@holoscript/core 8.0.8 → 8.0.9

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 (462) hide show
  1. package/bin/holoscript.cjs +5 -1
  2. package/dist/GLTFPipeline-L76YTXKA.js +15 -0
  3. package/dist/GLTFPipeline-ZWJN7GI6.cjs +36 -0
  4. package/dist/HoloCompositionParser-K76KTEEE.js +12 -0
  5. package/dist/HoloCompositionParser-UZH6Y4HO.cjs +45 -0
  6. package/dist/HoloScriptCodeParser-2D4ERFUZ.js +6 -0
  7. package/dist/HoloScriptCodeParser-UDRLDA7I.cjs +23 -0
  8. package/dist/HoloScriptPlusParser-FTMCGWXD.js +13 -0
  9. package/dist/HoloScriptPlusParser-LQR5GIKF.cjs +30 -0
  10. package/dist/HoloScriptRuntime-UTRLJI5L.js +12 -0
  11. package/dist/HoloScriptRuntime-YBYXJHJN.cjs +21 -0
  12. package/dist/SceneIRCompiler-63KA3M2F.js +17 -0
  13. package/dist/SceneIRCompiler-KWUFHZ4O.cjs +42 -0
  14. package/dist/{USDZExporter-AUHZODOF.cjs → USDZExporter-ML4UMIGC.cjs} +3 -3
  15. package/dist/{USDZExporter-GXB4AUSG.js → USDZExporter-ZFKLQ76G.js} +3 -3
  16. package/dist/agents/index.cjs +1 -1
  17. package/dist/agents/index.js +1 -1
  18. package/dist/audit/AuditLogger.d.ts +106 -0
  19. package/dist/audit/AuditQueryBuilder.d.ts +79 -0
  20. package/dist/audit/ComplianceReporter.d.ts +90 -0
  21. package/dist/audit/index.d.ts +13 -0
  22. package/dist/{chunk-FGMDMJM7.js → chunk-2BYAUHBO.js} +3 -3
  23. package/dist/{chunk-EDPYCLRC.cjs → chunk-2E6PP5UE.cjs} +83 -59
  24. package/dist/{chunk-GASCWJK5.js → chunk-2EGGAZT3.js} +65 -287
  25. package/dist/{chunk-SIEXCILW.js → chunk-2I3XAGMF.js} +3 -3
  26. package/dist/{chunk-OS533P33.cjs → chunk-2KKOYZYI.cjs} +1074 -1655
  27. package/dist/chunk-2MQKNDNH.js +51 -0
  28. package/dist/{chunk-7DMMMBCY.cjs → chunk-2X3IPCBK.cjs} +10 -10
  29. package/dist/chunk-2ZOTBO25.cjs +202 -0
  30. package/dist/chunk-356N4NPM.cjs +152 -0
  31. package/dist/{chunk-X3GJPRVK.cjs → chunk-36NPLOI4.cjs} +92 -81
  32. package/dist/{chunk-SLU6UPJI.cjs → chunk-37HHY7RH.cjs} +5 -5
  33. package/dist/{chunk-YDPEHCCI.cjs → chunk-3CDDRUER.cjs} +3 -118
  34. package/dist/chunk-3F7ZZWIN.js +1651 -0
  35. package/dist/chunk-3ILD7TKP.cjs +187 -0
  36. package/dist/{chunk-X27QRG4C.cjs → chunk-3IUHTGDD.cjs} +153 -41
  37. package/dist/{chunk-PXNZ6TME.js → chunk-4376VHNJ.js} +60 -36
  38. package/dist/{chunk-YKGPCZEE.cjs → chunk-4FIBOJW6.cjs} +10 -10
  39. package/dist/chunk-4Q7RKQQI.cjs +14195 -0
  40. package/dist/{chunk-YCM6QQRT.cjs → chunk-566ZB4LZ.cjs} +180 -8
  41. package/dist/{chunk-2Y3V22SG.js → chunk-5CURIYGT.js} +3 -3
  42. package/dist/{chunk-QBWNJXNR.js → chunk-5FYMCVBY.js} +5 -5
  43. package/dist/{chunk-ZA34AN3R.js → chunk-5LVFTGKH.js} +841 -12
  44. package/dist/chunk-63AUAIL6.js +48 -0
  45. package/dist/chunk-655FATJU.js +110 -0
  46. package/dist/{chunk-TQ377OLB.cjs → chunk-65S62L4D.cjs} +28 -22
  47. package/dist/chunk-6NTAZN5Z.cjs +502 -0
  48. package/dist/chunk-6TRX6AR2.js +9376 -0
  49. package/dist/chunk-6ZCCLKS2.cjs +51 -0
  50. package/dist/{chunk-MDR235RZ.js → chunk-734OB5SK.js} +721 -8
  51. package/dist/{chunk-Q2Q34NF3.js → chunk-77QI552M.js} +6 -6
  52. package/dist/{chunk-WKX5AMOY.js → chunk-7I74JWPW.js} +3 -3
  53. package/dist/{chunk-5FSKKMR7.cjs → chunk-7IDJDMPU.cjs} +232 -4
  54. package/dist/chunk-7VBKRGIZ.cjs +847 -0
  55. package/dist/{chunk-KCPHASCO.js → chunk-AATYYLYK.js} +5 -5
  56. package/dist/{chunk-WFKVS2K4.cjs → chunk-AUZRKIHQ.cjs} +1101 -55
  57. package/dist/{chunk-DTGBOSEM.cjs → chunk-AWXFEAQL.cjs} +12 -12
  58. package/dist/{chunk-THCK6ECW.js → chunk-B3CWTCK2.js} +231 -3
  59. package/dist/chunk-BCP4E7MD.cjs +997 -0
  60. package/dist/chunk-BG7RPYJP.js +91 -0
  61. package/dist/{chunk-VF257YKO.js → chunk-BP4KTMLY.js} +117 -5
  62. package/dist/{chunk-YN6IETRZ.js → chunk-BQJ3YBF3.js} +6424 -987
  63. package/dist/{chunk-KOUAQL2B.cjs → chunk-CANAL6CT.cjs} +1569 -168
  64. package/dist/{chunk-FDSGHPAK.js → chunk-CBSDJF3B.js} +3 -3
  65. package/dist/{chunk-FEWUHQNM.cjs → chunk-CFVK26P4.cjs} +4 -4
  66. package/dist/{chunk-M7K4LE66.cjs → chunk-CI33NINL.cjs} +4 -4
  67. package/dist/{chunk-2OWDB4FB.js → chunk-CKV5NYAE.js} +6 -6
  68. package/dist/{chunk-LPS5AMQD.cjs → chunk-CM4NHXVO.cjs} +24 -24
  69. package/dist/chunk-D3HSRXYB.js +115 -0
  70. package/dist/{chunk-FNHJRI32.js → chunk-DBH3D2MU.js} +1561 -160
  71. package/dist/{chunk-GW3LKD5C.js → chunk-DJNH4HFW.js} +3 -3
  72. package/dist/{chunk-2GCNOI2U.cjs → chunk-DN6F4DHH.cjs} +9 -3
  73. package/dist/chunk-DQRJ5RJG.js +432 -0
  74. package/dist/{chunk-C7ZBSV2Q.js → chunk-DUG3OQAS.js} +106 -43
  75. package/dist/chunk-ECUYJOJ2.cjs +199 -0
  76. package/dist/chunk-EEMTCAK7.js +182 -0
  77. package/dist/{chunk-3SKLAUDD.cjs → chunk-EI3J6LTW.cjs} +359 -581
  78. package/dist/{chunk-SSSN7VAM.js → chunk-EM2OGPYE.js} +4 -4
  79. package/dist/{chunk-56VOWURB.cjs → chunk-ENZCIQZC.cjs} +522 -453
  80. package/dist/chunk-ESBXUYOC.cjs +836 -0
  81. package/dist/{chunk-L5U4W6JC.js → chunk-ESSEF6U2.js} +4 -4
  82. package/dist/chunk-ET3AN4W3.js +824 -0
  83. package/dist/chunk-EXKSFGSX.cjs +14 -14
  84. package/dist/{chunk-I76GIKN7.cjs → chunk-F3YT6GUF.cjs} +17 -17
  85. package/dist/{chunk-WRWEX5ZF.js → chunk-F75DZBBI.js} +3 -3
  86. package/dist/{chunk-4JGRWHZJ.js → chunk-FG6PYGIZ.js} +12 -6
  87. package/dist/chunk-FGGJQRLZ.js +14 -14
  88. package/dist/{chunk-SXOSDZD6.js → chunk-FWCHPCD4.js} +128 -10
  89. package/dist/{chunk-XW6IXEQH.cjs → chunk-G35CAQ7I.cjs} +5 -5
  90. package/dist/{chunk-7VMGP2FW.js → chunk-G6KACNMO.js} +132 -188
  91. package/dist/{chunk-FJPADH77.cjs → chunk-GAWJJAGT.cjs} +6 -6
  92. package/dist/chunk-GGR7QUKK.cjs +4724 -0
  93. package/dist/chunk-GIBF4BHH.js +14098 -0
  94. package/dist/{chunk-AWB7QYY6.cjs → chunk-GILYQ5VH.cjs} +6 -6
  95. package/dist/{chunk-FWVYAMNW.cjs → chunk-GKFCHGCM.cjs} +4 -4
  96. package/dist/{chunk-Y3ZFVUUU.js → chunk-GLEJ2TLS.js} +3 -3
  97. package/dist/{chunk-3GWWJT7L.js → chunk-GP3OKSKT.js} +13 -13
  98. package/dist/chunk-GTIPOEHN.js +196 -0
  99. package/dist/{chunk-LMJ5EBV7.cjs → chunk-GZPUA2TL.cjs} +16 -15
  100. package/dist/{chunk-IELX2OKI.js → chunk-H4LJ4HEA.js} +3 -115
  101. package/dist/{chunk-ACVWFGBI.cjs → chunk-HCX4SMFK.cjs} +3 -3
  102. package/dist/{chunk-HYNTS5CP.js → chunk-HHRZ6STP.js} +24 -2
  103. package/dist/chunk-HIDEIEFG.js +48 -0
  104. package/dist/{chunk-W6RW64BB.cjs → chunk-HSWBIDZM.cjs} +228 -5
  105. package/dist/{chunk-GSOUNWEL.js → chunk-HVX7QQYK.js} +1035 -1616
  106. package/dist/{chunk-TRCGG42I.cjs → chunk-IFW5IW4L.cjs} +6502 -1019
  107. package/dist/{chunk-F5LKJ6F5.cjs → chunk-IJU6AS67.cjs} +32 -28
  108. package/dist/{chunk-TVANHNJ7.js → chunk-IK6Z2HNC.js} +173 -3
  109. package/dist/{chunk-QGMUTVVH.cjs → chunk-IS7NTKY5.cjs} +20 -20
  110. package/dist/{chunk-YFVQWSNJ.js → chunk-IXWGYWH6.js} +3 -3
  111. package/dist/chunk-J2DAS2PL.js +148 -0
  112. package/dist/chunk-JBQXZIWB.js +148 -0
  113. package/dist/chunk-JBYBMBMW.js +261 -0
  114. package/dist/{chunk-LWUOUCYL.js → chunk-JEJ7TT54.js} +5 -5
  115. package/dist/{chunk-DUCB6LGL.js → chunk-JOTCTHN5.js} +211 -5
  116. package/dist/{chunk-47RUFYKR.js → chunk-K56UVEXV.js} +3 -3
  117. package/dist/{chunk-XSFNHP2E.js → chunk-KB26H447.js} +3 -3
  118. package/dist/{chunk-3NGDZZR4.js → chunk-KEYG7HGY.js} +430 -37
  119. package/dist/{chunk-DY72BMU5.js → chunk-KFVNCW4Q.js} +4 -4
  120. package/dist/chunk-KPGC7SK2.js +192 -0
  121. package/dist/chunk-KROXXBK5.cjs +53 -0
  122. package/dist/{chunk-ZPZAVHXL.cjs → chunk-LB3ZZMKT.cjs} +137 -19
  123. package/dist/chunk-LDYZWNJW.cjs +1654 -0
  124. package/dist/{chunk-ULMSSHCJ.cjs → chunk-LMB555QB.cjs} +405 -38
  125. package/dist/{chunk-CBJY23VL.js → chunk-MD4IVS42.js} +3 -3
  126. package/dist/{chunk-VMLKSV26.js → chunk-MDDWEBCX.js} +226 -3
  127. package/dist/chunk-MUWH4QK5.cjs +94 -0
  128. package/dist/{chunk-T6W3Z3SH.cjs → chunk-N2ILK7BF.cjs} +4 -4
  129. package/dist/{chunk-6EX3I5P4.cjs → chunk-N74QRJGP.cjs} +6 -6
  130. package/dist/chunk-NFFHLX37.cjs +132 -0
  131. package/dist/chunk-NJSYWX7H.js +190 -0
  132. package/dist/{chunk-SH5PPVK7.cjs → chunk-NQN5LFN4.cjs} +165 -221
  133. package/dist/chunk-NTQRFOPP.cjs +56 -0
  134. package/dist/{chunk-YFWRJW4B.js → chunk-NWMJPTVL.js} +51 -55
  135. package/dist/{chunk-63ZGNR2T.cjs → chunk-OC6GV5QH.cjs} +42 -42
  136. package/dist/{chunk-7E7GCQCK.js → chunk-OG3MBHM3.js} +9 -3
  137. package/dist/chunk-OMNHTCS4.cjs +264 -0
  138. package/dist/chunk-OQXB6NNC.cjs +117 -0
  139. package/dist/{chunk-Y57W2CT5.cjs → chunk-OV46CCA2.cjs} +51 -55
  140. package/dist/{chunk-6PRZIHGL.cjs → chunk-OV6HHKLE.cjs} +21 -266
  141. package/dist/{chunk-C37BHB7N.cjs → chunk-P26YYPOO.cjs} +5 -5
  142. package/dist/{chunk-2BZHWUSR.cjs → chunk-P7JEKJTZ.cjs} +16 -16
  143. package/dist/{chunk-NGBXXZLL.cjs → chunk-PDXX5UI4.cjs} +45 -45
  144. package/dist/{chunk-FHQFPYV4.js → chunk-PJFTTSKE.js} +8 -7
  145. package/dist/{chunk-GVFJ6T4S.cjs → chunk-PVODJEJ7.cjs} +721 -8
  146. package/dist/{chunk-ZZ7RO2UQ.js → chunk-Q265VZJ4.js} +3 -3
  147. package/dist/{chunk-E7JP3BS3.cjs → chunk-Q47JEE2C.cjs} +4 -4
  148. package/dist/chunk-QBY7LRN2.js +281 -0
  149. package/dist/{chunk-Z6PMDS4G.js → chunk-QDQWKSU3.js} +1090 -53
  150. package/dist/{chunk-GH6C2QGW.cjs → chunk-QEDMOGF3.cjs} +857 -16
  151. package/dist/{chunk-5WUNN6ZN.cjs → chunk-QHSAVOOL.cjs} +24 -2
  152. package/dist/chunk-QJNCDVYM.cjs +137 -0
  153. package/dist/chunk-QM7FJB5W.js +4717 -0
  154. package/dist/chunk-QQFB4RT2.cjs +448 -0
  155. package/dist/chunk-QSYBHQAD.cjs +196 -0
  156. package/dist/{chunk-UGXHYIWT.cjs → chunk-QUJ3ZB55.cjs} +28 -28
  157. package/dist/{chunk-2YSNA2F2.cjs → chunk-QVJMDVYZ.cjs} +5 -5
  158. package/dist/chunk-RAJMAX6D.js +131 -0
  159. package/dist/{chunk-VVKVQZI6.js → chunk-RAN3ECAS.js} +3 -3
  160. package/dist/chunk-RKGUZBOC.js +79 -0
  161. package/dist/{chunk-HLFDZ35S.cjs → chunk-RRQIAJLQ.cjs} +8 -8
  162. package/dist/{chunk-PABONWKI.js → chunk-RXQNRZ5F.js} +3 -3
  163. package/dist/{chunk-7ZHYEITD.cjs → chunk-S4O7CFHQ.cjs} +10 -11
  164. package/dist/chunk-SE7ANBGN.js +128 -0
  165. package/dist/{chunk-X2AVEAZM.cjs → chunk-SJIRCTIS.cjs} +176 -2
  166. package/dist/{chunk-WXQ57LAO.js → chunk-SQXAZHDG.js} +4 -4
  167. package/dist/chunk-SR73L5ZP.cjs +84 -0
  168. package/dist/{chunk-OABEO6HH.js → chunk-SZOLTWWD.js} +2349 -214
  169. package/dist/{chunk-5JEU52DW.js → chunk-TPZ3BN2D.js} +3 -3
  170. package/dist/{chunk-QFU53KRH.js → chunk-TSTFYGGX.js} +4 -5
  171. package/dist/{chunk-EBS32AJI.cjs → chunk-TZCFKZ6Z.cjs} +5 -5
  172. package/dist/chunk-UCVZXQ63.js +724 -0
  173. package/dist/chunk-UGQ3QNV6.js +992 -0
  174. package/dist/chunk-UNMVGZVW.js +142 -0
  175. package/dist/{chunk-TEVX443G.js → chunk-UTUD6GJI.js} +178 -6
  176. package/dist/chunk-UXBYA7DV.cjs +155 -0
  177. package/dist/chunk-V6GXFSK7.cjs +443 -0
  178. package/dist/chunk-VHORVGCG.cjs +761 -0
  179. package/dist/{chunk-B4EKV6HQ.js → chunk-VKCTYLDN.js} +500 -442
  180. package/dist/{chunk-O3MGZDCT.cjs → chunk-VTEXJOSD.cjs} +63 -63
  181. package/dist/chunk-VVAAZITA.cjs +287 -0
  182. package/dist/{chunk-V7AKE5VT.cjs → chunk-W2GA3EQB.cjs} +435 -42
  183. package/dist/chunk-W4GABFCR.js +37 -0
  184. package/dist/chunk-WKEK4NCA.js +490 -0
  185. package/dist/{chunk-5A4TCHOC.cjs → chunk-WNYXT4TE.cjs} +4 -4
  186. package/dist/{chunk-S762UEV5.js → chunk-WTH23ISI.js} +6 -6
  187. package/dist/{chunk-BTKZGHAV.js → chunk-WWNCM473.js} +10 -6
  188. package/dist/{chunk-7X5PNIQJ.js → chunk-X3YFRH6K.js} +27 -25
  189. package/dist/{chunk-4YNYPHH3.cjs → chunk-X75H75UY.cjs} +2351 -213
  190. package/dist/{chunk-LYJJI7ZK.cjs → chunk-XCUDDFKC.cjs} +216 -9
  191. package/dist/chunk-YAO4HPJL.cjs +120 -0
  192. package/dist/chunk-YKY2JBER.cjs +9443 -0
  193. package/dist/chunk-YP5CHEYU.cjs +154 -0
  194. package/dist/{chunk-WRNEH5MO.js → chunk-YW3I2FQL.js} +18 -7
  195. package/dist/{chunk-BRNUPDHJ.js → chunk-Z557DVYN.js} +386 -19
  196. package/dist/{chunk-VSACG2AR.js → chunk-Z6LZUYZF.js} +21 -264
  197. package/dist/chunk-ZHPMP447.cjs +43 -0
  198. package/dist/{chunk-LODTHGST.cjs → chunk-ZK7KX5CD.cjs} +133 -70
  199. package/dist/{chunk-CCPSNT6B.cjs → chunk-ZRPALBQB.cjs} +5 -5
  200. package/dist/chunk-ZVFHPMC5.js +824 -0
  201. package/dist/chunk-ZVQMKUGJ.js +443 -0
  202. package/dist/cli/holoscript-runner.cjs +86 -48
  203. package/dist/cli/holoscript-runner.js +54 -16
  204. package/dist/codebase/index.cjs +1 -1
  205. package/dist/codebase/index.js +1 -1
  206. package/dist/compiler/agent-inference.cjs +11 -11
  207. package/dist/compiler/agent-inference.js +9 -6
  208. package/dist/compiler/android-xr.cjs +13 -12
  209. package/dist/compiler/android-xr.js +11 -10
  210. package/dist/compiler/android.cjs +12 -12
  211. package/dist/compiler/android.js +10 -10
  212. package/dist/compiler/business-quest.cjs +10 -10
  213. package/dist/compiler/business-quest.js +2 -2
  214. package/dist/compiler/coco.cjs +1 -1
  215. package/dist/compiler/coco.js +1 -1
  216. package/dist/compiler/context.cjs +9 -9
  217. package/dist/compiler/context.js +6 -6
  218. package/dist/compiler/daimon-seed.cjs +36 -0
  219. package/dist/compiler/daimon-seed.js +12 -0
  220. package/dist/compiler/domain-block-utils.cjs +205 -156
  221. package/dist/compiler/domain-block-utils.js +8 -7
  222. package/dist/compiler/dtdl.cjs +10 -10
  223. package/dist/compiler/dtdl.js +7 -7
  224. package/dist/compiler/gltf-pipeline.cjs +9 -9
  225. package/dist/compiler/gltf-pipeline.js +2 -2
  226. package/dist/compiler/godot.cjs +10 -9
  227. package/dist/compiler/godot.js +9 -8
  228. package/dist/compiler/incremental.cjs +11 -11
  229. package/dist/compiler/incremental.js +6 -6
  230. package/dist/compiler/index.cjs +2585 -3273
  231. package/dist/compiler/index.d.ts +149 -35
  232. package/dist/compiler/index.js +2197 -3102
  233. package/dist/compiler/ios.cjs +11 -11
  234. package/dist/compiler/ios.js +9 -9
  235. package/dist/compiler/llm-provider-capabilities.cjs +9 -9
  236. package/dist/compiler/llm-provider-capabilities.js +6 -6
  237. package/dist/compiler/nodetoy.cjs +1 -1
  238. package/dist/compiler/nodetoy.js +1 -1
  239. package/dist/compiler/openxr.cjs +11 -10
  240. package/dist/compiler/openxr.js +10 -9
  241. package/dist/compiler/remotion.cjs +1 -1
  242. package/dist/compiler/remotion.js +1 -1
  243. package/dist/compiler/reproducibility.cjs +1 -1
  244. package/dist/compiler/reproducibility.js +1 -1
  245. package/dist/compiler/sdf.cjs +11 -10
  246. package/dist/compiler/sdf.js +9 -8
  247. package/dist/compiler/semantic-scene.cjs +7 -7
  248. package/dist/compiler/semantic-scene.js +2 -2
  249. package/dist/compiler/state.cjs +9 -9
  250. package/dist/compiler/state.js +7 -7
  251. package/dist/compiler/trait-composition.cjs +11 -11
  252. package/dist/compiler/trait-composition.js +7 -7
  253. package/dist/compiler/traits/ProvenanceSemiring.d.ts +167 -0
  254. package/dist/compiler/traits/Semiring.d.ts +26 -0
  255. package/dist/compiler/unity.cjs +11 -10
  256. package/dist/compiler/unity.js +10 -9
  257. package/dist/compiler/unreal.cjs +12 -11
  258. package/dist/compiler/unreal.js +10 -9
  259. package/dist/compiler/urdf.cjs +18 -17
  260. package/dist/compiler/urdf.js +9 -8
  261. package/dist/compiler/usd-physics.cjs +11 -10
  262. package/dist/compiler/usd-physics.js +8 -7
  263. package/dist/compiler/visionos.cjs +11 -10
  264. package/dist/compiler/visionos.js +10 -9
  265. package/dist/compiler/vrchat.cjs +11 -10
  266. package/dist/compiler/vrchat.js +9 -8
  267. package/dist/compiler/wasm.cjs +14 -13
  268. package/dist/compiler/wasm.js +9 -8
  269. package/dist/compiler/webgpu.cjs +10 -9
  270. package/dist/compiler/webgpu.js +9 -8
  271. package/dist/constants.cjs +398 -0
  272. package/dist/constants.js +9 -0
  273. package/dist/coordinators/index.cjs +4 -1
  274. package/dist/coordinators/index.js +4 -1
  275. package/dist/debugger.cjs +11 -9
  276. package/dist/debugger.js +9 -7
  277. package/dist/{dist-ACXG6IH5.cjs → dist-GRMOP2UL.cjs} +341 -65
  278. package/dist/{dist-VD4L6V7Q.js → dist-ZBUKU2JG.js} +333 -63
  279. package/dist/entries/interop.cjs +23 -23
  280. package/dist/entries/interop.js +3 -3
  281. package/dist/entries/scripting.cjs +12 -11
  282. package/dist/entries/scripting.js +8 -7
  283. package/dist/evolution/index.cjs +66 -0
  284. package/dist/evolution/index.d.ts +162 -0
  285. package/dist/evolution/index.js +17 -0
  286. package/dist/hololand/index.cjs +41 -37
  287. package/dist/hololand/index.js +3 -3
  288. package/dist/index.cjs +12394 -3224
  289. package/dist/index.d.ts +260 -18
  290. package/dist/index.js +10755 -2182
  291. package/dist/keyword-registry/PluginKeywordRegistry.d.ts +138 -0
  292. package/dist/keyword-registry/index.cjs +29 -0
  293. package/dist/keyword-registry/index.d.ts +1 -0
  294. package/dist/keyword-registry/index.js +4 -0
  295. package/dist/math/tropical-spmv.cjs +11 -11
  296. package/dist/math/tropical-spmv.d.ts +1 -0
  297. package/dist/math/tropical-spmv.js +2 -2
  298. package/dist/math/tropicalSpmv.d.ts +43 -0
  299. package/dist/math/vec3.cjs +1 -1
  300. package/dist/math/vec3.js +1 -1
  301. package/dist/matter/StagedMatter.d.ts +82 -0
  302. package/dist/matter/index.cjs +17 -0
  303. package/dist/matter/index.d.ts +1 -0
  304. package/dist/matter/index.js +4 -0
  305. package/dist/{ml-dsa-Z7JDKW4L.js → ml-dsa-J6VKVT4K.js} +3 -3
  306. package/dist/{ml-dsa-FSKBTE3W.cjs → ml-dsa-MTIK4ZUQ.cjs} +23 -23
  307. package/dist/paper-0c-spike/index.cjs +1 -1
  308. package/dist/paper-0c-spike/index.js +1 -1
  309. package/dist/parameter-envelope/ParameterEnvelope.d.ts +128 -0
  310. package/dist/parameter-envelope/index.cjs +17 -0
  311. package/dist/parameter-envelope/index.d.ts +2 -0
  312. package/dist/parameter-envelope/index.js +4 -0
  313. package/dist/parser/HoloCompositionTypes.d.ts +2013 -0
  314. package/dist/parser/PipelineParser.d.ts +162 -0
  315. package/dist/parser.cjs +36 -20
  316. package/dist/parser.js +13 -9
  317. package/dist/plugin-manifest/ManifestAutoLoader.d.ts +35 -0
  318. package/dist/plugin-manifest/PluginManifest.d.ts +156 -0
  319. package/dist/plugin-manifest/index.cjs +25 -0
  320. package/dist/plugin-manifest/index.d.ts +2 -0
  321. package/dist/plugin-manifest/index.js +4 -0
  322. package/dist/plugin-solver-contract/PluginSolverContract.d.ts +288 -0
  323. package/dist/plugin-solver-contract/index.cjs +41 -0
  324. package/dist/plugin-solver-contract/index.d.ts +1 -0
  325. package/dist/plugin-solver-contract/index.js +4 -0
  326. package/dist/policy/ContentPolicyGate.d.ts +51 -0
  327. package/dist/policy/PolicyPack.d.ts +120 -0
  328. package/dist/policy/blocklist.d.ts +32 -0
  329. package/dist/policy/defaults.d.ts +44 -0
  330. package/dist/policy/index.cjs +106 -0
  331. package/dist/policy/index.d.ts +17 -0
  332. package/dist/policy/index.js +5 -0
  333. package/dist/policy/jsonLogic.d.ts +31 -0
  334. package/dist/policy/types.d.ts +174 -0
  335. package/dist/proof-composition/ProofCompositionLaw.d.ts +93 -0
  336. package/dist/proof-composition/index.cjs +25 -0
  337. package/dist/proof-composition/index.d.ts +1 -0
  338. package/dist/proof-composition/index.js +4 -0
  339. package/dist/receipts/hash-policy.d.ts +85 -0
  340. package/dist/reconstruction/index.cjs +75 -47
  341. package/dist/reconstruction/index.js +5 -5
  342. package/dist/runtime/plugin-trait-registrar.d.ts +36 -0
  343. package/dist/runtime.cjs +81 -79
  344. package/dist/runtime.js +9 -7
  345. package/dist/scene-presets-EDKYZ5GW.js +4 -0
  346. package/dist/scene-presets-NCW2CFRS.cjs +17 -0
  347. package/dist/self-improvement/index.cjs +1 -1
  348. package/dist/self-improvement/index.js +1 -1
  349. package/dist/{src-PT2FERDV.cjs → src-G3D7ZATQ.cjs} +545 -21
  350. package/dist/{src-J6CM4AUR.js → src-UXYA7HM6.js} +539 -16
  351. package/dist/storage/index.cjs +10 -10
  352. package/dist/storage/index.js +3 -3
  353. package/dist/testing.cjs +1 -1
  354. package/dist/testing.js +1 -1
  355. package/dist/tools/index.cjs +3631 -0
  356. package/dist/tools/index.js +3581 -0
  357. package/dist/traitDocs/traitDocs.cjs +9 -9
  358. package/dist/traitDocs/traitDocs.d.ts +1 -0
  359. package/dist/traitDocs/traitDocs.js +3 -3
  360. package/dist/traits/ControlLoopTrait.d.ts +154 -0
  361. package/dist/traits/KinematicChainTrait.d.ts +116 -0
  362. package/dist/traits/SensorSamplingTrait.d.ts +154 -0
  363. package/dist/traits/TraitTypes.d.ts +270 -0
  364. package/dist/traits/TransactionTrait.d.ts +121 -0
  365. package/dist/traits/botanical-lotus.cjs +54 -50
  366. package/dist/traits/botanical-lotus.js +2 -5
  367. package/dist/traits/control-loop.cjs +21 -0
  368. package/dist/traits/control-loop.d.ts +1 -0
  369. package/dist/traits/control-loop.js +4 -0
  370. package/dist/traits/engines/cloth-verlet.d.ts +65 -0
  371. package/dist/traits/engines/index.cjs +19 -19
  372. package/dist/traits/engines/index.d.ts +15 -275
  373. package/dist/traits/engines/index.js +3 -3
  374. package/dist/traits/engines/motion-data-schema.d.ts +119 -0
  375. package/dist/traits/engines/motion-matching.d.ts +102 -0
  376. package/dist/traits/engines/noise.d.ts +25 -0
  377. package/dist/traits/engines/onnx-adapter.d.ts +173 -0
  378. package/dist/traits/engines/onnx-motion-matching.d.ts +163 -0
  379. package/dist/traits/engines/pfnn-network.d.ts +92 -0
  380. package/dist/traits/engines/synthetic-walk-cycle.d.ts +38 -0
  381. package/dist/traits/engines/tensor-ops.d.ts +15 -0
  382. package/dist/traits/index.cjs +2789 -1259
  383. package/dist/traits/index.d.ts +35 -0
  384. package/dist/traits/index.js +1692 -411
  385. package/dist/traits/kinematic-chain.cjs +25 -0
  386. package/dist/traits/kinematic-chain.d.ts +1 -0
  387. package/dist/traits/kinematic-chain.js +4 -0
  388. package/dist/traits/sensor-sampling.cjs +33 -0
  389. package/dist/traits/sensor-sampling.d.ts +1 -0
  390. package/dist/traits/sensor-sampling.js +4 -0
  391. package/dist/traits/simulation-solver-factory.cjs +1 -1
  392. package/dist/traits/simulation-solver-factory.js +1 -1
  393. package/dist/traits/transaction.cjs +29 -0
  394. package/dist/traits/transaction.d.ts +1 -0
  395. package/dist/traits/transaction.js +4 -0
  396. package/dist/traits/webcam-gaze.cjs +1 -1
  397. package/dist/traits/webcam-gaze.js +1 -1
  398. package/dist/type-checker.cjs +7 -6
  399. package/dist/type-checker.js +5 -4
  400. package/dist/types/AdvancedTypeSystem.d.ts +489 -0
  401. package/dist/types/HoloScriptPlus.d.ts +810 -0
  402. package/dist/types/base.d.ts +248 -0
  403. package/dist/types.d.ts +799 -0
  404. package/dist/world/index.cjs +3 -4
  405. package/dist/world/index.js +3 -4
  406. package/dist/world-model/index.cjs +1 -1
  407. package/dist/world-model/index.js +1 -1
  408. package/dist/wot/index.cjs +1 -1
  409. package/dist/wot/index.js +1 -1
  410. package/package.json +113 -46
  411. package/dist/GLTFPipeline-3EJLL3TS.cjs +0 -38
  412. package/dist/GLTFPipeline-3OWJV2VK.js +0 -17
  413. package/dist/HoloScriptPlusParser-ADWRY5OS.cjs +0 -698
  414. package/dist/HoloScriptPlusParser-JLJDXHSC.js +0 -693
  415. package/dist/HoloScriptPlusParser-QCGFPWIL.cjs +0 -27
  416. package/dist/HoloScriptPlusParser-WENAFEFV.js +0 -10
  417. package/dist/HoloScriptRuntime-GGRVEU4T.cjs +0 -19
  418. package/dist/HoloScriptRuntime-GJK6VJPH.js +0 -10
  419. package/dist/chunk-22Q5A6RV.js +0 -979
  420. package/dist/chunk-4C57PR42.js +0 -468
  421. package/dist/chunk-4W5G5QVL.cjs +0 -847
  422. package/dist/chunk-5ET6L4NS.js +0 -487
  423. package/dist/chunk-C4GSLCHE.cjs +0 -7153
  424. package/dist/chunk-F2G6CWFT.js +0 -7089
  425. package/dist/chunk-G6PNEASF.cjs +0 -814
  426. package/dist/chunk-GTA4Q3A3.js +0 -1491
  427. package/dist/chunk-HCCQLAA4.cjs +0 -74
  428. package/dist/chunk-HFSVMKM3.cjs +0 -72
  429. package/dist/chunk-KAIVDEIG.cjs +0 -4539
  430. package/dist/chunk-KQU64CIX.cjs +0 -1508
  431. package/dist/chunk-MSYSQ2AJ.js +0 -4533
  432. package/dist/chunk-NHJLP37F.js +0 -70
  433. package/dist/chunk-NHYRRAGI.cjs +0 -490
  434. package/dist/chunk-OIQYIIO3.cjs +0 -473
  435. package/dist/chunk-OL46QLBJ.js +0 -61
  436. package/dist/chunk-SKZPC5AG.cjs +0 -984
  437. package/dist/chunk-SLHLXUMO.js +0 -445
  438. package/dist/chunk-UOIGFQXC.cjs +0 -9750
  439. package/dist/chunk-UOL6Y5TD.cjs +0 -759
  440. package/dist/chunk-UVFI7XIR.cjs +0 -452
  441. package/dist/chunk-VEPGBETF.js +0 -844
  442. package/dist/chunk-XQ5MWMP2.js +0 -756
  443. package/dist/chunk-XT6JY5W5.js +0 -9684
  444. package/dist/chunk-YRRAUB35.js +0 -811
  445. package/dist/compiler/GasOptimizationAnalyzer.d.ts +0 -73
  446. package/dist/compiler/NFTMarketplaceCompiler.d.ts +0 -23
  447. package/dist/compiler/ar.cjs +0 -23
  448. package/dist/compiler/ar.js +0 -11
  449. package/dist/compiler/babylon.cjs +0 -21
  450. package/dist/compiler/babylon.js +0 -15
  451. package/dist/compiler/multi-layer.cjs +0 -24
  452. package/dist/compiler/multi-layer.js +0 -15
  453. package/dist/compiler/playcanvas.cjs +0 -19
  454. package/dist/compiler/playcanvas.js +0 -13
  455. package/dist/compiler/r3f.cjs +0 -39
  456. package/dist/compiler/r3f.d.ts +0 -22
  457. package/dist/compiler/r3f.js +0 -17
  458. package/dist/compiler/vrr.cjs +0 -24
  459. package/dist/compiler/vrr.js +0 -12
  460. package/dist/parser/NFTMarketplaceTypes.d.ts +0 -191
  461. package/dist/playwright-3AT3AKTV.cjs +0 -98673
  462. package/dist/playwright-VZPDVUEQ.js +0 -98660
