@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
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@volter/model-editor",
3
3
  "author": "Volter AI, Inc.",
4
- "version": "0.5.66",
4
+ "version": "0.5.67",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -39,19 +39,19 @@
39
39
  "displayName": "Volter Model Editor",
40
40
  "colorTheme": "dark",
41
41
  "workbench": {
42
- "release": "model-editor-9ef15b1f345b-7b9222405623-darwin-arm64",
43
- "tarballSha256": "043e8a7c0986dc3c4b7129f970ac04e97d7309291325036ca02c3eca2d28ab05"
42
+ "release": "model-editor-53c70370c14c-d9c0c8f0d344-darwin-arm64",
43
+ "tarballSha256": "8836fa66512290299425e1516aa1316b866f402180302f4043d257f32442b7ab"
44
44
  }
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@volter/editor-core": "0.5.66",
49
- "@volter/editor-blender": "0.1.9",
50
- "@volter/editor-threejs": "0.5.66",
51
- "@volter/blender-engine": "0.1.8",
52
- "@volter/editor-project": "0.5.66",
53
- "@volter/editor-sdk": "0.5.66",
54
- "@volter/editor-live": "0.5.66",
48
+ "@volter/editor-core": "0.5.67",
49
+ "@volter/editor-blender": "0.1.10",
50
+ "@volter/editor-threejs": "0.5.67",
51
+ "@volter/blender-engine": "0.1.9",
52
+ "@volter/editor-project": "0.5.67",
53
+ "@volter/editor-sdk": "0.5.67",
54
+ "@volter/editor-live": "0.5.67",
55
55
  "@modelcontextprotocol/sdk": "1.30.0",
56
56
  "undici": "7.29.1"
57
57
  },
package/src/index.ts CHANGED
@@ -7,4 +7,5 @@ export const { mountVgai } = product({
7
7
  packages: { '@volter/editor-blender': blender, '@volter/editor-threejs': threejs },
8
8
  look: 'blender',
9
9
  workspace: 'model',
10
+ logo: 'https://brand.volter.ai/logo/volter-model-editor/svg',
10
11
  });
