diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b0e3907 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +node_modules +npm-debug.log +.DS_Store diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d4fb281..0000000 --- a/.gitignore +++ /dev/null @@ -1,41 +0,0 @@ -# Prerequisites -*.d - -# Compiled Object files -*.slo -*.lo -*.o -*.obj - -# Precompiled Headers -*.gch -*.pch - -# Linker files -*.ilk - -# Debugger Files -*.pdb - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app - -# debug information files -*.dwo diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index adda5c0..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "frontend/public/assets/chess-pieces"] - path = frontend/public/assets/chess-pieces - url = git@github.com:Kadagaden/chess-pieces.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..80e273f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:18-alpine + +WORKDIR /app + +# Install deps first (cache) +COPY package.json package-lock.json* ./ +RUN npm install --production + +COPY . . + +EXPOSE 3000 +CMD ["npm", "start"] diff --git a/Makefile b/Makefile deleted file mode 100644 index 4bfe6d0..0000000 --- a/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -.PHONY: sync-frontend dev-sync - -all: docker sync-frontend dev-sync - -docker: - docker-compose -f deploy/docker-compose.dev.yml up --build -d - @echo "Frontend is running at http://localhost:3000" - @echo "Backend is running at http://localhost:4000" - -stop: - docker-compose -f deploy/docker-compose.dev.yml down - @echo "Stopped." - -restart: stop docker - -sync-frontend: - @echo "Syncing frontend source -> public for dev..." - @rsync -av --exclude node_modules --exclude .git --delete frontend/src/ frontend/public/src/ - -dev-sync: sync-frontend - @echo "Done. You can run 'make dev-sync' whenever you changed frontend/src files." - -.PHONY: dev-watch -dev-watch: - @echo "Watching frontend/src for changes (requires inotifywait). Press Ctrl-C to stop." - @which inotifywait > /dev/null || (echo "Please install inotify-tools (apt install inotify-tools)" && exit 1) - while inotifywait -e modify,create,delete -r frontend/src; do \ - $(MAKE) dev-sync; \ - done \ No newline at end of file diff --git a/README.dev.md b/README.dev.md deleted file mode 100644 index b6adf77..0000000 --- a/README.dev.md +++ /dev/null @@ -1,25 +0,0 @@ -Dev quickstart (mock backend + static frontend) - -From repo root run: - - cd deploy - docker-compose -f docker-compose.dev.yml up --build -d - -Then open http://localhost:3000 for the frontend. Backend API listens on http://localhost:4000 - -If you edit files under `frontend/src/` during development, run: - - make dev-sync - -This will copy changed files into `frontend/public/src/` so the static server (http://localhost:3000) serves the latest JS/CSS without rebuilding containers. - -Development workflow note -------------------------- - -Two strategies are supported during development to ensure the static server serves the latest frontend sources: - -- Symlink (used in this repo): `frontend/public/src/game.js` is a symbolic link to `../../src/game.js` so there's one source of truth. This avoids accidental drift between `src/` and `public/src/` when editing locally. Symlinks are convenient for local development but may not be appropriate for all deployment or CI environments. - -- Rsync / dev-sync: Run `make dev-sync` to copy files from `frontend/src/` into `frontend/public/src/`. This works in environments where symlinks are undesirable or when preparing files for containers. - -Choose the approach that fits your workflow. This repository currently keeps a regular copy of `game.js` in `frontend/public/src/` (to avoid symlink issues in containers/CI), and `make dev-sync` remains available as the recommended way to update the public copy during development. diff --git a/backend/Dockerfile b/backend/Dockerfile deleted file mode 100644 index 9df819b..0000000 --- a/backend/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:22-alpine -WORKDIR /app -COPY package.json package-lock.json* ./ -RUN npm ci --only=production || npm install --only=production -COPY . . -EXPOSE 4000 -CMD ["node","index.js"] diff --git a/backend/README.md b/backend/README.md deleted file mode 100644 index 4df24e8..0000000 --- a/backend/README.md +++ /dev/null @@ -1,16 +0,0 @@ -Backend mock for ChessNut (Express + Socket.IO) - -API endpoints: -- POST /api/create { name, pass } -- GET /api/list -- POST /api/join { id, pass } - -Socket.IO events: -- join-game (room name) -- move (payload includes gameId) - -Run locally: - - cd backend - npm install - node index.js diff --git a/backend/engine-loader.mjs b/backend/engine-loader.mjs deleted file mode 100644 index 9ad169a..0000000 --- a/backend/engine-loader.mjs +++ /dev/null @@ -1,29 +0,0 @@ -// Small ESM helper run by backend to instantiate engine GameState and print a minimal serialized view. -import fs from 'fs'; -import path from 'path'; - -async function main(){ - try{ - const enginePath = 'file:///app/engine/core/game_state.js'; - const mod = await import(enginePath); - const GameState = mod && (mod.default || mod.GameState); - if(typeof GameState !== 'function'){ - console.error(JSON.stringify({ ok:false, error: 'GameState not found in module', keys: Object.keys(mod||{}) })); - process.exit(2); - } - const gs = new GameState(); - // attempt a minimal serialization similar to server's serializeEngineState - let boardObj = (typeof gs.getBoard === 'function') ? gs.getBoard() : gs.board; - const w = (typeof boardObj.getWidth === 'function') ? boardObj.getWidth() : (boardObj.width || 8); - const h = (typeof boardObj.getHeight === 'function') ? boardObj.getHeight() : (boardObj.height || 8); - const board = Array.from({ length: h }, () => Array.from({ length: w }, () => null)); - // best-effort: leave board nulls—engine may have complex pieces - const out = { ok:true, width: w, height: h }; - console.log(JSON.stringify(out)); - }catch(e){ - console.error(JSON.stringify({ ok:false, error: (e && e.stack) || String(e) })); - process.exit(1); - } -} - -main(); diff --git a/backend/index.js b/backend/index.js deleted file mode 100644 index a96719e..0000000 --- a/backend/index.js +++ /dev/null @@ -1,511 +0,0 @@ -const express = require('express'); -const http = require('http'); -const { Server } = require('socket.io'); -const bodyParser = require('body-parser'); -const cors = require('cors'); - -const app = express(); -app.use(cors()); -app.use(bodyParser.json()); - -const fs = require('fs'); -const path = require('path'); -const LOGFILE = process.env.CHESSNUT_LOG || '/tmp/chessnut.log'; -function appendLogLine(line){ - try{ fs.appendFileSync(LOGFILE, line + '\n'); }catch(e){} -} -function log(){ - const ts = new Date().toISOString(); - const msg = Array.prototype.slice.call(arguments).map(x => (typeof x === 'string' ? x : JSON.stringify(x))).join(' '); - const line = `${ts} ${msg}`; - console.log(line); - appendLogLine(line); -} - -// Request logging middleware: logs method, path, small subset of headers and body -app.use((req, res, next) => { - try{ - const { method, path } = req; - const info = { method, path, headers: { origin: req.headers.origin, host: req.headers.host }, body: req.body }; - log('HTTP', info); - }catch(e){} - next(); -}); - -const server = http.createServer(app); -const io = new Server(server, { cors: { origin: '*' } }); - -const PORT = process.env.PORT || 4000; - -// simple in-memory storage (not persisted) -const games = []; -// map socket.id -> { gameId, playerId } -const socketMap = new Map(); -// map `${gameId}:${playerId}` -> timeoutId for pending disconnects -const pendingDisconnects = new Map(); - -function pdKey(gameId, playerId){ return `${gameId}:${playerId}`; } - -// Diagnostic helper: attempt to dynamically import the engine GameState module -async function tryImportEngine(){ - const candidates = []; - // common possibilities inside container /app - candidates.push(path.join(__dirname, 'engine', 'core', 'game_state.js')); - candidates.push(path.resolve(__dirname, '../engine/core/game_state.js')); - candidates.push('/app/engine/core/game_state.js'); - candidates.push('/engine/core/game_state.js'); - - const attemptErrors = {}; - for (const candidate of candidates) { - try { - const urlStr = 'file://' + candidate; - const mod = await import(urlStr); - log('tryImportEngine: import OK', { tried: candidate, keys: Object.keys(mod) }); - return { ok: true, mod, tried: candidate }; - } catch (e) { - attemptErrors[candidate] = (e && e.stack) || String(e); - } - } - - // if we get here, all attempts failed — gather snippets from likely engine dir(s) - const files = ['game_state.js','board.js','piece.js','cell.js']; - const snippets = {}; - const probeDirs = [path.join(__dirname, 'engine', 'core'), path.resolve(__dirname, '../engine/core'), '/app/engine/core', '/engine/core']; - for (const d of probeDirs) { - for (const f of files) { - const p = path.join(d, f); - try { const txt = fs.readFileSync(p, 'utf8'); snippets[p] = txt.slice(0, 2000); } catch(err) { snippets[p] = `read-failed: ${err && err.message}`; } - } - } - log('tryImportEngine: all attempts failed', { attempts: Object.keys(attemptErrors).length, attemptErrors: Object.keys(attemptErrors).reduce((acc,k)=>{acc[k]=attemptErrors[k].split('\n')[0];return acc;},{}) }); - try{ fs.writeFileSync('/tmp/chessnut-engine-import-error.log', JSON.stringify({ time: new Date().toISOString(), attemptErrors, snippets }, null, 2)); }catch(err){} - // try fallback by running engine-loader.mjs (ESM) via node - try{ - const loaderRes = await runEngineLoader(); - log('tryImportEngine: runEngineLoader result', { loaderRes }); - if(loaderRes && loaderRes.ok) return { ok: true, loader: loaderRes }; - }catch(e){ log('tryImportEngine: runEngineLoader failed', { err: e && e.stack || e }); } - - return { ok: false, error: attemptErrors, snippets }; -} - -// Fallback: try to run engine-loader.mjs via node (spawn) to let node use ESM loader -const { spawnSync } = require('child_process'); - -async function runEngineLoader(){ - try{ - const loaderPath = path.join(__dirname, 'engine-loader.mjs'); - const res = spawnSync('node', [loaderPath], { encoding: 'utf8', maxBuffer: 200000 }); - if(res.error){ return { ok:false, error: res.error.message }; } - if(res.status !== 0){ - return { ok:false, stdout: res.stdout, stderr: res.stderr, status: res.status }; - } - try{ const j = JSON.parse(res.stdout || '{}'); return { ok:true, result: j, raw: res.stdout }; }catch(e){ return { ok:true, raw: res.stdout }; } - }catch(e){ return { ok:false, error: e && e.stack }; } -} - -app.post('/api/create', (req, res) => { - console.log('[backend] POST /api/create received', req.body && { name: req.body.name, owner: req.body.ownerNickname }); - const id = 'game-' + Math.random().toString(36).slice(2,9); - const { name, pass, ownerNickname, ownerColorChoice } = req.body || {}; - const g = { - id, - name: name || id, - pass: pass || null, - created: Date.now(), - players: [], - started: false, - options: { startWhenTwo: true } - }; - // add owner as first player if provided - let ownerPlayer = null; - if(ownerNickname){ - ownerPlayer = { id: 'p-' + Math.random().toString(36).slice(2,6), nickname: ownerNickname, colorChoice: ownerColorChoice || 'random', colorAssigned: null }; - g.players.push(ownerPlayer); - // explicit owner id for robust ownership checks - g.ownerId = ownerPlayer.id; - } - games.push(g); - io.emit('games-list', games); - // return game and owner player if present so frontend can persist player id - if(ownerPlayer) return res.json({ ok: true, game: g, player: ownerPlayer }); - res.json({ ok: true, game: g }); -}); - -app.get('/api/list', (req, res) => { - // remove any orphan games (no players) - for (let i = games.length - 1; i >= 0; i--) { - const g = games[i]; - if(!g.players || g.players.length === 0){ - games.splice(i, 1); - } - } - res.json(games); -}); - -// remove previously created test games (names used during local testing) -app.post('/api/cleanup-tests', (req, res) => { - const patterns = [/^test$/i, /^curl-test$/i, /^start-test$/i]; - const before = games.length; - for (let i = games.length - 1; i >= 0; i--) { - const g = games[i]; - if (patterns.some(p => p.test(g.name))) { - games.splice(i, 1); - } - } - const removed = before - games.length; - io.emit('games-list', games); - res.json({ ok: true, removed }); -}); - -function pruneOrphans(){ - let removed = 0; - for (let i = games.length - 1; i >= 0; i--) { - const g = games[i]; - if(!g.players || g.players.length === 0){ games.splice(i,1); removed++; } - } - if(removed) io.emit('games-list', games); - return removed; -} - -// allow manual prune via api for dev -app.post('/api/prune-orphans', (req, res) => { - const removed = pruneOrphans(); - res.json({ ok: true, removed }); -}); - -// dev helper: delete game(s) by exact name -app.post('/api/delete-by-name', (req, res) => { - const { name } = req.body || {}; - if(!name) return res.status(400).json({ error: 'name required' }); - const before = games.length; - for (let i = games.length - 1; i >= 0; i--) { - if (games[i].name === name) games.splice(i,1); - } - const removed = before - games.length; - if(removed) io.emit('games-list', games); - res.json({ ok: true, removed }); -}); - -// dev helper: delete a game by id -app.post('/api/delete-by-id', (req, res) => { - const { id } = req.body || {}; - if(!id) return res.status(400).json({ error: 'id required' }); - const idx = games.findIndex(g => g.id === id); - if(idx === -1) return res.status(404).json({ error: 'not found' }); - games.splice(idx, 1); - io.emit('games-list', games); - res.json({ ok: true, removed: 1 }); -}); - -// periodic prune every minute -setInterval(() => { pruneOrphans(); }, 60 * 1000); - -app.post('/api/join', (req, res) => { - const { id, pass, nickname, colorChoice } = req.body || {}; - const g = games.find(x => x.id === id); - if(!g) { - // log current games snapshot to help debugging - try{ - const snapshot = games.map(x => ({ id: x.id, name: x.name, players: (x.players||[]).length, started: !!x.started })); - log('start failed - game not found', { requestedId: id, gamesSnapshot: snapshot }); - }catch(e){ log('start failed - game not found (and failed to snapshot)'); } - return res.status(404).json({ error: 'not found' }); - } - if(g.pass && g.pass !== pass) return res.status(403).json({ error: 'bad password' }); - if(g.players.length >= 2) return res.status(403).json({ error: 'full' }); - const player = { id: 'p-' + Math.random().toString(36).slice(2,6), nickname: nickname || 'Anon', colorChoice: colorChoice || 'random', colorAssigned: null }; - player.connected = true; - g.players.push(player); - io.to(g.id).emit('player-update', g); - io.emit('games-list', games); - res.json({ ok: true, game: g, player }); -}); - -// leave a game: payload { gameId, playerId } -app.post('/api/leave', (req, res) => { - const { gameId, playerId } = req.body || {}; - const gIndex = games.findIndex(x => x.id === gameId); - if(gIndex === -1) return res.status(404).json({ error: 'not found' }); - const g = games[gIndex]; - const pIndex = g.players.findIndex(p => p.id === playerId); - if(pIndex === -1) return res.status(404).json({ error: 'player not in game' }); - // do not allow leaving once game started - if (g.started) return res.status(403).json({ error: 'game in progress' }); - // remove player (allowed only if game not started) - const leaving = g.players.splice(pIndex, 1)[0]; - // clear any pending disconnect timer for this player - const key = pdKey(gameId, playerId); - if(pendingDisconnects.has(key)){ clearTimeout(pendingDisconnects.get(key)); pendingDisconnects.delete(key); } - // if the leaving player was the owner, remove the entire game - if(g.ownerId && leaving.id === g.ownerId){ - games.splice(gIndex, 1); - io.emit('games-list', games); - io.to(gameId).emit('game-deleted', { gameId }); - return res.json({ ok: true, deleted: true }); - } - io.to(gameId).emit('player-update', g); - io.emit('games-list', games); - res.json({ ok: true, game: g }); -}); - -app.get('/api/game/:id', (req, res) => { - const id = req.params.id; - const g = games.find(x => x.id === id); - if(!g) return res.status(404).json({ error: 'not found' }); - // if game exists but has no players, treat as not found and remove it - if(!g.players || g.players.length === 0){ - // only prune if game has not started - if (!g.started) { - const idx = games.findIndex(x => x.id === id); - if(idx !== -1) games.splice(idx, 1); - return res.status(404).json({ error: 'not found' }); - } - } - res.json(g); -}); - -app.post('/api/start', async (req, res) => { - const { id } = req.body || {}; - log('POST /api/start', { id, body: req.body }); - const g = games.find(x => x.id === id); - if(!g) return res.status(404).json({ error: 'not found' }); - if(g.players.length < 2) { - log('start rejected: need 2 players', { gameId: id, players: g.players.map(p=>p.id) }); - return res.status(400).json({ error: 'need 2 players' }); - } - // assign colors - const p0 = g.players[0]; - const p1 = g.players[1]; - function assign(){ - // if one chose white and other chose black, honor - if(p0.colorChoice === 'white' && p1.colorChoice === 'black'){ p0.colorAssigned = 'white'; p1.colorAssigned = 'black'; return; } - if(p0.colorChoice === 'black' && p1.colorChoice === 'white'){ p0.colorAssigned = 'black'; p1.colorAssigned = 'white'; return; } - // if one fixed and other random, honor fixed - if(p0.colorChoice === 'white' || p0.colorChoice === 'black'){ p0.colorAssigned = p0.colorChoice; p1.colorAssigned = (p0.colorChoice === 'white' ? 'black' : 'white'); return; } - if(p1.colorChoice === 'white' || p1.colorChoice === 'black'){ p1.colorAssigned = p1.colorChoice; p0.colorAssigned = (p1.colorChoice === 'white' ? 'black' : 'white'); return; } - // otherwise random - if(Math.random() < 0.5){ p0.colorAssigned = 'white'; p1.colorAssigned = 'black'; } else { p0.colorAssigned = 'black'; p1.colorAssigned = 'white'; } - } - assign(); - // Safety: if both players somehow received the same color (bug/regression), force distinct colors - try{ - if (p0.colorAssigned && p1.colorAssigned && p0.colorAssigned === p1.colorAssigned) { - log('api/start: duplicate colorAssigned detected, forcing distinct assignment', { gameId: g.id, p0: p0.id, p1: p1.id, current: p0.colorAssigned }); - p0.colorAssigned = 'white'; - p1.colorAssigned = 'black'; - } - }catch(e){ log('api/start: safety assignment check failed', { err: e && e.stack }); } - // Notify clients about players/colors immediately - try{ io.to(g.id).emit('player-update', g); }catch(e){ log('failed to emit player-update after assign', { err: e && e.stack }); } - g.started = true; - // Initialize a minimal game.state to be consumed by frontend. - // We avoid importing engine/ here: state is a plain JS structure describing the board. - // Board is an 8x8 array of cells; each cell is either null or { color: 'white'|'black', type: 'PAWN'|'ROOK'|... } - function initialState() { - const w = 8, h = 8; - const board = Array.from({ length: h }, () => Array.from({ length: w }, () => null)); - // pawns - for (let x = 0; x < w; x++) { - board[1][x] = { color: 'white', type: 'PAWN' }; - board[6][x] = { color: 'black', type: 'PAWN' }; - } - // rooks - board[0][0] = { color: 'white', type: 'ROOK' }; - board[0][7] = { color: 'white', type: 'ROOK' }; - board[7][0] = { color: 'black', type: 'ROOK' }; - board[7][7] = { color: 'black', type: 'ROOK' }; - // knights - board[0][1] = { color: 'white', type: 'KNIGHT' }; - board[0][6] = { color: 'white', type: 'KNIGHT' }; - board[7][1] = { color: 'black', type: 'KNIGHT' }; - board[7][6] = { color: 'black', type: 'KNIGHT' }; - // bishops - board[0][2] = { color: 'white', type: 'BISHOP' }; - board[0][5] = { color: 'white', type: 'BISHOP' }; - board[7][2] = { color: 'black', type: 'BISHOP' }; - board[7][5] = { color: 'black', type: 'BISHOP' }; - // queen/king - board[0][3] = { color: 'white', type: 'QUEEN' }; - board[0][4] = { color: 'white', type: 'KING' }; - board[7][3] = { color: 'black', type: 'QUEEN' }; - board[7][4] = { color: 'black', type: 'KING' }; - - return { board, width: w, height: h }; - } - - // only initialize if not already present - if (!g.state) { - // attempt to import engine GameState for richer state; on failure we log diagnostics - const importResult = await tryImportEngine(); - if (importResult.ok) { - try { - const GameState = importResult.mod && (importResult.mod.default || importResult.mod.GameState); - if (typeof GameState === 'function') { - const gs = new GameState(); - g._engineState = gs; - // best-effort serialize engine board into plain structure - try{ - const serialized = (typeof gs.getBoard === 'function') ? (function(){ - const boardObj = gs.getBoard(); - const w = (typeof boardObj.getWidth === 'function') ? boardObj.getWidth() : (boardObj.width || 8); - const h = (typeof boardObj.getHeight === 'function') ? boardObj.getHeight() : (boardObj.height || 8); - const board = Array.from({ length: h }, (v, y) => Array.from({ length: w }, (v2, x) => { - try { - const cell = (typeof boardObj.getCell === 'function') ? boardObj.getCell(x, y) : (boardObj.grid && boardObj.grid[y] && boardObj.grid[y][x]); - if (!cell || !cell.piece) return null; - const p = cell.piece; - const color = (typeof p.getColor === 'function' ? p.getColor() : p.color) || p.color; - const type = (typeof p.getType === 'function' ? p.getType() : p.type) || p.type; - return { color: String(color).toLowerCase(), type: String(type).toUpperCase() }; - } catch (e) { return null; } - })); - return { board, width: w, height: h }; - })() : null; - g.state = serialized || initialState(); - }catch(e){ log('engine serialization failed, falling back', { err: e && e.stack }); g.state = initialState(); } - } else { - log('imported engine module does not expose GameState constructor, falling back to plain state'); - g.state = initialState(); - } - } catch(e){ log('failed to instantiate GameState, falling back', { err: e && e.stack }); g.state = initialState(); } - } else { - // engine import failed: do NOT abort. Use the plain initial state so server continues to work - log('api/start: engine import failed, falling back to plain initialState', { gameId: g.id, diagnostic: importResult }); - g.state = initialState(); - } - } - // set initial turn: white starts - g.turn = 'white'; - log('start succeeded', { gameId: g.id, players: g.players.map(p => ({ id: p.id, nickname: p.nickname, colorAssigned: p.colorAssigned })) }); - io.to(g.id).emit('game-start', g); - io.emit('games-list', games); - res.json({ ok: true, game: g }); -}); - -io.on('connection', (socket) => { - log('socket connected', { socketId: socket.id, remote: socket.handshake && socket.handshake.address }); - socket.on('join-game', (gameId) => { - const room = gameId; - socket.join(room); - log('join-game', { socketId: socket.id, room }); - }); - // client can identify which player it is in a game so server can map socket -> player - socket.on('identify', (payload) => { - try { - const { gameId, playerId } = payload || {}; - if(gameId && playerId){ - socketMap.set(socket.id, { gameId, playerId }); - log('identify', { socketId: socket.id, gameId, playerId }); - // if this player had a pending disconnect timer, cancel it and mark reconnected - const key = pdKey(gameId, playerId); - if(pendingDisconnects.has(key)){ - clearTimeout(pendingDisconnects.get(key)); - pendingDisconnects.delete(key); - // mark player as connected again and notify others - const g = games.find(x => x.id === gameId); - if(g){ - const p = g.players.find(p => p.id === playerId); - if(p){ p.connected = true; io.to(gameId).emit('player-update', g); io.emit('games-list', games); } - } - } - } - }catch(e){ } - }); - socket.on('move', (payload) => { - try { - log('socket move', { socketId: socket.id, payload }); - const { gameId, playerId, from, to } = payload || {}; - const g = games.find(x => x.id === gameId); - if (!g) return; - - // basic validation: must be started and it must be the player's turn - if (!g.started) return; - - const player = g.players.find(p => p.id === playerId); - if (!player) return; - // determine player's color - const color = player.colorAssigned || (player.colorChoice === 'white' ? 'white' : (player.colorChoice === 'black' ? 'black' : null)); - // if no assigned color (random choice), try to infer from players array - if (!color) { - if (g.players[0] && g.players[1]) { - // if not assigned, assume assignment as in /api/start logic - // fallback: first player white - } - } - - // ensure it is this player's turn (simple toggle 'white'/'black') - if (g.turn && color && g.turn !== color) { - // not this player's turn - socket.emit('error', { error: 'not your turn' }); - return; - } - - // bounds check and cell existence - const h = g.state.height || g.state.board.length; - const w = g.state.width || (g.state.board[0] && g.state.board[0].length) || 8; - if (!from || !to) return; - if (from.x < 0 || from.x >= w || from.y < 0 || from.y >= h) return; - if (to.x < 0 || to.x >= w || to.y < 0 || to.y >= h) return; - - const src = g.state.board[from.y][from.x]; - if (!src) return; // no piece at source - if (src.color !== color) { socket.emit('error', { error: 'not your piece' }); return; } - - // naive move apply: move piece from src to dest (no legality checks beyond ownership) - const dst = g.state.board[to.y][to.x]; - // apply - g.state.board[to.y][to.x] = src; - g.state.board[from.y][from.x] = null; - - // toggle turn - g.turn = g.turn === 'white' ? 'black' : 'white'; - - io.to(gameId).emit('move', { gameId, playerId, from, to }); - io.to(gameId).emit('game-state', g.state); - } catch (e) { - console.error('move handler error', e && e.stack); - } - }); - - socket.on('disconnect', (reason) => { - const meta = socketMap.get(socket.id); - log('socket disconnect', { socketId: socket.id, reason, meta }); - if(!meta) return; - const { gameId, playerId } = meta; - // remove mapping for this socket immediately - socketMap.delete(socket.id); - // schedule a delayed removal: if the player doesn't reconnect within 3s, consider them left - const key = pdKey(gameId, playerId); - if(pendingDisconnects.has(key)){ - clearTimeout(pendingDisconnects.get(key)); - pendingDisconnects.delete(key); - } - const t = setTimeout(() => { - // perform removal after grace period - const gIndex = games.findIndex(x => x.id === gameId); - if(gIndex === -1){ pendingDisconnects.delete(key); return; } - const g = games[gIndex]; - const pIndex = g.players.findIndex(p => p.id === playerId); - if(pIndex === -1){ pendingDisconnects.delete(key); return; } - const player = g.players[pIndex]; - // remove player regardless of started state (user asked players away >3s are considered left) - const leaving = g.players.splice(pIndex, 1)[0]; - log('delayed remove player', { gameId, playerId: leaving.id, owner: g.ownerId }); - // if owner left, remove entire game immediately - if(g.ownerId && leaving.id === g.ownerId){ - games.splice(gIndex, 1); - io.emit('games-list', games); - io.to(gameId).emit('game-deleted', { gameId }); - pendingDisconnects.delete(key); - return; - } - io.to(gameId).emit('player-update', g); - io.emit('games-list', games); - pendingDisconnects.delete(key); - }, 3000); - pendingDisconnects.set(key, t); - }); -}); - -server.listen(PORT, () => console.log(`backend listening ${PORT}`)); diff --git a/backend/node_modules/@types/node/globals.typedarray.d.ts b/backend/node_modules/@types/node/globals.typedarray.d.ts deleted file mode 100644 index 6d5c952..0000000 --- a/backend/node_modules/@types/node/globals.typedarray.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export {}; // Make this a module - -declare global { - namespace NodeJS { - type TypedArray = - | Uint8Array - | Uint8ClampedArray - | Uint16Array - | Uint32Array - | Int8Array - | Int16Array - | Int32Array - | BigUint64Array - | BigInt64Array - | Float16Array - | Float32Array - | Float64Array; - type ArrayBufferView = - | TypedArray - | DataView; - } -} diff --git a/backend/node_modules/@types/node/ts5.6/globals.typedarray.d.ts b/backend/node_modules/@types/node/ts5.6/globals.typedarray.d.ts deleted file mode 100644 index 255e204..0000000 --- a/backend/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -export {}; // Make this a module - -declare global { - namespace NodeJS { - type TypedArray = - | Uint8Array - | Uint8ClampedArray - | Uint16Array - | Uint32Array - | Int8Array - | Int16Array - | Int32Array - | BigUint64Array - | BigInt64Array - | Float16Array - | Float32Array - | Float64Array; - type ArrayBufferView = TypedArray | DataView; - } -} diff --git a/backend/package.json b/backend/package.json deleted file mode 100644 index a582349..0000000 --- a/backend/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "chessnut-backend", - "version": "0.1.0", - "private": true, - "scripts": { - "start": "node index.js", - "dev": "NODE_ENV=development node index.js" - }, - "dependencies": { - "cors": "^2.8.5", - "express": "^4.18.2", - "socket.io": "^4.7.1", - "body-parser": "^1.20.2" - } -} diff --git a/backend/test-import-engine.mjs b/backend/test-import-engine.mjs deleted file mode 100644 index a76c943..0000000 --- a/backend/test-import-engine.mjs +++ /dev/null @@ -1,33 +0,0 @@ -import fs from 'fs'; -import path from 'path'; -import url from 'url'; - -(async function(){ - const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); - const p = path.resolve(__dirname, '../engine/core/game_state.js'); - console.log('Trying to load:', p); - try{ - const content = fs.readFileSync(p, 'utf8'); - console.log('File exists, first 200 chars:\n', content.slice(0,200)); - }catch(e){ console.error('Cannot read file', e && e.message); } - - try{ - console.log('\nAttempting dynamic import() with file:// path...'); - const mod = await import('file://' + p); - console.log('Imported module keys:', Object.keys(mod)); - console.log('Default export type:', typeof mod.default); - }catch(e){ - console.error('import(file://) failed:'); - console.error(e && e.stack || e); - } - - try{ - console.log('\nAttempting import with relative path from backend:'); - const mod2 = await import('../engine/core/game_state.js'); - console.log('Imported module keys (rel):', Object.keys(mod2)); - console.log('Default export type (rel):', typeof mod2.default); - }catch(e){ - console.error('relative import failed:'); - console.error(e && e.stack || e); - } -})(); \ No newline at end of file diff --git a/deploy/docker-compose.dev.yml b/deploy/docker-compose.dev.yml deleted file mode 100644 index 7ce5f85..0000000 --- a/deploy/docker-compose.dev.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: '3.8' -services: - backend: - build: ../backend - ports: - - '4000:4000' - volumes: - - ../backend:/app - - ../engine:/app/engine - - frontend: - image: nginx:stable-alpine - ports: - - '3000:80' - volumes: - - ../frontend/public:/usr/share/nginx/html:ro diff --git a/engine/core/board.js b/engine/core/board.js deleted file mode 100644 index 3883fe0..0000000 --- a/engine/core/board.js +++ /dev/null @@ -1,67 +0,0 @@ -import Cell from './cell.js'; -import * as Movement from './movement/index.js'; -import Piece, { PieceColor, PieceType } from './piece.js'; - -/** - * Represents the game board. - */ -class Board { - /** - * @param {number} width - * @param {number} height - */ - constructor(width, height) { - /** @type {number} */ - this.width = width; - /** @type {number} */ - this.height = height; - /** @type {Cell[][]} */ - this.grid = Array.from({ length: height }, () => Array.from({ length: width }, () => new Cell())); - - this.setupInitialPieces(); - } - - /** - * @param {number} x - * @param {number} y - * @param {Piece|null} piece - */ - setPiece(x, y, piece) { - this.grid[y][x].piece = piece; - } - - setupInitialPieces() { - // Pawns - for (let x = 0; x < this.width; x++) { - this.setPiece(x, 1, new Piece(PieceColor.WHITE, PieceType.PAWN, [Movement.PawnMove], x, 1)); - this.setPiece(x, 6, new Piece(PieceColor.BLACK, PieceType.PAWN, [Movement.PawnMove], x, 6)); - } - - // Rooks - this.setPiece(0, 0, new Piece(PieceColor.WHITE, PieceType.ROOK, [Movement.RookMove], 0, 0)); - this.setPiece(7, 0, new Piece(PieceColor.WHITE, PieceType.ROOK, [Movement.RookMove], 7, 0)); - this.setPiece(0, 7, new Piece(PieceColor.BLACK, PieceType.ROOK, [Movement.RookMove], 0, 7)); - this.setPiece(7, 7, new Piece(PieceColor.BLACK, PieceType.ROOK, [Movement.RookMove], 7, 7)); - - // Knights - this.setPiece(1, 0, new Piece(PieceColor.WHITE, PieceType.KNIGHT, [Movement.KnightMove], 1, 0)); - this.setPiece(6, 0, new Piece(PieceColor.WHITE, PieceType.KNIGHT, [Movement.KnightMove], 6, 0)); - this.setPiece(1, 7, new Piece(PieceColor.BLACK, PieceType.KNIGHT, [Movement.KnightMove], 1, 7)); - this.setPiece(6, 7, new Piece(PieceColor.BLACK, PieceType.KNIGHT, [Movement.KnightMove], 6, 7)); - - // Bishops - this.setPiece(2, 0, new Piece(PieceColor.WHITE, PieceType.BISHOP, [Movement.BishopMove], 2, 0)); - this.setPiece(5, 0, new Piece(PieceColor.WHITE, PieceType.BISHOP, [Movement.BishopMove], 5, 0)); - this.setPiece(2, 7, new Piece(PieceColor.BLACK, PieceType.BISHOP, [Movement.BishopMove], 2, 7)); - this.setPiece(5, 7, new Piece(PieceColor.BLACK, PieceType.BISHOP, [Movement.BishopMove], 5, 7)); - - // Queens and Kings - this.setPiece(3, 0, new Piece(PieceColor.WHITE, PieceType.QUEEN, [Movement.QueenMove], 3, 0)); - this.setPiece(4, 0, new Piece(PieceColor.WHITE, PieceType.KING, [Movement.KingMove], 4, 0)); - this.setPiece(3, 7, new Piece(PieceColor.BLACK, PieceType.QUEEN, [Movement.QueenMove], 3, 7)); - this.setPiece(4, 7, new Piece(PieceColor.BLACK, PieceType.KING, [Movement.KingMove], 4, 7)); - } -} - -export { Cell, Movement, Piece, PieceColor, PieceType }; -export default Board; diff --git a/engine/core/card.js b/engine/core/card.js deleted file mode 100644 index 9c40328..0000000 --- a/engine/core/card.js +++ /dev/null @@ -1,14 +0,0 @@ -import Effect from './effect.js'; - -class Card { - constructor() { - /** @type {string} */ - this.name; - /** @type {string} */ - this.description; - /** @type {Effect} */ - this.effect; - } -} - -export default Card; diff --git a/engine/core/cell.js b/engine/core/cell.js deleted file mode 100644 index 7967912..0000000 --- a/engine/core/cell.js +++ /dev/null @@ -1,11 +0,0 @@ -class Cell { - /** - * @param {Piece|null} piece - */ - constructor(piece = null) { - /** @type {Piece|null} */ - this.piece = piece; - } -} - -export default Cell; diff --git a/engine/core/effect.js b/engine/core/effect.js deleted file mode 100644 index 4f80e3f..0000000 --- a/engine/core/effect.js +++ /dev/null @@ -1,5 +0,0 @@ -class Effect { - constructor() {} -} - -export default Effect; diff --git a/engine/core/game_state.js b/engine/core/game_state.js deleted file mode 100644 index abb2bfc..0000000 --- a/engine/core/game_state.js +++ /dev/null @@ -1,133 +0,0 @@ -import Board, { Piece } from './board.js'; -import Team from './team.js'; -import Stack from './stack.js'; -import PieceColor from './board.js'; -import Piece from './board.js'; - -class GameState { - constructor() { - /** @type {Board} */ - this.board = new Board(8, 8); - /** @type {Stack} */ - this.stack = new Stack(); - /** @type {Team} */ - this.whiteTeam = new Team("white"); - /** @type {Team} */ - this.blackTeam = new Team("black"); - /** @type {number} */ - this.turn = 0; - /** @type {Piece|null} */ - this.whiteSelectedPiece = null; - /** @type {Piece|null} */ - this.blackSelectedPiece = null; - } - - /** - * @returns {void} - */ - nextTurn() { - this.turn = 1 - this.turn; - } - - /** - * @param {PieceColor} color - * @returns {boolean} - */ - hasHisKing(color) { - const team = color === PieceColor.WHITE ? this.whiteTeam : this.blackTeam; - return team.hasKing(); - } - - /** - * @param {PieceColor} - * @returns {Array<>} - */ - getMoves(team) { - if (team == WHITE && this.whiteSelectedPiece != null) { - if (this.whiteSelectedPiece.priorityMovements.length > 0) { - return this.whiteSelectedPiece.priorityMovements.flatmap((m) => m.moves()); - } else { - return this.whiteSelectedPiece.movements.flatMap((m) => m.moves()); - } - } else if (team == BLACK && this.blackSelectedPiece != null) { - if (this.blackSelectedPiece.priorityMovements.length > 0) { - return this.blackSelectedPiece.priorityMovements.flatmap((m) => m.moves()); - } else { - return this.blackSelectedPiece.movements.flatMap((m) => m.moves()); - } - } else { - return []; - } - } - - /** - * @param {number} - * @param {number} - * @param {PieceColor} - * @returns {boolean} - */ - click(x, y, team) { - selectedPiece = this.board.grid[x][y]; - // White team - if (team == WHITE) { - // one empty cell - if (this.whiteSelectedPiece == null) { - this.whiteSelectedPiece = this.board.grid[x][y].piece; - // previous one was black - } else if (this.whiteSelectedPiece.color == BLACK) { - this.whiteSelectedPiece = this.board.grid[x][y].piece; - // select a white piece - } else if (selectedPiece.color == WHITE) { - this.whiteSelectedPiece = this.board.grid[x][y].piece; - // possible move - } else { - // authorized move - if (this.getMoves(team).filter(({x_, y_, _}) => x == x_ && y == y_).length > 0) { - if (selectedPiece != null) { - this.whiteTeam.capture.push(selectedPiece); - } - this.board.grid[x][y] = this.whiteSelectedPiece; - this.board.grid[this.whiteSelectedPiece.x][this.whiteSelectedPiece.y] = null; - this.whiteSelectedPiece.x = x; - this.whiteSelectedPiece.y = y; - return true; - } else { - this.whiteSelectedPiece = this.board.grid[x][y].piece; - } - } - - // black team - } else { - // one empty cell - if (this.blackSelectedPiece == null) { - this.blackSelectedPiece = this.board.grid[x][y].piece; - // previous one was white - } else if (this.blackSelectedPiece.color == WHITE) { - this.blackSelectedPiece = this.board.grid[x][y].piece; - // select a black piece - } else if (selectedPiece.color == BLACK) { - this.blackSelectedPiece = this.board.grid[x][y].piece; - // possible move - } else { - // authorized move - if (this.getMoves(team).filter(({x_, y_, _}) => x == x_ && y == y_).length > 0) { - if (selectedPiece != null) { - this.blackTeam.capture.push(selectedPiece); - } - this.board.grid[x][y] = this.blackSelectedPiece; - this.board.grid[this.blackSelectedPiece.x][this.blackSelectedPiece.y] = null; - this.blackSelectedPiece.x = x; - this.blackSelectedPiece.y = y; - return true; - } else { - this.blackSelectedPiece = this.board.grid[x][y].piece; - } - } - } - - // no move done - return false; - } -} - -export default GameState; diff --git a/engine/core/hand.js b/engine/core/hand.js deleted file mode 100644 index ec25070..0000000 --- a/engine/core/hand.js +++ /dev/null @@ -1,31 +0,0 @@ -import Card from './card.js'; - -class Hand { - constructor() { - /** @type {Array(Card)} */ - this.cards = []; - } - - /** - * @param {Card} card - */ - pushCard(card) { - this.cards.push(card); - } - - /** - * @param {number} index - * @returns {Card|null} - */ - popCard(index) { - if (index < 0 || index >= this.cards.length) { - return null; - } else { - let c = this.cards.at(index); - this.cards.splice(index, 1); - return c; - } - } -} - -export default Hand; diff --git a/engine/core/movement/generateMoves.js b/engine/core/movement/generateMoves.js deleted file mode 100644 index 9431ba7..0000000 --- a/engine/core/movement/generateMoves.js +++ /dev/null @@ -1,59 +0,0 @@ -// Utilities for movement generation -// The movement modules receive a context object with at least: -// - board: instance exposing getWidth(), getHeight(), getCell(x,y) and setPiece(x,y,piece) -// - from: { x, y } -// - piece: the moving piece (with getColor()) - -/** - * Walk in linear directions (array of dx,dy) until blocked. - * Returns an array of move objects: { x, y, capture: boolean } - * - * Options: - * - maxSteps (default: Infinity) - * - allowCapture=true - * - allowEmpty=true - */ -export function generateLinearMoves({ - board, - from, - piece, - directions, - maxSteps = Infinity, - allowCapture = true, - allowEmpty = true, - allowRing = false -}) { - const moves = []; - const w = board.getWidth(); - const h = board.getHeight(); - const color = piece.getColor(); - - for (const [dx, dy] of directions) { - let steps = 0; - let x = from.x + dx; - let y = from.y + dy; - - while (x >= 0 && x < w && y >= 0 && y < h && steps < maxSteps) { - const cell = board.getCell(x, y); - const target = cell?.piece ?? null; - - if (target == null) { - if (allowEmpty) moves.push({ x, y, capture: false }); - // continue along this direction - } else { - // occupied - if (target.getColor() !== color) { - if (allowCapture) moves.push({ x, y, capture: true }); - } - // stop after encountering any piece - break; - } - - steps++; - x += dx; - y += dy; - } - } - - return moves; -} diff --git a/engine/core/movement/index.js b/engine/core/movement/index.js deleted file mode 100644 index fa17b81..0000000 --- a/engine/core/movement/index.js +++ /dev/null @@ -1,13 +0,0 @@ -// Central export for movement modules -import {RookMove, BishopMove, KnightMove, QueenMove, KingMove, PawnMove} from './moves.js'; -import { generateLinearMoves } from './generateMoves.js'; - -export default { - RookMove, - BishopMove, - KnightMove, - QueenMove, - KingMove, - PawnMove, - generateLinearMoves, -}; \ No newline at end of file diff --git a/engine/core/movement/moves.js b/engine/core/movement/moves.js deleted file mode 100644 index 9856a41..0000000 --- a/engine/core/movement/moves.js +++ /dev/null @@ -1,178 +0,0 @@ -import { generateLinearMoves } from './generateMoves.js'; - -// basic moves -class RookMove { - /** - * Return possible moves for a rook-like piece from `from` on the given `board`. - * The move format is { x, y, capture: boolean } - * - * ctx: { board, from: {x,y}, piece, allowRing } - */ - static moves(ctx) { - const orthogonals = [ - [1, 0], - [-1, 0], - [0, 1], - [0, -1], - ]; - - return generateLinearMoves({ - board: ctx.board, - from: ctx.from, - piece: ctx.piece, - directions: orthogonals, - allowRing: ctx.allowRing - }); - } -} - -class BishopMove { - /** - * Return possible moves for a bishop-like piece from `from` on the given `board`. - * The move format is { x, y, capture: boolean } - * - * ctx: { board, from: {x,y}, piece } - */ - static moves(ctx) { - const diagonals = [ - [1, 1], - [1, -1], - [-1, 1], - [-1, -1], - ]; - - return generateLinearMoves({ - board: ctx.board, - from: ctx.from, - piece: ctx.piece, - directions: diagonals, - allowRing: ctx.allowRing - }); - } -} - -class KnightMove { - /** - * Return possible moves for a knight-like piece from `from` on the given `board`. - * The move format is { x, y, capture: boolean } - * - * ctx: { board, from: {x,y}, piece } - */ - static moves(ctx) { - const knightMoves = [ - [2, 1], [2, -1], [-2, 1], [-2, -1], - [1, 2], [1, -2], [-1, 2], [-1, -2], - ]; - - return generateLinearMoves({ - board: ctx.board, - from: ctx.from, - piece: ctx.piece, - directions: knightMoves, - maxSteps: 1, - allowEmpty: true, - allowCapture: true, - allowRing: ctx.allowRing - }); - - } -} - -class QueenMove { - /** - * Return possible moves for a queen-like piece from `from` on the given `board`. - * The move format is { x, y, capture: boolean } - * - * ctx: { board, from: {x,y}, piece } - */ - static moves(ctx) { - const directions = [ - [1, 0], [-1, 0], [0, 1], [0, -1], // orthogonals - [1, 1], [1, -1], [-1, 1], [-1, -1], // diagonals - ]; - - return generateLinearMoves({ - board: ctx.board, - from: ctx.from, - piece: ctx.piece, - directions: directions, - allowRing: ctx.allowRing - }); - } -} - -class KingMove { - /** - * Return possible moves for a king-like piece from `from` on the given `board`. - * The move format is { x, y, capture: boolean } - * - * ctx: { board, from: {x,y}, piece } - */ - static moves(ctx) { - const directions = [ - [1, 0], [-1, 0], [0, 1], [0, -1], // orthogonals - [1, 1], [1, -1], [-1, 1], [-1, -1], // diagonals - ]; - - return generateLinearMoves({ - board: ctx.board, - from: ctx.from, - piece: ctx.piece, - directions: directions, - maxSteps: 1, - allowRing: ctx.allowRing - }); - } -} - -class PawnMove { - /** - * Return possible moves for a pawn-like piece from `from` on the given `board`. - * The move format is { x, y, capture: boolean } - * - * ctx: { board, from: {x,y}, piece } - */ - static moves(ctx) { - const color = ctx.piece.getColor(); - const forward = (color === 'white') ? -1 : 1; // assuming y=0 is top - - const moves = []; - const w = ctx.board.getWidth(); - const h = ctx.board.getHeight(); - const x = ctx.from.x; - const y = ctx.from.y; - - // Forward move - if (y + forward >= 0 && y + forward < h) { - const forwardCell = ctx.board.getCell(x, y + forward); - if (forwardCell?.piece == null) { - moves.push({ x: x, y: y + forward, capture: false }); - - // Double step from starting position - const startingRow = (color === 'white') ? h - 2 : 1; - if (!ctx.piece.hasMoved) { - const doubleForwardCell = ctx.board.getCell(x, y + 2 * forward); - if (doubleForwardCell?.piece == null) { - moves.push({ x: x, y: y + 2 * forward, capture: false }); - } - } - - } - } - - // Captures - for (const dx of [-1, 1]) { - if (x + dx >= 0 && x + dx < w && y + forward >= 0 && y + forward < h) { - const diagCell = ctx.board.getCell(x + dx, y + forward); - const target = diagCell?.piece ?? null; - if (target != null && target.getColor() !== color) { - moves.push({ x: x + dx, y: y + forward, capture: true }); - } - } - } - - return moves; - } -} - -export { RookMove, BishopMove, KnightMove, QueenMove, KingMove, PawnMove }; diff --git a/engine/core/piece.js b/engine/core/piece.js deleted file mode 100644 index a3f0168..0000000 --- a/engine/core/piece.js +++ /dev/null @@ -1,42 +0,0 @@ -const PieceColor = { - WHITE: 'WHITE', - BLACK: 'BLACK' -}; - -const PieceType = { - PAWN: 'PAWN', - KNIGHT: 'KNIGHT', - BISHOP: 'BISHOP', - ROOK: 'ROOK', - QUEEN: 'QUEEN', - KING: 'KING' -}; - -class Piece { - /** - * @param {PieceColor} color - * @param {PieceType} type - * @param {Array} movements - * @param {number} x - * @param {number} y - */ - constructor(color, type, movements, x, y) { - /** @type {PieceColor} */ - this.color = color; - /** @type {PieceType} */ - this.type = type; - /** @type {boolean} */ - this.hasMoved = false; - /** @type {Array} */ - this.movements = movements; - /** @type {Array} */ - this.priorityMovements = []; - /** @type {number} */ - this.x = x; - /** @type {number} */ - this.y = y; - } -} - -export default Piece; -export { PieceColor, PieceType }; diff --git a/engine/core/stack.js b/engine/core/stack.js deleted file mode 100644 index 2720342..0000000 --- a/engine/core/stack.js +++ /dev/null @@ -1,50 +0,0 @@ -import Card from './card.js'; - -class Stack { - constructor() { - /** @type {Array(Card)} */ - this.stack; - /** @type {Array{Card}} */ - this.discard; - } - - /** - * @returns {Card|null} - */ - drawACard() { - if (this.stack.length > 0) { - return this.stack.pop(); - } else { - if (this.discard.length == 0) { - return null; - } - while (this.discard.length > 0) { - let randomIndex = Math.floor(Math.random() * this.discard.length); - this.stack.push(this.discard.at(randomIndex)); - this.stack.splice(randomIndex, 1); - } - return this.stack.pop(); - } - } - - /** - * - * @param {card} card - */ - discardACard(card) { - this.discard.push(card); - } - - /** - * @description Shuffle the stack - */ - shuffle() { - let index = this.stack.length - 1; - while (index > 0) { - let randomIndex = Math.floor(Math.random() * index); - [this.stack[index], this.stack[randomIndex]] = [this.stack[randomIndex], this.stack[index]]; - } - } -} - -export default Stack; diff --git a/engine/core/team.js b/engine/core/team.js deleted file mode 100644 index ac75809..0000000 --- a/engine/core/team.js +++ /dev/null @@ -1,30 +0,0 @@ -import Piece, { PieceColor } from './piece.js'; -import Hand from './hand.js'; - -class Team { - /** - * @param {PieceColor} color - * @param {Piece} king - */ - constructor(color, king) { - /** @type {PieceColor} */ - this.color = color; - /** @type {Piece} */ - this.king = king; - /** @type {Hand} */ - this.hand = new Hand(); - /** @type {boolean} */ - this.hasMadeAction = false; - /** @type {Array} */ - this.capture = []; - } - - /** - * @returns {boolean} - */ - hasKing() { - return this.king !== null; - } -} - -export default Team; diff --git a/frontend/README.md b/frontend/README.md deleted file mode 100644 index ff7fd42..0000000 --- a/frontend/README.md +++ /dev/null @@ -1,8 +0,0 @@ -Frontend demo: simple static lobby + board renderer - -Contents: -- `public/index.html` : entry page -- `src/main.js` : minimal JS for lobby and board rendering -- `src/styles.css` : styles - -How to run (dev): serve the `public` folder with a static server (e.g. `npx serve public` or `python3 -m http.server` from `frontend/public`) diff --git a/frontend/public/assets/chess-pieces b/frontend/public/assets/chess-pieces deleted file mode 160000 index 978d740..0000000 --- a/frontend/public/assets/chess-pieces +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 978d74002e90598eb2f952460e37552a4ec2dace diff --git a/frontend/public/game.html b/frontend/public/game.html deleted file mode 100644 index a67988c..0000000 --- a/frontend/public/game.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - ChessNut 1 Partie - - - - -
-

Partie

-
Chargement...
-
Couleur: —
-
- Joueurs: -
    -
    -
    Chargement de l'état du serveur...
    -
    -
    -
    -
    - - - - - - diff --git a/frontend/public/index.html b/frontend/public/index.html deleted file mode 100644 index fef348b..0000000 --- a/frontend/public/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - ChessNut — Lobby - - - -
    -
    -

    ChessNut — Lobby

    -
    - -
    -
    -
    -

    Créer une partie

    - - - -
    - -
    -

    Rejoindre une partie

    - - -
    -
    - - -
    -
    - - - - - diff --git a/frontend/public/src/game.js b/frontend/public/src/game.js deleted file mode 100644 index 6a0fa44..0000000 --- a/frontend/public/src/game.js +++ /dev/null @@ -1,192 +0,0 @@ -const q = s => document.querySelector(s); - -// socket variable will be initialized on first load/join -let socket = null; -let myPlayerId = null; -let currentGameId = null; -let selected = null; // {x,y} - -function renderBoardFromState(state, asWhite = null) { - const container = q('#board-container'); - if(!container){ console.error('renderBoardFromState: #board-container not found'); return; } - console.log('renderBoardFromState called, state present?', !!state); - container.innerHTML = ''; - const boardEl = document.createElement('div'); - boardEl.className = 'board'; - - // if no state provided, create an empty 8x8 board - if(!state || !state.board){ - const w = 8, h = 8; - const board = Array.from({ length: h }, () => Array.from({ length: w }, () => null)); - state = { board, width: w, height: h }; - } - - const h = state.height || state.board.length; - const w = state.width || (state.board[0] && state.board[0].length) || 8; - - // Use CSS grid so cells distribute evenly and keep the board square via wrapper's aspect-ratio - boardEl.style.display = 'grid'; - boardEl.style.gridTemplateColumns = `repeat(${w}, 1fr)`; - boardEl.style.gridTemplateRows = `repeat(${h}, 1fr)`; - // Keep cells square regardless of board dimensions by setting an aspect-ratio on the board element. - // We want height / width ratio so each grid cell becomes square: aspect-ratio = h / w - boardEl.style.aspectRatio = `${w} / ${h}`; // CSS aspect-ratio uses width/height, but grid tracks make squares when width/height ratio is set accordingly - // Make the board responsive: max size will be limited by container width - boardEl.style.maxWidth = 'min(90vmin, 80vw)'; - boardEl.style.width = '100%'; - - // determine orientation: explicit asWhite param > window.myColor > default true - try{ - let useWhite = true; - if (asWhite === null) { - if (window && window.myColor) useWhite = (String(window.myColor).toLowerCase() === 'white'); - } else { - useWhite = !!asWhite; - } - console.log('[renderBoardFromState] myPlayerId=', myPlayerId, 'window.myColor=', window && window.myColor, 'asWhite param=', asWhite, 'computed useWhite=', useWhite); - // set dataset for easier inspection in DevTools - try { boardEl.dataset.orientation = useWhite ? 'white' : 'black'; container.dataset.myPlayerId = myPlayerId || ''; } catch(e) {} - if (!useWhite) boardEl.classList.add('flipped'); - }catch(e){} - - // Render cells in visual order depending on orientation. We do not rotate the element; instead we map - // visual coordinates -> state coordinates so piece images remain upright. - const useWhite = (boardEl.dataset.orientation || 'white') === 'white' || (window && window.myColor && String(window.myColor).toLowerCase() === 'white'); - for (let vr = 0; vr < h; vr++) { - for (let vc = 0; vc < w; vc++) { - // Map visual row/col to state row/col depending on orientation - // For white perspective we want white pieces at the bottom (state row 0 -> visual bottom), - // so state row = h-1 - vr. For black perspective, state row = vr. - const r = useWhite ? (h - 1 - vr) : vr; - // For white perspective, file order is left->right = state col 0..w-1; for black it's mirrored. - const c = useWhite ? vc : (w - 1 - vc); - const cell = document.createElement('div'); - cell.className = 'cell'; - // alternate light/dark based on visual coordinates so checkerboard looks proper - const isLight = ((vr + vc) % 2) === 0; - cell.classList.add(isLight ? 'light' : 'dark'); - // store state coordinates so click handlers send correct moves - cell.dataset.x = c; - cell.dataset.y = r; - const piece = document.createElement('img'); - piece.className = 'piece'; - - const cellObj = state.board[r] && state.board[r][c]; - if (cellObj) { - const t = cellObj.type || 'PAWN'; - const color = (cellObj.color || 'white').toLowerCase(); - const lookup = { - PAWN: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wP' : 'bP'}.svg`, - ROOK: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wR' : 'bR'}.svg`, - KNIGHT: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wN' : 'bN'}.svg`, - BISHOP: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wB' : 'bB'}.svg`, - QUEEN: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wQ' : 'bQ'}.svg`, - KING: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wK' : 'bK'}.svg`, - }; - piece.src = lookup[t] || lookup.PAWN; - } else { - piece.style.display = 'none'; - } - - cell.appendChild(piece); - boardEl.appendChild(cell); - // clicks on cells should do absolutely nothing (display-only mode) - cell.addEventListener('click', () => { - // intentionally empty - no selection, no move, no UI changes - }); - } - } - container.appendChild(boardEl); - // (previously: overlay/drawing code removed per user request) - // ensure player color display is in sync - try{ const pc = document.getElementById('player-color'); if(pc && window && window.myColor) pc.textContent = 'Couleur: ' + window.myColor; }catch(e){} - console.log('renderBoardFromState: board appended (w=' + w + ', h=' + h + ')'); -} - - -function setMeta(text) { q('#meta').textContent = text; } - -function renderPlayersList(gameObj){ - try{ - const ul = document.getElementById('players-list'); if(!ul) return; - ul.innerHTML = ''; - const players = (gameObj && gameObj.players) ? gameObj.players : []; - players.forEach(p => { - const li = document.createElement('li'); - li.textContent = (p.nickname || p.id) + ' — ' + (p.colorAssigned || 'non assignée'); - if(window && myPlayerId && p.id === myPlayerId) li.textContent += ' (vous)'; - ul.appendChild(li); - }); - }catch(e){} -} - -q('#create-only')?.addEventListener('click', async () => { - const name = q('#game-name').value || 'game-from-ui'; - const res = await fetch('/api/create', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ name, ownerNickname: 'ui-host' }) }); - const j = await res.json(); - setMeta('Created: ' + j.game.id); - q('#game-id-input').value = j.game.id; - // store owner player id in session so host remembers which player they are - try{ if (j.player && j.game && j.player.id) { sessionStorage.setItem('chessnut:game:' + j.game.id + ':playerId', j.player.id); sessionStorage.setItem('playerId:' + j.game.id, j.player.id); } }catch(e){} -}); - -q('#create-start')?.addEventListener('click', async () => { - const name = q('#game-name').value || 'game-from-ui'; - // create - const createResp = await fetch('/api/create', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ name, ownerNickname: 'ui-host' }) }); - const createJson = await createResp.json(); - const id = createJson.game.id; - setMeta('Created: ' + id + ' — joining as second player...'); - // join as second player - const joinResp = await fetch('/api/join', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ id, nickname: 'ui-guest' }) }); - const joinJson = await joinResp.json(); - // if join returned a player object, use it as this client's player id (we're acting as the guest here) - if (joinJson && joinJson.player && joinJson.player.id) { - myPlayerId = joinJson.player.id; - try{ sessionStorage.setItem('chessnut:game:' + id + ':playerId', myPlayerId); sessionStorage.setItem('playerId:' + id, myPlayerId); }catch(e){} - } - setMeta('Joined — starting...'); - const startResp = await fetch('/api/start', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ id }) }); - const startJson = await startResp.json(); - setMeta('Started: ' + id); - if (startJson.game && startJson.game.state) renderBoardFromState(startJson.game.state); - // connect socket and join room as the guest player we created earlier - currentGameId = id; - // try to capture the second player id from server game.players - const players = startJson.game.players || []; - if (players[1]) myPlayerId = players[1].id; else if (players[0]) myPlayerId = players[0].id; - // persist player id in sessionStorage (per-tab) so reloads can identify this client without colliding across tabs - try{ if(myPlayerId && id) { sessionStorage.setItem('chessnut:game:' + id + ':playerId', myPlayerId); sessionStorage.setItem('playerId:' + id, myPlayerId); } }catch(e){} - if (!socket) { - socket = io(); - socket.on('connect', () => { socket.emit('join-game', currentGameId); socket.emit('identify', { gameId: currentGameId, playerId: myPlayerId }); }); - socket.on('game-state', (s) => { renderBoardFromState(s); setMeta('game-state updated'); }); - socket.on('move', (m) => { setMeta('remote move ' + JSON.stringify(m)); }); - socket.on('player-update', (g) => { setMeta('players updated'); }); - socket.on('error', (e) => { console.warn('socket error', e); setMeta('Socket error: ' + (e && e.error)); }); - } -}); - -q('#load')?.addEventListener('click', async () => { - const id = q('#game-id-input').value; - if(!id) return setMeta('Enter a game id'); - const res = await fetch('/api/game/' + id).catch(e => null); - if(!res || !res.ok) return setMeta('Game not found or backend unreachable'); - const j = await res.json(); - setMeta('Loaded: ' + id + ' (started=' + !!j.started + ')'); - if (j.state && j.state.board) renderBoardFromState(j.state); - // wire socket to listen to updates in this game - currentGameId = id; - // choose a player id if any exists (by default pick first) - if (j.players && j.players.length > 0) myPlayerId = j.players[0].id; - // prefer stored player id if present (sessionStorage is per-tab so two tabs won't collide) - try{ const stored = sessionStorage.getItem('chessnut:game:' + id + ':playerId') || sessionStorage.getItem('playerId:' + id); if(stored) myPlayerId = stored; else if(myPlayerId && id) { sessionStorage.setItem('chessnut:game:' + id + ':playerId', myPlayerId); sessionStorage.setItem('playerId:' + id, myPlayerId); } }catch(e){} - if (!socket) { - socket = io(); - socket.on('connect', () => { socket.emit('join-game', currentGameId); socket.emit('identify', { gameId: currentGameId, playerId: myPlayerId }); }); - socket.on('game-state', (s) => { renderBoardFromState(s); setMeta('game-state updated'); }); - socket.on('move', (m) => { setMeta('remote move ' + JSON.stringify(m)); }); - socket.on('player-update', (g) => { setMeta('players updated'); }); - socket.on('error', (e) => { console.warn('socket error', e); setMeta('Socket error: ' + (e && e.error)); }); - } -}); diff --git a/frontend/public/src/main.js b/frontend/public/src/main.js deleted file mode 100644 index bf19f18..0000000 --- a/frontend/public/src/main.js +++ /dev/null @@ -1,234 +0,0 @@ -// Minimal frontend to create/join a game and render a static board using chess_maestro pieces -const q = s => document.querySelector(s); - -function showLobby() { - q('#lobby').classList.remove('hidden'); - q('#board-section')?.classList?.add('hidden'); -} - -function showBoard(gameId, role) { - q('#lobby').classList.add('hidden'); - q('#board-section')?.classList?.remove('hidden'); - q('#game-id').textContent = gameId; - q('#player-role').textContent = role; - // determine this client's assigned color (if any) so we can render board from that perspective - (function(){ - const stored = sessionStorage.getItem(`playerId:${gameId}`) || sessionStorage.getItem('chessnut:game:' + gameId + ':playerId'); - // prefer server-provided state to compute orientation when available - fetch(`/api/game/${gameId}`).then(r => { if(!r.ok) throw new Error('no api'); return r.json(); }).then(g => { - try{ - let asWhite = true; - if (stored && g && g.players) { - const me = g.players.find(p => p.id === stored); - if (me && me.colorAssigned) asWhite = (String(me.colorAssigned).toLowerCase() === 'white'); - } else if (role) { - // fall back to role passed by caller - asWhite = (role === 'white'); - } - if (g && g.state && typeof renderBoardFromState === 'function') renderBoardFromState(g.state, asWhite); - else renderBoard(asWhite); - }catch(e){ renderBoard(role === 'white'); } - }).catch(() => { - // backend not reachable: fall back to role param - renderBoard(role === 'white'); - }); - })(); -} - -q('#create-btn').addEventListener('click', () => { - console.log('[frontend] create-btn clicked'); - const id = 'game-' + Math.random().toString(36).slice(2,9); - const pass = q('#create-pass').value; - const name = q('#create-name').value || id; - const nick = 'player'; - const colorChoice = 'random'; - const game = { id, name, pass: pass || null, owner: 'you', created: Date.now(), players: [{ id: 'p-' + Math.random().toString(36).slice(2,6), nickname: nick, colorChoice, colorAssigned: null }], started: false }; - - // try backend first (explicit host). If it fails, save locally and redirect to waiting page. - // include a neutral ownerNickname so backend creates the owner player, but we do not surface any pseudo in the UI - fetch('http://localhost:4000/api/create', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({name, pass, ownerNickname: nick, ownerColorChoice: colorChoice}) }) - .then(r => { console.log('[frontend] backend /api/create response', r.status); if(!r.ok) throw new Error('no api'); return r.json(); }) - .then(resp => { console.log('[frontend] created (backend)', resp); /* backend now returns { ok: true, game, player } for the owner */ - if(resp.player && resp.player.id){ sessionStorage.setItem(`playerId:${resp.game.id}`, resp.player.id); } - alert('Partie créée: ' + (resp.game.name || 'Partie')); window.location.href = `waiting.html?game=${resp.game.id}`; }) - .catch((err) => { - console.warn('[frontend] backend create failed, saving locally and redirecting', err && err.message); - // save to localStorage so waiting page can pick it up - const all = JSON.parse(localStorage.getItem('games') || '[]'); - all.push(game); - localStorage.setItem('games', JSON.stringify(all)); - alert('Partie créée localement: ' + (game.name || 'Partie')); - window.location.href = `waiting.html?game=${game.id}`; - }); -}); - -q('#show-list-btn').addEventListener('click', () => { - const list = q('#games-list'); - list.classList.toggle('hidden'); - renderGameList(); -}); - -function saveGame(game){ - const all = JSON.parse(localStorage.getItem('games') || '[]'); - all.push(game); - localStorage.setItem('games', JSON.stringify(all)); -} - -function renderGameList(){ - const ul = q('#games-ul'); - ul.innerHTML = ''; - console.log('[frontend] renderGameList called'); - // prefer backend host in dev - fetch('http://localhost:4000/api/list') - .then(r => { if(!r.ok) throw new Error('no remote api'); return r.json(); }) - .then(all => { if(!all || all.length === 0){ ul.innerHTML = '
  • Aucune partie disponible
  • '; return; } all.forEach(g => renderGameListItem(ul, g)); }) - .catch(() => { - // try same-origin then localStorage - fetch('/api/list') - .then(r => { if(!r.ok) throw new Error('no local api'); return r.json(); }) - .then(all => { if(!all || all.length === 0){ ul.innerHTML = '
  • Aucune partie disponible
  • '; return; } all.forEach(g => renderGameListItem(ul, g)); }) - .catch(() => { - const all = JSON.parse(localStorage.getItem('games') || '[]'); - if(all.length === 0){ ul.innerHTML = '
  • Aucune partie disponible
  • '; return; } - all.forEach(g => renderGameListItem(ul, g)); - }); - }); -} - -// Socket: listen for global games-list updates from backend to refresh lobby list live -if(typeof io !== 'undefined'){ - try{ - const sock = io('http://localhost:4000', { transports: ['websocket', 'polling'] }); - sock.on('connect', () => { console.log('lobby socket connected', sock.id); }); - sock.on('games-list', (list) => { console.log('games-list event received', list); try { renderGameList(); } catch(e){} }); - sock.on('connect_error', (e) => { console.warn('lobby socket connect error', e); }); - }catch(e){ console.warn('failed to init lobby socket', e); } -} - -function renderGameListItem(ul, g){ - const li = document.createElement('li'); - // display only human-friendly name; avoid showing internal ids - li.textContent = g.name || 'Partie'; - - // detect if this client already joined this game (we store playerId in sessionStorage) - const storedPlayerId = sessionStorage.getItem(`playerId:${g.id}`); - // If we have a stored player id but the server-side game no longer contains that player, - // cleanup the sessionStorage entry (it means the player was removed / left). - let alreadyJoined = false; - if (storedPlayerId) { - const playerStillInGame = (g.players || []).some(p => p.id === storedPlayerId); - if (!playerStillInGame) { - // stale stored id: remove it - sessionStorage.removeItem(`playerId:${g.id}`); - } else { - alreadyJoined = true; - } - } - - if(alreadyJoined){ - const span = document.createElement('span'); - span.textContent = ' — Vous êtes dans cette partie'; - span.style.marginLeft = '8px'; - li.appendChild(span); - } else { - const btn = document.createElement('button'); - btn.textContent = 'Rejoindre'; - btn.addEventListener('click', () => { - console.log('[frontend] join clicked for', g.id); - if(g.pass){ const entered = prompt('Mot de passe pour rejoindre la partie'); if(entered !== g.pass){ alert('Mot de passe incorrect'); return; } } - const payload = { id: g.id, pass: g.pass, nickname: 'player' }; - - // prefer backend host first - fetch('http://localhost:4000/api/join', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify(payload) }) - .then(r => { if(!r.ok) throw new Error('join failed'); return r.json(); }) - .then(resp => { if(resp && resp.player && resp.player.id){ sessionStorage.setItem(`playerId:${g.id}`, resp.player.id); } window.location.href = `waiting.html?game=${g.id}`; }) - .catch(() => { - fetch('/api/join', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify(payload) }) - .then(r => { if(!r.ok) throw new Error('join failed'); return r.json(); }) - .then(() => { window.location.href = `waiting.html?game=${g.id}`; }) - .catch(() => { saveGame(g); window.location.href = `waiting.html?game=${g.id}`; }); - }); - - }); - - li.appendChild(btn); - } - - ul.appendChild(li); -} - -q('#leave-btn')?.addEventListener('click', () => showLobby()); - -q('#flip-btn')?.addEventListener('click', () => { const board = q('#board-container'); board.classList.toggle('flipped'); }); - -function renderBoard(asWhite=true) { - const container = q('#board-container'); - if(!container) return; - container.innerHTML = ''; - const board = document.createElement('div'); - board.className = 'board'; - // render without CSS rotation: draw ranks/files in visual order - for (let vr = 0; vr < 8; vr++) { - const row = document.createElement('div'); - row.className = 'row'; - for (let vc = 0; vc < 8; vc++) { - // For white perspective we want white at bottom -> state row = 7 - vr - const r = asWhite ? (7 - vr) : vr; - const c = asWhite ? vc : (7 - vc); - const cell = document.createElement('div'); - cell.className = 'cell'; - const piece = document.createElement('img'); - piece.className = 'piece'; - if (r === 1) piece.src = 'assets/chess-pieces/chess_maestro_bw/wP.svg'; - else if (r === 6) piece.src = 'assets/chess-pieces/chess_maestro_bw/bP.svg'; - else piece.style.display = 'none'; - cell.appendChild(piece); - row.appendChild(cell); - } - board.appendChild(row); - } - - container.appendChild(board); -} - -// initial view -showLobby(); - -// waiting room helpers -let pollInterval = null; -function showWaiting(game){ - q('#lobby').classList.add('hidden'); - q('#board-section')?.classList?.add('hidden'); - q('#lobby-waiting').classList.remove('hidden'); - // show the game name instead of internal id - q('#wait-game-id').textContent = game.name || ''; - renderWaitingPlayers(game.players || []); -} - -function renderWaitingPlayers(players){ - const ul = q('#wait-players'); ul.innerHTML = ''; - if(!players || players.length === 0) ul.innerHTML = '
  • Aucun joueur
  • '; - (players||[]).forEach(p => { const li = document.createElement('li'); li.textContent = `${p.nickname} (${p.colorAssigned || p.colorChoice})`; ul.appendChild(li); }); -} - -function startPolling(gameId){ - if(pollInterval) clearInterval(pollInterval); - pollInterval = setInterval(() => { - fetch(`/api/game/${gameId}`).then(r => { if(!r.ok) throw new Error('no api'); return r.json(); }).then(g => { - renderWaitingPlayers(g.players || []); - if(g.started){ clearInterval(pollInterval); q('#lobby-waiting').classList.add('hidden'); showBoard(g.id, 'white'); } - }).catch(() => { - fetch(`http://localhost:4000/api/game/${gameId}`).then(r => r.json()).then(g => { renderWaitingPlayers(g.players || []); if(g.started){ clearInterval(pollInterval); q('#lobby-waiting').classList.add('hidden'); showBoard(g.id, 'white'); } }).catch(()=>{}); - }); - }, 1000); -} - -q('#start-btn')?.addEventListener('click', () => { - const id = q('#wait-game-id').textContent; - fetch('/api/start', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ id }) }) - .then(r => { if(!r.ok) throw new Error('start failed'); return r.json(); }) - .then(() => alert('Partie démarrée')) - .catch(() => { fetch('http://localhost:4000/api/start', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ id }) }).then(()=>alert('Partie démarrée')).catch(()=>alert('Impossible de démarrer la partie')); }); -}); - -q('#back-to-lobby')?.addEventListener('click', () => { if(pollInterval) clearInterval(pollInterval); q('#lobby-waiting').classList.add('hidden'); showLobby(); }); diff --git a/frontend/public/src/styles.css b/frontend/public/src/styles.css deleted file mode 100644 index 61b3f44..0000000 --- a/frontend/public/src/styles.css +++ /dev/null @@ -1,22 +0,0 @@ -:root{ - --cell-size: 60px; -} -body{font-family: Arial, Helvetica, sans-serif; margin:0; padding:0;} -.hidden{display:none} -header{background:#222;color:#fff;padding:10px} -main{padding:16px} -.card{border:1px solid #ddd;padding:12px;margin:8px;border-radius:6px} -/* The board will be a CSS grid with an aspect-ratio set by JS to keep cells square regardless of board dimensions. */ -.board{display:grid; gap:0; margin:0 auto;} -.row{display:flex;gap:0 /* no gap between cells */} -.row .cell { width:var(--cell-size); height:var(--cell-size); } -/* Make sizing include borders so borders don't add extra space */ -*, *::before, *::after { box-sizing: border-box; } -/* For grid-rendered boards (JS sets display:grid on .board), let cells stretch to the grid track size. - For row-based rendering, `.row .cell` provides fixed sizing. */ -.board > .cell { width:100%; height:100%; display:flex; align-items:center; justify-content:center; background:#f0d9b5; border:1px solid #b58863; margin:0; } -.cell.light { background: #f0d9b5; } -.cell.dark { background: #b58863; } -.piece{width:70%;height:70%;object-fit:contain} -.game-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px} -.controls button{margin-left:8px} diff --git a/frontend/public/src/waiting.js b/frontend/public/src/waiting.js deleted file mode 100644 index e17b361..0000000 --- a/frontend/public/src/waiting.js +++ /dev/null @@ -1,170 +0,0 @@ -const q = s => document.querySelector(s); - -function qsParam(name){ - const p = new URLSearchParams(window.location.search); - return p.get(name); -} - -const gameId = qsParam('game'); -console.log('[waiting.js] loaded - build: v2 -', { gameId, url: window.location.href }); -if(!gameId){ document.body.innerHTML = '

    Game ID missing in URL

    '; } -else { - // Query explicit backend first to avoid interpreting same-origin static 404 as game-deleted - fetch(`http://localhost:4000/api/game/${gameId}`).then(r => { - if(r.status === 404){ - // game deleted — eject user to lobby and clear session state - sessionStorage.removeItem(`playerId:${gameId}`); - alert('La partie a été supprimée par l\'hôte. Retour au lobby.'); - window.location.href = 'index.html'; - throw new Error('game deleted'); - } - if(!r.ok) throw new Error('no api'); - return r.json(); - }).then(g => { - q('#wait-game-id').textContent = g.name || ''; - renderWaitingPlayers(g.players||[]); - // if game already started, redirect immediately to the game page - if (g.started) { window.location.href = `game.html?game=${g.id}`; return; } - // display current player nick and color if we have a playerId - const stored = sessionStorage.getItem(`playerId:${gameId}`); - if(stored){ - const me = (g.players||[]).find(p=>p.id===stored); - if(me){ q('#player-nick').textContent = 'Vous'; q('#player-color').textContent = me.colorChoice || '-'; } - } - // owner-only start button - const ownerId = g.players && g.players[0] && g.players[0].id; - if(ownerId && stored && ownerId === stored){ q('#start-btn')?.classList.remove('hidden'); } else { q('#start-btn')?.classList.add('hidden'); } - // disable start button unless there are at least 2 players - const startBtn = q('#start-btn'); - if(startBtn){ if((g.players||[]).length < 2){ startBtn.disabled = true; } else { startBtn.disabled = false; } } - if(!g.started) startPolling(gameId); - // try to connect socket.io for instant updates and identification - tryConnectSocket(gameId); - }).catch(()=>{ - // fallback: attempt same-origin server, then localStorage - fetch(`/api/game/${gameId}`).then(r=>{ - if(r.status === 404){ sessionStorage.removeItem(`playerId:${gameId}`); alert('La partie a été supprimée par l\'hôte. Retour au lobby.'); window.location.href = 'index.html'; throw new Error('game deleted'); } - if(!r.ok) throw new Error('no api'); - return r.json(); - }).then(g=>{ - q('#wait-game-id').textContent = g.name || ''; - renderWaitingPlayers(g.players||[]); - // if game already started, redirect immediately to the game page - if (g.started) { window.location.href = `game.html?game=${g.id}`; return; } - const stored = sessionStorage.getItem(`playerId:${gameId}`); - if(stored){ const me = (g.players||[]).find(p=>p.id===stored); if(me){ q('#player-nick').textContent = 'Vous'; q('#player-color').textContent = me.colorChoice || '-'; } } - const ownerId = g.players && g.players[0] && g.players[0].id; - if(ownerId && stored && ownerId === stored){ q('#start-btn')?.classList.remove('hidden'); } else { q('#start-btn')?.classList.add('hidden'); } - // disable start button unless there are at least 2 players - const startBtn = q('#start-btn'); - if(startBtn){ if((g.players||[]).length < 2){ startBtn.disabled = true; } else { startBtn.disabled = false; } } - if(!g.started) startPolling(gameId); - tryConnectSocket(gameId); - }).catch(()=>{ - const all = JSON.parse(localStorage.getItem('games') || '[]'); - const g = all.find(x=>x.id === gameId); - if(g){ q('#wait-game-id').textContent = g.name || ''; renderWaitingPlayers(g.players || []); } else { startPolling(gameId); } - }); - }); -} - -// Socket.IO wiring: connect to backend explicitly and join game room; send identify so server can map socket->player -function tryConnectSocket(gameId){ - if(typeof io === 'undefined') return; // socket lib not loaded - // connect explicitly to backend to avoid same-origin static server 404 - const sock = io('http://localhost:4000', { transports: ['websocket', 'polling'] }); - sock.on('connect', () => { - console.log('socket connected from waiting page', sock.id); - sock.emit('join-game', gameId); - const stored = sessionStorage.getItem(`playerId:${gameId}`) || (()=>{ const all = JSON.parse(localStorage.getItem('games') || '[]'); const g = all.find(x=>x.id===gameId); return g && g.players && g.players[0] && g.players[0].id; })(); - if(stored) sock.emit('identify', { gameId, playerId: stored }); - }); - sock.on('reconnect', (attempt) => { console.log('waiting socket reconnected', attempt); }); - sock.on('game-deleted', (payload) => { - if(payload && payload.gameId === gameId){ - sessionStorage.removeItem(`playerId:${gameId}`); - alert('La partie a été supprimée par l\'hôte. Retour au lobby.'); - window.location.href = 'index.html'; - } - }); - sock.on('player-update', (g) => { - if(!g) return; - console.log('[waiting.js] player-update received', g); - renderWaitingPlayers(g.players||[]); - // update start button visibility/disabled state live - try { console.log('[waiting.js] updating start button'); updateStartButton(g); } catch(e){ console.error('updateStartButton error', e); } - }); - sock.on('game-start', (g) => { - if(!g) return; - // redirect to game view when started - window.location.href = `game.html?game=${g.id}`; - }); - sock.on('connect_error', (err) => { - console.warn('socket connect error', err); - // leave polling as fallback - }); -} - -function updateStartButton(g){ - const stored = sessionStorage.getItem(`playerId:${gameId}`); - const ownerId = g.players && g.players[0] && g.players[0].id; - const startBtn = q('#start-btn'); - console.log('[waiting.js] updateStartButton values', { ownerId, stored, playersLength: (g.players||[]).length, startBtnExists: !!startBtn }); - if(ownerId && stored && ownerId === stored){ startBtn?.classList.remove('hidden'); } else { startBtn?.classList.add('hidden'); } - if(startBtn){ startBtn.disabled = ((g.players||[]).length < 2); } -} - -function renderWaitingPlayers(players){ - const ul = q('#wait-players'); ul.innerHTML = ''; - if(!players || players.length === 0) ul.innerHTML = '
  • Aucun joueur
  • '; - (players||[]).forEach((p, i) => { const li = document.createElement('li'); li.textContent = `Joueur ${i+1} (${p.colorAssigned || p.colorChoice})`; ul.appendChild(li); }); -} - -let poll = null; -function startPolling(id){ - if(poll) clearInterval(poll); - poll = setInterval(()=>{ - // Prefer explicit backend host to avoid same-origin 404 from static server - fetch(`http://localhost:4000/api/game/${id}`).then(r=>{ if(!r.ok) throw new Error('no api'); return r.json(); }).then(g=>{ renderWaitingPlayers(g.players||[]); if(g.started){ clearInterval(poll); window.location.href = `game.html?game=${g.id}`; } }).catch(()=>{ - // fallback to same-origin if backend not reachable - fetch(`/api/game/${id}`).then(r=>{ if(!r.ok) throw new Error('no api'); return r.json(); }).then(g=>{ renderWaitingPlayers(g.players||[]); if(g.started){ clearInterval(poll); window.location.href = `game.html?game=${g.id}`; } }).catch(()=>{}); - }); - }, 1000); -} - -// Join handled from lobby; waiting room doesn't provide a join button - -q('#start-btn')?.addEventListener('click', () => { - // force explicit backend host (no fallback) so request always goes to :4000 - console.log('[waiting] start click - POST to http://localhost:4000/api/start', { gameId }); - fetch('http://localhost:4000/api/start', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ id: gameId }) }) - .then(async (r) => { - const body = await r.json().catch(()=>({})); - if(!r.ok) throw body; - return body; - }) - .then((resp)=>{ try { window.location.href = `game.html?game=${resp.game.id}`; } catch(e) { alert('Partie démarrée'); } }) - .catch((err)=>{ const msg = (err && err.error) ? err.error : (typeof err === 'string' ? err : JSON.stringify(err)); alert('Impossible de démarrer: ' + msg); console.error('start error', err); }); -}); - -q('#leave-btn')?.addEventListener('click', () => { - const stored = sessionStorage.getItem(`playerId:${gameId}`) || null; - const playerId = stored || (() => { const all = JSON.parse(localStorage.getItem('games') || '[]'); const g = all.find(x=>x.id===gameId); return g && g.players && g.players[0] && g.players[0].id; })(); - if(!playerId){ alert('Impossible de déterminer votre identifiant de joueur pour quitter'); return; } - // prefer explicit backend host to avoid same-origin static server 404s - fetch(`http://localhost:4000/api/leave`, { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ gameId, playerId }) }) - .then(r=>{ if(!r.ok) throw new Error('leave failed'); return r.json(); }).then(resp=>{ - if(resp.deleted){ alert('Vous étiez l\'hôte — la partie a été supprimée'); window.location.href = 'index.html'; } - else { alert('Vous avez quitté la partie'); window.location.href = 'index.html'; } - }).catch(()=>{ - // fallback to same-origin in case backend is proxied - fetch('/api/leave', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ gameId, playerId }) }) - .then(r=>{ if(!r.ok) throw new Error('leave failed'); return r.json(); }).then(resp=>{ - if(resp.deleted){ alert('Vous étiez l\'hôte — la partie a été supprimée'); window.location.href = 'index.html'; } - else { alert('Vous avez quitté la partie'); window.location.href = 'index.html'; } - }).catch(err=>{ - console.error('leave failed', err); - alert('Impossible de quitter la partie — le serveur est injoignable. Si le problème persiste, vérifiez que le backend tourne sur :4000.'); - }); - }); -}); diff --git a/frontend/public/waiting.html b/frontend/public/waiting.html deleted file mode 100644 index d6884ba..0000000 --- a/frontend/public/waiting.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - ChessNut — Salle d'attente - - - - -
    -

    Salle d'attente

    -
    -
    Partie:
    -
    Joueurs:
    -
      -
      -
      Votre pseudo: -
      -
      Couleur choisie: -
      -
      -
      - - -
      -
      -
      - - - - - diff --git a/frontend/src/game.js b/frontend/src/game.js deleted file mode 100644 index 1456337..0000000 --- a/frontend/src/game.js +++ /dev/null @@ -1,136 +0,0 @@ -const q = s => document.querySelector(s); - -// socket variable will be initialized on first load/join -let socket = null; -let myPlayerId = null; -let currentGameId = null; -let selected = null; // {x,y} - -function renderBoardFromState(state) { - const container = q('#board-container'); - if(!container){ console.error('renderBoardFromState: #board-container not found'); return; } - console.log('renderBoardFromState called, state present?', !!state); - // clear previous board and overlays - container.innerHTML = ''; - removeExistingOverlay(container); - const boardEl = document.createElement('div'); - boardEl.className = 'board'; - - // if no state provided, create an empty 8x8 board - if(!state || !state.board){ - const w = 8, h = 8; - const board = Array.from({ length: h }, () => Array.from({ length: w }, () => null)); - state = { board, width: w, height: h }; - } - - const h = state.height || state.board.length; - const w = state.width || (state.board[0] && state.board[0].length) || 8; - - // Use CSS grid so cells distribute evenly and keep the board square via wrapper's aspect-ratio - boardEl.style.display = 'grid'; - boardEl.style.gridTemplateColumns = `repeat(${w}, 1fr)`; - boardEl.style.gridTemplateRows = `repeat(${h}, 1fr)`; - - for (let r = 0; r < h; r++) { - for (let c = 0; c < w; c++) { - const cell = document.createElement('div'); - cell.className = 'cell'; - // alternate light/dark based on coordinates (classic checkerboard) - const isLight = ((r + c) % 2) === 1; - cell.classList.add(isLight ? 'light' : 'dark'); - cell.dataset.x = c; - cell.dataset.y = r; - const piece = document.createElement('img'); - piece.className = 'piece'; - - const cellObj = state.board[r] && state.board[r][c]; - if (cellObj) { - const t = cellObj.type || 'PAWN'; - const color = (cellObj.color || 'white').toLowerCase(); - const lookup = { - PAWN: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wP' : 'bP'}.svg`, - ROOK: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wR' : 'bR'}.svg`, - KNIGHT: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wN' : 'bN'}.svg`, - BISHOP: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wB' : 'bB'}.svg`, - QUEEN: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wQ' : 'bQ'}.svg`, - KING: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wK' : 'bK'}.svg`, - }; - piece.src = lookup[t] || lookup.PAWN; - } else { - piece.style.display = 'none'; - } - - cell.appendChild(piece); - boardEl.appendChild(cell); - // clicks on cells should do absolutely nothing (display-only mode) - cell.addEventListener('click', () => { - // intentionally empty — do not select, do not emit moves, do not change UI - }); - } - } - container.appendChild(boardEl); - // (previously: overlay/drawing code removed per user request) - console.log('renderBoardFromState: board appended (w=' + w + ', h=' + h + ')'); -} - - -function setMeta(text) { q('#meta').textContent = text; } - -q('#create-only')?.addEventListener('click', async () => { - const name = q('#game-name').value || 'game-from-ui'; - const res = await fetch('/api/create', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ name, ownerNickname: 'ui-host' }) }); - const j = await res.json(); - setMeta('Created: ' + j.game.id); - q('#game-id-input').value = j.game.id; -}); - -q('#create-start')?.addEventListener('click', async () => { - const name = q('#game-name').value || 'game-from-ui'; - // create - const createResp = await fetch('/api/create', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ name, ownerNickname: 'ui-host' }) }); - const createJson = await createResp.json(); - const id = createJson.game.id; - setMeta('Created: ' + id + ' — joining as second player...'); - // join as second player - await fetch('/api/join', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ id, nickname: 'ui-guest' }) }); - setMeta('Joined — starting...'); - const startResp = await fetch('/api/start', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ id }) }); - const startJson = await startResp.json(); - setMeta('Started: ' + id); - if (startJson.game && startJson.game.state) renderBoardFromState(startJson.game.state); - // connect socket and join room as the guest player we created earlier - currentGameId = id; - // try to capture the second player id from server game.players - const players = startJson.game.players || []; - if (players[1]) myPlayerId = players[1].id; else if (players[0]) myPlayerId = players[0].id; - if (!socket) { - socket = io(); - socket.on('connect', () => { socket.emit('join-game', currentGameId); socket.emit('identify', { gameId: currentGameId, playerId: myPlayerId }); }); - socket.on('game-state', (s) => { renderBoardFromState(s); setMeta('game-state updated'); }); - socket.on('move', (m) => { setMeta('remote move ' + JSON.stringify(m)); }); - socket.on('player-update', (g) => { setMeta('players updated'); }); - socket.on('error', (e) => { console.warn('socket error', e); setMeta('Socket error: ' + (e && e.error)); }); - } -}); - -q('#load')?.addEventListener('click', async () => { - const id = q('#game-id-input').value; - if(!id) return setMeta('Enter a game id'); - const res = await fetch('/api/game/' + id).catch(e => null); - if(!res || !res.ok) return setMeta('Game not found or backend unreachable'); - const j = await res.json(); - setMeta('Loaded: ' + id + ' (started=' + !!j.started + ')'); - if (j.state && j.state.board) renderBoardFromState(j.state); - // wire socket to listen to updates in this game - currentGameId = id; - // choose a player id if any exists (by default pick first) - if (j.players && j.players.length > 0) myPlayerId = j.players[0].id; - if (!socket) { - socket = io(); - socket.on('connect', () => { socket.emit('join-game', currentGameId); socket.emit('identify', { gameId: currentGameId, playerId: myPlayerId }); }); - socket.on('game-state', (s) => { renderBoardFromState(s); setMeta('game-state updated'); }); - socket.on('move', (m) => { setMeta('remote move ' + JSON.stringify(m)); }); - socket.on('player-update', (g) => { setMeta('players updated'); }); - socket.on('error', (e) => { console.warn('socket error', e); setMeta('Socket error: ' + (e && e.error)); }); - } -}); diff --git a/frontend/src/main.js b/frontend/src/main.js deleted file mode 100644 index 2ef5d0e..0000000 --- a/frontend/src/main.js +++ /dev/null @@ -1,242 +0,0 @@ -// Minimal frontend to create/join a game and render a static board using chess_maestro pieces -const q = s => document.querySelector(s); - -function showLobby() { - q('#lobby').classList.remove('hidden'); - q('#board-section')?.classList?.add('hidden'); -} - -function showBoard(gameId, role) { - q('#lobby').classList.add('hidden'); - q('#board-section')?.classList?.remove('hidden'); - q('#game-id').textContent = gameId; - q('#player-role').textContent = role; - - // Try to fetch the server-provided game.state. If present, render from state.board. - fetch(`/api/game/${gameId}`).then(r => { if(!r.ok) throw new Error('no api'); return r.json(); }).then(g => { - if (g && g.state && g.state.board) { - renderBoardFromState(g.state, role === 'white'); - } else { - renderBoard(role === 'white'); - } - }).catch(() => { - // fallback to static local render - renderBoard(role === 'white'); - }); -} - -q('#create-btn').addEventListener('click', () => { - console.log('[frontend] create-btn clicked'); - const id = 'game-' + Math.random().toString(36).slice(2,9); - const pass = q('#create-pass').value; - const name = q('#create-name').value || id; - // minimal create: no prompts, use default host nickname - const nick = 'Host'; - const colorChoice = 'random'; - const game = { id, name, pass: pass || null, owner: 'you', created: Date.now(), players: [{ id: 'p-' + Math.random().toString(36).slice(2,6), nickname: nick, colorChoice, colorAssigned: null }], started: false }; - - // try backend first (explicit host). If it fails, save locally and redirect to waiting page. - fetch('http://localhost:4000/api/create', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({name, pass, ownerNickname: nick, ownerColorChoice: colorChoice}) }) - .then(r => { console.log('[frontend] backend /api/create response', r.status); if(!r.ok) throw new Error('no api'); return r.json(); }) - .then(g => { console.log('[frontend] created (backend)', g); alert('Partie créée: ' + g.id); window.location.href = `waiting.html?game=${g.id}`; }) - .catch((err) => { - console.warn('[frontend] backend create failed, saving locally and redirecting', err && err.message); - // save to localStorage so waiting page can pick it up - const all = JSON.parse(localStorage.getItem('games') || '[]'); - all.push(game); - localStorage.setItem('games', JSON.stringify(all)); - alert('Partie créée localement: ' + game.id); - window.location.href = `waiting.html?game=${game.id}`; - }); -}); - -q('#show-list-btn').addEventListener('click', () => { - const list = q('#games-list'); - list.classList.toggle('hidden'); - renderGameList(); -}); - -function saveGame(game){ - const all = JSON.parse(localStorage.getItem('games') || '[]'); - all.push(game); - localStorage.setItem('games', JSON.stringify(all)); -} - -function renderGameList(){ - const ul = q('#games-ul'); - ul.innerHTML = ''; - console.log('[frontend] renderGameList called'); - // prefer backend host in dev - fetch('http://localhost:4000/api/list') - .then(r => { if(!r.ok) throw new Error('no remote api'); return r.json(); }) - .then(all => { if(!all || all.length === 0){ ul.innerHTML = '
    • Aucune partie disponible
    • '; return; } all.forEach(g => renderGameListItem(ul, g)); }) - .catch(() => { - // try same-origin then localStorage - fetch('/api/list') - .then(r => { if(!r.ok) throw new Error('no local api'); return r.json(); }) - .then(all => { if(!all || all.length === 0){ ul.innerHTML = '
    • Aucune partie disponible
    • '; return; } all.forEach(g => renderGameListItem(ul, g)); }) - .catch(() => { - const all = JSON.parse(localStorage.getItem('games') || '[]'); - if(all.length === 0){ ul.innerHTML = '
    • Aucune partie disponible
    • '; return; } - all.forEach(g => renderGameListItem(ul, g)); - }); - }); -} - -function renderGameListItem(ul, g){ - const li = document.createElement('li'); - li.textContent = `${g.name} (${g.id})`; - const btn = document.createElement('button'); - btn.textContent = 'Rejoindre'; - btn.addEventListener('click', () => { - console.log('[frontend] join clicked for', g.id); - if(g.pass){ const entered = prompt('Mot de passe pour rejoindre la partie'); if(entered !== g.pass){ alert('Mot de passe incorrect'); return; } } - const nick = prompt('Ton pseudo') || 'Player'; - const payload = { id: g.id, pass: g.pass, nickname: nick }; - - // prefer backend host first - fetch('http://localhost:4000/api/join', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify(payload) }) - .then(r => { if(!r.ok) throw new Error('join failed'); return r.json(); }) - .then(() => { window.location.href = `waiting.html?game=${g.id}`; }) - .catch(() => { - fetch('/api/join', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify(payload) }) - .then(r => { if(!r.ok) throw new Error('join failed'); return r.json(); }) - .then(() => { window.location.href = `waiting.html?game=${g.id}`; }) - .catch(() => { saveGame(g); window.location.href = `waiting.html?game=${g.id}`; }); - }); - - }); - - li.appendChild(btn); - ul.appendChild(li); -} - -q('#leave-btn')?.addEventListener('click', () => showLobby()); - -q('#flip-btn')?.addEventListener('click', () => { const board = q('#board-container'); board.classList.toggle('flipped'); }); - -function renderBoard(asWhite=true) { - // legacy static render (used as fallback) - const container = q('#board-container'); - if(!container) return; - container.innerHTML = ''; - const board = document.createElement('div'); - board.className = 'board'; - if (!asWhite) board.classList.add('flipped'); - - for (let r = 0; r < 8; r++) { - const row = document.createElement('div'); - row.className = 'row'; - for (let c = 0; c < 8; c++) { - const cell = document.createElement('div'); - cell.className = 'cell'; - const piece = document.createElement('img'); - piece.className = 'piece'; - if (r === 1) piece.src = 'assets/chess-pieces/chess_maestro_bw/wP.svg'; - else if (r === 6) piece.src = 'assets/chess-pieces/chess_maestro_bw/bP.svg'; - else piece.style.display = 'none'; - cell.appendChild(piece); - row.appendChild(cell); - } - board.appendChild(row); - } - - container.appendChild(board); -} - -function renderBoardFromState(state, asWhite = true) { - const container = q('#board-container'); - if(!container) return; - container.innerHTML = ''; - const boardEl = document.createElement('div'); - boardEl.className = 'board'; - if (!asWhite) boardEl.classList.add('flipped'); - - const h = state.height || state.board.length; - const w = state.width || (state.board[0] && state.board[0].length) || 8; - - for (let r = 0; r < h; r++) { - const row = document.createElement('div'); - row.className = 'row'; - for (let c = 0; c < w; c++) { - const cell = document.createElement('div'); - cell.className = 'cell'; - const piece = document.createElement('img'); - piece.className = 'piece'; - - const cellObj = state.board[r] && state.board[r][c]; - if (cellObj) { - // map type/color to an asset - minimal mapping for common pieces - const t = cellObj.type || 'PAWN'; - const color = (cellObj.color || 'white').toLowerCase(); - const lookup = { - PAWN: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wP' : 'bP'}.svg`, - ROOK: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wR' : 'bR'}.svg`, - KNIGHT: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wN' : 'bN'}.svg`, - BISHOP: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wB' : 'bB'}.svg`, - QUEEN: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wQ' : 'bQ'}.svg`, - KING: `assets/chess-pieces/chess_maestro_bw/${color[0] === 'w' ? 'wK' : 'bK'}.svg`, - }; - piece.src = lookup[t] || lookup.PAWN; - } else { - piece.style.display = 'none'; - } - - cell.appendChild(piece); - row.appendChild(cell); - } - boardEl.appendChild(row); - } - - container.appendChild(boardEl); -} - -// initial view -// initial view -// If URL contains ?game=..., directly open the board view -const params = new URLSearchParams(window.location.search); -const initialGame = params.get('game'); -if (initialGame) { - // assign a default role (will be refreshed when fetching game state) - showBoard(initialGame, 'white'); -} else { - showLobby(); -} - -// waiting room helpers -let pollInterval = null; -function showWaiting(game){ - q('#lobby').classList.add('hidden'); - q('#board-section')?.classList?.add('hidden'); - q('#lobby-waiting').classList.remove('hidden'); - q('#wait-game-id').textContent = game.id || ''; - renderWaitingPlayers(game.players || []); -} - -function renderWaitingPlayers(players){ - const ul = q('#wait-players'); ul.innerHTML = ''; - if(!players || players.length === 0) ul.innerHTML = '
    • Aucun joueur
    • '; - (players||[]).forEach(p => { const li = document.createElement('li'); li.textContent = `${p.nickname} (${p.colorAssigned || p.colorChoice})`; ul.appendChild(li); }); -} - -function startPolling(gameId){ - if(pollInterval) clearInterval(pollInterval); - pollInterval = setInterval(() => { - fetch(`/api/game/${gameId}`).then(r => { if(!r.ok) throw new Error('no api'); return r.json(); }).then(g => { - renderWaitingPlayers(g.players || []); - if(g.started){ clearInterval(pollInterval); q('#lobby-waiting').classList.add('hidden'); showBoard(g.id, 'white'); } - }).catch(() => { - fetch(`http://localhost:4000/api/game/${gameId}`).then(r => r.json()).then(g => { renderWaitingPlayers(g.players || []); if(g.started){ clearInterval(pollInterval); q('#lobby-waiting').classList.add('hidden'); showBoard(g.id, 'white'); } }).catch(()=>{}); - }); - }, 1000); -} - -q('#start-btn')?.addEventListener('click', () => { - const id = q('#wait-game-id').textContent; - fetch('/api/start', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ id }) }) - .then(r => { if(!r.ok) throw new Error('start failed'); return r.json(); }) - .then(() => alert('Partie démarrée')) - .catch(() => { fetch('http://localhost:4000/api/start', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ id }) }).then(()=>alert('Partie démarrée')).catch(()=>alert('Impossible de démarrer la partie')); }); -}); - -q('#back-to-lobby')?.addEventListener('click', () => { if(pollInterval) clearInterval(pollInterval); q('#lobby-waiting').classList.add('hidden'); showLobby(); }); diff --git a/frontend/src/styles.css b/frontend/src/styles.css deleted file mode 100644 index 5be1939..0000000 --- a/frontend/src/styles.css +++ /dev/null @@ -1,30 +0,0 @@ -:root{ - --cell-size: 60px; -} -body{font-family: Arial, Helvetica, sans-serif; margin:0; padding:0;} -.hidden{display:none} -header{background:#222;color:#fff;padding:10px} -main{padding:16px} -.card{border:1px solid #ddd;padding:12px;margin:8px;border-radius:6px} -.board{display:flex;flex-direction:column;gap:0 /* no gap between rows */; /* remove outer border so cell borders touch */ width:calc(var(--cell-size)*8);} -.row{display:flex;gap:0 /* no gap between cells */} -.row .cell { width:var(--cell-size); height:var(--cell-size); } -/* Make sizing include borders so borders don't add extra space */ -*, *::before, *::after { box-sizing: border-box; } -/* For grid-rendered boards (JS sets display:grid on .board), let cells stretch to the grid track size. - For row-based rendering, `.row .cell` provides fixed sizing. */ -.board > .cell { width:100%; height:100%; display:flex; align-items:center; justify-content:center; background:#f0d9b5; border:1px solid #b58863; margin:0; } -.cell.light { background: #f0d9b5; } -.cell.dark { background: #b58863; } -.piece{width:48px;height:48px} -.game-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px} -.controls button{margin-left:8px} - -/* Ensure selected cells have no visual effect (display-only mode) */ -.cell.selected{outline: none !important; box-shadow: none !important; border-color: inherit !important; background: inherit !important} - -/* Overlay for drawings (arrows/circles) */ -.board-overlay-wrapper{position:relative;width:100%;height:100%;} -.board-overlay{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:auto;z-index:30} -.overlay-controls button{background:rgba(255,255,255,0.9);border:1px solid #ccc;padding:6px 8px;border-radius:4px;cursor:pointer} -.overlay-controls button:hover{filter:brightness(0.95)} diff --git a/frontend/src/waiting.js b/frontend/src/waiting.js deleted file mode 100644 index e19ae76..0000000 --- a/frontend/src/waiting.js +++ /dev/null @@ -1,56 +0,0 @@ -const q = s => document.querySelector(s); - -function qsParam(name){ - const p = new URLSearchParams(window.location.search); - return p.get(name); -} - -const gameId = qsParam('game'); -if(!gameId){ document.body.innerHTML = '

      Game ID missing in URL

      '; } -else { - q('#wait-game-id').textContent = gameId; - // try backend first, if fails read from localStorage (fallback created locally) - fetch(`/api/game/${gameId}`).then(r => { if(!r.ok) throw new Error('no api'); return r.json(); }).then(g => { - renderWaitingPlayers(g.players||[]); - if(!g.started) startPolling(gameId); - }).catch(()=>{ - // fallback: look in localStorage - const all = JSON.parse(localStorage.getItem('games') || '[]'); - const g = all.find(x=>x.id === gameId); - if(g){ renderWaitingPlayers(g.players || []); } else { startPolling(gameId); } - }); -} - -function renderWaitingPlayers(players){ - const ul = q('#wait-players'); ul.innerHTML = ''; - if(!players || players.length === 0) ul.innerHTML = '
    • Aucun joueur
    • '; - (players||[]).forEach(p => { const li = document.createElement('li'); li.textContent = `${p.nickname} (${p.colorAssigned || p.colorChoice})`; ul.appendChild(li); }); -} - -let poll = null; -function startPolling(id){ - if(poll) clearInterval(poll); - poll = setInterval(()=>{ - fetch(`/api/game/${id}`).then(r=>{ if(!r.ok) throw new Error('no api'); return r.json(); }).then(g=>{ renderWaitingPlayers(g.players||[]); if(g.started){ clearInterval(poll); window.location.href = `game.html?game=${g.id}`; } }).catch(()=>{ - fetch(`http://localhost:4000/api/game/${id}`).then(r=>r.json()).then(g=>{ renderWaitingPlayers(g.players||[]); if(g.started){ clearInterval(poll); window.location.href = `game.html?game=${g.id}`; } }).catch(()=>{}); - }); - }, 1000); -} - -q('#join-btn')?.addEventListener('click', () => { - const nick = q('#nick-input').value || 'Guest'; - const colorChoice = q('#color-choice').value || 'random'; - fetch('/api/join', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ id: gameId, nickname: nick, colorChoice }) }) - .then(r=>{ if(!r.ok) throw new Error('join failed'); return r.json(); }).then(resp=>{ renderWaitingPlayers(resp.game.players || []); }).catch(()=>{ alert('Impossible de rejoindre (backend absent)'); }); -}); - -q('#start-btn')?.addEventListener('click', () => { - fetch('/api/start', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ id: gameId }) }) - .then(r=>{ if(!r.ok) throw new Error('start failed'); return r.json(); }).then((res)=>{ - // If backend confirms, go to game page - window.location.href = `game.html?game=${gameId}`; - }).catch(()=>{ - // If backend absent, still attempt to open the game page — polling may still load state from localStorage/backends - window.location.href = `game.html?game=${gameId}`; - }); -}); diff --git a/backend/node_modules/.bin/mime b/node_modules/.bin/mime similarity index 100% rename from backend/node_modules/.bin/mime rename to node_modules/.bin/mime diff --git a/node_modules/.bin/uuid b/node_modules/.bin/uuid new file mode 120000 index 0000000..588f70e --- /dev/null +++ b/node_modules/.bin/uuid @@ -0,0 +1 @@ +../uuid/dist/bin/uuid \ No newline at end of file diff --git a/backend/node_modules/.package-lock.json b/node_modules/.package-lock.json similarity index 97% rename from backend/node_modules/.package-lock.json rename to node_modules/.package-lock.json index 20e42b9..3bc793a 100644 --- a/backend/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -1,5 +1,5 @@ { - "name": "chessnut-backend", + "name": "chessnut-server", "version": "0.1.0", "lockfileVersion": 3, "requires": true, @@ -20,12 +20,12 @@ } }, "node_modules/@types/node": { - "version": "24.7.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.7.2.tgz", - "integrity": "sha512-/NbVmcGTP+lj5oa4yiYxxeBjRivKQ5Ns1eSZeB99ExsEQ6rX5XYU1Zy/gGxY/ilqtD4Etx9mKyrPxZRetiahhA==", + "version": "24.10.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.0.tgz", + "integrity": "sha512-qzQZRBqkFsYyaSWXuEHc2WR9c0a0CXwiE5FWUvn7ZM+vdy1uZLfCunD38UzhuB7YN/J11ndbDBcTmOdxJo9Q7A==", "license": "MIT", "dependencies": { - "undici-types": "~7.14.0" + "undici-types": "~7.16.0" } }, "node_modules/accepts": { @@ -118,6 +118,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/chess.js": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/chess.js/-/chess.js-1.4.0.tgz", + "integrity": "sha512-BBJgrrtKQOzFLonR0l+k64A98NLemPwNsCskwb+29bRwobUa4iTm51E1kwGPbWXAcfdDa18nad6vpPPKPWarqw==", + "license": "BSD-2-Clause" + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -1021,9 +1027,9 @@ } }, "node_modules/undici-types": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.14.0.tgz", - "integrity": "sha512-QQiYxHuyZ9gQUIrmPo3IA+hUl4KYk8uSA7cHrcKd/l3p1OTpZcM0Tbp9x7FAtXdAYhlasd60ncPpgu6ihG6TOA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", "license": "MIT" }, "node_modules/unpipe": { @@ -1044,6 +1050,19 @@ "node": ">= 0.4.0" } }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/backend/node_modules/@socket.io/component-emitter/LICENSE b/node_modules/@socket.io/component-emitter/LICENSE similarity index 100% rename from backend/node_modules/@socket.io/component-emitter/LICENSE rename to node_modules/@socket.io/component-emitter/LICENSE diff --git a/backend/node_modules/@socket.io/component-emitter/Readme.md b/node_modules/@socket.io/component-emitter/Readme.md similarity index 100% rename from backend/node_modules/@socket.io/component-emitter/Readme.md rename to node_modules/@socket.io/component-emitter/Readme.md diff --git a/backend/node_modules/@socket.io/component-emitter/lib/cjs/index.d.ts b/node_modules/@socket.io/component-emitter/lib/cjs/index.d.ts similarity index 100% rename from backend/node_modules/@socket.io/component-emitter/lib/cjs/index.d.ts rename to node_modules/@socket.io/component-emitter/lib/cjs/index.d.ts diff --git a/backend/node_modules/@socket.io/component-emitter/lib/cjs/index.js b/node_modules/@socket.io/component-emitter/lib/cjs/index.js similarity index 100% rename from backend/node_modules/@socket.io/component-emitter/lib/cjs/index.js rename to node_modules/@socket.io/component-emitter/lib/cjs/index.js diff --git a/backend/node_modules/@socket.io/component-emitter/lib/cjs/package.json b/node_modules/@socket.io/component-emitter/lib/cjs/package.json similarity index 100% rename from backend/node_modules/@socket.io/component-emitter/lib/cjs/package.json rename to node_modules/@socket.io/component-emitter/lib/cjs/package.json diff --git a/backend/node_modules/@socket.io/component-emitter/lib/esm/index.d.ts b/node_modules/@socket.io/component-emitter/lib/esm/index.d.ts similarity index 100% rename from backend/node_modules/@socket.io/component-emitter/lib/esm/index.d.ts rename to node_modules/@socket.io/component-emitter/lib/esm/index.d.ts diff --git a/backend/node_modules/@socket.io/component-emitter/lib/esm/index.js b/node_modules/@socket.io/component-emitter/lib/esm/index.js similarity index 100% rename from backend/node_modules/@socket.io/component-emitter/lib/esm/index.js rename to node_modules/@socket.io/component-emitter/lib/esm/index.js diff --git a/backend/node_modules/@socket.io/component-emitter/lib/esm/package.json b/node_modules/@socket.io/component-emitter/lib/esm/package.json similarity index 100% rename from backend/node_modules/@socket.io/component-emitter/lib/esm/package.json rename to node_modules/@socket.io/component-emitter/lib/esm/package.json diff --git a/backend/node_modules/@socket.io/component-emitter/package.json b/node_modules/@socket.io/component-emitter/package.json similarity index 100% rename from backend/node_modules/@socket.io/component-emitter/package.json rename to node_modules/@socket.io/component-emitter/package.json diff --git a/backend/node_modules/@types/cors/LICENSE b/node_modules/@types/cors/LICENSE similarity index 100% rename from backend/node_modules/@types/cors/LICENSE rename to node_modules/@types/cors/LICENSE diff --git a/backend/node_modules/@types/cors/README.md b/node_modules/@types/cors/README.md similarity index 100% rename from backend/node_modules/@types/cors/README.md rename to node_modules/@types/cors/README.md diff --git a/backend/node_modules/@types/cors/index.d.ts b/node_modules/@types/cors/index.d.ts similarity index 100% rename from backend/node_modules/@types/cors/index.d.ts rename to node_modules/@types/cors/index.d.ts diff --git a/backend/node_modules/@types/cors/package.json b/node_modules/@types/cors/package.json similarity index 100% rename from backend/node_modules/@types/cors/package.json rename to node_modules/@types/cors/package.json diff --git a/backend/node_modules/@types/node/LICENSE b/node_modules/@types/node/LICENSE similarity index 100% rename from backend/node_modules/@types/node/LICENSE rename to node_modules/@types/node/LICENSE diff --git a/backend/node_modules/@types/node/README.md b/node_modules/@types/node/README.md similarity index 96% rename from backend/node_modules/@types/node/README.md rename to node_modules/@types/node/README.md index bcafc8f..d221535 100644 --- a/backend/node_modules/@types/node/README.md +++ b/node_modules/@types/node/README.md @@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/). Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node. ### Additional Details - * Last updated: Sat, 11 Oct 2025 14:02:18 GMT + * Last updated: Mon, 03 Nov 2025 01:29:59 GMT * Dependencies: [undici-types](https://npmjs.com/package/undici-types) # Credits diff --git a/backend/node_modules/@types/node/assert.d.ts b/node_modules/@types/node/assert.d.ts similarity index 97% rename from backend/node_modules/@types/node/assert.d.ts rename to node_modules/@types/node/assert.d.ts index eb9238c..cd6d6df 100644 --- a/backend/node_modules/@types/node/assert.d.ts +++ b/node_modules/@types/node/assert.d.ts @@ -44,6 +44,13 @@ declare module "assert" { * @default true */ strict?: boolean | undefined; + /** + * If set to `true`, skips prototype and constructor + * comparison in deep equality checks. + * @since v24.9.0 + * @default false + */ + skipPrototype?: boolean | undefined; } interface Assert extends Pick { readonly [kOptions]: AssertOptions & { strict: false }; @@ -67,7 +74,8 @@ declare module "assert" { * ``` * * **Important**: When destructuring assertion methods from an `Assert` instance, - * the methods lose their connection to the instance's configuration options (such as `diff` and `strict` settings). + * the methods lose their connection to the instance's configuration options (such + * as `diff`, `strict`, and `skipPrototype` settings). * The destructured methods will fall back to default behavior instead. * * ```js @@ -81,6 +89,33 @@ declare module "assert" { * strictEqual({ a: 1 }, { b: { c: 1 } }); * ``` * + * The `skipPrototype` option affects all deep equality methods: + * + * ```js + * class Foo { + * constructor(a) { + * this.a = a; + * } + * } + * + * class Bar { + * constructor(a) { + * this.a = a; + * } + * } + * + * const foo = new Foo(1); + * const bar = new Bar(1); + * + * // Default behavior - fails due to different constructors + * const assert1 = new Assert(); + * assert1.deepStrictEqual(foo, bar); // AssertionError + * + * // Skip prototype comparison - passes if properties are equal + * const assert2 = new Assert({ skipPrototype: true }); + * assert2.deepStrictEqual(foo, bar); // OK + * ``` + * * When destructured, methods lose access to the instance's `this` context and revert to default assertion behavior * (diff: 'simple', non-strict mode). * To maintain custom options when using destructured methods, avoid diff --git a/backend/node_modules/@types/node/assert/strict.d.ts b/node_modules/@types/node/assert/strict.d.ts similarity index 100% rename from backend/node_modules/@types/node/assert/strict.d.ts rename to node_modules/@types/node/assert/strict.d.ts diff --git a/backend/node_modules/@types/node/async_hooks.d.ts b/node_modules/@types/node/async_hooks.d.ts similarity index 100% rename from backend/node_modules/@types/node/async_hooks.d.ts rename to node_modules/@types/node/async_hooks.d.ts diff --git a/backend/node_modules/@types/node/buffer.buffer.d.ts b/node_modules/@types/node/buffer.buffer.d.ts similarity index 98% rename from backend/node_modules/@types/node/buffer.buffer.d.ts rename to node_modules/@types/node/buffer.buffer.d.ts index b22f83a..8823dee 100644 --- a/backend/node_modules/@types/node/buffer.buffer.d.ts +++ b/node_modules/@types/node/buffer.buffer.d.ts @@ -451,7 +451,16 @@ declare module "buffer" { */ subarray(start?: number, end?: number): Buffer; } + // TODO: remove globals in future version + /** + * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports + * TypeScript versions earlier than 5.7. + */ type NonSharedBuffer = Buffer; + /** + * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports + * TypeScript versions earlier than 5.7. + */ type AllowSharedBuffer = Buffer; } /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */ diff --git a/backend/node_modules/@types/node/buffer.d.ts b/node_modules/@types/node/buffer.d.ts similarity index 99% rename from backend/node_modules/@types/node/buffer.d.ts rename to node_modules/@types/node/buffer.d.ts index 49636f3..9a62ccf 100644 --- a/backend/node_modules/@types/node/buffer.d.ts +++ b/node_modules/@types/node/buffer.d.ts @@ -59,7 +59,7 @@ declare module "buffer" { * @since v19.4.0, v18.14.0 * @param input The input to validate. */ - export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; + export function isUtf8(input: ArrayBuffer | NodeJS.TypedArray): boolean; /** * This function returns `true` if `input` contains only valid ASCII-encoded data, * including the case in which `input` is empty. @@ -68,7 +68,7 @@ declare module "buffer" { * @since v19.6.0, v18.15.0 * @param input The input to validate. */ - export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; + export function isAscii(input: ArrayBuffer | NodeJS.TypedArray): boolean; export let INSPECT_MAX_BYTES: number; export const kMaxLength: number; export const kStringMaxLength: number; @@ -113,7 +113,11 @@ declare module "buffer" { * @param fromEnc The current encoding. * @param toEnc To target encoding. */ - export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer; + export function transcode( + source: Uint8Array, + fromEnc: TranscodeEncoding, + toEnc: TranscodeEncoding, + ): NonSharedBuffer; /** * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using * a prior call to `URL.createObjectURL()`. @@ -330,7 +334,7 @@ declare module "buffer" { * @return The number of bytes contained within `string`. */ byteLength( - string: string | Buffer | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, + string: string | NodeJS.ArrayBufferView | ArrayBufferLike, encoding?: BufferEncoding, ): number; /** diff --git a/backend/node_modules/@types/node/child_process.d.ts b/node_modules/@types/node/child_process.d.ts similarity index 96% rename from backend/node_modules/@types/node/child_process.d.ts rename to node_modules/@types/node/child_process.d.ts index bf66a08..ecad7d8 100644 --- a/backend/node_modules/@types/node/child_process.d.ts +++ b/node_modules/@types/node/child_process.d.ts @@ -66,6 +66,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/child_process.js) */ declare module "child_process" { + import { NonSharedBuffer } from "node:buffer"; import { Abortable, EventEmitter } from "node:events"; import * as dgram from "node:dgram"; import * as net from "node:net"; @@ -1001,7 +1002,7 @@ declare module "child_process" { function exec( command: string, options: ExecOptionsWithBufferEncoding, - callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void, + callback?: (error: ExecException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void, ): ChildProcess; // `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`. function exec( @@ -1013,7 +1014,11 @@ declare module "child_process" { function exec( command: string, options: ExecOptions | undefined | null, - callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, + callback?: ( + error: ExecException | null, + stdout: string | NonSharedBuffer, + stderr: string | NonSharedBuffer, + ) => void, ): ChildProcess; interface PromiseWithChild extends Promise { child: ChildProcess; @@ -1027,8 +1032,8 @@ declare module "child_process" { command: string, options: ExecOptionsWithBufferEncoding, ): PromiseWithChild<{ - stdout: Buffer; - stderr: Buffer; + stdout: NonSharedBuffer; + stderr: NonSharedBuffer; }>; function __promisify__( command: string, @@ -1041,8 +1046,8 @@ declare module "child_process" { command: string, options: ExecOptions | undefined | null, ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; + stdout: string | NonSharedBuffer; + stderr: string | NonSharedBuffer; }>; } interface ExecFileOptions extends CommonOptions, Abortable { @@ -1144,13 +1149,13 @@ declare module "child_process" { function execFile( file: string, options: ExecFileOptionsWithBufferEncoding, - callback?: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void, + callback?: (error: ExecFileException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void, ): ChildProcess; function execFile( file: string, args: readonly string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding, - callback?: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void, + callback?: (error: ExecFileException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void, ): ChildProcess; // `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`. function execFile( @@ -1169,7 +1174,11 @@ declare module "child_process" { file: string, options: ExecFileOptions | undefined | null, callback: - | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) + | (( + error: ExecFileException | null, + stdout: string | NonSharedBuffer, + stderr: string | NonSharedBuffer, + ) => void) | undefined | null, ): ChildProcess; @@ -1178,7 +1187,11 @@ declare module "child_process" { args: readonly string[] | undefined | null, options: ExecFileOptions | undefined | null, callback: - | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) + | (( + error: ExecFileException | null, + stdout: string | NonSharedBuffer, + stderr: string | NonSharedBuffer, + ) => void) | undefined | null, ): ChildProcess; @@ -1198,16 +1211,16 @@ declare module "child_process" { file: string, options: ExecFileOptionsWithBufferEncoding, ): PromiseWithChild<{ - stdout: Buffer; - stderr: Buffer; + stdout: NonSharedBuffer; + stderr: NonSharedBuffer; }>; function __promisify__( file: string, args: readonly string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding, ): PromiseWithChild<{ - stdout: Buffer; - stderr: Buffer; + stdout: NonSharedBuffer; + stderr: NonSharedBuffer; }>; function __promisify__( file: string, @@ -1228,16 +1241,16 @@ declare module "child_process" { file: string, options: ExecFileOptions | undefined | null, ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; + stdout: string | NonSharedBuffer; + stderr: string | NonSharedBuffer; }>; function __promisify__( file: string, args: readonly string[] | undefined | null, options: ExecFileOptions | undefined | null, ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; + stdout: string | NonSharedBuffer; + stderr: string | NonSharedBuffer; }>; } interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable { @@ -1343,11 +1356,11 @@ declare module "child_process" { * @param command The command to run. * @param args List of string arguments. */ - function spawnSync(command: string): SpawnSyncReturns; + function spawnSync(command: string): SpawnSyncReturns; function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; - function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; - function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns; + function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; + function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; + function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns; function spawnSync( command: string, args: readonly string[], @@ -1357,12 +1370,12 @@ declare module "child_process" { command: string, args: readonly string[], options: SpawnSyncOptionsWithBufferEncoding, - ): SpawnSyncReturns; + ): SpawnSyncReturns; function spawnSync( command: string, args?: readonly string[], options?: SpawnSyncOptions, - ): SpawnSyncReturns; + ): SpawnSyncReturns; interface CommonExecOptions extends CommonOptions { input?: string | NodeJS.ArrayBufferView | undefined; /** @@ -1404,10 +1417,10 @@ declare module "child_process" { * @param command The command to run. * @return The stdout from the command. */ - function execSync(command: string): Buffer; + function execSync(command: string): NonSharedBuffer; function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string; - function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer; - function execSync(command: string, options?: ExecSyncOptions): string | Buffer; + function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): NonSharedBuffer; + function execSync(command: string, options?: ExecSyncOptions): string | NonSharedBuffer; interface ExecFileSyncOptions extends CommonExecOptions { shell?: boolean | string | undefined; } @@ -1437,11 +1450,11 @@ declare module "child_process" { * @param args List of string arguments. * @return The stdout from the command. */ - function execFileSync(file: string): Buffer; + function execFileSync(file: string): NonSharedBuffer; function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string; - function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer; - function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer; - function execFileSync(file: string, args: readonly string[]): Buffer; + function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): NonSharedBuffer; + function execFileSync(file: string, options?: ExecFileSyncOptions): string | NonSharedBuffer; + function execFileSync(file: string, args: readonly string[]): NonSharedBuffer; function execFileSync( file: string, args: readonly string[], @@ -1451,8 +1464,12 @@ declare module "child_process" { file: string, args: readonly string[], options: ExecFileSyncOptionsWithBufferEncoding, - ): Buffer; - function execFileSync(file: string, args?: readonly string[], options?: ExecFileSyncOptions): string | Buffer; + ): NonSharedBuffer; + function execFileSync( + file: string, + args?: readonly string[], + options?: ExecFileSyncOptions, + ): string | NonSharedBuffer; } declare module "node:child_process" { export * from "child_process"; diff --git a/backend/node_modules/@types/node/cluster.d.ts b/node_modules/@types/node/cluster.d.ts similarity index 99% rename from backend/node_modules/@types/node/cluster.d.ts rename to node_modules/@types/node/cluster.d.ts index 1a16701..cdbc219 100644 --- a/backend/node_modules/@types/node/cluster.d.ts +++ b/node_modules/@types/node/cluster.d.ts @@ -72,7 +72,7 @@ declare module "cluster" { * String arguments passed to worker. * @default process.argv.slice(2) */ - args?: string[] | undefined; + args?: readonly string[] | undefined; /** * Whether or not to send output to parent's stdio. * @default false diff --git a/backend/node_modules/@types/node/compatibility/iterators.d.ts b/node_modules/@types/node/compatibility/iterators.d.ts similarity index 100% rename from backend/node_modules/@types/node/compatibility/iterators.d.ts rename to node_modules/@types/node/compatibility/iterators.d.ts diff --git a/backend/node_modules/@types/node/console.d.ts b/node_modules/@types/node/console.d.ts similarity index 98% rename from backend/node_modules/@types/node/console.d.ts rename to node_modules/@types/node/console.d.ts index c923bd0..3c8a682 100644 --- a/backend/node_modules/@types/node/console.d.ts +++ b/node_modules/@types/node/console.d.ts @@ -431,9 +431,10 @@ declare module "node:console" { colorMode?: boolean | "auto" | undefined; /** * Specifies options that are passed along to - * [`util.inspect()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilinspectobject-options). + * `util.inspect()`. Can be an options object or, if different options + * for stdout and stderr are desired, a `Map` from stream objects to options. */ - inspectOptions?: InspectOptions | undefined; + inspectOptions?: InspectOptions | ReadonlyMap | undefined; /** * Set group indentation. * @default 2 diff --git a/backend/node_modules/@types/node/constants.d.ts b/node_modules/@types/node/constants.d.ts similarity index 100% rename from backend/node_modules/@types/node/constants.d.ts rename to node_modules/@types/node/constants.d.ts diff --git a/backend/node_modules/@types/node/crypto.d.ts b/node_modules/@types/node/crypto.d.ts similarity index 89% rename from backend/node_modules/@types/node/crypto.d.ts rename to node_modules/@types/node/crypto.d.ts index 237368a..d975caf 100644 --- a/backend/node_modules/@types/node/crypto.d.ts +++ b/node_modules/@types/node/crypto.d.ts @@ -17,6 +17,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/crypto.js) */ declare module "crypto" { + import { NonSharedBuffer } from "node:buffer"; import * as stream from "node:stream"; import { PeerCertificate } from "node:tls"; /** @@ -44,7 +45,7 @@ declare module "crypto" { * @param encoding The `encoding` of the `spkac` string. * @return The challenge component of the `spkac` data structure, which includes a public key and a challenge. */ - static exportChallenge(spkac: BinaryLike): Buffer; + static exportChallenge(spkac: BinaryLike): NonSharedBuffer; /** * ```js * const { Certificate } = await import('node:crypto'); @@ -57,7 +58,7 @@ declare module "crypto" { * @param encoding The `encoding` of the `spkac` string. * @return The public key component of the `spkac` data structure, which includes a public key and a challenge. */ - static exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer; + static exportPublicKey(spkac: BinaryLike, encoding?: string): NonSharedBuffer; /** * ```js * import { Buffer } from 'node:buffer'; @@ -78,7 +79,7 @@ declare module "crypto" { * @returns The challenge component of the `spkac` data structure, * which includes a public key and a challenge. */ - exportChallenge(spkac: BinaryLike): Buffer; + exportChallenge(spkac: BinaryLike): NonSharedBuffer; /** * @deprecated * @param spkac @@ -86,7 +87,7 @@ declare module "crypto" { * @returns The public key component of the `spkac` data structure, * which includes a public key and a challenge. */ - exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer; + exportPublicKey(spkac: BinaryLike, encoding?: string): NonSharedBuffer; /** * @deprecated * @param spkac @@ -402,7 +403,7 @@ declare module "crypto" { * @since v0.1.92 * @param encoding The `encoding` of the return value. */ - digest(): Buffer; + digest(): NonSharedBuffer; digest(encoding: BinaryToTextEncoding): string; } /** @@ -496,7 +497,7 @@ declare module "crypto" { * @since v0.1.94 * @param encoding The `encoding` of the return value. */ - digest(): Buffer; + digest(): NonSharedBuffer; digest(encoding: BinaryToTextEncoding): string; } type KeyObjectType = "secret" | "public" | "private"; @@ -636,8 +637,8 @@ declare module "crypto" { * PKCS#1 and SEC1 encryption. * @since v11.6.0 */ - export(options: KeyExportOptions<"pem">): string | Buffer; - export(options?: KeyExportOptions<"der">): Buffer; + export(options: KeyExportOptions<"pem">): string | NonSharedBuffer; + export(options?: KeyExportOptions<"der">): NonSharedBuffer; export(options?: JwkKeyExportOptions): JsonWebKey; /** * Returns `true` or `false` depending on whether the keys have exactly the same @@ -886,8 +887,8 @@ declare module "crypto" { * @param inputEncoding The `encoding` of the data. * @param outputEncoding The `encoding` of the return value. */ - update(data: BinaryLike): Buffer; - update(data: string, inputEncoding: Encoding): Buffer; + update(data: BinaryLike): NonSharedBuffer; + update(data: string, inputEncoding: Encoding): NonSharedBuffer; update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; /** @@ -898,7 +899,7 @@ declare module "crypto" { * @param outputEncoding The `encoding` of the return value. * @return Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. */ - final(): Buffer; + final(): NonSharedBuffer; final(outputEncoding: BufferEncoding): string; /** * When using block encryption algorithms, the `Cipheriv` class will automatically @@ -924,7 +925,7 @@ declare module "crypto" { plaintextLength: number; }, ): this; - getAuthTag(): Buffer; + getAuthTag(): NonSharedBuffer; } interface CipherGCM extends Cipheriv { setAAD( @@ -933,7 +934,7 @@ declare module "crypto" { plaintextLength: number; }, ): this; - getAuthTag(): Buffer; + getAuthTag(): NonSharedBuffer; } interface CipherOCB extends Cipheriv { setAAD( @@ -942,7 +943,7 @@ declare module "crypto" { plaintextLength: number; }, ): this; - getAuthTag(): Buffer; + getAuthTag(): NonSharedBuffer; } interface CipherChaCha20Poly1305 extends Cipheriv { setAAD( @@ -951,7 +952,7 @@ declare module "crypto" { plaintextLength: number; }, ): this; - getAuthTag(): Buffer; + getAuthTag(): NonSharedBuffer; } /** * Creates and returns a `Decipheriv` object that uses the given `algorithm`, `key` and initialization vector (`iv`). @@ -1136,8 +1137,8 @@ declare module "crypto" { * @param inputEncoding The `encoding` of the `data` string. * @param outputEncoding The `encoding` of the return value. */ - update(data: NodeJS.ArrayBufferView): Buffer; - update(data: string, inputEncoding: Encoding): Buffer; + update(data: NodeJS.ArrayBufferView): NonSharedBuffer; + update(data: string, inputEncoding: Encoding): NonSharedBuffer; update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; /** @@ -1148,7 +1149,7 @@ declare module "crypto" { * @param outputEncoding The `encoding` of the return value. * @return Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. */ - final(): Buffer; + final(): NonSharedBuffer; final(outputEncoding: BufferEncoding): string; /** * When data has been encrypted without standard block padding, calling `decipher.setAutoPadding(false)` will disable automatic padding to prevent `decipher.final()` from checking for and @@ -1310,6 +1311,7 @@ declare module "crypto" { * @since v0.1.92 * @param options `stream.Writable` options */ + // TODO: signing algorithm type function createSign(algorithm: string, options?: stream.WritableOptions): Sign; type DSAEncoding = "der" | "ieee-p1363"; interface SigningOptions { @@ -1319,6 +1321,7 @@ declare module "crypto" { padding?: number | undefined; saltLength?: number | undefined; dsaEncoding?: DSAEncoding | undefined; + context?: ArrayBuffer | NodeJS.ArrayBufferView | undefined; } interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {} interface SignKeyObjectInput extends SigningOptions { @@ -1420,7 +1423,7 @@ declare module "crypto" { * called. Multiple calls to `sign.sign()` will result in an error being thrown. * @since v0.1.92 */ - sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput): Buffer; + sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput): NonSharedBuffer; sign( privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput, outputFormat: BinaryToTextEncoding, @@ -1579,7 +1582,7 @@ declare module "crypto" { * @since v0.5.0 * @param encoding The `encoding` of the return value. */ - generateKeys(): Buffer; + generateKeys(): NonSharedBuffer; generateKeys(encoding: BinaryToTextEncoding): string; /** * Computes the shared secret using `otherPublicKey` as the other @@ -1594,8 +1597,16 @@ declare module "crypto" { * @param inputEncoding The `encoding` of an `otherPublicKey` string. * @param outputEncoding The `encoding` of the return value. */ - computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer; - computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer; + computeSecret( + otherPublicKey: NodeJS.ArrayBufferView, + inputEncoding?: null, + outputEncoding?: null, + ): NonSharedBuffer; + computeSecret( + otherPublicKey: string, + inputEncoding: BinaryToTextEncoding, + outputEncoding?: null, + ): NonSharedBuffer; computeSecret( otherPublicKey: NodeJS.ArrayBufferView, inputEncoding: null, @@ -1613,7 +1624,7 @@ declare module "crypto" { * @since v0.5.0 * @param encoding The `encoding` of the return value. */ - getPrime(): Buffer; + getPrime(): NonSharedBuffer; getPrime(encoding: BinaryToTextEncoding): string; /** * Returns the Diffie-Hellman generator in the specified `encoding`. @@ -1622,7 +1633,7 @@ declare module "crypto" { * @since v0.5.0 * @param encoding The `encoding` of the return value. */ - getGenerator(): Buffer; + getGenerator(): NonSharedBuffer; getGenerator(encoding: BinaryToTextEncoding): string; /** * Returns the Diffie-Hellman public key in the specified `encoding`. @@ -1631,7 +1642,7 @@ declare module "crypto" { * @since v0.5.0 * @param encoding The `encoding` of the return value. */ - getPublicKey(): Buffer; + getPublicKey(): NonSharedBuffer; getPublicKey(encoding: BinaryToTextEncoding): string; /** * Returns the Diffie-Hellman private key in the specified `encoding`. @@ -1640,7 +1651,7 @@ declare module "crypto" { * @since v0.5.0 * @param encoding The `encoding` of the return value. */ - getPrivateKey(): Buffer; + getPrivateKey(): NonSharedBuffer; getPrivateKey(encoding: BinaryToTextEncoding): string; /** * Sets the Diffie-Hellman public key. If the `encoding` argument is provided, `publicKey` is expected @@ -1784,7 +1795,7 @@ declare module "crypto" { iterations: number, keylen: number, digest: string, - callback: (err: Error | null, derivedKey: Buffer) => void, + callback: (err: Error | null, derivedKey: NonSharedBuffer) => void, ): void; /** * Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) @@ -1821,7 +1832,7 @@ declare module "crypto" { iterations: number, keylen: number, digest: string, - ): Buffer; + ): NonSharedBuffer; /** * Generates cryptographically strong pseudorandom data. The `size` argument * is a number indicating the number of bytes to generate. @@ -1874,10 +1885,10 @@ declare module "crypto" { * @param size The number of bytes to generate. The `size` must not be larger than `2**31 - 1`. * @return if the `callback` function is not provided. */ - function randomBytes(size: number): Buffer; - function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; - function pseudoRandomBytes(size: number): Buffer; - function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; + function randomBytes(size: number): NonSharedBuffer; + function randomBytes(size: number, callback: (err: Error | null, buf: NonSharedBuffer) => void): void; + function pseudoRandomBytes(size: number): NonSharedBuffer; + function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: NonSharedBuffer) => void): void; /** * Return a random integer `n` such that `min <= n < max`. This * implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias). @@ -2107,14 +2118,14 @@ declare module "crypto" { password: BinaryLike, salt: BinaryLike, keylen: number, - callback: (err: Error | null, derivedKey: Buffer) => void, + callback: (err: Error | null, derivedKey: NonSharedBuffer) => void, ): void; function scrypt( password: BinaryLike, salt: BinaryLike, keylen: number, options: ScryptOptions, - callback: (err: Error | null, derivedKey: Buffer) => void, + callback: (err: Error | null, derivedKey: NonSharedBuffer) => void, ): void; /** * Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based @@ -2146,7 +2157,12 @@ declare module "crypto" { * ``` * @since v10.5.0 */ - function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer; + function scryptSync( + password: BinaryLike, + salt: BinaryLike, + keylen: number, + options?: ScryptOptions, + ): NonSharedBuffer; interface RsaPublicKey { key: KeyLike; padding?: number | undefined; @@ -2175,7 +2191,7 @@ declare module "crypto" { function publicEncrypt( key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView | string, - ): Buffer; + ): NonSharedBuffer; /** * Decrypts `buffer` with `key`.`buffer` was previously encrypted using * the corresponding private key, for example using {@link privateEncrypt}. @@ -2190,7 +2206,7 @@ declare module "crypto" { function publicDecrypt( key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView | string, - ): Buffer; + ): NonSharedBuffer; /** * Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using * the corresponding public key, for example using {@link publicEncrypt}. @@ -2199,7 +2215,10 @@ declare module "crypto" { * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_OAEP_PADDING`. * @since v0.11.14 */ - function privateDecrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView | string): Buffer; + function privateDecrypt( + privateKey: RsaPrivateKey | KeyLike, + buffer: NodeJS.ArrayBufferView | string, + ): NonSharedBuffer; /** * Encrypts `buffer` with `privateKey`. The returned data can be decrypted using * the corresponding public key, for example using {@link publicDecrypt}. @@ -2208,7 +2227,10 @@ declare module "crypto" { * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_PADDING`. * @since v1.1.0 */ - function privateEncrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView | string): Buffer; + function privateEncrypt( + privateKey: RsaPrivateKey | KeyLike, + buffer: NodeJS.ArrayBufferView | string, + ): NonSharedBuffer; /** * ```js * const { @@ -2337,7 +2359,7 @@ declare module "crypto" { inputEncoding?: BinaryToTextEncoding, outputEncoding?: "latin1" | "hex" | "base64" | "base64url", format?: "uncompressed" | "compressed" | "hybrid", - ): Buffer | string; + ): NonSharedBuffer | string; /** * Generates private and public EC Diffie-Hellman key values, and returns * the public key in the specified `format` and `encoding`. This key should be @@ -2350,7 +2372,7 @@ declare module "crypto" { * @param encoding The `encoding` of the return value. * @param [format='uncompressed'] */ - generateKeys(): Buffer; + generateKeys(): NonSharedBuffer; generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; /** * Computes the shared secret using `otherPublicKey` as the other @@ -2369,8 +2391,8 @@ declare module "crypto" { * @param inputEncoding The `encoding` of the `otherPublicKey` string. * @param outputEncoding The `encoding` of the return value. */ - computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer; - computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer; + computeSecret(otherPublicKey: NodeJS.ArrayBufferView): NonSharedBuffer; + computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): NonSharedBuffer; computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string; computeSecret( otherPublicKey: string, @@ -2384,7 +2406,7 @@ declare module "crypto" { * @param encoding The `encoding` of the return value. * @return The EC Diffie-Hellman in the specified `encoding`. */ - getPrivateKey(): Buffer; + getPrivateKey(): NonSharedBuffer; getPrivateKey(encoding: BinaryToTextEncoding): string; /** * The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified the point will be returned in`'uncompressed'` format. @@ -2396,7 +2418,7 @@ declare module "crypto" { * @param [format='uncompressed'] * @return The EC Diffie-Hellman public key in the specified `encoding` and `format`. */ - getPublicKey(encoding?: null, format?: ECDHKeyFormat): Buffer; + getPublicKey(encoding?: null, format?: ECDHKeyFormat): NonSharedBuffer; getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; /** * Sets the EC Diffie-Hellman private key. @@ -2460,6 +2482,18 @@ declare module "crypto" { | "ml-kem-768" | "rsa-pss" | "rsa" + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s" | "x25519" | "x448"; type KeyFormat = "pem" | "der" | "jwk"; @@ -2478,6 +2512,7 @@ declare module "crypto" { interface X448KeyPairKeyObjectOptions {} interface MLDSAKeyPairKeyObjectOptions {} interface MLKEMKeyPairKeyObjectOptions {} + interface SLHDSAKeyPairKeyObjectOptions {} interface ECKeyPairKeyObjectOptions { /** * Name of the curve to use @@ -2660,6 +2695,15 @@ declare module "crypto" { type: "pkcs8"; }; } + interface SLHDSAKeyPairOptions { + publicKeyEncoding: { + type: "spki"; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: "pkcs8"; + }; + } interface KeyPairSyncResult { publicKey: T1; privateKey: T2; @@ -2713,15 +2757,15 @@ declare module "crypto" { function generateKeyPairSync( type: "rsa", options: RSAKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "rsa", options: RSAKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "rsa", options: RSAKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; function generateKeyPairSync( type: "rsa-pss", @@ -2730,15 +2774,15 @@ declare module "crypto" { function generateKeyPairSync( type: "rsa-pss", options: RSAPSSKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "rsa-pss", options: RSAPSSKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "rsa-pss", options: RSAPSSKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult; function generateKeyPairSync( type: "dsa", @@ -2747,15 +2791,15 @@ declare module "crypto" { function generateKeyPairSync( type: "dsa", options: DSAKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "dsa", options: DSAKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "dsa", options: DSAKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; function generateKeyPairSync( type: "ec", @@ -2764,15 +2808,15 @@ declare module "crypto" { function generateKeyPairSync( type: "ec", options: ECKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "ec", options: ECKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "ec", options: ECKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult; function generateKeyPairSync( type: "ed25519", @@ -2781,15 +2825,15 @@ declare module "crypto" { function generateKeyPairSync( type: "ed25519", options: ED25519KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "ed25519", options: ED25519KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "ed25519", options: ED25519KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; function generateKeyPairSync( type: "ed448", @@ -2798,15 +2842,15 @@ declare module "crypto" { function generateKeyPairSync( type: "ed448", options: ED448KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "ed448", options: ED448KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "ed448", options: ED448KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; function generateKeyPairSync( type: "x25519", @@ -2815,15 +2859,15 @@ declare module "crypto" { function generateKeyPairSync( type: "x25519", options: X25519KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "x25519", options: X25519KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "x25519", options: X25519KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; function generateKeyPairSync( type: "x448", @@ -2832,15 +2876,15 @@ declare module "crypto" { function generateKeyPairSync( type: "x448", options: X448KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "x448", options: X448KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "x448", options: X448KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; function generateKeyPairSync( type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", @@ -2849,15 +2893,15 @@ declare module "crypto" { function generateKeyPairSync( type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", options: MLDSAKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", options: MLDSAKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", options: MLDSAKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", options?: MLDSAKeyPairKeyObjectOptions, @@ -2869,19 +2913,99 @@ declare module "crypto" { function generateKeyPairSync( type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", options: MLKEMKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", options: MLKEMKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", options: MLKEMKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; + ): KeyPairSyncResult; function generateKeyPairSync( type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", options?: MLKEMKeyPairKeyObjectOptions, ): KeyPairKeyObjectResult; + function generateKeyPairSync( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairOptions<"pem", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairOptions<"pem", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairOptions<"der", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairOptions<"der", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options?: SLHDSAKeyPairKeyObjectOptions, + ): KeyPairKeyObjectResult; /** * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, * Ed25519, Ed448, X25519, X448, and DH are currently supported. @@ -2930,17 +3054,17 @@ declare module "crypto" { function generateKeyPair( type: "rsa", options: RSAKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "rsa", options: RSAKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, ): void; function generateKeyPair( type: "rsa", options: RSAKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "rsa", @@ -2955,17 +3079,17 @@ declare module "crypto" { function generateKeyPair( type: "rsa-pss", options: RSAPSSKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "rsa-pss", options: RSAPSSKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, ): void; function generateKeyPair( type: "rsa-pss", options: RSAPSSKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "rsa-pss", @@ -2980,17 +3104,17 @@ declare module "crypto" { function generateKeyPair( type: "dsa", options: DSAKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "dsa", options: DSAKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, ): void; function generateKeyPair( type: "dsa", options: DSAKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "dsa", @@ -3005,17 +3129,17 @@ declare module "crypto" { function generateKeyPair( type: "ec", options: ECKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "ec", options: ECKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, ): void; function generateKeyPair( type: "ec", options: ECKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "ec", @@ -3030,17 +3154,17 @@ declare module "crypto" { function generateKeyPair( type: "ed25519", options: ED25519KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "ed25519", options: ED25519KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, ): void; function generateKeyPair( type: "ed25519", options: ED25519KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "ed25519", @@ -3055,17 +3179,17 @@ declare module "crypto" { function generateKeyPair( type: "ed448", options: ED448KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "ed448", options: ED448KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, ): void; function generateKeyPair( type: "ed448", options: ED448KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "ed448", @@ -3080,17 +3204,17 @@ declare module "crypto" { function generateKeyPair( type: "x25519", options: X25519KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "x25519", options: X25519KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, ): void; function generateKeyPair( type: "x25519", options: X25519KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "x25519", @@ -3105,17 +3229,17 @@ declare module "crypto" { function generateKeyPair( type: "x448", options: X448KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "x448", options: X448KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, ): void; function generateKeyPair( type: "x448", options: X448KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "x448", @@ -3130,17 +3254,17 @@ declare module "crypto" { function generateKeyPair( type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", options: MLDSAKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", options: MLDSAKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, ): void; function generateKeyPair( type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", options: MLDSAKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", @@ -3155,23 +3279,108 @@ declare module "crypto" { function generateKeyPair( type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", options: MLKEMKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", options: MLKEMKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, ): void; function generateKeyPair( type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", options: MLKEMKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, ): void; function generateKeyPair( type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", options: MLKEMKeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, ): void; + function generateKeyPair( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairOptions<"pem", "pem">, + callback: (err: Error | null, publicKey: string, privateKey: string) => void, + ): void; + function generateKeyPair( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairOptions<"pem", "der">, + callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairOptions<"der", "pem">, + callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + ): void; + function generateKeyPair( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairOptions<"der", "der">, + callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairKeyObjectOptions | undefined, + callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, + ): void; namespace generateKeyPair { function __promisify__( type: "rsa", @@ -3185,21 +3394,21 @@ declare module "crypto" { options: RSAKeyPairOptions<"pem", "der">, ): Promise<{ publicKey: string; - privateKey: Buffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "rsa", options: RSAKeyPairOptions<"der", "pem">, ): Promise<{ - publicKey: Buffer; + publicKey: NonSharedBuffer; privateKey: string; }>; function __promisify__( type: "rsa", options: RSAKeyPairOptions<"der", "der">, ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; + publicKey: NonSharedBuffer; + privateKey: NonSharedBuffer; }>; function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise; function __promisify__( @@ -3214,21 +3423,21 @@ declare module "crypto" { options: RSAPSSKeyPairOptions<"pem", "der">, ): Promise<{ publicKey: string; - privateKey: Buffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "rsa-pss", options: RSAPSSKeyPairOptions<"der", "pem">, ): Promise<{ - publicKey: Buffer; + publicKey: NonSharedBuffer; privateKey: string; }>; function __promisify__( type: "rsa-pss", options: RSAPSSKeyPairOptions<"der", "der">, ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; + publicKey: NonSharedBuffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "rsa-pss", @@ -3246,21 +3455,21 @@ declare module "crypto" { options: DSAKeyPairOptions<"pem", "der">, ): Promise<{ publicKey: string; - privateKey: Buffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "dsa", options: DSAKeyPairOptions<"der", "pem">, ): Promise<{ - publicKey: Buffer; + publicKey: NonSharedBuffer; privateKey: string; }>; function __promisify__( type: "dsa", options: DSAKeyPairOptions<"der", "der">, ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; + publicKey: NonSharedBuffer; + privateKey: NonSharedBuffer; }>; function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise; function __promisify__( @@ -3275,21 +3484,21 @@ declare module "crypto" { options: ECKeyPairOptions<"pem", "der">, ): Promise<{ publicKey: string; - privateKey: Buffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "ec", options: ECKeyPairOptions<"der", "pem">, ): Promise<{ - publicKey: Buffer; + publicKey: NonSharedBuffer; privateKey: string; }>; function __promisify__( type: "ec", options: ECKeyPairOptions<"der", "der">, ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; + publicKey: NonSharedBuffer; + privateKey: NonSharedBuffer; }>; function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise; function __promisify__( @@ -3304,21 +3513,21 @@ declare module "crypto" { options: ED25519KeyPairOptions<"pem", "der">, ): Promise<{ publicKey: string; - privateKey: Buffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "ed25519", options: ED25519KeyPairOptions<"der", "pem">, ): Promise<{ - publicKey: Buffer; + publicKey: NonSharedBuffer; privateKey: string; }>; function __promisify__( type: "ed25519", options: ED25519KeyPairOptions<"der", "der">, ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; + publicKey: NonSharedBuffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "ed25519", @@ -3336,21 +3545,21 @@ declare module "crypto" { options: ED448KeyPairOptions<"pem", "der">, ): Promise<{ publicKey: string; - privateKey: Buffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "ed448", options: ED448KeyPairOptions<"der", "pem">, ): Promise<{ - publicKey: Buffer; + publicKey: NonSharedBuffer; privateKey: string; }>; function __promisify__( type: "ed448", options: ED448KeyPairOptions<"der", "der">, ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; + publicKey: NonSharedBuffer; + privateKey: NonSharedBuffer; }>; function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise; function __promisify__( @@ -3365,21 +3574,21 @@ declare module "crypto" { options: X25519KeyPairOptions<"pem", "der">, ): Promise<{ publicKey: string; - privateKey: Buffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "x25519", options: X25519KeyPairOptions<"der", "pem">, ): Promise<{ - publicKey: Buffer; + publicKey: NonSharedBuffer; privateKey: string; }>; function __promisify__( type: "x25519", options: X25519KeyPairOptions<"der", "der">, ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; + publicKey: NonSharedBuffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "x25519", @@ -3397,21 +3606,21 @@ declare module "crypto" { options: X448KeyPairOptions<"pem", "der">, ): Promise<{ publicKey: string; - privateKey: Buffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "x448", options: X448KeyPairOptions<"der", "pem">, ): Promise<{ - publicKey: Buffer; + publicKey: NonSharedBuffer; privateKey: string; }>; function __promisify__( type: "x448", options: X448KeyPairOptions<"der", "der">, ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; + publicKey: NonSharedBuffer; + privateKey: NonSharedBuffer; }>; function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise; function __promisify__( @@ -3426,21 +3635,21 @@ declare module "crypto" { options: MLDSAKeyPairOptions<"pem", "der">, ): Promise<{ publicKey: string; - privateKey: Buffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", options: MLDSAKeyPairOptions<"der", "pem">, ): Promise<{ - publicKey: Buffer; + publicKey: NonSharedBuffer; privateKey: string; }>; function __promisify__( type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", options: MLDSAKeyPairOptions<"der", "der">, ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; + publicKey: NonSharedBuffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87", @@ -3458,26 +3667,118 @@ declare module "crypto" { options: MLKEMKeyPairOptions<"pem", "der">, ): Promise<{ publicKey: string; - privateKey: Buffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", options: MLKEMKeyPairOptions<"der", "pem">, ): Promise<{ - publicKey: Buffer; + publicKey: NonSharedBuffer; privateKey: string; }>; function __promisify__( type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", options: MLKEMKeyPairOptions<"der", "der">, ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; + publicKey: NonSharedBuffer; + privateKey: NonSharedBuffer; }>; function __promisify__( type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768", options?: MLKEMKeyPairKeyObjectOptions, ): Promise; + function __promisify__( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairOptions<"pem", "pem">, + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairOptions<"pem", "der">, + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairOptions<"der", "pem">, + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options: SLHDSAKeyPairOptions<"der", "der">, + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__( + type: + | "slh-dsa-sha2-128f" + | "slh-dsa-sha2-128s" + | "slh-dsa-sha2-192f" + | "slh-dsa-sha2-192s" + | "slh-dsa-sha2-256f" + | "slh-dsa-sha2-256s" + | "slh-dsa-shake-128f" + | "slh-dsa-shake-128s" + | "slh-dsa-shake-192f" + | "slh-dsa-shake-192s" + | "slh-dsa-shake-256f" + | "slh-dsa-shake-256s", + options?: SLHDSAKeyPairKeyObjectOptions, + ): Promise; } /** * Calculates and returns the signature for `data` using the given private key and @@ -3498,12 +3799,12 @@ declare module "crypto" { algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput, - ): Buffer; + ): NonSharedBuffer; function sign( algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput, - callback: (error: Error | null, data: Buffer) => void, + callback: (error: Error | null, data: NonSharedBuffer) => void, ): void; /** * Verifies the given signature for `data` using the given key and algorithm. If @@ -3560,11 +3861,11 @@ declare module "crypto" { function decapsulate( key: KeyLike | PrivateKeyInput | JsonWebKeyInput, ciphertext: ArrayBuffer | NodeJS.ArrayBufferView, - ): Buffer; + ): NonSharedBuffer; function decapsulate( key: KeyLike | PrivateKeyInput | JsonWebKeyInput, ciphertext: ArrayBuffer | NodeJS.ArrayBufferView, - callback: (err: Error, sharedKey: Buffer) => void, + callback: (err: Error, sharedKey: NonSharedBuffer) => void, ): void; /** * Computes the Diffie-Hellman shared secret based on a `privateKey` and a `publicKey`. @@ -3574,10 +3875,10 @@ declare module "crypto" { * If the `callback` function is provided this function uses libuv's threadpool. * @since v13.9.0, v12.17.0 */ - function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer; + function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): NonSharedBuffer; function diffieHellman( options: { privateKey: KeyObject; publicKey: KeyObject }, - callback: (err: Error | null, secret: Buffer) => void, + callback: (err: Error | null, secret: NonSharedBuffer) => void, ): void; /** * Key encapsulation using a KEM algorithm with a public key. @@ -3598,10 +3899,12 @@ declare module "crypto" { * If the `callback` function is provided this function uses libuv's threadpool. * @since v24.7.0 */ - function encapsulate(key: KeyLike | PublicKeyInput | JsonWebKeyInput): { sharedKey: Buffer; ciphertext: Buffer }; function encapsulate( key: KeyLike | PublicKeyInput | JsonWebKeyInput, - callback: (err: Error, result: { sharedKey: Buffer; ciphertext: Buffer }) => void, + ): { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer }; + function encapsulate( + key: KeyLike | PublicKeyInput | JsonWebKeyInput, + callback: (err: Error, result: { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer }) => void, ): void; interface OneShotDigestOptions { /** @@ -3666,12 +3969,12 @@ declare module "crypto" { algorithm: string, data: BinaryLike, options: OneShotDigestOptionsWithBufferEncoding | "buffer", - ): Buffer; + ): NonSharedBuffer; function hash( algorithm: string, data: BinaryLike, options: OneShotDigestOptions | BinaryToTextEncoding | "buffer", - ): string | Buffer; + ): string | NonSharedBuffer; type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts"; interface CipherInfoOptions { /** @@ -3963,7 +4266,7 @@ declare module "crypto" { * A `Buffer` containing the DER encoding of this certificate. * @since v15.6.0 */ - readonly raw: Buffer; + readonly raw: NonSharedBuffer; /** * The serial number of this certificate. * @@ -3973,6 +4276,16 @@ declare module "crypto" { * @since v15.6.0 */ readonly serialNumber: string; + /** + * The algorithm used to sign the certificate or `undefined` if the signature algorithm is unknown by OpenSSL. + * @since v24.9.0 + */ + readonly signatureAlgorithm: string | undefined; + /** + * The OID of the algorithm used to sign the certificate. + * @since v24.9.0 + */ + readonly signatureAlgorithmOid: string; /** * The date/time from which this certificate is considered valid. * @since v15.6.0 @@ -4331,7 +4644,7 @@ declare module "crypto" { function argon2( algorithm: Argon2Algorithm, parameters: Argon2Parameters, - callback: (err: Error | null, derivedKey: Buffer) => void, + callback: (err: Error | null, derivedKey: NonSharedBuffer) => void, ): void; /** * Provides a synchronous [Argon2][] implementation. Argon2 is a password-based @@ -4368,7 +4681,7 @@ declare module "crypto" { * @since v24.7.0 * @experimental */ - function argon2Sync(algorithm: Argon2Algorithm, parameters: Argon2Parameters): Buffer; + function argon2Sync(algorithm: Argon2Algorithm, parameters: Argon2Parameters): NonSharedBuffer; /** * A convenient alias for `crypto.webcrypto.subtle`. * @since v17.4.0 @@ -4433,6 +4746,15 @@ declare module "crypto" { interface Algorithm { name: string; } + interface Argon2Params extends Algorithm { + associatedData?: BufferSource; + memory: number; + nonce: BufferSource; + parallelism: number; + passes: number; + secretValue?: BufferSource; + version?: number; + } interface CShakeParams extends Algorithm { customization?: BufferSource; functionName?: BufferSource; @@ -4456,9 +4778,6 @@ declare module "crypto" { interface EcdsaParams extends Algorithm { hash: HashAlgorithmIdentifier; } - interface Ed448Params extends Algorithm { - context?: BufferSource; - } interface HkdfParams extends Algorithm { hash: HashAlgorithmIdentifier; info: BufferSource; @@ -4499,6 +4818,19 @@ declare module "crypto" { interface KeyAlgorithm { name: string; } + interface KmacImportParams extends Algorithm { + length?: number; + } + interface KmacKeyAlgorithm extends KeyAlgorithm { + length: number; + } + interface KmacKeyGenParams extends Algorithm { + length?: number; + } + interface KmacParams extends Algorithm { + customization?: BufferSource; + length: number; + } interface Pbkdf2Params extends Algorithm { hash: HashAlgorithmIdentifier; iterations: number; @@ -4628,6 +4960,10 @@ declare module "crypto" { */ interface SubtleCrypto { /** + * A message recipient uses their asymmetric private key to decrypt an + * "encapsulated key" (ciphertext), thereby recovering a temporary symmetric + * key (represented as `ArrayBuffer`) which is then used to decrypt a message. + * * The algorithms currently supported include: * * * `'ML-KEM-512'` @@ -4642,6 +4978,10 @@ declare module "crypto" { ciphertext: BufferSource, ): Promise; /** + * A message recipient uses their asymmetric private key to decrypt an + * "encapsulated key" (ciphertext), thereby recovering a temporary symmetric + * key (represented as `CryptoKey`) which is then used to decrypt a message. + * * The algorithms currently supported include: * * * `'ML-KEM-512'` @@ -4655,13 +4995,13 @@ declare module "crypto" { decapsulationAlgorithm: AlgorithmIdentifier, decapsulationKey: CryptoKey, ciphertext: BufferSource, - sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams, + sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams, extractable: boolean, usages: KeyUsage[], ): Promise; /** * Using the method and parameters specified in `algorithm` and the keying material provided by `key`, - * `subtle.decrypt()` attempts to decipher the provided `data`. If successful, + * this method attempts to decipher the provided `data`. If successful, * the returned promise will be resolved with an `` containing the plaintext result. * * The algorithms currently supported include: @@ -4681,7 +5021,7 @@ declare module "crypto" { ): Promise; /** * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`, - * `subtle.deriveBits()` attempts to generate `length` bits. + * this method attempts to generate `length` bits. * The Node.js implementation requires that when `length` is a number it must be multiple of `8`. * When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed * for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms. @@ -4689,6 +5029,9 @@ declare module "crypto" { * * The algorithms currently supported include: * + * * `'Argon2d'` + * * `'Argon2i'` + * * `'Argon2id'` * * `'ECDH'` * * `'HKDF'` * * `'PBKDF2'` @@ -4702,19 +5045,22 @@ declare module "crypto" { length?: number | null, ): Promise; deriveBits( - algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, + algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params | Argon2Params, baseKey: CryptoKey, length: number, ): Promise; /** * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`, - * `subtle.deriveKey()` attempts to generate a new ` based on the method and parameters in `derivedKeyAlgorithm`. + * this method attempts to generate a new ` based on the method and parameters in `derivedKeyAlgorithm`. * * Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material, * then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input. * * The algorithms currently supported include: * + * * `'Argon2d'` + * * `'Argon2i'` + * * `'Argon2id'` * * `'ECDH'` * * `'HKDF'` * * `'PBKDF2'` @@ -4724,9 +5070,9 @@ declare module "crypto" { * @since v15.0.0 */ deriveKey( - algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, + algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params | Argon2Params, baseKey: CryptoKey, - derivedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams, + derivedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams, extractable: boolean, keyUsages: readonly KeyUsage[], ): Promise; @@ -4751,6 +5097,9 @@ declare module "crypto" { */ digest(algorithm: AlgorithmIdentifier | CShakeParams, data: BufferSource): Promise; /** + * Uses a message recipient's asymmetric public key to encrypt a temporary symmetric key. + * This encrypted key is the "encapsulated key" represented as `EncapsulatedBits`. + * * The algorithms currently supported include: * * * `'ML-KEM-512'` @@ -4764,6 +5113,9 @@ declare module "crypto" { encapsulationKey: CryptoKey, ): Promise; /** + * Uses a message recipient's asymmetric public key to encrypt a temporary symmetric key. + * This encrypted key is the "encapsulated key" represented as `EncapsulatedKey`. + * * The algorithms currently supported include: * * * `'ML-KEM-512'` @@ -4776,13 +5128,13 @@ declare module "crypto" { encapsulateKey( encapsulationAlgorithm: AlgorithmIdentifier, encapsulationKey: CryptoKey, - sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams, + sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams, extractable: boolean, usages: KeyUsage[], ): Promise; /** * Using the method and parameters specified by `algorithm` and the keying material provided by `key`, - * `subtle.encrypt()` attempts to encipher `data`. If successful, + * this method attempts to encipher `data`. If successful, * the returned promise is resolved with an `` containing the encrypted result. * * The algorithms currently supported include: @@ -4818,9 +5170,9 @@ declare module "crypto" { exportKey(format: "jwk", key: CryptoKey): Promise; exportKey(format: Exclude, key: CryptoKey): Promise; /** - * Using the method and parameters provided in `algorithm`, `subtle.generateKey()` - * attempts to generate new keying material. Depending the method used, the method - * may generate either a single `CryptoKey` or a `CryptoKeyPair`. + * Using the parameters provided in `algorithm`, this method + * attempts to generate new keying material. Depending on the algorithm used + * either a single `CryptoKey` or a `CryptoKeyPair` is generated. * * The `CryptoKeyPair` (public and private key) generating algorithms supported * include: @@ -4841,7 +5193,7 @@ declare module "crypto" { * * `'X25519'` * * `'X448'` * - * The {CryptoKey} (secret key) generating algorithms supported include: + * The `CryptoKey` (secret key) generating algorithms supported include: * * `'AES-CBC'` * * `'AES-CTR'` * * `'AES-GCM'` @@ -4849,6 +5201,8 @@ declare module "crypto" { * * `'AES-OCB'` * * `'ChaCha20-Poly1305'` * * `'HMAC'` + * * `'KMAC128'` + * * `'KMAC256'` * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. * @since v15.0.0 */ @@ -4858,7 +5212,7 @@ declare module "crypto" { keyUsages: readonly KeyUsage[], ): Promise; generateKey( - algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, + algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params | KmacKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[], ): Promise; @@ -4876,11 +5230,13 @@ declare module "crypto" { */ getPublicKey(key: CryptoKey, keyUsages: KeyUsage[]): Promise; /** - * The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format` - * to create a `` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments. - * If the import is successful, the returned promise will be resolved with the created ``. + * This method attempts to interpret the provided `keyData` + * as the given `format` to create a `CryptoKey` instance using the provided + * `algorithm`, `extractable`, and `keyUsages` arguments. If the import is + * successful, the returned promise will be resolved with a {CryptoKey} + * representation of the key material. * - * If importing a `'PBKDF2'` key, `extractable` must be `false`. + * If importing KDF algorithm keys, `extractable` must be `false`. * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`, * `'raw-public'`, or `'raw-seed'`. * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. @@ -4894,7 +5250,8 @@ declare module "crypto" { | RsaHashedImportParams | EcKeyImportParams | HmacImportParams - | AesKeyAlgorithm, + | AesKeyAlgorithm + | KmacImportParams, extractable: boolean, keyUsages: readonly KeyUsage[], ): Promise; @@ -4906,13 +5263,14 @@ declare module "crypto" { | RsaHashedImportParams | EcKeyImportParams | HmacImportParams - | AesKeyAlgorithm, + | AesKeyAlgorithm + | KmacImportParams, extractable: boolean, keyUsages: KeyUsage[], ): Promise; /** * Using the method and parameters given by `algorithm` and the keying material provided by `key`, - * `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful, + * this method attempts to generate a cryptographic signature of `data`. If successful, * the returned promise is resolved with an `` containing the generated signature. * * The algorithms currently supported include: @@ -4921,6 +5279,8 @@ declare module "crypto" { * * `'Ed25519'` * * `'Ed448'` * * `'HMAC'` + * * `'KMAC128'` + * * `'KMAC256'` * * `'ML-DSA-44'` * * `'ML-DSA-65'` * * `'ML-DSA-87'` @@ -4929,13 +5289,13 @@ declare module "crypto" { * @since v15.0.0 */ sign( - algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params | ContextParams, + algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | ContextParams | KmacParams, key: CryptoKey, data: BufferSource, ): Promise; /** * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. - * The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `` instance. + * This method attempts to decrypt a wrapped key and create a `` instance. * It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input) * then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs. * If successful, the returned promise is resolved with a `` object. @@ -4963,6 +5323,8 @@ declare module "crypto" { * * `'Ed25519'` * * `'Ed448'` * * `'HMAC'` + * * `'KMAC128'` + * * `'KMAC256'` * * `'ML-DSA-44'` * * `'ML-DSA-65'` * * `'ML-DSA-87'` @@ -4989,21 +5351,24 @@ declare module "crypto" { | RsaHashedImportParams | EcKeyImportParams | HmacImportParams - | AesKeyAlgorithm, + | AesKeyAlgorithm + | KmacImportParams, extractable: boolean, keyUsages: KeyUsage[], ): Promise; /** * Using the method and parameters given in `algorithm` and the keying material provided by `key`, - * `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`. + * This method attempts to verify that `signature` is a valid cryptographic signature of `data`. * The returned promise is resolved with either `true` or `false`. * * The algorithms currently supported include: * * * `'ECDSA'` * * `'Ed25519'` - * * `'Ed448'`[^secure-curves] + * * `'Ed448'` * * `'HMAC'` + * * `'KMAC128'` + * * `'KMAC256'` * * `'ML-DSA-44'` * * `'ML-DSA-65'` * * `'ML-DSA-87'` @@ -5012,14 +5377,14 @@ declare module "crypto" { * @since v15.0.0 */ verify( - algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params | ContextParams, + algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | ContextParams | KmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource, ): Promise; /** * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. - * The `subtle.wrapKey()` method exports the keying material into the format identified by `format`, + * This method exports the keying material into the format identified by `format`, * then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`. * It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments, * then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs. diff --git a/backend/node_modules/@types/node/dgram.d.ts b/node_modules/@types/node/dgram.d.ts similarity index 97% rename from backend/node_modules/@types/node/dgram.d.ts rename to node_modules/@types/node/dgram.d.ts index 35239f9..bc69f0b 100644 --- a/backend/node_modules/@types/node/dgram.d.ts +++ b/node_modules/@types/node/dgram.d.ts @@ -26,6 +26,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/dgram.js) */ declare module "dgram" { + import { NonSharedBuffer } from "node:buffer"; import { AddressInfo, BlockList } from "node:net"; import * as dns from "node:dns"; import { Abortable, EventEmitter } from "node:events"; @@ -85,8 +86,8 @@ declare module "dgram" { * @param options Available options are: * @param callback Attached as a listener for `'message'` events. Optional. */ - function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; - function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; + function createSocket(type: SocketType, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket; + function createSocket(options: SocketOptions, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket; /** * Encapsulates the datagram functionality. * @@ -556,37 +557,37 @@ declare module "dgram" { addListener(event: "connect", listener: () => void): this; addListener(event: "error", listener: (err: Error) => void): this; addListener(event: "listening", listener: () => void): this; - addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + addListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this; emit(event: string | symbol, ...args: any[]): boolean; emit(event: "close"): boolean; emit(event: "connect"): boolean; emit(event: "error", err: Error): boolean; emit(event: "listening"): boolean; - emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean; + emit(event: "message", msg: NonSharedBuffer, rinfo: RemoteInfo): boolean; on(event: string, listener: (...args: any[]) => void): this; on(event: "close", listener: () => void): this; on(event: "connect", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; on(event: "listening", listener: () => void): this; - on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + on(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this; once(event: string, listener: (...args: any[]) => void): this; once(event: "close", listener: () => void): this; once(event: "connect", listener: () => void): this; once(event: "error", listener: (err: Error) => void): this; once(event: "listening", listener: () => void): this; - once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + once(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; prependListener(event: "close", listener: () => void): this; prependListener(event: "connect", listener: () => void): this; prependListener(event: "error", listener: (err: Error) => void): this; prependListener(event: "listening", listener: () => void): this; - prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + prependListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: "close", listener: () => void): this; prependOnceListener(event: "connect", listener: () => void): this; prependOnceListener(event: "error", listener: (err: Error) => void): this; prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + prependOnceListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this; /** * Calls `socket.close()` and returns a promise that fulfills when the socket has closed. * @since v20.5.0 diff --git a/backend/node_modules/@types/node/diagnostics_channel.d.ts b/node_modules/@types/node/diagnostics_channel.d.ts similarity index 99% rename from backend/node_modules/@types/node/diagnostics_channel.d.ts rename to node_modules/@types/node/diagnostics_channel.d.ts index fa5ed69..025847d 100644 --- a/backend/node_modules/@types/node/diagnostics_channel.d.ts +++ b/node_modules/@types/node/diagnostics_channel.d.ts @@ -189,7 +189,6 @@ declare module "diagnostics_channel" { * }); * ``` * @since v15.1.0, v14.17.0 - * @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)} * @param onMessage The handler to receive channel messages */ subscribe(onMessage: ChannelListener): void; @@ -210,7 +209,6 @@ declare module "diagnostics_channel" { * channel.unsubscribe(onMessage); * ``` * @since v15.1.0, v14.17.0 - * @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)} * @param onMessage The previous subscribed handler to remove * @return `true` if the handler was found, `false` otherwise. */ diff --git a/backend/node_modules/@types/node/dns.d.ts b/node_modules/@types/node/dns.d.ts similarity index 100% rename from backend/node_modules/@types/node/dns.d.ts rename to node_modules/@types/node/dns.d.ts diff --git a/backend/node_modules/@types/node/dns/promises.d.ts b/node_modules/@types/node/dns/promises.d.ts similarity index 100% rename from backend/node_modules/@types/node/dns/promises.d.ts rename to node_modules/@types/node/dns/promises.d.ts diff --git a/backend/node_modules/@types/node/domain.d.ts b/node_modules/@types/node/domain.d.ts similarity index 100% rename from backend/node_modules/@types/node/domain.d.ts rename to node_modules/@types/node/domain.d.ts diff --git a/backend/node_modules/@types/node/events.d.ts b/node_modules/@types/node/events.d.ts similarity index 100% rename from backend/node_modules/@types/node/events.d.ts rename to node_modules/@types/node/events.d.ts diff --git a/backend/node_modules/@types/node/fs.d.ts b/node_modules/@types/node/fs.d.ts similarity index 97% rename from backend/node_modules/@types/node/fs.d.ts rename to node_modules/@types/node/fs.d.ts index 0e13307..b300ca4 100644 --- a/backend/node_modules/@types/node/fs.d.ts +++ b/node_modules/@types/node/fs.d.ts @@ -19,6 +19,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/fs.js) */ declare module "fs" { + import { NonSharedBuffer } from "node:buffer"; import * as stream from "node:stream"; import { Abortable, EventEmitter } from "node:events"; import { URL } from "node:url"; @@ -394,23 +395,29 @@ declare module "fs" { * 3. error */ addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; + addListener(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this; addListener(event: "close", listener: () => void): this; addListener(event: "error", listener: (error: Error) => void): this; on(event: string, listener: (...args: any[]) => void): this; - on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; + on(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this; on(event: "close", listener: () => void): this; on(event: "error", listener: (error: Error) => void): this; once(event: string, listener: (...args: any[]) => void): this; - once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; + once(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this; once(event: "close", listener: () => void): this; once(event: "error", listener: (error: Error) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; + prependListener( + event: "change", + listener: (eventType: string, filename: string | NonSharedBuffer) => void, + ): this; prependListener(event: "close", listener: () => void): this; prependListener(event: "error", listener: (error: Error) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; + prependOnceListener( + event: "change", + listener: (eventType: string, filename: string | NonSharedBuffer) => void, + ): this; prependOnceListener(event: "close", listener: () => void): this; prependOnceListener(event: "error", listener: (error: Error) => void): this; } @@ -1550,7 +1557,7 @@ declare module "fs" { export function readlink( path: PathLike, options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, linkString: NonSharedBuffer) => void, ): void; /** * Asynchronous readlink(2) - read value of a symbolic link. @@ -1560,7 +1567,7 @@ declare module "fs" { export function readlink( path: PathLike, options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, linkString: string | NonSharedBuffer) => void, ): void; /** * Asynchronous readlink(2) - read value of a symbolic link. @@ -1582,13 +1589,13 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; + function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; /** * Asynchronous readlink(2) - read value of a symbolic link. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; + function __promisify__(path: PathLike, options?: EncodingOption): Promise; } /** * Returns the symbolic link's string value. @@ -1607,13 +1614,13 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer; + export function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer; /** * Synchronous readlink(2) - read value of a symbolic link. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readlinkSync(path: PathLike, options?: EncodingOption): string | Buffer; + export function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer; /** * Asynchronously computes the canonical pathname by resolving `.`, `..`, and * symbolic links. @@ -1653,7 +1660,7 @@ declare module "fs" { export function realpath( path: PathLike, options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void, ): void; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. @@ -1663,7 +1670,7 @@ declare module "fs" { export function realpath( path: PathLike, options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void, ): void; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. @@ -1685,13 +1692,13 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; + function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; + function __promisify__(path: PathLike, options?: EncodingOption): Promise; /** * Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html). * @@ -1717,12 +1724,12 @@ declare module "fs" { function native( path: PathLike, options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void, ): void; function native( path: PathLike, options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void, ): void; function native( path: PathLike, @@ -1742,17 +1749,17 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer; + export function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer; /** * Synchronous realpath(3) - return the canonicalized absolute pathname. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function realpathSync(path: PathLike, options?: EncodingOption): string | Buffer; + export function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer; export namespace realpathSync { function native(path: PathLike, options?: EncodingOption): string; - function native(path: PathLike, options: BufferEncodingOption): Buffer; - function native(path: PathLike, options?: EncodingOption): string | Buffer; + function native(path: PathLike, options: BufferEncodingOption): NonSharedBuffer; + function native(path: PathLike, options?: EncodingOption): string | NonSharedBuffer; } /** * Asynchronously removes a file or symbolic link. No arguments other than a @@ -2122,12 +2129,8 @@ declare module "fs" { */ export function mkdtemp( prefix: string, - options: - | "buffer" - | { - encoding: "buffer"; - }, - callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void, + options: BufferEncodingOption, + callback: (err: NodeJS.ErrnoException | null, folder: NonSharedBuffer) => void, ): void; /** * Asynchronously creates a unique temporary directory. @@ -2137,7 +2140,7 @@ declare module "fs" { export function mkdtemp( prefix: string, options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, folder: string | NonSharedBuffer) => void, ): void; /** * Asynchronously creates a unique temporary directory. @@ -2159,13 +2162,13 @@ declare module "fs" { * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function __promisify__(prefix: string, options: BufferEncodingOption): Promise; + function __promisify__(prefix: string, options: BufferEncodingOption): Promise; /** * Asynchronously creates a unique temporary directory. * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function __promisify__(prefix: string, options?: EncodingOption): Promise; + function __promisify__(prefix: string, options?: EncodingOption): Promise; } /** * Returns the created directory path. @@ -2183,13 +2186,13 @@ declare module "fs" { * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer; + export function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer; /** * Synchronously creates a unique temporary directory. * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function mkdtempSync(prefix: string, options?: EncodingOption): string | Buffer; + export function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer; export interface DisposableTempDir extends AsyncDisposable { /** * The path of the created directory. @@ -2263,7 +2266,7 @@ declare module "fs" { recursive?: boolean | undefined; } | "buffer", - callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void, + callback: (err: NodeJS.ErrnoException | null, files: NonSharedBuffer[]) => void, ): void; /** * Asynchronous readdir(3) - read a directory. @@ -2280,7 +2283,7 @@ declare module "fs" { | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void, + callback: (err: NodeJS.ErrnoException | null, files: string[] | NonSharedBuffer[]) => void, ): void; /** * Asynchronous readdir(3) - read a directory. @@ -2315,7 +2318,7 @@ declare module "fs" { withFileTypes: true; recursive?: boolean | undefined; }, - callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void, + callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void, ): void; export namespace readdir { /** @@ -2348,7 +2351,7 @@ declare module "fs" { withFileTypes?: false | undefined; recursive?: boolean | undefined; }, - ): Promise; + ): Promise; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -2363,7 +2366,7 @@ declare module "fs" { }) | BufferEncoding | null, - ): Promise; + ): Promise; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -2388,7 +2391,7 @@ declare module "fs" { withFileTypes: true; recursive?: boolean | undefined; }, - ): Promise[]>; + ): Promise[]>; } /** * Reads the contents of the directory. @@ -2428,7 +2431,7 @@ declare module "fs" { recursive?: boolean | undefined; } | "buffer", - ): Buffer[]; + ): NonSharedBuffer[]; /** * Synchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -2443,7 +2446,7 @@ declare module "fs" { }) | BufferEncoding | null, - ): string[] | Buffer[]; + ): string[] | NonSharedBuffer[]; /** * Synchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -2468,7 +2471,7 @@ declare module "fs" { withFileTypes: true; recursive?: boolean | undefined; }, - ): Dirent[]; + ): Dirent[]; /** * Closes the file descriptor. No arguments other than a possible exception are * given to the completion callback. @@ -2835,7 +2838,7 @@ declare module "fs" { encoding?: BufferEncoding | null, ): number; export type ReadPosition = number | bigint; - export interface ReadSyncOptions { + export interface ReadOptions { /** * @default 0 */ @@ -2849,9 +2852,15 @@ declare module "fs" { */ position?: ReadPosition | null | undefined; } - export interface ReadAsyncOptions extends ReadSyncOptions { - buffer?: TBuffer; + export interface ReadOptionsWithBuffer extends ReadOptions { + buffer?: T | undefined; } + /** @deprecated Use `ReadOptions` instead. */ + // TODO: remove in future major + export interface ReadSyncOptions extends ReadOptions {} + /** @deprecated Use `ReadOptionsWithBuffer` instead. */ + // TODO: remove in future major + export interface ReadAsyncOptions extends ReadOptionsWithBuffer {} /** * Read data from the file specified by `fd`. * @@ -2886,15 +2895,15 @@ declare module "fs" { * `position` defaults to `null` * @since v12.17.0, 13.11.0 */ - export function read( + export function read( fd: number, - options: ReadAsyncOptions, + options: ReadOptionsWithBuffer, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, ): void; export function read( fd: number, buffer: TBuffer, - options: ReadSyncOptions, + options: ReadOptions, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, ): void; export function read( @@ -2904,7 +2913,7 @@ declare module "fs" { ): void; export function read( fd: number, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void, + callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NonSharedBuffer) => void, ): void; export namespace read { /** @@ -2924,16 +2933,16 @@ declare module "fs" { bytesRead: number; buffer: TBuffer; }>; - function __promisify__( + function __promisify__( fd: number, - options: ReadAsyncOptions, + options: ReadOptionsWithBuffer, ): Promise<{ bytesRead: number; buffer: TBuffer; }>; function __promisify__(fd: number): Promise<{ bytesRead: number; - buffer: NodeJS.ArrayBufferView; + buffer: NonSharedBuffer; }>; } /** @@ -2955,7 +2964,7 @@ declare module "fs" { * Similar to the above `fs.readSync` function, this version takes an optional `options` object. * If no `options` object is specified, it will default with the above values. */ - export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number; + export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number; /** * Asynchronously reads the entire contents of a file. * @@ -3628,12 +3637,12 @@ declare module "fs" { export function watch( filename: PathLike, options: WatchOptionsWithBufferEncoding | "buffer", - listener: WatchListener, + listener: WatchListener, ): FSWatcher; export function watch( filename: PathLike, options: WatchOptions | BufferEncoding | "buffer" | null, - listener: WatchListener, + listener: WatchListener, ): FSWatcher; export function watch(filename: PathLike, listener: WatchListener): FSWatcher; /** @@ -4344,27 +4353,29 @@ declare module "fs" { * @since v12.9.0 * @param [position='null'] */ - export function writev( + export function writev( fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void, + buffers: TBuffers, + cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void, ): void; - export function writev( + export function writev( fd: number, - buffers: readonly NodeJS.ArrayBufferView[], + buffers: TBuffers, position: number | null, - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void, + cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void, ): void; - export interface WriteVResult { + // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314 + // TODO: remove default in future major version + export interface WriteVResult { bytesWritten: number; - buffers: NodeJS.ArrayBufferView[]; + buffers: T; } export namespace writev { - function __promisify__( + function __promisify__( fd: number, - buffers: readonly NodeJS.ArrayBufferView[], + buffers: TBuffers, position?: number, - ): Promise; + ): Promise>; } /** * For detailed information, see the documentation of the asynchronous version of @@ -4389,27 +4400,29 @@ declare module "fs" { * @since v13.13.0, v12.17.0 * @param [position='null'] */ - export function readv( + export function readv( fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void, + buffers: TBuffers, + cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void, ): void; - export function readv( + export function readv( fd: number, - buffers: readonly NodeJS.ArrayBufferView[], + buffers: TBuffers, position: number | null, - cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void, + cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void, ): void; - export interface ReadVResult { + // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314 + // TODO: remove default in future major version + export interface ReadVResult { bytesRead: number; - buffers: NodeJS.ArrayBufferView[]; + buffers: T; } export namespace readv { - function __promisify__( + function __promisify__( fd: number, - buffers: readonly NodeJS.ArrayBufferView[], + buffers: TBuffers, position?: number, - ): Promise; + ): Promise>; } /** * For detailed information, see the documentation of the asynchronous version of diff --git a/backend/node_modules/@types/node/fs/promises.d.ts b/node_modules/@types/node/fs/promises.d.ts similarity index 96% rename from backend/node_modules/@types/node/fs/promises.d.ts rename to node_modules/@types/node/fs/promises.d.ts index adddd09..986b6da 100644 --- a/backend/node_modules/@types/node/fs/promises.d.ts +++ b/node_modules/@types/node/fs/promises.d.ts @@ -9,6 +9,7 @@ * @since v10.0.0 */ declare module "fs/promises" { + import { NonSharedBuffer } from "node:buffer"; import { Abortable } from "node:events"; import { Stream } from "node:stream"; import { ReadableStream } from "node:stream/web"; @@ -31,6 +32,8 @@ declare module "fs/promises" { OpenDirOptions, OpenMode, PathLike, + ReadOptions, + ReadOptionsWithBuffer, ReadPosition, ReadStream, ReadVResult, @@ -59,6 +62,7 @@ declare module "fs/promises" { bytesRead: number; buffer: T; } + /** @deprecated This interface will be removed in a future version. Use `import { ReadOptionsWithBuffer } from "node:fs"` instead. */ interface FileReadOptions { /** * @default `Buffer.alloc(0xffff)` @@ -237,11 +241,13 @@ declare module "fs/promises" { length?: number | null, position?: ReadPosition | null, ): Promise>; - read( + read( buffer: T, - options?: FileReadOptions, + options?: ReadOptions, + ): Promise>; + read( + options?: ReadOptionsWithBuffer, ): Promise>; - read(options?: FileReadOptions): Promise>; /** * Returns a byte-oriented `ReadableStream` that may be used to read the file's * contents. @@ -285,7 +291,7 @@ declare module "fs/promises" { options?: | ({ encoding?: null | undefined } & Abortable) | null, - ): Promise; + ): Promise; /** * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. * The `FileHandle` must have been opened for reading. @@ -304,7 +310,7 @@ declare module "fs/promises" { | (ObjectEncodingOptions & Abortable) | BufferEncoding | null, - ): Promise; + ): Promise; /** * Convenience method to create a `readline` interface and stream over the file. * See `filehandle.createReadStream()` for the options. @@ -413,7 +419,7 @@ declare module "fs/promises" { * @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current * position. See the POSIX pwrite(2) documentation for more detail. */ - write( + write( buffer: TBuffer, offset?: number | null, length?: number | null, @@ -452,14 +458,20 @@ declare module "fs/promises" { * @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current * position. */ - writev(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise; + writev( + buffers: TBuffers, + position?: number, + ): Promise>; /** * Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s * @since v13.13.0, v12.17.0 * @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position. * @return Fulfills upon success an object containing two properties: */ - readv(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise; + readv( + buffers: TBuffers, + position?: number, + ): Promise>; /** * Closes the file handle after waiting for any pending operation on the handle to * complete. @@ -696,7 +708,7 @@ declare module "fs/promises" { recursive?: boolean | undefined; } | "buffer", - ): Promise; + ): Promise; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -711,7 +723,7 @@ declare module "fs/promises" { }) | BufferEncoding | null, - ): Promise; + ): Promise; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -736,7 +748,7 @@ declare module "fs/promises" { withFileTypes: true; recursive?: boolean | undefined; }, - ): Promise[]>; + ): Promise[]>; /** * Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is * fulfilled with the`linkString` upon success. @@ -754,13 +766,16 @@ declare module "fs/promises" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function readlink(path: PathLike, options: BufferEncodingOption): Promise; + function readlink(path: PathLike, options: BufferEncodingOption): Promise; /** * Asynchronous readlink(2) - read value of a symbolic link. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function readlink(path: PathLike, options?: ObjectEncodingOptions | string | null): Promise; + function readlink( + path: PathLike, + options?: ObjectEncodingOptions | string | null, + ): Promise; /** * Creates a symbolic link. * @@ -911,7 +926,7 @@ declare module "fs/promises" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function realpath(path: PathLike, options: BufferEncodingOption): Promise; + function realpath(path: PathLike, options: BufferEncodingOption): Promise; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -920,7 +935,7 @@ declare module "fs/promises" { function realpath( path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null, - ): Promise; + ): Promise; /** * Creates a unique temporary directory. A unique directory name is generated by * appending six random characters to the end of the provided `prefix`. Due to @@ -956,13 +971,16 @@ declare module "fs/promises" { * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function mkdtemp(prefix: string, options: BufferEncodingOption): Promise; + function mkdtemp(prefix: string, options: BufferEncodingOption): Promise; /** * Asynchronously creates a unique temporary directory. * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + function mkdtemp( + prefix: string, + options?: ObjectEncodingOptions | BufferEncoding | null, + ): Promise; /** * The resulting Promise holds an async-disposable object whose `path` property * holds the created directory path. When the object is disposed, the directory @@ -1138,7 +1156,7 @@ declare module "fs/promises" { flag?: OpenMode | undefined; } & Abortable) | null, - ): Promise; + ): Promise; /** * Asynchronously reads the entire contents of a file. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -1174,7 +1192,7 @@ declare module "fs/promises" { ) | BufferEncoding | null, - ): Promise; + ): Promise; /** * Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail. * @@ -1251,11 +1269,11 @@ declare module "fs/promises" { function watch( filename: PathLike, options: WatchOptionsWithBufferEncoding | "buffer", - ): NodeJS.AsyncIterator>; + ): NodeJS.AsyncIterator>; function watch( filename: PathLike, options: WatchOptions | BufferEncoding | "buffer", - ): NodeJS.AsyncIterator>; + ): NodeJS.AsyncIterator>; /** * Asynchronously copies the entire directory structure from `src` to `dest`, * including subdirectories and files. diff --git a/backend/node_modules/@types/node/globals.d.ts b/node_modules/@types/node/globals.d.ts similarity index 100% rename from backend/node_modules/@types/node/globals.d.ts rename to node_modules/@types/node/globals.d.ts diff --git a/node_modules/@types/node/globals.typedarray.d.ts b/node_modules/@types/node/globals.typedarray.d.ts new file mode 100644 index 0000000..cae4c0b --- /dev/null +++ b/node_modules/@types/node/globals.typedarray.d.ts @@ -0,0 +1,41 @@ +export {}; // Make this a module + +declare global { + namespace NodeJS { + type TypedArray = + | Uint8Array + | Uint8ClampedArray + | Uint16Array + | Uint32Array + | Int8Array + | Int16Array + | Int32Array + | BigUint64Array + | BigInt64Array + | Float16Array + | Float32Array + | Float64Array; + type ArrayBufferView = + | TypedArray + | DataView; + + // The following aliases are required to allow use of non-shared ArrayBufferViews in @types/node + // while maintaining compatibility with TS <=5.6. + // TODO: remove once @types/node no longer supports TS 5.6, and replace with native types. + type NonSharedUint8Array = Uint8Array; + type NonSharedUint8ClampedArray = Uint8ClampedArray; + type NonSharedUint16Array = Uint16Array; + type NonSharedUint32Array = Uint32Array; + type NonSharedInt8Array = Int8Array; + type NonSharedInt16Array = Int16Array; + type NonSharedInt32Array = Int32Array; + type NonSharedBigUint64Array = BigUint64Array; + type NonSharedBigInt64Array = BigInt64Array; + type NonSharedFloat16Array = Float16Array; + type NonSharedFloat32Array = Float32Array; + type NonSharedFloat64Array = Float64Array; + type NonSharedDataView = DataView; + type NonSharedTypedArray = TypedArray; + type NonSharedArrayBufferView = ArrayBufferView; + } +} diff --git a/backend/node_modules/@types/node/http.d.ts b/node_modules/@types/node/http.d.ts similarity index 97% rename from backend/node_modules/@types/node/http.d.ts rename to node_modules/@types/node/http.d.ts index f4ea91b..771b8b2 100644 --- a/backend/node_modules/@types/node/http.d.ts +++ b/node_modules/@types/node/http.d.ts @@ -40,6 +40,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/http.js) */ declare module "http" { + import { NonSharedBuffer } from "node:buffer"; import * as stream from "node:stream"; import { URL } from "node:url"; import { LookupOptions } from "node:dns"; @@ -339,6 +340,17 @@ declare module "http" { * If the header's value is an array, the items will be joined using `; `. */ uniqueHeaders?: Array | undefined; + /** + * A callback which receives an + * incoming request and returns a boolean, to control which upgrade attempts + * should be accepted. Accepted upgrades will fire an `'upgrade'` event (or + * their sockets will be destroyed, if no listener is registered) while + * rejected upgrades will fire a `'request'` event like any non-upgrade + * request. + * @since v24.9.0 + * @default () => server.listenerCount('upgrade') > 0 + */ + shouldUpgradeCallback?: ((request: InstanceType) => boolean) | undefined; /** * If set to `true`, an error is thrown when writing to an HTTP response which does not have a body. * @default false @@ -484,13 +496,13 @@ declare module "http" { addListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; addListener( event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, ): this; addListener(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; addListener(event: "request", listener: RequestListener): this; addListener( event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, ): this; emit(event: string, ...args: any[]): boolean; emit(event: "close"): boolean; @@ -508,14 +520,14 @@ declare module "http" { res: InstanceType & { req: InstanceType }, ): boolean; emit(event: "clientError", err: Error, socket: stream.Duplex): boolean; - emit(event: "connect", req: InstanceType, socket: stream.Duplex, head: Buffer): boolean; + emit(event: "connect", req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer): boolean; emit(event: "dropRequest", req: InstanceType, socket: stream.Duplex): boolean; emit( event: "request", req: InstanceType, res: InstanceType & { req: InstanceType }, ): boolean; - emit(event: "upgrade", req: InstanceType, socket: stream.Duplex, head: Buffer): boolean; + emit(event: "upgrade", req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer): boolean; on(event: string, listener: (...args: any[]) => void): this; on(event: "close", listener: () => void): this; on(event: "connection", listener: (socket: Socket) => void): this; @@ -524,10 +536,16 @@ declare module "http" { on(event: "checkContinue", listener: RequestListener): this; on(event: "checkExpectation", listener: RequestListener): this; on(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - on(event: "connect", listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + on( + event: "connect", + listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, + ): this; on(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; on(event: "request", listener: RequestListener): this; - on(event: "upgrade", listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + on( + event: "upgrade", + listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, + ): this; once(event: string, listener: (...args: any[]) => void): this; once(event: "close", listener: () => void): this; once(event: "connection", listener: (socket: Socket) => void): this; @@ -538,13 +556,13 @@ declare module "http" { once(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; once( event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, ): this; once(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; once(event: "request", listener: RequestListener): this; once( event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, ): this; prependListener(event: string, listener: (...args: any[]) => void): this; prependListener(event: "close", listener: () => void): this; @@ -556,7 +574,7 @@ declare module "http" { prependListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; prependListener( event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, ): this; prependListener( event: "dropRequest", @@ -565,7 +583,7 @@ declare module "http" { prependListener(event: "request", listener: RequestListener): this; prependListener( event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, ): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: "close", listener: () => void): this; @@ -577,7 +595,7 @@ declare module "http" { prependOnceListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; prependOnceListener( event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, ): this; prependOnceListener( event: "dropRequest", @@ -586,7 +604,7 @@ declare module "http" { prependOnceListener(event: "request", listener: RequestListener): this; prependOnceListener( event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, ): this; } /** @@ -1106,7 +1124,7 @@ declare module "http" { addListener(event: "abort", listener: () => void): this; addListener( event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, + listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, ): this; addListener(event: "continue", listener: () => void): this; addListener(event: "information", listener: (info: InformationEvent) => void): this; @@ -1115,7 +1133,7 @@ declare module "http" { addListener(event: "timeout", listener: () => void): this; addListener( event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, + listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, ): this; addListener(event: "close", listener: () => void): this; addListener(event: "drain", listener: () => void): this; @@ -1128,13 +1146,19 @@ declare module "http" { * @deprecated */ on(event: "abort", listener: () => void): this; - on(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + on( + event: "connect", + listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, + ): this; on(event: "continue", listener: () => void): this; on(event: "information", listener: (info: InformationEvent) => void): this; on(event: "response", listener: (response: IncomingMessage) => void): this; on(event: "socket", listener: (socket: Socket) => void): this; on(event: "timeout", listener: () => void): this; - on(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + on( + event: "upgrade", + listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, + ): this; on(event: "close", listener: () => void): this; on(event: "drain", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; @@ -1146,13 +1170,19 @@ declare module "http" { * @deprecated */ once(event: "abort", listener: () => void): this; - once(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + once( + event: "connect", + listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, + ): this; once(event: "continue", listener: () => void): this; once(event: "information", listener: (info: InformationEvent) => void): this; once(event: "response", listener: (response: IncomingMessage) => void): this; once(event: "socket", listener: (socket: Socket) => void): this; once(event: "timeout", listener: () => void): this; - once(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + once( + event: "upgrade", + listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, + ): this; once(event: "close", listener: () => void): this; once(event: "drain", listener: () => void): this; once(event: "error", listener: (err: Error) => void): this; @@ -1166,7 +1196,7 @@ declare module "http" { prependListener(event: "abort", listener: () => void): this; prependListener( event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, + listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, ): this; prependListener(event: "continue", listener: () => void): this; prependListener(event: "information", listener: (info: InformationEvent) => void): this; @@ -1175,7 +1205,7 @@ declare module "http" { prependListener(event: "timeout", listener: () => void): this; prependListener( event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, + listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, ): this; prependListener(event: "close", listener: () => void): this; prependListener(event: "drain", listener: () => void): this; @@ -1190,7 +1220,7 @@ declare module "http" { prependOnceListener(event: "abort", listener: () => void): this; prependOnceListener( event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, + listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, ): this; prependOnceListener(event: "continue", listener: () => void): this; prependOnceListener(event: "information", listener: (info: InformationEvent) => void): this; @@ -1199,7 +1229,7 @@ declare module "http" { prependOnceListener(event: "timeout", listener: () => void): this; prependOnceListener( event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, + listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, ): this; prependOnceListener(event: "close", listener: () => void): this; prependOnceListener(event: "drain", listener: () => void): this; diff --git a/backend/node_modules/@types/node/http2.d.ts b/node_modules/@types/node/http2.d.ts similarity index 94% rename from backend/node_modules/@types/node/http2.d.ts rename to node_modules/@types/node/http2.d.ts index 2ba2464..c90af90 100644 --- a/backend/node_modules/@types/node/http2.d.ts +++ b/node_modules/@types/node/http2.d.ts @@ -9,6 +9,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/http2.js) */ declare module "http2" { + import { NonSharedBuffer } from "node:buffer"; import EventEmitter = require("node:events"); import * as fs from "node:fs"; import * as net from "node:net"; @@ -191,7 +192,7 @@ declare module "http2" { sendTrailers(headers: OutgoingHttpHeaders): void; addListener(event: "aborted", listener: () => void): this; addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; + addListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; addListener(event: "drain", listener: () => void): this; addListener(event: "end", listener: () => void): this; addListener(event: "error", listener: (err: Error) => void): this; @@ -206,7 +207,7 @@ declare module "http2" { addListener(event: string | symbol, listener: (...args: any[]) => void): this; emit(event: "aborted"): boolean; emit(event: "close"): boolean; - emit(event: "data", chunk: Buffer | string): boolean; + emit(event: "data", chunk: NonSharedBuffer | string): boolean; emit(event: "drain"): boolean; emit(event: "end"): boolean; emit(event: "error", err: Error): boolean; @@ -221,7 +222,7 @@ declare module "http2" { emit(event: string | symbol, ...args: any[]): boolean; on(event: "aborted", listener: () => void): this; on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; + on(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; on(event: "drain", listener: () => void): this; on(event: "end", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; @@ -236,7 +237,7 @@ declare module "http2" { on(event: string | symbol, listener: (...args: any[]) => void): this; once(event: "aborted", listener: () => void): this; once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; + once(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; once(event: "drain", listener: () => void): this; once(event: "end", listener: () => void): this; once(event: "error", listener: (err: Error) => void): this; @@ -251,7 +252,7 @@ declare module "http2" { once(event: string | symbol, listener: (...args: any[]) => void): this; prependListener(event: "aborted", listener: () => void): this; prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; prependListener(event: "drain", listener: () => void): this; prependListener(event: "end", listener: () => void): this; prependListener(event: "error", listener: (err: Error) => void): this; @@ -266,7 +267,7 @@ declare module "http2" { prependListener(event: string | symbol, listener: (...args: any[]) => void): this; prependOnceListener(event: "aborted", listener: () => void): this; prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; prependOnceListener(event: "drain", listener: () => void): this; prependOnceListener(event: "end", listener: () => void): this; prependOnceListener(event: "error", listener: (err: Error) => void): this; @@ -284,61 +285,111 @@ declare module "http2" { addListener(event: "continue", listener: () => {}): this; addListener( event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + listener: ( + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + rawHeaders: string[], + ) => void, ): this; addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; addListener( event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + listener: ( + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + rawHeaders: string[], + ) => void, ): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; emit(event: "continue"): boolean; - emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; + emit( + event: "headers", + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + rawHeaders: string[], + ): boolean; emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; + emit( + event: "response", + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + rawHeaders: string[], + ): boolean; emit(event: string | symbol, ...args: any[]): boolean; on(event: "continue", listener: () => {}): this; on( event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + listener: ( + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + rawHeaders: string[], + ) => void, ): this; on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; on( event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + listener: ( + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + rawHeaders: string[], + ) => void, ): this; on(event: string | symbol, listener: (...args: any[]) => void): this; once(event: "continue", listener: () => {}): this; once( event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + listener: ( + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + rawHeaders: string[], + ) => void, ): this; once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; once( event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + listener: ( + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + rawHeaders: string[], + ) => void, ): this; once(event: string | symbol, listener: (...args: any[]) => void): this; prependListener(event: "continue", listener: () => {}): this; prependListener( event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + listener: ( + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + rawHeaders: string[], + ) => void, ): this; prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; prependListener( event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + listener: ( + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + rawHeaders: string[], + ) => void, ): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; prependOnceListener(event: "continue", listener: () => {}): this; prependOnceListener( event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + listener: ( + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + rawHeaders: string[], + ) => void, ): this; prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; prependOnceListener( event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + listener: ( + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + rawHeaders: string[], + ) => void, ): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; } @@ -784,10 +835,10 @@ declare module "http2" { * @since v8.9.3 * @param payload Optional ping payload. */ - ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; + ping(callback: (err: Error | null, duration: number, payload: NonSharedBuffer) => void): boolean; ping( payload: NodeJS.ArrayBufferView, - callback: (err: Error | null, duration: number, payload: Buffer) => void, + callback: (err: Error | null, duration: number, payload: NonSharedBuffer) => void, ): boolean; /** * Calls `ref()` on this `Http2Session` instance's underlying `net.Socket`. @@ -849,7 +900,7 @@ declare module "http2" { ): this; addListener( event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void, + listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void, ): this; addListener(event: "localSettings", listener: (settings: Settings) => void): this; addListener(event: "ping", listener: () => void): this; @@ -859,7 +910,7 @@ declare module "http2" { emit(event: "close"): boolean; emit(event: "error", err: Error): boolean; emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean; - emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData?: Buffer): boolean; + emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer): boolean; emit(event: "localSettings", settings: Settings): boolean; emit(event: "ping"): boolean; emit(event: "remoteSettings", settings: Settings): boolean; @@ -868,7 +919,10 @@ declare module "http2" { on(event: "close", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void): this; + on( + event: "goaway", + listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void, + ): this; on(event: "localSettings", listener: (settings: Settings) => void): this; on(event: "ping", listener: () => void): this; on(event: "remoteSettings", listener: (settings: Settings) => void): this; @@ -877,7 +931,10 @@ declare module "http2" { once(event: "close", listener: () => void): this; once(event: "error", listener: (err: Error) => void): this; once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void): this; + once( + event: "goaway", + listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void, + ): this; once(event: "localSettings", listener: (settings: Settings) => void): this; once(event: "ping", listener: () => void): this; once(event: "remoteSettings", listener: (settings: Settings) => void): this; @@ -891,7 +948,7 @@ declare module "http2" { ): this; prependListener( event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void, + listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void, ): this; prependListener(event: "localSettings", listener: (settings: Settings) => void): this; prependListener(event: "ping", listener: () => void): this; @@ -906,7 +963,7 @@ declare module "http2" { ): this; prependOnceListener( event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void, + listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void, ): this; prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this; prependOnceListener(event: "ping", listener: () => void): this; @@ -976,6 +1033,7 @@ declare module "http2" { stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number, + rawHeaders: string[], ) => void, ): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -987,6 +1045,7 @@ declare module "http2" { stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number, + rawHeaders: string[], ): boolean; emit(event: string | symbol, ...args: any[]): boolean; on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; @@ -998,6 +1057,7 @@ declare module "http2" { stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number, + rawHeaders: string[], ) => void, ): this; on(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1013,6 +1073,7 @@ declare module "http2" { stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number, + rawHeaders: string[], ) => void, ): this; once(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1028,6 +1089,7 @@ declare module "http2" { stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number, + rawHeaders: string[], ) => void, ): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1043,6 +1105,7 @@ declare module "http2" { stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number, + rawHeaders: string[], ) => void, ): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1160,7 +1223,12 @@ declare module "http2" { ): this; addListener( event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + listener: ( + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + flags: number, + rawHeaders: string[], + ) => void, ): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; emit( @@ -1168,7 +1236,13 @@ declare module "http2" { session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket, ): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; + emit( + event: "stream", + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + flags: number, + rawHeaders: string[], + ): boolean; emit(event: string | symbol, ...args: any[]): boolean; on( event: "connect", @@ -1179,7 +1253,12 @@ declare module "http2" { ): this; on( event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + listener: ( + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + flags: number, + rawHeaders: string[], + ) => void, ): this; on(event: string | symbol, listener: (...args: any[]) => void): this; once( @@ -1191,7 +1270,12 @@ declare module "http2" { ): this; once( event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + listener: ( + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + flags: number, + rawHeaders: string[], + ) => void, ): this; once(event: string | symbol, listener: (...args: any[]) => void): this; prependListener( @@ -1203,7 +1287,12 @@ declare module "http2" { ): this; prependListener( event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + listener: ( + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + flags: number, + rawHeaders: string[], + ) => void, ): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; prependOnceListener( @@ -1215,7 +1304,12 @@ declare module "http2" { ): this; prependOnceListener( event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + listener: ( + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + flags: number, + rawHeaders: string[], + ) => void, ): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; } @@ -1384,7 +1478,12 @@ declare module "http2" { addListener(event: "sessionError", listener: (err: Error) => void): this; addListener( event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + listener: ( + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + flags: number, + rawHeaders: string[], + ) => void, ): this; addListener(event: "timeout", listener: () => void): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1399,7 +1498,13 @@ declare module "http2" { session: ServerHttp2Session, ): boolean; emit(event: "sessionError", err: Error): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; + emit( + event: "stream", + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + flags: number, + rawHeaders: string[], + ): boolean; emit(event: "timeout"): boolean; emit(event: string | symbol, ...args: any[]): boolean; on( @@ -1417,7 +1522,12 @@ declare module "http2" { on(event: "sessionError", listener: (err: Error) => void): this; on( event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + listener: ( + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + flags: number, + rawHeaders: string[], + ) => void, ): this; on(event: "timeout", listener: () => void): this; on(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1436,7 +1546,12 @@ declare module "http2" { once(event: "sessionError", listener: (err: Error) => void): this; once( event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + listener: ( + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + flags: number, + rawHeaders: string[], + ) => void, ): this; once(event: "timeout", listener: () => void): this; once(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1455,7 +1570,12 @@ declare module "http2" { prependListener(event: "sessionError", listener: (err: Error) => void): this; prependListener( event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + listener: ( + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + flags: number, + rawHeaders: string[], + ) => void, ): this; prependListener(event: "timeout", listener: () => void): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1474,7 +1594,12 @@ declare module "http2" { prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; prependOnceListener( event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + listener: ( + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + flags: number, + rawHeaders: string[], + ) => void, ): this; prependOnceListener(event: "timeout", listener: () => void): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1798,45 +1923,45 @@ declare module "http2" { * @since v8.4.0 */ setTimeout(msecs: number, callback?: () => void): void; - read(size?: number): Buffer | string | null; + read(size?: number): NonSharedBuffer | string | null; addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; + addListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; addListener(event: "end", listener: () => void): this; addListener(event: "readable", listener: () => void): this; addListener(event: "error", listener: (err: Error) => void): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; emit(event: "aborted", hadError: boolean, code: number): boolean; emit(event: "close"): boolean; - emit(event: "data", chunk: Buffer | string): boolean; + emit(event: "data", chunk: NonSharedBuffer | string): boolean; emit(event: "end"): boolean; emit(event: "readable"): boolean; emit(event: "error", err: Error): boolean; emit(event: string | symbol, ...args: any[]): boolean; on(event: "aborted", listener: (hadError: boolean, code: number) => void): this; on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; + on(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; on(event: "end", listener: () => void): this; on(event: "readable", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; on(event: string | symbol, listener: (...args: any[]) => void): this; once(event: "aborted", listener: (hadError: boolean, code: number) => void): this; once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; + once(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; once(event: "end", listener: () => void): this; once(event: "readable", listener: () => void): this; once(event: "error", listener: (err: Error) => void): this; once(event: string | symbol, listener: (...args: any[]) => void): this; prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; prependListener(event: "end", listener: () => void): this; prependListener(event: "readable", listener: () => void): this; prependListener(event: "error", listener: (err: Error) => void): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; prependOnceListener(event: "end", listener: () => void): this; prependOnceListener(event: "readable", listener: () => void): this; prependOnceListener(event: "error", listener: (err: Error) => void): this; @@ -2195,8 +2320,8 @@ declare module "http2" { * will result in a `TypeError` being thrown. * @since v8.4.0 */ - writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; - writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this; + writeHead(statusCode: number, headers?: OutgoingHttpHeaders | readonly string[]): this; + writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders | readonly string[]): this; /** * Call `http2stream.pushStream()` with the given headers, and wrap the * given `Http2Stream` on a newly created `Http2ServerResponse` as the callback @@ -2496,7 +2621,7 @@ declare module "http2" { * ``` * @since v8.4.0 */ - export function getPackedSettings(settings: Settings): Buffer; + export function getPackedSettings(settings: Settings): NonSharedBuffer; /** * Returns a `HTTP/2 Settings Object` containing the deserialized settings from * the given `Buffer` as generated by `http2.getPackedSettings()`. diff --git a/backend/node_modules/@types/node/https.d.ts b/node_modules/@types/node/https.d.ts similarity index 83% rename from backend/node_modules/@types/node/https.d.ts rename to node_modules/@types/node/https.d.ts index 1348d59..53de0b9 100644 --- a/backend/node_modules/@types/node/https.d.ts +++ b/node_modules/@types/node/https.d.ts @@ -4,6 +4,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/https.js) */ declare module "https" { + import { NonSharedBuffer } from "node:buffer"; import { Duplex } from "node:stream"; import * as tls from "node:tls"; import * as http from "node:http"; @@ -63,22 +64,25 @@ declare module "https" { */ closeIdleConnections(): void; addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + addListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this; addListener( event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, + listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, ): this; addListener( event: "OCSPRequest", listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, + certificate: NonSharedBuffer, + issuer: NonSharedBuffer, + callback: (err: Error | null, resp: Buffer | null) => void, ) => void, ): this; addListener( event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, + listener: ( + sessionId: NonSharedBuffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, ): this; addListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; @@ -91,28 +95,32 @@ declare module "https" { addListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; addListener( event: "connect", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, ): this; addListener(event: "request", listener: http.RequestListener): this; addListener( event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, ): this; emit(event: string, ...args: any[]): boolean; - emit(event: "keylog", line: Buffer, tlsSocket: tls.TLSSocket): boolean; + emit(event: "keylog", line: NonSharedBuffer, tlsSocket: tls.TLSSocket): boolean; emit( event: "newSession", - sessionId: Buffer, - sessionData: Buffer, - callback: (err: Error, resp: Buffer) => void, + sessionId: NonSharedBuffer, + sessionData: NonSharedBuffer, + callback: () => void, ): boolean; emit( event: "OCSPRequest", - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, + certificate: NonSharedBuffer, + issuer: NonSharedBuffer, + callback: (err: Error | null, resp: Buffer | null) => void, + ): boolean; + emit( + event: "resumeSession", + sessionId: NonSharedBuffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, ): boolean; - emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; emit(event: "secureConnection", tlsSocket: tls.TLSSocket): boolean; emit(event: "tlsClientError", err: Error, tlsSocket: tls.TLSSocket): boolean; emit(event: "close"): boolean; @@ -130,30 +138,33 @@ declare module "https" { res: InstanceType, ): boolean; emit(event: "clientError", err: Error, socket: Duplex): boolean; - emit(event: "connect", req: InstanceType, socket: Duplex, head: Buffer): boolean; + emit(event: "connect", req: InstanceType, socket: Duplex, head: NonSharedBuffer): boolean; emit( event: "request", req: InstanceType, res: InstanceType, ): boolean; - emit(event: "upgrade", req: InstanceType, socket: Duplex, head: Buffer): boolean; + emit(event: "upgrade", req: InstanceType, socket: Duplex, head: NonSharedBuffer): boolean; on(event: string, listener: (...args: any[]) => void): this; - on(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + on(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this; on( event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, + listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, ): this; on( event: "OCSPRequest", listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, + certificate: NonSharedBuffer, + issuer: NonSharedBuffer, + callback: (err: Error | null, resp: Buffer | null) => void, ) => void, ): this; on( event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, + listener: ( + sessionId: NonSharedBuffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, ): this; on(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; on(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; @@ -164,26 +175,35 @@ declare module "https" { on(event: "checkContinue", listener: http.RequestListener): this; on(event: "checkExpectation", listener: http.RequestListener): this; on(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - on(event: "connect", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + on( + event: "connect", + listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, + ): this; on(event: "request", listener: http.RequestListener): this; - on(event: "upgrade", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + on( + event: "upgrade", + listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, + ): this; once(event: string, listener: (...args: any[]) => void): this; - once(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + once(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this; once( event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, + listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, ): this; once( event: "OCSPRequest", listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, + certificate: NonSharedBuffer, + issuer: NonSharedBuffer, + callback: (err: Error | null, resp: Buffer | null) => void, ) => void, ): this; once( event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, + listener: ( + sessionId: NonSharedBuffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, ): this; once(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; once(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; @@ -194,26 +214,35 @@ declare module "https" { once(event: "checkContinue", listener: http.RequestListener): this; once(event: "checkExpectation", listener: http.RequestListener): this; once(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - once(event: "connect", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + once( + event: "connect", + listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, + ): this; once(event: "request", listener: http.RequestListener): this; - once(event: "upgrade", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + once( + event: "upgrade", + listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, + ): this; prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + prependListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this; prependListener( event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, + listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, ): this; prependListener( event: "OCSPRequest", listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, + certificate: NonSharedBuffer, + issuer: NonSharedBuffer, + callback: (err: Error | null, resp: Buffer | null) => void, ) => void, ): this; prependListener( event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, + listener: ( + sessionId: NonSharedBuffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, ): this; prependListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; @@ -226,30 +255,33 @@ declare module "https" { prependListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; prependListener( event: "connect", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, ): this; prependListener(event: "request", listener: http.RequestListener): this; prependListener( event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, ): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this; prependOnceListener( event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, + listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, ): this; prependOnceListener( event: "OCSPRequest", listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, + certificate: NonSharedBuffer, + issuer: NonSharedBuffer, + callback: (err: Error | null, resp: Buffer | null) => void, ) => void, ): this; prependOnceListener( event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, + listener: ( + sessionId: NonSharedBuffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, ): this; prependOnceListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; @@ -262,12 +294,12 @@ declare module "https" { prependOnceListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; prependOnceListener( event: "connect", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, ): this; prependOnceListener(event: "request", listener: http.RequestListener): this; prependOnceListener( event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, + listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, ): this; } /** diff --git a/backend/node_modules/@types/node/index.d.ts b/node_modules/@types/node/index.d.ts similarity index 100% rename from backend/node_modules/@types/node/index.d.ts rename to node_modules/@types/node/index.d.ts diff --git a/backend/node_modules/@types/node/inspector.d.ts b/node_modules/@types/node/inspector.d.ts similarity index 100% rename from backend/node_modules/@types/node/inspector.d.ts rename to node_modules/@types/node/inspector.d.ts diff --git a/backend/node_modules/@types/node/inspector.generated.d.ts b/node_modules/@types/node/inspector.generated.d.ts similarity index 100% rename from backend/node_modules/@types/node/inspector.generated.d.ts rename to node_modules/@types/node/inspector.generated.d.ts diff --git a/backend/node_modules/@types/node/module.d.ts b/node_modules/@types/node/module.d.ts similarity index 100% rename from backend/node_modules/@types/node/module.d.ts rename to node_modules/@types/node/module.d.ts diff --git a/backend/node_modules/@types/node/net.d.ts b/node_modules/@types/node/net.d.ts similarity index 98% rename from backend/node_modules/@types/node/net.d.ts rename to node_modules/@types/node/net.d.ts index 2e70d90..38c1627 100644 --- a/backend/node_modules/@types/node/net.d.ts +++ b/node_modules/@types/node/net.d.ts @@ -13,6 +13,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/net.js) */ declare module "net" { + import { NonSharedBuffer } from "node:buffer"; import * as stream from "node:stream"; import { Abortable, EventEmitter } from "node:events"; import * as dns from "node:dns"; @@ -380,7 +381,7 @@ declare module "net" { event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void, ): this; - addListener(event: "data", listener: (data: Buffer) => void): this; + addListener(event: "data", listener: (data: NonSharedBuffer) => void): this; addListener(event: "drain", listener: () => void): this; addListener(event: "end", listener: () => void): this; addListener(event: "error", listener: (err: Error) => void): this; @@ -396,7 +397,7 @@ declare module "net" { emit(event: "connectionAttempt", ip: string, port: number, family: number): boolean; emit(event: "connectionAttemptFailed", ip: string, port: number, family: number, error: Error): boolean; emit(event: "connectionAttemptTimeout", ip: string, port: number, family: number): boolean; - emit(event: "data", data: Buffer): boolean; + emit(event: "data", data: NonSharedBuffer): boolean; emit(event: "drain"): boolean; emit(event: "end"): boolean; emit(event: "error", err: Error): boolean; @@ -412,7 +413,7 @@ declare module "net" { listener: (ip: string, port: number, family: number, error: Error) => void, ): this; on(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this; - on(event: "data", listener: (data: Buffer) => void): this; + on(event: "data", listener: (data: NonSharedBuffer) => void): this; on(event: "drain", listener: () => void): this; on(event: "end", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; @@ -431,7 +432,7 @@ declare module "net" { ): this; once(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this; once(event: "connect", listener: () => void): this; - once(event: "data", listener: (data: Buffer) => void): this; + once(event: "data", listener: (data: NonSharedBuffer) => void): this; once(event: "drain", listener: () => void): this; once(event: "end", listener: () => void): this; once(event: "error", listener: (err: Error) => void): this; @@ -453,7 +454,7 @@ declare module "net" { event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void, ): this; - prependListener(event: "data", listener: (data: Buffer) => void): this; + prependListener(event: "data", listener: (data: NonSharedBuffer) => void): this; prependListener(event: "drain", listener: () => void): this; prependListener(event: "end", listener: () => void): this; prependListener(event: "error", listener: (err: Error) => void): this; @@ -478,7 +479,7 @@ declare module "net" { event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void, ): this; - prependOnceListener(event: "data", listener: (data: Buffer) => void): this; + prependOnceListener(event: "data", listener: (data: NonSharedBuffer) => void): this; prependOnceListener(event: "drain", listener: () => void): this; prependOnceListener(event: "end", listener: () => void): this; prependOnceListener(event: "error", listener: (err: Error) => void): this; diff --git a/backend/node_modules/@types/node/os.d.ts b/node_modules/@types/node/os.d.ts similarity index 99% rename from backend/node_modules/@types/node/os.d.ts rename to node_modules/@types/node/os.d.ts index 3ff1c1b..505f5b4 100644 --- a/backend/node_modules/@types/node/os.d.ts +++ b/node_modules/@types/node/os.d.ts @@ -8,6 +8,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/os.js) */ declare module "os" { + import { NonSharedBuffer } from "buffer"; interface CpuInfo { model: string; speed: number; @@ -253,9 +254,9 @@ declare module "os" { * Throws a [`SystemError`](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-systemerror) if a user has no `username` or `homedir`. * @since v6.0.0 */ - function userInfo(options: UserInfoOptionsWithBufferEncoding): UserInfo; function userInfo(options?: UserInfoOptionsWithStringEncoding): UserInfo; - function userInfo(options: UserInfoOptions): UserInfo; + function userInfo(options: UserInfoOptionsWithBufferEncoding): UserInfo; + function userInfo(options: UserInfoOptions): UserInfo; type SignalConstants = { [key in NodeJS.Signals]: number; }; diff --git a/backend/node_modules/@types/node/package.json b/node_modules/@types/node/package.json similarity index 96% rename from backend/node_modules/@types/node/package.json rename to node_modules/@types/node/package.json index 409d167..2381888 100644 --- a/backend/node_modules/@types/node/package.json +++ b/node_modules/@types/node/package.json @@ -1,6 +1,6 @@ { "name": "@types/node", - "version": "24.7.2", + "version": "24.10.0", "description": "TypeScript definitions for node", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", "license": "MIT", @@ -147,9 +147,9 @@ }, "scripts": {}, "dependencies": { - "undici-types": "~7.14.0" + "undici-types": "~7.16.0" }, "peerDependencies": {}, - "typesPublisherContentHash": "4bf36d2d52de2aa8898ee24d026198a784567fa5a42adcae5e37b826951ff66d", + "typesPublisherContentHash": "520eb7d36290a7656940213fbf34026408b9af9ff538455bf669b4ea7a21d5bf", "typeScriptVersion": "5.2" } \ No newline at end of file diff --git a/backend/node_modules/@types/node/path.d.ts b/node_modules/@types/node/path.d.ts similarity index 100% rename from backend/node_modules/@types/node/path.d.ts rename to node_modules/@types/node/path.d.ts diff --git a/backend/node_modules/@types/node/perf_hooks.d.ts b/node_modules/@types/node/perf_hooks.d.ts similarity index 100% rename from backend/node_modules/@types/node/perf_hooks.d.ts rename to node_modules/@types/node/perf_hooks.d.ts diff --git a/backend/node_modules/@types/node/process.d.ts b/node_modules/@types/node/process.d.ts similarity index 99% rename from backend/node_modules/@types/node/process.d.ts rename to node_modules/@types/node/process.d.ts index c152531..f47bad5 100644 --- a/backend/node_modules/@types/node/process.d.ts +++ b/node_modules/@types/node/process.d.ts @@ -1,5 +1,6 @@ declare module "process" { - import { Control, MessageOptions } from "node:child_process"; + import { Control, MessageOptions, SendHandle } from "node:child_process"; + import { PathLike } from "node:fs"; import * as tty from "node:tty"; import { Worker } from "node:worker_threads"; @@ -331,7 +332,7 @@ declare module "process" { */ type UnhandledRejectionListener = (reason: unknown, promise: Promise) => void; type WarningListener = (warning: Error) => void; - type MessageListener = (message: unknown, sendHandle: unknown) => void; + type MessageListener = (message: unknown, sendHandle: SendHandle) => void; type SignalsListener = (signal: Signals) => void; type MultipleResolveListener = ( type: MultipleResolveType, @@ -1466,7 +1467,7 @@ declare module "process" { * @since v20.12.0 * @param path The path to the .env file */ - loadEnvFile(path?: string | URL | Buffer): void; + loadEnvFile(path?: PathLike): void; /** * The `process.pid` property returns the PID of the process. * @@ -1775,7 +1776,7 @@ declare module "process" { */ send?( message: any, - sendHandle?: any, + sendHandle?: SendHandle, options?: MessageOptions, callback?: (error: Error | null) => void, ): boolean; @@ -1979,7 +1980,7 @@ declare module "process" { emit(event: "uncaughtExceptionMonitor", error: Error): boolean; emit(event: "unhandledRejection", reason: unknown, promise: Promise): boolean; emit(event: "warning", warning: Error): boolean; - emit(event: "message", message: unknown, sendHandle: unknown): this; + emit(event: "message", message: unknown, sendHandle: SendHandle): this; emit(event: Signals, signal?: Signals): boolean; emit( event: "multipleResolves", diff --git a/backend/node_modules/@types/node/punycode.d.ts b/node_modules/@types/node/punycode.d.ts similarity index 100% rename from backend/node_modules/@types/node/punycode.d.ts rename to node_modules/@types/node/punycode.d.ts diff --git a/backend/node_modules/@types/node/querystring.d.ts b/node_modules/@types/node/querystring.d.ts similarity index 100% rename from backend/node_modules/@types/node/querystring.d.ts rename to node_modules/@types/node/querystring.d.ts diff --git a/backend/node_modules/@types/node/readline.d.ts b/node_modules/@types/node/readline.d.ts similarity index 100% rename from backend/node_modules/@types/node/readline.d.ts rename to node_modules/@types/node/readline.d.ts diff --git a/backend/node_modules/@types/node/readline/promises.d.ts b/node_modules/@types/node/readline/promises.d.ts similarity index 100% rename from backend/node_modules/@types/node/readline/promises.d.ts rename to node_modules/@types/node/readline/promises.d.ts diff --git a/backend/node_modules/@types/node/repl.d.ts b/node_modules/@types/node/repl.d.ts similarity index 100% rename from backend/node_modules/@types/node/repl.d.ts rename to node_modules/@types/node/repl.d.ts diff --git a/backend/node_modules/@types/node/sea.d.ts b/node_modules/@types/node/sea.d.ts similarity index 93% rename from backend/node_modules/@types/node/sea.d.ts rename to node_modules/@types/node/sea.d.ts index 5119ede..870c304 100644 --- a/backend/node_modules/@types/node/sea.d.ts +++ b/node_modules/@types/node/sea.d.ts @@ -150,4 +150,13 @@ declare module "node:sea" { * @since v20.12.0 */ function getRawAsset(key: AssetKey): ArrayBuffer; + /** + * This method can be used to retrieve an array of all the keys of assets + * embedded into the single-executable application. + * An error is thrown when not running inside a single-executable application. + * @since v24.8.0 + * @returns An array containing all the keys of the assets + * embedded in the executable. If no assets are embedded, returns an empty array. + */ + function getAssetKeys(): string[]; } diff --git a/backend/node_modules/@types/node/sqlite.d.ts b/node_modules/@types/node/sqlite.d.ts similarity index 78% rename from backend/node_modules/@types/node/sqlite.d.ts rename to node_modules/@types/node/sqlite.d.ts index 50be8b5..6ff7943 100644 --- a/backend/node_modules/@types/node/sqlite.d.ts +++ b/node_modules/@types/node/sqlite.d.ts @@ -43,10 +43,9 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/sqlite.js) */ declare module "node:sqlite" { + import { PathLike } from "node:fs"; type SQLInputValue = null | number | bigint | string | NodeJS.ArrayBufferView; - type SQLOutputValue = null | number | bigint | string | Uint8Array; - /** @deprecated Use `SQLInputValue` or `SQLOutputValue` instead. */ - type SupportedValueType = SQLOutputValue; + type SQLOutputValue = null | number | bigint | string | NodeJS.NonSharedUint8Array; interface DatabaseSyncOptions { /** * If `true`, the database is opened by the constructor. When @@ -240,7 +239,7 @@ declare module "node:sqlite" { * To use an in-memory database, the path should be the special name `':memory:'`. * @param options Configuration options for the database connection. */ - constructor(path: string | Buffer | URL, options?: DatabaseSyncOptions); + constructor(path: PathLike, options?: DatabaseSyncOptions); /** * Registers a new aggregate function with the SQLite database. This method is a wrapper around * [`sqlite3_create_window_function()`](https://www.sqlite.org/c3ref/create_function.html). @@ -330,6 +329,64 @@ declare module "node:sqlite" { func: (...args: SQLOutputValue[]) => SQLInputValue, ): void; function(name: string, func: (...args: SQLOutputValue[]) => SQLInputValue): void; + /** + * Sets an authorizer callback that SQLite will invoke whenever it attempts to + * access data or modify the database schema through prepared statements. + * This can be used to implement security policies, audit access, or restrict certain operations. + * This method is a wrapper around [`sqlite3_set_authorizer()`](https://sqlite.org/c3ref/set_authorizer.html). + * + * When invoked, the callback receives five arguments: + * + * * `actionCode` {number} The type of operation being performed (e.g., + * `SQLITE_INSERT`, `SQLITE_UPDATE`, `SQLITE_SELECT`). + * * `arg1` {string|null} The first argument (context-dependent, often a table name). + * * `arg2` {string|null} The second argument (context-dependent, often a column name). + * * `dbName` {string|null} The name of the database. + * * `triggerOrView` {string|null} The name of the trigger or view causing the access. + * + * The callback must return one of the following constants: + * + * * `SQLITE_OK` - Allow the operation. + * * `SQLITE_DENY` - Deny the operation (causes an error). + * * `SQLITE_IGNORE` - Ignore the operation (silently skip). + * + * ```js + * import { DatabaseSync, constants } from 'node:sqlite'; + * const db = new DatabaseSync(':memory:'); + * + * // Set up an authorizer that denies all table creation + * db.setAuthorizer((actionCode) => { + * if (actionCode === constants.SQLITE_CREATE_TABLE) { + * return constants.SQLITE_DENY; + * } + * return constants.SQLITE_OK; + * }); + * + * // This will work + * db.prepare('SELECT 1').get(); + * + * // This will throw an error due to authorization denial + * try { + * db.exec('CREATE TABLE blocked (id INTEGER)'); + * } catch (err) { + * console.log('Operation blocked:', err.message); + * } + * ``` + * @since v24.10.0 + * @param callback The authorizer function to set, or `null` to + * clear the current authorizer. + */ + setAuthorizer( + callback: + | (( + actionCode: number, + arg1: string | null, + arg2: string | null, + dbName: string | null, + triggerOrView: string | null, + ) => number) + | null, + ): void; /** * Whether the database is currently open or not. * @since v22.15.0 @@ -355,6 +412,47 @@ declare module "node:sqlite" { * @return The prepared statement. */ prepare(sql: string): StatementSync; + /** + * Creates a new `SQLTagStore`, which is an LRU (Least Recently Used) cache for + * storing prepared statements. This allows for the efficient reuse of prepared + * statements by tagging them with a unique identifier. + * + * When a tagged SQL literal is executed, the `SQLTagStore` checks if a prepared + * statement for that specific SQL string already exists in the cache. If it does, + * the cached statement is used. If not, a new prepared statement is created, + * executed, and then stored in the cache for future use. This mechanism helps to + * avoid the overhead of repeatedly parsing and preparing the same SQL statements. + * + * ```js + * import { DatabaseSync } from 'node:sqlite'; + * + * const db = new DatabaseSync(':memory:'); + * const sql = db.createSQLTagStore(); + * + * db.exec('CREATE TABLE users (id INT, name TEXT)'); + * + * // Using the 'run' method to insert data. + * // The tagged literal is used to identify the prepared statement. + * sql.run`INSERT INTO users VALUES (1, 'Alice')`; + * sql.run`INSERT INTO users VALUES (2, 'Bob')`; + * + * // Using the 'get' method to retrieve a single row. + * const id = 1; + * const user = sql.get`SELECT * FROM users WHERE id = ${id}`; + * console.log(user); // { id: 1, name: 'Alice' } + * + * // Using the 'all' method to retrieve all rows. + * const allUsers = sql.all`SELECT * FROM users ORDER BY id`; + * console.log(allUsers); + * // [ + * // { id: 1, name: 'Alice' }, + * // { id: 2, name: 'Bob' } + * // ] + * ``` + * @since v24.9.0 + * @returns A new SQL tag store for caching prepared statements. + */ + createTagStore(maxSize?: number): SQLTagStore; /** * Creates and attaches a session to the database. This method is a wrapper around * [`sqlite3session_create()`](https://www.sqlite.org/session/sqlite3session_create.html) and @@ -410,7 +508,7 @@ declare module "node:sqlite" { * @returns Binary changeset that can be applied to other databases. * @since v22.12.0 */ - changeset(): Uint8Array; + changeset(): NodeJS.NonSharedUint8Array; /** * Similar to the method above, but generates a more compact patchset. See * [Changesets and Patchsets](https://www.sqlite.org/sessionintro.html#changesets_and_patchsets) @@ -420,7 +518,7 @@ declare module "node:sqlite" { * @returns Binary patchset that can be applied to other databases. * @since v22.12.0 */ - patchset(): Uint8Array; + patchset(): NodeJS.NonSharedUint8Array; /** * Closes the session. An exception is thrown if the database or the session is not open. This method is a * wrapper around @@ -428,6 +526,73 @@ declare module "node:sqlite" { */ close(): void; } + /** + * This class represents a single LRU (Least Recently Used) cache for storing + * prepared statements. + * + * Instances of this class are created via the database.createSQLTagStore() method, + * not by using a constructor. The store caches prepared statements based on the + * provided SQL query string. When the same query is seen again, the store + * retrieves the cached statement and safely applies the new values through + * parameter binding, thereby preventing attacks like SQL injection. + * + * The cache has a maxSize that defaults to 1000 statements, but a custom size can + * be provided (e.g., database.createSQLTagStore(100)). All APIs exposed by this + * class execute synchronously. + * @since v24.9.0 + */ + interface SQLTagStore { + /** + * Executes the given SQL query and returns all resulting rows as an array of objects. + * @since v24.9.0 + */ + all( + stringElements: TemplateStringsArray, + ...boundParameters: SQLInputValue[] + ): Record[]; + /** + * Executes the given SQL query and returns the first resulting row as an object. + * @since v24.9.0 + */ + get( + stringElements: TemplateStringsArray, + ...boundParameters: SQLInputValue[] + ): Record | undefined; + /** + * Executes the given SQL query and returns an iterator over the resulting rows. + * @since v24.9.0 + */ + iterate( + stringElements: TemplateStringsArray, + ...boundParameters: SQLInputValue[] + ): NodeJS.Iterator>; + /** + * Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE). + * @since v24.9.0 + */ + run(stringElements: TemplateStringsArray, ...boundParameters: SQLInputValue[]): StatementResultingChanges; + /** + * A read-only property that returns the number of prepared statements currently in the cache. + * @since v24.9.0 + * @returns The maximum number of prepared statements the cache can hold. + */ + size(): number; + /** + * A read-only property that returns the maximum number of prepared statements the cache can hold. + * @since v24.9.0 + */ + readonly capacity: number; + /** + * A read-only property that returns the `DatabaseSync` object associated with this `SQLTagStore`. + * @since v24.9.0 + */ + readonly db: DatabaseSync; + /** + * Resets the LRU cache, clearing all stored prepared statements. + * @since v24.9.0 + */ + clear(): void; + } interface StatementColumnMetadata { /** * The unaliased name of the column in the origin @@ -679,7 +844,7 @@ declare module "node:sqlite" { * @returns A promise that fulfills with the total number of backed-up pages upon completion, or rejects if an * error occurs. */ - function backup(sourceDb: DatabaseSync, path: string | Buffer | URL, options?: BackupOptions): Promise; + function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise; /** * @since v22.13.0 */ @@ -719,5 +884,54 @@ declare module "node:sqlite" { * @since v22.12.0 */ const SQLITE_CHANGESET_ABORT: number; + /** + * Deny the operation and cause an error to be returned. + * @since v24.10.0 + */ + const SQLITE_DENY: number; + /** + * Ignore the operation and continue as if it had never been requested. + * @since 24.10.0 + */ + const SQLITE_IGNORE: number; + /** + * Allow the operation to proceed normally. + * @since v24.10.0 + */ + const SQLITE_OK: number; + const SQLITE_CREATE_INDEX: number; + const SQLITE_CREATE_TABLE: number; + const SQLITE_CREATE_TEMP_INDEX: number; + const SQLITE_CREATE_TEMP_TABLE: number; + const SQLITE_CREATE_TEMP_TRIGGER: number; + const SQLITE_CREATE_TEMP_VIEW: number; + const SQLITE_CREATE_TRIGGER: number; + const SQLITE_CREATE_VIEW: number; + const SQLITE_DELETE: number; + const SQLITE_DROP_INDEX: number; + const SQLITE_DROP_TABLE: number; + const SQLITE_DROP_TEMP_INDEX: number; + const SQLITE_DROP_TEMP_TABLE: number; + const SQLITE_DROP_TEMP_TRIGGER: number; + const SQLITE_DROP_TEMP_VIEW: number; + const SQLITE_DROP_TRIGGER: number; + const SQLITE_DROP_VIEW: number; + const SQLITE_INSERT: number; + const SQLITE_PRAGMA: number; + const SQLITE_READ: number; + const SQLITE_SELECT: number; + const SQLITE_TRANSACTION: number; + const SQLITE_UPDATE: number; + const SQLITE_ATTACH: number; + const SQLITE_DETACH: number; + const SQLITE_ALTER_TABLE: number; + const SQLITE_REINDEX: number; + const SQLITE_ANALYZE: number; + const SQLITE_CREATE_VTABLE: number; + const SQLITE_DROP_VTABLE: number; + const SQLITE_FUNCTION: number; + const SQLITE_SAVEPOINT: number; + const SQLITE_COPY: number; + const SQLITE_RECURSIVE: number; } } diff --git a/backend/node_modules/@types/node/stream.d.ts b/node_modules/@types/node/stream.d.ts similarity index 99% rename from backend/node_modules/@types/node/stream.d.ts rename to node_modules/@types/node/stream.d.ts index e42224c..3b38302 100644 --- a/backend/node_modules/@types/node/stream.d.ts +++ b/node_modules/@types/node/stream.d.ts @@ -1656,6 +1656,7 @@ declare module "stream" { ref(): void; unref(): void; } + // TODO: these should all take webstream arguments /** * Returns whether the stream has encountered an error. * @since v17.3.0, v16.14.0 @@ -1664,8 +1665,15 @@ declare module "stream" { /** * Returns whether the stream is readable. * @since v17.4.0, v16.14.0 + * @returns Only returns `null` if `stream` is not a valid `Readable`, `Duplex` or `ReadableStream`. */ - function isReadable(stream: Readable | NodeJS.ReadableStream): boolean; + function isReadable(stream: Readable | NodeJS.ReadableStream): boolean | null; + /** + * Returns whether the stream is writable. + * @since v20.0.0 + * @returns Only returns `null` if `stream` is not a valid `Writable`, `Duplex` or `WritableStream`. + */ + function isWritable(stream: Writable | NodeJS.WritableStream): boolean | null; } export = Stream; } diff --git a/backend/node_modules/@types/node/stream/consumers.d.ts b/node_modules/@types/node/stream/consumers.d.ts similarity index 92% rename from backend/node_modules/@types/node/stream/consumers.d.ts rename to node_modules/@types/node/stream/consumers.d.ts index 746d6e5..05db025 100644 --- a/backend/node_modules/@types/node/stream/consumers.d.ts +++ b/node_modules/@types/node/stream/consumers.d.ts @@ -4,7 +4,7 @@ * @since v16.7.0 */ declare module "stream/consumers" { - import { Blob as NodeBlob } from "node:buffer"; + import { Blob as NodeBlob, NonSharedBuffer } from "node:buffer"; import { ReadableStream as WebReadableStream } from "node:stream/web"; /** * @since v16.7.0 @@ -20,7 +20,7 @@ declare module "stream/consumers" { * @since v16.7.0 * @returns Fulfills with a `Buffer` containing the full contents of the stream. */ - function buffer(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable): Promise; + function buffer(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable): Promise; /** * @since v16.7.0 * @returns Fulfills with the contents of the stream parsed as a diff --git a/backend/node_modules/@types/node/stream/promises.d.ts b/node_modules/@types/node/stream/promises.d.ts similarity index 100% rename from backend/node_modules/@types/node/stream/promises.d.ts rename to node_modules/@types/node/stream/promises.d.ts diff --git a/backend/node_modules/@types/node/stream/web.d.ts b/node_modules/@types/node/stream/web.d.ts similarity index 100% rename from backend/node_modules/@types/node/stream/web.d.ts rename to node_modules/@types/node/stream/web.d.ts diff --git a/backend/node_modules/@types/node/string_decoder.d.ts b/node_modules/@types/node/string_decoder.d.ts similarity index 94% rename from backend/node_modules/@types/node/string_decoder.d.ts rename to node_modules/@types/node/string_decoder.d.ts index 3632c16..bcd64d5 100644 --- a/backend/node_modules/@types/node/string_decoder.d.ts +++ b/node_modules/@types/node/string_decoder.d.ts @@ -48,7 +48,7 @@ declare module "string_decoder" { * @since v0.1.99 * @param buffer The bytes to decode. */ - write(buffer: string | Buffer | NodeJS.ArrayBufferView): string; + write(buffer: string | NodeJS.ArrayBufferView): string; /** * Returns any remaining input stored in the internal buffer as a string. Bytes * representing incomplete UTF-8 and UTF-16 characters will be replaced with @@ -59,7 +59,7 @@ declare module "string_decoder" { * @since v0.9.3 * @param buffer The bytes to decode. */ - end(buffer?: string | Buffer | NodeJS.ArrayBufferView): string; + end(buffer?: string | NodeJS.ArrayBufferView): string; } } declare module "node:string_decoder" { diff --git a/backend/node_modules/@types/node/test.d.ts b/node_modules/@types/node/test.d.ts similarity index 100% rename from backend/node_modules/@types/node/test.d.ts rename to node_modules/@types/node/test.d.ts diff --git a/backend/node_modules/@types/node/timers.d.ts b/node_modules/@types/node/timers.d.ts similarity index 100% rename from backend/node_modules/@types/node/timers.d.ts rename to node_modules/@types/node/timers.d.ts diff --git a/backend/node_modules/@types/node/timers/promises.d.ts b/node_modules/@types/node/timers/promises.d.ts similarity index 100% rename from backend/node_modules/@types/node/timers/promises.d.ts rename to node_modules/@types/node/timers/promises.d.ts diff --git a/backend/node_modules/@types/node/tls.d.ts b/node_modules/@types/node/tls.d.ts similarity index 91% rename from backend/node_modules/@types/node/tls.d.ts rename to node_modules/@types/node/tls.d.ts index 629db52..5d52de8 100644 --- a/backend/node_modules/@types/node/tls.d.ts +++ b/node_modules/@types/node/tls.d.ts @@ -9,6 +9,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/tls.js) */ declare module "tls" { + import { NonSharedBuffer } from "node:buffer"; import { X509Certificate } from "node:crypto"; import * as net from "node:net"; import * as stream from "stream"; @@ -49,7 +50,7 @@ declare module "tls" { /** * The DER encoded X.509 certificate data. */ - raw: Buffer; + raw: NonSharedBuffer; /** * The certificate subject. */ @@ -115,7 +116,7 @@ declare module "tls" { /** * The public key. */ - pubkey?: Buffer; + pubkey?: NonSharedBuffer; /** * The ASN.1 name of the OID of the elliptic curve. * Well-known curves are identified by an OID. @@ -295,7 +296,7 @@ declare module "tls" { * @since v9.9.0 * @return The latest `Finished` message that has been sent to the socket as part of a SSL/TLS handshake, or `undefined` if no `Finished` message has been sent yet. */ - getFinished(): Buffer | undefined; + getFinished(): NonSharedBuffer | undefined; /** * Returns an object representing the peer's certificate. If the peer does not * provide a certificate, an empty object will be returned. If the socket has been @@ -322,7 +323,7 @@ declare module "tls" { * @return The latest `Finished` message that is expected or has actually been received from the socket as part of a SSL/TLS handshake, or `undefined` if there is no `Finished` message so * far. */ - getPeerFinished(): Buffer | undefined; + getPeerFinished(): NonSharedBuffer | undefined; /** * Returns a string containing the negotiated SSL/TLS protocol version of the * current connection. The value `'unknown'` will be returned for connected @@ -352,7 +353,7 @@ declare module "tls" { * must use the `'session'` event (it also works for TLSv1.2 and below). * @since v0.11.4 */ - getSession(): Buffer | undefined; + getSession(): NonSharedBuffer | undefined; /** * See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information. * @since v12.11.0 @@ -367,7 +368,7 @@ declare module "tls" { * See `Session Resumption` for more information. * @since v0.11.4 */ - getTLSTicket(): Buffer | undefined; + getTLSTicket(): NonSharedBuffer | undefined; /** * See `Session Resumption` for more information. * @since v0.5.6 @@ -478,37 +479,37 @@ declare module "tls" { * @param context Optionally provide a context. * @return requested bytes of the keying material */ - exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer; + exportKeyingMaterial(length: number, label: string, context: Buffer): NonSharedBuffer; addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; + addListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; addListener(event: "secureConnect", listener: () => void): this; - addListener(event: "session", listener: (session: Buffer) => void): this; - addListener(event: "keylog", listener: (line: Buffer) => void): this; + addListener(event: "session", listener: (session: NonSharedBuffer) => void): this; + addListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this; emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "OCSPResponse", response: Buffer): boolean; + emit(event: "OCSPResponse", response: NonSharedBuffer): boolean; emit(event: "secureConnect"): boolean; - emit(event: "session", session: Buffer): boolean; - emit(event: "keylog", line: Buffer): boolean; + emit(event: "session", session: NonSharedBuffer): boolean; + emit(event: "keylog", line: NonSharedBuffer): boolean; on(event: string, listener: (...args: any[]) => void): this; - on(event: "OCSPResponse", listener: (response: Buffer) => void): this; + on(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; on(event: "secureConnect", listener: () => void): this; - on(event: "session", listener: (session: Buffer) => void): this; - on(event: "keylog", listener: (line: Buffer) => void): this; + on(event: "session", listener: (session: NonSharedBuffer) => void): this; + on(event: "keylog", listener: (line: NonSharedBuffer) => void): this; once(event: string, listener: (...args: any[]) => void): this; - once(event: "OCSPResponse", listener: (response: Buffer) => void): this; + once(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; once(event: "secureConnect", listener: () => void): this; - once(event: "session", listener: (session: Buffer) => void): this; - once(event: "keylog", listener: (line: Buffer) => void): this; + once(event: "session", listener: (session: NonSharedBuffer) => void): this; + once(event: "keylog", listener: (line: NonSharedBuffer) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; + prependListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; prependListener(event: "secureConnect", listener: () => void): this; - prependListener(event: "session", listener: (session: Buffer) => void): this; - prependListener(event: "keylog", listener: (line: Buffer) => void): this; + prependListener(event: "session", listener: (session: NonSharedBuffer) => void): this; + prependListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; + prependOnceListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; prependOnceListener(event: "secureConnect", listener: () => void): this; - prependOnceListener(event: "session", listener: (session: Buffer) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer) => void): this; + prependOnceListener(event: "session", listener: (session: NonSharedBuffer) => void): this; + prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this; } interface CommonConnectionOptions { /** @@ -531,7 +532,7 @@ declare module "tls" { * An array of strings or a Buffer naming possible ALPN protocols. * (Protocols should be ordered by their priority.) */ - ALPNProtocols?: string[] | Uint8Array[] | Uint8Array | undefined; + ALPNProtocols?: readonly string[] | NodeJS.ArrayBufferView | undefined; /** * SNICallback(servername, cb) A function that will be * called if the client supports SNI TLS extension. Two arguments @@ -596,7 +597,7 @@ declare module "tls" { pskIdentityHint?: string | undefined; } interface PSKCallbackNegotation { - psk: DataView | NodeJS.TypedArray; + psk: NodeJS.ArrayBufferView; identity: string; } interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions { @@ -655,7 +656,7 @@ declare module "tls" { * @since v3.0.0 * @return A 48-byte buffer containing the session ticket keys. */ - getTicketKeys(): Buffer; + getTicketKeys(): NonSharedBuffer; /** * The `server.setSecureContext()` method replaces the secure context of an * existing server. Existing connections to the server are not interrupted. @@ -687,115 +688,138 @@ declare module "tls" { addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; addListener( event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, + listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, ): this; addListener( event: "OCSPRequest", listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, + certificate: NonSharedBuffer, + issuer: NonSharedBuffer, + callback: (err: Error | null, resp: Buffer | null) => void, ) => void, ): this; addListener( event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, + listener: ( + sessionId: NonSharedBuffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, ): this; addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + addListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this; emit(event: string | symbol, ...args: any[]): boolean; emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; - emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: () => void): boolean; + emit( + event: "newSession", + sessionId: NonSharedBuffer, + sessionData: NonSharedBuffer, + callback: () => void, + ): boolean; emit( event: "OCSPRequest", - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, + certificate: NonSharedBuffer, + issuer: NonSharedBuffer, + callback: (err: Error | null, resp: Buffer | null) => void, ): boolean; emit( event: "resumeSession", - sessionId: Buffer, + sessionId: NonSharedBuffer, callback: (err: Error | null, sessionData: Buffer | null) => void, ): boolean; emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; - emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean; + emit(event: "keylog", line: NonSharedBuffer, tlsSocket: TLSSocket): boolean; on(event: string, listener: (...args: any[]) => void): this; on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; + on( + event: "newSession", + listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, + ): this; on( event: "OCSPRequest", listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, + certificate: NonSharedBuffer, + issuer: NonSharedBuffer, + callback: (err: Error | null, resp: Buffer | null) => void, ) => void, ): this; on( event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, + listener: ( + sessionId: NonSharedBuffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, ): this; on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + on(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this; once(event: string, listener: (...args: any[]) => void): this; once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; once( event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, + listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, ): this; once( event: "OCSPRequest", listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, + certificate: NonSharedBuffer, + issuer: NonSharedBuffer, + callback: (err: Error | null, resp: Buffer | null) => void, ) => void, ): this; once( event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, + listener: ( + sessionId: NonSharedBuffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, ): this; once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + once(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; prependListener( event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, + listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, ): this; prependListener( event: "OCSPRequest", listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, + certificate: NonSharedBuffer, + issuer: NonSharedBuffer, + callback: (err: Error | null, resp: Buffer | null) => void, ) => void, ): this; prependListener( event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, + listener: ( + sessionId: NonSharedBuffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, ): this; prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + prependListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; prependOnceListener( event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, + listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, ): this; prependOnceListener( event: "OCSPRequest", listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, + certificate: NonSharedBuffer, + issuer: NonSharedBuffer, + callback: (err: Error | null, resp: Buffer | null) => void, ) => void, ): this; prependOnceListener( event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, + listener: ( + sessionId: NonSharedBuffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, ): this; prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this; } type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1"; interface SecureContextOptions { diff --git a/backend/node_modules/@types/node/trace_events.d.ts b/node_modules/@types/node/trace_events.d.ts similarity index 100% rename from backend/node_modules/@types/node/trace_events.d.ts rename to node_modules/@types/node/trace_events.d.ts diff --git a/backend/node_modules/@types/node/ts5.6/buffer.buffer.d.ts b/node_modules/@types/node/ts5.6/buffer.buffer.d.ts similarity index 97% rename from backend/node_modules/@types/node/ts5.6/buffer.buffer.d.ts rename to node_modules/@types/node/ts5.6/buffer.buffer.d.ts index d19026d..a5f67d7 100644 --- a/backend/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +++ b/node_modules/@types/node/ts5.6/buffer.buffer.d.ts @@ -32,7 +32,7 @@ declare module "buffer" { * @param arrayBuffer The ArrayBuffer with which to share memory. * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. */ - new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer; + new(arrayBuffer: ArrayBufferLike): Buffer; /** * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`. * Array entries outside that range will be truncated to fit into it. @@ -126,7 +126,7 @@ declare module "buffer" { * `arrayBuffer.byteLength - byteOffset`. */ from( - arrayBuffer: WithImplicitCoercion, + arrayBuffer: WithImplicitCoercion, byteOffset?: number, length?: number, ): Buffer; @@ -448,7 +448,15 @@ declare module "buffer" { */ subarray(start?: number, end?: number): Buffer; } + /** + * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports + * TypeScript versions earlier than 5.7. + */ type NonSharedBuffer = Buffer; + /** + * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports + * TypeScript versions earlier than 5.7. + */ type AllowSharedBuffer = Buffer; } /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */ diff --git a/backend/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts b/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts similarity index 100% rename from backend/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts rename to node_modules/@types/node/ts5.6/compatibility/float16array.d.ts diff --git a/node_modules/@types/node/ts5.6/globals.typedarray.d.ts b/node_modules/@types/node/ts5.6/globals.typedarray.d.ts new file mode 100644 index 0000000..57a1ab4 --- /dev/null +++ b/node_modules/@types/node/ts5.6/globals.typedarray.d.ts @@ -0,0 +1,36 @@ +export {}; // Make this a module + +declare global { + namespace NodeJS { + type TypedArray = + | Uint8Array + | Uint8ClampedArray + | Uint16Array + | Uint32Array + | Int8Array + | Int16Array + | Int32Array + | BigUint64Array + | BigInt64Array + | Float16Array + | Float32Array + | Float64Array; + type ArrayBufferView = TypedArray | DataView; + + type NonSharedUint8Array = Uint8Array; + type NonSharedUint8ClampedArray = Uint8ClampedArray; + type NonSharedUint16Array = Uint16Array; + type NonSharedUint32Array = Uint32Array; + type NonSharedInt8Array = Int8Array; + type NonSharedInt16Array = Int16Array; + type NonSharedInt32Array = Int32Array; + type NonSharedBigUint64Array = BigUint64Array; + type NonSharedBigInt64Array = BigInt64Array; + type NonSharedFloat16Array = Float16Array; + type NonSharedFloat32Array = Float32Array; + type NonSharedFloat64Array = Float64Array; + type NonSharedDataView = DataView; + type NonSharedTypedArray = TypedArray; + type NonSharedArrayBufferView = ArrayBufferView; + } +} diff --git a/backend/node_modules/@types/node/ts5.6/index.d.ts b/node_modules/@types/node/ts5.6/index.d.ts similarity index 100% rename from backend/node_modules/@types/node/ts5.6/index.d.ts rename to node_modules/@types/node/ts5.6/index.d.ts diff --git a/backend/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts b/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts similarity index 100% rename from backend/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts rename to node_modules/@types/node/ts5.7/compatibility/float16array.d.ts diff --git a/backend/node_modules/@types/node/ts5.7/index.d.ts b/node_modules/@types/node/ts5.7/index.d.ts similarity index 100% rename from backend/node_modules/@types/node/ts5.7/index.d.ts rename to node_modules/@types/node/ts5.7/index.d.ts diff --git a/backend/node_modules/@types/node/tty.d.ts b/node_modules/@types/node/tty.d.ts similarity index 100% rename from backend/node_modules/@types/node/tty.d.ts rename to node_modules/@types/node/tty.d.ts diff --git a/backend/node_modules/@types/node/url.d.ts b/node_modules/@types/node/url.d.ts similarity index 96% rename from backend/node_modules/@types/node/url.d.ts rename to node_modules/@types/node/url.d.ts index ba12c46..8d0fb65 100644 --- a/backend/node_modules/@types/node/url.d.ts +++ b/node_modules/@types/node/url.d.ts @@ -8,7 +8,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/url.js) */ declare module "url" { - import { Blob as NodeBlob } from "node:buffer"; + import { Blob as NodeBlob, NonSharedBuffer } from "node:buffer"; import { ClientRequestArgs } from "node:http"; import { ParsedUrlQuery, ParsedUrlQueryInput } from "node:querystring"; // Input to `url.format` @@ -71,20 +71,44 @@ declare module "url" { * A `URIError` is thrown if the `auth` property is present but cannot be decoded. * * `url.parse()` uses a lenient, non-standard algorithm for parsing URL - * strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) and incorrect handling of usernames and passwords. Do not use with untrusted - * input. CVEs are not issued for `url.parse()` vulnerabilities. Use the `WHATWG URL` API instead. + * strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) + * and incorrect handling of usernames and passwords. Do not use with untrusted + * input. CVEs are not issued for `url.parse()` vulnerabilities. Use the + * [WHATWG URL](https://nodejs.org/docs/latest-v24.x/api/url.html#the-whatwg-url-api) API instead, for example: + * + * ```js + * function getURL(req) { + * const proto = req.headers['x-forwarded-proto'] || 'https'; + * const host = req.headers['x-forwarded-host'] || req.headers.host || 'example.com'; + * return new URL(req.url || '/', `${proto}://${host}`); + * } + * ``` + * + * The example above assumes well-formed headers are forwarded from a reverse + * proxy to your Node.js server. If you are not using a reverse proxy, you should + * use the example below: + * + * ```js + * function getURL(req) { + * return new URL(req.url || '/', 'https://example.com'); + * } + * ``` * @since v0.1.25 * @deprecated Use the WHATWG URL API instead. * @param urlString The URL string to parse. - * @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property - * on the returned URL object will be an unparsed, undecoded string. - * @param [slashesDenoteHost=false] If `true`, the first token after the literal string `//` and preceding the next `/` will be interpreted as the `host`. For instance, given `//foo/bar`, the - * result would be `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`. + * @param parseQueryString If `true`, the `query` property will always + * be set to an object returned by the [`querystring`](https://nodejs.org/docs/latest-v24.x/api/querystring.html) module's `parse()` + * method. If `false`, the `query` property on the returned URL object will be an + * unparsed, undecoded string. **Default:** `false`. + * @param slashesDenoteHost If `true`, the first token after the literal + * string `//` and preceding the next `/` will be interpreted as the `host`. + * For instance, given `//foo/bar`, the result would be + * `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`. + * **Default:** `false`. */ - function parse(urlString: string): UrlWithStringQuery; function parse( urlString: string, - parseQueryString: false | undefined, + parseQueryString?: false, slashesDenoteHost?: boolean, ): UrlWithStringQuery; function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; @@ -325,7 +349,7 @@ declare module "url" { * @returns The fully-resolved platform-specific Node.js file path * as a `Buffer`. */ - function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions): Buffer; + function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions): NonSharedBuffer; /** * This function ensures that `path` is resolved absolutely, and that the URL * control characters are correctly encoded when converting into a File URL. diff --git a/backend/node_modules/@types/node/util.d.ts b/node_modules/@types/node/util.d.ts similarity index 99% rename from backend/node_modules/@types/node/util.d.ts rename to node_modules/@types/node/util.d.ts index 287952a..c825a79 100644 --- a/backend/node_modules/@types/node/util.d.ts +++ b/node_modules/@types/node/util.d.ts @@ -853,6 +853,15 @@ declare module "util" { * @return The deprecated function wrapped to emit a warning. */ export function deprecate(fn: T, msg: string, code?: string): T; + export interface IsDeepStrictEqualOptions { + /** + * If `true`, prototype and constructor + * comparison is skipped during deep strict equality check. + * @since v24.9.0 + * @default false + */ + skipPrototype?: boolean | undefined; + } /** * Returns `true` if there is deep strict equality between `val1` and `val2`. * Otherwise, returns `false`. @@ -861,7 +870,7 @@ declare module "util" { * equality. * @since v9.0.0 */ - export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean; + export function isDeepStrictEqual(val1: unknown, val2: unknown, options?: IsDeepStrictEqualOptions): boolean; /** * Returns `str` with any ANSI escape codes removed. * @@ -1332,7 +1341,7 @@ declare module "util" { * encoded bytes. * @param [input='an empty string'] The text to encode. */ - encode(input?: string): Uint8Array; + encode(input?: string): NodeJS.NonSharedUint8Array; /** * UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object * containing the read Unicode code units and written UTF-8 bytes. @@ -1442,7 +1451,7 @@ declare module "util" { /** * Array of argument strings. */ - args?: string[] | undefined; + args?: readonly string[] | undefined; /** * Used to describe arguments known to the parser. */ diff --git a/backend/node_modules/@types/node/v8.d.ts b/node_modules/@types/node/v8.d.ts similarity index 97% rename from backend/node_modules/@types/node/v8.d.ts rename to node_modules/@types/node/v8.d.ts index 40c58af..d509ee1 100644 --- a/backend/node_modules/@types/node/v8.d.ts +++ b/node_modules/@types/node/v8.d.ts @@ -7,6 +7,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/v8.js) */ declare module "v8" { + import { NonSharedBuffer } from "node:buffer"; import { Readable } from "node:stream"; interface HeapSpaceInfo { space_name: string; @@ -400,6 +401,38 @@ declare module "v8" { * @since v12.8.0 */ function getHeapCodeStatistics(): HeapCodeStatistics; + /** + * @since v24.8.0 + */ + interface CPUProfileHandle { + /** + * Stopping collecting the profile, then return a Promise that fulfills with an error or the + * profile data. + * @since v24.8.0 + */ + stop(): Promise; + /** + * Stopping collecting the profile and the profile will be discarded. + * @since v24.8.0 + */ + [Symbol.asyncDispose](): Promise; + } + /** + * @since v24.9.0 + */ + interface HeapProfileHandle { + /** + * Stopping collecting the profile, then return a Promise that fulfills with an error or the + * profile data. + * @since v24.9.0 + */ + stop(): Promise; + /** + * Stopping collecting the profile and the profile will be discarded. + * @since v24.9.0 + */ + [Symbol.asyncDispose](): Promise; + } /** * V8 only supports `Latin-1/ISO-8859-1` and `UTF16` as the underlying representation of a string. * If the `content` uses `Latin-1/ISO-8859-1` as the underlying representation, this function will return true; @@ -453,7 +486,7 @@ declare module "v8" { * the buffer is released. Calling this method results in undefined behavior * if a previous write has failed. */ - releaseBuffer(): Buffer; + releaseBuffer(): NonSharedBuffer; /** * Marks an `ArrayBuffer` as having its contents transferred out of band. * Pass the corresponding `ArrayBuffer` in the deserializing context to `deserializer.transferArrayBuffer()`. @@ -481,7 +514,7 @@ declare module "v8" { * will require a way to compute the length of the buffer. * For use inside of a custom `serializer._writeHostObject()`. */ - writeRawBytes(buffer: NodeJS.TypedArray): void; + writeRawBytes(buffer: NodeJS.ArrayBufferView): void; } /** * A subclass of `Serializer` that serializes `TypedArray`(in particular `Buffer`) and `DataView` objects as host objects, and only @@ -552,7 +585,7 @@ declare module "v8" { * larger than `buffer.constants.MAX_LENGTH`. * @since v8.0.0 */ - function serialize(value: any): Buffer; + function serialize(value: any): NonSharedBuffer; /** * Uses a `DefaultDeserializer` with default options to read a JS value * from a buffer. diff --git a/backend/node_modules/@types/node/vm.d.ts b/node_modules/@types/node/vm.d.ts similarity index 86% rename from backend/node_modules/@types/node/vm.d.ts rename to node_modules/@types/node/vm.d.ts index 06a5343..50b7f09 100644 --- a/backend/node_modules/@types/node/vm.d.ts +++ b/node_modules/@types/node/vm.d.ts @@ -37,6 +37,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/vm.js) */ declare module "vm" { + import { NonSharedBuffer } from "node:buffer"; import { ImportAttributes, ImportPhase } from "node:module"; interface Context extends NodeJS.Dict {} interface BaseOptions { @@ -66,7 +67,7 @@ declare module "vm" { /** * Provides an optional data with V8's code cache data for the supplied source. */ - cachedData?: Buffer | NodeJS.ArrayBufferView | undefined; + cachedData?: NodeJS.ArrayBufferView | undefined; /** @deprecated in favor of `script.createCachedData()` */ produceCachedData?: boolean | undefined; /** @@ -367,7 +368,7 @@ declare module "vm" { * ``` * @since v10.6.0 */ - createCachedData(): Buffer; + createCachedData(): NonSharedBuffer; /** @deprecated in favor of `script.createCachedData()` */ cachedDataProduced?: boolean; /** @@ -377,7 +378,7 @@ declare module "vm" { * @since v5.7.0 */ cachedDataRejected?: boolean; - cachedData?: Buffer; + cachedData?: NonSharedBuffer; /** * When the script is compiled from a source that contains a source map magic * comment, this property will be set to the URL of the source map. @@ -676,14 +677,12 @@ declare module "vm" { * flag enabled. * * The `vm.Module` class provides a low-level interface for using - * ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script` class that closely mirrors [Module Record](https://262.ecma-international.org/14.0/#sec-abstract-module-records) s as - * defined in the ECMAScript + * ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script` + * class that closely mirrors [Module Record](https://tc39.es/ecma262/#sec-abstract-module-records)s as defined in the ECMAScript * specification. * * Unlike `vm.Script` however, every `vm.Module` object is bound to a context from - * its creation. Operations on `vm.Module` objects are intrinsically asynchronous, - * in contrast with the synchronous nature of `vm.Script` objects. The use of - * 'async' functions can help with manipulating `vm.Module` objects. + * its creation. * * Using a `vm.Module` object requires three distinct steps: creation/parsing, * linking, and evaluation. These three steps are illustrated in the following @@ -711,7 +710,7 @@ declare module "vm" { * // Here, we attempt to obtain the default export from the module "foo", and * // put it into local binding "secret". * - * const bar = new vm.SourceTextModule(` + * const rootModule = new vm.SourceTextModule(` * import s from 'foo'; * s; * print(s); @@ -721,39 +720,48 @@ declare module "vm" { * // * // "Link" the imported dependencies of this Module to it. * // - * // The provided linking callback (the "linker") accepts two arguments: the - * // parent module (`bar` in this case) and the string that is the specifier of - * // the imported module. The callback is expected to return a Module that - * // corresponds to the provided specifier, with certain requirements documented - * // in `module.link()`. - * // - * // If linking has not started for the returned Module, the same linker - * // callback will be called on the returned Module. + * // Obtain the requested dependencies of a SourceTextModule by + * // `sourceTextModule.moduleRequests` and resolve them. * // * // Even top-level Modules without dependencies must be explicitly linked. The - * // callback provided would never be called, however. + * // array passed to `sourceTextModule.linkRequests(modules)` can be + * // empty, however. * // - * // The link() method returns a Promise that will be resolved when all the - * // Promises returned by the linker resolve. - * // - * // Note: This is a contrived example in that the linker function creates a new - * // "foo" module every time it is called. In a full-fledged module system, a - * // cache would probably be used to avoid duplicated modules. + * // Note: This is a contrived example in that the resolveAndLinkDependencies + * // creates a new "foo" module every time it is called. In a full-fledged + * // module system, a cache would probably be used to avoid duplicated modules. * - * async function linker(specifier, referencingModule) { - * if (specifier === 'foo') { - * return new vm.SourceTextModule(` - * // The "secret" variable refers to the global variable we added to - * // "contextifiedObject" when creating the context. - * export default secret; - * `, { context: referencingModule.context }); + * const moduleMap = new Map([ + * ['root', rootModule], + * ]); * - * // Using `contextifiedObject` instead of `referencingModule.context` - * // here would work as well. - * } - * throw new Error(`Unable to resolve dependency: ${specifier}`); + * function resolveAndLinkDependencies(module) { + * const requestedModules = module.moduleRequests.map((request) => { + * // In a full-fledged module system, the resolveAndLinkDependencies would + * // resolve the module with the module cache key `[specifier, attributes]`. + * // In this example, we just use the specifier as the key. + * const specifier = request.specifier; + * + * let requestedModule = moduleMap.get(specifier); + * if (requestedModule === undefined) { + * requestedModule = new vm.SourceTextModule(` + * // The "secret" variable refers to the global variable we added to + * // "contextifiedObject" when creating the context. + * export default secret; + * `, { context: referencingModule.context }); + * moduleMap.set(specifier, linkedModule); + * // Resolve the dependencies of the new module as well. + * resolveAndLinkDependencies(requestedModule); + * } + * + * return requestedModule; + * }); + * + * module.linkRequests(requestedModules); * } - * await bar.link(linker); + * + * resolveAndLinkDependencies(rootModule); + * rootModule.instantiate(); * * // Step 3 * // @@ -761,7 +769,7 @@ declare module "vm" { * // resolve after the module has finished evaluating. * * // Prints 42. - * await bar.evaluate(); + * await rootModule.evaluate(); * ``` * @since v13.0.0, v12.16.0 * @experimental @@ -831,6 +839,10 @@ declare module "vm" { * Link module dependencies. This method must be called before evaluation, and * can only be called once per module. * + * Use `sourceTextModule.linkRequests(modules)` and + * `sourceTextModule.instantiate()` to link modules either synchronously or + * asynchronously. + * * The function is expected to return a `Module` object or a `Promise` that * eventually resolves to a `Module` object. The returned `Module` must satisfy the * following two invariants: @@ -911,6 +923,39 @@ declare module "vm" { class SourceTextModule extends Module { /** * Creates a new `SourceTextModule` instance. + * + * Properties assigned to the `import.meta` object that are objects may + * allow the module to access information outside the specified `context`. Use + * `vm.runInContext()` to create objects in a specific context. + * + * ```js + * import vm from 'node:vm'; + * + * const contextifiedObject = vm.createContext({ secret: 42 }); + * + * const module = new vm.SourceTextModule( + * 'Object.getPrototypeOf(import.meta.prop).secret = secret;', + * { + * initializeImportMeta(meta) { + * // Note: this object is created in the top context. As such, + * // Object.getPrototypeOf(import.meta.prop) points to the + * // Object.prototype in the top context rather than that in + * // the contextified object. + * meta.prop = {}; + * }, + * }); + * // The module has an empty `moduleRequests` array. + * module.linkRequests([]); + * module.instantiate(); + * await module.evaluate(); + * + * // Now, Object.prototype.secret will be equal to 42. + * // + * // To fix this problem, replace + * // meta.prop = {}; + * // above with + * // meta.prop = vm.runInContext('{}', contextifiedObject); + * ``` * @param code JavaScript Module code to parse */ constructor(code: string, options?: SourceTextModuleOptions); @@ -918,6 +963,75 @@ declare module "vm" { * @deprecated Use `sourceTextModule.moduleRequests` instead. */ readonly dependencySpecifiers: readonly string[]; + /** + * Iterates over the dependency graph and returns `true` if any module in its + * dependencies or this module itself contains top-level `await` expressions, + * otherwise returns `false`. + * + * The search may be slow if the graph is big enough. + * + * This requires the module to be instantiated first. If the module is not + * instantiated yet, an error will be thrown. + * @since v24.9.0 + */ + hasAsyncGraph(): boolean; + /** + * Returns whether the module itself contains any top-level `await` expressions. + * + * This corresponds to the field `[[HasTLA]]` in [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) in the + * ECMAScript specification. + * @since v24.9.0 + */ + hasTopLevelAwait(): boolean; + /** + * Instantiate the module with the linked requested modules. + * + * This resolves the imported bindings of the module, including re-exported + * binding names. When there are any bindings that cannot be resolved, + * an error would be thrown synchronously. + * + * If the requested modules include cyclic dependencies, the + * `sourceTextModule.linkRequests(modules)` method must be called on all + * modules in the cycle before calling this method. + * @since v24.8.0 + */ + instantiate(): void; + /** + * Link module dependencies. This method must be called before evaluation, and + * can only be called once per module. + * + * The order of the module instances in the `modules` array should correspond to the order of + * `sourceTextModule.moduleRequests` being resolved. If two module requests have the same + * specifier and import attributes, they must be resolved with the same module instance or an + * `ERR_MODULE_LINK_MISMATCH` would be thrown. For example, when linking requests for this + * module: + * + * ```js + * import foo from 'foo'; + * import source Foo from 'foo'; + * ``` + * + * The `modules` array must contain two references to the same instance, because the two + * module requests are identical but in two phases. + * + * If the module has no dependencies, the `modules` array can be empty. + * + * Users can use `sourceTextModule.moduleRequests` to implement the host-defined + * [HostLoadImportedModule](https://tc39.es/ecma262/#sec-HostLoadImportedModule) abstract operation in the ECMAScript specification, + * and using `sourceTextModule.linkRequests()` to invoke specification defined + * [FinishLoadingImportedModule](https://tc39.es/ecma262/#sec-FinishLoadingImportedModule), on the module with all dependencies in a batch. + * + * It's up to the creator of the `SourceTextModule` to determine if the resolution + * of the dependencies is synchronous or asynchronous. + * + * After each module in the `modules` array is linked, call + * `sourceTextModule.instantiate()`. + * @since v24.8.0 + * @param modules Array of `vm.Module` objects that this module depends on. + * The order of the modules in the array is the order of + * `sourceTextModule.moduleRequests`. + */ + linkRequests(modules: readonly Module[]): void; /** * The requested import dependencies of this module. The returned array is frozen * to disallow any changes to it. @@ -1013,9 +1127,7 @@ declare module "vm" { options?: SyntheticModuleOptions, ); /** - * This method is used after the module is linked to set the values of exports. If - * it is called before the module is linked, an `ERR_VM_MODULE_STATUS` error - * will be thrown. + * This method sets the module export binding slots with the given value. * * ```js * import vm from 'node:vm'; @@ -1024,7 +1136,6 @@ declare module "vm" { * m.setExport('x', 1); * }); * - * await m.link(() => {}); * await m.evaluate(); * * assert.strictEqual(m.namespace.x, 1); diff --git a/backend/node_modules/@types/node/wasi.d.ts b/node_modules/@types/node/wasi.d.ts similarity index 99% rename from backend/node_modules/@types/node/wasi.d.ts rename to node_modules/@types/node/wasi.d.ts index 150ad90..7685c1e 100644 --- a/backend/node_modules/@types/node/wasi.d.ts +++ b/node_modules/@types/node/wasi.d.ts @@ -77,7 +77,7 @@ declare module "wasi" { * WASI command itself. * @default [] */ - args?: string[] | undefined; + args?: readonly string[] | undefined; /** * An object similar to `process.env` that the WebAssembly * application will see as its environment. diff --git a/backend/node_modules/@types/node/web-globals/abortcontroller.d.ts b/node_modules/@types/node/web-globals/abortcontroller.d.ts similarity index 100% rename from backend/node_modules/@types/node/web-globals/abortcontroller.d.ts rename to node_modules/@types/node/web-globals/abortcontroller.d.ts diff --git a/backend/node_modules/@types/node/web-globals/crypto.d.ts b/node_modules/@types/node/web-globals/crypto.d.ts similarity index 100% rename from backend/node_modules/@types/node/web-globals/crypto.d.ts rename to node_modules/@types/node/web-globals/crypto.d.ts diff --git a/backend/node_modules/@types/node/web-globals/domexception.d.ts b/node_modules/@types/node/web-globals/domexception.d.ts similarity index 100% rename from backend/node_modules/@types/node/web-globals/domexception.d.ts rename to node_modules/@types/node/web-globals/domexception.d.ts diff --git a/backend/node_modules/@types/node/web-globals/events.d.ts b/node_modules/@types/node/web-globals/events.d.ts similarity index 100% rename from backend/node_modules/@types/node/web-globals/events.d.ts rename to node_modules/@types/node/web-globals/events.d.ts diff --git a/backend/node_modules/@types/node/web-globals/fetch.d.ts b/node_modules/@types/node/web-globals/fetch.d.ts similarity index 100% rename from backend/node_modules/@types/node/web-globals/fetch.d.ts rename to node_modules/@types/node/web-globals/fetch.d.ts diff --git a/backend/node_modules/@types/node/web-globals/navigator.d.ts b/node_modules/@types/node/web-globals/navigator.d.ts similarity index 100% rename from backend/node_modules/@types/node/web-globals/navigator.d.ts rename to node_modules/@types/node/web-globals/navigator.d.ts diff --git a/backend/node_modules/@types/node/web-globals/storage.d.ts b/node_modules/@types/node/web-globals/storage.d.ts similarity index 100% rename from backend/node_modules/@types/node/web-globals/storage.d.ts rename to node_modules/@types/node/web-globals/storage.d.ts diff --git a/backend/node_modules/@types/node/web-globals/streams.d.ts b/node_modules/@types/node/web-globals/streams.d.ts similarity index 100% rename from backend/node_modules/@types/node/web-globals/streams.d.ts rename to node_modules/@types/node/web-globals/streams.d.ts diff --git a/backend/node_modules/@types/node/worker_threads.d.ts b/node_modules/@types/node/worker_threads.d.ts similarity index 93% rename from backend/node_modules/@types/node/worker_threads.d.ts rename to node_modules/@types/node/worker_threads.d.ts index e3350f3..cc947c0 100644 --- a/backend/node_modules/@types/node/worker_threads.d.ts +++ b/node_modules/@types/node/worker_threads.d.ts @@ -62,7 +62,7 @@ declare module "worker_threads" { import { Readable, Writable } from "node:stream"; import { ReadableStream, TransformStream, WritableStream } from "node:stream/web"; import { URL } from "node:url"; - import { HeapInfo } from "node:v8"; + import { CPUProfileHandle, HeapInfo, HeapProfileHandle } from "node:v8"; import { MessageEvent } from "undici-types"; const isInternalThread: boolean; const isMainThread: boolean; @@ -469,6 +469,81 @@ declare module "worker_threads" { * @since v24.0.0 */ getHeapStatistics(): Promise; + /** + * Starting a CPU profile then return a Promise that fulfills with an error + * or an `CPUProfileHandle` object. This API supports `await using` syntax. + * + * ```js + * const { Worker } = require('node:worker_threads'); + * + * const worker = new Worker(` + * const { parentPort } = require('worker_threads'); + * parentPort.on('message', () => {}); + * `, { eval: true }); + * + * worker.on('online', async () => { + * const handle = await worker.startCpuProfile(); + * const profile = await handle.stop(); + * console.log(profile); + * worker.terminate(); + * }); + * ``` + * + * `await using` example. + * + * ```js + * const { Worker } = require('node:worker_threads'); + * + * const w = new Worker(` + * const { parentPort } = require('node:worker_threads'); + * parentPort.on('message', () => {}); + * `, { eval: true }); + * + * w.on('online', async () => { + * // Stop profile automatically when return and profile will be discarded + * await using handle = await w.startCpuProfile(); + * }); + * ``` + * @since v24.8.0 + */ + startCpuProfile(): Promise; + /** + * Starting a Heap profile then return a Promise that fulfills with an error + * or an `HeapProfileHandle` object. This API supports `await using` syntax. + * + * ```js + * const { Worker } = require('node:worker_threads'); + * + * const worker = new Worker(` + * const { parentPort } = require('worker_threads'); + * parentPort.on('message', () => {}); + * `, { eval: true }); + * + * worker.on('online', async () => { + * const handle = await worker.startHeapProfile(); + * const profile = await handle.stop(); + * console.log(profile); + * worker.terminate(); + * }); + * ``` + * + * `await using` example. + * + * ```js + * const { Worker } = require('node:worker_threads'); + * + * const w = new Worker(` + * const { parentPort } = require('node:worker_threads'); + * parentPort.on('message', () => {}); + * `, { eval: true }); + * + * w.on('online', async () => { + * // Stop profile automatically when return and profile will be discarded + * await using handle = await w.startHeapProfile(); + * }); + * ``` + */ + startHeapProfile(): Promise; /** * Calls `worker.terminate()` when the dispose scope is exited. * diff --git a/backend/node_modules/@types/node/zlib.d.ts b/node_modules/@types/node/zlib.d.ts similarity index 96% rename from backend/node_modules/@types/node/zlib.d.ts rename to node_modules/@types/node/zlib.d.ts index ebdc232..10f0e60 100644 --- a/backend/node_modules/@types/node/zlib.d.ts +++ b/node_modules/@types/node/zlib.d.ts @@ -92,6 +92,7 @@ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/zlib.js) */ declare module "zlib" { + import { NonSharedBuffer } from "node:buffer"; import * as stream from "node:stream"; interface ZlibOptions { /** @@ -227,7 +228,7 @@ declare module "zlib" { * @returns A 32-bit unsigned integer containing the checksum. * @since v22.2.0 */ - function crc32(data: string | Buffer | NodeJS.ArrayBufferView, value?: number): number; + function crc32(data: string | NodeJS.ArrayBufferView, value?: number): number; /** * Creates and returns a new `BrotliCompress` object. * @since v11.7.0, v10.16.0 @@ -291,124 +292,124 @@ declare module "zlib" { */ function createZstdDecompress(options?: ZstdOptions): ZstdDecompress; type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView; - type CompressCallback = (error: Error | null, result: Buffer) => void; + type CompressCallback = (error: Error | null, result: NonSharedBuffer) => void; /** * @since v11.7.0, v10.16.0 */ function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void; function brotliCompress(buf: InputType, callback: CompressCallback): void; namespace brotliCompress { - function __promisify__(buffer: InputType, options?: BrotliOptions): Promise; + function __promisify__(buffer: InputType, options?: BrotliOptions): Promise; } /** * Compress a chunk of data with `BrotliCompress`. * @since v11.7.0, v10.16.0 */ - function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer; + function brotliCompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer; /** * @since v11.7.0, v10.16.0 */ function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void; function brotliDecompress(buf: InputType, callback: CompressCallback): void; namespace brotliDecompress { - function __promisify__(buffer: InputType, options?: BrotliOptions): Promise; + function __promisify__(buffer: InputType, options?: BrotliOptions): Promise; } /** * Decompress a chunk of data with `BrotliDecompress`. * @since v11.7.0, v10.16.0 */ - function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer; + function brotliDecompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer; /** * @since v0.6.0 */ function deflate(buf: InputType, callback: CompressCallback): void; function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; namespace deflate { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; + function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; } /** * Compress a chunk of data with `Deflate`. * @since v0.11.12 */ - function deflateSync(buf: InputType, options?: ZlibOptions): Buffer; + function deflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer; /** * @since v0.6.0 */ function deflateRaw(buf: InputType, callback: CompressCallback): void; function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; namespace deflateRaw { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; + function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; } /** * Compress a chunk of data with `DeflateRaw`. * @since v0.11.12 */ - function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer; + function deflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer; /** * @since v0.6.0 */ function gzip(buf: InputType, callback: CompressCallback): void; function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; namespace gzip { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; + function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; } /** * Compress a chunk of data with `Gzip`. * @since v0.11.12 */ - function gzipSync(buf: InputType, options?: ZlibOptions): Buffer; + function gzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer; /** * @since v0.6.0 */ function gunzip(buf: InputType, callback: CompressCallback): void; function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; namespace gunzip { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; + function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; } /** * Decompress a chunk of data with `Gunzip`. * @since v0.11.12 */ - function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer; + function gunzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer; /** * @since v0.6.0 */ function inflate(buf: InputType, callback: CompressCallback): void; function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; namespace inflate { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; + function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; } /** * Decompress a chunk of data with `Inflate`. * @since v0.11.12 */ - function inflateSync(buf: InputType, options?: ZlibOptions): Buffer; + function inflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer; /** * @since v0.6.0 */ function inflateRaw(buf: InputType, callback: CompressCallback): void; function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; namespace inflateRaw { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; + function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; } /** * Decompress a chunk of data with `InflateRaw`. * @since v0.11.12 */ - function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer; + function inflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer; /** * @since v0.6.0 */ function unzip(buf: InputType, callback: CompressCallback): void; function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; namespace unzip { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; + function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; } /** * Decompress a chunk of data with `Unzip`. * @since v0.11.12 */ - function unzipSync(buf: InputType, options?: ZlibOptions): Buffer; + function unzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer; /** * @since v22.15.0 * @experimental @@ -416,14 +417,14 @@ declare module "zlib" { function zstdCompress(buf: InputType, callback: CompressCallback): void; function zstdCompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void; namespace zstdCompress { - function __promisify__(buffer: InputType, options?: ZstdOptions): Promise; + function __promisify__(buffer: InputType, options?: ZstdOptions): Promise; } /** * Compress a chunk of data with `ZstdCompress`. * @since v22.15.0 * @experimental */ - function zstdCompressSync(buf: InputType, options?: ZstdOptions): Buffer; + function zstdCompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer; /** * @since v22.15.0 * @experimental @@ -431,14 +432,14 @@ declare module "zlib" { function zstdDecompress(buf: InputType, callback: CompressCallback): void; function zstdDecompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void; namespace zstdDecompress { - function __promisify__(buffer: InputType, options?: ZstdOptions): Promise; + function __promisify__(buffer: InputType, options?: ZstdOptions): Promise; } /** * Decompress a chunk of data with `ZstdDecompress`. * @since v22.15.0 * @experimental */ - function zstdDecompressSync(buf: InputType, options?: ZstdOptions): Buffer; + function zstdDecompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer; namespace constants { const BROTLI_DECODE: number; const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number; diff --git a/backend/node_modules/accepts/HISTORY.md b/node_modules/accepts/HISTORY.md similarity index 100% rename from backend/node_modules/accepts/HISTORY.md rename to node_modules/accepts/HISTORY.md diff --git a/backend/node_modules/accepts/LICENSE b/node_modules/accepts/LICENSE similarity index 100% rename from backend/node_modules/accepts/LICENSE rename to node_modules/accepts/LICENSE diff --git a/backend/node_modules/accepts/README.md b/node_modules/accepts/README.md similarity index 100% rename from backend/node_modules/accepts/README.md rename to node_modules/accepts/README.md diff --git a/backend/node_modules/accepts/index.js b/node_modules/accepts/index.js similarity index 100% rename from backend/node_modules/accepts/index.js rename to node_modules/accepts/index.js diff --git a/backend/node_modules/accepts/package.json b/node_modules/accepts/package.json similarity index 100% rename from backend/node_modules/accepts/package.json rename to node_modules/accepts/package.json diff --git a/backend/node_modules/array-flatten/LICENSE b/node_modules/array-flatten/LICENSE similarity index 100% rename from backend/node_modules/array-flatten/LICENSE rename to node_modules/array-flatten/LICENSE diff --git a/backend/node_modules/array-flatten/README.md b/node_modules/array-flatten/README.md similarity index 100% rename from backend/node_modules/array-flatten/README.md rename to node_modules/array-flatten/README.md diff --git a/backend/node_modules/array-flatten/array-flatten.js b/node_modules/array-flatten/array-flatten.js similarity index 100% rename from backend/node_modules/array-flatten/array-flatten.js rename to node_modules/array-flatten/array-flatten.js diff --git a/backend/node_modules/array-flatten/package.json b/node_modules/array-flatten/package.json similarity index 100% rename from backend/node_modules/array-flatten/package.json rename to node_modules/array-flatten/package.json diff --git a/backend/node_modules/base64id/CHANGELOG.md b/node_modules/base64id/CHANGELOG.md similarity index 100% rename from backend/node_modules/base64id/CHANGELOG.md rename to node_modules/base64id/CHANGELOG.md diff --git a/backend/node_modules/base64id/LICENSE b/node_modules/base64id/LICENSE similarity index 100% rename from backend/node_modules/base64id/LICENSE rename to node_modules/base64id/LICENSE diff --git a/backend/node_modules/base64id/README.md b/node_modules/base64id/README.md similarity index 100% rename from backend/node_modules/base64id/README.md rename to node_modules/base64id/README.md diff --git a/backend/node_modules/base64id/lib/base64id.js b/node_modules/base64id/lib/base64id.js similarity index 100% rename from backend/node_modules/base64id/lib/base64id.js rename to node_modules/base64id/lib/base64id.js diff --git a/backend/node_modules/base64id/package.json b/node_modules/base64id/package.json similarity index 100% rename from backend/node_modules/base64id/package.json rename to node_modules/base64id/package.json diff --git a/backend/node_modules/body-parser/HISTORY.md b/node_modules/body-parser/HISTORY.md similarity index 100% rename from backend/node_modules/body-parser/HISTORY.md rename to node_modules/body-parser/HISTORY.md diff --git a/backend/node_modules/body-parser/LICENSE b/node_modules/body-parser/LICENSE similarity index 100% rename from backend/node_modules/body-parser/LICENSE rename to node_modules/body-parser/LICENSE diff --git a/backend/node_modules/body-parser/README.md b/node_modules/body-parser/README.md similarity index 100% rename from backend/node_modules/body-parser/README.md rename to node_modules/body-parser/README.md diff --git a/backend/node_modules/body-parser/SECURITY.md b/node_modules/body-parser/SECURITY.md similarity index 100% rename from backend/node_modules/body-parser/SECURITY.md rename to node_modules/body-parser/SECURITY.md diff --git a/backend/node_modules/body-parser/index.js b/node_modules/body-parser/index.js similarity index 100% rename from backend/node_modules/body-parser/index.js rename to node_modules/body-parser/index.js diff --git a/backend/node_modules/body-parser/lib/read.js b/node_modules/body-parser/lib/read.js similarity index 100% rename from backend/node_modules/body-parser/lib/read.js rename to node_modules/body-parser/lib/read.js diff --git a/backend/node_modules/body-parser/lib/types/json.js b/node_modules/body-parser/lib/types/json.js similarity index 100% rename from backend/node_modules/body-parser/lib/types/json.js rename to node_modules/body-parser/lib/types/json.js diff --git a/backend/node_modules/body-parser/lib/types/raw.js b/node_modules/body-parser/lib/types/raw.js similarity index 100% rename from backend/node_modules/body-parser/lib/types/raw.js rename to node_modules/body-parser/lib/types/raw.js diff --git a/backend/node_modules/body-parser/lib/types/text.js b/node_modules/body-parser/lib/types/text.js similarity index 100% rename from backend/node_modules/body-parser/lib/types/text.js rename to node_modules/body-parser/lib/types/text.js diff --git a/backend/node_modules/body-parser/lib/types/urlencoded.js b/node_modules/body-parser/lib/types/urlencoded.js similarity index 100% rename from backend/node_modules/body-parser/lib/types/urlencoded.js rename to node_modules/body-parser/lib/types/urlencoded.js diff --git a/backend/node_modules/body-parser/package.json b/node_modules/body-parser/package.json similarity index 100% rename from backend/node_modules/body-parser/package.json rename to node_modules/body-parser/package.json diff --git a/backend/node_modules/bytes/History.md b/node_modules/bytes/History.md similarity index 100% rename from backend/node_modules/bytes/History.md rename to node_modules/bytes/History.md diff --git a/backend/node_modules/bytes/LICENSE b/node_modules/bytes/LICENSE similarity index 100% rename from backend/node_modules/bytes/LICENSE rename to node_modules/bytes/LICENSE diff --git a/backend/node_modules/bytes/Readme.md b/node_modules/bytes/Readme.md similarity index 100% rename from backend/node_modules/bytes/Readme.md rename to node_modules/bytes/Readme.md diff --git a/backend/node_modules/bytes/index.js b/node_modules/bytes/index.js similarity index 100% rename from backend/node_modules/bytes/index.js rename to node_modules/bytes/index.js diff --git a/backend/node_modules/bytes/package.json b/node_modules/bytes/package.json similarity index 100% rename from backend/node_modules/bytes/package.json rename to node_modules/bytes/package.json diff --git a/backend/node_modules/call-bind-apply-helpers/.eslintrc b/node_modules/call-bind-apply-helpers/.eslintrc similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/.eslintrc rename to node_modules/call-bind-apply-helpers/.eslintrc diff --git a/backend/node_modules/call-bind-apply-helpers/.github/FUNDING.yml b/node_modules/call-bind-apply-helpers/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/.github/FUNDING.yml rename to node_modules/call-bind-apply-helpers/.github/FUNDING.yml diff --git a/backend/node_modules/call-bind-apply-helpers/.nycrc b/node_modules/call-bind-apply-helpers/.nycrc similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/.nycrc rename to node_modules/call-bind-apply-helpers/.nycrc diff --git a/backend/node_modules/call-bind-apply-helpers/CHANGELOG.md b/node_modules/call-bind-apply-helpers/CHANGELOG.md similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/CHANGELOG.md rename to node_modules/call-bind-apply-helpers/CHANGELOG.md diff --git a/backend/node_modules/call-bind-apply-helpers/LICENSE b/node_modules/call-bind-apply-helpers/LICENSE similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/LICENSE rename to node_modules/call-bind-apply-helpers/LICENSE diff --git a/backend/node_modules/call-bind-apply-helpers/README.md b/node_modules/call-bind-apply-helpers/README.md similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/README.md rename to node_modules/call-bind-apply-helpers/README.md diff --git a/backend/node_modules/call-bind-apply-helpers/actualApply.d.ts b/node_modules/call-bind-apply-helpers/actualApply.d.ts similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/actualApply.d.ts rename to node_modules/call-bind-apply-helpers/actualApply.d.ts diff --git a/backend/node_modules/call-bind-apply-helpers/actualApply.js b/node_modules/call-bind-apply-helpers/actualApply.js similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/actualApply.js rename to node_modules/call-bind-apply-helpers/actualApply.js diff --git a/backend/node_modules/call-bind-apply-helpers/applyBind.d.ts b/node_modules/call-bind-apply-helpers/applyBind.d.ts similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/applyBind.d.ts rename to node_modules/call-bind-apply-helpers/applyBind.d.ts diff --git a/backend/node_modules/call-bind-apply-helpers/applyBind.js b/node_modules/call-bind-apply-helpers/applyBind.js similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/applyBind.js rename to node_modules/call-bind-apply-helpers/applyBind.js diff --git a/backend/node_modules/call-bind-apply-helpers/functionApply.d.ts b/node_modules/call-bind-apply-helpers/functionApply.d.ts similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/functionApply.d.ts rename to node_modules/call-bind-apply-helpers/functionApply.d.ts diff --git a/backend/node_modules/call-bind-apply-helpers/functionApply.js b/node_modules/call-bind-apply-helpers/functionApply.js similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/functionApply.js rename to node_modules/call-bind-apply-helpers/functionApply.js diff --git a/backend/node_modules/call-bind-apply-helpers/functionCall.d.ts b/node_modules/call-bind-apply-helpers/functionCall.d.ts similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/functionCall.d.ts rename to node_modules/call-bind-apply-helpers/functionCall.d.ts diff --git a/backend/node_modules/call-bind-apply-helpers/functionCall.js b/node_modules/call-bind-apply-helpers/functionCall.js similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/functionCall.js rename to node_modules/call-bind-apply-helpers/functionCall.js diff --git a/backend/node_modules/call-bind-apply-helpers/index.d.ts b/node_modules/call-bind-apply-helpers/index.d.ts similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/index.d.ts rename to node_modules/call-bind-apply-helpers/index.d.ts diff --git a/backend/node_modules/call-bind-apply-helpers/index.js b/node_modules/call-bind-apply-helpers/index.js similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/index.js rename to node_modules/call-bind-apply-helpers/index.js diff --git a/backend/node_modules/call-bind-apply-helpers/package.json b/node_modules/call-bind-apply-helpers/package.json similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/package.json rename to node_modules/call-bind-apply-helpers/package.json diff --git a/backend/node_modules/call-bind-apply-helpers/reflectApply.d.ts b/node_modules/call-bind-apply-helpers/reflectApply.d.ts similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/reflectApply.d.ts rename to node_modules/call-bind-apply-helpers/reflectApply.d.ts diff --git a/backend/node_modules/call-bind-apply-helpers/reflectApply.js b/node_modules/call-bind-apply-helpers/reflectApply.js similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/reflectApply.js rename to node_modules/call-bind-apply-helpers/reflectApply.js diff --git a/backend/node_modules/call-bind-apply-helpers/test/index.js b/node_modules/call-bind-apply-helpers/test/index.js similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/test/index.js rename to node_modules/call-bind-apply-helpers/test/index.js diff --git a/backend/node_modules/call-bind-apply-helpers/tsconfig.json b/node_modules/call-bind-apply-helpers/tsconfig.json similarity index 100% rename from backend/node_modules/call-bind-apply-helpers/tsconfig.json rename to node_modules/call-bind-apply-helpers/tsconfig.json diff --git a/backend/node_modules/call-bound/.eslintrc b/node_modules/call-bound/.eslintrc similarity index 100% rename from backend/node_modules/call-bound/.eslintrc rename to node_modules/call-bound/.eslintrc diff --git a/backend/node_modules/call-bound/.github/FUNDING.yml b/node_modules/call-bound/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/call-bound/.github/FUNDING.yml rename to node_modules/call-bound/.github/FUNDING.yml diff --git a/backend/node_modules/call-bound/.nycrc b/node_modules/call-bound/.nycrc similarity index 100% rename from backend/node_modules/call-bound/.nycrc rename to node_modules/call-bound/.nycrc diff --git a/backend/node_modules/call-bound/CHANGELOG.md b/node_modules/call-bound/CHANGELOG.md similarity index 100% rename from backend/node_modules/call-bound/CHANGELOG.md rename to node_modules/call-bound/CHANGELOG.md diff --git a/backend/node_modules/call-bound/LICENSE b/node_modules/call-bound/LICENSE similarity index 100% rename from backend/node_modules/call-bound/LICENSE rename to node_modules/call-bound/LICENSE diff --git a/backend/node_modules/call-bound/README.md b/node_modules/call-bound/README.md similarity index 100% rename from backend/node_modules/call-bound/README.md rename to node_modules/call-bound/README.md diff --git a/backend/node_modules/call-bound/index.d.ts b/node_modules/call-bound/index.d.ts similarity index 100% rename from backend/node_modules/call-bound/index.d.ts rename to node_modules/call-bound/index.d.ts diff --git a/backend/node_modules/call-bound/index.js b/node_modules/call-bound/index.js similarity index 100% rename from backend/node_modules/call-bound/index.js rename to node_modules/call-bound/index.js diff --git a/backend/node_modules/call-bound/package.json b/node_modules/call-bound/package.json similarity index 100% rename from backend/node_modules/call-bound/package.json rename to node_modules/call-bound/package.json diff --git a/backend/node_modules/call-bound/test/index.js b/node_modules/call-bound/test/index.js similarity index 100% rename from backend/node_modules/call-bound/test/index.js rename to node_modules/call-bound/test/index.js diff --git a/backend/node_modules/call-bound/tsconfig.json b/node_modules/call-bound/tsconfig.json similarity index 100% rename from backend/node_modules/call-bound/tsconfig.json rename to node_modules/call-bound/tsconfig.json diff --git a/node_modules/chess.js/.eslintignore b/node_modules/chess.js/.eslintignore new file mode 100644 index 0000000..71ab450 --- /dev/null +++ b/node_modules/chess.js/.eslintignore @@ -0,0 +1 @@ +src/pgn.d.ts diff --git a/node_modules/chess.js/.eslintrc.cjs b/node_modules/chess.js/.eslintrc.cjs new file mode 100644 index 0000000..12c9125 --- /dev/null +++ b/node_modules/chess.js/.eslintrc.cjs @@ -0,0 +1,32 @@ +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], + extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], + + rules: { + // allow while(true) loops + 'no-constant-condition': ['error', { checkLoops: false }], + '@typescript-eslint/naming-convention': [ + 'error', + { + selector: ['default'], + format: ['strictCamelCase'], + leadingUnderscore: 'allow', + }, + { + selector: ['variable'], + format: ['strictCamelCase', 'UPPER_CASE'], + }, + { + selector: ['objectLiteralProperty'], + format: ['strictCamelCase', 'UPPER_CASE'], + }, + { + selector: ['typeLike'], + format: ['PascalCase'], + }, + ], + 'multiline-comment-style': ['error', 'starred-block'], + }, +} diff --git a/node_modules/chess.js/.prettierignore b/node_modules/chess.js/.prettierignore new file mode 100644 index 0000000..c9a33d1 --- /dev/null +++ b/node_modules/chess.js/.prettierignore @@ -0,0 +1,3 @@ +coverage/ +package-lock.json +src/pgn.* diff --git a/node_modules/chess.js/.prettierrc b/node_modules/chess.js/.prettierrc new file mode 100644 index 0000000..16be68d --- /dev/null +++ b/node_modules/chess.js/.prettierrc @@ -0,0 +1,21 @@ +{ + "semi": false, + "singleQuote": true, + "overrides": [ + { + "files": "**/*.md", + "options": { + "parser": "markdown", + "printWidth": 80, + "proseWrap": "always" + } + }, + { + "files": "**/*.json", + "options": { + "parser": "json", + "tabWidth": 2 + } + } + ] +} diff --git a/node_modules/chess.js/LICENSE b/node_modules/chess.js/LICENSE new file mode 100644 index 0000000..f318b42 --- /dev/null +++ b/node_modules/chess.js/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2025, Jeff Hlywa (jhlywa@gmail.com) +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/chess.js/README.md b/node_modules/chess.js/README.md new file mode 100644 index 0000000..6eef21f --- /dev/null +++ b/node_modules/chess.js/README.md @@ -0,0 +1,1041 @@ +# chess.js + +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/jhlywa/chess.js/node.js.yml)](https://github.com/jhlywa/chess.js/actions) +[![npm](https://img.shields.io/npm/v/chess.js?color=blue)](https://www.npmjs.com/package/chess.js) +[![npm](https://img.shields.io/npm/dm/chess.js)](https://www.npmjs.com/package/chess.js) + +chess.js is a TypeScript chess library used for chess move +generation/validation, piece placement/movement, and check/checkmate/stalemate +detection - basically everything but the AI. + +chess.js has been extensively tested in node.js and most modern browsers. + +## Installation + +Run the following command to install the most recent version of chess.js from +NPM: + +```sh +npm install chess.js +``` + +## Importing + +### Import (as ESM) + +```js +import { Chess } from 'chess.js' +``` + +ECMAScript modules (ESM) can be directly imported in a browser: + +```html + +``` + +### Import (as CommonJS) + +```js +const { Chess } = require('chess.js') +``` + +## Example Code + +The code below plays a random game of chess: + +```js +import { Chess } from 'chess.js' + +const chess = new Chess() + +while (!chess.isGameOver()) { + const moves = chess.moves() + const move = moves[Math.floor(Math.random() * moves.length)] + chess.move(move) +} +console.log(chess.pgn()) +``` + +## User Interface + +By design, chess.js is a headless library and does not include user interface +elements. Many developers have successfully integrated chess.js with the +[chessboard.js](http://chessboardjs.com) library. See +[chessboard.js - Random vs Random](http://chessboardjs.com/examples#5002) for an +example. + +## Parsers (permissive / strict) + +This library includes two parsers (`permissive` and `strict`) which are used to +parse different forms of chess move notation. The `permissive` parser (the +default) is able to handle many non-standard derivatives of algebraic notation +(e.g. `Nf3`, `g1f3`, `g1-f3`, `Ng1f3`, `Ng1-f3`, `Ng1xf3`). The `strict` parser +only accepts moves in Standard Algebraic Notation and requires that they +strictly adhere to the specification. The `strict` parser runs slightly faster +but will not parse any non-standard notation. + +## API + +### Constants + +The following constants are exported from the top-level module: + +```ts +// colors +export const WHITE = 'w' +export const BLACK = 'b' + +// pieces +export const PAWN = 'p' +export const KNIGHT = 'n' +export const BISHOP = 'b' +export const ROOK = 'r' +export const QUEEN = 'q' +export const KING = 'k' + +// starting position (in FEN) +export const DEFAULT_POSITION = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1' + +// square list +export const SQUARES = ['a8', 'b8', 'c8', ..., 'f1', 'g1', 'h1'] +``` + +### Constructor: Chess([ fen ], { skipValidation = false } = {}) + +The Chess() constructor creates a new chess object that default to the initial +board position. It accepts two optional parameters : a string which specifies +the board configuration in +[Forsyth-Edwards Notation (FEN)](http://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation), +and an object with a `skipValidation` boolean. By default the constructor will +throw an exception if an invalid FEN string is provided. This behavior can be +skipped by setting the `skipValidation` boolean. + +```ts +import { Chess } from 'chess.js' + +// an empty constructor defaults the starting position +let chess = new Chess() + +// pass in a FEN string to load a particular position +let chess = new Chess( + 'r1k4r/p2nb1p1/2b4p/1p1n1p2/2PP4/3Q1NB1/1P3PPP/R5K1 b - - 0 19', +) + +// the white king is missing from the FEN string below +let chess = new Chess( + 'r1k4r/p2nb1p1/2b4p/1p1n1p2/2PP4/3Q1NB1/1P3PPP/R52 b - - 0 19', + { skipValidation = true }, +) +``` + +### .ascii() + +Returns a string containing an ASCII diagram of the current position. + +```ts +const chess = new Chess() + +// make some moves +chess.move('e4') +chess.move('e5') +chess.move('f4') + +chess.ascii() +// -> ' +------------------------+ +// 8 | r n b q k b n r | +// 7 | p p p p . p p p | +// 6 | . . . . . . . . | +// 5 | . . . . p . . . | +// 4 | . . . . P P . . | +// 3 | . . . . . . . . | +// 2 | P P P P . . P P | +// 1 | R N B Q K B N R | +// +------------------------+ +// a b c d e f g h' +``` + +### .attackers(square, [ color ]) + +Returns a list of squares that have pieces belonging to the side to move that +can attack the given square. This function takes an optional parameter which can +change which color the pieces should belong to. + +```ts +const chess = new Chess() + +chess.attackers('f3') +// -> ['e2', 'g2', 'g1'] (empty squares can be attacked) + +chess.attackers('e2') +// -> ['d1', 'e1', 'f1', 'g1'] (we can attack our own pieces) + +chess.attackers('f6') +// -> [] (squares not attacked by the side to move will return an empty list) + +chess.move('e4') +chess.attackers('f6') +// -> ['g8', 'e7', 'g7'] (return value changes depending on side to move) + +chess.attackers('f3', WHITE) +// -> ['g2', 'd1', 'g1'] (side to move can be ignored by specifying a color) + +chess.load('4k3/4n3/8/8/8/8/4R3/4K3 w - - 0 1') +chess.attackers('c6', BLACK) +// -> ['e7'] (pieces still attack a square even if they are pinned) +``` + +### .board() + +Returns a 2D array representation of the current position. Empty squares are +represented by `null`. + +```ts +const chess = new Chess() + +chess.board() +// -> [[{square: 'a8', type: 'r', color: 'b'}, +// {square: 'b8', type: 'n', color: 'b'}, +// {square: 'c8', type: 'b', color: 'b'}, +// {square: 'd8', type: 'q', color: 'b'}, +// {square: 'e8', type: 'k', color: 'b'}, +// {square: 'f8', type: 'b', color: 'b'}, +// {square: 'g8', type: 'n', color: 'b'}, +// {square: 'h8', type: 'r', color: 'b'}], +// [...], +// [...], +// [...], +// [...], +// [...], +// [{square: 'a1', type: 'r', color: 'w'}, +// {square: 'b1', type: 'n', color: 'w'}, +// {square: 'c1', type: 'b', color: 'w'}, +// {square: 'd1', type: 'q', color: 'w'}, +// {square: 'e1', type: 'k', color: 'w'}, +// {square: 'f1', type: 'b', color: 'w'}, +// {square: 'g1', type: 'n', color: 'w'}, +// {square: 'h1', type: 'r', color: 'w'}]] +``` + +### .clear({ preserveHeaders = false } = {}) + +Clears the board. + +```ts +chess.clear() +chess.fen() +// -> '8/8/8/8/8/8/8/8 w - - 0 1' <- empty board +``` + +### .fen({ forceEnpassantSquare = false) = {}) + +Returns the FEN string for the current position. Note, the en passant square is +only included if the side-to-move can legally capture en passant. + +The enpassant square will always be included if forceEnpassantSquare is true. + +```ts +const chess = new Chess() + +// make some moves +chess.move('e4') +chess.move('e5') +chess.move('f4') + +chess.fen() +// -> 'rnbqkbnr/pppp1ppp/8/4p3/4PP2/8/PPPP2PP/RNBQKBNR b KQkq - 0 2' +``` + +### .findPiece(piece) + +Returns a list containing the squares where the requested piece is located. +Returns an empty list if the piece is not on the board. + +```ts +const chess = new Chess() + +chess.findPiece({ type: KING, color: BLACK }) +// -> ['e8'] +chess.findPiece({ type: BISHOP, color: WHITE }) +// -> ['c1', 'f1'] +chess.remove('d1') +chess.findPiece({ type: QUEEN, color: WHITE }) +// -> [] +``` + +### .get(square) + +Returns the piece on the square. Returns `undefined` if the square is empty. + +```ts +chess.put({ type: PAWN, color: BLACK }, 'a5') // put a black pawn on a5 + +chess.get('a5') +// -> { type: 'p', color: 'b' }, +chess.get('a6') +// -> undefined +``` + +### .getCastlingRights(color) + +Gets the castling rights for the given color. An object is returned which +indicates whether the right is available or not for both kingside and queenside. +Note this does not indicate if such a move is legal or not in the current +position as checks etc. also need to be considered. + +```ts +const chess = new Chess() + +chess.getCastlingRights(BLACK) // black can castle queenside only +// -> { 'k': false, 'q': true } +``` + +### .getComment() + +Retrieve the comment for the current position, if it exists. + +```ts +const chess = new Chess() + +chess.loadPgn('1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 {giuoco piano} *') + +chess.getComment() +// -> "giuoco piano" +``` + +### .getComments() + +Retrieve comments for all positions. + +```ts +const chess = new Chess() + +chess.loadPgn( + "1. e4 e5 {king's pawn opening} 2. Nf3 Nc6 3. Bc4 Bc5 {giuoco piano} *", +) + +chess.getComments() +// -> [ +// { +// fen: "rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2", +// comment: "king's pawn opening" +// }, +// { +// fen: "r1bqkbnr/pppp1ppp/2n5/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3", +// comment: "giuoco piano" +// } +// ] +``` + +### .getHeaders() + +Retrieve the PGN headers. + +```ts +chess.setHeader('White', 'Morphy') +chess.setHeader('Black', 'Anderssen') +chess.setHeader('Date', '1858-??-??') +chess.getHeaders() +// -> { White: 'Morphy', Black: 'Anderssen', Date: '1858-??-??' } +``` + +### .hash() + +Returns a unique 64-bit hash as a hexidecimal string for the current position. + +```ts +chess.hash() +// -> '3436f01fd716346e' +``` + +### .history([ options ]) + +Returns a list containing the moves of the current game. Options is an optional +parameter which may contain a 'verbose' flag. See .moves() for a description of +the verbose move fields. A FEN string of the position _prior_ to the move being +made is added to the verbose history output. + +```ts +const chess = new Chess() +chess.move('e4') +chess.move('e5') +chess.move('f4') +chess.move('exf4') + +chess.history() +// -> ['e4', 'e5', 'f4', 'exf4'] + +chess.history({ verbose: true }) +// --> +// [ +// { +// before: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1', +// after: 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1', +// color: 'w', +// piece: 'p', +// from: 'e2', +// to: 'e4', +// san: 'e4', +// lan: 'e2e4', +// }, +// { +// before: 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1', +// after: 'rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2', +// color: 'b', +// piece: 'p', +// from: 'e7', +// to: 'e5', +// san: 'e5', +// lan: 'e7e5', +// }, +// { +// before: 'rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2', +// after: 'rnbqkbnr/pppp1ppp/8/4p3/4PP2/8/PPPP2PP/RNBQKBNR b KQkq - 0 2', +// color: 'w', +// piece: 'p', +// from: 'f2', +// to: 'f4', +// san: 'f4', +// lan: 'f2f4', +// }, +// { +// before: 'rnbqkbnr/pppp1ppp/8/4p3/4PP2/8/PPPP2PP/RNBQKBNR b KQkq - 0 2', +// after: 'rnbqkbnr/pppp1ppp/8/8/4Pp2/8/PPPP2PP/RNBQKBNR w KQkq - 0 3', +// color: 'b', +// piece: 'p', +// from: 'e5', +// to: 'f4', +// san: 'exf4', +// lan: 'e5f4', +// captured: 'p' +// } +// ] +``` + +### .inCheck() + +Returns true or false if the side to move is in check. + +```ts +const chess = new Chess( + 'rnb1kbnr/pppp1ppp/8/4p3/5PPq/8/PPPPP2P/RNBQKBNR w KQkq - 1 3', +) +chess.inCheck() +// -> true +``` + +### .isAttacked(square, color) + +Returns true if the square is attacked by any piece of the given color. + +```ts +const chess = new Chess() +chess.isAttacked('f3', WHITE) +// -> true (we can attack empty squares) + +chess.isAttacked('f6', BLACK) +// -> true (side to move (e.g. the value returned by .turn) is ignored) + +chess.load(DEFAULT_POSITION) +chess.isAttacked('e2', WHITE) +// -> true (we can attack our own pieces) + +chess.load('4k3/4n3/8/8/8/8/4R3/4K3 w - - 0 1') +chess.isAttacked('c6', BLACK) +// -> true (pieces still attack a square even if they are pinned) +``` + +### .isCheckmate() + +Returns true or false if the side to move has been checkmated. + +```ts +const chess = new Chess( + 'rnb1kbnr/pppp1ppp/8/4p3/5PPq/8/PPPPP2P/RNBQKBNR w KQkq - 1 3', +) +chess.isCheckmate() +// -> true +``` + +### .isDraw() + +Returns true or false if the game is drawn (50-move rule or insufficient +material). + +```ts +const chess = new Chess('4k3/4P3/4K3/8/8/8/8/8 b - - 0 78') +chess.isDraw() +// -> true +``` + +### .isDrawByFiftyMoves() + +Returns true or false if the game is drawn by 50-move rule. + +```ts +const chess = new Chess('4k3/4P3/4K3/8/8/8/8/8 b - - 0 78') +chess.isDrawByFiftyMoves() +// -> true +``` + +### .isInsufficientMaterial() + +Returns true if the game is drawn due to insufficient material (K vs. K, K vs. +KB, or K vs. KN) otherwise false. + +```ts +const chess = new Chess('k7/8/n7/8/8/8/8/7K b - - 0 1') +chess.isInsufficientMaterial() +// -> true +``` + +### .isGameOver() + +Returns true if the game has ended via checkmate, stalemate, draw, threefold +repetition, or insufficient material. Otherwise, returns false. + +```ts +const chess = new Chess() +chess.isGameOver() +// -> false + +// stalemate +chess.load('4k3/4P3/4K3/8/8/8/8/8 b - - 0 78') +chess.isGameOver() +// -> true + +// checkmate +chess.load('rnb1kbnr/pppp1ppp/8/4p3/5PPq/8/PPPPP2P/RNBQKBNR w KQkq - 1 3') +chess.isGameOver() +// -> true +``` + +### .isStalemate() + +Returns true or false if the side to move has been stalemated. + +```ts +const chess = new Chess('4k3/4P3/4K3/8/8/8/8/8 b - - 0 78') +chess.isStalemate() +// -> true +``` + +### .isThreefoldRepetition() + +Returns true or false if the current board position has occurred three or more +times. + +```ts +const chess = new Chess( + 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1', +) +// -> true +// rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq occurs 1st time +chess.isThreefoldRepetition() +// -> false + +chess.move('Nf3') +chess.move('Nf6') +chess.move('Ng1') +chess.move('Ng8') +// rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq occurs 2nd time +chess.isThreefoldRepetition() +// -> false + +chess.move('Nf3') +chess.move('Nf6') +chess.move('Ng1') +chess.move('Ng8') +// rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq occurs 3rd time +chess.isThreefoldRepetition() +// -> true +``` + +### .load(fen: string, { skipValidation = false, preserveHeaders = false } = {}) + +Clears the board and loads the provided FEN string. The castling rights, en +passant square and move numbers are defaulted to `- - 0 1` if omitted. Throws an +exception if the FEN is invalid. + +```ts +const chess = new Chess() +chess.load('4r3/8/2p2PPk/1p6/pP2p1R1/P1B5/2P2K2/3r4 w - - 1 45') + +try { + chess.load('8/4p3/8/8/8/8/4P3/6K1 w - - 1 45') +} catch (e) { + console.error(e) +} +// -> Error: Invalid FEN: missing black king + +chess.load('8/4p3/8/8/8/8/4P3/6K1 w - - 1 45', { skipValidation: true }) +// -> Works! +``` + +### .loadPgn(pgn, [ options ]) + +Load the moves of a game stored in +[Portable Game Notation](http://en.wikipedia.org/wiki/Portable_Game_Notation). +`pgn` should be a string. Options is an optional object which may contain a +string `newlineChar` and a boolean `strict`. + +The `newlineChar` is a string representation of a valid RegExp fragment and is +used to process the PGN. It defaults to `\r?\n`. Special characters should not +be pre-escaped, but any literal special characters should be escaped as is +normal for a RegExp. Keep in mind that backslashes in JavaScript strings must +themselves be escaped (see `sloppyPgn` example below). Avoid using a +`newlineChar` that may occur elsewhere in a PGN, such as `.` or `x`, as this +will result in unexpected behavior. + +The `strict` flag is a boolean (default: `false`) that instructs chess.js to +only parse moves in Standard Algebraic Notation form. See `.move` documentation +for more information about non-SAN notations. + +The method will throw and exception if the PGN fails to parse. + +```ts +const chess = new Chess() +const pgn = [ + '[Event "Casual Game"]', + '[Site "Berlin GER"]', + '[Date "1852.??.??"]', + '[EventDate "?"]', + '[Round "?"]', + '[Result "1-0"]', + '[White "Adolf Anderssen"]', + '[Black "Jean Dufresne"]', + '[ECO "C52"]', + '[WhiteElo "?"]', + '[BlackElo "?"]', + '[PlyCount "47"]', + '', + '1.e4 e5 2.Nf3 Nc6 3.Bc4 Bc5 4.b4 Bxb4 5.c3 Ba5 6.d4 exd4 7.O-O', + 'd3 8.Qb3 Qf6 9.e5 Qg6 10.Re1 Nge7 11.Ba3 b5 12.Qxb5 Rb8 13.Qa4', + 'Bb6 14.Nbd2 Bb7 15.Ne4 Qf5 16.Bxd3 Qh5 17.Nf6+ gxf6 18.exf6', + 'Rg8 19.Rad1 Qxf3 20.Rxe7+ Nxe7 21.Qxd7+ Kxd7 22.Bf5+ Ke8', + '23.Bd7+ Kf8 24.Bxe7# 1-0', +] + +chess.loadPgn(pgn.join('\n')) + +chess.ascii() +// -> ' +------------------------+ +// 8 | . r . . . k r . | +// 7 | p b p B B p . p | +// 6 | . b . . . P . . | +// 5 | . . . . . . . . | +// 4 | . . . . . . . . | +// 3 | . . P . . q . . | +// 2 | P . . . . P P P | +// 1 | . . . R . . K . | +// +------------------------+ +// a b c d e f g h' + +// Parse non-standard move formats and unusual line separators +const sloppyPgn = [ + '[Event "Wijk aan Zee (Netherlands)"]', + '[Date "1971.01.26"]', + '[Result "1-0"]', + '[White "Tigran Vartanovich Petrosian"]', + '[Black "Hans Ree"]', + '[ECO "A29"]', + '', + '1. Pc2c4 Pe7e5', // non-standard + '2. Nc3 Nf6', + '3. Nf3 Nc6', + '4. g2g3 Bb4', // non-standard + '5. Nd5 Nxd5', + '6. c4xd5 e5-e4', // non-standard + '7. dxc6 exf3', + '8. Qb3 1-0', +].join(':') + +chess.loadPgn(sloppyPgn, { newlineChar: ':' }) +// works by default + +chess.loadPgn(sloppyPgn, { newlineChar: ':', strict: true }) +// Error: Invalid move in PGN: Pc2c4 +``` + +### .move(move, [ options ]) + +Makes a move on the board and returns a move object if the move was legal. The +move argument can be either a string in Standard Algebraic Notation (SAN) or a +move object. Throws an 'Illegal move' exception if the move was illegal. + +#### .move() - Standard Algebraic Notation (SAN) + +```ts +const chess = new Chess() + +chess.move('e4') +// -> { color: 'w', from: 'e2', to: 'e4', piece: 'p', san: 'e4' } + +chess.move('nf6') // SAN is case sensitive!! +// Error: Invalid move: nf6 + +chess.move('Nf6') +// -> { color: 'b', from: 'g8', to: 'f6', piece: 'n', san: 'Nf6' } +``` + +#### .move() - Object Notation + +A move object contains `to`, `from` and, `promotion` (only when necessary) +fields. + +```ts +const chess = new Chess() + +chess.move({ from: 'g2', to: 'g3' }) +// -> { color: 'w', from: 'g2', to: 'g3', piece: 'p', san: 'g3' } +``` + +#### .move() - Permissive Parser + +The permissive (default) move parser can be used to parse a variety of +non-standard move notations. Users may specify an `{ strict: true }` flag to +verify that all supplied moves adhere to the Standard Algebraic Notation +specification. + +```ts +const chess = new Chess() + +// permissive parser accepts various forms of algebraic notation +chess.move('e2e4') +chess.move('e7-e5') +chess.move('Pf2-f4') +chess.move('ef4') // missing 'x' in capture +chess.move('Ng1-f3') +chess.move('d7xd6') // ignore 'x' when not a capture +chess.move('d4') + +// correctly parses incorrectly disambiguated moves +chess.load('r2qkbnr/ppp2ppp/2n5/1B2pQ2/4P3/8/PPP2PPP/RNB1K2R b KQkq - 3 7') + +chess.move('Nge7') // Ne7 is unambiguous because the knight on c6 is pinned +chess.undo() +chess.move('Nge7', { strict: true }) // strict SAN requires Ne7 +// Error: Invalid move: Nge7 +``` + +### .moveNumber() + +Returns the current move number. + +```ts +chess.load('4r1k1/p1prnpb1/Pp1pq1pp/3Np2P/2P1P3/R4N2/1PP2PP1/3QR1K1 w - - 2 20') +chess.moveNumber() +// -> 20 +``` + +### .moves({ piece?: Piece, square?: Square, verbose = false} = {}) + +Returns a list of legal moves from the current position. This function takes an +optional object which can be used to generate detailed move objects or to +restrict the move generator to specific squares or pieces. + +```ts +const chess = new Chess() +chess.moves() +// -> ['a3', 'a4', 'b3', 'b4', 'c3', 'c4', 'd3', 'd4', 'e3', 'e4', +// 'f3', 'f4', 'g3', 'g4', 'h3', 'h4', 'Na3', 'Nc3', 'Nf3', 'Nh3'] + +chess.moves({ square: 'e2' }) // single square move generation +// -> ['e3', 'e4'] + +chess.moves({ piece: 'n' }) // generate moves for piece type +// ['Na3', 'Nc3', 'Nf3', 'Nh3'] + +chess.moves({ verbose: true }) // return verbose moves +// -> [{ color: 'w', from: 'a2', to: 'a3', +// piece: 'p', +// san: 'a3', lan: 'a2a3', +// before: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1' +// after: 'rnbqkbnr/pppppppp/8/8/8/P7/1PPPPPPP/RNBQKBNR b KQkq - 0 1' +// # a `captured` field is included when the move is a capture +// # a `promotion` field is included when the move is a promotion +// }, +// ... +// ] +``` + +#### Move Object (e.g. when { verbose: true }) + +The `color` field indicates the color of the moving piece (`w` or `b`). + +The `from` and `to` fields are from and to squares in algebraic notation. + +The `piece`, `captured`, and `promotion` fields contain the lowercase +representation of the applicable piece (`pnbrqk`). The `captured` and +`promotion` fields are only present when the move is a valid capture or +promotion. + +The `san` field is the move in Standard Algebraic Notation (SAN). The `lan` +field is the move in Long Algebraic Notation (LAN). + +The `before` and `after` keys contain the FEN of the position before and after +the move. + +The `Move` object has helper methods that describe the type of move: + +- `.isCapture()` - is the move a regular capture? NOTE: this is `false` for an + en-passant capture +- `.isEnPassant()` - is the move an en-passant capture? +- `.isBigPawn()` - is the move a 2-rank pawn move? +- `.isPromotion()` - is the move a pawn promotion? +- `.isKingsideCastle()` - is the move a kingside castle? +- `.isQueensideCastle()` - is the move a queenside castle? + +### .pgn([ options ]) + +Returns the game in PGN format. Options is an optional parameter which may +include max width and/or a newline character settings. + +```ts +const chess = new Chess() +chess.setHeader('White', 'Plunky') +chess.setHeader('Black', 'Plinkie') +chess.move('e4') +chess.move('e5') +chess.move('Nc3') +chess.move('Nc6') + +chess.pgn({ maxWidth: 5, newline: '
      ' }) +// -> '[White "Plunky"]
      [Black "Plinkie"]

      1. e4 e5
      2. Nc3 Nc6' +``` + +### .put(piece, square) + +Place a piece on the square where piece is an object with the form { type: ..., +color: ... }. Returns true if the piece was successfully placed, otherwise, the +board remains unchanged and false is returned. `put()` will fail when passed an +invalid piece or square, or when two or more kings of the same color are placed. + +```ts +chess.clear() + +chess.put({ type: PAWN, color: BLACK }, 'a5') // put a black pawn on a5 +// -> true +chess.put({ type: 'k', color: 'w' }, 'h1') // shorthand +// -> true + +chess.fen() +// -> '8/8/8/p7/8/8/8/7K w - - 0 0' + +chess.put({ type: 'z', color: 'w' }, 'a1') // invalid piece +// -> false + +chess.clear() + +chess.put({ type: 'k', color: 'w' }, 'a1') +// -> true + +chess.put({ type: 'k', color: 'w' }, 'h1') // fail - two kings +// -> false +``` + +### .remove(square) + +Remove and return the piece on _square_. Returns `undefined` if the square is +already empty. + +```ts +chess.clear() +chess.put({ type: PAWN, color: BLACK }, 'a5') // put a black pawn on a5 +chess.put({ type: KING, color: WHITE }, 'h1') // put a white king on h1 + +chess.remove('a5') +// -> { type: 'p', color: 'b' }, +chess.remove('h1') +// -> { type: 'k', color: 'w' }, +chess.remove('e1') +// -> undefined +``` + +### .removeComment() + +Delete and return the comment for the current position, if it exists. + +```ts +const chess = new Chess() + +chess.loadPgn('1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 {giuoco piano} *') + +chess.getComment() +// -> "giuoco piano" + +chess.removeComment() +// -> "giuoco piano" + +chess.getComment() +// -> undefined +``` + +### .removeComments() + +Delete and return comments for all positions. + +```ts +const chess = new Chess() + +chess.loadPgn( + "1. e4 e5 {king's pawn opening} 2. Nf3 Nc6 3. Bc4 Bc5 {giuoco piano} *", +) + +chess.removeComments() +// -> [ +// { +// fen: "rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2", +// comment: "king's pawn opening" +// }, +// { +// fen: "r1bqkbnr/pppp1ppp/2n5/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3", +// comment: "giuoco piano" +// } +// ] + +chess.getComments() +// -> [] +``` + +### .removeHeader(field: string): boolean + +Remove a field from the PGN header. Returns `true` if the header was removed, +else `false` as the header was not found. + +```ts +chess.setHeader('White', 'Morphy') +chess.setHeader('Black', 'Anderssen') +chess.setHeader('Date', '1858-??-??') +chess.removeHeader('Date') +chess.getHeaders() +// -> { White: 'Morphy', Black: 'Anderssen'} +``` + +### .reset() + +Reset the board to the initial starting position. + +### .setCastlingRights(color, rights) + +Sets the castling rights for the given color. Returns true if the change was +successfully made. False will be returned when the position doesn't allow the +requested change i.e. if the corresponding king or rook is not on it's starting +square. + +```ts +// white can't castle kingside but can castle queenside +chess.setCastlingRights(WHITE, { [KING]: false, [QUEEN]: true }) +``` + +### .setComment(comment) + +Comment on the current position. + +```ts +const chess = new Chess() + +chess.move('e4') +chess.setComment("king's pawn opening") + +chess.pgn() +// -> "1. e4 {king's pawn opening}" +``` + +### .setHeader(key: string, value: string): Record + +Set a header key/value pair to be added to the PGN output. + +```ts +chess.setHeader('White', 'Robert James Fischer') +// { 'White': 'Robert James Fischer' } +chess.setHeader('Black', 'Mikhail Tal') +// { 'White': 'Robert James Fischer', 'Black': 'Mikhail Tal' } +``` + +### .setTurn(color) + +Sets the side to move. If the color is changed it returns true, if the color +remains unchanged it returns false. If a player is in check, attempting to +change the color to turn will throw an exception. + +```ts +chess.setTurn('b') +// -> true +chess.setTurn('b') +// -> false +``` + +### .squareColor(square) + +Returns the color of the square ('light' or 'dark'). + +```ts +const chess = Chess() +chess.squareColor('h1') +// -> 'light' +chess.squareColor('a7') +// -> 'dark' +chess.squareColor('bogus square') +// -> null +``` + +### .turn() + +Returns the current side to move. + +```ts +chess.load('rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1') +chess.turn() +// -> 'b' +``` + +### .undo() + +Takeback the last half-move, returning a move object if successful, otherwise +null. + +```ts +const chess = new Chess() + +chess.fen() +// -> 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1' +chess.move('e4') +chess.fen() +// -> 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1' + +chess.undo() +// { +// color: 'w', +// piece: 'p', +// from: 'e2', +// to: 'e4', +// san: 'e4', +// flags: 'b', +// lan: 'e2e4', +// before: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1', +// after: 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1' +// } + +chess.fen() +// -> 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1' +chess.undo() +// -> null +``` + +### validateFen(fen): + +This static function returns a validation object specifying validity or the +errors found within the FEN string. + +```ts +import { validateFen } from 'chess.js' + +validateFen('2n1r3/p1k2pp1/B1p3b1/P7/5bP1/2N1B3/1P2KP2/2R5 b - - 4 25') +// -> { ok: true } + +validateFen('4r3/8/X12XPk/1p6/pP2p1R1/P1B5/2P2K2/3r4 w - - 1 45') +// -> { ok: false, +// error: '1st field (piece positions) is invalid [invalid piece].' } +``` diff --git a/node_modules/chess.js/benchmarks/bench.ts b/node_modules/chess.js/benchmarks/bench.ts new file mode 100644 index 0000000..3fa0d98 --- /dev/null +++ b/node_modules/chess.js/benchmarks/bench.ts @@ -0,0 +1,50 @@ +import fs from 'fs' +import path from 'path' +import { Bench } from 'tinybench' +import { Chess } from '../dist/esm/chess' + +// Load the PGNs into memory +const file = fs.readFileSync(path.join(__dirname, '/benchmark.pgn'), 'utf8') + +const games = file + .split(/^\[Event /m) + .filter((p) => p.trim() != '') + .map((p) => '[Event ' + p) + +// Run the benchmark +const bench = new Bench({ + name: 'chess.js benchmark', + iterations: 30, + time: 15, +}) + +const chess = new Chess() + +bench.add('loadPgn', () => { + for (const game of games) { + chess.loadPgn(game) + } +}) + +bench.run().then(() => { + for (const task of bench.tasks) { + console.log(task.name) + const result = task.result + if (!result) { + console.log('No result') + continue + } + + const avg = result.latency.mean.toFixed(2) + const moe = result.latency.rme.toFixed(2) + const min = result.latency.min.toFixed(2) + const max = result.latency.max.toFixed(2) + const total = (result.totalTime / 1000).toFixed(2) + + console.log(`Avg: ${avg}ms ± ${moe}%`) + console.log(`Min: ${min}ms`) + console.log(`Max: ${max}ms`) + console.log(`Samples: ${result.samples.length}`) + console.log(`Total time: ${total}s`) + } +}) diff --git a/node_modules/chess.js/benchmarks/benchmark.pgn b/node_modules/chess.js/benchmarks/benchmark.pgn new file mode 100644 index 0000000..667aa0b --- /dev/null +++ b/node_modules/chess.js/benchmarks/benchmark.pgn @@ -0,0 +1,2446 @@ +[Event "Rated Classical game"] +[Site "https://lichess.org/j1dkb5dw"] +[Date "????.??.??"] +[Round "?"] +[White "BFG9k"] +[Black "mamalak"] +[Result "1-0"] +[WhiteElo "1639"] +[BlackElo "1403"] +[ECO "C00"] +[Opening "French Defense: Normal Variation"] +[TimeControl "600+8"] +[UTCDate "2012.12.31"] +[UTCTime "23:01:03"] +[Termination "Normal"] +[WhiteRatingDiff "+5"] +[BlackRatingDiff "-8"] + +1. e4 e6 2. d4 b6 3. a3 Bb7 4. Nc3 Nh6 5. Bxh6 gxh6 6. Be2 Qg5 7. Bg4 h5 8. +Nf3 Qg6 9. Nh4 Qg5 10. Bxh5 Qxh4 11. Qf3 Kd8 12. Qxf7 Nc6 13. Qe8# 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/a9tcp02g"] +[Date "????.??.??"] +[Round "?"] +[White "Desmond_Wilson"] +[Black "savinka59"] +[Result "1-0"] +[WhiteElo "1654"] +[BlackElo "1919"] +[ECO "D04"] +[Opening "Queen's Pawn Game: Colle System, Anti-Colle"] +[TimeControl "480+2"] +[UTCDate "2012.12.31"] +[UTCTime "23:04:12"] +[Termination "Normal"] +[WhiteRatingDiff "+19"] +[BlackRatingDiff "-22"] + +1. d4 d5 2. Nf3 Nf6 3. e3 Bf5 4. Nh4 Bg6 5. Nxg6 hxg6 6. Nd2 e6 7. Bd3 Bd6 +8. e4 dxe4 9. Nxe4 Rxh2 10. Ke2 Rxh1 11. Qxh1 Nc6 12. Bg5 Ke7 13. Qh7 Nxd4+ +14. Kd2 Qe8 15. Qxg7 Qh8 16. Bxf6+ Kd7 17. Qxh8 Rxh8 18. Bxh8 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/szom2tog"] +[Date "????.??.??"] +[Round "?"] +[White "Kozakmamay007"] +[Black "VanillaShamanilla"] +[Result "1-0"] +[WhiteElo "1643"] +[BlackElo "1747"] +[ECO "C50"] +[Opening "Four Knights Game: Italian Variation"] +[TimeControl "420+17"] +[UTCDate "2012.12.31"] +[UTCTime "23:03:15"] +[Termination "Normal"] +[WhiteRatingDiff "+13"] +[BlackRatingDiff "-94"] + +1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. Nc3 Bc5 5. a3 Bxf2+ 6. Kxf2 Nd4 7. d3 +Ng4+ 8. Kf1 Qf6 9. h3 d5 10. Nxd5 Qe6 11. Nxc7+ 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/rklpc7mk"] +[Date "????.??.??"] +[Round "?"] +[White "Naitero_Nagasaki"] +[Black "800"] +[Result "0-1"] +[WhiteElo "1824"] +[BlackElo "1973"] +[ECO "B12"] +[Opening "Caro-Kann Defense: Goldman Variation"] +[TimeControl "60+1"] +[UTCDate "2012.12.31"] +[UTCTime "23:04:57"] +[Termination "Normal"] +[WhiteRatingDiff "-6"] +[BlackRatingDiff "+8"] + +1. e4 c6 2. Nc3 d5 3. Qf3 dxe4 4. Nxe4 Nd7 5. Bc4 Ngf6 6. Nxf6+ Nxf6 7. Qg3 +Bf5 8. d3 Bg6 9. Ne2 e6 10. Bf4 Nh5 11. Qf3 Nxf4 12. Nxf4 Be7 13. Bxe6 fxe6 +14. Nxe6 Qa5+ 15. c3 Qe5+ 16. Qe3 Qxe3+ 17. fxe3 Kd7 18. Nf4 Bd6 19. Nxg6 +hxg6 20. h3 Bg3+ 21. Kd2 Raf8 22. Rhf1 Ke7 23. d4 Rxf1 24. Rxf1 Rf8 25. +Rxf8 Kxf8 26. e4 Ke7 27. Ke3 g5 28. Kf3 Be1 29. Kg4 Bd2 30. Kf5 Bc1 31. Kg6 +Kf8 32. e5 Bxb2 33. Kxg5 Bxc3 34. h4 Bxd4 35. h5 Bxe5 36. g4 Bb2 37. Kf5 +Kf7 38. g5 Bc1 39. g6+ Ke7 40. Ke5 b5 41. Kd4 Kd6 42. Kc3 c5 43. a3 Bg5 44. +a4 bxa4 45. Kb2 Kd5 46. Ka3 Kd4 47. Kxa4 c4 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/1xb3os63"] +[Date "????.??.??"] +[Round "?"] +[White "nichiren1967"] +[Black "Naitero_Nagasaki"] +[Result "0-1"] +[WhiteElo "1765"] +[BlackElo "1815"] +[ECO "C00"] +[Opening "French Defense: La Bourdonnais Variation"] +[TimeControl "60+1"] +[UTCDate "2012.12.31"] +[UTCTime "23:02:37"] +[Termination "Normal"] +[WhiteRatingDiff "-9"] +[BlackRatingDiff "+9"] + +1. e4 e6 2. f4 d5 3. e5 c5 4. Nf3 Qb6 5. c3 Nc6 6. d3 Bd7 7. Be2 Nh6 8. O-O +Nf5 9. g4 Nh6 10. Kg2 Nxg4 11. h3 Nh6 12. Ng5 Nf5 13. Bg4 Nce7 14. Nd2 Ne3+ +15. Kf3 Nxd1 16. Rxd1 h6 17. Nxf7 Kxf7 18. Rf1 h5 19. Bxe6+ Bxe6 20. Kg3 +Nf5+ 21. Kg2 Ne3+ 22. Kf2 Nxf1 23. Kxf1 Bxh3+ 0-1 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/6x5nq6qd"] +[Date "????.??.??"] +[Round "?"] +[White "sport"] +[Black "shamirbj"] +[Result "1-0"] +[WhiteElo "1477"] +[BlackElo "1487"] +[ECO "B00"] +[Opening "Owen Defense"] +[TimeControl "300+3"] +[UTCDate "2012.12.31"] +[UTCTime "23:09:21"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+12"] +[BlackRatingDiff "-11"] + +1. e4 b6 2. Bc4 Bb7 3. d3 Nh6 4. Bxh6 gxh6 5. Qf3 e6 6. Nh3 Bg7 7. c3 Nc6 +8. Qg3 Rg8 9. Qf3 Ne5 10. Qe3 Nxc4 11. dxc4 Qe7 12. O-O Qc5 13. Qxc5 b5 14. +Qxb5 Bxe4 15. Nd2 Bc6 16. Qb3 Bxc3 17. g3 Bxd2 18. Rad1 Bg5 19. Nxg5 hxg5 +20. Qd3 h6 21. b4 Ba4 22. Rd2 Rb8 23. b5 d6 24. Qa3 Bxb5 25. cxb5 Rxb5 26. +Qxa7 Rc5 27. Qa8+ Ke7 28. Qxg8 e5 29. Qh8 d5 30. Qxe5+ Kd7 31. Rxd5+ Rxd5 +32. Qxd5+ 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/fl7asfa0"] +[Date "????.??.??"] +[Round "?"] +[White "tiggran"] +[Black "arion_6"] +[Result "0-1"] +[WhiteElo "1541"] +[BlackElo "1500"] +[ECO "C53"] +[Opening "Italian Game: Classical Variation, Giuoco Pianissimo"] +[TimeControl "300+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:02:14"] +[Termination "Normal"] +[WhiteRatingDiff "-8"] +[BlackRatingDiff "+196"] + +1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. d3 Bc5 5. c3 O-O 6. O-O d6 7. Bg5 Na5 8. +Bb3 Nxb3 9. Qxb3 Be6 10. Qxb7 Rb8 11. Qa6 Rxb2 12. Nbd2 Rxd2 13. Nxd2 h6 +14. Bh4 g5 15. Bg3 h5 16. h3 h4 17. Bh2 Qd7 18. Nf3 Bxh3 19. Nxg5 Qg4 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/7b44wxzu"] +[Date "????.??.??"] +[Round "?"] +[White "hostking"] +[Black "troepianiz"] +[Result "1-0"] +[WhiteElo "1765"] +[BlackElo "1752"] +[ECO "C20"] +[Opening "English Opening: The Whale"] +[TimeControl "540+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:06:10"] +[Termination "Normal"] +[WhiteRatingDiff "+10"] +[BlackRatingDiff "-10"] + +1. e4 e5 2. c4 Bc5 3. Nf3 d6 4. d3 a6 5. a3 Bg4 6. h3 Bxf3 7. Qxf3 Qf6 8. +Be2 Nd7 9. Nc3 Ne7 10. O-O Bd4 11. Bd2 h6 12. Rab1 g5 13. Qg4 c6 14. Be3 +Ba7 15. Bxa7 Rxa7 16. b4 Qg6 17. Na4 h5 18. Qg3 Nf6 19. Qe3 Ra8 20. Nb6 Rb8 +21. c5 d5 22. exd5 Nfxd5 23. Qxe5 Rd8 24. Qxh8+ Ng8 25. Bxh5 Qh6 26. Rbe1+ +Ne7 27. Rxe7+ Kxe7 28. Re1+ 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/7rzcutsf"] +[Date "????.??.??"] +[Round "?"] +[White "manos68"] +[Black "jtkjtkful"] +[Result "1-0"] +[WhiteElo "1445"] +[BlackElo "1169"] +[ECO "A43"] +[Opening "Old Benoni Defense"] +[TimeControl "900+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:03:50"] +[Termination "Normal"] +[WhiteRatingDiff "+4"] +[BlackRatingDiff "-15"] + +1. d4 c5 2. c4 d6 3. Bf4 g6 4. Nf3 Bh6 5. Bxh6 Nxh6 6. Nc3 Nf5 7. d5 O-O 8. +e4 Nd4 9. Bd3 Bd7 10. O-O a6 11. Ng5 h5 12. Re1 e6 13. dxe6 Nxe6 14. Nxe6 +Bxe6 15. Nd5 h4 16. h3 Bxh3 17. gxh3 Qg5+ 18. Kf1 Nd7 19. Qa4 Nf6 20. Ne7+ +Kh8 21. f3 Qg3 22. Ke2 Qxh3 23. Rh1 Qg2+ 24. Ke3 h3 25. Qd1 Rae8 26. Bf1 +Ng4+ 27. Kd3 Ne5+ 28. Kc3 Qg3 29. Rxh3+ Qxh3 30. Bxh3 Rxe7 31. Qxd6 Nc6 32. +Rh1 Rd8 33. Qxc5 a5 34. Bd7+ Kg7 35. Bxc6 Rc7 36. Qe5+ f6 37. Qxc7+ 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/9opx3qh7"] +[Date "????.??.??"] +[Round "?"] +[White "adamsrj"] +[Black "hamiakaz"] +[Result "0-1"] +[WhiteElo "1522"] +[BlackElo "1428"] +[ECO "A40"] +[Opening "Englund Gambit Complex: Hartlaub-Charlick Gambit"] +[TimeControl "180+5"] +[UTCDate "2012.12.31"] +[UTCTime "23:02:48"] +[Termination "Normal"] +[WhiteRatingDiff "-14"] +[BlackRatingDiff "+14"] + +1. d4 e5 2. dxe5 d6 3. exd6 Bxd6 4. Nf3 Nf6 5. Nc3 O-O 6. a3 Nc6 7. e3 a6 +8. Be2 h6 9. O-O Ne5 10. Bd2 Nxf3+ 11. Bxf3 Be5 12. Rc1 c6 13. Qe2 Qd6 14. +Rfd1 Bxh2+ 15. Kh1 Be5 16. e4 Bxc3 17. Bxc3 Qe6 18. Rd3 Bd7 19. Rcd1 Rad8 +20. Bxf6 gxf6 21. Rd6 Qe7 22. R1d2 Be6 23. Rxd8 Rxd8 24. Rxd8+ Qxd8 25. c4 +Qd4 26. c5 Qxc5 27. Qd2 f5 28. exf5 Bxf5 29. Qxh6 Bg6 30. Be4 Bxe4 31. Qh4 +Bg6 32. Qd8+ Kg7 33. Qc7 b5 34. b4 Qc1+ 35. Kh2 Qxa3 36. Qe5+ Kg8 37. Qe8+ +Kg7 38. Qxc6 Qxb4 39. Qxa6 Qh4+ 40. Kg1 b4 41. Qa1+ Qf6 42. Qa4 Qc3 43. f3 +b3 44. Qa3 Qc2 45. Kh2 b2 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/1hi3aveq"] +[Date "????.??.??"] +[Round "?"] +[White "BFG9k"] +[Black "Sagaz"] +[Result "0-1"] +[WhiteElo "1644"] +[BlackElo "1544"] +[ECO "B06"] +[Opening "Modern Defense"] +[TimeControl "600+8"] +[UTCDate "2012.12.31"] +[UTCTime "23:07:33"] +[Termination "Normal"] +[WhiteRatingDiff "-16"] +[BlackRatingDiff "+14"] + +1. e4 g6 2. d4 d6 3. Nf3 c6 4. h3 Nf6 5. Bg5 Nxe4 6. Qe2 Bf5 7. Nbd2 Qa5 8. +c3 Nxd2 9. Bxd2 Nd7 10. b4 Qa3 11. Ng5 h5 12. Qc4 d5 13. Qe2 Qb2 14. Qd1 +Bc2 15. Qc1 Qxc1+ 16. Rxc1 Ba4 17. Bd3 Nb6 18. O-O Nc4 19. Bxc4 dxc4 20. +Bf4 Bh6 21. Rfe1 O-O 22. Rxe7 Rae8 23. Rxb7 f6 24. Ne6 Rxe6 25. Bxh6 Rf7 +26. Rb8+ Kh7 27. Bf4 g5 28. Bd2 Re2 29. Be1 Rfe7 30. Kf1 Bc2 31. Rc8 Bd3 +32. Rxc6 Rc2+ 33. Kg1 Rxc1 34. Rxf6 h4 35. g4 Rexe1+ 36. Kg2 Be4+ 37. f3 +Rc2# 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/n5crd00d"] +[Date "????.??.??"] +[Round "?"] +[White "arion_6"] +[Black "Naitero_Nagasaki"] +[Result "0-1"] +[WhiteElo "1957"] +[BlackElo "1755"] +[ECO "C13"] +[Opening "French Defense: Classical Variation, Richter Attack"] +[TimeControl "300+8"] +[UTCDate "2012.12.31"] +[UTCTime "23:09:29"] +[Termination "Normal"] +[WhiteRatingDiff "-158"] +[BlackRatingDiff "+14"] + +1. e4 e6 2. d4 d5 3. Nc3 Nf6 4. Bg5 Be7 5. Bxf6 Bxf6 6. e5 Be7 7. Qg4 O-O +8. Bd3 f5 9. Qg3 c5 10. Nf3 Qb6 11. Na4 Qb4+ 12. Nc3 Qxb2 13. Kd2 cxd4 14. +Nxd4 Bb4 15. Bb5 a6 16. Rhb1 Qxc3+ 17. Qxc3 Bxc3+ 18. Kxc3 axb5 19. Rxb5 +Nc6 20. Nxc6 bxc6 21. Rc5 Bd7 22. a4 Ra6 23. a5 Rfa8 24. Kd4 g5 25. Ra4 h5 +26. h3 f4 27. f3 Kf7 28. Kd3 Ke7 29. Ke2 Be8 30. Kf2 Kd7 31. g3 fxg3+ 32. +Kxg3 Bg6 33. Ra2 Bf5 34. h4 g4 35. fxg4 Bxg4 36. Kf4 Rf8+ 37. Kg5 Rf5+ 38. +Kh6 Rxe5 39. Ra4 Kd6 40. Rc3 c5 41. Rg3 c4 42. Kg7 Kc5 43. Kf6 Re2 44. Ke7 +Rxc2 45. Rxg4 hxg4 46. h5 Rh2 47. Ra3 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/iinnkv77"] +[Date "????.??.??"] +[Round "?"] +[White "Kozakmamay007"] +[Black "vadi"] +[Result "1-0"] +[WhiteElo "1656"] +[BlackElo "1812"] +[ECO "C50"] +[Opening "Giuoco Piano"] +[TimeControl "420+17"] +[UTCDate "2012.12.31"] +[UTCTime "23:10:03"] +[Termination "Normal"] +[WhiteRatingDiff "+16"] +[BlackRatingDiff "-17"] + +1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. a3 Qf6 5. b4 Bb6 6. d3 h6 7. Nc3 Nge7 8. +O-O O-O 9. Re1 a6 10. Be3 Nd4 11. Bxd4 exd4 12. e5 Qg6 13. Ne4 d5 14. exd6 +cxd6 15. Bb3 Be6 16. Bxe6 fxe6 17. Nxd6 Rab8 18. Nc4 Ba7 19. Nfe5 Qe8 20. +Nd6 Qd8 21. Ndc4 Qd5 22. Qg4 Rf5 23. Ng6 Nxg6 24. Qxg6 Re8 25. Qxe8+ 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/z2ncoii6"] +[Date "????.??.??"] +[Round "?"] +[White "Abd0"] +[Black "Killi"] +[Result "1-0"] +[WhiteElo "1436"] +[BlackElo "1506"] +[ECO "C60"] +[Opening "Ruy Lopez: Cozio Defense"] +[TimeControl "420+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:08:21"] +[Termination "Normal"] +[WhiteRatingDiff "+15"] +[BlackRatingDiff "-14"] + +1. e4 e5 2. Nf3 Nc6 3. Bb5 Nge7 4. Nc3 h6 5. Nd5 a6 6. Ba4 b5 7. Bb3 Ng6 8. +c4 b4 9. Ba4 Nd4 10. O-O c6 11. Ne3 a5 12. Nxd4 exd4 13. Nf5 Ba6 14. Nxd4 +Bxc4 15. Nxc6 Bxf1 16. Nxd8 Bxg2 17. Nxf7 Bxe4 18. Qe2 Kxf7 19. Qxe4 Kg8 +20. Qxa8 Kh7 21. Qe4 d5 22. Qxd5 Be7 23. d3 Rf8 24. Bb3 Nf4 25. Qe4+ Ng6 +26. Be3 Bh4 27. Rf1 Bf6 28. Bd4 Bh4 29. f4 Bd8 30. f5 Ne7 31. f6+ Ng6 32. +fxg7 Rxf1+ 33. Kxf1 h5 34. g8=Q+ Kh6 35. Qexg6# 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/vb3w3rmn"] +[Date "????.??.??"] +[Round "?"] +[White "nichiren1967"] +[Black "chinokoli"] +[Result "1/2-1/2"] +[WhiteElo "1878"] +[BlackElo "1940"] +[ECO "B21"] +[Opening "Sicilian Defense: McDonnell Attack"] +[TimeControl "300+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:04:28"] +[Termination "Normal"] +[WhiteRatingDiff "+2"] +[BlackRatingDiff "-2"] + +1. e4 c5 2. f4 d5 3. exd5 Qxd5 4. Nc3 Qd8 5. Bc4 Bf5 6. d3 a6 7. g4 Bd7 8. +a4 e6 9. Bd2 Bc6 10. Nf3 Bxf3 11. Qxf3 Qh4+ 12. Qg3 Qxg3+ 13. hxg3 Nc6 14. +O-O-O O-O-O 15. f5 Ne5 16. fxe6 Nxc4 17. dxc4 fxe6 18. Rde1 Bd6 19. Bf4 +Bxf4+ 20. gxf4 Nh6 21. g5 Nf5 22. Rxe6 Rd4 23. Rf1 Rxc4 24. Re5 g6 25. Kd2 +Rd8+ 26. Kc1 Rd7 27. Nd5 Rd6 28. Ne7+ Nxe7 29. Rxe7 Rd7 30. Rxd7 Kxd7 31. +b3 Re4 32. Kb2 Ke6 33. Kc3 Kf5 34. Rh1 Re7 35. Rf1 Re4 36. Rh1 Rxf4 37. +Rxh7 Kxg5 38. Rxb7 Rf6 39. Rc7 Kf4 40. Rxc5 g5 41. b4 g4 42. Rc4+ Kf3 43. +Rc5 Rg6 44. Rf5+ Kg2 45. b5 axb5 46. axb5 g3 47. Kb4 Kh1 48. Rd5 g2 49. +Rd1+ g1=Q 50. Rxg1+ Kxg1 51. c4 Kf2 52. c5 Ke3 53. b6 Kd4 54. b7 Rg1 55. +Kb5 Rb1+ 56. Kc6 Rb4 57. Kc7 Kxc5 58. b8=Q Rxb8 59. Kxb8 1/2-1/2 + +[Event "Rated Classical game"] +[Site "https://lichess.org/q7s1nprp"] +[Date "????.??.??"] +[Round "?"] +[White "troepianiz"] +[Black "hostking"] +[Result "0-1"] +[WhiteElo "1742"] +[BlackElo "1775"] +[ECO "A01"] +[Opening "Nimzo-Larsen Attack: Modern Variation #2"] +[TimeControl "540+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:15:00"] +[Termination "Normal"] +[WhiteRatingDiff "-10"] +[BlackRatingDiff "+10"] + +1. b3 e5 2. Bb2 e4 3. d3 Nf6 4. Nh3 d5 5. dxe4 Nxe4 6. Nf4 Qh4 7. g3 Bc5 8. +f3 Bf2# 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/iclkx584"] +[Date "????.??.??"] +[Round "?"] +[White "Voltvolf"] +[Black "Marzinkus"] +[Result "1-0"] +[WhiteElo "1824"] +[BlackElo "1811"] +[ECO "C02"] +[Opening "French Defense: Advance Variation #2"] +[TimeControl "360+6"] +[UTCDate "2012.12.31"] +[UTCTime "23:10:00"] +[Termination "Normal"] +[WhiteRatingDiff "+11"] +[BlackRatingDiff "-11"] + +1. e4 e6 2. d4 d5 3. e5 c5 4. c3 Ne7 5. f4 cxd4 6. cxd4 Nf5 7. Nf3 Nc6 8. +Bb5 Bd7 9. O-O Qb6 10. Bxc6 Bxc6 11. Nc3 Be7 12. a3 O-O 13. b4 Rac8 14. Bb2 +Bb5 15. Rf2 Bc4 16. Na4 Qc6 17. Nc5 b6 18. Nd3 a5 19. Bc3 a4 20. g4 Bxd3 +21. Qxd3 Qxc3 22. Qxc3 Rxc3 23. gxf5 exf5 24. Kg2 Rfc8 25. Raa2 h5 26. h4 +R8c6 27. Ng5 f6 28. exf6 Bxf6 29. Nf3 g6 30. Ne5 Bxe5 31. fxe5 Kg7 32. Rfe2 +Rd3 33. e6 Rxd4 34. e7 Rg4+ 35. Kf2 Re4 36. Rxe4 dxe4 37. e8=Q Rc3 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/i62y90w7"] +[Date "????.??.??"] +[Round "?"] +[White "VanillaShamanilla"] +[Black "mamalak"] +[Result "1-0"] +[WhiteElo "1653"] +[BlackElo "1395"] +[ECO "C00"] +[Opening "French Defense: Normal Variation"] +[TimeControl "1200+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:09:26"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+25"] +[BlackRatingDiff "-7"] + +1. e4 e6 2. d4 b6 3. d5 Bb4+ 4. c3 Bc5 5. b4 Bd6 6. Nf3 exd5 7. e5 Qe7 8. +Qxd5 Bxe5 9. Nxe5 c6 10. Qxf7+ Qxf7 11. Nxf7 Kxf7 12. Bc4+ Ke8 13. O-O d5 +14. Re1+ Kd8 15. Bg5+ Kc7 16. Bb3 Nd7 17. c4 Ngf6 18. Bf4+ Kb7 19. cxd5 +Nxd5 20. Bxd5 cxd5 21. Nc3 Nf6 22. a4 Bd7 23. a5 b5 24. a6+ Kc6 25. Be5 +Rae8 26. f4 Re6 27. Rec1 Kb6 28. Bd4+ Kc7 29. Nxb5+ Kb8 30. Nc7 Rc6 31. +Rxc6 Bxc6 32. Bxf6 Kxc7 33. Bxg7 Rg8 34. Be5+ Kb6 35. Bd4+ Kb5 36. Ra5+ +Kxb4 37. Ra1 Kc4 38. Bxa7 d4 39. Rc1+ Kd5 40. Rd1 Ke4 41. Rxd4+ Ke3 42. Bc5 +Rxg2+ 43. Kf1 Rf2+ 44. Ke1 Rxh2 45. Kd1 Bf3+ 46. Kc1 Rh4 47. Ra4+ Kd3 48. +Ra3+ Ke2 49. Re3+ Kf2 50. Re5+ Kg3 51. Rg5+ Kh3 52. Bd6 Rg4 53. Rh5+ Kg3 +54. f5+ Kf2 55. Rxh7 Rc4+ 56. Kb2 Ke2 57. a7 Kd2 58. Rh2+ Kd1 59. Rf2 Ba8 +60. f6 Rc6 61. Be7 Rb6+ 62. Kc3 Ke1 63. Rf5 Ke2 64. f7 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/kpyneu5v"] +[Date "????.??.??"] +[Round "?"] +[White "savinka59"] +[Black "Desmond_Wilson"] +[Result "1-0"] +[WhiteElo "1897"] +[BlackElo "1673"] +[ECO "B01"] +[Opening "Scandinavian Defense: Mieses-Kotroc Variation"] +[TimeControl "480+2"] +[UTCDate "2012.12.31"] +[UTCTime "23:10:44"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+6"] +[BlackRatingDiff "-5"] + +1. e4 d5 2. exd5 Qxd5 3. Nc3 Qe5+ 4. Be2 Bg4 5. d4 Qe6 6. Be3 Nc6 7. Bxg4 +Qg6 8. Bf3 Nb4 9. Be4 Qa6 10. Nb5 Qxb5 11. c3 Nd5 12. Bd3 Qxb2 13. Ne2 Nxc3 +14. Nxc3 Qxc3+ 15. Ke2 Qb2+ 16. Kf3 O-O-O 17. Qa4 e6 18. Qxa7 Qa3 19. Qxa3 +Bxa3 20. Rab1 Nf6 21. Rb3 Bd6 22. Rhb1 b6 23. Bb5 Nd5 24. a4 Kb7 25. a5 c6 +26. Bc4 b5 27. Bxd5 exd5 28. Bf4 Be7 29. Re3 Rhe8 30. Rbe1 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/mntamgdj"] +[Date "????.??.??"] +[Round "?"] +[White "Killi"] +[Black "Abd0"] +[Result "1-0"] +[WhiteElo "1492"] +[BlackElo "1451"] +[ECO "C24"] +[Opening "Bishop's Opening: Berlin Defense"] +[TimeControl "420+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:16:04"] +[Termination "Normal"] +[WhiteRatingDiff "+10"] +[BlackRatingDiff "-11"] + +1. e4 e5 2. Bc4 Nf6 3. d3 Bc5 4. Bg5 Bxf2+ 5. Kxf2 Nxe4+ 6. dxe4 Qxg5 7. +Nf3 Qf6 8. Qd5 Nc6 9. Rf1 O-O 10. Kg1 Nb4 11. Qxe5 Qxe5 12. Nxe5 Nxc2 13. +Bxf7+ Kh8 14. Bc4 Rxf1+ 15. Bxf1 Nxa1 16. Nc3 Nc2 17. Nd5 c6 18. Ne7 d6 19. +Nf7# 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/55a83jiu"] +[Date "????.??.??"] +[Round "?"] +[White "ghosty"] +[Black "jorespi"] +[Result "1-0"] +[WhiteElo "1500"] +[BlackElo "1585"] +[ECO "C30"] +[Opening "King's Gambit"] +[TimeControl "300+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:09:39"] +[Termination "Normal"] +[WhiteRatingDiff "+222"] +[BlackRatingDiff "-9"] + +1. e4 e5 2. f4 d6 3. Nf3 Nc6 4. d4 exd4 5. Nxd4 Be7 6. Nxc6 bxc6 7. Bc4 Be6 +8. Bxe6 fxe6 9. c4 Nh6 10. Nc3 O-O 11. O-O e5 12. f5 Nf7 13. b4 Bg5 14. b5 +Bxc1 15. Rxc1 Ng5 16. bxc6 a6 17. Re1 g6 18. fxg6 hxg6 19. Nd5 Ne6 20. Qg4 +Qe8 21. Rf1 Nf4 22. Nxf4 Rxf4 23. Rxf4 exf4 24. Qxf4 Qxc6 25. Qf6 Qd7 26. +c5 Rf8 27. Qxg6+ Kh8 28. cxd6 cxd6 29. Rd1 Rg8 30. Qf6+ Kh7 31. Rxd6 Qa7+ +32. Kf1 Rg7 33. Qh6+ Kg8 34. Rd8+ Kf7 35. e5 Qc7 36. Qf6# 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/ufcqmfxx"] +[Date "????.??.??"] +[Round "?"] +[White "6WX"] +[Black "adamsrj"] +[Result "1-0"] +[WhiteElo "1463"] +[BlackElo "1504"] +[ECO "C44"] +[Opening "Scotch Game: Benima Defense"] +[TimeControl "1560+30"] +[UTCDate "2012.12.31"] +[UTCTime "23:16:04"] +[Termination "Normal"] +[WhiteRatingDiff "+62"] +[BlackRatingDiff "-12"] + +1. e4 e5 2. Nf3 Nc6 3. Bc4 Be7 4. d4 exd4 5. Nxd4 d6 6. Nc3 Nf6 7. Bg5 Nxd4 +8. Qxd4 h6 9. Bh4 O-O 10. O-O-O Bd7 11. Rhe1 Re8 12. Nd5 Nxd5 13. Qxd5 Bxh4 +14. Qxf7+ Kh8 15. e5 Rf8 16. Qg6 Bxf2 17. Bd3 Kg8 18. e6 Bxe1 19. Qh7# 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/n3p0bgc7"] +[Date "????.??.??"] +[Round "?"] +[White "georgek"] +[Black "b777"] +[Result "1-0"] +[WhiteElo "1554"] +[BlackElo "1429"] +[ECO "B01"] +[Opening "Scandinavian Defense: Mieses-Kotroc Variation"] +[TimeControl "300+2"] +[UTCDate "2012.12.31"] +[UTCTime "23:12:39"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+7"] +[BlackRatingDiff "-7"] + +1. e4 d5 2. exd5 Qxd5 3. Nc3 Qe6+ 4. Qe2 Nf6 5. Nf3 b6 6. d3 h6 7. Qxe6 +Bxe6 8. Be2 Nbd7 9. O-O Bg4 10. Bf4 Rc8 11. Nb5 Nd5 12. Bg3 a6 13. Nbd4 f6 +14. Rad1 c5 15. Nb3 Nb4 16. d4 c4 17. Nc1 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/v778e8mr"] +[Date "????.??.??"] +[Round "?"] +[White "chinokoli"] +[Black "nichiren1967"] +[Result "1-0"] +[WhiteElo "1938"] +[BlackElo "1880"] +[ECO "D20"] +[Opening "Queen's Gambit Accepted: Saduleto Variation"] +[TimeControl "300+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:11:15"] +[Termination "Normal"] +[WhiteRatingDiff "+9"] +[BlackRatingDiff "-10"] + +1. d4 d5 2. c4 dxc4 3. e4 g6 4. Bxc4 Bg7 5. Ne2 Nf6 6. Nbc3 O-O 7. O-O e6 +8. Be3 Nbd7 9. f3 Nb6 10. Bd3 a5 11. b3 c6 12. Kh1 Nbd7 13. Qd2 b5 14. a4 +b4 15. Na2 Ba6 16. Nac1 Bxd3 17. Nxd3 Qc7 18. Bf4 Qb6 19. Rac1 Nh5 20. Bh6 +Bxh6 21. Qxh6 Ng7 22. Rc4 e5 23. dxe5 Rfe8 24. f4 Qe3 25. Nec1 Nb6 26. Re1 +Nxc4 27. Rxe3 Nxe3 28. Qh3 Nd1 29. Qf3 Nc3 30. f5 gxf5 31. exf5 Rad8 32. h3 +c5 33. f6 Ne6 34. Nxc5 Kh8 35. N1d3 Rg8 36. Nxe6 fxe6 37. Nf4 Rde8 38. f7 +Rgf8 39. fxe8=Q Rxe8 40. Qg4 Na2 41. Nxe6 Rg8 42. Qf5 h6 43. Qf6+ Kh7 44. +Nf8+ Rxf8 45. Qxf8 Nc1 46. Qf7+ Kh8 47. e6 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/fiv37vzi"] +[Date "????.??.??"] +[Round "?"] +[White "sebastian44"] +[Black "ticotico"] +[Result "1-0"] +[WhiteElo "1336"] +[BlackElo "1337"] +[ECO "C40"] +[Opening "King's Pawn Game: McConnell Defense"] +[TimeControl "300+5"] +[UTCDate "2012.12.31"] +[UTCTime "23:12:46"] +[Termination "Normal"] +[WhiteRatingDiff "+11"] +[BlackRatingDiff "-41"] + +1. e4 e5 2. Nf3 Qf6 3. d4 d6 4. d5 Bd7 5. Nc3 a6 6. Be3 Be7 7. Qd3 Nh6 8. +Qc4 Bd8 9. O-O-O Ng4 10. Bg5 Qg6 11. Bxd8 Kxd8 12. Qe2 Qh6+ 13. Kb1 Ke7 14. +h3 Nf6 15. g4 g5 16. Bg2 Rc8 17. Nd2 c5 18. dxc6 Bxc6 19. Qe3 Nfd7 20. h4 +b5 21. hxg5 Qf8 22. g6 hxg6 23. Qg5+ Nf6 24. Nf3 Qd8 25. Nxe5 Nd7 26. Nxg6+ +Ke8 27. Rh8+ Nf8 28. Rxf8+ Kd7 29. Rxd8+ Rxd8 30. Qf5+ Kc7 31. Ne7 Bb7 32. +Qxf6 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/aw9vx3l5"] +[Date "????.??.??"] +[Round "?"] +[White "Federico"] +[Black "Naitero_Nagasaki"] +[Result "1-0"] +[WhiteElo "1793"] +[BlackElo "1827"] +[ECO "A40"] +[Opening "Horwitz Defense"] +[TimeControl "300+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:12:31"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+14"] +[BlackRatingDiff "-12"] + +1. d4 e6 2. e3 c5 3. c3 d5 4. Bd3 c4 5. Bc2 b5 6. f4 Nc6 7. Nf3 a5 8. O-O +Bb7 9. Nbd2 b4 10. Ne5 Bd6 11. Qf3 f5 12. Qh5+ g6 13. Nxg6 Nf6 14. Qh3 Rg8 +15. Ne5 Qe7 16. Ndf3 O-O-O 17. Rb1 Rg7 18. Ng5 Rdg8 19. Rf2 Ne4 20. Bxe4 +fxe4 21. Qxe6+ Qxe6 22. Nxe6 Bxe5 23. Nxg7 Bxg7 24. Bd2 Bf6 25. g3 h5 26. +Rbf1 h4 27. Kg2 hxg3 28. hxg3 Kc7 29. Rh1 Bc8 30. Rh6 Bg4 31. Rxf6 Bf3+ 32. +Rxf3 exf3+ 33. Kxf3 b3 34. axb3 cxb3 35. e4 dxe4+ 36. Kxe4 a4 37. Kf3 Na5 +38. Rf5 Nb7 39. g4 Nd6 40. Rc5+ Kb6 41. c4 Rc8 42. Rxc8 Nxc8 43. Bb4 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/flvoc7ly"] +[Date "????.??.??"] +[Round "?"] +[White "hostking"] +[Black "troepianiz"] +[Result "0-1"] +[WhiteElo "1785"] +[BlackElo "1732"] +[ECO "B06"] +[Opening "Modern Defense"] +[TimeControl "540+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:18:19"] +[Termination "Normal"] +[WhiteRatingDiff "-12"] +[BlackRatingDiff "+12"] + +1. e4 g6 2. c4 Bg7 3. d4 b6 4. Nf3 c5 5. d5 Nf6 6. Nc3 O-O 7. Bd3 e6 8. d6 +Nc6 9. Nb5 Ba6 10. Nc7 Bb7 11. Nxa8 Qxa8 12. O-O Nd4 13. Ne5 Rd8 14. f3 Ne8 +15. Qa4 Bxe5 16. f4 Bxd6 17. f5 exf5 18. exf5 Bxg2 19. fxg6 Bxf1 20. gxh7+ +Kh8 21. Qc2 Nxc2 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/6vapfe1h"] +[Date "????.??.??"] +[Round "?"] +[White "800"] +[Black "Voltvolf"] +[Result "1-0"] +[WhiteElo "1981"] +[BlackElo "1601"] +[ECO "A15"] +[Opening "English Opening: Anglo-Indian Defense, King's Knight Variation"] +[TimeControl "60+1"] +[UTCDate "2012.12.31"] +[UTCTime "23:17:15"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+2"] +[BlackRatingDiff "-3"] + +1. c4 Nf6 2. Nf3 e6 3. e3 c5 4. Nc3 Nc6 5. Be2 b6 6. O-O Bb7 7. b3 Be7 8. +Bb2 O-O 9. Rc1 e5 10. d4 e4 11. Ng5 cxd4 12. exd4 d5 13. cxd5 Nxd5 14. +Ngxe4 Nxc3 15. Bxc3 Nxd4 16. Qxd4 Qxd4 17. Bxd4 Bxe4 18. Rc7 Bd6 19. Rd7 +Bf4 20. g3 Bf5 21. Rd5 Be6 22. Rb5 Bh6 23. Bf3 Rad8 24. Be5 Rd2 25. a4 g6 +26. Kg2 Bg7 27. Bxg7 Kxg7 28. a5 Rb8 29. axb6 Rxb6 30. Rxb6 axb6 31. Rb1 +Rd3 32. b4 b5 33. Be2 Bd5+ 34. Kf1 Rc3 35. Bxb5 Be4 36. Re1 Bd5 37. Be2 Bc4 +38. Bxc4 Rxc4 39. Rb1 Rc6 40. b5 Rb6 41. Ke2 Kf6 42. Kd3 Ke6 43. Kc4 Kd6 +44. Rd1+ Kc7 45. Re1 Kd6 46. Kb4 h5 47. f4 f5 48. Re5 Kc7 49. Kc5 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/m45sueue"] +[Date "????.??.??"] +[Round "?"] +[White "jorespi"] +[Black "Marzinkus"] +[Result "1-0"] +[WhiteElo "1711"] +[BlackElo "1800"] +[ECO "C02"] +[Opening "French Defense: Advance Variation #2"] +[TimeControl "360+6"] +[UTCDate "2012.12.31"] +[UTCTime "23:18:24"] +[Termination "Normal"] +[WhiteRatingDiff "+14"] +[BlackRatingDiff "-15"] + +1. e4 e6 2. d4 d5 3. e5 c5 4. c3 Ne7 5. f4 Nbc6 6. Nf3 cxd4 7. cxd4 Nf5 8. +g4 Nfe7 9. Nc3 Bd7 10. Bd3 Nb4 11. O-O Ng6 12. a3 Nxd3 13. Qxd3 Be7 14. f5 +exf5 15. gxf5 Nf8 16. Nxd5 g5 17. f6 g4 18. fxe7 Qa5 19. exf8=Q+ Kxf8 20. +Bh6+ Ke8 21. Nf6+ Ke7 22. Nd2 Be6 23. Bg5 Kf8 24. Nfe4 h6 25. Bh4 Qb6 26. +Nc5 Bd5 27. b4 Rc8 28. Nd7+ 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/15lzmn9d"] +[Date "????.??.??"] +[Round "?"] +[White "omarojo"] +[Black "josefo"] +[Result "1-0"] +[WhiteElo "1421"] +[BlackElo "1491"] +[ECO "B07"] +[Opening "Pirc Defense #5"] +[TimeControl "300+8"] +[UTCDate "2012.12.31"] +[UTCTime "23:18:49"] +[Termination "Normal"] +[WhiteRatingDiff "+43"] +[BlackRatingDiff "-71"] + +1. e4 d6 2. d4 c6 3. c4 b5 4. d5 cxd5 5. cxd5 Bd7 6. Qb3 Qa5+ 7. Bd2 Qb6 8. +Na3 a6 9. Nc4 Qd4 10. Nf3 Qxe4+ 11. Ne3 e6 12. Bd3 Qe5 13. Nxe5 dxe5 14. +O-O exd5 15. Nxd5 Nc6 16. Bxb5 Nd4 17. Nc7+ Kd8 18. Qd5 Kxc7 19. Qxd7+ Kb6 +20. Rfe1 axb5 21. Rxe5 Nc6 22. Re8 Ra7 23. Be3+ Ka6 24. Qxc6+ Ka5 25. Bxa7 +Ne7 26. Qb6+ Ka4 27. b3+ Ka3 28. Qxb5 Ng6 29. Bd4 Nf4 30. Qa4# 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/561bha9i"] +[Date "????.??.??"] +[Round "?"] +[White "cheesedout"] +[Black "pseudoknight"] +[Result "1-0"] +[WhiteElo "1849"] +[BlackElo "1728"] +[ECO "A43"] +[Opening "Old Benoni Defense"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:18:51"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+7"] +[BlackRatingDiff "-8"] + +1. d4 c5 2. c4 cxd4 3. Qxd4 Nc6 4. Qd1 g6 5. a3 Bg7 6. Nf3 d6 7. Bg5 Nf6 8. +Nc3 Qb6 9. Qc2 O-O 10. e3 Bf5 11. Bd3 Bxd3 12. Qxd3 Qxb2 13. O-O Qb6 14. +Nd5 Nxd5 15. Rab1 Qa6 16. Qxd5 Rac8 17. Nd4 Nxd4 18. exd4 Qxc4 19. Qxc4 +Rxc4 20. Bxe7 Re8 21. Bxd6 Bxd4 22. Rbd1 Bb6 23. Bb4 Re2 24. h3 Rcc2 25. +Be1 Ra2 26. Rd7 Rxa3 27. Rxb7 Raa2 28. Rb8+ Kg7 29. Bc3+ Kh6 30. Be1 f5 31. +Rf8 Kg7 32. Re8 g5 33. Rxe2 Rxe2 34. g3 Kf6 35. Kg2 h5 36. Bc3+ Ke6 37. Re1 +Rxe1 38. Bxe1 Ke5 39. f3 Bd4 40. Bd2 a6 41. f4+ 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/i5u1h3yk"] +[Date "????.??.??"] +[Round "?"] +[White "Abd0"] +[Black "Killi"] +[Result "0-1"] +[WhiteElo "1440"] +[BlackElo "1502"] +[ECO "C55"] +[Opening "Italian Game: Two Knights Defense, Modern Bishop's Opening"] +[TimeControl "420+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:19:01"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-10"] +[BlackRatingDiff "+9"] + +1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. d3 h6 5. O-O Bc5 6. h3 d6 7. Nc3 Nd4 8. +Nd5 Nxd5 9. exd5 c6 10. a3 cxd5 11. Bxd5 Be6 12. Bxb7 Rb8 13. Ba6 O-O 14. +c3 Nf5 15. d4 exd4 16. cxd4 Bb6 17. Be3 d5 18. Ne5 Nxe3 19. fxe3 Qg5 20. +Qf3 f6 21. Ng4 Bc7 22. b4 Bxg4 23. hxg4 Qh4 24. Qxd5+ Kh8 25. Qh5 Qg3 26. +Qh3 Rbe8 27. Qxg3 Bxg3 28. Rf3 Bh4 29. g3 Bg5 30. Re1 Re6 31. Bd3 Rfe8 32. +e4 Rc8 33. e5 Bd2 34. Re2 Bc3 35. exf6 Bxd4+ 36. Kh2 Rxe2+ 37. Bxe2 Bxf6 +38. a4 Rc2 39. Rf2 Bd4 40. Rf8+ Kh7 41. Re8 Bc3 42. Kh3 Bxb4 43. Bd3+ g6 +44. Bxc2 a5 45. Kh4 Kg7 46. g5 h5 47. g4 hxg4 48. Kxg4 Kf7 49. Rc8 Bd2 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/descpsmi"] +[Date "????.??.??"] +[Round "?"] +[White "j-jorjik"] +[Black "jesuss"] +[Result "1-0"] +[WhiteElo "1548"] +[BlackElo "1415"] +[ECO "C21"] +[Opening "Center Game #2"] +[TimeControl "480+8"] +[UTCDate "2012.12.31"] +[UTCTime "23:19:27"] +[Termination "Normal"] +[WhiteRatingDiff "+8"] +[BlackRatingDiff "-8"] + +1. e4 e5 2. d4 Qf6 3. dxe5 Qxe5 4. Qe2 Nf6 5. Nf3 Qxe4 6. Qxe4+ Nxe4 7. +Nbd2 Nxd2 8. Bxd2 g6 9. Bc3 Rg8 10. Ng5 Bg7 11. Bxg7 Rxg7 12. O-O-O b6 13. +Re1+ Kf8 14. Be2 Bb7 15. Bf3 Bxf3 16. Nxf3 f6 17. Nd4 Nc6 18. Nxc6 dxc6 19. +Re6 Re8 20. Rxf6+ Kg8 21. Rxc6 Re2 22. Rf1 Rd7 23. b3 Rdd2 24. Rd1 Rxd1+ +25. Kxd1 Rxf2 26. Rxc7 Rxg2 27. Rxa7 Rxh2 28. Rb7 g5 29. Rxb6 g4 30. Rb4 g3 +31. Rg4+ Kh8 32. Rxg3 Rh1+ 33. Kd2 h5 34. c4 h4 35. Re3 h3 36. c5 Kg7 37. +c6 Kg6 38. c7 Kg5 39. c8=Q h2 40. Qh3 Kf6 41. Qf3+ Kg6 42. Qxh1 Kf5 43. +Qxh2 Kf6 44. Qf2+ Kg5 45. Rg3+ Kh4 46. Qh2# 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/8ok6jtv5"] +[Date "????.??.??"] +[Round "?"] +[White "barriosgb2"] +[Black "Boss92"] +[Result "0-1"] +[WhiteElo "1561"] +[BlackElo "1503"] +[ECO "B06"] +[Opening "Robatsch (Modern) Defense"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:20:14"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-13"] +[BlackRatingDiff "+14"] + +1. e4 g6 2. d4 Bg7 3. c3 e6 4. Bd3 f5 5. exf5 gxf5 6. Nf3 Qf6 7. Bg5 Qg6 8. +O-O h6 9. Bf4 Nf6 10. Bxc7 Nc6 11. Be5 O-O 12. Nh4 Qg5 13. Nf3 Qh5 14. Be2 +Ng4 15. Bg3 Rf6 16. Be5 Rg6 17. Bxg7 Rxg7 18. h3 Nf6 19. Ne5 Qe8 20. Nxc6 +dxc6 21. Bf3 Nd5 22. c4 Bd7 23. c5 b6 24. Bxd5 Rb8 0-1 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/a301qp92"] +[Date "????.??.??"] +[Round "?"] +[White "sport"] +[Black "georgek"] +[Result "0-1"] +[WhiteElo "1489"] +[BlackElo "1561"] +[ECO "C23"] +[Opening "Bishop's Opening: Philidor Counterattack"] +[TimeControl "300+3"] +[UTCDate "2012.12.31"] +[UTCTime "23:20:40"] +[Termination "Normal"] +[WhiteRatingDiff "-9"] +[BlackRatingDiff "+9"] + +1. e4 e5 2. Bc4 c6 3. Nf3 d5 4. exd5 cxd5 5. Bb3 Nc6 6. Ba4 Bd6 7. O-O e4 +8. Re1 Nf6 9. d3 O-O 10. dxe4 dxe4 11. Nd4 Qc7 12. g3 a6 13. Bxc6 bxc6 14. +Bg5 Be5 15. Bxf6 Bxf6 16. Nb3 Bxb2 17. N1d2 Rd8 18. Rb1 Qe5 19. Rxe4 Qxe4 +20. Nxe4 Rxd1+ 21. Rxd1 Bf5 22. Nd6 Bxc2 23. Rd2 Bxb3 24. Rxb2 Bd5 25. Nf5 +g6 26. Ne7+ Kg7 27. Nxd5 cxd5 28. Kg2 d4 29. Rc2 d3 30. Rd2 Rd8 31. Kf3 a5 +32. Ke3 Re8+ 33. Kxd3 Re1 34. Kc2 Rh1 35. f3 h5 36. h4 Kh6 37. Rd5 Rg1 38. +Rxa5 Rxg3 39. Ra3 g5 40. hxg5+ Kxg5 41. Rd3 h4 42. f4+ Kxf4 43. Rxg3 Kxg3 +0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/61wsdfp4"] +[Date "????.??.??"] +[Round "?"] +[White "adamsrj"] +[Black "6WX"] +[Result "1-0"] +[WhiteElo "1492"] +[BlackElo "1525"] +[ECO "B50"] +[Opening "Sicilian Defense"] +[TimeControl "1560+30"] +[UTCDate "2012.12.31"] +[UTCTime "23:21:14"] +[Termination "Normal"] +[WhiteRatingDiff "+12"] +[BlackRatingDiff "-53"] + +1. e4 c5 2. Nf3 d6 3. h3 Nc6 4. d4 cxd4 5. Nxd4 e5 6. Nxc6 bxc6 7. Nc3 Nf6 +8. Bc4 Rb8 9. Rb1 Nxe4 10. Nxe4 d5 11. Bxd5 cxd5 12. Nc3 Bb7 13. O-O Qd7 +14. f4 d4 15. Ne2 Qd5 16. Kf2 f6 17. fxe5 fxe5 18. Ke1 Bb4+ 19. c3 d3 20. +cxb4 Qxg2 21. Qxd3 Be4 22. Qd6 Rd8 23. Qxe5+ Kd7 24. Rf7+ Kc8 25. Qc7# 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/qwuudn2s"] +[Date "????.??.??"] +[Round "?"] +[White "sebastian44"] +[Black "jtkjtkful"] +[Result "0-1"] +[WhiteElo "1347"] +[BlackElo "1519"] +[ECO "B01"] +[Opening "Scandinavian Defense"] +[TimeControl "300+5"] +[UTCDate "2012.12.31"] +[UTCTime "23:24:11"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-6"] +[BlackRatingDiff "+23"] + +1. e4 d5 2. e5 d4 3. Nf3 Nc6 4. c3 d3 5. Na3 f6 6. exf6 Nxf6 7. Qa4 Qd5 0-1 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/7hvhc1t7"] +[Date "????.??.??"] +[Round "?"] +[White "migsan"] +[Black "MARC0"] +[Result "1-0"] +[WhiteElo "1162"] +[BlackElo "1244"] +[ECO "A00"] +[Opening "Van't Kruijs Opening"] +[TimeControl "420+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:23:14"] +[Termination "Normal"] +[WhiteRatingDiff "+17"] +[BlackRatingDiff "-21"] + +1. e3 d5 2. b3 e5 3. Bb2 Qg5 4. g3 Nf6 5. Bh3 Nc6 6. Qf3 Bb4 7. c3 O-O 8. +Ne2 Bg4 9. Qg2 Bxe2 10. Kxe2 Bxc3 11. Bxc3 d4 12. Ba5 Rae8 13. Bxc7 dxe3 +14. dxe3 Qxe3+ 15. Kxe3 Nd4 16. Qxb7 Nc2+ 17. Kf3 Nxa1 18. Bd6 e4+ 19. Kg2 +Nc2 20. Bxf8 Kxf8 21. Rc1 Ne3+ 22. Kg1 Kg8 23. Qxa7 h6 24. Qxe3 Ng4 25. +Bxg4 g6 26. Rc7 f5 27. Qa7 h5 28. Rg7+ Kf8 29. Rf7+ Kg8 30. Rg7+ Kf8 31. +Be2 f4 32. Bc4 e3 33. Rf7+ Kg8 34. Qc5 exf2+ 35. Kxf2 Kh8 36. Qc7 fxg3+ 37. +Kxg3 Kg8 38. Rg7+ Kf8 39. Rg8# 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/md14boea"] +[Date "????.??.??"] +[Round "?"] +[White "metrolog"] +[Black "b777"] +[Result "1-0"] +[WhiteElo "1627"] +[BlackElo "1633"] +[ECO "A40"] +[Opening "English Defense"] +[TimeControl "180+15"] +[UTCDate "2012.12.31"] +[UTCTime "23:22:12"] +[Termination "Normal"] +[WhiteRatingDiff "+11"] +[BlackRatingDiff "-11"] + +1. d4 b6 2. c4 e6 3. Nc3 Bb7 4. a3 g6 5. h3 Bg7 6. Nf3 Bxf3 7. exf3 Qf6 8. +Be2 Qxd4 9. Qxd4 Bxd4 10. O-O Bxc3 11. bxc3 Ne7 12. Bd3 f5 13. Be3 c5 14. +Rab1 Nbc6 15. Bh6 Na5 16. a4 Nec6 17. g4 Ne5 18. Be2 O-O-O 19. Bg7 Rhg8 20. +Bxe5 d6 21. Bf6 Rdf8 22. g5 e5 23. Rbd1 Kc7 24. Rd3 f4 25. Rfd1 Nb7 26. +R3d2 Rf7 27. Bd3 Na5 28. Kf1 Nb3 29. Re2 Na5 30. Be4 Nxc4 31. Bd5 Rxf6 32. +Bxg8 Rf5 33. Bxc4 Rxg5 34. Red2 Rf5 35. Rxd6 e4 36. Rd7+ Kb8 37. Rd8+ Kc7 +38. R1d7+ Kc6 39. Bb5# 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/e0p9f3qt"] +[Date "????.??.??"] +[Round "?"] +[White "Desmond_Wilson"] +[Black "ghosty"] +[Result "0-1"] +[WhiteElo "1360"] +[BlackElo "1722"] +[ECO "D04"] +[Opening "Queen's Pawn Game: Colle System, Anti-Colle"] +[TimeControl "240+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:25:46"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-3"] +[BlackRatingDiff "+35"] + +1. d4 d5 2. Nf3 Nf6 3. e3 Bf5 4. Nh4 Bg6 5. Nxg6 hxg6 6. Bd3 e6 7. Qe2 Bd6 +8. Nd2 c5 9. c3 c4 10. Bc2 Nc6 11. e4 dxe4 12. Nxe4 e5 13. Nxf6+ gxf6 14. +Qxc4 Qc7 15. Bb3 Na5 16. Ba4+ Nc6 17. d5 a6 18. dxc6 b5 19. Bxb5 axb5 20. +Qxb5 Rb8 21. Qa6 Kf8 22. Be3 Kg7 23. O-O-O Ra8 24. b4 Rxa6 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/8qxqjb4h"] +[Date "????.??.??"] +[Round "?"] +[White "Naitero_Nagasaki"] +[Black "arion_6"] +[Result "0-1"] +[WhiteElo "1769"] +[BlackElo "1799"] +[ECO "C52"] +[Opening "Italian Game: Evans Gambit, Lasker Defense"] +[TimeControl "300+8"] +[UTCDate "2012.12.31"] +[UTCTime "23:26:10"] +[Termination "Normal"] +[WhiteRatingDiff "-9"] +[BlackRatingDiff "+74"] + +1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. b4 Bxb4 5. c3 Bc5 6. O-O d6 7. d4 Bb6 8. +Ba3 exd4 9. cxd4 Bg4 10. Nc3 0-1 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/2cj9hphe"] +[Date "????.??.??"] +[Round "?"] +[White "tiggran"] +[Black "barriosgb2"] +[Result "1-0"] +[WhiteElo "1533"] +[BlackElo "1712"] +[ECO "B10"] +[Opening "Caro-Kann Defense"] +[TimeControl "300+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:08:52"] +[Termination "Normal"] +[WhiteRatingDiff "+16"] +[BlackRatingDiff "-17"] + +1. e4 c6 2. Nf3 d5 3. exd5 cxd5 4. d4 Nc6 5. Nc3 e6 6. Be2 Bd6 7. O-O Nf6 +8. Bg5 O-O 9. Qd2 Be7 10. Rfe1 Qc7 11. Bf4 Qd7 12. Bb5 a6 13. Ba4 b5 14. +Bb3 Qa7 15. Nh4 Qd7 16. Bh6 gxh6 17. Qxh6 Ne4 18. Nxe4 dxe4 19. Rxe4 f5 20. +Rxe6 Kh8 21. Nxf5 Rxf5 22. Rae1 Bf8 23. Qh3 Rg5 24. R1e4 Qg7 25. g3 Bxe6 +26. Bxe6 Re8 27. d5 Ne5 28. f4 Nf3+ 29. Kh1 Rg6 30. f5 Rg5 31. Kg2 Nd4 32. +c3 Nxe6 33. dxe6 Bd6 34. g4 Qf6 35. Qd3 Bb8 36. Qd7 Qh6 37. e7 Qxh2+ 38. +Kf3 Qg3+ 39. Ke2 Qg2+ 40. Kd1 Qxe4 41. Qxe8+ Rg8 42. Qf7 Qxg4+ 43. Kc2 Qg2+ +44. Kb3 a5 45. e8=Q a4+ 46. Ka3 Bd6+ 47. b4 axb3+ 48. Kxb3 Rxe8 49. Qxe8+ +Kg7 50. Qd7+ Kh6 51. Qxd6+ Kg5 52. f6 Qf3 53. Qe5+ Kg6 54. Qxb5 Qxf6 55. a4 +Qe6+ 56. Ka3 Qd6+ 57. Qb4 Qd3 58. a5 h5 59. Qb6+ Kg5 60. Qc5+ Kg4 61. Kb4 +Qb1+ 62. Kc4 Qa2+ 63. Kd3 Qb1+ 64. Kc4 Qa2+ 65. Kd4 Qd2+ 66. Kc4 Qa2+ 67. +Kb5 Qb3+ 68. Qb4+ Qxb4+ 69. Kxb4 h4 70. a6 h3 71. a7 h2 72. a8=Q h1=B 73. +Qxh1 Kf4 74. c4 Kg3 75. Qe1+ Kf3 76. Qd2 Ke4 77. Qc3 Kf4 78. Qd3 Ke5 79. c5 +Ke6 80. c6 Ke5 81. c7 Ke6 82. Qd4 Ke7 83. c8=Q Kf7 84. Qd6 Kg7 85. Qcc7+ +Kg8 86. Qdd8# 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/k29ncaud"] +[Date "????.??.??"] +[Round "?"] +[White "troepianiz"] +[Black "hostking"] +[Result "0-1"] +[WhiteElo "1744"] +[BlackElo "1773"] +[ECO "C00"] +[Opening "French Defense: Horwitz Attack"] +[TimeControl "540+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:25:04"] +[Termination "Normal"] +[WhiteRatingDiff "-10"] +[BlackRatingDiff "+9"] + +1. e4 e6 2. b3 d6 3. Bb2 e5 4. g3 Nf6 5. Bh3 Bxh3 6. Nxh3 Nxe4 7. f3 Nc5 8. +d4 exd4 9. Bxd4 Qe7+ 10. Qe2 Qxe2+ 11. Kxe2 Ne6 12. Bc3 Nc6 13. Re1 Ncd4+ +14. Bxd4 Nxd4+ 15. Kd3+ Ne6 16. Nf4 Kd7 17. Nc3 Ng5 18. Re3 g6 19. h4 Ne6 +20. Nxe6 fxe6 21. Ne4 Bg7 22. Rd1 Rhf8 23. f4 b6 24. Ng5 e5 25. fxe5 Bxe5 +26. Nxh7 Rf2 27. Ng5 Rg2 28. Ne4 Rf8 29. Kc4 Rxc2+ 30. Kd3 Rxa2 31. Kc4 +Rc2+ 32. Nc3 a6 33. Kd3 Rxc3+ 34. Ke4 Rxe3+ 35. Kxe3 Bxg3 36. Rh1 c5 37. h5 +g5 38. h6 Bh4 39. Ra1 a5 40. Ke4 Rh8 41. Kf5 Rxh6 42. b4 cxb4 43. Ke4 Re6+ +44. Kd5 Re5+ 45. Kc4 b5+ 46. Kb3 Re3+ 47. Ka2 a4 48. Rd1 g4 49. Rg1 g3 50. +Rg2 Rf3 51. Rg1 Rf2+ 52. Kb1 g2 53. Rxg2 Rxg2 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/g5j064qn"] +[Date "????.??.??"] +[Round "?"] +[White "pseudoknight"] +[Black "Ben_Dover"] +[Result "0-1"] +[WhiteElo "1720"] +[BlackElo "1865"] +[ECO "B02"] +[Opening "Alekhine Defense: John Tracy Gambit"] +[TimeControl "60+1"] +[UTCDate "2012.12.31"] +[UTCTime "23:26:03"] +[Termination "Normal"] +[WhiteRatingDiff "-6"] +[BlackRatingDiff "+6"] + +1. e4 Nf6 2. Nf3 Nxe4 3. Nc3 Nxc3 4. dxc3 e6 5. Bg5 Be7 6. h4 O-O 7. Bc4 d5 +8. Bd3 c5 9. b3 Nc6 10. Qd2 e5 11. Be2 e4 12. Nh2 h6 13. Bxe7 Qxe7 14. +O-O-O Be6 15. Bg4 Rad8 16. Qe2 Qxh4 17. Bxe6 fxe6 18. Ng4 Qg5+ 19. Kb2 Ne5 +20. Nxe5 Qxe5 21. f3 d4 22. fxe4 dxc3+ 23. Kb1 Qc7 24. Qe3 Qa5 25. Rde1 b5 +26. Qxc5 Rc8 27. Qd4 Qa3 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/h6veisdc"] +[Date "????.??.??"] +[Round "?"] +[White "Ben_Dover"] +[Black "pseudoknight"] +[Result "0-1"] +[WhiteElo "1871"] +[BlackElo "1714"] +[ECO "A00"] +[Opening "Van Geet Opening"] +[TimeControl "60+1"] +[UTCDate "2012.12.31"] +[UTCTime "23:28:33"] +[Termination "Normal"] +[WhiteRatingDiff "-15"] +[BlackRatingDiff "+15"] + +1. Nc3 c5 2. d3 g6 3. e4 Bg7 4. f4 Nc6 5. Nf3 e6 6. Be3 Nge7 7. Qe2 Qb6 8. +Na4 Qa5+ 9. Nc3 d6 10. Bd2 b5 11. Nd5 Qd8 12. Nxe7 Qxe7 13. O-O-O b4 14. d4 +Nxd4 15. Nxd4 Bxd4 16. Qb5+ Bd7 17. Qb7 O-O 18. Bb5 Rfd8 19. Bxd7 Qxd7 20. +Qxd7 Rxd7 21. c3 bxc3 22. Bxc3 Bxc3 23. bxc3 Rad8 24. Kc2 d5 25. e5 d4 26. +c4 Rb8 27. Rb1 Rdb7 28. Rxb7 Rxb7 29. Rc1 Kf8 30. Kd3 Ke7 31. Rc2 Kd7 32. +Ke4 Ke7 33. g4 f6 34. exf6+ Kxf6 35. h4 h6 36. g5+ hxg5 37. hxg5+ Ke7 38. +Ke5 Rb1 39. Re2 d3 40. Rd2 Re1+ 41. Re2 Rxe2# 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/y3m3quag"] +[Date "????.??.??"] +[Round "?"] +[White "Jonathan_52"] +[Black "jtkjtkful"] +[Result "0-1"] +[WhiteElo "1500"] +[BlackElo "1511"] +[ECO "A40"] +[Opening "Mikenas Defense"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:28:46"] +[Termination "Normal"] +[WhiteRatingDiff "-169"] +[BlackRatingDiff "+66"] + +1. d4 Nc6 2. e3 d5 3. Bd3 Bf5 4. Bd2 e6 5. Nf3 Bxd3 6. cxd3 Bb4 7. e4 Bxd2+ +8. Kxd2 dxe4 9. dxe4 Nxd4 10. Nc3 Nxf3+ 11. Ke2 Nd4+ 12. Ke3 Nc2+ 13. Qxc2 +Qd6 14. Qa4+ c6 15. Qb3 O-O-O 16. Rad1 Qc5+ 17. Rd4 Qxd4+ 18. Kf3 Qf6+ 19. +Ke3 g5 20. f3 Qf4+ 21. Ke2 Qd2+ 22. Kf1 Qc1+ 23. Kf2 Qd2+ 24. Kg3 Qf4+ 25. +Kf2 Rd2+ 26. Kf1 Qe3 27. Qb4 Qf2# 0-1 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/8dqmtc5l"] +[Date "????.??.??"] +[Round "?"] +[White "migsan"] +[Black "MARC0"] +[Result "1-0"] +[WhiteElo "1179"] +[BlackElo "1223"] +[ECO "A00"] +[Opening "Van't Kruijs Opening"] +[TimeControl "420+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:28:48"] +[Termination "Normal"] +[WhiteRatingDiff "+15"] +[BlackRatingDiff "-18"] + +1. e3 d5 2. b3 e5 3. Bb2 Nf6 4. g3 Nc6 5. Bg2 Bf5 6. Na3 Bd6 7. Nb5 O-O 8. +c4 dxc4 9. bxc4 a6 10. Nc3 Bc5 11. Nf3 Bd3 12. Ng5 e4 13. Nd5 h6 14. Nh3 +Kh8 15. Bc3 Bb4 16. Bxb4 a5 17. Bxf8 Qxf8 18. Nxc7 Qb4 19. Nxa8 Qxc4 20. +Rc1 Ng4 21. Rxc4 Bxc4 22. Nc7 Nce5 23. Ne8 Nd3+ 24. Kf1 Nb2+ 25. Kg1 Nxd1 +26. Bxe4 Ndxf2 27. Bf5 Bd5 28. Nd6 Bxh1 29. Nxf7+ Kg8 30. Be6 Nxh3+ 31. +Kxh1 Nhf2+ 32. Kg2 Kf8 33. Kf3 h5 34. Kf4 Nd3+ 35. Kg5 Nc5 36. Kxh5 Nxe6 +37. Kxg4 Kxf7 38. d4 Ke7 39. d5 Nc5 40. Kf4 Nd3+ 41. Ke4 Nc1 42. Ke5 Kd7 +43. d6 Nxa2 44. h4 Nc3 45. g4 Ne2 46. g5 a4 47. h5 a3 48. h6 gxh6 49. gxh6 +a2 50. h7 a1=Q+ 51. Kf5 Qe5+ 52. Kg6 Qg7+ 53. Kxg7 Nf4 54. h8=Q Kxd6 55. +Qh4 b6 56. Qxf4+ Kc6 57. Qb4 b5 58. e4 Kd7 59. e5 Kd8 60. Qe4 b4 61. Qxb4 +Ke8 62. e6 Kd8 63. Qe4 Ke8 64. e7 Kd7 65. e8=Q+ Kc7 66. Q4e6 Kb7 67. Q8e7+ +Kb8 68. Qg8# 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/ce12lh0d"] +[Date "????.??.??"] +[Round "?"] +[White "sebastian44"] +[Black "Milligan"] +[Result "1-0"] +[WhiteElo "1341"] +[BlackElo "1290"] +[ECO "C55"] +[Opening "Italian Game: Two Knights Defense, Open Variation"] +[TimeControl "300+5"] +[UTCDate "2012.12.31"] +[UTCTime "23:29:30"] +[Termination "Normal"] +[WhiteRatingDiff "+10"] +[BlackRatingDiff "-14"] + +1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. d4 d5 5. dxe5 Nxe4 6. Bb5 Bd7 7. e6 Bxe6 +8. Bxc6+ bxc6 9. Kf1 Bc5 10. Ne5 Nxf2 11. Qe2 Nxh1 12. Nxc6 Qd6 13. Qb5 +Qf4+ 14. Bxf4 O-O 15. Qxc5 Rae8 16. Nc3 Bf5 17. Re1 Re6 18. Rxe6 Bxe6 19. +Ne7+ Kh8 20. Qxc7 Rc8 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/g9xgwzcc"] +[Date "????.??.??"] +[Round "?"] +[White "Killi"] +[Black "Abd0"] +[Result "1-0"] +[WhiteElo "1511"] +[BlackElo "1430"] +[ECO "A10"] +[Opening "English Opening"] +[TimeControl "420+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:30:54"] +[Termination "Normal"] +[WhiteRatingDiff "+9"] +[BlackRatingDiff "-9"] + +1. c4 d6 2. e4 Nf6 3. Nc3 e5 4. Nf3 Be6 5. d3 Be7 6. h3 c5 7. Be2 Nc6 8. a3 +Qa5 9. Bd2 Qb6 10. Rb1 Nd4 11. Nxd4 exd4 12. Nd5 Nxd5 13. exd5 Bd7 14. Bg4 +f5 15. Bh5+ g6 16. Bf3 O-O-O 17. Qe2 Rhe8 18. O-O Bg5 19. Qd1 f4 20. a4 Bh6 +21. a5 Qc7 22. Qc2 Bf5 23. b4 g5 24. b5 b6 25. axb6 axb6 26. Ra1 Kd7 27. +Ra6 Ra8 28. Qa4 Bxd3 29. Rxa8 Rxa8 30. Qxa8 Bxc4 31. Re1 Bxb5 32. Qe8# 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/l0gjct48"] +[Date "????.??.??"] +[Round "?"] +[White "jtkjtkful"] +[Black "Jonathan_52"] +[Result "1-0"] +[WhiteElo "1577"] +[BlackElo "1331"] +[ECO "D02"] +[Opening "Queen's Gambit Refused: Baltic Defense"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:30:58"] +[Termination "Normal"] +[WhiteRatingDiff "+34"] +[BlackRatingDiff "-61"] + +1. d4 d5 2. c4 Bf5 3. Bf4 dxc4 4. e3 e6 5. Bxc4 Bd6 6. Qa4+ c6 7. Bxd6 b5 +8. Qb4 bxc4 9. Bf8 Ne7 10. Bxg7 Rg8 11. Bf6 Rg6 12. Bxe7 Qc7 13. Bf8 Na6 +14. Qa3 Rb8 15. Nd2 Nb4 16. O-O-O e5 17. Nxc4 Kxf8 18. Nd6 Qxd6 19. Qxa7 +Rxg2 20. Nh3 Rxf2 21. Nxf2 Bg6 22. Ng4 h6 23. Nxh6 Bh5 24. Rhg1 Bxd1 25. +Rf1 exd4 26. Qxf7# 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/ui2g2idg"] +[Date "????.??.??"] +[Round "?"] +[White "6WX"] +[Black "adamsrj"] +[Result "0-1"] +[WhiteElo "1472"] +[BlackElo "1504"] +[ECO "B30"] +[Opening "Sicilian Defense: Nyezhmetdinov-Rossolimo Attack"] +[TimeControl "1560+30"] +[UTCDate "2012.12.31"] +[UTCTime "23:31:06"] +[Termination "Normal"] +[WhiteRatingDiff "-39"] +[BlackRatingDiff "+9"] + +1. e4 c5 2. Nf3 Nc6 3. Bb5 d6 4. c3 Bd7 5. d4 cxd4 6. cxd4 Qa5+ 7. Nc3 Rc8 +8. d5 Nb8 9. Bxd7+ Nxd7 10. Bd2 Ngf6 11. Qc2 Qa6 12. Nd4 g6 13. Qb3 Bg7 14. +Ndb5 O-O 15. O-O Ne8 16. Rac1 Nc7 17. Nxc7 Rxc7 18. Na4 Rxc1 19. Rxc1 b5 +20. Nc3 Qb7 21. Nxb5 Rc8 22. Nxa7 Rxc1+ 23. Bxc1 Qxa7 24. Be3 Qa5 25. h3 +Be5 26. Kf1 Nc5 27. Qb8+ Kg7 28. a3 Nd3 29. b4 Qa4 30. Ke2 Qc2+ 31. Bd2 Bc3 +0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/ckfufm8a"] +[Date "????.??.??"] +[Round "?"] +[White "jorespi"] +[Black "Marzinkus"] +[Result "1/2-1/2"] +[WhiteElo "1725"] +[BlackElo "1785"] +[ECO "C02"] +[Opening "French Defense: Advance Variation #2"] +[TimeControl "360+6"] +[UTCDate "2012.12.31"] +[UTCTime "23:31:18"] +[Termination "Normal"] +[WhiteRatingDiff "+2"] +[BlackRatingDiff "-2"] + +1. e4 e6 2. d4 d5 3. e5 c5 4. c3 Ne7 5. f4 Nbc6 6. Bb5 Bd7 7. Bxc6 Bxc6 8. +Nf3 cxd4 9. cxd4 Nf5 10. Nc3 Bb4 11. O-O O-O 12. g4 Nh4 13. a3 Nxf3+ 14. +Qxf3 Bxc3 15. bxc3 Rc8 16. Bd2 Bb5 17. Rf2 Bc4 18. f5 a5 19. g5 b5 20. h4 +exf5 21. Qxf5 Qe7 22. h5 Rc6 23. h6 gxh6 24. gxh6 Rg6+ 25. Kh1 Qh4+ 26. Rh2 +Qg3 27. Qf2 Qd3 28. Rg1 Qc2 29. Rhg2 Bd3 30. Rg3 f6 31. Rxg6+ hxg6 32. e6 +Be4+ 33. Kh2 Bf5 34. e7 Re8 35. Qe2 Rxe7 36. Qxe7 Qxd2+ 37. Rg2 Qxh6+ 38. +Kg1 Qf8 39. Qb7 Qd6 40. Qa8+ Kf7 41. Qb7+ Qd7 42. Qb6 Be4 43. Rf2 Qg4+ 44. +Kf1 Qh3+ 45. Ke1 Qe3+ 46. Kf1 Bd3+ 47. Kg1 Qg3+ 48. Rg2 Qe1+ 49. Kh2 Qh4+ +50. Kg1 Qe1+ 51. Kh2 Qh4+ 52. Kg1 Qe1+ 53. Kh2 Qh4+ 54. Kg1 Qe1+ 1/2-1/2 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/r1hjky2j"] +[Date "????.??.??"] +[Round "?"] +[White "pseudoknight"] +[Black "Ben_Dover"] +[Result "0-1"] +[WhiteElo "1729"] +[BlackElo "1856"] +[ECO "B10"] +[Opening "Caro-Kann Defense"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:31:51"] +[Termination "Normal"] +[WhiteRatingDiff "-7"] +[BlackRatingDiff "+7"] + +1. e4 c6 2. Nf3 d5 3. exd5 cxd5 4. d4 Nc6 5. Nc3 Bf5 6. Bg5 Nf6 7. Bb5 a6 +8. Ba4 b5 9. Bb3 e6 10. O-O Bd6 11. Qe1 h6 12. Bh4 O-O 13. Ne5 Nxd4 14. Rd1 +Nxb3 15. cxb3 Be7 16. Nc6 Qc7 17. Nxe7+ Qxe7 18. Nxd5 Nxd5 19. Rxd5 Qxh4 +20. Rd7 e5 21. Qxe5 Bxd7 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/lfhdo7vu"] +[Date "????.??.??"] +[Round "?"] +[White "Desmond_Wilson"] +[Black "Sig"] +[Result "0-1"] +[WhiteElo "1668"] +[BlackElo "1907"] +[ECO "B07"] +[Opening "Rat Defense: Antal Defense"] +[TimeControl "420+9"] +[UTCDate "2012.12.31"] +[UTCTime "23:32:14"] +[Termination "Normal"] +[WhiteRatingDiff "-5"] +[BlackRatingDiff "+6"] + +1. d4 d6 2. e4 Nd7 3. Bb5 c6 4. Bc4 e5 5. d5 Ngf6 6. Bg5 h6 7. Bh4 c5 8. +Qf3 a6 9. a4 Qb6 10. b3 Qa5+ 11. Nd2 b5 12. Be2 Be7 13. Bxf6 Bxf6 14. Qh3 +Bg5 15. Nf3 Nf6 16. Qg3 Nxe4 17. Rd1 Nxg3 18. fxg3 Be3 19. Nh4 bxa4 20. Nf5 +Bxf5 21. bxa4 Bxc2 22. Ra1 Qxd2+ 23. Kf1 Bd3 24. Re1 Rb8 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/rweo1wg8"] +[Date "????.??.??"] +[Round "?"] +[White "Ben_Dover"] +[Black "pseudoknight"] +[Result "1-0"] +[WhiteElo "1856"] +[BlackElo "1729"] +[ECO "B27"] +[Opening "Sicilian Defense: Hyperaccelerated Dragon"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:33:24"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+7"] +[BlackRatingDiff "-7"] + +1. e4 c5 2. Nf3 g6 3. Bc4 Bg7 4. O-O e6 5. d4 Ne7 6. d5 exd5 7. exd5 d6 8. +Re1 O-O 9. Bg5 f6 10. Bf4 g5 11. Bg3 Nf5 12. h4 Nxg3 13. fxg3 h6 14. Qd3 +Nd7 15. Qg6 Ne5 16. Rxe5 fxe5 17. hxg5 Bf5 18. Qh5 e4 19. gxh6 exf3 20. +hxg7 f2+ 21. Kf1 Rf7 22. Nc3 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/yzr38w22"] +[Date "????.??.??"] +[Round "?"] +[White "cheesedout"] +[Black "sonie"] +[Result "0-1"] +[WhiteElo "1856"] +[BlackElo "1786"] +[ECO "A40"] +[Opening "Englund Gambit"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:34:10"] +[Termination "Normal"] +[WhiteRatingDiff "-13"] +[BlackRatingDiff "+13"] + +1. d4 e5 2. c4 exd4 3. Qxd4 Nc6 4. Qd1 d6 5. Nc3 Nf6 6. Nf3 Be7 7. a3 Bf5 +8. Bg5 O-O 9. e3 d5 10. cxd5 Nxd5 11. Nxd5 Bxg5 12. Nxg5 Qxg5 13. Nxc7 Rad8 +14. Nd5 Be4 15. Bc4 Bxd5 16. Qc2 Qxg2 17. O-O-O Be4 18. Bd3 Bxd3 19. Rxd3 +Qxh1+ 20. Rd1 Rxd1+ 21. Qxd1 Qxd1+ 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/svgpbjpp"] +[Date "????.??.??"] +[Round "?"] +[White "sebastian44"] +[Black "jtkjtkful"] +[Result "1-0"] +[WhiteElo "1351"] +[BlackElo "1542"] +[ECO "B01"] +[Opening "Scandinavian Defense"] +[TimeControl "300+5"] +[UTCDate "2012.12.31"] +[UTCTime "23:34:23"] +[Termination "Normal"] +[WhiteRatingDiff "+15"] +[BlackRatingDiff "-57"] + +1. e4 d5 2. e5 d4 3. d3 Qd5 4. Nf3 h6 5. c3 dxc3 6. Nxc3 Qc6 7. d4 Bg4 8. +Be2 Qg6 9. Nd5 Na6 10. Nh4 O-O-O 11. Nxg6 fxg6 12. Bxg4+ 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/opew3pnp"] +[Date "????.??.??"] +[Round "?"] +[White "barriosgb2"] +[Black "ghosty"] +[Result "1-0"] +[WhiteElo "1695"] +[BlackElo "1757"] +[ECO "B22"] +[Opening "Sicilian Defense: Alapin Variation"] +[TimeControl "240+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:33:32"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+11"] +[BlackRatingDiff "-125"] + +1. e4 c5 2. c3 g6 3. d4 cxd4 4. cxd4 Bg7 5. Nf3 e6 6. Nc3 Ne7 7. Bc4 a6 8. +O-O b5 9. Bb3 Bb7 10. Be3 d5 11. e5 b4 12. Ne2 a5 13. Ba4+ Nd7 14. Qd3 Ba6 +15. Bb5 Bxb5 16. Qxb5 O-O 17. a3 Nf5 18. axb4 Nxe3 19. fxe3 Nb6 20. bxa5 +Nc4 21. a6 Qd7 22. Qxd7 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/iwdxjr8a"] +[Date "????.??.??"] +[Round "?"] +[White "Abd0"] +[Black "Killi"] +[Result "0-1"] +[WhiteElo "1421"] +[BlackElo "1520"] +[ECO "B00"] +[Opening "Nimzowitsch Defense: Kennedy Variation, Linksspringer Variation"] +[TimeControl "420+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:35:21"] +[Termination "Normal"] +[WhiteRatingDiff "-9"] +[BlackRatingDiff "+8"] + +1. e4 Nc6 2. d4 e5 3. d5 Nce7 4. Nc3 Ng6 5. Bd3 Bb4 6. a3 Bxc3+ 7. bxc3 d6 +8. Be3 Nf6 9. c4 Bd7 10. Nf3 Bg4 11. O-O Qd7 12. Be2 Nf4 13. Bxf4 Nh5 14. +h3 Bxh3 15. Bxe5 Bxg2 16. Bxg7 Bxf1 17. Bxf1 Qg4+ 18. Bg2 Qxg7 19. Rb1 Nf4 +20. Nh4 O-O-O 21. Qf3 Nxg2 22. Nxg2 Rhg8 23. Kf1 Qd4 24. Qh3+ Kb8 25. Qxh7 +Qxc4+ 26. Ke1 Qxc2 27. Rd1 Rxg2 28. Qxf7 Rg1# 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/v1qe2gmv"] +[Date "????.??.??"] +[Round "?"] +[White "j-jorjik"] +[Black "Maroz"] +[Result "0-1"] +[WhiteElo "1556"] +[BlackElo "1525"] +[ECO "C22"] +[Opening "Center Game: Berger Variation"] +[TimeControl "480+8"] +[UTCDate "2012.12.31"] +[UTCTime "23:34:59"] +[Termination "Normal"] +[WhiteRatingDiff "-14"] +[BlackRatingDiff "+14"] + +1. e4 e5 2. d4 exd4 3. Qxd4 Nc6 4. Qe3 Nf6 5. Nc3 a6 6. Nd5 h6 7. Nxf6+ +Qxf6 8. Bd2 Be7 9. Bc3 Qg6 10. Rd1 O-O 11. g3 Bb4 12. Bd3 Bxc3+ 13. bxc3 +Qf6 14. Bc4 d6 15. f3 b5 16. Bd5 Bb7 17. Nh3 Rab8 18. Bxc6 Bxc6 19. Nf4 b4 +20. Nh5 Qe5 21. Nf4 bxc3 22. Ne2 Rb2 23. Nxc3 Rxc2 24. Rc1 Rxc1+ 25. Qxc1 +Bd7 26. Nd5 c6 27. Nb6 Qa5+ 28. Kd1 Qxb6 29. Qd2 Qb1+ 30. Qc1 Qxc1+ 31. +Kxc1 c5 32. Rd1 Bh3 33. Rxd6 Bg2 34. Rd3 c4 35. Rc3 Rc8 36. Kd2 Bf1 37. Ke1 +Bd3 38. e5 Rc5 39. f4 g5 40. Kf2 Kg7 41. Kf3 Kg6 42. fxg5 hxg5 43. g4 Rxe5 +44. a3 f6 45. h3 f5 46. gxf5+ Kxf5 47. Kg3 Re3+ 48. Kh2 Kf4 49. Kg2 Rg3+ +50. Kh2 Kf3 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/8rhz66pz"] +[Date "????.??.??"] +[Round "?"] +[White "pseudoknight"] +[Black "Ben_Dover"] +[Result "0-1"] +[WhiteElo "1722"] +[BlackElo "1863"] +[ECO "B35"] +[Opening "Sicilian Defense: Dragon Variation, Modern Bc4 Variation"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:35:47"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-7"] +[BlackRatingDiff "+7"] + +1. e4 c5 2. Nf3 d6 3. Nc3 Nc6 4. d4 cxd4 5. Nxd4 g6 6. Be3 Bg7 7. Bc4 Nf6 +8. Bb3 O-O 9. Qd3 Nb4 10. Qe2 Ng4 11. O-O-O a5 12. h3 Nxe3 13. Qxe3 Bd7 14. +a3 Nc6 15. Nxc6 Bxc6 16. f4 b5 17. Rhe1 b4 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/8dbw628m"] +[Date "????.??.??"] +[Round "?"] +[White "Jonathan_52"] +[Black "1000"] +[Result "0-1"] +[WhiteElo "1270"] +[BlackElo "1646"] +[ECO "A40"] +[Opening "English Defense #2"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:34:22"] +[Termination "Normal"] +[WhiteRatingDiff "-28"] +[BlackRatingDiff "+3"] + +1. d4 b6 2. e3 Bb7 3. Bd3 a6 4. Nf3 g6 5. e4 c6 6. d5 b5 7. dxc6 Bxc6 8. e5 +e6 9. Ng5 f6 10. f3 fxg5 11. Be4 Bxe4 12. fxe4 g4 13. Qd6 Bxd6 14. exd6 h5 +15. Rf1 h4 16. Rf4 h3 17. gxh3 g3 18. hxg3 Rxh3 19. Rg4 Rh1+ 20. Kf2 Qb6+ +21. Kf3 Rf1+ 22. Kg2 Qg1+ 23. Kh3 Qh1# 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/w9bplalm"] +[Date "????.??.??"] +[Round "?"] +[White "1000"] +[Black "Jonathan_52"] +[Result "1-0"] +[WhiteElo "1649"] +[BlackElo "1242"] +[ECO "A01"] +[Opening "Nimzo-Larsen Attack: Classical Variation"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:36:30"] +[Termination "Normal"] +[WhiteRatingDiff "+3"] +[BlackRatingDiff "-22"] + +1. b3 d5 2. Bb2 e5 3. a4 f5 4. a5 c5 5. a6 bxa6 6. e3 d4 7. exd4 cxd4 8. +Bd3 e4 9. Bf1 d3 10. cxd3 exd3 11. Bxd3 Qxd3 12. Qe2+ Kd7 13. Qxd3+ Ke7 14. +Qe3+ Kd7 15. Qd3+ Ke7 16. Ba3+ Kf6 17. Qc3+ Kg5 18. Bxf8 Nf6 19. Bxg7 Bb7 +20. Qxf6+ Kf4 21. Qe5+ Kg4 22. Bxh8 Bxg2 23. h3+ Kh4 24. Qg3+ Kh5 25. Qxg2 +a5 26. Qxa8 Nd7 27. Qxa7 Nf6 28. Qf7+ Kg5 29. h4+ Kg4 30. f3+ Kf4 31. Kf2 +Nd5 32. Ne2# 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/tvo57kgr"] +[Date "????.??.??"] +[Round "?"] +[White "schutzstaffel"] +[Black "MARC0"] +[Result "1-0"] +[WhiteElo "1871"] +[BlackElo "1627"] +[ECO "C41"] +[Opening "Philidor Defense #3"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:37:20"] +[Termination "Normal"] +[WhiteRatingDiff "+6"] +[BlackRatingDiff "-26"] + +1. e4 e5 2. Nf3 d6 3. Bc4 Nf6 4. Nc3 h6 5. d4 Be7 6. dxe5 dxe5 7. Qxd8+ +Bxd8 8. Nxe5 Nbd7 9. Nxf7 Rf8 10. Nxd8 Kxd8 11. O-O Ne5 12. Bb3 Bg4 13. Bf4 +Re8 14. f3 Bh5 15. Rad1+ Ke7 16. Bxe5 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/r5urywfn"] +[Date "????.??.??"] +[Round "?"] +[White "Rodney"] +[Black "neto391994"] +[Result "1-0"] +[WhiteElo "1514"] +[BlackElo "1550"] +[ECO "D30"] +[Opening "Queen's Gambit Declined"] +[TimeControl "480+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:30:49"] +[Termination "Normal"] +[WhiteRatingDiff "+12"] +[BlackRatingDiff "-22"] + +1. d4 d5 2. c4 e6 3. c5 c6 4. b4 a5 5. a3 axb4 6. e3 Qa5 7. Bd2 Nd7 8. Bxb4 +Qa7 9. Nf3 Ngf6 10. Be2 h6 11. O-O b6 12. cxb6 Qxb6 13. Bxf8 Nxf8 14. Nc3 +N8d7 15. Rb1 Qc7 16. Rb3 Ng4 17. g3 g5 18. Qd2 Ndf6 19. Ne1 e5 20. dxe5 +Qxe5 21. Qd4 Qxd4 22. exd4 Ne4 23. Nxe4 dxe4 24. Bxg4 Bxg4 25. Ng2 Be6 26. +Rb7 Rxa3 27. Rb8+ Ke7 28. Rxh8 Bc4 29. Rc1 Bd5 30. Ne3 Bb3 31. Rxc6 Ra1+ +32. Kg2 Ba4 33. Rcxh6 Bb5 34. Rh5 g4 35. Re5+ Kd6 36. Rxb5 Ke6 37. Rh6+ Ke7 +38. Re5+ Kd7 39. Rxe4 f5 40. Re5 Ra8 41. Rxf5 Ke7 42. Rb5 Kd7 43. Rbb6 Rc8 +44. Nxg4 Ke7 45. Rb7+ Kd8 46. Rh8# 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/6w1twyqo"] +[Date "????.??.??"] +[Round "?"] +[White "sonie"] +[Black "Gardo"] +[Result "1-0"] +[WhiteElo "1799"] +[BlackElo "1634"] +[ECO "B21"] +[Opening "Sicilian Defense: McDonnell Attack"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:35:50"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+7"] +[BlackRatingDiff "-7"] + +1. e4 c5 2. f4 d5 3. exd5 Qxd5 4. Nc3 Qd8 5. d3 e6 6. Be3 Nf6 7. Be2 b6 8. +Qd2 Nc6 9. O-O-O Bd7 10. d4 cxd4 11. Bxd4 Nxd4 12. Qxd4 Be7 13. Bb5 Bxb5 +14. Qxd8+ Rxd8 15. Rxd8+ Bxd8 16. Nxb5 a6 17. Nd6+ Ke7 18. Nc4 b5 19. Ne3 +Rg8 20. Ne2 Bb6 21. Nd1 g5 22. f5 e5 23. Re1 Nd7 24. g4 f6 25. h3 h6 26. +Ne3 Bxe3+ 27. Kb1 Nc5 28. Nc3 Bd4 29. Nd5+ Kd6 30. Nxf6 Rf8 31. Nh5 Bf2 32. +Re2 Bh4 33. b3 e4 34. Ng7 Kd5 35. Rd2+ Ke5 36. b4 Be1 37. Re2 Bxb4 38. Kb2 +a5 39. a3 Na4+ 40. Kb3 Bc3 41. Re3 Rc8 42. Ne6 Rc4 43. Rxc3 Rxc3+ 44. Ka2 +Rxc2+ 45. Kb1 Rh2 46. Kc1 Rxh3 47. Nf8 Rxa3 48. Ng6+ Kf6 49. Nf8 Ra2 50. +Nd7+ 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/2pprzty1"] +[Date "????.??.??"] +[Round "?"] +[White "ricodelacasita"] +[Black "cheesedout"] +[Result "0-1"] +[WhiteElo "1749"] +[BlackElo "1843"] +[ECO "B40"] +[Opening "Sicilian Defense: French Variation"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:36:49"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-9"] +[BlackRatingDiff "+8"] + +1. e4 c5 2. Nf3 e6 3. Be2 d5 4. exd5 exd5 5. d4 Nf6 6. dxc5 Bxc5 7. O-O Be7 +8. h3 O-O 9. Bf4 Nc6 10. c3 Bd6 11. Bxd6 Qxd6 12. Nbd2 Bf5 13. Nb3 Bg6 14. +Bd3 Nh5 15. Nbd4 Nxd4 16. cxd4 Be4 17. Bxe4 dxe4 18. Ne5 Nf4 19. Qg4 Ne6 +20. Rad1 f6 21. Nc4 Qd5 22. Ne3 Qg5 23. Qxe4 Nf4 24. d5 Nxh3+ 25. Kh2 Nf4 +26. g3 Qh5+ 27. Kg1 Nh3+ 28. Kg2 f5 29. Qh4 Qxh4 30. gxh4 Nf4+ 31. Kf3 Nh5 +32. Rg1 g6 33. d6 Nf6 34. d7 Rad8 35. Nc4 Rxd7 36. Rxd7 Nxd7 37. Rd1 Nc5 +38. Rd5 Ne6 39. Rd6 Nc7 40. Rd7 Nb5 41. Nd6 Nd4+ 0-1 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/7zkpfs9g"] +[Date "????.??.??"] +[Round "?"] +[White "tiggran"] +[Black "maslick"] +[Result "0-1"] +[WhiteElo "1549"] +[BlackElo "1609"] +[ECO "C55"] +[Opening "Italian Game: Two Knights Defense, Modern Bishop's Opening"] +[TimeControl "300+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:37:54"] +[Termination "Normal"] +[WhiteRatingDiff "-9"] +[BlackRatingDiff "+30"] + +1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. d3 d6 5. Bg5 Be7 6. c3 Bg4 7. h3 Be6 8. +Bxe6 fxe6 9. Qb3 Qd7 10. Qxb7 O-O 11. Qb3 Rab8 12. Qc2 d5 13. Nbd2 h6 14. +Bxf6 Rxf6 15. O-O d4 16. c4 Qe8 17. Rfe1 Qg6 18. b3 Bb4 19. Qd1 Bc3 20. Rc1 +Rbf8 21. Nh4 Qg5 22. g3 Qxd2 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/4dkjy2se"] +[Date "????.??.??"] +[Round "?"] +[White "sebastian44"] +[Black "metrolog"] +[Result "0-1"] +[WhiteElo "1366"] +[BlackElo "1440"] +[ECO "C02"] +[Opening "French Defense: Advance Variation #3"] +[TimeControl "300+5"] +[UTCDate "2012.12.31"] +[UTCTime "23:37:59"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-8"] +[BlackRatingDiff "+9"] + +1. e4 d5 2. e5 e6 3. d4 Ne7 4. Nf3 Ng6 5. Bb5+ c6 6. Bd3 Be7 7. Bxg6 fxg6 +8. Nc3 O-O 9. O-O c5 10. dxc5 Bxc5 11. Bg5 Qb6 12. a3 Qxb2 13. Na4 Qb5 14. +Nxc5 Qxc5 15. Be3 Qc7 16. Rc1 Nc6 17. Bc5 Rf5 18. Bd6 Qf7 19. Qd3 a5 20. +Rce1 b6 21. Nh4 Rh5 22. g3 Ba6 23. Qc3 Nd8 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/4l1zkb2b"] +[Date "????.??.??"] +[Round "?"] +[White "Ben_Dover"] +[Black "pseudoknight"] +[Result "1-0"] +[WhiteElo "1870"] +[BlackElo "1715"] +[ECO "B21"] +[Opening "Sicilian Defense: Smith-Morra Gambit"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:38:38"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+6"] +[BlackRatingDiff "-6"] + +1. e4 c5 2. d4 cxd4 3. c3 dxc3 4. Nxc3 d6 5. Nf3 g6 6. Bc4 Bg7 7. Bf4 Nf6 +8. Rc1 O-O 9. O-O Nc6 10. a3 a6 11. b4 Bd7 12. Qb3 b5 13. Bxf7+ Rxf7 14. +Ng5 e6 15. Bxd6 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/k6e0k2bs"] +[Date "????.??.??"] +[Round "?"] +[White "Jonathan_52"] +[Black "1000"] +[Result "0-1"] +[WhiteElo "1220"] +[BlackElo "1652"] +[ECO "A40"] +[Opening "English Defense #2"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:38:53"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-17"] +[BlackRatingDiff "+2"] + +1. d4 b6 2. e4 Bb7 3. c4 a6 4. f4 e6 5. d5 exd5 6. exd5 g6 7. Qe2+ Qe7 8. +f5 gxf5 9. Qxe7+ Bxe7 10. Bd3 Kd8 11. Bxf5 c6 12. dxc6 Bxc6 13. Bf4 Bxg2 +14. Be4 Bxe4 15. Nf3 Bxf3 16. Rf1 Bb7 17. h3 Bf6 18. h4 Bxb2 19. Nc3 Bxc3+ +20. Kd1 Bxa1 21. Ke2 a5 22. Rxa1 Ba6 23. Rc1 b5 24. cxb5 Bxb5+ 25. Kd2 h5 +26. Rb1 Bc6 27. Rb4 Na6 28. Rc4 Rc8 29. Rd4 d5 30. Bd6 Nf6 31. Rf4 Ne4+ 32. +Kd3 Re8 33. Rf6 Ng3 34. Rxf7 Re3+ 35. Kc2 Bb5+ 36. Kd2 Rcc3 37. Kd1 Re2 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/5dpjox73"] +[Date "????.??.??"] +[Round "?"] +[White "Gardo"] +[Black "sonie"] +[Result "0-1"] +[WhiteElo "1627"] +[BlackElo "1806"] +[ECO "A04"] +[Opening "Zukertort Opening: Queenside Fianchetto Variation"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:38:47"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-6"] +[BlackRatingDiff "+6"] + +1. Nf3 b6 2. d4 Bb7 3. c4 g6 4. Nc3 Bg7 5. e4 e6 6. d5 Ne7 7. Bd3 exd5 8. +exd5 c6 9. Be4 cxd5 10. Bxd5 Bxd5 11. cxd5 d6 12. O-O Nd7 13. Re1 O-O 14. +a3 Be5 15. Rb1 Bxc3 16. bxc3 Rc8 17. c4 Nc5 18. Bd2 Nf5 19. Bf4 Qd7 20. Qc2 +Rfe8 21. Ng5 Rxe1+ 22. Rxe1 Re8 23. Rxe8+ Qxe8 24. g3 h6 25. Nh3 Kg7 26. +Bxd6 Ne4 27. Qb2+ Kg8 28. Be5 f6 29. Bxf6 Kf7 30. Ng5+ hxg5 31. Bg7 Nxg7 +32. f3 Nf6 33. Kg2 Qe3 34. Kh3 g4+ 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/nk9szdum"] +[Date "????.??.??"] +[Round "?"] +[White "nujabes"] +[Black "Boss92"] +[Result "1-0"] +[WhiteElo "1731"] +[BlackElo "1517"] +[ECO "B06"] +[Opening "Modern Defense"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:39:21"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+6"] +[BlackRatingDiff "-6"] + +1. e4 g6 2. Nf3 e6 3. d4 Bg7 4. Bc4 Ne7 5. Nc3 O-O 6. O-O f6 7. e5 f5 8. +Bg5 c6 9. Qd2 Qe8 10. Bxe7 Qxe7 11. Ng5 h6 12. Nh3 g5 13. f4 g4 14. Nf2 d6 +15. h3 gxh3 16. gxh3 d5 17. Be2 Kh8 18. Kh2 Rg8 19. Bh5 Nd7 20. Rg1 c5 21. +Rg6 cxd4 22. Qxd4 Nc5 23. Rag1 Ne4 24. Nfxe4 fxe4 25. Nb5 Bd7 26. Nd6 Rac8 +27. c3 Rcf8 28. Qe3 Qh4 29. Be2 Qxf4+ 30. Qxf4 Rxf4 31. Rxg7 Rxg7 32. Rxg7 +Kxg7 33. Bg4 b6 34. Kg3 Rf3+ 35. Kh4 Kg6 36. Ne8 h5 37. Nf6 Rxf6 38. exf6 +Kxf6 39. Bxe6 Ke5 40. Kxh5 Bxe6 41. Kg6 Bd7 42. h4 Bh3 43. h5 Bg4 44. h6 +Bf5+ 45. Kg7 Bh7 46. Kxh7 Kf4 47. Kg7 e3 48. h7 e2 49. h8=Q e1=Q 50. Qh4+ +Kf3 51. Qxe1 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/57g6e1ub"] +[Date "????.??.??"] +[Round "?"] +[White "Beibus"] +[Black "Carroll"] +[Result "0-1"] +[WhiteElo "1621"] +[BlackElo "1661"] +[ECO "C02"] +[Opening "French Defense: Advance Variation"] +[TimeControl "180+3"] +[UTCDate "2012.12.31"] +[UTCTime "23:39:49"] +[Termination "Normal"] +[WhiteRatingDiff "-9"] +[BlackRatingDiff "+28"] + +1. e4 e6 2. d4 d5 3. e5 c5 4. c3 Nc6 5. f4 Nge7 6. g4 cxd4 7. cxd4 Qb6 8. +Nf3 Ng6 9. Be3 Bb4+ 10. Nc3 Bd7 11. Bd3 Rc8 12. Bxg6 fxg6 13. a3 Bxc3+ 14. +bxc3 Na5 15. Rb1 Qc7 16. Rc1 Nc4 17. Qe2 O-O 18. Ng5 a6 19. a4 Qa5 20. O-O +h6 21. Nf3 Bxa4 22. Ra1 b5 23. Rfc1 Qb6 24. Bf2 Rxf4 25. Nh4 Kh7 26. Qd3 +Rcf8 27. Qxg6+ Kg8 28. Qxe6+ Qxe6 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/fij0ygia"] +[Date "????.??.??"] +[Round "?"] +[White "tarasss"] +[Black "Mariss"] +[Result "0-1"] +[WhiteElo "1499"] +[BlackElo "1895"] +[ECO "C55"] +[Opening "Italian Game: Anti-Fried Liver Defense"] +[TimeControl "660+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:38:05"] +[Termination "Normal"] +[WhiteRatingDiff "-3"] +[BlackRatingDiff "+3"] + +1. e4 e5 2. Nf3 Nc6 3. Bc4 h6 4. d4 exd4 5. Nxd4 Bc5 6. Nf5 Qf6 7. Nc3 Nge7 +8. Bf4 d6 9. Nd5 Nxd5 10. Bxd5 O-O 11. Nxh6+ gxh6 12. Qd2 Qxb2 13. Kf1 +Qxa1+ 14. Ke2 Qd4 15. Qe1 0-1 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/u2c6lcug"] +[Date "????.??.??"] +[Round "?"] +[White "barriosgb2"] +[Black "georgek"] +[Result "1-0"] +[WhiteElo "1706"] +[BlackElo "1570"] +[ECO "C41"] +[Opening "Philidor Defense: Nimzowitsch Variation"] +[TimeControl "180+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:40:32"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+7"] +[BlackRatingDiff "-7"] + +1. e4 e5 2. Nf3 Nf6 3. d4 d6 4. dxe5 dxe5 5. Bd3 Bc5 6. O-O O-O 7. Nc3 Bg4 +8. Be3 Bxe3 9. fxe3 Nc6 10. Qe1 Qe7 11. Nd5 Qd8 12. Rd1 Be6 13. Ng5 Bxd5 +14. exd5 Ne7 15. Qh4 h6 16. Ne4 Ng6 17. Nxf6+ gxf6 18. Qg4 Kg7 19. h4 Rh8 +20. h5 Qe7 21. hxg6 fxg6 22. Qxg6+ Kf8 23. Rf2 Qc5 24. Rxf6+ Ke7 25. Rf7+ +Kd8 26. Qf6+ Kc8 27. Bf5+ Kb8 28. Qxh8+ 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/11lz75z1"] +[Date "????.??.??"] +[Round "?"] +[White "cheesedout"] +[Black "ricodelacasita"] +[Result "0-1"] +[WhiteElo "1851"] +[BlackElo "1740"] +[ECO "D15"] +[Opening "Slav Defense: Two Knights Attack"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:39:27"] +[Termination "Normal"] +[WhiteRatingDiff "-14"] +[BlackRatingDiff "+15"] + +1. d4 c6 2. c4 d5 3. Nc3 dxc4 4. Nf3 Nf6 5. Bg5 Bg4 6. e3 e6 7. Bxc4 Be7 8. +Qc2 h6 9. Bh4 Nbd7 10. O-O-O Nb6 11. Bd3 a5 12. a3 O-O 13. h3 Bh5 14. g4 +Bg6 15. Bxg6 fxg6 16. Qxg6 Nfd5 17. Bxe7 Qxe7 18. Ne4 Rxf3 19. h4 Qf7 20. +Qh5 Nc4 21. Qxf7+ Rxf7 22. g5 h5 23. g6 Rff8 24. Nc5 b6 25. Nxe6 Rxf2 26. +Rd2 Nxd2 27. Ng5 Nb3+ 28. Kb1 Nd2+ 29. Ka1 Nb3+ 30. Ka2 a4 31. e4 Nc3# 0-1 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/5ug0gm2j"] +[Date "????.??.??"] +[Round "?"] +[White "joecasatro"] +[Black "?"] +[Result "0-1"] +[WhiteElo "1081"] +[BlackElo "?"] +[ECO "B54"] +[Opening "Sicilian Defense"] +[TimeControl "300+3"] +[UTCDate "2012.12.31"] +[UTCTime "23:41:40"] +[Termination "Normal"] + +1. e4 c5 2. Nf3 d6 3. d4 Na6 4. Bxa6 bxa6 5. dxc5 Bb7 6. cxd6 exd6 7. Nc3 +Nf6 8. e5 Ng4 9. exd6 Bxd6 10. h3 Qe7+ 11. Be3 Nxe3 12. fxe3 Qxe3+ 13. Ne2 +Bg3+ 14. Kf1 Qf2# 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/9eowgcah"] +[Date "????.??.??"] +[Round "?"] +[White "adamsrj"] +[Black "6WX"] +[Result "1-0"] +[WhiteElo "1513"] +[BlackElo "1433"] +[ECO "A40"] +[Opening "Horwitz Defense"] +[TimeControl "1560+30"] +[UTCDate "2012.12.31"] +[UTCTime "23:40:11"] +[Termination "Normal"] +[WhiteRatingDiff "+9"] +[BlackRatingDiff "-29"] + +1. d4 e6 2. Nf3 Be7 3. c4 c6 4. Nc3 d5 5. cxd5 cxd5 6. e3 Nc6 7. Bb5 Bd7 8. +Qa4 Qb6 9. Bd2 a6 10. O-O Nf6 11. Bxc6 Bxc6 12. Qc2 Qc7 13. Ne5 Bd6 14. f4 +Bb5 15. Rfc1 Rc8 16. Qb3 Bc4 17. Nxc4 dxc4 18. Qa4+ Nd7 19. Ne4 Be7 20. b3 +O-O 21. Rxc4 Qb8 22. Rxc8 Rxc8 23. b4 Nb6 24. Qd1 Nc4 25. Bc1 Bxb4 26. Nd2 +Ba3 27. Nxc4 Bxc1 28. Rxc1 b5 29. Ne5 Rxc1 30. Qxc1 f6 31. Nd7 Qd6 32. Qc8+ +Kf7 33. Nc5 Kg6 34. Qxe6 Qc7 35. f5+ Kg5 36. Qxa6 g6 37. fxg6 hxg6 38. Ne6+ +1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/zz6hctpl"] +[Date "????.??.??"] +[Round "?"] +[White "sonie"] +[Black "Gardo"] +[Result "1-0"] +[WhiteElo "1812"] +[BlackElo "1621"] +[ECO "B21"] +[Opening "Sicilian Defense: Smith-Morra Gambit #2"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:41:05"] +[Termination "Normal"] +[WhiteRatingDiff "+6"] +[BlackRatingDiff "-6"] + +1. e4 c5 2. d4 d6 3. dxc5 dxc5 4. Qxd8+ Kxd8 5. Be3 e5 6. Nc3 Nf6 7. O-O-O+ +Ke8 8. f4 Nc6 9. fxe5 Nxe5 10. Nb5 a6 11. Nc7+ Ke7 12. Bxc5# 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/jz0n40qn"] +[Date "????.??.??"] +[Round "?"] +[White "ricodelacasita"] +[Black "cheesedout"] +[Result "0-1"] +[WhiteElo "1755"] +[BlackElo "1837"] +[ECO "B40"] +[Opening "Sicilian Defense: French Variation"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:41:34"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-9"] +[BlackRatingDiff "+8"] + +1. e4 c5 2. Nf3 e6 3. Be2 d5 4. d3 Nf6 5. e5 Nfd7 6. d4 Be7 7. c3 O-O 8. +O-O Nc6 9. h3 f6 10. exf6 Nxf6 11. dxc5 Bxc5 12. Bg5 h6 13. Bh4 Be7 14. Bg3 +Bd6 15. Bxd6 Qxd6 16. Na3 a6 17. Nc2 e5 18. Nd2 e4 19. Nc4 Qf4 20. N2e3 Qg5 +21. Nd6 Bxh3 22. Kh2 Be6 23. c4 d4 24. Nd5 Nxd5 25. cxd5 Bxd5 26. Nxb7 d3 +27. Bg4 Ne5 28. Bh3 Bxb7 29. Qb3+ Kh8 30. Qxb7 Qh4 31. g3 Ng4+ 32. Kg2 Qg5 +33. Bxg4 Qxg4 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/cryiytws"] +[Date "????.??.??"] +[Round "?"] +[White "schutzstaffel"] +[Black "nujabes"] +[Result "0-1"] +[WhiteElo "1863"] +[BlackElo "1737"] +[ECO "B01"] +[Opening "Scandinavian Defense"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:43:07"] +[Termination "Normal"] +[WhiteRatingDiff "-19"] +[BlackRatingDiff "+16"] + +1. e4 d5 2. e5 c5 3. g3 Nc6 4. Qe2 Nh6 5. d4 Bg4 6. f3 Nxd4 7. Qd3 Bf5 8. +Qe3 Nxc2+ 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/5pv72z4l"] +[Date "????.??.??"] +[Round "?"] +[White "Jonathan_52"] +[Black "1000"] +[Result "0-1"] +[WhiteElo "1203"] +[BlackElo "1654"] +[ECO "A40"] +[Opening "English Defense #2"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:42:21"] +[Termination "Normal"] +[WhiteRatingDiff "-15"] +[BlackRatingDiff "+2"] + +1. d4 b6 2. e4 Bb7 3. f4 a6 4. c4 b5 5. cxb5 axb5 6. d5 Ba6 7. e5 b4 8. f5 +c6 9. a3 Bxf1 10. axb4 Rxa1 11. dxc6 Rxb1 12. Qd5 Rxc1+ 13. Kf2 Ba6 14. Nf3 +dxc6 15. Qc5 Rxc5 16. Nh4 Qd2+ 17. Kf3 Qd3+ 18. Kf2 Rc2+ 19. Kg1 Qd1# 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/ez8rfz4d"] +[Date "????.??.??"] +[Round "?"] +[White "hostking"] +[Black "maslick"] +[Result "1-0"] +[WhiteElo "1782"] +[BlackElo "1666"] +[ECO "C55"] +[Opening "Italian Game: Two Knights Defense, Modern Bishop's Opening"] +[TimeControl "540+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:42:49"] +[Termination "Normal"] +[WhiteRatingDiff "+7"] +[BlackRatingDiff "-9"] + +1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. d3 Be7 5. Nc3 d6 6. h3 Be6 7. Bxe6 fxe6 +8. d4 exd4 9. Nxd4 O-O 10. Nxe6 Qd7 11. Nxf8 Rxf8 12. O-O Ne5 13. f4 Nc4 +14. b3 Nb6 15. e5 Ne8 16. Ba3 Qc6 17. Qf3 Qd7 18. Rad1 Qe6 19. Rfe1 Rf7 20. +exd6 Qg6 21. dxe7 Qxc2 22. Rd8 h6 23. Rxe8+ Kh7 24. Rh8+ Kg6 25. e8=Q 1-0 + +[Event "Rated Blitz game"] +[Site "https://lichess.org/p9iql6gw"] +[Date "????.??.??"] +[Round "?"] +[White "FifthCategory"] +[Black "HeyPepito"] +[Result "0-1"] +[WhiteElo "1888"] +[BlackElo "1771"] +[ECO "C00"] +[Opening "French Defense: Knight Variation"] +[TimeControl "180+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:42:54"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-14"] +[BlackRatingDiff "+35"] + +1. e4 e6 2. Nf3 d5 3. exd5 exd5 4. d4 Nf6 5. h3 Bd6 6. Bd3 O-O 7. O-O Be6 +8. Bg5 Nbd7 9. Re1 h6 10. Bh4 c6 11. Ne5 Qc7 12. Nxd7 Qxd7 13. Bxf6 gxf6 +14. Qf3 f5 15. Nc3 Kh7 16. Ne2 Rg8 17. Nf4 Bxf4 18. Qxf4 Rg5 19. g3 Rag8 +20. Kh2 h5 21. Rg1 a6 22. a3 a5 23. Rae1 b6 24. b3 c5 25. dxc5 bxc5 26. Re5 +R8g6 27. Rge1 Kg7 28. a4 Kf6 29. R5e2 Kg7 30. Qe5+ Rf6 31. Qf4 Rfg6 32. Re5 +Kf6 33. Bb5 Qb7 34. R5e2 Kg7 35. Qe5+ Rf6 36. Qf4 Kg6 37. Re5 Qc7 38. Qe3 +Qd6 39. Bd3 d4 40. Qe2 Kh6 41. h4 Rg4 42. Qd2+ Kh7 43. Qxa5 Rfg6 44. Qd2 +Bd7 45. Qe2 Bc6 46. Bb5 Bxb5 47. axb5 Qb8 48. Qc4 Rg7 49. Qxc5 f4 50. Rxh5+ +Kg8 51. Rhe5 fxg3+ 52. fxg3 Rxg3 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/lemtrylc"] +[Date "????.??.??"] +[Round "?"] +[White "Gardo"] +[Black "Boss92"] +[Result "1-0"] +[WhiteElo "1615"] +[BlackElo "1511"] +[ECO "A04"] +[Opening "Zukertort Opening: Kingside Fianchetto"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:43:50"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+9"] +[BlackRatingDiff "-8"] + +1. Nf3 g6 2. d4 Bg7 3. c4 e6 4. Nc3 c6 5. e3 Ne7 6. Bd3 O-O 7. O-O f5 8. +Qc2 d5 9. cxd5 exd5 10. a3 Nd7 11. b3 Nf6 12. b4 Ne4 13. Bxe4 dxe4 14. Nd2 +Nd5 15. Qb3 Be6 16. Nxd5 Bxd5 17. Nc4 b5 18. Bd2 Bxc4 19. Qc3 Bxf1 20. Rxf1 +Qb6 21. a4 bxa4 22. Qa3 Qb5 23. Rb1 Rad8 24. Bc3 Rf7 25. d5 cxd5 26. Bxg7 +Rxg7 27. h3 Rc7 28. Ra1 Rdc8 29. Kh2 Rc3 30. Qxa4 Qxa4 31. Rxa4 R8c7 32. b5 +Rb3 33. Rd4 Rxb5 34. g3 Rcc5 35. Kg2 Kf7 36. h4 Kf6 37. Kh3 Ke5 38. g4 h5 +39. g5 f4 40. exf4+ Kxf4 41. Rxd5 Rc3+ 42. f3 Rbb3 43. Kh2 Rxf3 44. Rf5+ +1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/1wey3xwd"] +[Date "????.??.??"] +[Round "?"] +[White "b777"] +[Black "NotGoodAtThis"] +[Result "1-0"] +[WhiteElo "1622"] +[BlackElo "1576"] +[ECO "C21"] +[Opening "King's Pawn Game: Beyer Gambit"] +[TimeControl "300+8"] +[UTCDate "2012.12.31"] +[UTCTime "23:41:46"] +[Termination "Normal"] +[WhiteRatingDiff "+8"] +[BlackRatingDiff "-94"] + +1. e4 e5 2. d4 d5 3. dxe5 dxe4 4. Qxd8+ Kxd8 5. Nc3 Nc6 6. Bf4 Bb4 7. Bc4 +Nd4 8. Rd1 Bg4 9. f3 Bf5 10. Rxd4+ Ke8 11. Bxf7+ Kxf7 12. Rxb4 Rd8 13. fxe4 +Be6 14. Nf3 c5 15. Rxb7+ Ne7 16. Rc7 Rc8 17. Rxa7 h6 18. O-O g5 19. Nxg5+ +hxg5 20. Bxg5+ Kg6 21. Bxe7 Rh7 22. Rf6+ Kg7 23. Rxe6 Kf7 24. Rf6+ Ke8 25. +Rf8# 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/pustsz6l"] +[Date "????.??.??"] +[Round "?"] +[White "neto391994"] +[Black "Rodney"] +[Result "1-0"] +[WhiteElo "1528"] +[BlackElo "1526"] +[ECO "C41"] +[Opening "Philidor Defense #3"] +[TimeControl "480+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:44:02"] +[Termination "Normal"] +[WhiteRatingDiff "+19"] +[BlackRatingDiff "-10"] + +1. e4 e5 2. Nf3 d6 3. Bc4 h6 4. Nc3 c6 5. d3 b5 6. Bb3 a5 7. a4 b4 8. Ne2 +c5 9. c3 Bg4 10. Neg1 Nf6 11. cxb4 cxb4 12. h3 Bh5 13. g4 Bg6 14. Nd2 Nc6 +15. h4 Nd4 16. h5 Bh7 17. Nc4 Nxb3 18. Qxb3 Nxg4 19. f3 Nf6 20. Nh3 Be7 21. +Rg1 O-O 22. Bxh6 Nxh5 23. Qd1 Bg6 24. Be3 Nf4 25. Nxf4 exf4 26. Bxf4 Bh4+ +27. Ke2 Re8 28. Qb3 d5 29. Nd6 Re7 30. Kd2 dxe4 31. Rxg6 Kh7 32. Rg4 Rd7 +33. Nxe4 Rxd3+ 34. Qxd3 Qxd3+ 35. Kxd3 Rd8+ 36. Ke3 Be7 37. Rh1+ Kg8 38. +Bh6 f5 39. Rxg7+ Kh8 40. Rxe7 fxe4 41. Rxe4 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/rbsxmejf"] +[Date "????.??.??"] +[Round "?"] +[White "schutzstaffel"] +[Black "nujabes"] +[Result "0-1"] +[WhiteElo "1844"] +[BlackElo "1753"] +[ECO "B01"] +[Opening "Scandinavian Defense"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:44:10"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-17"] +[BlackRatingDiff "+15"] + +1. e4 d5 2. e5 c5 3. Nf3 Nc6 4. Bb5 Bg4 5. Bxc6+ bxc6 6. O-O Qc7 7. c3 Bxf3 +8. Qxf3 Qxe5 9. d3 Nf6 10. Bf4 Qf5 11. h3 e6 12. g4 Qg6 13. Qg3 h5 14. g5 +h4 15. Qg2 Nh5 16. Be3 Be7 17. f4 Ng3 18. Bf2 e5 19. Bxg3 exf4 20. Bxf4 +Qxd3 21. Na3 c4 22. Rae1 Kd7 23. Qg4+ Kd8 24. Rxe7 Kxe7 25. Re1+ Kd8 26. g6 +Qxg6 27. Qxg6 fxg6 28. Bg5+ Kd7 29. b3 Rae8 30. Rf1 Re3 31. Rf7+ Ke6 32. +Re7+ Kf5 33. Bxe3 g5 34. Bd4 Rf8 35. Rxg7 Ke4 36. Rxg5 Rf3 37. Re5+ Kd3 38. +bxc4 dxc4 39. Nb1 Rg3+ 40. Kf2 Kc2 41. Na3+ Kc1 42. Nxc4 Kb1 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/uzvrxybj"] +[Date "????.??.??"] +[Round "?"] +[White "cheesedout"] +[Black "ricodelacasita"] +[Result "0-1"] +[WhiteElo "1845"] +[BlackElo "1746"] +[ECO "D43"] +[Opening "Semi-Slav Defense"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:44:01"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-13"] +[BlackRatingDiff "+15"] + +1. d4 c6 2. c4 d5 3. Nc3 e6 4. Nf3 Nf6 5. Bg5 Be7 6. Bh4 h6 7. Bg3 O-O 8. +e3 Nbd7 9. Bd3 dxc4 10. Bxc4 Nb6 11. Bd3 Nbd5 12. O-O Nxc3 13. bxc3 Nd5 14. +Qc2 f5 15. e4 fxe4 16. Bxe4 Nf6 17. Bd3 Bd6 18. Be5 Bxe5 19. Nxe5 Nd7 20. +Ng6 Rf7 21. Bc4 Qf6 22. Bd3 Nf8 23. Ne5 Re7 24. Rae1 Bd7 25. Ng4 Qg5 26. +Ne5 Qf6 27. Nxd7 Rxd7 28. Re3 Re8 29. Rf3 Qg5 30. Rg3 Qf6 31. h3 Red8 32. +Qe2 e5 33. Rf3 Qe6 34. Bf5 Qd5 35. Bxd7 Rxd7 36. dxe5 Qd2 37. Qxd2 Rxd2 38. +e6 Re2 39. Re3 Rxe3 40. fxe3 Nxe6 41. Re1 Nc5 42. Kf2 Nd3+ 43. Ke2 Nxe1 44. +Kxe1 Kf7 45. Ke2 Ke6 46. Kd3 Kd5 47. e4+ Ke5 48. c4 b6 49. Ke3 c5 50. g4 g6 +51. h4 g5 52. hxg5 hxg5 53. Kf3 a6 54. Ke3 b5 55. cxb5 axb5 56. Kd3 c4+ 57. +Kc3 Kxe4 58. Kb4 Kf4 59. Kxb5 c3 60. Kc4 c2 61. a4 c1=Q+ 62. Kb5 Qb2+ 63. +Ka6 Qa3 64. a5 Qb4 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/ysmsba6s"] +[Date "????.??.??"] +[Round "?"] +[White "1000"] +[Black "giao"] +[Result "1-0"] +[WhiteElo "1656"] +[BlackElo "1431"] +[ECO "A01"] +[Opening "Nimzo-Larsen Attack"] +[TimeControl "0+1"] +[UTCDate "2012.12.31"] +[UTCTime "23:44:48"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+6"] +[BlackRatingDiff "-5"] + +1. b3 g6 2. Bb2 Nf6 3. a3 Bg7 4. g4 O-O 5. g5 b6 6. gxf6 exf6 7. Bg2 f5 8. +Bxg7 Kxg7 9. Bxa8 Nc6 10. Bxc6 dxc6 11. Qc1 Qf6 12. c3 b5 13. Qb2 a5 14. +Ra2 Kg8 15. c4 Qd6 16. Nc3 bxc4 17. bxc4 Be6 18. c5 Qxc5 19. Qc2 Rd8 20. e3 +Qb6 21. d4 c5 22. Na4 Bxa2 23. Nxb6 cxb6 24. Qxa2 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/0wn9o371"] +[Date "????.??.??"] +[Round "?"] +[White "Ben_Dover"] +[Black "schutzstaffel"] +[Result "1-0"] +[WhiteElo "1876"] +[BlackElo "1877"] +[ECO "C00"] +[Opening "French Defense: Normal Variation"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:40:47"] +[Termination "Normal"] +[WhiteRatingDiff "+10"] +[BlackRatingDiff "-14"] + +1. e4 e6 2. d4 Ne7 3. Nf3 Ng6 4. Bg5 Be7 5. Bxe7 Qxe7 6. Nc3 O-O 7. h4 h5 +8. Ng5 Nf4 9. Qd2 e5 10. dxe5 Qxe5 11. Nf3 Qf6 12. e5 Qh6 13. Ng5 Ne6 14. +O-O-O Nxg5 15. hxg5 Qg6 16. Bd3 Qe6 17. f4 g6 18. Rdg1 b6 19. g4 Bb7 20. +Rh2 hxg4 21. Ne4 d5 22. Rgh1 f6 23. Rh8+ Kf7 24. R1h7+ Ke8 25. Nxf6+ Qxf6 +26. gxf6 Nc6 27. Bxg6+ Kd8 28. Rxf8# 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/7tuxquet"] +[Date "????.??.??"] +[Round "?"] +[White "excel"] +[Black "VanillaShamanilla"] +[Result "1-0"] +[WhiteElo "1646"] +[BlackElo "1678"] +[ECO "C46"] +[Opening "Three Knights Opening"] +[TimeControl "600+5"] +[UTCDate "2012.12.31"] +[UTCTime "23:40:45"] +[Termination "Normal"] +[WhiteRatingDiff "+11"] +[BlackRatingDiff "-61"] + +1. e4 e5 2. Nf3 Nc6 3. Nc3 Bc5 4. Bb5 Nd4 5. Nxe5 Qg5 6. Nf3 Qxg2 7. Nxd4 +Qxh1+ 8. Ke2 Qxd1+ 9. Kxd1 Bxd4 10. Nd5 Bb6 11. Be2 Nf6 12. Nc3 O-O 13. d3 +Bxf2 14. Bg5 d6 15. Bxf6 gxf6 16. Nd5 f5 17. Nxc7 Rb8 18. Nb5 f4 19. Nxd6 +Be3 20. Nb5 a6 21. Nc3 Bh3 22. Nd5 Kg7 23. c4 Kg6 24. Kc2 Rbe8 25. b4 f5 +26. exf5+ Kxf5 27. Bf1 Bxf1 28. Rxf1 Rg8 29. Nxe3+ Ke5 30. Nd5 Rg2+ 31. Kc3 +Rxa2 32. d4+ Kf5 33. Nxf4 Re3+ 34. Nd3+ Ke4 35. Rf4# 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/xglg4885"] +[Date "????.??.??"] +[Round "?"] +[White "rennigeb"] +[Black "zanella"] +[Result "0-1"] +[WhiteElo "1510"] +[BlackElo "1805"] +[ECO "B01"] +[Opening "Scandinavian Defense: Main Line"] +[TimeControl "600+3"] +[UTCDate "2012.12.31"] +[UTCTime "23:50:26"] +[Termination "Normal"] +[WhiteRatingDiff "-4"] +[BlackRatingDiff "+9"] + +1. e4 d5 2. exd5 Qxd5 3. Nc3 Qa5 4. d3 c6 5. Bd2 Qb6 6. b3 Nf6 7. Nf3 Bg4 +8. Be2 e6 9. Ne5 Bxe2 10. Qxe2 Be7 11. f4 O-O 12. Be3 Qa5 13. Bd2 Bb4 14. +Nc4 Qc7 15. O-O Nbd7 16. d4 Bxc3 17. Bxc3 Nd5 18. Bb2 Nxf4 19. Qe3 Ng6 20. +Rf3 Nf6 21. Ne5 Nd5 22. Qe4 Nf6 23. Qe3 Nd5 24. Qe4 Rad8 25. Raf1 Nf6 26. +Qe3 Nxe5 27. dxe5 Nd5 28. Qf2 Rd7 29. a3 a6 30. c4 Nb6 31. Bc1 Rfd8 32. Rg3 +g6 33. Bg5 Qxe5 34. Bxd8 Rxd8 35. Qxb6 Rd7 36. Re3 Qb2 37. Qb4 Qd4 38. Qc3 +Qd6 39. Qd3 Qxd3 40. Rxd3 Rxd3 41. Rf3 Rxf3 42. gxf3 Kg7 43. Kf2 Kf6 44. +Ke3 Kf5 45. f4 f6 46. b4 e5 0-1 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/fj6xrbnm"] +[Date "????.??.??"] +[Round "?"] +[White "Batalha"] +[Black "chess345"] +[Result "0-1"] +[WhiteElo "1244"] +[BlackElo "1857"] +[ECO "A15"] +[Opening "English Opening: Anglo-Indian Defense"] +[TimeControl "120+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:45:26"] +[Termination "Time forfeit"] +[WhiteRatingDiff "-1"] +[BlackRatingDiff "+6"] + +1. c4 Nf6 2. f3 g6 3. Nc3 Bg7 4. e3 d6 5. d4 O-O 6. Bd3 c5 7. d5 e6 8. e4 +exd5 9. cxd5 Re8 10. Nge2 Nh5 11. O-O Nd7 12. Bb5 a6 13. Bxd7 Bxd7 14. a4 +b5 15. axb5 axb5 16. Rxa8 Qxa8 17. Bf4 b4 18. Nb1 Be5 19. Bxe5 Rxe5 20. Nd2 +Bb5 21. b3 Qa6 22. Nc4 Bxc4 23. bxc4 Qxc4 24. Kh1 g5 25. g4 Ng7 26. Qa1 h5 +27. gxh5 Nxh5 28. Ng3 Nxg3+ 29. hxg3 Qe2 30. Qa8+ Kg7 31. Rg1 Qxf3+ 32. Rg2 +g4 0-1 + +[Event "Rated Classical game"] +[Site "https://lichess.org/i5a89m1j"] +[Date "????.??.??"] +[Round "?"] +[White "Mariss"] +[Black "tarasss"] +[Result "1-0"] +[WhiteElo "1898"] +[BlackElo "1496"] +[ECO "C67"] +[Opening "Ruy Lopez: Berlin Defense, Rio Gambit Accepted"] +[TimeControl "660+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:46:35"] +[Termination "Normal"] +[WhiteRatingDiff "+2"] +[BlackRatingDiff "-2"] + +1. e4 e5 2. Nf3 Nc6 3. Bb5 Nf6 4. O-O Nxe4 5. Re1 d5 6. d3 a6 7. Bxc6+ bxc6 +8. dxe4 Bc5 9. exd5 Qf6 10. Rxe5+ Be7 11. Bg5 Qf4 12. Bxf4 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/xfnan2k5"] +[Date "????.??.??"] +[Round "?"] +[White "1000"] +[Black "giao"] +[Result "1-0"] +[WhiteElo "1656"] +[BlackElo "1431"] +[ECO "A01"] +[Opening "Nimzo-Larsen Attack: Spike Variation"] +[TimeControl "0+1"] +[UTCDate "2012.12.31"] +[UTCTime "23:46:36"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+6"] +[BlackRatingDiff "-5"] + +1. b3 g6 2. Bb2 Nf6 3. g4 b6 4. g5 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/x0ekc8d4"] +[Date "????.??.??"] +[Round "?"] +[White "Boss92"] +[Black "Gardo"] +[Result "1-0"] +[WhiteElo "1503"] +[BlackElo "1624"] +[ECO "A01"] +[Opening "Nimzo-Larsen Attack: English Variation"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:46:38"] +[Termination "Normal"] +[WhiteRatingDiff "+15"] +[BlackRatingDiff "-16"] + +1. b3 c5 2. Bb2 d6 3. d3 f6 4. Nd2 e5 5. c4 Bd7 6. f3 Be7 7. h3 Nh6 8. Qc2 +Nf5 9. O-O-O Bf8 10. Ne4 Ne7 11. Nxd6# 1-0 + +[Event "Rated Classical game"] +[Site "https://lichess.org/wb4ea59s"] +[Date "????.??.??"] +[Round "?"] +[White "metrolog"] +[Black "vadi"] +[Result "1-0"] +[WhiteElo "1638"] +[BlackElo "1795"] +[ECO "D35"] +[Opening "Queen's Gambit Declined: Normal Defense"] +[TimeControl "180+15"] +[UTCDate "2012.12.31"] +[UTCTime "23:46:41"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+16"] +[BlackRatingDiff "-18"] + +1. d4 d5 2. c4 Nf6 3. Nc3 e6 4. a3 Be7 5. c5 O-O 6. Bf4 Nc6 7. Nb5 a6 8. +Nxc7 Ra7 9. e3 Nh5 10. Qxh5 g6 11. Qh3 1-0 + +[Event "Rated Bullet game"] +[Site "https://lichess.org/4snemu9c"] +[Date "????.??.??"] +[Round "?"] +[White "schutzstaffel"] +[Black "giao"] +[Result "1-0"] +[WhiteElo "1827"] +[BlackElo "1426"] +[ECO "B06"] +[Opening "Modern Defense: Geller's System"] +[TimeControl "60+0"] +[UTCDate "2012.12.31"] +[UTCTime "23:46:57"] +[Termination "Time forfeit"] +[WhiteRatingDiff "+3"] +[BlackRatingDiff "-3"] + +1. e4 g6 2. Nf3 Bg7 3. c3 d6 4. d4 Nf6 5. Bd3 O-O 6. Nbd2 Bg4 7. O-O c5 8. +d5 Nbd7 9. Qc2 b5 10. b3 Bxf3 11. Nxf3 a6 12. Bb2 Re8 13. c4 bxc4 14. Bxc4 +e5 15. dxe6 fxe6 16. Rae1 d5 17. exd5 exd5 18. Rxe8+ Qxe8 19. Re1 Qd8 20. +Bxf6 Bxf6 21. Bxd5+ Kg7 22. Bc4 Nb6 23. Qe2 Ra7 24. Qe6 Rd7 25. h4 Nxc4 26. +Qxc4 Rd1 27. Rxd1 Qxd1+ 28. Kh2 1-0 + diff --git a/node_modules/chess.js/dist/cjs/chess.js b/node_modules/chess.js/dist/cjs/chess.js new file mode 100644 index 0000000..92c52a5 --- /dev/null +++ b/node_modules/chess.js/dist/cjs/chess.js @@ -0,0 +1,3384 @@ +'use strict'; + +// @generated by Peggy 4.2.0. +// +// https://peggyjs.org/ + + + + function rootNode(comment) { + return comment !== null ? { comment, variations: [] } : { variations: []} + } + + function node(move, suffix, nag, comment, variations) { + const node = { move, variations }; + + if (suffix) { + node.suffix = suffix; + } + + if (nag) { + node.nag = nag; + } + + if (comment !== null) { + node.comment = comment; + } + + return node + } + + function lineToTree(...nodes) { + const [root, ...rest] = nodes; + + let parent = root; + + for (const child of rest) { + if (child !== null) { + parent.variations = [child, ...child.variations]; + child.variations = []; + parent = child; + } + } + + return root + } + + function pgn(headers, game) { + if (game.marker && game.marker.comment) { + let node = game.root; + while (true) { + const next = node.variations[0]; + if (!next) { + node.comment = game.marker.comment; + break + } + node = next; + } + } + + return { + headers, + root: game.root, + result: (game.marker && game.marker.result) ?? undefined + } + } + +function peg$subclass(child, parent) { + function C() { this.constructor = child; } + C.prototype = parent.prototype; + child.prototype = new C(); +} + +function peg$SyntaxError(message, expected, found, location) { + var self = Error.call(this, message); + // istanbul ignore next Check is a necessary evil to support older environments + if (Object.setPrototypeOf) { + Object.setPrototypeOf(self, peg$SyntaxError.prototype); + } + self.expected = expected; + self.found = found; + self.location = location; + self.name = "SyntaxError"; + return self; +} + +peg$subclass(peg$SyntaxError, Error); + +function peg$padEnd(str, targetLength, padString) { + padString = padString || " "; + if (str.length > targetLength) { return str; } + targetLength -= str.length; + padString += padString.repeat(targetLength); + return str + padString.slice(0, targetLength); +} + +peg$SyntaxError.prototype.format = function(sources) { + var str = "Error: " + this.message; + if (this.location) { + var src = null; + var k; + for (k = 0; k < sources.length; k++) { + if (sources[k].source === this.location.source) { + src = sources[k].text.split(/\r\n|\n|\r/g); + break; + } + } + var s = this.location.start; + var offset_s = (this.location.source && (typeof this.location.source.offset === "function")) + ? this.location.source.offset(s) + : s; + var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column; + if (src) { + var e = this.location.end; + var filler = peg$padEnd("", offset_s.line.toString().length, ' '); + var line = src[s.line - 1]; + var last = s.line === e.line ? e.column : line.length + 1; + var hatLen = (last - s.column) || 1; + str += "\n --> " + loc + "\n" + + filler + " |\n" + + offset_s.line + " | " + line + "\n" + + filler + " | " + peg$padEnd("", s.column - 1, ' ') + + peg$padEnd("", hatLen, "^"); + } else { + str += "\n at " + loc; + } + } + return str; +}; + +peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + + class: function(expectation) { + var escapedParts = expectation.parts.map(function(part) { + return Array.isArray(part) + ? classEscape(part[0]) + "-" + classEscape(part[1]) + : classEscape(part); + }); + + return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]"; + }, + + any: function() { + return "any character"; + }, + + end: function() { + return "end of input"; + }, + + other: function(expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + function literalEscape(s) { + return s + .replace(/\\/g, "\\\\") + .replace(/"/g, "\\\"") + .replace(/\0/g, "\\0") + .replace(/\t/g, "\\t") + .replace(/\n/g, "\\n") + .replace(/\r/g, "\\r") + .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); + } + + function classEscape(s) { + return s + .replace(/\\/g, "\\\\") + .replace(/\]/g, "\\]") + .replace(/\^/g, "\\^") + .replace(/-/g, "\\-") + .replace(/\0/g, "\\0") + .replace(/\t/g, "\\t") + .replace(/\n/g, "\\n") + .replace(/\r/g, "\\r") + .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = expected.map(describeExpectation); + var i, j; + + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + descriptions.length = j; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; +}; + +function peg$parse(input, options) { + options = options !== undefined ? options : {}; + + var peg$FAILED = {}; + var peg$source = options.grammarSource; + + var peg$startRuleFunctions = { pgn: peg$parsepgn }; + var peg$startRuleFunction = peg$parsepgn; + + var peg$c0 = "["; + var peg$c1 = "\""; + var peg$c2 = "]"; + var peg$c3 = "."; + var peg$c4 = "O-O-O"; + var peg$c5 = "O-O"; + var peg$c6 = "0-0-0"; + var peg$c7 = "0-0"; + var peg$c8 = "$"; + var peg$c9 = "{"; + var peg$c10 = "}"; + var peg$c11 = ";"; + var peg$c12 = "("; + var peg$c13 = ")"; + var peg$c14 = "1-0"; + var peg$c15 = "0-1"; + var peg$c16 = "1/2-1/2"; + var peg$c17 = "*"; + + var peg$r0 = /^[a-zA-Z]/; + var peg$r1 = /^[^"]/; + var peg$r2 = /^[0-9]/; + var peg$r3 = /^[.]/; + var peg$r4 = /^[a-zA-Z1-8\-=]/; + var peg$r5 = /^[+#]/; + var peg$r6 = /^[!?]/; + var peg$r7 = /^[^}]/; + var peg$r8 = /^[^\r\n]/; + var peg$r9 = /^[ \t\r\n]/; + + var peg$e0 = peg$otherExpectation("tag pair"); + var peg$e1 = peg$literalExpectation("[", false); + var peg$e2 = peg$literalExpectation("\"", false); + var peg$e3 = peg$literalExpectation("]", false); + var peg$e4 = peg$otherExpectation("tag name"); + var peg$e5 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false); + var peg$e6 = peg$otherExpectation("tag value"); + var peg$e7 = peg$classExpectation(["\""], true, false); + var peg$e8 = peg$otherExpectation("move number"); + var peg$e9 = peg$classExpectation([["0", "9"]], false, false); + var peg$e10 = peg$literalExpectation(".", false); + var peg$e11 = peg$classExpectation(["."], false, false); + var peg$e12 = peg$otherExpectation("standard algebraic notation"); + var peg$e13 = peg$literalExpectation("O-O-O", false); + var peg$e14 = peg$literalExpectation("O-O", false); + var peg$e15 = peg$literalExpectation("0-0-0", false); + var peg$e16 = peg$literalExpectation("0-0", false); + var peg$e17 = peg$classExpectation([["a", "z"], ["A", "Z"], ["1", "8"], "-", "="], false, false); + var peg$e18 = peg$classExpectation(["+", "#"], false, false); + var peg$e19 = peg$otherExpectation("suffix annotation"); + var peg$e20 = peg$classExpectation(["!", "?"], false, false); + var peg$e21 = peg$otherExpectation("NAG"); + var peg$e22 = peg$literalExpectation("$", false); + var peg$e23 = peg$otherExpectation("brace comment"); + var peg$e24 = peg$literalExpectation("{", false); + var peg$e25 = peg$classExpectation(["}"], true, false); + var peg$e26 = peg$literalExpectation("}", false); + var peg$e27 = peg$otherExpectation("rest of line comment"); + var peg$e28 = peg$literalExpectation(";", false); + var peg$e29 = peg$classExpectation(["\r", "\n"], true, false); + var peg$e30 = peg$otherExpectation("variation"); + var peg$e31 = peg$literalExpectation("(", false); + var peg$e32 = peg$literalExpectation(")", false); + var peg$e33 = peg$otherExpectation("game termination marker"); + var peg$e34 = peg$literalExpectation("1-0", false); + var peg$e35 = peg$literalExpectation("0-1", false); + var peg$e36 = peg$literalExpectation("1/2-1/2", false); + var peg$e37 = peg$literalExpectation("*", false); + var peg$e38 = peg$otherExpectation("whitespace"); + var peg$e39 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false); + + var peg$f0 = function(headers, game) { return pgn(headers, game) }; + var peg$f1 = function(tagPairs) { return Object.fromEntries(tagPairs) }; + var peg$f2 = function(tagName, tagValue) { return [tagName, tagValue] }; + var peg$f3 = function(root, marker) { return { root, marker} }; + var peg$f4 = function(comment, moves) { return lineToTree(rootNode(comment), ...moves.flat()) }; + var peg$f5 = function(san, suffix, nag, comment, variations) { return node(san, suffix, nag, comment, variations) }; + var peg$f6 = function(nag) { return nag }; + var peg$f7 = function(comment) { return comment.replace(/[\r\n]+/g, " ") }; + var peg$f8 = function(comment) { return comment.trim() }; + var peg$f9 = function(line) { return line }; + var peg$f10 = function(result, comment) { return { result, comment } }; + var peg$currPos = options.peg$currPos | 0; + var peg$posDetailsCache = [{ line: 1, column: 1 }]; + var peg$maxFailPos = peg$currPos; + var peg$maxFailExpected = options.peg$maxFailExpected || []; + var peg$silentFails = options.peg$silentFails | 0; + + var peg$result; + + if (options.startRule) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function peg$literalExpectation(text, ignoreCase) { + return { type: "literal", text: text, ignoreCase: ignoreCase }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } + + function peg$endExpectation() { + return { type: "end" }; + } + + function peg$otherExpectation(description) { + return { type: "other", description: description }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos]; + var p; + + if (details) { + return details; + } else { + if (pos >= peg$posDetailsCache.length) { + p = peg$posDetailsCache.length - 1; + } else { + p = pos; + while (!peg$posDetailsCache[--p]) {} + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; + } + + peg$posDetailsCache[pos] = details; + + return details; + } + } + + function peg$computeLocation(startPos, endPos, offset) { + var startPosDetails = peg$computePosDetails(startPos); + var endPosDetails = peg$computePosDetails(endPos); + + var res = { + source: peg$source, + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + return res; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parsepgn() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parsetagPairSection(); + s2 = peg$parsemoveTextSection(); + s0 = peg$f0(s1, s2); + + return s0; + } + + function peg$parsetagPairSection() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = []; + s2 = peg$parsetagPair(); + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parsetagPair(); + } + s2 = peg$parse_(); + s0 = peg$f1(s1); + + return s0; + } + + function peg$parsetagPair() { + var s0, s2, s4, s6, s7, s8, s10; + + peg$silentFails++; + s0 = peg$currPos; + peg$parse_(); + if (input.charCodeAt(peg$currPos) === 91) { + s2 = peg$c0; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e1); } + } + if (s2 !== peg$FAILED) { + peg$parse_(); + s4 = peg$parsetagName(); + if (s4 !== peg$FAILED) { + peg$parse_(); + if (input.charCodeAt(peg$currPos) === 34) { + s6 = peg$c1; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e2); } + } + if (s6 !== peg$FAILED) { + s7 = peg$parsetagValue(); + if (input.charCodeAt(peg$currPos) === 34) { + s8 = peg$c1; + peg$currPos++; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e2); } + } + if (s8 !== peg$FAILED) { + peg$parse_(); + if (input.charCodeAt(peg$currPos) === 93) { + s10 = peg$c2; + peg$currPos++; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e3); } + } + if (s10 !== peg$FAILED) { + s0 = peg$f2(s4, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + if (peg$silentFails === 0) { peg$fail(peg$e0); } + } + + return s0; + } + + function peg$parsetagName() { + var s0, s1, s2; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = input.charAt(peg$currPos); + if (peg$r0.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e5); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = input.charAt(peg$currPos); + if (peg$r0.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e5); } + } + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s0 = input.substring(s0, peg$currPos); + } else { + s0 = s1; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e4); } + } + + return s0; + } + + function peg$parsetagValue() { + var s0, s1, s2; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = input.charAt(peg$currPos); + if (peg$r1.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e7); } + } + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = input.charAt(peg$currPos); + if (peg$r1.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e7); } + } + } + s0 = input.substring(s0, peg$currPos); + peg$silentFails--; + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e6); } + + return s0; + } + + function peg$parsemoveTextSection() { + var s0, s1, s3; + + s0 = peg$currPos; + s1 = peg$parseline(); + peg$parse_(); + s3 = peg$parsegameTerminationMarker(); + if (s3 === peg$FAILED) { + s3 = null; + } + peg$parse_(); + s0 = peg$f3(s1, s3); + + return s0; + } + + function peg$parseline() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsecomment(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = []; + s3 = peg$parsemove(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parsemove(); + } + s0 = peg$f4(s1, s2); + + return s0; + } + + function peg$parsemove() { + var s0, s4, s5, s6, s7, s8, s9, s10; + + s0 = peg$currPos; + peg$parse_(); + peg$parsemoveNumber(); + peg$parse_(); + s4 = peg$parsesan(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesuffixAnnotation(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = []; + s7 = peg$parsenag(); + while (s7 !== peg$FAILED) { + s6.push(s7); + s7 = peg$parsenag(); + } + s7 = peg$parse_(); + s8 = peg$parsecomment(); + if (s8 === peg$FAILED) { + s8 = null; + } + s9 = []; + s10 = peg$parsevariation(); + while (s10 !== peg$FAILED) { + s9.push(s10); + s10 = peg$parsevariation(); + } + s0 = peg$f5(s4, s5, s6, s8, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsemoveNumber() { + var s0, s1, s2, s3, s4, s5; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = input.charAt(peg$currPos); + if (peg$r2.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = input.charAt(peg$currPos); + if (peg$r2.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + } + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c3; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e10); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = []; + s5 = input.charAt(peg$currPos); + if (peg$r3.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e11); } + } + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = input.charAt(peg$currPos); + if (peg$r3.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e11); } + } + } + s1 = [s1, s2, s3, s4]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e8); } + } + + return s0; + } + + function peg$parsesan() { + var s0, s1, s2, s3, s4, s5; + + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c4) { + s2 = peg$c4; + peg$currPos += 5; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e13); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c5) { + s2 = peg$c5; + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e14); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 5) === peg$c6) { + s2 = peg$c6; + peg$currPos += 5; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e15); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c7) { + s2 = peg$c7; + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e16); } + } + if (s2 === peg$FAILED) { + s2 = peg$currPos; + s3 = input.charAt(peg$currPos); + if (peg$r0.test(s3)) { + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e5); } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = input.charAt(peg$currPos); + if (peg$r4.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e17); } + } + if (s5 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = input.charAt(peg$currPos); + if (peg$r4.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e17); } + } + } + } else { + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s3 = [s3, s4]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } + } + } + } + if (s2 !== peg$FAILED) { + s3 = input.charAt(peg$currPos); + if (peg$r5.test(s3)) { + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e18); } + } + if (s3 === peg$FAILED) { + s3 = null; + } + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s0 = input.substring(s0, peg$currPos); + } else { + s0 = s1; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e12); } + } + + return s0; + } + + function peg$parsesuffixAnnotation() { + var s0, s1, s2; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = input.charAt(peg$currPos); + if (peg$r6.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e20); } + } + while (s2 !== peg$FAILED) { + s1.push(s2); + if (s1.length >= 2) { + s2 = peg$FAILED; + } else { + s2 = input.charAt(peg$currPos); + if (peg$r6.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e20); } + } + } + } + if (s1.length < 1) { + peg$currPos = s0; + s0 = peg$FAILED; + } else { + s0 = s1; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e19); } + } + + return s0; + } + + function peg$parsenag() { + var s0, s2, s3, s4, s5; + + peg$silentFails++; + s0 = peg$currPos; + peg$parse_(); + if (input.charCodeAt(peg$currPos) === 36) { + s2 = peg$c8; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e22); } + } + if (s2 !== peg$FAILED) { + s3 = peg$currPos; + s4 = []; + s5 = input.charAt(peg$currPos); + if (peg$r2.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + if (s5 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = input.charAt(peg$currPos); + if (peg$r2.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + } + } else { + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s3 = input.substring(s3, peg$currPos); + } else { + s3 = s4; + } + if (s3 !== peg$FAILED) { + s0 = peg$f6(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + if (peg$silentFails === 0) { peg$fail(peg$e21); } + } + + return s0; + } + + function peg$parsecomment() { + var s0; + + s0 = peg$parsebraceComment(); + if (s0 === peg$FAILED) { + s0 = peg$parserestOfLineComment(); + } + + return s0; + } + + function peg$parsebraceComment() { + var s0, s1, s2, s3, s4; + + peg$silentFails++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 123) { + s1 = peg$c9; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e24); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = []; + s4 = input.charAt(peg$currPos); + if (peg$r7.test(s4)) { + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e25); } + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = input.charAt(peg$currPos); + if (peg$r7.test(s4)) { + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e25); } + } + } + s2 = input.substring(s2, peg$currPos); + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c10; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e26); } + } + if (s3 !== peg$FAILED) { + s0 = peg$f7(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e23); } + } + + return s0; + } + + function peg$parserestOfLineComment() { + var s0, s1, s2, s3, s4; + + peg$silentFails++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 59) { + s1 = peg$c11; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e28); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = []; + s4 = input.charAt(peg$currPos); + if (peg$r8.test(s4)) { + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e29); } + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = input.charAt(peg$currPos); + if (peg$r8.test(s4)) { + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e29); } + } + } + s2 = input.substring(s2, peg$currPos); + s0 = peg$f8(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e27); } + } + + return s0; + } + + function peg$parsevariation() { + var s0, s2, s3, s5; + + peg$silentFails++; + s0 = peg$currPos; + peg$parse_(); + if (input.charCodeAt(peg$currPos) === 40) { + s2 = peg$c12; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e31); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseline(); + if (s3 !== peg$FAILED) { + peg$parse_(); + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c13; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e32); } + } + if (s5 !== peg$FAILED) { + s0 = peg$f9(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + if (peg$silentFails === 0) { peg$fail(peg$e30); } + } + + return s0; + } + + function peg$parsegameTerminationMarker() { + var s0, s1, s3; + + peg$silentFails++; + s0 = peg$currPos; + if (input.substr(peg$currPos, 3) === peg$c14) { + s1 = peg$c14; + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e34); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c15) { + s1 = peg$c15; + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e35); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7) === peg$c16) { + s1 = peg$c16; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e36); } + } + if (s1 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c17; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e37); } + } + } + } + } + if (s1 !== peg$FAILED) { + peg$parse_(); + s3 = peg$parsecomment(); + if (s3 === peg$FAILED) { + s3 = null; + } + s0 = peg$f10(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e33); } + } + + return s0; + } + + function peg$parse_() { + var s0, s1; + + peg$silentFails++; + s0 = []; + s1 = input.charAt(peg$currPos); + if (peg$r9.test(s1)) { + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e39); } + } + while (s1 !== peg$FAILED) { + s0.push(s1); + s1 = input.charAt(peg$currPos); + if (peg$r9.test(s1)) { + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e39); } + } + } + peg$silentFails--; + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e38); } + + return s0; + } + + peg$result = peg$startRuleFunction(); + + if (options.peg$library) { + return /** @type {any} */ ({ + peg$result, + peg$currPos, + peg$FAILED, + peg$maxFailExpected, + peg$maxFailPos + }); + } + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + + throw peg$buildStructuredError( + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); + } +} + +/** + * @license + * Copyright (c) 2025, Jeff Hlywa (jhlywa@gmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +const MASK64 = 0xffffffffffffffffn; +function rotl(x, k) { + return ((x << k) | (x >> (64n - k))) & 0xffffffffffffffffn; +} +function wrappingMul(x, y) { + return (x * y) & MASK64; +} +// xoroshiro128** +function xoroshiro128(state) { + return function () { + let s0 = BigInt(state & MASK64); + let s1 = BigInt((state >> 64n) & MASK64); + const result = wrappingMul(rotl(wrappingMul(s0, 5n), 7n), 9n); + s1 ^= s0; + s0 = (rotl(s0, 24n) ^ s1 ^ (s1 << 16n)) & MASK64; + s1 = rotl(s1, 37n); + state = (s1 << 64n) | s0; + return result; + }; +} +const rand = xoroshiro128(0xa187eb39cdcaed8f31c4b365b102e01en); +const PIECE_KEYS = Array.from({ length: 2 }, () => Array.from({ length: 6 }, () => Array.from({ length: 128 }, () => rand()))); +const EP_KEYS = Array.from({ length: 8 }, () => rand()); +const CASTLING_KEYS = Array.from({ length: 16 }, () => rand()); +const SIDE_KEY = rand(); +const WHITE = 'w'; +const BLACK = 'b'; +const PAWN = 'p'; +const KNIGHT = 'n'; +const BISHOP = 'b'; +const ROOK = 'r'; +const QUEEN = 'q'; +const KING = 'k'; +const DEFAULT_POSITION = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1'; +class Move { + color; + from; + to; + piece; + captured; + promotion; + /** + * @deprecated This field is deprecated and will be removed in version 2.0.0. + * Please use move descriptor functions instead: `isCapture`, `isPromotion`, + * `isEnPassant`, `isKingsideCastle`, `isQueensideCastle`, `isCastle`, and + * `isBigPawn` + */ + flags; + san; + lan; + before; + after; + constructor(chess, internal) { + const { color, piece, from, to, flags, captured, promotion } = internal; + const fromAlgebraic = algebraic(from); + const toAlgebraic = algebraic(to); + this.color = color; + this.piece = piece; + this.from = fromAlgebraic; + this.to = toAlgebraic; + /* + * HACK: The chess['_method']() calls below invoke private methods in the + * Chess class to generate SAN and FEN. It's a bit of a hack, but makes the + * code cleaner elsewhere. + */ + this.san = chess['_moveToSan'](internal, chess['_moves']({ legal: true })); + this.lan = fromAlgebraic + toAlgebraic; + this.before = chess.fen(); + // Generate the FEN for the 'after' key + chess['_makeMove'](internal); + this.after = chess.fen(); + chess['_undoMove'](); + // Build the text representation of the move flags + this.flags = ''; + for (const flag in BITS) { + if (BITS[flag] & flags) { + this.flags += FLAGS[flag]; + } + } + if (captured) { + this.captured = captured; + } + if (promotion) { + this.promotion = promotion; + this.lan += promotion; + } + } + isCapture() { + return this.flags.indexOf(FLAGS['CAPTURE']) > -1; + } + isPromotion() { + return this.flags.indexOf(FLAGS['PROMOTION']) > -1; + } + isEnPassant() { + return this.flags.indexOf(FLAGS['EP_CAPTURE']) > -1; + } + isKingsideCastle() { + return this.flags.indexOf(FLAGS['KSIDE_CASTLE']) > -1; + } + isQueensideCastle() { + return this.flags.indexOf(FLAGS['QSIDE_CASTLE']) > -1; + } + isBigPawn() { + return this.flags.indexOf(FLAGS['BIG_PAWN']) > -1; + } +} +const EMPTY = -1; +const FLAGS = { + NORMAL: 'n', + CAPTURE: 'c', + BIG_PAWN: 'b', + EP_CAPTURE: 'e', + PROMOTION: 'p', + KSIDE_CASTLE: 'k', + QSIDE_CASTLE: 'q', + NULL_MOVE: '-', +}; +// prettier-ignore +const SQUARES = [ + 'a8', 'b8', 'c8', 'd8', 'e8', 'f8', 'g8', 'h8', + 'a7', 'b7', 'c7', 'd7', 'e7', 'f7', 'g7', 'h7', + 'a6', 'b6', 'c6', 'd6', 'e6', 'f6', 'g6', 'h6', + 'a5', 'b5', 'c5', 'd5', 'e5', 'f5', 'g5', 'h5', + 'a4', 'b4', 'c4', 'd4', 'e4', 'f4', 'g4', 'h4', + 'a3', 'b3', 'c3', 'd3', 'e3', 'f3', 'g3', 'h3', + 'a2', 'b2', 'c2', 'd2', 'e2', 'f2', 'g2', 'h2', + 'a1', 'b1', 'c1', 'd1', 'e1', 'f1', 'g1', 'h1' +]; +const BITS = { + NORMAL: 1, + CAPTURE: 2, + BIG_PAWN: 4, + EP_CAPTURE: 8, + PROMOTION: 16, + KSIDE_CASTLE: 32, + QSIDE_CASTLE: 64, + NULL_MOVE: 128, +}; +/* eslint-disable @typescript-eslint/naming-convention */ +// these are required, according to spec +const SEVEN_TAG_ROSTER = { + Event: '?', + Site: '?', + Date: '????.??.??', + Round: '?', + White: '?', + Black: '?', + Result: '*', +}; +/** + * These nulls are placeholders to fix the order of tags (as they appear in PGN spec); null values will be + * eliminated in getHeaders() + */ +const SUPLEMENTAL_TAGS = { + WhiteTitle: null, + BlackTitle: null, + WhiteElo: null, + BlackElo: null, + WhiteUSCF: null, + BlackUSCF: null, + WhiteNA: null, + BlackNA: null, + WhiteType: null, + BlackType: null, + EventDate: null, + EventSponsor: null, + Section: null, + Stage: null, + Board: null, + Opening: null, + Variation: null, + SubVariation: null, + ECO: null, + NIC: null, + Time: null, + UTCTime: null, + UTCDate: null, + TimeControl: null, + SetUp: null, + FEN: null, + Termination: null, + Annotator: null, + Mode: null, + PlyCount: null, +}; +const HEADER_TEMPLATE = { + ...SEVEN_TAG_ROSTER, + ...SUPLEMENTAL_TAGS, +}; +/* eslint-enable @typescript-eslint/naming-convention */ +/* + * NOTES ABOUT 0x88 MOVE GENERATION ALGORITHM + * ---------------------------------------------------------------------------- + * From https://github.com/jhlywa/chess.js/issues/230 + * + * A lot of people are confused when they first see the internal representation + * of chess.js. It uses the 0x88 Move Generation Algorithm which internally + * stores the board as an 8x16 array. This is purely for efficiency but has a + * couple of interesting benefits: + * + * 1. 0x88 offers a very inexpensive "off the board" check. Bitwise AND (&) any + * square with 0x88, if the result is non-zero then the square is off the + * board. For example, assuming a knight square A8 (0 in 0x88 notation), + * there are 8 possible directions in which the knight can move. These + * directions are relative to the 8x16 board and are stored in the + * PIECE_OFFSETS map. One possible move is A8 - 18 (up one square, and two + * squares to the left - which is off the board). 0 - 18 = -18 & 0x88 = 0x88 + * (because of two-complement representation of -18). The non-zero result + * means the square is off the board and the move is illegal. Take the + * opposite move (from A8 to C7), 0 + 18 = 18 & 0x88 = 0. A result of zero + * means the square is on the board. + * + * 2. The relative distance (or difference) between two squares on a 8x16 board + * is unique and can be used to inexpensively determine if a piece on a + * square can attack any other arbitrary square. For example, let's see if a + * pawn on E7 can attack E2. The difference between E7 (20) - E2 (100) is + * -80. We add 119 to make the ATTACKS array index non-negative (because the + * worst case difference is A8 - H1 = -119). The ATTACKS array contains a + * bitmask of pieces that can attack from that distance and direction. + * ATTACKS[-80 + 119=39] gives us 24 or 0b11000 in binary. Look at the + * PIECE_MASKS map to determine the mask for a given piece type. In our pawn + * example, we would check to see if 24 & 0x1 is non-zero, which it is + * not. So, naturally, a pawn on E7 can't attack a piece on E2. However, a + * rook can since 24 & 0x8 is non-zero. The only thing left to check is that + * there are no blocking pieces between E7 and E2. That's where the RAYS + * array comes in. It provides an offset (in this case 16) to add to E7 (20) + * to check for blocking pieces. E7 (20) + 16 = E6 (36) + 16 = E5 (52) etc. + */ +// prettier-ignore +// eslint-disable-next-line +const Ox88 = { + a8: 0, b8: 1, c8: 2, d8: 3, e8: 4, f8: 5, g8: 6, h8: 7, + a7: 16, b7: 17, c7: 18, d7: 19, e7: 20, f7: 21, g7: 22, h7: 23, + a6: 32, b6: 33, c6: 34, d6: 35, e6: 36, f6: 37, g6: 38, h6: 39, + a5: 48, b5: 49, c5: 50, d5: 51, e5: 52, f5: 53, g5: 54, h5: 55, + a4: 64, b4: 65, c4: 66, d4: 67, e4: 68, f4: 69, g4: 70, h4: 71, + a3: 80, b3: 81, c3: 82, d3: 83, e3: 84, f3: 85, g3: 86, h3: 87, + a2: 96, b2: 97, c2: 98, d2: 99, e2: 100, f2: 101, g2: 102, h2: 103, + a1: 112, b1: 113, c1: 114, d1: 115, e1: 116, f1: 117, g1: 118, h1: 119 +}; +const PAWN_OFFSETS = { + b: [16, 32, 17, 15], + w: [-16, -32, -17, -15], +}; +const PIECE_OFFSETS = { + n: [-18, -33, -31, -14, 18, 33, 31, 14], + b: [-17, -15, 17, 15], + r: [-16, 1, 16, -1], + q: [-17, -16, -15, 1, 17, 16, 15, -1], + k: [-17, -16, -15, 1, 17, 16, 15, -1], +}; +// prettier-ignore +const ATTACKS = [ + 20, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 20, 0, + 0, 20, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 20, 0, 0, + 0, 0, 20, 0, 0, 0, 0, 24, 0, 0, 0, 0, 20, 0, 0, 0, + 0, 0, 0, 20, 0, 0, 0, 24, 0, 0, 0, 20, 0, 0, 0, 0, + 0, 0, 0, 0, 20, 0, 0, 24, 0, 0, 20, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 20, 2, 24, 2, 20, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2, 53, 56, 53, 2, 0, 0, 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 56, 0, 56, 24, 24, 24, 24, 24, 24, 0, + 0, 0, 0, 0, 0, 2, 53, 56, 53, 2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 20, 2, 24, 2, 20, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 20, 0, 0, 24, 0, 0, 20, 0, 0, 0, 0, 0, + 0, 0, 0, 20, 0, 0, 0, 24, 0, 0, 0, 20, 0, 0, 0, 0, + 0, 0, 20, 0, 0, 0, 0, 24, 0, 0, 0, 0, 20, 0, 0, 0, + 0, 20, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 20, 0, 0, + 20, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 20 +]; +// prettier-ignore +const RAYS = [ + 17, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 15, 0, + 0, 17, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 15, 0, 0, + 0, 0, 17, 0, 0, 0, 0, 16, 0, 0, 0, 0, 15, 0, 0, 0, + 0, 0, 0, 17, 0, 0, 0, 16, 0, 0, 0, 15, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 0, 0, 16, 0, 0, 15, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 17, 0, 16, 0, 15, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 17, 16, 15, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 0, -1, -1, -1, -1, -1, -1, -1, 0, + 0, 0, 0, 0, 0, 0, -15, -16, -17, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -15, 0, -16, 0, -17, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -15, 0, 0, -16, 0, 0, -17, 0, 0, 0, 0, 0, + 0, 0, 0, -15, 0, 0, 0, -16, 0, 0, 0, -17, 0, 0, 0, 0, + 0, 0, -15, 0, 0, 0, 0, -16, 0, 0, 0, 0, -17, 0, 0, 0, + 0, -15, 0, 0, 0, 0, 0, -16, 0, 0, 0, 0, 0, -17, 0, 0, + -15, 0, 0, 0, 0, 0, 0, -16, 0, 0, 0, 0, 0, 0, -17 +]; +const PIECE_MASKS = { p: 0x1, n: 0x2, b: 0x4, r: 0x8, q: 0x10, k: 0x20 }; +const SYMBOLS = 'pnbrqkPNBRQK'; +const PROMOTIONS = [KNIGHT, BISHOP, ROOK, QUEEN]; +const RANK_1 = 7; +const RANK_2 = 6; +/* + * const RANK_3 = 5 + * const RANK_4 = 4 + * const RANK_5 = 3 + * const RANK_6 = 2 + */ +const RANK_7 = 1; +const RANK_8 = 0; +const SIDES = { + [KING]: BITS.KSIDE_CASTLE, + [QUEEN]: BITS.QSIDE_CASTLE, +}; +const ROOKS = { + w: [ + { square: Ox88.a1, flag: BITS.QSIDE_CASTLE }, + { square: Ox88.h1, flag: BITS.KSIDE_CASTLE }, + ], + b: [ + { square: Ox88.a8, flag: BITS.QSIDE_CASTLE }, + { square: Ox88.h8, flag: BITS.KSIDE_CASTLE }, + ], +}; +const SECOND_RANK = { b: RANK_7, w: RANK_2 }; +const SAN_NULLMOVE = '--'; +// Extracts the zero-based rank of an 0x88 square. +function rank(square) { + return square >> 4; +} +// Extracts the zero-based file of an 0x88 square. +function file(square) { + return square & 0xf; +} +function isDigit(c) { + return '0123456789'.indexOf(c) !== -1; +} +// Converts a 0x88 square to algebraic notation. +function algebraic(square) { + const f = file(square); + const r = rank(square); + return ('abcdefgh'.substring(f, f + 1) + + '87654321'.substring(r, r + 1)); +} +function swapColor(color) { + return color === WHITE ? BLACK : WHITE; +} +function validateFen(fen) { + // 1st criterion: 6 space-seperated fields? + const tokens = fen.split(/\s+/); + if (tokens.length !== 6) { + return { + ok: false, + error: 'Invalid FEN: must contain six space-delimited fields', + }; + } + // 2nd criterion: move number field is a integer value > 0? + const moveNumber = parseInt(tokens[5], 10); + if (isNaN(moveNumber) || moveNumber <= 0) { + return { + ok: false, + error: 'Invalid FEN: move number must be a positive integer', + }; + } + // 3rd criterion: half move counter is an integer >= 0? + const halfMoves = parseInt(tokens[4], 10); + if (isNaN(halfMoves) || halfMoves < 0) { + return { + ok: false, + error: 'Invalid FEN: half move counter number must be a non-negative integer', + }; + } + // 4th criterion: 4th field is a valid e.p.-string? + if (!/^(-|[abcdefgh][36])$/.test(tokens[3])) { + return { ok: false, error: 'Invalid FEN: en-passant square is invalid' }; + } + // 5th criterion: 3th field is a valid castle-string? + if (/[^kKqQ-]/.test(tokens[2])) { + return { ok: false, error: 'Invalid FEN: castling availability is invalid' }; + } + // 6th criterion: 2nd field is "w" (white) or "b" (black)? + if (!/^(w|b)$/.test(tokens[1])) { + return { ok: false, error: 'Invalid FEN: side-to-move is invalid' }; + } + // 7th criterion: 1st field contains 8 rows? + const rows = tokens[0].split('/'); + if (rows.length !== 8) { + return { + ok: false, + error: "Invalid FEN: piece data does not contain 8 '/'-delimited rows", + }; + } + // 8th criterion: every row is valid? + for (let i = 0; i < rows.length; i++) { + // check for right sum of fields AND not two numbers in succession + let sumFields = 0; + let previousWasNumber = false; + for (let k = 0; k < rows[i].length; k++) { + if (isDigit(rows[i][k])) { + if (previousWasNumber) { + return { + ok: false, + error: 'Invalid FEN: piece data is invalid (consecutive number)', + }; + } + sumFields += parseInt(rows[i][k], 10); + previousWasNumber = true; + } + else { + if (!/^[prnbqkPRNBQK]$/.test(rows[i][k])) { + return { + ok: false, + error: 'Invalid FEN: piece data is invalid (invalid piece)', + }; + } + sumFields += 1; + previousWasNumber = false; + } + } + if (sumFields !== 8) { + return { + ok: false, + error: 'Invalid FEN: piece data is invalid (too many squares in rank)', + }; + } + } + // 9th criterion: is en-passant square legal? + if ((tokens[3][1] == '3' && tokens[1] == 'w') || + (tokens[3][1] == '6' && tokens[1] == 'b')) { + return { ok: false, error: 'Invalid FEN: illegal en-passant square' }; + } + // 10th criterion: does chess position contain exact two kings? + const kings = [ + { color: 'white', regex: /K/g }, + { color: 'black', regex: /k/g }, + ]; + for (const { color, regex } of kings) { + if (!regex.test(tokens[0])) { + return { ok: false, error: `Invalid FEN: missing ${color} king` }; + } + if ((tokens[0].match(regex) || []).length > 1) { + return { ok: false, error: `Invalid FEN: too many ${color} kings` }; + } + } + // 11th criterion: are any pawns on the first or eighth rows? + if (Array.from(rows[0] + rows[7]).some((char) => char.toUpperCase() === 'P')) { + return { + ok: false, + error: 'Invalid FEN: some pawns are on the edge rows', + }; + } + return { ok: true }; +} +// this function is used to uniquely identify ambiguous moves +function getDisambiguator(move, moves) { + const from = move.from; + const to = move.to; + const piece = move.piece; + let ambiguities = 0; + let sameRank = 0; + let sameFile = 0; + for (let i = 0, len = moves.length; i < len; i++) { + const ambigFrom = moves[i].from; + const ambigTo = moves[i].to; + const ambigPiece = moves[i].piece; + /* + * if a move of the same piece type ends on the same to square, we'll need + * to add a disambiguator to the algebraic notation + */ + if (piece === ambigPiece && from !== ambigFrom && to === ambigTo) { + ambiguities++; + if (rank(from) === rank(ambigFrom)) { + sameRank++; + } + if (file(from) === file(ambigFrom)) { + sameFile++; + } + } + } + if (ambiguities > 0) { + if (sameRank > 0 && sameFile > 0) { + /* + * if there exists a similar moving piece on the same rank and file as + * the move in question, use the square as the disambiguator + */ + return algebraic(from); + } + else if (sameFile > 0) { + /* + * if the moving piece rests on the same file, use the rank symbol as the + * disambiguator + */ + return algebraic(from).charAt(1); + } + else { + // else use the file symbol + return algebraic(from).charAt(0); + } + } + return ''; +} +function addMove(moves, color, from, to, piece, captured = undefined, flags = BITS.NORMAL) { + const r = rank(to); + if (piece === PAWN && (r === RANK_1 || r === RANK_8)) { + for (let i = 0; i < PROMOTIONS.length; i++) { + const promotion = PROMOTIONS[i]; + moves.push({ + color, + from, + to, + piece, + captured, + promotion, + flags: flags | BITS.PROMOTION, + }); + } + } + else { + moves.push({ + color, + from, + to, + piece, + captured, + flags, + }); + } +} +function inferPieceType(san) { + let pieceType = san.charAt(0); + if (pieceType >= 'a' && pieceType <= 'h') { + const matches = san.match(/[a-h]\d.*[a-h]\d/); + if (matches) { + return undefined; + } + return PAWN; + } + pieceType = pieceType.toLowerCase(); + if (pieceType === 'o') { + return KING; + } + return pieceType; +} +// parses all of the decorators out of a SAN string +function strippedSan(move) { + return move.replace(/=/, '').replace(/[+#]?[?!]*$/, ''); +} +class Chess { + _board = new Array(128); + _turn = WHITE; + _header = {}; + _kings = { w: EMPTY, b: EMPTY }; + _epSquare = -1; + _halfMoves = 0; + _moveNumber = 0; + _history = []; + _comments = {}; + _castling = { w: 0, b: 0 }; + _hash = 0n; + // tracks number of times a position has been seen for repetition checking + _positionCount = new Map(); + constructor(fen = DEFAULT_POSITION, { skipValidation = false } = {}) { + this.load(fen, { skipValidation }); + } + clear({ preserveHeaders = false } = {}) { + this._board = new Array(128); + this._kings = { w: EMPTY, b: EMPTY }; + this._turn = WHITE; + this._castling = { w: 0, b: 0 }; + this._epSquare = EMPTY; + this._halfMoves = 0; + this._moveNumber = 1; + this._history = []; + this._comments = {}; + this._header = preserveHeaders ? this._header : { ...HEADER_TEMPLATE }; + this._hash = this._computeHash(); + this._positionCount = new Map(); + /* + * Delete the SetUp and FEN headers (if preserved), the board is empty and + * these headers don't make sense in this state. They'll get added later + * via .load() or .put() + */ + this._header['SetUp'] = null; + this._header['FEN'] = null; + } + load(fen, { skipValidation = false, preserveHeaders = false } = {}) { + let tokens = fen.split(/\s+/); + // append commonly omitted fen tokens + if (tokens.length >= 2 && tokens.length < 6) { + const adjustments = ['-', '-', '0', '1']; + fen = tokens.concat(adjustments.slice(-(6 - tokens.length))).join(' '); + } + tokens = fen.split(/\s+/); + if (!skipValidation) { + const { ok, error } = validateFen(fen); + if (!ok) { + throw new Error(error); + } + } + const position = tokens[0]; + let square = 0; + this.clear({ preserveHeaders }); + for (let i = 0; i < position.length; i++) { + const piece = position.charAt(i); + if (piece === '/') { + square += 8; + } + else if (isDigit(piece)) { + square += parseInt(piece, 10); + } + else { + const color = piece < 'a' ? WHITE : BLACK; + this._put({ type: piece.toLowerCase(), color }, algebraic(square)); + square++; + } + } + this._turn = tokens[1]; + if (tokens[2].indexOf('K') > -1) { + this._castling.w |= BITS.KSIDE_CASTLE; + } + if (tokens[2].indexOf('Q') > -1) { + this._castling.w |= BITS.QSIDE_CASTLE; + } + if (tokens[2].indexOf('k') > -1) { + this._castling.b |= BITS.KSIDE_CASTLE; + } + if (tokens[2].indexOf('q') > -1) { + this._castling.b |= BITS.QSIDE_CASTLE; + } + this._epSquare = tokens[3] === '-' ? EMPTY : Ox88[tokens[3]]; + this._halfMoves = parseInt(tokens[4], 10); + this._moveNumber = parseInt(tokens[5], 10); + this._hash = this._computeHash(); + this._updateSetup(fen); + this._incPositionCount(); + } + fen({ forceEnpassantSquare = false, } = {}) { + let empty = 0; + let fen = ''; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + if (this._board[i]) { + if (empty > 0) { + fen += empty; + empty = 0; + } + const { color, type: piece } = this._board[i]; + fen += color === WHITE ? piece.toUpperCase() : piece.toLowerCase(); + } + else { + empty++; + } + if ((i + 1) & 0x88) { + if (empty > 0) { + fen += empty; + } + if (i !== Ox88.h1) { + fen += '/'; + } + empty = 0; + i += 8; + } + } + let castling = ''; + if (this._castling[WHITE] & BITS.KSIDE_CASTLE) { + castling += 'K'; + } + if (this._castling[WHITE] & BITS.QSIDE_CASTLE) { + castling += 'Q'; + } + if (this._castling[BLACK] & BITS.KSIDE_CASTLE) { + castling += 'k'; + } + if (this._castling[BLACK] & BITS.QSIDE_CASTLE) { + castling += 'q'; + } + // do we have an empty castling flag? + castling = castling || '-'; + let epSquare = '-'; + /* + * only print the ep square if en passant is a valid move (pawn is present + * and ep capture is not pinned) + */ + if (this._epSquare !== EMPTY) { + if (forceEnpassantSquare) { + epSquare = algebraic(this._epSquare); + } + else { + const bigPawnSquare = this._epSquare + (this._turn === WHITE ? 16 : -16); + const squares = [bigPawnSquare + 1, bigPawnSquare - 1]; + for (const square of squares) { + // is the square off the board? + if (square & 0x88) { + continue; + } + const color = this._turn; + // is there a pawn that can capture the epSquare? + if (this._board[square]?.color === color && + this._board[square]?.type === PAWN) { + // if the pawn makes an ep capture, does it leave its king in check? + this._makeMove({ + color, + from: square, + to: this._epSquare, + piece: PAWN, + captured: PAWN, + flags: BITS.EP_CAPTURE, + }); + const isLegal = !this._isKingAttacked(color); + this._undoMove(); + // if ep is legal, break and set the ep square in the FEN output + if (isLegal) { + epSquare = algebraic(this._epSquare); + break; + } + } + } + } + } + return [ + fen, + this._turn, + castling, + epSquare, + this._halfMoves, + this._moveNumber, + ].join(' '); + } + _pieceKey(i) { + if (!this._board[i]) { + return 0n; + } + const { color, type } = this._board[i]; + const colorIndex = { + w: 0, + b: 1, + }[color]; + const typeIndex = { + p: 0, + n: 1, + b: 2, + r: 3, + q: 4, + k: 5, + }[type]; + return PIECE_KEYS[colorIndex][typeIndex][i]; + } + _epKey() { + return this._epSquare === EMPTY ? 0n : EP_KEYS[this._epSquare & 7]; + } + _castlingKey() { + const index = (this._castling.w >> 5) | (this._castling.b >> 3); + return CASTLING_KEYS[index]; + } + _computeHash() { + let hash = 0n; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + // did we run off the end of the board + if (i & 0x88) { + i += 7; + continue; + } + if (this._board[i]) { + hash ^= this._pieceKey(i); + } + } + hash ^= this._epKey(); + hash ^= this._castlingKey(); + if (this._turn === 'b') { + hash ^= SIDE_KEY; + } + return hash; + } + /* + * Called when the initial board setup is changed with put() or remove(). + * modifies the SetUp and FEN properties of the header object. If the FEN + * is equal to the default position, the SetUp and FEN are deleted the setup + * is only updated if history.length is zero, ie moves haven't been made. + */ + _updateSetup(fen) { + if (this._history.length > 0) + return; + if (fen !== DEFAULT_POSITION) { + this._header['SetUp'] = '1'; + this._header['FEN'] = fen; + } + else { + this._header['SetUp'] = null; + this._header['FEN'] = null; + } + } + reset() { + this.load(DEFAULT_POSITION); + } + get(square) { + return this._board[Ox88[square]]; + } + findPiece(piece) { + const squares = []; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + // did we run off the end of the board + if (i & 0x88) { + i += 7; + continue; + } + // if empty square or wrong color + if (!this._board[i] || this._board[i]?.color !== piece.color) { + continue; + } + // check if square contains the requested piece + if (this._board[i].color === piece.color && + this._board[i].type === piece.type) { + squares.push(algebraic(i)); + } + } + return squares; + } + put({ type, color }, square) { + if (this._put({ type, color }, square)) { + this._updateCastlingRights(); + this._updateEnPassantSquare(); + this._updateSetup(this.fen()); + return true; + } + return false; + } + _set(sq, piece) { + this._hash ^= this._pieceKey(sq); + this._board[sq] = piece; + this._hash ^= this._pieceKey(sq); + } + _put({ type, color }, square) { + // check for piece + if (SYMBOLS.indexOf(type.toLowerCase()) === -1) { + return false; + } + // check for valid square + if (!(square in Ox88)) { + return false; + } + const sq = Ox88[square]; + // don't let the user place more than one king + if (type == KING && + !(this._kings[color] == EMPTY || this._kings[color] == sq)) { + return false; + } + const currentPieceOnSquare = this._board[sq]; + // if one of the kings will be replaced by the piece from args, set the `_kings` respective entry to `EMPTY` + if (currentPieceOnSquare && currentPieceOnSquare.type === KING) { + this._kings[currentPieceOnSquare.color] = EMPTY; + } + this._set(sq, { type: type, color: color }); + if (type === KING) { + this._kings[color] = sq; + } + return true; + } + _clear(sq) { + this._hash ^= this._pieceKey(sq); + delete this._board[sq]; + } + remove(square) { + const piece = this.get(square); + this._clear(Ox88[square]); + if (piece && piece.type === KING) { + this._kings[piece.color] = EMPTY; + } + this._updateCastlingRights(); + this._updateEnPassantSquare(); + this._updateSetup(this.fen()); + return piece; + } + _updateCastlingRights() { + this._hash ^= this._castlingKey(); + const whiteKingInPlace = this._board[Ox88.e1]?.type === KING && + this._board[Ox88.e1]?.color === WHITE; + const blackKingInPlace = this._board[Ox88.e8]?.type === KING && + this._board[Ox88.e8]?.color === BLACK; + if (!whiteKingInPlace || + this._board[Ox88.a1]?.type !== ROOK || + this._board[Ox88.a1]?.color !== WHITE) { + this._castling.w &= -65; + } + if (!whiteKingInPlace || + this._board[Ox88.h1]?.type !== ROOK || + this._board[Ox88.h1]?.color !== WHITE) { + this._castling.w &= -33; + } + if (!blackKingInPlace || + this._board[Ox88.a8]?.type !== ROOK || + this._board[Ox88.a8]?.color !== BLACK) { + this._castling.b &= -65; + } + if (!blackKingInPlace || + this._board[Ox88.h8]?.type !== ROOK || + this._board[Ox88.h8]?.color !== BLACK) { + this._castling.b &= -33; + } + this._hash ^= this._castlingKey(); + } + _updateEnPassantSquare() { + if (this._epSquare === EMPTY) { + return; + } + const startSquare = this._epSquare + (this._turn === WHITE ? -16 : 16); + const currentSquare = this._epSquare + (this._turn === WHITE ? 16 : -16); + const attackers = [currentSquare + 1, currentSquare - 1]; + if (this._board[startSquare] !== null || + this._board[this._epSquare] !== null || + this._board[currentSquare]?.color !== swapColor(this._turn) || + this._board[currentSquare]?.type !== PAWN) { + this._hash ^= this._epKey(); + this._epSquare = EMPTY; + return; + } + const canCapture = (square) => !(square & 0x88) && + this._board[square]?.color === this._turn && + this._board[square]?.type === PAWN; + if (!attackers.some(canCapture)) { + this._hash ^= this._epKey(); + this._epSquare = EMPTY; + } + } + _attacked(color, square, verbose) { + const attackers = []; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + // did we run off the end of the board + if (i & 0x88) { + i += 7; + continue; + } + // if empty square or wrong color + if (this._board[i] === undefined || this._board[i].color !== color) { + continue; + } + const piece = this._board[i]; + const difference = i - square; + // skip - to/from square are the same + if (difference === 0) { + continue; + } + const index = difference + 119; + if (ATTACKS[index] & PIECE_MASKS[piece.type]) { + if (piece.type === PAWN) { + if ((difference > 0 && piece.color === WHITE) || + (difference <= 0 && piece.color === BLACK)) { + if (!verbose) { + return true; + } + else { + attackers.push(algebraic(i)); + } + } + continue; + } + // if the piece is a knight or a king + if (piece.type === 'n' || piece.type === 'k') { + if (!verbose) { + return true; + } + else { + attackers.push(algebraic(i)); + continue; + } + } + const offset = RAYS[index]; + let j = i + offset; + let blocked = false; + while (j !== square) { + if (this._board[j] != null) { + blocked = true; + break; + } + j += offset; + } + if (!blocked) { + if (!verbose) { + return true; + } + else { + attackers.push(algebraic(i)); + continue; + } + } + } + } + if (verbose) { + return attackers; + } + else { + return false; + } + } + attackers(square, attackedBy) { + if (!attackedBy) { + return this._attacked(this._turn, Ox88[square], true); + } + else { + return this._attacked(attackedBy, Ox88[square], true); + } + } + _isKingAttacked(color) { + const square = this._kings[color]; + return square === -1 ? false : this._attacked(swapColor(color), square); + } + hash() { + return this._hash.toString(16); + } + isAttacked(square, attackedBy) { + return this._attacked(attackedBy, Ox88[square]); + } + isCheck() { + return this._isKingAttacked(this._turn); + } + inCheck() { + return this.isCheck(); + } + isCheckmate() { + return this.isCheck() && this._moves().length === 0; + } + isStalemate() { + return !this.isCheck() && this._moves().length === 0; + } + isInsufficientMaterial() { + /* + * k.b. vs k.b. (of opposite colors) with mate in 1: + * 8/8/8/8/1b6/8/B1k5/K7 b - - 0 1 + * + * k.b. vs k.n. with mate in 1: + * 8/8/8/8/1n6/8/B7/K1k5 b - - 2 1 + */ + const pieces = { + b: 0, + n: 0, + r: 0, + q: 0, + k: 0, + p: 0, + }; + const bishops = []; + let numPieces = 0; + let squareColor = 0; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + squareColor = (squareColor + 1) % 2; + if (i & 0x88) { + i += 7; + continue; + } + const piece = this._board[i]; + if (piece) { + pieces[piece.type] = piece.type in pieces ? pieces[piece.type] + 1 : 1; + if (piece.type === BISHOP) { + bishops.push(squareColor); + } + numPieces++; + } + } + // k vs. k + if (numPieces === 2) { + return true; + } + else if ( + // k vs. kn .... or .... k vs. kb + numPieces === 3 && + (pieces[BISHOP] === 1 || pieces[KNIGHT] === 1)) { + return true; + } + else if (numPieces === pieces[BISHOP] + 2) { + // kb vs. kb where any number of bishops are all on the same color + let sum = 0; + const len = bishops.length; + for (let i = 0; i < len; i++) { + sum += bishops[i]; + } + if (sum === 0 || sum === len) { + return true; + } + } + return false; + } + isThreefoldRepetition() { + return this._getPositionCount(this._hash) >= 3; + } + isDrawByFiftyMoves() { + return this._halfMoves >= 100; // 50 moves per side = 100 half moves + } + isDraw() { + return (this.isDrawByFiftyMoves() || + this.isStalemate() || + this.isInsufficientMaterial() || + this.isThreefoldRepetition()); + } + isGameOver() { + return this.isCheckmate() || this.isDraw(); + } + moves({ verbose = false, square = undefined, piece = undefined, } = {}) { + const moves = this._moves({ square, piece }); + if (verbose) { + return moves.map((move) => new Move(this, move)); + } + else { + return moves.map((move) => this._moveToSan(move, moves)); + } + } + _moves({ legal = true, piece = undefined, square = undefined, } = {}) { + const forSquare = square ? square.toLowerCase() : undefined; + const forPiece = piece?.toLowerCase(); + const moves = []; + const us = this._turn; + const them = swapColor(us); + let firstSquare = Ox88.a8; + let lastSquare = Ox88.h1; + let singleSquare = false; + // are we generating moves for a single square? + if (forSquare) { + // illegal square, return empty moves + if (!(forSquare in Ox88)) { + return []; + } + else { + firstSquare = lastSquare = Ox88[forSquare]; + singleSquare = true; + } + } + for (let from = firstSquare; from <= lastSquare; from++) { + // did we run off the end of the board + if (from & 0x88) { + from += 7; + continue; + } + // empty square or opponent, skip + if (!this._board[from] || this._board[from].color === them) { + continue; + } + const { type } = this._board[from]; + let to; + if (type === PAWN) { + if (forPiece && forPiece !== type) + continue; + // single square, non-capturing + to = from + PAWN_OFFSETS[us][0]; + if (!this._board[to]) { + addMove(moves, us, from, to, PAWN); + // double square + to = from + PAWN_OFFSETS[us][1]; + if (SECOND_RANK[us] === rank(from) && !this._board[to]) { + addMove(moves, us, from, to, PAWN, undefined, BITS.BIG_PAWN); + } + } + // pawn captures + for (let j = 2; j < 4; j++) { + to = from + PAWN_OFFSETS[us][j]; + if (to & 0x88) + continue; + if (this._board[to]?.color === them) { + addMove(moves, us, from, to, PAWN, this._board[to].type, BITS.CAPTURE); + } + else if (to === this._epSquare) { + addMove(moves, us, from, to, PAWN, PAWN, BITS.EP_CAPTURE); + } + } + } + else { + if (forPiece && forPiece !== type) + continue; + for (let j = 0, len = PIECE_OFFSETS[type].length; j < len; j++) { + const offset = PIECE_OFFSETS[type][j]; + to = from; + while (true) { + to += offset; + if (to & 0x88) + break; + if (!this._board[to]) { + addMove(moves, us, from, to, type); + } + else { + // own color, stop loop + if (this._board[to].color === us) + break; + addMove(moves, us, from, to, type, this._board[to].type, BITS.CAPTURE); + break; + } + /* break, if knight or king */ + if (type === KNIGHT || type === KING) + break; + } + } + } + } + /* + * check for castling if we're: + * a) generating all moves, or + * b) doing single square move generation on the king's square + */ + if (forPiece === undefined || forPiece === KING) { + if (!singleSquare || lastSquare === this._kings[us]) { + // king-side castling + if (this._castling[us] & BITS.KSIDE_CASTLE) { + const castlingFrom = this._kings[us]; + const castlingTo = castlingFrom + 2; + if (!this._board[castlingFrom + 1] && + !this._board[castlingTo] && + !this._attacked(them, this._kings[us]) && + !this._attacked(them, castlingFrom + 1) && + !this._attacked(them, castlingTo)) { + addMove(moves, us, this._kings[us], castlingTo, KING, undefined, BITS.KSIDE_CASTLE); + } + } + // queen-side castling + if (this._castling[us] & BITS.QSIDE_CASTLE) { + const castlingFrom = this._kings[us]; + const castlingTo = castlingFrom - 2; + if (!this._board[castlingFrom - 1] && + !this._board[castlingFrom - 2] && + !this._board[castlingFrom - 3] && + !this._attacked(them, this._kings[us]) && + !this._attacked(them, castlingFrom - 1) && + !this._attacked(them, castlingTo)) { + addMove(moves, us, this._kings[us], castlingTo, KING, undefined, BITS.QSIDE_CASTLE); + } + } + } + } + /* + * return all pseudo-legal moves (this includes moves that allow the king + * to be captured) + */ + if (!legal || this._kings[us] === -1) { + return moves; + } + // filter out illegal moves + const legalMoves = []; + for (let i = 0, len = moves.length; i < len; i++) { + this._makeMove(moves[i]); + if (!this._isKingAttacked(us)) { + legalMoves.push(moves[i]); + } + this._undoMove(); + } + return legalMoves; + } + move(move, { strict = false } = {}) { + /* + * The move function can be called with in the following parameters: + * + * .move('Nxb7') <- argument is a case-sensitive SAN string + * + * .move({ from: 'h7', <- argument is a move object + * to :'h8', + * promotion: 'q' }) + * + * + * An optional strict argument may be supplied to tell chess.js to + * strictly follow the SAN specification. + */ + let moveObj = null; + if (typeof move === 'string') { + moveObj = this._moveFromSan(move, strict); + } + else if (move === null) { + moveObj = this._moveFromSan(SAN_NULLMOVE, strict); + } + else if (typeof move === 'object') { + const moves = this._moves(); + // convert the pretty move object to an ugly move object + for (let i = 0, len = moves.length; i < len; i++) { + if (move.from === algebraic(moves[i].from) && + move.to === algebraic(moves[i].to) && + (!('promotion' in moves[i]) || move.promotion === moves[i].promotion)) { + moveObj = moves[i]; + break; + } + } + } + // failed to find move + if (!moveObj) { + if (typeof move === 'string') { + throw new Error(`Invalid move: ${move}`); + } + else { + throw new Error(`Invalid move: ${JSON.stringify(move)}`); + } + } + //disallow null moves when in check + if (this.isCheck() && moveObj.flags & BITS.NULL_MOVE) { + throw new Error('Null move not allowed when in check'); + } + /* + * need to make a copy of move because we can't generate SAN after the move + * is made + */ + const prettyMove = new Move(this, moveObj); + this._makeMove(moveObj); + this._incPositionCount(); + return prettyMove; + } + _push(move) { + this._history.push({ + move, + kings: { b: this._kings.b, w: this._kings.w }, + turn: this._turn, + castling: { b: this._castling.b, w: this._castling.w }, + epSquare: this._epSquare, + halfMoves: this._halfMoves, + moveNumber: this._moveNumber, + }); + } + _movePiece(from, to) { + this._hash ^= this._pieceKey(from); + this._board[to] = this._board[from]; + delete this._board[from]; + this._hash ^= this._pieceKey(to); + } + _makeMove(move) { + const us = this._turn; + const them = swapColor(us); + this._push(move); + if (move.flags & BITS.NULL_MOVE) { + if (us === BLACK) { + this._moveNumber++; + } + this._halfMoves++; + this._turn = them; + this._epSquare = EMPTY; + return; + } + this._hash ^= this._epKey(); + this._hash ^= this._castlingKey(); + if (move.captured) { + this._hash ^= this._pieceKey(move.to); + } + this._movePiece(move.from, move.to); + // if ep capture, remove the captured pawn + if (move.flags & BITS.EP_CAPTURE) { + if (this._turn === BLACK) { + this._clear(move.to - 16); + } + else { + this._clear(move.to + 16); + } + } + // if pawn promotion, replace with new piece + if (move.promotion) { + this._clear(move.to); + this._set(move.to, { type: move.promotion, color: us }); + } + // if we moved the king + if (this._board[move.to].type === KING) { + this._kings[us] = move.to; + // if we castled, move the rook next to the king + if (move.flags & BITS.KSIDE_CASTLE) { + const castlingTo = move.to - 1; + const castlingFrom = move.to + 1; + this._movePiece(castlingFrom, castlingTo); + } + else if (move.flags & BITS.QSIDE_CASTLE) { + const castlingTo = move.to + 1; + const castlingFrom = move.to - 2; + this._movePiece(castlingFrom, castlingTo); + } + // turn off castling + this._castling[us] = 0; + } + // turn off castling if we move a rook + if (this._castling[us]) { + for (let i = 0, len = ROOKS[us].length; i < len; i++) { + if (move.from === ROOKS[us][i].square && + this._castling[us] & ROOKS[us][i].flag) { + this._castling[us] ^= ROOKS[us][i].flag; + break; + } + } + } + // turn off castling if we capture a rook + if (this._castling[them]) { + for (let i = 0, len = ROOKS[them].length; i < len; i++) { + if (move.to === ROOKS[them][i].square && + this._castling[them] & ROOKS[them][i].flag) { + this._castling[them] ^= ROOKS[them][i].flag; + break; + } + } + } + this._hash ^= this._castlingKey(); + // if big pawn move, update the en passant square + if (move.flags & BITS.BIG_PAWN) { + let epSquare; + if (us === BLACK) { + epSquare = move.to - 16; + } + else { + epSquare = move.to + 16; + } + if ((!((move.to - 1) & 0x88) && + this._board[move.to - 1]?.type === PAWN && + this._board[move.to - 1]?.color === them) || + (!((move.to + 1) & 0x88) && + this._board[move.to + 1]?.type === PAWN && + this._board[move.to + 1]?.color === them)) { + this._epSquare = epSquare; + this._hash ^= this._epKey(); + } + else { + this._epSquare = EMPTY; + } + } + else { + this._epSquare = EMPTY; + } + // reset the 50 move counter if a pawn is moved or a piece is captured + if (move.piece === PAWN) { + this._halfMoves = 0; + } + else if (move.flags & (BITS.CAPTURE | BITS.EP_CAPTURE)) { + this._halfMoves = 0; + } + else { + this._halfMoves++; + } + if (us === BLACK) { + this._moveNumber++; + } + this._turn = them; + this._hash ^= SIDE_KEY; + } + undo() { + const hash = this._hash; + const move = this._undoMove(); + if (move) { + const prettyMove = new Move(this, move); + this._decPositionCount(hash); + return prettyMove; + } + return null; + } + _undoMove() { + const old = this._history.pop(); + if (old === undefined) { + return null; + } + this._hash ^= this._epKey(); + this._hash ^= this._castlingKey(); + const move = old.move; + this._kings = old.kings; + this._turn = old.turn; + this._castling = old.castling; + this._epSquare = old.epSquare; + this._halfMoves = old.halfMoves; + this._moveNumber = old.moveNumber; + this._hash ^= this._epKey(); + this._hash ^= this._castlingKey(); + this._hash ^= SIDE_KEY; + const us = this._turn; + const them = swapColor(us); + if (move.flags & BITS.NULL_MOVE) { + return move; + } + this._movePiece(move.to, move.from); + // to undo any promotions + if (move.piece) { + this._clear(move.from); + this._set(move.from, { type: move.piece, color: us }); + } + if (move.captured) { + if (move.flags & BITS.EP_CAPTURE) { + // en passant capture + let index; + if (us === BLACK) { + index = move.to - 16; + } + else { + index = move.to + 16; + } + this._set(index, { type: PAWN, color: them }); + } + else { + // regular capture + this._set(move.to, { type: move.captured, color: them }); + } + } + if (move.flags & (BITS.KSIDE_CASTLE | BITS.QSIDE_CASTLE)) { + let castlingTo, castlingFrom; + if (move.flags & BITS.KSIDE_CASTLE) { + castlingTo = move.to + 1; + castlingFrom = move.to - 1; + } + else { + castlingTo = move.to - 2; + castlingFrom = move.to + 1; + } + this._movePiece(castlingFrom, castlingTo); + } + return move; + } + pgn({ newline = '\n', maxWidth = 0, } = {}) { + /* + * using the specification from http://www.chessclub.com/help/PGN-spec + * example for html usage: .pgn({ max_width: 72, newline_char: "
      " }) + */ + const result = []; + let headerExists = false; + /* add the PGN header information */ + for (const i in this._header) { + /* + * TODO: order of enumerated properties in header object is not + * guaranteed, see ECMA-262 spec (section 12.6.4) + * + * By using HEADER_TEMPLATE, the order of tags should be preserved; we + * do have to check for null placeholders, though, and omit them + */ + const headerTag = this._header[i]; + if (headerTag) + result.push(`[${i} "${this._header[i]}"]` + newline); + headerExists = true; + } + if (headerExists && this._history.length) { + result.push(newline); + } + const appendComment = (moveString) => { + const comment = this._comments[this.fen()]; + if (typeof comment !== 'undefined') { + const delimiter = moveString.length > 0 ? ' ' : ''; + moveString = `${moveString}${delimiter}{${comment}}`; + } + return moveString; + }; + // pop all of history onto reversed_history + const reversedHistory = []; + while (this._history.length > 0) { + reversedHistory.push(this._undoMove()); + } + const moves = []; + let moveString = ''; + // special case of a commented starting position with no moves + if (reversedHistory.length === 0) { + moves.push(appendComment('')); + } + // build the list of moves. a move_string looks like: "3. e3 e6" + while (reversedHistory.length > 0) { + moveString = appendComment(moveString); + const move = reversedHistory.pop(); + // make TypeScript stop complaining about move being undefined + if (!move) { + break; + } + // if the position started with black to move, start PGN with #. ... + if (!this._history.length && move.color === 'b') { + const prefix = `${this._moveNumber}. ...`; + // is there a comment preceding the first move? + moveString = moveString ? `${moveString} ${prefix}` : prefix; + } + else if (move.color === 'w') { + // store the previous generated move_string if we have one + if (moveString.length) { + moves.push(moveString); + } + moveString = this._moveNumber + '.'; + } + moveString = + moveString + ' ' + this._moveToSan(move, this._moves({ legal: true })); + this._makeMove(move); + } + // are there any other leftover moves? + if (moveString.length) { + moves.push(appendComment(moveString)); + } + // is there a result? (there ALWAYS has to be a result according to spec; see Seven Tag Roster) + moves.push(this._header.Result || '*'); + /* + * history should be back to what it was before we started generating PGN, + * so join together moves + */ + if (maxWidth === 0) { + return result.join('') + moves.join(' '); + } + // TODO (jah): huh? + const strip = function () { + if (result.length > 0 && result[result.length - 1] === ' ') { + result.pop(); + return true; + } + return false; + }; + // NB: this does not preserve comment whitespace. + const wrapComment = function (width, move) { + for (const token of move.split(' ')) { + if (!token) { + continue; + } + if (width + token.length > maxWidth) { + while (strip()) { + width--; + } + result.push(newline); + width = 0; + } + result.push(token); + width += token.length; + result.push(' '); + width++; + } + if (strip()) { + width--; + } + return width; + }; + // wrap the PGN output at max_width + let currentWidth = 0; + for (let i = 0; i < moves.length; i++) { + if (currentWidth + moves[i].length > maxWidth) { + if (moves[i].includes('{')) { + currentWidth = wrapComment(currentWidth, moves[i]); + continue; + } + } + // if the current move will push past max_width + if (currentWidth + moves[i].length > maxWidth && i !== 0) { + // don't end the line with whitespace + if (result[result.length - 1] === ' ') { + result.pop(); + } + result.push(newline); + currentWidth = 0; + } + else if (i !== 0) { + result.push(' '); + currentWidth++; + } + result.push(moves[i]); + currentWidth += moves[i].length; + } + return result.join(''); + } + /** + * @deprecated Use `setHeader` and `getHeaders` instead. This method will return null header tags (which is not what you want) + */ + header(...args) { + for (let i = 0; i < args.length; i += 2) { + if (typeof args[i] === 'string' && typeof args[i + 1] === 'string') { + this._header[args[i]] = args[i + 1]; + } + } + return this._header; + } + // TODO: value validation per spec + setHeader(key, value) { + this._header[key] = value ?? SEVEN_TAG_ROSTER[key] ?? null; + return this.getHeaders(); + } + removeHeader(key) { + if (key in this._header) { + this._header[key] = SEVEN_TAG_ROSTER[key] || null; + return true; + } + return false; + } + // return only non-null headers (omit placemarker nulls) + getHeaders() { + const nonNullHeaders = {}; + for (const [key, value] of Object.entries(this._header)) { + if (value !== null) { + nonNullHeaders[key] = value; + } + } + return nonNullHeaders; + } + loadPgn(pgn, { strict = false, newlineChar = '\r?\n', } = {}) { + // If newlineChar is not the default, replace all instances with \n + if (newlineChar !== '\r?\n') { + pgn = pgn.replace(new RegExp(newlineChar, 'g'), '\n'); + } + const parsedPgn = peg$parse(pgn); + // Put the board in the starting position + this.reset(); + // parse PGN header + const headers = parsedPgn.headers; + let fen = ''; + for (const key in headers) { + // check to see user is including fen (possibly with wrong tag case) + if (key.toLowerCase() === 'fen') { + fen = headers[key]; + } + this.header(key, headers[key]); + } + /* + * the permissive parser should attempt to load a fen tag, even if it's the + * wrong case and doesn't include a corresponding [SetUp "1"] tag + */ + if (!strict) { + if (fen) { + this.load(fen, { preserveHeaders: true }); + } + } + else { + /* + * strict parser - load the starting position indicated by [Setup '1'] + * and [FEN position] + */ + if (headers['SetUp'] === '1') { + if (!('FEN' in headers)) { + throw new Error('Invalid PGN: FEN tag must be supplied with SetUp tag'); + } + // don't clear the headers when loading + this.load(headers['FEN'], { preserveHeaders: true }); + } + } + let node = parsedPgn.root; + while (node) { + if (node.move) { + const move = this._moveFromSan(node.move, strict); + if (move == null) { + throw new Error(`Invalid move in PGN: ${node.move}`); + } + else { + this._makeMove(move); + this._incPositionCount(); + } + } + if (node.comment !== undefined) { + this._comments[this.fen()] = node.comment; + } + node = node.variations[0]; + } + /* + * Per section 8.2.6 of the PGN spec, the Result tag pair must match match + * the termination marker. Only do this when headers are present, but the + * result tag is missing + */ + const result = parsedPgn.result; + if (result && + Object.keys(this._header).length && + this._header['Result'] !== result) { + this.setHeader('Result', result); + } + } + /* + * Convert a move from 0x88 coordinates to Standard Algebraic Notation + * (SAN) + * + * @param {boolean} strict Use the strict SAN parser. It will throw errors + * on overly disambiguated moves (see below): + * + * r1bqkbnr/ppp2ppp/2n5/1B1pP3/4P3/8/PPPP2PP/RNBQK1NR b KQkq - 2 4 + * 4. ... Nge7 is overly disambiguated because the knight on c6 is pinned + * 4. ... Ne7 is technically the valid SAN + */ + _moveToSan(move, moves) { + let output = ''; + if (move.flags & BITS.KSIDE_CASTLE) { + output = 'O-O'; + } + else if (move.flags & BITS.QSIDE_CASTLE) { + output = 'O-O-O'; + } + else if (move.flags & BITS.NULL_MOVE) { + return SAN_NULLMOVE; + } + else { + if (move.piece !== PAWN) { + const disambiguator = getDisambiguator(move, moves); + output += move.piece.toUpperCase() + disambiguator; + } + if (move.flags & (BITS.CAPTURE | BITS.EP_CAPTURE)) { + if (move.piece === PAWN) { + output += algebraic(move.from)[0]; + } + output += 'x'; + } + output += algebraic(move.to); + if (move.promotion) { + output += '=' + move.promotion.toUpperCase(); + } + } + this._makeMove(move); + if (this.isCheck()) { + if (this.isCheckmate()) { + output += '#'; + } + else { + output += '+'; + } + } + this._undoMove(); + return output; + } + // convert a move from Standard Algebraic Notation (SAN) to 0x88 coordinates + _moveFromSan(move, strict = false) { + // strip off any move decorations: e.g Nf3+?! becomes Nf3 + let cleanMove = strippedSan(move); + if (!strict) { + if (cleanMove === '0-0') { + cleanMove = 'O-O'; + } + else if (cleanMove === '0-0-0') { + cleanMove = 'O-O-O'; + } + } + //first implementation of null with a dummy move (black king moves from a8 to a8), maybe this can be implemented better + if (cleanMove == SAN_NULLMOVE) { + const res = { + color: this._turn, + from: 0, + to: 0, + piece: 'k', + flags: BITS.NULL_MOVE, + }; + return res; + } + let pieceType = inferPieceType(cleanMove); + let moves = this._moves({ legal: true, piece: pieceType }); + // strict parser + for (let i = 0, len = moves.length; i < len; i++) { + if (cleanMove === strippedSan(this._moveToSan(moves[i], moves))) { + return moves[i]; + } + } + // the strict parser failed + if (strict) { + return null; + } + let piece = undefined; + let matches = undefined; + let from = undefined; + let to = undefined; + let promotion = undefined; + /* + * The default permissive (non-strict) parser allows the user to parse + * non-standard chess notations. This parser is only run after the strict + * Standard Algebraic Notation (SAN) parser has failed. + * + * When running the permissive parser, we'll run a regex to grab the piece, the + * to/from square, and an optional promotion piece. This regex will + * parse common non-standard notation like: Pe2-e4, Rc1c4, Qf3xf7, + * f7f8q, b1c3 + * + * NOTE: Some positions and moves may be ambiguous when using the permissive + * parser. For example, in this position: 6k1/8/8/B7/8/8/8/BN4K1 w - - 0 1, + * the move b1c3 may be interpreted as Nc3 or B1c3 (a disambiguated bishop + * move). In these cases, the permissive parser will default to the most + * basic interpretation (which is b1c3 parsing to Nc3). + */ + let overlyDisambiguated = false; + matches = cleanMove.match(/([pnbrqkPNBRQK])?([a-h][1-8])x?-?([a-h][1-8])([qrbnQRBN])?/); + if (matches) { + piece = matches[1]; + from = matches[2]; + to = matches[3]; + promotion = matches[4]; + if (from.length == 1) { + overlyDisambiguated = true; + } + } + else { + /* + * The [a-h]?[1-8]? portion of the regex below handles moves that may be + * overly disambiguated (e.g. Nge7 is unnecessary and non-standard when + * there is one legal knight move to e7). In this case, the value of + * 'from' variable will be a rank or file, not a square. + */ + matches = cleanMove.match(/([pnbrqkPNBRQK])?([a-h]?[1-8]?)x?-?([a-h][1-8])([qrbnQRBN])?/); + if (matches) { + piece = matches[1]; + from = matches[2]; + to = matches[3]; + promotion = matches[4]; + if (from.length == 1) { + overlyDisambiguated = true; + } + } + } + pieceType = inferPieceType(cleanMove); + moves = this._moves({ + legal: true, + piece: piece ? piece : pieceType, + }); + if (!to) { + return null; + } + for (let i = 0, len = moves.length; i < len; i++) { + if (!from) { + // if there is no from square, it could be just 'x' missing from a capture + if (cleanMove === + strippedSan(this._moveToSan(moves[i], moves)).replace('x', '')) { + return moves[i]; + } + // hand-compare move properties with the results from our permissive regex + } + else if ((!piece || piece.toLowerCase() == moves[i].piece) && + Ox88[from] == moves[i].from && + Ox88[to] == moves[i].to && + (!promotion || promotion.toLowerCase() == moves[i].promotion)) { + return moves[i]; + } + else if (overlyDisambiguated) { + /* + * SPECIAL CASE: we parsed a move string that may have an unneeded + * rank/file disambiguator (e.g. Nge7). The 'from' variable will + */ + const square = algebraic(moves[i].from); + if ((!piece || piece.toLowerCase() == moves[i].piece) && + Ox88[to] == moves[i].to && + (from == square[0] || from == square[1]) && + (!promotion || promotion.toLowerCase() == moves[i].promotion)) { + return moves[i]; + } + } + } + return null; + } + ascii() { + let s = ' +------------------------+\n'; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + // display the rank + if (file(i) === 0) { + s += ' ' + '87654321'[rank(i)] + ' |'; + } + if (this._board[i]) { + const piece = this._board[i].type; + const color = this._board[i].color; + const symbol = color === WHITE ? piece.toUpperCase() : piece.toLowerCase(); + s += ' ' + symbol + ' '; + } + else { + s += ' . '; + } + if ((i + 1) & 0x88) { + s += '|\n'; + i += 8; + } + } + s += ' +------------------------+\n'; + s += ' a b c d e f g h'; + return s; + } + perft(depth) { + const moves = this._moves({ legal: false }); + let nodes = 0; + const color = this._turn; + for (let i = 0, len = moves.length; i < len; i++) { + this._makeMove(moves[i]); + if (!this._isKingAttacked(color)) { + if (depth - 1 > 0) { + nodes += this.perft(depth - 1); + } + else { + nodes++; + } + } + this._undoMove(); + } + return nodes; + } + setTurn(color) { + if (this._turn == color) { + return false; + } + this.move('--'); + return true; + } + turn() { + return this._turn; + } + board() { + const output = []; + let row = []; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + if (this._board[i] == null) { + row.push(null); + } + else { + row.push({ + square: algebraic(i), + type: this._board[i].type, + color: this._board[i].color, + }); + } + if ((i + 1) & 0x88) { + output.push(row); + row = []; + i += 8; + } + } + return output; + } + squareColor(square) { + if (square in Ox88) { + const sq = Ox88[square]; + return (rank(sq) + file(sq)) % 2 === 0 ? 'light' : 'dark'; + } + return null; + } + history({ verbose = false } = {}) { + const reversedHistory = []; + const moveHistory = []; + while (this._history.length > 0) { + reversedHistory.push(this._undoMove()); + } + while (true) { + const move = reversedHistory.pop(); + if (!move) { + break; + } + if (verbose) { + moveHistory.push(new Move(this, move)); + } + else { + moveHistory.push(this._moveToSan(move, this._moves())); + } + this._makeMove(move); + } + return moveHistory; + } + /* + * Keeps track of position occurrence counts for the purpose of repetition + * checking. Old positions are removed from the map if their counts are reduced to 0. + */ + _getPositionCount(hash) { + return this._positionCount.get(hash) ?? 0; + } + _incPositionCount() { + this._positionCount.set(this._hash, (this._positionCount.get(this._hash) ?? 0) + 1); + } + _decPositionCount(hash) { + const currentCount = this._positionCount.get(hash) ?? 0; + if (currentCount === 1) { + this._positionCount.delete(hash); + } + else { + this._positionCount.set(hash, currentCount - 1); + } + } + _pruneComments() { + const reversedHistory = []; + const currentComments = {}; + const copyComment = (fen) => { + if (fen in this._comments) { + currentComments[fen] = this._comments[fen]; + } + }; + while (this._history.length > 0) { + reversedHistory.push(this._undoMove()); + } + copyComment(this.fen()); + while (true) { + const move = reversedHistory.pop(); + if (!move) { + break; + } + this._makeMove(move); + copyComment(this.fen()); + } + this._comments = currentComments; + } + getComment() { + return this._comments[this.fen()]; + } + setComment(comment) { + this._comments[this.fen()] = comment.replace('{', '[').replace('}', ']'); + } + /** + * @deprecated Renamed to `removeComment` for consistency + */ + deleteComment() { + return this.removeComment(); + } + removeComment() { + const comment = this._comments[this.fen()]; + delete this._comments[this.fen()]; + return comment; + } + getComments() { + this._pruneComments(); + return Object.keys(this._comments).map((fen) => { + return { fen: fen, comment: this._comments[fen] }; + }); + } + /** + * @deprecated Renamed to `removeComments` for consistency + */ + deleteComments() { + return this.removeComments(); + } + removeComments() { + this._pruneComments(); + return Object.keys(this._comments).map((fen) => { + const comment = this._comments[fen]; + delete this._comments[fen]; + return { fen: fen, comment: comment }; + }); + } + setCastlingRights(color, rights) { + for (const side of [KING, QUEEN]) { + if (rights[side] !== undefined) { + if (rights[side]) { + this._castling[color] |= SIDES[side]; + } + else { + this._castling[color] &= ~SIDES[side]; + } + } + } + this._updateCastlingRights(); + const result = this.getCastlingRights(color); + return ((rights[KING] === undefined || rights[KING] === result[KING]) && + (rights[QUEEN] === undefined || rights[QUEEN] === result[QUEEN])); + } + getCastlingRights(color) { + return { + [KING]: (this._castling[color] & SIDES[KING]) !== 0, + [QUEEN]: (this._castling[color] & SIDES[QUEEN]) !== 0, + }; + } + moveNumber() { + return this._moveNumber; + } +} + +exports.BISHOP = BISHOP; +exports.BLACK = BLACK; +exports.Chess = Chess; +exports.DEFAULT_POSITION = DEFAULT_POSITION; +exports.KING = KING; +exports.KNIGHT = KNIGHT; +exports.Move = Move; +exports.PAWN = PAWN; +exports.QUEEN = QUEEN; +exports.ROOK = ROOK; +exports.SEVEN_TAG_ROSTER = SEVEN_TAG_ROSTER; +exports.SQUARES = SQUARES; +exports.WHITE = WHITE; +exports.validateFen = validateFen; +exports.xoroshiro128 = xoroshiro128; +//# sourceMappingURL=chess.js.map diff --git a/node_modules/chess.js/dist/cjs/chess.js.map b/node_modules/chess.js/dist/cjs/chess.js.map new file mode 100644 index 0000000..db2f6d9 --- /dev/null +++ b/node_modules/chess.js/dist/cjs/chess.js.map @@ -0,0 +1 @@ +{"version":3,"file":"chess.js","sources":["../../src/pgn.js","../../../src/chess.ts"],"sourcesContent":["// @generated by Peggy 4.2.0.\n//\n// https://peggyjs.org/\n\n\n\n function rootNode(comment) {\n \treturn comment !== null ? { comment, variations: [] } : { variations: []}\n }\n\n function node(move, suffix, nag, comment, variations) {\n \tconst node = { move, variations }\n\n if (suffix) {\n \tnode.suffix = suffix\n }\n\n if (nag) {\n \tnode.nag = nag\n }\n\n if (comment !== null) {\n \tnode.comment = comment\n }\n\n return node\n }\n\n function lineToTree(...nodes) {\n \tconst [root, ...rest] = nodes;\n\n let parent = root\n\n for (const child of rest) {\n \tif (child !== null) {\n \tparent.variations = [child, ...child.variations]\n child.variations = []\n parent = child\n }\n }\n\n \treturn root\n }\n\n function pgn(headers, game) {\n \tif (game.marker && game.marker.comment) {\n \tlet node = game.root\n while (true) {\n \tconst next = node.variations[0]\n if (!next) {\n \tnode.comment = game.marker.comment\n \tbreak\n }\n node = next\n }\n }\n\n \treturn {\n \theaders,\n root: game.root,\n result: (game.marker && game.marker.result) ?? undefined\n }\n }\n\nfunction peg$subclass(child, parent) {\n function C() { this.constructor = child; }\n C.prototype = parent.prototype;\n child.prototype = new C();\n}\n\nfunction peg$SyntaxError(message, expected, found, location) {\n var self = Error.call(this, message);\n // istanbul ignore next Check is a necessary evil to support older environments\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(self, peg$SyntaxError.prototype);\n }\n self.expected = expected;\n self.found = found;\n self.location = location;\n self.name = \"SyntaxError\";\n return self;\n}\n\npeg$subclass(peg$SyntaxError, Error);\n\nfunction peg$padEnd(str, targetLength, padString) {\n padString = padString || \" \";\n if (str.length > targetLength) { return str; }\n targetLength -= str.length;\n padString += padString.repeat(targetLength);\n return str + padString.slice(0, targetLength);\n}\n\npeg$SyntaxError.prototype.format = function(sources) {\n var str = \"Error: \" + this.message;\n if (this.location) {\n var src = null;\n var k;\n for (k = 0; k < sources.length; k++) {\n if (sources[k].source === this.location.source) {\n src = sources[k].text.split(/\\r\\n|\\n|\\r/g);\n break;\n }\n }\n var s = this.location.start;\n var offset_s = (this.location.source && (typeof this.location.source.offset === \"function\"))\n ? this.location.source.offset(s)\n : s;\n var loc = this.location.source + \":\" + offset_s.line + \":\" + offset_s.column;\n if (src) {\n var e = this.location.end;\n var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');\n var line = src[s.line - 1];\n var last = s.line === e.line ? e.column : line.length + 1;\n var hatLen = (last - s.column) || 1;\n str += \"\\n --> \" + loc + \"\\n\"\n + filler + \" |\\n\"\n + offset_s.line + \" | \" + line + \"\\n\"\n + filler + \" | \" + peg$padEnd(\"\", s.column - 1, ' ')\n + peg$padEnd(\"\", hatLen, \"^\");\n } else {\n str += \"\\n at \" + loc;\n }\n }\n return str;\n};\n\npeg$SyntaxError.buildMessage = function(expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function(expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n\n class: function(expectation) {\n var escapedParts = expectation.parts.map(function(part) {\n return Array.isArray(part)\n ? classEscape(part[0]) + \"-\" + classEscape(part[1])\n : classEscape(part);\n });\n\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts.join(\"\") + \"]\";\n },\n\n any: function() {\n return \"any character\";\n },\n\n end: function() {\n return \"end of input\";\n },\n\n other: function(expectation) {\n return expectation.description;\n }\n };\n\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\"/g, \"\\\\\\\"\")\n .replace(/\\0/g, \"\\\\0\")\n .replace(/\\t/g, \"\\\\t\")\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/[\\x00-\\x0F]/g, function(ch) { return \"\\\\x0\" + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return \"\\\\x\" + hex(ch); });\n }\n\n function classEscape(s) {\n return s\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\\]/g, \"\\\\]\")\n .replace(/\\^/g, \"\\\\^\")\n .replace(/-/g, \"\\\\-\")\n .replace(/\\0/g, \"\\\\0\")\n .replace(/\\t/g, \"\\\\t\")\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/[\\x00-\\x0F]/g, function(ch) { return \"\\\\x0\" + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return \"\\\\x\" + hex(ch); });\n }\n\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n\n function describeExpected(expected) {\n var descriptions = expected.map(describeExpectation);\n var i, j;\n\n descriptions.sort();\n\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n};\n\nfunction peg$parse(input, options) {\n options = options !== undefined ? options : {};\n\n var peg$FAILED = {};\n var peg$source = options.grammarSource;\n\n var peg$startRuleFunctions = { pgn: peg$parsepgn };\n var peg$startRuleFunction = peg$parsepgn;\n\n var peg$c0 = \"[\";\n var peg$c1 = \"\\\"\";\n var peg$c2 = \"]\";\n var peg$c3 = \".\";\n var peg$c4 = \"O-O-O\";\n var peg$c5 = \"O-O\";\n var peg$c6 = \"0-0-0\";\n var peg$c7 = \"0-0\";\n var peg$c8 = \"$\";\n var peg$c9 = \"{\";\n var peg$c10 = \"}\";\n var peg$c11 = \";\";\n var peg$c12 = \"(\";\n var peg$c13 = \")\";\n var peg$c14 = \"1-0\";\n var peg$c15 = \"0-1\";\n var peg$c16 = \"1/2-1/2\";\n var peg$c17 = \"*\";\n\n var peg$r0 = /^[a-zA-Z]/;\n var peg$r1 = /^[^\"]/;\n var peg$r2 = /^[0-9]/;\n var peg$r3 = /^[.]/;\n var peg$r4 = /^[a-zA-Z1-8\\-=]/;\n var peg$r5 = /^[+#]/;\n var peg$r6 = /^[!?]/;\n var peg$r7 = /^[^}]/;\n var peg$r8 = /^[^\\r\\n]/;\n var peg$r9 = /^[ \\t\\r\\n]/;\n\n var peg$e0 = peg$otherExpectation(\"tag pair\");\n var peg$e1 = peg$literalExpectation(\"[\", false);\n var peg$e2 = peg$literalExpectation(\"\\\"\", false);\n var peg$e3 = peg$literalExpectation(\"]\", false);\n var peg$e4 = peg$otherExpectation(\"tag name\");\n var peg$e5 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"]], false, false);\n var peg$e6 = peg$otherExpectation(\"tag value\");\n var peg$e7 = peg$classExpectation([\"\\\"\"], true, false);\n var peg$e8 = peg$otherExpectation(\"move number\");\n var peg$e9 = peg$classExpectation([[\"0\", \"9\"]], false, false);\n var peg$e10 = peg$literalExpectation(\".\", false);\n var peg$e11 = peg$classExpectation([\".\"], false, false);\n var peg$e12 = peg$otherExpectation(\"standard algebraic notation\");\n var peg$e13 = peg$literalExpectation(\"O-O-O\", false);\n var peg$e14 = peg$literalExpectation(\"O-O\", false);\n var peg$e15 = peg$literalExpectation(\"0-0-0\", false);\n var peg$e16 = peg$literalExpectation(\"0-0\", false);\n var peg$e17 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"], [\"1\", \"8\"], \"-\", \"=\"], false, false);\n var peg$e18 = peg$classExpectation([\"+\", \"#\"], false, false);\n var peg$e19 = peg$otherExpectation(\"suffix annotation\");\n var peg$e20 = peg$classExpectation([\"!\", \"?\"], false, false);\n var peg$e21 = peg$otherExpectation(\"NAG\");\n var peg$e22 = peg$literalExpectation(\"$\", false);\n var peg$e23 = peg$otherExpectation(\"brace comment\");\n var peg$e24 = peg$literalExpectation(\"{\", false);\n var peg$e25 = peg$classExpectation([\"}\"], true, false);\n var peg$e26 = peg$literalExpectation(\"}\", false);\n var peg$e27 = peg$otherExpectation(\"rest of line comment\");\n var peg$e28 = peg$literalExpectation(\";\", false);\n var peg$e29 = peg$classExpectation([\"\\r\", \"\\n\"], true, false);\n var peg$e30 = peg$otherExpectation(\"variation\");\n var peg$e31 = peg$literalExpectation(\"(\", false);\n var peg$e32 = peg$literalExpectation(\")\", false);\n var peg$e33 = peg$otherExpectation(\"game termination marker\");\n var peg$e34 = peg$literalExpectation(\"1-0\", false);\n var peg$e35 = peg$literalExpectation(\"0-1\", false);\n var peg$e36 = peg$literalExpectation(\"1/2-1/2\", false);\n var peg$e37 = peg$literalExpectation(\"*\", false);\n var peg$e38 = peg$otherExpectation(\"whitespace\");\n var peg$e39 = peg$classExpectation([\" \", \"\\t\", \"\\r\", \"\\n\"], false, false);\n\n var peg$f0 = function(headers, game) { return pgn(headers, game) };\n var peg$f1 = function(tagPairs) { return Object.fromEntries(tagPairs) };\n var peg$f2 = function(tagName, tagValue) { return [tagName, tagValue] };\n var peg$f3 = function(root, marker) { return { root, marker} };\n var peg$f4 = function(comment, moves) { return lineToTree(rootNode(comment), ...moves.flat()) };\n var peg$f5 = function(san, suffix, nag, comment, variations) { return node(san, suffix, nag, comment, variations) };\n var peg$f6 = function(nag) { return nag };\n var peg$f7 = function(comment) { return comment.replace(/[\\r\\n]+/g, \" \") };\n var peg$f8 = function(comment) { return comment.trim() };\n var peg$f9 = function(line) { return line };\n var peg$f10 = function(result, comment) { return { result, comment } };\n var peg$currPos = options.peg$currPos | 0;\n var peg$savedPos = peg$currPos;\n var peg$posDetailsCache = [{ line: 1, column: 1 }];\n var peg$maxFailPos = peg$currPos;\n var peg$maxFailExpected = options.peg$maxFailExpected || [];\n var peg$silentFails = options.peg$silentFails | 0;\n\n var peg$result;\n\n if (options.startRule) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function offset() {\n return peg$savedPos;\n }\n\n function range() {\n return {\n source: peg$source,\n start: peg$savedPos,\n end: peg$currPos\n };\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location = location !== undefined\n ? location\n : peg$computeLocation(peg$savedPos, peg$currPos);\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location\n );\n }\n\n function error(message, location) {\n location = location !== undefined\n ? location\n : peg$computeLocation(peg$savedPos, peg$currPos);\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos];\n var p;\n\n if (details) {\n return details;\n } else {\n if (pos >= peg$posDetailsCache.length) {\n p = peg$posDetailsCache.length - 1;\n } else {\n p = pos;\n while (!peg$posDetailsCache[--p]) {}\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos, offset) {\n var startPosDetails = peg$computePosDetails(startPos);\n var endPosDetails = peg$computePosDetails(endPos);\n\n var res = {\n source: peg$source,\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n if (offset && peg$source && (typeof peg$source.offset === \"function\")) {\n res.start = peg$source.offset(res.start);\n res.end = peg$source.offset(res.end);\n }\n return res;\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) { return; }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location\n );\n }\n\n function peg$parsepgn() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsetagPairSection();\n s2 = peg$parsemoveTextSection();\n peg$savedPos = s0;\n s0 = peg$f0(s1, s2);\n\n return s0;\n }\n\n function peg$parsetagPairSection() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsetagPair();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsetagPair();\n }\n s2 = peg$parse_();\n peg$savedPos = s0;\n s0 = peg$f1(s1);\n\n return s0;\n }\n\n function peg$parsetagPair() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (input.charCodeAt(peg$currPos) === 91) {\n s2 = peg$c0;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e1); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n s4 = peg$parsetagName();\n if (s4 !== peg$FAILED) {\n s5 = peg$parse_();\n if (input.charCodeAt(peg$currPos) === 34) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e2); }\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$parsetagValue();\n if (input.charCodeAt(peg$currPos) === 34) {\n s8 = peg$c1;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e2); }\n }\n if (s8 !== peg$FAILED) {\n s9 = peg$parse_();\n if (input.charCodeAt(peg$currPos) === 93) {\n s10 = peg$c2;\n peg$currPos++;\n } else {\n s10 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e3); }\n }\n if (s10 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f2(s4, s7);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e0); }\n }\n\n return s0;\n }\n\n function peg$parsetagName() {\n var s0, s1, s2;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = [];\n s2 = input.charAt(peg$currPos);\n if (peg$r0.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e5); }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = input.charAt(peg$currPos);\n if (peg$r0.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e5); }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e4); }\n }\n\n return s0;\n }\n\n function peg$parsetagValue() {\n var s0, s1, s2;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = [];\n s2 = input.charAt(peg$currPos);\n if (peg$r1.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e7); }\n }\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = input.charAt(peg$currPos);\n if (peg$r1.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e7); }\n }\n }\n s0 = input.substring(s0, peg$currPos);\n peg$silentFails--;\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e6); }\n\n return s0;\n }\n\n function peg$parsemoveTextSection() {\n var s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = peg$parseline();\n s2 = peg$parse_();\n s3 = peg$parsegameTerminationMarker();\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n s4 = peg$parse_();\n peg$savedPos = s0;\n s0 = peg$f3(s1, s3);\n\n return s0;\n }\n\n function peg$parseline() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = peg$parsecomment();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n s2 = [];\n s3 = peg$parsemove();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsemove();\n }\n peg$savedPos = s0;\n s0 = peg$f4(s1, s2);\n\n return s0;\n }\n\n function peg$parsemove() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;\n\n s0 = peg$currPos;\n s1 = peg$parse_();\n s2 = peg$parsemoveNumber();\n if (s2 === peg$FAILED) {\n s2 = null;\n }\n s3 = peg$parse_();\n s4 = peg$parsesan();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsesuffixAnnotation();\n if (s5 === peg$FAILED) {\n s5 = null;\n }\n s6 = [];\n s7 = peg$parsenag();\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parsenag();\n }\n s7 = peg$parse_();\n s8 = peg$parsecomment();\n if (s8 === peg$FAILED) {\n s8 = null;\n }\n s9 = [];\n s10 = peg$parsevariation();\n while (s10 !== peg$FAILED) {\n s9.push(s10);\n s10 = peg$parsevariation();\n }\n peg$savedPos = s0;\n s0 = peg$f5(s4, s5, s6, s8, s9);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsemoveNumber() {\n var s0, s1, s2, s3, s4, s5;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = [];\n s2 = input.charAt(peg$currPos);\n if (peg$r2.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e9); }\n }\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = input.charAt(peg$currPos);\n if (peg$r2.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e9); }\n }\n }\n if (input.charCodeAt(peg$currPos) === 46) {\n s2 = peg$c3;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e10); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n s4 = [];\n s5 = input.charAt(peg$currPos);\n if (peg$r3.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e11); }\n }\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = input.charAt(peg$currPos);\n if (peg$r3.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e11); }\n }\n }\n s1 = [s1, s2, s3, s4];\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e8); }\n }\n\n return s0;\n }\n\n function peg$parsesan() {\n var s0, s1, s2, s3, s4, s5;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.substr(peg$currPos, 5) === peg$c4) {\n s2 = peg$c4;\n peg$currPos += 5;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e13); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c5) {\n s2 = peg$c5;\n peg$currPos += 3;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e14); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c6) {\n s2 = peg$c6;\n peg$currPos += 5;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e15); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c7) {\n s2 = peg$c7;\n peg$currPos += 3;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e16); }\n }\n if (s2 === peg$FAILED) {\n s2 = peg$currPos;\n s3 = input.charAt(peg$currPos);\n if (peg$r0.test(s3)) {\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e5); }\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = input.charAt(peg$currPos);\n if (peg$r4.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e17); }\n }\n if (s5 !== peg$FAILED) {\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = input.charAt(peg$currPos);\n if (peg$r4.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e17); }\n }\n }\n } else {\n s4 = peg$FAILED;\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n }\n }\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = input.charAt(peg$currPos);\n if (peg$r5.test(s3)) {\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e18); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n s2 = [s2, s3];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e12); }\n }\n\n return s0;\n }\n\n function peg$parsesuffixAnnotation() {\n var s0, s1, s2;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = [];\n s2 = input.charAt(peg$currPos);\n if (peg$r6.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e20); }\n }\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n if (s1.length >= 2) {\n s2 = peg$FAILED;\n } else {\n s2 = input.charAt(peg$currPos);\n if (peg$r6.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e20); }\n }\n }\n }\n if (s1.length < 1) {\n peg$currPos = s0;\n s0 = peg$FAILED;\n } else {\n s0 = s1;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e19); }\n }\n\n return s0;\n }\n\n function peg$parsenag() {\n var s0, s1, s2, s3, s4, s5;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (input.charCodeAt(peg$currPos) === 36) {\n s2 = peg$c8;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e22); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$currPos;\n s4 = [];\n s5 = input.charAt(peg$currPos);\n if (peg$r2.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e9); }\n }\n if (s5 !== peg$FAILED) {\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = input.charAt(peg$currPos);\n if (peg$r2.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e9); }\n }\n }\n } else {\n s4 = peg$FAILED;\n }\n if (s4 !== peg$FAILED) {\n s3 = input.substring(s3, peg$currPos);\n } else {\n s3 = s4;\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f6(s3);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e21); }\n }\n\n return s0;\n }\n\n function peg$parsecomment() {\n var s0;\n\n s0 = peg$parsebraceComment();\n if (s0 === peg$FAILED) {\n s0 = peg$parserestOfLineComment();\n }\n\n return s0;\n }\n\n function peg$parsebraceComment() {\n var s0, s1, s2, s3, s4;\n\n peg$silentFails++;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c9;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e24); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = [];\n s4 = input.charAt(peg$currPos);\n if (peg$r7.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e25); }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = input.charAt(peg$currPos);\n if (peg$r7.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e25); }\n }\n }\n s2 = input.substring(s2, peg$currPos);\n if (input.charCodeAt(peg$currPos) === 125) {\n s3 = peg$c10;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e26); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f7(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e23); }\n }\n\n return s0;\n }\n\n function peg$parserestOfLineComment() {\n var s0, s1, s2, s3, s4;\n\n peg$silentFails++;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 59) {\n s1 = peg$c11;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e28); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = [];\n s4 = input.charAt(peg$currPos);\n if (peg$r8.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = input.charAt(peg$currPos);\n if (peg$r8.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n }\n s2 = input.substring(s2, peg$currPos);\n peg$savedPos = s0;\n s0 = peg$f8(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e27); }\n }\n\n return s0;\n }\n\n function peg$parsevariation() {\n var s0, s1, s2, s3, s4, s5;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (input.charCodeAt(peg$currPos) === 40) {\n s2 = peg$c12;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e31); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parseline();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c13;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e32); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f9(s3);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e30); }\n }\n\n return s0;\n }\n\n function peg$parsegameTerminationMarker() {\n var s0, s1, s2, s3;\n\n peg$silentFails++;\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 3) === peg$c14) {\n s1 = peg$c14;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e34); }\n }\n if (s1 === peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c15) {\n s1 = peg$c15;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e35); }\n }\n if (s1 === peg$FAILED) {\n if (input.substr(peg$currPos, 7) === peg$c16) {\n s1 = peg$c16;\n peg$currPos += 7;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e36); }\n }\n if (s1 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 42) {\n s1 = peg$c17;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e37); }\n }\n }\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n s3 = peg$parsecomment();\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n peg$savedPos = s0;\n s0 = peg$f10(s1, s3);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e33); }\n }\n\n return s0;\n }\n\n function peg$parse_() {\n var s0, s1;\n\n peg$silentFails++;\n s0 = [];\n s1 = input.charAt(peg$currPos);\n if (peg$r9.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e39); }\n }\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n s1 = input.charAt(peg$currPos);\n if (peg$r9.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e39); }\n }\n }\n peg$silentFails--;\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e38); }\n\n return s0;\n }\n\n peg$result = peg$startRuleFunction();\n\n if (options.peg$library) {\n return /** @type {any} */ ({\n peg$result,\n peg$currPos,\n peg$FAILED,\n peg$maxFailExpected,\n peg$maxFailPos\n });\n }\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n } else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)\n );\n }\n}\n\nconst peg$allowedStartRules = [\n \"pgn\"\n];\n\nexport {\n peg$allowedStartRules as StartRules,\n peg$SyntaxError as SyntaxError,\n peg$parse as parse\n};\n",null],"names":["parse"],"mappings":";;AAAA;AACA;AACA;;;;AAIA,EAAE,SAAS,QAAQ,CAAC,OAAO,EAAE;AAC7B,GAAG,OAAO,OAAO,KAAK,IAAI,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE;AAC3E;;AAEA,EAAE,SAAS,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE;AACxD,GAAG,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,UAAU;;AAElC,IAAI,IAAI,MAAM,EAAE;AAChB,KAAK,IAAI,CAAC,MAAM,GAAG;AACnB;;AAEA,IAAI,IAAI,GAAG,EAAE;AACb,KAAK,IAAI,CAAC,GAAG,GAAG;AAChB;;AAEA,IAAI,IAAI,OAAO,KAAK,IAAI,EAAE;AAC1B,KAAK,IAAI,CAAC,OAAO,GAAG;AACpB;;AAEA,IAAI,OAAO;AACX;;AAEA,EAAE,SAAS,UAAU,CAAC,GAAG,KAAK,EAAE;AAChC,GAAG,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK;;AAEhC,IAAI,IAAI,MAAM,GAAG;;AAEjB,IAAI,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE;AAC9B,KAAK,IAAI,KAAK,KAAK,IAAI,EAAE;AACzB,SAAS,MAAM,CAAC,UAAU,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,UAAU;AACxD,YAAY,KAAK,CAAC,UAAU,GAAG;AAC/B,YAAY,MAAM,GAAG;AACrB;AACA;;AAEA,GAAG,OAAO;AACV;;AAEA,EAAE,SAAS,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE;AA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,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;AACnD,YAAA,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;SACtD;;IAGH,UAAU,GAAA;QACR,OAAO,IAAI,CAAC,WAAW;;AAE1B;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/chess.js/dist/esm/chess.js b/node_modules/chess.js/dist/esm/chess.js new file mode 100644 index 0000000..c0006f7 --- /dev/null +++ b/node_modules/chess.js/dist/esm/chess.js @@ -0,0 +1,3368 @@ +// @generated by Peggy 4.2.0. +// +// https://peggyjs.org/ + + + + function rootNode(comment) { + return comment !== null ? { comment, variations: [] } : { variations: []} + } + + function node(move, suffix, nag, comment, variations) { + const node = { move, variations }; + + if (suffix) { + node.suffix = suffix; + } + + if (nag) { + node.nag = nag; + } + + if (comment !== null) { + node.comment = comment; + } + + return node + } + + function lineToTree(...nodes) { + const [root, ...rest] = nodes; + + let parent = root; + + for (const child of rest) { + if (child !== null) { + parent.variations = [child, ...child.variations]; + child.variations = []; + parent = child; + } + } + + return root + } + + function pgn(headers, game) { + if (game.marker && game.marker.comment) { + let node = game.root; + while (true) { + const next = node.variations[0]; + if (!next) { + node.comment = game.marker.comment; + break + } + node = next; + } + } + + return { + headers, + root: game.root, + result: (game.marker && game.marker.result) ?? undefined + } + } + +function peg$subclass(child, parent) { + function C() { this.constructor = child; } + C.prototype = parent.prototype; + child.prototype = new C(); +} + +function peg$SyntaxError(message, expected, found, location) { + var self = Error.call(this, message); + // istanbul ignore next Check is a necessary evil to support older environments + if (Object.setPrototypeOf) { + Object.setPrototypeOf(self, peg$SyntaxError.prototype); + } + self.expected = expected; + self.found = found; + self.location = location; + self.name = "SyntaxError"; + return self; +} + +peg$subclass(peg$SyntaxError, Error); + +function peg$padEnd(str, targetLength, padString) { + padString = padString || " "; + if (str.length > targetLength) { return str; } + targetLength -= str.length; + padString += padString.repeat(targetLength); + return str + padString.slice(0, targetLength); +} + +peg$SyntaxError.prototype.format = function(sources) { + var str = "Error: " + this.message; + if (this.location) { + var src = null; + var k; + for (k = 0; k < sources.length; k++) { + if (sources[k].source === this.location.source) { + src = sources[k].text.split(/\r\n|\n|\r/g); + break; + } + } + var s = this.location.start; + var offset_s = (this.location.source && (typeof this.location.source.offset === "function")) + ? this.location.source.offset(s) + : s; + var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column; + if (src) { + var e = this.location.end; + var filler = peg$padEnd("", offset_s.line.toString().length, ' '); + var line = src[s.line - 1]; + var last = s.line === e.line ? e.column : line.length + 1; + var hatLen = (last - s.column) || 1; + str += "\n --> " + loc + "\n" + + filler + " |\n" + + offset_s.line + " | " + line + "\n" + + filler + " | " + peg$padEnd("", s.column - 1, ' ') + + peg$padEnd("", hatLen, "^"); + } else { + str += "\n at " + loc; + } + } + return str; +}; + +peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + + class: function(expectation) { + var escapedParts = expectation.parts.map(function(part) { + return Array.isArray(part) + ? classEscape(part[0]) + "-" + classEscape(part[1]) + : classEscape(part); + }); + + return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]"; + }, + + any: function() { + return "any character"; + }, + + end: function() { + return "end of input"; + }, + + other: function(expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + function literalEscape(s) { + return s + .replace(/\\/g, "\\\\") + .replace(/"/g, "\\\"") + .replace(/\0/g, "\\0") + .replace(/\t/g, "\\t") + .replace(/\n/g, "\\n") + .replace(/\r/g, "\\r") + .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); + } + + function classEscape(s) { + return s + .replace(/\\/g, "\\\\") + .replace(/\]/g, "\\]") + .replace(/\^/g, "\\^") + .replace(/-/g, "\\-") + .replace(/\0/g, "\\0") + .replace(/\t/g, "\\t") + .replace(/\n/g, "\\n") + .replace(/\r/g, "\\r") + .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = expected.map(describeExpectation); + var i, j; + + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + descriptions.length = j; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; +}; + +function peg$parse(input, options) { + options = options !== undefined ? options : {}; + + var peg$FAILED = {}; + var peg$source = options.grammarSource; + + var peg$startRuleFunctions = { pgn: peg$parsepgn }; + var peg$startRuleFunction = peg$parsepgn; + + var peg$c0 = "["; + var peg$c1 = "\""; + var peg$c2 = "]"; + var peg$c3 = "."; + var peg$c4 = "O-O-O"; + var peg$c5 = "O-O"; + var peg$c6 = "0-0-0"; + var peg$c7 = "0-0"; + var peg$c8 = "$"; + var peg$c9 = "{"; + var peg$c10 = "}"; + var peg$c11 = ";"; + var peg$c12 = "("; + var peg$c13 = ")"; + var peg$c14 = "1-0"; + var peg$c15 = "0-1"; + var peg$c16 = "1/2-1/2"; + var peg$c17 = "*"; + + var peg$r0 = /^[a-zA-Z]/; + var peg$r1 = /^[^"]/; + var peg$r2 = /^[0-9]/; + var peg$r3 = /^[.]/; + var peg$r4 = /^[a-zA-Z1-8\-=]/; + var peg$r5 = /^[+#]/; + var peg$r6 = /^[!?]/; + var peg$r7 = /^[^}]/; + var peg$r8 = /^[^\r\n]/; + var peg$r9 = /^[ \t\r\n]/; + + var peg$e0 = peg$otherExpectation("tag pair"); + var peg$e1 = peg$literalExpectation("[", false); + var peg$e2 = peg$literalExpectation("\"", false); + var peg$e3 = peg$literalExpectation("]", false); + var peg$e4 = peg$otherExpectation("tag name"); + var peg$e5 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false); + var peg$e6 = peg$otherExpectation("tag value"); + var peg$e7 = peg$classExpectation(["\""], true, false); + var peg$e8 = peg$otherExpectation("move number"); + var peg$e9 = peg$classExpectation([["0", "9"]], false, false); + var peg$e10 = peg$literalExpectation(".", false); + var peg$e11 = peg$classExpectation(["."], false, false); + var peg$e12 = peg$otherExpectation("standard algebraic notation"); + var peg$e13 = peg$literalExpectation("O-O-O", false); + var peg$e14 = peg$literalExpectation("O-O", false); + var peg$e15 = peg$literalExpectation("0-0-0", false); + var peg$e16 = peg$literalExpectation("0-0", false); + var peg$e17 = peg$classExpectation([["a", "z"], ["A", "Z"], ["1", "8"], "-", "="], false, false); + var peg$e18 = peg$classExpectation(["+", "#"], false, false); + var peg$e19 = peg$otherExpectation("suffix annotation"); + var peg$e20 = peg$classExpectation(["!", "?"], false, false); + var peg$e21 = peg$otherExpectation("NAG"); + var peg$e22 = peg$literalExpectation("$", false); + var peg$e23 = peg$otherExpectation("brace comment"); + var peg$e24 = peg$literalExpectation("{", false); + var peg$e25 = peg$classExpectation(["}"], true, false); + var peg$e26 = peg$literalExpectation("}", false); + var peg$e27 = peg$otherExpectation("rest of line comment"); + var peg$e28 = peg$literalExpectation(";", false); + var peg$e29 = peg$classExpectation(["\r", "\n"], true, false); + var peg$e30 = peg$otherExpectation("variation"); + var peg$e31 = peg$literalExpectation("(", false); + var peg$e32 = peg$literalExpectation(")", false); + var peg$e33 = peg$otherExpectation("game termination marker"); + var peg$e34 = peg$literalExpectation("1-0", false); + var peg$e35 = peg$literalExpectation("0-1", false); + var peg$e36 = peg$literalExpectation("1/2-1/2", false); + var peg$e37 = peg$literalExpectation("*", false); + var peg$e38 = peg$otherExpectation("whitespace"); + var peg$e39 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false); + + var peg$f0 = function(headers, game) { return pgn(headers, game) }; + var peg$f1 = function(tagPairs) { return Object.fromEntries(tagPairs) }; + var peg$f2 = function(tagName, tagValue) { return [tagName, tagValue] }; + var peg$f3 = function(root, marker) { return { root, marker} }; + var peg$f4 = function(comment, moves) { return lineToTree(rootNode(comment), ...moves.flat()) }; + var peg$f5 = function(san, suffix, nag, comment, variations) { return node(san, suffix, nag, comment, variations) }; + var peg$f6 = function(nag) { return nag }; + var peg$f7 = function(comment) { return comment.replace(/[\r\n]+/g, " ") }; + var peg$f8 = function(comment) { return comment.trim() }; + var peg$f9 = function(line) { return line }; + var peg$f10 = function(result, comment) { return { result, comment } }; + var peg$currPos = options.peg$currPos | 0; + var peg$posDetailsCache = [{ line: 1, column: 1 }]; + var peg$maxFailPos = peg$currPos; + var peg$maxFailExpected = options.peg$maxFailExpected || []; + var peg$silentFails = options.peg$silentFails | 0; + + var peg$result; + + if (options.startRule) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function peg$literalExpectation(text, ignoreCase) { + return { type: "literal", text: text, ignoreCase: ignoreCase }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } + + function peg$endExpectation() { + return { type: "end" }; + } + + function peg$otherExpectation(description) { + return { type: "other", description: description }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos]; + var p; + + if (details) { + return details; + } else { + if (pos >= peg$posDetailsCache.length) { + p = peg$posDetailsCache.length - 1; + } else { + p = pos; + while (!peg$posDetailsCache[--p]) {} + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; + } + + peg$posDetailsCache[pos] = details; + + return details; + } + } + + function peg$computeLocation(startPos, endPos, offset) { + var startPosDetails = peg$computePosDetails(startPos); + var endPosDetails = peg$computePosDetails(endPos); + + var res = { + source: peg$source, + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + return res; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parsepgn() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parsetagPairSection(); + s2 = peg$parsemoveTextSection(); + s0 = peg$f0(s1, s2); + + return s0; + } + + function peg$parsetagPairSection() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = []; + s2 = peg$parsetagPair(); + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parsetagPair(); + } + s2 = peg$parse_(); + s0 = peg$f1(s1); + + return s0; + } + + function peg$parsetagPair() { + var s0, s2, s4, s6, s7, s8, s10; + + peg$silentFails++; + s0 = peg$currPos; + peg$parse_(); + if (input.charCodeAt(peg$currPos) === 91) { + s2 = peg$c0; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e1); } + } + if (s2 !== peg$FAILED) { + peg$parse_(); + s4 = peg$parsetagName(); + if (s4 !== peg$FAILED) { + peg$parse_(); + if (input.charCodeAt(peg$currPos) === 34) { + s6 = peg$c1; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e2); } + } + if (s6 !== peg$FAILED) { + s7 = peg$parsetagValue(); + if (input.charCodeAt(peg$currPos) === 34) { + s8 = peg$c1; + peg$currPos++; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e2); } + } + if (s8 !== peg$FAILED) { + peg$parse_(); + if (input.charCodeAt(peg$currPos) === 93) { + s10 = peg$c2; + peg$currPos++; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e3); } + } + if (s10 !== peg$FAILED) { + s0 = peg$f2(s4, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + if (peg$silentFails === 0) { peg$fail(peg$e0); } + } + + return s0; + } + + function peg$parsetagName() { + var s0, s1, s2; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = input.charAt(peg$currPos); + if (peg$r0.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e5); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = input.charAt(peg$currPos); + if (peg$r0.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e5); } + } + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s0 = input.substring(s0, peg$currPos); + } else { + s0 = s1; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e4); } + } + + return s0; + } + + function peg$parsetagValue() { + var s0, s1, s2; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = input.charAt(peg$currPos); + if (peg$r1.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e7); } + } + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = input.charAt(peg$currPos); + if (peg$r1.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e7); } + } + } + s0 = input.substring(s0, peg$currPos); + peg$silentFails--; + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e6); } + + return s0; + } + + function peg$parsemoveTextSection() { + var s0, s1, s3; + + s0 = peg$currPos; + s1 = peg$parseline(); + peg$parse_(); + s3 = peg$parsegameTerminationMarker(); + if (s3 === peg$FAILED) { + s3 = null; + } + peg$parse_(); + s0 = peg$f3(s1, s3); + + return s0; + } + + function peg$parseline() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsecomment(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = []; + s3 = peg$parsemove(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parsemove(); + } + s0 = peg$f4(s1, s2); + + return s0; + } + + function peg$parsemove() { + var s0, s4, s5, s6, s7, s8, s9, s10; + + s0 = peg$currPos; + peg$parse_(); + peg$parsemoveNumber(); + peg$parse_(); + s4 = peg$parsesan(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesuffixAnnotation(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = []; + s7 = peg$parsenag(); + while (s7 !== peg$FAILED) { + s6.push(s7); + s7 = peg$parsenag(); + } + s7 = peg$parse_(); + s8 = peg$parsecomment(); + if (s8 === peg$FAILED) { + s8 = null; + } + s9 = []; + s10 = peg$parsevariation(); + while (s10 !== peg$FAILED) { + s9.push(s10); + s10 = peg$parsevariation(); + } + s0 = peg$f5(s4, s5, s6, s8, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsemoveNumber() { + var s0, s1, s2, s3, s4, s5; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = input.charAt(peg$currPos); + if (peg$r2.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = input.charAt(peg$currPos); + if (peg$r2.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + } + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c3; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e10); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = []; + s5 = input.charAt(peg$currPos); + if (peg$r3.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e11); } + } + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = input.charAt(peg$currPos); + if (peg$r3.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e11); } + } + } + s1 = [s1, s2, s3, s4]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e8); } + } + + return s0; + } + + function peg$parsesan() { + var s0, s1, s2, s3, s4, s5; + + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c4) { + s2 = peg$c4; + peg$currPos += 5; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e13); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c5) { + s2 = peg$c5; + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e14); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 5) === peg$c6) { + s2 = peg$c6; + peg$currPos += 5; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e15); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c7) { + s2 = peg$c7; + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e16); } + } + if (s2 === peg$FAILED) { + s2 = peg$currPos; + s3 = input.charAt(peg$currPos); + if (peg$r0.test(s3)) { + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e5); } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = input.charAt(peg$currPos); + if (peg$r4.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e17); } + } + if (s5 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = input.charAt(peg$currPos); + if (peg$r4.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e17); } + } + } + } else { + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s3 = [s3, s4]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } + } + } + } + if (s2 !== peg$FAILED) { + s3 = input.charAt(peg$currPos); + if (peg$r5.test(s3)) { + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e18); } + } + if (s3 === peg$FAILED) { + s3 = null; + } + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s0 = input.substring(s0, peg$currPos); + } else { + s0 = s1; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e12); } + } + + return s0; + } + + function peg$parsesuffixAnnotation() { + var s0, s1, s2; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = input.charAt(peg$currPos); + if (peg$r6.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e20); } + } + while (s2 !== peg$FAILED) { + s1.push(s2); + if (s1.length >= 2) { + s2 = peg$FAILED; + } else { + s2 = input.charAt(peg$currPos); + if (peg$r6.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e20); } + } + } + } + if (s1.length < 1) { + peg$currPos = s0; + s0 = peg$FAILED; + } else { + s0 = s1; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e19); } + } + + return s0; + } + + function peg$parsenag() { + var s0, s2, s3, s4, s5; + + peg$silentFails++; + s0 = peg$currPos; + peg$parse_(); + if (input.charCodeAt(peg$currPos) === 36) { + s2 = peg$c8; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e22); } + } + if (s2 !== peg$FAILED) { + s3 = peg$currPos; + s4 = []; + s5 = input.charAt(peg$currPos); + if (peg$r2.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + if (s5 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = input.charAt(peg$currPos); + if (peg$r2.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + } + } else { + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s3 = input.substring(s3, peg$currPos); + } else { + s3 = s4; + } + if (s3 !== peg$FAILED) { + s0 = peg$f6(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + if (peg$silentFails === 0) { peg$fail(peg$e21); } + } + + return s0; + } + + function peg$parsecomment() { + var s0; + + s0 = peg$parsebraceComment(); + if (s0 === peg$FAILED) { + s0 = peg$parserestOfLineComment(); + } + + return s0; + } + + function peg$parsebraceComment() { + var s0, s1, s2, s3, s4; + + peg$silentFails++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 123) { + s1 = peg$c9; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e24); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = []; + s4 = input.charAt(peg$currPos); + if (peg$r7.test(s4)) { + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e25); } + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = input.charAt(peg$currPos); + if (peg$r7.test(s4)) { + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e25); } + } + } + s2 = input.substring(s2, peg$currPos); + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c10; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e26); } + } + if (s3 !== peg$FAILED) { + s0 = peg$f7(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e23); } + } + + return s0; + } + + function peg$parserestOfLineComment() { + var s0, s1, s2, s3, s4; + + peg$silentFails++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 59) { + s1 = peg$c11; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e28); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = []; + s4 = input.charAt(peg$currPos); + if (peg$r8.test(s4)) { + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e29); } + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = input.charAt(peg$currPos); + if (peg$r8.test(s4)) { + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e29); } + } + } + s2 = input.substring(s2, peg$currPos); + s0 = peg$f8(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e27); } + } + + return s0; + } + + function peg$parsevariation() { + var s0, s2, s3, s5; + + peg$silentFails++; + s0 = peg$currPos; + peg$parse_(); + if (input.charCodeAt(peg$currPos) === 40) { + s2 = peg$c12; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e31); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseline(); + if (s3 !== peg$FAILED) { + peg$parse_(); + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c13; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e32); } + } + if (s5 !== peg$FAILED) { + s0 = peg$f9(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + if (peg$silentFails === 0) { peg$fail(peg$e30); } + } + + return s0; + } + + function peg$parsegameTerminationMarker() { + var s0, s1, s3; + + peg$silentFails++; + s0 = peg$currPos; + if (input.substr(peg$currPos, 3) === peg$c14) { + s1 = peg$c14; + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e34); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c15) { + s1 = peg$c15; + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e35); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7) === peg$c16) { + s1 = peg$c16; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e36); } + } + if (s1 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c17; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e37); } + } + } + } + } + if (s1 !== peg$FAILED) { + peg$parse_(); + s3 = peg$parsecomment(); + if (s3 === peg$FAILED) { + s3 = null; + } + s0 = peg$f10(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e33); } + } + + return s0; + } + + function peg$parse_() { + var s0, s1; + + peg$silentFails++; + s0 = []; + s1 = input.charAt(peg$currPos); + if (peg$r9.test(s1)) { + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e39); } + } + while (s1 !== peg$FAILED) { + s0.push(s1); + s1 = input.charAt(peg$currPos); + if (peg$r9.test(s1)) { + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e39); } + } + } + peg$silentFails--; + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e38); } + + return s0; + } + + peg$result = peg$startRuleFunction(); + + if (options.peg$library) { + return /** @type {any} */ ({ + peg$result, + peg$currPos, + peg$FAILED, + peg$maxFailExpected, + peg$maxFailPos + }); + } + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + + throw peg$buildStructuredError( + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); + } +} + +/** + * @license + * Copyright (c) 2025, Jeff Hlywa (jhlywa@gmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +const MASK64 = 0xffffffffffffffffn; +function rotl(x, k) { + return ((x << k) | (x >> (64n - k))) & 0xffffffffffffffffn; +} +function wrappingMul(x, y) { + return (x * y) & MASK64; +} +// xoroshiro128** +function xoroshiro128(state) { + return function () { + let s0 = BigInt(state & MASK64); + let s1 = BigInt((state >> 64n) & MASK64); + const result = wrappingMul(rotl(wrappingMul(s0, 5n), 7n), 9n); + s1 ^= s0; + s0 = (rotl(s0, 24n) ^ s1 ^ (s1 << 16n)) & MASK64; + s1 = rotl(s1, 37n); + state = (s1 << 64n) | s0; + return result; + }; +} +const rand = xoroshiro128(0xa187eb39cdcaed8f31c4b365b102e01en); +const PIECE_KEYS = Array.from({ length: 2 }, () => Array.from({ length: 6 }, () => Array.from({ length: 128 }, () => rand()))); +const EP_KEYS = Array.from({ length: 8 }, () => rand()); +const CASTLING_KEYS = Array.from({ length: 16 }, () => rand()); +const SIDE_KEY = rand(); +const WHITE = 'w'; +const BLACK = 'b'; +const PAWN = 'p'; +const KNIGHT = 'n'; +const BISHOP = 'b'; +const ROOK = 'r'; +const QUEEN = 'q'; +const KING = 'k'; +const DEFAULT_POSITION = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1'; +class Move { + color; + from; + to; + piece; + captured; + promotion; + /** + * @deprecated This field is deprecated and will be removed in version 2.0.0. + * Please use move descriptor functions instead: `isCapture`, `isPromotion`, + * `isEnPassant`, `isKingsideCastle`, `isQueensideCastle`, `isCastle`, and + * `isBigPawn` + */ + flags; + san; + lan; + before; + after; + constructor(chess, internal) { + const { color, piece, from, to, flags, captured, promotion } = internal; + const fromAlgebraic = algebraic(from); + const toAlgebraic = algebraic(to); + this.color = color; + this.piece = piece; + this.from = fromAlgebraic; + this.to = toAlgebraic; + /* + * HACK: The chess['_method']() calls below invoke private methods in the + * Chess class to generate SAN and FEN. It's a bit of a hack, but makes the + * code cleaner elsewhere. + */ + this.san = chess['_moveToSan'](internal, chess['_moves']({ legal: true })); + this.lan = fromAlgebraic + toAlgebraic; + this.before = chess.fen(); + // Generate the FEN for the 'after' key + chess['_makeMove'](internal); + this.after = chess.fen(); + chess['_undoMove'](); + // Build the text representation of the move flags + this.flags = ''; + for (const flag in BITS) { + if (BITS[flag] & flags) { + this.flags += FLAGS[flag]; + } + } + if (captured) { + this.captured = captured; + } + if (promotion) { + this.promotion = promotion; + this.lan += promotion; + } + } + isCapture() { + return this.flags.indexOf(FLAGS['CAPTURE']) > -1; + } + isPromotion() { + return this.flags.indexOf(FLAGS['PROMOTION']) > -1; + } + isEnPassant() { + return this.flags.indexOf(FLAGS['EP_CAPTURE']) > -1; + } + isKingsideCastle() { + return this.flags.indexOf(FLAGS['KSIDE_CASTLE']) > -1; + } + isQueensideCastle() { + return this.flags.indexOf(FLAGS['QSIDE_CASTLE']) > -1; + } + isBigPawn() { + return this.flags.indexOf(FLAGS['BIG_PAWN']) > -1; + } +} +const EMPTY = -1; +const FLAGS = { + NORMAL: 'n', + CAPTURE: 'c', + BIG_PAWN: 'b', + EP_CAPTURE: 'e', + PROMOTION: 'p', + KSIDE_CASTLE: 'k', + QSIDE_CASTLE: 'q', + NULL_MOVE: '-', +}; +// prettier-ignore +const SQUARES = [ + 'a8', 'b8', 'c8', 'd8', 'e8', 'f8', 'g8', 'h8', + 'a7', 'b7', 'c7', 'd7', 'e7', 'f7', 'g7', 'h7', + 'a6', 'b6', 'c6', 'd6', 'e6', 'f6', 'g6', 'h6', + 'a5', 'b5', 'c5', 'd5', 'e5', 'f5', 'g5', 'h5', + 'a4', 'b4', 'c4', 'd4', 'e4', 'f4', 'g4', 'h4', + 'a3', 'b3', 'c3', 'd3', 'e3', 'f3', 'g3', 'h3', + 'a2', 'b2', 'c2', 'd2', 'e2', 'f2', 'g2', 'h2', + 'a1', 'b1', 'c1', 'd1', 'e1', 'f1', 'g1', 'h1' +]; +const BITS = { + NORMAL: 1, + CAPTURE: 2, + BIG_PAWN: 4, + EP_CAPTURE: 8, + PROMOTION: 16, + KSIDE_CASTLE: 32, + QSIDE_CASTLE: 64, + NULL_MOVE: 128, +}; +/* eslint-disable @typescript-eslint/naming-convention */ +// these are required, according to spec +const SEVEN_TAG_ROSTER = { + Event: '?', + Site: '?', + Date: '????.??.??', + Round: '?', + White: '?', + Black: '?', + Result: '*', +}; +/** + * These nulls are placeholders to fix the order of tags (as they appear in PGN spec); null values will be + * eliminated in getHeaders() + */ +const SUPLEMENTAL_TAGS = { + WhiteTitle: null, + BlackTitle: null, + WhiteElo: null, + BlackElo: null, + WhiteUSCF: null, + BlackUSCF: null, + WhiteNA: null, + BlackNA: null, + WhiteType: null, + BlackType: null, + EventDate: null, + EventSponsor: null, + Section: null, + Stage: null, + Board: null, + Opening: null, + Variation: null, + SubVariation: null, + ECO: null, + NIC: null, + Time: null, + UTCTime: null, + UTCDate: null, + TimeControl: null, + SetUp: null, + FEN: null, + Termination: null, + Annotator: null, + Mode: null, + PlyCount: null, +}; +const HEADER_TEMPLATE = { + ...SEVEN_TAG_ROSTER, + ...SUPLEMENTAL_TAGS, +}; +/* eslint-enable @typescript-eslint/naming-convention */ +/* + * NOTES ABOUT 0x88 MOVE GENERATION ALGORITHM + * ---------------------------------------------------------------------------- + * From https://github.com/jhlywa/chess.js/issues/230 + * + * A lot of people are confused when they first see the internal representation + * of chess.js. It uses the 0x88 Move Generation Algorithm which internally + * stores the board as an 8x16 array. This is purely for efficiency but has a + * couple of interesting benefits: + * + * 1. 0x88 offers a very inexpensive "off the board" check. Bitwise AND (&) any + * square with 0x88, if the result is non-zero then the square is off the + * board. For example, assuming a knight square A8 (0 in 0x88 notation), + * there are 8 possible directions in which the knight can move. These + * directions are relative to the 8x16 board and are stored in the + * PIECE_OFFSETS map. One possible move is A8 - 18 (up one square, and two + * squares to the left - which is off the board). 0 - 18 = -18 & 0x88 = 0x88 + * (because of two-complement representation of -18). The non-zero result + * means the square is off the board and the move is illegal. Take the + * opposite move (from A8 to C7), 0 + 18 = 18 & 0x88 = 0. A result of zero + * means the square is on the board. + * + * 2. The relative distance (or difference) between two squares on a 8x16 board + * is unique and can be used to inexpensively determine if a piece on a + * square can attack any other arbitrary square. For example, let's see if a + * pawn on E7 can attack E2. The difference between E7 (20) - E2 (100) is + * -80. We add 119 to make the ATTACKS array index non-negative (because the + * worst case difference is A8 - H1 = -119). The ATTACKS array contains a + * bitmask of pieces that can attack from that distance and direction. + * ATTACKS[-80 + 119=39] gives us 24 or 0b11000 in binary. Look at the + * PIECE_MASKS map to determine the mask for a given piece type. In our pawn + * example, we would check to see if 24 & 0x1 is non-zero, which it is + * not. So, naturally, a pawn on E7 can't attack a piece on E2. However, a + * rook can since 24 & 0x8 is non-zero. The only thing left to check is that + * there are no blocking pieces between E7 and E2. That's where the RAYS + * array comes in. It provides an offset (in this case 16) to add to E7 (20) + * to check for blocking pieces. E7 (20) + 16 = E6 (36) + 16 = E5 (52) etc. + */ +// prettier-ignore +// eslint-disable-next-line +const Ox88 = { + a8: 0, b8: 1, c8: 2, d8: 3, e8: 4, f8: 5, g8: 6, h8: 7, + a7: 16, b7: 17, c7: 18, d7: 19, e7: 20, f7: 21, g7: 22, h7: 23, + a6: 32, b6: 33, c6: 34, d6: 35, e6: 36, f6: 37, g6: 38, h6: 39, + a5: 48, b5: 49, c5: 50, d5: 51, e5: 52, f5: 53, g5: 54, h5: 55, + a4: 64, b4: 65, c4: 66, d4: 67, e4: 68, f4: 69, g4: 70, h4: 71, + a3: 80, b3: 81, c3: 82, d3: 83, e3: 84, f3: 85, g3: 86, h3: 87, + a2: 96, b2: 97, c2: 98, d2: 99, e2: 100, f2: 101, g2: 102, h2: 103, + a1: 112, b1: 113, c1: 114, d1: 115, e1: 116, f1: 117, g1: 118, h1: 119 +}; +const PAWN_OFFSETS = { + b: [16, 32, 17, 15], + w: [-16, -32, -17, -15], +}; +const PIECE_OFFSETS = { + n: [-18, -33, -31, -14, 18, 33, 31, 14], + b: [-17, -15, 17, 15], + r: [-16, 1, 16, -1], + q: [-17, -16, -15, 1, 17, 16, 15, -1], + k: [-17, -16, -15, 1, 17, 16, 15, -1], +}; +// prettier-ignore +const ATTACKS = [ + 20, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 20, 0, + 0, 20, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 20, 0, 0, + 0, 0, 20, 0, 0, 0, 0, 24, 0, 0, 0, 0, 20, 0, 0, 0, + 0, 0, 0, 20, 0, 0, 0, 24, 0, 0, 0, 20, 0, 0, 0, 0, + 0, 0, 0, 0, 20, 0, 0, 24, 0, 0, 20, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 20, 2, 24, 2, 20, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2, 53, 56, 53, 2, 0, 0, 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 56, 0, 56, 24, 24, 24, 24, 24, 24, 0, + 0, 0, 0, 0, 0, 2, 53, 56, 53, 2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 20, 2, 24, 2, 20, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 20, 0, 0, 24, 0, 0, 20, 0, 0, 0, 0, 0, + 0, 0, 0, 20, 0, 0, 0, 24, 0, 0, 0, 20, 0, 0, 0, 0, + 0, 0, 20, 0, 0, 0, 0, 24, 0, 0, 0, 0, 20, 0, 0, 0, + 0, 20, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 20, 0, 0, + 20, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 20 +]; +// prettier-ignore +const RAYS = [ + 17, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 15, 0, + 0, 17, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 15, 0, 0, + 0, 0, 17, 0, 0, 0, 0, 16, 0, 0, 0, 0, 15, 0, 0, 0, + 0, 0, 0, 17, 0, 0, 0, 16, 0, 0, 0, 15, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 0, 0, 16, 0, 0, 15, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 17, 0, 16, 0, 15, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 17, 16, 15, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 0, -1, -1, -1, -1, -1, -1, -1, 0, + 0, 0, 0, 0, 0, 0, -15, -16, -17, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -15, 0, -16, 0, -17, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -15, 0, 0, -16, 0, 0, -17, 0, 0, 0, 0, 0, + 0, 0, 0, -15, 0, 0, 0, -16, 0, 0, 0, -17, 0, 0, 0, 0, + 0, 0, -15, 0, 0, 0, 0, -16, 0, 0, 0, 0, -17, 0, 0, 0, + 0, -15, 0, 0, 0, 0, 0, -16, 0, 0, 0, 0, 0, -17, 0, 0, + -15, 0, 0, 0, 0, 0, 0, -16, 0, 0, 0, 0, 0, 0, -17 +]; +const PIECE_MASKS = { p: 0x1, n: 0x2, b: 0x4, r: 0x8, q: 0x10, k: 0x20 }; +const SYMBOLS = 'pnbrqkPNBRQK'; +const PROMOTIONS = [KNIGHT, BISHOP, ROOK, QUEEN]; +const RANK_1 = 7; +const RANK_2 = 6; +/* + * const RANK_3 = 5 + * const RANK_4 = 4 + * const RANK_5 = 3 + * const RANK_6 = 2 + */ +const RANK_7 = 1; +const RANK_8 = 0; +const SIDES = { + [KING]: BITS.KSIDE_CASTLE, + [QUEEN]: BITS.QSIDE_CASTLE, +}; +const ROOKS = { + w: [ + { square: Ox88.a1, flag: BITS.QSIDE_CASTLE }, + { square: Ox88.h1, flag: BITS.KSIDE_CASTLE }, + ], + b: [ + { square: Ox88.a8, flag: BITS.QSIDE_CASTLE }, + { square: Ox88.h8, flag: BITS.KSIDE_CASTLE }, + ], +}; +const SECOND_RANK = { b: RANK_7, w: RANK_2 }; +const SAN_NULLMOVE = '--'; +// Extracts the zero-based rank of an 0x88 square. +function rank(square) { + return square >> 4; +} +// Extracts the zero-based file of an 0x88 square. +function file(square) { + return square & 0xf; +} +function isDigit(c) { + return '0123456789'.indexOf(c) !== -1; +} +// Converts a 0x88 square to algebraic notation. +function algebraic(square) { + const f = file(square); + const r = rank(square); + return ('abcdefgh'.substring(f, f + 1) + + '87654321'.substring(r, r + 1)); +} +function swapColor(color) { + return color === WHITE ? BLACK : WHITE; +} +function validateFen(fen) { + // 1st criterion: 6 space-seperated fields? + const tokens = fen.split(/\s+/); + if (tokens.length !== 6) { + return { + ok: false, + error: 'Invalid FEN: must contain six space-delimited fields', + }; + } + // 2nd criterion: move number field is a integer value > 0? + const moveNumber = parseInt(tokens[5], 10); + if (isNaN(moveNumber) || moveNumber <= 0) { + return { + ok: false, + error: 'Invalid FEN: move number must be a positive integer', + }; + } + // 3rd criterion: half move counter is an integer >= 0? + const halfMoves = parseInt(tokens[4], 10); + if (isNaN(halfMoves) || halfMoves < 0) { + return { + ok: false, + error: 'Invalid FEN: half move counter number must be a non-negative integer', + }; + } + // 4th criterion: 4th field is a valid e.p.-string? + if (!/^(-|[abcdefgh][36])$/.test(tokens[3])) { + return { ok: false, error: 'Invalid FEN: en-passant square is invalid' }; + } + // 5th criterion: 3th field is a valid castle-string? + if (/[^kKqQ-]/.test(tokens[2])) { + return { ok: false, error: 'Invalid FEN: castling availability is invalid' }; + } + // 6th criterion: 2nd field is "w" (white) or "b" (black)? + if (!/^(w|b)$/.test(tokens[1])) { + return { ok: false, error: 'Invalid FEN: side-to-move is invalid' }; + } + // 7th criterion: 1st field contains 8 rows? + const rows = tokens[0].split('/'); + if (rows.length !== 8) { + return { + ok: false, + error: "Invalid FEN: piece data does not contain 8 '/'-delimited rows", + }; + } + // 8th criterion: every row is valid? + for (let i = 0; i < rows.length; i++) { + // check for right sum of fields AND not two numbers in succession + let sumFields = 0; + let previousWasNumber = false; + for (let k = 0; k < rows[i].length; k++) { + if (isDigit(rows[i][k])) { + if (previousWasNumber) { + return { + ok: false, + error: 'Invalid FEN: piece data is invalid (consecutive number)', + }; + } + sumFields += parseInt(rows[i][k], 10); + previousWasNumber = true; + } + else { + if (!/^[prnbqkPRNBQK]$/.test(rows[i][k])) { + return { + ok: false, + error: 'Invalid FEN: piece data is invalid (invalid piece)', + }; + } + sumFields += 1; + previousWasNumber = false; + } + } + if (sumFields !== 8) { + return { + ok: false, + error: 'Invalid FEN: piece data is invalid (too many squares in rank)', + }; + } + } + // 9th criterion: is en-passant square legal? + if ((tokens[3][1] == '3' && tokens[1] == 'w') || + (tokens[3][1] == '6' && tokens[1] == 'b')) { + return { ok: false, error: 'Invalid FEN: illegal en-passant square' }; + } + // 10th criterion: does chess position contain exact two kings? + const kings = [ + { color: 'white', regex: /K/g }, + { color: 'black', regex: /k/g }, + ]; + for (const { color, regex } of kings) { + if (!regex.test(tokens[0])) { + return { ok: false, error: `Invalid FEN: missing ${color} king` }; + } + if ((tokens[0].match(regex) || []).length > 1) { + return { ok: false, error: `Invalid FEN: too many ${color} kings` }; + } + } + // 11th criterion: are any pawns on the first or eighth rows? + if (Array.from(rows[0] + rows[7]).some((char) => char.toUpperCase() === 'P')) { + return { + ok: false, + error: 'Invalid FEN: some pawns are on the edge rows', + }; + } + return { ok: true }; +} +// this function is used to uniquely identify ambiguous moves +function getDisambiguator(move, moves) { + const from = move.from; + const to = move.to; + const piece = move.piece; + let ambiguities = 0; + let sameRank = 0; + let sameFile = 0; + for (let i = 0, len = moves.length; i < len; i++) { + const ambigFrom = moves[i].from; + const ambigTo = moves[i].to; + const ambigPiece = moves[i].piece; + /* + * if a move of the same piece type ends on the same to square, we'll need + * to add a disambiguator to the algebraic notation + */ + if (piece === ambigPiece && from !== ambigFrom && to === ambigTo) { + ambiguities++; + if (rank(from) === rank(ambigFrom)) { + sameRank++; + } + if (file(from) === file(ambigFrom)) { + sameFile++; + } + } + } + if (ambiguities > 0) { + if (sameRank > 0 && sameFile > 0) { + /* + * if there exists a similar moving piece on the same rank and file as + * the move in question, use the square as the disambiguator + */ + return algebraic(from); + } + else if (sameFile > 0) { + /* + * if the moving piece rests on the same file, use the rank symbol as the + * disambiguator + */ + return algebraic(from).charAt(1); + } + else { + // else use the file symbol + return algebraic(from).charAt(0); + } + } + return ''; +} +function addMove(moves, color, from, to, piece, captured = undefined, flags = BITS.NORMAL) { + const r = rank(to); + if (piece === PAWN && (r === RANK_1 || r === RANK_8)) { + for (let i = 0; i < PROMOTIONS.length; i++) { + const promotion = PROMOTIONS[i]; + moves.push({ + color, + from, + to, + piece, + captured, + promotion, + flags: flags | BITS.PROMOTION, + }); + } + } + else { + moves.push({ + color, + from, + to, + piece, + captured, + flags, + }); + } +} +function inferPieceType(san) { + let pieceType = san.charAt(0); + if (pieceType >= 'a' && pieceType <= 'h') { + const matches = san.match(/[a-h]\d.*[a-h]\d/); + if (matches) { + return undefined; + } + return PAWN; + } + pieceType = pieceType.toLowerCase(); + if (pieceType === 'o') { + return KING; + } + return pieceType; +} +// parses all of the decorators out of a SAN string +function strippedSan(move) { + return move.replace(/=/, '').replace(/[+#]?[?!]*$/, ''); +} +class Chess { + _board = new Array(128); + _turn = WHITE; + _header = {}; + _kings = { w: EMPTY, b: EMPTY }; + _epSquare = -1; + _halfMoves = 0; + _moveNumber = 0; + _history = []; + _comments = {}; + _castling = { w: 0, b: 0 }; + _hash = 0n; + // tracks number of times a position has been seen for repetition checking + _positionCount = new Map(); + constructor(fen = DEFAULT_POSITION, { skipValidation = false } = {}) { + this.load(fen, { skipValidation }); + } + clear({ preserveHeaders = false } = {}) { + this._board = new Array(128); + this._kings = { w: EMPTY, b: EMPTY }; + this._turn = WHITE; + this._castling = { w: 0, b: 0 }; + this._epSquare = EMPTY; + this._halfMoves = 0; + this._moveNumber = 1; + this._history = []; + this._comments = {}; + this._header = preserveHeaders ? this._header : { ...HEADER_TEMPLATE }; + this._hash = this._computeHash(); + this._positionCount = new Map(); + /* + * Delete the SetUp and FEN headers (if preserved), the board is empty and + * these headers don't make sense in this state. They'll get added later + * via .load() or .put() + */ + this._header['SetUp'] = null; + this._header['FEN'] = null; + } + load(fen, { skipValidation = false, preserveHeaders = false } = {}) { + let tokens = fen.split(/\s+/); + // append commonly omitted fen tokens + if (tokens.length >= 2 && tokens.length < 6) { + const adjustments = ['-', '-', '0', '1']; + fen = tokens.concat(adjustments.slice(-(6 - tokens.length))).join(' '); + } + tokens = fen.split(/\s+/); + if (!skipValidation) { + const { ok, error } = validateFen(fen); + if (!ok) { + throw new Error(error); + } + } + const position = tokens[0]; + let square = 0; + this.clear({ preserveHeaders }); + for (let i = 0; i < position.length; i++) { + const piece = position.charAt(i); + if (piece === '/') { + square += 8; + } + else if (isDigit(piece)) { + square += parseInt(piece, 10); + } + else { + const color = piece < 'a' ? WHITE : BLACK; + this._put({ type: piece.toLowerCase(), color }, algebraic(square)); + square++; + } + } + this._turn = tokens[1]; + if (tokens[2].indexOf('K') > -1) { + this._castling.w |= BITS.KSIDE_CASTLE; + } + if (tokens[2].indexOf('Q') > -1) { + this._castling.w |= BITS.QSIDE_CASTLE; + } + if (tokens[2].indexOf('k') > -1) { + this._castling.b |= BITS.KSIDE_CASTLE; + } + if (tokens[2].indexOf('q') > -1) { + this._castling.b |= BITS.QSIDE_CASTLE; + } + this._epSquare = tokens[3] === '-' ? EMPTY : Ox88[tokens[3]]; + this._halfMoves = parseInt(tokens[4], 10); + this._moveNumber = parseInt(tokens[5], 10); + this._hash = this._computeHash(); + this._updateSetup(fen); + this._incPositionCount(); + } + fen({ forceEnpassantSquare = false, } = {}) { + let empty = 0; + let fen = ''; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + if (this._board[i]) { + if (empty > 0) { + fen += empty; + empty = 0; + } + const { color, type: piece } = this._board[i]; + fen += color === WHITE ? piece.toUpperCase() : piece.toLowerCase(); + } + else { + empty++; + } + if ((i + 1) & 0x88) { + if (empty > 0) { + fen += empty; + } + if (i !== Ox88.h1) { + fen += '/'; + } + empty = 0; + i += 8; + } + } + let castling = ''; + if (this._castling[WHITE] & BITS.KSIDE_CASTLE) { + castling += 'K'; + } + if (this._castling[WHITE] & BITS.QSIDE_CASTLE) { + castling += 'Q'; + } + if (this._castling[BLACK] & BITS.KSIDE_CASTLE) { + castling += 'k'; + } + if (this._castling[BLACK] & BITS.QSIDE_CASTLE) { + castling += 'q'; + } + // do we have an empty castling flag? + castling = castling || '-'; + let epSquare = '-'; + /* + * only print the ep square if en passant is a valid move (pawn is present + * and ep capture is not pinned) + */ + if (this._epSquare !== EMPTY) { + if (forceEnpassantSquare) { + epSquare = algebraic(this._epSquare); + } + else { + const bigPawnSquare = this._epSquare + (this._turn === WHITE ? 16 : -16); + const squares = [bigPawnSquare + 1, bigPawnSquare - 1]; + for (const square of squares) { + // is the square off the board? + if (square & 0x88) { + continue; + } + const color = this._turn; + // is there a pawn that can capture the epSquare? + if (this._board[square]?.color === color && + this._board[square]?.type === PAWN) { + // if the pawn makes an ep capture, does it leave its king in check? + this._makeMove({ + color, + from: square, + to: this._epSquare, + piece: PAWN, + captured: PAWN, + flags: BITS.EP_CAPTURE, + }); + const isLegal = !this._isKingAttacked(color); + this._undoMove(); + // if ep is legal, break and set the ep square in the FEN output + if (isLegal) { + epSquare = algebraic(this._epSquare); + break; + } + } + } + } + } + return [ + fen, + this._turn, + castling, + epSquare, + this._halfMoves, + this._moveNumber, + ].join(' '); + } + _pieceKey(i) { + if (!this._board[i]) { + return 0n; + } + const { color, type } = this._board[i]; + const colorIndex = { + w: 0, + b: 1, + }[color]; + const typeIndex = { + p: 0, + n: 1, + b: 2, + r: 3, + q: 4, + k: 5, + }[type]; + return PIECE_KEYS[colorIndex][typeIndex][i]; + } + _epKey() { + return this._epSquare === EMPTY ? 0n : EP_KEYS[this._epSquare & 7]; + } + _castlingKey() { + const index = (this._castling.w >> 5) | (this._castling.b >> 3); + return CASTLING_KEYS[index]; + } + _computeHash() { + let hash = 0n; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + // did we run off the end of the board + if (i & 0x88) { + i += 7; + continue; + } + if (this._board[i]) { + hash ^= this._pieceKey(i); + } + } + hash ^= this._epKey(); + hash ^= this._castlingKey(); + if (this._turn === 'b') { + hash ^= SIDE_KEY; + } + return hash; + } + /* + * Called when the initial board setup is changed with put() or remove(). + * modifies the SetUp and FEN properties of the header object. If the FEN + * is equal to the default position, the SetUp and FEN are deleted the setup + * is only updated if history.length is zero, ie moves haven't been made. + */ + _updateSetup(fen) { + if (this._history.length > 0) + return; + if (fen !== DEFAULT_POSITION) { + this._header['SetUp'] = '1'; + this._header['FEN'] = fen; + } + else { + this._header['SetUp'] = null; + this._header['FEN'] = null; + } + } + reset() { + this.load(DEFAULT_POSITION); + } + get(square) { + return this._board[Ox88[square]]; + } + findPiece(piece) { + const squares = []; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + // did we run off the end of the board + if (i & 0x88) { + i += 7; + continue; + } + // if empty square or wrong color + if (!this._board[i] || this._board[i]?.color !== piece.color) { + continue; + } + // check if square contains the requested piece + if (this._board[i].color === piece.color && + this._board[i].type === piece.type) { + squares.push(algebraic(i)); + } + } + return squares; + } + put({ type, color }, square) { + if (this._put({ type, color }, square)) { + this._updateCastlingRights(); + this._updateEnPassantSquare(); + this._updateSetup(this.fen()); + return true; + } + return false; + } + _set(sq, piece) { + this._hash ^= this._pieceKey(sq); + this._board[sq] = piece; + this._hash ^= this._pieceKey(sq); + } + _put({ type, color }, square) { + // check for piece + if (SYMBOLS.indexOf(type.toLowerCase()) === -1) { + return false; + } + // check for valid square + if (!(square in Ox88)) { + return false; + } + const sq = Ox88[square]; + // don't let the user place more than one king + if (type == KING && + !(this._kings[color] == EMPTY || this._kings[color] == sq)) { + return false; + } + const currentPieceOnSquare = this._board[sq]; + // if one of the kings will be replaced by the piece from args, set the `_kings` respective entry to `EMPTY` + if (currentPieceOnSquare && currentPieceOnSquare.type === KING) { + this._kings[currentPieceOnSquare.color] = EMPTY; + } + this._set(sq, { type: type, color: color }); + if (type === KING) { + this._kings[color] = sq; + } + return true; + } + _clear(sq) { + this._hash ^= this._pieceKey(sq); + delete this._board[sq]; + } + remove(square) { + const piece = this.get(square); + this._clear(Ox88[square]); + if (piece && piece.type === KING) { + this._kings[piece.color] = EMPTY; + } + this._updateCastlingRights(); + this._updateEnPassantSquare(); + this._updateSetup(this.fen()); + return piece; + } + _updateCastlingRights() { + this._hash ^= this._castlingKey(); + const whiteKingInPlace = this._board[Ox88.e1]?.type === KING && + this._board[Ox88.e1]?.color === WHITE; + const blackKingInPlace = this._board[Ox88.e8]?.type === KING && + this._board[Ox88.e8]?.color === BLACK; + if (!whiteKingInPlace || + this._board[Ox88.a1]?.type !== ROOK || + this._board[Ox88.a1]?.color !== WHITE) { + this._castling.w &= -65; + } + if (!whiteKingInPlace || + this._board[Ox88.h1]?.type !== ROOK || + this._board[Ox88.h1]?.color !== WHITE) { + this._castling.w &= -33; + } + if (!blackKingInPlace || + this._board[Ox88.a8]?.type !== ROOK || + this._board[Ox88.a8]?.color !== BLACK) { + this._castling.b &= -65; + } + if (!blackKingInPlace || + this._board[Ox88.h8]?.type !== ROOK || + this._board[Ox88.h8]?.color !== BLACK) { + this._castling.b &= -33; + } + this._hash ^= this._castlingKey(); + } + _updateEnPassantSquare() { + if (this._epSquare === EMPTY) { + return; + } + const startSquare = this._epSquare + (this._turn === WHITE ? -16 : 16); + const currentSquare = this._epSquare + (this._turn === WHITE ? 16 : -16); + const attackers = [currentSquare + 1, currentSquare - 1]; + if (this._board[startSquare] !== null || + this._board[this._epSquare] !== null || + this._board[currentSquare]?.color !== swapColor(this._turn) || + this._board[currentSquare]?.type !== PAWN) { + this._hash ^= this._epKey(); + this._epSquare = EMPTY; + return; + } + const canCapture = (square) => !(square & 0x88) && + this._board[square]?.color === this._turn && + this._board[square]?.type === PAWN; + if (!attackers.some(canCapture)) { + this._hash ^= this._epKey(); + this._epSquare = EMPTY; + } + } + _attacked(color, square, verbose) { + const attackers = []; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + // did we run off the end of the board + if (i & 0x88) { + i += 7; + continue; + } + // if empty square or wrong color + if (this._board[i] === undefined || this._board[i].color !== color) { + continue; + } + const piece = this._board[i]; + const difference = i - square; + // skip - to/from square are the same + if (difference === 0) { + continue; + } + const index = difference + 119; + if (ATTACKS[index] & PIECE_MASKS[piece.type]) { + if (piece.type === PAWN) { + if ((difference > 0 && piece.color === WHITE) || + (difference <= 0 && piece.color === BLACK)) { + if (!verbose) { + return true; + } + else { + attackers.push(algebraic(i)); + } + } + continue; + } + // if the piece is a knight or a king + if (piece.type === 'n' || piece.type === 'k') { + if (!verbose) { + return true; + } + else { + attackers.push(algebraic(i)); + continue; + } + } + const offset = RAYS[index]; + let j = i + offset; + let blocked = false; + while (j !== square) { + if (this._board[j] != null) { + blocked = true; + break; + } + j += offset; + } + if (!blocked) { + if (!verbose) { + return true; + } + else { + attackers.push(algebraic(i)); + continue; + } + } + } + } + if (verbose) { + return attackers; + } + else { + return false; + } + } + attackers(square, attackedBy) { + if (!attackedBy) { + return this._attacked(this._turn, Ox88[square], true); + } + else { + return this._attacked(attackedBy, Ox88[square], true); + } + } + _isKingAttacked(color) { + const square = this._kings[color]; + return square === -1 ? false : this._attacked(swapColor(color), square); + } + hash() { + return this._hash.toString(16); + } + isAttacked(square, attackedBy) { + return this._attacked(attackedBy, Ox88[square]); + } + isCheck() { + return this._isKingAttacked(this._turn); + } + inCheck() { + return this.isCheck(); + } + isCheckmate() { + return this.isCheck() && this._moves().length === 0; + } + isStalemate() { + return !this.isCheck() && this._moves().length === 0; + } + isInsufficientMaterial() { + /* + * k.b. vs k.b. (of opposite colors) with mate in 1: + * 8/8/8/8/1b6/8/B1k5/K7 b - - 0 1 + * + * k.b. vs k.n. with mate in 1: + * 8/8/8/8/1n6/8/B7/K1k5 b - - 2 1 + */ + const pieces = { + b: 0, + n: 0, + r: 0, + q: 0, + k: 0, + p: 0, + }; + const bishops = []; + let numPieces = 0; + let squareColor = 0; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + squareColor = (squareColor + 1) % 2; + if (i & 0x88) { + i += 7; + continue; + } + const piece = this._board[i]; + if (piece) { + pieces[piece.type] = piece.type in pieces ? pieces[piece.type] + 1 : 1; + if (piece.type === BISHOP) { + bishops.push(squareColor); + } + numPieces++; + } + } + // k vs. k + if (numPieces === 2) { + return true; + } + else if ( + // k vs. kn .... or .... k vs. kb + numPieces === 3 && + (pieces[BISHOP] === 1 || pieces[KNIGHT] === 1)) { + return true; + } + else if (numPieces === pieces[BISHOP] + 2) { + // kb vs. kb where any number of bishops are all on the same color + let sum = 0; + const len = bishops.length; + for (let i = 0; i < len; i++) { + sum += bishops[i]; + } + if (sum === 0 || sum === len) { + return true; + } + } + return false; + } + isThreefoldRepetition() { + return this._getPositionCount(this._hash) >= 3; + } + isDrawByFiftyMoves() { + return this._halfMoves >= 100; // 50 moves per side = 100 half moves + } + isDraw() { + return (this.isDrawByFiftyMoves() || + this.isStalemate() || + this.isInsufficientMaterial() || + this.isThreefoldRepetition()); + } + isGameOver() { + return this.isCheckmate() || this.isDraw(); + } + moves({ verbose = false, square = undefined, piece = undefined, } = {}) { + const moves = this._moves({ square, piece }); + if (verbose) { + return moves.map((move) => new Move(this, move)); + } + else { + return moves.map((move) => this._moveToSan(move, moves)); + } + } + _moves({ legal = true, piece = undefined, square = undefined, } = {}) { + const forSquare = square ? square.toLowerCase() : undefined; + const forPiece = piece?.toLowerCase(); + const moves = []; + const us = this._turn; + const them = swapColor(us); + let firstSquare = Ox88.a8; + let lastSquare = Ox88.h1; + let singleSquare = false; + // are we generating moves for a single square? + if (forSquare) { + // illegal square, return empty moves + if (!(forSquare in Ox88)) { + return []; + } + else { + firstSquare = lastSquare = Ox88[forSquare]; + singleSquare = true; + } + } + for (let from = firstSquare; from <= lastSquare; from++) { + // did we run off the end of the board + if (from & 0x88) { + from += 7; + continue; + } + // empty square or opponent, skip + if (!this._board[from] || this._board[from].color === them) { + continue; + } + const { type } = this._board[from]; + let to; + if (type === PAWN) { + if (forPiece && forPiece !== type) + continue; + // single square, non-capturing + to = from + PAWN_OFFSETS[us][0]; + if (!this._board[to]) { + addMove(moves, us, from, to, PAWN); + // double square + to = from + PAWN_OFFSETS[us][1]; + if (SECOND_RANK[us] === rank(from) && !this._board[to]) { + addMove(moves, us, from, to, PAWN, undefined, BITS.BIG_PAWN); + } + } + // pawn captures + for (let j = 2; j < 4; j++) { + to = from + PAWN_OFFSETS[us][j]; + if (to & 0x88) + continue; + if (this._board[to]?.color === them) { + addMove(moves, us, from, to, PAWN, this._board[to].type, BITS.CAPTURE); + } + else if (to === this._epSquare) { + addMove(moves, us, from, to, PAWN, PAWN, BITS.EP_CAPTURE); + } + } + } + else { + if (forPiece && forPiece !== type) + continue; + for (let j = 0, len = PIECE_OFFSETS[type].length; j < len; j++) { + const offset = PIECE_OFFSETS[type][j]; + to = from; + while (true) { + to += offset; + if (to & 0x88) + break; + if (!this._board[to]) { + addMove(moves, us, from, to, type); + } + else { + // own color, stop loop + if (this._board[to].color === us) + break; + addMove(moves, us, from, to, type, this._board[to].type, BITS.CAPTURE); + break; + } + /* break, if knight or king */ + if (type === KNIGHT || type === KING) + break; + } + } + } + } + /* + * check for castling if we're: + * a) generating all moves, or + * b) doing single square move generation on the king's square + */ + if (forPiece === undefined || forPiece === KING) { + if (!singleSquare || lastSquare === this._kings[us]) { + // king-side castling + if (this._castling[us] & BITS.KSIDE_CASTLE) { + const castlingFrom = this._kings[us]; + const castlingTo = castlingFrom + 2; + if (!this._board[castlingFrom + 1] && + !this._board[castlingTo] && + !this._attacked(them, this._kings[us]) && + !this._attacked(them, castlingFrom + 1) && + !this._attacked(them, castlingTo)) { + addMove(moves, us, this._kings[us], castlingTo, KING, undefined, BITS.KSIDE_CASTLE); + } + } + // queen-side castling + if (this._castling[us] & BITS.QSIDE_CASTLE) { + const castlingFrom = this._kings[us]; + const castlingTo = castlingFrom - 2; + if (!this._board[castlingFrom - 1] && + !this._board[castlingFrom - 2] && + !this._board[castlingFrom - 3] && + !this._attacked(them, this._kings[us]) && + !this._attacked(them, castlingFrom - 1) && + !this._attacked(them, castlingTo)) { + addMove(moves, us, this._kings[us], castlingTo, KING, undefined, BITS.QSIDE_CASTLE); + } + } + } + } + /* + * return all pseudo-legal moves (this includes moves that allow the king + * to be captured) + */ + if (!legal || this._kings[us] === -1) { + return moves; + } + // filter out illegal moves + const legalMoves = []; + for (let i = 0, len = moves.length; i < len; i++) { + this._makeMove(moves[i]); + if (!this._isKingAttacked(us)) { + legalMoves.push(moves[i]); + } + this._undoMove(); + } + return legalMoves; + } + move(move, { strict = false } = {}) { + /* + * The move function can be called with in the following parameters: + * + * .move('Nxb7') <- argument is a case-sensitive SAN string + * + * .move({ from: 'h7', <- argument is a move object + * to :'h8', + * promotion: 'q' }) + * + * + * An optional strict argument may be supplied to tell chess.js to + * strictly follow the SAN specification. + */ + let moveObj = null; + if (typeof move === 'string') { + moveObj = this._moveFromSan(move, strict); + } + else if (move === null) { + moveObj = this._moveFromSan(SAN_NULLMOVE, strict); + } + else if (typeof move === 'object') { + const moves = this._moves(); + // convert the pretty move object to an ugly move object + for (let i = 0, len = moves.length; i < len; i++) { + if (move.from === algebraic(moves[i].from) && + move.to === algebraic(moves[i].to) && + (!('promotion' in moves[i]) || move.promotion === moves[i].promotion)) { + moveObj = moves[i]; + break; + } + } + } + // failed to find move + if (!moveObj) { + if (typeof move === 'string') { + throw new Error(`Invalid move: ${move}`); + } + else { + throw new Error(`Invalid move: ${JSON.stringify(move)}`); + } + } + //disallow null moves when in check + if (this.isCheck() && moveObj.flags & BITS.NULL_MOVE) { + throw new Error('Null move not allowed when in check'); + } + /* + * need to make a copy of move because we can't generate SAN after the move + * is made + */ + const prettyMove = new Move(this, moveObj); + this._makeMove(moveObj); + this._incPositionCount(); + return prettyMove; + } + _push(move) { + this._history.push({ + move, + kings: { b: this._kings.b, w: this._kings.w }, + turn: this._turn, + castling: { b: this._castling.b, w: this._castling.w }, + epSquare: this._epSquare, + halfMoves: this._halfMoves, + moveNumber: this._moveNumber, + }); + } + _movePiece(from, to) { + this._hash ^= this._pieceKey(from); + this._board[to] = this._board[from]; + delete this._board[from]; + this._hash ^= this._pieceKey(to); + } + _makeMove(move) { + const us = this._turn; + const them = swapColor(us); + this._push(move); + if (move.flags & BITS.NULL_MOVE) { + if (us === BLACK) { + this._moveNumber++; + } + this._halfMoves++; + this._turn = them; + this._epSquare = EMPTY; + return; + } + this._hash ^= this._epKey(); + this._hash ^= this._castlingKey(); + if (move.captured) { + this._hash ^= this._pieceKey(move.to); + } + this._movePiece(move.from, move.to); + // if ep capture, remove the captured pawn + if (move.flags & BITS.EP_CAPTURE) { + if (this._turn === BLACK) { + this._clear(move.to - 16); + } + else { + this._clear(move.to + 16); + } + } + // if pawn promotion, replace with new piece + if (move.promotion) { + this._clear(move.to); + this._set(move.to, { type: move.promotion, color: us }); + } + // if we moved the king + if (this._board[move.to].type === KING) { + this._kings[us] = move.to; + // if we castled, move the rook next to the king + if (move.flags & BITS.KSIDE_CASTLE) { + const castlingTo = move.to - 1; + const castlingFrom = move.to + 1; + this._movePiece(castlingFrom, castlingTo); + } + else if (move.flags & BITS.QSIDE_CASTLE) { + const castlingTo = move.to + 1; + const castlingFrom = move.to - 2; + this._movePiece(castlingFrom, castlingTo); + } + // turn off castling + this._castling[us] = 0; + } + // turn off castling if we move a rook + if (this._castling[us]) { + for (let i = 0, len = ROOKS[us].length; i < len; i++) { + if (move.from === ROOKS[us][i].square && + this._castling[us] & ROOKS[us][i].flag) { + this._castling[us] ^= ROOKS[us][i].flag; + break; + } + } + } + // turn off castling if we capture a rook + if (this._castling[them]) { + for (let i = 0, len = ROOKS[them].length; i < len; i++) { + if (move.to === ROOKS[them][i].square && + this._castling[them] & ROOKS[them][i].flag) { + this._castling[them] ^= ROOKS[them][i].flag; + break; + } + } + } + this._hash ^= this._castlingKey(); + // if big pawn move, update the en passant square + if (move.flags & BITS.BIG_PAWN) { + let epSquare; + if (us === BLACK) { + epSquare = move.to - 16; + } + else { + epSquare = move.to + 16; + } + if ((!((move.to - 1) & 0x88) && + this._board[move.to - 1]?.type === PAWN && + this._board[move.to - 1]?.color === them) || + (!((move.to + 1) & 0x88) && + this._board[move.to + 1]?.type === PAWN && + this._board[move.to + 1]?.color === them)) { + this._epSquare = epSquare; + this._hash ^= this._epKey(); + } + else { + this._epSquare = EMPTY; + } + } + else { + this._epSquare = EMPTY; + } + // reset the 50 move counter if a pawn is moved or a piece is captured + if (move.piece === PAWN) { + this._halfMoves = 0; + } + else if (move.flags & (BITS.CAPTURE | BITS.EP_CAPTURE)) { + this._halfMoves = 0; + } + else { + this._halfMoves++; + } + if (us === BLACK) { + this._moveNumber++; + } + this._turn = them; + this._hash ^= SIDE_KEY; + } + undo() { + const hash = this._hash; + const move = this._undoMove(); + if (move) { + const prettyMove = new Move(this, move); + this._decPositionCount(hash); + return prettyMove; + } + return null; + } + _undoMove() { + const old = this._history.pop(); + if (old === undefined) { + return null; + } + this._hash ^= this._epKey(); + this._hash ^= this._castlingKey(); + const move = old.move; + this._kings = old.kings; + this._turn = old.turn; + this._castling = old.castling; + this._epSquare = old.epSquare; + this._halfMoves = old.halfMoves; + this._moveNumber = old.moveNumber; + this._hash ^= this._epKey(); + this._hash ^= this._castlingKey(); + this._hash ^= SIDE_KEY; + const us = this._turn; + const them = swapColor(us); + if (move.flags & BITS.NULL_MOVE) { + return move; + } + this._movePiece(move.to, move.from); + // to undo any promotions + if (move.piece) { + this._clear(move.from); + this._set(move.from, { type: move.piece, color: us }); + } + if (move.captured) { + if (move.flags & BITS.EP_CAPTURE) { + // en passant capture + let index; + if (us === BLACK) { + index = move.to - 16; + } + else { + index = move.to + 16; + } + this._set(index, { type: PAWN, color: them }); + } + else { + // regular capture + this._set(move.to, { type: move.captured, color: them }); + } + } + if (move.flags & (BITS.KSIDE_CASTLE | BITS.QSIDE_CASTLE)) { + let castlingTo, castlingFrom; + if (move.flags & BITS.KSIDE_CASTLE) { + castlingTo = move.to + 1; + castlingFrom = move.to - 1; + } + else { + castlingTo = move.to - 2; + castlingFrom = move.to + 1; + } + this._movePiece(castlingFrom, castlingTo); + } + return move; + } + pgn({ newline = '\n', maxWidth = 0, } = {}) { + /* + * using the specification from http://www.chessclub.com/help/PGN-spec + * example for html usage: .pgn({ max_width: 72, newline_char: "
      " }) + */ + const result = []; + let headerExists = false; + /* add the PGN header information */ + for (const i in this._header) { + /* + * TODO: order of enumerated properties in header object is not + * guaranteed, see ECMA-262 spec (section 12.6.4) + * + * By using HEADER_TEMPLATE, the order of tags should be preserved; we + * do have to check for null placeholders, though, and omit them + */ + const headerTag = this._header[i]; + if (headerTag) + result.push(`[${i} "${this._header[i]}"]` + newline); + headerExists = true; + } + if (headerExists && this._history.length) { + result.push(newline); + } + const appendComment = (moveString) => { + const comment = this._comments[this.fen()]; + if (typeof comment !== 'undefined') { + const delimiter = moveString.length > 0 ? ' ' : ''; + moveString = `${moveString}${delimiter}{${comment}}`; + } + return moveString; + }; + // pop all of history onto reversed_history + const reversedHistory = []; + while (this._history.length > 0) { + reversedHistory.push(this._undoMove()); + } + const moves = []; + let moveString = ''; + // special case of a commented starting position with no moves + if (reversedHistory.length === 0) { + moves.push(appendComment('')); + } + // build the list of moves. a move_string looks like: "3. e3 e6" + while (reversedHistory.length > 0) { + moveString = appendComment(moveString); + const move = reversedHistory.pop(); + // make TypeScript stop complaining about move being undefined + if (!move) { + break; + } + // if the position started with black to move, start PGN with #. ... + if (!this._history.length && move.color === 'b') { + const prefix = `${this._moveNumber}. ...`; + // is there a comment preceding the first move? + moveString = moveString ? `${moveString} ${prefix}` : prefix; + } + else if (move.color === 'w') { + // store the previous generated move_string if we have one + if (moveString.length) { + moves.push(moveString); + } + moveString = this._moveNumber + '.'; + } + moveString = + moveString + ' ' + this._moveToSan(move, this._moves({ legal: true })); + this._makeMove(move); + } + // are there any other leftover moves? + if (moveString.length) { + moves.push(appendComment(moveString)); + } + // is there a result? (there ALWAYS has to be a result according to spec; see Seven Tag Roster) + moves.push(this._header.Result || '*'); + /* + * history should be back to what it was before we started generating PGN, + * so join together moves + */ + if (maxWidth === 0) { + return result.join('') + moves.join(' '); + } + // TODO (jah): huh? + const strip = function () { + if (result.length > 0 && result[result.length - 1] === ' ') { + result.pop(); + return true; + } + return false; + }; + // NB: this does not preserve comment whitespace. + const wrapComment = function (width, move) { + for (const token of move.split(' ')) { + if (!token) { + continue; + } + if (width + token.length > maxWidth) { + while (strip()) { + width--; + } + result.push(newline); + width = 0; + } + result.push(token); + width += token.length; + result.push(' '); + width++; + } + if (strip()) { + width--; + } + return width; + }; + // wrap the PGN output at max_width + let currentWidth = 0; + for (let i = 0; i < moves.length; i++) { + if (currentWidth + moves[i].length > maxWidth) { + if (moves[i].includes('{')) { + currentWidth = wrapComment(currentWidth, moves[i]); + continue; + } + } + // if the current move will push past max_width + if (currentWidth + moves[i].length > maxWidth && i !== 0) { + // don't end the line with whitespace + if (result[result.length - 1] === ' ') { + result.pop(); + } + result.push(newline); + currentWidth = 0; + } + else if (i !== 0) { + result.push(' '); + currentWidth++; + } + result.push(moves[i]); + currentWidth += moves[i].length; + } + return result.join(''); + } + /** + * @deprecated Use `setHeader` and `getHeaders` instead. This method will return null header tags (which is not what you want) + */ + header(...args) { + for (let i = 0; i < args.length; i += 2) { + if (typeof args[i] === 'string' && typeof args[i + 1] === 'string') { + this._header[args[i]] = args[i + 1]; + } + } + return this._header; + } + // TODO: value validation per spec + setHeader(key, value) { + this._header[key] = value ?? SEVEN_TAG_ROSTER[key] ?? null; + return this.getHeaders(); + } + removeHeader(key) { + if (key in this._header) { + this._header[key] = SEVEN_TAG_ROSTER[key] || null; + return true; + } + return false; + } + // return only non-null headers (omit placemarker nulls) + getHeaders() { + const nonNullHeaders = {}; + for (const [key, value] of Object.entries(this._header)) { + if (value !== null) { + nonNullHeaders[key] = value; + } + } + return nonNullHeaders; + } + loadPgn(pgn, { strict = false, newlineChar = '\r?\n', } = {}) { + // If newlineChar is not the default, replace all instances with \n + if (newlineChar !== '\r?\n') { + pgn = pgn.replace(new RegExp(newlineChar, 'g'), '\n'); + } + const parsedPgn = peg$parse(pgn); + // Put the board in the starting position + this.reset(); + // parse PGN header + const headers = parsedPgn.headers; + let fen = ''; + for (const key in headers) { + // check to see user is including fen (possibly with wrong tag case) + if (key.toLowerCase() === 'fen') { + fen = headers[key]; + } + this.header(key, headers[key]); + } + /* + * the permissive parser should attempt to load a fen tag, even if it's the + * wrong case and doesn't include a corresponding [SetUp "1"] tag + */ + if (!strict) { + if (fen) { + this.load(fen, { preserveHeaders: true }); + } + } + else { + /* + * strict parser - load the starting position indicated by [Setup '1'] + * and [FEN position] + */ + if (headers['SetUp'] === '1') { + if (!('FEN' in headers)) { + throw new Error('Invalid PGN: FEN tag must be supplied with SetUp tag'); + } + // don't clear the headers when loading + this.load(headers['FEN'], { preserveHeaders: true }); + } + } + let node = parsedPgn.root; + while (node) { + if (node.move) { + const move = this._moveFromSan(node.move, strict); + if (move == null) { + throw new Error(`Invalid move in PGN: ${node.move}`); + } + else { + this._makeMove(move); + this._incPositionCount(); + } + } + if (node.comment !== undefined) { + this._comments[this.fen()] = node.comment; + } + node = node.variations[0]; + } + /* + * Per section 8.2.6 of the PGN spec, the Result tag pair must match match + * the termination marker. Only do this when headers are present, but the + * result tag is missing + */ + const result = parsedPgn.result; + if (result && + Object.keys(this._header).length && + this._header['Result'] !== result) { + this.setHeader('Result', result); + } + } + /* + * Convert a move from 0x88 coordinates to Standard Algebraic Notation + * (SAN) + * + * @param {boolean} strict Use the strict SAN parser. It will throw errors + * on overly disambiguated moves (see below): + * + * r1bqkbnr/ppp2ppp/2n5/1B1pP3/4P3/8/PPPP2PP/RNBQK1NR b KQkq - 2 4 + * 4. ... Nge7 is overly disambiguated because the knight on c6 is pinned + * 4. ... Ne7 is technically the valid SAN + */ + _moveToSan(move, moves) { + let output = ''; + if (move.flags & BITS.KSIDE_CASTLE) { + output = 'O-O'; + } + else if (move.flags & BITS.QSIDE_CASTLE) { + output = 'O-O-O'; + } + else if (move.flags & BITS.NULL_MOVE) { + return SAN_NULLMOVE; + } + else { + if (move.piece !== PAWN) { + const disambiguator = getDisambiguator(move, moves); + output += move.piece.toUpperCase() + disambiguator; + } + if (move.flags & (BITS.CAPTURE | BITS.EP_CAPTURE)) { + if (move.piece === PAWN) { + output += algebraic(move.from)[0]; + } + output += 'x'; + } + output += algebraic(move.to); + if (move.promotion) { + output += '=' + move.promotion.toUpperCase(); + } + } + this._makeMove(move); + if (this.isCheck()) { + if (this.isCheckmate()) { + output += '#'; + } + else { + output += '+'; + } + } + this._undoMove(); + return output; + } + // convert a move from Standard Algebraic Notation (SAN) to 0x88 coordinates + _moveFromSan(move, strict = false) { + // strip off any move decorations: e.g Nf3+?! becomes Nf3 + let cleanMove = strippedSan(move); + if (!strict) { + if (cleanMove === '0-0') { + cleanMove = 'O-O'; + } + else if (cleanMove === '0-0-0') { + cleanMove = 'O-O-O'; + } + } + //first implementation of null with a dummy move (black king moves from a8 to a8), maybe this can be implemented better + if (cleanMove == SAN_NULLMOVE) { + const res = { + color: this._turn, + from: 0, + to: 0, + piece: 'k', + flags: BITS.NULL_MOVE, + }; + return res; + } + let pieceType = inferPieceType(cleanMove); + let moves = this._moves({ legal: true, piece: pieceType }); + // strict parser + for (let i = 0, len = moves.length; i < len; i++) { + if (cleanMove === strippedSan(this._moveToSan(moves[i], moves))) { + return moves[i]; + } + } + // the strict parser failed + if (strict) { + return null; + } + let piece = undefined; + let matches = undefined; + let from = undefined; + let to = undefined; + let promotion = undefined; + /* + * The default permissive (non-strict) parser allows the user to parse + * non-standard chess notations. This parser is only run after the strict + * Standard Algebraic Notation (SAN) parser has failed. + * + * When running the permissive parser, we'll run a regex to grab the piece, the + * to/from square, and an optional promotion piece. This regex will + * parse common non-standard notation like: Pe2-e4, Rc1c4, Qf3xf7, + * f7f8q, b1c3 + * + * NOTE: Some positions and moves may be ambiguous when using the permissive + * parser. For example, in this position: 6k1/8/8/B7/8/8/8/BN4K1 w - - 0 1, + * the move b1c3 may be interpreted as Nc3 or B1c3 (a disambiguated bishop + * move). In these cases, the permissive parser will default to the most + * basic interpretation (which is b1c3 parsing to Nc3). + */ + let overlyDisambiguated = false; + matches = cleanMove.match(/([pnbrqkPNBRQK])?([a-h][1-8])x?-?([a-h][1-8])([qrbnQRBN])?/); + if (matches) { + piece = matches[1]; + from = matches[2]; + to = matches[3]; + promotion = matches[4]; + if (from.length == 1) { + overlyDisambiguated = true; + } + } + else { + /* + * The [a-h]?[1-8]? portion of the regex below handles moves that may be + * overly disambiguated (e.g. Nge7 is unnecessary and non-standard when + * there is one legal knight move to e7). In this case, the value of + * 'from' variable will be a rank or file, not a square. + */ + matches = cleanMove.match(/([pnbrqkPNBRQK])?([a-h]?[1-8]?)x?-?([a-h][1-8])([qrbnQRBN])?/); + if (matches) { + piece = matches[1]; + from = matches[2]; + to = matches[3]; + promotion = matches[4]; + if (from.length == 1) { + overlyDisambiguated = true; + } + } + } + pieceType = inferPieceType(cleanMove); + moves = this._moves({ + legal: true, + piece: piece ? piece : pieceType, + }); + if (!to) { + return null; + } + for (let i = 0, len = moves.length; i < len; i++) { + if (!from) { + // if there is no from square, it could be just 'x' missing from a capture + if (cleanMove === + strippedSan(this._moveToSan(moves[i], moves)).replace('x', '')) { + return moves[i]; + } + // hand-compare move properties with the results from our permissive regex + } + else if ((!piece || piece.toLowerCase() == moves[i].piece) && + Ox88[from] == moves[i].from && + Ox88[to] == moves[i].to && + (!promotion || promotion.toLowerCase() == moves[i].promotion)) { + return moves[i]; + } + else if (overlyDisambiguated) { + /* + * SPECIAL CASE: we parsed a move string that may have an unneeded + * rank/file disambiguator (e.g. Nge7). The 'from' variable will + */ + const square = algebraic(moves[i].from); + if ((!piece || piece.toLowerCase() == moves[i].piece) && + Ox88[to] == moves[i].to && + (from == square[0] || from == square[1]) && + (!promotion || promotion.toLowerCase() == moves[i].promotion)) { + return moves[i]; + } + } + } + return null; + } + ascii() { + let s = ' +------------------------+\n'; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + // display the rank + if (file(i) === 0) { + s += ' ' + '87654321'[rank(i)] + ' |'; + } + if (this._board[i]) { + const piece = this._board[i].type; + const color = this._board[i].color; + const symbol = color === WHITE ? piece.toUpperCase() : piece.toLowerCase(); + s += ' ' + symbol + ' '; + } + else { + s += ' . '; + } + if ((i + 1) & 0x88) { + s += '|\n'; + i += 8; + } + } + s += ' +------------------------+\n'; + s += ' a b c d e f g h'; + return s; + } + perft(depth) { + const moves = this._moves({ legal: false }); + let nodes = 0; + const color = this._turn; + for (let i = 0, len = moves.length; i < len; i++) { + this._makeMove(moves[i]); + if (!this._isKingAttacked(color)) { + if (depth - 1 > 0) { + nodes += this.perft(depth - 1); + } + else { + nodes++; + } + } + this._undoMove(); + } + return nodes; + } + setTurn(color) { + if (this._turn == color) { + return false; + } + this.move('--'); + return true; + } + turn() { + return this._turn; + } + board() { + const output = []; + let row = []; + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + if (this._board[i] == null) { + row.push(null); + } + else { + row.push({ + square: algebraic(i), + type: this._board[i].type, + color: this._board[i].color, + }); + } + if ((i + 1) & 0x88) { + output.push(row); + row = []; + i += 8; + } + } + return output; + } + squareColor(square) { + if (square in Ox88) { + const sq = Ox88[square]; + return (rank(sq) + file(sq)) % 2 === 0 ? 'light' : 'dark'; + } + return null; + } + history({ verbose = false } = {}) { + const reversedHistory = []; + const moveHistory = []; + while (this._history.length > 0) { + reversedHistory.push(this._undoMove()); + } + while (true) { + const move = reversedHistory.pop(); + if (!move) { + break; + } + if (verbose) { + moveHistory.push(new Move(this, move)); + } + else { + moveHistory.push(this._moveToSan(move, this._moves())); + } + this._makeMove(move); + } + return moveHistory; + } + /* + * Keeps track of position occurrence counts for the purpose of repetition + * checking. Old positions are removed from the map if their counts are reduced to 0. + */ + _getPositionCount(hash) { + return this._positionCount.get(hash) ?? 0; + } + _incPositionCount() { + this._positionCount.set(this._hash, (this._positionCount.get(this._hash) ?? 0) + 1); + } + _decPositionCount(hash) { + const currentCount = this._positionCount.get(hash) ?? 0; + if (currentCount === 1) { + this._positionCount.delete(hash); + } + else { + this._positionCount.set(hash, currentCount - 1); + } + } + _pruneComments() { + const reversedHistory = []; + const currentComments = {}; + const copyComment = (fen) => { + if (fen in this._comments) { + currentComments[fen] = this._comments[fen]; + } + }; + while (this._history.length > 0) { + reversedHistory.push(this._undoMove()); + } + copyComment(this.fen()); + while (true) { + const move = reversedHistory.pop(); + if (!move) { + break; + } + this._makeMove(move); + copyComment(this.fen()); + } + this._comments = currentComments; + } + getComment() { + return this._comments[this.fen()]; + } + setComment(comment) { + this._comments[this.fen()] = comment.replace('{', '[').replace('}', ']'); + } + /** + * @deprecated Renamed to `removeComment` for consistency + */ + deleteComment() { + return this.removeComment(); + } + removeComment() { + const comment = this._comments[this.fen()]; + delete this._comments[this.fen()]; + return comment; + } + getComments() { + this._pruneComments(); + return Object.keys(this._comments).map((fen) => { + return { fen: fen, comment: this._comments[fen] }; + }); + } + /** + * @deprecated Renamed to `removeComments` for consistency + */ + deleteComments() { + return this.removeComments(); + } + removeComments() { + this._pruneComments(); + return Object.keys(this._comments).map((fen) => { + const comment = this._comments[fen]; + delete this._comments[fen]; + return { fen: fen, comment: comment }; + }); + } + setCastlingRights(color, rights) { + for (const side of [KING, QUEEN]) { + if (rights[side] !== undefined) { + if (rights[side]) { + this._castling[color] |= SIDES[side]; + } + else { + this._castling[color] &= ~SIDES[side]; + } + } + } + this._updateCastlingRights(); + const result = this.getCastlingRights(color); + return ((rights[KING] === undefined || rights[KING] === result[KING]) && + (rights[QUEEN] === undefined || rights[QUEEN] === result[QUEEN])); + } + getCastlingRights(color) { + return { + [KING]: (this._castling[color] & SIDES[KING]) !== 0, + [QUEEN]: (this._castling[color] & SIDES[QUEEN]) !== 0, + }; + } + moveNumber() { + return this._moveNumber; + } +} + +export { BISHOP, BLACK, Chess, DEFAULT_POSITION, KING, KNIGHT, Move, PAWN, QUEEN, ROOK, SEVEN_TAG_ROSTER, SQUARES, WHITE, validateFen, xoroshiro128 }; +//# sourceMappingURL=chess.js.map diff --git a/node_modules/chess.js/dist/esm/chess.js.map b/node_modules/chess.js/dist/esm/chess.js.map new file mode 100644 index 0000000..7ec4d8b --- /dev/null +++ b/node_modules/chess.js/dist/esm/chess.js.map @@ -0,0 +1 @@ +{"version":3,"file":"chess.js","sources":["../../src/pgn.js","../../../src/chess.ts"],"sourcesContent":["// @generated by Peggy 4.2.0.\n//\n// https://peggyjs.org/\n\n\n\n function rootNode(comment) {\n \treturn comment !== null ? { comment, variations: [] } : { variations: []}\n }\n\n function node(move, suffix, nag, comment, variations) {\n \tconst node = { move, variations }\n\n if (suffix) {\n \tnode.suffix = suffix\n }\n\n if (nag) {\n \tnode.nag = nag\n }\n\n if (comment !== null) {\n \tnode.comment = comment\n }\n\n return node\n }\n\n function lineToTree(...nodes) {\n \tconst [root, ...rest] = nodes;\n\n let parent = root\n\n for (const child of rest) {\n \tif (child !== null) {\n \tparent.variations = [child, ...child.variations]\n child.variations = []\n parent = child\n }\n }\n\n \treturn root\n }\n\n function pgn(headers, game) {\n \tif (game.marker && game.marker.comment) {\n \tlet node = game.root\n while (true) {\n \tconst next = node.variations[0]\n if (!next) {\n \tnode.comment = game.marker.comment\n \tbreak\n }\n node = next\n }\n }\n\n \treturn {\n \theaders,\n root: game.root,\n result: (game.marker && game.marker.result) ?? undefined\n }\n }\n\nfunction peg$subclass(child, parent) {\n function C() { this.constructor = child; }\n C.prototype = parent.prototype;\n child.prototype = new C();\n}\n\nfunction peg$SyntaxError(message, expected, found, location) {\n var self = Error.call(this, message);\n // istanbul ignore next Check is a necessary evil to support older environments\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(self, peg$SyntaxError.prototype);\n }\n self.expected = expected;\n self.found = found;\n self.location = location;\n self.name = \"SyntaxError\";\n return self;\n}\n\npeg$subclass(peg$SyntaxError, Error);\n\nfunction peg$padEnd(str, targetLength, padString) {\n padString = padString || \" \";\n if (str.length > targetLength) { return str; }\n targetLength -= str.length;\n padString += padString.repeat(targetLength);\n return str + padString.slice(0, targetLength);\n}\n\npeg$SyntaxError.prototype.format = function(sources) {\n var str = \"Error: \" + this.message;\n if (this.location) {\n var src = null;\n var k;\n for (k = 0; k < sources.length; k++) {\n if (sources[k].source === this.location.source) {\n src = sources[k].text.split(/\\r\\n|\\n|\\r/g);\n break;\n }\n }\n var s = this.location.start;\n var offset_s = (this.location.source && (typeof this.location.source.offset === \"function\"))\n ? this.location.source.offset(s)\n : s;\n var loc = this.location.source + \":\" + offset_s.line + \":\" + offset_s.column;\n if (src) {\n var e = this.location.end;\n var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');\n var line = src[s.line - 1];\n var last = s.line === e.line ? e.column : line.length + 1;\n var hatLen = (last - s.column) || 1;\n str += \"\\n --> \" + loc + \"\\n\"\n + filler + \" |\\n\"\n + offset_s.line + \" | \" + line + \"\\n\"\n + filler + \" | \" + peg$padEnd(\"\", s.column - 1, ' ')\n + peg$padEnd(\"\", hatLen, \"^\");\n } else {\n str += \"\\n at \" + loc;\n }\n }\n return str;\n};\n\npeg$SyntaxError.buildMessage = function(expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function(expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n\n class: function(expectation) {\n var escapedParts = expectation.parts.map(function(part) {\n return Array.isArray(part)\n ? classEscape(part[0]) + \"-\" + classEscape(part[1])\n : classEscape(part);\n });\n\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts.join(\"\") + \"]\";\n },\n\n any: function() {\n return \"any character\";\n },\n\n end: function() {\n return \"end of input\";\n },\n\n other: function(expectation) {\n return expectation.description;\n }\n };\n\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\"/g, \"\\\\\\\"\")\n .replace(/\\0/g, \"\\\\0\")\n .replace(/\\t/g, \"\\\\t\")\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/[\\x00-\\x0F]/g, function(ch) { return \"\\\\x0\" + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return \"\\\\x\" + hex(ch); });\n }\n\n function classEscape(s) {\n return s\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\\]/g, \"\\\\]\")\n .replace(/\\^/g, \"\\\\^\")\n .replace(/-/g, \"\\\\-\")\n .replace(/\\0/g, \"\\\\0\")\n .replace(/\\t/g, \"\\\\t\")\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/[\\x00-\\x0F]/g, function(ch) { return \"\\\\x0\" + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return \"\\\\x\" + hex(ch); });\n }\n\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n\n function describeExpected(expected) {\n var descriptions = expected.map(describeExpectation);\n var i, j;\n\n descriptions.sort();\n\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n};\n\nfunction peg$parse(input, options) {\n options = options !== undefined ? options : {};\n\n var peg$FAILED = {};\n var peg$source = options.grammarSource;\n\n var peg$startRuleFunctions = { pgn: peg$parsepgn };\n var peg$startRuleFunction = peg$parsepgn;\n\n var peg$c0 = \"[\";\n var peg$c1 = \"\\\"\";\n var peg$c2 = \"]\";\n var peg$c3 = \".\";\n var peg$c4 = \"O-O-O\";\n var peg$c5 = \"O-O\";\n var peg$c6 = \"0-0-0\";\n var peg$c7 = \"0-0\";\n var peg$c8 = \"$\";\n var peg$c9 = \"{\";\n var peg$c10 = \"}\";\n var peg$c11 = \";\";\n var peg$c12 = \"(\";\n var peg$c13 = \")\";\n var peg$c14 = \"1-0\";\n var peg$c15 = \"0-1\";\n var peg$c16 = \"1/2-1/2\";\n var peg$c17 = \"*\";\n\n var peg$r0 = /^[a-zA-Z]/;\n var peg$r1 = /^[^\"]/;\n var peg$r2 = /^[0-9]/;\n var peg$r3 = /^[.]/;\n var peg$r4 = /^[a-zA-Z1-8\\-=]/;\n var peg$r5 = /^[+#]/;\n var peg$r6 = /^[!?]/;\n var peg$r7 = /^[^}]/;\n var peg$r8 = /^[^\\r\\n]/;\n var peg$r9 = /^[ \\t\\r\\n]/;\n\n var peg$e0 = peg$otherExpectation(\"tag pair\");\n var peg$e1 = peg$literalExpectation(\"[\", false);\n var peg$e2 = peg$literalExpectation(\"\\\"\", false);\n var peg$e3 = peg$literalExpectation(\"]\", false);\n var peg$e4 = peg$otherExpectation(\"tag name\");\n var peg$e5 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"]], false, false);\n var peg$e6 = peg$otherExpectation(\"tag value\");\n var peg$e7 = peg$classExpectation([\"\\\"\"], true, false);\n var peg$e8 = peg$otherExpectation(\"move number\");\n var peg$e9 = peg$classExpectation([[\"0\", \"9\"]], false, false);\n var peg$e10 = peg$literalExpectation(\".\", false);\n var peg$e11 = peg$classExpectation([\".\"], false, false);\n var peg$e12 = peg$otherExpectation(\"standard algebraic notation\");\n var peg$e13 = peg$literalExpectation(\"O-O-O\", false);\n var peg$e14 = peg$literalExpectation(\"O-O\", false);\n var peg$e15 = peg$literalExpectation(\"0-0-0\", false);\n var peg$e16 = peg$literalExpectation(\"0-0\", false);\n var peg$e17 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"], [\"1\", \"8\"], \"-\", \"=\"], false, false);\n var peg$e18 = peg$classExpectation([\"+\", \"#\"], false, false);\n var peg$e19 = peg$otherExpectation(\"suffix annotation\");\n var peg$e20 = peg$classExpectation([\"!\", \"?\"], false, false);\n var peg$e21 = peg$otherExpectation(\"NAG\");\n var peg$e22 = peg$literalExpectation(\"$\", false);\n var peg$e23 = peg$otherExpectation(\"brace comment\");\n var peg$e24 = peg$literalExpectation(\"{\", false);\n var peg$e25 = peg$classExpectation([\"}\"], true, false);\n var peg$e26 = peg$literalExpectation(\"}\", false);\n var peg$e27 = peg$otherExpectation(\"rest of line comment\");\n var peg$e28 = peg$literalExpectation(\";\", false);\n var peg$e29 = peg$classExpectation([\"\\r\", \"\\n\"], true, false);\n var peg$e30 = peg$otherExpectation(\"variation\");\n var peg$e31 = peg$literalExpectation(\"(\", false);\n var peg$e32 = peg$literalExpectation(\")\", false);\n var peg$e33 = peg$otherExpectation(\"game termination marker\");\n var peg$e34 = peg$literalExpectation(\"1-0\", false);\n var peg$e35 = peg$literalExpectation(\"0-1\", false);\n var peg$e36 = peg$literalExpectation(\"1/2-1/2\", false);\n var peg$e37 = peg$literalExpectation(\"*\", false);\n var peg$e38 = peg$otherExpectation(\"whitespace\");\n var peg$e39 = peg$classExpectation([\" \", \"\\t\", \"\\r\", \"\\n\"], false, false);\n\n var peg$f0 = function(headers, game) { return pgn(headers, game) };\n var peg$f1 = function(tagPairs) { return Object.fromEntries(tagPairs) };\n var peg$f2 = function(tagName, tagValue) { return [tagName, tagValue] };\n var peg$f3 = function(root, marker) { return { root, marker} };\n var peg$f4 = function(comment, moves) { return lineToTree(rootNode(comment), ...moves.flat()) };\n var peg$f5 = function(san, suffix, nag, comment, variations) { return node(san, suffix, nag, comment, variations) };\n var peg$f6 = function(nag) { return nag };\n var peg$f7 = function(comment) { return comment.replace(/[\\r\\n]+/g, \" \") };\n var peg$f8 = function(comment) { return comment.trim() };\n var peg$f9 = function(line) { return line };\n var peg$f10 = function(result, comment) { return { result, comment } };\n var peg$currPos = options.peg$currPos | 0;\n var peg$savedPos = peg$currPos;\n var peg$posDetailsCache = [{ line: 1, column: 1 }];\n var peg$maxFailPos = peg$currPos;\n var peg$maxFailExpected = options.peg$maxFailExpected || [];\n var peg$silentFails = options.peg$silentFails | 0;\n\n var peg$result;\n\n if (options.startRule) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function offset() {\n return peg$savedPos;\n }\n\n function range() {\n return {\n source: peg$source,\n start: peg$savedPos,\n end: peg$currPos\n };\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location = location !== undefined\n ? location\n : peg$computeLocation(peg$savedPos, peg$currPos);\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location\n );\n }\n\n function error(message, location) {\n location = location !== undefined\n ? location\n : peg$computeLocation(peg$savedPos, peg$currPos);\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos];\n var p;\n\n if (details) {\n return details;\n } else {\n if (pos >= peg$posDetailsCache.length) {\n p = peg$posDetailsCache.length - 1;\n } else {\n p = pos;\n while (!peg$posDetailsCache[--p]) {}\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos, offset) {\n var startPosDetails = peg$computePosDetails(startPos);\n var endPosDetails = peg$computePosDetails(endPos);\n\n var res = {\n source: peg$source,\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n if (offset && peg$source && (typeof peg$source.offset === \"function\")) {\n res.start = peg$source.offset(res.start);\n res.end = peg$source.offset(res.end);\n }\n return res;\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) { return; }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location\n );\n }\n\n function peg$parsepgn() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsetagPairSection();\n s2 = peg$parsemoveTextSection();\n peg$savedPos = s0;\n s0 = peg$f0(s1, s2);\n\n return s0;\n }\n\n function peg$parsetagPairSection() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsetagPair();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsetagPair();\n }\n s2 = peg$parse_();\n peg$savedPos = s0;\n s0 = peg$f1(s1);\n\n return s0;\n }\n\n function peg$parsetagPair() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (input.charCodeAt(peg$currPos) === 91) {\n s2 = peg$c0;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e1); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n s4 = peg$parsetagName();\n if (s4 !== peg$FAILED) {\n s5 = peg$parse_();\n if (input.charCodeAt(peg$currPos) === 34) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e2); }\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$parsetagValue();\n if (input.charCodeAt(peg$currPos) === 34) {\n s8 = peg$c1;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e2); }\n }\n if (s8 !== peg$FAILED) {\n s9 = peg$parse_();\n if (input.charCodeAt(peg$currPos) === 93) {\n s10 = peg$c2;\n peg$currPos++;\n } else {\n s10 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e3); }\n }\n if (s10 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f2(s4, s7);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e0); }\n }\n\n return s0;\n }\n\n function peg$parsetagName() {\n var s0, s1, s2;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = [];\n s2 = input.charAt(peg$currPos);\n if (peg$r0.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e5); }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = input.charAt(peg$currPos);\n if (peg$r0.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e5); }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e4); }\n }\n\n return s0;\n }\n\n function peg$parsetagValue() {\n var s0, s1, s2;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = [];\n s2 = input.charAt(peg$currPos);\n if (peg$r1.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e7); }\n }\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = input.charAt(peg$currPos);\n if (peg$r1.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e7); }\n }\n }\n s0 = input.substring(s0, peg$currPos);\n peg$silentFails--;\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e6); }\n\n return s0;\n }\n\n function peg$parsemoveTextSection() {\n var s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = peg$parseline();\n s2 = peg$parse_();\n s3 = peg$parsegameTerminationMarker();\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n s4 = peg$parse_();\n peg$savedPos = s0;\n s0 = peg$f3(s1, s3);\n\n return s0;\n }\n\n function peg$parseline() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = peg$parsecomment();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n s2 = [];\n s3 = peg$parsemove();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsemove();\n }\n peg$savedPos = s0;\n s0 = peg$f4(s1, s2);\n\n return s0;\n }\n\n function peg$parsemove() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;\n\n s0 = peg$currPos;\n s1 = peg$parse_();\n s2 = peg$parsemoveNumber();\n if (s2 === peg$FAILED) {\n s2 = null;\n }\n s3 = peg$parse_();\n s4 = peg$parsesan();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsesuffixAnnotation();\n if (s5 === peg$FAILED) {\n s5 = null;\n }\n s6 = [];\n s7 = peg$parsenag();\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parsenag();\n }\n s7 = peg$parse_();\n s8 = peg$parsecomment();\n if (s8 === peg$FAILED) {\n s8 = null;\n }\n s9 = [];\n s10 = peg$parsevariation();\n while (s10 !== peg$FAILED) {\n s9.push(s10);\n s10 = peg$parsevariation();\n }\n peg$savedPos = s0;\n s0 = peg$f5(s4, s5, s6, s8, s9);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsemoveNumber() {\n var s0, s1, s2, s3, s4, s5;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = [];\n s2 = input.charAt(peg$currPos);\n if (peg$r2.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e9); }\n }\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = input.charAt(peg$currPos);\n if (peg$r2.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e9); }\n }\n }\n if (input.charCodeAt(peg$currPos) === 46) {\n s2 = peg$c3;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e10); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n s4 = [];\n s5 = input.charAt(peg$currPos);\n if (peg$r3.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e11); }\n }\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = input.charAt(peg$currPos);\n if (peg$r3.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e11); }\n }\n }\n s1 = [s1, s2, s3, s4];\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e8); }\n }\n\n return s0;\n }\n\n function peg$parsesan() {\n var s0, s1, s2, s3, s4, s5;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.substr(peg$currPos, 5) === peg$c4) {\n s2 = peg$c4;\n peg$currPos += 5;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e13); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c5) {\n s2 = peg$c5;\n peg$currPos += 3;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e14); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c6) {\n s2 = peg$c6;\n peg$currPos += 5;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e15); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c7) {\n s2 = peg$c7;\n peg$currPos += 3;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e16); }\n }\n if (s2 === peg$FAILED) {\n s2 = peg$currPos;\n s3 = input.charAt(peg$currPos);\n if (peg$r0.test(s3)) {\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e5); }\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = input.charAt(peg$currPos);\n if (peg$r4.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e17); }\n }\n if (s5 !== peg$FAILED) {\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = input.charAt(peg$currPos);\n if (peg$r4.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e17); }\n }\n }\n } else {\n s4 = peg$FAILED;\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n }\n }\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = input.charAt(peg$currPos);\n if (peg$r5.test(s3)) {\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e18); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n s2 = [s2, s3];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e12); }\n }\n\n return s0;\n }\n\n function peg$parsesuffixAnnotation() {\n var s0, s1, s2;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = [];\n s2 = input.charAt(peg$currPos);\n if (peg$r6.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e20); }\n }\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n if (s1.length >= 2) {\n s2 = peg$FAILED;\n } else {\n s2 = input.charAt(peg$currPos);\n if (peg$r6.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e20); }\n }\n }\n }\n if (s1.length < 1) {\n peg$currPos = s0;\n s0 = peg$FAILED;\n } else {\n s0 = s1;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e19); }\n }\n\n return s0;\n }\n\n function peg$parsenag() {\n var s0, s1, s2, s3, s4, s5;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (input.charCodeAt(peg$currPos) === 36) {\n s2 = peg$c8;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e22); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$currPos;\n s4 = [];\n s5 = input.charAt(peg$currPos);\n if (peg$r2.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e9); }\n }\n if (s5 !== peg$FAILED) {\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = input.charAt(peg$currPos);\n if (peg$r2.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e9); }\n }\n }\n } else {\n s4 = peg$FAILED;\n }\n if (s4 !== peg$FAILED) {\n s3 = input.substring(s3, peg$currPos);\n } else {\n s3 = s4;\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f6(s3);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e21); }\n }\n\n return s0;\n }\n\n function peg$parsecomment() {\n var s0;\n\n s0 = peg$parsebraceComment();\n if (s0 === peg$FAILED) {\n s0 = peg$parserestOfLineComment();\n }\n\n return s0;\n }\n\n function peg$parsebraceComment() {\n var s0, s1, s2, s3, s4;\n\n peg$silentFails++;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c9;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e24); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = [];\n s4 = input.charAt(peg$currPos);\n if (peg$r7.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e25); }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = input.charAt(peg$currPos);\n if (peg$r7.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e25); }\n }\n }\n s2 = input.substring(s2, peg$currPos);\n if (input.charCodeAt(peg$currPos) === 125) {\n s3 = peg$c10;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e26); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f7(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e23); }\n }\n\n return s0;\n }\n\n function peg$parserestOfLineComment() {\n var s0, s1, s2, s3, s4;\n\n peg$silentFails++;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 59) {\n s1 = peg$c11;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e28); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = [];\n s4 = input.charAt(peg$currPos);\n if (peg$r8.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = input.charAt(peg$currPos);\n if (peg$r8.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n }\n s2 = input.substring(s2, peg$currPos);\n peg$savedPos = s0;\n s0 = peg$f8(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e27); }\n }\n\n return s0;\n }\n\n function peg$parsevariation() {\n var s0, s1, s2, s3, s4, s5;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (input.charCodeAt(peg$currPos) === 40) {\n s2 = peg$c12;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e31); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parseline();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c13;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e32); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f9(s3);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e30); }\n }\n\n return s0;\n }\n\n function peg$parsegameTerminationMarker() {\n var s0, s1, s2, s3;\n\n peg$silentFails++;\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 3) === peg$c14) {\n s1 = peg$c14;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e34); }\n }\n if (s1 === peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c15) {\n s1 = peg$c15;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e35); }\n }\n if (s1 === peg$FAILED) {\n if (input.substr(peg$currPos, 7) === peg$c16) {\n s1 = peg$c16;\n peg$currPos += 7;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e36); }\n }\n if (s1 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 42) {\n s1 = peg$c17;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e37); }\n }\n }\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n s3 = peg$parsecomment();\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n peg$savedPos = s0;\n s0 = peg$f10(s1, s3);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e33); }\n }\n\n return s0;\n }\n\n function peg$parse_() {\n var s0, s1;\n\n peg$silentFails++;\n s0 = [];\n s1 = input.charAt(peg$currPos);\n if (peg$r9.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e39); }\n }\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n s1 = input.charAt(peg$currPos);\n if (peg$r9.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e39); }\n }\n }\n peg$silentFails--;\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e38); }\n\n return s0;\n }\n\n peg$result = peg$startRuleFunction();\n\n if (options.peg$library) {\n return /** @type {any} */ ({\n peg$result,\n peg$currPos,\n peg$FAILED,\n peg$maxFailExpected,\n peg$maxFailPos\n });\n }\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n } else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)\n );\n }\n}\n\nconst peg$allowedStartRules = [\n \"pgn\"\n];\n\nexport {\n peg$allowedStartRules as StartRules,\n peg$SyntaxError as SyntaxError,\n peg$parse as parse\n};\n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,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;SACtD;;IAGH,UAAU,GAAA;QACR,OAAO,IAAI,CAAC,WAAW;;AAE1B;;;;"} \ No newline at end of file diff --git a/node_modules/chess.js/dist/types/chess.d.ts b/node_modules/chess.js/dist/types/chess.d.ts new file mode 100644 index 0000000..10bf4ec --- /dev/null +++ b/node_modules/chess.js/dist/types/chess.d.ts @@ -0,0 +1,282 @@ +/** + * @license + * Copyright (c) 2025, Jeff Hlywa (jhlywa@gmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +declare function xoroshiro128(state: bigint): () => bigint; +declare const WHITE = "w"; +declare const BLACK = "b"; +declare const PAWN = "p"; +declare const KNIGHT = "n"; +declare const BISHOP = "b"; +declare const ROOK = "r"; +declare const QUEEN = "q"; +declare const KING = "k"; +declare type Color = 'w' | 'b'; +declare type PieceSymbol = 'p' | 'n' | 'b' | 'r' | 'q' | 'k'; +declare type Square = 'a8' | 'b8' | 'c8' | 'd8' | 'e8' | 'f8' | 'g8' | 'h8' | 'a7' | 'b7' | 'c7' | 'd7' | 'e7' | 'f7' | 'g7' | 'h7' | 'a6' | 'b6' | 'c6' | 'd6' | 'e6' | 'f6' | 'g6' | 'h6' | 'a5' | 'b5' | 'c5' | 'd5' | 'e5' | 'f5' | 'g5' | 'h5' | 'a4' | 'b4' | 'c4' | 'd4' | 'e4' | 'f4' | 'g4' | 'h4' | 'a3' | 'b3' | 'c3' | 'd3' | 'e3' | 'f3' | 'g3' | 'h3' | 'a2' | 'b2' | 'c2' | 'd2' | 'e2' | 'f2' | 'g2' | 'h2' | 'a1' | 'b1' | 'c1' | 'd1' | 'e1' | 'f1' | 'g1' | 'h1'; +declare const DEFAULT_POSITION = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; +declare type Piece = { + color: Color; + type: PieceSymbol; +}; +declare type InternalMove = { + color: Color; + from: number; + to: number; + piece: PieceSymbol; + captured?: PieceSymbol; + promotion?: PieceSymbol; + flags: number; +}; +declare class Move { + color: Color; + from: Square; + to: Square; + piece: PieceSymbol; + captured?: PieceSymbol; + promotion?: PieceSymbol; + /** + * @deprecated This field is deprecated and will be removed in version 2.0.0. + * Please use move descriptor functions instead: `isCapture`, `isPromotion`, + * `isEnPassant`, `isKingsideCastle`, `isQueensideCastle`, `isCastle`, and + * `isBigPawn` + */ + flags: string; + san: string; + lan: string; + before: string; + after: string; + constructor(chess: Chess, internal: InternalMove); + isCapture(): boolean; + isPromotion(): boolean; + isEnPassant(): boolean; + isKingsideCastle(): boolean; + isQueensideCastle(): boolean; + isBigPawn(): boolean; +} +declare const SQUARES: Square[]; +declare const SEVEN_TAG_ROSTER: Record; +declare function validateFen(fen: string): { + ok: boolean; + error?: string; +}; +declare class Chess { + private _board; + private _turn; + private _header; + private _kings; + private _epSquare; + private _halfMoves; + private _moveNumber; + private _history; + private _comments; + private _castling; + private _hash; + private _positionCount; + constructor(fen?: string, { skipValidation }?: { + skipValidation?: boolean | undefined; + }); + clear({ preserveHeaders }?: { + preserveHeaders?: boolean | undefined; + }): void; + load(fen: string, { skipValidation, preserveHeaders }?: { + skipValidation?: boolean | undefined; + preserveHeaders?: boolean | undefined; + }): void; + fen({ forceEnpassantSquare, }?: { + forceEnpassantSquare?: boolean; + }): string; + private _pieceKey; + private _epKey; + private _castlingKey; + private _computeHash; + private _updateSetup; + reset(): void; + get(square: Square): Piece | undefined; + findPiece(piece: Piece): Square[]; + put({ type, color }: { + type: PieceSymbol; + color: Color; + }, square: Square): boolean; + private _set; + private _put; + private _clear; + remove(square: Square): Piece | undefined; + private _updateCastlingRights; + private _updateEnPassantSquare; + private _attacked; + attackers(square: Square, attackedBy?: Color): Square[]; + private _isKingAttacked; + hash(): string; + isAttacked(square: Square, attackedBy: Color): boolean; + isCheck(): boolean; + inCheck(): boolean; + isCheckmate(): boolean; + isStalemate(): boolean; + isInsufficientMaterial(): boolean; + isThreefoldRepetition(): boolean; + isDrawByFiftyMoves(): boolean; + isDraw(): boolean; + isGameOver(): boolean; + moves(): string[]; + moves({ square }: { + square: Square; + }): string[]; + moves({ piece }: { + piece: PieceSymbol; + }): string[]; + moves({ square, piece }: { + square: Square; + piece: PieceSymbol; + }): string[]; + moves({ verbose, square }: { + verbose: true; + square?: Square; + }): Move[]; + moves({ verbose, square }: { + verbose: false; + square?: Square; + }): string[]; + moves({ verbose, square, }: { + verbose?: boolean; + square?: Square; + }): string[] | Move[]; + moves({ verbose, piece }: { + verbose: true; + piece?: PieceSymbol; + }): Move[]; + moves({ verbose, piece }: { + verbose: false; + piece?: PieceSymbol; + }): string[]; + moves({ verbose, piece, }: { + verbose?: boolean; + piece?: PieceSymbol; + }): string[] | Move[]; + moves({ verbose, square, piece, }: { + verbose: true; + square?: Square; + piece?: PieceSymbol; + }): Move[]; + moves({ verbose, square, piece, }: { + verbose: false; + square?: Square; + piece?: PieceSymbol; + }): string[]; + moves({ verbose, square, piece, }: { + verbose?: boolean; + square?: Square; + piece?: PieceSymbol; + }): string[] | Move[]; + moves({ square, piece }: { + square?: Square; + piece?: PieceSymbol; + }): Move[]; + private _moves; + move(move: string | { + from: string; + to: string; + promotion?: string; + } | null, { strict }?: { + strict?: boolean; + }): Move; + private _push; + private _movePiece; + private _makeMove; + undo(): Move | null; + private _undoMove; + pgn({ newline, maxWidth, }?: { + newline?: string; + maxWidth?: number; + }): string; + /** + * @deprecated Use `setHeader` and `getHeaders` instead. This method will return null header tags (which is not what you want) + */ + header(...args: string[]): Record; + setHeader(key: string, value: string): Record; + removeHeader(key: string): boolean; + getHeaders(): Record; + loadPgn(pgn: string, { strict, newlineChar, }?: { + strict?: boolean; + newlineChar?: string; + }): void; + private _moveToSan; + private _moveFromSan; + ascii(): string; + perft(depth: number): number; + setTurn(color: Color): boolean; + turn(): Color; + board(): ({ + square: Square; + type: PieceSymbol; + color: Color; + } | null)[][]; + squareColor(square: Square): 'light' | 'dark' | null; + history(): string[]; + history({ verbose }: { + verbose: true; + }): Move[]; + history({ verbose }: { + verbose: false; + }): string[]; + history({ verbose }: { + verbose: boolean; + }): string[] | Move[]; + private _getPositionCount; + private _incPositionCount; + private _decPositionCount; + private _pruneComments; + getComment(): string; + setComment(comment: string): void; + /** + * @deprecated Renamed to `removeComment` for consistency + */ + deleteComment(): string; + removeComment(): string; + getComments(): { + fen: string; + comment: string; + }[]; + /** + * @deprecated Renamed to `removeComments` for consistency + */ + deleteComments(): { + fen: string; + comment: string; + }[]; + removeComments(): { + fen: string; + comment: string; + }[]; + setCastlingRights(color: Color, rights: Partial>): boolean; + getCastlingRights(color: Color): { + [KING]: boolean; + [QUEEN]: boolean; + }; + moveNumber(): number; +} + +export { BISHOP, BLACK, Chess, DEFAULT_POSITION, KING, KNIGHT, Move, PAWN, QUEEN, ROOK, SEVEN_TAG_ROSTER, SQUARES, WHITE, validateFen, xoroshiro128 }; +export type { Color, Piece, PieceSymbol, Square }; diff --git a/node_modules/chess.js/package.json b/node_modules/chess.js/package.json new file mode 100644 index 0000000..a14e52d --- /dev/null +++ b/node_modules/chess.js/package.json @@ -0,0 +1,44 @@ +{ + "name": "chess.js", + "version": "1.4.0", + "license": "BSD-2-Clause", + "main": "dist/cjs/chess.js", + "module": "dist/esm/chess.js", + "types": "dist/types/chess.d.ts", + "homepage": "https://github.com/jhlywa/chess.js", + "author": "Jeff Hlywa ", + "scripts": { + "prepare": "npm run build", + "build": "npm run parser && tsc --noEmit && rollup -c", + "check": "npm run format:check && npm run lint && npm run test && npm run build", + "clean": "rm -rf ./dist; rm -f src/pgn.js src/pgn.d.ts", + "format": "prettier --write .", + "format:check": "prettier --check .", + "lint": "eslint src/ --ext .ts", + "parser": "peggy -c peggy.config.mjs", + "test": "vitest", + "test:coverage": "vitest --coverage", + "bench": "tsx benchmarks/bench.ts" + }, + "repository": { + "type": "git", + "url": "https://github.com/jhlywa/chess.js" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^28.0.3", + "@rollup/plugin-typescript": "^12.1.2", + "@typescript-eslint/eslint-plugin": "^5.17.0", + "@typescript-eslint/parser": "^5.17.0", + "@vitest/coverage-v8": "^3.2.2", + "eslint": "^8.12.0", + "peggy": "^4.2.0", + "prettier": "^3.1.0", + "rollup": "^4.41.1", + "rollup-plugin-dts": "^6.2.1", + "tinybench": "^4.0.1", + "tslib": "^2.8.1", + "tsx": "^4.19.4", + "typescript": "^4.6.3", + "vitest": "^3.2.2" + } +} diff --git a/node_modules/chess.js/peggy.config.mjs b/node_modules/chess.js/peggy.config.mjs new file mode 100644 index 0000000..6542ce4 --- /dev/null +++ b/node_modules/chess.js/peggy.config.mjs @@ -0,0 +1,10 @@ +export default { + input: 'src/pgn.peggy', + output: 'src/pgn.js', + format: 'es', + dts: true, + allowedStartRules: ['pgn'], + returnTypes: { + pgn: '{ headers: Record, root: import("./node").Node, result?: string }', + }, +} diff --git a/node_modules/chess.js/rollup.config.mjs b/node_modules/chess.js/rollup.config.mjs new file mode 100644 index 0000000..4cd693f --- /dev/null +++ b/node_modules/chess.js/rollup.config.mjs @@ -0,0 +1,44 @@ +import commonjs from '@rollup/plugin-commonjs' +import typescript from '@rollup/plugin-typescript' +import { dts } from 'rollup-plugin-dts' + +export default [ + { + input: 'src/chess.ts', + output: { + file: 'dist/cjs/chess.js', + format: 'cjs', + sourcemap: true, + }, + plugins: [ + commonjs(), + typescript({ + tsconfig: 'tsconfig.cjs.json', + sourceMap: true, + }), + ], + }, + { + input: 'src/chess.ts', + output: { + file: 'dist/esm/chess.js', + format: 'esm', + sourcemap: true, + }, + plugins: [ + commonjs(), + typescript({ + tsconfig: 'tsconfig.esm.json', + sourceMap: true, + }), + ], + }, + { + input: 'src/chess.ts', + output: { + file: 'dist/types/chess.d.ts', + format: 'es', + }, + plugins: [dts()], + }, +] diff --git a/node_modules/chess.js/src/chess.ts b/node_modules/chess.js/src/chess.ts new file mode 100644 index 0000000..8971fad --- /dev/null +++ b/node_modules/chess.js/src/chess.ts @@ -0,0 +1,2696 @@ +/** + * @license + * Copyright (c) 2025, Jeff Hlywa (jhlywa@gmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +import { parse } from './pgn' + +const MASK64 = 0xffffffffffffffffn + +function rotl(x: bigint, k: bigint): bigint { + return ((x << k) | (x >> (64n - k))) & 0xffffffffffffffffn +} + +function wrappingMul(x: bigint, y: bigint) { + return (x * y) & MASK64 +} + +// xoroshiro128** +export function xoroshiro128(state: bigint) { + return function () { + let s0 = BigInt(state & MASK64) + let s1 = BigInt((state >> 64n) & MASK64) + + const result = wrappingMul(rotl(wrappingMul(s0, 5n), 7n), 9n) + + s1 ^= s0 + s0 = (rotl(s0, 24n) ^ s1 ^ (s1 << 16n)) & MASK64 + s1 = rotl(s1, 37n) + + state = (s1 << 64n) | s0 + + return result + } +} + +const rand = xoroshiro128(0xa187eb39cdcaed8f31c4b365b102e01en) + +const PIECE_KEYS = Array.from({ length: 2 }, () => + Array.from({ length: 6 }, () => Array.from({ length: 128 }, () => rand())), +) + +const EP_KEYS = Array.from({ length: 8 }, () => rand()) + +const CASTLING_KEYS = Array.from({ length: 16 }, () => rand()) + +const SIDE_KEY = rand() + +export const WHITE = 'w' +export const BLACK = 'b' + +export const PAWN = 'p' +export const KNIGHT = 'n' +export const BISHOP = 'b' +export const ROOK = 'r' +export const QUEEN = 'q' +export const KING = 'k' + +export type Color = 'w' | 'b' +export type PieceSymbol = 'p' | 'n' | 'b' | 'r' | 'q' | 'k' + +// prettier-ignore +export type Square = + 'a8' | 'b8' | 'c8' | 'd8' | 'e8' | 'f8' | 'g8' | 'h8' | + 'a7' | 'b7' | 'c7' | 'd7' | 'e7' | 'f7' | 'g7' | 'h7' | + 'a6' | 'b6' | 'c6' | 'd6' | 'e6' | 'f6' | 'g6' | 'h6' | + 'a5' | 'b5' | 'c5' | 'd5' | 'e5' | 'f5' | 'g5' | 'h5' | + 'a4' | 'b4' | 'c4' | 'd4' | 'e4' | 'f4' | 'g4' | 'h4' | + 'a3' | 'b3' | 'c3' | 'd3' | 'e3' | 'f3' | 'g3' | 'h3' | + 'a2' | 'b2' | 'c2' | 'd2' | 'e2' | 'f2' | 'g2' | 'h2' | + 'a1' | 'b1' | 'c1' | 'd1' | 'e1' | 'f1' | 'g1' | 'h1' + +export const DEFAULT_POSITION = + 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1' + +export type Piece = { + color: Color + type: PieceSymbol +} + +type InternalMove = { + color: Color + from: number + to: number + piece: PieceSymbol + captured?: PieceSymbol + promotion?: PieceSymbol + flags: number +} + +interface History { + move: InternalMove + kings: Record + turn: Color + castling: Record + epSquare: number + halfMoves: number + moveNumber: number +} + +export class Move { + color: Color + from: Square + to: Square + piece: PieceSymbol + captured?: PieceSymbol + promotion?: PieceSymbol + + /** + * @deprecated This field is deprecated and will be removed in version 2.0.0. + * Please use move descriptor functions instead: `isCapture`, `isPromotion`, + * `isEnPassant`, `isKingsideCastle`, `isQueensideCastle`, `isCastle`, and + * `isBigPawn` + */ + flags: string + + san: string + lan: string + before: string + after: string + + constructor(chess: Chess, internal: InternalMove) { + const { color, piece, from, to, flags, captured, promotion } = internal + + const fromAlgebraic = algebraic(from) + const toAlgebraic = algebraic(to) + + this.color = color + this.piece = piece + this.from = fromAlgebraic + this.to = toAlgebraic + + /* + * HACK: The chess['_method']() calls below invoke private methods in the + * Chess class to generate SAN and FEN. It's a bit of a hack, but makes the + * code cleaner elsewhere. + */ + + this.san = chess['_moveToSan'](internal, chess['_moves']({ legal: true })) + this.lan = fromAlgebraic + toAlgebraic + this.before = chess.fen() + + // Generate the FEN for the 'after' key + chess['_makeMove'](internal) + this.after = chess.fen() + chess['_undoMove']() + + // Build the text representation of the move flags + this.flags = '' + for (const flag in BITS) { + if (BITS[flag] & flags) { + this.flags += FLAGS[flag] + } + } + + if (captured) { + this.captured = captured + } + + if (promotion) { + this.promotion = promotion + this.lan += promotion + } + } + + isCapture() { + return this.flags.indexOf(FLAGS['CAPTURE']) > -1 + } + + isPromotion() { + return this.flags.indexOf(FLAGS['PROMOTION']) > -1 + } + + isEnPassant() { + return this.flags.indexOf(FLAGS['EP_CAPTURE']) > -1 + } + + isKingsideCastle() { + return this.flags.indexOf(FLAGS['KSIDE_CASTLE']) > -1 + } + + isQueensideCastle() { + return this.flags.indexOf(FLAGS['QSIDE_CASTLE']) > -1 + } + + isBigPawn() { + return this.flags.indexOf(FLAGS['BIG_PAWN']) > -1 + } +} + +const EMPTY = -1 + +const FLAGS: Record = { + NORMAL: 'n', + CAPTURE: 'c', + BIG_PAWN: 'b', + EP_CAPTURE: 'e', + PROMOTION: 'p', + KSIDE_CASTLE: 'k', + QSIDE_CASTLE: 'q', + NULL_MOVE: '-', +} + +// prettier-ignore +export const SQUARES: Square[] = [ + 'a8', 'b8', 'c8', 'd8', 'e8', 'f8', 'g8', 'h8', + 'a7', 'b7', 'c7', 'd7', 'e7', 'f7', 'g7', 'h7', + 'a6', 'b6', 'c6', 'd6', 'e6', 'f6', 'g6', 'h6', + 'a5', 'b5', 'c5', 'd5', 'e5', 'f5', 'g5', 'h5', + 'a4', 'b4', 'c4', 'd4', 'e4', 'f4', 'g4', 'h4', + 'a3', 'b3', 'c3', 'd3', 'e3', 'f3', 'g3', 'h3', + 'a2', 'b2', 'c2', 'd2', 'e2', 'f2', 'g2', 'h2', + 'a1', 'b1', 'c1', 'd1', 'e1', 'f1', 'g1', 'h1' +] + +const BITS: Record = { + NORMAL: 1, + CAPTURE: 2, + BIG_PAWN: 4, + EP_CAPTURE: 8, + PROMOTION: 16, + KSIDE_CASTLE: 32, + QSIDE_CASTLE: 64, + NULL_MOVE: 128, +} + +/* eslint-disable @typescript-eslint/naming-convention */ + +// these are required, according to spec +export const SEVEN_TAG_ROSTER: Record = { + Event: '?', + Site: '?', + Date: '????.??.??', + Round: '?', + White: '?', + Black: '?', + Result: '*', +} + +/** + * These nulls are placeholders to fix the order of tags (as they appear in PGN spec); null values will be + * eliminated in getHeaders() + */ +const SUPLEMENTAL_TAGS: Record = { + WhiteTitle: null, + BlackTitle: null, + WhiteElo: null, + BlackElo: null, + WhiteUSCF: null, + BlackUSCF: null, + WhiteNA: null, + BlackNA: null, + WhiteType: null, + BlackType: null, + EventDate: null, + EventSponsor: null, + Section: null, + Stage: null, + Board: null, + Opening: null, + Variation: null, + SubVariation: null, + ECO: null, + NIC: null, + Time: null, + UTCTime: null, + UTCDate: null, + TimeControl: null, + SetUp: null, + FEN: null, + Termination: null, + Annotator: null, + Mode: null, + PlyCount: null, +} + +const HEADER_TEMPLATE = { + ...SEVEN_TAG_ROSTER, + ...SUPLEMENTAL_TAGS, +} +/* eslint-enable @typescript-eslint/naming-convention */ + +/* + * NOTES ABOUT 0x88 MOVE GENERATION ALGORITHM + * ---------------------------------------------------------------------------- + * From https://github.com/jhlywa/chess.js/issues/230 + * + * A lot of people are confused when they first see the internal representation + * of chess.js. It uses the 0x88 Move Generation Algorithm which internally + * stores the board as an 8x16 array. This is purely for efficiency but has a + * couple of interesting benefits: + * + * 1. 0x88 offers a very inexpensive "off the board" check. Bitwise AND (&) any + * square with 0x88, if the result is non-zero then the square is off the + * board. For example, assuming a knight square A8 (0 in 0x88 notation), + * there are 8 possible directions in which the knight can move. These + * directions are relative to the 8x16 board and are stored in the + * PIECE_OFFSETS map. One possible move is A8 - 18 (up one square, and two + * squares to the left - which is off the board). 0 - 18 = -18 & 0x88 = 0x88 + * (because of two-complement representation of -18). The non-zero result + * means the square is off the board and the move is illegal. Take the + * opposite move (from A8 to C7), 0 + 18 = 18 & 0x88 = 0. A result of zero + * means the square is on the board. + * + * 2. The relative distance (or difference) between two squares on a 8x16 board + * is unique and can be used to inexpensively determine if a piece on a + * square can attack any other arbitrary square. For example, let's see if a + * pawn on E7 can attack E2. The difference between E7 (20) - E2 (100) is + * -80. We add 119 to make the ATTACKS array index non-negative (because the + * worst case difference is A8 - H1 = -119). The ATTACKS array contains a + * bitmask of pieces that can attack from that distance and direction. + * ATTACKS[-80 + 119=39] gives us 24 or 0b11000 in binary. Look at the + * PIECE_MASKS map to determine the mask for a given piece type. In our pawn + * example, we would check to see if 24 & 0x1 is non-zero, which it is + * not. So, naturally, a pawn on E7 can't attack a piece on E2. However, a + * rook can since 24 & 0x8 is non-zero. The only thing left to check is that + * there are no blocking pieces between E7 and E2. That's where the RAYS + * array comes in. It provides an offset (in this case 16) to add to E7 (20) + * to check for blocking pieces. E7 (20) + 16 = E6 (36) + 16 = E5 (52) etc. + */ + +// prettier-ignore +// eslint-disable-next-line +const Ox88: Record = { + a8: 0, b8: 1, c8: 2, d8: 3, e8: 4, f8: 5, g8: 6, h8: 7, + a7: 16, b7: 17, c7: 18, d7: 19, e7: 20, f7: 21, g7: 22, h7: 23, + a6: 32, b6: 33, c6: 34, d6: 35, e6: 36, f6: 37, g6: 38, h6: 39, + a5: 48, b5: 49, c5: 50, d5: 51, e5: 52, f5: 53, g5: 54, h5: 55, + a4: 64, b4: 65, c4: 66, d4: 67, e4: 68, f4: 69, g4: 70, h4: 71, + a3: 80, b3: 81, c3: 82, d3: 83, e3: 84, f3: 85, g3: 86, h3: 87, + a2: 96, b2: 97, c2: 98, d2: 99, e2: 100, f2: 101, g2: 102, h2: 103, + a1: 112, b1: 113, c1: 114, d1: 115, e1: 116, f1: 117, g1: 118, h1: 119 +} + +const PAWN_OFFSETS = { + b: [16, 32, 17, 15], + w: [-16, -32, -17, -15], +} + +const PIECE_OFFSETS = { + n: [-18, -33, -31, -14, 18, 33, 31, 14], + b: [-17, -15, 17, 15], + r: [-16, 1, 16, -1], + q: [-17, -16, -15, 1, 17, 16, 15, -1], + k: [-17, -16, -15, 1, 17, 16, 15, -1], +} + +// prettier-ignore +const ATTACKS = [ + 20, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0,20, 0, + 0,20, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0,20, 0, 0, + 0, 0,20, 0, 0, 0, 0, 24, 0, 0, 0, 0,20, 0, 0, 0, + 0, 0, 0,20, 0, 0, 0, 24, 0, 0, 0,20, 0, 0, 0, 0, + 0, 0, 0, 0,20, 0, 0, 24, 0, 0,20, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,20, 2, 24, 2,20, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2,53, 56, 53, 2, 0, 0, 0, 0, 0, 0, + 24,24,24,24,24,24,56, 0, 56,24,24,24,24,24,24, 0, + 0, 0, 0, 0, 0, 2,53, 56, 53, 2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,20, 2, 24, 2,20, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,20, 0, 0, 24, 0, 0,20, 0, 0, 0, 0, 0, + 0, 0, 0,20, 0, 0, 0, 24, 0, 0, 0,20, 0, 0, 0, 0, + 0, 0,20, 0, 0, 0, 0, 24, 0, 0, 0, 0,20, 0, 0, 0, + 0,20, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0,20, 0, 0, + 20, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0,20 +]; + +// prettier-ignore +const RAYS = [ + 17, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 15, 0, + 0, 17, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 15, 0, 0, + 0, 0, 17, 0, 0, 0, 0, 16, 0, 0, 0, 0, 15, 0, 0, 0, + 0, 0, 0, 17, 0, 0, 0, 16, 0, 0, 0, 15, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 0, 0, 16, 0, 0, 15, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 17, 0, 16, 0, 15, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 17, 16, 15, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 0, -1, -1, -1,-1, -1, -1, -1, 0, + 0, 0, 0, 0, 0, 0,-15,-16,-17, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,-15, 0,-16, 0,-17, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,-15, 0, 0,-16, 0, 0,-17, 0, 0, 0, 0, 0, + 0, 0, 0,-15, 0, 0, 0,-16, 0, 0, 0,-17, 0, 0, 0, 0, + 0, 0,-15, 0, 0, 0, 0,-16, 0, 0, 0, 0,-17, 0, 0, 0, + 0,-15, 0, 0, 0, 0, 0,-16, 0, 0, 0, 0, 0,-17, 0, 0, + -15, 0, 0, 0, 0, 0, 0,-16, 0, 0, 0, 0, 0, 0,-17 +]; + +const PIECE_MASKS = { p: 0x1, n: 0x2, b: 0x4, r: 0x8, q: 0x10, k: 0x20 } + +const SYMBOLS = 'pnbrqkPNBRQK' + +const PROMOTIONS: PieceSymbol[] = [KNIGHT, BISHOP, ROOK, QUEEN] + +const RANK_1 = 7 +const RANK_2 = 6 +/* + * const RANK_3 = 5 + * const RANK_4 = 4 + * const RANK_5 = 3 + * const RANK_6 = 2 + */ +const RANK_7 = 1 +const RANK_8 = 0 + +const SIDES = { + [KING]: BITS.KSIDE_CASTLE, + [QUEEN]: BITS.QSIDE_CASTLE, +} + +const ROOKS = { + w: [ + { square: Ox88.a1, flag: BITS.QSIDE_CASTLE }, + { square: Ox88.h1, flag: BITS.KSIDE_CASTLE }, + ], + b: [ + { square: Ox88.a8, flag: BITS.QSIDE_CASTLE }, + { square: Ox88.h8, flag: BITS.KSIDE_CASTLE }, + ], +} + +const SECOND_RANK = { b: RANK_7, w: RANK_2 } + +const TERMINATION_MARKERS = ['1-0', '0-1', '1/2-1/2', '*'] + +const SAN_NULLMOVE = '--' + +// Extracts the zero-based rank of an 0x88 square. +function rank(square: number): number { + return square >> 4 +} + +// Extracts the zero-based file of an 0x88 square. +function file(square: number): number { + return square & 0xf +} + +function isDigit(c: string): boolean { + return '0123456789'.indexOf(c) !== -1 +} + +// Converts a 0x88 square to algebraic notation. +function algebraic(square: number): Square { + const f = file(square) + const r = rank(square) + return ('abcdefgh'.substring(f, f + 1) + + '87654321'.substring(r, r + 1)) as Square +} + +function swapColor(color: Color): Color { + return color === WHITE ? BLACK : WHITE +} + +export function validateFen(fen: string): { ok: boolean; error?: string } { + // 1st criterion: 6 space-seperated fields? + const tokens = fen.split(/\s+/) + if (tokens.length !== 6) { + return { + ok: false, + error: 'Invalid FEN: must contain six space-delimited fields', + } + } + + // 2nd criterion: move number field is a integer value > 0? + const moveNumber = parseInt(tokens[5], 10) + if (isNaN(moveNumber) || moveNumber <= 0) { + return { + ok: false, + error: 'Invalid FEN: move number must be a positive integer', + } + } + + // 3rd criterion: half move counter is an integer >= 0? + const halfMoves = parseInt(tokens[4], 10) + if (isNaN(halfMoves) || halfMoves < 0) { + return { + ok: false, + error: + 'Invalid FEN: half move counter number must be a non-negative integer', + } + } + + // 4th criterion: 4th field is a valid e.p.-string? + if (!/^(-|[abcdefgh][36])$/.test(tokens[3])) { + return { ok: false, error: 'Invalid FEN: en-passant square is invalid' } + } + + // 5th criterion: 3th field is a valid castle-string? + if (/[^kKqQ-]/.test(tokens[2])) { + return { ok: false, error: 'Invalid FEN: castling availability is invalid' } + } + + // 6th criterion: 2nd field is "w" (white) or "b" (black)? + if (!/^(w|b)$/.test(tokens[1])) { + return { ok: false, error: 'Invalid FEN: side-to-move is invalid' } + } + + // 7th criterion: 1st field contains 8 rows? + const rows = tokens[0].split('/') + if (rows.length !== 8) { + return { + ok: false, + error: "Invalid FEN: piece data does not contain 8 '/'-delimited rows", + } + } + + // 8th criterion: every row is valid? + for (let i = 0; i < rows.length; i++) { + // check for right sum of fields AND not two numbers in succession + let sumFields = 0 + let previousWasNumber = false + + for (let k = 0; k < rows[i].length; k++) { + if (isDigit(rows[i][k])) { + if (previousWasNumber) { + return { + ok: false, + error: 'Invalid FEN: piece data is invalid (consecutive number)', + } + } + sumFields += parseInt(rows[i][k], 10) + previousWasNumber = true + } else { + if (!/^[prnbqkPRNBQK]$/.test(rows[i][k])) { + return { + ok: false, + error: 'Invalid FEN: piece data is invalid (invalid piece)', + } + } + sumFields += 1 + previousWasNumber = false + } + } + if (sumFields !== 8) { + return { + ok: false, + error: 'Invalid FEN: piece data is invalid (too many squares in rank)', + } + } + } + + // 9th criterion: is en-passant square legal? + if ( + (tokens[3][1] == '3' && tokens[1] == 'w') || + (tokens[3][1] == '6' && tokens[1] == 'b') + ) { + return { ok: false, error: 'Invalid FEN: illegal en-passant square' } + } + + // 10th criterion: does chess position contain exact two kings? + const kings = [ + { color: 'white', regex: /K/g }, + { color: 'black', regex: /k/g }, + ] + + for (const { color, regex } of kings) { + if (!regex.test(tokens[0])) { + return { ok: false, error: `Invalid FEN: missing ${color} king` } + } + + if ((tokens[0].match(regex) || []).length > 1) { + return { ok: false, error: `Invalid FEN: too many ${color} kings` } + } + } + + // 11th criterion: are any pawns on the first or eighth rows? + if ( + Array.from(rows[0] + rows[7]).some((char) => char.toUpperCase() === 'P') + ) { + return { + ok: false, + error: 'Invalid FEN: some pawns are on the edge rows', + } + } + + return { ok: true } +} + +// this function is used to uniquely identify ambiguous moves +function getDisambiguator(move: InternalMove, moves: InternalMove[]): string { + const from = move.from + const to = move.to + const piece = move.piece + + let ambiguities = 0 + let sameRank = 0 + let sameFile = 0 + + for (let i = 0, len = moves.length; i < len; i++) { + const ambigFrom = moves[i].from + const ambigTo = moves[i].to + const ambigPiece = moves[i].piece + + /* + * if a move of the same piece type ends on the same to square, we'll need + * to add a disambiguator to the algebraic notation + */ + if (piece === ambigPiece && from !== ambigFrom && to === ambigTo) { + ambiguities++ + + if (rank(from) === rank(ambigFrom)) { + sameRank++ + } + + if (file(from) === file(ambigFrom)) { + sameFile++ + } + } + } + + if (ambiguities > 0) { + if (sameRank > 0 && sameFile > 0) { + /* + * if there exists a similar moving piece on the same rank and file as + * the move in question, use the square as the disambiguator + */ + return algebraic(from) + } else if (sameFile > 0) { + /* + * if the moving piece rests on the same file, use the rank symbol as the + * disambiguator + */ + return algebraic(from).charAt(1) + } else { + // else use the file symbol + return algebraic(from).charAt(0) + } + } + + return '' +} + +function addMove( + moves: InternalMove[], + color: Color, + from: number, + to: number, + piece: PieceSymbol, + captured: PieceSymbol | undefined = undefined, + flags: number = BITS.NORMAL, +) { + const r = rank(to) + + if (piece === PAWN && (r === RANK_1 || r === RANK_8)) { + for (let i = 0; i < PROMOTIONS.length; i++) { + const promotion = PROMOTIONS[i] + moves.push({ + color, + from, + to, + piece, + captured, + promotion, + flags: flags | BITS.PROMOTION, + }) + } + } else { + moves.push({ + color, + from, + to, + piece, + captured, + flags, + }) + } +} + +function inferPieceType(san: string): PieceSymbol | undefined { + let pieceType = san.charAt(0) + if (pieceType >= 'a' && pieceType <= 'h') { + const matches = san.match(/[a-h]\d.*[a-h]\d/) + if (matches) { + return undefined + } + return PAWN + } + pieceType = pieceType.toLowerCase() + if (pieceType === 'o') { + return KING + } + return pieceType as PieceSymbol +} + +// parses all of the decorators out of a SAN string +function strippedSan(move: string): string { + return move.replace(/=/, '').replace(/[+#]?[?!]*$/, '') +} + +export class Chess { + private _board = new Array(128) + private _turn: Color = WHITE + private _header: Record = {} + private _kings: Record = { w: EMPTY, b: EMPTY } + private _epSquare = -1 + private _halfMoves = 0 + private _moveNumber = 0 + private _history: History[] = [] + private _comments: Record = {} + private _castling: Record = { w: 0, b: 0 } + + private _hash = 0n + + // tracks number of times a position has been seen for repetition checking + private _positionCount = new Map() + + constructor(fen = DEFAULT_POSITION, { skipValidation = false } = {}) { + this.load(fen, { skipValidation }) + } + + clear({ preserveHeaders = false } = {}) { + this._board = new Array(128) + this._kings = { w: EMPTY, b: EMPTY } + this._turn = WHITE + this._castling = { w: 0, b: 0 } + this._epSquare = EMPTY + this._halfMoves = 0 + this._moveNumber = 1 + this._history = [] + this._comments = {} + this._header = preserveHeaders ? this._header : { ...HEADER_TEMPLATE } + this._hash = this._computeHash() + this._positionCount = new Map() + + /* + * Delete the SetUp and FEN headers (if preserved), the board is empty and + * these headers don't make sense in this state. They'll get added later + * via .load() or .put() + */ + this._header['SetUp'] = null + this._header['FEN'] = null + } + + load(fen: string, { skipValidation = false, preserveHeaders = false } = {}) { + let tokens = fen.split(/\s+/) + + // append commonly omitted fen tokens + if (tokens.length >= 2 && tokens.length < 6) { + const adjustments = ['-', '-', '0', '1'] + fen = tokens.concat(adjustments.slice(-(6 - tokens.length))).join(' ') + } + + tokens = fen.split(/\s+/) + + if (!skipValidation) { + const { ok, error } = validateFen(fen) + if (!ok) { + throw new Error(error) + } + } + + const position = tokens[0] + let square = 0 + + this.clear({ preserveHeaders }) + + for (let i = 0; i < position.length; i++) { + const piece = position.charAt(i) + + if (piece === '/') { + square += 8 + } else if (isDigit(piece)) { + square += parseInt(piece, 10) + } else { + const color = piece < 'a' ? WHITE : BLACK + this._put( + { type: piece.toLowerCase() as PieceSymbol, color }, + algebraic(square), + ) + square++ + } + } + + this._turn = tokens[1] as Color + + if (tokens[2].indexOf('K') > -1) { + this._castling.w |= BITS.KSIDE_CASTLE + } + if (tokens[2].indexOf('Q') > -1) { + this._castling.w |= BITS.QSIDE_CASTLE + } + if (tokens[2].indexOf('k') > -1) { + this._castling.b |= BITS.KSIDE_CASTLE + } + if (tokens[2].indexOf('q') > -1) { + this._castling.b |= BITS.QSIDE_CASTLE + } + + this._epSquare = tokens[3] === '-' ? EMPTY : Ox88[tokens[3] as Square] + this._halfMoves = parseInt(tokens[4], 10) + this._moveNumber = parseInt(tokens[5], 10) + + this._hash = this._computeHash() + this._updateSetup(fen) + this._incPositionCount() + } + + fen({ + forceEnpassantSquare = false, + }: { forceEnpassantSquare?: boolean } = {}) { + let empty = 0 + let fen = '' + + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + if (this._board[i]) { + if (empty > 0) { + fen += empty + empty = 0 + } + const { color, type: piece } = this._board[i] + + fen += color === WHITE ? piece.toUpperCase() : piece.toLowerCase() + } else { + empty++ + } + + if ((i + 1) & 0x88) { + if (empty > 0) { + fen += empty + } + + if (i !== Ox88.h1) { + fen += '/' + } + + empty = 0 + i += 8 + } + } + + let castling = '' + if (this._castling[WHITE] & BITS.KSIDE_CASTLE) { + castling += 'K' + } + if (this._castling[WHITE] & BITS.QSIDE_CASTLE) { + castling += 'Q' + } + if (this._castling[BLACK] & BITS.KSIDE_CASTLE) { + castling += 'k' + } + if (this._castling[BLACK] & BITS.QSIDE_CASTLE) { + castling += 'q' + } + + // do we have an empty castling flag? + castling = castling || '-' + + let epSquare = '-' + /* + * only print the ep square if en passant is a valid move (pawn is present + * and ep capture is not pinned) + */ + if (this._epSquare !== EMPTY) { + if (forceEnpassantSquare) { + epSquare = algebraic(this._epSquare) + } else { + const bigPawnSquare = this._epSquare + (this._turn === WHITE ? 16 : -16) + const squares = [bigPawnSquare + 1, bigPawnSquare - 1] + + for (const square of squares) { + // is the square off the board? + if (square & 0x88) { + continue + } + + const color = this._turn + + // is there a pawn that can capture the epSquare? + if ( + this._board[square]?.color === color && + this._board[square]?.type === PAWN + ) { + // if the pawn makes an ep capture, does it leave its king in check? + this._makeMove({ + color, + from: square, + to: this._epSquare, + piece: PAWN, + captured: PAWN, + flags: BITS.EP_CAPTURE, + }) + const isLegal = !this._isKingAttacked(color) + this._undoMove() + + // if ep is legal, break and set the ep square in the FEN output + if (isLegal) { + epSquare = algebraic(this._epSquare) + break + } + } + } + } + } + + return [ + fen, + this._turn, + castling, + epSquare, + this._halfMoves, + this._moveNumber, + ].join(' ') + } + + private _pieceKey(i: number) { + if (!this._board[i]) { + return 0n + } + + const { color, type } = this._board[i] + + const colorIndex = { + w: 0, + b: 1, + }[color] + + const typeIndex = { + p: 0, + n: 1, + b: 2, + r: 3, + q: 4, + k: 5, + }[type] + + return PIECE_KEYS[colorIndex][typeIndex][i] + } + + private _epKey() { + return this._epSquare === EMPTY ? 0n : EP_KEYS[this._epSquare & 7] + } + + private _castlingKey() { + const index = (this._castling.w >> 5) | (this._castling.b >> 3) + return CASTLING_KEYS[index] + } + + private _computeHash() { + let hash = 0n + + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + // did we run off the end of the board + if (i & 0x88) { + i += 7 + continue + } + + if (this._board[i]) { + hash ^= this._pieceKey(i) + } + } + + hash ^= this._epKey() + hash ^= this._castlingKey() + + if (this._turn === 'b') { + hash ^= SIDE_KEY + } + + return hash + } + + /* + * Called when the initial board setup is changed with put() or remove(). + * modifies the SetUp and FEN properties of the header object. If the FEN + * is equal to the default position, the SetUp and FEN are deleted the setup + * is only updated if history.length is zero, ie moves haven't been made. + */ + private _updateSetup(fen: string) { + if (this._history.length > 0) return + + if (fen !== DEFAULT_POSITION) { + this._header['SetUp'] = '1' + this._header['FEN'] = fen + } else { + this._header['SetUp'] = null + this._header['FEN'] = null + } + } + + reset() { + this.load(DEFAULT_POSITION) + } + + get(square: Square): Piece | undefined { + return this._board[Ox88[square]] + } + + findPiece(piece: Piece): Square[] { + const squares: Square[] = [] + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + // did we run off the end of the board + if (i & 0x88) { + i += 7 + continue + } + + // if empty square or wrong color + if (!this._board[i] || this._board[i]?.color !== piece.color) { + continue + } + + // check if square contains the requested piece + if ( + this._board[i].color === piece.color && + this._board[i].type === piece.type + ) { + squares.push(algebraic(i)) + } + } + + return squares + } + + put( + { type, color }: { type: PieceSymbol; color: Color }, + square: Square, + ): boolean { + if (this._put({ type, color }, square)) { + this._updateCastlingRights() + this._updateEnPassantSquare() + this._updateSetup(this.fen()) + return true + } + return false + } + + private _set(sq: number, piece: Piece) { + this._hash ^= this._pieceKey(sq) + this._board[sq] = piece + this._hash ^= this._pieceKey(sq) + } + + private _put( + { type, color }: { type: PieceSymbol; color: Color }, + square: Square, + ): boolean { + // check for piece + if (SYMBOLS.indexOf(type.toLowerCase()) === -1) { + return false + } + + // check for valid square + if (!(square in Ox88)) { + return false + } + + const sq = Ox88[square] + + // don't let the user place more than one king + if ( + type == KING && + !(this._kings[color] == EMPTY || this._kings[color] == sq) + ) { + return false + } + + const currentPieceOnSquare = this._board[sq] + + // if one of the kings will be replaced by the piece from args, set the `_kings` respective entry to `EMPTY` + if (currentPieceOnSquare && currentPieceOnSquare.type === KING) { + this._kings[currentPieceOnSquare.color] = EMPTY + } + + this._set(sq, { type: type as PieceSymbol, color: color as Color }) + + if (type === KING) { + this._kings[color] = sq + } + + return true + } + + private _clear(sq: number) { + this._hash ^= this._pieceKey(sq) + delete this._board[sq] + } + + remove(square: Square): Piece | undefined { + const piece = this.get(square) + this._clear(Ox88[square]) + if (piece && piece.type === KING) { + this._kings[piece.color] = EMPTY + } + + this._updateCastlingRights() + this._updateEnPassantSquare() + this._updateSetup(this.fen()) + + return piece + } + + private _updateCastlingRights() { + this._hash ^= this._castlingKey() + + const whiteKingInPlace = + this._board[Ox88.e1]?.type === KING && + this._board[Ox88.e1]?.color === WHITE + const blackKingInPlace = + this._board[Ox88.e8]?.type === KING && + this._board[Ox88.e8]?.color === BLACK + + if ( + !whiteKingInPlace || + this._board[Ox88.a1]?.type !== ROOK || + this._board[Ox88.a1]?.color !== WHITE + ) { + this._castling.w &= ~BITS.QSIDE_CASTLE + } + + if ( + !whiteKingInPlace || + this._board[Ox88.h1]?.type !== ROOK || + this._board[Ox88.h1]?.color !== WHITE + ) { + this._castling.w &= ~BITS.KSIDE_CASTLE + } + + if ( + !blackKingInPlace || + this._board[Ox88.a8]?.type !== ROOK || + this._board[Ox88.a8]?.color !== BLACK + ) { + this._castling.b &= ~BITS.QSIDE_CASTLE + } + + if ( + !blackKingInPlace || + this._board[Ox88.h8]?.type !== ROOK || + this._board[Ox88.h8]?.color !== BLACK + ) { + this._castling.b &= ~BITS.KSIDE_CASTLE + } + + this._hash ^= this._castlingKey() + } + + private _updateEnPassantSquare() { + if (this._epSquare === EMPTY) { + return + } + + const startSquare = this._epSquare + (this._turn === WHITE ? -16 : 16) + const currentSquare = this._epSquare + (this._turn === WHITE ? 16 : -16) + const attackers = [currentSquare + 1, currentSquare - 1] + + if ( + this._board[startSquare] !== null || + this._board[this._epSquare] !== null || + this._board[currentSquare]?.color !== swapColor(this._turn) || + this._board[currentSquare]?.type !== PAWN + ) { + this._hash ^= this._epKey() + this._epSquare = EMPTY + return + } + + const canCapture = (square: number) => + !(square & 0x88) && + this._board[square]?.color === this._turn && + this._board[square]?.type === PAWN + + if (!attackers.some(canCapture)) { + this._hash ^= this._epKey() + this._epSquare = EMPTY + } + } + + private _attacked(color: Color, square: number): boolean + private _attacked(color: Color, square: number, verbose: false): boolean + private _attacked(color: Color, square: number, verbose: true): Square[] + private _attacked(color: Color, square: number, verbose?: boolean) { + const attackers: Square[] = [] + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + // did we run off the end of the board + if (i & 0x88) { + i += 7 + continue + } + + // if empty square or wrong color + if (this._board[i] === undefined || this._board[i].color !== color) { + continue + } + + const piece = this._board[i] + const difference = i - square + + // skip - to/from square are the same + if (difference === 0) { + continue + } + + const index = difference + 119 + + if (ATTACKS[index] & PIECE_MASKS[piece.type]) { + if (piece.type === PAWN) { + if ( + (difference > 0 && piece.color === WHITE) || + (difference <= 0 && piece.color === BLACK) + ) { + if (!verbose) { + return true + } else { + attackers.push(algebraic(i)) + } + } + continue + } + + // if the piece is a knight or a king + if (piece.type === 'n' || piece.type === 'k') { + if (!verbose) { + return true + } else { + attackers.push(algebraic(i)) + continue + } + } + + const offset = RAYS[index] + let j = i + offset + + let blocked = false + while (j !== square) { + if (this._board[j] != null) { + blocked = true + break + } + j += offset + } + + if (!blocked) { + if (!verbose) { + return true + } else { + attackers.push(algebraic(i)) + continue + } + } + } + } + + if (verbose) { + return attackers + } else { + return false + } + } + + attackers(square: Square, attackedBy?: Color): Square[] { + if (!attackedBy) { + return this._attacked(this._turn, Ox88[square], true) + } else { + return this._attacked(attackedBy, Ox88[square], true) + } + } + + private _isKingAttacked(color: Color): boolean { + const square = this._kings[color] + return square === -1 ? false : this._attacked(swapColor(color), square) + } + + hash(): string { + return this._hash.toString(16) + } + + isAttacked(square: Square, attackedBy: Color): boolean { + return this._attacked(attackedBy, Ox88[square]) + } + + isCheck(): boolean { + return this._isKingAttacked(this._turn) + } + + inCheck(): boolean { + return this.isCheck() + } + + isCheckmate(): boolean { + return this.isCheck() && this._moves().length === 0 + } + + isStalemate(): boolean { + return !this.isCheck() && this._moves().length === 0 + } + + isInsufficientMaterial(): boolean { + /* + * k.b. vs k.b. (of opposite colors) with mate in 1: + * 8/8/8/8/1b6/8/B1k5/K7 b - - 0 1 + * + * k.b. vs k.n. with mate in 1: + * 8/8/8/8/1n6/8/B7/K1k5 b - - 2 1 + */ + const pieces: Record = { + b: 0, + n: 0, + r: 0, + q: 0, + k: 0, + p: 0, + } + const bishops = [] + let numPieces = 0 + let squareColor = 0 + + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + squareColor = (squareColor + 1) % 2 + if (i & 0x88) { + i += 7 + continue + } + + const piece = this._board[i] + if (piece) { + pieces[piece.type] = piece.type in pieces ? pieces[piece.type] + 1 : 1 + if (piece.type === BISHOP) { + bishops.push(squareColor) + } + numPieces++ + } + } + + // k vs. k + if (numPieces === 2) { + return true + } else if ( + // k vs. kn .... or .... k vs. kb + numPieces === 3 && + (pieces[BISHOP] === 1 || pieces[KNIGHT] === 1) + ) { + return true + } else if (numPieces === pieces[BISHOP] + 2) { + // kb vs. kb where any number of bishops are all on the same color + let sum = 0 + const len = bishops.length + for (let i = 0; i < len; i++) { + sum += bishops[i] + } + if (sum === 0 || sum === len) { + return true + } + } + + return false + } + + isThreefoldRepetition(): boolean { + return this._getPositionCount(this._hash) >= 3 + } + + isDrawByFiftyMoves(): boolean { + return this._halfMoves >= 100 // 50 moves per side = 100 half moves + } + + isDraw(): boolean { + return ( + this.isDrawByFiftyMoves() || + this.isStalemate() || + this.isInsufficientMaterial() || + this.isThreefoldRepetition() + ) + } + + isGameOver(): boolean { + return this.isCheckmate() || this.isDraw() + } + + moves(): string[] + moves({ square }: { square: Square }): string[] + moves({ piece }: { piece: PieceSymbol }): string[] + + moves({ square, piece }: { square: Square; piece: PieceSymbol }): string[] + + moves({ verbose, square }: { verbose: true; square?: Square }): Move[] + moves({ verbose, square }: { verbose: false; square?: Square }): string[] + moves({ + verbose, + square, + }: { + verbose?: boolean + square?: Square + }): string[] | Move[] + + moves({ verbose, piece }: { verbose: true; piece?: PieceSymbol }): Move[] + moves({ verbose, piece }: { verbose: false; piece?: PieceSymbol }): string[] + moves({ + verbose, + piece, + }: { + verbose?: boolean + piece?: PieceSymbol + }): string[] | Move[] + + moves({ + verbose, + square, + piece, + }: { + verbose: true + square?: Square + piece?: PieceSymbol + }): Move[] + moves({ + verbose, + square, + piece, + }: { + verbose: false + square?: Square + piece?: PieceSymbol + }): string[] + moves({ + verbose, + square, + piece, + }: { + verbose?: boolean + square?: Square + piece?: PieceSymbol + }): string[] | Move[] + + moves({ square, piece }: { square?: Square; piece?: PieceSymbol }): Move[] + + moves({ + verbose = false, + square = undefined, + piece = undefined, + }: { verbose?: boolean; square?: Square; piece?: PieceSymbol } = {}) { + const moves = this._moves({ square, piece }) + + if (verbose) { + return moves.map((move) => new Move(this, move)) + } else { + return moves.map((move) => this._moveToSan(move, moves)) + } + } + + private _moves({ + legal = true, + piece = undefined, + square = undefined, + }: { + legal?: boolean + piece?: PieceSymbol + square?: Square + } = {}): InternalMove[] { + const forSquare = square ? (square.toLowerCase() as Square) : undefined + const forPiece = piece?.toLowerCase() + + const moves: InternalMove[] = [] + const us = this._turn + const them = swapColor(us) + + let firstSquare = Ox88.a8 + let lastSquare = Ox88.h1 + let singleSquare = false + + // are we generating moves for a single square? + if (forSquare) { + // illegal square, return empty moves + if (!(forSquare in Ox88)) { + return [] + } else { + firstSquare = lastSquare = Ox88[forSquare] + singleSquare = true + } + } + + for (let from = firstSquare; from <= lastSquare; from++) { + // did we run off the end of the board + if (from & 0x88) { + from += 7 + continue + } + + // empty square or opponent, skip + if (!this._board[from] || this._board[from].color === them) { + continue + } + const { type } = this._board[from] + + let to: number + if (type === PAWN) { + if (forPiece && forPiece !== type) continue + + // single square, non-capturing + to = from + PAWN_OFFSETS[us][0] + if (!this._board[to]) { + addMove(moves, us, from, to, PAWN) + + // double square + to = from + PAWN_OFFSETS[us][1] + if (SECOND_RANK[us] === rank(from) && !this._board[to]) { + addMove(moves, us, from, to, PAWN, undefined, BITS.BIG_PAWN) + } + } + + // pawn captures + for (let j = 2; j < 4; j++) { + to = from + PAWN_OFFSETS[us][j] + if (to & 0x88) continue + + if (this._board[to]?.color === them) { + addMove( + moves, + us, + from, + to, + PAWN, + this._board[to].type, + BITS.CAPTURE, + ) + } else if (to === this._epSquare) { + addMove(moves, us, from, to, PAWN, PAWN, BITS.EP_CAPTURE) + } + } + } else { + if (forPiece && forPiece !== type) continue + + for (let j = 0, len = PIECE_OFFSETS[type].length; j < len; j++) { + const offset = PIECE_OFFSETS[type][j] + to = from + + while (true) { + to += offset + if (to & 0x88) break + + if (!this._board[to]) { + addMove(moves, us, from, to, type) + } else { + // own color, stop loop + if (this._board[to].color === us) break + + addMove( + moves, + us, + from, + to, + type, + this._board[to].type, + BITS.CAPTURE, + ) + break + } + + /* break, if knight or king */ + if (type === KNIGHT || type === KING) break + } + } + } + } + + /* + * check for castling if we're: + * a) generating all moves, or + * b) doing single square move generation on the king's square + */ + + if (forPiece === undefined || forPiece === KING) { + if (!singleSquare || lastSquare === this._kings[us]) { + // king-side castling + if (this._castling[us] & BITS.KSIDE_CASTLE) { + const castlingFrom = this._kings[us] + const castlingTo = castlingFrom + 2 + + if ( + !this._board[castlingFrom + 1] && + !this._board[castlingTo] && + !this._attacked(them, this._kings[us]) && + !this._attacked(them, castlingFrom + 1) && + !this._attacked(them, castlingTo) + ) { + addMove( + moves, + us, + this._kings[us], + castlingTo, + KING, + undefined, + BITS.KSIDE_CASTLE, + ) + } + } + + // queen-side castling + if (this._castling[us] & BITS.QSIDE_CASTLE) { + const castlingFrom = this._kings[us] + const castlingTo = castlingFrom - 2 + + if ( + !this._board[castlingFrom - 1] && + !this._board[castlingFrom - 2] && + !this._board[castlingFrom - 3] && + !this._attacked(them, this._kings[us]) && + !this._attacked(them, castlingFrom - 1) && + !this._attacked(them, castlingTo) + ) { + addMove( + moves, + us, + this._kings[us], + castlingTo, + KING, + undefined, + BITS.QSIDE_CASTLE, + ) + } + } + } + } + + /* + * return all pseudo-legal moves (this includes moves that allow the king + * to be captured) + */ + if (!legal || this._kings[us] === -1) { + return moves + } + + // filter out illegal moves + const legalMoves = [] + + for (let i = 0, len = moves.length; i < len; i++) { + this._makeMove(moves[i]) + if (!this._isKingAttacked(us)) { + legalMoves.push(moves[i]) + } + this._undoMove() + } + + return legalMoves + } + + move( + move: string | { from: string; to: string; promotion?: string } | null, + { strict = false }: { strict?: boolean } = {}, + ): Move { + /* + * The move function can be called with in the following parameters: + * + * .move('Nxb7') <- argument is a case-sensitive SAN string + * + * .move({ from: 'h7', <- argument is a move object + * to :'h8', + * promotion: 'q' }) + * + * + * An optional strict argument may be supplied to tell chess.js to + * strictly follow the SAN specification. + */ + + let moveObj = null + + if (typeof move === 'string') { + moveObj = this._moveFromSan(move, strict) + } else if (move === null) { + moveObj = this._moveFromSan(SAN_NULLMOVE, strict) + } else if (typeof move === 'object') { + const moves = this._moves() + + // convert the pretty move object to an ugly move object + for (let i = 0, len = moves.length; i < len; i++) { + if ( + move.from === algebraic(moves[i].from) && + move.to === algebraic(moves[i].to) && + (!('promotion' in moves[i]) || move.promotion === moves[i].promotion) + ) { + moveObj = moves[i] + break + } + } + } + + // failed to find move + if (!moveObj) { + if (typeof move === 'string') { + throw new Error(`Invalid move: ${move}`) + } else { + throw new Error(`Invalid move: ${JSON.stringify(move)}`) + } + } + + //disallow null moves when in check + if (this.isCheck() && moveObj.flags & BITS.NULL_MOVE) { + throw new Error('Null move not allowed when in check') + } + + /* + * need to make a copy of move because we can't generate SAN after the move + * is made + */ + const prettyMove = new Move(this, moveObj) + + this._makeMove(moveObj) + this._incPositionCount() + return prettyMove + } + + private _push(move: InternalMove) { + this._history.push({ + move, + kings: { b: this._kings.b, w: this._kings.w }, + turn: this._turn, + castling: { b: this._castling.b, w: this._castling.w }, + epSquare: this._epSquare, + halfMoves: this._halfMoves, + moveNumber: this._moveNumber, + }) + } + + private _movePiece(from: number, to: number) { + this._hash ^= this._pieceKey(from) + + this._board[to] = this._board[from] + delete this._board[from] + + this._hash ^= this._pieceKey(to) + } + + private _makeMove(move: InternalMove) { + const us = this._turn + const them = swapColor(us) + this._push(move) + + if (move.flags & BITS.NULL_MOVE) { + if (us === BLACK) { + this._moveNumber++ + } + this._halfMoves++ + this._turn = them + + this._epSquare = EMPTY + + return + } + + this._hash ^= this._epKey() + this._hash ^= this._castlingKey() + + if (move.captured) { + this._hash ^= this._pieceKey(move.to) + } + + this._movePiece(move.from, move.to) + + // if ep capture, remove the captured pawn + if (move.flags & BITS.EP_CAPTURE) { + if (this._turn === BLACK) { + this._clear(move.to - 16) + } else { + this._clear(move.to + 16) + } + } + + // if pawn promotion, replace with new piece + if (move.promotion) { + this._clear(move.to) + this._set(move.to, { type: move.promotion, color: us }) + } + + // if we moved the king + if (this._board[move.to].type === KING) { + this._kings[us] = move.to + + // if we castled, move the rook next to the king + if (move.flags & BITS.KSIDE_CASTLE) { + const castlingTo = move.to - 1 + const castlingFrom = move.to + 1 + this._movePiece(castlingFrom, castlingTo) + } else if (move.flags & BITS.QSIDE_CASTLE) { + const castlingTo = move.to + 1 + const castlingFrom = move.to - 2 + this._movePiece(castlingFrom, castlingTo) + } + + // turn off castling + this._castling[us] = 0 + } + + // turn off castling if we move a rook + if (this._castling[us]) { + for (let i = 0, len = ROOKS[us].length; i < len; i++) { + if ( + move.from === ROOKS[us][i].square && + this._castling[us] & ROOKS[us][i].flag + ) { + this._castling[us] ^= ROOKS[us][i].flag + break + } + } + } + + // turn off castling if we capture a rook + if (this._castling[them]) { + for (let i = 0, len = ROOKS[them].length; i < len; i++) { + if ( + move.to === ROOKS[them][i].square && + this._castling[them] & ROOKS[them][i].flag + ) { + this._castling[them] ^= ROOKS[them][i].flag + break + } + } + } + + this._hash ^= this._castlingKey() + + // if big pawn move, update the en passant square + if (move.flags & BITS.BIG_PAWN) { + let epSquare + + if (us === BLACK) { + epSquare = move.to - 16 + } else { + epSquare = move.to + 16 + } + + if ( + (!((move.to - 1) & 0x88) && + this._board[move.to - 1]?.type === PAWN && + this._board[move.to - 1]?.color === them) || + (!((move.to + 1) & 0x88) && + this._board[move.to + 1]?.type === PAWN && + this._board[move.to + 1]?.color === them) + ) { + this._epSquare = epSquare + this._hash ^= this._epKey() + } else { + this._epSquare = EMPTY + } + } else { + this._epSquare = EMPTY + } + + // reset the 50 move counter if a pawn is moved or a piece is captured + if (move.piece === PAWN) { + this._halfMoves = 0 + } else if (move.flags & (BITS.CAPTURE | BITS.EP_CAPTURE)) { + this._halfMoves = 0 + } else { + this._halfMoves++ + } + + if (us === BLACK) { + this._moveNumber++ + } + + this._turn = them + this._hash ^= SIDE_KEY + } + + undo(): Move | null { + const hash = this._hash + const move = this._undoMove() + if (move) { + const prettyMove = new Move(this, move) + this._decPositionCount(hash) + return prettyMove + } + return null + } + + private _undoMove(): InternalMove | null { + const old = this._history.pop() + if (old === undefined) { + return null + } + + this._hash ^= this._epKey() + this._hash ^= this._castlingKey() + + const move = old.move + + this._kings = old.kings + this._turn = old.turn + this._castling = old.castling + this._epSquare = old.epSquare + this._halfMoves = old.halfMoves + this._moveNumber = old.moveNumber + + this._hash ^= this._epKey() + this._hash ^= this._castlingKey() + this._hash ^= SIDE_KEY + + const us = this._turn + const them = swapColor(us) + + if (move.flags & BITS.NULL_MOVE) { + return move + } + + this._movePiece(move.to, move.from) + + // to undo any promotions + if (move.piece) { + this._clear(move.from) + this._set(move.from, { type: move.piece, color: us }) + } + + if (move.captured) { + if (move.flags & BITS.EP_CAPTURE) { + // en passant capture + let index: number + if (us === BLACK) { + index = move.to - 16 + } else { + index = move.to + 16 + } + this._set(index, { type: PAWN, color: them }) + } else { + // regular capture + this._set(move.to, { type: move.captured, color: them }) + } + } + + if (move.flags & (BITS.KSIDE_CASTLE | BITS.QSIDE_CASTLE)) { + let castlingTo: number, castlingFrom: number + if (move.flags & BITS.KSIDE_CASTLE) { + castlingTo = move.to + 1 + castlingFrom = move.to - 1 + } else { + castlingTo = move.to - 2 + castlingFrom = move.to + 1 + } + this._movePiece(castlingFrom, castlingTo) + } + + return move + } + + pgn({ + newline = '\n', + maxWidth = 0, + }: { newline?: string; maxWidth?: number } = {}): string { + /* + * using the specification from http://www.chessclub.com/help/PGN-spec + * example for html usage: .pgn({ max_width: 72, newline_char: "
      " }) + */ + + const result: string[] = [] + let headerExists = false + + /* add the PGN header information */ + for (const i in this._header) { + /* + * TODO: order of enumerated properties in header object is not + * guaranteed, see ECMA-262 spec (section 12.6.4) + * + * By using HEADER_TEMPLATE, the order of tags should be preserved; we + * do have to check for null placeholders, though, and omit them + */ + const headerTag = this._header[i] + if (headerTag) result.push(`[${i} "${this._header[i]}"]` + newline) + headerExists = true + } + + if (headerExists && this._history.length) { + result.push(newline) + } + + const appendComment = (moveString: string) => { + const comment = this._comments[this.fen()] + if (typeof comment !== 'undefined') { + const delimiter = moveString.length > 0 ? ' ' : '' + moveString = `${moveString}${delimiter}{${comment}}` + } + return moveString + } + + // pop all of history onto reversed_history + const reversedHistory = [] + while (this._history.length > 0) { + reversedHistory.push(this._undoMove()) + } + + const moves = [] + let moveString = '' + + // special case of a commented starting position with no moves + if (reversedHistory.length === 0) { + moves.push(appendComment('')) + } + + // build the list of moves. a move_string looks like: "3. e3 e6" + while (reversedHistory.length > 0) { + moveString = appendComment(moveString) + const move = reversedHistory.pop() + + // make TypeScript stop complaining about move being undefined + if (!move) { + break + } + + // if the position started with black to move, start PGN with #. ... + if (!this._history.length && move.color === 'b') { + const prefix = `${this._moveNumber}. ...` + // is there a comment preceding the first move? + moveString = moveString ? `${moveString} ${prefix}` : prefix + } else if (move.color === 'w') { + // store the previous generated move_string if we have one + if (moveString.length) { + moves.push(moveString) + } + moveString = this._moveNumber + '.' + } + + moveString = + moveString + ' ' + this._moveToSan(move, this._moves({ legal: true })) + this._makeMove(move) + } + + // are there any other leftover moves? + if (moveString.length) { + moves.push(appendComment(moveString)) + } + + // is there a result? (there ALWAYS has to be a result according to spec; see Seven Tag Roster) + moves.push(this._header.Result || '*') + + /* + * history should be back to what it was before we started generating PGN, + * so join together moves + */ + if (maxWidth === 0) { + return result.join('') + moves.join(' ') + } + + // TODO (jah): huh? + const strip = function () { + if (result.length > 0 && result[result.length - 1] === ' ') { + result.pop() + return true + } + return false + } + + // NB: this does not preserve comment whitespace. + const wrapComment = function (width: number, move: string) { + for (const token of move.split(' ')) { + if (!token) { + continue + } + if (width + token.length > maxWidth) { + while (strip()) { + width-- + } + result.push(newline) + width = 0 + } + result.push(token) + width += token.length + result.push(' ') + width++ + } + if (strip()) { + width-- + } + return width + } + + // wrap the PGN output at max_width + let currentWidth = 0 + for (let i = 0; i < moves.length; i++) { + if (currentWidth + moves[i].length > maxWidth) { + if (moves[i].includes('{')) { + currentWidth = wrapComment(currentWidth, moves[i]) + continue + } + } + // if the current move will push past max_width + if (currentWidth + moves[i].length > maxWidth && i !== 0) { + // don't end the line with whitespace + if (result[result.length - 1] === ' ') { + result.pop() + } + + result.push(newline) + currentWidth = 0 + } else if (i !== 0) { + result.push(' ') + currentWidth++ + } + result.push(moves[i]) + currentWidth += moves[i].length + } + + return result.join('') + } + + /** + * @deprecated Use `setHeader` and `getHeaders` instead. This method will return null header tags (which is not what you want) + */ + header(...args: string[]): Record { + for (let i = 0; i < args.length; i += 2) { + if (typeof args[i] === 'string' && typeof args[i + 1] === 'string') { + this._header[args[i]] = args[i + 1] + } + } + return this._header + } + + // TODO: value validation per spec + setHeader(key: string, value: string): Record { + this._header[key] = value ?? SEVEN_TAG_ROSTER[key] ?? null + return this.getHeaders() + } + + removeHeader(key: string): boolean { + if (key in this._header) { + this._header[key] = SEVEN_TAG_ROSTER[key] || null + return true + } + return false + } + + // return only non-null headers (omit placemarker nulls) + getHeaders(): Record { + const nonNullHeaders: Record = {} + for (const [key, value] of Object.entries(this._header)) { + if (value !== null) { + nonNullHeaders[key] = value + } + } + return nonNullHeaders + } + + loadPgn( + pgn: string, + { + strict = false, + newlineChar = '\r?\n', + }: { strict?: boolean; newlineChar?: string } = {}, + ) { + // If newlineChar is not the default, replace all instances with \n + if (newlineChar !== '\r?\n') { + pgn = pgn.replace(new RegExp(newlineChar, 'g'), '\n') + } + + const parsedPgn = parse(pgn) + + // Put the board in the starting position + this.reset() + + // parse PGN header + const headers = parsedPgn.headers + let fen = '' + + for (const key in headers) { + // check to see user is including fen (possibly with wrong tag case) + if (key.toLowerCase() === 'fen') { + fen = headers[key] + } + + this.header(key, headers[key]) + } + + /* + * the permissive parser should attempt to load a fen tag, even if it's the + * wrong case and doesn't include a corresponding [SetUp "1"] tag + */ + if (!strict) { + if (fen) { + this.load(fen, { preserveHeaders: true }) + } + } else { + /* + * strict parser - load the starting position indicated by [Setup '1'] + * and [FEN position] + */ + if (headers['SetUp'] === '1') { + if (!('FEN' in headers)) { + throw new Error( + 'Invalid PGN: FEN tag must be supplied with SetUp tag', + ) + } + // don't clear the headers when loading + this.load(headers['FEN'], { preserveHeaders: true }) + } + } + + let node = parsedPgn.root + + while (node) { + if (node.move) { + const move = this._moveFromSan(node.move, strict) + + if (move == null) { + throw new Error(`Invalid move in PGN: ${node.move}`) + } else { + this._makeMove(move) + this._incPositionCount() + } + } + + if (node.comment !== undefined) { + this._comments[this.fen()] = node.comment + } + + node = node.variations[0] + } + + /* + * Per section 8.2.6 of the PGN spec, the Result tag pair must match match + * the termination marker. Only do this when headers are present, but the + * result tag is missing + */ + + const result = parsedPgn.result + if ( + result && + Object.keys(this._header).length && + this._header['Result'] !== result + ) { + this.setHeader('Result', result) + } + } + + /* + * Convert a move from 0x88 coordinates to Standard Algebraic Notation + * (SAN) + * + * @param {boolean} strict Use the strict SAN parser. It will throw errors + * on overly disambiguated moves (see below): + * + * r1bqkbnr/ppp2ppp/2n5/1B1pP3/4P3/8/PPPP2PP/RNBQK1NR b KQkq - 2 4 + * 4. ... Nge7 is overly disambiguated because the knight on c6 is pinned + * 4. ... Ne7 is technically the valid SAN + */ + + private _moveToSan(move: InternalMove, moves: InternalMove[]): string { + let output = '' + + if (move.flags & BITS.KSIDE_CASTLE) { + output = 'O-O' + } else if (move.flags & BITS.QSIDE_CASTLE) { + output = 'O-O-O' + } else if (move.flags & BITS.NULL_MOVE) { + return SAN_NULLMOVE + } else { + if (move.piece !== PAWN) { + const disambiguator = getDisambiguator(move, moves) + output += move.piece.toUpperCase() + disambiguator + } + + if (move.flags & (BITS.CAPTURE | BITS.EP_CAPTURE)) { + if (move.piece === PAWN) { + output += algebraic(move.from)[0] + } + output += 'x' + } + + output += algebraic(move.to) + + if (move.promotion) { + output += '=' + move.promotion.toUpperCase() + } + } + + this._makeMove(move) + if (this.isCheck()) { + if (this.isCheckmate()) { + output += '#' + } else { + output += '+' + } + } + this._undoMove() + + return output + } + + // convert a move from Standard Algebraic Notation (SAN) to 0x88 coordinates + private _moveFromSan(move: string, strict = false): InternalMove | null { + // strip off any move decorations: e.g Nf3+?! becomes Nf3 + let cleanMove = strippedSan(move) + + if (!strict) { + if (cleanMove === '0-0') { + cleanMove = 'O-O' + } else if (cleanMove === '0-0-0') { + cleanMove = 'O-O-O' + } + } + + //first implementation of null with a dummy move (black king moves from a8 to a8), maybe this can be implemented better + if (cleanMove == SAN_NULLMOVE) { + const res: InternalMove = { + color: this._turn, + from: 0, + to: 0, + piece: 'k', + flags: BITS.NULL_MOVE, + } + return res + } + + let pieceType = inferPieceType(cleanMove) + let moves = this._moves({ legal: true, piece: pieceType }) + + // strict parser + for (let i = 0, len = moves.length; i < len; i++) { + if (cleanMove === strippedSan(this._moveToSan(moves[i], moves))) { + return moves[i] + } + } + + // the strict parser failed + if (strict) { + return null + } + + let piece = undefined + let matches = undefined + let from = undefined + let to = undefined + let promotion = undefined + + /* + * The default permissive (non-strict) parser allows the user to parse + * non-standard chess notations. This parser is only run after the strict + * Standard Algebraic Notation (SAN) parser has failed. + * + * When running the permissive parser, we'll run a regex to grab the piece, the + * to/from square, and an optional promotion piece. This regex will + * parse common non-standard notation like: Pe2-e4, Rc1c4, Qf3xf7, + * f7f8q, b1c3 + * + * NOTE: Some positions and moves may be ambiguous when using the permissive + * parser. For example, in this position: 6k1/8/8/B7/8/8/8/BN4K1 w - - 0 1, + * the move b1c3 may be interpreted as Nc3 or B1c3 (a disambiguated bishop + * move). In these cases, the permissive parser will default to the most + * basic interpretation (which is b1c3 parsing to Nc3). + */ + + let overlyDisambiguated = false + + matches = cleanMove.match( + /([pnbrqkPNBRQK])?([a-h][1-8])x?-?([a-h][1-8])([qrbnQRBN])?/, + // piece from to promotion + ) + + if (matches) { + piece = matches[1] + from = matches[2] as Square + to = matches[3] as Square + promotion = matches[4] + + if (from.length == 1) { + overlyDisambiguated = true + } + } else { + /* + * The [a-h]?[1-8]? portion of the regex below handles moves that may be + * overly disambiguated (e.g. Nge7 is unnecessary and non-standard when + * there is one legal knight move to e7). In this case, the value of + * 'from' variable will be a rank or file, not a square. + */ + + matches = cleanMove.match( + /([pnbrqkPNBRQK])?([a-h]?[1-8]?)x?-?([a-h][1-8])([qrbnQRBN])?/, + ) + + if (matches) { + piece = matches[1] + from = matches[2] as Square + to = matches[3] as Square + promotion = matches[4] + + if (from.length == 1) { + overlyDisambiguated = true + } + } + } + + pieceType = inferPieceType(cleanMove) + moves = this._moves({ + legal: true, + piece: piece ? (piece as PieceSymbol) : pieceType, + }) + + if (!to) { + return null + } + + for (let i = 0, len = moves.length; i < len; i++) { + if (!from) { + // if there is no from square, it could be just 'x' missing from a capture + if ( + cleanMove === + strippedSan(this._moveToSan(moves[i], moves)).replace('x', '') + ) { + return moves[i] + } + // hand-compare move properties with the results from our permissive regex + } else if ( + (!piece || piece.toLowerCase() == moves[i].piece) && + Ox88[from] == moves[i].from && + Ox88[to] == moves[i].to && + (!promotion || promotion.toLowerCase() == moves[i].promotion) + ) { + return moves[i] + } else if (overlyDisambiguated) { + /* + * SPECIAL CASE: we parsed a move string that may have an unneeded + * rank/file disambiguator (e.g. Nge7). The 'from' variable will + */ + + const square = algebraic(moves[i].from) + if ( + (!piece || piece.toLowerCase() == moves[i].piece) && + Ox88[to] == moves[i].to && + (from == square[0] || from == square[1]) && + (!promotion || promotion.toLowerCase() == moves[i].promotion) + ) { + return moves[i] + } + } + } + + return null + } + + ascii(): string { + let s = ' +------------------------+\n' + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + // display the rank + if (file(i) === 0) { + s += ' ' + '87654321'[rank(i)] + ' |' + } + + if (this._board[i]) { + const piece = this._board[i].type + const color = this._board[i].color + const symbol = + color === WHITE ? piece.toUpperCase() : piece.toLowerCase() + s += ' ' + symbol + ' ' + } else { + s += ' . ' + } + + if ((i + 1) & 0x88) { + s += '|\n' + i += 8 + } + } + s += ' +------------------------+\n' + s += ' a b c d e f g h' + + return s + } + + perft(depth: number): number { + const moves = this._moves({ legal: false }) + let nodes = 0 + const color = this._turn + + for (let i = 0, len = moves.length; i < len; i++) { + this._makeMove(moves[i]) + if (!this._isKingAttacked(color)) { + if (depth - 1 > 0) { + nodes += this.perft(depth - 1) + } else { + nodes++ + } + } + this._undoMove() + } + + return nodes + } + + setTurn(color: Color): boolean { + if (this._turn == color) { + return false + } + + this.move('--') + return true + } + + turn(): Color { + return this._turn + } + + board(): ({ square: Square; type: PieceSymbol; color: Color } | null)[][] { + const output = [] + let row = [] + + for (let i = Ox88.a8; i <= Ox88.h1; i++) { + if (this._board[i] == null) { + row.push(null) + } else { + row.push({ + square: algebraic(i), + type: this._board[i].type, + color: this._board[i].color, + }) + } + if ((i + 1) & 0x88) { + output.push(row) + row = [] + i += 8 + } + } + + return output + } + + squareColor(square: Square): 'light' | 'dark' | null { + if (square in Ox88) { + const sq = Ox88[square] + return (rank(sq) + file(sq)) % 2 === 0 ? 'light' : 'dark' + } + + return null + } + + history(): string[] + history({ verbose }: { verbose: true }): Move[] + history({ verbose }: { verbose: false }): string[] + history({ verbose }: { verbose: boolean }): string[] | Move[] + history({ verbose = false }: { verbose?: boolean } = {}) { + const reversedHistory = [] + const moveHistory = [] + + while (this._history.length > 0) { + reversedHistory.push(this._undoMove()) + } + + while (true) { + const move = reversedHistory.pop() + if (!move) { + break + } + + if (verbose) { + moveHistory.push(new Move(this, move)) + } else { + moveHistory.push(this._moveToSan(move, this._moves())) + } + this._makeMove(move) + } + + return moveHistory + } + + /* + * Keeps track of position occurrence counts for the purpose of repetition + * checking. Old positions are removed from the map if their counts are reduced to 0. + */ + private _getPositionCount(hash: bigint): number { + return this._positionCount.get(hash) ?? 0 + } + + private _incPositionCount() { + this._positionCount.set( + this._hash, + (this._positionCount.get(this._hash) ?? 0) + 1, + ) + } + + private _decPositionCount(hash: bigint) { + const currentCount = this._positionCount.get(hash) ?? 0 + + if (currentCount === 1) { + this._positionCount.delete(hash) + } else { + this._positionCount.set(hash, currentCount - 1) + } + } + + private _pruneComments() { + const reversedHistory = [] + const currentComments: Record = {} + + const copyComment = (fen: string) => { + if (fen in this._comments) { + currentComments[fen] = this._comments[fen] + } + } + + while (this._history.length > 0) { + reversedHistory.push(this._undoMove()) + } + + copyComment(this.fen()) + + while (true) { + const move = reversedHistory.pop() + if (!move) { + break + } + this._makeMove(move) + copyComment(this.fen()) + } + this._comments = currentComments + } + + getComment(): string { + return this._comments[this.fen()] + } + + setComment(comment: string) { + this._comments[this.fen()] = comment.replace('{', '[').replace('}', ']') + } + + /** + * @deprecated Renamed to `removeComment` for consistency + */ + deleteComment(): string { + return this.removeComment() + } + + removeComment(): string { + const comment = this._comments[this.fen()] + delete this._comments[this.fen()] + return comment + } + + getComments(): { fen: string; comment: string }[] { + this._pruneComments() + return Object.keys(this._comments).map((fen: string) => { + return { fen: fen, comment: this._comments[fen] } + }) + } + + /** + * @deprecated Renamed to `removeComments` for consistency + */ + deleteComments(): { fen: string; comment: string }[] { + return this.removeComments() + } + + removeComments(): { fen: string; comment: string }[] { + this._pruneComments() + return Object.keys(this._comments).map((fen) => { + const comment = this._comments[fen] + delete this._comments[fen] + return { fen: fen, comment: comment } + }) + } + + setCastlingRights( + color: Color, + rights: Partial>, + ): boolean { + for (const side of [KING, QUEEN] as const) { + if (rights[side] !== undefined) { + if (rights[side]) { + this._castling[color] |= SIDES[side] + } else { + this._castling[color] &= ~SIDES[side] + } + } + } + + this._updateCastlingRights() + const result = this.getCastlingRights(color) + + return ( + (rights[KING] === undefined || rights[KING] === result[KING]) && + (rights[QUEEN] === undefined || rights[QUEEN] === result[QUEEN]) + ) + } + + getCastlingRights(color: Color): { [KING]: boolean; [QUEEN]: boolean } { + return { + [KING]: (this._castling[color] & SIDES[KING]) !== 0, + [QUEEN]: (this._castling[color] & SIDES[QUEEN]) !== 0, + } + } + + moveNumber(): number { + return this._moveNumber + } +} diff --git a/node_modules/chess.js/src/node.ts b/node_modules/chess.js/src/node.ts new file mode 100644 index 0000000..e310b1f --- /dev/null +++ b/node_modules/chess.js/src/node.ts @@ -0,0 +1,7 @@ +export type Node = { + move?: string + suffix?: string + nag?: string + comment?: string + variations: Node[] +} diff --git a/node_modules/chess.js/src/pgn.d.ts b/node_modules/chess.js/src/pgn.d.ts new file mode 100644 index 0000000..d775bd4 --- /dev/null +++ b/node_modules/chess.js/src/pgn.d.ts @@ -0,0 +1,209 @@ +/** Provides information pointing to a location within a source. */ +export interface Location { + /** Line in the parsed source (1-based). */ + readonly line: number; + /** Column in the parsed source (1-based). */ + readonly column: number; + /** Offset in the parsed source (0-based). */ + readonly offset: number; +} + +/** + * Anything that can successfully be converted to a string with `String()` + * so that it can be used in error messages. + * + * The GrammarLocation class in Peggy is a good example. + */ +export interface GrammarSourceObject { + readonly toString: () => string; + + /** + * If specified, allows the grammar source to be embedded in a larger file + * at some offset. + */ + readonly offset?: undefined | ((loc: Location) => Location); +} + +/** + * Most often, you just use a string with the file name. + */ +export type GrammarSource = string | GrammarSourceObject; + +/** The `start` and `end` position's of an object within the source. */ +export interface LocationRange { + /** + * A string or object that was supplied to the `parse()` call as the + * `grammarSource` option. + */ + readonly source: GrammarSource; + /** Position at the beginning of the expression. */ + readonly start: Location; + /** Position after the end of the expression. */ + readonly end: Location; +} + +/** + * Expected a literal string, like `"foo"i`. + */ +export interface LiteralExpectation { + readonly type: "literal"; + readonly text: string; + readonly ignoreCase: boolean; +} + +/** + * Range of characters, like `a-z` + */ +export type ClassRange = [ + start: string, + end: string, +] + +export interface ClassParts extends Array { +} + +/** + * Expected a class, such as `[^acd-gz]i` + */ +export interface ClassExpectation { + readonly type: "class"; + readonly parts: ClassParts; + readonly inverted: boolean; + readonly ignoreCase: boolean; +} + +/** + * Expected any character, with `.` + */ +export interface AnyExpectation { + readonly type: "any"; +} + +/** + * Expected the end of input. + */ +export interface EndExpectation { + readonly type: "end"; +} + +/** + * Expected some other input. These are specified with a rule's + * "human-readable name", or with the `expected(message, location)` + * function. + */ +export interface OtherExpectation { + readonly type: "other"; + readonly description: string; +} + +export type Expectation = + | AnyExpectation + | ClassExpectation + | EndExpectation + | LiteralExpectation + | OtherExpectation; + +/** + * Pass an array of these into `SyntaxError.prototype.format()` + */ +export interface SourceText { + /** + * Identifier of an input that was used as a grammarSource in parse(). + */ + readonly source: GrammarSource; + /** Source text of the input. */ + readonly text: string; +} + +export declare class SyntaxError extends Error { + /** + * Constructs the human-readable message from the machine representation. + * + * @param expected Array of expected items, generated by the parser + * @param found Any text that will appear as found in the input instead of + * expected + */ + static buildMessage(expected: Expectation[], found?: string | null | undefined): string; + readonly message: string; + readonly expected: Expectation[]; + readonly found: string | null | undefined; + readonly location: LocationRange; + readonly name: string; + constructor( + message: string, + expected: Expectation[], + found: string | null, + location: LocationRange, + ); + + /** + * With good sources, generates a feature-rich error message pointing to the + * error in the input. + * @param sources List of {source, text} objects that map to the input. + */ + format(sources: SourceText[]): string; +} + +/** + * Trace execution of the parser. + */ +export interface ParserTracer { + trace: (event: ParserTracerEvent) => void; +} + +export type ParserTracerEvent + = { + readonly type: "rule.enter"; + readonly rule: string; + readonly location: LocationRange + } + | { + readonly type: "rule.fail"; + readonly rule: string; + readonly location: LocationRange + } + | { + readonly type: "rule.match"; + readonly rule: string; + readonly location: LocationRange + /** Return value from the rule. */ + readonly result: unknown; + }; + +export type StartRuleNames = "pgn"; +export interface ParseOptions { + /** + * String or object that will be attached to the each `LocationRange` object + * created by the parser. For example, this can be path to the parsed file + * or even the File object. + */ + readonly grammarSource?: GrammarSource; + readonly startRule?: T; + readonly tracer?: ParserTracer; + + // Internal use only: + readonly peg$library?: boolean; + // Internal use only: + peg$currPos?: number; + // Internal use only: + peg$silentFails?: number; + // Internal use only: + peg$maxFailExpected?: Expectation[]; + // Extra application-specific properties + [key: string]: unknown; +} + +export declare const StartRules: StartRuleNames[]; +export declare const parse: typeof ParseFunction; + +// Overload of ParseFunction for each allowedStartRule + +declare function ParseFunction>( + input: string, + options?: Options, +): { headers: Record, root: import("./node").Node, result?: string }; + +declare function ParseFunction>( + input: string, + options?: Options, +): { headers: Record, root: import("./node").Node, result?: string }; diff --git a/node_modules/chess.js/src/pgn.js b/node_modules/chess.js/src/pgn.js new file mode 100644 index 0000000..ddf0708 --- /dev/null +++ b/node_modules/chess.js/src/pgn.js @@ -0,0 +1,1313 @@ +// @generated by Peggy 4.2.0. +// +// https://peggyjs.org/ + + + + function rootNode(comment) { + return comment !== null ? { comment, variations: [] } : { variations: []} + } + + function node(move, suffix, nag, comment, variations) { + const node = { move, variations } + + if (suffix) { + node.suffix = suffix + } + + if (nag) { + node.nag = nag + } + + if (comment !== null) { + node.comment = comment + } + + return node + } + + function lineToTree(...nodes) { + const [root, ...rest] = nodes; + + let parent = root + + for (const child of rest) { + if (child !== null) { + parent.variations = [child, ...child.variations] + child.variations = [] + parent = child + } + } + + return root + } + + function pgn(headers, game) { + if (game.marker && game.marker.comment) { + let node = game.root + while (true) { + const next = node.variations[0] + if (!next) { + node.comment = game.marker.comment + break + } + node = next + } + } + + return { + headers, + root: game.root, + result: (game.marker && game.marker.result) ?? undefined + } + } + +function peg$subclass(child, parent) { + function C() { this.constructor = child; } + C.prototype = parent.prototype; + child.prototype = new C(); +} + +function peg$SyntaxError(message, expected, found, location) { + var self = Error.call(this, message); + // istanbul ignore next Check is a necessary evil to support older environments + if (Object.setPrototypeOf) { + Object.setPrototypeOf(self, peg$SyntaxError.prototype); + } + self.expected = expected; + self.found = found; + self.location = location; + self.name = "SyntaxError"; + return self; +} + +peg$subclass(peg$SyntaxError, Error); + +function peg$padEnd(str, targetLength, padString) { + padString = padString || " "; + if (str.length > targetLength) { return str; } + targetLength -= str.length; + padString += padString.repeat(targetLength); + return str + padString.slice(0, targetLength); +} + +peg$SyntaxError.prototype.format = function(sources) { + var str = "Error: " + this.message; + if (this.location) { + var src = null; + var k; + for (k = 0; k < sources.length; k++) { + if (sources[k].source === this.location.source) { + src = sources[k].text.split(/\r\n|\n|\r/g); + break; + } + } + var s = this.location.start; + var offset_s = (this.location.source && (typeof this.location.source.offset === "function")) + ? this.location.source.offset(s) + : s; + var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column; + if (src) { + var e = this.location.end; + var filler = peg$padEnd("", offset_s.line.toString().length, ' '); + var line = src[s.line - 1]; + var last = s.line === e.line ? e.column : line.length + 1; + var hatLen = (last - s.column) || 1; + str += "\n --> " + loc + "\n" + + filler + " |\n" + + offset_s.line + " | " + line + "\n" + + filler + " | " + peg$padEnd("", s.column - 1, ' ') + + peg$padEnd("", hatLen, "^"); + } else { + str += "\n at " + loc; + } + } + return str; +}; + +peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + + class: function(expectation) { + var escapedParts = expectation.parts.map(function(part) { + return Array.isArray(part) + ? classEscape(part[0]) + "-" + classEscape(part[1]) + : classEscape(part); + }); + + return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]"; + }, + + any: function() { + return "any character"; + }, + + end: function() { + return "end of input"; + }, + + other: function(expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + function literalEscape(s) { + return s + .replace(/\\/g, "\\\\") + .replace(/"/g, "\\\"") + .replace(/\0/g, "\\0") + .replace(/\t/g, "\\t") + .replace(/\n/g, "\\n") + .replace(/\r/g, "\\r") + .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); + } + + function classEscape(s) { + return s + .replace(/\\/g, "\\\\") + .replace(/\]/g, "\\]") + .replace(/\^/g, "\\^") + .replace(/-/g, "\\-") + .replace(/\0/g, "\\0") + .replace(/\t/g, "\\t") + .replace(/\n/g, "\\n") + .replace(/\r/g, "\\r") + .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = expected.map(describeExpectation); + var i, j; + + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + descriptions.length = j; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; +}; + +function peg$parse(input, options) { + options = options !== undefined ? options : {}; + + var peg$FAILED = {}; + var peg$source = options.grammarSource; + + var peg$startRuleFunctions = { pgn: peg$parsepgn }; + var peg$startRuleFunction = peg$parsepgn; + + var peg$c0 = "["; + var peg$c1 = "\""; + var peg$c2 = "]"; + var peg$c3 = "."; + var peg$c4 = "O-O-O"; + var peg$c5 = "O-O"; + var peg$c6 = "0-0-0"; + var peg$c7 = "0-0"; + var peg$c8 = "$"; + var peg$c9 = "{"; + var peg$c10 = "}"; + var peg$c11 = ";"; + var peg$c12 = "("; + var peg$c13 = ")"; + var peg$c14 = "1-0"; + var peg$c15 = "0-1"; + var peg$c16 = "1/2-1/2"; + var peg$c17 = "*"; + + var peg$r0 = /^[a-zA-Z]/; + var peg$r1 = /^[^"]/; + var peg$r2 = /^[0-9]/; + var peg$r3 = /^[.]/; + var peg$r4 = /^[a-zA-Z1-8\-=]/; + var peg$r5 = /^[+#]/; + var peg$r6 = /^[!?]/; + var peg$r7 = /^[^}]/; + var peg$r8 = /^[^\r\n]/; + var peg$r9 = /^[ \t\r\n]/; + + var peg$e0 = peg$otherExpectation("tag pair"); + var peg$e1 = peg$literalExpectation("[", false); + var peg$e2 = peg$literalExpectation("\"", false); + var peg$e3 = peg$literalExpectation("]", false); + var peg$e4 = peg$otherExpectation("tag name"); + var peg$e5 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false); + var peg$e6 = peg$otherExpectation("tag value"); + var peg$e7 = peg$classExpectation(["\""], true, false); + var peg$e8 = peg$otherExpectation("move number"); + var peg$e9 = peg$classExpectation([["0", "9"]], false, false); + var peg$e10 = peg$literalExpectation(".", false); + var peg$e11 = peg$classExpectation(["."], false, false); + var peg$e12 = peg$otherExpectation("standard algebraic notation"); + var peg$e13 = peg$literalExpectation("O-O-O", false); + var peg$e14 = peg$literalExpectation("O-O", false); + var peg$e15 = peg$literalExpectation("0-0-0", false); + var peg$e16 = peg$literalExpectation("0-0", false); + var peg$e17 = peg$classExpectation([["a", "z"], ["A", "Z"], ["1", "8"], "-", "="], false, false); + var peg$e18 = peg$classExpectation(["+", "#"], false, false); + var peg$e19 = peg$otherExpectation("suffix annotation"); + var peg$e20 = peg$classExpectation(["!", "?"], false, false); + var peg$e21 = peg$otherExpectation("NAG"); + var peg$e22 = peg$literalExpectation("$", false); + var peg$e23 = peg$otherExpectation("brace comment"); + var peg$e24 = peg$literalExpectation("{", false); + var peg$e25 = peg$classExpectation(["}"], true, false); + var peg$e26 = peg$literalExpectation("}", false); + var peg$e27 = peg$otherExpectation("rest of line comment"); + var peg$e28 = peg$literalExpectation(";", false); + var peg$e29 = peg$classExpectation(["\r", "\n"], true, false); + var peg$e30 = peg$otherExpectation("variation"); + var peg$e31 = peg$literalExpectation("(", false); + var peg$e32 = peg$literalExpectation(")", false); + var peg$e33 = peg$otherExpectation("game termination marker"); + var peg$e34 = peg$literalExpectation("1-0", false); + var peg$e35 = peg$literalExpectation("0-1", false); + var peg$e36 = peg$literalExpectation("1/2-1/2", false); + var peg$e37 = peg$literalExpectation("*", false); + var peg$e38 = peg$otherExpectation("whitespace"); + var peg$e39 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false); + + var peg$f0 = function(headers, game) { return pgn(headers, game) }; + var peg$f1 = function(tagPairs) { return Object.fromEntries(tagPairs) }; + var peg$f2 = function(tagName, tagValue) { return [tagName, tagValue] }; + var peg$f3 = function(root, marker) { return { root, marker} }; + var peg$f4 = function(comment, moves) { return lineToTree(rootNode(comment), ...moves.flat()) }; + var peg$f5 = function(san, suffix, nag, comment, variations) { return node(san, suffix, nag, comment, variations) }; + var peg$f6 = function(nag) { return nag }; + var peg$f7 = function(comment) { return comment.replace(/[\r\n]+/g, " ") }; + var peg$f8 = function(comment) { return comment.trim() }; + var peg$f9 = function(line) { return line }; + var peg$f10 = function(result, comment) { return { result, comment } }; + var peg$currPos = options.peg$currPos | 0; + var peg$savedPos = peg$currPos; + var peg$posDetailsCache = [{ line: 1, column: 1 }]; + var peg$maxFailPos = peg$currPos; + var peg$maxFailExpected = options.peg$maxFailExpected || []; + var peg$silentFails = options.peg$silentFails | 0; + + var peg$result; + + if (options.startRule) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function text() { + return input.substring(peg$savedPos, peg$currPos); + } + + function offset() { + return peg$savedPos; + } + + function range() { + return { + source: peg$source, + start: peg$savedPos, + end: peg$currPos + }; + } + + function location() { + return peg$computeLocation(peg$savedPos, peg$currPos); + } + + function expected(description, location) { + location = location !== undefined + ? location + : peg$computeLocation(peg$savedPos, peg$currPos); + + throw peg$buildStructuredError( + [peg$otherExpectation(description)], + input.substring(peg$savedPos, peg$currPos), + location + ); + } + + function error(message, location) { + location = location !== undefined + ? location + : peg$computeLocation(peg$savedPos, peg$currPos); + + throw peg$buildSimpleError(message, location); + } + + function peg$literalExpectation(text, ignoreCase) { + return { type: "literal", text: text, ignoreCase: ignoreCase }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } + + function peg$anyExpectation() { + return { type: "any" }; + } + + function peg$endExpectation() { + return { type: "end" }; + } + + function peg$otherExpectation(description) { + return { type: "other", description: description }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos]; + var p; + + if (details) { + return details; + } else { + if (pos >= peg$posDetailsCache.length) { + p = peg$posDetailsCache.length - 1; + } else { + p = pos; + while (!peg$posDetailsCache[--p]) {} + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; + } + + peg$posDetailsCache[pos] = details; + + return details; + } + } + + function peg$computeLocation(startPos, endPos, offset) { + var startPosDetails = peg$computePosDetails(startPos); + var endPosDetails = peg$computePosDetails(endPos); + + var res = { + source: peg$source, + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + if (offset && peg$source && (typeof peg$source.offset === "function")) { + res.start = peg$source.offset(res.start); + res.end = peg$source.offset(res.end); + } + return res; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildSimpleError(message, location) { + return new peg$SyntaxError(message, null, null, location); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parsepgn() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parsetagPairSection(); + s2 = peg$parsemoveTextSection(); + peg$savedPos = s0; + s0 = peg$f0(s1, s2); + + return s0; + } + + function peg$parsetagPairSection() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = []; + s2 = peg$parsetagPair(); + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parsetagPair(); + } + s2 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f1(s1); + + return s0; + } + + function peg$parsetagPair() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; + + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 91) { + s2 = peg$c0; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e1); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = peg$parsetagName(); + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 34) { + s6 = peg$c1; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e2); } + } + if (s6 !== peg$FAILED) { + s7 = peg$parsetagValue(); + if (input.charCodeAt(peg$currPos) === 34) { + s8 = peg$c1; + peg$currPos++; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e2); } + } + if (s8 !== peg$FAILED) { + s9 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 93) { + s10 = peg$c2; + peg$currPos++; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e3); } + } + if (s10 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f2(s4, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e0); } + } + + return s0; + } + + function peg$parsetagName() { + var s0, s1, s2; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = input.charAt(peg$currPos); + if (peg$r0.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e5); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = input.charAt(peg$currPos); + if (peg$r0.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e5); } + } + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s0 = input.substring(s0, peg$currPos); + } else { + s0 = s1; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e4); } + } + + return s0; + } + + function peg$parsetagValue() { + var s0, s1, s2; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = input.charAt(peg$currPos); + if (peg$r1.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e7); } + } + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = input.charAt(peg$currPos); + if (peg$r1.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e7); } + } + } + s0 = input.substring(s0, peg$currPos); + peg$silentFails--; + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e6); } + + return s0; + } + + function peg$parsemoveTextSection() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + s1 = peg$parseline(); + s2 = peg$parse_(); + s3 = peg$parsegameTerminationMarker(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f3(s1, s3); + + return s0; + } + + function peg$parseline() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsecomment(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = []; + s3 = peg$parsemove(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parsemove(); + } + peg$savedPos = s0; + s0 = peg$f4(s1, s2); + + return s0; + } + + function peg$parsemove() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; + + s0 = peg$currPos; + s1 = peg$parse_(); + s2 = peg$parsemoveNumber(); + if (s2 === peg$FAILED) { + s2 = null; + } + s3 = peg$parse_(); + s4 = peg$parsesan(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesuffixAnnotation(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = []; + s7 = peg$parsenag(); + while (s7 !== peg$FAILED) { + s6.push(s7); + s7 = peg$parsenag(); + } + s7 = peg$parse_(); + s8 = peg$parsecomment(); + if (s8 === peg$FAILED) { + s8 = null; + } + s9 = []; + s10 = peg$parsevariation(); + while (s10 !== peg$FAILED) { + s9.push(s10); + s10 = peg$parsevariation(); + } + peg$savedPos = s0; + s0 = peg$f5(s4, s5, s6, s8, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsemoveNumber() { + var s0, s1, s2, s3, s4, s5; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = input.charAt(peg$currPos); + if (peg$r2.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = input.charAt(peg$currPos); + if (peg$r2.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + } + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c3; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e10); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = []; + s5 = input.charAt(peg$currPos); + if (peg$r3.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e11); } + } + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = input.charAt(peg$currPos); + if (peg$r3.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e11); } + } + } + s1 = [s1, s2, s3, s4]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e8); } + } + + return s0; + } + + function peg$parsesan() { + var s0, s1, s2, s3, s4, s5; + + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c4) { + s2 = peg$c4; + peg$currPos += 5; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e13); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c5) { + s2 = peg$c5; + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e14); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 5) === peg$c6) { + s2 = peg$c6; + peg$currPos += 5; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e15); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c7) { + s2 = peg$c7; + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e16); } + } + if (s2 === peg$FAILED) { + s2 = peg$currPos; + s3 = input.charAt(peg$currPos); + if (peg$r0.test(s3)) { + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e5); } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = input.charAt(peg$currPos); + if (peg$r4.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e17); } + } + if (s5 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = input.charAt(peg$currPos); + if (peg$r4.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e17); } + } + } + } else { + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s3 = [s3, s4]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } + } + } + } + if (s2 !== peg$FAILED) { + s3 = input.charAt(peg$currPos); + if (peg$r5.test(s3)) { + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e18); } + } + if (s3 === peg$FAILED) { + s3 = null; + } + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s0 = input.substring(s0, peg$currPos); + } else { + s0 = s1; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e12); } + } + + return s0; + } + + function peg$parsesuffixAnnotation() { + var s0, s1, s2; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = input.charAt(peg$currPos); + if (peg$r6.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e20); } + } + while (s2 !== peg$FAILED) { + s1.push(s2); + if (s1.length >= 2) { + s2 = peg$FAILED; + } else { + s2 = input.charAt(peg$currPos); + if (peg$r6.test(s2)) { + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e20); } + } + } + } + if (s1.length < 1) { + peg$currPos = s0; + s0 = peg$FAILED; + } else { + s0 = s1; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e19); } + } + + return s0; + } + + function peg$parsenag() { + var s0, s1, s2, s3, s4, s5; + + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 36) { + s2 = peg$c8; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e22); } + } + if (s2 !== peg$FAILED) { + s3 = peg$currPos; + s4 = []; + s5 = input.charAt(peg$currPos); + if (peg$r2.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + if (s5 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = input.charAt(peg$currPos); + if (peg$r2.test(s5)) { + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + } + } else { + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s3 = input.substring(s3, peg$currPos); + } else { + s3 = s4; + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f6(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e21); } + } + + return s0; + } + + function peg$parsecomment() { + var s0; + + s0 = peg$parsebraceComment(); + if (s0 === peg$FAILED) { + s0 = peg$parserestOfLineComment(); + } + + return s0; + } + + function peg$parsebraceComment() { + var s0, s1, s2, s3, s4; + + peg$silentFails++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 123) { + s1 = peg$c9; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e24); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = []; + s4 = input.charAt(peg$currPos); + if (peg$r7.test(s4)) { + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e25); } + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = input.charAt(peg$currPos); + if (peg$r7.test(s4)) { + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e25); } + } + } + s2 = input.substring(s2, peg$currPos); + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c10; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e26); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f7(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e23); } + } + + return s0; + } + + function peg$parserestOfLineComment() { + var s0, s1, s2, s3, s4; + + peg$silentFails++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 59) { + s1 = peg$c11; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e28); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = []; + s4 = input.charAt(peg$currPos); + if (peg$r8.test(s4)) { + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e29); } + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = input.charAt(peg$currPos); + if (peg$r8.test(s4)) { + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e29); } + } + } + s2 = input.substring(s2, peg$currPos); + peg$savedPos = s0; + s0 = peg$f8(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e27); } + } + + return s0; + } + + function peg$parsevariation() { + var s0, s1, s2, s3, s4, s5; + + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 40) { + s2 = peg$c12; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e31); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseline(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c13; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e32); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f9(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e30); } + } + + return s0; + } + + function peg$parsegameTerminationMarker() { + var s0, s1, s2, s3; + + peg$silentFails++; + s0 = peg$currPos; + if (input.substr(peg$currPos, 3) === peg$c14) { + s1 = peg$c14; + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e34); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c15) { + s1 = peg$c15; + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e35); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7) === peg$c16) { + s1 = peg$c16; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e36); } + } + if (s1 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c17; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e37); } + } + } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + s3 = peg$parsecomment(); + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f10(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e33); } + } + + return s0; + } + + function peg$parse_() { + var s0, s1; + + peg$silentFails++; + s0 = []; + s1 = input.charAt(peg$currPos); + if (peg$r9.test(s1)) { + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e39); } + } + while (s1 !== peg$FAILED) { + s0.push(s1); + s1 = input.charAt(peg$currPos); + if (peg$r9.test(s1)) { + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e39); } + } + } + peg$silentFails--; + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e38); } + + return s0; + } + + peg$result = peg$startRuleFunction(); + + if (options.peg$library) { + return /** @type {any} */ ({ + peg$result, + peg$currPos, + peg$FAILED, + peg$maxFailExpected, + peg$maxFailPos + }); + } + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + + throw peg$buildStructuredError( + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); + } +} + +const peg$allowedStartRules = [ + "pgn" +]; + +export { + peg$allowedStartRules as StartRules, + peg$SyntaxError as SyntaxError, + peg$parse as parse +}; diff --git a/node_modules/chess.js/src/pgn.peggy b/node_modules/chess.js/src/pgn.peggy new file mode 100644 index 0000000..b3e883f --- /dev/null +++ b/node_modules/chess.js/src/pgn.peggy @@ -0,0 +1,113 @@ +{{ + function rootNode(comment) { + return comment !== null ? { comment, variations: [] } : { variations: []} + } + + function node(move, suffix, nag, comment, variations) { + const node = { move, variations } + + if (suffix) { + node.suffix = suffix + } + + if (nag) { + node.nag = nag + } + + if (comment !== null) { + node.comment = comment + } + + return node + } + + function lineToTree(...nodes) { + const [root, ...rest] = nodes; + + let parent = root + + for (const child of rest) { + if (child !== null) { + parent.variations = [child, ...child.variations] + child.variations = [] + parent = child + } + } + + return root + } + + function pgn(headers, game) { + if (game.marker && game.marker.comment) { + let node = game.root + while (true) { + const next = node.variations[0] + if (!next) { + node.comment = game.marker.comment + break + } + node = next + } + } + + return { + headers, + root: game.root, + result: (game.marker && game.marker.result) ?? undefined + } + } +}} + +pgn + = headers:tagPairSection game:moveTextSection { return pgn(headers, game) } + +tagPairSection + = tagPairs:tagPair* _ { return Object.fromEntries(tagPairs) } + +tagPair "tag pair" + = _ '[' _ tagName:tagName _ '"' tagValue:tagValue '"' _ ']' { return [tagName, tagValue] } + +tagName "tag name" + = $[a-zA-Z]+ + +tagValue "tag value" + = $[^"]* + +moveTextSection + = root:line _ marker:gameTerminationMarker? _ { return { root, marker} } + +line + = comment:comment? moves:move* { return lineToTree(rootNode(comment), ...moves.flat()) } + +move + = _ moveNumber? _ san:san suffix:suffixAnnotation? nag:nag* _ comment:comment? variations:variation* { return node(san, suffix, nag, comment, variations) } + +moveNumber "move number" + = [0-9]*'.' _ [.]* + +san "standard algebraic notation" + = $(("O-O-O" / "O-O" / "0-0-0" / "0-0" / [a-zA-Z][a-zA-Z1-8-=]+) [+#]?) + +suffixAnnotation "suffix annotation" + = [!?] |1..2| + +nag "NAG" + = _ '$' nag:$[0-9]+ { return nag } + +comment + = braceComment / restOfLineComment + +braceComment "brace comment" + = '{' comment:$[^}]* '}' { return comment.replace(/[\r\n]+/g, " ") } + +restOfLineComment "rest of line comment" + = ';' comment:$[^\r\n]* { return comment.trim() } + +variation "variation" + = _ '(' line:line _ ')' { return line } + +gameTerminationMarker "game termination marker" + = result:('1-0' / '0-1' / '1/2-1/2' / '*') _ comment:comment? { return { result, comment } } + +_ "whitespace" + = [\x20\t\r\n]* diff --git a/node_modules/chess.js/tsconfig.cjs.json b/node_modules/chess.js/tsconfig.cjs.json new file mode 100644 index 0000000..fac3bf7 --- /dev/null +++ b/node_modules/chess.js/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/cjs", + "module": "esnext" + } +} diff --git a/node_modules/chess.js/tsconfig.esm.json b/node_modules/chess.js/tsconfig.esm.json new file mode 100644 index 0000000..b2157ef --- /dev/null +++ b/node_modules/chess.js/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/esm", + "module": "esnext" + } +} diff --git a/node_modules/chess.js/tsconfig.json b/node_modules/chess.js/tsconfig.json new file mode 100644 index 0000000..3b973f3 --- /dev/null +++ b/node_modules/chess.js/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "esModuleInterop": true, + "moduleResolution": "node", + "removeComments": false, + "sourceMap": true, + "strict": true, + "target": "ESNext" + }, + "include": ["src/**/*"] +} diff --git a/node_modules/chess.js/tsconfig.types.json b/node_modules/chess.js/tsconfig.types.json new file mode 100644 index 0000000..5f3e8a7 --- /dev/null +++ b/node_modules/chess.js/tsconfig.types.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/types", + "declaration": true, + "emitDeclarationOnly": true + } +} diff --git a/node_modules/chess.js/vite.config.ts b/node_modules/chess.js/vite.config.ts new file mode 100644 index 0000000..8b542cb --- /dev/null +++ b/node_modules/chess.js/vite.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from 'vite' + +export default defineConfig({ + test: { + coverage: { + provider: 'v8', + include: ['src/**/*.{js,ts}'], + exclude: ['src/pgn.js'], + }, + }, +}) diff --git a/backend/node_modules/content-disposition/HISTORY.md b/node_modules/content-disposition/HISTORY.md similarity index 100% rename from backend/node_modules/content-disposition/HISTORY.md rename to node_modules/content-disposition/HISTORY.md diff --git a/backend/node_modules/content-disposition/LICENSE b/node_modules/content-disposition/LICENSE similarity index 100% rename from backend/node_modules/content-disposition/LICENSE rename to node_modules/content-disposition/LICENSE diff --git a/backend/node_modules/content-disposition/README.md b/node_modules/content-disposition/README.md similarity index 100% rename from backend/node_modules/content-disposition/README.md rename to node_modules/content-disposition/README.md diff --git a/backend/node_modules/content-disposition/index.js b/node_modules/content-disposition/index.js similarity index 100% rename from backend/node_modules/content-disposition/index.js rename to node_modules/content-disposition/index.js diff --git a/backend/node_modules/content-disposition/package.json b/node_modules/content-disposition/package.json similarity index 100% rename from backend/node_modules/content-disposition/package.json rename to node_modules/content-disposition/package.json diff --git a/backend/node_modules/content-type/HISTORY.md b/node_modules/content-type/HISTORY.md similarity index 100% rename from backend/node_modules/content-type/HISTORY.md rename to node_modules/content-type/HISTORY.md diff --git a/backend/node_modules/content-type/LICENSE b/node_modules/content-type/LICENSE similarity index 100% rename from backend/node_modules/content-type/LICENSE rename to node_modules/content-type/LICENSE diff --git a/backend/node_modules/content-type/README.md b/node_modules/content-type/README.md similarity index 100% rename from backend/node_modules/content-type/README.md rename to node_modules/content-type/README.md diff --git a/backend/node_modules/content-type/index.js b/node_modules/content-type/index.js similarity index 100% rename from backend/node_modules/content-type/index.js rename to node_modules/content-type/index.js diff --git a/backend/node_modules/content-type/package.json b/node_modules/content-type/package.json similarity index 100% rename from backend/node_modules/content-type/package.json rename to node_modules/content-type/package.json diff --git a/backend/node_modules/cookie-signature/.npmignore b/node_modules/cookie-signature/.npmignore similarity index 100% rename from backend/node_modules/cookie-signature/.npmignore rename to node_modules/cookie-signature/.npmignore diff --git a/backend/node_modules/cookie-signature/History.md b/node_modules/cookie-signature/History.md similarity index 100% rename from backend/node_modules/cookie-signature/History.md rename to node_modules/cookie-signature/History.md diff --git a/backend/node_modules/cookie-signature/Readme.md b/node_modules/cookie-signature/Readme.md similarity index 100% rename from backend/node_modules/cookie-signature/Readme.md rename to node_modules/cookie-signature/Readme.md diff --git a/backend/node_modules/cookie-signature/index.js b/node_modules/cookie-signature/index.js similarity index 100% rename from backend/node_modules/cookie-signature/index.js rename to node_modules/cookie-signature/index.js diff --git a/backend/node_modules/cookie-signature/package.json b/node_modules/cookie-signature/package.json similarity index 100% rename from backend/node_modules/cookie-signature/package.json rename to node_modules/cookie-signature/package.json diff --git a/backend/node_modules/cookie/LICENSE b/node_modules/cookie/LICENSE similarity index 100% rename from backend/node_modules/cookie/LICENSE rename to node_modules/cookie/LICENSE diff --git a/backend/node_modules/cookie/README.md b/node_modules/cookie/README.md similarity index 100% rename from backend/node_modules/cookie/README.md rename to node_modules/cookie/README.md diff --git a/backend/node_modules/cookie/SECURITY.md b/node_modules/cookie/SECURITY.md similarity index 100% rename from backend/node_modules/cookie/SECURITY.md rename to node_modules/cookie/SECURITY.md diff --git a/backend/node_modules/cookie/index.js b/node_modules/cookie/index.js similarity index 100% rename from backend/node_modules/cookie/index.js rename to node_modules/cookie/index.js diff --git a/backend/node_modules/cookie/package.json b/node_modules/cookie/package.json similarity index 100% rename from backend/node_modules/cookie/package.json rename to node_modules/cookie/package.json diff --git a/backend/node_modules/cors/CONTRIBUTING.md b/node_modules/cors/CONTRIBUTING.md similarity index 100% rename from backend/node_modules/cors/CONTRIBUTING.md rename to node_modules/cors/CONTRIBUTING.md diff --git a/backend/node_modules/cors/HISTORY.md b/node_modules/cors/HISTORY.md similarity index 100% rename from backend/node_modules/cors/HISTORY.md rename to node_modules/cors/HISTORY.md diff --git a/backend/node_modules/cors/LICENSE b/node_modules/cors/LICENSE similarity index 100% rename from backend/node_modules/cors/LICENSE rename to node_modules/cors/LICENSE diff --git a/backend/node_modules/cors/README.md b/node_modules/cors/README.md similarity index 100% rename from backend/node_modules/cors/README.md rename to node_modules/cors/README.md diff --git a/backend/node_modules/cors/lib/index.js b/node_modules/cors/lib/index.js similarity index 100% rename from backend/node_modules/cors/lib/index.js rename to node_modules/cors/lib/index.js diff --git a/backend/node_modules/cors/package.json b/node_modules/cors/package.json similarity index 100% rename from backend/node_modules/cors/package.json rename to node_modules/cors/package.json diff --git a/backend/node_modules/debug/.coveralls.yml b/node_modules/debug/.coveralls.yml similarity index 100% rename from backend/node_modules/debug/.coveralls.yml rename to node_modules/debug/.coveralls.yml diff --git a/backend/node_modules/debug/.eslintrc b/node_modules/debug/.eslintrc similarity index 100% rename from backend/node_modules/debug/.eslintrc rename to node_modules/debug/.eslintrc diff --git a/backend/node_modules/debug/.npmignore b/node_modules/debug/.npmignore similarity index 100% rename from backend/node_modules/debug/.npmignore rename to node_modules/debug/.npmignore diff --git a/backend/node_modules/debug/.travis.yml b/node_modules/debug/.travis.yml similarity index 100% rename from backend/node_modules/debug/.travis.yml rename to node_modules/debug/.travis.yml diff --git a/backend/node_modules/debug/CHANGELOG.md b/node_modules/debug/CHANGELOG.md similarity index 100% rename from backend/node_modules/debug/CHANGELOG.md rename to node_modules/debug/CHANGELOG.md diff --git a/backend/node_modules/debug/LICENSE b/node_modules/debug/LICENSE similarity index 100% rename from backend/node_modules/debug/LICENSE rename to node_modules/debug/LICENSE diff --git a/backend/node_modules/debug/Makefile b/node_modules/debug/Makefile similarity index 100% rename from backend/node_modules/debug/Makefile rename to node_modules/debug/Makefile diff --git a/backend/node_modules/debug/README.md b/node_modules/debug/README.md similarity index 100% rename from backend/node_modules/debug/README.md rename to node_modules/debug/README.md diff --git a/backend/node_modules/debug/component.json b/node_modules/debug/component.json similarity index 100% rename from backend/node_modules/debug/component.json rename to node_modules/debug/component.json diff --git a/backend/node_modules/debug/karma.conf.js b/node_modules/debug/karma.conf.js similarity index 100% rename from backend/node_modules/debug/karma.conf.js rename to node_modules/debug/karma.conf.js diff --git a/backend/node_modules/debug/node.js b/node_modules/debug/node.js similarity index 100% rename from backend/node_modules/debug/node.js rename to node_modules/debug/node.js diff --git a/backend/node_modules/debug/package.json b/node_modules/debug/package.json similarity index 100% rename from backend/node_modules/debug/package.json rename to node_modules/debug/package.json diff --git a/backend/node_modules/debug/src/browser.js b/node_modules/debug/src/browser.js similarity index 100% rename from backend/node_modules/debug/src/browser.js rename to node_modules/debug/src/browser.js diff --git a/backend/node_modules/debug/src/debug.js b/node_modules/debug/src/debug.js similarity index 100% rename from backend/node_modules/debug/src/debug.js rename to node_modules/debug/src/debug.js diff --git a/backend/node_modules/debug/src/index.js b/node_modules/debug/src/index.js similarity index 100% rename from backend/node_modules/debug/src/index.js rename to node_modules/debug/src/index.js diff --git a/backend/node_modules/debug/src/inspector-log.js b/node_modules/debug/src/inspector-log.js similarity index 100% rename from backend/node_modules/debug/src/inspector-log.js rename to node_modules/debug/src/inspector-log.js diff --git a/backend/node_modules/debug/src/node.js b/node_modules/debug/src/node.js similarity index 100% rename from backend/node_modules/debug/src/node.js rename to node_modules/debug/src/node.js diff --git a/backend/node_modules/depd/History.md b/node_modules/depd/History.md similarity index 100% rename from backend/node_modules/depd/History.md rename to node_modules/depd/History.md diff --git a/backend/node_modules/depd/LICENSE b/node_modules/depd/LICENSE similarity index 100% rename from backend/node_modules/depd/LICENSE rename to node_modules/depd/LICENSE diff --git a/backend/node_modules/depd/Readme.md b/node_modules/depd/Readme.md similarity index 100% rename from backend/node_modules/depd/Readme.md rename to node_modules/depd/Readme.md diff --git a/backend/node_modules/depd/index.js b/node_modules/depd/index.js similarity index 100% rename from backend/node_modules/depd/index.js rename to node_modules/depd/index.js diff --git a/backend/node_modules/depd/lib/browser/index.js b/node_modules/depd/lib/browser/index.js similarity index 100% rename from backend/node_modules/depd/lib/browser/index.js rename to node_modules/depd/lib/browser/index.js diff --git a/backend/node_modules/depd/package.json b/node_modules/depd/package.json similarity index 100% rename from backend/node_modules/depd/package.json rename to node_modules/depd/package.json diff --git a/backend/node_modules/destroy/LICENSE b/node_modules/destroy/LICENSE similarity index 100% rename from backend/node_modules/destroy/LICENSE rename to node_modules/destroy/LICENSE diff --git a/backend/node_modules/destroy/README.md b/node_modules/destroy/README.md similarity index 100% rename from backend/node_modules/destroy/README.md rename to node_modules/destroy/README.md diff --git a/backend/node_modules/destroy/index.js b/node_modules/destroy/index.js similarity index 100% rename from backend/node_modules/destroy/index.js rename to node_modules/destroy/index.js diff --git a/backend/node_modules/destroy/package.json b/node_modules/destroy/package.json similarity index 100% rename from backend/node_modules/destroy/package.json rename to node_modules/destroy/package.json diff --git a/backend/node_modules/dunder-proto/.eslintrc b/node_modules/dunder-proto/.eslintrc similarity index 100% rename from backend/node_modules/dunder-proto/.eslintrc rename to node_modules/dunder-proto/.eslintrc diff --git a/backend/node_modules/dunder-proto/.github/FUNDING.yml b/node_modules/dunder-proto/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/dunder-proto/.github/FUNDING.yml rename to node_modules/dunder-proto/.github/FUNDING.yml diff --git a/backend/node_modules/dunder-proto/.nycrc b/node_modules/dunder-proto/.nycrc similarity index 100% rename from backend/node_modules/dunder-proto/.nycrc rename to node_modules/dunder-proto/.nycrc diff --git a/backend/node_modules/dunder-proto/CHANGELOG.md b/node_modules/dunder-proto/CHANGELOG.md similarity index 100% rename from backend/node_modules/dunder-proto/CHANGELOG.md rename to node_modules/dunder-proto/CHANGELOG.md diff --git a/backend/node_modules/dunder-proto/LICENSE b/node_modules/dunder-proto/LICENSE similarity index 100% rename from backend/node_modules/dunder-proto/LICENSE rename to node_modules/dunder-proto/LICENSE diff --git a/backend/node_modules/dunder-proto/README.md b/node_modules/dunder-proto/README.md similarity index 100% rename from backend/node_modules/dunder-proto/README.md rename to node_modules/dunder-proto/README.md diff --git a/backend/node_modules/dunder-proto/get.d.ts b/node_modules/dunder-proto/get.d.ts similarity index 100% rename from backend/node_modules/dunder-proto/get.d.ts rename to node_modules/dunder-proto/get.d.ts diff --git a/backend/node_modules/dunder-proto/get.js b/node_modules/dunder-proto/get.js similarity index 100% rename from backend/node_modules/dunder-proto/get.js rename to node_modules/dunder-proto/get.js diff --git a/backend/node_modules/dunder-proto/package.json b/node_modules/dunder-proto/package.json similarity index 100% rename from backend/node_modules/dunder-proto/package.json rename to node_modules/dunder-proto/package.json diff --git a/backend/node_modules/dunder-proto/set.d.ts b/node_modules/dunder-proto/set.d.ts similarity index 100% rename from backend/node_modules/dunder-proto/set.d.ts rename to node_modules/dunder-proto/set.d.ts diff --git a/backend/node_modules/dunder-proto/set.js b/node_modules/dunder-proto/set.js similarity index 100% rename from backend/node_modules/dunder-proto/set.js rename to node_modules/dunder-proto/set.js diff --git a/backend/node_modules/dunder-proto/test/get.js b/node_modules/dunder-proto/test/get.js similarity index 100% rename from backend/node_modules/dunder-proto/test/get.js rename to node_modules/dunder-proto/test/get.js diff --git a/backend/node_modules/dunder-proto/test/index.js b/node_modules/dunder-proto/test/index.js similarity index 100% rename from backend/node_modules/dunder-proto/test/index.js rename to node_modules/dunder-proto/test/index.js diff --git a/backend/node_modules/dunder-proto/test/set.js b/node_modules/dunder-proto/test/set.js similarity index 100% rename from backend/node_modules/dunder-proto/test/set.js rename to node_modules/dunder-proto/test/set.js diff --git a/backend/node_modules/dunder-proto/tsconfig.json b/node_modules/dunder-proto/tsconfig.json similarity index 100% rename from backend/node_modules/dunder-proto/tsconfig.json rename to node_modules/dunder-proto/tsconfig.json diff --git a/backend/node_modules/ee-first/LICENSE b/node_modules/ee-first/LICENSE similarity index 100% rename from backend/node_modules/ee-first/LICENSE rename to node_modules/ee-first/LICENSE diff --git a/backend/node_modules/ee-first/README.md b/node_modules/ee-first/README.md similarity index 100% rename from backend/node_modules/ee-first/README.md rename to node_modules/ee-first/README.md diff --git a/backend/node_modules/ee-first/index.js b/node_modules/ee-first/index.js similarity index 100% rename from backend/node_modules/ee-first/index.js rename to node_modules/ee-first/index.js diff --git a/backend/node_modules/ee-first/package.json b/node_modules/ee-first/package.json similarity index 100% rename from backend/node_modules/ee-first/package.json rename to node_modules/ee-first/package.json diff --git a/backend/node_modules/encodeurl/LICENSE b/node_modules/encodeurl/LICENSE similarity index 100% rename from backend/node_modules/encodeurl/LICENSE rename to node_modules/encodeurl/LICENSE diff --git a/backend/node_modules/encodeurl/README.md b/node_modules/encodeurl/README.md similarity index 100% rename from backend/node_modules/encodeurl/README.md rename to node_modules/encodeurl/README.md diff --git a/backend/node_modules/encodeurl/index.js b/node_modules/encodeurl/index.js similarity index 100% rename from backend/node_modules/encodeurl/index.js rename to node_modules/encodeurl/index.js diff --git a/backend/node_modules/encodeurl/package.json b/node_modules/encodeurl/package.json similarity index 100% rename from backend/node_modules/encodeurl/package.json rename to node_modules/encodeurl/package.json diff --git a/backend/node_modules/engine.io-parser/LICENSE b/node_modules/engine.io-parser/LICENSE similarity index 100% rename from backend/node_modules/engine.io-parser/LICENSE rename to node_modules/engine.io-parser/LICENSE diff --git a/backend/node_modules/engine.io-parser/Readme.md b/node_modules/engine.io-parser/Readme.md similarity index 100% rename from backend/node_modules/engine.io-parser/Readme.md rename to node_modules/engine.io-parser/Readme.md diff --git a/backend/node_modules/engine.io-parser/build/cjs/commons.d.ts b/node_modules/engine.io-parser/build/cjs/commons.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/commons.d.ts rename to node_modules/engine.io-parser/build/cjs/commons.d.ts diff --git a/backend/node_modules/engine.io-parser/build/cjs/commons.js b/node_modules/engine.io-parser/build/cjs/commons.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/commons.js rename to node_modules/engine.io-parser/build/cjs/commons.js diff --git a/backend/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.d.ts b/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.d.ts rename to node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.d.ts diff --git a/backend/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.js b/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.js rename to node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.js diff --git a/backend/node_modules/engine.io-parser/build/cjs/decodePacket.browser.d.ts b/node_modules/engine.io-parser/build/cjs/decodePacket.browser.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/decodePacket.browser.d.ts rename to node_modules/engine.io-parser/build/cjs/decodePacket.browser.d.ts diff --git a/backend/node_modules/engine.io-parser/build/cjs/decodePacket.browser.js b/node_modules/engine.io-parser/build/cjs/decodePacket.browser.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/decodePacket.browser.js rename to node_modules/engine.io-parser/build/cjs/decodePacket.browser.js diff --git a/backend/node_modules/engine.io-parser/build/cjs/decodePacket.d.ts b/node_modules/engine.io-parser/build/cjs/decodePacket.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/decodePacket.d.ts rename to node_modules/engine.io-parser/build/cjs/decodePacket.d.ts diff --git a/backend/node_modules/engine.io-parser/build/cjs/decodePacket.js b/node_modules/engine.io-parser/build/cjs/decodePacket.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/decodePacket.js rename to node_modules/engine.io-parser/build/cjs/decodePacket.js diff --git a/backend/node_modules/engine.io-parser/build/cjs/encodePacket.browser.d.ts b/node_modules/engine.io-parser/build/cjs/encodePacket.browser.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/encodePacket.browser.d.ts rename to node_modules/engine.io-parser/build/cjs/encodePacket.browser.d.ts diff --git a/backend/node_modules/engine.io-parser/build/cjs/encodePacket.browser.js b/node_modules/engine.io-parser/build/cjs/encodePacket.browser.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/encodePacket.browser.js rename to node_modules/engine.io-parser/build/cjs/encodePacket.browser.js diff --git a/backend/node_modules/engine.io-parser/build/cjs/encodePacket.d.ts b/node_modules/engine.io-parser/build/cjs/encodePacket.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/encodePacket.d.ts rename to node_modules/engine.io-parser/build/cjs/encodePacket.d.ts diff --git a/backend/node_modules/engine.io-parser/build/cjs/encodePacket.js b/node_modules/engine.io-parser/build/cjs/encodePacket.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/encodePacket.js rename to node_modules/engine.io-parser/build/cjs/encodePacket.js diff --git a/backend/node_modules/engine.io-parser/build/cjs/index.d.ts b/node_modules/engine.io-parser/build/cjs/index.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/index.d.ts rename to node_modules/engine.io-parser/build/cjs/index.d.ts diff --git a/backend/node_modules/engine.io-parser/build/cjs/index.js b/node_modules/engine.io-parser/build/cjs/index.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/index.js rename to node_modules/engine.io-parser/build/cjs/index.js diff --git a/backend/node_modules/engine.io-parser/build/cjs/package.json b/node_modules/engine.io-parser/build/cjs/package.json similarity index 100% rename from backend/node_modules/engine.io-parser/build/cjs/package.json rename to node_modules/engine.io-parser/build/cjs/package.json diff --git a/backend/node_modules/engine.io-parser/build/esm/commons.d.ts b/node_modules/engine.io-parser/build/esm/commons.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/commons.d.ts rename to node_modules/engine.io-parser/build/esm/commons.d.ts diff --git a/backend/node_modules/engine.io-parser/build/esm/commons.js b/node_modules/engine.io-parser/build/esm/commons.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/commons.js rename to node_modules/engine.io-parser/build/esm/commons.js diff --git a/backend/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.d.ts b/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.d.ts rename to node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.d.ts diff --git a/backend/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js b/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js rename to node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js diff --git a/backend/node_modules/engine.io-parser/build/esm/decodePacket.browser.d.ts b/node_modules/engine.io-parser/build/esm/decodePacket.browser.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/decodePacket.browser.d.ts rename to node_modules/engine.io-parser/build/esm/decodePacket.browser.d.ts diff --git a/backend/node_modules/engine.io-parser/build/esm/decodePacket.browser.js b/node_modules/engine.io-parser/build/esm/decodePacket.browser.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/decodePacket.browser.js rename to node_modules/engine.io-parser/build/esm/decodePacket.browser.js diff --git a/backend/node_modules/engine.io-parser/build/esm/decodePacket.d.ts b/node_modules/engine.io-parser/build/esm/decodePacket.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/decodePacket.d.ts rename to node_modules/engine.io-parser/build/esm/decodePacket.d.ts diff --git a/backend/node_modules/engine.io-parser/build/esm/decodePacket.js b/node_modules/engine.io-parser/build/esm/decodePacket.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/decodePacket.js rename to node_modules/engine.io-parser/build/esm/decodePacket.js diff --git a/backend/node_modules/engine.io-parser/build/esm/encodePacket.browser.d.ts b/node_modules/engine.io-parser/build/esm/encodePacket.browser.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/encodePacket.browser.d.ts rename to node_modules/engine.io-parser/build/esm/encodePacket.browser.d.ts diff --git a/backend/node_modules/engine.io-parser/build/esm/encodePacket.browser.js b/node_modules/engine.io-parser/build/esm/encodePacket.browser.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/encodePacket.browser.js rename to node_modules/engine.io-parser/build/esm/encodePacket.browser.js diff --git a/backend/node_modules/engine.io-parser/build/esm/encodePacket.d.ts b/node_modules/engine.io-parser/build/esm/encodePacket.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/encodePacket.d.ts rename to node_modules/engine.io-parser/build/esm/encodePacket.d.ts diff --git a/backend/node_modules/engine.io-parser/build/esm/encodePacket.js b/node_modules/engine.io-parser/build/esm/encodePacket.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/encodePacket.js rename to node_modules/engine.io-parser/build/esm/encodePacket.js diff --git a/backend/node_modules/engine.io-parser/build/esm/index.d.ts b/node_modules/engine.io-parser/build/esm/index.d.ts similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/index.d.ts rename to node_modules/engine.io-parser/build/esm/index.d.ts diff --git a/backend/node_modules/engine.io-parser/build/esm/index.js b/node_modules/engine.io-parser/build/esm/index.js similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/index.js rename to node_modules/engine.io-parser/build/esm/index.js diff --git a/backend/node_modules/engine.io-parser/build/esm/package.json b/node_modules/engine.io-parser/build/esm/package.json similarity index 100% rename from backend/node_modules/engine.io-parser/build/esm/package.json rename to node_modules/engine.io-parser/build/esm/package.json diff --git a/backend/node_modules/engine.io-parser/package.json b/node_modules/engine.io-parser/package.json similarity index 100% rename from backend/node_modules/engine.io-parser/package.json rename to node_modules/engine.io-parser/package.json diff --git a/backend/node_modules/engine.io/LICENSE b/node_modules/engine.io/LICENSE similarity index 100% rename from backend/node_modules/engine.io/LICENSE rename to node_modules/engine.io/LICENSE diff --git a/backend/node_modules/engine.io/README.md b/node_modules/engine.io/README.md similarity index 100% rename from backend/node_modules/engine.io/README.md rename to node_modules/engine.io/README.md diff --git a/backend/node_modules/engine.io/build/contrib/types.cookie.d.ts b/node_modules/engine.io/build/contrib/types.cookie.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/contrib/types.cookie.d.ts rename to node_modules/engine.io/build/contrib/types.cookie.d.ts diff --git a/backend/node_modules/engine.io/build/contrib/types.cookie.js b/node_modules/engine.io/build/contrib/types.cookie.js similarity index 100% rename from backend/node_modules/engine.io/build/contrib/types.cookie.js rename to node_modules/engine.io/build/contrib/types.cookie.js diff --git a/backend/node_modules/engine.io/build/engine.io.d.ts b/node_modules/engine.io/build/engine.io.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/engine.io.d.ts rename to node_modules/engine.io/build/engine.io.d.ts diff --git a/backend/node_modules/engine.io/build/engine.io.js b/node_modules/engine.io/build/engine.io.js similarity index 100% rename from backend/node_modules/engine.io/build/engine.io.js rename to node_modules/engine.io/build/engine.io.js diff --git a/backend/node_modules/engine.io/build/parser-v3/index.d.ts b/node_modules/engine.io/build/parser-v3/index.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/parser-v3/index.d.ts rename to node_modules/engine.io/build/parser-v3/index.d.ts diff --git a/backend/node_modules/engine.io/build/parser-v3/index.js b/node_modules/engine.io/build/parser-v3/index.js similarity index 100% rename from backend/node_modules/engine.io/build/parser-v3/index.js rename to node_modules/engine.io/build/parser-v3/index.js diff --git a/backend/node_modules/engine.io/build/parser-v3/utf8.d.ts b/node_modules/engine.io/build/parser-v3/utf8.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/parser-v3/utf8.d.ts rename to node_modules/engine.io/build/parser-v3/utf8.d.ts diff --git a/backend/node_modules/engine.io/build/parser-v3/utf8.js b/node_modules/engine.io/build/parser-v3/utf8.js similarity index 100% rename from backend/node_modules/engine.io/build/parser-v3/utf8.js rename to node_modules/engine.io/build/parser-v3/utf8.js diff --git a/backend/node_modules/engine.io/build/server.d.ts b/node_modules/engine.io/build/server.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/server.d.ts rename to node_modules/engine.io/build/server.d.ts diff --git a/backend/node_modules/engine.io/build/server.js b/node_modules/engine.io/build/server.js similarity index 100% rename from backend/node_modules/engine.io/build/server.js rename to node_modules/engine.io/build/server.js diff --git a/backend/node_modules/engine.io/build/socket.d.ts b/node_modules/engine.io/build/socket.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/socket.d.ts rename to node_modules/engine.io/build/socket.d.ts diff --git a/backend/node_modules/engine.io/build/socket.js b/node_modules/engine.io/build/socket.js similarity index 100% rename from backend/node_modules/engine.io/build/socket.js rename to node_modules/engine.io/build/socket.js diff --git a/backend/node_modules/engine.io/build/transport.d.ts b/node_modules/engine.io/build/transport.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/transport.d.ts rename to node_modules/engine.io/build/transport.d.ts diff --git a/backend/node_modules/engine.io/build/transport.js b/node_modules/engine.io/build/transport.js similarity index 100% rename from backend/node_modules/engine.io/build/transport.js rename to node_modules/engine.io/build/transport.js diff --git a/backend/node_modules/engine.io/build/transports-uws/index.d.ts b/node_modules/engine.io/build/transports-uws/index.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/transports-uws/index.d.ts rename to node_modules/engine.io/build/transports-uws/index.d.ts diff --git a/backend/node_modules/engine.io/build/transports-uws/index.js b/node_modules/engine.io/build/transports-uws/index.js similarity index 100% rename from backend/node_modules/engine.io/build/transports-uws/index.js rename to node_modules/engine.io/build/transports-uws/index.js diff --git a/backend/node_modules/engine.io/build/transports-uws/polling.d.ts b/node_modules/engine.io/build/transports-uws/polling.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/transports-uws/polling.d.ts rename to node_modules/engine.io/build/transports-uws/polling.d.ts diff --git a/backend/node_modules/engine.io/build/transports-uws/polling.js b/node_modules/engine.io/build/transports-uws/polling.js similarity index 100% rename from backend/node_modules/engine.io/build/transports-uws/polling.js rename to node_modules/engine.io/build/transports-uws/polling.js diff --git a/backend/node_modules/engine.io/build/transports-uws/websocket.d.ts b/node_modules/engine.io/build/transports-uws/websocket.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/transports-uws/websocket.d.ts rename to node_modules/engine.io/build/transports-uws/websocket.d.ts diff --git a/backend/node_modules/engine.io/build/transports-uws/websocket.js b/node_modules/engine.io/build/transports-uws/websocket.js similarity index 100% rename from backend/node_modules/engine.io/build/transports-uws/websocket.js rename to node_modules/engine.io/build/transports-uws/websocket.js diff --git a/backend/node_modules/engine.io/build/transports/index.d.ts b/node_modules/engine.io/build/transports/index.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/transports/index.d.ts rename to node_modules/engine.io/build/transports/index.d.ts diff --git a/backend/node_modules/engine.io/build/transports/index.js b/node_modules/engine.io/build/transports/index.js similarity index 100% rename from backend/node_modules/engine.io/build/transports/index.js rename to node_modules/engine.io/build/transports/index.js diff --git a/backend/node_modules/engine.io/build/transports/polling-jsonp.d.ts b/node_modules/engine.io/build/transports/polling-jsonp.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/transports/polling-jsonp.d.ts rename to node_modules/engine.io/build/transports/polling-jsonp.d.ts diff --git a/backend/node_modules/engine.io/build/transports/polling-jsonp.js b/node_modules/engine.io/build/transports/polling-jsonp.js similarity index 100% rename from backend/node_modules/engine.io/build/transports/polling-jsonp.js rename to node_modules/engine.io/build/transports/polling-jsonp.js diff --git a/backend/node_modules/engine.io/build/transports/polling.d.ts b/node_modules/engine.io/build/transports/polling.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/transports/polling.d.ts rename to node_modules/engine.io/build/transports/polling.d.ts diff --git a/backend/node_modules/engine.io/build/transports/polling.js b/node_modules/engine.io/build/transports/polling.js similarity index 100% rename from backend/node_modules/engine.io/build/transports/polling.js rename to node_modules/engine.io/build/transports/polling.js diff --git a/backend/node_modules/engine.io/build/transports/websocket.d.ts b/node_modules/engine.io/build/transports/websocket.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/transports/websocket.d.ts rename to node_modules/engine.io/build/transports/websocket.d.ts diff --git a/backend/node_modules/engine.io/build/transports/websocket.js b/node_modules/engine.io/build/transports/websocket.js similarity index 100% rename from backend/node_modules/engine.io/build/transports/websocket.js rename to node_modules/engine.io/build/transports/websocket.js diff --git a/backend/node_modules/engine.io/build/transports/webtransport.d.ts b/node_modules/engine.io/build/transports/webtransport.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/transports/webtransport.d.ts rename to node_modules/engine.io/build/transports/webtransport.d.ts diff --git a/backend/node_modules/engine.io/build/transports/webtransport.js b/node_modules/engine.io/build/transports/webtransport.js similarity index 100% rename from backend/node_modules/engine.io/build/transports/webtransport.js rename to node_modules/engine.io/build/transports/webtransport.js diff --git a/backend/node_modules/engine.io/build/userver.d.ts b/node_modules/engine.io/build/userver.d.ts similarity index 100% rename from backend/node_modules/engine.io/build/userver.d.ts rename to node_modules/engine.io/build/userver.d.ts diff --git a/backend/node_modules/engine.io/build/userver.js b/node_modules/engine.io/build/userver.js similarity index 100% rename from backend/node_modules/engine.io/build/userver.js rename to node_modules/engine.io/build/userver.js diff --git a/backend/node_modules/engine.io/node_modules/cookie/LICENSE b/node_modules/engine.io/node_modules/cookie/LICENSE similarity index 100% rename from backend/node_modules/engine.io/node_modules/cookie/LICENSE rename to node_modules/engine.io/node_modules/cookie/LICENSE diff --git a/backend/node_modules/engine.io/node_modules/cookie/README.md b/node_modules/engine.io/node_modules/cookie/README.md similarity index 100% rename from backend/node_modules/engine.io/node_modules/cookie/README.md rename to node_modules/engine.io/node_modules/cookie/README.md diff --git a/backend/node_modules/engine.io/node_modules/cookie/SECURITY.md b/node_modules/engine.io/node_modules/cookie/SECURITY.md similarity index 100% rename from backend/node_modules/engine.io/node_modules/cookie/SECURITY.md rename to node_modules/engine.io/node_modules/cookie/SECURITY.md diff --git a/backend/node_modules/engine.io/node_modules/cookie/index.js b/node_modules/engine.io/node_modules/cookie/index.js similarity index 100% rename from backend/node_modules/engine.io/node_modules/cookie/index.js rename to node_modules/engine.io/node_modules/cookie/index.js diff --git a/backend/node_modules/engine.io/node_modules/cookie/package.json b/node_modules/engine.io/node_modules/cookie/package.json similarity index 100% rename from backend/node_modules/engine.io/node_modules/cookie/package.json rename to node_modules/engine.io/node_modules/cookie/package.json diff --git a/backend/node_modules/engine.io/node_modules/debug/LICENSE b/node_modules/engine.io/node_modules/debug/LICENSE similarity index 100% rename from backend/node_modules/engine.io/node_modules/debug/LICENSE rename to node_modules/engine.io/node_modules/debug/LICENSE diff --git a/backend/node_modules/engine.io/node_modules/debug/README.md b/node_modules/engine.io/node_modules/debug/README.md similarity index 100% rename from backend/node_modules/engine.io/node_modules/debug/README.md rename to node_modules/engine.io/node_modules/debug/README.md diff --git a/backend/node_modules/engine.io/node_modules/debug/package.json b/node_modules/engine.io/node_modules/debug/package.json similarity index 100% rename from backend/node_modules/engine.io/node_modules/debug/package.json rename to node_modules/engine.io/node_modules/debug/package.json diff --git a/backend/node_modules/engine.io/node_modules/debug/src/browser.js b/node_modules/engine.io/node_modules/debug/src/browser.js similarity index 100% rename from backend/node_modules/engine.io/node_modules/debug/src/browser.js rename to node_modules/engine.io/node_modules/debug/src/browser.js diff --git a/backend/node_modules/engine.io/node_modules/debug/src/common.js b/node_modules/engine.io/node_modules/debug/src/common.js similarity index 100% rename from backend/node_modules/engine.io/node_modules/debug/src/common.js rename to node_modules/engine.io/node_modules/debug/src/common.js diff --git a/backend/node_modules/engine.io/node_modules/debug/src/index.js b/node_modules/engine.io/node_modules/debug/src/index.js similarity index 100% rename from backend/node_modules/engine.io/node_modules/debug/src/index.js rename to node_modules/engine.io/node_modules/debug/src/index.js diff --git a/backend/node_modules/engine.io/node_modules/debug/src/node.js b/node_modules/engine.io/node_modules/debug/src/node.js similarity index 100% rename from backend/node_modules/engine.io/node_modules/debug/src/node.js rename to node_modules/engine.io/node_modules/debug/src/node.js diff --git a/backend/node_modules/engine.io/node_modules/ms/index.js b/node_modules/engine.io/node_modules/ms/index.js similarity index 100% rename from backend/node_modules/engine.io/node_modules/ms/index.js rename to node_modules/engine.io/node_modules/ms/index.js diff --git a/backend/node_modules/engine.io/node_modules/ms/license.md b/node_modules/engine.io/node_modules/ms/license.md similarity index 100% rename from backend/node_modules/engine.io/node_modules/ms/license.md rename to node_modules/engine.io/node_modules/ms/license.md diff --git a/backend/node_modules/engine.io/node_modules/ms/package.json b/node_modules/engine.io/node_modules/ms/package.json similarity index 100% rename from backend/node_modules/engine.io/node_modules/ms/package.json rename to node_modules/engine.io/node_modules/ms/package.json diff --git a/backend/node_modules/engine.io/node_modules/ms/readme.md b/node_modules/engine.io/node_modules/ms/readme.md similarity index 100% rename from backend/node_modules/engine.io/node_modules/ms/readme.md rename to node_modules/engine.io/node_modules/ms/readme.md diff --git a/backend/node_modules/engine.io/package.json b/node_modules/engine.io/package.json similarity index 100% rename from backend/node_modules/engine.io/package.json rename to node_modules/engine.io/package.json diff --git a/backend/node_modules/engine.io/wrapper.mjs b/node_modules/engine.io/wrapper.mjs similarity index 100% rename from backend/node_modules/engine.io/wrapper.mjs rename to node_modules/engine.io/wrapper.mjs diff --git a/backend/node_modules/es-define-property/.eslintrc b/node_modules/es-define-property/.eslintrc similarity index 100% rename from backend/node_modules/es-define-property/.eslintrc rename to node_modules/es-define-property/.eslintrc diff --git a/backend/node_modules/es-define-property/.github/FUNDING.yml b/node_modules/es-define-property/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/es-define-property/.github/FUNDING.yml rename to node_modules/es-define-property/.github/FUNDING.yml diff --git a/backend/node_modules/es-define-property/.nycrc b/node_modules/es-define-property/.nycrc similarity index 100% rename from backend/node_modules/es-define-property/.nycrc rename to node_modules/es-define-property/.nycrc diff --git a/backend/node_modules/es-define-property/CHANGELOG.md b/node_modules/es-define-property/CHANGELOG.md similarity index 100% rename from backend/node_modules/es-define-property/CHANGELOG.md rename to node_modules/es-define-property/CHANGELOG.md diff --git a/backend/node_modules/es-define-property/LICENSE b/node_modules/es-define-property/LICENSE similarity index 100% rename from backend/node_modules/es-define-property/LICENSE rename to node_modules/es-define-property/LICENSE diff --git a/backend/node_modules/es-define-property/README.md b/node_modules/es-define-property/README.md similarity index 100% rename from backend/node_modules/es-define-property/README.md rename to node_modules/es-define-property/README.md diff --git a/backend/node_modules/es-define-property/index.d.ts b/node_modules/es-define-property/index.d.ts similarity index 100% rename from backend/node_modules/es-define-property/index.d.ts rename to node_modules/es-define-property/index.d.ts diff --git a/backend/node_modules/es-define-property/index.js b/node_modules/es-define-property/index.js similarity index 100% rename from backend/node_modules/es-define-property/index.js rename to node_modules/es-define-property/index.js diff --git a/backend/node_modules/es-define-property/package.json b/node_modules/es-define-property/package.json similarity index 100% rename from backend/node_modules/es-define-property/package.json rename to node_modules/es-define-property/package.json diff --git a/backend/node_modules/es-define-property/test/index.js b/node_modules/es-define-property/test/index.js similarity index 100% rename from backend/node_modules/es-define-property/test/index.js rename to node_modules/es-define-property/test/index.js diff --git a/backend/node_modules/es-define-property/tsconfig.json b/node_modules/es-define-property/tsconfig.json similarity index 100% rename from backend/node_modules/es-define-property/tsconfig.json rename to node_modules/es-define-property/tsconfig.json diff --git a/backend/node_modules/es-errors/.eslintrc b/node_modules/es-errors/.eslintrc similarity index 100% rename from backend/node_modules/es-errors/.eslintrc rename to node_modules/es-errors/.eslintrc diff --git a/backend/node_modules/es-errors/.github/FUNDING.yml b/node_modules/es-errors/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/es-errors/.github/FUNDING.yml rename to node_modules/es-errors/.github/FUNDING.yml diff --git a/backend/node_modules/es-errors/CHANGELOG.md b/node_modules/es-errors/CHANGELOG.md similarity index 100% rename from backend/node_modules/es-errors/CHANGELOG.md rename to node_modules/es-errors/CHANGELOG.md diff --git a/backend/node_modules/es-errors/LICENSE b/node_modules/es-errors/LICENSE similarity index 100% rename from backend/node_modules/es-errors/LICENSE rename to node_modules/es-errors/LICENSE diff --git a/backend/node_modules/es-errors/README.md b/node_modules/es-errors/README.md similarity index 100% rename from backend/node_modules/es-errors/README.md rename to node_modules/es-errors/README.md diff --git a/backend/node_modules/es-errors/eval.d.ts b/node_modules/es-errors/eval.d.ts similarity index 100% rename from backend/node_modules/es-errors/eval.d.ts rename to node_modules/es-errors/eval.d.ts diff --git a/backend/node_modules/es-errors/eval.js b/node_modules/es-errors/eval.js similarity index 100% rename from backend/node_modules/es-errors/eval.js rename to node_modules/es-errors/eval.js diff --git a/backend/node_modules/es-errors/index.d.ts b/node_modules/es-errors/index.d.ts similarity index 100% rename from backend/node_modules/es-errors/index.d.ts rename to node_modules/es-errors/index.d.ts diff --git a/backend/node_modules/es-errors/index.js b/node_modules/es-errors/index.js similarity index 100% rename from backend/node_modules/es-errors/index.js rename to node_modules/es-errors/index.js diff --git a/backend/node_modules/es-errors/package.json b/node_modules/es-errors/package.json similarity index 100% rename from backend/node_modules/es-errors/package.json rename to node_modules/es-errors/package.json diff --git a/backend/node_modules/es-errors/range.d.ts b/node_modules/es-errors/range.d.ts similarity index 100% rename from backend/node_modules/es-errors/range.d.ts rename to node_modules/es-errors/range.d.ts diff --git a/backend/node_modules/es-errors/range.js b/node_modules/es-errors/range.js similarity index 100% rename from backend/node_modules/es-errors/range.js rename to node_modules/es-errors/range.js diff --git a/backend/node_modules/es-errors/ref.d.ts b/node_modules/es-errors/ref.d.ts similarity index 100% rename from backend/node_modules/es-errors/ref.d.ts rename to node_modules/es-errors/ref.d.ts diff --git a/backend/node_modules/es-errors/ref.js b/node_modules/es-errors/ref.js similarity index 100% rename from backend/node_modules/es-errors/ref.js rename to node_modules/es-errors/ref.js diff --git a/backend/node_modules/es-errors/syntax.d.ts b/node_modules/es-errors/syntax.d.ts similarity index 100% rename from backend/node_modules/es-errors/syntax.d.ts rename to node_modules/es-errors/syntax.d.ts diff --git a/backend/node_modules/es-errors/syntax.js b/node_modules/es-errors/syntax.js similarity index 100% rename from backend/node_modules/es-errors/syntax.js rename to node_modules/es-errors/syntax.js diff --git a/backend/node_modules/es-errors/test/index.js b/node_modules/es-errors/test/index.js similarity index 100% rename from backend/node_modules/es-errors/test/index.js rename to node_modules/es-errors/test/index.js diff --git a/backend/node_modules/es-errors/tsconfig.json b/node_modules/es-errors/tsconfig.json similarity index 100% rename from backend/node_modules/es-errors/tsconfig.json rename to node_modules/es-errors/tsconfig.json diff --git a/backend/node_modules/es-errors/type.d.ts b/node_modules/es-errors/type.d.ts similarity index 100% rename from backend/node_modules/es-errors/type.d.ts rename to node_modules/es-errors/type.d.ts diff --git a/backend/node_modules/es-errors/type.js b/node_modules/es-errors/type.js similarity index 100% rename from backend/node_modules/es-errors/type.js rename to node_modules/es-errors/type.js diff --git a/backend/node_modules/es-errors/uri.d.ts b/node_modules/es-errors/uri.d.ts similarity index 100% rename from backend/node_modules/es-errors/uri.d.ts rename to node_modules/es-errors/uri.d.ts diff --git a/backend/node_modules/es-errors/uri.js b/node_modules/es-errors/uri.js similarity index 100% rename from backend/node_modules/es-errors/uri.js rename to node_modules/es-errors/uri.js diff --git a/backend/node_modules/es-object-atoms/.eslintrc b/node_modules/es-object-atoms/.eslintrc similarity index 100% rename from backend/node_modules/es-object-atoms/.eslintrc rename to node_modules/es-object-atoms/.eslintrc diff --git a/backend/node_modules/es-object-atoms/.github/FUNDING.yml b/node_modules/es-object-atoms/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/es-object-atoms/.github/FUNDING.yml rename to node_modules/es-object-atoms/.github/FUNDING.yml diff --git a/backend/node_modules/es-object-atoms/CHANGELOG.md b/node_modules/es-object-atoms/CHANGELOG.md similarity index 100% rename from backend/node_modules/es-object-atoms/CHANGELOG.md rename to node_modules/es-object-atoms/CHANGELOG.md diff --git a/backend/node_modules/es-object-atoms/LICENSE b/node_modules/es-object-atoms/LICENSE similarity index 100% rename from backend/node_modules/es-object-atoms/LICENSE rename to node_modules/es-object-atoms/LICENSE diff --git a/backend/node_modules/es-object-atoms/README.md b/node_modules/es-object-atoms/README.md similarity index 100% rename from backend/node_modules/es-object-atoms/README.md rename to node_modules/es-object-atoms/README.md diff --git a/backend/node_modules/es-object-atoms/RequireObjectCoercible.d.ts b/node_modules/es-object-atoms/RequireObjectCoercible.d.ts similarity index 100% rename from backend/node_modules/es-object-atoms/RequireObjectCoercible.d.ts rename to node_modules/es-object-atoms/RequireObjectCoercible.d.ts diff --git a/backend/node_modules/es-object-atoms/RequireObjectCoercible.js b/node_modules/es-object-atoms/RequireObjectCoercible.js similarity index 100% rename from backend/node_modules/es-object-atoms/RequireObjectCoercible.js rename to node_modules/es-object-atoms/RequireObjectCoercible.js diff --git a/backend/node_modules/es-object-atoms/ToObject.d.ts b/node_modules/es-object-atoms/ToObject.d.ts similarity index 100% rename from backend/node_modules/es-object-atoms/ToObject.d.ts rename to node_modules/es-object-atoms/ToObject.d.ts diff --git a/backend/node_modules/es-object-atoms/ToObject.js b/node_modules/es-object-atoms/ToObject.js similarity index 100% rename from backend/node_modules/es-object-atoms/ToObject.js rename to node_modules/es-object-atoms/ToObject.js diff --git a/backend/node_modules/es-object-atoms/index.d.ts b/node_modules/es-object-atoms/index.d.ts similarity index 100% rename from backend/node_modules/es-object-atoms/index.d.ts rename to node_modules/es-object-atoms/index.d.ts diff --git a/backend/node_modules/es-object-atoms/index.js b/node_modules/es-object-atoms/index.js similarity index 100% rename from backend/node_modules/es-object-atoms/index.js rename to node_modules/es-object-atoms/index.js diff --git a/backend/node_modules/es-object-atoms/isObject.d.ts b/node_modules/es-object-atoms/isObject.d.ts similarity index 100% rename from backend/node_modules/es-object-atoms/isObject.d.ts rename to node_modules/es-object-atoms/isObject.d.ts diff --git a/backend/node_modules/es-object-atoms/isObject.js b/node_modules/es-object-atoms/isObject.js similarity index 100% rename from backend/node_modules/es-object-atoms/isObject.js rename to node_modules/es-object-atoms/isObject.js diff --git a/backend/node_modules/es-object-atoms/package.json b/node_modules/es-object-atoms/package.json similarity index 100% rename from backend/node_modules/es-object-atoms/package.json rename to node_modules/es-object-atoms/package.json diff --git a/backend/node_modules/es-object-atoms/test/index.js b/node_modules/es-object-atoms/test/index.js similarity index 100% rename from backend/node_modules/es-object-atoms/test/index.js rename to node_modules/es-object-atoms/test/index.js diff --git a/backend/node_modules/es-object-atoms/tsconfig.json b/node_modules/es-object-atoms/tsconfig.json similarity index 100% rename from backend/node_modules/es-object-atoms/tsconfig.json rename to node_modules/es-object-atoms/tsconfig.json diff --git a/backend/node_modules/escape-html/LICENSE b/node_modules/escape-html/LICENSE similarity index 100% rename from backend/node_modules/escape-html/LICENSE rename to node_modules/escape-html/LICENSE diff --git a/backend/node_modules/escape-html/Readme.md b/node_modules/escape-html/Readme.md similarity index 100% rename from backend/node_modules/escape-html/Readme.md rename to node_modules/escape-html/Readme.md diff --git a/backend/node_modules/escape-html/index.js b/node_modules/escape-html/index.js similarity index 100% rename from backend/node_modules/escape-html/index.js rename to node_modules/escape-html/index.js diff --git a/backend/node_modules/escape-html/package.json b/node_modules/escape-html/package.json similarity index 100% rename from backend/node_modules/escape-html/package.json rename to node_modules/escape-html/package.json diff --git a/backend/node_modules/etag/HISTORY.md b/node_modules/etag/HISTORY.md similarity index 100% rename from backend/node_modules/etag/HISTORY.md rename to node_modules/etag/HISTORY.md diff --git a/backend/node_modules/etag/LICENSE b/node_modules/etag/LICENSE similarity index 100% rename from backend/node_modules/etag/LICENSE rename to node_modules/etag/LICENSE diff --git a/backend/node_modules/etag/README.md b/node_modules/etag/README.md similarity index 100% rename from backend/node_modules/etag/README.md rename to node_modules/etag/README.md diff --git a/backend/node_modules/etag/index.js b/node_modules/etag/index.js similarity index 100% rename from backend/node_modules/etag/index.js rename to node_modules/etag/index.js diff --git a/backend/node_modules/etag/package.json b/node_modules/etag/package.json similarity index 100% rename from backend/node_modules/etag/package.json rename to node_modules/etag/package.json diff --git a/backend/node_modules/express/History.md b/node_modules/express/History.md similarity index 100% rename from backend/node_modules/express/History.md rename to node_modules/express/History.md diff --git a/backend/node_modules/express/LICENSE b/node_modules/express/LICENSE similarity index 100% rename from backend/node_modules/express/LICENSE rename to node_modules/express/LICENSE diff --git a/backend/node_modules/express/Readme.md b/node_modules/express/Readme.md similarity index 100% rename from backend/node_modules/express/Readme.md rename to node_modules/express/Readme.md diff --git a/backend/node_modules/express/index.js b/node_modules/express/index.js similarity index 100% rename from backend/node_modules/express/index.js rename to node_modules/express/index.js diff --git a/backend/node_modules/express/lib/application.js b/node_modules/express/lib/application.js similarity index 100% rename from backend/node_modules/express/lib/application.js rename to node_modules/express/lib/application.js diff --git a/backend/node_modules/express/lib/express.js b/node_modules/express/lib/express.js similarity index 100% rename from backend/node_modules/express/lib/express.js rename to node_modules/express/lib/express.js diff --git a/backend/node_modules/express/lib/middleware/init.js b/node_modules/express/lib/middleware/init.js similarity index 100% rename from backend/node_modules/express/lib/middleware/init.js rename to node_modules/express/lib/middleware/init.js diff --git a/backend/node_modules/express/lib/middleware/query.js b/node_modules/express/lib/middleware/query.js similarity index 100% rename from backend/node_modules/express/lib/middleware/query.js rename to node_modules/express/lib/middleware/query.js diff --git a/backend/node_modules/express/lib/request.js b/node_modules/express/lib/request.js similarity index 100% rename from backend/node_modules/express/lib/request.js rename to node_modules/express/lib/request.js diff --git a/backend/node_modules/express/lib/response.js b/node_modules/express/lib/response.js similarity index 100% rename from backend/node_modules/express/lib/response.js rename to node_modules/express/lib/response.js diff --git a/backend/node_modules/express/lib/router/index.js b/node_modules/express/lib/router/index.js similarity index 100% rename from backend/node_modules/express/lib/router/index.js rename to node_modules/express/lib/router/index.js diff --git a/backend/node_modules/express/lib/router/layer.js b/node_modules/express/lib/router/layer.js similarity index 100% rename from backend/node_modules/express/lib/router/layer.js rename to node_modules/express/lib/router/layer.js diff --git a/backend/node_modules/express/lib/router/route.js b/node_modules/express/lib/router/route.js similarity index 100% rename from backend/node_modules/express/lib/router/route.js rename to node_modules/express/lib/router/route.js diff --git a/backend/node_modules/express/lib/utils.js b/node_modules/express/lib/utils.js similarity index 100% rename from backend/node_modules/express/lib/utils.js rename to node_modules/express/lib/utils.js diff --git a/backend/node_modules/express/lib/view.js b/node_modules/express/lib/view.js similarity index 100% rename from backend/node_modules/express/lib/view.js rename to node_modules/express/lib/view.js diff --git a/backend/node_modules/express/package.json b/node_modules/express/package.json similarity index 100% rename from backend/node_modules/express/package.json rename to node_modules/express/package.json diff --git a/backend/node_modules/finalhandler/HISTORY.md b/node_modules/finalhandler/HISTORY.md similarity index 100% rename from backend/node_modules/finalhandler/HISTORY.md rename to node_modules/finalhandler/HISTORY.md diff --git a/backend/node_modules/finalhandler/LICENSE b/node_modules/finalhandler/LICENSE similarity index 100% rename from backend/node_modules/finalhandler/LICENSE rename to node_modules/finalhandler/LICENSE diff --git a/backend/node_modules/finalhandler/README.md b/node_modules/finalhandler/README.md similarity index 100% rename from backend/node_modules/finalhandler/README.md rename to node_modules/finalhandler/README.md diff --git a/backend/node_modules/finalhandler/SECURITY.md b/node_modules/finalhandler/SECURITY.md similarity index 100% rename from backend/node_modules/finalhandler/SECURITY.md rename to node_modules/finalhandler/SECURITY.md diff --git a/backend/node_modules/finalhandler/index.js b/node_modules/finalhandler/index.js similarity index 100% rename from backend/node_modules/finalhandler/index.js rename to node_modules/finalhandler/index.js diff --git a/backend/node_modules/finalhandler/package.json b/node_modules/finalhandler/package.json similarity index 100% rename from backend/node_modules/finalhandler/package.json rename to node_modules/finalhandler/package.json diff --git a/backend/node_modules/forwarded/HISTORY.md b/node_modules/forwarded/HISTORY.md similarity index 100% rename from backend/node_modules/forwarded/HISTORY.md rename to node_modules/forwarded/HISTORY.md diff --git a/backend/node_modules/forwarded/LICENSE b/node_modules/forwarded/LICENSE similarity index 100% rename from backend/node_modules/forwarded/LICENSE rename to node_modules/forwarded/LICENSE diff --git a/backend/node_modules/forwarded/README.md b/node_modules/forwarded/README.md similarity index 100% rename from backend/node_modules/forwarded/README.md rename to node_modules/forwarded/README.md diff --git a/backend/node_modules/forwarded/index.js b/node_modules/forwarded/index.js similarity index 100% rename from backend/node_modules/forwarded/index.js rename to node_modules/forwarded/index.js diff --git a/backend/node_modules/forwarded/package.json b/node_modules/forwarded/package.json similarity index 100% rename from backend/node_modules/forwarded/package.json rename to node_modules/forwarded/package.json diff --git a/backend/node_modules/fresh/HISTORY.md b/node_modules/fresh/HISTORY.md similarity index 100% rename from backend/node_modules/fresh/HISTORY.md rename to node_modules/fresh/HISTORY.md diff --git a/backend/node_modules/fresh/LICENSE b/node_modules/fresh/LICENSE similarity index 100% rename from backend/node_modules/fresh/LICENSE rename to node_modules/fresh/LICENSE diff --git a/backend/node_modules/fresh/README.md b/node_modules/fresh/README.md similarity index 100% rename from backend/node_modules/fresh/README.md rename to node_modules/fresh/README.md diff --git a/backend/node_modules/fresh/index.js b/node_modules/fresh/index.js similarity index 100% rename from backend/node_modules/fresh/index.js rename to node_modules/fresh/index.js diff --git a/backend/node_modules/fresh/package.json b/node_modules/fresh/package.json similarity index 100% rename from backend/node_modules/fresh/package.json rename to node_modules/fresh/package.json diff --git a/backend/node_modules/function-bind/.eslintrc b/node_modules/function-bind/.eslintrc similarity index 100% rename from backend/node_modules/function-bind/.eslintrc rename to node_modules/function-bind/.eslintrc diff --git a/backend/node_modules/function-bind/.github/FUNDING.yml b/node_modules/function-bind/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/function-bind/.github/FUNDING.yml rename to node_modules/function-bind/.github/FUNDING.yml diff --git a/backend/node_modules/function-bind/.github/SECURITY.md b/node_modules/function-bind/.github/SECURITY.md similarity index 100% rename from backend/node_modules/function-bind/.github/SECURITY.md rename to node_modules/function-bind/.github/SECURITY.md diff --git a/backend/node_modules/function-bind/.nycrc b/node_modules/function-bind/.nycrc similarity index 100% rename from backend/node_modules/function-bind/.nycrc rename to node_modules/function-bind/.nycrc diff --git a/backend/node_modules/function-bind/CHANGELOG.md b/node_modules/function-bind/CHANGELOG.md similarity index 100% rename from backend/node_modules/function-bind/CHANGELOG.md rename to node_modules/function-bind/CHANGELOG.md diff --git a/backend/node_modules/function-bind/LICENSE b/node_modules/function-bind/LICENSE similarity index 100% rename from backend/node_modules/function-bind/LICENSE rename to node_modules/function-bind/LICENSE diff --git a/backend/node_modules/function-bind/README.md b/node_modules/function-bind/README.md similarity index 100% rename from backend/node_modules/function-bind/README.md rename to node_modules/function-bind/README.md diff --git a/backend/node_modules/function-bind/implementation.js b/node_modules/function-bind/implementation.js similarity index 100% rename from backend/node_modules/function-bind/implementation.js rename to node_modules/function-bind/implementation.js diff --git a/backend/node_modules/function-bind/index.js b/node_modules/function-bind/index.js similarity index 100% rename from backend/node_modules/function-bind/index.js rename to node_modules/function-bind/index.js diff --git a/backend/node_modules/function-bind/package.json b/node_modules/function-bind/package.json similarity index 100% rename from backend/node_modules/function-bind/package.json rename to node_modules/function-bind/package.json diff --git a/backend/node_modules/function-bind/test/.eslintrc b/node_modules/function-bind/test/.eslintrc similarity index 100% rename from backend/node_modules/function-bind/test/.eslintrc rename to node_modules/function-bind/test/.eslintrc diff --git a/backend/node_modules/function-bind/test/index.js b/node_modules/function-bind/test/index.js similarity index 100% rename from backend/node_modules/function-bind/test/index.js rename to node_modules/function-bind/test/index.js diff --git a/backend/node_modules/get-intrinsic/.eslintrc b/node_modules/get-intrinsic/.eslintrc similarity index 100% rename from backend/node_modules/get-intrinsic/.eslintrc rename to node_modules/get-intrinsic/.eslintrc diff --git a/backend/node_modules/get-intrinsic/.github/FUNDING.yml b/node_modules/get-intrinsic/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/get-intrinsic/.github/FUNDING.yml rename to node_modules/get-intrinsic/.github/FUNDING.yml diff --git a/backend/node_modules/get-intrinsic/.nycrc b/node_modules/get-intrinsic/.nycrc similarity index 100% rename from backend/node_modules/get-intrinsic/.nycrc rename to node_modules/get-intrinsic/.nycrc diff --git a/backend/node_modules/get-intrinsic/CHANGELOG.md b/node_modules/get-intrinsic/CHANGELOG.md similarity index 100% rename from backend/node_modules/get-intrinsic/CHANGELOG.md rename to node_modules/get-intrinsic/CHANGELOG.md diff --git a/backend/node_modules/get-intrinsic/LICENSE b/node_modules/get-intrinsic/LICENSE similarity index 100% rename from backend/node_modules/get-intrinsic/LICENSE rename to node_modules/get-intrinsic/LICENSE diff --git a/backend/node_modules/get-intrinsic/README.md b/node_modules/get-intrinsic/README.md similarity index 100% rename from backend/node_modules/get-intrinsic/README.md rename to node_modules/get-intrinsic/README.md diff --git a/backend/node_modules/get-intrinsic/index.js b/node_modules/get-intrinsic/index.js similarity index 100% rename from backend/node_modules/get-intrinsic/index.js rename to node_modules/get-intrinsic/index.js diff --git a/backend/node_modules/get-intrinsic/package.json b/node_modules/get-intrinsic/package.json similarity index 100% rename from backend/node_modules/get-intrinsic/package.json rename to node_modules/get-intrinsic/package.json diff --git a/backend/node_modules/get-intrinsic/test/GetIntrinsic.js b/node_modules/get-intrinsic/test/GetIntrinsic.js similarity index 100% rename from backend/node_modules/get-intrinsic/test/GetIntrinsic.js rename to node_modules/get-intrinsic/test/GetIntrinsic.js diff --git a/backend/node_modules/get-proto/.eslintrc b/node_modules/get-proto/.eslintrc similarity index 100% rename from backend/node_modules/get-proto/.eslintrc rename to node_modules/get-proto/.eslintrc diff --git a/backend/node_modules/get-proto/.github/FUNDING.yml b/node_modules/get-proto/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/get-proto/.github/FUNDING.yml rename to node_modules/get-proto/.github/FUNDING.yml diff --git a/backend/node_modules/get-proto/.nycrc b/node_modules/get-proto/.nycrc similarity index 100% rename from backend/node_modules/get-proto/.nycrc rename to node_modules/get-proto/.nycrc diff --git a/backend/node_modules/get-proto/CHANGELOG.md b/node_modules/get-proto/CHANGELOG.md similarity index 100% rename from backend/node_modules/get-proto/CHANGELOG.md rename to node_modules/get-proto/CHANGELOG.md diff --git a/backend/node_modules/get-proto/LICENSE b/node_modules/get-proto/LICENSE similarity index 100% rename from backend/node_modules/get-proto/LICENSE rename to node_modules/get-proto/LICENSE diff --git a/backend/node_modules/get-proto/Object.getPrototypeOf.d.ts b/node_modules/get-proto/Object.getPrototypeOf.d.ts similarity index 100% rename from backend/node_modules/get-proto/Object.getPrototypeOf.d.ts rename to node_modules/get-proto/Object.getPrototypeOf.d.ts diff --git a/backend/node_modules/get-proto/Object.getPrototypeOf.js b/node_modules/get-proto/Object.getPrototypeOf.js similarity index 100% rename from backend/node_modules/get-proto/Object.getPrototypeOf.js rename to node_modules/get-proto/Object.getPrototypeOf.js diff --git a/backend/node_modules/get-proto/README.md b/node_modules/get-proto/README.md similarity index 100% rename from backend/node_modules/get-proto/README.md rename to node_modules/get-proto/README.md diff --git a/backend/node_modules/get-proto/Reflect.getPrototypeOf.d.ts b/node_modules/get-proto/Reflect.getPrototypeOf.d.ts similarity index 100% rename from backend/node_modules/get-proto/Reflect.getPrototypeOf.d.ts rename to node_modules/get-proto/Reflect.getPrototypeOf.d.ts diff --git a/backend/node_modules/get-proto/Reflect.getPrototypeOf.js b/node_modules/get-proto/Reflect.getPrototypeOf.js similarity index 100% rename from backend/node_modules/get-proto/Reflect.getPrototypeOf.js rename to node_modules/get-proto/Reflect.getPrototypeOf.js diff --git a/backend/node_modules/get-proto/index.d.ts b/node_modules/get-proto/index.d.ts similarity index 100% rename from backend/node_modules/get-proto/index.d.ts rename to node_modules/get-proto/index.d.ts diff --git a/backend/node_modules/get-proto/index.js b/node_modules/get-proto/index.js similarity index 100% rename from backend/node_modules/get-proto/index.js rename to node_modules/get-proto/index.js diff --git a/backend/node_modules/get-proto/package.json b/node_modules/get-proto/package.json similarity index 100% rename from backend/node_modules/get-proto/package.json rename to node_modules/get-proto/package.json diff --git a/backend/node_modules/get-proto/test/index.js b/node_modules/get-proto/test/index.js similarity index 100% rename from backend/node_modules/get-proto/test/index.js rename to node_modules/get-proto/test/index.js diff --git a/backend/node_modules/get-proto/tsconfig.json b/node_modules/get-proto/tsconfig.json similarity index 100% rename from backend/node_modules/get-proto/tsconfig.json rename to node_modules/get-proto/tsconfig.json diff --git a/backend/node_modules/gopd/.eslintrc b/node_modules/gopd/.eslintrc similarity index 100% rename from backend/node_modules/gopd/.eslintrc rename to node_modules/gopd/.eslintrc diff --git a/backend/node_modules/gopd/.github/FUNDING.yml b/node_modules/gopd/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/gopd/.github/FUNDING.yml rename to node_modules/gopd/.github/FUNDING.yml diff --git a/backend/node_modules/gopd/CHANGELOG.md b/node_modules/gopd/CHANGELOG.md similarity index 100% rename from backend/node_modules/gopd/CHANGELOG.md rename to node_modules/gopd/CHANGELOG.md diff --git a/backend/node_modules/gopd/LICENSE b/node_modules/gopd/LICENSE similarity index 100% rename from backend/node_modules/gopd/LICENSE rename to node_modules/gopd/LICENSE diff --git a/backend/node_modules/gopd/README.md b/node_modules/gopd/README.md similarity index 100% rename from backend/node_modules/gopd/README.md rename to node_modules/gopd/README.md diff --git a/backend/node_modules/gopd/gOPD.d.ts b/node_modules/gopd/gOPD.d.ts similarity index 100% rename from backend/node_modules/gopd/gOPD.d.ts rename to node_modules/gopd/gOPD.d.ts diff --git a/backend/node_modules/gopd/gOPD.js b/node_modules/gopd/gOPD.js similarity index 100% rename from backend/node_modules/gopd/gOPD.js rename to node_modules/gopd/gOPD.js diff --git a/backend/node_modules/gopd/index.d.ts b/node_modules/gopd/index.d.ts similarity index 100% rename from backend/node_modules/gopd/index.d.ts rename to node_modules/gopd/index.d.ts diff --git a/backend/node_modules/gopd/index.js b/node_modules/gopd/index.js similarity index 100% rename from backend/node_modules/gopd/index.js rename to node_modules/gopd/index.js diff --git a/backend/node_modules/gopd/package.json b/node_modules/gopd/package.json similarity index 100% rename from backend/node_modules/gopd/package.json rename to node_modules/gopd/package.json diff --git a/backend/node_modules/gopd/test/index.js b/node_modules/gopd/test/index.js similarity index 100% rename from backend/node_modules/gopd/test/index.js rename to node_modules/gopd/test/index.js diff --git a/backend/node_modules/gopd/tsconfig.json b/node_modules/gopd/tsconfig.json similarity index 100% rename from backend/node_modules/gopd/tsconfig.json rename to node_modules/gopd/tsconfig.json diff --git a/backend/node_modules/has-symbols/.eslintrc b/node_modules/has-symbols/.eslintrc similarity index 100% rename from backend/node_modules/has-symbols/.eslintrc rename to node_modules/has-symbols/.eslintrc diff --git a/backend/node_modules/has-symbols/.github/FUNDING.yml b/node_modules/has-symbols/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/has-symbols/.github/FUNDING.yml rename to node_modules/has-symbols/.github/FUNDING.yml diff --git a/backend/node_modules/has-symbols/.nycrc b/node_modules/has-symbols/.nycrc similarity index 100% rename from backend/node_modules/has-symbols/.nycrc rename to node_modules/has-symbols/.nycrc diff --git a/backend/node_modules/has-symbols/CHANGELOG.md b/node_modules/has-symbols/CHANGELOG.md similarity index 100% rename from backend/node_modules/has-symbols/CHANGELOG.md rename to node_modules/has-symbols/CHANGELOG.md diff --git a/backend/node_modules/has-symbols/LICENSE b/node_modules/has-symbols/LICENSE similarity index 100% rename from backend/node_modules/has-symbols/LICENSE rename to node_modules/has-symbols/LICENSE diff --git a/backend/node_modules/has-symbols/README.md b/node_modules/has-symbols/README.md similarity index 100% rename from backend/node_modules/has-symbols/README.md rename to node_modules/has-symbols/README.md diff --git a/backend/node_modules/has-symbols/index.d.ts b/node_modules/has-symbols/index.d.ts similarity index 100% rename from backend/node_modules/has-symbols/index.d.ts rename to node_modules/has-symbols/index.d.ts diff --git a/backend/node_modules/has-symbols/index.js b/node_modules/has-symbols/index.js similarity index 100% rename from backend/node_modules/has-symbols/index.js rename to node_modules/has-symbols/index.js diff --git a/backend/node_modules/has-symbols/package.json b/node_modules/has-symbols/package.json similarity index 100% rename from backend/node_modules/has-symbols/package.json rename to node_modules/has-symbols/package.json diff --git a/backend/node_modules/has-symbols/shams.d.ts b/node_modules/has-symbols/shams.d.ts similarity index 100% rename from backend/node_modules/has-symbols/shams.d.ts rename to node_modules/has-symbols/shams.d.ts diff --git a/backend/node_modules/has-symbols/shams.js b/node_modules/has-symbols/shams.js similarity index 100% rename from backend/node_modules/has-symbols/shams.js rename to node_modules/has-symbols/shams.js diff --git a/backend/node_modules/has-symbols/test/index.js b/node_modules/has-symbols/test/index.js similarity index 100% rename from backend/node_modules/has-symbols/test/index.js rename to node_modules/has-symbols/test/index.js diff --git a/backend/node_modules/has-symbols/test/shams/core-js.js b/node_modules/has-symbols/test/shams/core-js.js similarity index 100% rename from backend/node_modules/has-symbols/test/shams/core-js.js rename to node_modules/has-symbols/test/shams/core-js.js diff --git a/backend/node_modules/has-symbols/test/shams/get-own-property-symbols.js b/node_modules/has-symbols/test/shams/get-own-property-symbols.js similarity index 100% rename from backend/node_modules/has-symbols/test/shams/get-own-property-symbols.js rename to node_modules/has-symbols/test/shams/get-own-property-symbols.js diff --git a/backend/node_modules/has-symbols/test/tests.js b/node_modules/has-symbols/test/tests.js similarity index 100% rename from backend/node_modules/has-symbols/test/tests.js rename to node_modules/has-symbols/test/tests.js diff --git a/backend/node_modules/has-symbols/tsconfig.json b/node_modules/has-symbols/tsconfig.json similarity index 100% rename from backend/node_modules/has-symbols/tsconfig.json rename to node_modules/has-symbols/tsconfig.json diff --git a/backend/node_modules/hasown/.eslintrc b/node_modules/hasown/.eslintrc similarity index 100% rename from backend/node_modules/hasown/.eslintrc rename to node_modules/hasown/.eslintrc diff --git a/backend/node_modules/hasown/.github/FUNDING.yml b/node_modules/hasown/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/hasown/.github/FUNDING.yml rename to node_modules/hasown/.github/FUNDING.yml diff --git a/backend/node_modules/hasown/.nycrc b/node_modules/hasown/.nycrc similarity index 100% rename from backend/node_modules/hasown/.nycrc rename to node_modules/hasown/.nycrc diff --git a/backend/node_modules/hasown/CHANGELOG.md b/node_modules/hasown/CHANGELOG.md similarity index 100% rename from backend/node_modules/hasown/CHANGELOG.md rename to node_modules/hasown/CHANGELOG.md diff --git a/backend/node_modules/hasown/LICENSE b/node_modules/hasown/LICENSE similarity index 100% rename from backend/node_modules/hasown/LICENSE rename to node_modules/hasown/LICENSE diff --git a/backend/node_modules/hasown/README.md b/node_modules/hasown/README.md similarity index 100% rename from backend/node_modules/hasown/README.md rename to node_modules/hasown/README.md diff --git a/backend/node_modules/hasown/index.d.ts b/node_modules/hasown/index.d.ts similarity index 100% rename from backend/node_modules/hasown/index.d.ts rename to node_modules/hasown/index.d.ts diff --git a/backend/node_modules/hasown/index.js b/node_modules/hasown/index.js similarity index 100% rename from backend/node_modules/hasown/index.js rename to node_modules/hasown/index.js diff --git a/backend/node_modules/hasown/package.json b/node_modules/hasown/package.json similarity index 100% rename from backend/node_modules/hasown/package.json rename to node_modules/hasown/package.json diff --git a/backend/node_modules/hasown/tsconfig.json b/node_modules/hasown/tsconfig.json similarity index 100% rename from backend/node_modules/hasown/tsconfig.json rename to node_modules/hasown/tsconfig.json diff --git a/backend/node_modules/http-errors/HISTORY.md b/node_modules/http-errors/HISTORY.md similarity index 100% rename from backend/node_modules/http-errors/HISTORY.md rename to node_modules/http-errors/HISTORY.md diff --git a/backend/node_modules/http-errors/LICENSE b/node_modules/http-errors/LICENSE similarity index 100% rename from backend/node_modules/http-errors/LICENSE rename to node_modules/http-errors/LICENSE diff --git a/backend/node_modules/http-errors/README.md b/node_modules/http-errors/README.md similarity index 100% rename from backend/node_modules/http-errors/README.md rename to node_modules/http-errors/README.md diff --git a/backend/node_modules/http-errors/index.js b/node_modules/http-errors/index.js similarity index 100% rename from backend/node_modules/http-errors/index.js rename to node_modules/http-errors/index.js diff --git a/backend/node_modules/http-errors/package.json b/node_modules/http-errors/package.json similarity index 100% rename from backend/node_modules/http-errors/package.json rename to node_modules/http-errors/package.json diff --git a/backend/node_modules/iconv-lite/Changelog.md b/node_modules/iconv-lite/Changelog.md similarity index 100% rename from backend/node_modules/iconv-lite/Changelog.md rename to node_modules/iconv-lite/Changelog.md diff --git a/backend/node_modules/iconv-lite/LICENSE b/node_modules/iconv-lite/LICENSE similarity index 100% rename from backend/node_modules/iconv-lite/LICENSE rename to node_modules/iconv-lite/LICENSE diff --git a/backend/node_modules/iconv-lite/README.md b/node_modules/iconv-lite/README.md similarity index 100% rename from backend/node_modules/iconv-lite/README.md rename to node_modules/iconv-lite/README.md diff --git a/backend/node_modules/iconv-lite/encodings/dbcs-codec.js b/node_modules/iconv-lite/encodings/dbcs-codec.js similarity index 100% rename from backend/node_modules/iconv-lite/encodings/dbcs-codec.js rename to node_modules/iconv-lite/encodings/dbcs-codec.js diff --git a/backend/node_modules/iconv-lite/encodings/dbcs-data.js b/node_modules/iconv-lite/encodings/dbcs-data.js similarity index 100% rename from backend/node_modules/iconv-lite/encodings/dbcs-data.js rename to node_modules/iconv-lite/encodings/dbcs-data.js diff --git a/backend/node_modules/iconv-lite/encodings/index.js b/node_modules/iconv-lite/encodings/index.js similarity index 100% rename from backend/node_modules/iconv-lite/encodings/index.js rename to node_modules/iconv-lite/encodings/index.js diff --git a/backend/node_modules/iconv-lite/encodings/internal.js b/node_modules/iconv-lite/encodings/internal.js similarity index 100% rename from backend/node_modules/iconv-lite/encodings/internal.js rename to node_modules/iconv-lite/encodings/internal.js diff --git a/backend/node_modules/iconv-lite/encodings/sbcs-codec.js b/node_modules/iconv-lite/encodings/sbcs-codec.js similarity index 100% rename from backend/node_modules/iconv-lite/encodings/sbcs-codec.js rename to node_modules/iconv-lite/encodings/sbcs-codec.js diff --git a/backend/node_modules/iconv-lite/encodings/sbcs-data-generated.js b/node_modules/iconv-lite/encodings/sbcs-data-generated.js similarity index 100% rename from backend/node_modules/iconv-lite/encodings/sbcs-data-generated.js rename to node_modules/iconv-lite/encodings/sbcs-data-generated.js diff --git a/backend/node_modules/iconv-lite/encodings/sbcs-data.js b/node_modules/iconv-lite/encodings/sbcs-data.js similarity index 100% rename from backend/node_modules/iconv-lite/encodings/sbcs-data.js rename to node_modules/iconv-lite/encodings/sbcs-data.js diff --git a/backend/node_modules/iconv-lite/encodings/tables/big5-added.json b/node_modules/iconv-lite/encodings/tables/big5-added.json similarity index 100% rename from backend/node_modules/iconv-lite/encodings/tables/big5-added.json rename to node_modules/iconv-lite/encodings/tables/big5-added.json diff --git a/backend/node_modules/iconv-lite/encodings/tables/cp936.json b/node_modules/iconv-lite/encodings/tables/cp936.json similarity index 100% rename from backend/node_modules/iconv-lite/encodings/tables/cp936.json rename to node_modules/iconv-lite/encodings/tables/cp936.json diff --git a/backend/node_modules/iconv-lite/encodings/tables/cp949.json b/node_modules/iconv-lite/encodings/tables/cp949.json similarity index 100% rename from backend/node_modules/iconv-lite/encodings/tables/cp949.json rename to node_modules/iconv-lite/encodings/tables/cp949.json diff --git a/backend/node_modules/iconv-lite/encodings/tables/cp950.json b/node_modules/iconv-lite/encodings/tables/cp950.json similarity index 100% rename from backend/node_modules/iconv-lite/encodings/tables/cp950.json rename to node_modules/iconv-lite/encodings/tables/cp950.json diff --git a/backend/node_modules/iconv-lite/encodings/tables/eucjp.json b/node_modules/iconv-lite/encodings/tables/eucjp.json similarity index 100% rename from backend/node_modules/iconv-lite/encodings/tables/eucjp.json rename to node_modules/iconv-lite/encodings/tables/eucjp.json diff --git a/backend/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json b/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json similarity index 100% rename from backend/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json rename to node_modules/iconv-lite/encodings/tables/gb18030-ranges.json diff --git a/backend/node_modules/iconv-lite/encodings/tables/gbk-added.json b/node_modules/iconv-lite/encodings/tables/gbk-added.json similarity index 100% rename from backend/node_modules/iconv-lite/encodings/tables/gbk-added.json rename to node_modules/iconv-lite/encodings/tables/gbk-added.json diff --git a/backend/node_modules/iconv-lite/encodings/tables/shiftjis.json b/node_modules/iconv-lite/encodings/tables/shiftjis.json similarity index 100% rename from backend/node_modules/iconv-lite/encodings/tables/shiftjis.json rename to node_modules/iconv-lite/encodings/tables/shiftjis.json diff --git a/backend/node_modules/iconv-lite/encodings/utf16.js b/node_modules/iconv-lite/encodings/utf16.js similarity index 100% rename from backend/node_modules/iconv-lite/encodings/utf16.js rename to node_modules/iconv-lite/encodings/utf16.js diff --git a/backend/node_modules/iconv-lite/encodings/utf7.js b/node_modules/iconv-lite/encodings/utf7.js similarity index 100% rename from backend/node_modules/iconv-lite/encodings/utf7.js rename to node_modules/iconv-lite/encodings/utf7.js diff --git a/backend/node_modules/iconv-lite/lib/bom-handling.js b/node_modules/iconv-lite/lib/bom-handling.js similarity index 100% rename from backend/node_modules/iconv-lite/lib/bom-handling.js rename to node_modules/iconv-lite/lib/bom-handling.js diff --git a/backend/node_modules/iconv-lite/lib/extend-node.js b/node_modules/iconv-lite/lib/extend-node.js similarity index 100% rename from backend/node_modules/iconv-lite/lib/extend-node.js rename to node_modules/iconv-lite/lib/extend-node.js diff --git a/backend/node_modules/iconv-lite/lib/index.d.ts b/node_modules/iconv-lite/lib/index.d.ts similarity index 100% rename from backend/node_modules/iconv-lite/lib/index.d.ts rename to node_modules/iconv-lite/lib/index.d.ts diff --git a/backend/node_modules/iconv-lite/lib/index.js b/node_modules/iconv-lite/lib/index.js similarity index 100% rename from backend/node_modules/iconv-lite/lib/index.js rename to node_modules/iconv-lite/lib/index.js diff --git a/backend/node_modules/iconv-lite/lib/streams.js b/node_modules/iconv-lite/lib/streams.js similarity index 100% rename from backend/node_modules/iconv-lite/lib/streams.js rename to node_modules/iconv-lite/lib/streams.js diff --git a/backend/node_modules/iconv-lite/package.json b/node_modules/iconv-lite/package.json similarity index 100% rename from backend/node_modules/iconv-lite/package.json rename to node_modules/iconv-lite/package.json diff --git a/backend/node_modules/inherits/LICENSE b/node_modules/inherits/LICENSE similarity index 100% rename from backend/node_modules/inherits/LICENSE rename to node_modules/inherits/LICENSE diff --git a/backend/node_modules/inherits/README.md b/node_modules/inherits/README.md similarity index 100% rename from backend/node_modules/inherits/README.md rename to node_modules/inherits/README.md diff --git a/backend/node_modules/inherits/inherits.js b/node_modules/inherits/inherits.js similarity index 100% rename from backend/node_modules/inherits/inherits.js rename to node_modules/inherits/inherits.js diff --git a/backend/node_modules/inherits/inherits_browser.js b/node_modules/inherits/inherits_browser.js similarity index 100% rename from backend/node_modules/inherits/inherits_browser.js rename to node_modules/inherits/inherits_browser.js diff --git a/backend/node_modules/inherits/package.json b/node_modules/inherits/package.json similarity index 100% rename from backend/node_modules/inherits/package.json rename to node_modules/inherits/package.json diff --git a/backend/node_modules/ipaddr.js/LICENSE b/node_modules/ipaddr.js/LICENSE similarity index 100% rename from backend/node_modules/ipaddr.js/LICENSE rename to node_modules/ipaddr.js/LICENSE diff --git a/backend/node_modules/ipaddr.js/README.md b/node_modules/ipaddr.js/README.md similarity index 100% rename from backend/node_modules/ipaddr.js/README.md rename to node_modules/ipaddr.js/README.md diff --git a/backend/node_modules/ipaddr.js/ipaddr.min.js b/node_modules/ipaddr.js/ipaddr.min.js similarity index 100% rename from backend/node_modules/ipaddr.js/ipaddr.min.js rename to node_modules/ipaddr.js/ipaddr.min.js diff --git a/backend/node_modules/ipaddr.js/lib/ipaddr.js b/node_modules/ipaddr.js/lib/ipaddr.js similarity index 100% rename from backend/node_modules/ipaddr.js/lib/ipaddr.js rename to node_modules/ipaddr.js/lib/ipaddr.js diff --git a/backend/node_modules/ipaddr.js/lib/ipaddr.js.d.ts b/node_modules/ipaddr.js/lib/ipaddr.js.d.ts similarity index 100% rename from backend/node_modules/ipaddr.js/lib/ipaddr.js.d.ts rename to node_modules/ipaddr.js/lib/ipaddr.js.d.ts diff --git a/backend/node_modules/ipaddr.js/package.json b/node_modules/ipaddr.js/package.json similarity index 100% rename from backend/node_modules/ipaddr.js/package.json rename to node_modules/ipaddr.js/package.json diff --git a/backend/node_modules/math-intrinsics/.eslintrc b/node_modules/math-intrinsics/.eslintrc similarity index 100% rename from backend/node_modules/math-intrinsics/.eslintrc rename to node_modules/math-intrinsics/.eslintrc diff --git a/backend/node_modules/math-intrinsics/.github/FUNDING.yml b/node_modules/math-intrinsics/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/math-intrinsics/.github/FUNDING.yml rename to node_modules/math-intrinsics/.github/FUNDING.yml diff --git a/backend/node_modules/math-intrinsics/CHANGELOG.md b/node_modules/math-intrinsics/CHANGELOG.md similarity index 100% rename from backend/node_modules/math-intrinsics/CHANGELOG.md rename to node_modules/math-intrinsics/CHANGELOG.md diff --git a/backend/node_modules/math-intrinsics/LICENSE b/node_modules/math-intrinsics/LICENSE similarity index 100% rename from backend/node_modules/math-intrinsics/LICENSE rename to node_modules/math-intrinsics/LICENSE diff --git a/backend/node_modules/math-intrinsics/README.md b/node_modules/math-intrinsics/README.md similarity index 100% rename from backend/node_modules/math-intrinsics/README.md rename to node_modules/math-intrinsics/README.md diff --git a/backend/node_modules/math-intrinsics/abs.d.ts b/node_modules/math-intrinsics/abs.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/abs.d.ts rename to node_modules/math-intrinsics/abs.d.ts diff --git a/backend/node_modules/math-intrinsics/abs.js b/node_modules/math-intrinsics/abs.js similarity index 100% rename from backend/node_modules/math-intrinsics/abs.js rename to node_modules/math-intrinsics/abs.js diff --git a/backend/node_modules/math-intrinsics/constants/maxArrayLength.d.ts b/node_modules/math-intrinsics/constants/maxArrayLength.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/constants/maxArrayLength.d.ts rename to node_modules/math-intrinsics/constants/maxArrayLength.d.ts diff --git a/backend/node_modules/math-intrinsics/constants/maxArrayLength.js b/node_modules/math-intrinsics/constants/maxArrayLength.js similarity index 100% rename from backend/node_modules/math-intrinsics/constants/maxArrayLength.js rename to node_modules/math-intrinsics/constants/maxArrayLength.js diff --git a/backend/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts b/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts rename to node_modules/math-intrinsics/constants/maxSafeInteger.d.ts diff --git a/backend/node_modules/math-intrinsics/constants/maxSafeInteger.js b/node_modules/math-intrinsics/constants/maxSafeInteger.js similarity index 100% rename from backend/node_modules/math-intrinsics/constants/maxSafeInteger.js rename to node_modules/math-intrinsics/constants/maxSafeInteger.js diff --git a/backend/node_modules/math-intrinsics/constants/maxValue.d.ts b/node_modules/math-intrinsics/constants/maxValue.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/constants/maxValue.d.ts rename to node_modules/math-intrinsics/constants/maxValue.d.ts diff --git a/backend/node_modules/math-intrinsics/constants/maxValue.js b/node_modules/math-intrinsics/constants/maxValue.js similarity index 100% rename from backend/node_modules/math-intrinsics/constants/maxValue.js rename to node_modules/math-intrinsics/constants/maxValue.js diff --git a/backend/node_modules/math-intrinsics/floor.d.ts b/node_modules/math-intrinsics/floor.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/floor.d.ts rename to node_modules/math-intrinsics/floor.d.ts diff --git a/backend/node_modules/math-intrinsics/floor.js b/node_modules/math-intrinsics/floor.js similarity index 100% rename from backend/node_modules/math-intrinsics/floor.js rename to node_modules/math-intrinsics/floor.js diff --git a/backend/node_modules/math-intrinsics/isFinite.d.ts b/node_modules/math-intrinsics/isFinite.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/isFinite.d.ts rename to node_modules/math-intrinsics/isFinite.d.ts diff --git a/backend/node_modules/math-intrinsics/isFinite.js b/node_modules/math-intrinsics/isFinite.js similarity index 100% rename from backend/node_modules/math-intrinsics/isFinite.js rename to node_modules/math-intrinsics/isFinite.js diff --git a/backend/node_modules/math-intrinsics/isInteger.d.ts b/node_modules/math-intrinsics/isInteger.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/isInteger.d.ts rename to node_modules/math-intrinsics/isInteger.d.ts diff --git a/backend/node_modules/math-intrinsics/isInteger.js b/node_modules/math-intrinsics/isInteger.js similarity index 100% rename from backend/node_modules/math-intrinsics/isInteger.js rename to node_modules/math-intrinsics/isInteger.js diff --git a/backend/node_modules/math-intrinsics/isNaN.d.ts b/node_modules/math-intrinsics/isNaN.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/isNaN.d.ts rename to node_modules/math-intrinsics/isNaN.d.ts diff --git a/backend/node_modules/math-intrinsics/isNaN.js b/node_modules/math-intrinsics/isNaN.js similarity index 100% rename from backend/node_modules/math-intrinsics/isNaN.js rename to node_modules/math-intrinsics/isNaN.js diff --git a/backend/node_modules/math-intrinsics/isNegativeZero.d.ts b/node_modules/math-intrinsics/isNegativeZero.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/isNegativeZero.d.ts rename to node_modules/math-intrinsics/isNegativeZero.d.ts diff --git a/backend/node_modules/math-intrinsics/isNegativeZero.js b/node_modules/math-intrinsics/isNegativeZero.js similarity index 100% rename from backend/node_modules/math-intrinsics/isNegativeZero.js rename to node_modules/math-intrinsics/isNegativeZero.js diff --git a/backend/node_modules/math-intrinsics/max.d.ts b/node_modules/math-intrinsics/max.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/max.d.ts rename to node_modules/math-intrinsics/max.d.ts diff --git a/backend/node_modules/math-intrinsics/max.js b/node_modules/math-intrinsics/max.js similarity index 100% rename from backend/node_modules/math-intrinsics/max.js rename to node_modules/math-intrinsics/max.js diff --git a/backend/node_modules/math-intrinsics/min.d.ts b/node_modules/math-intrinsics/min.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/min.d.ts rename to node_modules/math-intrinsics/min.d.ts diff --git a/backend/node_modules/math-intrinsics/min.js b/node_modules/math-intrinsics/min.js similarity index 100% rename from backend/node_modules/math-intrinsics/min.js rename to node_modules/math-intrinsics/min.js diff --git a/backend/node_modules/math-intrinsics/mod.d.ts b/node_modules/math-intrinsics/mod.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/mod.d.ts rename to node_modules/math-intrinsics/mod.d.ts diff --git a/backend/node_modules/math-intrinsics/mod.js b/node_modules/math-intrinsics/mod.js similarity index 100% rename from backend/node_modules/math-intrinsics/mod.js rename to node_modules/math-intrinsics/mod.js diff --git a/backend/node_modules/math-intrinsics/package.json b/node_modules/math-intrinsics/package.json similarity index 100% rename from backend/node_modules/math-intrinsics/package.json rename to node_modules/math-intrinsics/package.json diff --git a/backend/node_modules/math-intrinsics/pow.d.ts b/node_modules/math-intrinsics/pow.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/pow.d.ts rename to node_modules/math-intrinsics/pow.d.ts diff --git a/backend/node_modules/math-intrinsics/pow.js b/node_modules/math-intrinsics/pow.js similarity index 100% rename from backend/node_modules/math-intrinsics/pow.js rename to node_modules/math-intrinsics/pow.js diff --git a/backend/node_modules/math-intrinsics/round.d.ts b/node_modules/math-intrinsics/round.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/round.d.ts rename to node_modules/math-intrinsics/round.d.ts diff --git a/backend/node_modules/math-intrinsics/round.js b/node_modules/math-intrinsics/round.js similarity index 100% rename from backend/node_modules/math-intrinsics/round.js rename to node_modules/math-intrinsics/round.js diff --git a/backend/node_modules/math-intrinsics/sign.d.ts b/node_modules/math-intrinsics/sign.d.ts similarity index 100% rename from backend/node_modules/math-intrinsics/sign.d.ts rename to node_modules/math-intrinsics/sign.d.ts diff --git a/backend/node_modules/math-intrinsics/sign.js b/node_modules/math-intrinsics/sign.js similarity index 100% rename from backend/node_modules/math-intrinsics/sign.js rename to node_modules/math-intrinsics/sign.js diff --git a/backend/node_modules/math-intrinsics/test/index.js b/node_modules/math-intrinsics/test/index.js similarity index 100% rename from backend/node_modules/math-intrinsics/test/index.js rename to node_modules/math-intrinsics/test/index.js diff --git a/backend/node_modules/math-intrinsics/tsconfig.json b/node_modules/math-intrinsics/tsconfig.json similarity index 100% rename from backend/node_modules/math-intrinsics/tsconfig.json rename to node_modules/math-intrinsics/tsconfig.json diff --git a/backend/node_modules/media-typer/HISTORY.md b/node_modules/media-typer/HISTORY.md similarity index 100% rename from backend/node_modules/media-typer/HISTORY.md rename to node_modules/media-typer/HISTORY.md diff --git a/backend/node_modules/media-typer/LICENSE b/node_modules/media-typer/LICENSE similarity index 100% rename from backend/node_modules/media-typer/LICENSE rename to node_modules/media-typer/LICENSE diff --git a/backend/node_modules/media-typer/README.md b/node_modules/media-typer/README.md similarity index 100% rename from backend/node_modules/media-typer/README.md rename to node_modules/media-typer/README.md diff --git a/backend/node_modules/media-typer/index.js b/node_modules/media-typer/index.js similarity index 100% rename from backend/node_modules/media-typer/index.js rename to node_modules/media-typer/index.js diff --git a/backend/node_modules/media-typer/package.json b/node_modules/media-typer/package.json similarity index 100% rename from backend/node_modules/media-typer/package.json rename to node_modules/media-typer/package.json diff --git a/backend/node_modules/merge-descriptors/HISTORY.md b/node_modules/merge-descriptors/HISTORY.md similarity index 100% rename from backend/node_modules/merge-descriptors/HISTORY.md rename to node_modules/merge-descriptors/HISTORY.md diff --git a/backend/node_modules/merge-descriptors/LICENSE b/node_modules/merge-descriptors/LICENSE similarity index 100% rename from backend/node_modules/merge-descriptors/LICENSE rename to node_modules/merge-descriptors/LICENSE diff --git a/backend/node_modules/merge-descriptors/README.md b/node_modules/merge-descriptors/README.md similarity index 100% rename from backend/node_modules/merge-descriptors/README.md rename to node_modules/merge-descriptors/README.md diff --git a/backend/node_modules/merge-descriptors/index.js b/node_modules/merge-descriptors/index.js similarity index 100% rename from backend/node_modules/merge-descriptors/index.js rename to node_modules/merge-descriptors/index.js diff --git a/backend/node_modules/merge-descriptors/package.json b/node_modules/merge-descriptors/package.json similarity index 100% rename from backend/node_modules/merge-descriptors/package.json rename to node_modules/merge-descriptors/package.json diff --git a/backend/node_modules/methods/HISTORY.md b/node_modules/methods/HISTORY.md similarity index 100% rename from backend/node_modules/methods/HISTORY.md rename to node_modules/methods/HISTORY.md diff --git a/backend/node_modules/methods/LICENSE b/node_modules/methods/LICENSE similarity index 100% rename from backend/node_modules/methods/LICENSE rename to node_modules/methods/LICENSE diff --git a/backend/node_modules/methods/README.md b/node_modules/methods/README.md similarity index 100% rename from backend/node_modules/methods/README.md rename to node_modules/methods/README.md diff --git a/backend/node_modules/methods/index.js b/node_modules/methods/index.js similarity index 100% rename from backend/node_modules/methods/index.js rename to node_modules/methods/index.js diff --git a/backend/node_modules/methods/package.json b/node_modules/methods/package.json similarity index 100% rename from backend/node_modules/methods/package.json rename to node_modules/methods/package.json diff --git a/backend/node_modules/mime-db/HISTORY.md b/node_modules/mime-db/HISTORY.md similarity index 100% rename from backend/node_modules/mime-db/HISTORY.md rename to node_modules/mime-db/HISTORY.md diff --git a/backend/node_modules/mime-db/LICENSE b/node_modules/mime-db/LICENSE similarity index 100% rename from backend/node_modules/mime-db/LICENSE rename to node_modules/mime-db/LICENSE diff --git a/backend/node_modules/mime-db/README.md b/node_modules/mime-db/README.md similarity index 100% rename from backend/node_modules/mime-db/README.md rename to node_modules/mime-db/README.md diff --git a/backend/node_modules/mime-db/db.json b/node_modules/mime-db/db.json similarity index 100% rename from backend/node_modules/mime-db/db.json rename to node_modules/mime-db/db.json diff --git a/backend/node_modules/mime-db/index.js b/node_modules/mime-db/index.js similarity index 100% rename from backend/node_modules/mime-db/index.js rename to node_modules/mime-db/index.js diff --git a/backend/node_modules/mime-db/package.json b/node_modules/mime-db/package.json similarity index 100% rename from backend/node_modules/mime-db/package.json rename to node_modules/mime-db/package.json diff --git a/backend/node_modules/mime-types/HISTORY.md b/node_modules/mime-types/HISTORY.md similarity index 100% rename from backend/node_modules/mime-types/HISTORY.md rename to node_modules/mime-types/HISTORY.md diff --git a/backend/node_modules/mime-types/LICENSE b/node_modules/mime-types/LICENSE similarity index 100% rename from backend/node_modules/mime-types/LICENSE rename to node_modules/mime-types/LICENSE diff --git a/backend/node_modules/mime-types/README.md b/node_modules/mime-types/README.md similarity index 100% rename from backend/node_modules/mime-types/README.md rename to node_modules/mime-types/README.md diff --git a/backend/node_modules/mime-types/index.js b/node_modules/mime-types/index.js similarity index 100% rename from backend/node_modules/mime-types/index.js rename to node_modules/mime-types/index.js diff --git a/backend/node_modules/mime-types/package.json b/node_modules/mime-types/package.json similarity index 100% rename from backend/node_modules/mime-types/package.json rename to node_modules/mime-types/package.json diff --git a/backend/node_modules/mime/.npmignore b/node_modules/mime/.npmignore similarity index 100% rename from backend/node_modules/mime/.npmignore rename to node_modules/mime/.npmignore diff --git a/backend/node_modules/mime/CHANGELOG.md b/node_modules/mime/CHANGELOG.md similarity index 100% rename from backend/node_modules/mime/CHANGELOG.md rename to node_modules/mime/CHANGELOG.md diff --git a/backend/node_modules/mime/LICENSE b/node_modules/mime/LICENSE similarity index 100% rename from backend/node_modules/mime/LICENSE rename to node_modules/mime/LICENSE diff --git a/backend/node_modules/mime/README.md b/node_modules/mime/README.md similarity index 100% rename from backend/node_modules/mime/README.md rename to node_modules/mime/README.md diff --git a/backend/node_modules/mime/cli.js b/node_modules/mime/cli.js similarity index 100% rename from backend/node_modules/mime/cli.js rename to node_modules/mime/cli.js diff --git a/backend/node_modules/mime/mime.js b/node_modules/mime/mime.js similarity index 100% rename from backend/node_modules/mime/mime.js rename to node_modules/mime/mime.js diff --git a/backend/node_modules/mime/package.json b/node_modules/mime/package.json similarity index 100% rename from backend/node_modules/mime/package.json rename to node_modules/mime/package.json diff --git a/backend/node_modules/mime/src/build.js b/node_modules/mime/src/build.js similarity index 100% rename from backend/node_modules/mime/src/build.js rename to node_modules/mime/src/build.js diff --git a/backend/node_modules/mime/src/test.js b/node_modules/mime/src/test.js similarity index 100% rename from backend/node_modules/mime/src/test.js rename to node_modules/mime/src/test.js diff --git a/backend/node_modules/mime/types.json b/node_modules/mime/types.json similarity index 100% rename from backend/node_modules/mime/types.json rename to node_modules/mime/types.json diff --git a/backend/node_modules/ms/index.js b/node_modules/ms/index.js similarity index 100% rename from backend/node_modules/ms/index.js rename to node_modules/ms/index.js diff --git a/backend/node_modules/ms/license.md b/node_modules/ms/license.md similarity index 100% rename from backend/node_modules/ms/license.md rename to node_modules/ms/license.md diff --git a/backend/node_modules/ms/package.json b/node_modules/ms/package.json similarity index 100% rename from backend/node_modules/ms/package.json rename to node_modules/ms/package.json diff --git a/backend/node_modules/ms/readme.md b/node_modules/ms/readme.md similarity index 100% rename from backend/node_modules/ms/readme.md rename to node_modules/ms/readme.md diff --git a/backend/node_modules/negotiator/HISTORY.md b/node_modules/negotiator/HISTORY.md similarity index 100% rename from backend/node_modules/negotiator/HISTORY.md rename to node_modules/negotiator/HISTORY.md diff --git a/backend/node_modules/negotiator/LICENSE b/node_modules/negotiator/LICENSE similarity index 100% rename from backend/node_modules/negotiator/LICENSE rename to node_modules/negotiator/LICENSE diff --git a/backend/node_modules/negotiator/README.md b/node_modules/negotiator/README.md similarity index 100% rename from backend/node_modules/negotiator/README.md rename to node_modules/negotiator/README.md diff --git a/backend/node_modules/negotiator/index.js b/node_modules/negotiator/index.js similarity index 100% rename from backend/node_modules/negotiator/index.js rename to node_modules/negotiator/index.js diff --git a/backend/node_modules/negotiator/lib/charset.js b/node_modules/negotiator/lib/charset.js similarity index 100% rename from backend/node_modules/negotiator/lib/charset.js rename to node_modules/negotiator/lib/charset.js diff --git a/backend/node_modules/negotiator/lib/encoding.js b/node_modules/negotiator/lib/encoding.js similarity index 100% rename from backend/node_modules/negotiator/lib/encoding.js rename to node_modules/negotiator/lib/encoding.js diff --git a/backend/node_modules/negotiator/lib/language.js b/node_modules/negotiator/lib/language.js similarity index 100% rename from backend/node_modules/negotiator/lib/language.js rename to node_modules/negotiator/lib/language.js diff --git a/backend/node_modules/negotiator/lib/mediaType.js b/node_modules/negotiator/lib/mediaType.js similarity index 100% rename from backend/node_modules/negotiator/lib/mediaType.js rename to node_modules/negotiator/lib/mediaType.js diff --git a/backend/node_modules/negotiator/package.json b/node_modules/negotiator/package.json similarity index 100% rename from backend/node_modules/negotiator/package.json rename to node_modules/negotiator/package.json diff --git a/backend/node_modules/object-assign/index.js b/node_modules/object-assign/index.js similarity index 100% rename from backend/node_modules/object-assign/index.js rename to node_modules/object-assign/index.js diff --git a/backend/node_modules/object-assign/license b/node_modules/object-assign/license similarity index 100% rename from backend/node_modules/object-assign/license rename to node_modules/object-assign/license diff --git a/backend/node_modules/object-assign/package.json b/node_modules/object-assign/package.json similarity index 100% rename from backend/node_modules/object-assign/package.json rename to node_modules/object-assign/package.json diff --git a/backend/node_modules/object-assign/readme.md b/node_modules/object-assign/readme.md similarity index 100% rename from backend/node_modules/object-assign/readme.md rename to node_modules/object-assign/readme.md diff --git a/backend/node_modules/object-inspect/.eslintrc b/node_modules/object-inspect/.eslintrc similarity index 100% rename from backend/node_modules/object-inspect/.eslintrc rename to node_modules/object-inspect/.eslintrc diff --git a/backend/node_modules/object-inspect/.github/FUNDING.yml b/node_modules/object-inspect/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/object-inspect/.github/FUNDING.yml rename to node_modules/object-inspect/.github/FUNDING.yml diff --git a/backend/node_modules/object-inspect/.nycrc b/node_modules/object-inspect/.nycrc similarity index 100% rename from backend/node_modules/object-inspect/.nycrc rename to node_modules/object-inspect/.nycrc diff --git a/backend/node_modules/object-inspect/CHANGELOG.md b/node_modules/object-inspect/CHANGELOG.md similarity index 100% rename from backend/node_modules/object-inspect/CHANGELOG.md rename to node_modules/object-inspect/CHANGELOG.md diff --git a/backend/node_modules/object-inspect/LICENSE b/node_modules/object-inspect/LICENSE similarity index 100% rename from backend/node_modules/object-inspect/LICENSE rename to node_modules/object-inspect/LICENSE diff --git a/backend/node_modules/object-inspect/example/all.js b/node_modules/object-inspect/example/all.js similarity index 100% rename from backend/node_modules/object-inspect/example/all.js rename to node_modules/object-inspect/example/all.js diff --git a/backend/node_modules/object-inspect/example/circular.js b/node_modules/object-inspect/example/circular.js similarity index 100% rename from backend/node_modules/object-inspect/example/circular.js rename to node_modules/object-inspect/example/circular.js diff --git a/backend/node_modules/object-inspect/example/fn.js b/node_modules/object-inspect/example/fn.js similarity index 100% rename from backend/node_modules/object-inspect/example/fn.js rename to node_modules/object-inspect/example/fn.js diff --git a/backend/node_modules/object-inspect/example/inspect.js b/node_modules/object-inspect/example/inspect.js similarity index 100% rename from backend/node_modules/object-inspect/example/inspect.js rename to node_modules/object-inspect/example/inspect.js diff --git a/backend/node_modules/object-inspect/index.js b/node_modules/object-inspect/index.js similarity index 100% rename from backend/node_modules/object-inspect/index.js rename to node_modules/object-inspect/index.js diff --git a/backend/node_modules/object-inspect/package-support.json b/node_modules/object-inspect/package-support.json similarity index 100% rename from backend/node_modules/object-inspect/package-support.json rename to node_modules/object-inspect/package-support.json diff --git a/backend/node_modules/object-inspect/package.json b/node_modules/object-inspect/package.json similarity index 100% rename from backend/node_modules/object-inspect/package.json rename to node_modules/object-inspect/package.json diff --git a/backend/node_modules/object-inspect/readme.markdown b/node_modules/object-inspect/readme.markdown similarity index 100% rename from backend/node_modules/object-inspect/readme.markdown rename to node_modules/object-inspect/readme.markdown diff --git a/backend/node_modules/object-inspect/test-core-js.js b/node_modules/object-inspect/test-core-js.js similarity index 100% rename from backend/node_modules/object-inspect/test-core-js.js rename to node_modules/object-inspect/test-core-js.js diff --git a/backend/node_modules/object-inspect/test/bigint.js b/node_modules/object-inspect/test/bigint.js similarity index 100% rename from backend/node_modules/object-inspect/test/bigint.js rename to node_modules/object-inspect/test/bigint.js diff --git a/backend/node_modules/object-inspect/test/browser/dom.js b/node_modules/object-inspect/test/browser/dom.js similarity index 100% rename from backend/node_modules/object-inspect/test/browser/dom.js rename to node_modules/object-inspect/test/browser/dom.js diff --git a/backend/node_modules/object-inspect/test/circular.js b/node_modules/object-inspect/test/circular.js similarity index 100% rename from backend/node_modules/object-inspect/test/circular.js rename to node_modules/object-inspect/test/circular.js diff --git a/backend/node_modules/object-inspect/test/deep.js b/node_modules/object-inspect/test/deep.js similarity index 100% rename from backend/node_modules/object-inspect/test/deep.js rename to node_modules/object-inspect/test/deep.js diff --git a/backend/node_modules/object-inspect/test/element.js b/node_modules/object-inspect/test/element.js similarity index 100% rename from backend/node_modules/object-inspect/test/element.js rename to node_modules/object-inspect/test/element.js diff --git a/backend/node_modules/object-inspect/test/err.js b/node_modules/object-inspect/test/err.js similarity index 100% rename from backend/node_modules/object-inspect/test/err.js rename to node_modules/object-inspect/test/err.js diff --git a/backend/node_modules/object-inspect/test/fakes.js b/node_modules/object-inspect/test/fakes.js similarity index 100% rename from backend/node_modules/object-inspect/test/fakes.js rename to node_modules/object-inspect/test/fakes.js diff --git a/backend/node_modules/object-inspect/test/fn.js b/node_modules/object-inspect/test/fn.js similarity index 100% rename from backend/node_modules/object-inspect/test/fn.js rename to node_modules/object-inspect/test/fn.js diff --git a/backend/node_modules/object-inspect/test/global.js b/node_modules/object-inspect/test/global.js similarity index 100% rename from backend/node_modules/object-inspect/test/global.js rename to node_modules/object-inspect/test/global.js diff --git a/backend/node_modules/object-inspect/test/has.js b/node_modules/object-inspect/test/has.js similarity index 100% rename from backend/node_modules/object-inspect/test/has.js rename to node_modules/object-inspect/test/has.js diff --git a/backend/node_modules/object-inspect/test/holes.js b/node_modules/object-inspect/test/holes.js similarity index 100% rename from backend/node_modules/object-inspect/test/holes.js rename to node_modules/object-inspect/test/holes.js diff --git a/backend/node_modules/object-inspect/test/indent-option.js b/node_modules/object-inspect/test/indent-option.js similarity index 100% rename from backend/node_modules/object-inspect/test/indent-option.js rename to node_modules/object-inspect/test/indent-option.js diff --git a/backend/node_modules/object-inspect/test/inspect.js b/node_modules/object-inspect/test/inspect.js similarity index 100% rename from backend/node_modules/object-inspect/test/inspect.js rename to node_modules/object-inspect/test/inspect.js diff --git a/backend/node_modules/object-inspect/test/lowbyte.js b/node_modules/object-inspect/test/lowbyte.js similarity index 100% rename from backend/node_modules/object-inspect/test/lowbyte.js rename to node_modules/object-inspect/test/lowbyte.js diff --git a/backend/node_modules/object-inspect/test/number.js b/node_modules/object-inspect/test/number.js similarity index 100% rename from backend/node_modules/object-inspect/test/number.js rename to node_modules/object-inspect/test/number.js diff --git a/backend/node_modules/object-inspect/test/quoteStyle.js b/node_modules/object-inspect/test/quoteStyle.js similarity index 100% rename from backend/node_modules/object-inspect/test/quoteStyle.js rename to node_modules/object-inspect/test/quoteStyle.js diff --git a/backend/node_modules/object-inspect/test/toStringTag.js b/node_modules/object-inspect/test/toStringTag.js similarity index 100% rename from backend/node_modules/object-inspect/test/toStringTag.js rename to node_modules/object-inspect/test/toStringTag.js diff --git a/backend/node_modules/object-inspect/test/undef.js b/node_modules/object-inspect/test/undef.js similarity index 100% rename from backend/node_modules/object-inspect/test/undef.js rename to node_modules/object-inspect/test/undef.js diff --git a/backend/node_modules/object-inspect/test/values.js b/node_modules/object-inspect/test/values.js similarity index 100% rename from backend/node_modules/object-inspect/test/values.js rename to node_modules/object-inspect/test/values.js diff --git a/backend/node_modules/object-inspect/util.inspect.js b/node_modules/object-inspect/util.inspect.js similarity index 100% rename from backend/node_modules/object-inspect/util.inspect.js rename to node_modules/object-inspect/util.inspect.js diff --git a/backend/node_modules/on-finished/HISTORY.md b/node_modules/on-finished/HISTORY.md similarity index 100% rename from backend/node_modules/on-finished/HISTORY.md rename to node_modules/on-finished/HISTORY.md diff --git a/backend/node_modules/on-finished/LICENSE b/node_modules/on-finished/LICENSE similarity index 100% rename from backend/node_modules/on-finished/LICENSE rename to node_modules/on-finished/LICENSE diff --git a/backend/node_modules/on-finished/README.md b/node_modules/on-finished/README.md similarity index 100% rename from backend/node_modules/on-finished/README.md rename to node_modules/on-finished/README.md diff --git a/backend/node_modules/on-finished/index.js b/node_modules/on-finished/index.js similarity index 100% rename from backend/node_modules/on-finished/index.js rename to node_modules/on-finished/index.js diff --git a/backend/node_modules/on-finished/package.json b/node_modules/on-finished/package.json similarity index 100% rename from backend/node_modules/on-finished/package.json rename to node_modules/on-finished/package.json diff --git a/backend/node_modules/parseurl/HISTORY.md b/node_modules/parseurl/HISTORY.md similarity index 100% rename from backend/node_modules/parseurl/HISTORY.md rename to node_modules/parseurl/HISTORY.md diff --git a/backend/node_modules/parseurl/LICENSE b/node_modules/parseurl/LICENSE similarity index 100% rename from backend/node_modules/parseurl/LICENSE rename to node_modules/parseurl/LICENSE diff --git a/backend/node_modules/parseurl/README.md b/node_modules/parseurl/README.md similarity index 100% rename from backend/node_modules/parseurl/README.md rename to node_modules/parseurl/README.md diff --git a/backend/node_modules/parseurl/index.js b/node_modules/parseurl/index.js similarity index 100% rename from backend/node_modules/parseurl/index.js rename to node_modules/parseurl/index.js diff --git a/backend/node_modules/parseurl/package.json b/node_modules/parseurl/package.json similarity index 100% rename from backend/node_modules/parseurl/package.json rename to node_modules/parseurl/package.json diff --git a/backend/node_modules/path-to-regexp/LICENSE b/node_modules/path-to-regexp/LICENSE similarity index 100% rename from backend/node_modules/path-to-regexp/LICENSE rename to node_modules/path-to-regexp/LICENSE diff --git a/backend/node_modules/path-to-regexp/Readme.md b/node_modules/path-to-regexp/Readme.md similarity index 100% rename from backend/node_modules/path-to-regexp/Readme.md rename to node_modules/path-to-regexp/Readme.md diff --git a/backend/node_modules/path-to-regexp/index.js b/node_modules/path-to-regexp/index.js similarity index 100% rename from backend/node_modules/path-to-regexp/index.js rename to node_modules/path-to-regexp/index.js diff --git a/backend/node_modules/path-to-regexp/package.json b/node_modules/path-to-regexp/package.json similarity index 100% rename from backend/node_modules/path-to-regexp/package.json rename to node_modules/path-to-regexp/package.json diff --git a/backend/node_modules/proxy-addr/HISTORY.md b/node_modules/proxy-addr/HISTORY.md similarity index 100% rename from backend/node_modules/proxy-addr/HISTORY.md rename to node_modules/proxy-addr/HISTORY.md diff --git a/backend/node_modules/proxy-addr/LICENSE b/node_modules/proxy-addr/LICENSE similarity index 100% rename from backend/node_modules/proxy-addr/LICENSE rename to node_modules/proxy-addr/LICENSE diff --git a/backend/node_modules/proxy-addr/README.md b/node_modules/proxy-addr/README.md similarity index 100% rename from backend/node_modules/proxy-addr/README.md rename to node_modules/proxy-addr/README.md diff --git a/backend/node_modules/proxy-addr/index.js b/node_modules/proxy-addr/index.js similarity index 100% rename from backend/node_modules/proxy-addr/index.js rename to node_modules/proxy-addr/index.js diff --git a/backend/node_modules/proxy-addr/package.json b/node_modules/proxy-addr/package.json similarity index 100% rename from backend/node_modules/proxy-addr/package.json rename to node_modules/proxy-addr/package.json diff --git a/backend/node_modules/qs/.editorconfig b/node_modules/qs/.editorconfig similarity index 100% rename from backend/node_modules/qs/.editorconfig rename to node_modules/qs/.editorconfig diff --git a/backend/node_modules/qs/.eslintrc b/node_modules/qs/.eslintrc similarity index 100% rename from backend/node_modules/qs/.eslintrc rename to node_modules/qs/.eslintrc diff --git a/backend/node_modules/qs/.github/FUNDING.yml b/node_modules/qs/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/qs/.github/FUNDING.yml rename to node_modules/qs/.github/FUNDING.yml diff --git a/backend/node_modules/qs/.nycrc b/node_modules/qs/.nycrc similarity index 100% rename from backend/node_modules/qs/.nycrc rename to node_modules/qs/.nycrc diff --git a/backend/node_modules/qs/CHANGELOG.md b/node_modules/qs/CHANGELOG.md similarity index 100% rename from backend/node_modules/qs/CHANGELOG.md rename to node_modules/qs/CHANGELOG.md diff --git a/backend/node_modules/qs/LICENSE.md b/node_modules/qs/LICENSE.md similarity index 100% rename from backend/node_modules/qs/LICENSE.md rename to node_modules/qs/LICENSE.md diff --git a/backend/node_modules/qs/README.md b/node_modules/qs/README.md similarity index 100% rename from backend/node_modules/qs/README.md rename to node_modules/qs/README.md diff --git a/backend/node_modules/qs/dist/qs.js b/node_modules/qs/dist/qs.js similarity index 100% rename from backend/node_modules/qs/dist/qs.js rename to node_modules/qs/dist/qs.js diff --git a/backend/node_modules/qs/lib/formats.js b/node_modules/qs/lib/formats.js similarity index 100% rename from backend/node_modules/qs/lib/formats.js rename to node_modules/qs/lib/formats.js diff --git a/backend/node_modules/qs/lib/index.js b/node_modules/qs/lib/index.js similarity index 100% rename from backend/node_modules/qs/lib/index.js rename to node_modules/qs/lib/index.js diff --git a/backend/node_modules/qs/lib/parse.js b/node_modules/qs/lib/parse.js similarity index 100% rename from backend/node_modules/qs/lib/parse.js rename to node_modules/qs/lib/parse.js diff --git a/backend/node_modules/qs/lib/stringify.js b/node_modules/qs/lib/stringify.js similarity index 100% rename from backend/node_modules/qs/lib/stringify.js rename to node_modules/qs/lib/stringify.js diff --git a/backend/node_modules/qs/lib/utils.js b/node_modules/qs/lib/utils.js similarity index 100% rename from backend/node_modules/qs/lib/utils.js rename to node_modules/qs/lib/utils.js diff --git a/backend/node_modules/qs/package.json b/node_modules/qs/package.json similarity index 100% rename from backend/node_modules/qs/package.json rename to node_modules/qs/package.json diff --git a/backend/node_modules/qs/test/empty-keys-cases.js b/node_modules/qs/test/empty-keys-cases.js similarity index 100% rename from backend/node_modules/qs/test/empty-keys-cases.js rename to node_modules/qs/test/empty-keys-cases.js diff --git a/backend/node_modules/qs/test/parse.js b/node_modules/qs/test/parse.js similarity index 100% rename from backend/node_modules/qs/test/parse.js rename to node_modules/qs/test/parse.js diff --git a/backend/node_modules/qs/test/stringify.js b/node_modules/qs/test/stringify.js similarity index 100% rename from backend/node_modules/qs/test/stringify.js rename to node_modules/qs/test/stringify.js diff --git a/backend/node_modules/qs/test/utils.js b/node_modules/qs/test/utils.js similarity index 100% rename from backend/node_modules/qs/test/utils.js rename to node_modules/qs/test/utils.js diff --git a/backend/node_modules/range-parser/HISTORY.md b/node_modules/range-parser/HISTORY.md similarity index 100% rename from backend/node_modules/range-parser/HISTORY.md rename to node_modules/range-parser/HISTORY.md diff --git a/backend/node_modules/range-parser/LICENSE b/node_modules/range-parser/LICENSE similarity index 100% rename from backend/node_modules/range-parser/LICENSE rename to node_modules/range-parser/LICENSE diff --git a/backend/node_modules/range-parser/README.md b/node_modules/range-parser/README.md similarity index 100% rename from backend/node_modules/range-parser/README.md rename to node_modules/range-parser/README.md diff --git a/backend/node_modules/range-parser/index.js b/node_modules/range-parser/index.js similarity index 100% rename from backend/node_modules/range-parser/index.js rename to node_modules/range-parser/index.js diff --git a/backend/node_modules/range-parser/package.json b/node_modules/range-parser/package.json similarity index 100% rename from backend/node_modules/range-parser/package.json rename to node_modules/range-parser/package.json diff --git a/backend/node_modules/raw-body/HISTORY.md b/node_modules/raw-body/HISTORY.md similarity index 100% rename from backend/node_modules/raw-body/HISTORY.md rename to node_modules/raw-body/HISTORY.md diff --git a/backend/node_modules/raw-body/LICENSE b/node_modules/raw-body/LICENSE similarity index 100% rename from backend/node_modules/raw-body/LICENSE rename to node_modules/raw-body/LICENSE diff --git a/backend/node_modules/raw-body/README.md b/node_modules/raw-body/README.md similarity index 100% rename from backend/node_modules/raw-body/README.md rename to node_modules/raw-body/README.md diff --git a/backend/node_modules/raw-body/SECURITY.md b/node_modules/raw-body/SECURITY.md similarity index 100% rename from backend/node_modules/raw-body/SECURITY.md rename to node_modules/raw-body/SECURITY.md diff --git a/backend/node_modules/raw-body/index.d.ts b/node_modules/raw-body/index.d.ts similarity index 100% rename from backend/node_modules/raw-body/index.d.ts rename to node_modules/raw-body/index.d.ts diff --git a/backend/node_modules/raw-body/index.js b/node_modules/raw-body/index.js similarity index 100% rename from backend/node_modules/raw-body/index.js rename to node_modules/raw-body/index.js diff --git a/backend/node_modules/raw-body/package.json b/node_modules/raw-body/package.json similarity index 100% rename from backend/node_modules/raw-body/package.json rename to node_modules/raw-body/package.json diff --git a/backend/node_modules/safe-buffer/LICENSE b/node_modules/safe-buffer/LICENSE similarity index 100% rename from backend/node_modules/safe-buffer/LICENSE rename to node_modules/safe-buffer/LICENSE diff --git a/backend/node_modules/safe-buffer/README.md b/node_modules/safe-buffer/README.md similarity index 100% rename from backend/node_modules/safe-buffer/README.md rename to node_modules/safe-buffer/README.md diff --git a/backend/node_modules/safe-buffer/index.d.ts b/node_modules/safe-buffer/index.d.ts similarity index 100% rename from backend/node_modules/safe-buffer/index.d.ts rename to node_modules/safe-buffer/index.d.ts diff --git a/backend/node_modules/safe-buffer/index.js b/node_modules/safe-buffer/index.js similarity index 100% rename from backend/node_modules/safe-buffer/index.js rename to node_modules/safe-buffer/index.js diff --git a/backend/node_modules/safe-buffer/package.json b/node_modules/safe-buffer/package.json similarity index 100% rename from backend/node_modules/safe-buffer/package.json rename to node_modules/safe-buffer/package.json diff --git a/backend/node_modules/safer-buffer/LICENSE b/node_modules/safer-buffer/LICENSE similarity index 100% rename from backend/node_modules/safer-buffer/LICENSE rename to node_modules/safer-buffer/LICENSE diff --git a/backend/node_modules/safer-buffer/Porting-Buffer.md b/node_modules/safer-buffer/Porting-Buffer.md similarity index 100% rename from backend/node_modules/safer-buffer/Porting-Buffer.md rename to node_modules/safer-buffer/Porting-Buffer.md diff --git a/backend/node_modules/safer-buffer/Readme.md b/node_modules/safer-buffer/Readme.md similarity index 100% rename from backend/node_modules/safer-buffer/Readme.md rename to node_modules/safer-buffer/Readme.md diff --git a/backend/node_modules/safer-buffer/dangerous.js b/node_modules/safer-buffer/dangerous.js similarity index 100% rename from backend/node_modules/safer-buffer/dangerous.js rename to node_modules/safer-buffer/dangerous.js diff --git a/backend/node_modules/safer-buffer/package.json b/node_modules/safer-buffer/package.json similarity index 100% rename from backend/node_modules/safer-buffer/package.json rename to node_modules/safer-buffer/package.json diff --git a/backend/node_modules/safer-buffer/safer.js b/node_modules/safer-buffer/safer.js similarity index 100% rename from backend/node_modules/safer-buffer/safer.js rename to node_modules/safer-buffer/safer.js diff --git a/backend/node_modules/safer-buffer/tests.js b/node_modules/safer-buffer/tests.js similarity index 100% rename from backend/node_modules/safer-buffer/tests.js rename to node_modules/safer-buffer/tests.js diff --git a/backend/node_modules/send/HISTORY.md b/node_modules/send/HISTORY.md similarity index 100% rename from backend/node_modules/send/HISTORY.md rename to node_modules/send/HISTORY.md diff --git a/backend/node_modules/send/LICENSE b/node_modules/send/LICENSE similarity index 100% rename from backend/node_modules/send/LICENSE rename to node_modules/send/LICENSE diff --git a/backend/node_modules/send/README.md b/node_modules/send/README.md similarity index 100% rename from backend/node_modules/send/README.md rename to node_modules/send/README.md diff --git a/backend/node_modules/send/SECURITY.md b/node_modules/send/SECURITY.md similarity index 100% rename from backend/node_modules/send/SECURITY.md rename to node_modules/send/SECURITY.md diff --git a/backend/node_modules/send/index.js b/node_modules/send/index.js similarity index 100% rename from backend/node_modules/send/index.js rename to node_modules/send/index.js diff --git a/backend/node_modules/send/node_modules/encodeurl/HISTORY.md b/node_modules/send/node_modules/encodeurl/HISTORY.md similarity index 100% rename from backend/node_modules/send/node_modules/encodeurl/HISTORY.md rename to node_modules/send/node_modules/encodeurl/HISTORY.md diff --git a/backend/node_modules/send/node_modules/encodeurl/LICENSE b/node_modules/send/node_modules/encodeurl/LICENSE similarity index 100% rename from backend/node_modules/send/node_modules/encodeurl/LICENSE rename to node_modules/send/node_modules/encodeurl/LICENSE diff --git a/backend/node_modules/send/node_modules/encodeurl/README.md b/node_modules/send/node_modules/encodeurl/README.md similarity index 100% rename from backend/node_modules/send/node_modules/encodeurl/README.md rename to node_modules/send/node_modules/encodeurl/README.md diff --git a/backend/node_modules/send/node_modules/encodeurl/index.js b/node_modules/send/node_modules/encodeurl/index.js similarity index 100% rename from backend/node_modules/send/node_modules/encodeurl/index.js rename to node_modules/send/node_modules/encodeurl/index.js diff --git a/backend/node_modules/send/node_modules/encodeurl/package.json b/node_modules/send/node_modules/encodeurl/package.json similarity index 100% rename from backend/node_modules/send/node_modules/encodeurl/package.json rename to node_modules/send/node_modules/encodeurl/package.json diff --git a/backend/node_modules/send/node_modules/ms/index.js b/node_modules/send/node_modules/ms/index.js similarity index 100% rename from backend/node_modules/send/node_modules/ms/index.js rename to node_modules/send/node_modules/ms/index.js diff --git a/backend/node_modules/send/node_modules/ms/license.md b/node_modules/send/node_modules/ms/license.md similarity index 100% rename from backend/node_modules/send/node_modules/ms/license.md rename to node_modules/send/node_modules/ms/license.md diff --git a/backend/node_modules/send/node_modules/ms/package.json b/node_modules/send/node_modules/ms/package.json similarity index 100% rename from backend/node_modules/send/node_modules/ms/package.json rename to node_modules/send/node_modules/ms/package.json diff --git a/backend/node_modules/send/node_modules/ms/readme.md b/node_modules/send/node_modules/ms/readme.md similarity index 100% rename from backend/node_modules/send/node_modules/ms/readme.md rename to node_modules/send/node_modules/ms/readme.md diff --git a/backend/node_modules/send/package.json b/node_modules/send/package.json similarity index 100% rename from backend/node_modules/send/package.json rename to node_modules/send/package.json diff --git a/backend/node_modules/serve-static/HISTORY.md b/node_modules/serve-static/HISTORY.md similarity index 100% rename from backend/node_modules/serve-static/HISTORY.md rename to node_modules/serve-static/HISTORY.md diff --git a/backend/node_modules/serve-static/LICENSE b/node_modules/serve-static/LICENSE similarity index 100% rename from backend/node_modules/serve-static/LICENSE rename to node_modules/serve-static/LICENSE diff --git a/backend/node_modules/serve-static/README.md b/node_modules/serve-static/README.md similarity index 100% rename from backend/node_modules/serve-static/README.md rename to node_modules/serve-static/README.md diff --git a/backend/node_modules/serve-static/index.js b/node_modules/serve-static/index.js similarity index 100% rename from backend/node_modules/serve-static/index.js rename to node_modules/serve-static/index.js diff --git a/backend/node_modules/serve-static/package.json b/node_modules/serve-static/package.json similarity index 100% rename from backend/node_modules/serve-static/package.json rename to node_modules/serve-static/package.json diff --git a/backend/node_modules/setprototypeof/LICENSE b/node_modules/setprototypeof/LICENSE similarity index 100% rename from backend/node_modules/setprototypeof/LICENSE rename to node_modules/setprototypeof/LICENSE diff --git a/backend/node_modules/setprototypeof/README.md b/node_modules/setprototypeof/README.md similarity index 100% rename from backend/node_modules/setprototypeof/README.md rename to node_modules/setprototypeof/README.md diff --git a/backend/node_modules/setprototypeof/index.d.ts b/node_modules/setprototypeof/index.d.ts similarity index 100% rename from backend/node_modules/setprototypeof/index.d.ts rename to node_modules/setprototypeof/index.d.ts diff --git a/backend/node_modules/setprototypeof/index.js b/node_modules/setprototypeof/index.js similarity index 100% rename from backend/node_modules/setprototypeof/index.js rename to node_modules/setprototypeof/index.js diff --git a/backend/node_modules/setprototypeof/package.json b/node_modules/setprototypeof/package.json similarity index 100% rename from backend/node_modules/setprototypeof/package.json rename to node_modules/setprototypeof/package.json diff --git a/backend/node_modules/setprototypeof/test/index.js b/node_modules/setprototypeof/test/index.js similarity index 100% rename from backend/node_modules/setprototypeof/test/index.js rename to node_modules/setprototypeof/test/index.js diff --git a/backend/node_modules/side-channel-list/.editorconfig b/node_modules/side-channel-list/.editorconfig similarity index 100% rename from backend/node_modules/side-channel-list/.editorconfig rename to node_modules/side-channel-list/.editorconfig diff --git a/backend/node_modules/side-channel-list/.eslintrc b/node_modules/side-channel-list/.eslintrc similarity index 100% rename from backend/node_modules/side-channel-list/.eslintrc rename to node_modules/side-channel-list/.eslintrc diff --git a/backend/node_modules/side-channel-list/.github/FUNDING.yml b/node_modules/side-channel-list/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/side-channel-list/.github/FUNDING.yml rename to node_modules/side-channel-list/.github/FUNDING.yml diff --git a/backend/node_modules/side-channel-list/.nycrc b/node_modules/side-channel-list/.nycrc similarity index 100% rename from backend/node_modules/side-channel-list/.nycrc rename to node_modules/side-channel-list/.nycrc diff --git a/backend/node_modules/side-channel-list/CHANGELOG.md b/node_modules/side-channel-list/CHANGELOG.md similarity index 100% rename from backend/node_modules/side-channel-list/CHANGELOG.md rename to node_modules/side-channel-list/CHANGELOG.md diff --git a/backend/node_modules/side-channel-list/LICENSE b/node_modules/side-channel-list/LICENSE similarity index 100% rename from backend/node_modules/side-channel-list/LICENSE rename to node_modules/side-channel-list/LICENSE diff --git a/backend/node_modules/side-channel-list/README.md b/node_modules/side-channel-list/README.md similarity index 100% rename from backend/node_modules/side-channel-list/README.md rename to node_modules/side-channel-list/README.md diff --git a/backend/node_modules/side-channel-list/index.d.ts b/node_modules/side-channel-list/index.d.ts similarity index 100% rename from backend/node_modules/side-channel-list/index.d.ts rename to node_modules/side-channel-list/index.d.ts diff --git a/backend/node_modules/side-channel-list/index.js b/node_modules/side-channel-list/index.js similarity index 100% rename from backend/node_modules/side-channel-list/index.js rename to node_modules/side-channel-list/index.js diff --git a/backend/node_modules/side-channel-list/list.d.ts b/node_modules/side-channel-list/list.d.ts similarity index 100% rename from backend/node_modules/side-channel-list/list.d.ts rename to node_modules/side-channel-list/list.d.ts diff --git a/backend/node_modules/side-channel-list/package.json b/node_modules/side-channel-list/package.json similarity index 100% rename from backend/node_modules/side-channel-list/package.json rename to node_modules/side-channel-list/package.json diff --git a/backend/node_modules/side-channel-list/test/index.js b/node_modules/side-channel-list/test/index.js similarity index 100% rename from backend/node_modules/side-channel-list/test/index.js rename to node_modules/side-channel-list/test/index.js diff --git a/backend/node_modules/side-channel-list/tsconfig.json b/node_modules/side-channel-list/tsconfig.json similarity index 100% rename from backend/node_modules/side-channel-list/tsconfig.json rename to node_modules/side-channel-list/tsconfig.json diff --git a/backend/node_modules/side-channel-map/.editorconfig b/node_modules/side-channel-map/.editorconfig similarity index 100% rename from backend/node_modules/side-channel-map/.editorconfig rename to node_modules/side-channel-map/.editorconfig diff --git a/backend/node_modules/side-channel-map/.eslintrc b/node_modules/side-channel-map/.eslintrc similarity index 100% rename from backend/node_modules/side-channel-map/.eslintrc rename to node_modules/side-channel-map/.eslintrc diff --git a/backend/node_modules/side-channel-map/.github/FUNDING.yml b/node_modules/side-channel-map/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/side-channel-map/.github/FUNDING.yml rename to node_modules/side-channel-map/.github/FUNDING.yml diff --git a/backend/node_modules/side-channel-map/.nycrc b/node_modules/side-channel-map/.nycrc similarity index 100% rename from backend/node_modules/side-channel-map/.nycrc rename to node_modules/side-channel-map/.nycrc diff --git a/backend/node_modules/side-channel-map/CHANGELOG.md b/node_modules/side-channel-map/CHANGELOG.md similarity index 100% rename from backend/node_modules/side-channel-map/CHANGELOG.md rename to node_modules/side-channel-map/CHANGELOG.md diff --git a/backend/node_modules/side-channel-map/LICENSE b/node_modules/side-channel-map/LICENSE similarity index 100% rename from backend/node_modules/side-channel-map/LICENSE rename to node_modules/side-channel-map/LICENSE diff --git a/backend/node_modules/side-channel-map/README.md b/node_modules/side-channel-map/README.md similarity index 100% rename from backend/node_modules/side-channel-map/README.md rename to node_modules/side-channel-map/README.md diff --git a/backend/node_modules/side-channel-map/index.d.ts b/node_modules/side-channel-map/index.d.ts similarity index 100% rename from backend/node_modules/side-channel-map/index.d.ts rename to node_modules/side-channel-map/index.d.ts diff --git a/backend/node_modules/side-channel-map/index.js b/node_modules/side-channel-map/index.js similarity index 100% rename from backend/node_modules/side-channel-map/index.js rename to node_modules/side-channel-map/index.js diff --git a/backend/node_modules/side-channel-map/package.json b/node_modules/side-channel-map/package.json similarity index 100% rename from backend/node_modules/side-channel-map/package.json rename to node_modules/side-channel-map/package.json diff --git a/backend/node_modules/side-channel-map/test/index.js b/node_modules/side-channel-map/test/index.js similarity index 100% rename from backend/node_modules/side-channel-map/test/index.js rename to node_modules/side-channel-map/test/index.js diff --git a/backend/node_modules/side-channel-map/tsconfig.json b/node_modules/side-channel-map/tsconfig.json similarity index 100% rename from backend/node_modules/side-channel-map/tsconfig.json rename to node_modules/side-channel-map/tsconfig.json diff --git a/backend/node_modules/side-channel-weakmap/.editorconfig b/node_modules/side-channel-weakmap/.editorconfig similarity index 100% rename from backend/node_modules/side-channel-weakmap/.editorconfig rename to node_modules/side-channel-weakmap/.editorconfig diff --git a/backend/node_modules/side-channel-weakmap/.eslintrc b/node_modules/side-channel-weakmap/.eslintrc similarity index 100% rename from backend/node_modules/side-channel-weakmap/.eslintrc rename to node_modules/side-channel-weakmap/.eslintrc diff --git a/backend/node_modules/side-channel-weakmap/.github/FUNDING.yml b/node_modules/side-channel-weakmap/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/side-channel-weakmap/.github/FUNDING.yml rename to node_modules/side-channel-weakmap/.github/FUNDING.yml diff --git a/backend/node_modules/side-channel-weakmap/.nycrc b/node_modules/side-channel-weakmap/.nycrc similarity index 100% rename from backend/node_modules/side-channel-weakmap/.nycrc rename to node_modules/side-channel-weakmap/.nycrc diff --git a/backend/node_modules/side-channel-weakmap/CHANGELOG.md b/node_modules/side-channel-weakmap/CHANGELOG.md similarity index 100% rename from backend/node_modules/side-channel-weakmap/CHANGELOG.md rename to node_modules/side-channel-weakmap/CHANGELOG.md diff --git a/backend/node_modules/side-channel-weakmap/LICENSE b/node_modules/side-channel-weakmap/LICENSE similarity index 100% rename from backend/node_modules/side-channel-weakmap/LICENSE rename to node_modules/side-channel-weakmap/LICENSE diff --git a/backend/node_modules/side-channel-weakmap/README.md b/node_modules/side-channel-weakmap/README.md similarity index 100% rename from backend/node_modules/side-channel-weakmap/README.md rename to node_modules/side-channel-weakmap/README.md diff --git a/backend/node_modules/side-channel-weakmap/index.d.ts b/node_modules/side-channel-weakmap/index.d.ts similarity index 100% rename from backend/node_modules/side-channel-weakmap/index.d.ts rename to node_modules/side-channel-weakmap/index.d.ts diff --git a/backend/node_modules/side-channel-weakmap/index.js b/node_modules/side-channel-weakmap/index.js similarity index 100% rename from backend/node_modules/side-channel-weakmap/index.js rename to node_modules/side-channel-weakmap/index.js diff --git a/backend/node_modules/side-channel-weakmap/package.json b/node_modules/side-channel-weakmap/package.json similarity index 100% rename from backend/node_modules/side-channel-weakmap/package.json rename to node_modules/side-channel-weakmap/package.json diff --git a/backend/node_modules/side-channel-weakmap/test/index.js b/node_modules/side-channel-weakmap/test/index.js similarity index 100% rename from backend/node_modules/side-channel-weakmap/test/index.js rename to node_modules/side-channel-weakmap/test/index.js diff --git a/backend/node_modules/side-channel-weakmap/tsconfig.json b/node_modules/side-channel-weakmap/tsconfig.json similarity index 100% rename from backend/node_modules/side-channel-weakmap/tsconfig.json rename to node_modules/side-channel-weakmap/tsconfig.json diff --git a/backend/node_modules/side-channel/.editorconfig b/node_modules/side-channel/.editorconfig similarity index 100% rename from backend/node_modules/side-channel/.editorconfig rename to node_modules/side-channel/.editorconfig diff --git a/backend/node_modules/side-channel/.eslintrc b/node_modules/side-channel/.eslintrc similarity index 100% rename from backend/node_modules/side-channel/.eslintrc rename to node_modules/side-channel/.eslintrc diff --git a/backend/node_modules/side-channel/.github/FUNDING.yml b/node_modules/side-channel/.github/FUNDING.yml similarity index 100% rename from backend/node_modules/side-channel/.github/FUNDING.yml rename to node_modules/side-channel/.github/FUNDING.yml diff --git a/backend/node_modules/side-channel/.nycrc b/node_modules/side-channel/.nycrc similarity index 100% rename from backend/node_modules/side-channel/.nycrc rename to node_modules/side-channel/.nycrc diff --git a/backend/node_modules/side-channel/CHANGELOG.md b/node_modules/side-channel/CHANGELOG.md similarity index 100% rename from backend/node_modules/side-channel/CHANGELOG.md rename to node_modules/side-channel/CHANGELOG.md diff --git a/backend/node_modules/side-channel/LICENSE b/node_modules/side-channel/LICENSE similarity index 100% rename from backend/node_modules/side-channel/LICENSE rename to node_modules/side-channel/LICENSE diff --git a/backend/node_modules/side-channel/README.md b/node_modules/side-channel/README.md similarity index 100% rename from backend/node_modules/side-channel/README.md rename to node_modules/side-channel/README.md diff --git a/backend/node_modules/side-channel/index.d.ts b/node_modules/side-channel/index.d.ts similarity index 100% rename from backend/node_modules/side-channel/index.d.ts rename to node_modules/side-channel/index.d.ts diff --git a/backend/node_modules/side-channel/index.js b/node_modules/side-channel/index.js similarity index 100% rename from backend/node_modules/side-channel/index.js rename to node_modules/side-channel/index.js diff --git a/backend/node_modules/side-channel/package.json b/node_modules/side-channel/package.json similarity index 100% rename from backend/node_modules/side-channel/package.json rename to node_modules/side-channel/package.json diff --git a/backend/node_modules/side-channel/test/index.js b/node_modules/side-channel/test/index.js similarity index 100% rename from backend/node_modules/side-channel/test/index.js rename to node_modules/side-channel/test/index.js diff --git a/backend/node_modules/side-channel/tsconfig.json b/node_modules/side-channel/tsconfig.json similarity index 100% rename from backend/node_modules/side-channel/tsconfig.json rename to node_modules/side-channel/tsconfig.json diff --git a/backend/node_modules/socket.io-adapter/LICENSE b/node_modules/socket.io-adapter/LICENSE similarity index 100% rename from backend/node_modules/socket.io-adapter/LICENSE rename to node_modules/socket.io-adapter/LICENSE diff --git a/backend/node_modules/socket.io-adapter/Readme.md b/node_modules/socket.io-adapter/Readme.md similarity index 100% rename from backend/node_modules/socket.io-adapter/Readme.md rename to node_modules/socket.io-adapter/Readme.md diff --git a/backend/node_modules/socket.io-adapter/dist/cluster-adapter.d.ts b/node_modules/socket.io-adapter/dist/cluster-adapter.d.ts similarity index 100% rename from backend/node_modules/socket.io-adapter/dist/cluster-adapter.d.ts rename to node_modules/socket.io-adapter/dist/cluster-adapter.d.ts diff --git a/backend/node_modules/socket.io-adapter/dist/cluster-adapter.js b/node_modules/socket.io-adapter/dist/cluster-adapter.js similarity index 100% rename from backend/node_modules/socket.io-adapter/dist/cluster-adapter.js rename to node_modules/socket.io-adapter/dist/cluster-adapter.js diff --git a/backend/node_modules/socket.io-adapter/dist/contrib/yeast.d.ts b/node_modules/socket.io-adapter/dist/contrib/yeast.d.ts similarity index 100% rename from backend/node_modules/socket.io-adapter/dist/contrib/yeast.d.ts rename to node_modules/socket.io-adapter/dist/contrib/yeast.d.ts diff --git a/backend/node_modules/socket.io-adapter/dist/contrib/yeast.js b/node_modules/socket.io-adapter/dist/contrib/yeast.js similarity index 100% rename from backend/node_modules/socket.io-adapter/dist/contrib/yeast.js rename to node_modules/socket.io-adapter/dist/contrib/yeast.js diff --git a/backend/node_modules/socket.io-adapter/dist/in-memory-adapter.d.ts b/node_modules/socket.io-adapter/dist/in-memory-adapter.d.ts similarity index 100% rename from backend/node_modules/socket.io-adapter/dist/in-memory-adapter.d.ts rename to node_modules/socket.io-adapter/dist/in-memory-adapter.d.ts diff --git a/backend/node_modules/socket.io-adapter/dist/in-memory-adapter.js b/node_modules/socket.io-adapter/dist/in-memory-adapter.js similarity index 100% rename from backend/node_modules/socket.io-adapter/dist/in-memory-adapter.js rename to node_modules/socket.io-adapter/dist/in-memory-adapter.js diff --git a/backend/node_modules/socket.io-adapter/dist/index.d.ts b/node_modules/socket.io-adapter/dist/index.d.ts similarity index 100% rename from backend/node_modules/socket.io-adapter/dist/index.d.ts rename to node_modules/socket.io-adapter/dist/index.d.ts diff --git a/backend/node_modules/socket.io-adapter/dist/index.js b/node_modules/socket.io-adapter/dist/index.js similarity index 100% rename from backend/node_modules/socket.io-adapter/dist/index.js rename to node_modules/socket.io-adapter/dist/index.js diff --git a/backend/node_modules/socket.io-adapter/node_modules/debug/LICENSE b/node_modules/socket.io-adapter/node_modules/debug/LICENSE similarity index 100% rename from backend/node_modules/socket.io-adapter/node_modules/debug/LICENSE rename to node_modules/socket.io-adapter/node_modules/debug/LICENSE diff --git a/backend/node_modules/socket.io-adapter/node_modules/debug/README.md b/node_modules/socket.io-adapter/node_modules/debug/README.md similarity index 100% rename from backend/node_modules/socket.io-adapter/node_modules/debug/README.md rename to node_modules/socket.io-adapter/node_modules/debug/README.md diff --git a/backend/node_modules/socket.io-adapter/node_modules/debug/package.json b/node_modules/socket.io-adapter/node_modules/debug/package.json similarity index 100% rename from backend/node_modules/socket.io-adapter/node_modules/debug/package.json rename to node_modules/socket.io-adapter/node_modules/debug/package.json diff --git a/backend/node_modules/socket.io-adapter/node_modules/debug/src/browser.js b/node_modules/socket.io-adapter/node_modules/debug/src/browser.js similarity index 100% rename from backend/node_modules/socket.io-adapter/node_modules/debug/src/browser.js rename to node_modules/socket.io-adapter/node_modules/debug/src/browser.js diff --git a/backend/node_modules/socket.io-adapter/node_modules/debug/src/common.js b/node_modules/socket.io-adapter/node_modules/debug/src/common.js similarity index 100% rename from backend/node_modules/socket.io-adapter/node_modules/debug/src/common.js rename to node_modules/socket.io-adapter/node_modules/debug/src/common.js diff --git a/backend/node_modules/socket.io-adapter/node_modules/debug/src/index.js b/node_modules/socket.io-adapter/node_modules/debug/src/index.js similarity index 100% rename from backend/node_modules/socket.io-adapter/node_modules/debug/src/index.js rename to node_modules/socket.io-adapter/node_modules/debug/src/index.js diff --git a/backend/node_modules/socket.io-adapter/node_modules/debug/src/node.js b/node_modules/socket.io-adapter/node_modules/debug/src/node.js similarity index 100% rename from backend/node_modules/socket.io-adapter/node_modules/debug/src/node.js rename to node_modules/socket.io-adapter/node_modules/debug/src/node.js diff --git a/backend/node_modules/socket.io-adapter/node_modules/ms/index.js b/node_modules/socket.io-adapter/node_modules/ms/index.js similarity index 100% rename from backend/node_modules/socket.io-adapter/node_modules/ms/index.js rename to node_modules/socket.io-adapter/node_modules/ms/index.js diff --git a/backend/node_modules/socket.io-adapter/node_modules/ms/license.md b/node_modules/socket.io-adapter/node_modules/ms/license.md similarity index 100% rename from backend/node_modules/socket.io-adapter/node_modules/ms/license.md rename to node_modules/socket.io-adapter/node_modules/ms/license.md diff --git a/backend/node_modules/socket.io-adapter/node_modules/ms/package.json b/node_modules/socket.io-adapter/node_modules/ms/package.json similarity index 100% rename from backend/node_modules/socket.io-adapter/node_modules/ms/package.json rename to node_modules/socket.io-adapter/node_modules/ms/package.json diff --git a/backend/node_modules/socket.io-adapter/node_modules/ms/readme.md b/node_modules/socket.io-adapter/node_modules/ms/readme.md similarity index 100% rename from backend/node_modules/socket.io-adapter/node_modules/ms/readme.md rename to node_modules/socket.io-adapter/node_modules/ms/readme.md diff --git a/backend/node_modules/socket.io-adapter/package.json b/node_modules/socket.io-adapter/package.json similarity index 100% rename from backend/node_modules/socket.io-adapter/package.json rename to node_modules/socket.io-adapter/package.json diff --git a/backend/node_modules/socket.io-parser/LICENSE b/node_modules/socket.io-parser/LICENSE similarity index 100% rename from backend/node_modules/socket.io-parser/LICENSE rename to node_modules/socket.io-parser/LICENSE diff --git a/backend/node_modules/socket.io-parser/Readme.md b/node_modules/socket.io-parser/Readme.md similarity index 100% rename from backend/node_modules/socket.io-parser/Readme.md rename to node_modules/socket.io-parser/Readme.md diff --git a/backend/node_modules/socket.io-parser/build/cjs/binary.d.ts b/node_modules/socket.io-parser/build/cjs/binary.d.ts similarity index 100% rename from backend/node_modules/socket.io-parser/build/cjs/binary.d.ts rename to node_modules/socket.io-parser/build/cjs/binary.d.ts diff --git a/backend/node_modules/socket.io-parser/build/cjs/binary.js b/node_modules/socket.io-parser/build/cjs/binary.js similarity index 100% rename from backend/node_modules/socket.io-parser/build/cjs/binary.js rename to node_modules/socket.io-parser/build/cjs/binary.js diff --git a/backend/node_modules/socket.io-parser/build/cjs/index.d.ts b/node_modules/socket.io-parser/build/cjs/index.d.ts similarity index 100% rename from backend/node_modules/socket.io-parser/build/cjs/index.d.ts rename to node_modules/socket.io-parser/build/cjs/index.d.ts diff --git a/backend/node_modules/socket.io-parser/build/cjs/index.js b/node_modules/socket.io-parser/build/cjs/index.js similarity index 100% rename from backend/node_modules/socket.io-parser/build/cjs/index.js rename to node_modules/socket.io-parser/build/cjs/index.js diff --git a/backend/node_modules/socket.io-parser/build/cjs/is-binary.d.ts b/node_modules/socket.io-parser/build/cjs/is-binary.d.ts similarity index 100% rename from backend/node_modules/socket.io-parser/build/cjs/is-binary.d.ts rename to node_modules/socket.io-parser/build/cjs/is-binary.d.ts diff --git a/backend/node_modules/socket.io-parser/build/cjs/is-binary.js b/node_modules/socket.io-parser/build/cjs/is-binary.js similarity index 100% rename from backend/node_modules/socket.io-parser/build/cjs/is-binary.js rename to node_modules/socket.io-parser/build/cjs/is-binary.js diff --git a/backend/node_modules/socket.io-parser/build/cjs/package.json b/node_modules/socket.io-parser/build/cjs/package.json similarity index 100% rename from backend/node_modules/socket.io-parser/build/cjs/package.json rename to node_modules/socket.io-parser/build/cjs/package.json diff --git a/backend/node_modules/socket.io-parser/build/esm-debug/binary.d.ts b/node_modules/socket.io-parser/build/esm-debug/binary.d.ts similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm-debug/binary.d.ts rename to node_modules/socket.io-parser/build/esm-debug/binary.d.ts diff --git a/backend/node_modules/socket.io-parser/build/esm-debug/binary.js b/node_modules/socket.io-parser/build/esm-debug/binary.js similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm-debug/binary.js rename to node_modules/socket.io-parser/build/esm-debug/binary.js diff --git a/backend/node_modules/socket.io-parser/build/esm-debug/index.d.ts b/node_modules/socket.io-parser/build/esm-debug/index.d.ts similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm-debug/index.d.ts rename to node_modules/socket.io-parser/build/esm-debug/index.d.ts diff --git a/backend/node_modules/socket.io-parser/build/esm-debug/index.js b/node_modules/socket.io-parser/build/esm-debug/index.js similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm-debug/index.js rename to node_modules/socket.io-parser/build/esm-debug/index.js diff --git a/backend/node_modules/socket.io-parser/build/esm-debug/is-binary.d.ts b/node_modules/socket.io-parser/build/esm-debug/is-binary.d.ts similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm-debug/is-binary.d.ts rename to node_modules/socket.io-parser/build/esm-debug/is-binary.d.ts diff --git a/backend/node_modules/socket.io-parser/build/esm-debug/is-binary.js b/node_modules/socket.io-parser/build/esm-debug/is-binary.js similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm-debug/is-binary.js rename to node_modules/socket.io-parser/build/esm-debug/is-binary.js diff --git a/backend/node_modules/socket.io-parser/build/esm-debug/package.json b/node_modules/socket.io-parser/build/esm-debug/package.json similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm-debug/package.json rename to node_modules/socket.io-parser/build/esm-debug/package.json diff --git a/backend/node_modules/socket.io-parser/build/esm/binary.d.ts b/node_modules/socket.io-parser/build/esm/binary.d.ts similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm/binary.d.ts rename to node_modules/socket.io-parser/build/esm/binary.d.ts diff --git a/backend/node_modules/socket.io-parser/build/esm/binary.js b/node_modules/socket.io-parser/build/esm/binary.js similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm/binary.js rename to node_modules/socket.io-parser/build/esm/binary.js diff --git a/backend/node_modules/socket.io-parser/build/esm/index.d.ts b/node_modules/socket.io-parser/build/esm/index.d.ts similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm/index.d.ts rename to node_modules/socket.io-parser/build/esm/index.d.ts diff --git a/backend/node_modules/socket.io-parser/build/esm/index.js b/node_modules/socket.io-parser/build/esm/index.js similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm/index.js rename to node_modules/socket.io-parser/build/esm/index.js diff --git a/backend/node_modules/socket.io-parser/build/esm/is-binary.d.ts b/node_modules/socket.io-parser/build/esm/is-binary.d.ts similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm/is-binary.d.ts rename to node_modules/socket.io-parser/build/esm/is-binary.d.ts diff --git a/backend/node_modules/socket.io-parser/build/esm/is-binary.js b/node_modules/socket.io-parser/build/esm/is-binary.js similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm/is-binary.js rename to node_modules/socket.io-parser/build/esm/is-binary.js diff --git a/backend/node_modules/socket.io-parser/build/esm/package.json b/node_modules/socket.io-parser/build/esm/package.json similarity index 100% rename from backend/node_modules/socket.io-parser/build/esm/package.json rename to node_modules/socket.io-parser/build/esm/package.json diff --git a/backend/node_modules/socket.io-parser/node_modules/debug/LICENSE b/node_modules/socket.io-parser/node_modules/debug/LICENSE similarity index 100% rename from backend/node_modules/socket.io-parser/node_modules/debug/LICENSE rename to node_modules/socket.io-parser/node_modules/debug/LICENSE diff --git a/backend/node_modules/socket.io-parser/node_modules/debug/README.md b/node_modules/socket.io-parser/node_modules/debug/README.md similarity index 100% rename from backend/node_modules/socket.io-parser/node_modules/debug/README.md rename to node_modules/socket.io-parser/node_modules/debug/README.md diff --git a/backend/node_modules/socket.io-parser/node_modules/debug/package.json b/node_modules/socket.io-parser/node_modules/debug/package.json similarity index 100% rename from backend/node_modules/socket.io-parser/node_modules/debug/package.json rename to node_modules/socket.io-parser/node_modules/debug/package.json diff --git a/backend/node_modules/socket.io-parser/node_modules/debug/src/browser.js b/node_modules/socket.io-parser/node_modules/debug/src/browser.js similarity index 100% rename from backend/node_modules/socket.io-parser/node_modules/debug/src/browser.js rename to node_modules/socket.io-parser/node_modules/debug/src/browser.js diff --git a/backend/node_modules/socket.io-parser/node_modules/debug/src/common.js b/node_modules/socket.io-parser/node_modules/debug/src/common.js similarity index 100% rename from backend/node_modules/socket.io-parser/node_modules/debug/src/common.js rename to node_modules/socket.io-parser/node_modules/debug/src/common.js diff --git a/backend/node_modules/socket.io-parser/node_modules/debug/src/index.js b/node_modules/socket.io-parser/node_modules/debug/src/index.js similarity index 100% rename from backend/node_modules/socket.io-parser/node_modules/debug/src/index.js rename to node_modules/socket.io-parser/node_modules/debug/src/index.js diff --git a/backend/node_modules/socket.io-parser/node_modules/debug/src/node.js b/node_modules/socket.io-parser/node_modules/debug/src/node.js similarity index 100% rename from backend/node_modules/socket.io-parser/node_modules/debug/src/node.js rename to node_modules/socket.io-parser/node_modules/debug/src/node.js diff --git a/backend/node_modules/socket.io-parser/node_modules/ms/index.js b/node_modules/socket.io-parser/node_modules/ms/index.js similarity index 100% rename from backend/node_modules/socket.io-parser/node_modules/ms/index.js rename to node_modules/socket.io-parser/node_modules/ms/index.js diff --git a/backend/node_modules/socket.io-parser/node_modules/ms/license.md b/node_modules/socket.io-parser/node_modules/ms/license.md similarity index 100% rename from backend/node_modules/socket.io-parser/node_modules/ms/license.md rename to node_modules/socket.io-parser/node_modules/ms/license.md diff --git a/backend/node_modules/socket.io-parser/node_modules/ms/package.json b/node_modules/socket.io-parser/node_modules/ms/package.json similarity index 100% rename from backend/node_modules/socket.io-parser/node_modules/ms/package.json rename to node_modules/socket.io-parser/node_modules/ms/package.json diff --git a/backend/node_modules/socket.io-parser/node_modules/ms/readme.md b/node_modules/socket.io-parser/node_modules/ms/readme.md similarity index 100% rename from backend/node_modules/socket.io-parser/node_modules/ms/readme.md rename to node_modules/socket.io-parser/node_modules/ms/readme.md diff --git a/backend/node_modules/socket.io-parser/package.json b/node_modules/socket.io-parser/package.json similarity index 100% rename from backend/node_modules/socket.io-parser/package.json rename to node_modules/socket.io-parser/package.json diff --git a/backend/node_modules/socket.io/LICENSE b/node_modules/socket.io/LICENSE similarity index 100% rename from backend/node_modules/socket.io/LICENSE rename to node_modules/socket.io/LICENSE diff --git a/backend/node_modules/socket.io/Readme.md b/node_modules/socket.io/Readme.md similarity index 100% rename from backend/node_modules/socket.io/Readme.md rename to node_modules/socket.io/Readme.md diff --git a/backend/node_modules/socket.io/client-dist/socket.io.esm.min.js b/node_modules/socket.io/client-dist/socket.io.esm.min.js similarity index 100% rename from backend/node_modules/socket.io/client-dist/socket.io.esm.min.js rename to node_modules/socket.io/client-dist/socket.io.esm.min.js diff --git a/backend/node_modules/socket.io/client-dist/socket.io.esm.min.js.map b/node_modules/socket.io/client-dist/socket.io.esm.min.js.map similarity index 100% rename from backend/node_modules/socket.io/client-dist/socket.io.esm.min.js.map rename to node_modules/socket.io/client-dist/socket.io.esm.min.js.map diff --git a/backend/node_modules/socket.io/client-dist/socket.io.js b/node_modules/socket.io/client-dist/socket.io.js similarity index 100% rename from backend/node_modules/socket.io/client-dist/socket.io.js rename to node_modules/socket.io/client-dist/socket.io.js diff --git a/backend/node_modules/socket.io/client-dist/socket.io.js.map b/node_modules/socket.io/client-dist/socket.io.js.map similarity index 100% rename from backend/node_modules/socket.io/client-dist/socket.io.js.map rename to node_modules/socket.io/client-dist/socket.io.js.map diff --git a/backend/node_modules/socket.io/client-dist/socket.io.min.js b/node_modules/socket.io/client-dist/socket.io.min.js similarity index 100% rename from backend/node_modules/socket.io/client-dist/socket.io.min.js rename to node_modules/socket.io/client-dist/socket.io.min.js diff --git a/backend/node_modules/socket.io/client-dist/socket.io.min.js.map b/node_modules/socket.io/client-dist/socket.io.min.js.map similarity index 100% rename from backend/node_modules/socket.io/client-dist/socket.io.min.js.map rename to node_modules/socket.io/client-dist/socket.io.min.js.map diff --git a/backend/node_modules/socket.io/client-dist/socket.io.msgpack.min.js b/node_modules/socket.io/client-dist/socket.io.msgpack.min.js similarity index 100% rename from backend/node_modules/socket.io/client-dist/socket.io.msgpack.min.js rename to node_modules/socket.io/client-dist/socket.io.msgpack.min.js diff --git a/backend/node_modules/socket.io/client-dist/socket.io.msgpack.min.js.map b/node_modules/socket.io/client-dist/socket.io.msgpack.min.js.map similarity index 100% rename from backend/node_modules/socket.io/client-dist/socket.io.msgpack.min.js.map rename to node_modules/socket.io/client-dist/socket.io.msgpack.min.js.map diff --git a/backend/node_modules/socket.io/dist/broadcast-operator.d.ts b/node_modules/socket.io/dist/broadcast-operator.d.ts similarity index 100% rename from backend/node_modules/socket.io/dist/broadcast-operator.d.ts rename to node_modules/socket.io/dist/broadcast-operator.d.ts diff --git a/backend/node_modules/socket.io/dist/broadcast-operator.js b/node_modules/socket.io/dist/broadcast-operator.js similarity index 100% rename from backend/node_modules/socket.io/dist/broadcast-operator.js rename to node_modules/socket.io/dist/broadcast-operator.js diff --git a/backend/node_modules/socket.io/dist/client.d.ts b/node_modules/socket.io/dist/client.d.ts similarity index 100% rename from backend/node_modules/socket.io/dist/client.d.ts rename to node_modules/socket.io/dist/client.d.ts diff --git a/backend/node_modules/socket.io/dist/client.js b/node_modules/socket.io/dist/client.js similarity index 100% rename from backend/node_modules/socket.io/dist/client.js rename to node_modules/socket.io/dist/client.js diff --git a/backend/node_modules/socket.io/dist/index.d.ts b/node_modules/socket.io/dist/index.d.ts similarity index 100% rename from backend/node_modules/socket.io/dist/index.d.ts rename to node_modules/socket.io/dist/index.d.ts diff --git a/backend/node_modules/socket.io/dist/index.js b/node_modules/socket.io/dist/index.js similarity index 100% rename from backend/node_modules/socket.io/dist/index.js rename to node_modules/socket.io/dist/index.js diff --git a/backend/node_modules/socket.io/dist/namespace.d.ts b/node_modules/socket.io/dist/namespace.d.ts similarity index 100% rename from backend/node_modules/socket.io/dist/namespace.d.ts rename to node_modules/socket.io/dist/namespace.d.ts diff --git a/backend/node_modules/socket.io/dist/namespace.js b/node_modules/socket.io/dist/namespace.js similarity index 100% rename from backend/node_modules/socket.io/dist/namespace.js rename to node_modules/socket.io/dist/namespace.js diff --git a/backend/node_modules/socket.io/dist/parent-namespace.d.ts b/node_modules/socket.io/dist/parent-namespace.d.ts similarity index 100% rename from backend/node_modules/socket.io/dist/parent-namespace.d.ts rename to node_modules/socket.io/dist/parent-namespace.d.ts diff --git a/backend/node_modules/socket.io/dist/parent-namespace.js b/node_modules/socket.io/dist/parent-namespace.js similarity index 100% rename from backend/node_modules/socket.io/dist/parent-namespace.js rename to node_modules/socket.io/dist/parent-namespace.js diff --git a/backend/node_modules/socket.io/dist/socket-types.d.ts b/node_modules/socket.io/dist/socket-types.d.ts similarity index 100% rename from backend/node_modules/socket.io/dist/socket-types.d.ts rename to node_modules/socket.io/dist/socket-types.d.ts diff --git a/backend/node_modules/socket.io/dist/socket-types.js b/node_modules/socket.io/dist/socket-types.js similarity index 100% rename from backend/node_modules/socket.io/dist/socket-types.js rename to node_modules/socket.io/dist/socket-types.js diff --git a/backend/node_modules/socket.io/dist/socket.d.ts b/node_modules/socket.io/dist/socket.d.ts similarity index 100% rename from backend/node_modules/socket.io/dist/socket.d.ts rename to node_modules/socket.io/dist/socket.d.ts diff --git a/backend/node_modules/socket.io/dist/socket.js b/node_modules/socket.io/dist/socket.js similarity index 100% rename from backend/node_modules/socket.io/dist/socket.js rename to node_modules/socket.io/dist/socket.js diff --git a/backend/node_modules/socket.io/dist/typed-events.d.ts b/node_modules/socket.io/dist/typed-events.d.ts similarity index 100% rename from backend/node_modules/socket.io/dist/typed-events.d.ts rename to node_modules/socket.io/dist/typed-events.d.ts diff --git a/backend/node_modules/socket.io/dist/typed-events.js b/node_modules/socket.io/dist/typed-events.js similarity index 100% rename from backend/node_modules/socket.io/dist/typed-events.js rename to node_modules/socket.io/dist/typed-events.js diff --git a/backend/node_modules/socket.io/dist/uws.d.ts b/node_modules/socket.io/dist/uws.d.ts similarity index 100% rename from backend/node_modules/socket.io/dist/uws.d.ts rename to node_modules/socket.io/dist/uws.d.ts diff --git a/backend/node_modules/socket.io/dist/uws.js b/node_modules/socket.io/dist/uws.js similarity index 100% rename from backend/node_modules/socket.io/dist/uws.js rename to node_modules/socket.io/dist/uws.js diff --git a/backend/node_modules/socket.io/node_modules/debug/LICENSE b/node_modules/socket.io/node_modules/debug/LICENSE similarity index 100% rename from backend/node_modules/socket.io/node_modules/debug/LICENSE rename to node_modules/socket.io/node_modules/debug/LICENSE diff --git a/backend/node_modules/socket.io/node_modules/debug/README.md b/node_modules/socket.io/node_modules/debug/README.md similarity index 100% rename from backend/node_modules/socket.io/node_modules/debug/README.md rename to node_modules/socket.io/node_modules/debug/README.md diff --git a/backend/node_modules/socket.io/node_modules/debug/package.json b/node_modules/socket.io/node_modules/debug/package.json similarity index 100% rename from backend/node_modules/socket.io/node_modules/debug/package.json rename to node_modules/socket.io/node_modules/debug/package.json diff --git a/backend/node_modules/socket.io/node_modules/debug/src/browser.js b/node_modules/socket.io/node_modules/debug/src/browser.js similarity index 100% rename from backend/node_modules/socket.io/node_modules/debug/src/browser.js rename to node_modules/socket.io/node_modules/debug/src/browser.js diff --git a/backend/node_modules/socket.io/node_modules/debug/src/common.js b/node_modules/socket.io/node_modules/debug/src/common.js similarity index 100% rename from backend/node_modules/socket.io/node_modules/debug/src/common.js rename to node_modules/socket.io/node_modules/debug/src/common.js diff --git a/backend/node_modules/socket.io/node_modules/debug/src/index.js b/node_modules/socket.io/node_modules/debug/src/index.js similarity index 100% rename from backend/node_modules/socket.io/node_modules/debug/src/index.js rename to node_modules/socket.io/node_modules/debug/src/index.js diff --git a/backend/node_modules/socket.io/node_modules/debug/src/node.js b/node_modules/socket.io/node_modules/debug/src/node.js similarity index 100% rename from backend/node_modules/socket.io/node_modules/debug/src/node.js rename to node_modules/socket.io/node_modules/debug/src/node.js diff --git a/backend/node_modules/socket.io/node_modules/ms/index.js b/node_modules/socket.io/node_modules/ms/index.js similarity index 100% rename from backend/node_modules/socket.io/node_modules/ms/index.js rename to node_modules/socket.io/node_modules/ms/index.js diff --git a/backend/node_modules/socket.io/node_modules/ms/license.md b/node_modules/socket.io/node_modules/ms/license.md similarity index 100% rename from backend/node_modules/socket.io/node_modules/ms/license.md rename to node_modules/socket.io/node_modules/ms/license.md diff --git a/backend/node_modules/socket.io/node_modules/ms/package.json b/node_modules/socket.io/node_modules/ms/package.json similarity index 100% rename from backend/node_modules/socket.io/node_modules/ms/package.json rename to node_modules/socket.io/node_modules/ms/package.json diff --git a/backend/node_modules/socket.io/node_modules/ms/readme.md b/node_modules/socket.io/node_modules/ms/readme.md similarity index 100% rename from backend/node_modules/socket.io/node_modules/ms/readme.md rename to node_modules/socket.io/node_modules/ms/readme.md diff --git a/backend/node_modules/socket.io/package.json b/node_modules/socket.io/package.json similarity index 100% rename from backend/node_modules/socket.io/package.json rename to node_modules/socket.io/package.json diff --git a/backend/node_modules/socket.io/wrapper.mjs b/node_modules/socket.io/wrapper.mjs similarity index 100% rename from backend/node_modules/socket.io/wrapper.mjs rename to node_modules/socket.io/wrapper.mjs diff --git a/backend/node_modules/statuses/HISTORY.md b/node_modules/statuses/HISTORY.md similarity index 100% rename from backend/node_modules/statuses/HISTORY.md rename to node_modules/statuses/HISTORY.md diff --git a/backend/node_modules/statuses/LICENSE b/node_modules/statuses/LICENSE similarity index 100% rename from backend/node_modules/statuses/LICENSE rename to node_modules/statuses/LICENSE diff --git a/backend/node_modules/statuses/README.md b/node_modules/statuses/README.md similarity index 100% rename from backend/node_modules/statuses/README.md rename to node_modules/statuses/README.md diff --git a/backend/node_modules/statuses/codes.json b/node_modules/statuses/codes.json similarity index 100% rename from backend/node_modules/statuses/codes.json rename to node_modules/statuses/codes.json diff --git a/backend/node_modules/statuses/index.js b/node_modules/statuses/index.js similarity index 100% rename from backend/node_modules/statuses/index.js rename to node_modules/statuses/index.js diff --git a/backend/node_modules/statuses/package.json b/node_modules/statuses/package.json similarity index 100% rename from backend/node_modules/statuses/package.json rename to node_modules/statuses/package.json diff --git a/backend/node_modules/toidentifier/HISTORY.md b/node_modules/toidentifier/HISTORY.md similarity index 100% rename from backend/node_modules/toidentifier/HISTORY.md rename to node_modules/toidentifier/HISTORY.md diff --git a/backend/node_modules/toidentifier/LICENSE b/node_modules/toidentifier/LICENSE similarity index 100% rename from backend/node_modules/toidentifier/LICENSE rename to node_modules/toidentifier/LICENSE diff --git a/backend/node_modules/toidentifier/README.md b/node_modules/toidentifier/README.md similarity index 100% rename from backend/node_modules/toidentifier/README.md rename to node_modules/toidentifier/README.md diff --git a/backend/node_modules/toidentifier/index.js b/node_modules/toidentifier/index.js similarity index 100% rename from backend/node_modules/toidentifier/index.js rename to node_modules/toidentifier/index.js diff --git a/backend/node_modules/toidentifier/package.json b/node_modules/toidentifier/package.json similarity index 100% rename from backend/node_modules/toidentifier/package.json rename to node_modules/toidentifier/package.json diff --git a/backend/node_modules/type-is/HISTORY.md b/node_modules/type-is/HISTORY.md similarity index 100% rename from backend/node_modules/type-is/HISTORY.md rename to node_modules/type-is/HISTORY.md diff --git a/backend/node_modules/type-is/LICENSE b/node_modules/type-is/LICENSE similarity index 100% rename from backend/node_modules/type-is/LICENSE rename to node_modules/type-is/LICENSE diff --git a/backend/node_modules/type-is/README.md b/node_modules/type-is/README.md similarity index 100% rename from backend/node_modules/type-is/README.md rename to node_modules/type-is/README.md diff --git a/backend/node_modules/type-is/index.js b/node_modules/type-is/index.js similarity index 100% rename from backend/node_modules/type-is/index.js rename to node_modules/type-is/index.js diff --git a/backend/node_modules/type-is/package.json b/node_modules/type-is/package.json similarity index 100% rename from backend/node_modules/type-is/package.json rename to node_modules/type-is/package.json diff --git a/backend/node_modules/undici-types/LICENSE b/node_modules/undici-types/LICENSE similarity index 100% rename from backend/node_modules/undici-types/LICENSE rename to node_modules/undici-types/LICENSE diff --git a/backend/node_modules/undici-types/README.md b/node_modules/undici-types/README.md similarity index 100% rename from backend/node_modules/undici-types/README.md rename to node_modules/undici-types/README.md diff --git a/backend/node_modules/undici-types/agent.d.ts b/node_modules/undici-types/agent.d.ts similarity index 97% rename from backend/node_modules/undici-types/agent.d.ts rename to node_modules/undici-types/agent.d.ts index 8c88148..4bb3512 100644 --- a/backend/node_modules/undici-types/agent.d.ts +++ b/node_modules/undici-types/agent.d.ts @@ -24,6 +24,7 @@ declare namespace Agent { factory?(origin: string | URL, opts: Object): Dispatcher; interceptors?: { Agent?: readonly Dispatcher.DispatchInterceptor[] } & Pool.Options['interceptors'] + maxOrigins?: number } export interface DispatchOptions extends Dispatcher.DispatchOptions { diff --git a/backend/node_modules/undici-types/api.d.ts b/node_modules/undici-types/api.d.ts similarity index 100% rename from backend/node_modules/undici-types/api.d.ts rename to node_modules/undici-types/api.d.ts diff --git a/backend/node_modules/undici-types/balanced-pool.d.ts b/node_modules/undici-types/balanced-pool.d.ts similarity index 100% rename from backend/node_modules/undici-types/balanced-pool.d.ts rename to node_modules/undici-types/balanced-pool.d.ts diff --git a/backend/node_modules/undici-types/cache-interceptor.d.ts b/node_modules/undici-types/cache-interceptor.d.ts similarity index 100% rename from backend/node_modules/undici-types/cache-interceptor.d.ts rename to node_modules/undici-types/cache-interceptor.d.ts diff --git a/backend/node_modules/undici-types/cache.d.ts b/node_modules/undici-types/cache.d.ts similarity index 100% rename from backend/node_modules/undici-types/cache.d.ts rename to node_modules/undici-types/cache.d.ts diff --git a/backend/node_modules/undici-types/client-stats.d.ts b/node_modules/undici-types/client-stats.d.ts similarity index 100% rename from backend/node_modules/undici-types/client-stats.d.ts rename to node_modules/undici-types/client-stats.d.ts diff --git a/backend/node_modules/undici-types/client.d.ts b/node_modules/undici-types/client.d.ts similarity index 100% rename from backend/node_modules/undici-types/client.d.ts rename to node_modules/undici-types/client.d.ts diff --git a/backend/node_modules/undici-types/connector.d.ts b/node_modules/undici-types/connector.d.ts similarity index 100% rename from backend/node_modules/undici-types/connector.d.ts rename to node_modules/undici-types/connector.d.ts diff --git a/backend/node_modules/undici-types/content-type.d.ts b/node_modules/undici-types/content-type.d.ts similarity index 100% rename from backend/node_modules/undici-types/content-type.d.ts rename to node_modules/undici-types/content-type.d.ts diff --git a/backend/node_modules/undici-types/cookies.d.ts b/node_modules/undici-types/cookies.d.ts similarity index 100% rename from backend/node_modules/undici-types/cookies.d.ts rename to node_modules/undici-types/cookies.d.ts diff --git a/backend/node_modules/undici-types/diagnostics-channel.d.ts b/node_modules/undici-types/diagnostics-channel.d.ts similarity index 98% rename from backend/node_modules/undici-types/diagnostics-channel.d.ts rename to node_modules/undici-types/diagnostics-channel.d.ts index eb3d50d..4925c87 100644 --- a/backend/node_modules/undici-types/diagnostics-channel.d.ts +++ b/node_modules/undici-types/diagnostics-channel.d.ts @@ -16,7 +16,6 @@ declare namespace DiagnosticsChannel { statusText: string; headers: Array; } - type Error = unknown interface ConnectParams { host: URL['host']; hostname: URL['hostname']; diff --git a/backend/node_modules/undici-types/dispatcher.d.ts b/node_modules/undici-types/dispatcher.d.ts similarity index 100% rename from backend/node_modules/undici-types/dispatcher.d.ts rename to node_modules/undici-types/dispatcher.d.ts diff --git a/backend/node_modules/undici-types/env-http-proxy-agent.d.ts b/node_modules/undici-types/env-http-proxy-agent.d.ts similarity index 100% rename from backend/node_modules/undici-types/env-http-proxy-agent.d.ts rename to node_modules/undici-types/env-http-proxy-agent.d.ts diff --git a/backend/node_modules/undici-types/errors.d.ts b/node_modules/undici-types/errors.d.ts similarity index 90% rename from backend/node_modules/undici-types/errors.d.ts rename to node_modules/undici-types/errors.d.ts index 387420d..fbf3195 100644 --- a/backend/node_modules/undici-types/errors.d.ts +++ b/node_modules/undici-types/errors.d.ts @@ -49,21 +49,6 @@ declare namespace Errors { headers: IncomingHttpHeaders | string[] | null } - export class ResponseStatusCodeError extends UndiciError { - constructor ( - message?: string, - statusCode?: number, - headers?: IncomingHttpHeaders | string[] | null, - body?: null | Record | string - ) - name: 'ResponseStatusCodeError' - code: 'UND_ERR_RESPONSE_STATUS_CODE' - body: null | Record | string - status: number - statusCode: number - headers: IncomingHttpHeaders | string[] | null - } - /** Passed an invalid argument. */ export class InvalidArgumentError extends UndiciError { name: 'InvalidArgumentError' @@ -168,4 +153,9 @@ declare namespace Errors { name: 'SecureProxyConnectionError' code: 'UND_ERR_PRX_TLS' } + + class MaxOriginsReachedError extends UndiciError { + name: 'MaxOriginsReachedError' + code: 'UND_ERR_MAX_ORIGINS_REACHED' + } } diff --git a/backend/node_modules/undici-types/eventsource.d.ts b/node_modules/undici-types/eventsource.d.ts similarity index 100% rename from backend/node_modules/undici-types/eventsource.d.ts rename to node_modules/undici-types/eventsource.d.ts diff --git a/backend/node_modules/undici-types/fetch.d.ts b/node_modules/undici-types/fetch.d.ts similarity index 100% rename from backend/node_modules/undici-types/fetch.d.ts rename to node_modules/undici-types/fetch.d.ts diff --git a/backend/node_modules/undici-types/formdata.d.ts b/node_modules/undici-types/formdata.d.ts similarity index 100% rename from backend/node_modules/undici-types/formdata.d.ts rename to node_modules/undici-types/formdata.d.ts diff --git a/backend/node_modules/undici-types/global-dispatcher.d.ts b/node_modules/undici-types/global-dispatcher.d.ts similarity index 100% rename from backend/node_modules/undici-types/global-dispatcher.d.ts rename to node_modules/undici-types/global-dispatcher.d.ts diff --git a/backend/node_modules/undici-types/global-origin.d.ts b/node_modules/undici-types/global-origin.d.ts similarity index 100% rename from backend/node_modules/undici-types/global-origin.d.ts rename to node_modules/undici-types/global-origin.d.ts diff --git a/backend/node_modules/undici-types/h2c-client.d.ts b/node_modules/undici-types/h2c-client.d.ts similarity index 100% rename from backend/node_modules/undici-types/h2c-client.d.ts rename to node_modules/undici-types/h2c-client.d.ts diff --git a/backend/node_modules/undici-types/handlers.d.ts b/node_modules/undici-types/handlers.d.ts similarity index 100% rename from backend/node_modules/undici-types/handlers.d.ts rename to node_modules/undici-types/handlers.d.ts diff --git a/backend/node_modules/undici-types/header.d.ts b/node_modules/undici-types/header.d.ts similarity index 100% rename from backend/node_modules/undici-types/header.d.ts rename to node_modules/undici-types/header.d.ts diff --git a/backend/node_modules/undici-types/index.d.ts b/node_modules/undici-types/index.d.ts similarity index 100% rename from backend/node_modules/undici-types/index.d.ts rename to node_modules/undici-types/index.d.ts diff --git a/backend/node_modules/undici-types/interceptors.d.ts b/node_modules/undici-types/interceptors.d.ts similarity index 89% rename from backend/node_modules/undici-types/interceptors.d.ts rename to node_modules/undici-types/interceptors.d.ts index 5a6fcb2..74389db 100644 --- a/backend/node_modules/undici-types/interceptors.d.ts +++ b/node_modules/undici-types/interceptors.d.ts @@ -9,6 +9,10 @@ declare namespace Interceptors { export type DumpInterceptorOpts = { maxSize?: number } export type RetryInterceptorOpts = RetryHandler.RetryOptions export type RedirectInterceptorOpts = { maxRedirections?: number } + export type DecompressInterceptorOpts = { + skipErrorResponses?: boolean + skipStatusCodes?: number[] + } export type ResponseErrorInterceptorOpts = { throwOnError: boolean } export type CacheInterceptorOpts = CacheHandler.CacheOptions @@ -28,6 +32,7 @@ declare namespace Interceptors { export function dump (opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor export function retry (opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor export function redirect (opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor + export function decompress (opts?: DecompressInterceptorOpts): Dispatcher.DispatcherComposeInterceptor export function responseError (opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor export function dns (opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor export function cache (opts?: CacheInterceptorOpts): Dispatcher.DispatcherComposeInterceptor diff --git a/backend/node_modules/undici-types/mock-agent.d.ts b/node_modules/undici-types/mock-agent.d.ts similarity index 100% rename from backend/node_modules/undici-types/mock-agent.d.ts rename to node_modules/undici-types/mock-agent.d.ts diff --git a/backend/node_modules/undici-types/mock-call-history.d.ts b/node_modules/undici-types/mock-call-history.d.ts similarity index 100% rename from backend/node_modules/undici-types/mock-call-history.d.ts rename to node_modules/undici-types/mock-call-history.d.ts diff --git a/backend/node_modules/undici-types/mock-client.d.ts b/node_modules/undici-types/mock-client.d.ts similarity index 100% rename from backend/node_modules/undici-types/mock-client.d.ts rename to node_modules/undici-types/mock-client.d.ts diff --git a/backend/node_modules/undici-types/mock-errors.d.ts b/node_modules/undici-types/mock-errors.d.ts similarity index 100% rename from backend/node_modules/undici-types/mock-errors.d.ts rename to node_modules/undici-types/mock-errors.d.ts diff --git a/backend/node_modules/undici-types/mock-interceptor.d.ts b/node_modules/undici-types/mock-interceptor.d.ts similarity index 100% rename from backend/node_modules/undici-types/mock-interceptor.d.ts rename to node_modules/undici-types/mock-interceptor.d.ts diff --git a/backend/node_modules/undici-types/mock-pool.d.ts b/node_modules/undici-types/mock-pool.d.ts similarity index 100% rename from backend/node_modules/undici-types/mock-pool.d.ts rename to node_modules/undici-types/mock-pool.d.ts diff --git a/backend/node_modules/undici-types/package.json b/node_modules/undici-types/package.json similarity index 98% rename from backend/node_modules/undici-types/package.json rename to node_modules/undici-types/package.json index 0a942d4..a5e7d9d 100644 --- a/backend/node_modules/undici-types/package.json +++ b/node_modules/undici-types/package.json @@ -1,6 +1,6 @@ { "name": "undici-types", - "version": "7.14.0", + "version": "7.16.0", "description": "A stand-alone types package for Undici", "homepage": "https://undici.nodejs.org", "bugs": { diff --git a/backend/node_modules/undici-types/patch.d.ts b/node_modules/undici-types/patch.d.ts similarity index 100% rename from backend/node_modules/undici-types/patch.d.ts rename to node_modules/undici-types/patch.d.ts diff --git a/backend/node_modules/undici-types/pool-stats.d.ts b/node_modules/undici-types/pool-stats.d.ts similarity index 100% rename from backend/node_modules/undici-types/pool-stats.d.ts rename to node_modules/undici-types/pool-stats.d.ts diff --git a/backend/node_modules/undici-types/pool.d.ts b/node_modules/undici-types/pool.d.ts similarity index 100% rename from backend/node_modules/undici-types/pool.d.ts rename to node_modules/undici-types/pool.d.ts diff --git a/backend/node_modules/undici-types/proxy-agent.d.ts b/node_modules/undici-types/proxy-agent.d.ts similarity index 100% rename from backend/node_modules/undici-types/proxy-agent.d.ts rename to node_modules/undici-types/proxy-agent.d.ts diff --git a/backend/node_modules/undici-types/readable.d.ts b/node_modules/undici-types/readable.d.ts similarity index 100% rename from backend/node_modules/undici-types/readable.d.ts rename to node_modules/undici-types/readable.d.ts diff --git a/backend/node_modules/undici-types/retry-agent.d.ts b/node_modules/undici-types/retry-agent.d.ts similarity index 100% rename from backend/node_modules/undici-types/retry-agent.d.ts rename to node_modules/undici-types/retry-agent.d.ts diff --git a/backend/node_modules/undici-types/retry-handler.d.ts b/node_modules/undici-types/retry-handler.d.ts similarity index 100% rename from backend/node_modules/undici-types/retry-handler.d.ts rename to node_modules/undici-types/retry-handler.d.ts diff --git a/backend/node_modules/undici-types/snapshot-agent.d.ts b/node_modules/undici-types/snapshot-agent.d.ts similarity index 93% rename from backend/node_modules/undici-types/snapshot-agent.d.ts rename to node_modules/undici-types/snapshot-agent.d.ts index a08dd6f..f1d1ccd 100644 --- a/backend/node_modules/undici-types/snapshot-agent.d.ts +++ b/node_modules/undici-types/snapshot-agent.d.ts @@ -18,9 +18,11 @@ declare class SnapshotRecorder { } declare namespace SnapshotRecorder { + type SnapshotRecorderMode = 'record' | 'playback' | 'update' + export interface Options { snapshotPath?: string - mode?: 'record' | 'playback' | 'update' + mode?: SnapshotRecorderMode maxSnapshots?: number autoFlush?: boolean flushInterval?: number @@ -77,7 +79,7 @@ declare class SnapshotAgent extends MockAgent { saveSnapshots (filePath?: string): Promise loadSnapshots (filePath?: string): Promise getRecorder (): SnapshotRecorder - getMode (): 'record' | 'playback' | 'update' + getMode (): SnapshotRecorder.SnapshotRecorderMode clearSnapshots (): void resetCallCounts (): void deleteSnapshot (requestOpts: any): boolean @@ -87,7 +89,7 @@ declare class SnapshotAgent extends MockAgent { declare namespace SnapshotAgent { export interface Options extends MockAgent.Options { - mode?: 'record' | 'playback' | 'update' + mode?: SnapshotRecorder.SnapshotRecorderMode snapshotPath?: string maxSnapshots?: number autoFlush?: boolean diff --git a/backend/node_modules/undici-types/util.d.ts b/node_modules/undici-types/util.d.ts similarity index 100% rename from backend/node_modules/undici-types/util.d.ts rename to node_modules/undici-types/util.d.ts diff --git a/backend/node_modules/undici-types/utility.d.ts b/node_modules/undici-types/utility.d.ts similarity index 100% rename from backend/node_modules/undici-types/utility.d.ts rename to node_modules/undici-types/utility.d.ts diff --git a/backend/node_modules/undici-types/webidl.d.ts b/node_modules/undici-types/webidl.d.ts similarity index 74% rename from backend/node_modules/undici-types/webidl.d.ts rename to node_modules/undici-types/webidl.d.ts index f15d699..d2a8eb9 100644 --- a/backend/node_modules/undici-types/webidl.d.ts +++ b/node_modules/undici-types/webidl.d.ts @@ -10,11 +10,6 @@ type SequenceConverter = (object: unknown, iterable?: IterableIterator) => type RecordConverter = (object: unknown) => Record -interface ConvertToIntOpts { - clamp?: boolean - enforceRange?: boolean -} - interface WebidlErrors { /** * @description Instantiate an error @@ -74,7 +69,7 @@ interface WebidlUtil { V: unknown, bitLength: number, signedness: 'signed' | 'unsigned', - opts?: ConvertToIntOpts + flags?: number ): number /** @@ -94,15 +89,17 @@ interface WebidlUtil { * This is only effective in some newer Node.js versions. */ markAsUncloneable (V: any): void + + IsResizableArrayBuffer (V: ArrayBufferLike): boolean + + HasFlag (flag: number, attributes: number): boolean } interface WebidlConverters { /** * @see https://webidl.spec.whatwg.org/#es-DOMString */ - DOMString (V: unknown, prefix: string, argument: string, opts?: { - legacyNullToEmptyString: boolean - }): string + DOMString (V: unknown, prefix: string, argument: string, flags?: number): string /** * @see https://webidl.spec.whatwg.org/#es-ByteString @@ -142,39 +139,78 @@ interface WebidlConverters { /** * @see https://webidl.spec.whatwg.org/#es-unsigned-short */ - ['unsigned short'] (V: unknown, opts?: ConvertToIntOpts): number + ['unsigned short'] (V: unknown, flags?: number): number /** * @see https://webidl.spec.whatwg.org/#idl-ArrayBuffer */ - ArrayBuffer (V: unknown): ArrayBufferLike - ArrayBuffer (V: unknown, opts: { allowShared: false }): ArrayBuffer + ArrayBuffer ( + V: unknown, + prefix: string, + argument: string, + options?: { allowResizable: boolean } + ): ArrayBuffer + + /** + * @see https://webidl.spec.whatwg.org/#idl-SharedArrayBuffer + */ + SharedArrayBuffer ( + V: unknown, + prefix: string, + argument: string, + options?: { allowResizable: boolean } + ): SharedArrayBuffer /** * @see https://webidl.spec.whatwg.org/#es-buffer-source-types */ TypedArray ( V: unknown, - TypedArray: NodeJS.TypedArray | ArrayBufferLike - ): NodeJS.TypedArray | ArrayBufferLike - TypedArray ( - V: unknown, - TypedArray: NodeJS.TypedArray | ArrayBufferLike, - opts?: { allowShared: false } - ): NodeJS.TypedArray | ArrayBuffer + T: new () => NodeJS.TypedArray, + prefix: string, + argument: string, + flags?: number + ): NodeJS.TypedArray /** * @see https://webidl.spec.whatwg.org/#es-buffer-source-types */ - DataView (V: unknown, opts?: { allowShared: boolean }): DataView + DataView ( + V: unknown, + prefix: string, + argument: string, + flags?: number + ): DataView + + /** + * @see https://webidl.spec.whatwg.org/#es-buffer-source-types + */ + ArrayBufferView ( + V: unknown, + prefix: string, + argument: string, + flags?: number + ): NodeJS.ArrayBufferView /** * @see https://webidl.spec.whatwg.org/#BufferSource */ BufferSource ( V: unknown, - opts?: { allowShared: boolean } - ): NodeJS.TypedArray | ArrayBufferLike | DataView + prefix: string, + argument: string, + flags?: number + ): ArrayBuffer | NodeJS.ArrayBufferView + + /** + * @see https://webidl.spec.whatwg.org/#AllowSharedBufferSource + */ + AllowSharedBufferSource ( + V: unknown, + prefix: string, + argument: string, + flags?: number + ): ArrayBuffer | SharedArrayBuffer | NodeJS.ArrayBufferView ['sequence']: SequenceConverter @@ -192,6 +228,13 @@ interface WebidlConverters { */ RequestInit (V: unknown): undici.RequestInit + /** + * @see https://html.spec.whatwg.org/multipage/webappapis.html#eventhandlernonnull + */ + EventHandlerNonNull (V: unknown): Function | null + + WebSocketStreamWrite (V: unknown): ArrayBuffer | NodeJS.TypedArray | string + [Key: string]: (...args: any[]) => unknown } @@ -210,6 +253,10 @@ interface WebidlIs { AbortSignal: WebidlIsFunction MessagePort: WebidlIsFunction USVString: WebidlIsFunction + /** + * @see https://webidl.spec.whatwg.org/#BufferSource + */ + BufferSource: WebidlIsFunction } export interface Webidl { @@ -217,6 +264,7 @@ export interface Webidl { util: WebidlUtil converters: WebidlConverters is: WebidlIs + attributes: WebIDLExtendedAttributes /** * @description Performs a brand-check on {@param V} to ensure it is a @@ -278,3 +326,16 @@ export interface Webidl { argumentLengthCheck (args: { length: number }, min: number, context: string): void } + +interface WebIDLExtendedAttributes { + /** https://webidl.spec.whatwg.org/#Clamp */ + Clamp: number + /** https://webidl.spec.whatwg.org/#EnforceRange */ + EnforceRange: number + /** https://webidl.spec.whatwg.org/#AllowShared */ + AllowShared: number + /** https://webidl.spec.whatwg.org/#AllowResizable */ + AllowResizable: number + /** https://webidl.spec.whatwg.org/#LegacyNullToEmptyString */ + LegacyNullToEmptyString: number +} diff --git a/backend/node_modules/undici-types/websocket.d.ts b/node_modules/undici-types/websocket.d.ts similarity index 100% rename from backend/node_modules/undici-types/websocket.d.ts rename to node_modules/undici-types/websocket.d.ts diff --git a/backend/node_modules/unpipe/HISTORY.md b/node_modules/unpipe/HISTORY.md similarity index 100% rename from backend/node_modules/unpipe/HISTORY.md rename to node_modules/unpipe/HISTORY.md diff --git a/backend/node_modules/unpipe/LICENSE b/node_modules/unpipe/LICENSE similarity index 100% rename from backend/node_modules/unpipe/LICENSE rename to node_modules/unpipe/LICENSE diff --git a/backend/node_modules/unpipe/README.md b/node_modules/unpipe/README.md similarity index 100% rename from backend/node_modules/unpipe/README.md rename to node_modules/unpipe/README.md diff --git a/backend/node_modules/unpipe/index.js b/node_modules/unpipe/index.js similarity index 100% rename from backend/node_modules/unpipe/index.js rename to node_modules/unpipe/index.js diff --git a/backend/node_modules/unpipe/package.json b/node_modules/unpipe/package.json similarity index 100% rename from backend/node_modules/unpipe/package.json rename to node_modules/unpipe/package.json diff --git a/backend/node_modules/utils-merge/.npmignore b/node_modules/utils-merge/.npmignore similarity index 100% rename from backend/node_modules/utils-merge/.npmignore rename to node_modules/utils-merge/.npmignore diff --git a/backend/node_modules/utils-merge/LICENSE b/node_modules/utils-merge/LICENSE similarity index 100% rename from backend/node_modules/utils-merge/LICENSE rename to node_modules/utils-merge/LICENSE diff --git a/backend/node_modules/utils-merge/README.md b/node_modules/utils-merge/README.md similarity index 100% rename from backend/node_modules/utils-merge/README.md rename to node_modules/utils-merge/README.md diff --git a/backend/node_modules/utils-merge/index.js b/node_modules/utils-merge/index.js similarity index 100% rename from backend/node_modules/utils-merge/index.js rename to node_modules/utils-merge/index.js diff --git a/backend/node_modules/utils-merge/package.json b/node_modules/utils-merge/package.json similarity index 100% rename from backend/node_modules/utils-merge/package.json rename to node_modules/utils-merge/package.json diff --git a/node_modules/uuid/CHANGELOG.md b/node_modules/uuid/CHANGELOG.md new file mode 100644 index 0000000..0412ad8 --- /dev/null +++ b/node_modules/uuid/CHANGELOG.md @@ -0,0 +1,274 @@ +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [9.0.1](https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1) (2023-09-12) + +### build + +- Fix CI to work with Node.js 20.x + +## [9.0.0](https://github.com/uuidjs/uuid/compare/v8.3.2...v9.0.0) (2022-09-05) + +### ⚠ BREAKING CHANGES + +- Drop Node.js 10.x support. This library always aims at supporting one EOLed LTS release which by this time now is 12.x which has reached EOL 30 Apr 2022. + +- Remove the minified UMD build from the package. + + Minified code is hard to audit and since this is a widely used library it seems more appropriate nowadays to optimize for auditability than to ship a legacy module format that, at best, serves educational purposes nowadays. + + For production browser use cases, users should be using a bundler. For educational purposes, today's online sandboxes like replit.com offer convenient ways to load npm modules, so the use case for UMD through repos like UNPKG or jsDelivr has largely vanished. + +- Drop IE 11 and Safari 10 support. Drop support for browsers that don't correctly implement const/let and default arguments, and no longer transpile the browser build to ES2015. + + This also removes the fallback on msCrypto instead of the crypto API. + + Browser tests are run in the first supported version of each supported browser and in the latest (as of this commit) version available on Browserstack. + +### Features + +- optimize uuid.v1 by 1.3x uuid.v4 by 4.3x (430%) ([#597](https://github.com/uuidjs/uuid/issues/597)) ([3a033f6](https://github.com/uuidjs/uuid/commit/3a033f6bab6bb3780ece6d645b902548043280bc)) +- remove UMD build ([#645](https://github.com/uuidjs/uuid/issues/645)) ([e948a0f](https://github.com/uuidjs/uuid/commit/e948a0f22bf22f4619b27bd913885e478e20fe6f)), closes [#620](https://github.com/uuidjs/uuid/issues/620) +- use native crypto.randomUUID when available ([#600](https://github.com/uuidjs/uuid/issues/600)) ([c9e076c](https://github.com/uuidjs/uuid/commit/c9e076c852edad7e9a06baaa1d148cf4eda6c6c4)) + +### Bug Fixes + +- add Jest/jsdom compatibility ([#642](https://github.com/uuidjs/uuid/issues/642)) ([16f9c46](https://github.com/uuidjs/uuid/commit/16f9c469edf46f0786164cdf4dc980743984a6fd)) +- change default export to named function ([#545](https://github.com/uuidjs/uuid/issues/545)) ([c57bc5a](https://github.com/uuidjs/uuid/commit/c57bc5a9a0653273aa639cda9177ce52efabe42a)) +- handle error when parameter is not set in v3 and v5 ([#622](https://github.com/uuidjs/uuid/issues/622)) ([fcd7388](https://github.com/uuidjs/uuid/commit/fcd73881692d9fabb63872576ba28e30ff852091)) +- run npm audit fix ([#644](https://github.com/uuidjs/uuid/issues/644)) ([04686f5](https://github.com/uuidjs/uuid/commit/04686f54c5fed2cfffc1b619f4970c4bb8532353)) +- upgrading from uuid3 broken link ([#568](https://github.com/uuidjs/uuid/issues/568)) ([1c849da](https://github.com/uuidjs/uuid/commit/1c849da6e164259e72e18636726345b13a7eddd6)) + +### build + +- drop Node.js 8.x from babel transpile target ([#603](https://github.com/uuidjs/uuid/issues/603)) ([aa11485](https://github.com/uuidjs/uuid/commit/aa114858260402107ec8a1e1a825dea0a259bcb5)) +- drop support for legacy browsers (IE11, Safari 10) ([#604](https://github.com/uuidjs/uuid/issues/604)) ([0f433e5](https://github.com/uuidjs/uuid/commit/0f433e5ec444edacd53016de67db021102f36148)) + +- drop node 10.x to upgrade dev dependencies ([#653](https://github.com/uuidjs/uuid/issues/653)) ([28a5712](https://github.com/uuidjs/uuid/commit/28a571283f8abda6b9d85e689f95b7d3ee9e282e)), closes [#643](https://github.com/uuidjs/uuid/issues/643) + +### [8.3.2](https://github.com/uuidjs/uuid/compare/v8.3.1...v8.3.2) (2020-12-08) + +### Bug Fixes + +- lazy load getRandomValues ([#537](https://github.com/uuidjs/uuid/issues/537)) ([16c8f6d](https://github.com/uuidjs/uuid/commit/16c8f6df2f6b09b4d6235602d6a591188320a82e)), closes [#536](https://github.com/uuidjs/uuid/issues/536) + +### [8.3.1](https://github.com/uuidjs/uuid/compare/v8.3.0...v8.3.1) (2020-10-04) + +### Bug Fixes + +- support expo>=39.0.0 ([#515](https://github.com/uuidjs/uuid/issues/515)) ([c65a0f3](https://github.com/uuidjs/uuid/commit/c65a0f3fa73b901959d638d1e3591dfacdbed867)), closes [#375](https://github.com/uuidjs/uuid/issues/375) + +## [8.3.0](https://github.com/uuidjs/uuid/compare/v8.2.0...v8.3.0) (2020-07-27) + +### Features + +- add parse/stringify/validate/version/NIL APIs ([#479](https://github.com/uuidjs/uuid/issues/479)) ([0e6c10b](https://github.com/uuidjs/uuid/commit/0e6c10ba1bf9517796ff23c052fc0468eedfd5f4)), closes [#475](https://github.com/uuidjs/uuid/issues/475) [#478](https://github.com/uuidjs/uuid/issues/478) [#480](https://github.com/uuidjs/uuid/issues/480) [#481](https://github.com/uuidjs/uuid/issues/481) [#180](https://github.com/uuidjs/uuid/issues/180) + +## [8.2.0](https://github.com/uuidjs/uuid/compare/v8.1.0...v8.2.0) (2020-06-23) + +### Features + +- improve performance of v1 string representation ([#453](https://github.com/uuidjs/uuid/issues/453)) ([0ee0b67](https://github.com/uuidjs/uuid/commit/0ee0b67c37846529c66089880414d29f3ae132d5)) +- remove deprecated v4 string parameter ([#454](https://github.com/uuidjs/uuid/issues/454)) ([88ce3ca](https://github.com/uuidjs/uuid/commit/88ce3ca0ba046f60856de62c7ce03f7ba98ba46c)), closes [#437](https://github.com/uuidjs/uuid/issues/437) +- support jspm ([#473](https://github.com/uuidjs/uuid/issues/473)) ([e9f2587](https://github.com/uuidjs/uuid/commit/e9f2587a92575cac31bc1d4ae944e17c09756659)) + +### Bug Fixes + +- prepare package exports for webpack 5 ([#468](https://github.com/uuidjs/uuid/issues/468)) ([8d6e6a5](https://github.com/uuidjs/uuid/commit/8d6e6a5f8965ca9575eb4d92e99a43435f4a58a8)) + +## [8.1.0](https://github.com/uuidjs/uuid/compare/v8.0.0...v8.1.0) (2020-05-20) + +### Features + +- improve v4 performance by reusing random number array ([#435](https://github.com/uuidjs/uuid/issues/435)) ([bf4af0d](https://github.com/uuidjs/uuid/commit/bf4af0d711b4d2ed03d1f74fd12ad0baa87dc79d)) +- optimize V8 performance of bytesToUuid ([#434](https://github.com/uuidjs/uuid/issues/434)) ([e156415](https://github.com/uuidjs/uuid/commit/e156415448ec1af2351fa0b6660cfb22581971f2)) + +### Bug Fixes + +- export package.json required by react-native and bundlers ([#449](https://github.com/uuidjs/uuid/issues/449)) ([be1c8fe](https://github.com/uuidjs/uuid/commit/be1c8fe9a3206c358e0059b52fafd7213aa48a52)), closes [ai/nanoevents#44](https://github.com/ai/nanoevents/issues/44#issuecomment-602010343) [#444](https://github.com/uuidjs/uuid/issues/444) + +## [8.0.0](https://github.com/uuidjs/uuid/compare/v7.0.3...v8.0.0) (2020-04-29) + +### ⚠ BREAKING CHANGES + +- For native ECMAScript Module (ESM) usage in Node.js only named exports are exposed, there is no more default export. + + ```diff + -import uuid from 'uuid'; + -console.log(uuid.v4()); // -> 'cd6c3b08-0adc-4f4b-a6ef-36087a1c9869' + +import { v4 as uuidv4 } from 'uuid'; + +uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d' + ``` + +- Deep requiring specific algorithms of this library like `require('uuid/v4')`, which has been deprecated in `uuid@7`, is no longer supported. + + Instead use the named exports that this module exports. + + For ECMAScript Modules (ESM): + + ```diff + -import uuidv4 from 'uuid/v4'; + +import { v4 as uuidv4 } from 'uuid'; + uuidv4(); + ``` + + For CommonJS: + + ```diff + -const uuidv4 = require('uuid/v4'); + +const { v4: uuidv4 } = require('uuid'); + uuidv4(); + ``` + +### Features + +- native Node.js ES Modules (wrapper approach) ([#423](https://github.com/uuidjs/uuid/issues/423)) ([2d9f590](https://github.com/uuidjs/uuid/commit/2d9f590ad9701d692625c07ed62f0a0f91227991)), closes [#245](https://github.com/uuidjs/uuid/issues/245) [#419](https://github.com/uuidjs/uuid/issues/419) [#342](https://github.com/uuidjs/uuid/issues/342) +- remove deep requires ([#426](https://github.com/uuidjs/uuid/issues/426)) ([daf72b8](https://github.com/uuidjs/uuid/commit/daf72b84ceb20272a81bb5fbddb05dd95922cbba)) + +### Bug Fixes + +- add CommonJS syntax example to README quickstart section ([#417](https://github.com/uuidjs/uuid/issues/417)) ([e0ec840](https://github.com/uuidjs/uuid/commit/e0ec8402c7ad44b7ef0453036c612f5db513fda0)) + +### [7.0.3](https://github.com/uuidjs/uuid/compare/v7.0.2...v7.0.3) (2020-03-31) + +### Bug Fixes + +- make deep require deprecation warning work in browsers ([#409](https://github.com/uuidjs/uuid/issues/409)) ([4b71107](https://github.com/uuidjs/uuid/commit/4b71107d8c0d2ef56861ede6403fc9dc35a1e6bf)), closes [#408](https://github.com/uuidjs/uuid/issues/408) + +### [7.0.2](https://github.com/uuidjs/uuid/compare/v7.0.1...v7.0.2) (2020-03-04) + +### Bug Fixes + +- make access to msCrypto consistent ([#393](https://github.com/uuidjs/uuid/issues/393)) ([8bf2a20](https://github.com/uuidjs/uuid/commit/8bf2a20f3565df743da7215eebdbada9d2df118c)) +- simplify link in deprecation warning ([#391](https://github.com/uuidjs/uuid/issues/391)) ([bb2c8e4](https://github.com/uuidjs/uuid/commit/bb2c8e4e9f4c5f9c1eaaf3ea59710c633cd90cb7)) +- update links to match content in readme ([#386](https://github.com/uuidjs/uuid/issues/386)) ([44f2f86](https://github.com/uuidjs/uuid/commit/44f2f86e9d2bbf14ee5f0f00f72a3db1292666d4)) + +### [7.0.1](https://github.com/uuidjs/uuid/compare/v7.0.0...v7.0.1) (2020-02-25) + +### Bug Fixes + +- clean up esm builds for node and browser ([#383](https://github.com/uuidjs/uuid/issues/383)) ([59e6a49](https://github.com/uuidjs/uuid/commit/59e6a49e7ce7b3e8fb0f3ee52b9daae72af467dc)) +- provide browser versions independent from module system ([#380](https://github.com/uuidjs/uuid/issues/380)) ([4344a22](https://github.com/uuidjs/uuid/commit/4344a22e7aed33be8627eeaaf05360f256a21753)), closes [#378](https://github.com/uuidjs/uuid/issues/378) + +## [7.0.0](https://github.com/uuidjs/uuid/compare/v3.4.0...v7.0.0) (2020-02-24) + +### ⚠ BREAKING CHANGES + +- The default export, which used to be the v4() method but which was already discouraged in v3.x of this library, has been removed. +- Explicitly note that deep imports of the different uuid version functions are deprecated and no longer encouraged and that ECMAScript module named imports should be used instead. Emit a deprecation warning for people who deep-require the different algorithm variants. +- Remove builtin support for insecure random number generators in the browser. Users who want that will have to supply their own random number generator function. +- Remove support for generating v3 and v5 UUIDs in Node.js<4.x +- Convert code base to ECMAScript Modules (ESM) and release CommonJS build for node and ESM build for browser bundlers. + +### Features + +- add UMD build to npm package ([#357](https://github.com/uuidjs/uuid/issues/357)) ([4e75adf](https://github.com/uuidjs/uuid/commit/4e75adf435196f28e3fbbe0185d654b5ded7ca2c)), closes [#345](https://github.com/uuidjs/uuid/issues/345) +- add various es module and CommonJS examples ([b238510](https://github.com/uuidjs/uuid/commit/b238510bf352463521f74bab175a3af9b7a42555)) +- ensure that docs are up-to-date in CI ([ee5e77d](https://github.com/uuidjs/uuid/commit/ee5e77db547474f5a8f23d6c857a6d399209986b)) +- hybrid CommonJS & ECMAScript modules build ([a3f078f](https://github.com/uuidjs/uuid/commit/a3f078faa0baff69ab41aed08e041f8f9c8993d0)) +- remove insecure fallback random number generator ([3a5842b](https://github.com/uuidjs/uuid/commit/3a5842b141a6e5de0ae338f391661e6b84b167c9)), closes [#173](https://github.com/uuidjs/uuid/issues/173) +- remove support for pre Node.js v4 Buffer API ([#356](https://github.com/uuidjs/uuid/issues/356)) ([b59b5c5](https://github.com/uuidjs/uuid/commit/b59b5c5ecad271c5453f1a156f011671f6d35627)) +- rename repository to github:uuidjs/uuid ([#351](https://github.com/uuidjs/uuid/issues/351)) ([c37a518](https://github.com/uuidjs/uuid/commit/c37a518e367ac4b6d0aa62dba1bc6ce9e85020f7)), closes [#338](https://github.com/uuidjs/uuid/issues/338) + +### Bug Fixes + +- add deep-require proxies for local testing and adjust tests ([#365](https://github.com/uuidjs/uuid/issues/365)) ([7fedc79](https://github.com/uuidjs/uuid/commit/7fedc79ac8fda4bfd1c566c7f05ef4ac13b2db48)) +- add note about removal of default export ([#372](https://github.com/uuidjs/uuid/issues/372)) ([12749b7](https://github.com/uuidjs/uuid/commit/12749b700eb49db8a9759fd306d8be05dbfbd58c)), closes [#370](https://github.com/uuidjs/uuid/issues/370) +- deprecated deep requiring of the different algorithm versions ([#361](https://github.com/uuidjs/uuid/issues/361)) ([c0bdf15](https://github.com/uuidjs/uuid/commit/c0bdf15e417639b1aeb0b247b2fb11f7a0a26b23)) + +## [3.4.0](https://github.com/uuidjs/uuid/compare/v3.3.3...v3.4.0) (2020-01-16) + +### Features + +- rename repository to github:uuidjs/uuid ([#351](https://github.com/uuidjs/uuid/issues/351)) ([e2d7314](https://github.com/uuidjs/uuid/commit/e2d7314)), closes [#338](https://github.com/uuidjs/uuid/issues/338) + +## [3.3.3](https://github.com/uuidjs/uuid/compare/v3.3.2...v3.3.3) (2019-08-19) + +### Bug Fixes + +- no longer run ci tests on node v4 +- upgrade dependencies + +## [3.3.2](https://github.com/uuidjs/uuid/compare/v3.3.1...v3.3.2) (2018-06-28) + +### Bug Fixes + +- typo ([305d877](https://github.com/uuidjs/uuid/commit/305d877)) + +## [3.3.1](https://github.com/uuidjs/uuid/compare/v3.3.0...v3.3.1) (2018-06-28) + +### Bug Fixes + +- fix [#284](https://github.com/uuidjs/uuid/issues/284) by setting function name in try-catch ([f2a60f2](https://github.com/uuidjs/uuid/commit/f2a60f2)) + +# [3.3.0](https://github.com/uuidjs/uuid/compare/v3.2.1...v3.3.0) (2018-06-22) + +### Bug Fixes + +- assignment to readonly property to allow running in strict mode ([#270](https://github.com/uuidjs/uuid/issues/270)) ([d062fdc](https://github.com/uuidjs/uuid/commit/d062fdc)) +- fix [#229](https://github.com/uuidjs/uuid/issues/229) ([c9684d4](https://github.com/uuidjs/uuid/commit/c9684d4)) +- Get correct version of IE11 crypto ([#274](https://github.com/uuidjs/uuid/issues/274)) ([153d331](https://github.com/uuidjs/uuid/commit/153d331)) +- mem issue when generating uuid ([#267](https://github.com/uuidjs/uuid/issues/267)) ([c47702c](https://github.com/uuidjs/uuid/commit/c47702c)) + +### Features + +- enforce Conventional Commit style commit messages ([#282](https://github.com/uuidjs/uuid/issues/282)) ([cc9a182](https://github.com/uuidjs/uuid/commit/cc9a182)) + +## [3.2.1](https://github.com/uuidjs/uuid/compare/v3.2.0...v3.2.1) (2018-01-16) + +### Bug Fixes + +- use msCrypto if available. Fixes [#241](https://github.com/uuidjs/uuid/issues/241) ([#247](https://github.com/uuidjs/uuid/issues/247)) ([1fef18b](https://github.com/uuidjs/uuid/commit/1fef18b)) + +# [3.2.0](https://github.com/uuidjs/uuid/compare/v3.1.0...v3.2.0) (2018-01-16) + +### Bug Fixes + +- remove mistakenly added typescript dependency, rollback version (standard-version will auto-increment) ([09fa824](https://github.com/uuidjs/uuid/commit/09fa824)) +- use msCrypto if available. Fixes [#241](https://github.com/uuidjs/uuid/issues/241) ([#247](https://github.com/uuidjs/uuid/issues/247)) ([1fef18b](https://github.com/uuidjs/uuid/commit/1fef18b)) + +### Features + +- Add v3 Support ([#217](https://github.com/uuidjs/uuid/issues/217)) ([d94f726](https://github.com/uuidjs/uuid/commit/d94f726)) + +# [3.1.0](https://github.com/uuidjs/uuid/compare/v3.1.0...v3.0.1) (2017-06-17) + +### Bug Fixes + +- (fix) Add .npmignore file to exclude test/ and other non-essential files from packing. (#183) +- Fix typo (#178) +- Simple typo fix (#165) + +### Features + +- v5 support in CLI (#197) +- V5 support (#188) + +# 3.0.1 (2016-11-28) + +- split uuid versions into separate files + +# 3.0.0 (2016-11-17) + +- remove .parse and .unparse + +# 2.0.0 + +- Removed uuid.BufferClass + +# 1.4.0 + +- Improved module context detection +- Removed public RNG functions + +# 1.3.2 + +- Improve tests and handling of v1() options (Issue #24) +- Expose RNG option to allow for perf testing with different generators + +# 1.3.0 + +- Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)! +- Support for node.js crypto API +- De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code diff --git a/node_modules/uuid/CONTRIBUTING.md b/node_modules/uuid/CONTRIBUTING.md new file mode 100644 index 0000000..4a4503d --- /dev/null +++ b/node_modules/uuid/CONTRIBUTING.md @@ -0,0 +1,18 @@ +# Contributing + +Please feel free to file GitHub Issues or propose Pull Requests. We're always happy to discuss improvements to this library! + +## Testing + +```shell +npm test +``` + +## Releasing + +Releases are supposed to be done from master, version bumping is automated through [`standard-version`](https://github.com/conventional-changelog/standard-version): + +```shell +npm run release -- --dry-run # verify output manually +npm run release # follow the instructions from the output of this command +``` diff --git a/node_modules/uuid/LICENSE.md b/node_modules/uuid/LICENSE.md new file mode 100644 index 0000000..3934168 --- /dev/null +++ b/node_modules/uuid/LICENSE.md @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2010-2020 Robert Kieffer and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/uuid/README.md b/node_modules/uuid/README.md new file mode 100644 index 0000000..4f51e09 --- /dev/null +++ b/node_modules/uuid/README.md @@ -0,0 +1,466 @@ + + + +# uuid [![CI](https://github.com/uuidjs/uuid/workflows/CI/badge.svg)](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [![Browser](https://github.com/uuidjs/uuid/workflows/Browser/badge.svg)](https://github.com/uuidjs/uuid/actions?query=workflow%3ABrowser) + +For the creation of [RFC4122](https://www.ietf.org/rfc/rfc4122.txt) UUIDs + +- **Complete** - Support for RFC4122 version 1, 3, 4, and 5 UUIDs +- **Cross-platform** - Support for ... + - CommonJS, [ECMAScript Modules](#ecmascript-modules) and [CDN builds](#cdn-builds) + - NodeJS 12+ ([LTS releases](https://github.com/nodejs/Release)) + - Chrome, Safari, Firefox, Edge browsers + - Webpack and rollup.js module bundlers + - [React Native / Expo](#react-native--expo) +- **Secure** - Cryptographically-strong random values +- **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers +- **CLI** - Includes the [`uuid` command line](#command-line) utility + +> **Note** Upgrading from `uuid@3`? Your code is probably okay, but check out [Upgrading From `uuid@3`](#upgrading-from-uuid3) for details. + +> **Note** Only interested in creating a version 4 UUID? You might be able to use [`crypto.randomUUID()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID), eliminating the need to install this library. + +## Quickstart + +To create a random UUID... + +**1. Install** + +```shell +npm install uuid +``` + +**2. Create a UUID** (ES6 module syntax) + +```javascript +import { v4 as uuidv4 } from 'uuid'; +uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d' +``` + +... or using CommonJS syntax: + +```javascript +const { v4: uuidv4 } = require('uuid'); +uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed' +``` + +For timestamp UUIDs, namespace UUIDs, and other options read on ... + +## API Summary + +| | | | +| --- | --- | --- | +| [`uuid.NIL`](#uuidnil) | The nil UUID string (all zeros) | New in `uuid@8.3` | +| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes | New in `uuid@8.3` | +| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string | New in `uuid@8.3` | +| [`uuid.v1()`](#uuidv1options-buffer-offset) | Create a version 1 (timestamp) UUID | | +| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID | | +| [`uuid.v4()`](#uuidv4options-buffer-offset) | Create a version 4 (random) UUID | | +| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID | | +| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID | New in `uuid@8.3` | +| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID | New in `uuid@8.3` | + +## API + +### uuid.NIL + +The nil UUID string (all zeros). + +Example: + +```javascript +import { NIL as NIL_UUID } from 'uuid'; + +NIL_UUID; // ⇨ '00000000-0000-0000-0000-000000000000' +``` + +### uuid.parse(str) + +Convert UUID string to array of bytes + +| | | +| --------- | ---------------------------------------- | +| `str` | A valid UUID `String` | +| _returns_ | `Uint8Array[16]` | +| _throws_ | `TypeError` if `str` is not a valid UUID | + +Note: Ordering of values in the byte arrays used by `parse()` and `stringify()` follows the left ↠ right order of hex-pairs in UUID strings. As shown in the example below. + +Example: + +```javascript +import { parse as uuidParse } from 'uuid'; + +// Parse a UUID +const bytes = uuidParse('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); + +// Convert to hex strings to show byte order (for documentation purposes) +[...bytes].map((v) => v.toString(16).padStart(2, '0')); // ⇨ + // [ + // '6e', 'c0', 'bd', '7f', + // '11', 'c0', '43', 'da', + // '97', '5e', '2a', '8a', + // 'd9', 'eb', 'ae', '0b' + // ] +``` + +### uuid.stringify(arr[, offset]) + +Convert array of bytes to UUID string + +| | | +| -------------- | ---------------------------------------------------------------------------- | +| `arr` | `Array`-like collection of 16 values (starting from `offset`) between 0-255. | +| [`offset` = 0] | `Number` Starting index in the Array | +| _returns_ | `String` | +| _throws_ | `TypeError` if a valid UUID string cannot be generated | + +Note: Ordering of values in the byte arrays used by `parse()` and `stringify()` follows the left ↠ right order of hex-pairs in UUID strings. As shown in the example below. + +Example: + +```javascript +import { stringify as uuidStringify } from 'uuid'; + +const uuidBytes = [ + 0x6e, 0xc0, 0xbd, 0x7f, 0x11, 0xc0, 0x43, 0xda, 0x97, 0x5e, 0x2a, 0x8a, 0xd9, 0xeb, 0xae, 0x0b, +]; + +uuidStringify(uuidBytes); // ⇨ '6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b' +``` + +### uuid.v1([options[, buffer[, offset]]]) + +Create an RFC version 1 (timestamp) UUID + +| | | +| --- | --- | +| [`options`] | `Object` with one or more of the following properties: | +| [`options.node` ] | RFC "node" field as an `Array[6]` of byte values (per 4.1.6) | +| [`options.clockseq`] | RFC "clock sequence" as a `Number` between 0 - 0x3fff | +| [`options.msecs`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) | +| [`options.nsecs`] | RFC "timestamp" field (`Number` of nanoseconds to add to `msecs`, should be 0-10,000) | +| [`options.random`] | `Array` of 16 random bytes (0-255) | +| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) | +| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` | +| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` | +| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` | +| _throws_ | `Error` if more than 10M UUIDs/sec are requested | + +Note: The default [node id](https://tools.ietf.org/html/rfc4122#section-4.1.6) (the last 12 digits in the UUID) is generated once, randomly, on process startup, and then remains unchanged for the duration of the process. + +Note: `options.random` and `options.rng` are only meaningful on the very first call to `v1()`, where they may be passed to initialize the internal `node` and `clockseq` fields. + +Example: + +```javascript +import { v1 as uuidv1 } from 'uuid'; + +uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d' +``` + +Example using `options`: + +```javascript +import { v1 as uuidv1 } from 'uuid'; + +const v1options = { + node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], + clockseq: 0x1234, + msecs: new Date('2011-11-01').getTime(), + nsecs: 5678, +}; +uuidv1(v1options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab' +``` + +### uuid.v3(name, namespace[, buffer[, offset]]) + +Create an RFC version 3 (namespace w/ MD5) UUID + +API is identical to `v5()`, but uses "v3" instead. + +⚠️ Note: Per the RFC, "_If backward compatibility is not an issue, SHA-1 [Version 5] is preferred_." + +### uuid.v4([options[, buffer[, offset]]]) + +Create an RFC version 4 (random) UUID + +| | | +| --- | --- | +| [`options`] | `Object` with one or more of the following properties: | +| [`options.random`] | `Array` of 16 random bytes (0-255) | +| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) | +| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` | +| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` | +| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` | + +Example: + +```javascript +import { v4 as uuidv4 } from 'uuid'; + +uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed' +``` + +Example using predefined `random` values: + +```javascript +import { v4 as uuidv4 } from 'uuid'; + +const v4options = { + random: [ + 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36, + ], +}; +uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836' +``` + +### uuid.v5(name, namespace[, buffer[, offset]]) + +Create an RFC version 5 (namespace w/ SHA-1) UUID + +| | | +| --- | --- | +| `name` | `String \| Array` | +| `namespace` | `String \| Array[16]` Namespace UUID | +| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` | +| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` | +| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` | + +Note: The RFC `DNS` and `URL` namespaces are available as `v5.DNS` and `v5.URL`. + +Example with custom namespace: + +```javascript +import { v5 as uuidv5 } from 'uuid'; + +// Define a custom namespace. Readers, create your own using something like +// https://www.uuidgenerator.net/ +const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341'; + +uuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681' +``` + +Example with RFC `URL` namespace: + +```javascript +import { v5 as uuidv5 } from 'uuid'; + +uuidv5('https://www.w3.org/', uuidv5.URL); // ⇨ 'c106a26a-21bb-5538-8bf2-57095d1976c1' +``` + +### uuid.validate(str) + +Test a string to see if it is a valid UUID + +| | | +| --------- | --------------------------------------------------- | +| `str` | `String` to validate | +| _returns_ | `true` if string is a valid UUID, `false` otherwise | + +Example: + +```javascript +import { validate as uuidValidate } from 'uuid'; + +uuidValidate('not a UUID'); // ⇨ false +uuidValidate('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ true +``` + +Using `validate` and `version` together it is possible to do per-version validation, e.g. validate for only v4 UUIds. + +```javascript +import { version as uuidVersion } from 'uuid'; +import { validate as uuidValidate } from 'uuid'; + +function uuidValidateV4(uuid) { + return uuidValidate(uuid) && uuidVersion(uuid) === 4; +} + +const v1Uuid = 'd9428888-122b-11e1-b85c-61cd3cbb3210'; +const v4Uuid = '109156be-c4fb-41ea-b1b4-efe1671c5836'; + +uuidValidateV4(v4Uuid); // ⇨ true +uuidValidateV4(v1Uuid); // ⇨ false +``` + +### uuid.version(str) + +Detect RFC version of a UUID + +| | | +| --------- | ---------------------------------------- | +| `str` | A valid UUID `String` | +| _returns_ | `Number` The RFC version of the UUID | +| _throws_ | `TypeError` if `str` is not a valid UUID | + +Example: + +```javascript +import { version as uuidVersion } from 'uuid'; + +uuidVersion('45637ec4-c85f-11ea-87d0-0242ac130003'); // ⇨ 1 +uuidVersion('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ 4 +``` + +## Command Line + +UUIDs can be generated from the command line using `uuid`. + +```shell +$ npx uuid +ddeb27fb-d9a0-4624-be4d-4615062daed4 +``` + +The default is to generate version 4 UUIDS, however the other versions are supported. Type `uuid --help` for details: + +```shell +$ npx uuid --help + +Usage: + uuid + uuid v1 + uuid v3 + uuid v4 + uuid v5 + uuid --help + +Note: may be "URL" or "DNS" to use the corresponding UUIDs +defined by RFC4122 +``` + +## ECMAScript Modules + +This library comes with [ECMAScript Modules](https://www.ecma-international.org/ecma-262/6.0/#sec-modules) (ESM) support for Node.js versions that support it ([example](./examples/node-esmodules/)) as well as bundlers like [rollup.js](https://rollupjs.org/guide/en/#tree-shaking) ([example](./examples/browser-rollup/)) and [webpack](https://webpack.js.org/guides/tree-shaking/) ([example](./examples/browser-webpack/)) (targeting both, Node.js and browser environments). + +```javascript +import { v4 as uuidv4 } from 'uuid'; +uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed' +``` + +To run the examples you must first create a dist build of this library in the module root: + +```shell +npm run build +``` + +## CDN Builds + +### ECMAScript Modules + +To load this module directly into modern browsers that [support loading ECMAScript Modules](https://caniuse.com/#feat=es6-module) you can make use of [jspm](https://jspm.org/): + +```html + +``` + +### UMD + +As of `uuid@9` [UMD (Universal Module Definition)](https://github.com/umdjs/umd) builds are no longer shipped with this library. + +If you need a UMD build of this library, use a bundler like Webpack or Rollup. Alternatively, refer to the documentation of [`uuid@8.3.2`](https://github.com/uuidjs/uuid/blob/v8.3.2/README.md#umd) which was the last version that shipped UMD builds. + +## Known issues + +### Duplicate UUIDs (Googlebot) + +This module may generate duplicate UUIDs when run in clients with _deterministic_ random number generators, such as [Googlebot crawlers](https://developers.google.com/search/docs/advanced/crawling/overview-google-crawlers). This can cause problems for apps that expect client-generated UUIDs to always be unique. Developers should be prepared for this and have a strategy for dealing with possible collisions, such as: + +- Check for duplicate UUIDs, fail gracefully +- Disable write operations for Googlebot clients + +### "getRandomValues() not supported" + +This error occurs in environments where the standard [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) API is not supported. This issue can be resolved by adding an appropriate polyfill: + +### React Native / Expo + +1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme) +1. Import it _before_ `uuid`. Since `uuid` might also appear as a transitive dependency of some other imports it's safest to just import `react-native-get-random-values` as the very first thing in your entry point: + +```javascript +import 'react-native-get-random-values'; +import { v4 as uuidv4 } from 'uuid'; +``` + +Note: If you are using Expo, you must be using at least `react-native-get-random-values@1.5.0` and `expo@39.0.0`. + +### Web Workers / Service Workers (Edge <= 18) + +[In Edge <= 18, Web Crypto is not supported in Web Workers or Service Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if you find one, please). + +### IE 11 (Internet Explorer) + +Support for IE11 and other legacy browsers has been dropped as of `uuid@9`. If you need to support legacy browsers, you can always transpile the uuid module source yourself (e.g. using [Babel](https://babeljs.io/)). + +## Upgrading From `uuid@7` + +### Only Named Exports Supported When Using with Node.js ESM + +`uuid@7` did not come with native ECMAScript Module (ESM) support for Node.js. Importing it in Node.js ESM consequently imported the CommonJS source with a default export. This library now comes with true Node.js ESM support and only provides named exports. + +Instead of doing: + +```javascript +import uuid from 'uuid'; +uuid.v4(); +``` + +you will now have to use the named exports: + +```javascript +import { v4 as uuidv4 } from 'uuid'; +uuidv4(); +``` + +### Deep Requires No Longer Supported + +Deep requires like `require('uuid/v4')` [which have been deprecated in `uuid@7`](#deep-requires-now-deprecated) are no longer supported. + +## Upgrading From `uuid@3` + +"_Wait... what happened to `uuid@4` thru `uuid@6`?!?_" + +In order to avoid confusion with RFC [version 4](#uuidv4options-buffer-offset) and [version 5](#uuidv5name-namespace-buffer-offset) UUIDs, and a possible [version 6](http://gh.peabody.io/uuidv6/), releases 4 thru 6 of this module have been skipped. + +### Deep Requires Now Deprecated + +`uuid@3` encouraged the use of deep requires to minimize the bundle size of browser builds: + +```javascript +const uuidv4 = require('uuid/v4'); // <== NOW DEPRECATED! +uuidv4(); +``` + +As of `uuid@7` this library now provides ECMAScript modules builds, which allow packagers like Webpack and Rollup to do "tree-shaking" to remove dead code. Instead, use the `import` syntax: + +```javascript +import { v4 as uuidv4 } from 'uuid'; +uuidv4(); +``` + +... or for CommonJS: + +```javascript +const { v4: uuidv4 } = require('uuid'); +uuidv4(); +``` + +### Default Export Removed + +`uuid@3` was exporting the Version 4 UUID method as a default export: + +```javascript +const uuid = require('uuid'); // <== REMOVED! +``` + +This usage pattern was already discouraged in `uuid@3` and has been removed in `uuid@7`. + +--- + +Markdown generated from [README_js.md](README_js.md) by diff --git a/node_modules/uuid/dist/bin/uuid b/node_modules/uuid/dist/bin/uuid new file mode 100755 index 0000000..f38d2ee --- /dev/null +++ b/node_modules/uuid/dist/bin/uuid @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('../uuid-bin'); diff --git a/node_modules/uuid/dist/commonjs-browser/index.js b/node_modules/uuid/dist/commonjs-browser/index.js new file mode 100644 index 0000000..5586dd3 --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/index.js @@ -0,0 +1,79 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "NIL", { + enumerable: true, + get: function get() { + return _nil.default; + } +}); +Object.defineProperty(exports, "parse", { + enumerable: true, + get: function get() { + return _parse.default; + } +}); +Object.defineProperty(exports, "stringify", { + enumerable: true, + get: function get() { + return _stringify.default; + } +}); +Object.defineProperty(exports, "v1", { + enumerable: true, + get: function get() { + return _v.default; + } +}); +Object.defineProperty(exports, "v3", { + enumerable: true, + get: function get() { + return _v2.default; + } +}); +Object.defineProperty(exports, "v4", { + enumerable: true, + get: function get() { + return _v3.default; + } +}); +Object.defineProperty(exports, "v5", { + enumerable: true, + get: function get() { + return _v4.default; + } +}); +Object.defineProperty(exports, "validate", { + enumerable: true, + get: function get() { + return _validate.default; + } +}); +Object.defineProperty(exports, "version", { + enumerable: true, + get: function get() { + return _version.default; + } +}); + +var _v = _interopRequireDefault(require("./v1.js")); + +var _v2 = _interopRequireDefault(require("./v3.js")); + +var _v3 = _interopRequireDefault(require("./v4.js")); + +var _v4 = _interopRequireDefault(require("./v5.js")); + +var _nil = _interopRequireDefault(require("./nil.js")); + +var _version = _interopRequireDefault(require("./version.js")); + +var _validate = _interopRequireDefault(require("./validate.js")); + +var _stringify = _interopRequireDefault(require("./stringify.js")); + +var _parse = _interopRequireDefault(require("./parse.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/md5.js b/node_modules/uuid/dist/commonjs-browser/md5.js new file mode 100644 index 0000000..7a4582a --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/md5.js @@ -0,0 +1,223 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/* + * Browser-compatible JavaScript MD5 + * + * Modification of JavaScript MD5 + * https://github.com/blueimp/JavaScript-MD5 + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + * + * Based on + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ +function md5(bytes) { + if (typeof bytes === 'string') { + const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape + + bytes = new Uint8Array(msg.length); + + for (let i = 0; i < msg.length; ++i) { + bytes[i] = msg.charCodeAt(i); + } + } + + return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8)); +} +/* + * Convert an array of little-endian words to an array of bytes + */ + + +function md5ToHexEncodedArray(input) { + const output = []; + const length32 = input.length * 32; + const hexTab = '0123456789abcdef'; + + for (let i = 0; i < length32; i += 8) { + const x = input[i >> 5] >>> i % 32 & 0xff; + const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16); + output.push(hex); + } + + return output; +} +/** + * Calculate output length with padding and bit length + */ + + +function getOutputLength(inputLength8) { + return (inputLength8 + 64 >>> 9 << 4) + 14 + 1; +} +/* + * Calculate the MD5 of an array of little-endian words, and a bit length. + */ + + +function wordsToMd5(x, len) { + /* append padding */ + x[len >> 5] |= 0x80 << len % 32; + x[getOutputLength(len) - 1] = len; + let a = 1732584193; + let b = -271733879; + let c = -1732584194; + let d = 271733878; + + for (let i = 0; i < x.length; i += 16) { + const olda = a; + const oldb = b; + const oldc = c; + const oldd = d; + a = md5ff(a, b, c, d, x[i], 7, -680876936); + d = md5ff(d, a, b, c, x[i + 1], 12, -389564586); + c = md5ff(c, d, a, b, x[i + 2], 17, 606105819); + b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330); + a = md5ff(a, b, c, d, x[i + 4], 7, -176418897); + d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426); + c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341); + b = md5ff(b, c, d, a, x[i + 7], 22, -45705983); + a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416); + d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417); + c = md5ff(c, d, a, b, x[i + 10], 17, -42063); + b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162); + a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682); + d = md5ff(d, a, b, c, x[i + 13], 12, -40341101); + c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290); + b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329); + a = md5gg(a, b, c, d, x[i + 1], 5, -165796510); + d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632); + c = md5gg(c, d, a, b, x[i + 11], 14, 643717713); + b = md5gg(b, c, d, a, x[i], 20, -373897302); + a = md5gg(a, b, c, d, x[i + 5], 5, -701558691); + d = md5gg(d, a, b, c, x[i + 10], 9, 38016083); + c = md5gg(c, d, a, b, x[i + 15], 14, -660478335); + b = md5gg(b, c, d, a, x[i + 4], 20, -405537848); + a = md5gg(a, b, c, d, x[i + 9], 5, 568446438); + d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690); + c = md5gg(c, d, a, b, x[i + 3], 14, -187363961); + b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501); + a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467); + d = md5gg(d, a, b, c, x[i + 2], 9, -51403784); + c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473); + b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734); + a = md5hh(a, b, c, d, x[i + 5], 4, -378558); + d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463); + c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562); + b = md5hh(b, c, d, a, x[i + 14], 23, -35309556); + a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060); + d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353); + c = md5hh(c, d, a, b, x[i + 7], 16, -155497632); + b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640); + a = md5hh(a, b, c, d, x[i + 13], 4, 681279174); + d = md5hh(d, a, b, c, x[i], 11, -358537222); + c = md5hh(c, d, a, b, x[i + 3], 16, -722521979); + b = md5hh(b, c, d, a, x[i + 6], 23, 76029189); + a = md5hh(a, b, c, d, x[i + 9], 4, -640364487); + d = md5hh(d, a, b, c, x[i + 12], 11, -421815835); + c = md5hh(c, d, a, b, x[i + 15], 16, 530742520); + b = md5hh(b, c, d, a, x[i + 2], 23, -995338651); + a = md5ii(a, b, c, d, x[i], 6, -198630844); + d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415); + c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905); + b = md5ii(b, c, d, a, x[i + 5], 21, -57434055); + a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571); + d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606); + c = md5ii(c, d, a, b, x[i + 10], 15, -1051523); + b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799); + a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359); + d = md5ii(d, a, b, c, x[i + 15], 10, -30611744); + c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380); + b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649); + a = md5ii(a, b, c, d, x[i + 4], 6, -145523070); + d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379); + c = md5ii(c, d, a, b, x[i + 2], 15, 718787259); + b = md5ii(b, c, d, a, x[i + 9], 21, -343485551); + a = safeAdd(a, olda); + b = safeAdd(b, oldb); + c = safeAdd(c, oldc); + d = safeAdd(d, oldd); + } + + return [a, b, c, d]; +} +/* + * Convert an array bytes to an array of little-endian words + * Characters >255 have their high-byte silently ignored. + */ + + +function bytesToWords(input) { + if (input.length === 0) { + return []; + } + + const length8 = input.length * 8; + const output = new Uint32Array(getOutputLength(length8)); + + for (let i = 0; i < length8; i += 8) { + output[i >> 5] |= (input[i / 8] & 0xff) << i % 32; + } + + return output; +} +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ + + +function safeAdd(x, y) { + const lsw = (x & 0xffff) + (y & 0xffff); + const msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return msw << 16 | lsw & 0xffff; +} +/* + * Bitwise rotate a 32-bit number to the left. + */ + + +function bitRotateLeft(num, cnt) { + return num << cnt | num >>> 32 - cnt; +} +/* + * These functions implement the four basic operations the algorithm uses. + */ + + +function md5cmn(q, a, b, x, s, t) { + return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b); +} + +function md5ff(a, b, c, d, x, s, t) { + return md5cmn(b & c | ~b & d, a, b, x, s, t); +} + +function md5gg(a, b, c, d, x, s, t) { + return md5cmn(b & d | c & ~d, a, b, x, s, t); +} + +function md5hh(a, b, c, d, x, s, t) { + return md5cmn(b ^ c ^ d, a, b, x, s, t); +} + +function md5ii(a, b, c, d, x, s, t) { + return md5cmn(c ^ (b | ~d), a, b, x, s, t); +} + +var _default = md5; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/native.js b/node_modules/uuid/dist/commonjs-browser/native.js new file mode 100644 index 0000000..c2eea59 --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/native.js @@ -0,0 +1,11 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); +var _default = { + randomUUID +}; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/nil.js b/node_modules/uuid/dist/commonjs-browser/nil.js new file mode 100644 index 0000000..7ade577 --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/nil.js @@ -0,0 +1,8 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _default = '00000000-0000-0000-0000-000000000000'; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/parse.js b/node_modules/uuid/dist/commonjs-browser/parse.js new file mode 100644 index 0000000..4c69fc3 --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/parse.js @@ -0,0 +1,45 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _validate = _interopRequireDefault(require("./validate.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function parse(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } + + let v; + const arr = new Uint8Array(16); // Parse ########-....-....-....-............ + + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 0xff; + arr[2] = v >>> 8 & 0xff; + arr[3] = v & 0xff; // Parse ........-####-....-....-............ + + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 0xff; // Parse ........-....-####-....-............ + + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 0xff; // Parse ........-....-....-####-............ + + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 0xff; // Parse ........-....-....-....-############ + // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) + + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; + arr[11] = v / 0x100000000 & 0xff; + arr[12] = v >>> 24 & 0xff; + arr[13] = v >>> 16 & 0xff; + arr[14] = v >>> 8 & 0xff; + arr[15] = v & 0xff; + return arr; +} + +var _default = parse; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/regex.js b/node_modules/uuid/dist/commonjs-browser/regex.js new file mode 100644 index 0000000..1ef91d6 --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/regex.js @@ -0,0 +1,8 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/rng.js b/node_modules/uuid/dist/commonjs-browser/rng.js new file mode 100644 index 0000000..d067cdb --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/rng.js @@ -0,0 +1,25 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = rng; +// Unique ID creation requires a high quality random # generator. In the browser we therefore +// require the crypto API and do not support built-in fallback to lower quality random number +// generators (like Math.random()). +let getRandomValues; +const rnds8 = new Uint8Array(16); + +function rng() { + // lazy load so that environments that need to polyfill have a chance to do so + if (!getRandomValues) { + // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. + getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); + + if (!getRandomValues) { + throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); + } + } + + return getRandomValues(rnds8); +} \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/sha1.js b/node_modules/uuid/dist/commonjs-browser/sha1.js new file mode 100644 index 0000000..24cbced --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/sha1.js @@ -0,0 +1,104 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +// Adapted from Chris Veness' SHA1 code at +// http://www.movable-type.co.uk/scripts/sha1.html +function f(s, x, y, z) { + switch (s) { + case 0: + return x & y ^ ~x & z; + + case 1: + return x ^ y ^ z; + + case 2: + return x & y ^ x & z ^ y & z; + + case 3: + return x ^ y ^ z; + } +} + +function ROTL(x, n) { + return x << n | x >>> 32 - n; +} + +function sha1(bytes) { + const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6]; + const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; + + if (typeof bytes === 'string') { + const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape + + bytes = []; + + for (let i = 0; i < msg.length; ++i) { + bytes.push(msg.charCodeAt(i)); + } + } else if (!Array.isArray(bytes)) { + // Convert Array-like to Array + bytes = Array.prototype.slice.call(bytes); + } + + bytes.push(0x80); + const l = bytes.length / 4 + 2; + const N = Math.ceil(l / 16); + const M = new Array(N); + + for (let i = 0; i < N; ++i) { + const arr = new Uint32Array(16); + + for (let j = 0; j < 16; ++j) { + arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3]; + } + + M[i] = arr; + } + + M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32); + M[N - 1][14] = Math.floor(M[N - 1][14]); + M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff; + + for (let i = 0; i < N; ++i) { + const W = new Uint32Array(80); + + for (let t = 0; t < 16; ++t) { + W[t] = M[i][t]; + } + + for (let t = 16; t < 80; ++t) { + W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1); + } + + let a = H[0]; + let b = H[1]; + let c = H[2]; + let d = H[3]; + let e = H[4]; + + for (let t = 0; t < 80; ++t) { + const s = Math.floor(t / 20); + const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0; + e = d; + d = c; + c = ROTL(b, 30) >>> 0; + b = a; + a = T; + } + + H[0] = H[0] + a >>> 0; + H[1] = H[1] + b >>> 0; + H[2] = H[2] + c >>> 0; + H[3] = H[3] + d >>> 0; + H[4] = H[4] + e >>> 0; + } + + return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff]; +} + +var _default = sha1; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/stringify.js b/node_modules/uuid/dist/commonjs-browser/stringify.js new file mode 100644 index 0000000..390bf89 --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/stringify.js @@ -0,0 +1,44 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +exports.unsafeStringify = unsafeStringify; + +var _validate = _interopRequireDefault(require("./validate.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ +const byteToHex = []; + +for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 0x100).toString(16).slice(1)); +} + +function unsafeStringify(arr, offset = 0) { + // Note: Be careful editing this code! It's been tuned for performance + // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; +} + +function stringify(arr, offset = 0) { + const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one + // of the following: + // - One or more input array values don't map to a hex octet (leading to + // "undefined" in the uuid) + // - Invalid input values for the RFC `version` or `variant` fields + + if (!(0, _validate.default)(uuid)) { + throw TypeError('Stringified UUID is invalid'); + } + + return uuid; +} + +var _default = stringify; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/v1.js b/node_modules/uuid/dist/commonjs-browser/v1.js new file mode 100644 index 0000000..125bc58 --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/v1.js @@ -0,0 +1,107 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _rng = _interopRequireDefault(require("./rng.js")); + +var _stringify = require("./stringify.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html +let _nodeId; + +let _clockseq; // Previous uuid creation time + + +let _lastMSecs = 0; +let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details + +function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not + // specified. We do this lazily to minimize issues related to insufficient + // system entropy. See #189 + + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || _rng.default)(); + + if (node == null) { + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + + if (clockseq == null) { + // Per 4.2.2, randomize (14 bit) clockseq + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; + } + } // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. + + + let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock + + let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) + + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression + + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval + + + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } // Per 4.2.1.2 Throw error if too many uuids are requested + + + if (nsecs >= 10000) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } + + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + + msecs += 12219292800000; // `time_low` + + const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; // `time_mid` + + const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; // `time_high_and_version` + + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + + b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + + b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` + + b[i++] = clockseq & 0xff; // `node` + + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + + return buf || (0, _stringify.unsafeStringify)(b); +} + +var _default = v1; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/v3.js b/node_modules/uuid/dist/commonjs-browser/v3.js new file mode 100644 index 0000000..6b47ff5 --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/v3.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _v = _interopRequireDefault(require("./v35.js")); + +var _md = _interopRequireDefault(require("./md5.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const v3 = (0, _v.default)('v3', 0x30, _md.default); +var _default = v3; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/v35.js b/node_modules/uuid/dist/commonjs-browser/v35.js new file mode 100644 index 0000000..7c522d9 --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/v35.js @@ -0,0 +1,80 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.URL = exports.DNS = void 0; +exports.default = v35; + +var _stringify = require("./stringify.js"); + +var _parse = _interopRequireDefault(require("./parse.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); // UTF8 escape + + const bytes = []; + + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } + + return bytes; +} + +const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; +exports.DNS = DNS; +const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; +exports.URL = URL; + +function v35(name, version, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + var _namespace; + + if (typeof value === 'string') { + value = stringToBytes(value); + } + + if (typeof namespace === 'string') { + namespace = (0, _parse.default)(namespace); + } + + if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) { + throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); + } // Compute hash of namespace and value, Per 4.3 + // Future: Use spread syntax when supported on all platforms, e.g. `bytes = + // hashfunc([...namespace, ... value])` + + + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 0x0f | version; + bytes[8] = bytes[8] & 0x3f | 0x80; + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; + } + + return buf; + } + + return (0, _stringify.unsafeStringify)(bytes); + } // Function#name is not settable on some platforms (#270) + + + try { + generateUUID.name = name; // eslint-disable-next-line no-empty + } catch (err) {} // For CommonJS default export support + + + generateUUID.DNS = DNS; + generateUUID.URL = URL; + return generateUUID; +} \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/v4.js b/node_modules/uuid/dist/commonjs-browser/v4.js new file mode 100644 index 0000000..959d698 --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/v4.js @@ -0,0 +1,43 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _native = _interopRequireDefault(require("./native.js")); + +var _rng = _interopRequireDefault(require("./rng.js")); + +var _stringify = require("./stringify.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function v4(options, buf, offset) { + if (_native.default.randomUUID && !buf && !options) { + return _native.default.randomUUID(); + } + + options = options || {}; + + const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + + + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; + } + + return buf; + } + + return (0, _stringify.unsafeStringify)(rnds); +} + +var _default = v4; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/v5.js b/node_modules/uuid/dist/commonjs-browser/v5.js new file mode 100644 index 0000000..99d615e --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/v5.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _v = _interopRequireDefault(require("./v35.js")); + +var _sha = _interopRequireDefault(require("./sha1.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const v5 = (0, _v.default)('v5', 0x50, _sha.default); +var _default = v5; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/validate.js b/node_modules/uuid/dist/commonjs-browser/validate.js new file mode 100644 index 0000000..fd05215 --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/validate.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _regex = _interopRequireDefault(require("./regex.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function validate(uuid) { + return typeof uuid === 'string' && _regex.default.test(uuid); +} + +var _default = validate; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/commonjs-browser/version.js b/node_modules/uuid/dist/commonjs-browser/version.js new file mode 100644 index 0000000..f63af01 --- /dev/null +++ b/node_modules/uuid/dist/commonjs-browser/version.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _validate = _interopRequireDefault(require("./validate.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function version(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } + + return parseInt(uuid.slice(14, 15), 16); +} + +var _default = version; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/index.js b/node_modules/uuid/dist/esm-browser/index.js new file mode 100644 index 0000000..1db6f6d --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/index.js @@ -0,0 +1,9 @@ +export { default as v1 } from './v1.js'; +export { default as v3 } from './v3.js'; +export { default as v4 } from './v4.js'; +export { default as v5 } from './v5.js'; +export { default as NIL } from './nil.js'; +export { default as version } from './version.js'; +export { default as validate } from './validate.js'; +export { default as stringify } from './stringify.js'; +export { default as parse } from './parse.js'; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/md5.js b/node_modules/uuid/dist/esm-browser/md5.js new file mode 100644 index 0000000..f12212e --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/md5.js @@ -0,0 +1,215 @@ +/* + * Browser-compatible JavaScript MD5 + * + * Modification of JavaScript MD5 + * https://github.com/blueimp/JavaScript-MD5 + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + * + * Based on + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ +function md5(bytes) { + if (typeof bytes === 'string') { + const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape + + bytes = new Uint8Array(msg.length); + + for (let i = 0; i < msg.length; ++i) { + bytes[i] = msg.charCodeAt(i); + } + } + + return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8)); +} +/* + * Convert an array of little-endian words to an array of bytes + */ + + +function md5ToHexEncodedArray(input) { + const output = []; + const length32 = input.length * 32; + const hexTab = '0123456789abcdef'; + + for (let i = 0; i < length32; i += 8) { + const x = input[i >> 5] >>> i % 32 & 0xff; + const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16); + output.push(hex); + } + + return output; +} +/** + * Calculate output length with padding and bit length + */ + + +function getOutputLength(inputLength8) { + return (inputLength8 + 64 >>> 9 << 4) + 14 + 1; +} +/* + * Calculate the MD5 of an array of little-endian words, and a bit length. + */ + + +function wordsToMd5(x, len) { + /* append padding */ + x[len >> 5] |= 0x80 << len % 32; + x[getOutputLength(len) - 1] = len; + let a = 1732584193; + let b = -271733879; + let c = -1732584194; + let d = 271733878; + + for (let i = 0; i < x.length; i += 16) { + const olda = a; + const oldb = b; + const oldc = c; + const oldd = d; + a = md5ff(a, b, c, d, x[i], 7, -680876936); + d = md5ff(d, a, b, c, x[i + 1], 12, -389564586); + c = md5ff(c, d, a, b, x[i + 2], 17, 606105819); + b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330); + a = md5ff(a, b, c, d, x[i + 4], 7, -176418897); + d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426); + c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341); + b = md5ff(b, c, d, a, x[i + 7], 22, -45705983); + a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416); + d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417); + c = md5ff(c, d, a, b, x[i + 10], 17, -42063); + b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162); + a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682); + d = md5ff(d, a, b, c, x[i + 13], 12, -40341101); + c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290); + b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329); + a = md5gg(a, b, c, d, x[i + 1], 5, -165796510); + d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632); + c = md5gg(c, d, a, b, x[i + 11], 14, 643717713); + b = md5gg(b, c, d, a, x[i], 20, -373897302); + a = md5gg(a, b, c, d, x[i + 5], 5, -701558691); + d = md5gg(d, a, b, c, x[i + 10], 9, 38016083); + c = md5gg(c, d, a, b, x[i + 15], 14, -660478335); + b = md5gg(b, c, d, a, x[i + 4], 20, -405537848); + a = md5gg(a, b, c, d, x[i + 9], 5, 568446438); + d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690); + c = md5gg(c, d, a, b, x[i + 3], 14, -187363961); + b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501); + a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467); + d = md5gg(d, a, b, c, x[i + 2], 9, -51403784); + c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473); + b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734); + a = md5hh(a, b, c, d, x[i + 5], 4, -378558); + d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463); + c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562); + b = md5hh(b, c, d, a, x[i + 14], 23, -35309556); + a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060); + d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353); + c = md5hh(c, d, a, b, x[i + 7], 16, -155497632); + b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640); + a = md5hh(a, b, c, d, x[i + 13], 4, 681279174); + d = md5hh(d, a, b, c, x[i], 11, -358537222); + c = md5hh(c, d, a, b, x[i + 3], 16, -722521979); + b = md5hh(b, c, d, a, x[i + 6], 23, 76029189); + a = md5hh(a, b, c, d, x[i + 9], 4, -640364487); + d = md5hh(d, a, b, c, x[i + 12], 11, -421815835); + c = md5hh(c, d, a, b, x[i + 15], 16, 530742520); + b = md5hh(b, c, d, a, x[i + 2], 23, -995338651); + a = md5ii(a, b, c, d, x[i], 6, -198630844); + d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415); + c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905); + b = md5ii(b, c, d, a, x[i + 5], 21, -57434055); + a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571); + d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606); + c = md5ii(c, d, a, b, x[i + 10], 15, -1051523); + b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799); + a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359); + d = md5ii(d, a, b, c, x[i + 15], 10, -30611744); + c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380); + b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649); + a = md5ii(a, b, c, d, x[i + 4], 6, -145523070); + d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379); + c = md5ii(c, d, a, b, x[i + 2], 15, 718787259); + b = md5ii(b, c, d, a, x[i + 9], 21, -343485551); + a = safeAdd(a, olda); + b = safeAdd(b, oldb); + c = safeAdd(c, oldc); + d = safeAdd(d, oldd); + } + + return [a, b, c, d]; +} +/* + * Convert an array bytes to an array of little-endian words + * Characters >255 have their high-byte silently ignored. + */ + + +function bytesToWords(input) { + if (input.length === 0) { + return []; + } + + const length8 = input.length * 8; + const output = new Uint32Array(getOutputLength(length8)); + + for (let i = 0; i < length8; i += 8) { + output[i >> 5] |= (input[i / 8] & 0xff) << i % 32; + } + + return output; +} +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ + + +function safeAdd(x, y) { + const lsw = (x & 0xffff) + (y & 0xffff); + const msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return msw << 16 | lsw & 0xffff; +} +/* + * Bitwise rotate a 32-bit number to the left. + */ + + +function bitRotateLeft(num, cnt) { + return num << cnt | num >>> 32 - cnt; +} +/* + * These functions implement the four basic operations the algorithm uses. + */ + + +function md5cmn(q, a, b, x, s, t) { + return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b); +} + +function md5ff(a, b, c, d, x, s, t) { + return md5cmn(b & c | ~b & d, a, b, x, s, t); +} + +function md5gg(a, b, c, d, x, s, t) { + return md5cmn(b & d | c & ~d, a, b, x, s, t); +} + +function md5hh(a, b, c, d, x, s, t) { + return md5cmn(b ^ c ^ d, a, b, x, s, t); +} + +function md5ii(a, b, c, d, x, s, t) { + return md5cmn(c ^ (b | ~d), a, b, x, s, t); +} + +export default md5; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/native.js b/node_modules/uuid/dist/esm-browser/native.js new file mode 100644 index 0000000..b22292c --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/native.js @@ -0,0 +1,4 @@ +const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); +export default { + randomUUID +}; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/nil.js b/node_modules/uuid/dist/esm-browser/nil.js new file mode 100644 index 0000000..b36324c --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/nil.js @@ -0,0 +1 @@ +export default '00000000-0000-0000-0000-000000000000'; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/parse.js b/node_modules/uuid/dist/esm-browser/parse.js new file mode 100644 index 0000000..6421c5d --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/parse.js @@ -0,0 +1,35 @@ +import validate from './validate.js'; + +function parse(uuid) { + if (!validate(uuid)) { + throw TypeError('Invalid UUID'); + } + + let v; + const arr = new Uint8Array(16); // Parse ########-....-....-....-............ + + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 0xff; + arr[2] = v >>> 8 & 0xff; + arr[3] = v & 0xff; // Parse ........-####-....-....-............ + + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 0xff; // Parse ........-....-####-....-............ + + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 0xff; // Parse ........-....-....-####-............ + + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 0xff; // Parse ........-....-....-....-############ + // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) + + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; + arr[11] = v / 0x100000000 & 0xff; + arr[12] = v >>> 24 & 0xff; + arr[13] = v >>> 16 & 0xff; + arr[14] = v >>> 8 & 0xff; + arr[15] = v & 0xff; + return arr; +} + +export default parse; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/regex.js b/node_modules/uuid/dist/esm-browser/regex.js new file mode 100644 index 0000000..3da8673 --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/regex.js @@ -0,0 +1 @@ +export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/rng.js b/node_modules/uuid/dist/esm-browser/rng.js new file mode 100644 index 0000000..6e65234 --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/rng.js @@ -0,0 +1,18 @@ +// Unique ID creation requires a high quality random # generator. In the browser we therefore +// require the crypto API and do not support built-in fallback to lower quality random number +// generators (like Math.random()). +let getRandomValues; +const rnds8 = new Uint8Array(16); +export default function rng() { + // lazy load so that environments that need to polyfill have a chance to do so + if (!getRandomValues) { + // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. + getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); + + if (!getRandomValues) { + throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); + } + } + + return getRandomValues(rnds8); +} \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/sha1.js b/node_modules/uuid/dist/esm-browser/sha1.js new file mode 100644 index 0000000..d3c2565 --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/sha1.js @@ -0,0 +1,96 @@ +// Adapted from Chris Veness' SHA1 code at +// http://www.movable-type.co.uk/scripts/sha1.html +function f(s, x, y, z) { + switch (s) { + case 0: + return x & y ^ ~x & z; + + case 1: + return x ^ y ^ z; + + case 2: + return x & y ^ x & z ^ y & z; + + case 3: + return x ^ y ^ z; + } +} + +function ROTL(x, n) { + return x << n | x >>> 32 - n; +} + +function sha1(bytes) { + const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6]; + const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; + + if (typeof bytes === 'string') { + const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape + + bytes = []; + + for (let i = 0; i < msg.length; ++i) { + bytes.push(msg.charCodeAt(i)); + } + } else if (!Array.isArray(bytes)) { + // Convert Array-like to Array + bytes = Array.prototype.slice.call(bytes); + } + + bytes.push(0x80); + const l = bytes.length / 4 + 2; + const N = Math.ceil(l / 16); + const M = new Array(N); + + for (let i = 0; i < N; ++i) { + const arr = new Uint32Array(16); + + for (let j = 0; j < 16; ++j) { + arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3]; + } + + M[i] = arr; + } + + M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32); + M[N - 1][14] = Math.floor(M[N - 1][14]); + M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff; + + for (let i = 0; i < N; ++i) { + const W = new Uint32Array(80); + + for (let t = 0; t < 16; ++t) { + W[t] = M[i][t]; + } + + for (let t = 16; t < 80; ++t) { + W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1); + } + + let a = H[0]; + let b = H[1]; + let c = H[2]; + let d = H[3]; + let e = H[4]; + + for (let t = 0; t < 80; ++t) { + const s = Math.floor(t / 20); + const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0; + e = d; + d = c; + c = ROTL(b, 30) >>> 0; + b = a; + a = T; + } + + H[0] = H[0] + a >>> 0; + H[1] = H[1] + b >>> 0; + H[2] = H[2] + c >>> 0; + H[3] = H[3] + d >>> 0; + H[4] = H[4] + e >>> 0; + } + + return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff]; +} + +export default sha1; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/stringify.js b/node_modules/uuid/dist/esm-browser/stringify.js new file mode 100644 index 0000000..a6e4c88 --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/stringify.js @@ -0,0 +1,33 @@ +import validate from './validate.js'; +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ + +const byteToHex = []; + +for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 0x100).toString(16).slice(1)); +} + +export function unsafeStringify(arr, offset = 0) { + // Note: Be careful editing this code! It's been tuned for performance + // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; +} + +function stringify(arr, offset = 0) { + const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one + // of the following: + // - One or more input array values don't map to a hex octet (leading to + // "undefined" in the uuid) + // - Invalid input values for the RFC `version` or `variant` fields + + if (!validate(uuid)) { + throw TypeError('Stringified UUID is invalid'); + } + + return uuid; +} + +export default stringify; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/v1.js b/node_modules/uuid/dist/esm-browser/v1.js new file mode 100644 index 0000000..382e5d7 --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/v1.js @@ -0,0 +1,95 @@ +import rng from './rng.js'; +import { unsafeStringify } from './stringify.js'; // **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html + +let _nodeId; + +let _clockseq; // Previous uuid creation time + + +let _lastMSecs = 0; +let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details + +function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not + // specified. We do this lazily to minimize issues related to insufficient + // system entropy. See #189 + + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || rng)(); + + if (node == null) { + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + + if (clockseq == null) { + // Per 4.2.2, randomize (14 bit) clockseq + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; + } + } // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. + + + let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock + + let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) + + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression + + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval + + + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } // Per 4.2.1.2 Throw error if too many uuids are requested + + + if (nsecs >= 10000) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } + + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + + msecs += 12219292800000; // `time_low` + + const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; // `time_mid` + + const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; // `time_high_and_version` + + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + + b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + + b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` + + b[i++] = clockseq & 0xff; // `node` + + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + + return buf || unsafeStringify(b); +} + +export default v1; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/v3.js b/node_modules/uuid/dist/esm-browser/v3.js new file mode 100644 index 0000000..09063b8 --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/v3.js @@ -0,0 +1,4 @@ +import v35 from './v35.js'; +import md5 from './md5.js'; +const v3 = v35('v3', 0x30, md5); +export default v3; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/v35.js b/node_modules/uuid/dist/esm-browser/v35.js new file mode 100644 index 0000000..3355e1f --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/v35.js @@ -0,0 +1,66 @@ +import { unsafeStringify } from './stringify.js'; +import parse from './parse.js'; + +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); // UTF8 escape + + const bytes = []; + + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } + + return bytes; +} + +export const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; +export const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; +export default function v35(name, version, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + var _namespace; + + if (typeof value === 'string') { + value = stringToBytes(value); + } + + if (typeof namespace === 'string') { + namespace = parse(namespace); + } + + if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) { + throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); + } // Compute hash of namespace and value, Per 4.3 + // Future: Use spread syntax when supported on all platforms, e.g. `bytes = + // hashfunc([...namespace, ... value])` + + + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 0x0f | version; + bytes[8] = bytes[8] & 0x3f | 0x80; + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; + } + + return buf; + } + + return unsafeStringify(bytes); + } // Function#name is not settable on some platforms (#270) + + + try { + generateUUID.name = name; // eslint-disable-next-line no-empty + } catch (err) {} // For CommonJS default export support + + + generateUUID.DNS = DNS; + generateUUID.URL = URL; + return generateUUID; +} \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/v4.js b/node_modules/uuid/dist/esm-browser/v4.js new file mode 100644 index 0000000..95ea879 --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/v4.js @@ -0,0 +1,29 @@ +import native from './native.js'; +import rng from './rng.js'; +import { unsafeStringify } from './stringify.js'; + +function v4(options, buf, offset) { + if (native.randomUUID && !buf && !options) { + return native.randomUUID(); + } + + options = options || {}; + const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; + } + + return buf; + } + + return unsafeStringify(rnds); +} + +export default v4; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/v5.js b/node_modules/uuid/dist/esm-browser/v5.js new file mode 100644 index 0000000..e87fe31 --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/v5.js @@ -0,0 +1,4 @@ +import v35 from './v35.js'; +import sha1 from './sha1.js'; +const v5 = v35('v5', 0x50, sha1); +export default v5; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/validate.js b/node_modules/uuid/dist/esm-browser/validate.js new file mode 100644 index 0000000..f1cdc7a --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/validate.js @@ -0,0 +1,7 @@ +import REGEX from './regex.js'; + +function validate(uuid) { + return typeof uuid === 'string' && REGEX.test(uuid); +} + +export default validate; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-browser/version.js b/node_modules/uuid/dist/esm-browser/version.js new file mode 100644 index 0000000..9363076 --- /dev/null +++ b/node_modules/uuid/dist/esm-browser/version.js @@ -0,0 +1,11 @@ +import validate from './validate.js'; + +function version(uuid) { + if (!validate(uuid)) { + throw TypeError('Invalid UUID'); + } + + return parseInt(uuid.slice(14, 15), 16); +} + +export default version; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/index.js b/node_modules/uuid/dist/esm-node/index.js new file mode 100644 index 0000000..1db6f6d --- /dev/null +++ b/node_modules/uuid/dist/esm-node/index.js @@ -0,0 +1,9 @@ +export { default as v1 } from './v1.js'; +export { default as v3 } from './v3.js'; +export { default as v4 } from './v4.js'; +export { default as v5 } from './v5.js'; +export { default as NIL } from './nil.js'; +export { default as version } from './version.js'; +export { default as validate } from './validate.js'; +export { default as stringify } from './stringify.js'; +export { default as parse } from './parse.js'; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/md5.js b/node_modules/uuid/dist/esm-node/md5.js new file mode 100644 index 0000000..4d68b04 --- /dev/null +++ b/node_modules/uuid/dist/esm-node/md5.js @@ -0,0 +1,13 @@ +import crypto from 'crypto'; + +function md5(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return crypto.createHash('md5').update(bytes).digest(); +} + +export default md5; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/native.js b/node_modules/uuid/dist/esm-node/native.js new file mode 100644 index 0000000..f0d1992 --- /dev/null +++ b/node_modules/uuid/dist/esm-node/native.js @@ -0,0 +1,4 @@ +import crypto from 'crypto'; +export default { + randomUUID: crypto.randomUUID +}; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/nil.js b/node_modules/uuid/dist/esm-node/nil.js new file mode 100644 index 0000000..b36324c --- /dev/null +++ b/node_modules/uuid/dist/esm-node/nil.js @@ -0,0 +1 @@ +export default '00000000-0000-0000-0000-000000000000'; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/parse.js b/node_modules/uuid/dist/esm-node/parse.js new file mode 100644 index 0000000..6421c5d --- /dev/null +++ b/node_modules/uuid/dist/esm-node/parse.js @@ -0,0 +1,35 @@ +import validate from './validate.js'; + +function parse(uuid) { + if (!validate(uuid)) { + throw TypeError('Invalid UUID'); + } + + let v; + const arr = new Uint8Array(16); // Parse ########-....-....-....-............ + + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 0xff; + arr[2] = v >>> 8 & 0xff; + arr[3] = v & 0xff; // Parse ........-####-....-....-............ + + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 0xff; // Parse ........-....-####-....-............ + + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 0xff; // Parse ........-....-....-####-............ + + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 0xff; // Parse ........-....-....-....-############ + // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) + + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; + arr[11] = v / 0x100000000 & 0xff; + arr[12] = v >>> 24 & 0xff; + arr[13] = v >>> 16 & 0xff; + arr[14] = v >>> 8 & 0xff; + arr[15] = v & 0xff; + return arr; +} + +export default parse; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/regex.js b/node_modules/uuid/dist/esm-node/regex.js new file mode 100644 index 0000000..3da8673 --- /dev/null +++ b/node_modules/uuid/dist/esm-node/regex.js @@ -0,0 +1 @@ +export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/rng.js b/node_modules/uuid/dist/esm-node/rng.js new file mode 100644 index 0000000..8006244 --- /dev/null +++ b/node_modules/uuid/dist/esm-node/rng.js @@ -0,0 +1,12 @@ +import crypto from 'crypto'; +const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate + +let poolPtr = rnds8Pool.length; +export default function rng() { + if (poolPtr > rnds8Pool.length - 16) { + crypto.randomFillSync(rnds8Pool); + poolPtr = 0; + } + + return rnds8Pool.slice(poolPtr, poolPtr += 16); +} \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/sha1.js b/node_modules/uuid/dist/esm-node/sha1.js new file mode 100644 index 0000000..e23850b --- /dev/null +++ b/node_modules/uuid/dist/esm-node/sha1.js @@ -0,0 +1,13 @@ +import crypto from 'crypto'; + +function sha1(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return crypto.createHash('sha1').update(bytes).digest(); +} + +export default sha1; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/stringify.js b/node_modules/uuid/dist/esm-node/stringify.js new file mode 100644 index 0000000..a6e4c88 --- /dev/null +++ b/node_modules/uuid/dist/esm-node/stringify.js @@ -0,0 +1,33 @@ +import validate from './validate.js'; +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ + +const byteToHex = []; + +for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 0x100).toString(16).slice(1)); +} + +export function unsafeStringify(arr, offset = 0) { + // Note: Be careful editing this code! It's been tuned for performance + // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; +} + +function stringify(arr, offset = 0) { + const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one + // of the following: + // - One or more input array values don't map to a hex octet (leading to + // "undefined" in the uuid) + // - Invalid input values for the RFC `version` or `variant` fields + + if (!validate(uuid)) { + throw TypeError('Stringified UUID is invalid'); + } + + return uuid; +} + +export default stringify; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/v1.js b/node_modules/uuid/dist/esm-node/v1.js new file mode 100644 index 0000000..382e5d7 --- /dev/null +++ b/node_modules/uuid/dist/esm-node/v1.js @@ -0,0 +1,95 @@ +import rng from './rng.js'; +import { unsafeStringify } from './stringify.js'; // **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html + +let _nodeId; + +let _clockseq; // Previous uuid creation time + + +let _lastMSecs = 0; +let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details + +function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not + // specified. We do this lazily to minimize issues related to insufficient + // system entropy. See #189 + + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || rng)(); + + if (node == null) { + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + + if (clockseq == null) { + // Per 4.2.2, randomize (14 bit) clockseq + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; + } + } // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. + + + let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock + + let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) + + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression + + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval + + + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } // Per 4.2.1.2 Throw error if too many uuids are requested + + + if (nsecs >= 10000) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } + + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + + msecs += 12219292800000; // `time_low` + + const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; // `time_mid` + + const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; // `time_high_and_version` + + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + + b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + + b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` + + b[i++] = clockseq & 0xff; // `node` + + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + + return buf || unsafeStringify(b); +} + +export default v1; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/v3.js b/node_modules/uuid/dist/esm-node/v3.js new file mode 100644 index 0000000..09063b8 --- /dev/null +++ b/node_modules/uuid/dist/esm-node/v3.js @@ -0,0 +1,4 @@ +import v35 from './v35.js'; +import md5 from './md5.js'; +const v3 = v35('v3', 0x30, md5); +export default v3; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/v35.js b/node_modules/uuid/dist/esm-node/v35.js new file mode 100644 index 0000000..3355e1f --- /dev/null +++ b/node_modules/uuid/dist/esm-node/v35.js @@ -0,0 +1,66 @@ +import { unsafeStringify } from './stringify.js'; +import parse from './parse.js'; + +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); // UTF8 escape + + const bytes = []; + + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } + + return bytes; +} + +export const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; +export const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; +export default function v35(name, version, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + var _namespace; + + if (typeof value === 'string') { + value = stringToBytes(value); + } + + if (typeof namespace === 'string') { + namespace = parse(namespace); + } + + if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) { + throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); + } // Compute hash of namespace and value, Per 4.3 + // Future: Use spread syntax when supported on all platforms, e.g. `bytes = + // hashfunc([...namespace, ... value])` + + + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 0x0f | version; + bytes[8] = bytes[8] & 0x3f | 0x80; + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; + } + + return buf; + } + + return unsafeStringify(bytes); + } // Function#name is not settable on some platforms (#270) + + + try { + generateUUID.name = name; // eslint-disable-next-line no-empty + } catch (err) {} // For CommonJS default export support + + + generateUUID.DNS = DNS; + generateUUID.URL = URL; + return generateUUID; +} \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/v4.js b/node_modules/uuid/dist/esm-node/v4.js new file mode 100644 index 0000000..95ea879 --- /dev/null +++ b/node_modules/uuid/dist/esm-node/v4.js @@ -0,0 +1,29 @@ +import native from './native.js'; +import rng from './rng.js'; +import { unsafeStringify } from './stringify.js'; + +function v4(options, buf, offset) { + if (native.randomUUID && !buf && !options) { + return native.randomUUID(); + } + + options = options || {}; + const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; + } + + return buf; + } + + return unsafeStringify(rnds); +} + +export default v4; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/v5.js b/node_modules/uuid/dist/esm-node/v5.js new file mode 100644 index 0000000..e87fe31 --- /dev/null +++ b/node_modules/uuid/dist/esm-node/v5.js @@ -0,0 +1,4 @@ +import v35 from './v35.js'; +import sha1 from './sha1.js'; +const v5 = v35('v5', 0x50, sha1); +export default v5; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/validate.js b/node_modules/uuid/dist/esm-node/validate.js new file mode 100644 index 0000000..f1cdc7a --- /dev/null +++ b/node_modules/uuid/dist/esm-node/validate.js @@ -0,0 +1,7 @@ +import REGEX from './regex.js'; + +function validate(uuid) { + return typeof uuid === 'string' && REGEX.test(uuid); +} + +export default validate; \ No newline at end of file diff --git a/node_modules/uuid/dist/esm-node/version.js b/node_modules/uuid/dist/esm-node/version.js new file mode 100644 index 0000000..9363076 --- /dev/null +++ b/node_modules/uuid/dist/esm-node/version.js @@ -0,0 +1,11 @@ +import validate from './validate.js'; + +function version(uuid) { + if (!validate(uuid)) { + throw TypeError('Invalid UUID'); + } + + return parseInt(uuid.slice(14, 15), 16); +} + +export default version; \ No newline at end of file diff --git a/node_modules/uuid/dist/index.js b/node_modules/uuid/dist/index.js new file mode 100644 index 0000000..88d676a --- /dev/null +++ b/node_modules/uuid/dist/index.js @@ -0,0 +1,79 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "NIL", { + enumerable: true, + get: function () { + return _nil.default; + } +}); +Object.defineProperty(exports, "parse", { + enumerable: true, + get: function () { + return _parse.default; + } +}); +Object.defineProperty(exports, "stringify", { + enumerable: true, + get: function () { + return _stringify.default; + } +}); +Object.defineProperty(exports, "v1", { + enumerable: true, + get: function () { + return _v.default; + } +}); +Object.defineProperty(exports, "v3", { + enumerable: true, + get: function () { + return _v2.default; + } +}); +Object.defineProperty(exports, "v4", { + enumerable: true, + get: function () { + return _v3.default; + } +}); +Object.defineProperty(exports, "v5", { + enumerable: true, + get: function () { + return _v4.default; + } +}); +Object.defineProperty(exports, "validate", { + enumerable: true, + get: function () { + return _validate.default; + } +}); +Object.defineProperty(exports, "version", { + enumerable: true, + get: function () { + return _version.default; + } +}); + +var _v = _interopRequireDefault(require("./v1.js")); + +var _v2 = _interopRequireDefault(require("./v3.js")); + +var _v3 = _interopRequireDefault(require("./v4.js")); + +var _v4 = _interopRequireDefault(require("./v5.js")); + +var _nil = _interopRequireDefault(require("./nil.js")); + +var _version = _interopRequireDefault(require("./version.js")); + +var _validate = _interopRequireDefault(require("./validate.js")); + +var _stringify = _interopRequireDefault(require("./stringify.js")); + +var _parse = _interopRequireDefault(require("./parse.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } \ No newline at end of file diff --git a/node_modules/uuid/dist/md5-browser.js b/node_modules/uuid/dist/md5-browser.js new file mode 100644 index 0000000..7a4582a --- /dev/null +++ b/node_modules/uuid/dist/md5-browser.js @@ -0,0 +1,223 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/* + * Browser-compatible JavaScript MD5 + * + * Modification of JavaScript MD5 + * https://github.com/blueimp/JavaScript-MD5 + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + * + * Based on + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ +function md5(bytes) { + if (typeof bytes === 'string') { + const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape + + bytes = new Uint8Array(msg.length); + + for (let i = 0; i < msg.length; ++i) { + bytes[i] = msg.charCodeAt(i); + } + } + + return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8)); +} +/* + * Convert an array of little-endian words to an array of bytes + */ + + +function md5ToHexEncodedArray(input) { + const output = []; + const length32 = input.length * 32; + const hexTab = '0123456789abcdef'; + + for (let i = 0; i < length32; i += 8) { + const x = input[i >> 5] >>> i % 32 & 0xff; + const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16); + output.push(hex); + } + + return output; +} +/** + * Calculate output length with padding and bit length + */ + + +function getOutputLength(inputLength8) { + return (inputLength8 + 64 >>> 9 << 4) + 14 + 1; +} +/* + * Calculate the MD5 of an array of little-endian words, and a bit length. + */ + + +function wordsToMd5(x, len) { + /* append padding */ + x[len >> 5] |= 0x80 << len % 32; + x[getOutputLength(len) - 1] = len; + let a = 1732584193; + let b = -271733879; + let c = -1732584194; + let d = 271733878; + + for (let i = 0; i < x.length; i += 16) { + const olda = a; + const oldb = b; + const oldc = c; + const oldd = d; + a = md5ff(a, b, c, d, x[i], 7, -680876936); + d = md5ff(d, a, b, c, x[i + 1], 12, -389564586); + c = md5ff(c, d, a, b, x[i + 2], 17, 606105819); + b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330); + a = md5ff(a, b, c, d, x[i + 4], 7, -176418897); + d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426); + c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341); + b = md5ff(b, c, d, a, x[i + 7], 22, -45705983); + a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416); + d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417); + c = md5ff(c, d, a, b, x[i + 10], 17, -42063); + b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162); + a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682); + d = md5ff(d, a, b, c, x[i + 13], 12, -40341101); + c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290); + b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329); + a = md5gg(a, b, c, d, x[i + 1], 5, -165796510); + d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632); + c = md5gg(c, d, a, b, x[i + 11], 14, 643717713); + b = md5gg(b, c, d, a, x[i], 20, -373897302); + a = md5gg(a, b, c, d, x[i + 5], 5, -701558691); + d = md5gg(d, a, b, c, x[i + 10], 9, 38016083); + c = md5gg(c, d, a, b, x[i + 15], 14, -660478335); + b = md5gg(b, c, d, a, x[i + 4], 20, -405537848); + a = md5gg(a, b, c, d, x[i + 9], 5, 568446438); + d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690); + c = md5gg(c, d, a, b, x[i + 3], 14, -187363961); + b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501); + a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467); + d = md5gg(d, a, b, c, x[i + 2], 9, -51403784); + c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473); + b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734); + a = md5hh(a, b, c, d, x[i + 5], 4, -378558); + d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463); + c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562); + b = md5hh(b, c, d, a, x[i + 14], 23, -35309556); + a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060); + d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353); + c = md5hh(c, d, a, b, x[i + 7], 16, -155497632); + b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640); + a = md5hh(a, b, c, d, x[i + 13], 4, 681279174); + d = md5hh(d, a, b, c, x[i], 11, -358537222); + c = md5hh(c, d, a, b, x[i + 3], 16, -722521979); + b = md5hh(b, c, d, a, x[i + 6], 23, 76029189); + a = md5hh(a, b, c, d, x[i + 9], 4, -640364487); + d = md5hh(d, a, b, c, x[i + 12], 11, -421815835); + c = md5hh(c, d, a, b, x[i + 15], 16, 530742520); + b = md5hh(b, c, d, a, x[i + 2], 23, -995338651); + a = md5ii(a, b, c, d, x[i], 6, -198630844); + d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415); + c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905); + b = md5ii(b, c, d, a, x[i + 5], 21, -57434055); + a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571); + d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606); + c = md5ii(c, d, a, b, x[i + 10], 15, -1051523); + b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799); + a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359); + d = md5ii(d, a, b, c, x[i + 15], 10, -30611744); + c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380); + b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649); + a = md5ii(a, b, c, d, x[i + 4], 6, -145523070); + d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379); + c = md5ii(c, d, a, b, x[i + 2], 15, 718787259); + b = md5ii(b, c, d, a, x[i + 9], 21, -343485551); + a = safeAdd(a, olda); + b = safeAdd(b, oldb); + c = safeAdd(c, oldc); + d = safeAdd(d, oldd); + } + + return [a, b, c, d]; +} +/* + * Convert an array bytes to an array of little-endian words + * Characters >255 have their high-byte silently ignored. + */ + + +function bytesToWords(input) { + if (input.length === 0) { + return []; + } + + const length8 = input.length * 8; + const output = new Uint32Array(getOutputLength(length8)); + + for (let i = 0; i < length8; i += 8) { + output[i >> 5] |= (input[i / 8] & 0xff) << i % 32; + } + + return output; +} +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ + + +function safeAdd(x, y) { + const lsw = (x & 0xffff) + (y & 0xffff); + const msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return msw << 16 | lsw & 0xffff; +} +/* + * Bitwise rotate a 32-bit number to the left. + */ + + +function bitRotateLeft(num, cnt) { + return num << cnt | num >>> 32 - cnt; +} +/* + * These functions implement the four basic operations the algorithm uses. + */ + + +function md5cmn(q, a, b, x, s, t) { + return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b); +} + +function md5ff(a, b, c, d, x, s, t) { + return md5cmn(b & c | ~b & d, a, b, x, s, t); +} + +function md5gg(a, b, c, d, x, s, t) { + return md5cmn(b & d | c & ~d, a, b, x, s, t); +} + +function md5hh(a, b, c, d, x, s, t) { + return md5cmn(b ^ c ^ d, a, b, x, s, t); +} + +function md5ii(a, b, c, d, x, s, t) { + return md5cmn(c ^ (b | ~d), a, b, x, s, t); +} + +var _default = md5; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/md5.js b/node_modules/uuid/dist/md5.js new file mode 100644 index 0000000..824d481 --- /dev/null +++ b/node_modules/uuid/dist/md5.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _crypto = _interopRequireDefault(require("crypto")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function md5(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('md5').update(bytes).digest(); +} + +var _default = md5; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/native-browser.js b/node_modules/uuid/dist/native-browser.js new file mode 100644 index 0000000..c2eea59 --- /dev/null +++ b/node_modules/uuid/dist/native-browser.js @@ -0,0 +1,11 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); +var _default = { + randomUUID +}; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/native.js b/node_modules/uuid/dist/native.js new file mode 100644 index 0000000..de80469 --- /dev/null +++ b/node_modules/uuid/dist/native.js @@ -0,0 +1,15 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _crypto = _interopRequireDefault(require("crypto")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var _default = { + randomUUID: _crypto.default.randomUUID +}; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/nil.js b/node_modules/uuid/dist/nil.js new file mode 100644 index 0000000..7ade577 --- /dev/null +++ b/node_modules/uuid/dist/nil.js @@ -0,0 +1,8 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _default = '00000000-0000-0000-0000-000000000000'; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/parse.js b/node_modules/uuid/dist/parse.js new file mode 100644 index 0000000..4c69fc3 --- /dev/null +++ b/node_modules/uuid/dist/parse.js @@ -0,0 +1,45 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _validate = _interopRequireDefault(require("./validate.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function parse(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } + + let v; + const arr = new Uint8Array(16); // Parse ########-....-....-....-............ + + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 0xff; + arr[2] = v >>> 8 & 0xff; + arr[3] = v & 0xff; // Parse ........-####-....-....-............ + + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 0xff; // Parse ........-....-####-....-............ + + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 0xff; // Parse ........-....-....-####-............ + + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 0xff; // Parse ........-....-....-....-############ + // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) + + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; + arr[11] = v / 0x100000000 & 0xff; + arr[12] = v >>> 24 & 0xff; + arr[13] = v >>> 16 & 0xff; + arr[14] = v >>> 8 & 0xff; + arr[15] = v & 0xff; + return arr; +} + +var _default = parse; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/regex.js b/node_modules/uuid/dist/regex.js new file mode 100644 index 0000000..1ef91d6 --- /dev/null +++ b/node_modules/uuid/dist/regex.js @@ -0,0 +1,8 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/rng-browser.js b/node_modules/uuid/dist/rng-browser.js new file mode 100644 index 0000000..d067cdb --- /dev/null +++ b/node_modules/uuid/dist/rng-browser.js @@ -0,0 +1,25 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = rng; +// Unique ID creation requires a high quality random # generator. In the browser we therefore +// require the crypto API and do not support built-in fallback to lower quality random number +// generators (like Math.random()). +let getRandomValues; +const rnds8 = new Uint8Array(16); + +function rng() { + // lazy load so that environments that need to polyfill have a chance to do so + if (!getRandomValues) { + // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. + getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); + + if (!getRandomValues) { + throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); + } + } + + return getRandomValues(rnds8); +} \ No newline at end of file diff --git a/node_modules/uuid/dist/rng.js b/node_modules/uuid/dist/rng.js new file mode 100644 index 0000000..3507f93 --- /dev/null +++ b/node_modules/uuid/dist/rng.js @@ -0,0 +1,24 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = rng; + +var _crypto = _interopRequireDefault(require("crypto")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate + +let poolPtr = rnds8Pool.length; + +function rng() { + if (poolPtr > rnds8Pool.length - 16) { + _crypto.default.randomFillSync(rnds8Pool); + + poolPtr = 0; + } + + return rnds8Pool.slice(poolPtr, poolPtr += 16); +} \ No newline at end of file diff --git a/node_modules/uuid/dist/sha1-browser.js b/node_modules/uuid/dist/sha1-browser.js new file mode 100644 index 0000000..24cbced --- /dev/null +++ b/node_modules/uuid/dist/sha1-browser.js @@ -0,0 +1,104 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +// Adapted from Chris Veness' SHA1 code at +// http://www.movable-type.co.uk/scripts/sha1.html +function f(s, x, y, z) { + switch (s) { + case 0: + return x & y ^ ~x & z; + + case 1: + return x ^ y ^ z; + + case 2: + return x & y ^ x & z ^ y & z; + + case 3: + return x ^ y ^ z; + } +} + +function ROTL(x, n) { + return x << n | x >>> 32 - n; +} + +function sha1(bytes) { + const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6]; + const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; + + if (typeof bytes === 'string') { + const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape + + bytes = []; + + for (let i = 0; i < msg.length; ++i) { + bytes.push(msg.charCodeAt(i)); + } + } else if (!Array.isArray(bytes)) { + // Convert Array-like to Array + bytes = Array.prototype.slice.call(bytes); + } + + bytes.push(0x80); + const l = bytes.length / 4 + 2; + const N = Math.ceil(l / 16); + const M = new Array(N); + + for (let i = 0; i < N; ++i) { + const arr = new Uint32Array(16); + + for (let j = 0; j < 16; ++j) { + arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3]; + } + + M[i] = arr; + } + + M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32); + M[N - 1][14] = Math.floor(M[N - 1][14]); + M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff; + + for (let i = 0; i < N; ++i) { + const W = new Uint32Array(80); + + for (let t = 0; t < 16; ++t) { + W[t] = M[i][t]; + } + + for (let t = 16; t < 80; ++t) { + W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1); + } + + let a = H[0]; + let b = H[1]; + let c = H[2]; + let d = H[3]; + let e = H[4]; + + for (let t = 0; t < 80; ++t) { + const s = Math.floor(t / 20); + const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0; + e = d; + d = c; + c = ROTL(b, 30) >>> 0; + b = a; + a = T; + } + + H[0] = H[0] + a >>> 0; + H[1] = H[1] + b >>> 0; + H[2] = H[2] + c >>> 0; + H[3] = H[3] + d >>> 0; + H[4] = H[4] + e >>> 0; + } + + return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff]; +} + +var _default = sha1; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/sha1.js b/node_modules/uuid/dist/sha1.js new file mode 100644 index 0000000..03bdd63 --- /dev/null +++ b/node_modules/uuid/dist/sha1.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _crypto = _interopRequireDefault(require("crypto")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function sha1(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('sha1').update(bytes).digest(); +} + +var _default = sha1; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/stringify.js b/node_modules/uuid/dist/stringify.js new file mode 100644 index 0000000..390bf89 --- /dev/null +++ b/node_modules/uuid/dist/stringify.js @@ -0,0 +1,44 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +exports.unsafeStringify = unsafeStringify; + +var _validate = _interopRequireDefault(require("./validate.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ +const byteToHex = []; + +for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 0x100).toString(16).slice(1)); +} + +function unsafeStringify(arr, offset = 0) { + // Note: Be careful editing this code! It's been tuned for performance + // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; +} + +function stringify(arr, offset = 0) { + const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one + // of the following: + // - One or more input array values don't map to a hex octet (leading to + // "undefined" in the uuid) + // - Invalid input values for the RFC `version` or `variant` fields + + if (!(0, _validate.default)(uuid)) { + throw TypeError('Stringified UUID is invalid'); + } + + return uuid; +} + +var _default = stringify; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/uuid-bin.js b/node_modules/uuid/dist/uuid-bin.js new file mode 100644 index 0000000..50a7a9f --- /dev/null +++ b/node_modules/uuid/dist/uuid-bin.js @@ -0,0 +1,85 @@ +"use strict"; + +var _assert = _interopRequireDefault(require("assert")); + +var _v = _interopRequireDefault(require("./v1.js")); + +var _v2 = _interopRequireDefault(require("./v3.js")); + +var _v3 = _interopRequireDefault(require("./v4.js")); + +var _v4 = _interopRequireDefault(require("./v5.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function usage() { + console.log('Usage:'); + console.log(' uuid'); + console.log(' uuid v1'); + console.log(' uuid v3 '); + console.log(' uuid v4'); + console.log(' uuid v5 '); + console.log(' uuid --help'); + console.log('\nNote: may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC4122'); +} + +const args = process.argv.slice(2); + +if (args.indexOf('--help') >= 0) { + usage(); + process.exit(0); +} + +const version = args.shift() || 'v4'; + +switch (version) { + case 'v1': + console.log((0, _v.default)()); + break; + + case 'v3': + { + const name = args.shift(); + let namespace = args.shift(); + (0, _assert.default)(name != null, 'v3 name not specified'); + (0, _assert.default)(namespace != null, 'v3 namespace not specified'); + + if (namespace === 'URL') { + namespace = _v2.default.URL; + } + + if (namespace === 'DNS') { + namespace = _v2.default.DNS; + } + + console.log((0, _v2.default)(name, namespace)); + break; + } + + case 'v4': + console.log((0, _v3.default)()); + break; + + case 'v5': + { + const name = args.shift(); + let namespace = args.shift(); + (0, _assert.default)(name != null, 'v5 name not specified'); + (0, _assert.default)(namespace != null, 'v5 namespace not specified'); + + if (namespace === 'URL') { + namespace = _v4.default.URL; + } + + if (namespace === 'DNS') { + namespace = _v4.default.DNS; + } + + console.log((0, _v4.default)(name, namespace)); + break; + } + + default: + usage(); + process.exit(1); +} \ No newline at end of file diff --git a/node_modules/uuid/dist/v1.js b/node_modules/uuid/dist/v1.js new file mode 100644 index 0000000..125bc58 --- /dev/null +++ b/node_modules/uuid/dist/v1.js @@ -0,0 +1,107 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _rng = _interopRequireDefault(require("./rng.js")); + +var _stringify = require("./stringify.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html +let _nodeId; + +let _clockseq; // Previous uuid creation time + + +let _lastMSecs = 0; +let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details + +function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not + // specified. We do this lazily to minimize issues related to insufficient + // system entropy. See #189 + + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || _rng.default)(); + + if (node == null) { + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + + if (clockseq == null) { + // Per 4.2.2, randomize (14 bit) clockseq + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; + } + } // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. + + + let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock + + let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) + + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression + + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval + + + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } // Per 4.2.1.2 Throw error if too many uuids are requested + + + if (nsecs >= 10000) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } + + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + + msecs += 12219292800000; // `time_low` + + const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; // `time_mid` + + const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; // `time_high_and_version` + + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + + b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + + b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` + + b[i++] = clockseq & 0xff; // `node` + + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + + return buf || (0, _stringify.unsafeStringify)(b); +} + +var _default = v1; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/v3.js b/node_modules/uuid/dist/v3.js new file mode 100644 index 0000000..6b47ff5 --- /dev/null +++ b/node_modules/uuid/dist/v3.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _v = _interopRequireDefault(require("./v35.js")); + +var _md = _interopRequireDefault(require("./md5.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const v3 = (0, _v.default)('v3', 0x30, _md.default); +var _default = v3; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/v35.js b/node_modules/uuid/dist/v35.js new file mode 100644 index 0000000..7c522d9 --- /dev/null +++ b/node_modules/uuid/dist/v35.js @@ -0,0 +1,80 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.URL = exports.DNS = void 0; +exports.default = v35; + +var _stringify = require("./stringify.js"); + +var _parse = _interopRequireDefault(require("./parse.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); // UTF8 escape + + const bytes = []; + + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } + + return bytes; +} + +const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; +exports.DNS = DNS; +const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; +exports.URL = URL; + +function v35(name, version, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + var _namespace; + + if (typeof value === 'string') { + value = stringToBytes(value); + } + + if (typeof namespace === 'string') { + namespace = (0, _parse.default)(namespace); + } + + if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) { + throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); + } // Compute hash of namespace and value, Per 4.3 + // Future: Use spread syntax when supported on all platforms, e.g. `bytes = + // hashfunc([...namespace, ... value])` + + + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 0x0f | version; + bytes[8] = bytes[8] & 0x3f | 0x80; + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; + } + + return buf; + } + + return (0, _stringify.unsafeStringify)(bytes); + } // Function#name is not settable on some platforms (#270) + + + try { + generateUUID.name = name; // eslint-disable-next-line no-empty + } catch (err) {} // For CommonJS default export support + + + generateUUID.DNS = DNS; + generateUUID.URL = URL; + return generateUUID; +} \ No newline at end of file diff --git a/node_modules/uuid/dist/v4.js b/node_modules/uuid/dist/v4.js new file mode 100644 index 0000000..959d698 --- /dev/null +++ b/node_modules/uuid/dist/v4.js @@ -0,0 +1,43 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _native = _interopRequireDefault(require("./native.js")); + +var _rng = _interopRequireDefault(require("./rng.js")); + +var _stringify = require("./stringify.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function v4(options, buf, offset) { + if (_native.default.randomUUID && !buf && !options) { + return _native.default.randomUUID(); + } + + options = options || {}; + + const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + + + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; + } + + return buf; + } + + return (0, _stringify.unsafeStringify)(rnds); +} + +var _default = v4; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/v5.js b/node_modules/uuid/dist/v5.js new file mode 100644 index 0000000..99d615e --- /dev/null +++ b/node_modules/uuid/dist/v5.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _v = _interopRequireDefault(require("./v35.js")); + +var _sha = _interopRequireDefault(require("./sha1.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const v5 = (0, _v.default)('v5', 0x50, _sha.default); +var _default = v5; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/validate.js b/node_modules/uuid/dist/validate.js new file mode 100644 index 0000000..fd05215 --- /dev/null +++ b/node_modules/uuid/dist/validate.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _regex = _interopRequireDefault(require("./regex.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function validate(uuid) { + return typeof uuid === 'string' && _regex.default.test(uuid); +} + +var _default = validate; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/dist/version.js b/node_modules/uuid/dist/version.js new file mode 100644 index 0000000..f63af01 --- /dev/null +++ b/node_modules/uuid/dist/version.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _validate = _interopRequireDefault(require("./validate.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function version(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } + + return parseInt(uuid.slice(14, 15), 16); +} + +var _default = version; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/uuid/package.json b/node_modules/uuid/package.json new file mode 100644 index 0000000..6cc3361 --- /dev/null +++ b/node_modules/uuid/package.json @@ -0,0 +1,135 @@ +{ + "name": "uuid", + "version": "9.0.1", + "description": "RFC4122 (v1, v4, and v5) UUIDs", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "commitlint": { + "extends": [ + "@commitlint/config-conventional" + ] + }, + "keywords": [ + "uuid", + "guid", + "rfc4122" + ], + "license": "MIT", + "bin": { + "uuid": "./dist/bin/uuid" + }, + "sideEffects": false, + "main": "./dist/index.js", + "exports": { + ".": { + "node": { + "module": "./dist/esm-node/index.js", + "require": "./dist/index.js", + "import": "./wrapper.mjs" + }, + "browser": { + "import": "./dist/esm-browser/index.js", + "require": "./dist/commonjs-browser/index.js" + }, + "default": "./dist/esm-browser/index.js" + }, + "./package.json": "./package.json" + }, + "module": "./dist/esm-node/index.js", + "browser": { + "./dist/md5.js": "./dist/md5-browser.js", + "./dist/native.js": "./dist/native-browser.js", + "./dist/rng.js": "./dist/rng-browser.js", + "./dist/sha1.js": "./dist/sha1-browser.js", + "./dist/esm-node/index.js": "./dist/esm-browser/index.js" + }, + "files": [ + "CHANGELOG.md", + "CONTRIBUTING.md", + "LICENSE.md", + "README.md", + "dist", + "wrapper.mjs" + ], + "devDependencies": { + "@babel/cli": "7.18.10", + "@babel/core": "7.18.10", + "@babel/eslint-parser": "7.18.9", + "@babel/preset-env": "7.18.10", + "@commitlint/cli": "17.0.3", + "@commitlint/config-conventional": "17.0.3", + "bundlewatch": "0.3.3", + "eslint": "8.21.0", + "eslint-config-prettier": "8.5.0", + "eslint-config-standard": "17.0.0", + "eslint-plugin-import": "2.26.0", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-prettier": "4.2.1", + "eslint-plugin-promise": "6.0.0", + "husky": "8.0.1", + "jest": "28.1.3", + "lint-staged": "13.0.3", + "npm-run-all": "4.1.5", + "optional-dev-dependency": "2.0.1", + "prettier": "2.7.1", + "random-seed": "0.3.0", + "runmd": "1.3.9", + "standard-version": "9.5.0" + }, + "optionalDevDependencies": { + "@wdio/browserstack-service": "7.16.10", + "@wdio/cli": "7.16.10", + "@wdio/jasmine-framework": "7.16.6", + "@wdio/local-runner": "7.16.10", + "@wdio/spec-reporter": "7.16.9", + "@wdio/static-server-service": "7.16.6" + }, + "scripts": { + "examples:browser:webpack:build": "cd examples/browser-webpack && npm install && npm run build", + "examples:browser:rollup:build": "cd examples/browser-rollup && npm install && npm run build", + "examples:node:commonjs:test": "cd examples/node-commonjs && npm install && npm test", + "examples:node:esmodules:test": "cd examples/node-esmodules && npm install && npm test", + "examples:node:jest:test": "cd examples/node-jest && npm install && npm test", + "prepare": "cd $( git rev-parse --show-toplevel ) && husky install", + "lint": "npm run eslint:check && npm run prettier:check", + "eslint:check": "eslint src/ test/ examples/ *.js", + "eslint:fix": "eslint --fix src/ test/ examples/ *.js", + "pretest": "[ -n $CI ] || npm run build", + "test": "BABEL_ENV=commonjsNode node --throw-deprecation node_modules/.bin/jest test/unit/", + "pretest:browser": "optional-dev-dependency && npm run build && npm-run-all --parallel examples:browser:**", + "test:browser": "wdio run ./wdio.conf.js", + "pretest:node": "npm run build", + "test:node": "npm-run-all --parallel examples:node:**", + "test:pack": "./scripts/testpack.sh", + "pretest:benchmark": "npm run build", + "test:benchmark": "cd examples/benchmark && npm install && npm test", + "prettier:check": "prettier --check '**/*.{js,jsx,json,md}'", + "prettier:fix": "prettier --write '**/*.{js,jsx,json,md}'", + "bundlewatch": "npm run pretest:browser && bundlewatch --config bundlewatch.config.json", + "md": "runmd --watch --output=README.md README_js.md", + "docs": "( node --version | grep -q 'v18' ) && ( npm run build && npx runmd --output=README.md README_js.md )", + "docs:diff": "npm run docs && git diff --quiet README.md", + "build": "./scripts/build.sh", + "prepack": "npm run build", + "release": "standard-version --no-verify" + }, + "repository": { + "type": "git", + "url": "https://github.com/uuidjs/uuid.git" + }, + "lint-staged": { + "*.{js,jsx,json,md}": [ + "prettier --write" + ], + "*.{js,jsx}": [ + "eslint --fix" + ] + }, + "standard-version": { + "scripts": { + "postchangelog": "prettier --write CHANGELOG.md" + } + } +} diff --git a/node_modules/uuid/wrapper.mjs b/node_modules/uuid/wrapper.mjs new file mode 100644 index 0000000..c31e9ce --- /dev/null +++ b/node_modules/uuid/wrapper.mjs @@ -0,0 +1,10 @@ +import uuid from './dist/index.js'; +export const v1 = uuid.v1; +export const v3 = uuid.v3; +export const v4 = uuid.v4; +export const v5 = uuid.v5; +export const NIL = uuid.NIL; +export const version = uuid.version; +export const validate = uuid.validate; +export const stringify = uuid.stringify; +export const parse = uuid.parse; diff --git a/backend/node_modules/vary/HISTORY.md b/node_modules/vary/HISTORY.md similarity index 100% rename from backend/node_modules/vary/HISTORY.md rename to node_modules/vary/HISTORY.md diff --git a/backend/node_modules/vary/LICENSE b/node_modules/vary/LICENSE similarity index 100% rename from backend/node_modules/vary/LICENSE rename to node_modules/vary/LICENSE diff --git a/backend/node_modules/vary/README.md b/node_modules/vary/README.md similarity index 100% rename from backend/node_modules/vary/README.md rename to node_modules/vary/README.md diff --git a/backend/node_modules/vary/index.js b/node_modules/vary/index.js similarity index 100% rename from backend/node_modules/vary/index.js rename to node_modules/vary/index.js diff --git a/backend/node_modules/vary/package.json b/node_modules/vary/package.json similarity index 100% rename from backend/node_modules/vary/package.json rename to node_modules/vary/package.json diff --git a/backend/node_modules/ws/LICENSE b/node_modules/ws/LICENSE similarity index 100% rename from backend/node_modules/ws/LICENSE rename to node_modules/ws/LICENSE diff --git a/backend/node_modules/ws/README.md b/node_modules/ws/README.md similarity index 100% rename from backend/node_modules/ws/README.md rename to node_modules/ws/README.md diff --git a/backend/node_modules/ws/browser.js b/node_modules/ws/browser.js similarity index 100% rename from backend/node_modules/ws/browser.js rename to node_modules/ws/browser.js diff --git a/backend/node_modules/ws/index.js b/node_modules/ws/index.js similarity index 100% rename from backend/node_modules/ws/index.js rename to node_modules/ws/index.js diff --git a/backend/node_modules/ws/lib/buffer-util.js b/node_modules/ws/lib/buffer-util.js similarity index 100% rename from backend/node_modules/ws/lib/buffer-util.js rename to node_modules/ws/lib/buffer-util.js diff --git a/backend/node_modules/ws/lib/constants.js b/node_modules/ws/lib/constants.js similarity index 100% rename from backend/node_modules/ws/lib/constants.js rename to node_modules/ws/lib/constants.js diff --git a/backend/node_modules/ws/lib/event-target.js b/node_modules/ws/lib/event-target.js similarity index 100% rename from backend/node_modules/ws/lib/event-target.js rename to node_modules/ws/lib/event-target.js diff --git a/backend/node_modules/ws/lib/extension.js b/node_modules/ws/lib/extension.js similarity index 100% rename from backend/node_modules/ws/lib/extension.js rename to node_modules/ws/lib/extension.js diff --git a/backend/node_modules/ws/lib/limiter.js b/node_modules/ws/lib/limiter.js similarity index 100% rename from backend/node_modules/ws/lib/limiter.js rename to node_modules/ws/lib/limiter.js diff --git a/backend/node_modules/ws/lib/permessage-deflate.js b/node_modules/ws/lib/permessage-deflate.js similarity index 100% rename from backend/node_modules/ws/lib/permessage-deflate.js rename to node_modules/ws/lib/permessage-deflate.js diff --git a/backend/node_modules/ws/lib/receiver.js b/node_modules/ws/lib/receiver.js similarity index 100% rename from backend/node_modules/ws/lib/receiver.js rename to node_modules/ws/lib/receiver.js diff --git a/backend/node_modules/ws/lib/sender.js b/node_modules/ws/lib/sender.js similarity index 100% rename from backend/node_modules/ws/lib/sender.js rename to node_modules/ws/lib/sender.js diff --git a/backend/node_modules/ws/lib/stream.js b/node_modules/ws/lib/stream.js similarity index 100% rename from backend/node_modules/ws/lib/stream.js rename to node_modules/ws/lib/stream.js diff --git a/backend/node_modules/ws/lib/subprotocol.js b/node_modules/ws/lib/subprotocol.js similarity index 100% rename from backend/node_modules/ws/lib/subprotocol.js rename to node_modules/ws/lib/subprotocol.js diff --git a/backend/node_modules/ws/lib/validation.js b/node_modules/ws/lib/validation.js similarity index 100% rename from backend/node_modules/ws/lib/validation.js rename to node_modules/ws/lib/validation.js diff --git a/backend/node_modules/ws/lib/websocket-server.js b/node_modules/ws/lib/websocket-server.js similarity index 100% rename from backend/node_modules/ws/lib/websocket-server.js rename to node_modules/ws/lib/websocket-server.js diff --git a/backend/node_modules/ws/lib/websocket.js b/node_modules/ws/lib/websocket.js similarity index 100% rename from backend/node_modules/ws/lib/websocket.js rename to node_modules/ws/lib/websocket.js diff --git a/backend/node_modules/ws/package.json b/node_modules/ws/package.json similarity index 100% rename from backend/node_modules/ws/package.json rename to node_modules/ws/package.json diff --git a/backend/node_modules/ws/wrapper.mjs b/node_modules/ws/wrapper.mjs similarity index 100% rename from backend/node_modules/ws/wrapper.mjs rename to node_modules/ws/wrapper.mjs diff --git a/backend/package-lock.json b/package-lock.json similarity index 96% rename from backend/package-lock.json rename to package-lock.json index 82a5223..9d042ac 100644 --- a/backend/package-lock.json +++ b/package-lock.json @@ -1,17 +1,18 @@ { - "name": "chessnut-backend", + "name": "chessnut-server", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "chessnut-backend", + "name": "chessnut-server", "version": "0.1.0", + "license": "MIT", "dependencies": { - "body-parser": "^1.20.2", - "cors": "^2.8.5", + "chess.js": "^1.1.2", "express": "^4.18.2", - "socket.io": "^4.7.1" + "socket.io": "^4.7.2", + "uuid": "^9.0.0" } }, "node_modules/@socket.io/component-emitter": { @@ -30,12 +31,12 @@ } }, "node_modules/@types/node": { - "version": "24.7.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.7.2.tgz", - "integrity": "sha512-/NbVmcGTP+lj5oa4yiYxxeBjRivKQ5Ns1eSZeB99ExsEQ6rX5XYU1Zy/gGxY/ilqtD4Etx9mKyrPxZRetiahhA==", + "version": "24.10.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.0.tgz", + "integrity": "sha512-qzQZRBqkFsYyaSWXuEHc2WR9c0a0CXwiE5FWUvn7ZM+vdy1uZLfCunD38UzhuB7YN/J11ndbDBcTmOdxJo9Q7A==", "license": "MIT", "dependencies": { - "undici-types": "~7.14.0" + "undici-types": "~7.16.0" } }, "node_modules/accepts": { @@ -128,6 +129,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/chess.js": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/chess.js/-/chess.js-1.4.0.tgz", + "integrity": "sha512-BBJgrrtKQOzFLonR0l+k64A98NLemPwNsCskwb+29bRwobUa4iTm51E1kwGPbWXAcfdDa18nad6vpPPKPWarqw==", + "license": "BSD-2-Clause" + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -1031,9 +1038,9 @@ } }, "node_modules/undici-types": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.14.0.tgz", - "integrity": "sha512-QQiYxHuyZ9gQUIrmPo3IA+hUl4KYk8uSA7cHrcKd/l3p1OTpZcM0Tbp9x7FAtXdAYhlasd60ncPpgu6ihG6TOA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", "license": "MIT" }, "node_modules/unpipe": { @@ -1054,6 +1061,19 @@ "node": ">= 0.4.0" } }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/package.json b/package.json new file mode 100644 index 0000000..d20ea26 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "chessnut-server", + "version": "0.1.0", + "description": "Lightweight chess server with rooms for 2 players, real-time via Socket.IO", + "main": "server.js", + "scripts": { + "start": "node server.js", + "dev": "NODE_ENV=development node server.js" + }, + "keywords": ["chess","socket.io","rooms","docker"], + "author": "Didictateur", + "license": "MIT", + "dependencies": { + "chess.js": "^1.1.2", + "express": "^4.18.2", + "socket.io": "^4.7.2", + "uuid": "^9.0.0" + } +} diff --git a/public/game.html b/public/game.html new file mode 100644 index 0000000..4a3a636 --- /dev/null +++ b/public/game.html @@ -0,0 +1,81 @@ + + + + + ChessNut - Partie + + + +

      ChessNut — Partie

      +
      Room: - Player: -
      +
      Fen: -
      +
      Joueurs: +
        +
        + +

        Contrôles (dev)

        +
        + From: To: Promotion: + +
        + +

        Événements

        +
        Logs...
        + + + + + + diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..0fb7c8e --- /dev/null +++ b/public/index.html @@ -0,0 +1,45 @@ + + + + + ChessNut - Test client + + + +

        ChessNut - Client de test

        +
        + + Room ID: + +
        + +
        + +
        + +

        Après création ou connexion, vous serez redirigé·e vers la page de salle d'attente dédiée.

        + + + + + diff --git a/public/waiting.html b/public/waiting.html new file mode 100644 index 0000000..1666510 --- /dev/null +++ b/public/waiting.html @@ -0,0 +1,93 @@ + + + + + ChessNut - Salle d'attente + + + +

        ChessNut — Salle d'attente

        +
        +
        Room: -
        +
        Status: -
        +
        Joueurs: +
          +
          +
          +
          + +
          + + + + + + + + diff --git a/server.js b/server.js new file mode 100644 index 0000000..2a1e3a4 --- /dev/null +++ b/server.js @@ -0,0 +1,122 @@ +const express = require('express'); +const http = require('http'); +const { Server } = require('socket.io'); +const { Chess } = require('chess.js'); +const { v4: uuidv4 } = require('uuid'); + +const app = express(); +const server = http.createServer(app); +const io = new Server(server, { cors: { origin: '*' } }); + +app.use(express.json()); +app.use(express.static('public')); + +// In-memory rooms store. For production replace with persistent store. +// room = { id, chess: Chess, players: [{id, socketId, color}], status } +const rooms = new Map(); + +app.post('/rooms', (req, res) => { + const id = uuidv4().slice(0, 8); + const chess = new Chess(); + rooms.set(id, { id, chess, players: [], status: 'waiting' }); + res.json({ roomId: id }); +}); + +app.get('/rooms/:id', (req, res) => { + const room = rooms.get(req.params.id); + if (!room) return res.status(404).json({ error: 'room not found' }); + res.json({ id: room.id, fen: room.chess.fen(), players: room.players.map(p => ({ id: p.id, color: p.color })), status: room.status }); +}); + +io.on('connection', (socket) => { + console.log('socket connected', socket.id); + + socket.on('room:join', ({ roomId, playerId }, cb) => { + const room = rooms.get(roomId); + if (!room) return cb && cb({ error: 'room not found' }); + if (room.players.length >= 2) return cb && cb({ error: 'room full' }); + + const assignedId = playerId || uuidv4(); + const color = room.players.length === 0 ? 'white' : 'black'; + room.players.push({ id: assignedId, socketId: socket.id, color }); + socket.join(roomId); + socket.data.roomId = roomId; + socket.data.playerId = assignedId; + + + io.to(roomId).emit('room:update', { + fen: room.chess.fen(), + players: room.players.map(p => ({ id: p.id, color: p.color })), + status: room.status + }); + + cb && cb({ ok: true, color, roomId, playerId: assignedId }); + }); + + socket.on('game:move', ({ roomId, from, to, promotion }, cb) => { + const room = rooms.get(roomId); + if (!room) return cb && cb({ error: 'room not found' }); + + const chess = room.chess; + + // Validate move + const move = chess.move({ from, to, promotion }); + if (!move) return cb && cb({ error: 'invalid move' }); + + io.to(roomId).emit('move:moved', { move, fen: chess.fen() }); + + if (chess.isGameOver()) { + room.status = 'finished'; + let result = 'draw'; + if (chess.isCheckmate()) result = 'checkmate'; + else if (chess.isStalemate()) result = 'stalemate'; + io.to(roomId).emit('game:over', { result, fen: chess.fen() }); + } + + cb && cb({ ok: true, move, fen: chess.fen() }); + }); + + // Host can start the game explicitly + socket.on('game:start', ({ roomId }, cb) => { + const room = rooms.get(roomId); + if (!room) return cb && cb({ error: 'room not found' }); + + // verify sender is the host (first player) + const senderId = socket.data.playerId; + if (!senderId) return cb && cb({ error: 'not joined' }); + if (room.players.length < 2) return cb && cb({ error: 'need 2 players to start' }); + const host = room.players[0]; + if (!host || host.id !== senderId) return cb && cb({ error: 'only host can start' }); + + room.status = 'playing'; + io.to(roomId).emit('game:started', { roomId, fen: room.chess.fen() }); + io.to(roomId).emit('room:update', { + fen: room.chess.fen(), + players: room.players.map(p => ({ id: p.id, color: p.color })), + status: room.status + }); + + cb && cb({ ok: true }); + }); + + socket.on('disconnect', () => { + const roomId = socket.data.roomId; + if (!roomId) return; + const room = rooms.get(roomId); + if (!room) return; + + room.players = room.players.filter(p => p.socketId !== socket.id); + if (room.players.length < 2 && room.status === 'playing') room.status = 'waiting'; + + io.to(roomId).emit('room:update', { + fen: room.chess.fen(), + players: room.players.map(p => ({ id: p.id, color: p.color })), + status: room.status + }); + }); +}); + +const PORT = process.env.PORT || 3000; +server.listen(PORT, () => { + console.log(`ChessNut server listening on port ${PORT}`); +});