@lewismoten/gamemaker-sandbox-tools 3.1.0 → 3.4.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 (343) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/NOTICE.md +105 -3
  3. package/README.md +301 -15
  4. package/dist/audio-files.js +82 -0
  5. package/dist/audio.js +23 -138
  6. package/dist/block-merge.js +43 -0
  7. package/dist/color-reduce.js +44 -0
  8. package/dist/colors.js +87 -0
  9. package/dist/delta.js +75 -0
  10. package/dist/disk-diff.js +220 -0
  11. package/dist/drawing.js +83 -869
  12. package/dist/embroidery/compile.js +85 -0
  13. package/dist/embroidery/dst.js +79 -0
  14. package/dist/embroidery/exp.js +26 -0
  15. package/dist/embroidery/fill.js +49 -0
  16. package/dist/embroidery/geom.js +82 -0
  17. package/dist/embroidery/pes.js +79 -0
  18. package/dist/embroidery/satin.js +29 -0
  19. package/dist/embroidery/simulate.js +30 -0
  20. package/dist/embroidery/strokeFont.js +253 -0
  21. package/dist/embroidery/svg.js +24 -0
  22. package/dist/embroidery/types.js +13 -0
  23. package/dist/embroidery/units.js +26 -0
  24. package/dist/embroidery/validate.js +15 -0
  25. package/dist/formats/blocks.js +1 -103
  26. package/dist/formats/character.js +1 -83
  27. package/dist/formats/cmf.js +1 -37
  28. package/dist/formats/fli.js +1 -296
  29. package/dist/formats/fliLimits.js +1 -54
  30. package/dist/formats/game.js +1 -193
  31. package/dist/formats/gif.js +1 -125
  32. package/dist/formats/graphicScripts.js +1 -44
  33. package/dist/formats/map.js +1 -38
  34. package/dist/formats/monster.js +1 -69
  35. package/dist/formats/palette.js +1 -58
  36. package/dist/formats/recording.js +1 -17
  37. package/dist/formats/sound.js +1 -44
  38. package/dist/formats/voc.js +1 -303
  39. package/dist/gif-shrink.js +56 -0
  40. package/dist/image/png.js +42 -0
  41. package/dist/images.js +81 -43
  42. package/dist/kit/actors.js +19 -0
  43. package/dist/kit/align.js +204 -0
  44. package/dist/kit/blit.js +45 -0
  45. package/dist/kit/blockRoles.js +97 -0
  46. package/dist/kit/clips.js +40 -0
  47. package/dist/kit/coverPaint.js +18 -0
  48. package/dist/kit/disk.js +76 -0
  49. package/dist/kit/fadeOut.js +13 -0
  50. package/dist/kit/fliClips.js +133 -0
  51. package/dist/kit/fliShrink.js +277 -0
  52. package/dist/kit/gameSim.js +235 -0
  53. package/dist/kit/hopBot.js +142 -0
  54. package/dist/kit/levelGen.js +1423 -0
  55. package/dist/kit/levelGrid.js +33 -0
  56. package/dist/kit/levelPicture.js +27 -0
  57. package/dist/kit/menuVersion.js +19 -0
  58. package/dist/kit/microText.js +35 -0
  59. package/dist/kit/mumble.js +74 -0
  60. package/dist/kit/music.js +8 -0
  61. package/dist/kit/palRamps.js +32 -0
  62. package/dist/kit/palette.js +49 -0
  63. package/dist/kit/pcText.js +72 -0
  64. package/dist/kit/photo.js +150 -0
  65. package/dist/kit/pixels.js +79 -0
  66. package/dist/kit/png.js +40 -0
  67. package/dist/kit/quantize.js +72 -0
  68. package/dist/kit/raytrace.js +379 -0
  69. package/dist/kit/recordedDemo.js +10 -0
  70. package/dist/kit/reel.js +77 -0
  71. package/dist/kit/road3d.js +67 -0
  72. package/dist/kit/routeChecks.js +8 -0
  73. package/dist/kit/saveSlots.js +11 -0
  74. package/dist/kit/sceneInit.js +13 -0
  75. package/dist/kit/sceneSim.js +112 -0
  76. package/dist/kit/screenText.js +15 -0
  77. package/dist/kit/sdftext.js +237 -0
  78. package/dist/kit/shading.js +69 -0
  79. package/dist/kit/song.js +251 -0
  80. package/dist/kit/songFx.js +179 -0
  81. package/dist/kit/sound.js +52 -0
  82. package/dist/kit/synthParts.js +20 -0
  83. package/dist/kit/tar.js +53 -0
  84. package/dist/kit/textBounds.js +84 -0
  85. package/dist/kit/textfit.js +246 -0
  86. package/dist/kit/transforms.js +57 -0
  87. package/dist/kit/tune.js +21 -0
  88. package/dist/look-alike.js +50 -0
  89. package/dist/menu-version.js +4 -0
  90. package/dist/mesh/colorBodies.js +137 -0
  91. package/dist/mesh/decimate.js +207 -0
  92. package/dist/mesh/meshCheck.js +51 -0
  93. package/dist/mesh/overhang.js +41 -0
  94. package/dist/mesh/sampledField.js +12 -0
  95. package/dist/mesh/stl.js +36 -0
  96. package/dist/mesh/surfaceNets.js +79 -0
  97. package/dist/mesh/tetraMesh.js +62 -0
  98. package/dist/mesh/threeMf.js +58 -0
  99. package/dist/mesh/zipFile.js +52 -0
  100. package/dist/microFont.js +101 -0
  101. package/dist/music/compose.js +72 -0
  102. package/dist/pack/meshPack.js +198 -0
  103. package/dist/pack/threeMfPack.js +92 -0
  104. package/dist/palette-reserve.js +116 -0
  105. package/dist/palettes.js +138 -0
  106. package/dist/release-notes.js +40 -0
  107. package/dist/simulation.js +16 -2774
  108. package/dist/text.js +74 -0
  109. package/dist/types/audio.d.ts +4 -0
  110. package/dist/types/audioFiles.d.ts +22 -0
  111. package/dist/types/audioWav.d.ts +4 -0
  112. package/dist/types/blockMerge.d.ts +24 -0
  113. package/dist/types/colorReduce.d.ts +23 -0
  114. package/dist/types/{web/packages/tools/src/colors.d.ts → colors.d.ts} +6 -0
  115. package/dist/types/delta.d.ts +32 -0
  116. package/dist/types/diskDiff.d.ts +47 -0
  117. package/dist/types/drawing.d.ts +15 -0
  118. package/dist/types/embroidery/compile.d.ts +3 -0
  119. package/dist/types/embroidery/dst.d.ts +13 -0
  120. package/dist/types/embroidery/exp.d.ts +8 -0
  121. package/dist/types/embroidery/fill.d.ts +6 -0
  122. package/dist/types/embroidery/geom.d.ts +19 -0
  123. package/dist/types/embroidery/pes.d.ts +10 -0
  124. package/dist/types/embroidery/satin.d.ts +11 -0
  125. package/dist/types/embroidery/simulate.d.ts +19 -0
  126. package/dist/types/embroidery/strokeFont.d.ts +20 -0
  127. package/dist/types/embroidery/svg.d.ts +3 -0
  128. package/dist/types/embroidery/types.d.ts +70 -0
  129. package/dist/types/embroidery/units.d.ts +10 -0
  130. package/dist/types/embroidery/validate.d.ts +22 -0
  131. package/dist/types/formats/blocks.d.ts +1 -0
  132. package/dist/types/formats/character.d.ts +1 -0
  133. package/dist/types/formats/cmf.d.ts +1 -0
  134. package/dist/types/formats/fli.d.ts +1 -0
  135. package/dist/types/formats/fliLimits.d.ts +1 -0
  136. package/dist/types/formats/game.d.ts +1 -0
  137. package/dist/types/formats/gif.d.ts +1 -0
  138. package/dist/types/formats/graphicScripts.d.ts +1 -0
  139. package/dist/types/formats/map.d.ts +1 -0
  140. package/dist/types/formats/monster.d.ts +1 -0
  141. package/dist/types/formats/palette.d.ts +1 -0
  142. package/dist/types/formats/recording.d.ts +1 -0
  143. package/dist/types/formats/sound.d.ts +1 -0
  144. package/dist/types/formats/voc.d.ts +1 -0
  145. package/dist/types/gifShrink.d.ts +8 -0
  146. package/dist/types/image/animatedGif.d.ts +9 -0
  147. package/dist/types/image/surface.d.ts +26 -0
  148. package/dist/types/images.d.ts +13 -0
  149. package/dist/types/kit/actors.d.ts +7 -0
  150. package/dist/types/kit/align.d.ts +93 -0
  151. package/dist/types/kit/audioEvents.d.ts +26 -0
  152. package/dist/types/kit/blit.d.ts +20 -0
  153. package/dist/types/kit/blockRoles.d.ts +243 -0
  154. package/dist/types/{games/kit → kit}/clips.d.ts +1 -1
  155. package/dist/types/kit/coverPaint.d.ts +7 -0
  156. package/dist/types/kit/disk.d.ts +15 -0
  157. package/dist/types/kit/fadeOut.d.ts +12 -0
  158. package/dist/types/kit/fliClips.d.ts +32 -0
  159. package/dist/types/kit/fliShrink.d.ts +149 -0
  160. package/dist/types/{games/kit → kit}/gameSim.d.ts +9 -5
  161. package/dist/types/kit/hopBot.d.ts +72 -0
  162. package/dist/types/kit/laserClearance.d.ts +16 -0
  163. package/dist/types/kit/laserJoints.d.ts +39 -0
  164. package/dist/types/kit/laserLayout.d.ts +54 -0
  165. package/dist/types/kit/laserPixels.d.ts +52 -0
  166. package/dist/types/kit/laserPreview.d.ts +9 -0
  167. package/dist/types/kit/laserSvg.d.ts +35 -0
  168. package/dist/types/kit/levelGen/castle.d.ts +17 -0
  169. package/dist/types/kit/levelGen/dungeon.d.ts +11 -0
  170. package/dist/types/kit/levelGen/forest.d.ts +17 -0
  171. package/dist/types/kit/levelGen/furnish.d.ts +31 -0
  172. package/dist/types/kit/levelGen/grid.d.ts +46 -0
  173. package/dist/types/kit/levelGen/index.d.ts +138 -0
  174. package/dist/types/kit/levelGen/interior.d.ts +18 -0
  175. package/dist/types/kit/levelGen/jumpModel.d.ts +78 -0
  176. package/dist/types/kit/levelGen/needs.d.ts +44 -0
  177. package/dist/types/kit/levelGen/overworld.d.ts +21 -0
  178. package/dist/types/kit/levelGen/platform.d.ts +59 -0
  179. package/dist/types/kit/levelGen/platformCap.d.ts +13 -0
  180. package/dist/types/kit/levelGen/platformReach.d.ts +37 -0
  181. package/dist/types/kit/levelGen/props.d.ts +37 -0
  182. package/dist/types/kit/levelGen/town.d.ts +24 -0
  183. package/dist/types/kit/levelGrid.d.ts +16 -0
  184. package/dist/types/kit/levelPicture.d.ts +9 -0
  185. package/dist/types/kit/menuVersion.d.ts +7 -0
  186. package/dist/types/kit/microText.d.ts +18 -0
  187. package/dist/types/kit/mumble.d.ts +41 -0
  188. package/dist/types/kit/music.d.ts +1 -0
  189. package/dist/types/kit/palMerge.d.ts +10 -0
  190. package/dist/types/kit/palRamps.d.ts +28 -0
  191. package/dist/types/kit/pcText.d.ts +19 -0
  192. package/dist/types/kit/photo.d.ts +69 -0
  193. package/dist/types/kit/png.d.ts +7 -0
  194. package/dist/types/kit/quantize.d.ts +20 -0
  195. package/dist/types/kit/raytrace.d.ts +169 -0
  196. package/dist/types/kit/recordedDemo.d.ts +1 -0
  197. package/dist/types/kit/road3d.d.ts +71 -0
  198. package/dist/types/kit/routeChecks.d.ts +6 -0
  199. package/dist/types/kit/saveSlots.d.ts +17 -0
  200. package/dist/types/kit/sceneInit.d.ts +11 -0
  201. package/dist/types/{games/kit → kit}/sceneSim.d.ts +5 -5
  202. package/dist/types/kit/screenText.d.ts +3 -0
  203. package/dist/types/kit/sdftext.d.ts +34 -0
  204. package/dist/types/kit/shading.d.ts +23 -0
  205. package/dist/types/kit/shareBlocks.d.ts +20 -0
  206. package/dist/types/kit/song.d.ts +89 -0
  207. package/dist/types/kit/songFx.d.ts +99 -0
  208. package/dist/types/kit/synthParts.d.ts +7 -0
  209. package/dist/types/kit/tar.d.ts +13 -0
  210. package/dist/types/kit/textfit.d.ts +74 -0
  211. package/dist/types/kit/transforms.d.ts +8 -0
  212. package/dist/types/lookAlike.d.ts +31 -0
  213. package/dist/types/menuVersionEntry.d.ts +1 -0
  214. package/dist/types/mesh/colorBodies.d.ts +18 -0
  215. package/dist/types/mesh/decimate.d.ts +10 -0
  216. package/dist/types/mesh/fieldTrinket.d.ts +40 -0
  217. package/dist/types/mesh/figureShapes.d.ts +24 -0
  218. package/dist/types/mesh/mesh.d.ts +9 -0
  219. package/dist/types/mesh/meshCheck.d.ts +22 -0
  220. package/dist/types/mesh/overhang.d.ts +24 -0
  221. package/dist/types/mesh/pixelFigure.d.ts +41 -0
  222. package/dist/types/mesh/sampledField.d.ts +3 -0
  223. package/dist/types/mesh/sdfShapes.d.ts +20 -0
  224. package/dist/types/mesh/stl.d.ts +9 -0
  225. package/dist/types/mesh/strokeText.d.ts +8 -0
  226. package/dist/types/mesh/surfaceNets.d.ts +14 -0
  227. package/dist/types/mesh/tetraMesh.d.ts +4 -0
  228. package/dist/types/mesh/threeMf.d.ts +12 -0
  229. package/dist/types/mesh/trinketKinds.d.ts +72 -0
  230. package/dist/types/mesh/trinketTool.d.ts +26 -0
  231. package/dist/types/mesh/voxel.d.ts +10 -0
  232. package/dist/types/mesh/zipFile.d.ts +13 -0
  233. package/dist/types/microFont.d.ts +6 -0
  234. package/dist/types/pack/meshPack.d.ts +26 -0
  235. package/dist/types/pack/threeMfPack.d.ts +11 -0
  236. package/dist/types/palettePresetData.d.ts +4 -0
  237. package/dist/types/palettePresets.d.ts +12 -0
  238. package/dist/types/paletteReserve.d.ts +52 -0
  239. package/dist/types/palettes.d.ts +4 -0
  240. package/dist/types/releaseNotes.d.ts +3 -0
  241. package/dist/types/simulation.d.ts +6 -0
  242. package/dist/types/{web/packages/tools/src/text.d.ts → text.d.ts} +6 -6
  243. package/package.json +145 -15
  244. package/dist/binary-D7wuaC5g.js +0 -120
  245. package/dist/pixels-DzfIIUOl.js +0 -76
  246. package/dist/types/games/kit/blit.d.ts +0 -10
  247. package/dist/types/games/kit/music.d.ts +0 -1
  248. package/dist/types/games/kit/pcText.d.ts +0 -8
  249. package/dist/types/games/kit/shading.d.ts +0 -11
  250. package/dist/types/web/packages/tools/src/audio.d.ts +0 -3
  251. package/dist/types/web/packages/tools/src/drawing.d.ts +0 -10
  252. package/dist/types/web/packages/tools/src/images.d.ts +0 -2
  253. package/dist/types/web/packages/tools/src/microFont.d.ts +0 -1
  254. package/dist/types/web/packages/tools/src/simulation.d.ts +0 -3
  255. package/dist/types/web/scripts/cdGames.d.ts +0 -103
  256. package/dist/types/web/scripts/gameShots.d.ts +0 -12
  257. package/dist/types/web/scripts/ogImage.d.ts +0 -21
  258. package/dist/types/web/src/audio/cmfLoad.d.ts +0 -7
  259. package/dist/types/web/src/audio/cmfPlayer.d.ts +0 -69
  260. package/dist/types/web/src/audio/context.d.ts +0 -12
  261. package/dist/types/web/src/audio/engine.d.ts +0 -39
  262. package/dist/types/web/src/audio/music.worklet.d.ts +0 -14
  263. package/dist/types/web/src/audio/opl.d.ts +0 -37
  264. package/dist/types/web/src/audio/output.d.ts +0 -13
  265. package/dist/types/web/src/desk/boxes/boxFacts.d.ts +0 -85
  266. package/dist/types/web/src/dosPlayer/fileExtensions.d.ts +0 -44
  267. package/dist/types/web/src/dosPlayer/patchRules.d.ts +0 -24
  268. package/dist/types/web/src/dosPlayer/patchTable.d.ts +0 -80
  269. package/dist/types/web/src/edition.d.ts +0 -6
  270. package/dist/types/web/src/eggs/eggState.d.ts +0 -26
  271. package/dist/types/web/src/eggs/eggs.d.ts +0 -31
  272. package/dist/types/web/src/engine/character.d.ts +0 -30
  273. package/dist/types/web/src/engine/funcKeys.d.ts +0 -33
  274. package/dist/types/web/src/engine/game.d.ts +0 -52
  275. package/dist/types/web/src/engine/keys.d.ts +0 -17
  276. package/dist/types/web/src/engine/machine.d.ts +0 -99
  277. package/dist/types/web/src/engine/menus.d.ts +0 -46
  278. package/dist/types/web/src/engine/monsters.d.ts +0 -19
  279. package/dist/types/web/src/engine/playGain.d.ts +0 -11
  280. package/dist/types/web/src/engine/playerLook.d.ts +0 -26
  281. package/dist/types/web/src/engine/recorder.d.ts +0 -60
  282. package/dist/types/web/src/engine/render.d.ts +0 -8
  283. package/dist/types/web/src/engine/scene.d.ts +0 -156
  284. package/dist/types/web/src/engine/scroll.d.ts +0 -16
  285. package/dist/types/web/src/engine/showGraphic.d.ts +0 -39
  286. package/dist/types/web/src/engine/slowPc.d.ts +0 -62
  287. package/dist/types/web/src/engine/touch.d.ts +0 -33
  288. package/dist/types/web/src/engine/world.d.ts +0 -215
  289. package/dist/types/web/src/export/gameAbout.d.ts +0 -15
  290. package/dist/types/web/src/formats/binary.d.ts +0 -44
  291. package/dist/types/web/src/formats/blocks.d.ts +0 -52
  292. package/dist/types/web/src/formats/character.d.ts +0 -65
  293. package/dist/types/web/src/formats/cmf.d.ts +0 -33
  294. package/dist/types/web/src/formats/fli.d.ts +0 -45
  295. package/dist/types/web/src/formats/fliLimits.d.ts +0 -13
  296. package/dist/types/web/src/formats/game.d.ts +0 -72
  297. package/dist/types/web/src/formats/gif.d.ts +0 -15
  298. package/dist/types/web/src/formats/graphicScripts.d.ts +0 -18
  299. package/dist/types/web/src/formats/highscore.d.ts +0 -10
  300. package/dist/types/web/src/formats/map.d.ts +0 -24
  301. package/dist/types/web/src/formats/monster.d.ts +0 -48
  302. package/dist/types/web/src/formats/palette.d.ts +0 -15
  303. package/dist/types/web/src/formats/recording.d.ts +0 -7
  304. package/dist/types/web/src/formats/sound.d.ts +0 -13
  305. package/dist/types/web/src/formats/voc.d.ts +0 -13
  306. package/dist/types/web/src/gfx/cp437Glyphs.d.ts +0 -2
  307. package/dist/types/web/src/gfx/font8x8.d.ts +0 -2
  308. package/dist/types/web/src/gfx/levelPicture.d.ts +0 -81
  309. package/dist/types/web/src/gfx/screen.d.ts +0 -46
  310. package/dist/types/web/src/gfx/titlePicture.d.ts +0 -21
  311. package/dist/types/web/src/input/chords.d.ts +0 -22
  312. package/dist/types/web/src/input/deskMouse.d.ts +0 -14
  313. package/dist/types/web/src/input/keyboard.d.ts +0 -39
  314. package/dist/types/web/src/input/scancodes.d.ts +0 -3
  315. package/dist/types/web/src/manual/printables/types.d.ts +0 -277
  316. package/dist/types/web/src/project/bizarre.d.ts +0 -28
  317. package/dist/types/web/src/project/companion.d.ts +0 -35
  318. package/dist/types/web/src/project/diskFacts.d.ts +0 -30
  319. package/dist/types/web/src/project/files.d.ts +0 -124
  320. package/dist/types/web/src/project/gameFiles.d.ts +0 -49
  321. package/dist/types/web/src/project/gamePack.d.ts +0 -17
  322. package/dist/types/web/src/project/health.d.ts +0 -30
  323. package/dist/types/web/src/project/secretGames.d.ts +0 -19
  324. package/dist/types/web/src/project/storage.d.ts +0 -46
  325. package/dist/types/web/src/project/streamGame.d.ts +0 -38
  326. package/dist/types/web/src/project/zip.d.ts +0 -33
  327. package/dist/types/web/src/retro/dos/disks.d.ts +0 -33
  328. package/dist/types/web/src/retro/text/cp437.d.ts +0 -4
  329. package/dist/types/web/src/seededRandom.d.ts +0 -6
  330. package/dist/types/web/src/tinHearts/deskHearts.d.ts +0 -33
  331. package/dist/types/web/src/tinHearts/manifest.d.ts +0 -30
  332. package/dist/types/web/src/tinHearts/tinHearts.d.ts +0 -84
  333. package/dist/types/web/src/walkthrough/format.d.ts +0 -92
  334. package/dist/types/web/src/walkthrough/madeUpScores.d.ts +0 -6
  335. package/dist/types/web/src/walkthrough/runtime.d.ts +0 -134
  336. /package/dist/types/{web/src/assistant → image}/png.d.ts +0 -0
  337. /package/dist/types/{games/kit → kit}/palette.d.ts +0 -0
  338. /package/dist/types/{games/kit → kit}/pixels.d.ts +0 -0
  339. /package/dist/types/{games/kit → kit}/reel.d.ts +0 -0
  340. /package/dist/types/{games/kit → kit}/sound.d.ts +0 -0
  341. /package/dist/types/{games/kit → kit}/textBounds.d.ts +0 -0
  342. /package/dist/types/{games/kit → kit}/tune.d.ts +0 -0
  343. /package/dist/types/{web/src/audio → music}/compose.d.ts +0 -0
