@esengine/ecs-framework-math 2.10.0 → 2.10.3

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 (92) hide show
  1. package/dist/index.cjs +2 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.ts +10175 -0
  4. package/dist/index.mjs +2 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/index.umd.js +2 -0
  7. package/dist/index.umd.js.map +1 -0
  8. package/package.json +21 -12
  9. package/bin/Animation/Easing.d.ts +0 -244
  10. package/bin/Animation/Easing.d.ts.map +0 -1
  11. package/bin/Animation/Easing.js +0 -407
  12. package/bin/Animation/Easing.js.map +0 -1
  13. package/bin/Animation/Interpolation.d.ts +0 -172
  14. package/bin/Animation/Interpolation.d.ts.map +0 -1
  15. package/bin/Animation/Interpolation.js +0 -327
  16. package/bin/Animation/Interpolation.js.map +0 -1
  17. package/bin/Animation/index.d.ts +0 -8
  18. package/bin/Animation/index.d.ts.map +0 -1
  19. package/bin/Animation/index.js +0 -8
  20. package/bin/Animation/index.js.map +0 -1
  21. package/bin/Circle.d.ts +0 -277
  22. package/bin/Circle.d.ts.map +0 -1
  23. package/bin/Circle.js +0 -496
  24. package/bin/Circle.js.map +0 -1
  25. package/bin/Collision/CollisionDetector.d.ts +0 -114
  26. package/bin/Collision/CollisionDetector.d.ts.map +0 -1
  27. package/bin/Collision/CollisionDetector.js +0 -353
  28. package/bin/Collision/CollisionDetector.js.map +0 -1
  29. package/bin/Collision/index.d.ts +0 -7
  30. package/bin/Collision/index.d.ts.map +0 -1
  31. package/bin/Collision/index.js +0 -7
  32. package/bin/Collision/index.js.map +0 -1
  33. package/bin/Color.d.ts +0 -277
  34. package/bin/Color.d.ts.map +0 -1
  35. package/bin/Color.js +0 -470
  36. package/bin/Color.js.map +0 -1
  37. package/bin/Fixed32.d.ts +0 -266
  38. package/bin/Fixed32.d.ts.map +0 -1
  39. package/bin/Fixed32.js +0 -381
  40. package/bin/Fixed32.js.map +0 -1
  41. package/bin/FixedMath.d.ts +0 -109
  42. package/bin/FixedMath.d.ts.map +0 -1
  43. package/bin/FixedMath.js +0 -264
  44. package/bin/FixedMath.js.map +0 -1
  45. package/bin/FixedVector2.d.ts +0 -293
  46. package/bin/FixedVector2.d.ts.map +0 -1
  47. package/bin/FixedVector2.js +0 -413
  48. package/bin/FixedVector2.js.map +0 -1
  49. package/bin/MathUtils.d.ts +0 -312
  50. package/bin/MathUtils.d.ts.map +0 -1
  51. package/bin/MathUtils.js +0 -500
  52. package/bin/MathUtils.js.map +0 -1
  53. package/bin/Matrix3.d.ts +0 -288
  54. package/bin/Matrix3.d.ts.map +0 -1
  55. package/bin/Matrix3.js +0 -542
  56. package/bin/Matrix3.js.map +0 -1
  57. package/bin/Rectangle.d.ts +0 -266
  58. package/bin/Rectangle.d.ts.map +0 -1
  59. package/bin/Rectangle.js +0 -437
  60. package/bin/Rectangle.js.map +0 -1
  61. package/bin/Vector2.d.ts +0 -333
  62. package/bin/Vector2.d.ts.map +0 -1
  63. package/bin/Vector2.js +0 -484
  64. package/bin/Vector2.js.map +0 -1
  65. package/bin/Vector3.d.ts +0 -257
  66. package/bin/Vector3.d.ts.map +0 -1
  67. package/bin/Vector3.js +0 -372
  68. package/bin/Vector3.js.map +0 -1
  69. package/bin/index.d.ts +0 -25
  70. package/bin/index.d.ts.map +0 -1
  71. package/bin/index.js +0 -32
  72. package/bin/index.js.map +0 -1
  73. package/bin/nodes/ColorNodes.d.ts +0 -70
  74. package/bin/nodes/ColorNodes.d.ts.map +0 -1
  75. package/bin/nodes/ColorNodes.js +0 -427
  76. package/bin/nodes/ColorNodes.js.map +0 -1
  77. package/bin/nodes/FixedNodes.d.ts +0 -98
  78. package/bin/nodes/FixedNodes.d.ts.map +0 -1
  79. package/bin/nodes/FixedNodes.js +0 -612
  80. package/bin/nodes/FixedNodes.js.map +0 -1
  81. package/bin/nodes/FixedVectorNodes.d.ts +0 -58
  82. package/bin/nodes/FixedVectorNodes.d.ts.map +0 -1
  83. package/bin/nodes/FixedVectorNodes.js +0 -330
  84. package/bin/nodes/FixedVectorNodes.js.map +0 -1
  85. package/bin/nodes/VectorNodes.d.ts +0 -62
  86. package/bin/nodes/VectorNodes.d.ts.map +0 -1
  87. package/bin/nodes/VectorNodes.js +0 -355
  88. package/bin/nodes/VectorNodes.js.map +0 -1
  89. package/bin/nodes/index.d.ts +0 -20
  90. package/bin/nodes/index.d.ts.map +0 -1
  91. package/bin/nodes/index.js +0 -27
  92. package/bin/nodes/index.js.map +0 -1
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";class t{constructor(t=0,e=0){this.x=t,this.y=e}get length(){return Math.sqrt(this.x*this.x+this.y*this.y)}get lengthSquared(){return this.x*this.x+this.y*this.y}get angle(){return Math.atan2(this.y,this.x)}get isZero(){return 0===this.x&&0===this.y}get isUnit(){const t=this.lengthSquared;return Math.abs(t-1)<Number.EPSILON}set(t,e){return this.x=t,this.y=e,this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new t(this.x,this.y)}add(t){return this.x+=t.x,this.y+=t.y,this}subtract(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t,this.y*=t,this}divide(t){if(0===t)throw new Error("不能除以零");return this.x/=t,this.y/=t,this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}normalize(){const t=this.length;return 0===t?this:this.divide(t)}normalized(){return this.clone().normalize()}distanceTo(t){const e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}angleTo(t){const e=this.dot(t),r=this.length*t.length;return 0===r?0:Math.acos(Math.max(-1,Math.min(1,e/r)))}projectOnto(e){const r=this.dot(e),a=e.lengthSquared;return 0===a?new t:e.clone().multiply(r/a)}projectOntoLength(t){const e=t.length;return 0===e?0:this.dot(t)/e}perpendicular(){return new t(this.y,-this.x)}rotate(t){const e=Math.cos(t),r=Math.sin(t),a=this.x*e+this.y*r,s=-this.x*r+this.y*e;return this.x=a,this.y=s,this}rotated(t){return this.clone().rotate(t)}rotateAround(t,e){return this.subtract(t).rotate(e).add(t)}reflect(t){const e=this.dot(t);return this.x-=2*e*t.x,this.y-=2*e*t.y,this}reflected(t){return this.clone().reflect(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}clampLength(t){return this.lengthSquared>t*t?this.normalize().multiply(t):this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}equals(t,e=Number.EPSILON){return Math.abs(this.x-t.x)<e&&Math.abs(this.y-t.y)<e}exactEquals(t){return this.x===t.x&&this.y===t.y}static add(e,r){return new t(e.x+r.x,e.y+r.y)}static subtract(e,r){return new t(e.x-r.x,e.y-r.y)}static multiply(e,r){return new t(e.x*r,e.y*r)}static dot(t,e){return t.x*e.x+t.y*e.y}static cross(t,e){return t.x*e.y-t.y*e.x}static distance(t,e){const r=t.x-e.x,a=t.y-e.y;return Math.sqrt(r*r+a*a)}static lerp(e,r,a){return new t(e.x+(r.x-e.x)*a,e.y+(r.y-e.y)*a)}static fromAngle(e){return new t(Math.cos(e),Math.sin(e))}static fromPolar(e,r){return new t(e*Math.cos(r),e*Math.sin(r))}static min(e,r){return new t(Math.min(e.x,r.x),Math.min(e.y,r.y))}static max(e,r){return new t(Math.max(e.x,r.x),Math.max(e.y,r.y))}toString(){return`Vector2(${this.x.toFixed(3)}, ${this.y.toFixed(3)})`}toArray(){return[this.x,this.y]}toObject(){return{x:this.x,y:this.y}}}t.ZERO=new t(0,0),t.ONE=new t(1,1),t.RIGHT=new t(1,0),t.LEFT=new t(-1,0),t.UP=new t(0,1),t.DOWN=new t(0,-1);class e{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.z=r}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}get lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}get isZero(){return 0===this.x&&0===this.y&&0===this.z}get isUnit(){const t=this.lengthSquared;return Math.abs(t-1)<Number.EPSILON}set(t,e,r){return this.x=t,this.y=e,this.z=r,this}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}clone(){return new e(this.x,this.y,this.z)}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}subtract(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}multiply(t){return this.x*=t,this.y*=t,this.z*=t,this}divide(t){if(0===t)throw new Error("不能除以零");return this.x/=t,this.y/=t,this.z/=t,this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){return new e(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)}normalize(){const t=this.length;return 0===t?this:this.divide(t)}normalized(){return this.clone().normalize()}distanceTo(t){const e=this.x-t.x,r=this.y-t.y,a=this.z-t.z;return Math.sqrt(e*e+r*r+a*a)}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y,a=this.z-t.z;return e*e+r*r+a*a}angleTo(t){const e=this.dot(t),r=this.length*t.length;return 0===r?0:Math.acos(Math.max(-1,Math.min(1,e/r)))}projectOnto(t){const r=this.dot(t),a=t.lengthSquared;return 0===a?new e:t.clone().multiply(r/a)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}clampLength(t){return this.lengthSquared>t*t?this.normalize().multiply(t):this}equals(t,e=Number.EPSILON){return Math.abs(this.x-t.x)<e&&Math.abs(this.y-t.y)<e&&Math.abs(this.z-t.z)<e}exactEquals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z}static add(t,r){return new e(t.x+r.x,t.y+r.y,t.z+r.z)}static subtract(t,r){return new e(t.x-r.x,t.y-r.y,t.z-r.z)}static multiply(t,r){return new e(t.x*r,t.y*r,t.z*r)}static dot(t,e){return t.x*e.x+t.y*e.y+t.z*e.z}static cross(t,r){return new e(t.y*r.z-t.z*r.y,t.z*r.x-t.x*r.z,t.x*r.y-t.y*r.x)}static distance(t,e){const r=t.x-e.x,a=t.y-e.y,s=t.z-e.z;return Math.sqrt(r*r+a*a+s*s)}static lerp(t,r,a){return new e(t.x+(r.x-t.x)*a,t.y+(r.y-t.y)*a,t.z+(r.z-t.z)*a)}toString(){return`Vector3(${this.x.toFixed(3)}, ${this.y.toFixed(3)}, ${this.z.toFixed(3)})`}toArray(){return[this.x,this.y,this.z]}toObject(){return{x:this.x,y:this.y,z:this.z}}}e.ZERO=new e(0,0,0),e.ONE=new e(1,1,1),e.RIGHT=new e(1,0,0),e.LEFT=new e(-1,0,0),e.UP=new e(0,1,0),e.DOWN=new e(0,-1,0),e.FORWARD=new e(0,0,1),e.BACK=new e(0,0,-1);class r{constructor(t){this.elements=new Float32Array(9),t?this.elements.set(t):this.identity()}get(t,e){return this.elements[3*t+e]}set(t,e,r){return this.elements[3*t+e]=r,this}get m00(){return this.elements[0]}set m00(t){this.elements[0]=t}get m01(){return this.elements[1]}set m01(t){this.elements[1]=t}get m02(){return this.elements[2]}set m02(t){this.elements[2]=t}get m10(){return this.elements[3]}set m10(t){this.elements[3]=t}get m11(){return this.elements[4]}set m11(t){this.elements[4]=t}get m12(){return this.elements[5]}set m12(t){this.elements[5]=t}get m20(){return this.elements[6]}set m20(t){this.elements[6]=t}get m21(){return this.elements[7]}set m21(t){this.elements[7]=t}get m22(){return this.elements[8]}set m22(t){this.elements[8]=t}identity(){return this.elements.set([1,0,0,0,1,0,0,0,1]),this}zero(){return this.elements.fill(0),this}copy(t){return this.elements.set(t.elements),this}clone(){return new r(this.elements)}fromArray(t){return this.elements.set(t),this}add(t){for(let e=0;e<9;e++)this.elements[e]+=t.elements[e];return this}subtract(t){for(let e=0;e<9;e++)this.elements[e]-=t.elements[e];return this}multiplyScalar(t){for(let e=0;e<9;e++)this.elements[e]*=t;return this}multiply(t){const e=this.elements,r=t.elements,a=new Float32Array(9);return a[0]=e[0]*r[0]+e[1]*r[3]+e[2]*r[6],a[1]=e[0]*r[1]+e[1]*r[4]+e[2]*r[7],a[2]=e[0]*r[2]+e[1]*r[5]+e[2]*r[8],a[3]=e[3]*r[0]+e[4]*r[3]+e[5]*r[6],a[4]=e[3]*r[1]+e[4]*r[4]+e[5]*r[7],a[5]=e[3]*r[2]+e[4]*r[5]+e[5]*r[8],a[6]=e[6]*r[0]+e[7]*r[3]+e[8]*r[6],a[7]=e[6]*r[1]+e[7]*r[4]+e[8]*r[7],a[8]=e[6]*r[2]+e[7]*r[5]+e[8]*r[8],this.elements.set(a),this}premultiply(t){const e=t.elements,r=this.elements,a=new Float32Array(9);return a[0]=e[0]*r[0]+e[1]*r[3]+e[2]*r[6],a[1]=e[0]*r[1]+e[1]*r[4]+e[2]*r[7],a[2]=e[0]*r[2]+e[1]*r[5]+e[2]*r[8],a[3]=e[3]*r[0]+e[4]*r[3]+e[5]*r[6],a[4]=e[3]*r[1]+e[4]*r[4]+e[5]*r[7],a[5]=e[3]*r[2]+e[4]*r[5]+e[5]*r[8],a[6]=e[6]*r[0]+e[7]*r[3]+e[8]*r[6],a[7]=e[6]*r[1]+e[7]*r[4]+e[8]*r[7],a[8]=e[6]*r[2]+e[7]*r[5]+e[8]*r[8],this.elements.set(a),this}makeTranslation(t,e){return this.elements.set([1,0,t,0,1,e,0,0,1]),this}makeRotation(t){const e=Math.cos(t),r=Math.sin(t);return this.elements.set([e,r,0,-r,e,0,0,0,1]),this}makeScale(t,e){return this.elements.set([t,0,0,0,e,0,0,0,1]),this}translate(t,e){return this.m02+=this.m00*t+this.m01*e,this.m12+=this.m10*t+this.m11*e,this}rotate(t){const e=Math.cos(t),r=Math.sin(t),a=this.m00*e-this.m01*r,s=this.m00*r+this.m01*e,o=this.m10*e-this.m11*r,i=this.m10*r+this.m11*e;return this.m00=a,this.m01=s,this.m10=o,this.m11=i,this}scale(t,e){return this.m00*=t,this.m01*=e,this.m10*=t,this.m11*=e,this}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}determinant(){const t=this.elements;return t[0]*(t[4]*t[8]-t[5]*t[7])-t[1]*(t[3]*t[8]-t[5]*t[6])+t[2]*(t[3]*t[7]-t[4]*t[6])}invert(){const t=this.elements,e=this.determinant();if(Math.abs(e)<Number.EPSILON)return console.warn("Matrix3: 矩阵不可逆"),this;const r=1/e,a=new Float32Array(9);return a[0]=(t[4]*t[8]-t[5]*t[7])*r,a[1]=(t[2]*t[7]-t[1]*t[8])*r,a[2]=(t[1]*t[5]-t[2]*t[4])*r,a[3]=(t[5]*t[6]-t[3]*t[8])*r,a[4]=(t[0]*t[8]-t[2]*t[6])*r,a[5]=(t[2]*t[3]-t[0]*t[5])*r,a[6]=(t[3]*t[7]-t[4]*t[6])*r,a[7]=(t[1]*t[6]-t[0]*t[7])*r,a[8]=(t[0]*t[4]-t[1]*t[3])*r,this.elements.set(a),this}transformVector(e){const r=e.x,a=e.y,s=this.m20*r+this.m21*a+this.m22;return new t((this.m00*r+this.m01*a+this.m02)/s,(this.m10*r+this.m11*a+this.m12)/s)}transformDirection(e){return new t(this.m00*e.x+this.m01*e.y,this.m10*e.x+this.m11*e.y)}transformVectors(t){return t.map(t=>this.transformVector(t))}getTranslation(){return new t(this.m02,this.m12)}getRotation(){return Math.atan2(this.m01,this.m00)}getScale(){const e=Math.sqrt(this.m00*this.m00+this.m10*this.m10),r=Math.sqrt(this.m01*this.m01+this.m11*this.m11),a=this.determinant();return new t(a<0?-e:e,r)}decompose(){return{translation:this.getTranslation(),rotation:this.getRotation(),scale:this.getScale()}}equals(t,e=Number.EPSILON){for(let r=0;r<9;r++)if(Math.abs(this.elements[r]-t.elements[r])>=e)return!1;return!0}exactEquals(t){for(let e=0;e<9;e++)if(this.elements[e]!==t.elements[e])return!1;return!0}isIdentity(t=Number.EPSILON){return this.equals(r.IDENTITY,t)}static multiply(t,e){return t.clone().multiply(e)}static translation(t,e){return(new r).makeTranslation(t,e)}static rotation(t){return(new r).makeRotation(t)}static scale(t,e){return(new r).makeScale(t,e)}static TRS(t,e,a){const s=Math.cos(e),o=Math.sin(e);return new r([a.x*s,a.y*o,t.x,-a.x*o,a.y*s,t.y,0,0,1])}toString(){const t=this.elements;return`Matrix3(\n ${t[0].toFixed(3)}, ${t[1].toFixed(3)}, ${t[2].toFixed(3)}\n ${t[3].toFixed(3)}, ${t[4].toFixed(3)}, ${t[5].toFixed(3)}\n ${t[6].toFixed(3)}, ${t[7].toFixed(3)}, ${t[8].toFixed(3)}\n)`}toArray(){return Array.from(this.elements)}toCSSTransform(){const t=this.elements;return`matrix(${t[0]}, ${t[3]}, ${t[1]}, ${t[4]}, ${t[2]}, ${t[5]})`}}r.IDENTITY=new r([1,0,0,0,1,0,0,0,1]),r.ZERO=new r([0,0,0,0,0,0,0,0,0]);class a{constructor(t=0,e=0,r=0,a=0){this.x=t,this.y=e,this.width=r,this.height=a}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}get centerX(){return this.x+.5*this.width}get centerY(){return this.y+.5*this.height}get center(){return new t(this.centerX,this.centerY)}get topLeft(){return new t(this.x,this.y)}get topRight(){return new t(this.right,this.y)}get bottomLeft(){return new t(this.x,this.bottom)}get bottomRight(){return new t(this.right,this.bottom)}get area(){return this.width*this.height}get perimeter(){return 2*(this.width+this.height)}get isEmpty(){return this.width<=0||this.height<=0}get isSquare(){return this.width===this.height&&this.width>0}set(t,e,r,a){return this.x=t,this.y=e,this.width=r,this.height=a,this}copy(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}clone(){return new a(this.x,this.y,this.width,this.height)}setPosition(t,e){return this.x=t,this.y=e,this}setSize(t,e){return this.width=t,this.height=e,this}setCenter(t,e){return this.x=t-.5*this.width,this.y=e-.5*this.height,this}translate(t,e){return this.x+=t,this.y+=e,this}scale(t,e=t){const r=this.centerX,a=this.centerY;return this.width*=t,this.height*=e,this.setCenter(r,a)}inflate(t){return this.x-=t,this.y-=t,this.width+=2*t,this.height+=2*t,this}inflateXY(t,e){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}containsPoint(t){return t.x>=this.x&&t.x<=this.right&&t.y>=this.y&&t.y<=this.bottom}contains(t,e){return t>=this.x&&t<=this.right&&e>=this.y&&e<=this.bottom}containsRect(t){return this.x<=t.x&&this.y<=t.y&&this.right>=t.right&&this.bottom>=t.bottom}intersects(t){return this.x<t.right&&this.right>t.x&&this.y<t.bottom&&this.bottom>t.y}intersection(t){if(!this.intersects(t))return a.EMPTY.clone();const e=Math.max(this.x,t.x),r=Math.max(this.y,t.y),s=Math.min(this.right,t.right),o=Math.min(this.bottom,t.bottom);return new a(e,r,s-e,o-r)}union(t){const e=Math.min(this.x,t.x),r=Math.min(this.y,t.y),s=Math.max(this.right,t.right),o=Math.max(this.bottom,t.bottom);return new a(e,r,s-e,o-r)}intersectionArea(t){const e=this.intersection(t);return e.isEmpty?0:e.area}distanceToPoint(t){const e=Math.max(0,Math.max(this.x-t.x,t.x-this.right)),r=Math.max(0,Math.max(this.y-t.y,t.y-this.bottom));return Math.sqrt(e*e+r*r)}distanceToRect(t){if(this.intersects(t))return 0;const e=Math.max(0,Math.max(this.x-t.right,t.x-this.right)),r=Math.max(0,Math.max(this.y-t.bottom,t.y-this.bottom));return Math.sqrt(e*e+r*r)}closestPointTo(e){return new t(Math.max(this.x,Math.min(this.right,e.x)),Math.max(this.y,Math.min(this.bottom,e.y)))}equals(t,e=Number.EPSILON){return Math.abs(this.x-t.x)<e&&Math.abs(this.y-t.y)<e&&Math.abs(this.width-t.width)<e&&Math.abs(this.height-t.height)<e}exactEquals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}static fromCenter(t,e,r,s){return new a(t-.5*r,e-.5*s,r,s)}static fromPoints(t,e){const r=Math.min(t.x,e.x),s=Math.min(t.y,e.y),o=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);return new a(r,s,o,i)}static fromPointArray(t){if(0===t.length)return a.EMPTY.clone();let e=t[0].x,r=t[0].y,s=t[0].x,o=t[0].y;for(let a=1;a<t.length;a++)e=Math.min(e,t[a].x),r=Math.min(r,t[a].y),s=Math.max(s,t[a].x),o=Math.max(o,t[a].y);return new a(e,r,s-e,o-r)}static square(t,e,r){return new a(t,e,r,r)}static lerp(t,e,r){return new a(t.x+(e.x-t.x)*r,t.y+(e.y-t.y)*r,t.width+(e.width-t.width)*r,t.height+(e.height-t.height)*r)}toString(){return`Rectangle(${this.x.toFixed(2)}, ${this.y.toFixed(2)}, ${this.width.toFixed(2)}, ${this.height.toFixed(2)})`}toArray(){return[this.x,this.y,this.width,this.height]}toObject(){return{x:this.x,y:this.y,width:this.width,height:this.height}}getVertices(){return[this.topLeft,this.topRight,this.bottomRight,this.bottomLeft]}}a.EMPTY=new a(0,0,0,0);class s{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r}get center(){return new t(this.x,this.y)}set center(t){this.x=t.x,this.y=t.y}get diameter(){return 2*this.radius}set diameter(t){this.radius=.5*t}get area(){return Math.PI*this.radius*this.radius}get circumference(){return 2*Math.PI*this.radius}get bounds(){return new a(this.x-this.radius,this.y-this.radius,this.diameter,this.diameter)}get isEmpty(){return this.radius<=0}set(t,e,r){return this.x=t,this.y=e,this.radius=r,this}copy(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}clone(){return new s(this.x,this.y,this.radius)}setPosition(t,e){return this.x=t,this.y=e,this}setCenter(t){return this.x=t.x,this.y=t.y,this}setRadius(t){return this.radius=t,this}translate(t,e){return this.x+=t,this.y+=e,this}translateBy(t){return this.x+=t.x,this.y+=t.y,this}scale(t){return this.radius*=t,this}inflate(t){return this.radius+=t,this}containsPoint(t){const e=t.x-this.x,r=t.y-this.y;return e*e+r*r<=this.radius*this.radius}contains(t,e){const r=t-this.x,a=e-this.y;return r*r+a*a<=this.radius*this.radius}containsCircle(t){return this.distanceToCircle(t)+t.radius<=this.radius}pointOnBoundary(t,e=Number.EPSILON){const r=this.distanceToPoint(t);return Math.abs(r-this.radius)<e}intersects(t){const e=this.x-t.x,r=this.y-t.y,a=e*e+r*r,s=this.radius+t.radius;return a<=s*s}intersectsRect(t){const e=Math.max(t.x,Math.min(this.x,t.right)),r=Math.max(t.y,Math.min(this.y,t.bottom)),a=this.x-e,s=this.y-r;return a*a+s*s<=this.radius*this.radius}intersectionArea(t){const e=this.distanceToCircle(t);if(e>=this.radius+t.radius)return 0;if(e<=Math.abs(this.radius-t.radius)){const e=Math.min(this.radius,t.radius);return Math.PI*e*e}const r=this.radius,a=t.radius;return r*r*Math.acos((e*e+r*r-a*a)/(2*e*r))+a*a*Math.acos((e*e+a*a-r*r)/(2*e*a))-.5*Math.sqrt((-e+r+a)*(e+r-a)*(e-r+a)*(e+r+a))}distanceToPoint(t){const e=t.x-this.x,r=t.y-this.y;return Math.sqrt(e*e+r*r)}distanceToPointFromBoundary(t){return this.distanceToPoint(t)-this.radius}distanceToCircle(t){const e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)}distanceToCircleFromBoundary(t){return this.distanceToCircle(t)-this.radius-t.radius}distanceToRect(t){return Math.max(0,t.distanceToPoint(this.center)-this.radius)}closestPointTo(e){const r=t.subtract(e,this.center);return r.isZero?new t(this.x+this.radius,this.y):this.center.clone().add(r.normalized().multiply(this.radius))}farthestPointFrom(e){const r=t.subtract(e,this.center);return r.isZero?new t(this.x-this.radius,this.y):this.center.clone().subtract(r.normalized().multiply(this.radius))}getPointAtAngle(e){return new t(this.x+this.radius*Math.cos(e),this.y+this.radius*Math.sin(e))}getAngleToPoint(t){return Math.atan2(t.y-this.y,t.x-this.x)}getLineIntersections(e,r){const a=r.x-e.x,s=r.y-e.y,o=e.x-this.x,i=e.y-this.y,n=a*a+s*s,u=2*(o*a+i*s),c=u*u-4*n*(o*o+i*i-this.radius*this.radius);if(c<0)return[];if(0===c){const r=-u/(2*n);return[new t(e.x+r*a,e.y+r*s)]}const l=Math.sqrt(c),h=(-u-l)/(2*n),p=(-u+l)/(2*n);return[new t(e.x+h*a,e.y+h*s),new t(e.x+p*a,e.y+p*s)]}equals(t,e=Number.EPSILON){return Math.abs(this.x-t.x)<e&&Math.abs(this.y-t.y)<e&&Math.abs(this.radius-t.radius)<e}exactEquals(t){return this.x===t.x&&this.y===t.y&&this.radius===t.radius}static fromDiameter(t,e,r){return new s(t,e,.5*r)}static fromThreePoints(t,e,r){const a=t.x,o=t.y,i=e.x,n=e.y,u=r.x,c=r.y,l=2*(a*(n-c)+i*(c-o)+u*(o-n));if(Math.abs(l)<Number.EPSILON)return null;const h=((a*a+o*o)*(n-c)+(i*i+n*n)*(c-o)+(u*u+c*c)*(o-n))/l,p=((a*a+o*o)*(u-i)+(i*i+n*n)*(a-u)+(u*u+c*c)*(i-a))/l,m=Math.sqrt((a-h)*(a-h)+(o-p)*(o-p));return new s(h,p,m)}static fromPointArray(e){if(0===e.length)return s.EMPTY.clone();if(1===e.length)return new s(e[0].x,e[0].y,0);let r=e[0].x,a=e[0].y,o=e[0].x,i=e[0].y;for(const t of e)r=Math.min(r,t.x),a=Math.min(a,t.y),o=Math.max(o,t.x),i=Math.max(i,t.y);const n=.5*(r+o),u=.5*(a+i),c=new t(n,u);let l=0;for(const r of e){const e=t.distance(c,r);l=Math.max(l,e)}return new s(n,u,l)}static lerp(t,e,r){return new s(t.x+(e.x-t.x)*r,t.y+(e.y-t.y)*r,t.radius+(e.radius-t.radius)*r)}toString(){return`Circle(${this.x.toFixed(2)}, ${this.y.toFixed(2)}, r=${this.radius.toFixed(2)})`}toArray(){return[this.x,this.y,this.radius]}toObject(){return{x:this.x,y:this.y,radius:this.radius}}}s.EMPTY=new s(0,0,0),s.UNIT=new s(0,0,1);class o{constructor(t){this.raw=0|t}static from(t){return new o(Math.round(t*o.SCALE))}static fromRaw(t){return new o(t)}static fromInt(t){return new o((0|t)<<o.FRACTION_BITS)}toNumber(){return this.raw/o.SCALE}toRaw(){return this.raw}toInt(){return this.raw>>o.FRACTION_BITS}toString(){return`Fixed32(${this.toNumber().toFixed(5)})`}add(t){return new o(this.raw+t.raw)}sub(t){return new o(this.raw-t.raw)}mul(t){const e=this.raw,r=t.raw,a=65535&e,s=e>>16,i=65535&r,n=r>>16,u=a*i>>>16,c=a*n,l=s*i,h=s*n*o.SCALE+c+l+u;return new o(0|h)}div(t){if(0===t.raw)throw new Error("Fixed32: Division by zero");const e=this.raw*o.SCALE/t.raw|0;return new o(e)}mod(t){return new o(this.raw%t.raw)}neg(){return new o(-this.raw)}abs(){return this.raw>=0?this:new o(-this.raw)}eq(t){return this.raw===t.raw}ne(t){return this.raw!==t.raw}lt(t){return this.raw<t.raw}le(t){return this.raw<=t.raw}gt(t){return this.raw>t.raw}ge(t){return this.raw>=t.raw}isZero(){return 0===this.raw}isPositive(){return this.raw>0}isNegative(){return this.raw<0}static sqrt(t){if(t.raw<=0)return o.ZERO;let e=t.raw,r=0;for(let a=0;a<16&&(r=e,e=e+t.raw*o.SCALE/e>>1,e!==r);a++);return new o(e)}static floor(t){return new o(t.raw&~(o.SCALE-1))}static ceil(t){return 0===(t.raw&o.SCALE-1)?t:new o((t.raw&~(o.SCALE-1))+o.SCALE)}static round(t){return new o(t.raw+(o.SCALE>>1)&~(o.SCALE-1))}static min(t,e){return t.raw<e.raw?t:e}static max(t,e){return t.raw>e.raw?t:e}static clamp(t,e,r){return t.raw<e.raw?e:t.raw>r.raw?r:t}static lerp(t,e,r){return t.add(e.sub(t).mul(r))}static sign(t){return t.raw>0?o.ONE:t.raw<0?o.NEG_ONE:o.ZERO}static add(t,e){return t.add(e)}static sub(t,e){return t.sub(e)}static mul(t,e){return t.mul(e)}static div(t,e){return t.div(e)}}o.FRACTION_BITS=16,o.SCALE=65536,o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,o.EPSILON=1,o.ZERO=new o(0),o.ONE=new o(o.SCALE),o.NEG_ONE=new o(-o.SCALE),o.HALF=new o(o.SCALE>>1),o.PI=new o(205887),o.TWO_PI=new o(411775),o.HALF_PI=new o(102944),o.RAD_TO_DEG=new o(3754936),o.DEG_TO_RAD=new o(1144);class i{static generateSinTable(){const t=new Int32Array(i.SIN_TABLE_SIZE+1);for(let e=0;e<=i.SIN_TABLE_SIZE;e++){const r=e*Math.PI/(2*i.SIN_TABLE_SIZE);t[e]=Math.round(Math.sin(r)*o.SCALE)}return t}static sin(t){let e=t.raw%o.TWO_PI.raw;e<0&&(e+=o.TWO_PI.raw);const r=o.HALF_PI.raw,a=o.PI.raw;let s,n=!1;e<=r?s=e:e<=a?s=a-e:e<=3*r?(s=e-a,n=!0):(s=o.TWO_PI.raw-e,n=!0);const u=Math.min(s*i.SIN_TABLE_SIZE/r|0,i.SIN_TABLE_SIZE),c=i.SIN_TABLE[u];return o.fromRaw(n?-c:c)}static cos(t){return i.sin(t.add(o.HALF_PI))}static tan(t){const e=i.cos(t);return e.isZero()?o.fromRaw(o.MAX_VALUE):i.sin(t).div(e)}static atan2(t,e){const r=t.raw,a=e.raw;if(0===a&&0===r)return o.ZERO;const s=Math.abs(r),n=Math.abs(a);let u;return u=n>=s?i.atanApprox(s,n):o.HALF_PI.raw-i.atanApprox(n,s),a<0&&(u=o.PI.raw-u),r<0&&(u=-u),o.fromRaw(u)}static atanApprox(t,e){if(0===e)return o.HALF_PI.raw;const r=t*o.SCALE/e|0,a=r*r/o.SCALE|0,s=o.SCALE+(18432*a/o.SCALE|0);return r*o.SCALE/s|0}static asin(t){const e=o.ONE,r=t.mul(t),a=o.sqrt(e.sub(r));return i.atan2(t,a)}static acos(t){return o.HALF_PI.sub(i.asin(t))}static normalizeAngle(t){let e=t.raw%o.TWO_PI.raw;return e>o.PI.raw?e-=o.TWO_PI.raw:e<-o.PI.raw&&(e+=o.TWO_PI.raw),o.fromRaw(e)}static angleDelta(t,e){return i.normalizeAngle(e.sub(t))}static lerpAngle(t,e,r){const a=i.angleDelta(t,e);return t.add(a.mul(r))}static radToDeg(t){return t.mul(o.RAD_TO_DEG)}static degToRad(t){return t.mul(o.DEG_TO_RAD)}static pow(t,e){if(0===e)return o.ONE;e<0&&(t=o.ONE.div(t),e=-e);let r=o.ONE;for(;e>0;)1&e&&(r=r.mul(t)),t=t.mul(t),e>>=1;return r}static exp(t){const e=o.ONE,r=t.mul(t),a=r.mul(t),s=a.mul(t);return e.add(t).add(r.div(o.from(2))).add(a.div(o.from(6))).add(s.div(o.from(24)))}static ln(t){if(t.raw<=0)throw new Error("FixedMath.ln: argument must be positive");let e=o.ZERO;const r=o.from(2);for(let a=0;a<10;a++){const a=i.exp(e),s=t.sub(a),o=t.add(a);e=e.add(r.mul(s).div(o))}return e}}i.SIN_TABLE_SIZE=1024,i.SIN_TABLE=i.generateSinTable();class n{constructor(t,e){this.x=t,this.y=e}static from(t,e){return new n(o.from(t),o.from(e))}static fromRaw(t,e){return new n(o.fromRaw(t),o.fromRaw(e))}static fromInt(t,e){return new n(o.fromInt(t),o.fromInt(e))}static fromObject(t){return n.from(t.x,t.y)}toObject(){return{x:this.x.toNumber(),y:this.y.toNumber()}}toArray(){return[this.x.toNumber(),this.y.toNumber()]}toRawObject(){return{x:this.x.toRaw(),y:this.y.toRaw()}}toString(){return`FixedVector2(${this.x.toNumber().toFixed(3)}, ${this.y.toNumber().toFixed(3)})`}clone(){return new n(this.x,this.y)}add(t){return new n(this.x.add(t.x),this.y.add(t.y))}sub(t){return new n(this.x.sub(t.x),this.y.sub(t.y))}mul(t){return new n(this.x.mul(t),this.y.mul(t))}div(t){return new n(this.x.div(t),this.y.div(t))}mulComponents(t){return new n(this.x.mul(t.x),this.y.mul(t.y))}divComponents(t){return new n(this.x.div(t.x),this.y.div(t.y))}neg(){return new n(this.x.neg(),this.y.neg())}dot(t){return this.x.mul(t.x).add(this.y.mul(t.y))}cross(t){return this.x.mul(t.y).sub(this.y.mul(t.x))}lengthSquared(){return this.dot(this)}length(){return o.sqrt(this.lengthSquared())}normalize(){const t=this.length();return t.isZero()?n.ZERO:this.div(t)}distanceSquaredTo(t){const e=this.x.sub(t.x),r=this.y.sub(t.y);return e.mul(e).add(r.mul(r))}distanceTo(t){return o.sqrt(this.distanceSquaredTo(t))}perpendicular(){return new n(this.y,this.x.neg())}perpendicularCCW(){return new n(this.y.neg(),this.x)}projectOnto(t){const e=this.dot(t),r=t.lengthSquared();return r.isZero()?n.ZERO:t.mul(e.div(r))}reflect(t){const e=this.dot(t),r=o.from(2);return this.sub(t.mul(r.mul(e)))}rotate(t){const e=i.cos(t),r=i.sin(t);return new n(this.x.mul(e).add(this.y.mul(r)),this.x.neg().mul(r).add(this.y.mul(e)))}rotateAround(t,e){return this.sub(t).rotate(e).add(t)}angle(){return i.atan2(this.y,this.x)}angleTo(t){const e=this.cross(t),r=this.dot(t);return i.atan2(e,r)}static fromPolar(t,e){return new n(t.mul(i.cos(e)),t.mul(i.sin(e)))}static fromAngle(t){return new n(i.cos(t),i.sin(t))}equals(t){return this.x.eq(t.x)&&this.y.eq(t.y)}isZero(){return this.x.isZero()&&this.y.isZero()}clampLength(t){const e=this.lengthSquared(),r=t.mul(t);return e.gt(r)?this.normalize().mul(t):this}clamp(t,e){return new n(o.clamp(this.x,t.x,e.x),o.clamp(this.y,t.y,e.y))}lerp(t,e){return new n(o.lerp(this.x,t.x,e),o.lerp(this.y,t.y,e))}moveTowards(t,e){const r=t.sub(this),a=r.length();return a.isZero()||a.le(e)?t:this.add(r.div(a).mul(e))}static add(t,e){return t.add(e)}static sub(t,e){return t.sub(e)}static dot(t,e){return t.dot(e)}static cross(t,e){return t.cross(e)}static distance(t,e){return t.distanceTo(e)}static lerp(t,e,r){return t.lerp(e,r)}static min(t,e){return new n(o.min(t.x,e.x),o.min(t.y,e.y))}static max(t,e){return new n(o.max(t.x,e.x),o.max(t.y,e.y))}}n.ZERO=new n(o.ZERO,o.ZERO),n.ONE=new n(o.ONE,o.ONE),n.RIGHT=new n(o.ONE,o.ZERO),n.LEFT=new n(o.NEG_ONE,o.ZERO),n.UP=new n(o.ZERO,o.ONE),n.DOWN=new n(o.ZERO,o.NEG_ONE);class u{static degToRad(t){return t*u.DEG_TO_RAD}static radToDeg(t){return t*u.RAD_TO_DEG}static normalizeAngle(t){for(;t<0;)t+=u.TWO_PI;for(;t>=u.TWO_PI;)t-=u.TWO_PI;return t}static normalizeAngleSigned(t){for(;t<=-Math.PI;)t+=u.TWO_PI;for(;t>Math.PI;)t-=u.TWO_PI;return t}static angleDifference(t,e){let r=e-t;return r=u.normalizeAngleSigned(r),r}static lerpAngle(t,e,r){return t+u.angleDifference(t,e)*r}static clamp(t,e,r){return Math.max(e,Math.min(r,t))}static clamp01(t){return Math.max(0,Math.min(1,t))}static lerp(t,e,r){return t+(e-t)*r}static inverseLerp(t,e,r){return Math.abs(e-t)<u.EPSILON?0:(r-t)/(e-t)}static remap(t,e,r,a,s){const o=u.inverseLerp(e,r,t);return u.lerp(a,s,o)}static smoothStep(t){return(t=u.clamp01(t))*t*(3-2*t)}static smootherStep(t){return(t=u.clamp01(t))*t*t*(t*(6*t-15)+10)}static approximately(t,e,r=u.EPSILON){return Math.abs(t-e)<r}static isZero(t,e=u.EPSILON){return Math.abs(t)<e}static sign(t){return t>0?1:t<0?-1:0}static random(t=0,e=1){return Math.random()*(e-t)+t}static randomInt(t,e){return Math.floor(Math.random()*(e-t+1))+t}static randomChoice(t){return t[Math.floor(Math.random()*t.length)]}static randomBoolean(t=.5){return Math.random()<t}static randomInUnitCircle(){const e=Math.random()*u.TWO_PI,r=Math.sqrt(Math.random());return t.fromPolar(r,e)}static randomOnUnitCircle(){const e=Math.random()*u.TWO_PI;return t.fromAngle(e)}static fastInverseSqrt(t){return 1/Math.sqrt(t)}static fastPow(t,e){return 0===e?1:1===e?t:2===e?t*t:3===e?t*t*t:Math.pow(t,e)}static factorial(t){if(t<0)return NaN;if(0===t||1===t)return 1;let e=1;for(let r=2;r<=t;r++)e*=r;return e}static gcd(t,e){for(t=Math.abs(Math.floor(t)),e=Math.abs(Math.floor(e));0!==e;){const r=e;e=t%e,t=r}return t}static lcm(t,e){return Math.abs(t*e)/u.gcd(t,e)}static fibonacci(t){if(t<=0)return 0;if(1===t)return 1;let e=0,r=1;for(let a=2;a<=t;a++){const t=e+r;e=r,r=t}return r}static arithmeticSum(t,e,r){return(t+e)*r*.5}static geometricSum(t,e,r){return Math.abs(e-1)<u.EPSILON?t*r:t*(1-Math.pow(e,r))/(1-e)}static quadraticBezier(e,r,a,s){const o=1-s,i=s*s,n=o*o;return new t(n*e.x+2*o*s*r.x+i*a.x,n*e.y+2*o*s*r.y+i*a.y)}static cubicBezier(e,r,a,s,o){const i=1-o,n=o*o,u=i*i,c=u*i,l=n*o;return new t(c*e.x+3*u*o*r.x+3*i*n*a.x+l*s.x,c*e.y+3*u*o*r.y+3*i*n*a.y+l*s.y)}static catmullRom(e,r,a,s,o){const i=o*o,n=i*o,u=.5*(2*r.x+(-e.x+a.x)*o+(2*e.x-5*r.x+4*a.x-s.x)*i+(-e.x+3*r.x-3*a.x+s.x)*n),c=.5*(2*r.y+(-e.y+a.y)*o+(2*e.y-5*r.y+4*a.y-s.y)*i+(-e.y+3*r.y-3*a.y+s.y)*n);return new t(u,c)}static noise(t,e=0,r=0){const a=43758.5453*Math.sin(12.9898*t+78.233*e+37.719*r);return a-Math.floor(a)}static smoothNoise(t,e=0,r=0){const a=Math.floor(t),s=Math.floor(e),o=t-a,i=e-s,n=u.noise(a,s,r),c=u.noise(a+1,s,r),l=u.noise(a,s+1,r),h=u.noise(a+1,s+1,r),p=u.lerp(n,c,o),m=u.lerp(l,h,o);return u.lerp(p,m,i)}static toPrecision(t,e){const r=Math.pow(10,e);return Math.round(t*r)/r}static inRange(t,e,r){return t>=e&&t<=r}static min(...t){return Math.min(...t)}static max(...t){return Math.max(...t)}static average(t){return 0===t.length?0:t.reduce((t,e)=>t+e,0)/t.length}static median(t){if(0===t.length)return 0;const e=[...t].sort((t,e)=>t-e),r=Math.floor(e.length/2);return e.length%2==0?(e[r-1]+e[r])/2:e[r]}}u.PI=Math.PI,u.TWO_PI=2*Math.PI,u.HALF_PI=.5*Math.PI,u.QUARTER_PI=.25*Math.PI,u.DEG_TO_RAD=Math.PI/180,u.RAD_TO_DEG=180/Math.PI,u.GOLDEN_RATIO=.5*(1+Math.sqrt(5)),u.EPSILON=Number.EPSILON;class c{constructor(t=255,e=255,r=255,a=1){this.r=Math.round(Math.max(0,Math.min(255,t))),this.g=Math.round(Math.max(0,Math.min(255,e))),this.b=Math.round(Math.max(0,Math.min(255,r))),this.a=Math.max(0,Math.min(1,a))}static fromHex(t,e=1){const{r:r,g:a,b:s}=c.hexToRgb(t);return new c(r,a,s,e)}static fromUint32(t,e=!1){if(e){return new c(t>>16&255,t>>8&255,255&t,(t>>24&255)/255)}return new c(t>>16&255,t>>8&255,255&t)}static fromHSL(t,e,r,a=1){const{r:s,g:o,b:i}=c.hslToRgb(t,e,r);return new c(s,o,i,a)}static fromFloat(t,e,r,a=1){return new c(255*t,255*e,255*r,a)}static hexToRgb(t){const e=t.replace("#","");let r=255,a=255,s=255;return 6===e.length?(r=parseInt(e.substring(0,2),16),a=parseInt(e.substring(2,4),16),s=parseInt(e.substring(4,6),16)):3===e.length?(r=parseInt(e[0]+e[0],16),a=parseInt(e[1]+e[1],16),s=parseInt(e[2]+e[2],16)):8===e.length&&(r=parseInt(e.substring(2,4),16),a=parseInt(e.substring(4,6),16),s=parseInt(e.substring(6,8),16)),{r:r,g:a,b:s}}static rgbToHex(t,e,r){const a=t=>Math.round(t).toString(16).padStart(2,"0");return`#${a(t)}${a(e)}${a(r)}`}static hslToRgb(t,e,r){let a,s,o;if(t=(t%360+360)%360/360,e=Math.max(0,Math.min(1,e)),r=Math.max(0,Math.min(1,r)),0===e)a=s=o=r;else{const i=(t,e,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t),n=r<.5?r*(1+e):r+e-r*e,u=2*r-n;a=i(u,n,t+1/3),s=i(u,n,t),o=i(u,n,t-1/3)}return{r:Math.round(255*a),g:Math.round(255*s),b:Math.round(255*o)}}static rgbToHsl(t,e,r){t/=255,e/=255,r/=255;const a=Math.max(t,e,r),s=Math.min(t,e,r);let o=0,i=0;const n=(a+s)/2;if(a!==s){const u=a-s;switch(i=n>.5?u/(2-a-s):u/(a+s),a){case t:o=((e-r)/u+(e<r?6:0))/6;break;case e:o=((r-t)/u+2)/6;break;case r:o=((t-e)/u+4)/6}}return{h:360*o,s:i,l:n}}static packRGB(t,e,r){return(255&t)<<16|(255&e)<<8|255&r}static packARGB(t,e,r,a){return(255&Math.round(255*a))<<24|(255&t)<<16|(255&e)<<8|255&r}static packABGR(t,e,r,a){return(255&Math.round(255*a))<<24|(255&r)<<16|(255&e)<<8|255&t}static packHexAlpha(t,e){const{r:r,g:a,b:s}=c.hexToRgb(t);return c.packABGR(r,a,s,e)}static unpackARGB(t){return{a:(t>>24&255)/255,r:t>>16&255,g:t>>8&255,b:255&t}}static unpackABGR(t){return{a:(t>>24&255)/255,b:t>>16&255,g:t>>8&255,r:255&t}}static lerp(t,e,r){return r=Math.max(0,Math.min(1,r)),new c(t.r+(e.r-t.r)*r,t.g+(e.g-t.g)*r,t.b+(e.b-t.b)*r,t.a+(e.a-t.a)*r)}static lerpUint32(t,e,r){r=Math.max(0,Math.min(1,r));const a=t>>16&255,s=t>>8&255,o=255&t,i=e>>16&255,n=e>>8&255,u=255&e;return Math.round(a+(i-a)*r)<<16|Math.round(s+(n-s)*r)<<8|Math.round(o+(u-o)*r)}static mix(t,e,r=.5){return c.lerp(t,e,r)}static lighten(t,e){const r=c.rgbToHsl(t.r,t.g,t.b);r.l=Math.min(1,r.l+e);const a=c.hslToRgb(r.h,r.s,r.l);return new c(a.r,a.g,a.b,t.a)}static darken(t,e){const r=c.rgbToHsl(t.r,t.g,t.b);r.l=Math.max(0,r.l-e);const a=c.hslToRgb(r.h,r.s,r.l);return new c(a.r,a.g,a.b,t.a)}static saturate(t,e){const r=c.rgbToHsl(t.r,t.g,t.b);r.s=Math.min(1,r.s+e);const a=c.hslToRgb(r.h,r.s,r.l);return new c(a.r,a.g,a.b,t.a)}static desaturate(t,e){const r=c.rgbToHsl(t.r,t.g,t.b);r.s=Math.max(0,r.s-e);const a=c.hslToRgb(r.h,r.s,r.l);return new c(a.r,a.g,a.b,t.a)}static invert(t){return new c(255-t.r,255-t.g,255-t.b,t.a)}static grayscale(t){const e=Math.round(.299*t.r+.587*t.g+.114*t.b);return new c(e,e,e,t.a)}static luminance(t){return(.299*t.r+.587*t.g+.114*t.b)/255}static contrastRatio(t,e){const r=c.luminance(t),a=c.luminance(e);return(Math.max(r,a)+.05)/(Math.min(r,a)+.05)}toHex(){return c.rgbToHex(this.r,this.g,this.b)}toHexAlpha(){return`#${Math.round(255*this.a).toString(16).padStart(2,"0")}${this.toHex().slice(1)}`}toRgba(){return`rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`}toRgb(){return`rgb(${this.r}, ${this.g}, ${this.b})`}toHSL(){return c.rgbToHsl(this.r,this.g,this.b)}toUint32(){return c.packRGB(this.r,this.g,this.b)}toUint32Alpha(){return c.packARGB(this.r,this.g,this.b,this.a)}toWebGL(){return c.packABGR(this.r,this.g,this.b,this.a)}toFloatArray(){return[this.r/255,this.g/255,this.b/255,this.a]}clone(){return new c(this.r,this.g,this.b,this.a)}set(t,e,r,a){return this.r=Math.round(Math.max(0,Math.min(255,t))),this.g=Math.round(Math.max(0,Math.min(255,e))),this.b=Math.round(Math.max(0,Math.min(255,r))),void 0!==a&&(this.a=Math.max(0,Math.min(1,a))),this}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}toString(){return`Color(${this.r}, ${this.g}, ${this.b}, ${this.a})`}}c.WHITE=new c(255,255,255),c.BLACK=new c(0,0,0),c.RED=new c(255,0,0),c.GREEN=new c(0,255,0),c.BLUE=new c(0,0,255),c.YELLOW=new c(255,255,0),c.CYAN=new c(0,255,255),c.MAGENTA=new c(255,0,255),c.TRANSPARENT=new c(0,0,0,0),c.GRAY=new c(128,128,128);class l{static linear(t){return t}static quadIn(t){return t*t}static quadOut(t){return 1-(1-t)*(1-t)}static quadInOut(t){return t<.5?2*t*t:1-2*(1-t)*(1-t)}static cubicIn(t){return t*t*t}static cubicOut(t){return 1-Math.pow(1-t,3)}static cubicInOut(t){return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2}static quartIn(t){return t*t*t*t}static quartOut(t){return 1-Math.pow(1-t,4)}static quartInOut(t){return t<.5?8*t*t*t*t:1-Math.pow(-2*t+2,4)/2}static quintIn(t){return t*t*t*t*t}static quintOut(t){return 1-Math.pow(1-t,5)}static quintInOut(t){return t<.5?16*t*t*t*t*t:1-Math.pow(-2*t+2,5)/2}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*(t-1))}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return 1-Math.sqrt(1-t*t)}static circOut(t){return Math.sqrt(1-(t-1)*(t-1))}static circInOut(t){return t<.5?(1-Math.sqrt(1-4*t*t))/2:(Math.sqrt(1-(-2*t+2)*(-2*t+2))+1)/2}static backIn(t,e=1.70158){return(e+1)*t*t*t-e*t*t}static backOut(t,e=1.70158){const r=e;return 1+(r+1)*Math.pow(t-1,3)+r*Math.pow(t-1,2)}static backInOut(t,e=1.70158){const r=1.525*e;return t<.5?Math.pow(2*t,2)*(2*(r+1)*t-r)/2:(Math.pow(2*t-2,2)*((r+1)*(2*t-2)+r)+2)/2}static elasticIn(t,e=1,r=.3){if(0===t)return 0;if(1===t)return 1;const a=r/4;return-e*Math.pow(2,10*(t-1))*Math.sin((t-1-a)*(2*Math.PI)/r)}static elasticOut(t,e=1,r=.3){if(0===t)return 0;if(1===t)return 1;const a=r/4;return e*Math.pow(2,-10*t)*Math.sin((t-a)*(2*Math.PI)/r)+1}static elasticInOut(t,e=1,r=.45){if(0===t)return 0;if(1===t)return 1;const a=r/4;return t<.5?e*Math.pow(2,10*(2*t-1))*Math.sin((2*t-1-a)*(2*Math.PI)/r)*-.5:e*Math.pow(2,-10*(2*t-1))*Math.sin((2*t-1-a)*(2*Math.PI)/r)*.5+1}static bounceIn(t){return 1-l.bounceOut(1-t)}static bounceOut(t){const e=7.5625,r=2.75;return t<1/r?e*t*t:t<2/r?e*(t-=1.5/r)*t+.75:t<2.5/r?e*(t-=2.25/r)*t+.9375:e*(t-=2.625/r)*t+.984375}static bounceInOut(t){return t<.5?(1-l.bounceOut(1-2*t))/2:(1+l.bounceOut(2*t-1))/2}static combine(t,e){return e||(e=new Array(t.length).fill(1/t.length)),r=>{let a=0;for(let s=0;s<t.length;s++)a+=t[s](r)*(e[s]||0);return a}}static piecewise(t){const e=t.reduce((t,e)=>t+e.duration,0),r=t.map(t=>({...t,duration:t.duration/e}));return t=>{let e=0;for(const a of r){if(t<=e+a.duration){const r=(t-e)/a.duration;return a.easing(Math.max(0,Math.min(1,r)))}e+=a.duration}return r[r.length-1].easing(1)}}static reverse(t){return e=>1-t(1-e)}static mirror(t){return e=>t(e<.5?2*e:2-2*e)}}l.smoothIn=l.quadOut,l.smoothOut=l.quadIn,l.quickIn=l.cubicOut,l.quickOut=l.cubicIn,l.natural=l.quartOut,l.emphasize=l.backOut;class h{constructor(t){this.cache=new Map,this.interpolator=t}setRange(t,e){this.from===t&&this.to===e||(this.from=t,this.to=e,this.cache.clear())}get(t){if(!this.from||!this.to)throw new Error("插值范围未设置");if(!this.cache.has(t)){const e=this.interpolator(this.from,this.to,t);this.cache.set(t,e)}return this.cache.get(t)}clearCache(){this.cache.clear()}}class p{static number(t,e,r){return u.lerp(t,e,r)}static vector2(e,r,a){return t.lerp(e,r,a)}static angle(t,e,r){return u.lerpAngle(t,e,r)}static color(t,e,r){const a=[],s=Math.max(t.length,e.length);for(let o=0;o<s;o++){const s=t[o]??(3===o?1:0),i=e[o]??(3===o?1:0);a[o]=u.lerp(s,i,r)}return a}static cubicSpline(t,e,r,a,s){const o=s*s;return.5*(2*e+(-t+r)*s+(2*t-5*e+4*r-a)*o+(3*e-t-3*r+a)*(o*s))}static hermite(t,e,r,a,s){const o=s*s,i=o*s;return(2*i-3*o+1)*t+(i-2*o+s)*e+(-2*i+3*o)*r+(i-o)*a}static slerp(e,r,a){let s=t.dot(e,r),o=r;if(s<0&&(s=-s,o=r.clone().negate()),s>.9995)return t.lerp(e,o,a).normalize();const i=Math.acos(Math.abs(s)),n=Math.sin(i),u=Math.sin((1-a)*i)/n,c=Math.sin(a*i)/n;return new t(e.x*u+o.x*c,e.y*u+o.y*c)}static createCachedInterpolator(t){return new h(t)}static spline(t,e){if(0===t.length)return 0;if(1===t.length)return t[0];if(2===t.length)return u.lerp(t[0],t[1],e);const r=t.length-1,a=e*r,s=Math.floor(a),o=a-s,i=Math.max(0,Math.min(r-1,s)),n=t[Math.max(0,i-1)],c=t[i],l=t[Math.min(r,i+1)],h=t[Math.min(r,i+2)];return p.cubicSpline(n,c,l,h,o)}static vectorSpline(e,r){if(0===e.length)return new t;if(1===e.length)return e[0].clone();if(2===e.length)return t.lerp(e[0],e[1],r);const a=e.map(t=>t.x),s=e.map(t=>t.y);return new t(p.spline(a,r),p.spline(s,r))}static keyframe(t,e,r){if(0===t.length)throw new Error("至少需要一个关键帧");if(1===t.length||e<=t[0].time)return t[0].value;if(e>=t[t.length-1].time)return t[t.length-1].value;for(let a=0;a<t.length-1;a++){const s=t[a],o=t[a+1];if(e>=s.time&&e<=o.time){const t=o.time-s.time,a=t>0?(e-s.time)/t:0,i=s.easing?s.easing(a):a;return r(s.value,o.value,i)}}return t[t.length-1].value}static pathInterpolation(e,r,a=!1){if(0===e.length)return new t;if(1===e.length)return e[0].clone();const s=r*p.getPathLength(e,a);let o=0;const i=a?e.length:e.length-1;for(let r=0;r<i;r++){const a=e[r],i=e[(r+1)%e.length],n=t.distance(a,i);if(o+n>=s){const e=(s-o)/n;return t.lerp(a,i,e)}o+=n}return e[e.length-1].clone()}static getPathLength(e,r=!1){if(e.length<2)return 0;let a=0;const s=r?e.length:e.length-1;for(let r=0;r<s;r++){const s=e[r],o=e[(r+1)%e.length];a+=t.distance(s,o)}return a}static createNumberInterpolator(t,e){return r=>p.number(t,e,r)}static createVectorInterpolator(t,e){return r=>p.vector2(t,e,r)}static createCompositeInterpolator(t){return(e,r,a)=>{const s=[];for(let o=0;o<Math.min(t.length,e.length,r.length);o++)s[o]=t[o](e[o],r[o],a);return s}}}const m={type:"MakeVector2",title:"Make Vector2",category:"math",description:"Creates a Vector2 from X and Y",keywords:["make","create","vector","vector2"],menuPath:["Math","Vector","Make Vector2"],isPure:!0,inputs:[{name:"x",displayName:"X",type:"float",defaultValue:0},{name:"y",displayName:"Y",type:"float",defaultValue:0}],outputs:[{name:"vector",displayName:"Vector",type:"vector2"}],color:"#2196F3"};class d{execute(e,r){const a=r,s=Number(a.evaluateInput(e.id,"x",0)),o=Number(a.evaluateInput(e.id,"y",0));return{outputs:{vector:new t(s,o)}}}}const x={type:"BreakVector2",title:"Break Vector2",category:"math",description:"Breaks a Vector2 into X and Y",keywords:["break","split","vector","vector2"],menuPath:["Math","Vector","Break Vector2"],isPure:!0,inputs:[{name:"vector",displayName:"Vector",type:"vector2"}],outputs:[{name:"x",displayName:"X",type:"float"},{name:"y",displayName:"Y",type:"float"}],color:"#2196F3"};class y{execute(e,r){const a=r.evaluateInput(e.id,"vector",t.ZERO);return{outputs:{x:a?.x??0,y:a?.y??0}}}}const g={type:"Vector2Add",title:"Vector2 +",category:"math",description:"Adds two vectors",keywords:["add","plus","vector"],menuPath:["Math","Vector","Add"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"vector2"},{name:"b",displayName:"B",type:"vector2"}],outputs:[{name:"result",displayName:"Result",type:"vector2"}],color:"#2196F3"};class w{execute(e,r){const a=r,s=a.evaluateInput(e.id,"a",t.ZERO),o=a.evaluateInput(e.id,"b",t.ZERO);return{outputs:{result:t.add(s??t.ZERO,o??t.ZERO)}}}}const b={type:"Vector2Subtract",title:"Vector2 -",category:"math",description:"Subtracts B from A",keywords:["subtract","minus","vector"],menuPath:["Math","Vector","Subtract"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"vector2"},{name:"b",displayName:"B",type:"vector2"}],outputs:[{name:"result",displayName:"Result",type:"vector2"}],color:"#2196F3"};class M{execute(e,r){const a=r,s=a.evaluateInput(e.id,"a",t.ZERO),o=a.evaluateInput(e.id,"b",t.ZERO);return{outputs:{result:t.subtract(s??t.ZERO,o??t.ZERO)}}}}const E={type:"Vector2Scale",title:"Vector2 *",category:"math",description:"Scales a vector by a scalar",keywords:["scale","multiply","vector"],menuPath:["Math","Vector","Scale"],isPure:!0,inputs:[{name:"vector",displayName:"Vector",type:"vector2"},{name:"scalar",displayName:"Scalar",type:"float",defaultValue:1}],outputs:[{name:"result",displayName:"Result",type:"vector2"}],color:"#2196F3"};class N{execute(e,r){const a=r,s=a.evaluateInput(e.id,"vector",t.ZERO),o=Number(a.evaluateInput(e.id,"scalar",1));return{outputs:{result:t.multiply(s??t.ZERO,o)}}}}const f={type:"Vector2Length",title:"Vector2 Length",category:"math",description:"Gets the length of a vector",keywords:["length","magnitude","vector"],menuPath:["Math","Vector","Length"],isPure:!0,inputs:[{name:"vector",displayName:"Vector",type:"vector2"}],outputs:[{name:"length",displayName:"Length",type:"float"}],color:"#2196F3"};class F{execute(e,r){return{outputs:{length:(r.evaluateInput(e.id,"vector",t.ZERO)??t.ZERO).length}}}}const v={type:"Vector2Normalize",title:"Vector2 Normalize",category:"math",description:"Normalizes a vector to unit length",keywords:["normalize","unit","vector"],menuPath:["Math","Vector","Normalize"],isPure:!0,inputs:[{name:"vector",displayName:"Vector",type:"vector2"}],outputs:[{name:"result",displayName:"Result",type:"vector2"}],color:"#2196F3"};class I{execute(e,r){return{outputs:{result:(r.evaluateInput(e.id,"vector",t.ZERO)??t.ZERO).normalized()}}}}const R={type:"Vector2Dot",title:"Vector2 Dot",category:"math",description:"Calculates dot product",keywords:["dot","product","vector"],menuPath:["Math","Vector","Dot Product"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"vector2"},{name:"b",displayName:"B",type:"vector2"}],outputs:[{name:"result",displayName:"Result",type:"float"}],color:"#2196F3"};class O{execute(e,r){const a=r,s=a.evaluateInput(e.id,"a",t.ZERO),o=a.evaluateInput(e.id,"b",t.ZERO);return{outputs:{result:t.dot(s??t.ZERO,o??t.ZERO)}}}}const P={type:"Vector2Cross",title:"Vector2 Cross",category:"math",description:"2D cross product (returns scalar)",keywords:["cross","product","vector"],menuPath:["Math","Vector","Cross Product"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"vector2"},{name:"b",displayName:"B",type:"vector2"}],outputs:[{name:"result",displayName:"Result",type:"float"}],color:"#2196F3"};class C{execute(e,r){const a=r,s=a.evaluateInput(e.id,"a",t.ZERO),o=a.evaluateInput(e.id,"b",t.ZERO);return{outputs:{result:t.cross(s??t.ZERO,o??t.ZERO)}}}}const T={type:"Vector2Distance",title:"Vector2 Distance",category:"math",description:"Distance between two points",keywords:["distance","length","vector"],menuPath:["Math","Vector","Distance"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"vector2"},{name:"b",displayName:"B",type:"vector2"}],outputs:[{name:"distance",displayName:"Distance",type:"float"}],color:"#2196F3"};class A{execute(e,r){const a=r,s=a.evaluateInput(e.id,"a",t.ZERO),o=a.evaluateInput(e.id,"b",t.ZERO);return{outputs:{distance:t.distance(s??t.ZERO,o??t.ZERO)}}}}const V={type:"Vector2Lerp",title:"Vector2 Lerp",category:"math",description:"Linear interpolation between two vectors",keywords:["lerp","interpolate","vector"],menuPath:["Math","Vector","Lerp"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"vector2"},{name:"b",displayName:"B",type:"vector2"},{name:"t",displayName:"T",type:"float",defaultValue:.5}],outputs:[{name:"result",displayName:"Result",type:"vector2"}],color:"#2196F3"};class S{execute(e,r){const a=r,s=a.evaluateInput(e.id,"a",t.ZERO),o=a.evaluateInput(e.id,"b",t.ZERO),i=Number(a.evaluateInput(e.id,"t",.5));return{outputs:{result:t.lerp(s??t.ZERO,o??t.ZERO,i)}}}}const Z={type:"Vector2Rotate",title:"Vector2 Rotate",category:"math",description:"Rotates a vector by angle (radians)",keywords:["rotate","turn","vector"],menuPath:["Math","Vector","Rotate"],isPure:!0,inputs:[{name:"vector",displayName:"Vector",type:"vector2"},{name:"angle",displayName:"Angle (rad)",type:"float",defaultValue:0}],outputs:[{name:"result",displayName:"Result",type:"vector2"}],color:"#2196F3"};class L{execute(e,r){const a=r,s=a.evaluateInput(e.id,"vector",t.ZERO),o=Number(a.evaluateInput(e.id,"angle",0));return{outputs:{result:(s??t.ZERO).rotated(o)}}}}const k={type:"Vector2FromAngle",title:"Vector2 From Angle",category:"math",description:"Creates unit vector from angle (radians)",keywords:["from","angle","direction","vector"],menuPath:["Math","Vector","From Angle"],isPure:!0,inputs:[{name:"angle",displayName:"Angle (rad)",type:"float",defaultValue:0}],outputs:[{name:"vector",displayName:"Vector",type:"vector2"}],color:"#2196F3"};class B{execute(e,r){const a=Number(r.evaluateInput(e.id,"angle",0));return{outputs:{vector:t.fromAngle(a)}}}}const z=[{template:m,executor:new d},{template:x,executor:new y},{template:g,executor:new w},{template:b,executor:new M},{template:E,executor:new N},{template:f,executor:new F},{template:v,executor:new I},{template:R,executor:new O},{template:P,executor:new C},{template:T,executor:new A},{template:V,executor:new S},{template:Z,executor:new L},{template:k,executor:new B}],j={type:"Fixed32From",title:"Fixed32 From Float",category:"math",description:"Creates Fixed32 from float",keywords:["fixed","fixed32","from","create","deterministic"],menuPath:["Math","Fixed","From Float"],isPure:!0,inputs:[{name:"value",displayName:"Value",type:"float",defaultValue:0}],outputs:[{name:"fixed",displayName:"Fixed32",type:"object"}],color:"#9C27B0"};class q{execute(t,e){const r=Number(e.evaluateInput(t.id,"value",0));return{outputs:{fixed:o.from(r)}}}}const D={type:"Fixed32FromInt",title:"Fixed32 From Int",category:"math",description:"Creates Fixed32 from integer (no precision loss)",keywords:["fixed","fixed32","from","int","integer"],menuPath:["Math","Fixed","From Int"],isPure:!0,inputs:[{name:"value",displayName:"Value",type:"int",defaultValue:0}],outputs:[{name:"fixed",displayName:"Fixed32",type:"object"}],color:"#9C27B0"};class H{execute(t,e){const r=e,a=Math.floor(Number(r.evaluateInput(t.id,"value",0)));return{outputs:{fixed:o.fromInt(a)}}}}const _={type:"Fixed32ToFloat",title:"Fixed32 To Float",category:"math",description:"Converts Fixed32 to float",keywords:["fixed","fixed32","to","float","convert"],menuPath:["Math","Fixed","To Float"],isPure:!0,inputs:[{name:"fixed",displayName:"Fixed32",type:"object"}],outputs:[{name:"value",displayName:"Value",type:"float"}],color:"#9C27B0"};class G{execute(t,e){const r=e.evaluateInput(t.id,"fixed",o.ZERO);return{outputs:{value:r?.toNumber()??0}}}}const $={type:"Fixed32ToInt",title:"Fixed32 To Int",category:"math",description:"Converts Fixed32 to integer (floor)",keywords:["fixed","fixed32","to","int","integer"],menuPath:["Math","Fixed","To Int"],isPure:!0,inputs:[{name:"fixed",displayName:"Fixed32",type:"object"}],outputs:[{name:"value",displayName:"Value",type:"int"}],color:"#9C27B0"};class W{execute(t,e){const r=e.evaluateInput(t.id,"fixed",o.ZERO);return{outputs:{value:r?.toInt()??0}}}}const Y={type:"Fixed32Add",title:"Fixed32 +",category:"math",description:"Adds two Fixed32 values",keywords:["fixed","add","plus","+"],menuPath:["Math","Fixed","Add"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class U{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",o.ZERO),s=r.evaluateInput(t.id,"b",o.ZERO);return{outputs:{result:(a??o.ZERO).add(s??o.ZERO)}}}}const X={type:"Fixed32Subtract",title:"Fixed32 -",category:"math",description:"Subtracts B from A",keywords:["fixed","subtract","minus","-"],menuPath:["Math","Fixed","Subtract"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class K{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",o.ZERO),s=r.evaluateInput(t.id,"b",o.ZERO);return{outputs:{result:(a??o.ZERO).sub(s??o.ZERO)}}}}const Q={type:"Fixed32Multiply",title:"Fixed32 *",category:"math",description:"Multiplies two Fixed32 values",keywords:["fixed","multiply","times","*"],menuPath:["Math","Fixed","Multiply"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class J{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",o.ONE),s=r.evaluateInput(t.id,"b",o.ONE);return{outputs:{result:(a??o.ONE).mul(s??o.ONE)}}}}const tt={type:"Fixed32Divide",title:"Fixed32 /",category:"math",description:"Divides A by B",keywords:["fixed","divide","/"],menuPath:["Math","Fixed","Divide"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class et{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",o.ZERO),s=r.evaluateInput(t.id,"b",o.ONE)??o.ONE;return s.isZero()?{outputs:{result:o.ZERO}}:{outputs:{result:(a??o.ZERO).div(s)}}}}const rt={type:"Fixed32Negate",title:"Fixed32 Negate",category:"math",description:"Negates a Fixed32 value",keywords:["fixed","negate","-"],menuPath:["Math","Fixed","Negate"],isPure:!0,inputs:[{name:"value",displayName:"Value",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class at{execute(t,e){return{outputs:{result:(e.evaluateInput(t.id,"value",o.ZERO)??o.ZERO).neg()}}}}const st={type:"Fixed32Abs",title:"Fixed32 Abs",category:"math",description:"Absolute value of Fixed32",keywords:["fixed","abs","absolute"],menuPath:["Math","Fixed","Abs"],isPure:!0,inputs:[{name:"value",displayName:"Value",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class ot{execute(t,e){return{outputs:{result:(e.evaluateInput(t.id,"value",o.ZERO)??o.ZERO).abs()}}}}const it={type:"Fixed32Sqrt",title:"Fixed32 Sqrt",category:"math",description:"Square root (deterministic)",keywords:["fixed","sqrt","square","root"],menuPath:["Math","Fixed","Sqrt"],isPure:!0,inputs:[{name:"value",displayName:"Value",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class nt{execute(t,e){const r=e.evaluateInput(t.id,"value",o.ZERO);return{outputs:{result:o.sqrt(r??o.ZERO)}}}}const ut={type:"Fixed32Floor",title:"Fixed32 Floor",category:"math",description:"Floor of Fixed32",keywords:["fixed","floor","round","down"],menuPath:["Math","Fixed","Floor"],isPure:!0,inputs:[{name:"value",displayName:"Value",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class ct{execute(t,e){const r=e.evaluateInput(t.id,"value",o.ZERO);return{outputs:{result:o.floor(r??o.ZERO)}}}}const lt={type:"Fixed32Ceil",title:"Fixed32 Ceil",category:"math",description:"Ceiling of Fixed32",keywords:["fixed","ceil","ceiling","round","up"],menuPath:["Math","Fixed","Ceil"],isPure:!0,inputs:[{name:"value",displayName:"Value",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class ht{execute(t,e){const r=e.evaluateInput(t.id,"value",o.ZERO);return{outputs:{result:o.ceil(r??o.ZERO)}}}}const pt={type:"Fixed32Round",title:"Fixed32 Round",category:"math",description:"Rounds Fixed32 to nearest integer",keywords:["fixed","round"],menuPath:["Math","Fixed","Round"],isPure:!0,inputs:[{name:"value",displayName:"Value",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class mt{execute(t,e){const r=e.evaluateInput(t.id,"value",o.ZERO);return{outputs:{result:o.round(r??o.ZERO)}}}}const dt={type:"Fixed32Sign",title:"Fixed32 Sign",category:"math",description:"Sign of Fixed32 (-1, 0, or 1)",keywords:["fixed","sign"],menuPath:["Math","Fixed","Sign"],isPure:!0,inputs:[{name:"value",displayName:"Value",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class xt{execute(t,e){const r=e.evaluateInput(t.id,"value",o.ZERO);return{outputs:{result:o.sign(r??o.ZERO)}}}}const yt={type:"Fixed32Min",title:"Fixed32 Min",category:"math",description:"Minimum of two Fixed32 values",keywords:["fixed","min","minimum"],menuPath:["Math","Fixed","Min"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class gt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",o.ZERO),s=r.evaluateInput(t.id,"b",o.ZERO);return{outputs:{result:o.min(a??o.ZERO,s??o.ZERO)}}}}const wt={type:"Fixed32Max",title:"Fixed32 Max",category:"math",description:"Maximum of two Fixed32 values",keywords:["fixed","max","maximum"],menuPath:["Math","Fixed","Max"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class bt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",o.ZERO),s=r.evaluateInput(t.id,"b",o.ZERO);return{outputs:{result:o.max(a??o.ZERO,s??o.ZERO)}}}}const Mt={type:"Fixed32Clamp",title:"Fixed32 Clamp",category:"math",description:"Clamps Fixed32 to range",keywords:["fixed","clamp","limit","range"],menuPath:["Math","Fixed","Clamp"],isPure:!0,inputs:[{name:"value",displayName:"Value",type:"object"},{name:"min",displayName:"Min",type:"object"},{name:"max",displayName:"Max",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class Et{execute(t,e){const r=e,a=r.evaluateInput(t.id,"value",o.ZERO),s=r.evaluateInput(t.id,"min",o.ZERO),i=r.evaluateInput(t.id,"max",o.ONE);return{outputs:{result:o.clamp(a??o.ZERO,s??o.ZERO,i??o.ONE)}}}}const Nt={type:"Fixed32Lerp",title:"Fixed32 Lerp",category:"math",description:"Linear interpolation between A and B",keywords:["fixed","lerp","interpolate","blend"],menuPath:["Math","Fixed","Lerp"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"},{name:"t",displayName:"T",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#9C27B0"};class ft{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",o.ZERO),s=r.evaluateInput(t.id,"b",o.ONE),i=r.evaluateInput(t.id,"t",o.HALF);return{outputs:{result:o.lerp(a??o.ZERO,s??o.ONE,i??o.HALF)}}}}const Ft={type:"Fixed32Compare",title:"Fixed32 Compare",category:"math",description:"Compares two Fixed32 values",keywords:["fixed","compare","equal","less","greater"],menuPath:["Math","Fixed","Compare"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"}],outputs:[{name:"equal",displayName:"A == B",type:"bool"},{name:"less",displayName:"A < B",type:"bool"},{name:"greater",displayName:"A > B",type:"bool"}],color:"#9C27B0"};class vt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",o.ZERO),s=r.evaluateInput(t.id,"b",o.ZERO),i=a??o.ZERO,n=s??o.ZERO;return{outputs:{equal:i.eq(n),less:i.lt(n),greater:i.gt(n)}}}}const It={type:"Fixed32IsZero",title:"Fixed32 Is Zero",category:"math",description:"Checks if Fixed32 is zero, positive, or negative",keywords:["fixed","zero","check"],menuPath:["Math","Fixed","Is Zero"],isPure:!0,inputs:[{name:"value",displayName:"Value",type:"object"}],outputs:[{name:"isZero",displayName:"Is Zero",type:"bool"},{name:"isPositive",displayName:"Is Positive",type:"bool"},{name:"isNegative",displayName:"Is Negative",type:"bool"}],color:"#9C27B0"};class Rt{execute(t,e){const r=e.evaluateInput(t.id,"value",o.ZERO)??o.ZERO;return{outputs:{isZero:r.isZero(),isPositive:r.isPositive(),isNegative:r.isNegative()}}}}const Ot={type:"Fixed32Constants",title:"Fixed32 Constants",category:"math",description:"Common Fixed32 constants",keywords:["fixed","constant","pi","zero","one"],menuPath:["Math","Fixed","Constants"],isPure:!0,inputs:[],outputs:[{name:"zero",displayName:"0",type:"object"},{name:"one",displayName:"1",type:"object"},{name:"half",displayName:"0.5",type:"object"},{name:"pi",displayName:"PI",type:"object"},{name:"twoPi",displayName:"2PI",type:"object"}],color:"#9C27B0"};class Pt{execute(){return{outputs:{zero:o.ZERO,one:o.ONE,half:o.HALF,pi:o.PI,twoPi:o.TWO_PI}}}}const Ct=[{template:j,executor:new q},{template:D,executor:new H},{template:_,executor:new G},{template:$,executor:new W},{template:Y,executor:new U},{template:X,executor:new K},{template:Q,executor:new J},{template:tt,executor:new et},{template:rt,executor:new at},{template:st,executor:new ot},{template:it,executor:new nt},{template:ut,executor:new ct},{template:lt,executor:new ht},{template:pt,executor:new mt},{template:dt,executor:new xt},{template:yt,executor:new gt},{template:wt,executor:new bt},{template:Mt,executor:new Et},{template:Nt,executor:new ft},{template:Ft,executor:new vt},{template:It,executor:new Rt},{template:Ot,executor:new Pt}],Tt={type:"MakeFixedVector2",title:"Make FixedVector2",category:"math",description:"Creates FixedVector2 from floats",keywords:["make","create","fixed","vector","deterministic"],menuPath:["Math","Fixed Vector","Make FixedVector2"],isPure:!0,inputs:[{name:"x",displayName:"X",type:"float",defaultValue:0},{name:"y",displayName:"Y",type:"float",defaultValue:0}],outputs:[{name:"vector",displayName:"Vector",type:"object"}],color:"#673AB7"};class At{execute(t,e){const r=e,a=Number(r.evaluateInput(t.id,"x",0)),s=Number(r.evaluateInput(t.id,"y",0));return{outputs:{vector:n.from(a,s)}}}}const Vt={type:"BreakFixedVector2",title:"Break FixedVector2",category:"math",description:"Breaks FixedVector2 into X and Y floats",keywords:["break","split","fixed","vector"],menuPath:["Math","Fixed Vector","Break FixedVector2"],isPure:!0,inputs:[{name:"vector",displayName:"Vector",type:"object"}],outputs:[{name:"x",displayName:"X",type:"float"},{name:"y",displayName:"Y",type:"float"}],color:"#673AB7"};class St{execute(t,e){const r=e.evaluateInput(t.id,"vector",n.ZERO)??n.ZERO;return{outputs:{x:r.x.toNumber(),y:r.y.toNumber()}}}}const Zt={type:"FixedVector2Add",title:"FixedVector2 +",category:"math",description:"Adds two fixed vectors",keywords:["fixed","vector","add","+"],menuPath:["Math","Fixed Vector","Add"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#673AB7"};class Lt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",n.ZERO),s=r.evaluateInput(t.id,"b",n.ZERO);return{outputs:{result:(a??n.ZERO).add(s??n.ZERO)}}}}const kt={type:"FixedVector2Subtract",title:"FixedVector2 -",category:"math",description:"Subtracts B from A",keywords:["fixed","vector","subtract","-"],menuPath:["Math","Fixed Vector","Subtract"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#673AB7"};class Bt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",n.ZERO),s=r.evaluateInput(t.id,"b",n.ZERO);return{outputs:{result:(a??n.ZERO).sub(s??n.ZERO)}}}}const zt={type:"FixedVector2Scale",title:"FixedVector2 *",category:"math",description:"Scales vector by Fixed32 scalar",keywords:["fixed","vector","scale","*"],menuPath:["Math","Fixed Vector","Scale"],isPure:!0,inputs:[{name:"vector",displayName:"Vector",type:"object"},{name:"scalar",displayName:"Scalar",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#673AB7"};class jt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"vector",n.ZERO),s=r.evaluateInput(t.id,"scalar",o.ONE);return{outputs:{result:(a??n.ZERO).mul(s??o.ONE)}}}}const qt={type:"FixedVector2Negate",title:"FixedVector2 Negate",category:"math",description:"Negates a fixed vector",keywords:["fixed","vector","negate","-"],menuPath:["Math","Fixed Vector","Negate"],isPure:!0,inputs:[{name:"vector",displayName:"Vector",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#673AB7"};class Dt{execute(t,e){return{outputs:{result:(e.evaluateInput(t.id,"vector",n.ZERO)??n.ZERO).neg()}}}}const Ht={type:"FixedVector2Length",title:"FixedVector2 Length",category:"math",description:"Gets the length of a fixed vector",keywords:["fixed","vector","length","magnitude"],menuPath:["Math","Fixed Vector","Length"],isPure:!0,inputs:[{name:"vector",displayName:"Vector",type:"object"}],outputs:[{name:"length",displayName:"Length",type:"object"}],color:"#673AB7"};class _t{execute(t,e){return{outputs:{length:(e.evaluateInput(t.id,"vector",n.ZERO)??n.ZERO).length()}}}}const Gt={type:"FixedVector2Normalize",title:"FixedVector2 Normalize",category:"math",description:"Normalizes a fixed vector",keywords:["fixed","vector","normalize","unit"],menuPath:["Math","Fixed Vector","Normalize"],isPure:!0,inputs:[{name:"vector",displayName:"Vector",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#673AB7"};class $t{execute(t,e){return{outputs:{result:(e.evaluateInput(t.id,"vector",n.ZERO)??n.ZERO).normalize()}}}}const Wt={type:"FixedVector2Dot",title:"FixedVector2 Dot",category:"math",description:"Calculates dot product",keywords:["fixed","vector","dot","product"],menuPath:["Math","Fixed Vector","Dot Product"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#673AB7"};class Yt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",n.ZERO),s=r.evaluateInput(t.id,"b",n.ZERO);return{outputs:{result:n.dot(a??n.ZERO,s??n.ZERO)}}}}const Ut={type:"FixedVector2Cross",title:"FixedVector2 Cross",category:"math",description:"2D cross product (returns Fixed32)",keywords:["fixed","vector","cross","product"],menuPath:["Math","Fixed Vector","Cross Product"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#673AB7"};class Xt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",n.ZERO),s=r.evaluateInput(t.id,"b",n.ZERO);return{outputs:{result:n.cross(a??n.ZERO,s??n.ZERO)}}}}const Kt={type:"FixedVector2Distance",title:"FixedVector2 Distance",category:"math",description:"Distance between two points",keywords:["fixed","vector","distance"],menuPath:["Math","Fixed Vector","Distance"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"}],outputs:[{name:"distance",displayName:"Distance",type:"object"}],color:"#673AB7"};class Qt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",n.ZERO),s=r.evaluateInput(t.id,"b",n.ZERO);return{outputs:{distance:n.distance(a??n.ZERO,s??n.ZERO)}}}}const Jt={type:"FixedVector2Lerp",title:"FixedVector2 Lerp",category:"math",description:"Linear interpolation between two vectors",keywords:["fixed","vector","lerp","interpolate"],menuPath:["Math","Fixed Vector","Lerp"],isPure:!0,inputs:[{name:"a",displayName:"A",type:"object"},{name:"b",displayName:"B",type:"object"},{name:"t",displayName:"T",type:"object"}],outputs:[{name:"result",displayName:"Result",type:"object"}],color:"#673AB7"};class te{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",n.ZERO),s=r.evaluateInput(t.id,"b",n.ZERO),i=r.evaluateInput(t.id,"t",o.HALF);return{outputs:{result:n.lerp(a??n.ZERO,s??n.ZERO,i??o.HALF)}}}}const ee=[{template:Tt,executor:new At},{template:Vt,executor:new St},{template:Zt,executor:new Lt},{template:kt,executor:new Bt},{template:zt,executor:new jt},{template:qt,executor:new Dt},{template:Ht,executor:new _t},{template:Gt,executor:new $t},{template:Wt,executor:new Yt},{template:Ut,executor:new Xt},{template:Kt,executor:new Qt},{template:Jt,executor:new te}],re={type:"MakeColor",title:"Make Color",category:"math",description:"Creates a Color from RGBA",keywords:["make","create","color","rgba"],menuPath:["Math","Color","Make Color"],isPure:!0,inputs:[{name:"r",displayName:"R (0-255)",type:"int",defaultValue:255},{name:"g",displayName:"G (0-255)",type:"int",defaultValue:255},{name:"b",displayName:"B (0-255)",type:"int",defaultValue:255},{name:"a",displayName:"A (0-1)",type:"float",defaultValue:1}],outputs:[{name:"color",displayName:"Color",type:"color"}],color:"#E91E63"};class ae{execute(t,e){const r=e,a=Number(r.evaluateInput(t.id,"r",255)),s=Number(r.evaluateInput(t.id,"g",255)),o=Number(r.evaluateInput(t.id,"b",255)),i=Number(r.evaluateInput(t.id,"a",1));return{outputs:{color:new c(a,s,o,i)}}}}const se={type:"BreakColor",title:"Break Color",category:"math",description:"Breaks a Color into RGBA",keywords:["break","split","color","rgba"],menuPath:["Math","Color","Break Color"],isPure:!0,inputs:[{name:"color",displayName:"Color",type:"color"}],outputs:[{name:"r",displayName:"R",type:"int"},{name:"g",displayName:"G",type:"int"},{name:"b",displayName:"B",type:"int"},{name:"a",displayName:"A",type:"float"}],color:"#E91E63"};class oe{execute(t,e){const r=e.evaluateInput(t.id,"color",c.WHITE)??c.WHITE;return{outputs:{r:r.r,g:r.g,b:r.b,a:r.a}}}}const ie={type:"ColorFromHex",title:"Color From Hex",category:"math",description:"Creates a Color from hex string",keywords:["color","hex","from","create"],menuPath:["Math","Color","From Hex"],isPure:!0,inputs:[{name:"hex",displayName:"Hex",type:"string",defaultValue:"#FFFFFF"},{name:"alpha",displayName:"Alpha",type:"float",defaultValue:1}],outputs:[{name:"color",displayName:"Color",type:"color"}],color:"#E91E63"};class ne{execute(t,e){const r=e,a=String(r.evaluateInput(t.id,"hex","#FFFFFF")),s=Number(r.evaluateInput(t.id,"alpha",1));return{outputs:{color:c.fromHex(a,s)}}}}const ue={type:"ColorToHex",title:"Color To Hex",category:"math",description:"Converts a Color to hex string",keywords:["color","hex","to","convert"],menuPath:["Math","Color","To Hex"],isPure:!0,inputs:[{name:"color",displayName:"Color",type:"color"}],outputs:[{name:"hex",displayName:"Hex",type:"string"}],color:"#E91E63"};class ce{execute(t,e){return{outputs:{hex:(e.evaluateInput(t.id,"color",c.WHITE)??c.WHITE).toHex()}}}}const le={type:"ColorFromHSL",title:"Color From HSL",category:"math",description:"Creates a Color from HSL values",keywords:["color","hsl","hue","saturation","lightness"],menuPath:["Math","Color","From HSL"],isPure:!0,inputs:[{name:"h",displayName:"H (0-360)",type:"float",defaultValue:0},{name:"s",displayName:"S (0-1)",type:"float",defaultValue:1},{name:"l",displayName:"L (0-1)",type:"float",defaultValue:.5},{name:"a",displayName:"A (0-1)",type:"float",defaultValue:1}],outputs:[{name:"color",displayName:"Color",type:"color"}],color:"#E91E63"};class he{execute(t,e){const r=e,a=Number(r.evaluateInput(t.id,"h",0)),s=Number(r.evaluateInput(t.id,"s",1)),o=Number(r.evaluateInput(t.id,"l",.5)),i=Number(r.evaluateInput(t.id,"a",1));return{outputs:{color:c.fromHSL(a,s,o,i)}}}}const pe={type:"ColorToHSL",title:"Color To HSL",category:"math",description:"Converts a Color to HSL values",keywords:["color","hsl","convert"],menuPath:["Math","Color","To HSL"],isPure:!0,inputs:[{name:"color",displayName:"Color",type:"color"}],outputs:[{name:"h",displayName:"H",type:"float"},{name:"s",displayName:"S",type:"float"},{name:"l",displayName:"L",type:"float"}],color:"#E91E63"};class me{execute(t,e){const r=(e.evaluateInput(t.id,"color",c.WHITE)??c.WHITE).toHSL();return{outputs:{h:r.h,s:r.s,l:r.l}}}}const de={type:"ColorLerp",title:"Color Lerp",category:"math",description:"Linear interpolation between two colors",keywords:["color","lerp","interpolate","blend"],menuPath:["Math","Color","Lerp"],isPure:!0,inputs:[{name:"from",displayName:"From",type:"color"},{name:"to",displayName:"To",type:"color"},{name:"t",displayName:"T",type:"float",defaultValue:.5}],outputs:[{name:"result",displayName:"Result",type:"color"}],color:"#E91E63"};class xe{execute(t,e){const r=e,a=r.evaluateInput(t.id,"from",c.BLACK),s=r.evaluateInput(t.id,"to",c.WHITE),o=Number(r.evaluateInput(t.id,"t",.5));return{outputs:{result:c.lerp(a??c.BLACK,s??c.WHITE,o)}}}}const ye={type:"ColorLighten",title:"Color Lighten",category:"math",description:"Lightens a color",keywords:["color","lighten","bright"],menuPath:["Math","Color","Lighten"],isPure:!0,inputs:[{name:"color",displayName:"Color",type:"color"},{name:"amount",displayName:"Amount",type:"float",defaultValue:.1}],outputs:[{name:"result",displayName:"Result",type:"color"}],color:"#E91E63"};class ge{execute(t,e){const r=e,a=r.evaluateInput(t.id,"color",c.GRAY),s=Number(r.evaluateInput(t.id,"amount",.1));return{outputs:{result:c.lighten(a??c.GRAY,s)}}}}const we={type:"ColorDarken",title:"Color Darken",category:"math",description:"Darkens a color",keywords:["color","darken","dark"],menuPath:["Math","Color","Darken"],isPure:!0,inputs:[{name:"color",displayName:"Color",type:"color"},{name:"amount",displayName:"Amount",type:"float",defaultValue:.1}],outputs:[{name:"result",displayName:"Result",type:"color"}],color:"#E91E63"};class be{execute(t,e){const r=e,a=r.evaluateInput(t.id,"color",c.GRAY),s=Number(r.evaluateInput(t.id,"amount",.1));return{outputs:{result:c.darken(a??c.GRAY,s)}}}}const Me={type:"ColorSaturate",title:"Color Saturate",category:"math",description:"Increases color saturation",keywords:["color","saturate","saturation"],menuPath:["Math","Color","Saturate"],isPure:!0,inputs:[{name:"color",displayName:"Color",type:"color"},{name:"amount",displayName:"Amount",type:"float",defaultValue:.1}],outputs:[{name:"result",displayName:"Result",type:"color"}],color:"#E91E63"};class Ee{execute(t,e){const r=e,a=r.evaluateInput(t.id,"color",c.GRAY),s=Number(r.evaluateInput(t.id,"amount",.1));return{outputs:{result:c.saturate(a??c.GRAY,s)}}}}const Ne={type:"ColorDesaturate",title:"Color Desaturate",category:"math",description:"Decreases color saturation",keywords:["color","desaturate","saturation"],menuPath:["Math","Color","Desaturate"],isPure:!0,inputs:[{name:"color",displayName:"Color",type:"color"},{name:"amount",displayName:"Amount",type:"float",defaultValue:.1}],outputs:[{name:"result",displayName:"Result",type:"color"}],color:"#E91E63"};class fe{execute(t,e){const r=e,a=r.evaluateInput(t.id,"color",c.GRAY),s=Number(r.evaluateInput(t.id,"amount",.1));return{outputs:{result:c.desaturate(a??c.GRAY,s)}}}}const Fe={type:"ColorInvert",title:"Color Invert",category:"math",description:"Inverts a color",keywords:["color","invert","inverse"],menuPath:["Math","Color","Invert"],isPure:!0,inputs:[{name:"color",displayName:"Color",type:"color"}],outputs:[{name:"result",displayName:"Result",type:"color"}],color:"#E91E63"};class ve{execute(t,e){const r=e.evaluateInput(t.id,"color",c.WHITE);return{outputs:{result:c.invert(r??c.WHITE)}}}}const Ie={type:"ColorGrayscale",title:"Color Grayscale",category:"math",description:"Converts color to grayscale",keywords:["color","grayscale","gray","grey"],menuPath:["Math","Color","Grayscale"],isPure:!0,inputs:[{name:"color",displayName:"Color",type:"color"}],outputs:[{name:"result",displayName:"Result",type:"color"}],color:"#E91E63"};class Re{execute(t,e){const r=e.evaluateInput(t.id,"color",c.WHITE);return{outputs:{result:c.grayscale(r??c.WHITE)}}}}const Oe={type:"ColorLuminance",title:"Color Luminance",category:"math",description:"Gets perceived brightness (0-1)",keywords:["color","luminance","brightness"],menuPath:["Math","Color","Luminance"],isPure:!0,inputs:[{name:"color",displayName:"Color",type:"color"}],outputs:[{name:"luminance",displayName:"Luminance",type:"float"}],color:"#E91E63"};class Pe{execute(t,e){const r=e.evaluateInput(t.id,"color",c.WHITE);return{outputs:{luminance:c.luminance(r??c.WHITE)}}}}const Ce={type:"ColorConstants",title:"Color Constants",category:"math",description:"Common color constants",keywords:["color","constant","red","green","blue","white","black"],menuPath:["Math","Color","Constants"],isPure:!0,inputs:[],outputs:[{name:"white",displayName:"White",type:"color"},{name:"black",displayName:"Black",type:"color"},{name:"red",displayName:"Red",type:"color"},{name:"green",displayName:"Green",type:"color"},{name:"blue",displayName:"Blue",type:"color"},{name:"transparent",displayName:"Transparent",type:"color"}],color:"#E91E63"};class Te{execute(){return{outputs:{white:c.WHITE,black:c.BLACK,red:c.RED,green:c.GREEN,blue:c.BLUE,transparent:c.TRANSPARENT}}}}const Ae=[{template:re,executor:new ae},{template:se,executor:new oe},{template:ie,executor:new ne},{template:ue,executor:new ce},{template:le,executor:new he},{template:pe,executor:new me},{template:de,executor:new xe},{template:ye,executor:new ge},{template:we,executor:new be},{template:Me,executor:new Ee},{template:Ne,executor:new fe},{template:Fe,executor:new ve},{template:Ie,executor:new Re},{template:Oe,executor:new Pe},{template:Ce,executor:new Te}],Ve=[...z,...Ct,...ee,...Ae];exports.BreakColorExecutor=oe,exports.BreakColorTemplate=se,exports.BreakFixedVector2Executor=St,exports.BreakFixedVector2Template=Vt,exports.BreakVector2Executor=y,exports.BreakVector2Template=x,exports.CachedInterpolator=h,exports.Circle=s,exports.CollisionDetector=class{static pointCircle(e,r){const a=t.distance(e,r.center);if(!(a<=r.radius))return{collided:!1};return{collided:!0,normal:a>0?t.subtract(e,r.center).normalize():new t(1,0),penetration:r.radius-a,contactPoint:e.clone()}}static pointRect(e,r){if(!r.containsPoint(e))return{collided:!1};const a=e.x-r.left,s=r.right-e.x,o=e.y-r.top,i=r.bottom-e.y,n=Math.min(a,s,o,i);let u;const c=n;return u=n===a?new t(-1,0):n===s?new t(1,0):new t(0,n===o?-1:1),{collided:!0,normal:u,penetration:c,contactPoint:e.clone()}}static circleCircle(e,r){const a=t.distance(e.center,r.center),s=e.radius+r.radius;if(!(a<=s))return{collided:!1};const o=a>0?t.subtract(r.center,e.center).normalize():new t(1,0),i=s-a,n=e.center.clone().add(o.clone().multiply(e.radius-.5*i));return{collided:!0,normal:o,penetration:i,contactPoint:n}}static circleRect(e,r){const a=r.closestPointTo(e.center),s=t.distance(e.center,a);if(!(s<=e.radius))return{collided:!1};return{collided:!0,normal:s>0?t.subtract(a,e.center).normalize():new t(0,-1),penetration:e.radius-s,contactPoint:a}}static rectRect(e,r){if(!e.intersects(r))return{collided:!1};const a=Math.max(e.left,r.left),s=Math.min(e.right,r.right),o=Math.max(e.top,r.top),i=Math.min(e.bottom,r.bottom),n=s-a,u=i-o;let c,l;n<u?(l=n,c=e.centerX<r.centerX?new t(-1,0):new t(1,0)):(l=u,c=e.centerY<r.centerY?new t(0,-1):new t(0,1));return{collided:!0,normal:c,penetration:l,contactPoint:new t(.5*(a+s),.5*(o+i))}}static rayCircle(e,r,a,s=1/0){const o=t.subtract(e,a.center),i=r.lengthSquared,n=2*t.dot(o,r),u=n*n-4*i*(o.lengthSquared-a.radius*a.radius);if(u<0)return{collided:!1};const c=Math.sqrt(u),l=(-n-c)/(2*i),h=l>=0?l:(-n+c)/(2*i);if(h<0||h>s)return{collided:!1};const p=e.clone().add(r.clone().multiply(h));return{collided:!0,normal:t.subtract(p,a.center).normalize(),contactPoint:p,distance:h,penetration:0}}static rayRect(e,r,a,s=1/0){const o=0!==r.x?1/r.x:1e10,i=0!==r.y?1/r.y:1e10,n=(a.left-e.x)*o,u=(a.right-e.x)*o,c=(a.top-e.y)*i,l=(a.bottom-e.y)*i,h=Math.max(Math.min(n,u),Math.min(c,l)),p=Math.min(Math.max(n,u),Math.max(c,l));if(p<0||h>p||h>s)return{collided:!1};const m=h>=0?h:p,d=e.clone().add(r.clone().multiply(m));let x;const y=1e-6;return x=Math.abs(d.x-a.left)<y?new t(-1,0):Math.abs(d.x-a.right)<y?new t(1,0):Math.abs(d.y-a.top)<y?new t(0,-1):new t(0,1),{collided:!0,normal:x,contactPoint:d,distance:m,penetration:0}}static lineSegmentLineSegment(e,r,a,s){const o=t.subtract(r,e),i=t.subtract(s,a),n=t.subtract(a,e),u=t.cross(o,i);if(Math.abs(u)<Number.EPSILON)return{collided:!1};const c=t.cross(n,i)/u,l=t.cross(n,o)/u;if(c>=0&&c<=1&&l>=0&&l<=1){const t=e.clone().add(o.clone().multiply(c));return{collided:!0,normal:o.perpendicular().normalize(),contactPoint:t,penetration:0}}return{collided:!1}}static lineSegmentCircle(e,r,a){const s=t.subtract(r,e),o=t.subtract(e,a.center),i=t.dot(s,s),n=2*t.dot(o,s),u=n*n-4*i*(t.dot(o,o)-a.radius*a.radius);if(u<0)return{collided:!1};const c=Math.sqrt(u),l=(-n-c)/(2*i),h=(-n+c)/(2*i),p=[];if(l>=0&&l<=1&&p.push(l),h>=0&&h<=1&&p.push(h),0===p.length)return{collided:!1};const m=p[0],d=e.clone().add(s.clone().multiply(m));return{collided:!0,normal:t.subtract(d,a.center).normalize(),contactPoint:d,penetration:0}}static aabbTest(t,e){return t.intersects(e)}static circleTest(e,r,a,s){return t.distance(e,a)<=r+s}},exports.Color=c,exports.ColorConstantsExecutor=Te,exports.ColorConstantsTemplate=Ce,exports.ColorDarkenExecutor=be,exports.ColorDarkenTemplate=we,exports.ColorDesaturateExecutor=fe,exports.ColorDesaturateTemplate=Ne,exports.ColorFromHSLExecutor=he,exports.ColorFromHSLTemplate=le,exports.ColorFromHexExecutor=ne,exports.ColorFromHexTemplate=ie,exports.ColorGrayscaleExecutor=Re,exports.ColorGrayscaleTemplate=Ie,exports.ColorInvertExecutor=ve,exports.ColorInvertTemplate=Fe,exports.ColorLerpExecutor=xe,exports.ColorLerpTemplate=de,exports.ColorLightenExecutor=ge,exports.ColorLightenTemplate=ye,exports.ColorLuminanceExecutor=Pe,exports.ColorLuminanceTemplate=Oe,exports.ColorNodeDefinitions=Ae,exports.ColorSaturateExecutor=Ee,exports.ColorSaturateTemplate=Me,exports.ColorToHSLExecutor=me,exports.ColorToHSLTemplate=pe,exports.ColorToHexExecutor=ce,exports.ColorToHexTemplate=ue,exports.Easing=l,exports.Fixed32=o,exports.Fixed32AbsExecutor=ot,exports.Fixed32AbsTemplate=st,exports.Fixed32AddExecutor=U,exports.Fixed32AddTemplate=Y,exports.Fixed32CeilExecutor=ht,exports.Fixed32CeilTemplate=lt,exports.Fixed32ClampExecutor=Et,exports.Fixed32ClampTemplate=Mt,exports.Fixed32CompareExecutor=vt,exports.Fixed32CompareTemplate=Ft,exports.Fixed32ConstantsExecutor=Pt,exports.Fixed32ConstantsTemplate=Ot,exports.Fixed32DivideExecutor=et,exports.Fixed32DivideTemplate=tt,exports.Fixed32FloorExecutor=ct,exports.Fixed32FloorTemplate=ut,exports.Fixed32FromExecutor=q,exports.Fixed32FromIntExecutor=H,exports.Fixed32FromIntTemplate=D,exports.Fixed32FromTemplate=j,exports.Fixed32IsZeroExecutor=Rt,exports.Fixed32IsZeroTemplate=It,exports.Fixed32LerpExecutor=ft,exports.Fixed32LerpTemplate=Nt,exports.Fixed32MaxExecutor=bt,exports.Fixed32MaxTemplate=wt,exports.Fixed32MinExecutor=gt,exports.Fixed32MinTemplate=yt,exports.Fixed32MultiplyExecutor=J,exports.Fixed32MultiplyTemplate=Q,exports.Fixed32NegateExecutor=at,exports.Fixed32NegateTemplate=rt,exports.Fixed32RoundExecutor=mt,exports.Fixed32RoundTemplate=pt,exports.Fixed32SignExecutor=xt,exports.Fixed32SignTemplate=dt,exports.Fixed32SqrtExecutor=nt,exports.Fixed32SqrtTemplate=it,exports.Fixed32SubtractExecutor=K,exports.Fixed32SubtractTemplate=X,exports.Fixed32ToFloatExecutor=G,exports.Fixed32ToFloatTemplate=_,exports.Fixed32ToIntExecutor=W,exports.Fixed32ToIntTemplate=$,exports.FixedMath=i,exports.FixedNodeDefinitions=Ct,exports.FixedVector2=n,exports.FixedVector2AddExecutor=Lt,exports.FixedVector2AddTemplate=Zt,exports.FixedVector2CrossExecutor=Xt,exports.FixedVector2CrossTemplate=Ut,exports.FixedVector2DistanceExecutor=Qt,exports.FixedVector2DistanceTemplate=Kt,exports.FixedVector2DotExecutor=Yt,exports.FixedVector2DotTemplate=Wt,exports.FixedVector2LengthExecutor=_t,exports.FixedVector2LengthTemplate=Ht,exports.FixedVector2LerpExecutor=te,exports.FixedVector2LerpTemplate=Jt,exports.FixedVector2NegateExecutor=Dt,exports.FixedVector2NegateTemplate=qt,exports.FixedVector2NormalizeExecutor=$t,exports.FixedVector2NormalizeTemplate=Gt,exports.FixedVector2ScaleExecutor=jt,exports.FixedVector2ScaleTemplate=zt,exports.FixedVector2SubtractExecutor=Bt,exports.FixedVector2SubtractTemplate=kt,exports.FixedVectorNodeDefinitions=ee,exports.Interpolation=p,exports.MakeColorExecutor=ae,exports.MakeColorTemplate=re,exports.MakeFixedVector2Executor=At,exports.MakeFixedVector2Template=Tt,exports.MakeVector2Executor=d,exports.MakeVector2Template=m,exports.MathNodeDefinitions=Ve,exports.MathUtils=u,exports.Matrix3=r,exports.Rectangle=a,exports.Vector2=t,exports.Vector2AddExecutor=w,exports.Vector2AddTemplate=g,exports.Vector2CrossExecutor=C,exports.Vector2CrossTemplate=P,exports.Vector2DistanceExecutor=A,exports.Vector2DistanceTemplate=T,exports.Vector2DotExecutor=O,exports.Vector2DotTemplate=R,exports.Vector2FromAngleExecutor=B,exports.Vector2FromAngleTemplate=k,exports.Vector2LengthExecutor=F,exports.Vector2LengthTemplate=f,exports.Vector2LerpExecutor=S,exports.Vector2LerpTemplate=V,exports.Vector2NormalizeExecutor=I,exports.Vector2NormalizeTemplate=v,exports.Vector2RotateExecutor=L,exports.Vector2RotateTemplate=Z,exports.Vector2ScaleExecutor=N,exports.Vector2ScaleTemplate=E,exports.Vector2SubtractExecutor=M,exports.Vector2SubtractTemplate=b,exports.Vector3=e,exports.VectorNodeDefinitions=z;
2
+ //# sourceMappingURL=index.cjs.map