define(["exports","./Check-2514d21d","./when-d186add7","./Math-7f5f2992"],(function(e,t,n,r){"use strict";function o(e,t){this.x=n.u(e,0),this.y=n.u(t,0)}o.fromElements=function(e,t,r){return n.e(r)?(r.x=e,r.y=t,r):new o(e,t)},o.clone=function(e,t){if(n.e(e))return n.e(t)?(t.x=e.x,t.y=e.y,t):new o(e.x,e.y)},o.fromCartesian3=o.clone,o.fromCartesian4=o.clone,o.packedLength=2,o.pack=function(e,r,o){return t.o.typeOf.object("value",e),t.o.defined("array",r),o=n.u(o,0),r[o++]=e.x,r[o]=e.y,r},o.unpack=function(e,r,a){return t.o.defined("array",e),r=n.u(r,0),n.e(a)||(a=new o),a.x=e[r++],a.y=e[r],a},o.packArray=function(e,r){t.o.defined("array",e);var a=e.length,u=2*a;if(n.e(r)){if(!Array.isArray(r)&&r.length!==u)throw new t.t("If result is a typed array, it must have exactly array.length * 2 elements");r.length!==u&&(r.length=u)}else r=new Array(u);for(var y=0;y<a;++y)o.pack(e[y],r,2*y);return r},o.unpackArray=function(e,r){if(t.o.defined("array",e),t.o.typeOf.number.greaterThanOrEquals("array.length",e.length,2),e.length%2!=0)throw new t.t("array length must be a multiple of 2.");var a=e.length;n.e(r)?r.length=a/2:r=new Array(a/2);for(var u=0;u<a;u+=2){var y=u/2;r[y]=o.unpack(e,u,r[y])}return r},o.fromArray=o.unpack,o.maximumComponent=function(e){return t.o.typeOf.object("cartesian",e),Math.max(e.x,e.y)},o.minimumComponent=function(e){return t.o.typeOf.object("cartesian",e),Math.min(e.x,e.y)},o.minimumByComponent=function(e,n,r){return t.o.typeOf.object("first",e),t.o.typeOf.object("second",n),t.o.typeOf.object("result",r),r.x=Math.min(e.x,n.x),r.y=Math.min(e.y,n.y),r},o.maximumByComponent=function(e,n,r){return t.o.typeOf.object("first",e),t.o.typeOf.object("second",n),t.o.typeOf.object("result",r),r.x=Math.max(e.x,n.x),r.y=Math.max(e.y,n.y),r},o.magnitudeSquared=function(e){return t.o.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y},o.magnitude=function(e){return Math.sqrt(o.magnitudeSquared(e))};var a=new o;o.distance=function(e,n){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),o.subtract(e,n,a),o.magnitude(a)},o.distanceSquared=function(e,n){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),o.subtract(e,n,a),o.magnitudeSquared(a)},o.normalize=function(e,n){t.o.typeOf.object("cartesian",e),t.o.typeOf.object("result",n);var r=o.magnitude(e);if(n.x=e.x/r,n.y=e.y/r,isNaN(n.x)||isNaN(n.y))throw new t.t("normalized result is not a number");return n},o.dot=function(e,n){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),e.x*n.x+e.y*n.y},o.multiplyComponents=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=e.x*n.x,r.y=e.y*n.y,r},o.divideComponents=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=e.x/n.x,r.y=e.y/n.y,r},o.add=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=e.x+n.x,r.y=e.y+n.y,r},o.subtract=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=e.x-n.x,r.y=e.y-n.y,r},o.multiplyByScalar=function(e,n,r){return t.o.typeOf.object("cartesian",e),t.o.typeOf.number("scalar",n),t.o.typeOf.object("result",r),r.x=e.x*n,r.y=e.y*n,r},o.divideByScalar=function(e,n,r){return t.o.typeOf.object("cartesian",e),t.o.typeOf.number("scalar",n),t.o.typeOf.object("result",r),r.x=e.x/n,r.y=e.y/n,r},o.negate=function(e,n){return t.o.typeOf.object("cartesian",e),t.o.typeOf.object("result",n),n.x=-e.x,n.y=-e.y,n},o.abs=function(e,n){return t.o.typeOf.object("cartesian",e),t.o.typeOf.object("result",n),n.x=Math.abs(e.x),n.y=Math.abs(e.y),n};var u=new o;o.lerp=function(e,n,r,a){return t.o.typeOf.object("start",e),t.o.typeOf.object("end",n),t.o.typeOf.number("t",r),t.o.typeOf.object("result",a),o.multiplyByScalar(n,r,u),a=o.multiplyByScalar(e,1-r,a),o.add(u,a,a)};var y=new o,c=new o;o.angleBetween=function(e,n){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),o.normalize(e,y),o.normalize(n,c),r.e.acosClamped(o.dot(y,c))};var i=new o;o.mostOrthogonalAxis=function(e,n){t.o.typeOf.object("cartesian",e),t.o.typeOf.object("result",n);var r=o.normalize(e,i);return o.abs(r,r),n=r.x<=r.y?o.clone(o.UNIT_X,n):o.clone(o.UNIT_Y,n)},o.equals=function(e,t){return e===t||n.e(e)&&n.e(t)&&e.x===t.x&&e.y===t.y},o.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},o.equalsEpsilon=function(e,t,o,a){return e===t||n.e(e)&&n.e(t)&&r.e.equalsEpsilon(e.x,t.x,o,a)&&r.e.equalsEpsilon(e.y,t.y,o,a)},o.ZERO=Object.freeze(new o(0,0)),o.UNIT_X=Object.freeze(new o(1,0)),o.UNIT_Y=Object.freeze(new o(0,1)),o.prototype.clone=function(e){return o.clone(this,e)},o.prototype.equals=function(e){return o.equals(this,e)},o.prototype.equalsEpsilon=function(e,t,n){return o.equalsEpsilon(this,e,t,n)},o.prototype.toString=function(){return"("+this.x+", "+this.y+")"},e.o=o}));
