@needle-tools/engine 4.1.0-experimental.12 → 4.1.0

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 (238) hide show
  1. package/CHANGELOG.md +72 -10
  2. package/README.md +28 -17
  3. package/components.needle.json +1 -1
  4. package/dist/gltf-progressive.js +220 -221
  5. package/dist/gltf-progressive.light.js +220 -221
  6. package/dist/gltf-progressive.light.min.js +6 -6
  7. package/dist/gltf-progressive.light.umd.cjs +7 -7
  8. package/dist/gltf-progressive.min.js +6 -6
  9. package/dist/gltf-progressive.umd.cjs +7 -7
  10. package/dist/needle-engine.bundle.js +8286 -7952
  11. package/dist/needle-engine.bundle.light.js +8239 -7905
  12. package/dist/needle-engine.bundle.light.min.js +270 -227
  13. package/dist/needle-engine.bundle.light.umd.cjs +181 -138
  14. package/dist/needle-engine.bundle.min.js +270 -227
  15. package/dist/needle-engine.bundle.umd.cjs +177 -134
  16. package/dist/needle-engine.d.ts +140 -0
  17. package/dist/needle-engine.js +597 -590
  18. package/dist/needle-engine.light.d.ts +140 -0
  19. package/dist/needle-engine.light.js +597 -590
  20. package/dist/needle-engine.light.min.js +1 -1
  21. package/dist/needle-engine.light.umd.cjs +1 -1
  22. package/dist/needle-engine.min.js +1 -1
  23. package/dist/needle-engine.umd.cjs +1 -1
  24. package/dist/postprocessing.js +1 -1
  25. package/dist/postprocessing.light.js +1 -1
  26. package/dist/postprocessing.light.min.js +1 -1
  27. package/dist/postprocessing.min.js +1 -1
  28. package/dist/three-examples.js +2809 -2450
  29. package/dist/three-examples.light.js +2809 -2450
  30. package/dist/three-examples.light.min.js +47 -15
  31. package/dist/three-examples.light.umd.cjs +47 -15
  32. package/dist/three-examples.min.js +47 -15
  33. package/dist/three-examples.umd.cjs +47 -15
  34. package/dist/three-mesh-ui.js +1 -1
  35. package/dist/three-mesh-ui.light.js +1 -1
  36. package/dist/three-mesh-ui.light.min.js +1 -1
  37. package/dist/three-mesh-ui.min.js +1 -1
  38. package/dist/three.js +577 -572
  39. package/dist/three.light.js +577 -572
  40. package/dist/three.light.min.js +170 -170
  41. package/dist/three.light.umd.cjs +170 -170
  42. package/dist/three.min.js +170 -170
  43. package/dist/three.umd.cjs +170 -170
  44. package/dist/vendor.js +1327 -1331
  45. package/dist/vendor.light.js +1327 -1331
  46. package/dist/vendor.light.min.js +33 -33
  47. package/dist/vendor.light.umd.cjs +33 -33
  48. package/dist/vendor.min.js +33 -33
  49. package/dist/vendor.umd.cjs +33 -33
  50. package/lib/engine/assets/index.js.map +1 -1
  51. package/lib/engine/engine.d.ts +4 -0
  52. package/lib/engine/engine.js +12 -0
  53. package/lib/engine/engine.js.map +1 -0
  54. package/lib/engine/engine_addressables.d.ts +6 -4
  55. package/lib/engine/engine_addressables.js +8 -1
  56. package/lib/engine/engine_addressables.js.map +1 -1
  57. package/lib/engine/engine_context.d.ts +3 -2
  58. package/lib/engine/engine_context.js +28 -4
  59. package/lib/engine/engine_context.js.map +1 -1
  60. package/lib/engine/engine_gameobject.d.ts +2 -12
  61. package/lib/engine/engine_gameobject.js +5 -15
  62. package/lib/engine/engine_gameobject.js.map +1 -1
  63. package/lib/engine/engine_gltf_builtin_components.js +5 -0
  64. package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
  65. package/lib/engine/engine_input.d.ts +19 -6
  66. package/lib/engine/engine_input.js +0 -10
  67. package/lib/engine/engine_input.js.map +1 -1
  68. package/lib/engine/engine_license.js +1 -1
  69. package/lib/engine/engine_license.js.map +1 -1
  70. package/lib/engine/engine_modules.d.ts +7 -0
  71. package/lib/engine/engine_modules.js +7 -0
  72. package/lib/engine/engine_modules.js.map +1 -1
  73. package/lib/engine/engine_networking_auto.js +6 -11
  74. package/lib/engine/engine_networking_auto.js.map +1 -1
  75. package/lib/engine/engine_networking_instantiate.d.ts +1 -1
  76. package/lib/engine/engine_physics_rapier.d.ts +6 -4
  77. package/lib/engine/engine_physics_rapier.js +38 -24
  78. package/lib/engine/engine_physics_rapier.js.map +1 -1
  79. package/lib/engine/engine_scenetools.js +6 -2
  80. package/lib/engine/engine_scenetools.js.map +1 -1
  81. package/lib/engine/engine_types.d.ts +9 -2
  82. package/lib/engine/engine_types.js +6 -0
  83. package/lib/engine/engine_types.js.map +1 -1
  84. package/lib/engine/engine_web_api.d.ts +12 -0
  85. package/lib/engine/engine_web_api.js +113 -0
  86. package/lib/engine/engine_web_api.js.map +1 -0
  87. package/lib/engine/export/gltf/Writers.js.map +1 -1
  88. package/lib/engine/export/gltf/index.js +11 -1
  89. package/lib/engine/export/gltf/index.js.map +1 -1
  90. package/lib/engine/export/utils.d.ts +2 -0
  91. package/lib/engine/export/utils.js +8 -0
  92. package/lib/engine/export/utils.js.map +1 -0
  93. package/lib/engine/extensions/NEEDLE_gameobject_data.js +1 -1
  94. package/lib/engine/extensions/NEEDLE_gameobject_data.js.map +1 -1
  95. package/lib/engine/js-extensions/Object3D.d.ts +5 -1
  96. package/lib/engine/js-extensions/Object3D.js.map +1 -1
  97. package/lib/engine/webcomponents/needle menu/needle-menu.js +8 -2
  98. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  99. package/lib/engine/xr/NeedleXRSession.js +3 -0
  100. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  101. package/lib/engine-components/AvatarLoader.js.map +1 -1
  102. package/lib/engine-components/Camera.d.ts +7 -4
  103. package/lib/engine-components/Camera.js +13 -10
  104. package/lib/engine-components/Camera.js.map +1 -1
  105. package/lib/engine-components/Collider.js +4 -5
  106. package/lib/engine-components/Collider.js.map +1 -1
  107. package/lib/engine-components/Component.d.ts +4 -3
  108. package/lib/engine-components/Component.js +6 -7
  109. package/lib/engine-components/Component.js.map +1 -1
  110. package/lib/engine-components/ContactShadows.d.ts +1 -1
  111. package/lib/engine-components/ContactShadows.js +7 -0
  112. package/lib/engine-components/ContactShadows.js.map +1 -1
  113. package/lib/engine-components/FlyControls.d.ts +10 -0
  114. package/lib/engine-components/FlyControls.js +29 -0
  115. package/lib/engine-components/FlyControls.js.map +1 -0
  116. package/lib/engine-components/GroundProjection.d.ts +1 -1
  117. package/lib/engine-components/GroundProjection.js +39 -32
  118. package/lib/engine-components/GroundProjection.js.map +1 -1
  119. package/lib/engine-components/OrbitControls.js +9 -1
  120. package/lib/engine-components/OrbitControls.js.map +1 -1
  121. package/lib/engine-components/RigidBody.d.ts +1 -0
  122. package/lib/engine-components/RigidBody.js +11 -4
  123. package/lib/engine-components/RigidBody.js.map +1 -1
  124. package/lib/engine-components/SceneSwitcher.d.ts +1 -1
  125. package/lib/engine-components/SceneSwitcher.js +1 -1
  126. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  127. package/lib/engine-components/SpatialTrigger.d.ts +2 -2
  128. package/lib/engine-components/SpatialTrigger.js +4 -4
  129. package/lib/engine-components/SpatialTrigger.js.map +1 -1
  130. package/lib/engine-components/TransformGizmo.d.ts +7 -1
  131. package/lib/engine-components/TransformGizmo.js +39 -32
  132. package/lib/engine-components/TransformGizmo.js.map +1 -1
  133. package/lib/engine-components/VideoPlayer.js +0 -1
  134. package/lib/engine-components/VideoPlayer.js.map +1 -1
  135. package/lib/engine-components/export/gltf/GltfExport.js +23 -4
  136. package/lib/engine-components/export/gltf/GltfExport.js.map +1 -1
  137. package/lib/engine-components/export/usdz/ThreeUSDZExporter.d.ts +1 -1
  138. package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +2 -2
  139. package/lib/engine-components/export/usdz/index.d.ts +1 -1
  140. package/lib/engine-components/export/usdz/index.js +1 -1
  141. package/lib/engine-components/export/usdz/index.js.map +1 -1
  142. package/lib/engine-components/particlesystem/ParticleSystem.d.ts +5 -6
  143. package/lib/engine-components/particlesystem/ParticleSystem.js +23 -9
  144. package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
  145. package/lib/engine-components/particlesystem/ParticleSystemModules.js +8 -2
  146. package/lib/engine-components/particlesystem/ParticleSystemModules.js.map +1 -1
  147. package/lib/engine-components/postprocessing/Effects/Antialiasing.js.map +1 -1
  148. package/lib/engine-components/postprocessing/Effects/BloomEffect.js.map +1 -1
  149. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js.map +1 -1
  150. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js.map +1 -1
  151. package/lib/engine-components/postprocessing/Effects/Pixelation.js.map +1 -1
  152. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js.map +1 -1
  153. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js.map +1 -1
  154. package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +2 -0
  155. package/lib/engine-components/postprocessing/Effects/Sharpening.js +29 -20
  156. package/lib/engine-components/postprocessing/Effects/Sharpening.js.map +1 -1
  157. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js.map +1 -1
  158. package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
  159. package/lib/engine-components/postprocessing/Effects/Vignette.js.map +1 -1
  160. package/lib/engine-components/postprocessing/PostProcessingHandler.js +1 -1
  161. package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
  162. package/lib/engine-components/webxr/Avatar.js +3 -3
  163. package/lib/engine-components/webxr/Avatar.js.map +1 -1
  164. package/lib/engine-components/webxr/WebXR.js +22 -13
  165. package/lib/engine-components/webxr/WebXR.js.map +1 -1
  166. package/lib/engine-components/webxr/WebXRImageTracking.d.ts +4 -0
  167. package/lib/engine-components/webxr/WebXRImageTracking.js +14 -4
  168. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  169. package/lib/engine-components/webxr/WebXRRig.d.ts +11 -1
  170. package/lib/engine-components/webxr/WebXRRig.js +13 -1
  171. package/lib/engine-components/webxr/WebXRRig.js.map +1 -1
  172. package/lib/engine-components-experimental/networking/PlayerSync.d.ts +4 -1
  173. package/lib/engine-components-experimental/networking/PlayerSync.js +18 -30
  174. package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
  175. package/lib/needle-engine.js +5 -5
  176. package/lib/needle-engine.js.map +1 -1
  177. package/package.json +14 -8
  178. package/plugins/common/config.cjs +22 -6
  179. package/plugins/common/config.js +27 -11
  180. package/plugins/next/next.js +47 -4
  181. package/plugins/vite/transform.js +3 -3
  182. package/src/engine/assets/index.ts +1 -0
  183. package/src/engine/codegen/register_types.ts +2 -2
  184. package/src/engine/engine_addressables.ts +19 -12
  185. package/src/engine/engine_context.ts +33 -8
  186. package/src/engine/engine_gameobject.ts +12 -16
  187. package/src/engine/engine_gltf_builtin_components.ts +7 -1
  188. package/src/engine/engine_input.ts +12 -5
  189. package/src/engine/engine_license.ts +2 -1
  190. package/src/engine/engine_modules.ts +7 -0
  191. package/src/engine/engine_networking_auto.ts +7 -22
  192. package/src/engine/engine_networking_instantiate.ts +1 -1
  193. package/src/engine/engine_physics_rapier.ts +48 -26
  194. package/src/engine/engine_scenetools.ts +6 -2
  195. package/src/engine/engine_types.ts +10 -2
  196. package/src/engine/export/gltf/Writers.ts +0 -1
  197. package/src/engine/export/gltf/index.ts +13 -3
  198. package/src/engine/export/index.ts +1 -1
  199. package/src/engine/export/utils.ts +10 -0
  200. package/src/engine/extensions/NEEDLE_gameobject_data.ts +1 -2
  201. package/src/engine/js-extensions/Object3D.ts +6 -1
  202. package/src/engine/webcomponents/needle menu/needle-menu.ts +16 -10
  203. package/src/engine/xr/NeedleXRSession.ts +4 -1
  204. package/src/engine-components/AvatarLoader.ts +1 -1
  205. package/src/engine-components/Camera.ts +14 -11
  206. package/src/engine-components/Collider.ts +4 -4
  207. package/src/engine-components/Component.ts +13 -7
  208. package/src/engine-components/ContactShadows.ts +11 -2
  209. package/src/engine-components/GroundProjection.ts +46 -38
  210. package/src/engine-components/OrbitControls.ts +9 -1
  211. package/src/engine-components/RigidBody.ts +13 -5
  212. package/src/engine-components/SceneSwitcher.ts +1 -1
  213. package/src/engine-components/SpatialTrigger.ts +6 -6
  214. package/src/engine-components/TransformGizmo.ts +41 -33
  215. package/src/engine-components/VideoPlayer.ts +0 -1
  216. package/src/engine-components/export/gltf/GltfExport.ts +26 -6
  217. package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +2 -2
  218. package/src/engine-components/export/usdz/index.ts +1 -1
  219. package/src/engine-components/particlesystem/ParticleSystem.ts +26 -10
  220. package/src/engine-components/particlesystem/ParticleSystemModules.ts +10 -3
  221. package/src/engine-components/postprocessing/Effects/Antialiasing.ts +0 -1
  222. package/src/engine-components/postprocessing/Effects/BloomEffect.ts +1 -1
  223. package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +1 -1
  224. package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +1 -1
  225. package/src/engine-components/postprocessing/Effects/Pixelation.ts +1 -1
  226. package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +1 -1
  227. package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +1 -1
  228. package/src/engine-components/postprocessing/Effects/Sharpening.ts +32 -21
  229. package/src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +0 -1
  230. package/src/engine-components/postprocessing/Effects/Tonemapping.ts +1 -1
  231. package/src/engine-components/postprocessing/Effects/Vignette.ts +1 -1
  232. package/src/engine-components/postprocessing/PostProcessingHandler.ts +2 -3
  233. package/src/engine-components/webxr/Avatar.ts +3 -3
  234. package/src/engine-components/webxr/WebXR.ts +23 -14
  235. package/src/engine-components/webxr/WebXRImageTracking.ts +23 -8
  236. package/src/engine-components/webxr/WebXRRig.ts +15 -2
  237. package/src/engine-components-experimental/networking/PlayerSync.ts +18 -37
  238. package/src/needle-engine.ts +5 -5
