"use strict";(self.webpackChunkluna=self.webpackChunkluna||[]).push([[8],{56:(t,e,i)=>{var n=i(1),o=i(0),s=i(42),r=i(3);const a=new o.j,l=new o.j,c=new o.j,h=new o.j,d=new o.j;function u(t){return a.copy(t),a.w<0&&a.negate(),2*Math.atan2(a.z,a.w)}function y(t,e){e.set(0,0,Math.sin(.5*t),Math.cos(.5*t))}function _(t,e,i){c.copy(t),c.w<0&&c.negate(),y(e,h),function(t,e){l.copy(t),l.w<0&&l.negate(),y(u(l),e)}(c,d),d.invert(),i.mul2(h,d),i.mul(c)}function p(t,e,i=1e-6){return Math.abs(t-e)<=i}let g=0,m=null,f=null,C=null;pc.waitForBox2D.then((t=>{m=t,f=new m.b2Vec2(0,0),C=new m.b2Vec2(0,0)}));class b extends n.k{constructor(t){super(),t=Object.assign({enabled:!0,simulated:!0,type:UnityEngine.RigidbodyType2D.Dynamic,collisionDetectionMode:UnityEngine.CollisionDetectionMode2D.Discrete,mass:1,constraints:0,useAutoMass:!1,gravityScale:1,angularDrag:.05,drag:0},t),this.id=g++,this._enabled=!!t.enabled,this._simulated=!!t.simulated,this._collisionDetectionMode=t.collisionDetectionMode,this._constraints=t.constraints||0,this._freezeRotation=!!(this._constraints&UnityEngine.RigidbodyConstraints2D.FreezeRotation),this._freezeX=!!(this._constraints&UnityEngine.RigidbodyConstraints2D.FreezePositionX),this._freezeY=!!(this._constraints&UnityEngine.RigidbodyConstraints2D.FreezePositionY),this._mass=t.mass,this._material=t.material||null,this._useFullKinematicContacts=!1;const e=new m.b2BodyDef;e.awake=this._enabled,e.type=t.type===UnityEngine.RigidbodyType2D.Dynamic?m.b2_dynamicBody:t.type===UnityEngine.RigidbodyType2D.Kinematic?m.b2_kinematicBody:m.b2_staticBody,e.bullet=this._collisionDetectionMode===UnityEngine.CollisionDetectionMode2D.Continuous,e.gravityScale=Number.isFinite(t.gravityScale)?t.gravityScale:1,e.angularDamping=t.angularDrag>=0?t.angularDrag:.05,e.linearDamping=t.drag>0?t.drag:0,e.fixedRotation=this._freezeRotation,e.fixedPositionX=this._freezeX,e.fixedPositionY=this._freezeY,e.enabled=this._simulated,e.autoMass=t.useAutoMass,this._body=this.world.CreateBody(e),m.destroy(e),this._body.SetComponentId(this.id),this.resetMassData(),this._worldTransformVersion=-1,this._cullingLayer=-1,this._lastSyncEntityPosition=new o.m(-1/0,-1/0,-1/0),this._lastSyncEntityRotation=new o.j(-1/0,-1/0,-1/0,-1/0),this._lastSyncEntityScale=new o.m(-1/0,-1/0,-1/0),this["__UnityEngine.Rigidbody2D"]=null,pc.markPhysics2dModuleAsUsed(),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Rigidbody2DComponent")}get adapter(){return n.a.getApplication().systems.physics2D.adapter}get world(){return this.adapter._world}get body(){return this._body}get destroyed(){return this._destroyed}onEnable(){return!!super.onEnable()&&(this._simulated&&this.adapter.enableRigidbody(this),!0)}onDisable(){return!!super.onDisable()&&(this._simulated&&this.adapter.disableRigidbody(this),this.resetVelocity(),this.resetAngularVelocity(),!0)}onDestroy(){if(!super.onDestroy())return!1;this._destroyed=!0,this.onDisable();let t=this._body.GetJointList();for(;m.getPointer(t)!==m.getPointer(m.NULL);){const e=t.joint,i=this.adapter.getJointComponentForJoint(e);i?(this.adapter.unlinkJointAndJointComponent(e,i),i._joint=null,t=t.next):t=t.next}return this.world.DestroyBody(this._body),!0}syncLayers(){const t=this.entity;t.cullingLayer!==this._cullingLayer&&(this._cullingLayer=t.cullingLayer,this.body.SetUnityLayers(1<0&&t.SetEnabled(!1)}onDisable(){return!!super.onDisable()&&(this._adapter.disableEffector(this),!0)}onDestroy(){return!!super.onDestroy()&&(this.onDisable(),!0)}}x.checkForEffectorColliderMaskUsage=function(t,e){return t.getIsUsedByEffector()&&null!==t.getEffector()&&t.getEffector().useColliderMask||e.getIsUsedByEffector()&&null!==e.getEffector()&&e.getEffector().useColliderMask},x.checkEffectorColliderMask=function(t,e){return!(!t.enabled||!e.enabled)&&(x.processCheckEffectorColliderMask(t,e)&&x.processCheckEffectorColliderMask(e,t))},x.processCheckEffectorColliderMask=function(t,e){if(!t.getIsUsedByEffector())return!0;const i=t.getEffector();return null!==i&&(!i.useColliderMask||!i.ignoreContacts()&&0!=(i.colliderMask&e.entity.layerMask))};const S=new o.i,D=new o.m,A=new o.i,w=new o.j,M=new o.i,T=new o.m;let B=null;pc.waitForBox2D.then((t=>{B=t}));class F extends s.a{constructor(t){super(t),F.instance=this,this._effectors2d=new Map}setup(){var t;this._world=this.options.world,this._newContacts={},this._contacts={},this._oldContacts={},this._contactCount={},this._disabledContacts=new Set,this.velocityIterations=0,this.positionIterations=0,this._groundBody=null,this.collisionMatrix=new Uint32Array(32),this._bodyMap={},this._colliderMap={},this._jointMap={},this._world.SetContactFilter((t=this,Object.assign(new B.JSContactFilter,{ShouldCollide(e,i){const n=B.wrapPointer(e,B.b2Fixture),o=B.wrapPointer(i,B.b2Fixture),s=t.getColliderComponentForCollider(n),r=t.getColliderComponentForCollider(o),a=s._bodyComponent,l=r._bodyComponent,c=a.body,h=l.body,d=s.entity,u=r.entity;return!(!a._enabled||!l.enabled)&&!!(c.GetType()===B.b2_dynamicBody||h.GetType()===B.b2_dynamicBody||a&&c.GetType()===B.b2_kinematicBody&&a.getUseFullKinematicContacts()||l&&h.GetType()===B.b2_kinematicBody&&l.getUseFullKinematicContacts()||n.IsSensor()||o.IsSensor())&&!t._disabledContacts.has(t._getCollidersUid(s,r))&&(x.checkForEffectorColliderMaskUsage(s,r)?x.checkEffectorColliderMask(s,r):!(t.collisionMatrix[d.cullingLayer]&1<Object.assign(new B.JSContactListener,{BeginContact(e){const i=B.wrapPointer(e,B.b2Contact),n=t._getContactUid(i);if(t._contacts[n]||t._newContacts[n])t._contactCount[n]++;else{t._contactCount[n]=0,t._newContacts[n]=i,i._relativeVelocity=i._relativeVelocity||new o.l;const e=i.GetFixtureA().GetBody().GetLinearVelocity();i._relativeVelocity.set(-e.x,-e.y);const s=i.GetFixtureB().GetBody().GetLinearVelocity();i._relativeVelocity.x+=s.x,i._relativeVelocity.y+=s.y}delete t._oldContacts[n]},EndContact(e){const i=B.wrapPointer(e,B.b2Contact),n=t._getContactUid(i),o=t._contacts[n];o&&--t._contactCount[n]<=0&&(t._oldContacts[n]=o,t._contactCount[n]=0)},PreSolve(e){const i=B.wrapPointer(e,B.b2Contact),n=t.getColliderComponentForCollider(i.GetFixtureA()),o=t.getColliderComponentForCollider(i.GetFixtureB());if(n._usedByEffector){const e=t._effectors2d.get(n._entity._guid);e&&e.onBeforeCollision2D(i)}else if(o._usedByEffector){const e=t._effectors2d.get(o._entity._guid);e&&e.onBeforeCollision2D(i)}},PostSolve(){}}))(this))}get groundBody(){return this._groundBody||(this._groundBody=new b({enabled:!0,simulated:!0,type:UnityEngine.RigidbodyType2D.Static}),this._groundBody._entity=n.a.getApplication().root),this._groundBody}addRigidbody(t){t.SetEnabled(!0),this.preSimulationSynchronization(this.getBodyComponentForBody(t),s.a.PreSyncStages.TransformToPhysics)}removeRigidbody(t){t.SetEnabled(!1)}fetchBody(t){let e=t;for(;e;){if(e._enabledInHierarchy){const t=this.getAttachedRigidbodyComponent(e);if(t)return t}e=e._parent}return this.groundBody}enableCollider(t){const e=this.fetchBody(t.entity);t._bodyComponent=e,this.getRelativeTransformAndScale(e,t,S,D),t.updateRelativeTransformAndScale(S,D),t.syncLayers(),t.enable(),this._colliders.push(t),t._worldTransformVersion=t._entity.aabbVersion}disableCollider(t){const e=this._colliders,i=e.indexOf(t);if(!(i<0)){e[i]=e[e.length-1],e.length-=1;for(let e=0;ee?t+1e7*e:e+1e7*t}handleContacts(){this._triggerNewContacts(),this._triggerPersistentContacts(),this._removeNewContacts(),this._triggerOldContacts()}_triggerNewContacts(){for(const t in this._newContacts)this._contacts[t]||this._triggerContactCallback("Enter",this._newContacts[t],Number(t),!0)}_triggerPersistentContacts(){for(const t in this._contacts)this._triggerContactCallback("Stay",this._contacts[t],Number(t))}_removeNewContacts(){for(const t in this._newContacts)this._contacts[t]=this._newContacts[t],delete this._newContacts[t]}_triggerOldContacts(){for(const t in this._oldContacts){const e=this._oldContacts[t],i=this.getColliderComponentForCollider(e.GetFixtureA()),n=this.getColliderComponentForCollider(e.GetFixtureB());i&&i.removeContact(Number(t)),n&&n.removeContact(Number(t)),this._triggerContactCallback("Exit",e,Number(t)),delete e["__UnityEngine.Collision2D"],delete this._oldContacts[t],delete this._contacts[t]}}_triggerContactCallback(t,e,i,o=!1){if(this._disabledContacts.has(i))return;const s=e.GetFixtureA(),r=e.GetFixtureB(),a=this.getColliderComponentForCollider(s),l=this.getColliderComponentForCollider(r);if(!a||!l)return;const c=n.d.instance;if(a._isTrigger||l._isTrigger){const e="OnTrigger"+t+"2D";c.startSubSection([n.d.PHYSICS2D,e]),this.dispatchContact(a._entity,e,l.code);let i=a._bodyComponent;i&&a._entity!==i._entity&&this.dispatchContact(i._entity,e,l.code),this.dispatchContact(l._entity,e,a.code),i=l._bodyComponent,i&&l._entity!==i._entity&&this.dispatchContact(i._entity,e,a.code),c.endSubSection([n.d.PHYSICS2D,e])}else{o&&(a.addContact(e,i),l.addContact(e,i));const s="OnCollision"+t+"2D";c.startSubSection([n.d.PHYSICS2D,s]),this.dispatchContact(a._entity,s,UnityEngine.Object.FromHandle(UnityEngine.Collision2D,e).ConfigureFor(0));let r=a._bodyComponent;r&&a._entity!==r._entity&&this.dispatchContact(r._entity,s,UnityEngine.Object.FromHandle(UnityEngine.Collision2D,e).ConfigureFor(0)),this.dispatchContact(l._entity,s,UnityEngine.Object.FromHandle(UnityEngine.Collision2D,e).ConfigureFor(1)),r=l._bodyComponent,r&&l._entity!==r._entity&&this.dispatchContact(r._entity,s,UnityEngine.Object.FromHandle(UnityEngine.Collision2D,e).ConfigureFor(1)),c.endSubSection([n.d.PHYSICS2D,s])}}ignoreCollision(t,e,i){if(!t.entity._enabledInHierarchy||!e.entity._enabledInHierarchy)return;const n=this._getCollidersUid(t,e);i?this._disabledContacts.add(n):this._disabledContacts.delete(n),t.recalculateContacts(),e.recalculateContacts()}getIgnoreCollision(t,e){const i=this._getCollidersUid(t,e);return this._disabledContacts.has(i)}getLayerCollisionMask(t){return this.collisionMatrix[t]}setLayerCollisionMask(t,e){const i=this.collisionMatrix[t];if(i===e)return;this.collisionMatrix[t]=e;const n=1<{E=t}));class R extends n.j{constructor(t){super(t),this.id="physics2D",this.performanceSamplerSection=n.d.PHYSICS2D,this._defaultMaterial=new UnityEngine.PhysicsMaterial2D,this._defaultMaterial.friction=.4,this._defaultMaterial.bounciness=0,this._autoSyncTransforms=!1,this._gravity=new o.l(0,-9.81);const e=new E.b2Vec2(this._gravity.x,this._gravity.y);this._world=new E.b2World(e),E.destroy(e),this._adapter=new F({world:this._world});const i=n.i.instance.physics2DSettings;this._applyProjectSettings(i)}onFixedUpdate(t){this._adapter.onFixedUpdate(t)}setIgnoreCollisionBetweenLayers(t,e,i){this._adapter.setIgnoreCollisionBetweenLayers(t,e,i)}syncHierarchyRecursive(t){this._adapter.syncHierarchyRecursive(t)}syncHierarchy(t){this._adapter.syncHierarchy(t)}syncTransforms(t){this._autoSyncTransforms&&this._adapter.syncTransforms(t)}get adapter(){return this._adapter}get gravity(){return this._gravity}set gravity(t){this._gravity=t;const e=this._world.GetGravity();e.x=t.x,e.y=t.y,this._world.SetGravity(e)}get defaultMaterial(){return this._defaultMaterial}set defaultMaterial(t){t&&(this._defaultMaterial=t)}get autoSyncTransforms(){return this._autoSyncTransforms}set autoSyncTransforms(t){this._autoSyncTransforms=t}get velocityIterations(){return F.instance.velocityIterations}set velocityIterations(t){F.instance.velocityIterations=t>0?t:1}get positionIterations(){return F.instance.positionIterations}set positionIterations(t){F.instance.positionIterations=t>0?t:1}_applyProjectSettings(t){this.gravity=t.gravity.clone(),this.autoSyncTransforms=t.autoSyncTransforms,this.positionIterations=t.positionIterations,this.velocityIterations=t.velocityIterations,this.defaultMaterial=t.material,this.adapter.world.SetAngularSleepTolerance(t.angularSleepTolerance),this.adapter.world.SetLinearSleepTolerance(t.linearSleepTolerance),this.adapter.world.SetBaumgarteScale(t.baumgarteScale),this.adapter.world.SetBaumgarteTOIScale(t.baumgarteTOIScale),this.adapter.world.SetTimeToSleep(t.timeToSleep),this.adapter.world.SetMaxRotationSpeed(t.maxRotationSpeed),this.adapter.world.SetMaxTranslationSpeed(t.maxTranslationSpeed),this.adapter.world.SetMaxLinearCorrection(t.maxLinearCorrection),this.adapter.world.SetMaxAngularCorrection(t.maxAngularCorrection),this.adapter.world.SetVelocityThreshold(t.velocityThreshold),this.adapter.world.SetDefaultContactOffset(t.defaultContactOffset);for(let e=0;e{G=Object.assign(new E.JSRayCastCallback,{ReportFixture:(t,e,i,s)=>{const r=E.wrapPointer(t,E.b2Fixture),a=E.wrapPointer(e,E.b2Vec2),l=E.wrapPointer(i,E.b2Vec2),c=F.instance.getColliderComponentForCollider(r);if(r.IsSensor()&&!n.i.instance.physics2DSettings.queriesHitTriggers)return-1;if(0==(1<G.maxDepth)return 1;const d=new UnityEngine.RaycastHit2D;if(d.normal=new o.l(l.x,l.y),d.point=new o.l(a.x,a.y),d.centroid=d.point.clone(),d.fraction=s,d.distance=0,d.fraction>0){const t=d.point.x-G.pointA.x,e=d.point.y-G.pointA.y;d.distance=Math.sqrt(t*t+e*e)}d.collider=c.code;for(let t=0;tr.b*r.b;if(n.i.instance.physics2DSettings.queriesStartInColliders){const t=new o.l,e=new o.l(G.pointA.x,G.pointA.y);i&&(t.copy(e),t.x-=G.pointB.x,t.y-=G.pointB.y,t.normalize());const n=R.overlapPointAll(e,G.layerMask,G.minDepth,G.maxDepth);for(let i=0;it.fraction-e.fraction)),G.allResults.length):G.allResults.length},pointA:new E.b2Vec2(0,0),pointB:new E.b2Vec2(0,0),layerMask:0,minDepth:1/0,maxDepth:-1/0,allResults:[]})})),R.raycast=(t,e,i,n,o,s)=>{F.instance.autoSyncTransforms(),G.pointA.Set(t.x,t.y),G.pointB.Set(t.x,t.y),e.normalize();const a=i>Number.MAX_SAFE_INTEGER;G.pointB.x+=e.x*(a?r.e:i),G.pointB.y+=e.y*(a?r.e:i),G.layerMask=n,G.minDepth=o,G.maxDepth=s,G.run();for(let t=0;t{F.instance.autoSyncTransforms(),G.pointA.Set(t.x,t.y),G.pointB.Set(t.x,t.y),e.normalize();const a=i>Number.MAX_SAFE_INTEGER;G.pointB.x+=e.x*(a?r.e:i),G.pointB.y+=e.y*(a?r.e:i),G.layerMask=n,G.minDepth=o,G.maxDepth=s,G.run();for(let t=0;t{if(!i||0===i.length)return 0;F.instance.autoSyncTransforms(),G.pointA.Set(t.x,t.y),G.pointB.Set(t.x,t.y),e.normalize();const l=n>Number.MAX_SAFE_INTEGER;G.pointB.x+=e.x*(l?r.e:n),G.pointB.y+=e.y*(l?r.e:n),G.layerMask=o,G.minDepth=s,G.maxDepth=a,G.run();const c=Math.min(G.allResults.length,i.length);for(let t=0;t(F.instance.autoSyncTransforms(),G.pointA.Set(t.x,t.y),G.pointB.Set(e.x,e.y),G.layerMask=i,G.minDepth=n,G.maxDepth=o,G.run(),G.allResults[0]||new UnityEngine.RaycastHit2D),R.linecastAll=(t,e,i,n,o)=>(F.instance.autoSyncTransforms(),G.pointA.Set(t.x,t.y),G.pointB.Set(e.x,e.y),G.layerMask=i,G.minDepth=n,G.maxDepth=o,G.run(),[...G.allResults]),R.linecastNonAlloc=(t,e,i,n,o,s)=>{if(!i||0===i.length)return 0;F.instance.autoSyncTransforms(),G.pointA.Set(t.x,t.y),G.pointB.Set(e.x,e.y),G.layerMask=n,G.minDepth=o,G.maxDepth=s,G.run();const r=Math.min(G.allResults.length,i.length);for(let t=0;tthis.maxDepth?1:this.checkFixture(e,i)?(this.allResults.push(i),this.allResults.sort(((t,e)=>t.entity.getPosition().z-e.entity.getPosition().z)),1):1},run(){this.allResults.length=0,this.aabb=this.aabb||new E.b2AABB,this.initializeAABB(),F.instance.world.QueryAABB(this,this.aabb)},checkFixture:(t,e)=>!0,initializeAABB(){throw new Error("Not implemented")},layerMask:0,minDepth:1/0,maxDepth:-1/0,aabb:null,allResults:[]};let j=null;const k=()=>Object.assign(new E.JSQueryCallback,P,{checkFixture(t,e){return t.TestPoint(this.point)},initializeAABB(){j.aabb.lowerBound=j.point,j.aabb.upperBound=j.point},point:new E.b2Vec2(0,0)});pc.waitForBox2D.then((()=>{j=k()})),R.overlapPoint=(t,e,i,n)=>(F.instance.autoSyncTransforms(),j.layerMask=e,j.minDepth=i,j.maxDepth=n,j.point.Set(t.x,t.y),j.run(),j.allResults.length?j.allResults[0].code:null),R.overlapPointAll=(t,e,i,n)=>(F.instance.autoSyncTransforms(),j.layerMask=e,j.minDepth=i,j.maxDepth=n,j.point.Set(t.x,t.y),j.run(),j.allResults.map((t=>t.code))),R.overlapPointNonAlloc=(t,e,i,n,o)=>{if(!e||0===e.length)return 0;F.instance.autoSyncTransforms(),j.layerMask=i,j.minDepth=n,j.maxDepth=o,j.point.Set(t.x,t.y),j.run();const s=Math.min(e.length,j.allResults.length);for(let t=0;t{const o=t.GetChildCount(),s=e.GetChildCount();for(let r=0;rObject.assign(new E.JSQueryCallback,P,{checkFixture:(t,e)=>U.isPointQuery?t.TestPoint(U.point):z(U.circleShape,t.GetShape(),U.queryTransform,t.GetBody().GetTransform()),initializeAABB(){if(U.radius<1e-5)return U.aabb.lowerBound=U.aabb.upperBound=this.point,void(U.isPointQuery=!0);U.circleShape.m_p.Set(U.point.x,U.point.y),U.circleShape.m_radius=U.radius,U.queryTransform.SetIdentity(),U.circleShape.ComputeAABB(U.aabb,U.queryTransform,0,!1),U.isPointQuery=!1},point:new E.b2Vec2(0,0),radius:0,circleShape:new E.b2CircleShape,queryTransform:new E.b2Transform(new E.b2Vec2(0,0),new E.b2Rot(0)),isPointQuery:!1});pc.waitForBox2D.then((()=>{U=L()})),R.overlapCircle=(t,e,i,n,o)=>(F.instance.autoSyncTransforms(),U.layerMask=i,U.minDepth=n,U.maxDepth=o,U.point.Set(t.x,t.y),U.radius=e,U.run(),U.allResults.length?U.allResults[0].code:null),R.overlapCircleAll=(t,e,i,n,o)=>(F.instance.autoSyncTransforms(),U.layerMask=i,U.minDepth=n,U.maxDepth=o,U.point.Set(t.x,t.y),U.radius=e,U.run(),U.allResults.map((t=>t.code))),R.overlapCircleNonAlloc=(t,e,i,n,o,s)=>{if(!i||0===i.length)return 0;F.instance.autoSyncTransforms(),U.layerMask=n,U.minDepth=o,U.maxDepth=s,U.point.Set(t.x,t.y),U.radius=e,U.run();const r=Math.min(i.length,U.allResults.length);for(let t=0;t{J=Object.assign(new E.JSQueryCallback,P,{checkFixture:(t,e)=>z(J.polygonShape,t.GetShape(),J.queryTransform,t.GetBody().GetTransform()),initializeAABB(){J.polygonShape.SetAsBox(Math.max(r.f,.5*J.size.x),Math.max(r.f,.5*J.size.y),J.point,J.angle),J.queryTransform.SetIdentity(),J.polygonShape.ComputeAABB(J.aabb,J.queryTransform,0,!1)},point:new E.b2Vec2(0,0),size:new E.b2Vec2(0,0),angle:0,polygonShape:new E.b2PolygonShape,queryTransform:new E.b2Transform(new E.b2Vec2(0,0),new E.b2Rot(0))})})),R.overlapBox=(t,e,i,n,s,r)=>(F.instance.autoSyncTransforms(),J.layerMask=n,J.minDepth=s,J.maxDepth=r,J.point.Set(t.x,t.y),J.size.Set(e.x,e.y),J.angle=i*o.e,J.run(),J.allResults.length?J.allResults[0].code:null),R.overlapBoxAll=(t,e,i,n,s,r)=>(F.instance.autoSyncTransforms(),J.layerMask=n,J.minDepth=s,J.maxDepth=r,J.point.Set(t.x,t.y),J.size.Set(e.x,e.y),J.angle=i*o.e,J.run(),J.allResults.map((t=>t.code))),R.overlapBoxNonAlloc=(t,e,i,n,s,r,a)=>{F.instance.autoSyncTransforms(),J.layerMask=s,J.minDepth=r,J.maxDepth=a,J.point.Set(t.x,t.y),J.size.Set(e.x,e.y),J.angle=i*o.e,J.run();const l=Math.min(n.length,J.allResults.length);for(let t=0;t{I=Object.assign(new E.JSQueryCallback,P,{checkFixture:(t,e)=>z(I.queryCollider._fixtures[0].GetShape(),t.GetShape(),I.queryCollider._fixtures[0].GetBody().GetTransform(),t.GetBody().GetTransform()),initializeAABB(){const t=I.queryCollider.getBounds();I.aabb.lowerBound.Set(t.min.x,t.min.y),I.aabb.upperBound.Set(t.max.x,t.max.y)},queryCollider:null})})),R.overlapCollider=(t,e,i,n,o)=>{if(!e||0===e.length)return 0;F.instance.autoSyncTransforms(),I.queryCollider=t,J.layerMask=i,J.minDepth=n,J.maxDepth=o,I.run();const s=Math.min(e.length,I.allResults.length);for(let t=0;tObject.assign(new E.JSQueryCallback,P,{checkFixture(t,e){return z(this.capsuleShape,t.GetShape(),this.queryTransform,t.GetBody().GetTransform())},initializeAABB(){const t=Math.max(r.f,this.size.x),e=Math.max(r.f,this.size.y);if(this.direction===UnityEngine.CapsuleDirection2D.Vertical){const i=Math.max(r.f,e-t);this.capsuleShape.SetByExtentsY(.5*t,i,this.point,this.angle)}else{const i=Math.max(r.f,t-e);this.capsuleShape.SetByExtentsX(.5*e,i,this.point,this.angle)}this.queryTransform.SetIdentity(),this.capsuleShape.ComputeAABB(q.aabb,this.queryTransform,0,!1)},point:new E.b2Vec2(0,0),size:new E.b2Vec2(0,0),direction:0,angle:0,capsuleShape:new E.b2CapsuleShape,queryTransform:new E.b2Transform(new E.b2Vec2(0,0),new E.b2Rot(0))});pc.waitForBox2D.then((()=>{q=v()})),R.overlapCapsule=(t,e,i,n,s,r,a)=>(F.instance.autoSyncTransforms(),q.point.Set(t.x,t.y),q.size.Set(e.x,e.y),q.direction=i,q.angle=n*o.e,q.layerMask=s,q.minDepth=r,q.maxDepth=a,q.run(),q.allResults.length>0?q.allResults[0].code:null),R.overlapCapsuleAll=(t,e,i,n,s,r,a)=>(F.instance.autoSyncTransforms(),q.point.Set(t.x,t.y),q.size.Set(e.x,e.y),q.direction=i,q.angle=n*o.e,q.layerMask=s,q.minDepth=r,q.maxDepth=a,q.run(),q.allResults.map((t=>t.code))),R.overlapCapsuleNonAlloc=(t,e,i,n,s,r,a,l)=>{if(!s||0===s.length)return 0;F.instance.autoSyncTransforms(),q.point.Set(t.x,t.y),q.size.Set(e.x,e.y),q.direction=i,q.angle=n*o.e,q.layerMask=r,q.minDepth=a,q.maxDepth=l,q.run();const c=Math.min(q.allResults.length,s.length);for(let t=0;t{F.instance.ignoreCollision(t,e,i)},R.getIgnoreCollision=(t,e)=>F.instance.getIgnoreCollision(t,e);const O={run(){this.foundFixtureProxies.length=0,this.results.length=0,this.initialize(),F.instance.world.QueryProxyAABB(this,this.sweepAABB);for(let t=0;tt.distance-e.distance))},addRaycastHit(t){if(t){for(let e=0;et.fraction&&(this.results[e]=t));this.results.push(t)}},buildRaycastHit(t,e,i,n,s){const a=new E.b2Fixture;a.m_shape=this.shape;const l=E.b2Contact.prototype.Create(a,0,t.fixture,t.childIndex,F.instance.world.GetBlockAllocator()),c=l.GetFixtureB()===a;let h=e,d=i,u=this.shape.m_radius,y=t.fixture.GetShape().m_radius;c&&(h=i,d=e,u=t.fixture.GetShape().m_radius,y=this.shape.m_radius);const _=l.GetManifold();if(l.Evaluate(_,h,d),0===_.pointCount){const t=.5*r.h;c?_.radiusB+=t:_.radiusA+=t,this.shape.m_radius+=t,l.Evaluate(_,h,d),this.shape.m_radius-=t}const p=_.pointCount,g=new UnityEngine.RaycastHit2D;if(p>0){const i=new E.b2WorldManifold;i.Initialize(_,h,u,d,y),g.normal=new o.l(i.normal.x,i.normal.y),c||(g.normal=new o.l(-i.normal.x,-i.normal.y)),g.collider=F.instance.getColliderComponentForCollider(t.fixture).code,g.fraction=n,g.distance=s;const a=e.p;if(g.centroid=new o.l(a.x,a.y),1===p)g.point=new o.l(i.points.x,i.points.y);else{const t=i.GetPointAt(0),e=i.GetPointAt(1),n=i.GetSeparationAt(0),s=i.GetSeparationAt(1),a=Math.abs(n-s)0?g:null},ReportFixtureProxy(t){const e=E.wrapPointer(t,E.b2FixtureProxy),i=e.fixture,o=F.instance.getColliderComponentForCollider(i);if(i.IsSensor()&&!n.i.instance.physics2DSettings.queriesHitTriggers)return!0;if(0==(1<this.maxDepth||this.foundFixtureProxies.push(e),!0},initialize(){this.sweepInput=this.sweepInput||new E.b2TOIInput,this.sweepAABB=this.sweepAABB||new E.b2AABB,this.castTransform=this.castTransform||new E.b2Transform(new E.b2Vec2(0,0),new E.b2Rot(0)),this.shape=this.initializeShape();const t=new E.b2Rot(this.angle);this.castTransform.p.Set(this.pointA.x,this.pointA.y),this.castTransform.q=t;const e=new E.b2Transform(this.pointB,t),i=new E.b2AABB,n=new E.b2AABB;this.shape.ComputeAABB(i,this.castTransform,0,!1),this.shape.ComputeAABB(n,e,0,!1),this.sweepAABB.Combine(i,n),this.sweepInput.proxyA.Set(this.shape,0);const o=this.sweepInput.sweepA;o.localCenter.SetZero(),o.c0=this.castTransform.p,o.c=e.p,o.a0=o.a=this.angle,o.alpha0=0,E.destroy(t),E.destroy(e),E.destroy(i),E.destroy(n)},initializeShape(){throw new Error("Not implemented")},pointA:null,pointB:null,angle:0,layerMask:-1,minDepth:-1/0,maxDepth:1/0,results:[],foundFixtureProxies:[],shape:null,sweepInput:null,sweepAABB:null,castTransform:null};pc.waitForBox2D.then((t=>{O.pointA=new t.b2Vec2(0,0),O.pointB=new t.b2Vec2(0,0)}));let V=null;const N=()=>Object.assign(new E.JSQueryProxyCallback,O,{initializeShape(){return this.circleShape.m_radius=this.radius,this.circleShape},circleShape:new E.b2CircleShape,radius:0});pc.waitForBox2D.then((()=>{V=N()})),R.circleCast=(t,e,i,n,o,s,a)=>{if(e<=r.f)return new UnityEngine.RaycastHit2D;V.pointA.Set(t.x,t.y),V.pointB.Set(t.x,t.y),i.normalize();const l=n>Number.MAX_SAFE_INTEGER;V.pointB.x+=i.x*(l?r.e:n),V.pointB.y+=i.y*(l?r.e:n),V.radius=e,V.layerMask=o,V.minDepth=s,V.maxDepth=a,F.instance.autoSyncTransforms(),V.run();for(let t=0;t{if(e<=r.f)return[];V.pointA.Set(t.x,t.y),V.pointB.Set(t.x,t.y),i.normalize();const l=n>Number.MAX_SAFE_INTEGER;V.pointB.x+=i.x*(l?r.e:n),V.pointB.y+=i.y*(l?r.e:n),V.radius=e,V.layerMask=o,V.minDepth=s,V.maxDepth=a,F.instance.autoSyncTransforms(),V.run();for(let t=0;t{if(e<=r.f)return 0;if(0===n.length)return 0;V.pointA.Set(t.x,t.y),V.pointB.Set(t.x,t.y),i.normalize();const c=o>Number.MAX_SAFE_INTEGER;V.pointB.x+=i.x*(c?r.e:o),V.pointB.y+=i.y*(c?r.e:o),V.radius=e,V.layerMask=s,V.minDepth=a,V.maxDepth=l,F.instance.autoSyncTransforms(),V.run();const h=Math.min(V.results.length,n.length);for(let t=0;tObject.assign(new E.JSQueryProxyCallback,O,{initializeShape(){return this.boxShape.SetAsBox(this.boxHalfSize.x,this.boxHalfSize.y),this.boxShape},boxShape:new E.b2PolygonShape,boxHalfSize:new E.b2Vec2(0,0)});pc.waitForBox2D.then((()=>{H=X()})),R.boxCast=(t,e,i,n,s,a,l,c)=>{if(e.x<=r.f||e.y<=r.f)return new UnityEngine.RaycastHit2D;H.pointA.Set(t.x,t.y),H.pointB.Set(t.x,t.y),n.normalize();const h=s>Number.MAX_SAFE_INTEGER;H.pointB.x+=n.x*(h?r.e:s),H.pointB.y+=n.y*(h?r.e:s),H.boxHalfSize.Set(.5*e.x,.5*e.y),H.angle=i*o.e,H.layerMask=a,H.minDepth=l,H.maxDepth=c,F.instance.autoSyncTransforms(),H.run();for(let t=0;t{if(e.x<=r.f||e.y<=r.f)return[];H.pointA.Set(t.x,t.y),H.pointB.Set(t.x,t.y),n.normalize();const h=s>Number.MAX_SAFE_INTEGER;H.pointB.x+=n.x*(h?r.e:s),H.pointB.y+=n.y*(h?r.e:s),H.boxHalfSize.Set(.5*e.x,.5*e.y),H.angle=i*o.e,H.layerMask=a,H.minDepth=l,H.maxDepth=c,F.instance.autoSyncTransforms(),H.run();for(let t=0;t{if(e.x<=r.f||e.y<=r.f)return 0;if(0===s.length)return 0;H.pointA.Set(t.x,t.y),H.pointB.Set(t.x,t.y),n.normalize();const d=a>Number.MAX_SAFE_INTEGER;H.pointB.x+=n.x*(d?r.e:a),H.pointB.y+=n.y*(d?r.e:a),H.boxHalfSize.Set(.5*e.x,.5*e.y),H.angle=i*o.e,H.layerMask=l,H.minDepth=c,H.maxDepth=h,F.instance.autoSyncTransforms(),H.run();const u=Math.min(H.results.length,s.length);for(let t=0;tObject.assign(new E.JSQueryProxyCallback,O,{initializeShape(){const t=Math.max(r.f,this.size.x),e=Math.max(r.f,this.size.y);if(this.direction===UnityEngine.CapsuleDirection2D.Vertical){const i=Math.max(r.f,e-t);this.capsuleShape.SetByExtentsY(.5*t,i)}else{const i=Math.max(r.f,t-e);this.capsuleShape.SetByExtentsX(.5*e,i)}return this.capsuleShape},capsuleShape:new E.b2CapsuleShape,size:new E.b2Vec2(0,0),direction:0});pc.waitForBox2D.then((()=>{W=Y()})),R.capsuleCast=(t,e,i,n,s,a,l,c,h)=>{if(e.x<=r.f||e.y<=r.f)return new UnityEngine.RaycastHit2D;W.pointA.Set(t.x,t.y),W.pointB.Set(t.x,t.y),s.normalize();const d=a>Number.MAX_SAFE_INTEGER;W.pointB.x+=s.x*(d?r.e:a),W.pointB.y+=s.y*(d?r.e:a),W.size.Set(e.x,e.y),W.direction=i,W.angle=n*o.e,W.layerMask=l,W.minDepth=c,W.maxDepth=h,F.instance.autoSyncTransforms(),W.run();for(let t=0;t{if(e.x<=r.f||e.y<=r.f)return[];W.pointA.Set(t.x,t.y),W.pointB.Set(t.x,t.y),s.normalize();const d=a>Number.MAX_SAFE_INTEGER;W.pointB.x+=s.x*(d?r.e:a),W.pointB.y+=s.y*(d?r.e:a),W.size.Set(e.x,e.y),W.direction=i,W.angle=n*o.e,W.layerMask=l,W.minDepth=c,W.maxDepth=h,F.instance.autoSyncTransforms(),W.run();for(let t=0;t{if(e.x<=r.f||e.y<=r.f)return 0;if(0===a.length)return 0;W.pointA.Set(t.x,t.y),W.pointB.Set(t.x,t.y),s.normalize();const u=l>Number.MAX_SAFE_INTEGER;W.pointB.x+=s.x*(u?r.e:l),W.pointB.y+=s.y*(u?r.e:l),W.size.Set(e.x,e.y),W.direction=i,W.angle=n*o.e,W.layerMask=c,W.minDepth=h,W.maxDepth=d,F.instance.autoSyncTransforms(),W.run();const y=Math.min(W.results.length,a.length);for(let t=0;t{const s=i>Number.MAX_SAFE_INTEGER,a=s?1:1/i,l=t.clone();if(e.normalize(),l.x+=e.x*(s?r.e:i),l.y+=e.y*(s?r.e:i),l.z+=e.z*(s?r.e:i),Math.abs(t.z-l.z)t.collider.handle.entity.position.z-e.collider.handle.entity.position.z)):d.sort(((t,e)=>e.collider.handle.entity.position.z-t.collider.handle.entity.position.z));const y=new o.m(0,0,u?1:-1),_=[];for(let i=0;i{if(!i||0===i.length)return 0;const s=R.getRayIntersectionAll(t,e,n,o),r=Math.min(i.length,s.length);for(let t=0;t{const i=t.handle,n=e.handle;if(!i._contacts||i===n)return!1;for(const t in i._contacts){if(!i._contacts.hasOwnProperty(t))continue;const e=i._contacts[t],o=e.GetFixtureA(),s=e.GetFixtureB(),r=F.instance.getColliderComponentForCollider(o),a=F.instance.getColliderComponentForCollider(s);if(r===n||a===n)return!0}return!1},R.getLayerCollisionMask=t=>F.instance.getLayerCollisionMask(t),R.setLayerCollisionMask=(t,e)=>F.instance.setLayerCollisionMask(t,e),R.getIgnoreLayerCollision=(t,e)=>F.instance.getIgnoreLayerCollision(t,e),R.setIgnoreLayerCollision=(t,e,i)=>F.instance.setIgnoreLayerCollision(t,e,i);let Q=null;pc.waitForBox2D.then((t=>{Q=t}));let K=0;class Z extends n.k{constructor(t){t=t||{},super(),this.id=K++,this._enabled=void 0===t.enabled||t.enabled,this._active=this._enabled,this._shape=t.shape||null,this._isTrigger=!!t.isTrigger,this._usedByEffector=!!t.usedByEffector,this._density=t.density>=0?t.density:1,this._offset=this._offset||t.offset||new o.l,this._type=t.type||"collider2D",this._relativeTransform=new o.i,this._accumulatedScale=new o.m(1,1,1),this._material=t.material||null,this._contacts={},this._bodyComponent=null,this._fixtures=[],this._worldTransformVersion=-1,this._cullingLayer=-1,this._errorFlag=!1,this["__UnityEngine.Collider2D"]=null,pc.markPhysics2dModuleAsUsed()}get code(){return this._code||this._initializeCode(),this._code}get shape(){return this._shape}get body(){return this._bodyComponent?this._bodyComponent.body:null}get type(){return this._type}_initializeCode(){this._code&&(this["__UnityEngine.Collider2D"]=this._code,this._code.handle=this)}onEnable(){return!!super.onEnable()&&(F.instance.enableCollider(this),!0)}onDisable(){return!!super.onDisable()&&(F.instance.disableCollider(this),!0)}enable(){this._active=!0,0===this._fixtures.length&&this.rebuildFixtures()}disable(){this._active=!1,this.cleanup()}cleanup(t=!1){if(0!==this._fixtures.length){for(let t=0;t=e)break;if(!this._contacts.hasOwnProperty(n))continue;const o=this._contacts[n],s=o.GetFixtureA(),r=o.GetFixtureB();if(!s.GetBody()||!r.GetBody())continue;const a=F.instance.getColliderComponentForCollider(s),l=F.instance.getColliderComponentForCollider(r);this._fixtures.includes(s)?t[i++]=l.code:this._fixtures.includes(r)&&(t[i++]=a.code)}return i}getContactedColliders(t){return this.getContactedCollidersInternal(t,t.length)}getContactedCollidersAll(){const t=[];return this.getContactedCollidersInternal(t,1/0),t}getContactedContactsInternal(t,e){if(!t||e<=0)return 0;let i=0;for(const n in this._contacts){const o=this._contacts[n],s=o.GetFixtureA().GetComponentId()===this.id?F.instance.getColliderComponentForCollider(o.GetFixtureB()):F.instance.getColliderComponentForCollider(o.GetFixtureA());if(t[i]=UnityEngine.ContactPoint2D.ConfigureFor(o,this.code,s.code,0),i++,i>=e)break}return i}getContactedContacts(t){return this.getContactedContactsInternal(t,t.length)}getContactedContactsAll(){const t=[];return this.getContactedContactsInternal(t,1/0),t}getIsTrigger(){return this._isTrigger}setIsTrigger(t){t=!!t,this._isTrigger!==t&&(this._isTrigger=t,this.rebuildFixturesIfNecessary())}getIsUsedByEffector(){return this._usedByEffector}setIsUsedByEffector(t){this._usedByEffector=!!t}getEffector(){return F.instance._effectors2d.get(this.entity._guid)||null}getOffset(){return this._offset.clone()}setOffset(t=o.l.ZERO){this._offset.equals(t)||(this._offset.copy(t),this.rebuildFixturesIfNecessary())}getShapeCount(){return this._fixtures.length}overlapCollider(t,e){let i=t.minDepth,n=t.maxDepth;t.useDepth||(i=-1/0,n=1/0);let o=t.layerMask;return t.useLayerMask||(o=-1),R.overlapCollider(this,e,i,n,o)}getBounds(){if(!this._fixtures.length||!this._active)return new o.b;const t=new Q.b2AABB,e=new Q.b2AABB,i=this._bodyComponent.body.GetTransform();for(let n=0;n{$=t}));let tt=null;pc.waitForBox2D.then((t=>{tt=t}));let et=null;pc.waitForBox2D.then((t=>{et=t}));let it=null;pc.waitForBox2D.then((t=>{it=t}));const nt=new o.m;let ot=null;pc.waitForBox2D.then((t=>{ot=t}));const st=new o.m;class rt extends Z{constructor(t){(t=t||{}).type="boxCollider2D",super(t),this._offset=(new o.l).copy(t.center||o.l.ZERO),this._size=(new o.l).copy(t.size||o.l.ONE),this._size.x=Math.max(r.f,this._size.x),this._size.y=Math.max(r.f,this._size.y),this._radius=(0,o.o)(t.radius||0,0,r.d),this["__UnityEngine.BoxCollider2D"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"BoxCollider2DComponents")}_initializeCode(){this._code=new UnityEngine.BoxCollider2D(this),this["__UnityEngine.BoxCollider2D"]=this._code,super._initializeCode()}getSize(){return this._size.clone()}setSize(t=o.l.ONE){this._size.equals(t)||(this._size.copy(t),this._size.x=Math.max(r.f,this._size.x),this._size.y=Math.max(r.f,this._size.y),this.rebuildFixturesIfNecessary())}generateShapes(){const t=[new o.l(-this._size.x/2+this._offset.x,-this._size.y/2+this._offset.y),new o.l(this._size.x/2+this._offset.x,-this._size.y/2+this._offset.y),new o.l(this._size.x/2+this._offset.x,this._size.y/2+this._offset.y),new o.l(-this._size.x/2+this._offset.x,this._size.y/2+this._offset.y)],e=[];for(const i of t)st.set(i.x,i.y,0),this._relativeTransform.transformPoint(st,st),e.push(new ot.b2Vec2(st.x,st.y));const i=new ot.b2PolygonShape,[n,s]=ot.pointsToVec2Array(e);return rt.polygonColliderBuilder.ValidatePolygonShape(n,e.length,.5*r.h*(.5*r.h))?(i.Set(n,e.length),s(),i.m_radius=this._radius,[i]):(this._errorFlag=!0,ot.destroy(i),s(),[])}}rt._polygonColliderBuilder=null,Object.defineProperty(rt,"polygonColliderBuilder",{get:()=>(rt._polygonColliderBuilder||(rt._polygonColliderBuilder=new ot.b2PolygonColliderBuilder),rt._polygonColliderBuilder)});class at extends n.j{constructor(t){super(t),this.id="collider2D",this.performanceSamplerSection=n.d.PHYSICS2D,this._physics2DSystem=n.a.getApplication().systems.physics2D}removeComponent(t,e){e.onDestroy(),super.removeComponent(t,e)}get defaultMaterial(){return this._physics2DSystem.defaultMaterial}set defaultMaterial(t){this._physics2DSystem.defaultMaterial=t}}class lt extends n.j{constructor(t){super(t),this.id="rigidbody2D",this.performanceSamplerSection=n.d.PHYSICS2D,this._physics2DSystem=n.a.getApplication().systems.physics2D}removeComponent(t,e){e.onDestroy(),super.removeComponent(t,e)}get adapter(){return this._physics2DSystem.adapter}}const ct=["onFixedUpdate"];let ht=0,dt=null;pc.waitForBox2D.then((t=>{dt=t}));class ut extends n.k{constructor(t){t=Object.assign({enabled:!0,enableCollision:!1,breakForce:1/0,breakTorque:1/0},t||{}),super(),this.id=ht++,this._enabled=!!t.enabled,this._enableCollision=!!t.enableCollision,this._breakForce=Number.isFinite(t.breakForce)&&t.breakForce>=0?t.breakForce:1/0,this._breakTorque=Number.isFinite(t.breakTorque)&&t.breakTorque>=0?t.breakTorque:1/0,this._attachedRigidbody=null,this._connectedBody=null,this._joint=null,this._type="",this._dt=0,pc.markPhysics2dModuleAsUsed()}get sortingOrderInQueue(){return this._sortingOrderInQueue}get code(){return this._code||this._initializeCode(),this._code}get joint(){return this._joint}get type(){return this._type}get class(){throw new Error("Not implemented")}_initializeCode(){this._code&&(this["__UnityEngine.Joint2D"]=this._code,this._code.handle=this)}onEnable(){return!!super.onEnable()&&(F.instance.enableConstraint(this),!0)}onDisable(){return!!super.onDisable()&&(F.instance.disableConstraint(this),!0)}onDestroy(){return!!super.onDestroy()&&(this.onDisable(),this.destroyJoint(),!0)}enable(){this._enabled=!0,this.createJoint()}disable(){this._enabled=!1,this.destroyJoint()}_queuesToSubscribe(){return ct}onFixedUpdate(t){if(this._enabled){if(this._dt=t,this._breakTorque<1/0){if(this._joint.GetReactionTorque(1/t)>this._breakTorque)return void this.onDestroy()}if(this._breakForce<1/0){this._joint.GetReactionForce(1/t).LengthSquared()>this._breakForce*this._breakForce&&this.onDestroy()}}}recreateJoint(t=!1){this.destroyJoint(t),this.createJoint()}createJoint(){if(this._joint)return;this._connectedBody=this.code.connectedBody;let t=this._connectedBody&&this._connectedBody.handle;const e=this.getAttachedRigidbody().handle;t||(t=F.instance.groundBody);const i=this._createJoint(e,t);i&&(this._joint=dt.wrapPointer(dt.getPointer(i),this.class),this._joint.SetComponentId(this.id),F.instance.linkJointAndJointComponent(this._joint,this),e.body.SetAwake(!0),t.body.SetAwake(!0))}destroyJoint(t=!1){if(this._joint){if(DEBUG){let t=!1;if([this.joint.GetBodyA().GetJointList(),this.joint.GetBodyB().GetJointList()].forEach((e=>{let i=e;for(;dt.getPointer(i)!==dt.getPointer(dt.NULL);){if(dt.getPointer(i.joint)===dt.getPointer(this.joint)){t=!0;break}i=i.next}})),!t)throw new Error("Joint is not found in any of the bodies")}F.instance.unlinkJointAndJointComponent(this._joint,this),F.instance.world.DestroyJoint(this._joint),this._joint=null}}_createJoint(t,e){throw new Error("Not implemented")}getEnableCollision(){return this._enableCollision}setEnableCollision(t=!1){this._enableCollision!==t&&(this._enableCollision=t,this._joint&&this.recreateJoint())}getAttachedRigidbody(){if(this._attachedRigidbody)return this._attachedRigidbody;const t=this._entity._unityComponents.rigidbody2D[0];return this._attachedRigidbody=UnityEngine.Object.FromHandle(UnityEngine.Rigidbody2D,t),this._attachedRigidbody}getConnectedBody(){return this._connectedBody}setConnectedBody(t){this._connectedBody!==t&&(this._connectedBody=t,this._joint&&this.recreateJoint(!0))}getBreakForce(){return this._breakForce}setBreakForce(t){t<0&&(t=0),this._breakForce=t}getBreakTorque(){return this._breakTorque}setBreakTorque(t){this._breakTorque=t<0?0:t}getReactionForce(t){if(t<=0||!this._joint)return new o.l;const e=this._joint.GetReactionForce(1/t);return new o.l(e.x,e.y)}getFrameReactionForce(){if(0===this._dt||!this._joint)return new o.l;const t=this._joint.GetReactionForce(1/this._dt);return new o.l(t.x,t.y)}getReactionTorque(t){return t>0&&this._joint?this._joint.GetReactionTorque(1/t):0}getFrameReactionTorque(){return this._dt>0&&this._joint?this._joint.GetReactionTorque(1/this._dt):0}}let yt=null;pc.waitForBox2D.then((t=>{yt=t}));class _t extends ut{constructor(t){super(t=Object.assign({autoConfigureConnectedAnchor:!0,connectedAnchor:new o.l,anchor:new o.l},t)),this._autoConfigureConnectedAnchor=!!t.autoConfigureConnectedAnchor,this._connectedAnchor=t.connectedAnchor,this._anchor=t.anchor}_initializeCode(){this._code&&(this["__UnityEngine.AnchoredJoint2D"]=this._code),super._initializeCode()}getAutoConfigureConnectedAnchor(){return this._autoConfigureConnectedAnchor}setAutoConfigureConnectedAnchor(t){this._autoConfigureConnectedAnchor!==t&&(this._autoConfigureConnectedAnchor=!!t,this._joint&&this.recreateJoint())}getAnchor(){return this._anchor.clone()}setAnchor(t){this._anchor.equals(t)||(this._anchor.copy(t),this._joint&&this.recreateJoint())}getConnectedAnchor(){return this._connectedAnchor.clone()}setConnectedAnchor(t){this._connectedAnchor.equals(t)||(this._connectedAnchor.copy(t),this._joint&&this.recreateJoint())}configureAnchors(t,e,i,n){const o=i.entity.getLossyScale();t.Set(this._anchor.x*o.x,this._anchor.y*o.y);const s=n.entity.getLossyScale();if(!this._autoConfigureConnectedAnchor)return void e.Set(this._connectedAnchor.x*s.x,this._connectedAnchor.y*s.y);const r=i.body.GetWorldPoint(t);if(!this._connectedBody)return this._connectedAnchor.set(r.x,r.y),void e.Set(this._connectedAnchor.x,this._connectedAnchor.y);const a=n.body.GetLocalPoint(r);this._connectedAnchor.set(a.x/s.x,a.y/s.y),e.Set(a.x,a.y)}configureDistance(t,e,i,n){const o=i.body.GetWorldPoint(t),s=o.x,r=o.y,a=n.body.GetWorldPoint(e),l=s-a.x,c=r-a.y;return Math.sqrt(l*l+c*c)}}let pt=null;pc.waitForBox2D.then((t=>{pt=t}));let gt=null;pc.waitForBox2D.then((t=>{gt=t}));let mt=null;pc.waitForBox2D.then((t=>{mt=t}));let ft=null;pc.waitForBox2D.then((t=>{ft=t}));let Ct=null;pc.waitForBox2D.then((t=>{Ct=t}));let bt=null;pc.waitForBox2D.then((t=>{bt=t}));let xt=null;pc.waitForBox2D.then((t=>{xt=t}));let St=null;pc.waitForBox2D.then((t=>{St=t}));class Dt extends n.j{constructor(t){super(t),this.id="joint2D",this.performanceSamplerSection=n.d.PHYSICS2D}removeComponent(t,e){e.onDestroy(),super.removeComponent(t,e)}}class At extends n.j{constructor(t){super(t),this.id="effector2D",this.performanceSamplerSection=n.d.PHYSICS2D}removeComponent(t,e){e.onDestroy(),super.removeComponent(t,e)}}pc.Collider2DComponent=Z,pc.CapsuleCollider2DComponent=class extends Z{constructor(t){(t=t||{}).type="capsuleCollider2D",super(t),this._offset=(new o.l).copy(t.center||o.l.ZERO),this._size=(new o.l).copy(t.size||new o.l(.5,1)),this._size.x=(0,o.o)(this._size.x,r.f,r.d),this._size.y=(0,o.o)(this._size.y,r.f,r.d),this._direction=t.direction||UnityEngine.CapsuleDirection2D.Vertical,this["__UnityEngine.CapsuleCollider2D"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"CapsuleCollider2DComponent")}_initializeCode(){this._code=new UnityEngine.CapsuleCollider2D(this),this["__UnityEngine.CapsuleCollider2D"]=this._code,super._initializeCode()}getSize(){return this._size.clone()}setSize(t){this._size.equals(t)||(this._size=t,this.rebuildFixturesIfNecessary())}getDirection(){return this._direction}setDirection(t){this._direction=t,this.rebuildFixturesIfNecessary()}generateShapes(){const t=this._size.clone().scale(.5),e=this._relativeTransform.multiplyPoint(new o.m(-t.x+this._offset.x,this._offset.y,0)),i=this._relativeTransform.multiplyPoint(new o.m(t.x+this._offset.x,this._offset.y,0)),n=this._relativeTransform.multiplyPoint(new o.m(this._offset.x,-t.y+this._offset.y,0)),s=this._relativeTransform.multiplyPoint(new o.m(this._offset.x,t.y+this._offset.y,0)),a=new et.b2Vec2(e.x,e.y),l=new et.b2Vec2(i.x,i.y),c=new et.b2Vec2(n.x,n.y),h=new et.b2Vec2(s.x,s.y),d=new et.b2Vec2(l.x-a.x,l.y-a.y),u=new et.b2Vec2(h.x-c.x,h.y-c.y),y=d.Normalize(),_=u.Normalize(),p=Math.abs(y-_)<=.005?.005:0,g=new et.b2CapsuleShape;if(this._direction===UnityEngine.CapsuleDirection2D.Vertical){const t=.5*y,e=.5*((_>y?y:_-r.f)+p),i=new et.b2Vec2(e*u.x,e*u.y),n=new et.b2Vec2(c.x+i.x,c.y+i.y),o=new et.b2Vec2(h.x-i.x,h.y-i.y);g.SetByEndCaps(t,n,o),et.destroy(i),et.destroy(n),et.destroy(o)}else{const t=.5*_,e=.5*((y>_?_:y-r.f)+p),i=new et.b2Vec2(e*d.x,e*d.y),n=new et.b2Vec2(a.x+i.x,a.y+i.y),o=new et.b2Vec2(l.x-i.x,l.y-i.y);g.SetByEndCaps(t,n,o),et.destroy(i),et.destroy(n),et.destroy(o)}return et.destroy(a),et.destroy(l),et.destroy(c),et.destroy(h),et.destroy(d),et.destroy(u),[g]}},pc.CircleCollider2DComponent=class extends Z{constructor(t){(t=t||{}).type="circleCollider2D",super(t),this._offset=(new o.l).copy(t.center||o.l.ZERO),this._radius=(0,o.o)(t.radius||.5,1e-4,1e6),this["__UnityEngine.CircleCollider2D"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"CircleCollider2DComponent")}_initializeCode(){this._code=new UnityEngine.CircleCollider2D(this),this["__UnityEngine.CircleCollider2D"]=this._code,super._initializeCode()}getRadius(){return this._radius}setRadius(t){this._radius!==t&&(this._radius=t,this.rebuildFixturesIfNecessary())}generateShapes(){nt.set(this._offset.x,this._offset.y,0),this._relativeTransform.transformPoint(nt,nt);const t=this.entity.getLossyScale(),e=(0,o.o)(Math.max(r.f,Math.max(Math.abs(t.x),Math.abs(t.y))*this._radius),r.f,r.d),i=new it.b2CircleShape;return i.m_p.Set(nt.x,nt.y),i.m_radius=e,[i]}},pc.BoxCollider2DComponent=rt,pc.EdgeCollider2DComponent=class extends Z{constructor(t){(t=t||{}).type="edgeCollider2D",super(t),this._radius=(0,o.o)(t.radius||0,0,r.d),this._useAdjacentStartPoint=t.useAdjacentStartPoint||!1,this._useAdjacentEndPoint=t.useAdjacentEndPoint||!1,this._adjacentStartPoint=t.adjacentStartPoint||new o.l,this._adjacentEndPoint=t.adjacentEndPoint||new o.l,this._points=[];const e=t.points||[];for(let t=0,i=0;tt.clone()))}setPoints(t=[]){this._points=t,this.rebuildFixturesIfNecessary()}getPointCount(){return this._points.length}generateShapes(){const t=[];for(let e=0;er.d*r.d)return null;const a=new o.l(s.x,s.y),l=10*r.b;Math.abs(a.x)0&&i[i.length-1].clone().sub(a).lengthSq()<=e||i.push(a)}return i}generateShapes(){let t=0;const e=new $.b2PolygonColliderBuilder;for(let i=0;inew $.b2Vec2(t.x,t.y))),[s,r]=$.pointsToVec2Array(o);e.AddContour(s,o.length),r()}if(0===t)return this._errorFlag=!0,$.destroy(e),[];e.Tesselate();const i=e.GetShapesCount(),n=[];for(let t=0;t=this._paths.length||t<0)throw new System.ArgumentOutOfRangeException.ctor;return this._paths[t].map((t=>t.clone()))}setPoints(t){t&&0!==t.length&&this.setPath(0,t)}setPath(t,e){if(!e)throw new System.ArgumentNullException;if(t>0&&t>=this._paths.length||t<0)throw new System.ArgumentOutOfRangeException.ctor;this._paths[t]=e,this.rebuildFixtures()}getPathCount(){return this._paths.length}setPathCount(t){if(this._paths.length!==t){t<0&&(t=0),this._paths.length=t;for(let t=0;tMath.PI&&p(a,this._bodyAngleA-t,r.g)?this._referenceAngle+=t:this._bodyAngleA<-Math.PI&&p(a,this._bodyAngleA+t,r.g)&&(this._referenceAngle-=t),this._bodyAngleB>Math.PI&&p(l,this._bodyAngleB-t,r.g)?this._referenceAngle-=t:this._bodyAngleA<-Math.PI&&p(l,this._bodyAngleB+t,r.g)&&(this._referenceAngle+=t),i.referenceAngle=this._referenceAngle}else i.referenceAngle=l-a;const c=F.instance.world.CreateJoint(i);return Ct.destroy(i),c}destroyJoint(t=!1){this._hasPreviousState=!1,!t&&this._joint&&(this._referenceAngle=this.joint.GetReferenceAngle(),this._bodyAngleA=this.joint.GetBodyA().GetAngle(),this._bodyAngleB=this.joint.GetBodyB().GetAngle(),this._hasPreviousState=!0),super.destroyJoint(t)}getUseLimits(){return this._useLimits}setUseLimits(t){t=!!t,this._useLimits!==t&&(this._useLimits=t,this._joint&&this._joint.EnableLimit(t))}getLimits(){if(this._limits)return this._limits.$clone();const t=new UnityEngine.JointAngleLimits2D;return t.max=359,t}setLimits(t){if((!this._limits||this._limits.min!==t.min||this._limits.max!==t.max)&&(this._limits=t,this._joint)){const e=t.min*o.e,i=t.max*o.e;this._joint.SetLimits(Math.min(e,i),Math.max(e,i))}}getUseMotor(){return this._useMotor}setUseMotor(t){t=!!t,this._useMotor!==t&&(this._useMotor=t,this._joint&&this._joint.EnableMotor(t))}getMotor(){if(this._motor)return this._motor.$clone();const t=new UnityEngine.JointMotor2D;return t.maxMotorTorque=r.d,t}setMotor(t){if(this.setUseMotor(!0),this._motor&&this._motor.motorSpeed===t.motorSpeed&&this._motor.maxMotorTorque===t.maxMotorTorque)return;this._motor=t;const e=this._joint;e&&(e.SetMotorSpeed(t.motorSpeed*o.e),e.SetMaxMotorTorque(t.maxMotorTorque))}getJointAngle(){return this._joint?this._joint.GetJointAngle()*o.k:0}},pc.RelativeJoint2DComponent=class extends ut{constructor(t){super(t=Object.assign({autoConfigureOffset:!0,linearOffset:new o.l,angularOffset:0,maxForce:r.c,maxTorque:r.c,correctionScale:.3},t)),this._type="relativeJoint2D",this._autoConfigureOffset=!!t.autoConfigureOffset,this._linearOffset=t.linearOffset,this._angularOffset=t.angularOffset,this._maxForce=t.maxForce,this._maxTorque=t.maxTorque,this._correctionScale=t.correctionScale,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"RelativeJoint2DComponent")}_initializeCode(){this._code=new UnityEngine.RelativeJoint2D(this),this["__UnityEngine.RelativeJoint2D"]=this._code,super._initializeCode()}get class(){return gt.b2MotorJoint}_createJoint(t,e){const i=new gt.b2MotorJointDef;if(i.maxForce=this._maxForce,i.maxTorque=this._maxTorque,i.correctionFactor=this._correctionScale,this._autoConfigureOffset){const i=t.body.GetLocalPoint(e.body.GetPosition());this._linearOffset.set(i.x,i.y),this._angularOffset=e.body.GetAngle()-t.body.GetAngle()}i.linearOffset.Set(this._linearOffset.x,this._linearOffset.y),i.angularOffset=this._angularOffset*o.e,i.bodyA=t.body,i.bodyB=e.body,i.collideConnected=this._enableCollision;const n=F.instance.world.CreateJoint(i);return gt.destroy(i),n}getAngularOffset(){return null===this.joint?this._angularOffset:this._joint.GetAngularOffset()*o.k}setAngularOffset(t){this._angularOffset!==t&&(this._angularOffset=t,this._joint&&this._joint.SetAngularOffset(t*o.e))}getLinearOffset(){if(null===this.joint)return this._linearOffset;const t=this._joint.GetLinearOffset();return new o.l(t.x,t.y)}setLinearOffset(t){if(!this._linearOffset.equals(t)&&(this._linearOffset.set(t.x,t.y),this._joint)){const t=new gt.b2Vec2(this._linearOffset.x,this._linearOffset.y);this._joint.SetLinearOffset(t),gt.destroy(t)}}getAutoConfigureOffset(){return this._autoConfigureOffset}setAutoConfigureOffset(t){this._autoConfigureOffset=!!t}getCorrectionScale(){return this._correctionScale}setCorrectionScale(t){this._correctionScale!==t&&(this._correctionScale=(0,o.o)(t,0,1),this._joint&&this._joint.SetCorrectionFactor(this._correctionScale))}getMaxForce(){return this._maxForce}setMaxForce(t){this._maxForce!==t&&(this._maxForce=(0,o.o)(t,0,r.c),this._joint&&this._joint.SetMaxForce(this._maxForce))}getMaxTorque(){return this._maxTorque}setMaxTorque(t){this._maxTorque!==t&&(this._maxTorque=(0,o.o)(t,0,r.c),this._joint&&this._joint.SetMaxTorque(this._maxTorque))}getTarget(){if(!this._joint)return o.l.ZERO.clone();const t=this._joint,e=this._joint.GetBodyB(),i=e.GetAngle()-t.GetAngularOffset(),n=Math.sin(i),s=Math.cos(i),r=t.GetLinearOffset(),a=s*-r.x-n*-r.y,l=n*-r.x+s*-r.y,c=e.GetPosition();return new o.l(c.x+a,c.y+l)}},pc.SliderJoint2DComponent=class extends _t{constructor(t){super(t=Object.assign({autoConfigureAngle:!0,useMotor:!1,useLimits:!1,motor:null,limits:null,angle:0,autoConfigureConnectedAnchor:!1},t)),this._type="sliderJoint2D",this._autoConfigureAngle=!!t.autoConfigureAngle,this._angle=t.angle,this._useMotor=!!t.useMotor,this._motor=t.motor,this._useLimits=!!t.useLimits,this._limits=t.limits,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"SliderJoint2DComponent")}_initializeCode(){this._code=new UnityEngine.SliderJoint2D(this),this["__UnityEngine.SliderJoint2D"]=this._code,super._initializeCode()}get class(){return pt.b2PrismaticJoint}_createJoint(t,e){const i=new pt.b2PrismaticJointDef;if(i.enableMotor=this._useMotor,i.enableLimit=this._useLimits,i.motorSpeed=this._motor?this._motor.motorSpeed:0,i.maxMotorForce=this._motor?this._motor.maxMotorTorque:r.d,i.lowerTranslation=Math.min(this._limits.min,this._limits.max),i.upperTranslation=Math.max(this._limits.min,this._limits.max),i.referenceAngle=e.body.GetAngle()-t.body.GetAngle(),this.configureAnchors(i.localAnchorA,i.localAnchorB,t,e),this._autoConfigureAngle){const n=t.body.GetWorldPoint(i.localAnchorA),s=n.x,a=n.y,l=e.body.GetWorldPoint(i.localAnchorB),c=l.x-s,h=l.y-a;this._angle=(0,o.o)(Math.atan2(h,c)*o.k,-r.d,r.d)}const n=this._angle*o.e;i.localAxisA.Set(Math.cos(n),Math.sin(n)),i.bodyA=t.body,i.bodyB=e.body,i.collideConnected=this._enableCollision;const s=F.instance.world.CreateJoint(i);return pt.destroy(i),s}getAngle(){return this._angle*o.k}setAngle(t){this._angle!==t&&(this._angle=t,this.recreateJoint(!0))}getReferenceAngle(){return this._joint?this._joint.GetReferenceAngle()*o.k:0}getAutoConfigureAngle(){return this._autoConfigureAngle}setAutoConfigureAngle(t){this._autoConfigureAngle=!!t}getUseMotor(){return this._useMotor}setUseMotor(t){t=!!t,this._useMotor!==t&&(this._useMotor=t,this._joint&&this._joint.EnableMotor(t))}getMotor(){if(this._motor)return this._motor.$clone();const t=new UnityEngine.JointMotor2D;return t.maxMotorTorque=r.c,t}setMotor(t){if(this.setUseMotor(!0),this._motor&&this._motor.motorSpeed===t.motorSpeed&&this._motor.maxMotorTorque===t.maxMotorTorque)return;this._motor=t;const e=this._joint;e&&(e.SetMotorSpeed(t.motorSpeed),e.SetMaxMotorForce(t.maxMotorTorque))}getUseLimits(){return this._useLimits}setUseLimits(t){t=!!t,this._useLimits!==t&&(this._useLimits=t,this._joint&&this._joint.EnableLimit(t))}getLimits(){return this._limits?this._limits.$clone():new UnityEngine.JointTranslationLimits2D}setLimits(t){this.setUseLimits(!0),this._limits&&this._limits.min===t.min&&this._limits.max===t.max||(this._limits=t,this._joint&&this._joint.SetLimits(t.min,t.max))}getLimitState(){if(!this._joint)return UnityEngine.JointLimitState2D.Inactive;switch(this._joint.GetLimitState()){case 0:default:return UnityEngine.JointLimitState2D.Inactive;case 1:return UnityEngine.JointLimitState2D.LowerLimit;case 2:return UnityEngine.JointLimitState2D.UpperLimit;case 3:return UnityEngine.JointLimitState2D.EqualLimits}}getJointTranslation(){return this._joint?this._joint.GetJointTranslation():0}getJointSpeed(){return this._joint?this._joint.GetJointSpeed()*o.k:0}getMotorForce(t){return this._joint&&t>0?this._joint.GetMotorForce(1/t):0}},pc.SpringJoint2DComponent=class extends _t{constructor(t){super(t=Object.assign({autoConfigureConnectedAnchor:!1,autoConfigureDistance:!0,distance:1,dampingRatio:0,frequency:1},t)),this._type="springJoint2D",this._frequency=t.frequency,this._dampingRatio=t.dampingRatio,this._distance=t.distance,this._autoConfigureDistance=!!t.autoConfigureDistance,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"SpringJoint2DComponent")}_initializeCode(){this._code=new UnityEngine.SpringJoint2D(this),this["__UnityEngine.SpringJoint2D"]=this._code,super._initializeCode()}get class(){return St.b2DistanceJoint}_createJoint(t,e){const i=new St.b2DistanceJointDef;this.configureAnchors(i.localAnchorA,i.localAnchorB,t,e),this._autoConfigureDistance&&(this._distance=(0,o.o)(this.configureDistance(i.localAnchorA,i.localAnchorB,t,e),.005,r.d)),i.dampingRatio=this._dampingRatio,i.frequencyHz=this._frequency,i.length=this._distance,i.bodyA=t.body,i.bodyB=e.body,i.collideConnected=this._enableCollision;const n=F.instance.world.CreateJoint(i);return St.destroy(i),n}getDistance(){return this._distance}setDistance(t){this._distance=t,this._joint&&this._joint.SetLength(t)}getFrequency(){return this._frequency}setFrequency(t){this._frequency=t,this._joint&&this._joint.SetFrequency(t)}getDampingRatio(){return this._dampingRatio}setDampingRatio(t){this._dampingRatio=t,this._joint&&this._joint.SetDampingRatio(t)}},pc.TargetJoint2DComponent=class extends ut{constructor(t){super(t=Object.assign({autoConfigureTarget:!0,target:new o.l,anchor:new o.l,maxForce:r.c,dampingRatio:1,frequency:5},t||{})),this._autoConfigureTarget=!!t.autoConfigureTarget,this._target=t.target,this._anchor=t.anchor,this._maxForce=t.maxForce,this._dampingRatio=t.dampingRatio,this._frequency=t.frequency,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"TargetJoint2DComponent")}get class(){return yt.b2MouseJoint}_initializeCode(){this._code=new UnityEngine.TargetJoint2D(this),this["__UnityEngine.TargetJoint2D"]=this._code,super._initializeCode()}_createJoint(t,e){const i=new yt.b2MouseJointDef;i.bodyA=F.instance.groundBody.body,i.bodyB=t.body,i.collideConnected=!0,i.maxForce=this._maxForce,i.dampingRatio=this._dampingRatio,i.frequencyHz=this._frequency;const n=this.entity.getLossyScale();if(i.localAnchor.Set(this._anchor.x*n.x,this._anchor.y*n.y),this._autoConfigureTarget){const t=this.entity.getPosition();this._target.set(t.x,t.y)}i.target.Set(this._target.x,this._target.y);const o=F.instance.world.CreateJoint(i);return yt.destroy(i),o}setConnectedBody(t){}getAutoConfigureTarget(){return this._autoConfigureTarget}setAutoConfigureTarget(t){this._autoConfigureTarget=!!t}getTarget(){return this._target.clone()}setTarget(t){if(!this._target.equals(t)&&(this._target.copy(t),this._joint)){const t=new yt.b2Vec2(this._target.x,this._target.y);this.joint.SetTarget(t),yt.destroy(t)}}getAnchor(){return this._anchor.clone()}setAnchor(t){this._anchor.equals(t)||(this._anchor=t,this._joint&&this.recreateJoint())}getMaxForce(){return this._maxForce}setMaxForce(t){this._maxForce!==t&&(this._maxForce=(0,o.o)(t,0,r.d),this._joint&&this.joint.SetMaxForce(this._maxForce))}getFrequency(){return this._frequency}setFrequency(t){this._frequency!==t&&(this._frequency=(0,o.o)(t,0,r.d),this._joint&&this.joint.SetFrequency(this._frequency))}getDampingRatio(){return this._dampingRatio}setDampingRatio(t){this._dampingRatio!==t&&(this._dampingRatio=(0,o.o)(t,0,1),this._joint&&this.joint.SetDampingRatio(this._dampingRatio))}},pc.WheelJoint2DComponent=class extends _t{constructor(t){super(t=Object.assign({suspension:null,motor:null,useMotor:!1},t)),this._type="wheelJoint2D",this._suspension=t.suspension,this._motor=t.motor,this._useMotor=!!t.useMotor,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"WheelJoint2DComponent")}_initializeCode(){this._code=new UnityEngine.WheelJoint2D(this),this["__UnityEngine.WheelJoint2D"]=this._code,super._initializeCode()}get class(){return ft.b2WheelJoint}_createJoint(t,e){if(e===F.instance._groundBody||!e.enabled||!e.entity.enabled)return null;const i=new ft.b2WheelJointDef;i.enableMotor=this._useMotor,i.motorSpeed=this._motor?this._motor.motorSpeed*o.e:0,i.maxMotorTorque=this._motor?this._motor.maxMotorTorque:r.d,i.frequencyHz=this._suspension?this._suspension.frequency:2,i.dampingRatio=this._suspension?this._suspension.dampingRatio:.7;const n=(this._suspension?this._suspension.angle:90)*o.e;i.localAxisA.Set(Math.cos(n),Math.sin(n));const s=t.entity.getLossyScale(),a=e.entity.getLossyScale();i.localAnchorA.Set(this._anchor.x*s.x,this._anchor.y*s.y),i.localAnchorB.Set(this._connectedAnchor.x*a.x,this._connectedAnchor.y*a.y),i.bodyA=t.body,i.bodyB=e.body,i.collideConnected=this._enableCollision;const l=F.instance.world.CreateJoint(i);return ft.destroy(i),l}getSuspension(){if(this._suspension)return this._suspension.$clone();const t=new UnityEngine.JointSuspension2D;return t.dampingRatio=.7,t.frequency=2,t.angle=90,t}setSuspension(t){this._suspension&&this._suspension.dampingRatio===t.dampingRatio&&this._suspension.frequency===t.frequency&&this._suspension.angle===t.angle||(this._suspension=t,this._joint&&this.recreateJoint())}getUseMotor(){return this._useMotor}setUseMotor(t){t=!!t,this._useMotor!==t&&(this._useMotor=t,this._joint&&this._joint.EnableMotor(t))}getMotor(){if(this._motor)return this._motor.$clone();const t=new UnityEngine.JointMotor2D;return t.maxMotorTorque=r.d,t}setMotor(t){if(this.setUseMotor(!0),this._motor&&this._motor.motorSpeed===t.motorSpeed&&this._motor.maxMotorTorque===t.maxMotorTorque)return;this._motor=t;const e=this._joint;e&&(e.SetMotorSpeed(t.motorSpeed*o.e),e.SetMaxMotorTorque(t.maxMotorTorque))}getMotorTorque(t){return this._joint&&t>0?this._joint.GetMotorTorque(1/t):0}getJointAngle(){return this._joint?this._joint.GetJointAngle()*o.k:0}getJointSpeed(){return this._joint?this._joint.GetJointAngularSpeed()*o.k:0}getJointTranslation(){return this._joint?this._joint.GetJointTranslation():0}getJointLinearSpeed(){return this._joint?this._joint.GetJointLinearSpeed():0}},pc.Joint2DSystem=Dt,pc.Effector2DComponent=x,pc.PlatformEffector2DComponent=class extends x{_initializeCode(){this._code=new UnityEngine.PlatformEffector2D(this),this["__UnityEngine.PlatformEffector2D"]=this._code,super._initializeCode()}},pc.Effector2DSystem=At,pc.Physics2DSystem=R,pc.markPhysics2dModuleAsUsed=()=>{TRACE&&window.traceResults.markModuleAsUsed(window.traceResults.EngineModules.Physics2d)}}},t=>{t.O(0,[1],(()=>{return e=56,t(t.s=e);var e}));t.O()}]);