@esengine/ecs-framework-math 2.10.1 → 2.11.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 (92) hide show
  1. package/dist/index.cjs +2 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.ts +10420 -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 +20 -11
  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
@@ -0,0 +1,2 @@
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ECSMath={})}(this,function(t){"use strict";class e{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 e(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(t){const r=this.dot(t),a=t.lengthSquared;return 0===a?new e:t.clone().multiply(r/a)}projectOntoLength(t){const e=t.length;return 0===e?0:this.dot(t)/e}perpendicular(){return new e(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(t,r){return new e(t.x+r.x,t.y+r.y)}static subtract(t,r){return new e(t.x-r.x,t.y-r.y)}static multiply(t,r){return new e(t.x*r,t.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 det(t,e){return t.x*e.y-t.y*e.x}static lengthSq(t){return t.x*t.x+t.y*t.y}static len(t){return Math.sqrt(t.x*t.x+t.y*t.y)}static normalize(t){const r=Math.sqrt(t.x*t.x+t.y*t.y);return r<Number.EPSILON?new e(0,0):new e(t.x/r,t.y/r)}static distance(t,e){const r=t.x-e.x,a=t.y-e.y;return Math.sqrt(r*r+a*a)}static distanceSq(t,e){const r=t.x-e.x,a=t.y-e.y;return r*r+a*a}static lerp(t,r,a){return new e(t.x+(r.x-t.x)*a,t.y+(r.y-t.y)*a)}static fromAngle(t){return new e(Math.cos(t),Math.sin(t))}static fromPolar(t,r){return new e(t*Math.cos(r),t*Math.sin(r))}static min(t,r){return new e(Math.min(t.x,r.x),Math.min(t.y,r.y))}static max(t,r){return new e(Math.max(t.x,r.x),Math.max(t.y,r.y))}static perpLeft(t){return new e(-t.y,t.x)}static perpRight(t){return new e(t.y,-t.x)}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}}}e.ZERO=new e(0,0),e.ONE=new e(1,1),e.RIGHT=new e(1,0),e.LEFT=new e(-1,0),e.UP=new e(0,1),e.DOWN=new e(0,-1);class r{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 r(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 r(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 e=this.dot(t),a=t.lengthSquared;return 0===a?new r:t.clone().multiply(e/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,e){return new r(t.x+e.x,t.y+e.y,t.z+e.z)}static subtract(t,e){return new r(t.x-e.x,t.y-e.y,t.z-e.z)}static multiply(t,e){return new r(t.x*e,t.y*e,t.z*e)}static dot(t,e){return t.x*e.x+t.y*e.y+t.z*e.z}static cross(t,e){return new r(t.y*e.z-t.z*e.y,t.z*e.x-t.x*e.z,t.x*e.y-t.y*e.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,e,a){return new r(t.x+(e.x-t.x)*a,t.y+(e.y-t.y)*a,t.z+(e.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}}}r.ZERO=new r(0,0,0),r.ONE=new r(1,1,1),r.RIGHT=new r(1,0,0),r.LEFT=new r(-1,0,0),r.UP=new r(0,1,0),r.DOWN=new r(0,-1,0),r.FORWARD=new r(0,0,1),r.BACK=new r(0,0,-1);class a{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 a(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,i=this.m10*e-this.m11*r,n=this.m10*r+this.m11*e;return this.m00=a,this.m01=s,this.m10=i,this.m11=n,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(t){const r=t.x,a=t.y,s=this.m20*r+this.m21*a+this.m22;return new e((this.m00*r+this.m01*a+this.m02)/s,(this.m10*r+this.m11*a+this.m12)/s)}transformDirection(t){return new e(this.m00*t.x+this.m01*t.y,this.m10*t.x+this.m11*t.y)}transformVectors(t){return t.map(t=>this.transformVector(t))}getTranslation(){return new e(this.m02,this.m12)}getRotation(){return Math.atan2(this.m01,this.m00)}getScale(){const t=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 e(a<0?-t:t,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(a.IDENTITY,t)}static multiply(t,e){return t.clone().multiply(e)}static translation(t,e){return(new a).makeTranslation(t,e)}static rotation(t){return(new a).makeRotation(t)}static scale(t,e){return(new a).makeScale(t,e)}static TRS(t,e,r){const s=Math.cos(e),i=Math.sin(e);return new a([r.x*s,r.y*i,t.x,-r.x*i,r.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]})`}}a.IDENTITY=new a([1,0,0,0,1,0,0,0,1]),a.ZERO=new a([0,0,0,0,0,0,0,0,0]);class s{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 e(this.centerX,this.centerY)}get topLeft(){return new e(this.x,this.y)}get topRight(){return new e(this.right,this.y)}get bottomLeft(){return new e(this.x,this.bottom)}get bottomRight(){return new e(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 s(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 s.EMPTY.clone();const e=Math.max(this.x,t.x),r=Math.max(this.y,t.y),a=Math.min(this.right,t.right),i=Math.min(this.bottom,t.bottom);return new s(e,r,a-e,i-r)}union(t){const e=Math.min(this.x,t.x),r=Math.min(this.y,t.y),a=Math.max(this.right,t.right),i=Math.max(this.bottom,t.bottom);return new s(e,r,a-e,i-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(t){return new e(Math.max(this.x,Math.min(this.right,t.x)),Math.max(this.y,Math.min(this.bottom,t.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,a){return new s(t-.5*r,e-.5*a,r,a)}static fromPoints(t,e){const r=Math.min(t.x,e.x),a=Math.min(t.y,e.y),i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return new s(r,a,i,n)}static fromPointArray(t){if(0===t.length)return s.EMPTY.clone();let e=t[0].x,r=t[0].y,a=t[0].x,i=t[0].y;for(let s=1;s<t.length;s++)e=Math.min(e,t[s].x),r=Math.min(r,t[s].y),a=Math.max(a,t[s].x),i=Math.max(i,t[s].y);return new s(e,r,a-e,i-r)}static square(t,e,r){return new s(t,e,r,r)}static lerp(t,e,r){return new s(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]}}s.EMPTY=new s(0,0,0,0);class i{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r}get center(){return new e(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 s(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 i(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(t){const r=e.subtract(t,this.center);return r.isZero?new e(this.x+this.radius,this.y):this.center.clone().add(r.normalized().multiply(this.radius))}farthestPointFrom(t){const r=e.subtract(t,this.center);return r.isZero?new e(this.x-this.radius,this.y):this.center.clone().subtract(r.normalized().multiply(this.radius))}getPointAtAngle(t){return new e(this.x+this.radius*Math.cos(t),this.y+this.radius*Math.sin(t))}getAngleToPoint(t){return Math.atan2(t.y-this.y,t.x-this.x)}getLineIntersections(t,r){const a=r.x-t.x,s=r.y-t.y,i=t.x-this.x,n=t.y-this.y,o=a*a+s*s,u=2*(i*a+n*s),c=u*u-4*o*(i*i+n*n-this.radius*this.radius);if(c<0)return[];if(0===c){const r=-u/(2*o);return[new e(t.x+r*a,t.y+r*s)]}const l=Math.sqrt(c),h=(-u-l)/(2*o),m=(-u+l)/(2*o);return[new e(t.x+h*a,t.y+h*s),new e(t.x+m*a,t.y+m*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 i(t,e,.5*r)}static fromThreePoints(t,e,r){const a=t.x,s=t.y,n=e.x,o=e.y,u=r.x,c=r.y,l=2*(a*(o-c)+n*(c-s)+u*(s-o));if(Math.abs(l)<Number.EPSILON)return null;const h=((a*a+s*s)*(o-c)+(n*n+o*o)*(c-s)+(u*u+c*c)*(s-o))/l,m=((a*a+s*s)*(u-n)+(n*n+o*o)*(a-u)+(u*u+c*c)*(n-a))/l,d=Math.sqrt((a-h)*(a-h)+(s-m)*(s-m));return new i(h,m,d)}static fromPointArray(t){if(0===t.length)return i.EMPTY.clone();if(1===t.length)return new i(t[0].x,t[0].y,0);let r=t[0].x,a=t[0].y,s=t[0].x,n=t[0].y;for(const e of t)r=Math.min(r,e.x),a=Math.min(a,e.y),s=Math.max(s,e.x),n=Math.max(n,e.y);const o=.5*(r+s),u=.5*(a+n),c=new e(o,u);let l=0;for(const r of t){const t=e.distance(c,r);l=Math.max(l,t)}return new i(o,u,l)}static lerp(t,e,r){return new i(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}}}i.EMPTY=new i(0,0,0),i.UNIT=new i(0,0,1);class n{static signedArea(t){const e=t.length;if(e<3)return 0;let r=0;for(let a=0;a<e;a++){const s=(a+1)%e,i=t[a],n=t[s];r+=i.x*n.y,r-=n.x*i.y}return.5*r}static area(t){return Math.abs(n.signedArea(t))}static isCCW(t,e=!1){const r=n.signedArea(t);return e?r<0:r>0}static isCW(t,e=!1){return!n.isCCW(t,e)}static reverse(t){return[...t].reverse()}static reverseInPlace(t){t.reverse()}static ensureCCW(t,e=!1){return n.isCCW(t,e)?[...t]:n.reverse(t)}static ensureCW(t,e=!1){return n.isCW(t,e)?[...t]:n.reverse(t)}static centroid(t){const e=t.length;if(0===e)return{x:0,y:0};if(1===e)return{x:t[0].x,y:t[0].y};if(2===e)return{x:.5*(t[0].x+t[1].x),y:.5*(t[0].y+t[1].y)};let r=0,a=0,s=0;for(let i=0;i<e;i++){const n=(i+1)%e,o=t[i],u=t[n],c=o.x*u.y-u.x*o.y;s+=c,r+=(o.x+u.x)*c,a+=(o.y+u.y)*c}s*=.5;const i=1/(6*s);return{x:r*i,y:a*i}}static containsPoint(t,e){const r=e.length;if(r<3)return!1;let a=!1;for(let s=0,i=r-1;s<r;i=s++){const r=e[s],n=e[i];r.y>t.y!=n.y>t.y&&t.x<(n.x-r.x)*(t.y-r.y)/(n.y-r.y)+r.x&&(a=!a)}return a}static isConvex(t){const e=t.length;if(e<3)return!1;if(3===e)return!0;let r=null;for(let a=0;a<e;a++){const s=t[a],i=t[(a+1)%e],n=t[(a+2)%e],o=i.x-s.x,u=i.y-s.y,c=n.x-i.x,l=o*(n.y-i.y)-u*c;if(Math.abs(l)>1e-10)if(null===r)r=l>0?1:-1;else if((l>0?1:-1)!==r)return!1}return!0}static perimeter(t){const e=t.length;if(e<2)return 0;let r=0;for(let a=0;a<e;a++){const s=(a+1)%e,i=t[a],n=t[s],o=n.x-i.x,u=n.y-i.y;r+=Math.sqrt(o*o+u*u)}return r}static bounds(t){if(0===t.length)return{minX:0,minY:0,maxX:0,maxY:0};let e=1/0,r=1/0,a=-1/0,s=-1/0;for(const i of t)i.x<e&&(e=i.x),i.y<r&&(r=i.y),i.x>a&&(a=i.x),i.y>s&&(s=i.y);return{minX:e,minY:r,maxX:a,maxY:s}}}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 u{static generateSinTable(){const t=new Int32Array(u.SIN_TABLE_SIZE+1);for(let e=0;e<=u.SIN_TABLE_SIZE;e++){const r=e*Math.PI/(2*u.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,i=!1;e<=r?s=e:e<=a?s=a-e:e<=3*r?(s=e-a,i=!0):(s=o.TWO_PI.raw-e,i=!0);const n=Math.min(s*u.SIN_TABLE_SIZE/r|0,u.SIN_TABLE_SIZE),c=u.SIN_TABLE[n];return o.fromRaw(i?-c:c)}static cos(t){return u.sin(t.add(o.HALF_PI))}static tan(t){const e=u.cos(t);return e.isZero()?o.fromRaw(o.MAX_VALUE):u.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),i=Math.abs(a);let n;return n=i>=s?u.atanApprox(s,i):o.HALF_PI.raw-u.atanApprox(i,s),a<0&&(n=o.PI.raw-n),r<0&&(n=-n),o.fromRaw(n)}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 u.atan2(t,a)}static acos(t){return o.HALF_PI.sub(u.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 u.normalizeAngle(e.sub(t))}static lerpAngle(t,e,r){const a=u.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=u.exp(e),s=t.sub(a),i=t.add(a);e=e.add(r.mul(s).div(i))}return e}}u.SIN_TABLE_SIZE=1024,u.SIN_TABLE=u.generateSinTable();class c{constructor(t,e){this.x=t,this.y=e}static from(t,e){return new c(o.from(t),o.from(e))}static fromRaw(t,e){return new c(o.fromRaw(t),o.fromRaw(e))}static fromInt(t,e){return new c(o.fromInt(t),o.fromInt(e))}static fromObject(t){return c.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 c(this.x,this.y)}add(t){return new c(this.x.add(t.x),this.y.add(t.y))}sub(t){return new c(this.x.sub(t.x),this.y.sub(t.y))}mul(t){return new c(this.x.mul(t),this.y.mul(t))}div(t){return new c(this.x.div(t),this.y.div(t))}mulComponents(t){return new c(this.x.mul(t.x),this.y.mul(t.y))}divComponents(t){return new c(this.x.div(t.x),this.y.div(t.y))}neg(){return new c(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()?c.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 c(this.y,this.x.neg())}perpendicularCCW(){return new c(this.y.neg(),this.x)}projectOnto(t){const e=this.dot(t),r=t.lengthSquared();return r.isZero()?c.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=u.cos(t),r=u.sin(t);return new c(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 u.atan2(this.y,this.x)}angleTo(t){const e=this.cross(t),r=this.dot(t);return u.atan2(e,r)}static fromPolar(t,e){return new c(t.mul(u.cos(e)),t.mul(u.sin(e)))}static fromAngle(t){return new c(u.cos(t),u.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 c(o.clamp(this.x,t.x,e.x),o.clamp(this.y,t.y,e.y))}lerp(t,e){return new c(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 c(o.min(t.x,e.x),o.min(t.y,e.y))}static max(t,e){return new c(o.max(t.x,e.x),o.max(t.y,e.y))}}c.ZERO=new c(o.ZERO,o.ZERO),c.ONE=new c(o.ONE,o.ONE),c.RIGHT=new c(o.ONE,o.ZERO),c.LEFT=new c(o.NEG_ONE,o.ZERO),c.UP=new c(o.ZERO,o.ONE),c.DOWN=new c(o.ZERO,o.NEG_ONE);class l{static degToRad(t){return t*l.DEG_TO_RAD}static radToDeg(t){return t*l.RAD_TO_DEG}static normalizeAngle(t){for(;t<0;)t+=l.TWO_PI;for(;t>=l.TWO_PI;)t-=l.TWO_PI;return t}static normalizeAngleSigned(t){for(;t<=-Math.PI;)t+=l.TWO_PI;for(;t>Math.PI;)t-=l.TWO_PI;return t}static angleDifference(t,e){let r=e-t;return r=l.normalizeAngleSigned(r),r}static lerpAngle(t,e,r){return t+l.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)<l.EPSILON?0:(r-t)/(e-t)}static remap(t,e,r,a,s){const i=l.inverseLerp(e,r,t);return l.lerp(a,s,i)}static smoothStep(t){return(t=l.clamp01(t))*t*(3-2*t)}static smootherStep(t){return(t=l.clamp01(t))*t*t*(t*(6*t-15)+10)}static approximately(t,e,r=l.EPSILON){return Math.abs(t-e)<r}static isZero(t,e=l.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 t=Math.random()*l.TWO_PI,r=Math.sqrt(Math.random());return e.fromPolar(r,t)}static randomOnUnitCircle(){const t=Math.random()*l.TWO_PI;return e.fromAngle(t)}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)/l.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)<l.EPSILON?t*r:t*(1-Math.pow(e,r))/(1-e)}static quadraticBezier(t,r,a,s){const i=1-s,n=s*s,o=i*i;return new e(o*t.x+2*i*s*r.x+n*a.x,o*t.y+2*i*s*r.y+n*a.y)}static cubicBezier(t,r,a,s,i){const n=1-i,o=i*i,u=n*n,c=u*n,l=o*i;return new e(c*t.x+3*u*i*r.x+3*n*o*a.x+l*s.x,c*t.y+3*u*i*r.y+3*n*o*a.y+l*s.y)}static catmullRom(t,r,a,s,i){const n=i*i,o=n*i,u=.5*(2*r.x+(-t.x+a.x)*i+(2*t.x-5*r.x+4*a.x-s.x)*n+(-t.x+3*r.x-3*a.x+s.x)*o),c=.5*(2*r.y+(-t.y+a.y)*i+(2*t.y-5*r.y+4*a.y-s.y)*n+(-t.y+3*r.y-3*a.y+s.y)*o);return new e(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),i=t-a,n=e-s,o=l.noise(a,s,r),u=l.noise(a+1,s,r),c=l.noise(a,s+1,r),h=l.noise(a+1,s+1,r),m=l.lerp(o,u,i),d=l.lerp(c,h,i);return l.lerp(m,d,n)}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]}}l.PI=Math.PI,l.TWO_PI=2*Math.PI,l.HALF_PI=.5*Math.PI,l.QUARTER_PI=.25*Math.PI,l.DEG_TO_RAD=Math.PI/180,l.RAD_TO_DEG=180/Math.PI,l.GOLDEN_RATIO=.5*(1+Math.sqrt(5)),l.EPSILON=Number.EPSILON;class h{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}=h.hexToRgb(t);return new h(r,a,s,e)}static fromUint32(t,e=!1){if(e){return new h(t>>16&255,t>>8&255,255&t,(t>>24&255)/255)}return new h(t>>16&255,t>>8&255,255&t)}static fromHSL(t,e,r,a=1){const{r:s,g:i,b:n}=h.hslToRgb(t,e,r);return new h(s,i,n,a)}static fromFloat(t,e,r,a=1){return new h(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,i;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=i=r;else{const n=(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),o=r<.5?r*(1+e):r+e-r*e,u=2*r-o;a=n(u,o,t+1/3),s=n(u,o,t),i=n(u,o,t-1/3)}return{r:Math.round(255*a),g:Math.round(255*s),b:Math.round(255*i)}}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 i=0,n=0;const o=(a+s)/2;if(a!==s){const u=a-s;switch(n=o>.5?u/(2-a-s):u/(a+s),a){case t:i=((e-r)/u+(e<r?6:0))/6;break;case e:i=((r-t)/u+2)/6;break;case r:i=((t-e)/u+4)/6}}return{h:360*i,s:n,l:o}}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}=h.hexToRgb(t);return h.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 h(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,i=255&t,n=e>>16&255,o=e>>8&255,u=255&e;return Math.round(a+(n-a)*r)<<16|Math.round(s+(o-s)*r)<<8|Math.round(i+(u-i)*r)}static mix(t,e,r=.5){return h.lerp(t,e,r)}static lighten(t,e){const r=h.rgbToHsl(t.r,t.g,t.b);r.l=Math.min(1,r.l+e);const a=h.hslToRgb(r.h,r.s,r.l);return new h(a.r,a.g,a.b,t.a)}static darken(t,e){const r=h.rgbToHsl(t.r,t.g,t.b);r.l=Math.max(0,r.l-e);const a=h.hslToRgb(r.h,r.s,r.l);return new h(a.r,a.g,a.b,t.a)}static saturate(t,e){const r=h.rgbToHsl(t.r,t.g,t.b);r.s=Math.min(1,r.s+e);const a=h.hslToRgb(r.h,r.s,r.l);return new h(a.r,a.g,a.b,t.a)}static desaturate(t,e){const r=h.rgbToHsl(t.r,t.g,t.b);r.s=Math.max(0,r.s-e);const a=h.hslToRgb(r.h,r.s,r.l);return new h(a.r,a.g,a.b,t.a)}static invert(t){return new h(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 h(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=h.luminance(t),a=h.luminance(e);return(Math.max(r,a)+.05)/(Math.min(r,a)+.05)}toHex(){return h.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 h.rgbToHsl(this.r,this.g,this.b)}toUint32(){return h.packRGB(this.r,this.g,this.b)}toUint32Alpha(){return h.packARGB(this.r,this.g,this.b,this.a)}toWebGL(){return h.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 h(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})`}}h.WHITE=new h(255,255,255),h.BLACK=new h(0,0,0),h.RED=new h(255,0,0),h.GREEN=new h(0,255,0),h.BLUE=new h(0,0,255),h.YELLOW=new h(255,255,0),h.CYAN=new h(0,255,255),h.MAGENTA=new h(255,0,255),h.TRANSPARENT=new h(0,0,0,0),h.GRAY=new h(128,128,128);class m{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-m.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-m.bounceOut(1-2*t))/2:(1+m.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)}}m.smoothIn=m.quadOut,m.smoothOut=m.quadIn,m.quickIn=m.cubicOut,m.quickOut=m.cubicIn,m.natural=m.quartOut,m.emphasize=m.backOut;class d{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 l.lerp(t,e,r)}static vector2(t,r,a){return e.lerp(t,r,a)}static angle(t,e,r){return l.lerpAngle(t,e,r)}static color(t,e,r){const a=[],s=Math.max(t.length,e.length);for(let i=0;i<s;i++){const s=t[i]??(3===i?1:0),n=e[i]??(3===i?1:0);a[i]=l.lerp(s,n,r)}return a}static cubicSpline(t,e,r,a,s){const i=s*s;return.5*(2*e+(-t+r)*s+(2*t-5*e+4*r-a)*i+(3*e-t-3*r+a)*(i*s))}static hermite(t,e,r,a,s){const i=s*s,n=i*s;return(2*n-3*i+1)*t+(n-2*i+s)*e+(-2*n+3*i)*r+(n-i)*a}static slerp(t,r,a){let s=e.dot(t,r),i=r;if(s<0&&(s=-s,i=r.clone().negate()),s>.9995)return e.lerp(t,i,a).normalize();const n=Math.acos(Math.abs(s)),o=Math.sin(n),u=Math.sin((1-a)*n)/o,c=Math.sin(a*n)/o;return new e(t.x*u+i.x*c,t.y*u+i.y*c)}static createCachedInterpolator(t){return new d(t)}static spline(t,e){if(0===t.length)return 0;if(1===t.length)return t[0];if(2===t.length)return l.lerp(t[0],t[1],e);const r=t.length-1,a=e*r,s=Math.floor(a),i=a-s,n=Math.max(0,Math.min(r-1,s)),o=t[Math.max(0,n-1)],u=t[n],c=t[Math.min(r,n+1)],h=t[Math.min(r,n+2)];return p.cubicSpline(o,u,c,h,i)}static vectorSpline(t,r){if(0===t.length)return new e;if(1===t.length)return t[0].clone();if(2===t.length)return e.lerp(t[0],t[1],r);const a=t.map(t=>t.x),s=t.map(t=>t.y);return new e(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],i=t[a+1];if(e>=s.time&&e<=i.time){const t=i.time-s.time,a=t>0?(e-s.time)/t:0,n=s.easing?s.easing(a):a;return r(s.value,i.value,n)}}return t[t.length-1].value}static pathInterpolation(t,r,a=!1){if(0===t.length)return new e;if(1===t.length)return t[0].clone();const s=r*p.getPathLength(t,a);let i=0;const n=a?t.length:t.length-1;for(let r=0;r<n;r++){const a=t[r],n=t[(r+1)%t.length],o=e.distance(a,n);if(i+o>=s){const t=(s-i)/o;return e.lerp(a,n,t)}i+=o}return t[t.length-1].clone()}static getPathLength(t,r=!1){if(t.length<2)return 0;let a=0;const s=r?t.length:t.length-1;for(let r=0;r<s;r++){const s=t[r],i=t[(r+1)%t.length];a+=e.distance(s,i)}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 i=0;i<Math.min(t.length,e.length,r.length);i++)s[i]=t[i](e[i],r[i],a);return s}}}const y={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 x{execute(t,r){const a=r,s=Number(a.evaluateInput(t.id,"x",0)),i=Number(a.evaluateInput(t.id,"y",0));return{outputs:{vector:new e(s,i)}}}}const g={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 w{execute(t,r){const a=r.evaluateInput(t.id,"vector",e.ZERO);return{outputs:{x:a?.x??0,y:a?.y??0}}}}const b={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 M{execute(t,r){const a=r,s=a.evaluateInput(t.id,"a",e.ZERO),i=a.evaluateInput(t.id,"b",e.ZERO);return{outputs:{result:e.add(s??e.ZERO,i??e.ZERO)}}}}const E={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 f{execute(t,r){const a=r,s=a.evaluateInput(t.id,"a",e.ZERO),i=a.evaluateInput(t.id,"b",e.ZERO);return{outputs:{result:e.subtract(s??e.ZERO,i??e.ZERO)}}}}const N={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 F{execute(t,r){const a=r,s=a.evaluateInput(t.id,"vector",e.ZERO),i=Number(a.evaluateInput(t.id,"scalar",1));return{outputs:{result:e.multiply(s??e.ZERO,i)}}}}const v={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 I{execute(t,r){return{outputs:{length:(r.evaluateInput(t.id,"vector",e.ZERO)??e.ZERO).length}}}}const R={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 O{execute(t,r){return{outputs:{result:(r.evaluateInput(t.id,"vector",e.ZERO)??e.ZERO).normalized()}}}}const P={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 C{execute(t,r){const a=r,s=a.evaluateInput(t.id,"a",e.ZERO),i=a.evaluateInput(t.id,"b",e.ZERO);return{outputs:{result:e.dot(s??e.ZERO,i??e.ZERO)}}}}const T={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 A{execute(t,r){const a=r,s=a.evaluateInput(t.id,"a",e.ZERO),i=a.evaluateInput(t.id,"b",e.ZERO);return{outputs:{result:e.cross(s??e.ZERO,i??e.ZERO)}}}}const V={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 S{execute(t,r){const a=r,s=a.evaluateInput(t.id,"a",e.ZERO),i=a.evaluateInput(t.id,"b",e.ZERO);return{outputs:{distance:e.distance(s??e.ZERO,i??e.ZERO)}}}}const Z={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 L{execute(t,r){const a=r,s=a.evaluateInput(t.id,"a",e.ZERO),i=a.evaluateInput(t.id,"b",e.ZERO),n=Number(a.evaluateInput(t.id,"t",.5));return{outputs:{result:e.lerp(s??e.ZERO,i??e.ZERO,n)}}}}const k={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 B{execute(t,r){const a=r,s=a.evaluateInput(t.id,"vector",e.ZERO),i=Number(a.evaluateInput(t.id,"angle",0));return{outputs:{result:(s??e.ZERO).rotated(i)}}}}const z={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 q{execute(t,r){const a=Number(r.evaluateInput(t.id,"angle",0));return{outputs:{vector:e.fromAngle(a)}}}}const j=[{template:y,executor:new x},{template:g,executor:new w},{template:b,executor:new M},{template:E,executor:new f},{template:N,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},{template:z,executor:new q}],D={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 H{execute(t,e){const r=Number(e.evaluateInput(t.id,"value",0));return{outputs:{fixed:o.from(r)}}}}const _={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 G{execute(t,e){const r=e,a=Math.floor(Number(r.evaluateInput(t.id,"value",0)));return{outputs:{fixed:o.fromInt(a)}}}}const W={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 ${execute(t,e){const r=e.evaluateInput(t.id,"fixed",o.ZERO);return{outputs:{value:r?.toNumber()??0}}}}const Y={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 U{execute(t,e){const r=e.evaluateInput(t.id,"fixed",o.ZERO);return{outputs:{value:r?.toInt()??0}}}}const X={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 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).add(s??o.ZERO)}}}}const Q={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 J{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 tt={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 et{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 rt={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 at{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 st={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 it{execute(t,e){return{outputs:{result:(e.evaluateInput(t.id,"value",o.ZERO)??o.ZERO).neg()}}}}const nt={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 ut={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 ct{execute(t,e){const r=e.evaluateInput(t.id,"value",o.ZERO);return{outputs:{result:o.sqrt(r??o.ZERO)}}}}const lt={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 ht{execute(t,e){const r=e.evaluateInput(t.id,"value",o.ZERO);return{outputs:{result:o.floor(r??o.ZERO)}}}}const mt={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 dt{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 yt{execute(t,e){const r=e.evaluateInput(t.id,"value",o.ZERO);return{outputs:{result:o.round(r??o.ZERO)}}}}const xt={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 gt{execute(t,e){const r=e.evaluateInput(t.id,"value",o.ZERO);return{outputs:{result:o.sign(r??o.ZERO)}}}}const wt={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 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.min(a??o.ZERO,s??o.ZERO)}}}}const Mt={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 Et{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 ft={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 Nt{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 Ft={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 vt{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 It={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 Rt{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 Ot={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 Pt{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 Ct={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 Tt{execute(){return{outputs:{zero:o.ZERO,one:o.ONE,half:o.HALF,pi:o.PI,twoPi:o.TWO_PI}}}}const At=[{template:D,executor:new H},{template:_,executor:new G},{template:W,executor:new $},{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 it},{template:nt,executor:new ot},{template:ut,executor:new ct},{template:lt,executor:new ht},{template:mt,executor:new dt},{template:pt,executor:new yt},{template:xt,executor:new gt},{template:wt,executor:new bt},{template:Mt,executor:new Et},{template:ft,executor:new Nt},{template:Ft,executor:new vt},{template:It,executor:new Rt},{template:Ot,executor:new Pt},{template:Ct,executor:new Tt}],Vt={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 St{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:c.from(a,s)}}}}const Zt={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 Lt{execute(t,e){const r=e.evaluateInput(t.id,"vector",c.ZERO)??c.ZERO;return{outputs:{x:r.x.toNumber(),y:r.y.toNumber()}}}}const kt={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 Bt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",c.ZERO),s=r.evaluateInput(t.id,"b",c.ZERO);return{outputs:{result:(a??c.ZERO).add(s??c.ZERO)}}}}const zt={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 qt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",c.ZERO),s=r.evaluateInput(t.id,"b",c.ZERO);return{outputs:{result:(a??c.ZERO).sub(s??c.ZERO)}}}}const jt={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 Dt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"vector",c.ZERO),s=r.evaluateInput(t.id,"scalar",o.ONE);return{outputs:{result:(a??c.ZERO).mul(s??o.ONE)}}}}const Ht={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 _t{execute(t,e){return{outputs:{result:(e.evaluateInput(t.id,"vector",c.ZERO)??c.ZERO).neg()}}}}const Gt={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 Wt{execute(t,e){return{outputs:{length:(e.evaluateInput(t.id,"vector",c.ZERO)??c.ZERO).length()}}}}const $t={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 Yt{execute(t,e){return{outputs:{result:(e.evaluateInput(t.id,"vector",c.ZERO)??c.ZERO).normalize()}}}}const Ut={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 Xt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",c.ZERO),s=r.evaluateInput(t.id,"b",c.ZERO);return{outputs:{result:c.dot(a??c.ZERO,s??c.ZERO)}}}}const Kt={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 Qt{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",c.ZERO),s=r.evaluateInput(t.id,"b",c.ZERO);return{outputs:{result:c.cross(a??c.ZERO,s??c.ZERO)}}}}const Jt={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 te{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",c.ZERO),s=r.evaluateInput(t.id,"b",c.ZERO);return{outputs:{distance:c.distance(a??c.ZERO,s??c.ZERO)}}}}const ee={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 re{execute(t,e){const r=e,a=r.evaluateInput(t.id,"a",c.ZERO),s=r.evaluateInput(t.id,"b",c.ZERO),i=r.evaluateInput(t.id,"t",o.HALF);return{outputs:{result:c.lerp(a??c.ZERO,s??c.ZERO,i??o.HALF)}}}}const ae=[{template:Vt,executor:new St},{template:Zt,executor:new Lt},{template:kt,executor:new Bt},{template:zt,executor:new qt},{template:jt,executor:new Dt},{template:Ht,executor:new _t},{template:Gt,executor:new Wt},{template:$t,executor:new Yt},{template:Ut,executor:new Xt},{template:Kt,executor:new Qt},{template:Jt,executor:new te},{template:ee,executor:new re}],se={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 ie{execute(t,e){const r=e,a=Number(r.evaluateInput(t.id,"r",255)),s=Number(r.evaluateInput(t.id,"g",255)),i=Number(r.evaluateInput(t.id,"b",255)),n=Number(r.evaluateInput(t.id,"a",1));return{outputs:{color:new h(a,s,i,n)}}}}const ne={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",h.WHITE)??h.WHITE;return{outputs:{r:r.r,g:r.g,b:r.b,a:r.a}}}}const ue={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 ce{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:h.fromHex(a,s)}}}}const le={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 he{execute(t,e){return{outputs:{hex:(e.evaluateInput(t.id,"color",h.WHITE)??h.WHITE).toHex()}}}}const me={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 de{execute(t,e){const r=e,a=Number(r.evaluateInput(t.id,"h",0)),s=Number(r.evaluateInput(t.id,"s",1)),i=Number(r.evaluateInput(t.id,"l",.5)),n=Number(r.evaluateInput(t.id,"a",1));return{outputs:{color:h.fromHSL(a,s,i,n)}}}}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 ye{execute(t,e){const r=(e.evaluateInput(t.id,"color",h.WHITE)??h.WHITE).toHSL();return{outputs:{h:r.h,s:r.s,l:r.l}}}}const xe={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 ge{execute(t,e){const r=e,a=r.evaluateInput(t.id,"from",h.BLACK),s=r.evaluateInput(t.id,"to",h.WHITE),i=Number(r.evaluateInput(t.id,"t",.5));return{outputs:{result:h.lerp(a??h.BLACK,s??h.WHITE,i)}}}}const we={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 be{execute(t,e){const r=e,a=r.evaluateInput(t.id,"color",h.GRAY),s=Number(r.evaluateInput(t.id,"amount",.1));return{outputs:{result:h.lighten(a??h.GRAY,s)}}}}const Me={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 Ee{execute(t,e){const r=e,a=r.evaluateInput(t.id,"color",h.GRAY),s=Number(r.evaluateInput(t.id,"amount",.1));return{outputs:{result:h.darken(a??h.GRAY,s)}}}}const fe={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 Ne{execute(t,e){const r=e,a=r.evaluateInput(t.id,"color",h.GRAY),s=Number(r.evaluateInput(t.id,"amount",.1));return{outputs:{result:h.saturate(a??h.GRAY,s)}}}}const Fe={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 ve{execute(t,e){const r=e,a=r.evaluateInput(t.id,"color",h.GRAY),s=Number(r.evaluateInput(t.id,"amount",.1));return{outputs:{result:h.desaturate(a??h.GRAY,s)}}}}const Ie={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 Re{execute(t,e){const r=e.evaluateInput(t.id,"color",h.WHITE);return{outputs:{result:h.invert(r??h.WHITE)}}}}const Oe={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 Pe{execute(t,e){const r=e.evaluateInput(t.id,"color",h.WHITE);return{outputs:{result:h.grayscale(r??h.WHITE)}}}}const Ce={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 Te{execute(t,e){const r=e.evaluateInput(t.id,"color",h.WHITE);return{outputs:{luminance:h.luminance(r??h.WHITE)}}}}const Ae={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 Ve{execute(){return{outputs:{white:h.WHITE,black:h.BLACK,red:h.RED,green:h.GREEN,blue:h.BLUE,transparent:h.TRANSPARENT}}}}const Se=[{template:se,executor:new ie},{template:ne,executor:new oe},{template:ue,executor:new ce},{template:le,executor:new he},{template:me,executor:new de},{template:pe,executor:new ye},{template:xe,executor:new ge},{template:we,executor:new be},{template:Me,executor:new Ee},{template:fe,executor:new Ne},{template:Fe,executor:new ve},{template:Ie,executor:new Re},{template:Oe,executor:new Pe},{template:Ce,executor:new Te},{template:Ae,executor:new Ve}],Ze=[...j,...At,...ae,...Se];t.BreakColorExecutor=oe,t.BreakColorTemplate=ne,t.BreakFixedVector2Executor=Lt,t.BreakFixedVector2Template=Zt,t.BreakVector2Executor=w,t.BreakVector2Template=g,t.CachedInterpolator=d,t.Circle=i,t.CollisionDetector=class{static pointCircle(t,r){const a=e.distance(t,r.center);if(!(a<=r.radius))return{collided:!1};return{collided:!0,normal:a>0?e.subtract(t,r.center).normalize():new e(1,0),penetration:r.radius-a,contactPoint:t.clone()}}static pointRect(t,r){if(!r.containsPoint(t))return{collided:!1};const a=t.x-r.left,s=r.right-t.x,i=t.y-r.top,n=r.bottom-t.y,o=Math.min(a,s,i,n);let u;const c=o;return u=o===a?new e(-1,0):o===s?new e(1,0):new e(0,o===i?-1:1),{collided:!0,normal:u,penetration:c,contactPoint:t.clone()}}static circleCircle(t,r){const a=e.distance(t.center,r.center),s=t.radius+r.radius;if(!(a<=s))return{collided:!1};const i=a>0?e.subtract(r.center,t.center).normalize():new e(1,0),n=s-a,o=t.center.clone().add(i.clone().multiply(t.radius-.5*n));return{collided:!0,normal:i,penetration:n,contactPoint:o}}static circleRect(t,r){const a=r.closestPointTo(t.center),s=e.distance(t.center,a);if(!(s<=t.radius))return{collided:!1};return{collided:!0,normal:s>0?e.subtract(a,t.center).normalize():new e(0,-1),penetration:t.radius-s,contactPoint:a}}static rectRect(t,r){if(!t.intersects(r))return{collided:!1};const a=Math.max(t.left,r.left),s=Math.min(t.right,r.right),i=Math.max(t.top,r.top),n=Math.min(t.bottom,r.bottom),o=s-a,u=n-i;let c,l;o<u?(l=o,c=t.centerX<r.centerX?new e(-1,0):new e(1,0)):(l=u,c=t.centerY<r.centerY?new e(0,-1):new e(0,1));return{collided:!0,normal:c,penetration:l,contactPoint:new e(.5*(a+s),.5*(i+n))}}static rayCircle(t,r,a,s=1/0){const i=e.subtract(t,a.center),n=r.lengthSquared,o=2*e.dot(i,r),u=o*o-4*n*(i.lengthSquared-a.radius*a.radius);if(u<0)return{collided:!1};const c=Math.sqrt(u),l=(-o-c)/(2*n),h=l>=0?l:(-o+c)/(2*n);if(h<0||h>s)return{collided:!1};const m=t.clone().add(r.clone().multiply(h));return{collided:!0,normal:e.subtract(m,a.center).normalize(),contactPoint:m,distance:h,penetration:0}}static rayRect(t,r,a,s=1/0){const i=0!==r.x?1/r.x:1e10,n=0!==r.y?1/r.y:1e10,o=(a.left-t.x)*i,u=(a.right-t.x)*i,c=(a.top-t.y)*n,l=(a.bottom-t.y)*n,h=Math.max(Math.min(o,u),Math.min(c,l)),m=Math.min(Math.max(o,u),Math.max(c,l));if(m<0||h>m||h>s)return{collided:!1};const d=h>=0?h:m,p=t.clone().add(r.clone().multiply(d));let y;const x=1e-6;return y=Math.abs(p.x-a.left)<x?new e(-1,0):Math.abs(p.x-a.right)<x?new e(1,0):Math.abs(p.y-a.top)<x?new e(0,-1):new e(0,1),{collided:!0,normal:y,contactPoint:p,distance:d,penetration:0}}static lineSegmentLineSegment(t,r,a,s){const i=e.subtract(r,t),n=e.subtract(s,a),o=e.subtract(a,t),u=e.cross(i,n);if(Math.abs(u)<Number.EPSILON)return{collided:!1};const c=e.cross(o,n)/u,l=e.cross(o,i)/u;if(c>=0&&c<=1&&l>=0&&l<=1){const e=t.clone().add(i.clone().multiply(c));return{collided:!0,normal:i.perpendicular().normalize(),contactPoint:e,penetration:0}}return{collided:!1}}static lineSegmentCircle(t,r,a){const s=e.subtract(r,t),i=e.subtract(t,a.center),n=e.dot(s,s),o=2*e.dot(i,s),u=o*o-4*n*(e.dot(i,i)-a.radius*a.radius);if(u<0)return{collided:!1};const c=Math.sqrt(u),l=(-o-c)/(2*n),h=(-o+c)/(2*n),m=[];if(l>=0&&l<=1&&m.push(l),h>=0&&h<=1&&m.push(h),0===m.length)return{collided:!1};const d=m[0],p=t.clone().add(s.clone().multiply(d));return{collided:!0,normal:e.subtract(p,a.center).normalize(),contactPoint:p,penetration:0}}static aabbTest(t,e){return t.intersects(e)}static circleTest(t,r,a,s){return e.distance(t,a)<=r+s}},t.Color=h,t.ColorConstantsExecutor=Ve,t.ColorConstantsTemplate=Ae,t.ColorDarkenExecutor=Ee,t.ColorDarkenTemplate=Me,t.ColorDesaturateExecutor=ve,t.ColorDesaturateTemplate=Fe,t.ColorFromHSLExecutor=de,t.ColorFromHSLTemplate=me,t.ColorFromHexExecutor=ce,t.ColorFromHexTemplate=ue,t.ColorGrayscaleExecutor=Pe,t.ColorGrayscaleTemplate=Oe,t.ColorInvertExecutor=Re,t.ColorInvertTemplate=Ie,t.ColorLerpExecutor=ge,t.ColorLerpTemplate=xe,t.ColorLightenExecutor=be,t.ColorLightenTemplate=we,t.ColorLuminanceExecutor=Te,t.ColorLuminanceTemplate=Ce,t.ColorNodeDefinitions=Se,t.ColorSaturateExecutor=Ne,t.ColorSaturateTemplate=fe,t.ColorToHSLExecutor=ye,t.ColorToHSLTemplate=pe,t.ColorToHexExecutor=he,t.ColorToHexTemplate=le,t.Easing=m,t.Fixed32=o,t.Fixed32AbsExecutor=ot,t.Fixed32AbsTemplate=nt,t.Fixed32AddExecutor=K,t.Fixed32AddTemplate=X,t.Fixed32CeilExecutor=dt,t.Fixed32CeilTemplate=mt,t.Fixed32ClampExecutor=Nt,t.Fixed32ClampTemplate=ft,t.Fixed32CompareExecutor=Rt,t.Fixed32CompareTemplate=It,t.Fixed32ConstantsExecutor=Tt,t.Fixed32ConstantsTemplate=Ct,t.Fixed32DivideExecutor=at,t.Fixed32DivideTemplate=rt,t.Fixed32FloorExecutor=ht,t.Fixed32FloorTemplate=lt,t.Fixed32FromExecutor=H,t.Fixed32FromIntExecutor=G,t.Fixed32FromIntTemplate=_,t.Fixed32FromTemplate=D,t.Fixed32IsZeroExecutor=Pt,t.Fixed32IsZeroTemplate=Ot,t.Fixed32LerpExecutor=vt,t.Fixed32LerpTemplate=Ft,t.Fixed32MaxExecutor=Et,t.Fixed32MaxTemplate=Mt,t.Fixed32MinExecutor=bt,t.Fixed32MinTemplate=wt,t.Fixed32MultiplyExecutor=et,t.Fixed32MultiplyTemplate=tt,t.Fixed32NegateExecutor=it,t.Fixed32NegateTemplate=st,t.Fixed32RoundExecutor=yt,t.Fixed32RoundTemplate=pt,t.Fixed32SignExecutor=gt,t.Fixed32SignTemplate=xt,t.Fixed32SqrtExecutor=ct,t.Fixed32SqrtTemplate=ut,t.Fixed32SubtractExecutor=J,t.Fixed32SubtractTemplate=Q,t.Fixed32ToFloatExecutor=$,t.Fixed32ToFloatTemplate=W,t.Fixed32ToIntExecutor=U,t.Fixed32ToIntTemplate=Y,t.FixedMath=u,t.FixedNodeDefinitions=At,t.FixedVector2=c,t.FixedVector2AddExecutor=Bt,t.FixedVector2AddTemplate=kt,t.FixedVector2CrossExecutor=Qt,t.FixedVector2CrossTemplate=Kt,t.FixedVector2DistanceExecutor=te,t.FixedVector2DistanceTemplate=Jt,t.FixedVector2DotExecutor=Xt,t.FixedVector2DotTemplate=Ut,t.FixedVector2LengthExecutor=Wt,t.FixedVector2LengthTemplate=Gt,t.FixedVector2LerpExecutor=re,t.FixedVector2LerpTemplate=ee,t.FixedVector2NegateExecutor=_t,t.FixedVector2NegateTemplate=Ht,t.FixedVector2NormalizeExecutor=Yt,t.FixedVector2NormalizeTemplate=$t,t.FixedVector2ScaleExecutor=Dt,t.FixedVector2ScaleTemplate=jt,t.FixedVector2SubtractExecutor=qt,t.FixedVector2SubtractTemplate=zt,t.FixedVectorNodeDefinitions=ae,t.Interpolation=p,t.MakeColorExecutor=ie,t.MakeColorTemplate=se,t.MakeFixedVector2Executor=St,t.MakeFixedVector2Template=Vt,t.MakeVector2Executor=x,t.MakeVector2Template=y,t.MathNodeDefinitions=Ze,t.MathUtils=l,t.Matrix3=a,t.Polygon=n,t.Rectangle=s,t.Vector2=e,t.Vector2AddExecutor=M,t.Vector2AddTemplate=b,t.Vector2CrossExecutor=A,t.Vector2CrossTemplate=T,t.Vector2DistanceExecutor=S,t.Vector2DistanceTemplate=V,t.Vector2DotExecutor=C,t.Vector2DotTemplate=P,t.Vector2FromAngleExecutor=q,t.Vector2FromAngleTemplate=z,t.Vector2LengthExecutor=I,t.Vector2LengthTemplate=v,t.Vector2LerpExecutor=L,t.Vector2LerpTemplate=Z,t.Vector2NormalizeExecutor=O,t.Vector2NormalizeTemplate=R,t.Vector2RotateExecutor=B,t.Vector2RotateTemplate=k,t.Vector2ScaleExecutor=F,t.Vector2ScaleTemplate=N,t.Vector2SubtractExecutor=f,t.Vector2SubtractTemplate=E,t.Vector3=r,t.VectorNodeDefinitions=j});
2
+ //# sourceMappingURL=index.umd.js.map