"use strict";var b=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var n in e)b(t,n,{get:e[n],enumerable:!0})},x=(t,e,n,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of l(e))!m.call(t,c)&&c!==n&&b(t,c,{get:()=>e[c],enumerable:!(u=h(e,c))||u.enumerable});return t};var y=t=>x(b({},"__esModule",{value:!0}),t);var a={};p(a,{rect:()=>o,vec:()=>r});module.exports=y(a);var s=class t{constructor(e,n){this.x=e;this.y=n}get yx(){return new t(this.y,this.x)}setX(e){return new t(e,this.y)}setY(e){return new t(this.x,e)}map(e){let n=e(this.x,this.y);if(n.length!==2)throw new Error(`The function must return an array of length 2, but got length ${n.length}`);return new t(...n)}reduce(e){return e(this.x,this.y)}add(e,n){let u=e instanceof t?e:r(e,n);return new t(this.x+u.x,this.y+u.y)}sub(e,n){let u=e instanceof t?e:r(e,n);return new t(this.x-u.x,this.y-u.y)}div(e,n){let u=e instanceof t?e:r(e,n);return new t(this.x/u.x,this.y/u.y)}dot(e,n){let u=e instanceof t?e:r(e,n);return this.x*u.x+this.y*u.y}cross(e,n){let u=e instanceof t?e:r(e,n);return this.x*u.y-u.x*this.y}mul(e,n){let u=e instanceof t?e:r(e,n);return new t(this.x*u.x,this.y*u.y)}len(){return Math.sqrt(this.x**2+this.y**2)}norm(){let e=this.len();return new t(this.x/e,this.y/e)}rotRad(e){let n=Math.cos(e),u=Math.sin(e);return new t(this.x*n-this.y*u,this.x*u+this.y*n)}rotDeg(e){return this.rotRad(e*Math.PI/180)}angleTo(e){return Math.acos(this.dot(e)/(this.len()*e.len()))}lookAt(e,n="x"){let u=e.sub(this),c=Math.atan2(u.y,u.x);switch(n){case"x":return c;case"y":return c+Math.PI/2;case"-x":return c+Math.PI;case"-y":return c+Math.PI*3/2}}asArray(){return[this.x,this.y]}isInRect(e,n){let u=e instanceof i?e:e instanceof t?o(e,n):o(e);return u.o.x<=this.x&&u.o.x+u.d.x>=this.x&&u.o.y<=this.y&&u.o.y+u.d.y>=this.y}equals(e,n){let u=e instanceof t?e:r(e,n);return this.x===u.x&&this.y===u.y}};function r(t,e){return Array.isArray(t)?new s(t[0],t[1]):typeof t=="number"?new s(t,e??t):new s(t.x,t.y)}var i=class t{constructor(e,n){this.o=e;this.d=n}setO(e){return new t(e,this.d)}setD(e){return new t(this.o,e)}map(e){let n=e(this.o,this.d);if(n.length!==2)throw new Error(`The function must return an array of length 2, but got length ${n.length}`);return new t(...n)}get as(){return{styleObject:()=>({left:`${this.o.x}px`,top:`${this.o.y}px`,width:`${this.d.x}px`,height:`${this.d.y}px`}),cssText(){return Object.entries(this.styleObject).map(([e,n])=>`${e}: ${n};`).join(" ")}}}equals(e){return e.o.equals(this.o)&&e.d.equals(this.d)}};function o(t,e){return t instanceof s?new i(t,e):new i(r(t.x,t.y),r(t.width,t.height))}0&&(module.exports={rect,vec}); //# sourceMappingURL=main.cjs.map