From b091882d7d9e8cb39a136b1f28216fa8a5c2c24e Mon Sep 17 00:00:00 2001 From: Davide Cappellini Date: Sun, 8 Nov 2026 11:34:48 +0100 Subject: [PATCH] prototype-tile-leak: phone test page (Pixi tile-size client check) Co-Authored-By: Claude Sonnet 5.5 --- prototype-tile-leak/.gitignore | 2 + prototype-tile-leak/README.md | 34 + prototype-tile-leak/devbox.json | 9 +- prototype-tile-leak/devbox.lock | 75 ++ prototype-tile-leak/index.html | 29 + prototype-tile-leak/package-lock.json | 1320 ++++++++++++++++++++++++ prototype-tile-leak/package.json | 8 + prototype-tile-leak/src/gen.nim | 4 +- prototype-tile-leak/src/phonesrv.nim | 71 ++ prototype-tile-leak/tools/headless.mjs | 13 + prototype-tile-leak/tools/phone.sh | 20 + prototype-tile-leak/tsconfig.json | 13 + prototype-tile-leak/web/main.ts | 228 ++++ 13 files changed, 1822 insertions(+), 4 deletions(-) create mode 100644 prototype-tile-leak/index.html create mode 100644 prototype-tile-leak/package-lock.json create mode 100644 prototype-tile-leak/package.json create mode 100644 prototype-tile-leak/src/phonesrv.nim create mode 100644 prototype-tile-leak/tools/headless.mjs create mode 100755 prototype-tile-leak/tools/phone.sh create mode 100644 prototype-tile-leak/tsconfig.json create mode 100644 prototype-tile-leak/web/main.ts diff --git a/prototype-tile-leak/.gitignore b/prototype-tile-leak/.gitignore index 17451cf..9ddd144 100644 --- a/prototype-tile-leak/.gitignore +++ b/prototype-tile-leak/.gitignore @@ -6,3 +6,5 @@ bin/ nimble.develop nimbledeps devbox.d/ +node_modules/ +dist/ diff --git a/prototype-tile-leak/README.md b/prototype-tile-leak/README.md index 0759b40..22eb3d9 100644 --- a/prototype-tile-leak/README.md +++ b/prototype-tile-leak/README.md @@ -119,3 +119,37 @@ devbox run maskbench # results/maskbench.log (~30 s) devbox run netbench # leak-bound demo + h2load matrix -> results/netbench.log ``` `results/steps.log`: `python3 tools/steps.py > results/steps.log` (replays `../prototype-server-vision/results/leak-A.jsonl`; first message = connect burst, excluded from steady stats). + +## Phone test (client-side risk of 32 px tiles) +Question: does a Pixi v8 client cope with 32 px tiles (262,144 on a 16384 px map) vs 64 / 256 on a real phone? Unmeasured so far (Q4 "Not measured: client cost"). + +### Run +``` +cd prototype-tile-leak +devbox run phone # first run: npm install + generates 16384 px tiles x {32,64,256} (g6 art, minutes, ~1.1 GB gitignored in data/phone) + builds; then serves +``` +Prints `http://:8099/` (one line per interface; override with `PORT=`, `WORLD=`; changing WORLD regenerates tiles). Ctrl-C stops. Server: `src/phonesrv.nim`, plain static server (mummy; **no auth, no nginx, no X-Accel**: this tests the client, not the auth path, which `netbench` already covers), binds 0.0.0.0, rejects non-private peers (403), `Cache-Control: no-store` so every load is cold network. NixOS firewall: port 8099/tcp must be open (e.g. temporary `sudo iptables -I nixos-fw -p tcp --dport 8099 -j nixos-fw-accept`, removed with `-D`, or `networking.firewall.allowedTCPPorts`); not changed by this prototype. +`POST /results` (LAN only, JSON object <= 64 KB, whole file <= 2 MB per server run) appends one line per Send to `results/phone-.jsonl`. + +### On the phone (~5 min) +1. Open the URL. Overlay top-left. Check `renderer` (webgl/webgpu), `dpr`, UA. +2. Tile size = **32**, **Open map** mode. Pan with one finger for 20 s (long drags, fast flicks), pinch zoom in/out for 10 s. Note moving fps. +3. **Reveal viewport (cold)**: drops all tiles, refetches everything in view; read `viewport loaded ms`. Press 3x, also at zoom 0.5 (worst case, ~1.3k tiles). +4. **Explore: start**: simulated connect burst (~290 cells, one disc) then a step every 400 ms (~11 new cells/step, leak-A median). Let it run 60 s; camera follows, you can still pan/pinch. +5. Pick **64**, repeat 2-4; pick **256**, repeat 2-4. (Switching size stores a snapshot of the previous size.) +6. **Send results** (also snapshots the current size). Check `results/phone-*.jsonl` on the laptop. + +### What the numbers mean +- `fps(5s)`: all frames incl. idle (vsync cap: 60 or 120). `moving avg/p5/min`: only frames within 300 ms of a pan/pinch/sim step, accumulated per tile size since selecting it. **p5 = 1000/p95 frame time**, the figure to judge; min = worst single frame. +- `sprites`/`textures`: tile sprites on stage / loaded textures. Only tiles in view + 1 tile margin load; those beyond 2 tiles are released (sprite pooled, texture + source destroyed). Both must stay bounded (~ view area / tile^2) while panning, not grow: growth means a leak. +- `req inflight/done/failed`; cap 24 in flight (browser limits HTTP/1.1 to ~6 per host, so the server hop is HTTP/1.1; real deployment should use h2). `fetch+decode ms` = request to ImageBitmap ready. +- `viewport loaded ms` (ttvl): from click (cold reveal / size change / explore start) until every allowed tile in view is loaded. The explore start value is the connect burst. +- `heap`: only Chrome-based browsers (not iOS Safari). GPU memory is not visible; use `peakTextures` x tile^2 x 4 B as an estimate (32 px: 4 KB each). +- Fog mode: a tile loads iff it overlaps >= 1 revealed 32 px cell (same rule as the server auth), so 256 px mode also loads partly unexplored tiles. + +### Proposed pass criteria (32 px, mid-range phone, Wi-Fi) +- moving p5 fps >= 30 while panning at zoom 1 (avg >= 45); no thermal collapse over the 60 s explore run. +- viewport load (cold) < 1 s at zoom 1; connect burst < 2 s. +- failed requests 0; sprites/textures bounded; heap not growing between size switches. +- 32 px not worse than ~1.5x of 64 px on the same metrics. If 32 fails but 64 passes: fall back to 64 px (README recommendation above). +Headless smoke check (server running): `devbox run -- node tools/headless.mjs` (software GL, not representative for fps). diff --git a/prototype-tile-leak/devbox.json b/prototype-tile-leak/devbox.json index 6870a77..d04bcdb 100644 --- a/prototype-tile-leak/devbox.json +++ b/prototype-tile-leak/devbox.json @@ -5,7 +5,9 @@ "nimble": "latest", "nginx": "latest", "nghttp2": "latest", - "curl": "latest" + "curl": "latest", + "nodejs": "latest", + "chromium": "latest" }, "env": { "NIMBLE_DIR": "$DEVBOX_PROJECT_ROOT/.devbox/nimble" @@ -30,7 +32,10 @@ ], "netbench": [ "tools/netbench.sh | tee results/netbench.log" + ], + "phone": [ + "tools/phone.sh" ] } } -} \ No newline at end of file +} diff --git a/prototype-tile-leak/devbox.lock b/prototype-tile-leak/devbox.lock index 1c197e8..95fdaa5 100644 --- a/prototype-tile-leak/devbox.lock +++ b/prototype-tile-leak/devbox.lock @@ -1,6 +1,42 @@ { "lockfile_version": "1", "packages": { + "chromium@latest": { + "last_modified": "2026-10-08T19:21:32Z", + "resolved": "github:NixOS/nixpkgs/8edc0c72e3a38faf5434e40d1f19431125fe4b30#chromium", + "source": "devbox-search", + "version": "155.0.8059.39", + "systems": { + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/q56ri55nzhpwzhisgb2r0kilb61k4f5a-chromium-155.0.8059.39", + "default": true + }, + { + "name": "sandbox", + "path": "/nix/store/a1w34yg08mvma03xps5dsy8vw5hrdy9w-chromium-155.0.8059.39-sandbox" + } + ], + "store_path": "/nix/store/q56ri55nzhpwzhisgb2r0kilb61k4f5a-chromium-155.0.8059.39" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/ky199ji3a5drs6rm3wr5zidamx9dhz56-chromium-155.0.8059.39", + "default": true + }, + { + "name": "sandbox", + "path": "/nix/store/5hpd396v5byrfp1vnw7zmpfscqd3b1zv-chromium-155.0.8059.39-sandbox" + } + ], + "store_path": "/nix/store/ky199ji3a5drs6rm3wr5zidamx9dhz56-chromium-155.0.8059.39" + } + } + }, "curl@latest": { "last_modified": "2025-12-05T15:03:55Z", "resolved": "github:NixOS/nixpkgs/a672be65651c80d3f592a89b3945466584a22069#curl", @@ -509,6 +545,45 @@ "store_path": "/nix/store/8f5wx2s80gnw0lkmdpbl63n1xlilcfxi-nimble-0.24.1" } } + }, + "nodejs@latest": { + "last_modified": "2026-10-08T19:21:32Z", + "plugin_version": "0.0.2", + "resolved": "github:NixOS/nixpkgs/8edc0c72e3a38faf5434e40d1f19431125fe4b30#nodejs_26", + "source": "devbox-search", + "version": "26.11.1", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/42hvw959dvc16w7p79xns4p4sgfx2wiv-nodejs-26.11.1", + "default": true + } + ], + "store_path": "/nix/store/42hvw959dvc16w7p79xns4p4sgfx2wiv-nodejs-26.11.1" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/zzx8zal1hmjkamrp8y9k6mjim08pzwz8-nodejs-26.11.1", + "default": true + } + ], + "store_path": "/nix/store/zzx8zal1hmjkamrp8y9k6mjim08pzwz8-nodejs-26.11.1" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/m7vfpzl1rjwjpwlcsqs166jn3lywzpq1-nodejs-26.11.1", + "default": true + } + ], + "store_path": "/nix/store/m7vfpzl1rjwjpwlcsqs166jn3lywzpq1-nodejs-26.11.1" + } + } } } } diff --git a/prototype-tile-leak/index.html b/prototype-tile-leak/index.html new file mode 100644 index 0000000..e904cb2 --- /dev/null +++ b/prototype-tile-leak/index.html @@ -0,0 +1,29 @@ + + + + + +Pixi v8 tile-size phone test (throwaway) + + + +
+
+
+ + + + + +
+ + + diff --git a/prototype-tile-leak/package-lock.json b/prototype-tile-leak/package-lock.json new file mode 100644 index 0000000..47407c1 --- /dev/null +++ b/prototype-tile-leak/package-lock.json @@ -0,0 +1,1320 @@ +{ + "name": "prototype-tile-leak-phone", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "prototype-tile-leak-phone", + "dependencies": { + "pixi.js": "^8.22.0" + }, + "devDependencies": { + "playwright-core": "^1.64.1", + "typescript": "^7.0.2", + "vite": "^8.3.5" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.156.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", + "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@pixi/colord": { + "version": "2.9.6", + "resolved": "https://registry.npmjs.org/@pixi/colord/-/colord-2.9.6.tgz", + "integrity": "sha512-nezytU2pw587fQstUu1AsJZDVEynjskwOL+kibwcdxsMBFqPsFFNA7xl0ii/gXuDi6M0xj3mfRJj8pBSc2jCfA==", + "license": "MIT" + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.16.tgz", + "integrity": "sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.16.tgz", + "integrity": "sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.16.tgz", + "integrity": "sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.16.tgz", + "integrity": "sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.16.tgz", + "integrity": "sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.16.tgz", + "integrity": "sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.16.tgz", + "integrity": "sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.16.tgz", + "integrity": "sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.16.tgz", + "integrity": "sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.16.tgz", + "integrity": "sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.16.tgz", + "integrity": "sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.16.tgz", + "integrity": "sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.16.tgz", + "integrity": "sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.16.tgz", + "integrity": "sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.16.tgz", + "integrity": "sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/earcut": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/earcut/-/earcut-3.0.0.tgz", + "integrity": "sha512-k/9fOUGO39yd2sCjrbAJvGDEQvRwRnQIZlBz43roGwUZo5SHAmyVvSFyaVVZkicRVCaDXPKlbxrUcBuJoSWunQ==", + "license": "MIT" + }, + "node_modules/@typescript/typescript-aix-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz", + "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz", + "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz", + "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz", + "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz", + "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz", + "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz", + "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-loong64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz", + "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-mips64el": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz", + "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz", + "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-riscv64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz", + "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-s390x": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz", + "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz", + "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz", + "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz", + "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz", + "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz", + "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-sunos-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz", + "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz", + "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz", + "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@webgpu/types": { + "version": "0.1.74", + "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.74.tgz", + "integrity": "sha512-lgiI4hbuLcI9unnm2cL/tvCaQU45dp0xcLWJh5uB/9MBGvIA4F8XIk7nSiBeg+K4xWGYwgZKn80LmERI5CxoTA==", + "license": "BSD-3-Clause" + }, + "node_modules/@xmldom/xmldom": { + "version": "0.8.15", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.15.tgz", + "integrity": "sha512-/5NV/vDALVFDXgLmfsy9TRCBlKwO2LNBFzpzvb9iIj+jR+eSc6DLYYvVOdivT/jm7MtU6TebYuRmzEOI7w40UA==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/earcut": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-3.2.4.tgz", + "integrity": "sha512-FHc6yNpnTORB0tM5kmZ03iD2mDuNakDE2lvf4Hw1XkfxtEHIGVi01B/GqUSwx+NcC1WGjidAfpTXzeALtPtfpg==", + "license": "ISC" + }, + "node_modules/eventemitter3": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/gifuct-js": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/gifuct-js/-/gifuct-js-2.1.2.tgz", + "integrity": "sha512-rI2asw77u0mGgwhV3qA+OEgYqaDn5UNqgs+Bx0FGwSpuqfYn+Ir6RQY5ENNQ8SbIiG/m5gVa7CD5RriO4f4Lsg==", + "license": "MIT", + "dependencies": { + "js-binary-schema-parser": "^2.0.3" + } + }, + "node_modules/ismobilejs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ismobilejs/-/ismobilejs-1.1.1.tgz", + "integrity": "sha512-VaFW53yt8QO61k2WJui0dHf4SlL8lxBofUuUmwBo0ljPk0Drz2TiuDW4jo3wDcv41qy/SxrJ+VAzJ/qYqsmzRw==", + "license": "MIT" + }, + "node_modules/js-binary-schema-parser": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/js-binary-schema-parser/-/js-binary-schema-parser-2.0.3.tgz", + "integrity": "sha512-xezGJmOb4lk/M1ZZLTR/jaBHQ4gG/lqQnJqdIv4721DMggsa1bDVlHXNeHYogaIEHD9vCRv0fcL4hMA+Coarkg==", + "license": "MIT" + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/parse-svg-path": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/parse-svg-path/-/parse-svg-path-0.2.0.tgz", + "integrity": "sha512-Tf7FFIrguPKQwzD4pWnYkR2VOv3raoHeKED80Bm+BYHI3KxC8KsgsGC5+fSMzAGDA6UEk4bHvmi+RsjmL3khpg==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pixi.js": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/pixi.js/-/pixi.js-8.22.0.tgz", + "integrity": "sha512-QbTANHMZ751MIjLiLSUSM8a7LNMWwMIf0KbRCqlW+SPS9hNLfSVS+cl1O2SEp9g1K/wyLzj/OJHv+1TUfiPr/w==", + "license": "MIT", + "workspaces": [ + "examples", + "playground" + ], + "dependencies": { + "@pixi/colord": "^2.9.6", + "@types/earcut": "^3.0.0", + "@webgpu/types": "^0.1.69", + "@xmldom/xmldom": "^0.8.15", + "earcut": "^3.0.2", + "eventemitter3": "^5.0.1", + "gifuct-js": "^2.1.2", + "ismobilejs": "^1.1.1", + "parse-svg-path": "^0.2.0", + "tiny-lru": "^11.4.7" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/pixijs" + } + }, + "node_modules/playwright-core": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.0.tgz", + "integrity": "sha512-vNSKgH6YqtN7cdT/L334zo0a+YwkrpicyrHJlWWPIm/Q+Nn2SWInil01oT0mbu96U4GgoRtCYQD9CzJQgju+lA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/postcss": { + "version": "8.5.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz", + "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/rolldown": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.16.tgz", + "integrity": "sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.156.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.16", + "@rolldown/binding-android-arm64": "1.2.16", + "@rolldown/binding-darwin-arm64": "1.2.16", + "@rolldown/binding-darwin-x64": "1.2.16", + "@rolldown/binding-freebsd-x64": "1.2.16", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.16", + "@rolldown/binding-linux-arm64-gnu": "1.2.16", + "@rolldown/binding-linux-arm64-musl": "1.2.16", + "@rolldown/binding-linux-ppc64-gnu": "1.2.16", + "@rolldown/binding-linux-s390x-gnu": "1.2.16", + "@rolldown/binding-linux-x64-gnu": "1.2.16", + "@rolldown/binding-linux-x64-musl": "1.2.16", + "@rolldown/binding-openharmony-arm64": "1.2.16", + "@rolldown/binding-win32-arm64-msvc": "1.2.16", + "@rolldown/binding-win32-x64-msvc": "1.2.16" + } + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tiny-lru": { + "version": "11.4.7", + "resolved": "https://registry.npmjs.org/tiny-lru/-/tiny-lru-11.4.7.tgz", + "integrity": "sha512-w/Te7uMUVeH0CR8vZIjr+XiN41V+30lkDdK+NRIDCUYKKuL9VcmaUEmaPISuwGhLlrTGh5yu18lENtR9axSxYw==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/typescript": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz", + "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc" + }, + "engines": { + "node": ">=16.20.0" + }, + "optionalDependencies": { + "@typescript/typescript-aix-ppc64": "7.0.2", + "@typescript/typescript-darwin-arm64": "7.0.2", + "@typescript/typescript-darwin-x64": "7.0.2", + "@typescript/typescript-freebsd-arm64": "7.0.2", + "@typescript/typescript-freebsd-x64": "7.0.2", + "@typescript/typescript-linux-arm": "7.0.2", + "@typescript/typescript-linux-arm64": "7.0.2", + "@typescript/typescript-linux-loong64": "7.0.2", + "@typescript/typescript-linux-mips64el": "7.0.2", + "@typescript/typescript-linux-ppc64": "7.0.2", + "@typescript/typescript-linux-riscv64": "7.0.2", + "@typescript/typescript-linux-s390x": "7.0.2", + "@typescript/typescript-linux-x64": "7.0.2", + "@typescript/typescript-netbsd-arm64": "7.0.2", + "@typescript/typescript-netbsd-x64": "7.0.2", + "@typescript/typescript-openbsd-arm64": "7.0.2", + "@typescript/typescript-openbsd-x64": "7.0.2", + "@typescript/typescript-sunos-x64": "7.0.2", + "@typescript/typescript-win32-arm64": "7.0.2", + "@typescript/typescript-win32-x64": "7.0.2" + } + }, + "node_modules/vite": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.6.tgz", + "integrity": "sha512-UI7dK29NnS54Fk+mmo7o+jI6U8Fp7hDl+X5Q1k45WH+d4dSlbLVUETGQ+hfkNgvLQGyoElPj837nZyv4MBc0VA==", + "dev": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.32", + "rolldown": "~1.2.16", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.7.1 || ^0.8.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + } + } +} diff --git a/prototype-tile-leak/package.json b/prototype-tile-leak/package.json new file mode 100644 index 0000000..aea891c --- /dev/null +++ b/prototype-tile-leak/package.json @@ -0,0 +1,8 @@ +{ + "name": "prototype-tile-leak-phone", + "private": true, + "type": "module", + "scripts": { "build": "tsc && vite build" }, + "dependencies": { "pixi.js": "^8.22.0" }, + "devDependencies": { "playwright-core": "^1.64.1", "typescript": "^7.0.2", "vite": "^8.3.5" } +} diff --git a/prototype-tile-leak/src/gen.nim b/prototype-tile-leak/src/gen.nim index 546406e..5180c81 100644 --- a/prototype-tile-leak/src/gen.nim +++ b/prototype-tile-leak/src/gen.nim @@ -1,7 +1,7 @@ -## slice the procedural 4096^2 map into square tiles of each size. usage: gen +## slice the procedural 4096^2 map into square tiles of each size. usage: gen [world=4096] import pixie, pixie/fileformats/png, std/[os, strformat, strutils] import art -let (outDir, grain, world) = (paramStr(1), paramStr(2).parseFloat, 4096) +let (outDir, grain, world) = (paramStr(1), paramStr(2).parseFloat, if paramCount() > 2: paramStr(3).parseInt else: 4096) for size in [256, 64, 32]: let d = outDir / ("tiles" & $size) createDir d diff --git a/prototype-tile-leak/src/phonesrv.nim b/prototype-tile-leak/src/phonesrv.nim new file mode 100644 index 0000000..45c45bf --- /dev/null +++ b/prototype-tile-leak/src/phonesrv.nim @@ -0,0 +1,71 @@ +## Phone test: plain static server (no auth, no nginx) for dist/ + data/phone tiles + POST /results. LAN only (peer must be private/loopback). +## usage: phonesrv +import std/[strutils, os, json, times, locks] +import mummy + +const MaxBody = 64 * 1024 +const MaxFile = 2 * 1024 * 1024 # total bytes appended per server run +let port = parseInt(paramStr(1)) +let world = parseInt(paramStr(2)) +let resFile = "results" / ("phone-" & now().format("yyyyMMdd'T'HHmmss") & ".jsonl") +var lk: Lock +var written = 0 +initLock lk +createDir "results" + +proc lanPeer(a: string): bool = + a.startsWith("127.") or a.startsWith("10.") or a.startsWith("192.168.") or a.startsWith("169.254.") or + a == "::1" or a.toLowerAscii.startsWith("fe80") or a.toLowerAscii.startsWith("::ffff:192.168.") or + a.toLowerAscii.startsWith("::ffff:10.") or a.toLowerAscii.startsWith("::ffff:127.") or + (a.startsWith("172.") and a.split('.').len > 1 and a.split('.')[1].parseInt in 16..31) + +proc reply(r: Request, code: int, ctype: string, body: string, cache = "no-store") = + var h: HttpHeaders + h["Content-Type"] = ctype + h["Cache-Control"] = cache # no-store: measure cold network loads, not the HTTP cache + r.respond(code, h, body) + +proc ctypeOf(p: string): string = + case p.splitFile.ext + of ".html": "text/html; charset=utf-8" + of ".js": "text/javascript" + of ".css": "text/css" + of ".png": "image/png" + of ".json": "application/json" + else: "application/octet-stream" + +proc handler(request: Request) {.gcsafe.} = + {.gcsafe.}: + if not lanPeer(request.remoteAddress): request.respond(403); return + let path = request.path + if request.httpMethod == "POST" and path == "/results": + if request.body.len > MaxBody: request.respond(413); return + var node: JsonNode + try: node = parseJson(request.body) + except CatchableError: request.respond(400); return + if node.kind != JObject: request.respond(400); return + let line = $node & "\n" + withLock lk: + if written + line.len > MaxFile: request.respond(413); return + written += line.len + let f = open(resFile, fmAppend) + f.write line + f.close + request.reply(200, "application/json", "{\"ok\":true,\"file\":" & $(%resFile) & "}") + return + if request.httpMethod != "GET": request.respond(405); return + var file = "" + if path == "/" : file = "dist/index.html" + elif path == "/meta.json": request.reply(200, "application/json", "{\"world\":" & $world & "}"); return + elif path.startsWith("/assets/") and path.len < 100 and + path[8 .. ^1].allCharsInSet(Letters + Digits + {'.', '-', '_'}) and ".." notin path: file = "dist" & path + elif path.startsWith("/tiles/"): # /tiles/<32|64|256>/_.png + let parts = path[7 .. ^1].split('/') + if parts.len == 2 and parts[0] in ["32", "64", "256"] and parts[1].endsWith(".png"): + let xy = parts[1][0 .. ^5].split('_') + if xy.len == 2 and xy[0].len in 1..3 and xy[1].len in 1..3 and xy[0].allCharsInSet(Digits) and xy[1].allCharsInSet(Digits): + file = "data/phone/tiles" & parts[0] / parts[1] + if file == "" or not fileExists file: request.respond(404); return + request.reply(200, ctypeOf file, readFile file) + +newServer(handler, workerThreads = 8).serve(Port(port), "0.0.0.0") diff --git a/prototype-tile-leak/tools/headless.mjs b/prototype-tile-leak/tools/headless.mjs new file mode 100644 index 0000000..12985bc --- /dev/null +++ b/prototype-tile-leak/tools/headless.mjs @@ -0,0 +1,13 @@ +// headless smoke check of the phone page (server must be running): node tools/headless.mjs [url] +import { chromium } from 'playwright-core'; +const b = await chromium.launch({ executablePath: process.env.CHROMIUM_PATH || 'chromium', args: ['--no-sandbox', '--use-gl=angle', '--use-angle=swiftshader', '--enable-unsafe-swiftshader'] }); +const p = await b.newPage({ viewport: { width: 412, height: 800 }, hasTouch: true }); +const errs = []; p.on('pageerror', (e) => errs.push(String(e))); p.on('console', (m) => m.type() === 'error' && errs.push(m.text())); +await p.goto(process.argv[2] || 'http://127.0.0.1:8099/'); +const stats = async () => (await p.textContent('#stats')).split('\n').slice(0, 7).join('\n'); +await p.waitForTimeout(3000); console.log('open:\n' + await stats()); +await p.selectOption('#size', '64'); await p.waitForTimeout(1500); +await p.selectOption('#size', '32'); await p.click('#explore'); await p.waitForTimeout(4000); console.log('explore:\n' + await stats()); +await p.click('#reveal'); await p.waitForTimeout(3000); console.log('reveal:\n' + await stats()); +await p.click('#send'); await p.waitForTimeout(500); console.log(await p.textContent('#msg')); +console.log('errors:', errs); await b.close(); diff --git a/prototype-tile-leak/tools/phone.sh b/prototype-tile-leak/tools/phone.sh new file mode 100755 index 0000000..0021895 --- /dev/null +++ b/prototype-tile-leak/tools/phone.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# `devbox run phone`: build client + server, ensure tiles, serve on 0.0.0.0:$PORT (LAN only), print URLs. Ctrl-C stops. +set -eu +cd "$(dirname "$0")/.." +PORT=${PORT:-8099}; WORLD=${WORLD:-16384} +[ -d node_modules/pixi.js ] || npm install --no-audit --no-fund +nimble setup -y >/dev/null; mkdir -p bin results +[ -x bin/gen ] || nim c -d:release --hints:off --warnings:off -o:bin/gen src/gen.nim +if [ "$(ls data/phone/tiles32 2>/dev/null | wc -l)" != "$(( (WORLD/32)*(WORLD/32) ))" ] || [ "$(ls data/phone/tiles64 2>/dev/null | wc -l)" != "$(( (WORLD/64)*(WORLD/64) ))" ] || [ "$(ls data/phone/tiles256 2>/dev/null | wc -l)" != "$(( (WORLD/256)*(WORLD/256) ))" ]; then + echo "generating ${WORLD}px tiles (one-off, minutes, ~1.1 GB on disk)..."; rm -rf data/phone; mkdir -p data/phone; bin/gen data/phone 6 "$WORLD" +fi +nim c -d:release --hints:off --warnings:off -o:bin/phonesrv src/phonesrv.nim +npm run build >/dev/null +bin/phonesrv "$PORT" "$WORLD" & SRV=$! +trap 'kill $SRV 2>/dev/null' EXIT INT TERM +sleep 1; kill -0 $SRV 2>/dev/null || { echo "server failed to start (port $PORT busy?)"; exit 1; } +echo; echo "Open on the phone (same Wi-Fi):" +ip -4 -o addr show scope global | awk -v p="$PORT" '{split($4,a,"/"); print " http://" a[1] ":" p "/ (" $2 ")"}' +echo "Results -> $PWD/results/phone-*.jsonl. Ctrl-C to stop." +wait $SRV diff --git a/prototype-tile-leak/tsconfig.json b/prototype-tile-leak/tsconfig.json new file mode 100644 index 0000000..f4ed78c --- /dev/null +++ b/prototype-tile-leak/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "bundler", + "lib": ["ES2022", "DOM"], + "strict": true, + "noEmit": true, + "skipLibCheck": true, + "types": ["vite/client"] + }, + "include": ["web"] +} diff --git a/prototype-tile-leak/web/main.ts b/prototype-tile-leak/web/main.ts new file mode 100644 index 0000000..49d16e0 --- /dev/null +++ b/prototype-tile-leak/web/main.ts @@ -0,0 +1,228 @@ +// THROWAWAY phone test: does Pixi v8 cope with 32 px tiles? See ../README.md "Phone test". +import { Application, Container, ImageSource, Sprite, Texture } from 'pixi.js'; + +const CELL = 32; +const MAX_INFLIGHT = 24; +const $ = (id: string) => document.getElementById(id) as T; +const meta = await (await fetch('/meta.json')).json(); +const WORLD: number = meta.world; + +const app = new Application(); +await app.init({ + resizeTo: window, background: 0x000000, antialias: false, + resolution: Math.min(devicePixelRatio, 2), autoDensity: true, + eventFeatures: { move: false, globalMove: false, click: false, wheel: false }, // DOM pointer events below +}); +document.body.prepend(app.canvas); +const world = new Container(); +app.stage.addChild(world); + +// ---------- state ---------- +type Tile = { sprite: Sprite; tex: Texture }; +let size = 32; +let mode: 'open' | 'fog' = 'open'; +let cam = { x: WORLD / 2, y: WORLD / 2, z: 1 }; // world point at screen centre, zoom +let dirty = true, lastMove = 0; +const loaded = new Map(); +const inflight = new Set(); +const pool: Sprite[] = []; +let revealedCells: number[] = []; // fog mode: cell ids (cy*CW+cx) +const CW = WORLD / CELL; +const revealedMask = new Uint8Array(CW * CW); +let allowed = new Set(); // fog mode: tile ids of current size overlapping >=1 revealed cell +const tw = () => WORLD / size; +const tid = (x: number, y: number) => y * tw() + x; + +// ---------- per-size accumulators ---------- +const mk = () => ({ started: 0, done: 0, failed: 0, bytes: 0, lat: [] as number[], frames: [] as number[], ttvl: [] as number[], + peakSprites: 0, peakTextures: 0, peakHeapMB: 0, t0: performance.now() }); +let acc = mk(); +const snaps: Record = {}; +const pct = (a: number[], p: number) => { if (!a.length) return null; const s = [...a].sort((x, y) => x - y); return s[Math.min(s.length - 1, Math.floor(p * s.length))]; }; +const mean = (a: number[]) => a.length ? a.reduce((x, y) => x + y, 0) / a.length : null; +const r1 = (v: number | null) => v === null ? null : Math.round(v * 10) / 10; +function snapshot() { + const f = acc.frames; // frame ms while camera moving / sim running + return { + size, mode, zoom: r1(cam.z), seconds: r1((performance.now() - acc.t0) / 1000), + movingFrames: f.length, movingFpsAvg: r1(f.length ? 1000 / mean(f)! : null), + movingFpsP5: r1(f.length ? 1000 / pct(f, 0.95)! : null), movingFpsMin: r1(f.length ? 1000 / Math.max(...f) : null), + reqStarted: acc.started, reqDone: acc.done, reqFailed: acc.failed, MB: r1(acc.bytes / 1e6), + fetchDecodeMsMed: r1(pct(acc.lat, 0.5)), fetchDecodeMsP95: r1(pct(acc.lat, 0.95)), + ttvlMs: acc.ttvl.map(Math.round), peakSprites: acc.peakSprites, peakTextures: acc.peakTextures, peakHeapMB: acc.peakHeapMB || null, + }; +} + +// ---------- tiles ---------- +function view(margin: number) { // tile index range covering the screen (+margin px, world units) + const hw = app.screen.width / 2 / cam.z + margin, hh = app.screen.height / 2 / cam.z + margin; + const x0 = Math.max(0, Math.floor((cam.x - hw) / size)), x1 = Math.min(tw() - 1, Math.floor((cam.x + hw) / size)); + const y0 = Math.max(0, Math.floor((cam.y - hh) / size)), y1 = Math.min(tw() - 1, Math.floor((cam.y + hh) / size)); + return { x0, x1, y0, y1 }; +} +const isAllowed = (id: number) => mode === 'open' || allowed.has(id); + +function release(id: number) { + const t = loaded.get(id)!; + loaded.delete(id); + world.removeChild(t.sprite); + t.sprite.texture = Texture.EMPTY; + t.tex.destroy(true); // true = also destroy the TextureSource (frees GPU memory + closes the ImageBitmap) + pool.push(t.sprite); +} +function dropAll() { for (const id of [...loaded.keys()]) release(id); } + +async function fetchTile(id: number, x: number, y: number, mySize: number) { + inflight.add(id); acc.started++; + const t0 = performance.now(); + try { + const res = await fetch(`/tiles/${mySize}/${x}_${y}.png`, { cache: 'no-store' }); + if (!res.ok) throw new Error(String(res.status)); + const blob = await res.blob(); + const bmp = await createImageBitmap(blob); + if (mySize !== size) { bmp.close(); return; } // size switched while in flight + const tex = new Texture({ source: new ImageSource({ resource: bmp }) }); + const sprite = pool.pop() ?? new Sprite(); + sprite.texture = tex; + sprite.position.set(x * size, y * size); + world.addChild(sprite); + loaded.set(id, { sprite, tex }); + acc.done++; acc.bytes += blob.size; acc.lat.push(performance.now() - t0); + } catch { acc.failed++; } finally { inflight.delete(id); dirty = true; } +} + +let ttvlT0: number | null = null; +function updateTiles() { + const need = view(size), keep = view(size * 2); + for (const id of [...loaded.keys()]) { + const x = id % tw(), y = Math.floor(id / tw()); + if (x < keep.x0 || x > keep.x1 || y < keep.y0 || y > keep.y1 || !isAllowed(id)) release(id); + } + const q: { id: number; x: number; y: number; d: number }[] = []; + for (let y = need.y0; y <= need.y1; y++) for (let x = need.x0; x <= need.x1; x++) { + const id = tid(x, y); + if (!loaded.has(id) && !inflight.has(id) && isAllowed(id)) + q.push({ id, x, y, d: Math.hypot((x + .5) * size - cam.x, (y + .5) * size - cam.y) }); // nearest first + } + q.sort((a, b) => a.d - b.d); + for (const t of q) { if (inflight.size >= MAX_INFLIGHT) break; fetchTile(t.id, t.x, t.y, size); } + // time-to-viewport-loaded: all allowed tiles strictly in view are loaded + if (ttvlT0 !== null) { + const v = view(0); let all = true; + for (let y = v.y0; y <= v.y1 && all; y++) for (let x = v.x0; x <= v.x1; x++) { const id = tid(x, y); if (isAllowed(id) && !loaded.has(id)) { all = false; break; } } + if (all && inflight.size === 0) { acc.ttvl.push(performance.now() - ttvlT0); ttvlT0 = null; } + } +} + +// ---------- fog / exploration ---------- +function reveal(cx: number, cy: number) { + if (cx < 0 || cy < 0 || cx >= CW || cy >= CW || revealedMask[cy * CW + cx]) return; + revealedMask[cy * CW + cx] = 1; revealedCells.push(cy * CW + cx); + allowed.add(tid(Math.floor(cx * CELL / size), Math.floor(cy * CELL / size))); +} +function revealDisc(px: number, py: number, rCells: number) { + const cx = Math.floor(px / CELL), cy = Math.floor(py / CELL), r = Math.ceil(rCells); + for (let dy = -r; dy <= r; dy++) for (let dx = -r; dx <= r; dx++) if (dx * dx + dy * dy <= rCells * rCells) reveal(cx + dx, cy + dy); +} +function resetFog() { revealedMask.fill(0); revealedCells = []; allowed = new Set(); } +function rebuildAllowed() { allowed = new Set(); for (const c of revealedCells) allowed.add(tid(Math.floor((c % CW) * CELL / size), Math.floor(Math.floor(c / CW) * CELL / size))); } + +let sim: { x: number; y: number; h: number; timer: number } | null = null; +function startSim() { + stopSim(); dropAll(); resetFog(); mode = 'fog'; + sim = { x: WORLD / 2, y: WORLD / 2, h: Math.random() * 6.28, timer: 0 }; + cam.x = sim.x; cam.y = sim.y; + revealDisc(sim.x, sim.y, 9.6); // connect burst, ~290 cells (leak-A hello) + ttvlT0 = performance.now(); dirty = true; + sim.timer = window.setInterval(() => { // steady: ~0.6 cell per step reveals ~11 new cells (leak-A median) + const s = sim!; s.h += (Math.random() - .5) * 0.8; + s.x = Math.min(WORLD - 400, Math.max(400, s.x + Math.cos(s.h) * 0.6 * CELL)); s.y = Math.min(WORLD - 400, Math.max(400, s.y + Math.sin(s.h) * 0.6 * CELL)); + revealDisc(s.x, s.y, 9.6); + cam.x = s.x; cam.y = s.y; lastMove = performance.now(); dirty = true; + }, 400); + $('explore').textContent = 'Explore: stop'; +} +function stopSim() { if (sim) clearInterval(sim.timer); sim = null; $('explore').textContent = 'Explore: start'; } + +// ---------- controls ---------- +function setSize(s: number) { + snaps[size] = snapshot(); stopSim(); dropAll(); + size = s; acc = mk(); rebuildAllowed(); ttvlT0 = performance.now(); dirty = true; +} +$('size').onchange = (e) => setSize(Number((e.target as HTMLSelectElement).value)); +$('explore').onclick = () => (sim ? stopSim() : startSim()); +$('open').onclick = () => { stopSim(); mode = 'open'; dirty = true; }; +$('reveal').onclick = () => { + dropAll(); // cold: every tile in view must come over the network again + if (mode === 'fog') { const v = view(0); for (let y = v.y0 * size / CELL; y < (v.y1 + 1) * size / CELL; y++) for (let x = v.x0 * size / CELL; x < (v.x1 + 1) * size / CELL; x++) reveal(x, y); } + // fog: reveal exactly the cells under the screen + ttvlT0 = performance.now(); dirty = true; +}; +$('send').onclick = async () => { + snaps[size] = snapshot(); + const body = { t: new Date().toISOString(), ua: navigator.userAgent, dpr: devicePixelRatio, screen: [screen.width, screen.height], inner: [innerWidth, innerHeight], + renderer: app.renderer.name, world: WORLD, snaps }; + try { const r = await fetch('/results', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) }); msg(`send: ${r.status} ${await r.text()}`); } + catch (e) { msg(`send failed: ${e}`); } +}; +function msg(s: string) { $('msg').textContent = s; } + +// ---------- touch: 1 pointer pan, 2 pointers pinch ---------- +const ptrs = new Map(); +const clampZ = (z: number) => Math.min(4, Math.max(0.5, z)); // min 0.5: at 32 px a full viewport is already ~1.3k tiles +function zoomAt(sx: number, sy: number, nz: number) { // keep world point under (sx,sy) fixed + const wx = cam.x + (sx - app.screen.width / 2) / cam.z, wy = cam.y + (sy - app.screen.height / 2) / cam.z; + cam.z = clampZ(nz); cam.x = wx - (sx - app.screen.width / 2) / cam.z; cam.y = wy - (sy - app.screen.height / 2) / cam.z; +} +const cv = app.canvas; +cv.addEventListener('pointerdown', (e) => { cv.setPointerCapture(e.pointerId); ptrs.set(e.pointerId, { x: e.clientX, y: e.clientY }); }); +const up = (e: PointerEvent) => ptrs.delete(e.pointerId); +cv.addEventListener('pointerup', up); cv.addEventListener('pointercancel', up); +cv.addEventListener('pointermove', (e) => { + const p = ptrs.get(e.pointerId); if (!p) return; + if (ptrs.size === 1) { cam.x -= (e.clientX - p.x) / cam.z; cam.y -= (e.clientY - p.y) / cam.z; } + else if (ptrs.size === 2) { + const [a, b] = [...ptrs.entries()].map(([id, v]) => ({ id, ...v })); + const d0 = Math.hypot(a.x - b.x, a.y - b.y); + p.x = e.clientX; p.y = e.clientY; + const d1 = Math.hypot(a.id === e.pointerId ? e.clientX - b.x : a.x - e.clientX, a.id === e.pointerId ? e.clientY - b.y : a.y - e.clientY); + if (d0 > 0) zoomAt((a.x + b.x) / 2, (a.y + b.y) / 2, cam.z * d1 / d0); + } + p.x = e.clientX; p.y = e.clientY; lastMove = performance.now(); dirty = true; +}); +cv.addEventListener('wheel', (e) => { e.preventDefault(); zoomAt(e.clientX, e.clientY, cam.z * Math.exp(-e.deltaY / 500)); lastMove = performance.now(); dirty = true; }, { passive: false }); +cv.addEventListener('contextmenu', (e) => e.preventDefault()); + +// ---------- frame loop + overlay ---------- +const recent: { t: number; dt: number }[] = []; +let lastOverlay = 0; +const heapMB = () => { const m = (performance as any).memory; return m ? m.usedJSHeapSize / 1048576 : null; }; +const gl = (app.renderer as any).gl as WebGL2RenderingContext | undefined; +app.ticker.add((tk) => { + const now = performance.now(), dt = tk.deltaMS; + world.scale.set(cam.z); + world.position.set(app.screen.width / 2 - cam.x * cam.z, app.screen.height / 2 - cam.y * cam.z); + const moving = now - lastMove < 300; + recent.push({ t: now, dt }); while (recent[0].t < now - 5000) recent.shift(); + if (moving && acc.frames.length < 50000) acc.frames.push(dt); + if (dirty) { dirty = false; updateTiles(); } + else if (ttvlT0 !== null || inflight.size) updateTiles(); + acc.peakSprites = Math.max(acc.peakSprites, world.children.length); acc.peakTextures = Math.max(acc.peakTextures, loaded.size); + const h = heapMB(); if (h) acc.peakHeapMB = Math.max(acc.peakHeapMB, Math.round(h)); + if (now - lastOverlay > 500) { + lastOverlay = now; + const sum = recent.reduce((s, r) => s + r.dt, 0), fpsAvg = recent.length * 1000 / sum, fpsMin = 1000 / Math.max(...recent.map((r) => r.dt)); + const s = snapshot(); + $('stats').textContent = +`fps(5s) avg ${fpsAvg.toFixed(0)} min ${fpsMin.toFixed(0)} | moving avg ${s.movingFpsAvg ?? '-'} p5 ${s.movingFpsP5 ?? '-'} min ${s.movingFpsMin ?? '-'} +tile ${size}px mode ${mode} zoom ${cam.z.toFixed(2)} world ${WORLD} +sprites ${world.children.length} textures ${loaded.size} pool ${pool.length} +req inflight ${inflight.size} done ${acc.done} failed ${acc.failed} (${(acc.bytes / 1e6).toFixed(1)} MB) +fetch+decode ms med ${s.fetchDecodeMsMed ?? '-'} p95 ${s.fetchDecodeMsP95 ?? '-'} +viewport loaded ms: ${ttvlT0 !== null ? 'loading...' : (s.ttvlMs.at(-1) ?? '-')} (all: ${s.ttvlMs.join(',')}) +heap ${h ? h.toFixed(0) + ' MB' : 'n/a'} dpr ${devicePixelRatio} res ${app.renderer.resolution} +renderer ${app.renderer.name}${gl ? ' ' + String(gl.getParameter(gl.VERSION)) : ''} +${navigator.userAgent}`; + } +}); +ttvlT0 = performance.now();