@volter/model-editor 0.5.66 → 0.5.67

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 (200) hide show
  1. package/dist/.vite/manifest.json +1022 -1006
  2. package/dist/assets/AudioViewer-DVXaSSYC.js +1 -0
  3. package/dist/assets/{BVHLoader-xUHWsz84.js → BVHLoader-msuIvJVn.js} +1 -1
  4. package/dist/assets/ColladaLoader-BpvxwqkB.js +3 -0
  5. package/dist/assets/EntityModelDocument-BtlQZcoU.js +1 -0
  6. package/dist/assets/EnvironmentAssetDocument-BH3zT9rt.js +1 -0
  7. package/dist/assets/FBXLoader-CsdO937F.js +1 -0
  8. package/dist/assets/{GameplaySessionTimeline-HJLZUV4Q.js → GameplaySessionTimeline-Dko95kB7.js} +10 -10
  9. package/dist/assets/ImageViewer-CZ_RMER2.js +1 -0
  10. package/dist/assets/{InspectorCanvasPreview-CLDhscy0.js → InspectorCanvasPreview-BLecDHpc.js} +1 -1
  11. package/dist/assets/InspectorObjectPreview-CSIWwJQE.js +1 -0
  12. package/dist/assets/JsonAssetDocument-CGYSeJyl.js +2 -0
  13. package/dist/assets/{LineSegments2-C8H20K8w.js → LineSegments2-BKEsgiC8.js} +2 -2
  14. package/dist/assets/LiveModuleDocument-CIvS-SUT.js +2 -0
  15. package/dist/assets/LutAssetDocument-BA70uU3w.js +1 -0
  16. package/dist/assets/{MTLLoader-C-rA0fNF.js → MTLLoader-DNh2pFDc.js} +2 -2
  17. package/dist/assets/ModelAssetDocument-D0lNEhOg.js +1 -0
  18. package/dist/assets/NonThreeAuthoringBootstrap-C0pCfkJ4.js +2 -0
  19. package/dist/assets/OBJLoader-DPi99VIm.js +5 -0
  20. package/dist/assets/Object3DDocumentToolbar-PGYkZEwr.js +1 -0
  21. package/dist/assets/Object3DPreview-BROKXSTC.js +2 -0
  22. package/dist/assets/OnlineAssetDetail-lEHnhdUS.js +1 -0
  23. package/dist/assets/OrbitControls-smIenN60.js +1 -0
  24. package/dist/assets/PLYLoader-Cx9Yc9xe.js +2 -0
  25. package/dist/assets/QuarksAssetDocument-C_8eG4KG.js +2 -0
  26. package/dist/assets/RectAreaLightUniformsLib-Iam8rS8R.js +1 -0
  27. package/dist/assets/STLLoader-BaJkM-k1.js +1 -0
  28. package/dist/assets/{ShaderAssetDocument-qlLeb2S3.js → ShaderAssetDocument-Gdp7OCfv.js} +5 -5
  29. package/dist/assets/SourceAssetViewer-l72u0hOa.js +1 -0
  30. package/dist/assets/StageHost-CdzuP0NS.js +1179 -0
  31. package/dist/assets/TDSLoader-BskhMiUy.js +1 -0
  32. package/dist/assets/ToolObject3DPreview-CU5klD6l.js +1 -0
  33. package/dist/assets/Toolbar-DI0LGx25.js +1 -0
  34. package/dist/assets/TransientHint-myZtSdd6.js +1 -0
  35. package/dist/assets/VideoViewer-z0JPXPKa.js +1 -0
  36. package/dist/assets/ViewportShadingMenu-CVU2bU_3.js +1 -0
  37. package/dist/assets/animation-mixers.service-DSIsxWG5.js +1 -0
  38. package/dist/assets/animation-timeline.utility-BEgDQC04.js +1 -0
  39. package/dist/assets/asset-editor-persistence-BtRQI8t6.js +1 -0
  40. package/dist/assets/bitmap-label-Ct4k6ehY.js +1 -0
  41. package/dist/assets/{blender-emscripten-engine-CEsWgnR7.js → blender-emscripten-engine-BeWFjMn-.js} +1 -1
  42. package/dist/assets/blender-node-editor.document-C_kpsARB.js +1 -0
  43. package/dist/assets/{blender-properties-tab-C5tUuCSv.js → blender-properties-tab-B_XBg6S8.js} +3 -3
  44. package/dist/assets/blender-runtime-host-CYhl4T9S.js +4 -0
  45. package/dist/assets/{blender-runtime-skin-DMq0XAvO.js → blender-runtime-skin-Bk6uXECD.js} +98 -51
  46. package/dist/assets/blender-runtime.document-CAPDRCvN.js +12 -0
  47. package/dist/assets/blender-timeline.document-CcEymQyL.js +1 -0
  48. package/dist/assets/blender-uv-editor.document-DSPvSEuE.js +1 -0
  49. package/dist/assets/blender-version.status-CEu7vCi3.js +1 -0
  50. package/dist/assets/{blender-wali-engine-D3iKpzn9.js → blender-wali-engine-da698rDf.js} +1 -1
  51. package/dist/assets/blender.command-BCb_c9lw.js +1 -0
  52. package/dist/assets/blender.keymap-_rF_vRX8.js +1 -0
  53. package/dist/assets/{blender.status-ujwGU6dU.js → blender.status-DrasQhJV.js} +1 -1
  54. package/dist/assets/{blender.style-CxfbTFcE.js → blender.style-DaIh9SiA.js} +1 -1
  55. package/dist/assets/{client-DNXj_opT.js → client-mkWk8S65.js} +1 -1
  56. package/dist/assets/content-bounds-_QWiKD5_.js +85 -0
  57. package/dist/assets/{hosted-asset-materialization-BXM49Qkc.js → hosted-asset-materialization-hUS3IhTD.js} +2 -2
  58. package/dist/assets/index-0Lm0Nf1M.css +1 -0
  59. package/dist/assets/{index-CJbYy-CF.js → index-7vd2obXq.js} +2 -2
  60. package/dist/assets/{index-DgapqSPi.js → index-BRLA7zdc.js} +1 -1
  61. package/dist/assets/{index-BtfYaG4D.js → index-CQG6JOSy.js} +18 -18
  62. package/dist/assets/{index-CanA16PU.js → index-CnvSS9lU.js} +1 -1
  63. package/dist/assets/{index-Bge9JUr6.js → index-DYNMP0kE.js} +1 -1
  64. package/dist/assets/index-Dm_h-T4x.js +1406 -0
  65. package/dist/assets/{index-gHZae-lw.js → index-Dz8qGBZc.js} +1 -1
  66. package/dist/assets/{index-BncK9THk.js → index-Fv4R0cYr.js} +1 -1
  67. package/dist/assets/{index-IEjydI9d.js → index-f-MQ14bP.js} +1 -1
  68. package/dist/assets/{index-D2LwEE0L.js → index-jib6KJY8.js} +6 -6
  69. package/dist/assets/{index-DUqP1RMl.js → index-ux8XhRyW.js} +1 -1
  70. package/dist/assets/{jsx-runtime-DPjLkJKQ.js → jsx-runtime-CAUTK36e.js} +1 -1
  71. package/dist/assets/layered-pick-CT4HlEpW.js +1 -0
  72. package/dist/assets/live-mixers-B-bwLZ7c.js +1 -0
  73. package/dist/assets/model-inspection-DDZE59vp.js +1 -0
  74. package/dist/assets/models.finder-Caf-3Yix.js +1 -0
  75. package/dist/assets/product-DbFrUS6F.js +1 -0
  76. package/dist/assets/properties-bone-constraints.inspector-DB3Rc_Hf.js +1 -0
  77. package/dist/assets/properties-bone.inspector-B7f7H_Co.js +1 -0
  78. package/dist/assets/properties-collection.inspector-JCtV3h3Y.js +1 -0
  79. package/dist/assets/properties-constraints.inspector-Cs8MwS-1.js +1 -0
  80. package/dist/assets/properties-data.inspector-DKGiHu8O.js +1 -0
  81. package/dist/assets/properties-material.inspector-Dc18RI13.js +1 -0
  82. package/dist/assets/properties-modifiers.inspector-DvGvXq2v.js +1 -0
  83. package/dist/assets/properties-object.inspector-Bl9nrytP.js +1 -0
  84. package/dist/assets/properties-output.inspector-B6QsU94n.js +1 -0
  85. package/dist/assets/properties-particles.inspector-B1dMnZSA.js +1 -0
  86. package/dist/assets/properties-physics.inspector-BwfNykfW.js +1 -0
  87. package/dist/assets/properties-render.inspector-KrL2EiTH.js +1 -0
  88. package/dist/assets/properties-scene.inspector-CewQnyRt.js +1 -0
  89. package/dist/assets/properties-texture.inspector-BITMzY-f.js +1 -0
  90. package/dist/assets/properties-view-layer.inspector-BpkDbmcb.js +1 -0
  91. package/dist/assets/properties-world.inspector-DLRH45Oj.js +1 -0
  92. package/dist/assets/{react-18-DyywM-Z2.js → react-18-D335xReo.js} +1 -1
  93. package/dist/assets/{react-story-board-B9V-j_Y5.js → react-story-board-CkaP4mEG.js} +1 -1
  94. package/dist/assets/{session-CsR0lApe.js → session-CTXsU1lK.js} +176 -1
  95. package/dist/assets/{spark.module-gG1EsWx8.js → spark.module-DMQ9J7rT.js} +11 -11
  96. package/dist/assets/stage-keyboard-BY7u9_MB.js +1 -0
  97. package/dist/assets/stage-overlay-set-DRFcVd27.js +1 -0
  98. package/dist/assets/stage-presence-markers-D2IpuOAY.js +1 -0
  99. package/dist/assets/stage-transform-tools-BGcIULoe.js +1 -0
  100. package/dist/assets/story-capture-RSWY8I8h.js +1 -0
  101. package/dist/assets/three-integration.service-0EyPpd5f.js +4 -0
  102. package/dist/assets/{three.module-ZILb6uB7.js → three.module-CrYDk-Xr.js} +1 -1
  103. package/dist/assets/transform-mode-request-Cz6fzydi.js +1 -0
  104. package/dist/assets/transport-strip-Co-ZDkf-.js +1 -0
  105. package/dist/assets/{vgai-shared-fontawesome-CFSkqz69.js → vgai-shared-fontawesome-2ZSGa7vM.js} +1 -1
  106. package/dist/assets/vgai-shared-jsx-dev-runtime-hkPLeIJV.js +1 -0
  107. package/dist/assets/vgai-shared-jsx-runtime-CUvvjEqj.js +1 -0
  108. package/dist/assets/{vgai-shared-react-dom-client-S0ozfl6_.js → vgai-shared-react-dom-client-CS681GK2.js} +1 -1
  109. package/dist/assets/{vgai-shared-three-DzfWDqlp.js → vgai-shared-three-CLJ0K3jQ.js} +1 -1
  110. package/dist/assets/viewport-door-BdL0u5rd.js +1 -0
  111. package/dist/assets/viewport-editor-controls-BYaAZ_Ku.js +1 -0
  112. package/dist/assets/viewport-surface-status-yS6CrXH7.js +24 -0
  113. package/dist/assets/{worker-B7zhIsFh.js → worker-CC9Ug5Ei.js} +1 -1
  114. package/dist/assets/world-documents-B5IWN-ng.js +3 -0
  115. package/dist/vgai-shared-react.json +4 -4
  116. package/dist/vgai-shared-three.json +1 -1
  117. package/dist-node/cli.js +248 -209
  118. package/dist-node/create.js +77 -77
  119. package/package.json +10 -10
  120. package/src/index.ts +1 -0
  121. package/dist/assets/AudioViewer-CRWsJVYN.js +0 -1
  122. package/dist/assets/ColladaLoader-Ccy_gHsu.js +0 -3
  123. package/dist/assets/EntityModelDocument-Dal8YnLK.js +0 -1
  124. package/dist/assets/EnvironmentAssetDocument-DFOFYX5v.js +0 -1
  125. package/dist/assets/FBXLoader-Dh0pOBW2.js +0 -1
  126. package/dist/assets/ImageViewer-BzqBpqL-.js +0 -1
  127. package/dist/assets/InspectorObjectPreview-BUZEp4xS.js +0 -1
  128. package/dist/assets/JsonAssetDocument-DCkqRS0N.js +0 -2
  129. package/dist/assets/LiveModuleDocument-CuOBVz3A.js +0 -2
  130. package/dist/assets/LutAssetDocument-IyEir1rq.js +0 -1
  131. package/dist/assets/ModelAssetDocument-DNStNyCc.js +0 -1
  132. package/dist/assets/NonThreeAuthoringBootstrap-BE15Wpmw.js +0 -2
  133. package/dist/assets/OBJLoader-CopWRneC.js +0 -5
  134. package/dist/assets/Object3DDocumentToolbar-5Dv_8caG.js +0 -1
  135. package/dist/assets/Object3DPreview-C09u9uQZ.js +0 -2
  136. package/dist/assets/OnlineAssetDetail-DOPUI1iu.js +0 -1
  137. package/dist/assets/OrbitControls-DrFzvAAB.js +0 -1
  138. package/dist/assets/PLYLoader-D_esTZ2f.js +0 -2
  139. package/dist/assets/QuarksAssetDocument-BbSJ970L.js +0 -2
  140. package/dist/assets/RectAreaLightUniformsLib-u1ciScuw.js +0 -1
  141. package/dist/assets/STLLoader-Cl5I0sAi.js +0 -1
  142. package/dist/assets/SourceAssetViewer-DwhuqbA4.js +0 -1
  143. package/dist/assets/StageHost-D-o8MsFS.js +0 -1122
  144. package/dist/assets/TDSLoader-KKBg8ef1.js +0 -1
  145. package/dist/assets/ToolObject3DPreview-ILbch3kN.js +0 -1
  146. package/dist/assets/Toolbar-DYJjJKTt.js +0 -1
  147. package/dist/assets/TransientHint-D94hsJSR.js +0 -1
  148. package/dist/assets/VideoViewer-Bx3FPbgE.js +0 -1
  149. package/dist/assets/ViewportShadingMenu-B3N6hSdN.js +0 -1
  150. package/dist/assets/animation-mixers.service-N9HxGOMf.js +0 -1
  151. package/dist/assets/asset-editor-persistence-DGD05u26.js +0 -1
  152. package/dist/assets/blender-node-editor.document-BT2M622g.js +0 -1
  153. package/dist/assets/blender-runtime-host-4ufXy47O.js +0 -4
  154. package/dist/assets/blender-runtime.document-DeFQQsF6.js +0 -8
  155. package/dist/assets/blender-timeline.document-BnlSdxy0.js +0 -1
  156. package/dist/assets/blender-uv-editor.document-UC-XeNn0.js +0 -1
  157. package/dist/assets/blender-version.status-BZP39oH7.js +0 -1
  158. package/dist/assets/blender.command-IGP5wuda.js +0 -1
  159. package/dist/assets/blender.keymap-GAQgeklK.js +0 -1
  160. package/dist/assets/browserAll-2r3AVaAO.js +0 -14
  161. package/dist/assets/canvas-preview-frames-CO60PDM7.js +0 -5
  162. package/dist/assets/index-B4bmKkgY.css +0 -1
  163. package/dist/assets/index-cpXNKgvz.js +0 -1498
  164. package/dist/assets/live-mixers-BRkRHd6g.js +0 -1
  165. package/dist/assets/material-preview.view-DqNcpd_b.js +0 -1
  166. package/dist/assets/model-inspection-JC6gbV8Q.js +0 -1
  167. package/dist/assets/models.finder-BplPGS4I.js +0 -1
  168. package/dist/assets/product-CfZaqLpw.js +0 -1
  169. package/dist/assets/properties-bone-constraints.inspector-Di8kNtAi.js +0 -1
  170. package/dist/assets/properties-bone.inspector-CqAIKNsE.js +0 -1
  171. package/dist/assets/properties-collection.inspector-DpHC_fXW.js +0 -1
  172. package/dist/assets/properties-constraints.inspector-C7G7NOZU.js +0 -1
  173. package/dist/assets/properties-data.inspector-D1sUUst6.js +0 -1
  174. package/dist/assets/properties-material.inspector-BUSjc8tl.js +0 -1
  175. package/dist/assets/properties-modifiers.inspector-Sq9bcfFz.js +0 -1
  176. package/dist/assets/properties-object.inspector-BzqiU_29.js +0 -1
  177. package/dist/assets/properties-output.inspector-BWpFqvfT.js +0 -1
  178. package/dist/assets/properties-particles.inspector-DO1KoaTz.js +0 -1
  179. package/dist/assets/properties-physics.inspector-BgkrTNSA.js +0 -1
  180. package/dist/assets/properties-render.inspector-BU5NOVoQ.js +0 -1
  181. package/dist/assets/properties-scene.inspector-DbMErJ48.js +0 -1
  182. package/dist/assets/properties-texture.inspector-toPpEwqp.js +0 -1
  183. package/dist/assets/properties-view-layer.inspector-COpx9iEK.js +0 -1
  184. package/dist/assets/properties-world.inspector-CxU0DrYX.js +0 -1
  185. package/dist/assets/react-three-rapier.esm-CN6t4A7c.js +0 -1
  186. package/dist/assets/stage-keyboard-CzlqI0nh.js +0 -1
  187. package/dist/assets/stage-overlay-set-DQeskS16.js +0 -1
  188. package/dist/assets/stage-presence-markers-S1lMOwIa.js +0 -1
  189. package/dist/assets/stage-transform-tools-Cqtv-ZQ1.js +0 -1
  190. package/dist/assets/story-capture-DmIUyEQn.js +0 -1
  191. package/dist/assets/story-mount-turn-2IYGgHob.js +0 -1
  192. package/dist/assets/story-pixi-preview-aw8xQhvF.js +0 -1
  193. package/dist/assets/story-three-preview-DDmMjlI8.js +0 -37
  194. package/dist/assets/transform-mode-request-DSPwviXs.js +0 -1
  195. package/dist/assets/vgai-shared-jsx-dev-runtime-DFDKL7fx.js +0 -1
  196. package/dist/assets/vgai-shared-jsx-runtime-DIqBpTut.js +0 -1
  197. package/dist/assets/viewport-pick-context-DkawXbEi.js +0 -1
  198. package/dist/assets/viewport-surface-status-DuININWe.js +0 -20
  199. package/dist/assets/webworkerAll-CqQUotBj.js +0 -101
  200. package/dist/assets/world-documents-DkBqH8VU.js +0 -3
