@cimplify/sdk 0.108.0 → 0.110.2

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 (608) hide show
  1. package/LICENSE +21 -0
  2. package/dist/advanced.d.mts +4 -3
  3. package/dist/advanced.d.ts +4 -3
  4. package/dist/advanced.js +24 -24
  5. package/dist/advanced.mjs +5 -5
  6. package/dist/animation-4EXBXRVX.js +27 -0
  7. package/dist/animation-6DICNWUP.mjs +6 -0
  8. package/dist/audio-DhvyjqdA.d.mts +249 -0
  9. package/dist/audio-m0w8cnxq.d.ts +249 -0
  10. package/dist/avatars.d.mts +110 -0
  11. package/dist/avatars.d.ts +110 -0
  12. package/dist/avatars.js +82 -0
  13. package/dist/avatars.mjs +5 -0
  14. package/dist/backend-gUCzs5Kg.d.mts +3866 -0
  15. package/dist/backend-gUCzs5Kg.d.ts +3866 -0
  16. package/dist/{catalogue-B4eLL8Mi.d.ts → catalogue-CPTMyBUz.d.mts} +109 -221
  17. package/dist/catalogue-DzrTXP3v.d.mts +541 -0
  18. package/dist/catalogue-DzrTXP3v.d.ts +541 -0
  19. package/dist/{catalogue-OT89_Ifs.d.mts → catalogue-OTuS5zp-.d.ts} +109 -221
  20. package/dist/chunk-22BD3RHN.mjs +1809 -0
  21. package/dist/chunk-25T4JHEA.mjs +21 -0
  22. package/dist/chunk-2AQ237Y4.js +508 -0
  23. package/dist/chunk-2IC4H6OV.mjs +48 -0
  24. package/dist/chunk-2LHLG4OB.mjs +71 -0
  25. package/dist/chunk-2O2CG465.js +1709 -0
  26. package/dist/chunk-2Q4DTHXK.js +316 -0
  27. package/dist/chunk-2QTQ6BUH.mjs +46 -0
  28. package/dist/chunk-2UN4SFLR.mjs +100 -0
  29. package/dist/chunk-2V75I7K3.js +454 -0
  30. package/dist/chunk-2V7IL4HC.js +10 -0
  31. package/dist/chunk-34XBXUMW.js +296 -0
  32. package/dist/chunk-3C4C654I.js +71 -0
  33. package/dist/chunk-3DAD2LDF.mjs +72 -0
  34. package/dist/chunk-3GXH2NFD.mjs +4 -0
  35. package/dist/chunk-3O47ZFW3.js +961 -0
  36. package/dist/chunk-3OY3VYNF.mjs +11 -0
  37. package/dist/chunk-3S6WPBZL.js +2936 -0
  38. package/dist/chunk-3TUOUP5T.js +399 -0
  39. package/dist/chunk-3VEH23I5.mjs +1380 -0
  40. package/dist/chunk-3ZYSAW2T.mjs +263 -0
  41. package/dist/chunk-4ANVF274.js +103 -0
  42. package/dist/chunk-4C7I3ELN.js +388 -0
  43. package/dist/chunk-4DYKAYFO.mjs +8 -0
  44. package/dist/chunk-4ZDR72SG.js +329 -0
  45. package/dist/chunk-52YS45RR.js +1066 -0
  46. package/dist/chunk-5325XSCH.js +107 -0
  47. package/dist/chunk-5AD5X6AV.js +13 -0
  48. package/dist/chunk-5BYDGGWO.mjs +197 -0
  49. package/dist/chunk-5C3C7VDM.mjs +55 -0
  50. package/dist/chunk-5HFMY3D7.js +660 -0
  51. package/dist/chunk-5LH2QN3T.js +1862 -0
  52. package/dist/chunk-5PJEXSOW.js +44 -0
  53. package/dist/chunk-5SXDH3Y7.js +90 -0
  54. package/dist/chunk-5YFBGGCK.mjs +502 -0
  55. package/dist/chunk-5YWN6H5Q.mjs +133 -0
  56. package/dist/chunk-66QP3SMN.js +402 -0
  57. package/dist/chunk-6DAEZKIG.mjs +385 -0
  58. package/dist/chunk-6DATW7TB.mjs +420 -0
  59. package/dist/{chunk-JRGK3NXR.mjs → chunk-6ETDAU62.mjs} +72 -212
  60. package/dist/chunk-6H254EVP.mjs +178 -0
  61. package/dist/chunk-6PFNJPBJ.mjs +820 -0
  62. package/dist/chunk-6PJWXIFX.mjs +357 -0
  63. package/dist/chunk-6SWKWCMS.js +80 -0
  64. package/dist/chunk-6VVXXX7S.js +808 -0
  65. package/dist/chunk-6WUBSMTX.js +1403 -0
  66. package/dist/chunk-73SGZLAQ.mjs +35 -0
  67. package/dist/chunk-76L2V6KD.mjs +4 -0
  68. package/dist/chunk-7AAIAVAA.js +1531 -0
  69. package/dist/chunk-7ARSJPV3.mjs +93 -0
  70. package/dist/chunk-7BHW5GTC.mjs +1234 -0
  71. package/dist/chunk-7DQSDKDU.js +6 -0
  72. package/dist/chunk-7IQQQENP.mjs +401 -0
  73. package/dist/chunk-7KFTYENS.js +11357 -0
  74. package/dist/chunk-7SM6XSPZ.js +3171 -0
  75. package/dist/chunk-7SXOHAIR.mjs +28 -0
  76. package/dist/chunk-A2MAX6S4.js +90 -0
  77. package/dist/chunk-A33OORT7.mjs +1530 -0
  78. package/dist/{chunk-U6ACF76H.mjs → chunk-A36JRXXH.mjs} +1075 -1845
  79. package/dist/chunk-A7BU3BK4.js +52 -0
  80. package/dist/chunk-A7MQSN2V.mjs +77 -0
  81. package/dist/chunk-A7V4L2IT.mjs +416 -0
  82. package/dist/chunk-AABEK6XU.js +226 -0
  83. package/dist/chunk-AGV33FWC.mjs +5005 -0
  84. package/dist/chunk-AHNR3BXI.js +108 -0
  85. package/dist/chunk-AQ5RLBU2.mjs +286 -0
  86. package/dist/chunk-AQOE6WCG.js +1270 -0
  87. package/dist/chunk-ATAWRACV.mjs +62 -0
  88. package/dist/chunk-ATCURNUV.js +14 -0
  89. package/dist/chunk-AWPV33OO.js +6 -0
  90. package/dist/chunk-AYJPHKYV.js +337 -0
  91. package/dist/chunk-AZ5BGWHB.js +162 -0
  92. package/dist/chunk-AZAXD44P.js +1373 -0
  93. package/dist/chunk-BBGKQIJJ.mjs +406 -0
  94. package/dist/chunk-BP4JLSUA.js +1453 -0
  95. package/dist/{chunk-SUCE7FWA.mjs → chunk-BTUSVHIE.mjs} +539 -978
  96. package/dist/chunk-BU6OK542.mjs +818 -0
  97. package/dist/chunk-CVSRWM6W.js +418 -0
  98. package/dist/chunk-CYBMFMJD.mjs +247 -0
  99. package/dist/chunk-DDJLDOUX.mjs +217 -0
  100. package/dist/{chunk-V32BCG7M.js → chunk-DFZWHNRG.js} +75 -215
  101. package/dist/chunk-DJ2C7AVG.js +644 -0
  102. package/dist/chunk-DS2VU4WW.mjs +102 -0
  103. package/dist/chunk-DSAG7T5P.js +7290 -0
  104. package/dist/chunk-E2QPPH7I.js +327 -0
  105. package/dist/chunk-E65WCTIG.mjs +1187 -0
  106. package/dist/{chunk-33VCYWVL.mjs → chunk-E6QQKDNE.mjs} +30 -42
  107. package/dist/chunk-ECDK6QBF.mjs +981 -0
  108. package/dist/chunk-EIB4OWVQ.mjs +620 -0
  109. package/dist/chunk-EQUZYCGO.js +250 -0
  110. package/dist/chunk-F3UJ6ZRM.mjs +313 -0
  111. package/dist/chunk-F63N2ZTQ.js +7023 -0
  112. package/dist/chunk-F6XRYEM3.mjs +26 -0
  113. package/dist/chunk-FE6VCE4K.js +5030 -0
  114. package/dist/chunk-FLWD6GRR.js +1372 -0
  115. package/dist/chunk-FQBFWJBS.mjs +110 -0
  116. package/dist/chunk-FXVJ2HFU.js +26 -0
  117. package/dist/chunk-FZMQMQBW.js +312 -0
  118. package/dist/chunk-G3EEC44R.js +53 -0
  119. package/dist/{chunk-KG3WT4PR.mjs → chunk-GCKWKLZF.mjs} +73 -104
  120. package/dist/chunk-GCX7TY4D.mjs +6826 -0
  121. package/dist/chunk-GDB6TCSD.js +450 -0
  122. package/dist/chunk-GDCV4IWO.mjs +21 -0
  123. package/dist/chunk-GDZT5LZ5.js +170 -0
  124. package/dist/chunk-GHPUYD4I.mjs +213 -0
  125. package/dist/chunk-GHS6MIL6.mjs +1432 -0
  126. package/dist/chunk-GPS2THCL.mjs +11 -0
  127. package/dist/{chunk-EV2EVOYS.js → chunk-GTJWQAGU.js} +31 -42
  128. package/dist/chunk-GVTI6UJQ.mjs +130 -0
  129. package/dist/chunk-GXKI64OT.mjs +1138 -0
  130. package/dist/chunk-GYDYF2WX.js +275 -0
  131. package/dist/chunk-GYLP6UG4.mjs +705 -0
  132. package/dist/chunk-H3OQKK6X.js +1158 -0
  133. package/dist/chunk-H5DFSCJ6.js +40 -0
  134. package/dist/chunk-HAGEIC2L.mjs +186 -0
  135. package/dist/chunk-HAJ4JRFO.js +293 -0
  136. package/dist/chunk-HDR72GB6.js +188 -0
  137. package/dist/chunk-HF5HPS4T.mjs +40 -0
  138. package/dist/chunk-HK6LOFDS.js +218 -0
  139. package/dist/chunk-HMWYTXCY.mjs +143 -0
  140. package/dist/chunk-HPCSRCMA.js +89 -0
  141. package/dist/chunk-HSEO6TPU.js +247 -0
  142. package/dist/chunk-I5FOHCLH.js +132 -0
  143. package/dist/chunk-IDLW4NWA.mjs +85 -0
  144. package/dist/chunk-IIDZ5WUX.js +61 -0
  145. package/dist/chunk-IR74FJHU.js +2332 -0
  146. package/dist/chunk-IRVFYAKP.mjs +100 -0
  147. package/dist/{chunk-XBL3TMPC.mjs → chunk-IZDWAL53.mjs} +1795 -3287
  148. package/dist/chunk-J2KZXIU3.js +51 -0
  149. package/dist/chunk-J2U6PJSO.js +91 -0
  150. package/dist/chunk-J5AJNY2N.js +283 -0
  151. package/dist/chunk-J6KQZ4FO.mjs +821 -0
  152. package/dist/{chunk-OWW5GUSB.js → chunk-JGBCIKJV.js} +7 -6
  153. package/dist/chunk-JKGTBMU7.mjs +25 -0
  154. package/dist/chunk-JR3TNEQC.js +422 -0
  155. package/dist/chunk-JURRXY2J.mjs +29 -0
  156. package/dist/chunk-K3HW5I2A.mjs +317 -0
  157. package/dist/chunk-K46SMZ66.mjs +103 -0
  158. package/dist/chunk-K4UDGE3Z.mjs +6 -0
  159. package/dist/chunk-KDQOR4QQ.mjs +350 -0
  160. package/dist/chunk-KDTVOLHI.mjs +288 -0
  161. package/dist/chunk-KGHJH5KJ.mjs +35 -0
  162. package/dist/chunk-KIZOA5LX.mjs +140 -0
  163. package/dist/chunk-KK6HYVBI.mjs +242 -0
  164. package/dist/chunk-KMKWGXMK.js +856 -0
  165. package/dist/chunk-KPA6K5IB.js +80 -0
  166. package/dist/chunk-KU7O4IXU.mjs +260 -0
  167. package/dist/chunk-KVFNRJOR.mjs +11142 -0
  168. package/dist/chunk-KZJRSXHK.js +2432 -0
  169. package/dist/chunk-LHWPRUJL.js +79 -0
  170. package/dist/chunk-LIV3KXJG.mjs +369 -0
  171. package/dist/chunk-LKV4LACG.js +21 -0
  172. package/dist/chunk-LUY45X3U.mjs +263 -0
  173. package/dist/chunk-LYEZZEEF.mjs +17 -0
  174. package/dist/chunk-M5EXQZYY.mjs +1519 -0
  175. package/dist/chunk-ME6HGG4I.mjs +1338 -0
  176. package/dist/chunk-MEXP6DA6.js +31 -0
  177. package/dist/chunk-MG52AW3H.js +902 -0
  178. package/dist/chunk-MIPO6F72.js +334 -0
  179. package/dist/{chunk-5QW7CQBA.js → chunk-MKIJQL5Q.js} +211 -321
  180. package/dist/chunk-MN3YETVN.mjs +17 -0
  181. package/dist/chunk-MOBSBXVE.mjs +2391 -0
  182. package/dist/chunk-MOMOZEUM.mjs +88 -0
  183. package/dist/chunk-MRFUNRAP.js +62 -0
  184. package/dist/chunk-MTIHEW2M.js +433 -0
  185. package/dist/chunk-N4RGGDEL.mjs +73 -0
  186. package/dist/chunk-NH654HAT.js +10 -0
  187. package/dist/chunk-NHJUGZUR.mjs +253 -0
  188. package/dist/chunk-NMQT4HG3.mjs +757 -0
  189. package/dist/chunk-NPSYB6DC.mjs +906 -0
  190. package/dist/chunk-NW2GPMSO.js +857 -0
  191. package/dist/chunk-NXKQOQ6L.js +76 -0
  192. package/dist/chunk-NXLAZIJZ.js +309 -0
  193. package/dist/chunk-NYWNA5CF.js +148 -0
  194. package/dist/chunk-NZTKLY2W.js +1442 -0
  195. package/dist/chunk-O2ICABUD.js +36 -0
  196. package/dist/chunk-OIVVQQ22.js +862 -0
  197. package/dist/chunk-OKC2B4O3.mjs +312 -0
  198. package/dist/chunk-OLWFPDBK.js +2220 -0
  199. package/dist/chunk-OMTVH334.js +3779 -0
  200. package/dist/chunk-OQRVEM56.mjs +362 -0
  201. package/dist/chunk-OXMIBOD4.js +337 -0
  202. package/dist/chunk-PBL6YL5L.mjs +288 -0
  203. package/dist/chunk-PDOELNNQ.js +97 -0
  204. package/dist/chunk-PDQJY2GZ.js +136 -0
  205. package/dist/chunk-PKOZXD2Q.js +1274 -0
  206. package/dist/chunk-PPF2BYFL.mjs +2191 -0
  207. package/dist/chunk-PQTQKNKD.js +539 -0
  208. package/dist/chunk-PRSR4FAV.mjs +81 -0
  209. package/dist/chunk-PTRNO5UD.js +95 -0
  210. package/dist/chunk-Q2Y3VMKH.js +2000 -0
  211. package/dist/chunk-QCZOE65N.js +96 -0
  212. package/dist/chunk-QDYFLATW.mjs +52 -0
  213. package/dist/chunk-QQABGCMM.js +22 -0
  214. package/dist/chunk-QS6TRHMR.js +345 -0
  215. package/dist/chunk-R56P64LB.mjs +208 -0
  216. package/dist/chunk-RCQ2MPBV.js +428 -0
  217. package/dist/chunk-RFVRPYR2.mjs +856 -0
  218. package/dist/chunk-RKBLPGPV.js +11521 -0
  219. package/dist/chunk-RM2V4IND.mjs +327 -0
  220. package/dist/chunk-RQXN5A34.mjs +613 -0
  221. package/dist/chunk-RUVGVNOF.mjs +2687 -0
  222. package/dist/chunk-SAFJIGYB.mjs +165 -0
  223. package/dist/chunk-SKQFLBDD.js +263 -0
  224. package/dist/chunk-SMK6JU2F.mjs +2092 -0
  225. package/dist/{chunk-UVRPC2P7.js → chunk-SNNEOS5Z.js} +1984 -3476
  226. package/dist/chunk-SPCRQ6NO.mjs +1246 -0
  227. package/dist/chunk-SWX4SALA.mjs +19 -0
  228. package/dist/{chunk-JVODCGFP.mjs → chunk-SYEO2WV4.mjs} +128 -238
  229. package/dist/chunk-T2QQMX2N.js +10 -0
  230. package/dist/chunk-T3AFF3L7.mjs +57 -0
  231. package/dist/chunk-T6Z2EXYL.js +712 -0
  232. package/dist/chunk-T7LOXGYX.js +118 -0
  233. package/dist/chunk-TJCAE7RC.mjs +1315 -0
  234. package/dist/chunk-TJI3K6RP.js +137 -0
  235. package/dist/chunk-TL2SVO4P.mjs +55 -0
  236. package/dist/chunk-TM63CYGN.mjs +399 -0
  237. package/dist/chunk-TU5RYTYU.mjs +13 -0
  238. package/dist/chunk-TVJZ4GPS.js +1553 -0
  239. package/dist/chunk-TWM6DLYF.js +371 -0
  240. package/dist/chunk-U63OC4TQ.js +30 -0
  241. package/dist/{chunk-L5GKVQVJ.js → chunk-U6BVSJZ6.js} +25 -57
  242. package/dist/chunk-U6UVWEAK.mjs +792 -0
  243. package/dist/chunk-UCEPNO6N.mjs +11048 -0
  244. package/dist/{chunk-ANT574FD.js → chunk-UCR5HRYM.js} +74 -105
  245. package/dist/chunk-UG5BTOTF.mjs +334 -0
  246. package/dist/chunk-UGH37BQW.mjs +157 -0
  247. package/dist/chunk-V7ZRH3PY.mjs +271 -0
  248. package/dist/chunk-VBGHBL3E.mjs +1394 -0
  249. package/dist/chunk-VRBDAS5I.js +920 -0
  250. package/dist/chunk-VVE3Y76O.js +230 -0
  251. package/dist/chunk-W65JIRI4.mjs +1182 -0
  252. package/dist/chunk-WHYKAT7G.js +62 -0
  253. package/dist/{chunk-YOIVZ6OA.mjs → chunk-WIZRUIZB.mjs} +25 -57
  254. package/dist/chunk-WKWTDZS7.js +385 -0
  255. package/dist/chunk-WLMINRC4.mjs +78 -0
  256. package/dist/chunk-WOF3AD3J.js +22 -0
  257. package/dist/chunk-WWKMOA76.js +1262 -0
  258. package/dist/chunk-X5A5FOWW.js +615 -0
  259. package/dist/chunk-X6CN6KQF.mjs +192 -0
  260. package/dist/chunk-XD2PMH46.mjs +517 -0
  261. package/dist/chunk-XJA2NGTI.mjs +88 -0
  262. package/dist/chunk-XJIHN3BY.mjs +8 -0
  263. package/dist/chunk-XK6UDWJS.js +203 -0
  264. package/dist/chunk-XPG3N5CF.mjs +415 -0
  265. package/dist/chunk-XVZ2NKSU.mjs +74 -0
  266. package/dist/chunk-XYP45OLE.js +117 -0
  267. package/dist/chunk-XZSDGZX6.mjs +301 -0
  268. package/dist/chunk-Y2EMGN4T.mjs +120 -0
  269. package/dist/chunk-Y3XWP5XW.mjs +298 -0
  270. package/dist/chunk-Y4K22JL6.js +228 -0
  271. package/dist/chunk-Y65LXQGA.mjs +3164 -0
  272. package/dist/chunk-Y66WVMO5.mjs +87 -0
  273. package/dist/chunk-Y7JWLB25.mjs +7280 -0
  274. package/dist/chunk-YCDXAJKU.js +175 -0
  275. package/dist/chunk-YRDQCCIS.js +152 -0
  276. package/dist/chunk-YV52DGSA.js +111 -0
  277. package/dist/chunk-YXGZQPUD.js +94 -0
  278. package/dist/chunk-Z3A3AFVU.mjs +102 -0
  279. package/dist/chunk-ZCY6YKKP.mjs +475 -0
  280. package/dist/chunk-ZEQHXVU5.js +215 -0
  281. package/dist/chunk-ZF7JCXCI.js +284 -0
  282. package/dist/chunk-ZJBRUH6V.js +29 -0
  283. package/dist/chunk-ZMIL4ZOA.js +365 -0
  284. package/dist/chunk-ZR5ULMN2.mjs +337 -0
  285. package/dist/chunk-ZXREOYOW.js +87 -0
  286. package/dist/{client-BSP9U1O1.d.mts → client-CX_WR0-J.d.mts} +2 -2
  287. package/dist/client-Dytx_ZTC.d.ts +230 -0
  288. package/dist/{client-B878xeAP.d.ts → client-dqOhP9Nc.d.ts} +2 -2
  289. package/dist/client-hTKbCuhG.d.mts +230 -0
  290. package/dist/clock-B-UAjkKa.d.mts +5 -0
  291. package/dist/clock-B-UAjkKa.d.ts +5 -0
  292. package/dist/config-BlXQluJR.d.mts +36 -0
  293. package/dist/config-BlXQluJR.d.ts +36 -0
  294. package/dist/courier-Cnn-edJ4.d.ts +95 -0
  295. package/dist/courier-FmGfkvIN.d.mts +95 -0
  296. package/dist/crowd-DdHFbqKK.d.ts +186 -0
  297. package/dist/crowd-hOVSAmA3.d.mts +186 -0
  298. package/dist/danfo-BEBapFlX.d.mts +146 -0
  299. package/dist/danfo-UQ_PTIIx.d.ts +146 -0
  300. package/dist/{elements-Bty6Qs_N.d.mts → elements-DdsRig-2.d.mts} +1548 -257
  301. package/dist/{elements-Bty6Qs_N.d.ts → elements-DdsRig-2.d.ts} +1548 -257
  302. package/dist/engines/godot.d.mts +56 -0
  303. package/dist/engines/godot.d.ts +56 -0
  304. package/dist/engines/godot.js +28 -0
  305. package/dist/engines/godot.mjs +3 -0
  306. package/dist/engines/wasm.d.mts +11 -0
  307. package/dist/engines/wasm.d.ts +11 -0
  308. package/dist/engines/wasm.js +178 -0
  309. package/dist/engines/wasm.mjs +176 -0
  310. package/dist/fallback-CrG_lTFk.d.mts +270 -0
  311. package/dist/fallback-CrG_lTFk.d.ts +270 -0
  312. package/dist/fallback-KDB4Y2CE.mjs +6 -0
  313. package/dist/fallback-Y26TQENE.js +19 -0
  314. package/dist/features-CZB4rmcD.d.mts +118 -0
  315. package/dist/features-CZB4rmcD.d.ts +118 -0
  316. package/dist/fit-BWiE7rgA.d.mts +44 -0
  317. package/dist/fit-DK0oT7zO.d.ts +44 -0
  318. package/dist/five-a-side-Bv1AOUy3.d.mts +115 -0
  319. package/dist/five-a-side-EC51SJY1.d.ts +115 -0
  320. package/dist/fluid-ARr0qUIL.d.ts +939 -0
  321. package/dist/fluid-DLlEj2cs.d.mts +939 -0
  322. package/dist/game/conformance.d.mts +84 -0
  323. package/dist/game/conformance.d.ts +84 -0
  324. package/dist/game/conformance.js +1025 -0
  325. package/dist/game/conformance.mjs +994 -0
  326. package/dist/game/heap.d.mts +40 -0
  327. package/dist/game/heap.d.ts +40 -0
  328. package/dist/game/heap.js +48 -0
  329. package/dist/game/heap.mjs +7 -0
  330. package/dist/game/kit/canvas.d.mts +240 -0
  331. package/dist/game/kit/canvas.d.ts +240 -0
  332. package/dist/game/kit/canvas.js +3566 -0
  333. package/dist/game/kit/canvas.mjs +1039 -0
  334. package/dist/game/kit/courier.d.mts +17 -0
  335. package/dist/game/kit/courier.d.ts +17 -0
  336. package/dist/game/kit/courier.js +66 -0
  337. package/dist/game/kit/courier.mjs +49 -0
  338. package/dist/game/kit/danfo.d.mts +11 -0
  339. package/dist/game/kit/danfo.d.ts +11 -0
  340. package/dist/game/kit/danfo.js +109 -0
  341. package/dist/game/kit/danfo.mjs +44 -0
  342. package/dist/game/kit/engine.d.mts +29 -0
  343. package/dist/game/kit/engine.d.ts +29 -0
  344. package/dist/game/kit/engine.js +183 -0
  345. package/dist/game/kit/engine.mjs +30 -0
  346. package/dist/game/kit/five-a-side.d.mts +11 -0
  347. package/dist/game/kit/five-a-side.d.ts +11 -0
  348. package/dist/game/kit/five-a-side.js +86 -0
  349. package/dist/game/kit/five-a-side.mjs +41 -0
  350. package/dist/game/kit/frontier.d.mts +344 -0
  351. package/dist/game/kit/frontier.d.ts +344 -0
  352. package/dist/game/kit/frontier.js +435 -0
  353. package/dist/game/kit/frontier.mjs +14 -0
  354. package/dist/game/kit/genesis.d.mts +752 -0
  355. package/dist/game/kit/genesis.d.ts +752 -0
  356. package/dist/game/kit/genesis.js +380 -0
  357. package/dist/game/kit/genesis.mjs +15 -0
  358. package/dist/game/kit/ludo.d.mts +15 -0
  359. package/dist/game/kit/ludo.d.ts +15 -0
  360. package/dist/game/kit/ludo.js +87 -0
  361. package/dist/game/kit/ludo.mjs +42 -0
  362. package/dist/game/kit/runner.d.mts +12 -0
  363. package/dist/game/kit/runner.d.ts +12 -0
  364. package/dist/game/kit/runner.js +83 -0
  365. package/dist/game/kit/runner.mjs +46 -0
  366. package/dist/game/kit/shootout.d.mts +13 -0
  367. package/dist/game/kit/shootout.d.ts +13 -0
  368. package/dist/game/kit/shootout.js +122 -0
  369. package/dist/game/kit/shootout.mjs +57 -0
  370. package/dist/game/kit/slots.d.mts +392 -0
  371. package/dist/game/kit/slots.d.ts +392 -0
  372. package/dist/game/kit/slots.js +215 -0
  373. package/dist/game/kit/slots.mjs +6 -0
  374. package/dist/game/kit/tycoon.d.mts +16 -0
  375. package/dist/game/kit/tycoon.d.ts +16 -0
  376. package/dist/game/kit/tycoon.js +145 -0
  377. package/dist/game/kit/tycoon.mjs +44 -0
  378. package/dist/game/kit/word.d.mts +11 -0
  379. package/dist/game/kit/word.d.ts +11 -0
  380. package/dist/game/kit/word.js +78 -0
  381. package/dist/game/kit/word.mjs +41 -0
  382. package/dist/game/kit/worlds.d.mts +18 -0
  383. package/dist/game/kit/worlds.d.ts +18 -0
  384. package/dist/game/kit/worlds.js +74 -0
  385. package/dist/game/kit/worlds.mjs +49 -0
  386. package/dist/game/kit.d.mts +53 -0
  387. package/dist/game/kit.d.ts +53 -0
  388. package/dist/game/kit.js +2610 -0
  389. package/dist/game/kit.mjs +101 -0
  390. package/dist/game/prepared.d.mts +14 -0
  391. package/dist/game/prepared.d.ts +14 -0
  392. package/dist/game/prepared.js +81 -0
  393. package/dist/game/prepared.mjs +32 -0
  394. package/dist/game-Bx8onkhX.d.mts +1451 -0
  395. package/dist/game-fgQy2YIm.d.ts +1451 -0
  396. package/dist/game-theme-CBTw1b_d.d.mts +35 -0
  397. package/dist/game-theme-Dg-ict5A.d.ts +35 -0
  398. package/dist/game.d.mts +3546 -0
  399. package/dist/game.d.ts +3546 -0
  400. package/dist/game.js +4455 -0
  401. package/dist/game.mjs +50 -0
  402. package/dist/graphics-C6YjWYvP.d.ts +5 -0
  403. package/dist/graphics-Dk2yQnYN.d.mts +5 -0
  404. package/dist/guest-DrsA00XD.d.mts +732 -0
  405. package/dist/guest-wIdfoT05.d.ts +732 -0
  406. package/dist/hit-stop-BKkVwTq7.d.mts +43 -0
  407. package/dist/hit-stop-D-8pPYnM.d.ts +43 -0
  408. package/dist/hot-Crn9XpHJ.d.ts +29 -0
  409. package/dist/hot-DH3nOhQD.d.mts +29 -0
  410. package/dist/{index-CQStGb3B.d.mts → index-6gkHMGAq.d.mts} +2 -2
  411. package/dist/index-B8ybCKJI.d.ts +41 -0
  412. package/dist/{index-DJwXmoaP.d.ts → index-B98Xac8e.d.ts} +2 -2
  413. package/dist/{index-B7oA_1XI.d.ts → index-B_ByTtIT.d.ts} +2 -2
  414. package/dist/index-DHjNHb1c.d.mts +41 -0
  415. package/dist/{index-DhUSTAhT.d.mts → index-DbAN_VQE.d.mts} +2 -2
  416. package/dist/index.d.mts +134 -24
  417. package/dist/index.d.ts +134 -24
  418. package/dist/index.js +407 -248
  419. package/dist/index.mjs +184 -58
  420. package/dist/interactives-authoring.d.mts +231 -0
  421. package/dist/interactives-authoring.d.ts +231 -0
  422. package/dist/interactives-authoring.js +1743 -0
  423. package/dist/interactives-authoring.mjs +1704 -0
  424. package/dist/interactives-canvas.global.js +148 -0
  425. package/dist/interactives-guest.d.mts +20 -0
  426. package/dist/interactives-guest.d.ts +20 -0
  427. package/dist/interactives-guest.js +63 -0
  428. package/dist/interactives-guest.json +1 -0
  429. package/dist/interactives-guest.mjs +61 -0
  430. package/dist/interactives-jsc.global.js +9357 -0
  431. package/dist/interactives-meters.d.mts +93 -0
  432. package/dist/interactives-meters.d.ts +93 -0
  433. package/dist/interactives-meters.js +252 -0
  434. package/dist/interactives-meters.mjs +68 -0
  435. package/dist/interactives-production.d.mts +430 -0
  436. package/dist/interactives-production.d.ts +430 -0
  437. package/dist/interactives-production.js +1231 -0
  438. package/dist/interactives-production.mjs +1170 -0
  439. package/dist/interactives-record.d.mts +112 -0
  440. package/dist/interactives-record.d.ts +112 -0
  441. package/dist/interactives-record.js +302 -0
  442. package/dist/interactives-record.mjs +295 -0
  443. package/dist/interactives-runtime.d.mts +61 -0
  444. package/dist/interactives-runtime.d.ts +61 -0
  445. package/dist/interactives-runtime.js +442 -0
  446. package/dist/interactives-runtime.mjs +25 -0
  447. package/dist/interactives-studio-kernel.global.js +1 -0
  448. package/dist/interactives-studio.d.mts +806 -0
  449. package/dist/interactives-studio.d.ts +806 -0
  450. package/dist/interactives-studio.js +5741 -0
  451. package/dist/interactives-studio.mjs +5651 -0
  452. package/dist/interactives-tick.d.mts +90 -0
  453. package/dist/interactives-tick.d.ts +90 -0
  454. package/dist/interactives-tick.js +203 -0
  455. package/dist/interactives-tick.mjs +6 -0
  456. package/dist/interactives-web.d.mts +762 -0
  457. package/dist/interactives-web.d.ts +762 -0
  458. package/dist/interactives-web.js +5000 -0
  459. package/dist/interactives-web.mjs +4628 -0
  460. package/dist/interactives.d.mts +2430 -0
  461. package/dist/interactives.d.ts +2430 -0
  462. package/dist/interactives.js +5723 -0
  463. package/dist/interactives.mjs +4333 -0
  464. package/dist/juice-CoHxlpKA.d.ts +42 -0
  465. package/dist/juice-DQztFS43.d.mts +42 -0
  466. package/dist/launch-T2f4_Di4.d.mts +151 -0
  467. package/dist/launch-d6oreMzR.d.ts +151 -0
  468. package/dist/library-DXYaMFhi.d.mts +69 -0
  469. package/dist/library-DXYaMFhi.d.ts +69 -0
  470. package/dist/link-BUTqGmyi.d.mts +38 -0
  471. package/dist/link-BUTqGmyi.d.ts +38 -0
  472. package/dist/lint.js +104 -204
  473. package/dist/lint.mjs +103 -203
  474. package/dist/local-D8_I6UeL.d.mts +6967 -0
  475. package/dist/local-VZkqsCzR.d.ts +6967 -0
  476. package/dist/lockstep-BLf6dglI.d.mts +321 -0
  477. package/dist/lockstep-D50Ia0JW.d.ts +321 -0
  478. package/dist/ludo-B8ClkDqr.d.ts +205 -0
  479. package/dist/ludo-BOuohQ-M.d.mts +205 -0
  480. package/dist/mock/cli.mjs +200 -56
  481. package/dist/mock/library.js +200 -56
  482. package/dist/mock/library.mjs +200 -56
  483. package/dist/mock/msw.js +200 -56
  484. package/dist/mock/msw.mjs +200 -56
  485. package/dist/native-BodxSh03.d.mts +16 -0
  486. package/dist/native-DUHMT8gA.d.ts +16 -0
  487. package/dist/network-ZXLD7l1b.d.mts +19 -0
  488. package/dist/network-ZXLD7l1b.d.ts +19 -0
  489. package/dist/online-XeymeM9s.d.ts +381 -0
  490. package/dist/online-d7W_Al9a.d.mts +381 -0
  491. package/dist/params-DxFb5G_U.d.mts +155 -0
  492. package/dist/params-DxFb5G_U.d.ts +155 -0
  493. package/dist/play-BRRlfLhX.d.ts +940 -0
  494. package/dist/play-ClrMd_e8.d.mts +940 -0
  495. package/dist/policy-CCw8tXLm.d.mts +3078 -0
  496. package/dist/policy-CMqOSQIu.d.ts +3078 -0
  497. package/dist/ports-B_0v_P3A.d.mts +13 -0
  498. package/dist/ports-CGU_3e_0.d.ts +13 -0
  499. package/dist/prefetch-BHnicOQj.d.ts +117 -0
  500. package/dist/prefetch-CBXgYacv.d.mts +117 -0
  501. package/dist/{price-CSztR02F.d.mts → price-BOzexBww.d.mts} +1 -1
  502. package/dist/{price-C_vasx9A.d.ts → price-C1h9sPxE.d.ts} +1 -1
  503. package/dist/protocol-C8qbpUbT.d.mts +242 -0
  504. package/dist/protocol-C8qbpUbT.d.ts +242 -0
  505. package/dist/rapier-AZHT4YI7.js +7886 -0
  506. package/dist/rapier-ODEPCQA6.mjs +7792 -0
  507. package/dist/react.d.mts +157 -15
  508. package/dist/react.d.ts +157 -15
  509. package/dist/react.js +5564 -5904
  510. package/dist/react.mjs +5451 -5808
  511. package/dist/runner-CQcLL7By.d.ts +189 -0
  512. package/dist/runner-D46Yj-wE.d.mts +189 -0
  513. package/dist/runtime-BRWfkf_q.d.mts +51 -0
  514. package/dist/runtime-DyuBMkKM.d.ts +51 -0
  515. package/dist/scheduling-D2ajXpMC.d.ts +224 -0
  516. package/dist/scheduling-DSRbbaZb.d.mts +224 -0
  517. package/dist/schema-BrWxzKp6.d.mts +63 -0
  518. package/dist/schema-BrWxzKp6.d.ts +63 -0
  519. package/dist/server/evict.js +34 -37
  520. package/dist/server/evict.mjs +34 -37
  521. package/dist/server/tanstack.d.mts +49 -3
  522. package/dist/server/tanstack.d.ts +49 -3
  523. package/dist/server/tanstack.js +169 -117
  524. package/dist/server/tanstack.mjs +166 -118
  525. package/dist/{server-Dckg4Vdr.d.ts → server-D29IIuDV.d.ts} +136 -130
  526. package/dist/{server-B6dW7-Lj.d.mts → server-DQMWPnc8.d.mts} +136 -130
  527. package/dist/server.d.mts +45 -5
  528. package/dist/server.d.ts +45 -5
  529. package/dist/server.js +171 -227
  530. package/dist/server.mjs +165 -225
  531. package/dist/session-grant-CJ27DwrT.d.mts +19 -0
  532. package/dist/session-grant-CJ27DwrT.d.ts +19 -0
  533. package/dist/shootout-BJZeX6FG.d.ts +140 -0
  534. package/dist/shootout-tcZd1Rxt.d.mts +140 -0
  535. package/dist/state-replica-stMtdkVD.d.mts +42 -0
  536. package/dist/state-replica-stMtdkVD.d.ts +42 -0
  537. package/dist/studio-CowqWqez.d.mts +14 -0
  538. package/dist/studio-CowqWqez.d.ts +14 -0
  539. package/dist/styles.css +1 -1
  540. package/dist/template-AhCdB1kW.d.mts +190 -0
  541. package/dist/template-BkEGVTQj.d.ts +190 -0
  542. package/dist/terrain-BMxEc6Oc.d.ts +429 -0
  543. package/dist/terrain-C-XC1Oui.d.mts +429 -0
  544. package/dist/testing/msw.d.mts +28 -4
  545. package/dist/testing/msw.d.ts +28 -4
  546. package/dist/testing/msw.js +15 -21
  547. package/dist/testing/msw.mjs +15 -21
  548. package/dist/testing/suite.d.mts +6 -5
  549. package/dist/testing/suite.d.ts +6 -5
  550. package/dist/testing/suite.js +89 -124
  551. package/dist/testing/suite.mjs +81 -116
  552. package/dist/testing.d.mts +27 -1227
  553. package/dist/testing.d.ts +27 -1227
  554. package/dist/testing.js +127 -131
  555. package/dist/testing.mjs +19 -23
  556. package/dist/tick-transport-C8QEh8Uw.d.mts +50 -0
  557. package/dist/tick-transport-UjHY3xK1.d.ts +50 -0
  558. package/dist/timeline-protocol-hp6e8zFB.d.mts +47 -0
  559. package/dist/timeline-protocol-hp6e8zFB.d.ts +47 -0
  560. package/dist/tokens-DhanQRQS.d.mts +21 -0
  561. package/dist/tokens-K8yxwd6G.d.ts +21 -0
  562. package/dist/tree-C-Io2Hbx.d.mts +35 -0
  563. package/dist/tree-CP_qSW4H.d.ts +35 -0
  564. package/dist/tycoon-B5KHk2Xx.d.mts +255 -0
  565. package/dist/tycoon-hmHo-3HX.d.ts +255 -0
  566. package/dist/types-BQkxPwZP.d.mts +219 -0
  567. package/dist/types-D_f6UUxM.d.ts +219 -0
  568. package/dist/ui-DwHicuFv.d.mts +563 -0
  569. package/dist/ui-hi7S2YcH.d.ts +563 -0
  570. package/dist/{sign-in-DQlIdqsi.d.mts → url-52ndUruG.d.mts} +15 -1
  571. package/dist/{sign-in-DQlIdqsi.d.ts → url-52ndUruG.d.ts} +15 -1
  572. package/dist/utils.d.mts +3 -3
  573. package/dist/utils.d.ts +3 -3
  574. package/dist/utils.js +37 -37
  575. package/dist/utils.mjs +4 -4
  576. package/dist/vars-Dc_PrhBK.d.mts +511 -0
  577. package/dist/vars-Dc_PrhBK.d.ts +511 -0
  578. package/dist/vm-IUARFFAI.mjs +63 -0
  579. package/dist/vm-N7L6MGGH.js +65 -0
  580. package/dist/weave-delivery-CW-Kstut.d.mts +360 -0
  581. package/dist/weave-delivery-CW-Kstut.d.ts +360 -0
  582. package/dist/web-Dss74a7v.d.ts +883 -0
  583. package/dist/web-f9ZQPoyw.d.mts +883 -0
  584. package/dist/web-transport-C7MkBL0a.d.ts +19 -0
  585. package/dist/web-transport-aYEqXMd9.d.mts +19 -0
  586. package/dist/weight-CPGjsgjV.d.ts +92 -0
  587. package/dist/weight-tF1ODR1p.d.mts +92 -0
  588. package/dist/word-BcX9Jcmv.d.mts +70 -0
  589. package/dist/word-C7sVPLHm.d.ts +70 -0
  590. package/dist/world-PvILHDR1.d.ts +2285 -0
  591. package/dist/world-qekkXjJv.d.mts +2285 -0
  592. package/dist/worlds-Br2Pb0Cs.d.ts +109 -0
  593. package/dist/worlds-D5ydYr7d.d.mts +109 -0
  594. package/engines/c/cimplify.h +108 -0
  595. package/engines/c/cimplify.lib.js +11 -0
  596. package/engines/godot/addons/cimplify/cimplify.gd +97 -0
  597. package/engines/rust/interactives-ctx/Cargo.toml +9 -0
  598. package/engines/rust/interactives-ctx/src/lib.rs +189 -0
  599. package/package.json +189 -3
  600. package/vendor/rapier3d-compat/LICENSE +201 -0
  601. package/vendor/rapier3d-compat/PATCHES.md +61 -0
  602. package/dist/chunk-2P4KXFB6.js +0 -274
  603. package/dist/chunk-3G6RQLXK.mjs +0 -21
  604. package/dist/chunk-3V4DVXV3.mjs +0 -254
  605. package/dist/chunk-EDK3LNM6.js +0 -2436
  606. package/dist/chunk-F7J3HK27.js +0 -4549
  607. package/dist/chunk-U4MW6PYU.mjs +0 -23
  608. package/dist/chunk-XREIZ56K.js +0 -26