@@ -1,7 +1,7 @@
1
1
  var It = Object.defineProperty;
2
2
  var Ct = (i, e, t) => e in i ? It(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
3
  var I = (i, e, t) => (Ct(i, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { ax as Rt, I as Bt, B as Ut, l as At, D as Tt, aw as Mt, ab as Ft, aq as Ot, b3 as Lt, M as zt, q as Wt, O as Et, Y as Dt, P as Ht, k as Gt, T as $t, b as Nt, g as Xt, V as jt, h as Yt } from "./three.js";
4
+ import { ax as Rt, I as Bt, B as Ut, k as At, D as Tt, aw as Mt, ab as Ft, aq as Ot, b3 as Lt, M as zt, q as Wt, O as Et, Y as Dt, P as Ht, j as Gt, T as $t, a as Nt, f as Xt, V as jt, g as Yt } from "./three.js";
5
5
  var V = {};
6
6
  V.d = (i, e) => {
7
7
  for (var t in e)
@@ -1,7 +1,7 @@
1
1
  var It = Object.defineProperty;
2
2
  var Ct = (i, e, t) => e in i ? It(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
3
  var I = (i, e, t) => (Ct(i, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { ax as Rt, I as Bt, B as Ut, l as At, D as Tt, aw as Mt, ab as Ft, aq as Ot, b3 as Lt, M as zt, q as Wt, O as Et, Y as Dt, P as Ht, k as Gt, T as $t, b as Nt, g as Xt, V as jt, h as Yt } from "./three.light.js";
4
+ import { ax as Rt, I as Bt, B as Ut, k as At, D as Tt, aw as Mt, ab as Ft, aq as Ot, b3 as Lt, M as zt, q as Wt, O as Et, Y as Dt, P as Ht, j as Gt, T as $t, a as Nt, f as Xt, V as jt, g as Yt } from "./three.light.js";
5
5
  var V = {};
6
6
  V.d = (i, e) => {
7
7
  for (var t in e)
@@ -1,4 +1,4 @@
1
- var Tt=Object.defineProperty,Ft=(s,e,t)=>e in s?Tt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,M=(s,e,t)=>(Ft(s,typeof e!="symbol"?e+"":e,t),t);import{ax as Ot,I as zt,B as At,l as Wt,D as Dt,aw as Et,ab as Lt,aq as Ht,b3 as Gt,M as $t,q as jt,O as Xt,Y as Yt,P as Nt,k as Kt,T as qt,b as Jt,g as Qt,V as Zt,h as es}from"./three.light.min.js";var V={};V.d=(s,e)=>{for(var t in e)V.o(e,t)&&!V.o(s,t)&&Object.defineProperty(s,t,{enumerable:!0,get:e[t]})},V.o=(s,e)=>Object.prototype.hasOwnProperty.call(s,e),V.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var m={};V.d(m,{ti:()=>p,nS:()=>yt,eB:()=>z,Yp:()=>Z,VB:()=>C,BC:()=>I,zN:()=>R,cV:()=>P,hW:()=>W,k2:()=>Fe,K6:()=>w,M7:()=>ee,ls:()=>F,Hi:()=>Qe,EY:()=>A,MR:()=>Ge,zf:()=>Te,Ay:()=>gr,yo:()=>xt});var Z={};V.r(Z),V.d(Z,{get:()=>Ce,set:()=>ts});var ee={};V.r(ee),V.d(ee,{alphaTestTransformer:()=>G,asPreprocessorValueTransformer:()=>$e,toPreprocessorTriggerTransformer:()=>pe,toUserDataTransformer:()=>di,uniformOrUserDataTransformer:()=>x});const te={fontFamily:null,fontSize:.05,fontKerning:"auto",fontStyle:"normal",fontWeight:"normal",offset:.005,lineHeight:1.2,lineBreak:`- ,.:?!
1
+ var Tt=Object.defineProperty,Ft=(s,e,t)=>e in s?Tt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,M=(s,e,t)=>(Ft(s,typeof e!="symbol"?e+"":e,t),t);import{ax as Ot,I as zt,B as At,k as Wt,D as Dt,aw as Et,ab as Lt,aq as Ht,b3 as Gt,M as $t,q as jt,O as Xt,Y as Yt,P as Nt,j as Kt,T as qt,a as Jt,f as Qt,V as Zt,g as es}from"./three.light.min.js";var V={};V.d=(s,e)=>{for(var t in e)V.o(e,t)&&!V.o(s,t)&&Object.defineProperty(s,t,{enumerable:!0,get:e[t]})},V.o=(s,e)=>Object.prototype.hasOwnProperty.call(s,e),V.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var m={};V.d(m,{ti:()=>p,nS:()=>yt,eB:()=>z,Yp:()=>Z,VB:()=>C,BC:()=>I,zN:()=>R,cV:()=>P,hW:()=>W,k2:()=>Fe,K6:()=>w,M7:()=>ee,ls:()=>F,Hi:()=>Qe,EY:()=>A,MR:()=>Ge,zf:()=>Te,Ay:()=>gr,yo:()=>xt});var Z={};V.r(Z),V.d(Z,{get:()=>Ce,set:()=>ts});var ee={};V.r(ee),V.d(ee,{alphaTestTransformer:()=>G,asPreprocessorValueTransformer:()=>$e,toPreprocessorTriggerTransformer:()=>pe,toUserDataTransformer:()=>di,uniformOrUserDataTransformer:()=>x});const te={fontFamily:null,fontSize:.05,fontKerning:"auto",fontStyle:"normal",fontWeight:"normal",offset:.005,lineHeight:1.2,lineBreak:`- ,.:?!
2
2
  `,whiteSpace:"pre-line",flexDirection:"column",justifyContent:"start",alignItems:"start",backgroundImage:null,textAlign:"left",boxSizing:"content-box",position:"static",color:16777215,fontColor:16777215,fontOpacity:1,opacity:1,fontPXRange:4,fontSupersampling:!0,fontSmooth:"antialiased",borderRadius:0,borderWidth:0,borderColor:"black",borderOpacity:1,backgroundSize:"cover",backgroundColor:0,backgroundOpacity:0,overflow:"visible",letterSpacing:0,invertAlpha:!1,segments:1},ts=function(s){for(const e in s)te[e]=s[e]},Ce=function(s){return Object.prototype.hasOwnProperty.call(te,s)||console.warn(`ThreeMeshUI::DefaultValues is trying to retrieve non-existing property '${s}'`),te[s]};class p{constructor(e,t=null,i=!0){this._id=e,this._value=t,this._needsUpdate=!0,this._needsProcess=!1,this._needsRender=!1,this._isPrimitive=i}get id(){return this._id}get value(){return this._value}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}update(e,t){this.output(t)}output(e){}_outputValue(e){e[this._id]=this._value}process(e){}render(e){}getInheritedInput(e){if(this._value!=="inherit")return this._value;const t=e._parent._value;return t&&t[`_${this._id}`]?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}getDefaultValue(){return Ce(this._id)}isValid(e){return!0}emptyStrategyLogic(){throw new Error(`ThreeMeshUI::${this.constructor.name} has empty strategy. Update has not been processed.`)}requestUpdate(){this._needsUpdate=!0}requestProcess(){this._needsProcess=!1}requestRender(){this._needsRender=!1}}class ss extends p{constructor(){super("renderOrder","auto",!0),this.output=this._outputValue,this._actualValue=0}set value(e){this.isValid(e)&&(this._value=e,this._needsUpdate=!0)}update(e,t){if(this._value!=="auto")this._actualValue=this._value;else{const i=e._parent._value;if(i!==null){const n=i._renderOrder._actualValue,r=1+i._children._uis.indexOf(e);this._actualValue=n+r}}for(const i of e._children._uis)i._renderOrder._value==="auto"&&(i._renderOrder._needsUpdate=!0);this._outputValue(t)}_outputValue(e){e[this._id]=this._actualValue}get value(){return this._value}}class R extends p{constructor(e,t=null,i=!0){super(e,t,i),this.output=this._outputValue,this._notInheritedValue=null}update(e,t){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(e)),this.propagate(e),this._outputValue(t)}propagate(e){for(const t of e._children._uis){const i=t[`_${this._id}`];i!==void 0&&i._value==="inherit"&&(t[`_${this._id}`]._needsUpdate=!0)}}_outputValue(e){e[this._id]=this._notInheritedValue}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class is extends R{constructor(){super("offset","inherit",!1)}update(e,t){super.update(e,t),e._parent._value!==null&&(e.position.z=this._notInheritedValue)}}class ns extends R{constructor(){super("fontSmooth","inherit",!0),this._needsUpdate=!1,this.isValid=os,this.output=this._outputValue}}const rs=["inherit","none","antialiased"];function os(s){return rs.indexOf(s)===-1?(console.warn(`.fontSmoothing value '${s}' is not valid. Aborted`),!1):!0}var as=s=>{var e={};return V.d(e,s),e};const a=as({BackSide:()=>Ot,BufferAttribute:()=>zt,BufferGeometry:()=>At,Color:()=>Wt,DoubleSide:()=>Dt,EventDispatcher:()=>Et,FileLoader:()=>Lt,FrontSide:()=>Ht,LinearFilter:()=>Gt,Mesh:()=>$t,MeshBasicMaterial:()=>jt,Object3D:()=>Xt,Plane:()=>Yt,PlaneGeometry:()=>Nt,ShaderMaterial:()=>Kt,Texture:()=>qt,TextureLoader:()=>Jt,Vector2:()=>Qt,Vector3:()=>Zt,Vector4:()=>es});class g extends p{constructor(e,t,i=!0){super(e,"unset",i),this._input="inherit",this._allowsInherit=!0,this._inheritedInput=void 0,this._inline=void 0}update(e,t){this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const i of e._children._uis){const n=i[`_${this._id}`];(n._input?n._input:n._value)==="inherit"&&(i[`_${this._id}`]._needsUpdate=!0)}this.output(t)}computeOutputValue(e){this._value=this._input}_computeFromInherited(e){this._value=this._inheritedInput}set value(e){console.warn(".(style) sub-property cannot be directly set. It must comes from inline or computed setter.")}set inline(e){this.isValidValue(e)&&e!==this._inline&&(this._input=this._inline=e,this._needsUpdate=!0)}get inline(){return this._inline}isValidValue(e){return!0}getInheritedInput(e){if(this._input!=="inherit")return this._input;const t=e._parent._value;return t?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}}class D extends g{constructor(e,t){super(e,t,!1),this._input=new a.Vector4(0,0,0,0),this._inline=null,this._value=new a.Vector4(0,0,0,0)}get value(){return this._value}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input)}set inline(e){this._vector4ValueSetter(this._input,e),!this._input.equals(this._value)&&(this._needsUpdate=!0)}set top(e){this._input.x!==e&&(this._input.x=e,this._needsUpdate=!0)}get top(){return this._input.x}set right(e){this._input.y!==e&&(this._input.y=e,this._needsUpdate=!0)}get right(){return this._input.y}set bottom(e){this._input.z!==e&&(this._input.z=e,this._needsUpdate=!0)}get bottom(){return this._input.z}set left(e){this._input.w!==e&&(this._input.w=e,this._needsUpdate=!0)}get left(){return this._input.w}dispose(){this._computed=null,this._inline=null,this._input=null,this._output=null}_vector4ValueSetter(e,t){if(t instanceof a.Vector4){e.copy(t);return}if((typeof t=="string"||t instanceof String)&&(t=t.split(" ")),Array.isArray(t))switch(t=t.map(i=>parseFloat(i)),t.length){case 1:e.setScalar(t[0]);return;case 2:e.x=e.z=t[0],e.y=e.w=t[1];return;case 3:e.x=t[0],e.y=t[1],e.z=t[2];return;case 4:e.x=t[0],e.y=t[1],e.z=t[2],e.w=t[3];return;default:console.error("StyleVector4Property::set() Four Dimension property had more than four values");return}isNaN(t)||e.setScalar(t)}}class ls extends D{constructor(){super("padding",new a.Vector4(0,0,0,0))}computeOutputValue(e){super.computeOutputValue(e),e._bounds._needsUpdate=!0,e._bounds._needsRender=!0,e._layouter._needsProcess=!0,e._renderer._needsRender=!0,e._parent._value&&(e._parent._value._layouter._needsProcess=!0)}}class hs extends D{constructor(){super("margin",new a.Vector4(0,0,0,0))}computeOutputValue(e){super.computeOutputValue(e),e._renderer._needsRender=!0,e._parent._value&&(e._parent._value._flexDirection._needsProcess=!0)}}const Me=function(s,e,t){s[e]=t},us=function(s,e,t){t!==null&&(s[e]=t)};class E{constructor(e){this._definition=e}set definition(e){this._definition=e}mediate(e,t,i,n=null){for(const r in this._definition){const o=this._definition[r];if(i[r]!==void 0){const h=o.t?o.t:Me;h(t,o.m,i[r]),n&&h(n,o.m,i[r])}}}static mediate(e,t,i,n,r=null){if(t)for(const o in n){const h=n[o];if(i[o]!==void 0){const c=h.t?h.t:Me;c(t,h.m,i[o]),r&&c(r,h.m,i[o])}}}}class cs extends p{constructor(){super("parent",null,!1)}update(e,t){e.parent&&e.parent.isUI?this._value=e.parent:this._value=null}set value(e){console.warn("ParentProperty is readonly")}get value(){return this._value}find(e){return this._value?e(this._value)?this._value:this._value._parent.find(e):null}dispose(){this._value=null}}const se=function(s,e,t=6){return s.toFixed(t)===e.toFixed(t)};class Be extends p{constructor(e,t){super(e,t,!0),this.output=this._outputValue}set value(e){this.isValid(e)&&(se(this._value,e)||(this._value=e,this._needsUpdate=!0))}get value(){return this._value}}class Pe extends R{constructor(e){super(e,"inherit",!0),this.isValid=_s}}const ds=[a.FrontSide,a.BackSide,a.DoubleSide];function _s(s){return ds.indexOf(s)===-1?(console.warn(`SideProperty value '${s}' is not valid. Abort`),!1):!0}class Ie{constructor(){this._offsetX=0,this._offsetY=0,this._lineBreak=null,this._kerning=0,this._fontFactor=1,this._fontSize=0,this._cumulativeWidth=0,this._paddingLeft=0,this._paddingRight=0,this._marginLeft=0,this._marginRight=0}resetOffsets(){this._offsetX=this._offsetY=0,this._cumulativeWidth=0}get xadvance(){return 0}get xoffset(){return 0}get yoffset(){return 0}get width(){return 0}get height(){return 0}set lineBreak(e){this._lineBreak=e}get lineBreak(){return this._lineBreak}get anchor(){return 0}get kerning(){return this._kerning*this._fontFactor}set kerning(e){this._kerning=e}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize=e}get lineHeight(){return 0}get offsetX(){return this._offsetX}set offsetX(e){this._offsetX=e}get offsetY(){return this._offsetY}set offsetY(e){this._offsetY=e}get cumulativeWidth(){return this._cumulativeWidth}set cumulativeWidth(e){this._cumulativeWidth=e}get marginLeft(){return this._marginLeft}set marginLeft(e){this._marginLeft=e}get marginRight(){return this._marginRight}set marginRight(e){this._marginRight=e}get paddingLeft(){return this._paddingLeft}set paddingLeft(e){this._paddingLeft=e}get paddingRight(){return this._paddingRight}set paddingRight(e){this._paddingRight=e}get lineBase(){return 0}set fontFactor(e){this._fontFactor=e}get fontFactor(){return this._fontFactor}}class Te{constructor(e){this._char="",this._width=1,this._heigth=1,this._xadvance=1,this._xoffset=0,this._yoffset=0,this._font=e}get font(){return this._font}get char(){return this._char}get width(){return this._width}get height(){return this._heigth}get xadvance(){return this._xadvance}get xoffset(){return this._xoffset}get yoffset(){return this._yoffset}set yoffset(e){this._yoffset=e}clone(e){throw new Error("Abstract... Need to be implemented")}asInlineGlyph(){throw new Error("Abstract... Need to be implemented")}}class Fe extends Ie{constructor(e){super(),this._typographic=e}get typographic(){return this._typographic}get xadvance(){return this._typographic.xadvance*this._fontFactor}get xoffset(){return this._typographic.xoffset*this._fontFactor}get yoffset(){return this._typographic.yoffset*this._fontFactor}get width(){return this._typographic.width*this._fontFactor}get height(){return this._typographic.height*this._fontFactor}get char(){return this._typographic.char}get anchor(){return this.yoffset}get lineHeight(){return this._typographic.font.lineHeight*this._fontFactor}get lineBase(){return this._typographic.font.lineBase*this._fontFactor}}const ps={light:"100",normal:"400",bold:"700",bolder:"900"};function ie(s){return isNaN(s)?ps[s]||s:s.toString()}class fs extends a.EventDispatcher{constructor(e,t){super(),this._isReady=!1,this._weight=ie(e),this._style=t,this._size=42,this._lineHeight=42,this._lineBase=42,this._font=null}get typographic(){return this._font}get isReady(){return this._isReady}get weight(){return this._weight}get style(){return this._style}get texture(){return this._texture}set fontMaterial(e){throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`)}get fontMaterial(){throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`)}get id(){return`${this._name}(w:${this.weight},s:${this.style})`}getTypographicGlyph(e){let t=this._chars[e];if(t)return t;if(e.match(/\s/))return this._chars[" "];const i=this._getFallbackCharacter(e);if(i&&(t=this._chars[i],t))return t;throw Error(`FontVariant('${this.id}')::getTypographicGlyph() - character('${e}') and/or fallback character were not found in provided msdf charset.`)}_getFallbackCharacter(e){throw new Error(`FontVariant(${typeof this})::_getFallbackCharacter() is abstract and should therefore be overridden.`)}getGeometricGlyph(e,t){throw new Error(`FontVariant(${typeof this})::getGeometryCharacter() is abstract and should therefore be overridden.`)}getKerningAmount(e){return this._kernings[e]?this._kernings[e]:0}adjustTypographicGlyphs(e){for(const t in e){const i=this.getTypographicGlyph(t),n=e[t];for(const r in n)i["_"+r]=e[t][r]}}_checkReadiness(){this._readyCondition()&&ms(this)}_alterElementProperties(e){throw new Error(`FontVariant(${typeof this})::_alterElementProperties() is abstract and should therefore be overridden.`)}_readyCondition(){throw new Error(`FontVariant(${typeof this})::_readyCondition() is abstract and should therefore be overridden.`)}}const gs={type:"ready"};function ms(s){s._isReady=!0,s.dispatchEvent(gs)}const I=fs;class vs extends p{constructor(e=null){super("font",e,!1),this._needsUpdate=!1,this._fontVariant=null,this._handleFontReadyClosure=null,this.isValid=bs}output(e){e[this._id]=this._fontVariant}update(e,t){if(this._fontVariant&&!this._fontVariant.isReady&&this._fontVariant.removeEventListener("ready",this._handleFontReadyClosure),this._value&&this._value instanceof I)this._fontVariant=this._value;else{const i=e._fontFamily._value;i&&(this._fontVariant=i.getVariant(e._fontWeight._value,e._fontStyle._value))}this._fontVariant&&(this._fontVariant._alterElementProperties(e),this._handleFontReadyClosure=ys(e,this),this._fontVariant.isReady?this._handleFontReadyClosure():this._fontVariant.addEventListener("ready",this._handleFontReadyClosure),(!e._fontMaterial._defaultMaterial||!(e._fontMaterial._defaultMaterial instanceof this._fontVariant.fontMaterial))&&(e._fontMaterial._defaultMaterial=new this._fontVariant.fontMaterial,e._fontMaterial._needsUpdate=!0))}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value}get fontVariant(){return this._fontVariant}dispose(){this._handleFontReadyClosure&&(this._fontVariant.removeEventListener("ready",this._handleFontReadyClosure),this._handleFontReadyClosure=null),this._value=null,this._fontVariant=null}}function bs(s){return s instanceof I?!0:(console.warn(`.font value '${s}' is not valid. It requires a FontVariant instance. Aborted`),!1)}function ys(s,e){return function(){e._needsUpdate=!0,s._glyphs._needsProcess=!0,e._fontVariant.removeEventListener("ready",e._handleFontReadyClosure),e._handleFontReadyClosure=null}}class xs extends g{constructor(e){super("display",e),this._value="flex",this._allowsInherit=!1,this._needsUpdate=!1,this.isValidValue=Ss}computeOutputValue(e){e._visible._value=this._output!=="none"}}const ws=["none","flex"];function Ss(s){return ws.indexOf(s)===-1?(console.warn(`(.style) display value '${s}' is not valid. Aborted`),!1):!0}class Vs extends g{constructor(e){super("boxSizing",e),this._allowsInherit=!1,this.isValidValue=Us}computeOutputValue(e){this._value=this._inheritedInput,e._bounds._needsUpdate=!0}}const ks=["border-box","content-box"];function Us(s){return ks.indexOf(s)===-1?(console.warn(`(.style) boxSizing value '${s}' is not valid. Aborted`),!1):!0}class T extends g{constructor(e,t){super(e,t,!1),this._value=new a.Color,this.output=this._outputValue}computeOutputValue(e){this._input!=="inherit"&&this._value.set(this._input)}set inline(e){this._input=this._inline=e,this._needsUpdate=!0}}class ne extends g{constructor(e,t){super(e,t,!0),this.isValidValue=Rs,this._allowsInherit=!1,this._input=t,this._value=t,this.output=this._outputValue,this.computeOutputValue=this._computeFromInherited}_outputValue(e){e[this._id]=this._inheritedInput}}function Rs(s){return s<0&&s>1?(console.warn(`(.style) styleFactorProperty('${this.id}') value '${s}' is not valid)`),!1):!0}class Cs extends g{constructor(e){super("backgroundImage",e,!0),this._input=null,this._allowsInherit=!1,this._textureSize=new a.Vector2(1,1),this.isValidValue=Ms}get value(){return this._value}output(e){e[this._id]=this._value,e.tSize=this._textureSize}computeOutputValue(e){if(this._value=this._inheritedInput,this._value instanceof a.Texture&&!this._value.image){console.warn("ThreeMeshUI - .backgroundImage :: Please provide preloaded texture in order to have accurate sizing.");return}this._needsProcess=!0}process(e){this._value?this._textureSize.set(this._value.image.width,this._value.image.height):this._textureSize.set(1,1)}}function Ms(s){return!0}class Bs extends g{constructor(e){super("backgroundSize",e,!0),this.isValidValue=Is,this.output=this._outputValue}}const Ps=["cover","contain","stretch"];function Is(s){return Ps.indexOf(s)===-1?(console.warn(`(.style) backgroundSize value '${s}' is not valid. Aborted`),!1):!0}class Ts extends g{constructor(e){super("overflow",e,!0),this.isValidValue=Os,this._clippingPlanes=null,this._renderStrategy=this._emptyRender}update(e,t){this._inline!==void 0&&this._inline!=="unset"?this._input=this._inline:this._computed!==void 0&&(this._input=this._computed),this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const i of e._children._uis)i._overflow._needsUpdate=!0;this.output(t)}output(e){e.clippingPlanes=this._clippingPlanes}computeOutputValue(e){super.computeOutputValue(e),this._value==="hidden"?this._renderStrategy=this._propagateRender:(this._renderStrategy=this._emptyRender,this._clippingPlanes=null);const t=e._parent._value;if(t!==null){const i=t._overflow;if((i._value==="hidden"||i._clippingPlanes!==null)&&!this._clippingPlanes){this._clippingPlanes=[new a.Plane(new a.Vector3(0,-1,0),1),new a.Plane(new a.Vector3(-1,0,0),1),new a.Plane(new a.Vector3(0,1,0),1),new a.Plane(new a.Vector3(1,0,0),1)];for(let n=0;n<this._clippingPlanes.length;n++)this._clippingPlanes[n].parent=t;i._clippingPlanes!==null&&this._clippingPlanes.push(...i._clippingPlanes),this._renderStrategy=this._hiddenRender,this._needsRender=!0}else(i._value==="visible"||i._clippingPlanes===null)&&this._clippingPlanes!==null&&(this._clippingPlanes=null,this._renderStrategy=this._emptyRender,this._needsRender=!0)}}render(e){this._renderStrategy(e)}_emptyRender(e){}_hiddenRender(e){const t=e._parent._value,i=t._bounds._offsetHeight,n=t._bounds._offsetWidth,r=t._padding._value,o=t._borderWidth._value;for(let h=0;h<4&&h<this._clippingPlanes.length;h++){const c=this._clippingPlanes[h];switch(h%4){case 0:c.constant=i/2-(r.x+o.x);break;case 1:c.constant=n/2-(r.y+o.y);break;case 2:c.constant=i/2-(r.z+o.z);break;case 3:c.constant=n/2-(r.w+o.w);break}c.applyMatrix4(t.matrixWorld)}for(let h=0;h<e._children._uis.length;h++){const c=e._children._uis[h];c._overflow._needsRender=!0}}_propagateRender(e){for(let t=0;t<e._children._uis.length;t++){const i=e._children._uis[t];i._overflow._needsRender=!0}}}const Fs=["visible","hidden"];function Os(s){return Fs.indexOf(s)===-1?(console.warn(`(.style) overflow value '${s}' is not valid. Aborted`),!1):!0}const B="rem",Oe="em",L="%",zs=[B,Oe,L],ze=function(s){return zs.indexOf(s)===-1?B:s};class As extends D{constructor(e){super("borderRadius",e),this._valueUV=this._value.clone(),this._input=new a.Vector4(0,0,0,0),this._mediation=!0,this._cornerTL=new a.Vector2(0,1),this._cornerTR=new a.Vector2(1,1),this._cornerBR=new a.Vector2(1,0),this._cornerBL=new a.Vector2(0,0);const t=new H(this._valueUV,["x","y"]),i=new H(this._valueUV,["z","w"]),n=new H(this._valueUV,["x","w"]),r=new H(this._valueUV,["y","z"]);t.complementaryMediation=i,i.complementaryMediation=t,n.complementaryMediation=r,r.complementaryMediation=n,this._sideMediators=[t,i,n,r],this._units=B}set units(e){this._units=ze(e),this._needsProcess=!0}get units(){return this._units}set mediation(e){e!==this._mediation&&(this._mediation=e,this._needsUpdate=!0)}get mediation(){return this._mediation}output(e){e.cornerTL=this._cornerTL,e.cornerTR=this._cornerTR,e.cornerBR=this._cornerBR,e.cornerBL=this._cornerBL}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input),this._needsProcess=!0}process(e){this._needsRender=!0}render(e){this._valueUV.copy(this._value);const t=e._bounds._offsetWidth,i=e._bounds._offsetHeight;if(this._units===L&&this._valueUV.divideScalar(100),this._units===B&&this._valueUV.divideScalar(Math.min(t,i)),this._mediation)do this._sideMediators.forEach(o=>o.computeValue()),this._sideMediators.sort((o,h)=>o.value<h.value?1:-1),this._sideMediators[0].value>1&&this._sideMediators[0].mediate();while(this._sideMediators[0].value>1);let n=t>i?i/t:1,r=t<i?t/i:1;this._units===L&&(n=r=1),this._cornerTL.x=this._valueUV.x*n,this._cornerTL.y=1-this._valueUV.x*r,this._cornerTR.x=1-this._valueUV.y*n,this._cornerTR.y=1-this._valueUV.y*r,this._cornerBR.x=1-this._valueUV.z*n,this._cornerBR.y=this._valueUV.z*r,this._cornerBL.x=this._valueUV.w*n,this._cornerBL.y=this._valueUV.w*r}dispose(){for(const e of this._sideMediators)e.dispose();this._sideMediators=null,this._cornerTL=null,this._cornerTR=null,this._cornerBR=null,this._cornerBL=null,super.dispose()}set topLeft(e){this._input.x!==e&&(this._input.x=e,this._needsUpdate=!0)}get topLeft(){return this._input.x}set topRight(e){this._input.y!==e&&(this._input.y=e,this._needsUpdate=!0)}get topRight(){return this._input.y}set bottomRight(e){this._input.z!==e&&(this._input.z=e,this._needsUpdate=!0)}get bottomRight(){return this._input.z}set bottomLeft(e){this._input.w!==e&&(this._input.w=e,this._needsUpdate=!0)}get bottomLeft(){return this._input.w}set top(e){this._input.x===e&&this._input.y===e||(this._input.x=this._input.y=e,this._needsUpdate=!0)}get top(){return(this._input.x+this._input.y)/2}set right(e){this._input.y===e&&this._input.z===e||(this._input.y=this._input.z=e,this._needsUpdate=!0)}get right(){return(this._input.y+this._input.z)/2}set bottom(e){this._input.z===e&&this._input.w===e||(this._input.z=this._input.w=e,this._needsUpdate=!0)}get bottom(){return(this._input.z+this._input.w)/2}set left(e){this._input.w===e&&this._input.x===e||(this._input.w=this._input.x=e,this._needsUpdate=!0)}get left(){return(this._input.w+this._input.x)/2}}class H{constructor(e,t){this._borderRadiuses=e,this._sideProperties=t,this._complementaryMediation=null,this._value=0}get value(){return this._value}set complementaryMediation(e){this._complementaryMediation=e}computeValue(){let e=0;for(const t of this._sideProperties)e+=this._borderRadiuses[t];this._value=e}mediate(e=!0){if(!(this._value<1)){for(const t of this._sideProperties)this._borderRadiuses[t]/=this._value;e&&this._complementaryMediation.mediate(!1)}}dispose(){this._complementaryMediation=null,this._borderRadiuses=null}}class Ws extends D{constructor(e){super("borderWidth",e,!1),this._valueUV=this._value.clone(),this.output=this._outputValue,this._units=B}set units(e){this._units=ze(e),this._needsUpdate=!0}get units(){return this._units}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input),this._needsProcess=!0,e._bounds._needsUpdate=!0,e._layouter._needsUpdate=!0}_outputValue(e){e[this._id]=this._valueUV}process(e){this._needsRender=!0,e._borderRadius._needsRender=!0}render(e){this._valueUV.copy(this._value);const t=e._bounds._offsetWidth,i=e._bounds._offsetHeight;if(this._units===L&&(console.log("Percent"),console.log(this._valueUV)),this._units===B)t!==0&&(this._valueUV.w/=t,this._valueUV.y/=t),i!==0&&(this._valueUV.x/=i,this._valueUV.z/=i);else if(this._units===Oe){if(t!==0){const n=t>i?i/t:1;this._valueUV.y*=n,this._valueUV.w*=n}if(i!==0){const n=t<i?t/i:1;this._valueUV.x*=n,this._valueUV.z*=n}}}}class Ds extends p{constructor(e,t=!0){super("visible",t,!0),this._needsUpdate=!1}update(e,t){e.visible=this._value,e._parent._value&&(e._parent._value._children._needsUpdate=!0)}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value}}class Ae extends T{constructor(e){super("backgroundColor",e,!1),this._input="transparent",this._allowsInherit=!1}computeOutputValue(e){e._backgroundMesh.visible=!(this._input==="none"||this._input==="transparent"),this._input==="inherit"?this._value.set(this.getInheritedInput(e)):this._input==="transparent"||this._input==="none"||this._value.set(this._input)}}class k extends p{constructor(e="untitled"){super(e,void 0,!1)}update(e,t){}output(e){}}class Es extends p{constructor(){super("inlineJustificator",null,!1),this._value=null}update(e,t){}process(e){const t=e._bounds._innerHeight,i=e._layouter._value,n=Math.abs(i.height);let r=(()=>{switch(e._alignItems._value){case"inherit":case"start":return t/2;case"end":return n-t/2;case"stretch":case"center":return n/2}})();const o=e._padding._value,h=e._borderWidth._value;r+=(-o.x+o.z)/2+(-h.x+h.z)/2,i.forEach(c=>{c.y+=r,c.forEach(d=>{d.offsetY+=r})})}}const Ls=["start","center","end","stretch"],Hs=function(s){return Ls.indexOf(s)===-1?(console.warn(`(.style) alignItems value '${s}' is not valid. Aborted`),!1):!0};class re extends g{constructor(){super("alignItems","inherit",!0),this.isValidValue=Hs}}class oe extends g{constructor(){super("textAlign","inherit",!0),this.isValidValue=$s}}const Gs=["left","right","center","justify","justify-left","justify-right","justify-center"],$s=function(s){return Gs.indexOf(s)===-1?(console.warn(`(.style) textAlign value '${s}' is not valid. Aborted`),!1):!0};class ae extends g{constructor(){super("flexDirection","inherit",!0),this.isValid=Xs}}const js=["row","row-reverse","column","column-reverse"];function Xs(s){return js.indexOf(s)===-1?(console.warn(`(.style) flexDirection value '${s}' is not valid. Aborted`),!1):!0}class le extends g{constructor(){super("justifyContent","inherit",!0),this.isValidValue=Ns}}const Ys=["start","center","end","space-between","space-around","space-evenly"];function Ns(s){return Ys.indexOf(s)===-1?(console.warn(`(.style) justifyContent value '${s}' is not valid. Aborted`),!1):!0}class Ks extends g{constructor(){super("order",0,!0),this._value=0,this._input=0,this._allowsInherit=!1}computeOutputValue(e){this._value=this._inheritedInput,e._parent._value&&(e._parent._value._children._needsProcess=!0)}}class We extends g{constructor(){super("position","static",!0),this._allowsInherit=!1,this._value="static",this._needsUpdate=!1,this.computeOutputValue=this._computeFromInherited,this.isValidValue=Js}_computeFromInherited(e){super._computeFromInherited(e),e._parent._value&&(e._parent._value._children._needsProcess=!0)}}const qs=["static","absolute"];function Js(s){return qs.indexOf(s)===-1?(console.warn(`(.style) position value '${s}' is not valid. Aborted`),!1):!0}class De extends g{constructor(e,t=null){super(e,t,!0),this._input="auto",this._auto=!0,this._relative=!1,this._updateRequired=!0}set inline(e){this.isValidValue(e)&&e!==this._inline&&(this._inline=e,this._input!==this._inline&&this._parseInput())}get inline(){return this._inline}_parseInput(){let e=!0;if(this._inline!==void 0&&this._inline!=="unset"?this._input=this._inline:this._computed!==void 0?(this._computed===this._input&&(e=!1),this._input=this._computed):e=this._input==="inherit",e){if(this._auto=!this._input||this._input==="auto",this._auto)this._relative=!1;else if((typeof this._input=="string"||this._input instanceof String)&&this._input.endsWith("%")){this._relative=!0,this._value=0;const t=parseFloat(this._input.replace("%","").trim());isNaN(t)||(this._value=t/100)}else this._relative=!1,this._value=this._input;this._needsUpdate=this._updateRequired=e}}update(e,t){if(this._updateRequired){this._updateRequired=!1,this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const i of e._children._uis)i[`_${this._id}`]._needsUpdate=!0;this.output(t),e._parent._value&&(e._parent._value._layouter._needsProcess=!0)}}computeOutputValue(e){e._bounds._needsUpdate=!0,e._renderer._needsRender=!0}getInheritedInput(e){if(this._input!=="inherit"&&!this._auto)return this._input;const t=e._parent._value;return t?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}getDefaultValue(){return 0}get value(){return this._value}}class Qs extends De{constructor(){super("width")}}class Zs extends De{constructor(){super("height")}computeOutputValue(e){super.computeOutputValue(e)}}class Ee extends k{constructor(){super("textContent"),this._needsUpdate=!1}set value(e){}process(e){let t="";for(let i=0;i<e.children.length;i++){const n=e.children[i];n.isUI&&(t+=n.textContent)}this._value=t}}class Le extends g{constructor(e){super("fontStyle",e,!0),this.isValidValue=ti}}const ei=["normal","italic"];function ti(s){return ei.indexOf(s)===-1?(console.warn(`(.style) fontStyle value '${s}' is not valid. Aborted`),!1):!0}class He extends g{constructor(){super("fontWeight","inherit",!0),this.isValid=ii}}const si=["100","200","300","400","500","600","700","800","900","light","normal","bold","bolder"];function ii(s){return si.indexOf(s.toString())===-1?(console.warn(`(.style) fontWeight value '${s}' is not valid. Aborted`),!1):!0}class Ge{constructor(){this._size=42,this._lineHeight=42,this._lineBase=38,this._name="-",this._charset=""}get size(){return this._size}get lineHeight(){return this._lineHeight}get lineBase(){return this._lineBase}get name(){return this._name}get charset(){return this._charset}}class ni extends Ge{constructor(e){super(),this._size=e.info.size,this._lineHeight=e.common.lineHeight,this._lineBase=e.common.base,this._name=e.info.face,this._textureWidth=e.common.scaleW,this._textureHeight=e.common.scaleH,this._charset=e.chars.map(t=>t.char).join("")}get textureWidth(){return this._textureWidth}get textureHeight(){return this._textureHeight}}class ri extends Fe{constructor(e){super(e)}get uv(){return this.typographic.uv}}class q extends Te{constructor(e,t){super(e),this._char=t.char,this._width=t.width,this._heigth=t.height,this._xadvance=t.xadvance?t.xadvance:this._width,this._xoffset=t.xoffset?t.xoffset:0,this._yoffset=t.yoffset?t.yoffset:0,this._uv=t.uv?t.uv:null,isNaN(t.x)||(this._uv={left:t.x/e.textureWidth,right:(t.x+t.width)/e.textureWidth,top:1-(t.y+t.height)/e.textureHeight,bottom:1-t.y/e.textureHeight})}get uv(){return this._uv}clone(e){return new q(this._font,{char:e,width:this._width,height:this._heigth,xadvance:this._xadvance,xoffset:this._xoffset,yoffset:this._yoffset,uv:null})}asInlineGlyph(){return new ri(this)}}class oi extends a.PlaneGeometry{constructor(e,t){let i=1,n=1;const r=e.typographic.font.size,o=t._segments.value;i=Math.ceil(e.typographic.width/r*o),n=Math.ceil(e.typographic.height/r*o),super(e.width,e.height,i,n),e.uv?(this._mapUVs(e),this._transformGeometry(e)):(this._nullifyUVs(),this.scale(0,0,1),this.translate(0,e.fontSize/2,0)),this.name="GlyphGeometry"}_mapUVs(e){const t=e.uv.right-e.uv.left,i=e.uv.bottom-e.uv.top,n=this.getAttribute("uv").array.slice(),r=[];for(let o=0;o<n.length;o+=2){const h=n[o],c=n[o+1];r.push(e.uv.left+t*h),r.push(e.uv.top+i*c)}this.setAttribute("uvG",new a.BufferAttribute(new Float32Array(r),2))}_nullifyUVs(){const e=[],t=this.getAttribute("uv").array.length;for(let i=0;i<t;i++)e.push(0);this.setAttribute("uvG",new a.BufferAttribute(new Float32Array(e),2))}_transformGeometry(e){this.translate(e.width/2,-e.height/2,0)}}const ai=`
3
3
  attribute vec2 uvG;
4
4
  varying vec2 vUvG;
@@ -1,4 +1,4 @@
1
- var Tt=Object.defineProperty,Ft=(s,e,t)=>e in s?Tt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,M=(s,e,t)=>(Ft(s,typeof e!="symbol"?e+"":e,t),t);import{ax as Ot,I as zt,B as At,l as Wt,D as Dt,aw as Et,ab as Lt,aq as Ht,b3 as Gt,M as $t,q as jt,O as Xt,Y as Yt,P as Nt,k as Kt,T as qt,b as Jt,g as Qt,V as Zt,h as es}from"./three.min.js";var V={};V.d=(s,e)=>{for(var t in e)V.o(e,t)&&!V.o(s,t)&&Object.defineProperty(s,t,{enumerable:!0,get:e[t]})},V.o=(s,e)=>Object.prototype.hasOwnProperty.call(s,e),V.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var m={};V.d(m,{ti:()=>p,nS:()=>yt,eB:()=>z,Yp:()=>Z,VB:()=>C,BC:()=>I,zN:()=>R,cV:()=>P,hW:()=>W,k2:()=>Fe,K6:()=>w,M7:()=>ee,ls:()=>F,Hi:()=>Qe,EY:()=>A,MR:()=>Ge,zf:()=>Te,Ay:()=>gr,yo:()=>xt});var Z={};V.r(Z),V.d(Z,{get:()=>Ce,set:()=>ts});var ee={};V.r(ee),V.d(ee,{alphaTestTransformer:()=>G,asPreprocessorValueTransformer:()=>$e,toPreprocessorTriggerTransformer:()=>pe,toUserDataTransformer:()=>di,uniformOrUserDataTransformer:()=>x});const te={fontFamily:null,fontSize:.05,fontKerning:"auto",fontStyle:"normal",fontWeight:"normal",offset:.005,lineHeight:1.2,lineBreak:`- ,.:?!
1
+ var Tt=Object.defineProperty,Ft=(s,e,t)=>e in s?Tt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,M=(s,e,t)=>(Ft(s,typeof e!="symbol"?e+"":e,t),t);import{ax as Ot,I as zt,B as At,k as Wt,D as Dt,aw as Et,ab as Lt,aq as Ht,b3 as Gt,M as $t,q as jt,O as Xt,Y as Yt,P as Nt,j as Kt,T as qt,a as Jt,f as Qt,V as Zt,g as es}from"./three.min.js";var V={};V.d=(s,e)=>{for(var t in e)V.o(e,t)&&!V.o(s,t)&&Object.defineProperty(s,t,{enumerable:!0,get:e[t]})},V.o=(s,e)=>Object.prototype.hasOwnProperty.call(s,e),V.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var m={};V.d(m,{ti:()=>p,nS:()=>yt,eB:()=>z,Yp:()=>Z,VB:()=>C,BC:()=>I,zN:()=>R,cV:()=>P,hW:()=>W,k2:()=>Fe,K6:()=>w,M7:()=>ee,ls:()=>F,Hi:()=>Qe,EY:()=>A,MR:()=>Ge,zf:()=>Te,Ay:()=>gr,yo:()=>xt});var Z={};V.r(Z),V.d(Z,{get:()=>Ce,set:()=>ts});var ee={};V.r(ee),V.d(ee,{alphaTestTransformer:()=>G,asPreprocessorValueTransformer:()=>$e,toPreprocessorTriggerTransformer:()=>pe,toUserDataTransformer:()=>di,uniformOrUserDataTransformer:()=>x});const te={fontFamily:null,fontSize:.05,fontKerning:"auto",fontStyle:"normal",fontWeight:"normal",offset:.005,lineHeight:1.2,lineBreak:`- ,.:?!
2
2
  `,whiteSpace:"pre-line",flexDirection:"column",justifyContent:"start",alignItems:"start",backgroundImage:null,textAlign:"left",boxSizing:"content-box",position:"static",color:16777215,fontColor:16777215,fontOpacity:1,opacity:1,fontPXRange:4,fontSupersampling:!0,fontSmooth:"antialiased",borderRadius:0,borderWidth:0,borderColor:"black",borderOpacity:1,backgroundSize:"cover",backgroundColor:0,backgroundOpacity:0,overflow:"visible",letterSpacing:0,invertAlpha:!1,segments:1},ts=function(s){for(const e in s)te[e]=s[e]},Ce=function(s){return Object.prototype.hasOwnProperty.call(te,s)||console.warn(`ThreeMeshUI::DefaultValues is trying to retrieve non-existing property '${s}'`),te[s]};class p{constructor(e,t=null,i=!0){this._id=e,this._value=t,this._needsUpdate=!0,this._needsProcess=!1,this._needsRender=!1,this._isPrimitive=i}get id(){return this._id}get value(){return this._value}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}update(e,t){this.output(t)}output(e){}_outputValue(e){e[this._id]=this._value}process(e){}render(e){}getInheritedInput(e){if(this._value!=="inherit")return this._value;const t=e._parent._value;return t&&t[`_${this._id}`]?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}getDefaultValue(){return Ce(this._id)}isValid(e){return!0}emptyStrategyLogic(){throw new Error(`ThreeMeshUI::${this.constructor.name} has empty strategy. Update has not been processed.`)}requestUpdate(){this._needsUpdate=!0}requestProcess(){this._needsProcess=!1}requestRender(){this._needsRender=!1}}class ss extends p{constructor(){super("renderOrder","auto",!0),this.output=this._outputValue,this._actualValue=0}set value(e){this.isValid(e)&&(this._value=e,this._needsUpdate=!0)}update(e,t){if(this._value!=="auto")this._actualValue=this._value;else{const i=e._parent._value;if(i!==null){const n=i._renderOrder._actualValue,r=1+i._children._uis.indexOf(e);this._actualValue=n+r}}for(const i of e._children._uis)i._renderOrder._value==="auto"&&(i._renderOrder._needsUpdate=!0);this._outputValue(t)}_outputValue(e){e[this._id]=this._actualValue}get value(){return this._value}}class R extends p{constructor(e,t=null,i=!0){super(e,t,i),this.output=this._outputValue,this._notInheritedValue=null}update(e,t){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(e)),this.propagate(e),this._outputValue(t)}propagate(e){for(const t of e._children._uis){const i=t[`_${this._id}`];i!==void 0&&i._value==="inherit"&&(t[`_${this._id}`]._needsUpdate=!0)}}_outputValue(e){e[this._id]=this._notInheritedValue}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class is extends R{constructor(){super("offset","inherit",!1)}update(e,t){super.update(e,t),e._parent._value!==null&&(e.position.z=this._notInheritedValue)}}class ns extends R{constructor(){super("fontSmooth","inherit",!0),this._needsUpdate=!1,this.isValid=os,this.output=this._outputValue}}const rs=["inherit","none","antialiased"];function os(s){return rs.indexOf(s)===-1?(console.warn(`.fontSmoothing value '${s}' is not valid. Aborted`),!1):!0}var as=s=>{var e={};return V.d(e,s),e};const a=as({BackSide:()=>Ot,BufferAttribute:()=>zt,BufferGeometry:()=>At,Color:()=>Wt,DoubleSide:()=>Dt,EventDispatcher:()=>Et,FileLoader:()=>Lt,FrontSide:()=>Ht,LinearFilter:()=>Gt,Mesh:()=>$t,MeshBasicMaterial:()=>jt,Object3D:()=>Xt,Plane:()=>Yt,PlaneGeometry:()=>Nt,ShaderMaterial:()=>Kt,Texture:()=>qt,TextureLoader:()=>Jt,Vector2:()=>Qt,Vector3:()=>Zt,Vector4:()=>es});class g extends p{constructor(e,t,i=!0){super(e,"unset",i),this._input="inherit",this._allowsInherit=!0,this._inheritedInput=void 0,this._inline=void 0}update(e,t){this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const i of e._children._uis){const n=i[`_${this._id}`];(n._input?n._input:n._value)==="inherit"&&(i[`_${this._id}`]._needsUpdate=!0)}this.output(t)}computeOutputValue(e){this._value=this._input}_computeFromInherited(e){this._value=this._inheritedInput}set value(e){console.warn(".(style) sub-property cannot be directly set. It must comes from inline or computed setter.")}set inline(e){this.isValidValue(e)&&e!==this._inline&&(this._input=this._inline=e,this._needsUpdate=!0)}get inline(){return this._inline}isValidValue(e){return!0}getInheritedInput(e){if(this._input!=="inherit")return this._input;const t=e._parent._value;return t?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}}class D extends g{constructor(e,t){super(e,t,!1),this._input=new a.Vector4(0,0,0,0),this._inline=null,this._value=new a.Vector4(0,0,0,0)}get value(){return this._value}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input)}set inline(e){this._vector4ValueSetter(this._input,e),!this._input.equals(this._value)&&(this._needsUpdate=!0)}set top(e){this._input.x!==e&&(this._input.x=e,this._needsUpdate=!0)}get top(){return this._input.x}set right(e){this._input.y!==e&&(this._input.y=e,this._needsUpdate=!0)}get right(){return this._input.y}set bottom(e){this._input.z!==e&&(this._input.z=e,this._needsUpdate=!0)}get bottom(){return this._input.z}set left(e){this._input.w!==e&&(this._input.w=e,this._needsUpdate=!0)}get left(){return this._input.w}dispose(){this._computed=null,this._inline=null,this._input=null,this._output=null}_vector4ValueSetter(e,t){if(t instanceof a.Vector4){e.copy(t);return}if((typeof t=="string"||t instanceof String)&&(t=t.split(" ")),Array.isArray(t))switch(t=t.map(i=>parseFloat(i)),t.length){case 1:e.setScalar(t[0]);return;case 2:e.x=e.z=t[0],e.y=e.w=t[1];return;case 3:e.x=t[0],e.y=t[1],e.z=t[2];return;case 4:e.x=t[0],e.y=t[1],e.z=t[2],e.w=t[3];return;default:console.error("StyleVector4Property::set() Four Dimension property had more than four values");return}isNaN(t)||e.setScalar(t)}}class ls extends D{constructor(){super("padding",new a.Vector4(0,0,0,0))}computeOutputValue(e){super.computeOutputValue(e),e._bounds._needsUpdate=!0,e._bounds._needsRender=!0,e._layouter._needsProcess=!0,e._renderer._needsRender=!0,e._parent._value&&(e._parent._value._layouter._needsProcess=!0)}}class hs extends D{constructor(){super("margin",new a.Vector4(0,0,0,0))}computeOutputValue(e){super.computeOutputValue(e),e._renderer._needsRender=!0,e._parent._value&&(e._parent._value._flexDirection._needsProcess=!0)}}const Me=function(s,e,t){s[e]=t},us=function(s,e,t){t!==null&&(s[e]=t)};class E{constructor(e){this._definition=e}set definition(e){this._definition=e}mediate(e,t,i,n=null){for(const r in this._definition){const o=this._definition[r];if(i[r]!==void 0){const h=o.t?o.t:Me;h(t,o.m,i[r]),n&&h(n,o.m,i[r])}}}static mediate(e,t,i,n,r=null){if(t)for(const o in n){const h=n[o];if(i[o]!==void 0){const c=h.t?h.t:Me;c(t,h.m,i[o]),r&&c(r,h.m,i[o])}}}}class cs extends p{constructor(){super("parent",null,!1)}update(e,t){e.parent&&e.parent.isUI?this._value=e.parent:this._value=null}set value(e){console.warn("ParentProperty is readonly")}get value(){return this._value}find(e){return this._value?e(this._value)?this._value:this._value._parent.find(e):null}dispose(){this._value=null}}const se=function(s,e,t=6){return s.toFixed(t)===e.toFixed(t)};class Be extends p{constructor(e,t){super(e,t,!0),this.output=this._outputValue}set value(e){this.isValid(e)&&(se(this._value,e)||(this._value=e,this._needsUpdate=!0))}get value(){return this._value}}class Pe extends R{constructor(e){super(e,"inherit",!0),this.isValid=_s}}const ds=[a.FrontSide,a.BackSide,a.DoubleSide];function _s(s){return ds.indexOf(s)===-1?(console.warn(`SideProperty value '${s}' is not valid. Abort`),!1):!0}class Ie{constructor(){this._offsetX=0,this._offsetY=0,this._lineBreak=null,this._kerning=0,this._fontFactor=1,this._fontSize=0,this._cumulativeWidth=0,this._paddingLeft=0,this._paddingRight=0,this._marginLeft=0,this._marginRight=0}resetOffsets(){this._offsetX=this._offsetY=0,this._cumulativeWidth=0}get xadvance(){return 0}get xoffset(){return 0}get yoffset(){return 0}get width(){return 0}get height(){return 0}set lineBreak(e){this._lineBreak=e}get lineBreak(){return this._lineBreak}get anchor(){return 0}get kerning(){return this._kerning*this._fontFactor}set kerning(e){this._kerning=e}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize=e}get lineHeight(){return 0}get offsetX(){return this._offsetX}set offsetX(e){this._offsetX=e}get offsetY(){return this._offsetY}set offsetY(e){this._offsetY=e}get cumulativeWidth(){return this._cumulativeWidth}set cumulativeWidth(e){this._cumulativeWidth=e}get marginLeft(){return this._marginLeft}set marginLeft(e){this._marginLeft=e}get marginRight(){return this._marginRight}set marginRight(e){this._marginRight=e}get paddingLeft(){return this._paddingLeft}set paddingLeft(e){this._paddingLeft=e}get paddingRight(){return this._paddingRight}set paddingRight(e){this._paddingRight=e}get lineBase(){return 0}set fontFactor(e){this._fontFactor=e}get fontFactor(){return this._fontFactor}}class Te{constructor(e){this._char="",this._width=1,this._heigth=1,this._xadvance=1,this._xoffset=0,this._yoffset=0,this._font=e}get font(){return this._font}get char(){return this._char}get width(){return this._width}get height(){return this._heigth}get xadvance(){return this._xadvance}get xoffset(){return this._xoffset}get yoffset(){return this._yoffset}set yoffset(e){this._yoffset=e}clone(e){throw new Error("Abstract... Need to be implemented")}asInlineGlyph(){throw new Error("Abstract... Need to be implemented")}}class Fe extends Ie{constructor(e){super(),this._typographic=e}get typographic(){return this._typographic}get xadvance(){return this._typographic.xadvance*this._fontFactor}get xoffset(){return this._typographic.xoffset*this._fontFactor}get yoffset(){return this._typographic.yoffset*this._fontFactor}get width(){return this._typographic.width*this._fontFactor}get height(){return this._typographic.height*this._fontFactor}get char(){return this._typographic.char}get anchor(){return this.yoffset}get lineHeight(){return this._typographic.font.lineHeight*this._fontFactor}get lineBase(){return this._typographic.font.lineBase*this._fontFactor}}const ps={light:"100",normal:"400",bold:"700",bolder:"900"};function ie(s){return isNaN(s)?ps[s]||s:s.toString()}class fs extends a.EventDispatcher{constructor(e,t){super(),this._isReady=!1,this._weight=ie(e),this._style=t,this._size=42,this._lineHeight=42,this._lineBase=42,this._font=null}get typographic(){return this._font}get isReady(){return this._isReady}get weight(){return this._weight}get style(){return this._style}get texture(){return this._texture}set fontMaterial(e){throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`)}get fontMaterial(){throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`)}get id(){return`${this._name}(w:${this.weight},s:${this.style})`}getTypographicGlyph(e){let t=this._chars[e];if(t)return t;if(e.match(/\s/))return this._chars[" "];const i=this._getFallbackCharacter(e);if(i&&(t=this._chars[i],t))return t;throw Error(`FontVariant('${this.id}')::getTypographicGlyph() - character('${e}') and/or fallback character were not found in provided msdf charset.`)}_getFallbackCharacter(e){throw new Error(`FontVariant(${typeof this})::_getFallbackCharacter() is abstract and should therefore be overridden.`)}getGeometricGlyph(e,t){throw new Error(`FontVariant(${typeof this})::getGeometryCharacter() is abstract and should therefore be overridden.`)}getKerningAmount(e){return this._kernings[e]?this._kernings[e]:0}adjustTypographicGlyphs(e){for(const t in e){const i=this.getTypographicGlyph(t),n=e[t];for(const r in n)i["_"+r]=e[t][r]}}_checkReadiness(){this._readyCondition()&&ms(this)}_alterElementProperties(e){throw new Error(`FontVariant(${typeof this})::_alterElementProperties() is abstract and should therefore be overridden.`)}_readyCondition(){throw new Error(`FontVariant(${typeof this})::_readyCondition() is abstract and should therefore be overridden.`)}}const gs={type:"ready"};function ms(s){s._isReady=!0,s.dispatchEvent(gs)}const I=fs;class vs extends p{constructor(e=null){super("font",e,!1),this._needsUpdate=!1,this._fontVariant=null,this._handleFontReadyClosure=null,this.isValid=bs}output(e){e[this._id]=this._fontVariant}update(e,t){if(this._fontVariant&&!this._fontVariant.isReady&&this._fontVariant.removeEventListener("ready",this._handleFontReadyClosure),this._value&&this._value instanceof I)this._fontVariant=this._value;else{const i=e._fontFamily._value;i&&(this._fontVariant=i.getVariant(e._fontWeight._value,e._fontStyle._value))}this._fontVariant&&(this._fontVariant._alterElementProperties(e),this._handleFontReadyClosure=ys(e,this),this._fontVariant.isReady?this._handleFontReadyClosure():this._fontVariant.addEventListener("ready",this._handleFontReadyClosure),(!e._fontMaterial._defaultMaterial||!(e._fontMaterial._defaultMaterial instanceof this._fontVariant.fontMaterial))&&(e._fontMaterial._defaultMaterial=new this._fontVariant.fontMaterial,e._fontMaterial._needsUpdate=!0))}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value}get fontVariant(){return this._fontVariant}dispose(){this._handleFontReadyClosure&&(this._fontVariant.removeEventListener("ready",this._handleFontReadyClosure),this._handleFontReadyClosure=null),this._value=null,this._fontVariant=null}}function bs(s){return s instanceof I?!0:(console.warn(`.font value '${s}' is not valid. It requires a FontVariant instance. Aborted`),!1)}function ys(s,e){return function(){e._needsUpdate=!0,s._glyphs._needsProcess=!0,e._fontVariant.removeEventListener("ready",e._handleFontReadyClosure),e._handleFontReadyClosure=null}}class xs extends g{constructor(e){super("display",e),this._value="flex",this._allowsInherit=!1,this._needsUpdate=!1,this.isValidValue=Ss}computeOutputValue(e){e._visible._value=this._output!=="none"}}const ws=["none","flex"];function Ss(s){return ws.indexOf(s)===-1?(console.warn(`(.style) display value '${s}' is not valid. Aborted`),!1):!0}class Vs extends g{constructor(e){super("boxSizing",e),this._allowsInherit=!1,this.isValidValue=Us}computeOutputValue(e){this._value=this._inheritedInput,e._bounds._needsUpdate=!0}}const ks=["border-box","content-box"];function Us(s){return ks.indexOf(s)===-1?(console.warn(`(.style) boxSizing value '${s}' is not valid. Aborted`),!1):!0}class T extends g{constructor(e,t){super(e,t,!1),this._value=new a.Color,this.output=this._outputValue}computeOutputValue(e){this._input!=="inherit"&&this._value.set(this._input)}set inline(e){this._input=this._inline=e,this._needsUpdate=!0}}class ne extends g{constructor(e,t){super(e,t,!0),this.isValidValue=Rs,this._allowsInherit=!1,this._input=t,this._value=t,this.output=this._outputValue,this.computeOutputValue=this._computeFromInherited}_outputValue(e){e[this._id]=this._inheritedInput}}function Rs(s){return s<0&&s>1?(console.warn(`(.style) styleFactorProperty('${this.id}') value '${s}' is not valid)`),!1):!0}class Cs extends g{constructor(e){super("backgroundImage",e,!0),this._input=null,this._allowsInherit=!1,this._textureSize=new a.Vector2(1,1),this.isValidValue=Ms}get value(){return this._value}output(e){e[this._id]=this._value,e.tSize=this._textureSize}computeOutputValue(e){if(this._value=this._inheritedInput,this._value instanceof a.Texture&&!this._value.image){console.warn("ThreeMeshUI - .backgroundImage :: Please provide preloaded texture in order to have accurate sizing.");return}this._needsProcess=!0}process(e){this._value?this._textureSize.set(this._value.image.width,this._value.image.height):this._textureSize.set(1,1)}}function Ms(s){return!0}class Bs extends g{constructor(e){super("backgroundSize",e,!0),this.isValidValue=Is,this.output=this._outputValue}}const Ps=["cover","contain","stretch"];function Is(s){return Ps.indexOf(s)===-1?(console.warn(`(.style) backgroundSize value '${s}' is not valid. Aborted`),!1):!0}class Ts extends g{constructor(e){super("overflow",e,!0),this.isValidValue=Os,this._clippingPlanes=null,this._renderStrategy=this._emptyRender}update(e,t){this._inline!==void 0&&this._inline!=="unset"?this._input=this._inline:this._computed!==void 0&&(this._input=this._computed),this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const i of e._children._uis)i._overflow._needsUpdate=!0;this.output(t)}output(e){e.clippingPlanes=this._clippingPlanes}computeOutputValue(e){super.computeOutputValue(e),this._value==="hidden"?this._renderStrategy=this._propagateRender:(this._renderStrategy=this._emptyRender,this._clippingPlanes=null);const t=e._parent._value;if(t!==null){const i=t._overflow;if((i._value==="hidden"||i._clippingPlanes!==null)&&!this._clippingPlanes){this._clippingPlanes=[new a.Plane(new a.Vector3(0,-1,0),1),new a.Plane(new a.Vector3(-1,0,0),1),new a.Plane(new a.Vector3(0,1,0),1),new a.Plane(new a.Vector3(1,0,0),1)];for(let n=0;n<this._clippingPlanes.length;n++)this._clippingPlanes[n].parent=t;i._clippingPlanes!==null&&this._clippingPlanes.push(...i._clippingPlanes),this._renderStrategy=this._hiddenRender,this._needsRender=!0}else(i._value==="visible"||i._clippingPlanes===null)&&this._clippingPlanes!==null&&(this._clippingPlanes=null,this._renderStrategy=this._emptyRender,this._needsRender=!0)}}render(e){this._renderStrategy(e)}_emptyRender(e){}_hiddenRender(e){const t=e._parent._value,i=t._bounds._offsetHeight,n=t._bounds._offsetWidth,r=t._padding._value,o=t._borderWidth._value;for(let h=0;h<4&&h<this._clippingPlanes.length;h++){const c=this._clippingPlanes[h];switch(h%4){case 0:c.constant=i/2-(r.x+o.x);break;case 1:c.constant=n/2-(r.y+o.y);break;case 2:c.constant=i/2-(r.z+o.z);break;case 3:c.constant=n/2-(r.w+o.w);break}c.applyMatrix4(t.matrixWorld)}for(let h=0;h<e._children._uis.length;h++){const c=e._children._uis[h];c._overflow._needsRender=!0}}_propagateRender(e){for(let t=0;t<e._children._uis.length;t++){const i=e._children._uis[t];i._overflow._needsRender=!0}}}const Fs=["visible","hidden"];function Os(s){return Fs.indexOf(s)===-1?(console.warn(`(.style) overflow value '${s}' is not valid. Aborted`),!1):!0}const B="rem",Oe="em",L="%",zs=[B,Oe,L],ze=function(s){return zs.indexOf(s)===-1?B:s};class As extends D{constructor(e){super("borderRadius",e),this._valueUV=this._value.clone(),this._input=new a.Vector4(0,0,0,0),this._mediation=!0,this._cornerTL=new a.Vector2(0,1),this._cornerTR=new a.Vector2(1,1),this._cornerBR=new a.Vector2(1,0),this._cornerBL=new a.Vector2(0,0);const t=new H(this._valueUV,["x","y"]),i=new H(this._valueUV,["z","w"]),n=new H(this._valueUV,["x","w"]),r=new H(this._valueUV,["y","z"]);t.complementaryMediation=i,i.complementaryMediation=t,n.complementaryMediation=r,r.complementaryMediation=n,this._sideMediators=[t,i,n,r],this._units=B}set units(e){this._units=ze(e),this._needsProcess=!0}get units(){return this._units}set mediation(e){e!==this._mediation&&(this._mediation=e,this._needsUpdate=!0)}get mediation(){return this._mediation}output(e){e.cornerTL=this._cornerTL,e.cornerTR=this._cornerTR,e.cornerBR=this._cornerBR,e.cornerBL=this._cornerBL}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input),this._needsProcess=!0}process(e){this._needsRender=!0}render(e){this._valueUV.copy(this._value);const t=e._bounds._offsetWidth,i=e._bounds._offsetHeight;if(this._units===L&&this._valueUV.divideScalar(100),this._units===B&&this._valueUV.divideScalar(Math.min(t,i)),this._mediation)do this._sideMediators.forEach(o=>o.computeValue()),this._sideMediators.sort((o,h)=>o.value<h.value?1:-1),this._sideMediators[0].value>1&&this._sideMediators[0].mediate();while(this._sideMediators[0].value>1);let n=t>i?i/t:1,r=t<i?t/i:1;this._units===L&&(n=r=1),this._cornerTL.x=this._valueUV.x*n,this._cornerTL.y=1-this._valueUV.x*r,this._cornerTR.x=1-this._valueUV.y*n,this._cornerTR.y=1-this._valueUV.y*r,this._cornerBR.x=1-this._valueUV.z*n,this._cornerBR.y=this._valueUV.z*r,this._cornerBL.x=this._valueUV.w*n,this._cornerBL.y=this._valueUV.w*r}dispose(){for(const e of this._sideMediators)e.dispose();this._sideMediators=null,this._cornerTL=null,this._cornerTR=null,this._cornerBR=null,this._cornerBL=null,super.dispose()}set topLeft(e){this._input.x!==e&&(this._input.x=e,this._needsUpdate=!0)}get topLeft(){return this._input.x}set topRight(e){this._input.y!==e&&(this._input.y=e,this._needsUpdate=!0)}get topRight(){return this._input.y}set bottomRight(e){this._input.z!==e&&(this._input.z=e,this._needsUpdate=!0)}get bottomRight(){return this._input.z}set bottomLeft(e){this._input.w!==e&&(this._input.w=e,this._needsUpdate=!0)}get bottomLeft(){return this._input.w}set top(e){this._input.x===e&&this._input.y===e||(this._input.x=this._input.y=e,this._needsUpdate=!0)}get top(){return(this._input.x+this._input.y)/2}set right(e){this._input.y===e&&this._input.z===e||(this._input.y=this._input.z=e,this._needsUpdate=!0)}get right(){return(this._input.y+this._input.z)/2}set bottom(e){this._input.z===e&&this._input.w===e||(this._input.z=this._input.w=e,this._needsUpdate=!0)}get bottom(){return(this._input.z+this._input.w)/2}set left(e){this._input.w===e&&this._input.x===e||(this._input.w=this._input.x=e,this._needsUpdate=!0)}get left(){return(this._input.w+this._input.x)/2}}class H{constructor(e,t){this._borderRadiuses=e,this._sideProperties=t,this._complementaryMediation=null,this._value=0}get value(){return this._value}set complementaryMediation(e){this._complementaryMediation=e}computeValue(){let e=0;for(const t of this._sideProperties)e+=this._borderRadiuses[t];this._value=e}mediate(e=!0){if(!(this._value<1)){for(const t of this._sideProperties)this._borderRadiuses[t]/=this._value;e&&this._complementaryMediation.mediate(!1)}}dispose(){this._complementaryMediation=null,this._borderRadiuses=null}}class Ws extends D{constructor(e){super("borderWidth",e,!1),this._valueUV=this._value.clone(),this.output=this._outputValue,this._units=B}set units(e){this._units=ze(e),this._needsUpdate=!0}get units(){return this._units}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input),this._needsProcess=!0,e._bounds._needsUpdate=!0,e._layouter._needsUpdate=!0}_outputValue(e){e[this._id]=this._valueUV}process(e){this._needsRender=!0,e._borderRadius._needsRender=!0}render(e){this._valueUV.copy(this._value);const t=e._bounds._offsetWidth,i=e._bounds._offsetHeight;if(this._units===L&&(console.log("Percent"),console.log(this._valueUV)),this._units===B)t!==0&&(this._valueUV.w/=t,this._valueUV.y/=t),i!==0&&(this._valueUV.x/=i,this._valueUV.z/=i);else if(this._units===Oe){if(t!==0){const n=t>i?i/t:1;this._valueUV.y*=n,this._valueUV.w*=n}if(i!==0){const n=t<i?t/i:1;this._valueUV.x*=n,this._valueUV.z*=n}}}}class Ds extends p{constructor(e,t=!0){super("visible",t,!0),this._needsUpdate=!1}update(e,t){e.visible=this._value,e._parent._value&&(e._parent._value._children._needsUpdate=!0)}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value}}class Ae extends T{constructor(e){super("backgroundColor",e,!1),this._input="transparent",this._allowsInherit=!1}computeOutputValue(e){e._backgroundMesh.visible=!(this._input==="none"||this._input==="transparent"),this._input==="inherit"?this._value.set(this.getInheritedInput(e)):this._input==="transparent"||this._input==="none"||this._value.set(this._input)}}class k extends p{constructor(e="untitled"){super(e,void 0,!1)}update(e,t){}output(e){}}class Es extends p{constructor(){super("inlineJustificator",null,!1),this._value=null}update(e,t){}process(e){const t=e._bounds._innerHeight,i=e._layouter._value,n=Math.abs(i.height);let r=(()=>{switch(e._alignItems._value){case"inherit":case"start":return t/2;case"end":return n-t/2;case"stretch":case"center":return n/2}})();const o=e._padding._value,h=e._borderWidth._value;r+=(-o.x+o.z)/2+(-h.x+h.z)/2,i.forEach(c=>{c.y+=r,c.forEach(d=>{d.offsetY+=r})})}}const Ls=["start","center","end","stretch"],Hs=function(s){return Ls.indexOf(s)===-1?(console.warn(`(.style) alignItems value '${s}' is not valid. Aborted`),!1):!0};class re extends g{constructor(){super("alignItems","inherit",!0),this.isValidValue=Hs}}class oe extends g{constructor(){super("textAlign","inherit",!0),this.isValidValue=$s}}const Gs=["left","right","center","justify","justify-left","justify-right","justify-center"],$s=function(s){return Gs.indexOf(s)===-1?(console.warn(`(.style) textAlign value '${s}' is not valid. Aborted`),!1):!0};class ae extends g{constructor(){super("flexDirection","inherit",!0),this.isValid=Xs}}const js=["row","row-reverse","column","column-reverse"];function Xs(s){return js.indexOf(s)===-1?(console.warn(`(.style) flexDirection value '${s}' is not valid. Aborted`),!1):!0}class le extends g{constructor(){super("justifyContent","inherit",!0),this.isValidValue=Ns}}const Ys=["start","center","end","space-between","space-around","space-evenly"];function Ns(s){return Ys.indexOf(s)===-1?(console.warn(`(.style) justifyContent value '${s}' is not valid. Aborted`),!1):!0}class Ks extends g{constructor(){super("order",0,!0),this._value=0,this._input=0,this._allowsInherit=!1}computeOutputValue(e){this._value=this._inheritedInput,e._parent._value&&(e._parent._value._children._needsProcess=!0)}}class We extends g{constructor(){super("position","static",!0),this._allowsInherit=!1,this._value="static",this._needsUpdate=!1,this.computeOutputValue=this._computeFromInherited,this.isValidValue=Js}_computeFromInherited(e){super._computeFromInherited(e),e._parent._value&&(e._parent._value._children._needsProcess=!0)}}const qs=["static","absolute"];function Js(s){return qs.indexOf(s)===-1?(console.warn(`(.style) position value '${s}' is not valid. Aborted`),!1):!0}class De extends g{constructor(e,t=null){super(e,t,!0),this._input="auto",this._auto=!0,this._relative=!1,this._updateRequired=!0}set inline(e){this.isValidValue(e)&&e!==this._inline&&(this._inline=e,this._input!==this._inline&&this._parseInput())}get inline(){return this._inline}_parseInput(){let e=!0;if(this._inline!==void 0&&this._inline!=="unset"?this._input=this._inline:this._computed!==void 0?(this._computed===this._input&&(e=!1),this._input=this._computed):e=this._input==="inherit",e){if(this._auto=!this._input||this._input==="auto",this._auto)this._relative=!1;else if((typeof this._input=="string"||this._input instanceof String)&&this._input.endsWith("%")){this._relative=!0,this._value=0;const t=parseFloat(this._input.replace("%","").trim());isNaN(t)||(this._value=t/100)}else this._relative=!1,this._value=this._input;this._needsUpdate=this._updateRequired=e}}update(e,t){if(this._updateRequired){this._updateRequired=!1,this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const i of e._children._uis)i[`_${this._id}`]._needsUpdate=!0;this.output(t),e._parent._value&&(e._parent._value._layouter._needsProcess=!0)}}computeOutputValue(e){e._bounds._needsUpdate=!0,e._renderer._needsRender=!0}getInheritedInput(e){if(this._input!=="inherit"&&!this._auto)return this._input;const t=e._parent._value;return t?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}getDefaultValue(){return 0}get value(){return this._value}}class Qs extends De{constructor(){super("width")}}class Zs extends De{constructor(){super("height")}computeOutputValue(e){super.computeOutputValue(e)}}class Ee extends k{constructor(){super("textContent"),this._needsUpdate=!1}set value(e){}process(e){let t="";for(let i=0;i<e.children.length;i++){const n=e.children[i];n.isUI&&(t+=n.textContent)}this._value=t}}class Le extends g{constructor(e){super("fontStyle",e,!0),this.isValidValue=ti}}const ei=["normal","italic"];function ti(s){return ei.indexOf(s)===-1?(console.warn(`(.style) fontStyle value '${s}' is not valid. Aborted`),!1):!0}class He extends g{constructor(){super("fontWeight","inherit",!0),this.isValid=ii}}const si=["100","200","300","400","500","600","700","800","900","light","normal","bold","bolder"];function ii(s){return si.indexOf(s.toString())===-1?(console.warn(`(.style) fontWeight value '${s}' is not valid. Aborted`),!1):!0}class Ge{constructor(){this._size=42,this._lineHeight=42,this._lineBase=38,this._name="-",this._charset=""}get size(){return this._size}get lineHeight(){return this._lineHeight}get lineBase(){return this._lineBase}get name(){return this._name}get charset(){return this._charset}}class ni extends Ge{constructor(e){super(),this._size=e.info.size,this._lineHeight=e.common.lineHeight,this._lineBase=e.common.base,this._name=e.info.face,this._textureWidth=e.common.scaleW,this._textureHeight=e.common.scaleH,this._charset=e.chars.map(t=>t.char).join("")}get textureWidth(){return this._textureWidth}get textureHeight(){return this._textureHeight}}class ri extends Fe{constructor(e){super(e)}get uv(){return this.typographic.uv}}class q extends Te{constructor(e,t){super(e),this._char=t.char,this._width=t.width,this._heigth=t.height,this._xadvance=t.xadvance?t.xadvance:this._width,this._xoffset=t.xoffset?t.xoffset:0,this._yoffset=t.yoffset?t.yoffset:0,this._uv=t.uv?t.uv:null,isNaN(t.x)||(this._uv={left:t.x/e.textureWidth,right:(t.x+t.width)/e.textureWidth,top:1-(t.y+t.height)/e.textureHeight,bottom:1-t.y/e.textureHeight})}get uv(){return this._uv}clone(e){return new q(this._font,{char:e,width:this._width,height:this._heigth,xadvance:this._xadvance,xoffset:this._xoffset,yoffset:this._yoffset,uv:null})}asInlineGlyph(){return new ri(this)}}class oi extends a.PlaneGeometry{constructor(e,t){let i=1,n=1;const r=e.typographic.font.size,o=t._segments.value;i=Math.ceil(e.typographic.width/r*o),n=Math.ceil(e.typographic.height/r*o),super(e.width,e.height,i,n),e.uv?(this._mapUVs(e),this._transformGeometry(e)):(this._nullifyUVs(),this.scale(0,0,1),this.translate(0,e.fontSize/2,0)),this.name="GlyphGeometry"}_mapUVs(e){const t=e.uv.right-e.uv.left,i=e.uv.bottom-e.uv.top,n=this.getAttribute("uv").array.slice(),r=[];for(let o=0;o<n.length;o+=2){const h=n[o],c=n[o+1];r.push(e.uv.left+t*h),r.push(e.uv.top+i*c)}this.setAttribute("uvG",new a.BufferAttribute(new Float32Array(r),2))}_nullifyUVs(){const e=[],t=this.getAttribute("uv").array.length;for(let i=0;i<t;i++)e.push(0);this.setAttribute("uvG",new a.BufferAttribute(new Float32Array(e),2))}_transformGeometry(e){this.translate(e.width/2,-e.height/2,0)}}const ai=`
3
3
  attribute vec2 uvG;
4
4
  varying vec2 vUvG;