@@ -0,0 +1 @@
1
+ import{j as e}from"./jsx-runtime-CAUTK36e.js";import{r as o}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{aW as W,aX as H,aY as B,aZ as M,ak as v,aS as P,a_ as h,a$ as F}from"./index-Dm_h-T4x.js";import"./index-jib6KJY8.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-mkWk8S65.js";function q({assetPath:n,displayName:l}){const{sheetPath:i,frameName:t}=W(n),a=`/${i}`,[s,r]=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?s?.frames.find(c=>c.name===f)??null:null;o.useEffect(()=>{p(t),u("fit")},[t]),o.useEffect(()=>{if(!t){r(null);return}let c=!1;return fetch(`/${H(i)}`).then(d=>d.ok?d.text():null).then(d=>{c||!d||r(B(d))}).catch(()=>{c||r(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(z,{title:E,srcWidth:b,srcHeight:$,scaleMode:m,scale:k,onScaleMode:u}),e.jsx(C,{stageRef:w,frameName:t,frame:g,sheet:s,sheetUrl:a,title:E,scale:k,onNatural:I}),s&&s.frames.length>1?e.jsx(O,{sheetUrl:a,frames:s.frames,activeName:f,onPick:p}):null]})}function z({title:n,srcWidth:l,srcHeight:i,scaleMode:t,scale:a,onScaleMode:s}){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"?` · ${T(a)}`:""]}),e.jsx("span",{style:{flex:1}}),[1,4,8,"fit"].map(r=>e.jsx(P,{type:"button",size:"compact",shape:"segment","aria-pressed":t===r,variant:t===r?"primary":"secondary",onClick:()=>s(r),children:r==="fit"?"Fit":`${r}×`},String(r)))]})}function C({stageRef:n,frameName:l,frame:i,sheet:t,sheetUrl:a,title:s,scale:r,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:a,frame:i,scale:r}):p=e.jsx("img",{src:a,alt:s,style:{imageRendering:"pixelated",display:"block",transform:`scale(${r})`,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 O({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(a=>{const s=a.name===i;return e.jsxs("button",{type:"button",title:a.name,"aria-pressed":s,onClick:()=>t(a.name),style:{border:s?`1px solid ${h[1]}`:"1px solid transparent",background:"transparent",padding:2,cursor:"pointer",flex:"0 0 auto"},children:[e.jsx(F,{sheetUrl:n,frame:a,maxEdge:40}),e.jsx("div",{style:{fontSize:9,color:s?h[1]:h[3],maxWidth:56,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.name})]},a.name)})})}function T(n){return n>=1?`${n}×`:`1/${Math.round(1/n)}×`}export{q as ImageViewer};
@@ -1 +1 @@
1
- import{a as i}from"./jsx-runtime-DPjLkJKQ.js";import{r as o}from"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";function f({capture:r,previewKey:s,size:l}){const[n,e]=o.useState(null);return o.useEffect(()=>{let t=!1;return e(null),r(l).then(a=>{t||e(a)},()=>{t||e(null)}),()=>{t=!0}},[r,s,l]),n?i.jsx("img",{src:n,alt:"Selected object preview",className:"vgai-component-thumbnail"}):null}export{f as InspectorCanvasPreview};
1
+ import{j as a}from"./jsx-runtime-CAUTK36e.js";import{r as o}from"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";function f({capture:r,previewKey:s,size:l}){const[n,e]=o.useState(null);return o.useEffect(()=>{let t=!1;return e(null),r(l).then(i=>{t||e(i)},()=>{t||e(null)}),()=>{t=!0}},[r,s,l]),n?a.jsx("img",{src:n,alt:"Selected object preview",className:"vgai-component-thumbnail"}):null}export{f as InspectorCanvasPreview};
@@ -0,0 +1 @@
1
+ import{j as t}from"./jsx-runtime-CAUTK36e.js";import{Object3DSnapshotDocument as p}from"./EntityModelDocument-BtlQZcoU.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./three-integration.service-0EyPpd5f.js";import"./index-Dm_h-T4x.js";import"./index-DaQZGF7d.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-jib6KJY8.js";import"./client-mkWk8S65.js";import"./content-bounds-_QWiKD5_.js";import"./three.module-CrYDk-Xr.js";import"./layered-pick-CT4HlEpW.js";import"./viewport-door-BdL0u5rd.js";import"./bitmap-label-Ct4k6ehY.js";import"./live-mixers-B-bwLZ7c.js";import"./StageHost-CdzuP0NS.js";import"./viewport-surface-status-yS6CrXH7.js";import"./model-inspection-DDZE59vp.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-smIenN60.js";import"./LineSegments2-BKEsgiC8.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./editor-presentation-activity-C7SNSmTd.js";import"./transport-strip-Co-ZDkf-.js";function $({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{$ as InspectorObjectPreview};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BRLA7zdc.js","assets/index-BP6wv2A0.js","assets/index-7vd2obXq.js","assets/index-CnvSS9lU.js","assets/index-DYNMP0kE.js","assets/index-Dz8qGBZc.js","assets/index-Fv4R0cYr.js","assets/index-f-MQ14bP.js","assets/index-ux8XhRyW.js"])))=>i.map(i=>d[i]);
2
+ import{j as a}from"./jsx-runtime-CAUTK36e.js";import{r as m}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{al as n,i as b,b0 as z,aV as F,b1 as M,b2 as J}from"./index-Dm_h-T4x.js";import"./index-jib6KJY8.js";const P={ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"typescript",jsx:"typescript",mjs:"typescript",cjs:"typescript",json:"json",jsonc:"json",json5:"json"};function ie(e){const o=e.split("/").pop()??e,t=o.lastIndexOf(".");return t<0?"text":P[o.slice(t+1).toLowerCase()]??"text"}let T=null;function W(){return T??=Promise.all([b(()=>import("./index-BP6wv2A0.js"),[]),b(()=>import("./index-BRLA7zdc.js").then(e=>e.i),__vite__mapDeps([0,1])),b(()=>import("./index-7vd2obXq.js").then(e=>e.w),__vite__mapDeps([2,1,0])),b(()=>import("./index-CnvSS9lU.js"),__vite__mapDeps([3,0,1])),b(()=>import("./index-DYNMP0kE.js"),__vite__mapDeps([4,1,0,2])),b(()=>import("./index-Dz8qGBZc.js"),__vite__mapDeps([5,6,2,1,0])),b(()=>import("./index-f-MQ14bP.js"),__vite__mapDeps([7,6,2,1,0])),b(()=>import("./index-ux8XhRyW.js"),__vite__mapDeps([8,0,1,2]))]).then(([e,o,t,r,c,s,l,d])=>({state:e,view:o,language:t,search:r,commands:c,javascript:s,json:l,oneDark:d})),T}function S(e){return typeof e=="number"?`${e}px`:e}function R(e){return typeof e=="string"&&e.trim().endsWith("%")}function G(e,o){let t=0;for(;t<e.length&&t<o.length&&e[t]===o[t];)t++;let r=e.length,c=o.length;for(;r>t&&c>t&&e[r-1]===o[c-1];)r--,c--;return{from:t,oldEnd:r,newEnd:c}}const L=1800,k=`color-mix(in srgb, ${n.semantic.warning} 42%, transparent)`,C=`color-mix(in srgb, ${n.semantic.warning} 18%, transparent)`;function U(e){class o extends e.view.WidgetType{constructor(s){super(),this.revision=s}eq(s){return this.revision===s.revision}toDOM(){const s=document.createElement("span");return s.className=`cm-source-deletion cm-source-change cm-source-change-${this.revision%2}`,s.setAttribute("aria-hidden","true"),s}}const t=e.state.StateEffect.define(),r=e.state.StateField.define({create:()=>e.view.Decoration.none,update(c,s){let l=c.map(s.changes);for(const d of s.effects){if(!d.is(t))continue;if(!d.value){l=e.view.Decoration.none;continue}const{from:g,to:i,revision:y}=d.value,f=g===i?e.view.Decoration.widget({widget:new o(y),side:-1}).range(g):e.view.Decoration.mark({class:`cm-source-change cm-source-change-${y%2}`}).range(g,i);l=e.view.Decoration.set([f])}return l},provide:c=>e.view.EditorView.decorations.from(c)});return{mark:t,field:r}}function K(e,o,t){return e.view.EditorView.theme({"&":{color:n.content.primary,backgroundColor:"transparent",fontSize:`${o}px`,...R(t)?{height:S(t)}:{}},"&.cm-focused":{outline:"none"},".cm-content":{fontFamily:n.typography.mono,padding:"2px 0",caretColor:"transparent"},".cm-scroller":{fontFamily:n.typography.mono,lineHeight:"1.5",overflow:"auto",...t===void 0?{}:{maxHeight:S(t)}},".cm-gutters":{backgroundColor:"transparent",color:n.content.dim,border:"none",userSelect:"none"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",minWidth:"2ch"},".cm-content ::selection":{backgroundColor:n.selection.background},".cm-panels":{backgroundColor:n.surface.raised,color:n.content.primary,border:"none",fontFamily:n.typography.sans},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${n.boundary.default}`},".cm-textfield":{backgroundColor:n.surface.inset,color:n.content.primary,border:`1px solid ${n.boundary.default}`,borderRadius:n.shape.small},".cm-button":{backgroundColor:n.surface.raised,backgroundImage:"none",color:n.content.primary,border:`1px solid ${n.boundary.default}`,borderRadius:n.shape.small},".cm-searchMatch":{backgroundColor:n.accent.muted},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:n.accent.default,color:n.content.onAccent},".cm-source-change":{backgroundColor:k,borderRadius:"2px"},".cm-line:has(.cm-source-change)":{backgroundColor:C},".cm-source-change, .cm-line:has(.cm-source-change)":{animationDuration:`${L}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:C},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-line-odd":{"0%, 40%":{backgroundColor:C},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-change-even":{"0%, 40%":{backgroundColor:k},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-change-odd":{"0%, 40%":{backgroundColor:k},"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:n.neutralOverlay.active,outline:`1px solid ${n.boundary.strong}`}},{dark:!0})}function H(e,o,t,r){const c=o==="typescript"?[e.javascript.javascript({typescript:!0,jsx:!0})]:o==="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"}),...c,K(e,t,r)]}function q({value:e,language:o,fontSize:t=11,maxHeight:r,ariaLabel:c,followChanges:s=!1}){const l=m.useRef(null),d=m.useRef(null),g=m.useRef(null),i=m.useRef(null),y=m.useRef(0),f=m.useRef(e);f.current=e;const[p,I]=m.useState(null),[N,$]=m.useState(!1);m.useEffect(()=>{let u=!1;return W().then(h=>{u||I(h)},()=>{u||$(!0)}),()=>{u=!0}},[]),m.useEffect(()=>{const u=l.current;if(!u||!p)return;const h=U(p),w=new p.view.EditorView({parent:u,state:p.state.EditorState.create({doc:f.current,extensions:[H(p,o,t,r),h.field]})});return d.current=w,g.current=h,()=>{i.current!==null&&clearTimeout(i.current),i.current=null,g.current=null,d.current=null,w.destroy()}},[p,o,t,r]),m.useEffect(()=>{const u=d.current;if(!u)return;const h=u.state.toText(e).toString(),w=u.state.doc.toString();if(w===h)return;const{from:x,oldEnd:B,newEnd:D}=G(w,h),O=u.state.changes({from:x,to:B,insert:h.slice(x,D)}),v=g.current,E=[];if(s&&p&&v){const _=u.coordsAtPos(x),j=u.scrollDOM.getBoundingClientRect(),A=_&&_.top>=j.top&&_.bottom<=j.bottom&&_.left>=j.left&&_.right<=j.right?u.scrollSnapshot().map(O):p.view.EditorView.scrollIntoView(x,{y:"nearest",x:"nearest"});A&&E.push(A),E.push(v.mark.of({from:x,to:D,revision:++y.current}))}else v&&E.push(v.mark.of(null));u.dispatch({changes:O,effects:E}),i.current!==null&&clearTimeout(i.current),i.current=null,s&&v&&(i.current=setTimeout(()=>{d.current===u&&u.dispatch({effects:v.mark.of(null)}),i.current=null},L))},[e,s,p]);const V=R(r)?{height:"100%",minHeight:0}:{};return p?a.jsx("div",{ref:l,role:"group","aria-label":c,style:{minWidth:0,...V}}):a.jsxs("div",{role:"group","aria-label":c,style:{minWidth:0,...V},children:[N&&a.jsx("div",{style:{color:n.semantic.warning,fontSize:10,marginBottom:4},children:"Syntax highlighting failed to load — showing plain text."}),a.jsx("pre",{style:{margin:0,fontFamily:n.typography.mono,fontSize:t,lineHeight:1.5,color:n.content.primary,whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"auto",...r===void 0?{}:{maxHeight:S(r)},...R(r)?{height:S(r)}:{}},children:e})]})}const X={fontSize:11,color:n.content.muted,marginBottom:2};function Y({assetPath:e}){const[o,t]=m.useState(null),[r,c]=m.useState("json"),[s,l]=m.useState(!1),d=e.split("/").pop()??e;return m.useEffect(()=>{let g=!1;return t(null),l(!1),fetch(z(e)).then(i=>i.text()).then(i=>{try{const y=JSON.parse(i);g||(c("json"),t(JSON.stringify(y,null,2)))}catch{g||(c("text"),t(i))}}).catch(()=>{g||l(!0)}),()=>{g=!0}},[e]),a.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[a.jsx("div",{style:{fontWeight:600,fontSize:12,color:n.content.primary,wordBreak:"break-all"},children:d}),a.jsx("div",{className:"vgai-content-frost",style:{border:`1px solid ${n.boundary.default}`,borderRadius:n.shape.small,padding:8,overflow:"hidden",maxHeight:500},children:s?a.jsx("span",{style:{color:n.semantic.danger,fontSize:11},children:"Failed to load file"}):o===null?a.jsx("span",{style:{color:n.content.muted,fontSize:11},children:"Loading..."}):a.jsx(q,{value:o,language:r,fontSize:10,maxHeight:484,ariaLabel:`Contents of ${d}`})}),a.jsx(F,{label:"Info",defaultOpen:!1,children:a.jsxs("div",{children:[a.jsx("div",{style:X,children:"Path"}),a.jsx("div",{style:{fontSize:11,color:n.content.primary,wordBreak:"break-all"},children:e})]})})]})}function Q({documentId:e,assetPath:o,displayName:t,active:r,sections:c,status:s}){const[l,d]=m.useState({kind:"loading"}),g=M();if(m.useEffect(()=>{if(!r){d({kind:"loading"});return}const i=new AbortController;return d({kind:"loading"}),(async()=>{for(const f of g){const p=await f.recognize(o,i.signal);if(p!==null)return{kind:"content",viewer:f,content:p}}return{kind:"generic"}})().then(f=>{i.signal.aborted||d(f)},f=>{i.signal.aborted||d({kind:"error",message:f instanceof Error?f.message:String(f)})}),()=>i.abort()},[r,o,g]),l.kind==="content"){const{Viewer:i}=l.viewer;return a.jsx(i,{documentId:e,assetPath:o,displayName:t,active:r,content:l.content})}return a.jsx(J,{documentId:e,active:r,type:"json",title:t,sections:c,status:s,children:l.kind==="loading"?a.jsxs("div",{style:{padding:20,color:n.content.muted},children:["Inspecting ",t,"…"]}):l.kind==="error"?a.jsx("div",{role:"alert",style:{padding:20,color:n.semantic.danger},children:l.message}):a.jsx(Y,{assetPath:o})})}const ce=Object.freeze(Object.defineProperty({__proto__:null,JsonAssetDocument:Q},Symbol.toStringTag,{value:"Module"}));export{q as C,Q as J,ce as a,ie as c};
@@ -1,4 +1,4 @@
1
- import{r as K,bi as B,bj as G,a as X,bd as M,aw as $,aK as I,bk as O,bl as _,bm as Q,B as C,bn as V,V as g,k as Y,o as E,bo as Z,d as ee,b as te}from"./three.module-ZILb6uB7.js";M.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new X(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};B.line={uniforms:G.merge([M.common,M.fog,M.line]),vertexShader:`
1
+ import{S as Q,aM as M,aC as G,g as X,aN as B,aO as $,F as I,aP as O,aQ as _,aR as K,t as C,a7 as V,V as y,c as Y,k as E,aS as Z,a as ee,j as te}from"./three.module-CrYDk-Xr.js";B.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new X(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};M.line={uniforms:G.merge([B.common,B.fog,B.line]),vertexShader:`
2
2
  #include <common>
3
3
  #include <color_pars_vertex>
4
4
  #include <fog_pars_vertex>
@@ -367,4 +367,4 @@ import{r as K,bi as B,bj as G,a as X,bd as M,aw as $,aK as I,bk as O,bl as _,bm
367
367
  #include <premultiplied_alpha_fragment>
368
368
 
369
369
  }
370
- `};class ie extends K{constructor(e){super({type:"LineMaterial",uniforms:G.clone(B.line.uniforms),vertexShader:B.line.vertexShader,fragmentShader:B.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const j=new C,z=new g;class ne extends ${constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new I(e,3)),this.setAttribute("uv",new I(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new O(t,6,1);return this.setAttribute("instanceStart",new _(i,3,0)),this.setAttribute("instanceEnd",new _(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new O(t,6,1);return this.setAttribute("instanceColorStart",new _(i,3,0)),this.setAttribute("instanceColorEnd",new _(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Q(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new C);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),j.setFromBufferAttribute(t),this.boundingBox.union(j))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new V),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let s=0;for(let r=0,l=e.count;r<l;r++)z.fromBufferAttribute(e,r),s=Math.max(s,i.distanceToSquared(z)),z.fromBufferAttribute(t,r),s=Math.max(s,i.distanceToSquared(z));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}const L=new E,H=new g,R=new g,o=new E,a=new E,m=new E,D=new g,T=new ee,d=new Z,N=new g,U=new C,A=new V,v=new E;let y,x;function F(c,e,t){return v.set(0,0,-e,1).applyMatrix4(c.projectionMatrix),v.multiplyScalar(1/v.w),v.x=x/t.width,v.y=x/t.height,v.applyMatrix4(c.projectionMatrixInverse),v.multiplyScalar(1/v.w),Math.abs(Math.max(v.x,v.y))}function se(c,e){const t=c.matrixWorld,i=c.geometry,s=i.attributes.instanceStart,r=i.attributes.instanceEnd,l=Math.min(i.instanceCount,s.count);for(let n=0,f=l;n<f;n++){d.start.fromBufferAttribute(s,n),d.end.fromBufferAttribute(r,n),d.applyMatrix4(t);const p=new g,h=new g;y.distanceSqToSegment(d.start,d.end,h,p),h.distanceTo(p)<x*.5&&e.push({point:h,pointOnLine:p,distance:y.origin.distanceTo(h),object:c,face:null,faceIndex:n,uv:null,uv1:null})}}function re(c,e,t){const i=e.projectionMatrix,r=c.material.resolution,l=c.matrixWorld,n=c.geometry,f=n.attributes.instanceStart,p=n.attributes.instanceEnd,h=Math.min(n.instanceCount,f.count),u=-e.near;y.at(1,m),m.w=1,m.applyMatrix4(e.matrixWorldInverse),m.applyMatrix4(i),m.multiplyScalar(1/m.w),m.x*=r.x/2,m.y*=r.y/2,m.z=0,D.copy(m),T.multiplyMatrices(e.matrixWorldInverse,l);for(let S=0,q=h;S<q;S++){if(o.fromBufferAttribute(f,S),a.fromBufferAttribute(p,S),o.w=1,a.w=1,o.applyMatrix4(T),a.applyMatrix4(T),o.z>u&&a.z>u)continue;if(o.z>u){const b=o.z-a.z,w=(o.z-u)/b;o.lerp(a,w)}else if(a.z>u){const b=a.z-o.z,w=(a.z-u)/b;a.lerp(o,w)}o.applyMatrix4(i),a.applyMatrix4(i),o.multiplyScalar(1/o.w),a.multiplyScalar(1/a.w),o.x*=r.x/2,o.y*=r.y/2,a.x*=r.x/2,a.y*=r.y/2,d.start.copy(o),d.start.z=0,d.end.copy(a),d.end.z=0;const P=d.closestPointToPointParameter(D,!0);d.at(P,N);const W=te.lerp(o.z,a.z,P),k=W>=-1&&W<=1,J=D.distanceTo(N)<x*.5;if(k&&J){d.start.fromBufferAttribute(f,S),d.end.fromBufferAttribute(p,S),d.start.applyMatrix4(l),d.end.applyMatrix4(l);const b=new g,w=new g;y.distanceSqToSegment(d.start,d.end,w,b),t.push({point:w,pointOnLine:b,distance:y.origin.distanceTo(w),object:c,face:null,faceIndex:S,uv:null,uv1:null})}}}class de extends Y{constructor(e=new ne,t=new ie({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let l=0,n=0,f=t.count;l<f;l++,n+=2)H.fromBufferAttribute(t,l),R.fromBufferAttribute(i,l),s[n]=n===0?0:s[n-1],s[n+1]=s[n]+H.distanceTo(R);const r=new O(s,2,1);return e.setAttribute("instanceDistanceStart",new _(r,1,0)),e.setAttribute("instanceDistanceEnd",new _(r,1,1)),this}raycast(e,t){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const r=e.params.Line2!==void 0&&e.params.Line2.threshold||0;y=e.ray;const l=this.matrixWorld,n=this.geometry,f=this.material;x=f.linewidth+r,n.boundingSphere===null&&n.computeBoundingSphere(),A.copy(n.boundingSphere).applyMatrix4(l);let p;if(i)p=x*.5;else{const u=Math.max(s.near,A.distanceToPoint(y.origin));p=F(s,u,f.resolution)}if(A.radius+=p,y.intersectsSphere(A)===!1)return;n.boundingBox===null&&n.computeBoundingBox(),U.copy(n.boundingBox).applyMatrix4(l);let h;if(i)h=x*.5;else{const u=Math.max(s.near,U.distanceToPoint(y.origin));h=F(s,u,f.resolution)}U.expandByScalar(h),y.intersectsBox(U)!==!1&&(i?se(this,t):re(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(L),this.material.uniforms.resolution.value.set(L.z,L.w))}}export{ne as L,ie as a,de as b};
370
+ `};class ie extends Q{constructor(e){super({type:"LineMaterial",uniforms:G.clone(M.line.uniforms),vertexShader:M.line.vertexShader,fragmentShader:M.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const j=new C,z=new y;class ne extends ${constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new I(e,3)),this.setAttribute("uv",new I(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new O(t,6,1);return this.setAttribute("instanceStart",new _(i,3,0)),this.setAttribute("instanceEnd",new _(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new O(t,6,1);return this.setAttribute("instanceColorStart",new _(i,3,0)),this.setAttribute("instanceColorEnd",new _(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new K(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new C);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),j.setFromBufferAttribute(t),this.boundingBox.union(j))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new V),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let s=0;for(let r=0,l=e.count;r<l;r++)z.fromBufferAttribute(e,r),s=Math.max(s,i.distanceToSquared(z)),z.fromBufferAttribute(t,r),s=Math.max(s,i.distanceToSquared(z));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}const L=new E,R=new y,H=new y,a=new E,o=new E,m=new E,D=new y,T=new ee,d=new Z,N=new y,U=new C,A=new V,v=new E;let g,x;function F(c,e,t){return v.set(0,0,-e,1).applyMatrix4(c.projectionMatrix),v.multiplyScalar(1/v.w),v.x=x/t.width,v.y=x/t.height,v.applyMatrix4(c.projectionMatrixInverse),v.multiplyScalar(1/v.w),Math.abs(Math.max(v.x,v.y))}function se(c,e){const t=c.matrixWorld,i=c.geometry,s=i.attributes.instanceStart,r=i.attributes.instanceEnd,l=Math.min(i.instanceCount,s.count);for(let n=0,f=l;n<f;n++){d.start.fromBufferAttribute(s,n),d.end.fromBufferAttribute(r,n),d.applyMatrix4(t);const p=new y,h=new y;g.distanceSqToSegment(d.start,d.end,h,p),h.distanceTo(p)<x*.5&&e.push({point:h,pointOnLine:p,distance:g.origin.distanceTo(h),object:c,face:null,faceIndex:n,uv:null,uv1:null})}}function re(c,e,t){const i=e.projectionMatrix,r=c.material.resolution,l=c.matrixWorld,n=c.geometry,f=n.attributes.instanceStart,p=n.attributes.instanceEnd,h=Math.min(n.instanceCount,f.count),u=-e.near;g.at(1,m),m.w=1,m.applyMatrix4(e.matrixWorldInverse),m.applyMatrix4(i),m.multiplyScalar(1/m.w),m.x*=r.x/2,m.y*=r.y/2,m.z=0,D.copy(m),T.multiplyMatrices(e.matrixWorldInverse,l);for(let S=0,q=h;S<q;S++){if(a.fromBufferAttribute(f,S),o.fromBufferAttribute(p,S),a.w=1,o.w=1,a.applyMatrix4(T),o.applyMatrix4(T),a.z>u&&o.z>u)continue;if(a.z>u){const b=a.z-o.z,w=(a.z-u)/b;a.lerp(o,w)}else if(o.z>u){const b=o.z-a.z,w=(o.z-u)/b;o.lerp(a,w)}a.applyMatrix4(i),o.applyMatrix4(i),a.multiplyScalar(1/a.w),o.multiplyScalar(1/o.w),a.x*=r.x/2,a.y*=r.y/2,o.x*=r.x/2,o.y*=r.y/2,d.start.copy(a),d.start.z=0,d.end.copy(o),d.end.z=0;const P=d.closestPointToPointParameter(D,!0);d.at(P,N);const W=te.lerp(a.z,o.z,P),k=W>=-1&&W<=1,J=D.distanceTo(N)<x*.5;if(k&&J){d.start.fromBufferAttribute(f,S),d.end.fromBufferAttribute(p,S),d.start.applyMatrix4(l),d.end.applyMatrix4(l);const b=new y,w=new y;g.distanceSqToSegment(d.start,d.end,w,b),t.push({point:w,pointOnLine:b,distance:g.origin.distanceTo(w),object:c,face:null,faceIndex:S,uv:null,uv1:null})}}}class de extends Y{constructor(e=new ne,t=new ie({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let l=0,n=0,f=t.count;l<f;l++,n+=2)R.fromBufferAttribute(t,l),H.fromBufferAttribute(i,l),s[n]=n===0?0:s[n-1],s[n+1]=s[n]+R.distanceTo(H);const r=new O(s,2,1);return e.setAttribute("instanceDistanceStart",new _(r,1,0)),e.setAttribute("instanceDistanceEnd",new _(r,1,1)),this}raycast(e,t){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const r=e.params.Line2!==void 0&&e.params.Line2.threshold||0;g=e.ray;const l=this.matrixWorld,n=this.geometry,f=this.material;x=f.linewidth+r,n.boundingSphere===null&&n.computeBoundingSphere(),A.copy(n.boundingSphere).applyMatrix4(l);let p;if(i)p=x*.5;else{const u=Math.max(s.near,A.distanceToPoint(g.origin));p=F(s,u,f.resolution)}if(A.radius+=p,g.intersectsSphere(A)===!1)return;n.boundingBox===null&&n.computeBoundingBox(),U.copy(n.boundingBox).applyMatrix4(l);let h;if(i)h=x*.5;else{const u=Math.max(s.near,U.distanceToPoint(g.origin));h=F(s,u,f.resolution)}U.expandByScalar(h),g.intersectsBox(U)!==!1&&(i?se(this,t):re(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(L),this.material.uniforms.resolution.value.set(L.z,L.w))}}export{ne as L,ie as a,de as b};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StageHost-CdzuP0NS.js","assets/index-Dm_h-T4x.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-CAUTK36e.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-jib6KJY8.js","assets/client-mkWk8S65.js","assets/index-0Lm0Nf1M.css","assets/three-integration.service-0EyPpd5f.js","assets/content-bounds-_QWiKD5_.js","assets/three.module-CrYDk-Xr.js","assets/layered-pick-CT4HlEpW.js","assets/viewport-door-BdL0u5rd.js","assets/bitmap-label-Ct4k6ehY.js","assets/viewport-surface-status-yS6CrXH7.js","assets/live-mixers-B-bwLZ7c.js","assets/model-inspection-DDZE59vp.js","assets/clip-planes-CnAI6DZn.js","assets/OrbitControls-smIenN60.js","assets/LineSegments2-BKEsgiC8.js","assets/viewport-editor-controls-BYaAZ_Ku.js","assets/editor-presentation-activity-C7SNSmTd.js","assets/transport-strip-Co-ZDkf-.js"])))=>i.map(i=>d[i]);
2
+ import{j as o}from"./jsx-runtime-CAUTK36e.js";import{cT as U,K as W,i as G,al as g,bj as q,cU as J,cV as K,ax as Q,cu as X,cW as Y}from"./index-Dm_h-T4x.js";import{r as c}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-jib6KJY8.js";import{P as Z,G as ee,d as M}from"./three-integration.service-0EyPpd5f.js";import{V as te,O as re,b as ne}from"./viewport-surface-status-yS6CrXH7.js";import{G as oe,t as se}from"./three.module-CrYDk-Xr.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./client-mkWk8S65.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./content-bounds-_QWiKD5_.js";import"./layered-pick-CT4HlEpW.js";import"./viewport-door-BdL0u5rd.js";import"./bitmap-label-Ct4k6ehY.js";class w extends Error{constructor(t){super(t.message),this.refusal=t,this.name="LiveModuleError"}}function ie(e){return Object.keys(e).filter(t=>t!=="__esModule"&&t!=="Symbol.toStringTag")}function T(e){return typeof e=="object"&&e!==null&&e.isObject3D===!0}function ae(e){if("default"in e)return{name:"default",value:e.default};const t=ie(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 _(e){if(T(e))return{root:e};if(!e||typeof e!="object")return;const t=e;if(!T(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 L(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 $="a model module returns a THREE.Object3D, or a build result `{ root, animations?, dispose? }` whose `root` is one.";async function ce(e,t){const r=_(t);if(r)return{...r,exportName:e};if(typeof t!="function")return{kind:"not-a-model",message:`Export '${e}' is ${L(t)}, not a function and not a model — `+$};let l;try{l=await t()}catch(s){return{kind:"import-failed",message:`Export '${e}' threw while building: ${N(s)}`,...s instanceof Error&&s.stack?{stack:s.stack}:{}}}const u=_(l);return u?{...u,exportName:e}:{kind:"not-a-model",message:`Export '${e}' ran but returned ${L(l)} — ${$}`}}function N(e){return e instanceof Error?e.message:String(e)}async function le(e,t,r){let l;try{l=await import(U(e,t,r))}catch(d){throw new w({kind:"import-failed",message:N(d),...d instanceof Error&&d.stack?{stack:d.stack}:{}})}const u=ae(l);if("kind"in u)throw new w(u);const s=await ce(u.name,u.value);if("kind"in s)throw new w(s);return s}const ue=c.lazy(async()=>({default:(await G(()=>import("./StageHost-CdzuP0NS.js").then(t=>t.S),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]))).Object3DDocumentViewport}));function de(e){return me(e.documentId,e.chromeless),o.jsx(c.Suspense,{fallback:o.jsx(te,{testId:"object3d-document-loading",children:re}),children:o.jsx(ue,{...e})})}function me(e,t=!1){c.useEffect(()=>{if(!t)return W(e)},[e,t])}const R={height:"100%",width:"100%",minHeight:0,display:"flex",position:"relative"},C={flex:1,minWidth:0,minHeight:0,display:"flex"};function fe(e,t){if(e.kind!=="import-failed")return{message:e.message};const r=Y(t);return r?{message:r,stack:e.message}:{message:e.message,stack:e.stack}}function Te({documentId:e,projectRoot:t,modulePath:r,displayName:l,active:u,fallback:s}){const[d,v]=c.useState({status:"probing"}),[h,E]=c.useState(null),m=c.useMemo(()=>{const i=new oe;return i.name=r.split("/").pop()??r,i},[r]),D=c.useRef(!1);c.useEffect(()=>{let i=!1,j=0,f=null,p=Promise.resolve(),x=null,y=null;const O=()=>{f&&(m.remove(f),m.animations=[],y?y():M(f),f=null,y=null)},V=(n,b)=>{O(),f=n,y=b,m.add(n),m.animations=n.animations,X(e)},B=(n,b)=>{if(n.kind==="not-a-model"&&!b){v({status:"fallback",reason:n.message});return}const a=fe(n,r);E(a),Q.error(`${r}: ${a.message}`,"live-module"),b||v({status:"fallback",reason:n.message})},S=n=>i||n!==j,H=async()=>{j+=1;const n=j,b=K();let a;try{a=await le(t,r,b)}catch(k){if(S(n))return;if(!(k instanceof w))throw k;x=k,B(k.refusal,f!==null);return}if(S(n)){a.dispose?a.dispose():M(a.root);return}V(a.root,a.dispose??null),x=null,J(r),E(null),v({status:"live",exportName:a.exportName})},A=()=>(p=H(),p),z=Z(e,async()=>{let n=A();for(;;){if(await n,i)throw new Error(`Document closed while rebuilding: ${r}`);if(n===p)break;n=p}if(x)throw x});A();const P=q();return()=>{i=!0,z(),P(),O()}},[m,e,r,t]),c.useEffect(()=>{if(d.status!=="live"||D.current)return;let i=0,j=0;const f=()=>{const p=ee(e);if(p){D.current=!0,new se().setFromObject(m).isEmpty()||p.frame();return}++j>60||(i=requestAnimationFrame(f))};return i=requestAnimationFrame(f),()=>cancelAnimationFrame(i)},[m,e,d.status]);const I=c.useCallback(()=>({root:m,dispose(){}}),[m]);return d.status==="probing"?o.jsxs("div",{style:{padding:20,color:g.content.muted},children:["Inspecting ",l,"…"]}):d.status==="fallback"?o.jsxs("div",{style:R,children:[h?o.jsx(F,{failure:h}):null,o.jsx("div",{style:{...C,overflow:"auto"},children:s})]}):o.jsxs("div",{style:R,children:[o.jsx("div",{style:{...C,opacity:h?.35:1},children:o.jsx(de,{documentId:e,sourcePath:r,displayName:l,build:I,active:u,assetType:"model module",cameraDirection:ne,modelSource:{kind:"project-file",path:r}})}),h?o.jsx(F,{failure:h}):null]})}function F({failure:e}){return o.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:g.shape.small,background:g.surface.raised,border:`1px solid ${g.semantic.danger}`,color:g.semantic.danger,fontFamily:g.typography.mono,fontSize:11,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word",pointerEvents:"auto"},children:[o.jsx("div",{style:{fontWeight:600},children:"This module did not build — showing the last good model."}),o.jsx("div",{style:{marginTop:4},children:e.message}),e.stack?o.jsx("div",{style:{marginTop:6,color:g.content.muted},children:e.stack}):null]})}export{Te as LiveModuleDocument};
@@ -0,0 +1 @@
1
+ import{j as i}from"./jsx-runtime-CAUTK36e.js";import{cI as z,cN as N,cK as I,cL as A,al as y,b2 as M,cO as k,cM as L,aT as P}from"./index-Dm_h-T4x.js";import{r as w}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-jib6KJY8.js";import{EffectComposer as B,LUT3DEffect as F,RenderPass as O,EffectPass as _}from"./index-CQG6JOSy.js";import{aT as $,af as T,aU as G,V as v,u as H,n as D,I as j,aB as V,f as X,aJ as q,Y as W,C as R,P as Z,bH as J,D as K,aw as C,d as Y,x as Q,X as ee,c as te}from"./three.module-CrYDk-Xr.js";import{s as re}from"./asset-editor-persistence-BtRQI8t6.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./client-mkWk8S65.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";class ne extends ${constructor(t){super(t),this.type=T}setType(t){return this.type=t,this}load(t,a,f,g){const n=new G(this.manager);n.setPath(this.path),n.setResponseType("text"),n.load(t,c=>{try{a(this.parse(c))}catch(e){g?g(e):console.error(e),this.manager.itemError(t)}},f,g)}parse(t){const a=/TITLE +"([^"]*)"/,f=/LUT_3D_SIZE +(\d+)/,g=/DOMAIN_MIN +([\d.]+) +([\d.]+) +([\d.]+)/,n=/DOMAIN_MAX +([\d.]+) +([\d.]+) +([\d.]+)/,c=/^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm;let e=a.exec(t);const p=e!==null?e[1]:null;if(e=f.exec(t),e===null)throw new Error("LUTCubeLoader: Missing LUT_3D_SIZE information");const s=Number(e[1]),u=s**3*4,o=this.type===T?new Uint8Array(u):new Float32Array(u),d=new v(0,0,0),m=new v(1,1,1);if(e=g.exec(t),e!==null&&d.set(Number(e[1]),Number(e[2]),Number(e[3])),e=n.exec(t),e!==null&&m.set(Number(e[1]),Number(e[2]),Number(e[3])),d.x>m.x||d.y>m.y||d.z>m.z)throw new Error("LUTCubeLoader: Invalid input domain");const x=this.type===T?255:1;let h=0;for(;(e=c.exec(t))!==null;)o[h++]=Number(e[1])*x,o[h++]=Number(e[2])*x,o[h++]=Number(e[3])*x,o[h++]=x;const l=new H;return l.image.data=o,l.image.width=s,l.image.height=s,l.image.depth=s,l.type=this.type,l.magFilter=D,l.minFilter=D,l.wrapS=j,l.wrapT=j,l.wrapR=j,l.generateMipmaps=!1,l.needsUpdate=!0,{title:p,size:s,domainMin:d,domainMax:m,texture3D:l}}}function b(r){return r.split("/").pop()??r}function E(r,t,a){return Math.min(a,Math.max(t,r))}function U(r){return[r.x,r.y,r.z].map(t=>t.toFixed(2)).join(", ")}function se(){const r=new W;r.background=new R("#171a22");const t=new Z(34,1,.1,100);t.position.set(6.6,4.6,8.8),t.lookAt(0,.7,0),r.add(new J("#dce8ff","#322a27",2.1));const a=new K("#fff3db",3.8);a.position.set(4,7,5),r.add(a);const f=[],g=[],n=(s,u,o)=>{f.push(s),g.push(u);const d=new te(s,u);return d.position.set(...o),d.castShadow=!0,d.receiveShadow=!0,r.add(d),d},c=[["#e64d45",-2.4],["#e5ad42",-1.2],["#55b86a",0],["#47a9d8",1.2],["#8a68d7",2.4]];for(const[s,u]of c)n(new Y(.48,48,32),new C({color:s,roughness:.3,metalness:.08}),[u,.65,0]);[.06,.18,.5,.82,1].forEach((s,u)=>{const o=Math.round(s*255);n(new Q(.78,.78,.78),new C({color:new R(`rgb(${o}, ${o}, ${o})`),roughness:.72}),[-2.4+u*1.2,1.85,-.1])});const p=n(new ee(9,6),new C({color:"#777b86",roughness:.92}),[0,.08,-1.8]);return p.rotation.x=-Math.PI/2,{scene:r,camera:t,dispose:()=>{for(const s of f)s.dispose();for(const s of g)s.dispose()}}}function oe({lut:r,settingsRef:t}){const a=w.useRef(null);return w.useEffect(()=>{const f=a.current;if(!f)return;let g=!1,n=0;const c=document.createElement("canvas");c.setAttribute("aria-label","LUT before and after preview"),c.style.width="100%",c.style.height="100%",c.style.display="block",f.replaceChildren(c);const e=new V({canvas:c,antialias:!0});e.outputColorSpace=X,e.toneMapping=q,e.toneMappingExposure=1,e.shadowMap.enabled=!0;const p=se(),s=new B(e),u=new F(r.texture3D,{tetrahedralInterpolation:!0});s.addPass(new O(p.scene,p.camera)),s.addPass(new _(p.camera,u));const o={width:1,height:1},d=()=>{const l=t.current,S=Math.round(o.width*E(l.split,.05,.95));u.blendMode.opacity.value=E(l.intensity,0,1),u.tetrahedralInterpolation=l.tetrahedral,e.setScissorTest(!1),e.setRenderTarget(null),e.clear(),e.setScissorTest(!0),e.setScissor(0,0,S,o.height),e.render(p.scene,p.camera),e.setScissor(S,0,o.width-S,o.height),s.render(),e.setScissorTest(!1)},m=()=>{const l=f.getBoundingClientRect();o.width=Math.max(1,Math.floor(l.width)),o.height=Math.max(1,Math.floor(l.height)),e.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),e.setSize(o.width,o.height,!1),s.setSize(o.width,o.height),p.camera.aspect=o.width/o.height,p.camera.updateProjectionMatrix()};m(),d();const x=new ResizeObserver(()=>{m(),d()});x.observe(f);const h=()=>{g||(d(),n=requestAnimationFrame(h))};return n=requestAnimationFrame(h),()=>{g=!0,cancelAnimationFrame(n),x.disconnect(),s.dispose(),u.dispose(),p.dispose(),e.dispose(),c.remove()}},[r,t]),i.jsx("div",{ref:a,"data-testid":"lut-preview",style:{width:"100%",height:"100%",minHeight:260,background:"#171a22"}})}function ie({settings:r,onChange:t}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:4},children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Intensity",i.jsx(L,{value:r.intensity,onChange:a=>t({...r,intensity:E(a,0,1)}),step:.01,precision:2})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Comparison split",i.jsx(L,{value:r.split,onChange:a=>t({...r,split:E(a,.05,.95)}),step:.01,precision:2})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:7,fontSize:11},children:[i.jsx(P,{checked:r.tetrahedral,onChange:a=>t({...r,tetrahedral:a.target.checked})}),"Tetrahedral interpolation"]}),i.jsx("div",{style:{color:y.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 ae(r){const t=await k(r);if(t===null)throw new Error(`CUBE LUT not found: ${r}`);return new ne().parse(t)}function be({documentId:r,assetPath:t,active:a=!0}){const[f,g]=w.useState(0),[n,c]=w.useState(null),[e,p]=w.useState(null),[s,u]=w.useState({intensity:1,split:.5,tetrahedral:!0}),o=w.useRef(s);o.current=s,w.useEffect(()=>{if(a)return re(t,()=>g(m=>m+1))},[a,t]),w.useEffect(()=>{if(!a)return;let m=!1,x=null;return c(null),p(null),ae(t).then(h=>{if(x=h,m){h.texture3D.dispose();return}c(h)},h=>{m||p(h instanceof Error?h.message:String(h))}),()=>{m=!0,x?.texture3D.dispose()}},[a,t,f]);const d=w.useMemo(()=>[{id:"lut-profile",title:"Color Grade",icon:N,order:z,body:{kind:"custom",...n?{data:{title:n.title,size:n.size,domainMin:n.domainMin.toArray(),domainMax:n.domainMax.toArray()}}:{},render:()=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"6px 10px"},children:[i.jsx("span",{style:{color:y.content.muted},children:"Title"}),i.jsx("span",{children:n?.title||b(t)}),i.jsx("span",{style:{color:y.content.muted},children:"Cube"}),i.jsx("span",{children:n?`${n.size}³`:"—"}),i.jsx("span",{style:{color:y.content.muted},children:"Domain"}),i.jsx("span",{children:n?`${U(n.domainMin)} → ${U(n.domainMax)}`:"—"})]})}},{id:"lut-preview-settings",title:"Preview",icon:A,order:I,body:{kind:"custom",data:{...s},render:()=>i.jsx(ie,{settings:s,onChange:u})}}],[t,n,s]);return e?i.jsx(M,{documentId:r,active:a,type:"color grade",title:b(t),status:"CUBE LUT unavailable",children:i.jsx("div",{role:"alert",style:{padding:20,color:y.semantic.danger},children:e})}):n?i.jsx(M,{documentId:r,active:a,type:"color grade",title:b(t),sections:d,status:`CUBE LUT · ${n.size}³`,fill:!0,children:i.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,background:"#171a22"},children:[i.jsx(oe,{lut:n,settingsRef:o}),i.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"}),i.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:n.title||"Graded"})]})}):i.jsx(M,{documentId:r,active:a,type:"color grade",title:b(t),status:"Loading CUBE LUT",children:i.jsx("div",{style:{padding:20,color:y.content.muted},children:"Loading color grade…"})})}export{be as LutAssetDocument};
@@ -1,2 +1,2 @@
1
- import{a0 as b,aQ as w,a2 as M,a9 as x,q as F,aR as d,h as u,e as f,aN as O,a as g,aS as y,aT as L}from"./three.module-ZILb6uB7.js";class S extends b{constructor(s){super(s)}load(s,o,p,e){const a=this,n=this.path===""?w.extractUrlBase(s):this.path,r=new M(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(s,function(t){try{o(a.parse(t,n))}catch(i){e?e(i):console.error(i),a.manager.itemError(s)}},p,e)}setMaterialOptions(s){return this.materialOptions=s,this}parse(s,o){const p=s.split(`
2
- `);let e={};const a=/\s+/,n={};for(let t=0;t<p.length;t++){let i=p[t];if(i=i.trim(),i.length===0||i.charAt(0)==="#")continue;const c=i.indexOf(" ");let l=c>=0?i.substring(0,c):i;l=l.toLowerCase();let h=c>=0?i.substring(c+1):"";if(h=h.trim(),l==="newmtl")e={name:h},n[h]=e;else if(l==="ka"||l==="kd"||l==="ks"||l==="ke"){const m=h.split(a,3);e[l]=[parseFloat(m[0]),parseFloat(m[1]),parseFloat(m[2])]}else e[l]=h}const r=new C(this.resourcePath||o,this.materialOptions);return r.setCrossOrigin(this.crossOrigin),r.setManager(this.manager),r.setMaterials(n),r}}class C{constructor(s="",o={}){this.baseUrl=s,this.options=o,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:x,this.wrap=this.options.wrap!==void 0?this.options.wrap:F}setCrossOrigin(s){return this.crossOrigin=s,this}setManager(s){this.manager=s}setMaterials(s){this.materialsInfo=this.convert(s),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(s){if(!this.options)return s;const o={};for(const p in s){const e=s[p],a={};o[p]=a;for(const n in e){let r=!0,t=e[n];const i=n.toLowerCase();switch(i){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(t=[t[0]/255,t[1]/255,t[2]/255]),this.options&&this.options.ignoreZeroRGBs&&t[0]===0&&t[1]===0&&t[2]===0&&(r=!1);break}r&&(a[i]=t)}}return o}preload(){for(const s in this.materialsInfo)this.create(s)}getIndex(s){return this.nameLookup[s]}getAsArray(){let s=0;for(const o in this.materialsInfo)this.materialsArray[s]=this.create(o),this.nameLookup[o]=s,s++;return this.materialsArray}create(s){return this.materials[s]===void 0&&this.createMaterial_(s),this.materials[s]}createMaterial_(s){const o=this,p=this.materialsInfo[s],e={name:s,side:this.side};function a(r,t){return typeof t!="string"||t===""?"":/^https?:\/\//i.test(t)?t:r+t}function n(r,t){if(e[r])return;const i=o.getTextureParams(t,e),c=o.loadTexture(a(o.baseUrl,i.url));c.repeat.copy(i.scale),c.offset.copy(i.offset),c.wrapS=o.wrap,c.wrapT=o.wrap,(r==="map"||r==="emissiveMap")&&(c.colorSpace=f),e[r]=c}for(const r in p){const t=p[r];let i;if(t!=="")switch(r.toLowerCase()){case"kd":e.color=d.colorSpaceToWorking(new u().fromArray(t),f);break;case"ks":e.specular=d.colorSpaceToWorking(new u().fromArray(t),f);break;case"ke":e.emissive=d.colorSpaceToWorking(new u().fromArray(t),f);break;case"map_kd":n("map",t);break;case"map_ks":n("specularMap",t);break;case"map_ke":n("emissiveMap",t);break;case"norm":n("normalMap",t);break;case"map_bump":case"bump":n("bumpMap",t);break;case"disp":n("displacementMap",t);break;case"map_d":n("alphaMap",t),e.transparent=!0;break;case"ns":e.shininess=parseFloat(t);break;case"d":i=parseFloat(t),i<1&&(e.opacity=i,e.transparent=!0);break;case"tr":i=parseFloat(t),this.options&&this.options.invertTrProperty&&(i=1-i),i>0&&(e.opacity=1-i,e.transparent=!0);break}}return this.materials[s]=new O(e),this.materials[s]}getTextureParams(s,o){const p={scale:new g(1,1),offset:new g(0,0)},e=s.split(/\s+/);let a;return a=e.indexOf("-bm"),a>=0&&(o.bumpScale=parseFloat(e[a+1]),e.splice(a,2)),a=e.indexOf("-mm"),a>=0&&(o.displacementBias=parseFloat(e[a+1]),o.displacementScale=parseFloat(e[a+2]),e.splice(a,3)),a=e.indexOf("-s"),a>=0&&(p.scale.set(parseFloat(e[a+1]),parseFloat(e[a+2])),e.splice(a,4)),a=e.indexOf("-o"),a>=0&&(p.offset.set(parseFloat(e[a+1]),parseFloat(e[a+2])),e.splice(a,4)),p.url=e.join(" ").trim(),p}loadTexture(s,o,p,e,a){const n=this.manager!==void 0?this.manager:y;let r=n.getHandler(s);r===null&&(r=new L(n)),r.setCrossOrigin&&r.setCrossOrigin(this.crossOrigin);const t=r.load(s,p,e,a);return o!==void 0&&(t.mapping=o),t}}export{S as MTLLoader};
1
+ import{aT as b,aY as w,aU as M,b as x,N as F,aE as d,C as u,f,cH as O,g,cI as y,a_ as C}from"./three.module-CrYDk-Xr.js";class A extends b{constructor(s){super(s)}load(s,o,c,e){const a=this,n=this.path===""?w.extractUrlBase(s):this.path,r=new M(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(s,function(t){try{o(a.parse(t,n))}catch(i){e?e(i):console.error(i),a.manager.itemError(s)}},c,e)}setMaterialOptions(s){return this.materialOptions=s,this}parse(s,o){const c=s.split(`
2
+ `);let e={};const a=/\s+/,n={};for(let t=0;t<c.length;t++){let i=c[t];if(i=i.trim(),i.length===0||i.charAt(0)==="#")continue;const p=i.indexOf(" ");let l=p>=0?i.substring(0,p):i;l=l.toLowerCase();let h=p>=0?i.substring(p+1):"";if(h=h.trim(),l==="newmtl")e={name:h},n[h]=e;else if(l==="ka"||l==="kd"||l==="ks"||l==="ke"){const m=h.split(a,3);e[l]=[parseFloat(m[0]),parseFloat(m[1]),parseFloat(m[2])]}else e[l]=h}const r=new L(this.resourcePath||o,this.materialOptions);return r.setCrossOrigin(this.crossOrigin),r.setManager(this.manager),r.setMaterials(n),r}}class L{constructor(s="",o={}){this.baseUrl=s,this.options=o,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:x,this.wrap=this.options.wrap!==void 0?this.options.wrap:F}setCrossOrigin(s){return this.crossOrigin=s,this}setManager(s){this.manager=s}setMaterials(s){this.materialsInfo=this.convert(s),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(s){if(!this.options)return s;const o={};for(const c in s){const e=s[c],a={};o[c]=a;for(const n in e){let r=!0,t=e[n];const i=n.toLowerCase();switch(i){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(t=[t[0]/255,t[1]/255,t[2]/255]),this.options&&this.options.ignoreZeroRGBs&&t[0]===0&&t[1]===0&&t[2]===0&&(r=!1);break}r&&(a[i]=t)}}return o}preload(){for(const s in this.materialsInfo)this.create(s)}getIndex(s){return this.nameLookup[s]}getAsArray(){let s=0;for(const o in this.materialsInfo)this.materialsArray[s]=this.create(o),this.nameLookup[o]=s,s++;return this.materialsArray}create(s){return this.materials[s]===void 0&&this.createMaterial_(s),this.materials[s]}createMaterial_(s){const o=this,c=this.materialsInfo[s],e={name:s,side:this.side};function a(r,t){return typeof t!="string"||t===""?"":/^https?:\/\//i.test(t)?t:r+t}function n(r,t){if(e[r])return;const i=o.getTextureParams(t,e),p=o.loadTexture(a(o.baseUrl,i.url));p.repeat.copy(i.scale),p.offset.copy(i.offset),p.wrapS=o.wrap,p.wrapT=o.wrap,(r==="map"||r==="emissiveMap")&&(p.colorSpace=f),e[r]=p}for(const r in c){const t=c[r];let i;if(t!=="")switch(r.toLowerCase()){case"kd":e.color=d.colorSpaceToWorking(new u().fromArray(t),f);break;case"ks":e.specular=d.colorSpaceToWorking(new u().fromArray(t),f);break;case"ke":e.emissive=d.colorSpaceToWorking(new u().fromArray(t),f);break;case"map_kd":n("map",t);break;case"map_ks":n("specularMap",t);break;case"map_ke":n("emissiveMap",t);break;case"norm":n("normalMap",t);break;case"map_bump":case"bump":n("bumpMap",t);break;case"disp":n("displacementMap",t);break;case"map_d":n("alphaMap",t),e.transparent=!0;break;case"ns":e.shininess=parseFloat(t);break;case"d":i=parseFloat(t),i<1&&(e.opacity=i,e.transparent=!0);break;case"tr":i=parseFloat(t),this.options&&this.options.invertTrProperty&&(i=1-i),i>0&&(e.opacity=1-i,e.transparent=!0);break}}return this.materials[s]=new O(e),this.materials[s]}getTextureParams(s,o){const c={scale:new g(1,1),offset:new g(0,0)},e=s.split(/\s+/);let a;return a=e.indexOf("-bm"),a>=0&&(o.bumpScale=parseFloat(e[a+1]),e.splice(a,2)),a=e.indexOf("-mm"),a>=0&&(o.displacementBias=parseFloat(e[a+1]),o.displacementScale=parseFloat(e[a+2]),e.splice(a,3)),a=e.indexOf("-s"),a>=0&&(c.scale.set(parseFloat(e[a+1]),parseFloat(e[a+2])),e.splice(a,4)),a=e.indexOf("-o"),a>=0&&(c.offset.set(parseFloat(e[a+1]),parseFloat(e[a+2])),e.splice(a,4)),c.url=e.join(" ").trim(),c}loadTexture(s,o,c,e,a){const n=this.manager!==void 0?this.manager:y;let r=n.getHandler(s);r===null&&(r=new C(n)),r.setCrossOrigin&&r.setCrossOrigin(this.crossOrigin);const t=r.load(s,c,e,a);return o!==void 0&&(t.mapping=o),t}}export{A as MTLLoader};
@@ -0,0 +1 @@
1
+ import{j as p}from"./jsx-runtime-CAUTK36e.js";import{r as n}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{al as a}from"./index-Dm_h-T4x.js";import"./index-jib6KJY8.js";import{m as w,L as x,a as E,b as S,d as f}from"./three-integration.service-0EyPpd5f.js";import{O as M}from"./StageHost-CdzuP0NS.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-mkWk8S65.js";import"./content-bounds-_QWiKD5_.js";import"./three.module-CrYDk-Xr.js";import"./layered-pick-CT4HlEpW.js";import"./viewport-door-BdL0u5rd.js";import"./bitmap-label-Ct4k6ehY.js";import"./viewport-surface-status-yS6CrXH7.js";import"./live-mixers-B-bwLZ7c.js";import"./model-inspection-DDZE59vp.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-smIenN60.js";import"./LineSegments2-BKEsgiC8.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./editor-presentation-activity-C7SNSmTd.js";import"./transport-strip-Co-ZDkf-.js";function X({documentId:g,assetPath:o,displayName:u,active:l}){const[b,m]=n.useState(null),[d,c]=n.useState(null);n.useEffect(()=>{if(!l){m(null);return}const i=new AbortController;let s=null;m(null),c(null);const e=w(o);return(e==="glb"||e==="gltf"||e==="spz"?x(o,i.signal):e?E({url:o,format:e}).then(S).then(r=>({root:r,sourceBytes:null})):Promise.reject(new Error(`No native Three.js model loader supports ${o}.`))).then(r=>{if(i.signal.aborted){f(r.root);return}s=r.root,m(r)},r=>{i.signal.aborted||c(r instanceof Error?r.message:String(r))}),()=>{i.abort(),s&&f(s)}},[l,o]);const t=b?.root??null,j=n.useCallback(()=>{if(!t)throw new Error(`Model asset ${o} is not loaded.`);return{root:t,animations:t.animations,dispose(){}}},[o,t]);return d?p.jsx("div",{role:"alert",style:{padding:20,color:a.semantic.danger},children:d}):t?p.jsx(M,{documentId:g,sourcePath:o,displayName:u,build:j,active:l,assetType:"model",modelSource:{kind:"project-file",path:o}}):p.jsxs("div",{style:{padding:20,color:a.content.muted},children:["Loading ",u,"…"]})}export{X as ModelAssetDocument};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/world-documents-B5IWN-ng.js","assets/jsx-runtime-CAUTK36e.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-Dm_h-T4x.js","assets/index-DaQZGF7d.js","assets/index-D_NuPfjr.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-jib6KJY8.js","assets/client-mkWk8S65.js","assets/index-0Lm0Nf1M.css","assets/layered-pick-CT4HlEpW.js","assets/Toolbar-DI0LGx25.js","assets/transform-mode-request-Cz6fzydi.js","assets/TransientHint-myZtSdd6.js","assets/react-story-board-CkaP4mEG.js","assets/viewport-editor-controls-BYaAZ_Ku.js"])))=>i.map(i=>d[i]);
2
+ import{r as I}from"./index-DaQZGF7d.js";import{aw as _,ax as u,ay as D,az as N,aA as F,F as H,aB as W,aC as p,aD as C,aE as b,aF as B,aG as T,aH as $,aI as x,aJ as R,aK as G,aL as M,aM as E,a3 as L,aN as V,aO as q,aP as J,aQ as K,i as U,aR as Z,y as Q}from"./index-Dm_h-T4x.js";const l=new WeakMap,X=new Set;function S(){for(const t of X)t()}function Y(t){const e=(l.get(t)?.generation??0)+1;return l.set(t,{generation:e,settled:!1}),S(),()=>{const r=l.get(t);!r||r.generation!==e||r.settled||(l.set(t,{generation:e,settled:!0}),S())}}const ee={transform:!1,inspectorFields:!1,persist:!1};class te{capabilities=ee;provenance={source:"boundary",label:"read-only",detail:"Declared world without a live editing surface in this viewport — disclosed, not simulated; rows are read-only."};world;reason;store;pickable;constructor(e,r,s,o){this.store=e,this.world=r,this.reason=s??null,o&&(this.pickable={pick:o})}get disclosure(){return this.reason}get label(){return this.world.entryOrScenePath?.split("/").pop()??this.world.id}get node(){return{id:this.world.id,label:this.label,secondaryLabel:this.reason?"Unavailable":"Read-only",role:"boundary",kind:this.world.kind,parentId:null,childIds:[]}}hierarchy={roots:()=>[this.node],node:e=>e===this.world.id?this.node:null};selection={get:()=>[...this.store.selectedEntityIds],set:e=>this.store.selectMultiple(e)};inspector={properties:e=>{if(e!==this.world.id)return[];const r=[{path:"kind",label:"Kind",type:"string",readonly:!0}];return this.world.adapter!==void 0&&r.push({path:"adapter",label:"Adapter",type:"string",readonly:!0}),this.world.entryOrScenePath!==void 0&&r.push({path:"path",label:"Entry / Scene",type:"string",readonly:!0}),r.push({path:"zOrder",label:"Z Order",type:"number",readonly:!0},{path:"pausable",label:"Pausable",type:"boolean",readonly:!0}),this.reason&&r.push({path:"reason",label:"Reason",type:"string",readonly:!0}),r},get:(e,r)=>{if(e===this.world.id)switch(r){case"kind":return this.world.kind;case"adapter":return this.world.adapter;case"path":return this.world.entryOrScenePath;case"zOrder":return this.world.zOrder;case"pausable":return this.world.pausable;case"reason":return this.reason??void 0;default:return}},set:(e,r,s)=>{}}}const re="(invalid manifest)";let v=!1,m=!1,w=!1,c=null;function y(){if(m||w||!v||!c)return;m=!0;const t=c;queueMicrotask(()=>{if(m=!1,c!==t){y();return}v=!1,w=!0,Promise.resolve().then(t).catch(e=>{u.error(`Edit-mode rebuild failed: ${e instanceof Error?e.message:String(e)}`,"authoring")}).finally(()=>{w=!1,y()})})}function se(t){return c=t,y(),()=>{c===t&&(c=null)}}function me(){v=!0,y()}const ie=new Set(["three","canvas","dom"]);function d(t){return typeof t=="string"?t:void 0}function ne(t){const e=t.world;if(!e||typeof e!="object")return;const r=d(e.entry);if(r)return{entry:r,export:d(e.export)}}function oe(t){if(t!=null){if(typeof t=="string")return t;if(typeof t=="object"){const e=t;if(typeof e.module=="string")return`module:${e.module}`;const r=e.ingest;if(r&&typeof r=="object")return"ingest"}}}function ae(t){if(!t||typeof t!="object")return null;const e=t.roots;return e===void 0||!Array.isArray(e)?null:{roots:e.map((s,o)=>{const n=s&&typeof s=="object"?s:{},a=n.zOrder,i=n.pausable;return{id:d(n.id)??`(world ${o})`,surface:(typeof n.adapter=="string"?d(n.adapter):void 0)??d(n.adapter&&typeof n.adapter=="object"?n.adapter.surface:void 0)??"(missing adapter surface)",adapter:oe(n.adapter),scene:d(n.scene),entry:d(n.entry),zOrder:typeof a=="number"?a:void 0,pausable:typeof i=="boolean"?i:void 0,dev:n.dev===!0,world:ne(n)}})}}function de(t){return ie.has(t.surface)?!t.scene&&!t.entry?`World "${t.id}" declares neither \`scene\` nor \`entry\` — nothing to mount.`:null:`Unknown world surface "${t.surface}" — expected one of: three, canvas, react.`}function f(t,e){const r=t.roots;if(Array.isArray(r))return r.find(s=>!!s&&typeof s=="object"&&s.id===e)}function P(t,e){return f(t,e)}class ce{raw;synthesizedValue;store;fileHistory;unsubscribeHistory;constructor(e,r,s){this.raw=e,this.synthesizedValue=r,this.store=s;const o=s.projectHistory;this.fileHistory=o?C(o,b(),"project-manifest"):null,this.unsubscribeHistory=this.fileHistory?this.fileHistory.subscribeAll(n=>{n==="vgai.project.json"&&b().readBytes(n).then(a=>JSON.parse(new TextDecoder().decode(a))).then(a=>{for(const i of Object.keys(this.raw))delete this.raw[i];Object.assign(this.raw,a),this.store.notifyIngestEdit()}).catch(()=>{})}):null}getGameName(){const e=this.raw.name;return typeof e=="string"?e:""}get synthesized(){return this.synthesizedValue}setGameName(e){this.raw.name=e,this.persist("Rename Game")}getRootContentSource(e){const r=f(this.raw,e);if(!r)return;const s=r.scene;if(typeof s=="string")return`Scene · ${s}`;const o=r.entry;return typeof o=="string"?`Entry · ${o}`:"Adapter-owned runtime content"}getRootZOrder(e){const r=f(this.raw,e)?.zOrder;return typeof r=="number"?r:0}setRootZOrder(e,r){const s=P(this.raw,e);s&&(s.zOrder=r,this.persist("Change World Order"))}getRootPausable(e){const r=f(this.raw,e)?.pausable;return typeof r=="boolean"?r:!0}setRootPausable(e,r){const s=P(this.raw,e);s&&(s.pausable=r,this.persist("Change World Pausing"))}async materialize(){const e=await this.write("Create Game Manifest");return e&&(this.synthesizedValue=!1),e}dispose(){this.unsubscribeHistory?.()}persist(e){this.synthesized||this.write(e)}async write(e){const r=JSON.stringify(this.raw,null,2);try{if(this.fileHistory)return await this.fileHistory.write("vgai.project.json",r,{label:e,kind:"manifest",contentType:"application/json"}),this.store.notifyIngestEdit(),!0;const s=async()=>{const o=await fetch("/__editor/manifest",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:"vgai.project.json",content:r,...B()})});T(o,"Write vgai.project.json failed"),o.ok||await $(o,{label:"Write vgai.project.json",attempted:{"vgai.project.json":r},reapply:s})};return await s(),this.store.notifyIngestEdit(),!0}catch(s){return this.fileHistory&&b().readBytes("vgai.project.json").then(o=>JSON.parse(new TextDecoder().decode(o))).then(o=>{for(const n of Object.keys(this.raw))delete this.raw[n];Object.assign(this.raw,o),this.store.notifyIngestEdit()}).catch(()=>{}),u.error(`Failed to write vgai.project.json: ${s}`,"project"),!1}}}let j=null;function ue(t,e,r){const s=D(e).map(i=>{const g=i.zOrder??0,O=N(i.surface);if(O)return{worldId:i.id,kind:i.surface,adapter:O(t,i.id),zOrder:g};const k=de(i),z={id:i.id,kind:i.surface,adapter:i.adapter,entryOrScenePath:i.scene??i.entry,zOrder:g,pausable:i.pausable??!0};return{worldId:i.id,kind:i.surface,adapter:new te(t,z,k??void 0),zOrder:g}}),o=r&&s.length>=1?new ce(r.raw,r.synthesized,t):void 0;j=o??null;const n=F(x()?.config),a=new H(s,o,n);if(s.length>=1){if(R()&&!G())return u.warn("Edit-mode authoring not installed: a foreign session (ingest/play) owns the authoring override.","authoring"),a;W(a),p(a),t.notifyIngestEdit()}else if(!R()){const i=L(t,"No world yet","Declare a root in vgai.project.json");M(i),p(i),t.notifyIngestEdit()}return a}function h(t){t&&E()===t&&p(null);const e=V();e&&E()===e&&p(null),M(null),j?.dispose(),j=null}async function le(t){const e=Y(t);let r,s;try{const o=await _(),n=o!==null&&ae(o);if(n)r=n,s={raw:o,synthesized:!1};else throw new Error("manifest has no `roots` array (zero roots is fine; a missing field is not)")}catch(o){const n=o instanceof Error?o.message:String(o);u.error(`Failed to load vgai.project.json: ${n}`,"project"),r={roots:[{id:"manifest",surface:re,adapter:n}]}}try{return ue(t,r,s)}finally{e()}}class he{constructor(e){this.store=e,this.unbind=se(()=>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?.(),h(this.composite),A.delete(this.store))}}attach(e){const r=this.retain();return this.stages.add(e),{ready:this.composite?e(this.composite):this.tail,dispose:()=>{this.stages.delete(e),r()}}}rebuild(){const e=this.tail.then(async()=>{if(this.disposed)return;const r=Q(),s=new Set(J().map(i=>i.descriptor.id)),o=this.composite?K().map(i=>i.descriptor.id).filter(i=>s.has(i)):[];this.disposeDocuments?.(),this.disposeDocuments=void 0,h(this.composite),this.composite=void 0;const n=await le(this.store);if(this.disposed){h(n);return}const{installRootDocuments:a}=await U(async()=>{const{installRootDocuments:i}=await import("./world-documents-B5IWN-ng.js");return{installRootDocuments:i}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]));if(this.disposed){h(n);return}this.composite=n,this.disposeDocuments=a(this.store,n);for(const i of o)Z(i,i===r);await Promise.all([...this.stages].map(i=>i(n)))});return this.tail=e.catch(()=>{}),e}}const A=new Map;function fe(t){let e=A.get(t);return e||(e=new he(t),A.set(t,e)),e}function pe(t){const e=fe(t);return{ready:e.ready.then(()=>q()),dispose:e.retain()}}function ye({store:t}){return I.useEffect(()=>{const e=pe(t);return e.ready.catch(r=>{u.error(`Authoring session failed: ${r instanceof Error?r.message:String(r)}`,"authoring")}),e.dispose},[t]),null}const we=Object.freeze(Object.defineProperty({__proto__:null,ProjectAuthoringBootstrap:ye},Symbol.toStringTag,{value:"Module"}));export{te as B,re as I,we as N,me as q};
@@ -0,0 +1,5 @@
1
+ import{aT as N,aU as H,C as R,f as T,G as k,B as P,F as w,a1 as C,b5 as U,b4 as L,cH as J,a0 as B,b9 as F,c as D,V}from"./three.module-CrYDk-Xr.js";const q=/^[og]\s*(.+)?/,W=/^mtllib /,K=/^usemtl /,Q=/^usemap /,G=/\s+/,S=new V,z=new V,E=new V,O=new V,j=new V,_=new R;function X(){const I={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(s,e){if(this.object&&this.object.fromDeclaration===!1){this.object.name=s,this.object.fromDeclaration=e!==!1;return}const n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:s||"",fromDeclaration:e!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(t,i){const a=this._finalize(!1);a&&(a.inherited||a.groupCount<=0)&&this.materials.splice(a.index,1);const d={index:this.materials.length,name:t||"",mtllib:Array.isArray(i)&&i.length>0?i[i.length-1]:"",smooth:a!==void 0?a.smooth:this.smooth,groupStart:a!==void 0?a.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(g){const r={index:typeof g=="number"?g:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return r.clone=this.clone.bind(r),r}};return this.materials.push(d),d},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(t){const i=this.currentMaterial();if(i&&i.groupEnd===-1&&(i.groupEnd=this.geometry.vertices.length/3,i.groupCount=i.groupEnd-i.groupStart,i.inherited=!1),t&&this.materials.length>1)for(let a=this.materials.length-1;a>=0;a--)this.materials[a].groupCount<=0&&this.materials.splice(a,1);return t&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),i}},n&&n.name&&typeof n.clone=="function"){const t=n.clone(0);t.inherited=!0,this.object.materials.push(t)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(s,e){const n=parseInt(s,10);return(n>=0?n-1:n+e/3)*3},parseNormalIndex:function(s,e){const n=parseInt(s,10);return(n>=0?n-1:n+e/3)*3},parseUVIndex:function(s,e){const n=parseInt(s,10);return(n>=0?n-1:n+e/2)*2},addVertex:function(s,e,n){const t=this.vertices,i=this.object.geometry.vertices;i.push(t[s+0],t[s+1],t[s+2]),i.push(t[e+0],t[e+1],t[e+2]),i.push(t[n+0],t[n+1],t[n+2])},addVertexPoint:function(s){const e=this.vertices;this.object.geometry.vertices.push(e[s+0],e[s+1],e[s+2])},addVertexLine:function(s){const e=this.vertices;this.object.geometry.vertices.push(e[s+0],e[s+1],e[s+2])},addNormal:function(s,e,n){const t=this.normals,i=this.object.geometry.normals;i.push(t[s+0],t[s+1],t[s+2]),i.push(t[e+0],t[e+1],t[e+2]),i.push(t[n+0],t[n+1],t[n+2])},addFaceNormal:function(s,e,n){const t=this.vertices,i=this.object.geometry.normals;S.fromArray(t,s),z.fromArray(t,e),E.fromArray(t,n),j.subVectors(E,z),O.subVectors(S,z),j.cross(O),j.normalize(),i.push(j.x,j.y,j.z),i.push(j.x,j.y,j.z),i.push(j.x,j.y,j.z)},addColor:function(s,e,n){const t=this.colors,i=this.object.geometry.colors;t[s]!==void 0&&i.push(t[s+0],t[s+1],t[s+2]),t[e]!==void 0&&i.push(t[e+0],t[e+1],t[e+2]),t[n]!==void 0&&i.push(t[n+0],t[n+1],t[n+2])},addUV:function(s,e,n){const t=this.uvs,i=this.object.geometry.uvs;i.push(t[s+0],t[s+1]),i.push(t[e+0],t[e+1]),i.push(t[n+0],t[n+1])},addDefaultUV:function(){const s=this.object.geometry.uvs;s.push(0,0),s.push(0,0),s.push(0,0)},addUVLine:function(s){const e=this.uvs;this.object.geometry.uvs.push(e[s+0],e[s+1])},addFace:function(s,e,n,t,i,a,d,g,r){const h=this.vertices.length;let o=this.parseVertexIndex(s,h),l=this.parseVertexIndex(e,h),u=this.parseVertexIndex(n,h);if(this.addVertex(o,l,u),this.addColor(o,l,u),d!==void 0&&d!==""){const m=this.normals.length;o=this.parseNormalIndex(d,m),l=this.parseNormalIndex(g,m),u=this.parseNormalIndex(r,m),this.addNormal(o,l,u)}else this.addFaceNormal(o,l,u);if(t!==void 0&&t!==""){const m=this.uvs.length;o=this.parseUVIndex(t,m),l=this.parseUVIndex(i,m),u=this.parseUVIndex(a,m),this.addUV(o,l,u),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(s){this.object.geometry.type="Points";const e=this.vertices.length;for(let n=0,t=s.length;n<t;n++){const i=this.parseVertexIndex(s[n],e);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(s,e){this.object.geometry.type="Line";const n=this.vertices.length,t=this.uvs.length;for(let i=0,a=s.length;i<a;i++)this.addVertexLine(this.parseVertexIndex(s[i],n));for(let i=0,a=e.length;i<a;i++)this.addUVLine(this.parseUVIndex(e[i],t))}};return I.startObject("",!1),I}class Z extends N{constructor(s){super(s),this.materials=null}load(s,e,n,t){const i=this,a=new H(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(s,function(d){try{e(i.parse(d))}catch(g){t?t(g):console.error(g),i.manager.itemError(s)}},n,t)}setMaterials(s){return this.materials=s,this}parse(s){const e=new X;s.indexOf(`\r
2
+ `)!==-1&&(s=s.replace(/\r\n/g,`
3
+ `)),s.indexOf(`\\
4
+ `)!==-1&&(s=s.replace(/\\\n/g,""));const n=s.split(`
5
+ `);let t=[];for(let d=0,g=n.length;d<g;d++){const r=n[d].trimStart();if(r.length===0)continue;const h=r.charAt(0);if(h!=="#")if(h==="v"){const o=r.split(G);switch(o[0]){case"v":e.vertices.push(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3])),o.length>=7?(_.setRGB(parseFloat(o[4]),parseFloat(o[5]),parseFloat(o[6]),T),e.colors.push(_.r,_.g,_.b)):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]));break;case"vt":e.uvs.push(parseFloat(o[1]),parseFloat(o[2]));break}}else if(h==="f"){const l=r.slice(1).trim().split(G),u=[];for(let c=0,p=l.length;c<p;c++){const b=l[c];if(b.length>0){const v=b.split("/");u.push(v)}}const m=u[0];for(let c=1,p=u.length-1;c<p;c++){const b=u[c],v=u[c+1];e.addFace(m[0],b[0],v[0],m[1],b[1],v[1],m[2],b[2],v[2])}}else if(h==="l"){const o=r.substring(1).trim().split(" ");let l=[];const u=[];if(r.indexOf("/")===-1)l=o;else for(let m=0,c=o.length;m<c;m++){const p=o[m].split("/");p[0]!==""&&l.push(p[0]),p[1]!==""&&u.push(p[1])}e.addLineGeometry(l,u)}else if(h==="p"){const l=r.slice(1).trim().split(" ");e.addPointGeometry(l)}else if((t=q.exec(r))!==null){const o=(" "+t[0].slice(1).trim()).slice(1);e.startObject(o)}else if(K.test(r))e.object.startMaterial(r.substring(7).trim(),e.materialLibraries);else if(W.test(r))e.materialLibraries.push(r.substring(7).trim());else if(Q.test(r))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(h==="s"){if(t=r.split(" "),t.length>1){const l=t[1].trim().toLowerCase();e.object.smooth=l!=="0"&&l!=="off"}else e.object.smooth=!0;const o=e.object.currentMaterial();o&&(o.smooth=e.object.smooth)}else{if(r==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+r+'"')}}e.finalize();const i=new k;if(i.materialLibraries=[].concat(e.materialLibraries),!(e.objects.length===1&&e.objects[0].geometry.vertices.length===0)===!0)for(let d=0,g=e.objects.length;d<g;d++){const r=e.objects[d],h=r.geometry,o=r.materials,l=h.type==="Line",u=h.type==="Points";let m=!1;if(h.vertices.length===0)continue;const c=new P;c.setAttribute("position",new w(h.vertices,3)),h.normals.length>0&&c.setAttribute("normal",new w(h.normals,3)),h.colors.length>0&&(m=!0,c.setAttribute("color",new w(h.colors,3))),h.hasUVIndices===!0&&c.setAttribute("uv",new w(h.uvs,2));const p=[];for(let v=0,M=o.length;v<M;v++){const y=o[v],A=y.name+"_"+y.smooth+"_"+m;let f=e.materials[A];if(this.materials!==null){if(f=this.materials.create(y.name),l&&f&&!(f instanceof C)){const x=new C;U.prototype.copy.call(x,f),x.color.copy(f.color),f=x}else if(u&&f&&!(f instanceof L)){const x=new L({size:10,sizeAttenuation:!1});U.prototype.copy.call(x,f),x.color.copy(f.color),x.map=f.map,f=x}}f===void 0&&(l?f=new C:u?f=new L({size:1,sizeAttenuation:!1}):f=new J,f.name=y.name,f.flatShading=!y.smooth,f.vertexColors=m,e.materials[A]=f),p.push(f)}let b;if(p.length>1){for(let v=0,M=o.length;v<M;v++){const y=o[v];c.addGroup(y.groupStart,y.groupCount,v)}l?b=new B(c,p):u?b=new F(c,p):b=new D(c,p)}else l?b=new B(c,p[0]):u?b=new F(c,p[0]):b=new D(c,p[0]);b.name=r.name,i.add(b)}else if(e.vertices.length>0){const d=new L({size:1,sizeAttenuation:!1}),g=new P;g.setAttribute("position",new w(e.vertices,3)),e.colors.length>0&&e.colors[0]!==void 0&&(g.setAttribute("color",new w(e.colors,3)),d.vertexColors=!0);const r=new F(g,d);i.add(r)}return i}}export{Z as OBJLoader};
@@ -0,0 +1 @@
1
+ import{j as s}from"./jsx-runtime-CAUTK36e.js";import{cX as ee,cY as N,cZ as se,c_ as z,c$ as ae,s as ie,c9 as L,v as $,R as te,S as re,D as S,cq as oe,E as A,b$ as v,am as f,an as n,d0 as ne,aS as B,d1 as le,c0 as ce,A as F,M as d,c as W,bb as de,d2 as pe,d3 as ue,d4 as U,ba as G,d5 as me,d6 as he,cs as H,ap as ge,ak as _,a8 as ve,T as K,d7 as be,c1 as xe,d8 as je,c3 as we,d9 as Se,cE as fe}from"./index-Dm_h-T4x.js";import{r as t}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{D as ye,F as q,G as Ce,R as ke,S as Ee}from"./three-integration.service-0EyPpd5f.js";import{s as Pe}from"./model-inspection-DDZE59vp.js";import{d as Ve}from"./viewport-door-BdL0u5rd.js";import{v as X,V as Me,a as De,p as Te,b as Oe,c as Re}from"./ViewportShadingMenu-CVU2bU_3.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-jib6KJY8.js";import"./client-mkWk8S65.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./content-bounds-_QWiKD5_.js";import"./three.module-CrYDk-Xr.js";import"./layered-pick-CT4HlEpW.js";import"./bitmap-label-Ct4k6ehY.js";const Y=()=>()=>{},b=()=>0,Ne=[{key:"skeletons",label:"Bones"},{key:"weights",label:"Weights"},{key:"cursor",label:"3D Cursor"},{key:"cameras",label:"Cameras"},{key:"lights",label:"Lights"},{key:"empties",label:"Empties"}];function Qe({documentId:i,assetPath:p}){t.useSyncExternalStore(ye,q,q);const a=Ce(i);t.useSyncExternalStore(ee,N,N),t.useSyncExternalStore(a?.subscribe??Y,a?.getSnapshot??b,a?.getSnapshot??b),t.useSyncExternalStore(se,z,z);const l=ae(i);t.useSyncExternalStore(l?.subscribe??Y,l?.getSnapshot??b,l?.getSnapshot??b);const Z=Ve(i),[y,C]=t.useState(null),[k,h]=t.useState(null),[E,g]=t.useState(!1),[P,c]=t.useState(!1),V=t.useRef(null),M=t.useRef(null);if(t.useSyncExternalStore(ie,L,L),!a)return null;const r=a.presentation(),{lighting:u}=$(i),m=te(i),D=m?re(m.stageKind):null,J=m?.documentLayer?.all?.lighting?.studioPreset===S.id||D?.all?.lighting?.studioPreset===S.id,x=m?oe(m.stageKind):!1,T=e=>x?{modes:{[$(i).drawMode]:{lighting:e}}}:{all:{lighting:e}},j=new Set(Object.entries(D?.modes??{}).filter(([,e])=>e?.lighting!==void 0).map(([e])=>e)),w=new Set(Pe(a.root).filter(e=>e.available).map(e=>e.mode)),Q=[...x?X.map(e=>e.mode==="solid"?{...e,label:"Solid",description:"Materials' colours under the studio lights"}:e.mode==="clay"?{...e,label:"Clay"}:e):X,...j.has("preview")?[{mode:"preview",label:"Material Preview",description:"Materials lit by a preview environment"}]:[],...j.has("rendered")?[{mode:"rendered",label:"Rendered",description:"Lit as a render is, by the scene's own lights"}]:[],...w.has("uv")?[{mode:"uv",label:"UV",description:"UV coordinates as surface color"}]:[],...w.has("vertex-colors")?[{mode:"vertex-colors",label:"Vertex colors",description:"Authored color attributes without textures"}]:[]],O=async e=>{if(p){h(null);try{await fe().saveThumbnailFraming(p,e?void 0:a.cameraPose())}catch(o){h(o instanceof Error?o.message:String(o))}}},I=async()=>{h(null);try{const e={background:r.background},o=p?.toLowerCase().endsWith(".spz")?await ke(p,e):Ee(a.root,e);C(`data:image/png;base64,${o.contactSheet.base64}`)}catch(e){h(e instanceof Error?e.message:String(e))}},R=a.selection().length>0?"Frame selection":"Frame all";return s.jsxs("div",{className:"vgai-model-document-header",children:[s.jsxs(A,{compact:!0,label:"Viewport view controls",className:"vgai-model-viewport-toolbar vgai-model-viewport-toolbar--view",children:[s.jsx(v,{text:R,children:s.jsx(f,{"aria-label":R,onClick:()=>a.frame(),children:s.jsx(n,{icon:ne,size:"md"})})}),s.jsxs("div",{className:"vgai-viewport-popover-anchor",children:[s.jsx(v,{text:"Camera orientation and projection",children:s.jsxs(B,{ref:V,type:"button",size:"compact",variant:"secondary","aria-label":`Camera view: ${r.projection}`,"aria-haspopup":"menu","aria-expanded":E,onClick:()=>g(e=>!e),className:"vgai-model-toolbar-labelled-control",children:[s.jsx(n,{icon:le,size:"sm"}),s.jsx("span",{children:r.projection==="perspective"?"Perspective":"Orthographic"}),s.jsx(n,{icon:ce,size:"xs"})]})}),E&&s.jsxs(F,{anchorRef:V,align:"start",clamp:!0,"aria-label":"Camera view",onDismiss:()=>g(!1),style:{minWidth:210},children:[["front","right","top","isometric"].map(e=>s.jsx(d,{onSelect:()=>{a.setViewPreset(e,"view"),g(!1)},children:e==="isometric"?"Perspective 3/4":`${e[0]?.toUpperCase()}${e.slice(1)} view`},e)),s.jsx(W,{}),["perspective","orthographic"].map(e=>s.jsxs(d,{role:"menuitemradio","aria-checked":r.projection===e,onSelect:()=>{a.setProjection(e),g(!1)},children:[s.jsx("span",{className:"vgai-menu-check",children:r.projection===e&&s.jsx(n,{icon:de,size:"xs"})}),e==="perspective"?"Perspective":"Orthographic"]},e))]})]}),w.has("skeleton")?s.jsx(v,{text:`Rig: ${r.skeleton?"Visible":"Hidden"}`,children:s.jsx(f,{"aria-label":"Toggle rig overlay","aria-pressed":r.skeleton,onClick:()=>a.setSkeleton(!r.skeleton),children:s.jsx(n,{icon:pe,size:"md"})})}):null,ue("object3d-document").map(({id:e,Component:o})=>s.jsx(o,{documentId:i},e))]}),s.jsxs(A,{compact:!0,label:"Viewport preview controls",className:"vgai-model-viewport-toolbar vgai-model-viewport-toolbar--preview",children:[s.jsxs(Me,{mode:r.mode,onChange:e=>a.setMode(e),choices:Q,segments:x?Te(j):De,children:[U().length>0?s.jsxs("label",{children:[s.jsx("span",{children:"View"}),s.jsxs(G,{"aria-label":"View preset",value:"",onChange:e=>{e.target.value&&me(i,e.target.value)},children:[s.jsx("option",{value:"",children:"Choose…"}),U().map(e=>s.jsx("option",{value:e.id,children:e.title},e.id))]})]}):null,s.jsxs("label",{children:[s.jsx("span",{children:"Lighting"}),s.jsxs(G,{"aria-label":"Lighting",value:u.source==="studio"?`studio:${u.studioPreset}`:u.source,onChange:e=>{const o=e.target.value;H(i,T(o.startsWith("studio:")?{source:"studio",studioPreset:o.slice(7)}:{source:o}))},children:[he().filter(e=>e.id!==S.id||J).map(e=>s.jsx("option",{value:`studio:${e.id}`,children:e.title},e.id)),s.jsx("option",{value:"scene",children:"Scene lights"})]})]}),s.jsxs("label",{children:[s.jsx("span",{children:"Exposure"}),s.jsx(ge,{"aria-label":"Preview exposure",type:"range",min:"0.2",max:"2",step:"0.1",value:u.tone.exposure,onChange:e=>H(i,T({tone:{exposure:Number(e.target.value)}}))}),s.jsx(_,{as:"span",variant:"caption",children:u.tone.exposure.toFixed(1)})]})]}),s.jsx(Oe,{glyph:s.jsx(Re,{}),choices:[{id:"grid",label:"Grid",enabled:K(i),onToggle:()=>ve(i,!K(i))},{id:"bounds",label:"Bounds",enabled:r.bounds,onToggle:()=>a.setBounds(!r.bounds)},...l===null?[]:Ne.filter(e=>Z.includes(e.key)).map(e=>({id:e.key,label:e.label,enabled:l.helperVisibility[e.key],onToggle:()=>l.toggleHelperType(e.key)}))]}),s.jsxs("div",{className:"vgai-viewport-popover-anchor",children:[s.jsx(v,{text:"Asset preview actions",children:s.jsx(f,{ref:M,"aria-label":"Asset preview actions","aria-haspopup":"menu","aria-expanded":P,onClick:()=>c(e=>!e),children:s.jsx(n,{icon:be,size:"md"})})}),P&&s.jsxs(F,{anchorRef:M,clamp:!0,"aria-label":"Asset preview actions",onDismiss:()=>c(!1),style:{minWidth:210},children:[s.jsxs(d,{onSelect:()=>{c(!1),I()},children:[s.jsx(n,{icon:xe,size:"sm"}),"Capture preview"]}),p?s.jsxs(s.Fragment,{children:[s.jsx(d,{onSelect:()=>{c(!1),O(!1)},children:"Save thumbnail framing"}),s.jsx(d,{onSelect:()=>{c(!1),O(!0)},children:"Reset thumbnail framing"})]}):null,s.jsx(W,{}),s.jsxs(d,{onSelect:()=>{a.resetPresentation(),c(!1)},children:[s.jsx(n,{icon:je,size:"sm"}),"Reset viewport settings"]})]})]})]}),y?s.jsxs(we,{className:"vgai-model-capture-preview",children:[s.jsxs("div",{children:[s.jsx(_,{as:"strong",variant:"label",children:"Deterministic views"}),s.jsx(B,{type:"button",variant:"ghost",onClick:()=>C(null),children:"Close"})]}),s.jsx("img",{src:y,alt:"Front, right, top, and three-quarter model preview"})]}):null,k?s.jsx(Se,{className:"vgai-model-toolbar-error",tone:"error",children:k}):null]})}export{Qe as Object3DDocumentToolbar};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/spark.module-DMQ9J7rT.js","assets/three.module-CrYDk-Xr.js","assets/content-bounds-_QWiKD5_.js"])))=>i.map(i=>d[i]);
2
+ import{bC as te,al as A,i as re}from"./index-Dm_h-T4x.js";import{j as C}from"./jsx-runtime-CAUTK36e.js";import{r as E}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-jib6KJY8.js";import{aB as ne,Y as ie,P as oe,f as se,aJ as ae,bH as le,D as ce,bI as de,bJ as pe,bD as me,V as ue,an as fe}from"./three.module-CrYDk-Xr.js";import{O as we}from"./OrbitControls-smIenN60.js";import{c as be,m as he,l as ge,a as ve,b as xe,d as Y,h as ye,e as Ae,f as Ce,g as Ee}from"./three-integration.service-0EyPpd5f.js";import{s as Me,i as D}from"./editor-presentation-activity-C7SNSmTd.js";import"./client-mkWk8S65.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./content-bounds-_QWiKD5_.js";import"./layered-pick-CT4HlEpW.js";import"./viewport-door-BdL0u5rd.js";import"./bitmap-label-Ct4k6ehY.js";const v={webglContext:0,animationFrame:0,resizeObserver:0,objectUrl:0},K={...v};function F(r){v[r]++,K[r]=Math.max(K[r],v[r]);let s=!1;return()=>{s||(s=!0,v[r]=Math.max(0,v[r]-1))}}function Se(r){const s=r.animations[0];if(!s)return null;const m=new fe(r),b=m.clipAction(s).play();return b.paused=!0,m.update(0),m}let je=0;function Ge({assetPath:r,materialPath:s,displayName:m="Object3D preview",active:b=!0,sourceFactory:M,showSkeleton:_=!1,background:z,cameraDirection:S,showGrid:H=!0,useDefaultLighting:L=!0,exposure:T=1,setupPreview:k}){const W=E.useRef(null),[j,q]=E.useState(null),[I,R]=E.useState(!0);return E.useEffect(()=>{if(!b)return;const o=W.current;if(!o)return;const x=new AbortController,N=te({id:`preview-card:${++je}`,label:`${m} (preview card)`,contentClock:()=>0}),t=new ne({antialias:!0,alpha:!0}),Q=F("webglContext"),X=F("animationFrame"),Z=F("resizeObserver"),a=new ie,u=new oe(35,1,.01,1e3),f=new we(u,t.domElement),V=new pe;let $=null,w=null,y=null,c,l=null,h=null;const O=[];let d=0,p=!1;if(q(null),R(!0),t.outputColorSpace=se,t.toneMapping=ae,t.toneMappingExposure=T,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){a.add(new le(16777215,3489874,1.8));const e=new ce(16777215,2.2);e.position.set(3,5,4),a.add(e)}if(H){const e=new de(10,20,5333103,3423044);a.add(e),O.push(e)}const U=(e,n)=>{if(!h)return;const i=S?new ue(...S):void 0,g=Ce(h,Math.max(e,1)/Math.max(n,1),i);u.copy(g,!1),f.target.copy(h.center),f.update()},B=async e=>{if(p)return;a.add(e);let n=!1;if(e.traverse(i=>{ye(i,"gaussianSplat")&&(n=!0)}),n){const{SparkRenderer:i}=await re(async()=>{const{SparkRenderer:g}=await import("./spark.module-DMQ9J7rT.js");return{SparkRenderer:g}},__vite__mapDeps([0,1,2]));if(p)return;l=new i({renderer:t,enableLod:!1})}if(h=Ae(e,"perspective"),U(o.clientWidth,o.clientHeight),$=Se(e),_){const i=new me(e);i.name="__compact_preview_skeleton",a.add(i),O.push(i)}c=k?.({scene:a,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(M){y=be(M),await B(y.root);return}if(!r)throw new Error("Compact Object3D preview has no source.");const e=he(r);if(!e)throw new Error(`No native Three.js loader supports ${r}.`);const n=e==="glb"||e==="gltf"||e==="spz"?await ge(r,x.signal):await ve({url:r,format:e,...s?{materialUrl:s}:{}});if(w=xe(n),x.signal.aborted||p){Y(w),w=null;return}await B(w)}catch(e){!x.signal.aborted&&!p&&(q(e instanceof Error?e.message:String(e)),R(!1))}})();const G=()=>{const e=Math.max(o.clientWidth,1),n=Math.max(o.clientHeight,1);t.setSize(e,n,!1),h&&!c?U(e,n):(u.aspect=e/n,u.updateProjectionMatrix()),c?.resize?.(e,n,t.getPixelRatio())},J=new ResizeObserver(G);J.observe(o),G();const P=()=>{if(d=0,p||!D())return;const e=Math.min(V.getDelta(),.1);f.update(),l&&a.add(l);try{c?.render?c.render(e):t.render(a,u)}finally{l?.removeFromParent()}d=requestAnimationFrame(P)},ee=Me(()=>{D()?!p&&d===0&&(V.getDelta(),P()):(cancelAnimationFrame(d),d=0)});return D()&&(d=requestAnimationFrame(P)),()=>{p=!0,ee(),N(),x.abort(new Error("Compact Object3D preview closed.")),cancelAnimationFrame(d),J.disconnect(),$?.stopAllAction(),c?.dispose(),f.dispose(),l&&(l.removeFromParent(),Ee(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 g of i)g.dispose();else i?.dispose()}y&&y.dispose(),w&&Y(w),o.contains(t.domElement)&&o.removeChild(t.domElement),Z(),X(),Q()}},[b,r,z,S,T,s,k,H,_,M,L]),C.jsxs("div",{ref:W,"data-testid":"object3d-compact-preview",role:"region","aria-label":`Interactive 3D preview: ${m}`,"aria-busy":I,style:{width:"100%",height:"100%",minHeight:220,overflow:"hidden",position:"relative",background:A.surface.inset},children:[I&&!j?C.jsx("span",{style:{position:"absolute",padding:10,color:A.content.muted},children:"Loading…"}):null,b?null:C.jsx("span",{style:{position:"absolute",padding:10,color:A.content.muted},children:"Preview suspended while inactive."}),j?C.jsx("div",{role:"alert",style:{position:"absolute",padding:10,color:A.semantic.danger},children:j}):null]})}export{Ge as Object3DPreview};
@@ -0,0 +1 @@
1
+ import{j as t}from"./jsx-runtime-CAUTK36e.js";import{b3 as L,b4 as U,b5 as R,b6 as W,b7 as M,al as i,an as j,b8 as w,b9 as N,aV as C,ba as V,aS as J,bb as _,bc as G}from"./index-Dm_h-T4x.js";import{r}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{d as K}from"./asset-editor-persistence-BtRQI8t6.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-jib6KJY8.js";import"./client-mkWk8S65.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";const S=new Map,q=new Set;function I(){for(const e of q)e()}function Q(e,l){const n=S.get(e);if(n?.status==="running")return n;const f={id:e,label:l,stage:"fetch",loaded:0,total:0,status:"running",controller:new AbortController};return S.set(e,f),I(),f}function y(e,l){const n=S.get(e);n&&(Object.assign(n,l),I())}const 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 ce({online:e,mode:l="full",showPreview:n=!1,onResolved:f}){const[h,z]=r.useState([]),[o,A]=r.useState(null),[$,v]=r.useState(!0),[B,D]=r.useState(null),[m,F]=r.useState(null),[O,p]=r.useState(!1),[T,x]=r.useState(!1),[b,E]=r.useState(!1),[c,g]=r.useState("idle");r.useEffect(()=>{if(l==="preview"){v(!1);return}let s=!1;return v(!0),D(null),L(e.source,e.id).then(a=>{s||(z(a),a.length>0&&A(a[0]))}).catch(a=>{s||(z([]),D(a instanceof U?R(a.code):a instanceof Error?a.message:"Asset delivery metadata is unavailable while offline."))}).finally(()=>{s||v(!1)}),()=>{s=!0}},[l,e.source,e.id]);const P=e.source==="local"&&(e.type==="model"||e.type==="animation"||e.type==="source");r.useEffect(()=>{if(l==="inspector"&&!n){p(!1);return}let s=!1;if(F(null),x(!1),E(!1),!P){p(!1);return}return p(!0),W(e.source,e.id).then(a=>{s||(F(a),x(!a))}).catch(()=>{s||x(!0)}).finally(()=>{s||p(!1)}),()=>{s=!0}},[l,e.id,e.source,n,P]);const H=r.useCallback(async()=>{if(!o)return;const s=`single:${e.source}:${e.id}`,a=Q(s,e.name);y(s,{stage:"fetch",loaded:0,total:o.sizeBytes??0,status:"running"}),g("downloading");try{const d={source:e.source,id:e.id,name:e.name,url:o.url,format:o.format,jobId:s,signal:a.controller.signal};o.includes&&(d.includes=o.includes);const u=await K(d);u.ok&&u.path?(y(s,{stage:"commit",loaded:o.sizeBytes??1,total:o.sizeBytes??1,status:u.alreadyExists?"skipped":"imported",message:u.path}),g("done"),M(`${e.name} added to Content — drag it from there into the viewport to place it.`),f?.(`/${u.path}`)):(y(s,{status:"failed",message:u.error??"The import was rejected."}),g("error"))}catch(d){y(s,{status:a.controller.signal.aborted?"cancelled":"failed",message:d instanceof Error?d.message:String(d)}),g("error")}},[e,o,f]),k=t.jsx("img",{src:b?"/__editor/asset-library/local-placeholder.svg":e.thumbnailUrl,alt:b?`${e.name} preview unavailable`:e.name,onError:()=>E(!0),style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}});return t.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[l!=="preview"&&t.jsx("div",{style:{fontWeight:600,fontSize:12,color:i.content.primary,wordBreak:"break-all"},children:e.name}),(l!=="inspector"||n)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{width:"100%",height:"100%",minHeight:l==="inspector"?160:240,background:i.surface.shell,borderRadius:i.shape.small,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},children:O?t.jsxs("div",{style:{color:i.content.muted,fontSize:11},children:[t.jsx(j,{icon:w,spin:!0,style:{marginRight:5}}),"Loading Asset Editor preview…"]}):m?t.jsx(r.Suspense,{fallback:t.jsx("span",{style:{color:i.content.muted},children:"Loading preview…"}),children:t.jsx(N,{route:"model-preview",documentId:"",assetPath:m.path,...m.materialPath?{materialPath:m.materialPath}:{},displayName:e.name,active:!0,whenUnregistered:k})}):k}),b&&t.jsx("div",{role:"status",style:{color:i.content.dim,fontSize:10},children:"The catalog preview could not be loaded; showing the typed fallback."}),T&&t.jsx("div",{style:{color:i.content.dim,fontSize:10},children:"Interactive preview is unavailable for this variant; showing its catalog thumbnail."})]}),l!=="preview"&&t.jsxs(t.Fragment,{children:[t.jsx(C,{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:i.content.dim,marginBottom:2},children:"Source"}),t.jsx("div",{style:{fontSize:11,color:i.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:i.content.dim,marginBottom:2},children:"Type"}),t.jsx("div",{style:{fontSize:11,color:i.content.primary},children:e.type})]}),e.tags.length>0&&t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:i.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:i.surface.raised,borderRadius:i.shape.small,color:i.content.muted},children:s},s))})]}),e.author&&t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:i.content.dim,marginBottom:2},children:"Author"}),t.jsx("div",{style:{fontSize:11,color:i.content.primary},children:e.author})]})]})}),t.jsx(C,{label:"Add to Project",children:t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:$?t.jsxs("div",{style:{fontSize:11,color:i.content.dim},children:[t.jsx(j,{icon:w,spin:!0,style:{marginRight:4}}),"Loading options..."]}):B?t.jsxs("div",{role:"alert",style:{fontSize:11,color:i.content.muted},children:["Delivery unavailable: ",B]}):h.length>0?t.jsxs(t.Fragment,{children:[t.jsx(V,{"aria-label":"Asset delivery",value:o?h.indexOf(o):0,onChange:s=>A(h[Number(s.target.value)]??null),style:X,children:h.map((s,a)=>t.jsxs("option",{value:a,children:[s.label,s.sizeBytes?` (${Y(s.sizeBytes)})`:""]},a))}),t.jsxs(J,{type:"button",variant:c==="done"?"success":"primary",size:"comfortable",onClick:H,disabled:c==="downloading",style:{width:"100%"},children:[t.jsx(j,{icon:c==="done"?_:c==="downloading"?w:G,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:i.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:i.content.dim,padding:"4px 0"},children:["License: ",e.license??"CC0 (Public Domain)"]})]})]})}export{ce as OnlineAssetDetail};
@@ -0,0 +1 @@
1
+ import{bK as S,V as p,bL as u,bM as _,Q as E,bN as P,g as c,bO as w,s as O,j as R}from"./three.module-CrYDk-Xr.js";const D={type:"change"},b={type:"start"},M={type:"end"},f=new w,T=new O,j=Math.cos(70*R.DEG2RAD),n=new p,r=2*Math.PI,o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},y=1e-6;class X extends S{constructor(t,e=null){super(t,e),this.state=o.NONE,this.target=new p,this.cursor=new p,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:u.ROTATE,MIDDLE:u.DOLLY,RIGHT:u.PAN},this.touches={ONE:_.ROTATE,TWO:_.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new p,this._lastQuaternion=new E,this._lastTargetPosition=new p,this._quat=new E().setFromUnitVectors(t.up,new p(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new P,this._sphericalDelta=new P,this._scale=1,this._panOffset=new p,this._rotateStart=new c,this._rotateEnd=new c,this._rotateDelta=new c,this._panStart=new c,this._panEnd=new c,this._panDelta=new c,this._dollyStart=new c,this._dollyEnd=new c,this._dollyDelta=new c,this._dollyDirection=new p,this._mouse=new c,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=L.bind(this),this._onPointerDown=A.bind(this),this._onPointerUp=k.bind(this),this._onContextMenu=Z.bind(this),this._onMouseWheel=N.bind(this),this._onKeyDown=Y.bind(this),this._onTouchStart=I.bind(this),this._onTouchMove=U.bind(this),this._onMouseDown=x.bind(this),this._onMouseMove=C.bind(this),this._interceptControlDown=z.bind(this),this._interceptControlUp=K.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(t){super.connect(t),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=t}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(D),this.update(),this.state=o.NONE}update(t=null){const e=this.object.position;n.copy(e).sub(this.target),n.applyQuaternion(this._quat),this._spherical.setFromVector3(n),this.autoRotate&&this.state===o.NONE&&this._rotateLeft(this._getAutoRotationAngle(t)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let s=this.minAzimuthAngle,a=this.maxAzimuthAngle;isFinite(s)&&isFinite(a)&&(s<-Math.PI?s+=r:s>Math.PI&&(s-=r),a<-Math.PI?a+=r:a>Math.PI&&(a-=r),s<=a?this._spherical.theta=Math.max(s,Math.min(a,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(s+a)/2?Math.max(s,this._spherical.theta):Math.min(a,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let h=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const l=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),h=l!=this._spherical.radius}if(n.setFromSpherical(this._spherical),n.applyQuaternion(this._quatInverse),e.copy(this.target).add(n),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let l=null;if(this.object.isPerspectiveCamera){const d=n.length();l=this._clampDistance(d*this._scale);const m=d-l;this.object.position.addScaledVector(this._dollyDirection,m),this.object.updateMatrixWorld(),h=!!m}else if(this.object.isOrthographicCamera){const d=new p(this._mouse.x,this._mouse.y,0);d.unproject(this.object);const m=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),h=m!==this.object.zoom;const g=new p(this._mouse.x,this._mouse.y,0);g.unproject(this.object),this.object.position.sub(g).add(d),this.object.updateMatrixWorld(),l=n.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;l!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(l).add(this.object.position):(f.origin.copy(this.object.position),f.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(f.direction))<j?this.object.lookAt(this.target):(T.setFromNormalAndCoplanarPoint(this.object.up,this.target),f.intersectPlane(T,this.target))))}else if(this.object.isOrthographicCamera){const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),l!==this.object.zoom&&(this.object.updateProjectionMatrix(),h=!0)}return this._scale=1,this._performCursorZoom=!1,h||this._lastPosition.distanceToSquared(this.object.position)>y||8*(1-this._lastQuaternion.dot(this.object.quaternion))>y||this._lastTargetPosition.distanceToSquared(this.target)>y?(this.dispatchEvent(D),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?r/60*this.autoRotateSpeed*t:r/60/60*this.autoRotateSpeed}_getZoomScale(t){const e=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*e)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,e){n.setFromMatrixColumn(e,0),n.multiplyScalar(-t),this._panOffset.add(n)}_panUp(t,e){this.screenSpacePanning===!0?n.setFromMatrixColumn(e,1):(n.setFromMatrixColumn(e,0),n.crossVectors(this.object.up,n)),n.multiplyScalar(t),this._panOffset.add(n)}_pan(t,e){const s=this.domElement;if(this.object.isPerspectiveCamera){const a=this.object.position;n.copy(a).sub(this.target);let h=n.length();h*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*h/s.clientHeight,this.object.matrix),this._panUp(2*e*h/s.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/s.clientWidth,this.object.matrix),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/s.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,e){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const s=this.domElement.getBoundingClientRect(),a=t-s.left,h=e-s.top,l=s.width,d=s.height;this._mouse.x=a/l*2-1,this._mouse.y=-(h/d)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(r*this._rotateDelta.x/e.clientHeight),this._rotateUp(r*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let e=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(r*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),e=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-r*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),e=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(r*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),e=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-r*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),e=!0;break}e&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),s=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._rotateStart.set(s,a)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),s=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._panStart.set(s,a)}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),s=t.pageX-e.x,a=t.pageY-e.y,h=Math.sqrt(s*s+a*a);this._dollyStart.set(0,h)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const s=this._getSecondPointerPosition(t),a=.5*(t.pageX+s.x),h=.5*(t.pageY+s.y);this._rotateEnd.set(a,h)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(r*this._rotateDelta.x/e.clientHeight),this._rotateUp(r*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),s=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._panEnd.set(s,a)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const e=this._getSecondPointerPosition(t),s=t.pageX-e.x,a=t.pageY-e.y,h=Math.sqrt(s*s+a*a);this._dollyEnd.set(0,h),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const l=(t.pageX+e.x)*.5,d=(t.pageY+e.y)*.5;this._updateZoomParameters(l,d)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId){this._pointers.splice(e,1);return}}_isTrackingPointer(t){for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId)return!0;return!1}_trackPointer(t){let e=this._pointerPositions[t.pointerId];e===void 0&&(e=new c,this._pointerPositions[t.pointerId]=e),e.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const e=t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[e]}_customWheelEvent(t){const e=t.deltaMode,s={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(e){case 1:s.deltaY*=16;break;case 2:s.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(s.deltaY*=10),s}}function A(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i)))}function L(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function k(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(M),this.state=o.NONE;break;case 1:const t=this._pointers[0],e=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:e.x,pageY:e.y});break}}function x(i){let t;switch(i.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case u.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=o.DOLLY;break;case u.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=o.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=o.ROTATE}break;case u.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=o.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=o.PAN}break;default:this.state=o.NONE}this.state!==o.NONE&&this.dispatchEvent(b)}function C(i){switch(this.state){case o.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case o.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case o.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function N(i){this.enabled===!1||this.enableZoom===!1||this.state!==o.NONE||(i.preventDefault(),this.dispatchEvent(b),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(M))}function Y(i){this.enabled!==!1&&this._handleKeyDown(i)}function I(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case _.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=o.TOUCH_ROTATE;break;case _.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=o.TOUCH_PAN;break;default:this.state=o.NONE}break;case 2:switch(this.touches.TWO){case _.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=o.TOUCH_DOLLY_PAN;break;case _.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=o.TOUCH_DOLLY_ROTATE;break;default:this.state=o.NONE}break;default:this.state=o.NONE}this.state!==o.NONE&&this.dispatchEvent(b)}function U(i){switch(this._trackPointer(i),this.state){case o.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case o.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case o.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case o.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=o.NONE}}function Z(i){this.enabled!==!1&&i.preventDefault()}function z(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function K(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}export{X as O};
@@ -0,0 +1,2 @@
1
+ import{aT as M,aU as U,B as V,F as h,C as b,f as P}from"./three.module-CrYDk-Xr.js";const f=new b;class G extends M{constructor(u){super(u),this.propertyNameMapping={},this.customPropertyMapping={}}load(u,C,x,y){const R=this,d=new U(this.manager);d.setPath(this.path),d.setResponseType("arraybuffer"),d.setRequestHeader(this.requestHeader),d.setWithCredentials(this.withCredentials),d.load(u,function(B){try{C(R.parse(B))}catch(v){y?y(v):console.error(v),R.manager.itemError(u)}},x,y)}setPropertyNameMapping(u){this.propertyNameMapping=u}setCustomPropertyNameMapping(u){this.customPropertyMapping=u}parse(u){function C(e,n=0){const r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/;let t="";const s=r.exec(e);s!==null&&(t=s[1]);const o={comments:[],elements:[],headerLength:n,objInfo:""},i=t.split(/\r\n|\r|\n/);let a;function m(c,p){const l={type:c[0]};return l.type==="list"?(l.name=c[3],l.countType=c[1],l.itemType=c[2]):l.name=c[1],l.name in p&&(l.name=p[l.name]),l}for(let c=0;c<i.length;c++){let p=i[c];if(p=p.trim(),p==="")continue;const l=p.split(/\s+/),z=l.shift();switch(p=l.join(" "),z){case"format":o.format=l[0],o.version=l[1];break;case"comment":o.comments.push(p);break;case"element":a!==void 0&&o.elements.push(a),a={},a.name=l[0],a.count=parseInt(l[1]),a.properties=[];break;case"property":a.properties.push(m(l,g.propertyNameMapping));break;case"obj_info":o.objInfo=p;break;default:console.log("unhandled",z,l)}}return a!==void 0&&o.elements.push(a),o}function x(e,n){switch(n){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(e);case"float":case"double":case"float32":case"float64":return parseFloat(e)}}function y(e,n){const r={};for(let t=0;t<e.length;t++){if(n.empty())return null;if(e[t].type==="list"){const s=[],o=x(n.next(),e[t].countType);for(let i=0;i<o;i++){if(n.empty())return null;s.push(x(n.next(),e[t].itemType))}r[e[t].name]=s}else r[e[t].name]=x(n.next(),e[t].type)}return r}function R(){const e={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]};for(const n of Object.keys(g.customPropertyMapping))e[n]=[];return e}function d(e){const n=e.map(t=>t.name);function r(t){for(let s=0,o=t.length;s<o;s++){const i=t[s];if(n.includes(i))return i}return null}return{attrX:r(["x","px","posx"])||"x",attrY:r(["y","py","posy"])||"y",attrZ:r(["z","pz","posz"])||"z",attrNX:r(["nx","normalx"]),attrNY:r(["ny","normaly"]),attrNZ:r(["nz","normalz"]),attrS:r(["s","u","texture_u","tx"]),attrT:r(["t","v","texture_v","ty"]),attrR:r(["red","diffuse_red","r","diffuse_r"]),attrG:r(["green","diffuse_green","g","diffuse_g"]),attrB:r(["blue","diffuse_blue","b","diffuse_b"])}}function B(e,n){const r=R(),t=/end_header\s+(\S[\s\S]*\S|\S)\s*$/;let s,o;(o=t.exec(e))!==null?s=o[1].split(/\s+/):s=[];const i=new j(s);e:for(let a=0;a<n.elements.length;a++){const m=n.elements[a],c=d(m.properties);for(let p=0;p<m.count;p++){const l=y(m.properties,i);if(!l)break e;N(r,m.name,l,c)}}return v(r)}function v(e){let n=new V;e.indices.length>0&&n.setIndex(e.indices),n.setAttribute("position",new h(e.vertices,3)),e.normals.length>0&&n.setAttribute("normal",new h(e.normals,3)),e.uvs.length>0&&n.setAttribute("uv",new h(e.uvs,2)),e.colors.length>0&&n.setAttribute("color",new h(e.colors,3)),(e.faceVertexUvs.length>0||e.faceVertexColors.length>0)&&(n=n.toNonIndexed(),e.faceVertexUvs.length>0&&n.setAttribute("uv",new h(e.faceVertexUvs,2)),e.faceVertexColors.length>0&&n.setAttribute("color",new h(e.faceVertexColors,3)));for(const r of Object.keys(g.customPropertyMapping))e[r].length>0&&n.setAttribute(r,new h(e[r],g.customPropertyMapping[r].length));return n.computeBoundingSphere(),n}function N(e,n,r,t){if(n==="vertex"){e.vertices.push(r[t.attrX],r[t.attrY],r[t.attrZ]),t.attrNX!==null&&t.attrNY!==null&&t.attrNZ!==null&&e.normals.push(r[t.attrNX],r[t.attrNY],r[t.attrNZ]),t.attrS!==null&&t.attrT!==null&&e.uvs.push(r[t.attrS],r[t.attrT]),t.attrR!==null&&t.attrG!==null&&t.attrB!==null&&(f.setRGB(r[t.attrR]/255,r[t.attrG]/255,r[t.attrB]/255,P),e.colors.push(f.r,f.g,f.b));for(const s of Object.keys(g.customPropertyMapping))for(const o of g.customPropertyMapping[s])e[s].push(r[o])}else if(n==="face"){const s=r.vertex_indices||r.vertex_index,o=r.texcoord;s.length===3?(e.indices.push(s[0],s[1],s[2]),o&&o.length===6&&(e.faceVertexUvs.push(o[0],o[1]),e.faceVertexUvs.push(o[2],o[3]),e.faceVertexUvs.push(o[4],o[5]))):s.length===4&&(e.indices.push(s[0],s[1],s[3]),e.indices.push(s[1],s[2],s[3])),t.attrR!==null&&t.attrG!==null&&t.attrB!==null&&(f.setRGB(r[t.attrR]/255,r[t.attrG]/255,r[t.attrB]/255,P),e.faceVertexColors.push(f.r,f.g,f.b),e.faceVertexColors.push(f.r,f.g,f.b),e.faceVertexColors.push(f.r,f.g,f.b))}}function S(e,n){const r={};let t=0;for(let s=0;s<n.length;s++){const o=n[s],i=o.valueReader;if(o.type==="list"){const a=[],m=o.countReader.read(e+t);t+=o.countReader.size;for(let c=0;c<m;c++)a.push(i.read(e+t)),t+=i.size;r[o.name]=a}else r[o.name]=i.read(e+t),t+=i.size}return[r,t]}function I(e,n,r){function t(s,o,i){switch(o){case"int8":case"char":return{read:a=>s.getInt8(a),size:1};case"uint8":case"uchar":return{read:a=>s.getUint8(a),size:1};case"int16":case"short":return{read:a=>s.getInt16(a,i),size:2};case"uint16":case"ushort":return{read:a=>s.getUint16(a,i),size:2};case"int32":case"int":return{read:a=>s.getInt32(a,i),size:4};case"uint32":case"uint":return{read:a=>s.getUint32(a,i),size:4};case"float32":case"float":return{read:a=>s.getFloat32(a,i),size:4};case"float64":case"double":return{read:a=>s.getFloat64(a,i),size:8}}}for(let s=0,o=e.length;s<o;s++){const i=e[s];i.type==="list"?(i.countReader=t(n,i.countType,r),i.valueReader=t(n,i.itemType,r)):i.valueReader=t(n,i.type,r)}}function _(e,n){const r=R(),t=n.format==="binary_little_endian",s=new DataView(e,n.headerLength);let o,i=0;for(let a=0;a<n.elements.length;a++){const m=n.elements[a],c=m.properties,p=d(c);I(c,s,t);for(let l=0;l<m.count;l++){o=S(i,c),i+=o[1];const z=o[0];N(r,m.name,z,p)}}return v(r)}function w(e){let n=0,r=!0,t="";const s=[],o=new TextDecoder().decode(e.subarray(0,5)),i=/^ply\r\n/.test(o);do{const a=String.fromCharCode(e[n++]);a!==`
2
+ `&&a!=="\r"?t+=a:(t==="end_header"&&(r=!1),t!==""&&(s.push(t),t=""))}while(r&&n<e.length);return i===!0&&n++,{headerText:s.join("\r")+"\r",headerLength:n}}let T;const g=this;if(u instanceof ArrayBuffer){const e=new Uint8Array(u),{headerText:n,headerLength:r}=w(e),t=C(n,r);if(t.format==="ascii"){const s=new TextDecoder().decode(e);T=B(s,t)}else T=_(u,t)}else T=B(u,C(u));return T}}class j{constructor(u){this.arr=u,this.i=0}empty(){return this.i>=this.arr.length}next(){return this.arr[this.i++]}}export{G as PLYLoader};
@@ -0,0 +1,2 @@
1
+ import{j as h}from"./jsx-runtime-CAUTK36e.js";import{r as d}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{al as O}from"./index-Dm_h-T4x.js";import"./index-jib6KJY8.js";import{Q as C}from"./three-integration.service-0EyPpd5f.js";import{O as L,Q as x,V as y,C as Q,G as j}from"./StageHost-CdzuP0NS.js";import{t as z}from"./viewport-door-BdL0u5rd.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-mkWk8S65.js";import"./content-bounds-_QWiKD5_.js";import"./three.module-CrYDk-Xr.js";import"./layered-pick-CT4HlEpW.js";import"./bitmap-label-Ct4k6ehY.js";import"./viewport-surface-status-yS6CrXH7.js";import"./live-mixers-B-bwLZ7c.js";import"./model-inspection-DDZE59vp.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-smIenN60.js";import"./LineSegments2-BKEsgiC8.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./editor-presentation-activity-C7SNSmTd.js";import"./transport-strip-Co-ZDkf-.js";function $(e){const t=[],r=new Set;return e.traverse(s=>{if(s.type!=="ParticleEmitter")return;const o=s.system;!o||typeof o.getRendererSettings!="function"||r.has(o)||(r.add(o),t.push(o))}),t}function M(e){const t=e.split(/[?#]/,1)[0].replace(/^\/+/,"");return t.startsWith("public/")?t:`public/${t}`}const S=new WeakMap;function b(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function E(e){return b(e)?e:null}function w(e,t){t(e);for(const r of e.children??[])w(r,t)}function V(e){if(!b(e))return!1;const t=E(e.object);if(!t)return!1;let r=!1;return w(t,s=>{s.type==="ParticleEmitter"&&b(s.ps)&&s.ps.version!==void 0&&(r=!0)}),r}function B(e){const t=new Map,r=E(e.object);return r&&w(r,s=>{typeof s.uuid=="string"&&t.set(s.uuid,s)}),t}function F(e){const t=new x().parse(e.json),r=B(e.json),s=$(t),o=new Map(s.map(a=>[a.emitter,a])),p=new Map;if(t.traverse(a=>{const f=o.get(a);if(!f)return;const i=r.get(a.uuid);if(!i?.ps)throw new Error(`Native Quarks emitter ${a.name||a.uuid} has no matching JSON node.`);p.set(a,{system:f,json:i})}),p.size===0)throw new Error("The Quarks document contains no loadable emitter.");const u={root:t,originalText:e.text,json:e.json,emitters:p,dirty:!1};return S.set(t,u),u}function J(e){const t=S.get(e);if(!t)throw new Error("Object3D is not a native three.quarks JSON document.");return t}function q(e){for(const t of e.emitters.values())t.system.dispose();S.delete(e.root)}function G(e){const t=J(e);return t.dirty?`${JSON.stringify(t.json,null,2)}
2
+ `:t.originalText}const W=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 U(){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 m(e,t){if(!b(e)||typeof e.type!="string")throw new Error(`${t} must be a native quarks function JSON object with a type.`);return e}function k(e,t){const{system:r}=e;switch(t){case"particles.duration":return r.duration;case"particles.looping":return r.looping;case"particles.prewarm":return r.prewarm;case"particles.worldSpace":return r.worldSpace;case"particles.startLife":return r.startLife.toJSON();case"particles.startSpeed":return r.startSpeed.toJSON();case"particles.startRotation":return r.startRotation.toJSON();case"particles.startSize":return r.startSize.toJSON();case"particles.startColor":return r.startColor.toJSON();case"particles.emissionOverTime":return r.emissionOverTime.toJSON();case"particles.emissionOverDistance":return r.emissionOverDistance.toJSON();case"particles.shape":return r.emitterShape.type;case"particles.behaviors":return r.behaviors.map(s=>s.type);case"particles.renderMode":return r.renderMode;default:return}}function g(e){return e.slice(10)}function N(e,t,r){const{system:s}=e;switch(t){case"particles.duration":{const o=Number(r);if(!Number.isFinite(o)||o<=0)throw new Error("Particle duration must be a positive finite number.");s.duration=o;break}case"particles.looping":s.looping=!!r;break;case"particles.prewarm":s.prewarm=!!r;break;case"particles.worldSpace":s.worldSpace=!!r;break;case"particles.startLife":s.startLife=y(m(r,"Lifetime"));break;case"particles.startSpeed":s.startSpeed=y(m(r,"Speed"));break;case"particles.startRotation":s.startRotation=j(m(r,"Rotation"));break;case"particles.startSize":s.startSize=j(m(r,"Size"));break;case"particles.startColor":s.startColor=Q(m(r,"Color"));break;case"particles.emissionOverTime":s.emissionOverTime=y(m(r,"Rate over time"));break;case"particles.emissionOverDistance":s.emissionOverDistance=y(m(r,"Rate over distance"));break;default:throw new Error(`Particle field ${t} is read-only.`)}e.json.ps[g(t)]=r,s.restart()}function H(e,t,r,s){N(e,t,r),e.json.ps[g(t)]=s}function I(e){return e===void 0?void 0:JSON.parse(JSON.stringify(e))}const _=({root:e,defaultAdapter:t,commit:r})=>{const s=J(e),o=new Set,p=()=>{for(const i of o)i()},u=i=>{const n=z(t.hierarchy,i);return n?s.emitters.get(n)??null:null},a={properties:i=>[...t.inspector?.properties(i)??[],...u(i)?U():[]],get:(i,n)=>{const c=u(i);return c&&n.startsWith("particles.")?k(c,n):t.inspector?.get(i,n)},set:async(i,n,c)=>{const l=u(i);if(!l||!W.has(n)){await t.inspector?.set(i,n,c);return}const v=k(l,n),T=g(n),R=I(l.json.ps?.[T]),P=s.dirty;try{N(l,n,c),s.dirty=!0,p(),await r(`Edit ${l.system.emitter.name||"Particle Emitter"}`)}catch(D){throw H(l,n,v,R),s.dirty=P,p(),D}}};return{adapter:{capabilities:{...t.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:t.hierarchy,...t.selection?{selection:t.selection}:{},...t.transforms?{transforms:t.transforms}:{},inspector:a,subscribe:i=>{o.add(i);const n=t.subscribe?.(i)??(()=>{});return()=>{o.delete(i),n()}}},dispose:()=>o.clear()}};async function gt(e,t){const r=await fetch(C(e),{cache:"no-store",...t?{signal:t}:{}});if(!r.ok)throw new Error(`Could not load ${e}: HTTP ${r.status}.`);const s=await r.text();let o;try{o=JSON.parse(s)}catch{return null}return V(o)?{text:s,json:o,projectPath:M(e)}:null}function Ot({documentId:e,assetPath:t,displayName:r,active:s,source:o}){const[p,u]=d.useState(null),[a,f]=d.useState(null);d.useEffect(()=>{if(!s){u(null);return}let c=null;try{c=F(o),u(c),f(null)}catch(l){f(l instanceof Error?l.message:String(l))}return()=>{c&&q(c)}},[s,o]);const i=d.useCallback(()=>{if(!p)throw new Error(`Particle asset ${t} is not loaded.`);return{root:p.root,dispose(){}}},[p,t]),n=d.useMemo(()=>({label:`Edit ${r}`,resources:[{path:o.projectPath,contentType:"application/json",serialize:({root:c})=>G(c)}]}),[r,o.projectPath]);return a?h.jsx("div",{role:"alert",style:{padding:20,color:O.semantic.danger},children:a}):p?h.jsx(L,{documentId:e,sourcePath:t,displayName:r,build:i,active:s,assetType:"particles",persistence:n,authoring:_,dressing:{grid:!0}}):h.jsxs("div",{style:{padding:20,color:O.content.muted},children:["Loading ",r,"…"]})}export{Ot as QuarksAssetDocument,V as isNativeQuarksJson,gt as loadNativeQuarksJsonSource};