@@ -0,0 +1,1373 @@
1
+ 'use strict';
2
+
3
+ var chunkVVE3Y76O_js = require('./chunk-VVE3Y76O.js');
4
+ var chunkU63OC4TQ_js = require('./chunk-U63OC4TQ.js');
5
+ var chunk3C4C654I_js = require('./chunk-3C4C654I.js');
6
+ var chunkMRFUNRAP_js = require('./chunk-MRFUNRAP.js');
7
+ var chunkIIDZ5WUX_js = require('./chunk-IIDZ5WUX.js');
8
+ var chunkYXGZQPUD_js = require('./chunk-YXGZQPUD.js');
9
+ var chunk7AAIAVAA_js = require('./chunk-7AAIAVAA.js');
10
+ require('./chunk-T2QQMX2N.js');
11
+ var chunkT7LOXGYX_js = require('./chunk-T7LOXGYX.js');
12
+ var chunk2V7IL4HC_js = require('./chunk-2V7IL4HC.js');
13
+
14
+ // src/game/ecs/component.ts
15
+ var SIZE = 0, VERSION = 1, STORE_COUNTERS = 2, nextComponentId = 0, definedByName = /* @__PURE__ */ new Map();
16
+ function sameSchema(a, b) {
17
+ let keys = Object.keys(a);
18
+ if (keys.length !== Object.keys(b).length) return false;
19
+ for (let key of keys) {
20
+ let x = a[key], y = b[key];
21
+ if (typeof x == "string" || typeof y == "string") {
22
+ if (x !== y) return false;
23
+ } else if (y === void 0 || x[0] !== y[0] || x[1] !== y[1]) return false;
24
+ }
25
+ return true;
26
+ }
27
+ function defineComponent(name, schema) {
28
+ let existing = definedByName.get(name);
29
+ if (existing !== void 0 && chunkT7LOXGYX_js.reusingDefinitions() && sameSchema(existing.schema, schema)) return existing;
30
+ let type = { id: nextComponentId++, name, schema };
31
+ return definedByName.set(name, type), type;
32
+ }
33
+ function fieldArity(spec) {
34
+ return typeof spec == "string" ? 1 : spec[1];
35
+ }
36
+ function fieldScalar(spec) {
37
+ return typeof spec == "string" ? spec : spec[0];
38
+ }
39
+ var ComponentStore = class {
40
+ constructor(type, capacity, entityCapacity, memory = chunkU63OC4TQ_js.HEAP_MEMORY) {
41
+ this.counters = new Uint32Array((2));
42
+ this.type = type, this.capacity = capacity, this.entities = memory.allocate("u32", capacity), this.sparse = memory.allocate("i32", entityCapacity).fill(-1);
43
+ let keys = Object.keys(type.schema);
44
+ this.arrays = [], this.arities = new Int32Array(keys.length);
45
+ let fields = {};
46
+ for (let i = 0; i < keys.length; i++) {
47
+ let spec = type.schema[keys[i]], arity = fieldArity(spec), array = memory.allocate(fieldScalar(spec), capacity * arity);
48
+ this.arrays.push(array), this.arities[i] = arity, fields[keys[i]] = array;
49
+ }
50
+ this.fields = fields, this.views = [this.counters, this.entities, this.sparse, ...this.arrays];
51
+ }
52
+ get count() {
53
+ return this.counters[(0)];
54
+ }
55
+ get version() {
56
+ return this.counters[(1)];
57
+ }
58
+ rollbackViews() {
59
+ return this.views;
60
+ }
61
+ row(entity) {
62
+ let index = chunkMRFUNRAP_js.entityIndex(entity);
63
+ if (index >= this.sparse.length) return -1;
64
+ let row = this.sparse[index];
65
+ return row !== -1 && this.entities[row] === entity ? row : -1;
66
+ }
67
+ has(entity) {
68
+ return this.row(entity) !== -1;
69
+ }
70
+ require(entity) {
71
+ let row = this.row(entity);
72
+ if (row === -1)
73
+ throw new chunk2V7IL4HC_js.GameError("missing_component", `entity ${entity} has no ${this.type.name}`);
74
+ return row;
75
+ }
76
+ add(entity) {
77
+ let existing = this.row(entity);
78
+ if (existing !== -1) return existing;
79
+ let c = this.counters;
80
+ if (c[(0)] >= this.capacity)
81
+ throw new chunk2V7IL4HC_js.GameError(
82
+ "capacity_exceeded",
83
+ `component ${this.type.name} capacity ${this.capacity} reached`
84
+ );
85
+ let row = c[(0)]++;
86
+ this.entities[row] = entity, this.sparse[chunkMRFUNRAP_js.entityIndex(entity)] = row;
87
+ for (let i = 0; i < this.arrays.length; i++) {
88
+ let arity = this.arities[i];
89
+ this.arrays[i].fill(0, row * arity, row * arity + arity);
90
+ }
91
+ return c[(1)]++, row;
92
+ }
93
+ remove(entity) {
94
+ let row = this.row(entity);
95
+ if (row === -1) return false;
96
+ let c = this.counters, last = --c[(0)];
97
+ if (row !== last) {
98
+ let moved = this.entities[last];
99
+ this.entities[row] = moved, this.sparse[chunkMRFUNRAP_js.entityIndex(moved)] = row;
100
+ for (let i = 0; i < this.arrays.length; i++) {
101
+ let arity = this.arities[i];
102
+ this.arrays[i].copyWithin(row * arity, last * arity, last * arity + arity);
103
+ }
104
+ }
105
+ return this.sparse[chunkMRFUNRAP_js.entityIndex(entity)] = -1, c[(1)]++, true;
106
+ }
107
+ entityAt(row) {
108
+ return this.entities[row];
109
+ }
110
+ };
111
+
112
+ // src/game/scenery/scenery.ts
113
+ var DEFAULT_MOTION_OFFSET = ["dx", "dy", "dz"], DEFAULT_MOTION_REST = ["rx", "ry", "rz"], MILLIMETRES_PER_METRE = 1e3, NO_RIG = 0, SCENERY_MANIFEST_MAGIC = 1297109827, SCENERY_MANIFEST_VERSION = 1, SCENERY_MANIFEST_VERSION_PARTS = 2, SCENERY_PART_WHOLE = 255, SCENERY_PART_COARSE = 0, SCENERY_PART_MIDDLE = 1, SCENERY_PART_FINE = 2, PART_FIELD = 20, PART_MASK = 255, GROUP_SHIFT = 8, SCENERY_LEVEL_STEP = 3, SCENERY_CHUNK_EXTENSION = ".cspl", HEADER_BYTES = 32, ENTRY_BYTES = 80, DIGEST_OFFSET = 48, DIGEST_BYTES = 32, VERSION_FIELD = 4, COUNT_FIELD = 8, CELL_SIZE_FIELD = 12, ORIGIN_X_FIELD = 16, ORIGIN_Z_FIELD = 20, COLS_FIELD = 24, ROWS_FIELD = 28, KIB = 1024, HEX_RADIX = 16, BYTE_VALUES = 256, ABSOLUTE = /^[a-z][a-z0-9+.-]*:/i, HEX = Array.from({ length: (256) }, (_, i) => i.toString((16)).padStart(2, "0")), CLOSED_REGISTERS = new Uint32Array(20);
114
+ function sceneryPartDrawLevel(part) {
115
+ return part === (1) ? 1 : part === (2) ? 0 : 2;
116
+ }
117
+ function sceneryPartReach(part, radii) {
118
+ let level = sceneryPartDrawLevel(part);
119
+ return level === 0 ? radii.near : level === 1 ? radii.near * (3) : radii.far;
120
+ }
121
+ function sceneryEntryRows(manifest, count) {
122
+ let rows = Array.from({ length: count }, (_, i) => i), groups = manifest.groups, parts = manifest.parts;
123
+ return groups !== void 0 && parts !== void 0 && rows.sort((a, b) => groups[a] - groups[b] || parts[a] - parts[b] || a - b), Int32Array.from(rows);
124
+ }
125
+ var ENTRY_BYTES_FIELD = 16, ENTRY_MIN_FIELD = 24, BOUND_FLOATS = 6, SCENERY_LOAD_SHARE = 1.1, SCENERY_UNLOAD_SHARE = 1.35, SCENERY_NEED_SHARE = 3, SCENERY_TIER_RADII = [
126
+ { near: 40, far: 600 },
127
+ { near: 25, far: 350 },
128
+ { near: 14, far: 180 }
129
+ ];
130
+ function sceneryTierRadii(tier) {
131
+ return SCENERY_TIER_RADII[Math.min(SCENERY_TIER_RADII.length - 1, Math.max(0, tier))];
132
+ }
133
+ function sceneryPrefetchItems(manifest, paths, radii = SCENERY_TIER_RADII[0]) {
134
+ let items = [], b = manifest.bounds, rows = sceneryEntryRows(manifest, paths.length), start = 0;
135
+ for (; start < rows.length; ) {
136
+ let group = manifest.groups?.[rows[start]] ?? rows[start], end = start + 1;
137
+ for (; end < rows.length && manifest.groups !== void 0 && manifest.groups[rows[end]] === group; ) end++;
138
+ let lo = [1 / 0, 1 / 0, 1 / 0], hi = [-1 / 0, -1 / 0, -1 / 0], levels = [];
139
+ for (let k = start; k < end; k++) {
140
+ let row = rows[k];
141
+ for (let axis = 0; axis < 3; axis++)
142
+ lo[axis] = Math.min(lo[axis], b[row * (6) + axis]), hi[axis] = Math.max(hi[axis], b[row * (6) + 3 + axis]);
143
+ let part = manifest.parts?.[row] ?? (255), fine = part === (1) || part === (2);
144
+ levels.push(fine ? { path: paths[row], bytes: manifest.bytes[row], within: sceneryPartReach(part, radii) * (1.1) } : { path: paths[row], bytes: manifest.bytes[row] });
145
+ }
146
+ let dx = hi[0] - lo[0], dy = hi[1] - lo[1], dz = hi[2] - lo[2];
147
+ items.push({
148
+ center: [(lo[0] + hi[0]) * 0.5, (lo[1] + hi[1]) * 0.5, (lo[2] + hi[2]) * 0.5],
149
+ radius: Math.sqrt(dx * dx + dy * dy + dz * dz) * 0.5,
150
+ bytes: manifest.bytes[rows[start]],
151
+ levels
152
+ }), start = end;
153
+ }
154
+ return items;
155
+ }
156
+ function sceneryFirstView(manifest, paths, view, radius) {
157
+ let items = sceneryPrefetchItems(manifest, paths), near = [];
158
+ for (let item of items) {
159
+ let gap = Math.hypot(item.center[0] - view[0], item.center[1] - view[1], item.center[2] - view[2]) - (item.radius ?? 0);
160
+ gap <= radius && near.push({ path: item.levels[0].path, gap });
161
+ }
162
+ return near.sort((a, b) => a.gap - b.gap || (a.path < b.path ? -1 : 1)), near.map((entry) => entry.path);
163
+ }
164
+ function malformed(reason) {
165
+ return new chunk2V7IL4HC_js.GameError("invalid_argument", `the scenery manifest is malformed: ${reason}`);
166
+ }
167
+ function digestName(bytes, at) {
168
+ let out = "";
169
+ for (let i = 0; i < (32); i++) out += HEX[bytes[at + i]];
170
+ return out + SCENERY_CHUNK_EXTENSION;
171
+ }
172
+ function parseSceneryManifest(bytes) {
173
+ if (bytes.byteLength < (32)) throw malformed("too short");
174
+ let view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
175
+ if (view.getUint32(0, true) !== (1297109827)) throw malformed("not a CSPM file");
176
+ let version = view.getUint32((4), true);
177
+ if (version !== (1) && version !== (2)) throw malformed(`version ${version} is not supported`);
178
+ let count = view.getUint32((8), true);
179
+ if (bytes.byteLength < (32) + count * (80)) throw malformed(`${count} entries do not fit`);
180
+ let chunks = Array.from({ length: count }, (_, i) => digestName(bytes, (32) + i * (80) + (48))), bounds = new Float32Array(count * (6)), sizes = new Uint32Array(count), parts = new Uint8Array(count).fill((255)), groups = new Uint32Array(count);
181
+ for (let i = 0; i < count; i++) {
182
+ let at = (32) + i * (80);
183
+ sizes[i] = view.getUint32(at + (16), true);
184
+ for (let k = 0; k < (6); k++) bounds[i * (6) + k] = view.getFloat32(at + (24) + 4 * k, true);
185
+ if (groups[i] = i, version !== (2)) continue;
186
+ let tag = view.getUint32(at + (20), true), part = tag & (255);
187
+ if (part > (2)) throw malformed(`entry ${i} has part ${part}`);
188
+ parts[i] = part, groups[i] = tag >>> (8);
189
+ }
190
+ return {
191
+ bounds,
192
+ bytes: sizes,
193
+ parts,
194
+ groups,
195
+ grid: {
196
+ cellSize: view.getFloat32((12), true),
197
+ origin: [view.getFloat32((16), true), view.getFloat32((20), true)],
198
+ cols: view.getUint32((24), true),
199
+ rows: view.getUint32((28), true)
200
+ },
201
+ chunks
202
+ };
203
+ }
204
+ function sibling(manifest, name) {
205
+ if (ABSOLUTE.test(manifest)) return new URL(name, manifest).href;
206
+ let slash = manifest.lastIndexOf("/");
207
+ return slash < 0 ? name : manifest.slice(0, slash + 1) + name;
208
+ }
209
+ async function fetchBytes(url) {
210
+ let response = await fetch(url);
211
+ if (!response.ok) throw new chunk2V7IL4HC_js.GameError("asset_load_failed", `scenery ${url} failed with ${response.status}`);
212
+ return new Uint8Array(await response.arrayBuffer());
213
+ }
214
+ var DEFAULT_CACHE_BYTES = 8 * 1024 * 1024, ENGINE_ABSENT = 0, ENGINE_REQUESTED = 1, ENGINE_PROVIDED = 2, SWEEP_PER_FRAME = 256, SPHERE_FLOATS = 4, PRIORITY_NOW = 0, PRIORITY_SOON = 1, BUDGET_REASON = "budget";
215
+ function overBudget(error) {
216
+ return typeof error == "object" && error !== null && error.reason === BUDGET_REASON;
217
+ }
218
+ var SceneryChunks = class {
219
+ constructor(assets, cacheBytes = DEFAULT_CACHE_BYTES) {
220
+ this.assets = assets;
221
+ this.cacheBytes = cacheBytes;
222
+ this.kept = /* @__PURE__ */ new Map();
223
+ this.cache = /* @__PURE__ */ new Map();
224
+ this.cached = 0;
225
+ }
226
+ lazy(path) {
227
+ let assets = this.assets;
228
+ return assets !== null && assets.requests?.() === true && assets.lazy?.(path) === true;
229
+ }
230
+ read(path, priority = (0)) {
231
+ let assets = this.assets;
232
+ if (assets === null) return fetchBytes(path);
233
+ if (!this.lazy(path)) return this.retained(assets, path);
234
+ let hit = this.cache.get(path);
235
+ return hit !== void 0 ? (this.cache.delete(path), this.cache.set(path, hit), Promise.resolve(hit)) : assets.take(path, priority, false).catch((error) => {
236
+ if (!overBudget(error) || !this.reclaim()) throw error;
237
+ return assets.take(path, priority, false);
238
+ });
239
+ }
240
+ holds(path) {
241
+ return this.cache.has(path);
242
+ }
243
+ get reader() {
244
+ return this.assets;
245
+ }
246
+ retained(assets, path) {
247
+ let known = this.kept.get(path);
248
+ if (known !== void 0) return known;
249
+ let taken = assets.take(path);
250
+ return this.kept.set(path, taken), taken.catch(() => this.kept.delete(path)), taken;
251
+ }
252
+ delivered(path, bytes) {
253
+ if (!(!this.lazy(path) || this.cache.has(path)))
254
+ for (this.cache.set(path, bytes), this.cached += bytes.byteLength; this.cached > this.cacheBytes && this.cache.size > 0; ) this.evictColdest();
255
+ }
256
+ reclaim() {
257
+ let target = Math.floor(this.cache.size / 2);
258
+ if (this.cache.size === 0) return false;
259
+ for (; this.cache.size > target; ) this.evictColdest();
260
+ return true;
261
+ }
262
+ evictColdest() {
263
+ for (let [path, bytes] of this.cache) {
264
+ this.cache.delete(path), this.cached -= bytes.byteLength, this.assets?.release?.(path);
265
+ return;
266
+ }
267
+ }
268
+ get cachedBytes() {
269
+ return this.cached;
270
+ }
271
+ close() {
272
+ for (; this.cache.size > 0; ) this.evictColdest();
273
+ this.kept.clear();
274
+ }
275
+ }, Stats = class {
276
+ constructor(read) {
277
+ this.read = read;
278
+ }
279
+ get chunks() {
280
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.chunks];
281
+ }
282
+ get resident() {
283
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.resident];
284
+ }
285
+ get requested() {
286
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.requested];
287
+ }
288
+ get installed() {
289
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.installed];
290
+ }
291
+ get evicted() {
292
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.evicted];
293
+ }
294
+ get deferred() {
295
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.deferred];
296
+ }
297
+ get failed() {
298
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.failed];
299
+ }
300
+ get installedBytes() {
301
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.installedKib] * (1024);
302
+ }
303
+ get residentSplats() {
304
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.residentSplats];
305
+ }
306
+ get drawnSplats() {
307
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.drawnSplats];
308
+ }
309
+ get listedPages() {
310
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.listedPages];
311
+ }
312
+ get poolCapacity() {
313
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.poolCapacity];
314
+ }
315
+ get poolFreePages() {
316
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.poolFreePages];
317
+ }
318
+ get tier() {
319
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.tier];
320
+ }
321
+ get updates() {
322
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.updates];
323
+ }
324
+ get heroSplats() {
325
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.heroSplats];
326
+ }
327
+ get heroShed() {
328
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.heroShed];
329
+ }
330
+ get standIn() {
331
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.standIn] !== 0;
332
+ }
333
+ get deformedSplats() {
334
+ return this.read()[chunk7AAIAVAA_js.SCENERY_REGISTER.deformedSplats];
335
+ }
336
+ }, Scenery = class {
337
+ constructor(port, handle, manifest, chunkPaths, chunks, owner, options = {}) {
338
+ this.port = port;
339
+ this.handle = handle;
340
+ this.chunkPaths = chunkPaths;
341
+ this.chunks = chunks;
342
+ this.owner = owner;
343
+ this.requests = new Uint32Array(8);
344
+ this.transform = new Float32Array(8);
345
+ this.lastEye = new Float64Array(3);
346
+ this.registers = null;
347
+ this.predictor = null;
348
+ this.hasEye = false;
349
+ this.sweep = 0;
350
+ this.waiting = 0;
351
+ this.flow = new Float64Array(chunkVVE3Y76O_js.FLOW_WORDS);
352
+ this.closed = false;
353
+ this.editValues = new Float32Array(3);
354
+ this.standing = false;
355
+ this.kernel = null;
356
+ if (this.regionNames = options.regions ?? {}, this.standInTarget = options.standIn ?? null, options.heroBudget !== void 0) {
357
+ let caps = new Uint32Array(3);
358
+ caps.set(options.heroBudget), this.bodyPort().heroBudget(handle, caps);
359
+ }
360
+ this.grid = manifest.grid, this.stats = new Stats(() => this.view());
361
+ let rows = chunkPaths.length;
362
+ this.engineState = new Uint8Array(rows), this.entryRow = sceneryEntryRows(manifest, rows), this.rowBytes = manifest.bytes, this.rowPart = manifest.parts ?? new Uint8Array(rows).fill((255)), this.rowSphere = new Float32Array(rows * (4));
363
+ for (let i = 0; i < rows; i++) {
364
+ let b = manifest.bounds, at = i * (6), dx = b[at + 3] - b[at], dy = b[at + 4] - b[at + 1], dz = b[at + 5] - b[at + 2];
365
+ this.rowSphere[i * (4)] = (b[at] + b[at + 3]) * 0.5, this.rowSphere[i * (4) + 1] = (b[at + 1] + b[at + 4]) * 0.5, this.rowSphere[i * (4) + 2] = (b[at + 2] + b[at + 5]) * 0.5, this.rowSphere[i * (4) + 3] = Math.sqrt(dx * dx + dy * dy + dz * dz) * 0.5;
366
+ }
367
+ let radii = sceneryTierRadii(port.registers(handle)[chunk7AAIAVAA_js.SCENERY_REGISTER.tier] ?? 0);
368
+ this.layer = new chunkVVE3Y76O_js.PrefetchLayer({
369
+ name: "scenery",
370
+ items: sceneryPrefetchItems(manifest, chunkPaths, radii),
371
+ radius: () => sceneryTierRadii(this.tier()).far * (1.1),
372
+ need: () => sceneryTierRadii(this.tier()).near * (3),
373
+ cellSize: manifest.grid.cellSize > 0 ? manifest.grid.cellSize : void 0,
374
+ held: (entry) => {
375
+ let row = this.entryRow[entry];
376
+ return this.engineState[row] !== (0) || this.chunks.holds(this.chunkPaths[row]);
377
+ },
378
+ busy: () => this.waiting > 0,
379
+ flow: this.flow
380
+ });
381
+ }
382
+ tier() {
383
+ return this.closed ? 0 : this.view()[chunk7AAIAVAA_js.SCENERY_REGISTER.tier];
384
+ }
385
+ get prefetcher() {
386
+ return this.predictor;
387
+ }
388
+ stream(prefetch) {
389
+ if (this.predictor !== null || this.closed) return;
390
+ let reader = this.chunks.reader;
391
+ reader === null || reader.prefetch === void 0 || (this.predictor = prefetch.stream(this.layer, { stalled: () => this.stalled(), assets: reader }));
392
+ }
393
+ stalled() {
394
+ if (this.closed || !this.hasEye) return false;
395
+ let layer = this.layer, eye = this.lastEye, need = layer.needRadius() / layer.scale, cell = layer.cellSize, c0 = Math.max(0, Math.floor((eye[0] - need - layer.maxRadius - layer.originX) / cell)), c1 = Math.min(layer.cols - 1, Math.floor((eye[0] + need + layer.maxRadius - layer.originX) / cell)), r0 = Math.max(0, Math.floor((eye[2] - need - layer.maxRadius - layer.originZ) / cell)), r1 = Math.min(layer.rows - 1, Math.floor((eye[2] + need + layer.maxRadius - layer.originZ) / cell));
396
+ for (let row = r0; row <= r1; row++)
397
+ for (let col = c0; col <= c1; col++) {
398
+ let c = row * layer.cols + col;
399
+ for (let k = layer.cellStart[c]; k < layer.cellStart[c + 1]; k++) {
400
+ let item = layer.cellItems[k];
401
+ if (this.engineState[this.entryRow[layer.entryStart[item]]] === (2)) continue;
402
+ let dx = layer.x[item] - eye[0], dy = layer.y[item] - eye[1], dz = layer.z[item] - eye[2];
403
+ if (Math.sqrt(dx * dx + dy * dy + dz * dz) - layer.radius[item] <= need) return true;
404
+ }
405
+ }
406
+ return false;
407
+ }
408
+ /** True once `remove()` has run. */
409
+ get removed() {
410
+ return this.closed;
411
+ }
412
+ /** Places the scenery in the world: translation, rotation (normalised by the engine) and a uniform scale above zero. */
413
+ setTransform(position, rotation, scale = 1) {
414
+ if (this.closed) return;
415
+ if (!(scale > 0)) throw new chunk2V7IL4HC_js.GameError("invalid_argument", `scenery scale must be above zero, got ${scale}`);
416
+ let t = this.transform;
417
+ t[0] = position.x, t[1] = position.y, t[2] = position.z, t[3] = rotation?.x ?? 0, t[4] = rotation?.y ?? 0, t[5] = rotation?.z ?? 0, t[6] = rotation?.w ?? 1, t[7] = scale, this.port.setTransform(this.handle, t), this.layer.setPlacement(t);
418
+ }
419
+ bodyPort() {
420
+ let bodies = this.port.bodies;
421
+ if (bodies == null) throw new chunk2V7IL4HC_js.GameError("unsupported_feature", "this engine build does not move or edit splats");
422
+ return bodies;
423
+ }
424
+ regionOf(region) {
425
+ let id = typeof region == "string" ? this.regionNames[region] : region;
426
+ if (id === void 0 || !Number.isInteger(id) || id < 0 || id >= 256) throw new chunk2V7IL4HC_js.GameError("invalid_argument", `no splat region ${String(region)}`);
427
+ return id;
428
+ }
429
+ /** Recolours one baked region without recapture: hue in radians, saturation and gain as multipliers. */
430
+ edit(region, edit) {
431
+ if (this.closed) return;
432
+ let v = this.editValues;
433
+ if (v[0] = edit.hue ?? 0, v[1] = edit.saturation ?? 1, v[2] = edit.gain ?? 1, !(v[1] >= 0) || !(v[2] >= 0) || !Number.isFinite(v[0])) throw new chunk2V7IL4HC_js.GameError("invalid_argument", "a splat edit needs a finite hue and non-negative saturation and gain");
434
+ this.bodyPort().edit(this.handle, this.regionOf(region), v);
435
+ }
436
+ /** Drives this body from a model's pose on the rig it was baked against; null returns it to rest. Throws when the rig differs. */
437
+ bind(rig) {
438
+ this.closed || this.bodyPort().bind(this.handle, rig ?? (0));
439
+ }
440
+ /** Splats in garment region `region` follow `cloth`, which must use the mesh the region was baked with. It may be called at any point in the cloth's run. */
441
+ drape(cloth, region, options = {}) {
442
+ if (this.closed) return;
443
+ let host = cloth.engineHost;
444
+ if (host === null) throw new chunk2V7IL4HC_js.GameError("unsupported_feature", "this cloth is not simulated by the engine");
445
+ this.bodyPort().drape(this.handle, host, cloth.id, this.regionOf(region), options.rest ?? null);
446
+ }
447
+ /** Rows a motion table needs: one for every splat in the manifest, across all levels of detail. */
448
+ get motionRows() {
449
+ return this.closed ? 0 : this.bodyPort().motionRows(this.handle);
450
+ }
451
+ /**
452
+ * Runs a per-splat program. `kernel` is called once a frame, normally `() => game.kernels.run(wave, table, time)`;
453
+ * the engine reads what it writes before deforming, and pays only for the channels named here. Pass null to stop.
454
+ */
455
+ motion(kernel, options) {
456
+ if (this.closed) return;
457
+ let bodies = this.bodyPort();
458
+ if (kernel === null || options === void 0) {
459
+ this.kernel = null, bodies.motion(this.handle, 0, null, 0, 0);
460
+ return;
461
+ }
462
+ let table = options.table, named = options.rotation !== void 0 || options.colour !== void 0 || options.opacity !== void 0, offset = options.offset ?? (named ? void 0 : DEFAULT_MOTION_OFFSET), mask = 0, names = [...options.rest ?? DEFAULT_MOTION_REST], channel = (bit, fields) => {
463
+ fields !== void 0 && (mask |= bit, names.push(...fields));
464
+ };
465
+ channel(1, offset), channel(2, options.rotation), channel(4, options.colour), channel(8, options.opacity === void 0 ? void 0 : [options.opacity]);
466
+ let columns = new Uint32Array(14);
467
+ if (names.forEach((name, k) => {
468
+ columns[k] = table.column(name);
469
+ }), !(options.reach >= 0)) throw new chunk2V7IL4HC_js.GameError("invalid_argument", "a splat motion reach must not be negative");
470
+ bodies.motion(this.handle, table.id, columns, Math.ceil(options.reach * (1e3)), mask), this.kernel = () => kernel(table);
471
+ }
472
+ follow() {
473
+ this.kernel?.();
474
+ let target = this.standInTarget;
475
+ if (target === null) return;
476
+ let wanted = this.view()[chunk7AAIAVAA_js.SCENERY_REGISTER.standIn] !== 0;
477
+ wanted !== this.standing && (this.standing = wanted, wanted ? target.show() : target.hide());
478
+ }
479
+ /** Closes the scenery and frees its engine resources. Later calls on the handle do nothing. */
480
+ remove() {
481
+ this.closed || (this.closed = true, this.registers = null, this.predictor !== null && this.owner.unstream(this.predictor), this.predictor = null, this.owner.release(this), this.port.close(this.handle), this.chunks.close());
482
+ }
483
+ update(eye) {
484
+ if (this.closed) return;
485
+ let n = this.port.update(this.handle, eye, this.requests);
486
+ for (let i = 0; i < n; i++) this.fetch(this.requests[i], i === 0 ? (0) : (1));
487
+ this.layer.toLocal(eye, this.lastEye, 0, true), this.hasEye = true, this.forget(), this.follow();
488
+ }
489
+ forget() {
490
+ let layer = this.layer, eye = this.lastEye, radii = sceneryTierRadii(this.tier()), scale = layer.scale, states = this.engineState, sphere = this.rowSphere, sweep = this.sweep, end = Math.min(states.length, sweep + (256));
491
+ for (let row = sweep; row < end; row++) {
492
+ if (states[row] !== (2)) continue;
493
+ let at = row * (4), dx = sphere[at] - eye[0], dy = sphere[at + 1] - eye[1], dz = sphere[at + 2] - eye[2], unload = sceneryPartReach(this.rowPart[row], radii) * (1.35) / scale;
494
+ Math.sqrt(dx * dx + dy * dy + dz * dz) - sphere[at + 3] > unload && (states[row] = (0));
495
+ }
496
+ this.sweep = end >= states.length ? 0 : end;
497
+ }
498
+ fetch(index, priority) {
499
+ let path = this.chunkPaths[index];
500
+ if (path === void 0) {
501
+ this.port.fail(this.handle, index);
502
+ return;
503
+ }
504
+ this.mark(index, (1));
505
+ let reader = this.chunks.reader;
506
+ if (reader?.progressive !== void 0 && reader.isProgressive?.(path) === true && !this.chunks.holds(path)) {
507
+ let first = true;
508
+ reader.progressive(
509
+ path,
510
+ (output) => {
511
+ first ? (first = false, this.deliver(index, path, output, false)) : this.upgrade(index, output);
512
+ },
513
+ priority
514
+ ).done.then(
515
+ (bytes) => this.chunks.delivered(path, bytes),
516
+ () => {
517
+ first && this.failed(index);
518
+ }
519
+ );
520
+ return;
521
+ }
522
+ this.chunks.read(path, priority).then(
523
+ (bytes) => this.deliver(index, path, bytes, true),
524
+ () => this.failed(index)
525
+ );
526
+ }
527
+ deliver(index, path, bytes, cache) {
528
+ if (!this.closed) {
529
+ try {
530
+ this.port.provide(this.handle, index, bytes);
531
+ } catch {
532
+ this.failed(index);
533
+ return;
534
+ }
535
+ this.mark(index, (2)), cache && this.chunks.delivered(path, bytes);
536
+ }
537
+ }
538
+ upgrade(index, bytes) {
539
+ if (!(this.closed || this.engineState[index] !== (2)))
540
+ try {
541
+ this.port.provide(this.handle, index, bytes);
542
+ } catch {
543
+ return;
544
+ }
545
+ }
546
+ failed(index) {
547
+ this.closed || (this.mark(index, (0)), this.port.fail(this.handle, index));
548
+ }
549
+ mark(index, state) {
550
+ let previous = this.engineState[index], bytes = this.rowBytes[index];
551
+ previous === (1) && (this.waiting--, this.flow[chunkVVE3Y76O_js.FLOW_BACKLOG] -= bytes), state === (1) && (this.waiting++, this.flow[chunkVVE3Y76O_js.FLOW_BACKLOG] += bytes), previous === (1) && state === (2) && (this.flow[chunkVVE3Y76O_js.FLOW_DELIVERED] += bytes), this.engineState[index] = state;
552
+ }
553
+ view() {
554
+ if (this.closed) return CLOSED_REGISTERS;
555
+ let registers = this.registers;
556
+ return registers !== null && registers.byteLength > 0 ? registers : (this.registers = this.port.registers(this.handle), this.registers);
557
+ }
558
+ }, GraphicsScenery = class {
559
+ constructor(port, eye) {
560
+ this.port = port;
561
+ this.eye = eye;
562
+ this.live = [];
563
+ this.eyeBuffer = new Float32Array(3);
564
+ this.prefetch = null;
565
+ }
566
+ attachPrefetch(prefetch) {
567
+ if (this.prefetch = prefetch, prefetch !== null) for (let i = 0; i < this.live.length; i++) this.live[i].stream(prefetch);
568
+ }
569
+ unstream(predictor) {
570
+ this.prefetch?.removeStream(predictor);
571
+ }
572
+ /** False when this backend or engine build cannot draw splat scenery; `load` then throws. */
573
+ get supported() {
574
+ return this.port !== null;
575
+ }
576
+ /**
577
+ * Opens the scenery whose manifest is at `source` (a `splats.cspm` URL or, with `options.assets`, a package path).
578
+ * Chunk files `<sha256>.cspl` are read from the manifest's folder on demand.
579
+ * Throws `unsupported_feature` when `supported` is false.
580
+ */
581
+ load(source, options = {}) {
582
+ let port = this.port;
583
+ if (port === null) throw new chunk2V7IL4HC_js.GameError("unsupported_feature", "this backend does not draw splat scenery");
584
+ let manifest = typeof source == "string" ? source : source.href, assets = options.assets;
585
+ return this.open(port, manifest, new SceneryChunks(assets ?? null, options.cacheBytes), options);
586
+ }
587
+ /** Loads a splat body baked against a rig and binds it, so it follows that model's animation. */
588
+ async splatBody(options) {
589
+ let body = await this.load(options.manifest, options);
590
+ return body.bind(options.rig), body;
591
+ }
592
+ async open(port, location, chunks, options) {
593
+ let bytes = await chunks.read(location), manifest = parseSceneryManifest(bytes), paths = manifest.chunks.map((name) => sibling(location, name)), handle = port.open(bytes), scenery = new Scenery(port, handle, manifest, paths, chunks, this, options);
594
+ return this.live.push(scenery), this.prefetch !== null && scenery.stream(this.prefetch), scenery;
595
+ }
596
+ /** Number of scenery handles currently loaded. */
597
+ get count() {
598
+ return this.live.length;
599
+ }
600
+ release(scenery) {
601
+ let index = this.live.indexOf(scenery);
602
+ index >= 0 && this.live.splice(index, 1);
603
+ }
604
+ frame() {
605
+ let live = this.live;
606
+ if (!(live.length === 0 || !this.eye(this.eyeBuffer)))
607
+ for (let i = 0; i < live.length; i++) live[i].update(this.eyeBuffer);
608
+ }
609
+ dispose() {
610
+ for (let i = this.live.length - 1; i >= 0; i--) this.live[i].remove();
611
+ }
612
+ };
613
+
614
+ // src/game/render/graphics.ts
615
+ var CUBE_FACE_COUNT = 6, MAT4_TRANSLATION_X = 12, MAT4_TRANSLATION_Y = 13, MAT4_TRANSLATION_Z = 14, QUALITY_TIER_FULL = 0, QUALITY_TIER_REDUCED = 1, QUALITY_TIER_MINIMUM = 2, Renderable = defineComponent("renderable", { node: "u32" }), FEED_NO_COLUMN = 4294967295, FEED_AXES = 3, MAX_PALETTE_FRAMES = 1024;
616
+ function scalarColumn(table, field) {
617
+ if (table.schema[field] !== "f32") throw new chunk2V7IL4HC_js.GameError("invalid_argument", `instance feeds read f32 fields; ${field} is not one`);
618
+ return table.column(field);
619
+ }
620
+ function wordColumn(table, field) {
621
+ if (field === void 0) return (4294967295);
622
+ if (table.schema[field] !== "u32") throw new chunk2V7IL4HC_js.GameError("invalid_argument", `instance rotation and animation read packed u32 fields; ${field} is not one`);
623
+ return table.column(field);
624
+ }
625
+ function poseColumns(table, fields) {
626
+ if (!(fields.rotation === void 0 && fields.animation === void 0))
627
+ return [wordColumn(table, fields.rotation), wordColumn(table, fields.animation)];
628
+ }
629
+ function feedFields(fields) {
630
+ let named = typeof fields.position == "string" ? [fields.position] : [...fields.position];
631
+ return fields.scale !== void 0 && named.push(fields.scale), fields.rotation !== void 0 && named.push(fields.rotation), fields.animation !== void 0 && named.push(fields.animation), named;
632
+ }
633
+ function feedColumns(table, fields) {
634
+ let columns = [];
635
+ if (typeof fields.position == "string") {
636
+ if (table.schema[fields.position] !== "vec3") throw new chunk2V7IL4HC_js.GameError("invalid_argument", `instance feed position ${fields.position} must be a vec3 field`);
637
+ for (let k = 0; k < (3); k++) columns.push(table.column(fields.position, k));
638
+ } else
639
+ for (let field of fields.position) columns.push(scalarColumn(table, field));
640
+ return columns.push(fields.scale === void 0 ? (4294967295) : scalarColumn(table, fields.scale)), columns;
641
+ }
642
+ var Graphics = class {
643
+ constructor(port, world, transforms, scenery = null) {
644
+ this.fed = /* @__PURE__ */ new Map();
645
+ this.presentedByFeeds = /* @__PURE__ */ new Set();
646
+ this.cameraMatrix = new Float32Array(16);
647
+ this.activeCamera = null;
648
+ this.port = port, this.world = world, this.transforms = transforms, this.renderables = world.register(Renderable), this.nodeIds = new Uint32Array(this.renderables.capacity), this.matrixRows = new Int32Array(this.renderables.capacity), this.scenery = new GraphicsScenery(scenery, (out) => this.readCameraEye(out)), world.onDespawn(this);
649
+ }
650
+ readCameraEye(out) {
651
+ let camera = this.activeCamera;
652
+ if (camera === null) return false;
653
+ let m = this.cameraMatrix;
654
+ return this.port.readNodeMatrix(camera, m, 0), out[0] = m[(12)], out[1] = m[(13)], out[2] = m[(14)], true;
655
+ }
656
+ get capabilities() {
657
+ return this.port.capabilities;
658
+ }
659
+ get gpu() {
660
+ return this.port.gpu;
661
+ }
662
+ attach(surface) {
663
+ return this.port.attach(surface);
664
+ }
665
+ resize(width, height, pixelRatio) {
666
+ this.port.resize(width, height, pixelRatio);
667
+ }
668
+ createGeometry(desc) {
669
+ return this.port.createGeometry(desc);
670
+ }
671
+ geometryAttribute(geometry, name) {
672
+ return this.port.geometryAttribute(geometry, name);
673
+ }
674
+ markGeometryDirty(geometry, name, start = 0, count = -1) {
675
+ this.port.markGeometryDirty(geometry, name, start, count);
676
+ }
677
+ setDrawRange(geometry, start, count) {
678
+ this.port.setDrawRange(geometry, start, count);
679
+ }
680
+ destroyGeometry(geometry) {
681
+ this.port.destroyGeometry(geometry);
682
+ }
683
+ createTexture(desc) {
684
+ return this.port.createTexture(desc);
685
+ }
686
+ loadTexture(source) {
687
+ return this.port.loadTexture(source);
688
+ }
689
+ upgradeTexture(texture, source) {
690
+ return this.port.upgradeTexture || this.unsupported("texture upgrades"), this.port.upgradeTexture(texture, source);
691
+ }
692
+ upgradeModel(model, source) {
693
+ return this.port.upgradeModel || this.unsupported("model upgrades"), this.port.upgradeModel(model, source);
694
+ }
695
+ markTextureDirty(texture, region) {
696
+ this.port.markTextureDirty(texture, region);
697
+ }
698
+ pushVideoFrame(texture, frame, width, height) {
699
+ return this.port.pushVideoFrame || this.unsupported("video textures"), this.port.pushVideoFrame(texture, frame, width, height);
700
+ }
701
+ readRenderTarget(target, rect, slice = 0) {
702
+ return this.port.readRenderTarget || this.unsupported("render target readback"), this.port.readRenderTarget(target, rect, slice);
703
+ }
704
+ vectorPort() {
705
+ let port = this.port.vectorSurfaces;
706
+ return port == null && this.unsupported("vector surfaces"), port;
707
+ }
708
+ get vectorSurfaceCap() {
709
+ return this.port.vectorSurfaces?.cap ?? 0;
710
+ }
711
+ loadVector(bytes) {
712
+ return this.vectorPort().load(bytes);
713
+ }
714
+ unloadVector(asset) {
715
+ this.vectorPort().unload(asset);
716
+ }
717
+ vectorSurface(desc) {
718
+ return this.port.capabilities.renderTargets || this.unsupported("render targets"), this.vectorPort().create(desc);
719
+ }
720
+ destroyVectorSurface(surface) {
721
+ this.vectorPort().destroy(surface);
722
+ }
723
+ setVectorSurfaceNode(surface, node) {
724
+ this.vectorPort().setNode(surface, node);
725
+ }
726
+ playVectorSurface(surface, kind, index = 0) {
727
+ this.vectorPort().play(surface, kind, index);
728
+ }
729
+ seekVectorSurface(surface, kind, index, seconds) {
730
+ let port = this.vectorPort();
731
+ port.seek || this.unsupported("vector surface seeking"), port.seek(surface, kind, index, seconds);
732
+ }
733
+ vectorSurfaceInput(surface, name) {
734
+ return this.vectorPort().inputIndex(surface, name);
735
+ }
736
+ setVectorSurfaceInput(surface, input, value) {
737
+ this.vectorPort().setInput(surface, input, typeof value == "boolean" ? Number(value) : value);
738
+ }
739
+ vectorSurfaceData(surface, path) {
740
+ return this.vectorPort().dataIndex(surface, path);
741
+ }
742
+ setVectorSurfaceData(surface, handle, kind, value = 0) {
743
+ this.vectorPort().setData(surface, handle, kind, value);
744
+ }
745
+ vectorSurfacePointer(surface, phase, u, v) {
746
+ return this.vectorPort().pointer(surface, phase, u, v);
747
+ }
748
+ pickVectorSurface(origin, direction, phase, far = 1e3) {
749
+ return this.vectorPort().pick(origin, direction, far, phase);
750
+ }
751
+ vectorSurfaceEvents(out = []) {
752
+ return this.vectorPort().events(out), out;
753
+ }
754
+ vectorSurfaceStats(out = chunk7AAIAVAA_js.createVectorSurfaceStats()) {
755
+ return this.vectorPort().stats(out), out;
756
+ }
757
+ setVectorSurfaceTier(tier) {
758
+ this.vectorPort().setTier(tier);
759
+ }
760
+ createMaterial(desc) {
761
+ return desc.kind === "shader" && this.checkShader(desc.shader.glsl !== void 0), this.port.createMaterial(desc);
762
+ }
763
+ setMaterialColor(material, color) {
764
+ this.port.setMaterialColor(material, (color >> 16 & 255) / 255, (color >> 8 & 255) / 255, (color & 255) / 255);
765
+ }
766
+ setMaterialRgb(material, r, g, b) {
767
+ this.port.setMaterialColor(material, r, g, b);
768
+ }
769
+ setMaterialOpacity(material, opacity) {
770
+ this.port.setMaterialOpacity(material, opacity);
771
+ }
772
+ setMaterialTexture(material, slot, texture) {
773
+ this.port.setMaterialTexture(material, slot, texture);
774
+ }
775
+ setUniform(material, name, value) {
776
+ this.port.setMaterialScalar(material, name, value);
777
+ }
778
+ setUniformVector(material, name, value) {
779
+ this.port.setMaterialVector(material, name, value);
780
+ }
781
+ setUniformTexture(material, name, texture) {
782
+ this.port.setMaterialUniformTexture(material, name, texture);
783
+ }
784
+ setMaterialState(material, state) {
785
+ this.port.setMaterialState(material, state);
786
+ }
787
+ createEmitter(desc) {
788
+ return this.port.capabilities.particles || this.unsupported("particles"), this.port.createEmitter(desc);
789
+ }
790
+ particles(entity, emitter) {
791
+ return this.create(entity, { kind: "particles", emitter });
792
+ }
793
+ emit(emitter, count) {
794
+ this.port.emit(emitter, count);
795
+ }
796
+ setEmitterRate(emitter, rate) {
797
+ this.port.setEmitterRate(emitter, rate);
798
+ }
799
+ clearEmitter(emitter) {
800
+ this.port.clearEmitter(emitter);
801
+ }
802
+ destroyEmitter(emitter) {
803
+ this.port.destroyEmitter(emitter);
804
+ }
805
+ setRenderOrder(node, order) {
806
+ this.port.setRenderOrder(node, order);
807
+ }
808
+ setShadow(light, shadow) {
809
+ this.port.setShadow(light, shadow);
810
+ }
811
+ setLod(node, near, far, hysteresis = 0) {
812
+ if (near < 0 || far > 0 && far <= near || hysteresis < 0)
813
+ throw new chunk2V7IL4HC_js.GameError("invalid_argument", `lod range ${near}..${far} with hysteresis ${hysteresis} is invalid`);
814
+ this.port.setLod(node, near, far, hysteresis);
815
+ }
816
+ lodLevels(levels, hysteresis = 0) {
817
+ for (let i = 0; i < levels.length; i++) {
818
+ let next = i + 1 < levels.length ? levels[i + 1].distance : 0;
819
+ this.setLod(levels[i].node, levels[i].distance, next, hysteresis);
820
+ }
821
+ }
822
+ setSprite(node, rotation, centerX = 0.5, centerY = 0.5) {
823
+ this.port.setSprite(node, rotation, centerX, centerY);
824
+ }
825
+ setProbeCoefficients(light, sh) {
826
+ if (sh.length < chunkIIDZ5WUX_js.SH_COEFFICIENT_FLOATS)
827
+ throw new chunk2V7IL4HC_js.GameError("invalid_argument", `light probes take ${chunkIIDZ5WUX_js.SH_COEFFICIENT_FLOATS} coefficients (9 RGB)`);
828
+ this.port.setProbeCoefficients(light, sh);
829
+ }
830
+ decal(entity, material, options = {}) {
831
+ return this.port.capabilities.decals || this.unsupported("decals"), this.create(entity, { kind: "decal", material, ...options });
832
+ }
833
+ setProjectionMatrix(camera, matrix, near, far) {
834
+ if (matrix !== null && matrix.length < 16) throw new chunk2V7IL4HC_js.GameError("invalid_argument", "projection matrices hold 16 floats");
835
+ this.port.capabilities.customProjection || this.unsupported("custom projections"), this.port.setProjectionMatrix(camera, matrix, near, far);
836
+ }
837
+ setViewOffset(camera, offset) {
838
+ if (offset !== null && (offset.fullWidth <= 0 || offset.fullHeight <= 0 || offset.width <= 0 || offset.height <= 0))
839
+ throw new chunk2V7IL4HC_js.GameError("invalid_argument", "view offsets need positive sizes");
840
+ this.port.capabilities.customProjection || this.unsupported("view offsets"), this.port.setViewOffset(camera, offset);
841
+ }
842
+ gpuStats(out) {
843
+ return this.port.gpuStats(out);
844
+ }
845
+ attachNode(entity, node) {
846
+ this.transforms.row(entity);
847
+ let row = this.world.add(entity, Renderable);
848
+ return this.renderables.fields.node[row] = node, node;
849
+ }
850
+ create(entity, desc) {
851
+ return this.attachNode(entity, this.createDetached(desc));
852
+ }
853
+ createDetached(desc) {
854
+ return this.checkNode(desc), this.port.createNode(desc);
855
+ }
856
+ mesh(entity, geometry, material) {
857
+ return this.create(entity, { kind: "mesh", geometry, material, castShadow: true, receiveShadow: true });
858
+ }
859
+ camera(entity, fov = 60, near = 0.1, far = 1e3) {
860
+ let node = this.create(entity, { kind: "camera", projection: "perspective", fov, near, far });
861
+ return this.port.setActiveCamera(node), this.activeCamera = node, node;
862
+ }
863
+ instanced(desc) {
864
+ this.port.capabilities.instancing || this.unsupported("instancing");
865
+ let node = this.port.createNode({ kind: "instanced", ...desc });
866
+ return {
867
+ node,
868
+ capacity: desc.capacity,
869
+ matrices: this.port.instanceMatrices(node),
870
+ colors: this.port.instanceColors(node)
871
+ };
872
+ }
873
+ batchedDraw(desc) {
874
+ if (!this.port.capabilities.instancing || desc.slots <= 0) return null;
875
+ let { slots, ...rest } = desc, node = this.port.createNode({ kind: "instanced", ...rest, batchSlots: slots }), buffers = this.port.batchBuffers(node);
876
+ return buffers === null ? (this.port.destroyNode(node), null) : {
877
+ node,
878
+ capacity: desc.capacity,
879
+ matrices: this.port.instanceMatrices(node),
880
+ colors: this.port.instanceColors(node),
881
+ slots: buffers.slots,
882
+ ranges: buffers.ranges
883
+ };
884
+ }
885
+ markBatch(batch) {
886
+ this.port.markBatch(batch.node);
887
+ }
888
+ setInstanceCount(batch, count) {
889
+ if (count < 0 || count > batch.capacity)
890
+ throw new chunk2V7IL4HC_js.GameError("invalid_argument", `instance count ${count} exceeds ${batch.capacity}`);
891
+ this.port.setInstanceCount(batch.node, count);
892
+ }
893
+ markInstancesDirty(batch) {
894
+ this.port.markInstancesDirty(batch.node);
895
+ }
896
+ feedInstances(batch, table, fields, options = {}) {
897
+ if (!table.native || this.port.setInstanceFeed === void 0) return false;
898
+ let columns = feedColumns(table, fields), pose = poseColumns(table, fields), hostReads = options.hostReads === true;
899
+ return this.port.setInstanceFeed(batch.node, table.id, columns, hostReads, pose) ? (this.forget(batch.node), this.world.presentsKernels(table) || (this.world.presentKernels(table), this.presentedByFeeds.add(table)), this.fed.set(batch.node, table), hostReads && this.world.hostReads(table, feedFields(fields)), true) : false;
900
+ }
901
+ setInstancePalette(batch, model, desc) {
902
+ if (this.port.setInstancePalette === void 0) return false;
903
+ if (desc === null) return this.port.setInstancePalette(batch.node, model, 0, 0, 0, 0);
904
+ let skin = desc.skin ?? 0, firstClip = desc.firstClip ?? 0, whole = (value) => Number.isInteger(value) && value >= 0;
905
+ if (!whole(skin) || !whole(firstClip) || !whole(desc.clips) || desc.clips < 1 || !whole(desc.frames) || desc.frames < 1 || desc.frames > (1024))
906
+ throw new chunk2V7IL4HC_js.GameError("invalid_argument", `an instance palette needs whole clips of at least 1 and 1 to ${(1024)} frames per clip`);
907
+ return this.port.setInstancePalette(batch.node, model, skin, firstClip, desc.clips, desc.frames);
908
+ }
909
+ stopFeedingInstances(batch) {
910
+ this.fed.has(batch.node) && this.port.clearInstanceFeed?.(batch.node), this.forget(batch.node);
911
+ }
912
+ forget(node) {
913
+ let table = this.fed.get(node);
914
+ if (table !== void 0) {
915
+ this.fed.delete(node);
916
+ for (let other of this.fed.values()) if (other === table) return;
917
+ this.presentedByFeeds.delete(table) && this.world.presentKernels(table, false);
918
+ }
919
+ }
920
+ morphWeights(node) {
921
+ return this.port.capabilities.morphTargets || this.unsupported("morph targets"), this.port.morphWeights(node);
922
+ }
923
+ markMorphWeightsDirty(node) {
924
+ this.port.markMorphWeightsDirty(node);
925
+ }
926
+ skeletonPose(node) {
927
+ return this.port.capabilities.skinning || this.unsupported("skinning"), this.port.skeletonPose(node);
928
+ }
929
+ markSkeletonDirty(node) {
930
+ this.port.markSkeletonDirty(node);
931
+ }
932
+ setVisible(node, visible) {
933
+ this.port.setNodeVisible(node, visible);
934
+ }
935
+ setLayers(node, mask) {
936
+ this.port.setNodeLayers(node, mask);
937
+ }
938
+ setNodeMaterial(node, material) {
939
+ this.port.setNodeMaterial(node, material);
940
+ }
941
+ setText(node, text) {
942
+ this.port.setNodeText(node, text);
943
+ }
944
+ loadFont(source, family) {
945
+ return this.port.capabilities.text || this.unsupported("text"), this.port.loadFont(source, family);
946
+ }
947
+ text3d(entity, font, text, style = {}) {
948
+ return this.create(entity, { ...style, kind: "text3d", font, text });
949
+ }
950
+ setTextStyle(node, style) {
951
+ this.port.setTextStyle(node, style);
952
+ }
953
+ textBounds(node, out) {
954
+ this.port.textBounds(node, out);
955
+ }
956
+ raycast(origin, direction, out, far = 0, layers = 4294967295) {
957
+ return this.port.capabilities.picking || this.unsupported("picking"), this.port.raycast(origin, direction, far, layers, out);
958
+ }
959
+ batchHandle() {
960
+ return this.port.capabilities.picking ? this.port.batchHandle?.() ?? 0 : 0;
961
+ }
962
+ governorPressure() {
963
+ return this.port.governorPressure?.() ?? 0;
964
+ }
965
+ /** Pins the renderer's quality tier (0 full, 1 reduced, 2 minimum), or returns it to the governor with null. False when this renderer has no governor. */
966
+ forceQualityTier(tier) {
967
+ if (tier !== null && !(Number.isInteger(tier) && tier >= (0) && tier <= (2)))
968
+ throw new chunk2V7IL4HC_js.GameError("invalid_argument", `quality tiers run from ${(0)} to ${(2)}`);
969
+ return this.port.forceQualityTier?.(tier) ?? false;
970
+ }
971
+ qualityTier() {
972
+ return this.port.qualityTier?.() ?? (0);
973
+ }
974
+ setPerspective(camera, fovDegrees, near, far) {
975
+ this.port.setCameraPerspective(camera, fovDegrees, near, far);
976
+ }
977
+ setPerspectiveFrom(camera, values, offset = 0) {
978
+ this.port.setCameraPerspectiveFrom(camera, values, offset);
979
+ }
980
+ setOrthographic(camera, height, near, far) {
981
+ this.port.setCameraOrthographic(camera, height, near, far);
982
+ }
983
+ setActiveCamera(camera) {
984
+ this.port.setActiveCamera(camera), this.activeCamera = camera;
985
+ }
986
+ setLight(light, color, intensity) {
987
+ this.port.setLight(light, color, intensity);
988
+ }
989
+ setEnvironment(desc) {
990
+ this.port.setEnvironment(desc);
991
+ }
992
+ createRenderTarget(desc) {
993
+ return this.port.capabilities.renderTargets || this.unsupported("render targets"), this.port.createRenderTarget(desc);
994
+ }
995
+ renderTargetTexture(target) {
996
+ return this.port.renderTargetTexture(target);
997
+ }
998
+ renderTargetAttachment(target, attachment) {
999
+ return attachment === 0 ? this.port.renderTargetTexture(target) : (this.port.renderTargetAttachment || this.unsupported("multiple render target attachments"), this.port.renderTargetAttachment(target, attachment));
1000
+ }
1001
+ captureCube(target, camera) {
1002
+ return Array.from(
1003
+ { length: (6) },
1004
+ (_, slice) => this.port.createRenderPass({ camera, target, slice, cubeFace: true, once: true })
1005
+ );
1006
+ }
1007
+ createReflector(target, camera, plane, order = -1) {
1008
+ return this.port.createRenderPass({ camera, target, reflect: plane, order });
1009
+ }
1010
+ renderTargetDepthTexture(target) {
1011
+ return this.port.renderTargetDepthTexture || this.unsupported("sampled render target depth"), this.port.renderTargetDepthTexture(target);
1012
+ }
1013
+ resizeRenderTarget(target, width, height) {
1014
+ this.port.resizeRenderTarget(target, width, height);
1015
+ }
1016
+ createPostChain(desc) {
1017
+ this.port.capabilities.postProcessing || this.unsupported("post-processing");
1018
+ for (let effect of desc.effects)
1019
+ effect.kind === "shader" && this.checkShader(effect.shader.glsl !== void 0);
1020
+ return this.port.createPostChain(desc);
1021
+ }
1022
+ setPostChain(chain) {
1023
+ this.port.setPostChain(chain);
1024
+ }
1025
+ setWeather(state) {
1026
+ this.port.setWeather(state);
1027
+ }
1028
+ setTimeOfDay(hours, latitude, dayOfYear) {
1029
+ this.port.setTimeOfDay(hours, latitude, dayOfYear);
1030
+ }
1031
+ mediaVolume(desc) {
1032
+ let port = this.port, { createMedium, setMedium, mediumTexels, markMedium, destroyMedium } = port;
1033
+ if (createMedium === void 0 || setMedium === void 0 || mediumTexels === void 0 || markMedium === void 0 || destroyMedium === void 0)
1034
+ throw new chunk2V7IL4HC_js.GameError("unsupported_feature", "media volumes need the native engine with feature media_volume_1");
1035
+ let media = {
1036
+ createMedium: createMedium.bind(port),
1037
+ setMedium: setMedium.bind(port),
1038
+ mediumTexels: mediumTexels.bind(port),
1039
+ markMedium: markMedium.bind(port),
1040
+ destroyMedium: destroyMedium.bind(port)
1041
+ };
1042
+ return new chunk3C4C654I_js.MediumVolume(media, media.createMedium(desc), desc);
1043
+ }
1044
+ setPostUniform(chain, effect, name, value) {
1045
+ this.port.setPostScalar(chain, effect, name, value);
1046
+ }
1047
+ createRenderPass(desc) {
1048
+ return desc.target !== null && !this.port.capabilities.renderTargets && this.unsupported("render targets"), this.port.createRenderPass(desc);
1049
+ }
1050
+ setRenderPassEnabled(pass, enabled) {
1051
+ this.port.setRenderPassEnabled(pass, enabled);
1052
+ }
1053
+ loadModel(source) {
1054
+ return this.port.capabilities.models || this.unsupported("models"), this.port.loadModel(source);
1055
+ }
1056
+ loadClips(root, source, options) {
1057
+ return this.port.loadClips || this.unsupported("animation clip import"), this.port.loadClips(root, source, options);
1058
+ }
1059
+ setTint(node, tint) {
1060
+ this.port.setTint || this.unsupported("kit tints"), this.port.setTint(node, tint);
1061
+ }
1062
+ instantiate(entity, model) {
1063
+ return this.attachNode(entity, this.port.instantiateModel(model));
1064
+ }
1065
+ findNode(root, name) {
1066
+ return this.port.findNode(root, name);
1067
+ }
1068
+ playClip(root, clip, loop = true, fadeSeconds = 0, speed = 1) {
1069
+ return this.port.playClip(root, clip, loop, fadeSeconds, speed);
1070
+ }
1071
+ setClipWeight(action, weight) {
1072
+ this.port.setClipWeight(action, weight);
1073
+ }
1074
+ clipIndex(root, clip) {
1075
+ return this.port.clipIndex?.(root, clip) ?? -1;
1076
+ }
1077
+ playClipIndex(root, clip, loop, fadeSeconds, speed) {
1078
+ return this.port.playClipIndex === void 0 && this.unsupported("clip playback by index"), this.port.playClipIndex(root, clip, loop, fadeSeconds, speed);
1079
+ }
1080
+ setIkTarget(chain, x, y, z, weight) {
1081
+ this.clips.setIkTarget(chain, x, y, z, weight);
1082
+ }
1083
+ instanceBuffer(node, colours) {
1084
+ try {
1085
+ return colours ? this.port.instanceColors(node) : this.port.instanceMatrices(node);
1086
+ } catch {
1087
+ return null;
1088
+ }
1089
+ }
1090
+ markInstances(node) {
1091
+ this.port.markInstancesDirty(node);
1092
+ }
1093
+ stopClip(action, fadeSeconds = 0) {
1094
+ this.port.stopClip(action, fadeSeconds);
1095
+ }
1096
+ get clips() {
1097
+ return this.port.clips ?? this.unsupported("clip animation (actions, masks, blend spaces, IK, retargeting, root motion)");
1098
+ }
1099
+ get hasClipAnimation() {
1100
+ return this.port.clips !== void 0;
1101
+ }
1102
+ nodeOf(entity) {
1103
+ let row = this.renderables.row(entity);
1104
+ return row === -1 ? null : this.renderables.fields.node[row];
1105
+ }
1106
+ entityOfNode(node) {
1107
+ let nodes = this.renderables.fields.node, n = this.renderables.count;
1108
+ for (let row = 0; row < n; row++) if (nodes[row] === node) return this.renderables.entities[row];
1109
+ return chunkMRFUNRAP_js.NO_ENTITY;
1110
+ }
1111
+ readNodeMatrix(node, out, offset = 0) {
1112
+ this.port.readNodeMatrix(node, out, offset);
1113
+ }
1114
+ stats(out) {
1115
+ this.port.stats(out);
1116
+ }
1117
+ onDespawn(entity) {
1118
+ let row = this.renderables.row(entity);
1119
+ if (row === -1) return;
1120
+ let node = this.renderables.fields.node[row];
1121
+ node === this.activeCamera && (this.activeCamera = null), this.forget(node), this.port.destroyNode(node);
1122
+ }
1123
+ sync(time) {
1124
+ let store = this.renderables, transforms = this.transforms.store, n = store.count, count = 0;
1125
+ for (let r = 0; r < n; r++) {
1126
+ let row = transforms.row(store.entities[r]);
1127
+ row !== -1 && (this.nodeIds[count] = store.fields.node[r], this.matrixRows[count] = row, count++);
1128
+ }
1129
+ this.port.writeNodeMatrices(this.nodeIds, transforms.fields.render, this.matrixRows, count), this.port.advanceAnimations(time);
1130
+ }
1131
+ render(time) {
1132
+ this.scenery.frame(), this.port.render(time);
1133
+ }
1134
+ checkNode(desc) {
1135
+ let caps = this.port.capabilities;
1136
+ if (desc.kind === "skinned" && !caps.skinning && this.unsupported("skinning"), desc.kind === "instanced" && !caps.instancing && this.unsupported("instancing"), desc.kind === "particles" && !caps.particles && this.unsupported("particles"), desc.kind === "decal" && !caps.decals && this.unsupported("decals"), desc.kind === "camera" && desc.projection === "custom" && !caps.customProjection && this.unsupported("custom projections"), desc.kind === "light" && desc.light === "probe" && desc.sh !== void 0 && desc.sh.length < chunkIIDZ5WUX_js.SH_COEFFICIENT_FLOATS)
1137
+ throw new chunk2V7IL4HC_js.GameError("invalid_argument", `light probes take ${chunkIIDZ5WUX_js.SH_COEFFICIENT_FLOATS} coefficients (9 RGB)`);
1138
+ }
1139
+ checkShader(hasGlsl) {
1140
+ if (!(this.port.capabilities.shaderLanguages.indexOf("wgsl") >= 0) && !hasGlsl)
1141
+ throw new chunk2V7IL4HC_js.GameError(
1142
+ "shader_requires_translation",
1143
+ "this backend draws with WebGL2; the shader needs its admitted GLSL translation"
1144
+ );
1145
+ }
1146
+ unsupported(feature) {
1147
+ throw new chunk2V7IL4HC_js.GameError("unsupported_feature", `${this.port.capabilities.backend} does not support ${feature}`);
1148
+ }
1149
+ };
1150
+
1151
+ // src/interactives/meters/frames.ts
1152
+ var FRAME_WINDOW = 600, NO_MOMENT = 65535, MAX_MOMENTS = 64, MS_PER_SECOND = 1e3, NS_PER_MS = 1e6, P50 = 0.5, P95 = 0.95, P99 = 0.99;
1153
+ function percentile(sorted, share) {
1154
+ return sorted.length === 0 ? 0 : sorted[Math.min(sorted.length - 1, Math.floor(share * sorted.length))];
1155
+ }
1156
+ function smoothVerdict(fps, target = chunkVVE3Y76O_js.TARGET_HZ) {
1157
+ let share = fps / target;
1158
+ return share >= chunkVVE3Y76O_js.SMOOTH_SHARE ? "smooth" : share >= chunkVVE3Y76O_js.STUTTER_SHARE ? "slight" : "stutters";
1159
+ }
1160
+ function heatVerdict(busyShare, pressure) {
1161
+ return busyShare >= chunkVVE3Y76O_js.HOT_BUSY_SHARE || pressure >= chunkVVE3Y76O_js.HOT_PRESSURE ? "hot" : busyShare >= chunkVVE3Y76O_js.WARM_BUSY_SHARE || pressure >= chunkVVE3Y76O_js.WARM_PRESSURE ? "warm" : "cool";
1162
+ }
1163
+ var FrameRecorder = class {
1164
+ constructor() {
1165
+ this.frameMs = new Float64Array((600));
1166
+ this.moments = new Uint16Array((600));
1167
+ this.passNs = new Float64Array(chunkIIDZ5WUX_js.GPU_PASS_NAMES.length);
1168
+ this.labels = [];
1169
+ this.head = 0;
1170
+ this.count = 0;
1171
+ this.moment = (65535);
1172
+ this.gpuFrames = 0;
1173
+ this.busyNs = 0;
1174
+ this.spanNs = 0;
1175
+ this.pressure = 0;
1176
+ }
1177
+ mark(label) {
1178
+ if (label === null) {
1179
+ this.moment = (65535);
1180
+ return;
1181
+ }
1182
+ let index = this.labels.indexOf(label);
1183
+ index < 0 && this.labels.length < (64) && (index = this.labels.push(label) - 1), this.moment = index < 0 ? (65535) : index;
1184
+ }
1185
+ frame(seconds) {
1186
+ !(seconds > 0) || !Number.isFinite(seconds) || (this.frameMs[this.head] = seconds * (1e3), this.moments[this.head] = this.moment, this.head = (this.head + 1) % (600), this.count < (600) && this.count++, this.spanNs += seconds * (1e3) * (1e6));
1187
+ }
1188
+ gpu(lastNs, passNs, pressure) {
1189
+ lastNs > 0 && (this.busyNs += lastNs, this.gpuFrames++);
1190
+ for (let i = 0; i < this.passNs.length && i < passNs.length; i++) this.passNs[i] += passNs[i];
1191
+ pressure > this.pressure && (this.pressure = pressure);
1192
+ }
1193
+ reset() {
1194
+ this.head = 0, this.count = 0, this.gpuFrames = 0, this.busyNs = 0, this.spanNs = 0, this.pressure = 0, this.passNs.fill(0);
1195
+ }
1196
+ get frames() {
1197
+ return this.count;
1198
+ }
1199
+ heat() {
1200
+ let samples = this.gpuFrames, average = this.count === 0 ? 0 : this.spanNs / this.count, busyShare = samples === 0 || average === 0 ? 0 : Math.min(1, this.busyNs / samples / average);
1201
+ return { busyShare, pressure: this.pressure, heat: heatVerdict(busyShare, this.pressure) };
1202
+ }
1203
+ meter(tier, calibration = null, target = chunkVVE3Y76O_js.TARGET_HZ) {
1204
+ let scale = chunkVVE3Y76O_js.isCalibrated(calibration) ? calibration.frameScale : 1, sorted = this.frameMs.slice(0, this.count).sort();
1205
+ for (let i = 0; i < sorted.length; i++) sorted[i] *= scale;
1206
+ let p95 = percentile(sorted, (0.95)), fps = p95 > 0 ? Math.min(target, (1e3) / p95) : target;
1207
+ return {
1208
+ tier,
1209
+ frames: this.count,
1210
+ p50Ms: percentile(sorted, (0.5)),
1211
+ p95Ms: p95,
1212
+ p99Ms: percentile(sorted, (0.99)),
1213
+ fps,
1214
+ targetFps: target,
1215
+ smooth: smoothVerdict(fps, target),
1216
+ worstMoment: this.worstMoment(),
1217
+ causes: chunkVVE3Y76O_js.passCauses(this.passNs),
1218
+ calibrated: chunkVVE3Y76O_js.isCalibrated(calibration),
1219
+ device: chunkVVE3Y76O_js.isCalibrated(calibration) ? calibration.device : null
1220
+ };
1221
+ }
1222
+ worstMoment() {
1223
+ let worst = (65535), worstMs = 0;
1224
+ for (let m = 0; m < this.labels.length; m++) {
1225
+ let mine = [];
1226
+ for (let i = 0; i < this.count; i++) this.moments[i] === m && mine.push(this.frameMs[i]);
1227
+ if (mine.length === 0) continue;
1228
+ mine.sort((a, b) => a - b);
1229
+ let ms = mine[Math.min(mine.length - 1, Math.floor((0.95) * mine.length))];
1230
+ ms > worstMs && (worstMs = ms, worst = m);
1231
+ }
1232
+ return worst === (65535) ? null : this.labels[worst];
1233
+ }
1234
+ };
1235
+
1236
+ // src/interactives/meters/memory.ts
1237
+ var MemoryPeak = class {
1238
+ constructor() {
1239
+ this.script = 0;
1240
+ this.engine = 0;
1241
+ this.graphics = 0;
1242
+ }
1243
+ note(sample) {
1244
+ sample.scriptBytes > this.script && (this.script = sample.scriptBytes), sample.engineBytes > this.engine && (this.engine = sample.engineBytes), sample.graphicsBytes > this.graphics && (this.graphics = sample.graphicsBytes);
1245
+ }
1246
+ noteScript(bytes) {
1247
+ bytes > this.script && (this.script = bytes);
1248
+ }
1249
+ noteEngine(bytes) {
1250
+ bytes > this.engine && (this.engine = bytes);
1251
+ }
1252
+ noteGraphics(bytes) {
1253
+ bytes > this.graphics && (this.graphics = bytes);
1254
+ }
1255
+ reset() {
1256
+ this.script = 0, this.engine = 0, this.graphics = 0;
1257
+ }
1258
+ get peak() {
1259
+ return { scriptBytes: this.script, engineBytes: this.engine, graphicsBytes: this.graphics };
1260
+ }
1261
+ };
1262
+ function memoryMeter(sample, tier, calibration = null) {
1263
+ let scale = chunkVVE3Y76O_js.isCalibrated(calibration) ? calibration.memoryScale : 1, bytes = (sample.scriptBytes + sample.engineBytes + sample.graphicsBytes) * scale, ceiling = chunkVVE3Y76O_js.MEMORY_CEILING_BYTES[tier];
1264
+ return {
1265
+ tier,
1266
+ bytes,
1267
+ ceilingBytes: ceiling,
1268
+ memory: bytes > ceiling ? "too_much" : bytes > ceiling * chunkVVE3Y76O_js.TIGHT_MEMORY_SHARE ? "tight" : "fits",
1269
+ causes: chunkVVE3Y76O_js.rankCauses([
1270
+ { label: "Game code and data", cost: sample.scriptBytes },
1271
+ { label: "World, physics and sound", cost: sample.engineBytes },
1272
+ { label: "Pictures, models and screens", cost: sample.graphicsBytes }
1273
+ ]),
1274
+ calibrated: chunkVVE3Y76O_js.isCalibrated(calibration)
1275
+ };
1276
+ }
1277
+
1278
+ // src/interactives/meters/live.ts
1279
+ var GPU_SAMPLE_FRAMES = 30, QUALITY_FOR_TIER = {
1280
+ low: (2),
1281
+ mid: (1),
1282
+ high: (0)
1283
+ }, GameMeters = class {
1284
+ constructor(game, tier, calibrations = []) {
1285
+ this.game = game;
1286
+ this.calibrations = calibrations;
1287
+ this.recorder = new FrameRecorder();
1288
+ this.memory = new MemoryPeak();
1289
+ this.stats = chunkIIDZ5WUX_js.createGpuStats();
1290
+ this.forced = false;
1291
+ this.sinceGpu = 0;
1292
+ this.tier = tier;
1293
+ }
1294
+ get playingAs() {
1295
+ return this.tier;
1296
+ }
1297
+ get simulating() {
1298
+ return this.forced;
1299
+ }
1300
+ playAs(tier) {
1301
+ let graphics = this.game.graphics;
1302
+ if (tier === null)
1303
+ return graphics.forceQualityTier(null), this.forced = false, this.reset(), true;
1304
+ let pinned = graphics.forceQualityTier(QUALITY_FOR_TIER[tier]);
1305
+ return this.forced = pinned, pinned && (this.tier = tier), this.reset(), pinned;
1306
+ }
1307
+ measureAs(tier, pin) {
1308
+ return pin ? this.playAs(tier) : (this.forced && this.game.graphics.forceQualityTier(null), this.forced = false, this.tier = tier, this.reset(), true);
1309
+ }
1310
+ moment(label) {
1311
+ this.recorder.mark(label);
1312
+ }
1313
+ update() {
1314
+ if (this.recorder.frame(this.game.clock[chunkYXGZQPUD_js.FRAME_SECONDS_SLOT]), ++this.sinceGpu < (30)) return;
1315
+ this.sinceGpu = 0;
1316
+ let graphics = this.game.graphics;
1317
+ graphics.gpuStats(this.stats) && (this.recorder.gpu(this.stats.gpuP50Ns, this.stats.passNs, graphics.governorPressure()), this.memory.noteGraphics(this.stats.gpuBytes));
1318
+ }
1319
+ noteInspector(readout) {
1320
+ this.memory.noteEngine(readout.arena.highWaterBytes);
1321
+ }
1322
+ noteScriptHeap(bytes) {
1323
+ this.memory.noteScript(bytes);
1324
+ }
1325
+ reset() {
1326
+ this.recorder.reset(), this.memory.reset(), this.sinceGpu = 0;
1327
+ }
1328
+ read() {
1329
+ let calibration = chunkVVE3Y76O_js.calibrationFor(this.calibrations, this.tier);
1330
+ return {
1331
+ tier: this.tier,
1332
+ asTier: this.forced,
1333
+ frames: this.recorder.meter(this.tier, calibration),
1334
+ heat: this.recorder.heat(),
1335
+ memory: memoryMeter(this.memory.peak, this.tier, calibration)
1336
+ };
1337
+ }
1338
+ };
1339
+
1340
+ exports.ComponentStore = ComponentStore;
1341
+ exports.FRAME_WINDOW = (600);
1342
+ exports.FrameRecorder = FrameRecorder;
1343
+ exports.GPU_SAMPLE_FRAMES = (30);
1344
+ exports.GameMeters = GameMeters;
1345
+ exports.Graphics = Graphics;
1346
+ exports.GraphicsScenery = GraphicsScenery;
1347
+ exports.MAX_MOMENTS = (64);
1348
+ exports.MemoryPeak = MemoryPeak;
1349
+ exports.QUALITY_FOR_TIER = QUALITY_FOR_TIER;
1350
+ exports.Renderable = Renderable;
1351
+ exports.SCENERY_CHUNK_EXTENSION = SCENERY_CHUNK_EXTENSION;
1352
+ exports.SCENERY_LOAD_SHARE = (1.1);
1353
+ exports.SCENERY_MANIFEST_MAGIC = (1297109827);
1354
+ exports.SCENERY_MANIFEST_VERSION = (1);
1355
+ exports.SCENERY_MANIFEST_VERSION_PARTS = (2);
1356
+ exports.SCENERY_NEED_SHARE = (3);
1357
+ exports.SCENERY_PART_COARSE = (0);
1358
+ exports.SCENERY_PART_FINE = (2);
1359
+ exports.SCENERY_PART_MIDDLE = (1);
1360
+ exports.SCENERY_PART_WHOLE = (255);
1361
+ exports.SCENERY_TIER_RADII = SCENERY_TIER_RADII;
1362
+ exports.Scenery = Scenery;
1363
+ exports.defineComponent = defineComponent;
1364
+ exports.heatVerdict = heatVerdict;
1365
+ exports.memoryMeter = memoryMeter;
1366
+ exports.parseSceneryManifest = parseSceneryManifest;
1367
+ exports.sceneryEntryRows = sceneryEntryRows;
1368
+ exports.sceneryFirstView = sceneryFirstView;
1369
+ exports.sceneryPartDrawLevel = sceneryPartDrawLevel;
1370
+ exports.sceneryPartReach = sceneryPartReach;
1371
+ exports.sceneryPrefetchItems = sceneryPrefetchItems;
1372
+ exports.sceneryTierRadii = sceneryTierRadii;
1373
+ exports.smoothVerdict = smoothVerdict;