@@ -1 +0,0 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{t as r,B as k,C as w,R as z,S as C}from"./index-cpXNKgvz.js";import"./index-D2LwEE0L.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-ZILb6uB7.js";const m={fontSize:11,color:r.content.dim,marginBottom:2};function M({assetPath:s}){const i=l.useRef(null),[a,p]=l.useState(!1),[n,f]=l.useState(null),[c,x]=l.useState(0),[h,g]=l.useState(!1),[v,y]=l.useState(1),j=s.split("/").pop()??s,b=s.split(".").pop()?.toUpperCase()??"";l.useEffect(()=>()=>{i.current?.pause()},[]);const S=()=>{const t=i.current;t&&(a?t.pause():t.play(),p(!a))},d=t=>{const o=Math.floor(t/60),u=Math.floor(t%60);return`${o}:${u.toString().padStart(2,"0")}`};return e.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[e.jsx("div",{style:{fontWeight:600,fontSize:12,color:r.content.primary,wordBreak:"break-all"},children:j}),e.jsxs("div",{className:"vgai-content-frost",style:{width:"100%",border:`1px solid ${r.boundary.default}`,borderRadius:r.shape.small,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:8,padding:16},children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:48,height:48,children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",fill:"var(--vgai-asset-icon-audio)"}),e.jsx("path",{d:"M9 8l4-2v12l-4-2H7V10h2zm6 1v6m2-5v4",stroke:"var(--vgai-text-1)",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"})]}),n!=null&&e.jsxs("div",{style:{width:"100%",fontSize:10,color:r.content.muted,textAlign:"center"},children:[d(c)," / ",d(n)]}),n!=null&&n>0&&e.jsx("div",{style:{width:"100%",height:4,background:r.surface.raised,borderRadius:r.shape.small,cursor:"pointer",position:"relative"},onClick:t=>{const o=t.currentTarget.getBoundingClientRect(),u=(t.clientX-o.left)/o.width;i.current&&(i.current.currentTime=u*n)},children:e.jsx("div",{style:{width:`${c/n*100}%`,height:"100%",background:"var(--vgai-asset-icon-audio)",borderRadius:r.shape.small}})}),e.jsx(k,{type:"button",variant:"secondary",size:"comfortable",onClick:S,children:a?"Pause":"Play"}),e.jsx("div",{role:"img","aria-label":"Audio waveform",style:{width:"100%",height:36,display:"flex",alignItems:"center",gap:2},children:Array.from({length:48},(t,o)=>e.jsx("i",{style:{flex:1,height:`${20+o*37%75}%`,background:"var(--vgai-asset-icon-audio)",opacity:o/48<=c/(n||1)?1:.3}},o))}),e.jsxs("label",{style:{fontSize:11,color:r.content.muted},children:[e.jsx(w,{checked:h,onChange:t=>g(t.target.checked)})," Loop"]}),e.jsxs("label",{style:{fontSize:11,color:r.content.muted},children:["Volume"," ",e.jsx(z,{"aria-label":"Audio volume",min:"0",max:"1",step:"0.05",value:v,onChange:t=>{const o=Number(t.target.value);y(o),i.current&&(i.current.volume=o)}})]})]}),e.jsx("audio",{ref:i,src:s,loop:h,onLoadedMetadata:()=>{i.current&&f(i.current.duration)},onTimeUpdate:()=>{i.current&&x(i.current.currentTime)},onEnded:()=>p(!1)}),e.jsx(C,{label:"Info",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Path"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary,wordBreak:"break-all"},children:s})]}),n!=null&&e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Duration"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary},children:d(n)})]}),e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Format"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary},children:b})]})]})})]})}export{M as AudioViewer};
@@ -1,3 +0,0 @@
1
- import{b4 as kn,ae as wn,a0 as it,aQ as Nn,a2 as An,V as $,d as X,j as at,f as Tn,aT as En,h as rt,b as pe,aY as ot,b5 as _n,aN as ct,aR as Ee,e as ee,a as xn,a8 as Cn,a9 as vn,g as lt,aa as Ln,b6 as In,b7 as Rn,b8 as Mn,a$ as Sn,aJ as dt,Q as On,aW as ut,aX as Gn,ak as jn,aK as ne,aV as qn,aL as ft,b9 as Pn,k as Hn,ba as Un,aO as Bn,aU as zn,q as _e,a3 as ht}from"./three.module-ZILb6uB7.js";class pt extends kn{constructor(D){super(D)}parse(D){function se(h){switch(h.image_type){case me:case z:if(h.colormap_length>256||h.colormap_size!==24||h.colormap_type!==1)throw new Error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case B:case V:case ue:case be:if(h.colormap_type)throw new Error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case Ce:throw new Error("THREE.TGALoader: No data.");default:throw new Error("THREE.TGALoader: Invalid type "+h.image_type)}if(h.width<=0||h.height<=0)throw new Error("THREE.TGALoader: Invalid image size.");if(h.pixel_size!==8&&h.pixel_size!==16&&h.pixel_size!==24&&h.pixel_size!==32)throw new Error("THREE.TGALoader: Invalid pixel size "+h.pixel_size)}function U(h,q,R,C,P){let _,v;const A=R.pixel_size>>3,N=R.width*R.height*A;if(q&&(v=P.subarray(C,C+=R.colormap_length*(R.colormap_size>>3))),h){_=new Uint8Array(N);let y,u,k,M=0;const W=new Uint8Array(A);for(;M<N;)if(y=P[C++],u=(y&127)+1,y&128){for(k=0;k<A;++k)W[k]=P[C++];for(k=0;k<u;++k)_.set(W,M+k*A);M+=A*u}else{for(u*=A,k=0;k<u;++k)_[M+k]=P[C++];M+=u}}else _=P.subarray(C,C+=q?R.width*R.height:N);return{pixel_data:_,palettes:v}}function te(h,q,R,C,P,_,v,A,N){const y=N;let u,k=0,M,W;const re=j.width;for(W=q;W!==C;W+=R)for(M=P;M!==v;M+=_,k++)u=A[k],h[(M+re*W)*4+3]=255,h[(M+re*W)*4+2]=y[u*3+0],h[(M+re*W)*4+1]=y[u*3+1],h[(M+re*W)*4+0]=y[u*3+2];return h}function L(h,q,R,C,P,_,v,A){let N,y=0,u,k;const M=j.width;for(k=q;k!==C;k+=R)for(u=P;u!==v;u+=_,y+=2)N=A[y+0]+(A[y+1]<<8),h[(u+M*k)*4+0]=(N&31744)>>7,h[(u+M*k)*4+1]=(N&992)>>2,h[(u+M*k)*4+2]=(N&31)<<3,h[(u+M*k)*4+3]=N&32768?0:255;return h}function Q(h,q,R,C,P,_,v,A){let N=0,y,u;const k=j.width;for(u=q;u!==C;u+=R)for(y=P;y!==v;y+=_,N+=3)h[(y+k*u)*4+3]=255,h[(y+k*u)*4+2]=A[N+0],h[(y+k*u)*4+1]=A[N+1],h[(y+k*u)*4+0]=A[N+2];return h}function S(h,q,R,C,P,_,v,A){let N=0,y,u;const k=j.width;for(u=q;u!==C;u+=R)for(y=P;y!==v;y+=_,N+=4)h[(y+k*u)*4+2]=A[N+0],h[(y+k*u)*4+1]=A[N+1],h[(y+k*u)*4+0]=A[N+2],h[(y+k*u)*4+3]=A[N+3];return h}function de(h,q,R,C,P,_,v,A){let N,y=0,u,k;const M=j.width;for(k=q;k!==C;k+=R)for(u=P;u!==v;u+=_,y++)N=A[y],h[(u+M*k)*4+0]=N,h[(u+M*k)*4+1]=N,h[(u+M*k)*4+2]=N,h[(u+M*k)*4+3]=255;return h}function Z(h,q,R,C,P,_,v,A){let N=0,y,u;const k=j.width;for(u=q;u!==C;u+=R)for(y=P;y!==v;y+=_,N+=2)h[(y+k*u)*4+0]=A[N+0],h[(y+k*u)*4+1]=A[N+0],h[(y+k*u)*4+2]=A[N+0],h[(y+k*u)*4+3]=A[N+1];return h}function xe(h,q,R,C,P){let _,v,A,N,y,u;switch((j.flags&ve)>>ge){default:case Ie:_=0,A=1,y=q,v=0,N=1,u=R;break;case ye:_=0,A=1,y=q,v=R-1,N=-1,u=-1;break;case ie:_=q-1,A=-1,y=-1,v=0,N=1,u=R;break;case Le:_=q-1,A=-1,y=-1,v=R-1,N=-1,u=-1;break}if(he)switch(j.pixel_size){case 8:de(h,v,N,u,_,A,y,C);break;case 16:Z(h,v,N,u,_,A,y,C);break;default:throw new Error("THREE.TGALoader: Format not supported.")}else switch(j.pixel_size){case 8:te(h,v,N,u,_,A,y,C,P);break;case 16:L(h,v,N,u,_,A,y,C);break;case 24:Q(h,v,N,u,_,A,y,C);break;case 32:S(h,v,N,u,_,A,y,C);break;default:throw new Error("THREE.TGALoader: Format not supported.")}return h}const Ce=0,me=1,B=2,V=3,z=9,ue=10,be=11,ve=48,ge=4,ye=0,Le=1,Ie=2,ie=3;if(D.length<19)throw new Error("THREE.TGALoader: Not enough data to contain header.");let I=0;const O=new Uint8Array(D),j={id_length:O[I++],colormap_type:O[I++],image_type:O[I++],colormap_index:O[I++]|O[I++]<<8,colormap_length:O[I++]|O[I++]<<8,colormap_size:O[I++],origin:[O[I++]|O[I++]<<8,O[I++]|O[I++]<<8],width:O[I++]|O[I++]<<8,height:O[I++]|O[I++]<<8,pixel_size:O[I++],flags:O[I++]};if(se(j),j.id_length+I>D.length)throw new Error("THREE.TGALoader: No data.");I+=j.id_length;let ae=!1,fe=!1,he=!1;switch(j.image_type){case z:ae=!0,fe=!0;break;case me:fe=!0;break;case ue:ae=!0;break;case B:break;case be:ae=!0,he=!0;break;case V:he=!0;break}const ke=new Uint8Array(j.width*j.height*4),we=U(ae,fe,j,I,O);return xe(ke,j.width,j.height,we.pixel_data,we.palettes),{data:ke,width:j.width,height:j.height,flipY:!0,generateMipmaps:!0,minFilter:wn}}}class Vn extends it{load(D,se,U,te){const L=this,Q=L.path===""?Nn.extractUrlBase(D):L.path,S=new An(L.manager);S.setPath(L.path),S.setRequestHeader(L.requestHeader),S.setWithCredentials(L.withCredentials),S.load(D,function(de){try{se(L.parse(de,Q))}catch(Z){te?te(Z):console.error(Z),L.manager.itemError(D)}},U,te)}parse(D,se){function U(t,e){const s=[],n=t.childNodes;for(let i=0,a=n.length;i<a;i++){const r=n[i];r.nodeName===e&&s.push(r)}return s}function te(t){if(t.length===0)return[];const e=t.trim().split(/\s+/),s=new Array(e.length);for(let n=0,i=e.length;n<i;n++)s[n]=e[n];return s}function L(t){if(t.length===0)return[];const e=t.trim().split(/\s+/),s=new Array(e.length);for(let n=0,i=e.length;n<i;n++)s[n]=parseFloat(e[n]);return s}function Q(t){if(t.length===0)return[];const e=t.trim().split(/\s+/),s=new Array(e.length);for(let n=0,i=e.length;n<i;n++)s[n]=parseInt(e[n]);return s}function S(t){return t.substring(1)}function de(){return"three_default_"+gn++}function Z(t){return Object.keys(t).length===0}function xe(t){return{unit:Ce(U(t,"unit")[0]),upAxis:me(U(t,"up_axis")[0])}}function Ce(t){return t!==void 0&&t.hasAttribute("meter")===!0?parseFloat(t.getAttribute("meter")):1}function me(t){return t!==void 0?t.textContent:"Y_UP"}function B(t,e,s,n){const i=U(t,e)[0];if(i!==void 0){const a=U(i,s);for(let r=0;r<a.length;r++)n(a[r])}}function V(t,e){for(const s in t){const n=t[s];n.build=e(t[s])}}function z(t,e){return t.build!==void 0||(t.build=e(t)),t.build}function ue(t){const e={sources:{},samplers:{},channels:{}};let s=!1;for(let n=0,i=t.childNodes.length;n<i;n++){const a=t.childNodes[n];if(a.nodeType!==1)continue;let r;switch(a.nodeName){case"source":r=a.getAttribute("id"),e.sources[r]=Re(a);break;case"sampler":r=a.getAttribute("id"),e.samplers[r]=be(a);break;case"channel":r=a.getAttribute("target"),e.channels[r]=ve(a);break;case"animation":ue(a),s=!0;break;default:console.log(a)}}s===!1&&(w.animations[t.getAttribute("id")||pe.generateUUID()]=e)}function be(t){const e={inputs:{}};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"input":const a=S(i.getAttribute("source")),r=i.getAttribute("semantic");e.inputs[r]=a;break}}return e}function ve(t){const e={};let n=t.getAttribute("target").split("/");const i=n.shift();let a=n.shift();const r=a.indexOf("(")!==-1,d=a.indexOf(".")!==-1;if(d)n=a.split("."),a=n.shift(),e.member=n.shift();else if(r){const c=a.split("(");a=c.shift();for(let l=0;l<c.length;l++)c[l]=parseInt(c[l].replace(/\)/,""));e.indices=c}return e.id=i,e.sid=a,e.arraySyntax=r,e.memberSyntax=d,e.sampler=S(t.getAttribute("source")),e}function ge(t){const e=[],s=t.channels,n=t.samplers,i=t.sources;for(const a in s)if(s.hasOwnProperty(a)){const r=s[a],d=n[r.sampler],c=d.inputs.INPUT,l=d.inputs.OUTPUT,m=i[c],o=i[l],p=Le(r,m,o);j(p,e)}return e}function ye(t){return z(w.animations[t],ge)}function Le(t,e,s){const n=w.nodes[t.id],i=ce(n.id),a=n.transforms[t.sid],r=n.matrix.clone().transpose();let d,c,l,m,o,p;const f={};switch(a){case"matrix":for(l=0,m=e.array.length;l<m;l++)if(d=e.array[l],c=l*s.stride,f[d]===void 0&&(f[d]={}),t.arraySyntax===!0){const G=s.array[c],x=t.indices[0]+4*t.indices[1];f[d][x]=G}else for(o=0,p=s.stride;o<p;o++)f[d][o]=s.array[c+o];break;case"translate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',a);break;case"rotate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',a);break;case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',a);break}const g=Ie(f,r);return{name:i.uuid,keyframes:g}}function Ie(t,e){const s=[];for(const i in t)s.push({time:parseFloat(i),value:t[i]});s.sort(n);for(let i=0;i<16;i++)ae(s,i,e.elements[i]);return s;function n(i,a){return i.time-a.time}}const ie=new $,I=new $,O=new On;function j(t,e){const s=t.keyframes,n=t.name,i=[],a=[],r=[],d=[];for(let c=0,l=s.length;c<l;c++){const m=s[c],o=m.time,p=m.value;K.fromArray(p).transpose(),K.decompose(ie,O,I),i.push(o),a.push(ie.x,ie.y,ie.z),r.push(O.x,O.y,O.z,O.w),d.push(I.x,I.y,I.z)}return a.length>0&&e.push(new ut(n+".position",i,a)),r.length>0&&e.push(new Gn(n+".quaternion",i,r)),d.length>0&&e.push(new ut(n+".scale",i,d)),e}function ae(t,e,s){let n,i=!0,a,r;for(a=0,r=t.length;a<r;a++)n=t[a],n.value[e]===void 0?n.value[e]=null:i=!1;if(i===!0)for(a=0,r=t.length;a<r;a++)n=t[a],n.value[e]=s;else fe(t,e)}function fe(t,e){let s,n;for(let i=0,a=t.length;i<a;i++){const r=t[i];if(r.value[e]===null){if(s=he(t,i,e),n=ke(t,i,e),s===null){r.value[e]=n.value[e];continue}if(n===null){r.value[e]=s.value[e];continue}we(r,s,n,e)}}}function he(t,e,s){for(;e>=0;){const n=t[e];if(n.value[s]!==null)return n;e--}return null}function ke(t,e,s){for(;e<t.length;){const n=t[e];if(n.value[s]!==null)return n;e++}return null}function we(t,e,s,n){if(s.time-e.time===0){t.value[n]=e.value[n];return}t.value[n]=(t.time-e.time)*(s.value[n]-e.value[n])/(s.time-e.time)+e.value[n]}function h(t){const e={name:t.getAttribute("id")||"default",start:parseFloat(t.getAttribute("start")||0),end:parseFloat(t.getAttribute("end")||0),animations:[]};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"instance_animation":e.animations.push(S(i.getAttribute("url")));break}}w.clips[t.getAttribute("id")]=e}function q(t){const e=[],s=t.name,n=t.end-t.start||-1,i=t.animations;for(let a=0,r=i.length;a<r;a++){const d=ye(i[a]);for(let c=0,l=d.length;c<l;c++)e.push(d[c])}return new ot(s,n,e)}function R(t){return z(w.clips[t],q)}function C(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"skin":e.id=S(i.getAttribute("source")),e.skin=P(i);break;case"morph":e.id=S(i.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.");break}}w.controllers[t.getAttribute("id")]=e}function P(t){const e={sources:{}};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"bind_shape_matrix":e.bindShapeMatrix=L(i.textContent);break;case"source":const a=i.getAttribute("id");e.sources[a]=Re(i);break;case"joints":e.joints=_(i);break;case"vertex_weights":e.vertexWeights=v(i);break}}return e}function _(t){const e={inputs:{}};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"input":const a=i.getAttribute("semantic"),r=S(i.getAttribute("source"));e.inputs[a]=r;break}}return e}function v(t){const e={inputs:{}};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"input":const a=i.getAttribute("semantic"),r=S(i.getAttribute("source")),d=parseInt(i.getAttribute("offset"));e.inputs[a]={id:r,offset:d};break;case"vcount":e.vcount=Q(i.textContent);break;case"v":e.v=Q(i.textContent);break}}return e}function A(t){const e={id:t.id},s=w.geometries[e.id];return t.skin!==void 0&&(e.skin=N(t.skin),s.sources.skinIndices=e.skin.indices,s.sources.skinWeights=e.skin.weights),e}function N(t){const s={joints:[],indices:{array:[],stride:4},weights:{array:[],stride:4}},n=t.sources,i=t.vertexWeights,a=i.vcount,r=i.v,d=i.inputs.JOINT.offset,c=i.inputs.WEIGHT.offset,l=t.sources[t.joints.inputs.JOINT],m=t.sources[t.joints.inputs.INV_BIND_MATRIX],o=n[i.inputs.WEIGHT.id].array;let p=0,f,g,b;for(f=0,b=a.length;f<b;f++){const x=a[f],T=[];for(g=0;g<x;g++){const E=r[p+d],Y=r[p+c],F=o[Y];T.push({index:E,weight:F}),p+=2}for(T.sort(G),g=0;g<4;g++){const E=T[g];E!==void 0?(s.indices.array.push(E.index),s.weights.array.push(E.weight)):(s.indices.array.push(0),s.weights.array.push(0))}}for(t.bindShapeMatrix?s.bindMatrix=new X().fromArray(t.bindShapeMatrix).transpose():s.bindMatrix=new X().identity(),f=0,b=l.array.length;f<b;f++){const x=l.array[f],T=new X().fromArray(m.array,f*m.stride).transpose();s.joints.push({name:x,boneInverse:T})}return s;function G(x,T){return T.weight-x.weight}}function y(t){return z(w.controllers[t],A)}function u(t){const e={init_from:U(t,"init_from")[0].textContent};w.images[t.getAttribute("id")]=e}function k(t){return t.build!==void 0?t.build:t.init_from}function M(t){const e=w.images[t];return e!==void 0?z(e,k):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",t),null)}function W(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"profile_COMMON":e.profile=re(i);break}}w.effects[t.getAttribute("id")]=e}function re(t){const e={surfaces:{},samplers:{}};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"newparam":bt(i,e);break;case"technique":e.technique=kt(i);break;case"extra":e.extra=qe(i);break}}return e}function bt(t,e){const s=t.getAttribute("sid");for(let n=0,i=t.childNodes.length;n<i;n++){const a=t.childNodes[n];if(a.nodeType===1)switch(a.nodeName){case"surface":e.surfaces[s]=gt(a);break;case"sampler2D":e.samplers[s]=yt(a);break}}}function gt(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"init_from":e.init_from=i.textContent;break}}return e}function yt(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"source":e.source=i.textContent;break}}return e}function kt(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"constant":case"lambert":case"blinn":case"phong":e.type=i.nodeName,e.parameters=wt(i);break;case"extra":e.extra=qe(i);break}}return e}function wt(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":e[i.nodeName]=Ge(i);break;case"transparent":e[i.nodeName]={opaque:i.hasAttribute("opaque")?i.getAttribute("opaque"):"A_ONE",data:Ge(i)};break}}return e}function Ge(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"color":e[i.nodeName]=L(i.textContent);break;case"float":e[i.nodeName]=parseFloat(i.textContent);break;case"texture":e[i.nodeName]={id:i.getAttribute("texture"),extra:je(i)};break}}return e}function je(t){const e={technique:{}};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"extra":Nt(i,e);break}}return e}function Nt(t,e){for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"technique":At(i,e);break}}}function At(t,e){for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":e.technique[i.nodeName]=parseFloat(i.textContent);break;case"wrapU":case"wrapV":i.textContent.toUpperCase()==="TRUE"?e.technique[i.nodeName]=1:i.textContent.toUpperCase()==="FALSE"?e.technique[i.nodeName]=0:e.technique[i.nodeName]=parseInt(i.textContent);break;case"bump":e[i.nodeName]=Pe(i);break}}}function qe(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"technique":e.technique=Tt(i);break}}return e}function Tt(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"double_sided":e[i.nodeName]=parseInt(i.textContent);break;case"bump":e[i.nodeName]=Pe(i);break}}return e}function Pe(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"texture":e[i.nodeName]={id:i.getAttribute("texture"),texcoord:i.getAttribute("texcoord"),extra:je(i)};break}}return e}function He(t){return t}function Et(t){return z(w.effects[t],He)}function _t(t){const e={name:t.getAttribute("name")};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"instance_effect":e.url=S(i.getAttribute("url"));break}}w.materials[t.getAttribute("id")]=e}function xt(t){let e,s=t.slice((t.lastIndexOf(".")-1>>>0)+2);switch(s=s.toLowerCase(),s){case"tga":e=Oe;break;default:e=tt}return e}function Ue(t){const e=Et(t.url),s=e.profile.technique;let n;switch(s.type){case"phong":case"blinn":n=new ct;break;case"lambert":n=new _n;break;default:n=new at;break}n.name=t.name||"";function i(c,l=null){const m=e.profile.samplers[c.id];let o=null;if(m!==void 0){const p=e.profile.surfaces[m.source];o=M(p.init_from)}else console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),o=M(c.id);if(o!==null){const p=xt(o);if(p!==void 0){const f=p.load(o),g=c.extra;if(g!==void 0&&g.technique!==void 0&&Z(g.technique)===!1){const b=g.technique;f.wrapS=b.wrapU?_e:ht,f.wrapT=b.wrapV?_e:ht,f.offset.set(b.offsetU||0,b.offsetV||0),f.repeat.set(b.repeatU||1,b.repeatV||1)}else f.wrapS=_e,f.wrapT=_e;return l!==null&&(f.colorSpace=l),f}else return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",o),null}else return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",c.id),null}const a=s.parameters;for(const c in a){const l=a[c];switch(c){case"diffuse":l.color&&n.color.fromArray(l.color),l.texture&&(n.map=i(l.texture,ee));break;case"specular":l.color&&n.specular&&n.specular.fromArray(l.color),l.texture&&(n.specularMap=i(l.texture));break;case"bump":l.texture&&(n.normalMap=i(l.texture));break;case"ambient":l.texture&&(n.lightMap=i(l.texture,ee));break;case"shininess":l.float&&n.shininess&&(n.shininess=l.float);break;case"emission":l.color&&n.emissive&&n.emissive.fromArray(l.color),l.texture&&(n.emissiveMap=i(l.texture,ee));break}}Ee.colorSpaceToWorking(n.color,ee),n.specular&&Ee.colorSpaceToWorking(n.specular,ee),n.emissive&&Ee.colorSpaceToWorking(n.emissive,ee);let r=a.transparent,d=a.transparency;if(d===void 0&&r&&(d={float:1}),r===void 0&&d&&(r={opaque:"A_ONE",data:{color:[1,1,1,1]}}),r&&d)if(r.data.texture)n.transparent=!0;else{const c=r.data.color;switch(r.opaque){case"A_ONE":n.opacity=c[3]*d.float;break;case"RGB_ZERO":n.opacity=1-c[0]*d.float;break;case"A_ZERO":n.opacity=1-c[3]*d.float;break;case"RGB_ONE":n.opacity=c[0]*d.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',r.opaque)}n.opacity<1&&(n.transparent=!0)}if(s.extra!==void 0&&s.extra.technique!==void 0){const c=s.extra.technique;for(const l in c){const m=c[l];switch(l){case"double_sided":n.side=m===1?Cn:vn;break;case"bump":n.normalMap=i(m.texture),n.normalScale=new xn(1,1);break}}}return n}function Ct(t){return z(w.materials[t],Ue)}function vt(t){const e={name:t.getAttribute("name")};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"optics":e.optics=Lt(i);break}}w.cameras[t.getAttribute("id")]=e}function Lt(t){for(let e=0;e<t.childNodes.length;e++){const s=t.childNodes[e];switch(s.nodeName){case"technique_common":return It(s)}}return{}}function It(t){const e={};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];switch(n.nodeName){case"perspective":case"orthographic":e.technique=n.nodeName,e.parameters=Rt(n);break}}return e}function Rt(t){const e={};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];switch(n.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":e[n.nodeName]=parseFloat(n.textContent);break}}return e}function Be(t){let e;switch(t.optics.technique){case"perspective":e=new lt(t.optics.parameters.yfov,t.optics.parameters.aspect_ratio,t.optics.parameters.znear,t.optics.parameters.zfar);break;case"orthographic":let s=t.optics.parameters.ymag,n=t.optics.parameters.xmag;const i=t.optics.parameters.aspect_ratio;n=n===void 0?s*i:n,s=s===void 0?n/i:s,n*=.5,s*=.5,e=new Ln(-n,n,s,-s,t.optics.parameters.znear,t.optics.parameters.zfar);break;default:e=new lt;break}return e.name=t.name||"",e}function Mt(t){const e=w.cameras[t];return e!==void 0?z(e,Be):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",t),null)}function St(t){let e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"technique_common":e=Ot(i);break}}w.lights[t.getAttribute("id")]=e}function Ot(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"directional":case"point":case"spot":case"ambient":e.technique=i.nodeName,e.parameters=Gt(i)}}return e}function Gt(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"color":const a=L(i.textContent);e.color=new rt().fromArray(a),Ee.colorSpaceToWorking(e.color,ee);break;case"falloff_angle":e.falloffAngle=parseFloat(i.textContent);break;case"quadratic_attenuation":const r=parseFloat(i.textContent);e.distance=r?Math.sqrt(1/r):0;break}}return e}function ze(t){let e;switch(t.technique){case"directional":e=new Sn;break;case"point":e=new Mn;break;case"spot":e=new Rn;break;case"ambient":e=new In;break}return t.parameters.color&&e.color.copy(t.parameters.color),t.parameters.distance&&(e.distance=t.parameters.distance),e}function jt(t){const e=w.lights[t];return e!==void 0?z(e,ze):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",t),null)}function qt(t){const e={name:t.getAttribute("name"),sources:{},vertices:{},primitives:[]},s=U(t,"mesh")[0];if(s!==void 0){for(let n=0;n<s.childNodes.length;n++){const i=s.childNodes[n];if(i.nodeType!==1)continue;const a=i.getAttribute("id");switch(i.nodeName){case"source":e.sources[a]=Re(i);break;case"vertices":e.vertices=Pt(i);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",i.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":e.primitives.push(Ht(i));break;default:console.log(i)}}w.geometries[t.getAttribute("id")]=e}}function Re(t){const e={array:[],stride:3};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"float_array":e.array=L(n.textContent);break;case"Name_array":e.array=te(n.textContent);break;case"technique_common":const i=U(n,"accessor")[0];i!==void 0&&(e.stride=parseInt(i.getAttribute("stride")));break}}return e}function Pt(t){const e={};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];n.nodeType===1&&(e[n.getAttribute("semantic")]=S(n.getAttribute("source")))}return e}function Ht(t){const e={type:t.nodeName,material:t.getAttribute("material"),count:parseInt(t.getAttribute("count")),inputs:{},stride:0,hasUV:!1};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"input":const a=S(i.getAttribute("source")),r=i.getAttribute("semantic"),d=parseInt(i.getAttribute("offset")),c=parseInt(i.getAttribute("set")),l=c>0?r+c:r;e.inputs[l]={id:a,offset:d},e.stride=Math.max(e.stride,d+1),r==="TEXCOORD"&&(e.hasUV=!0);break;case"vcount":e.vcount=Q(i.textContent);break;case"p":e.p=Q(i.textContent);break}}return e}function Ut(t){const e={};for(let s=0;s<t.length;s++){const n=t[s];e[n.type]===void 0&&(e[n.type]=[]),e[n.type].push(n)}return e}function Bt(t){let e=0;for(let s=0,n=t.length;s<n;s++)t[s].hasUV===!0&&e++;e>0&&e<t.length&&(t.uvsNeedsFix=!0)}function Fe(t){const e={},s=t.sources,n=t.vertices,i=t.primitives;if(i.length===0)return{};const a=Ut(i);for(const r in a){const d=a[r];Bt(d),e[r]=zt(d,s,n)}return e}function zt(t,e,s){const n={},i={array:[],stride:0},a={array:[],stride:0},r={array:[],stride:0},d={array:[],stride:0},c={array:[],stride:0},l={array:[],stride:4},m={array:[],stride:4},o=new jn,p=[];let f=0;for(let g=0;g<t.length;g++){const b=t[g],G=b.inputs;let x=0;switch(b.type){case"lines":case"linestrips":x=b.count*2;break;case"triangles":x=b.count*3;break;case"polylist":for(let T=0;T<b.count;T++){const E=b.vcount[T];switch(E){case 3:x+=3;break;case 4:x+=6;break;default:x+=(E-2)*3;break}}break;default:console.warn("THREE.ColladaLoader: Unknown primitive type:",b.type)}o.addGroup(f,x,g),f+=x,b.material&&p.push(b.material);for(const T in G){const E=G[T];switch(T){case"VERTEX":for(const Y in s){const F=s[Y];switch(Y){case"POSITION":const le=i.array.length;if(J(b,e[F],E.offset,i.array),i.stride=e[F].stride,e.skinWeights&&e.skinIndices&&(J(b,e.skinIndices,E.offset,l.array),J(b,e.skinWeights,E.offset,m.array)),b.hasUV===!1&&t.uvsNeedsFix===!0){const yn=(i.array.length-le)/i.stride;for(let st=0;st<yn;st++)r.array.push(0,0)}break;case"NORMAL":J(b,e[F],E.offset,a.array),a.stride=e[F].stride;break;case"COLOR":J(b,e[F],E.offset,c.array),c.stride=e[F].stride;break;case"TEXCOORD":J(b,e[F],E.offset,r.array),r.stride=e[F].stride;break;case"TEXCOORD1":J(b,e[F],E.offset,d.array),r.stride=e[F].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',Y)}}break;case"NORMAL":J(b,e[E.id],E.offset,a.array),a.stride=e[E.id].stride;break;case"COLOR":J(b,e[E.id],E.offset,c.array,!0),c.stride=e[E.id].stride;break;case"TEXCOORD":J(b,e[E.id],E.offset,r.array),r.stride=e[E.id].stride;break;case"TEXCOORD1":J(b,e[E.id],E.offset,d.array),d.stride=e[E.id].stride;break}}}return i.array.length>0&&o.setAttribute("position",new ne(i.array,i.stride)),a.array.length>0&&o.setAttribute("normal",new ne(a.array,a.stride)),c.array.length>0&&o.setAttribute("color",new ne(c.array,c.stride)),r.array.length>0&&o.setAttribute("uv",new ne(r.array,r.stride)),d.array.length>0&&o.setAttribute("uv1",new ne(d.array,d.stride)),l.array.length>0&&o.setAttribute("skinIndex",new ne(l.array,l.stride)),m.array.length>0&&o.setAttribute("skinWeight",new ne(m.array,m.stride)),n.data=o,n.type=t[0].type,n.materialKeys=p,n}function J(t,e,s,n,i=!1){const a=t.p,r=t.stride,d=t.vcount;function c(o){let p=a[o+s]*m;const f=p+m;for(;p<f;p++)n.push(l[p]);if(i){const g=n.length-m-1;Ne.setRGB(n[g+0],n[g+1],n[g+2],ee),n[g+0]=Ne.r,n[g+1]=Ne.g,n[g+2]=Ne.b}}const l=e.array,m=e.stride;if(t.vcount!==void 0){let o=0;for(let p=0,f=d.length;p<f;p++){const g=d[p];if(g===4){const b=o+r*0,G=o+r*1,x=o+r*2,T=o+r*3;c(b),c(G),c(T),c(G),c(x),c(T)}else if(g===3){const b=o+r*0,G=o+r*1,x=o+r*2;c(b),c(G),c(x)}else if(g>4)for(let b=1,G=g-2;b<=G;b++){const x=o+r*0,T=o+r*b,E=o+r*(b+1);c(x),c(T),c(E)}o+=r*g}}else for(let o=0,p=a.length;o<p;o+=r)c(o)}function Ve(t){return z(w.geometries[t],Fe)}function Ft(t){const e={name:t.getAttribute("name")||"",joints:{},links:[]};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"technique_common":Dt(n,e);break}}w.kinematicsModels[t.getAttribute("id")]=e}function Vt(t){return t.build!==void 0?t.build:t}function Kt(t){return z(w.kinematicsModels[t],Vt)}function Dt(t,e){for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"joint":e.joints[n.getAttribute("sid")]=Wt(n);break;case"link":e.links.push(Ke(n));break}}}function Wt(t){let e;for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"prismatic":case"revolute":e=Jt(n);break}}return e}function Jt(t){const e={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",axis:new $,limits:{min:0,max:0},type:t.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"axis":const i=L(n.textContent);e.axis.fromArray(i);break;case"limits":const a=n.getElementsByTagName("max")[0],r=n.getElementsByTagName("min")[0];e.limits.max=parseFloat(a.textContent),e.limits.min=parseFloat(r.textContent);break}}return e.limits.min>=e.limits.max&&(e.static=!0),e.middlePosition=(e.limits.min+e.limits.max)/2,e}function Ke(t){const e={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",attachments:[],transforms:[]};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"attachment_full":e.attachments.push(Yt(n));break;case"matrix":case"translate":case"rotate":e.transforms.push(De(n));break}}return e}function Yt(t){const e={joint:t.getAttribute("joint").split("/").pop(),transforms:[],links:[]};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"link":e.links.push(Ke(n));break;case"matrix":case"translate":case"rotate":e.transforms.push(De(n));break}}return e}function De(t){const e={type:t.nodeName},s=L(t.textContent);switch(e.type){case"matrix":e.obj=new X,e.obj.fromArray(s).transpose();break;case"translate":e.obj=new $,e.obj.fromArray(s);break;case"rotate":e.obj=new $,e.obj.fromArray(s),e.angle=pe.degToRad(s[3]);break}return e}function Xt(t){const e={name:t.getAttribute("name")||"",rigidBodies:{}};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"rigid_body":e.rigidBodies[n.getAttribute("name")]={},Qt(n,e.rigidBodies[n.getAttribute("name")]);break}}w.physicsModels[t.getAttribute("id")]=e}function Qt(t,e){for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"technique_common":Zt(n,e);break}}}function Zt(t,e){for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"inertia":e.inertia=L(n.textContent);break;case"mass":e.mass=L(n.textContent)[0];break}}}function $t(t){const e={bindJointAxis:[]};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"bind_joint_axis":e.bindJointAxis.push(en(n));break}}w.kinematicsScenes[S(t.getAttribute("url"))]=e}function en(t){const e={target:t.getAttribute("target").split("/").pop()};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"axis":const i=n.getElementsByTagName("param")[0];e.axis=i.textContent;const a=e.axis.split("inst_").pop().split("axis")[0];e.jointIndex=a.substring(0,a.length-1);break}}return e}function tn(t){return t.build!==void 0?t.build:t}function nn(t){return z(w.kinematicsScenes[t],tn)}function sn(){const t=Object.keys(w.kinematicsModels)[0],e=Object.keys(w.kinematicsScenes)[0],s=Object.keys(w.visualScenes)[0];if(t===void 0||e===void 0)return;const n=Kt(t),i=nn(e),a=Ze(s),r=i.bindJointAxis,d={};for(let m=0,o=r.length;m<o;m++){const p=r[m],f=H.querySelector('[sid="'+p.target+'"]');if(f){const g=f.parentElement;c(p.jointIndex,g)}}function c(m,o){const p=o.getAttribute("name"),f=n.joints[m];a.traverse(function(g){g.name===p&&(d[m]={object:g,transforms:an(o),joint:f,position:f.zeroPosition})})}const l=new X;nt={joints:n&&n.joints,getJointValue:function(m){const o=d[m];if(o)return o.position;console.warn("THREE.ColladaLoader: Joint "+m+" doesn't exist.")},setJointValue:function(m,o){const p=d[m];if(p){const f=p.joint;if(o>f.limits.max||o<f.limits.min)console.warn("THREE.ColladaLoader: Joint "+m+" value "+o+" outside of limits (min: "+f.limits.min+", max: "+f.limits.max+").");else if(f.static)console.warn("THREE.ColladaLoader: Joint "+m+" is static.");else{const g=p.object,b=f.axis,G=p.transforms;K.identity();for(let x=0;x<G.length;x++){const T=G[x];if(T.sid&&T.sid.indexOf(m)!==-1)switch(f.type){case"revolute":K.multiply(l.makeRotationAxis(b,pe.degToRad(o)));break;case"prismatic":K.multiply(l.makeTranslation(b.x*o,b.y*o,b.z*o));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+f.type);break}else switch(T.type){case"matrix":K.multiply(T.obj);break;case"translate":K.multiply(l.makeTranslation(T.obj.x,T.obj.y,T.obj.z));break;case"scale":K.scale(T.obj);break;case"rotate":K.multiply(l.makeRotationAxis(T.obj,T.angle));break}}g.matrix.copy(K),g.matrix.decompose(g.position,g.quaternion,g.scale),d[m].position=o}}else console.log("THREE.ColladaLoader: "+m+" does not exist.")}}}function an(t){const e=[],s=H.querySelector('[id="'+t.id+'"]');for(let n=0;n<s.childNodes.length;n++){const i=s.childNodes[n];if(i.nodeType!==1)continue;let a,r;switch(i.nodeName){case"matrix":a=L(i.textContent);const d=new X().fromArray(a).transpose();e.push({sid:i.getAttribute("sid"),type:i.nodeName,obj:d});break;case"translate":case"scale":a=L(i.textContent),r=new $().fromArray(a),e.push({sid:i.getAttribute("sid"),type:i.nodeName,obj:r});break;case"rotate":a=L(i.textContent),r=new $().fromArray(a);const c=pe.degToRad(a[3]);e.push({sid:i.getAttribute("sid"),type:i.nodeName,obj:r,angle:c});break}}return e}function rn(t){const e=t.getElementsByTagName("node");for(let s=0;s<e.length;s++){const n=e[s];n.hasAttribute("id")===!1&&n.setAttribute("id",de())}}const K=new X,oe=new $;function Me(t){const e={name:t.getAttribute("name")||"",type:t.getAttribute("type"),id:t.getAttribute("id"),sid:t.getAttribute("sid"),matrix:new X,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType!==1)continue;let i;switch(n.nodeName){case"node":e.nodes.push(n.getAttribute("id")),Me(n);break;case"instance_camera":e.instanceCameras.push(S(n.getAttribute("url")));break;case"instance_controller":e.instanceControllers.push(We(n));break;case"instance_light":e.instanceLights.push(S(n.getAttribute("url")));break;case"instance_geometry":e.instanceGeometries.push(We(n));break;case"instance_node":e.instanceNodes.push(S(n.getAttribute("url")));break;case"matrix":i=L(n.textContent),e.matrix.multiply(K.fromArray(i).transpose()),e.transforms[n.getAttribute("sid")]=n.nodeName;break;case"translate":i=L(n.textContent),oe.fromArray(i),e.matrix.multiply(K.makeTranslation(oe.x,oe.y,oe.z)),e.transforms[n.getAttribute("sid")]=n.nodeName;break;case"rotate":i=L(n.textContent);const a=pe.degToRad(i[3]);e.matrix.multiply(K.makeRotationAxis(oe.fromArray(i),a)),e.transforms[n.getAttribute("sid")]=n.nodeName;break;case"scale":i=L(n.textContent),e.matrix.scale(oe.fromArray(i)),e.transforms[n.getAttribute("sid")]=n.nodeName;break;case"extra":break;default:console.log(n)}}return Xe(e.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",e.id):w.nodes[e.id]=e,e}function We(t){const e={id:S(t.getAttribute("url")),materials:{},skeletons:[]};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];switch(n.nodeName){case"bind_material":const i=n.getElementsByTagName("instance_material");for(let a=0;a<i.length;a++){const r=i[a],d=r.getAttribute("symbol"),c=r.getAttribute("target");e.materials[d]=S(c)}break;case"skeleton":e.skeletons.push(S(n.textContent));break}}return e}function on(t,e){const s=[],n=[];let i,a,r;for(i=0;i<t.length;i++){const l=t[i];let m;if(Xe(l))m=ce(l),Je(m,e,s);else if(fn(l)){const p=w.visualScenes[l].children;for(let f=0;f<p.length;f++){const g=p[f];if(g.type==="JOINT"){const b=ce(g.id);Je(b,e,s)}}}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",l)}for(i=0;i<e.length;i++)for(a=0;a<s.length;a++)if(r=s[a],r.bone.name===e[i].name){n[i]=r,r.processed=!0;break}for(i=0;i<s.length;i++)r=s[i],r.processed===!1&&(n.push(r),r.processed=!0);const d=[],c=[];for(i=0;i<n.length;i++)r=n[i],d.push(r.bone),c.push(r.boneInverse);return new zn(d,c)}function Je(t,e,s){t.traverse(function(n){if(n.isBone===!0){let i;for(let a=0;a<e.length;a++){const r=e[a];if(r.name===n.name){i=r.boneInverse;break}}i===void 0&&(i=new X),s.push({bone:n,boneInverse:i,processed:!1})}})}function cn(t){const e=[],s=t.matrix,n=t.nodes,i=t.type,a=t.instanceCameras,r=t.instanceControllers,d=t.instanceLights,c=t.instanceGeometries,l=t.instanceNodes;for(let o=0,p=n.length;o<p;o++)e.push(ce(n[o]));for(let o=0,p=a.length;o<p;o++){const f=Mt(a[o]);f!==null&&e.push(f.clone())}for(let o=0,p=r.length;o<p;o++){const f=r[o],g=y(f.id),b=Ve(g.id),G=Ye(b,f.materials),x=f.skeletons,T=g.skin.joints,E=on(x,T);for(let Y=0,F=G.length;Y<F;Y++){const le=G[Y];le.isSkinnedMesh&&(le.bind(E,g.skin.bindMatrix),le.normalizeSkinWeights()),e.push(le)}}for(let o=0,p=d.length;o<p;o++){const f=jt(d[o]);f!==null&&e.push(f.clone())}for(let o=0,p=c.length;o<p;o++){const f=c[o],g=Ve(f.id),b=Ye(g,f.materials);for(let G=0,x=b.length;G<x;G++)e.push(b[G])}for(let o=0,p=l.length;o<p;o++)e.push(ce(l[o]).clone());let m;if(n.length===0&&e.length===1)m=e[0];else{m=i==="JOINT"?new qn:new dt;for(let o=0;o<e.length;o++)m.add(e[o])}return m.name=i==="JOINT"?t.sid:t.name,m.matrix.copy(s),m.matrix.decompose(m.position,m.quaternion,m.scale),m}const ln=new at({name:it.DEFAULT_MATERIAL_NAME,color:16711935});function dn(t,e){const s=[];for(let n=0,i=t.length;n<i;n++){const a=e[t[n]];a===void 0?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",t[n]),s.push(ln)):s.push(Ct(a))}return s}function Ye(t,e){const s=[];for(const n in t){const i=t[n],a=dn(i.materialKeys,e);if(a.length===0&&(n==="lines"||n==="linestrips"?a.push(new ft):a.push(new ct)),n==="lines"||n==="linestrips")for(let l=0,m=a.length;l<m;l++){const o=a[l];if(o.isMeshPhongMaterial===!0||o.isMeshLambertMaterial===!0){const p=new ft;p.color.copy(o.color),p.opacity=o.opacity,p.transparent=o.transparent,a[l]=p}}const r=i.data.attributes.skinIndex!==void 0,d=a.length===1?a[0]:a;let c;switch(n){case"lines":c=new Bn(i.data,d);break;case"linestrips":c=new Un(i.data,d);break;case"triangles":case"polylist":r?c=new Pn(i.data,d):c=new Hn(i.data,d);break}s.push(c)}return s}function Xe(t){return w.nodes[t]!==void 0}function ce(t){return z(w.nodes[t],cn)}function un(t){const e={name:t.getAttribute("name"),children:[]};rn(t);const s=U(t,"node");for(let n=0;n<s.length;n++)e.children.push(Me(s[n]));w.visualScenes[t.getAttribute("id")]=e}function Qe(t){const e=new dt;e.name=t.name;const s=t.children;for(let n=0;n<s.length;n++){const i=s[n];e.add(ce(i.id))}return e}function fn(t){return w.visualScenes[t]!==void 0}function Ze(t){return z(w.visualScenes[t],Qe)}function hn(t){const e=U(t,"instance_visual_scene")[0];return Ze(S(e.getAttribute("url")))}function pn(){const t=w.clips;if(Z(t)===!0){if(Z(w.animations)===!1){const e=[];for(const s in w.animations){const n=ye(s);for(let i=0,a=n.length;i<a;i++)e.push(n[i])}Ae.push(new ot("default",-1,e))}}else for(const e in t)Ae.push(R(e))}function mn(t){let e="";const s=[t];for(;s.length;){const n=s.shift();n.nodeType===Node.TEXT_NODE?e+=n.textContent:(e+=`
2
- `,s.push(...n.childNodes))}return e.trim()}if(D.length===0)return{scene:new Tn};const $e=new DOMParser().parseFromString(D,"application/xml"),H=U($e,"COLLADA")[0],Se=$e.getElementsByTagName("parsererror")[0];if(Se!==void 0){const t=U(Se,"div")[0];let e;return t?e=t.textContent:e=mn(Se),console.error(`THREE.ColladaLoader: Failed to parse collada file.
3
- `,e),null}const bn=H.getAttribute("version");console.debug("THREE.ColladaLoader: File version",bn);const et=xe(U(H,"asset")[0]),tt=new En(this.manager);tt.setPath(this.resourcePath||se).setCrossOrigin(this.crossOrigin);let Oe;pt&&(Oe=new pt(this.manager),Oe.setPath(this.resourcePath||se));const Ne=new rt,Ae=[];let nt={},gn=0;const w={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};B(H,"library_animations","animation",ue),B(H,"library_animation_clips","animation_clip",h),B(H,"library_controllers","controller",C),B(H,"library_images","image",u),B(H,"library_effects","effect",W),B(H,"library_materials","material",_t),B(H,"library_cameras","camera",vt),B(H,"library_lights","light",St),B(H,"library_geometries","geometry",qt),B(H,"library_nodes","node",Me),B(H,"library_visual_scenes","visual_scene",un),B(H,"library_kinematics_models","kinematics_model",Ft),B(H,"library_physics_models","physics_model",Xt),B(H,"scene","instance_kinematics_scene",$t),V(w.animations,ge),V(w.clips,q),V(w.controllers,A),V(w.images,k),V(w.effects,He),V(w.materials,Ue),V(w.cameras,Be),V(w.lights,ze),V(w.geometries,Fe),V(w.visualScenes,Qe),pn(),sn();const Te=hn(U(H,"scene")[0]);return Te.animations=Ae,et.upAxis==="Z_UP"&&(console.warn("THREE.ColladaLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted, see #24289."),Te.rotation.set(-Math.PI/2,0,0)),Te.scale.multiplyScalar(et.unit),{get animations(){return console.warn("THREE.ColladaLoader: Please access animations over scene.animations now."),Ae},kinematics:nt,library:w,scene:Te}}}export{Vn as ColladaLoader};
@@ -1 +0,0 @@
1
- import{a as p}from"./jsx-runtime-DPjLkJKQ.js";import{F as f,G as d,t as v,H as S,I as x,J as b}from"./index-cpXNKgvz.js";import{r as u}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{a as h}from"./live-mixers-BRkRHd6g.js";import{O as j}from"./StageHost-D-o8MsFS.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-ZILb6uB7.js";import"./viewport-surface-status-DuININWe.js";import"./model-inspection-JC6gbV8Q.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-DrFzvAAB.js";import"./LineSegments2-C8H20K8w.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function w(s){const t=new Set;return s.traverse(r=>{const o=h(r);if(o)for(const e of o.clips.values())t.add(e);for(const e of r.animations)t.add(e)}),[...t]}function E({documentId:s,source:t,sourcePath:r,displayName:o,active:e,chromeless:i=!1,revision:n=0,modelSource:c}){const l=u.useCallback(()=>{const a=S(x(t)),m=w(t);return a.animations=[...m],{root:a,animations:m,dispose(){b(a)}}},[t,n]);return p.jsx(j,{documentId:s,sourcePath:r??o,displayName:o,build:l,active:e,chromeless:i,rendererLane:i?"inspector-preview":"own",assetType:"entity",...c?{modelSource:c}:{}})}function z({documentId:s,entityId:t,displayName:r,active:o}){const e=f(d()),i=u.useSyncExternalStore(e.subscribe,e.getSnapshot),n=e.objectMap.get(t);return n?p.jsx(E,{documentId:s,source:n,sourcePath:`Entity ${t}`,displayName:r,active:o,revision:i,modelSource:{kind:"entity",entityId:t}}):p.jsxs("div",{role:"alert",style:{padding:20,color:v.semantic.danger},children:["Scene entity ",t," is no longer available."]})}export{z as EntityModelDocument,E as Object3DSnapshotDocument};
@@ -1 +0,0 @@
1
- import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{P as M,K as C,L as D,M as k,t as y,A as R,N as A,O as P,Q as b}from"./index-cpXNKgvz.js";import{r as f}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{E as z,W as O,e as L,A as I,f as T,g as B,h as F,i as H,j as G,k as E,l as j,m as S,n as N,b as $}from"./three.module-ZILb6uB7.js";import{O as q}from"./OrbitControls-DrFzvAAB.js";import{s as _}from"./asset-editor-persistence-DGD05u26.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";function U(e){return e.split("/").pop()??e}function v(e,t,r){return Math.min(r,Math.max(t,e))}function W(e){return e.split(/[?#]/,1)[0].toLowerCase().endsWith(".exr")}async function X(e){const t=W(e)?"EXR":"HDR",s=await(t==="EXR"?new A:new P).loadAsync(e),p=s.image,n=p.width??0,a=p.height??0,c=n>0&&a>0&&Math.abs(n/a-2)<=.04;return s.mapping=z,s.needsUpdate=!0,{texture:s,width:n,height:a,format:t,panorama:c}}function K(e){const t=new T,r=new B(38,1,.05,100);r.position.set(6.2,3.4,7.8),r.lookAt(0,.7,0);const s=[],p=[];if(!e.panorama){t.background=new F("#11141b");const i=e.width>0&&e.height>0?e.width/e.height:1,d=new H(i>=1?4.8:4.8*i,i>=1?4.8/i:4.8),m=new G({map:e.texture,toneMapped:!0});return s.push(d),p.push(m),t.add(new E(d,m)),r.position.set(0,0,6.5),r.lookAt(0,0,0),{scene:t,camera:r,geometries:s,materials:p}}t.background=e.texture,t.environment=e.texture;const n=(i,d,m)=>{s.push(i),p.push(d);const x=new E(i,d);x.position.set(...m),t.add(x)};n(new S(1,64,40),new j({color:"#d8dde5",roughness:.08,metalness:1}),[-2.3,1.15,0]),n(new S(1,64,40),new j({color:"#c97341",roughness:.32,metalness:.25}),[0,1.15,0]),n(new S(1,64,40),new j({color:"#d7d5cf",roughness:.82,metalness:0}),[2.3,1.15,0]);const a=new N(5.7,96),c=new j({color:"#737881",roughness:.58,metalness:0});s.push(a),p.push(c);const l=new E(a,c);return l.rotation.x=-Math.PI/2,l.position.y=.08,t.add(l),{scene:t,camera:r,geometries:s,materials:p}}function Q({image:e,settingsRef:t}){const r=f.useRef(null);return f.useEffect(()=>{const s=r.current;if(!s)return;let p=!1,n=0;const a=document.createElement("canvas");a.setAttribute("aria-label",`${e.format} environment preview`),a.style.width="100%",a.style.height="100%",a.style.display="block",s.replaceChildren(a);const c=new O({canvas:a,antialias:!0});c.outputColorSpace=L,c.toneMapping=I;const l=K(e),i=new q(l.camera,a);i.target.set(0,e.panorama?.8:0,0),i.enableDamping=!0,i.enablePan=!1,i.minDistance=e.panorama?3.8:4,i.maxDistance=e.panorama?14:10,i.update();const d={width:1,height:1},m=()=>{const u=t.current;if(c.toneMappingExposure=v(u.exposure,.05,8),e.panorama){const h=$.degToRad(u.rotation);l.scene.backgroundRotation.y=h,l.scene.environmentRotation.y=h,l.scene.backgroundBlurriness=v(u.blur,0,1),l.scene.environmentIntensity=v(u.intensity,0,8)}i.update(),c.render(l.scene,l.camera)},x=()=>{const u=s.getBoundingClientRect();d.width=Math.max(1,Math.floor(u.width)),d.height=Math.max(1,Math.floor(u.height)),c.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),c.setSize(d.width,d.height,!1),l.camera.aspect=d.width/d.height,l.camera.updateProjectionMatrix(),m()};x();const w=new ResizeObserver(x);w.observe(s);const g=()=>{p||(m(),n=requestAnimationFrame(g))};return n=requestAnimationFrame(g),()=>{p=!0,cancelAnimationFrame(n),w.disconnect(),i.dispose();for(const u of l.geometries)u.dispose();for(const u of l.materials)u.dispose();c.dispose(),a.remove()}},[e,t]),o.jsx("div",{ref:r,"data-testid":"environment-preview",style:{width:"100%",height:"100%",minHeight:260,background:"#11141b"}})}function V({panorama:e,settings:t,onChange:r}){return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:4},children:[o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Exposure",o.jsx(b,{value:t.exposure,onChange:s=>r({...t,exposure:v(s,.05,8)}),step:.05,precision:2})]}),e&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Lighting intensity",o.jsx(b,{value:t.intensity,onChange:s=>r({...t,intensity:v(s,0,8)}),step:.05,precision:2})]}),o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Rotation",o.jsx(b,{value:t.rotation,onChange:s=>r({...t,rotation:s%360}),step:1,precision:0})]}),o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Background blur",o.jsx(b,{value:t.blur,onChange:s=>r({...t,blur:v(s,0,1)}),step:.05,precision:2})]})]}),o.jsx("div",{style:{color:y.content.muted,fontSize:10,lineHeight:1.45},children:"Preview controls are session-only. Bind the image, orientation, and accepted intensity in the owning scene source."})]})}function ce({documentId:e,assetPath:t,active:r=!0}){const[s,p]=f.useState(0),[n,a]=f.useState(null),[c,l]=f.useState(null),[i,d]=f.useState({exposure:1,intensity:1,rotation:0,blur:0}),m=f.useRef(i);m.current=i,f.useEffect(()=>{if(r)return _(t,()=>p(g=>g+1))},[r,t]),f.useEffect(()=>{if(!r)return;let g=!1,u=null;return a(null),l(null),X(t).then(h=>{if(u=h,g){h.texture.dispose();return}a(h)},h=>{g||l(h instanceof Error?h.message:String(h))}),()=>{g=!0,u?.texture.dispose()}},[r,t,s]);const x=f.useMemo(()=>[{id:"environment-image",title:"Environment Image",icon:C,order:M,body:{kind:"custom",...n?{data:{format:n.format,width:n.width,height:n.height,panorama:n.panorama}}:{},render:()=>o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"6px 10px"},children:[o.jsx("span",{style:{color:y.content.muted},children:"Format"}),o.jsx("span",{children:n?.format??"—"}),o.jsx("span",{style:{color:y.content.muted},children:"Resolution"}),o.jsx("span",{children:n?`${n.width} × ${n.height}`:"—"}),o.jsx("span",{style:{color:y.content.muted},children:"Projection"}),o.jsx("span",{children:n?.panorama?"2:1 equirectangular":"Flat image"})]})}},{id:"environment-preview-settings",title:"Preview",icon:k,order:D,body:{kind:"custom",data:{...i},render:()=>o.jsx(V,{panorama:n?.panorama??!1,settings:i,onChange:d})}}],[n,i]),w=U(t);return c?o.jsx(R,{documentId:e,active:r,type:"environment image",title:w,status:"HDR image unavailable",children:o.jsx("div",{role:"alert",style:{padding:20,color:y.semantic.danger},children:c})}):n?o.jsx(R,{documentId:e,active:r,type:"environment image",title:w,sections:x,status:`${n.format} · ${n.width} × ${n.height}`,fill:!0,children:o.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0},children:[o.jsx(Q,{image:n,settingsRef:m}),o.jsx("div",{style:{position:"absolute",left:12,bottom:12,padding:"4px 7px",borderRadius:4,background:"rgba(12,14,20,0.72)",color:"#f2f4f8",fontSize:10,pointerEvents:"none"},children:n.panorama?"Drag to orbit · wheel to frame":"Non-2:1 image · flat preview"})]})}):o.jsx(R,{documentId:e,active:r,type:"environment image",title:w,status:"Loading HDR image",children:o.jsx("div",{style:{padding:20,color:y.content.muted},children:"Loading environment…"})})}export{ce as EnvironmentAssetDocument};
@@ -1 +0,0 @@
1
- import{o as G,V as M,bs as ue,a0 as Z,aQ as he,a2 as fe,aT as me,q as $,a3 as J,ab as de,aN as _,b5 as ge,aR as B,h as b,e as D,E as ye,d as I,aJ as ee,aV as te,c as W,aD as K,g as ve,b8 as ne,b as S,b7 as we,a$ as Te,b9 as Ie,k as Fe,aL as xe,ba as Pe,aU as Ae,b6 as Se,ak as Q,aK as V,bt as Ee,ap as De,a as Le,bu as Me,aA as O,aY as ke,Q as R,aW as Ce,aX as re,bv as be}from"./three.module-ZILb6uB7.js";import{bZ as Re}from"./index-cpXNKgvz.js";import"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";function ae(h,e,t){const n=t.length-h-1;if(e>=t[n])return n-1;if(e<=t[h])return h;let r=h,s=n,i=Math.floor((r+s)/2);for(;e<t[i]||e>=t[i+1];)e<t[i]?s=i:r=i,i=Math.floor((r+s)/2);return i}function Be(h,e,t,n){const r=[],s=[],i=[];r[0]=1;for(let a=1;a<=t;++a){s[a]=e-n[h+1-a],i[a]=n[h+a]-e;let o=0;for(let l=0;l<a;++l){const p=i[l+1],c=s[a-l],u=r[l]/(p+c);r[l]=o+p*u,o=c*u}r[a]=o}return r}function Oe(h,e,t,n){const r=ae(h,n,e),s=Be(r,n,h,e),i=new G(0,0,0,0);for(let a=0;a<=h;++a){const o=t[r-h+a],l=s[a],p=o.w*l;i.x+=o.x*p,i.y+=o.y*p,i.z+=o.z*p,i.w+=o.w*l}return i}function Ve(h,e,t,n,r){const s=[];for(let c=0;c<=t;++c)s[c]=0;const i=[];for(let c=0;c<=n;++c)i[c]=s.slice(0);const a=[];for(let c=0;c<=t;++c)a[c]=s.slice(0);a[0][0]=1;const o=s.slice(0),l=s.slice(0);for(let c=1;c<=t;++c){o[c]=e-r[h+1-c],l[c]=r[h+c]-e;let u=0;for(let f=0;f<c;++f){const m=l[f+1],g=o[c-f];a[c][f]=m+g;const d=a[f][c-1]/a[c][f];a[f][c]=u+m*d,u=g*d}a[c][c]=u}for(let c=0;c<=t;++c)i[0][c]=a[c][t];for(let c=0;c<=t;++c){let u=0,f=1;const m=[];for(let g=0;g<=t;++g)m[g]=s.slice(0);m[0][0]=1;for(let g=1;g<=n;++g){let d=0;const w=c-g,T=t-g;c>=g&&(m[f][0]=m[u][0]/a[T+1][w],d=m[f][0]*a[w][T]);const v=w>=-1?1:-w,x=c-1<=T?g-1:t-c;for(let P=v;P<=x;++P)m[f][P]=(m[u][P]-m[u][P-1])/a[T+1][w+P],d+=m[f][P]*a[w+P][T];c<=T&&(m[f][g]=-m[u][g-1]/a[T+1][c],d+=m[f][g]*a[c][T]),i[g][c]=d;const E=u;u=f,f=E}}let p=t;for(let c=1;c<=n;++c){for(let u=0;u<=t;++u)i[c][u]*=p;p*=t-c}return i}function Ue(h,e,t,n,r){const s=r<h?r:h,i=[],a=ae(h,n,e),o=Ve(a,n,h,s,e),l=[];for(let p=0;p<t.length;++p){const c=t[p].clone(),u=c.w;c.x*=u,c.y*=u,c.z*=u,l[p]=c}for(let p=0;p<=s;++p){const c=l[a-h].clone().multiplyScalar(o[p][0]);for(let u=1;u<=h;++u)c.add(l[a-h+u].clone().multiplyScalar(o[p][u]));i[p]=c}for(let p=s+1;p<=r+1;++p)i[p]=new G(0,0,0);return i}function Xe(h,e){let t=1;for(let r=2;r<=h;++r)t*=r;let n=1;for(let r=2;r<=e;++r)n*=r;for(let r=2;r<=h-e;++r)n*=r;return t/n}function Ge(h){const e=h.length,t=[],n=[];for(let s=0;s<e;++s){const i=h[s];t[s]=new M(i.x,i.y,i.z),n[s]=i.w}const r=[];for(let s=0;s<e;++s){const i=t[s].clone();for(let a=1;a<=s;++a)i.sub(r[s-a].clone().multiplyScalar(Xe(s,a)*n[a]));r[s]=i.divideScalar(n[0])}return r}function ze(h,e,t,n,r){const s=Ue(h,e,t,n,r);return Ge(s)}class je extends ue{constructor(e,t,n,r,s){super();const i=t?t.length-1:0,a=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=s||i;for(let o=0;o<a;++o){const l=n[o];this.controlPoints[o]=new G(l.x,l.y,l.z,l.w)}}getPoint(e,t=new M){const n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),s=Oe(this.degree,this.knots,this.controlPoints,r);return s.w!==1&&s.divideScalar(s.w),n.set(s.x,s.y,s.z)}getTangent(e,t=new M){const n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),s=ze(this.degree,this.knots,this.controlPoints,r,1);return n.copy(s[1]).normalize(),n}toJSON(){const e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(t=>t.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(t=>new G(t[0],t[1],t[2],t[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}}let y,F,A;class pt extends Z{constructor(e){super(e)}load(e,t,n,r){const s=this,i=s.path===""?he.extractUrlBase(e):s.path,a=new fe(this.manager);a.setPath(s.path),a.setResponseType("arraybuffer"),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(o,i))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}parse(e,t){if(Qe(e))y=new Ne().parse(e);else{const r=ce(e);if(!Ye(r))throw new Error("THREE.FBXLoader: Unknown format.");if(ie(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+ie(r));y=new We().parse(r)}const n=new me(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new _e(n,this.manager).parse(y)}}class _e{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){F=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),r=this.parseDeformers(),s=new Ke().parse(r);return this.parseScene(r,s,n),A}parseConnections(){const e=new Map;return"Connections"in y&&y.Connections.connections.forEach(function(n){const r=n[0],s=n[1],i=n[2];e.has(r)||e.set(r,{parents:[],children:[]});const a={ID:s,relationship:i};e.get(r).parents.push(a),e.has(s)||e.set(s,{parents:[],children:[]});const o={ID:r,relationship:i};e.get(s).children.push(o)}),e}parseImages(){const e={},t={};if("Video"in y.Objects){const n=y.Objects.Video;for(const r in n){const s=n[r],i=parseInt(r);if(e[i]=s.RelativeFilename||s.Filename,"Content"in s){const a=s.Content instanceof ArrayBuffer&&s.Content.byteLength>0,o=typeof s.Content=="string"&&s.Content!=="";if(a||o){const l=this.parseImage(n[r]);t[s.RelativeFilename||s.Filename]=l}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let s;switch(r){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),s="image/tga";break;case"webp":s="image/webp";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in y.Objects){const n=y.Objects.Texture;for(const r in n){const s=this.parseTexture(n[r],e);t.set(parseInt(r),s)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,s=e.WrapModeV,i=r!==void 0?r.value:0,a=s!==void 0?s.value:0;if(n.wrapS=i===0?$:J,n.wrapT=a===0?$:J,"Scaling"in e){const o=e.Scaling.value;n.repeat.x=o[0],n.repeat.y=o[1]}if("Translation"in e){const o=e.Translation.value;n.offset.x=o[0],n.offset.y=o[1]}return n}loadTexture(e,t){const n=e.FileName.split(".").pop().toLowerCase();let r=this.manager.getHandler(`.${n}`);r===null&&(r=this.textureLoader);const s=r.path;s||r.setPath(this.textureLoader.path);const i=F.get(e.id).children;let a;if(i!==void 0&&i.length>0&&t[i[0].ID]!==void 0&&(a=t[i[0].ID],(a.indexOf("blob:")===0||a.indexOf("data:")===0)&&r.setPath(void 0)),a===void 0)return console.warn("FBXLoader: Undefined filename, creating placeholder texture."),new de;const o=r.load(a);return r.setPath(s),o}parseMaterials(e){const t=new Map;if("Material"in y.Objects){const n=y.Objects.Material;for(const r in n){const s=this.parseMaterial(n[r],e);s!==null&&t.set(parseInt(r),s)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!F.has(n))return null;const i=this.parseParameters(e,t,n);let a;switch(s.toLowerCase()){case"phong":a=new _;break;case"lambert":a=new ge;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new _;break}return a.setValues(i),a.name=r,a}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=B.colorSpaceToWorking(new b().fromArray(e.Diffuse.value),D):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=B.colorSpaceToWorking(new b().fromArray(e.DiffuseColor.value),D)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=B.colorSpaceToWorking(new b().fromArray(e.Emissive.value),D):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=B.colorSpaceToWorking(new b().fromArray(e.EmissiveColor.value),D)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),r.opacity=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0),(r.opacity===1||r.opacity===0)&&(r.opacity=e.Opacity?parseFloat(e.Opacity.value):null,r.opacity===null&&(r.opacity=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=B.colorSpaceToWorking(new b().fromArray(e.Specular.value),D):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=B.colorSpaceToWorking(new b().fromArray(e.SpecularColor.value),D));const s=this;return F.get(n).children.forEach(function(i){const a=i.relationship;switch(a){case"Bump":r.bumpMap=s.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=s.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=s.getTexture(t,i.ID),r.map!==void 0&&(r.map.colorSpace=D);break;case"DisplacementColor":r.displacementMap=s.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=s.getTexture(t,i.ID),r.emissiveMap!==void 0&&(r.emissiveMap.colorSpace=D);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=s.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=s.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=ye,r.envMap.colorSpace=D);break;case"SpecularColor":r.specularMap=s.getTexture(t,i.ID),r.specularMap!==void 0&&(r.specularMap.colorSpace=D);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=s.getTexture(t,i.ID),r.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),r}getTexture(e,t){return"LayeredTexture"in y.Objects&&t in y.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=F.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in y.Objects){const n=y.Objects.Deformer;for(const r in n){const s=n[r],i=F.get(parseInt(r));if(s.attrType==="Skin"){const a=this.parseSkeleton(i,n);a.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=i.parents[0].ID,e[r]=a}else if(s.attrType==="BlendShape"){const a={id:r};a.rawTargets=this.parseMorphTargets(i,n),a.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const s=t[r.ID];if(s.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new I().fromArray(s.TransformLink.a)};"Indexes"in s&&(i.indices=s.Indexes.a,i.weights=s.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r<e.children.length;r++){const s=e.children[r],i=t[s.ID],a={name:i.attrName,initialWeight:i.DeformPercent,id:i.id,fullWeights:i.FullWeights.a};if(i.attrType!=="BlendShapeChannel")return;a.geoID=F.get(parseInt(s.ID)).children.filter(function(o){return o.relationship===void 0})[0].ID,n.push(a)}return n}parseScene(e,t,n){A=new ee;const r=this.parseModels(e.skeletons,t,n),s=y.Objects.Model,i=this;r.forEach(function(o){const l=s[o.ID];i.setLookAtProperties(o,l),F.get(o.ID).parents.forEach(function(c){const u=r.get(c.ID);u!==void 0&&u.add(o)}),o.parent===null&&A.add(o)}),this.bindSkeleton(e.skeletons,t,r),this.addGlobalSceneSettings(),A.traverse(function(o){if(o.userData.transformData){o.parent&&(o.userData.transformData.parentMatrix=o.parent.matrix,o.userData.transformData.parentMatrixWorld=o.parent.matrixWorld);const l=le(o.userData.transformData);o.applyMatrix4(l),o.updateWorldMatrix()}});const a=new He().parse();A.children.length===1&&A.children[0].isGroup&&(A.children[0].animations=a,A=A.children[0]),A.animations=a}parseModels(e,t,n){const r=new Map,s=y.Objects.Model;for(const i in s){const a=parseInt(i),o=s[i],l=F.get(a);let p=this.buildSkeleton(l,e,a,o.attrName);if(!p){switch(o.attrType){case"Camera":p=this.createCamera(l);break;case"Light":p=this.createLight(l);break;case"Mesh":p=this.createMesh(l,t,n);break;case"NurbsCurve":p=this.createCurve(l,t);break;case"LimbNode":case"Root":p=new te;break;case"Null":default:p=new ee;break}p.name=o.attrName?W.sanitizeNodeName(o.attrName):"",p.userData.originalName=o.attrName,p.ID=a}this.getTransformData(p,o),r.set(a,p)}return r}buildSkeleton(e,t,n,r){let s=null;return e.parents.forEach(function(i){for(const a in t){const o=t[a];o.rawBones.forEach(function(l,p){if(l.ID===i.ID){const c=s;s=new te,s.matrixWorld.copy(l.transformLink),s.name=r?W.sanitizeNodeName(r):"",s.userData.originalName=r,s.ID=n,o.bones[p]=s,c!==null&&s.add(c)}})}}),s}createCamera(e){let t,n;if(e.children.forEach(function(r){const s=y.Objects.NodeAttribute[r.ID];s!==void 0&&(n=s)}),n===void 0)t=new K;else{let r=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(r=1);let s=1;n.NearPlane!==void 0&&(s=n.NearPlane.value/1e3);let i=1e3;n.FarPlane!==void 0&&(i=n.FarPlane.value/1e3);let a=window.innerWidth,o=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(a=n.AspectWidth.value,o=n.AspectHeight.value);const l=a/o;let p=45;n.FieldOfView!==void 0&&(p=n.FieldOfView.value);const c=n.FocalLength?n.FocalLength.value:null;switch(r){case 0:t=new ve(p,l,s,i),c!==null&&t.setFocalLength(c);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),t=new K;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),t=new K;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(r){const s=y.Objects.NodeAttribute[r.ID];s!==void 0&&(n=s)}),n===void 0)t=new K;else{let r;n.LightType===void 0?r=0:r=n.LightType.value;let s=16777215;n.Color!==void 0&&(s=B.colorSpaceToWorking(new b().fromArray(n.Color.value),D));let i=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(i=0);let a=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?a=0:a=n.FarAttenuationEnd.value);const o=1;switch(r){case 0:t=new ne(s,i,a,o);break;case 1:t=new Te(s,i);break;case 2:let l=Math.PI/3;n.InnerAngle!==void 0&&(l=S.degToRad(n.InnerAngle.value));let p=0;n.OuterAngle!==void 0&&(p=S.degToRad(n.OuterAngle.value),p=Math.max(p,1)),t=new we(s,i,a,l,p,o);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new ne(s,i);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let r,s=null,i=null;const a=[];if(e.children.forEach(function(o){t.has(o.ID)&&(s=t.get(o.ID)),n.has(o.ID)&&a.push(n.get(o.ID))}),a.length>1?i=a:a.length>0?i=a[0]:(i=new _({name:Z.DEFAULT_MATERIAL_NAME,color:13421772}),a.push(i)),"color"in s.attributes&&a.forEach(function(o){o.vertexColors=!0}),s.groups.length>0){let o=!1;for(let l=0,p=s.groups.length;l<p;l++){const c=s.groups[l];(c.materialIndex<0||c.materialIndex>=a.length)&&(c.materialIndex=a.length,o=!0)}if(o){const l=new _;a.push(l)}}return s.FBX_Deformer?(r=new Ie(s,i),r.normalizeSkinWeights()):r=new Fe(s,i),r}createCurve(e,t){const n=e.children.reduce(function(s,i){return t.has(i.ID)&&(s=t.get(i.ID)),s},null),r=new xe({name:Z.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new Pe(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=z(t.RotationOrder.value):n.eulerOrder=z(0),"Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&F.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const s=y.Objects.Model[r.ID];if("Lcl_Translation"in s){const i=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),A.add(e.target)):e.lookAt(new M().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const s in e){const i=e[s];F.get(parseInt(i.ID)).parents.forEach(function(o){if(t.has(o.ID)){const l=o.ID;F.get(l).parents.forEach(function(c){n.has(c.ID)&&n.get(c.ID).bind(new Ae(i.bones),r[c.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in y.Objects){const t=y.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(s){e[s.Node]=new I().fromArray(s.Matrix.a)}):e[r.Node]=new I().fromArray(r.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in y){if("AmbientColor"in y.GlobalSettings){const e=y.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const s=new b().setRGB(t,n,r,D);A.add(new Se(s,1))}}"UnitScaleFactor"in y.GlobalSettings&&(A.userData.unitScaleFactor=y.GlobalSettings.UnitScaleFactor.value)}}}class Ke{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in y.Objects){const n=y.Objects.Geometry;for(const r in n){const s=F.get(parseInt(r)),i=this.parseGeometry(s,n[r],e);t.set(parseInt(r),i)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,s=[],i=e.parents.map(function(c){return y.Objects.Model[c.ID]});if(i.length===0)return;const a=e.children.reduce(function(c,u){return r[u.ID]!==void 0&&(c=r[u.ID]),c},null);e.children.forEach(function(c){n.morphTargets[c.ID]!==void 0&&s.push(n.morphTargets[c.ID])});const o=i[0],l={};"RotationOrder"in o&&(l.eulerOrder=z(o.RotationOrder.value)),"InheritType"in o&&(l.inheritType=parseInt(o.InheritType.value)),"GeometricTranslation"in o&&(l.translation=o.GeometricTranslation.value),"GeometricRotation"in o&&(l.rotation=o.GeometricRotation.value),"GeometricScaling"in o&&(l.scale=o.GeometricScaling.value);const p=le(l);return this.genGeometry(t,a,s,p)}genGeometry(e,t,n,r){const s=new Q;e.attrName&&(s.name=e.attrName);const i=this.parseGeoNode(e,t),a=this.genBuffers(i),o=new V(a.vertex,3);if(o.applyMatrix4(r),s.setAttribute("position",o),a.colors.length>0&&s.setAttribute("color",new V(a.colors,3)),t&&(s.setAttribute("skinIndex",new Ee(a.weightsIndices,4)),s.setAttribute("skinWeight",new V(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const l=new De().getNormalMatrix(r),p=new V(a.normal,3);p.applyNormalMatrix(l),s.setAttribute("normal",p)}if(a.uvs.forEach(function(l,p){const c=p===0?"uv":`uv${p}`;s.setAttribute(c,new V(a.uvs[p],2))}),i.material&&i.material.mappingType!=="AllSame"){let l=a.materialIndex[0],p=0;if(a.materialIndex.forEach(function(c,u){c!==l&&(s.addGroup(p,u-p,l),l=c,p=u)}),s.groups.length>0){const c=s.groups[s.groups.length-1],u=c.start+c.count;u!==a.materialIndex.length&&s.addGroup(u,a.materialIndex.length-u,l)}s.groups.length===0&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,e,n,r),s}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&e.LayerElementColor[0].Colors&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,s){r.indices.forEach(function(i,a){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:s,weight:r.weights[a]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,s=!1,i=[],a=[],o=[],l=[],p=[],c=[];const u=this;return e.vertexIndices.forEach(function(f,m){let g,d=!1;f<0&&(f=f^-1,d=!0);let w=[],T=[];if(i.push(f*3,f*3+1,f*3+2),e.color){const v=H(m,n,f,e.color);o.push(v[0],v[1],v[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(v){T.push(v.weight),w.push(v.id)}),T.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const v=[0,0,0,0],x=[0,0,0,0];T.forEach(function(E,P){let C=E,L=w[P];x.forEach(function(j,X,k){if(C>j){k[X]=C,C=j;const N=v[X];v[X]=L,L=N}})}),w=v,T=x}for(;T.length<4;)T.push(0),w.push(0);for(let v=0;v<4;++v)p.push(T[v]),c.push(w[v])}if(e.normal){const v=H(m,n,f,e.normal);a.push(v[0],v[1],v[2])}e.material&&e.material.mappingType!=="AllSame"&&(g=H(m,n,f,e.material)[0],g<0&&(u.negativeMaterialIndices=!0,g=0)),e.uv&&e.uv.forEach(function(v,x){const E=H(m,n,f,v);l[x]===void 0&&(l[x]=[]),l[x].push(E[0]),l[x].push(E[1])}),r++,d&&(u.genFace(t,e,i,g,a,o,l,p,c,r),n++,r=0,i=[],a=[],o=[],l=[],p=[],c=[])}),t}getNormalNewell(e){const t=new M(0,0,0);for(let n=0;n<e.length;n++){const r=e[n],s=e[(n+1)%e.length];t.x+=(r.y-s.y)*(r.z+s.z),t.y+=(r.z-s.z)*(r.x+s.x),t.z+=(r.x-s.x)*(r.y+s.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){const t=this.getNormalNewell(e),r=(Math.abs(t.z)>.5?new M(0,1,0):new M(0,0,1)).cross(t).normalize(),s=t.clone().cross(r).normalize();return{normal:t,tangent:r,bitangent:s}}flattenVertex(e,t,n){return new Le(e.dot(t),e.dot(n))}genFace(e,t,n,r,s,i,a,o,l,p){let c;if(p>3){const u=[],f=t.baseVertexPositions||t.vertexPositions;for(let w=0;w<n.length;w+=3)u.push(new M(f[n[w]],f[n[w+1]],f[n[w+2]]));const{tangent:m,bitangent:g}=this.getNormalTangentAndBitangent(u),d=[];for(const w of u)d.push(this.flattenVertex(w,m,g));c=Me.triangulateShape(d,[])}else c=[[0,1,2]];for(const[u,f,m]of c)e.vertex.push(t.vertexPositions[n[u*3]]),e.vertex.push(t.vertexPositions[n[u*3+1]]),e.vertex.push(t.vertexPositions[n[u*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),e.vertex.push(t.vertexPositions[n[m*3]]),e.vertex.push(t.vertexPositions[n[m*3+1]]),e.vertex.push(t.vertexPositions[n[m*3+2]]),t.skeleton&&(e.vertexWeights.push(o[u*4]),e.vertexWeights.push(o[u*4+1]),e.vertexWeights.push(o[u*4+2]),e.vertexWeights.push(o[u*4+3]),e.vertexWeights.push(o[f*4]),e.vertexWeights.push(o[f*4+1]),e.vertexWeights.push(o[f*4+2]),e.vertexWeights.push(o[f*4+3]),e.vertexWeights.push(o[m*4]),e.vertexWeights.push(o[m*4+1]),e.vertexWeights.push(o[m*4+2]),e.vertexWeights.push(o[m*4+3]),e.weightsIndices.push(l[u*4]),e.weightsIndices.push(l[u*4+1]),e.weightsIndices.push(l[u*4+2]),e.weightsIndices.push(l[u*4+3]),e.weightsIndices.push(l[f*4]),e.weightsIndices.push(l[f*4+1]),e.weightsIndices.push(l[f*4+2]),e.weightsIndices.push(l[f*4+3]),e.weightsIndices.push(l[m*4]),e.weightsIndices.push(l[m*4+1]),e.weightsIndices.push(l[m*4+2]),e.weightsIndices.push(l[m*4+3])),t.color&&(e.colors.push(i[u*3]),e.colors.push(i[u*3+1]),e.colors.push(i[u*3+2]),e.colors.push(i[f*3]),e.colors.push(i[f*3+1]),e.colors.push(i[f*3+2]),e.colors.push(i[m*3]),e.colors.push(i[m*3+1]),e.colors.push(i[m*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(s[u*3]),e.normal.push(s[u*3+1]),e.normal.push(s[u*3+2]),e.normal.push(s[f*3]),e.normal.push(s[f*3+1]),e.normal.push(s[f*3+2]),e.normal.push(s[m*3]),e.normal.push(s[m*3+1]),e.normal.push(s[m*3+2])),t.uv&&t.uv.forEach(function(g,d){e.uvs[d]===void 0&&(e.uvs[d]=[]),e.uvs[d].push(a[d][u*2]),e.uvs[d].push(a[d][u*2+1]),e.uvs[d].push(a[d][f*2]),e.uvs[d].push(a[d][f*2+1]),e.uvs[d].push(a[d][m*2]),e.uvs[d].push(a[d][m*2+1])})}addMorphTargets(e,t,n,r){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const s=this;n.forEach(function(i){i.rawTargets.forEach(function(a){const o=y.Objects.Geometry[a.geoID];o!==void 0&&s.genMorphGeometry(e,t,o,r,a.name)})})}genMorphGeometry(e,t,n,r,s){const i=t.Vertices!==void 0?t.Vertices.a:[],a=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],o=n.Vertices!==void 0?n.Vertices.a:[],l=n.Indexes!==void 0?n.Indexes.a:[],p=e.attributes.position.count*3,c=new Float32Array(p);for(let g=0;g<l.length;g++){const d=l[g]*3;c[d]=o[g*3],c[d+1]=o[g*3+1],c[d+2]=o[g*3+2]}const u={vertexIndices:a,vertexPositions:c,baseVertexPositions:i},f=this.genBuffers(u),m=new V(f.vertex,3);m.name=s||n.attrName,m.applyMatrix4(r),e.morphAttributes.position.push(m)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a;let s=[];return n==="IndexToDirect"&&("NormalIndex"in e?s=e.NormalIndex.a:"NormalsIndex"in e&&(s=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:s,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a;let s=[];return n==="IndexToDirect"&&(s=e.UVIndex.a),{dataSize:2,buffer:r,indices:s,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a;let s=[];n==="IndexToDirect"&&(s=e.ColorIndex.a);for(let i=0,a=new b;i<r.length;i+=4)a.fromArray(r,i),B.colorSpaceToWorking(a,D),a.toArray(r,i);return{dataSize:4,buffer:r,indices:s,mappingType:t,referenceType:n}}parseMaterialIndices(e){const t=e.MappingInformationType,n=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const r=e.Materials.a,s=[];for(let i=0;i<r.length;++i)s.push(i);return{dataSize:1,buffer:r,indices:s,mappingType:t,referenceType:n}}parseNurbsGeometry(e){const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new Q;const n=t-1,r=e.KnotVector.a,s=[],i=e.Points.a;for(let c=0,u=i.length;c<u;c+=4)s.push(new G().fromArray(i,c));let a,o;if(e.Form==="Closed")s.push(s[0]);else if(e.Form==="Periodic"){a=n,o=r.length-1-a;for(let c=0;c<n;++c)s.push(s[c])}const p=new je(n,r,s,a,o).getPoints(s.length*12);return new Q().setFromPoints(p)}}class He{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const n in t){const r=t[n],s=this.addClip(r);e.push(s)}return e}parseClips(){if(y.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=y.Objects.AnimationCurveNode,t=new Map;for(const n in e){const r=e[n];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){const s={id:r.id,attr:r.attrName,curves:{}};t.set(s.id,s)}}return t}parseAnimationCurves(e){const t=y.Objects.AnimationCurve;for(const n in t){const r={id:t[n].id,times:t[n].KeyTime.a.map(qe),values:t[n].KeyValueFloat.a},s=F.get(r.id);if(s!==void 0){const i=s.parents[0].ID,a=s.parents[0].relationship;a.match(/X/)?e.get(i).curves.x=r:a.match(/Y/)?e.get(i).curves.y=r:a.match(/Z/)?e.get(i).curves.z=r:a.match(/DeformPercent/)&&e.has(i)&&(e.get(i).curves.morph=r)}}}parseAnimationLayers(e){const t=y.Objects.AnimationLayer,n=new Map;for(const r in t){const s=[],i=F.get(parseInt(r));i!==void 0&&(i.children.forEach(function(o,l){if(e.has(o.ID)){const p=e.get(o.ID);if(p.curves.x!==void 0||p.curves.y!==void 0||p.curves.z!==void 0){if(s[l]===void 0){const c=F.get(o.ID).parents.filter(function(u){return u.relationship!==void 0})[0].ID;if(c!==void 0){const u=y.Objects.Model[c.toString()];if(u===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",o);return}const f={modelName:u.attrName?W.sanitizeNodeName(u.attrName):"",ID:u.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};A.traverse(function(m){m.ID===u.id&&(f.transform=m.matrix,m.userData.transformData&&(f.eulerOrder=m.userData.transformData.eulerOrder))}),f.transform||(f.transform=new I),"PreRotation"in u&&(f.preRotation=u.PreRotation.value),"PostRotation"in u&&(f.postRotation=u.PostRotation.value),s[l]=f}}s[l]&&(s[l][p.attr]=p)}else if(p.curves.morph!==void 0){if(s[l]===void 0){const c=F.get(o.ID).parents.filter(function(w){return w.relationship!==void 0})[0].ID,u=F.get(c).parents[0].ID,f=F.get(u).parents[0].ID,m=F.get(f).parents[0].ID,g=y.Objects.Model[m],d={modelName:g.attrName?W.sanitizeNodeName(g.attrName):"",morphName:y.Objects.Deformer[c].attrName};s[l]=d}s[l][p.attr]=p}}}),n.set(parseInt(r),s))}return n}parseAnimStacks(e){const t=y.Objects.AnimationStack,n={};for(const r in t){const s=F.get(parseInt(r)).children;s.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(s[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ke(e.name,-1,t)}generateTracks(e){const t=[];let n=new M,r=new M;if(e.transform&&e.transform.decompose(n,new R,r),n=n.toArray(),r=r.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");s!==void 0&&t.push(s)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const s=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&&t.push(s)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.S.curves,r,"scale");s!==void 0&&t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&&t.push(s)}return t}generateVectorTrack(e,t,n,r){const s=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(s,t,n);return new Ce(e+"."+r,s,i)}generateRotationTrack(e,t,n,r,s){let i,a;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const u=this.interpolateRotations(t.x,t.y,t.z,s);i=u[0],a=u[1]}const o=z(0);n!==void 0&&(n=n.map(S.degToRad),n.push(o),n=new O().fromArray(n),n=new R().setFromEuler(n)),r!==void 0&&(r=r.map(S.degToRad),r.push(o),r=new O().fromArray(r),r=new R().setFromEuler(r).invert());const l=new R,p=new O,c=[];if(!a||!i)return new re(e+".quaternion",[0],[0]);for(let u=0;u<a.length;u+=3)p.set(a[u],a[u+1],a[u+2],s),l.setFromEuler(p),n!==void 0&&l.premultiply(n),r!==void 0&&l.multiply(r),u>2&&new R().fromArray(c,(u-3)/3*4).dot(l)<0&&l.set(-l.x,-l.y,-l.z,-l.w),l.toArray(c,u/3*4);return new re(e+".quaternion",i,c)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(s){return s/100}),r=A.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new be(e.modelName+".morphTargetInfluences["+r+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(n,r){return n-r}),t.length>1){let n=1,r=t[0];for(let s=1;s<t.length;s++){const i=t[s];i!==r&&(t[n]=i,r=i,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){const r=n,s=[];let i=-1,a=-1,o=-1;return e.forEach(function(l){if(t.x&&(i=t.x.times.indexOf(l)),t.y&&(a=t.y.times.indexOf(l)),t.z&&(o=t.z.times.indexOf(l)),i!==-1){const p=t.x.values[i];s.push(p),r[0]=p}else s.push(r[0]);if(a!==-1){const p=t.y.values[a];s.push(p),r[1]=p}else s.push(r[1]);if(o!==-1){const p=t.z.values[o];s.push(p),r[2]=p}else s.push(r[2])}),s}interpolateRotations(e,t,n,r){const s=[],i=[];s.push(e.times[0]),i.push(S.degToRad(e.values[0])),i.push(S.degToRad(t.values[0])),i.push(S.degToRad(n.values[0]));for(let a=1;a<e.values.length;a++){const o=[e.values[a-1],t.values[a-1],n.values[a-1]];if(isNaN(o[0])||isNaN(o[1])||isNaN(o[2]))continue;const l=o.map(S.degToRad),p=[e.values[a],t.values[a],n.values[a]];if(isNaN(p[0])||isNaN(p[1])||isNaN(p[2]))continue;const c=p.map(S.degToRad),u=[p[0]-o[0],p[1]-o[1],p[2]-o[2]],f=[Math.abs(u[0]),Math.abs(u[1]),Math.abs(u[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){const g=Math.max(...f)/180,d=new O(...l,r),w=new O(...c,r),T=new R().setFromEuler(d),v=new R().setFromEuler(w);T.dot(v)&&v.set(-v.x,-v.y,-v.z,-v.w);const x=e.times[a-1],E=e.times[a]-x,P=new R,C=new O;for(let L=0;L<1;L+=1/g)P.copy(T.clone().slerp(v.clone(),L)),s.push(x+L*E),C.setFromQuaternion(P,r),i.push(C.x),i.push(C.y),i.push(C.z)}else s.push(e.times[a]),i.push(S.degToRad(e.values[a])),i.push(S.degToRad(t.values[a])),i.push(S.degToRad(n.values[a]))}return[s,i]}}class We{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new oe,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(r,s){const i=r.match(/^[\s\t]*;/),a=r.match(/^[\s\t]*$/);if(i||a)return;const o=r.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),l=r.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),p=r.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(r,o):l?t.parseNodeProperty(r,l,n[++s]):p?t.popStack():r.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(r)}),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map(function(o){return o.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:n},i=this.parseNodeAttr(r),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,s):n in a?(n==="PoseNode"?a.PoseNode.push(s):a[n].id!==void 0&&(a[n]={},a[n][a[n].id]=a[n]),i.id!==""&&(a[n][i.id]=s)):typeof i.id=="number"?(a[n]={},a[n][i.id]=s):n!=="Properties70"&&(n==="PoseNode"?a[n]=[s]:a[n]=s),typeof i.id=="number"&&(s.id=i.id),i.name!==""&&(s.attrName=i.name),i.type!==""&&(s.attrType=i.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",r="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&s===","&&(s=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,s);return}if(r==="C"){const o=s.split(",").slice(1),l=parseInt(o[0]),p=parseInt(o[1]);let c=s.split(",").slice(3);c=c.map(function(u){return u.trim().replace(/^"/,"")}),r="connections",s=[l,p],$e(s,c),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=s),r in i&&Array.isArray(i[r])?i[r].push(s):r!=="a"?i[r]=s:i.a=s,this.setCurrentProp(i,r),r==="a"&&s.slice(-1)!==","&&(i.a=q(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=q(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(p){return p.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=r[0],i=r[1],a=r[2],o=r[3];let l=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=q(l);break}this.getPrevNode()[s]={type:i,type2:a,flag:o,value:l},this.setCurrentProp(this.getPrevNode(),s)}}class Ne{parse(e){const t=new se(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new oe;for(;!this.endOfContent(t);){const s=this.parseNode(t,n);s!==null&&r.add(s.name,s)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),a=e.getString(i);if(r===0)return null;const o=[];for(let u=0;u<s;u++)o.push(this.parseProperty(e));const l=o.length>0?o[0]:"",p=o.length>1?o[1]:"",c=o.length>2?o[2]:"";for(n.singleProperty=s===1&&e.getOffset()===r;r>e.getOffset();){const u=this.parseNode(e,t);u!==null&&this.parseSubNode(a,n,u)}return n.propertyList=o,typeof l=="number"&&(n.id=l),p!==""&&(n.attrName=p),c!==""&&(n.attrType=c),a!==""&&(n.name=a),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(s,i){i!==0&&r.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(s){t[s]=n[s]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],s=n.propertyList[1];const i=n.propertyList[2],a=n.propertyList[3];let o;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?o=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:o=n.propertyList[4],t[r]={type:s,type2:i,flag:a,value:o}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),s=e.getUint32(),i=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const a=Re(new Uint8Array(e.getArrayBuffer(i))),o=new se(a.buffer);switch(t){case"b":case"c":return o.getBooleanArray(r);case"d":return o.getFloat64Array(r);case"f":return o.getFloat32Array(r);case"i":return o.getInt32Array(r);case"l":return o.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class se{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){const t=this.offset;let n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);const r=n.indexOf(0);return r>=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}}class oe{add(e,t){this[e]=t}}function Qe(h){const e="Kaydara FBX Binary \0";return h.byteLength>=e.length&&e===ce(h,0,e.length)}function Ye(h){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const s=h[r-1];return h=h.slice(t+r),t++,s}for(let r=0;r<e.length;++r)if(n(1)===e[r])return!1;return!0}function ie(h){const e=/FBXVersion: (\d+)/,t=h.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function qe(h){return h/46186158e3}const Ze=[];function H(h,e,t,n){let r;switch(n.mappingType){case"ByPolygonVertex":r=h;break;case"ByPolygon":r=e;break;case"ByVertice":r=t;break;case"AllSame":r=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(r=n.indices[r]);const s=r*n.dataSize,i=s+n.dataSize;return Je(Ze,n.buffer,s,i)}const Y=new O,U=new M;function le(h){const e=new I,t=new I,n=new I,r=new I,s=new I,i=new I,a=new I,o=new I,l=new I,p=new I,c=new I,u=new I,f=h.inheritType?h.inheritType:0;h.translation&&e.setPosition(U.fromArray(h.translation));const m=z(0);if(h.preRotation){const k=h.preRotation.map(S.degToRad);k.push(m),t.makeRotationFromEuler(Y.fromArray(k))}if(h.rotation){const k=h.rotation.map(S.degToRad);k.push(h.eulerOrder||m),n.makeRotationFromEuler(Y.fromArray(k))}if(h.postRotation){const k=h.postRotation.map(S.degToRad);k.push(m),r.makeRotationFromEuler(Y.fromArray(k)),r.invert()}h.scale&&s.scale(U.fromArray(h.scale)),h.scalingOffset&&a.setPosition(U.fromArray(h.scalingOffset)),h.scalingPivot&&i.setPosition(U.fromArray(h.scalingPivot)),h.rotationOffset&&o.setPosition(U.fromArray(h.rotationOffset)),h.rotationPivot&&l.setPosition(U.fromArray(h.rotationPivot)),h.parentMatrixWorld&&(c.copy(h.parentMatrix),p.copy(h.parentMatrixWorld));const g=t.clone().multiply(n).multiply(r),d=new I;d.extractRotation(p);const w=new I;w.copyPosition(p);const T=w.clone().invert().multiply(p),v=d.clone().invert().multiply(T),x=s,E=new I;if(f===0)E.copy(d).multiply(g).multiply(v).multiply(x);else if(f===1)E.copy(d).multiply(v).multiply(g).multiply(x);else{const N=new I().scale(new M().setFromMatrixScale(c)).clone().invert(),pe=v.clone().multiply(N);E.copy(d).multiply(g).multiply(pe).multiply(x)}const P=l.clone().invert(),C=i.clone().invert();let L=e.clone().multiply(o).multiply(l).multiply(t).multiply(n).multiply(r).multiply(P).multiply(a).multiply(i).multiply(s).multiply(C);const j=new I().copyPosition(L),X=p.clone().multiply(j);return u.copyPosition(X),L=u.clone().multiply(E),L.premultiply(p.invert()),L}function z(h){h=h||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return h===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[h]}function q(h){return h.split(",").map(function(t){return parseFloat(t)})}function ce(h,e,t){return e===void 0&&(e=0),t===void 0&&(t=h.byteLength),new TextDecoder().decode(new Uint8Array(h,e,t))}function $e(h,e){for(let t=0,n=h.length,r=e.length;t<r;t++,n++)h[n]=e[t]}function Je(h,e,t,n){for(let r=t,s=0;r<n;r++,s++)h[s]=e[r];return h}export{pt as FBXLoader};
@@ -1 +0,0 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as o}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{b as B,c as H,p as W,r as M,T as v,B as P,d as h,f as F}from"./index-cpXNKgvz.js";import"./index-D2LwEE0L.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-ZILb6uB7.js";function Q({assetPath:i,displayName:l}){const{sheetPath:n,frameName:t}=B(i),s=`/${n}`,[r,a]=o.useState(null),[x,p]=o.useState(t),[m,u]=o.useState("fit"),[j,I]=o.useState(null),w=o.useRef(null),[y,N]=o.useState({w:320,h:240}),f=x??t,g=f?r?.frames.find(c=>c.name===f)??null:null;o.useEffect(()=>{p(t),u("fit")},[t]),o.useEffect(()=>{if(!t){a(null);return}let c=!1;return fetch(`/${H(n)}`).then(d=>d.ok?d.text():null).then(d=>{c||!d||a(W(d))}).catch(()=>{c||a(null)}),()=>{c=!0}},[t,n]),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??n.split("/").pop()??i;return e.jsxs("div",{"data-testid":"image-asset-document",style:{height:"100%",minHeight:240,display:"flex",flexDirection:"column",minWidth:0},children:[e.jsx(T,{title:E,srcWidth:b,srcHeight:$,scaleMode:m,scale:k,onScaleMode:u}),e.jsx(z,{stageRef:w,frameName:t,frame:g,sheet:r,sheetUrl:s,title:E,scale:k,onNatural:I}),r&&r.frames.length>1?e.jsx(C,{sheetUrl:s,frames:r.frames,activeName:f,onPick:p}):null]})}function T({title:i,srcWidth:l,srcHeight:n,scaleMode:t,scale:s,onScaleMode:r}){return e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:6,padding:"6px 8px"},children:[e.jsx(v,{tone:"dim",variant:"label",children:i}),l>0&&e.jsxs(v,{tone:"muted",variant:"code",children:[l," × ",n,t==="fit"?` · ${O(s)}`:""]}),e.jsx("span",{style:{flex:1}}),[1,4,8,"fit"].map(a=>e.jsx(P,{type:"button",size:"compact",shape:"segment","aria-pressed":t===a,variant:t===a?"primary":"secondary",onClick:()=>r(a),children:a==="fit"?"Fit":`${a}×`},String(a)))]})}function z({stageRef:i,frameName:l,frame:n,sheet:t,sheetUrl:s,title:r,scale:a,onNatural:x}){let p;return l&&!n?p=e.jsx(v,{tone:"muted",variant:"body",children:t?`No sprite named ${l}`:"Loading sprite…"}):n?p=e.jsx(F,{sheetUrl:s,frame:n,scale:a}):p=e.jsx("img",{src:s,alt:r,style:{imageRendering:"pixelated",display:"block",transform:`scale(${a})`,transformOrigin:"center center"},onLoad:m=>{const u=m.currentTarget;x({w:u.naturalWidth,h:u.naturalHeight})}}),e.jsx("div",{ref:i,className:"vgai-asset-transparency-well","data-testid":"sprite-stage",style:{flex:1,minHeight:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto"},children:p})}function C({sheetUrl:i,frames:l,activeName:n,onPick:t}){return e.jsx("div",{"data-testid":"sprite-filmstrip",style:{display:"flex",gap:6,overflowX:"auto",padding:"8px 8px 10px",borderTop:`1px solid ${h[3]}`},children:l.map(s=>{const r=s.name===n;return e.jsxs("button",{type:"button",title:s.name,"aria-pressed":r,onClick:()=>t(s.name),style:{border:r?`1px solid ${h[1]}`:"1px solid transparent",background:"transparent",padding:2,cursor:"pointer",flex:"0 0 auto"},children:[e.jsx(F,{sheetUrl:i,frame:s,maxEdge:40}),e.jsx("div",{style:{fontSize:9,color:r?h[1]:h[3],maxWidth:56,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name})]},s.name)})})}function O(i){return i>=1?`${i}×`:`1/${Math.round(1/i)}×`}export{Q as ImageViewer};
@@ -1 +0,0 @@
1
- import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{Object3DSnapshotDocument as p}from"./EntityModelDocument-Dal8YnLK.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-cpXNKgvz.js";import"./index-DaQZGF7d.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-ZILb6uB7.js";import"./live-mixers-BRkRHd6g.js";import"./StageHost-D-o8MsFS.js";import"./viewport-surface-status-DuININWe.js";import"./model-inspection-JC6gbV8Q.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-DrFzvAAB.js";import"./LineSegments2-C8H20K8w.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function B({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{B as InspectorObjectPreview};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DgapqSPi.js","assets/index-BP6wv2A0.js","assets/index-CJbYy-CF.js","assets/index-CanA16PU.js","assets/index-Bge9JUr6.js","assets/index-gHZae-lw.js","assets/index-BncK9THk.js","assets/index-IEjydI9d.js","assets/index-DUqP1RMl.js"])))=>i.map(i=>d[i]);
2
- import{a}from"./jsx-runtime-DPjLkJKQ.js";import{r as m}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{t as n,a$ as b,bt as z,S as F,bu as M,A as J}from"./index-cpXNKgvz.js";import"./index-D2LwEE0L.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-DgapqSPi.js").then(e=>e.i),__vite__mapDeps([0,1])),b(()=>import("./index-CJbYy-CF.js").then(e=>e.w),__vite__mapDeps([2,1,0])),b(()=>import("./index-CanA16PU.js"),__vite__mapDeps([3,0,1])),b(()=>import("./index-Bge9JUr6.js"),__vite__mapDeps([4,1,0,2])),b(()=>import("./index-gHZae-lw.js"),__vite__mapDeps([5,6,2,1,0])),b(()=>import("./index-IEjydI9d.js"),__vite__mapDeps([7,6,2,1,0])),b(()=>import("./index-DUqP1RMl.js"),__vite__mapDeps([8,0,1,2]))]).then(([e,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||N(!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),A=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(),O=_&&_.top>=j.top&&_.bottom<=j.bottom&&_.left>=j.left&&_.right<=j.right?u.scrollSnapshot().map(A):p.view.EditorView.scrollIntoView(x,{y:"nearest",x:"nearest"});O&&E.push(O),E.push(v.mark.of({from:x,to:D,revision:++y.current}))}else v&&E.push(v.mark.of(null));u.dispatch({changes:A,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:[$&&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,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StageHost-D-o8MsFS.js","assets/index-cpXNKgvz.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/three.module-ZILb6uB7.js","assets/index-B4bmKkgY.css","assets/viewport-surface-status-DuININWe.js","assets/live-mixers-BRkRHd6g.js","assets/model-inspection-JC6gbV8Q.js","assets/clip-planes-CnAI6DZn.js","assets/OrbitControls-DrFzvAAB.js","assets/LineSegments2-C8H20K8w.js","assets/viewport-pick-context-DkawXbEi.js","assets/editor-presentation-activity-C7SNSmTd.js"])))=>i.map(i=>d[i]);
2
- import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{bR as W,bS as P,a$ as q,bT as J,t as g,u as X,X as G,E as M,bU as K,bV as Q,br as Y,bW as Z,bX as ee}from"./index-cpXNKgvz.js";import{r as c}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{V as te,O as re,S as ne}from"./viewport-surface-status-DuININWe.js";import{aJ as oe,B as se}from"./three.module-ZILb6uB7.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.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(W(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 q(()=>import("./StageHost-D-o8MsFS.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]))).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 P(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=ee(t);return r?{message:r,stack:e.message}:{message:e.message,stack:e.stack}}function De({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,y=0,f=null,p=Promise.resolve(),x=null,j=null;const S=()=>{f&&(m.remove(f),m.animations=[],j?j():M(f),f=null,j=null)},I=(n,b)=>{S(),f=n,j=b,m.add(n),m.animations=n.animations,Z(e)},V=(n,b)=>{if(n.kind==="not-a-model"&&!b){v({status:"fallback",reason:n.message});return}const a=fe(n,r);E(a),Y.error(`${r}: ${a.message}`,"live-module"),b||v({status:"fallback",reason:n.message})},O=n=>i||n!==y,H=async()=>{y+=1;const n=y,b=Q();let a;try{a=await le(t,r,b)}catch(k){if(O(n))return;if(!(k instanceof w))throw k;x=k,V(k.refusal,f!==null);return}if(O(n)){a.dispose?a.dispose():M(a.root);return}I(a.root,a.dispose??null),x=null,K(r),E(null),v({status:"live",exportName:a.exportName})},A=()=>(p=H(),p),z=J(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 U=X();return()=>{i=!0,z(),U(),S()}},[m,e,r,t]),c.useEffect(()=>{if(d.status!=="live"||D.current)return;let i=0,y=0;const f=()=>{const p=G(e);if(p){D.current=!0,new se().setFromObject(m).isEmpty()||p.frame();return}++y>60||(i=requestAnimationFrame(f))};return i=requestAnimationFrame(f),()=>cancelAnimationFrame(i)},[m,e,d.status]);const B=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:B,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{De as LiveModuleDocument};
@@ -1 +0,0 @@
1
- import{a as i}from"./jsx-runtime-DPjLkJKQ.js";import{P as U,b9 as A,L as N,M as k,t as y,A as M,ba as I,Q as C,C as P}from"./index-cpXNKgvz.js";import{r as w}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{EffectComposer as F,LUT3DEffect as _,RenderPass as $,EffectPass as B}from"./index-BtfYaG4D.js";import{a0 as O,w as T,a2 as G,V as v,$ as H,L as R,a3 as L,W as V,e as W,A as q,f as X,h as D,g as Z,a_ as Q,a$ as J,l as j,m as K,b3 as Y,i as ee,k as te}from"./three.module-ZILb6uB7.js";import{s as re}from"./asset-editor-persistence-DGD05u26.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";class ne extends O{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=R,l.minFilter=R,l.wrapS=L,l.wrapT=L,l.wrapR=L,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 z(r){return[r.x,r.y,r.z].map(t=>t.toFixed(2)).join(", ")}function se(){const r=new X;r.background=new D("#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 Q("#dce8ff","#322a27",2.1));const a=new J("#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 K(.48,48,32),new j({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 Y(.78,.78,.78),new j({color:new D(`rgb(${o}, ${o}, ${o})`),roughness:.72}),[-2.4+u*1.2,1.85,-.1])});const p=n(new ee(9,6),new j({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=W,e.toneMapping=q,e.toneMappingExposure=1,e.shadowMap.enabled=!0;const p=se(),s=new F(e),u=new _(r.texture3D,{tetrahedralInterpolation:!0});s.addPass(new $(p.scene,p.camera)),s.addPass(new B(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(C,{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(C,{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 I(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:A,order:U,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?`${z(n.domainMin)} → ${z(n.domainMax)}`:"—"})]})}},{id:"lut-preview-settings",title:"Preview",icon:k,order:N,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 +0,0 @@
1
- import{a as u}from"./jsx-runtime-DPjLkJKQ.js";import{r as i}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{x,y as E,z as w,D as S,E as a,t as f}from"./index-cpXNKgvz.js";import"./index-D2LwEE0L.js";import{O as M}from"./StageHost-D-o8MsFS.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-ZILb6uB7.js";import"./viewport-surface-status-DuININWe.js";import"./live-mixers-BRkRHd6g.js";import"./model-inspection-JC6gbV8Q.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-DrFzvAAB.js";import"./LineSegments2-C8H20K8w.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function J({documentId:g,assetPath:o,displayName:d,active:l}){const[b,s]=i.useState(null),[p,c]=i.useState(null);i.useEffect(()=>{if(!l){s(null);return}const n=new AbortController;let m=null;s(null),c(null);const t=x(o);return(t==="glb"||t==="gltf"||t==="spz"?E(o,n.signal):t?w({url:o,format:t}).then(S).then(r=>({root:r,sourceBytes:null})):Promise.reject(new Error(`No native Three.js model loader supports ${o}.`))).then(r=>{if(n.signal.aborted){a(r.root);return}m=r.root,s(r)},r=>{n.signal.aborted||c(r instanceof Error?r.message:String(r))}),()=>{n.abort(),m&&a(m)}},[l,o]);const e=b?.root??null,j=i.useCallback(()=>{if(!e)throw new Error(`Model asset ${o} is not loaded.`);return{root:e,animations:e.animations,dispose(){}}},[o,e]);return p?u.jsx("div",{role:"alert",style:{padding:20,color:f.semantic.danger},children:p}):e?u.jsx(M,{documentId:g,sourcePath:o,displayName:d,build:j,active:l,assetType:"model",modelSource:{kind:"project-file",path:o}}):u.jsxs("div",{style:{padding:20,color:f.content.muted},children:["Loading ",d,"…"]})}export{J as ModelAssetDocument};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/world-documents-DkBqH8VU.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-cpXNKgvz.js","assets/index-DaQZGF7d.js","assets/index-D_NuPfjr.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/three.module-ZILb6uB7.js","assets/index-B4bmKkgY.css","assets/Toolbar-DYJjJKTt.js","assets/transform-mode-request-DSPwviXs.js","assets/TransientHint-D94hsJSR.js","assets/react-story-board-B9V-j_Y5.js","assets/viewport-pick-context-DkawXbEi.js"])))=>i.map(i=>d[i]);
2
- import{r as z}from"./index-DaQZGF7d.js";import{c9 as I,br as l,ca as D,cb as N,cc as H,cd as W,ce as F,cf as y,j as C,cg as m,ch as $,ci as B,cj as T,v as x,ck as E,cl as q,cm as S,cn as V,co as G,cp as L,cq as J,a$ as K,cr as U,bh as Z}from"./index-cpXNKgvz.js";const h=new WeakMap,Q=new Set;function P(){for(const t of Q)t()}function X(t){const e=(h.get(t)?.generation??0)+1;return h.set(t,{generation:e,settled:!1}),P(),()=>{const r=h.get(t);!r||r.generation!==e||r.settled||(h.set(t,{generation:e,settled:!0}),P())}}const Y={transform:!1,inspectorFields:!1,persist:!1};class ee{capabilities=Y;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 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 te="(invalid manifest)";let j=!1,w=!1,v=!1,c=null;function g(){if(w||v||!j||!c)return;w=!0;const t=c;queueMicrotask(()=>{if(w=!1,c!==t){g();return}j=!1,v=!0,Promise.resolve().then(t).catch(e=>{l.error(`Edit-mode rebuild failed: ${e instanceof Error?e.message:String(e)}`,"authoring")}).finally(()=>{v=!1,g()})})}function re(t){return c=t,g(),()=>{c===t&&(c=null)}}function be(){j=!0,g()}const se=new Set(["three","canvas","dom"]);function d(t){return typeof t=="string"?t:void 0}function ie(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 ne(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 oe(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 i=s&&typeof s=="object"?s:{},a=i.zOrder,n=i.pausable;return{id:d(i.id)??`(world ${o})`,surface:(typeof i.adapter=="string"?d(i.adapter):void 0)??d(i.adapter&&typeof i.adapter=="object"?i.adapter.surface:void 0)??"(missing adapter surface)",adapter:ne(i.adapter),scene:d(i.scene),entry:d(i.entry),zOrder:typeof a=="number"?a:void 0,pausable:typeof n=="boolean"?n:void 0,dev:i.dev===!0,world:ie(i)}})}}function ae(t){return se.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 p(t,e){const r=t.roots;if(Array.isArray(r))return r.find(s=>!!s&&typeof s=="object"&&s.id===e)}function k(t,e){return p(t,e)}class de{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,m(),"project-manifest"):null,this.unsubscribeHistory=this.fileHistory?this.fileHistory.subscribeAll(i=>{i==="vgai.project.json"&&m().readBytes(i).then(a=>JSON.parse(new TextDecoder().decode(a))).then(a=>{for(const n of Object.keys(this.raw))delete this.raw[n];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=p(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=p(this.raw,e)?.zOrder;return typeof r=="number"?r:0}setRootZOrder(e,r){const s=k(this.raw,e);s&&(s.zOrder=r,this.persist("Change World Order"))}getRootPausable(e){const r=p(this.raw,e)?.pausable;return typeof r=="boolean"?r:!0}setRootPausable(e,r){const s=k(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(o,"Write vgai.project.json failed"),o.ok||await T(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&&m().readBytes("vgai.project.json").then(o=>JSON.parse(new TextDecoder().decode(o))).then(o=>{for(const i of Object.keys(this.raw))delete this.raw[i];Object.assign(this.raw,o),this.store.notifyIngestEdit()}).catch(()=>{}),l.error(`Failed to write vgai.project.json: ${s}`,"project"),!1}}}let A=null,u=null;function ce(t,e,r){const s=D(e).map(n=>{const b=n.zOrder??0,R=N(n.surface);if(R)return{worldId:n.id,kind:n.surface,adapter:R(t,n.id),zOrder:b};const M=ae(n),_={id:n.id,kind:n.surface,adapter:n.adapter,entryOrScenePath:n.scene??n.entry,zOrder:b,pausable:n.pausable??!0};return{worldId:n.id,kind:n.surface,adapter:new ee(t,_,M??void 0),zOrder:b}}),o=r&&s.length>=1?new de(r.raw,r.synthesized,t):void 0;A=o??null;const i=H(x()?.config),a=new W(s,o,i);if(s.length>=1){if(E()&&!q())return l.warn("Edit-mode authoring not installed: a foreign session (ingest/play) owns the authoring override.","authoring"),a;F(a),y(a),t.notifyIngestEdit()}else E()||(u=V(t,"No world yet","Declare a root in vgai.project.json"),y(u),t.notifyIngestEdit());return a}function f(t){t&&S()===t&&y(null),u&&S()===u&&y(null),u=null,A?.dispose(),A=null}async function ue(t){const e=X(t);let r,s;try{const o=await I(),i=o!==null&&oe(o);if(i)r=i,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 i=o instanceof Error?o.message:String(o);l.error(`Failed to load vgai.project.json: ${i}`,"project"),r={roots:[{id:"manifest",surface:te,adapter:i}]}}try{return ce(t,r,s)}finally{e()}}class le{constructor(e){this.store=e,this.unbind=re(()=>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?.(),f(this.composite),O.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=Z(),s=new Set(L().map(n=>n.descriptor.id)),o=this.composite?J().map(n=>n.descriptor.id).filter(n=>s.has(n)):[];this.disposeDocuments?.(),this.disposeDocuments=void 0,f(this.composite),this.composite=void 0;const i=await ue(this.store);if(this.disposed){f(i);return}const{installRootDocuments:a}=await K(async()=>{const{installRootDocuments:n}=await import("./world-documents-DkBqH8VU.js");return{installRootDocuments:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]));if(this.disposed){f(i);return}this.composite=i,this.disposeDocuments=a(this.store,i);for(const n of o)U(n,n===r);await Promise.all([...this.stages].map(n=>n(i)))});return this.tail=e.catch(()=>{}),e}}const O=new Map;function he(t){let e=O.get(t);return e||(e=new le(t),O.set(t,e)),e}function fe(t){const e=he(t);return{ready:e.ready.then(()=>G()),dispose:e.retain()}}function pe({store:t}){return z.useEffect(()=>{const e=fe(t);return e.ready.catch(r=>{l.error(`Authoring session failed: ${r instanceof Error?r.message:String(r)}`,"authoring")}),e.dispose},[t]),null}const me=Object.freeze(Object.defineProperty({__proto__:null,ProjectAuthoringBootstrap:pe},Symbol.toStringTag,{value:"Module"}));export{ee as B,te as I,me as N,be as q};
@@ -1,5 +0,0 @@
1
- import{a0 as N,a2 as R,h as k,e as H,aJ as J,ak as A,aK as w,aL as C,aj as U,aM as L,aN as T,aO as D,aP as z,k as O,V}from"./three.module-ZILb6uB7.js";const q=/^[og]\s*(.+)?/,K=/^mtllib /,W=/^usemtl /,Q=/^usemap /,S=/\s+/,B=new V,F=new V,E=new V,G=new V,j=new V,_=new k;function X(){const M={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;B.fromArray(t,s),F.fromArray(t,e),E.fromArray(t,n),j.subVectors(E,F),G.subVectors(B,F),j.cross(G),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 M.startObject("",!1),M}class Z extends N{constructor(s){super(s),this.materials=null}load(s,e,n,t){const i=this,a=new R(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(S);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]),H),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(S),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(W.test(r))e.object.startMaterial(r.substring(7).trim(),e.materialLibraries);else if(K.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 J;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 A;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,I=o.length;v<I;v++){const y=o[v],P=y.name+"_"+y.smooth+"_"+m;let f=e.materials[P];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 T,f.name=y.name,f.flatShading=!y.smooth,f.vertexColors=m,e.materials[P]=f),p.push(f)}let b;if(p.length>1){for(let v=0,I=o.length;v<I;v++){const y=o[v];c.addGroup(y.groupStart,y.groupCount,v)}l?b=new D(c,p):u?b=new z(c,p):b=new O(c,p)}else l?b=new D(c,p[0]):u?b=new z(c,p[0]):b=new O(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 A;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 z(g,d);i.add(r)}return i}}export{Z as OBJLoader};
@@ -1 +0,0 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{V as K,W as P,X,Y,Z as D,_ as Z,$ as T,a0 as J,a1 as Q,a2 as I,a3 as O,a4 as ee,a5 as se,a6 as M,a7 as R,a8 as g,a9 as b,aa as n,ab as ae,B as N,ac as ie,ad as te,ae as z,af as d,ag as B,ah as oe,ai as re,aj as ne,ak as W,al as $,am as le,an as ce,ao as A,ap as de,T as F,aq as pe,ar as L,as as ue,at as he,au as me,av as ge,aw as ve,ax as xe,ay as be,az as je}from"./index-cpXNKgvz.js";import{r as t}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{s as we}from"./model-inspection-JC6gbV8Q.js";import{v as fe,V as Se,a as ye,b as Ce,c as Ve}from"./ViewportShadingMenu-B3N6hSdN.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-ZILb6uB7.js";const U=()=>()=>{},v=()=>0,Ee=[{key:"skeletons",label:"Bones"},{key:"weights",label:"Weights"}];function Ae({documentId:i,assetPath:p}){t.useSyncExternalStore(K,P,P);const a=X(i);t.useSyncExternalStore(Y,D,D),t.useSyncExternalStore(a?.subscribe??U,a?.getSnapshot??v,a?.getSnapshot??v),t.useSyncExternalStore(Z,T,T);const l=J(i);t.useSyncExternalStore(l?.subscribe??U,l?.getSnapshot??v,l?.getSnapshot??v);const H=Q(i),[j,w]=t.useState(null),[f,h]=t.useState(null),[S,m]=t.useState(!1),[y,c]=t.useState(!1),C=t.useRef(null),V=t.useRef(null);if(t.useSyncExternalStore(I,O,O),!a)return null;const o=a.presentation(),{lighting:u}=ee(i),_=se(i)?.documentLayer?.all?.lighting?.studioPreset===M.id,x=new Set(we(a.root).filter(s=>s.available).map(s=>s.mode)),G=[...fe,...x.has("uv")?[{mode:"uv",label:"UV",description:"UV coordinates as surface color"}]:[],...x.has("vertex-colors")?[{mode:"vertex-colors",label:"Vertex colors",description:"Authored color attributes without textures"}]:[]],E=async s=>{if(p){h(null);try{await je().saveThumbnailFraming(p,s?void 0:a.cameraPose())}catch(r){h(r instanceof Error?r.message:String(r))}}},q=async()=>{h(null);try{const s={background:o.background},r=p?.toLowerCase().endsWith(".spz")?await xe(p,s):be(a.root,s);w(`data:image/png;base64,${r.contactSheet.base64}`)}catch(s){h(s instanceof Error?s.message:String(s))}},k=a.selection().length>0?"Frame selection":"Frame all";return e.jsxs("div",{className:"vgai-model-document-header",children:[e.jsxs(R,{compact:!0,label:"Viewport view controls",className:"vgai-model-viewport-toolbar vgai-model-viewport-toolbar--view",children:[e.jsx(g,{text:k,children:e.jsx(b,{"aria-label":k,onClick:()=>a.frame(),children:e.jsx(n,{icon:ae,size:"md"})})}),e.jsxs("div",{className:"vgai-viewport-popover-anchor",children:[e.jsx(g,{text:"Camera orientation and projection",children:e.jsxs(N,{ref:C,type:"button",size:"compact",variant:"secondary","aria-label":`Camera view: ${o.projection}`,"aria-haspopup":"menu","aria-expanded":S,onClick:()=>m(s=>!s),className:"vgai-model-toolbar-labelled-control",children:[e.jsx(n,{icon:ie,size:"sm"}),e.jsx("span",{children:o.projection==="perspective"?"Perspective":"Orthographic"}),e.jsx(n,{icon:te,size:"xs"})]})}),S&&e.jsxs(z,{anchorRef:C,align:"start",clamp:!0,"aria-label":"Camera view",onDismiss:()=>m(!1),style:{minWidth:210},children:[["front","right","top","isometric"].map(s=>e.jsx(d,{onSelect:()=>{a.setViewPreset(s),m(!1)},children:s==="isometric"?"Perspective 3/4":`${s[0]?.toUpperCase()}${s.slice(1)} view`},s)),e.jsx(B,{}),["perspective","orthographic"].map(s=>e.jsxs(d,{role:"menuitemradio","aria-checked":o.projection===s,onSelect:()=>{a.setProjection(s),m(!1)},children:[e.jsx("span",{className:"vgai-menu-check",children:o.projection===s&&e.jsx(n,{icon:oe,size:"xs"})}),s==="perspective"?"Perspective":"Orthographic"]},s))]})]}),x.has("skeleton")?e.jsx(g,{text:`Rig: ${o.skeleton?"Visible":"Hidden"}`,children:e.jsx(b,{"aria-label":"Toggle rig overlay","aria-pressed":o.skeleton,onClick:()=>a.setSkeleton(!o.skeleton),children:e.jsx(n,{icon:re,size:"md"})})}):null,ne("object3d-document").map(({id:s,Component:r})=>e.jsx(r,{documentId:i},s))]}),e.jsxs(R,{compact:!0,label:"Viewport preview controls",className:"vgai-model-viewport-toolbar vgai-model-viewport-toolbar--preview",children:[e.jsxs(Se,{mode:o.mode,onChange:s=>a.setMode(s),choices:G,segments:ye,children:[W().length>0?e.jsxs("label",{children:[e.jsx("span",{children:"View"}),e.jsxs($,{"aria-label":"View preset",value:"",onChange:s=>{s.target.value&&le(i,s.target.value)},children:[e.jsx("option",{value:"",children:"Choose…"}),W().map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})]}):null,e.jsxs("label",{children:[e.jsx("span",{children:"Lighting"}),e.jsxs($,{"aria-label":"Lighting",value:u.source==="studio"?`studio:${u.studioPreset}`:u.source,onChange:s=>{const r=s.target.value;A(i,r.startsWith("studio:")?{all:{lighting:{source:"studio",studioPreset:r.slice(7)}}}:{all:{lighting:{source:r}}})},children:[ce().filter(s=>s.id!==M.id||_).map(s=>e.jsx("option",{value:`studio:${s.id}`,children:s.title},s.id)),e.jsx("option",{value:"scene",children:"Scene lights"})]})]}),e.jsxs("label",{children:[e.jsx("span",{children:"Exposure"}),e.jsx(de,{"aria-label":"Preview exposure",type:"range",min:"0.2",max:"2",step:"0.1",value:u.tone.exposure,onChange:s=>A(i,{all:{lighting:{tone:{exposure:Number(s.target.value)}}}})}),e.jsx(F,{as:"span",variant:"caption",children:u.tone.exposure.toFixed(1)})]})]}),e.jsx(Ce,{glyph:e.jsx(Ve,{}),choices:[{id:"grid",label:"Grid",enabled:L(i),onToggle:()=>pe(i,!L(i))},{id:"bounds",label:"Bounds",enabled:o.bounds,onToggle:()=>a.setBounds(!o.bounds)},...l===null?[]:Ee.filter(s=>H.includes(s.key)).map(s=>({id:s.key,label:s.label,enabled:l.helperVisibility[s.key],onToggle:()=>l.toggleHelperType(s.key)}))]}),e.jsxs("div",{className:"vgai-viewport-popover-anchor",children:[e.jsx(g,{text:"Asset preview actions",children:e.jsx(b,{ref:V,"aria-label":"Asset preview actions","aria-haspopup":"menu","aria-expanded":y,onClick:()=>c(s=>!s),children:e.jsx(n,{icon:ue,size:"md"})})}),y&&e.jsxs(z,{anchorRef:V,clamp:!0,"aria-label":"Asset preview actions",onDismiss:()=>c(!1),style:{minWidth:210},children:[e.jsxs(d,{onSelect:()=>{c(!1),q()},children:[e.jsx(n,{icon:he,size:"sm"}),"Capture preview"]}),p?e.jsxs(e.Fragment,{children:[e.jsx(d,{onSelect:()=>{c(!1),E(!1)},children:"Save thumbnail framing"}),e.jsx(d,{onSelect:()=>{c(!1),E(!0)},children:"Reset thumbnail framing"})]}):null,e.jsx(B,{}),e.jsxs(d,{onSelect:()=>{a.resetPresentation(),c(!1)},children:[e.jsx(n,{icon:me,size:"sm"}),"Reset viewport settings"]})]})]})]}),j?e.jsxs(ge,{className:"vgai-model-capture-preview",children:[e.jsxs("div",{children:[e.jsx(F,{as:"strong",variant:"label",children:"Deterministic views"}),e.jsx(N,{type:"button",variant:"ghost",onClick:()=>w(null),children:"Close"})]}),e.jsx("img",{src:j,alt:"Front, right, top, and three-quarter model preview"})]}):null,f?e.jsx(ve,{className:"vgai-model-toolbar-error",tone:"error",children:f}):null]})}export{Ae as Object3DDocumentToolbar};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/spark.module-gG1EsWx8.js","assets/three.module-ZILb6uB7.js","assets/index-cpXNKgvz.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/index-B4bmKkgY.css"])))=>i.map(i=>d[i]);
2
- import{aX as te,t as A,aY as re,x as ne,aZ as ie,z as oe,D as ae,E as Y,a_ as se,a$ as le,b0 as ce,b1 as de,b2 as pe}from"./index-cpXNKgvz.js";import{a as E}from"./jsx-runtime-DPjLkJKQ.js";import{r as C}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{W as me,f as ue,g as fe,e as we,A as be,a_ as ge,a$ as he,b0 as ve,ao as xe,b1 as ye,V as Ae,b2 as Ee}from"./three.module-ZILb6uB7.js";import{O as Ce}from"./OrbitControls-DrFzvAAB.js";import{s as Me,i as F}from"./editor-presentation-activity-C7SNSmTd.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";const v={webglContext:0,animationFrame:0,resizeObserver:0,objectUrl:0},Z={...v};function _(r){v[r]++,Z[r]=Math.max(Z[r],v[r]);let a=!1;return()=>{a||(a=!0,v[r]=Math.max(0,v[r]-1))}}function Se(r){const a=r.animations[0];if(!a)return null;const m=new Ee(r),b=m.clipAction(a).play();return b.paused=!0,m.update(0),m}let je=0;function qe({assetPath:r,materialPath:a,displayName:m="Object3D preview",active:b=!0,sourceFactory:M,showSkeleton:D=!1,background:z,cameraDirection:S,showGrid:H=!0,useDefaultLighting:L=!0,exposure:T=1,setupPreview:k}){const W=C.useRef(null),[j,$]=C.useState(null),[q,R]=C.useState(!0);return C.useEffect(()=>{if(!b)return;const o=W.current;if(!o)return;const x=new AbortController,J=te({id:`preview-card:${++je}`,label:`${m} (preview card)`,contentClock:()=>0}),t=new me({antialias:!0,alpha:!0}),K=_("webglContext"),N=_("animationFrame"),Q=_("resizeObserver"),s=new ue,u=new fe(35,1,.01,1e3),f=new Ce(u,t.domElement),V=new xe;let I=null,w=null,y=null,c,l=null,g=null;const O=[];let d=0,p=!1;if($(null),R(!0),t.outputColorSpace=we,t.toneMapping=be,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){s.add(new ge(16777215,3489874,1.8));const e=new he(16777215,2.2);e.position.set(3,5,4),s.add(e)}if(H){const e=new ve(10,20,5333103,3423044);s.add(e),O.push(e)}const U=(e,n)=>{if(!g)return;const i=S?new Ae(...S):void 0,h=de(g,Math.max(e,1)/Math.max(n,1),i);u.copy(h,!1),f.target.copy(g.center),f.update()},G=async e=>{if(p)return;s.add(e);let n=!1;if(e.traverse(i=>{se(i,"gaussianSplat")&&(n=!0)}),n){const{SparkRenderer:i}=await le(async()=>{const{SparkRenderer:h}=await import("./spark.module-gG1EsWx8.js");return{SparkRenderer:h}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]));if(p)return;l=new i({renderer:t,enableLod:!1})}if(g=ce(e,"perspective"),U(o.clientWidth,o.clientHeight),I=Se(e),D){const i=new ye(e);i.name="__compact_preview_skeleton",s.add(i),O.push(i)}c=k?.({scene:s,camera:u,renderer:t,model:e}),c?.resize?.(Math.max(o.clientWidth,1),Math.max(o.clientHeight,1),t.getPixelRatio()),R(!1)};(async()=>{try{if(M){y=re(M),await G(y.root);return}if(!r)throw new Error("Compact Object3D preview has no source.");const e=ne(r);if(!e)throw new Error(`No native Three.js loader supports ${r}.`);const n=e==="glb"||e==="gltf"||e==="spz"?await ie(r,x.signal):await oe({url:r,format:e,...a?{materialUrl:a}:{}});if(w=ae(n),x.signal.aborted||p){Y(w),w=null;return}await G(w)}catch(e){!x.signal.aborted&&!p&&($(e instanceof Error?e.message:String(e)),R(!1))}})();const B=()=>{const e=Math.max(o.clientWidth,1),n=Math.max(o.clientHeight,1);t.setSize(e,n,!1),g&&!c?U(e,n):(u.aspect=e/n,u.updateProjectionMatrix()),c?.resize?.(e,n,t.getPixelRatio())},X=new ResizeObserver(B);X.observe(o),B();const P=()=>{if(d=0,p||!F())return;const e=Math.min(V.getDelta(),.1);f.update(),l&&s.add(l);try{c?.render?c.render(e):t.render(s,u)}finally{l?.removeFromParent()}d=requestAnimationFrame(P)},ee=Me(()=>{F()?!p&&d===0&&(V.getDelta(),P()):(cancelAnimationFrame(d),d=0)});return F()&&(d=requestAnimationFrame(P)),()=>{p=!0,ee(),J(),x.abort(new Error("Compact Object3D preview closed.")),cancelAnimationFrame(d),X.disconnect(),I?.stopAllAction(),c?.dispose(),f.dispose(),l&&(l.removeFromParent(),pe(l),l=null),t.dispose(),t.forceContextLoss();for(const e of O){const n=e;n.geometry?.dispose();const i=n.material;if(Array.isArray(i))for(const h of i)h.dispose();else i?.dispose()}y&&y.dispose(),w&&Y(w),o.contains(t.domElement)&&o.removeChild(t.domElement),Q(),N(),K()}},[b,r,z,S,T,a,k,H,D,M,L]),E.jsxs("div",{ref:W,"data-testid":"object3d-compact-preview",role:"region","aria-label":`Interactive 3D preview: ${m}`,"aria-busy":q,style:{width:"100%",height:"100%",minHeight:220,overflow:"hidden",position:"relative",background:A.surface.inset},children:[q&&!j?E.jsx("span",{style:{position:"absolute",padding:10,color:A.content.muted},children:"Loading…"}):null,b?null:E.jsx("span",{style:{position:"absolute",padding:10,color:A.content.muted},children:"Preview suspended while inactive."}),j?E.jsx("div",{role:"alert",style:{position:"absolute",padding:10,color:A.semantic.danger},children:j}):null]})}export{qe as Object3DPreview};
@@ -1 +0,0 @@
1
- import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{b3 as L,b4 as U,b5 as R,b6 as W,aC as M,t as i,aa as b,b7 as w,n as N,S as k,al as J,B as V,ah as _,b8 as G}from"./index-cpXNKgvz.js";import{r}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{d as K}from"./asset-editor-persistence-DGD05u26.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-ZILb6uB7.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 de({online:e,mode:l="full",showPreview:n=!1,onResolved:f}){const[h,z]=r.useState([]),[o,B]=r.useState(null),[$,v]=r.useState(!0),[A,D]=r.useState(null),[m,F]=r.useState(null),[O,p]=r.useState(!1),[T,x]=r.useState(!1),[j,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&&B(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 C=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),!C){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,C]);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]),P=t.jsx("img",{src:j?"/__editor/asset-library/local-placeholder.svg":e.thumbnailUrl,alt:j?`${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(b,{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:P})}):P}),j&&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(k,{label:"Info",children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color: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(k,{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(b,{icon:w,spin:!0,style:{marginRight:4}}),"Loading options..."]}):A?t.jsxs("div",{role:"alert",style:{fontSize:11,color:i.content.muted},children:["Delivery unavailable: ",A]}):h.length>0?t.jsxs(t.Fragment,{children:[t.jsx(J,{"aria-label":"Asset delivery",value:o?h.indexOf(o):0,onChange:s=>B(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(V,{type:"button",variant:c==="done"?"success":"primary",size:"comfortable",onClick:H,disabled:c==="downloading",style:{width:"100%"},children:[t.jsx(b,{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{de as OnlineAssetDetail};