@volter/editor 0.5.60 → 0.5.62

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.
Files changed (65) hide show
  1. package/BUNDLED_NOTICES +6 -6
  2. package/dist/.vite/manifest.json +210 -210
  3. package/dist/assets/{AudioViewer-C9JP7n49.js → AudioViewer-_65u1JZP.js} +1 -1
  4. package/dist/assets/{EntityModelDocument-SFgsuX4_.js → EntityModelDocument-B01ItUUL.js} +1 -1
  5. package/dist/assets/{EnvironmentAssetDocument-DEqKuki2.js → EnvironmentAssetDocument-Bi3xStlu.js} +1 -1
  6. package/dist/assets/{GameplaySessionTimeline-BtEPIu2F.js → GameplaySessionTimeline-DrwkiTxs.js} +1 -1
  7. package/dist/assets/{ImageViewer-CyIXlQTG.js → ImageViewer-CxxsCkXk.js} +1 -1
  8. package/dist/assets/{InspectorObjectPreview-MDmTPFBT.js → InspectorObjectPreview-DHQ7UhMS.js} +1 -1
  9. package/dist/assets/{JsonAssetDocument-Zyv_CDpC.js → JsonAssetDocument-4RfU5RS8.js} +1 -1
  10. package/dist/assets/{ModelAssetDocument-BKdnWaJL.js → ModelAssetDocument-C0WYRlmP.js} +1 -1
  11. package/dist/assets/{NonThreeAuthoringBootstrap-ab96Xbnn.js → NonThreeAuthoringBootstrap-kBoH9ZCc.js} +2 -2
  12. package/dist/assets/{Object3DPreview-ChopdNF4.js → Object3DPreview-Df_6xVfz.js} +2 -2
  13. package/dist/assets/{OnlineAssetDetail-B_l8XkeE.js → OnlineAssetDetail-Bl-DFUDz.js} +2 -2
  14. package/dist/assets/{SourceAssetViewer-zpxF5DOe.js → SourceAssetViewer-Dq5hik7X.js} +2 -2
  15. package/dist/assets/{StageHost-B4P-uvV9.js → StageHost-CjZBoXiO.js} +4 -4
  16. package/dist/assets/{ToolObject3DPreview-DGcT5dDK.js → ToolObject3DPreview-DDdFF5Hq.js} +1 -1
  17. package/dist/assets/{TransientHint-9_u15mth.js → TransientHint-Cut0DwSC.js} +1 -1
  18. package/dist/assets/{VideoViewer-3I_zUWEC.js → VideoViewer-DOhDskaJ.js} +1 -1
  19. package/dist/assets/{asset-editor-persistence-B6Yg7dTC.js → asset-editor-persistence-Cy4ncL8Y.js} +1 -1
  20. package/dist/assets/{blender-node-editor.document-DGn6U6Kf.js → blender-node-editor.document-DZX8R9UW.js} +1 -1
  21. package/dist/assets/blender-properties-tab-DO8ngdEa.js +3 -0
  22. package/dist/assets/blender-runtime-host-CZ0ICcqX.js +4 -0
  23. package/dist/assets/{blender-runtime-skin-BFLh4nHG.js → blender-runtime-skin-iZ5_55m6.js} +1 -1
  24. package/dist/assets/{blender-runtime.document-C60VEa1_.js → blender-runtime.document-e6XwhZtK.js} +1 -1
  25. package/dist/assets/{blender-timeline.document-D9BOYb0q.js → blender-timeline.document-Ct8EdSSf.js} +1 -1
  26. package/dist/assets/{blender-uv-editor.document-BK2pP2sR.js → blender-uv-editor.document-DmstRCpx.js} +1 -1
  27. package/dist/assets/{blender-version.status-ZqfW0upF.js → blender-version.status-DAnsMAXI.js} +1 -1
  28. package/dist/assets/{blender.command-BLtAEuIZ.js → blender.command-C7eRl9Wc.js} +1 -1
  29. package/dist/assets/{browserAll-DTuU4PmC.js → browserAll-DdupNJVI.js} +1 -1
  30. package/dist/assets/{edit-mode-authoring-DBEoND0w.js → edit-mode-authoring-D-tlcyhW.js} +1 -1
  31. package/dist/assets/{hosted-asset-materialization-6HtWQ0od.js → hosted-asset-materialization-DrhYnKEA.js} +1 -1
  32. package/dist/assets/{index-DuB3wHKD.js → index-DGwLrPW2.js} +346 -346
  33. package/dist/assets/{models.finder-Bs46IncP.js → models.finder-D4-OsuPY.js} +1 -1
  34. package/dist/assets/{product-FSoI1WhZ.js → product-1wO3CqY2.js} +1 -1
  35. package/dist/assets/{properties-bone-constraints.inspector-QML_-0yQ.js → properties-bone-constraints.inspector-Tu4aGcUC.js} +1 -1
  36. package/dist/assets/{properties-bone.inspector-DSDyP6-P.js → properties-bone.inspector-BTw6Ydqp.js} +1 -1
  37. package/dist/assets/{properties-collection.inspector-jic5mzgz.js → properties-collection.inspector-DS_MJGmP.js} +1 -1
  38. package/dist/assets/{properties-constraints.inspector-TLHv00p7.js → properties-constraints.inspector-DDHQ3IsG.js} +1 -1
  39. package/dist/assets/{properties-data.inspector-BJBPl88V.js → properties-data.inspector-CU_ptAXu.js} +1 -1
  40. package/dist/assets/{properties-material.inspector-xxWuVjrx.js → properties-material.inspector-K_490mzj.js} +1 -1
  41. package/dist/assets/{properties-modifiers.inspector-CWjdmu_J.js → properties-modifiers.inspector-C9W-DSy6.js} +1 -1
  42. package/dist/assets/{properties-object.inspector-D15l44Tq.js → properties-object.inspector-BSKPM6mE.js} +1 -1
  43. package/dist/assets/{properties-output.inspector-DVuGGSBb.js → properties-output.inspector-BiCs3V_B.js} +1 -1
  44. package/dist/assets/{properties-particles.inspector-B94x32Ez.js → properties-particles.inspector-xr6tE5xr.js} +1 -1
  45. package/dist/assets/{properties-physics.inspector-9EYMjwFP.js → properties-physics.inspector-CM4hbWT8.js} +1 -1
  46. package/dist/assets/{properties-render.inspector-8yA_8luD.js → properties-render.inspector-q33hbi-N.js} +1 -1
  47. package/dist/assets/{properties-scene.inspector-WM7qZhJ4.js → properties-scene.inspector-CsL8eJwX.js} +1 -1
  48. package/dist/assets/{properties-texture.inspector-Cno5lCIz.js → properties-texture.inspector-Cc1rNJN6.js} +1 -1
  49. package/dist/assets/{properties-view-layer.inspector--PX0c9h6.js → properties-view-layer.inspector-Clpi3vl_.js} +1 -1
  50. package/dist/assets/{properties-world.inspector-C3EuydM_.js → properties-world.inspector-B8WhdUCj.js} +1 -1
  51. package/dist/assets/{react-story-board-d_OfX68Z.js → react-story-board-Dz4z1udM.js} +1 -1
  52. package/dist/assets/{react-three-rapier.esm-Ch_Gf2qR.js → react-three-rapier.esm-Cs9qhWCS.js} +1 -1
  53. package/dist/assets/{spark.module-B_-x7Z29.js → spark.module-CjQpY2Op.js} +1 -1
  54. package/dist/assets/{stage-keyboard-C9wzGFxu.js → stage-keyboard-BqXYO1Lq.js} +1 -1
  55. package/dist/assets/{stage-overlay-set-D7J-N5eX.js → stage-overlay-set-Ca7_4aZA.js} +1 -1
  56. package/dist/assets/{stage-presence-markers-DvbNl1W4.js → stage-presence-markers-A2CQsGTy.js} +1 -1
  57. package/dist/assets/{story-capture-D0H-H2_b.js → story-capture-t1kkknek.js} +1 -1
  58. package/dist/assets/{story-pixi-preview-Cafk1Xbk.js → story-pixi-preview-DxsuWuR0.js} +1 -1
  59. package/dist/assets/{story-three-preview-ByMTQc8w.js → story-three-preview-Bz5tElwm.js} +2 -2
  60. package/dist/assets/{webworkerAll-CS1yjkoi.js → webworkerAll-6TTdOa6N.js} +1 -1
  61. package/dist/assets/{world-documents-CWiw361z.js → world-documents-DCnT6IOG.js} +1 -1
  62. package/dist-node/cli.js +7 -7
  63. package/package.json +7 -7
  64. package/dist/assets/blender-properties-tab-DkE9ensL.js +0 -3
  65. package/dist/assets/blender-runtime-host-JKPuUKtZ.js +0 -4
