diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..1e2addeb8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,21 @@ +name: Build + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Install dependencies + run: npm ci + - name: "Run build" + run: npm run build + - uses: actions/upload-artifact@v3 + with: + name: Build + path: dist \ No newline at end of file diff --git a/.gitignore b/.gitignore index c70619c97..604552189 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ node_modules cert database logs +dist # JetBrains IDEs .idea/ \ No newline at end of file diff --git a/build.mjs b/build.mjs new file mode 100644 index 000000000..8d0b54e46 --- /dev/null +++ b/build.mjs @@ -0,0 +1,68 @@ +import { readdir, cp as copy, rm as remove, readFile, writeFile } from "node:fs/promises"; +import { minify } from "terser"; + +/** Whether to generate source maps */ +const generateMaps = true; + +/** + * + * @param {string} path + * @param {string} ext + * @returns {Promise} + */ +async function getExtFiles(path, ext) { + const filesNFolder = await readdir(path); + const folders = filesNFolder.filter(v => !v.endsWith(ext)); + let files = filesNFolder.filter(v => v.endsWith(ext)); + + for (const folder of folders) { + try { + const newFiles = await getExtFiles(`${path}/${folder}`, ext); + files.push(...newFiles.map(v => `${folder}/${v}`)); + } catch (e) { + if (e.code) continue; + console.log(e); + } + } + + return files; +} + +await remove("./dist", { + recursive: true, + force: true, +}); + +await copy("./src/client", "./dist", { + recursive: true, + force: true, +}); + +const clientScript = await getExtFiles("./src/client/scripts", ".js"); +const clientStyle = []; // await getExtFiles("./src/client/css", ".css"); + +const clientFiles = []; +clientFiles.push(...clientScript.map(v => `./src/client/scripts/${v}`), ...clientStyle.map(v => `./src/client/css/${v}`)); + +const filesToWrite = []; + +for (const file of clientFiles) { + const filePath = `./dist/${file.replace('./src/client/', '')}`; + const code = await readFile(filePath, 'utf8'); + const minified = await minify(code, { + mangle: true, // Disable variable name mangling + compress: true, // Enable compression + sourceMap: generateMaps + }); + + filesToWrite.push( + writeFile(filePath, minified.code, 'utf8') + ); + if (generateMaps) { + filesToWrite.push( + writeFile(filePath + ".map", minified.map, "utf8") + ); + } +} + +await Promise.all(filesToWrite); \ No newline at end of file diff --git a/resources/SKELETON.css b/dev-utils/SKELETON.css similarity index 100% rename from resources/SKELETON.css rename to dev-utils/SKELETON.css diff --git a/resources/SKELETON.html b/dev-utils/SKELETON.html similarity index 100% rename from resources/SKELETON.html rename to dev-utils/SKELETON.html diff --git a/resources/images/icons/Checkerboard (current)/Screen Shot 2023-03-03 at 5.30.34 PM.png b/dev-utils/images/icons/Checkerboard (current)/Screen Shot 2023-03-03 at 5.30.34 PM.png similarity index 100% rename from resources/images/icons/Checkerboard (current)/Screen Shot 2023-03-03 at 5.30.34 PM.png rename to dev-utils/images/icons/Checkerboard (current)/Screen Shot 2023-03-03 at 5.30.34 PM.png diff --git a/resources/images/icons/Checkerboard (current)/Screen Shot 2023-03-03 at 5.36.48 PM.png b/dev-utils/images/icons/Checkerboard (current)/Screen Shot 2023-03-03 at 5.36.48 PM.png similarity index 100% rename from resources/images/icons/Checkerboard (current)/Screen Shot 2023-03-03 at 5.36.48 PM.png rename to dev-utils/images/icons/Checkerboard (current)/Screen Shot 2023-03-03 at 5.36.48 PM.png diff --git a/resources/images/icons/Checkerboard (current)/favicon.ico b/dev-utils/images/icons/Checkerboard (current)/favicon.ico similarity index 100% rename from resources/images/icons/Checkerboard (current)/favicon.ico rename to dev-utils/images/icons/Checkerboard (current)/favicon.ico diff --git a/public/img/favicon.png b/dev-utils/images/icons/Checkerboard (current)/favicon.png similarity index 100% rename from public/img/favicon.png rename to dev-utils/images/icons/Checkerboard (current)/favicon.png diff --git a/resources/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_and_no_background.png b/dev-utils/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_and_no_background.png similarity index 100% rename from resources/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_and_no_background.png rename to dev-utils/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_and_no_background.png diff --git a/resources/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_and_shadow.png b/dev-utils/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_and_shadow.png similarity index 100% rename from resources/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_and_shadow.png rename to dev-utils/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_and_shadow.png diff --git a/resources/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_colored.png b/dev-utils/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_colored.png similarity index 100% rename from resources/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_colored.png rename to dev-utils/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_colored.png diff --git a/resources/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_cropped2.png b/dev-utils/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_cropped2.png similarity index 100% rename from resources/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_cropped2.png rename to dev-utils/images/icons/Omega_1 with the queen as the one, by jo_the_lurker/Infinite_Chess_but_with_a_very_finite_logo_cropped2.png diff --git a/resources/images/pieces/Promotion spritesheet creation/acChess_nlt45.png b/dev-utils/images/pieces/Promotion spritesheet creation/acChess_nlt45.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/acChess_nlt45.png rename to dev-utils/images/pieces/Promotion spritesheet creation/acChess_nlt45.png diff --git a/resources/images/pieces/Promotion spritesheet creation/adChess_ndt45.png b/dev-utils/images/pieces/Promotion spritesheet creation/adChess_ndt45.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/adChess_ndt45.png rename to dev-utils/images/pieces/Promotion spritesheet creation/adChess_ndt45.png diff --git a/resources/images/pieces/Promotion spritesheet creation/aeChess_blt45.png b/dev-utils/images/pieces/Promotion spritesheet creation/aeChess_blt45.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/aeChess_blt45.png rename to dev-utils/images/pieces/Promotion spritesheet creation/aeChess_blt45.png diff --git a/resources/images/pieces/Promotion spritesheet creation/afChess_bdt45.png b/dev-utils/images/pieces/Promotion spritesheet creation/afChess_bdt45.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/afChess_bdt45.png rename to dev-utils/images/pieces/Promotion spritesheet creation/afChess_bdt45.png diff --git a/resources/images/pieces/Promotion spritesheet creation/ag7Chess_rlt45.png b/dev-utils/images/pieces/Promotion spritesheet creation/ag7Chess_rlt45.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/ag7Chess_rlt45.png rename to dev-utils/images/pieces/Promotion spritesheet creation/ag7Chess_rlt45.png diff --git a/resources/images/pieces/Promotion spritesheet creation/ahchess_rdt45.png b/dev-utils/images/pieces/Promotion spritesheet creation/ahchess_rdt45.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/ahchess_rdt45.png rename to dev-utils/images/pieces/Promotion spritesheet creation/ahchess_rdt45.png diff --git a/resources/images/pieces/Promotion spritesheet creation/ai9Chess_qlt45.png b/dev-utils/images/pieces/Promotion spritesheet creation/ai9Chess_qlt45.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/ai9Chess_qlt45.png rename to dev-utils/images/pieces/Promotion spritesheet creation/ai9Chess_qlt45.png diff --git a/resources/images/pieces/Promotion spritesheet creation/aj10Chess_qdt45.png b/dev-utils/images/pieces/Promotion spritesheet creation/aj10Chess_qdt45.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/aj10Chess_qdt45.png rename to dev-utils/images/pieces/Promotion spritesheet creation/aj10Chess_qdt45.png diff --git a/resources/images/pieces/Promotion spritesheet creation/am5chancellor_w.png b/dev-utils/images/pieces/Promotion spritesheet creation/am5chancellor_w.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/am5chancellor_w.png rename to dev-utils/images/pieces/Promotion spritesheet creation/am5chancellor_w.png diff --git a/resources/images/pieces/Promotion spritesheet creation/aochancellor_b.png b/dev-utils/images/pieces/Promotion spritesheet creation/aochancellor_b.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/aochancellor_b.png rename to dev-utils/images/pieces/Promotion spritesheet creation/aochancellor_b.png diff --git a/resources/images/pieces/Promotion spritesheet creation/apwhite-archbis sharepened1.png b/dev-utils/images/pieces/Promotion spritesheet creation/apwhite-archbis sharepened1.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/apwhite-archbis sharepened1.png rename to dev-utils/images/pieces/Promotion spritesheet creation/apwhite-archbis sharepened1.png diff --git a/resources/images/pieces/Promotion spritesheet creation/aqblack-archbis sharpened1.png b/dev-utils/images/pieces/Promotion spritesheet creation/aqblack-archbis sharpened1.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/aqblack-archbis sharpened1.png rename to dev-utils/images/pieces/Promotion spritesheet creation/aqblack-archbis sharpened1.png diff --git a/resources/images/pieces/Promotion spritesheet creation/arAmazon White.png b/dev-utils/images/pieces/Promotion spritesheet creation/arAmazon White.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/arAmazon White.png rename to dev-utils/images/pieces/Promotion spritesheet creation/arAmazon White.png diff --git a/resources/images/pieces/Promotion spritesheet creation/asAmazon Black 512.png b/dev-utils/images/pieces/Promotion spritesheet creation/asAmazon Black 512.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/asAmazon Black 512.png rename to dev-utils/images/pieces/Promotion spritesheet creation/asAmazon Black 512.png diff --git a/resources/images/pieces/Promotion spritesheet creation/at9guard_w.png b/dev-utils/images/pieces/Promotion spritesheet creation/at9guard_w.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/at9guard_w.png rename to dev-utils/images/pieces/Promotion spritesheet creation/at9guard_w.png diff --git a/resources/images/pieces/Promotion spritesheet creation/auguard_b.png b/dev-utils/images/pieces/Promotion spritesheet creation/auguard_b.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/auguard_b.png rename to dev-utils/images/pieces/Promotion spritesheet creation/auguard_b.png diff --git a/resources/images/pieces/Promotion spritesheet creation/axHawk White.png b/dev-utils/images/pieces/Promotion spritesheet creation/axHawk White.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/axHawk White.png rename to dev-utils/images/pieces/Promotion spritesheet creation/axHawk White.png diff --git a/resources/images/pieces/Promotion spritesheet creation/ayHawk Black.png b/dev-utils/images/pieces/Promotion spritesheet creation/ayHawk Black.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/ayHawk Black.png rename to dev-utils/images/pieces/Promotion spritesheet creation/ayHawk Black.png diff --git a/resources/images/pieces/Promotion spritesheet creation/azCamel White.png b/dev-utils/images/pieces/Promotion spritesheet creation/azCamel White.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/azCamel White.png rename to dev-utils/images/pieces/Promotion spritesheet creation/azCamel White.png diff --git a/resources/images/pieces/Promotion spritesheet creation/baCamel Black.png b/dev-utils/images/pieces/Promotion spritesheet creation/baCamel Black.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/baCamel Black.png rename to dev-utils/images/pieces/Promotion spritesheet creation/baCamel Black.png diff --git a/resources/images/pieces/Promotion spritesheet creation/bbGiraffe White.png b/dev-utils/images/pieces/Promotion spritesheet creation/bbGiraffe White.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/bbGiraffe White.png rename to dev-utils/images/pieces/Promotion spritesheet creation/bbGiraffe White.png diff --git a/resources/images/pieces/Promotion spritesheet creation/bcGiraffe Black.png b/dev-utils/images/pieces/Promotion spritesheet creation/bcGiraffe Black.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/bcGiraffe Black.png rename to dev-utils/images/pieces/Promotion spritesheet creation/bcGiraffe Black.png diff --git a/resources/images/pieces/Promotion spritesheet creation/bdZebra White.png b/dev-utils/images/pieces/Promotion spritesheet creation/bdZebra White.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/bdZebra White.png rename to dev-utils/images/pieces/Promotion spritesheet creation/bdZebra White.png diff --git a/resources/images/pieces/Promotion spritesheet creation/beZebra Black.png b/dev-utils/images/pieces/Promotion spritesheet creation/beZebra Black.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/beZebra Black.png rename to dev-utils/images/pieces/Promotion spritesheet creation/beZebra Black.png diff --git a/resources/images/pieces/Promotion spritesheet creation/bfKnightrider White.png b/dev-utils/images/pieces/Promotion spritesheet creation/bfKnightrider White.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/bfKnightrider White.png rename to dev-utils/images/pieces/Promotion spritesheet creation/bfKnightrider White.png diff --git a/resources/images/pieces/Promotion spritesheet creation/bgKnightrider Black.png b/dev-utils/images/pieces/Promotion spritesheet creation/bgKnightrider Black.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/bgKnightrider Black.png rename to dev-utils/images/pieces/Promotion spritesheet creation/bgKnightrider Black.png diff --git a/resources/images/pieces/Promotion spritesheet creation/blRose White.png b/dev-utils/images/pieces/Promotion spritesheet creation/blRose White.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/blRose White.png rename to dev-utils/images/pieces/Promotion spritesheet creation/blRose White.png diff --git a/resources/images/pieces/Promotion spritesheet creation/bmRose Black.png b/dev-utils/images/pieces/Promotion spritesheet creation/bmRose Black.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/bmRose Black.png rename to dev-utils/images/pieces/Promotion spritesheet creation/bmRose Black.png diff --git a/resources/images/pieces/Promotion spritesheet creation/bnCentaur White.png b/dev-utils/images/pieces/Promotion spritesheet creation/bnCentaur White.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/bnCentaur White.png rename to dev-utils/images/pieces/Promotion spritesheet creation/bnCentaur White.png diff --git a/resources/images/pieces/Promotion spritesheet creation/boCentaur Black.png b/dev-utils/images/pieces/Promotion spritesheet creation/boCentaur Black.png similarity index 100% rename from resources/images/pieces/Promotion spritesheet creation/boCentaur Black.png rename to dev-utils/images/pieces/Promotion spritesheet creation/boCentaur Black.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/Empty (placeholder).png b/dev-utils/images/pieces/cburnett/All png, 512x512/Empty (placeholder).png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/Empty (placeholder).png rename to dev-utils/images/pieces/cburnett/All png, 512x512/Empty (placeholder).png diff --git a/resources/images/pieces/cburnett/All png, 512x512/aaChess_plt45.png b/dev-utils/images/pieces/cburnett/All png, 512x512/aaChess_plt45.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/aaChess_plt45.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/aaChess_plt45.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/abChess_pdt45.png b/dev-utils/images/pieces/cburnett/All png, 512x512/abChess_pdt45.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/abChess_pdt45.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/abChess_pdt45.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/acChess_nlt45.png b/dev-utils/images/pieces/cburnett/All png, 512x512/acChess_nlt45.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/acChess_nlt45.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/acChess_nlt45.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/adChess_ndt45.png b/dev-utils/images/pieces/cburnett/All png, 512x512/adChess_ndt45.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/adChess_ndt45.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/adChess_ndt45.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/aeChess_blt45.png b/dev-utils/images/pieces/cburnett/All png, 512x512/aeChess_blt45.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/aeChess_blt45.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/aeChess_blt45.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/afChess_bdt45.png b/dev-utils/images/pieces/cburnett/All png, 512x512/afChess_bdt45.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/afChess_bdt45.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/afChess_bdt45.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/ag7Chess_rlt45.png b/dev-utils/images/pieces/cburnett/All png, 512x512/ag7Chess_rlt45.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/ag7Chess_rlt45.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/ag7Chess_rlt45.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/ahchess_rdt45.png b/dev-utils/images/pieces/cburnett/All png, 512x512/ahchess_rdt45.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/ahchess_rdt45.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/ahchess_rdt45.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/ai9Chess_qlt45.png b/dev-utils/images/pieces/cburnett/All png, 512x512/ai9Chess_qlt45.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/ai9Chess_qlt45.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/ai9Chess_qlt45.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/aj10Chess_qdt45.png b/dev-utils/images/pieces/cburnett/All png, 512x512/aj10Chess_qdt45.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/aj10Chess_qdt45.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/aj10Chess_qdt45.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/ak11Chess_klt45.png b/dev-utils/images/pieces/cburnett/All png, 512x512/ak11Chess_klt45.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/ak11Chess_klt45.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/ak11Chess_klt45.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/al12Chess_kdt45.png b/dev-utils/images/pieces/cburnett/All png, 512x512/al12Chess_kdt45.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/al12Chess_kdt45.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/al12Chess_kdt45.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/am5chancellor_w.png b/dev-utils/images/pieces/cburnett/All png, 512x512/am5chancellor_w.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/am5chancellor_w.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/am5chancellor_w.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/aochancellor_b.png b/dev-utils/images/pieces/cburnett/All png, 512x512/aochancellor_b.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/aochancellor_b.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/aochancellor_b.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/apwhite-archbis sharepened1.png b/dev-utils/images/pieces/cburnett/All png, 512x512/apwhite-archbis sharepened1.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/apwhite-archbis sharepened1.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/apwhite-archbis sharepened1.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/aqblack-archbis sharpened1.png b/dev-utils/images/pieces/cburnett/All png, 512x512/aqblack-archbis sharpened1.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/aqblack-archbis sharpened1.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/aqblack-archbis sharpened1.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/arAmazon White.png b/dev-utils/images/pieces/cburnett/All png, 512x512/arAmazon White.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/arAmazon White.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/arAmazon White.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/asAmazon Black 512.png b/dev-utils/images/pieces/cburnett/All png, 512x512/asAmazon Black 512.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/asAmazon Black 512.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/asAmazon Black 512.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/at9guard_w.png b/dev-utils/images/pieces/cburnett/All png, 512x512/at9guard_w.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/at9guard_w.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/at9guard_w.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/auguard_b.png b/dev-utils/images/pieces/cburnett/All png, 512x512/auguard_b.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/auguard_b.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/auguard_b.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/avCommoner White.png b/dev-utils/images/pieces/cburnett/All png, 512x512/avCommoner White.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/avCommoner White.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/avCommoner White.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/awCommoner Black.png b/dev-utils/images/pieces/cburnett/All png, 512x512/awCommoner Black.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/awCommoner Black.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/awCommoner Black.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/azCamel White.png b/dev-utils/images/pieces/cburnett/All png, 512x512/azCamel White.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/azCamel White.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/azCamel White.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/baCamel Black.png b/dev-utils/images/pieces/cburnett/All png, 512x512/baCamel Black.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/baCamel Black.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/baCamel Black.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bbGiraffe White.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bbGiraffe White.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bbGiraffe White.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bbGiraffe White.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bcGiraffe Black.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bcGiraffe Black.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bcGiraffe Black.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bcGiraffe Black.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bdZebra White.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bdZebra White.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bdZebra White.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bdZebra White.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/beZebra Black.png b/dev-utils/images/pieces/cburnett/All png, 512x512/beZebra Black.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/beZebra Black.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/beZebra Black.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bfKnightrider White.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bfKnightrider White.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bfKnightrider White.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bfKnightrider White.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bgKnightrider Black.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bgKnightrider Black.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bgKnightrider Black.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bgKnightrider Black.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bhUnicorn White.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bhUnicorn White.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bhUnicorn White.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bhUnicorn White.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/biUnicorn Black.png b/dev-utils/images/pieces/cburnett/All png, 512x512/biUnicorn Black.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/biUnicorn Black.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/biUnicorn Black.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bjw-unicorn 512.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bjw-unicorn 512.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bjw-unicorn 512.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bjw-unicorn 512.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bkb-unicorn 512.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bkb-unicorn 512.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bkb-unicorn 512.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bkb-unicorn 512.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/blRose White.png b/dev-utils/images/pieces/cburnett/All png, 512x512/blRose White.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/blRose White.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/blRose White.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bmRose Black.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bmRose Black.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bmRose Black.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bmRose Black.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bnCentaur White.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bnCentaur White.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bnCentaur White.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bnCentaur White.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/boCentaur Black.png b/dev-utils/images/pieces/cburnett/All png, 512x512/boCentaur Black.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/boCentaur Black.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/boCentaur Black.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bpRoyal Centaur White.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bpRoyal Centaur White.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bpRoyal Centaur White.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bpRoyal Centaur White.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bqRoyal Centaur Black.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bqRoyal Centaur Black.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bqRoyal Centaur Black.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bqRoyal Centaur Black.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/brwhite-rqueen.png b/dev-utils/images/pieces/cburnett/All png, 512x512/brwhite-rqueen.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/brwhite-rqueen.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/brwhite-rqueen.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bsblack-rqueen.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bsblack-rqueen.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bsblack-rqueen.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bsblack-rqueen.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/btKelpie White.png b/dev-utils/images/pieces/cburnett/All png, 512x512/btKelpie White.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/btKelpie White.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/btKelpie White.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/buKelpie Black.png b/dev-utils/images/pieces/cburnett/All png, 512x512/buKelpie Black.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/buKelpie Black.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/buKelpie Black.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bvWhite Dragon 512.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bvWhite Dragon 512.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bvWhite Dragon 512.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bvWhite Dragon 512.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bwBlack Dragon 512.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bwBlack Dragon 512.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bwBlack Dragon 512.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bwBlack Dragon 512.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bxDragon White.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bxDragon White.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bxDragon White.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bxDragon White.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/byDragon Black.png b/dev-utils/images/pieces/cburnett/All png, 512x512/byDragon Black.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/byDragon Black.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/byDragon Black.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/byzAir.png b/dev-utils/images/pieces/cburnett/All png, 512x512/byzAir.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/byzAir.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/byzAir.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/bzobstacle.png b/dev-utils/images/pieces/cburnett/All png, 512x512/bzobstacle.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/bzobstacle.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/bzobstacle.png diff --git a/resources/images/pieces/cburnett/All png, 512x512/caAdd Loot Studios Coin2 512 brightened copy.png b/dev-utils/images/pieces/cburnett/All png, 512x512/caAdd Loot Studios Coin2 512 brightened copy.png similarity index 100% rename from resources/images/pieces/cburnett/All png, 512x512/caAdd Loot Studios Coin2 512 brightened copy.png rename to dev-utils/images/pieces/cburnett/All png, 512x512/caAdd Loot Studios Coin2 512 brightened copy.png diff --git a/resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_bdt45.svg b/dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_bdt45.svg similarity index 100% rename from resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_bdt45.svg rename to dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_bdt45.svg diff --git a/resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_blt45.svg b/dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_blt45.svg similarity index 100% rename from resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_blt45.svg rename to dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_blt45.svg diff --git a/resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_kdt45.svg b/dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_kdt45.svg similarity index 100% rename from resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_kdt45.svg rename to dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_kdt45.svg diff --git a/resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_klt45.svg b/dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_klt45.svg similarity index 100% rename from resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_klt45.svg rename to dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_klt45.svg diff --git a/resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_ndt45.svg b/dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_ndt45.svg similarity index 100% rename from resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_ndt45.svg rename to dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_ndt45.svg diff --git a/resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_nlt45.svg b/dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_nlt45.svg similarity index 100% rename from resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_nlt45.svg rename to dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_nlt45.svg diff --git a/resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_pdt45.svg b/dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_pdt45.svg similarity index 100% rename from resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_pdt45.svg rename to dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_pdt45.svg diff --git a/resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_plt45.svg b/dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_plt45.svg similarity index 100% rename from resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_plt45.svg rename to dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_plt45.svg diff --git a/resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_qdt45.svg b/dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_qdt45.svg similarity index 100% rename from resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_qdt45.svg rename to dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_qdt45.svg diff --git a/resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_qlt45.svg b/dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_qlt45.svg similarity index 100% rename from resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_qlt45.svg rename to dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_qlt45.svg diff --git a/resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_rdt45.svg b/dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_rdt45.svg similarity index 100% rename from resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_rdt45.svg rename to dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_rdt45.svg diff --git a/resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_rlt45.svg b/dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_rlt45.svg similarity index 100% rename from resources/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_rlt45.svg rename to dev-utils/images/pieces/cburnett/Vector graphics/Standard, non-fairy/Chess_rlt45.svg diff --git a/resources/images/pieces/green_chess/black-amazon.png b/dev-utils/images/pieces/green_chess/black-amazon.png similarity index 100% rename from resources/images/pieces/green_chess/black-amazon.png rename to dev-utils/images/pieces/green_chess/black-amazon.png diff --git a/resources/images/pieces/green_chess/black-archbis.png b/dev-utils/images/pieces/green_chess/black-archbis.png similarity index 100% rename from resources/images/pieces/green_chess/black-archbis.png rename to dev-utils/images/pieces/green_chess/black-archbis.png diff --git a/resources/images/pieces/green_chess/black-augna.png b/dev-utils/images/pieces/green_chess/black-augna.png similarity index 100% rename from resources/images/pieces/green_chess/black-augna.png rename to dev-utils/images/pieces/green_chess/black-augna.png diff --git a/resources/images/pieces/green_chess/black-augnd.png b/dev-utils/images/pieces/green_chess/black-augnd.png similarity index 100% rename from resources/images/pieces/green_chess/black-augnd.png rename to dev-utils/images/pieces/green_chess/black-augnd.png diff --git a/resources/images/pieces/green_chess/black-augnf.png b/dev-utils/images/pieces/green_chess/black-augnf.png similarity index 100% rename from resources/images/pieces/green_chess/black-augnf.png rename to dev-utils/images/pieces/green_chess/black-augnf.png diff --git a/resources/images/pieces/green_chess/black-augnw.png b/dev-utils/images/pieces/green_chess/black-augnw.png similarity index 100% rename from resources/images/pieces/green_chess/black-augnw.png rename to dev-utils/images/pieces/green_chess/black-augnw.png diff --git a/resources/images/pieces/green_chess/black-bishop.png b/dev-utils/images/pieces/green_chess/black-bishop.png similarity index 100% rename from resources/images/pieces/green_chess/black-bishop.png rename to dev-utils/images/pieces/green_chess/black-bishop.png diff --git a/resources/images/pieces/green_chess/black-bpawn.png b/dev-utils/images/pieces/green_chess/black-bpawn.png similarity index 100% rename from resources/images/pieces/green_chess/black-bpawn.png rename to dev-utils/images/pieces/green_chess/black-bpawn.png diff --git a/resources/images/pieces/green_chess/black-bpawn2.png b/dev-utils/images/pieces/green_chess/black-bpawn2.png similarity index 100% rename from resources/images/pieces/green_chess/black-bpawn2.png rename to dev-utils/images/pieces/green_chess/black-bpawn2.png diff --git a/resources/images/pieces/green_chess/black-centaur.png b/dev-utils/images/pieces/green_chess/black-centaur.png similarity index 100% rename from resources/images/pieces/green_chess/black-centaur.png rename to dev-utils/images/pieces/green_chess/black-centaur.png diff --git a/resources/images/pieces/green_chess/black-chancel.png b/dev-utils/images/pieces/green_chess/black-chancel.png similarity index 100% rename from resources/images/pieces/green_chess/black-chancel.png rename to dev-utils/images/pieces/green_chess/black-chancel.png diff --git a/resources/images/pieces/green_chess/black-commonr.png b/dev-utils/images/pieces/green_chess/black-commonr.png similarity index 100% rename from resources/images/pieces/green_chess/black-commonr.png rename to dev-utils/images/pieces/green_chess/black-commonr.png diff --git a/resources/images/pieces/green_chess/black-grassh.png b/dev-utils/images/pieces/green_chess/black-grassh.png similarity index 100% rename from resources/images/pieces/green_chess/black-grassh.png rename to dev-utils/images/pieces/green_chess/black-grassh.png diff --git a/resources/images/pieces/green_chess/black-king.png b/dev-utils/images/pieces/green_chess/black-king.png similarity index 100% rename from resources/images/pieces/green_chess/black-king.png rename to dev-utils/images/pieces/green_chess/black-king.png diff --git a/resources/images/pieces/green_chess/black-knight.png b/dev-utils/images/pieces/green_chess/black-knight.png similarity index 100% rename from resources/images/pieces/green_chess/black-knight.png rename to dev-utils/images/pieces/green_chess/black-knight.png diff --git a/resources/images/pieces/green_chess/black-nightrd.png b/dev-utils/images/pieces/green_chess/black-nightrd.png similarity index 100% rename from resources/images/pieces/green_chess/black-nightrd.png rename to dev-utils/images/pieces/green_chess/black-nightrd.png diff --git a/resources/images/pieces/green_chess/black-nrking.png b/dev-utils/images/pieces/green_chess/black-nrking.png similarity index 100% rename from resources/images/pieces/green_chess/black-nrking.png rename to dev-utils/images/pieces/green_chess/black-nrking.png diff --git a/resources/images/pieces/green_chess/black-pawn.png b/dev-utils/images/pieces/green_chess/black-pawn.png similarity index 100% rename from resources/images/pieces/green_chess/black-pawn.png rename to dev-utils/images/pieces/green_chess/black-pawn.png diff --git a/resources/images/pieces/green_chess/black-queen.png b/dev-utils/images/pieces/green_chess/black-queen.png similarity index 100% rename from resources/images/pieces/green_chess/black-queen.png rename to dev-utils/images/pieces/green_chess/black-queen.png diff --git a/resources/images/pieces/green_chess/black-rknight.png b/dev-utils/images/pieces/green_chess/black-rknight.png similarity index 100% rename from resources/images/pieces/green_chess/black-rknight.png rename to dev-utils/images/pieces/green_chess/black-rknight.png diff --git a/resources/images/pieces/green_chess/black-rook.png b/dev-utils/images/pieces/green_chess/black-rook.png similarity index 100% rename from resources/images/pieces/green_chess/black-rook.png rename to dev-utils/images/pieces/green_chess/black-rook.png diff --git a/resources/images/pieces/green_chess/black-rook4.png b/dev-utils/images/pieces/green_chess/black-rook4.png similarity index 100% rename from resources/images/pieces/green_chess/black-rook4.png rename to dev-utils/images/pieces/green_chess/black-rook4.png diff --git a/resources/images/pieces/green_chess/black-rqueen.png b/dev-utils/images/pieces/green_chess/black-rqueen.png similarity index 100% rename from resources/images/pieces/green_chess/black-rqueen.png rename to dev-utils/images/pieces/green_chess/black-rqueen.png diff --git a/resources/images/pieces/green_chess/white-amazon.png b/dev-utils/images/pieces/green_chess/white-amazon.png similarity index 100% rename from resources/images/pieces/green_chess/white-amazon.png rename to dev-utils/images/pieces/green_chess/white-amazon.png diff --git a/resources/images/pieces/green_chess/white-archbis.png b/dev-utils/images/pieces/green_chess/white-archbis.png similarity index 100% rename from resources/images/pieces/green_chess/white-archbis.png rename to dev-utils/images/pieces/green_chess/white-archbis.png diff --git a/resources/images/pieces/green_chess/white-augna.png b/dev-utils/images/pieces/green_chess/white-augna.png similarity index 100% rename from resources/images/pieces/green_chess/white-augna.png rename to dev-utils/images/pieces/green_chess/white-augna.png diff --git a/resources/images/pieces/green_chess/white-augnd.png b/dev-utils/images/pieces/green_chess/white-augnd.png similarity index 100% rename from resources/images/pieces/green_chess/white-augnd.png rename to dev-utils/images/pieces/green_chess/white-augnd.png diff --git a/resources/images/pieces/green_chess/white-augnf.png b/dev-utils/images/pieces/green_chess/white-augnf.png similarity index 100% rename from resources/images/pieces/green_chess/white-augnf.png rename to dev-utils/images/pieces/green_chess/white-augnf.png diff --git a/resources/images/pieces/green_chess/white-augnw.png b/dev-utils/images/pieces/green_chess/white-augnw.png similarity index 100% rename from resources/images/pieces/green_chess/white-augnw.png rename to dev-utils/images/pieces/green_chess/white-augnw.png diff --git a/resources/images/pieces/green_chess/white-bishop.png b/dev-utils/images/pieces/green_chess/white-bishop.png similarity index 100% rename from resources/images/pieces/green_chess/white-bishop.png rename to dev-utils/images/pieces/green_chess/white-bishop.png diff --git a/resources/images/pieces/green_chess/white-bpawn.png b/dev-utils/images/pieces/green_chess/white-bpawn.png similarity index 100% rename from resources/images/pieces/green_chess/white-bpawn.png rename to dev-utils/images/pieces/green_chess/white-bpawn.png diff --git a/resources/images/pieces/green_chess/white-bpawn2.png b/dev-utils/images/pieces/green_chess/white-bpawn2.png similarity index 100% rename from resources/images/pieces/green_chess/white-bpawn2.png rename to dev-utils/images/pieces/green_chess/white-bpawn2.png diff --git a/resources/images/pieces/green_chess/white-centaur.png b/dev-utils/images/pieces/green_chess/white-centaur.png similarity index 100% rename from resources/images/pieces/green_chess/white-centaur.png rename to dev-utils/images/pieces/green_chess/white-centaur.png diff --git a/resources/images/pieces/green_chess/white-chancel.png b/dev-utils/images/pieces/green_chess/white-chancel.png similarity index 100% rename from resources/images/pieces/green_chess/white-chancel.png rename to dev-utils/images/pieces/green_chess/white-chancel.png diff --git a/resources/images/pieces/green_chess/white-commonr.png b/dev-utils/images/pieces/green_chess/white-commonr.png similarity index 100% rename from resources/images/pieces/green_chess/white-commonr.png rename to dev-utils/images/pieces/green_chess/white-commonr.png diff --git a/resources/images/pieces/green_chess/white-grassh.png b/dev-utils/images/pieces/green_chess/white-grassh.png similarity index 100% rename from resources/images/pieces/green_chess/white-grassh.png rename to dev-utils/images/pieces/green_chess/white-grassh.png diff --git a/resources/images/pieces/green_chess/white-king.png b/dev-utils/images/pieces/green_chess/white-king.png similarity index 100% rename from resources/images/pieces/green_chess/white-king.png rename to dev-utils/images/pieces/green_chess/white-king.png diff --git a/resources/images/pieces/green_chess/white-knight.png b/dev-utils/images/pieces/green_chess/white-knight.png similarity index 100% rename from resources/images/pieces/green_chess/white-knight.png rename to dev-utils/images/pieces/green_chess/white-knight.png diff --git a/resources/images/pieces/green_chess/white-nightrd.png b/dev-utils/images/pieces/green_chess/white-nightrd.png similarity index 100% rename from resources/images/pieces/green_chess/white-nightrd.png rename to dev-utils/images/pieces/green_chess/white-nightrd.png diff --git a/resources/images/pieces/green_chess/white-nrking.png b/dev-utils/images/pieces/green_chess/white-nrking.png similarity index 100% rename from resources/images/pieces/green_chess/white-nrking.png rename to dev-utils/images/pieces/green_chess/white-nrking.png diff --git a/resources/images/pieces/green_chess/white-pawn.png b/dev-utils/images/pieces/green_chess/white-pawn.png similarity index 100% rename from resources/images/pieces/green_chess/white-pawn.png rename to dev-utils/images/pieces/green_chess/white-pawn.png diff --git a/resources/images/pieces/green_chess/white-queen.png b/dev-utils/images/pieces/green_chess/white-queen.png similarity index 100% rename from resources/images/pieces/green_chess/white-queen.png rename to dev-utils/images/pieces/green_chess/white-queen.png diff --git a/resources/images/pieces/green_chess/white-rknight.png b/dev-utils/images/pieces/green_chess/white-rknight.png similarity index 100% rename from resources/images/pieces/green_chess/white-rknight.png rename to dev-utils/images/pieces/green_chess/white-rknight.png diff --git a/resources/images/pieces/green_chess/white-rook.png b/dev-utils/images/pieces/green_chess/white-rook.png similarity index 100% rename from resources/images/pieces/green_chess/white-rook.png rename to dev-utils/images/pieces/green_chess/white-rook.png diff --git a/resources/images/pieces/green_chess/white-rook4.png b/dev-utils/images/pieces/green_chess/white-rook4.png similarity index 100% rename from resources/images/pieces/green_chess/white-rook4.png rename to dev-utils/images/pieces/green_chess/white-rook4.png diff --git a/resources/images/pieces/green_chess/white-rqueen.png b/dev-utils/images/pieces/green_chess/white-rqueen.png similarity index 100% rename from resources/images/pieces/green_chess/white-rqueen.png rename to dev-utils/images/pieces/green_chess/white-rqueen.png diff --git a/resources/images/pieces/miscellaneous/Rose/Screen Shot 2024-05-26 at 2.54.14 PM.png b/dev-utils/images/pieces/miscellaneous/Rose/Screen Shot 2024-05-26 at 2.54.14 PM.png similarity index 100% rename from resources/images/pieces/miscellaneous/Rose/Screen Shot 2024-05-26 at 2.54.14 PM.png rename to dev-utils/images/pieces/miscellaneous/Rose/Screen Shot 2024-05-26 at 2.54.14 PM.png diff --git a/resources/images/pieces/miscellaneous/Rose/Screen Shot 2024-05-26 at 2.59.47 PM.png b/dev-utils/images/pieces/miscellaneous/Rose/Screen Shot 2024-05-26 at 2.59.47 PM.png similarity index 100% rename from resources/images/pieces/miscellaneous/Rose/Screen Shot 2024-05-26 at 2.59.47 PM.png rename to dev-utils/images/pieces/miscellaneous/Rose/Screen Shot 2024-05-26 at 2.59.47 PM.png diff --git a/resources/images/pieces/miscellaneous/Zebra flower texture by chessguyyy.png b/dev-utils/images/pieces/miscellaneous/Zebra flower texture by chessguyyy.png similarity index 100% rename from resources/images/pieces/miscellaneous/Zebra flower texture by chessguyyy.png rename to dev-utils/images/pieces/miscellaneous/Zebra flower texture by chessguyyy.png diff --git a/resources/images/pieces/pychess/hawksB.png b/dev-utils/images/pieces/pychess/hawksB.png similarity index 100% rename from resources/images/pieces/pychess/hawksB.png rename to dev-utils/images/pieces/pychess/hawksB.png diff --git a/resources/images/pieces/pychess/hawksW.png b/dev-utils/images/pieces/pychess/hawksW.png similarity index 100% rename from resources/images/pieces/pychess/hawksW.png rename to dev-utils/images/pieces/pychess/hawksW.png diff --git a/resources/images/pieces/stockfish/1pawn_w.png b/dev-utils/images/pieces/stockfish/1pawn_w.png similarity index 100% rename from resources/images/pieces/stockfish/1pawn_w.png rename to dev-utils/images/pieces/stockfish/1pawn_w.png diff --git a/resources/images/pieces/stockfish/2knight_w.png b/dev-utils/images/pieces/stockfish/2knight_w.png similarity index 100% rename from resources/images/pieces/stockfish/2knight_w.png rename to dev-utils/images/pieces/stockfish/2knight_w.png diff --git a/resources/images/pieces/stockfish/3bishop_w.png b/dev-utils/images/pieces/stockfish/3bishop_w.png similarity index 100% rename from resources/images/pieces/stockfish/3bishop_w.png rename to dev-utils/images/pieces/stockfish/3bishop_w.png diff --git a/resources/images/pieces/stockfish/4rook_w.png b/dev-utils/images/pieces/stockfish/4rook_w.png similarity index 100% rename from resources/images/pieces/stockfish/4rook_w.png rename to dev-utils/images/pieces/stockfish/4rook_w.png diff --git a/resources/images/pieces/stockfish/7king_w.png b/dev-utils/images/pieces/stockfish/7king_w.png similarity index 100% rename from resources/images/pieces/stockfish/7king_w.png rename to dev-utils/images/pieces/stockfish/7king_w.png diff --git a/resources/images/pieces/stockfish/8queen_w.png b/dev-utils/images/pieces/stockfish/8queen_w.png similarity index 100% rename from resources/images/pieces/stockfish/8queen_w.png rename to dev-utils/images/pieces/stockfish/8queen_w.png diff --git a/resources/images/pieces/stockfish/bishop_b.png b/dev-utils/images/pieces/stockfish/bishop_b.png similarity index 100% rename from resources/images/pieces/stockfish/bishop_b.png rename to dev-utils/images/pieces/stockfish/bishop_b.png diff --git a/resources/images/pieces/stockfish/king_b.png b/dev-utils/images/pieces/stockfish/king_b.png similarity index 100% rename from resources/images/pieces/stockfish/king_b.png rename to dev-utils/images/pieces/stockfish/king_b.png diff --git a/resources/images/pieces/stockfish/knight_b.png b/dev-utils/images/pieces/stockfish/knight_b.png similarity index 100% rename from resources/images/pieces/stockfish/knight_b.png rename to dev-utils/images/pieces/stockfish/knight_b.png diff --git a/resources/images/pieces/stockfish/pawn_b.png b/dev-utils/images/pieces/stockfish/pawn_b.png similarity index 100% rename from resources/images/pieces/stockfish/pawn_b.png rename to dev-utils/images/pieces/stockfish/pawn_b.png diff --git a/resources/images/pieces/stockfish/queen_b.png b/dev-utils/images/pieces/stockfish/queen_b.png similarity index 100% rename from resources/images/pieces/stockfish/queen_b.png rename to dev-utils/images/pieces/stockfish/queen_b.png diff --git a/resources/images/pieces/stockfish/rook_b.png b/dev-utils/images/pieces/stockfish/rook_b.png similarity index 100% rename from resources/images/pieces/stockfish/rook_b.png rename to dev-utils/images/pieces/stockfish/rook_b.png diff --git a/resources/readme.md b/dev-utils/readme.md similarity index 100% rename from resources/readme.md rename to dev-utils/readme.md diff --git a/resources/scripts/bigint.js b/dev-utils/scripts/bigint.js similarity index 100% rename from resources/scripts/bigint.js rename to dev-utils/scripts/bigint.js diff --git a/resources/scripts/gl-matrix.js b/dev-utils/scripts/gl-matrix.js similarity index 100% rename from resources/scripts/gl-matrix.js rename to dev-utils/scripts/gl-matrix.js diff --git a/resources/sounds/fesliyan_studios/Clock-ticking-Turning-3.mp3 b/dev-utils/sounds/fesliyan_studios/Clock-ticking-Turning-3.mp3 similarity index 100% rename from resources/sounds/fesliyan_studios/Clock-ticking-Turning-3.mp3 rename to dev-utils/sounds/fesliyan_studios/Clock-ticking-Turning-3.mp3 diff --git a/resources/sounds/infinite_chess/Marimba_c2 hard.mp3 b/dev-utils/sounds/infinite_chess/Marimba_c2 hard.mp3 similarity index 100% rename from resources/sounds/infinite_chess/Marimba_c2 hard.mp3 rename to dev-utils/sounds/infinite_chess/Marimba_c2 hard.mp3 diff --git a/resources/sounds/infinite_chess/Marimba_c2 soft.mp3 b/dev-utils/sounds/infinite_chess/Marimba_c2 soft.mp3 similarity index 100% rename from resources/sounds/infinite_chess/Marimba_c2 soft.mp3 rename to dev-utils/sounds/infinite_chess/Marimba_c2 soft.mp3 diff --git a/resources/sounds/infinite_chess/Ticking reverb.mp3 b/dev-utils/sounds/infinite_chess/Ticking reverb.mp3 similarity index 100% rename from resources/sounds/infinite_chess/Ticking reverb.mp3 rename to dev-utils/sounds/infinite_chess/Ticking reverb.mp3 diff --git a/resources/sounds/infinite_chess/Ticking.mp3 b/dev-utils/sounds/infinite_chess/Ticking.mp3 similarity index 100% rename from resources/sounds/infinite_chess/Ticking.mp3 rename to dev-utils/sounds/infinite_chess/Ticking.mp3 diff --git a/resources/sounds/infinite_chess/afk_timer.mp3 b/dev-utils/sounds/infinite_chess/afk_timer.mp3 similarity index 100% rename from resources/sounds/infinite_chess/afk_timer.mp3 rename to dev-utils/sounds/infinite_chess/afk_timer.mp3 diff --git a/resources/sounds/infinite_chess/base_c2.mp3 b/dev-utils/sounds/infinite_chess/base_c2.mp3 similarity index 100% rename from resources/sounds/infinite_chess/base_c2.mp3 rename to dev-utils/sounds/infinite_chess/base_c2.mp3 diff --git a/resources/sounds/infinite_chess/bell.mp3 b/dev-utils/sounds/infinite_chess/bell.mp3 similarity index 100% rename from resources/sounds/infinite_chess/bell.mp3 rename to dev-utils/sounds/infinite_chess/bell.mp3 diff --git a/resources/sounds/infinite_chess/countdownfull.mp3 b/dev-utils/sounds/infinite_chess/countdownfull.mp3 similarity index 100% rename from resources/sounds/infinite_chess/countdownfull.mp3 rename to dev-utils/sounds/infinite_chess/countdownfull.mp3 diff --git a/resources/sounds/infinite_chess/draw.mp3 b/dev-utils/sounds/infinite_chess/draw.mp3 similarity index 100% rename from resources/sounds/infinite_chess/draw.mp3 rename to dev-utils/sounds/infinite_chess/draw.mp3 diff --git a/resources/sounds/infinite_chess/drum_1.mp3 b/dev-utils/sounds/infinite_chess/drum_1.mp3 similarity index 100% rename from resources/sounds/infinite_chess/drum_1.mp3 rename to dev-utils/sounds/infinite_chess/drum_1.mp3 diff --git a/resources/sounds/infinite_chess/drum_2.mp3 b/dev-utils/sounds/infinite_chess/drum_2.mp3 similarity index 100% rename from resources/sounds/infinite_chess/drum_2.mp3 rename to dev-utils/sounds/infinite_chess/drum_2.mp3 diff --git a/resources/sounds/infinite_chess/game_start.mp3 b/dev-utils/sounds/infinite_chess/game_start.mp3 similarity index 100% rename from resources/sounds/infinite_chess/game_start.mp3 rename to dev-utils/sounds/infinite_chess/game_start.mp3 diff --git a/resources/sounds/infinite_chess/loss.mp3 b/dev-utils/sounds/infinite_chess/loss.mp3 similarity index 100% rename from resources/sounds/infinite_chess/loss.mp3 rename to dev-utils/sounds/infinite_chess/loss.mp3 diff --git a/resources/sounds/infinite_chess/viloa staccato c3 4.mp3 b/dev-utils/sounds/infinite_chess/viloa staccato c3 4.mp3 similarity index 100% rename from resources/sounds/infinite_chess/viloa staccato c3 4.mp3 rename to dev-utils/sounds/infinite_chess/viloa staccato c3 4.mp3 diff --git a/resources/sounds/infinite_chess/violins 1 staccato c4.mp3 b/dev-utils/sounds/infinite_chess/violins 1 staccato c4.mp3 similarity index 100% rename from resources/sounds/infinite_chess/violins 1 staccato c4.mp3 rename to dev-utils/sounds/infinite_chess/violins 1 staccato c4.mp3 diff --git a/resources/sounds/infinite_chess/win.mp3 b/dev-utils/sounds/infinite_chess/win.mp3 similarity index 100% rename from resources/sounds/infinite_chess/win.mp3 rename to dev-utils/sounds/infinite_chess/win.mp3 diff --git a/resources/sounds/lichess/capture.mp3 b/dev-utils/sounds/lichess/capture.mp3 similarity index 100% rename from resources/sounds/lichess/capture.mp3 rename to dev-utils/sounds/lichess/capture.mp3 diff --git a/resources/sounds/lichess/capture_reverb.mp3 b/dev-utils/sounds/lichess/capture_reverb.mp3 similarity index 100% rename from resources/sounds/lichess/capture_reverb.mp3 rename to dev-utils/sounds/lichess/capture_reverb.mp3 diff --git a/resources/sounds/lichess/lowtime.mp3 b/dev-utils/sounds/lichess/lowtime.mp3 similarity index 100% rename from resources/sounds/lichess/lowtime.mp3 rename to dev-utils/sounds/lichess/lowtime.mp3 diff --git a/resources/sounds/lichess/move.mp3 b/dev-utils/sounds/lichess/move.mp3 similarity index 100% rename from resources/sounds/lichess/move.mp3 rename to dev-utils/sounds/lichess/move.mp3 diff --git a/resources/sounds/lichess/move_reverb.mp3 b/dev-utils/sounds/lichess/move_reverb.mp3 similarity index 100% rename from resources/sounds/lichess/move_reverb.mp3 rename to dev-utils/sounds/lichess/move_reverb.mp3 diff --git a/docs/COPYING.md b/docs/COPYING.md index 2b658d82e..7708bcf6d 100644 --- a/docs/COPYING.md +++ b/docs/COPYING.md @@ -6,7 +6,7 @@ Infinite Chess is free software; you can redistribute and/or modify it under the Infinite Chess is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.en.html) for more details. -See [LICENSE](./LICENSE) for a copy of the GNU Affero General Public License. +See [LICENSE](../LICENSE) for a copy of the GNU Affero General Public License. ## Exceptions (free) diff --git a/docs/NAVIGATING.md b/docs/NAVIGATING.md index e0532b85e..8a918c0e3 100644 --- a/docs/NAVIGATING.md +++ b/docs/NAVIGATING.md @@ -1,55 +1,49 @@ # Navigating the workspace # -This guide gives you several pointers on how to navigate the project, including where to find the game's code! +This guide gives you several pointers on how to navigate the project. The entire source code of the project is located in [src](../src/). -It is assumed you have already gone through the [Setup](./SETUP.md) process. +It is assumed you have already gone through the [Setup](./SETUP.md) process. Whenever you run `nodemon`, [build.mjs](../build.mjs) automatically deploys and minifies all clientside assets of the project from [src](../src/) to the newly created folder `dist`, and an infinite chess server at `https://localhost:3443` is launched. +## Server ## -## Getting Started ## +[src/server](../src/server/) contains all serverside files of the website. -There has been 3 automatically generated accounts for you to test with- -- Member: Has basic member permissions. -- Patron: Has patron-specific permissions (at the moment this holds no difference between member accounts). -- Owner: Has owner permissions, allowing access to otherwise innaccessible pages, including the game's developmental version. - -The password for every one of these accounts is `1`. - - - -## Server.js ## - -Everything starts running from [server.js](../server.js)! +Everything starts running from [server.js](../src/server/server.js)! This configures and starts our http, https, and websocket servers, and it cleans up on closing. +[src/server/game/](../src/server/game/) contains the server-side code for running online play, including the [invites-manager](../src/server/game/invitesmanager.js) and the [game-manager](../src/server/game/gamemanager.js). +Both of these managers use websockets to broadcast changes out to the clients in real-time. -## [views](../views) ## +The websocket server code is located [here](../src/server/wsserver.js). -This contains all our html documents. -The routers that actually send these htmls to the client are located in [../routes/root.js](../routes/root.js) +## Client ## +[src/client](../src/client/) contains all clientside files of the website. +It has subfolders for all the HTML, CSS, JavaScript, sound and image files of the website. -## Public assets ## +[src/client/views](../src/client/views) contains all our HTML documents. -Public items such as css, scripts, audio, images, and more, that are **not** locked behind certain roles, are located in [public](../public). +The routers that actually send these htmls to the client are located in [src/server/routes/root.js](../src/server/routes/root.js). -The play page's minified game code is located in [../public/scripts/game](../public/scripts/game). [app.js](../public/scripts/game/app.js) is loaded separately, and [htmlscript.js](../public/scripts/game/htmlscript.js) is injected directly into the html before serving to the client! +[src/client/scripts/game/](../src/client/scripts/game/) contains all our javascipt code for running the game in the user's browser. +## Accounts ## -## Protected assets ## +There are 3 automatically generated accounts for you to test with- +- `Member`: Has basic member permissions. +- `Patron`: Has patron-specific permissions (at the moment this holds no difference to member accounts). +- `Owner`: Has owner-specific permissions (at the moment this holds no difference to member accounts). + +The password for every one of these accounts is `1`. -Items that are private (i.e. only served to users with the `owner` role), are located in [../protected-owner](../protected-owner). -The game's unminified code is located within [protected-owner/scripts/game](./protected-owner/scripts/game). This contains all the javascript code for the developmental version of the game! To access this developmental version in your browser, go to: -``` -https://localhost:3443/play/devversion -``` -This will forward you to the login page, login with the owner account to access it. The password is `1`. +## Making changes to the repository ## Every game script includes a basic description at the top. [Ask for help](https://discord.com/channels/1114425729569017918/1115358966642393190) in the discord for greater understanding of how each script works! @@ -70,17 +64,6 @@ and under the "Preferences" tab, checking the box next to "Disable cache (while Now, as long as you have developer tools open whenever you refresh, the game will always hard refresh and load your new code. - -## Game ## - -[game](../game) contains the server-side code for running online play, including the [invites-manager](../game/invitesmanager.js) and the [game-manager](../game/gamemanager.js). - -Both of these managers run use websockets to broadcast changes out to the clients in real-time. - -The websocket server code is located [here](../wsserver.js). - - - # FAQ # ### How do I connect to the web server with other devices in my home network? ### diff --git a/nodemon.json b/nodemon.json index 61e301356..0b82f9e0d 100644 --- a/nodemon.json +++ b/nodemon.json @@ -1,8 +1,9 @@ { "ignore": [ "./database/**/*", - "./public/**/*", + "./dist/**/*", "./protected-owner/**/*", "./protected-patron/**/*" - ] -} \ No newline at end of file + ], + "exec": "npm run build && npm run start" +} diff --git a/package-lock.json b/package-lock.json index bc542ccc1..c9c4d8d15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,9 @@ "proper-lockfile": "^4.1.2", "uuid": "^8.3.2", "ws": "^8.16.0" + }, + "devDependencies": { + "terser": "^5.31.2" } }, "node_modules/@babel/runtime": { @@ -35,6 +38,64 @@ "node": ">=6.9.0" } }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, "node_modules/@mapbox/node-pre-gyp": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", @@ -106,6 +167,18 @@ "node": ">= 0.6" } }, + "node_modules/acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -258,6 +331,12 @@ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -323,6 +402,12 @@ "color-support": "bin.js" } }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1567,6 +1652,25 @@ "node": ">=10" } }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -1634,6 +1738,24 @@ "node": ">=10" } }, + "node_modules/terser": { + "version": "5.31.2", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.2.tgz", + "integrity": "sha512-LGyRZVFm/QElZHy/CPr/O4eNZOZIzsrQ92y4v9UJe/pFJjypje2yI3C2FmPtvUEnhadlSbmG2nXtdcjHOjCfxw==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", diff --git a/package.json b/package.json index f8d00f384..40253356b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "infinitechess.org server", "author": "Naviary", "license": "AGPL", - "main": "server.js", + "main": "src/server/server.js", "dependencies": { "bcrypt": "^5.1.1", "cookie-parser": "^1.4.6", @@ -19,5 +19,13 @@ "proper-lockfile": "^4.1.2", "uuid": "^8.3.2", "ws": "^8.16.0" + }, + "devDependencies": { + "terser": "^5.31.2" + }, + "scripts": { + "build": "node build.mjs", + "watch": "nodemon", + "start": "node ." } } diff --git a/protected-owner/css/dev.css b/protected-owner/css/dev.css deleted file mode 100644 index b98026a20..000000000 --- a/protected-owner/css/dev.css +++ /dev/null @@ -1,1496 +0,0 @@ -* { - margin: 0; - padding: 0; - font-family: Verdana; - border: 0; - /* Enable temporarily during dev to see the borders of all elements */ - /* outline: 1px solid rgba(0, 0, 0, 0.191); */ -} - -html { - background-color: rgb(33, 33, 33); -} - -/* Variables */ -:root { - /* 100vw, but with a maximum, so some UIs don't get too big. */ - --vw-capped: clamp(0px, 100vw, 1086px); - --nav-bar-height: 40px; - /* The viewport height, subtract the navigation bar height. */ - --vh-sub-nav: calc(100vh - var(--nav-bar-height)); - /* The minimum between the viewport width and height */ - --vwh: min(var(--vh-sub-nav), var(--vw-capped)); -} - - - -/* Header along the very top of the page */ - -header { - position: fixed; - left: 0; - top: 0; - right: 0; - box-shadow: 0px 1px 5px rgb(107, 107, 107); - height: var(--nav-bar-height); - font-size: 0; - overflow: scroll; - white-space: nowrap; - text-align: center; - background-color: white; - z-index: 1; -} - -header a { - display: inline-block; - text-decoration: none; - line-height: var(--nav-bar-height); - margin-left: 4px; - min-width: 70px; - font-size: 16px; - color: black; -} - -header a:hover { - background-color: rgb(211, 235, 255); -} - -header p { - padding: 0 10px; -} - -/* Start increasing header links width */ -@media only screen and (min-width: 450px) { - - header { - overflow: unset; - } - - header a { - min-width: calc(70px + (100vw - 450px) * 0.15); - } -} - -/* Stop increasing header links width */ -@media only screen and (min-width: 715px) { - - header a { - min-width: 110px; - } -} - - - -/* Everything besides the top navigation bar */ - -main { - position: fixed; - top: var(--nav-bar-height); - bottom: 0; - left: 0; - right: 0; -} - - - -/* Loading Page */ - -.animation-container { - display: flex; - background-color: black; - justify-content: center; /* Center horizontally */ - align-items: center; /* Center vertically */ - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - z-index: -1; - overflow: hidden; -} - -.loading-glow { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - --ring-color: rgb(60,60,60,1); - background: radial-gradient(circle, var(--ring-color) 0%, black 70%); - color: red; - z-index: -1; /* Render below checkers */ - transition: 0.5s; -} - -.loadingGlowAnimation { - animation: loadingGlow 1.2s alternate infinite cubic-bezier(.42,0,.58,1); -} - -@keyframes loadingGlow { - 0% { - transform: scale(1.2); - opacity: 70%; - } - 100% { - transform: scale(2); - } -} - -.loading-glow.loading-glow-error { - --ring-color-error: rgb(60, 45, 45); - background: radial-gradient(circle, var(--ring-color-error) 0%, black 70%); -} - -.loading-text { - color: white; - position: absolute; - font-family: Verdana; - font-size: calc(30px + 1.2vw); - letter-spacing: 0.05em; - font-weight: bold; - animation: 0.6s infinite cubic-bezier(.42,0,.58,1) alternate loadingPulsing, - 1.2s infinite cubic-bezier(.42,0,.58,1) alternate loadingExpand; -} - -@keyframes loadingPulsing { - from { - opacity: 100%; - } - to { - opacity: 60%; - } -} - -@keyframes loadingExpand { - from { - - } - to { - transform: scale(1.04); - } -} - -.loading-error { - color: red; - position: absolute; - font-family: Verdana; - text-align: center; -} - -.loading-error h1 { - font-size: calc(30px + 1.2vw); - letter-spacing: 0.05em; - font-weight: bold; - margin-bottom: 0.1em; -} - -.loading-error p { - font-size: 16px; - padding: 0 1em; -} - -.checkerboard { - width: 100vw; - height: 100svh; - background: repeating-conic-gradient(black 0% 25%, transparent 0% 50%) - 50% / 20vmin 20vmin; -} - -/* Canvas and the Overlay containing all html elements above the canvas */ - -canvas { - position: absolute; - width: 100%; - height: 100%; -} - -#overlay { - position: absolute; - width: 100%; - height: 100%; -} - - - -/* Discord & Game Credits external links on title screen and invite creation screen */ - -.menu-external-links { - position: absolute; - bottom: 0; - right: 0; - left: 0; - z-index: 1; -} - -.menu-external-links .discord-icon { - position: absolute; - left: 0; - bottom: 0; - width: calc(30px + var(--vw-capped) * 0.03); - margin: 8px 17px; - opacity: 0.4; -} - -.menu-external-links .discord-icon:hover { - opacity: 0.55; -} - -.menu-external-links .github-icon { - position: absolute; - left: 0; - bottom: 0; - width: calc(30px + var(--vw-capped) * 0.03); - margin: 10px calc(40px + var(--vw-capped) * 0.054); - opacity: 0.4; -} - -.menu-external-links .github-icon:hover { - opacity: 0.55; -} - -.menu-external-links .credits { - opacity: 0.5; - font-weight: bold; - position: absolute; - right: 0; - bottom: 0; - color: black; - text-decoration: none; - margin: 12px 17px; - font-size: calc(16px + var(--vw-capped) * 0.012) -} - -.menu-external-links .credits:hover { - opacity: 0.7; -} - - - -/* Title Screen: Play, guide, board editor */ - -.title { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - display: grid; - grid-template: min(16vw, 173px, calc(var(--vh-sub-nav) * 0.184)) repeat(3, min(8vw, 86px, calc(var(--vh-sub-nav) * 0.092))) / 1fr min(50vw, 542px, calc(var(--vh-sub-nav) * 0.575)) 1fr; - gap: min(2vw, 22px, calc(var(--vh-sub-nav) * 0.023)); - padding-bottom: min(10vw, 108px, calc(var(--vh-sub-nav) * 0.115)); - justify-content: center; - align-content: center; -} - -.title h1 { - font-size: min(10vw, 108px, calc(var(--vh-sub-nav) * 0.115)); - font-family: Georgia; - color: rgb(0, 0, 0); - text-shadow: 1px 2px 3px rgb(255, 255, 255); - text-align: center; - overflow: visible; - grid-column: 1 / 4; -} - -/* All bubble buttons on title screen have similar design */ -.titlebubble { - box-shadow: 2px 4px 6px 0px rgb(0, 0, 0); - border: 2px solid rgb(139, 139, 139); - border-radius: min(1.3vw, 14px, calc(var(--vh-sub-nav) * 0.015)); - color: rgb(0, 0, 0); - background-color: rgb(255, 255, 255); - background: linear-gradient(to bottom, white, rgb(226, 226, 226), white); -} - -.title button { - font-size: min(2.5vw, 27px, calc(var(--vh-sub-nav) * 0.029)); - grid-column: 2 / 3; -} - -.title button:hover { - /* box-shadow: 0 0 15px 0 rgba(255, 255, 255, 0.51); */ - background: linear-gradient(to bottom, white, rgb(242, 242, 242), white); -} - -.title button:active { - /* background-color: rgb(255, 255, 255); */ - background: linear-gradient(to bottom, white, rgb(255, 255, 255), white); -} - - - -/* Guide */ - -.guide { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - display: grid; - grid-template-rows: calc((var(--vh-sub-nav) - var(--gap)) * 0.85) min(calc(var(--vw-capped) * 0.08), var(--vh-sub-nav) * 0.08); - grid-template-columns: calc(var(--vwh) * 0.86); - --gap: min(1.5vw, 16px, calc(var(--vh-sub-nav) * 0.0173)); - gap: var(--gap); - justify-content: center; - align-content: center; -} - -.guide .guide-contents { - padding: 5%; - overflow-y: scroll; -} - -.guide button { - font-size: calc(var(--vwh) * 0.03); -} - -.guide button:hover { - background: linear-gradient(to bottom, white, rgb(242, 242, 242), white); -} - -.guide button:active { - background: linear-gradient(to bottom, white, rgb(255, 255, 255), white); -} - -.guide h1 { - margin: 0 0 1em; - font-weight: normal; - --edge-color: rgb(249, 249, 249); - background: linear-gradient(to right, var(--edge-color), rgb(228, 228, 228), var(--edge-color)); - border-radius: 0.25em; - padding: 0.25em; -} - -.guide h2 { - margin: 2.25em 0 0; - font-weight: normal; -} - -.guide .line-break { - border: 0; - border-top: 1px solid #adadad; /* Adjust the color as needed */ - margin: 0.5em 0 1em; /* Adjust the spacing as needed */ -} - -.guide p { - margin: 1.5em 0; -} - -.guide li { - margin: 0.75em 0 0.5em 0.5em; -} - -.guide .clear-float { - clear: both; -} - -.guide img { - box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.157); - border-radius: 0.7em; - border: 2px solid rgb(101, 101, 101); - box-sizing: content-box; -} - -.guide .img-promotionlines { - margin: 0.75em 0 0.75em 1.5em; - width: 50%; - aspect-ratio: 1.789 / 1; /* width / height */ - float: right; -} - -.guide .img-kingrookfork { - margin: 0.75em 1.5em 0.75em 0; - float: left; - width: 42%; - aspect-ratio: 1.077 / 1; /* width / height */ -} - -.guide .img-arrowindicators { - margin: 0.75em 0 0.75em 1.5em; - width: 25%; - float: right; - aspect-ratio: 1 / 1; /* width / height */ -} - -.guide .fairy-pieces { - display: flex; - height: min(var(--vwh) * 0.35); - align-items: stretch; - justify-content: center; -} - -.guide .img-fairymoveset { - box-sizing: border-box; - margin: 0 1em 0 0; - height: 100%; - aspect-ratio: 1 / 1; /* width / height */ -} - -.guide .fairy-card-container { - font-size: min(var(--vwh) * 0.02); - display: flex; - box-sizing: border-box; -} - -.guide .left-arrow, .guide .right-arrow { - display: flex; - width: 13%; - flex-shrink: 0; -} - -.guide svg { - box-sizing: border-box; - width: 100%; - padding: 5%; - border-radius: 0.5em; - /* margin: 0.75em 0; */ -} - -.guide svg:hover { - background-color: rgb(224, 224, 224); -} - -.guide svg:active { - background-color: rgb(218, 218, 218); -} - -.guide .fairy-card { - margin: 0 1em; - display: flex; - flex-direction: column; -} - -.guide .space-1 { - flex-grow: 1; -} - -.guide .fairy-card-title { - text-align: center; - font-size: 1.6em; - font-weight: bold; - margin: 0 0 1em; - text-shadow: 0 0.12em 0.2em rgba(0, 0, 0, 0.203); - flex-grow: 0; -} - -.guide .fairy-card-description { - margin: 0; - font-size: 1em; - flex-grow: 0; -} - -.guide .space-2 { - flex-grow: 2; -} - -@media only screen and (max-width: 700px) { - .guide .img-promotionlines, .guide .img-kingrookfork { - float: none; - width: 95%; - margin: 0 auto; - display: block; /* Ensures the image is a block element */ - } -} - -@media only screen and (max-width: 500px) { - .guide .img-arrowindicators { - width: 96px; - } -} - -@media only screen and (max-width: 600px), (max-height: 648px) { - .guide .img-fairymoveset { - width: 95%; - height: unset; - margin: 0 0 0.75em; - } - - .guide .fairy-card-container { - padding-bottom: 0.75em; - min-height: 18em; - } - - .guide .left-arrow, .guide .right-arrow { - display: flex; - max-width: 50px; - } - - .guide .fairy-pieces { - flex-wrap: wrap; - height: unset; - } - - .guide .fairy-card-title { - font-size: 2.4em; - } - - .guide .fairy-card-description { - font-size: 1.5em; - } -} - - - -/* Play Page: Invite creation screen */ - -.play-selection { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - display: grid; - grid-template: repeat(2, min(8vw, 86px, calc(var(--vh-sub-nav) * 0.092))) min(50vw, 542px, calc(var(--vh-sub-nav) * 0.575)) min(8vw, 86px, calc(var(--vh-sub-nav) * 0.092)) / repeat(6, min(13vw, 141px, calc(var(--vh-sub-nav) * 0.15))); - gap: min(1.5vw, 16px, calc(var(--vh-sub-nav) * 0.0173)); - justify-content: center; - align-content: center; - margin-bottom: 8vh; -} - -.play-selection button { - font-size: min(2.5vw, 27px, calc(var(--vh-sub-nav) * 0.029)); -} - -.play-selection button:hover { - background: linear-gradient(to bottom, white, rgb(242, 242, 242), white); -} - -.play-selection button:active { - background: linear-gradient(to bottom, white, rgb(255, 255, 255), white); -} - -.play-selection .play-name { - grid-column: 1 / 7; - align-self: center; - justify-self: center; - font-size: min(2.5vw, 27px, calc(var(--vh-sub-nav) * 0.029)); -} - -.play-selection .online { - grid-column: 1 / 3; -} - -.play-selection .local { - grid-column: 3 / 5; -} - -.play-selection .computer { - grid-column: 5 / 7; -} - -.play-selection .create-invite { - grid-column: 1 / 4; - background: linear-gradient(to bottom, white, rgb(226, 226, 226), white); -} - -.play-selection .play-back { - grid-column: 4 / 7; -} - -.play-selection .selected { - box-shadow: none; -} - -.play-selection .game-options { - font-size: min(2.5vw, 27px, calc(var(--vh-sub-nav) * 0.029)); - grid-column: 1 / 7; - overflow-y: auto; - display: flex; - flex-direction: column; -} - -/* Target the scrollbar */ -.game-options::-webkit-scrollbar { - width: 9px; /* Set the width of the scrollbar */ -} - -/* Set the background color of the scrollbar track */ -.game-options::-webkit-scrollbar-track { - background-color: #f1f1f1; - border-radius: 5px; /* Set the border radius of the track */ -} - -/* Set the color and border radius of the scrollbar thumb */ -.game-options::-webkit-scrollbar-thumb { - background-color: rgb(174, 174, 174); - border-radius: 5px; /* Set the border radius of the thumb */ -} - -.game-options .options { - background: linear-gradient(to bottom, white, rgb(229, 229, 229), white); - border-bottom: 2px solid rgb(168, 168, 168); - /* border-radius: min(1.3vw, 30px) min(1.3vw, 30px) 0 0; */ - border-radius: min(1.3vw, 30px, calc(var(--vh-sub-nav) * 0.015)); - display: flex; - justify-content: center; -} - -.option-card { - display: flex; - flex-flow: column; - align-items: center; - padding: 0.35em 1.1em; -} - -.game-options .option-card p { - font-size: min(1.5vw, 16px, calc(var(--vh-sub-nav) * 0.017)); - text-align: center; - padding-bottom: 0.3em; -} - -.game-options select { - border: 1.5px solid grey; - border-radius: 0.75em; - padding: 0.6em 0.9em; - font-size: min(1.5vw, 16px, calc(var(--vh-sub-nav) * 0.017)); - box-sizing: content-box; - min-width: 3em; - max-width: 6em; - text-align: center; - - /* Remove arrow */ - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; -} - -#option-clock { - max-width: 5em; -} - -.invite-list { - flex-grow: 1; -} - -.game-options .join-existing { - text-align: center; - font-size: min(1.7vw, 18px, calc(var(--vh-sub-nav) * 0.020)); - padding: 0.5em; -} - -.game-options .invite { - background-color: rgba(0, 0, 255, 0.227); - height: 3em; - display: flex; - align-items: center; - font-size: min(1.7vw, 18px, calc(var(--vh-sub-nav) * 0.020)); - justify-content: space-between; - margin: 0.4em; - border-radius: 0.3em; -} - -.invite .invite-child { - padding: 0 0.6em; -} - -.invite .invite-child.accept { - margin-right: 0.8em; - padding: 0.5em 0.8em; - border-radius: 0.5em; -} - -.invite.hover { - background-color: rgba(48, 145, 255, 0.442); -} - -.invite.hover .accept { - background-color: rgba(255, 255, 255, 0.299); -} - -.invite.ours { - background-color: rgba(156, 36, 255, 0.303); -} - -.invite.ours.hover { - background-color: rgba(255, 36, 178, 0.266); -} - -.invite.private { - background-color: rgba(0, 0, 0, 0.266); -} - -.invite.private.hover { - background-color: rgba(0, 0, 0, 0.22); -} - -.join-private, .invite-code { - display: flex; - justify-content: center; - align-items: center; - font-size: 0.9em; - background: linear-gradient(to bottom, white, rgb(229, 229, 229), white); - padding: 0.5em 0; - border-top: 2px solid rgb(168, 168, 168); - border-radius: min(1.3vw, 30px, calc(var(--vh-sub-nav) * 0.015)); -} - -.textbox-private { - font-size: 0.8em; - margin: 0 1.8em 0 1em; - text-align: center; - background-color: rgba(255, 255, 255, 0.291); - border: 0; - border-radius: 0.5em; - padding: 0.4em 0; - box-shadow: 0 0 0.4em rgba(0, 0, 0, 0.398); - width: 4.6em; -} - -.textbox-private:hover { - box-shadow: 0 0 0.4em rgba(0, 0, 0, 0.631); -} - -.textbox-private:focus { - outline: solid 1px black; -} - -.invite-code-code { - font-size: 1.1em; - margin: 0 1.1em 0 0.7em; - text-shadow: 0.05em 0.1em 0.15em rgba(0, 0, 0, 0.175); - font-weight: bold; -} - -button.join-button, button.copy-button { - font-size: 0.8em; - background-color: white; - padding: 0.45em 0.65em; - border-radius: 0.6em; - box-shadow: 0 0 0.4em rgba(0, 0, 0, 0.649); - background: linear-gradient(to bottom, white, rgb(226, 226, 226), white); -} - - - -/* Top Navigation: Zoom buttons, coordinates, rewind/forward game, pause */ - -.navigation { - position: absolute; - top: 0; - width: 100%; - font-size: 84px; /* Update with doc!! */ - height: 1em; - display: flex; - box-shadow: 0px 1px 7px 0px rgba(0, 0, 0, 0.659); - background: linear-gradient(to top, rgba(255, 255, 255, 0.104), rgba(255, 255, 255, 0.552), rgba(255, 255, 255, 0.216)); - backdrop-filter: blur(8px); /* Apply a blur effect to the background */ - -webkit-backdrop-filter: blur(5px); /* Fixes blur for Safari */ -} - -.teleport, .coords, .right-nav { - display: flex; - align-items: center; -} - -.teleport { - justify-content: flex-start; - padding-left: 0.14em; -} - -.coords { - justify-content: center; - flex-grow: 1; -} - -.right-nav { - justify-content: flex-end; - padding-right: 0.14em; -} - -#position { - box-sizing: border-box; - font-size: 0.19em; - height: 4em; - margin: 0.44em; - border-radius: 0.5em; - background-color: rgb(255, 255, 255); - box-shadow: 0px 0px 7px 0px rgba(0, 0, 0, 0.878); - display: flex; - flex-direction: column; - justify-content: center; -} - -.x, .y { - height: 50%; - display: flex; - align-items: center; - justify-content: space-between; -} - -.x { - padding: 0.13em 0 0 0.44em; - border-radius: 0.5em 0.5em 0 0; - border-bottom: 1px solid rgb(161, 161, 161); -} - -.y { - padding: 0 0 0.13em 0.44em; - border-radius: 0 0 0.5em 0.5em; -} - -#x, #y { - margin-right: 0.31em; - padding: 0.06em 0.19em; - border-radius: 0.19em; - min-width: 7.5em; - max-width: 8.75em; - background-color: rgb(245, 245, 245); - color: rgb(37, 37, 37); -} - -.navigation .button { - position: relative; - width: 0.74em; - height: 0.74em; - margin: 0.07em; - border-radius: 0.16em; - background-color: rgb(255, 255, 255); - box-shadow: 0px 0px 7px 0px rgba(0, 0, 0, 0.878); - transition: transform 0.15s; - cursor: pointer; - -webkit-tap-highlight-color: transparent; /* No more blue highlight when tapping buttons on mobile */ -} - -.navigation .button:hover { - transform: scale(1.07); -} - -.navigation .button:active { - transform: scale(1); -} - -.navigation svg { - position: absolute; -} - -/* Start shrinking top navigation bar */ -@media only screen and (max-width: 700px) { /* 700px needs to be updated within camera.updatePIXEL_HEIGHT_OF_NAVS() !!! */ - .navigation { - font-size: 12vw; /* Update with doc!! */ - } -} - -/* Small screens. HIDE the coords and make the buttons bigger! */ -@media only screen and (max-width: 550px) { /* 550 needs to be updated within camera.updatePIXEL_HEIGHT_OF_NAVS() !!! */ - .navigation { - justify-content: space-between; - font-size: 66px; /* Update with doc!! */ - } - - .coords { - display: none; - } -} - -/* Mobile screen, start shrinking the size again */ -@media only screen and (max-width: 368px) { /* 368 needs to be updated within camera.updatePIXEL_HEIGHT_OF_NAVS() !!! */ - .navigation { - font-size: 17.9vw; /* Update with doc!! */ - } -} - - - -/* Bottom Navigation: Color to move, clocks, player names */ - -.footer { - position: absolute; - bottom: 0; - width: 100%; - height: 84px; - box-shadow: 0px -1px 7px 0px rgba(0, 0, 0, 0.659); - display: flex; - background: linear-gradient(to bottom, rgba(255, 255, 255, 0.307), white, rgba(255, 255, 255, 0.84)); - backdrop-filter: blur(8px); /* Apply a blur effect to the background */ - -webkit-backdrop-filter: blur(5px); /* Fixes blur for Safari */ -} - -.timerwhitecontainer, .timerblackcontainer { - display: flex; - align-items: center; -} - -.timerwhitecontainer { - padding: 25px 0 25px 25px; -} - -.timerblackcontainer { - padding: 25px 25px 25px 0; -} - -.timerwhite, .timerblack { - background-color: rgba(121, 121, 121, 0.474); - padding: 15px; - font-size: 20px; - border-radius: 10px; - z-index: 1; -} - -.timerwhite { - background-color: rgb(255, 255, 255); - color: rgb(0, 0, 0); - box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.878); -} - -.timerblack { - background-color: rgb(0, 0, 0); - color: white; - box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.571); -} - -.playerwhite, .playerblack { - display: flex; - align-items: center; - font-size: 18px; -} - -.playerwhite { - padding: 0 10px 0 25px; -} - -.playerblack { - text-align: right; - padding: 0 25px 0 10px; -} - -.whosturn { - flex-grow: 1; - display: flex; - align-items: center; - justify-content: center; - text-align: center; - font-size: 30px; - font-family: "Open Sans"; - font-weight: bold; -} - -.dotwhite, .dotblack { - border: 1px solid black; - width: 22px; - height: 22px; - border-radius: 100%; - margin: 12px; - transition: 0.25s; - flex-shrink: 0; -} - -.dotwhite { - background-color: white; - box-shadow: 0px 0px 9px 0px rgba(0, 0, 0, 0.491); -} - -.dotblack { - background-color: black; - box-shadow: 0px 0px 9px 0px rgba(0, 0, 0, 0.259); -} - -@media only screen and (max-width: 850px) { - .dotwhite, .dotblack { - display: none; - } - .whosturn { - font-size: 24px; - } - .playerwhite, .playerblack { - font-size: 16px; - } - .playerwhite { - padding-left: 20px; - } - .playerblack { - padding-right: 20px; - } - .timerwhitecontainer { - padding: 20px 0 20px 20px; - } - - .timerblackcontainer { - padding: 20px 20px 20px 0; - } - .timerwhite, .timerblack { - padding: 14px 12px; - font-size: 18px; - border-radius: 9px; - } - -} - -@media only screen and (max-width: 502px) { - - .playerwhite, .playerblack { - display: none; - } -} - - - -/* Promotion UI */ - -#promote { - min-width: 280px; - max-width: 400px; - padding: 10px; - border-radius: 10px; - position: absolute; - left: 50%; - top: 50%; - transform: translate(-50%, -50%); - background-color: rgba(255, 255, 255, 0.949); - box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.918); - background-image: url("/img/game/promotions.png"); /* New pieces */ - background-repeat: no-repeat; - background-size: 0; -} - -.promotecolor { - display: flex; - justify-content: space-evenly; - flex-wrap: wrap; - background-image: inherit; - background-repeat: no-repeat; - background-size: 0; -} - -.promotepiececontainer { - background-image: inherit; - background-repeat: no-repeat; - background-size: 0; - width: 80px; - height: 80px; - padding: 3px; - margin: 3px; - border-radius: 10px; -} - -.promotepiececontainer:hover { - background-color: rgba(0, 0, 0, 0.099); -} - -.promotepiececontainer:active { - background-color: rgba(0, 0, 0, 0.158); -} - -.promotepiece { - width: 80px; - height: 80px; - background-image: inherit; - background-repeat: no-repeat; - /* NEEDS TO BE as many times greater than 100% as there are pieces in the promotions spritesheet! 30 pieces => 3000% */ - background-size: 3000%; -} - -.knightsW { - background-position-x: calc(100%/29 * 0); -} - -.knightsB { - background-position-x: calc(100%/29 * 1); -} - -.guardsW { - background-position-x: calc(100%/29 * 2); -} - -.guardsB { - background-position-x: calc(100%/29 * 3); -} - -.bishopsW { - background-position-x: calc(100%/29 * 4); -} - -.bishopsB { - background-position-x: calc(100%/29 * 5); -} - -.rooksW { - background-position-x: calc(100%/29 * 6); -} - -.rooksB { - background-position-x: calc(100%/29 * 7); -} - -.queensW { - background-position-x: calc(100%/29 * 8); -} - -.queensB { - background-position-x: calc(100%/29 * 9); -} - -.archbishopsW { - background-position-x: calc(100%/29 * 10); -} - -.archbishopsB { - background-position-x: calc(100%/29 * 11); -} - -.chancellorsW { - background-position-x: calc(100%/29 * 12); -} - -.chancellorsB { - background-position-x: calc(100%/29 * 13); -} - -.amazonsW { - background-position-x: calc(100%/29 * 14); -} - -.amazonsB { - background-position-x: calc(100%/29 * 15); -} - -.hawksW { - background-position-x: calc(100%/29 * 16); -} - -.hawksB { - background-position-x: calc(100%/29 * 17); -} - -.camelsW { - background-position-x: calc(100%/29 * 18); -} - -.camelsB { - background-position-x: calc(100%/29 * 19); -} - -.giraffesW { - background-position-x: calc(100%/29 * 20); -} - -.giraffesB { - background-position-x: calc(100%/29 * 21); -} - -.zebrasW { - background-position-x: calc(100%/29 * 22); -} - -.zebrasB { - background-position-x: calc(100%/29 * 23); -} - -.centaursW { - background-position-x: calc(100%/29 * 24); -} - -.centaursB { - background-position-x: calc(100%/29 * 25); -} - -.knightridersW { - background-position-x: calc(100%/29 * 26); -} - -.knightridersB { - background-position-x: calc(100%/29 * 27); -} - -.rosesW { - background-position-x: calc(100%/29 * 28); -} - -.rosesB { - background-position-x: calc(100%/29 * 29); -} - - - -/* Pause UI */ - -.pauseUI { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - background-color: rgba(0, 0, 0, 0.849); - padding-bottom: 15vh; - display: grid; - grid-template: repeat(5, min(8vw, 86px)) / repeat(2, min(30vw, 320px)); - gap: min(3vw, 32px); - justify-content: center; - align-content: center; -} - -.pauseUI p.paused, .pauseUI button { - font-size: min(2.5vw, 27px); -} - -.pauseUI p.paused { - color: white; - text-align: center; - align-self: center; -} - -.pauseUI button { - background-color: rgb(228, 228, 228); - box-shadow: 0 0 10px 0 rgba(255, 255, 255, 0.27); - border-radius: min(0.9vw, 10px); - color: rgb(0, 0, 0); - background: linear-gradient(to bottom, white, rgb(199, 199, 199), white); -} - -.pauseUI button:hover { - /* background-color: rgb(255, 255, 255); */ - background: linear-gradient(to bottom, white, rgb(219, 219, 219), white); -} - -.pauseUI button:active { - /* box-shadow: 0 0 15px 0 rgba(255, 255, 255, 0.51); */ - background: linear-gradient(to bottom, white, rgb(230, 230, 230), white); -} - -.pauseUI p.paused, button.paused, button.resume, button.mainmenu { - grid-column: 1 / 3; -} - - - -/* Status text showing alerts and errors */ - -.statusmessage { - position: absolute; - bottom: 84px; - left: 0; - right: 0; - padding: 1em 8%; - z-index: 1; - pointer-events: none; -} - -.statusmessage .statustext { - margin: 0 auto; - padding: 0.4em 3em; - width: fit-content; - font-size: 18px; - text-align: center; - opacity: 0; - white-space: pre-wrap; - line-height: 1.5; -} - -.statustext.ok { - opacity: 1; - color: black; - --color: white; - background: linear-gradient(to right, transparent, var(--color), var(--color), var(--color), var(--color), transparent); -} - -.statustext.error { - opacity: 1; - color: white; - --color: rgb(255, 0, 0); - background: linear-gradient(to right, transparent, var(--color), var(--color), var(--color), var(--color), transparent); -} - - - -/* Status messages along the top-right showing detailed information (move count, fps meter) */ - -#stats { - position: absolute; - top: 0; - width: 100%; - font-size: 22px; -} - -.status { - text-align: right; - margin: 0.4em 0.6em; - word-break: break-all; -} - - - -/* General classes with basic properties */ - -.currPage { - background-color: rgb(236, 236, 236); -} - -.center { - text-align: center; -} - -a { - -webkit-tap-highlight-color: rgba(0, 0, 0, 0.099); -} - -.unavailable { - color: rgb(190, 190, 190); -} - -.flex { - display: flex; -} - -.hidden { - display: none; -} - -.opacity-0_5 { - opacity: 0.5; -} - -.opacity-0_25 { - opacity: 0.25; -} - -.rotate-180 { - transform: rotate(180deg); -} - -.unselectable { - user-select: none; /* Makes the whole div unselectable (would ruin the experience) */ - -moz-user-select: none; - -webkit-user-select: none; - -ms-user-select: none; -} - -.selectable { - user-select: text; - -moz-user-select: text; - -webkit-user-select: text; - -ms-user-select: text; -} - - - -/* Animations */ - -@keyframes fade-in { - from { - opacity: 0%; - } - to { - opacity: 100%; - } -} - -@keyframes fade-out { - 0% { - opacity: 1; - } - 100% { - opacity: 0; - } -} - -.fade-in-1s { - animation: fade-in 1s; -} - -.fade-out-1s { - animation: fade-out 1s; /* UPDATE 1s within the document in the statustext module! */ -} - -.fade-in-2_3s { - animation: fade-in 0.67s; -} - -.fade-out-2_3s { - animation: fade-out 0.67s; /* UPDATE 1s within the document in the statustext module! */ -} - - - -/* Tooltips */ - -.tooltip-dl, .tooltip-d, .tooltip-dr { - position: relative; -} - -/* The main tooltip black box */ -.tooltip-dl::before, .tooltip-d::before, .tooltip-dr::before { - content: attr(data-tooltip); - position: absolute; - top: calc(100% + 8px); - background-color: black; - color: rgb(236, 236, 236); - text-align: center; - border-radius: 6px; - font-size: 12px; - width: max-content; /* Width based on content size */ - max-width: 100px; - padding: 5px 5px; - visibility: hidden; /* Hidden by default */ - opacity: 0; - transition: opacity 0.1s ease-in-out; - /* Hovering over the tooltip won't count as hovering over its parent */ - pointer-events: none; -} - -/* down-left */ -.tooltip-dl::before { - right: 0; -} - -/* down */ -.tooltip-d::before { - left: 50%; - transform: translateX(-50%); /* Shift it left by half of its width */ -} - -/* down-right */ -.tooltip-dr::before { - left: 0; -} - -/* The arrow on the top of the tooltip box */ -.tooltip-dl::after, .tooltip-d::after, .tooltip-dr::after { - content: ""; - position: absolute; - top: calc(100% + 8.5px);; /* Position right below the tooltip */ - left: 50%; - border-width: 5px; - border-style: solid; - border-color: transparent transparent black transparent; - transform: translate(-50%, -100%); - visibility: hidden; /* Hidden by default */ - opacity: 0; - transition: opacity 0.1s ease-in-out; - z-index: 1; - /* Hovering over the tooltip won't count as hovering over its parent */ - pointer-events: none; -} - -/* After 1s of hovering, the tooltip becomes visible */ -.tooltip-dl:hover::before, .tooltip-d:hover::before, .tooltip-dr:hover::before, -.tooltip-dl:hover::after, .tooltip-d:hover::after, .tooltip-dr:hover::after { - visibility: visible; - opacity: 1; - transition-delay: 1s; /* Delay the tooltip appearance */ - z-index: 1; -} - -/* Overwriting styles after you've already started hovering (no delay) */ -.tooltip-dl.fast-transition:hover::before, .tooltip-d.fast-transition:hover::before, .tooltip-dr.fast-transition:hover::before, -.tooltip-dl.fast-transition:hover::after, .tooltip-d.fast-transition:hover::after, .tooltip-dr.fast-transition:hover::after { - transition-delay: 0s; /* Delay the tooltip appearance */ -} - -/* Mobile devices should NOT show the tooltips on hover.. perhaps on active though? */ -@media not (pointer: fine) { - .tooltip-dl:hover::before, .tooltip-d:hover::before, .tooltip-dr:hover::before, - .tooltip-dl:hover::after, .tooltip-d:hover::after, .tooltip-dr:hover::after { - visibility: hidden; - opacity: 0; - transition-delay: 0; /* Delay the tooltip appearance */ - z-index: 0; - } - - .tooltip-dl:active::before, .tooltip-d:active::before, .tooltip-dr:active::before, - .tooltip-dl:active::after, .tooltip-d:active::after, .tooltip-dr:active::after { - visibility: visible; - opacity: 1; - transition-delay: 0.5s; /* Delay the tooltip appearance */ - z-index: 1; - } -} \ No newline at end of file diff --git a/public/scripts/createaccount.js b/public/scripts/createaccount.js deleted file mode 100644 index 97060b1eb..000000000 --- a/public/scripts/createaccount.js +++ /dev/null @@ -1 +0,0 @@ -const usernameInputElement=document.getElementById("username"),emailInputElement=document.getElementById("email"),passwordInputElement=document.getElementById("password"),submitButton=document.getElementById("submit");let data;fetch("/createaccount/data").then((e=>e.json())).then((e=>{data=e}));let usernameHasError=!1;usernameInputElement.addEventListener("input",(e=>{let t=document.getElementById("usernameerror");const n=usernameInputElement.value.length<3,r=!onlyLettersAndNumbers(usernameInputElement.value),a=!!data&&(!n&&-1!==data.reservedUsernames.indexOf(usernameInputElement.value.toLowerCase())),s=!!data&&(!n&&checkProfanity(usernameInputElement.value));n||r||a||s?t||(usernameHasError=!0,createErrorElement("usernameerror","usernameinputline"),usernameInputElement.style.outline="solid 1px red",t=document.getElementById("usernameerror")):t&&(usernameHasError=!1,t.remove(),usernameInputElement.removeAttribute("style")),n&&r?t.textContent="Username must be atleast 3 characters long, and only contain letters A-Z and numbers 0-9":n?t.textContent="Username must be atleast 3 characters long":r?t.textContent="Username must only contain letters A-Z and numbers 0-9":a?t.textContent="That username is reserved":s&&(t.textContent="That username contains a word that is not allowed"),updateSubmitButton()})),usernameInputElement.addEventListener("focusout",(e=>{0===usernameInputElement.value.length||usernameHasError||fetch(`/createaccount/username/${usernameInputElement.value}`).then((e=>e.json())).then((e=>{!0!==e[0]&&(usernameHasError=!0,createErrorElement("usernameerror","usernameinputline"),usernameInputElement.style.outline="solid 1px red",usernameError=document.getElementById("usernameerror"),usernameError.textContent="That username is taken",updateSubmitButton())}))}));let emailHasError=!1;emailInputElement.addEventListener("input",(e=>{let t=document.getElementById("emailerror");const n=!validEmail(emailInputElement.value);n?t||(emailHasError=!0,createErrorElement("emailerror","emailinputline"),emailInputElement.style.outline="solid 1px red",t=document.getElementById("emailerror")):t&&(emailHasError=!1,t.remove(),emailInputElement.removeAttribute("style")),n&&(t.textContent="This is not a valid email"),updateSubmitButton()})),emailInputElement.addEventListener("focusout",(e=>{emailInputElement.value.length>1&&!emailHasError&&fetch(`/createaccount/email/${emailInputElement.value}`).then((e=>e.json())).then((e=>{if(!1===e[0]){emailHasError=!0,createErrorElement("emailerror","emailinputline"),emailInputElement.style.outline="solid 1px red";document.getElementById("emailerror").textContent="This email is already in use",updateSubmitButton()}}))}));let passwordHasError=!1;passwordInputElement.addEventListener("input",(e=>{let t=document.getElementById("passworderror");const n=passwordInputElement.value.length<6||passwordInputElement.value.length>30,r=!validPassword(passwordInputElement.value),a="password"===passwordInputElement.value.toLowerCase();n||r||a?t||(passwordHasError=!0,createErrorElement("passworderror","passwordinputline"),passwordInputElement.style.outline="solid 1px red",t=document.getElementById("passworderror")):t&&(passwordHasError=!1,t.remove(),passwordInputElement.removeAttribute("style")),r?t.textContent="Password is in an incorrect format":n?t.textContent="Password must be between 6-30 characters long":a&&(t.textContent="Password must not be 'password'"),updateSubmitButton()})),submitButton.addEventListener("click",(e=>{e.preventDefault(),!usernameHasError&&!emailHasError&&!passwordHasError&&usernameInputElement.value&&emailInputElement.value&&passwordInputElement.value&&sendForm(usernameInputElement.value,emailInputElement.value,passwordInputElement.value)})),sendForm=function(e,t,n){let r=!1,a={method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({username:e,email:t,password:n})};fetch("/createaccount",a).then((e=>(e.ok&&(r=!0),e.json()))).then((t=>{window.location.href=r?`/member/${e.toLowerCase()}`:"/409"}))},createErrorElement=function(e,t){const n=document.createElement("div");n.className="error",n.id=e,document.getElementById(t).insertAdjacentElement("afterend",n)};const updateSubmitButton=function(){usernameHasError||emailHasError||passwordHasError||!usernameInputElement.value||!emailInputElement.value||!passwordInputElement.value?submitButton.className="unavailable":submitButton.className="ready"};function getCookieValue(e){const t=document.cookie.split("; ");for(let n=0;nt,u=l?t:c,d={startTime:performance.now(),soundPlayed:!1,type:e,startCoords:i,endCoords:r,captured:a,dist:c,distIsGreater:l,duration:150+6*u},m=d.duration-100;d.soundTimeoutID=setTimeout(n,m,d),o.push(d)},update:function(){if(0!==o.length){main.renderThisFrame();for(let e=o.length-1;e>=0;e--){const t=o[e];performance.now()-t.startTime>t.duration&&o.splice(e,1)}}},renderTransparentSquares:function(){if(0===o.length)return;(function(){const e=[],t=[0,0,0,0];for(const n of o)e.push(...i(n.endCoords,t));return buffermodel.createModel_Colored(new Float32Array(e),3,"TRIANGLES")})().render()},renderPieces:function(){if(0===o.length)return;(function(){const e=[];for(const n of o){const o=(performance.now()-n.startTime)/n.duration,i=-.5*Math.cos(o*Math.PI)+.5;let a=n.endCoords[0]-n.startCoords[0],s=n.endCoords[1]-n.startCoords[1];const c=n.dist;let l,u;if(n.distIsGreater){const e=o<.5,r=e?1:-1,d=e?i:1-i,m=t/c;a*=m,s*=m;const p=e?n.startCoords:n.endCoords,g=a*d*r,f=s*d*r;l=p[0]+g,u=p[1]+f}else{const e=a*i,t=s*i;l=n.startCoords[0]+e,u=n.startCoords[1]+t}const d=[l,u];n.captured&&r(e,n.captured.type,n.captured.coords),r(e,n.type,d)}return buffermodel.createModel_ColorTextured(new Float32Array(e),3,"TRIANGLES",pieces.getSpritesheet())})().render()}})}(),area=function(){const e=.03,t=.2,o=1.4,n=10;function i(e,t){if(!e)return console.error("Cannot calculate area from an undefined coords list.");if(0===e.length)return console.error("Cannot calculate area from an empty coords list.");let o=math.getBoxFromCoordsList(e);return t&&(o=math.mergeBoundingBoxes(o,t)),r(o)}function r(o){if(!o)return console.error("Cannot calculate area from an undefined box.");const i=function(o){if(!o)return console.error("Cannot apply padding to an undefined box."),o;const i=math.deepCopyObject(o),r=camera.getPIXEL_HEIGHT_OF_TOP_NAV(),c=camera.getPIXEL_HEIGHT_OF_BOTTOM_NAV(),l=r+c,u=camera.getCanvasHeightVirtualPixels()-l,d=board.gsquareCenter();i.left-=d,i.right+=1-d,i.bottom-=d,i.top+=1-d;let m=math.deepCopyObject(i),p=a(m);if(n<=0)return console.error("iterationsToRecalcPadding must be greater than 0!"),i;for(let o=0;oo&&(a=o),a}function s(e,t,o){return{left:e.left-t,right:e.right+t,bottom:e.bottom-o,top:e.top+o}}function c(e){if(!e)return console.error("Cannot init teleport from an undefined box.");l(r(e))}function l(e,t){if(!e)return console.error("Cannot init teleport from an undefined area.");const o=e.boundingBox,n=movement.getBoardPos(),r=e.coords,a=board.gboundingBox();let s;e.scalew&&IC&&D{const t=Math.cos(n),i=Math.sin(n),r=e[0]*t-e[1]*i,a=e[0]*i+e[1]*t;return[r+o[0],a+o[1]]}));return i}([[F,-L],[F,+L],[F+L,0]],"top"===r?90:"left"===r?180:"bottom"===r?270:"topright"===r?45:"topleft"===r?135:"bottomleft"===r?225:"bottomright"===r?315:0,p);for(let e=0;ec.bottom&&nc.right?u[n]?od[n].coords[0]&&(d[n]={type:e,coords:t}):d[n]={type:e,coords:t}}if(o>c.left&&oc.top?m[o]?np[o].coords[1]&&(p[o]={type:e,coords:t}):p[o]={type:e,coords:t}}{const i=math.getUpDiagonalFromCoords(t),r=[y.left,y.top],a=[y.right,y.bottom],s=math.getUpDiagonalFromCoords(r),c=math.getUpDiagonalFromCoords(a);if(ic){n>y.top||o>y.right?g[i]?of[i].coords[0]&&(f[i]={type:e,coords:t}):f[i]={type:e,coords:t}}}{const i=math.getDownDiagonalFromCoords(t),r=[y.left,y.bottom],a=[y.right,y.top],s=math.getDownDiagonalFromCoords(r),c=math.getDownDiagonalFromCoords(a);if(i>s&&iy.top||ov[i].coords[0]&&(v[i]={type:e,coords:t}):v[i]={type:e,coords:t}:h[i]?o0){const o={},n=movesscript.convertMovesTo1DFormat(e.moves,o);t.turn=o.turn;const i={next_move:"white"===t.turn?"w":"b",fullmove:t.fullMove,make_new_lines:!1,compact_moves:2},r=formatconverter.longToShortMoves(n,i).split("|");t.moves=r}if(e.promotionRanks&&(e.gameRules?e.gameRules.promotionRanks=e.promotionRanks:e.gameRules={promotionRanks:e.promotionRanks}),e.gameRules){const o={};if(e.gameRules.slideLimit&&"Infinity"!==e.gameRules.slideLimit&&(o.slideLimit=e.gameRules.slideLimit),e.gameRules.winConditions){const t={white:[],black:[]};for(const o in e.gameRules.winConditions){const n=e.gameRules.winConditions[o];"both"!==n&&"white"!==n||t.white.push(o),"both"!==n&&"black"!==n||t.black.push(o)}o.winConditions=t}e.promotionRanks&&(o.promotionRanks=[e.promotionRanks[1],e.promotionRanks[0]],o.promotionsAllowed=variant.getPromotionsAllowed(e.startingPosition,o.promotionRanks)),t.gameRules=o}return console.log("longformat after converting to new format:"),console.log(math.deepCopyObject(t)),t}}),board=function(){let e,t,o;const n=.5;let i,r,a,s,c,l,u,d;const m=-.01;let p,g;function f(){!function(){if(perspective.isMouseLocked())return;if(perspective.getEnabled())return a=void 0,void(s=void 0);const e=b();a=e.tile_Float,s=e.tile_Int}(),function(){if(!perspective.isMouseLocked())return;const e=math.convertWorldSpaceToCoords(input.getMouseWorldLocation());a=e,s=[Math.floor(e[0]+n),Math.floor(e[1]+n)]}()}function h(){const e=options.isDebugModeOn()?camera.getScreenBoundingBox(!0):camera.getScreenBoundingBox(!1),t=.5*camera.canvas.height/e.top/camera.getPixelDensity();r=t*movement.getBoardScale()}function v(){c={},l={};for(let e=0;ecamera.canvas.width/2)return;let y=v+b,w=P+(f-d)/a;const C=v+.5,k=y+.5,T=perspective.getEnabled()?m:0;let[S,M,E,B]=p;B*=i;let[x,I,D,R]=g;R*=i;const F=[],L=bufferdata.getDataQuad_ColorTexture3D(l,d,u,f,T,v,P,y,w,S,M,E,B);F.push(...L);const O=bufferdata.getDataQuad_ColorTexture3D(l,d,u,f,T,C,P,k,w,x,I,D,R);F.push(...O);const _=perspective.getEnabled()?t:e;buffermodel.createModel_ColorTextured(new Float32Array(F),3,"TRIANGLES",_).render()}return Object.freeze({gsquareCenter:function(){return n},initTextures:function(){e=texture.loadTexture("tiles",{useMipmaps:!1}),t=texture.loadTexture("tiles256",{useMipmaps:!1}),o=texture.loadTexture("tilesGrey78",{useMipmaps:!1})},gtileWidth_Pixels:function(){return r},recalcVariables:function(){h(),f(),v(),u=math.getBoundingBoxOfBoard(movement.getBoardPos(),movement.getBoardScale(),camera.getScreenBoundingBox()),d=y(u)},gtile_MouseOver_Float:function(){return a},isOffsetOutOfRangeOfRegenRange:function(e,t){const o=movement.getBoardPos(),n=Math.abs(o[0]-e[0]),i=Math.abs(o[1]-e[1]);return n>t||i>t},gpositionFingerOver:function(e){return{id:e,x:c[e][0],y:c[e][1]}},initDarkTilesModel:w,gtile_MouseOver_Int:function(){return s},recalcTileWidth_Pixels:h,gtileCoordsOver:P,roundAwayBoundingBox:y,gboundingBox:function(){return math.deepCopyObject(d)},changeTheme:function(e){e.whiteTiles&&(options.themes[options.gtheme()].whiteTiles=e.whiteTiles),e.darkTiles&&(options.themes[options.gtheme()].darkTiles=e.darkTiles),k(e,"whiteTiles"),k(e,"darkTiles"),k(e,"selectedPieceHighlightColor"),k(e,"legalMovesHighlightColor"),k(e,"lastMoveHighlightColor"),k(e,"checkHighlightColor"),k(e,"useColoredPieces"),T(e,"whitePiecesColor"),T(e,"blackPiecesColor"),T(e,"neutralPiecesColor"),S(),piecesmodel.regenModel(game.getGamefile(),options.getPieceRegenColorArgs()),highlights.regenModel()},gboundingBoxFloat:function(){return math.deepCopyObject(u)},updateTheme:S,resetColor:E,glimitToDampScale:function(){return 1e-5},darkenColor:function(){const e=options.getDefaultTiles(!0),t=options.getDefaultTiles(!1),o=.09;M([e[0]-o,e[1]-o,e[2]-o,1],[t[0]-o,t[1]-o,t[2]-o,1])},render:function(){webgl.executeWithDepthFunc_ALWAYS((()=>{!function(){const e=camera.getZFar()/Math.SQRT2,t=perspective.getEnabled()?m:0,o=camera.getPosition(!0)[2],n=(p[0]+g[0])/2,i=(p[1]+g[1])/2,r=(p[2]+g[2])/2,a=(p[3]+g[3])/2,s=bufferdata.getDataBoxTunnel(-e,-e,o,e,e,t,n,i,r,a);s.push(...bufferdata.getDataQuad_Color3D(-e,-e,e,e,t,n,i,r,a));buffermodel.createModel_Colored(new Float32Array(s),3,"TRIANGLES").render()}(),C(),function(){const e=-math.getBaseLog10(movement.getBoardScale()),t=.5;if(e4||0===t?console.error(`Unsupported array length ${t} for uniform value.`):`uniform${t}fv`}(t);case"matrix":return function(e){const t=e.length;switch(t){case 4:return"uniformMatrix2fv";case 9:return"uniformMatrix3fv";case 16:return"uniformMatrix4fv";default:console.error(`Unsupported matrix size ${t} for uniform value.`)}}(t);case"number":return"uniform1i";default:console.error(`Unsupported uniform type ${e}.`)}}(n,o);if("matrix"===n){const n=!1;return gl[i](e.uniformLocations[t],n,o)}gl[i](e.uniformLocations[t],o)}return Object.freeze({validRenderModes:["TRIANGLES","TRIANGLE_STRIP","TRIANGLE_FAN","POINTS","LINE_LOOP","LINE_STRIP","LINES"],DRAW_HINT:"STATIC_DRAW",createModel_Textured:function(t,o,n,i){if(o<2||o>3)return console.error(`Unsupported numPositionComponents ${o}`);if(null==i)return console.error("Cannot create a textured buffer model without a texture!");const r=o+2,a=e(shaders.programs.textureProgram,o,!0,!1);return new BufferModel(shaders.programs.textureProgram,t,r,n,i,a)},createModel_Colored:function(t,o,n){if(o<2||o>3)return console.error(`Unsupported numPositionComponents ${o}`);const i=o+4,r=e(shaders.programs.colorProgram,o,!1,!0);return new BufferModel(shaders.programs.colorProgram,t,i,n,void 0,r)},createModel_ColorTextured:function(t,o,n,i){if(o<2||o>3)return console.error(`Unsupported numPositionComponents ${o}`);if(null==i)return console.error("Cannot create a textured buffer model without a texture!");const r=o+6,a=e(shaders.programs.coloredTextureProgram,o,!0,!0);return new BufferModel(shaders.programs.coloredTextureProgram,t,r,n,i,a)},createModel_TintTextured:function(t,o,n,i){if(o<2||o>3)return console.error(`Unsupported numPositionComponents ${o}`);if(null==i)return console.error("Cannot create a tinted textured buffer model without a texture!");const r=o+2,a=e(shaders.programs.tintedTextureProgram,o,!0,!1);return new BufferModel(shaders.programs.tintedTextureProgram,t,r,n,i,a)},renderPreppedModel:function(e,t=[0,0,0],n=[1,1,1],i,r,a,s={}){const c=mat4.create();mat4.scale(c,c,n),mat4.translate(c,c,t),gl.uniformMatrix4fv(e.uniformLocations.worldMatrix,gl.FALSE,c);for(const t in s)o(e,t,s[t]);a&&gl.bindTexture(gl.TEXTURE_2D,a),gl.drawArrays(gl[r],0,i),a&&gl.bindTexture(gl.TEXTURE_2D,null)}})}();function BufferModel(e,t,o,n,i,r){if(!math.isFloat32Array(t))return console.error("Cannot create a buffer model without a Float32Array!");if(t.length%o!=0)return console.error("Data length is not divisible by stride when generating a buffer model! Perhaps did you pass in the wrong numPositionComponents, or use the wrong constructor?");if(!buffermodel.validRenderModes.includes(n))return console.error(`Mode "${n}" is not an accepted value!`);this.data=t;const a=t.length/o;let s=i;const c=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,c),gl.bufferData(gl.ARRAY_BUFFER,t,gl[buffermodel.DRAW_HINT]),gl.bindBuffer(gl.ARRAY_BUFFER,null),this.updateBuffer=function(){gl.bindBuffer(gl.ARRAY_BUFFER,c),gl.bufferSubData(gl.ARRAY_BUFFER,0,t),gl.bindBuffer(gl.ARRAY_BUFFER,null)},this.updateBufferIndices=function(e,o){if(e+o-1>t.length-1)return console.error("Cannot update buffer indices when they overflow the data.");const n=e*t.BYTES_PER_ELEMENT;gl.bindBuffer(gl.ARRAY_BUFFER,c),gl.bufferSubData(gl.ARRAY_BUFFER,n,t.subarray(e,e+o)),gl.bindBuffer(gl.ARRAY_BUFFER,null)},this.deleteBuffer=function(){gl.deleteBuffer(c)},this.render=function(i,l,u){r(c,o,t.BYTES_PER_ELEMENT),buffermodel.renderPreppedModel(e,i,l,a,n,s,u)},this.getMode=function(){return n},this.getStride=function(){return o},s&&(this.changeTexture=function(e){s=e})}const camera=function(){const e=[0,0,12],t=[0,0,18];let o=90*Math.PI/180;const n=1,i=1500*Math.SQRT2,r=40,a=window.devicePixelRatio;let s,c,l,u,d,m,p,g,f,h,v=document.getElementById("game");function P(o){return math.deepCopyObject(!o&&options.isDebugModeOn()?t:e)}function b(){l=window.innerWidth,u=window.innerHeight-r,v.width=l*a,v.height=u*a,gl.viewport(0,0,v.width,v.height),y(),m=gl.canvas.clientWidth/gl.canvas.clientHeight,function(){let n=e[2];const i=o/2;let r=Math.tan(i)*n,a=r*m;p={left:-a,right:a,bottom:-r,top:r},n=t[2],r=Math.tan(i)*n,a=r*m,g={left:-a,right:a,bottom:-r,top:r}}(),game.updateVariablesAfterScreenResize(),miniimage.recalcWidthWorld(),function(){mat4.perspective(f,o,m,n,i);for(const e in shaders.programs){const t=shaders.programs[e],o=t.uniformLocations.projectionMatrix;null!=o&&(gl.useProgram(t.program),gl.uniformMatrix4fv(o,gl.FALSE,f))}}()}function y(){s=options.gnavigationVisible()?window.innerWidth>700?84:window.innerWidth>550?.12*window.innerWidth:window.innerWidth>368?66:.179*window.innerWidth:0,c=options.gnavigationVisible()?84:0,main.renderThisFrame(),stats.updateStatsCSS()}function w(e){const t=mat4.create(),o=P();mat4.lookAt(t,o,[0,0,0],[0,1,0]),e||perspective.applyRotations(t),h=t,C()}function C(){for(const e in shaders.programs){const t=shaders.programs[e],o=t.uniformLocations.viewMatrix;null!=o&&(gl.useProgram(t.program),gl.uniformMatrix4fv(o,!1,h))}}return Object.freeze({getPosition:P,getPixelDensity:function(){return a},getPIXEL_HEIGHT_OF_TOP_NAV:function(){return s},getPIXEL_HEIGHT_OF_BOTTOM_NAV:function(){return c},canvas:v,getCanvasWidthVirtualPixels:function(){return l},getCanvasHeightVirtualPixels:function(){return u},getCanvasRect:function(){return math.deepCopyObject(d)},getScreenBoundingBox:function(e){return math.deepCopyObject(e?g:p)},getViewMatrix:function(){return math.copyFloat32Array(h)},init:function(){f=mat4.create(),b(),w(),d=v.getBoundingClientRect()},updatePIXEL_HEIGHT_OF_NAVS:y,setViewMatrix:function(e){h=e,C()},onScreenResize:function(){b(),perspective.initCrosshairModel(),main.renderThisFrame()},onPositionChange:function(){w()},initViewMatrix:w,getZFar:function(){return i}})}(),checkdetection=function(){function e(e,n,i,r){if(!e)throw new Error("Cannot detect if a square of an undefined game is being attacked!");if(!n)return!1;if("white"!==i&&"black"!==i)throw new Error(`Cannot detect if an opponent is attacking the square of the team of color ${i}!`);let a=!1;return function(e,t,n,i){const r=e.vicinity;for(let a in r){const s=r[a],c=math.getCoordsFromKey(a),l=[t[0]+c[0],t[1]+c[1]],u=math.getKeyFromCoords(l),d=e.piecesOrganizedByKey[u];if(!d)continue;if(n===math.getPieceColorFromType(d))continue;const m=math.trimWorBFromType(d);if(s.includes(m))return i&&o(i,{coords:l,slidingCheck:!1}),!0}return!1}(e,n,i,r)&&(a=!0),function(e,t,n,i){const r="white"===n?1:-1;for(let a=-1;a<=1;a+=2){const s=[t[0]-a,t[1]+r];let c=math.getKeyFromCoords(s);const l=e.piecesOrganizedByKey[c];if(!l)continue;if(n===math.getPieceColorFromType(l))continue;if(l.startsWith("pawns"))return i&&o(i,{coords:s,slidingCheck:!1}),!0}return!1}(e,n,i,r)&&(a=!0),function(e,o,n,i){let r=!1;const a=e.piecesOrganizedByRow[o[1]];t(e,a,"horizontal",o,n,i)&&(r=!0);const s=e.piecesOrganizedByColumn[o[0]];t(e,s,"vertical",o,n,i)&&(r=!0);let c=math.getUpDiagonalFromCoords(o),l=e.piecesOrganizedByUpDiagonal[c];t(e,l,"diagonalup",o,n,i)&&(r=!0);c=math.getDownDiagonalFromCoords(o),l=e.piecesOrganizedByDownDiagonal[c],t(e,l,"diagonaldown",o,n,i)&&(r=!0);return r}(e,n,i,r)&&(a=!0),a}function t(e,t,n,i,r,a){if(!t)return!1;for(let s=0;s0&&r},removeMovesThatPutYouInCheck:function(e,o,i,r){wincondition.isOpponentUsingWinCondition(e,"checkmate")&&(function(e,o,n,i){if(!(o.horizontal||o.vertical||o.diagonalUp||o.diagonalDown))return;const r=gamefileutility.getJumpingRoyalCoords(e,i);if(0===r.length)return;if(function(e,t,o,n){if(!e.inCheck)return!1;const i=e.attackers.length;if(0===i)throw new Error("We are in check, but there is no specified attacker!");const r=e.attackers[0];i>1||!legalmoves.checkIfMoveLegal(t,n,r.coords,{ignoreIndividualMoves:!0})||t.individual.push(r.coords);const a=math.chebyshevDistance(n,r.coords);if(!r.slidingCheck||1===a)return s(),!0;return function(e,t,o,n){let i;i=e[1]===t[1]?"horizontal":e[0]===t[0]?"vertical":e[0]>t[0]&&e[1]>t[1]||t[0]>e[0]&&t[1]>e[1]?"diagonalUp":"diagonalDown";const r=math.getUpDiagonalFromCoords(n),a=math.getDownDiagonalFromCoords(n);function s(e,t,i,r){(e>t&&ei&&e{!function(e,o,n,i,r){const a=i.coords,s=n[1]===a[1],c=n[0]===a[0],l=math.getUpDiagonalFromCoords(n),u=math.getUpDiagonalFromCoords(a),d=l===u,m=math.getDownDiagonalFromCoords(n),p=math.getDownDiagonalFromCoords(a),g=m===p;if(!(s||c||d||g))return;const f=math.deepCopyObject(i);if(movepiece.deletePiece(e,i,{updateData:!1}),s){t(e,e.piecesOrganizedByRow[n[1]],"horizontal",n,r,[])&&(o.vertical=void 0,o.diagonalUp=void 0,o.diagonalDown=void 0)}else if(c){t(e,e.piecesOrganizedByColumn[n[0]],"vertical",n,r,[])&&(o.horizontal=void 0,o.diagonalUp=void 0,o.diagonalDown=void 0)}else if(d){const i=math.getUpDiagonalFromCoords(n);t(e,e.piecesOrganizedByUpDiagonal[i],"diagonalup",n,r,[])&&(o.horizontal=void 0,o.vertical=void 0,o.diagonalDown=void 0)}else{const i=math.getDownDiagonalFromCoords(n);t(e,e.piecesOrganizedByDownDiagonal[i],"diagonaldown",n,r,[])&&(o.horizontal=void 0,o.vertical=void 0,o.diagonalUp=void 0)}movepiece.addPiece(e,f.type,f.coords,f.index,{updateData:!1})}(e,o,r,n,i)}))}(e,o,i,r),function(e,t,o,i){if(!t)return;for(let r=t.length-1;r>=0;r--){n(e,o,t[r],i)&&t.splice(r,1)}}(e,o.individual,i,r))},doesMovePutInCheck:n,detectCheckmateOrDraw:function(e){if(function(e){const t=e.moves,o={},n={};let i=0,r=t.length-1;for(;r>=0;){const e=t[r];if(e.captured||e.type.startsWith("pawns"))break;const a=e.endCoords;let s=`${a[0]},${a[1]},${e.type}`;n[s]?delete n[s]:o[s]=!0;const c=e.startCoords;s=`${c[0]},${c[1]},${e.type}`,o[s]?delete o[s]:n[s]=!0;const l=Object.keys(o),u=Object.keys(n);if(0===l.length&&0===u.length&&(i++,2===i))break;r--}return 2===i}(e))return"draw repetition";const t=e.whosTurn,o="white"===t?pieces.white:pieces.black;for(let t=0;t1+1/3)a=1,s=1;else if(o>1){a=1,s=3*(o-1)}else if(n<.5){i=2*n,a=1}else if(n<.75){i=1,a=1-.5*(4*(n-.5))}else{i=1,a=.5-.5*(4*(n-.75))}e.style.outline=`3px solid rgb(${255*i},${255*a},${255*s})`}function v(){const o=P(a.white),n=P(a.black);e.textContent=o,t.textContent=n}function P(e){let t=Math.ceil(e/1e3),o=0;for(;t>=60;)t-=60,o++;return t<0&&(t=0),`${o.toString().padStart(2,"0")}:${t.toString().padStart(2,"0")}`}function b(){if(r.minutes0)m.ticking.timeoutID=setTimeout(k,t);else{k(-t)}}(e),function(e){if(clearTimeout(m.tick.timeoutID),m.tick.sound?.fadeOut(m.tick.fadeOutDuration),onlinegame.areInOnlineGame()&&s!==onlinegame.getOurColor()||!u)return;const t=u-m.tick.timeToStartFromEnd-e;if(t>0)m.tick.timeoutID=setTimeout(T,t);else{T(-t)}}(e)}function C(e){if(!e)return console.error("Cannot play drum without secsRemaining");sound.playSound_drum();if(u-Date.now()<1500)return;const t=e-1;if(0===t)return;const o=u-Date.now()-1e3*t;m.drum.timeoutID=setTimeout(C,o,t)}function k(e){m.ticking.sound=sound.playSound_ticking({fadeInDuration:m.ticking.fadeInDuration,offset:e})}function T(e){m.tick.sound=sound.playSound_tick({volume:.07,fadeInDuration:m.tick.fadeInDuration,offset:e})}return Object.freeze({set:function(e,t){if(!game.getGamefile())return console.error("Game must be initialized before starting the clocks.");const s=function(e){const[t,o]=e.split("+").map((e=>+e));return{minutes:t,increment:o}}(e);if(r.minutes=s.minutes,r.millis=math.minutesToMillis(r.minutes),r.increment=s.increment,i=0===r.minutes&&void 0===r.increment,i)return style.hideElement(o),void style.hideElement(n);style.revealElement(o),style.revealElement(n),t?p(t.timerWhite,t.timerBlack,t.timeNextPlayerLosesAt):(a.white=r.millis,a.black=r.millis),v()},edit:p,stop:g,reset:function(){g(),i=void 0,r.minutes=void 0,r.millis=void 0,r.increment=void 0,a.white=void 0,a.black=void 0,d.whiteNotified=!1,d.blackNotified=!1,m.drum.timeoutID=void 0,m.tick.sound=void 0,m.ticking.sound=void 0,m.tick.timeoutID=void 0,m.ticking.timeoutID=void 0,f(e),f(t)},update:function(){const o=game.getGamefile();if(i||o.gameConclusion||!movesscript.isGameResignable(o)||null==l)return;"white"===s?h(e,a.white):h(t,a.black);const n=Date.now()-l;"white"===s?a.white=Math.ceil(c-n):a.black=Math.ceil(c-n),v(),onlinegame.areInOnlineGame()||(a.white<=0?(o.gameConclusion="black time",gamefileutility.concludeGame(game.getGamefile())):a.black<=0&&(o.gameConclusion="white time",gamefileutility.concludeGame(game.getGamefile())))},push:function(){if(onlinegame.areInOnlineGame())return;if(i)return;const o=game.getGamefile();movesscript.isGameResignable(o)&&(a[s]+=math.secondsToMillis(r.increment),s=s?math.getOppositeColor(s):o.startSnapshot.turn,c=a[s],l=Date.now(),u=l+c,b(),w(),f("white"===s?t:e))},getClockFromKey:function(e){if("0"===e)return"No Clock";const t=e.split("+");return`${t[0]}m+${t[1]}s`},isClockValueInfinite:function(e){return"0"===e},printClocks:function(){console.log(`White time: ${a.white}`),console.log(`Black time: ${a.black}`),console.log(`timeRemainAtTurnStart: ${c}`),console.log(`timeAtTurnStart: ${l}`)}})}(),coin=function(){const e=["xxg","cxhg","dvsi","wnnh","bsfvl","bciph","xwui","lprd","bxksd","brsvd","bnesg","beeud","wst","bqvoe","qmch","jshi","yqyg","rtja","bjohd","lrql","oyqo","bqxv","btqta","bdanl","bjwxi","byhah","zyrk","pdya","vpka","uqxd","tgrk","egzd","bqdhi","gcvh","osae","btrua","bclih","plgh","bfmsl","bsxza"],t="jdhagkleioqcfmnzxyptsuvrw";function o(e){let o=0,n=1,i=e.startsWith("b");i&&(e=e.substring(1));const r=function(e,t){const o=e.length,n=-t%o;return e.slice(n)+e.slice(0,n)}(e,-3);for(let e=r.length-1;e>=0;e--){o+=t.indexOf(r[e])*n,n*=25}return o/=3,i?-o:o}return Object.freeze({appDat:function(t,n,i,r){const{texStartX:a,texStartY:s,texEndX:c,texEndY:l}=bufferdata.getTexDataOfType("yellow");for(let u=0;u0)return statustext.showStatus("Cannot paste game after moves are made!");let o,n;try{o=await navigator.clipboard.readText()}catch(e){const t="Clipboard permission denied. This might be your browser.";return statustext.showStatus(t+"\n"+e,!0)}try{n=JSON.parse(o)}catch(e){try{n=formatconverter.ShortToLong_Format(o,!0,!0)}catch(e){return console.error(e),void statustext.showStatus("Clipboard is not in valid ICN notation.",!0)}}n=backcompatible.getLongformatInNewNotation(n),function(e){e.metadata||(e.metadata={});e.turn||(e.turn="white");e.fullMove||(e.fullMove=1);if(!e.startingPosition&&!e.metadata.Variant)return statustext.showStatus("Game needs to specify either the 'Variant' metadata, or 'startingPosition' property.",!0),!1;e.startingPosition&&!e.specialRights&&(e.specialRights={});e.gameRules||(e.gameRules=variant.getBareMinimumGameRules());return e.gameRules.winConditions=e.gameRules.winConditions||variant.getDefaultWinConditions(),!!function(e){for(let t=0;t{t.metadata[e]=o[e]})),(t.shortposition||t.startingPosition)&&(t.metadata.Date=o.Date);delete t.metadata.Result,delete t.metadata.Condition;const n={turn:t.turn,fullMove:t.fullMove,enpassant:t.enpassant,moveRule:t.moveRule,positionString:t.shortposition,startingPosition:t.startingPosition,specialRights:t.specialRights,gameRules:t.gameRules};if(onlinegame.areInOnlineGame()&&onlinegame.getIsPrivate()){const e=onlinegame.getGameID();localstorage.saveItem(e,n)}const i=new gamefile(t.metadata,{moves:t.moves,variantOptions:n}),r=onlinegame.getIsPrivate()?" Pasting a game in a private match will cause a desync if your opponent doesn't do the same!":"";let a=!1;if(i.startSnapshot.pieceCount>=gamefileutility.pieceCountToDisableCheckmate){a=!0,statustext.showStatus(`Piece count ${i.startSnapshot.pieceCount} exceeded ${gamefileutility.pieceCountToDisableCheckmate}! Changed checkmate win conditions to royalcapture, and toggled off icon rendering. Hit 'P' to re-enable (not recommended).${r}`,!1,1.5);const e=i.gameRules.winConditions.white.includes("checkmate"),t=i.gameRules.winConditions.black.includes("checkmate");e&&(math.removeObjectFromArray(i.gameRules.winConditions.white,"checkmate",!0),i.gameRules.winConditions.white.push("royalcapture")),t&&(math.removeObjectFromArray(i.gameRules.winConditions.black,"checkmate",!0),i.gameRules.winConditions.black.push("royalcapture"))}if(!a){const e=`Loaded game from clipboard!${r}`;statustext.showStatus(e)}game.unloadGame(),game.loadGamefile(i),console.log("Loaded game!")}(n)}})}(),formatconverter=function(){const e={kingsW:"K",kingsB:"k",pawnsW:"P",pawnsB:"p",knightsW:"N",knightsB:"n",bishopsW:"B",bishopsB:"b",rooksW:"R",rooksB:"r",queensW:"Q",queensB:"q",amazonsW:"AM",amazonsB:"am",hawksW:"HA",hawksB:"ha",chancellorsW:"CH",chancellorsB:"ch",archbishopsW:"AR",archbishopsB:"ar",guardsW:"GU",guardsB:"gu",camelsW:"CA",camelsB:"ca",giraffesW:"GI",giraffesB:"gi",zebrasW:"ZE",zebrasB:"ze",centaursW:"CE",centaursB:"ce",royalQueensW:"RQ",royalQueensB:"rq",royalCentaursW:"RC",royalCentaursB:"rc",obstaclesN:"ob",voidsN:"vo"};const t=function(e){let t={};for(let o in e)t[e[o]]=o;return t}(e);function o(t){if(!e[t])throw new Error("Unknown piece type detected: "+t);return e[t]}function n(e){if(!t[e])throw new Error("Unknown piece abbreviation detected: "+e);return t[e]}function i(e){try{JSON.parse(e)}catch(e){return!1}return!0}function r(e,{next_move:t,fullmove:n,make_new_lines:i,compact_moves:r}){if("string"==typeof e[0])return e.join("|");let a="";for(let s=0;s":"x",a+=0==r?" ":"",a+=c.endCoords.toString(),a+=0==r?" ":"",c.promotion&&(a+=0==r||1==r?"=":"",a+=o(c.promotion)),!c.mate||0!=r&&1!=r?!c.check||0!=r&&1!=r||(a+="+"):a+="#",a=a.trimEnd(),"w"==t?t="b":(t="w",n+=1,s!=e.length-1&&0==r&&(a+=i?"\n":" |"))}return a.trimEnd()}function a(e){const t=[];for(e.replace(/[\!\?=]/g,"");e.indexOf("{")>-1;){let t=e.indexOf("{"),o=e.indexOf("}");if(-1==o)throw new Error("Unclosed { found.");e=e.slice(0,t)+"|"+e.slice(o+1)}if(!(e=e.match(/[a-zA-Z]*-?[0-9]+,-?[0-9]+[\s]*(x|>)+[\s]*-?[0-9]+,-?[0-9]+[^\|\.0-9]*/g)))return t;for(let o=0;o${r}${c}`)}return t}function s(e,t={}){let n="";if(!e)return n;for(let i in e)t[i]?n+=`${o(e[i])}${i}+|`:n+=`${o(e[i])}${i}|`;return 0!=n.length&&(n=n.slice(0,-1)),n}function c(e,t,o){const n={},i={},r={};for(const a in e){const s=e[a];t&&s.startsWith("pawns")?n[a]=!0:o&&s.startsWith("kings")?(n[a]=!0,i[a]=u(s)):o&&s.startsWith(o)&&(r[a]=u(s))}if(0===Object.keys(i).length)return n;e:for(const e in r){const t=l(e);for(const o in i){const a=l(o);if(t[1]!==a[1])continue;if(r[e]!==i[o])continue;if(!(Math.abs(t[0]-a[0])<3)){n[e]=!0;continue e}}}return n}function l(e){return e.split(",").map(Number)}function u(e){if(e.endsWith("W"))return"white";if(e.endsWith("B"))return"black";if(e.endsWith("N"))return"neutral";throw new Error(`Cannot get color of piece with type "${e}"!`)}function d(e){const t={},o={},i=/[a-zA-Z]/,r=e.length-1;let a=0,s=0;for(;a1||"checkmate"!==t[0])&&(a+=`${t.toString()} `):a+=`(${t.toString()}|${o.toString()}) `}}const d={};let m=!1;for(const t in e.gameRules)"promotionRanks"!==t&&"promotionsAllowed"!==t&&"winConditions"!==t&&(d[t]=e.gameRules[t],m=!0);return m&&(a+=`${JSON.stringify(d)} `),i&&(a+="string"!=typeof e.startingPosition?s(e.startingPosition,e.specialRights):e.startingPosition,e.moves&&(a+=`${c}${c}`)),e.moves&&(a+=r(e.moves,{next_move:l,fullmove:u,compact_moves:t,make_new_lines:n})),a},ShortToLong_Format:function(e){let t={gameRules:{}},o={};for(;e.indexOf("[")>-1;){let t=e.indexOf("["),n=e.indexOf("]");if(-1==n)throw new Error("Unclosed [ detected");let i=e.slice(t+1,n);e=`${e.slice(0,t)}${e.slice(n+1)}`;let r=i.indexOf(": ");r>-1?o[i.slice(0,r)]=i.slice(r+2):o[i]=""}for(t.metadata=o;""!=e;){if(/\s/.test(e[0])){e=e.slice(1);continue}let o=e.search(/\s/);-1==o&&(o=e.length);let r=e.slice(0,o),s=e.slice(o,o+1);if(e=e.slice(o+1),t.turn||!/^(w|b)$/.test(r))if(t.enpassant||!/^(-?[0-9]+,-?[0-9]+)$/.test(r))if(t.moveRule||!/^([0-9]+\/[0-9]+)$/.test(r))if(t.fullMove||!/^([0-9]+)$/.test(r))if(!/^\(((()|([^\(\)\|]*\|)-?[0-9]+)|(\|\)$))/.test(r)||t.gameRules.promotionRanks)if(!/^(\(?[a-zA-z][^0-9]*)$/.test(r)||t.gameRules.winConditions)if("{"!==r[0])if(t.startingPosition||!/^([a-zA-z]+-?[0-9]+,-?[0-9]+\+?($|\|))/.test(r)){if(/^(([0-9]+\.)|([a-zA-Z]*-?[0-9]+,-?[0-9]+[\s]*(x|>)+))/.test(r)){const o=a((r+" "+e).trimEnd());return o.length>0&&(t.moves=o),t.gameRules.winConditions||(t.gameRules.winConditions={white:["checkmate"],black:["checkmate"]}),t}}else{const{startingPosition:e,specialRights:o}=d(r);t.specialRights=o,t.startingPosition=e,t.shortposition=r}else{for(r+=s;!i(r);){if(""==e)throw new Error("Extra optional arguments not in JSON format");let t=e.search(/\s/);-1==t&&(t=e.length),r+=e.slice(0,t+1),e=e.slice(t+1)}let o=JSON.parse(r);for(let e in o)t.gameRules[e]=o[e]}else{t.gameRules.winConditions={},r=r.replace(/[\(\)]/g,"").split("|"),1==r.length&&r.push(r[0]);for(let e=0;e<2;e++){let o=0==e?"white":"black";t.gameRules.winConditions[o]=[];for(let n of r[e].split(","))t.gameRules.winConditions[o].push(n)}}else{if(r=r.replace(/[\(\)]+/g,"").split("|"),2!==r.length)throw new Error("Promotion ranks needs exactly 2 values");t.gameRules.promotionRanks=[],t.gameRules.promotionsAllowed={white:[],black:[]};for(let e=0;e<2;e++){let o=0==e?"white":"black";if(""!=r[e]&&null!=r[e]){let i=-1==r[e].indexOf(";")?parseInt(r[e]):parseInt(r[e].split(";")[0]);if(isNaN(i))throw new Error("Promotion rank is NaN");if(t.gameRules.promotionRanks.push(i),r[e]=r[e].split(";"),1==r[e].length)t.gameRules.promotionsAllowed[o]=["queens","rooks","bishops","knights"];else{t.gameRules.promotionsAllowed[o]=[];for(let i of r[e][1].split(","))t.gameRules.promotionsAllowed[o].push(n(i).slice(0,-1))}}else t.gameRules.promotionRanks.push(void 0)}}else t.fullMove=parseInt(r);else t.moveRule=r;else t.enpassant=[parseInt(r.split(",")[0]),parseInt(r.split(",")[1])];else t.turn="b"==r?"black":"white"}return t.gameRules.winConditions||(t.gameRules.winConditions={white:["checkmate"],black:["checkmate"]}),t},GameToPosition:function(e,t=0,o=!1){if("string"==typeof e.startingPosition)throw new Error("startingPosition must be in json format!");if(!e.moves||0===e.moves.length)return e;let n=o?e:m(e),i=n.enpassant?n.enpassant:"";for(let e=0;e1?n.enpassant=[t.endCoords[0],Math.round(.5*(t.startCoords[1]+t.endCoords[1]))]:delete n.enpassant,t.castle){let e=t.castle.coord[0].toString()+","+t.castle.coord[1].toString();n.startingPosition[`${(parseInt(t.endCoords[0])-t.castle.dir).toString()},${t.endCoords[1].toString()}`]=`${n.startingPosition[e]}`,delete n.startingPosition[e],n.specialRights&&delete n.specialRights[e]}i=r}return delete n.moves,n.moves=[],n},LongToShort_CompactMove:function(e){let t=e.promotion?o(e.promotion):"";return`${e.startCoords.toString()}>${e.endCoords.toString()}${t}`},ShortToLong_CompactMove:function(e){let t=e.match(/-?[0-9]+,-?[0-9]+/g);if(2!==t.length)throw new Error(`Short move does not contain 2 valid coordinates: ${JSON.stringify(t)}`);t=t.map((e=>l(e))),t.forEach((e=>{if(!isFinite(e[0]))throw new Error(`Move coordinate must not be Infinite. coords: ${e}`);if(!isFinite(e[1]))throw new Error(`Move coordinate must not be Infinite. coords: ${e}`)}));let o=/[a-zA-Z]+/.test(e)?n(e.match(/[a-zA-Z]+/)):"",i={compact:e};return i.startCoords=t[0],i.endCoords=t[1],""!=o&&(i.promotion=o),i},LongToShort_Position:s,LongToShort_Position_FromGamerules:function(e,t,o){return s(e,c(e,t,o))},getStartingPositionAndSpecialRightsFromShortPosition:d,generateSpecialRights:c,convertShortMovesToLong:a,longToShortMoves:r})}(),game=function(){let e;return Object.freeze({getGamefile:function(){return e},init:function(){board.initTextures(),pieces.initSpritesheet(),pieces.initSpritesheetData(),guititle.open(),board.recalcTileWidth_Pixels()},updateVariablesAfterScreenResize:function(){board.initDarkTilesModel(),movement.setScale_When1TileIs1Pixel_Physical(2*camera.getScreenBoundingBox(!1).right/camera.canvas.width),movement.setScale_When1TileIs1Pixel_Virtual(movement.getScale_When1TileIs1Pixel_Physical()*camera.getPixelDensity())},update:function(){input.isKeyDown("`")&&options.toggleDeveloperMode(),input.isKeyDown("m")&&options.toggleFPS(),game.getGamefile()?.mesh.locked&&input.isKeyDown("z")&&main.sforceCalc(!0),gui.getScreen().includes("title")?(movement.panBoard(),invites.update()):function(){input.isKeyDown("1")&&options.toggleEM();input.isKeyDown("escape")&&guipause.toggle();input.isKeyDown("tab")&&guipause.callback_TogglePointers();input.isKeyDown("r")&&piecesmodel.regenModel(game.getGamefile(),options.getPieceRegenColorArgs(),!0);input.isKeyDown("n")&&options.toggleNavigationBar();if(clock.update(),miniimage.testIfToggled(),animation.update(),guipause.areWePaused()&&!onlinegame.areInOnlineGame())return;if(movement.recalcPosition(),transition.update(),board.recalcVariables(),movesscript.update(),arrows.update(),selection.update(),miniimage.genModel(),highlightline.genModel(),movement.updateNavControls(),guipause.areWePaused())return;movement.dragBoard()}(),onlinegame.update(),guinavigation.updateElement_Coords()},render:function(){board.render(),function(){if(gui.getScreen().includes("title"))return;input.renderMouse(),webgl.executeWithDepthFunc_ALWAYS((()=>{highlights.render(),highlightline.render()})),animation.renderTransparentSquares(),pieces.renderPiecesInGame(e),animation.renderPieces(),webgl.executeWithDepthFunc_ALWAYS((()=>{promotionlines.render(),selection.renderGhostPiece(),arrows.renderThem(),perspective.renderCrosshair()}))}()},loadGamefile:function(t){if(e)return console.error("Must unloadGame() before loading a new one!");e=t,t.startSnapshot.pieceCount>=gamefileutility.pieceCountToDisableCheckmate?(miniimage.disable(),arrows.setMode(0)):miniimage.enable(),guipromotion.initUI(e.gameRules.promotionsAllowed),piecesmodel.regenModel(game.getGamefile(),options.getPieceRegenColorArgs()),main.enableForceRender(),guinavigation.update_MoveButtons(),guigameinfo.updateWhosTurn(e),e.gameConclusion&&gamefileutility.concludeGame(e,e.gameConclusion)},unloadGame:function(){e.mesh.terminateIfGenerating(),e=void 0,selection.unselectPiece(),transition.eraseTelHist(),board.updateTheme()}})}();function gamefile(e,{moves:t=[],variantOptions:o,gameConclusion:n}={}){this.metadata={Variant:void 0,Version:void 0,White:void 0,Black:void 0,Clock:void 0,Date:void 0,Result:void 0,Condition:void 0},this.startSnapshot={position:void 0,positionString:void 0,specialRights:void 0,enpassant:void 0,moveRuleState:void 0,fullMove:void 0,turn:void 0,pieceCount:void 0,box:void 0},this.gameRules={winConditions:void 0,promotionRanks:void 0,promotionsAllowed:{white:void 0,black:void 0},slideLimit:void 0},this.ourPieces=void 0,this.piecesOrganizedByKey=void 0,this.piecesOrganizedByKey=void 0,this.piecesOrganizedByRow=void 0,this.piecesOrganizedByColumn=void 0,this.piecesOrganizedByUpDiagonal=void 0,this.piecesOrganizedByDownDiagonal=void 0,this.mesh={data64:void 0,data32:void 0,rotatedData64:void 0,rotatedData32:void 0,model:void 0,rotatedModel:void 0,usingColoredTextures:void 0,stride:void 0,offset:void 0,isGenerating:0,locked:0,terminateIfGenerating:()=>{this.mesh.isGenerating&&(this.mesh.terminate=!0)},terminate:!1},this.voidMesh={data64:void 0,data32:void 0,model:void 0},this.pieceMovesets=void 0,this.vicinity=void 0,this.specialDetects=void 0,this.specialMoves=void 0,this.specialUndos=void 0,math.copyPropertiesToObject(e,this.metadata),variant.setupVariant(this,e,o),this.moveRuleState=this.gameRules.moveRule?this.startSnapshot.moveRuleState:void 0,area.initStartingAreaBox(this),this.moves=[],this.moveIndex=-1,this.enpassant=math.deepCopyObject(this.startSnapshot.enpassant),this.specialRights=math.deepCopyObject(this.startSnapshot.specialRights),this.whosTurn=this.startSnapshot.turn,this.inCheck=void 0,this.attackers=void 0,this.checksGiven=void 0,this.ourPieces=organizedlines.buildStateFromKeyList(this.startSnapshot.position),this.startSnapshot.pieceCount=gamefileutility.getPieceCountOfGame(this),organizedlines.initOrganizedPieceLists(this,{appendUndefineds:!1}),movepiece.makeAllMovesInGame(this,t),this.gameConclusion=n||this.gameConclusion,organizedlines.addMoreUndefineds(this,{regenModel:!1})}const gamefileutility=function(){function e(e,t,o,n){if(!t)return console.log("Cannot iterate through each piece in an undefined typeList!");for(let o=0;o{e&&i.push(e)}))}else if("black"===t)for(let e=0;e{e&&i.push(e)}))}else console.error(`Cannot get jumping royal coords from a side with color ${t}!`);return i},getCountOfTypesFromPiecesByType:function(e,t,o){const n=math.getWorBFromColor(o);let i=0;for(let o=0;o0?(n[0]=2*(l*c+m*r+u*s-d*a)/p,n[1]=2*(u*c+m*a+d*r-l*s)/p,n[2]=2*(d*c+m*s+l*a-u*r)/p):(n[0]=2*(l*c+m*r+u*s-d*a),n[1]=2*(u*c+m*a+d*r-l*s),n[2]=2*(d*c+m*s+l*a-u*r)),i(e,o,n),e},getTranslation:function(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e},getScaling:r,getRotation:function(e,o){var n=new t(3);r(n,o);var i=1/n[0],a=1/n[1],s=1/n[2],c=o[0]*i,l=o[1]*a,u=o[2]*s,d=o[4]*i,m=o[5]*a,p=o[6]*s,g=o[8]*i,f=o[9]*a,h=o[10]*s,v=c+m+h,P=0;return v>0?(P=2*Math.sqrt(v+1),e[3]=.25*P,e[0]=(p-f)/P,e[1]=(g-u)/P,e[2]=(l-d)/P):c>m&&c>h?(P=2*Math.sqrt(1+c-m-h),e[3]=(p-f)/P,e[0]=.25*P,e[1]=(l+d)/P,e[2]=(g+u)/P):m>h?(P=2*Math.sqrt(1+m-c-h),e[3]=(g-u)/P,e[0]=(l+d)/P,e[1]=.25*P,e[2]=(p+f)/P):(P=2*Math.sqrt(1+h-c-m),e[3]=(l-d)/P,e[0]=(g+u)/P,e[1]=(p+f)/P,e[2]=.25*P),e},decompose:function(e,t,o,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];var i=n[0],r=n[1],a=n[2],s=n[4],c=n[5],l=n[6],u=n[8],d=n[9],m=n[10];o[0]=Math.hypot(i,r,a),o[1]=Math.hypot(s,c,l),o[2]=Math.hypot(u,d,m);var p=1/o[0],g=1/o[1],f=1/o[2],h=i*p,v=r*g,P=a*f,b=s*p,y=c*g,w=l*f,C=u*p,k=d*g,T=m*f,S=h+y+T,M=0;return S>0?(M=2*Math.sqrt(S+1),e[3]=.25*M,e[0]=(w-k)/M,e[1]=(C-P)/M,e[2]=(v-b)/M):h>y&&h>T?(M=2*Math.sqrt(1+h-y-T),e[3]=(w-k)/M,e[0]=.25*M,e[1]=(v+b)/M,e[2]=(C+P)/M):y>T?(M=2*Math.sqrt(1+y-h-T),e[3]=(C-P)/M,e[0]=(v+b)/M,e[1]=.25*M,e[2]=(w+k)/M):(M=2*Math.sqrt(1+T-h-y),e[3]=(v-b)/M,e[0]=(C+P)/M,e[1]=(w+k)/M,e[2]=.25*M),e},fromRotationTranslationScale:function(e,t,o,n){var i=t[0],r=t[1],a=t[2],s=t[3],c=i+i,l=r+r,u=a+a,d=i*c,m=i*l,p=i*u,g=r*l,f=r*u,h=a*u,v=s*c,P=s*l,b=s*u,y=n[0],w=n[1],C=n[2];return e[0]=(1-(g+h))*y,e[1]=(m+b)*y,e[2]=(p-P)*y,e[3]=0,e[4]=(m-b)*w,e[5]=(1-(d+h))*w,e[6]=(f+v)*w,e[7]=0,e[8]=(p+P)*C,e[9]=(f-v)*C,e[10]=(1-(d+g))*C,e[11]=0,e[12]=o[0],e[13]=o[1],e[14]=o[2],e[15]=1,e},fromRotationTranslationScaleOrigin:function(e,t,o,n,i){var r=t[0],a=t[1],s=t[2],c=t[3],l=r+r,u=a+a,d=s+s,m=r*l,p=r*u,g=r*d,f=a*u,h=a*d,v=s*d,P=c*l,b=c*u,y=c*d,w=n[0],C=n[1],k=n[2],T=i[0],S=i[1],M=i[2],E=(1-(f+v))*w,B=(p+y)*w,x=(g-b)*w,I=(p-y)*C,D=(1-(m+v))*C,R=(h+P)*C,F=(g+b)*k,L=(h-P)*k,O=(1-(m+f))*k;return e[0]=E,e[1]=B,e[2]=x,e[3]=0,e[4]=I,e[5]=D,e[6]=R,e[7]=0,e[8]=F,e[9]=L,e[10]=O,e[11]=0,e[12]=o[0]+T-(E*T+I*S+F*M),e[13]=o[1]+S-(B*T+D*S+L*M),e[14]=o[2]+M-(x*T+R*S+O*M),e[15]=1,e},fromQuat:function(e,t){var o=t[0],n=t[1],i=t[2],r=t[3],a=o+o,s=n+n,c=i+i,l=o*a,u=n*a,d=n*s,m=i*a,p=i*s,g=i*c,f=r*a,h=r*s,v=r*c;return e[0]=1-d-g,e[1]=u+v,e[2]=m-h,e[3]=0,e[4]=u-v,e[5]=1-l-g,e[6]=p+f,e[7]=0,e[8]=m+h,e[9]=p-f,e[10]=1-l-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},frustum:function(e,t,o,n,i,r,a){var s=1/(o-t),c=1/(i-n),l=1/(r-a);return e[0]=2*r*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*r*c,e[6]=0,e[7]=0,e[8]=(o+t)*s,e[9]=(i+n)*c,e[10]=(a+r)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*r*2*l,e[15]=0,e},perspectiveNO:a,perspective:s,perspectiveZO:function(e,t,o,n,i){var r=1/Math.tan(t/2);if(e[0]=r/o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0){var a=1/(n-i);e[10]=i*a,e[14]=i*n*a}else e[10]=-1,e[14]=-n;return e},perspectiveFromFieldOfView:function(e,t,o,n){var i=Math.tan(t.upDegrees*Math.PI/180),r=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),c=2/(a+s),l=2/(i+r);return e[0]=c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=l,e[6]=0,e[7]=0,e[8]=-(a-s)*c*.5,e[9]=(i-r)*l*.5,e[10]=n/(o-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*o/(o-n),e[15]=0,e},orthoNO:c,ortho:l,orthoZO:function(e,t,o,n,i,r,a){var s=1/(t-o),c=1/(n-i),l=1/(r-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=l,e[11]=0,e[12]=(t+o)*s,e[13]=(i+n)*c,e[14]=r*l,e[15]=1,e},lookAt:function(t,n,i,r){var a,s,c,l,u,d,m,p,g,f,h=n[0],v=n[1],P=n[2],b=r[0],y=r[1],w=r[2],C=i[0],k=i[1],T=i[2];return Math.abs(h-C)0&&(u*=p=1/Math.sqrt(p),d*=p,m*=p);var g=c*m-l*d,f=l*u-s*m,h=s*d-c*u;return(p=g*g+f*f+h*h)>0&&(g*=p=1/Math.sqrt(p),f*=p,h*=p),e[0]=g,e[1]=f,e[2]=h,e[3]=0,e[4]=d*h-m*f,e[5]=m*g-u*h,e[6]=u*f-d*g,e[7]=0,e[8]=u,e[9]=d,e[10]=m,e[11]=0,e[12]=i,e[13]=r,e[14]=a,e[15]=1,e},str:function(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"},frob:function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},add:function(e,t,o){return e[0]=t[0]+o[0],e[1]=t[1]+o[1],e[2]=t[2]+o[2],e[3]=t[3]+o[3],e[4]=t[4]+o[4],e[5]=t[5]+o[5],e[6]=t[6]+o[6],e[7]=t[7]+o[7],e[8]=t[8]+o[8],e[9]=t[9]+o[9],e[10]=t[10]+o[10],e[11]=t[11]+o[11],e[12]=t[12]+o[12],e[13]=t[13]+o[13],e[14]=t[14]+o[14],e[15]=t[15]+o[15],e},subtract:u,multiplyScalar:function(e,t,o){return e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e[3]=t[3]*o,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12]*o,e[13]=t[13]*o,e[14]=t[14]*o,e[15]=t[15]*o,e},multiplyScalarAndAdd:function(e,t,o,n){return e[0]=t[0]+o[0]*n,e[1]=t[1]+o[1]*n,e[2]=t[2]+o[2]*n,e[3]=t[3]+o[3]*n,e[4]=t[4]+o[4]*n,e[5]=t[5]+o[5]*n,e[6]=t[6]+o[6]*n,e[7]=t[7]+o[7]*n,e[8]=t[8]+o[8]*n,e[9]=t[9]+o[9]*n,e[10]=t[10]+o[10]*n,e[11]=t[11]+o[11]*n,e[12]=t[12]+o[12]*n,e[13]=t[13]+o[13]*n,e[14]=t[14]+o[14]*n,e[15]=t[15]+o[15]*n,e},exactEquals:function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},equals:function(t,o){var n=t[0],i=t[1],r=t[2],a=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],m=t[9],p=t[10],g=t[11],f=t[12],h=t[13],v=t[14],P=t[15],b=o[0],y=o[1],w=o[2],C=o[3],k=o[4],T=o[5],S=o[6],M=o[7],E=o[8],B=o[9],x=o[10],I=o[11],D=o[12],R=o[13],F=o[14],L=o[15];return Math.abs(n-b)<=e*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-y)<=e*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-w)<=e*Math.max(1,Math.abs(r),Math.abs(w))&&Math.abs(a-C)<=e*Math.max(1,Math.abs(a),Math.abs(C))&&Math.abs(s-k)<=e*Math.max(1,Math.abs(s),Math.abs(k))&&Math.abs(c-T)<=e*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(l-S)<=e*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(u-M)<=e*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(d-E)<=e*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(m-B)<=e*Math.max(1,Math.abs(m),Math.abs(B))&&Math.abs(p-x)<=e*Math.max(1,Math.abs(p),Math.abs(x))&&Math.abs(g-I)<=e*Math.max(1,Math.abs(g),Math.abs(I))&&Math.abs(f-D)<=e*Math.max(1,Math.abs(f),Math.abs(D))&&Math.abs(h-R)<=e*Math.max(1,Math.abs(h),Math.abs(R))&&Math.abs(v-F)<=e*Math.max(1,Math.abs(v),Math.abs(F))&&Math.abs(P-L)<=e*Math.max(1,Math.abs(P),Math.abs(L))},mul:d,sub:m})}(),gui=function(){let e="";const t=document.getElementById("overlay");return t.addEventListener("click",(function(e){if(e=e||window.event,!guipromotion.isUIOpen())return;selection.unselectPiece(),main.renderThisFrame()})),Object.freeze({fadeInOverlay1s:function(){style.fadeIn1s(t)},getScreen:function(){return e},setScreen:function(t){e=t},callback_featurePlanned:function(e){e=e||window.event,statustext.showStatus("This feature is planned!")},makeOverlayUnselectable:function(){t.classList.add("unselectable")},makeOverlaySelectable:function(){t.classList.remove("unselectable")}})}(),guigameinfo=function(){const e=document.getElementById("whosturn"),t=document.getElementById("dot"),o=document.getElementById("playerwhite"),n=document.getElementById("playerblack");return Object.freeze({open:function(){game.getGamefile().gameConclusion||style.revealElement(t)},hidePlayerNames:function(){style.hideElement(o),style.hideElement(n)},revealPlayerNames:function(e){const t=e.metadata.White,i=e.metadata.Black;o.textContent=onlinegame.areWeColor("white")&&"(Guest)"===t?"(You)":t,n.textContent=onlinegame.areWeColor("black")&&"(Guest)"===i?"(You)":i,style.revealElement(o),style.revealElement(n)},updateWhosTurn:function(o){const n=o.whosTurn;if("white"!==n&&"black"!==n)throw new Error(`Cannot set the document element text showing whos turn it is when color is neither white nor black! ${n}`);let i="";if(onlinegame.areInOnlineGame()){i=onlinegame.isItOurTurn(o)?"Your move":"Their move"}else i="white"===n?"White to move":"Black to move";e.textContent=i,style.revealElement(t),"white"===n?(t.classList.remove("dotblack"),t.classList.add("dotwhite")):(t.classList.remove("dotwhite"),t.classList.add("dotblack"))},gameEnd:function(o){const{victor:n,condition:i}=wincondition.getVictorAndConditionFromGameConclusion(o);style.hideElement(t),onlinegame.areInOnlineGame()?onlinegame.areWeColor(n)?e.textContent="checkmate"===i?"You win by checkmate!":"time"===i?"You win on time!":"resignation"===i?"You win by resignation!":"disconnect"===i?"You win by abandonment!":"royalcapture"===i?"You win by royal capture!":"allroyalscaptured"===i?"You win by all royals captured!":"allpiecescaptured"===i?"You win by all pieces captured!":"threecheck"===i?"You win by three-check!":"koth"===i?"You win by king of the hill!":"You win!":e.textContent="draw"===n?"stalemate"===i?"Draw by stalemate!":"repetition"===i?"Draw by repetition!":"moverule"===i?`Draw by the ${game.getGamefile().gameRules.moveRule/2}-move-rule!`:"Draw!":"aborted"===i?"Game aborted.":"checkmate"===i?"You lose by checkmate!":"time"===i?"You lose on time!":"resignation"===i?"You lose by resignation!":"disconnect"===i?"You lose by abandonment!":"royalcapture"===i?"You lose by royal capture!":"allroyalscaptured"===i?"You lose by all royals captured!":"allpiecescaptured"===i?"You lose by all pieces captured!":"threecheck"===i?"You lose by three-check!":"koth"===i?"You lose by king of the hill!":"You lose!":"checkmate"===i?e.textContent="white"===n?"White wins by checkmate!":"black"===n?"Black wins by checkmate!":"This is a bug, please report. Game ended by checkmate.":"time"===i?e.textContent="white"===n?"White wins on time!":"black"===n?"Black wins on time!":"This is a bug, please report. Game ended on time.":"royalcapture"===i?e.textContent="white"===n?"White wins by royal capture!":"black"===n?"Black wins by royal capture!":"This is a bug, please report. Game ended by royal capture.":"allroyalscaptured"===i?e.textContent="white"===n?"White wins by all royals captured!":"black"===n?"Black wins by all royals captured!":"This is a bug, please report. Game ended by all royals captured.":"allpiecescaptured"===i?e.textContent="white"===n?"White wins by all pieces captured!":"black"===n?"Black wins by all pieces captured!":"This is a bug, please report. Game ended by all pieces captured.":"threecheck"===i?e.textContent="white"===n?"White wins by three-check!":"black"===n?"Black wins by three-check!":"This is a bug, please report. Game ended by three-check.":"koth"===i?e.textContent="white"===n?"White wins by king of the hill!":"black"===n?"Black wins by king of the hill!":"This is a bug, please report. Game ended by king of the hill.":"stalemate"===i?e.textContent="Draw by stalemate!":"repetition"===i?e.textContent="Draw by repetition!":"moverule"===i?e.textContent=`Draw by the ${game.getGamefile().gameRules.moveRule/2}-move-rule!`:(e.textContent="This is a bug, please report!",console.error(`Game conclusion: "${o}"\nVictor: ${n}\nCondition: ${i}`))}})}(),guiguide=function(){const e=document.getElementById("guide"),t=document.getElementById("guide-back"),o=document.getElementById("fairy-pieces"),n=document.getElementById("fairy-card"),i=document.getElementById("fairy-back"),r=document.getElementById("fairy-forward");let a=0,s=7;function c(){style.hideElement(e),t.removeEventListener("click",l),i.removeEventListener("click",u),r.removeEventListener("click",d)}function l(){c(),guititle.open()}function u(e){e=e||window.event,0!==a&&(m(),a--,p(),g())}function d(e){e=e||window.event,a!==s&&(m(),a++,p(),g())}function m(){const e=o.querySelectorAll("img")[a];style.hideElement(e);const t=n.querySelectorAll(".fairy-card-desc")[a];style.hideElement(t)}function p(){const e=o.querySelectorAll("img")[a];style.revealElement(e);const t=n.querySelectorAll(".fairy-card-desc")[a];style.revealElement(t)}function g(){0===a?i.classList.add("opacity-0_25"):i.classList.remove("opacity-0_25"),a===s?r.classList.add("opacity-0_25"):r.classList.remove("opacity-0_25")}return Object.freeze({open:function(){style.revealElement(e),t.addEventListener("click",l),i.addEventListener("click",u),r.addEventListener("click",d),e.querySelectorAll("img").forEach((e=>{e.src||(e.src=e.getAttribute("data-src"))}))},close:c})}(),guiloading=function(){const e=document.getElementById("loading-animation");document.getElementById("loading-text");return Object.freeze({closeAnimation:function(){style.fadeIn1s(camera.canvas),gui.fadeInOverlay1s(),setTimeout(style.hideElement,1e3,e)}})}(),guinavigation=function(){const e=document.getElementById("recenter"),t=document.getElementById("expand"),o=document.getElementById("back"),n=document.getElementById("navigation"),i=document.getElementById("x"),r=document.getElementById("y"),a=document.getElementById("move-left"),s=document.getElementById("move-right"),c=document.getElementById("pause"),l=250,u=40;let d,m,p,g,f=20,h=0,v=!1,P=!1,b=!1;function y(e){e=e||window.event,transition.telToPrevTel()}function w(e){e=e||window.event;const t=gamefileutility.getCoordsOfAllPieces(game.getGamefile());area.initTelFromCoordsList(t)}function C(e){e=e||window.event;const t=game.getGamefile().startSnapshot.box;if(!t)return console.error("Cannot recenter when the bounding box of the starting position is undefined!");area.initTelFromUnpaddedBox(t)}function k(e){e=e||window.event,b||S()&&(h=Date.now(),movesscript.rewindMove())}function T(e){e=e||window.event,S()&&(h=Date.now(),movesscript.forwardMove())}function S(){return Date.now()-h>=f}function M(){const e=movesscript.isDecrementingLegal(game.getGamefile()),t=movesscript.isIncrementingLegal(game.getGamefile());e?a.classList.remove("opacity-0_5"):a.classList.add("opacity-0_5"),t?s.classList.remove("opacity-0_5"):s.classList.add("opacity-0_5")}function E(e){e=e||window.event,guipause.open()}function B(){d=setTimeout((()=>{m=setInterval((()=>{k()}),u)}),l)}function x(){clearTimeout(d),clearInterval(m)}function I(){clearTimeout(d),clearInterval(m)}function D(){p=setTimeout((()=>{g=setInterval((()=>{T()}),u)}),l)}function R(){clearTimeout(p),clearInterval(g)}function F(){clearTimeout(p),clearInterval(g)}function L(){v=!0,d=setTimeout((()=>{v&&(m=setInterval((()=>{k()}),u))}),l)}function O(e){if(e=e||window.event,!v)return;const t=e.touches[0],o=a.getBoundingClientRect();t.clientX>o.left&&t.clientXo.top&&t.clientY{P&&(g=setInterval((()=>{T()}),u))}),l)}function A(e){if(e=e||window.event,!P)return;const t=e.touches[0],o=s.getBoundingClientRect();t.clientX>o.left&&t.clientXo.top&&t.clientY{N--,N>0||(b=!1)}),750)},isRewindButtonLocked:function(){return b}})}(),guipause=function(){let e=!1;const t=document.getElementById("pauseUI"),o=document.getElementById("resume"),n=document.getElementById("togglepointers"),i=document.getElementById("copygame"),r=document.getElementById("pastegame"),a=document.getElementById("mainmenu"),s=document.getElementById("toggleperspective");function c(){e=!0,l(),function(){const e=game.getGamefile().moves,t=e.length,o=onlinegame.getIsPrivate()&&(0===t||1===e[0].length&&null==e[0][0]);onlinegame.areInOnlineGame()&&!o?r.classList.add("opacity-0_5"):r.classList.remove("opacity-0_5")}(),style.revealElement(t),o.addEventListener("click",u),n.addEventListener("click",m),i.addEventListener("click",copypastegame.callbackCopy),r.addEventListener("click",copypastegame.callbackPaste),a.addEventListener("click",d),s.addEventListener("click",p)}function l(){if(e)return!onlinegame.areInOnlineGame()||game.getGamefile().gameConclusion?a.textContent="Main Menu":movesscript.isGameResignable(game.getGamefile())?a.textContent="Resign Game":a.textContent="Abort Game"}function u(c){e&&(c=c||window.event,e=!1,style.hideElement(t),o.removeEventListener("click",u),n.removeEventListener("click",m),i.removeEventListener("click",copypastegame.callbackCopy),r.removeEventListener("click",copypastegame.callbackPaste),a.removeEventListener("click",d),s.removeEventListener("click",p),main.renderThisFrame())}async function d(e){e=e||window.event,onlinegame.onMainMenuPress(),onlinegame.closeOnlineGame(),u(),game.unloadGame(),clock.reset(),guinavigation.close(),guititle.open()}function m(t){t=t||window.event,main.renderThisFrame();let o=arrows.getMode();o++,o>2&&(o=0),arrows.setMode(o);const i=0===o?"Arrows: Off":1===o?"Arrows: Defense":"Arrows: All";n.textContent=i,e||statustext.showStatus("Toggled "+i)}function p(e){e=e||window.event,perspective.toggle()}return Object.freeze({areWePaused:function(){return e},gelement_perspective:function(){return s},open:c,toggle:function(){e?u():c()},changeTextOfMainMenuButton:l,callback_Resume:u,callback_TogglePointers:m})}(),guiplay=function(){const e=document.getElementById("menu-external-links"),t=document.getElementById("play-selection"),o=document.getElementById("play-name"),n=document.getElementById("play-back"),i=document.getElementById("online"),r=document.getElementById("local"),a=document.getElementById("computer"),s=document.getElementById("create-invite"),c=document.getElementById("option-card-color"),l=document.getElementById("option-card-private"),u=document.getElementById("option-card-rated"),d=document.getElementById("option-variant"),m=document.getElementById("option-clock"),p=document.getElementById("option-color"),g=document.getElementById("option-private"),f=document.getElementById("option-rated"),h=document.getElementById("join-private"),v=document.getElementById("invite-code"),P=document.getElementById("copy-button"),b=document.getElementById("join-button"),y=document.getElementById("textbox-private");let w;const C=5,k=12;function T(){style.hideElement(t),style.hideElement(e),n.removeEventListener("click",M),i.removeEventListener("click",E),r.removeEventListener("click",B),a.removeEventListener("click",gui.callback_featurePlanned),s.removeEventListener("click",x),p.removeEventListener("change",I),m.removeEventListener("change",I),b.removeEventListener("click",D),P.removeEventListener("click",F),y.removeEventListener("keyup",R),websocket.unsubFromInvites()}function S(e){if(w=e,"online"===e){o.textContent="Play - Online",i.classList.add("selected"),r.classList.remove("selected"),i.classList.remove("not-selected"),r.classList.add("not-selected"),s.textContent="Create Invite",c.classList.remove("hidden"),u.classList.remove("hidden"),l.classList.remove("hidden");const e=localstorage.loadItem("clock_online");m.selectedIndex=null!=e?e:C,h.classList.remove("hidden")}else if("local"===e){guiplay.setElement_CreateInviteEnabled(!0),invites.cancel(),o.textContent="Play - Local",i.classList.remove("selected"),r.classList.add("selected"),i.classList.add("not-selected"),r.classList.remove("not-selected"),s.textContent="Start Game",c.classList.add("hidden"),u.classList.add("hidden"),l.classList.add("hidden");const e=localstorage.loadItem("clock_local");m.selectedIndex=null!=e?e:k,h.classList.add("hidden"),v.classList.add("hidden")}}function M(e){e=e||window.event,T(),guititle.open()}function E(e){e=e||window.event,S("online")}function B(e){e=e||window.event,S("local")}function x(e){e=e||window.event;const t={variant:d.value,clock:m.value,color:p.value,rated:f.value,publicity:g.value};"local"===w?(T(),function(e){gui.setScreen("game local");const t=clock.isClockValueInfinite(e.clock),o={metadata:{Variant:e.variant,Clock:t?"Infinite":e.clock}};W(o),clock.set(e.clock),guigameinfo.hidePlayerNames()}(t)):"online"===w&&(invites.doWeHave()?invites.cancel(void 0,!0):invites.create(t))}function I(e){if(e=e||window.event,function(e){const t=w;localstorage.saveItem(`clock_${t}`,e,math.getTotalMilliseconds({days:7}))}(m.selectedIndex),"online"!==w)return;const t=m.value,o=p.value;f.disabled="0"===t||"Random"!==o}function D(e){e=e||window.event;const t=y.value.toLowerCase();if(5!==t.length)return statustext.showStatus("Invite code needs to be 5 digits.");b.disabled=!0;invites.accept(t,!0)}function R(e){13===(e=e||window.event).keyCode?b.disabled||D(e):b.disabled=!1}function F(e){if(e=e||window.event,!w.includes("online"))return;if(!invites.doWeHave())return;const t=invites.gelement_iCodeCode().textContent;main.copyToClipboard(t),statustext.showStatus("Copied invite code to clipboard.")}function L(e){(e=e||window.event).target.classList.add("hover")}function O(e){(e=e||window.event).target.classList.remove("hover")}function _(e){e=e||window.event,invites.click(e.currentTarget)}function W(e){console.log("Loading game with game options:"),console.log(e),main.renderThisFrame(),movement.eraseMomentum(),options.disableEM(),e.metadata.Date=e.metadata.Date||math.getUTCDateTime();const t=new gamefile(e.metadata,{moves:e.moves,variantOptions:e.variantOptions,gameConclusion:e.gameConclusion});game.loadGamefile(t);const o=area.calculateFromUnpaddedBox(t.startSnapshot.box);movement.setPositionToArea(o,"pidough"),options.setNavigationBar(!0),sound.playSound_gamestart()}return Object.freeze({getElement_joinPrivate:function(){return h},getElement_inviteCode:function(){return v},getModeSelected:function(){return w},open:function(){gui.setScreen("title play"),style.revealElement(t),style.revealElement(e),S("online"),n.addEventListener("click",M),i.addEventListener("click",E),r.addEventListener("click",B),a.addEventListener("click",gui.callback_featurePlanned),s.addEventListener("click",x),p.addEventListener("change",I),m.addEventListener("change",I),b.addEventListener("click",D),P.addEventListener("click",F),y.addEventListener("keyup",R),invites.subscribeToInvites()},close:T,startOnlineGame:function(e){gui.setScreen("game online"),onlinegame.setColorAndGameID(e),e.variantOptions=function(){if(!onlinegame.getIsPrivate())return;const e=onlinegame.getGameID();return null==e?console.error("Can't generate variant options when reloading private custom game because gameID isn't defined yet."):localstorage.loadItem(e)}(),W(e),onlinegame.initOnlineGame(e),clock.set(e.clock,{timerWhite:e.timerWhite,timerBlack:e.timerBlack,timeNextPlayerLosesAt:e.timeNextPlayerLosesAt}),guigameinfo.revealPlayerNames(e)},setElement_CreateInviteEnabled:function(e){s.disabled=!e},setElement_CreateInviteTextContent:function(e){s.textContent=e},initListeners_Invites:function(){document.querySelectorAll(".invite").forEach((e=>{e.addEventListener("mouseenter",L),e.addEventListener("mouseleave",O),e.addEventListener("click",_)}))},closeListeners_Invites:function(){document.querySelectorAll(".invite").forEach((e=>{e.removeEventListener("mouseenter",L),e.removeEventListener("mouseleave",O),e.removeEventListener("click",_)}))},onPlayPage:function(){return"title play"===gui.getScreen()}})}(),guipromotion=function(){const e=document.getElementById("promote"),t=document.getElementById("promotewhite"),o=document.getElementById("promoteblack"),n=document.getElementById("amazonsW"),i=document.getElementById("queensW"),r=document.getElementById("knightridersW"),a=document.getElementById("chancellorsW"),s=document.getElementById("archbishopsW"),c=document.getElementById("rooksW"),l=document.getElementById("bishopsW"),u=document.getElementById("rosesW"),d=document.getElementById("hawksW"),m=document.getElementById("giraffesW"),p=document.getElementById("zebrasW"),g=document.getElementById("camelsW"),f=document.getElementById("centaursW"),h=document.getElementById("knightsW"),v=document.getElementById("guardsW"),P=document.getElementById("amazonsB"),b=document.getElementById("queensB"),y=document.getElementById("knightridersB"),w=document.getElementById("chancellorsB"),C=document.getElementById("archbishopsB"),k=document.getElementById("rooksB"),T=document.getElementById("bishopsB"),S=document.getElementById("rosesB"),M=document.getElementById("hawksB"),E=document.getElementById("giraffesB"),B=document.getElementById("zebrasB"),x=document.getElementById("camelsB"),I=document.getElementById("centaursB"),D=document.getElementById("knightsB"),R=document.getElementById("guardsB");let F=!1;function L(){F=!1,style.hideElement(e),n.removeEventListener("click",O),i.removeEventListener("click",O),r.removeEventListener("click",O),a.removeEventListener("click",O),s.removeEventListener("click",O),c.removeEventListener("click",O),l.removeEventListener("click",O),u.removeEventListener("click",O),d.removeEventListener("click",O),m.removeEventListener("click",O),p.removeEventListener("click",O),g.removeEventListener("click",O),f.removeEventListener("click",O),h.removeEventListener("click",O),v.removeEventListener("click",O),P.removeEventListener("click",O),b.removeEventListener("click",O),y.removeEventListener("click",O),w.removeEventListener("click",O),C.removeEventListener("click",O),k.removeEventListener("click",O),T.removeEventListener("click",O),S.removeEventListener("click",O),M.removeEventListener("click",O),E.removeEventListener("click",O),B.removeEventListener("click",O),x.removeEventListener("click",O),I.removeEventListener("click",O),D.removeEventListener("click",O),R.removeEventListener("click",O)}function O(e){const t=(e=e||window.event).srcElement.classList[1];selection.promoteToType(t),L()}return Object.freeze({isUIOpen:function(){return F},open:function(L){F=!0,style.revealElement(e),"white"===L?(style.hideElement(o),style.revealElement(t)):(style.hideElement(t),style.revealElement(o)),n.addEventListener("click",O),i.addEventListener("click",O),r.addEventListener("click",O),a.addEventListener("click",O),s.addEventListener("click",O),c.addEventListener("click",O),l.addEventListener("click",O),u.addEventListener("click",O),d.addEventListener("click",O),m.addEventListener("click",O),p.addEventListener("click",O),g.addEventListener("click",O),f.addEventListener("click",O),h.addEventListener("click",O),v.addEventListener("click",O),P.addEventListener("click",O),b.addEventListener("click",O),y.addEventListener("click",O),w.addEventListener("click",O),C.addEventListener("click",O),k.addEventListener("click",O),T.addEventListener("click",O),S.addEventListener("click",O),M.addEventListener("click",O),E.addEventListener("click",O),B.addEventListener("click",O),x.addEventListener("click",O),I.addEventListener("click",O),D.addEventListener("click",O),R.addEventListener("click",O),perspective.unlockMouse()},close:L,initUI:function(e){const t=e.white,o=e.black;t.includes("amazons")?style.revealElement(n):style.hideElement(n),t.includes("queens")?style.revealElement(i):style.hideElement(i),t.includes("knightriders")?style.revealElement(r):style.hideElement(r),t.includes("chancellors")?style.revealElement(a):style.hideElement(a),t.includes("archbishops")?style.revealElement(s):style.hideElement(s),t.includes("rooks")?style.revealElement(c):style.hideElement(c),t.includes("bishops")?style.revealElement(l):style.hideElement(l),t.includes("roses")?style.revealElement(u):style.hideElement(u),t.includes("hawks")?style.revealElement(d):style.hideElement(d),t.includes("giraffes")?style.revealElement(m):style.hideElement(m),t.includes("zebras")?style.revealElement(p):style.hideElement(p),t.includes("camels")?style.revealElement(g):style.hideElement(g),t.includes("centaurs")?style.revealElement(f):style.hideElement(f),t.includes("knights")?style.revealElement(h):style.hideElement(h),t.includes("guards")?style.revealElement(v):style.hideElement(v),o.includes("amazons")?style.revealElement(P):style.hideElement(P),o.includes("queens")?style.revealElement(b):style.hideElement(b),o.includes("knightriders")?style.revealElement(y):style.hideElement(y),o.includes("chancellors")?style.revealElement(w):style.hideElement(w),o.includes("archbishops")?style.revealElement(C):style.hideElement(C),o.includes("rooks")?style.revealElement(k):style.hideElement(k),o.includes("bishops")?style.revealElement(T):style.hideElement(T),o.includes("roses")?style.revealElement(S):style.hideElement(S),o.includes("hawks")?style.revealElement(M):style.hideElement(M),o.includes("giraffes")?style.revealElement(E):style.hideElement(E),o.includes("zebras")?style.revealElement(B):style.hideElement(B),o.includes("camels")?style.revealElement(x):style.hideElement(x),o.includes("centaurs")?style.revealElement(I):style.hideElement(I),o.includes("knights")?style.revealElement(D):style.hideElement(D),o.includes("guards")?style.revealElement(R):style.hideElement(R)}})}(),guititle=function(){const e=document.getElementById("title"),t=document.getElementById("play"),o=document.getElementById("rules"),n=document.getElementById("board-editor"),i=document.getElementById("menu-external-links");function r(){t.removeEventListener("click",a),o.removeEventListener("click",s),n.removeEventListener("click",gui.callback_featurePlanned),style.hideElement(e),style.hideElement(i)}function a(e){e=e||window.event,r(),guiplay.open()}function s(e){e=e||window.event,r(),guiguide.open()}return Object.freeze({boardVel:.6,open:function(){perspective.disable(),gui.getScreen()?.includes("title")||movement.randomizePanVelDir(),gui.setScreen("title"),movement.setBoardScale(1.8,"pidough"),style.revealElement(e),style.revealElement(i),t.addEventListener("click",a),o.addEventListener("click",s),n.addEventListener("click",gui.callback_featurePlanned)},close:r})}(),highlightline=function(){let e,t;function o(e,t,o,n){const[i,r,a,s]=n;e.push(t[0],t[1],i,r,a,s,o[0],o[1],i,r,a,s)}function n(e,t,o){return!o&&e[0]t[0]?t:e}function i(e,t,o,n){const i=(n?t[1]:t[0])-e[0],r=o?i:-i;return[e[0]+i,e[1]+r]}return Object.freeze({genModel:function(){if(!movement.isScaleLess1Pixel_Virtual())return;if(!selection.isAPieceSelected())return;const r=[],a=math.deepCopyObject(selection.getLegalMovesOfSelectedPiece()),s=selection.getPieceSelected().coords,c=math.convertCoordToWorldSpace(s),l=math.deepCopyObject(options.getDefaultLegalMoveHighlight());l[3]=1;const u=miniimage.gwidthWorld()/2,d=[];if(a.horizontal){const e=math.convertCoordToWorldSpace_ClampEdge([a.horizontal[0],s[1]]),t=math.convertCoordToWorldSpace_ClampEdge([a.horizontal[1],s[1]]);o(r,e,t,l);const n=math.closestPointOnLine(e,t,input.getMouseWorldLocation());n.moveset=a.horizontal,n.direction="horizontal",n.distance<=u&&d.push(n)}if(a.vertical){const e=math.convertCoordToWorldSpace_ClampEdge([s[0],a.vertical[0]]),t=math.convertCoordToWorldSpace_ClampEdge([s[0],a.vertical[1]]);o(r,e,t,l);const n=math.closestPointOnLine(e,t,input.getMouseWorldLocation());n.moveset=a.vertical,n.direction="vertical",n.distance<=u&&d.push(n)}const m=perspective.distToRenderBoard;let p=perspective.getEnabled()?{left:-m,right:m,bottom:-m,top:m}:camera.getScreenBoundingBox(!1);e:if(a.diagonalUp){const e=math.getUpDiagonalFromCoords(c);let t=math.getIntersectionEntryTile(1,e,p,"bottomleft");if(!t)break e;const m=i(s,a.diagonalUp,!0,!1);t=n(t,math.convertCoordToWorldSpace(m),!1);let g=math.getIntersectionEntryTile(1,e,p,"topright");const f=i(s,a.diagonalUp,!0,!0);g=n(g,math.convertCoordToWorldSpace(f),!0),o(r,t,g,l);const h=math.closestPointOnLine(t,g,input.getMouseWorldLocation());h.moveset=a.diagonalUp,h.direction="diagonalup",h.distance<=u&&d.push(h)}e:if(a.diagonalDown){const e=math.getDownDiagonalFromCoords(c);let t=math.getIntersectionEntryTile(-1,e,p,"topleft");if(!t)break e;const m=i(s,a.diagonalDown,!1,!1);t=n(t,math.convertCoordToWorldSpace(m),!1);let g=math.getIntersectionEntryTile(-1,e,p,"bottomright");const f=i(s,a.diagonalDown,!1,!0);g=n(g,math.convertCoordToWorldSpace(f),!0),o(r,t,g,l);const h=math.closestPointOnLine(t,g,input.getMouseWorldLocation());h.moveset=a.diagonalDown,h.direction="diagonaldown",h.distance<=u&&d.push(h)}if(e=buffermodel.createModel_Colored(new Float32Array(r),2,"LINES"),t=void 0,miniimage.isHovering())return;let g=d[0];for(let e=1;er){const e=r/n;n*=e,i*=e}return[n,i]}(),r=e/2,a=i/2,s=movement.getBoardPos(),c=Math.ceil(s[0]-r),l=Math.floor(s[0]+r),u=Math.ceil(s[1]-a),d=Math.floor(s[1]+a);t={left:c,right:l,bottom:u,top:d}}(),function(){const e=selection.getPieceSelected().coords,o=options.getDefaultLegalMoveHighlight(),[n,r,c,u]=o;(function(e,t,o){const n=selection.getLegalMovesOfSelectedPiece();if(!n.horizontal)return;const[r,c,l,u]=options.getDefaultLegalMoveHighlight();let d=n.horizontal[0]-board.gsquareCenter();do+1-board.gsquareCenter()&&(d=o+1-board.gsquareCenter());m=d-a[0],p=e[1]-board.gsquareCenter()-a[1],g=e[0]+1-board.gsquareCenter()-a[0],f=p+1,i.push(...bufferdata.getDataQuad_Color3D(m,p,g,f,s,r,c,l,u))})(e,t.left,t.right),function(e,t,o){const n=selection.getLegalMovesOfSelectedPiece();if(!n.vertical)return;const[r,c,l,u]=options.getDefaultLegalMoveHighlight();let d=n.vertical[0]-board.gsquareCenter();do+1-board.gsquareCenter()&&(d=o+1-board.gsquareCenter());m=d-a[1],p=e[0]-board.gsquareCenter()-a[0],g=e[1]+1-board.gsquareCenter()-a[1],f=p+1,i.push(...bufferdata.getDataQuad_Color3D(p,m,f,g,s,r,c,l,u))}(e,t.bottom,t.top),function(e,t,o,n,i,r){const s=selection.getLegalMovesOfSelectedPiece();if(!s.diagonalUp)return;const c=math.getUpDiagonalFromCoords(e),u=math.getIntersectionEntryTile(1,c,t,"bottomleft"),d=math.getIntersectionEntryTile(1,c,t,"topright");if(!u)return;{let t=d,c=u;t[0]>e[0]-1&&(t=[e[0]-1,e[1]-1]);let m=s.diagonalUp[0];c[0]m&&(c[0]=m,c[1]=t[1]+m-t[0]);let p=c[0]-t[0]+1;p<0&&(p=0),l(p,t[0]-board.gsquareCenter()-a[0],t[1]-board.gsquareCenter()-a[1],1,1,o,n,i,r)}}(e,t,n,r,c,u),function(e,t,o,n,i,r){const s=selection.getLegalMovesOfSelectedPiece();if(!s.diagonalDown)return;const c=math.getDownDiagonalFromCoords(e),u=math.getIntersectionEntryTile(-1,c,t,"topleft"),d=math.getIntersectionEntryTile(-1,c,t,"bottomright");if(!u)return;{let t=d,c=u;t[0]>e[0]-1&&(t=[e[0]-1,e[1]+1]);let m=s.diagonalDown[0];c[0]m&&(c[0]=m,c[1]=t[1]+m-t[0]);let p=c[0]-t[0]+1;p<0&&(p=0),l(p,t[0]-board.gsquareCenter()-a[0],t[1]-board.gsquareCenter()+1-a[1],1,-1,o,n,i,r)}}(e,t,n,r,c,u)}(),r=buffermodel.createModel_Colored(new Float32Array(i),3,"TRIANGLES")}function l(e,t,o,n,r,a,c,l,u){for(let d=0;dv)return;const e=b[0]-u[0],t=b[1]-u[1];Math.hypot(e,t)>P||(h=!0)}function R(){perspective.isMouseLocked()||(input.isMouseSupported()||input.isMouseDown_Left()?function(){const e=perspective.getIsViewingBlackPerspective()?-1:1,t=camera.getCanvasWidthVirtualPixels()/2,o=camera.getCanvasHeightVirtualPixels()/2,n=options.isDebugModeOn()?camera.getScreenBoundingBox(!0):camera.getScreenBoundingBox(!1),i=e*b[0]/t*n.right,r=e*b[1]/o*n.top;w=[i,r]}():function(){if(selection.isAPieceSelected()&&movement.isScaleLess1Pixel_Virtual())return;w=[0,0]}())}function F(){if(!perspective.isMouseLocked())return;const e=Math.PI/180*perspective.getRotX(),t=Math.PI/180*perspective.getRotZ(),o=-Math.tan(e)*camera.getPosition()[2],n=o*Math.sin(t),i=o*Math.cos(t);w=[n,i]}function L(e){f+=e.deltaY}function O(e){const t=e.button;d.push(t),-1===m.indexOf(t)&&m.push(t)}function _(e){const t=m.indexOf(e.button);-1!==t&&m.splice(t,1)}function W(){return t.length>0}function A(e){e.changeInX=0,e.changeInY=0}return Object.freeze({getTouchHelds:function(){return o},atleast1TouchDown:W,getTouchClicked:function(){return n},isMouseDown_Left:function(){return d.includes(0)},removeMouseDown_Left:function(){math.removeObjectFromArray(d,0)},getTouchClickedTile:function(){return a},getTouchClickedWorld:function(){return s},isMouseHeld_Left:function(){return m.includes(0)},isKeyDown:function(e){return p.includes(e)},atleast1KeyHeld:function(){return g.length>0},isKeyHeld:function(e){return g.includes(e)},getMouseWheel:function(){return f},getMouseClickedTile:function(){return l},getMouseClicked:function(){return h},getMousePos:function(){return[b[0],b[1]]},getMouseMoved:S,doIgnoreMouseDown:function(e){C=!0},isMouseSupported:function(){return k},initListeners:function(){window.addEventListener("resize",(()=>{camera.onScreenResize()})),e.addEventListener("touchstart",(e=>{perspective.getEnabled()||("string"==typeof(e=e||window.event).target.className&&e.target.className.includes("button"),"overlay"===e.target.id&&e.preventDefault(),C||(function(e){for(let n=0;n{if(perspective.getEnabled())return;const t=(e=e||window.event).changedTouches;for(let e=0;e{e=e||window.event,!guipause.areWePaused()&&(0!==arrows.getMode()||movement.isScaleLess1Pixel_Virtual()||selection.isAPieceSelected()||perspective.getEnabled())&&main.renderThisFrame();const t=M(e);b=t,y=!0,R(),F(),perspective.update(e.movementX,e.movementY)})),e.addEventListener("wheel",(e=>{L(e=e||window.event)})),document.addEventListener("wheel",(e=>{e=e||window.event,perspective.getEnabled()&&perspective.isMouseLocked()&&L(e)})),e.addEventListener("mousedown",(e=>{e=e||window.event,n=!1,s=void 0,C||("overlay"===e.target.id&&e.preventDefault(),O(e),R(),F(),board.recalcTile_MouseCrosshairOver(),0===e.button&&I())})),document.addEventListener("mousedown",(e=>{e=e||window.event,perspective.getEnabled()&&perspective.isMouseLocked()&&(O(e),0===e.button&&I())})),e.addEventListener("mouseup",(e=>{_(e=e||window.event),setTimeout(perspective.relockMouse,1),0===e.button&&D()})),document.addEventListener("mouseup",(e=>{e=e||window.event,perspective.getEnabled()&&perspective.isMouseLocked()&&(_(e),D())})),document.addEventListener("keydown",(e=>{const t=(e=e||window.event).key.toLowerCase();p.push(t),-1===g.indexOf(t)&&g.push(t),"Tab"===e.key&&e.preventDefault()})),document.addEventListener("keyup",(e=>{e=e||window.event;const t=g.indexOf(e.key.toLowerCase());-1!==t&&g.splice(t,1)})),e.addEventListener("contextmenu",(e=>{"overlay"===(e=e||window.event).target.id&&e.preventDefault()})),function(){if(window.matchMedia("(pointer: fine)").matches)return;k=!1,console.log("Mouse is not supported on this device. Disabling perspective mode."),guipause.gelement_perspective().classList.add("opacity-0_5")}()},resetKeyEvents:function(){t=[],n=!1,d=[],f=0,h=!1,p=[],y=!1,C=!1},touchHeldsIncludesID:function(e){for(let t=0;t0||p.length>0},renderMouse:function(){if(k)return;if(!selection.isAPieceSelected())return;if(!movement.isScaleLess1Pixel_Virtual())return;const[e,t]=w,o=math.convertPixelsToWorldSpace_Virtual(0),n=math.convertPixelsToWorldSpace_Virtual(6.5),i=bufferdata.getDataRingSolid(e,t,o,n,32,0,0,0,.5),r=new Float32Array(i);buffermodel.createModel_Colored(r,2,"TRIANGLES").render()},moveMouse:function(e,t){if(!selection.isAPieceSelected()||!movement.isScaleLess1Pixel_Virtual())return A(e),void(t&&A(t));let o=math.convertPixelsToWorldSpace_Virtual(e.changeInX),n=math.convertPixelsToWorldSpace_Virtual(e.changeInY);if(t){o=(o+math.convertPixelsToWorldSpace_Virtual(t.changeInX))/2,n=(n+math.convertPixelsToWorldSpace_Virtual(t.changeInY))/2,A(t)}const i=onlinegame.areInOnlineGame()&&onlinegame.areWeColor("black")?-1:1;w[0]-=.5*o*i,w[1]-=.5*n*i,A(e),function(){const e=camera.getScreenBoundingBox().right*T,t=Math.hypot(w[0],w[1]);if(t{guiplay.setElement_CreateInviteEnabled(!0)}));websocket.sendmessage("invites","cancelinvite",e,t,(()=>{guiplay.setElement_CreateInviteEnabled(!0),clearTimeout(o)}))}function c(){localstorage.deleteItem("invite-tag")}const l=(()=>{const e={};let t={};return function(o){let n=!1;const i={};o.forEach((o=>{const r=o.name,a=o.id;i[a]=!0,t[a]||e[r]||d(o)||(e[r]=!0,setTimeout((()=>{delete e[r]}),1e4),n||(input.isMouseSupported()?sound.playSound_base():sound.playSound_viola_c3(),n=!0))})),t=i}})();function u({recentUsersInLastList:r=!1}={}){guiplay.closeListeners_Invites(),t.innerHTML="",e.innerHTML="",o=void 0,i=!1,n=void 0,r&&l([])}function d(e){if(validation.getMember()===e.name)return!0;const t=localstorage.loadItem("invite-tag");return!!t&&e.tag===t}function m(e,t,o){const n=document.createElement("div");for(let t=0;t{guiplay.setElement_CreateInviteEnabled(!0)}));websocket.sendmessage("invites","createinvite",e,!0,(()=>{guiplay.setElement_CreateInviteEnabled(!0),clearTimeout(t)}))},cancel:s,clear:u,accept:p,click:function(e){const t=e.querySelectorAll(".accept")[0].textContent;if("Cancel"===t)s(e.id,!0);else{if("Accept"!==t)return console.error(`Unknown command ${t} when clicking invite.`);p(e.id)}},doWeHave:function(){return i},clearIfOnPlayPage:function(){guiplay.onPlayPage()&&(u(),g())},unsubIfWeNotHave:function(){i||websocket.unsubFromInvites()},deleteInviteTagInLocalStorage:c,subscribeToInvites:async function(e){if(!guiplay.onPlayPage())return;const t=websocket.getSubs();!e&&t.invites||(t.invites=!0,websocket.sendmessage("general","sub","invites"))}})}(),legalmoves=function(){function e(e,t){t=math.trimWorBFromType(t);const o=e.pieceMovesets[t];return o?o():{}}function t(e,t,o,n,i){if(!o)return;const r=t?1:0,a=[o[0]+n[r],o[1]+n[r]];for(let t=0;ta[0]&&(a[0]=e)}else if(s>n[r]){const e=c||l?s-1:s;e{e[0]+=t[0],e[1]+=t[1]}))}(l.individual,r),g=function(e,t,o){if(!t)return;for(let n=t.length-1;n>=0;n--){const i=t[n],r=gamefileutility.getPieceTypeAtCoords(e,i);if(!r)continue;o!==math.getPieceColorFromType(r)&&"voidsN"!==r||t.splice(n,1)}return t}(o,l.individual,c);let e=r[1];u=t(o.piecesOrganizedByRow[e],!1,l.horizontal,r,c),e=r[0],d=t(o.piecesOrganizedByColumn[e],!0,l.vertical,r,c),e=math.getUpDiagonalFromCoords(r),m=t(o.piecesOrganizedByUpDiagonal[e],!1,l.diagonalUp,r,c),e=math.getDownDiagonalFromCoords(r),p=t(o.piecesOrganizedByDownDiagonal[e],!1,l.diagonalDown,r,c)}o.specialDetects[s]&&o.specialDetects[s](o,r,c,g);let f={individual:g,horizontal:u,vertical:d,diagonalUp:m,diagonalDown:p};return c===o.whosTurn&&checkdetection.removeMovesThatPutYouInCheck(o,f,n,c),f},checkIfMoveLegal:function(e,t,o,{ignoreIndividualMoves:n}={}){if(math.areCoordsEqual(t,o))return!1;if(!n){const t=e.individual,n=t?t.length:0;for(let e=0;e=i[0]&&o[0]<=i[1])return!0;const r=e.vertical;if(r&&o[0]==t[0]&&o[1]>=r[0]&&o[1]<=r[1])return!0;const a=e.diagonalUp;let s=math.getUpDiagonalFromCoords(t),c=math.getUpDiagonalFromCoords(o);if(a&&s==c&&o[0]>=a[0]&&o[0]<=a[1])return!0;const l=e.diagonalDown;return s=math.getDownDiagonalFromCoords(t),c=math.getDownDiagonalFromCoords(o),!!(l&&s==c&&o[0]>=l[0]&&o[0]<=l[1])},doesSlideMovesetContainSquare:function(e,t,o){const n=t?o[1]:o[0];return!(ne[1])},hasAtleast1Move:function(e){if(e.individual.length>0)return!0;if(t(e.horizontal))return!0;if(t(e.vertical))return!0;if(t(e.diagonalUp))return!0;if(t(e.diagonalDown))return!0;function t(e){return!!e&&e[1]-e[0]>0}return!1},slide_CalcLegalLimit:t,isOpponentsMoveLegal:function(e,t,o){if(!t)return console.log("Opponents move is illegal because it is not defined. There was likely an error in converting it to long format."),"Move is not defined. Probably an error in converting it to long format.";const n=math.deepCopyObject(t),i=math.deepCopyObject(e.inCheck),r=math.deepCopyObject(e.attackers),a=e.moveIndex;movepiece.forwardToFront(e,{flipTurn:!1,animateLastMove:!1,updateData:!1,updateProperties:!1,simulated:!0});const s=gamefileutility.getPieceAtCoords(e,n.startCoords);if(!s)return console.log(`Opponent's move is illegal because no piece exists at the startCoords. Move: ${JSON.stringify(n)}`),l("No piece exists at start coords.");if(math.getPieceColorFromType(s.type)!==e.whosTurn)return console.log(`Opponent's move is illegal because you can't move a non-friendly piece. Move: ${JSON.stringify(n)}`),l("Can't move a non-friendly piece.");if(n.promotion){if(!s.type.startsWith("pawns"))return console.log(`Opponent's move is illegal because you can't promote a non-pawn. Move: ${JSON.stringify(n)}`),l("Can't promote a non-pawn.");const t=math.getPieceColorFromType(n.promotion);if(e.whosTurn!==t)return console.log(`Opponent's move is illegal because they promoted to the opposite color. Move: ${JSON.stringify(n)}`),l("Can't promote to opposite color.");const o=math.trimWorBFromType(n.promotion);if(!e.gameRules.promotionsAllowed[e.whosTurn].includes(o))return console.log(`Opponent's move is illegal because the specified promotion is illegal. Move: ${JSON.stringify(n)}`),l("Specified promotion is illegal.")}else if(specialdetect.isPawnPromotion(e,s.type,n.endCoords))return console.log(`Opponent's move is illegal because they didn't promote at the promotion line. Move: ${JSON.stringify(n)}`),l("Didn't promote when moved to promotion line.");const c=legalmoves.calculate(e,s);if(!legalmoves.checkIfMoveLegal(c,n.startCoords,n.endCoords))return console.log(`Opponent's move is illegal because the destination coords are illegal. Move: ${JSON.stringify(n)}`),l(`Destination coordinates are illegal. inCheck: ${JSON.stringify(e.inCheck)}. attackers: ${JSON.stringify(e.attackers)}. originalMoveIndex: ${a}. inCheckB4Forwarding: ${i}. attackersB4Forwarding: ${JSON.stringify(r)}`);if(!1===o||wincondition.isGameConclusionDecisive(o)){const t=math.getPieceColorFromType(s.type),i=movepiece.simulateMove(e,n,t,{doGameOverChecks:!0});if(i.gameConclusion!==o)return console.log(`Opponent's move is illegal because gameConclusion doesn't match. Should be "${i.gameConclusion}", received "${o}". Their move: ${JSON.stringify(n)}`),l(`Game conclusion isn't correct. Received: ${o}. Should be ${i.gameConclusion}`)}return movepiece.rewindGameToIndex(e,a,{removeMove:!1,updateData:!1}),!0;function l(t){return movepiece.rewindGameToIndex(e,a,{removeMove:!1,updateData:!1}),t}}})}(),loadbalancer=function(){let e,t,o=0,n=0;const i=1e3,r=[];let a=0,s=0,c=0,l=0,u=1,d=1;let m=!1;const p={normal:3e4,dev:2e3};let g,f=!1;const h=36e5;let v,P=!0,b=!0;let y;function w(){clearTimeout(v),v=setTimeout(k,h)}function C(){m=!0,g=void 0}function k(){if(invites.doWeHave())return w();f=!0,v=void 0,websocket.unsubFromInvites()}return window.addEventListener("focus",(()=>{P=!0})),window.addEventListener("blur",(function(){P=!1})),document.addEventListener("visibilitychange",(function(){document.hidden?(b=!1,y=setTimeout(invites.cancel,18e5)):(b=!0,clearTimeout(y),y=void 0,onlinegame.cancelMoveSound())})),Object.freeze({getRunTime:function(){return e},getDeltaTime:function(){return t},update:function(n){!function(n){e=n,t=(e-o)/1e3,o=e}(n),r.push(e),function(){const t=e-i,o=math.binarySearch_findValue(r,t);r.splice(0,o)}(),a=1e3*r.length/i,stats.updateFPS(a),function(){if(a<=s)return;s=a,c=1e3/s}(),input.atleast1InputThisFrame()&&(m=!1,f=!1,clearTimeout(g),g=setTimeout(C,main.devBuild?p.dev:p.normal),w(),invites.subscribeToInvites())},getLongTaskTime:function(){return l},timeAnimationFrame:function(){n=performance.now()-e,function(){l=c-n-d;const e=n*u;l=Math.max(l,e),l=Math.min(l,c)}()},refreshPeriod:1e3,refreshPeriodAFK:5e3,stayConnectedPeriod:5e3,gisAFK:function(){return m},gisHibernating:function(){return f},isPageHidden:function(){return!b}})}(),localstorage=function(){const e=!1;function t(e){const t=localStorage.getItem(e);if(null==t)return;let n;try{n=JSON.parse(t)}catch(t){return void o(e)}if(!function(e){if(null==e.expires)return console.log(`Local storage item was in an old format. Deleting it! Value: ${JSON.stringify(e)}}`),!0;return Date.now()>=e.expires}(n))return n.value;o(e)}function o(t){e&&console.log(`Deleting local storage item with key '${t}!'`),localStorage.removeItem(t)}return Object.freeze({saveItem:function(t,o,n=864e5){e&&console.log(`Saving key to local storage: ${t}`);const i={value:o,expires:Date.now()+n},r=JSON.stringify(i);localStorage.setItem(t,r)},loadItem:t,deleteItem:o,eraseExpiredItems:function(){const e=Object.keys(localStorage);e.length>0&&console.log(`Items in local storage: ${JSON.stringify(e)}`);for(const o of e)t(o)},eraseAll:function(){console.log("Erasing ALL items in local storage...");const e=Object.keys(localStorage);for(const t of e)o(t)}})}(),main=function(){let e=!0,t=!1,o=!1;return Object.freeze({GAME_VERSION:"1.3.3.1",devBuild:0,videoMode:!1,gforceCalc:function(){return o},renderThisFrame:function(){e=!0},enableForceRender:function(){t=!0},sforceCalc:function(e){o=e},start:function(){guiloading.closeAnimation(),webgl.init(),shaders.initPrograms(),camera.init(),browsersupport.checkBrowserSupport(),game.init(),input.initListeners(),window.addEventListener("beforeunload",(function(e){e=e||window.event,websocket.closeSocket(),validation.deleteToken(),invites.deleteInviteTagInLocalStorage(),localstorage.eraseExpiredItems()})),onlinegame.askServerIfWeAreInGame(),localstorage.eraseExpiredItems(),function(){const e=document.querySelectorAll("img[data-src]"),t=new IntersectionObserver(((e,t)=>{e.forEach((e=>{if(!e.isIntersecting)return;const o=e.target;o.src||(console.log("skipping"),o.src=o.getAttribute("data-src"),o.removeAttribute("data-src")),t.unobserve(o)}))}),{rootMargin:"0px 0px 50px 0px",threshold:.01});e.forEach((e=>{t.observe(e)}))}(),function(){const o=function(n){loadbalancer.update(n),game.update(),function(){t&&(e=!0);if(!e)return;t=!1,webgl.clearScreen(),game.render(),e=!1}(),input.resetKeyEvents(),loadbalancer.timeAnimationFrame(),requestAnimationFrame(o)};requestAnimationFrame(o)}()},copyToClipboard:function(e){navigator.clipboard.writeText(e).then((()=>{console.log("Copied to clipboard")})).catch((e=>{console.error("Failed to copy to clipboard",e)}))},sleep:function(e){return new Promise((t=>setTimeout(t,e)))}})}();function a(e,t){if(!e)throw new Error("Cannot log an object without a message");console.log(e),console.log(math.deepCopyObject(t))}function b(){console.error("Generic error")}const math=function(){function e(e,t){return e?t?(t[0]e.right&&(e.right=t[0]),void(t[1]e.top&&(e.top=t[1]))):console.error("Undefined coords shouldn't be passed into math.expandBoxToContainSquare()!"):console.error("Cannot expand an undefined box to fit a square!")}function t(e,t){const o=t[0]-e[0],n=t[1]-e[1];return Math.hypot(o,n)}function o(e){let t="";const o="0123456789abcdefghijklmnopqrstuvwxyz";for(let n=0;ne.right)&&(!(t.bottome.top)))},boxContainsSquare:function(e,t){return t||console.log("We need a square to test if it's within this box!"),"number"!=typeof t[0]&&console.log("Square is of the wrong data type!"),!(t[0]e.right)&&(!(t[1]e.top)))},getUpDiagonalFromCoords:function(e){return-e[0]+e[1]},getDownDiagonalFromCoords:function(e){return e[0]+e[1]},deepCopyObject:function e(t){if("object"!=typeof t||null===t)return t;let o=Array.isArray(t)?[]:{};for(let n in t){const i=t[n];o[n]=e(i)}return o},getKeyFromCoords:function(e){return`${e[0]},${e[1]}`},getCoordsFromKey:function(e){return e.split(",").map(Number)},isOrthogonalDistanceGreaterThanValue:function(e,t,o){const n=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]);return n>o||i>o},getBaseLog10:function(e){return Math.log(e)/Math.log(10)},convertWorldSpaceToCoords:function(e){const t=movement.getBoardPos(),o=movement.getBoardScale();return[e[0]/o+t[0],e[1]/o+t[1]]},convertWorldSpaceToCoords_Rounded:function(e){const t=movement.getBoardPos(),o=movement.getBoardScale(),n=e[0]/o+t[0],i=e[1]/o+t[1],r=board.gsquareCenter();return[Math.floor(n+r),Math.floor(i+r)]},convertCoordToWorldSpace:function(e,t=movement.getBoardPos(),o=movement.getBoardScale()){return[(e[0]-t[0]+.5-board.gsquareCenter())*o,(e[1]-t[1]+.5-board.gsquareCenter())*o]},convertCoordToWorldSpace_ClampEdge:function(e){const t=movement.getBoardPos(),o=movement.getBoardScale();let n=(e[0]-t[0]+.5-board.gsquareCenter())*o,i=(e[1]-t[1]+.5-board.gsquareCenter())*o;const r=perspective.getEnabled(),a=perspective.distToRenderBoard,s=r?{left:-a,right:a,bottom:-a,top:a}:camera.getScreenBoundingBox(!1);return ns.right&&(n=r?perspective.distToRenderBoard:camera.getScreenBoundingBox(!1).right),is.top&&(i=r?perspective.distToRenderBoard:camera.getScreenBoundingBox(!1).top),[n,i]},closestPointOnLine:function(e,o,n){let i,r;const a=o[0]-e[0],s=o[1]-e[1];if(0===a){let t=n[1];to[1]&&(t=o[1]),i=[e[0],t]}else{const t=s/a,r=e[1]-t*e[0],c=(t*(n[1]-r)+n[0])/(t*t+1),l=t*c+r;i=co[0]?o:[c,l]}return r=t(i,n),{coords:i,distance:r}},getBoundingBoxOfBoard:function(e=movement.getBoardPos(),t=movement.getBoardScale()){const o=camera.getScreenBoundingBox().right/t,n=e[0]-o,i=e[0]+o,r=camera.getScreenBoundingBox().top/t;return{left:n,right:i,bottom:e[1]-r,top:e[1]+r}},convertPixelsToWorldSpace_Virtual:function(e){return e/camera.getCanvasHeightVirtualPixels()*(camera.getScreenBoundingBox(!1).top-camera.getScreenBoundingBox(!1).bottom)},convertWorldSpaceToPixels_Virtual:function(e){return e/(camera.getScreenBoundingBox(!1).top-camera.getScreenBoundingBox(!1).bottom)*camera.getCanvasHeightVirtualPixels()},getIntersectionEntryTile:function(e,t,o,n){const{left:i,right:r,top:a,bottom:s}=o;if(n.endsWith("left")){const o=i*e+t;if(o>=s&&o<=a)return[i,o]}if(n.startsWith("bottom")){const o=(s-t)*e;if(o>=i&&o<=r)return[o,s]}if(n.endsWith("right")){const o=r*e+t;if(o>=s&&o<=a)return[r,o]}if(n.startsWith("top")){const o=(a-t)*e;if(o>=i&&o<=r)return[o,a]}},convertWorldSpaceToGrid:function(e){return e/movement.getBoardScale()},euclideanDistance:t,manhattanDistance:function(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])},chebyshevDistance:function(e,t){const o=Math.abs(e[0]-t[0]),n=Math.abs(e[1]-t[1]);return Math.max(o,n)},generateID:o,generateNumbID:function(e){const t=Math.random(),o=10**e;return Math.floor(t*o)},toRadians:function(e){return e*(Math.PI/180)},generatePerspectiveBoundingBox:function(e){const t=movement.getBoardPos(),o=e/movement.getBoardScale();return{left:t[0]-o,right:t[0]+o,bottom:t[1]-o,top:t[1]+o}},areCoordsEqual:function(e,t){return!(!t||!t)&&(e[0]===t[0]&&e[1]===t[1])},areCoordsEqual_noValidate:function(e,t){return e[0]===t[0]&&e[1]===t[1]},binarySearch_findSplitPoint:function(e,t){if(null==t)throw new Error(`Cannot binary search when value is null! ${t}`);let o=0,n=e.length-1;for(;o<=n;){const i=Math.floor((o+n)/2),r=e[i];if(tr)o=i+1;else if(r===t)throw new`Cannot find split point of sortedArray when it already contains the value! ${t}. List: ${JSON.stringify(e)}`}return o},binarySearch_findValue:function(e,t){if(null==t)return console.error(`Cannot binary search when value is null! ${t}`);let o=0,n=e.length-1;for(;o<=n;){const i=Math.floor((o+n)/2),r=e[i];if(tr)o=i+1;else if(r===t)return i}return o},deleteValueFromOrganizedArray:function(e,t){let o=0,n=e.length-1;for(;o<=n;){const i=Math.floor((o+n)/2),r=e[i];if(t===r)return e.splice(i,1),i;tr&&(o=i+1)}},copyCoords:function(e){return[e[0],e[1]]},roundAwayFromZero:function(e){return e>0?Math.ceil(e):Math.floor(e)},getPieceColorFromType:function(e){if(e.endsWith("W"))return"white";if(e.endsWith("B"))return"black";if(e.endsWith("N"))return"neutral";throw new Error(`Cannot get the color of piece with type ${pieceType}`)},getOppositeColor:function(e){if("white"===e)return"black";if("black"===e)return"white";throw new Error(`Cannot return the opposite color of color ${e}!`)},getWorBFromType:function(e){return e.charAt(e.length-1)},getWorBFromColor:function(e){if("white"===e)return"W";if("black"===e)return"B";if("neutral"===e)return"N";throw new Error(`Cannot return WorB from strange color ${e}!`)},trimWorBFromType:function(e){return e.slice(0,-1)},isFloat32Array:function(e){return e instanceof Float32Array},PseudoRandomGenerator:function(e){const t=2491057,o=8388607;let n=e;this.nextInt=function(){const e=(16807*n+t)%o;return n=e,e},this.nextFloat=function(){const e=(16807*n+t)%o;return n=e,e/o}},decimalToPercent:function(e){return Math.round(100*e).toString()+"%"},copyPropertiesToObject:function(e,t){const o=Object.keys(e);for(let n=0;nt.right?e.right:t.right,bottom:e.bottomt.top?e.top:t.top}:console.error("Cannot merge 2 bounding boxes when 1+ isn't defined.")},getBoxFromCoordsList:function(t){if(null==t)return console.error("Coords not specified when calculating the bounding box of a coordinate list!");if(0===t.length)return console.error("Cannot calculate the bounding box of 0 coordinates!");const o={},n=t.shift();o.left=n[0],o.right=n[0],o.bottom=n[1],o.top=n[1];for(const n of t)e(o,n);return o},expandBoxToContainSquare:e,isJson:function(e){try{JSON.parse(e)}catch(e){return!1}return!0},invertObj:function(e){let t={};for(let o in e)t[e[o]]=o;return t},getUTCDateTime:function(e){const t=e?new Date(e):new Date;return`${t.getUTCFullYear()}/${("0"+(t.getUTCMonth()+1)).slice(-2)}/${("0"+t.getUTCDate()).slice(-2)} ${("0"+t.getUTCHours()).slice(-2)}:${("0"+t.getUTCMinutes()).slice(-2)}:${("0"+t.getUTCSeconds()).slice(-2)}`},getUTCTimestamp:function(e){const[t,o]=e.split(" "),[n,i,r]=t.split("/").map((e=>parseInt(e,10))),[a,s,c]=o.split(":").map((e=>parseInt(e,10)));return new Date(Date.UTC(n,i-1,r,a,s,c)).getTime()},capitalizeFirstLetter:function(e){return e.charAt(0).toUpperCase()+e.slice(1)},minutesToMillis:function(e){return 60*e*1e3},secondsToMillis:function(e){return 1e3*e},getTotalMilliseconds:function(e){const t={milliseconds:1,seconds:1e3,minutes:6e4,hours:36e5,days:864e5,weeks:6048e5,months:2592e6,years:31536e6};let o=0;for(const n in e)t[n]&&(o+=e[n]*t[n]);return o},genUniqueID:function(e,t){let n;do{n=o(e)}while(null!=t[n]);return n}})}(),miniimage=function(){let e;const t=.6;let o,n=[],i=[],r=!1,a=!1;function s(){if(r=!1,!movement.isScaleLess1Pixel_Virtual())return;if(a)return;n=[],i=[],null==e&&console.error("widthWorld is not defined yet");const s=e/2,c=movement.getBoardPos(),l=movement.getBoardScale();pieces.forEachPieceType((function(o){const a=game.getGamefile().ourPieces[o];if(!a)return;const u=perspective.getIsViewingBlackPerspective()?-1:1,{texStartX:d,texStartY:m,texEndX:p,texEndY:g}=bufferdata.getTexDataOfType(o,u),{r:f,g:h,b:v}=options.getColorOfType(o);for(let o=0;oP&&Tb&&S0){const e=area.calculateFromCoordsList(i),t={endCoords:e.coords,endScale:e.scale};transition.teleport(t),input.getTouchClicked()||input.removeMouseDown_Left()}}return Object.freeze({gwidthWorld:function(){return e},gopacity:function(){return t},isHovering:function(){return r},isDisabled:function(){return a},testIfToggled:function(){input.isKeyDown("p")&&(a=!a,main.renderThisFrame(),a?statustext.showStatus("Toggled off icon rendering."):statustext.showStatus("Toggled on icon rendering."))},genModel:s,render:function(){movement.isScaleLess1Pixel_Virtual()&&(a||(o||s(),webgl.executeWithDepthFunc_ALWAYS((()=>{o.render()}))))},enable:function(){a=!1},disable:function(){a=!0},recalcWidthWorld:function(){e=math.convertPixelsToWorldSpace_Virtual(36)}})}(),movement=function(){const e=50;let t=11;const o=6,n=1,i=20,r=.03,a=2.5,s="pidough";let c,l,u,d,m,p,g,f=[0,0],h=[0,0],v=1,P=0,b=0,y=!1,w=!1;function C(e,t){return t!==s?e:Array.isArray(e)?isNaN(e[0])||isNaN(e[1])?console.error(`Cannot set position to ${e}!`):(f=e,void main.renderThisFrame()):console.error(`New position must be an array! ${e}`)}function k(e,t){return t!==s?(main.devBuild&&console.error("Incorrect pass"),e):isNaN(e)?console.error(`Cannot set scale to ${e}!`):e<=0?(console.error(`Cannot set scale to ${e}!!`),console.trace()):(v=e,v>i&&(v=i,P=0),y=v0?(P-=loadbalancer.getDeltaTime()*o,P<0&&(P=0)):(P+=loadbalancer.getDeltaTime()*o,P>0&&(P=0)))}return Object.freeze({getScale_When1TileIs1Pixel_Physical:function(){return p},setScale_When1TileIs1Pixel_Physical:function(e){p=e},getScale_When1TileIs1Pixel_Virtual:function(){return g},setScale_When1TileIs1Pixel_Virtual:function(e){g=e},setPanVelCap:function(e){main.devBuild&&(t=e)},isScaleLess1Pixel_Physical:function(){return y},isScaleLess1Pixel_Virtual:function(){return w},getBoardPos:function(){return math.copyCoords(f)},setBoardPos:C,getBoardScale:function(){return v},setBoardScale:k,recalcPosition:function(){transition.areWeTeleporting()||(T(),function(){if(0===P)return;const e=P>0||v>board.glimitToDampScale()?1:v/board.glimitToDampScale();main.renderThisFrame();k(v*(1+loadbalancer.getDeltaTime()*P*e),s)}())},panBoard:T,updateNavControls:function(){if(function(){if(0===b)return;if(1===b)return void(input.isMouseHeld_Left()||(b=0));if(0!==input.getTouchHelds().length)return;b=0,u=void 0}(),!transition.areWeTeleporting()){if(guipromotion.isUIOpen())return x(),void I();!function(){if(perspective.getEnabled())return;0===b?input.isMouseDown_Left()?function(){b=1;const e=board.gtile_MouseOver_Float();c=[e[0],e[1]],S()}():input.getTouchHelds().length>0&&function(){b=2,S();M(1),input.getTouchHelds().length>1&&E()}():2===b&&function(){const e=input.getTouchHelds().length;if(void 0===u){if(1===e)l.id!==input.getTouchHelds()[0].id&&M(1);else if(e>1){input.touchHeldsIncludesID(l.id)||M(1),E()}}else if(1===e)M(1),u=void 0;else if(e>1){const e=input.touchHeldsIncludesID(l.id),t=input.touchHeldsIncludesID(u.id);if(!e||!t){M(1),E()}}}()}(),function(){if(0!==b)return;let e=!1;input.atleast1KeyHeld()&&(input.isKeyHeld("d")&&(e=!0,B(0)),input.isKeyHeld("a")&&(e=!0,B(180)),input.isKeyHeld("w")&&(e=!0,B(90)),input.isKeyHeld("s")&&(e=!0,B(-90)));if(e){const e=Math.hypot(...h),o=t/e;o<1&&(h[0]*=o,h[1]*=o)}else x()}(),function(){let e=!1;input.isKeyHeld(" ")&&(e=!0,P-=loadbalancer.getDeltaTime()*o,P<-n&&(P=-n));input.isKeyHeld("shift")&&(e=!0,P+=loadbalancer.getDeltaTime()*o,P>n&&(P=n));e||I();0!==input.getMouseWheel()&&(P-=r*input.getMouseWheel(),P>a?P=a:P<-a&&(P=-a))}()}},randomizePanVelDir:function(){const e=2*Math.random()*Math.PI,t=math.getXYComponents_FromAngle(e);h[0]=t[0]*guititle.boardVel,h[1]=t[1]*guititle.boardVel},dragBoard:function(){1==b?function(){main.renderThisFrame();const e=perspective.getIsViewingBlackPerspective()?-1:1,t=c[0]-e*input.getMousePos()[0]/board.gtileWidth_Pixels(),o=c[1]-e*input.getMousePos()[1]/board.gtileWidth_Pixels();f=[t,o]}():2==b&&function(){main.renderThisFrame();const e=perspective.getIsViewingBlackPerspective()?-1:1;if(void 0===u){const t=input.getTouchHelds()[0],o=l.x-e*t.x/board.gtileWidth_Pixels(),n=l.y-e*t.y/board.gtileWidth_Pixels();return input.moveMouse(t),void(f=[o,n])}const t=u.x-l.x,o=u.y-l.y,n=l.x+t/2,i=l.y+o/2,r=input.getTouchHeldByID(l.id),a=input.getTouchHeldByID(u.id),c=a.x-r.x,p=a.y-r.y,g=r.x+c/2,h=r.y+p/2,v=n-e*(g/board.gtileWidth_Pixels()),P=i-e*(h/board.gtileWidth_Pixels());f=[v,P];const b=[r.x,r.y],y=[a.x,a.y];let w=math.euclideanDistance(b,y)/m;if(dt;)s(e,{animate:!1,updateData:n,removeMove:o});guigameinfo.updateWhosTurn(e),main.renderThisFrame()},rewindMove:s,simulateMove:function(t,o,n,{doGameOverChecks:i=!1}={}){e(t,o,{pushClock:!1,animate:!1,updateData:!1,simulated:!0,doGameOverChecks:i,updateProperties:i});const r={isCheck:i?t.inCheck:checkdetection.detectCheck(t,n,[]),gameConclusion:i?t.gameConclusion:void 0};return s(t,{updateData:!1,animate:!1}),r},stripSpecialMoveTagsFromCoords:function(e){return[e[0],e[1]]}})}(),movesets=Object.freeze({getPieceMovesets:function(e=1/0){if("number"!=typeof e)throw new Error("slideLimit gamerule is in an unsupported value.");return{pawns:function(){return{individual:[]}},knights:function(){return{individual:[[-2,1],[-1,2],[1,2],[2,1],[-2,-1],[-1,-2],[1,-2],[2,-1]]}},hawks:function(){return{individual:[[-3,0],[-2,0],[2,0],[3,0],[0,-3],[0,-2],[0,2],[0,3],[-2,-2],[-2,2],[2,-2],[2,2],[-3,-3],[-3,3],[3,-3],[3,3]]}},kings:function(){return{individual:[[-1,0],[-1,1],[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1]]}},guards:function(){return{individual:[[-1,0],[-1,1],[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1]]}},rooks:function(){return{individual:[],horizontal:[-e,e],vertical:[-e,e]}},bishops:function(){return{individual:[],diagonalUp:[-e,e],diagonalDown:[-e,e]}},queens:function(){return{individual:[],horizontal:[-e,e],vertical:[-e,e],diagonalUp:[-e,e],diagonalDown:[-e,e]}},royalQueens:function(){return{individual:[],horizontal:[-e,e],vertical:[-e,e],diagonalUp:[-e,e],diagonalDown:[-e,e]}},chancellors:function(){return{individual:[[-2,1],[-1,2],[1,2],[2,1],[-2,-1],[-1,-2],[1,-2],[2,-1]],horizontal:[-e,e],vertical:[-e,e]}},archbishops:function(){return{individual:[[-2,1],[-1,2],[1,2],[2,1],[-2,-1],[-1,-2],[1,-2],[2,-1]],diagonalUp:[-e,e],diagonalDown:[-e,e]}},amazons:function(){return{individual:[[-2,1],[-1,2],[1,2],[2,1],[-2,-1],[-1,-2],[1,-2],[2,-1]],horizontal:[-e,e],vertical:[-e,e],diagonalUp:[-e,e],diagonalDown:[-e,e]}},camels:function(){return{individual:[[-3,1],[-1,3],[1,3],[3,1],[-3,-1],[-1,-3],[1,-3],[3,-1]]}},giraffes:function(){return{individual:[[-4,1],[-1,4],[1,4],[4,1],[-4,-1],[-1,-4],[1,-4],[4,-1]]}},zebras:function(){return{individual:[[-3,2],[-2,3],[2,3],[3,2],[-3,-2],[-2,-3],[2,-3],[3,-2]]}},centaurs:function(){return{individual:[[-1,0],[-1,1],[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1],[-2,1],[-1,2],[1,2],[2,1],[-2,-1],[-1,-2],[1,-2],[2,-1]]}},royalCentaurs:function(){return{individual:[[-1,0],[-1,1],[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1],[-2,1],[-1,2],[1,2],[2,1],[-2,-1],[-1,-2],[1,-2],[2,-1]]}}}}});function Move(){console.error("This Move constructor should NEVER be called! It is purely for useful JSDoc dropdown info when working with the `Move` type."),this.type=void 0,this.startCoords=void 0,this.endCoords=void 0,this.captured=void 0,this.check=void 0,this.mate=void 0,this.rewindInfo={capturedIndex:void 0,pawnIndex:void 0,specialRightStart:void 0,specialRightEnd:void 0,enpassant:void 0,moveRuleState:void 0,checksGiven:void 0,inCheck:void 0,attackers:void 0},this.compact=void 0}const movesscript=function(){function e(){return game.getGamefile().mesh.locked?statustext.pleaseWaitForTask():n(game.getGamefile())?(main.renderThisFrame(),movepiece.rewindMove(game.getGamefile(),{removeMove:!1}),selection.unselectPiece(),guinavigation.update_MoveButtons(),void stats.showMoves()):stats.showMoves()}function t(){if(game.getGamefile().mesh.locked)return statustext.pleaseWaitForTask();if(!o(game.getGamefile()))return stats.showMoves();const e=function(){const e=game.getGamefile().moveIndex+1;return a(game.getGamefile().moves,e)}();movepiece.makeMove(game.getGamefile(),e,{flipTurn:!1,recordMove:!1,pushClock:!1,doGameOverChecks:!1,updateProperties:!1}),guinavigation.update_MoveButtons(),stats.showMoves()}function o(e){if(null==e)throw new Error("Cannot ask if incrementing moves is legal when there's no gamefile.");const t=e.moveIndex+1;return!i(e.moves,t)}function n(e){if(null==e)throw new Error("Cannot ask if decrementing moves is legal when there's no gamefile.");const t=e.moveIndex-1;return!i(e.moves,t)}function i(e,t){return t<-1||t>=e.length}function r(e){const t=e.length-1;if(!(t<0))return e[t]}function a(e,t){return i(e,t)?console.error("Cannot get next move when index overflow"):e[t]}function s(e,t){return t===e.length-1}return Object.freeze({update:function(){!function(){if(!input.isKeyDown("arrowleft"))return;if(guinavigation.isRewindButtonLocked())return;e()}(),function(){if(!input.isKeyDown("arrowright"))return;t()}()},rewindMove:e,forwardMove:t,isIncrementingLegal:o,isDecrementingLegal:n,isIndexOutOfRange:i,getLastMove:r,getCurrentMove:function(e){const t=e.moveIndex;if(!(t<0))return e.moves[t]},getMoveFromIndex:a,areWeViewingLatestMove:function(e){const t=e.moveIndex;return s(e.moves,t)},isIndexTheLastMove:s,getWhosTurnAtFront:function(e){let t=e.moves.length;return"black"===e.startSnapshot.turn&&t++,0===t%2?"white":"black"},getPlyCount:function(e){return e.length},hasPieceMoved:function(e,t){for(const o of e.moves)if(math.areCoordsEqual(o.endCoords,t))return!0;return!1},deleteLastMove:function(e){if(0===e.length)return console.error("Cannot delete last move when there are none");e.pop()},flagLastMoveAsCheck:function(e){if(0===e.moves.length)throw new Error("Cannot flag the game's last move as a 'check' when there are no moves.");r(e.moves).check=!0},flagLastMoveAsMate:function(e){if(0===e.moves.length)return;r(e.moves).mate=!0},areMovesIn2DFormat:function(e){return 0!==e.length&&Array.isArray(e[0])},convertMovesTo1DFormat:function(e,t){t.turn="white";const o=[];for(let n=0;n1},getColorThatPlayedMoveIndex:function(e,t){if(-1===e)return console.error("Cannot get color that played move index when move index is -1.");const o=e%2==0?"white":"black";return t?math.getOppositeColor(o):o}})}(),onlinegame=function(){let e,t,o,n=!1,i=!1;const r={originalDocumentTitle:document.title,timeoutID:void 0,moveSound_timeoutID:void 0},a={timeUntilAFKSecs:40,timeUntilAFKSecs_Abortable:20,timerToLossFromAFK:2e4,timeoutID:void 0,timeWeLoseFromAFK:void 0,displayAFKTimeoutID:void 0,playStaccatoTimeoutID:void 0,timeOpponentLoseFromAFK:void 0,displayOpponentAFKTimeoutID:void 0},s={timeOpponentLoseFromDisconnect:void 0,displayOpponentDisconnectTimeoutID:void 0},c={time:!1,keyMinutes:[30,20,15,10,5,2,1,0],timeoutID:void 0};function l(){if(clearTimeout(a.timeoutID),!M()||game.getGamefile().gameConclusion)return;const e=movesscript.isGameResignable(game.getGamefile())?a.timeUntilAFKSecs:a.timeUntilAFKSecs_Abortable;a.timeoutID=setTimeout(d,1e3*e)}function u(){clearTimeout(a.timeoutID),clearTimeout(a.displayAFKTimeoutID),clearTimeout(a.playStaccatoTimeoutID),clearTimeout(a.displayOpponentAFKTimeoutID)}function d(){websocket.sendmessage("game","AFK"),a.timeWeLoseFromAFK=Date.now()+a.timerToLossFromAFK,sound.playSound_lowtime(),m(20),a.playStaccatoTimeoutID=setTimeout(p,1e4,"c3",10)}function m(e){const t=movesscript.isGameResignable(game.getGamefile())?"resigning":"aborting";statustext.showStatusForDuration(`You are AFK. Auto-${t} in ${e}...`,1e3);const o=e-1;if(0===o)return;const n=a.timeWeLoseFromAFK-Date.now()-1e3*o;a.displayAFKTimeoutID=setTimeout(m,n,o)}function p(e,t){if("c3"===e)sound.playSound_viola_c3();else{if("c4"!==e)return console.error("Invalid violin note");sound.playSound_violin_c4()}let o=t>5?t-1:t-.5;if(0===o)return;const n=o===Math.floor(o)?"c3":"c4",i=a.timeWeLoseFromAFK-Date.now()-1e3*o;a.playStaccatoTimeoutID=setTimeout(p,i,n,o)}function g(e){if(f(),!e)return console.error("Cannot display opponent is AFK when autoResignTime not specified");a.timeOpponentLoseFromAFK=e;const t=e-Date.now();h(Math.ceil(t/1e3))}function f(){clearTimeout(a.displayOpponentAFKTimeoutID),a.displayOpponentAFKTimeoutID=void 0}function h(e){const t=movesscript.isGameResignable(game.getGamefile())?"resigning":"aborting";statustext.showStatusForDuration(`Opponent is AFK. Auto-${t} in ${e}...`,1e3);const o=e-1;if(0===o)return;const n=a.timeOpponentLoseFromAFK-Date.now()-1e3*o;a.displayOpponentAFKTimeoutID=setTimeout(h,n,o)}function v({autoDisconnectResignTime:e,wasByChoice:t}={}){if(!e)return console.error("Cannot display opponent has disconnected when autoResignTime not specified");if(null==t)return console.error("Cannot display opponent has disconnected when wasByChoice not specified");f(),P(),s.timeOpponentLoseFromDisconnect=e;const o=e-Date.now();b(Math.ceil(o/1e3),t)}function P(){clearTimeout(s.displayOpponentDisconnectTimeoutID),s.displayOpponentDisconnectTimeoutID=void 0}function b(e,t){const o=t?"disconnected":"lost connection",n=movesscript.isGameResignable(game.getGamefile())?"resigning":"aborting";a.timeWeLoseFromAFK||statustext.showStatusForDuration(`Opponent has ${o}. Auto-${n} in ${e}...`,1e3);const i=e-1;if(0===i)return;const r=s.timeOpponentLoseFromDisconnect-Date.now()-1e3*i;s.displayOpponentDisconnectTimeoutID=setTimeout(b,r,i,t)}function y(e){if(!loadbalancer.isPageHidden())return document.title=r.originalDocumentTitle;document.title=e?"YOUR MOVE":r.originalDocumentTitle,r.timeoutID=setTimeout(y,1500,!e)}function w(){document.title=r.originalDocumentTitle,clearTimeout(r.timeoutID),r.timeoutID=void 0}function C(){if(!loadbalancer.isPageHidden())return;if(!movesscript.isGameResignable(game.getGamefile()))return;const e=1e3*a.timeUntilAFKSecs/2;r.moveSound_timeoutID=setTimeout((()=>{sound.playSound_move(0)}),e)}function k(){n&&websocket.sendmessage("game","resync",e,!1,(function(){i=!0}))}function T(e){const t={reason:e,opponentsMoveNumber:game.getGamefile().moves.length+1};websocket.sendmessage("game","report",t)}function S(){n=!1,e=void 0,t=void 0,o=void 0,i=!1,u(),r.timeoutID=void 0,a.timeoutID=void 0,a.timeWeLoseFromAFK=void 0,a.displayAFKTimeoutID=void 0,a.playStaccatoTimeoutID=void 0,a.displayOpponentAFKTimeoutID=void 0,a.timeOpponentLoseFromAFK=void 0,I(),w(),perspective.resetRotations()}function M(){return game.getGamefile().whosTurn===o}function E(){if(!n||!i)return;main.devBuild&&console.log("Sending our move..");const e=game.getGamefile(),t={move:movesscript.getLastMove(e.moves).compact,moveNumber:e.moves.length,gameConclusion:e.gameConclusion};websocket.sendmessage("game","submitmove",t,!0),l()}function B(e){if(c.time===e)return;I(),c.time=e;const t=e-Date.now(),o=Math.ceil(t/6e4);console.log(`Server has informed us it is restarting in ${o} minutes!`),x(o)}function x(e){if(0===e)return statustext.showStatus("Server restarting shortly...",!1,2),void(c.time=!1);const t=e>1?"s":"";let o;statustext.showStatus(`Server restarting in ${e} minute${t}...`,!1,2);for(const t of c.keyMinutes)if(t0&&movesscript.getColorThatPlayedMoveIndex(e.moves.length-1,"black"===e.startSnapshot.turn)===o,s=0===n.length&&1===e.moves.length||e.moves.length>1&&n.length>0&&e.moves[e.moves.length-2].compact===n[n.length-1];if(!i&&r&&a&&s)return console.log("Sending our move again after resyncing.."),E();const c=e.moveIndex;movepiece.forwardToFront(e,{flipTurn:!1,animateLastMove:!1,updateProperties:!1});let u=!1;for(;e.moves.length>n.length;)movepiece.rewindMove(e,{animate:!1}),console.log("Rewound one move while resyncing to online game."),u=!0;let d=n.length-1;for(;-1!==d;){const t=e.moves[d];if(t){if(t.compact===n[d])break;movepiece.rewindMove(e,{animate:!1}),console.log("Rewound one INCORRECT move while resyncing to online game."),u=!0}d--}const m=math.getOppositeColor(o);for(;d90&&o<270}return Object.freeze({getEnabled:function(){return e},getRotX:function(){return t},getRotZ:function(){return o},distToRenderBoard:1500,viewRange:1e3,getIsViewingBlackPerspective:function(){return n},toggle:function(){if(!input.isMouseSupported())return statustext.showStatus("Perspective mode is available on desktop!");e?c():function(){if(e)return console.error("Should not be enabling perspective when it is already enabled.");e=!0,guipause.gelement_perspective().textContent="Perspective: On",guipause.callback_Resume(),u(),board.initDarkTilesModel(),m(),piecesmodel.initRotatedPiecesModel(game.getGamefile()),statustext.showStatus("WASD to move. Space & shift to zoom.")}()},disable:c,resetRotations:l,relockMouse:function(){e&&(d()||guipause.areWePaused()||selection.isPawnCurrentlyPromoting()||u())},update:function(n,i){e&&d()&&(t+=.13*i,o+=.13*n,function(){t>0?t=0:t<-180&&(t=-180);o<0?o+=360:o>360&&(o-=360)}(),p(),camera.onPositionChange())},applyRotations:function(e){if(0===t&&0===o)return;const n=camera.getPosition();if(mat4.translate(e,e,n),t<0){const o=t*(Math.PI/180);mat4.rotate(e,e,o,[1,0,0])}const i=o*(Math.PI/180);mat4.rotate(e,e,i,[0,0,1]);const r=[-n[0],-n[1],-n[2]];mat4.translate(e,e,r)},isMouseLocked:d,renderCrosshair:function(){if(!e)return;if(main.videoMode)return;if(null==s)return console.error("Crosshair model is null but it should have been defined when toggling on perspective!");const t=camera.getViewMatrix();camera.initViewMatrix(!0),webgl.executeWithInverseBlending((()=>{s.render()})),camera.setViewMatrix(t)},unlockMouse:function(){e&&document.exitPointerLock()},isLookingUp:function(){return e&&t<=-90},initCrosshairModel:m})}(),pieces=function(){const e=["kingsW","giraffesW","camelsW","zebrasW","amazonsW","queensW","royalQueensW","hawksW","chancellorsW","archbishopsW","centaursW","royalCentaursW","knightsW","guardsW","rooksW","bishopsW","pawnsW"],t=["kingsB","giraffesB","camelsB","zebrasB","amazonsB","queensB","royalQueensB","hawksB","chancellorsB","archbishopsB","centaursB","royalCentaursB","knightsB","guardsB","rooksB","bishopsB","pawnsB"],o=["obstaclesN","voidsN"];let n,i;return Object.freeze({white:e,black:t,neutral:o,royals:["kings","royalQueens","royalCentaurs"],jumpingRoyals:["kings","royalCentaurs"],extraUndefineds:5,renderPiecesInGame:function(e){!function(e){if(null==e.mesh)return;if(null==e.mesh.model)return;if(movement.isScaleLess1Pixel_Virtual()&&!miniimage.isDisabled())return;!movement.isScaleLess1Pixel_Virtual()&&board.isOffsetOutOfRangeOfRegenRange(e.mesh.offset,piecesmodel.regenRange)&&piecesmodel.shiftPiecesModel(e);const t=movement.getBoardPos(),o=[-t[0]+e.mesh.offset[0],-t[1]+e.mesh.offset[1],0],n=movement.getBoardScale(),i=[n,n,1];let r;r=onlinegame.areWeColor("black")?perspective.getEnabled()&&!perspective.getIsViewingBlackPerspective()&&null!=e.mesh.rotatedModel?e.mesh.rotatedModel:e.mesh.model:perspective.getEnabled()&&perspective.getIsViewingBlackPerspective()&&null!=e.mesh.rotatedModel?e.mesh.rotatedModel:e.mesh.model;r.render(o,i)}(e),voids.render(e),miniimage.render()},renderGhostPiece:function(e,t){const o=options.getColorOfType(e);o.a*=.4;const n=bufferdata.getDataQuad_ColorTexture_FromCoordAndType(t,e,o);buffermodel.createModel_ColorTextured(new Float32Array(n),2,"TRIANGLES",pieces.getSpritesheet()).render()},forEachPieceType:function(n,{ignoreNeutrals:i=!1,ignoreVoids:r=!1}={}){for(let o=0;o=g))return;const e=h/i;stats.updatePiecesMesh(e),await main.sleep(0),p=performance.now(),g=p+loadbalancer.getLongTaskTime()}return stats.showPiecesMesh(),await pieces.forEachPieceType_Async((async function(o){if(e.mesh.terminate)return;const n=game.getGamefile().ourPieces[o],{texStartX:i,texStartY:r,texEndX:s,texEndY:c}=bufferdata.getTexDataOfType(o,u);if(t){const e=math.getPieceColorFromType(o),n=t[e];var p=n[0],g=n[1],P=n[2],b=n[3]}for(let o=0;o=m){if(f=0,await v(),e.mesh.terminate)return;main.gforceCalc()&&(m=1/0,main.sforceCalc(!1))}}}),{ignoreVoids:!0}),stats.hidePiecesMesh(),e.mesh.terminate?(console.log("Mesh generation terminated."),e.mesh.terminate=!1,e.mesh.locked--,void e.mesh.isGenerating--):(main.enableForceRender(),l.model=t?buffermodel.createModel_ColorTextured(l.data32,2,"TRIANGLES",pieces.getSpritesheet()):buffermodel.createModel_Textured(l.data32,2,"TRIANGLES",pieces.getSpritesheet()),math.copyPropertiesToObject(l,e.mesh),perspective.getEnabled()&&await piecesmodel.initRotatedPiecesModel(game.getGamefile(),!0),e.mesh.terminate?(e.mesh.terminate=!1,e.mesh.locked--,void e.mesh.isGenerating--):(voids.regenModel(e),o&&statustext.showStatus("Regenerated pieces.",!1,.5),main.renderThisFrame(),main.enableForceRender(),e.mesh.locked--,e.mesh.isGenerating--,void console.log("Done!")))},movebufferdata(e,t,o){if(!e.mesh.data64)throw new Error("Should not be moving piece data when data64 is not defined!");if(!e.mesh.data32)throw new Error("Should not be moving piece data when data32 is not defined!");let n=piecesmodel.getPieceIndexInData(e,t)*(e.mesh.stride*piecesmodel.pointsPerSquare);const{startX:i,startY:r,endX:a,endY:s}=bufferdata.getCoordDataOfTile_WithOffset(e.mesh.offset,o),c=e.mesh.stride;function l(e){e[n]=i,e[n+1]=r,e[n+1*c]=i,e[n+1*c+1]=s,e[n+2*c]=a,e[n+2*c+1]=r,e[n+3*c]=a,e[n+3*c+1]=r,e[n+4*c]=i,e[n+4*c+1]=s,e[n+5*c]=a,e[n+5*c+1]=s}l(e.mesh.data64),l(e.mesh.data32),perspective.getEnabled()&&(l(e.mesh.rotatedData64),l(e.mesh.rotatedData32));const u=5*c+2;e.mesh.model.updateBufferIndices(n,u),perspective.getEnabled()&&e.mesh.rotatedModel.updateBufferIndices(n,u)},deletebufferdata(e,t){if(!e.mesh.data64)throw new Error("Should not be deleting piece data when data64 is not defined!");if(!e.mesh.data32)throw new Error("Should not be deleting piece data when data32 is not defined!");const o=piecesmodel.getPieceIndexInData(e,t),n=e.mesh.stride*piecesmodel.pointsPerSquare,i=o*n;for(let t=0;tgamefileutility.calcPieceIndexInAllPieces(e,t)+coin.getCoinCount(),printbufferdataOnCoords(e,t){const o=gamefileutility.getPieceAtCoords(e,t);o||console.log("No piece at these coords to retrieve data from!");const n=piecesmodel.getPieceIndexInData(e,o);printbufferdataOnIndex(n)},printbufferdataOnIndex(e,t){const o=e.mesh.stride*piecesmodel.pointsPerSquare;let n=t*o;for(a=0;a=a){if(l=0,await m(),e.mesh.terminate)return;main.gforceCalc()&&(a=1/0,main.sforceCalc(!1))}}:async function(t,i){for(let r=0;r=a){if(l=0,await m(),e.mesh.terminate)return;main.gforceCalc()&&(a=1/0,main.sforceCalc(!1))}};if(await d(e.mesh.data64,e.mesh.rotatedData64),e.mesh.terminate)return console.log("Mesh generation terminated."),stats.hideRotateMesh(),t||(e.mesh.terminate=!1),e.mesh.locked--,void e.mesh.isGenerating--;if(await d(e.mesh.data32,e.mesh.rotatedData32),e.mesh.terminate)return console.log("Mesh generation terminated."),stats.hideRotateMesh(),t||(e.mesh.terminate=!1),e.mesh.locked--,void e.mesh.isGenerating--;async function m(){if(!(performance.now()>=c))return;const e=u/r;stats.updateRotateMesh(e),await main.sleep(0),s=performance.now(),c=s+loadbalancer.getLongTaskTime()}stats.hideRotateMesh(),e.mesh.rotatedModel=e.mesh.usingColoredTextures?buffermodel.createModel_ColorTextured(e.mesh.rotatedData32,2,"TRIANGLES",pieces.getSpritesheet()):buffermodel.createModel_Textured(e.mesh.rotatedData32,2,"TRIANGLES",pieces.getSpritesheet()),e.mesh.locked--,e.mesh.isGenerating--,main.renderThisFrame()},eraseRotatedModel(e){null!=e?.mesh&&(delete e.mesh.rotatedData64,delete e.mesh.rotatedData32,delete e.mesh.rotatedModel)}},promotionlines={startEnd:[-3,12],thickness:.01,render:function(){if(!game.getGamefile().gameRules.promotionRanks)return;const e=promotionlines.initModel(),t=movement.getBoardPos(),o=[-t[0],-t[1],0],n=movement.getBoardScale(),i=[n,n,1];e.render(o,i)},initModel:function(){const e=promotionlines.startEnd[0]-board.gsquareCenter(),t=promotionlines.startEnd[1]+1-board.gsquareCenter(),o=game.getGamefile(),n=o.gameRules.promotionRanks[0]+1-board.gsquareCenter()-promotionlines.thickness,i=o.gameRules.promotionRanks[0]+1-board.gsquareCenter()+promotionlines.thickness,r=o.gameRules.promotionRanks[1]-board.gsquareCenter()-promotionlines.thickness,a=o.gameRules.promotionRanks[1]-board.gsquareCenter()+promotionlines.thickness,s=new Float32Array([e,n,0,0,0,1,e,i,0,0,0,1,t,n,0,0,0,1,t,n,0,0,0,1,e,i,0,0,0,1,t,i,0,0,0,1,e,r,0,0,0,1,e,a,0,0,0,1,t,r,0,0,0,1,t,r,0,0,0,1,e,a,0,0,0,1,t,a,0,0,0,1]);return buffermodel.createModel_Colored(s,2,"TRIANGLES")}},selection=function(){let e,t,o,n,i=!1,r=!1;function a(){return null!=e}function s(o,n,i){main.renderThisFrame(),e={type:o,index:n,coords:i},t=legalmoves.calculate(game.getGamefile(),e),highlights.regenModel()}function c(){e=void 0,t=void 0,r=!1,n=void 0,guipromotion.close(),main.renderThisFrame()}function l(t){const o=movepiece.stripSpecialMoveTagsFromCoords(t),n={type:e.type,startCoords:e.coords,endCoords:o};specialdetect.transferSpecialFlags_FromCoordsToMove(t,n);const i=formatconverter.LongToShort_CompactMove(n);n.compact=i,movepiece.makeMove(game.getGamefile(),n),onlinegame.sendMove(),c()}return Object.freeze({isAPieceSelected:a,getPieceSelected:function(){return e},unselectPiece:c,getLegalMovesOfSelectedPiece:function(){return t},isPawnCurrentlyPromoting:function(){return r},promoteToType:function(e){n=e},update:function(){const a=game.getGamefile();if(onlinegame.areInOnlineGame()&&!onlinegame.isItOurTurn(a))return;if(r)return void(n&&function(){const e=r;e.promotion=n,l(e),perspective.relockMouse()}());if(movement.isScaleLess1Pixel_Virtual()||transition.areWeTeleporting()||a.gameConclusion||guipause.areWePaused()||perspective.isLookingUp())return;let u=input.getTouchClickedTile();if(o=input.getTouchClicked()?[u.x,u.y]:input.getMouseClicked()?input.getMouseClickedTile():board.gtile_MouseOver_Int(),!o)return;if(function(){if(null==e)return void(i=!1);const n=game.getGamefile(),r=gamefileutility.getPieceTypeAtCoords(n,o),a=r&&math.getPieceColorFromType(e.type)===math.getPieceColorFromType(r),s=!a&&"voidsN"===r;i=legalmoves.checkIfMoveLegal(t,e.coords,o)||options.getEM()&&!s&&!a}(),!input.getMouseClicked()&&!input.getTouchClicked())return;const d=gamefileutility.getPieceTypeAtCoords(a,o);e?function(t,o){const n=game.getGamefile();e:if(o){if(math.getPieceColorFromType(e.type)!==math.getPieceColorFromType(o))break e;if(o&&math.areCoordsEqual(e.coords,t))main.renderThisFrame(),c();else if("voidsN"!==o){s(o,gamefileutility.getPieceIndexByTypeAndCoords(n,o,t),t)}return}if(!i)return;if(n.mesh.locked)return statustext.pleaseWaitForTask();if(specialdetect.isPawnPromotion(n,e.type,t)){const o=math.getPieceColorFromType(e.type);return guipromotion.open(o),void(r=t)}l(t)}(o,d):d&&function(e){const t=game.getGamefile(),n=math.getPieceColorFromType(e);if(!movesscript.areWeViewingLatestMove(t)&&(n===t.whosTurn||options.getEM()&&"voidsN"!==e))return movepiece.forwardToFront(t,{flipTurn:!1,updateProperties:!1});if(n!==t.whosTurn&&!options.getEM())return;if(options.getEM()&&"voidsN"===e)return;const i=gamefileutility.getPieceIndexByTypeAndCoords(t,e,o);s(e,i,o)}(d)},renderGhostPiece:function(){a()&&o&&i&&input.isMouseSupported()&&pieces.renderGhostPiece(e.type,o)}})}(),shaders=function(){const e={colorProgram:void 0,textureProgram:void 0,coloredTextureProgram:void 0,tintedTextureProgram:void 0};function t(e,t){const n=o(gl.VERTEX_SHADER,e),i=o(gl.FRAGMENT_SHADER,t),r=gl.createProgram();return gl.attachShader(r,n),gl.attachShader(r,i),gl.linkProgram(r),gl.getProgramParameter(r,gl.LINK_STATUS)?r:(alert(`Unable to initialize the shader program: ${gl.getProgramInfoLog(r)}`),null)}function o(e,t){const o=gl.createShader(e);if(gl.shaderSource(o,t),gl.compileShader(o),!gl.getShaderParameter(o,gl.COMPILE_STATUS)){const e=`An error occurred compiling the shaders: ${gl.getShaderInfoLog(o)}`;return alert(e),console.error(e),gl.deleteShader(o),null}return o}return Object.freeze({initPrograms:function(){e.colorProgram=function(){const e="",o=t(`\n attribute vec4 aVertexPosition;\n attribute vec4 aVertexColor;\n\n uniform mat4 uWorldMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjMatrix;\n\n varying lowp vec4 vColor;\n\n void main() {\n gl_Position = uProjMatrix * uViewMatrix * uWorldMatrix * aVertexPosition;\n vColor = aVertexColor;\n ${e}\n }\n `,"\n varying lowp vec4 vColor;\n\n void main() {\n gl_FragColor = vColor;\n }\n ");return{program:o,attribLocations:{vertexPosition:gl.getAttribLocation(o,"aVertexPosition"),vertexColor:gl.getAttribLocation(o,"aVertexColor")},uniformLocations:{projectionMatrix:gl.getUniformLocation(o,"uProjMatrix"),viewMatrix:gl.getUniformLocation(o,"uViewMatrix"),worldMatrix:gl.getUniformLocation(o,"uWorldMatrix")}}}(),e.textureProgram=function(){const e=t("\n attribute vec4 aVertexPosition;\n attribute vec2 aTextureCoord;\n\n uniform mat4 uWorldMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjMatrix;\n\n varying lowp vec2 vTextureCoord;\n\n void main(void) {\n gl_Position = uProjMatrix * uViewMatrix * uWorldMatrix * aVertexPosition; // Original, no z-translating\n vTextureCoord = aTextureCoord;\n }\n ","\n varying lowp vec2 vTextureCoord;\n\n uniform sampler2D uSampler;\n\n void main(void) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n }\n ");return{program:e,attribLocations:{vertexPosition:gl.getAttribLocation(e,"aVertexPosition"),textureCoord:gl.getAttribLocation(e,"aTextureCoord")},uniformLocations:{projectionMatrix:gl.getUniformLocation(e,"uProjMatrix"),viewMatrix:gl.getUniformLocation(e,"uViewMatrix"),worldMatrix:gl.getUniformLocation(e,"uWorldMatrix"),uSampler:gl.getUniformLocation(e,"uSampler")}}}(),e.coloredTextureProgram=function(){const e=t("\n attribute vec4 aVertexPosition;\n attribute vec2 aTextureCoord;\n attribute vec4 aVertexColor;\n\n uniform mat4 uWorldMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjMatrix;\n\n varying lowp vec2 vTextureCoord;\n varying lowp vec4 vColor;\n\n void main(void) {\n gl_Position = uProjMatrix * uViewMatrix * uWorldMatrix * aVertexPosition;\n vTextureCoord = aTextureCoord;\n vColor = aVertexColor;\n }\n ","\n varying lowp vec2 vTextureCoord;\n varying lowp vec4 vColor;\n\n uniform sampler2D uSampler;\n\n void main(void) {\n gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor;\n }\n ");return{program:e,attribLocations:{vertexPosition:gl.getAttribLocation(e,"aVertexPosition"),textureCoord:gl.getAttribLocation(e,"aTextureCoord"),vertexColor:gl.getAttribLocation(e,"aVertexColor")},uniformLocations:{projectionMatrix:gl.getUniformLocation(e,"uProjMatrix"),viewMatrix:gl.getUniformLocation(e,"uViewMatrix"),worldMatrix:gl.getUniformLocation(e,"uWorldMatrix"),uSampler:gl.getUniformLocation(e,"uSampler")}}}(),e.tintedTextureProgram=function(){const e=t(" \n attribute vec4 aVertexPosition;\n attribute vec2 aTextureCoord;\n\n uniform mat4 uWorldMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjMatrix;\n\n varying lowp vec2 vTextureCoord;\n\n void main(void) {\n gl_Position = uProjMatrix * uViewMatrix * uWorldMatrix * aVertexPosition;\n vTextureCoord = aTextureCoord;\n }\n ","\n varying lowp vec2 vTextureCoord;\n\n uniform lowp vec4 uVertexColor;\n uniform sampler2D uSampler;\n\n void main(void) {\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uVertexColor;\n }\n "),o={program:e,attribLocations:{vertexPosition:gl.getAttribLocation(e,"aVertexPosition"),textureCoord:gl.getAttribLocation(e,"aTextureCoord")},uniformLocations:{uVertexColor:gl.getUniformLocation(e,"uVertexColor"),projectionMatrix:gl.getUniformLocation(e,"uProjMatrix"),viewMatrix:gl.getUniformLocation(e,"uViewMatrix"),worldMatrix:gl.getUniformLocation(e,"uWorldMatrix"),uSampler:gl.getUniformLocation(e,"uSampler")}};gl.useProgram(o.program);const n=[1,1,1,1];return gl.uniform4fv(o.uniformLocations.uVertexColor,n),o}()},programs:e})}(),sound=function(){const e={gamestart:[0,2],move:[2,2.21],capture:[2.21,2.58],bell:[2.58,5.57],lowtime:[5.57,6.3],win:[6.3,8.3],draw:[8.3,10.31],loss:[10.31,12.32],drum1:[12.32,16.32],drum2:[16.32,19.57],tick:[19.57,25.32],ticking:[25.32,36.82],viola_staccato_c3:[36.82,38.82],violin_staccato_c4:[38.82,40.82],marimba_c2:[40.82,42.82],marimba_c2_soft:[42.82,44.82],base_staccato_c2:[44.82,46.82]};let t,o;const n=1e6,i=15,r=80,a=3.5,s=1.5;let c=0,l=35;function u(o,{volume:n=1,delay:i=0,offset:r=0,fadeInDuration:a,reverbVolume:s,reverbDuration:c}={}){if(!htmlscript.hasUserGesturedAtleastOnce())return;if(!t)throw new Error(`Can't play sound ${o} when audioContext isn't initialized yet! (Still loading)`);const l=function(t){const o=e[t];if(o)return o;throw new Error(`Cannot return sound stamp for strange new sound ${t}!`)}(o),u=r/1e3,m=l[0]+u,f=(h=l)[1]-h[0]-u;var h;if(f<0)return;const v=t.currentTime+i,P={source:void 0,sourceReverb:void 0,stop:()=>{P.source.stop(),P.sourceReverb&&P.sourceReverb.stop()},fadeOut:e=>{g(P.source,e),P.sourceReverb&&g(P.sourceReverb,e)}},b=d(n);if(b.start(v,m,f),P.source=b,!s)return w();if(null==c)return console.error("Need to specify a reverb duration.");const y=d(s,1,c);return y.start(v,m,f),P.sourceReverb=y,w();function w(){return null==a||(p(P.source,n,a),P.sourceReverb&&p(P.sourceReverb,s,a)),P}}function d(e,n=1,i){const r=t.createBufferSource();if(null==o)throw new Error("audioDecodedBuffer should never be undefined! This usually happens when soundspritesheet.mp3 starts loading but the document finishes loading in the middle of the audio loading.");r.buffer=o;const a=[],s=function(e,t){t>4&&(console.error(`Gain was DANGEROUSLY set to ${t}!!!! Resetting to 1.`),t=1);const o=e.createGain();return o.gain.value=t,o}(t,e);if(a.push(s),r.gainNode=s,null!=i){const e=function(e,t){var o=m(t);return new ConvolverNode(e,{buffer:o})}(t,i);a.push(e)}return r.playbackRate.value=n,function(e,t,o){let n=e;for(let e=0;e{e.stop()}),o)}function f(e){const t=(e-i)/(r-i);if(t<=0)return{reverbVolume:null,reverbDuration:null};if(t>=1)return{reverbVolume:a,reverbDuration:s};return{reverbVolume:a*t,reverbDuration:s}}return Object.freeze({getAudioContext:function(){return t},initAudioContext:function(e,n){t=e,o=n},playSound_gamestart:function(){return u("gamestart",{volume:.4})},playSound_move:async function(e,t){await async function(){const e=Date.now()-c;if(e>=l)return;const t=l-e;await main.sleep(t)}();const o=e>=n,i=t&&o?.3:t?.5:1,r=1*i;let{reverbVolume:a,reverbDuration:s}=f(e);if(a*=i,u("move",{volume:r,reverbVolume:a,reverbDuration:s}),o){u("bell",.6*i)}c=Date.now()},playSound_capture:function(e,t){const o=t&&e>=n?.3:t?.5:1,i=1*o;let{reverbVolume:r,reverbDuration:a}=f(e);if(r*=o,u("capture",{volume:i,reverbVolume:r,reverbDuration:a}),e>=n){u("bell",.6*o)}},playSound_lowtime:function(){return u("lowtime")},playSound_win:function(e){return u("win",{volume:.7,delay:e})},playSound_draw:function(e){return u("draw",{volume:.7,delay:e})},playSound_loss:function(e){return u("loss",{volume:.7,delay:e})},playSound_drum:function(){return u(`drum${Math.random()>.5?1:2}`,{volume:.7})},playSound_tick:function({volume:e,fadeInDuration:t,offset:o}={}){return u("tick",{volume:e,offset:o,fadeInDuration:t})},playSound_ticking:function({fadeInDuration:e,offset:t}={}){return u("ticking",{volume:.18,offset:t,fadeInDuration:e})},playSound_viola_c3:function({volume:e}={}){return u("viola_staccato_c3",{volume:e})},playSound_violin_c4:function(){return u("violin_staccato_c4",{volume:.9})},playSound_marimba:function(){return u(`marimba_c2${Math.random()>.15?"_soft":""}`,{volume:.4})},playSound_base:function(){return u("base_staccato_c2",{volume:.8})}})}(),specialdetect=function(){const e=["enpassant","promotion","castle"];function t(e,t,o,i){if(!n(e,t))return;const r=t[0],a=t[1],s=e.piecesOrganizedByRow[a];let c=!0,l=!0,u=-1/0,d=1/0;for(let e=0;eu?u=t[0]:t[0]>r&&t[0]({kings:specialmove.kings,royalCentaurs:specialmove.kings,pawns:specialmove.pawns}),kings(e,t,o,{updateData:n=!0,animate:i=!0,updateProperties:r=!0,simulated:a=!1}={}){const s=o.castle;if(!s)return!1;movepiece.movePiece(e,t,o.endCoords,{updateData:n});const c=gamefileutility.getPieceAtCoords(e,s.coord),l=[o.endCoords[0]-s.dir,o.endCoords[1]],u=math.getKeyFromCoords(c.coords);if(delete e.specialRights[u],movepiece.movePiece(e,c,l,{updateData:n}),i){animation.animatePiece(t.type,t.coords,o.endCoords);const e=!1;animation.animatePiece(c.type,c.coords,l,void 0,e)}return!0},pawns(e,t,o,{updateData:n=!0,animate:i=!0,updateProperties:r=!0,simulated:a=!1}={}){r&&specialmove.isPawnMoveADoublePush(t.coords,o.endCoords)&&(e.enpassant=specialmove.getEnPassantSquare(t.coords,o.endCoords));const s=o.enpassant,c=o.promotion;if(!s&&!c)return!1;let l=s?specialmove.getEnpassantCaptureCoords(o.endCoords,s):o.endCoords,u=gamefileutility.getPieceAtCoords(e,l);return u&&(o.captured=u.type),u&&a&&(o.rewindInfo.capturedIndex=u.index),u&&movepiece.deletePiece(e,u,{updateData:n}),c?(movepiece.deletePiece(e,t,{updateData:n}),movepiece.addPiece(e,c,o.endCoords,null,{updateData:n})):movepiece.movePiece(e,t,o.endCoords,{updateData:n}),i&&animation.animatePiece(t.type,t.coords,o.endCoords,u),!0},isPawnMoveADoublePush:(e,t)=>2===Math.abs(e[1]-t[1]),getEnPassantSquare(e,t){const o=(e[1]+t[1])/2;return[e[0],o]},getEnpassantCaptureCoords:(e,t)=>[e[0],e[1]+t]},specialundo={getFunctions:()=>({kings:specialundo.kings,royalCentaurs:specialundo.kings,pawns:specialundo.pawns}),kings(e,t,{updateData:o=!0,animate:n=!0}={}){const i=t.castle;if(!i)return!1;let r=gamefileutility.getPieceAtCoords(e,t.endCoords);movepiece.movePiece(e,r,t.startCoords,{updateData:o});const a=r.coords,s=[a[0]-i.dir,a[1]];if(r=gamefileutility.getPieceAtCoords(e,s),movepiece.movePiece(e,r,i.coord,{updateData:o}),!o){const t=math.getKeyFromCoords(i.coord);e.specialRights[t]=!0}if(n){animation.animatePiece(t.type,t.endCoords,t.startCoords);const e=!1;animation.animatePiece(r.type,s,i.coord,void 0,e)}return!0},pawns(e,t,{updateData:o=!0,animate:n=!0}={}){const i=t.enpassant,r=t.promotion,a=2===Math.abs(t.endCoords[1]-t.startCoords[1]);if(!i&&!r&&!a)return!1;const s=gamefileutility.getPieceAtCoords(e,t.endCoords);if(t.promotion){const n=math.getWorBFromType(s.type);movepiece.deletePiece(e,s,{updateData:o});const i="pawns"+n;movepiece.addPiece(e,i,t.startCoords,t.rewindInfo.pawnIndex,{updateData:o})}else movepiece.movePiece(e,s,t.startCoords,{updateData:o}),!o&&a&&delete e.enpassant;if(t.enpassant){const n=t.captured,i=[t.endCoords[0],t.endCoords[1]+t.enpassant];movepiece.addPiece(e,n,i,t.rewindInfo.capturedIndex,{updateData:o})}else if(t.captured){const n=t.captured;movepiece.addPiece(e,n,t.endCoords,t.rewindInfo.capturedIndex,{updateData:o})}return n&&animation.animatePiece(t.type,t.endCoords,t.startCoords),!0}},stats={element_Statuses:document.getElementById("stats"),elementStatusMoveLooking:document.getElementById("status-move-looking"),elementStatusFPS:document.getElementById("status-fps"),elementStatusPiecesMesh:document.getElementById("status-pieces-mesh"),elementStatusRotateMesh:document.getElementById("status-rotate-mesh"),elementStatusCoords:document.getElementById("status-coords"),elementStatusMoves:document.getElementById("status-moves"),visibilityWeight:0,showMoves(e=2.5){main.videoMode||(stats.visibilityWeight++,stats.setTextContentOfMoves(),setTimeout(stats.hideMoves,1e3*e),1===stats.visibilityWeight&&style.revealElement(stats.elementStatusMoves))},hideMoves(){stats.visibilityWeight--,0===stats.visibilityWeight&&style.hideElement(stats.elementStatusMoves)},setTextContentOfMoves(){const e=game.getGamefile().moveIndex+1,t=movesscript.getPlyCount(game.getGamefile().moves);stats.elementStatusMoves.textContent=`Move: ${e}/${t}`},updateStatsCSS(){stats.element_Statuses.style=`top: ${camera.getPIXEL_HEIGHT_OF_TOP_NAV()}px`},showPiecesMesh(){main.videoMode||style.revealElement(stats.elementStatusPiecesMesh)},updatePiecesMesh(e){const t=math.decimalToPercent(e);stats.elementStatusPiecesMesh.textContent=`Constructing mesh ${t}`},hidePiecesMesh(){style.hideElement(stats.elementStatusPiecesMesh)},showFPS(){main.videoMode||style.revealElement(stats.elementStatusFPS)},hideFPS(){style.hideElement(stats.elementStatusFPS)},updateFPS(e){if(!options.isFPSOn())return;const t=0|e;stats.elementStatusFPS.textContent=`FPS: ${t}`},showRotateMesh(){main.videoMode||style.revealElement(stats.elementStatusRotateMesh)},updateRotateMesh(e){const t=math.decimalToPercent(e);stats.elementStatusRotateMesh.textContent=`Rotating mesh ${t}`},hideRotateMesh(){style.hideElement(stats.elementStatusRotateMesh)},hideMoveLooking(){style.hideElement(stats.elementStatusMoveLooking)}},statustext=function(){const e=document.getElementById("statusmessage"),t=document.getElementById("statustext"),o=1e3,n=900,i=45;let r=0;function a(e,t,o=1){s(e,(n+e.length*i)*o,t)}function s(n,i,a){if(null==n)return console.error("Cannot show status of undefined text!!");r++,setTimeout((function(){1===r?(t.classList.add("fade-out-1s"),function(o){setTimeout((function(){r--,r>0||(e.classList.add("hidden"),t.classList.remove("fade-out-1s"))}),o)}(o)):r--}),i),t.textContent=n,t.classList.remove("fade-out-1s"),e.classList.remove("hidden"),a?(t.classList.remove("ok"),t.classList.add("error"),console.error(n)):(t.classList.remove("error"),t.classList.add("ok"))}return Object.freeze({showStatus:a,lostConnection:function(){a("Lost connection.")},pleaseWaitForTask:function(){a("Please wait a moment to perform this task.",!1,.5)},getLayerCount:function(){return r},showStatusForDuration:s})}(),style=function(){const e=document.getElementById("style");let t;function o(e,t){e.classList.add(t)}function n(e,t){e.classList.remove(t)}function i(e,t){n(e,t),o(e,t)}function r(e){o(e,"hidden")}function a(e){n(e,"hidden")}return Object.freeze({hideElement:r,revealElement:a,setNavStyle:function(o){t=o,e.innerHTML=t},fadeIn1s:function(e){a(e),i(e,"fade-in-2_3s"),e.fadeIn1sLayers?e.fadeIn1sLayers++:e.fadeIn1sLayers=1,setTimeout((()=>{e.fadeIn1sLayers--,e.fadeIn1sLayers>0||(delete e.fadeIn1sLayers,n(e,"fade-in-2_3s"))}),1e3)},fadeOut1s:function(e){a(e),i(e,"fade-out-2_3s"),e.fadeOut1sLayers?e.fadeOut1sLayers++:e.fadeOut1sLayers=1,setTimeout((()=>{e.fadeOut1sLayers--,e.fadeOut1sLayers>0||(delete e.fadeOut1sLayers,n(e,"fade-out-2_3s"),r(e))}),1e3)}})}(),texture=Object.freeze({loadTexture:function(e,{useMipmaps:t=!1}={}){gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,!0);const o=document.getElementById(e);if(null==o)return console.error(`Unable to find of document texture element with id '${e}'!`);const n=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,n);const i=gl.RGBA,r=gl.RGBA,a=gl.UNSIGNED_BYTE;gl.texImage2D(gl.TEXTURE_2D,0,i,r,a,o);const s=math.isPowerOfTwo(o.offsetWidth)&&math.isPowerOfTwo(o.offsetHeight);return!s&&t&&console.log(`Image ID ${e} dimensions is not a power of two! Unable to use mipmaps. Dimensions: ${o.offsetWidth}x${o.offsetHeight}`),t&&s?gl.generateMipmap(gl.TEXTURE_2D):(gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.REPEAT),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.REPEAT),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST)),gl.bindTexture(gl.TEXTURE_2D,null),n}});!function(){const e=["tooltip-dl","tooltip-d","tooltip-dr"],t=e.map((e=>"."+e)),o=document.querySelectorAll(t.join(", "));let n,i=!1;function r(){i&&(n=void 0,i=!1,o.forEach((e=>{e.classList.remove("fast-transition")})))}input.isMouseSupported()&&o.forEach((t=>{const a=(s=t,e.find((e=>s.classList.contains(e)))||null);var s;let c,l,u=!1,d=!1,m=!1,p=!1;function g(){m=!0}function f(){clearTimeout(c),c=void 0}function h(){p||(t.classList.remove(a),p=!0,m=!1,r(),f())}function v(){clearTimeout(l),l=void 0}function P(){v(),l=setTimeout(b,2e3)}function b(){p&&!d&&(v(),t.classList.add(a),p=!1,u&&g())}t.addEventListener("mouseenter",(()=>{u=!0,clearTimeout(n),n=void 0,i?g():c=setTimeout(g,1e3)})),t.addEventListener("mouseleave",(function(){u=!1,d=!1,f(),b(),m&&(i||(i=!0,o.forEach((e=>{e.classList.add("fast-transition")}))),n=setTimeout(r,750)),m=!1})),t.addEventListener("mousedown",(function(){d=!0,h(),P()})),t.addEventListener("mouseup",(function(){d=!1,h(),P()}))}))}();const transition=function(){const e=[],t=20,o=600,n=70,i=1.3;let r;const a=90,s=800;let c,l,u,d,m,p,g,f,h,v,P,b,y,w,C,k=!1;function T(e,t,a){a||M({endCoords:movement.getBoardPos(),endScale:movement.getBoardScale(),isPanTel:!1}),C=t,d=movement.getBoardPos(),g=movement.getBoardScale(),m=e.endCoords,f=e.endScale,c=performance.now(),l=ft&&e.shift()}return Object.freeze({areWeTeleporting:function(){return k},teleport:T,update:function(){if(!k)return;main.renderThisFrame();const e=performance.now()-c;if(e>=r)return movement.setBoardPos(m,"pidough"),movement.setBoardScale(f,"pidough"),void(C?T(C,void 0,!0):k=!1);let t=e/r;const o=-.5*Math.cos(Math.PI*t)+.5;u?function(e,t){const o=a/movement.getBoardScale();let n,i;if(Math.abs(p[0])>o||Math.abs(p[1])>o){const r=e<.5,a=r?1:-1,s=r?t:1-t;let c=p[0];const l=o/Math.abs(c);let u=p[1];const g=o/Math.abs(u);let f=l(e.ok&&(r=!0),e.json()))).then((a=>{r?(e=d("token"),e?console.log("Logged in"):console.error("Response from the server did not include a token!"),o=a.member,u()):(console.log(`Server: ${a.message}`),i=!1),t=Date.now(),n=!1})).catch((e=>{console.error("Error occurred during refreshing of token:",e),t=Date.now(),n=!1}))}function u(){i?(r.setAttribute("href",`/member/${o.toLowerCase()}`),a.textContent="Profile",s.setAttribute("href","/logout"),c.textContent="Log Out"):(r.setAttribute("href","/login"),a.textContent="Log In",s.setAttribute("href","/createaccount"),c.textContent="Create Account")}function d(e){const t=document.cookie.split("; ");for(let o=0;o89e4&&(e=void 0),(!e&&i||!i&&o>6012e5)&&await l(),e},getMember:function(){return o},getAllCookies:function(){return document.cookie},getCookieValue:d,deleteToken:function(){e=void 0,o=void 0,t=void 0,i=!1,document.cookie="token=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/",u()},areWeLoggedIn:function(){return i},waitUntilInitialRequestBack:async function(){for(;null==t;)await main.sleep(100)}})}(),variant=function(){const e=["Classical","Core","Standarch","Space Classic","CoaIP","Pawn Horde","Space","Obstocean","Abundance","Amazon Chandelier","Containment","Classical - Limit 7","CoaIP - Limit 7","Chess","Classical - KOTH","CoaIP - KOTH","Omega","Omega^2","Omega^3","Omega^4","Classical+","Pawndard","Knightline","Knighted Chess"],t=["Omega","Omega^2","Omega^3","Omega^4"];function o(e={}){const t=e.promotionRanks||(null===e.promotionRanks?null:[8,1]),o={promotionRanks:t,promotionsAllowed:e.promotionsAllowed||s(e.position,t),winConditions:e.winConditions||{white:["checkmate"],black:["checkmate"]},moveRule:e.moveRule||100};return null!=e.slideLimit&&(o.slideLimit=e.slideLimit),null===e.moveRule&&delete o.moveRule,o}function n(){return{white:["checkmate"],black:["checkmate"]}}function i({Variant:e,Date:t}){let o,n;switch(e){case"Classical":case"Classical - Limit 7":case"Classical - KOTH":return o="P1,2+|P2,2+|P3,2+|P4,2+|P5,2+|P6,2+|P7,2+|P8,2+|p1,7+|p2,7+|p3,7+|p4,7+|p5,7+|p6,7+|p7,7+|p8,7+|R1,1+|R8,1+|r1,8+|r8,8+|N2,1|N7,1|n2,8|n7,8|B3,1|B6,1|b3,8|b6,8|Q4,1|q4,8|K5,1+|k5,8+",r({positionString:o});case"Core":return o="p-1,10+|p3,10+|p4,10+|p5,10+|p6,10+|p10,10+|p0,9+|p9,9+|n0,8|r1,8+|n2,8|b3,8|q4,8|k5,8+|b6,8|n7,8|r8,8+|n9,8|p-2,7+|p1,7+|p2,7+|p3,7+|p4,7+|p5,7+|p6,7+|p7,7+|p8,7+|p11,7+|p-3,6+|p12,6+|p1,5+|P2,5+|P7,5+|p8,5+|P1,4+|p2,4+|p7,4+|P8,4+|P-3,3+|P12,3+|P-2,2+|P1,2+|P2,2+|P3,2+|P4,2+|P5,2+|P6,2+|P7,2+|P8,2+|P11,2+|N0,1|R1,1+|N2,1|B3,1|Q4,1|K5,1+|B6,1|N7,1|R8,1+|N9,1|P0,0+|P9,0+|P-1,-1+|P3,-1+|P4,-1+|P5,-1+|P6,-1+|P10,-1+",r({positionString:o});case"Standarch":case"Standarch - 3 Check":return o="p4,11+|p5,11+|p1,10+|p2,10+|p3,10+|p6,10+|p7,10+|p8,10+|p0,9+|ar4,9|ch5,9|p9,9+|p0,8+|r1,8+|n2,8|b3,8|q4,8|k5,8+|b6,8|n7,8|r8,8+|p9,8+|p0,7+|p1,7+|p2,7+|p3,7+|p4,7+|p5,7+|p6,7+|p7,7+|p8,7+|p9,7+|P0,2+|P1,2+|P2,2+|P3,2+|P4,2+|P5,2+|P6,2+|P7,2+|P8,2+|P9,2+|P0,1+|R1,1+|N2,1|B3,1|Q4,1|K5,1+|B6,1|N7,1|R8,1+|P9,1+|P0,0+|AR4,0|CH5,0|P9,0+|P1,-1+|P2,-1+|P3,-1+|P6,-1+|P7,-1+|P8,-1+|P4,-2+|P5,-2+",r({positionString:o});case"Space Classic":return o=function(e){const t=e?math.getUTCTimestamp(e):e.now();return t<17090172e5?"p-3,15+|q4,15|p11,15+|p-4,14+|b4,14|p12,14+|p-5,13+|r2,13|b4,13|r6,13|p13,13+|p3,5+|p4,5+|p5,5+|n3,4|k4,4|n5,4|p-6,3+|p1,3+|p2,3+|p3,3+|p4,3+|p5,3+|p6,3+|p7,3+|p-8,2+|p-7,2+|p15,2+|p16,2+|p-9,1+|p17,1+|P-9,0+|P17,0+|P-8,-1+|P-7,-1+|P15,-1+|P16,-1+|P1,-2+|P2,-2+|P3,-2+|P4,-2+|P5,-2+|P6,-2+|P7,-2+|P14,-2+|N3,-3|K4,-3|N5,-3|P3,-4+|P4,-4+|P5,-4+|P-5,-12+|R2,-12|B4,-12|R6,-12|P13,-12+|P-4,-13+|B4,-13|P12,-13+|P-3,-14+|Q4,-14|P11,-14+":"p-3,18+|r2,18|b4,18|b5,18|r7,18|p12,18+|p-4,17+|p13,17+|p-5,16+|p14,16+|p3,9+|p4,9+|p5,9+|p6,9+|n3,8|k4,8|q5,8|n6,8|p-6,7+|p1,7+|p2,7+|p3,7+|p4,7+|p5,7+|p6,7+|p7,7+|p8,7+|p-8,6+|p-7,6+|p16,6+|p17,6+|p-9,5+|p18,5+|P-9,4+|P18,4+|P-8,3+|P-7,3+|P16,3+|P17,3+|P1,2+|P2,2+|P3,2+|P4,2+|P5,2+|P6,2+|P7,2+|P8,2+|P15,2+|N3,1|K4,1|Q5,1|N6,1|P3,0+|P4,0+|P5,0+|P6,0+|P-5,-7+|P14,-7+|P-4,-8+|P13,-8+|P-3,-9+|R2,-9|B4,-9|B5,-9|R7,-9|P12,-9+"}(t),r({positionString:o});case"CoaIP":case"CoaIP - Limit 7":case"CoaIP - KOTH":case"CoaIP - 3 Check":return o="P-2,1+|P-1,2+|P0,2+|P1,2+|P2,2+|P3,2+|P4,2+|P5,2+|P6,2+|P7,2+|P8,2+|P9,2+|P10,2+|P11,1+|P-4,-6+|P-3,-5+|P-2,-4+|P-1,-5+|P0,-6+|P9,-6+|P10,-5+|P11,-4+|P12,-5+|P13,-6+|p-2,8+|p-1,7+|p0,7+|p1,7+|p2,7+|p3,7+|p4,7+|p5,7+|p6,7+|p7,7+|p8,7+|p9,7+|p10,7+|p11,8+|p-4,15+|p-3,14+|p-2,13+|p-1,14+|p0,15+|p9,15+|p10,14+|p11,13+|p12,14+|p13,15+|HA-2,-6|HA11,-6|ha-2,15|ha11,15|R-1,1|R10,1|r-1,8|r10,8|CH0,1|CH9,1|ch0,8|ch9,8|GU1,1+|GU8,1+|gu1,8+|gu8,8+|N2,1|N7,1|n2,8|n7,8|B3,1|B6,1|b3,8|b6,8|Q4,1|q4,8|K5,1+|k5,8+",r({positionString:o});case"Pawn Horde":return o="k5,2+|q4,2|r1,2+|n7,2|n2,2|r8,2+|b3,2|b6,2|P2,-1+|P3,-1+|P6,-1+|P7,-1+|P1,-2+|P2,-2+|P4,-2+|P5,-2+|P6,-2+|P7,-2+|P8,-2+|P1,-3+|P2,-3+|P4,-3+|P5,-3+|P6,-3+|P7,-3+|P8,-3+|P1,-4+|P2,-4+|P4,-4+|P5,-4+|P6,-4+|P7,-4+|P8,-4+|P1,-5+|P2,-5+|P4,-5+|P5,-5+|P6,-5+|P7,-5+|P8,-5+|P1,-6+|P2,-6+|P4,-6+|P5,-6+|P6,-6+|P7,-6+|P8,-6+|P3,-2+|P3,-3+|P3,-4+|P3,-5+|P3,-6+|P1,-7+|P2,-7+|P3,-7+|P4,-7+|P5,-7+|P6,-7+|P7,-7+|P8,-7+|P0,-6+|P0,-7+|P9,-6+|P9,-7+|p9,2+|p1,1+|p2,1+|p3,1+|p4,1+|p5,1+|p6,1+|p7,1+|p8,1+|p0,2+",r({positionString:o});case"Space":return o="q4,31|ch4,23|p-12,18+|b4,18|p20,18+|p-11,17+|ar-10,17|p0,17+|b4,17|p8,17+|ar18,17|p19,17+|p-11,16+|p-10,16+|p-1,16+|p9,16+|p18,16+|p19,16+|p-1,15+|r0,15|ha4,15|r8,15|p9,15+|p3,6+|p4,6+|p5,6+|p2,5+|k4,5|p6,5+|n1,4|ce4,4|n7,4|p-10,3+|p-1,3+|p0,3+|p2,3+|p3,3+|p4,3+|p5,3+|p6,3+|p8,3+|p9,3+|p-12,2+|p-11,2+|p19,2+|p20,2+|p-13,1+|p21,1+|P-13,0+|P21,0+|P-12,-1+|P-11,-1+|P19,-1+|P20,-1+|P-1,-2+|P0,-2+|P2,-2+|P3,-2+|P4,-2+|P5,-2+|P6,-2+|P8,-2+|P9,-2+|P18,-2+|N1,-3|CE4,-3|N7,-3|P2,-4+|K4,-4|P6,-4+|P3,-5+|P4,-5+|P5,-5+|P-1,-14+|R0,-14|HA4,-14|R8,-14|P9,-14+|P-11,-15+|P-10,-15+|P-1,-15+|P9,-15+|P18,-15+|P19,-15+|P-11,-16+|AR-10,-16|P0,-16+|B4,-16|P8,-16+|AR18,-16|P19,-16+|P-12,-17+|B4,-17|P20,-17+|CH4,-22|Q4,-30",r({positionString:o});case"Obstocean":return o="vo-8,14|vo-7,14|vo-6,14|vo-5,14|vo-4,14|vo-3,14|vo-2,14|vo-1,14|vo0,14|vo1,14|vo2,14|vo3,14|vo4,14|vo5,14|vo6,14|vo7,14|vo8,14|vo9,14|vo10,14|vo11,14|vo12,14|vo13,14|vo14,14|vo15,14|vo16,14|vo17,14|vo-8,13|vo-7,13|vo-6,13|vo-5,13|vo-4,13|vo-3,13|vo-2,13|vo-1,13|vo0,13|vo1,13|vo2,13|vo3,13|vo4,13|vo5,13|vo6,13|vo7,13|vo8,13|vo9,13|vo10,13|vo11,13|vo12,13|vo13,13|vo14,13|vo15,13|vo16,13|vo17,13|vo-8,12|vo-7,12|ob-6,12|ob-5,12|ob-4,12|ob-3,12|ob-2,12|ob-1,12|ob0,12|ob1,12|ob2,12|ob3,12|ob4,12|ob5,12|ob6,12|ob7,12|ob8,12|ob9,12|ob10,12|ob11,12|ob12,12|ob13,12|ob14,12|ob15,12|vo16,12|vo17,12|vo-8,11|vo-7,11|ob-6,11|ob-5,11|ob-4,11|ob-3,11|ob-2,11|ob-1,11|ob0,11|ob1,11|ob2,11|ob3,11|ob4,11|ob5,11|ob6,11|ob7,11|ob8,11|ob9,11|ob10,11|ob11,11|ob12,11|ob13,11|ob14,11|ob15,11|vo16,11|vo17,11|vo-8,10|vo-7,10|ob-6,10|ob-5,10|ob-4,10|ob-3,10|ob-2,10|ob-1,10|ob0,10|ob1,10|ob2,10|ob3,10|ob4,10|ob5,10|ob6,10|ob7,10|ob8,10|ob9,10|ob10,10|ob11,10|ob12,10|ob13,10|ob14,10|ob15,10|vo16,10|vo17,10|vo-8,9|vo-7,9|ob-6,9|ob-5,9|ob-4,9|ob-3,9|ob-2,9|ob-1,9|ob0,9|ob1,9|ob2,9|ob3,9|ob4,9|ob5,9|ob6,9|ob7,9|ob8,9|ob9,9|ob10,9|ob11,9|ob12,9|ob13,9|ob14,9|ob15,9|vo16,9|vo17,9|vo-8,8|vo-7,8|ob-6,8|ob-5,8|ob-4,8|ob-3,8|ob-2,8|ob-1,8|ob0,8|r1,8+|n2,8|b3,8|q4,8|k5,8+|b6,8|n7,8|r8,8+|ob9,8|ob10,8|ob11,8|ob12,8|ob13,8|ob14,8|ob15,8|vo16,8|vo17,8|vo-8,7|vo-7,7|ob-6,7|ob-5,7|ob-4,7|ob-3,7|ob-2,7|ob-1,7|ob0,7|p1,7+|p2,7+|p3,7+|p4,7+|p5,7+|p6,7+|p7,7+|p8,7+|ob9,7|ob10,7|ob11,7|ob12,7|ob13,7|ob14,7|ob15,7|vo16,7|vo17,7|vo-8,6|vo-7,6|ob-6,6|ob-5,6|ob-4,6|ob-3,6|ob-2,6|ob-1,6|ob0,6|ob1,6|ob2,6|ob3,6|ob4,6|ob5,6|ob6,6|ob7,6|ob8,6|ob9,6|ob10,6|ob11,6|ob12,6|ob13,6|ob14,6|ob15,6|vo16,6|vo17,6|vo-8,5|vo-7,5|ob-6,5|ob-5,5|ob-4,5|ob-3,5|ob-2,5|ob-1,5|ob0,5|ob1,5|ob2,5|ob3,5|ob4,5|ob5,5|ob6,5|ob7,5|ob8,5|ob9,5|ob10,5|ob11,5|ob12,5|ob13,5|ob14,5|ob15,5|vo16,5|vo17,5|vo-8,4|vo-7,4|ob-6,4|ob-5,4|ob-4,4|ob-3,4|ob-2,4|ob-1,4|ob0,4|ob1,4|ob2,4|ob3,4|ob4,4|ob5,4|ob6,4|ob7,4|ob8,4|ob9,4|ob10,4|ob11,4|ob12,4|ob13,4|ob14,4|ob15,4|vo16,4|vo17,4|vo-8,3|vo-7,3|ob-6,3|ob-5,3|ob-4,3|ob-3,3|ob-2,3|ob-1,3|ob0,3|ob1,3|ob2,3|ob3,3|ob4,3|ob5,3|ob6,3|ob7,3|ob8,3|ob9,3|ob10,3|ob11,3|ob12,3|ob13,3|ob14,3|ob15,3|vo16,3|vo17,3|vo-8,2|vo-7,2|ob-6,2|ob-5,2|ob-4,2|ob-3,2|ob-2,2|ob-1,2|ob0,2|P1,2+|P2,2+|P3,2+|P4,2+|P5,2+|P6,2+|P7,2+|P8,2+|ob9,2|ob10,2|ob11,2|ob12,2|ob13,2|ob14,2|ob15,2|vo16,2|vo17,2|vo-8,1|vo-7,1|ob-6,1|ob-5,1|ob-4,1|ob-3,1|ob-2,1|ob-1,1|ob0,1|R1,1+|N2,1|B3,1|Q4,1|K5,1+|B6,1|N7,1|R8,1+|ob9,1|ob10,1|ob11,1|ob12,1|ob13,1|ob14,1|ob15,1|vo16,1|vo17,1|vo-8,0|vo-7,0|ob-6,0|ob-5,0|ob-4,0|ob-3,0|ob-2,0|ob-1,0|ob0,0|ob1,0|ob2,0|ob3,0|ob4,0|ob5,0|ob6,0|ob7,0|ob8,0|ob9,0|ob10,0|ob11,0|ob12,0|ob13,0|ob14,0|ob15,0|vo16,0|vo17,0|vo-8,-1|vo-7,-1|ob-6,-1|ob-5,-1|ob-4,-1|ob-3,-1|ob-2,-1|ob-1,-1|ob0,-1|ob1,-1|ob2,-1|ob3,-1|ob4,-1|ob5,-1|ob6,-1|ob7,-1|ob8,-1|ob9,-1|ob10,-1|ob11,-1|ob12,-1|ob13,-1|ob14,-1|ob15,-1|vo16,-1|vo17,-1|vo-8,-2|vo-7,-2|ob-6,-2|ob-5,-2|ob-4,-2|ob-3,-2|ob-2,-2|ob-1,-2|ob0,-2|ob1,-2|ob2,-2|ob3,-2|ob4,-2|ob5,-2|ob6,-2|ob7,-2|ob8,-2|ob9,-2|ob10,-2|ob11,-2|ob12,-2|ob13,-2|ob14,-2|ob15,-2|vo16,-2|vo17,-2|vo-8,-3|vo-7,-3|ob-6,-3|ob-5,-3|ob-4,-3|ob-3,-3|ob-2,-3|ob-1,-3|ob0,-3|ob1,-3|ob2,-3|ob3,-3|ob4,-3|ob5,-3|ob6,-3|ob7,-3|ob8,-3|ob9,-3|ob10,-3|ob11,-3|ob12,-3|ob13,-3|ob14,-3|ob15,-3|vo16,-3|vo17,-3|vo-8,-4|vo-7,-4|vo-6,-4|vo-5,-4|vo-4,-4|vo-3,-4|vo-2,-4|vo-1,-4|vo0,-4|vo1,-4|vo2,-4|vo3,-4|vo4,-4|vo5,-4|vo6,-4|vo7,-4|vo8,-4|vo9,-4|vo10,-4|vo11,-4|vo12,-4|vo13,-4|vo14,-4|vo15,-4|vo16,-4|vo17,-4|vo-8,-5|vo-7,-5|vo-6,-5|vo-5,-5|vo-4,-5|vo-3,-5|vo-2,-5|vo-1,-5|vo0,-5|vo1,-5|vo2,-5|vo3,-5|vo4,-5|vo5,-5|vo6,-5|vo7,-5|vo8,-5|vo9,-5|vo10,-5|vo11,-5|vo12,-5|vo13,-5|vo14,-5|vo15,-5|vo16,-5|vo17,-5",r({positionString:o});case"Abundance":return o="p-3,10+|ha-2,10|ha-1,10|r0,10|ha1,10|ha2,10|p3,10+|p-2,9+|p-1,9+|p1,9+|p2,9+|p-5,6+|gu-4,6|r-3,6+|b-2,6|b-1,6|k0,6+|b1,6|b2,6|r3,6+|gu4,6|p5,6+|p-4,5+|gu-3,5|n-1,5|q0,5|n1,5|gu3,5|p4,5+|p-3,4+|p-2,4+|gu-1,4|ch0,4|gu1,4|p2,4+|p3,4+|p-1,3+|p0,3+|p1,3+|P-1,-3+|P0,-3+|P1,-3+|P-3,-4+|P-2,-4+|GU-1,-4|CH0,-4|GU1,-4|P2,-4+|P3,-4+|P-4,-5+|GU-3,-5|N-1,-5|Q0,-5|N1,-5|GU3,-5|P4,-5+|P-5,-6+|GU-4,-6|R-3,-6+|B-2,-6|B-1,-6|K0,-6+|B1,-6|B2,-6|R3,-6+|GU4,-6|P5,-6+|P-2,-9+|P-1,-9+|P1,-9+|P2,-9+|P-3,-10+|HA-2,-10|HA-1,-10|R0,-10|HA1,-10|HA2,-10|P3,-10+",r({positionString:o});case"Amazon Chandelier":return o="p-1,26+|p1,26+|p-2,25+|p-1,25+|p0,25+|p1,25+|p2,25+|p-2,24+|p-1,24+|am0,24|p1,24+|p2,24+|p-2,23+|p-1,23+|p0,23+|p1,23+|p2,23+|p-2,22+|p-1,22+|p1,22+|p2,22+|p-5,21+|p-4,21+|p-3,21+|p-2,21+|p-1,21+|p1,21+|p2,21+|p3,21+|p4,21+|p5,21+|p-5,20+|q-4,20|p-3,20+|p-2,20+|p-1,20+|p1,20+|p2,20+|p3,20+|q4,20|p5,20+|p-5,19+|p-4,19+|p-3,19+|p-2,19+|p-1,19+|p1,19+|p2,19+|p3,19+|p4,19+|p5,19+|p-5,18+|p-3,18+|p-2,18+|p-1,18+|p1,18+|p2,18+|p3,18+|p5,18+|p-8,17+|p-5,17+|p-3,17+|p-2,17+|p-1,17+|p1,17+|p2,17+|p3,17+|p5,17+|p8,17+|p-11,16+|p-10,16+|gu-9,16|ha-8,16|p-7,16+|gu-6,16|p-5,16+|p-3,16+|p-2,16+|p-1,16+|p1,16+|p2,16+|p3,16+|p5,16+|gu6,16|p7,16+|ha8,16|gu9,16|p10,16+|p11,16+|p-11,15+|r-10,15|p-9,15+|p-8,15+|r-7,15|p-6,15+|p-5,15+|p-3,15+|p-2,15+|p-1,15+|p1,15+|p2,15+|p3,15+|p5,15+|p6,15+|r7,15|p8,15+|p9,15+|r10,15|p11,15+|gu-12,14|p-11,14+|p-10,14+|p-9,14+|p-8,14+|p-7,14+|p-6,14+|p-5,14+|p-3,14+|p-2,14+|p-1,14+|p1,14+|p2,14+|p3,14+|p5,14+|p6,14+|p7,14+|p8,14+|p9,14+|p10,14+|p11,14+|gu12,14|p-19,13+|p-17,13+|gu-16,13|p-14,13+|p-12,13+|p-11,13+|p-9,13+|p-8,13+|p-6,13+|p-5,13+|p-3,13+|p-2,13+|p-1,13+|p1,13+|p2,13+|p3,13+|p5,13+|p6,13+|p8,13+|p9,13+|p11,13+|p12,13+|p14,13+|gu16,13|p17,13+|p19,13+|p-19,12+|b-18,12|p-17,12+|gu-16,12|p-14,12+|b-13,12|p-12,12+|p-11,12+|p-9,12+|p-8,12+|p-6,12+|p-5,12+|p-3,12+|p-2,12+|p-1,12+|p1,12+|p2,12+|p3,12+|p5,12+|p6,12+|p8,12+|p9,12+|p11,12+|p12,12+|b13,12|p14,12+|gu16,12|p17,12+|b18,12|p19,12+|gu-20,11|p-19,11+|p-17,11+|p-14,11+|p-12,11+|p-11,11+|p-9,11+|p-8,11+|p-6,11+|p-5,11+|p-3,11+|p-2,11+|p-1,11+|p1,11+|p2,11+|p3,11+|p5,11+|p6,11+|p8,11+|p9,11+|p11,11+|p12,11+|p14,11+|p17,11+|p19,11+|gu20,11|ha-20,10|p-19,10+|p-17,10+|p-14,10+|p-12,10+|p-11,10+|p-9,10+|p-8,10+|p-6,10+|p-5,10+|p-3,10+|p-2,10+|p-1,10+|p1,10+|p2,10+|p3,10+|p5,10+|p6,10+|p8,10+|p9,10+|p11,10+|p12,10+|p14,10+|p17,10+|p19,10+|ha20,10|n-11,9|n11,9|n-10,7|gu-5,7|gu-4,7|gu4,7|gu5,7|n10,7|n-8,6|n8,6|n-6,5|n6,5|n-4,4|k0,4|n4,4|n-2,3|n2,3|n0,2|N0,-1|N-2,-2|N2,-2|N-4,-3|K0,-3|N4,-3|N-6,-4|N6,-4|N-8,-5|N8,-5|N-10,-6|GU-5,-6|GU-4,-6|GU4,-6|GU5,-6|N10,-6|N-11,-8|N11,-8|HA-20,-9|P-19,-9+|P-17,-9+|P-14,-9+|P-12,-9+|P-11,-9+|P-9,-9+|P-8,-9+|P-6,-9+|P-5,-9+|P-3,-9+|P-2,-9+|P-1,-9+|P1,-9+|P2,-9+|P3,-9+|P5,-9+|P6,-9+|P8,-9+|P9,-9+|P11,-9+|P12,-9+|P14,-9+|P17,-9+|P19,-9+|HA20,-9|GU-20,-10|P-19,-10+|P-17,-10+|P-14,-10+|P-12,-10+|P-11,-10+|P-9,-10+|P-8,-10+|P-6,-10+|P-5,-10+|P-3,-10+|P-2,-10+|P-1,-10+|P1,-10+|P2,-10+|P3,-10+|P5,-10+|P6,-10+|P8,-10+|P9,-10+|P11,-10+|P12,-10+|P14,-10+|P17,-10+|P19,-10+|GU20,-10|P-19,-11+|B-18,-11|P-17,-11+|GU-16,-11|P-14,-11+|B-13,-11|P-12,-11+|P-11,-11+|P-9,-11+|P-8,-11+|P-6,-11+|P-5,-11+|P-3,-11+|P-2,-11+|P-1,-11+|P1,-11+|P2,-11+|P3,-11+|P5,-11+|P6,-11+|P8,-11+|P9,-11+|P11,-11+|P12,-11+|B13,-11|P14,-11+|GU16,-11|P17,-11+|B18,-11|P19,-11+|P-19,-12+|P-17,-12+|GU-16,-12|P-14,-12+|P-12,-12+|P-11,-12+|P-9,-12+|P-8,-12+|P-6,-12+|P-5,-12+|P-3,-12+|P-2,-12+|P-1,-12+|P1,-12+|P2,-12+|P3,-12+|P5,-12+|P6,-12+|P8,-12+|P9,-12+|P11,-12+|P12,-12+|P14,-12+|GU16,-12|P17,-12+|P19,-12+|GU-12,-13|P-11,-13+|P-10,-13+|P-9,-13+|P-8,-13+|P-7,-13+|P-6,-13+|P-5,-13+|P-3,-13+|P-2,-13+|P-1,-13+|P1,-13+|P2,-13+|P3,-13+|P5,-13+|P6,-13+|P7,-13+|P8,-13+|P9,-13+|P10,-13+|P11,-13+|GU12,-13|P-11,-14+|R-10,-14|P-9,-14+|P-8,-14+|R-7,-14|P-6,-14+|P-5,-14+|P-3,-14+|P-2,-14+|P-1,-14+|P1,-14+|P2,-14+|P3,-14+|P5,-14+|P6,-14+|R7,-14|P8,-14+|P9,-14+|R10,-14|P11,-14+|P-11,-15+|P-10,-15+|GU-9,-15|HA-8,-15|P-7,-15+|GU-6,-15|P-5,-15+|P-3,-15+|P-2,-15+|P-1,-15+|P1,-15+|P2,-15+|P3,-15+|P5,-15+|GU6,-15|P7,-15+|HA8,-15|GU9,-15|P10,-15+|P11,-15+|P-8,-16+|P-5,-16+|P-3,-16+|P-2,-16+|P-1,-16+|P1,-16+|P2,-16+|P3,-16+|P5,-16+|P8,-16+|P-5,-17+|P-3,-17+|P-2,-17+|P-1,-17+|P1,-17+|P2,-17+|P3,-17+|P5,-17+|P-5,-18+|P-4,-18+|P-3,-18+|P-2,-18+|P-1,-18+|P1,-18+|P2,-18+|P3,-18+|P4,-18+|P5,-18+|P-5,-19+|Q-4,-19|P-3,-19+|P-2,-19+|P-1,-19+|P1,-19+|P2,-19+|P3,-19+|Q4,-19|P5,-19+|P-5,-20+|P-4,-20+|P-3,-20+|P-2,-20+|P-1,-20+|P1,-20+|P2,-20+|P3,-20+|P4,-20+|P5,-20+|P-2,-21+|P-1,-21+|P1,-21+|P2,-21+|P-2,-22+|P-1,-22+|P0,-22+|P1,-22+|P2,-22+|P-2,-23+|P-1,-23+|AM0,-23|P1,-23+|P2,-23+|P-2,-24+|P-1,-24+|P0,-24+|P1,-24+|P2,-24+|P-1,-25+|P1,-25+",r({positionString:o});case"Containment":return o="K5,-5|k5,14|Q4,-5|q4,14|HA1,-6|HA8,-6|ha1,15|ha8,15|CH-6,-6|CH15,-6|ch-6,15|ch15,15|AR-6,-5|AR15,-5|ar-6,14|ar15,14|N-1,0|N1,0|N2,0|N4,-1|N5,-1|N7,0|N8,0|N10,0|n-1,9|n1,9|n2,9|n4,10|n5,10|n7,9|n8,9|n10,9|GU-2,-2|GU1,-3|GU3,-4|GU6,-4|GU8,-3|GU11,-2|gu-2,11|gu1,12|gu3,13|gu6,13|gu8,12|gu11,11|R-5,-6|R-5,-5|R-4,-5|R-4,-6|R13,-6|R13,-5|R14,-5|R14,-6|r-5,15|r-5,14|r-4,14|r-4,15|r13,15|r13,14|r14,14|r14,15|B-5,-2|B-4,-3|B-3,-2|B12,-2|B13,-3|B14,-2|b-5,11|b-4,12|b-3,11|b12,11|b13,12|b14,11|P-9,-8+|P-9,-6+|P-9,-4+|P-9,-2+|P-9,0+|P-9,2+|P-9,4+|P-9,6+|P-9,8+|P-9,10+|P-9,12+|P-9,14+|P-9,16+|P-8,-7+|P-8,-5+|P-8,-3+|P-8,-1+|P-8,1+|P-8,3+|P-8,5+|P-8,7+|P-8,9+|P-8,11+|P-8,13+|P-8,15+|P-8,17+|P17,-8+|P17,-6+|P17,-4+|P17,-2+|P17,0+|P17,2+|P17,4+|P17,6+|P17,8+|P17,10+|P17,12+|P17,14+|P17,16+|P18,-7+|P18,-5+|P18,-3+|P18,-1+|P18,1+|P18,3+|P18,5+|P18,7+|P18,9+|P18,11+|P18,13+|P18,15+|P18,17+|P-7,-8+|P-5,-8+|P-3,-8+|P-1,-8+|P1,-8+|P3,-8+|P5,-8+|P7,-8+|P9,-8+|P11,-8+|P13,-8+|P15,-8+|P-6,-7+|P-4,-7+|P-2,-7+|P0,-7+|P2,-7+|P4,-7+|P6,-7+|P8,-7+|P10,-7+|P12,-7+|P14,-7+|P16,-7+|P-7,16+|P-5,16+|P-3,16+|P-1,16+|P1,16+|P3,16+|P5,16+|P7,16+|P9,16+|P11,16+|P13,16+|P15,16+|P-6,17+|P-4,17+|P-2,17+|P0,17+|P2,17+|P4,17+|P6,17+|P8,17+|P10,17+|P12,17+|P14,17+|P16,17+|P-7,-6+|P-7,-4+|P-7,-2+|P-6,-2+|P-6,-1+|P-5,-1+|P-5,0+|P-5,-4+|P-4,-4+|P-4,-2+|P-4,-1+|P-3,-6+|P-3,-5+|P-3,-1+|P-3,0+|P-2,0+|P-2,1+|P-1,1+|P-1,-4+|P0,-3+|P1,-2+|P0,-1+|P0,1+|P1,1+|P2,1+|P3,1+|P3,0+|P3,-3+|P3,-5+|P4,-4+|P4,1+|P5,1+|P5,-4+|P6,-5+|P6,-3+|P6,0+|P6,1+|P7,1+|P8,1+|P9,1+|P9,-1+|P8,-2+|P9,-3+|P10,-4+|P10,1+|P11,1+|P11,0+|P12,0+|P12,-1+|P12,-5+|P12,-6+|P13,-4+|P13,-2+|P13,-1+|P14,0+|P14,-1+|P14,-4+|P15,-2+|P15,-1+|P16,-1+|P16,-3+|P16,-5+|p-9,-7+|p-9,-5+|p-9,-3+|p-9,-1+|p-9,1+|p-9,3+|p-9,5+|p-9,7+|p-9,9+|p-9,11+|p-9,13+|p-9,15+|p-9,17+|p-8,-8+|p-8,-6+|p-8,-4+|p-8,-2+|p-8,0+|p-8,2+|p-8,4+|p-8,6+|p-8,8+|p-8,10+|p-8,12+|p-8,14+|p-8,16+|p17,-7+|p17,-5+|p17,-3+|p17,-1+|p17,1+|p17,3+|p17,5+|p17,7+|p17,9+|p17,11+|p17,13+|p17,15+|p17,17+|p18,-8+|p18,-6+|p18,-4+|p18,-2+|p18,0+|p18,2+|p18,4+|p18,6+|p18,8+|p18,10+|p18,12+|p18,14+|p18,16+|p-6,-8+|p-4,-8+|p-2,-8+|p0,-8+|p2,-8+|p4,-8+|p6,-8+|p8,-8+|p10,-8+|p12,-8+|p14,-8+|p16,-8+|p-7,-7+|p-5,-7+|p-3,-7+|p-1,-7+|p1,-7+|p3,-7+|p5,-7+|p7,-7+|p9,-7+|p11,-7+|p13,-7+|p15,-7+|p-6,16+|p-4,16+|p-2,16+|p0,16+|p2,16+|p4,16+|p6,16+|p8,16+|p10,16+|p12,16+|p14,16+|p16,16+|p-7,17+|p-5,17+|p-3,17+|p-1,17+|p1,17+|p3,17+|p5,17+|p7,17+|p9,17+|p11,17+|p13,17+|p15,17+|p-7,15+|p-7,13+|p-7,11+|p-6,11+|p-6,10+|p-5,10+|p-5,9+|p-5,13+|p-4,13+|p-4,11+|p-4,10+|p-3,15+|p-3,14+|p-3,10+|p-3,9+|p-2,9+|p-2,8+|p-1,8+|p-1,13+|p0,12+|p1,11+|p0,10+|p0,8+|p1,8+|p2,8+|p3,8+|p3,9+|p3,12+|p3,14+|p4,13+|p4,8+|p5,8+|p5,13+|p6,14+|p6,12+|p6,9+|p6,8+|p7,8+|p8,8+|p9,8+|p9,10+|p8,11+|p9,12+|p10,13+|p10,8+|p11,8+|p11,9+|p12,9+|p12,10+|p12,14+|p12,15+|p13,13+|p13,11+|p13,10+|p14,9+|p14,10+|p14,13+|p15,11+|p15,10+|p16,10+|p16,12+|p16,14+",r({positionString:o});case"Chess":return o="vo-1,10|vo0,10|vo1,10|vo2,10|vo3,10|vo4,10|vo5,10|vo6,10|vo7,10|vo8,10|vo9,10|vo10,10|vo-1,9|vo0,9|vo1,9|vo2,9|vo3,9|vo4,9|vo5,9|vo6,9|vo7,9|vo8,9|vo9,9|vo10,9|vo-1,8|vo0,8|r1,8+|n2,8|b3,8|q4,8|k5,8+|b6,8|n7,8|r8,8+|vo9,8|vo10,8|vo-1,7|vo0,7|p1,7+|p2,7+|p3,7+|p4,7+|p5,7+|p6,7+|p7,7+|p8,7+|vo9,7|vo10,7|vo-1,6|vo0,6|vo9,6|vo10,6|vo-1,5|vo0,5|vo9,5|vo10,5|vo-1,4|vo0,4|vo9,4|vo10,4|vo-1,3|vo0,3|vo9,3|vo10,3|vo-1,2|vo0,2|P1,2+|P2,2+|P3,2+|P4,2+|P5,2+|P6,2+|P7,2+|P8,2+|vo9,2|vo10,2|vo-1,1|vo0,1|R1,1+|N2,1|B3,1|Q4,1|K5,1+|B6,1|N7,1|R8,1+|vo9,1|vo10,1|vo-1,0|vo0,0|vo1,0|vo2,0|vo3,0|vo4,0|vo5,0|vo6,0|vo7,0|vo8,0|vo9,0|vo10,0|vo-1,-1|vo0,-1|vo1,-1|vo2,-1|vo3,-1|vo4,-1|vo5,-1|vo6,-1|vo7,-1|vo8,-1|vo9,-1|vo10,-1",r({positionString:o});case"Classical+":return o="p1,9+|p2,9+|p3,9+|p6,9+|p7,9+|p8,9+|p0,8+|r1,8+|n2,8|b3,8|q4,8|k5,8+|b6,8|n7,8|r8,8+|p9,8+|p1,7+|p2,7+|p3,7+|p4,7+|p5,7+|p6,7+|p7,7+|p8,7+|p3,5+|p6,5+|P3,4+|P6,4+|P1,2+|P2,2+|P3,2+|P4,2+|P5,2+|P6,2+|P7,2+|P8,2+|P0,1+|R1,1+|N2,1|B3,1|Q4,1|K5,1+|B6,1|N7,1|R8,1+|P9,1+|P1,0+|P2,0+|P3,0+|P6,0+|P7,0+|P8,0+",r({positionString:o});case"Pawndard":return o="b4,14|b5,14|r4,12|r5,12|p2,10+|p3,10+|p6,10+|p7,10+|p1,9+|p8,9+|p0,8+|n2,8|n3,8|k4,8+|q5,8|n6,8|n7,8|p9,8+|p1,7+|p2,7+|p3,7+|p4,7+|p5,7+|p6,7+|p7,7+|p8,7+|P1,5+|p2,5+|P3,5+|p6,5+|P7,5+|p8,5+|p1,4+|P2,4+|p3,4+|P6,4+|p7,4+|P8,4+|P1,2+|P2,2+|P3,2+|P4,2+|P5,2+|P6,2+|P7,2+|P8,2+|P0,1+|N2,1|N3,1|Q4,1|K5,1+|N6,1|N7,1|P9,1+|P1,0+|P8,0+|P2,-1+|P3,-1+|P6,-1+|P7,-1+|R4,-3|R5,-3|B4,-5|B5,-5",r({positionString:o});case"Knightline":return o="k5,8+|n3,8|n4,8|n6,8|n7,8|p-5,7+|p-4,7+|p-3,7+|p-2,7+|p-1,7+|p0,7+|p1,7+|p2,7+|p3,7+|p4,7+|p5,7+|p6,7+|p7,7+|p8,7+|p9,7+|p10,7+|p11,7+|p12,7+|p13,7+|p14,7+|p15,7+|K5,1+|N3,1|N4,1|N6,1|N7,1|P-5,2+|P-4,2+|P-3,2+|P-2,2+|P-1,2+|P0,2+|P1,2+|P2,2+|P3,2+|P4,2+|P5,2+|P6,2+|P7,2+|P8,2+|P9,2+|P10,2+|P11,2+|P12,2+|P13,2+|P14,2+|P15,2+",r({positionString:o});case"Knighted Chess":return o="P1,2+|P2,2+|P3,2+|P4,2+|P5,2+|P6,2+|P7,2+|P8,2+|p1,7+|p2,7+|p3,7+|P0,1+|P1,0+|P2,0+|P3,0+|P6,0+|P7,0+|P8,0+|P9,1+|p4,7+|p5,7+|p6,7+|p7,7+|p8,7+|p0,8+|p1,9+|p2,9+|p3,9+|p6,9+|p7,9+|p8,9+|p9,8+|CH1,1+|CH8,1+|ch1,8+|ch8,8+|N2,1|N7,1|n2,8|n7,8|AR3,1|AR6,1|ar3,8|ar6,8|AM4,1|am4,8|RC5,1+|rc5,8+",r({positionString:o});case"Omega":return o="r-2,4|r2,4|r-2,2|r2,2|r-2,0|r0,0|r2,0|k0,-1|R1,-2|P-2,-3|Q-1,-3|P2,-3|K0,-4",r({positionString:o});case"Omega^2":return o="K51,94|k46,80|Q30,148|Q32,148|Q29,3|q29,148|q24,98|q24,97|q24,92|q24,91|q24,86|q24,85|q24,80|q24,79|q46,78|q45,77|q46,77|q45,76|q46,76|q78,60|N15,84|n63,64|r53,96|r45,81|r46,81|r46,79|r47,79|r45,78|B27,152|B29,152|B27,151|B28,151|B30,151|B32,151|B27,150|B28,150|B29,150|B30,150|B31,150|B32,150|B32,149|B9,96|B11,96|B15,96|B20,96|B47,87|B43,86|B44,82|B50,82|B51,81|B8,79|B10,79|B8,78|B10,78|B14,78|B19,78|B49,77|B41,72|B43,72|B45,72|B47,72|B49,72|B51,72|B53,72|B68,72|B10,71|B14,71|B18,71|B20,71|B22,71|B24,71|B76,55|B78,55|B80,55|B82,55|B84,55|B27,20|B29,20|B29,4|b27,155|b29,155|b31,155|b32,154|b9,99|b11,99|b15,99|b20,97|b33,97|b24,96|b11,92|b13,92|b15,92|b19,92|b47,91|b48,91|b49,91|b50,91|b51,91|b24,90|b47,90|b49,90|b51,90|b48,89|b50,89|b51,89|b47,88|b49,88|b51,88|b37,87|b48,87|b50,87|b51,87|b19,86|b49,86|b51,86|b48,85|b50,85|b24,84|b49,84|b51,84|b9,83|b48,83|b50,83|b51,82|b18,80|b14,79|b24,78|b52,77|b53,77|b47,76|b49,76|b51,76|b52,76|b53,76|b66,76|b70,76|b45,75|b47,75|b49,75|b51,75|b53,75|b10,74|b14,74|b18,74|b20,74|b22,74|b24,74|b58,74|b75,71|b78,58|b80,58|b82,58|b84,58|b27,23|b29,23|P26,155|P28,155|P30,155|P32,155|P27,154|P29,154|P31,154|P33,154|P26,153|P28,153|P30,153|P32,153|P26,152|P28,152|P31,152|P33,152|P26,151|P29,151|P31,151|P33,151|P26,150|P33,150|P26,149|P27,149|P28,149|P29,149|P30,149|P31,149|P33,149|P31,148|P33,148|P26,147|P28,147|P30,147|P31,147|P32,147|P33,147|P15,146|P27,146|P29,146|P28,145|P25,111|P24,110|P23,109|P22,108|P21,107|P25,107|P20,106|P24,106|P19,105|P23,105|P20,104|P19,103|P25,103|P20,102|P24,102|P19,101|P23,101|P20,100|P4,99|P6,99|P8,99|P10,99|P12,99|P14,99|P16,99|P19,99|P3,98|P5,98|P7,98|P9,98|P11,98|P15,98|P20,98|P4,97|P6,97|P8,97|P10,97|P12,97|P14,97|P16,97|P19,97|P21,97|P32,97|P34,97|P3,96|P5,96|P8,96|P10,96|P12,96|P33,96|P35,96|P4,95|P6,95|P8,95|P9,95|P10,95|P11,95|P12,95|P14,95|P16,95|P19,95|P21,95|P32,95|P34,95|P36,95|P23,94|P33,94|P35,94|P37,94|P8,93|P9,93|P34,93|P36,93|P38,93|P4,92|P6,92|P8,92|P10,92|P12,92|P14,92|P16,92|P18,92|P20,92|P35,92|P37,92|P39,92|P3,91|P5,91|P7,91|P9,91|P11,91|P13,91|P15,91|P19,91|P21,91|P36,91|P38,91|P40,91|P4,90|P6,90|P8,90|P10,90|P12,90|P14,90|P16,90|P18,90|P20,90|P35,90|P39,90|P41,90|P3,89|P5,89|P7,89|P9,89|P11,89|P13,89|P15,89|P19,89|P21,89|P34,89|P40,89|P42,89|P4,88|P6,88|P8,88|P10,88|P12,88|P14,88|P16,88|P23,88|P33,88|P37,88|P41,88|P43,88|P46,88|P48,88|P3,87|P5,87|P7,87|P9,87|P11,87|P13,87|P15,87|P32,87|P36,87|P38,87|P42,87|P44,87|P4,86|P6,86|P8,86|P10,86|P12,86|P14,86|P18,86|P20,86|P31,86|P35,86|P37,86|P39,86|P42,86|P44,86|P46,86|P48,86|P3,85|P5,85|P7,85|P9,85|P11,85|P13,85|P15,85|P17,85|P19,85|P21,85|P32,85|P36,85|P38,85|P40,85|P42,85|P43,85|P44,85|P3,84|P5,84|P7,84|P9,84|P11,84|P13,84|P18,84|P20,84|P33,84|P37,84|P39,84|P42,84|P43,84|P44,84|P52,84|P4,83|P6,83|P8,83|P10,83|P12,83|P14,83|P16,83|P19,83|P21,83|P34,83|P38,83|P40,83|P42,83|P43,83|P44,83|P49,83|P51,83|P3,82|P5,82|P7,82|P9,82|P11,82|P13,82|P15,82|P23,82|P31,82|P35,82|P39,82|P42,82|P43,82|P52,82|P2,81|P4,81|P6,81|P8,81|P10,81|P12,81|P14,81|P32,81|P38,81|P40,81|P42,81|P43,81|P44,81|P49,81|P3,80|P5,80|P7,80|P9,80|P11,80|P17,80|P19,80|P21,80|P31,80|P33,80|P37,80|P39,80|P50,80|P52,80|P2,79|P4,79|P7,79|P9,79|P11,79|P13,79|P15,79|P18,79|P20,79|P32,79|P34,79|P36,79|P38,79|P40,79|P44,79|P3,78|P5,78|P7,78|P9,78|P11,78|P17,78|P21,78|P33,78|P35,78|P37,78|P39,78|P41,78|P43,78|P2,77|P4,77|P7,77|P8,77|P9,77|P10,77|P11,77|P13,77|P15,77|P18,77|P20,77|P34,77|P36,77|P38,77|P40,77|P42,77|P23,76|P35,76|P37,76|P39,76|P41,76|P65,76|P67,76|P69,76|P71,76|P7,75|P8,75|P36,75|P38,75|P40,75|P42,75|P64,75|P66,75|P70,75|P3,74|P5,74|P7,74|P9,74|P11,74|P13,74|P15,74|P17,74|P19,74|P21,74|P23,74|P25,74|P37,74|P39,74|P41,74|P57,74|P59,74|P63,74|P65,74|P67,74|P69,74|P71,74|P2,73|P4,73|P6,73|P8,73|P10,73|P14,73|P18,73|P20,73|P22,73|P24,73|P38,73|P40,73|P42,73|P44,73|P46,73|P48,73|P50,73|P52,73|P54,73|P58,73|P62,73|P64,73|P66,73|P70,73|P72,73|P3,72|P5,72|P7,72|P9,72|P11,72|P13,72|P15,72|P17,72|P19,72|P21,72|P23,72|P25,72|P39,72|P57,72|P59,72|P61,72|P63,72|P65,72|P71,72|P2,71|P4,71|P6,71|P8,71|P40,71|P42,71|P44,71|P46,71|P48,71|P50,71|P52,71|P54,71|P58,71|P62,71|P64,71|P66,71|P70,71|P72,71|P74,71|P76,71|P3,70|P5,70|P7,70|P9,70|P11,70|P13,70|P15,70|P17,70|P19,70|P21,70|P23,70|P25,70|P57,70|P59,70|P61,70|P63,70|P65,70|P71,70|P75,70|P77,70|P56,69|P58,69|P62,69|P64,69|P72,69|P74,69|P76,69|P78,69|P57,68|P59,68|P61,68|P63,68|P67,68|P69,68|P75,68|P77,68|P79,68|P56,67|P58,67|P62,67|P66,67|P70,67|P74,67|P76,67|P78,67|P80,67|P57,66|P59,66|P64,66|P67,66|P69,66|P71,66|P75,66|P77,66|P79,66|P81,66|P56,65|P59,65|P63,65|P66,65|P70,65|P76,65|P78,65|P80,65|P82,65|P57,64|P59,64|P62,64|P65,64|P67,64|P69,64|P71,64|P73,64|P77,64|P79,64|P81,64|P83,64|P56,63|P58,63|P66,63|P70,63|P74,63|P78,63|P80,63|P82,63|P84,63|P57,62|P59,62|P61,62|P63,62|P65,62|P67,62|P69,62|P71,62|P73,62|P75,62|P79,62|P81,62|P83,62|P85,62|P56,61|P58,61|P60,61|P62,61|P64,61|P66,61|P70,61|P74,61|P76,61|P82,61|P84,61|P57,60|P59,60|P61,60|P63,60|P65,60|P67,60|P69,60|P71,60|P73,60|P75,60|P80,60|P82,60|P56,59|P58,59|P60,59|P62,59|P64,59|P66,59|P70,59|P74,59|P57,58|P59,58|P61,58|P63,58|P65,58|P73,58|P75,58|P58,57|P60,57|P62,57|P64,57|P74,57|P73,56|P75,56|P77,56|P79,56|P81,56|P83,56|P85,56|P74,55|P75,54|P77,54|P79,54|P81,54|P83,54|P85,54|P26,23|P28,23|P30,23|P27,22|P29,22|P26,21|P28,21|P30,21|P26,19|P28,19|P30,19|P26,18|P30,18|P26,17|P30,17|P26,16|P28,16|P30,16|P26,15|P28,15|P30,15|P26,14|P28,14|P30,14|P26,13|P28,13|P30,13|P26,12|P28,12|P30,12|P26,11|P28,11|P30,11|P26,10|P28,10|P30,10|P26,9|P28,9|P30,9|P26,8|P28,8|P30,8|P26,7|P28,7|P30,7|P26,6|P28,6|P30,6|P26,5|P28,5|P30,5|P26,4|P28,4|P30,4|P26,3|P28,3|P30,3|P26,2|P27,2|P28,2|P29,2|P30,2|p26,156|p28,156|p30,156|p32,156|p33,155|p26,154|p28,154|p30,154|p31,153|p33,153|p15,147|p25,112|p24,111|p23,110|p22,109|p25,109|p21,108|p25,108|p20,107|p24,107|p19,106|p23,106|p20,105|p25,105|p19,104|p25,104|p20,103|p24,103|p19,102|p23,102|p20,101|p25,101|p4,100|p6,100|p8,100|p10,100|p12,100|p14,100|p16,100|p19,100|p24,100|p25,100|p3,99|p5,99|p7,99|p20,99|p23,99|p24,99|p25,99|p4,98|p6,98|p8,98|p10,98|p12,98|p14,98|p16,98|p19,98|p21,98|p23,98|p25,98|p32,98|p34,98|p3,97|p5,97|p15,97|p23,97|p25,97|p35,97|p4,96|p6,96|p14,96|p16,96|p19,96|p21,96|p23,96|p25,96|p32,96|p34,96|p36,96|p18,95|p23,95|p25,95|p33,95|p35,95|p37,95|p25,94|p34,94|p36,94|p38,94|p4,93|p6,93|p10,93|p12,93|p14,93|p16,93|p18,93|p20,93|p23,93|p24,93|p25,93|p35,93|p37,93|p39,93|p3,92|p5,92|p7,92|p9,92|p21,92|p23,92|p25,92|p36,92|p38,92|p40,92|p46,92|p47,92|p48,92|p49,92|p50,92|p51,92|p52,92|p4,91|p6,91|p8,91|p10,91|p12,91|p14,91|p16,91|p18,91|p20,91|p23,91|p25,91|p35,91|p39,91|p41,91|p46,91|p52,91|p3,90|p5,90|p7,90|p9,90|p11,90|p13,90|p15,90|p19,90|p21,90|p23,90|p25,90|p34,90|p40,90|p42,90|p46,90|p48,90|p50,90|p52,90|p4,89|p6,89|p8,89|p10,89|p12,89|p14,89|p16,89|p23,89|p25,89|p33,89|p37,89|p41,89|p43,89|p46,89|p52,89|p3,88|p5,88|p7,88|p9,88|p11,88|p13,88|p15,88|p25,88|p32,88|p36,88|p38,88|p42,88|p44,88|p50,88|p52,88|p4,87|p6,87|p8,87|p10,87|p12,87|p14,87|p18,87|p20,87|p23,87|p24,87|p25,87|p31,87|p35,87|p39,87|p46,87|p52,87|p3,86|p5,86|p7,86|p9,86|p11,86|p13,86|p15,86|p17,86|p21,86|p23,86|p25,86|p32,86|p36,86|p38,86|p40,86|p47,86|p50,86|p52,86|p18,85|p20,85|p23,85|p25,85|p33,85|p37,85|p39,85|p46,85|p47,85|p49,85|p52,85|p4,84|p6,84|p8,84|p10,84|p12,84|p14,84|p16,84|p19,84|p21,84|p23,84|p25,84|p34,84|p38,84|p40,84|p46,84|p47,84|p3,83|p5,83|p7,83|p11,83|p13,83|p15,83|p23,83|p25,83|p31,83|p35,83|p39,83|p46,83|p47,83|p52,83|p2,82|p4,82|p6,82|p8,82|p10,82|p12,82|p14,82|p25,82|p32,82|p38,82|p40,82|p46,82|p47,82|p49,82|p3,81|p5,81|p7,81|p9,81|p11,81|p13,81|p15,81|p17,81|p19,81|p21,81|p23,81|p24,81|p25,81|p31,81|p33,81|p37,81|p39,81|p47,81|p50,81|p52,81|p2,80|p4,80|p13,80|p15,80|p20,80|p23,80|p25,80|p32,80|p34,80|p36,80|p38,80|p40,80|p44,80|p47,80|p3,79|p5,79|p17,79|p19,79|p21,79|p23,79|p25,79|p33,79|p35,79|p37,79|p39,79|p41,79|p43,79|p45,79|p2,78|p4,78|p13,78|p15,78|p18,78|p20,78|p23,78|p25,78|p34,78|p36,78|p38,78|p40,78|p42,78|p44,78|p47,78|p49,78|p51,78|p52,78|p53,78|p54,78|p17,77|p23,77|p25,77|p35,77|p37,77|p39,77|p41,77|p44,77|p47,77|p48,77|p50,77|p51,77|p54,77|p65,77|p67,77|p69,77|p71,77|p25,76|p36,76|p38,76|p40,76|p42,76|p44,76|p48,76|p50,76|p54,76|p64,76|p3,75|p5,75|p9,75|p11,75|p13,75|p15,75|p17,75|p19,75|p21,75|p23,75|p25,75|p37,75|p39,75|p41,75|p44,75|p46,75|p48,75|p50,75|p52,75|p54,75|p57,75|p59,75|p63,75|p65,75|p67,75|p69,75|p71,75|p2,74|p4,74|p6,74|p8,74|p38,74|p40,74|p42,74|p44,74|p46,74|p48,74|p50,74|p52,74|p54,74|p62,74|p64,74|p66,74|p70,74|p72,74|p3,73|p5,73|p7,73|p9,73|p11,73|p13,73|p15,73|p17,73|p19,73|p21,73|p23,73|p25,73|p39,73|p41,73|p43,73|p45,73|p47,73|p49,73|p51,73|p53,73|p57,73|p59,73|p61,73|p63,73|p65,73|p71,73|p2,72|p4,72|p6,72|p8,72|p10,72|p14,72|p18,72|p20,72|p22,72|p24,72|p40,72|p42,72|p44,72|p46,72|p48,72|p50,72|p52,72|p54,72|p58,72|p62,72|p64,72|p66,72|p70,72|p72,72|p74,72|p76,72|p3,71|p5,71|p7,71|p9,71|p11,71|p13,71|p15,71|p17,71|p19,71|p21,71|p23,71|p25,71|p53,71|p57,71|p59,71|p61,71|p63,71|p65,71|p71,71|p77,71|p56,70|p58,70|p62,70|p64,70|p67,70|p69,70|p72,70|p74,70|p76,70|p78,70|p57,69|p59,69|p61,69|p63,69|p67,69|p69,69|p75,69|p77,69|p79,69|p56,68|p58,68|p62,68|p66,68|p70,68|p74,68|p76,68|p78,68|p80,68|p57,67|p59,67|p64,67|p67,67|p69,67|p71,67|p75,67|p77,67|p79,67|p81,67|p56,66|p63,66|p66,66|p70,66|p73,66|p76,66|p78,66|p80,66|p82,66|p57,65|p62,65|p65,65|p67,65|p69,65|p71,65|p73,65|p77,65|p79,65|p81,65|p83,65|p56,64|p58,64|p61,64|p66,64|p70,64|p74,64|p78,64|p80,64|p82,64|p84,64|p57,63|p59,63|p61,63|p63,63|p65,63|p67,63|p69,63|p71,63|p73,63|p75,63|p79,63|p81,63|p83,63|p85,63|p56,62|p58,62|p60,62|p62,62|p64,62|p66,62|p70,62|p74,62|p76,62|p80,62|p82,62|p84,62|p57,61|p59,61|p61,61|p63,61|p65,61|p67,61|p69,61|p71,61|p73,61|p75,61|p77,61|p78,61|p80,61|p56,60|p58,60|p60,60|p62,60|p64,60|p66,60|p70,60|p74,60|p77,60|p79,60|p57,59|p59,59|p61,59|p63,59|p65,59|p73,59|p75,59|p77,59|p78,59|p79,59|p80,59|p81,59|p82,59|p83,59|p84,59|p85,59|p58,58|p60,58|p62,58|p64,58|p74,58|p77,58|p79,58|p81,58|p83,58|p85,58|p73,57|p75,57|p77,57|p79,57|p81,57|p83,57|p85,57|p74,56|p76,56|p78,56|p80,56|p82,56|p84,56|p75,55|p77,55|p79,55|p81,55|p83,55|p85,55|p26,24|p28,24|p30,24|p26,22|p28,22|p30,22|p27,21|p29,21|p26,20|p28,20|p30,20|p28,17",r({positionString:o});case"Omega^3":return n=variantomega.genPositionOfOmegaCubed(),r({startingPosition:n,pawnDoublePush:!1,castleWith:null});case"Omega^4":return n=variantomega.genPositionOfOmegaFourth(),r({startingPosition:n,pawnDoublePush:!1,castleWith:null});default:throw new Error("Unknown variant.")}}function r({positionString:e,startingPosition:t,specialRights:o,pawnDoublePush:n,castleWith:i}){if(e){if(!t){const n=formatconverter.getStartingPositionAndSpecialRightsFromShortPosition(e);t=n.startingPosition,o=n.specialRights}}else if(t&&o)e=formatconverter.LongToShort_Position(t,o);else{if(!t)return console.error("Not enough information to calculate the positionString, position, and specialRights of variant.");o=formatconverter.generateSpecialRights(t,n,i),e=formatconverter.LongToShort_Position(t,o)}return{positionString:e,position:t,specialRights:o}}function a({Variant:e,Date:t=math.getUTCDateTime()},n){switch(n||(n=i({Variant:e}).position),e){case"Classical":case"Core":case"Standarch":return o({position:n});case"Space Classic":o({promotionRanks:math.getUTCTimestamp(t)<17090172e5?[4,-3]:void 0,position:n});case"CoaIP":return o({position:n});case"Pawn Horde":return o({winConditions:{white:["checkmate"],black:["allpiecescaptured"]},promotionRanks:[2,-7],position:n});case"Space":return o({promotionRanks:[4,-3],position:n});case"Obstocean":return o({position:n});case"Abundance":return o({promotionRanks:[6,-6],position:n});case"Amazon Chandelier":return o({promotionRanks:[10,-9],position:n});case"Containment":return o({promotionRanks:null,position:n});case"Classical - Limit 7":case"CoaIP - Limit 7":return o({slideLimit:7,position:n});case"Chess":return o({position:n});case"Classical - KOTH":case"CoaIP - KOTH":return o({winConditions:{white:["checkmate","koth"],black:["checkmate","koth"]},position:n});case"Classical+":case"Pawndard":return o({position:n});case"Knightline":return o({promotionsAllowed:{white:["knights","queens"],black:["knights","queens"]}});case"Knighted Chess":return o({position:n});case"Omega":case"Omega^2":case"Omega^3":return o({promotionRanks:null,moveRule:null,position:n});case"Omega^4":return o({promotionRanks:null,moveRule:null,winConditions:{white:["royalcapture"],black:["royalcapture"]},position:n});case"Standarch - 3 Check":case"CoaIP - 3 Check":return o({winConditions:{white:["checkmate","threecheck"],black:["checkmate","threecheck"]},position:n});default:throw new Error("Unknown variant.")}}function s(e,t){const o=math.deepCopyObject(pieces.royals);o.push("pawns");const n=[],i=[];if(!t)return{white:n,black:i};for(const r in e){const a=e[r];if(a.endsWith("N"))continue;const s=math.trimWorBFromType(a);o.includes(s)||(n.includes(s)||(null!=t[0]&&n.push(s),null!=t[1]&&i.push(s)))}return{white:n,black:i}}function c(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Classical"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}function l(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Standarch"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}function u(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"CoaIP"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}return Object.freeze({setupVariant:function(e,t,o){o?function(e,{Variant:t,Date:o},n){let r=n.positionString,a=n.startingPosition,s=n.specialRights;if(n.startingPosition)r=formatconverter.LongToShort_Position(n.startingPosition,n.specialRights);else{const e=i({Variant:t,Date:o});r=e.positionString,a=e.position,s=e.specialRights}e.startSnapshot={position:a,positionString:r,specialRights:s,turn:n.turn||"white",fullMove:n.fullMove||1},n.enpassant&&(e.startSnapshot.enpassant=n.enpassant);if(n.moveRule){const[t,o]=n.moveRule.split("/");e.startSnapshot.moveRuleState=Number(t),n.gameRules.moveRule=Number(o)}e.gameRules=n.gameRules}(e,t,o):function(e,{Variant:t,Date:o}){switch(t){case"Classical":case"Classical - Limit 7":case"Classical - KOTH":c(e,{Variant:t,Date:o});break;case"Core":!function(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Core"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"Standarch":case"Standarch - 3 Check":l(e,{Variant:t,Date:o});break;case"Space Classic":!function(e,{Variant:t,Date:o}){e.metadata.Date=o;const{position:n,positionString:r,specialRights:s}=i({Variant:"Space Classic",Date:o});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"CoaIP":case"CoaIP - Limit 7":case"CoaIP - KOTH":case"CoaIP - 3 Check":u(e,{Variant:t,Date:o});break;case"Pawn Horde":!function(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Pawn Horde"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"Space":!function(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Space"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"Obstocean":!function(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Obstocean"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"Abundance":!function(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Abundance"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"Amazon Chandelier":!function(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Amazon Chandelier"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"Containment":!function(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Containment"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"Chess":!function(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Chess"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"Classical+":!function(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Classical+"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"Pawndard":!function(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Pawndard"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"Knightline":!function(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Knightline"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"Knighted Chess":!function(e,{Variant:t,Date:o}){const{position:n,positionString:r,specialRights:s}=i({Variant:"Knighted Chess"});e.startSnapshot={position:n,positionString:r,specialRights:s,turn:"white"},e.gameRules=a({Variant:t,Date:o},n)}(e,{Variant:t,Date:o});break;case"Omega":variantomega.initOmega(e,{Variant:t,Date:o});break;case"Omega^2":variantomega.initOmegaSquared(e,{Variant:t,Date:o});break;case"Omega^3":variantomega.initOmegaCubed(e,{Variant:t,Date:o});break;case"Omega^4":variantomega.initOmegaFourth(e,{Variant:t,Date:o});break;default:throw new Error("Unknown variant.")}e.gameRules.moveRule&&(e.startSnapshot.moveRuleState=0);e.startSnapshot.fullMove=1}(e,t),function(e){e.pieceMovesets=movesets.getPieceMovesets(e.gameRules.slideLimit),e.specialDetects=specialdetect.getSpecialMoves(),e.specialMoves=specialmove.getFunctions(),e.specialUndos=specialundo.getFunctions(),e.vicinity=legalmoves.genVicinity(e)}(e)},getGameRules:o,getGameRulesOfVariant:a,getBareMinimumGameRules:function(){return{winConditions:{white:["checkmate"],black:["checkmate"]}}},getStartingPositionOfVariant:i,getDefaultWinConditions:n,isVariantAVariantWhereBlackStarts:function(e){return t.includes(e)},isVariantValid:function(t){return e.includes(t)},getPromotionsAllowed:s})}(),variantomega=Object.freeze({initOmega:function(e,{Variant:t,Date:o}){const{position:n,positionString:i,specialRights:r}=variant.getStartingPositionOfVariant({Variant:"Omega"});e.startSnapshot={position:n,positionString:i,specialRights:r,turn:"black"},e.gameRules=variant.getGameRulesOfVariant({Variant:t,Date:o},n)},initOmegaSquared:function(e,{Variant:t,Date:o}){const{position:n,positionString:i,specialRights:r}=variant.getStartingPositionOfVariant({Variant:"Omega^2"});e.startSnapshot={position:n,positionString:i,specialRights:r,turn:"black"},e.gameRules=variant.getGameRulesOfVariant({Variant:t,Date:o},n)},initOmegaCubed:function(e,{Variant:t,Date:o}){const{position:n,positionString:i,specialRights:r}=variant.getStartingPositionOfVariant({Variant:"Omega^3"});e.startSnapshot={position:n,positionString:i,specialRights:r,turn:"black"},e.gameRules=variant.getGameRulesOfVariant({Variant:t,Date:o},n)},initOmegaFourth:function(e,{Variant:t,Date:o}){const{position:n,positionString:i,specialRights:r}=variant.getStartingPositionOfVariant({Variant:"Omega^4"});e.startSnapshot={position:n,positionString:i,specialRights:r,turn:"black"},e.gameRules=variant.getGameRulesOfVariant({Variant:t,Date:o},n)},genPositionOfOmegaCubed:function(){const e=500,t={};return t[math.getKeyFromCoords([3,15])]="kingsW",t[math.getKeyFromCoords([4,13])]="rooksB",o(t,7,-500,e),o(t,8,-500,e),o(t,9,-500,e),t[math.getKeyFromCoords([9,10])]="bishopsW",function(e,t){const o=math.getKeyFromCoords(t);delete e[o]}(t,[9,11]),o(t,10,-500,e),t[math.getKeyFromCoords([10,12])]="kingsB",function(e,t,o,i,r){let a=o;for(let o=t;oi)return}(t,15,6,e,e),function(e,t){for(let o=t.left;o<=t.right;o++){let n=math.getKeyFromCoords([o,t.bottom]);e[n]="voidsN",n=math.getKeyFromCoords([o,t.top]),e[n]="voidsN"}for(let o=t.bottom;o<=t.top;o++){let n=math.getKeyFromCoords([t.left,o]);e[n]="voidsN",n=math.getKeyFromCoords([t.right,o]),e[n]="voidsN"}}(t,{left:-500,right:500,bottom:-500,top:500}),t["499,492"]="voidsN",t["7,-500"]="pawnsW",t["8,-500"]="pawnsW",t["9,-500"]="pawnsW",t["10,-500"]="pawnsW",t["11,-500"]="pawnsW",t["12,-500"]="pawnsW",t["6,-501"]="voidsN",t["7,-501"]="voidsN",t["8,-501"]="voidsN",t["9,-501"]="voidsN",t["10,-501"]="voidsN",t["11,-501"]="voidsN",t["12,-501"]="voidsN",t["13,-501"]="voidsN",t["497,-497"]="voidsN",t["498,-497"]="voidsN",t["499,-497"]="voidsN",t["497,-498"]="voidsN",t["497,-499"]="voidsN",t["498,-498"]="voidsN",t["499,-499"]="voidsN",t["498,-499"]="bishopsB",t;function o(e,t,o,n){if(!(ni)}(t,1,-7,e,-500),function(e,t,o,n,i){let r=t,a=o,s=0;do{l(e,r,a,s),r-=8,a-=8,s++}while(r>n&&a>i)}(t,-1,-7,-500,-500),function(e,t,o,n,i,r){for(let i=t;i<=n;i++)e[math.getKeyFromCoords([i,o])]="voidsN";for(let t=o;t>=i;t--)e[math.getKeyFromCoords([n,t])]="voidsN";let a=i;for(let t=n;t>=-3;t--){let o=math.getKeyFromCoords([t,a]);e[o]="voidsN",o=math.getKeyFromCoords([t,a-1]),e[o]="voidsN",a--}for(let n=o;n>=r;n--)e[math.getKeyFromCoords([t,n])]="voidsN";a=r;for(let o=t;o<=-4;o++){let t=math.getKeyFromCoords([o,a]);e[t]="voidsN",t=math.getKeyFromCoords([o,a-1]),e[t]="voidsN",a--}e["492,493"]="voidsN"}(t,-866,500,567,-426,-134),t;function i(e,t,o,n){if(!(n-980&&(e[math.getKeyFromCoords([t+3,o-3])]="pawnsB"),o-4-t+3>-980&&(e[math.getKeyFromCoords([t+3,o-4])]="pawnsW"),o-5-t+4>-980&&(e[math.getKeyFromCoords([t+4,o-4])]="pawnsB"),o-3-t+4>-980&&(e[math.getKeyFromCoords([t+4,o-5])]="pawnsW"),o-4-t+5>-980&&(e[math.getKeyFromCoords([t+5,o-3])]="pawnsB"),o-4-t+5>-980&&(e[math.getKeyFromCoords([t+5,o-4])]="pawnsW"),o-2-t+6>-980&&(e[math.getKeyFromCoords([t+6,o-2])]="pawnsB"),o-3-t+6>-980&&(e[math.getKeyFromCoords([t+6,o-3])]="pawnsW"),o-1-t+7>-980&&(e[math.getKeyFromCoords([t+7,o-1])]="pawnsB"),o-2-t+7>-980&&(e[math.getKeyFromCoords([t+7,o-2])]="pawnsW"),o+1-t+7>-980&&(e[math.getKeyFromCoords([t+7,o+1])]="pawnsB"),o+0-t+7>-980&&(e[math.getKeyFromCoords([t+7,o+0])]="pawnsW"),o-2-t+8>-980&&(e[math.getKeyFromCoords([t+8,o-2])]="bishopsB"),o-6-t+6>-980&&(e[math.getKeyFromCoords([t+6,o-6])]="pawnsB"),o-7-t+6>-980&&(e[math.getKeyFromCoords([t+6,o-7])]="pawnsW"),o-5-t+7>-980&&(e[math.getKeyFromCoords([t+7,o-5])]="pawnsB"),o-6-t+7>-980&&(e[math.getKeyFromCoords([t+7,o-6])]="pawnsW"),o-4-t+8>-980&&(e[math.getKeyFromCoords([t+8,o-4])]="pawnsB"),o-5-t+8>-980&&(e[math.getKeyFromCoords([t+8,o-5])]="pawnsW"),o-3-t+9>-980&&(e[math.getKeyFromCoords([t+9,o-3])]="pawnsB"),o-4-t+9>-980&&(e[math.getKeyFromCoords([t+9,o-4])]="pawnsW");const i=n+2;let r=t+8,a=o+2;if(a-r>-990)for(let t=1;t<=i;t++)c(e,r,a,t===i),r+=1,a+=1;let s=t+4,l=o;for(let t=0;t{n[e]=!0}));continue}e=[],o=!0,i=a+1;for(let r=0;r{n[e]=!0}));continue}e=[],o=!0;let m=s-1;for(let i=0;i{n[e]=!0}));else{e=[],o=!0,m=c+1;for(let i=0;i{n[e]=!0}))):d=!1}}const m={left:r,right:a,bottom:s,top:c};o.push(m)}return o},render(e){if(null==e.voidMesh.model)return;const t=movement.getBoardPos(),o=[-t[0]+e.mesh.offset[0],-t[1]+e.mesh.offset[1],0],n=movement.getBoardScale(),i=[n,n,1];e.voidMesh.model.render(o,i)}};let gl;const webgl=function(){let e=[.5,.5,.5];const t="LEQUAL";function o(){gl.clearColor(...e,1),gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT)}function n(){gl.blendFunc(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA)}return Object.freeze({init:function(){if(gl||(gl=camera.canvas.getContext("webgl",{alpha:!1})),gl||(console.log("Browser doesn't support WebGL-1, falling back on experiment-webgl."),gl=canvas.getContext("experimental-webgl",{alpha:!1})),!gl)throw alert("Your browser does not support WebGL. This game requires that to function. Please update your browser."),new Error("WebGL not supported.");gl.clearDepth(1),o(),gl.enable(gl.DEPTH_TEST),gl.depthFunc(gl[t]),gl.enable(gl.BLEND),n()},clearScreen:o,executeWithDepthFunc_ALWAYS:function(e){gl.depthFunc(gl.ALWAYS),e(),gl.depthFunc(gl[t])},executeWithInverseBlending:function(e){gl.blendFunc(gl.ONE_MINUS_DST_COLOR,gl.GL_ZERO),e(),n()},setClearColor:function(t){e=t},queryWebGLContextInfo:function(){console.log("WebGL Context Information:"),[{name:"MAX_TEXTURE_SIZE",desc:"Maximum texture size",guaranteed:64},{name:"MAX_CUBE_MAP_TEXTURE_SIZE",desc:"Maximum cube map texture size",guaranteed:16},{name:"MAX_RENDERBUFFER_SIZE",desc:"Maximum renderbuffer size",guaranteed:1},{name:"MAX_TEXTURE_IMAGE_UNITS",desc:"Maximum texture units for fragment shader",guaranteed:8},{name:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",desc:"Maximum texture units for vertex shader",guaranteed:0},{name:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",desc:"Maximum combined texture units",guaranteed:8},{name:"MAX_VERTEX_ATTRIBS",desc:"Maximum vertex attributes",guaranteed:8},{name:"MAX_VERTEX_UNIFORM_VECTORS",desc:"Maximum vertex uniform vectors",guaranteed:128},{name:"MAX_FRAGMENT_UNIFORM_VECTORS",desc:"Maximum fragment uniform vectors",guaranteed:16},{name:"MAX_VARYING_VECTORS",desc:"Maximum varying vectors",guaranteed:8},{name:"MAX_VIEWPORT_DIMS",desc:"Maximum viewport dimensions",guaranteed:[0,0]},{name:"ALIASED_POINT_SIZE_RANGE",desc:"Aliased point size range",guaranteed:[1,1]},{name:"ALIASED_LINE_WIDTH_RANGE",desc:"Aliased line width range",guaranteed:[1,1]},{name:"MAX_VERTEX_UNIFORM_COMPONENTS",desc:"Maximum vertex uniform components",guaranteed:1024},{name:"MAX_FRAGMENT_UNIFORM_COMPONENTS",desc:"Maximum fragment uniform components",guaranteed:1024},{name:"MAX_VERTEX_OUTPUT_COMPONENTS",desc:"Maximum vertex output components",guaranteed:64},{name:"MAX_FRAGMENT_INPUT_COMPONENTS",desc:"Maximum fragment input components",guaranteed:60},{name:"MAX_DRAW_BUFFERS",desc:"Maximum draw buffers",guaranteed:4},{name:"MAX_COLOR_ATTACHMENTS",desc:"Maximum color attachments",guaranteed:4},{name:"MAX_SAMPLES",desc:"Maximum samples",guaranteed:4}].forEach((e=>{const t=gl.getParameter(gl[e.name]);console.log(`${e.desc}:`,t,`(Guaranteed: ${e.guaranteed})`)}))}})}(),websocket=function(){let e,t=!1,o=!1,n=!1,i=!1;const r=1e4;let a;const s=["invites","game"],c={invites:!1,game:!1},l=5e3,u=1e4,d=l,m=5e3,p=5e3;let g={},f={};const h=[],v=!0,P=!1,b=!0,y=!1;async function w(){if(i)return!1;for(;t||e&&e.readyState!==WebSocket.OPEN;)main.devBuild&&console.log("Waiting for the socket to be established or closed.."),await main.sleep(100);if(e&&e.readyState===WebSocket.OPEN)return!0;t=!0;let o=await C();for(;!o&&!R();)n=!0,statustext.showStatusForDuration("No connection.",l),onlinegame.onLostConnection(),invites.clearIfOnPlayPage(),await main.sleep(l),o=await C();return o&&n&&statustext.showStatusForDuration("Reconnected.",1e3),n=!1,h.forEach((e=>{clearTimeout(e)})),t=!1,o}async function C(){return o=setTimeout(T,m),new Promise(((t,o)=>{let n=`wss://${window.location.hostname}`;"443"!==window.location.port&&(n+=`:${window.location.port}`);const i=new WebSocket(n);i.onopen=()=>{k(),e=i,t(!0)},i.onerror=e=>{k(),t(!1)},i.onmessage=M,i.onclose=E}))}function k(){clearTimeout(o),o=!1}function T(){n=!0,statustext.showStatusForDuration("No connection.",m),o=setTimeout(T,m)}function S(t){t&&delete g[t],e&&(console.log(`Renewing connection after we haven't received an echo for ${p} milliseconds...`),n=!0,statustext.showStatusForDuration("No connection.",m),e.close(1e3,"Connection closed by client. Renew."))}function M(e){let t;try{t=JSON.parse(e.data)}catch(e){return console.error("Error parsing incoming message as JSON:",e)}const o="echo"===t.action;if(b&&main.devBuild&&(o?y&&console.log(`Incoming message: ${JSON.stringify(t)}`):console.log(`Incoming message: ${JSON.stringify(t)}`)),o)return function(e){const t=e.value,o=g[t];clearTimeout(o),delete g[t]}(t);const n=t.sub;if(null==n)return console.error("Server should not be sending us socket data without subscription data! Message:"),console.log(t);switch(I("general","echo",t.id),function(e){if(null==e)return;if(!f[e])return;f[e](),delete f[e]}(t.replyto),n){case"general":!function(e,t){switch(e){case"notify":statustext.showStatus(t);break;case"error":statustext.showStatus(t,!0,2);break;case"print":console.log(t);break;case"printerror":console.error(t);break;case"renewconnection":break;case"gameversion":t!==main.GAME_VERSION&&function(e){if(null==e)throw new Error("Can't hard refresh with no expected version.");const t={timeLastHardRefreshed:Date.now(),expectedVersion:e},o=localstorage.loadItem("hardrefreshinfo");if(o?.expectedVersion===e)return o.sentNotSupported||I("general","feature-not-supported",`location.reload(true) failed to hard refresh. Server version: ${e}. Still running: ${main.GAME_VERSION}`),o.sentNotSupported=!0,void n(o);function n(e){localstorage.saveItem("hardrefreshinfo",e,math.getTotalMilliseconds({days:1}))}n(t),location.reload(!0)}(t);break;default:console.log(`We don't know how to treat this server action in general route: Action "${e}". Value: ${t}`)}}(t.action,t.value);break;case"invites":invites.onmessage(t);break;case"game":onlinegame.onmessage(t);break;default:return console.error("Unknown socket subscription received from the server! Message:"),console.log(t)}}function E(t){main.devBuild&&console.log("WebSocket connection closed:",t.code,t.reason);const o=void 0!==e;if(e=void 0,function(){const e=Object.keys(g);for(const t of e){const e=g[t];clearTimeout(e)}g={}}(),f={},onlinegame.setInSyncFalse(),1006===t.code)return void(o&&F());const i=t.reason.trim();switch(i){case"Connection expired":F();break;case"Connection closed by client":break;case"Connection closed by client. Renew.":console.log("Closed web socket successfully. Renewing now.."),F();break;case"Unable to identify client IP address":statustext.showStatus("Unable to identify IP. Report this bug to Naviary!",!0,100),invites.clearIfOnPlayPage();break;case"Authentication needed":statustext.showStatus("Online play disabled. Cookies not supported. Try a different browser."),invites.clearIfOnPlayPage();break;case"Logged out":validation.deleteToken(),F();break;case"Too Many Requests. Try again soon.":statustext.showStatusForDuration("Too many requests. Try again soon.",u),B(u);break;case"Message Too Big":statustext.showStatus("Message too big. This should never happen, please report this bug to Naviary!",!0,3),B(d);break;case"Too Many Sockets":statustext.showStatus("Too many sockets. This should never happen, please report this bug to Naviary!",!0,3),setTimeout(F,u);break;case"Origin Error":statustext.showStatus("Origin error. This should never happen, please report this bug to Naviary!",!0,3),invites.clearIfOnPlayPage(),B(u);break;case"No echo heard":n=!0,statustext.showStatusForDuration("No connection.",m),F();break;default:statustext.showStatus(`Connection closed unexpectedly. Server message: "${i}" Please report this to Naviary!`,!0,100),console.error("Unknown reason why the WebSocket connection was closed. Not reopening or resubscribing.")}}function B(e){if(null==e)return console.error("Cannot enter timeout for an undefined amount of time!");i||(i=!0,setTimeout(x,e),invites.clearIfOnPlayPage())}function x(){i=!1,F()}async function I(t,o,n,i,s){if(!await w())return s&&s(),!1;clearTimeout(a),R()&&(a=setTimeout(D,r));const c={route:t,action:o,value:n},l="echo"===o;return l||(c.id=math.generateNumbID(10)),v&&main.devBuild&&(l?P&&console.log(`Sending: ${JSON.stringify(c)}`):console.log(`Sending: ${JSON.stringify(c)}`)),l||(g[c.id]=setTimeout(S,p,c.id)),l||function(e,t){if(!t)return;f[e]=t}(c.id,s),!(!e||e.readyState!==WebSocket.OPEN)&&(e.send(JSON.stringify(c)),!0)}function D(){if(e)return e.readyState!==WebSocket.OPEN?console.error("Cannot close socket because it's not open! Yet socket is defined."):void e.close(1e3,"Connection closed by client")}function R(){for(const e of s)if(!0===c[e])return!1;return!0}async function F(){if(main.devBuild&&console.log("Resubbing all.."),R())return n=!1,console.log("No subs to sub to.");if(!await w())return!1;for(const e of s)if(!1!==c[e])switch(e){case"invites":await invites.subscribeToInvites(!0);break;case"game":onlinegame.resyncToGame();break;default:return console.error(`Cannot resub to all subs after an unexpected socket closure with strange sub ${e}!`)}}return window.addEventListener("pageshow",(function(e){e.persisted&&(console.log("Page was returned to using the back or forward button."),F())})),Object.freeze({closeSocket:D,sendmessage:I,unsubFromInvites:function(){if(invites.clear({recentUsersInLastList:!0}),!1===c.invites)return;c.invites=!1,math.generateNumbID(10),I("general","unsub","invites")},getSubs:function(){return c},addTimerIDToCancelOnNewSocket:function(e){h.push(e)}})}(),wincondition=function(){const e=["checkmate","royalcapture","allroyalscaptured","allpiecescaptured","threecheck","koth"],t=[...e,"stalemate","repetition","moverule"],o=[[4,4],[5,4],[4,5],[5,5]];function n(e){if(!i(e,"threecheck"))return!1;if(e.inCheck){if(null==e.checksGiven&&(e.checksGiven={white:0,black:0}),"white"===e.whosTurn)e.checksGiven.white++;else{if("black"!==e.whosTurn)throw new Error(`Whosturn is invalid when detecting threecheck! Value ${e.whosTurn}`);e.checksGiven.black++}if(3===e.checksGiven[e.whosTurn]){if("white"===e.whosTurn)return"black threecheck";if("black"===e.whosTurn)return"white threecheck";throw new Error("Cannot determine winning color by wincondition threecheck!")}}return!1}function i(e,t){const o=math.getOppositeColor(e.whosTurn);return e.gameRules.winConditions[o].includes(t)}function r(e){const t=movesscript.getLastMove(e.moves);if(!t)return!1;if(!t.captured)return!1;const o=math.trimWorBFromType(t.captured);return pieces.royals.includes(o)}return Object.freeze({validWinConditions:e,getGameConclusion:function(e){return function(e){if(!i(e,"allpiecescaptured"))return!1;const t=gamefileutility.getPieceCountOfColorFromPiecesByType(e.ourPieces,e.whosTurn);if(0===t){if("white"===e.whosTurn)return"black allpiecescaptured";if("black"===e.whosTurn)return"white allpiecescaptured";throw new Error("Cannot determine winning color by wincondition allpiecescaptured!")}return!1}(e)||function(e){if(!i(e,"royalcapture"))return!1;if(r(e)){if("white"===e.whosTurn)return"black royalcapture";if("black"===e.whosTurn)return"white royalcapture";throw new Error("Cannot determine winning color by wincondition royalcapture!")}return!1}(e)||function(e){if(!i(e,"allroyalscaptured"))return!1;if(!r(e))return!1;const t=gamefileutility.getCountOfTypesFromPiecesByType(e.ourPieces,pieces.royals,e.whosTurn);if(0===t){if("white"===e.whosTurn)return"black allroyalscaptured";if("black"===e.whosTurn)return"white allroyalscaptured";throw new Error("Cannot determine winning color by wincondition allroyalscaptured!")}return!1}(e)||n(e)||function(e){if(!i(e,"koth"))return!1;const t=movesscript.getLastMove(e.moves);if(!t)return!1;if(!t.type.startsWith("kings"))return!1;let n=!1;for(let t=0;t{o||sound.getAudioContext()?.resume()}))}document.addEventListener("mousedown",t),document.addEventListener("click",t),async function(){const e=new AudioContext;let t;await fetch("/sounds/soundspritesheet.mp3").then((e=>e.arrayBuffer())).then((async n=>{await e.decodeAudioData(n,(function(e){t=e}))})).catch((e=>{console.error(`An error ocurred during loading of sounds: ${e.message}`),i()})),"complete"===document.readyState?function(){if(o)return;sound.initAudioContext(e,t),n=!0}():window.addEventListener("load",(()=>{o||(sound.initAudioContext(e,t),n=!0)}))}();let o=!1,d=!1;function i(e){if(e=e||window.event,o)return;o=!0;document.getElementById("loading-text").classList.add("hidden");const n=document.getElementById("loading-error"),t=document.getElementById("loading-error-text");n.classList.remove("hidden"),t.textContent=d?"Lost network.":"One or more resources failed to load. Please refresh.";const i=document.getElementById("loading-glow");i.classList.remove("loadingGlowAnimation"),i.classList.add("loading-glow-error")}function r(){console.log("Network connection lost"),d=!0,i()}function s(){console.log("Network connection regained"),d=!1,o&&window.location.reload()}return window.addEventListener("offline",r),window.addEventListener("online",s),window.addEventListener("load",(function(){o||(window.removeEventListener("offline",r),window.removeEventListener("online",s),main.start())})),Object.freeze({callback_LoadingError:i,removeOnerror:function(){this.onerror=null},hasUserGesturedAtleastOnce:function(){return e}})}(); \ No newline at end of file diff --git a/public/scripts/login.js b/public/scripts/login.js deleted file mode 100644 index cd82c4c37..000000000 --- a/public/scripts/login.js +++ /dev/null @@ -1 +0,0 @@ -const _0x12d292=_0x3f67;(function(_0x2a8ab5,_0x163b56){const _0x2d8aa9=_0x3f67,_0x24253e=_0x2a8ab5();while(!![]){try{const _0x23aa87=parseInt(_0x2d8aa9(0x1da))/0x1+-parseInt(_0x2d8aa9(0x1f2))/0x2+-parseInt(_0x2d8aa9(0x1dd))/0x3*(parseInt(_0x2d8aa9(0x1fa))/0x4)+parseInt(_0x2d8aa9(0x1ea))/0x5*(parseInt(_0x2d8aa9(0x202))/0x6)+-parseInt(_0x2d8aa9(0x208))/0x7*(parseInt(_0x2d8aa9(0x1f9))/0x8)+parseInt(_0x2d8aa9(0x1fc))/0x9+-parseInt(_0x2d8aa9(0x1f7))/0xa;if(_0x23aa87===_0x163b56)break;else _0x24253e['push'](_0x24253e['shift']());}catch(_0x28d305){_0x24253e['push'](_0x24253e['shift']());}}}(_0x361a,0xce121));const _0x4fc521=document[_0x12d292(0x1d1)](_0x12d292(0x1d0)),_0x3c8c4d=document['getElementById'](_0x12d292(0x1f4)),_0x2a9cad=document['getElementById']('submit');function _0x361a(){const _0x560a60=['click','username','getElementById','toLowerCase','get','redirectTo','length','className','unavailable','QPCJX','then','1229387IpZlhe','VXpYM','wjxNK','1130001PygQIL','forgot','input','odsgq','location','passwordinputline','loginerror','disabled','message','same-origin','error','remove','textContent','3865755QGCKRe','preventDefault','ready','cookie','pYnBd','zXaoO','addEventListener','/auth','1129824NrRIlG','forgothidden','password','split','forgotvisible','6106630tQEFlx','POST','8DJCGXr','8ZyxUjY','div','7118001bSdcuu','KBxlm','application/json','/member/','search','value','6dKNVIK','SoNrR','createElement','href','stringify','MJLrT','143171bsZIyA'];_0x361a=function(){return _0x560a60;};return _0x361a();}let _0x780267=undefined;const _0x43be9c=document[_0x12d292(0x1d1)](_0x12d292(0x1de));_0x4fc521[_0x12d292(0x1f0)](_0x12d292(0x1df),_0x1b09d8=>{const _0x41fe75=_0x12d292;_0x780267?.[_0x41fe75(0x1e8)](),_0x780267=undefined,_0x4c18a4(),_0x43be9c[_0x41fe75(0x1d6)]=_0x41fe75(0x1f3);}),_0x3c8c4d[_0x12d292(0x1f0)](_0x12d292(0x1df),_0x3d830d=>{const _0x15433c=_0x12d292;_0x780267?.[_0x15433c(0x1e8)](),_0x780267=undefined,_0x4c18a4(),_0x43be9c[_0x15433c(0x1d6)]=_0x15433c(0x1f3);}),_0x2a9cad['addEventListener'](_0x12d292(0x1cf),_0x276838=>{const _0x14f111=_0x12d292;_0x276838['preventDefault']();if(_0x4fc521[_0x14f111(0x201)]&&_0x3c8c4d['value']&&!_0x780267)_0x29e704(_0x4fc521['value'],_0x3c8c4d[_0x14f111(0x201)]);});const _0x29e704=(_0x5e5d6f,_0x2297ea)=>{const _0x3def08=_0x12d292;_0x2a9cad['disabled']=!![];let _0xa8df6f=![],_0xf9f9aa={'method':_0x3def08(0x1f8),'headers':{'Content-Type':_0x3def08(0x1fe)},'credentials':_0x3def08(0x1e6),'body':JSON[_0x3def08(0x206)]({'username':_0x5e5d6f,'password':_0x2297ea})};fetch(_0x3def08(0x1f1),_0xf9f9aa)['then'](_0xd7f949=>{const _0x5f0e64=_0x3def08;if(_0x5f0e64(0x1ef)===_0x5f0e64(0x203)){const _0x1040ee=_0x2cfdd5[_0x255d94][_0x5f0e64(0x1f5)]('=');if(_0x1040ee[0x0]===_0x5f0183)return _0x1040ee[0x1];}else{if(_0xd7f949['ok'])_0xa8df6f=!![];return _0xd7f949['json']();}})[_0x3def08(0x1d9)](_0x31f398=>{const _0x5e4e80=_0x3def08;if(_0x5e4e80(0x1d8)===_0x5e4e80(0x1d8)){if(_0xa8df6f){if(_0x5e4e80(0x1db)!=='VXpYM'){if(_0x28b62e){const _0x4393c3=_0x548962(_0x5e4e80(0x1d4));if(_0x4393c3)_0x2f60a4[_0x5e4e80(0x1e1)][_0x5e4e80(0x205)]=_0x4393c3;else _0x2f0095[_0x5e4e80(0x1e1)][_0x5e4e80(0x205)]=_0x5e4e80(0x1ff)+_0x31e80a[_0x5e4e80(0x1d2)]();}else!_0xf04bc8&&(_0x540f85(_0x5e4e80(0x1e3),_0x5e4e80(0x1e2)),_0xbffe2=_0x4f41f3[_0x5e4e80(0x1d1)]('loginerror'),_0x3f6f09[_0x5e4e80(0x1d6)]=_0x5e4e80(0x1f6)),_0xd2efe5(),_0x52d0f7[_0x5e4e80(0x1e9)]=_0x39fcbb['message'],_0x40546d[_0x5e4e80(0x1e4)]=![];}else{const _0x57a0a2=_0x2a768b(_0x5e4e80(0x1d4));if(_0x57a0a2)window[_0x5e4e80(0x1e1)][_0x5e4e80(0x205)]=_0x57a0a2;else window[_0x5e4e80(0x1e1)]['href']=_0x5e4e80(0x1ff)+_0x5e5d6f['toLowerCase']();}}else{if(_0x5e4e80(0x1fd)===_0x5e4e80(0x1fd))!_0x780267&&(_0x5e4e80(0x1ee)==='pYnBd'?(createErrorElement(_0x5e4e80(0x1e3),'passwordinputline'),_0x780267=document[_0x5e4e80(0x1d1)](_0x5e4e80(0x1e3)),_0x43be9c[_0x5e4e80(0x1d6)]=_0x5e4e80(0x1f6)):(_0x4a9a45?.[_0x5e4e80(0x1e8)](),_0xa5eb55=_0x57e5f5,_0x22d48f(),_0x31e18b['className']=_0x5e4e80(0x1f3))),_0x4c18a4(),_0x780267[_0x5e4e80(0x1e9)]=_0x31f398[_0x5e4e80(0x1e5)],_0x2a9cad['disabled']=![];else{const _0x331d21=_0x507c16(_0x5e4e80(0x1d4));if(_0x331d21)_0x3892cd[_0x5e4e80(0x1e1)]['href']=_0x331d21;else _0xc60265[_0x5e4e80(0x1e1)][_0x5e4e80(0x205)]=_0x5e4e80(0x1ff)+_0x35f9f1[_0x5e4e80(0x1d2)]();}}}else _0x4c53a6['className']=_0x5e4e80(0x1d7);});},_0x4c18a4=function(){const _0x41e42a=_0x12d292;if(!_0x4fc521[_0x41e42a(0x201)]||!_0x3c8c4d[_0x41e42a(0x201)]||_0x780267){if('coLsz'===_0x41e42a(0x1dc)){const _0xc2449d=_0x171834[_0x41e42a(0x1ed)]['split'](';\x20');for(let _0x3019ec=0x0;_0x3019ec<_0xc2449d[_0x41e42a(0x1d5)];_0x3019ec++){const _0x41e732=_0xc2449d[_0x3019ec]['split']('=');if(_0x41e732[0x0]===_0x3ef22a)return _0x41e732[0x1];}}else _0x2a9cad['className']=_0x41e42a(0x1d7);}else _0x41e42a(0x1e0)==='odsgq'?_0x2a9cad[_0x41e42a(0x1d6)]=_0x41e42a(0x1ec):(!_0xd7f523&&(_0x13e5b9(_0x41e42a(0x1e3),_0x41e42a(0x1e2)),_0x3c5004=_0x135f59[_0x41e42a(0x1d1)](_0x41e42a(0x1e3)),_0x5a5063[_0x41e42a(0x1d6)]='forgotvisible'),_0x3ea095(),_0x130149['textContent']=_0x318deb['message'],_0x4f4d63[_0x41e42a(0x1e4)]=![]);};createErrorElement=function(_0x22ff1b,_0x4550b0){const _0x21d04b=_0x12d292,_0x31704b=document[_0x21d04b(0x204)]('div');_0x31704b['className']='error',_0x31704b['id']=_0x22ff1b,document['getElementById'](_0x4550b0)['insertAdjacentElement']('afterend',_0x31704b);};function _0x1234f4(_0x4bd2e3){const _0x1b776a=_0x12d292,_0x42aa21=document[_0x1b776a(0x1ed)][_0x1b776a(0x1f5)](';\x20');for(let _0x1a35ff=0x0;_0x1a35ff<_0x42aa21[_0x1b776a(0x1d5)];_0x1a35ff++){if('qAftS'==='bqBde'){const _0x19e400=_0x1ec166[_0x1b776a(0x204)](_0x1b776a(0x1fb));_0x19e400['className']=_0x1b776a(0x1e7),_0x19e400['id']=_0x4b64b5,_0x1ef252[_0x1b776a(0x1d1)](_0x2405a4)['insertAdjacentElement']('afterend',_0x19e400);}else{const _0x10676f=_0x42aa21[_0x1a35ff][_0x1b776a(0x1f5)]('=');if(_0x10676f[0x0]===_0x4bd2e3){if(_0x1b776a(0x207)!==_0x1b776a(0x207)){_0xde32d3[_0x1b776a(0x1eb)]();if(_0x2a13b1[_0x1b776a(0x201)]&&_0x2d519c[_0x1b776a(0x201)]&&!_0x1028a6)_0x321900(_0x440d79['value'],_0x203e27['value']);}else return _0x10676f[0x1];}}}}function _0x3f67(_0x50d54b,_0x4c6125){const _0x361aab=_0x361a();return _0x3f67=function(_0x3f679,_0x13e1b0){_0x3f679=_0x3f679-0x1cf;let _0x41a442=_0x361aab[_0x3f679];return _0x41a442;},_0x3f67(_0x50d54b,_0x4c6125);}function _0x2a768b(_0x5ef2cc){const _0x2d421a=_0x12d292,_0x1235da=new URLSearchParams(window[_0x2d421a(0x1e1)][_0x2d421a(0x200)]);return _0x1235da[_0x2d421a(0x1d3)](_0x5ef2cc);} \ No newline at end of file diff --git a/public/scripts/member.js b/public/scripts/member.js deleted file mode 100644 index 8d42a8415..000000000 --- a/public/scripts/member.js +++ /dev/null @@ -1 +0,0 @@ -const _0x4de9f9=_0x4e49;(function(_0x262d0d,_0x40f698){const _0x41ae57=_0x4e49,_0x9cd0c3=_0x262d0d();while(!![]){try{const _0x2a0c69=parseInt(_0x41ae57(0x15f))/0x1*(-parseInt(_0x41ae57(0x163))/0x2)+parseInt(_0x41ae57(0x14e))/0x3*(parseInt(_0x41ae57(0x170))/0x4)+-parseInt(_0x41ae57(0x16a))/0x5*(-parseInt(_0x41ae57(0x143))/0x6)+parseInt(_0x41ae57(0x148))/0x7+-parseInt(_0x41ae57(0x13b))/0x8*(parseInt(_0x41ae57(0x161))/0x9)+-parseInt(_0x41ae57(0x160))/0xa+parseInt(_0x41ae57(0x154))/0xb;if(_0x2a0c69===_0x40f698)break;else _0x9cd0c3['push'](_0x9cd0c3['shift']());}catch(_0x49237e){_0x9cd0c3['push'](_0x9cd0c3['shift']());}}}(_0x4bb6,0x1e2a9));let _0xe091a6;const _0x546211=document['getElementById'](_0x4de9f9(0x126)),_0x293f11=document[_0x4de9f9(0x144)]('logintext'),_0x15f47d=document[_0x4de9f9(0x144)](_0x4de9f9(0x15d)),_0x15faa4=document[_0x4de9f9(0x144)](_0x4de9f9(0x129)),_0x3ca493=document[_0x4de9f9(0x144)]('verifyerror'),_0x2fd9fb=document[_0x4de9f9(0x144)](_0x4de9f9(0x13c)),_0x24caf4=document[_0x4de9f9(0x144)](_0x4de9f9(0x137));_0x24caf4['addEventListener'](_0x4de9f9(0x150),_0x57094b=>{_0x1cb2b3();});function _0x4e49(_0x5780a5,_0x23a9f8){const _0x4bb6d2=_0x4bb6();return _0x4e49=function(_0x4e4906,_0x52b523){_0x4e4906=_0x4e4906-0x11c;let _0xfc4f=_0x4bb6d2[_0x4e4906];return _0xfc4f;},_0x4e49(_0x5780a5,_0x23a9f8);}function _0x4bb6(){const _0x50de7a=['811850EdMMMB','130077Plmiwc','kbxQM','189574iUsgZg','seen','/member/','status','username','classList','ufGpK','5625csMEJD','elo','getComputedStyle','application/json','toLowerCase','message','80zAGeHu','/logout','Bearer\x20','verified','Authorization','VSGRu','KujIr','Log\x20Out','length','location','/send-email','loginlink','fwHHm','style','createaccounttext','className','Profile','currPage','padding-left','/refresh','setAttribute','/data','ZONWV','split','then','/401','innerWidth','adNBD','sendemail','log','resize','GMLcX','120gyowOG','verifyconfirm','getPropertyValue','NkHPX','/404','remove','TxICj','Logged\x20in','1002sAVaPW','getElementById','FgxDu','qJkop','/member/','354809StXIhv','same-origin','json','GwgMB','show-account-info','add','29487oGTXDc','TwJEg','click','href','email','textContent','893046cuuFhs','GET','getElementsByClassName','font-size','lMvXH','/500','member','token','hidden','createaccountlink','joined','1GJyCwX'];_0x4bb6=function(){return _0x50de7a;};return _0x4bb6();}const _0x4e9a0d=document[_0x4de9f9(0x156)]('member')[0x0],_0x3e2585=document['getElementById']('membername'),_0x48034b=document[_0x4de9f9(0x144)](_0x4de9f9(0x14c)),_0xa2f508=document[_0x4de9f9(0x144)]('accountinfo'),_0x282b81=document[_0x4de9f9(0x144)](_0x4de9f9(0x152)),_0x3da3ea=document[_0x4de9f9(0x144)]('change');let _0x28940d=![];const _0x1798e1=window[_0x4de9f9(0x124)]['href'][_0x4de9f9(0x132)]('/'),_0x547637=_0x1798e1[_0x1798e1[_0x4de9f9(0x123)]-0x1];_0x9e21a3();function _0x9e21a3(){const _0x12f6d8=_0x4de9f9;let _0x2933c0=![];fetch(_0x12f6d8(0x12e))['then'](_0x2c6b0a=>{const _0x476e5c=_0x12f6d8;if('VSGRu'!==_0x476e5c(0x120)){const _0x5da10f=_0x5cf3da(_0x1fa4d1[_0x476e5c(0x16c)](_0x32df97,null)['getPropertyValue'](_0x476e5c(0x12d)),0xa),_0x54e9cb=(_0x424866['innerWidth']-0xb9)*0.52;let _0xadf2c4=_0x54e9cb*(0x3/_0x2196bc[_0x476e5c(0x153)][_0x476e5c(0x123)]);const _0x208077=0x32;if(_0xadf2c4>_0x208077)_0xadf2c4=_0x208077;_0x6254b7['style'][_0x476e5c(0x157)]=_0xadf2c4+'px';}else{if(_0x2c6b0a['ok'])_0x2933c0=!![];return _0x2c6b0a['json']();}})[_0x12f6d8(0x133)](_0x50243d=>{const _0x25e1f7=_0x12f6d8;if('FgxDu'!==_0x25e1f7(0x145))_0xef1fc3[_0x25e1f7(0x124)]=_0x45105a[_0x25e1f7(0x124)];else{if(_0x2933c0){if(_0x25e1f7(0x13a)===_0x25e1f7(0x13a))console[_0x25e1f7(0x138)]('Logged\x20in'),_0xe091a6=_0x59c882(_0x25e1f7(0x15b)),_0x423547(_0x50243d[_0x25e1f7(0x15a)][_0x25e1f7(0x16e)]()),_0x546211['setAttribute']('href',_0x25e1f7(0x147)+_0x50243d[_0x25e1f7(0x15a)][_0x25e1f7(0x16e)]()),_0x293f11['textContent']=_0x25e1f7(0x12b),_0x15f47d['setAttribute'](_0x25e1f7(0x151),'/logout'),_0x15faa4['textContent']=_0x25e1f7(0x122);else{let _0x299acb={'method':_0x25e1f7(0x155),'headers':{'Content-Type':_0x25e1f7(0x16d)},'credentials':_0x25e1f7(0x149)};if(_0x4ca3e7)_0x299acb['headers'][_0x25e1f7(0x11f)]=_0x25e1f7(0x11d)+_0x41dfc7;_0x15e9ad('/member/'+_0x16712d+_0x25e1f7(0x130),_0x299acb)[_0x25e1f7(0x133)](_0x3a7dab=>{const _0x38f2ec=_0x25e1f7;if(_0x3a7dab[_0x38f2ec(0x166)]===0x194)_0x237e8a['location']=_0x38f2ec(0x13f);if(_0x3a7dab['status']===0x1f4)_0x357d60[_0x38f2ec(0x124)]=_0x38f2ec(0x159);return _0x3a7dab['json']();})[_0x25e1f7(0x133)](_0x4ebfb1=>{const _0x3c1a4e=_0x25e1f7;_0x2265ce[_0x3c1a4e(0x138)](_0x4ebfb1),_0x4bc8ae[_0x3c1a4e(0x153)]=_0x4ebfb1[_0x3c1a4e(0x167)];const _0x242871=_0xfc3ee1['getElementById'](_0x3c1a4e(0x16b));_0x242871[_0x3c1a4e(0x153)]=_0x4ebfb1[_0x3c1a4e(0x16b)];const _0x5cb39f=_0x19a562[_0x3c1a4e(0x144)](_0x3c1a4e(0x15e));_0x5cb39f[_0x3c1a4e(0x153)]=_0x4ebfb1[_0x3c1a4e(0x15e)];const _0x548651=_0x22b5d2[_0x3c1a4e(0x144)]('seen');_0x548651['textContent']=_0x4ebfb1[_0x3c1a4e(0x164)];if(_0x257449===_0x4ebfb1['username']['toLowerCase']()){_0x2daf73=!![],_0x16956b[_0x3c1a4e(0x12a)]=_0x3c1a4e(0x12c);if(_0x4ebfb1[_0x3c1a4e(0x11e)]===!![])_0x1a7849(_0x291330);else{if(_0x4ebfb1[_0x3c1a4e(0x11e)]===![])_0x44bf42(_0x2757f7);}_0xf5e7d4(_0x5c25e9),_0x4b28f4(_0x545a70),_0x5070f2[_0x3c1a4e(0x153)]=_0x4ebfb1[_0x3c1a4e(0x152)];}_0x465419();});}}else{if(_0x25e1f7(0x169)!==_0x25e1f7(0x169)){const _0x192f9a=_0x487c94[_0x182594][_0x25e1f7(0x132)]('=');if(_0x192f9a[0x0]===_0xc7ae51)return _0x192f9a[0x1];}else console[_0x25e1f7(0x138)](_0x50243d[_0x25e1f7(0x16f)]),_0x423547();}}});}function _0x423547(_0x5a2c70){const _0x141470=_0x4de9f9;let _0x10b3e0={'method':_0x141470(0x155),'headers':{'Content-Type':_0x141470(0x16d)},'credentials':_0x141470(0x149)};if(_0xe091a6)_0x10b3e0['headers'][_0x141470(0x11f)]='Bearer\x20'+_0xe091a6;fetch(_0x141470(0x165)+_0x547637+_0x141470(0x130),_0x10b3e0)['then'](_0x2323eb=>{const _0x2dd8c1=_0x141470;if('ZONWV'!==_0x2dd8c1(0x131)){if(!_0x54d5b1)return;let _0xe3ea24={'method':_0x2dd8c1(0x155),'headers':{'Content-Type':_0x2dd8c1(0x16d),'Authorization':_0x2dd8c1(0x11d)+_0x5c3d39},'credentials':'same-origin'};_0xdbd8fe('/member/'+_0x4c0685+_0x2dd8c1(0x125),_0xe3ea24)[_0x2dd8c1(0x133)](_0x1d1376=>{const _0x3ce476=_0x2dd8c1;if(_0x1d1376[_0x3ce476(0x166)]===0x191)_0x719c06['location']=_0x3ce476(0x134);return _0x1d1376[_0x3ce476(0x14a)]();})['then'](_0xd72ff1=>{const _0x1e4970=_0x2dd8c1;_0x1de473[_0x1e4970(0x124)]=_0xe56cfc[_0x1e4970(0x124)];});}else{if(_0x2323eb[_0x2dd8c1(0x166)]===0x194)window[_0x2dd8c1(0x124)]='/404';if(_0x2323eb[_0x2dd8c1(0x166)]===0x1f4)window[_0x2dd8c1(0x124)]='/500';return _0x2323eb[_0x2dd8c1(0x14a)]();}})[_0x141470(0x133)](_0x43d349=>{const _0x42b3f3=_0x141470;if(_0x42b3f3(0x14b)!=='tPGhJ'){console[_0x42b3f3(0x138)](_0x43d349),_0x3e2585[_0x42b3f3(0x153)]=_0x43d349['username'];const _0x57d961=document[_0x42b3f3(0x144)]('elo');_0x57d961['textContent']=_0x43d349['elo'];const _0x1ca9f1=document[_0x42b3f3(0x144)](_0x42b3f3(0x15e));_0x1ca9f1[_0x42b3f3(0x153)]=_0x43d349['joined'];const _0x54bea4=document[_0x42b3f3(0x144)](_0x42b3f3(0x164));_0x54bea4[_0x42b3f3(0x153)]=_0x43d349[_0x42b3f3(0x164)];if(_0x5a2c70===_0x43d349[_0x42b3f3(0x167)][_0x42b3f3(0x16e)]()){if(_0x42b3f3(0x13e)===_0x42b3f3(0x13e)){_0x28940d=!![],_0x293f11['className']=_0x42b3f3(0x12c);if(_0x43d349[_0x42b3f3(0x11e)]===!![])_0x4e5108(_0x2fd9fb);else{if(_0x43d349[_0x42b3f3(0x11e)]===![])_0x4e5108(_0x3ca493);}_0x4e5108(_0x48034b),_0x4e5108(_0x3da3ea),_0x282b81[_0x42b3f3(0x153)]=_0x43d349[_0x42b3f3(0x152)];}else _0x3e4752['classList'][_0x42b3f3(0x14d)](_0x42b3f3(0x15c));}_0x17b769();}else _0x4dece8();});}function showAccountInfo(){_0x1d01d2(_0x48034b),_0x4e5108(_0xa2f508);}function _0x1cb2b3(){const _0x32799a=_0x4de9f9;if(!_0x28940d)return;let _0x34ced3={'method':_0x32799a(0x155),'headers':{'Content-Type':_0x32799a(0x16d),'Authorization':'Bearer\x20'+_0xe091a6},'credentials':_0x32799a(0x149)};fetch('/member/'+_0x547637+_0x32799a(0x125),_0x34ced3)[_0x32799a(0x133)](_0x30f72a=>{const _0x38de3a=_0x32799a;if(_0x38de3a(0x14f)===_0x38de3a(0x136))_0x46d67b?(_0x3bad96[_0x38de3a(0x138)](_0x38de3a(0x142)),_0x3f4993=_0x519484('token'),_0xda61d3(_0xa328ad[_0x38de3a(0x15a)][_0x38de3a(0x16e)]()),_0x4e02ea['setAttribute'](_0x38de3a(0x151),_0x38de3a(0x147)+_0x5ca302[_0x38de3a(0x15a)][_0x38de3a(0x16e)]()),_0x5307d4['textContent']=_0x38de3a(0x12b),_0x580844[_0x38de3a(0x12f)](_0x38de3a(0x151),_0x38de3a(0x11c)),_0x1e8e87['textContent']='Log\x20Out'):(_0x1d7ba2[_0x38de3a(0x138)](_0x48e36c[_0x38de3a(0x16f)]),_0xcdb5c4());else{if(_0x30f72a[_0x38de3a(0x166)]===0x191)window[_0x38de3a(0x124)]=_0x38de3a(0x134);return _0x30f72a[_0x38de3a(0x14a)]();}})[_0x32799a(0x133)](_0x585b48=>{const _0x4a3b52=_0x32799a;if(_0x4a3b52(0x121)===_0x4a3b52(0x141)){if(_0x5a67eb['ok'])_0x459123=!![];return _0x45e8ff[_0x4a3b52(0x14a)]();}else window['location']=window[_0x4a3b52(0x124)];});}function _0x17b769(){const _0x4f661a=_0x4de9f9,_0x3de6bb=parseInt(window[_0x4f661a(0x16c)](_0x4e9a0d,null)[_0x4f661a(0x13d)](_0x4f661a(0x12d)),0xa),_0x56a331=(window[_0x4f661a(0x135)]-0xb9)*0.52;let _0x5db846=_0x56a331*(0x3/_0x3e2585['textContent'][_0x4f661a(0x123)]);const _0x3f700a=0x32;if(_0x5db846>_0x3f700a)_0x5db846=_0x3f700a;_0x3e2585[_0x4f661a(0x128)][_0x4f661a(0x157)]=_0x5db846+'px';}function _0x59c882(_0x5d3b6a){const _0x2a466e=_0x4de9f9,_0x431709=document['cookie'][_0x2a466e(0x132)](';\x20');for(let _0x2678c5=0x0;_0x2678c5<_0x431709[_0x2a466e(0x123)];_0x2678c5++){if(_0x2a466e(0x127)===_0x2a466e(0x158)){if(_0x4ccd0c[_0x2a466e(0x166)]===0x191)_0x490d31['location']=_0x2a466e(0x134);return _0x57845d[_0x2a466e(0x14a)]();}else{const _0x200c11=_0x431709[_0x2678c5]['split']('=');if(_0x200c11[0x0]===_0x5d3b6a){if(_0x2a466e(0x146)!==_0x2a466e(0x162))return _0x200c11[0x1];else _0x22330a[_0x2a466e(0x168)][_0x2a466e(0x140)](_0x2a466e(0x15c));}}}}function _0x1d01d2(_0x414764){const _0x14c22a=_0x4de9f9;_0x414764[_0x14c22a(0x168)][_0x14c22a(0x14d)](_0x14c22a(0x15c));}function _0x4e5108(_0x520965){const _0x31b1fb=_0x4de9f9;_0x520965[_0x31b1fb(0x168)][_0x31b1fb(0x140)]('hidden');}window['addEventListener'](_0x4de9f9(0x139),_0x24721a=>{_0x17b769();}); \ No newline at end of file diff --git a/public/scripts/memberHeader.js b/public/scripts/memberHeader.js deleted file mode 100644 index 509d970bf..000000000 --- a/public/scripts/memberHeader.js +++ /dev/null @@ -1 +0,0 @@ -'use strict';(function(_0x35c5c0,_0x3c1413){const _0x16943e=_0x39c9,_0x88a670=_0x35c5c0();while(!![]){try{const _0x12d2e0=parseInt(_0x16943e(0x190))/0x1*(-parseInt(_0x16943e(0x194))/0x2)+-parseInt(_0x16943e(0x1aa))/0x3+-parseInt(_0x16943e(0x181))/0x4+-parseInt(_0x16943e(0x198))/0x5*(parseInt(_0x16943e(0x183))/0x6)+-parseInt(_0x16943e(0x185))/0x7+-parseInt(_0x16943e(0x1a3))/0x8+parseInt(_0x16943e(0x18b))/0x9;if(_0x12d2e0===_0x3c1413)break;else _0x88a670['push'](_0x88a670['shift']());}catch(_0x33801c){_0x88a670['push'](_0x88a670['shift']());}}}(_0x697a,0xebcef));function _0x39c9(_0x2f7f1b,_0x1a5345){const _0x697a7b=_0x697a();return _0x39c9=function(_0x39c924,_0x3db322){_0x39c924=_0x39c924-0x17e;let _0x2acfb5=_0x697a7b[_0x39c924];return _0x2acfb5;},_0x39c9(_0x2f7f1b,_0x1a5345);}function _0x697a(){const _0x6f2e6a=['BMYza','/member/','/logout','SRLQm','hfyRU','5743512RmOKIF','member','log','freeze','Server:\x20','Error\x20occurred\x20during\x20refreshing\x20of\x20token:','then','Response\x20from\x20the\x20server\x20did\x20not\x20include\x20a\x20token!','sleep','1172416duYaaH','Logged\x20in','54hcPNUf','href','13412441FiZqDS','createaccountlink','error','caELJ','PSiuR','message','65371365AAdekD','json','toLowerCase','getElementById','oUYUU','27KSeRir','setAttribute','GHopE','split','98286CUXkqS','UqkQQ','cookie','now','19445HBbZzg','token','xoRbw','length','Log\x20Out','UqrdL','Profile','textContent','jwYTP','createaccounttext','qgxyn','6496648FAwvCu','/refresh'];_0x697a=function(){return _0x6f2e6a;};return _0x697a();}const _0x3617bc=(function(){const _0x3c9c96=_0x39c9,_0x55e2ec=0x3e8*0x3c*0xf,_0x370170=0x2710,_0x4a8069=0x3e8*0x3c*0x3c*0x18*0x7-0x3e8*0x3c*0x3c;let _0x296748=![],_0x36bb69,_0x270b71,_0x5bda9d,_0x2d5756=!![];const _0x48047e=document[_0x3c9c96(0x18e)]('loginlink'),_0x5454b8=document[_0x3c9c96(0x18e)]('logintext'),_0x4fba53=document['getElementById'](_0x3c9c96(0x186)),_0x29b990=document[_0x3c9c96(0x18e)](_0x3c9c96(0x1a1));function _0x125ba9(){const _0x2545bc=_0x3c9c96;if(_0x2545bc(0x1a9)===_0x2545bc(0x1a9))return _0x5bda9d;else{const _0x19308a=_0x524720[_0x44163e][_0x2545bc(0x193)]('=');if(_0x19308a[0x0]===_0x514dec)return _0x19308a[0x1];}}function _0x10d5fc(){const _0x2299f7=_0x3c9c96;if(_0x2299f7(0x19d)==='uTwDR')_0x5bf6b0[_0x2299f7(0x187)](_0x2299f7(0x1af),_0x26cd73),_0xc5913d=![];else return _0x2d5756;}async function _0x131a9b(){const _0x1dee85=_0x3c9c96;if('pUPXp'==='XysBB')_0x50058d[_0x1dee85(0x1ac)]('Server:\x20'+_0x58e55c['message']),_0x5b238a=![];else{while(_0x296748)await main[_0x1dee85(0x180)](0x64);const _0x40b7b0=Date[_0x1dee85(0x197)](),_0x4e4ebb=_0x40b7b0-_0x270b71;if(_0x36bb69&&_0x4e4ebb>_0x55e2ec-_0x370170)_0x36bb69=undefined;if(!_0x36bb69&&_0x2d5756)await _0x409b29();else{if(!_0x2d5756&&_0x4e4ebb>_0x4a8069)await _0x409b29();}return _0x36bb69;}}function _0x409b29(){const _0x1d155b=_0x3c9c96;if('VkIGB'===_0x1d155b(0x189))_0x28ab94=_0xa225df('token'),!_0x27d66b?_0x1131ca[_0x1d155b(0x187)]('Response\x20from\x20the\x20server\x20did\x20not\x20include\x20a\x20token!'):_0x3d6cd7[_0x1d155b(0x1ac)](_0x1d155b(0x182)),_0x1b7e38=_0x239907[_0x1d155b(0x1ab)],_0x80c4d4();else{_0x296748=!![];let _0x1763d2=![];fetch(_0x1d155b(0x1a4))[_0x1d155b(0x17e)](_0x16ac50=>{const _0x52dc28=_0x1d155b;return'UqkQQ'===_0x52dc28(0x195)?(_0x16ac50['ok']&&('jwYTP'!==_0x52dc28(0x1a0)?_0xa01698[_0x52dc28(0x187)](_0x52dc28(0x17f)):_0x1763d2=!![]),_0x16ac50[_0x52dc28(0x18c)]()):_0x468be3;})[_0x1d155b(0x17e)](_0x10e8d5=>{const _0x23b5be=_0x1d155b;if('BMYza'===_0x23b5be(0x1a5)){if(_0x1763d2){if('ZDQDG'!=='dXOuR'){_0x36bb69=_0x26f1d3(_0x23b5be(0x199));if(!_0x36bb69){if(_0x23b5be(0x1a2)===_0x23b5be(0x1a2))console[_0x23b5be(0x187)](_0x23b5be(0x17f));else{const _0x54ee1a=_0x4513d0[_0x23b5be(0x196)][_0x23b5be(0x193)](';\x20');for(let _0x575471=0x0;_0x575471<_0x54ee1a[_0x23b5be(0x19b)];_0x575471++){const _0x4698aa=_0x54ee1a[_0x575471][_0x23b5be(0x193)]('=');if(_0x4698aa[0x0]===_0x2416b5)return _0x4698aa[0x1];}}}else'caELJ'!==_0x23b5be(0x188)?_0x115d3b=!![]:console[_0x23b5be(0x1ac)](_0x23b5be(0x182));_0x5bda9d=_0x10e8d5[_0x23b5be(0x1ab)],_0x289652();}else return _0x3e58c5;}else _0x23b5be(0x18f)!==_0x23b5be(0x192)?(console[_0x23b5be(0x1ac)](_0x23b5be(0x1ae)+_0x10e8d5[_0x23b5be(0x18a)]),_0x2d5756=![]):_0x3536f1[_0x23b5be(0x1ac)](_0x23b5be(0x182));_0x270b71=Date['now'](),_0x296748=![];}else _0x19e732[_0x23b5be(0x191)]('href',_0x23b5be(0x1a6)+_0x30c5e8[_0x23b5be(0x18d)]()),_0x4f1159[_0x23b5be(0x19f)]=_0x23b5be(0x19e),_0x21c3ce[_0x23b5be(0x191)]('href',_0x23b5be(0x1a7)),_0x1e0538[_0x23b5be(0x19f)]=_0x23b5be(0x19c);})['catch'](_0x6b7a0a=>{const _0x316793=_0x1d155b;_0x316793(0x19a)!==_0x316793(0x19a)?_0x7df2ff=_0x8d8d42:(console[_0x316793(0x187)]('Error\x20occurred\x20during\x20refreshing\x20of\x20token:',_0x6b7a0a),_0x296748=![]);});}}function _0x289652(){const _0x567d86=_0x3c9c96;if(_0x567d86(0x1a8)!==_0x567d86(0x1a8))return _0x211f61['ok']&&(_0x5923b1=!![]),_0x4553bc[_0x567d86(0x18c)]();else _0x48047e['setAttribute']('href',_0x567d86(0x1a6)+_0x5bda9d['toLowerCase']()),_0x5454b8[_0x567d86(0x19f)]=_0x567d86(0x19e),_0x4fba53[_0x567d86(0x191)](_0x567d86(0x184),_0x567d86(0x1a7)),_0x29b990[_0x567d86(0x19f)]=_0x567d86(0x19c);}function _0x26f1d3(_0x2b9b5d){const _0x34ed2a=_0x3c9c96,_0x2eb542=document['cookie'][_0x34ed2a(0x193)](';\x20');for(let _0x25d529=0x0;_0x25d529<_0x2eb542[_0x34ed2a(0x19b)];_0x25d529++){const _0x3891f8=_0x2eb542[_0x25d529][_0x34ed2a(0x193)]('=');if(_0x3891f8[0x0]===_0x2b9b5d)return _0x3891f8[0x1];}}function _0x3f79a2(){_0x36bb69=undefined;}return _0x409b29(),Object[_0x3c9c96(0x1ad)]({'getAccessToken':_0x131a9b,'getMember':_0x125ba9,'getCookieValue':_0x26f1d3,'deleteToken':_0x3f79a2,'areWeLoggedIn':_0x10d5fc});}()); \ No newline at end of file diff --git a/public/css/404.css b/src/client/css/404.css similarity index 100% rename from public/css/404.css rename to src/client/css/404.css diff --git a/public/css/createaccount.css b/src/client/css/createaccount.css similarity index 100% rename from public/css/createaccount.css rename to src/client/css/createaccount.css diff --git a/public/css/credits.css b/src/client/css/credits.css similarity index 100% rename from public/css/credits.css rename to src/client/css/credits.css diff --git a/public/css/index.css b/src/client/css/index.css similarity index 100% rename from public/css/index.css rename to src/client/css/index.css diff --git a/public/css/login.css b/src/client/css/login.css similarity index 100% rename from public/css/login.css rename to src/client/css/login.css diff --git a/public/css/member.css b/src/client/css/member.css similarity index 100% rename from public/css/member.css rename to src/client/css/member.css diff --git a/public/css/news.css b/src/client/css/news.css similarity index 100% rename from public/css/news.css rename to src/client/css/news.css diff --git a/public/css/play.css b/src/client/css/play.css similarity index 100% rename from public/css/play.css rename to src/client/css/play.css diff --git a/public/css/termsofservice.css b/src/client/css/termsofservice.css similarity index 100% rename from public/css/termsofservice.css rename to src/client/css/termsofservice.css diff --git a/public/img/blank_board.png b/src/client/img/blank_board.png similarity index 100% rename from public/img/blank_board.png rename to src/client/img/blank_board.png diff --git a/resources/images/icons/Checkerboard (current)/favicon.png b/src/client/img/favicon.png similarity index 100% rename from resources/images/icons/Checkerboard (current)/favicon.png rename to src/client/img/favicon.png diff --git a/public/img/game/guide/arrowindicators.png b/src/client/img/game/guide/arrowindicators.png similarity index 100% rename from public/img/game/guide/arrowindicators.png rename to src/client/img/game/guide/arrowindicators.png diff --git a/public/img/game/guide/fairy/amazon.png b/src/client/img/game/guide/fairy/amazon.png similarity index 100% rename from public/img/game/guide/fairy/amazon.png rename to src/client/img/game/guide/fairy/amazon.png diff --git a/public/img/game/guide/fairy/archbishop.png b/src/client/img/game/guide/fairy/archbishop.png similarity index 100% rename from public/img/game/guide/fairy/archbishop.png rename to src/client/img/game/guide/fairy/archbishop.png diff --git a/public/img/game/guide/fairy/centaur.png b/src/client/img/game/guide/fairy/centaur.png similarity index 100% rename from public/img/game/guide/fairy/centaur.png rename to src/client/img/game/guide/fairy/centaur.png diff --git a/public/img/game/guide/fairy/chancellor.png b/src/client/img/game/guide/fairy/chancellor.png similarity index 100% rename from public/img/game/guide/fairy/chancellor.png rename to src/client/img/game/guide/fairy/chancellor.png diff --git a/public/img/game/guide/fairy/guard.png b/src/client/img/game/guide/fairy/guard.png similarity index 100% rename from public/img/game/guide/fairy/guard.png rename to src/client/img/game/guide/fairy/guard.png diff --git a/public/img/game/guide/fairy/hawk.png b/src/client/img/game/guide/fairy/hawk.png similarity index 100% rename from public/img/game/guide/fairy/hawk.png rename to src/client/img/game/guide/fairy/hawk.png diff --git a/public/img/game/guide/fairy/obstacle.png b/src/client/img/game/guide/fairy/obstacle.png similarity index 100% rename from public/img/game/guide/fairy/obstacle.png rename to src/client/img/game/guide/fairy/obstacle.png diff --git a/public/img/game/guide/fairy/void.png b/src/client/img/game/guide/fairy/void.png similarity index 100% rename from public/img/game/guide/fairy/void.png rename to src/client/img/game/guide/fairy/void.png diff --git a/public/img/game/guide/kingrookfork.png b/src/client/img/game/guide/kingrookfork.png similarity index 100% rename from public/img/game/guide/kingrookfork.png rename to src/client/img/game/guide/kingrookfork.png diff --git a/public/img/game/guide/promotionlines.png b/src/client/img/game/guide/promotionlines.png similarity index 100% rename from public/img/game/guide/promotionlines.png rename to src/client/img/game/guide/promotionlines.png diff --git a/public/img/game/promotions.png b/src/client/img/game/promotions.png similarity index 100% rename from public/img/game/promotions.png rename to src/client/img/game/promotions.png diff --git a/public/img/game/spritesheet64_cburnett.png b/src/client/img/game/spritesheet64_cburnett.png similarity index 100% rename from public/img/game/spritesheet64_cburnett.png rename to src/client/img/game/spritesheet64_cburnett.png diff --git a/public/img/game/tiles/tiles.png b/src/client/img/game/tiles/tiles.png similarity index 100% rename from public/img/game/tiles/tiles.png rename to src/client/img/game/tiles/tiles.png diff --git a/public/img/game/tiles/tiles256.png b/src/client/img/game/tiles/tiles256.png similarity index 100% rename from public/img/game/tiles/tiles256.png rename to src/client/img/game/tiles/tiles256.png diff --git a/public/img/game/tiles/tilesGrey78.png b/src/client/img/game/tiles/tilesGrey78.png similarity index 100% rename from public/img/game/tiles/tilesGrey78.png rename to src/client/img/game/tiles/tilesGrey78.png diff --git a/public/img/king_w.png b/src/client/img/king_w.png similarity index 100% rename from public/img/king_w.png rename to src/client/img/king_w.png diff --git a/public/img/member_default.png b/src/client/img/member_default.png similarity index 100% rename from public/img/member_default.png rename to src/client/img/member_default.png diff --git a/public/img/queen_w.png b/src/client/img/queen_w.png similarity index 100% rename from public/img/queen_w.png rename to src/client/img/queen_w.png diff --git a/protected-owner/scripts/createaccount.js b/src/client/scripts/createaccount.js similarity index 100% rename from protected-owner/scripts/createaccount.js rename to src/client/scripts/createaccount.js diff --git a/protected-owner/scripts/game/backcompatible.js b/src/client/scripts/game/chess/backcompatible.js similarity index 100% rename from protected-owner/scripts/game/backcompatible.js rename to src/client/scripts/game/chess/backcompatible.js diff --git a/protected-owner/scripts/game/browsersupport.js b/src/client/scripts/game/chess/browsersupport.js similarity index 100% rename from protected-owner/scripts/game/browsersupport.js rename to src/client/scripts/game/chess/browsersupport.js diff --git a/protected-owner/scripts/game/checkdetection.js b/src/client/scripts/game/chess/checkdetection.js similarity index 100% rename from protected-owner/scripts/game/checkdetection.js rename to src/client/scripts/game/chess/checkdetection.js diff --git a/protected-owner/scripts/game/clock.js b/src/client/scripts/game/chess/clock.js similarity index 100% rename from protected-owner/scripts/game/clock.js rename to src/client/scripts/game/chess/clock.js diff --git a/protected-owner/scripts/game/copypastegame.js b/src/client/scripts/game/chess/copypastegame.js similarity index 100% rename from protected-owner/scripts/game/copypastegame.js rename to src/client/scripts/game/chess/copypastegame.js diff --git a/protected-owner/scripts/game/formatconverter.js b/src/client/scripts/game/chess/formatconverter.js similarity index 100% rename from protected-owner/scripts/game/formatconverter.js rename to src/client/scripts/game/chess/formatconverter.js diff --git a/protected-owner/scripts/game/game.js b/src/client/scripts/game/chess/game.js similarity index 100% rename from protected-owner/scripts/game/game.js rename to src/client/scripts/game/chess/game.js diff --git a/protected-owner/scripts/game/gamefile.js b/src/client/scripts/game/chess/gamefile.js similarity index 100% rename from protected-owner/scripts/game/gamefile.js rename to src/client/scripts/game/chess/gamefile.js diff --git a/protected-owner/scripts/game/gamefileutility.js b/src/client/scripts/game/chess/gamefileutility.js similarity index 100% rename from protected-owner/scripts/game/gamefileutility.js rename to src/client/scripts/game/chess/gamefileutility.js diff --git a/protected-owner/scripts/game/insufficientmaterial.js b/src/client/scripts/game/chess/insufficientmaterial.js similarity index 100% rename from protected-owner/scripts/game/insufficientmaterial.js rename to src/client/scripts/game/chess/insufficientmaterial.js diff --git a/protected-owner/scripts/game/invites.js b/src/client/scripts/game/chess/invites.js similarity index 100% rename from protected-owner/scripts/game/invites.js rename to src/client/scripts/game/chess/invites.js diff --git a/protected-owner/scripts/game/legalmoves.js b/src/client/scripts/game/chess/legalmoves.js similarity index 100% rename from protected-owner/scripts/game/legalmoves.js rename to src/client/scripts/game/chess/legalmoves.js diff --git a/protected-owner/scripts/game/movepiece.js b/src/client/scripts/game/chess/movepiece.js similarity index 100% rename from protected-owner/scripts/game/movepiece.js rename to src/client/scripts/game/chess/movepiece.js diff --git a/protected-owner/scripts/game/movesets.js b/src/client/scripts/game/chess/movesets.js similarity index 100% rename from protected-owner/scripts/game/movesets.js rename to src/client/scripts/game/chess/movesets.js diff --git a/protected-owner/scripts/game/movesscript.js b/src/client/scripts/game/chess/movesscript.js similarity index 100% rename from protected-owner/scripts/game/movesscript.js rename to src/client/scripts/game/chess/movesscript.js diff --git a/protected-owner/scripts/game/onlinegame.js b/src/client/scripts/game/chess/onlinegame.js similarity index 100% rename from protected-owner/scripts/game/onlinegame.js rename to src/client/scripts/game/chess/onlinegame.js diff --git a/protected-owner/scripts/game/organizedlines.js b/src/client/scripts/game/chess/organizedlines.js similarity index 100% rename from protected-owner/scripts/game/organizedlines.js rename to src/client/scripts/game/chess/organizedlines.js diff --git a/protected-owner/scripts/game/pieces.js b/src/client/scripts/game/chess/pieces.js similarity index 100% rename from protected-owner/scripts/game/pieces.js rename to src/client/scripts/game/chess/pieces.js diff --git a/protected-owner/scripts/game/selection.js b/src/client/scripts/game/chess/selection.js similarity index 100% rename from protected-owner/scripts/game/selection.js rename to src/client/scripts/game/chess/selection.js diff --git a/protected-owner/scripts/game/specialdetect.js b/src/client/scripts/game/chess/specialdetect.js similarity index 100% rename from protected-owner/scripts/game/specialdetect.js rename to src/client/scripts/game/chess/specialdetect.js diff --git a/protected-owner/scripts/game/specialmove.js b/src/client/scripts/game/chess/specialmove.js similarity index 100% rename from protected-owner/scripts/game/specialmove.js rename to src/client/scripts/game/chess/specialmove.js diff --git a/protected-owner/scripts/game/specialundo.js b/src/client/scripts/game/chess/specialundo.js similarity index 100% rename from protected-owner/scripts/game/specialundo.js rename to src/client/scripts/game/chess/specialundo.js diff --git a/protected-owner/scripts/game/variant.js b/src/client/scripts/game/chess/variant.js similarity index 100% rename from protected-owner/scripts/game/variant.js rename to src/client/scripts/game/chess/variant.js diff --git a/protected-owner/scripts/game/variantomega.js b/src/client/scripts/game/chess/variantomega.js similarity index 100% rename from protected-owner/scripts/game/variantomega.js rename to src/client/scripts/game/chess/variantomega.js diff --git a/protected-owner/scripts/game/wincondition.js b/src/client/scripts/game/chess/wincondition.js similarity index 100% rename from protected-owner/scripts/game/wincondition.js rename to src/client/scripts/game/chess/wincondition.js diff --git a/protected-owner/scripts/game/camera.js b/src/client/scripts/game/display/camera.js similarity index 100% rename from protected-owner/scripts/game/camera.js rename to src/client/scripts/game/display/camera.js diff --git a/protected-owner/scripts/game/input.js b/src/client/scripts/game/display/input.js similarity index 100% rename from protected-owner/scripts/game/input.js rename to src/client/scripts/game/display/input.js diff --git a/protected-owner/scripts/game/main.js b/src/client/scripts/game/display/main.js similarity index 100% rename from protected-owner/scripts/game/main.js rename to src/client/scripts/game/display/main.js diff --git a/protected-owner/scripts/game/stats.js b/src/client/scripts/game/display/stats.js similarity index 100% rename from protected-owner/scripts/game/stats.js rename to src/client/scripts/game/display/stats.js diff --git a/protected-owner/scripts/game/websocket.js b/src/client/scripts/game/display/websocket.js similarity index 100% rename from protected-owner/scripts/game/websocket.js rename to src/client/scripts/game/display/websocket.js diff --git a/protected-owner/scripts/game/gui/gui.js b/src/client/scripts/game/gui/gui.js similarity index 100% rename from protected-owner/scripts/game/gui/gui.js rename to src/client/scripts/game/gui/gui.js diff --git a/protected-owner/scripts/game/gui/guigameinfo.js b/src/client/scripts/game/gui/guigameinfo.js similarity index 100% rename from protected-owner/scripts/game/gui/guigameinfo.js rename to src/client/scripts/game/gui/guigameinfo.js diff --git a/protected-owner/scripts/game/gui/guiguide.js b/src/client/scripts/game/gui/guiguide.js similarity index 100% rename from protected-owner/scripts/game/gui/guiguide.js rename to src/client/scripts/game/gui/guiguide.js diff --git a/protected-owner/scripts/game/gui/guiloading.js b/src/client/scripts/game/gui/guiloading.js similarity index 100% rename from protected-owner/scripts/game/gui/guiloading.js rename to src/client/scripts/game/gui/guiloading.js diff --git a/protected-owner/scripts/game/gui/guinavigation.js b/src/client/scripts/game/gui/guinavigation.js similarity index 100% rename from protected-owner/scripts/game/gui/guinavigation.js rename to src/client/scripts/game/gui/guinavigation.js diff --git a/protected-owner/scripts/game/gui/guipause.js b/src/client/scripts/game/gui/guipause.js similarity index 100% rename from protected-owner/scripts/game/gui/guipause.js rename to src/client/scripts/game/gui/guipause.js diff --git a/protected-owner/scripts/game/gui/guiplay.js b/src/client/scripts/game/gui/guiplay.js similarity index 100% rename from protected-owner/scripts/game/gui/guiplay.js rename to src/client/scripts/game/gui/guiplay.js diff --git a/protected-owner/scripts/game/gui/guipromotion.js b/src/client/scripts/game/gui/guipromotion.js similarity index 100% rename from protected-owner/scripts/game/gui/guipromotion.js rename to src/client/scripts/game/gui/guipromotion.js diff --git a/protected-owner/scripts/game/gui/guititle.js b/src/client/scripts/game/gui/guititle.js similarity index 100% rename from protected-owner/scripts/game/gui/guititle.js rename to src/client/scripts/game/gui/guititle.js diff --git a/protected-owner/scripts/game/gui/style.js b/src/client/scripts/game/gui/style.js similarity index 100% rename from protected-owner/scripts/game/gui/style.js rename to src/client/scripts/game/gui/style.js diff --git a/protected-owner/scripts/game/gui/tooltips.js b/src/client/scripts/game/gui/tooltips.js similarity index 100% rename from protected-owner/scripts/game/gui/tooltips.js rename to src/client/scripts/game/gui/tooltips.js diff --git a/protected-owner/scripts/game/jsconfig.json b/src/client/scripts/game/jsconfig.json similarity index 100% rename from protected-owner/scripts/game/jsconfig.json rename to src/client/scripts/game/jsconfig.json diff --git a/protected-owner/scripts/game/gl-matrix.js b/src/client/scripts/game/misc/gl-matrix.js similarity index 100% rename from protected-owner/scripts/game/gl-matrix.js rename to src/client/scripts/game/misc/gl-matrix.js diff --git a/protected-owner/scripts/game/htmlscript.js b/src/client/scripts/game/misc/htmlscript.js similarity index 100% rename from protected-owner/scripts/game/htmlscript.js rename to src/client/scripts/game/misc/htmlscript.js diff --git a/protected-owner/scripts/game/loadbalancer.js b/src/client/scripts/game/misc/loadbalancer.js similarity index 100% rename from protected-owner/scripts/game/loadbalancer.js rename to src/client/scripts/game/misc/loadbalancer.js diff --git a/protected-owner/scripts/game/localstorage.js b/src/client/scripts/game/misc/localstorage.js similarity index 100% rename from protected-owner/scripts/game/localstorage.js rename to src/client/scripts/game/misc/localstorage.js diff --git a/protected-owner/scripts/game/math.js b/src/client/scripts/game/misc/math.js similarity index 100% rename from protected-owner/scripts/game/math.js rename to src/client/scripts/game/misc/math.js diff --git a/protected-owner/scripts/game/sound.js b/src/client/scripts/game/misc/sound.js similarity index 100% rename from protected-owner/scripts/game/sound.js rename to src/client/scripts/game/misc/sound.js diff --git a/protected-owner/scripts/game/animation.js b/src/client/scripts/game/rendering/animation.js similarity index 100% rename from protected-owner/scripts/game/animation.js rename to src/client/scripts/game/rendering/animation.js diff --git a/protected-owner/scripts/game/area.js b/src/client/scripts/game/rendering/area.js similarity index 100% rename from protected-owner/scripts/game/area.js rename to src/client/scripts/game/rendering/area.js diff --git a/protected-owner/scripts/game/arrows.js b/src/client/scripts/game/rendering/arrows.js similarity index 100% rename from protected-owner/scripts/game/arrows.js rename to src/client/scripts/game/rendering/arrows.js diff --git a/protected-owner/scripts/game/board.js b/src/client/scripts/game/rendering/board.js similarity index 100% rename from protected-owner/scripts/game/board.js rename to src/client/scripts/game/rendering/board.js diff --git a/protected-owner/scripts/game/bufferdata.js b/src/client/scripts/game/rendering/bufferdata.js similarity index 100% rename from protected-owner/scripts/game/bufferdata.js rename to src/client/scripts/game/rendering/bufferdata.js diff --git a/protected-owner/scripts/game/buffermodel.js b/src/client/scripts/game/rendering/buffermodel.js similarity index 100% rename from protected-owner/scripts/game/buffermodel.js rename to src/client/scripts/game/rendering/buffermodel.js diff --git a/protected-owner/scripts/game/checkhighlight.js b/src/client/scripts/game/rendering/checkhighlight.js similarity index 100% rename from protected-owner/scripts/game/checkhighlight.js rename to src/client/scripts/game/rendering/checkhighlight.js diff --git a/protected-owner/scripts/game/coin.js b/src/client/scripts/game/rendering/coin.js similarity index 100% rename from protected-owner/scripts/game/coin.js rename to src/client/scripts/game/rendering/coin.js diff --git a/protected-owner/scripts/game/highlightline.js b/src/client/scripts/game/rendering/highlightline.js similarity index 100% rename from protected-owner/scripts/game/highlightline.js rename to src/client/scripts/game/rendering/highlightline.js diff --git a/protected-owner/scripts/game/highlights.js b/src/client/scripts/game/rendering/highlights.js similarity index 100% rename from protected-owner/scripts/game/highlights.js rename to src/client/scripts/game/rendering/highlights.js diff --git a/protected-owner/scripts/game/miniimage.js b/src/client/scripts/game/rendering/miniimage.js similarity index 100% rename from protected-owner/scripts/game/miniimage.js rename to src/client/scripts/game/rendering/miniimage.js diff --git a/protected-owner/scripts/game/movement.js b/src/client/scripts/game/rendering/movement.js similarity index 100% rename from protected-owner/scripts/game/movement.js rename to src/client/scripts/game/rendering/movement.js diff --git a/protected-owner/scripts/game/options.js b/src/client/scripts/game/rendering/options.js similarity index 100% rename from protected-owner/scripts/game/options.js rename to src/client/scripts/game/rendering/options.js diff --git a/protected-owner/scripts/game/perspective.js b/src/client/scripts/game/rendering/perspective.js similarity index 100% rename from protected-owner/scripts/game/perspective.js rename to src/client/scripts/game/rendering/perspective.js diff --git a/protected-owner/scripts/game/piecesmodel.js b/src/client/scripts/game/rendering/piecesmodel.js similarity index 100% rename from protected-owner/scripts/game/piecesmodel.js rename to src/client/scripts/game/rendering/piecesmodel.js diff --git a/protected-owner/scripts/game/promotionlines.js b/src/client/scripts/game/rendering/promotionlines.js similarity index 100% rename from protected-owner/scripts/game/promotionlines.js rename to src/client/scripts/game/rendering/promotionlines.js diff --git a/protected-owner/scripts/game/shaders.js b/src/client/scripts/game/rendering/shaders.js similarity index 100% rename from protected-owner/scripts/game/shaders.js rename to src/client/scripts/game/rendering/shaders.js diff --git a/protected-owner/scripts/game/statustext.js b/src/client/scripts/game/rendering/statustext.js similarity index 100% rename from protected-owner/scripts/game/statustext.js rename to src/client/scripts/game/rendering/statustext.js diff --git a/protected-owner/scripts/game/texture.js b/src/client/scripts/game/rendering/texture.js similarity index 100% rename from protected-owner/scripts/game/texture.js rename to src/client/scripts/game/rendering/texture.js diff --git a/protected-owner/scripts/game/transition.js b/src/client/scripts/game/rendering/transition.js similarity index 100% rename from protected-owner/scripts/game/transition.js rename to src/client/scripts/game/rendering/transition.js diff --git a/protected-owner/scripts/game/voids.js b/src/client/scripts/game/rendering/voids.js similarity index 100% rename from protected-owner/scripts/game/voids.js rename to src/client/scripts/game/rendering/voids.js diff --git a/protected-owner/scripts/game/webgl.js b/src/client/scripts/game/rendering/webgl.js similarity index 100% rename from protected-owner/scripts/game/webgl.js rename to src/client/scripts/game/rendering/webgl.js diff --git a/protected-owner/scripts/login.js b/src/client/scripts/login.js similarity index 100% rename from protected-owner/scripts/login.js rename to src/client/scripts/login.js diff --git a/protected-owner/scripts/member.js b/src/client/scripts/member.js similarity index 100% rename from protected-owner/scripts/member.js rename to src/client/scripts/member.js diff --git a/resources/scripts/memberHeader.js b/src/client/scripts/memberHeader.js similarity index 100% rename from resources/scripts/memberHeader.js rename to src/client/scripts/memberHeader.js diff --git a/protected-owner/scripts/game/validation.js b/src/client/scripts/validation.js similarity index 100% rename from protected-owner/scripts/game/validation.js rename to src/client/scripts/validation.js diff --git a/public/sounds/soundspritesheet.mp3 b/src/client/sounds/soundspritesheet.mp3 similarity index 100% rename from public/sounds/soundspritesheet.mp3 rename to src/client/sounds/soundspritesheet.mp3 diff --git a/views/createaccount.html b/src/client/views/createaccount.html similarity index 100% rename from views/createaccount.html rename to src/client/views/createaccount.html diff --git a/views/credits.html b/src/client/views/credits.html similarity index 100% rename from views/credits.html rename to src/client/views/credits.html diff --git a/views/errors/400.html b/src/client/views/errors/400.html similarity index 100% rename from views/errors/400.html rename to src/client/views/errors/400.html diff --git a/views/errors/401.html b/src/client/views/errors/401.html similarity index 100% rename from views/errors/401.html rename to src/client/views/errors/401.html diff --git a/views/errors/404.html b/src/client/views/errors/404.html similarity index 100% rename from views/errors/404.html rename to src/client/views/errors/404.html diff --git a/views/errors/409.html b/src/client/views/errors/409.html similarity index 100% rename from views/errors/409.html rename to src/client/views/errors/409.html diff --git a/views/errors/500.html b/src/client/views/errors/500.html similarity index 100% rename from views/errors/500.html rename to src/client/views/errors/500.html diff --git a/views/index.html b/src/client/views/index.html similarity index 100% rename from views/index.html rename to src/client/views/index.html diff --git a/views/login.html b/src/client/views/login.html similarity index 100% rename from views/login.html rename to src/client/views/login.html diff --git a/views/member.html b/src/client/views/member.html similarity index 100% rename from views/member.html rename to src/client/views/member.html diff --git a/views/news.html b/src/client/views/news.html similarity index 100% rename from views/news.html rename to src/client/views/news.html diff --git a/views/play.html b/src/client/views/play.html similarity index 76% rename from views/play.html rename to src/client/views/play.html index 014a8cdc1..f15dcf229 100644 --- a/views/play.html +++ b/src/client/views/play.html @@ -18,9 +18,147 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +