Mid-Simulator/node_modules/kaboom/dist/kaboom.mjs.map

8 lines
228 KiB
Text
Raw Normal View History

2022-04-18 01:14:39 +00:00
{
"version": 3,
"sources": ["../src/utils.ts", "../src/math.ts", "../src/fps.ts", "../src/timer.ts", "../src/kaboom.ts"],
"sourcesContent": ["export class IDList<T> extends Map<number, T> {\n\t_lastID: number;\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t\tthis._lastID = 0;\n\t}\n\tpush(v: T): number {\n\t\tconst id = this._lastID;\n\t\tthis.set(id, v);\n\t\tthis._lastID++;\n\t\treturn id;\n\t}\n\tpushd(v: T): () => void {\n\t\tconst id = this.push(v);\n\t\treturn () => this.delete(id);\n\t}\n}\n\nexport function deepEq(o1: any, o2: any): boolean {\n\tconst t1 = typeof o1;\n\tconst t2 = typeof o2;\n\tif (t1 !== t2) {\n\t\treturn false;\n\t}\n\tif (t1 === \"object\" && t2 === \"object\") {\n\t\tconst k1 = Object.keys(o1);\n\t\tconst k2 = Object.keys(o2);\n\t\tif (k1.length !== k2.length) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (const k of k1) {\n\t\t\tconst v1 = o1[k];\n\t\t\tconst v2 = o2[k];\n\t\t\tif (!(typeof v1 === \"function\" && typeof v2 === \"function\")) {\n\t\t\t\tif (!deepEq(v1, v2)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\treturn o1 === o2;\n}\n\nexport function downloadURL(url: string, filename: string) {\n\tconst a = document.createElement(\"a\");\n\tdocument.body.appendChild(a);\n\ta.setAttribute(\"style\", \"display: none\");\n\ta.href = url;\n\ta.download = filename;\n\ta.click();\n\tdocument.body.removeChild(a);\n}\n\nexport function downloadBlob(blob: Blob, filename: string) {\n\tconst url = URL.createObjectURL(blob);\n\tdownloadURL(url, filename);\n\tURL.revokeObjectURL(url);\n}\n\nexport function isDataURL(str: string) {\n\treturn str.match(/^data:\\w+\\/\\w+;base64,.+/);\n}\n\nexport const uid = (() => {\n\tlet id = 0;\n\treturn () => id++;\n})();\n\nconst warned = new Set();\n\nexport function deprecateMsg(oldName: string, newName: string) {\n\tif (!warned.has(oldName)) {\n\t\twarned.add(oldName);\n\t\tconsole.warn(`${oldName} is deprecated. Use ${newName} instead.`);\n\t}\n}\n\nexport const deprecate = (oldName: string, newName: string, newFunc: (...args) => any) => (...args) => {\n\tdeprecateMsg(oldName, newName);\n\treturn newFunc(...args);\n};\n", "import {\n\tVec4,\n\tPoint,\n\tPolygon,\n\tArea,\n} from \"./types\";\n\nimport {\n\tdeprecateMsg,\n} from \"./utils\";\n\nexport function deg2rad(deg: number): number {\n\treturn deg * Math.PI / 180;\n}\n\nexport function rad2deg(rad: number): number {\n\treturn rad * 180 / Math.PI;\n}\n\nexport function clamp(\n\tval: number,\n\tmin: number,\n\tmax: number,\n): number {\n\tif (min > max) {\n\t\treturn clamp(val, max, min);\n\t}\n\treturn Math.min(Math.max(val, min), max);\n}\n\nexport function lerp(\n\ta: number,\n\tb: number,\n\tt: number,\n): number {\n\treturn a + (b - a) * t;\n}\n\nexport function map(\n\tv: number,\n\tl1: number,\n\th1: number,\n\tl2: number,\n\th2: number,\n): number {\n\treturn l2 + (v - l1) / (h1 - l1) * (h2 - l2);\n}\n\nexport function mapc(\n\tv: number,\n\tl1: number,\n\th1: number,\n\tl2: number,\n\th2: number,\n): number {\n\treturn clamp(map(v, l1, h1, l2, h2), l2, h2);\n}\n\nexport class Vec2 {\n\tx: number = 0;\n\ty: number = 0;\n\tconstructor(x: number = 0, y: number = x) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t}\n\tstatic fromAngle(deg: number) {\n\t\tconst angle = deg2rad(deg);\n\t\treturn new Vec2(Math.cos(angle), Math.sin(angle));\n\t}\n\tstatic LEFT = new Vec2(-1, 0);\n\tstatic RIGHT = new Vec2(1, 0);\n\tstatic UP = new Vec2(0, -1);\n\tstatic DOWN = new Vec2(0, 1);\n\tclone(): Vec2 {\n\t\treturn new Vec2(this.x, this.y);\n\t}\n\tadd(...args): Vec2 {\n\t\tconst p2 = vec2(...args);\n\t\treturn new Vec2(this.x + p2.x, this.y + p2.y);\n\t}\n\tsub(...args): Vec2 {\n\t\tconst p2 = vec2(...args);\n\t\treturn new Vec2(this.x - p2.x, this.y - p2.y);\n\t}\n\tscale(...args): Vec2 {\n\t\tconst s = vec2(...args);\n\t\treturn new Vec2(this.x * s.x, this.y * s.y);\n\t}\n\tdist(...args): number {\n\t\tconst p2 = vec2(...args);\n\t\treturn Math.sqrt(\n\t\t\t(this.x - p2.x) * (this.x - p2.x)\n\t\t\t+ (this.y - p2.y) * (this.y - p2.y)\n\t\t);\n\t}\n\tlen(): number {\n\t\treturn this.dist(new Vec2(0, 0));\n\t}\n\tunit(): Vec2 {\n\t\treturn this.scale(1 / this.len());\n\t}\n\tnormal(): Vec2 {\n\t\treturn n
"mappings": "wlCAAO,mBAAwB,IAAe,CAE7C,eAAe,EAAM,CACpB,MAAM,GAAG,GAFV,kBAGC,KAAK,QAAU,EAEhB,KAAK,EAAc,CAClB,GAAM,GAAK,KAAK,QAChB,YAAK,IAAI,EAAI,GACb,KAAK,UACE,EAER,MAAM,EAAkB,CACvB,GAAM,GAAK,KAAK,KAAK,GACrB,MAAO,IAAM,KAAK,OAAO,KAdpB,cAkBA,YAAgB,EAAS,EAAkB,CACjD,GAAM,GAAK,MAAO,GACZ,EAAK,MAAO,GAClB,GAAI,IAAO,EACV,MAAO,GAER,GAAI,IAAO,UAAY,IAAO,SAAU,CACvC,GAAM,GAAK,OAAO,KAAK,GACjB,EAAK,OAAO,KAAK,GACvB,GAAI,EAAG,SAAW,EAAG,OACpB,MAAO,GAER,OAAW,KAAK,GAAI,CACnB,GAAM,GAAK,EAAG,GACR,EAAK,EAAG,GACd,GAAI,CAAE,OAAO,IAAO,YAAc,MAAO,IAAO,aAC3C,CAAC,GAAO,EAAI,GACf,MAAO,GAIV,MAAO,GAER,MAAO,KAAO,EAvBC,eA0BT,YAAqB,EAAa,E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