package/dist/audio.js CHANGED
@@ -1,140 +1,25 @@
1
- import { encodeCmf as S } from "./formats/cmf.js";
2
- import { encodeVoc as L } from "./formats/voc.js";
3
- import { NUMFREQ as p } from "./formats/sound.js";
4
- import { r as b } from "./pixels-DzfIIUOl.js";
5
- function s(e) {
6
- return Uint8Array.from([
7
- e.modChar,
8
- e.carChar,
9
- e.modLevel,
10
- e.carLevel,
11
- e.modAD,
12
- e.carAD,
13
- e.modSR,
14
- e.carSR,
15
- e.modWave ?? 0,
16
- e.carWave ?? 0,
17
- e.feedback,
18
- 0,
19
- 0,
20
- 0,
21
- 0,
22
- 0
23
- ]);
24
- }
25
- const C = {
26
- piano: s({ modChar: 1, carChar: 1, modLevel: 90, carLevel: 0, modAD: 242, carAD: 243, modSR: 99, carSR: 101, feedback: 8 }),
27
- bass: s({ modChar: 1, carChar: 1, modLevel: 26, carLevel: 0, modAD: 246, carAD: 245, modSR: 84, carSR: 69, feedback: 8 }),
28
- strings: s({ modChar: 97, carChar: 33, modLevel: 29, carLevel: 0, modAD: 116, carAD: 99, modSR: 19, carSR: 21, feedback: 14 }),
29
- brass: s({ modChar: 33, carChar: 33, modLevel: 26, carLevel: 0, modAD: 99, carAD: 116, modSR: 40, carSR: 23, feedback: 12 }),
30
- lead: s({ modChar: 34, carChar: 33, modLevel: 27, carLevel: 0, modAD: 244, carAD: 244, modSR: 68, carSR: 36, modWave: 2, feedback: 12 }),
31
- bell: s({ modChar: 7, carChar: 1, modLevel: 35, carLevel: 0, modAD: 245, carAD: 243, modSR: 34, carSR: 19, feedback: 4 }),
32
- organ: s({ modChar: 50, carChar: 49, modLevel: 68, carLevel: 0, modAD: 240, carAD: 240, modSR: 15, carSR: 15, feedback: 1 }),
33
- pad: s({ modChar: 161, carChar: 33, modLevel: 41, carLevel: 0, modAD: 67, carAD: 82, modSR: 5, carSR: 4, modWave: 1, feedback: 10 }),
34
- pluck: s({ modChar: 3, carChar: 1, modLevel: 30, carLevel: 0, modAD: 248, carAD: 246, modSR: 53, carSR: 85, feedback: 12 })
35
- }, D = { C: 0, D: 2, E: 4, F: 5, G: 7, A: 9, B: 11 }, k = { w: 4, h: 2, q: 1, e: 0.5, s: 0.25, t: 1 / 3 };
36
- function M(e) {
37
- if (/^r$/i.test(e)) return null;
38
- const r = /^([A-G])([#b]?)(-?\d)$/.exec(e);
39
- if (!r) throw new Error(`Bad note ${e}`);
40
- return 12 * (Number(r[3]) + 1) + D[r[1]] + (r[2] === "#" ? 1 : r[2] === "b" ? -1 : 0);
41
- }
42
- function g(e, r) {
43
- const a = Math.round(8760 / e), t = [], o = [], l = /* @__PURE__ */ new Map();
44
- for (const n of r) {
45
- t[n.channel] = n.instrument;
46
- let c = 0;
47
- for (const i of n.notes.split(",").map((d) => d.trim()).filter(Boolean)) {
48
- const d = /^(.+?)\s+([whqest])(\.?)$/.exec(i);
49
- if (!d) throw new Error(`Bad note "${i}"`);
50
- const f = k[d[2]] * (d[3] ? 1.5 : 1) * a;
51
- d[1].replace(/[[\]]/g, " ").trim().split(/\s+/).forEach((R, u) => {
52
- const v = M(R);
53
- if (v === null) return;
54
- const h = Math.min(15, n.channel + u);
55
- u > 0 && l.set(h, n.instrument);
56
- const A = v + (n.transpose ?? 0);
57
- o.push({ tick: c, data: [144 | h, A, n.velocity ?? 100] }), o.push({ tick: c + f * 0.92, data: [128 | h, A, 0] });
58
- }), c += f;
59
- }
60
- }
61
- for (const [n, c] of l) t[n] ??= c;
62
- for (let n = 0; n < 16; n++) t[n] ??= C.piano;
63
- return S({ instruments: t, events: o, ticksPerBeat: a });
64
- }
65
- function j(e = 120) {
66
- const r = Math.round(8760 / e), a = Array.from({ length: 16 }, () => C.piano);
67
- return S({ instruments: a, events: [{ tick: 4 * r, data: [176, 7, 100] }], ticksPerBeat: r });
68
- }
69
- const w = { w: 4, h: 2, q: 1, e: 0.5, s: 0.25, t: 1 / 3 }, E = (e) => e.split(",").map((r) => r.trim()).filter(Boolean).reduce((r, a) => r + w[a.endsWith(".") ? a.slice(-2, -1) : a.slice(-1)] * (a.endsWith(".") ? 1.5 : 1), 0);
70
- function q(e, r) {
71
- const a = r.map((t) => E(t.notes));
72
- if (a.some((t) => Math.abs(t - a[0]) > 1e-6)) throw new Error(`Voices differ in length: ${a.join(" ")}`);
73
- return g(e, r);
74
- }
75
- const P = (e, r, a, t = 100, o = 0) => ({
76
- channel: e,
77
- instrument: r,
78
- notes: a,
79
- velocity: t,
80
- transpose: o
81
- }), U = (...e) => e.filter(Boolean).join(", "), F = (e, r) => Array(e).fill(r).join(", ");
82
- function m(e) {
83
- return Uint16Array.from({ length: p }, (r, a) => Math.max(0, Math.min(8192, Math.round(e(a, a / (p - 1))))));
84
- }
85
- const T = {
86
- rise: (e = 200, r = 2e3) => m((a, t) => e * (r / e) ** t),
87
- fall: (e = 2e3, r = 150) => m((a, t) => e * (r / e) ** t),
88
- coin: () => m((e) => e < 4 ? 988 : e < 18 ? 1319 : 0),
89
- hurt: () => m((e) => (e % 2 ? 140 : 95) * (1 - e / 60)),
90
- zap: () => m((e) => 3e3 - e * 75 + e % 3 * 300),
91
- chirp: () => m((e) => e < 12 ? 1200 + e * 120 : 0),
92
- arpeggio: (e = [523, 659, 784, 1047]) => m((r) => r < e.length * 6 ? e[Math.floor(r / 6)] : 0),
93
- noise: (e = 1, r = 100, a = 2e3) => {
94
- const t = b(e);
95
- return m((o) => o < 30 ? r + t() * (a - r) : 0);
96
- },
97
- warble: (e = 600, r = 300, a = 1.3) => m((t) => e + Math.sin(t * a) * r)
98
- }, B = {
99
- sine: (e) => {
100
- let r = 0, a = 0;
101
- return (t) => {
102
- const o = typeof e == "number" ? e : e(t);
103
- return r += 2 * Math.PI * o * (t - a), a = t, Math.sin(r);
104
- };
105
- },
106
- square: (e) => {
107
- const r = B.sine(e);
108
- return (a) => r(a) >= 0 ? 1 : -1;
109
- },
110
- noise: (e = 7) => {
111
- const r = b(e);
112
- return () => r() * 2 - 1;
113
- }
114
- };
115
- function _(e, r, a = {}) {
116
- const t = a.rate ?? 11025, o = Math.round(e * t), l = new Float32Array(o), n = a.attack ?? 5e-3;
117
- for (let c = 0; c < o; c++) {
118
- const i = c / t, d = a.envelope ? a.envelope(i / e) : Math.min(1, i / n) * (1 - i / e) ** 1.5;
119
- l[c] = Math.max(-1, Math.min(1, r(i) * d * (a.gain ?? 0.9)));
120
- }
121
- return L(l, t);
122
- }
123
- const G = (...e) => (r) => e.reduce((a, [t, o]) => a + t(r) * o, 0);
1
+ import { INSTRUMENTS as r, blankSong as s, midi as m, sbi as i, song as p } from "./music/compose.js";
2
+ import { LEN as n, join as a, times as x, tune as f, v as l } from "./kit/tune.js";
3
+ import { SPEAKER as N, mix as S, osc as g, sample as b, speaker as k } from "./kit/sound.js";
4
+ import { env as w, gate as R, lowNoise as T, lowpass as c } from "./kit/synthParts.js";
124
5
  export {
125
- C as INSTRUMENTS,
126
- w as LEN,
127
- T as SPEAKER,
128
- j as blankSong,
129
- U as join,
130
- M as midi,
131
- G as mix,
132
- B as osc,
133
- _ as sample,
134
- s as sbi,
135
- g as song,
136
- m as speaker,
137
- F as times,
138
- q as tune,
139
- P as v
6
+ r as INSTRUMENTS,
7
+ n as LEN,
8
+ N as SPEAKER,
9
+ s as blankSong,
10
+ w as env,
11
+ R as gate,
12
+ a as join,
13
+ T as lowNoise,
14
+ c as lowpass,
15
+ m as midi,
16
+ S as mix,
17
+ g as osc,
18
+ b as sample,
19
+ i as sbi,
20
+ p as song,
21
+ k as speaker,
22
+ x as times,
23
+ f as tune,
24
+ l as v
140
25
  };
@@ -0,0 +1,43 @@
1
+ import { BACKBL as v, serializeBlocks as m, emptyBlock as y } from "@lewismoten/gamemaker-sandbox-engine/formats/blocks";
2
+ const f = (n) => m([{ ...n, nextBl: 0, touchBl: 0 }]).join(","), d = (n, s) => n.nextBl === s && n.touchBl === s, M = (n, s) => {
3
+ const o = m([n]);
4
+ return [!1, !0].some((p) => m([y(s, p)]).every((k, l) => k === o[l]));
5
+ };
6
+ function S(n) {
7
+ const { keep: s, drop: o, dropMaps: p, dropUsed: k, dropPinned: l, keepUsed: B } = n, u = /* @__PURE__ */ new Map();
8
+ s.forEach((e, t) => {
9
+ if (!d(e, t) || M(e, t) && !B.has(t)) return;
10
+ const c = f(e);
11
+ u.has(c) || u.set(c, t);
12
+ });
13
+ const i = s.flatMap((e, t) => M(e, t) && !B.has(t) ? [t] : []), r = /* @__PURE__ */ new Map(), h = [], b = /* @__PURE__ */ new Set(), x = (e, t) => {
14
+ r.set(e, t), h.push(e), b.add(t), i.splice(i.indexOf(t), 1);
15
+ }, w = [...k].sort((e, t) => e - t);
16
+ for (const e of w.filter((t) => l.has(t)))
17
+ if (d(o[e], e) && d(s[e], e) && !i.includes(e) && f(s[e]) === f(o[e])) r.set(e, e);
18
+ else if (i.includes(e)) x(e, e);
19
+ else return `block ${e} is carried between scenes (a pickup, a required or starting item, or block 0), and number ${e} is taken in the other set`;
20
+ for (const e of w.filter((t) => !l.has(t))) {
21
+ const t = d(o[e], e) ? u.get(f(o[e])) : void 0;
22
+ if (t !== void 0 && !b.has(t)) r.set(e, t);
23
+ else {
24
+ const c = i[0];
25
+ if (c === void 0) return `their drawn blocks do not fit in one file of ${v}`;
26
+ x(e, c);
27
+ }
28
+ }
29
+ const g = s.map((e) => ({ ...e }));
30
+ for (const e of h) {
31
+ const t = { ...o[e], pixels: o[e].pixels.slice(), xtra: o[e].xtra.slice() }, c = r.get(e);
32
+ for (const a of ["nextBl", "touchBl"])
33
+ if (t[a] === e) t[a] = c;
34
+ else if (r.has(t[a])) t[a] = r.get(t[a]);
35
+ else return `block ${e} turns into a block that is not drawn`;
36
+ g[c] = t;
37
+ }
38
+ const $ = p.map((e) => ({ ...e, blocks: e.blocks.map((t) => r.get(t) ?? t) }));
39
+ return { blocks: g, maps: $, at: r, fresh: h };
40
+ }
41
+ export {
42
+ S as mergeBackgroundSets
43
+ };
@@ -0,0 +1,44 @@
1
+ const L = 6, _ = 20;
2
+ function p(o, s) {
3
+ const f = (c) => {
4
+ const i = Math.min(63, c) / 63;
5
+ return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
6
+ }, [a, h, x] = [f(o[s * 3]), f(o[s * 3 + 1]), f(o[s * 3 + 2])], m = [(0.4124 * a + 0.3576 * h + 0.1805 * x) / 0.95047, 0.2126 * a + 0.7152 * h + 0.0722 * x, (0.0193 * a + 0.1192 * h + 0.9505 * x) / 1.08883], y = (c) => c > 216 / 24389 ? Math.cbrt(c) : (24389 / 27 * c + 16) / 116, [b, M, A] = m.map(y);
7
+ return [116 * M - 16, 500 * (b - M), 200 * (M - A)];
8
+ }
9
+ const G = (o, s) => Math.hypot(o[0] - s[0], o[1] - s[1], o[2] - s[2]);
10
+ function w(o, s, f, a) {
11
+ const h = (t) => t === 0 || t === 255 || a.has(t), x = [...a].filter((t) => t !== 0 && t !== 255), m = /* @__PURE__ */ new Map(), y = (t) => {
12
+ if (m.has(t)) return m.get(t);
13
+ const r = p(f[0], t);
14
+ let n, g = 1 / 0;
15
+ for (const u of x) {
16
+ const l = G(r, p(f[0], u));
17
+ l < g && (g = l, n = u);
18
+ }
19
+ return n !== void 0 && m.set(t, n), n;
20
+ }, b = /* @__PURE__ */ new Map(), M = [];
21
+ let A = 0, c = 0, i = 0;
22
+ for (const t of s) {
23
+ const r = o[t]?.pixels;
24
+ if (!r || r.every(h)) continue;
25
+ const n = r.slice();
26
+ for (let e = 0; e < n.length; e++) h(n[e]) || (n[e] = y(n[e]) ?? n[e]);
27
+ b.set(t, n);
28
+ let g = 0, u = 0, l = 0;
29
+ for (const e of f)
30
+ for (let d = 0; d < r.length; d++) {
31
+ if (r[d] === n[d]) continue;
32
+ const F = G(p(e, r[d]), p(e, n[d]));
33
+ g += F, l++, u = Math.max(u, F);
34
+ }
35
+ l && (g / l > 6 || u > 20) && M.push(t), A += g, c += l, i = Math.max(i, u);
36
+ }
37
+ return { changed: b, moves: m, score: { mean: c ? A / c : 0, worst: i, flagged: M } };
38
+ }
39
+ export {
40
+ L as FLAG_MEAN,
41
+ _ as FLAG_WORST,
42
+ p as labOf,
43
+ w as reduceBlocks
44
+ };
package/dist/colors.js ADDED
@@ -0,0 +1,87 @@
1
+ import { vga8 as c } from "@lewismoten/gamemaker-sandbox-engine/formats/palette";
2
+ function p(n) {
3
+ if (m(n), n.some((i) => i < 0 || i > 255)) throw new RangeError("RGB components must be 0..255");
4
+ const [r, s, a] = n.map((i) => i / 255), t = Math.max(r, s, a), e = Math.min(r, s, a), o = t - e;
5
+ return [((o === 0 ? 0 : t === r ? (s - a) / o : t === s ? (a - r) / o + 2 : (r - s) / o + 4) * 60 + 360) % 360, t === 0 ? 0 : o / t, t];
6
+ }
7
+ function R(n) {
8
+ if (n.length !== 3 || n.some((h) => !Number.isFinite(h)) || n[1] < 0 || n[1] > 1 || n[2] < 0 || n[2] > 1)
9
+ throw new RangeError("HSV needs a finite hue and saturation/value in 0..1");
10
+ const [r, s, a] = n, t = (r % 360 + 360) % 360 / 60, e = a * s, o = e * (1 - Math.abs(t % 2 - 1)), u = a - e;
11
+ return (t < 1 ? [e, o, 0] : t < 2 ? [o, e, 0] : t < 3 ? [0, e, o] : t < 4 ? [0, o, e] : t < 5 ? [o, 0, e] : [e, 0, o]).map((h) => Math.round((h + u) * 255));
12
+ }
13
+ const b = {
14
+ morning: { mul: [1, 0.94, 0.94], add: [14, 4, 10] },
15
+ noon: { mul: [1, 1, 1], add: [0, 0, 0] },
16
+ afternoon: { mul: [1.02, 0.96, 0.86], add: [8, 4, 0] },
17
+ sunset: { mul: [0.9, 0.7, 0.74], add: [30, 10, 16] },
18
+ night: { mul: [0.46, 0.5, 0.78], add: [8, 8, 30] },
19
+ // Under the big top at night: warm show lights on everything.
20
+ show: { mul: [1, 0.9, 0.86], add: [12, 4, 6] }
21
+ }, E = {
22
+ morning: [
23
+ [120, 150, 230],
24
+ [255, 214, 200],
25
+ [200, 190, 240]
26
+ ],
27
+ noon: [
28
+ [70, 130, 230],
29
+ [200, 232, 255]
30
+ ],
31
+ afternoon: [
32
+ [90, 140, 220],
33
+ [250, 236, 200],
34
+ [170, 200, 240]
35
+ ],
36
+ sunset: [
37
+ [60, 40, 120],
38
+ [255, 170, 90],
39
+ [210, 90, 120]
40
+ ],
41
+ night: [
42
+ [8, 8, 30],
43
+ [40, 40, 96]
44
+ ],
45
+ show: [
46
+ [6, 6, 28],
47
+ [60, 40, 110]
48
+ ]
49
+ }, f = (n) => Math.max(0, Math.min(255, Math.round(n)));
50
+ function m(n) {
51
+ if (n.length !== 3 || n.some((r) => !Number.isFinite(r))) throw new RangeError("RGB must contain three finite components");
52
+ }
53
+ function w(n, r) {
54
+ m(n);
55
+ const s = typeof r == "string" ? b[r] : r;
56
+ return m(s.mul), m(s.add), n.map((a, t) => f(a * s.mul[t] + s.add[t]));
57
+ }
58
+ function M(n, r, s, a) {
59
+ if (!Number.isSafeInteger(n) || n < 1 || n > 256) throw new RangeError("Ramp size must be 1..256");
60
+ return m(r), m(s), a && m(a), Array.from({ length: n }, (t, e) => {
61
+ const o = n === 1 ? 0 : e / (n - 1), [u, i, h] = a ? o < 0.5 ? [r, a, o * 2] : [a, s, (o - 0.5) * 2] : [r, s, o];
62
+ return u.map((d, g) => f(d + (i[g] - d) * h));
63
+ });
64
+ }
65
+ function x(n, r, s = [0, 255]) {
66
+ if (n.length !== 768 || n.some((e) => e > 63)) throw new RangeError("Expected a 768-byte six-bit VGA palette");
67
+ if (s.some((e) => !Number.isInteger(e) || e < 0 || e > 255)) throw new RangeError("Preserved palette indexes must be 0..255");
68
+ const a = new Set(s), t = n.slice();
69
+ for (let e = 0; e < 256; e++) {
70
+ if (a.has(e)) continue;
71
+ const o = [c(n[e * 3]), c(n[e * 3 + 1]), c(n[e * 3 + 2])];
72
+ t.set(
73
+ w(o, r).map((u) => u >> 2),
74
+ e * 3
75
+ );
76
+ }
77
+ return t;
78
+ }
79
+ export {
80
+ b as TIME_OF_DAY_LIGHT,
81
+ E as TIME_OF_DAY_SKY,
82
+ x as adjustPalette,
83
+ M as colorRamp,
84
+ R as hsvToRgb,
85
+ w as lightColor,
86
+ p as rgbToHsv
87
+ };
package/dist/delta.js ADDED
@@ -0,0 +1,75 @@
1
+ const h = /\.(lst|txt|json|md|csv|bat|ini|cfg|inf|doc|nfo|diz)$/i;
2
+ const c = (i) => Array.from(i, (e) => String.fromCharCode(e)).join("").match(/[^\n]*\n|[^\n]+/g) ?? [], f = (i) => Uint8Array.from(i.join(""), (e) => e.charCodeAt(0)), g = (i, e) => i.length === e.length && i.every((n, t) => n === e[t]);
3
+ function a(i, e) {
4
+ const n = [];
5
+ let t = 0;
6
+ for (; t < e.length; ) {
7
+ if (t < i.length && i[t] === e[t]) {
8
+ t++;
9
+ continue;
10
+ }
11
+ const s = t;
12
+ let l = t + 1, r = 0;
13
+ for (let o = l; o < e.length && r < 8; o++)
14
+ o < i.length && i[o] === e[o] ? r++ : (l = o + 1, r = 0);
15
+ n.push({ at: s, bytes: e.slice(s, l) }), t = l;
16
+ }
17
+ return { kind: "bytes", length: e.length, patches: n };
18
+ }
19
+ function u(i, e) {
20
+ const [n, t] = [c(i), c(e)];
21
+ let s = 0;
22
+ for (; s < n.length && s < t.length && n[s] === t[s]; ) s++;
23
+ let l = 0;
24
+ for (; l < n.length - s && l < t.length - s && n[n.length - 1 - l] === t[t.length - 1 - l]; ) l++;
25
+ return { kind: "lines", start: s, remove: n.length - s - l, add: t.slice(s, t.length - l) };
26
+ }
27
+ function d(i, e, n) {
28
+ if (!n) return e ? { kind: "gone" } : void 0;
29
+ if (!e) return { kind: "new", bytes: n };
30
+ if (!g(e, n))
31
+ return h.test(i) ? u(e, n) : a(e, n);
32
+ }
33
+ function y(i, e) {
34
+ if (e.kind === "gone") return;
35
+ if (e.kind === "new") return e.bytes;
36
+ if (!i) throw new Error("A patch has no file to change");
37
+ if (e.kind === "bytes") {
38
+ const t = new Uint8Array(e.length);
39
+ t.set(i.subarray(0, Math.min(i.length, e.length)));
40
+ for (const s of e.patches) t.set(s.bytes, s.at);
41
+ return t;
42
+ }
43
+ const n = c(i);
44
+ return n.splice(e.start, e.remove, ...e.add), f(n);
45
+ }
46
+ function k(i, e) {
47
+ const n = {};
48
+ for (const [t, s] of e) {
49
+ const l = d(t, i.get(t), s);
50
+ l && (n[t] = l);
51
+ }
52
+ for (const t of i.keys()) e.has(t) || (n[t] = { kind: "gone" });
53
+ return n;
54
+ }
55
+ function p(i, e) {
56
+ const n = new Map(i);
57
+ for (const [t, s] of Object.entries(e)) {
58
+ const l = y(n.get(t), s);
59
+ l ? n.set(t, l) : n.delete(t);
60
+ }
61
+ return n;
62
+ }
63
+ function b(i) {
64
+ let e = 0;
65
+ for (const n of Object.values(i))
66
+ n.kind === "new" ? e += n.bytes.length : n.kind === "bytes" ? e += n.patches.reduce((t, s) => t + s.bytes.length + 4, 0) : n.kind === "lines" && (e += n.add.reduce((t, s) => t + s.length, 0) + 4);
67
+ return e;
68
+ }
69
+ export {
70
+ p as applyDelta,
71
+ b as deltaSize,
72
+ d as diffFile,
73
+ k as diffVersions,
74
+ y as patchFile
75
+ };
@@ -0,0 +1,220 @@
1
+ import { BLOCK_COUNTS as G, BLOCK_SIZE as v, parseBlocks as M, serializeBlocks as j } from "@lewismoten/gamemaker-sandbox-engine/formats/blocks";
2
+ import { parseCharacter as z } from "@lewismoten/gamemaker-sandbox-engine/formats/character";
3
+ import { isFli as I, parseFli as C } from "@lewismoten/gamemaker-sandbox-engine/formats/fli";
4
+ import { parseGame as S } from "@lewismoten/gamemaker-sandbox-engine/formats/game";
5
+ import { fromCp437 as A } from "@lewismoten/gamemaker-sandbox-engine/text/cp437";
6
+ import { isGif as K, decodeGif as L } from "@lewismoten/gamemaker-sandbox-engine/formats/gif";
7
+ import { parseMap as O, MLEN as N, MWID as w } from "@lewismoten/gamemaker-sandbox-engine/formats/map";
8
+ import { parseMonsters as B } from "@lewismoten/gamemaker-sandbox-engine/formats/monster";
9
+ import { PALETTE_SIZE as D, parsePalette as E } from "@lewismoten/gamemaker-sandbox-engine/formats/palette";
10
+ import { isVoc as U, decodeVoc as q } from "@lewismoten/gamemaker-sandbox-engine/formats/voc";
11
+ const T = (c) => /\.([^./\\]+)$/.exec(c)?.[1].toLowerCase() ?? "", b = (c, o) => c.length === o.length && c.every((t, e) => t === o[e]), d = (c, o) => `${c} ${o}${c === 1 ? "" : "s"}`;
12
+ function k(c, o) {
13
+ if (o.length) {
14
+ if (K(o)) return "gif";
15
+ if (U(o)) return "voc";
16
+ if (T(c) === "fli" && I(o)) return "fli";
17
+ }
18
+ const t = T(c);
19
+ return ["gam", "pal", "map", "bbl", "mbl", "cbl", "chr", "mon"].includes(t) ? t : ["txt", "lst", "doc", "bat", "cfg", "ini", "md", "json"].includes(t) ? "text" : t === "fli" || t === "gif" || t === "voc" ? `${t} (not that format)` : t || "file";
20
+ }
21
+ function m(c, o = 12) {
22
+ const t = [];
23
+ for (let e = 0; e < c.length; ) {
24
+ let n = e;
25
+ for (; n + 1 < c.length && c[n + 1] === c[n] + 1; ) n++;
26
+ t.push(n > e ? `${c[e]}-${c[n]}` : `${c[e]}`), e = n + 1;
27
+ }
28
+ return t.length > o ? `${t.slice(0, o).join(", ")}, and ${t.length - o} more` : t.join(", ");
29
+ }
30
+ function g(c) {
31
+ return JSON.stringify(c, (o, t) => ArrayBuffer.isView(t) ? Array.from(t) : t && typeof t == "object" && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [n]) => e < n ? -1 : 1)) : t);
32
+ }
33
+ function V(c, o) {
34
+ let t = 0;
35
+ for (; t < c.length && t < o.length && c[t] === o[t]; ) t++;
36
+ let e = c.length, n = o.length;
37
+ for (; e > t && n > t && c[e - 1] === o[n - 1]; ) e--, n--;
38
+ const r = c.slice(t, e), s = o.slice(t, n);
39
+ if (r.length * s.length > 4e6) {
40
+ const h = /* @__PURE__ */ new Map();
41
+ for (const l of r) h.set(l, (h.get(l) ?? 0) + 1);
42
+ let f = 0;
43
+ for (const l of s) (h.get(l) ?? 0) > 0 && (h.set(l, h.get(l) - 1), f++);
44
+ return { added: s.length - f, removed: r.length - f };
45
+ }
46
+ let i = new Uint32Array(s.length + 1);
47
+ for (let h = 1; h <= r.length; h++) {
48
+ const f = new Uint32Array(s.length + 1);
49
+ for (let l = 1; l <= s.length; l++) f[l] = r[h - 1] === s[l - 1] ? i[l - 1] + 1 : Math.max(i[l], f[l - 1]);
50
+ i = f;
51
+ }
52
+ return { added: s.length - i[s.length], removed: r.length - i[s.length] };
53
+ }
54
+ function _(c, o) {
55
+ const t = new Set(c), e = /* @__PURE__ */ new Set(), n = [];
56
+ for (const r of c) {
57
+ if (e.has(r)) continue;
58
+ const s = { count: 0, x0: r % o, y0: Math.floor(r / o), x1: 0, y1: 0 };
59
+ s.x1 = s.x0, s.y1 = s.y0;
60
+ const i = [r];
61
+ for (e.add(r); i.length; ) {
62
+ const h = i.pop(), f = h % o, l = Math.floor(h / o);
63
+ s.count++, s.x0 = Math.min(s.x0, f), s.x1 = Math.max(s.x1, f), s.y0 = Math.min(s.y0, l), s.y1 = Math.max(s.y1, l);
64
+ for (let a = -3; a <= 3; a++)
65
+ for (let u = -3; u <= 3; u++) {
66
+ const p = f + u, y = (l + a) * o + p;
67
+ p < 0 || p >= o || !t.has(y) || e.has(y) || (e.add(y), i.push(y));
68
+ }
69
+ }
70
+ n.push(s);
71
+ }
72
+ return n.sort((r, s) => r.y0 - s.y0 || r.x0 - s.x0);
73
+ }
74
+ const F = (c) => new TextDecoder("latin1").decode(c);
75
+ function $(c, o) {
76
+ const t = Math.min(c.length, o.length);
77
+ let e = 0, n = -1;
78
+ for (let s = 0; s < t; s++) c[s] !== o[s] && (e++, n < 0 && (n = s));
79
+ const r = [c.length === o.length ? `same size (${c.length} bytes)` : `${c.length} -> ${o.length} bytes`];
80
+ return e || n >= 0 ? r.push(`${d(e, "byte")} differ${e === 1 ? "s" : ""}, the first at offset ${n}`) : r.push(`the first ${t} bytes are the same`), r;
81
+ }
82
+ function P(c, o, t) {
83
+ const e = G[c];
84
+ if (o.length < e * v || t.length < e * v) return $(o, t);
85
+ const n = M(o, e), r = M(t, e), s = [], i = [], h = [], f = (a, u) => u[a].pixels.every((p) => p === u[a].pixels[0]) && (u[a].pixels[0] === 255 || u[a].pixels[0] === 0);
86
+ for (let a = 0; a < e; a++)
87
+ b(j([n[a]]), j([r[a]])) || (f(a, n) ? i.push(a) : f(a, r) ? h.push(a) : s.push(a));
88
+ const l = [];
89
+ return i.length && l.push(`${d(i.length, "block")} new (were empty): ${m(i)}`), s.length && l.push(`${d(s.length, "block")} changed: ${m(s)}`), h.length && l.push(`${d(h.length, "block")} emptied: ${m(h)}`), l.length ? l : ["block data differs (no block pixels or settings changed in the first " + e + ")"];
90
+ }
91
+ function R(c, o) {
92
+ const t = O(c), e = O(o), n = [];
93
+ for (let i = 0; i < N * w; i++) t.blocks[i] !== e.blocks[i] && n.push(i);
94
+ const r = [
95
+ n.length ? `${d(n.length, "cell")} changed in ${d(_(n, w).length, "cluster")}` : "no background cells changed"
96
+ ];
97
+ for (const i of _(n, w).slice(0, 12)) r.push(` cluster at (${i.x0},${i.y0})-(${i.x1},${i.y1}): ${d(i.count, "cell")}`);
98
+ const s = t.mons.reduce((i, h, f) => i + (h !== e.mons[f] ? 1 : 0), 0);
99
+ return (s || g(t.monsters) !== g(e.monsters)) && r.push(`monsters: ${d(s, "cell")} with a different placement; ${t.monsters.length} -> ${e.monsters.length} placed`), r;
100
+ }
101
+ function x(c, o) {
102
+ const t = [];
103
+ for (let e = 0; e < Math.max(c.length, o.length); e++) g(c[e]) !== g(o[e]) && t.push(e);
104
+ return t;
105
+ }
106
+ function Z(c, o, t) {
107
+ switch (c) {
108
+ case "gam": {
109
+ const e = S(o), n = S(t), r = [`scenes ${e.scenes.length} -> ${n.scenes.length}`], s = x(e.scenes, n.scenes);
110
+ s.length && r.push(`scenes changed: ${m(s)}`);
111
+ for (const i of s.slice(0, 20)) {
112
+ const h = e.scenes[i], f = n.scenes[i], l = [];
113
+ if (!h || !f) l.push(h ? "removed" : "added");
114
+ else {
115
+ h.desc !== f.desc && l.push(`description "${A(h.desc)}" -> "${A(f.desc)}"`);
116
+ const a = x(h.files, f.files);
117
+ a.length && l.push(`files ${a.map((u) => `${h.files[u] || "-"} -> ${f.files[u] || "-"}`).join(", ")}`), g(h.links) !== g(f.links) && l.push(`links ${h.numLinks} -> ${f.numLinks} (changed)`), l.length || l.push("other settings");
118
+ }
119
+ r.push(` scene ${i}: ${l.join("; ")}`);
120
+ }
121
+ return g(e.header) !== g(n.header) && r.push("header changed"), r;
122
+ }
123
+ case "pal": {
124
+ if (o.length < D || t.length < D) return $(o, t);
125
+ const e = E(o), n = E(t), r = [];
126
+ for (let s = 0; s < 256; s++) (e[s * 3] !== n[s * 3] || e[s * 3 + 1] !== n[s * 3 + 1] || e[s * 3 + 2] !== n[s * 3 + 2]) && r.push(s);
127
+ return [`${d(r.length, "color")} changed: ${m(r)}`];
128
+ }
129
+ case "bbl":
130
+ case "mbl":
131
+ case "cbl":
132
+ return P(c, o, t);
133
+ case "map":
134
+ return R(o, t);
135
+ case "chr": {
136
+ const e = z(o), n = z(t), r = x(e.sequences, n.sequences), s = Object.keys(e).filter(
137
+ (i) => i !== "sequences" && g(e[i]) !== g(n[i])
138
+ );
139
+ return [
140
+ r.length ? `sequences changed: ${m(r)}` : "no sequences changed",
141
+ ...s.length ? [`other settings changed: ${s.sort().join(", ")}`] : []
142
+ ];
143
+ }
144
+ case "mon": {
145
+ const e = B(o), n = B(t), r = x(e, n);
146
+ return [`${d(r.length, "monster")} changed: ${m(r)}`];
147
+ }
148
+ case "text": {
149
+ const { added: e, removed: n } = V(F(o).split(/\r?\n/), F(t).split(/\r?\n/));
150
+ return [`${d(e, "line")} added, ${d(n, "line")} removed`];
151
+ }
152
+ case "gif": {
153
+ const e = L(o), n = L(t), r = [e.width === n.width && e.height === n.height ? `${e.width}x${e.height}` : `${e.width}x${e.height} -> ${n.width}x${n.height}`];
154
+ return e.width === n.width && e.height === n.height && r.push(
155
+ `${d(
156
+ e.pixels.reduce((s, i, h) => s + (i !== n.pixels[h] ? 1 : 0), 0),
157
+ "pixel"
158
+ )} changed`
159
+ ), r.push(g(e.palette) === g(n.palette) ? "palette same" : "palette changed"), r;
160
+ }
161
+ case "fli": {
162
+ const e = C(o), n = C(t);
163
+ return [
164
+ `${e.width}x${e.height}, ${d(e.frames.length, "frame")} -> ${n.width}x${n.height}, ${d(n.frames.length, "frame")}`,
165
+ `speed ${e.speed} -> ${n.speed}`,
166
+ ...e.frames.length === n.frames.length ? [
167
+ ((r) => `${d(r, "frame")} ${r === 1 ? "differs" : "differ"}`)(
168
+ e.frames.filter((r, s) => !b(o.subarray(r, e.frames[s + 1] ?? o.length), t.subarray(n.frames[s], n.frames[s + 1] ?? t.length))).length
169
+ )
170
+ ] : []
171
+ ];
172
+ }
173
+ case "voc": {
174
+ const e = q(o), n = q(t), r = (s) => `${(s.samples.length / s.sampleRate).toFixed(2)} s at ${s.sampleRate} Hz`;
175
+ return [`${r(e)} -> ${r(n)}`];
176
+ }
177
+ default:
178
+ return $(o, t);
179
+ }
180
+ }
181
+ function H(c, o, t) {
182
+ const e = k(c, o), n = k(c, t);
183
+ if (e !== n) return { kind: `${e} -> ${n}`, summary: ["contents changed type", ...$(o, t)] };
184
+ try {
185
+ return { kind: e, summary: Z(e, o, t) };
186
+ } catch {
187
+ return { kind: e, summary: ["could not be read as that format", ...$(o, t)] };
188
+ }
189
+ }
190
+ function re(c, o) {
191
+ const t = [.../* @__PURE__ */ new Set([...c.keys(), ...o.keys()])].sort(), e = { added: [], removed: [], changed: [], unchanged: 0 };
192
+ for (const n of t) {
193
+ const r = c.get(n), s = o.get(n);
194
+ !r && s ? e.added.push({ name: n, kind: k(n, s), size: s.length }) : r && !s ? e.removed.push({ name: n, kind: k(n, r), size: r.length }) : r && s && (b(r, s) ? e.unchanged++ : e.changed.push({ name: n, before: r.length, after: s.length, ...H(n, r, s) }));
195
+ }
196
+ return e;
197
+ }
198
+ function ce(c) {
199
+ const o = [
200
+ `${d(c.changed.length, "file")} changed, ${d(c.added.length, "file")} added, ${d(c.removed.length, "file")} removed, ${c.unchanged} unchanged`
201
+ ];
202
+ for (const t of c.added) o.push(`+ ${t.name} (${t.kind}, ${t.size} bytes)`);
203
+ for (const t of c.removed) o.push(`- ${t.name} (${t.kind}, ${t.size} bytes)`);
204
+ for (const t of c.changed) {
205
+ o.push(`~ ${t.name} (${t.kind}, ${t.before} -> ${t.after} bytes)`);
206
+ for (const e of t.summary) o.push(` ${e.replace(/^ +/, (n) => n + " ")}`);
207
+ }
208
+ return o.join(`
209
+ `) + `
210
+ `;
211
+ }
212
+ export {
213
+ _ as cellClusters,
214
+ re as diffDisks,
215
+ ce as formatDiff,
216
+ V as lineDiff,
217
+ m as ranges,
218
+ k as sniffKind,
219
+ H as summarizeChange
220
+ };