@@ -1 +1 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{t as r,B as k,C as w,R as z,S as C}from"./index-DuB3wHKD.js";import"./index-D2LwEE0L.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";const m={fontSize:11,color:r.content.dim,marginBottom:2};function M({assetPath:s}){const i=l.useRef(null),[a,p]=l.useState(!1),[n,f]=l.useState(null),[c,x]=l.useState(0),[h,g]=l.useState(!1),[v,y]=l.useState(1),j=s.split("/").pop()??s,b=s.split(".").pop()?.toUpperCase()??"";l.useEffect(()=>()=>{i.current?.pause()},[]);const S=()=>{const t=i.current;t&&(a?t.pause():t.play(),p(!a))},d=t=>{const o=Math.floor(t/60),u=Math.floor(t%60);return`${o}:${u.toString().padStart(2,"0")}`};return e.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[e.jsx("div",{style:{fontWeight:600,fontSize:12,color:r.content.primary,wordBreak:"break-all"},children:j}),e.jsxs("div",{className:"vgai-content-frost",style:{width:"100%",border:`1px solid ${r.boundary.default}`,borderRadius:r.shape.small,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:8,padding:16},children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:48,height:48,children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",fill:"var(--vgai-asset-icon-audio)"}),e.jsx("path",{d:"M9 8l4-2v12l-4-2H7V10h2zm6 1v6m2-5v4",stroke:"var(--vgai-text-1)",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"})]}),n!=null&&e.jsxs("div",{style:{width:"100%",fontSize:10,color:r.content.muted,textAlign:"center"},children:[d(c)," / ",d(n)]}),n!=null&&n>0&&e.jsx("div",{style:{width:"100%",height:4,background:r.surface.raised,borderRadius:r.shape.small,cursor:"pointer",position:"relative"},onClick:t=>{const o=t.currentTarget.getBoundingClientRect(),u=(t.clientX-o.left)/o.width;i.current&&(i.current.currentTime=u*n)},children:e.jsx("div",{style:{width:`${c/n*100}%`,height:"100%",background:"var(--vgai-asset-icon-audio)",borderRadius:r.shape.small}})}),e.jsx(k,{type:"button",variant:"secondary",size:"comfortable",onClick:S,children:a?"Pause":"Play"}),e.jsx("div",{role:"img","aria-label":"Audio waveform",style:{width:"100%",height:36,display:"flex",alignItems:"center",gap:2},children:Array.from({length:48},(t,o)=>e.jsx("i",{style:{flex:1,height:`${20+o*37%75}%`,background:"var(--vgai-asset-icon-audio)",opacity:o/48<=c/(n||1)?1:.3}},o))}),e.jsxs("label",{style:{fontSize:11,color:r.content.muted},children:[e.jsx(w,{checked:h,onChange:t=>g(t.target.checked)})," Loop"]}),e.jsxs("label",{style:{fontSize:11,color:r.content.muted},children:["Volume"," ",e.jsx(z,{"aria-label":"Audio volume",min:"0",max:"1",step:"0.05",value:v,onChange:t=>{const o=Number(t.target.value);y(o),i.current&&(i.current.volume=o)}})]})]}),e.jsx("audio",{ref:i,src:s,loop:h,onLoadedMetadata:()=>{i.current&&f(i.current.duration)},onTimeUpdate:()=>{i.current&&x(i.current.currentTime)},onEnded:()=>p(!1)}),e.jsx(C,{label:"Info",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Path"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary,wordBreak:"break-all"},children:s})]}),n!=null&&e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Duration"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary},children:d(n)})]}),e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Format"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary},children:b})]})]})})]})}export{M as AudioViewer};
1
+ import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{t as r,B as k,C as w,R as z,S as C}from"./index-DGwLrPW2.js";import"./index-D2LwEE0L.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";const m={fontSize:11,color:r.content.dim,marginBottom:2};function M({assetPath:s}){const i=l.useRef(null),[a,p]=l.useState(!1),[n,f]=l.useState(null),[c,x]=l.useState(0),[h,g]=l.useState(!1),[v,y]=l.useState(1),j=s.split("/").pop()??s,b=s.split(".").pop()?.toUpperCase()??"";l.useEffect(()=>()=>{i.current?.pause()},[]);const S=()=>{const t=i.current;t&&(a?t.pause():t.play(),p(!a))},d=t=>{const o=Math.floor(t/60),u=Math.floor(t%60);return`${o}:${u.toString().padStart(2,"0")}`};return e.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[e.jsx("div",{style:{fontWeight:600,fontSize:12,color:r.content.primary,wordBreak:"break-all"},children:j}),e.jsxs("div",{className:"vgai-content-frost",style:{width:"100%",border:`1px solid ${r.boundary.default}`,borderRadius:r.shape.small,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:8,padding:16},children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:48,height:48,children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",fill:"var(--vgai-asset-icon-audio)"}),e.jsx("path",{d:"M9 8l4-2v12l-4-2H7V10h2zm6 1v6m2-5v4",stroke:"var(--vgai-text-1)",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"})]}),n!=null&&e.jsxs("div",{style:{width:"100%",fontSize:10,color:r.content.muted,textAlign:"center"},children:[d(c)," / ",d(n)]}),n!=null&&n>0&&e.jsx("div",{style:{width:"100%",height:4,background:r.surface.raised,borderRadius:r.shape.small,cursor:"pointer",position:"relative"},onClick:t=>{const o=t.currentTarget.getBoundingClientRect(),u=(t.clientX-o.left)/o.width;i.current&&(i.current.currentTime=u*n)},children:e.jsx("div",{style:{width:`${c/n*100}%`,height:"100%",background:"var(--vgai-asset-icon-audio)",borderRadius:r.shape.small}})}),e.jsx(k,{type:"button",variant:"secondary",size:"comfortable",onClick:S,children:a?"Pause":"Play"}),e.jsx("div",{role:"img","aria-label":"Audio waveform",style:{width:"100%",height:36,display:"flex",alignItems:"center",gap:2},children:Array.from({length:48},(t,o)=>e.jsx("i",{style:{flex:1,height:`${20+o*37%75}%`,background:"var(--vgai-asset-icon-audio)",opacity:o/48<=c/(n||1)?1:.3}},o))}),e.jsxs("label",{style:{fontSize:11,color:r.content.muted},children:[e.jsx(w,{checked:h,onChange:t=>g(t.target.checked)})," Loop"]}),e.jsxs("label",{style:{fontSize:11,color:r.content.muted},children:["Volume"," ",e.jsx(z,{"aria-label":"Audio volume",min:"0",max:"1",step:"0.05",value:v,onChange:t=>{const o=Number(t.target.value);y(o),i.current&&(i.current.volume=o)}})]})]}),e.jsx("audio",{ref:i,src:s,loop:h,onLoadedMetadata:()=>{i.current&&f(i.current.duration)},onTimeUpdate:()=>{i.current&&x(i.current.currentTime)},onEnded:()=>p(!1)}),e.jsx(C,{label:"Info",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Path"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary,wordBreak:"break-all"},children:s})]}),n!=null&&e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Duration"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary},children:d(n)})]}),e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Format"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary},children:b})]})]})})]})}export{M as AudioViewer};
@@ -1 +1 @@
1
- import{a as c}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{u as f,t as v,c as S,b,d as x,g as u}from"./index-DuB3wHKD.js";import"./index-D2LwEE0L.js";import{O as g}from"./StageHost-B4P-uvV9.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-BHxt84w6.js";import"./LineSegments2-vfeDUBfs.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function h(i){const t=new Set;return i.traverse(r=>{const s=u(r,"_animationRuntime");if(s)for(const o of s.clips.values())t.add(o);const e=u(r,"_animClips");if(e)for(const o of e.values())t.add(o);for(const o of r.animations)t.add(o)}),[...t]}function w({documentId:i,source:t,sourcePath:r,displayName:s,active:e,chromeless:o=!1,revision:n=0,modelSource:p}){const d=l.useCallback(()=>{const a=S(b(t)),m=h(t);return a.animations=[...m],{root:a,animations:m,dispose(){x(a)}}},[t,n]);return c.jsx(g,{documentId:i,sourcePath:r??s,displayName:s,build:d,active:e,chromeless:o,rendererLane:o?"inspector-preview":"own",assetType:"entity",...p?{modelSource:p}:{}})}function $({documentId:i,entityId:t,displayName:r,active:s}){const e=f(),o=l.useSyncExternalStore(e.subscribe,e.getSnapshot),n=e.objectMap.get(t);return n?c.jsx(w,{documentId:i,source:n,sourcePath:`Entity ${t}`,displayName:r,active:s,revision:o,modelSource:{kind:"entity",entityId:t}}):c.jsxs("div",{role:"alert",style:{padding:20,color:v.semantic.danger},children:["Scene entity ",t," is no longer available."]})}export{$ as EntityModelDocument,w as Object3DSnapshotDocument};
1
+ import{a as c}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{u as f,t as v,c as S,b,d as x,g as u}from"./index-DGwLrPW2.js";import"./index-D2LwEE0L.js";import{O as g}from"./StageHost-CjZBoXiO.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-BHxt84w6.js";import"./LineSegments2-vfeDUBfs.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function h(i){const t=new Set;return i.traverse(r=>{const s=u(r,"_animationRuntime");if(s)for(const o of s.clips.values())t.add(o);const e=u(r,"_animClips");if(e)for(const o of e.values())t.add(o);for(const o of r.animations)t.add(o)}),[...t]}function w({documentId:i,source:t,sourcePath:r,displayName:s,active:e,chromeless:o=!1,revision:n=0,modelSource:p}){const d=l.useCallback(()=>{const a=S(b(t)),m=h(t);return a.animations=[...m],{root:a,animations:m,dispose(){x(a)}}},[t,n]);return c.jsx(g,{documentId:i,sourcePath:r??s,displayName:s,build:d,active:e,chromeless:o,rendererLane:o?"inspector-preview":"own",assetType:"entity",...p?{modelSource:p}:{}})}function $({documentId:i,entityId:t,displayName:r,active:s}){const e=f(),o=l.useSyncExternalStore(e.subscribe,e.getSnapshot),n=e.objectMap.get(t);return n?c.jsx(w,{documentId:i,source:n,sourcePath:`Entity ${t}`,displayName:r,active:s,revision:o,modelSource:{kind:"entity",entityId:t}}):c.jsxs("div",{role:"alert",style:{padding:20,color:v.semantic.danger},children:["Scene entity ",t," is no longer available."]})}export{$ as EntityModelDocument,w as Object3DSnapshotDocument};
@@ -1,4 +1,4 @@
1
- import{a as T}from"./jsx-runtime-DPjLkJKQ.js";import{aD as Xn,aE as jn,aF as $n,aG as Kn,t as Ce,aH as Ke,aI as Pe}from"./index-DuB3wHKD.js";import{r as ue}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{b0 as mn,H as Ee,v as Re,ac as ke,p as we,O as Ze,F as Ae,L as Ye,b9 as xe,bn as qn,aV as Vn,i as Jn,aW as Qn,w as et,k as nt,d as tt,bo as ot,b1 as rt,a0 as qe,am as ze,bp as Ve,bq as st,b as it}from"./three.module-BynznMJN.js";import{O as lt}from"./OrbitControls-BHxt84w6.js";import{u as Ge}from"./fflate.module-DPuTF8aG.js";import{s as ct}from"./asset-editor-persistence-B6Yg7dTC.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";class at extends mn{constructor(g){super(g),this.type=Ee,this.outputFormat=Re}parse(g){const N=Math.pow(2.7182818,2.2);function k(e,n){let t=0;for(let s=0;s<65536;++s)(s==0||e[s>>3]&1<<(s&7))&&(n[t++]=s);const r=t-1;for(;t<65536;)n[t++]=0;return r}function P(e){for(let n=0;n<16384;n++)e[n]={},e[n].len=0,e[n].lit=0,e[n].p=null}const U={l:0,c:0,lc:0};function z(e,n,t,r,s){for(;t<e;)n=n<<8|an(r,s),t+=8;t-=e,U.l=n>>t&(1<<e)-1,U.c=n,U.lc=t}const I=new Array(59);function W(e){for(let t=0;t<=58;++t)I[t]=0;for(let t=0;t<65537;++t)I[e[t]]+=1;let n=0;for(let t=58;t>0;--t){const r=n+I[t]>>1;I[t]=n,n=r}for(let t=0;t<65537;++t){const r=e[t];r>0&&(e[t]=r|I[r]++<<6)}}function O(e,n,t,r,s,a){const o=n;let u=0,l=0;for(;r<=s;r++){if(o.value-n.value>t)return!1;z(6,u,l,e,o);const i=U.l;if(u=U.c,l=U.lc,a[r]=i,i==63){if(o.value-n.value>t)throw new Error("Something wrong with hufUnpackEncTable");z(8,u,l,e,o);let c=U.l+6;if(u=U.c,l=U.lc,r+c>s+1)throw new Error("Something wrong with hufUnpackEncTable");for(;c--;)a[r++]=0;r--}else if(i>=59){let c=i-59+2;if(r+c>s+1)throw new Error("Something wrong with hufUnpackEncTable");for(;c--;)a[r++]=0;r--}}W(a)}function pe(e){return e&63}function Ue(e){return e>>6}function ye(e,n,t,r){for(;n<=t;n++){const s=Ue(e[n]),a=pe(e[n]);if(s>>a)throw new Error("Invalid table entry");if(a>14){const o=r[s>>a-14];if(o.len)throw new Error("Invalid table entry");if(o.lit++,o.p){const u=o.p;o.p=new Array(o.lit);for(let l=0;l<o.lit-1;++l)o.p[l]=u[l]}else o.p=new Array(1);o.p[o.lit-1]=n}else if(a){let o=0;for(let u=1<<14-a;u>0;u--){const l=r[(s<<14-a)+o];if(l.len||l.p)throw new Error("Invalid table entry");l.len=a,l.lit=n,o++}}}return!0}const K={c:0,lc:0};function Te(e,n,t,r){e=e<<8|an(t,r),n+=8,K.c=e,K.lc=n}const q={c:0,lc:0};function oe(e,n,t,r,s,a,o,u,l){if(e==n){r<8&&(Te(t,r,s,a),t=K.c,r=K.lc),r-=8;let i=t>>r;if(i=new Uint8Array([i])[0],u.value+i>l)return!1;const c=o[u.value-1];for(;i-- >0;)o[u.value++]=c}else if(u.value<l)o[u.value++]=e;else return!1;q.c=t,q.lc=r}function ve(e){return e&65535}function Je(e){const n=ve(e);return n>32767?n-65536:n}const Z={a:0,b:0};function Ie(e,n){const t=Je(e),s=Je(n),a=t+(s&1)+(s>>1),o=a,u=a-s;Z.a=o,Z.b=u}function be(e,n){const t=ve(e),r=ve(n),s=t-(r>>1)&65535,a=r+s-32768&65535;Z.a=a,Z.b=s}function dn(e,n,t,r,s,a,o){const u=o<16384,l=t>s?s:t;let i=1,c,p;for(;i<=l;)i<<=1;for(i>>=1,c=i,i>>=1;i>=1;){p=0;const h=p+a*(s-c),d=a*i,E=a*c,m=r*i,w=r*c;let y,A,L,$;for(;p<=h;p+=E){let D=p;const v=p+r*(t-c);for(;D<=v;D+=w){const G=D+m,V=D+d,B=V+m;u?(Ie(e[D+n],e[V+n]),y=Z.a,L=Z.b,Ie(e[G+n],e[B+n]),A=Z.a,$=Z.b,Ie(y,A),e[D+n]=Z.a,e[G+n]=Z.b,Ie(L,$),e[V+n]=Z.a,e[B+n]=Z.b):(be(e[D+n],e[V+n]),y=Z.a,L=Z.b,be(e[G+n],e[B+n]),A=Z.a,$=Z.b,be(y,A),e[D+n]=Z.a,e[G+n]=Z.b,be(L,$),e[V+n]=Z.a,e[B+n]=Z.b)}if(t&i){const G=D+d;u?Ie(e[D+n],e[G+n]):be(e[D+n],e[G+n]),y=Z.a,e[G+n]=Z.b,e[D+n]=y}}if(s&i){let D=p;const v=p+r*(t-c);for(;D<=v;D+=w){const G=D+m;u?Ie(e[D+n],e[G+n]):be(e[D+n],e[G+n]),y=Z.a,e[G+n]=Z.b,e[D+n]=y}}c=i,i>>=1}return p}function fn(e,n,t,r,s,a,o,u,l){let i=0,c=0;const p=o,h=Math.trunc(r.value+(s+7)/8);for(;r.value<h;)for(Te(i,c,t,r),i=K.c,c=K.lc;c>=14;){const E=i>>c-14&16383,m=n[E];if(m.len)c-=m.len,oe(m.lit,a,i,c,t,r,u,l,p),i=q.c,c=q.lc;else{if(!m.p)throw new Error("hufDecode issues");let w;for(w=0;w<m.lit;w++){const y=pe(e[m.p[w]]);for(;c<y&&r.value<h;)Te(i,c,t,r),i=K.c,c=K.lc;if(c>=y&&Ue(e[m.p[w]])==(i>>c-y&(1<<y)-1)){c-=y,oe(m.p[w],a,i,c,t,r,u,l,p),i=q.c,c=q.lc;break}}if(w==m.lit)throw new Error("hufDecode issues")}}const d=8-s&7;for(i>>=d,c-=d;c>0;){const E=n[i<<14-c&16383];if(E.len)c-=E.len,oe(E.lit,a,i,c,t,r,u,l,p),i=q.c,c=q.lc;else throw new Error("hufDecode issues")}return!0}function Qe(e,n,t,r,s,a){const o={value:0},u=t.value,l=ie(n,t),i=ie(n,t);t.value+=4;const c=ie(n,t);if(t.value+=4,l<0||l>=65537||i<0||i>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const p=new Array(65537),h=new Array(16384);P(h);const d=r-(t.value-u);if(O(e,t,d,l,i,p),c>8*(r-(t.value-u)))throw new Error("Something wrong with hufUncompress");ye(p,l,i,h),fn(p,h,e,t,c,i,a,s,o)}function wn(e,n,t){for(let r=0;r<t;++r)n[r]=e[n[r]]}function en(e){for(let n=1;n<e.length;n++){const t=e[n-1]+e[n]-128;e[n]=t}}function nn(e,n){let t=0,r=Math.floor((e.length+1)/2),s=0;const a=e.length-1;for(;!(s>a||(n[s++]=e[t++],s>a));)n[s++]=e[r++]}function tn(e){let n=e.byteLength;const t=new Array;let r=0;const s=new DataView(e);for(;n>0;){const a=s.getInt8(r++);if(a<0){const o=-a;n-=o+1;for(let u=0;u<o;u++)t.push(s.getUint8(r++))}else{const o=a;n-=2;const u=s.getUint8(r++);for(let l=0;l<o+1;l++)t.push(u)}}return t}function En(e,n,t,r,s,a){let o=new DataView(a.buffer);const u=t[e.idx[0]].width,l=t[e.idx[0]].height,i=3,c=Math.floor(u/8),p=Math.ceil(u/8),h=Math.ceil(l/8),d=u-(p-1)*8,E=l-(h-1)*8,m={value:0},w=new Array(i),y=new Array(i),A=new Array(i),L=new Array(i),$=new Array(i);for(let v=0;v<i;++v)$[v]=n[e.idx[v]],w[v]=v<1?0:w[v-1]+p*h,y[v]=new Float32Array(64),A[v]=new Uint16Array(64),L[v]=new Uint16Array(p*64);for(let v=0;v<h;++v){let G=8;v==h-1&&(G=E);let V=8;for(let C=0;C<p;++C){C==p-1&&(V=d);for(let F=0;F<i;++F)A[F].fill(0),A[F][0]=s[w[F]++],on(m,r,A[F]),rn(A[F],y[F]),sn(y[F]);yn(y);for(let F=0;F<i;++F)ln(y[F],L[F],C*64)}let B=0;for(let C=0;C<i;++C){const F=t[e.idx[C]].type;for(let me=8*v;me<8*v+G;++me){B=$[C][me];for(let De=0;De<c;++De){const ae=De*64+(me&7)*8;o.setUint16(B+0*F,L[C][ae+0],!0),o.setUint16(B+2*F,L[C][ae+1],!0),o.setUint16(B+4*F,L[C][ae+2],!0),o.setUint16(B+6*F,L[C][ae+3],!0),o.setUint16(B+8*F,L[C][ae+4],!0),o.setUint16(B+10*F,L[C][ae+5],!0),o.setUint16(B+12*F,L[C][ae+6],!0),o.setUint16(B+14*F,L[C][ae+7],!0),B+=16*F}}if(c!=p)for(let me=8*v;me<8*v+G;++me){const De=$[C][me]+8*c*2*F,ae=c*64+(me&7)*8;for(let He=0;He<V;++He)o.setUint16(De+He*2*F,L[C][ae+He],!0)}}}const D=new Uint16Array(u);o=new DataView(a.buffer);for(let v=0;v<i;++v){t[e.idx[v]].decoded=!0;const G=t[e.idx[v]].type;if(t[v].type==2)for(let V=0;V<l;++V){const B=$[v][V];for(let C=0;C<u;++C)D[C]=o.getUint16(B+C*2*G,!0);for(let C=0;C<u;++C)o.setFloat32(B+C*2*G,f(D[C]),!0)}}}function gn(e,n,t,r,s,a){const o=new DataView(a.buffer),u=t[e],l=u.width,i=u.height,c=Math.ceil(l/8),p=Math.ceil(i/8),h=Math.floor(l/8),d=l-(c-1)*8,E=i-(p-1)*8,m={value:0};let w=0;const y=new Float32Array(64),A=new Uint16Array(64),L=new Uint16Array(c*64);for(let $=0;$<p;++$){let D=8;$==p-1&&(D=E);for(let v=0;v<c;++v)A.fill(0),A[0]=s[w++],on(m,r,A),rn(A,y),sn(y),ln(y,L,v*64);for(let v=8*$;v<8*$+D;++v){let G=n[e][v];for(let V=0;V<h;++V){const B=V*64+(v&7)*8;for(let C=0;C<8;++C)o.setUint16(G+C*2*u.type,L[B+C],!0);G+=16*u.type}if(c!=h){const V=h*64+(v&7)*8;for(let B=0;B<d;++B)o.setUint16(G+B*2*u.type,L[V+B],!0)}}}u.decoded=!0}function on(e,n,t){let r,s=1;for(;s<64;)r=n[e.value],r==65280?s=64:r>>8==255?s+=r&255:(t[s]=r,s++),e.value++}function rn(e,n){n[0]=f(e[0]),n[1]=f(e[1]),n[2]=f(e[5]),n[3]=f(e[6]),n[4]=f(e[14]),n[5]=f(e[15]),n[6]=f(e[27]),n[7]=f(e[28]),n[8]=f(e[2]),n[9]=f(e[4]),n[10]=f(e[7]),n[11]=f(e[13]),n[12]=f(e[16]),n[13]=f(e[26]),n[14]=f(e[29]),n[15]=f(e[42]),n[16]=f(e[3]),n[17]=f(e[8]),n[18]=f(e[12]),n[19]=f(e[17]),n[20]=f(e[25]),n[21]=f(e[30]),n[22]=f(e[41]),n[23]=f(e[43]),n[24]=f(e[9]),n[25]=f(e[11]),n[26]=f(e[18]),n[27]=f(e[24]),n[28]=f(e[31]),n[29]=f(e[40]),n[30]=f(e[44]),n[31]=f(e[53]),n[32]=f(e[10]),n[33]=f(e[19]),n[34]=f(e[23]),n[35]=f(e[32]),n[36]=f(e[39]),n[37]=f(e[45]),n[38]=f(e[52]),n[39]=f(e[54]),n[40]=f(e[20]),n[41]=f(e[22]),n[42]=f(e[33]),n[43]=f(e[38]),n[44]=f(e[46]),n[45]=f(e[51]),n[46]=f(e[55]),n[47]=f(e[60]),n[48]=f(e[21]),n[49]=f(e[34]),n[50]=f(e[37]),n[51]=f(e[47]),n[52]=f(e[50]),n[53]=f(e[56]),n[54]=f(e[59]),n[55]=f(e[61]),n[56]=f(e[35]),n[57]=f(e[36]),n[58]=f(e[48]),n[59]=f(e[49]),n[60]=f(e[57]),n[61]=f(e[58]),n[62]=f(e[62]),n[63]=f(e[63])}function sn(e){const n=.5*Math.cos(.7853975),t=.5*Math.cos(3.14159/16),r=.5*Math.cos(3.14159/8),s=.5*Math.cos(3*3.14159/16),a=.5*Math.cos(5*3.14159/16),o=.5*Math.cos(3*3.14159/8),u=.5*Math.cos(7*3.14159/16),l=new Array(4),i=new Array(4),c=new Array(4),p=new Array(4);for(let h=0;h<8;++h){const d=h*8;l[0]=r*e[d+2],l[1]=o*e[d+2],l[2]=r*e[d+6],l[3]=o*e[d+6],i[0]=t*e[d+1]+s*e[d+3]+a*e[d+5]+u*e[d+7],i[1]=s*e[d+1]-u*e[d+3]-t*e[d+5]-a*e[d+7],i[2]=a*e[d+1]-t*e[d+3]+u*e[d+5]+s*e[d+7],i[3]=u*e[d+1]-a*e[d+3]+s*e[d+5]-t*e[d+7],c[0]=n*(e[d+0]+e[d+4]),c[3]=n*(e[d+0]-e[d+4]),c[1]=l[0]+l[3],c[2]=l[1]-l[2],p[0]=c[0]+c[1],p[1]=c[3]+c[2],p[2]=c[3]-c[2],p[3]=c[0]-c[1],e[d+0]=p[0]+i[0],e[d+1]=p[1]+i[1],e[d+2]=p[2]+i[2],e[d+3]=p[3]+i[3],e[d+4]=p[3]-i[3],e[d+5]=p[2]-i[2],e[d+6]=p[1]-i[1],e[d+7]=p[0]-i[0]}for(let h=0;h<8;++h)l[0]=r*e[16+h],l[1]=o*e[16+h],l[2]=r*e[48+h],l[3]=o*e[48+h],i[0]=t*e[8+h]+s*e[24+h]+a*e[40+h]+u*e[56+h],i[1]=s*e[8+h]-u*e[24+h]-t*e[40+h]-a*e[56+h],i[2]=a*e[8+h]-t*e[24+h]+u*e[40+h]+s*e[56+h],i[3]=u*e[8+h]-a*e[24+h]+s*e[40+h]-t*e[56+h],c[0]=n*(e[h]+e[32+h]),c[3]=n*(e[h]-e[32+h]),c[1]=l[0]+l[3],c[2]=l[1]-l[2],p[0]=c[0]+c[1],p[1]=c[3]+c[2],p[2]=c[3]-c[2],p[3]=c[0]-c[1],e[0+h]=p[0]+i[0],e[8+h]=p[1]+i[1],e[16+h]=p[2]+i[2],e[24+h]=p[3]+i[3],e[32+h]=p[3]-i[3],e[40+h]=p[2]-i[2],e[48+h]=p[1]-i[1],e[56+h]=p[0]-i[0]}function yn(e){for(let n=0;n<64;++n){const t=e[0][n],r=e[1][n],s=e[2][n];e[0][n]=t+1.5747*s,e[1][n]=t-.1873*r-.4682*s,e[2][n]=t+1.8556*r}}function ln(e,n,t){for(let r=0;r<64;++r)n[t+r]=xe.toHalfFloat(Sn(e[r]))}function Sn(e){return e<=1?Math.sign(e)*Math.pow(Math.abs(e),2.2):Math.sign(e)*Math.pow(N,Math.abs(e)-1)}function je(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function _n(e){const n=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),t=new Uint8Array(tn(n)),r=new Uint8Array(t.length);return en(t),nn(t,r),new DataView(r.buffer)}function $e(e){const n=e.array.slice(e.offset.value,e.offset.value+e.size),t=Ge(n),r=new Uint8Array(t.length);return en(t),nn(t,r),new DataView(r.buffer)}function vn(e){const n=e.viewer,t={value:e.offset.value},r=new Uint16Array(e.columns*e.lines*(e.inputChannels.length*e.type)),s=new Uint8Array(8192);let a=0;const o=new Array(e.inputChannels.length);for(let E=0,m=e.inputChannels.length;E<m;E++)o[E]={},o[E].start=a,o[E].end=o[E].start,o[E].nx=e.columns,o[E].ny=e.lines,o[E].size=e.type,a+=o[E].nx*o[E].ny*o[E].size;const u=Oe(n,t),l=Oe(n,t);if(l>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(u<=l)for(let E=0;E<l-u+1;E++)s[E+u]=de(n,t);const i=new Uint16Array(65536),c=k(s,i),p=ie(n,t);Qe(e.array,n,t,p,r,a);for(let E=0;E<e.inputChannels.length;++E){const m=o[E];for(let w=0;w<o[E].size;++w)dn(r,m.start+w,m.nx,m.size,m.ny,m.nx*m.size,c)}wn(i,r,a);let h=0;const d=new Uint8Array(r.buffer.byteLength);for(let E=0;E<e.lines;E++)for(let m=0;m<e.inputChannels.length;m++){const w=o[m],y=w.nx*w.size,A=new Uint8Array(r.buffer,w.end*2,y*2);d.set(A,h),h+=y*2,w.end+=y}return new DataView(d.buffer)}function In(e){const n=e.array.slice(e.offset.value,e.offset.value+e.size),t=Ge(n),r=e.inputChannels.length*e.lines*e.columns*e.totalBytes,s=new ArrayBuffer(r),a=new DataView(s);let o=0,u=0;const l=new Array(4);for(let i=0;i<e.lines;i++)for(let c=0;c<e.inputChannels.length;c++){let p=0;switch(e.inputChannels[c].pixelType){case 1:l[0]=o,l[1]=l[0]+e.columns,o=l[1]+e.columns;for(let d=0;d<e.columns;++d){const E=t[l[0]++]<<8|t[l[1]++];p+=E,a.setUint16(u,p,!0),u+=2}break;case 2:l[0]=o,l[1]=l[0]+e.columns,l[2]=l[1]+e.columns,o=l[2]+e.columns;for(let d=0;d<e.columns;++d){const E=t[l[0]++]<<24|t[l[1]++]<<16|t[l[2]++]<<8;p+=E,a.setUint32(u,p,!0),u+=4}break}}return a}function cn(e){const n=e.viewer,t={value:e.offset.value},r=new Uint8Array(e.columns*e.lines*(e.inputChannels.length*e.type*2)),s={version:re(n,t),unknownUncompressedSize:re(n,t),unknownCompressedSize:re(n,t),acCompressedSize:re(n,t),dcCompressedSize:re(n,t),rleCompressedSize:re(n,t),rleUncompressedSize:re(n,t),rleRawSize:re(n,t),totalAcUncompressedCount:re(n,t),totalDcUncompressedCount:re(n,t),acCompression:re(n,t)};if(s.version<2)throw new Error("EXRLoader.parse: "+Se.compression+" version "+s.version+" is unsupported");const a=new Array;let o=Oe(n,t)-2;for(;o>0;){const m=Be(n.buffer,t),w=de(n,t),y=w>>2&3,A=(w>>4)-1,L=new Int8Array([A])[0],$=de(n,t);a.push({name:m,index:L,type:$,compression:y}),o-=m.length+3}const u=Se.channels,l=new Array(e.inputChannels.length);for(let m=0;m<e.inputChannels.length;++m){const w=l[m]={},y=u[m];w.name=y.name,w.compression=0,w.decoded=!1,w.type=y.pixelType,w.pLinear=y.pLinear,w.width=e.columns,w.height=e.lines}const i={idx:new Array(3)};for(let m=0;m<e.inputChannels.length;++m){const w=l[m];for(let y=0;y<a.length;++y){const A=a[y];w.name==A.name&&(w.compression=A.compression,A.index>=0&&(i.idx[A.index]=m),w.offset=m)}}let c,p,h;if(s.acCompressedSize>0)switch(s.acCompression){case 0:c=new Uint16Array(s.totalAcUncompressedCount),Qe(e.array,n,t,s.acCompressedSize,c,s.totalAcUncompressedCount);break;case 1:const m=e.array.slice(t.value,t.value+s.totalAcUncompressedCount),w=Ge(m);c=new Uint16Array(w.buffer),t.value+=s.totalAcUncompressedCount;break}if(s.dcCompressedSize>0){const m={array:e.array,offset:t,size:s.dcCompressedSize};p=new Uint16Array($e(m).buffer),t.value+=s.dcCompressedSize}if(s.rleRawSize>0){const m=e.array.slice(t.value,t.value+s.rleCompressedSize),w=Ge(m);h=tn(w.buffer),t.value+=s.rleCompressedSize}let d=0;const E=new Array(l.length);for(let m=0;m<E.length;++m)E[m]=new Array;for(let m=0;m<e.lines;++m)for(let w=0;w<l.length;++w)E[w].push(d),d+=l[w].width*e.type*2;i.idx[0]!==void 0&&l[i.idx[0]]&&En(i,E,l,c,p,r);for(let m=0;m<l.length;++m){const w=l[m];if(!w.decoded)switch(w.compression){case 2:let y=0,A=0;for(let L=0;L<e.lines;++L){let $=E[m][y];for(let D=0;D<w.width;++D){for(let v=0;v<2*w.type;++v)r[$++]=h[A+v*w.width*w.height];A++}y++}break;case 1:gn(m,E,l,c,p,r);break;default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(r.buffer)}function Be(e,n){const t=new Uint8Array(e);let r=0;for(;t[n.value+r]!=0;)r+=1;const s=new TextDecoder().decode(t.slice(n.value,n.value+r));return n.value=n.value+r+1,s}function bn(e,n,t){const r=new TextDecoder().decode(new Uint8Array(e).slice(n.value,n.value+t));return n.value=n.value+t,r}function Rn(e,n){const t=se(e,n),r=ie(e,n);return[t,r]}function Cn(e,n){const t=ie(e,n),r=ie(e,n);return[t,r]}function se(e,n){const t=e.getInt32(n.value,!0);return n.value=n.value+4,t}function ie(e,n){const t=e.getUint32(n.value,!0);return n.value=n.value+4,t}function an(e,n){const t=e[n.value];return n.value=n.value+1,t}function de(e,n){const t=e.getUint8(n.value);return n.value=n.value+1,t}const re=function(e,n){let t;return"getBigInt64"in DataView.prototype?t=Number(e.getBigInt64(n.value,!0)):t=e.getUint32(n.value+4,!0)+Number(e.getUint32(n.value,!0)<<32),n.value+=8,t};function ne(e,n){const t=e.getFloat32(n.value,!0);return n.value+=4,t}function xn(e,n){return xe.toHalfFloat(ne(e,n))}function f(e){const n=(e&31744)>>10,t=e&1023;return(e>>15?-1:1)*(n?n===31?t?NaN:1/0:Math.pow(2,n-15)*(1+t/1024):6103515625e-14*(t/1024))}function Oe(e,n){const t=e.getUint16(n.value,!0);return n.value+=2,t}function An(e,n){return f(Oe(e,n))}function Mn(e,n,t,r){const s=t.value,a=[];for(;t.value<s+r-1;){const o=Be(n,t),u=se(e,t),l=de(e,t);t.value+=3;const i=se(e,t),c=se(e,t);a.push({name:o,pixelType:u,pLinear:l,xSampling:i,ySampling:c})}return t.value+=1,a}function Nn(e,n){const t=ne(e,n),r=ne(e,n),s=ne(e,n),a=ne(e,n),o=ne(e,n),u=ne(e,n),l=ne(e,n),i=ne(e,n);return{redX:t,redY:r,greenX:s,greenY:a,blueX:o,blueY:u,whiteX:l,whiteY:i}}function Un(e,n){const t=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],r=de(e,n);return t[r]}function Tn(e,n){const t=se(e,n),r=se(e,n),s=se(e,n),a=se(e,n);return{xMin:t,yMin:r,xMax:s,yMax:a}}function On(e,n){const t=["INCREASING_Y","DECREASING_Y","RANDOM_Y"],r=de(e,n);return t[r]}function Dn(e,n){const t=["ENVMAP_LATLONG","ENVMAP_CUBE"],r=de(e,n);return t[r]}function kn(e,n){const t=["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"],r=["ROUND_DOWN","ROUND_UP"],s=ie(e,n),a=ie(e,n),o=de(e,n);return{xSize:s,ySize:a,levelMode:t[o&15],roundingMode:r[o>>4]}}function Ln(e,n){const t=ne(e,n),r=ne(e,n);return[t,r]}function Fn(e,n){const t=ne(e,n),r=ne(e,n),s=ne(e,n);return[t,r,s]}function Bn(e,n,t,r,s){if(r==="string"||r==="stringvector"||r==="iccProfile")return bn(n,t,s);if(r==="chlist")return Mn(e,n,t,s);if(r==="chromaticities")return Nn(e,t);if(r==="compression")return Un(e,t);if(r==="box2i")return Tn(e,t);if(r==="envmap")return Dn(e,t);if(r==="tiledesc")return kn(e,t);if(r==="lineOrder")return On(e,t);if(r==="float")return ne(e,t);if(r==="v2f")return Ln(e,t);if(r==="v3f")return Fn(e,t);if(r==="int")return se(e,t);if(r==="rational")return Rn(e,t);if(r==="timecode")return Cn(e,t);if(r==="preview")return t.value+=s,"skipped";t.value+=s}function Hn(e,n){const t=Math.log2(e);return n=="ROUND_DOWN"?Math.floor(t):Math.ceil(t)}function Pn(e,n,t){let r=0;switch(e.levelMode){case"ONE_LEVEL":r=1;break;case"MIPMAP_LEVELS":r=Hn(Math.max(n,t),e.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return r}function un(e,n,t,r){const s=new Array(e);for(let a=0;a<e;a++){const o=1<<a;let u=n/o|0;r=="ROUND_UP"&&u*o<n&&(u+=1);const l=Math.max(u,1);s[a]=(l+t-1)/t|0}return s}function Zn(){const e=this,n=e.offset,t={value:0};for(let r=0;r<e.tileCount;r++){const s=se(e.viewer,n),a=se(e.viewer,n);n.value+=8,e.size=ie(e.viewer,n);const o=s*e.blockWidth,u=a*e.blockHeight;e.columns=o+e.blockWidth>e.width?e.width-o:e.blockWidth,e.lines=u+e.blockHeight>e.height?e.height-u:e.blockHeight;const l=e.columns*e.totalBytes,c=e.size<e.lines*l?e.uncompress(e):je(e);n.value+=e.size;for(let p=0;p<e.lines;p++){const h=p*e.columns*e.totalBytes;for(let d=0;d<e.inputChannels.length;d++){const E=Se.channels[d].name,m=e.channelByteOffsets[E]*e.columns,w=e.decodeChannels[E];if(w===void 0)continue;t.value=h+m;const y=(e.height-(1+u+p))*e.outLineWidth;for(let A=0;A<e.columns;A++){const L=y+(A+o)*e.outputChannels+w;e.byteArray[L]=e.getter(c,t)}}}}}function zn(){const e=this,n=e.offset,t={value:0};for(let r=0;r<e.height/e.blockHeight;r++){const s=se(e.viewer,n)-Se.dataWindow.yMin;e.size=ie(e.viewer,n),e.lines=s+e.blockHeight>e.height?e.height-s:e.blockHeight;const a=e.columns*e.totalBytes,u=e.size<e.lines*a?e.uncompress(e):je(e);n.value+=e.size;for(let l=0;l<e.blockHeight;l++){const i=r*e.blockHeight,c=l+e.scanOrder(i);if(c>=e.height)continue;const p=l*a,h=(e.height-1-c)*e.outLineWidth;for(let d=0;d<e.inputChannels.length;d++){const E=Se.channels[d].name,m=e.channelByteOffsets[E]*e.columns,w=e.decodeChannels[E];if(w!==void 0){t.value=p+m;for(let y=0;y<e.columns;y++){const A=h+y*e.outputChannels+w;e.byteArray[A]=e.getter(u,t)}}}}}}function Gn(e,n,t){const r={};if(e.getUint32(0,!0)!=20000630)throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");r.version=e.getUint8(4);const s=e.getUint8(5);r.spec={singleTile:!!(s&2),longName:!!(s&4),deepFormat:!!(s&8),multiPart:!!(s&16)},t.value=8;let a=!0;for(;a;){const o=Be(n,t);if(o==="")a=!1;else{const u=Be(n,t),l=ie(e,t),i=Bn(e,n,t,u,l);i===void 0?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${u}'.`):r[o]=i}}if((s&-7)!=0)throw console.error("THREE.EXRHeader:",r),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return r}function Yn(e,n,t,r,s,a){const o={size:0,viewer:n,array:t,offset:r,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,inputChannels:e.channels,channelByteOffsets:{},shouldExpand:!1,scanOrder:null,totalBytes:null,columns:null,lines:null,type:null,uncompress:null,getter:null,format:null,colorSpace:we};switch(e.compression){case"NO_COMPRESSION":o.blockHeight=1,o.uncompress=je;break;case"RLE_COMPRESSION":o.blockHeight=1,o.uncompress=_n;break;case"ZIPS_COMPRESSION":o.blockHeight=1,o.uncompress=$e;break;case"ZIP_COMPRESSION":o.blockHeight=16,o.uncompress=$e;break;case"PIZ_COMPRESSION":o.blockHeight=32,o.uncompress=vn;break;case"PXR24_COMPRESSION":o.blockHeight=16,o.uncompress=In;break;case"DWAA_COMPRESSION":o.blockHeight=32,o.uncompress=cn;break;case"DWAB_COMPRESSION":o.blockHeight=256,o.uncompress=cn;break;default:throw new Error("EXRLoader.parse: "+e.compression+" is unsupported")}const u={};for(const h of e.channels)switch(h.name){case"Y":case"R":case"G":case"B":case"A":u[h.name]=!0,o.type=h.pixelType}let l=!1,i=!1;if(u.R&&u.G&&u.B)o.outputChannels=4;else if(u.Y)o.outputChannels=1;else throw new Error("EXRLoader.parse: file contains unsupported data channels.");switch(o.outputChannels){case 4:a==Re?(l=!u.A,o.format=Re,o.colorSpace=we,o.outputChannels=4,o.decodeChannels={R:0,G:1,B:2,A:3}):a==ke?(o.format=ke,o.colorSpace=we,o.outputChannels=2,o.decodeChannels={R:0,G:1}):a==Ze?(o.format=Ze,o.colorSpace=we,o.outputChannels=1,o.decodeChannels={R:0}):i=!0;break;case 1:a==Re?(l=!0,o.format=Re,o.colorSpace=we,o.outputChannels=4,o.shouldExpand=!0,o.decodeChannels={Y:0}):a==ke?(o.format=ke,o.colorSpace=we,o.outputChannels=2,o.shouldExpand=!0,o.decodeChannels={Y:0}):a==Ze?(o.format=Ze,o.colorSpace=we,o.outputChannels=1,o.decodeChannels={Y:0}):i=!0;break;default:i=!0}if(i)throw new Error("EXRLoader.parse: invalid output format for specified file.");if(o.type==1)switch(s){case Ae:o.getter=An;break;case Ee:o.getter=Oe;break}else if(o.type==2)switch(s){case Ae:o.getter=ne;break;case Ee:o.getter=xn}else throw new Error("EXRLoader.parse: unsupported pixelType "+o.type+" for "+e.compression+".");o.columns=o.width;const c=o.width*o.height*o.outputChannels;switch(s){case Ae:o.byteArray=new Float32Array(c),l&&o.byteArray.fill(1,0,c);break;case Ee:o.byteArray=new Uint16Array(c),l&&o.byteArray.fill(15360,0,c);break;default:console.error("THREE.EXRLoader: unsupported type: ",s);break}let p=0;for(const h of e.channels)o.decodeChannels[h.name]!==void 0&&(o.channelByteOffsets[h.name]=p),p+=h.pixelType*2;if(o.totalBytes=p,o.outLineWidth=o.width*o.outputChannels,e.lineOrder==="INCREASING_Y"?o.scanOrder=h=>h:o.scanOrder=h=>o.height-1-h,e.spec.singleTile){o.blockHeight=e.tiles.ySize,o.blockWidth=e.tiles.xSize;const h=Pn(e.tiles,o.width,o.height),d=un(h,o.width,e.tiles.xSize,e.tiles.roundingMode),E=un(h,o.height,e.tiles.ySize,e.tiles.roundingMode);o.tileCount=d[0]*E[0];for(let m=0;m<h;m++)for(let w=0;w<E[m];w++)for(let y=0;y<d[m];y++)re(n,r);o.decode=Zn.bind(o)}else{o.blockWidth=o.width;const h=Math.ceil(o.height/o.blockHeight);for(let d=0;d<h;d++)re(n,r);o.decode=zn.bind(o)}return o}const hn={value:0},pn=new DataView(g),Wn=new Uint8Array(g),Se=Gn(pn,g,hn),fe=Yn(Se,pn,Wn,hn,this.type,this.outputFormat);if(fe.decode(),fe.shouldExpand){const e=fe.byteArray;if(this.outputFormat==Re)for(let n=0;n<e.length;n+=4)e[n+2]=e[n+1]=e[n];else if(this.outputFormat==ke)for(let n=0;n<e.length;n+=2)e[n+1]=e[n]}return{header:Se,width:fe.width,height:fe.height,data:fe.byteArray,format:fe.format,colorSpace:fe.colorSpace,type:this.type}}setDataType(g){return this.type=g,this}setOutputFormat(g){return this.outputFormat=g,this}load(g,x,M,j){function b(S,Y){S.colorSpace=Y.colorSpace,S.minFilter=Ye,S.magFilter=Ye,S.generateMipmaps=!1,S.flipY=!1,x&&x(S,Y)}return super.load(g,b,M,j)}}class ut extends mn{constructor(g){super(g),this.type=Ee}parse(g){const S=function(_,N){switch(_){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(N||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(N||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(N||""));default:case 4:throw new Error("THREE.HDRLoader: Memory Error: "+(N||""))}},te=function(_,N,k){N=N||1024;let U=_.pos,z=-1,I=0,W="",O=String.fromCharCode.apply(null,new Uint16Array(_.subarray(U,U+128)));for(;0>(z=O.indexOf(`
1
+ import{a as T}from"./jsx-runtime-DPjLkJKQ.js";import{aD as Xn,aE as jn,aF as $n,aG as Kn,t as Ce,aH as Ke,aI as Pe}from"./index-DGwLrPW2.js";import{r as ue}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{b0 as mn,H as Ee,v as Re,ac as ke,p as we,O as Ze,F as Ae,L as Ye,b9 as xe,bn as qn,aV as Vn,i as Jn,aW as Qn,w as et,k as nt,d as tt,bo as ot,b1 as rt,a0 as qe,am as ze,bp as Ve,bq as st,b as it}from"./three.module-BynznMJN.js";import{O as lt}from"./OrbitControls-BHxt84w6.js";import{u as Ge}from"./fflate.module-DPuTF8aG.js";import{s as ct}from"./asset-editor-persistence-Cy4ncL8Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";class at extends mn{constructor(g){super(g),this.type=Ee,this.outputFormat=Re}parse(g){const N=Math.pow(2.7182818,2.2);function k(e,n){let t=0;for(let s=0;s<65536;++s)(s==0||e[s>>3]&1<<(s&7))&&(n[t++]=s);const r=t-1;for(;t<65536;)n[t++]=0;return r}function P(e){for(let n=0;n<16384;n++)e[n]={},e[n].len=0,e[n].lit=0,e[n].p=null}const U={l:0,c:0,lc:0};function z(e,n,t,r,s){for(;t<e;)n=n<<8|an(r,s),t+=8;t-=e,U.l=n>>t&(1<<e)-1,U.c=n,U.lc=t}const I=new Array(59);function W(e){for(let t=0;t<=58;++t)I[t]=0;for(let t=0;t<65537;++t)I[e[t]]+=1;let n=0;for(let t=58;t>0;--t){const r=n+I[t]>>1;I[t]=n,n=r}for(let t=0;t<65537;++t){const r=e[t];r>0&&(e[t]=r|I[r]++<<6)}}function O(e,n,t,r,s,a){const o=n;let u=0,l=0;for(;r<=s;r++){if(o.value-n.value>t)return!1;z(6,u,l,e,o);const i=U.l;if(u=U.c,l=U.lc,a[r]=i,i==63){if(o.value-n.value>t)throw new Error("Something wrong with hufUnpackEncTable");z(8,u,l,e,o);let c=U.l+6;if(u=U.c,l=U.lc,r+c>s+1)throw new Error("Something wrong with hufUnpackEncTable");for(;c--;)a[r++]=0;r--}else if(i>=59){let c=i-59+2;if(r+c>s+1)throw new Error("Something wrong with hufUnpackEncTable");for(;c--;)a[r++]=0;r--}}W(a)}function pe(e){return e&63}function Ue(e){return e>>6}function ye(e,n,t,r){for(;n<=t;n++){const s=Ue(e[n]),a=pe(e[n]);if(s>>a)throw new Error("Invalid table entry");if(a>14){const o=r[s>>a-14];if(o.len)throw new Error("Invalid table entry");if(o.lit++,o.p){const u=o.p;o.p=new Array(o.lit);for(let l=0;l<o.lit-1;++l)o.p[l]=u[l]}else o.p=new Array(1);o.p[o.lit-1]=n}else if(a){let o=0;for(let u=1<<14-a;u>0;u--){const l=r[(s<<14-a)+o];if(l.len||l.p)throw new Error("Invalid table entry");l.len=a,l.lit=n,o++}}}return!0}const K={c:0,lc:0};function Te(e,n,t,r){e=e<<8|an(t,r),n+=8,K.c=e,K.lc=n}const q={c:0,lc:0};function oe(e,n,t,r,s,a,o,u,l){if(e==n){r<8&&(Te(t,r,s,a),t=K.c,r=K.lc),r-=8;let i=t>>r;if(i=new Uint8Array([i])[0],u.value+i>l)return!1;const c=o[u.value-1];for(;i-- >0;)o[u.value++]=c}else if(u.value<l)o[u.value++]=e;else return!1;q.c=t,q.lc=r}function ve(e){return e&65535}function Je(e){const n=ve(e);return n>32767?n-65536:n}const Z={a:0,b:0};function Ie(e,n){const t=Je(e),s=Je(n),a=t+(s&1)+(s>>1),o=a,u=a-s;Z.a=o,Z.b=u}function be(e,n){const t=ve(e),r=ve(n),s=t-(r>>1)&65535,a=r+s-32768&65535;Z.a=a,Z.b=s}function dn(e,n,t,r,s,a,o){const u=o<16384,l=t>s?s:t;let i=1,c,p;for(;i<=l;)i<<=1;for(i>>=1,c=i,i>>=1;i>=1;){p=0;const h=p+a*(s-c),d=a*i,E=a*c,m=r*i,w=r*c;let y,A,L,$;for(;p<=h;p+=E){let D=p;const v=p+r*(t-c);for(;D<=v;D+=w){const G=D+m,V=D+d,B=V+m;u?(Ie(e[D+n],e[V+n]),y=Z.a,L=Z.b,Ie(e[G+n],e[B+n]),A=Z.a,$=Z.b,Ie(y,A),e[D+n]=Z.a,e[G+n]=Z.b,Ie(L,$),e[V+n]=Z.a,e[B+n]=Z.b):(be(e[D+n],e[V+n]),y=Z.a,L=Z.b,be(e[G+n],e[B+n]),A=Z.a,$=Z.b,be(y,A),e[D+n]=Z.a,e[G+n]=Z.b,be(L,$),e[V+n]=Z.a,e[B+n]=Z.b)}if(t&i){const G=D+d;u?Ie(e[D+n],e[G+n]):be(e[D+n],e[G+n]),y=Z.a,e[G+n]=Z.b,e[D+n]=y}}if(s&i){let D=p;const v=p+r*(t-c);for(;D<=v;D+=w){const G=D+m;u?Ie(e[D+n],e[G+n]):be(e[D+n],e[G+n]),y=Z.a,e[G+n]=Z.b,e[D+n]=y}}c=i,i>>=1}return p}function fn(e,n,t,r,s,a,o,u,l){let i=0,c=0;const p=o,h=Math.trunc(r.value+(s+7)/8);for(;r.value<h;)for(Te(i,c,t,r),i=K.c,c=K.lc;c>=14;){const E=i>>c-14&16383,m=n[E];if(m.len)c-=m.len,oe(m.lit,a,i,c,t,r,u,l,p),i=q.c,c=q.lc;else{if(!m.p)throw new Error("hufDecode issues");let w;for(w=0;w<m.lit;w++){const y=pe(e[m.p[w]]);for(;c<y&&r.value<h;)Te(i,c,t,r),i=K.c,c=K.lc;if(c>=y&&Ue(e[m.p[w]])==(i>>c-y&(1<<y)-1)){c-=y,oe(m.p[w],a,i,c,t,r,u,l,p),i=q.c,c=q.lc;break}}if(w==m.lit)throw new Error("hufDecode issues")}}const d=8-s&7;for(i>>=d,c-=d;c>0;){const E=n[i<<14-c&16383];if(E.len)c-=E.len,oe(E.lit,a,i,c,t,r,u,l,p),i=q.c,c=q.lc;else throw new Error("hufDecode issues")}return!0}function Qe(e,n,t,r,s,a){const o={value:0},u=t.value,l=ie(n,t),i=ie(n,t);t.value+=4;const c=ie(n,t);if(t.value+=4,l<0||l>=65537||i<0||i>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const p=new Array(65537),h=new Array(16384);P(h);const d=r-(t.value-u);if(O(e,t,d,l,i,p),c>8*(r-(t.value-u)))throw new Error("Something wrong with hufUncompress");ye(p,l,i,h),fn(p,h,e,t,c,i,a,s,o)}function wn(e,n,t){for(let r=0;r<t;++r)n[r]=e[n[r]]}function en(e){for(let n=1;n<e.length;n++){const t=e[n-1]+e[n]-128;e[n]=t}}function nn(e,n){let t=0,r=Math.floor((e.length+1)/2),s=0;const a=e.length-1;for(;!(s>a||(n[s++]=e[t++],s>a));)n[s++]=e[r++]}function tn(e){let n=e.byteLength;const t=new Array;let r=0;const s=new DataView(e);for(;n>0;){const a=s.getInt8(r++);if(a<0){const o=-a;n-=o+1;for(let u=0;u<o;u++)t.push(s.getUint8(r++))}else{const o=a;n-=2;const u=s.getUint8(r++);for(let l=0;l<o+1;l++)t.push(u)}}return t}function En(e,n,t,r,s,a){let o=new DataView(a.buffer);const u=t[e.idx[0]].width,l=t[e.idx[0]].height,i=3,c=Math.floor(u/8),p=Math.ceil(u/8),h=Math.ceil(l/8),d=u-(p-1)*8,E=l-(h-1)*8,m={value:0},w=new Array(i),y=new Array(i),A=new Array(i),L=new Array(i),$=new Array(i);for(let v=0;v<i;++v)$[v]=n[e.idx[v]],w[v]=v<1?0:w[v-1]+p*h,y[v]=new Float32Array(64),A[v]=new Uint16Array(64),L[v]=new Uint16Array(p*64);for(let v=0;v<h;++v){let G=8;v==h-1&&(G=E);let V=8;for(let C=0;C<p;++C){C==p-1&&(V=d);for(let F=0;F<i;++F)A[F].fill(0),A[F][0]=s[w[F]++],on(m,r,A[F]),rn(A[F],y[F]),sn(y[F]);yn(y);for(let F=0;F<i;++F)ln(y[F],L[F],C*64)}let B=0;for(let C=0;C<i;++C){const F=t[e.idx[C]].type;for(let me=8*v;me<8*v+G;++me){B=$[C][me];for(let De=0;De<c;++De){const ae=De*64+(me&7)*8;o.setUint16(B+0*F,L[C][ae+0],!0),o.setUint16(B+2*F,L[C][ae+1],!0),o.setUint16(B+4*F,L[C][ae+2],!0),o.setUint16(B+6*F,L[C][ae+3],!0),o.setUint16(B+8*F,L[C][ae+4],!0),o.setUint16(B+10*F,L[C][ae+5],!0),o.setUint16(B+12*F,L[C][ae+6],!0),o.setUint16(B+14*F,L[C][ae+7],!0),B+=16*F}}if(c!=p)for(let me=8*v;me<8*v+G;++me){const De=$[C][me]+8*c*2*F,ae=c*64+(me&7)*8;for(let He=0;He<V;++He)o.setUint16(De+He*2*F,L[C][ae+He],!0)}}}const D=new Uint16Array(u);o=new DataView(a.buffer);for(let v=0;v<i;++v){t[e.idx[v]].decoded=!0;const G=t[e.idx[v]].type;if(t[v].type==2)for(let V=0;V<l;++V){const B=$[v][V];for(let C=0;C<u;++C)D[C]=o.getUint16(B+C*2*G,!0);for(let C=0;C<u;++C)o.setFloat32(B+C*2*G,f(D[C]),!0)}}}function gn(e,n,t,r,s,a){const o=new DataView(a.buffer),u=t[e],l=u.width,i=u.height,c=Math.ceil(l/8),p=Math.ceil(i/8),h=Math.floor(l/8),d=l-(c-1)*8,E=i-(p-1)*8,m={value:0};let w=0;const y=new Float32Array(64),A=new Uint16Array(64),L=new Uint16Array(c*64);for(let $=0;$<p;++$){let D=8;$==p-1&&(D=E);for(let v=0;v<c;++v)A.fill(0),A[0]=s[w++],on(m,r,A),rn(A,y),sn(y),ln(y,L,v*64);for(let v=8*$;v<8*$+D;++v){let G=n[e][v];for(let V=0;V<h;++V){const B=V*64+(v&7)*8;for(let C=0;C<8;++C)o.setUint16(G+C*2*u.type,L[B+C],!0);G+=16*u.type}if(c!=h){const V=h*64+(v&7)*8;for(let B=0;B<d;++B)o.setUint16(G+B*2*u.type,L[V+B],!0)}}}u.decoded=!0}function on(e,n,t){let r,s=1;for(;s<64;)r=n[e.value],r==65280?s=64:r>>8==255?s+=r&255:(t[s]=r,s++),e.value++}function rn(e,n){n[0]=f(e[0]),n[1]=f(e[1]),n[2]=f(e[5]),n[3]=f(e[6]),n[4]=f(e[14]),n[5]=f(e[15]),n[6]=f(e[27]),n[7]=f(e[28]),n[8]=f(e[2]),n[9]=f(e[4]),n[10]=f(e[7]),n[11]=f(e[13]),n[12]=f(e[16]),n[13]=f(e[26]),n[14]=f(e[29]),n[15]=f(e[42]),n[16]=f(e[3]),n[17]=f(e[8]),n[18]=f(e[12]),n[19]=f(e[17]),n[20]=f(e[25]),n[21]=f(e[30]),n[22]=f(e[41]),n[23]=f(e[43]),n[24]=f(e[9]),n[25]=f(e[11]),n[26]=f(e[18]),n[27]=f(e[24]),n[28]=f(e[31]),n[29]=f(e[40]),n[30]=f(e[44]),n[31]=f(e[53]),n[32]=f(e[10]),n[33]=f(e[19]),n[34]=f(e[23]),n[35]=f(e[32]),n[36]=f(e[39]),n[37]=f(e[45]),n[38]=f(e[52]),n[39]=f(e[54]),n[40]=f(e[20]),n[41]=f(e[22]),n[42]=f(e[33]),n[43]=f(e[38]),n[44]=f(e[46]),n[45]=f(e[51]),n[46]=f(e[55]),n[47]=f(e[60]),n[48]=f(e[21]),n[49]=f(e[34]),n[50]=f(e[37]),n[51]=f(e[47]),n[52]=f(e[50]),n[53]=f(e[56]),n[54]=f(e[59]),n[55]=f(e[61]),n[56]=f(e[35]),n[57]=f(e[36]),n[58]=f(e[48]),n[59]=f(e[49]),n[60]=f(e[57]),n[61]=f(e[58]),n[62]=f(e[62]),n[63]=f(e[63])}function sn(e){const n=.5*Math.cos(.7853975),t=.5*Math.cos(3.14159/16),r=.5*Math.cos(3.14159/8),s=.5*Math.cos(3*3.14159/16),a=.5*Math.cos(5*3.14159/16),o=.5*Math.cos(3*3.14159/8),u=.5*Math.cos(7*3.14159/16),l=new Array(4),i=new Array(4),c=new Array(4),p=new Array(4);for(let h=0;h<8;++h){const d=h*8;l[0]=r*e[d+2],l[1]=o*e[d+2],l[2]=r*e[d+6],l[3]=o*e[d+6],i[0]=t*e[d+1]+s*e[d+3]+a*e[d+5]+u*e[d+7],i[1]=s*e[d+1]-u*e[d+3]-t*e[d+5]-a*e[d+7],i[2]=a*e[d+1]-t*e[d+3]+u*e[d+5]+s*e[d+7],i[3]=u*e[d+1]-a*e[d+3]+s*e[d+5]-t*e[d+7],c[0]=n*(e[d+0]+e[d+4]),c[3]=n*(e[d+0]-e[d+4]),c[1]=l[0]+l[3],c[2]=l[1]-l[2],p[0]=c[0]+c[1],p[1]=c[3]+c[2],p[2]=c[3]-c[2],p[3]=c[0]-c[1],e[d+0]=p[0]+i[0],e[d+1]=p[1]+i[1],e[d+2]=p[2]+i[2],e[d+3]=p[3]+i[3],e[d+4]=p[3]-i[3],e[d+5]=p[2]-i[2],e[d+6]=p[1]-i[1],e[d+7]=p[0]-i[0]}for(let h=0;h<8;++h)l[0]=r*e[16+h],l[1]=o*e[16+h],l[2]=r*e[48+h],l[3]=o*e[48+h],i[0]=t*e[8+h]+s*e[24+h]+a*e[40+h]+u*e[56+h],i[1]=s*e[8+h]-u*e[24+h]-t*e[40+h]-a*e[56+h],i[2]=a*e[8+h]-t*e[24+h]+u*e[40+h]+s*e[56+h],i[3]=u*e[8+h]-a*e[24+h]+s*e[40+h]-t*e[56+h],c[0]=n*(e[h]+e[32+h]),c[3]=n*(e[h]-e[32+h]),c[1]=l[0]+l[3],c[2]=l[1]-l[2],p[0]=c[0]+c[1],p[1]=c[3]+c[2],p[2]=c[3]-c[2],p[3]=c[0]-c[1],e[0+h]=p[0]+i[0],e[8+h]=p[1]+i[1],e[16+h]=p[2]+i[2],e[24+h]=p[3]+i[3],e[32+h]=p[3]-i[3],e[40+h]=p[2]-i[2],e[48+h]=p[1]-i[1],e[56+h]=p[0]-i[0]}function yn(e){for(let n=0;n<64;++n){const t=e[0][n],r=e[1][n],s=e[2][n];e[0][n]=t+1.5747*s,e[1][n]=t-.1873*r-.4682*s,e[2][n]=t+1.8556*r}}function ln(e,n,t){for(let r=0;r<64;++r)n[t+r]=xe.toHalfFloat(Sn(e[r]))}function Sn(e){return e<=1?Math.sign(e)*Math.pow(Math.abs(e),2.2):Math.sign(e)*Math.pow(N,Math.abs(e)-1)}function je(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function _n(e){const n=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),t=new Uint8Array(tn(n)),r=new Uint8Array(t.length);return en(t),nn(t,r),new DataView(r.buffer)}function $e(e){const n=e.array.slice(e.offset.value,e.offset.value+e.size),t=Ge(n),r=new Uint8Array(t.length);return en(t),nn(t,r),new DataView(r.buffer)}function vn(e){const n=e.viewer,t={value:e.offset.value},r=new Uint16Array(e.columns*e.lines*(e.inputChannels.length*e.type)),s=new Uint8Array(8192);let a=0;const o=new Array(e.inputChannels.length);for(let E=0,m=e.inputChannels.length;E<m;E++)o[E]={},o[E].start=a,o[E].end=o[E].start,o[E].nx=e.columns,o[E].ny=e.lines,o[E].size=e.type,a+=o[E].nx*o[E].ny*o[E].size;const u=Oe(n,t),l=Oe(n,t);if(l>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(u<=l)for(let E=0;E<l-u+1;E++)s[E+u]=de(n,t);const i=new Uint16Array(65536),c=k(s,i),p=ie(n,t);Qe(e.array,n,t,p,r,a);for(let E=0;E<e.inputChannels.length;++E){const m=o[E];for(let w=0;w<o[E].size;++w)dn(r,m.start+w,m.nx,m.size,m.ny,m.nx*m.size,c)}wn(i,r,a);let h=0;const d=new Uint8Array(r.buffer.byteLength);for(let E=0;E<e.lines;E++)for(let m=0;m<e.inputChannels.length;m++){const w=o[m],y=w.nx*w.size,A=new Uint8Array(r.buffer,w.end*2,y*2);d.set(A,h),h+=y*2,w.end+=y}return new DataView(d.buffer)}function In(e){const n=e.array.slice(e.offset.value,e.offset.value+e.size),t=Ge(n),r=e.inputChannels.length*e.lines*e.columns*e.totalBytes,s=new ArrayBuffer(r),a=new DataView(s);let o=0,u=0;const l=new Array(4);for(let i=0;i<e.lines;i++)for(let c=0;c<e.inputChannels.length;c++){let p=0;switch(e.inputChannels[c].pixelType){case 1:l[0]=o,l[1]=l[0]+e.columns,o=l[1]+e.columns;for(let d=0;d<e.columns;++d){const E=t[l[0]++]<<8|t[l[1]++];p+=E,a.setUint16(u,p,!0),u+=2}break;case 2:l[0]=o,l[1]=l[0]+e.columns,l[2]=l[1]+e.columns,o=l[2]+e.columns;for(let d=0;d<e.columns;++d){const E=t[l[0]++]<<24|t[l[1]++]<<16|t[l[2]++]<<8;p+=E,a.setUint32(u,p,!0),u+=4}break}}return a}function cn(e){const n=e.viewer,t={value:e.offset.value},r=new Uint8Array(e.columns*e.lines*(e.inputChannels.length*e.type*2)),s={version:re(n,t),unknownUncompressedSize:re(n,t),unknownCompressedSize:re(n,t),acCompressedSize:re(n,t),dcCompressedSize:re(n,t),rleCompressedSize:re(n,t),rleUncompressedSize:re(n,t),rleRawSize:re(n,t),totalAcUncompressedCount:re(n,t),totalDcUncompressedCount:re(n,t),acCompression:re(n,t)};if(s.version<2)throw new Error("EXRLoader.parse: "+Se.compression+" version "+s.version+" is unsupported");const a=new Array;let o=Oe(n,t)-2;for(;o>0;){const m=Be(n.buffer,t),w=de(n,t),y=w>>2&3,A=(w>>4)-1,L=new Int8Array([A])[0],$=de(n,t);a.push({name:m,index:L,type:$,compression:y}),o-=m.length+3}const u=Se.channels,l=new Array(e.inputChannels.length);for(let m=0;m<e.inputChannels.length;++m){const w=l[m]={},y=u[m];w.name=y.name,w.compression=0,w.decoded=!1,w.type=y.pixelType,w.pLinear=y.pLinear,w.width=e.columns,w.height=e.lines}const i={idx:new Array(3)};for(let m=0;m<e.inputChannels.length;++m){const w=l[m];for(let y=0;y<a.length;++y){const A=a[y];w.name==A.name&&(w.compression=A.compression,A.index>=0&&(i.idx[A.index]=m),w.offset=m)}}let c,p,h;if(s.acCompressedSize>0)switch(s.acCompression){case 0:c=new Uint16Array(s.totalAcUncompressedCount),Qe(e.array,n,t,s.acCompressedSize,c,s.totalAcUncompressedCount);break;case 1:const m=e.array.slice(t.value,t.value+s.totalAcUncompressedCount),w=Ge(m);c=new Uint16Array(w.buffer),t.value+=s.totalAcUncompressedCount;break}if(s.dcCompressedSize>0){const m={array:e.array,offset:t,size:s.dcCompressedSize};p=new Uint16Array($e(m).buffer),t.value+=s.dcCompressedSize}if(s.rleRawSize>0){const m=e.array.slice(t.value,t.value+s.rleCompressedSize),w=Ge(m);h=tn(w.buffer),t.value+=s.rleCompressedSize}let d=0;const E=new Array(l.length);for(let m=0;m<E.length;++m)E[m]=new Array;for(let m=0;m<e.lines;++m)for(let w=0;w<l.length;++w)E[w].push(d),d+=l[w].width*e.type*2;i.idx[0]!==void 0&&l[i.idx[0]]&&En(i,E,l,c,p,r);for(let m=0;m<l.length;++m){const w=l[m];if(!w.decoded)switch(w.compression){case 2:let y=0,A=0;for(let L=0;L<e.lines;++L){let $=E[m][y];for(let D=0;D<w.width;++D){for(let v=0;v<2*w.type;++v)r[$++]=h[A+v*w.width*w.height];A++}y++}break;case 1:gn(m,E,l,c,p,r);break;default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(r.buffer)}function Be(e,n){const t=new Uint8Array(e);let r=0;for(;t[n.value+r]!=0;)r+=1;const s=new TextDecoder().decode(t.slice(n.value,n.value+r));return n.value=n.value+r+1,s}function bn(e,n,t){const r=new TextDecoder().decode(new Uint8Array(e).slice(n.value,n.value+t));return n.value=n.value+t,r}function Rn(e,n){const t=se(e,n),r=ie(e,n);return[t,r]}function Cn(e,n){const t=ie(e,n),r=ie(e,n);return[t,r]}function se(e,n){const t=e.getInt32(n.value,!0);return n.value=n.value+4,t}function ie(e,n){const t=e.getUint32(n.value,!0);return n.value=n.value+4,t}function an(e,n){const t=e[n.value];return n.value=n.value+1,t}function de(e,n){const t=e.getUint8(n.value);return n.value=n.value+1,t}const re=function(e,n){let t;return"getBigInt64"in DataView.prototype?t=Number(e.getBigInt64(n.value,!0)):t=e.getUint32(n.value+4,!0)+Number(e.getUint32(n.value,!0)<<32),n.value+=8,t};function ne(e,n){const t=e.getFloat32(n.value,!0);return n.value+=4,t}function xn(e,n){return xe.toHalfFloat(ne(e,n))}function f(e){const n=(e&31744)>>10,t=e&1023;return(e>>15?-1:1)*(n?n===31?t?NaN:1/0:Math.pow(2,n-15)*(1+t/1024):6103515625e-14*(t/1024))}function Oe(e,n){const t=e.getUint16(n.value,!0);return n.value+=2,t}function An(e,n){return f(Oe(e,n))}function Mn(e,n,t,r){const s=t.value,a=[];for(;t.value<s+r-1;){const o=Be(n,t),u=se(e,t),l=de(e,t);t.value+=3;const i=se(e,t),c=se(e,t);a.push({name:o,pixelType:u,pLinear:l,xSampling:i,ySampling:c})}return t.value+=1,a}function Nn(e,n){const t=ne(e,n),r=ne(e,n),s=ne(e,n),a=ne(e,n),o=ne(e,n),u=ne(e,n),l=ne(e,n),i=ne(e,n);return{redX:t,redY:r,greenX:s,greenY:a,blueX:o,blueY:u,whiteX:l,whiteY:i}}function Un(e,n){const t=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],r=de(e,n);return t[r]}function Tn(e,n){const t=se(e,n),r=se(e,n),s=se(e,n),a=se(e,n);return{xMin:t,yMin:r,xMax:s,yMax:a}}function On(e,n){const t=["INCREASING_Y","DECREASING_Y","RANDOM_Y"],r=de(e,n);return t[r]}function Dn(e,n){const t=["ENVMAP_LATLONG","ENVMAP_CUBE"],r=de(e,n);return t[r]}function kn(e,n){const t=["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"],r=["ROUND_DOWN","ROUND_UP"],s=ie(e,n),a=ie(e,n),o=de(e,n);return{xSize:s,ySize:a,levelMode:t[o&15],roundingMode:r[o>>4]}}function Ln(e,n){const t=ne(e,n),r=ne(e,n);return[t,r]}function Fn(e,n){const t=ne(e,n),r=ne(e,n),s=ne(e,n);return[t,r,s]}function Bn(e,n,t,r,s){if(r==="string"||r==="stringvector"||r==="iccProfile")return bn(n,t,s);if(r==="chlist")return Mn(e,n,t,s);if(r==="chromaticities")return Nn(e,t);if(r==="compression")return Un(e,t);if(r==="box2i")return Tn(e,t);if(r==="envmap")return Dn(e,t);if(r==="tiledesc")return kn(e,t);if(r==="lineOrder")return On(e,t);if(r==="float")return ne(e,t);if(r==="v2f")return Ln(e,t);if(r==="v3f")return Fn(e,t);if(r==="int")return se(e,t);if(r==="rational")return Rn(e,t);if(r==="timecode")return Cn(e,t);if(r==="preview")return t.value+=s,"skipped";t.value+=s}function Hn(e,n){const t=Math.log2(e);return n=="ROUND_DOWN"?Math.floor(t):Math.ceil(t)}function Pn(e,n,t){let r=0;switch(e.levelMode){case"ONE_LEVEL":r=1;break;case"MIPMAP_LEVELS":r=Hn(Math.max(n,t),e.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return r}function un(e,n,t,r){const s=new Array(e);for(let a=0;a<e;a++){const o=1<<a;let u=n/o|0;r=="ROUND_UP"&&u*o<n&&(u+=1);const l=Math.max(u,1);s[a]=(l+t-1)/t|0}return s}function Zn(){const e=this,n=e.offset,t={value:0};for(let r=0;r<e.tileCount;r++){const s=se(e.viewer,n),a=se(e.viewer,n);n.value+=8,e.size=ie(e.viewer,n);const o=s*e.blockWidth,u=a*e.blockHeight;e.columns=o+e.blockWidth>e.width?e.width-o:e.blockWidth,e.lines=u+e.blockHeight>e.height?e.height-u:e.blockHeight;const l=e.columns*e.totalBytes,c=e.size<e.lines*l?e.uncompress(e):je(e);n.value+=e.size;for(let p=0;p<e.lines;p++){const h=p*e.columns*e.totalBytes;for(let d=0;d<e.inputChannels.length;d++){const E=Se.channels[d].name,m=e.channelByteOffsets[E]*e.columns,w=e.decodeChannels[E];if(w===void 0)continue;t.value=h+m;const y=(e.height-(1+u+p))*e.outLineWidth;for(let A=0;A<e.columns;A++){const L=y+(A+o)*e.outputChannels+w;e.byteArray[L]=e.getter(c,t)}}}}}function zn(){const e=this,n=e.offset,t={value:0};for(let r=0;r<e.height/e.blockHeight;r++){const s=se(e.viewer,n)-Se.dataWindow.yMin;e.size=ie(e.viewer,n),e.lines=s+e.blockHeight>e.height?e.height-s:e.blockHeight;const a=e.columns*e.totalBytes,u=e.size<e.lines*a?e.uncompress(e):je(e);n.value+=e.size;for(let l=0;l<e.blockHeight;l++){const i=r*e.blockHeight,c=l+e.scanOrder(i);if(c>=e.height)continue;const p=l*a,h=(e.height-1-c)*e.outLineWidth;for(let d=0;d<e.inputChannels.length;d++){const E=Se.channels[d].name,m=e.channelByteOffsets[E]*e.columns,w=e.decodeChannels[E];if(w!==void 0){t.value=p+m;for(let y=0;y<e.columns;y++){const A=h+y*e.outputChannels+w;e.byteArray[A]=e.getter(u,t)}}}}}}function Gn(e,n,t){const r={};if(e.getUint32(0,!0)!=20000630)throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");r.version=e.getUint8(4);const s=e.getUint8(5);r.spec={singleTile:!!(s&2),longName:!!(s&4),deepFormat:!!(s&8),multiPart:!!(s&16)},t.value=8;let a=!0;for(;a;){const o=Be(n,t);if(o==="")a=!1;else{const u=Be(n,t),l=ie(e,t),i=Bn(e,n,t,u,l);i===void 0?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${u}'.`):r[o]=i}}if((s&-7)!=0)throw console.error("THREE.EXRHeader:",r),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return r}function Yn(e,n,t,r,s,a){const o={size:0,viewer:n,array:t,offset:r,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,inputChannels:e.channels,channelByteOffsets:{},shouldExpand:!1,scanOrder:null,totalBytes:null,columns:null,lines:null,type:null,uncompress:null,getter:null,format:null,colorSpace:we};switch(e.compression){case"NO_COMPRESSION":o.blockHeight=1,o.uncompress=je;break;case"RLE_COMPRESSION":o.blockHeight=1,o.uncompress=_n;break;case"ZIPS_COMPRESSION":o.blockHeight=1,o.uncompress=$e;break;case"ZIP_COMPRESSION":o.blockHeight=16,o.uncompress=$e;break;case"PIZ_COMPRESSION":o.blockHeight=32,o.uncompress=vn;break;case"PXR24_COMPRESSION":o.blockHeight=16,o.uncompress=In;break;case"DWAA_COMPRESSION":o.blockHeight=32,o.uncompress=cn;break;case"DWAB_COMPRESSION":o.blockHeight=256,o.uncompress=cn;break;default:throw new Error("EXRLoader.parse: "+e.compression+" is unsupported")}const u={};for(const h of e.channels)switch(h.name){case"Y":case"R":case"G":case"B":case"A":u[h.name]=!0,o.type=h.pixelType}let l=!1,i=!1;if(u.R&&u.G&&u.B)o.outputChannels=4;else if(u.Y)o.outputChannels=1;else throw new Error("EXRLoader.parse: file contains unsupported data channels.");switch(o.outputChannels){case 4:a==Re?(l=!u.A,o.format=Re,o.colorSpace=we,o.outputChannels=4,o.decodeChannels={R:0,G:1,B:2,A:3}):a==ke?(o.format=ke,o.colorSpace=we,o.outputChannels=2,o.decodeChannels={R:0,G:1}):a==Ze?(o.format=Ze,o.colorSpace=we,o.outputChannels=1,o.decodeChannels={R:0}):i=!0;break;case 1:a==Re?(l=!0,o.format=Re,o.colorSpace=we,o.outputChannels=4,o.shouldExpand=!0,o.decodeChannels={Y:0}):a==ke?(o.format=ke,o.colorSpace=we,o.outputChannels=2,o.shouldExpand=!0,o.decodeChannels={Y:0}):a==Ze?(o.format=Ze,o.colorSpace=we,o.outputChannels=1,o.decodeChannels={Y:0}):i=!0;break;default:i=!0}if(i)throw new Error("EXRLoader.parse: invalid output format for specified file.");if(o.type==1)switch(s){case Ae:o.getter=An;break;case Ee:o.getter=Oe;break}else if(o.type==2)switch(s){case Ae:o.getter=ne;break;case Ee:o.getter=xn}else throw new Error("EXRLoader.parse: unsupported pixelType "+o.type+" for "+e.compression+".");o.columns=o.width;const c=o.width*o.height*o.outputChannels;switch(s){case Ae:o.byteArray=new Float32Array(c),l&&o.byteArray.fill(1,0,c);break;case Ee:o.byteArray=new Uint16Array(c),l&&o.byteArray.fill(15360,0,c);break;default:console.error("THREE.EXRLoader: unsupported type: ",s);break}let p=0;for(const h of e.channels)o.decodeChannels[h.name]!==void 0&&(o.channelByteOffsets[h.name]=p),p+=h.pixelType*2;if(o.totalBytes=p,o.outLineWidth=o.width*o.outputChannels,e.lineOrder==="INCREASING_Y"?o.scanOrder=h=>h:o.scanOrder=h=>o.height-1-h,e.spec.singleTile){o.blockHeight=e.tiles.ySize,o.blockWidth=e.tiles.xSize;const h=Pn(e.tiles,o.width,o.height),d=un(h,o.width,e.tiles.xSize,e.tiles.roundingMode),E=un(h,o.height,e.tiles.ySize,e.tiles.roundingMode);o.tileCount=d[0]*E[0];for(let m=0;m<h;m++)for(let w=0;w<E[m];w++)for(let y=0;y<d[m];y++)re(n,r);o.decode=Zn.bind(o)}else{o.blockWidth=o.width;const h=Math.ceil(o.height/o.blockHeight);for(let d=0;d<h;d++)re(n,r);o.decode=zn.bind(o)}return o}const hn={value:0},pn=new DataView(g),Wn=new Uint8Array(g),Se=Gn(pn,g,hn),fe=Yn(Se,pn,Wn,hn,this.type,this.outputFormat);if(fe.decode(),fe.shouldExpand){const e=fe.byteArray;if(this.outputFormat==Re)for(let n=0;n<e.length;n+=4)e[n+2]=e[n+1]=e[n];else if(this.outputFormat==ke)for(let n=0;n<e.length;n+=2)e[n+1]=e[n]}return{header:Se,width:fe.width,height:fe.height,data:fe.byteArray,format:fe.format,colorSpace:fe.colorSpace,type:this.type}}setDataType(g){return this.type=g,this}setOutputFormat(g){return this.outputFormat=g,this}load(g,x,M,j){function b(S,Y){S.colorSpace=Y.colorSpace,S.minFilter=Ye,S.magFilter=Ye,S.generateMipmaps=!1,S.flipY=!1,x&&x(S,Y)}return super.load(g,b,M,j)}}class ut extends mn{constructor(g){super(g),this.type=Ee}parse(g){const S=function(_,N){switch(_){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(N||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(N||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(N||""));default:case 4:throw new Error("THREE.HDRLoader: Memory Error: "+(N||""))}},te=function(_,N,k){N=N||1024;let U=_.pos,z=-1,I=0,W="",O=String.fromCharCode.apply(null,new Uint16Array(_.subarray(U,U+128)));for(;0>(z=O.indexOf(`
2
2
  `))&&I<N&&U<_.byteLength;)W+=O,I+=O.length,U+=128,O+=String.fromCharCode.apply(null,new Uint16Array(_.subarray(U,U+128)));return-1<z?(_.pos+=I+z+1,W+O.slice(0,z)):!1},ce=function(_){const N=/^#\?(\S+)/,k=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,P=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,U=/^\s*FORMAT=(\S+)\s*$/,z=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,I={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let W,O;for((_.pos>=_.byteLength||!(W=te(_)))&&S(1,"no header found"),(O=W.match(N))||S(3,"bad initial token"),I.valid|=1,I.programtype=O[1],I.string+=W+`
3
3
  `;W=te(_),W!==!1;){if(I.string+=W+`
4
4
  `,W.charAt(0)==="#"){I.comments+=W+`
@@ -1,4 +1,4 @@
1
- import{a as z}from"./jsx-runtime-DPjLkJKQ.js";import{r as ie}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{aN as Fs,aO as Us,aP as ne,aQ as st,H as Se,t as X,aR as Bs}from"./index-DuB3wHKD.js";import"./index-D2LwEE0L.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";var Le={},$s=Object.defineProperty,zs=(e,t,i)=>t in e?$s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,O=(e,t,i)=>zs(e,typeof t!="symbol"?t+"":t,i),Or,Ws=Object.defineProperty,js=(e,t,i)=>t in e?Ws(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Tr=(e,t,i)=>js(e,typeof t!="symbol"?t+"":t,i),$=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))($||{});Date.now().toString();function qs(e){return e.nodeType===e.ELEMENT_NODE}class rs{constructor(){Tr(this,"idNodeMap",new Map),Tr(this,"nodeMetaMap",new WeakMap)}getId(t){var i;return t?((i=this.getMeta(t))==null?void 0:i.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const i=this.getId(t);this.idNodeMap.delete(i),t.childNodes&&t.childNodes.forEach(o=>this.removeNodeFromMap(o))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,i){const o=i.id;this.idNodeMap.set(o,t),this.nodeMetaMap.set(t,i)}replace(t,i){const o=this.getNode(t);if(o){const r=this.nodeMetaMap.get(o);r&&this.nodeMetaMap.set(i,r)}this.idNodeMap.set(t,i)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function is(){return new rs}function Vs(e){return e.toLowerCase()}function Gs(e,t){return!e||!t||e.type!==t.type?!1:e.type===$.Document?e.compatMode===t.compatMode:e.type===$.DocumentType?e.name===t.name&&e.publicId===t.publicId&&e.systemId===t.systemId:e.type===$.Comment||e.type===$.Text||e.type===$.CDATA?e.textContent===t.textContent:e.type===$.Element?e.tagName===t.tagName&&JSON.stringify(e.attributes)===JSON.stringify(t.attributes)&&e.isSVG===t.isSVG&&e.needBlock===t.needBlock:!1}function Hs(e,t){let i;try{i=new URL(e,t??window.location.href)}catch{return null}const o=/\.([0-9a-z]+)(?:$)/i,r=i.pathname.match(o);return r?.[1]??null}const Ys=/(max|min)-device-(width|height)/,_r=new RegExp(Ys.source,"g"),Js={postcssPlugin:"postcss-custom-selectors",prepare(){return{postcssPlugin:"postcss-custom-selectors",AtRule:function(e){e.params.match(_r)&&(e.params=e.params.replace(_r,"$1-$2"))}}}},Xs={postcssPlugin:"postcss-hover-classes",prepare:function(){const e=[];return{Rule:function(t){e.indexOf(t)===-1&&(e.push(t),t.selectors.forEach(function(i){i.includes(":hover")&&(t.selector+=`,
1
+ import{a as z}from"./jsx-runtime-DPjLkJKQ.js";import{r as ie}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{aN as Fs,aO as Us,aP as ne,aQ as st,H as Se,t as X,aR as Bs}from"./index-DGwLrPW2.js";import"./index-D2LwEE0L.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";var Le={},$s=Object.defineProperty,zs=(e,t,i)=>t in e?$s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,O=(e,t,i)=>zs(e,typeof t!="symbol"?t+"":t,i),Or,Ws=Object.defineProperty,js=(e,t,i)=>t in e?Ws(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Tr=(e,t,i)=>js(e,typeof t!="symbol"?t+"":t,i),$=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))($||{});Date.now().toString();function qs(e){return e.nodeType===e.ELEMENT_NODE}class rs{constructor(){Tr(this,"idNodeMap",new Map),Tr(this,"nodeMetaMap",new WeakMap)}getId(t){var i;return t?((i=this.getMeta(t))==null?void 0:i.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const i=this.getId(t);this.idNodeMap.delete(i),t.childNodes&&t.childNodes.forEach(o=>this.removeNodeFromMap(o))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,i){const o=i.id;this.idNodeMap.set(o,t),this.nodeMetaMap.set(t,i)}replace(t,i){const o=this.getNode(t);if(o){const r=this.nodeMetaMap.get(o);r&&this.nodeMetaMap.set(i,r)}this.idNodeMap.set(t,i)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function is(){return new rs}function Vs(e){return e.toLowerCase()}function Gs(e,t){return!e||!t||e.type!==t.type?!1:e.type===$.Document?e.compatMode===t.compatMode:e.type===$.DocumentType?e.name===t.name&&e.publicId===t.publicId&&e.systemId===t.systemId:e.type===$.Comment||e.type===$.Text||e.type===$.CDATA?e.textContent===t.textContent:e.type===$.Element?e.tagName===t.tagName&&JSON.stringify(e.attributes)===JSON.stringify(t.attributes)&&e.isSVG===t.isSVG&&e.needBlock===t.needBlock:!1}function Hs(e,t){let i;try{i=new URL(e,t??window.location.href)}catch{return null}const o=/\.([0-9a-z]+)(?:$)/i,r=i.pathname.match(o);return r?.[1]??null}const Ys=/(max|min)-device-(width|height)/,_r=new RegExp(Ys.source,"g"),Js={postcssPlugin:"postcss-custom-selectors",prepare(){return{postcssPlugin:"postcss-custom-selectors",AtRule:function(e){e.params.match(_r)&&(e.params=e.params.replace(_r,"$1-$2"))}}}},Xs={postcssPlugin:"postcss-hover-classes",prepare:function(){const e=[];return{Rule:function(t){e.indexOf(t)===-1&&(e.push(t),t.selectors.forEach(function(i){i.includes(":hover")&&(t.selector+=`,
2
2
  `+i.replace(/:hover/g,".\\:hover"))}))}}}};function Qs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ks(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var i=function o(){return this instanceof o?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(i,o,r.get?r:{enumerable:!0,get:function(){return e[o]}})}),i}var Ne={exports:{}},Pr;function Zs(){if(Pr)return Ne.exports;Pr=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return Ne.exports=t(),Ne.exports.createColors=t,Ne.exports}const en={},tn=Object.freeze(Object.defineProperty({__proto__:null,default:en},Symbol.toStringTag,{value:"Module"})),Q=Ks(tn);var nt,Ir;function hr(){if(Ir)return nt;Ir=1;let e=Zs(),t=Q;class i extends Error{constructor(r,u,n,a,h,c){super(r),this.name="CssSyntaxError",this.reason=r,h&&(this.file=h),a&&(this.source=a),c&&(this.plugin=c),typeof u<"u"&&typeof n<"u"&&(typeof u=="number"?(this.line=u,this.column=n):(this.line=u.line,this.column=u.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,i)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(r){if(!this.source)return"";let u=this.source;r==null&&(r=e.isColorSupported),t&&r&&(u=t(u));let n=u.split(/\r?\n/),a=Math.max(this.line-3,0),h=Math.min(this.line+2,n.length),c=String(h).length,s,d;if(r){let{bold:l,gray:f,red:m}=e.createColors(!0);s=p=>l(m(p)),d=p=>f(p)}else s=d=l=>l;return n.slice(a,h).map((l,f)=>{let m=a+1+f,p=" "+(" "+m).slice(-c)+" | ";if(m===this.line){let y=d(p.replace(/\d/g," "))+l.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+d(p)+l+`
3
3
  `+y+s("^")}return" "+d(p)+l}).join(`
4
4
  `)}toString(){let r=this.showSourceCode();return r&&(r=`
@@ -1 +1 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as o}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{k as B,m as H,p as W,n as M,T as v,B as P,q as h,v as F}from"./index-DuB3wHKD.js";import"./index-D2LwEE0L.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";function Q({assetPath:n,displayName:l}){const{sheetPath:i,frameName:t}=B(n),s=`/${i}`,[r,a]=o.useState(null),[x,p]=o.useState(t),[m,u]=o.useState("fit"),[j,I]=o.useState(null),w=o.useRef(null),[y,N]=o.useState({w:320,h:240}),f=x??t,g=f?r?.frames.find(c=>c.name===f)??null:null;o.useEffect(()=>{p(t),u("fit")},[t]),o.useEffect(()=>{if(!t){a(null);return}let c=!1;return fetch(`/${H(i)}`).then(d=>d.ok?d.text():null).then(d=>{c||!d||a(W(d))}).catch(()=>{c||a(null)}),()=>{c=!0}},[t,i]),o.useEffect(()=>{const c=w.current;if(!c)return;const d=new ResizeObserver(R=>{const S=R[0]?.contentRect;S&&N({w:Math.max(1,S.width-24),h:Math.max(1,S.height-24)})});return d.observe(c),()=>d.disconnect()},[]);const b=g?.sourceWidth??j?.w??0,$=g?.sourceHeight??j?.h??0,k=M(m,b,$,y.w,y.h),E=l??f??i.split("/").pop()??n;return e.jsxs("div",{"data-testid":"image-asset-document",style:{height:"100%",minHeight:240,display:"flex",flexDirection:"column",minWidth:0},children:[e.jsx(T,{title:E,srcWidth:b,srcHeight:$,scaleMode:m,scale:k,onScaleMode:u}),e.jsx(z,{stageRef:w,frameName:t,frame:g,sheet:r,sheetUrl:s,title:E,scale:k,onNatural:I}),r&&r.frames.length>1?e.jsx(C,{sheetUrl:s,frames:r.frames,activeName:f,onPick:p}):null]})}function T({title:n,srcWidth:l,srcHeight:i,scaleMode:t,scale:s,onScaleMode:r}){return e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:6,padding:"6px 8px"},children:[e.jsx(v,{tone:"dim",variant:"label",children:n}),l>0&&e.jsxs(v,{tone:"muted",variant:"code",children:[l," × ",i,t==="fit"?` · ${O(s)}`:""]}),e.jsx("span",{style:{flex:1}}),[1,4,8,"fit"].map(a=>e.jsx(P,{type:"button",size:"compact",shape:"segment","aria-pressed":t===a,variant:t===a?"primary":"secondary",onClick:()=>r(a),children:a==="fit"?"Fit":`${a}×`},String(a)))]})}function z({stageRef:n,frameName:l,frame:i,sheet:t,sheetUrl:s,title:r,scale:a,onNatural:x}){let p;return l&&!i?p=e.jsx(v,{tone:"muted",variant:"body",children:t?`No sprite named ${l}`:"Loading sprite…"}):i?p=e.jsx(F,{sheetUrl:s,frame:i,scale:a}):p=e.jsx("img",{src:s,alt:r,style:{imageRendering:"pixelated",display:"block",transform:`scale(${a})`,transformOrigin:"center center"},onLoad:m=>{const u=m.currentTarget;x({w:u.naturalWidth,h:u.naturalHeight})}}),e.jsx("div",{ref:n,className:"vgai-asset-transparency-well","data-testid":"sprite-stage",style:{flex:1,minHeight:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto"},children:p})}function C({sheetUrl:n,frames:l,activeName:i,onPick:t}){return e.jsx("div",{"data-testid":"sprite-filmstrip",style:{display:"flex",gap:6,overflowX:"auto",padding:"8px 8px 10px",borderTop:`1px solid ${h[3]}`},children:l.map(s=>{const r=s.name===i;return e.jsxs("button",{type:"button",title:s.name,"aria-pressed":r,onClick:()=>t(s.name),style:{border:r?`1px solid ${h[1]}`:"1px solid transparent",background:"transparent",padding:2,cursor:"pointer",flex:"0 0 auto"},children:[e.jsx(F,{sheetUrl:n,frame:s,maxEdge:40}),e.jsx("div",{style:{fontSize:9,color:r?h[1]:h[3],maxWidth:56,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name})]},s.name)})})}function O(n){return n>=1?`${n}×`:`1/${Math.round(1/n)}×`}export{Q as ImageViewer};
1
+ import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as o}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{k as B,m as H,p as W,n as M,T as v,B as P,q as h,v as F}from"./index-DGwLrPW2.js";import"./index-D2LwEE0L.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";function Q({assetPath:n,displayName:l}){const{sheetPath:i,frameName:t}=B(n),s=`/${i}`,[r,a]=o.useState(null),[x,p]=o.useState(t),[m,u]=o.useState("fit"),[j,I]=o.useState(null),w=o.useRef(null),[y,N]=o.useState({w:320,h:240}),f=x??t,g=f?r?.frames.find(c=>c.name===f)??null:null;o.useEffect(()=>{p(t),u("fit")},[t]),o.useEffect(()=>{if(!t){a(null);return}let c=!1;return fetch(`/${H(i)}`).then(d=>d.ok?d.text():null).then(d=>{c||!d||a(W(d))}).catch(()=>{c||a(null)}),()=>{c=!0}},[t,i]),o.useEffect(()=>{const c=w.current;if(!c)return;const d=new ResizeObserver(R=>{const S=R[0]?.contentRect;S&&N({w:Math.max(1,S.width-24),h:Math.max(1,S.height-24)})});return d.observe(c),()=>d.disconnect()},[]);const b=g?.sourceWidth??j?.w??0,$=g?.sourceHeight??j?.h??0,k=M(m,b,$,y.w,y.h),E=l??f??i.split("/").pop()??n;return e.jsxs("div",{"data-testid":"image-asset-document",style:{height:"100%",minHeight:240,display:"flex",flexDirection:"column",minWidth:0},children:[e.jsx(T,{title:E,srcWidth:b,srcHeight:$,scaleMode:m,scale:k,onScaleMode:u}),e.jsx(z,{stageRef:w,frameName:t,frame:g,sheet:r,sheetUrl:s,title:E,scale:k,onNatural:I}),r&&r.frames.length>1?e.jsx(C,{sheetUrl:s,frames:r.frames,activeName:f,onPick:p}):null]})}function T({title:n,srcWidth:l,srcHeight:i,scaleMode:t,scale:s,onScaleMode:r}){return e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:6,padding:"6px 8px"},children:[e.jsx(v,{tone:"dim",variant:"label",children:n}),l>0&&e.jsxs(v,{tone:"muted",variant:"code",children:[l," × ",i,t==="fit"?` · ${O(s)}`:""]}),e.jsx("span",{style:{flex:1}}),[1,4,8,"fit"].map(a=>e.jsx(P,{type:"button",size:"compact",shape:"segment","aria-pressed":t===a,variant:t===a?"primary":"secondary",onClick:()=>r(a),children:a==="fit"?"Fit":`${a}×`},String(a)))]})}function z({stageRef:n,frameName:l,frame:i,sheet:t,sheetUrl:s,title:r,scale:a,onNatural:x}){let p;return l&&!i?p=e.jsx(v,{tone:"muted",variant:"body",children:t?`No sprite named ${l}`:"Loading sprite…"}):i?p=e.jsx(F,{sheetUrl:s,frame:i,scale:a}):p=e.jsx("img",{src:s,alt:r,style:{imageRendering:"pixelated",display:"block",transform:`scale(${a})`,transformOrigin:"center center"},onLoad:m=>{const u=m.currentTarget;x({w:u.naturalWidth,h:u.naturalHeight})}}),e.jsx("div",{ref:n,className:"vgai-asset-transparency-well","data-testid":"sprite-stage",style:{flex:1,minHeight:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto"},children:p})}function C({sheetUrl:n,frames:l,activeName:i,onPick:t}){return e.jsx("div",{"data-testid":"sprite-filmstrip",style:{display:"flex",gap:6,overflowX:"auto",padding:"8px 8px 10px",borderTop:`1px solid ${h[3]}`},children:l.map(s=>{const r=s.name===i;return e.jsxs("button",{type:"button",title:s.name,"aria-pressed":r,onClick:()=>t(s.name),style:{border:r?`1px solid ${h[1]}`:"1px solid transparent",background:"transparent",padding:2,cursor:"pointer",flex:"0 0 auto"},children:[e.jsx(F,{sheetUrl:n,frame:s,maxEdge:40}),e.jsx("div",{style:{fontSize:9,color:r?h[1]:h[3],maxWidth:56,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name})]},s.name)})})}function O(n){return n>=1?`${n}×`:`1/${Math.round(1/n)}×`}export{Q as ImageViewer};
@@ -1 +1 @@
1
- import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{Object3DSnapshotDocument as p}from"./EntityModelDocument-SFgsuX4_.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-DaQZGF7d.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-DuB3wHKD.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";import"./StageHost-B4P-uvV9.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-BHxt84w6.js";import"./LineSegments2-vfeDUBfs.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function I({previewKey:i,object:o,displayName:r,fill:e=!1}){return t.jsx("div",{"data-testid":"inspector-object-preview",style:e?{position:"absolute",inset:0,overflow:"hidden"}:{width:"100%",height:220,minHeight:220,borderBottom:"1px solid var(--vgai-structural-divider)",overflow:"hidden",position:"relative"},children:t.jsx(p,{documentId:`inspector-preview:${i}`,source:o,displayName:r,active:!0,chromeless:!0})})}export{I as InspectorObjectPreview};
1
+ import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{Object3DSnapshotDocument as p}from"./EntityModelDocument-B01ItUUL.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-DaQZGF7d.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-DGwLrPW2.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";import"./StageHost-CjZBoXiO.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-BHxt84w6.js";import"./LineSegments2-vfeDUBfs.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function I({previewKey:i,object:o,displayName:r,fill:e=!1}){return t.jsx("div",{"data-testid":"inspector-object-preview",style:e?{position:"absolute",inset:0,overflow:"hidden"}:{width:"100%",height:220,minHeight:220,borderBottom:"1px solid var(--vgai-structural-divider)",overflow:"hidden",position:"relative"},children:t.jsx(p,{documentId:`inspector-preview:${i}`,source:o,displayName:r,active:!0,chromeless:!0})})}export{I as InspectorObjectPreview};
@@ -1,3 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DgapqSPi.js","assets/index-BP6wv2A0.js","assets/index-CJbYy-CF.js","assets/index-CanA16PU.js","assets/index-Bge9JUr6.js","assets/index-gHZae-lw.js","assets/index-BncK9THk.js","assets/index-IEjydI9d.js","assets/index-DUqP1RMl.js"])))=>i.map(i=>d[i]);
2
- import{a as m}from"./jsx-runtime-DPjLkJKQ.js";import{r as d}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{t as i,_ as b,b4 as W,S as X,aH as Y}from"./index-DuB3wHKD.js";import"./index-D2LwEE0L.js";import{O as Z,Q as ee,V as _,C as te,G as F}from"./StageHost-B4P-uvV9.js";const re={ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"typescript",jsx:"typescript",mjs:"typescript",cjs:"typescript",json:"json",jsonc:"json",json5:"json"};function Je(e){const r=e.split("/").pop()??e,t=r.lastIndexOf(".");return t<0?"text":re[r.slice(t+1).toLowerCase()]??"text"}let I=null;function ne(){return I??=Promise.all([b(()=>import("./index-BP6wv2A0.js"),[]),b(()=>import("./index-DgapqSPi.js").then(e=>e.i),__vite__mapDeps([0,1])),b(()=>import("./index-CJbYy-CF.js").then(e=>e.w),__vite__mapDeps([2,1,0])),b(()=>import("./index-CanA16PU.js"),__vite__mapDeps([3,0,1])),b(()=>import("./index-Bge9JUr6.js"),__vite__mapDeps([4,1,0,2])),b(()=>import("./index-gHZae-lw.js"),__vite__mapDeps([5,6,2,1,0])),b(()=>import("./index-IEjydI9d.js"),__vite__mapDeps([7,6,2,1,0])),b(()=>import("./index-DUqP1RMl.js"),__vite__mapDeps([8,0,1,2]))]).then(([e,r,t,n,o,a,l,c])=>({state:e,view:r,language:t,search:n,commands:o,javascript:a,json:l,oneDark:c})),I}function C(e){return typeof e=="number"?`${e}px`:e}function L(e){return typeof e=="string"&&e.trim().endsWith("%")}function oe(e,r){let t=0;for(;t<e.length&&t<r.length&&e[t]===r[t];)t++;let n=e.length,o=r.length;for(;n>t&&o>t&&e[n-1]===r[o-1];)n--,o--;return{from:t,oldEnd:n,newEnd:o}}const q=1800,J=`color-mix(in srgb, ${i.semantic.warning} 42%, transparent)`,V=`color-mix(in srgb, ${i.semantic.warning} 18%, transparent)`;function se(e){class r extends e.view.WidgetType{constructor(a){super(),this.revision=a}eq(a){return this.revision===a.revision}toDOM(){const a=document.createElement("span");return a.className=`cm-source-deletion cm-source-change cm-source-change-${this.revision%2}`,a.setAttribute("aria-hidden","true"),a}}const t=e.state.StateEffect.define(),n=e.state.StateField.define({create:()=>e.view.Decoration.none,update(o,a){let l=o.map(a.changes);for(const c of a.effects){if(!c.is(t))continue;if(!c.value){l=e.view.Decoration.none;continue}const{from:u,to:s,revision:p}=c.value,h=u===s?e.view.Decoration.widget({widget:new r(p),side:-1}).range(u):e.view.Decoration.mark({class:`cm-source-change cm-source-change-${p%2}`}).range(u,s);l=e.view.Decoration.set([h])}return l},provide:o=>e.view.EditorView.decorations.from(o)});return{mark:t,field:n}}function ie(e,r,t){return e.view.EditorView.theme({"&":{color:i.content.primary,backgroundColor:"transparent",fontSize:`${r}px`,...L(t)?{height:C(t)}:{}},"&.cm-focused":{outline:"none"},".cm-content":{fontFamily:i.typography.mono,padding:"2px 0",caretColor:"transparent"},".cm-scroller":{fontFamily:i.typography.mono,lineHeight:"1.5",overflow:"auto",...t===void 0?{}:{maxHeight:C(t)}},".cm-gutters":{backgroundColor:"transparent",color:i.content.dim,border:"none",userSelect:"none"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",minWidth:"2ch"},".cm-content ::selection":{backgroundColor:i.selection.background},".cm-panels":{backgroundColor:i.surface.raised,color:i.content.primary,border:"none",fontFamily:i.typography.sans},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${i.boundary.default}`},".cm-textfield":{backgroundColor:i.surface.inset,color:i.content.primary,border:`1px solid ${i.boundary.default}`,borderRadius:i.shape.small},".cm-button":{backgroundColor:i.surface.raised,backgroundImage:"none",color:i.content.primary,border:`1px solid ${i.boundary.default}`,borderRadius:i.shape.small},".cm-searchMatch":{backgroundColor:i.accent.muted},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:i.accent.default,color:i.content.onAccent},".cm-source-change":{backgroundColor:J,borderRadius:"2px"},".cm-line:has(.cm-source-change)":{backgroundColor:V},".cm-source-change, .cm-line:has(.cm-source-change)":{animationDuration:`${q}ms`,animationTimingFunction:"ease-out",animationFillMode:"forwards"},".cm-source-deletion":{display:"inline-block",width:"0",position:"relative"},".cm-source-deletion::after":{content:'""',position:"absolute",left:"-2px",bottom:"0",width:"4px",height:"1em",backgroundColor:"inherit",borderRadius:"2px"},".cm-source-change-0":{animationName:"vgai-source-change-even"},".cm-source-change-1":{animationName:"vgai-source-change-odd"},".cm-line:has(.cm-source-change-0)":{animationName:"vgai-source-line-even"},".cm-line:has(.cm-source-change-1)":{animationName:"vgai-source-line-odd"},"@keyframes vgai-source-line-even":{"0%, 40%":{backgroundColor:V},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-line-odd":{"0%, 40%":{backgroundColor:V},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-change-even":{"0%, 40%":{backgroundColor:J},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-change-odd":{"0%, 40%":{backgroundColor:J},"100%":{backgroundColor:"transparent"}},"@media (prefers-reduced-motion: reduce)":{".cm-source-change, .cm-line:has(.cm-source-change)":{animation:"none"}},".cm-matchingBracket, &.cm-focused .cm-matchingBracket":{backgroundColor:i.neutralOverlay.active,outline:`1px solid ${i.boundary.strong}`}},{dark:!0})}function ae(e,r,t,n){const o=r==="typescript"?[e.javascript.javascript({typescript:!0,jsx:!0})]:r==="json"?[e.json.json()]:[];return[e.view.lineNumbers(),e.view.highlightSpecialChars(),e.language.bracketMatching(),e.language.syntaxHighlighting(e.oneDark.oneDarkHighlightStyle),e.search.search({top:!0}),e.view.keymap.of([...e.commands.standardKeymap,...e.search.searchKeymap]),e.view.EditorView.lineWrapping,e.state.EditorState.readOnly.of(!0),e.view.EditorView.editable.of(!1),e.view.EditorView.contentAttributes.of({tabindex:"0"}),...o,ie(e,t,n)]}function ce({value:e,language:r,fontSize:t=11,maxHeight:n,ariaLabel:o,followChanges:a=!1}){const l=d.useRef(null),c=d.useRef(null),u=d.useRef(null),s=d.useRef(null),p=d.useRef(0),h=d.useRef(e);h.current=e;const[f,N]=d.useState(null),[D,T]=d.useState(!1);d.useEffect(()=>{let g=!1;return ne().then(y=>{g||N(y)},()=>{g||T(!0)}),()=>{g=!0}},[]),d.useEffect(()=>{const g=l.current;if(!g||!f)return;const y=se(f),v=new f.view.EditorView({parent:g,state:f.state.EditorState.create({doc:h.current,extensions:[ae(f,r,t,n),y.field]})});return c.current=v,u.current=y,()=>{s.current!==null&&clearTimeout(s.current),s.current=null,u.current=null,c.current=null,v.destroy()}},[f,r,t,n]),d.useEffect(()=>{const g=c.current;if(!g)return;const y=g.state.toText(e).toString(),v=g.state.doc.toString();if(v===y)return;const{from:j,oldEnd:K,newEnd:B}=oe(v,y),M=g.state.changes({from:j,to:K,insert:y.slice(j,B)}),S=u.current,x=[];if(a&&f&&S){const E=g.coordsAtPos(j),O=g.scrollDOM.getBoundingClientRect(),z=E&&E.top>=O.top&&E.bottom<=O.bottom&&E.left>=O.left&&E.right<=O.right?g.scrollSnapshot().map(M):f.view.EditorView.scrollIntoView(j,{y:"nearest",x:"nearest"});z&&x.push(z),x.push(S.mark.of({from:j,to:B,revision:++p.current}))}else S&&x.push(S.mark.of(null));g.dispatch({changes:M,effects:x}),s.current!==null&&clearTimeout(s.current),s.current=null,a&&S&&(s.current=setTimeout(()=>{c.current===g&&g.dispatch({effects:S.mark.of(null)}),s.current=null},q))},[e,a,f]);const k=L(n)?{height:"100%",minHeight:0}:{};return f?m.jsx("div",{ref:l,role:"group","aria-label":o,style:{minWidth:0,...k}}):m.jsxs("div",{role:"group","aria-label":o,style:{minWidth:0,...k},children:[D&&m.jsx("div",{style:{color:i.semantic.warning,fontSize:10,marginBottom:4},children:"Syntax highlighting failed to load — showing plain text."}),m.jsx("pre",{style:{margin:0,fontFamily:i.typography.mono,fontSize:t,lineHeight:1.5,color:i.content.primary,whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"auto",...n===void 0?{}:{maxHeight:C(n)},...L(n)?{height:C(n)}:{}},children:e})]})}const le={fontSize:11,color:i.content.muted,marginBottom:2};function ue({assetPath:e}){const[r,t]=d.useState(null),[n,o]=d.useState("json"),[a,l]=d.useState(!1),c=e.split("/").pop()??e;return d.useEffect(()=>{let u=!1;return t(null),l(!1),fetch(W(e)).then(s=>s.text()).then(s=>{try{const p=JSON.parse(s);u||(o("json"),t(JSON.stringify(p,null,2)))}catch{u||(o("text"),t(s))}}).catch(()=>{u||l(!0)}),()=>{u=!0}},[e]),m.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[m.jsx("div",{style:{fontWeight:600,fontSize:12,color:i.content.primary,wordBreak:"break-all"},children:c}),m.jsx("div",{className:"vgai-content-frost",style:{border:`1px solid ${i.boundary.default}`,borderRadius:i.shape.small,padding:8,overflow:"hidden",maxHeight:500},children:a?m.jsx("span",{style:{color:i.semantic.danger,fontSize:11},children:"Failed to load file"}):r===null?m.jsx("span",{style:{color:i.content.muted,fontSize:11},children:"Loading..."}):m.jsx(ce,{value:r,language:n,fontSize:10,maxHeight:484,ariaLabel:`Contents of ${c}`})}),m.jsx(X,{label:"Info",defaultOpen:!1,children:m.jsxs("div",{children:[m.jsx("div",{style:le,children:"Path"}),m.jsx("div",{style:{fontSize:11,color:i.content.primary,wordBreak:"break-all"},children:e})]})})]})}function pe(e){const r=[],t=new Set;return e.traverse(n=>{if(n.type!=="ParticleEmitter")return;const o=n.system;!o||typeof o.getRendererSettings!="function"||t.has(o)||(t.add(o),r.push(o))}),r}function de(e){const r=e.split(/[?#]/,1)[0].replace(/^\/+/,"");return r.startsWith("public/")?r:`public/${r}`}const $=new WeakMap;function R(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function G(e){return R(e)?e:null}function P(e,r){r(e);for(const t of e.children??[])P(t,r)}function me(e){if(!R(e))return!1;const r=G(e.object);if(!r)return!1;let t=!1;return P(r,n=>{n.type==="ParticleEmitter"&&R(n.ps)&&n.ps.version!==void 0&&(t=!0)}),t}function fe(e){const r=new Map,t=G(e.object);return t&&P(t,n=>{typeof n.uuid=="string"&&r.set(n.uuid,n)}),r}function ge(e){const r=new ee().parse(e.json),t=fe(e.json),n=pe(r),o=new Map(n.map(c=>[c.emitter,c])),a=new Map;if(r.traverse(c=>{const u=o.get(c);if(!u)return;const s=t.get(c.uuid);if(!s?.ps)throw new Error(`Native Quarks emitter ${c.name||c.uuid} has no matching JSON node.`);a.set(c,{system:u,json:s})}),a.size===0)throw new Error("The Quarks document contains no loadable emitter.");const l={root:r,originalText:e.text,json:e.json,emitters:a,dirty:!1};return $.set(r,l),l}function U(e){const r=$.get(e);if(!r)throw new Error("Object3D is not a native three.quarks JSON document.");return r}function he(e){for(const r of e.emitters.values())r.system.dispose();$.delete(e.root)}function ye(e){const r=U(e);return r.dirty?`${JSON.stringify(r.json,null,2)}
2
+ import{a as m}from"./jsx-runtime-DPjLkJKQ.js";import{r as d}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{t as i,_ as b,b4 as W,S as X,aH as Y}from"./index-DGwLrPW2.js";import"./index-D2LwEE0L.js";import{O as Z,Q as ee,V as _,C as te,G as F}from"./StageHost-CjZBoXiO.js";const re={ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"typescript",jsx:"typescript",mjs:"typescript",cjs:"typescript",json:"json",jsonc:"json",json5:"json"};function Je(e){const r=e.split("/").pop()??e,t=r.lastIndexOf(".");return t<0?"text":re[r.slice(t+1).toLowerCase()]??"text"}let I=null;function ne(){return I??=Promise.all([b(()=>import("./index-BP6wv2A0.js"),[]),b(()=>import("./index-DgapqSPi.js").then(e=>e.i),__vite__mapDeps([0,1])),b(()=>import("./index-CJbYy-CF.js").then(e=>e.w),__vite__mapDeps([2,1,0])),b(()=>import("./index-CanA16PU.js"),__vite__mapDeps([3,0,1])),b(()=>import("./index-Bge9JUr6.js"),__vite__mapDeps([4,1,0,2])),b(()=>import("./index-gHZae-lw.js"),__vite__mapDeps([5,6,2,1,0])),b(()=>import("./index-IEjydI9d.js"),__vite__mapDeps([7,6,2,1,0])),b(()=>import("./index-DUqP1RMl.js"),__vite__mapDeps([8,0,1,2]))]).then(([e,r,t,n,o,a,l,c])=>({state:e,view:r,language:t,search:n,commands:o,javascript:a,json:l,oneDark:c})),I}function C(e){return typeof e=="number"?`${e}px`:e}function L(e){return typeof e=="string"&&e.trim().endsWith("%")}function oe(e,r){let t=0;for(;t<e.length&&t<r.length&&e[t]===r[t];)t++;let n=e.length,o=r.length;for(;n>t&&o>t&&e[n-1]===r[o-1];)n--,o--;return{from:t,oldEnd:n,newEnd:o}}const q=1800,J=`color-mix(in srgb, ${i.semantic.warning} 42%, transparent)`,V=`color-mix(in srgb, ${i.semantic.warning} 18%, transparent)`;function se(e){class r extends e.view.WidgetType{constructor(a){super(),this.revision=a}eq(a){return this.revision===a.revision}toDOM(){const a=document.createElement("span");return a.className=`cm-source-deletion cm-source-change cm-source-change-${this.revision%2}`,a.setAttribute("aria-hidden","true"),a}}const t=e.state.StateEffect.define(),n=e.state.StateField.define({create:()=>e.view.Decoration.none,update(o,a){let l=o.map(a.changes);for(const c of a.effects){if(!c.is(t))continue;if(!c.value){l=e.view.Decoration.none;continue}const{from:u,to:s,revision:p}=c.value,h=u===s?e.view.Decoration.widget({widget:new r(p),side:-1}).range(u):e.view.Decoration.mark({class:`cm-source-change cm-source-change-${p%2}`}).range(u,s);l=e.view.Decoration.set([h])}return l},provide:o=>e.view.EditorView.decorations.from(o)});return{mark:t,field:n}}function ie(e,r,t){return e.view.EditorView.theme({"&":{color:i.content.primary,backgroundColor:"transparent",fontSize:`${r}px`,...L(t)?{height:C(t)}:{}},"&.cm-focused":{outline:"none"},".cm-content":{fontFamily:i.typography.mono,padding:"2px 0",caretColor:"transparent"},".cm-scroller":{fontFamily:i.typography.mono,lineHeight:"1.5",overflow:"auto",...t===void 0?{}:{maxHeight:C(t)}},".cm-gutters":{backgroundColor:"transparent",color:i.content.dim,border:"none",userSelect:"none"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",minWidth:"2ch"},".cm-content ::selection":{backgroundColor:i.selection.background},".cm-panels":{backgroundColor:i.surface.raised,color:i.content.primary,border:"none",fontFamily:i.typography.sans},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${i.boundary.default}`},".cm-textfield":{backgroundColor:i.surface.inset,color:i.content.primary,border:`1px solid ${i.boundary.default}`,borderRadius:i.shape.small},".cm-button":{backgroundColor:i.surface.raised,backgroundImage:"none",color:i.content.primary,border:`1px solid ${i.boundary.default}`,borderRadius:i.shape.small},".cm-searchMatch":{backgroundColor:i.accent.muted},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:i.accent.default,color:i.content.onAccent},".cm-source-change":{backgroundColor:J,borderRadius:"2px"},".cm-line:has(.cm-source-change)":{backgroundColor:V},".cm-source-change, .cm-line:has(.cm-source-change)":{animationDuration:`${q}ms`,animationTimingFunction:"ease-out",animationFillMode:"forwards"},".cm-source-deletion":{display:"inline-block",width:"0",position:"relative"},".cm-source-deletion::after":{content:'""',position:"absolute",left:"-2px",bottom:"0",width:"4px",height:"1em",backgroundColor:"inherit",borderRadius:"2px"},".cm-source-change-0":{animationName:"vgai-source-change-even"},".cm-source-change-1":{animationName:"vgai-source-change-odd"},".cm-line:has(.cm-source-change-0)":{animationName:"vgai-source-line-even"},".cm-line:has(.cm-source-change-1)":{animationName:"vgai-source-line-odd"},"@keyframes vgai-source-line-even":{"0%, 40%":{backgroundColor:V},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-line-odd":{"0%, 40%":{backgroundColor:V},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-change-even":{"0%, 40%":{backgroundColor:J},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-change-odd":{"0%, 40%":{backgroundColor:J},"100%":{backgroundColor:"transparent"}},"@media (prefers-reduced-motion: reduce)":{".cm-source-change, .cm-line:has(.cm-source-change)":{animation:"none"}},".cm-matchingBracket, &.cm-focused .cm-matchingBracket":{backgroundColor:i.neutralOverlay.active,outline:`1px solid ${i.boundary.strong}`}},{dark:!0})}function ae(e,r,t,n){const o=r==="typescript"?[e.javascript.javascript({typescript:!0,jsx:!0})]:r==="json"?[e.json.json()]:[];return[e.view.lineNumbers(),e.view.highlightSpecialChars(),e.language.bracketMatching(),e.language.syntaxHighlighting(e.oneDark.oneDarkHighlightStyle),e.search.search({top:!0}),e.view.keymap.of([...e.commands.standardKeymap,...e.search.searchKeymap]),e.view.EditorView.lineWrapping,e.state.EditorState.readOnly.of(!0),e.view.EditorView.editable.of(!1),e.view.EditorView.contentAttributes.of({tabindex:"0"}),...o,ie(e,t,n)]}function ce({value:e,language:r,fontSize:t=11,maxHeight:n,ariaLabel:o,followChanges:a=!1}){const l=d.useRef(null),c=d.useRef(null),u=d.useRef(null),s=d.useRef(null),p=d.useRef(0),h=d.useRef(e);h.current=e;const[f,N]=d.useState(null),[D,T]=d.useState(!1);d.useEffect(()=>{let g=!1;return ne().then(y=>{g||N(y)},()=>{g||T(!0)}),()=>{g=!0}},[]),d.useEffect(()=>{const g=l.current;if(!g||!f)return;const y=se(f),v=new f.view.EditorView({parent:g,state:f.state.EditorState.create({doc:h.current,extensions:[ae(f,r,t,n),y.field]})});return c.current=v,u.current=y,()=>{s.current!==null&&clearTimeout(s.current),s.current=null,u.current=null,c.current=null,v.destroy()}},[f,r,t,n]),d.useEffect(()=>{const g=c.current;if(!g)return;const y=g.state.toText(e).toString(),v=g.state.doc.toString();if(v===y)return;const{from:j,oldEnd:K,newEnd:B}=oe(v,y),M=g.state.changes({from:j,to:K,insert:y.slice(j,B)}),S=u.current,x=[];if(a&&f&&S){const E=g.coordsAtPos(j),O=g.scrollDOM.getBoundingClientRect(),z=E&&E.top>=O.top&&E.bottom<=O.bottom&&E.left>=O.left&&E.right<=O.right?g.scrollSnapshot().map(M):f.view.EditorView.scrollIntoView(j,{y:"nearest",x:"nearest"});z&&x.push(z),x.push(S.mark.of({from:j,to:B,revision:++p.current}))}else S&&x.push(S.mark.of(null));g.dispatch({changes:M,effects:x}),s.current!==null&&clearTimeout(s.current),s.current=null,a&&S&&(s.current=setTimeout(()=>{c.current===g&&g.dispatch({effects:S.mark.of(null)}),s.current=null},q))},[e,a,f]);const k=L(n)?{height:"100%",minHeight:0}:{};return f?m.jsx("div",{ref:l,role:"group","aria-label":o,style:{minWidth:0,...k}}):m.jsxs("div",{role:"group","aria-label":o,style:{minWidth:0,...k},children:[D&&m.jsx("div",{style:{color:i.semantic.warning,fontSize:10,marginBottom:4},children:"Syntax highlighting failed to load — showing plain text."}),m.jsx("pre",{style:{margin:0,fontFamily:i.typography.mono,fontSize:t,lineHeight:1.5,color:i.content.primary,whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"auto",...n===void 0?{}:{maxHeight:C(n)},...L(n)?{height:C(n)}:{}},children:e})]})}const le={fontSize:11,color:i.content.muted,marginBottom:2};function ue({assetPath:e}){const[r,t]=d.useState(null),[n,o]=d.useState("json"),[a,l]=d.useState(!1),c=e.split("/").pop()??e;return d.useEffect(()=>{let u=!1;return t(null),l(!1),fetch(W(e)).then(s=>s.text()).then(s=>{try{const p=JSON.parse(s);u||(o("json"),t(JSON.stringify(p,null,2)))}catch{u||(o("text"),t(s))}}).catch(()=>{u||l(!0)}),()=>{u=!0}},[e]),m.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[m.jsx("div",{style:{fontWeight:600,fontSize:12,color:i.content.primary,wordBreak:"break-all"},children:c}),m.jsx("div",{className:"vgai-content-frost",style:{border:`1px solid ${i.boundary.default}`,borderRadius:i.shape.small,padding:8,overflow:"hidden",maxHeight:500},children:a?m.jsx("span",{style:{color:i.semantic.danger,fontSize:11},children:"Failed to load file"}):r===null?m.jsx("span",{style:{color:i.content.muted,fontSize:11},children:"Loading..."}):m.jsx(ce,{value:r,language:n,fontSize:10,maxHeight:484,ariaLabel:`Contents of ${c}`})}),m.jsx(X,{label:"Info",defaultOpen:!1,children:m.jsxs("div",{children:[m.jsx("div",{style:le,children:"Path"}),m.jsx("div",{style:{fontSize:11,color:i.content.primary,wordBreak:"break-all"},children:e})]})})]})}function pe(e){const r=[],t=new Set;return e.traverse(n=>{if(n.type!=="ParticleEmitter")return;const o=n.system;!o||typeof o.getRendererSettings!="function"||t.has(o)||(t.add(o),r.push(o))}),r}function de(e){const r=e.split(/[?#]/,1)[0].replace(/^\/+/,"");return r.startsWith("public/")?r:`public/${r}`}const $=new WeakMap;function R(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function G(e){return R(e)?e:null}function P(e,r){r(e);for(const t of e.children??[])P(t,r)}function me(e){if(!R(e))return!1;const r=G(e.object);if(!r)return!1;let t=!1;return P(r,n=>{n.type==="ParticleEmitter"&&R(n.ps)&&n.ps.version!==void 0&&(t=!0)}),t}function fe(e){const r=new Map,t=G(e.object);return t&&P(t,n=>{typeof n.uuid=="string"&&r.set(n.uuid,n)}),r}function ge(e){const r=new ee().parse(e.json),t=fe(e.json),n=pe(r),o=new Map(n.map(c=>[c.emitter,c])),a=new Map;if(r.traverse(c=>{const u=o.get(c);if(!u)return;const s=t.get(c.uuid);if(!s?.ps)throw new Error(`Native Quarks emitter ${c.name||c.uuid} has no matching JSON node.`);a.set(c,{system:u,json:s})}),a.size===0)throw new Error("The Quarks document contains no loadable emitter.");const l={root:r,originalText:e.text,json:e.json,emitters:a,dirty:!1};return $.set(r,l),l}function U(e){const r=$.get(e);if(!r)throw new Error("Object3D is not a native three.quarks JSON document.");return r}function he(e){for(const r of e.emitters.values())r.system.dispose();$.delete(e.root)}function ye(e){const r=U(e);return r.dirty?`${JSON.stringify(r.json,null,2)}
3
3
  `:r.originalText}const be=new Set(["particles.duration","particles.looping","particles.prewarm","particles.worldSpace","particles.startLife","particles.startSpeed","particles.startRotation","particles.startSize","particles.startColor","particles.emissionOverTime","particles.emissionOverDistance"]);function we(){return[{path:"particles.duration",label:"Duration",type:"number",group:"Emission"},{path:"particles.looping",label:"Looping",type:"boolean",group:"Emission"},{path:"particles.prewarm",label:"Prewarm",type:"boolean",group:"Emission"},{path:"particles.emissionOverTime",label:"Rate over time",type:"json",group:"Emission"},{path:"particles.emissionOverDistance",label:"Rate over distance",type:"json",group:"Emission"},{path:"particles.startLife",label:"Lifetime",type:"json",group:"Start"},{path:"particles.startSpeed",label:"Speed",type:"json",group:"Start"},{path:"particles.startRotation",label:"Rotation",type:"json",group:"Start"},{path:"particles.startSize",label:"Size",type:"json",group:"Start"},{path:"particles.startColor",label:"Color",type:"json",group:"Start"},{path:"particles.worldSpace",label:"World space",type:"boolean",group:"Simulation"},{path:"particles.shape",label:"Shape",type:"string",readonly:!0,group:"Shape"},{path:"particles.behaviors",label:"Modules",type:"json",readonly:!0,group:"Behavior"},{path:"particles.renderMode",label:"Native render mode",type:"number",readonly:!0,group:"Renderer"}]}function w(e,r){if(!R(e)||typeof e.type!="string")throw new Error(`${r} must be a native quarks function JSON object with a type.`);return e}function Q(e,r){const{system:t}=e;switch(r){case"particles.duration":return t.duration;case"particles.looping":return t.looping;case"particles.prewarm":return t.prewarm;case"particles.worldSpace":return t.worldSpace;case"particles.startLife":return t.startLife.toJSON();case"particles.startSpeed":return t.startSpeed.toJSON();case"particles.startRotation":return t.startRotation.toJSON();case"particles.startSize":return t.startSize.toJSON();case"particles.startColor":return t.startColor.toJSON();case"particles.emissionOverTime":return t.emissionOverTime.toJSON();case"particles.emissionOverDistance":return t.emissionOverDistance.toJSON();case"particles.shape":return t.emitterShape.type;case"particles.behaviors":return t.behaviors.map(n=>n.type);case"particles.renderMode":return t.renderMode;default:return}}function A(e){return e.slice(10)}function H(e,r,t){const{system:n}=e;switch(r){case"particles.duration":{const o=Number(t);if(!Number.isFinite(o)||o<=0)throw new Error("Particle duration must be a positive finite number.");n.duration=o;break}case"particles.looping":n.looping=!!t;break;case"particles.prewarm":n.prewarm=!!t;break;case"particles.worldSpace":n.worldSpace=!!t;break;case"particles.startLife":n.startLife=_(w(t,"Lifetime"));break;case"particles.startSpeed":n.startSpeed=_(w(t,"Speed"));break;case"particles.startRotation":n.startRotation=F(w(t,"Rotation"));break;case"particles.startSize":n.startSize=F(w(t,"Size"));break;case"particles.startColor":n.startColor=te(w(t,"Color"));break;case"particles.emissionOverTime":n.emissionOverTime=_(w(t,"Rate over time"));break;case"particles.emissionOverDistance":n.emissionOverDistance=_(w(t,"Rate over distance"));break;default:throw new Error(`Particle field ${r} is read-only.`)}e.json.ps[A(r)]=t,n.restart()}function Se(e,r,t,n){H(e,r,t),e.json.ps[A(r)]=n}function ve(e){return e===void 0?void 0:JSON.parse(JSON.stringify(e))}const je=({root:e,defaultAdapter:r,commit:t})=>{const n=U(e),o=new Set,a=()=>{for(const s of o)s()},l=s=>{const p=r.hierarchy.object3D?.(s);return p?n.emitters.get(p)??null:null},c={properties:s=>[...r.inspector?.properties(s)??[],...l(s)?we():[]],get:(s,p)=>{const h=l(s);return h&&p.startsWith("particles.")?Q(h,p):r.inspector?.get(s,p)},set:async(s,p,h)=>{const f=l(s);if(!f||!be.has(p)){await r.inspector?.set(s,p,h);return}const N=Q(f,p),D=A(p),T=ve(f.json.ps?.[D]),k=n.dirty;try{H(f,p,h),n.dirty=!0,a(),await t(`Edit ${f.system.emitter.name||"Particle Emitter"}`)}catch(g){throw Se(f,p,N,T),n.dirty=k,a(),g}}};return{adapter:{capabilities:{...r.capabilities,inspectorFields:!0,persist:!0},provenance:{source:"document",label:"three.quarks JSON",detail:"The hierarchy and emitter fields are the native three.quarks Object3D JSON document."},hierarchy:r.hierarchy,...r.selection?{selection:r.selection}:{},...r.transforms?{transforms:r.transforms}:{},inspector:c,subscribe:s=>{o.add(s);const p=r.subscribe?.(s)??(()=>{});return()=>{o.delete(s),p()}}},dispose:()=>o.clear()}};async function Ee(e,r){const t=await fetch(W(e),{cache:"no-store",...r?{signal:r}:{}});if(!t.ok)throw new Error(`Could not load ${e}: HTTP ${t.status}.`);const n=await t.text();let o;try{o=JSON.parse(n)}catch{return null}return me(o)?{text:n,json:o,projectPath:de(e)}:null}function ke({documentId:e,assetPath:r,displayName:t,active:n,source:o}){const[a,l]=d.useState(null),[c,u]=d.useState(null);d.useEffect(()=>{if(!n){l(null);return}let h=null;try{h=ge(o),l(h),u(null)}catch(f){u(f instanceof Error?f.message:String(f))}return()=>{h&&he(h)}},[n,o]);const s=d.useCallback(()=>{if(!a)throw new Error(`Particle asset ${r} is not loaded.`);return{root:a.root,dispose(){}}},[a,r]),p=d.useMemo(()=>({label:`Edit ${t}`,resources:[{path:o.projectPath,contentType:"application/json",serialize:({root:h})=>ye(h)}]}),[t,o.projectPath]);return c?m.jsx("div",{role:"alert",style:{padding:20,color:i.semantic.danger},children:c}):a?m.jsx(Z,{documentId:e,sourcePath:r,displayName:t,build:s,active:n,assetType:"particles",persistence:p,authoring:je,dressing:{grid:!0}}):m.jsxs("div",{style:{padding:20,color:i.content.muted},children:["Loading ",t,"…"]})}function xe({documentId:e,assetPath:r,displayName:t,active:n,sections:o,status:a}){const[l,c]=d.useState({kind:"loading"});return d.useEffect(()=>{if(!n){c({kind:"loading"});return}const u=new AbortController;return c({kind:"loading"}),Ee(r,u.signal).then(s=>{u.signal.aborted||c(s?{kind:"quarks",source:s}:{kind:"generic"})},s=>{u.signal.aborted||c({kind:"error",message:s instanceof Error?s.message:String(s)})}),()=>u.abort()},[n,r]),l.kind==="quarks"?m.jsx(ke,{documentId:e,assetPath:r,displayName:t,active:n,source:l.source}):m.jsx(Y,{documentId:e,active:n,type:"json",title:t,sections:o,status:a,children:l.kind==="loading"?m.jsxs("div",{style:{padding:20,color:i.content.muted},children:["Inspecting ",t,"…"]}):l.kind==="error"?m.jsx("div",{role:"alert",style:{padding:20,color:i.semantic.danger},children:l.message}):m.jsx(ue,{assetPath:r})})}const Ve=Object.freeze(Object.defineProperty({__proto__:null,JsonAssetDocument:xe},Symbol.toStringTag,{value:"Module"}));export{ce as C,xe as J,Ve as a,Je as c};
@@ -1 +1 @@
1
- import{a as u}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{x,y as w,z as E,A as S,D as a,t as f}from"./index-DuB3wHKD.js";import"./index-D2LwEE0L.js";import{O as M}from"./StageHost-B4P-uvV9.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-BHxt84w6.js";import"./LineSegments2-vfeDUBfs.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function G({documentId:g,assetPath:o,displayName:d,active:i}){const[b,s]=l.useState(null),[c,p]=l.useState(null);l.useEffect(()=>{if(!i){s(null);return}const n=new AbortController;let m=null;s(null),p(null);const t=x(o);return(t==="glb"||t==="gltf"||t==="spz"?w(o,n.signal):t?E({url:o,format:t}).then(S).then(r=>({root:r,sourceBytes:null})):Promise.reject(new Error(`No native Three.js model loader supports ${o}.`))).then(r=>{if(n.signal.aborted){a(r.root);return}m=r.root,s(r)},r=>{n.signal.aborted||p(r instanceof Error?r.message:String(r))}),()=>{n.abort(),m&&a(m)}},[i,o]);const e=b?.root??null,j=l.useCallback(()=>{if(!e)throw new Error(`Model asset ${o} is not loaded.`);return{root:e,animations:e.animations,dispose(){}}},[o,e]);return c?u.jsx("div",{role:"alert",style:{padding:20,color:f.semantic.danger},children:c}):e?u.jsx(M,{documentId:g,sourcePath:o,displayName:d,build:j,active:i,assetType:"model",modelSource:{kind:"project-file",path:o}}):u.jsxs("div",{style:{padding:20,color:f.content.muted},children:["Loading ",d,"…"]})}export{G as ModelAssetDocument};
1
+ import{a as u}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{x,y as w,z as E,A as S,D as a,t as f}from"./index-DGwLrPW2.js";import"./index-D2LwEE0L.js";import{O as M}from"./StageHost-CjZBoXiO.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-BHxt84w6.js";import"./LineSegments2-vfeDUBfs.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function G({documentId:g,assetPath:o,displayName:d,active:i}){const[b,s]=l.useState(null),[c,p]=l.useState(null);l.useEffect(()=>{if(!i){s(null);return}const n=new AbortController;let m=null;s(null),p(null);const t=x(o);return(t==="glb"||t==="gltf"||t==="spz"?w(o,n.signal):t?E({url:o,format:t}).then(S).then(r=>({root:r,sourceBytes:null})):Promise.reject(new Error(`No native Three.js model loader supports ${o}.`))).then(r=>{if(n.signal.aborted){a(r.root);return}m=r.root,s(r)},r=>{n.signal.aborted||p(r instanceof Error?r.message:String(r))}),()=>{n.abort(),m&&a(m)}},[i,o]);const e=b?.root??null,j=l.useCallback(()=>{if(!e)throw new Error(`Model asset ${o} is not loaded.`);return{root:e,animations:e.animations,dispose(){}}},[o,e]);return c?u.jsx("div",{role:"alert",style:{padding:20,color:f.semantic.danger},children:c}):e?u.jsx(M,{documentId:g,sourcePath:o,displayName:d,build:j,active:i,assetType:"model",modelSource:{kind:"project-file",path:o}}):u.jsxs("div",{style:{padding:20,color:f.content.muted},children:["Loading ",d,"…"]})}export{G as ModelAssetDocument};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/world-documents-CWiw361z.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-DuB3wHKD.js","assets/index-DaQZGF7d.js","assets/index-D_NuPfjr.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/three.module-BynznMJN.js","assets/index-D2fNXpHa.css","assets/edit-mode-authoring-DBEoND0w.js","assets/TransientHint-9_u15mth.js","assets/react-story-board-d_OfX68Z.js","assets/viewport-pick-context-DkawXbEi.js"])))=>i.map(i=>d[i]);
2
- import{r as p}from"./index-DaQZGF7d.js";import{U as u,V as h,W as m,_ as l,X as f,Y as b,Z as g}from"./index-DuB3wHKD.js";import{b as v,e as r,i as D}from"./edit-mode-authoring-DBEoND0w.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";class y{constructor(s){this.store=s,this.unbind=v(()=>this.rebuild()),this.ready=this.rebuild()}references=0;disposed=!1;composite;disposeDocuments;stages=new Set;tail=Promise.resolve();unbind;ready;retain(){return this.references++,()=>{--this.references>0||(this.disposed=!0,this.unbind(),this.disposeDocuments?.(),r(this.composite),n.delete(this.store))}}attach(s){const i=this.retain();return this.stages.add(s),{ready:this.composite?s(this.composite):this.tail,dispose:()=>{this.stages.delete(s),i()}}}rebuild(){const s=this.tail.then(async()=>{if(this.disposed)return;const i=b(),a=new Set(h().map(t=>t.descriptor.id)),c=this.composite?m().map(t=>t.descriptor.id).filter(t=>a.has(t)):[];this.disposeDocuments?.(),this.disposeDocuments=void 0,r(this.composite),this.composite=void 0;const o=await D(this.store);if(this.disposed){r(o);return}const{installRootDocuments:d}=await l(async()=>{const{installRootDocuments:t}=await import("./world-documents-CWiw361z.js");return{installRootDocuments:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]));if(this.disposed){r(o);return}this.composite=o,this.disposeDocuments=d(this.store,o);for(const t of c)f(t,t===i);await Promise.all([...this.stages].map(t=>t(o)))});return this.tail=s.catch(()=>{}),s}}const n=new Map;function w(e){let s=n.get(e);return s||(s=new y(e),n.set(e,s)),s}function P(e){const s=w(e);return{ready:s.ready.then(()=>u()),dispose:s.retain()}}function I({store:e}){return p.useEffect(()=>{const s=P(e);return s.ready.catch(i=>{g.error(`Authoring session failed: ${i instanceof Error?i.message:String(i)}`,"authoring")}),s.dispose},[e]),null}export{I as ProjectAuthoringBootstrap};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/world-documents-DCnT6IOG.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-DGwLrPW2.js","assets/index-DaQZGF7d.js","assets/index-D_NuPfjr.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/three.module-BynznMJN.js","assets/index-D2fNXpHa.css","assets/edit-mode-authoring-D-tlcyhW.js","assets/TransientHint-Cut0DwSC.js","assets/react-story-board-Dz4z1udM.js","assets/viewport-pick-context-DkawXbEi.js"])))=>i.map(i=>d[i]);
2
+ import{r as p}from"./index-DaQZGF7d.js";import{U as u,V as h,W as m,_ as l,X as f,Y as b,Z as g}from"./index-DGwLrPW2.js";import{b as v,e as r,i as D}from"./edit-mode-authoring-D-tlcyhW.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";class y{constructor(s){this.store=s,this.unbind=v(()=>this.rebuild()),this.ready=this.rebuild()}references=0;disposed=!1;composite;disposeDocuments;stages=new Set;tail=Promise.resolve();unbind;ready;retain(){return this.references++,()=>{--this.references>0||(this.disposed=!0,this.unbind(),this.disposeDocuments?.(),r(this.composite),n.delete(this.store))}}attach(s){const i=this.retain();return this.stages.add(s),{ready:this.composite?s(this.composite):this.tail,dispose:()=>{this.stages.delete(s),i()}}}rebuild(){const s=this.tail.then(async()=>{if(this.disposed)return;const i=b(),a=new Set(h().map(t=>t.descriptor.id)),c=this.composite?m().map(t=>t.descriptor.id).filter(t=>a.has(t)):[];this.disposeDocuments?.(),this.disposeDocuments=void 0,r(this.composite),this.composite=void 0;const o=await D(this.store);if(this.disposed){r(o);return}const{installRootDocuments:d}=await l(async()=>{const{installRootDocuments:t}=await import("./world-documents-DCnT6IOG.js");return{installRootDocuments:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]));if(this.disposed){r(o);return}this.composite=o,this.disposeDocuments=d(this.store,o);for(const t of c)f(t,t===i);await Promise.all([...this.stages].map(t=>t(o)))});return this.tail=s.catch(()=>{}),s}}const n=new Map;function w(e){let s=n.get(e);return s||(s=new y(e),n.set(e,s)),s}function P(e){const s=w(e);return{ready:s.ready.then(()=>u()),dispose:s.retain()}}function I({store:e}){return p.useEffect(()=>{const s=P(e);return s.ready.catch(i=>{g.error(`Authoring session failed: ${i instanceof Error?i.message:String(i)}`,"authoring")}),s.dispose},[e]),null}export{I as ProjectAuthoringBootstrap};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/spark.module-B_-x7Z29.js","assets/three.module-BynznMJN.js","assets/index-DuB3wHKD.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/index-D2fNXpHa.css"])))=>i.map(i=>d[i]);
2
- import{K as te,t as A,L as re,x as ne,M as ie,z as oe,A as ae,D as N,N as se,_ as le,O as ce,P as de,Q as pe}from"./index-DuB3wHKD.js";import{a as M}from"./jsx-runtime-DPjLkJKQ.js";import{r as C}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{aV as me,w as ue,k as fe,i as we,aW as he,aX as ge,aY as ve,aZ as be,ae as xe,a_ as ye,V as Ae,a$ as Me}from"./three.module-BynznMJN.js";import{O as Ce}from"./OrbitControls-BHxt84w6.js";import{s as Ee,i as F}from"./editor-presentation-activity-C7SNSmTd.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";const b={webglContext:0,animationFrame:0,resizeObserver:0,objectUrl:0},Q={...b};function _(r){b[r]++,Q[r]=Math.max(Q[r],b[r]);let a=!1;return()=>{a||(a=!0,b[r]=Math.max(0,b[r]-1))}}function Se(r){const a=r.animations[0];if(!a)return null;const m=new Me(r),h=m.clipAction(a).play();return h.paused=!0,m.update(0),m}let je=0;function $e({assetPath:r,materialPath:a,displayName:m="Object3D preview",active:h=!0,sourceFactory:E,showSkeleton:D=!1,background:z,cameraDirection:S,showGrid:H=!0,useDefaultLighting:L=!0,exposure:k=1,setupPreview:T}){const W=C.useRef(null),[j,V]=C.useState(null),[$,R]=C.useState(!0);return C.useEffect(()=>{if(!h)return;const o=W.current;if(!o)return;const x=new AbortController,X=te({id:`preview-card:${++je}`,label:`${m} (preview card)`,contentClock:()=>0}),t=new me({antialias:!0,alpha:!0}),Y=_("webglContext"),Z=_("animationFrame"),J=_("resizeObserver"),s=new ue,u=new fe(35,1,.01,1e3),f=new Ce(u,t.domElement),q=new xe;let I=null,w=null,y=null,c,l=null,g=null;const O=[];let d=0,p=!1;if(V(null),R(!0),t.outputColorSpace=we,t.toneMapping=he,t.toneMappingExposure=k,t.shadowMap.enabled=!0,t.setClearColor(z??2106410,1),t.setPixelRatio(Math.min(window.devicePixelRatio,2)),t.domElement.style.width="100%",t.domElement.style.height="100%",t.domElement.style.display="block",o.appendChild(t.domElement),f.enableDamping=!0,f.dampingFactor=.1,L){s.add(new ge(16777215,3489874,1.8));const e=new ve(16777215,2.2);e.position.set(3,5,4),s.add(e)}if(H){const e=new be(10,20,5333103,3423044);s.add(e),O.push(e)}const U=(e,n)=>{if(!g)return;const i=S?new Ae(...S):void 0,v=de(g,Math.max(e,1)/Math.max(n,1),i);u.copy(v,!1),f.target.copy(g.center),f.update()},G=async e=>{if(p)return;s.add(e);let n=!1;if(e.traverse(i=>{se(i,"gaussianSplat")&&(n=!0)}),n){const{SparkRenderer:i}=await le(async()=>{const{SparkRenderer:v}=await import("./spark.module-B_-x7Z29.js");return{SparkRenderer:v}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]));if(p)return;l=new i({renderer:t,enableLod:!1})}if(g=ce(e,"perspective"),U(o.clientWidth,o.clientHeight),I=Se(e),D){const i=new ye(e);i.name="__compact_preview_skeleton",s.add(i),O.push(i)}c=T?.({scene:s,camera:u,renderer:t,model:e}),c?.resize?.(Math.max(o.clientWidth,1),Math.max(o.clientHeight,1),t.getPixelRatio()),R(!1)};(async()=>{try{if(E){y=re(E),await G(y.root);return}if(!r)throw new Error("Compact Object3D preview has no source.");const e=ne(r);if(!e)throw new Error(`No native Three.js loader supports ${r}.`);const n=e==="glb"||e==="gltf"||e==="spz"?await ie(r,x.signal):await oe({url:r,format:e,...a?{materialUrl:a}:{}});if(w=ae(n),x.signal.aborted||p){N(w),w=null;return}await G(w)}catch(e){!x.signal.aborted&&!p&&(V(e instanceof Error?e.message:String(e)),R(!1))}})();const B=()=>{const e=Math.max(o.clientWidth,1),n=Math.max(o.clientHeight,1);t.setSize(e,n,!1),g&&!c?U(e,n):(u.aspect=e/n,u.updateProjectionMatrix()),c?.resize?.(e,n,t.getPixelRatio())},K=new ResizeObserver(B);K.observe(o),B();const P=()=>{if(d=0,p||!F())return;const e=Math.min(q.getDelta(),.1);f.update(),l&&s.add(l);try{c?.render?c.render(e):t.render(s,u)}finally{l?.removeFromParent()}d=requestAnimationFrame(P)},ee=Ee(()=>{F()?!p&&d===0&&(q.getDelta(),P()):(cancelAnimationFrame(d),d=0)});return F()&&(d=requestAnimationFrame(P)),()=>{p=!0,ee(),X(),x.abort(new Error("Compact Object3D preview closed.")),cancelAnimationFrame(d),K.disconnect(),I?.stopAllAction(),c?.dispose(),f.dispose(),l&&(l.removeFromParent(),pe(l),l=null),t.dispose(),t.forceContextLoss();for(const e of O){const n=e;n.geometry?.dispose();const i=n.material;if(Array.isArray(i))for(const v of i)v.dispose();else i?.dispose()}y&&y.dispose(),w&&N(w),o.contains(t.domElement)&&o.removeChild(t.domElement),J(),Z(),Y()}},[h,r,z,S,k,a,T,H,D,E,L]),M.jsxs("div",{ref:W,"data-testid":"object3d-compact-preview",role:"region","aria-label":`Interactive 3D preview: ${m}`,"aria-busy":$,style:{width:"100%",height:"100%",minHeight:220,overflow:"hidden",position:"relative",background:A.surface.inset},children:[$&&!j?M.jsx("span",{style:{position:"absolute",padding:10,color:A.content.muted},children:"Loading…"}):null,h?null:M.jsx("span",{style:{position:"absolute",padding:10,color:A.content.muted},children:"Preview suspended while inactive."}),j?M.jsx("div",{role:"alert",style:{position:"absolute",padding:10,color:A.semantic.danger},children:j}):null]})}export{$e as Object3DPreview};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/spark.module-CjQpY2Op.js","assets/three.module-BynznMJN.js","assets/index-DGwLrPW2.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/index-D2fNXpHa.css"])))=>i.map(i=>d[i]);
2
+ import{K as te,t as A,L as re,x as ne,M as ie,z as oe,A as ae,D as N,N as se,_ as le,O as ce,P as de,Q as pe}from"./index-DGwLrPW2.js";import{a as M}from"./jsx-runtime-DPjLkJKQ.js";import{r as C}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{aV as me,w as ue,k as fe,i as we,aW as he,aX as ge,aY as ve,aZ as be,ae as xe,a_ as ye,V as Ae,a$ as Me}from"./three.module-BynznMJN.js";import{O as Ce}from"./OrbitControls-BHxt84w6.js";import{s as Ee,i as F}from"./editor-presentation-activity-C7SNSmTd.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";const b={webglContext:0,animationFrame:0,resizeObserver:0,objectUrl:0},Q={...b};function _(r){b[r]++,Q[r]=Math.max(Q[r],b[r]);let a=!1;return()=>{a||(a=!0,b[r]=Math.max(0,b[r]-1))}}function Se(r){const a=r.animations[0];if(!a)return null;const m=new Me(r),h=m.clipAction(a).play();return h.paused=!0,m.update(0),m}let je=0;function $e({assetPath:r,materialPath:a,displayName:m="Object3D preview",active:h=!0,sourceFactory:E,showSkeleton:D=!1,background:z,cameraDirection:S,showGrid:H=!0,useDefaultLighting:L=!0,exposure:k=1,setupPreview:T}){const W=C.useRef(null),[j,V]=C.useState(null),[$,R]=C.useState(!0);return C.useEffect(()=>{if(!h)return;const o=W.current;if(!o)return;const x=new AbortController,X=te({id:`preview-card:${++je}`,label:`${m} (preview card)`,contentClock:()=>0}),t=new me({antialias:!0,alpha:!0}),Y=_("webglContext"),Z=_("animationFrame"),J=_("resizeObserver"),s=new ue,u=new fe(35,1,.01,1e3),f=new Ce(u,t.domElement),q=new xe;let I=null,w=null,y=null,c,l=null,g=null;const O=[];let d=0,p=!1;if(V(null),R(!0),t.outputColorSpace=we,t.toneMapping=he,t.toneMappingExposure=k,t.shadowMap.enabled=!0,t.setClearColor(z??2106410,1),t.setPixelRatio(Math.min(window.devicePixelRatio,2)),t.domElement.style.width="100%",t.domElement.style.height="100%",t.domElement.style.display="block",o.appendChild(t.domElement),f.enableDamping=!0,f.dampingFactor=.1,L){s.add(new ge(16777215,3489874,1.8));const e=new ve(16777215,2.2);e.position.set(3,5,4),s.add(e)}if(H){const e=new be(10,20,5333103,3423044);s.add(e),O.push(e)}const U=(e,n)=>{if(!g)return;const i=S?new Ae(...S):void 0,v=de(g,Math.max(e,1)/Math.max(n,1),i);u.copy(v,!1),f.target.copy(g.center),f.update()},G=async e=>{if(p)return;s.add(e);let n=!1;if(e.traverse(i=>{se(i,"gaussianSplat")&&(n=!0)}),n){const{SparkRenderer:i}=await le(async()=>{const{SparkRenderer:v}=await import("./spark.module-CjQpY2Op.js");return{SparkRenderer:v}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]));if(p)return;l=new i({renderer:t,enableLod:!1})}if(g=ce(e,"perspective"),U(o.clientWidth,o.clientHeight),I=Se(e),D){const i=new ye(e);i.name="__compact_preview_skeleton",s.add(i),O.push(i)}c=T?.({scene:s,camera:u,renderer:t,model:e}),c?.resize?.(Math.max(o.clientWidth,1),Math.max(o.clientHeight,1),t.getPixelRatio()),R(!1)};(async()=>{try{if(E){y=re(E),await G(y.root);return}if(!r)throw new Error("Compact Object3D preview has no source.");const e=ne(r);if(!e)throw new Error(`No native Three.js loader supports ${r}.`);const n=e==="glb"||e==="gltf"||e==="spz"?await ie(r,x.signal):await oe({url:r,format:e,...a?{materialUrl:a}:{}});if(w=ae(n),x.signal.aborted||p){N(w),w=null;return}await G(w)}catch(e){!x.signal.aborted&&!p&&(V(e instanceof Error?e.message:String(e)),R(!1))}})();const B=()=>{const e=Math.max(o.clientWidth,1),n=Math.max(o.clientHeight,1);t.setSize(e,n,!1),g&&!c?U(e,n):(u.aspect=e/n,u.updateProjectionMatrix()),c?.resize?.(e,n,t.getPixelRatio())},K=new ResizeObserver(B);K.observe(o),B();const P=()=>{if(d=0,p||!F())return;const e=Math.min(q.getDelta(),.1);f.update(),l&&s.add(l);try{c?.render?c.render(e):t.render(s,u)}finally{l?.removeFromParent()}d=requestAnimationFrame(P)},ee=Ee(()=>{F()?!p&&d===0&&(q.getDelta(),P()):(cancelAnimationFrame(d),d=0)});return F()&&(d=requestAnimationFrame(P)),()=>{p=!0,ee(),X(),x.abort(new Error("Compact Object3D preview closed.")),cancelAnimationFrame(d),K.disconnect(),I?.stopAllAction(),c?.dispose(),f.dispose(),l&&(l.removeFromParent(),pe(l),l=null),t.dispose(),t.forceContextLoss();for(const e of O){const n=e;n.geometry?.dispose();const i=n.material;if(Array.isArray(i))for(const v of i)v.dispose();else i?.dispose()}y&&y.dispose(),w&&N(w),o.contains(t.domElement)&&o.removeChild(t.domElement),J(),Z(),Y()}},[h,r,z,S,k,a,T,H,D,E,L]),M.jsxs("div",{ref:W,"data-testid":"object3d-compact-preview",role:"region","aria-label":`Interactive 3D preview: ${m}`,"aria-busy":$,style:{width:"100%",height:"100%",minHeight:220,overflow:"hidden",position:"relative",background:A.surface.inset},children:[$&&!j?M.jsx("span",{style:{position:"absolute",padding:10,color:A.content.muted},children:"Loading…"}):null,h?null:M.jsx("span",{style:{position:"absolute",padding:10,color:A.content.muted},children:"Preview suspended while inactive."}),j?M.jsx("div",{role:"alert",style:{position:"absolute",padding:10,color:A.semantic.danger},children:j}):null]})}export{$e as Object3DPreview};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Object3DPreview-ChopdNF4.js","assets/index-DuB3wHKD.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/three.module-BynznMJN.js","assets/index-D2fNXpHa.css","assets/OrbitControls-BHxt84w6.js","assets/editor-presentation-activity-C7SNSmTd.js"])))=>i.map(i=>d[i]);
2
- import{$ as T,a0 as L,a1 as H,a2 as R,a3 as U,t as a,a4 as b,a5 as w,S as k,a6 as W,B as M,a7 as N,a8 as J,_ as V}from"./index-DuB3wHKD.js";import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{r}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{d as G}from"./asset-editor-persistence-B6Yg7dTC.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-BynznMJN.js";const S=new Map,K=new Set;function C(){for(const e of K)e()}function q(e,o){const n=S.get(e);if(n?.status==="running")return n;const f={id:e,label:o,stage:"fetch",loaded:0,total:0,status:"running",controller:new AbortController};return S.set(e,f),C(),f}function g(e,o){const n=S.get(e);n&&(Object.assign(n,o),C())}const Q=r.lazy(()=>V(()=>import("./Object3DPreview-ChopdNF4.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.Object3DPreview}))),X={width:"100%"};function Y(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function de({online:e,mode:o="full",showPreview:n=!1,onResolved:f}){const[h,z]=r.useState([]),[l,D]=r.useState(null),[O,y]=r.useState(!0),[B,A]=r.useState(null),[v,E]=r.useState(null),[I,m]=r.useState(!1),[_,x]=r.useState(!1),[j,P]=r.useState(!1),[c,p]=r.useState("idle");r.useEffect(()=>{if(o==="preview"){y(!1);return}let s=!1;return y(!0),A(null),T(e.source,e.id).then(i=>{s||(z(i),i.length>0&&D(i[0]))}).catch(i=>{s||(z([]),A(i instanceof L?H(i.code):i instanceof Error?i.message:"Asset delivery metadata is unavailable while offline."))}).finally(()=>{s||y(!1)}),()=>{s=!0}},[o,e.source,e.id]);const F=e.source==="local"&&(e.type==="model"||e.type==="animation"||e.type==="source");r.useEffect(()=>{if(o==="inspector"&&!n){m(!1);return}let s=!1;if(E(null),x(!1),P(!1),!F){m(!1);return}return m(!0),R(e.source,e.id).then(i=>{s||(E(i),x(!i))}).catch(()=>{s||x(!0)}).finally(()=>{s||m(!1)}),()=>{s=!0}},[o,e.id,e.source,n,F]);const $=r.useCallback(async()=>{if(!l)return;const s=`single:${e.source}:${e.id}`,i=q(s,e.name);g(s,{stage:"fetch",loaded:0,total:l.sizeBytes??0,status:"running"}),p("downloading");try{const d={source:e.source,id:e.id,name:e.name,url:l.url,format:l.format,jobId:s,signal:i.controller.signal};l.includes&&(d.includes=l.includes);const u=await G(d);u.ok&&u.path?(g(s,{stage:"commit",loaded:l.sizeBytes??1,total:l.sizeBytes??1,status:u.alreadyExists?"skipped":"imported",message:u.path}),p("done"),U(`${e.name} added to Content — drag it from there into the viewport to place it.`),f?.(`/${u.path}`)):(g(s,{status:"failed",message:u.error??"The import was rejected."}),p("error"))}catch(d){g(s,{status:i.controller.signal.aborted?"cancelled":"failed",message:d instanceof Error?d.message:String(d)}),p("error")}},[e,l,f]);return t.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[o!=="preview"&&t.jsx("div",{style:{fontWeight:600,fontSize:12,color:a.content.primary,wordBreak:"break-all"},children:e.name}),(o!=="inspector"||n)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{width:"100%",height:"100%",minHeight:o==="inspector"?160:240,background:a.surface.shell,borderRadius:a.shape.small,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},children:I?t.jsxs("div",{style:{color:a.content.muted,fontSize:11},children:[t.jsx(b,{icon:w,spin:!0,style:{marginRight:5}}),"Loading Asset Editor preview…"]}):v?t.jsx(r.Suspense,{fallback:t.jsx("span",{style:{color:a.content.muted},children:"Loading preview…"}),children:t.jsx(Q,{assetPath:v.path,materialPath:v.materialPath,displayName:e.name})}):t.jsx("img",{src:j?"/__editor/asset-library/local-placeholder.svg":e.thumbnailUrl,alt:j?`${e.name} preview unavailable`:e.name,onError:()=>P(!0),style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}})}),j&&t.jsx("div",{role:"status",style:{color:a.content.dim,fontSize:10},children:"The catalog preview could not be loaded; showing the typed fallback."}),_&&t.jsx("div",{style:{color:a.content.dim,fontSize:10},children:"Interactive preview is unavailable for this variant; showing its catalog thumbnail."})]}),o!=="preview"&&t.jsxs(t.Fragment,{children:[t.jsx(k,{label:"Info",children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:a.content.dim,marginBottom:2},children:"Source"}),t.jsx("div",{style:{fontSize:11,color:a.content.primary},children:e.source==="polyhaven"?"Poly Haven":e.source==="ambientcg"?"ambientCG":"Full Catalog"})]}),t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:a.content.dim,marginBottom:2},children:"Type"}),t.jsx("div",{style:{fontSize:11,color:a.content.primary},children:e.type})]}),e.tags.length>0&&t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:a.content.dim,marginBottom:2},children:"Tags"}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3},children:e.tags.slice(0,12).map(s=>t.jsx("span",{style:{fontSize:10,padding:"1px 5px",background:a.surface.raised,borderRadius:a.shape.small,color:a.content.muted},children:s},s))})]}),e.author&&t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:a.content.dim,marginBottom:2},children:"Author"}),t.jsx("div",{style:{fontSize:11,color:a.content.primary},children:e.author})]})]})}),t.jsx(k,{label:"Add to Project",children:t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:O?t.jsxs("div",{style:{fontSize:11,color:a.content.dim},children:[t.jsx(b,{icon:w,spin:!0,style:{marginRight:4}}),"Loading options..."]}):B?t.jsxs("div",{role:"alert",style:{fontSize:11,color:a.content.muted},children:["Delivery unavailable: ",B]}):h.length>0?t.jsxs(t.Fragment,{children:[t.jsx(W,{"aria-label":"Asset delivery",value:l?h.indexOf(l):0,onChange:s=>D(h[Number(s.target.value)]??null),style:X,children:h.map((s,i)=>t.jsxs("option",{value:i,children:[s.label,s.sizeBytes?` (${Y(s.sizeBytes)})`:""]},i))}),t.jsxs(M,{type:"button",variant:c==="done"?"success":"primary",size:"comfortable",onClick:$,disabled:c==="downloading",style:{width:"100%"},children:[t.jsx(b,{icon:c==="done"?N:c==="downloading"?w:J,spin:c==="downloading",style:{fontSize:10}}),c==="done"?"Downloaded":c==="downloading"?"Downloading...":c==="error"?"Retry":"Add to Project"]})]}):t.jsx("div",{role:"status",style:{fontSize:11,color:a.content.dim},children:e.source==="local"?"No healthy SSD or cloud delivery is available for this asset.":"This provider has no compatible remote delivery for the selected asset."})})}),t.jsxs("div",{style:{fontSize:10,color:a.content.dim,padding:"4px 0"},children:["License: ",e.license??"CC0 (Public Domain)"]})]})]})}export{de as OnlineAssetDetail};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Object3DPreview-Df_6xVfz.js","assets/index-DGwLrPW2.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/three.module-BynznMJN.js","assets/index-D2fNXpHa.css","assets/OrbitControls-BHxt84w6.js","assets/editor-presentation-activity-C7SNSmTd.js"])))=>i.map(i=>d[i]);
2
+ import{$ as T,a0 as L,a1 as H,a2 as R,a3 as U,t as a,a4 as b,a5 as w,S as k,a6 as W,B as M,a7 as N,a8 as J,_ as V}from"./index-DGwLrPW2.js";import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{r}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{d as G}from"./asset-editor-persistence-Cy4ncL8Y.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-BynznMJN.js";const S=new Map,K=new Set;function C(){for(const e of K)e()}function q(e,o){const n=S.get(e);if(n?.status==="running")return n;const f={id:e,label:o,stage:"fetch",loaded:0,total:0,status:"running",controller:new AbortController};return S.set(e,f),C(),f}function g(e,o){const n=S.get(e);n&&(Object.assign(n,o),C())}const Q=r.lazy(()=>V(()=>import("./Object3DPreview-Df_6xVfz.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.Object3DPreview}))),X={width:"100%"};function Y(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function de({online:e,mode:o="full",showPreview:n=!1,onResolved:f}){const[h,z]=r.useState([]),[l,D]=r.useState(null),[O,y]=r.useState(!0),[B,A]=r.useState(null),[v,E]=r.useState(null),[I,m]=r.useState(!1),[_,x]=r.useState(!1),[j,P]=r.useState(!1),[c,p]=r.useState("idle");r.useEffect(()=>{if(o==="preview"){y(!1);return}let s=!1;return y(!0),A(null),T(e.source,e.id).then(i=>{s||(z(i),i.length>0&&D(i[0]))}).catch(i=>{s||(z([]),A(i instanceof L?H(i.code):i instanceof Error?i.message:"Asset delivery metadata is unavailable while offline."))}).finally(()=>{s||y(!1)}),()=>{s=!0}},[o,e.source,e.id]);const F=e.source==="local"&&(e.type==="model"||e.type==="animation"||e.type==="source");r.useEffect(()=>{if(o==="inspector"&&!n){m(!1);return}let s=!1;if(E(null),x(!1),P(!1),!F){m(!1);return}return m(!0),R(e.source,e.id).then(i=>{s||(E(i),x(!i))}).catch(()=>{s||x(!0)}).finally(()=>{s||m(!1)}),()=>{s=!0}},[o,e.id,e.source,n,F]);const $=r.useCallback(async()=>{if(!l)return;const s=`single:${e.source}:${e.id}`,i=q(s,e.name);g(s,{stage:"fetch",loaded:0,total:l.sizeBytes??0,status:"running"}),p("downloading");try{const d={source:e.source,id:e.id,name:e.name,url:l.url,format:l.format,jobId:s,signal:i.controller.signal};l.includes&&(d.includes=l.includes);const u=await G(d);u.ok&&u.path?(g(s,{stage:"commit",loaded:l.sizeBytes??1,total:l.sizeBytes??1,status:u.alreadyExists?"skipped":"imported",message:u.path}),p("done"),U(`${e.name} added to Content — drag it from there into the viewport to place it.`),f?.(`/${u.path}`)):(g(s,{status:"failed",message:u.error??"The import was rejected."}),p("error"))}catch(d){g(s,{status:i.controller.signal.aborted?"cancelled":"failed",message:d instanceof Error?d.message:String(d)}),p("error")}},[e,l,f]);return t.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[o!=="preview"&&t.jsx("div",{style:{fontWeight:600,fontSize:12,color:a.content.primary,wordBreak:"break-all"},children:e.name}),(o!=="inspector"||n)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{width:"100%",height:"100%",minHeight:o==="inspector"?160:240,background:a.surface.shell,borderRadius:a.shape.small,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},children:I?t.jsxs("div",{style:{color:a.content.muted,fontSize:11},children:[t.jsx(b,{icon:w,spin:!0,style:{marginRight:5}}),"Loading Asset Editor preview…"]}):v?t.jsx(r.Suspense,{fallback:t.jsx("span",{style:{color:a.content.muted},children:"Loading preview…"}),children:t.jsx(Q,{assetPath:v.path,materialPath:v.materialPath,displayName:e.name})}):t.jsx("img",{src:j?"/__editor/asset-library/local-placeholder.svg":e.thumbnailUrl,alt:j?`${e.name} preview unavailable`:e.name,onError:()=>P(!0),style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}})}),j&&t.jsx("div",{role:"status",style:{color:a.content.dim,fontSize:10},children:"The catalog preview could not be loaded; showing the typed fallback."}),_&&t.jsx("div",{style:{color:a.content.dim,fontSize:10},children:"Interactive preview is unavailable for this variant; showing its catalog thumbnail."})]}),o!=="preview"&&t.jsxs(t.Fragment,{children:[t.jsx(k,{label:"Info",children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:a.content.dim,marginBottom:2},children:"Source"}),t.jsx("div",{style:{fontSize:11,color:a.content.primary},children:e.source==="polyhaven"?"Poly Haven":e.source==="ambientcg"?"ambientCG":"Full Catalog"})]}),t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:a.content.dim,marginBottom:2},children:"Type"}),t.jsx("div",{style:{fontSize:11,color:a.content.primary},children:e.type})]}),e.tags.length>0&&t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:a.content.dim,marginBottom:2},children:"Tags"}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3},children:e.tags.slice(0,12).map(s=>t.jsx("span",{style:{fontSize:10,padding:"1px 5px",background:a.surface.raised,borderRadius:a.shape.small,color:a.content.muted},children:s},s))})]}),e.author&&t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:a.content.dim,marginBottom:2},children:"Author"}),t.jsx("div",{style:{fontSize:11,color:a.content.primary},children:e.author})]})]})}),t.jsx(k,{label:"Add to Project",children:t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:O?t.jsxs("div",{style:{fontSize:11,color:a.content.dim},children:[t.jsx(b,{icon:w,spin:!0,style:{marginRight:4}}),"Loading options..."]}):B?t.jsxs("div",{role:"alert",style:{fontSize:11,color:a.content.muted},children:["Delivery unavailable: ",B]}):h.length>0?t.jsxs(t.Fragment,{children:[t.jsx(W,{"aria-label":"Asset delivery",value:l?h.indexOf(l):0,onChange:s=>D(h[Number(s.target.value)]??null),style:X,children:h.map((s,i)=>t.jsxs("option",{value:i,children:[s.label,s.sizeBytes?` (${Y(s.sizeBytes)})`:""]},i))}),t.jsxs(M,{type:"button",variant:c==="done"?"success":"primary",size:"comfortable",onClick:$,disabled:c==="downloading",style:{width:"100%"},children:[t.jsx(b,{icon:c==="done"?N:c==="downloading"?w:J,spin:c==="downloading",style:{fontSize:10}}),c==="done"?"Downloaded":c==="downloading"?"Downloading...":c==="error"?"Retry":"Add to Project"]})]}):t.jsx("div",{role:"status",style:{fontSize:11,color:a.content.dim},children:e.source==="local"?"No healthy SSD or cloud delivery is available for this asset.":"This provider has no compatible remote delivery for the selected asset."})})}),t.jsxs("div",{style:{fontSize:10,color:a.content.dim,padding:"4px 0"},children:["License: ",e.license??"CC0 (Public Domain)"]})]})]})}export{de as OnlineAssetDetail};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StageHost-B4P-uvV9.js","assets/index-DuB3wHKD.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/three.module-BynznMJN.js","assets/index-D2fNXpHa.css","assets/clip-planes-CnAI6DZn.js","assets/OrbitControls-BHxt84w6.js","assets/LineSegments2-vfeDUBfs.js","assets/viewport-pick-context-DkawXbEi.js","assets/editor-presentation-activity-C7SNSmTd.js"])))=>i.map(i=>d[i]);
2
- import{a as s}from"./jsx-runtime-DPjLkJKQ.js";import{r as f}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{bC as Fe,bD as ee,bE as ze,bF as ge,_ as Ne,bG as Ue,t as h,bH as Oe,bI as ye,bp as _e,D as te,bJ as Ie,bK as Be,Z as He,bL as Ve,bM as Ge,aD as xe,bN as We,aF as K,aG as be,aH as T,bO as Z,aI as U,C as ve,bP as re,bQ as Xe,a6 as qe,bR as Je,b4 as Ke,az as Ze}from"./index-DuB3wHKD.js";import"./index-D2LwEE0L.js";import{J as Qe,C as Ye,c as Pe}from"./JsonAssetDocument-Zyv_CDpC.js";import{AudioViewer as et}from"./AudioViewer-C9JP7n49.js";import{EnvironmentAssetDocument as tt}from"./EnvironmentAssetDocument-DEqKuki2.js";import{ImageViewer as rt}from"./ImageViewer-CyIXlQTG.js";import{a as nt,b as st,S as ot}from"./StageHost-B4P-uvV9.js";import{RootDocumentContent as it,activeRootDocumentHost as at}from"./world-documents-CWiw361z.js";import{aB as lt,ap as ct,z as ut,j as G,I as dt,V as O,y as ft,L as ne,J as W,aV as we,i as Y,aW as pt,w as je,d as _,k as Se,aX as mt,aY as ht,am as X,bp as Ee,bJ as De,bo as Me,a0 as Ce,g as gt,Z as yt,af as xt,x as bt,a as ke,c as Le,ae as vt,K as wt,v as jt,h as St}from"./three.module-BynznMJN.js";import{EffectComposer as Et,LUT3DEffect as Dt,RenderPass as Mt,EffectPass as Ct}from"./index-C5UECeSr.js";import{s as Q}from"./asset-editor-persistence-B6Yg7dTC.js";import{ModelAssetDocument as kt}from"./ModelAssetDocument-BKdnWaJL.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./OrbitControls-BHxt84w6.js";import"./fflate.module-DPuTF8aG.js";import"./clip-planes-CnAI6DZn.js";import"./LineSegments2-vfeDUBfs.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";import"./edit-mode-authoring-DBEoND0w.js";import"./TransientHint-9_u15mth.js";import"./react-story-board-d_OfX68Z.js";function Lt({value:e,onChange:t,disabled:r=!1}){const[n,i]=f.useState(e??""),o=Fe();f.useEffect(()=>{i(e??"")},[e]);const l=()=>{const a=n.trim();a&&a!==e&&t(a)};return e===null?s.jsxs("div",{className:"vgai-color-input",children:[s.jsx("div",{className:"vgai-color-input-mixed"}),s.jsx(ee,{placeholder:"—",disabled:r,onChange:a=>{a.target.value&&t(a.target.value)},"data-mixed":"true"})]}):s.jsxs("div",{className:"vgai-color-input",children:[s.jsx(ze,{value:e,disabled:r,onChange:a=>{o?.begin(),t(a.target.value)},onBlur:()=>o?.end()}),s.jsx(ee,{value:n,disabled:r,onChange:a=>i(a.target.value),onBlur:l,onKeyDown:a=>{a.key==="Enter"?(l(),a.target.blur()):a.key==="Escape"&&(i(e),a.target.blur())}})]})}class N extends Error{constructor(t){super(t.message),this.refusal=t,this.name="LiveModuleError"}}function Tt(e){return Object.keys(e).filter(t=>t!=="__esModule"&&t!=="Symbol.toStringTag")}function se(e){return typeof e=="object"&&e!==null&&e.isObject3D===!0}function At(e){if("default"in e)return{name:"default",value:e.default};const t=Tt(e);return t.length===0?{kind:"not-a-model",message:"This module exports nothing."}:t.length>1?{kind:"not-a-model",message:`This module has no default export and ${t.length} named exports (${t.join(", ")}), so there is no single subject to build. A model module default-exports its builder.`}:{name:t[0],value:e[t[0]]}}function oe(e){if(se(e))return{root:e};if(!e||typeof e!="object")return;const t=e;if(!se(t.root))return;const r=t.root;return Array.isArray(t.animations)&&r.animations.length===0&&(r.animations=t.animations),{root:r,...typeof t.dispose=="function"?{dispose:()=>t.dispose.call(e)}:{}}}function ie(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e!="object")return typeof e;if(Array.isArray(e))return"an array";const t=Object.keys(e);return t.length>0?`an object with keys ${t.slice(0,8).join(", ")}`:"an object with no own keys"}const ae="a model module returns a THREE.Object3D, or a build result `{ root, animations?, dispose? }` whose `root` is one.";async function $t(e,t){const r=oe(t);if(r)return{...r,exportName:e};if(typeof t!="function")return{kind:"not-a-model",message:`Export '${e}' is ${ie(t)}, not a function and not a model — `+ae};let n;try{n=await t()}catch(o){return{kind:"import-failed",message:`Export '${e}' threw while building: ${Te(o)}`,...o instanceof Error&&o.stack?{stack:o.stack}:{}}}const i=oe(n);return i?{...i,exportName:e}:{kind:"not-a-model",message:`Export '${e}' ran but returned ${ie(n)} — ${ae}`}}function Te(e){return e instanceof Error?e.message:String(e)}async function Rt(e,t,r){let n;try{n=await import(ge(e,t,r))}catch(l){throw new N({kind:"import-failed",message:Te(l),...l instanceof Error&&l.stack?{stack:l.stack}:{}})}const i=At(n);if("kind"in i)throw new N(i);const o=await $t(i.name,i.value);if("kind"in o)throw new N(o);return o}const Ft="data-vgai-pasteboard";function zt(e){let t=e;for(let r=0;r<12;r++){if(!t||typeof t!="object")return!1;const n=t;if(typeof n.type=="string")return n.props?.[Ft]==="true";if(typeof n.type=="function"){try{t=n.type(n.props??{})}catch{return!1}continue}return!1}return!1}async function Nt(e,t,r){let n;try{n=await import(ge(e,t,r))}catch{return!1}const i=n.default;if(typeof i!="function")return!1;let o;try{o=i({})}catch{return!1}return zt(o)}const Ut=f.lazy(async()=>({default:(await Ne(()=>import("./StageHost-B4P-uvV9.js").then(t=>t.c),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))).Object3DDocumentViewport}));function Ot(e){return _t(e.documentId,e.chromeless),s.jsx(f.Suspense,{fallback:s.jsx(nt,{testId:"object3d-document-loading",children:st}),children:s.jsx(Ut,{...e})})}function _t(e,t=!1){f.useEffect(()=>{if(!t)return Ue(e)},[e,t])}function It({documentId:e,active:t,modulePath:r}){const n=at(),i=f.useMemo(()=>({worldId:`pasteboard:${r}`,kind:"dom",path:r,zOrder:0,pausable:!1,entryOnly:!0}),[r]);return n?s.jsx("div",{style:{position:"relative",height:"100%",width:"100%"},children:s.jsx(it,{documentId:e,active:t,composite:n.composite,descriptor:i,store:n.store})}):s.jsx("div",{style:{padding:20,color:h.content.muted},children:"This pasteboard needs the project session's root-document host, which is not installed yet. Reopen the file once the project finishes loading."})}const le={height:"100%",width:"100%",minHeight:0,display:"flex",position:"relative"},ce={flex:1,minWidth:0,minHeight:0,display:"flex"};function Bt(e,t){if(e.kind!=="import-failed")return{message:e.message};const r=Ge(t);return r?{message:r,stack:e.message}:{message:e.message,stack:e.stack}}function Ht({documentId:e,projectRoot:t,modulePath:r,displayName:n,active:i,fallback:o}){const[l,a]=f.useState({status:"probing"}),[y,c]=f.useState(null),m=f.useMemo(()=>{const d=new lt;return d.name=r.split("/").pop()??r,d},[r]),u=f.useRef(!1);f.useEffect(()=>{let d=!1,v=0,p=null,g=Promise.resolve(),E=null,j=null;const S=()=>{p&&(m.remove(p),m.animations=[],j?j():te(p),p=null,j=null)},D=(w,M)=>{S(),p=w,j=M,m.add(w),m.animations=w.animations,Ve(e)},L=(w,M)=>{if(w.kind==="not-a-model"&&!M){a({status:"fallback",reason:w.message});return}const C=Bt(w,r);c(C),He.error(`${r}: ${C.message}`,"live-module"),M||a({status:"fallback",reason:w.message})},$=w=>d||w!==v,H=async()=>{v+=1;const w=v,M=Be();let C;try{C=await Rt(t,r,M)}catch(A){if($(w))return;if(!(A instanceof N))throw A;if(A.refusal.kind==="not-a-model"&&p===null){const V=await Nt(t,r,M);if($(w))return;if(V){c(null),a({status:"pasteboard"});return}}E=A,L(A.refusal,p!==null);return}if($(w)){C.dispose?C.dispose():te(C.root);return}D(C.root,C.dispose??null),E=null,Ie(r),c(null),a({status:"live",exportName:C.exportName})},F=()=>(g=H(),g),x=Oe(e,async()=>{let w=F();for(;;){if(await w,d)throw new Error(`Document closed while rebuilding: ${r}`);if(w===g)break;w=g}if(E)throw E});F();const k=ye();return()=>{d=!0,x(),k(),S()}},[m,e,r,t]),f.useEffect(()=>{if(l.status!=="live"||u.current)return;let d=0,v=0;const p=()=>{const g=_e(e);if(g){u.current=!0,new ct().setFromObject(m).isEmpty()||g.frame();return}++v>60||(d=requestAnimationFrame(p))};return d=requestAnimationFrame(p),()=>cancelAnimationFrame(d)},[m,e,l.status]);const b=f.useCallback(()=>({root:m,dispose(){}}),[m]);return l.status==="probing"?s.jsxs("div",{style:{padding:20,color:h.content.muted},children:["Inspecting ",n,"…"]}):l.status==="pasteboard"?s.jsx(It,{documentId:e,active:i,modulePath:r}):l.status==="fallback"?s.jsxs("div",{style:le,children:[y?s.jsx(ue,{failure:y}):null,s.jsx("div",{style:{...ce,overflow:"auto"},children:o})]}):s.jsxs("div",{style:le,children:[s.jsx("div",{style:{...ce,opacity:y?.35:1},children:s.jsx(Ot,{documentId:e,sourcePath:r,displayName:n,build:b,active:i,assetType:"model module",cameraDirection:ot,modelSource:{kind:"project-file",path:r}})}),y?s.jsx(ue,{failure:y}):null]})}function ue({failure:e}){return s.jsxs("div",{role:"alert","data-testid":"live-module-error",style:{position:"absolute",top:8,left:8,right:8,zIndex:2,maxHeight:"60%",overflow:"auto",padding:"8px 10px",borderRadius:h.shape.small,background:h.surface.raised,border:`1px solid ${h.semantic.danger}`,color:h.semantic.danger,fontFamily:h.typography.mono,fontSize:11,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word",pointerEvents:"auto"},children:[s.jsx("div",{style:{fontWeight:600},children:"This module did not build — showing the last good model."}),s.jsx("div",{style:{marginTop:4},children:e.message}),e.stack?s.jsx("div",{style:{marginTop:6,color:h.content.muted},children:e.stack}):null]})}class Vt extends ut{constructor(t){super(t),this.type=G}setType(t){return this.type=t,this}load(t,r,n,i){const o=new dt(this.manager);o.setPath(this.path),o.setResponseType("text"),o.load(t,l=>{try{r(this.parse(l))}catch(a){i?i(a):console.error(a),this.manager.itemError(t)}},n,i)}parse(t){const r=/TITLE +"([^"]*)"/,n=/LUT_3D_SIZE +(\d+)/,i=/DOMAIN_MIN +([\d.]+) +([\d.]+) +([\d.]+)/,o=/DOMAIN_MAX +([\d.]+) +([\d.]+) +([\d.]+)/,l=/^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm;let a=r.exec(t);const y=a!==null?a[1]:null;if(a=n.exec(t),a===null)throw new Error("LUTCubeLoader: Missing LUT_3D_SIZE information");const c=Number(a[1]),m=c**3*4,u=this.type===G?new Uint8Array(m):new Float32Array(m),b=new O(0,0,0),d=new O(1,1,1);if(a=i.exec(t),a!==null&&b.set(Number(a[1]),Number(a[2]),Number(a[3])),a=o.exec(t),a!==null&&d.set(Number(a[1]),Number(a[2]),Number(a[3])),b.x>d.x||b.y>d.y||b.z>d.z)throw new Error("LUTCubeLoader: Invalid input domain");const v=this.type===G?255:1;let p=0;for(;(a=l.exec(t))!==null;)u[p++]=Number(a[1])*v,u[p++]=Number(a[2])*v,u[p++]=Number(a[3])*v,u[p++]=v;const g=new ft;return g.image.data=u,g.image.width=c,g.image.height=c,g.image.depth=c,g.type=this.type,g.magFilter=ne,g.minFilter=ne,g.wrapS=W,g.wrapT=W,g.wrapR=W,g.generateMipmaps=!1,g.needsUpdate=!0,{title:y,size:c,domainMin:b,domainMax:d,texture3D:g}}}function z(e){return e.split("/").pop()??e}function I(e,t,r){return Math.min(r,Math.max(t,e))}function de(e){return[e.x,e.y,e.z].map(t=>t.toFixed(2)).join(", ")}function Gt(){const e=new je;e.background=new _("#171a22");const t=new Se(34,1,.1,100);t.position.set(6.6,4.6,8.8),t.lookAt(0,.7,0),e.add(new mt("#dce8ff","#322a27",2.1));const r=new ht("#fff3db",3.8);r.position.set(4,7,5),e.add(r);const n=[],i=[],o=(c,m,u)=>{n.push(c),i.push(m);const b=new Ce(c,m);return b.position.set(...u),b.castShadow=!0,b.receiveShadow=!0,e.add(b),b},l=[["#e64d45",-2.4],["#e5ad42",-1.2],["#55b86a",0],["#47a9d8",1.2],["#8a68d7",2.4]];for(const[c,m]of l)o(new Ee(.48,48,32),new X({color:c,roughness:.3,metalness:.08}),[m,.65,0]);[.06,.18,.5,.82,1].forEach((c,m)=>{const u=Math.round(c*255);o(new De(.78,.78,.78),new X({color:new _(`rgb(${u}, ${u}, ${u})`),roughness:.72}),[-2.4+m*1.2,1.85,-.1])});const y=o(new Me(9,6),new X({color:"#777b86",roughness:.92}),[0,.08,-1.8]);return y.rotation.x=-Math.PI/2,{scene:e,camera:t,dispose:()=>{for(const c of n)c.dispose();for(const c of i)c.dispose()}}}function Wt({lut:e,settingsRef:t}){const r=f.useRef(null);return f.useEffect(()=>{const n=r.current;if(!n)return;let i=!1,o=0;const l=document.createElement("canvas");l.setAttribute("aria-label","LUT before and after preview"),l.style.width="100%",l.style.height="100%",l.style.display="block",n.replaceChildren(l);const a=new we({canvas:l,antialias:!0});a.outputColorSpace=Y,a.toneMapping=pt,a.toneMappingExposure=1,a.shadowMap.enabled=!0;const y=Gt(),c=new Et(a),m=new Dt(e.texture3D,{tetrahedralInterpolation:!0});c.addPass(new Mt(y.scene,y.camera)),c.addPass(new Ct(y.camera,m));const u={width:1,height:1},b=()=>{const g=t.current,E=Math.round(u.width*I(g.split,.05,.95));m.blendMode.opacity.value=I(g.intensity,0,1),m.tetrahedralInterpolation=g.tetrahedral,a.setScissorTest(!1),a.setRenderTarget(null),a.clear(),a.setScissorTest(!0),a.setScissor(0,0,E,u.height),a.render(y.scene,y.camera),a.setScissor(E,0,u.width-E,u.height),c.render(),a.setScissorTest(!1)},d=()=>{const g=n.getBoundingClientRect();u.width=Math.max(1,Math.floor(g.width)),u.height=Math.max(1,Math.floor(g.height)),a.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),a.setSize(u.width,u.height,!1),c.setSize(u.width,u.height),y.camera.aspect=u.width/u.height,y.camera.updateProjectionMatrix()};d(),b();const v=new ResizeObserver(()=>{d(),b()});v.observe(n);const p=()=>{i||(b(),o=requestAnimationFrame(p))};return o=requestAnimationFrame(p),()=>{i=!0,cancelAnimationFrame(o),v.disconnect(),c.dispose(),m.dispose(),y.dispose(),a.dispose(),l.remove()}},[e,t]),s.jsx("div",{ref:r,"data-testid":"lut-preview",style:{width:"100%",height:"100%",minHeight:260,background:"#171a22"}})}function Xt({settings:e,onChange:t}){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:4},children:[s.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Intensity",s.jsx(U,{value:e.intensity,onChange:r=>t({...e,intensity:I(r,0,1)}),step:.01,precision:2})]}),s.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Comparison split",s.jsx(U,{value:e.split,onChange:r=>t({...e,split:I(r,.05,.95)}),step:.01,precision:2})]}),s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:7,fontSize:11},children:[s.jsx(ve,{checked:e.tetrahedral,onChange:r=>t({...e,tetrahedral:r.target.checked})}),"Tetrahedral interpolation"]}),s.jsx("div",{style:{color:h.content.muted,fontSize:10,lineHeight:1.45},children:"Preview controls are session-only. Bind the LUT and accepted intensity in the owning TSX post-processing composition."})]})}async function qt(e){const t=await Z(e);if(t===null)throw new Error(`CUBE LUT not found: ${e}`);return new Vt().parse(t)}function Jt({documentId:e,assetPath:t,active:r=!0}){const[n,i]=f.useState(0),[o,l]=f.useState(null),[a,y]=f.useState(null),[c,m]=f.useState({intensity:1,split:.5,tetrahedral:!0}),u=f.useRef(c);u.current=c,f.useEffect(()=>{if(r)return Q(t,()=>i(d=>d+1))},[r,t]),f.useEffect(()=>{if(!r)return;let d=!1,v=null;return l(null),y(null),qt(t).then(p=>{if(v=p,d){p.texture3D.dispose();return}l(p)},p=>{d||y(p instanceof Error?p.message:String(p))}),()=>{d=!0,v?.texture3D.dispose()}},[r,t,n]);const b=f.useMemo(()=>[{id:"lut-profile",title:"Color Grade",icon:We,order:xe,body:{kind:"custom",...o?{data:{title:o.title,size:o.size,domainMin:o.domainMin.toArray(),domainMax:o.domainMax.toArray()}}:{},render:()=>s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"6px 10px"},children:[s.jsx("span",{style:{color:h.content.muted},children:"Title"}),s.jsx("span",{children:o?.title||z(t)}),s.jsx("span",{style:{color:h.content.muted},children:"Cube"}),s.jsx("span",{children:o?`${o.size}³`:"—"}),s.jsx("span",{style:{color:h.content.muted},children:"Domain"}),s.jsx("span",{children:o?`${de(o.domainMin)} → ${de(o.domainMax)}`:"—"})]})}},{id:"lut-preview-settings",title:"Preview",icon:be,order:K,body:{kind:"custom",data:{...c},render:()=>s.jsx(Xt,{settings:c,onChange:m})}}],[t,o,c]);return a?s.jsx(T,{documentId:e,active:r,type:"color grade",title:z(t),status:"CUBE LUT unavailable",children:s.jsx("div",{role:"alert",style:{padding:20,color:h.semantic.danger},children:a})}):o?s.jsx(T,{documentId:e,active:r,type:"color grade",title:z(t),sections:b,status:`CUBE LUT · ${o.size}³`,fill:!0,children:s.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,background:"#171a22"},children:[s.jsx(Wt,{lut:o,settingsRef:u}),s.jsx("div",{style:{position:"absolute",left:12,top:12,padding:"4px 7px",borderRadius:4,background:"rgba(12,14,20,0.72)",color:"#f2f4f8",fontSize:10,pointerEvents:"none"},children:"Original"}),s.jsx("div",{style:{position:"absolute",right:12,top:12,padding:"4px 7px",borderRadius:4,background:"rgba(12,14,20,0.72)",color:"#f2f4f8",fontSize:10,pointerEvents:"none"},children:o.title||"Graded"})]})}):s.jsx(T,{documentId:e,active:r,type:"color grade",title:z(t),status:"Loading CUBE LUT",children:s.jsx("div",{style:{padding:20,color:h.content.muted},children:"Loading color grade…"})})}const Kt=[".vert",".vert.glsl"],Zt=[".frag",".frag.glsl"];function Qt(e){return e.split(/[?#]/,1)[0].toLowerCase()}function Yt(e,t=""){const r=Qt(e);return Kt.some(n=>r.endsWith(n))?"vertex":Zt.some(n=>r.endsWith(n))?"fragment":/\bgl_Position\b/.test(t)?"vertex":"fragment"}function Ae(e){const t=e.split(/[?#]/,1)[0];return/\.vert\.glsl$/i.test(t)?t.replace(/\.vert\.glsl$/i,".frag.glsl"):/\.frag\.glsl$/i.test(t)?t.replace(/\.frag\.glsl$/i,".vert.glsl"):/\.vert$/i.test(t)?t.replace(/\.vert$/i,".frag"):/\.frag$/i.test(t)?t.replace(/\.frag$/i,".vert"):null}function Pt(e){return e.replace(/\/\*[\s\S]*?\*\//g,t=>t.replace(/[^\n]/g," ")).replace(/\/\/[^\n]*/g,"")}function fe(e,t){const r=[],n=/\buniform\s+(?:(?:lowp|mediump|highp)\s+)?([A-Za-z_]\w*)\s+([A-Za-z_]\w*)\s*(?:\[\s*(\d+)\s*\])?\s*;/g;for(const i of Pt(e).matchAll(n)){const o=i[1],l=i[2];if(!o||!l)continue;const a=i[3]?Number.parseInt(i[3],10):void 0;r.push({name:l,type:o,...a?{arraySize:a}:{},stages:[t]})}return r}function er(e,t){const r=new Map;for(const n of[...fe(e,"vertex"),...fe(t,"fragment")]){const i=r.get(n.name);if(!i){r.set(n.name,n);continue}r.set(n.name,{...i,stages:[...new Set([...i.stages,...n.stages])]})}return[...r.values()]}function q(e,t){const r=e.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StageHost-CjZBoXiO.js","assets/index-DGwLrPW2.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/three.module-BynznMJN.js","assets/index-D2fNXpHa.css","assets/clip-planes-CnAI6DZn.js","assets/OrbitControls-BHxt84w6.js","assets/LineSegments2-vfeDUBfs.js","assets/viewport-pick-context-DkawXbEi.js","assets/editor-presentation-activity-C7SNSmTd.js"])))=>i.map(i=>d[i]);
2
+ import{a as s}from"./jsx-runtime-DPjLkJKQ.js";import{r as f}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{bC as Fe,bD as ee,bE as ze,bF as ge,_ as Ne,bG as Ue,t as h,bH as Oe,bI as ye,bp as _e,D as te,bJ as Ie,bK as Be,Z as He,bL as Ve,bM as Ge,aD as xe,bN as We,aF as K,aG as be,aH as T,bO as Z,aI as U,C as ve,bP as re,bQ as Xe,a6 as qe,bR as Je,b4 as Ke,az as Ze}from"./index-DGwLrPW2.js";import"./index-D2LwEE0L.js";import{J as Qe,C as Ye,c as Pe}from"./JsonAssetDocument-4RfU5RS8.js";import{AudioViewer as et}from"./AudioViewer-_65u1JZP.js";import{EnvironmentAssetDocument as tt}from"./EnvironmentAssetDocument-Bi3xStlu.js";import{ImageViewer as rt}from"./ImageViewer-CxxsCkXk.js";import{a as nt,b as st,S as ot}from"./StageHost-CjZBoXiO.js";import{RootDocumentContent as it,activeRootDocumentHost as at}from"./world-documents-DCnT6IOG.js";import{aB as lt,ap as ct,z as ut,j as G,I as dt,V as O,y as ft,L as ne,J as W,aV as we,i as Y,aW as pt,w as je,d as _,k as Se,aX as mt,aY as ht,am as X,bp as Ee,bJ as De,bo as Me,a0 as Ce,g as gt,Z as yt,af as xt,x as bt,a as ke,c as Le,ae as vt,K as wt,v as jt,h as St}from"./three.module-BynznMJN.js";import{EffectComposer as Et,LUT3DEffect as Dt,RenderPass as Mt,EffectPass as Ct}from"./index-C5UECeSr.js";import{s as Q}from"./asset-editor-persistence-Cy4ncL8Y.js";import{ModelAssetDocument as kt}from"./ModelAssetDocument-C0WYRlmP.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./OrbitControls-BHxt84w6.js";import"./fflate.module-DPuTF8aG.js";import"./clip-planes-CnAI6DZn.js";import"./LineSegments2-vfeDUBfs.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";import"./edit-mode-authoring-D-tlcyhW.js";import"./TransientHint-Cut0DwSC.js";import"./react-story-board-Dz4z1udM.js";function Lt({value:e,onChange:t,disabled:r=!1}){const[n,i]=f.useState(e??""),o=Fe();f.useEffect(()=>{i(e??"")},[e]);const l=()=>{const a=n.trim();a&&a!==e&&t(a)};return e===null?s.jsxs("div",{className:"vgai-color-input",children:[s.jsx("div",{className:"vgai-color-input-mixed"}),s.jsx(ee,{placeholder:"—",disabled:r,onChange:a=>{a.target.value&&t(a.target.value)},"data-mixed":"true"})]}):s.jsxs("div",{className:"vgai-color-input",children:[s.jsx(ze,{value:e,disabled:r,onChange:a=>{o?.begin(),t(a.target.value)},onBlur:()=>o?.end()}),s.jsx(ee,{value:n,disabled:r,onChange:a=>i(a.target.value),onBlur:l,onKeyDown:a=>{a.key==="Enter"?(l(),a.target.blur()):a.key==="Escape"&&(i(e),a.target.blur())}})]})}class N extends Error{constructor(t){super(t.message),this.refusal=t,this.name="LiveModuleError"}}function Tt(e){return Object.keys(e).filter(t=>t!=="__esModule"&&t!=="Symbol.toStringTag")}function se(e){return typeof e=="object"&&e!==null&&e.isObject3D===!0}function At(e){if("default"in e)return{name:"default",value:e.default};const t=Tt(e);return t.length===0?{kind:"not-a-model",message:"This module exports nothing."}:t.length>1?{kind:"not-a-model",message:`This module has no default export and ${t.length} named exports (${t.join(", ")}), so there is no single subject to build. A model module default-exports its builder.`}:{name:t[0],value:e[t[0]]}}function oe(e){if(se(e))return{root:e};if(!e||typeof e!="object")return;const t=e;if(!se(t.root))return;const r=t.root;return Array.isArray(t.animations)&&r.animations.length===0&&(r.animations=t.animations),{root:r,...typeof t.dispose=="function"?{dispose:()=>t.dispose.call(e)}:{}}}function ie(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e!="object")return typeof e;if(Array.isArray(e))return"an array";const t=Object.keys(e);return t.length>0?`an object with keys ${t.slice(0,8).join(", ")}`:"an object with no own keys"}const ae="a model module returns a THREE.Object3D, or a build result `{ root, animations?, dispose? }` whose `root` is one.";async function $t(e,t){const r=oe(t);if(r)return{...r,exportName:e};if(typeof t!="function")return{kind:"not-a-model",message:`Export '${e}' is ${ie(t)}, not a function and not a model — `+ae};let n;try{n=await t()}catch(o){return{kind:"import-failed",message:`Export '${e}' threw while building: ${Te(o)}`,...o instanceof Error&&o.stack?{stack:o.stack}:{}}}const i=oe(n);return i?{...i,exportName:e}:{kind:"not-a-model",message:`Export '${e}' ran but returned ${ie(n)} — ${ae}`}}function Te(e){return e instanceof Error?e.message:String(e)}async function Rt(e,t,r){let n;try{n=await import(ge(e,t,r))}catch(l){throw new N({kind:"import-failed",message:Te(l),...l instanceof Error&&l.stack?{stack:l.stack}:{}})}const i=At(n);if("kind"in i)throw new N(i);const o=await $t(i.name,i.value);if("kind"in o)throw new N(o);return o}const Ft="data-vgai-pasteboard";function zt(e){let t=e;for(let r=0;r<12;r++){if(!t||typeof t!="object")return!1;const n=t;if(typeof n.type=="string")return n.props?.[Ft]==="true";if(typeof n.type=="function"){try{t=n.type(n.props??{})}catch{return!1}continue}return!1}return!1}async function Nt(e,t,r){let n;try{n=await import(ge(e,t,r))}catch{return!1}const i=n.default;if(typeof i!="function")return!1;let o;try{o=i({})}catch{return!1}return zt(o)}const Ut=f.lazy(async()=>({default:(await Ne(()=>import("./StageHost-CjZBoXiO.js").then(t=>t.c),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))).Object3DDocumentViewport}));function Ot(e){return _t(e.documentId,e.chromeless),s.jsx(f.Suspense,{fallback:s.jsx(nt,{testId:"object3d-document-loading",children:st}),children:s.jsx(Ut,{...e})})}function _t(e,t=!1){f.useEffect(()=>{if(!t)return Ue(e)},[e,t])}function It({documentId:e,active:t,modulePath:r}){const n=at(),i=f.useMemo(()=>({worldId:`pasteboard:${r}`,kind:"dom",path:r,zOrder:0,pausable:!1,entryOnly:!0}),[r]);return n?s.jsx("div",{style:{position:"relative",height:"100%",width:"100%"},children:s.jsx(it,{documentId:e,active:t,composite:n.composite,descriptor:i,store:n.store})}):s.jsx("div",{style:{padding:20,color:h.content.muted},children:"This pasteboard needs the project session's root-document host, which is not installed yet. Reopen the file once the project finishes loading."})}const le={height:"100%",width:"100%",minHeight:0,display:"flex",position:"relative"},ce={flex:1,minWidth:0,minHeight:0,display:"flex"};function Bt(e,t){if(e.kind!=="import-failed")return{message:e.message};const r=Ge(t);return r?{message:r,stack:e.message}:{message:e.message,stack:e.stack}}function Ht({documentId:e,projectRoot:t,modulePath:r,displayName:n,active:i,fallback:o}){const[l,a]=f.useState({status:"probing"}),[y,c]=f.useState(null),m=f.useMemo(()=>{const d=new lt;return d.name=r.split("/").pop()??r,d},[r]),u=f.useRef(!1);f.useEffect(()=>{let d=!1,v=0,p=null,g=Promise.resolve(),E=null,j=null;const S=()=>{p&&(m.remove(p),m.animations=[],j?j():te(p),p=null,j=null)},D=(w,M)=>{S(),p=w,j=M,m.add(w),m.animations=w.animations,Ve(e)},L=(w,M)=>{if(w.kind==="not-a-model"&&!M){a({status:"fallback",reason:w.message});return}const C=Bt(w,r);c(C),He.error(`${r}: ${C.message}`,"live-module"),M||a({status:"fallback",reason:w.message})},$=w=>d||w!==v,H=async()=>{v+=1;const w=v,M=Be();let C;try{C=await Rt(t,r,M)}catch(A){if($(w))return;if(!(A instanceof N))throw A;if(A.refusal.kind==="not-a-model"&&p===null){const V=await Nt(t,r,M);if($(w))return;if(V){c(null),a({status:"pasteboard"});return}}E=A,L(A.refusal,p!==null);return}if($(w)){C.dispose?C.dispose():te(C.root);return}D(C.root,C.dispose??null),E=null,Ie(r),c(null),a({status:"live",exportName:C.exportName})},F=()=>(g=H(),g),x=Oe(e,async()=>{let w=F();for(;;){if(await w,d)throw new Error(`Document closed while rebuilding: ${r}`);if(w===g)break;w=g}if(E)throw E});F();const k=ye();return()=>{d=!0,x(),k(),S()}},[m,e,r,t]),f.useEffect(()=>{if(l.status!=="live"||u.current)return;let d=0,v=0;const p=()=>{const g=_e(e);if(g){u.current=!0,new ct().setFromObject(m).isEmpty()||g.frame();return}++v>60||(d=requestAnimationFrame(p))};return d=requestAnimationFrame(p),()=>cancelAnimationFrame(d)},[m,e,l.status]);const b=f.useCallback(()=>({root:m,dispose(){}}),[m]);return l.status==="probing"?s.jsxs("div",{style:{padding:20,color:h.content.muted},children:["Inspecting ",n,"…"]}):l.status==="pasteboard"?s.jsx(It,{documentId:e,active:i,modulePath:r}):l.status==="fallback"?s.jsxs("div",{style:le,children:[y?s.jsx(ue,{failure:y}):null,s.jsx("div",{style:{...ce,overflow:"auto"},children:o})]}):s.jsxs("div",{style:le,children:[s.jsx("div",{style:{...ce,opacity:y?.35:1},children:s.jsx(Ot,{documentId:e,sourcePath:r,displayName:n,build:b,active:i,assetType:"model module",cameraDirection:ot,modelSource:{kind:"project-file",path:r}})}),y?s.jsx(ue,{failure:y}):null]})}function ue({failure:e}){return s.jsxs("div",{role:"alert","data-testid":"live-module-error",style:{position:"absolute",top:8,left:8,right:8,zIndex:2,maxHeight:"60%",overflow:"auto",padding:"8px 10px",borderRadius:h.shape.small,background:h.surface.raised,border:`1px solid ${h.semantic.danger}`,color:h.semantic.danger,fontFamily:h.typography.mono,fontSize:11,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word",pointerEvents:"auto"},children:[s.jsx("div",{style:{fontWeight:600},children:"This module did not build — showing the last good model."}),s.jsx("div",{style:{marginTop:4},children:e.message}),e.stack?s.jsx("div",{style:{marginTop:6,color:h.content.muted},children:e.stack}):null]})}class Vt extends ut{constructor(t){super(t),this.type=G}setType(t){return this.type=t,this}load(t,r,n,i){const o=new dt(this.manager);o.setPath(this.path),o.setResponseType("text"),o.load(t,l=>{try{r(this.parse(l))}catch(a){i?i(a):console.error(a),this.manager.itemError(t)}},n,i)}parse(t){const r=/TITLE +"([^"]*)"/,n=/LUT_3D_SIZE +(\d+)/,i=/DOMAIN_MIN +([\d.]+) +([\d.]+) +([\d.]+)/,o=/DOMAIN_MAX +([\d.]+) +([\d.]+) +([\d.]+)/,l=/^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm;let a=r.exec(t);const y=a!==null?a[1]:null;if(a=n.exec(t),a===null)throw new Error("LUTCubeLoader: Missing LUT_3D_SIZE information");const c=Number(a[1]),m=c**3*4,u=this.type===G?new Uint8Array(m):new Float32Array(m),b=new O(0,0,0),d=new O(1,1,1);if(a=i.exec(t),a!==null&&b.set(Number(a[1]),Number(a[2]),Number(a[3])),a=o.exec(t),a!==null&&d.set(Number(a[1]),Number(a[2]),Number(a[3])),b.x>d.x||b.y>d.y||b.z>d.z)throw new Error("LUTCubeLoader: Invalid input domain");const v=this.type===G?255:1;let p=0;for(;(a=l.exec(t))!==null;)u[p++]=Number(a[1])*v,u[p++]=Number(a[2])*v,u[p++]=Number(a[3])*v,u[p++]=v;const g=new ft;return g.image.data=u,g.image.width=c,g.image.height=c,g.image.depth=c,g.type=this.type,g.magFilter=ne,g.minFilter=ne,g.wrapS=W,g.wrapT=W,g.wrapR=W,g.generateMipmaps=!1,g.needsUpdate=!0,{title:y,size:c,domainMin:b,domainMax:d,texture3D:g}}}function z(e){return e.split("/").pop()??e}function I(e,t,r){return Math.min(r,Math.max(t,e))}function de(e){return[e.x,e.y,e.z].map(t=>t.toFixed(2)).join(", ")}function Gt(){const e=new je;e.background=new _("#171a22");const t=new Se(34,1,.1,100);t.position.set(6.6,4.6,8.8),t.lookAt(0,.7,0),e.add(new mt("#dce8ff","#322a27",2.1));const r=new ht("#fff3db",3.8);r.position.set(4,7,5),e.add(r);const n=[],i=[],o=(c,m,u)=>{n.push(c),i.push(m);const b=new Ce(c,m);return b.position.set(...u),b.castShadow=!0,b.receiveShadow=!0,e.add(b),b},l=[["#e64d45",-2.4],["#e5ad42",-1.2],["#55b86a",0],["#47a9d8",1.2],["#8a68d7",2.4]];for(const[c,m]of l)o(new Ee(.48,48,32),new X({color:c,roughness:.3,metalness:.08}),[m,.65,0]);[.06,.18,.5,.82,1].forEach((c,m)=>{const u=Math.round(c*255);o(new De(.78,.78,.78),new X({color:new _(`rgb(${u}, ${u}, ${u})`),roughness:.72}),[-2.4+m*1.2,1.85,-.1])});const y=o(new Me(9,6),new X({color:"#777b86",roughness:.92}),[0,.08,-1.8]);return y.rotation.x=-Math.PI/2,{scene:e,camera:t,dispose:()=>{for(const c of n)c.dispose();for(const c of i)c.dispose()}}}function Wt({lut:e,settingsRef:t}){const r=f.useRef(null);return f.useEffect(()=>{const n=r.current;if(!n)return;let i=!1,o=0;const l=document.createElement("canvas");l.setAttribute("aria-label","LUT before and after preview"),l.style.width="100%",l.style.height="100%",l.style.display="block",n.replaceChildren(l);const a=new we({canvas:l,antialias:!0});a.outputColorSpace=Y,a.toneMapping=pt,a.toneMappingExposure=1,a.shadowMap.enabled=!0;const y=Gt(),c=new Et(a),m=new Dt(e.texture3D,{tetrahedralInterpolation:!0});c.addPass(new Mt(y.scene,y.camera)),c.addPass(new Ct(y.camera,m));const u={width:1,height:1},b=()=>{const g=t.current,E=Math.round(u.width*I(g.split,.05,.95));m.blendMode.opacity.value=I(g.intensity,0,1),m.tetrahedralInterpolation=g.tetrahedral,a.setScissorTest(!1),a.setRenderTarget(null),a.clear(),a.setScissorTest(!0),a.setScissor(0,0,E,u.height),a.render(y.scene,y.camera),a.setScissor(E,0,u.width-E,u.height),c.render(),a.setScissorTest(!1)},d=()=>{const g=n.getBoundingClientRect();u.width=Math.max(1,Math.floor(g.width)),u.height=Math.max(1,Math.floor(g.height)),a.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),a.setSize(u.width,u.height,!1),c.setSize(u.width,u.height),y.camera.aspect=u.width/u.height,y.camera.updateProjectionMatrix()};d(),b();const v=new ResizeObserver(()=>{d(),b()});v.observe(n);const p=()=>{i||(b(),o=requestAnimationFrame(p))};return o=requestAnimationFrame(p),()=>{i=!0,cancelAnimationFrame(o),v.disconnect(),c.dispose(),m.dispose(),y.dispose(),a.dispose(),l.remove()}},[e,t]),s.jsx("div",{ref:r,"data-testid":"lut-preview",style:{width:"100%",height:"100%",minHeight:260,background:"#171a22"}})}function Xt({settings:e,onChange:t}){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:4},children:[s.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Intensity",s.jsx(U,{value:e.intensity,onChange:r=>t({...e,intensity:I(r,0,1)}),step:.01,precision:2})]}),s.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Comparison split",s.jsx(U,{value:e.split,onChange:r=>t({...e,split:I(r,.05,.95)}),step:.01,precision:2})]}),s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:7,fontSize:11},children:[s.jsx(ve,{checked:e.tetrahedral,onChange:r=>t({...e,tetrahedral:r.target.checked})}),"Tetrahedral interpolation"]}),s.jsx("div",{style:{color:h.content.muted,fontSize:10,lineHeight:1.45},children:"Preview controls are session-only. Bind the LUT and accepted intensity in the owning TSX post-processing composition."})]})}async function qt(e){const t=await Z(e);if(t===null)throw new Error(`CUBE LUT not found: ${e}`);return new Vt().parse(t)}function Jt({documentId:e,assetPath:t,active:r=!0}){const[n,i]=f.useState(0),[o,l]=f.useState(null),[a,y]=f.useState(null),[c,m]=f.useState({intensity:1,split:.5,tetrahedral:!0}),u=f.useRef(c);u.current=c,f.useEffect(()=>{if(r)return Q(t,()=>i(d=>d+1))},[r,t]),f.useEffect(()=>{if(!r)return;let d=!1,v=null;return l(null),y(null),qt(t).then(p=>{if(v=p,d){p.texture3D.dispose();return}l(p)},p=>{d||y(p instanceof Error?p.message:String(p))}),()=>{d=!0,v?.texture3D.dispose()}},[r,t,n]);const b=f.useMemo(()=>[{id:"lut-profile",title:"Color Grade",icon:We,order:xe,body:{kind:"custom",...o?{data:{title:o.title,size:o.size,domainMin:o.domainMin.toArray(),domainMax:o.domainMax.toArray()}}:{},render:()=>s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"6px 10px"},children:[s.jsx("span",{style:{color:h.content.muted},children:"Title"}),s.jsx("span",{children:o?.title||z(t)}),s.jsx("span",{style:{color:h.content.muted},children:"Cube"}),s.jsx("span",{children:o?`${o.size}³`:"—"}),s.jsx("span",{style:{color:h.content.muted},children:"Domain"}),s.jsx("span",{children:o?`${de(o.domainMin)} → ${de(o.domainMax)}`:"—"})]})}},{id:"lut-preview-settings",title:"Preview",icon:be,order:K,body:{kind:"custom",data:{...c},render:()=>s.jsx(Xt,{settings:c,onChange:m})}}],[t,o,c]);return a?s.jsx(T,{documentId:e,active:r,type:"color grade",title:z(t),status:"CUBE LUT unavailable",children:s.jsx("div",{role:"alert",style:{padding:20,color:h.semantic.danger},children:a})}):o?s.jsx(T,{documentId:e,active:r,type:"color grade",title:z(t),sections:b,status:`CUBE LUT · ${o.size}³`,fill:!0,children:s.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,background:"#171a22"},children:[s.jsx(Wt,{lut:o,settingsRef:u}),s.jsx("div",{style:{position:"absolute",left:12,top:12,padding:"4px 7px",borderRadius:4,background:"rgba(12,14,20,0.72)",color:"#f2f4f8",fontSize:10,pointerEvents:"none"},children:"Original"}),s.jsx("div",{style:{position:"absolute",right:12,top:12,padding:"4px 7px",borderRadius:4,background:"rgba(12,14,20,0.72)",color:"#f2f4f8",fontSize:10,pointerEvents:"none"},children:o.title||"Graded"})]})}):s.jsx(T,{documentId:e,active:r,type:"color grade",title:z(t),status:"Loading CUBE LUT",children:s.jsx("div",{style:{padding:20,color:h.content.muted},children:"Loading color grade…"})})}const Kt=[".vert",".vert.glsl"],Zt=[".frag",".frag.glsl"];function Qt(e){return e.split(/[?#]/,1)[0].toLowerCase()}function Yt(e,t=""){const r=Qt(e);return Kt.some(n=>r.endsWith(n))?"vertex":Zt.some(n=>r.endsWith(n))?"fragment":/\bgl_Position\b/.test(t)?"vertex":"fragment"}function Ae(e){const t=e.split(/[?#]/,1)[0];return/\.vert\.glsl$/i.test(t)?t.replace(/\.vert\.glsl$/i,".frag.glsl"):/\.frag\.glsl$/i.test(t)?t.replace(/\.frag\.glsl$/i,".vert.glsl"):/\.vert$/i.test(t)?t.replace(/\.vert$/i,".frag"):/\.frag$/i.test(t)?t.replace(/\.frag$/i,".vert"):null}function Pt(e){return e.replace(/\/\*[\s\S]*?\*\//g,t=>t.replace(/[^\n]/g," ")).replace(/\/\/[^\n]*/g,"")}function fe(e,t){const r=[],n=/\buniform\s+(?:(?:lowp|mediump|highp)\s+)?([A-Za-z_]\w*)\s+([A-Za-z_]\w*)\s*(?:\[\s*(\d+)\s*\])?\s*;/g;for(const i of Pt(e).matchAll(n)){const o=i[1],l=i[2];if(!o||!l)continue;const a=i[3]?Number.parseInt(i[3],10):void 0;r.push({name:l,type:o,...a?{arraySize:a}:{},stages:[t]})}return r}function er(e,t){const r=new Map;for(const n of[...fe(e,"vertex"),...fe(t,"fragment")]){const i=r.get(n.name);if(!i){r.set(n.name,n);continue}r.set(n.name,{...i,stages:[...new Set([...i.stages,...n.stages])]})}return[...r.values()]}function q(e,t){const r=e.split(`
3
3
  `).map(n=>tr(n.trim(),t)).filter(n=>n!==null);return r.length===0&&e.trim()&&r.push({stage:t,severity:"error",message:e.trim()}),r}function tr(e,t){if(!e)return null;const r=e.match(/^(ERROR|WARNING):\s*\d+:(\d+)(?::|\((\d+)\):)\s*(.*)$/i);if(r)return{stage:t,severity:r[1].toLowerCase()==="warning"?"warning":"error",line:Number.parseInt(r[2],10),...r[3]?{column:Number.parseInt(r[3],10)}:{},message:r[4]||e};const n=e.match(/^\d+:(\d+)\((\d+)\):\s*(?:(error|warning)\s*:?)?\s*(.*)$/i);return n?{stage:t,severity:n[3]?.toLowerCase()==="warning"?"warning":"error",line:Number.parseInt(n[1],10),column:Number.parseInt(n[2],10),message:n[4]||e}:null}function pe(e){return`#line 1
4
4
  ${e}`}const rr=`varying vec2 vUv;
5
5