@@ -0,0 +1,4717 @@
1
+ import { ASTNodePool } from './chunk-2MQKNDNH.js';
2
+ import { MATERIAL_PROPERTIES_VISUALS, SURFACE_TEXTURE_VISUALS, LIGHTING_VISUALS, GEMS_MINERALS_VISUALS, FABRIC_CLOTH_VISUALS, VISUAL_EFFECTS_VISUALS, AGE_CONDITION_VISUALS, WATER_FLUID_VISUALS, WEATHER_PHENOMENA_VISUALS, EMOTION_MOOD_VISUALS, SIZE_SCALE_VISUALS, ENVIRONMENTAL_BIOME_VISUALS, MAGIC_FANTASY_VISUALS, SCIFI_TECHNOLOGY_VISUALS, CREATURES_MYTHICAL_VISUALS, NATURE_LIFE_VISUALS, FURNITURE_DECOR_VISUALS, CONSTRUCTION_BUILDING_VISUALS, CONTAINERS_STORAGE_VISUALS, SHAPE_FORM_VISUALS, ANIMALS_VISUALS, MARITIME_NAVAL_VISUALS, TIME_PERIOD_VISUALS, ACCESSIBILITY_VISUALS, ACCESSIBILITY_EXTENDED_VISUALS, ARCHITECTURE_REALESTATE_VISUALS, AUDIO_VISUALS, COOKING_FOOD_VISUALS, CORE_VR_INTERACTION_VISUALS, DATA_VISUALIZATION_VISUALS, PERCEPTUAL_COLOR_VISUALS, EDUCATION_LEARNING_VISUALS, ENVIRONMENT_INPUT_VISUALS, GAME_MECHANICS_VISUALS, GEOSPATIAL_WEB3_VISUALS, HEALTHCARE_MEDICAL_VISUALS, HUMANOID_AVATAR_VISUALS, INTELLIGENCE_BEHAVIOR_VISUALS, INTEROP_COPRESENCE_VISUALS, IOT_AUTONOMOUS_AGENTS_VISUALS, LOCOMOTION_MOVEMENT_VISUALS, MEASUREMENT_SENSING_VISUALS, MEDIA_ANALYTICS_VISUALS, MULTISENSORY_HAPTIC_VISUALS, MUSICAL_SOUND_VISUALS, MUSIC_PERFORMANCE_VISUALS, NARRATIVE_STORYTELLING_VISUALS, NETWORKING_AI_VISUALS, NPC_ROLES_VISUALS, OBJECT_INTERACTION_VISUALS, PARSER_CORE_UI_VISUALS, PHYSICAL_AFFORDANCES_VISUALS, PHYSICS_EXPANSION_VISUALS, PROCEDURAL_GENERATION_VISUALS, RESOURCE_GATHERING_VISUALS, SAFETY_BOUNDARIES_VISUALS, SIGNS_COMMUNICATION_VISUALS, SIMPLE_MODIFIERS_VISUALS, SOCIAL_COMMERCE_VISUALS, SOCIAL_EFFECTS_VISUALS, SPORTS_FITNESS_VISUALS, STATE_PERSISTENCE_VISUALS, TRANSPORTATION_VEHICLES_VISUALS, VOLUMETRIC_WEBGPU_VISUALS, WEATHER_PARTICLES_VISUALS, XR_PLATFORM_VISUALS } from './chunk-6TRX6AR2.js';
3
+ import { TraitVisualRegistry, TraitCompositor } from './chunk-ZVQMKUGJ.js';
4
+ import { createBotanicalLotusRenderProfile, buildLotusPetalMaterialSpec, LOTUS_PETAL_UNIFORM_BINDINGS, buildLotusPetalGeometryData, lotusPetalGeometryParamsFromProfile, buildLotusFlowerPlacements, buildLotusSceneScaffold } from './chunk-VKCTYLDN.js';
5
+ import { ProvenanceSemiring } from './chunk-DQRJ5RJG.js';
6
+ import { init_PlatformConditionalCompilerMixin, createPlatformTarget, PlatformConditionalCompilerMixin } from './chunk-DJNH4HFW.js';
7
+ import { init_DomainBlockCompilerMixin, compileDomainBlocks, compileSimulationBlock, simulationToR3F, compileWeatherBlock, weatherToR3F, compileAudioSourceBlock, audioSourceToR3F, compilePostProcessingBlock, postProcessingToR3F, compileParticleBlock, particlesToR3F, compilePhysicsBlock, physicsToR3F, compileMaterialBlock, materialToR3F, compileProceduralBlock } from './chunk-5LVFTGKH.js';
8
+ import { init_PerceptualColorPass, applyPerceptualColorPass } from './chunk-UCVZXQ63.js';
9
+ import { init_AgentRBAC, init_CompilerBase, getRBAC, UnauthorizedCompilerAccessError, escapeStringValue } from './chunk-DUG3OQAS.js';
10
+ import { mulberry32 } from './chunk-GLEJ2TLS.js';
11
+
12
+ // src/compiler/SceneIRCompiler.ts
13
+ init_PerceptualColorPass();
14
+
15
+ // src/traits/visual/presets/hologram-media.visual.ts
16
+ var HOLOGRAM_MEDIA_VISUALS = {
17
+ depth_estimation: {
18
+ material: { roughness: 0.3 },
19
+ emissive: { color: "#6644FF", intensity: 0.2 },
20
+ tags: ["ai", "depth", "hologram"],
21
+ layer: "visual_effect"
22
+ },
23
+ displacement: {
24
+ material: { roughness: 0.4 },
25
+ emissive: { color: "#8866FF", intensity: 0.15 },
26
+ tags: ["3d", "depth", "mesh"],
27
+ layer: "visual_effect"
28
+ },
29
+ segment: {
30
+ material: { roughness: 0.3 },
31
+ emissive: { color: "#FF44AA", intensity: 0.15 },
32
+ tags: ["ai", "segmentation", "mask"],
33
+ layer: "visual_effect"
34
+ },
35
+ animated_texture: {
36
+ material: { roughness: 0.3 },
37
+ emissive: { color: "#44FFAA", intensity: 0.15 },
38
+ tags: ["animation", "texture", "gif"],
39
+ layer: "visual_effect"
40
+ },
41
+ holographic_sprite: {
42
+ material: { roughness: 0.2 },
43
+ emissive: { color: "#AA44FF", intensity: 0.3 },
44
+ tags: ["hologram", "sprite", "3d"],
45
+ layer: "visual_effect"
46
+ },
47
+ quilt: {
48
+ material: { roughness: 0.3 },
49
+ emissive: { color: "#44AAFF", intensity: 0.2 },
50
+ tags: ["hologram", "multiview", "looking-glass"],
51
+ layer: "visual_effect"
52
+ },
53
+ gaussian_splatting: {
54
+ material: { roughness: 0.2 },
55
+ emissive: { color: "#AACCFF", intensity: 0.15 },
56
+ tags: ["3d", "photorealistic", "splat"],
57
+ layer: "visual_effect"
58
+ },
59
+ spatial_video: {
60
+ material: { roughness: 0.3 },
61
+ emissive: { color: "#FF8844", intensity: 0.15 },
62
+ tags: ["video", "stereo", "spatial"],
63
+ layer: "visual_effect"
64
+ },
65
+ image: {
66
+ material: { roughness: 0.4 },
67
+ tags: ["media", "texture", "source"],
68
+ layer: "base_material"
69
+ },
70
+ depth_sequence: {
71
+ material: { roughness: 0.3 },
72
+ emissive: { color: "#6644FF", intensity: 0.1 },
73
+ tags: ["video", "depth", "temporal"],
74
+ layer: "visual_effect"
75
+ },
76
+ temporal_smoothing: {
77
+ material: { roughness: 0.3 },
78
+ tags: ["processing", "temporal"],
79
+ layer: "visual_effect"
80
+ },
81
+ depth_to_normal: {
82
+ material: { roughness: 0.3 },
83
+ emissive: { color: "#8888FF", intensity: 0.1 },
84
+ tags: ["processing", "normal-map"],
85
+ layer: "visual_effect"
86
+ }
87
+ };
88
+
89
+ // src/traits/visual/presets/gaps-physics.visual.ts
90
+ var GAPS_PHYSICS_VISUALS = /* @__PURE__ */ new Map([
91
+ // --- Pillar A: Unified Physics ---
92
+ [
93
+ "fluid",
94
+ {
95
+ material: {
96
+ type: "physical",
97
+ color: "#1a6fc4",
98
+ metalness: 0,
99
+ roughness: 0.05,
100
+ transmission: 0.95,
101
+ ior: 1.33,
102
+ thickness: 0.5
103
+ },
104
+ layers: [
105
+ {
106
+ type: "effect",
107
+ name: "ssfr",
108
+ priority: 50,
109
+ config: {
110
+ resolutionScale: 0.5,
111
+ absorptionColor: [0.4, 0.04, 0],
112
+ absorptionStrength: 2,
113
+ fresnelPower: 0.02,
114
+ refractionStrength: 0.1
115
+ }
116
+ }
117
+ ]
118
+ }
119
+ ],
120
+ [
121
+ "soft_body_pro",
122
+ {
123
+ material: {
124
+ type: "physical",
125
+ color: "#e8a87c",
126
+ metalness: 0,
127
+ roughness: 0.6
128
+ },
129
+ layers: [
130
+ {
131
+ type: "deformation",
132
+ name: "pbd_tearing",
133
+ priority: 45,
134
+ config: { tearThreshold: 0.8, tearColor: "#8b0000" }
135
+ }
136
+ ]
137
+ }
138
+ ],
139
+ [
140
+ "crowd_sim",
141
+ {
142
+ material: {
143
+ type: "standard",
144
+ color: "#7b68ee"
145
+ },
146
+ layers: [
147
+ {
148
+ type: "instanced",
149
+ name: "crowd_instances",
150
+ priority: 30,
151
+ config: { maxInstances: 1e4, lodLevels: 3 }
152
+ }
153
+ ]
154
+ }
155
+ ],
156
+ [
157
+ "deformable_terrain",
158
+ {
159
+ material: {
160
+ type: "standard",
161
+ color: "#8b7355",
162
+ roughness: 0.9
163
+ },
164
+ layers: [
165
+ {
166
+ type: "displacement",
167
+ name: "heightmap_erosion",
168
+ priority: 40,
169
+ config: { displacementScale: 5 }
170
+ }
171
+ ]
172
+ }
173
+ ],
174
+ [
175
+ "volumetric_clouds",
176
+ {
177
+ material: {
178
+ type: "shader",
179
+ color: "#ffffff"
180
+ },
181
+ layers: [
182
+ {
183
+ type: "volumetric",
184
+ name: "cloud_raymarcher",
185
+ priority: 80,
186
+ config: {
187
+ absorptionCoeff: 0.04,
188
+ scatteringCoeff: 0.06,
189
+ phaseG: 0.3,
190
+ maxSteps: 64
191
+ }
192
+ }
193
+ ]
194
+ }
195
+ ],
196
+ [
197
+ "god_rays",
198
+ {
199
+ material: {
200
+ type: "shader",
201
+ color: "#fffde7"
202
+ },
203
+ layers: [
204
+ {
205
+ type: "post_process",
206
+ name: "volumetric_light",
207
+ priority: 85,
208
+ config: { decay: 0.96, weight: 0.5, exposure: 0.3, samples: 100 }
209
+ }
210
+ ]
211
+ }
212
+ ],
213
+ // --- Weather Hub ---
214
+ [
215
+ "weather",
216
+ {
217
+ material: {
218
+ type: "none",
219
+ color: "#87ceeb"
220
+ },
221
+ layers: [
222
+ {
223
+ type: "ambient",
224
+ name: "weather_atmosphere",
225
+ priority: 90,
226
+ config: { affectsLighting: true, affectsFog: true }
227
+ }
228
+ ]
229
+ }
230
+ ],
231
+ // --- Pillar B: Persistent World ---
232
+ [
233
+ "world_state",
234
+ {
235
+ material: {
236
+ type: "none",
237
+ color: "#4a90d9"
238
+ },
239
+ layers: []
240
+ }
241
+ ],
242
+ [
243
+ "spatial_voice",
244
+ {
245
+ material: {
246
+ type: "none",
247
+ color: "#90ee90"
248
+ },
249
+ layers: [
250
+ {
251
+ type: "indicator",
252
+ name: "voice_range",
253
+ priority: 10,
254
+ config: { showRadius: true, radiusColor: "#90ee9040" }
255
+ }
256
+ ]
257
+ }
258
+ ],
259
+ [
260
+ "lip_sync",
261
+ {
262
+ material: {
263
+ type: "none",
264
+ color: "#ffb6c1"
265
+ },
266
+ layers: [
267
+ {
268
+ type: "morph",
269
+ name: "viseme_blendshapes",
270
+ priority: 60,
271
+ config: { blendShapePrefix: "viseme_" }
272
+ }
273
+ ]
274
+ }
275
+ ],
276
+ // --- Pillar C: Living Economy ---
277
+ [
278
+ "ai_companion",
279
+ {
280
+ material: {
281
+ type: "standard",
282
+ color: "#dda0dd",
283
+ emissive: "#330033",
284
+ emissiveIntensity: 0.2
285
+ },
286
+ layers: [
287
+ {
288
+ type: "indicator",
289
+ name: "ai_thinking",
290
+ priority: 15,
291
+ config: { pulseColor: "#9b59b6", pulseSpeed: 1.5 }
292
+ }
293
+ ]
294
+ }
295
+ ],
296
+ [
297
+ "token_gated",
298
+ {
299
+ material: {
300
+ type: "standard",
301
+ color: "#ffd700",
302
+ metalness: 0.8,
303
+ roughness: 0.2
304
+ },
305
+ layers: [
306
+ {
307
+ type: "barrier",
308
+ name: "token_gate_barrier",
309
+ priority: 70,
310
+ config: { barrierColor: "#ffd70060", shimmer: true }
311
+ }
312
+ ]
313
+ }
314
+ ],
315
+ [
316
+ "moderation",
317
+ {
318
+ material: {
319
+ type: "none",
320
+ color: "#ff6347"
321
+ },
322
+ layers: []
323
+ }
324
+ ],
325
+ [
326
+ "anti_grief",
327
+ {
328
+ material: {
329
+ type: "none",
330
+ color: "#32cd32"
331
+ },
332
+ layers: [
333
+ {
334
+ type: "shield",
335
+ name: "grief_shield",
336
+ priority: 95,
337
+ config: { shieldColor: "#32cd3230" }
338
+ }
339
+ ]
340
+ }
341
+ ]
342
+ ]);
343
+
344
+ // src/traits/visual/presets/phone-sleeve-vr.visual.ts
345
+ var PHONE_SLEEVE_VR_VISUALS = {
346
+ // --- Hardware Form Factor ---
347
+ phone_sleeve: {
348
+ material: { roughness: 0.3, metalness: 0.6 },
349
+ emissive: { color: "#00CCFF", intensity: 0.2 },
350
+ tags: ["vr", "phone", "sleeve", "headset"],
351
+ layer: "visual_effect"
352
+ },
353
+ sleeve_nfc_trigger: {
354
+ material: { roughness: 0.4 },
355
+ emissive: { color: "#FFD700", intensity: 0.15 },
356
+ tags: ["nfc", "trigger", "hardware"],
357
+ layer: "visual_effect"
358
+ },
359
+ sleeve_lens_profile: {
360
+ material: { roughness: 0.1, metalness: 0 },
361
+ opacity: 0.6,
362
+ tags: ["lens", "optics"],
363
+ layer: "visual_effect"
364
+ },
365
+ phone_detection: {
366
+ material: { roughness: 0.4 },
367
+ emissive: { color: "#44FF88", intensity: 0.1 },
368
+ tags: ["detection", "calibration"],
369
+ layer: "visual_effect"
370
+ },
371
+ // --- Display ---
372
+ stereo_split: {
373
+ material: { roughness: 0.2 },
374
+ emissive: { color: "#FF44AA", intensity: 0.2 },
375
+ tags: ["stereoscopic", "display", "split"],
376
+ layer: "visual_effect"
377
+ },
378
+ barrel_distortion: {
379
+ material: { roughness: 0.3 },
380
+ emissive: { color: "#AA44FF", intensity: 0.15 },
381
+ tags: ["distortion", "shader", "lens"],
382
+ layer: "visual_effect"
383
+ },
384
+ chromatic_aberration_fix: {
385
+ material: { roughness: 0.3 },
386
+ emissive: { color: "#FF8800", intensity: 0.1 },
387
+ tags: ["color", "correction", "lens"],
388
+ layer: "visual_effect"
389
+ },
390
+ ipd_adjust: {
391
+ material: { roughness: 0.4 },
392
+ emissive: { color: "#44CCFF", intensity: 0.1 },
393
+ tags: ["calibration", "ipd", "comfort"],
394
+ layer: "visual_effect"
395
+ },
396
+ // --- Sensor / Tracking ---
397
+ gyro_head_tracking: {
398
+ material: { roughness: 0.4 },
399
+ emissive: { color: "#00FF88", intensity: 0.15 },
400
+ tags: ["tracking", "gyroscope", "3dof"],
401
+ layer: "visual_effect"
402
+ },
403
+ accel_sensor_fusion: {
404
+ material: { roughness: 0.4 },
405
+ emissive: { color: "#00CC66", intensity: 0.1 },
406
+ tags: ["sensor", "accelerometer", "fusion"],
407
+ layer: "visual_effect"
408
+ },
409
+ mag_drift_correction: {
410
+ material: { roughness: 0.4 },
411
+ emissive: { color: "#8844FF", intensity: 0.1 },
412
+ tags: ["magnetometer", "drift", "correction"],
413
+ layer: "visual_effect"
414
+ },
415
+ positional_estimation: {
416
+ material: { roughness: 0.4 },
417
+ emissive: { color: "#FFAA00", intensity: 0.15 },
418
+ tags: ["6dof", "vio", "tracking"],
419
+ layer: "visual_effect"
420
+ },
421
+ // --- Interaction ---
422
+ gaze_cursor: {
423
+ material: { roughness: 0.2 },
424
+ emissive: { color: "#FFFFFF", intensity: 0.3 },
425
+ tags: ["gaze", "cursor", "reticle"],
426
+ layer: "visual_effect"
427
+ },
428
+ gaze_dwell_select: {
429
+ material: { roughness: 0.3 },
430
+ emissive: { color: "#FFFF44", intensity: 0.2 },
431
+ tags: ["gaze", "dwell", "selection"],
432
+ layer: "visual_effect"
433
+ },
434
+ bt_controller: {
435
+ material: { roughness: 0.5, metalness: 0.3 },
436
+ tags: ["bluetooth", "controller", "input"],
437
+ layer: "visual_effect"
438
+ },
439
+ tap_select: {
440
+ material: { roughness: 0.4 },
441
+ emissive: { color: "#44FF44", intensity: 0.1 },
442
+ tags: ["tap", "capacitive", "input"],
443
+ layer: "visual_effect"
444
+ },
445
+ voice_command: {
446
+ material: { roughness: 0.4 },
447
+ emissive: { color: "#4488FF", intensity: 0.1 },
448
+ tags: ["voice", "speech", "command"],
449
+ layer: "visual_effect"
450
+ },
451
+ // --- Performance ---
452
+ thermal_throttle: {
453
+ material: { roughness: 0.6 },
454
+ emissive: { color: "#FF4400", intensity: 0.2 },
455
+ tags: ["thermal", "throttle", "performance"],
456
+ layer: "visual_effect"
457
+ },
458
+ battery_aware_lod: {
459
+ material: { roughness: 0.5 },
460
+ emissive: { color: "#44FF00", intensity: 0.1 },
461
+ tags: ["battery", "lod", "adaptive"],
462
+ layer: "visual_effect"
463
+ },
464
+ sleeve_foveated: {
465
+ material: { roughness: 0.3 },
466
+ emissive: { color: "#CC44FF", intensity: 0.15 },
467
+ tags: ["foveated", "rendering", "performance"],
468
+ layer: "visual_effect"
469
+ },
470
+ low_persistence: {
471
+ material: { roughness: 0.2 },
472
+ emissive: { color: "#88CCFF", intensity: 0.1 },
473
+ tags: ["display", "persistence", "blur"],
474
+ layer: "visual_effect"
475
+ },
476
+ // --- Comfort ---
477
+ vr_comfort_vignette: {
478
+ material: { roughness: 0.5 },
479
+ opacity: 0.7,
480
+ tags: ["comfort", "vignette", "motion"],
481
+ layer: "visual_effect"
482
+ },
483
+ reorient_snap: {
484
+ material: { roughness: 0.4 },
485
+ emissive: { color: "#44FFCC", intensity: 0.1 },
486
+ tags: ["snap", "recenter", "comfort"],
487
+ layer: "visual_effect"
488
+ },
489
+ static_horizon: {
490
+ material: { roughness: 0.4 },
491
+ emissive: { color: "#88FF88", intensity: 0.1 },
492
+ tags: ["horizon", "stability", "nausea"],
493
+ layer: "visual_effect"
494
+ },
495
+ session_timer: {
496
+ material: { roughness: 0.4 },
497
+ emissive: { color: "#FFCC00", intensity: 0.15 },
498
+ tags: ["timer", "health", "breaks"],
499
+ layer: "visual_effect"
500
+ }
501
+ };
502
+
503
+ // src/traits/visual/index.ts
504
+ var ALL_PRESETS = [
505
+ // Original 12
506
+ MATERIAL_PROPERTIES_VISUALS,
507
+ SURFACE_TEXTURE_VISUALS,
508
+ LIGHTING_VISUALS,
509
+ GEMS_MINERALS_VISUALS,
510
+ FABRIC_CLOTH_VISUALS,
511
+ VISUAL_EFFECTS_VISUALS,
512
+ AGE_CONDITION_VISUALS,
513
+ WATER_FLUID_VISUALS,
514
+ WEATHER_PHENOMENA_VISUALS,
515
+ EMOTION_MOOD_VISUALS,
516
+ SIZE_SCALE_VISUALS,
517
+ ENVIRONMENTAL_BIOME_VISUALS,
518
+ // Expansion wave 1
519
+ MAGIC_FANTASY_VISUALS,
520
+ SCIFI_TECHNOLOGY_VISUALS,
521
+ CREATURES_MYTHICAL_VISUALS,
522
+ NATURE_LIFE_VISUALS,
523
+ FURNITURE_DECOR_VISUALS,
524
+ CONSTRUCTION_BUILDING_VISUALS,
525
+ CONTAINERS_STORAGE_VISUALS,
526
+ SHAPE_FORM_VISUALS,
527
+ ANIMALS_VISUALS,
528
+ MARITIME_NAVAL_VISUALS,
529
+ TIME_PERIOD_VISUALS,
530
+ // Expansion wave 2 — full coverage
531
+ ACCESSIBILITY_VISUALS,
532
+ ACCESSIBILITY_EXTENDED_VISUALS,
533
+ ARCHITECTURE_REALESTATE_VISUALS,
534
+ AUDIO_VISUALS,
535
+ COOKING_FOOD_VISUALS,
536
+ CORE_VR_INTERACTION_VISUALS,
537
+ DATA_VISUALIZATION_VISUALS,
538
+ PERCEPTUAL_COLOR_VISUALS,
539
+ EDUCATION_LEARNING_VISUALS,
540
+ ENVIRONMENT_INPUT_VISUALS,
541
+ GAME_MECHANICS_VISUALS,
542
+ GEOSPATIAL_WEB3_VISUALS,
543
+ HEALTHCARE_MEDICAL_VISUALS,
544
+ HUMANOID_AVATAR_VISUALS,
545
+ INTELLIGENCE_BEHAVIOR_VISUALS,
546
+ INTEROP_COPRESENCE_VISUALS,
547
+ IOT_AUTONOMOUS_AGENTS_VISUALS,
548
+ LOCOMOTION_MOVEMENT_VISUALS,
549
+ MEASUREMENT_SENSING_VISUALS,
550
+ MEDIA_ANALYTICS_VISUALS,
551
+ MULTISENSORY_HAPTIC_VISUALS,
552
+ MUSICAL_SOUND_VISUALS,
553
+ MUSIC_PERFORMANCE_VISUALS,
554
+ NARRATIVE_STORYTELLING_VISUALS,
555
+ NETWORKING_AI_VISUALS,
556
+ NPC_ROLES_VISUALS,
557
+ OBJECT_INTERACTION_VISUALS,
558
+ PARSER_CORE_UI_VISUALS,
559
+ PHYSICAL_AFFORDANCES_VISUALS,
560
+ PHYSICS_EXPANSION_VISUALS,
561
+ PROCEDURAL_GENERATION_VISUALS,
562
+ RESOURCE_GATHERING_VISUALS,
563
+ SAFETY_BOUNDARIES_VISUALS,
564
+ SIGNS_COMMUNICATION_VISUALS,
565
+ SIMPLE_MODIFIERS_VISUALS,
566
+ SOCIAL_COMMERCE_VISUALS,
567
+ SOCIAL_EFFECTS_VISUALS,
568
+ SPORTS_FITNESS_VISUALS,
569
+ STATE_PERSISTENCE_VISUALS,
570
+ TRANSPORTATION_VEHICLES_VISUALS,
571
+ VOLUMETRIC_WEBGPU_VISUALS,
572
+ WEATHER_PARTICLES_VISUALS,
573
+ XR_PLATFORM_VISUALS,
574
+ // Hologram Media Pipeline
575
+ HOLOGRAM_MEDIA_VISUALS,
576
+ // GAPS Feature Roadmap — Phase 1
577
+ GAPS_PHYSICS_VISUALS,
578
+ // Phone Sleeve VR — smartphone-as-headset
579
+ PHONE_SLEEVE_VR_VISUALS
580
+ ];
581
+ function registerAllPresets() {
582
+ const registry = TraitVisualRegistry.getInstance();
583
+ for (const presetMap of ALL_PRESETS) {
584
+ registry.registerBatch(presetMap);
585
+ }
586
+ }
587
+ registerAllPresets();
588
+
589
+ // src/compiler/SceneIRCompiler.ts
590
+ init_DomainBlockCompilerMixin();
591
+ init_PlatformConditionalCompilerMixin();
592
+ init_AgentRBAC();
593
+ init_CompilerBase();
594
+
595
+ // src/animation/stagger.ts
596
+ function staggerOffsets(count, step, from = 0) {
597
+ if (count <= 0) return [];
598
+ return Array.from({ length: count }, (_, i) => from + i * step);
599
+ }
600
+ function applyStaggerToChildren(children, step, from = 0) {
601
+ if (!step || children.length === 0) return;
602
+ const offsets = staggerOffsets(children.length, step, from);
603
+ children.forEach((child, i) => {
604
+ const channels = child.props?.__animatedTransform;
605
+ if (!Array.isArray(channels)) return;
606
+ const delta = offsets[i];
607
+ for (const ch of channels) {
608
+ if (typeof ch.edge0 === "number") ch.edge0 = ch.edge0 + delta;
609
+ if (typeof ch.edge1 === "number") ch.edge1 = ch.edge1 + delta;
610
+ }
611
+ });
612
+ }
613
+ function defaultEntranceChannel(target) {
614
+ return { prop: "scaleUniform", target, edge0: 0, edge1: 0.4, from: 0, to: 1 };
615
+ }
616
+ function synthesizeEntranceChannels(children, target) {
617
+ let count = 0;
618
+ for (const child of children) {
619
+ const props = child.props;
620
+ if (!props) continue;
621
+ if (props.animated !== true) continue;
622
+ if (Array.isArray(props.__animatedTransform)) continue;
623
+ props.__animatedTransform = [defaultEntranceChannel(target)];
624
+ count += 1;
625
+ }
626
+ return count;
627
+ }
628
+
629
+ // src/compiler/SceneIRCompiler.ts
630
+ var sceneIRNodePool = new ASTNodePool(
631
+ () => ({ type: "", props: {} }),
632
+ (node) => {
633
+ node.type = "";
634
+ node.id = void 0;
635
+ node.props = {};
636
+ node.children = void 0;
637
+ node.traits = void 0;
638
+ node.directives = void 0;
639
+ node.assetMaturity = void 0;
640
+ },
641
+ 0
642
+ // Was 20000 — demand-allocate instead of pre-allocating
643
+ );
644
+ function isVfxParticleTraitName(name) {
645
+ return name.startsWith("vfx_particle_");
646
+ }
647
+ function vfxParticleEffect(name) {
648
+ return name.replace("vfx_particle_", "");
649
+ }
650
+ function gemResonanceConfig(config) {
651
+ return {
652
+ max_distance: 0.5,
653
+ base_frequencies: "auto",
654
+ blend_mode: "harmonic",
655
+ output: "spatial_audio",
656
+ ...config || {}
657
+ };
658
+ }
659
+ var MATERIAL_PRESETS = {
660
+ plastic: { roughness: 0.5, metalness: 0, clearcoat: 0.1 },
661
+ metal: { roughness: 0.2, metalness: 1 },
662
+ chrome: { roughness: 0.05, metalness: 1, envMapIntensity: 1.5 },
663
+ gold: { roughness: 0.3, metalness: 1, color: "#ffd700" },
664
+ copper: { roughness: 0.4, metalness: 1, color: "#b87333" },
665
+ glass: {
666
+ roughness: 0,
667
+ metalness: 0,
668
+ transmission: 0.95,
669
+ ior: 1.5,
670
+ thickness: 0.5,
671
+ transparent: true
672
+ },
673
+ crystal: {
674
+ roughness: 0,
675
+ metalness: 0.1,
676
+ transmission: 0.9,
677
+ ior: 2,
678
+ iridescence: 1,
679
+ iridescenceIOR: 1.3
680
+ },
681
+ wood: { roughness: 0.8, metalness: 0 },
682
+ fabric: {
683
+ roughness: 0.95,
684
+ metalness: 0,
685
+ sheen: 0.5,
686
+ sheenRoughness: 0.8,
687
+ sheenColor: "#ffffff"
688
+ },
689
+ rubber: { roughness: 0.9, metalness: 0 },
690
+ leather: {
691
+ roughness: 0.7,
692
+ metalness: 0,
693
+ sheen: 0.3,
694
+ sheenRoughness: 0.6,
695
+ sheenColor: "#3d2b1f"
696
+ },
697
+ water: {
698
+ roughness: 0,
699
+ metalness: 0,
700
+ transmission: 0.9,
701
+ ior: 1.33,
702
+ transparent: true,
703
+ color: "#006994"
704
+ },
705
+ emissive: { roughness: 0.5, metalness: 0, emissiveIntensity: 2 },
706
+ hologram: {
707
+ roughness: 0,
708
+ metalness: 0.3,
709
+ transparent: true,
710
+ opacity: 0.6,
711
+ emissiveIntensity: 1
712
+ },
713
+ stone: { roughness: 0.85, metalness: 0, color: "#808080" },
714
+ marble: { roughness: 0.15, metalness: 0, color: "#F0EDE6", envMapIntensity: 0.8 },
715
+ shiny: { roughness: 0.05, metalness: 0.3, envMapIntensity: 1.5, clearcoat: 0.8 },
716
+ neon: {
717
+ roughness: 0,
718
+ metalness: 0,
719
+ emissiveIntensity: 3,
720
+ transparent: true,
721
+ opacity: 0.9
722
+ },
723
+ toon: { roughness: 1, metalness: 0 },
724
+ wireframe: { roughness: 0.5, metalness: 0.5, wireframe: true },
725
+ velvet: {
726
+ roughness: 1,
727
+ metalness: 0,
728
+ sheen: 1,
729
+ sheenRoughness: 0.8,
730
+ sheenColor: "#ffffff",
731
+ clearcoat: 0.3
732
+ },
733
+ xray: { roughness: 0, metalness: 0, transparent: true, opacity: 0.3, emissiveIntensity: 0.5 },
734
+ gradient: { roughness: 0.5, metalness: 0 },
735
+ matte: { roughness: 1, metalness: 0 },
736
+ // ===========================================================================
737
+ // REALISTIC FABRICS — differentiated by sheen, roughness, and anisotropy
738
+ // ===========================================================================
739
+ cotton: {
740
+ roughness: 0.95,
741
+ metalness: 0,
742
+ sheen: 0.6,
743
+ sheenRoughness: 0.9,
744
+ sheenColor: "#ffffff"
745
+ },
746
+ polyester: {
747
+ roughness: 0.7,
748
+ metalness: 0,
749
+ sheen: 0.8,
750
+ sheenRoughness: 0.4,
751
+ sheenColor: "#e8e8e8"
752
+ },
753
+ silk: {
754
+ roughness: 0.3,
755
+ metalness: 0,
756
+ sheen: 1,
757
+ sheenRoughness: 0.2,
758
+ sheenColor: "#fffaf0",
759
+ anisotropy: 0.8,
760
+ anisotropyRotation: 0
761
+ },
762
+ satin: {
763
+ roughness: 0.25,
764
+ metalness: 0,
765
+ sheen: 0.9,
766
+ sheenRoughness: 0.15,
767
+ sheenColor: "#fff5ee",
768
+ anisotropy: 0.6,
769
+ anisotropyRotation: 0
770
+ },
771
+ linen: {
772
+ roughness: 0.9,
773
+ metalness: 0,
774
+ sheen: 0.4,
775
+ sheenRoughness: 0.85,
776
+ sheenColor: "#f5f0e8"
777
+ },
778
+ wool: {
779
+ roughness: 1,
780
+ metalness: 0,
781
+ sheen: 0.7,
782
+ sheenRoughness: 1,
783
+ sheenColor: "#e8dcc8"
784
+ },
785
+ denim: {
786
+ roughness: 0.85,
787
+ metalness: 0,
788
+ color: "#2b4570",
789
+ sheen: 0.5,
790
+ sheenRoughness: 0.7,
791
+ sheenColor: "#4a6fa5"
792
+ },
793
+ canvas: {
794
+ roughness: 0.95,
795
+ metalness: 0,
796
+ color: "#c8b88a",
797
+ sheen: 0.3,
798
+ sheenRoughness: 0.9,
799
+ sheenColor: "#d4c9a8"
800
+ },
801
+ burlap: {
802
+ roughness: 1,
803
+ metalness: 0,
804
+ color: "#8b7355",
805
+ sheen: 0.2,
806
+ sheenRoughness: 1,
807
+ sheenColor: "#a08060"
808
+ },
809
+ // ===========================================================================
810
+ // SKIN & ORGANIC — differentiated by subsurface scattering
811
+ // ===========================================================================
812
+ skin: {
813
+ roughness: 0.5,
814
+ metalness: 0,
815
+ color: "#e8b89d",
816
+ thickness: 0.8,
817
+ attenuationColor: "#cc4422",
818
+ attenuationDistance: 0.5
819
+ },
820
+ skin_dark: {
821
+ roughness: 0.45,
822
+ metalness: 0,
823
+ color: "#8d5524",
824
+ thickness: 1,
825
+ attenuationColor: "#661111",
826
+ attenuationDistance: 0.3
827
+ },
828
+ // Dragon / creature material presets
829
+ dragon_bone: {
830
+ roughness: 0.35,
831
+ metalness: 0.15,
832
+ color: "#e8dcc8"
833
+ },
834
+ dragon_leather: {
835
+ roughness: 0.8,
836
+ metalness: 0,
837
+ color: "#5c3a21"
838
+ },
839
+ dragon_scale: {
840
+ roughness: 0.25,
841
+ metalness: 0.4,
842
+ color: "#1a0d3d"
843
+ },
844
+ obsidian: {
845
+ roughness: 0.05,
846
+ metalness: 0.1,
847
+ color: "#0d0d0d",
848
+ clearcoat: 0.9,
849
+ clearcoatRoughness: 0.1,
850
+ envMapIntensity: 1.2
851
+ },
852
+ skin_pale: {
853
+ roughness: 0.55,
854
+ metalness: 0,
855
+ color: "#fde0c8",
856
+ thickness: 0.6,
857
+ attenuationColor: "#ee5533",
858
+ attenuationDistance: 0.6
859
+ },
860
+ candle_wax: {
861
+ roughness: 0.7,
862
+ metalness: 0,
863
+ color: "#fff8dc",
864
+ thickness: 2,
865
+ attenuationColor: "#ffaa44",
866
+ attenuationDistance: 0.3,
867
+ transmission: 0.15
868
+ },
869
+ jade: {
870
+ roughness: 0.2,
871
+ metalness: 0,
872
+ color: "#00a86b",
873
+ thickness: 1.5,
874
+ attenuationColor: "#004d32",
875
+ attenuationDistance: 1,
876
+ transmission: 0.1
877
+ },
878
+ milk: {
879
+ roughness: 0.3,
880
+ metalness: 0,
881
+ color: "#fdfff5",
882
+ thickness: 1,
883
+ attenuationColor: "#fff5d6",
884
+ attenuationDistance: 0.2,
885
+ transmission: 0.6,
886
+ ior: 1.35
887
+ },
888
+ leaf: {
889
+ roughness: 0.6,
890
+ metalness: 0,
891
+ color: "#228b22",
892
+ thickness: 0.3,
893
+ attenuationColor: "#44cc22",
894
+ attenuationDistance: 0.5
895
+ },
896
+ honey: {
897
+ roughness: 0.1,
898
+ metalness: 0,
899
+ color: "#eb9605",
900
+ thickness: 1.5,
901
+ attenuationColor: "#cc6600",
902
+ attenuationDistance: 0.4,
903
+ transmission: 0.7,
904
+ ior: 1.5
905
+ },
906
+ // ===========================================================================
907
+ // MUD & EARTH — differentiated by roughness, color, and subtle properties
908
+ // ===========================================================================
909
+ clay_mud: {
910
+ roughness: 0.95,
911
+ metalness: 0,
912
+ color: "#8b4513",
913
+ thickness: 0.5,
914
+ attenuationColor: "#663311",
915
+ attenuationDistance: 0.8
916
+ },
917
+ sandy_mud: {
918
+ roughness: 0.85,
919
+ metalness: 0.02,
920
+ color: "#c2a66b"
921
+ },
922
+ wet_mud: {
923
+ roughness: 0.4,
924
+ metalness: 0,
925
+ color: "#3d2b1f",
926
+ clearcoat: 0.6,
927
+ clearcoatRoughness: 0.2
928
+ },
929
+ dry_earth: {
930
+ roughness: 1,
931
+ metalness: 0,
932
+ color: "#9b7653"
933
+ },
934
+ peat: {
935
+ roughness: 0.9,
936
+ metalness: 0,
937
+ color: "#2d1f0e"
938
+ },
939
+ red_clay: {
940
+ roughness: 0.95,
941
+ metalness: 0,
942
+ color: "#cc4b2e",
943
+ thickness: 0.4,
944
+ attenuationColor: "#993322",
945
+ attenuationDistance: 0.6
946
+ },
947
+ volcanic_ash: {
948
+ roughness: 0.8,
949
+ metalness: 0.05,
950
+ color: "#3c3c3c"
951
+ },
952
+ wet_sand: {
953
+ roughness: 0.6,
954
+ metalness: 0.02,
955
+ color: "#c2b280",
956
+ clearcoat: 0.3,
957
+ clearcoatRoughness: 0.4
958
+ },
959
+ dry_sand: {
960
+ roughness: 0.95,
961
+ metalness: 0.02,
962
+ color: "#e0cc8e"
963
+ },
964
+ // ===========================================================================
965
+ // METALS (BRUSHED/ANISOTROPIC) — directional roughness
966
+ // ===========================================================================
967
+ brushed_steel: {
968
+ roughness: 0.35,
969
+ metalness: 1,
970
+ color: "#c0c0c0",
971
+ anisotropy: 0.7,
972
+ anisotropyRotation: 0
973
+ },
974
+ brushed_aluminum: {
975
+ roughness: 0.3,
976
+ metalness: 1,
977
+ color: "#d0d0d0",
978
+ anisotropy: 0.8,
979
+ anisotropyRotation: 0
980
+ },
981
+ brushed_copper: {
982
+ roughness: 0.35,
983
+ metalness: 1,
984
+ color: "#b87333",
985
+ anisotropy: 0.6,
986
+ anisotropyRotation: 0
987
+ },
988
+ cast_iron: {
989
+ roughness: 0.7,
990
+ metalness: 0.9,
991
+ color: "#3a3a3a"
992
+ },
993
+ bronze: {
994
+ roughness: 0.45,
995
+ metalness: 1,
996
+ color: "#cd7f32"
997
+ },
998
+ silver: {
999
+ roughness: 0.15,
1000
+ metalness: 1,
1001
+ color: "#c0c0c0",
1002
+ envMapIntensity: 1.3
1003
+ },
1004
+ platinum: {
1005
+ roughness: 0.2,
1006
+ metalness: 1,
1007
+ color: "#e5e4e2",
1008
+ envMapIntensity: 1.2
1009
+ },
1010
+ rust: {
1011
+ roughness: 0.9,
1012
+ metalness: 0.3,
1013
+ color: "#8b3a15"
1014
+ },
1015
+ // ===========================================================================
1016
+ // HAIR & FIBERS — anisotropy-driven
1017
+ // ===========================================================================
1018
+ hair_dark: {
1019
+ roughness: 0.35,
1020
+ metalness: 0,
1021
+ color: "#1a1209",
1022
+ anisotropy: 1,
1023
+ anisotropyRotation: Math.PI / 2,
1024
+ sheen: 0.3,
1025
+ sheenRoughness: 0.3,
1026
+ sheenColor: "#2a2219"
1027
+ },
1028
+ hair_blonde: {
1029
+ roughness: 0.3,
1030
+ metalness: 0,
1031
+ color: "#c8a55a",
1032
+ anisotropy: 1,
1033
+ anisotropyRotation: Math.PI / 2,
1034
+ sheen: 0.4,
1035
+ sheenRoughness: 0.25,
1036
+ sheenColor: "#d4b86a"
1037
+ },
1038
+ hair_red: {
1039
+ roughness: 0.35,
1040
+ metalness: 0,
1041
+ color: "#8b3a15",
1042
+ anisotropy: 1,
1043
+ anisotropyRotation: Math.PI / 2,
1044
+ sheen: 0.35,
1045
+ sheenRoughness: 0.3,
1046
+ sheenColor: "#a04520"
1047
+ },
1048
+ // ===========================================================================
1049
+ // WET SURFACES — clearcoat simulates water film
1050
+ // ===========================================================================
1051
+ wet_stone: {
1052
+ roughness: 0.3,
1053
+ metalness: 0,
1054
+ color: "#606060",
1055
+ clearcoat: 0.8,
1056
+ clearcoatRoughness: 0.1
1057
+ },
1058
+ wet_wood: {
1059
+ roughness: 0.4,
1060
+ metalness: 0,
1061
+ color: "#5a3a1a",
1062
+ clearcoat: 0.7,
1063
+ clearcoatRoughness: 0.15
1064
+ },
1065
+ wet_concrete: {
1066
+ roughness: 0.5,
1067
+ metalness: 0,
1068
+ color: "#707070",
1069
+ clearcoat: 0.5,
1070
+ clearcoatRoughness: 0.2
1071
+ },
1072
+ // ===========================================================================
1073
+ // FOOD & ORGANIC — SSS-heavy
1074
+ // ===========================================================================
1075
+ fruit: {
1076
+ roughness: 0.4,
1077
+ metalness: 0,
1078
+ color: "#ff4444",
1079
+ thickness: 0.8,
1080
+ attenuationColor: "#cc2200",
1081
+ attenuationDistance: 0.5,
1082
+ clearcoat: 0.3,
1083
+ clearcoatRoughness: 0.2
1084
+ },
1085
+ cheese: {
1086
+ roughness: 0.7,
1087
+ metalness: 0,
1088
+ color: "#ffc125",
1089
+ thickness: 1.2,
1090
+ attenuationColor: "#cc9900",
1091
+ attenuationDistance: 0.4
1092
+ },
1093
+ bread: {
1094
+ roughness: 0.95,
1095
+ metalness: 0,
1096
+ color: "#c4a35a",
1097
+ thickness: 0.3,
1098
+ attenuationColor: "#8b6914",
1099
+ attenuationDistance: 0.8
1100
+ },
1101
+ chocolate: {
1102
+ roughness: 0.5,
1103
+ metalness: 0,
1104
+ color: "#3b1e08",
1105
+ clearcoat: 0.2,
1106
+ clearcoatRoughness: 0.3
1107
+ },
1108
+ // ===========================================================================
1109
+ // COATED SURFACES — clearcoat-driven
1110
+ // ===========================================================================
1111
+ car_paint: {
1112
+ roughness: 0.1,
1113
+ metalness: 0,
1114
+ clearcoat: 1,
1115
+ clearcoatRoughness: 0.05
1116
+ },
1117
+ lacquer: {
1118
+ roughness: 0.05,
1119
+ metalness: 0,
1120
+ clearcoat: 1,
1121
+ clearcoatRoughness: 0.02
1122
+ },
1123
+ varnished_wood: {
1124
+ roughness: 0.3,
1125
+ metalness: 0,
1126
+ color: "#8b5e3c",
1127
+ clearcoat: 0.9,
1128
+ clearcoatRoughness: 0.1
1129
+ },
1130
+ glazed_ceramic: {
1131
+ roughness: 0.15,
1132
+ metalness: 0,
1133
+ color: "#f0ede6",
1134
+ clearcoat: 0.8,
1135
+ clearcoatRoughness: 0.05
1136
+ },
1137
+ enamel: {
1138
+ roughness: 0.1,
1139
+ metalness: 0,
1140
+ clearcoat: 0.9,
1141
+ clearcoatRoughness: 0.03
1142
+ },
1143
+ // ===========================================================================
1144
+ // IRIDESCENT — thin-film interference
1145
+ // ===========================================================================
1146
+ soap_bubble: {
1147
+ roughness: 0,
1148
+ metalness: 0,
1149
+ transmission: 0.9,
1150
+ ior: 1.33,
1151
+ transparent: true,
1152
+ opacity: 0.3,
1153
+ iridescence: 1,
1154
+ iridescenceIOR: 1.5
1155
+ },
1156
+ oil_slick: {
1157
+ roughness: 0,
1158
+ metalness: 0.1,
1159
+ color: "#1a1a2e",
1160
+ iridescence: 1,
1161
+ iridescenceIOR: 1.8
1162
+ },
1163
+ beetle_shell: {
1164
+ roughness: 0.2,
1165
+ metalness: 0.3,
1166
+ color: "#0a3d0a",
1167
+ iridescence: 0.8,
1168
+ iridescenceIOR: 1.6,
1169
+ clearcoat: 0.5,
1170
+ clearcoatRoughness: 0.1
1171
+ },
1172
+ pearl: {
1173
+ roughness: 0.15,
1174
+ metalness: 0,
1175
+ color: "#fdeef4",
1176
+ iridescence: 0.6,
1177
+ iridescenceIOR: 1.3,
1178
+ sheen: 0.3,
1179
+ sheenRoughness: 0.2,
1180
+ sheenColor: "#fff0f5"
1181
+ },
1182
+ abalone: {
1183
+ roughness: 0.1,
1184
+ metalness: 0.1,
1185
+ color: "#e0f0e8",
1186
+ iridescence: 1,
1187
+ iridescenceIOR: 1.5
1188
+ },
1189
+ // ===========================================================================
1190
+ // GEMSTONES — transmission + IOR + iridescence
1191
+ // ===========================================================================
1192
+ diamond: {
1193
+ roughness: 0,
1194
+ metalness: 0,
1195
+ color: "#ffffff",
1196
+ transmission: 0.95,
1197
+ ior: 2.417,
1198
+ thickness: 0.5,
1199
+ transparent: true
1200
+ },
1201
+ ruby: {
1202
+ roughness: 0.05,
1203
+ metalness: 0,
1204
+ color: "#e0115f",
1205
+ transmission: 0.4,
1206
+ ior: 1.76,
1207
+ thickness: 1
1208
+ },
1209
+ sapphire: {
1210
+ roughness: 0.05,
1211
+ metalness: 0,
1212
+ color: "#0f52ba",
1213
+ transmission: 0.4,
1214
+ ior: 1.77,
1215
+ thickness: 1
1216
+ },
1217
+ emerald: {
1218
+ roughness: 0.1,
1219
+ metalness: 0,
1220
+ color: "#50c878",
1221
+ transmission: 0.3,
1222
+ ior: 1.57,
1223
+ thickness: 1.2
1224
+ },
1225
+ amber: {
1226
+ roughness: 0.1,
1227
+ metalness: 0,
1228
+ color: "#ffbf00",
1229
+ transmission: 0.6,
1230
+ ior: 1.55,
1231
+ thickness: 2,
1232
+ transparent: true,
1233
+ attenuationColor: "#cc6600",
1234
+ attenuationDistance: 1
1235
+ },
1236
+ opal: {
1237
+ roughness: 0.15,
1238
+ metalness: 0,
1239
+ color: "#e8e0d0",
1240
+ iridescence: 0.9,
1241
+ iridescenceIOR: 1.45,
1242
+ transmission: 0.1,
1243
+ ior: 1.45
1244
+ },
1245
+ amethyst: {
1246
+ roughness: 0.05,
1247
+ metalness: 0,
1248
+ color: "#9966cc",
1249
+ transmission: 0.5,
1250
+ ior: 1.54,
1251
+ thickness: 1,
1252
+ transparent: true
1253
+ },
1254
+ topaz: {
1255
+ roughness: 0.02,
1256
+ metalness: 0,
1257
+ color: "#ffc87c",
1258
+ transmission: 0.7,
1259
+ ior: 1.63,
1260
+ thickness: 0.8,
1261
+ transparent: true
1262
+ },
1263
+ turquoise: {
1264
+ roughness: 0.6,
1265
+ metalness: 0,
1266
+ color: "#40e0d0"
1267
+ },
1268
+ lapis_lazuli: {
1269
+ roughness: 0.4,
1270
+ metalness: 0,
1271
+ color: "#26619c",
1272
+ clearcoat: 0.3,
1273
+ clearcoatRoughness: 0.1
1274
+ },
1275
+ // ===========================================================================
1276
+ // MORE METALS — extended metallic palette
1277
+ // ===========================================================================
1278
+ titanium: {
1279
+ roughness: 0.25,
1280
+ metalness: 1,
1281
+ color: "#878681"
1282
+ },
1283
+ tungsten: {
1284
+ roughness: 0.3,
1285
+ metalness: 1,
1286
+ color: "#696969"
1287
+ },
1288
+ tin: {
1289
+ roughness: 0.35,
1290
+ metalness: 1,
1291
+ color: "#b0b0b0",
1292
+ envMapIntensity: 0.8
1293
+ },
1294
+ lead: {
1295
+ roughness: 0.6,
1296
+ metalness: 0.9,
1297
+ color: "#595959"
1298
+ },
1299
+ brass: {
1300
+ roughness: 0.35,
1301
+ metalness: 1,
1302
+ color: "#b5a642"
1303
+ },
1304
+ wrought_iron: {
1305
+ roughness: 0.7,
1306
+ metalness: 0.85,
1307
+ color: "#2c2c2c"
1308
+ },
1309
+ mercury: {
1310
+ roughness: 0,
1311
+ metalness: 1,
1312
+ color: "#d4d4d4",
1313
+ envMapIntensity: 2
1314
+ },
1315
+ // ===========================================================================
1316
+ // NATURAL / WEATHER — environmental surfaces
1317
+ // ===========================================================================
1318
+ snow: {
1319
+ roughness: 0.8,
1320
+ metalness: 0,
1321
+ color: "#f0f8ff",
1322
+ thickness: 0.5,
1323
+ attenuationColor: "#c8e0ff",
1324
+ attenuationDistance: 2
1325
+ },
1326
+ fresh_snow: {
1327
+ roughness: 0.6,
1328
+ metalness: 0,
1329
+ color: "#ffffff",
1330
+ sheen: 0.3,
1331
+ sheenRoughness: 0.5,
1332
+ sheenColor: "#e8f0ff"
1333
+ },
1334
+ frost: {
1335
+ roughness: 0.3,
1336
+ metalness: 0,
1337
+ color: "#e8f4f8",
1338
+ transmission: 0.15,
1339
+ ior: 1.31,
1340
+ clearcoat: 0.4,
1341
+ clearcoatRoughness: 0.1
1342
+ },
1343
+ ice: {
1344
+ roughness: 0.1,
1345
+ metalness: 0,
1346
+ color: "#d6eaf8",
1347
+ transmission: 0.8,
1348
+ ior: 1.31,
1349
+ transparent: true
1350
+ },
1351
+ moss: {
1352
+ roughness: 1,
1353
+ metalness: 0,
1354
+ color: "#4a7c3f",
1355
+ sheen: 0.2,
1356
+ sheenRoughness: 1,
1357
+ sheenColor: "#5a9c4f"
1358
+ },
1359
+ lichen: {
1360
+ roughness: 0.9,
1361
+ metalness: 0,
1362
+ color: "#8fa37a"
1363
+ },
1364
+ bark: {
1365
+ roughness: 0.95,
1366
+ metalness: 0,
1367
+ color: "#5c4033"
1368
+ },
1369
+ dried_leaves: {
1370
+ roughness: 0.9,
1371
+ metalness: 0,
1372
+ color: "#8b6914",
1373
+ thickness: 0.1,
1374
+ attenuationColor: "#664400",
1375
+ attenuationDistance: 0.3
1376
+ },
1377
+ // ===========================================================================
1378
+ // AGED / WEATHERED — patina, tarnish, wear
1379
+ // ===========================================================================
1380
+ patina: {
1381
+ roughness: 0.6,
1382
+ metalness: 0.4,
1383
+ color: "#4a9c7e"
1384
+ },
1385
+ tarnished_silver: {
1386
+ roughness: 0.5,
1387
+ metalness: 0.7,
1388
+ color: "#8a8a7a"
1389
+ },
1390
+ aged_bronze: {
1391
+ roughness: 0.55,
1392
+ metalness: 0.6,
1393
+ color: "#6b8e5a"
1394
+ },
1395
+ weathered_wood: {
1396
+ roughness: 0.95,
1397
+ metalness: 0,
1398
+ color: "#8a8070"
1399
+ },
1400
+ cracked_paint: {
1401
+ roughness: 0.8,
1402
+ metalness: 0,
1403
+ color: "#c8c0b0"
1404
+ },
1405
+ oxidized_copper: {
1406
+ roughness: 0.65,
1407
+ metalness: 0.5,
1408
+ color: "#2e8b57"
1409
+ },
1410
+ // ===========================================================================
1411
+ // CONSTRUCTION — architectural materials
1412
+ // ===========================================================================
1413
+ asphalt: {
1414
+ roughness: 0.9,
1415
+ metalness: 0,
1416
+ color: "#3a3a3a"
1417
+ },
1418
+ cement: {
1419
+ roughness: 0.85,
1420
+ metalness: 0,
1421
+ color: "#a0a0a0"
1422
+ },
1423
+ tile_ceramic: {
1424
+ roughness: 0.2,
1425
+ metalness: 0,
1426
+ color: "#e8e0d0",
1427
+ clearcoat: 0.6,
1428
+ clearcoatRoughness: 0.05
1429
+ },
1430
+ tile_porcelain: {
1431
+ roughness: 0.1,
1432
+ metalness: 0,
1433
+ color: "#f5f5f5",
1434
+ clearcoat: 0.8,
1435
+ clearcoatRoughness: 0.02
1436
+ },
1437
+ linoleum: {
1438
+ roughness: 0.6,
1439
+ metalness: 0,
1440
+ color: "#c0b090",
1441
+ clearcoat: 0.2,
1442
+ clearcoatRoughness: 0.3
1443
+ },
1444
+ drywall: {
1445
+ roughness: 1,
1446
+ metalness: 0,
1447
+ color: "#f0ece0"
1448
+ },
1449
+ rebar: {
1450
+ roughness: 0.6,
1451
+ metalness: 0.9,
1452
+ color: "#5a4a3a"
1453
+ },
1454
+ stucco: {
1455
+ roughness: 0.95,
1456
+ metalness: 0,
1457
+ color: "#e8dcc8"
1458
+ },
1459
+ gravel: {
1460
+ roughness: 1,
1461
+ metalness: 0.02,
1462
+ color: "#8a8070"
1463
+ },
1464
+ // ===========================================================================
1465
+ // LEATHER VARIANTS — sheen + clearcoat differentiation
1466
+ // ===========================================================================
1467
+ suede: {
1468
+ roughness: 1,
1469
+ metalness: 0,
1470
+ color: "#8b6914",
1471
+ sheen: 0.6,
1472
+ sheenRoughness: 1,
1473
+ sheenColor: "#a07828"
1474
+ },
1475
+ patent_leather: {
1476
+ roughness: 0.05,
1477
+ metalness: 0,
1478
+ color: "#1a1a1a",
1479
+ clearcoat: 1,
1480
+ clearcoatRoughness: 0.02
1481
+ },
1482
+ distressed_leather: {
1483
+ roughness: 0.8,
1484
+ metalness: 0,
1485
+ color: "#5a3a1a",
1486
+ sheen: 0.15,
1487
+ sheenRoughness: 0.8,
1488
+ sheenColor: "#4a3010"
1489
+ },
1490
+ nubuck: {
1491
+ roughness: 0.95,
1492
+ metalness: 0,
1493
+ color: "#c8a882",
1494
+ sheen: 0.5,
1495
+ sheenRoughness: 0.9,
1496
+ sheenColor: "#d4b892"
1497
+ },
1498
+ // ===========================================================================
1499
+ // RUBBER VARIANTS
1500
+ // ===========================================================================
1501
+ tire_rubber: {
1502
+ roughness: 0.85,
1503
+ metalness: 0,
1504
+ color: "#1a1a1a"
1505
+ },
1506
+ silicone: {
1507
+ roughness: 0.6,
1508
+ metalness: 0,
1509
+ color: "#e0e0e0",
1510
+ thickness: 0.5,
1511
+ attenuationColor: "#cccccc",
1512
+ attenuationDistance: 1,
1513
+ transmission: 0.05
1514
+ },
1515
+ latex: {
1516
+ roughness: 0.3,
1517
+ metalness: 0,
1518
+ color: "#ffefd5",
1519
+ clearcoat: 0.5,
1520
+ clearcoatRoughness: 0.1,
1521
+ thickness: 0.3,
1522
+ attenuationColor: "#ffcc88",
1523
+ attenuationDistance: 0.5
1524
+ },
1525
+ eraser: {
1526
+ roughness: 0.95,
1527
+ metalness: 0,
1528
+ color: "#ff6b81"
1529
+ },
1530
+ // ===========================================================================
1531
+ // LIQUIDS — transmission + animated surface hints
1532
+ // ===========================================================================
1533
+ lava: {
1534
+ roughness: 0.8,
1535
+ metalness: 0,
1536
+ color: "#ff4400",
1537
+ emissive: "#ff2200",
1538
+ emissiveIntensity: 3
1539
+ },
1540
+ blood: {
1541
+ roughness: 0.2,
1542
+ metalness: 0,
1543
+ color: "#8b0000",
1544
+ clearcoat: 0.7,
1545
+ clearcoatRoughness: 0.05,
1546
+ thickness: 1,
1547
+ attenuationColor: "#440000",
1548
+ attenuationDistance: 0.3
1549
+ },
1550
+ oil_liquid: {
1551
+ roughness: 0.05,
1552
+ metalness: 0,
1553
+ color: "#1a1a0a",
1554
+ clearcoat: 0.9,
1555
+ clearcoatRoughness: 0.02
1556
+ },
1557
+ molten_metal: {
1558
+ roughness: 0.15,
1559
+ metalness: 0.8,
1560
+ color: "#ff8c00",
1561
+ emissive: "#ff6600",
1562
+ emissiveIntensity: 5
1563
+ },
1564
+ syrup: {
1565
+ roughness: 0.1,
1566
+ metalness: 0,
1567
+ color: "#8b4513",
1568
+ transmission: 0.4,
1569
+ ior: 1.49,
1570
+ thickness: 2,
1571
+ attenuationColor: "#663300",
1572
+ attenuationDistance: 0.5
1573
+ },
1574
+ // ===========================================================================
1575
+ // BLACKBODY / THERMAL — temperature-driven emission
1576
+ // ===========================================================================
1577
+ heated_metal_low: {
1578
+ roughness: 0.5,
1579
+ metalness: 0.9,
1580
+ color: "#4a4a4a",
1581
+ emissive: "#ff1a00",
1582
+ emissiveIntensity: 1.5
1583
+ },
1584
+ heated_metal_mid: {
1585
+ roughness: 0.4,
1586
+ metalness: 0.8,
1587
+ color: "#5a5a5a",
1588
+ emissive: "#ff6600",
1589
+ emissiveIntensity: 3
1590
+ },
1591
+ heated_metal_hot: {
1592
+ roughness: 0.3,
1593
+ metalness: 0.7,
1594
+ color: "#6a6a6a",
1595
+ emissive: "#ffcc00",
1596
+ emissiveIntensity: 5
1597
+ },
1598
+ heated_metal_white: {
1599
+ roughness: 0.2,
1600
+ metalness: 0.6,
1601
+ color: "#8a8a8a",
1602
+ emissive: "#ffffff",
1603
+ emissiveIntensity: 8
1604
+ },
1605
+ ember: {
1606
+ roughness: 0.9,
1607
+ metalness: 0,
1608
+ color: "#2a0a00",
1609
+ emissive: "#ff4400",
1610
+ emissiveIntensity: 2
1611
+ },
1612
+ coal: {
1613
+ roughness: 0.85,
1614
+ metalness: 0,
1615
+ color: "#1a1a1a",
1616
+ emissive: "#cc2200",
1617
+ emissiveIntensity: 0.5
1618
+ },
1619
+ // ===========================================================================
1620
+ // SPECIAL EFFECTS — sparkle, glow, energy
1621
+ // ===========================================================================
1622
+ glitter: {
1623
+ roughness: 0.2,
1624
+ metalness: 0.8,
1625
+ color: "#ffd700",
1626
+ envMapIntensity: 2
1627
+ },
1628
+ sequin: {
1629
+ roughness: 0.05,
1630
+ metalness: 1,
1631
+ envMapIntensity: 2.5,
1632
+ iridescence: 0.3
1633
+ },
1634
+ mica: {
1635
+ roughness: 0.3,
1636
+ metalness: 0.2,
1637
+ color: "#c8b888",
1638
+ iridescence: 0.4,
1639
+ iridescenceIOR: 1.58,
1640
+ sheen: 0.2,
1641
+ sheenRoughness: 0.3,
1642
+ sheenColor: "#d4c498"
1643
+ },
1644
+ fluorescent_green: {
1645
+ roughness: 0.5,
1646
+ metalness: 0,
1647
+ color: "#39ff14",
1648
+ emissive: "#39ff14",
1649
+ emissiveIntensity: 1.5
1650
+ },
1651
+ fluorescent_orange: {
1652
+ roughness: 0.5,
1653
+ metalness: 0,
1654
+ color: "#ff6700",
1655
+ emissive: "#ff6700",
1656
+ emissiveIntensity: 1.5
1657
+ },
1658
+ fluorescent_pink: {
1659
+ roughness: 0.5,
1660
+ metalness: 0,
1661
+ color: "#ff1493",
1662
+ emissive: "#ff1493",
1663
+ emissiveIntensity: 1.5
1664
+ },
1665
+ glow_in_dark: {
1666
+ roughness: 0.7,
1667
+ metalness: 0,
1668
+ color: "#2a3a2a",
1669
+ emissive: "#44ff44",
1670
+ emissiveIntensity: 0.8
1671
+ },
1672
+ plasma: {
1673
+ roughness: 0,
1674
+ metalness: 0,
1675
+ color: "#4400ff",
1676
+ emissive: "#8844ff",
1677
+ emissiveIntensity: 4,
1678
+ transparent: true,
1679
+ opacity: 0.7
1680
+ },
1681
+ energy_field: {
1682
+ roughness: 0,
1683
+ metalness: 0,
1684
+ emissive: "#00ccff",
1685
+ emissiveIntensity: 3,
1686
+ transparent: true,
1687
+ opacity: 0.4,
1688
+ transmission: 0.6
1689
+ },
1690
+ force_field: {
1691
+ roughness: 0,
1692
+ metalness: 0,
1693
+ emissive: "#00ff88",
1694
+ emissiveIntensity: 2,
1695
+ transparent: true,
1696
+ opacity: 0.2,
1697
+ iridescence: 0.8,
1698
+ iridescenceIOR: 1.5
1699
+ },
1700
+ // ===========================================================================
1701
+ // RETROREFLECTIVE — safety, signage
1702
+ // ===========================================================================
1703
+ safety_vest: {
1704
+ roughness: 0.6,
1705
+ metalness: 0,
1706
+ color: "#ccff00",
1707
+ emissive: "#ccff00",
1708
+ emissiveIntensity: 0.3
1709
+ },
1710
+ road_sign: {
1711
+ roughness: 0.4,
1712
+ metalness: 0.1,
1713
+ color: "#ffffff",
1714
+ envMapIntensity: 1.8,
1715
+ emissive: "#ffffff",
1716
+ emissiveIntensity: 0.2
1717
+ },
1718
+ reflective_tape: {
1719
+ roughness: 0.2,
1720
+ metalness: 0.3,
1721
+ color: "#e0e0e0",
1722
+ envMapIntensity: 2.5
1723
+ },
1724
+ // ===========================================================================
1725
+ // MISC — everything else in the real world
1726
+ // ===========================================================================
1727
+ chalkboard: {
1728
+ roughness: 0.9,
1729
+ metalness: 0,
1730
+ color: "#2a3a2a"
1731
+ },
1732
+ chalk: {
1733
+ roughness: 1,
1734
+ metalness: 0,
1735
+ color: "#ffffff"
1736
+ },
1737
+ charcoal: {
1738
+ roughness: 0.9,
1739
+ metalness: 0,
1740
+ color: "#1a1a1a"
1741
+ },
1742
+ cork: {
1743
+ roughness: 0.95,
1744
+ metalness: 0,
1745
+ color: "#b88a50"
1746
+ },
1747
+ felt: {
1748
+ roughness: 1,
1749
+ metalness: 0,
1750
+ color: "#5a8a5a",
1751
+ sheen: 0.4,
1752
+ sheenRoughness: 1,
1753
+ sheenColor: "#6a9a6a"
1754
+ },
1755
+ sponge: {
1756
+ roughness: 1,
1757
+ metalness: 0,
1758
+ color: "#e8c840"
1759
+ },
1760
+ porcelain: {
1761
+ roughness: 0.1,
1762
+ metalness: 0,
1763
+ color: "#f8f4f0",
1764
+ clearcoat: 0.7,
1765
+ clearcoatRoughness: 0.02
1766
+ },
1767
+ terracotta: {
1768
+ roughness: 0.85,
1769
+ metalness: 0,
1770
+ color: "#cc6644"
1771
+ },
1772
+ concrete_polished: {
1773
+ roughness: 0.3,
1774
+ metalness: 0,
1775
+ color: "#a0a0a0",
1776
+ clearcoat: 0.3,
1777
+ clearcoatRoughness: 0.15
1778
+ },
1779
+ rope: {
1780
+ roughness: 1,
1781
+ metalness: 0,
1782
+ color: "#c4a35a",
1783
+ sheen: 0.2,
1784
+ sheenRoughness: 1,
1785
+ sheenColor: "#b89848"
1786
+ },
1787
+ wicker: {
1788
+ roughness: 0.9,
1789
+ metalness: 0,
1790
+ color: "#a08050"
1791
+ },
1792
+ parchment: {
1793
+ roughness: 0.8,
1794
+ metalness: 0,
1795
+ color: "#f0e6c8",
1796
+ thickness: 0.1,
1797
+ attenuationColor: "#d4c0a0",
1798
+ attenuationDistance: 0.2
1799
+ },
1800
+ // ===========================================================================
1801
+ // ANIMATED MATERIALS — time-driven surface effects (wired to scene.time)
1802
+ // These set metadata flags that the runtime uses to drive animated shaders.
1803
+ // ===========================================================================
1804
+ flowing_water: {
1805
+ roughness: 0,
1806
+ metalness: 0,
1807
+ color: "#006994",
1808
+ transmission: 0.85,
1809
+ ior: 1.33,
1810
+ transparent: true,
1811
+ _animated: { pattern: "flow", speed: 0.8, amplitude: 0.3 }
1812
+ },
1813
+ rippling_water: {
1814
+ roughness: 0.05,
1815
+ metalness: 0,
1816
+ color: "#005577",
1817
+ transmission: 0.8,
1818
+ ior: 1.33,
1819
+ transparent: true,
1820
+ _animated: { pattern: "ripple", speed: 1, amplitude: 0.4 }
1821
+ },
1822
+ flickering_fire: {
1823
+ roughness: 0.8,
1824
+ metalness: 0,
1825
+ color: "#ff4400",
1826
+ emissive: "#ff2200",
1827
+ emissiveIntensity: 3,
1828
+ _animated: { pattern: "flicker", speed: 3, amplitude: 0.6 }
1829
+ },
1830
+ pulsing_glow: {
1831
+ roughness: 0.5,
1832
+ metalness: 0,
1833
+ emissive: "#00ff88",
1834
+ emissiveIntensity: 2,
1835
+ _animated: { pattern: "pulse", speed: 1.5, amplitude: 0.5 }
1836
+ },
1837
+ breathing_light: {
1838
+ roughness: 0.3,
1839
+ metalness: 0,
1840
+ emissive: "#4488ff",
1841
+ emissiveIntensity: 1.5,
1842
+ _animated: { pattern: "breathe", speed: 0.5, amplitude: 0.8 }
1843
+ },
1844
+ scrolling_lava: {
1845
+ roughness: 0.8,
1846
+ metalness: 0,
1847
+ color: "#ff4400",
1848
+ emissive: "#ff2200",
1849
+ emissiveIntensity: 4,
1850
+ _animated: { pattern: "scroll", speed: 0.3, amplitude: 1 }
1851
+ },
1852
+ waving_grass: {
1853
+ roughness: 0.9,
1854
+ metalness: 0,
1855
+ color: "#228b22",
1856
+ sheen: 0.2,
1857
+ sheenRoughness: 0.8,
1858
+ sheenColor: "#44cc22",
1859
+ _animated: { pattern: "wave", speed: 0.8, amplitude: 0.2 }
1860
+ },
1861
+ flickering_neon: {
1862
+ roughness: 0,
1863
+ metalness: 0,
1864
+ emissive: "#ff00ff",
1865
+ emissiveIntensity: 3.5,
1866
+ transparent: true,
1867
+ opacity: 0.9,
1868
+ _animated: { pattern: "flicker", speed: 5, amplitude: 0.4 }
1869
+ },
1870
+ pulsing_crystal: {
1871
+ roughness: 0,
1872
+ metalness: 0.1,
1873
+ transmission: 0.8,
1874
+ ior: 2,
1875
+ iridescence: 0.8,
1876
+ iridescenceIOR: 1.3,
1877
+ emissive: "#8844ff",
1878
+ emissiveIntensity: 1,
1879
+ _animated: { pattern: "pulse", speed: 0.8, amplitude: 0.6 }
1880
+ },
1881
+ animated_hologram: {
1882
+ roughness: 0,
1883
+ metalness: 0.3,
1884
+ transparent: true,
1885
+ opacity: 0.5,
1886
+ emissive: "#00ccff",
1887
+ emissiveIntensity: 1.5,
1888
+ _animated: { pattern: "scroll", speed: 1.5, amplitude: 0.3 }
1889
+ },
1890
+ boiling_surface: {
1891
+ roughness: 0.7,
1892
+ metalness: 0,
1893
+ color: "#cc4400",
1894
+ emissive: "#ff6600",
1895
+ emissiveIntensity: 2,
1896
+ _animated: { pattern: "noise", speed: 2, amplitude: 0.5 }
1897
+ },
1898
+ shimmer_heat: {
1899
+ roughness: 0,
1900
+ metalness: 0,
1901
+ transparent: true,
1902
+ opacity: 0.15,
1903
+ _animated: { pattern: "wave", speed: 2, amplitude: 0.1 }
1904
+ },
1905
+ // ===========================================================================
1906
+ // VOLUMETRIC MATERIALS — metadata for ray-marched volume rendering
1907
+ // These presets describe volumetric phenomena; the runtime renders them via
1908
+ // a ray marching pass on a bounding box/sphere geometry.
1909
+ // ===========================================================================
1910
+ fog: {
1911
+ roughness: 0,
1912
+ metalness: 0,
1913
+ color: "#c0c0c0",
1914
+ transparent: true,
1915
+ opacity: 0.3,
1916
+ _volumetric: { type: "fog", density: 0.3, scattering: 0.8, absorption: 0.05 }
1917
+ },
1918
+ dense_fog: {
1919
+ roughness: 0,
1920
+ metalness: 0,
1921
+ color: "#a0a0a0",
1922
+ transparent: true,
1923
+ opacity: 0.5,
1924
+ _volumetric: { type: "fog", density: 0.7, scattering: 0.9, absorption: 0.1 }
1925
+ },
1926
+ smoke: {
1927
+ roughness: 0,
1928
+ metalness: 0,
1929
+ color: "#404040",
1930
+ transparent: true,
1931
+ opacity: 0.4,
1932
+ _volumetric: {
1933
+ type: "smoke",
1934
+ density: 0.5,
1935
+ scattering: 0.3,
1936
+ absorption: 0.4,
1937
+ riseSpeed: 0.5,
1938
+ turbulence: 0.6
1939
+ }
1940
+ },
1941
+ campfire_smoke: {
1942
+ roughness: 0,
1943
+ metalness: 0,
1944
+ color: "#505050",
1945
+ transparent: true,
1946
+ opacity: 0.35,
1947
+ _volumetric: {
1948
+ type: "smoke",
1949
+ density: 0.4,
1950
+ scattering: 0.25,
1951
+ absorption: 0.5,
1952
+ riseSpeed: 0.8,
1953
+ turbulence: 0.4
1954
+ }
1955
+ },
1956
+ fire_volume: {
1957
+ roughness: 0,
1958
+ metalness: 0,
1959
+ color: "#ff4400",
1960
+ emissive: "#ff2200",
1961
+ emissiveIntensity: 4,
1962
+ transparent: true,
1963
+ opacity: 0.7,
1964
+ _volumetric: {
1965
+ type: "fire",
1966
+ density: 0.6,
1967
+ scattering: 0.1,
1968
+ absorption: 0.2,
1969
+ riseSpeed: 1.2,
1970
+ turbulence: 0.7,
1971
+ temperature: 2500
1972
+ }
1973
+ },
1974
+ candle_flame: {
1975
+ roughness: 0,
1976
+ metalness: 0,
1977
+ color: "#ffaa33",
1978
+ emissive: "#ff8800",
1979
+ emissiveIntensity: 3,
1980
+ transparent: true,
1981
+ opacity: 0.6,
1982
+ _volumetric: {
1983
+ type: "fire",
1984
+ density: 0.4,
1985
+ scattering: 0.05,
1986
+ absorption: 0.1,
1987
+ riseSpeed: 0.3,
1988
+ turbulence: 0.2,
1989
+ temperature: 1800
1990
+ }
1991
+ },
1992
+ clouds: {
1993
+ roughness: 0,
1994
+ metalness: 0,
1995
+ color: "#ffffff",
1996
+ transparent: true,
1997
+ opacity: 0.6,
1998
+ _volumetric: {
1999
+ type: "clouds",
2000
+ density: 0.4,
2001
+ scattering: 0.95,
2002
+ absorption: 0.02,
2003
+ noiseScale: 2,
2004
+ octaves: 6
2005
+ }
2006
+ },
2007
+ storm_clouds: {
2008
+ roughness: 0,
2009
+ metalness: 0,
2010
+ color: "#3a3a4a",
2011
+ transparent: true,
2012
+ opacity: 0.8,
2013
+ _volumetric: {
2014
+ type: "clouds",
2015
+ density: 0.7,
2016
+ scattering: 0.6,
2017
+ absorption: 0.15,
2018
+ noiseScale: 1.5,
2019
+ octaves: 6
2020
+ }
2021
+ },
2022
+ dust_motes: {
2023
+ roughness: 0,
2024
+ metalness: 0,
2025
+ color: "#c8b888",
2026
+ transparent: true,
2027
+ opacity: 0.15,
2028
+ _volumetric: { type: "dust", density: 0.1, scattering: 0.5, absorption: 0.02 }
2029
+ },
2030
+ mist: {
2031
+ roughness: 0,
2032
+ metalness: 0,
2033
+ color: "#e0e8f0",
2034
+ transparent: true,
2035
+ opacity: 0.25,
2036
+ _volumetric: {
2037
+ type: "mist",
2038
+ density: 0.2,
2039
+ scattering: 0.85,
2040
+ absorption: 0.03,
2041
+ heightFalloff: 1.5
2042
+ }
2043
+ },
2044
+ steam: {
2045
+ roughness: 0,
2046
+ metalness: 0,
2047
+ color: "#e8e8e8",
2048
+ transparent: true,
2049
+ opacity: 0.3,
2050
+ _volumetric: {
2051
+ type: "steam",
2052
+ density: 0.35,
2053
+ scattering: 0.7,
2054
+ absorption: 0.05,
2055
+ riseSpeed: 1,
2056
+ turbulence: 0.3
2057
+ }
2058
+ },
2059
+ aurora_borealis: {
2060
+ roughness: 0,
2061
+ metalness: 0,
2062
+ emissive: "#00ff88",
2063
+ emissiveIntensity: 2,
2064
+ transparent: true,
2065
+ opacity: 0.3,
2066
+ _volumetric: {
2067
+ type: "aurora",
2068
+ density: 0.15,
2069
+ scattering: 0.1,
2070
+ absorption: 0.01,
2071
+ emissionIntensity: 2
2072
+ }
2073
+ },
2074
+ nebula: {
2075
+ roughness: 0,
2076
+ metalness: 0,
2077
+ emissive: "#ff44aa",
2078
+ emissiveIntensity: 1.5,
2079
+ transparent: true,
2080
+ opacity: 0.4,
2081
+ _volumetric: {
2082
+ type: "nebula",
2083
+ density: 0.25,
2084
+ scattering: 0.3,
2085
+ absorption: 0.05,
2086
+ emissionIntensity: 1.5,
2087
+ noiseScale: 1
2088
+ }
2089
+ },
2090
+ underwater_caustics: {
2091
+ roughness: 0,
2092
+ metalness: 0,
2093
+ color: "#003366",
2094
+ transparent: true,
2095
+ opacity: 0.2,
2096
+ _volumetric: { type: "underwater", density: 0.15, scattering: 0.6, absorption: 0.1 }
2097
+ },
2098
+ god_rays: {
2099
+ roughness: 0,
2100
+ metalness: 0,
2101
+ color: "#ffffd0",
2102
+ transparent: true,
2103
+ opacity: 0.15,
2104
+ emissive: "#ffff88",
2105
+ emissiveIntensity: 0.5,
2106
+ _volumetric: { type: "god_rays", density: 0.1, scattering: 0.9, absorption: 0.01 }
2107
+ },
2108
+ neon_gas: {
2109
+ roughness: 0,
2110
+ metalness: 0,
2111
+ emissive: "#ff4400",
2112
+ emissiveIntensity: 3,
2113
+ transparent: true,
2114
+ opacity: 0.5,
2115
+ _volumetric: {
2116
+ type: "neon_gas",
2117
+ density: 0.3,
2118
+ scattering: 0.2,
2119
+ absorption: 0.05,
2120
+ emissionIntensity: 3
2121
+ }
2122
+ },
2123
+ explosion: {
2124
+ roughness: 0,
2125
+ metalness: 0,
2126
+ color: "#ff6600",
2127
+ emissive: "#ff4400",
2128
+ emissiveIntensity: 6,
2129
+ transparent: true,
2130
+ opacity: 0.8,
2131
+ _volumetric: {
2132
+ type: "fire",
2133
+ density: 0.8,
2134
+ scattering: 0.15,
2135
+ absorption: 0.3,
2136
+ riseSpeed: 2,
2137
+ turbulence: 1,
2138
+ temperature: 4e3
2139
+ }
2140
+ },
2141
+ toxic_gas: {
2142
+ roughness: 0,
2143
+ metalness: 0,
2144
+ color: "#44cc00",
2145
+ emissive: "#33aa00",
2146
+ emissiveIntensity: 1,
2147
+ transparent: true,
2148
+ opacity: 0.35,
2149
+ _volumetric: {
2150
+ type: "smoke",
2151
+ density: 0.3,
2152
+ scattering: 0.4,
2153
+ absorption: 0.2,
2154
+ riseSpeed: 0.2,
2155
+ turbulence: 0.3
2156
+ }
2157
+ },
2158
+ magical_mist: {
2159
+ roughness: 0,
2160
+ metalness: 0,
2161
+ emissive: "#8844ff",
2162
+ emissiveIntensity: 1.5,
2163
+ transparent: true,
2164
+ opacity: 0.3,
2165
+ iridescence: 0.6,
2166
+ iridescenceIOR: 1.5,
2167
+ _volumetric: {
2168
+ type: "mist",
2169
+ density: 0.2,
2170
+ scattering: 0.5,
2171
+ absorption: 0.03,
2172
+ emissionIntensity: 1.5
2173
+ }
2174
+ },
2175
+ // --- Architectural & Natural Stone ---
2176
+ brick: { roughness: 0.9, metalness: 0, color: "#a6523c" },
2177
+ concrete: { roughness: 0.88, metalness: 0, color: "#8a8a8a" },
2178
+ granite: { roughness: 0.6, metalness: 0, color: "#666670" },
2179
+ sandstone: { roughness: 0.85, metalness: 0, color: "#cca66e" },
2180
+ slate: { roughness: 0.7, metalness: 0, color: "#3f4450" },
2181
+ adobe: { roughness: 0.95, metalness: 0, color: "#bf9160" },
2182
+ plaster: { roughness: 0.82, metalness: 0, color: "#ebe8de" },
2183
+ // --- Plant & Cellulose ---
2184
+ bamboo: { roughness: 0.65, metalness: 0, color: "#b3a84d" },
2185
+ paper: { roughness: 0.9, metalness: 0, color: "#f3f0e5" },
2186
+ cardboard: { roughness: 0.88, metalness: 0, color: "#b88c58" },
2187
+ // --- Organic & Animal ---
2188
+ bone: { roughness: 0.7, metalness: 0, color: "#e0d4b5" },
2189
+ ivory: { roughness: 0.35, metalness: 0, color: "#f0e8c5", envMapIntensity: 0.4 },
2190
+ coral: { roughness: 0.75, metalness: 0, color: "#f2614d" },
2191
+ shell: {
2192
+ roughness: 0.25,
2193
+ metalness: 0.05,
2194
+ color: "#f5ede0",
2195
+ iridescence: 0.8,
2196
+ iridescenceIOR: 1.5,
2197
+ envMapIntensity: 0.6
2198
+ },
2199
+ thatch: { roughness: 0.95, metalness: 0, color: "#c0a84a" },
2200
+ // --- Synthetic & Engineered ---
2201
+ resin: {
2202
+ roughness: 0.08,
2203
+ metalness: 0,
2204
+ transmission: 0.75,
2205
+ ior: 1.5,
2206
+ color: "#e8c46a",
2207
+ transparent: true,
2208
+ opacity: 0.88
2209
+ },
2210
+ foam: { roughness: 0.95, metalness: 0, color: "#f0f0f0" },
2211
+ composite: { roughness: 0.5, metalness: 0.25, color: "#333338" },
2212
+ carbon_fiber: {
2213
+ roughness: 0.28,
2214
+ metalness: 0.6,
2215
+ color: "#111114",
2216
+ envMapIntensity: 1.2,
2217
+ clearcoat: 0.6,
2218
+ clearcoatRoughness: 0.1
2219
+ },
2220
+ kevlar: { roughness: 0.82, metalness: 0, color: "#ccbb66" },
2221
+ fiberglass: {
2222
+ roughness: 0.3,
2223
+ metalness: 0.05,
2224
+ transmission: 0.4,
2225
+ ior: 1.45,
2226
+ color: "#e0ede0",
2227
+ transparent: true,
2228
+ opacity: 0.92
2229
+ },
2230
+ stained_glass: {
2231
+ roughness: 0.05,
2232
+ metalness: 0,
2233
+ transmission: 0.85,
2234
+ ior: 1.52,
2235
+ color: "#cc44ff",
2236
+ transparent: true,
2237
+ opacity: 0.75,
2238
+ thickness: 0.3
2239
+ }
2240
+ };
2241
+ var ENVIRONMENT_PRESETS = {
2242
+ forest_sunset: {
2243
+ background: true,
2244
+ envPreset: "sunset",
2245
+ fog: { color: "#ff9966", near: 10, far: 100 },
2246
+ ground: { color: "#2d5a27" },
2247
+ lighting: {
2248
+ ambient: { color: "#ffa366", intensity: 0.3 },
2249
+ directional: { color: "#ff7700", intensity: 1.5, position: [10, 20, 5], shadows: true }
2250
+ }
2251
+ },
2252
+ cyberpunk_city: {
2253
+ background: true,
2254
+ envPreset: "night",
2255
+ fog: { color: "#0a0020", near: 5, far: 60 },
2256
+ ground: { color: "#1a1a2e" },
2257
+ lighting: {
2258
+ ambient: { color: "#220044", intensity: 0.2 },
2259
+ directional: { color: "#ff00ff", intensity: 0.5, position: [5, 15, 5], shadows: true },
2260
+ points: [
2261
+ { color: "#00ffff", intensity: 3, position: [-5, 3, -5], distance: 15 },
2262
+ { color: "#ff00ff", intensity: 3, position: [5, 3, 5], distance: 15 }
2263
+ ]
2264
+ },
2265
+ postprocessing: { bloom: { intensity: 1.5, luminanceThreshold: 0.1 } }
2266
+ },
2267
+ space_void: {
2268
+ background: true,
2269
+ envPreset: "night",
2270
+ lighting: {
2271
+ ambient: { color: "#111133", intensity: 0.1 },
2272
+ directional: { color: "#ffffff", intensity: 0.5, position: [0, 10, 0], shadows: false }
2273
+ }
2274
+ },
2275
+ studio: {
2276
+ background: true,
2277
+ envPreset: "studio",
2278
+ ground: { color: "#cccccc" },
2279
+ lighting: {
2280
+ ambient: { color: "#ffffff", intensity: 0.4 },
2281
+ directional: { color: "#ffffff", intensity: 1, position: [5, 10, 5], shadows: true }
2282
+ }
2283
+ },
2284
+ underwater: {
2285
+ background: true,
2286
+ envPreset: "dawn",
2287
+ fog: { color: "#003366", near: 2, far: 40 },
2288
+ ground: { color: "#1a3a4a" },
2289
+ lighting: {
2290
+ ambient: { color: "#004488", intensity: 0.3 },
2291
+ directional: { color: "#66aacc", intensity: 0.8, position: [0, 20, 0], shadows: true }
2292
+ }
2293
+ },
2294
+ desert: {
2295
+ background: true,
2296
+ envPreset: "sunset",
2297
+ fog: { color: "#d4a574", near: 20, far: 150 },
2298
+ ground: { color: "#c4a35a" },
2299
+ lighting: {
2300
+ ambient: { color: "#f5deb3", intensity: 0.4 },
2301
+ directional: { color: "#ffffcc", intensity: 2, position: [15, 30, 10], shadows: true }
2302
+ }
2303
+ }
2304
+ };
2305
+ var MESH_TYPES = /* @__PURE__ */ new Set([
2306
+ "orb",
2307
+ "sphere",
2308
+ "cube",
2309
+ "box",
2310
+ "cylinder",
2311
+ "pyramid",
2312
+ "cone",
2313
+ "plane",
2314
+ "torus",
2315
+ "ring",
2316
+ "capsule",
2317
+ "object",
2318
+ "avatar",
2319
+ "dna",
2320
+ "nerf",
2321
+ "volumetric_video",
2322
+ // Procedural geometry types (hull/spline/membrane/blob/metaball)
2323
+ "hull",
2324
+ "spline",
2325
+ "membrane",
2326
+ "blob",
2327
+ "metaball"
2328
+ ]);
2329
+ var UI_COMPONENT_PRESETS = {
2330
+ UIPanel: {
2331
+ component: "Container",
2332
+ // @react-three/uikit Container
2333
+ defaultProps: {
2334
+ flexDirection: "column",
2335
+ padding: 16,
2336
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
2337
+ borderRadius: 8
2338
+ }
2339
+ },
2340
+ UIText: {
2341
+ component: "Text",
2342
+ // @react-three/uikit Text
2343
+ defaultProps: {
2344
+ fontSize: 16,
2345
+ color: "white"
2346
+ }
2347
+ },
2348
+ UIButton: {
2349
+ component: "Button",
2350
+ // Custom button using Container with hover
2351
+ defaultProps: {
2352
+ padding: 12,
2353
+ paddingX: 24,
2354
+ backgroundColor: "#4a90d9",
2355
+ borderRadius: 4,
2356
+ cursor: "pointer"
2357
+ }
2358
+ },
2359
+ UISlider: {
2360
+ component: "Slider",
2361
+ // Custom slider implementation
2362
+ defaultProps: {
2363
+ width: 200,
2364
+ height: 20,
2365
+ trackColor: "#333",
2366
+ fillColor: "#4a90d9",
2367
+ thumbSize: 16
2368
+ }
2369
+ },
2370
+ UIInput: {
2371
+ component: "Input",
2372
+ // @react-three/uikit Input
2373
+ defaultProps: {
2374
+ width: 200,
2375
+ padding: 8,
2376
+ backgroundColor: "#222",
2377
+ borderColor: "#444",
2378
+ borderWidth: 1,
2379
+ borderRadius: 4,
2380
+ color: "white"
2381
+ }
2382
+ },
2383
+ UIImage: {
2384
+ component: "Image",
2385
+ // @react-three/uikit Image
2386
+ defaultProps: {
2387
+ objectFit: "contain"
2388
+ }
2389
+ },
2390
+ UIChart: {
2391
+ component: "Chart",
2392
+ // Custom chart component
2393
+ defaultProps: {
2394
+ width: 300,
2395
+ height: 200,
2396
+ backgroundColor: "#1a1a2e"
2397
+ }
2398
+ },
2399
+ UIGauge: {
2400
+ component: "Gauge",
2401
+ // Custom gauge component
2402
+ defaultProps: {
2403
+ size: 100,
2404
+ strokeWidth: 8,
2405
+ trackColor: "#333",
2406
+ fillColor: "#4a90d9"
2407
+ }
2408
+ }
2409
+ };
2410
+ var QUALITY_TIER_SCALES = {
2411
+ low: {
2412
+ particleScale: 0.25,
2413
+ lodLevel: "draft",
2414
+ maxLights: 2,
2415
+ shadowMapSize: 512,
2416
+ shaderComplexity: "basic"
2417
+ },
2418
+ med: {
2419
+ particleScale: 0.6,
2420
+ lodLevel: "mesh",
2421
+ maxLights: 4,
2422
+ shadowMapSize: 1024,
2423
+ shaderComplexity: "standard"
2424
+ },
2425
+ high: {
2426
+ particleScale: 1,
2427
+ lodLevel: "final",
2428
+ maxLights: 8,
2429
+ shadowMapSize: 2048,
2430
+ shaderComplexity: "physical"
2431
+ },
2432
+ ultra: {
2433
+ particleScale: 1.5,
2434
+ lodLevel: "final",
2435
+ maxLights: 16,
2436
+ shadowMapSize: 4096,
2437
+ shaderComplexity: "physical"
2438
+ }
2439
+ };
2440
+ var SceneIRCompiler = class {
2441
+ constructor(options = {}) {
2442
+ // ─── RBAC Enforcement ─────────────────────────────────────────────────
2443
+ this.rbac = getRBAC();
2444
+ this.compilerName = options.compilerName ?? "SceneIRCompiler";
2445
+ this.qualityTier = options.qualityTier ?? "high";
2446
+ this.tierScales = QUALITY_TIER_SCALES[this.qualityTier];
2447
+ this._defaultLighting = options.defaultLighting ?? true;
2448
+ this._holomapPointCloud = options.holomapPointCloud;
2449
+ if (options.platformTarget) {
2450
+ this._platformTarget = typeof options.platformTarget === "string" ? createPlatformTarget(options.platformTarget) : options.platformTarget;
2451
+ }
2452
+ }
2453
+ /**
2454
+ * Validate agent permissions before compilation.
2455
+ * Skips validation when no token is provided (backwards compatibility).
2456
+ *
2457
+ * Checks:
2458
+ * 1. AST read access (can the agent read AST?)
2459
+ * 2. Code generation access (can the agent generate code?)
2460
+ * 3. Output path scope (if outputPath provided)
2461
+ *
2462
+ * @param agentToken - Agent JWT token (optional for backwards compat)
2463
+ * @param outputPath - Optional output file path for scope validation
2464
+ * @throws UnauthorizedCompilerAccessError if token is provided but invalid/unauthorized
2465
+ */
2466
+ validateCompilerAccess(agentToken, outputPath) {
2467
+ if (!agentToken) return;
2468
+ const astDecision = this.rbac.checkAccess({
2469
+ token: agentToken,
2470
+ resourceType: "ast" /* AST */,
2471
+ operation: "read",
2472
+ expectedWorkflowStep: "generate_assembly" /* GENERATE_ASSEMBLY */
2473
+ });
2474
+ if (!astDecision.allowed) {
2475
+ throw new UnauthorizedCompilerAccessError(astDecision, "AST access", this.compilerName);
2476
+ }
2477
+ const codeDecision = this.rbac.checkAccess({
2478
+ token: agentToken,
2479
+ resourceType: "code" /* CODE */,
2480
+ operation: "write",
2481
+ expectedWorkflowStep: "generate_assembly" /* GENERATE_ASSEMBLY */
2482
+ });
2483
+ if (!codeDecision.allowed) {
2484
+ throw new UnauthorizedCompilerAccessError(codeDecision, "code generation", this.compilerName);
2485
+ }
2486
+ if (outputPath) {
2487
+ const outputDecision = this.rbac.checkAccess({
2488
+ token: agentToken,
2489
+ resourceType: "output" /* OUTPUT */,
2490
+ operation: "write",
2491
+ resourcePath: outputPath,
2492
+ expectedWorkflowStep: "serialize" /* SERIALIZE */
2493
+ });
2494
+ if (!outputDecision.allowed) {
2495
+ throw new UnauthorizedCompilerAccessError(
2496
+ outputDecision,
2497
+ `output write to '${outputPath}'`,
2498
+ this.compilerName
2499
+ );
2500
+ }
2501
+ }
2502
+ }
2503
+ // ─── Spread Expansion Utility ─────────────────────────────────────────
2504
+ /**
2505
+ * Expands spread expressions in a properties object.
2506
+ * Spreads are stored with keys like `__spread_0`, `__spread_1` and have
2507
+ * the structure: { type: 'spread', argument: <value> }
2508
+ *
2509
+ * @param props - The properties object potentially containing spreads
2510
+ * @param context - Optional context for resolving references (templates, state)
2511
+ * @returns A new object with spreads expanded and merged
2512
+ */
2513
+ expandSpreads(props, context) {
2514
+ const result = {};
2515
+ const spreadKeys = [];
2516
+ for (const [key, value] of Object.entries(props)) {
2517
+ if (key.startsWith("__spread_")) {
2518
+ spreadKeys.push(key);
2519
+ } else if (value && typeof value === "object" && value.type === "spread") {
2520
+ spreadKeys.push(key);
2521
+ } else {
2522
+ if (value && typeof value === "object" && !Array.isArray(value) && !("__ref" in value) && !("__expr" in value)) {
2523
+ result[key] = this.expandSpreads(value, context);
2524
+ } else if (Array.isArray(value)) {
2525
+ result[key] = this.expandArraySpreads(value, context);
2526
+ } else {
2527
+ result[key] = value;
2528
+ }
2529
+ }
2530
+ }
2531
+ for (const spreadKey of spreadKeys) {
2532
+ const spreadValue = props[spreadKey];
2533
+ if (spreadValue && typeof spreadValue === "object" && spreadValue.type === "spread") {
2534
+ const resolved = this.resolveSpreadArgument(
2535
+ spreadValue.argument,
2536
+ context
2537
+ );
2538
+ if (resolved && typeof resolved === "object" && !Array.isArray(resolved)) {
2539
+ Object.assign(result, this.expandSpreads(resolved, context));
2540
+ }
2541
+ }
2542
+ }
2543
+ for (const [key, value] of Object.entries(props)) {
2544
+ if (!key.startsWith("__spread_") && !(value && typeof value === "object" && value.type === "spread")) {
2545
+ if (value && typeof value === "object" && !Array.isArray(value) && !("__ref" in value) && !("__expr" in value)) {
2546
+ result[key] = this.expandSpreads(value, context);
2547
+ } else if (Array.isArray(value)) {
2548
+ result[key] = this.expandArraySpreads(value, context);
2549
+ } else {
2550
+ result[key] = value;
2551
+ }
2552
+ }
2553
+ }
2554
+ return result;
2555
+ }
2556
+ /**
2557
+ * Expands spread expressions within an array.
2558
+ * Spread elements have { type: 'spread', argument: <value> }
2559
+ */
2560
+ expandArraySpreads(arr, context) {
2561
+ const result = [];
2562
+ for (const item of arr) {
2563
+ if (item && typeof item === "object" && item.type === "spread") {
2564
+ const resolved = this.resolveSpreadArgument(
2565
+ item.argument,
2566
+ context
2567
+ );
2568
+ if (Array.isArray(resolved)) {
2569
+ result.push(...resolved);
2570
+ } else if (resolved !== void 0 && resolved !== null) {
2571
+ result.push(resolved);
2572
+ }
2573
+ } else if (item && typeof item === "object" && !Array.isArray(item)) {
2574
+ result.push(this.expandSpreads(item, context));
2575
+ } else {
2576
+ result.push(item);
2577
+ }
2578
+ }
2579
+ return result;
2580
+ }
2581
+ /**
2582
+ * Resolves a spread argument to its value.
2583
+ * Handles: direct values, __ref references, template references
2584
+ */
2585
+ resolveSpreadArgument(argument, context) {
2586
+ if (argument === null || argument === void 0) {
2587
+ return void 0;
2588
+ }
2589
+ if (typeof argument === "object" && !("__ref" in argument)) {
2590
+ return argument;
2591
+ }
2592
+ if (typeof argument === "object" && "__ref" in argument) {
2593
+ const ref = argument.__ref;
2594
+ if (context?.templates) {
2595
+ const template = context.templates.get(ref);
2596
+ if (template) {
2597
+ return template.properties || template;
2598
+ }
2599
+ }
2600
+ if (context?.state && ref in context.state) {
2601
+ return context.state[ref];
2602
+ }
2603
+ if (context?.state && ref.includes(".")) {
2604
+ const parts = ref.split(".");
2605
+ let value = context.state;
2606
+ for (const part of parts) {
2607
+ if (value && typeof value === "object" && part in value) {
2608
+ value = value[part];
2609
+ } else {
2610
+ value = void 0;
2611
+ break;
2612
+ }
2613
+ }
2614
+ if (value !== void 0) {
2615
+ return value;
2616
+ }
2617
+ }
2618
+ return argument;
2619
+ }
2620
+ if (typeof argument === "string") {
2621
+ if (context?.templates) {
2622
+ const template = context.templates.get(argument);
2623
+ if (template) {
2624
+ return template.properties || template;
2625
+ }
2626
+ }
2627
+ return { __ref: argument };
2628
+ }
2629
+ return argument;
2630
+ }
2631
+ // ─── HSPlusAST Compilation ────────────────────────────────────────────
2632
+ compile(ast, agentToken, outputPath) {
2633
+ this.validateCompilerAccess(agentToken, outputPath);
2634
+ const root = this.compileNode(ast.root);
2635
+ if (this.hasPostProcessing(root)) {
2636
+ root.children?.unshift({
2637
+ type: "EffectComposer",
2638
+ props: {},
2639
+ children: this.extractPostProcessingNodes(root)
2640
+ });
2641
+ }
2642
+ this.injectDefaultLighting(root);
2643
+ const domainBlocks = ast.domainBlocks ?? [];
2644
+ if (domainBlocks.length > 0) {
2645
+ const compiled = compileDomainBlocks(
2646
+ domainBlocks,
2647
+ {
2648
+ material: (block) => {
2649
+ const mat = compileMaterialBlock(block);
2650
+ return {
2651
+ type: "DomainBlockOutput",
2652
+ props: {
2653
+ __raw: materialToR3F(mat, this.tierScales),
2654
+ __domain: "material",
2655
+ __name: mat.name
2656
+ },
2657
+ children: []
2658
+ };
2659
+ },
2660
+ physics: (block) => {
2661
+ const phys = compilePhysicsBlock(block);
2662
+ return {
2663
+ type: "DomainBlockOutput",
2664
+ props: {
2665
+ __raw: physicsToR3F(phys),
2666
+ __domain: "physics",
2667
+ __name: phys.name || phys.keyword
2668
+ },
2669
+ children: []
2670
+ };
2671
+ },
2672
+ vfx: (block) => {
2673
+ const ps = compileParticleBlock(block);
2674
+ return {
2675
+ type: "DomainBlockOutput",
2676
+ props: {
2677
+ __raw: particlesToR3F(ps, this.tierScales),
2678
+ __domain: "vfx",
2679
+ __name: ps.name
2680
+ },
2681
+ children: []
2682
+ };
2683
+ },
2684
+ postfx: (block) => {
2685
+ const pp = compilePostProcessingBlock(block);
2686
+ return {
2687
+ type: "DomainBlockOutput",
2688
+ props: {
2689
+ __raw: postProcessingToR3F(pp),
2690
+ __domain: "postfx",
2691
+ __name: pp.name || "PostProcessing"
2692
+ },
2693
+ children: []
2694
+ };
2695
+ },
2696
+ audio: (block) => {
2697
+ const audio = compileAudioSourceBlock(block);
2698
+ return {
2699
+ type: "DomainBlockOutput",
2700
+ props: { __raw: audioSourceToR3F(audio), __domain: "audio", __name: audio.name },
2701
+ children: []
2702
+ };
2703
+ },
2704
+ weather: (block) => {
2705
+ const weather = compileWeatherBlock(block);
2706
+ return {
2707
+ type: "DomainBlockOutput",
2708
+ props: {
2709
+ __raw: weatherToR3F(weather),
2710
+ __domain: "weather",
2711
+ __name: weather.name || "Weather"
2712
+ },
2713
+ children: []
2714
+ };
2715
+ },
2716
+ simulation: (block) => {
2717
+ const sim = compileSimulationBlock(block);
2718
+ return {
2719
+ type: "DomainBlockOutput",
2720
+ props: {
2721
+ __raw: simulationToR3F(sim),
2722
+ __domain: "simulation",
2723
+ __name: sim.name || "Simulation"
2724
+ },
2725
+ children: []
2726
+ };
2727
+ },
2728
+ procedural: (block) => this.compileProceduralScatterNode(block) ?? this.createNode("Group", {}, block.name)
2729
+ }
2730
+ );
2731
+ if (!root.children) root.children = [];
2732
+ for (const c of compiled) {
2733
+ if (typeof c === "object") root.children.push(c);
2734
+ }
2735
+ }
2736
+ return root;
2737
+ }
2738
+ /**
2739
+ * Compiles a declarative 'world' node into R3F scene nodes.
2740
+ * Nested `world.children` (objects) are compiled via the same path as top-level objects.
2741
+ */
2742
+ compileWorldNode(world, templateMap) {
2743
+ const nodes = [];
2744
+ const props = {};
2745
+ if (world.properties) {
2746
+ for (const prop of world.properties) {
2747
+ props[prop.key] = prop.value;
2748
+ }
2749
+ }
2750
+ if (props.ambient_light !== void 0) {
2751
+ nodes.push(
2752
+ this.createNode("ambientLight", {
2753
+ intensity: Number(props.ambient_light)
2754
+ })
2755
+ );
2756
+ }
2757
+ if (props.skybox_color !== void 0) {
2758
+ nodes.push(
2759
+ this.createNode("Environment", {
2760
+ background: true,
2761
+ preset: "sunset"
2762
+ // Default preset if just color is given
2763
+ })
2764
+ );
2765
+ nodes.push(
2766
+ this.createNode("color", {
2767
+ attach: "background",
2768
+ args: [props.skybox_color]
2769
+ })
2770
+ );
2771
+ }
2772
+ if (props.gravity !== void 0) {
2773
+ nodes.push(
2774
+ this.createNode("Physics", {
2775
+ gravity: [0, -Number(props.gravity), 0]
2776
+ })
2777
+ );
2778
+ }
2779
+ const childNodes = [];
2780
+ if (world.children && world.children.length > 0) {
2781
+ for (const child of world.children) {
2782
+ childNodes.push(
2783
+ this.compileObjectDecl(child, templateMap)
2784
+ );
2785
+ }
2786
+ }
2787
+ if (childNodes.length === 0) {
2788
+ return nodes;
2789
+ }
2790
+ const group = this.createNode(
2791
+ "group",
2792
+ {},
2793
+ world.name ? escapeStringValue(world.name, "JSX") : void 0
2794
+ );
2795
+ group.children = [...nodes, ...childNodes];
2796
+ return [group];
2797
+ }
2798
+ createNode(type, props = {}, id) {
2799
+ const node = sceneIRNodePool.acquire();
2800
+ node.type = type;
2801
+ node.id = id;
2802
+ node.props = props;
2803
+ node.children = [];
2804
+ node.traits = /* @__PURE__ */ new Map();
2805
+ node.directives = [];
2806
+ return node;
2807
+ }
2808
+ /**
2809
+ * Compiles a `procedural` domain block (keyword scatter/procedural/generate/
2810
+ * distribute/pcg_graph) into an instanced `scatter` R3FNode that the web R3F
2811
+ * renderer (ScatterMesh) consumes as a THREE.InstancedMesh.
2812
+ *
2813
+ * Before this method, `.holo` scatter/procedural blocks parsed into the IR but
2814
+ * were silently dropped (compileComposition never read composition.domainBlocks),
2815
+ * so every "dense" world rendered only its hand-listed objects.
2816
+ *
2817
+ * Emitted node shape (shared contract with ImmersiveViewer):
2818
+ * { type: 'scatter', id: block.name, props: { transforms, count, sourceMesh,
2819
+ * hsType, color?, roughness?, metalness?, emissive? }, children: [] }
2820
+ * where each transform is [x, y, z, rotationY, scale].
2821
+ *
2822
+ * Placement is DETERMINISTIC (seeded mulberry32 — never Math.random) so builds
2823
+ * are reproducible. Placement is uniform on the XZ plane within `bounds`, with a
2824
+ * bounded rejection loop honoring `min_distance`.
2825
+ *
2826
+ * v1 limitations (documented):
2827
+ * - .glb/.gltf sourceMesh instances as a `box` placeholder (instancing a loaded
2828
+ * GLB across instances is a follow-up).
2829
+ * - Placement is flat (y=0); slope/terrain-conforming placement is out of scope.
2830
+ */
2831
+ compileProceduralScatterNode(block) {
2832
+ const proc = compileProceduralBlock(block);
2833
+ const props = block.properties ?? {};
2834
+ let scatterNode;
2835
+ if (Array.isArray(props.nodes)) {
2836
+ for (const n of props.nodes) {
2837
+ const nType = n.type ?? n.op ?? n.keyword ?? n.kind;
2838
+ if (typeof nType === "string" && nType.toLowerCase().includes("scatter")) {
2839
+ scatterNode = n.properties ?? n;
2840
+ break;
2841
+ }
2842
+ }
2843
+ }
2844
+ const rawCount = props.count ?? scatterNode?.count ?? proc.density;
2845
+ const count = Math.floor(typeof rawCount === "number" ? rawCount : 0);
2846
+ if (count < 1) return null;
2847
+ const sourceMesh = proc.sourceMesh || (scatterNode?.source_mesh || scatterNode?.sourceMesh || scatterNode?.mesh) || "box";
2848
+ const isGlb = /\.(glb|gltf)$/i.test(sourceMesh);
2849
+ const hsType = isGlb ? "box" : sourceMesh;
2850
+ const boundsRaw = props.bounds ?? props.area ?? scatterNode?.bounds ?? [10, 0, 10];
2851
+ const bx = typeof boundsRaw[0] === "number" ? boundsRaw[0] : 10;
2852
+ const bz = typeof boundsRaw[2] === "number" ? boundsRaw[2] : 10;
2853
+ const minDistance = (() => {
2854
+ const md = props.min_distance ?? props.minDistance ?? scatterNode?.min_distance;
2855
+ return typeof md === "number" && md > 0 ? md : 0;
2856
+ })();
2857
+ const sr = proc.scaleRange ?? props.scale_range;
2858
+ const sMin = Array.isArray(sr) && typeof sr[0] === "number" ? sr[0] : 1;
2859
+ const sMax = Array.isArray(sr) && typeof sr[1] === "number" ? sr[1] : 1;
2860
+ const randomRotation = (() => {
2861
+ const rr = props.random_rotation ?? props.randomRotation ?? scatterNode?.random_rotation;
2862
+ return rr === true;
2863
+ })();
2864
+ const seed = typeof proc.seed === "number" ? proc.seed : 1337;
2865
+ const rand = mulberry32(seed);
2866
+ const halfX = bx / 2;
2867
+ const halfZ = bz / 2;
2868
+ const minDistSq = minDistance * minDistance;
2869
+ const transforms = [];
2870
+ const maxAttempts = count * 30;
2871
+ let attempts = 0;
2872
+ while (transforms.length < count && attempts < maxAttempts) {
2873
+ attempts++;
2874
+ const x = (rand() * 2 - 1) * halfX;
2875
+ const z = (rand() * 2 - 1) * halfZ;
2876
+ if (minDistSq > 0) {
2877
+ let tooClose = false;
2878
+ for (const t of transforms) {
2879
+ const dx = t[0] - x;
2880
+ const dz = t[2] - z;
2881
+ if (dx * dx + dz * dz < minDistSq) {
2882
+ tooClose = true;
2883
+ break;
2884
+ }
2885
+ }
2886
+ if (tooClose) continue;
2887
+ }
2888
+ const ry = randomRotation ? rand() * Math.PI * 2 : 0;
2889
+ const scale = sMin + rand() * (sMax - sMin);
2890
+ transforms.push([x, 0, z, ry, scale]);
2891
+ }
2892
+ if (transforms.length < 1) return null;
2893
+ const materialProps = {};
2894
+ if (props.color != null) materialProps.color = props.color;
2895
+ if (props.roughness != null) materialProps.roughness = props.roughness;
2896
+ if (props.metalness != null) materialProps.metalness = props.metalness;
2897
+ if (props.emissive != null) materialProps.emissive = props.emissive;
2898
+ if (props.material != null) materialProps.material = props.material;
2899
+ return this.createNode(
2900
+ "scatter",
2901
+ {
2902
+ transforms,
2903
+ count: transforms.length,
2904
+ sourceMesh,
2905
+ hsType,
2906
+ ...materialProps
2907
+ },
2908
+ block.name
2909
+ );
2910
+ }
2911
+ /**
2912
+ * I.007 closure: emit a node's compiled petal material spec into its props.
2913
+ * Shared by every trait-bearing compile path (compileNode directives + the
2914
+ * .holo compileObjectDecl obj.traits path) so the emission can't silently miss
2915
+ * the real parser route. The spec is the locked CompiledMaterialSpec shape that
2916
+ * the renderer's buildCompiledMaterial consumes — building the petal material
2917
+ * from `.holo` data instead of hand-authoring it.
2918
+ */
2919
+ emitCompiledLotusMaterial(props, config) {
2920
+ const profile = createBotanicalLotusRenderProfile(config);
2921
+ props.__compiledMaterial = buildLotusPetalMaterialSpec(profile);
2922
+ props.__uniformBindings = LOTUS_PETAL_UNIFORM_BINDINGS;
2923
+ props.__petalGeometry = buildLotusPetalGeometryData(
2924
+ lotusPetalGeometryParamsFromProfile(profile)
2925
+ );
2926
+ props.__petalPlacements = buildLotusFlowerPlacements(profile);
2927
+ const scaffold = buildLotusSceneScaffold();
2928
+ props.__lotusScene = {
2929
+ stemHeight: scaffold.stem.height,
2930
+ scaffold,
2931
+ colors: {
2932
+ water: profile.colors.water,
2933
+ leaf: profile.colors.leaf,
2934
+ leafDark: profile.colors.leaf_dark
2935
+ },
2936
+ // The flower CENTRE: the seed pod (receptacle) ringed by stamen filaments —
2937
+ // the iconic lotus centre, colours + count from the profile.
2938
+ center: {
2939
+ seedPod: profile.colors.seed_pod,
2940
+ seedPodRim: profile.colors.seed_pod_rim,
2941
+ stamen: profile.colors.stamen,
2942
+ stamenTip: profile.colors.stamen_tip,
2943
+ stamenCount: profile.stamen_filament_count,
2944
+ // Carpel layout for the flat-topped "shower-head" seed pod, parsed from the
2945
+ // profile's declared dot pattern (e.g. '1_center_7_12_18_radial' → [1,7,12,18]
2946
+ // = 1 central carpel + radial rings of 7, 12, 18). The renderer recesses a
2947
+ // carpel well per entry — the iconic lotus receptacle, compiled from `.holo`.
2948
+ carpelRings: (profile.seed_pod_dot_pattern?.match(/\d+/g) ?? [
2949
+ "1",
2950
+ "7",
2951
+ "12",
2952
+ "18"
2953
+ ]).map(Number)
2954
+ }
2955
+ };
2956
+ const waterColor = profile.colors.water;
2957
+ const leafColor = profile.colors.leaf;
2958
+ const leafDarkColor = profile.colors.leaf_dark;
2959
+ const stemHeight = scaffold.stem.height;
2960
+ const scaffoldNodes = [
2961
+ this.createNode("mesh", {
2962
+ hsType: "plane",
2963
+ width: scaffold.waterSize,
2964
+ height: scaffold.waterSize,
2965
+ rotation: [-Math.PI / 2, 0, 0],
2966
+ color: waterColor,
2967
+ roughness: 0.22,
2968
+ metalness: 0.5,
2969
+ // Mark the pond as a REFLECTIVE surface — the renderer's generic MeshNode draws
2970
+ // it with a mirror material so the flower + pads reflect (a real water read).
2971
+ reflective: true
2972
+ }),
2973
+ ...scaffold.pads.map(
2974
+ (pad, padIdx) => this.createNode("mesh", {
2975
+ hsType: "lilypad",
2976
+ radius: pad.radius,
2977
+ // Per-pad notch width variation so the pads don't look stamped.
2978
+ notchAngle: 0.48 + padIdx % 3 * 0.07,
2979
+ position: pad.pos,
2980
+ rotation: [-Math.PI / 2, 0, pad.rotation],
2981
+ color: pad.dark ? leafDarkColor : leafColor,
2982
+ roughness: 0.85
2983
+ })
2984
+ )
2985
+ ];
2986
+ const stemNode = this.createNode("group", {
2987
+ __animatedTransform: [
2988
+ { prop: "scaleY", target: "developmentalTime", edge0: 0, edge1: 0.42, from: 1e-3, to: 1 },
2989
+ {
2990
+ prop: "posY",
2991
+ target: "developmentalTime",
2992
+ edge0: 0,
2993
+ edge1: 0.42,
2994
+ from: 0,
2995
+ to: stemHeight / 2
2996
+ }
2997
+ ]
2998
+ });
2999
+ stemNode.children = [
3000
+ this.createNode("mesh", {
3001
+ hsType: "cylinder",
3002
+ radiusTop: scaffold.stem.topRadius,
3003
+ radiusBottom: scaffold.stem.bottomRadius,
3004
+ height: stemHeight,
3005
+ color: leafDarkColor,
3006
+ roughness: 0.7
3007
+ })
3008
+ ];
3009
+ scaffoldNodes.push(stemNode);
3010
+ scaffold.leaves.forEach((lf, i) => {
3011
+ const leafNode = this.createNode("group", {
3012
+ position: lf.pos,
3013
+ __animatedTransform: [
3014
+ {
3015
+ prop: "scaleUniform",
3016
+ target: "developmentalTime",
3017
+ edge0: 0.15 + i * 0.08,
3018
+ edge1: 0.55 + i * 0.08,
3019
+ from: 0,
3020
+ to: 1
3021
+ }
3022
+ ]
3023
+ });
3024
+ leafNode.children = [
3025
+ this.createNode("mesh", {
3026
+ hsType: "cylinder",
3027
+ radiusTop: 0.03,
3028
+ radiusBottom: 0.045,
3029
+ height: lf.height,
3030
+ position: [0, lf.height / 2, 0],
3031
+ color: leafDarkColor,
3032
+ roughness: 0.7
3033
+ }),
3034
+ this.createNode("mesh", {
3035
+ hsType: "circle",
3036
+ radius: lf.radius,
3037
+ position: [0, lf.height, 0],
3038
+ rotation: [-Math.PI / 2 + lf.tilt, 0, lf.rotation],
3039
+ color: lf.dark ? leafDarkColor : leafColor,
3040
+ roughness: 0.8
3041
+ })
3042
+ ];
3043
+ scaffoldNodes.push(leafNode);
3044
+ });
3045
+ props.__scaffoldNodes = scaffoldNodes;
3046
+ }
3047
+ compileNode(node) {
3048
+ if (node.type === "system") {
3049
+ return this.compileSystemNode(node);
3050
+ }
3051
+ if (node.type === "component") {
3052
+ return this.compileComponentNode(node);
3053
+ }
3054
+ if (node.type === "timeline") {
3055
+ return this.compileHsplusTimelineNode(node);
3056
+ }
3057
+ const rawProps = node.properties || {};
3058
+ const type = this.mapType(node.type, rawProps);
3059
+ const r3fNode = sceneIRNodePool.acquire();
3060
+ r3fNode.type = type;
3061
+ const rawId = node.id || node.name;
3062
+ r3fNode.id = rawId ? escapeStringValue(rawId, "JSX") : void 0;
3063
+ r3fNode.props = this.compileProperties(node, rawProps);
3064
+ r3fNode.children = [];
3065
+ r3fNode.traits = /* @__PURE__ */ new Map();
3066
+ r3fNode.directives = node.directives || [];
3067
+ if (node.directives) {
3068
+ for (const directive of node.directives) {
3069
+ if (directive.type === "trait") {
3070
+ r3fNode.traits?.set(
3071
+ directive.name,
3072
+ directive.config
3073
+ );
3074
+ }
3075
+ }
3076
+ }
3077
+ const lotusConfig = r3fNode.traits?.get("botanical_lotus");
3078
+ if (lotusConfig) {
3079
+ this.emitCompiledLotusMaterial(r3fNode.props, lotusConfig);
3080
+ }
3081
+ const enhanced = node;
3082
+ if (enhanced.graphics) {
3083
+ this.applyGraphicsConfig(r3fNode, enhanced.graphics);
3084
+ }
3085
+ if (enhanced.children && Array.isArray(enhanced.children)) {
3086
+ r3fNode.children = enhanced.children.map(
3087
+ (child) => this.compileNode(child)
3088
+ );
3089
+ }
3090
+ return r3fNode;
3091
+ }
3092
+ // ─── HoloComposition Compilation (.holo files) ────────────────────────
3093
+ compileComposition(composition, agentToken, outputPath) {
3094
+ this.validateCompilerAccess(agentToken, outputPath);
3095
+ if (this._platformTarget) {
3096
+ const platformMixin = new PlatformConditionalCompilerMixin();
3097
+ composition = platformMixin.filterForPlatform(composition, this._platformTarget);
3098
+ }
3099
+ const root = sceneIRNodePool.acquire();
3100
+ root.type = "group";
3101
+ root.id = composition.name ? escapeStringValue(composition.name, "JSX") : void 0;
3102
+ root.props = {};
3103
+ root.children = [];
3104
+ root.traits = /* @__PURE__ */ new Map();
3105
+ root.directives = [];
3106
+ const templateMap = /* @__PURE__ */ new Map();
3107
+ if (Array.isArray(composition.templates)) {
3108
+ for (const tmpl of composition.templates) {
3109
+ templateMap.set(tmpl.name, tmpl);
3110
+ }
3111
+ }
3112
+ if (composition.children && Array.isArray(composition.children)) {
3113
+ for (const child of composition.children) {
3114
+ if (child.type === "template" && child.name) {
3115
+ templateMap.set(child.name, child);
3116
+ }
3117
+ }
3118
+ for (const child of composition.children) {
3119
+ root.children.push(this.compileChildNode(child, templateMap));
3120
+ }
3121
+ }
3122
+ if (composition.environment) {
3123
+ root.children.push(
3124
+ ...this.compileEnvironmentBlock(
3125
+ composition.environment
3126
+ )
3127
+ );
3128
+ }
3129
+ if (Array.isArray(composition.lights)) {
3130
+ for (const light of composition.lights) {
3131
+ root.children.push(this.compileLightBlock(light));
3132
+ }
3133
+ }
3134
+ if (Array.isArray(composition.objects)) {
3135
+ for (const obj of composition.objects) {
3136
+ root.children.push(this.compileObjectDecl(obj, templateMap));
3137
+ }
3138
+ }
3139
+ if (Array.isArray(composition.spatialGroups)) {
3140
+ for (const group of composition.spatialGroups) {
3141
+ root.children.push(this.compileSpatialGroup(group, templateMap));
3142
+ }
3143
+ }
3144
+ if (Array.isArray(composition.timelines)) {
3145
+ for (const timeline of composition.timelines) {
3146
+ root.children.push(
3147
+ this.compileTimelineBlock(timeline)
3148
+ );
3149
+ }
3150
+ }
3151
+ if (Array.isArray(composition.audio)) {
3152
+ for (const audio of composition.audio) {
3153
+ root.children.push(this.compileAudioBlock(audio));
3154
+ }
3155
+ }
3156
+ if (Array.isArray(composition.zones)) {
3157
+ for (const zone of composition.zones) {
3158
+ root.children.push(this.compileZoneBlock(zone));
3159
+ }
3160
+ }
3161
+ if (Array.isArray(composition.worlds)) {
3162
+ for (const world of composition.worlds) {
3163
+ root.children.push(
3164
+ ...this.compileWorldNode(
3165
+ world,
3166
+ templateMap
3167
+ )
3168
+ );
3169
+ }
3170
+ }
3171
+ if (composition.ui) {
3172
+ root.children.push(
3173
+ this.compileUIBlock(composition.ui)
3174
+ );
3175
+ }
3176
+ if (Array.isArray(composition.transitions)) {
3177
+ for (const transition of composition.transitions) {
3178
+ root.children.push(
3179
+ this.compileTransitionBlock(transition)
3180
+ );
3181
+ }
3182
+ }
3183
+ if (Array.isArray(composition.conditionals)) {
3184
+ for (const cond of composition.conditionals) {
3185
+ root.children.push(this.compileConditionalBlock(cond, templateMap));
3186
+ }
3187
+ }
3188
+ if (Array.isArray(composition.iterators)) {
3189
+ for (const iter of composition.iterators) {
3190
+ root.children.push(this.compileForEachBlock(iter, templateMap));
3191
+ }
3192
+ }
3193
+ if (composition.camera) {
3194
+ root.children.push(
3195
+ this.compileCameraBlock(composition.camera)
3196
+ );
3197
+ }
3198
+ if (composition.effects) {
3199
+ root.children.unshift(
3200
+ this.compileEffectsBlock(composition.effects)
3201
+ );
3202
+ } else if (this.hasPostProcessing(root)) {
3203
+ root.children.unshift({
3204
+ type: "EffectComposer",
3205
+ props: {},
3206
+ children: this.extractPostProcessingNodes(root)
3207
+ });
3208
+ }
3209
+ const domainBlocks = composition.domainBlocks ?? [];
3210
+ for (const block of domainBlocks) {
3211
+ const kw = (block.keyword ?? "").toLowerCase();
3212
+ const isProcedural = block.domain === "procedural" || kw === "scatter" || kw === "procedural" || kw === "generate" || kw === "distribute" || kw === "pcg_graph";
3213
+ if (!isProcedural) continue;
3214
+ const node = this.compileProceduralScatterNode(block);
3215
+ if (node) root.children.push(node);
3216
+ }
3217
+ this.injectHolomapPointCloud(root);
3218
+ this.injectDefaultLighting(root);
3219
+ return root;
3220
+ }
3221
+ /** R3F host apps can map this node to BufferGeometry + pointsMaterial from base64 buffers. */
3222
+ injectHolomapPointCloud(root) {
3223
+ const h = this._holomapPointCloud;
3224
+ if (!h || h.pointCount < 1 || !h.positionsB64 || !h.colorsB64) return;
3225
+ if (!root.children) root.children = [];
3226
+ root.children.push({
3227
+ type: "holomapPointCloud",
3228
+ props: {
3229
+ positionsB64: h.positionsB64,
3230
+ colorsB64: h.colorsB64,
3231
+ pointCount: h.pointCount
3232
+ }
3233
+ });
3234
+ }
3235
+ compileLightBlock(light) {
3236
+ const lightMapping = {
3237
+ directional: "directionalLight",
3238
+ point: "pointLight",
3239
+ spot: "spotLight",
3240
+ hemisphere: "hemisphereLight",
3241
+ ambient: "ambientLight",
3242
+ area: "rectAreaLight"
3243
+ };
3244
+ const type = lightMapping[light.lightType] || "directionalLight";
3245
+ const props = {};
3246
+ if (Array.isArray(light.properties)) {
3247
+ for (const prop of light.properties) {
3248
+ const key = prop.key;
3249
+ const value = prop.value;
3250
+ if (key === "cast_shadow" || key === "castShadow") {
3251
+ props.castShadow = value;
3252
+ } else if (key === "ground_color" || key === "groundColor") {
3253
+ props.groundColor = value;
3254
+ } else if (key === "shadow_map_size") {
3255
+ props["shadow-mapSize"] = Array.isArray(value) ? value : [value, value];
3256
+ } else {
3257
+ props[key] = value;
3258
+ }
3259
+ }
3260
+ }
3261
+ if ((light.lightType === "directional" || light.lightType === "spot") && props.castShadow === void 0) {
3262
+ props.castShadow = true;
3263
+ }
3264
+ const r3fNode = sceneIRNodePool.acquire();
3265
+ r3fNode.type = type;
3266
+ r3fNode.id = light.name ? escapeStringValue(light.name, "JSX") : void 0;
3267
+ r3fNode.props = props;
3268
+ r3fNode.children = [];
3269
+ r3fNode.traits = /* @__PURE__ */ new Map();
3270
+ r3fNode.directives = [];
3271
+ return r3fNode;
3272
+ }
3273
+ compileEffectsBlock(effects) {
3274
+ const children = [];
3275
+ if (Array.isArray(effects.effects)) {
3276
+ for (const effect of effects.effects) {
3277
+ const effectMapping = {
3278
+ bloom: "Bloom",
3279
+ ssao: "SSAO",
3280
+ vignette: "Vignette",
3281
+ dof: "DepthOfField",
3282
+ chromatic_aberration: "ChromaticAberration",
3283
+ tone_mapping: "ToneMapping",
3284
+ noise: "Noise"
3285
+ };
3286
+ const effectType = effect.effectType;
3287
+ const type = effectMapping[effectType] || effectType;
3288
+ children.push(
3289
+ this.createNode(type, { ...effect.properties || {} })
3290
+ );
3291
+ }
3292
+ }
3293
+ const composer = this.createNode("EffectComposer", {});
3294
+ composer.children = children;
3295
+ return composer;
3296
+ }
3297
+ compileCameraBlock(camera) {
3298
+ const props = {};
3299
+ if (Array.isArray(camera.properties)) {
3300
+ for (const prop of camera.properties) {
3301
+ if (prop.key === "field_of_view" || prop.key === "fov") {
3302
+ props.fov = prop.value;
3303
+ } else if (prop.key === "look_at" || prop.key === "lookAt") {
3304
+ props.lookAt = prop.value;
3305
+ } else {
3306
+ props[prop.key] = prop.value;
3307
+ }
3308
+ }
3309
+ }
3310
+ props.cameraType = camera.cameraType;
3311
+ return this.createNode("Camera", props, "__camera");
3312
+ }
3313
+ compileEnvironmentBlock(env) {
3314
+ const nodes = [];
3315
+ const envProps = {};
3316
+ if (env.properties) {
3317
+ for (const prop of env.properties) {
3318
+ envProps[prop.key] = prop.value;
3319
+ }
3320
+ }
3321
+ const presetName = envProps.skybox || envProps.preset;
3322
+ if (presetName) {
3323
+ const preset = ENVIRONMENT_PRESETS[presetName];
3324
+ if (preset) {
3325
+ nodes.push(
3326
+ this.createNode("Environment", {
3327
+ background: true,
3328
+ preset: preset.envPreset || presetName
3329
+ })
3330
+ );
3331
+ const lighting = preset.lighting;
3332
+ if (lighting?.ambient) {
3333
+ nodes.push(
3334
+ this.createNode("ambientLight", {
3335
+ color: lighting.ambient.color,
3336
+ intensity: lighting.ambient.intensity
3337
+ })
3338
+ );
3339
+ }
3340
+ if (lighting?.directional) {
3341
+ const dl = lighting.directional;
3342
+ nodes.push(
3343
+ this.createNode("directionalLight", {
3344
+ color: dl.color,
3345
+ intensity: dl.intensity,
3346
+ position: dl.position,
3347
+ castShadow: dl.shadows !== false,
3348
+ "shadow-mapSize": [2048, 2048]
3349
+ })
3350
+ );
3351
+ }
3352
+ if (Array.isArray(lighting?.points)) {
3353
+ for (const pl of lighting.points) {
3354
+ nodes.push(
3355
+ this.createNode("pointLight", {
3356
+ color: pl.color,
3357
+ intensity: pl.intensity,
3358
+ position: pl.position,
3359
+ distance: pl.distance
3360
+ })
3361
+ );
3362
+ }
3363
+ }
3364
+ const presetMap = preset;
3365
+ if (presetMap.fog) {
3366
+ const fogMap = presetMap.fog;
3367
+ nodes.push(
3368
+ this.createNode("fog", {
3369
+ attach: "fog",
3370
+ color: fogMap.color,
3371
+ near: fogMap.near,
3372
+ far: fogMap.far
3373
+ })
3374
+ );
3375
+ }
3376
+ if (presetMap.ground) {
3377
+ const groundMap = presetMap.ground;
3378
+ nodes.push(
3379
+ this.createNode(
3380
+ "mesh",
3381
+ {
3382
+ hsType: "plane",
3383
+ rotation: [-Math.PI / 2, 0, 0],
3384
+ position: [0, -0.01, 0],
3385
+ receiveShadow: true,
3386
+ args: [200, 200],
3387
+ color: groundMap.color,
3388
+ materialProps: { roughness: 0.8, metalness: 0 }
3389
+ },
3390
+ "__ground"
3391
+ )
3392
+ );
3393
+ }
3394
+ } else {
3395
+ nodes.push(this.createNode("Environment", { background: true, preset: presetName }));
3396
+ }
3397
+ }
3398
+ if (envProps.ambient_light !== void 0) {
3399
+ nodes.push(
3400
+ this.createNode("ambientLight", {
3401
+ intensity: typeof envProps.ambient_light === "number" ? envProps.ambient_light : 0.5
3402
+ })
3403
+ );
3404
+ }
3405
+ const explicitFog = envProps.fog;
3406
+ if (explicitFog && typeof explicitFog === "object") {
3407
+ nodes.push(
3408
+ this.createNode("fog", {
3409
+ attach: "fog",
3410
+ color: explicitFog.color || "#cccccc",
3411
+ near: explicitFog.near || 10,
3412
+ far: explicitFog.far || 100
3413
+ })
3414
+ );
3415
+ }
3416
+ return nodes;
3417
+ }
3418
+ compileObjectDecl(obj, templateMap) {
3419
+ const props = {};
3420
+ let geometryType = "cube";
3421
+ if (obj.template && templateMap) {
3422
+ const tmpl = templateMap.get(obj.template);
3423
+ if (tmpl) {
3424
+ const tmplTraits = tmpl.traits;
3425
+ if (tmplTraits && Array.isArray(tmplTraits)) {
3426
+ const existingTraitNames = new Set(
3427
+ (obj.traits || []).map(
3428
+ (t) => t.name
3429
+ )
3430
+ );
3431
+ obj.traits = [
3432
+ ...tmplTraits.filter(
3433
+ (t) => !existingTraitNames.has(t.name)
3434
+ ),
3435
+ ...obj.traits || []
3436
+ ];
3437
+ }
3438
+ const tmplProps = tmpl.properties;
3439
+ if (tmplProps && Array.isArray(tmplProps)) {
3440
+ const existingKeys = new Set(
3441
+ (obj.properties || []).map(
3442
+ (p) => p.key
3443
+ )
3444
+ );
3445
+ const mergedProps = tmplProps.filter((p) => !existingKeys.has(p.key)).map((p) => ({
3446
+ type: "ObjectProperty",
3447
+ key: p.key,
3448
+ value: p.value
3449
+ }));
3450
+ obj.properties = [...mergedProps, ...obj.properties || []];
3451
+ }
3452
+ }
3453
+ }
3454
+ if (obj.properties && Array.isArray(obj.properties)) {
3455
+ const expandedProperties = [];
3456
+ for (const p of obj.properties) {
3457
+ const prop = p;
3458
+ if (prop && prop.type === "spread") {
3459
+ const resolved = this.resolveSpreadArgument(
3460
+ prop.target || prop.argument,
3461
+ {
3462
+ templates: templateMap
3463
+ }
3464
+ );
3465
+ if (resolved && typeof resolved === "object" && !Array.isArray(resolved)) {
3466
+ for (const [key, value] of Object.entries(resolved)) {
3467
+ expandedProperties.push({ key, value });
3468
+ }
3469
+ } else if (Array.isArray(resolved)) {
3470
+ expandedProperties.push(...resolved);
3471
+ }
3472
+ } else {
3473
+ expandedProperties.push(prop);
3474
+ }
3475
+ }
3476
+ obj.properties = expandedProperties;
3477
+ }
3478
+ if (obj.properties) {
3479
+ for (const p of obj.properties) {
3480
+ const key = p.key;
3481
+ const value = p.value;
3482
+ if (key === "geometry" || key === "mesh") {
3483
+ geometryType = value;
3484
+ } else if (key === "type") {
3485
+ const valStr = value;
3486
+ if (["text", "sparkles", "portal", "audio"].includes(valStr)) {
3487
+ geometryType = valStr;
3488
+ } else if (["directional", "point", "spot", "hemisphere", "ambient", "area"].includes(valStr)) {
3489
+ geometryType = "light";
3490
+ props.lightType = valStr;
3491
+ } else {
3492
+ props[key] = value;
3493
+ }
3494
+ } else if (key === "light_type") {
3495
+ props.lightType = value;
3496
+ } else if (key === "position" && Array.isArray(value)) {
3497
+ props.position = value;
3498
+ } else if (key === "rotation" && Array.isArray(value)) {
3499
+ props.rotation = value;
3500
+ } else if (key === "scale") {
3501
+ props.scale = Array.isArray(value) ? value : [value, value, value];
3502
+ } else if (key === "color") {
3503
+ props.color = value;
3504
+ } else if (key === "src" || key === "model" || key === "source") {
3505
+ props.src = value;
3506
+ geometryType = "model";
3507
+ } else if (key === "text") {
3508
+ props.children = this.resolveValue(value);
3509
+ props.text = this.resolveValue(value);
3510
+ } else if (key === "font_size") {
3511
+ props.fontSize = value;
3512
+ } else if (key === "material") {
3513
+ const currentMaterialProps = props.materialProps || {};
3514
+ if (typeof value === "string" && MATERIAL_PRESETS[value]) {
3515
+ props.materialProps = { ...MATERIAL_PRESETS[value], ...currentMaterialProps };
3516
+ } else if (typeof value === "object" && value !== null) {
3517
+ const valObj = value;
3518
+ if (valObj.preset && typeof valObj.preset === "string" && MATERIAL_PRESETS[valObj.preset]) {
3519
+ const { preset: _, ...rest } = valObj;
3520
+ props.materialProps = {
3521
+ ...MATERIAL_PRESETS[valObj.preset],
3522
+ ...rest,
3523
+ ...currentMaterialProps
3524
+ };
3525
+ } else {
3526
+ props.materialProps = { ...currentMaterialProps, ...valObj };
3527
+ }
3528
+ }
3529
+ } else if (key === "roughness" || key === "metalness" || key === "metallic") {
3530
+ const mProps = props.materialProps || {};
3531
+ mProps[key === "metallic" ? "metalness" : key] = value;
3532
+ props.materialProps = mProps;
3533
+ } else if (key === "opacity") {
3534
+ const mProps = props.materialProps || {};
3535
+ mProps.opacity = value;
3536
+ mProps.transparent = value < 1;
3537
+ props.materialProps = mProps;
3538
+ } else if (key === "emissive") {
3539
+ props.materialProps = {
3540
+ ...props.materialProps || {},
3541
+ emissive: value
3542
+ };
3543
+ } else if (key === "emissiveIntensity" || key === "emissive_intensity") {
3544
+ props.materialProps = {
3545
+ ...props.materialProps || {},
3546
+ emissiveIntensity: value
3547
+ };
3548
+ } else if (key === "size") {
3549
+ if (Array.isArray(value)) {
3550
+ props.args = value;
3551
+ }
3552
+ props.size = value;
3553
+ } else if (key === "radius") {
3554
+ props.size = value * 2;
3555
+ } else if (key === "intensity") {
3556
+ props.intensity = value;
3557
+ } else if (key === "cast_shadow" || key === "castShadow") {
3558
+ props.castShadow = value;
3559
+ } else if (key === "receiveShadow" || key === "receive_shadow") {
3560
+ props.receiveShadow = value;
3561
+ } else if (key === "visible") {
3562
+ props[key] = value;
3563
+ } else if (key === "maturity") {
3564
+ props.maturityOverride = value;
3565
+ } else if (key === "promoteUrl" || key === "promote_url") {
3566
+ props.promoteUrl = value;
3567
+ } else if (key === "collisionShape" || key === "collision_shape") {
3568
+ props.collisionShape = value;
3569
+ } else {
3570
+ props[key] = this.resolveValue(value);
3571
+ }
3572
+ }
3573
+ }
3574
+ if (obj.traits && Array.isArray(obj.traits)) {
3575
+ const semiring = new ProvenanceSemiring();
3576
+ const physicsApplications = obj.traits.filter((t) => t.name === "physics" || t.name === "collidable").map((t) => {
3577
+ let baseConfig = t.config || {};
3578
+ if (t.name === "collidable" && !baseConfig.type)
3579
+ baseConfig = { ...baseConfig, type: "fixed" };
3580
+ if (t.name === "physics" && !baseConfig.type)
3581
+ baseConfig = { ...baseConfig, type: "dynamic" };
3582
+ return {
3583
+ name: t.name,
3584
+ config: baseConfig,
3585
+ context: obj.provenance?.context
3586
+ };
3587
+ });
3588
+ if (physicsApplications.length > 0) {
3589
+ const { config: mergedPhysics } = semiring.add(physicsApplications);
3590
+ props.rigidBody = { ...mergedPhysics };
3591
+ props.collider = { type: "auto" };
3592
+ if (props.rigidBody?.type === "fixed") {
3593
+ props.castShadow = true;
3594
+ props.receiveShadow = true;
3595
+ }
3596
+ }
3597
+ for (const trait of obj.traits) {
3598
+ const name = trait.name;
3599
+ if (name === "physics" || name === "collidable") {
3600
+ continue;
3601
+ } else if (name === "grabbable") {
3602
+ props.castShadow = true;
3603
+ props.grabbable = trait.config || true;
3604
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3605
+ if (!props.collider) props.collider = { type: "auto" };
3606
+ } else if (name === "hoverable") {
3607
+ props.hoverable = trait.config || true;
3608
+ } else if (name === "animated") {
3609
+ props.animated = trait.config || true;
3610
+ } else if (name === "positional" || name === "spatial_audio") {
3611
+ props.spatial = true;
3612
+ } else if (name === "gem_resonance") {
3613
+ props.gemResonance = gemResonanceConfig(trait.config);
3614
+ props.spatial = true;
3615
+ } else if (name === "shadow") {
3616
+ props.castShadow = true;
3617
+ if (trait.config?.mapSize)
3618
+ props["shadow-mapSize"] = [trait.config.mapSize, trait.config.mapSize];
3619
+ } else if (name === "material") {
3620
+ const presetName = trait.config?.preset;
3621
+ if (presetName && typeof presetName === "string" && MATERIAL_PRESETS[presetName]) {
3622
+ const { preset: _, ...rest } = trait.config;
3623
+ props.materialProps = {
3624
+ ...MATERIAL_PRESETS[presetName],
3625
+ ...rest,
3626
+ ...props.materialProps
3627
+ };
3628
+ } else {
3629
+ props.materialProps = {
3630
+ ...props.materialProps,
3631
+ ...trait.config
3632
+ };
3633
+ }
3634
+ } else if (name === "networked") {
3635
+ props.networked = trait.config || true;
3636
+ } else if (name === "moldable") {
3637
+ props.moldable = trait.config || true;
3638
+ } else if (name === "stretchable") {
3639
+ props.stretchable = trait.config || true;
3640
+ } else if (name === "bloom") {
3641
+ props.bloom = trait.config || { intensity: 1 };
3642
+ } else if (name === "portal") {
3643
+ props.portal = trait.config || true;
3644
+ } else if (name === "attach") {
3645
+ props.attach = trait.config || true;
3646
+ } else if (name === "orbit") {
3647
+ props.orbit = trait.config || true;
3648
+ } else if (name === "look_at") {
3649
+ props.lookAtTarget = trait.config || true;
3650
+ } else if (name === "follow") {
3651
+ props.follow = trait.config || true;
3652
+ } else if (name === "plane_detection") {
3653
+ props.planeDetection = trait.config || { mode: "all" };
3654
+ } else if (name === "mesh_detection") {
3655
+ props.meshDetection = trait.config || { classification: true };
3656
+ } else if (name === "anchor") {
3657
+ props.anchor = trait.config || { type: "spatial" };
3658
+ } else if (name === "persistent_anchor") {
3659
+ props.persistentAnchor = trait.config || { storage: "local" };
3660
+ } else if (name === "shared_anchor") {
3661
+ props.sharedAnchor = trait.config || { authority: "creator" };
3662
+ } else if (name === "occlusion") {
3663
+ props.occlusionMode = trait.config?.mode || "environment";
3664
+ props.occlusion = trait.config || true;
3665
+ } else if (name === "light_estimation") {
3666
+ props.lightEstimation = trait.config || { auto_apply: true };
3667
+ } else if (name === "geospatial") {
3668
+ props.geospatial = trait.config || true;
3669
+ } else if (name === "gaussian_splat") {
3670
+ props.gaussianSplat = trait.config || true;
3671
+ } else if (name === "nerf") {
3672
+ props.nerf = trait.config || true;
3673
+ } else if (name === "volumetric_video") {
3674
+ props.volumetricVideo = trait.config || true;
3675
+ } else if (name === "point_cloud") {
3676
+ props.pointCloud = trait.config || true;
3677
+ } else if (name === "photogrammetry") {
3678
+ props.photogrammetry = trait.config || true;
3679
+ } else if (name === "web_surface") {
3680
+ props.webSurface = trait.config || true;
3681
+ } else if (name === "cloth") {
3682
+ props.cloth = trait.config || { stiffness: 0.8 };
3683
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3684
+ } else if (name === "fluid") {
3685
+ props.fluid = trait.config || { viscosity: 0.01 };
3686
+ props.__gapsComponents = props.__gapsComponents || [];
3687
+ props.__gapsComponents.push("FluidRenderer");
3688
+ } else if (name === "soft_body") {
3689
+ props.softBody = trait.config || { elasticity: 0.5 };
3690
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3691
+ } else if (name === "rope") {
3692
+ props.rope = trait.config || { segments: 20 };
3693
+ } else if (name === "chain") {
3694
+ props.chain = trait.config || { link_count: 20 };
3695
+ } else if (name === "wind") {
3696
+ props.wind = trait.config || { strength: 5 };
3697
+ } else if (name === "buoyancy") {
3698
+ props.buoyancy = trait.config || { water_level: 0 };
3699
+ } else if (name === "destruction") {
3700
+ props.destruction = trait.config || { health: 100 };
3701
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3702
+ if (!props.collider) props.collider = { type: "auto" };
3703
+ } else if (name === "soft_body_pro") {
3704
+ props.softBodyPro = trait.config || { tear_threshold: 0.5 };
3705
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3706
+ } else if (name === "crowd_sim") {
3707
+ props.crowdSim = trait.config || { max_agents: 1e3 };
3708
+ } else if (name === "deformable_terrain") {
3709
+ props.deformableTerrain = trait.config || { resolution: 256 };
3710
+ } else if (name === "volumetric_clouds") {
3711
+ props.volumetricClouds = trait.config || { coverage: 0.5 };
3712
+ props.__gapsComponents = props.__gapsComponents || [];
3713
+ props.__gapsComponents.push("CloudRenderer");
3714
+ } else if (name === "god_rays") {
3715
+ props.godRays = trait.config || { intensity: 1 };
3716
+ props.__gapsComponents = props.__gapsComponents || [];
3717
+ props.__gapsComponents.push("GodRaysEffect");
3718
+ } else if (name === "spatial_voice") {
3719
+ props.spatialVoice = trait.config || { max_distance: 30 };
3720
+ props.spatial = true;
3721
+ } else if (name === "ai_companion") {
3722
+ props.aiCompanion = trait.config || { personality: "friendly" };
3723
+ } else if (name === "moderation") {
3724
+ props.moderation = trait.config || { sensitivity: "medium" };
3725
+ } else if (name === "anti_grief") {
3726
+ props.antiGrief = trait.config || { detection_window: 30 };
3727
+ } else if (name === "world_state") {
3728
+ props.worldState = trait.config || { sync_rate: 10 };
3729
+ } else if (name === "token_gated") {
3730
+ props.tokenGated = trait.config || { token_contract: "", min_balance: 1 };
3731
+ } else if (name === "ambisonics") {
3732
+ props.ambisonics = trait.config || { order: 1 };
3733
+ props.spatial = true;
3734
+ } else if (name === "hrtf") {
3735
+ props.hrtf = trait.config || true;
3736
+ props.spatial = true;
3737
+ } else if (name === "reverb_zone") {
3738
+ props.reverbZone = trait.config || { preset: "room" };
3739
+ } else if (name === "audio_occlusion") {
3740
+ props.audioOcclusion = trait.config || true;
3741
+ } else if (name === "audio_portal") {
3742
+ props.audioPortal = trait.config || true;
3743
+ } else if (name === "head_tracked_audio") {
3744
+ props.headTrackedAudio = trait.config || true;
3745
+ props.spatial = true;
3746
+ } else if (name === "accessible") {
3747
+ props.accessible = trait.config || { role: "generic" };
3748
+ } else if (name === "alt_text") {
3749
+ props.altText = trait.config?.text || "";
3750
+ } else if (name === "magnifiable") {
3751
+ props.magnifiable = trait.config || { max_scale: 3 };
3752
+ } else if (name === "high_contrast") {
3753
+ props.highContrast = trait.config || { mode: "outline" };
3754
+ } else if (name === "perceptual_color") {
3755
+ props.perceptualColor = trait.config || true;
3756
+ } else if (name === "motion_reduced") {
3757
+ props.motionReduced = trait.config || true;
3758
+ if (props.animated) props.animated = false;
3759
+ } else if (name === "compute") {
3760
+ props.compute = trait.config || true;
3761
+ } else if (name === "gpu_particle") {
3762
+ props.gpuParticle = trait.config || { count: 1e4 };
3763
+ } else if (isVfxParticleTraitName(name)) {
3764
+ const particleConfig = {
3765
+ effect: vfxParticleEffect(name),
3766
+ ...trait.config || {}
3767
+ };
3768
+ const gpuParticles = props.gpuParticles ?? [];
3769
+ props.gpuParticles = [...gpuParticles, particleConfig];
3770
+ if (!props.gpuParticle) props.gpuParticle = particleConfig;
3771
+ } else if (name === "gpu_physics") {
3772
+ props.gpuPhysics = trait.config || true;
3773
+ } else if (name === "digital_twin") {
3774
+ props.digitalTwin = trait.config || true;
3775
+ } else if (name === "sensor") {
3776
+ props.sensor = trait.config || true;
3777
+ } else if (name === "data_binding") {
3778
+ props.dataBinding = trait.config || true;
3779
+ } else if (name === "behavior_tree") {
3780
+ props.behaviorTree = trait.config || true;
3781
+ } else if (name === "llm_agent") {
3782
+ props.llmAgent = trait.config || true;
3783
+ } else if (name === "neural_link") {
3784
+ props.neuralLink = trait.config || { model: "brittney-v4.gguf", temperature: 0.7 };
3785
+ } else if (name === "perception") {
3786
+ props.perception = trait.config || { sight_range: 20 };
3787
+ } else if (name === "patrol") {
3788
+ props.patrol = trait.config || true;
3789
+ } else if (name === "co_located") {
3790
+ props.coLocated = trait.config || true;
3791
+ } else if (name === "shared_world") {
3792
+ props.sharedWorld = trait.config || true;
3793
+ } else if (name === "voice_proximity") {
3794
+ props.voiceProximity = trait.config || { max_distance: 20 };
3795
+ props.spatial = true;
3796
+ } else if (name === "spatial_persona") {
3797
+ props.spatialPersona = trait.config || { style: "realistic" };
3798
+ } else if (name === "shareplay") {
3799
+ props.sharePlay = trait.config || { activity_type: "custom" };
3800
+ } else if (name === "object_tracking") {
3801
+ props.objectTracking = trait.config || true;
3802
+ } else if (name === "scene_reconstruction") {
3803
+ props.sceneReconstruction = trait.config || { mode: "mesh" };
3804
+ } else if (name === "eye_tracked") {
3805
+ props.eyeTracked = true;
3806
+ } else if (name === "eye_hand_fusion") {
3807
+ props.eyeHandFusion = true;
3808
+ } else if (name === "controlnet") {
3809
+ props.controlNet = trait.config || { model: "canny" };
3810
+ } else if (name === "ai_texture_gen") {
3811
+ props.aiTextureGen = trait.config || { style: "photorealistic" };
3812
+ } else if (name === "diffusion_realtime") {
3813
+ props.diffusionRealtime = trait.config || { backend: "cuda" };
3814
+ } else if (name === "ai_upscaling") {
3815
+ props.aiUpscaling = trait.config || { factor: 2 };
3816
+ } else if (name === "ai_inpainting") {
3817
+ props.aiInpainting = trait.config || true;
3818
+ } else if (name === "neural_forge") {
3819
+ props.neuralForge = trait.config || true;
3820
+ } else if (name === "embedding_search") {
3821
+ props.embeddingSearch = trait.config || { dimensions: 1536 };
3822
+ } else if (name === "ai_npc_brain") {
3823
+ props.aiNpcBrain = trait.config || { model: "llm" };
3824
+ } else if (name === "vector_db") {
3825
+ props.vectorDb = trait.config || true;
3826
+ } else if (name === "vision" || name === "ai_vision") {
3827
+ props.vision = trait.config || { task: "detection" };
3828
+ } else if (name === "spatial_awareness") {
3829
+ props.spatialAwareness = trait.config || true;
3830
+ } else if (name === "neural_animation") {
3831
+ props.neuralAnimation = trait.config || { style: "motion_matching" };
3832
+ } else if (name === "draft") {
3833
+ props.draftMode = true;
3834
+ props.draftShape = trait.config?.shape || "box";
3835
+ props.draftColor = trait.config?.color || "#88aaff";
3836
+ props.draftOpacity = trait.config?.opacity ?? 1;
3837
+ props.draftWireframe = trait.config?.wireframe || false;
3838
+ if (trait.config?.collision !== false) {
3839
+ if (!props.rigidBody) props.rigidBody = { type: "fixed" };
3840
+ if (!props.collider) props.collider = { type: "auto" };
3841
+ }
3842
+ } else if (name === "botanical_lotus") {
3843
+ this.emitCompiledLotusMaterial(props, trait.config || {});
3844
+ } else {
3845
+ props[name] = trait.config || true;
3846
+ if (!props.__unrecognizedTraits) {
3847
+ props.__unrecognizedTraits = [];
3848
+ }
3849
+ props.__unrecognizedTraits.push(name);
3850
+ }
3851
+ }
3852
+ }
3853
+ if (obj.traits && Array.isArray(obj.traits)) {
3854
+ const traitNames = obj.traits.map(
3855
+ (t) => t.name
3856
+ );
3857
+ const compositor = new TraitCompositor();
3858
+ const composedMaterial = compositor.compose(traitNames);
3859
+ if (Object.keys(composedMaterial).length > 0) {
3860
+ props.materialProps = {
3861
+ ...props.materialProps,
3862
+ ...composedMaterial
3863
+ };
3864
+ }
3865
+ }
3866
+ const perceptualTrait = Array.isArray(obj.traits) ? obj.traits.find((trait) => trait.name === "perceptual_color") : void 0;
3867
+ const perceptualTraitConfig = perceptualTrait ? perceptualTrait.config && typeof perceptualTrait.config === "object" ? perceptualTrait.config : {} : void 0;
3868
+ this.applyPerceptualColorProps(
3869
+ props,
3870
+ perceptualTraitConfig,
3871
+ this.isScientificColorNode(geometryType, props)
3872
+ );
3873
+ let type;
3874
+ if (geometryType === "model" && props.src) {
3875
+ type = "gltfModel";
3876
+ } else if (geometryType === "light") {
3877
+ const lightType = props.lightType || props.type || "directional";
3878
+ const lightMapping = {
3879
+ directional: "directionalLight",
3880
+ point: "pointLight",
3881
+ spot: "spotLight",
3882
+ hemisphere: "hemisphereLight",
3883
+ ambient: "ambientLight",
3884
+ area: "rectAreaLight"
3885
+ };
3886
+ type = lightMapping[lightType] || "directionalLight";
3887
+ delete props.lightType;
3888
+ } else if (geometryType === "text") {
3889
+ type = "Text";
3890
+ } else if (geometryType === "sparkles") {
3891
+ type = "Sparkles";
3892
+ } else if (geometryType === "portal") {
3893
+ type = "Portal";
3894
+ } else if (geometryType === "gaussian_splat" || geometryType === "splat" || props.gaussianSplat !== void 0) {
3895
+ type = "splat";
3896
+ } else {
3897
+ type = "mesh";
3898
+ props.hsType = geometryType;
3899
+ if (!props.args) {
3900
+ const size = typeof props.size === "number" ? props.size : 1;
3901
+ props.args = this.getGeometryArgs(geometryType, { size });
3902
+ }
3903
+ }
3904
+ const r3fNode = this.createNode(type, props, obj.name);
3905
+ if (props.draftMode) {
3906
+ r3fNode.assetMaturity = "draft";
3907
+ } else if (props.maturityOverride) {
3908
+ const m = props.maturityOverride;
3909
+ if (m === "draft" || m === "mesh" || m === "final") {
3910
+ r3fNode.assetMaturity = m;
3911
+ }
3912
+ }
3913
+ delete props.maturityOverride;
3914
+ if (obj.children && Array.isArray(obj.children)) {
3915
+ for (const child of obj.children) {
3916
+ r3fNode.children.push(this.compileObjectDecl(child));
3917
+ }
3918
+ }
3919
+ if (props.__gapsComponents && Array.isArray(props.__gapsComponents)) {
3920
+ for (const componentType of props.__gapsComponents) {
3921
+ const componentProps = {};
3922
+ if (componentType === "CloudRenderer" && props.volumetricClouds) {
3923
+ const vc = props.volumetricClouds;
3924
+ componentProps.coverage = vc.coverage ?? 0.5;
3925
+ componentProps.altitude = vc.altitude ?? 500;
3926
+ componentProps.windOffset = vc.wind ?? [0, 0, 0];
3927
+ componentProps.layers = vc.layers ?? 3;
3928
+ } else if (componentType === "GodRaysEffect" && props.godRays) {
3929
+ const gr = props.godRays;
3930
+ componentProps.intensity = gr.intensity ?? 1;
3931
+ componentProps.decay = gr.decay ?? 0.96;
3932
+ componentProps.lightColor = gr.color ?? "#fffde7";
3933
+ } else if (componentType === "FluidRenderer" && props.fluid) {
3934
+ const fl = props.fluid;
3935
+ componentProps.color = fl.color ?? "#1a6fc4";
3936
+ componentProps.particleSize = fl.particle_radius ?? 0.02;
3937
+ componentProps.renderMode = fl.render_mode ?? "points";
3938
+ }
3939
+ r3fNode.children.push(
3940
+ this.createNode(componentType, componentProps, `${obj.name}-${componentType}`)
3941
+ );
3942
+ }
3943
+ delete props.__gapsComponents;
3944
+ }
3945
+ return r3fNode;
3946
+ }
3947
+ /**
3948
+ * Compile a SystemNode into an R3FNode.
3949
+ *
3950
+ * Systems are logical containers with state, actions, lifecycle hooks,
3951
+ * and optionally child objects/UI. In the R3F tree, a system compiles
3952
+ * to a group node annotated with its rich metadata (state, actions,
3953
+ * hooks) so the runtime/renderer can wire up behavior.
3954
+ */
3955
+ compileSystemNode(node, templateMap) {
3956
+ const props = {};
3957
+ if (node.state) {
3958
+ props.systemState = node.state;
3959
+ }
3960
+ if (node.actions) {
3961
+ props.systemActions = node.actions;
3962
+ }
3963
+ if (node.hooks) {
3964
+ props.systemHooks = node.hooks;
3965
+ }
3966
+ if (node.properties && typeof node.properties === "object") {
3967
+ for (const [key, value] of Object.entries(node.properties)) {
3968
+ props[key] = value;
3969
+ }
3970
+ }
3971
+ const r3fNode = this.createNode("System", props, node.id || node.name);
3972
+ if (node.directives) {
3973
+ r3fNode.directives = node.directives;
3974
+ }
3975
+ if (node.directives) {
3976
+ for (const d of node.directives) {
3977
+ if (d.type === "trait") {
3978
+ r3fNode.traits?.set(d.name, d.config || {});
3979
+ }
3980
+ }
3981
+ }
3982
+ if (node.children && Array.isArray(node.children)) {
3983
+ for (const child of node.children) {
3984
+ r3fNode.children.push(this.compileChildNode(child, templateMap));
3985
+ }
3986
+ }
3987
+ if (node.ui && Array.isArray(node.ui)) {
3988
+ for (const uiNode of node.ui) {
3989
+ r3fNode.children.push(this.compileNode(uiNode));
3990
+ }
3991
+ }
3992
+ return r3fNode;
3993
+ }
3994
+ /**
3995
+ * Compile a ComponentNode into an R3FNode.
3996
+ *
3997
+ * Components are UI-focused containers with props, state, actions,
3998
+ * and render/UI blocks. They compile to a group node annotated with
3999
+ * component metadata for the runtime.
4000
+ */
4001
+ compileComponentNode(node, templateMap) {
4002
+ const props = {};
4003
+ if (node.props) {
4004
+ props.componentProps = node.props;
4005
+ }
4006
+ if (node.state) {
4007
+ props.componentState = node.state;
4008
+ }
4009
+ if (node.actions) {
4010
+ props.componentActions = node.actions;
4011
+ }
4012
+ if (node.hooks) {
4013
+ props.componentHooks = node.hooks;
4014
+ }
4015
+ if (node.properties && typeof node.properties === "object") {
4016
+ for (const [key, value] of Object.entries(node.properties)) {
4017
+ props[key] = value;
4018
+ }
4019
+ }
4020
+ const r3fNode = this.createNode(
4021
+ "Component",
4022
+ props,
4023
+ node.id || node.name
4024
+ );
4025
+ if (node.directives) {
4026
+ r3fNode.directives = node.directives;
4027
+ }
4028
+ if (node.directives) {
4029
+ for (const d of node.directives) {
4030
+ if (d.type === "trait") {
4031
+ r3fNode.traits?.set(d.name, d.config || {});
4032
+ }
4033
+ }
4034
+ }
4035
+ if (node.children && Array.isArray(node.children)) {
4036
+ for (const child of node.children) {
4037
+ r3fNode.children.push(this.compileChildNode(child, templateMap));
4038
+ }
4039
+ }
4040
+ if (node.ui && Array.isArray(node.ui)) {
4041
+ for (const uiNode of node.ui) {
4042
+ r3fNode.children.push(this.compileNode(uiNode));
4043
+ }
4044
+ }
4045
+ return r3fNode;
4046
+ }
4047
+ /**
4048
+ * Dispatch a child node to the appropriate compile method based on its type.
4049
+ * Used by compileSystemNode, compileComponentNode, and compileComposition
4050
+ * when processing the parser's children array.
4051
+ */
4052
+ compileChildNode(child, templateMap) {
4053
+ switch (child.type) {
4054
+ case "system":
4055
+ return this.compileSystemNode(child, templateMap);
4056
+ case "component":
4057
+ return this.compileComponentNode(child, templateMap);
4058
+ case "object":
4059
+ return this.compileObjectDecl(child, templateMap);
4060
+ case "template":
4061
+ if (templateMap && typeof child.name === "string") {
4062
+ templateMap.set(child.name, child);
4063
+ }
4064
+ return this.compileTemplateNode(child, templateMap);
4065
+ case "spatial_group":
4066
+ return this.compileSpatialGroup(child, templateMap);
4067
+ default:
4068
+ return this.compileNode(child);
4069
+ }
4070
+ }
4071
+ /**
4072
+ * Compile a template node. Templates define reusable types.
4073
+ * In the R3F tree, they compile to an empty group (they're not
4074
+ * rendered directly — objects "using" them inherit their properties).
4075
+ */
4076
+ compileTemplateNode(node, _templateMap) {
4077
+ const props = {};
4078
+ if (node.state || node.properties?.state) {
4079
+ props.templateState = node.state || node.properties?.state;
4080
+ }
4081
+ if (node.properties) {
4082
+ for (const [key, value] of Object.entries(node.properties)) {
4083
+ if (key !== "state") {
4084
+ props[key] = value;
4085
+ }
4086
+ }
4087
+ }
4088
+ return this.createNode("Template", props, node.name);
4089
+ }
4090
+ compileSpatialGroup(group, templateMap) {
4091
+ const props = {};
4092
+ let staggerStep = 0;
4093
+ if (group.properties) {
4094
+ for (const prop of group.properties) {
4095
+ if (prop.key === "position") props.position = prop.value;
4096
+ else if (prop.key === "rotation") props.rotation = prop.value;
4097
+ else if (prop.key === "scale")
4098
+ props.scale = Array.isArray(prop.value) ? prop.value : [prop.value, prop.value, prop.value];
4099
+ else if (prop.key === "stagger") {
4100
+ const n = Number(prop.value);
4101
+ if (Number.isFinite(n)) {
4102
+ staggerStep = n;
4103
+ props.stagger = n;
4104
+ }
4105
+ }
4106
+ }
4107
+ }
4108
+ const node = this.createNode("group", props, group.name);
4109
+ if (group.objects) {
4110
+ for (const obj of group.objects)
4111
+ node.children.push(this.compileObjectDecl(obj, templateMap));
4112
+ }
4113
+ if (group.groups) {
4114
+ for (const sub of group.groups)
4115
+ node.children.push(this.compileSpatialGroup(sub, templateMap));
4116
+ }
4117
+ if (staggerStep && node.children) {
4118
+ const entranceTarget = `entrance_${String(group.name ?? "group").replace(
4119
+ /[^a-zA-Z0-9_]/g,
4120
+ "_"
4121
+ )}`;
4122
+ const synthesized = synthesizeEntranceChannels(
4123
+ node.children,
4124
+ entranceTarget
4125
+ );
4126
+ applyStaggerToChildren(node.children, staggerStep);
4127
+ if (synthesized > 0) {
4128
+ node.children.push(this.buildEntranceDriver(entranceTarget));
4129
+ }
4130
+ }
4131
+ return node;
4132
+ }
4133
+ /**
4134
+ * Build a hidden `Timeline` node that ramps `target` 0→1, played by the
4135
+ * existing `<TimelineDriver>`, so the synthesized `@animated` entrance channels
4136
+ * in a staggered group animate with no author-supplied timeline. (S3)
4137
+ */
4138
+ buildEntranceDriver(target) {
4139
+ const driver = this.createNode("Timeline", { autoplay: true, loop: false });
4140
+ driver.children = [
4141
+ this.createNode("TimelineEntry", {
4142
+ time: 0,
4143
+ actionKind: "animate",
4144
+ target,
4145
+ properties: { value: 0 }
4146
+ }),
4147
+ this.createNode("TimelineEntry", {
4148
+ time: 1,
4149
+ actionKind: "animate",
4150
+ target,
4151
+ properties: { value: 1 }
4152
+ })
4153
+ ];
4154
+ return driver;
4155
+ }
4156
+ compileTimelineBlock(timeline) {
4157
+ const entries = [];
4158
+ if (timeline.entries) {
4159
+ for (const entry of timeline.entries) {
4160
+ const action = entry.action;
4161
+ const entryProps = { time: entry.time, actionKind: action.kind };
4162
+ if (action.kind === "animate") {
4163
+ entryProps.target = action.target;
4164
+ entryProps.properties = action.properties;
4165
+ } else if (action.kind === "emit") {
4166
+ entryProps.event = action.event;
4167
+ if (action.data !== void 0) entryProps.data = action.data;
4168
+ } else if (action.kind === "call") {
4169
+ entryProps.method = action.method;
4170
+ if (action.args) entryProps.args = action.args;
4171
+ }
4172
+ entries.push(this.createNode("TimelineEntry", entryProps));
4173
+ }
4174
+ }
4175
+ const safeName = timeline.name ? escapeStringValue(timeline.name, "JSX") : void 0;
4176
+ const timelineNode = this.createNode(
4177
+ "Timeline",
4178
+ { autoplay: timeline.autoplay, loop: timeline.loop },
4179
+ safeName
4180
+ );
4181
+ timelineNode.children = entries;
4182
+ return timelineNode;
4183
+ }
4184
+ /**
4185
+ * Compile a `.hsplus` keyframe-track timeline (HoloScriptPlusParser shape:
4186
+ * `{ type:'timeline', children:[{ type:'track', target, keyframes:[{time,value,easing}] }] }`,
4187
+ * the Theatre.js harvest grammar) into the SAME `Timeline` + `TimelineEntry`
4188
+ * R3F shape the existing `<TimelineDriver>` already plays — one `TimelineEntry`
4189
+ * per keyframe, grouped by the track's target. The per-keyframe `easing` is
4190
+ * carried onto the entry so the driver can honor it (driver-side application is
4191
+ * the S4b slice; today the driver tweens with smoothstep). End-to-end: a
4192
+ * keyframe-track timeline now DRIVES `__animatedTransform` consumers.
4193
+ */
4194
+ compileHsplusTimelineNode(node) {
4195
+ const entries = [];
4196
+ const children = node.children || [];
4197
+ for (const track of children) {
4198
+ if (track.type !== "track") continue;
4199
+ const target = track.target;
4200
+ const keyframes = track.keyframes || [];
4201
+ for (const kf of keyframes) {
4202
+ const entryProps = {
4203
+ time: Number(kf.time),
4204
+ actionKind: "animate",
4205
+ target,
4206
+ properties: { value: this.resolveKeyframeValue(kf.value) }
4207
+ };
4208
+ if (typeof kf.easing === "string") entryProps.easing = kf.easing;
4209
+ entries.push(this.createNode("TimelineEntry", entryProps));
4210
+ }
4211
+ }
4212
+ const props = node.properties || {};
4213
+ const safeName = node.name ? escapeStringValue(node.name, "JSX") : void 0;
4214
+ const timelineNode = this.createNode(
4215
+ "Timeline",
4216
+ { autoplay: props.autoplay, loop: props.loop },
4217
+ safeName
4218
+ );
4219
+ timelineNode.children = entries;
4220
+ return timelineNode;
4221
+ }
4222
+ /** Resolve a keyframe value (a HoloScriptPlusParser `parseValue` result) to a
4223
+ * number — a bare number, a `{ value }` literal wrapper, or a coercible. */
4224
+ resolveKeyframeValue(v) {
4225
+ if (typeof v === "number") return v;
4226
+ if (v && typeof v === "object" && "value" in v) {
4227
+ const n2 = Number(v.value);
4228
+ return Number.isFinite(n2) ? n2 : 0;
4229
+ }
4230
+ const n = Number(v);
4231
+ return Number.isFinite(n) ? n : 0;
4232
+ }
4233
+ compileAudioBlock(audio) {
4234
+ const props = {};
4235
+ if (audio.properties) {
4236
+ for (const prop of audio.properties) {
4237
+ if (prop.key === "src" || prop.key === "source") {
4238
+ props.src = prop.value;
4239
+ } else if (prop.key === "rolloff") {
4240
+ props.rolloffFactor = prop.value;
4241
+ } else {
4242
+ props[prop.key] = prop.value;
4243
+ }
4244
+ }
4245
+ }
4246
+ const safeName = audio.name ? escapeStringValue(audio.name, "JSX") : void 0;
4247
+ return this.createNode("Audio", props, safeName);
4248
+ }
4249
+ compileZoneBlock(zone) {
4250
+ const props = {};
4251
+ if (zone.properties) {
4252
+ for (const prop of zone.properties) {
4253
+ props[prop.key] = prop.value;
4254
+ }
4255
+ }
4256
+ if (zone.handlers && zone.handlers.length > 0) {
4257
+ props.handlers = zone.handlers.map(
4258
+ (h) => ({
4259
+ event: h.event,
4260
+ parameters: h.parameters,
4261
+ body: h.body
4262
+ })
4263
+ );
4264
+ }
4265
+ const safeName = zone.name ? escapeStringValue(zone.name, "JSX") : void 0;
4266
+ return this.createNode("Zone", props, safeName);
4267
+ }
4268
+ compileUIBlock(ui) {
4269
+ const children = [];
4270
+ if (ui.elements) {
4271
+ for (const el of ui.elements) {
4272
+ const elProps = {};
4273
+ if (el.properties) {
4274
+ for (const prop of el.properties) {
4275
+ if (prop.key === "font_size") {
4276
+ elProps.fontSize = prop.value;
4277
+ } else {
4278
+ elProps[prop.key] = this.resolveValue(prop.value);
4279
+ }
4280
+ }
4281
+ }
4282
+ const safeElName = el.name ? escapeStringValue(el.name, "JSX") : void 0;
4283
+ children.push(this.createNode("UIElement", elProps, safeElName));
4284
+ }
4285
+ }
4286
+ const uiNode = this.createNode("UI", {}, "__ui");
4287
+ uiNode.children = children;
4288
+ return uiNode;
4289
+ }
4290
+ compileTransitionBlock(transition) {
4291
+ const props = {};
4292
+ if (transition.properties) {
4293
+ for (const prop of transition.properties) {
4294
+ props[prop.key] = prop.value;
4295
+ }
4296
+ }
4297
+ const safeName = transition.name ? escapeStringValue(transition.name, "JSX") : void 0;
4298
+ return this.createNode("Transition", props, safeName);
4299
+ }
4300
+ compileConditionalBlock(cond, templateMap) {
4301
+ const children = [];
4302
+ if (cond.objects) {
4303
+ for (const obj of cond.objects)
4304
+ children.push(this.compileObjectDecl(obj, templateMap));
4305
+ }
4306
+ if (cond.spatialGroups) {
4307
+ for (const g of cond.spatialGroups)
4308
+ children.push(this.compileSpatialGroup(g, templateMap));
4309
+ }
4310
+ const elseChildren = [];
4311
+ if (cond.elseObjects) {
4312
+ for (const obj of cond.elseObjects)
4313
+ elseChildren.push(this.compileObjectDecl(obj, templateMap));
4314
+ }
4315
+ if (cond.elseSpatialGroups) {
4316
+ for (const g of cond.elseSpatialGroups)
4317
+ elseChildren.push(this.compileSpatialGroup(g, templateMap));
4318
+ }
4319
+ const conditionalNode = this.createNode("ConditionalGroup", {
4320
+ condition: cond.condition,
4321
+ elseChildren: elseChildren.length > 0 ? elseChildren : void 0
4322
+ });
4323
+ conditionalNode.children = children;
4324
+ return conditionalNode;
4325
+ }
4326
+ compileForEachBlock(iter, templateMap) {
4327
+ const templateChildren = [];
4328
+ if (iter.objects) {
4329
+ for (const obj of iter.objects)
4330
+ templateChildren.push(this.compileObjectDecl(obj, templateMap));
4331
+ }
4332
+ if (iter.spatialGroups) {
4333
+ for (const g of iter.spatialGroups)
4334
+ templateChildren.push(this.compileSpatialGroup(g, templateMap));
4335
+ }
4336
+ const forEachNode = this.createNode("ForEachGroup", {
4337
+ variable: iter.variable,
4338
+ iterable: iter.iterable
4339
+ });
4340
+ forEachNode.children = templateChildren;
4341
+ return forEachNode;
4342
+ }
4343
+ /**
4344
+ * Resolve a property value, converting bind expressions into runtime-reactive markers.
4345
+ */
4346
+ resolveValue(value) {
4347
+ if (value && typeof value === "object" && value.__bind) {
4348
+ return {
4349
+ __bind: true,
4350
+ source: value.source,
4351
+ transform: value.transform
4352
+ };
4353
+ }
4354
+ return value;
4355
+ }
4356
+ // ─── Shared Helpers ───────────────────────────────────────────────────
4357
+ injectDefaultLighting(root) {
4358
+ if (!this._defaultLighting) return;
4359
+ if (!this.treeHasLights(root)) {
4360
+ const shadowSize = this.tierScales.shadowMapSize;
4361
+ root.children?.unshift(
4362
+ this.createNode("ambientLight", { intensity: 0.4, color: "#ffffff" }),
4363
+ this.createNode("directionalLight", {
4364
+ intensity: 1,
4365
+ position: [5, 10, 5],
4366
+ castShadow: true,
4367
+ "shadow-mapSize": [shadowSize, shadowSize],
4368
+ color: "#ffffff"
4369
+ })
4370
+ );
4371
+ }
4372
+ }
4373
+ treeHasLights(node) {
4374
+ if (node.type.toLowerCase().includes("light")) return true;
4375
+ return node.children?.some((c) => this.treeHasLights(c)) || false;
4376
+ }
4377
+ hasPostProcessing(node) {
4378
+ if (node.traits?.has("bloom") || node.traits?.has("postprocessing"))
4379
+ return true;
4380
+ if (node.props.bloom) return true;
4381
+ return node.children?.some((c) => this.hasPostProcessing(c)) || false;
4382
+ }
4383
+ extractPostProcessingNodes(node) {
4384
+ const effects = [];
4385
+ const ppTrait = node.traits?.get(
4386
+ "postprocessing"
4387
+ );
4388
+ if (ppTrait) {
4389
+ if (ppTrait.bloom)
4390
+ effects.push(this.createNode("Bloom", ppTrait.bloom));
4391
+ if (ppTrait.ssao)
4392
+ effects.push(this.createNode("SSAO", ppTrait.ssao));
4393
+ if (ppTrait.vignette)
4394
+ effects.push(this.createNode("Vignette", ppTrait.vignette));
4395
+ }
4396
+ if (node.props.bloom) {
4397
+ const bloom = node.props.bloom;
4398
+ const bloomProps = typeof bloom === "object" && bloom !== null ? bloom : { intensity: 1 };
4399
+ effects.push(this.createNode("Bloom", bloomProps));
4400
+ }
4401
+ node.children?.forEach((child) => effects.push(...this.extractPostProcessingNodes(child)));
4402
+ return effects;
4403
+ }
4404
+ mapType(type, props) {
4405
+ if (type === "environment") {
4406
+ if (props.name && typeof props.name === "string" && ENVIRONMENT_PRESETS[props.name]) {
4407
+ Object.assign(props, ENVIRONMENT_PRESETS[props.name]);
4408
+ }
4409
+ return "Environment";
4410
+ }
4411
+ if (type === "light") {
4412
+ const lightType = props.type || "directional";
4413
+ const lightMapping = {
4414
+ directional: "directionalLight",
4415
+ point: "pointLight",
4416
+ spot: "spotLight",
4417
+ hemisphere: "hemisphereLight",
4418
+ ambient: "ambientLight",
4419
+ area: "rectAreaLight"
4420
+ };
4421
+ return lightMapping[lightType] || "directionalLight";
4422
+ }
4423
+ if (type === "portal") return "Portal";
4424
+ if (type === "sparkles") return "Sparkles";
4425
+ if (MESH_TYPES.has(type)) {
4426
+ props.hsType = type;
4427
+ return "mesh";
4428
+ }
4429
+ const mapping = {
4430
+ ambient_light: "ambientLight",
4431
+ model: "gltfModel",
4432
+ audio: "positionalAudio",
4433
+ composition: "group",
4434
+ scale: "group",
4435
+ focus: "group",
4436
+ spatial_agent: "SpatialAgent",
4437
+ spatial_container: "group",
4438
+ ui_panel: "UIPanel",
4439
+ ui_text: "UIText",
4440
+ ui_button: "UIButton",
4441
+ ui_slider: "UISlider",
4442
+ ui_input: "UIInput",
4443
+ ui_image: "UIImage",
4444
+ ui_chart: "UIChart",
4445
+ ui_gauge: "UIGauge",
4446
+ ui_value: "UIValue",
4447
+ ui_status_indicator: "UIStatusIndicator",
4448
+ tool_slot: "ToolSlot",
4449
+ behavior: "group",
4450
+ system: "System",
4451
+ component: "Component",
4452
+ dna: "DNA",
4453
+ gaussian_splat: "splat",
4454
+ splat: "splat",
4455
+ nerf: "NeRF",
4456
+ volumetric_video: "VolumetricVideo",
4457
+ world: "group"
4458
+ };
4459
+ return mapping[type] || type;
4460
+ }
4461
+ applyPerceptualColorProps(props, traitConfig, scientific) {
4462
+ const input = this.resolvePerceptualColorInput(props, traitConfig, scientific);
4463
+ if (!input) return;
4464
+ const pass = applyPerceptualColorPass(input);
4465
+ props.perceptualColor = pass;
4466
+ if (pass.palette) {
4467
+ props.palette = pass.palette.colors;
4468
+ }
4469
+ if (pass.gradient) {
4470
+ props.gradient = pass.gradient.stops;
4471
+ props.gradientColors = pass.gradient.colors;
4472
+ }
4473
+ if (pass.colorMap) {
4474
+ props.colorMap = pass.colorMap.name;
4475
+ props.colorMapColors = pass.colorMap.colors;
4476
+ delete props.color_map;
4477
+ }
4478
+ if (!props.color && pass.gradient?.colors[0]) {
4479
+ props.color = pass.gradient.colors[0];
4480
+ }
4481
+ const materialProps = props.materialProps && typeof props.materialProps === "object" ? props.materialProps : {};
4482
+ if (pass.gradient?.colors[0] && materialProps.color === void 0) {
4483
+ props.materialProps = { ...materialProps, color: pass.gradient.colors[0] };
4484
+ }
4485
+ }
4486
+ resolvePerceptualColorInput(props, traitConfig, scientific) {
4487
+ const palette = this.stringArray(props.palette) ?? this.stringArray(traitConfig?.palette);
4488
+ const gradient = this.gradientStops(props.gradient) ?? this.gradientStops(traitConfig?.gradient);
4489
+ const colorMap = this.colorMapValue(props.colorMap) ?? this.colorMapValue(props.color_map) ?? this.colorMapValue(traitConfig?.color_map) ?? this.colorMapValue(traitConfig?.colorMap);
4490
+ const hasColorInput = palette !== void 0 || gradient !== void 0 || colorMap !== void 0;
4491
+ if (!traitConfig && !(scientific && hasColorInput)) return void 0;
4492
+ const mode = typeof traitConfig?.mode === "string" ? traitConfig.mode : "auto";
4493
+ const base = {
4494
+ steps: this.numberValue(traitConfig?.steps) ?? this.numberValue(props.steps) ?? 7,
4495
+ dampening: this.numberValue(traitConfig?.dampening),
4496
+ targetDeltaE: this.numberValue(traitConfig?.target_delta_e) ?? this.numberValue(traitConfig?.targetDeltaE),
4497
+ neutralAxis: this.booleanValue(traitConfig?.neutral_axis) ?? this.booleanValue(traitConfig?.neutralAxis),
4498
+ scientific
4499
+ };
4500
+ if (mode === "palette") return { ...base, palette: palette ?? ["#1F77B4", "#FF7F0E"] };
4501
+ if (mode === "gradient") return { ...base, gradient: gradient ?? palette };
4502
+ if (mode === "color_map") return { ...base, colorMap: colorMap ?? "viridis" };
4503
+ if (colorMap !== void 0) return { ...base, colorMap };
4504
+ if (gradient !== void 0) return { ...base, gradient };
4505
+ if (palette !== void 0) return { ...base, palette };
4506
+ return { ...base, colorMap: "viridis" };
4507
+ }
4508
+ isScientificColorNode(type, props) {
4509
+ return type === "heatmap_view" || type === "heatmap" || type === "chart" || type === "graph" || type === "scatter_plot" || type === "line_graph" || props.scientific === true || props.color_map !== void 0 || props.colorMap !== void 0;
4510
+ }
4511
+ stringArray(value) {
4512
+ return Array.isArray(value) && value.every((entry) => typeof entry === "string") ? [...value] : void 0;
4513
+ }
4514
+ gradientStops(value) {
4515
+ const stringColors = this.stringArray(value);
4516
+ if (stringColors) return stringColors;
4517
+ if (!Array.isArray(value)) return void 0;
4518
+ const stops = [];
4519
+ for (const entry of value) {
4520
+ if (!entry || typeof entry !== "object") continue;
4521
+ const record = entry;
4522
+ if (typeof record.t === "number" && typeof record.color === "string") {
4523
+ stops.push({ t: record.t, color: record.color });
4524
+ }
4525
+ }
4526
+ return stops.length > 0 ? stops : void 0;
4527
+ }
4528
+ colorMapValue(value) {
4529
+ if (typeof value === "string") return value;
4530
+ return this.gradientStops(value) ?? this.stringArray(value);
4531
+ }
4532
+ numberValue(value) {
4533
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
4534
+ }
4535
+ booleanValue(value) {
4536
+ return typeof value === "boolean" ? value : void 0;
4537
+ }
4538
+ compileProperties(node, rawProps) {
4539
+ const expandedProps = this.expandSpreads(rawProps);
4540
+ const props = { ...expandedProps };
4541
+ if (node.position) {
4542
+ props.position = node.position;
4543
+ }
4544
+ if (rawProps.position && Array.isArray(rawProps.position)) {
4545
+ props.position = rawProps.position;
4546
+ }
4547
+ if (node.hologram) {
4548
+ const h = node.hologram;
4549
+ if (h.color) props.color = h.color;
4550
+ if (MESH_TYPES.has(node.type)) {
4551
+ props.args = this.getGeometryArgs(node.type, h);
4552
+ props.hsType = node.type;
4553
+ }
4554
+ }
4555
+ if (rawProps.scale !== void 0 && !props.scale) {
4556
+ props.scale = Array.isArray(rawProps.scale) ? rawProps.scale : [rawProps.scale, rawProps.scale, rawProps.scale];
4557
+ }
4558
+ if (rawProps.geometry && !props.hsType) {
4559
+ props.hsType = rawProps.geometry;
4560
+ props.args = this.getGeometryArgs(rawProps.geometry, { size: rawProps.size || 1 });
4561
+ }
4562
+ if (rawProps.material && typeof rawProps.material === "string" && MATERIAL_PRESETS[rawProps.material]) {
4563
+ props.materialProps = {
4564
+ ...MATERIAL_PRESETS[rawProps.material],
4565
+ ...props.materialProps
4566
+ };
4567
+ }
4568
+ if (node.directives) {
4569
+ for (const d of node.directives) {
4570
+ if (d.type === "trait") {
4571
+ if (d.name === "grabbable") {
4572
+ props.castShadow = true;
4573
+ props.grabbable = d.config || true;
4574
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
4575
+ if (!props.collider) props.collider = { type: "auto" };
4576
+ } else if (d.name === "animated") {
4577
+ props.animated = d.config || true;
4578
+ } else if (d.name === "spatial_audio" || d.name === "voice") {
4579
+ props.spatial = true;
4580
+ } else if (d.name === "gem_resonance") {
4581
+ props.gemResonance = gemResonanceConfig(
4582
+ d.config
4583
+ );
4584
+ props.spatial = true;
4585
+ } else if (d.name === "networked") {
4586
+ props.networked = d.config || true;
4587
+ } else if (d.name === "moldable") {
4588
+ props.moldable = d.config || true;
4589
+ } else if (d.name === "stretchable") {
4590
+ props.stretchable = d.config || true;
4591
+ } else if (d.name === "ai_driven") {
4592
+ props.ai_driven = d.config || true;
4593
+ } else if (d.name === "dialogue") {
4594
+ props.dialogue = d.config || true;
4595
+ } else if (d.name === "gesture") {
4596
+ props.gesture = d.config || true;
4597
+ } else if (d.name === "haptic") {
4598
+ props.haptic = d.config || true;
4599
+ } else if (d.name === "avatar_embodiment") {
4600
+ props.avatarEmbodiment = d.config || true;
4601
+ } else if (d.name === "lip_sync") {
4602
+ props.lipSync = d.config || true;
4603
+ } else if (d.name === "emotion_directive") {
4604
+ props.emotionDirective = d.config || true;
4605
+ } else if (d.name === "stt") {
4606
+ props.stt = d.config || true;
4607
+ } else if (d.name === "tts") {
4608
+ props.tts = d.config || true;
4609
+ } else if (d.name === "generate") {
4610
+ props.generate = d.config;
4611
+ } else if (d.name === "skeleton") {
4612
+ props.skeleton = d.config || true;
4613
+ } else if (d.name === "body") {
4614
+ props.body = d.config || true;
4615
+ } else if (d.name === "gaussian_splat") {
4616
+ props.gaussianSplat = d.config || true;
4617
+ } else if (d.name === "nerf") {
4618
+ props.nerf = d.config || true;
4619
+ } else if (d.name === "volumetric_video") {
4620
+ props.volumetricVideo = d.config || true;
4621
+ } else if (d.name === "web_surface") {
4622
+ props.webSurface = d.config || true;
4623
+ }
4624
+ }
4625
+ }
4626
+ }
4627
+ const perceptualDirective = node.directives?.find(
4628
+ (directive) => directive.type === "trait" && directive.name === "perceptual_color"
4629
+ );
4630
+ const perceptualDirectiveConfig = perceptualDirective ? perceptualDirective.config && typeof perceptualDirective.config === "object" ? perceptualDirective.config : {} : void 0;
4631
+ this.applyPerceptualColorProps(
4632
+ props,
4633
+ perceptualDirectiveConfig,
4634
+ this.isScientificColorNode(node.type, props)
4635
+ );
4636
+ delete props.type;
4637
+ delete props.geometry;
4638
+ return props;
4639
+ }
4640
+ applyGraphicsConfig(r3fNode, graphics) {
4641
+ if (graphics.material) {
4642
+ const m = graphics.material;
4643
+ const materialProps = {};
4644
+ if (m.preset && MATERIAL_PRESETS[m.preset]) {
4645
+ Object.assign(materialProps, MATERIAL_PRESETS[m.preset]);
4646
+ }
4647
+ if (m.type === "pbr" && m.pbr) {
4648
+ if (m.pbr.baseColor) materialProps["color"] = this.mapColor(m.pbr.baseColor);
4649
+ if (m.pbr.metallic !== void 0) materialProps["metalness"] = m.pbr.metallic;
4650
+ if (m.pbr.roughness !== void 0) materialProps["roughness"] = m.pbr.roughness;
4651
+ if (m.pbr.emission) materialProps["emissive"] = this.mapColor(m.pbr.emission);
4652
+ if (m.pbr.emissionStrength) materialProps["emissiveIntensity"] = m.pbr.emissionStrength;
4653
+ if (m.pbr.clearcoat !== void 0) materialProps["clearcoat"] = m.pbr.clearcoat;
4654
+ if (m.pbr.transmission !== void 0) materialProps["transmission"] = m.pbr.transmission;
4655
+ if (m.pbr.ior !== void 0) materialProps["ior"] = m.pbr.ior;
4656
+ if (m.pbr.iridescence !== void 0) materialProps["iridescence"] = m.pbr.iridescence;
4657
+ }
4658
+ const prior = r3fNode.props.materialProps ?? {};
4659
+ r3fNode.props.materialProps = { ...prior, ...materialProps };
4660
+ }
4661
+ if (graphics.lighting) {
4662
+ const l = graphics.lighting;
4663
+ if (r3fNode.type.toLowerCase().includes("light")) {
4664
+ if (l.shadows) r3fNode.props.castShadow = true;
4665
+ if (l.intensity !== void 0) r3fNode.props.intensity = l.intensity;
4666
+ if (l.color) r3fNode.props.color = this.mapColor(l.color);
4667
+ }
4668
+ if (r3fNode.type === "Environment" && l.preset) {
4669
+ r3fNode.props.preset = l.preset;
4670
+ }
4671
+ }
4672
+ if (graphics.networked) {
4673
+ r3fNode.props.networked = graphics.networked;
4674
+ }
4675
+ }
4676
+ mapColor(c) {
4677
+ if (typeof c === "string") return c;
4678
+ if (typeof c === "number") return `#${c.toString(16).padStart(6, "0")}`;
4679
+ if (c.r !== void 0) {
4680
+ const r = c.r > 1 ? c.r : Math.floor(c.r * 255);
4681
+ const g = c.g > 1 ? c.g : Math.floor(c.g * 255);
4682
+ const b = c.b > 1 ? c.b : Math.floor(c.b * 255);
4683
+ return `rgb(${r}, ${g}, ${b})`;
4684
+ }
4685
+ return "#ffffff";
4686
+ }
4687
+ getGeometryArgs(type, hologram) {
4688
+ const size = hologram.size || 1;
4689
+ switch (type) {
4690
+ case "sphere":
4691
+ case "orb":
4692
+ return [size * 0.5, 32, 32];
4693
+ case "cube":
4694
+ case "box":
4695
+ return [size, size, size];
4696
+ case "cylinder":
4697
+ return [size * 0.5, size * 0.5, size, 32];
4698
+ case "pyramid":
4699
+ case "cone":
4700
+ return [size * 0.5, 0, size, 4];
4701
+ case "plane":
4702
+ return [size, size];
4703
+ case "torus":
4704
+ return [size * 0.5, size * 0.15, 16, 32];
4705
+ case "ring":
4706
+ return [size * 0.3, size * 0.5, 32];
4707
+ case "capsule":
4708
+ return [size * 0.3, size * 0.5, 4, 16];
4709
+ default:
4710
+ return [size, size, size];
4711
+ }
4712
+ }
4713
+ };
4714
+
4715
+ export { ENVIRONMENT_PRESETS, MATERIAL_PRESETS, QUALITY_TIER_SCALES, SceneIRCompiler, UI_COMPONENT_PRESETS, registerAllPresets };
4716
+ //# sourceMappingURL=chunk-QM7FJB5W.js.map
4717
+ //# sourceMappingURL=chunk-QM7FJB5W.js.map