mirror of
https://github.com/litruv/picoGraph.git
synced 2026-11-27 00:45:49 +11:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d56c7ce04 | ||
|
|
f917cf6ad5 | ||
|
|
71354ad463 | ||
|
|
ae374db9fb |
No files matched your search
@@ -0,0 +1,7 @@
|
|||||||
|
************************************* Invoked: Sat Mar 21 02:32:52 2026
|
||||||
|
[0] Arguments: C:\Users\litru\AppData\Local\Temp\WinGet\MSYS2.MSYS2.20251213\msys2-x86_64-20251213.exe, install, --confirm-command, --root, C:\msys64
|
||||||
|
[10] Operations sanity check succeeded.
|
||||||
|
[22] Using metadata cache from "C:/Users/litru/AppData/Local/cache\\qt-installer-framework\\d75f1c19-3379-3717-ae8d-1404b51494a9"
|
||||||
|
[22] Found 0 cached items.
|
||||||
|
[29] Loaded control script ":/metadata/installer-config/control_js"
|
||||||
|
[30] TargetDirectoryInUse : Error : The directory you selected already exists and contains an installation. Choose a different target for installation.
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
+225
-1
@@ -1,6 +1,24 @@
|
|||||||
const { app, BrowserWindow, ipcMain, Menu } = require("electron");
|
// Enable hot-reload during development
|
||||||
|
try {
|
||||||
|
require('electron-reloader')(module, {
|
||||||
|
debug: false,
|
||||||
|
watchRenderer: true,
|
||||||
|
ignore: [
|
||||||
|
/node_modules/,
|
||||||
|
/\.git/,
|
||||||
|
/dist/,
|
||||||
|
/build/,
|
||||||
|
/pico8-temp-player\.html$/
|
||||||
|
]
|
||||||
|
});
|
||||||
|
} catch (_) {
|
||||||
|
// Ignore errors in production (when electron-reloader isn't installed)
|
||||||
|
}
|
||||||
|
|
||||||
|
const { app, BrowserWindow, ipcMain, Menu, shell, dialog } = require("electron");
|
||||||
const fs = require("node:fs/promises");
|
const fs = require("node:fs/promises");
|
||||||
const path = require("node:path");
|
const path = require("node:path");
|
||||||
|
const { spawn } = require("node:child_process");
|
||||||
|
|
||||||
const OUTPUT_FILENAME = "compiled.lua";
|
const OUTPUT_FILENAME = "compiled.lua";
|
||||||
|
|
||||||
@@ -23,6 +41,16 @@ function getOutputPath() {
|
|||||||
return path.join(getOutputDirectory(), OUTPUT_FILENAME);
|
return path.join(getOutputDirectory(), OUTPUT_FILENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves the absolute directory where tileset images are stored.
|
||||||
|
*
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function getTilesetsDirectory() {
|
||||||
|
const applicationData = app.getPath("appData");
|
||||||
|
return path.join(applicationData, "pico-8", "carts", "picograph", "tilesets");
|
||||||
|
}
|
||||||
|
|
||||||
/** @type {import("electron").BrowserWindow | null} */
|
/** @type {import("electron").BrowserWindow | null} */
|
||||||
let mainWindow = null;
|
let mainWindow = null;
|
||||||
|
|
||||||
@@ -37,6 +65,7 @@ function createMainWindow() {
|
|||||||
height: 900,
|
height: 900,
|
||||||
minWidth: 960,
|
minWidth: 960,
|
||||||
minHeight: 640,
|
minHeight: 640,
|
||||||
|
frame: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
@@ -51,6 +80,23 @@ function createMainWindow() {
|
|||||||
|
|
||||||
window.loadFile(path.join(__dirname, "index.html"));
|
window.loadFile(path.join(__dirname, "index.html"));
|
||||||
|
|
||||||
|
// Open DevTools in development
|
||||||
|
window.webContents.openDevTools();
|
||||||
|
|
||||||
|
// Register F12 to toggle DevTools
|
||||||
|
window.webContents.on('before-input-event', (event, input) => {
|
||||||
|
if (input.key === 'F12') {
|
||||||
|
window.webContents.toggleDevTools();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const emitMaximizedState = () => {
|
||||||
|
window.webContents.send("window:maximized-changed", window.isMaximized());
|
||||||
|
};
|
||||||
|
|
||||||
|
window.on("maximize", emitMaximizedState);
|
||||||
|
window.on("unmaximize", emitMaximizedState);
|
||||||
|
|
||||||
window.on("closed", () => {
|
window.on("closed", () => {
|
||||||
mainWindow = null;
|
mainWindow = null;
|
||||||
});
|
});
|
||||||
@@ -75,6 +121,184 @@ function registerIpcHandlers() {
|
|||||||
|
|
||||||
return { filePath: outputPath };
|
return { filePath: outputPath };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("cart:preview", async (_event, cartContent) => {
|
||||||
|
if (typeof cartContent !== "string") {
|
||||||
|
throw new TypeError("Cart content must be a string");
|
||||||
|
}
|
||||||
|
|
||||||
|
const tempCartPath = path.join(app.getPath("temp"), `preview_${Date.now()}.p8`);
|
||||||
|
await fs.writeFile(tempCartPath, cartContent, "utf8");
|
||||||
|
|
||||||
|
return { filePath: tempCartPath };
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("player:writeHtml", async (_event, htmlContent) => {
|
||||||
|
if (typeof htmlContent !== "string") {
|
||||||
|
throw new TypeError("HTML content must be a string");
|
||||||
|
}
|
||||||
|
|
||||||
|
const playerPath = path.join(__dirname, "public", "pico8-temp-player.html");
|
||||||
|
await fs.writeFile(playerPath, htmlContent, "utf8");
|
||||||
|
|
||||||
|
return { filePath: playerPath };
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("player:writeCart", async (_event, cartContent) => {
|
||||||
|
if (typeof cartContent !== "string") {
|
||||||
|
throw new TypeError("Cart content must be a string");
|
||||||
|
}
|
||||||
|
|
||||||
|
const cartPath = path.join(__dirname, "public", "pico8-cart.p8");
|
||||||
|
await fs.writeFile(cartPath, cartContent, "utf8");
|
||||||
|
|
||||||
|
return { filePath: cartPath };
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("window:minimize", () => {
|
||||||
|
mainWindow?.minimize();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("window:toggle-maximize", () => {
|
||||||
|
if (!mainWindow) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainWindow.isMaximized()) {
|
||||||
|
mainWindow.unmaximize();
|
||||||
|
} else {
|
||||||
|
mainWindow.maximize();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mainWindow.isMaximized();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("window:close", () => {
|
||||||
|
mainWindow?.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("window:is-maximized", () => {
|
||||||
|
return mainWindow?.isMaximized() ?? false;
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("tileset:save", async (_event, fileBuffer, suggestedName) => {
|
||||||
|
if (!(fileBuffer instanceof Uint8Array)) {
|
||||||
|
throw new TypeError("File buffer must be a Uint8Array");
|
||||||
|
}
|
||||||
|
if (typeof suggestedName !== "string") {
|
||||||
|
throw new TypeError("Suggested name must be a string");
|
||||||
|
}
|
||||||
|
|
||||||
|
const tilesetsDir = getTilesetsDirectory();
|
||||||
|
await fs.mkdir(tilesetsDir, { recursive: true });
|
||||||
|
|
||||||
|
// Ensure unique filename
|
||||||
|
let fileName = suggestedName.endsWith(".png") ? suggestedName : `${suggestedName}.png`;
|
||||||
|
let filePath = path.join(tilesetsDir, fileName);
|
||||||
|
let counter = 1;
|
||||||
|
|
||||||
|
while (await fs.access(filePath).then(() => true).catch(() => false)) {
|
||||||
|
const nameWithoutExt = suggestedName.replace(/\.png$/i, "");
|
||||||
|
fileName = `${nameWithoutExt}_${counter}.png`;
|
||||||
|
filePath = path.join(tilesetsDir, fileName);
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
await fs.writeFile(filePath, Buffer.from(fileBuffer));
|
||||||
|
|
||||||
|
return { filePath, fileName };
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("tileset:show-in-folder", async (_event, filePath) => {
|
||||||
|
if (typeof filePath !== "string") {
|
||||||
|
throw new TypeError("File path must be a string");
|
||||||
|
}
|
||||||
|
|
||||||
|
shell.showItemInFolder(filePath);
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("tileset:reload", async (_event, filePath) => {
|
||||||
|
if (typeof filePath !== "string") {
|
||||||
|
throw new TypeError("File path must be a string");
|
||||||
|
}
|
||||||
|
|
||||||
|
const buffer = await fs.readFile(filePath);
|
||||||
|
return { buffer: Array.from(buffer) };
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("cart:get-stats", async (_event, cartContent) => {
|
||||||
|
if (typeof cartContent !== "string") {
|
||||||
|
throw new TypeError("Cart content must be a string");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write cart to a temporary file
|
||||||
|
const tempDir = app.getPath("temp");
|
||||||
|
const tempCartPath = path.join(tempDir, `stats_${Date.now()}.p8`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await fs.writeFile(tempCartPath, cartContent, "utf8");
|
||||||
|
|
||||||
|
// Run p8tool stats command
|
||||||
|
const picotoolPath = path.join(__dirname, "picotool");
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const p8tool = spawn("p8tool", ["stats", tempCartPath], {
|
||||||
|
cwd: __dirname,
|
||||||
|
shell: true
|
||||||
|
});
|
||||||
|
|
||||||
|
let stdout = "";
|
||||||
|
let stderr = "";
|
||||||
|
|
||||||
|
p8tool.stdout.on("data", (data) => {
|
||||||
|
stdout += data.toString();
|
||||||
|
});
|
||||||
|
|
||||||
|
p8tool.stderr.on("data", (data) => {
|
||||||
|
stderr += data.toString();
|
||||||
|
});
|
||||||
|
|
||||||
|
p8tool.on("close", async (code) => {
|
||||||
|
// Clean up temp file
|
||||||
|
try {
|
||||||
|
await fs.unlink(tempCartPath);
|
||||||
|
} catch (cleanupError) {
|
||||||
|
console.warn("Failed to delete temp cart:", cleanupError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code !== 0) {
|
||||||
|
reject(new Error(`p8tool stats exited with code ${code}: ${stderr}`));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse the output to extract token count
|
||||||
|
// Expected format: "version: 0 lines: 48 chars: 419 tokens: 134"
|
||||||
|
const tokenMatch = stdout.match(/tokens:\s*(\d+)/);
|
||||||
|
const linesMatch = stdout.match(/lines:\s*(\d+)/);
|
||||||
|
const charsMatch = stdout.match(/chars:\s*(\d+)/);
|
||||||
|
|
||||||
|
resolve({
|
||||||
|
tokens: tokenMatch ? parseInt(tokenMatch[1], 10) : 0,
|
||||||
|
lines: linesMatch ? parseInt(linesMatch[1], 10) : 0,
|
||||||
|
chars: charsMatch ? parseInt(charsMatch[1], 10) : 0,
|
||||||
|
rawOutput: stdout
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
p8tool.on("error", (error) => {
|
||||||
|
reject(new Error(`Failed to run p8tool: ${error.message}`));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
// Clean up temp file if it exists
|
||||||
|
try {
|
||||||
|
await fs.unlink(tempCartPath);
|
||||||
|
} catch (_) {
|
||||||
|
// Ignore cleanup errors
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+104
-14
@@ -3,16 +3,23 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self'; font-src 'self' data:;" />
|
||||||
<title>picoGraph</title>
|
<title>picoGraph</title>
|
||||||
<link rel="stylesheet" href="styles/main.css" />
|
<link rel="stylesheet" href="styles/main.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="app-header">
|
<header class="app-header">
|
||||||
<div class="header-primary-actions">
|
<div class="header-actions header-actions--left" aria-label="Workspace tools">
|
||||||
<button id="compileButton" class="header-primary-button" type="button">Compile</button>
|
<button
|
||||||
</div>
|
id="tileManagerButton"
|
||||||
<div class="header-title">picoGraph</div>
|
class="header-icon-button"
|
||||||
<div class="header-actions">
|
type="button"
|
||||||
|
aria-label="Tile manager"
|
||||||
|
title="Tile manager"
|
||||||
|
>
|
||||||
|
<span class="header-icon header-icon--tiles" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
<span class="header-icon-spacer" aria-hidden="true"></span>
|
||||||
<button
|
<button
|
||||||
id="projectSettingsButton"
|
id="projectSettingsButton"
|
||||||
class="header-icon-button"
|
class="header-icon-button"
|
||||||
@@ -22,6 +29,25 @@
|
|||||||
>
|
>
|
||||||
<span class="header-icon header-icon--settings" aria-hidden="true"></span>
|
<span class="header-icon header-icon--settings" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
id="exportLuaButton"
|
||||||
|
class="header-icon-button"
|
||||||
|
type="button"
|
||||||
|
aria-label="Export Lua"
|
||||||
|
title="Export Lua"
|
||||||
|
>
|
||||||
|
<span class="header-icon header-icon--export" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
<span class="header-icon-spacer" aria-hidden="true"></span>
|
||||||
|
<button
|
||||||
|
id="frameSelectionButton"
|
||||||
|
class="header-icon-button"
|
||||||
|
type="button"
|
||||||
|
aria-label="Frame selection"
|
||||||
|
title="Frame selection"
|
||||||
|
>
|
||||||
|
<span class="header-icon header-icon--frame" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
id="paletteToggleButton"
|
id="paletteToggleButton"
|
||||||
class="header-icon-button"
|
class="header-icon-button"
|
||||||
@@ -32,24 +58,58 @@
|
|||||||
>
|
>
|
||||||
<span class="header-icon header-icon--palette" aria-hidden="true"></span>
|
<span class="header-icon header-icon--palette" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="header-titlebar">
|
||||||
|
<div class="header-title">picoGraph</div>
|
||||||
|
</div>
|
||||||
|
<div class="header-primary-actions">
|
||||||
<button
|
<button
|
||||||
id="frameSelectionButton"
|
id="saveButton"
|
||||||
class="header-icon-button"
|
class="header-icon-button"
|
||||||
type="button"
|
type="button"
|
||||||
aria-label="Frame selection"
|
aria-label="Save workspace"
|
||||||
title="Frame selection"
|
title="Save workspace"
|
||||||
>
|
>
|
||||||
<span class="header-icon header-icon--frame" aria-hidden="true"></span>
|
<span class="header-icon header-icon--save" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
id="exportLuaButton"
|
id="previewButton"
|
||||||
class="header-icon-button"
|
class="header-icon-button header-icon-button--accent"
|
||||||
type="button"
|
type="button"
|
||||||
aria-label="Export Lua"
|
aria-label="Preview cart"
|
||||||
title="Export Lua"
|
title="Preview cart"
|
||||||
>
|
>
|
||||||
<span class="header-icon header-icon--export" aria-hidden="true"></span>
|
<span class="header-icon header-icon--play" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
|
<div id="windowControls" class="window-controls" aria-label="Window controls">
|
||||||
|
<button
|
||||||
|
id="minimizeWindowButton"
|
||||||
|
class="window-control-button"
|
||||||
|
type="button"
|
||||||
|
aria-label="Minimize window"
|
||||||
|
title="Minimize"
|
||||||
|
>
|
||||||
|
<span class="header-icon header-icon--minimize" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
id="maximizeWindowButton"
|
||||||
|
class="window-control-button"
|
||||||
|
type="button"
|
||||||
|
aria-label="Maximize window"
|
||||||
|
title="Maximize"
|
||||||
|
>
|
||||||
|
<span class="header-icon header-icon--maximize" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
id="closeWindowButton"
|
||||||
|
class="window-control-button window-control-button--close"
|
||||||
|
type="button"
|
||||||
|
aria-label="Close window"
|
||||||
|
title="Close"
|
||||||
|
>
|
||||||
|
<span class="header-icon header-icon--close-window" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<main id="appBody" class="app-body">
|
<main id="appBody" class="app-body">
|
||||||
@@ -127,6 +187,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
id="tileModal"
|
||||||
|
class="modal"
|
||||||
|
aria-hidden="true"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-labelledby="tileModalTitle"
|
||||||
|
hidden
|
||||||
|
>
|
||||||
|
<div class="modal__backdrop" data-modal-close></div>
|
||||||
|
<div class="modal__panel modal__panel--tile" role="document">
|
||||||
|
<header class="modal__header">
|
||||||
|
<h2 id="tileModalTitle">Tile Manager</h2>
|
||||||
|
<div class="modal__actions">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="modal__icon-button close-modal"
|
||||||
|
aria-label="Close tile manager"
|
||||||
|
title="Close"
|
||||||
|
data-modal-close
|
||||||
|
>
|
||||||
|
<span class="modal-icon modal-icon--close" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="modal__body">
|
||||||
|
<div class="tile-browser-container"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<template id="nodeTemplate">
|
<template id="nodeTemplate">
|
||||||
<article class="blueprint-node" draggable="false">
|
<article class="blueprint-node" draggable="false">
|
||||||
<header class="node-header">
|
<header class="node-header">
|
||||||
|
|||||||
Generated
+230
-2
@@ -10,7 +10,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^30.0.0",
|
"electron": "^30.0.0",
|
||||||
"electron-builder": "^24.6.3",
|
"electron-builder": "^24.6.3",
|
||||||
"electron-icon-builder": "^2.0.1"
|
"electron-icon-builder": "^2.0.1",
|
||||||
|
"electron-reloader": "^1.2.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/runtime": {
|
"node_modules/@babel/runtime": {
|
||||||
@@ -1318,6 +1319,20 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/anymatch": {
|
||||||
|
"version": "3.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
|
||||||
|
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"normalize-path": "^3.0.0",
|
||||||
|
"picomatch": "^2.0.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/app-builder-bin": {
|
"node_modules/app-builder-bin": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-4.0.0.tgz",
|
||||||
@@ -1729,6 +1744,19 @@
|
|||||||
"tweetnacl": "^0.14.3"
|
"tweetnacl": "^0.14.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/binary-extensions": {
|
||||||
|
"version": "2.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
|
||||||
|
"integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/bl": {
|
"node_modules/bl": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||||
@@ -2017,6 +2045,31 @@
|
|||||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/chokidar": {
|
||||||
|
"version": "3.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
|
||||||
|
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"anymatch": "~3.1.2",
|
||||||
|
"braces": "~3.0.2",
|
||||||
|
"glob-parent": "~5.1.2",
|
||||||
|
"is-binary-path": "~2.1.0",
|
||||||
|
"is-glob": "~4.0.1",
|
||||||
|
"normalize-path": "~3.0.0",
|
||||||
|
"readdirp": "~3.6.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8.10.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://paulmillr.com/funding/"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "~2.3.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/chownr": {
|
"node_modules/chownr": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
|
||||||
@@ -2375,6 +2428,19 @@
|
|||||||
"node": ">=0.10"
|
"node": ">=0.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/date-time": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/date-time/-/date-time-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"time-zone": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "4.4.3",
|
"version": "4.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||||
@@ -2881,6 +2947,13 @@
|
|||||||
"node": ">= 10.0.0"
|
"node": ">= 10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/electron-is-dev": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-R1oD5gMBPS7PVU8gJwH6CtT0e6VSoD0+SzSnYpNm+dBkcijgA+K7VAMHDfnRq/lkKPZArpzplTW6jfiMYosdzw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/electron-publish": {
|
"node_modules/electron-publish": {
|
||||||
"version": "24.13.1",
|
"version": "24.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-24.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-24.13.1.tgz",
|
||||||
@@ -2935,6 +3008,50 @@
|
|||||||
"node": ">= 10.0.0"
|
"node": ">= 10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/electron-reloader": {
|
||||||
|
"version": "1.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/electron-reloader/-/electron-reloader-1.2.3.tgz",
|
||||||
|
"integrity": "sha512-aDnACAzNg0QvQhzw7LYOx/nVS10mEtbuG6M0QQvNQcLnJEwFs6is+EGRCnM+KQlQ4KcTbdwnt07nd7ZjHpY4iw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"chalk": "^4.1.0",
|
||||||
|
"chokidar": "^3.5.0",
|
||||||
|
"date-time": "^3.1.0",
|
||||||
|
"electron-is-dev": "^1.2.0",
|
||||||
|
"find-up": "^5.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/electron-reloader/node_modules/find-up": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"locate-path": "^6.0.0",
|
||||||
|
"path-exists": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/electron-reloader/node_modules/path-exists": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/emoji-regex": {
|
"node_modules/emoji-regex": {
|
||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
@@ -3369,6 +3486,21 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"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/function-bind": {
|
"node_modules/function-bind": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||||
@@ -3993,6 +4125,19 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/is-binary-path": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"binary-extensions": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/is-ci": {
|
"node_modules/is-ci": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz",
|
||||||
@@ -4495,6 +4640,22 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/locate-path": {
|
||||||
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"p-locate": "^5.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/lodash": {
|
"node_modules/lodash": {
|
||||||
"version": "4.17.21",
|
"version": "4.17.21",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
@@ -4802,7 +4963,6 @@
|
|||||||
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
|
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@@ -4891,6 +5051,38 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/p-limit": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"yocto-queue": "^0.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/p-locate": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"p-limit": "^3.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/p-map": {
|
"node_modules/p-map": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz",
|
||||||
@@ -5564,6 +5756,19 @@
|
|||||||
"minimatch": "^5.1.0"
|
"minimatch": "^5.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/readdirp": {
|
||||||
|
"version": "3.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
||||||
|
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"picomatch": "^2.2.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/regenerator-runtime": {
|
"node_modules/regenerator-runtime": {
|
||||||
"version": "0.13.11",
|
"version": "0.13.11",
|
||||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
|
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
|
||||||
@@ -6449,6 +6654,16 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/time-zone": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/time-zone/-/time-zone-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/timm": {
|
"node_modules/timm": {
|
||||||
"version": "1.7.1",
|
"version": "1.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz",
|
||||||
@@ -6869,6 +7084,19 @@
|
|||||||
"fd-slicer": "~1.1.0"
|
"fd-slicer": "~1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/yocto-queue": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/zip-stream": {
|
"node_modules/zip-stream": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.1.tgz",
|
||||||
|
|||||||
+4
-2
@@ -12,7 +12,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^30.0.0",
|
"electron": "^30.0.0",
|
||||||
"electron-builder": "^24.6.3",
|
"electron-builder": "^24.6.3",
|
||||||
"electron-icon-builder": "^2.0.1"
|
"electron-icon-builder": "^2.0.1",
|
||||||
|
"electron-reloader": "^1.2.3"
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"appId": "com.litruv.picograph",
|
"appId": "com.litruv.picograph",
|
||||||
@@ -22,7 +23,8 @@
|
|||||||
"output": "dist"
|
"output": "dist"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"**/*"
|
"**/*",
|
||||||
|
"!picotool/**/*"
|
||||||
],
|
],
|
||||||
"win": {
|
"win": {
|
||||||
"icon": "build/icons/icon.ico",
|
"icon": "build/icons/icon.ico",
|
||||||
|
|||||||
+3416
File diff suppressed because it is too large.
Load diff
Submodule
+1
Submodule picotool added at 49808e5ddb.
+158
@@ -17,6 +17,164 @@ const api = {
|
|||||||
|
|
||||||
return ipcRenderer.invoke("lua:compile", source);
|
return ipcRenderer.invoke("lua:compile", source);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a temporary .p8 cart file for preview
|
||||||
|
*
|
||||||
|
* @param {string} cartContent Complete .p8 cart file content
|
||||||
|
* @returns {Promise<{ filePath: string }>}
|
||||||
|
*/
|
||||||
|
previewCart(cartContent) {
|
||||||
|
if (typeof cartContent !== "string") {
|
||||||
|
return Promise.reject(new TypeError("Cart content must be a string"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ipcRenderer.invoke("cart:preview", cartContent);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the PICO-8 player HTML to disk and returns the file path
|
||||||
|
*
|
||||||
|
* @param {string} htmlContent The player HTML content
|
||||||
|
* @returns {Promise<{ filePath: string }>}
|
||||||
|
*/
|
||||||
|
writePlayerHtml(htmlContent) {
|
||||||
|
if (typeof htmlContent !== "string") {
|
||||||
|
return Promise.reject(new TypeError("HTML content must be a string"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ipcRenderer.invoke("player:writeHtml", htmlContent);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the cart .p8 file to the public directory for the player to load
|
||||||
|
*
|
||||||
|
* @param {string} cartContent The .p8 cart content
|
||||||
|
* @returns {Promise<{ filePath: string }>}
|
||||||
|
*/
|
||||||
|
writePlayerCart(cartContent) {
|
||||||
|
if (typeof cartContent !== "string") {
|
||||||
|
return Promise.reject(new TypeError("Cart content must be a string"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ipcRenderer.invoke("player:writeCart", cartContent);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimizes the current window.
|
||||||
|
*
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
minimizeWindow() {
|
||||||
|
return ipcRenderer.invoke("window:minimize");
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles the current window maximize state.
|
||||||
|
*
|
||||||
|
* @returns {Promise<boolean>}
|
||||||
|
*/
|
||||||
|
toggleMaximizeWindow() {
|
||||||
|
return ipcRenderer.invoke("window:toggle-maximize");
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the current window.
|
||||||
|
*
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
closeWindow() {
|
||||||
|
return ipcRenderer.invoke("window:close");
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the current maximize state for the window.
|
||||||
|
*
|
||||||
|
* @returns {Promise<boolean>}
|
||||||
|
*/
|
||||||
|
getWindowMaximized() {
|
||||||
|
return ipcRenderer.invoke("window:is-maximized");
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribes to maximize state changes.
|
||||||
|
*
|
||||||
|
* @param {(isMaximized: boolean) => void} callback
|
||||||
|
* @returns {() => void}
|
||||||
|
*/
|
||||||
|
onWindowMaximizedChanged(callback) {
|
||||||
|
if (typeof callback !== "function") {
|
||||||
|
return () => {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const listener = (_event, isMaximized) => {
|
||||||
|
callback(Boolean(isMaximized));
|
||||||
|
};
|
||||||
|
ipcRenderer.on("window:maximized-changed", listener);
|
||||||
|
return () => {
|
||||||
|
ipcRenderer.removeListener("window:maximized-changed", listener);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves a tileset image file to the application data directory.
|
||||||
|
*
|
||||||
|
* @param {Uint8Array} fileBuffer The PNG file data
|
||||||
|
* @param {string} suggestedName Suggested filename
|
||||||
|
* @returns {Promise<{ filePath: string, fileName: string }>}
|
||||||
|
*/
|
||||||
|
saveTileset(fileBuffer, suggestedName) {
|
||||||
|
if (!(fileBuffer instanceof Uint8Array)) {
|
||||||
|
return Promise.reject(new TypeError("File buffer must be a Uint8Array"));
|
||||||
|
}
|
||||||
|
if (typeof suggestedName !== "string") {
|
||||||
|
return Promise.reject(new TypeError("Suggested name must be a string"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ipcRenderer.invoke("tileset:save", fileBuffer, suggestedName);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows a tileset file in the system file explorer.
|
||||||
|
*
|
||||||
|
* @param {string} filePath Path to the tileset file
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
showTilesetInFolder(filePath) {
|
||||||
|
if (typeof filePath !== "string") {
|
||||||
|
return Promise.reject(new TypeError("File path must be a string"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ipcRenderer.invoke("tileset:show-in-folder", filePath);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reloads a tileset image from disk.
|
||||||
|
*
|
||||||
|
* @param {string} filePath Path to the tileset file
|
||||||
|
* @returns {Promise<{ buffer: number[] }>}
|
||||||
|
*/
|
||||||
|
reloadTileset(filePath) {
|
||||||
|
if (typeof filePath !== "string") {
|
||||||
|
return Promise.reject(new TypeError("File path must be a string"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ipcRenderer.invoke("tileset:reload", filePath);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets PICO-8 cart statistics using p8tool stats command.
|
||||||
|
*
|
||||||
|
* @param {string} cartContent Complete .p8 cart file content
|
||||||
|
* @returns {Promise<{ tokens: number, lines: number, chars: number, rawOutput: string }>}
|
||||||
|
*/
|
||||||
|
getCartStats(cartContent) {
|
||||||
|
if (typeof cartContent !== "string") {
|
||||||
|
return Promise.reject(new TypeError("Cart content must be a string"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ipcRenderer.invoke("cart:get-stats", cartContent);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld("electronAPI", api);
|
contextBridge.exposeInMainWorld("electronAPI", api);
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
pico-8 cartridge // http://www.pico-8.com
|
||||||
|
version 41
|
||||||
|
__lua__
|
||||||
|
-- Generated with picoGraph
|
||||||
|
|
||||||
|
zzzz = ""
|
||||||
|
offset = 0
|
||||||
|
color = 5
|
||||||
|
var1 = nil
|
||||||
|
|
||||||
|
function _update()
|
||||||
|
-- sequence a
|
||||||
|
cls()
|
||||||
|
offset = 0
|
||||||
|
-- sequence b
|
||||||
|
if btn(0, 0) then
|
||||||
|
print("left", 0, offset, rnd((16) + (1)))
|
||||||
|
custom_addoffset()
|
||||||
|
end
|
||||||
|
-- sequence c
|
||||||
|
if btn(1, 0) then
|
||||||
|
print("right", 0, offset, color)
|
||||||
|
local itsalocalvariable = true
|
||||||
|
if itsalocalvariable then
|
||||||
|
custom_addoffset()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- sequence d
|
||||||
|
if btn(2, 0) then
|
||||||
|
print("up", 0, offset, color)
|
||||||
|
custom_addoffset()
|
||||||
|
end
|
||||||
|
-- sequence e
|
||||||
|
if btn(3, 0) then
|
||||||
|
print("down", 0, offset, color)
|
||||||
|
custom_addoffset()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function custom_addoffset()
|
||||||
|
offset = (offset) + (7)
|
||||||
|
end
|
||||||
|
__gfx__
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,95 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<style>
|
||||||
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
|
body { background: #1a1a2e; display: flex; align-items: center; justify-content: center; width: 100vw; height: 100vh; overflow: hidden; }
|
||||||
|
#canvas { image-rendering: pixelated; image-rendering: crisp-edges; width: 512px !important; height: 512px !important; border: 8px solid #000; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<canvas id="canvas" width="128" height="128"></canvas>
|
||||||
|
<script>
|
||||||
|
var pico8_state = [];
|
||||||
|
var pico8_buttons = [0,0,0,0,0,0,0,0];
|
||||||
|
var codo_command = 0;
|
||||||
|
var _cartname = ['untitled.p8'];
|
||||||
|
var codo_key_buffer = [];
|
||||||
|
var p8_keyboard_state = 0;
|
||||||
|
var pico8_mouse = [];
|
||||||
|
var pico8_gamepads = { count: 0 };
|
||||||
|
var pico8_gpio = new Array(128).fill(0);
|
||||||
|
var p8_dropped_cart = null;
|
||||||
|
var p8_dropped_cart_name = '';
|
||||||
|
|
||||||
|
var CART_B64 = 'cGljby04IGNhcnRyaWRnZSAvLyBodHRwOi8vd3d3LnBpY28tOC5jb20KdmVyc2lvbiA0MQpfX2x1YV9fCi0tIEdlbmVyYXRlZCB3aXRoIHBpY29HcmFwaAoKZnVuY3Rpb24gX2RyYXcoKQogIGNscygwKQogIGNpcmNmaWxsKDMyLCAzMiwgMjQsIDgpCmVuZApmdW5jdGlvbiBfdXBkYXRlKCkKZW5kCgpfX2dmeF9fCjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCg==';
|
||||||
|
|
||||||
|
// Silence all XHR — PICO-8 makes BBS metadata calls that crash from file:// origin.
|
||||||
|
(function() {
|
||||||
|
function MockXHR() {
|
||||||
|
this.onload = null; this.onerror = null; this.onreadystatechange = null;
|
||||||
|
this.readyState = 0; this.status = 0; this.statusText = '';
|
||||||
|
this.response = null; this.responseText = ''; this.responseType = '';
|
||||||
|
}
|
||||||
|
MockXHR.UNSENT=0; MockXHR.OPENED=1; MockXHR.HEADERS_RECEIVED=2; MockXHR.LOADING=3; MockXHR.DONE=4;
|
||||||
|
MockXHR.prototype.open = function() { this.readyState = 1; };
|
||||||
|
MockXHR.prototype.send = function() {
|
||||||
|
var self = this;
|
||||||
|
setTimeout(function() {
|
||||||
|
self.readyState = 4; self.status = 200; self.statusText = 'OK';
|
||||||
|
self.response = self.responseType === 'arraybuffer' ? new ArrayBuffer(0) : '';
|
||||||
|
self.responseText = '';
|
||||||
|
if (typeof self.onload === 'function') self.onload({ target: self });
|
||||||
|
if (typeof self.onreadystatechange === 'function') self.onreadystatechange();
|
||||||
|
}, 0);
|
||||||
|
};
|
||||||
|
MockXHR.prototype.setRequestHeader = function() {};
|
||||||
|
MockXHR.prototype.getResponseHeader = function() { return null; };
|
||||||
|
MockXHR.prototype.getAllResponseHeaders = function() { return ''; };
|
||||||
|
MockXHR.prototype.abort = function() {};
|
||||||
|
MockXHR.prototype.addEventListener = function(e, fn) {
|
||||||
|
if (e==='load') this.onload=fn;
|
||||||
|
if (e==='error') this.onerror=fn;
|
||||||
|
if (e==='readystatechange') this.onreadystatechange=fn;
|
||||||
|
};
|
||||||
|
MockXHR.prototype.removeEventListener = function() {};
|
||||||
|
window.XMLHttpRequest = MockXHR;
|
||||||
|
})();
|
||||||
|
|
||||||
|
var Module = {
|
||||||
|
arguments: [],
|
||||||
|
canvas: document.getElementById('canvas'),
|
||||||
|
preRun: [function() {
|
||||||
|
if (typeof IDBFS !== 'undefined' && typeof MEMFS !== 'undefined') {
|
||||||
|
var orig = FS.mount.bind(FS);
|
||||||
|
FS.mount = function(type, opts, mp) { return orig(type===IDBFS?MEMFS:type, opts, mp); };
|
||||||
|
}
|
||||||
|
FS.syncfs = function(populate, callback) {
|
||||||
|
var cb = typeof callback==='function' ? callback : typeof populate==='function' ? populate : null;
|
||||||
|
if (cb) setTimeout(function(){ cb(null); }, 0);
|
||||||
|
};
|
||||||
|
}],
|
||||||
|
postRun: [function() {
|
||||||
|
setTimeout(function() {
|
||||||
|
p8_dropped_cart = 'data:application/octet-stream;base64,' + CART_B64;
|
||||||
|
p8_dropped_cart_name = 'picograph.p8';
|
||||||
|
codo_command = 9;
|
||||||
|
|
||||||
|
// After cart loads, inject "run" + Enter to execute it
|
||||||
|
setTimeout(function() {
|
||||||
|
// Push keystrokes: r u n Enter (lowercase ASCII)
|
||||||
|
codo_key_buffer.push(114, 117, 110, 13);
|
||||||
|
}, 300);
|
||||||
|
}, 200);
|
||||||
|
}],
|
||||||
|
print: function(t) { console.log('P8:', t); },
|
||||||
|
printErr: function(t) { console.error('P8:', t); },
|
||||||
|
setStatus: function() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
function pico8_audio_context_suspended() { return false; }
|
||||||
|
</script>
|
||||||
|
<script src="./pico8_edu.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
var Module=typeof Module!=="undefined"?Module:{};if(!Module.expectedDataFileDownloads){Module.expectedDataFileDownloads=0;Module.finishedDataFileDownloads=0}Module.expectedDataFileDownloads++;(function(){var loadPackage=function(metadata){function runWithFS(){var fileData0=[];fileData0.push.apply(fileData0,[67,80,79,68,68,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,99,70,73,76,0,0,0,0,123,144,0,0,112,111,100,47,112,105,99,111,56,95,98,111,111,116,46,112,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,97,1,0,0,242,16,112,105,99,111,45,56,32,99,97,114,116,114,105,100,103,101,32,47,47,32,104,116,116,112,58,47,47,119,119,119,46,31,0,255,13,46,99,111,109,10,118,101,114,115,105,111,110,32,56,10,95,95,108,117,97,95,95,10,10,45,45,62,56,6,0,25,159,95,95,103,102,120,95,95,10,48,1,0,108,15,129,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,45,1,137,64,31,102,137,64,112,15,139,1,109,15,1,1,239,95,95,95,109,97,112,10,2,240,15,1,1,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,44,50,95,95,115,187,98,48,49,48,99,17,0,161,51,48,53,53,53,50,98,53,54,53,10,0,64,51,53,53,52,5,0,128,49,53,51,53,55,48,53,48,3,0,15,5,0,106,0,169,0,16,56,12,0,115,50,52,48,51,53,50,52,26,0,15,91,2,130,30,49,154,0,15,169,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,238,113,95,95,109,117,115,105,99,114,74,50,32,52,49,2,0,15,12,0,255,255,224,80,49,52,49,10,10,99,70,73,76,0,0,0,0,182,197,12,0,112,111,100,47,103,102,120,49,46,112,111,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,123,75,0,0,243,22,67,80,79,68,68,0,0,0,1,0,0,0,103,102,120,49,46,112,111,100,0,47,112,97,98,97,47,112,105,99,111,56,47,112,111,100,47,25,0,63,21,1,0,1,0,10,177,67,66,77,80,20,0,1,0,128,0,0,4,0,47,32,0,1,0,255,255,255,255,255,255,255,255,207,79,77,0,255,255,4,0,73,47,0,0,0,2,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,91,63,163,255,255,4,0,73,47,232,241,4,0,75,47,170,204,4,0,75,15,0,2,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,155,79,39,236,255,255,4,0,73,47,232,241,4,0,255,12,47,168,119,4,0,75,15,0,2,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,59,15,1,0,77,79,54,228,0,255,4,0,73,15,160,1,77,63,156,118,131,4,0,74,15,160,1,77,15,0,2,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,155,15,1,0,77,79,255,173,41,255,4,0,73,15,99,1,77,15,0,2,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,92,15,1,0,255,255,255,255,255,255,255,36,97,67,80,65,76,0,3,11,0,255,39,29,43,83,126,37,83,0,135,81,171,82,54,95,87,79,194,195,199,255,241,232,255,0,77,255,163,0,255,236,39,0,228,54,41,173,255,131,118,156,255,119,168,255,204,170,0,0,0,2,4,6,2,4,8,3,0,101,111,3,5,10,3,5,10,126,0,100,31,9,54,0,37,27,9,192,0,5,3,0,254,33,41,24,20,17,29,53,66,33,54,18,83,89,116,47,41,73,51,59,162,136,121,243,239,125,190,18,80,255,108,36,168,231,46,0,181,67,6,90,181,117,70,101,255,110,89,255,157,129,122,1,15,3,0,255,44,255,2,67,66,77,80,164,1,0,0,40,0,0,0,10,0,0,0,8,68,3,24,15,44,0,20,63,9,7,15,39,0,17,95,10,7,7,7,14,41,0,17,51,11,7,13,10,0,66,7,7,7,7,5,0,20,0,5,0,22,7,25,0,37,0,12,39,0,0,3,0,5,4,0,4,16,0,0,10,0,1,3,0,23,0,79,0,14,40,0,3,99,0,9,40,0,5,7,0,10,80,0,1,18,0,12,40,0,6,165,0,9,159,0,31,7,180,4,54,57,79,72,67,180,4,91,231,39,0,231,86,180,4,15,1,0,29,240,3,28,0,73,109,24,69,0,122,44,160,72,50,52,54,53,173,177,183,100,14,240,8,0,77,255,132,0,255,255,39,0,226,50,41,173,255,174,75,176,255,136,188,255,214,197,48,0,32,48,102,144,0,177,131,72,171,82,54,63,65,65,180,182,188,48,0,49,42,255,163,79,0,96,231,86,41,162,255,132,48,0,245,7,175,255,217,177,0,0,0,32,51,123,140,28,60,0,131,49,171,100,54,80,80,80,120,0,35,255,155,9,0,97,63,155,255,132,112,169,192,0,0,75,0,255,0,28,24,87,135,37,77,0,147,60,0,0,0,69,69,69,180,0,2,98,146,133,174,255,105,154,48,0,48,55,67,91,19,0,143,135,81,0,0,0,86,70,59,48,0,2,53,131,118,156,12,0,53,37,55,77,Line truncated
|
||||||
|
var asm=(/** @suppress {uselessCode} */ function(global,env,buffer) {
|
||||||
|
"use asm";var a=new global.Int8Array(buffer),b=new global.Int16Array(buffer),c=new global.Int32Array(buffer),d=new global.Uint8Array(buffer),e=new global.Uint16Array(buffer),f=new global.Float32Array(buffer),g=new global.Float64Array(buffer),h=env.ae|0,i=env.af|0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0.0,r=global.NaN,s=global.Infinity,t=global.Math.floor,u=global.Math.abs,v=global.Math.sqrt,w=global.Math.cos,x=global.Math.sin,y=global.Math.atan,z=global.Math.atan2,A=global.Math.ceil,B=global.Math.imul,C=global.Math.min,D=global.Math.clz32,E=env.a,F=env.b,G=env.c,H=env.d,I=env.e,J=env.f,K=env.g,L=env.h,M=env.i,N=env.j,O=env.k,P=env.l,Q=env.m,R=env.n,S=env.o,T=env.p,U=env.q,V=env.r,W=env.s,X=env.t,Y=env.u,Z=env.v,_=env.w,$=env.x,aa=env.y,ba=env.z,ca=env.A,da=env.B,ea=env.C,fa=env.D,ga=env.E,ha=env.F,ia=env.G,ja=env.H,ka=env.I,la=env.J,ma=env.K,na=env.L,oa=env.M,pa=env.N,qa=env.O,ra=env.P,sa=env.Q,ta=env.R,ua=env.S,va=env.T,wa=env.U,xa=env.V,ya=env.W,za=env.X,Aa=env.Y,Ba=env.Z,Ca=env._,Da=env.$,Ea=env.aa,Fa=env.ab,Ga=env.ac,Ha=env.ad,Ia=3373536,Ja=8616416,Ka=0.0;
|
||||||
|
// EMSCRIPTEN_START_FUNCS
|
||||||
|
function Di(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,C=0;e=Ia;Ia=Ia+16|0;f=e;g=c[b+8>>2]|0;h=c[b+12>>2]|0;i=(g|0)/8|0;j=(h|0)/8|0;k=(c[b>>2]|0)/8|0;l=b+4|0;m=(c[l>>2]|0)/8|0;n=c[(c[27952]|0)+12>>2]|0;if((g|0)<8|(h|0)<8){Ia=e;return}o=(B(m,-16)|0)-k+(c[842697]|0)|0;p=Hp(g,h,8)|0;q=Hp(i,j,8)|0;Ir(c[(c[27952]|0)+4>>2]|0,p,c[b>>2]|0,c[l>>2]|0,0,0,g,h);r=m+j|0;s=k+i|0;t=m;do{u=t<<4;v=t-m|0;w=k;do{x=w+u|0;if(x>>>0<256)Jp(q,w-k|0,v,c[(c[27952]|0)+44832+(x<<2)>>2]|0);w=w+1|0}while((w|0)<(s|0));t=t+1|0}while((t|0)<(r|0));t=c[b>>2]|0;b=c[l>>2]|0;Ep(c[(c[27952]|0)+4>>2]|0,t,b,g+-1+t|0,h+-1+b|0,0);b=k+i|0;t=c[27952]|0;if((g|0)>7){l=k+(m<<4)|0;s=k+1|0;w=((s|0)>(b|0)?s:b)-k<<2;b=0;s=m;while(1){ty(t+44832+(l+(b<<4)<<2)|0,0,w|0)|0;s=s+1|0;if((s|0)>=(r|0))break;else b=b+1|0}}b=c[842697]|0;Ir(p,c[(c[27952]|0)+4>>2]|0,0,0,b<<3&120,((b|0)/16|0)<<3,g,h);if((g|0)>7){g=0;do{h=0;do{b=c[842697]|0;s=(b&15)+h+(((b|0)/16|0)+g<<4)|0;if(s>>>0<256){b=Sp(q,h,g)|0;c[(c[27952]|0)+44832+(s<<2)>>2]=b}h=h+1|0}while((h|0)!=(i|0));g=g+1|0}while((g|0)!=(j|0))}j=c[27952]|0;g=j+4|0;h=j+12|0;j=32;do{b=j<<1;s=0;do{w=c[(c[(c[g>>2]|0)+16>>2]|0)+((s>>>6)+b<<2)>>2]|0;l=s<<1&126;a[(c[(c[(c[h>>2]|0)+16>>2]|0)+(j<<2)>>2]|0)+s>>0]=((d[w+(l|1)>>0]|0)<<4)+(d[w+l>>0]|0);s=s+1|0}while((s|0)!=128);j=j+1|0}while((j|0)!=64);Ip(p)|0;Ip(q)|0;if(on(c[811052]|0,f)|0){q=c[f+4>>2]|0;p=f+12|0;if((q|0)<=(c[p>>2]|0)){y=q;z=p;A=25}}else{c[f>>2]=0;c[f+4>>2]=0;c[f+8>>2]=127;p=f+12|0;c[p>>2]=31;y=0;z=p;A=25}if((A|0)==25){A=f+8|0;p=k+i|0;i=c[A>>2]|0;q=y;while(1){y=c[f>>2]|0;if((y|0)>(i|0))C=i;else{j=y;while(1){y=Sp(n,j,q)|0;h=y&15;g=(y|0)/16|0;if((g|0)<(r|0)&(((g|0)<(m|0)|((h|0)>=(p|0)|(h|0)<(k|0)))^1))Jp(n,j,q,o+y|0);y=c[A>>2]|0;if((j|0)<(y|0))j=j+1|0;else{C=y;break}}}if((q|0)<(c[z>>2]|0)){i=C;q=q+1|0}else break}}q=c[27952]|0;C=q+12|0;i=q+4|0;q=32;do{z=q<<1;A=0;do{o=(A>>>6)+z|0;n=A<<1&126;a[(c[(c[(c[i>>2]|0)+16>>2]|0)+(o<<2)>>2]|0)+n>>0]=a[(c[(c[(c[C>>2]|0)+16>>2]|0)+(q<<2)>>2]|0)+A>>0]&15;a[(c[(c[(c[i>>2]|0)+16>>2]|0)+(o<<2)>>2]|0)+(n|1)>>0]=(d[(c[(c[(c[C>>2]|0)+16>>2]|0)+(q<<2)>>2]|0)+A>>0]|0)>>>4;A=A+1|0}while((A|0)!=128);q=q+1|0}while((q|0)!=64);Ia=e;return}function Ei(){var b=0,d=0,e=0,f=0,g=0,h=0;b=a[3329306]|0;d=(b&255)<<8;e=a[3329307]|0;f=e<<24>>24==0?256:e&255;if(b<<24>>24>-1){e=(b&-16)<<24>>24==16?d+8192|0:d;b=(e+-8192|0)>>>0>7936?8192:e;g=b;h=(16384-b|0)/(f|0)|0}else{g=d;h=((65536-d|0)>>>0)/(f>>>0)|0}c[581854]=f;c[581855]=h;c[581856]=g;Tl(0,c[842609]|0)|0;Tl(1,c[842610]|0)|0;Tl(2,c[842611]|0)|0;Tl(3,c[842612]|0)|0;Ul(c[843156]|0);return}function Fi(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0;if((b|0)>=0?(f=c[581854]|0,(e|0)>-1&(f|0)>(b|0)&(c[581855]|0)>(e|0)):0){g=c[581856]|0;if(!(g&32768))h=(c[(c[(c[826224]|0)+12>>2]|0)+12>>2]|0)+(g+-8192)|0;else h=3304900+g|0;i=d[h+((B(f,e)|0)+b)>>0]|0;return i|0}if(!(a[3329274]&16)){i=0;return i|0}i=gm(3147996,c[826224]|0,24410)|0;return i|0}function Gi(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;if((b|0)<0)return;f=c[581854]|0;if(!((d|0)>-1&(f|0)>(b|0)&(c[581855]|0)>(d|0)))return;g=c[581856]|0;if(g&32768|0){a[3304900+g+((B(f,d)|0)+b)>>0]=e;return}h=(B(f,d)|0)+b|0;a[(c[(c[(c[826224]|0)+12>>2]|0)+12>>2]|0)+(g+-8192)+h>>0]=e;if((h|0)<=4095)return;fm(3147996,c[826224]|0,h,e);return}function Hi(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0;f=Ia;Ia=Ia+1808|0;g=f+1800|0;h=f+1792|0;i=f+768|0;j=f;k=f+1804|0;c[k>>2]=0;if(!(c[581858]|0)){c[581858]=1;ty(1444432,0,3600)|0}if(!(c[581857]|0)){l=9;Ia=f;return l|0}Hw(i,mc(63711,e)|0)|0;e=An(i,0,k)|0;if(!e){c[h>>2]=c[k>>2];c[h+4>>2]=i;Tv(1824144,63715,h)|0;rp(1824144);l=1;Ia=f;return l|0}c[g>>2]=i;Tv(1824144,63749,g)|0;rp(1824144);g=(b|0)>0?b:c[512164]|0;b=(g|0)<8?g:8;g=(b|0)>1?b:1;b=((g|0)<3?g:3)<<7;g=Hp(b,b,8)|0;if((c[581857]|0)>0){b=18;h=0;while(1){k=1444432+(h<<2)|0;m=c[k>>2]|0;if(!m){n=Hp(128,128,8)|0;c[k>>2]=n;o=n}else o=m;m=c[o+12>>2]|0;p=b;n=0;do{p=(d[m+n>>0]|0)>15?256:p;n=n+1|0}while((n|0)!=16384);h=h+1|0;if((h|0)>=(c[581857]|0))break;else b=p}if((p|0)>0){q=p;r=14}else s=p}else{q=18;r=14}if((r|0)==14){r=c[786986]|0;p=0;do{a[j+(p*3|0)>>0]=a[r+(p*3|0)>>0]|0;a[j+(p*3|0)+1>>0]=a[r+(p*3|0)+1>>0]|0;a[j+(p*3|0)+2>>0]=a[r+(p*3|0)+2>>0]|0;p=p+1|0}while((p|0)!=(q|0));s=q}q=zn(1<<(In(s)|0),j)|0;j=c[g>>2]|0;c[e>>2]=j;p=g+4|0;r=c[p>>2]|0;c[e+4>>2]=r;c[e+8>>2]=s;c[e+12>>2]=0;c[e+20>>2]=q;a:do if((c[581857]|0)>0){b=g+16|0;h=j;o=r;n=0;while(1){m=1444432+(n<<2)|0;Qp(c[m>>2]|0,g,0,0,h,o,0);k=Jn(e,0)|0;c[k>>2]=0;c[k+4>>2]=0;t=c[g>>2]|0;c[k+8>>2]=t;u=c[p>>2]|0;c[k+12>>2]=u;a[k+16>>0]=0;v=(n|0)!=0;c[k+20>>2]=v?0:q;w=xn(B(u,t)|0)|0;t=k+24|0;c[t>>2]=w;ty(w|0,0,B(c[p>>2]|0,c[g>>2]|0)|0)|0;w=c[p>>2]|0;if((w|0)>0){u=c[g>>2]|0;x=w;y=0;while(1){if((u|0)>0){z=u;A=0;do{a[(c[t>>2]|0)+((B(z,y)|0)+A)>>0]=(d[(c[(c[b>>2]|0)+(y<<2)>>2]|0)+A>>0]|0)%(s|0)|0;A=A+1|0;z=c[g>>2]|0}while((A|0)<(z|0));C=c[p>>2]|0;D=z}else{C=x;D=u}y=y+1|0;if((y|0)>=(C|0)){E=C;break}else{u=D;x=CLine truncated
|
||||||
|
function Tl(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;f=c[3148032+(b<<2)>>2]|0;g=b<<13;h=g+32768|0;i=a[3329306]|0;j=i<<24>>24<0&((i&255)<<8|0)<(g+40960|0)?0:e;e=3370436+(b<<2)|0;b=c[e>>2]|0;if((b|0)==0&(j|0)!=0){g=0;i=c[f+12>>2]|0;k=3304900+h|0;while(1){a[i>>0]=a[k>>0]&15;a[i+1>>0]=(d[k>>0]|0)>>>4;g=g+1|0;if((g|0)==8192)break;else{i=i+2|0;k=k+1|0}}l=c[e>>2]|0}else l=b;if((j|0)==0&(l|0)!=0){b=3304900+h|0;h=0;k=c[f+12>>2]|0;while(1){a[b>>0]=a[k+1>>0]<<4|a[k>>0]&15;h=h+1|0;if((h|0)==8192)break;else{b=b+1|0;k=k+2|0}}m=c[e>>2]|0}else m=l;if((m|0)==(j|0))return j|0;c[e>>2]=j;hm();qh(1024);return j|0}function Ul(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;d=(b|0)<3?b:3;b=(d|0)>0?d:0;c[843156]=b;d=a[3329304]|0;e=d&255;f=c[(c[826224]|0)+4>>2]|0;switch(d<<24>>24){case 0:{g=f;break}case 96:{g=c[3148048+(b<<2)>>2]|0;break}default:if(d<<24>>24<0&(e&224|0)==(e|0)?(d=e+-128>>5,(Tl(d,1)|0)!=0):0)g=c[3148032+(d<<2)>>2]|0;else g=f}f=c[826224]|0;c[f+8>>2]=g;g=a[3329305]|0;d=g&255;e=c[3148048+(c[843156]<<2)>>2]|0;switch(g<<24>>24){case 0:{h=c[f+4>>2]|0;break}case 96:{h=e;break}default:if(g<<24>>24<0&(d&224|0)==(d|0)?(g=d+-128>>5,(Tl(g,1)|0)!=0):0)h=c[3148032+(g<<2)>>2]|0;else h=e}c[787007]=h;Np(c[(c[826224]|0)+4>>2]|0);Np(c[787007]|0);Fp(c[787007]|0,c[825243]|0,c[825244]|0,c[825245]|0,c[825246]|0);return}function Vl(){var a=0,b=0;if(c[563337]|0)return 1;a=c[786990]|0;b=B((c[a+4>>2]|0)/128|0,(c[a>>2]|0)/128|0)|0;if((b|0)<1)return 1;else return ((b|0)<4?b:4)|0;return 0}function Wl(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;f=c[a>>2]|0;if((f|0)!=(c[b>>2]|0))return;g=a+4|0;h=c[g>>2]|0;if((h|0)!=(c[b+4>>2]|0))return;i=c[a+8>>2]|0;j=c[b+8>>2]|0;if((i|0)==(j|0)){Ir(a,b,0,0,0,0,f,h);return}if(!((i|0)==32&(j|0)==8&(h|0)>0))return;j=h;h=f;f=0;while(1){if((h|0)>0){i=0;do{k=Sp(a,i,f)|0;l=k>>>16&255;m=k>>>8&255;n=k&255;k=1e7;o=-1;p=0;while(1){q=c[3300844+(p<<2)>>2]&143;r=l-(d[e+(q*3|0)>>0]|0)|0;s=B(r,r)|0;r=m-(d[e+(q*3|0)+1>>0]|0)|0;t=(B(r,r)|0)+s|0;s=n-(d[e+(q*3|0)+2>>0]|0)|0;q=t+(B(s,s)|0)|0;s=(o|0)==-1|(q|0)<(k|0);o=s?p:o;p=p+1|0;if((p|0)==16)break;else k=s?q:k}Jp(b,i,f,o);i=i+1|0;u=c[a>>2]|0}while((i|0)<(u|0));v=c[g>>2]|0;w=u}else{v=j;w=h}f=f+1|0;if((f|0)>=(v|0))break;else{j=v;h=w}}return}function Xl(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;g=c[b>>2]|0;if((g|0)!=(c[e>>2]|0))return;h=b+4|0;i=c[h>>2]|0;if((i|0)!=(c[e+4>>2]|0))return;j=b+8|0;k=c[j>>2]|0;l=e+8|0;m=c[l>>2]|0;if((k|0)==(m|0)){Ir(b,e,0,0,0,0,g,i);return}if((k|0)==8&(m|0)==32){if((i|0)<=0)return;m=b+16|0;n=e+16|0;o=i;p=g;q=0;while(1){if((p|0)>0){r=c[(c[m>>2]|0)+(q<<2)>>2]|0;s=c[(c[n>>2]|0)+(q<<2)>>2]|0;t=0;do{u=a[r+t>>0]|0;v=u&255;c[s+(t<<2)>>2]=(d[f+(v*3|0)>>0]|0)<<16|(u<<24>>24==0?0:-16777216)|(d[f+(v*3|0)+1>>0]|0)<<8|(d[f+(v*3|0)+2>>0]|0);t=t+1|0;w=c[b>>2]|0}while((t|0)<(w|0));x=c[h>>2]|0;y=w}else{x=o;y=p}q=q+1|0;if((q|0)>=(x|0))break;else{o=x;p=y}}z=c[j>>2]|0;A=x;C=y}else{z=k;A=i;C=g}if((z|0)!=32)return;if(!((c[l>>2]|0)==8&(A|0)>0))return;l=e+16|0;e=C;C=A;A=0;z=0;g=0;while(1){if((e|0)>0){i=A;k=z;y=0;while(1){x=Sp(b,y,g)|0;j=i;i=x&-50529028;if((i|0)==(j|0))D=k;else{j=x>>>16&252;p=x>>>8&252;o=x&252;x=1e7;q=-1;w=0;while(1){n=w>>>0<16?w:w+112|0;m=j-(d[f+(n*3|0)>>0]|0)|0;t=B(m,m)|0;m=p-(d[f+(n*3|0)+1>>0]|0)|0;s=(B(m,m)|0)+t|0;t=o-(d[f+(n*3|0)+2>>0]|0)|0;m=s+(B(t,t)|0)|0;t=(q|0)==-1|(m|0)<(x|0);s=t?n:q;w=w+1|0;if((w|0)==32){D=s;break}else{x=t?m:x;q=s}}}a[(c[(c[l>>2]|0)+(g<<2)>>2]|0)+y>>0]=D;y=y+1|0;E=c[b>>2]|0;if((y|0)>=(E|0))break;else k=D}F=c[h>>2]|0;G=E;H=i;I=D}else{F=C;G=e;H=A;I=z}g=g+1|0;if((g|0)>=(F|0))break;else{e=G;C=F;A=H;z=I}}return}function Yl(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0;i=Ia;Ia=Ia+256|0;j=i+128|0;k=i;l=h&1;m=b+112|0;if(!(c[m>>2]|0)){n=c[825248]|0;c[b+96>>2]=n;o=c[825249]|0;c[b+100>>2]=o;p=b+68|0;if((c[p>>2]|0)==0?(c[b+60>>2]|0)==0:0)q=g;else q=g<<1;if((c[b+20>>2]|0)!=0?(n|0)>((c[b+24>>2]|0)-f|0):0){c[825248]=c[b+28>>2];n=b+48|0;r=c[n>>2]|0;if(!r)s=c[b+92>>2]|0;else s=r;r=s+o|0;c[825249]=r;c[n>>2]=0;t=r}else t=o;o=128-q-(c[b+124>>2]|0)+(c[825256]|0)|0;if((c[b+16>>2]|0)!=0&(t|0)>(o|0)){$a(t-o|0);u=p}else u=p}else u=b+68|0;p=c[3300780+((c[b+36>>2]&15)<<2)>>2]&15;o=c[3300780+((c[b+40>>2]&15)<<2)>>2]&15;t=b+136|0;q=c[3300780+((c[t>>2]&15)<<2)>>2]&15;if(!(c[u>>2]|0)){u=c[b+56>>2]|0;r=(u|0)!=0;n=r?2:1;s=c[b+60>>2]|0;v=(s|0)!=0;w=v?2:1;if((u|0)!=0?(c[b+64>>2]|0)!=0:0)x=(s|0)==0?1451104:1452128;else x=1452128;if(!s){y=n;z=w;A=x;C=0;D=v;E=r}else{y=n;z=w;A=x;C=(c[b+64>>2]|0)!=0;D=1;E=r}}else{y=2;z=2;A=1451104;C=1;D=1;E=1}r=0-l|0;x=y&r;w=z&r;r=((c[b+120>>2]|0)-(c[825255]|0)<<16>>16)+(c[825248]|0)|0;n=r-x|0;v=(c[825249]|0)+(h<<28>>31)+((c[b+124>>2]|0)-(c[825256]|0)<<16>>16)|0;h=v-w|0;s=(B(y,(f|0)<8?f:8)|0)+x|0;x=B(z,(g|0)<8?g:8)|0;u=x+w|0;w=BLine truncated
|
||||||
|
function hh(){var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;b=c[823146]|0;d=(a[c[c[823128]>>2]>>0]|0)==0;e=(b|0)==1?1:(a[c[c[823129]>>2]>>0]|0)!=0;f=(b|0)==2?1:(a[c[c[823130]>>2]>>0]|0)!=0;g=(b|0)==3?1:(a[c[c[823131]>>2]>>0]|0)!=0;h=(b|0)==4?1:(a[c[c[823132]>>2]>>0]|0)!=0;i=(b|0)==5?1:(a[c[c[823133]>>2]>>0]|0)!=0;j=(b|0)==6?1:(a[c[c[823134]>>2]>>0]|0)!=0;k=(b|0)==7?1:(a[c[c[823135]>>2]>>0]|0)!=0;l=(b|0)==8?1:(a[c[c[823136]>>2]>>0]|0)!=0;m=(b|0)==9?1:(a[c[c[823137]>>2]>>0]|0)!=0;n=(b|0)==10?1:(a[c[c[823138]>>2]>>0]|0)!=0;o=(b|0)==11?1:(a[c[c[823139]>>2]>>0]|0)!=0;p=(b|0)==12?1:(a[c[c[823140]>>2]>>0]|0)!=0;q=(b|0)==13?1:(a[c[c[823141]>>2]>>0]|0)!=0;r=(b|0)==14?1:(a[c[c[823142]>>2]>>0]|0)!=0;s=(b|0)==15?1:(a[c[c[823143]>>2]>>0]|0)!=0;a[c[c[27952]>>2]>>0]=0;t=s?15:r?14:q?13:p?12:o?11:n?10:m?9:l?8:k?7:j?6:i?5:h?4:g?3:f?2:e?1:((b|0)!=0&d)<<31>>31;Iw(c[c[27952]>>2]|0,c[c[823128]>>2]|0)|0;if((t|0)>0){d=c[c[27952]>>2]|0;b=d+(yw(d)|0)|0;a[b>>0]=a[99563]|0;a[b+1>>0]=a[99564]|0;a[b+2>>0]=a[99565]|0;a[b+3>>0]=a[99566]|0;a[b+4>>0]=a[99567]|0;a[b+5>>0]=a[99568]|0;a[b+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823129]>>2]|0)|0;if((t|0)>1){b=c[c[27952]>>2]|0;d=b+(yw(b)|0)|0;a[d>>0]=a[99563]|0;a[d+1>>0]=a[99564]|0;a[d+2>>0]=a[99565]|0;a[d+3>>0]=a[99566]|0;a[d+4>>0]=a[99567]|0;a[d+5>>0]=a[99568]|0;a[d+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823130]>>2]|0)|0;if((t|0)>2){d=c[c[27952]>>2]|0;b=d+(yw(d)|0)|0;a[b>>0]=a[99563]|0;a[b+1>>0]=a[99564]|0;a[b+2>>0]=a[99565]|0;a[b+3>>0]=a[99566]|0;a[b+4>>0]=a[99567]|0;a[b+5>>0]=a[99568]|0;a[b+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823131]>>2]|0)|0;if((t|0)>3){b=c[c[27952]>>2]|0;d=b+(yw(b)|0)|0;a[d>>0]=a[99563]|0;a[d+1>>0]=a[99564]|0;a[d+2>>0]=a[99565]|0;a[d+3>>0]=a[99566]|0;a[d+4>>0]=a[99567]|0;a[d+5>>0]=a[99568]|0;a[d+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823132]>>2]|0)|0;if((t|0)>4){d=c[c[27952]>>2]|0;b=d+(yw(d)|0)|0;a[b>>0]=a[99563]|0;a[b+1>>0]=a[99564]|0;a[b+2>>0]=a[99565]|0;a[b+3>>0]=a[99566]|0;a[b+4>>0]=a[99567]|0;a[b+5>>0]=a[99568]|0;a[b+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823133]>>2]|0)|0;if((t|0)>5){b=c[c[27952]>>2]|0;d=b+(yw(b)|0)|0;a[d>>0]=a[99563]|0;a[d+1>>0]=a[99564]|0;a[d+2>>0]=a[99565]|0;a[d+3>>0]=a[99566]|0;a[d+4>>0]=a[99567]|0;a[d+5>>0]=a[99568]|0;a[d+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823134]>>2]|0)|0;if((t|0)>6){d=c[c[27952]>>2]|0;b=d+(yw(d)|0)|0;a[b>>0]=a[99563]|0;a[b+1>>0]=a[99564]|0;a[b+2>>0]=a[99565]|0;a[b+3>>0]=a[99566]|0;a[b+4>>0]=a[99567]|0;a[b+5>>0]=a[99568]|0;a[b+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823135]>>2]|0)|0;if((t|0)>7){b=c[c[27952]>>2]|0;d=b+(yw(b)|0)|0;a[d>>0]=a[99563]|0;a[d+1>>0]=a[99564]|0;a[d+2>>0]=a[99565]|0;a[d+3>>0]=a[99566]|0;a[d+4>>0]=a[99567]|0;a[d+5>>0]=a[99568]|0;a[d+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823136]>>2]|0)|0;if((t|0)>8){d=c[c[27952]>>2]|0;b=d+(yw(d)|0)|0;a[b>>0]=a[99563]|0;a[b+1>>0]=a[99564]|0;a[b+2>>0]=a[99565]|0;a[b+3>>0]=a[99566]|0;a[b+4>>0]=a[99567]|0;a[b+5>>0]=a[99568]|0;a[b+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823137]>>2]|0)|0;if((t|0)>9){b=c[c[27952]>>2]|0;d=b+(yw(b)|0)|0;a[d>>0]=a[99563]|0;a[d+1>>0]=a[99564]|0;a[d+2>>0]=a[99565]|0;a[d+3>>0]=a[99566]|0;a[d+4>>0]=a[99567]|0;a[d+5>>0]=a[99568]|0;a[d+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823138]>>2]|0)|0;if((t|0)>10){d=c[c[27952]>>2]|0;b=d+(yw(d)|0)|0;a[b>>0]=a[99563]|0;a[b+1>>0]=a[99564]|0;a[b+2>>0]=a[99565]|0;a[b+3>>0]=a[99566]|0;a[b+4>>0]=a[99567]|0;a[b+5>>0]=a[99568]|0;a[b+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823139]>>2]|0)|0;if((t|0)>11){b=c[c[27952]>>2]|0;d=b+(yw(b)|0)|0;a[d>>0]=a[99563]|0;a[d+1>>0]=a[99564]|0;a[d+2>>0]=a[99565]|0;a[d+3>>0]=a[99566]|0;a[d+4>>0]=a[99567]|0;a[d+5>>0]=a[99568]|0;a[d+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823140]>>2]|0)|0;if((t|0)>12){d=c[c[27952]>>2]|0;b=d+(yw(d)|0)|0;a[b>>0]=a[99563]|0;a[b+1>>0]=a[99564]|0;a[b+2>>0]=a[99565]|0;a[b+3>>0]=a[99566]|0;a[b+4>>0]=a[99567]|0;a[b+5>>0]=a[99568]|0;a[b+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823141]>>2]|0)|0;if((t|0)>13){b=c[c[27952]>>2]|0;d=b+(yw(b)|0)|0;a[d>>0]=a[99563]|0;a[d+1>>0]=a[99564]|0;a[d+2>>0]=a[99565]|0;a[d+3>>0]=a[99566]|0;a[d+4>>0]=a[99567]|0;a[d+5>>0]=a[99568]|0;a[d+6>>0]=a[99569]|0}Iw(c[c[27952]>>2]|0,c[c[823142]>>2]|0)|0;if((t|0)<=14){u=c[27952]|0;v=c[u>>2]|0;w=c[823143]|0;x=c[w>>2]|0;Iw(v,x)|0;return}t=c[c[27952]>>2]|0;d=t+(yw(t)|0)|0;a[d>>0]=a[99563]|0;a[d+1>>0]=a[99564]|0;a[d+2>>0]=a[99565]|0;a[d+3>>0]=a[99566]|0;a[d+4>>0]=a[99567]|0;a[d+5>>0]=a[99568]|0;a[d+6>>0]=a[99569]|0;u=c[27952]|0;v=c[u>>2]|0;w=c[823143]|0;x=c[w>>2]|0;Iw(v,x)|0;return}function ih(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0;a=c[(c[823128]|0)+4>>2]|0;ty(c[a+12>>2]|0,0,c[a+88>>2]|0)|0;a=c[(c[823129]|0)+4>>2]|0;ty(c[a+12>>2]|0,0,c[a+88>>2]|0)|0;a=c[(c[823130]|0)+4>>2]|0;ty(c[a+12>>2]|0,0,c[a+88>>2]|0)|0;a=c[(c[823131]|0)+4>>2]|0;ty(c[a+12>>2]|0,0,c[a+88>>2]|0)|0;a=c[(c[823132]|0)+4>>2]|0;ty(c[a+12>>2]|0,0,c[a+88>>2]|0)|0;a=c[(c[823133]|0)+4>>2]|0;ty(c[a+12>>2]|0,0,c[a+88>>2]|0)|0;a=c[(c[823134]|0)+4>>2]|0;ty(c[a+12>>2]|0,0,c[a+88>>2Line truncated
|
||||||
|
function cp(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;if((f|0)<1){g=0;return g|0}if(!(c[599025]|0)){c[599025]=1;c[599026]=xs(524288)|0;ys(1774736,0,16384)}h=1774736+(b<<2)|0;i=c[h>>2]|0;if(!i){j=xs(48)|0;c[h>>2]=j;c[j>>2]=b;c[j+4>>2]=(b|0)/256|0;c[j+8>>2]=b&255;c[j+12>>2]=10;c[j+16>>2]=8e5;c[j+20>>2]=1050624;c[j+24>>2]=55;c[j+32>>2]=0;c[j+36>>2]=0;k=j}else k=i;do if(!(b&65280)){i=c[599027]|0;j=c[599028]|0;if((((f+7+j|0)/8|0)+i|0)>524282){fb(99695,1e3);c[599028]=0;g=0;return g|0}h=(b|0)==255;if(h|(c[9244]|0)!=(b|0)){if((j|0)>0){l=((j+7|0)/8|0)+i|0;c[599027]=l;m=c[599026]|0;n=c[599029]|0;a[m+n>>0]=j;a[m+(n+1)>>0]=j>>>8;o=m;p=l}else{o=c[599026]|0;p=i}c[9244]=b;c[599028]=0;a[o+p>>0]=b;a[o+(p+1)>>0]=b>>>8;c[599029]=p+2;l=p+4|0;c[599027]=l;q=l;r=0}else{q=i;r=j}if(h){h=c[599026]|0;a[h+q>>0]=f>>>3;a[h+(q+1)>>0]=f>>>11;c[599028]=r+16;s=f;break}h=r;j=q;i=0;l=0;while(1){m=i&7;if(!m){n=gm(3147996,c[826224]|0,(i>>>3)+e|0)|0;t=c[599028]|0;u=c[599027]|0;v=n}else{t=h;u=j;v=l}n=(c[599026]|0)+(((t|0)/8|0)+u)|0;a[n>>0]=(v>>>m&1)<<(t&7)|d[n>>0];h=t+1|0;c[599028]=h;i=i+1|0;if((i|0)==(f|0)){w=f;x=20;break}else{j=u;l=v}}}else{w=0;x=20}while(0);a:do if((x|0)==20){if((b|1|0)==257){if(!(c[599030]|0))c[599030]=xs(32768)|0;v=(f+7|0)/8|0;u=(f|0)>0;if(u){t=0;do{q=(gm(3147996,c[826224]|0,t+e|0)|0)&255;y=c[599030]|0;a[y+t>>0]=q;t=t+1|0}while((t|0)<(v|0));if(u?(fm(3147996,c[826224]|0,e,d[y>>0]|0),(f|0)>8):0){t=1;do{fm(3147996,c[826224]|0,t+e|0,d[(c[599030]|0)+t>>0]|0);t=t+1|0}while((t|0)<(v|0));z=f}else z=f}else z=f}else z=w;switch(b|0){case 2048:{v=(f|0)/8|0;b:do if((f|0)>7){t=c[599015]|0;u=0;while(1){if((t|0)>=(c[599016]|0))break;fm(3147996,c[826224]|0,u+e|0,d[(c[599014]|0)+t>>0]|0);t=(c[599015]|0)+1|0;c[599015]=t;q=u+1|0;if((q|0)>=(v|0))break b;else u=q}qh(u<<5);g=u<<3;return g|0}while(0);qh(f<<2);g=f;return g|0}case 2050:{v=(f|0)/8|0;c:do if((f|0)>7){t=c[599018]|0;q=0;while(1){if((t|0)>=(c[599019]|0))break;fm(3147996,c[826224]|0,q+e|0,d[(c[599017]|0)+t>>0]|0);t=(c[599018]|0)+1|0;c[599018]=t;r=q+1|0;if((r|0)>=(v|0))break c;else q=r}qh(q<<5);g=q<<3;return g|0}while(0);qh(f<<2);g=f;return g|0}case 2052:{if((a[3297404]|0)!=0&(c[825126]|0)!=0|(c[512077]|0)!=0){s=z;break a}v=Sx(1791120,1,(f|0)/8|0,c[9258]|0)|0;if((v|0)>0){t=0;do{fm(3147996,c[826224]|0,t+e|0,d[1791120+t>>0]|0);t=t+1|0}while((t|0)!=(v|0))}qh(v<<5);g=v<<3;return g|0}case 2053:{t=(f|0)/8|0;if((f|0)>7){u=0;do{a[1791120+u>>0]=gm(3147996,c[826224]|0,u+e|0)|0;u=u+1|0}while((u|0)!=(t|0))}Fx(1791120,1,t,c[9259]|0)|0;qh(f<<2);g=f;return g|0}default:{u=c[563862]|0;if((b|0)==2054&(u|0)!=0){if((a[3297404]|0)!=0&(c[825126]|0)!=0|(c[512077]|0)!=0){s=z;break a}v=Sx(1791120,1,(f|0)/8|0,u)|0;if((v|0)>0){u=0;do{fm(3147996,c[826224]|0,u+e|0,d[1791120+u>>0]|0);u=u+1|0}while((u|0)!=(v|0))}qh(v<<5);g=v<<3;return g|0}u=c[563863]|0;if(!((b|0)==2055&(u|0)!=0)){if((b|0)!=2056){s=z;break a}if(!(c[599022]|0))c[599022]=xs(2048)|0;t=(f|0)/8|0;if((f|0)<=7){s=f;break a}r=0;while(1){p=(gm(3147996,c[826224]|0,r+e|0)|0)&255;a[(c[599022]|0)+((c[599021]|0)+(c[599020]|0)&2047)>>0]=p;c[599021]=(c[599021]|0)+1;r=r+1|0;if((r|0)==(t|0)){s=f;break a}}}if((a[3297404]|0)!=0&(c[825126]|0)!=0|(c[512077]|0)!=0){s=z;break a}t=(f|0)/8|0;if((f|0)>7){r=0;do{a[1791120+r>>0]=gm(3147996,c[826224]|0,r+e|0)|0;r=r+1|0}while((r|0)!=(t|0));A=c[563863]|0}else A=u;Fx(1791120,1,t,A)|0;qh(f<<2);g=f;return g|0}}}while(0);c[k+44>>2]=1;g=s;return g|0}function dp(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;e=Ia;Ia=Ia+1056|0;f=e+1040|0;g=e+1032|0;h=e+1024|0;i=e;j=e+1044|0;if(!(c[599025]|0)){c[599025]=1;c[599026]=xs(524288)|0;ys(1774736,0,16384)}k=1774736+(b<<2)|0;l=c[k>>2]|0;if(!l){m=xs(48)|0;c[k>>2]=m;c[m>>2]=b;c[m+4>>2]=(b|0)/256|0;c[m+8>>2]=b&255;c[m+12>>2]=10;c[m+16>>2]=8e5;c[m+20>>2]=1050624;c[m+24>>2]=55;c[m+32>>2]=0;c[m+36>>2]=0;n=m}else n=l;if(c[n+44>>2]|0){Ia=e;return}l=a[d>>0]|0;if(l<<24>>24>47?(a[d+1>>0]|0)<58:0){c[h>>2]=j;ox(d,110259,h)|0;c[n+16>>2]=c[j>>2];Ia=e;return}if(l<<24>>24==32){h=d;while(1){m=h+1|0;b=a[m>>0]|0;if(b<<24>>24==32)h=m;else{o=b;p=m;break}}}else{o=l;p=d}d=n+16|0;l=n+12|0;h=n+20|0;m=n+24|0;b=n+32|0;k=n+36|0;if(!(o<<24>>24)){Ia=e;return}o=p;while(1){a[i>>0]=0;c[g>>2]=i;p=ox(o,99718,g)|0;if(!(Kw(i,58)|0)){a[i>>0]=0;q=0}else{c[j>>2]=0;n=(Kw(i,58)|0)+1|0;c[f>>2]=j;ox(n,110259,f)|0;a[(Kw(i,58)|0)>>0]=0;q=p}p=(a[o>>0]|0)==0?o:o+1|0;while(1){r=a[p>>0]|0;if(r<<24>>24==0|(r+-97&255)>25)break;else p=p+1|0}if(r<<24>>24!=0&(r+-97&255)>25){n=p;while(1){s=n+1|0;t=a[s>>0]|0;if(t<<24>>24!=0&(t+-97&255)>25)n=s;else{u=s;break}}}else u=p;if(!(xw(i,99725)|0))c[d>>2]=c[j>>2];if(!(xw(i,99730)|0))c[l>>2]=c[j>>2];if(!(xw(i,99734)|0))c[h>>2]=c[j>>2];if(!(xw(i,99739)|0))c[m>>2]=c[j>>2];if(!(xw(i,99750)|0))c[b>>2]=c[j>>2];if(!(xw(i,99757)|0))c[k>>2]=c[j>>2];if(!q){v=36;break}if(!(a[u>>0]|0)){v=36;break}else o=u}if((v|0)==36){Ia=e;return}}function ep(){var a=0,b=0,d=0;c[599020]=0;c[599021]=0;c[599023]=0;c[9243]=128;if(!(c[Line truncated
|
||||||
|
function jf(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0;f=Ia;Ia=Ia+32|0;g=f;h=b+40|0;i=c[h>>2]|0;j=b+4|0;k=c[j>>2]|0;l=te(i,11)|0;m=g+28|0;c[m>>2]=0;n=g+20|0;c[n>>2]=0;o=g+24|0;c[o>>2]=0;p=g+16|0;c[p>>2]=e;c[e+8>>2]=-1;c[e+12>>2]=-1;c[e>>2]=11;q=e+4|0;c[q>>2]=l;c[g+8>>2]=-1;c[g+12>>2]=-1;c[g>>2]=0;r=g+4|0;c[r>>2]=0;s=c[h>>2]|0;Se(s,e);if(((c[e>>2]|0)==6?(t=c[q>>2]|0,(t&256|0)==0):0)?(t|0)>=(d[s+46>>0]|0|0):0){t=s+48|0;a[t>>0]=(a[t>>0]|0)+-1<<24>>24}t=s+48|0;q=a[t>>0]|0;u=(q&255)+1|0;v=(c[s>>2]|0)+78|0;do if((q&255)>=(d[v>>0]|0))if((q&255)>248)we(c[s+12>>2]|0,50659);else{w=u&255;a[v>>0]=w;x=w;break}else x=u&255;while(0);a[t>>0]=x;Te(s,e,(x&255)+-1|0);x=b+24|0;if((c[x>>2]|0)!=123)re(b,123);e=b+16|0;c[e>>2]=c[j>>2];s=b+32|0;if((c[s>>2]|0)==287){t=pe(b,b+28|0)|0;c[x>>2]=t;y=t}else{t=s;u=c[t>>2]|0;v=c[t+4>>2]|0;t=b+24|0;c[t>>2]=u;c[t+4>>2]=v;c[s>>2]=287;y=u}a:do if((y|0)!=125){u=b+36|0;v=b+32|0;t=i+48|0;q=i+46|0;w=b+28|0;z=b+24|0;A=0;b:while(1){if(A|0){Se(i,g);if(((c[g>>2]|0)==6?(B=c[r>>2]|0,(B&256|0)==0):0)?(B|0)>=(d[q>>0]|0|0):0){B=(a[t>>0]|0)+-1<<24>>24;a[t>>0]=B;C=B}else C=a[t>>0]|0;B=(C&255)+1|0;D=(c[i>>2]|0)+78|0;if((C&255)<(d[D>>0]|0))E=B&255;else{if((C&255)>248){F=28;break}G=B&255;a[D>>0]=G;E=G}a[t>>0]=E;Te(i,g,(E&255)+-1|0);c[g>>2]=0;if((c[m>>2]|0)==50){G=c[(c[p>>2]|0)+4>>2]|0;D=c[o>>2]|0;B=((D+-1|0)/50|0)+1|0;H=G<<6|419430449;if((D|0)<25551)te(i,B<<14|H)|0;else{te(i,H)|0;te(i,B<<6|52)|0}a[t>>0]=G+1;c[m>>2]=0}}c:do switch(c[x>>2]|0){case 289:{G=pe(b,u)|0;c[v>>2]=G;if((G|0)==61){kf(b,g);break c}Le(b,g,0)|0;G=c[o>>2]|0;if((G|0)>2147483645){F=38;break b}c[o>>2]=G+1;c[m>>2]=(c[m>>2]|0)+1;break}case 91:{kf(b,g);break}default:{Le(b,g,0)|0;G=c[o>>2]|0;if((G|0)>2147483645){F=43;break b}c[o>>2]=G+1;c[m>>2]=(c[m>>2]|0)+1}}while(0);d:do switch(c[x>>2]|0){case 44:{c[e>>2]=c[j>>2];if((c[s>>2]|0)==287){G=pe(b,w)|0;c[x>>2]=G;I=G;break d}else{G=s;B=c[G>>2]|0;H=c[G+4>>2]|0;G=z;c[G>>2]=B;c[G+4>>2]=H;c[s>>2]=287;I=B;break d}break}case 59:{c[e>>2]=c[j>>2];if((c[s>>2]|0)==287){B=pe(b,w)|0;c[x>>2]=B;I=B;break d}else{B=s;H=c[B>>2]|0;G=c[B+4>>2]|0;B=z;c[B>>2]=H;c[B+4>>2]=G;c[s>>2]=287;I=H;break d}break}default:break a}while(0);if((I|0)==125)break a;A=c[g>>2]|0}if((F|0)==28)we(c[i+12>>2]|0,50659);else if((F|0)==38)He(c[h>>2]|0,2147483645,50865);else if((F|0)==43)He(c[h>>2]|0,2147483645,50865)}while(0);Ke(b,125,123,k);k=c[m>>2]|0;do if(k|0){switch(c[g>>2]|0){case 0:{J=k;F=75;break}case 12:{b=(c[(c[i>>2]|0)+12>>2]|0)+(c[r>>2]<<2)|0;c[b>>2]=c[b>>2]&-8372225;F=61;break}case 13:{b=c[i>>2]|0;h=c[b+12>>2]|0;I=h+(c[r>>2]<<2)|0;c[I>>2]=c[I>>2]&8388607;I=h+(c[r>>2]<<2)|0;h=i+48|0;s=a[h>>0]|0;x=s&255;c[I>>2]=x<<6|c[I>>2]&-16321;I=x+1|0;x=b+78|0;do if((s&255)>=(d[x>>0]|0))if((s&255)>248)we(c[i+12>>2]|0,50659);else{b=I&255;a[x>>0]=b;K=b;break}else K=I&255;while(0);a[h>>0]=K;F=61;break}default:{Se(i,g);if(((c[g>>2]|0)==6?(I=c[r>>2]|0,(I&256|0)==0):0)?(I|0)>=(d[i+46>>0]|0|0):0){I=i+48|0;a[I>>0]=(a[I>>0]|0)+-1<<24>>24}I=i+48|0;x=a[I>>0]|0;s=(x&255)+1|0;b=(c[i>>2]|0)+78|0;do if((x&255)>=(d[b>>0]|0))if((x&255)>248)we(c[i+12>>2]|0,50659);else{j=s&255;a[b>>0]=j;L=j;break}else L=s&255;while(0);a[I>>0]=L;Te(i,g,(L&255)+-1|0);J=c[m>>2]|0;F=75}}if((F|0)==61){s=c[(c[p>>2]|0)+4>>2]|0;b=c[o>>2]|0;x=((b+-1|0)/50|0)+1|0;h=s<<6|49;if((b|0)<25551)te(i,x<<14|h)|0;else{te(i,h)|0;te(i,x<<6|52)|0}a[i+48>>0]=s+1;c[o>>2]=(c[o>>2]|0)+-1;break}else if((F|0)==75){s=c[(c[p>>2]|0)+4>>2]|0;x=c[o>>2]|0;h=((x+-1|0)/50|0)+1|0;b=((J|0)==-1?49:J<<23|49)|s<<6;if((x|0)<25551)te(i,h<<14|b)|0;else{te(i,b)|0;te(i,h<<6|52)|0}a[i+48>>0]=s+1;break}}while(0);J=(c[(c[i>>2]|0)+12>>2]|0)+(l<<2)|0;l=c[J>>2]&8388607;i=c[o>>2]|0;if(i>>>0<8)M=i;else{if(i>>>0>15){o=1;p=i;do{F=p+1|0;p=F>>>1;o=o+1|0}while(F>>>0>31);N=o<<3;O=p}else{N=8;O=i}M=N|O+-8}O=M<<23|l;c[J>>2]=O;l=O&-8372225;O=c[n>>2]|0;if(O>>>0<8){P=O;Q=P<<14;R=Q&8372224;S=R|l;c[J>>2]=S;Ia=f;return}if(O>>>0>15){n=1;M=O;do{N=M+1|0;M=N>>>1;n=n+1|0}while(N>>>0>31);T=n<<3;U=M}else{T=8;U=O}P=T|U+-8;Q=P<<14;R=Q&8372224;S=R|l;c[J>>2]=S;Ia=f;return}function kf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;e=Ia;Ia=Ia+48|0;f=e+32|0;g=e+16|0;h=e;i=b+40|0;j=c[i>>2]|0;k=j+48|0;l=a[k>>0]|0;m=b+24|0;do if((c[m>>2]|0)!=289){n=b+4|0;o=b+16|0;c[o>>2]=c[n>>2];p=b+32|0;if((c[p>>2]|0)==287)c[m>>2]=pe(b,b+28|0)|0;else{q=p;r=c[q+4>>2]|0;s=b+24|0;c[s>>2]=c[q>>2];c[s+4>>2]=r;c[p>>2]=287}Le(b,g,0)|0;r=c[i>>2]|0;if((c[g+8>>2]|0)==(c[g+12>>2]|0))Se(r,g);else We(r,g)|0;if((c[m>>2]|0)!=93)re(b,93);c[o>>2]=c[n>>2];if((c[p>>2]|0)==287){n=pe(b,b+28|0)|0;c[m>>2]=n;t=n;break}else{n=p;o=c[n>>2]|0;r=c[n+4>>2]|0;n=b+24|0;c[n>>2]=o;c[n+4>>2]=r;c[p>>2]=287;t=o;break}}else{if((c[d+20>>2]|0)>2147483645)He(j,2147483645,50865);o=b+28|0;p=c[o>>2]|0;c[b+16>>2]=c[b+4>>2];r=b+32|0;if((c[r>>2]|0)==287){c[m>>2]=pe(b,o)|0;u=c[i>>2]|0}else{o=r;n=c[o+4>>2]|Line truncated
|
||||||
|
function pe(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0,kb=0,lb=0,mb=0,nb=0,ob=0,pb=0,qb=0,rb=0,sb=0,tb=0,ub=0,vb=0,wb=0,xb=0,yb=0,zb=0,Ab=0,Bb=0,Cb=0,Db=0,Eb=0,Fb=0,Gb=0,Hb=0,Ib=0,Jb=0,Kb=0,Lb=0,Mb=0,Nb=0,Ob=0,Pb=0,Qb=0,Rb=0,Sb=0,Tb=0,Ub=0,Vb=0,Wb=0,Xb=0,Yb=0,Zb=0,_b=0,$b=0,ac=0,bc=0,cc=0,dc=0,ec=0,fc=0,gc=0,hc=0,ic=0,jc=0,kc=0,lc=0,mc=0,nc=0,oc=0,pc=0,qc=0,rc=0,sc=0,tc=0,uc=0,vc=0,wc=0,xc=0,yc=0,zc=0,Ac=0,Bc=0,Cc=0,Ec=0,Fc=0,Gc=0,Hc=0,Ic=0,Jc=0,Kc=0,Lc=0,Mc=0,Nc=0,Oc=0,Rc=0,Sc=0,Tc=0,Uc=0,Vc=0,Wc=0,Xc=0,Yc=0,Zc=0,_c=0,ad=0,bd=0,cd=0,dd=0;f=Ia;Ia=Ia+16|0;g=f+12|0;h=f;i=b+12|0;j=c[i>>2]|0;a:do if((j|0)>1){switch(c[b>>2]|0){case 13:case 10:break;default:break a}c[i>>2]=j+-1;k=292;Ia=f;return k|0}while(0);j=b+52|0;c[(c[j>>2]|0)+4>>2]=0;l=b+8|0;m=b+48|0;b:while(1){n=c[l>>2]|0;c[l>>2]=0;o=c[b>>2]|0;c:do switch(o|0){case 63:{p=14;break b;break}case 92:case 33:case 126:case 124:case 38:case 37:case 42:case 43:{p=75;break b;break}case 91:{p=94;break b;break}case 61:{p=98;break b;break}case 60:{p=110;break b;break}case 94:{p=146;break b;break}case 62:{p=170;break b;break}case 58:{p=218;break b;break}case 39:case 34:{p=230;break b;break}case 46:{p=377;break b;break}case 57:case 56:case 55:case 54:case 53:case 52:case 51:case 50:case 49:case 48:{q=o;break b;break}case -1:{k=287;p=587;break b;break}case 13:case 10:{nf(b);r=c[i>>2]|0;if(r|0){p=7;break b}break}case 11:case 9:case 12:case 32:{s=c[m>>2]|0;t=c[s>>2]|0;c[s>>2]=t+-1;if(!t){t=Oa[c[s+8>>2]&7](c[s+16>>2]|0,c[s+12>>2]|0,g)|0;u=c[g>>2]|0;if((t|0)==0|(u|0)==0)v=-1;else{c[s>>2]=u+-1;c[s+4>>2]=t+1;v=d[t>>0]|0}w=v}else{t=s+4|0;s=c[t>>2]|0;c[t>>2]=s+1;w=d[s>>0]|0}c[b>>2]=w;c[l>>2]=n;break}case 45:{s=c[m>>2]|0;t=c[s>>2]|0;c[s>>2]=t+-1;if(!t){t=Oa[c[s+8>>2]&7](c[s+16>>2]|0,c[s+12>>2]|0,g)|0;u=c[g>>2]|0;if((t|0)==0|(u|0)==0)x=-1;else{c[s>>2]=u+-1;c[s+4>>2]=t+1;x=d[t>>0]|0}y=x}else{t=s+4|0;s=c[t>>2]|0;c[t>>2]=s+1;y=d[s>>0]|0}c[b>>2]=y;switch(y|0){case 61:{p=26;break b;break}case 45:break;default:{k=45;p=587;break b}}s=c[m>>2]|0;t=c[s>>2]|0;c[s>>2]=t+-1;if(!t){t=Oa[c[s+8>>2]&7](c[s+16>>2]|0,c[s+12>>2]|0,g)|0;u=c[g>>2]|0;if((t|0)==0|(u|0)==0)z=-1;else{c[s>>2]=u+-1;c[s+4>>2]=t+1;z=d[t>>0]|0}A=z}else{t=s+4|0;s=c[t>>2]|0;c[t>>2]=s+1;A=d[s>>0]|0}c[b>>2]=A;do if((A|0)==91){s=of(b)|0;c[(c[j>>2]|0)+4>>2]=0;if((s|0)>-1){pf(b,0,s);c[(c[j>>2]|0)+4>>2]=0;break c}else{B=c[b>>2]|0;break}}else B=A;while(0);s=B;while(1){switch(s|0){case -1:case 13:case 10:{break c;break}default:{}}t=c[m>>2]|0;u=c[t>>2]|0;c[t>>2]=u+-1;if(!u){u=Oa[c[t+8>>2]&7](c[t+16>>2]|0,c[t+12>>2]|0,g)|0;C=c[g>>2]|0;if((u|0)==0|(C|0)==0)D=-1;else{c[t>>2]=C+-1;c[t+4>>2]=u+1;D=d[u>>0]|0}E=D}else{u=t+4|0;t=c[u>>2]|0;c[u>>2]=t+1;E=d[t>>0]|0}c[b>>2]=E;s=E}break}case 47:{s=c[m>>2]|0;t=c[s>>2]|0;c[s>>2]=t+-1;if(!t){t=Oa[c[s+8>>2]&7](c[s+16>>2]|0,c[s+12>>2]|0,g)|0;u=c[g>>2]|0;if((t|0)==0|(u|0)==0)F=-1;else{c[s>>2]=u+-1;c[s+4>>2]=t+1;F=d[t>>0]|0}G=F}else{t=s+4|0;s=c[t>>2]|0;c[t>>2]=s+1;G=d[s>>0]|0}c[b>>2]=G;switch(G|0){case 61:{p=56;break b;break}case 47:break;default:{k=47;p=587;break b}}s=c[m>>2]|0;t=c[s>>2]|0;c[s>>2]=t+-1;if(!t){t=Oa[c[s+8>>2]&7](c[s+16>>2]|0,c[s+12>>2]|0,g)|0;u=c[g>>2]|0;if((t|0)==0|(u|0)==0)H=-1;else{c[s>>2]=u+-1;c[s+4>>2]=t+1;H=d[t>>0]|0}I=H}else{t=s+4|0;s=c[t>>2]|0;c[t>>2]=s+1;I=d[s>>0]|0}s=I;while(1){c[b>>2]=s;switch(s|0){case -1:case 13:case 10:{break c;break}default:{}}t=c[m>>2]|0;u=c[t>>2]|0;c[t>>2]=u+-1;if(!u){u=Oa[c[t+8>>2]&7](c[t+16>>2]|0,c[t+12>>2]|0,g)|0;C=c[g>>2]|0;if((u|0)==0|(C|0)==0)J=-1;else{c[t>>2]=C+-1;c[t+4>>2]=u+1;J=d[u>>0]|0}K=J}else{u=t+4|0;t=c[u>>2]|0;c[u>>2]=t+1;K=d[t>>0]|0}s=K}break}default:{p=556;break b}}while(0)}switch(p|0){case 7:{c[i>>2]=r+-1;k=292;Ia=f;return k|0}case 14:{r=c[m>>2]|0;K=c[r>>2]|0;c[r>>2]=K+-1;if(!K){K=Oa[c[r+8>>2]&7](c[r+16>>2]|0,c[r+12>>2]|0,g)|0;J=c[g>>2]|0;if((K|0)==0|(J|0)==0)L=-1;else{c[r>>2]=J+-1;c[r+4>>2]=K+1;L=d[K>>0]|0}M=L}else{L=r+4|0;r=c[L>>2]|0;c[L>>2]=r+1;M=d[r>>0]|0}c[b>>2]=M;c[i>>2]=(c[i>>2]|0)+1;k=291;Ia=f;return k|0}case 26:{i=c[m>>2]|0;M=c[i>>2]|0;c[i>>2]=M+-1;if(!M){M=Oa[c[i+8>>2]&7](c[i+16>>2]|0,c[i+12>>2]|0,g)|0;r=c[g>>2]|0;if((M|0)==0|(r|0)==0)N=-1;else{c[i>>2]=r+-1;c[i+4>>2]=M+1;N=d[M>>0]|0}O=N}else{N=i+4|0;i=c[N>>2]|0;c[N>>2]=i+1;O=d[i>>0]|0}c[b>>2]=O;k=300;Ia=f;return k|0}case 56:{O=c[m>>2]|0;i=c[O>>2]|0;c[O>>2]=i+-1;if(!i){i=Oa[c[O+8>>2]&7](c[O+16>>2]|0,c[O+12>>2]|0,g)|0;N=c[g>>2]|0;if((i|0)==0|(N|0)==0)P=-1;else{c[O>>2]=N+-1;c[O+4>>2]=i+1;P=d[i>>0]|0}Q=P}else{P=O+4|0;O=c[P>>2]|0;c[P>>2]=O+1;Q=d[O>>0]|0}c[b>>2]=Q;k=302;Ia=f;return k|0}case 75:{Q=c[m>>2]|0;O=c[Q>>2]|0Line truncated
|
||||||
|
function Xa(a){a=a|0;var b=0;b=Ia;Ia=Ia+a|0;Ia=Ia+15&-16;return b|0}function Ya(){return Ia|0}function Za(a){a=a|0;Ia=a}function _a(a,b){a=a|0;b=b|0;Ia=a;Ja=b}function $a(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;if((c[825126]|0)!=0&(c[825119]|0)==1?a[3329274]&64:0)return;c[825249]=(c[825249]|0)-b;d=128-b|0;e=c[787007]|0;if((d|0)>0){f=e;g=0;while(1){Ir(f,f,0,g+b|0,0,g,128,1);g=g+1|0;h=c[787007]|0;if((g|0)==(d|0)){i=h;j=d;break}else f=h}}else{i=e;j=0}Ep(i,0,j,127,127,0);qh(65536);return}function ab(){var b=0,d=0;b=(c[825249]|0)+(c[825254]|0)|0;c[825249]=b;if((b|0)<=((c[825256]|0)+122|0))return;if((c[825126]|0)!=0&(c[825119]|0)==1?a[3329274]&64:0)return;c[825249]=b+-6;b=c[787007]|0;d=0;do{Ir(b,b,0,d+6|0,0,d,128,1);d=d+1|0;b=c[787007]|0}while((d|0)!=122);Ep(b,0,122,127,127,0);qh(65536);return}function bb(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;b=Ia;Ia=Ia+352|0;d=b+336|0;e=b+328|0;f=b+320|0;g=b+312|0;h=b+304|0;i=b+296|0;j=b+288|0;k=b+280|0;l=b+272|0;m=b+264|0;n=b+256|0;o=b+248|0;p=b+240|0;q=b+232|0;r=b+224|0;s=b+216|0;t=b+208|0;u=b+200|0;v=b+192|0;w=b+184|0;x=b+176|0;y=b+168|0;z=b+160|0;A=b+152|0;B=b+144|0;C=b+136|0;D=b+128|0;E=b+120|0;F=b+16|0;G=b+8|0;H=b;I=b+340|0;if(!(Rv(a,37352,9)|0))Xq(a+10|0,3292588)|0;if(!(Rv(a,37362,10)|0))Xq(a+11|0,3294636)|0;if(!(Rv(a,37373,14)|0)){c[H>>2]=2048316;ox(a+14|0,102034,H)|0}if(!(Rv(a,37388,15)|0)){c[G>>2]=2048320;ox(a+15|0,102034,G)|0}if(!(Rv(a,37404,11)|0)){c[F>>2]=2048380;c[F+4>>2]=2048384;c[F+8>>2]=2048388;c[F+12>>2]=2048392;c[F+16>>2]=2048396;c[F+20>>2]=2048400;c[F+24>>2]=2048404;c[F+28>>2]=2048408;c[F+32>>2]=2048412;c[F+36>>2]=2048416;c[F+40>>2]=2048420;c[F+44>>2]=2048424;c[F+48>>2]=2048428;c[F+52>>2]=2048432;c[F+56>>2]=2048436;c[F+60>>2]=2048440;c[F+64>>2]=2048444;c[F+68>>2]=2048448;c[F+72>>2]=2048452;c[F+76>>2]=2048456;c[F+80>>2]=2048460;c[F+84>>2]=2048464;c[F+88>>2]=2048468;c[F+92>>2]=2048472;c[F+96>>2]=2048476;ox(a+11|0,37416,F)|0}if(!(Rv(a,37492,10)|0)){c[E>>2]=2048636;ox(a+10|0,102034,E)|0}if(!(Rv(a,37503,11)|0)){c[D>>2]=2048664;ox(a+11|0,102034,D)|0}if(!(Rv(a,53408,7)|0)){c[C>>2]=2048668;ox(a+7|0,102034,C)|0}if((Rv(a,98816,6)|0)==0?(c[B>>2]=2252304,ox(a+6|0,102034,B)|0,c[599468]|0):0)c[599468]=c[563076];if(!(Rv(a,37515,9)|0)){c[A>>2]=2048684;ox(a+9|0,102034,A)|0}if(!(Rv(a,53795,16)|0)){c[z>>2]=2048652;ox(a+16|0,102034,z)|0}if(!(Rv(a,53696,9)|0)){c[y>>2]=2048656;ox(a+9|0,102034,y)|0}if(!(Rv(a,37525,12)|0)){c[x>>2]=2048700;ox(a+12|0,102034,x)|0}if(!(Rv(a,37538,20)|0)){c[w>>2]=2251744;ox(a+20|0,102034,w)|0}if(!(Rv(a,37559,22)|0)){c[v>>2]=2251748;ox(a+22|0,102034,v)|0}if(!(Rv(a,37582,14)|0)){c[u>>2]=I;ox(a+14|0,102034,u)|0;c[512177]=(c[I>>2]|0)==2&1}if(!(Rv(a,53126,13)|0)){c[t>>2]=2048708;ox(a+13|0,102034,t)|0}if(!(Rv(a,37597,14)|0)){c[s>>2]=2048712;ox(a+14|0,102034,s)|0}if(!(Rv(a,53901,9)|0)){c[r>>2]=2048640;ox(a+9|0,102034,r)|0}if(!(Rv(a,52912,9)|0)){c[q>>2]=2048644;ox(a+9|0,102034,q)|0}if(!(Rv(a,37612,19)|0)){c[p>>2]=2048364;ox(a+19|0,102034,p)|0}if(!(Rv(a,37632,19)|0)){c[o>>2]=2048360;ox(a+19|0,102034,o)|0}if(!(Rv(a,37652,22)|0)){c[n>>2]=2048368;ox(a+22|0,102034,n)|0}if(!(Rv(a,37675,11)|0)){c[m>>2]=2048692;ox(a+11|0,102034,m)|0}if(!(Rv(a,37687,14)|0)){c[l>>2]=2048648;ox(a+14|0,102034,l)|0}if(!(Rv(a,37702,22)|0)){c[k>>2]=2048356;ox(a+22|0,102034,k)|0}if(!(Rv(a,37725,18)|0)){c[j>>2]=2048348;ox(a+18|0,102034,j)|0}if(!(Rv(a,37744,16)|0)){c[i>>2]=2048352;ox(a+16|0,102034,i)|0}if(!(Rv(a,37761,16)|0)){c[h>>2]=2048344;ox(a+16|0,102034,h)|0}if(!(Rv(a,37778,14)|0)){c[g>>2]=2048340;ox(a+14|0,102034,g)|0}if(!(Rv(a,37793,18)|0)){c[f>>2]=2048680;ox(a+18|0,102034,f)|0}if(!(Rv(a,37812,20)|0)){c[e>>2]=2048376;ox(a+20|0,102034,e)|0}if(Rv(a,37833,13)|0){Ia=b;return 0}c[d>>2]=2048312;ox(a+13|0,102034,d)|0;c[600024]=c[512078];Ia=b;return 0}function cb(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ja=0,Ka=0;b=Ia;Ia=Ia+432|0;d=b+424|0;e=b+416|0;f=b+408|0;g=b+400|0;h=b+392|0;i=b+384|0;j=b+376|0;k=b+368|0;l=b+360|0;m=b+352|0;n=b+344|0;o=b+336|0;p=b+328|0;q=b+320|0;r=b+312|0;s=b+304|0;t=b+296|0;u=b+288|0;v=b+280|0;w=b+272|0;x=b+264|0;y=b+256|0;z=b+248|0;A=b+240|0;B=b+232|0;C=b+224|0;D=b+216|0;E=b+208|0;F=b+200|0;G=b+192|0;H=b+184|0;I=b+176|0;J=b+168|0;K=b+160|0;L=b+152|0;M=b+144|0;N=b+136|0;O=b+128|0;P=b+120|0;Q=b+112|0;R=b+104|0;S=b+96|0;T=b+88|0;U=b+80|0;V=b+72|0;W=b+64|0;X=b+56|0;Y=b+48|0;Z=b+40|0;_=b+32|0;$=b+24|0;aa=b+16|0;ba=b+8|0;ca=b;da=a+8|0;a=c[da>>2]|0;c[ca>>2]=37860;wx(a,37847,ca)|0;Fx(37866,25,1,c[da>>2]|0)|0;ca=c[da>>2]|0;c[ba>>2]=c[563076];wx(ca,37892,ba)|0;Fx(37904,37,1,c[da>>2]|0)|0;ba=c[da>>2]|0;c[aa>>2]=3292588;wx(ba,37942,aa)Line truncated
|
||||||
|
function Cu(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0;e=Ia;Ia=Ia+80|0;f=e+48|0;g=e+40|0;h=e+24|0;i=e+8|0;j=e;k=e+68|0;l=e+64|0;c[824204]=0;m=xs(196609)|0;n=xs(196609)|0;a[m>>0]=0;o=Sq(m,196608,b)|0;if((d|0)!=0?(zx(o,109918)|0)==0:0){c[k>>2]=43;p=1}else q=2;do if((q|0)==2){d=o;a:while(1){switch(a[d>>0]|0){case 0:{break a;break}case 112:case 10:{q=7;break a;break}default:{}}d=d+1|0}if((q|0)==7?(Rv(d,109918,16)|0)==0:0){Sq(m,196608,b)|0;c[k>>2]=0;c[j>>2]=k;ox(m,109935,j)|0;if(!((c[600024]|0)==0&(c[k>>2]|0)>43)){p=0;break}Bs(m);Bs(n);c[824204]=1;r=0;Ia=e;return r|0}Bs(m);Bs(n);r=0;Ia=e;return r|0}while(0);j=Au()|0;c[j+45860>>2]=c[k>>2];o=0;do{ty(j+16+(o*680|0)|0,0,680)|0;c[j+16+(o*680|0)+8>>2]=(o|0)==0?1:16;o=o+1|0}while((o|0)!=64);o=j+4|0;Cp(c[o>>2]|0);s=j+12|0;Cp(c[s>>2]|0);ty(j+44832|0,0,1024)|0;a[c[j>>2]>>0]=0;b:do if(!(Nq(b)|0)){t=j+48028|0;u=j+48032|0;v=m+3|0;w=j+45856|0;x=0;y=p;z=0;A=0;B=0;C=0;D=0;E=0;c:while(1){if(!y){ty(m|0,0,196609)|0;Sq(m,196608,b)|0}if((Nq(b)|0)!=0?(a[m>>0]|0)==0:0){F=x;G=z;H=A;I=-1;J=C;K=D;L=E}else q=19;d:do if((q|0)==19){q=0;if(Rv(m,109946,8)|0)if(Rv(m,109955,7)|0)if(Rv(m,109963,7)|0)if(Rv(m,109971,7)|0)if(Rv(m,109979,7)|0)if(Rv(m,109987,7)|0)if(Rv(m,109995,9)|0)if(Rv(m,110005,9)|0)if(!(Rv(m,110015,15)|0)){F=x;G=z;H=A;I=7;J=C;K=D;L=E}else{if(!(Rv(m,110031,7)|0)){M=(c[t>>2]|0)+1|0;c[t>>2]=M;c[u>>2]=As(c[u>>2]|0,M<<2)|0;M=Cs(256)|0;N=(c[t>>2]|0)+-1|0;c[(c[u>>2]|0)+(N<<2)>>2]=M;M=(yw(m)|0)+1|0;Fq(m,1,M,c[(c[u>>2]|0)+(N<<2)>>2]|0)|0;F=x;G=z;H=A;I=8;J=C;K=D;L=E;break}if((B|0)==1){dv(m,n)|0;N=c[j>>2]|0;M=yw(N)|0;if(((yw(n)|0)+M|0)>>>0>=65536)break c;Iw(N,n)|0;if(!(Nq(b)|0)){N=c[j>>2]|0;M=N+(yw(N)|0)|0;a[M>>0]=10;a[M+1>>0]=0}a[(c[j>>2]|0)+65536>>0]=0;F=x;G=z;H=A;I=1;J=C;K=D;L=E;break}if((B|0)==2&(E|0)<128){M=0;do{N=a[m+M>>0]|0;O=N+-48|0;a[(c[(c[(c[o>>2]|0)+16>>2]|0)+(E<<2)>>2]|0)+M>>0]=O>>>0<10?O:(N+-97|0)>>>0<6?N+169|0:0;M=M+1|0}while((M|0)!=128);P=E+1|0}else P=E;if((x|0)<2&(B|0)==10){M=x<<7;N=(c[k>>2]|0)>2;O=0;do{if(N){Q=O<<1;R=a[m+Q>>0]|0;S=R+-48|0;T=a[m+(Q|1)>>0]|0;Q=T+-48|0;U=((S>>>0<10?S:(R+-97|0)>>>0<6?R+268435369|0:0)<<4)+(Q>>>0<10?Q:(T+-97|0)>>>0<6?T+-87|0:0)|0}else{T=a[m+O>>0]|0;Q=T+-48|0;U=Q>>>0<10?Q:(T+-97|0)>>>0<6?T+-87|0:0}c[j+44832+(O+M<<2)>>2]=U;O=O+1|0}while((O|0)!=128);V=x+1|0}else V=x;if((A|0)<64&(B|0)==3){O=0;do{M=O<<1;N=a[m+M>>0]|0;T=N+-48|0;Q=a[m+(M|1)>>0]|0;M=Q+-48|0;a[(c[(c[(c[s>>2]|0)+16>>2]|0)+(A<<2)>>2]|0)+O>>0]=((T>>>0<10?T:(N+-97|0)>>>0<6?N+9|0:0)<<4)+(M>>>0<10?M:(Q+-97|0)>>>0<6?Q+169|0:0);O=O+1|0}while((O|0)!=128);W=A+1|0}else W=A;if((D|0)<64&(B|0)==4){c[l>>2]=0;c[i>>2]=l;c[i+4>>2]=j+16+(D*680|0)+8;c[i+8>>2]=j+16+(D*680|0)+12;c[i+12>>2]=j+16+(D*680|0)+16;ox(m,110039,i)|0;O=c[l>>2]|0;c[j+16+(D*680|0)+4>>2]=O&1;c[j+16+(D*680|0)>>2]=O&254;O=0;do{Q=j+16+(D*680|0)+20+(O*20|0)|0;M=j+16+(D*680|0)+20+(O*20|0)+4|0;N=j+16+(D*680|0)+20+(O*20|0)+8|0;T=j+16+(D*680|0)+20+(O*20|0)+12|0;c[h>>2]=Q;c[h+4>>2]=M;c[h+8>>2]=N;c[h+12>>2]=T;ox(m+((O*5|0)+8)|0,110056,h)|0;R=c[T>>2]|0;if(R&8|0)c[j+16+(D*680|0)+20+(O*20|0)+16>>2]=128;S=c[M>>2]|0;if(S&8|0)c[j+16+(D*680|0)+20+(O*20|0)+16>>2]=128;c[T>>2]=R&7;c[M>>2]=S&7;c[N>>2]=c[N>>2]&7;c[Q>>2]=c[Q>>2]&63;O=O+1|0}while((O|0)!=32);X=D+1|0}else X=D;if((C|0)<64&(B|0)==5){if((c[k>>2]|0)>2){c[g>>2]=j+44560+(C<<2);ox(m,110070,g)|0;Y=v}else Y=m;O=j+43536+(C<<4)|0;Q=j+43536+(C<<4)+4|0;N=j+43536+(C<<4)+8|0;S=j+43536+(C<<4)+12|0;c[f>>2]=O;c[f+4>>2]=Q;c[f+8>>2]=N;c[f+12>>2]=S;ox(Y,110039,f)|0;do if((c[k>>2]|0)<4){if(!(c[O>>2]|0))c[O>>2]=65;if(!(c[Q>>2]|0))c[Q>>2]=65;if(!(c[N>>2]|0))c[N>>2]=65;if(c[S>>2]|0)break;c[S>>2]=65}while(0);F=V;G=z;H=W;I=5;J=C+1|0;K=X;L=P;break}if((z|0)<128&(B|0)==6){if(!(c[w>>2]|0))c[w>>2]=Hp(128,128,8)|0;S=0;do{N=a[m+S>>0]|0;Q=N+-48|0;do if(Q>>>0>=10)if((N+-97|0)>>>0<22){Z=N+-87|0;break}else{Z=(N+-65|0)>>>0<22?N+-55|0:0;break}else Z=Q;while(0);a[(c[(c[(c[w>>2]|0)+16>>2]|0)+(z<<2)>>2]|0)+S>>0]=(Z|0)>15?Z+112|0:Z;S=S+1|0}while((S|0)!=128);_=z+1|0}else _=z;switch(B|0){case 7:{S=0;while(1){Q=S<<1;N=a[m+Q>>0]|0;O=N+-48|0;M=a[m+(Q|1)>>0]|0;Q=M+-48|0;a[j+45884+S>>0]=((O>>>0<10?O:(N+-97|0)>>>0<6?N+9|0:0)<<4)+(Q>>>0<10?Q:(M+-97|0)>>>0<6?M+169|0:0);S=S+1|0;if((S|0)==2144){F=V;G=_;H=W;I=0;J=C;K=X;L=P;break d}}break}case 8:break;default:{F=V;G=_;H=W;I=B;J=C;K=X;L=P;break d}}S=c[(c[u>>2]|0)+((c[t>>2]|0)+-1<<2)>>2]|0;M=c[S+16>>2]|0;Q=yw(m)|0;if((Q+M|0)>>>0<262144)Fq(m,1,Q,S)|0;if(Nq(b)|0){F=V;G=_;H=W;I=8;J=C;K=X;L=P;break}Fq(110076,1,1,S)|0;F=V;G=_;H=W;I=8;J=C;K=X;L=P}else{F=x;G=z;H=A;I=6;J=C;K=D;L=E}else{F=x;G=z;H=A;I=5;J=C;K=D;L=E}else{F=x;G=z;H=A;I=4;J=C;K=D;L=E}else{F=x;G=z;H=A;I=3;J=C;K=D;L=E}else{F=x;G=z;H=A;I=10;J=C;K=D;L=E}else{F=x;G=z;H=A;I=2;J=C;K=D;L=E}else{F=x;G=z;H=A;I=1;J=C;K=D;L=E}else{F=x;G=z;H=A;I=-1;J=C;K=D;L=E}}while(0);if((I|0)!=-1&(Nq(b)|0)==0){x=F;y=0;z=G;A=H;B=I;C=J;D=K;E=L}else break b}Bs(m);Bs(n);c[824204]=2;r=0;Ia=e;return r|0}while(0);LLine truncated
|
||||||
|
function mn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0;e=Ia;Ia=Ia+384|0;f=e+376|0;g=e+368|0;h=e+360|0;i=e+352|0;j=e+344|0;k=e+336|0;l=e+328|0;m=e+320|0;n=e+288|0;o=e+256|0;p=e;c[o>>2]=c[1356];c[o+4>>2]=c[1357];c[o+8>>2]=c[1358];c[o+12>>2]=c[1359];c[o+16>>2]=c[1360];c[o+20>>2]=c[1361];c[o+24>>2]=c[1362];c[o+28>>2]=c[1363];c[n>>2]=0;c[n+4>>2]=0;c[n+8>>2]=0;c[n+12>>2]=0;c[n+16>>2]=0;c[n+20>>2]=0;c[n+24>>2]=0;c[n+28>>2]=0;ty(p|0,0,256)|0;q=a+44836|0;r=c[q>>2]|0;if((r|0)>0){s=0;do{if((s+d|0)<64){t=c[a+43536+(s<<4)>>2]|0;if((t|0)<64){u=0;do{if(c[a+16+(t*680|0)+20+(u*20|0)+16>>2]|0)c[n+((c[a+16+(t*680|0)+20+(u*20|0)+4>>2]&7)<<2)>>2]=1;u=u+1|0}while((u|0)!=32)}u=c[a+43536+(s<<4)+4>>2]|0;if((u|0)<64){t=0;do{if(c[a+16+(u*680|0)+20+(t*20|0)+16>>2]|0)c[n+((c[a+16+(u*680|0)+20+(t*20|0)+4>>2]&7)<<2)>>2]=1;t=t+1|0}while((t|0)!=32)}t=c[a+43536+(s<<4)+8>>2]|0;if((t|0)<64){u=0;do{if(c[a+16+(t*680|0)+20+(u*20|0)+16>>2]|0)c[n+((c[a+16+(t*680|0)+20+(u*20|0)+4>>2]&7)<<2)>>2]=1;u=u+1|0}while((u|0)!=32)}u=c[a+43536+(s<<4)+12>>2]|0;if((u|0)<64){t=0;do{if(c[a+16+(u*680|0)+20+(t*20|0)+16>>2]|0)c[n+((c[a+16+(u*680|0)+20+(t*20|0)+4>>2]&7)<<2)>>2]=1;t=t+1|0}while((t|0)!=32)}}s=s+1|0}while((s|0)<(r|0));if(c[n>>2]|0){c[m>>2]=0;Ux(97291,m)|0;v=0}else v=1}else v=1;m=(c[n+4>>2]|0)==0;if(!m){c[l>>2]=1;Ux(97291,l)|0}l=(c[n+8>>2]|0)==0;if(!l){c[k>>2]=2;Ux(97291,k)|0}k=(c[n+12>>2]|0)==0;if(!k){c[j>>2]=3;Ux(97291,j)|0}j=(c[n+16>>2]|0)==0;if(!j){c[i>>2]=4;Ux(97291,i)|0}i=(c[n+20>>2]|0)==0;if(!i){c[h>>2]=5;Ux(97291,h)|0}h=(c[n+24>>2]|0)==0;if(!h){c[g>>2]=6;Ux(97291,g)|0}g=(c[n+28>>2]|0)==0;if(!g){c[f>>2]=7;Ux(97291,f)|0}do if(!v){f=a+16|0;n=0;while(1){if(!(Qv(b+16+(n*680|0)|0,f,680)|0)){w=n;break}n=n+1|0;if(n>>>0>=64){x=18;break}}if((x|0)==18){n=ln(b)|0;if((n|0)==-1)break;sy(b+16+(n*680|0)|0,f|0,680)|0;w=n}if(w>>>0<8){c[o>>2]=w;sy(b+16+(w*680|0)|0,f|0,680)|0;y=1;x=23}}else{y=0;x=23}while(0);do if((x|0)==23){if(m)z=y;else{w=a+696|0;v=0;while(1){if(!(Qv(b+16+(v*680|0)|0,w,680)|0)){A=v;break}v=v+1|0;if(v>>>0>=64){x=96;break}}if((x|0)==96){v=ln(b)|0;if((v|0)==-1)break;sy(b+16+(v*680|0)|0,w|0,680)|0;A=v}if(A>>>0>=8)break;c[o+4>>2]=A;sy(b+16+(A*680|0)|0,w|0,680)|0;z=y+1|0}if(l)B=z;else{v=a+1376|0;f=0;while(1){if(!(Qv(b+16+(f*680|0)|0,v,680)|0)){C=f;break}f=f+1|0;if(f>>>0>=64){x=104;break}}if((x|0)==104){f=ln(b)|0;if((f|0)==-1)break;sy(b+16+(f*680|0)|0,v|0,680)|0;C=f}if(C>>>0>=8)break;c[o+8>>2]=C;sy(b+16+(C*680|0)|0,v|0,680)|0;B=z+1|0}if(k)D=B;else{f=a+2056|0;w=0;while(1){if(!(Qv(b+16+(w*680|0)|0,f,680)|0)){E=w;break}w=w+1|0;if(w>>>0>=64){x=112;break}}if((x|0)==112){w=ln(b)|0;if((w|0)==-1)break;sy(b+16+(w*680|0)|0,f|0,680)|0;E=w}if(E>>>0>=8)break;c[o+12>>2]=E;sy(b+16+(E*680|0)|0,f|0,680)|0;D=B+1|0}if(j)F=D;else{w=a+2736|0;v=0;while(1){if(!(Qv(b+16+(v*680|0)|0,w,680)|0)){G=v;break}v=v+1|0;if(v>>>0>=64){x=120;break}}if((x|0)==120){v=ln(b)|0;if((v|0)==-1)break;sy(b+16+(v*680|0)|0,w|0,680)|0;G=v}if(G>>>0>=8)break;c[o+16>>2]=G;sy(b+16+(G*680|0)|0,w|0,680)|0;F=D+1|0}if(i)H=F;else{v=a+3416|0;f=0;while(1){if(!(Qv(b+16+(f*680|0)|0,v,680)|0)){I=f;break}f=f+1|0;if(f>>>0>=64){x=128;break}}if((x|0)==128){f=ln(b)|0;if((f|0)==-1)break;sy(b+16+(f*680|0)|0,v|0,680)|0;I=f}if(I>>>0>=8)break;c[o+20>>2]=I;sy(b+16+(I*680|0)|0,v|0,680)|0;H=F+1|0}if(h)J=H;else{f=a+4096|0;w=0;while(1){if(!(Qv(b+16+(w*680|0)|0,f,680)|0)){K=w;break}w=w+1|0;if(w>>>0>=64){x=136;break}}if((x|0)==136){w=ln(b)|0;if((w|0)==-1)break;sy(b+16+(w*680|0)|0,f|0,680)|0;K=w}if(K>>>0>=8)break;c[o+24>>2]=K;sy(b+16+(K*680|0)|0,f|0,680)|0;J=H+1|0}if(g)L=J;else{w=a+4776|0;v=0;while(1){if(!(Qv(b+16+(v*680|0)|0,w,680)|0)){M=v;break}v=v+1|0;if(v>>>0>=64){x=144;break}}if((x|0)==144){v=ln(b)|0;if((v|0)==-1)break;sy(b+16+(v*680|0)|0,w|0,680)|0;M=v}if(M>>>0>=8)break;c[o+28>>2]=M;sy(b+16+(M*680|0)|0,w|0,680)|0;L=J+1|0}v=c[q>>2]|0;if((v|0)>0){f=v;v=0;n=0;r=0;while(1){s=v+d|0;if((s|0)<64){t=b+43536+(s<<4)|0;u=a+43536+(v<<4)|0;c[t>>2]=c[u>>2];c[t+4>>2]=c[u+4>>2];c[t+8>>2]=c[u+8>>2];c[t+12>>2]=c[u+12>>2];c[b+44560+(s<<2)>>2]=c[a+44560+(v<<2)>>2];u=c[a+43536+(v<<4)>>2]|0;a:do if((u|0)<64){t=b+43536+(s<<4)|0;N=a+16+(u*680|0)|0;if(!(Qv(b+16+((c[t>>2]|0)*680|0)|0,N,680)|0)){O=n;break}P=0;while(1){if(!(Qv(b+16+(P*680|0)|0,N,680)|0)){Q=P;break}P=P+1|0;if(P>>>0>=64){Q=-1;break}}P=0;while(1){if(!(Qv(b+16+(P*680|0)|0,N,680)|0)){R=P;break}P=P+1|0;if(P>>>0>=64){x=33;break}}do if((x|0)==33){x=0;P=ln(b)|0;if((P|0)!=-1?(sy(b+16+(P*680|0)|0,N|0,680)|0,(P|0)>-1):0){R=P;break}c[t>>2]=128;O=n;break a}while(0);c[t>>2]=R;N=n+((Q|0)==-1&1)|0;P=p+(R<<2)|0;if(c[P>>2]|0){O=N;break}c[P>>2]=1;P=0;do{S=b+16+(R*680|0)+20+(P*20|0)+4|0;if(c[b+16+(R*680|0)+20+(P*20|0)+16>>2]|0)c[S>>2]=c[o+(c[S>>2]<<2)>>2];P=P+1|0}while((P|0)!=32);O=N}else O=n;while(0);u=c[a+43536+(v<<4)+4>>2]|0;b:do if((u|0)<64){N=b+43536+(s<<4)+4|0;P=a+16+(u*680|0)|0;if(!(Qv(b+16+((cLine truncated
|
||||||
|
function Kc(e){e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0;f=Ia;Ia=Ia+64|0;g=f+40|0;h=f+32|0;i=f+24|0;j=f+16|0;k=f+8|0;l=f;m=f+48|0;n=e+16|0;o=e+36|0;p=e+116|0;q=e+12|0;r=e+8|0;s=e+38|0;t=e+24|0;u=e+32|0;v=e+28|0;w=m+4|0;x=c[n>>2]|0;a:while(1){y=c[c[x>>2]>>2]|0;z=y+12|0;A=c[(c[z>>2]|0)+8>>2]|0;B=x+24|0;C=x+28|0;D=x+4|0;E=x+4|0;F=x+4|0;G=x+4|0;H=x+4|0;I=x+4|0;J=x+4|0;K=c[x+24>>2]|0;b:while(1){L=c[C>>2]|0;c[C>>2]=L+4;M=c[L>>2]|0;L=c[581819]|0;N=c[9230]|0;do if((L|c[581820]|0)>(N|0)){if(!((L|0)>(N|0)|(b[o>>1]|0)==0)){c[581820]=0;O=K;break}c[p>>2]=1;P=c[n>>2]|0;Q=P+18|0;R=d[Q>>0]|0;if(!(R&128)){S=7;break a}a[Q>>0]=R&127;O=c[B>>2]|0}else O=K;while(0);c[581819]=L+2;N=M>>>6&255;T=O+(N<<3)|0;c:do switch(M&63){case 44:{S=231;break b;break}case 0:{c[581819]=L+1;R=M>>>23;c[T>>2]=c[O+(R<<3)>>2];c[O+(N<<3)+4>>2]=c[O+(R<<3)+4>>2];U=O;break}case 1:{c[581819]=L+1;R=M>>>14;c[T>>2]=c[A+(R<<3)>>2];c[O+(N<<3)+4>>2]=c[A+(R<<3)+4>>2];U=O;break}case 2:{R=c[C>>2]|0;c[C>>2]=R+4;V=(c[R>>2]|0)>>>6;c[T>>2]=c[A+(V<<3)>>2];c[O+(N<<3)+4>>2]=c[A+(V<<3)+4>>2];U=O;break}case 3:{c[T>>2]=M>>>23;c[O+(N<<3)+4>>2]=1;if(!(M&8372224))U=O;else{c[C>>2]=(c[C>>2]|0)+4;U=O}break}case 4:{V=M>>>23;R=T;while(1){c[R+4>>2]=0;if(!V){U=O;break}else{V=V+-1|0;R=R+8|0}}break}case 5:{R=c[(c[y+16+(M>>>23<<2)>>2]|0)+8>>2]|0;c[T>>2]=c[R>>2];c[O+(N<<3)+4>>2]=c[R+4>>2];U=O;break}case 6:{R=M>>>14;Mc(e,c[(c[y+16+(M>>>23<<2)>>2]|0)+8>>2]|0,(M&4194304|0)==0?O+((R&511)<<3)|0:A+((R&255)<<3)|0,T);U=c[B>>2]|0;break}case 7:{R=M>>>14;Mc(e,O+(M>>>23<<3)|0,(M&4194304|0)==0?O+((R&511)<<3)|0:A+((R&255)<<3)|0,T);U=c[B>>2]|0;break}case 8:{R=M>>>23;V=M>>>14;Nc(e,c[(c[y+16+(N<<2)>>2]|0)+8>>2]|0,(M|0)<0?A+((R&255)<<3)|0:O+(R<<3)|0,(M&4194304|0)==0?O+((V&511)<<3)|0:A+((V&255)<<3)|0);U=c[B>>2]|0;break}case 9:{V=c[y+16+(M>>>23<<2)>>2]|0;R=c[V+8>>2]|0;c[R>>2]=c[T>>2];W=O+(N<<3)+4|0;c[R+4>>2]=c[W>>2];if(((c[W>>2]&64|0)!=0?(W=c[T>>2]|0,(a[W+5>>0]&3)!=0):0)?(R=V+5|0,V=a[R>>0]|0,(V&4)!=0):0){X=c[q>>2]|0;if((d[X+49>>0]|0)<2){Oc(X,W);U=O;break c}else{a[R>>0]=a[X+48>>0]&3|V&-72;U=O;break c}}else U=O;break}case 10:{V=M>>>23;X=M>>>14;Nc(e,T,(M|0)<0?A+((V&255)<<3)|0:O+(V<<3)|0,(M&4194304|0)==0?O+((X&511)<<3)|0:A+((X&255)<<3)|0);U=c[B>>2]|0;break}case 11:{X=M>>>23;V=M>>>14;R=V&511;W=c[q>>2]|0;Y=W+4|0;Z=Pa[c[W>>2]&3](c[Y>>2]|0,0,5,32)|0;if(!Z){if(!(a[W+51>>0]|0)){S=31;break a}Pc(e,1);_=Pa[c[W>>2]&3](c[Y>>2]|0,0,5,32)|0;if(!_){S=31;break a}else $=_}else $=Z;Z=W+12|0;c[Z>>2]=(c[Z>>2]|0)+32;Z=W+56|0;a[$+5>>0]=a[W+48>>0]&3;a[$+4>>0]=5;c[$>>2]=c[Z>>2];c[Z>>2]=$;c[$+8>>2]=0;a[$+6>>0]=-1;Z=$+12|0;c[Z>>2]=0;W=$+28|0;c[W>>2]=0;_=$+16|0;c[_>>2]=2327284;Y=$+7|0;a[Y>>0]=0;aa=$+20|0;c[aa>>2]=2327284;c[T>>2]=$;c[O+(N<<3)+4>>2]=69;if(R|X|0){ba=M>>>26&31;ca=(ba|0)==0?X:(X&7|8)<<ba+-1;ba=M>>>17&31;X=(ba|0)==0?R:(V&7|8)<<ba+-1;ba=c[W>>2]|0;V=a[Y>>0]|0;R=V&255;da=c[_>>2]|0;if((ba|0)<(ca|0)){if((ca+1|0)>>>0>536870911){S=35;break a}ea=c[Z>>2]|0;fa=ba<<3;ba=ca<<3;ga=c[q>>2]|0;ha=(ea|0)==0;ia=ga+4|0;ja=Pa[c[ga>>2]&3](c[ia>>2]|0,ea,fa,ba)|0;if((ba|0)!=0&(ja|0)==0){if(!(a[ga+51>>0]|0)){S=39;break a}Pc(e,1);ka=Pa[c[ga>>2]&3](c[ia>>2]|0,ea,fa,ba)|0;if(!ka){S=39;break a}else la=ka}else la=ja;ja=ga+12|0;c[ja>>2]=(ha?0:0-fa|0)+ba+(c[ja>>2]|0);c[Z>>2]=la;Z=c[W>>2]|0;if((Z|0)<(ca|0)){ja=Z;do{c[la+(ja<<3)+4>>2]=0;ja=ja+1|0}while((ja|0)!=(ca|0))}c[W>>2]=ca}if(!X){c[_>>2]=2327284;ma=2327284;na=0;oa=0}else{ja=X+-1|0;if(ja>>>0>255){Z=0;ba=ja;while(1){fa=Z+8|0;ha=ba>>>8;if(ba>>>0>65535){Z=fa;ba=ha}else{pa=fa;qa=ha;break}}}else{pa=0;qa=ja}ba=pa+(d[400+qa>>0]|0)|0;if((ba|0)>30){S=50;break a}Z=1<<ba;if((Z+1|0)>>>0>214748364){S=52;break a}X=20<<ba;ca=c[q>>2]|0;W=ca+4|0;ha=Pa[c[ca>>2]&3](c[W>>2]|0,0,0,X)|0;if(ba>>>0<30&(ha|0)==0){if(!(a[ca+51>>0]|0)){S=56;break a}Pc(e,1);fa=Pa[c[ca>>2]&3](c[W>>2]|0,0,0,X)|0;if(!fa){S=56;break a}else ra=fa}else ra=ha;ha=ca+12|0;c[ha>>2]=(c[ha>>2]|0)+X;c[_>>2]=ra;X=ra;ha=0;do{c[X+(ha*20|0)+16>>2]=0;c[X+(ha*20|0)+12>>2]=0;c[X+(ha*20|0)+4>>2]=0;ha=ha+1|0;X=c[_>>2]|0}while((ha|0)<(Z|0));ma=X;na=ba&255;oa=Z}a[Y>>0]=na;c[aa>>2]=ma+(oa*20|0);if(V<<24>>24!=31){ha=1<<R;do{_=ha;ha=ha+-1|0;ja=da+(ha*20|0)+4|0;if(c[ja>>2]|0){ca=da+(ha*20|0)+8|0;fa=Rc($,ca)|0;if((fa|0)==2327260)sa=Sc(e,$,ca)|0;else sa=fa;c[sa>>2]=c[da+(ha*20|0)>>2];c[sa+4>>2]=c[ja>>2]}}while((_|0)>1)}if((da|0)!=2327284){ha=20<<R;V=c[q>>2]|0;Pa[c[V>>2]&3](c[V+4>>2]|0,da,ha,0)|0;aa=V+12|0;c[aa>>2]=(c[aa>>2]|0)-((da|0)==0?0:ha)}}ha=c[q>>2]|0;aa=ha+12|0;V=c[aa>>2]|0;if((V|0)>0){c[r>>2]=T+8;if(!(a[ha+51>>0]|0)){Y=ha+8|0;c[Y>>2]=V+1600+(c[Y>>2]|0);c[aa>>2]=-1600}else Tc(e);c[r>>2]=c[I>>2]}U=c[B>>2]|0;break}case 12:{aa=M>>>23;Y=O+(aa<<3)|0;V=T+8|0;c[V>>2]=c[Y>>2];c[V+4>Line truncated
|
||||||
|
function ms(b,c,e,f,g){b=b|0;c=c|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,C=0,D=0,E=0;h=(g+7|0)>>>3;i=((B(g,e)|0)+7|0)>>>3;if(!f){j=0;return j|0}e=i+1|0;g=(i|0)==0;k=(h|0)==0;l=(i|0)!=0;m=(h|0)!=0;n=h>>>0<i>>>0;o=0;p=0;a:while(1){q=B(p,i)|0;r=B(p,e)|0;s=o;o=b+q|0;q=c+(r+1)|0;b:do switch(a[c+r>>0]|0){case 0:{if(!g){t=0;do{a[o+t>>0]=a[q+t>>0]|0;t=t+1|0}while((t|0)!=(i|0))}break}case 1:{if(!k){t=0;do{a[o+t>>0]=a[q+t>>0]|0;t=t+1|0}while((t|0)!=(h|0))}if(n){t=h;do{a[o+t>>0]=(d[o+(t-h)>>0]|0)+(d[q+t>>0]|0);t=t+1|0}while((t|0)!=(i|0))}break}case 2:{if(!s){if(!l)break b;t=0;do{a[o+t>>0]=a[q+t>>0]|0;t=t+1|0}while((t|0)!=(i|0))}else{if(!l)break b;t=0;do{a[o+t>>0]=(d[s+t>>0]|0)+(d[q+t>>0]|0);t=t+1|0}while((t|0)!=(i|0))}break}case 3:{if(!s){if(m){t=0;do{a[o+t>>0]=a[q+t>>0]|0;t=t+1|0}while((t|0)!=(h|0))}if(!n)break b;t=h;do{a[o+t>>0]=((d[o+(t-h)>>0]|0)>>>1&255)+(d[q+t>>0]|0);t=t+1|0}while((t|0)!=(i|0))}else{if(m){t=0;do{a[o+t>>0]=((d[s+t>>0]|0)>>>1&255)+(d[q+t>>0]|0);t=t+1|0}while((t|0)!=(h|0))}if(!n)break b;t=h;do{a[o+t>>0]=(((d[s+t>>0]|0)+(d[o+(t-h)>>0]|0)|0)>>>1)+(d[q+t>>0]|0);t=t+1|0}while((t|0)!=(i|0))}break}case 4:{if(!s){if(m){t=0;do{a[o+t>>0]=a[q+t>>0]|0;t=t+1|0}while((t|0)!=(h|0))}if(!n)break b;t=h;do{a[o+t>>0]=(d[o+(t-h)>>0]|0)+(d[q+t>>0]|0);t=t+1|0}while((t|0)!=(i|0))}else{if(m){t=0;do{a[o+t>>0]=(d[s+t>>0]|0)+(d[q+t>>0]|0);t=t+1|0}while((t|0)!=(h|0))}if(!n)break b;t=h;do{u=t-h|0;v=a[o+u>>0]|0;w=a[s+t>>0]|0;x=a[s+u>>0]|0;u=w&255;y=x&255;z=u-y|0;A=(z|0)>-1?z:0-z|0;z=v&255;C=z-y|0;D=(C|0)>-1?C:0-C|0;C=u+z+(B(y,-2)|0)|0;y=(C|0)>-1?C:0-C|0;a[o+t>>0]=(((A|0)>(D|0)|(A|0)>(y|0)?((D|0)>(y|0)?x:w):v)&255)+(d[q+t>>0]|0);t=t+1|0}while((t|0)!=(i|0))}break}default:{j=36;E=47;break a}}while(0);p=p+1|0;if(p>>>0>=f>>>0){j=0;E=47;break}}if((E|0)==47)return j|0;return 0}function ns(a,b,d,e,f,g,h,i){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0;c[a>>2]=(g+7|0)>>>3;j=(h+7|0)>>>3;c[b>>2]=j;k=(c[a>>2]|0)==0?0:j;c[b>>2]=k;if(!k)c[a>>2]=0;k=a+4|0;c[k>>2]=(g+3|0)>>>3;l=b+4|0;c[l>>2]=j;m=(c[k>>2]|0)==0?0:j;c[l>>2]=m;if(!m)c[k>>2]=0;m=a+8|0;c[m>>2]=(g+3|0)>>>2;j=(h+3|0)>>>3;n=b+8|0;c[n>>2]=j;o=(c[m>>2]|0)==0?0:j;c[n>>2]=o;if(!o)c[m>>2]=0;o=a+12|0;c[o>>2]=(g+1|0)>>>2;j=(h+3|0)>>>2;p=b+12|0;c[p>>2]=j;q=(c[o>>2]|0)==0?0:j;c[p>>2]=q;if(!q)c[o>>2]=0;q=a+16|0;c[q>>2]=(g+1|0)>>>1;j=(h+1|0)>>>2;r=b+16|0;c[r>>2]=j;s=(c[q>>2]|0)==0?0:j;c[r>>2]=s;if(!s)c[q>>2]=0;s=a+20|0;c[s>>2]=g>>>1;j=(h+1|0)>>>1;t=b+20|0;c[t>>2]=j;u=(c[s>>2]|0)==0?0:j;c[t>>2]=u;if(!u)c[s>>2]=0;u=a+24|0;c[u>>2]=g;g=h>>>1;h=b+24|0;c[h>>2]=g;j=(c[u>>2]|0)==0?0:g;c[h>>2]=j;if(!j)c[u>>2]=0;c[f>>2]=0;c[e>>2]=0;c[d>>2]=0;j=c[a>>2]|0;a=c[b>>2]|0;if(!j){v=0;w=0;x=0}else{b=B(j,i)|0;j=(b+7|0)>>>3;v=B(a,j+1|0)|0;w=j;x=b}b=d+4|0;c[b>>2]=v;v=e+4|0;c[v>>2]=(B(a,w)|0)+(c[e>>2]|0);w=f+4|0;c[w>>2]=(((B(x,a)|0)+7|0)>>>3)+(c[f>>2]|0);a=c[k>>2]|0;k=c[l>>2]|0;if(!a){y=0;z=0;A=0}else{l=B(a,i)|0;a=(l+7|0)>>>3;y=B(k,a+1|0)|0;z=a;A=l}l=d+8|0;c[l>>2]=y+(c[b>>2]|0);b=e+8|0;c[b>>2]=(B(k,z)|0)+(c[v>>2]|0);v=f+8|0;c[v>>2]=(((B(A,k)|0)+7|0)>>>3)+(c[w>>2]|0);w=c[m>>2]|0;m=c[n>>2]|0;if(!w){C=0;D=0;E=0}else{n=B(w,i)|0;w=(n+7|0)>>>3;C=B(m,w+1|0)|0;D=w;E=n}n=d+12|0;c[n>>2]=C+(c[l>>2]|0);l=e+12|0;c[l>>2]=(B(m,D)|0)+(c[b>>2]|0);b=f+12|0;c[b>>2]=(((B(E,m)|0)+7|0)>>>3)+(c[v>>2]|0);v=c[o>>2]|0;o=c[p>>2]|0;if(!v){F=0;G=0;H=0}else{p=B(v,i)|0;v=(p+7|0)>>>3;F=B(o,v+1|0)|0;G=v;H=p}p=d+16|0;c[p>>2]=F+(c[n>>2]|0);n=e+16|0;c[n>>2]=(B(o,G)|0)+(c[l>>2]|0);l=f+16|0;c[l>>2]=(((B(H,o)|0)+7|0)>>>3)+(c[b>>2]|0);b=c[q>>2]|0;q=c[r>>2]|0;if(!b){I=0;J=0;K=0}else{r=B(b,i)|0;b=(r+7|0)>>>3;I=B(q,b+1|0)|0;J=b;K=r}r=d+20|0;c[r>>2]=I+(c[p>>2]|0);p=e+20|0;c[p>>2]=(B(q,J)|0)+(c[n>>2]|0);n=f+20|0;c[n>>2]=(((B(K,q)|0)+7|0)>>>3)+(c[l>>2]|0);l=c[s>>2]|0;s=c[t>>2]|0;if(!l){L=0;M=0;N=0}else{t=B(l,i)|0;l=(t+7|0)>>>3;L=B(s,l+1|0)|0;M=l;N=t}t=d+24|0;c[t>>2]=L+(c[r>>2]|0);r=e+24|0;c[r>>2]=(B(s,M)|0)+(c[p>>2]|0);p=f+24|0;c[p>>2]=(((B(N,s)|0)+7|0)>>>3)+(c[n>>2]|0);n=c[t>>2]|0;t=c[u>>2]|0;u=c[h>>2]|0;if(!t){O=0;P=0;Q=0;R=O+n|0;S=d+28|0;c[S>>2]=R;T=c[r>>2]|0;U=B(u,P)|0;V=U+T|0;W=e+28|0;c[W>>2]=V;X=c[p>>2]|0;Y=B(Q,u)|0;Z=Y+7|0;_=Z>>>3;$=_+X|0;aa=f+28|0;c[aa>>2]=$;return}h=B(t,i)|0;i=(h+7|0)>>>3;O=B(u,i+1|0)|0;P=i;Q=h;R=O+n|0;S=d+28|0;c[S>>2]=R;T=c[r>>2]|0;U=B(u,P)|0;V=U+T|0;W=e+28|0;c[W>>2]=V;X=c[p>>2]|0;Y=B(Q,u)|0;Z=Y+7|0;_=Z>>>3;$=_+X|0;aa=f+28|0;c[aa>>2]=$;return}function os(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;i=Ia;Ia=Ia+224|0;j=i+212|0;k=i;if(!f){l=100;Ia=i;return l|0}m=c[f>>2]|0;if(!m){n=c[f+8>>2]|0;vx(n,0,2)|0;o=Rx(n)|0;if(o>>>0>268435456){l=333;Ia=i;return l|0}Tx(n);p=zs(o)|0;Sx(p,1,o,n)|0;c[k+8>>2]=1;c[k+12>>2]=1;c[k+4>>2]=0;c[k+16>>2]=0;c[k>>2]=0;n=k+20|0;q=k+24|0;r=k+28|0;s=k+32|0;t=k+56|0;u=k+52|0;v=k+88|0;c[v>>Line truncated
|
||||||
|
function Fr(a,b){a=a|0;b=b|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0.0,o=0.0,p=0.0,q=0.0,r=0.0,s=0.0,t=0.0,u=0,v=0,y=0,z=0,A=0,B=0,C=0,D=0.0,E=0.0,F=0.0;d=a+24|0;e=c[d>>2]|0;g=e<<2;h=b+(g<<2)|0;i=b+((g|3)<<2)|0;if(!e)return;g=a+48|0;j=As(c[g>>2]|0,e*48|0)|0;c[g>>2]=j;e=c[d>>2]|0;if((e|0)>0){k=a+36|0;l=j;m=b;b=0;while(1){n=+f[m>>2];o=+x(+n);p=+f[m+4>>2];q=+x(+p);r=+f[m+8>>2];s=+x(+r);t=+w(+n);n=+w(+p);p=+w(+r);u=l+(b*48|0)|0;f[l+(b*48|0)+4>>2]=q;f[u>>2]=t*n;f[l+(b*48|0)+8>>2]=o*n;v=l+(b*48|0)+12|0;r=n*0.0-q*s;f[l+(b*48|0)+16>>2]=q*0.0+n*s;f[v>>2]=r*t-o*p;f[l+(b*48|0)+20>>2]=t*p+r*o;sr(u,v,l+(b*48|0)+24|0);v=m+12|0;l=c[g>>2]|0;u=l+(b*48|0)|0;f[u>>2]=+f[v>>2]*+f[u>>2];u=l+(b*48|0)+4|0;f[u>>2]=+f[v>>2]*+f[u>>2];u=l+(b*48|0)+8|0;f[u>>2]=+f[v>>2]*+f[u>>2];u=l+(b*48|0)+12|0;f[u>>2]=+f[v>>2]*+f[u>>2];u=l+(b*48|0)+16|0;f[u>>2]=+f[v>>2]*+f[u>>2];u=l+(b*48|0)+20|0;f[u>>2]=+f[v>>2]*+f[u>>2];u=l+(b*48|0)+24|0;f[u>>2]=+f[v>>2]*+f[u>>2];u=l+(b*48|0)+28|0;f[u>>2]=+f[v>>2]*+f[u>>2];u=l+(b*48|0)+32|0;f[u>>2]=+f[v>>2]*+f[u>>2];u=l+(b*48|0)+12|0;v=c[u>>2]|0;y=l+(b*48|0)+4|0;c[u>>2]=c[y>>2];c[y>>2]=v;v=l+(b*48|0)+24|0;y=c[v>>2]|0;u=l+(b*48|0)+8|0;c[v>>2]=c[u>>2];c[u>>2]=y;y=l+(b*48|0)+28|0;u=c[y>>2]|0;v=l+(b*48|0)+20|0;c[y>>2]=c[v>>2];c[v>>2]=u;if((c[(c[k>>2]|0)+(b<<2)>>2]|0)==-1){f[l+(b*48|0)+36>>2]=0.0;f[l+(b*48|0)+40>>2]=0.0;f[l+(b*48|0)+44>>2]=0.0}b=b+1|0;z=c[d>>2]|0;if((b|0)>=(z|0))break;else m=m+16|0}m=(z|0)>0;if(m){b=c[a+40>>2]|0;d=c[a+36>>2]|0;a=0;do{k=c[b+(a<<2)>>2]|0;g=c[d+(k<<2)>>2]|0;if((g|0)!=-1){f[l+(k*48|0)+36>>2]=+f[l+(g*48|0)+36>>2]+ +f[l+(g*48|0)>>2];f[l+(k*48|0)+40>>2]=+f[l+(g*48|0)+40>>2]+ +f[l+(g*48|0)+12>>2];f[l+(k*48|0)+44>>2]=+f[l+(g*48|0)+44>>2]+ +f[l+(g*48|0)+24>>2]}a=a+1|0}while((a|0)!=(z|0));A=z;B=l;C=m}else{A=z;B=l;C=0}}else{A=e;B=j;C=0}j=c[i>>2]|0;i=(j|0)<0;e=i?0-j|0:j;o=+f[B+(e*48|0)+36>>2];r=+f[B+(e*48|0)+40>>2];p=+f[B+(e*48|0)+44>>2];if(i){D=o+ +f[B+(e*48|0)>>2];E=r+ +f[B+(e*48|0)+12>>2];F=p+ +f[B+(e*48|0)+24>>2]}else{D=o;E=r;F=p}p=+f[h>>2]-D;D=+f[h+4>>2]-E;E=+f[h+8>>2]-F;if(!C)return;C=0;do{h=B+(C*48|0)+36|0;f[h>>2]=p+ +f[h>>2];h=B+(C*48|0)+40|0;f[h>>2]=D+ +f[h>>2];h=B+(C*48|0)+44|0;f[h>>2]=E+ +f[h>>2];C=C+1|0}while((C|0)!=(A|0));return}function Gr(a,b){a=a|0;b=b|0;var d=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0.0,A=0.0,B=0.0,C=0.0,D=0.0;d=Ia;Ia=Ia+16|0;g=d;if(!a){Ia=d;return}h=a+24|0;i=a+28|0;j=c[i>>2]|0;if(!(c[h>>2]|0)){Bs(j);c[i>>2]=0;Ia=d;return}k=a+4|0;c[i>>2]=As(j,c[k>>2]<<5)|0;j=a+44|0;l=zs(c[j>>2]|0)|0;if((c[h>>2]|0)>0){m=a+12|0;n=g+4|0;o=g+8|0;p=a+36|0;q=0;r=0;while(1){s=c[a>>2]|0;t=c[(c[m>>2]|0)+(q*80|0)+48>>2]|0;u=c[t+4>>2]|0;w=c[t>>2]|0;x=+f[s+(u*12|0)>>2]-+f[s+(w*12|0)>>2];f[g>>2]=x;A=+f[s+(u*12|0)+4>>2]-+f[s+(w*12|0)+4>>2];f[n>>2]=A;B=+f[s+(u*12|0)+8>>2]-+f[s+(w*12|0)+8>>2];f[o>>2]=B;f[l+((r|3)<<2)>>2]=+v(+(x*x+A*A+B*B));rr(g);B=+f[g>>2];A=+f[o>>2];x=+v(+(B*B+A*A));C=+z(+A,+B);w=l+(r<<2)|0;f[w>>2]=C;B=+f[n>>2];if(x==0.0)D=B>=0.0?1.5707963267948966:-1.5707963267948966;else D=+y(+(B/x));x=D;s=l+((r|1)<<2)|0;f[s>>2]=x;f[l+((r|2)<<2)>>2]=0.0;if(+f[o>>2]<0.0){f[w>>2]=C+3.141592653589793;f[s>>2]=(1.5707963267948966-(x<0.0?-x:x))*2.0*(+f[n>>2]>=0.0?1.0:-1.0)+x}if((c[(c[p>>2]|0)+(q<<2)>>2]|0)==-1){s=c[h>>2]<<2;w=l+(s<<2)|0;u=c[a>>2]|0;t=c[c[(c[m>>2]|0)+(q*80|0)+48>>2]>>2]|0;c[w>>2]=c[u+(t*12|0)>>2];c[w+4>>2]=c[u+(t*12|0)+4>>2];c[w+8>>2]=c[u+(t*12|0)+8>>2];c[l+((s|3)<<2)>>2]=q}q=q+1|0;if((q|0)>=(c[h>>2]|0))break;else r=r+4|0}}if(b|0){sy(b|0,l|0,c[j>>2]|0)|0;Bs(l);Ia=d;return}Fr(a,l);if((c[k>>2]|0)>0){j=a+48|0;b=0;do{r=c[i>>2]|0;tr((c[j>>2]|0)+((e[r+(b<<5)>>1]|0)*48|0)|0,(c[a>>2]|0)+(b*12|0)|0,r+(b<<5)+8|0);r=c[i>>2]|0;tr((c[j>>2]|0)+((e[r+(b<<5)+2>>1]|0)*48|0)|0,(c[a>>2]|0)+(b*12|0)|0,r+(b<<5)+20|0);b=b+1|0}while((b|0)<(c[k>>2]|0))}Bs(l);Ia=d;return}function Hr(){var a=0,b=0,d=0;a=c[599494]|0;b=c[599496]|0;if(!(c[599506]|c[599493]))if((b|0)==-1)d=(c[786973]|0)<720&1;else d=b;else d=1;b=(a|0)<8?a:8;return ((d|0)==0?((b|0)<1?1:(b|0)>0?b:0):1)|0}function Ir(a,b,e,f,g,h,i,j){a=a|0;b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;k=Ia;Ia=Ia+32|0;l=k+20|0;m=k+16|0;n=k+12|0;o=k+8|0;p=k+4|0;q=k;c[l>>2]=e;c[m>>2]=f;c[n>>2]=g;c[o>>2]=h;c[p>>2]=i;c[q>>2]=j;if(!((a|0)!=0&(b|0)!=0)){Ia=k;return}j=b+8|0;i=a+8|0;if(3147892==(a|0)?1:(c[j>>2]|0)<(c[i>>2]|0)){Ia=k;return}Kp(a,b,l,m,n,o,p,q);h=c[p>>2]|0;if((h|0)<1){Ia=k;return}g=c[j>>2]|0;j=g>>3;if(3147892==(b|0)){f=c[599494]|0;e=c[599496]|0;if(!(c[599506]|c[599493]))if((e|0)==-1)r=(c[b>>2]|0)<720&1;else r=e;else r=1;e=(f|0)<8?f:8;f=(e|0)<1?1:(e|0)>0?e:0;if(!((f|0)>1&(r|0)==0)){Zt(a,b,c[l>>2]|0,c[m>>2]|0,c[n>>2]|0,c[o>>2]|0,h,c[q>>2]|0,0);Ia=k;return}r=c[601343]|0;if(((r|0)!=0?(e=c[r>>2]|0,(e|0)==(B(c[a>>2]|0,f)|0)):0)?(s=c[r+4>>2]|0,(s|0)==(B(c[a+4>>2]|0,f)|0)):0){t=r;u=e;v=s}else{w=a;x=13}if((x|0)==13){Ip(r)|0;r=B(c[w>>2]|0,f)|0;w=B(c[a+4>>2]|0,f)|0;f=Hp(r,w,c[i>>2]|0)|0;c[601343]=f;t=f;u=c[f>>2]|0;v=c[f+4>>2]|0}Qp(a,t,0,0,u,v,0);v=c[601343]|0;Zt(v,b,0,0,0,0,cLine truncated
|
||||||
|
function Cw(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;i=Ia;Ia=Ia+240|0;j=i+232|0;k=i;l=c[e>>2]|0;c[j>>2]=l;m=c[e+4>>2]|0;e=j+4|0;c[e>>2]=m;c[k>>2]=a;a:do if((l|0)!=1|(m|0)!=0?(n=0-b|0,o=a+(0-(c[h+(f<<2)>>2]|0))|0,(Na[d&3](o,a)|0)>=1):0){p=o;o=a;q=1;r=f;s=(g|0)==0;while(1){if(s&(r|0)>1){t=o+n|0;u=c[h+(r+-2<<2)>>2]|0;if((Na[d&3](t,p)|0)>-1){v=o;w=q;x=r;y=10;break a}if((Na[d&3](t+(0-u)|0,p)|0)>-1){v=o;w=q;x=r;y=10;break a}}u=q+1|0;c[k+(q<<2)>>2]=p;t=Ew(j)|0;Bw(j,t);z=t+r|0;if(!((c[j>>2]|0)!=1|(c[e>>2]|0)!=0)){v=p;w=u;x=z;y=10;break a}t=p+(0-(c[h+(z<<2)>>2]|0))|0;if((Na[d&3](t,c[k>>2]|0)|0)<1){A=p;B=u;C=z;D=0;y=9;break}else{E=p;p=t;q=u;r=z;s=1;o=E}}}else{A=a;B=1;C=f;D=g;y=9}while(0);if((y|0)==9?(D|0)==0:0){v=A;w=B;x=C;y=10}if((y|0)==10){Gw(b,k,w);Aw(v,b,d,x,h)}Ia=i;return}function Dw(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=a+4|0;if(b>>>0>31){e=c[a>>2]|0;c[d>>2]=e;c[a>>2]=0;f=e;g=0;h=b+-32|0}else{f=c[d>>2]|0;g=c[a>>2]|0;h=b}c[d>>2]=g>>>(32-h|0)|f<<h;c[a>>2]=g<<h;return}function Ew(a){a=a|0;var b=0,d=0;b=Fw((c[a>>2]|0)+-1|0)|0;if(!b){d=Fw(c[a+4>>2]|0)|0;return ((d|0)==0?0:d+32|0)|0}else return b|0;return 0}function Fw(a){a=a|0;var b=0,c=0,d=0;if(a)if(!(a&1)){b=0;c=a;while(1){a=b+1|0;if(!(c&2)){b=a;c=c>>>1}else{d=a;break}}}else d=0;else d=32;return d|0}function Gw(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;e=Ia;Ia=Ia+256|0;f=e;a:do if((d|0)>=2?(g=b+(d<<2)|0,c[g>>2]=f,a|0):0){h=f;i=a;while(1){j=i>>>0<256?i:256;sy(h|0,c[b>>2]|0,j|0)|0;k=0;do{l=b+(k<<2)|0;k=k+1|0;sy(c[l>>2]|0,c[b+(k<<2)>>2]|0,j|0)|0;c[l>>2]=(c[l>>2]|0)+j}while((k|0)!=(d|0));k=i-j|0;if(!k)break a;h=c[g>>2]|0;i=k}}while(0);Ia=e;return}function Hw(a,b){a=a|0;b=b|0;Jw(a,b)|0;return a|0}function Iw(a,b){a=a|0;b=b|0;Hw(a+(yw(a)|0)|0,b)|0;return a|0}function Jw(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=d;a:do if(!((e^b)&3)){if(!(e&3)){f=b;g=d}else{h=b;i=d;while(1){j=a[i>>0]|0;a[h>>0]=j;if(!(j<<24>>24)){k=h;break a}j=i+1|0;l=h+1|0;if(!(j&3)){f=l;g=j;break}else{h=l;i=j}}}i=c[g>>2]|0;if(!((i&-2139062144^-2139062144)&i+-16843009)){h=i;i=f;j=g;while(1){l=j+4|0;m=i+4|0;c[i>>2]=h;h=c[l>>2]|0;if((h&-2139062144^-2139062144)&h+-16843009|0){n=m;o=l;break}else{i=m;j=l}}}else{n=f;o=g}p=n;q=o;r=10}else{p=b;q=d;r=10}while(0);if((r|0)==10){r=a[q>>0]|0;a[p>>0]=r;if(!(r<<24>>24))k=p;else{r=p;p=q;while(1){p=p+1|0;q=r+1|0;d=a[p>>0]|0;a[q>>0]=d;if(!(d<<24>>24)){k=q;break}else r=q}}}return k|0}function Kw(b,c){b=b|0;c=c|0;var d=0;d=Rw(b,c)|0;return ((a[d>>0]|0)==(c&255)<<24>>24?d:0)|0}function Lw(a){a=a|0;var b=0,d=0,e=0,f=0;b=Ia;Ia=Ia+16|0;d=b+8|0;e=Qw(a,589824,b)|0;do if((e|0)>=0){a=vv(1,2080)|0;if(!a){c[d>>2]=e;ea(6,d|0)|0;f=0;break}else{c[a>>2]=e;f=a;break}}else f=0;while(0);Ia=b;return f|0}function Mw(a,b){a=a|0;b=b|0;var d=0,e=0;d=Ia;Ia=Ia+16|0;e=d;c[e>>2]=a;c[e+4>>2]=b;b=Cv($(195,e|0)|0)|0;Ia=d;return b|0}function Nw(a){a=a|0;var b=0;b=Pw(c[a>>2]|0)|0;uv(a);return b|0}function Ow(a){a=a|0;var b=0,d=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;b=Ia;Ia=Ia+16|0;d=b;f=a+16|0;g=c[f>>2]|0;h=a+20|0;a:do if((g|0)<(c[h>>2]|0)){i=g;j=a+32+g|0;k=7}else{l=a+32|0;c[d>>2]=c[a>>2];c[d+4>>2]=l;c[d+8>>2]=2048;m=aa(220,d|0)|0;if((m|0)>=1){c[h>>2]=m;c[f>>2]=0;i=0;j=l;k=7;break}switch(m|0){case 0:case -2:{n=0;break a;break}default:{}}c[(Dv()|0)>>2]=0-m;n=0}while(0);if((k|0)==7){c[f>>2]=i+(e[j+16>>1]|0);i=j+8|0;f=c[i+4>>2]|0;k=a+8|0;c[k>>2]=c[i>>2];c[k+4>>2]=f;n=j}Ia=b;return n|0}function Pw(a){a=a|0;var b=0,d=0;b=Ia;Ia=Ia+16|0;d=b;c[d>>2]=Ev(a)|0;a=ea(6,d|0)|0;d=Cv((a|0)==-4?0:a)|0;Ia=b;return d|0}function Qw(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=Ia;Ia=Ia+48|0;f=e+32|0;g=e+16|0;h=e;if(!(b&4194368))i=0;else{c[h>>2]=d;d=(c[h>>2]|0)+(4-1)&~(4-1);j=c[d>>2]|0;c[h>>2]=d+4;i=j}c[g>>2]=a;c[g+4>>2]=b|32768;c[g+8>>2]=i;i=ca(5,g|0)|0;if(!((b&524288|0)==0|(i|0)<0)){c[f>>2]=i;c[f+4>>2]=2;c[f+8>>2]=1;ba(221,f|0)|0}f=Cv(i)|0;Ia=e;return f|0}function Rw(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=d&255;a:do if(!e)f=b+(yw(b)|0)|0;else{if(!(b&3))g=b;else{h=d&255;i=b;while(1){j=a[i>>0]|0;if(j<<24>>24==0?1:j<<24>>24==h<<24>>24){f=i;break a}j=i+1|0;if(!(j&3)){g=j;break}else i=j}}i=B(e,16843009)|0;h=c[g>>2]|0;b:do if(!((h&-2139062144^-2139062144)&h+-16843009)){j=h;k=g;while(1){l=j^i;if((l&-2139062144^-2139062144)&l+-16843009|0){m=k;break b}l=k+4|0;j=c[l>>2]|0;if((j&-2139062144^-2139062144)&j+-16843009|0){m=l;break}else k=l}}else m=g;while(0);i=d&255;h=m;while(1){k=a[h>>0]|0;if(k<<24>>24==0?1:k<<24>>24==i<<24>>24){f=h;break}else h=h+1|0}}while(0);return f|0}function Sw(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0.0;e=Ia;Ia=Ia+144|0;f=e;ty(f|0,0,144)|0;g=f+4|0;c[g>>2]=a;h=f+8|0;c[h>>2]=-1;c[f+44>>2]=a;c[f+76>>2]=-1;rw(f,0,0);i=+Tw(f,d,1);d=f+120|0;f=(c[g>>2]|0)-(c[h>>2]|0)|0;h=ey(c[d>>2]|0,c[d+4>>2]|0,f|0,((f|0)<0)<<31>>31|0)|0;f=G()|0;if(b|0)c[b>>2]=(h|0)==0&(f|0)==0?a:a+h|0;Ia=e;return +i}function Tw(b,e,f){b=b|0;e=e|Line truncated
|
||||||
|
|
||||||
|
// EMSCRIPTEN_END_FUNCS
|
||||||
|
var La=[Hy,zv,bb,cb,ag,dg,fj,bg,eg,gj,bj,hj,ij,jj,kj,hg,$f,gg,lj,mj,nj,oj,pj,qj,rj,sj,tj,uj,vj,wj,xj,yj,zj,vg,ug,wg,xg,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj,Kj,Lj,Mj,Nj,Oj,Pj,Qj,Rj,Sj,Tj,Uj,Vj,Wj,Xj,Yj,Zj,_j,$j,ak,bk,ck,dk,ek,fk,gk,hk,ik,jk,kk,lk,mk,nk,ok,pk,qk,rk,sk,tk,uk,vk,wk,xk,yk,zk,Ak,Bk,Ck,Dk,Ek,Fk,Gk,Hk,Ik,Jk,Kk,Lk,Mk,Nk,Ok,Pk,Qk,Rk,Sk,Tk,Uk,Vk,Wk,Xk,Yk,Zk,_k,$k,al,bl,cl,dl,el,fl,gl,Wf,Vf,Xf,Yf,Zf,_f,fg,pg,hl,rg,zg,yg,sg,il,jl,kl,ll,ml,nl,ol,pl,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy,Hy];var Ma=[Iy,Xv];var Na=[Jy,Rf,wo,xo];var Oa=[Ky,Av,Fv,qw,Mf,Gv,qx,Ky];var Pa=[Ly,Bv,dm,Ly];var Qa=[My,zl,Gl,My];var Ra=[Ny,vp];var Sa=[Oy,eb,oo,po,pu,Oy,Oy,Oy];var Ta=[Py,bp,Bc,he,le,Sf,lg,mg,Yv,Py,Py,Py,Py,Py,Py,Py];var Ua=[Qy,db,ou,Qy];var Va=[Ry,ii,Wh,rm,qm,Uh,sm,hi,gi,bi,Cm,Bm,Vh,tm,um,ai,Xh,Dm,Yh,_h,ym,zm,vm,wm,xm,Zh,$h,Lh,Qh,Ih,Rh,Sh,Th,Mh,Nh,Oh,Kh,Hh,Gh,Ph,ci,ji,Ku,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry,Ry];var Wa=[Sy,pi];return{___divdi3:iy,___emscripten_environ_constructor:$x,___errno_location:Dv,___muldi3:ky,___udivdi3:ly,__get_daylight:by,__get_environ:dy,__get_timezone:cy,__get_tzname:ay,_bitshift64Ashr:my,_bitshift64Lshr:ny,_bitshift64Shl:oy,_codo_mixer_callback:Ks,_free:uv,_i64Add:ey,_i64Subtract:fy,_main:Nb,_malloc:tv,_memcpy:sy,_memset:ty,_mix_0:Mt,_realloc:wv,_saveSetjmp:py,_sbrk:uy,_setThrew:ry,_testSetjmp:qy,dynCall_ii:vy,dynCall_iidiiii:wy,dynCall_iii:xy,dynCall_iiii:yy,dynCall_iiiii:zy,dynCall_iiiiii:Ay,dynCall_v:By,dynCall_vi:Cy,dynCall_vii:Dy,dynCall_viii:Ey,dynCall_viiiii:Fy,dynCall_viiiiii:Gy,establishStackSpace:_a,stackAlloc:Xa,stackRestore:Za,stackSave:Ya}})
|
||||||
|
|
||||||
|
|
||||||
|
// EMSCRIPTEN_END_ASM
|
||||||
|
(asmGlobalArg,asmLibraryArg,buffer);var ___divdi3=Module["___divdi3"]=asm["___divdi3"];var ___emscripten_environ_constructor=Module["___emscripten_environ_constructor"]=asm["___emscripten_environ_constructor"];var ___errno_location=Module["___errno_location"]=asm["___errno_location"];var ___muldi3=Module["___muldi3"]=asm["___muldi3"];var ___udivdi3=Module["___udivdi3"]=asm["___udivdi3"];var __get_daylight=Module["__get_daylight"]=asm["__get_daylight"];var __get_environ=Module["__get_environ"]=asm["__get_environ"];var __get_timezone=Module["__get_timezone"]=asm["__get_timezone"];var __get_tzname=Module["__get_tzname"]=asm["__get_tzname"];var _bitshift64Ashr=Module["_bitshift64Ashr"]=asm["_bitshift64Ashr"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _codo_mixer_callback=Module["_codo_mixer_callback"]=asm["_codo_mixer_callback"];var _free=Module["_free"]=asm["_free"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var _main=Module["_main"]=asm["_main"];var _malloc=Module["_malloc"]=asm["_malloc"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var _memset=Module["_memset"]=asm["_memset"];var _mix_0=Module["_mix_0"]=asm["_mix_0"];var _realloc=Module["_realloc"]=asm["_realloc"];var _saveSetjmp=Module["_saveSetjmp"]=asm["_saveSetjmp"];var _sbrk=Module["_sbrk"]=asm["_sbrk"];var _setThrew=Module["_setThrew"]=asm["_setThrew"];var _testSetjmp=Module["_testSetjmp"]=asm["_testSetjmp"];var establishStackSpace=Module["establishStackSpace"]=asm["establishStackSpace"];var stackAlloc=Module["stackAlloc"]=asm["stackAlloc"];var stackRestore=Module["stackRestore"]=asm["stackRestore"];var stackSave=Module["stackSave"]=asm["stackSave"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_iidiiii=Module["dynCall_iidiiii"]=asm["dynCall_iidiiii"];var dynCall_iii=Module["dynCall_iii"]=asm["dynCall_iii"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_iiiii=Module["dynCall_iiiii"]=asm["dynCall_iiiii"];var dynCall_iiiiii=Module["dynCall_iiiiii"]=asm["dynCall_iiiiii"];var dynCall_v=Module["dynCall_v"]=asm["dynCall_v"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_vii=Module["dynCall_vii"]=asm["dynCall_vii"];var dynCall_viii=Module["dynCall_viii"]=asm["dynCall_viii"];var dynCall_viiiii=Module["dynCall_viiiii"]=asm["dynCall_viiiii"];var dynCall_viiiiii=Module["dynCall_viiiiii"]=asm["dynCall_viiiiii"];Module["asm"]=asm;Module["ccall"]=ccall;Module["getValue"]=getValue;Module["getMemory"]=getMemory;Module["UTF8ToString"]=UTF8ToString;Module["stringToUTF8"]=stringToUTF8;Module["addRunDependency"]=addRunDependency;Module["removeRunDependency"]=removeRunDependency;Module["FS_createFolder"]=FS.createFolder;Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createLink"]=FS.createLink;Module["FS_createDevice"]=FS.createDevice;Module["FS_unlink"]=FS.unlink;if(memoryInitializer){if(!isDataURI(memoryInitializer)){memoryInitializer=locateFile(memoryInitializer)}if(ENVIRONMENT_IS_NODE||ENVIRONMENT_IS_SHELL){var data=Module["readBinary"](memoryInitializer);HEAPU8.set(data,GLOBAL_BASE)}else{addRunDependency("memory initializer");var applyMemoryInitializer=function(data){if(data.byteLength)data=new Uint8Array(data);HEAPU8.set(data,GLOBAL_BASE);if(Module["memoryInitializerRequest"])delete Module["memoryInitializerRequest"].response;removeRunDependency("memory initializer")};var doBrowserLoad=function(){Module["readAsync"](memoryInitializer,applyMemoryInitializer,function(){throw"could not load memory initializer "+memoryInitializer})};var memoryInitializerBytes=tryParseAsDataURI(memoryInitializer);if(memoryInitializerBytes){applyMemoryInitializer(memoryInitializerBytes.buffer)}else if(Module["memoryInitializerRequest"]){var useRequest=function(){var request=Module["memoryInitializerRequest"];var response=request.response;if(request.status!==200&&request.status!==0){var data=tryParseAsDataURI(Module["memoryInitializerRequestURL"]);if(data){response=data.buffer}else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+request.status+", retrying "+memoryInitializer);doBrowserLoad();return}}applyMemoryInitializer(response)};if(Module["memoryInitializerRequest"].response){setTimeout(useRequest,0)}else{Module["memoryInitializerRequest"].addEventListener("load",useRequest)}}else{doBrowserLoad()}}}function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var calledMain=false;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};Module["callMain"]=function callLine truncated
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
var Module=typeof Module!=="undefined"?Module:{};if(!Module.expectedDataFileDownloads){Module.expectedDataFileDownloads=0;Module.finishedDataFileDownloads=0}Module.expectedDataFileDownloads++;(function(){var loadPackage=function(metadata){function runWithFS(){var fileData0=[];fileData0.push.apply(fileData0,[67,80,79,68,68,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,99,70,73,76,0,0,0,0,123,144,0,0,112,111,100,47,112,105,99,111,56,95,98,111,111,116,46,112,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,97,1,0,0,242,16,112,105,99,111,45,56,32,99,97,114,116,114,105,100,103,101,32,47,47,32,104,116,116,112,58,47,47,119,119,119,46,31,0,255,13,46,99,111,109,10,118,101,114,115,105,111,110,32,56,10,95,95,108,117,97,95,95,10,10,45,45,62,56,6,0,25,159,95,95,103,102,120,95,95,10,48,1,0,108,15,129,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,45,1,137,64,31,102,137,64,112,15,139,1,109,15,1,1,239,95,95,95,109,97,112,10,2,240,15,1,1,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,44,50,95,95,115,187,98,48,49,48,99,17,0,161,51,48,53,53,53,50,98,53,54,53,10,0,64,51,53,53,52,5,0,128,49,53,51,53,55,48,53,48,3,0,15,5,0,106,0,169,0,16,56,12,0,115,50,52,48,51,53,50,52,26,0,15,91,2,130,30,49,154,0,15,169,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,238,113,95,95,109,117,115,105,99,114,74,50,32,52,49,2,0,15,12,0,255,255,224,80,49,52,49,10,10,99,70,73,76,0,0,0,0,182,197,12,0,112,111,100,47,103,102,120,49,46,112,111,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,123,75,0,0,243,22,67,80,79,68,68,0,0,0,1,0,0,0,103,102,120,49,46,112,111,100,0,47,112,97,98,97,47,112,105,99,111,56,47,112,111,100,47,25,0,63,21,1,0,1,0,10,177,67,66,77,80,20,0,1,0,128,0,0,4,0,47,32,0,1,0,255,255,255,255,255,255,255,255,207,79,77,0,255,255,4,0,73,47,0,0,0,2,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,91,63,163,255,255,4,0,73,47,232,241,4,0,75,47,170,204,4,0,75,15,0,2,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,155,79,39,236,255,255,4,0,73,47,232,241,4,0,255,12,47,168,119,4,0,75,15,0,2,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,59,15,1,0,77,79,54,228,0,255,4,0,73,15,160,1,77,63,156,118,131,4,0,74,15,160,1,77,15,0,2,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,155,15,1,0,77,79,255,173,41,255,4,0,73,15,99,1,77,15,0,2,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,92,15,1,0,255,255,255,255,255,255,255,36,97,67,80,65,76,0,3,11,0,255,39,29,43,83,126,37,83,0,135,81,171,82,54,95,87,79,194,195,199,255,241,232,255,0,77,255,163,0,255,236,39,0,228,54,41,173,255,131,118,156,255,119,168,255,204,170,0,0,0,2,4,6,2,4,8,3,0,101,111,3,5,10,3,5,10,126,0,100,31,9,54,0,37,27,9,192,0,5,3,0,254,33,41,24,20,17,29,53,66,33,54,18,83,89,116,47,41,73,51,59,162,136,121,243,239,125,190,18,80,255,108,36,168,231,46,0,181,67,6,90,181,117,70,101,255,110,89,255,157,129,122,1,15,3,0,255,44,255,2,67,66,77,80,164,1,0,0,40,0,0,0,10,0,0,0,8,68,3,24,15,44,0,20,63,9,7,15,39,0,17,95,10,7,7,7,14,41,0,17,51,11,7,13,10,0,66,7,7,7,7,5,0,20,0,5,0,22,7,25,0,37,0,12,39,0,0,3,0,5,4,0,4,16,0,0,10,0,1,3,0,23,0,79,0,14,40,0,3,99,0,9,40,0,5,7,0,10,80,0,1,18,0,12,40,0,6,165,0,9,159,0,31,7,180,4,54,57,79,72,67,180,4,91,231,39,0,231,86,180,4,15,1,0,29,240,3,28,0,73,109,24,69,0,122,44,160,72,50,52,54,53,173,177,183,100,14,240,8,0,77,255,132,0,255,255,39,0,226,50,41,173,255,174,75,176,255,136,188,255,214,197,48,0,32,48,102,144,0,177,131,72,171,82,54,63,65,65,180,182,188,48,0,49,42,255,163,79,0,96,231,86,41,162,255,132,48,0,245,7,175,255,217,177,0,0,0,32,51,123,140,28,60,0,131,49,171,100,54,80,80,80,120,0,35,255,155,9,0,97,63,155,255,132,112,169,192,0,0,75,0,255,0,28,24,87,135,37,77,0,147,60,0,0,0,69,69,69,180,0,2,98,146,133,174,255,105,154,48,0,48,55,67,91,19,0,143,135,81,0,0,0,86,70,59,48,0,2,53,131,118,156,12,0,53,37,55,77,Line truncated
|
||||||
|
var asm=(/** @suppress {uselessCode} */ function(global,env,buffer) {
|
||||||
|
"use asm";var a=new global.Int8Array(buffer),b=new global.Int16Array(buffer),c=new global.Int32Array(buffer),d=new global.Uint8Array(buffer),e=new global.Uint16Array(buffer),f=new global.Float32Array(buffer),g=new global.Float64Array(buffer),h=env.ae|0,i=env.af|0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0.0,r=global.NaN,s=global.Infinity,t=global.Math.floor,u=global.Math.abs,v=global.Math.sqrt,w=global.Math.cos,x=global.Math.sin,y=global.Math.atan,z=global.Math.atan2,A=global.Math.ceil,B=global.Math.imul,C=global.Math.min,D=global.Math.clz32,E=env.a,F=env.b,G=env.c,H=env.d,I=env.e,J=env.f,K=env.g,L=env.h,M=env.i,N=env.j,O=env.k,P=env.l,Q=env.m,R=env.n,S=env.o,T=env.p,U=env.q,V=env.r,W=env.s,X=env.t,Y=env.u,Z=env.v,_=env.w,$=env.x,aa=env.y,ba=env.z,ca=env.A,da=env.B,ea=env.C,fa=env.D,ga=env.E,ha=env.F,ia=env.G,ja=env.H,ka=env.I,la=env.J,ma=env.K,na=env.L,oa=env.M,pa=env.N,qa=env.O,ra=env.P,sa=env.Q,ta=env.R,ua=env.S,va=env.T,wa=env.U,xa=env.V,ya=env.W,za=env.X,Aa=env.Y,Ba=env.Z,Ca=env._,Da=env.$,Ea=env.aa,Fa=env.ab,Ga=env.ac,Ha=env.ad,Ia=3196624,Ja=8439504,Ka=0.0;
|
||||||
|
// EMSCRIPTEN_START_FUNCS
|
||||||
|
function Uf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;b=Ia;Ia=Ia+16|0;d=b;e=a+16|0;f=c[c[e>>2]>>2]|0;g=f+8|0;h=a+8|0;i=c[h>>2]|0;if(!(g>>>0>=i>>>0|(g|0)==2217396)){g=c[f+12>>2]&15;if((g|0)==5){j=f;k=i}else{l=g+1|0;m=4}}else{l=0;m=4}if((m|0)==4){m=c[16+(l<<2)>>2]|0;c[d>>2]=63002;c[d+4>>2]=m;Bf(a,1,Td(a,49400,d)|0)|0;j=c[c[e>>2]>>2]|0;k=c[h>>2]|0}d=j+16|0;if(d>>>0>=k>>>0|(d|0)==2217396){Bf(a,2,49420)|0;n=c[c[e>>2]>>2]|0;o=c[h>>2]|0}else{n=j;o=k}k=n+8|0;j=n+24|0;if(o>>>0<j>>>0){e=(n+20+(3-o)|0)>>>3;a=o;do{c[a+4>>2]=0;a=a+8|0}while(a>>>0<j>>>0);c[h>>2]=o+(e+1<<3)}c[h>>2]=j;j=Mc(c[k>>2]|0,n+16|0)|0;n=c[h>>2]|0;c[n+-8>>2]=c[j>>2];c[n+-4>>2]=c[j+4>>2];Ia=b;return 1}function Vf(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=Ia;Ia=Ia+16|0;e=d;f=b+16|0;g=c[c[f>>2]>>2]|0;h=g+8|0;i=b+8|0;j=c[i>>2]|0;if(!(h>>>0>=j>>>0|(h|0)==2217396)){h=c[g+12>>2]&15;if((h|0)==5){k=g;l=j}else{m=h+1|0;n=4}}else{m=0;n=4}if((n|0)==4){n=c[16+(m<<2)>>2]|0;c[e>>2]=63002;c[e+4>>2]=n;Bf(b,1,Td(b,49400,e)|0)|0;k=c[c[f>>2]>>2]|0;l=c[i>>2]|0}e=k+16|0;if(e>>>0>=l>>>0|(e|0)==2217396){Bf(b,2,49420)|0;o=c[c[f>>2]>>2]|0;p=c[i>>2]|0}else{o=k;p=l}l=o+24|0;if(l>>>0>=p>>>0|(l|0)==2217396){Bf(b,3,49420)|0;q=c[i>>2]|0;r=c[c[f>>2]>>2]|0}else{q=p;r=o}o=r+8|0;p=r+32|0;if(q>>>0<p>>>0){f=(r+28+(3-q)|0)>>>3;l=q;do{c[l+4>>2]=0;l=l+8|0}while(l>>>0<p>>>0);c[i>>2]=q+(f+1<<3)}c[i>>2]=p;p=c[o>>2]|0;f=r+16|0;q=Mc(p,f)|0;if((q|0)==2217396)s=Nc(b,p,f)|0;else s=q;c[s>>2]=c[r+24>>2];c[s+4>>2]=c[r+28>>2];a[(c[o>>2]|0)+6>>0]=0;r=c[i>>2]|0;if(!(c[r+-4>>2]&64)){t=r;u=t+-16|0;c[i>>2]=u;Ia=d;return 1}if(!(a[(c[r+-8>>2]|0)+5>>0]&3)){t=r;u=t+-16|0;c[i>>2]=u;Ia=d;return 1}s=c[o>>2]|0;o=s+5|0;q=a[o>>0]|0;if(!(q&4)){t=r;u=t+-16|0;c[i>>2]=u;Ia=d;return 1}r=c[b+12>>2]|0;a[o>>0]=q&-5;q=r+76|0;c[s+24>>2]=c[q>>2];c[q>>2]=s;t=c[i>>2]|0;u=t+-16|0;c[i>>2]=u;Ia=d;return 1}function Wf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;b=a+16|0;d=c[c[b>>2]>>2]|0;e=d+8|0;f=a+8|0;g=c[f>>2]|0;if(e>>>0>=g>>>0|(e|0)==2217396){Bf(a,1,49420)|0;h=c[c[b>>2]>>2]|0;i=c[f>>2]|0;j=h;k=h+8|0}else{i=g;j=d;k=e}if(k>>>0>=i>>>0|(k|0)==2217396){l=0;m=16+(l<<2)|0;n=c[m>>2]|0;Qd(a,n)|0;return 1}l=(c[j+12>>2]&15)+1|0;m=16+(l<<2)|0;n=c[m>>2]|0;Qd(a,n)|0;return 1}function Xf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;b=Ia;Ia=Ia+16|0;d=b;e=a+16|0;f=c[c[e>>2]>>2]|0;g=f+8|0;h=a+8|0;i=c[h>>2]|0;if(!(g>>>0>=i>>>0|(g|0)==2217396)){g=c[f+12>>2]&15;if((g|0)==5){j=f;k=i}else{l=g+1|0;m=4}}else{l=0;m=4}if((m|0)==4){m=c[16+(l<<2)>>2]|0;c[d>>2]=63002;c[d+4>>2]=m;Bf(a,1,Td(a,49400,d)|0)|0;j=c[c[e>>2]>>2]|0;k=c[h>>2]|0}e=j+24|0;if(k>>>0<e>>>0){d=(j+20+(3-k)|0)>>>3;j=k;do{c[j+4>>2]=0;j=j+8|0}while(j>>>0<e>>>0);c[h>>2]=k+(d+1<<3)}c[h>>2]=e;if(uf(a,1)|0){n=2;Ia=b;return n|0}a=c[h>>2]|0;c[a+4>>2]=0;c[h>>2]=a+8;n=1;Ia=b;return n|0}function Yf(a){a=a|0;Zf(a,49774,0,4);return 3}function Zf(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;g=Ia;Ia=Ia+16|0;h=g+8|0;i=g;j=(Jf(a,1,d)|0)==0;d=a+16|0;k=c[c[d>>2]>>2]|0;l=k+8|0;m=a+8|0;n=c[m>>2]|0;o=l>>>0<n>>>0;if(j){if(!((l|0)==2217396|o^1)){j=c[k+12>>2]&15;if((j|0)==5)p=n;else{q=j+1|0;r=5}}else{q=0;r=5}if((r|0)==5){r=c[16+(q<<2)>>2]|0;c[i>>2]=63002;c[i+4>>2]=r;Bf(a,1,Td(a,49400,i)|0)|0;p=c[m>>2]|0}c[p>>2]=f;c[p+4>>2]=22;p=c[m>>2]|0;f=p+8|0;c[m>>2]=f;i=c[c[d>>2]>>2]|0;d=i>>>0<p>>>0?i+8|0:2217396;c[f>>2]=c[d>>2];c[p+12>>2]=c[d+4>>2];d=c[m>>2]|0;p=d+8|0;c[m>>2]=p;if(!e){c[d+12>>2]=0;c[m>>2]=d+16;Ia=g;return}else{c[p>>2]=0;c[d+12>>2]=3;c[m>>2]=(c[m>>2]|0)+8;Ia=g;return}}else{d=o?l:2217396;c[n>>2]=c[d>>2];c[n+4>>2]=c[d+4>>2];d=c[m>>2]|0;c[m>>2]=d+8;m=d+-8|0;d=a+38|0;n=(b[d>>1]|0)+1<<16>>16;b[d>>1]=n;if((n&65535)>199){if(n<<16>>16==200)Ac(a,47199,h);if((n&65535)>224)yc(a,6)}n=a+36|0;b[n>>1]=(b[n>>1]|0)+1<<16>>16;if(!(Ec(a,m,3)|0))Fc(a);b[n>>1]=(b[n>>1]|0)+-1<<16>>16;b[d>>1]=(b[d>>1]|0)+-1<<16>>16;Ia=g;return}}function _f(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;b=Ia;Ia=Ia+16|0;e=b;f=a+16|0;g=c[c[f>>2]>>2]|0;h=g+16|0;i=a+8|0;j=c[i>>2]|0;if(!(h>>>0>=j>>>0|(h|0)==2217396)?(c[g+20>>2]|0)==3:0)k=(c[h>>2]>>16)+1|0;else k=1;h=g+8|0;if(!(h>>>0>=j>>>0|(h|0)==2217396)){h=c[g+12>>2]&15;if((h|0)==5)l=j;else{m=h+1|0;n=7}}else{m=0;n=7}if((n|0)==7){n=c[16+(m<<2)>>2]|0;c[e>>2]=63002;c[e+4>>2]=n;Bf(a,1,Td(a,49400,e)|0)|0;l=c[i>>2]|0}e=k<<16;c[l>>2]=e;c[l+4>>2]=3;l=c[i>>2]|0;a=l+8|0;c[i>>2]=a;n=c[c[f>>2]>>2]|0;f=c[(n>>>0<l>>>0?n+8|0:2217396)>>2]|0;n=k+-1|0;a:do if(n>>>0<(c[f+28>>2]|0)>>>0)o=(c[f+12>>2]|0)+(n<<3)|0;else{k=0-e|0;m=(c[f+16>>2]|0)+(((((e|0)<0?((e|0)==(k|0)?0:k):e)|0)%((1<<(d[f+7>>0]|0))+-1|1|0)|0)*20|0)|0;while(1){if((c[m+12>>2]|0)==3?(c[m+8>>2]|0)==(e|0):0)break;k=c[m+16>>2]|0;if(!k){o=2217396;break a}else m=k}o=m}while(0);c[a>>2]=c[o>>2];c[l+12>>2]=c[o+4>>2];o=c[i>>2]|0;c[i>>2]=o+8;if((o|0)==2217396){Ia=b;return 2}else{Ia=b;return ((c[o+4>>2]&15|0)==0?1:2)|0}return 0}function $f(a){a=a|0;Zf(a,49782,1,5);return 3}function ag(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=Line truncated
|
||||||
|
function Vl(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;j=Ia;Ia=Ia+16|0;k=j+4|0;l=j;m=h&1;n=b+72|0;o=c[n>>2]|0;p=c[o>>2]|0;if(p&4|0?(c[o+52>>2]|0)>>>0>4294901760:0){c[b+64>>2]=4;q=0;Ia=j;return q|0}if(!(p&1)){c[b+64>>2]=10;q=0;Ia=j;return q|0}c[b+28>>2]=d;c[b+32>>2]=e;c[b+36>>2]=f;c[b+40>>2]=g;a[b+44>>0]=m;m=(i|0)!=0;p=b+48|0;do if(m){if(c[p>>2]|0)c[p>>2]=0;r=Ql(c[i>>2]|0,c[i+12>>2]|0)|0;c[p>>2]=r;if(r|0){s=c[n>>2]|0;break}c[b+64>>2]=7;q=0;Ia=j;return q|0}else{c[p>>2]=0;s=o}while(0);a[l>>0]=44;r=c[s+64>>2]|0;if(!r)nv(44,c[s+56>>2]|0)|0;else Oa[r&7](b,l,1)|0;a[k>>0]=d;r=k+1|0;a[r>>0]=d>>>8;d=c[n>>2]|0;s=c[d+64>>2]|0;if(!s)hv(k,1,2,c[d+56>>2]|0)|0;else Oa[s&7](b,k,2)|0;a[k>>0]=e;a[r>>0]=e>>>8;e=c[n>>2]|0;s=c[e+64>>2]|0;if(!s)hv(k,1,2,c[e+56>>2]|0)|0;else Oa[s&7](b,k,2)|0;a[k>>0]=f;a[r>>0]=f>>>8;s=c[n>>2]|0;e=c[s+64>>2]|0;if(!e)hv(k,1,2,c[s+56>>2]|0)|0;else Oa[e&7](b,k,2)|0;a[k>>0]=g;a[r>>0]=g>>>8;r=c[n>>2]|0;e=c[r+64>>2]|0;if(!e)hv(k,1,2,c[r+56>>2]|0)|0;else Oa[e&7](b,k,2)|0;e=(m?128:0)|(h?64:0);a:do if(m){h=(c[i+4>>2]|0)+255|e;a[l>>0]=h;r=c[n>>2]|0;s=c[r+64>>2]|0;if(!s)nv(h<<24>>24,c[r+56>>2]|0)|0;else Oa[s&7](b,l,1)|0;if((c[i>>2]|0)>0){s=i+12|0;r=l+1|0;h=l+2|0;d=0;while(1){t=c[s>>2]|0;a[l>>0]=a[t+(d*3|0)>>0]|0;a[r>>0]=a[t+(d*3|0)+1>>0]|0;a[h>>0]=a[t+(d*3|0)+2>>0]|0;t=c[n>>2]|0;u=c[t+64>>2]|0;if(!u)v=hv(l,1,3,c[t+56>>2]|0)|0;else v=Oa[u&7](b,l,3)|0;d=d+1|0;if((v|0)!=3)break;if((d|0)>=(c[i>>2]|0))break a}c[b+64>>2]=2;q=0;Ia=j;return q|0}}else{a[l>>0]=e;d=c[n>>2]|0;h=c[d+64>>2]|0;if(!h){nv(e<<24>>24,c[d+56>>2]|0)|0;break}else{Oa[h&7](b,l,1)|0;break}}while(0);l=c[b+20>>2]|0;e=c[p>>2]|0;if((l|0)==0&(e|0)==0){c[b+64>>2]=5;q=0;Ia=j;return q|0}c[o>>2]=c[o>>2]|4;c[o+52>>2]=B(g,f)|0;f=c[n>>2]|0;n=c[((e|0)==0?l:e)+4>>2]|0;e=(n|0)>2?n:2;a[k>>0]=e;n=c[f+64>>2]|0;if(!n)nv(e<<24>>24,c[f+56>>2]|0)|0;else Oa[n&7](b,k,1)|0;a[f+68>>0]=0;c[f+8>>2]=e;k=1<<e;n=f+12|0;c[n>>2]=k;c[f+16>>2]=k+1;c[f+20>>2]=k+2;c[f+24>>2]=e+1;c[f+28>>2]=2<<e;c[f+36>>2]=4097;c[f+44>>2]=0;c[f+48>>2]=0;Wv(c[f+24900>>2]|0,-1,32768)|0;if(!(Wl(b,c[n>>2]|0)|0))c[b+64>>2]=8;q=1;Ia=j;return q|0}function Wl(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;f=b+72|0;g=c[f>>2]|0;h=g+44|0;i=c[h>>2]|0;do if((e|0)==4096){j=g+68|0;if((i|0)>0){k=g+48|0;l=b+64|0;m=c[k>>2]|0;n=1;while(1){o=a[j>>0]|0;do if(o<<24>>24==-1){p=c[f>>2]|0;q=c[p+64>>2]|0;if(!q)r=hv(j,1,256,c[p+56>>2]|0)|0;else r=Oa[q&7](b,j,256)|0;if((r|0)==((d[j>>0]|0)+1|0)){a[j>>0]=0;s=0;t=10;break}else{c[l>>2]=2;u=0;break}}else{s=o;t=10}while(0);if((t|0)==10){t=0;o=s+1<<24>>24;a[j>>0]=o;a[(o&255)+(g+68)>>0]=m;u=n}m=(c[k>>2]|0)>>>8;c[k>>2]=m;o=c[h>>2]|0;c[h>>2]=o+-8;if((o|0)<=8){v=u;break}else n=u}}else v=1;c[h>>2]=0;n=a[j>>0]|0;if(n<<24>>24){m=(n&255)+1|0;n=c[f>>2]|0;k=c[n+64>>2]|0;if(!k)w=hv(j,1,m,c[n+56>>2]|0)|0;else w=Oa[k&7](b,j,m)|0;if((w|0)!=((d[j>>0]|0)+1|0)){c[b+64>>2]=2;x=0;break}}a[j>>0]=0;m=c[f>>2]|0;k=c[m+64>>2]|0;if(!k)y=hv(j,1,1,c[m+56>>2]|0)|0;else y=Oa[k&7](b,j,1)|0;if((y|0)==1)x=v;else{c[b+64>>2]=2;x=0}}else{k=g+48|0;m=c[k>>2]|e<<i;c[k>>2]=m;n=(c[g+24>>2]|0)+i|0;c[h>>2]=n;if((n|0)>7){n=g+68|0;l=b+64|0;o=m;m=1;while(1){q=a[n>>0]|0;do if(q<<24>>24==-1){p=c[f>>2]|0;z=c[p+64>>2]|0;if(!z)A=hv(n,1,256,c[p+56>>2]|0)|0;else A=Oa[z&7](b,n,256)|0;if((A|0)==((d[n>>0]|0)+1|0)){a[n>>0]=0;B=0;t=32;break}else{c[l>>2]=2;C=0;break}}else{B=q;t=32}while(0);if((t|0)==32){t=0;q=B+1<<24>>24;a[n>>0]=q;a[(q&255)+(g+68)>>0]=o;C=m}o=(c[k>>2]|0)>>>8;c[k>>2]=o;q=c[h>>2]|0;c[h>>2]=q+-8;if((q|0)<=15){x=C;break}else m=C}}else x=1}while(0);C=g+28|0;if(!((e|0)<4096?(c[g+20>>2]|0)>=(c[C>>2]|0):0))return x|0;e=g+24|0;g=(c[e>>2]|0)+1|0;c[e>>2]=g;c[C>>2]=1<<g;return x|0}function Xl(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;f=c[a+72>>2]|0;g=c[f+24900>>2]|0;h=f+36|0;i=c[h>>2]|0;if((i|0)==4097){j=d[b>>0]|0;k=1}else{j=i;k=0}a:do if((k|0)<(e|0)){i=f+20|0;l=f+12|0;m=f+16|0;n=f+8|0;o=f+24|0;p=f+28|0;q=j;r=k;b:while(1){s=d[b+r>>0]|0;r=r+1|0;t=q<<8|s;u=t^q>>>4&1048575;v=u&8191;w=c[g+(v<<2)>>2]|0;x=w>>>12;c:do if((x|0)==1048575)y=10;else{z=w;A=v;B=x;while(1){if((B|0)==(t|0))break;A=A+1&8191;C=c[g+(A<<2)>>2]|0;B=C>>>12;if((B|0)==1048575){y=10;break c}else z=C}D=z&4095}while(0);do if((y|0)==10){y=0;if(!(Wl(a,q)|0)){y=11;break b}x=c[i>>2]|0;if((x|0)>4094){if(!(Wl(a,c[l>>2]|0)|0)){y=14;break b}c[i>>2]=(c[m>>2]|0)+1;v=(c[n>>2]|0)+1|0;c[o>>2]=v;c[p>>2]=1<<v;Wv(g|0,-1,32768)|0;D=s;break}c[i>>2]=x+1;v=u;while(1){w=v&8191;E=g+(w<<2)|0;if((c[E>>2]|0)>>>0<4294963200)v=w+1|0;else break}c[E>>2]=x&4095|t<<12;D=s}while(0);if((r|0)>=(e|0)){F=D;break a}else q=D}if((y|0)==11){c[a+64>>2]=8;G=0;return G|0}else if((y|0)==14){c[a+64>>2]=8;G=0;return G|0}}else F=j;while(0);c[h>>2]=F;if(c[f+52>>2]|0){G=1;return G|0}if(!(Wl(a,F)|0)){c[a+64>>2]=8;G=0;return G|0}if(!(Wl(a,c[f+16>>2]|0)|0)){c[a+64>>2]=8;G=0;return G|0}if(Wl(a,4096)|Line truncated
|
||||||
|
function Zk(){var a=0,b=0;a=c[535458]|0;b=c[778903]|0;if(b|0)c[b+332>>2]=a;b=c[778904]|0;if(b|0)c[b+332>>2]=a;b=c[778905]|0;if(b|0)c[b+332>>2]=a;b=c[778906]|0;if(b|0)c[b+332>>2]=a;b=c[778907]|0;if(b|0)c[b+332>>2]=a;b=c[778908]|0;if(b|0)c[b+332>>2]=a;b=c[778909]|0;if(b|0)c[b+332>>2]=a;b=c[778910]|0;if(b|0)c[b+332>>2]=a;b=c[778911]|0;if(b|0)c[b+332>>2]=a;b=c[778912]|0;if(b|0)c[b+332>>2]=a;b=c[778913]|0;if(b|0)c[b+332>>2]=a;b=c[778914]|0;if(b|0)c[b+332>>2]=a;b=c[778915]|0;if(b|0)c[b+332>>2]=a;b=c[778916]|0;if(b|0)c[b+332>>2]=a;b=c[778917]|0;if(b|0)c[b+332>>2]=a;b=c[778918]|0;if(!b)return;c[b+332>>2]=a;return}function _k(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=e&65535;h=g>>>0<24320;if((g+-17152|0)>>>0<7168&(c[742800]|0)>0)return;i=f&255;j=i>>>0>127?f|-256:i;k=(b|0)==0;if(!k)a[b+156904+g>>0]=f;if(e&32768|0){b=g+-32768>>13;if(!(c[3193536+(b<<2)>>2]|0))return;l=2971132+(b<<2)|0;b=e>>>6&127;m=e<<1&126;a[(c[(c[(c[l>>2]|0)+16>>2]|0)+(b<<2)>>2]|0)+m>>0]=f&15;a[(c[(c[(c[l>>2]|0)+16>>2]|0)+(b<<2)>>2]|0)+(m|1)>>0]=f>>>4&15;return}if(g>>>0<4096){m=d+8|0;b=g>>>6;l=e<<1&126;a[(c[(c[(c[m>>2]|0)+16>>2]|0)+(b<<2)>>2]|0)+l>>0]=f&15;a[(c[(c[(c[m>>2]|0)+16>>2]|0)+(b<<2)>>2]|0)+(l|1)>>0]=f>>>4&15;return}if(g>>>0<8192){l=d+8|0;b=g>>>6;m=e<<1&126;a[(c[(c[(c[l>>2]|0)+16>>2]|0)+(b<<2)>>2]|0)+m>>0]=f&15;a[(c[(c[(c[l>>2]|0)+16>>2]|0)+(b<<2)>>2]|0)+(m|1)>>0]=f>>>4&15;a[(c[(c[(c[d+12>>2]|0)+16>>2]|0)+(g>>>7<<2)>>2]|0)+(e&127)>>0]=f;return}if(g>>>0<12288){m=g+-8192|0;a[(c[(c[(c[d+12>>2]|0)+16>>2]|0)+(m>>7<<2)>>2]|0)+(m&127)>>0]=f;return}if(g>>>0<12544){c[d+44832+(g+-12288<<2)>>2]=i;return}if(g>>>0<12800){m=g+-12544|0;b=(m|0)/4|0;l=m&3;c[d+43536+(b<<4)+(l<<2)>>2]=f&127;m=1<<l;l=d+44560+(b<<2)|0;b=c[l>>2]|0;c[l>>2]=b&~m;if(!(f&128))return;c[l>>2]=b|m;return}if(g>>>0<17152){m=g+-12800|0;b=(m|0)/68|0;l=m-(b*68|0)|0;if((l|0)<64){m=(l|0)/2|0;if(!(l&1)){c[d+16+(b*680|0)+20+(m*20|0)>>2]=f&63;n=d+16+(b*680|0)+20+(m*20|0)+4|0;c[n>>2]=c[n>>2]&4|f>>>6&3;return}else{n=d+16+(b*680|0)+20+(m*20|0)+4|0;c[n>>2]=c[n>>2]&3|f<<2&4;c[d+16+(b*680|0)+20+(m*20|0)+8>>2]=f>>>1&7;c[d+16+(b*680|0)+20+(m*20|0)+12>>2]=f>>>4&7;c[d+16+(b*680|0)+20+(m*20|0)+16>>2]=f&128;return}}switch(l|0){case 64:{c[d+16+(b*680|0)+4>>2]=f&1;c[d+16+(b*680|0)>>2]=f&254;return}case 65:{c[d+16+(b*680|0)+8>>2]=i;return}case 66:{c[d+16+(b*680|0)+12>>2]=i;return}case 67:{c[d+16+(b*680|0)+16>>2]=i;return}default:return}}if(k|g>>>0<24064)return;if(h){h=g+-24064|0;k=3120248+(((h|0)/4|0)<<2)|0;b=c[k>>2]|0;d=h<<3&24;h=b&~(255<<d)|i<<d;c[k>>2]=h;if((b|0)==(h|0))return;c[798463]=1;return}if(g>>>0>=24448)if(g>>>0<24576){cn(g+-24448|0,i);return}else{h=g+-24576|0;b=h>>6;k=h<<1&126;a[(c[(c[(c[742782]|0)+16>>2]|0)+(b<<2)>>2]|0)+k>>0]=f&15;a[(c[(c[(c[742782]|0)+16>>2]|0)+(b<<2)>>2]|0)+(k|1)>>0]=f>>>4&15;return}k=g+-24320|0;if(g>>>0<24336){c[3123880+(k<<2)>>2]=i;return}if(g>>>0<24352){c[3123944+(g+-24336<<2)>>2]=i;if(!(f&128))return;nb();return}if(g>>>0<24356){c[3124072+(g+-24352<<2)>>2]=i;Lk();return}do switch((e&65535)<<16>>16){case 24356:{c[781025]=i;return}case 24357:{c[781022]=i;return}case 24358:{c[781023]=i;return}case 24359:{c[781024]=i;return}case 24360:{c[781030]=c[781030]&-256|i;return}case 24361:{c[781030]=c[781030]&255|j<<8;return}case 24362:{c[781031]=c[781031]&-256|i;return}case 24363:{c[781031]=c[781031]&255|j<<8;return}case 24364:{c[781033]=i;return}case 24369:{c[781038]=c[781038]&-256|i;return}case 24370:{c[781038]=c[781038]&-65281|i<<8;return}case 24371:{c[781038]=c[781038]&-16711681|i<<16;return}case 24372:{c[781043]=i;return}case 24373:{c[781041]=i;return}case 24380:{c[781039]=c[781039]&-256|i;return}case 24381:{c[781039]=c[781039]&255|j<<8;return}case 24382:{c[781040]=c[781040]&-256|i;return}case 24383:{c[781040]=c[781040]&255|j<<8;return}case 24384:{c[781382]=i;return}case 24385:{c[781383]=i;return}case 24386:{c[781384]=i;return}case 24387:{c[781385]=i;return}default:switch((e&65532)<<16>>16){case 24388:{b=(g<<3)+-195104|0;yl(0,(xl(0)|0)&~(255<<b)|i<<b);return}case 24392:{b=(g<<3)+-195136|0;yl(1,(xl(1)|0)&~(255<<b)|i<<b);return}default:{b=g+-24396|0;if(b>>>0<8){c[3124188+(b<<5)>>2]=f&1;c[3124188+(b<<5)+4>>2]=f>>>1&1;c[3124188+(b<<5)+8>>2]=f>>>2&1;c[3124188+(b<<5)+12>>2]=f>>>3&1;c[3124188+(b<<5)+16>>2]=f>>>4&1;c[3124188+(b<<5)+20>>2]=f>>>5&1;return}switch(k|1|0){case 85:{Nk(c[798931]|0);return}case 87:{Hh();return}default:{if((k|0)==94){c[781034]=i;c[781035]=f&15;c[781036]=f>>>4&15;return}if((e&65520|0)!=24416)return;c[3124008+(g+-24416<<2)>>2]=i;return}}}}}while(0)}function $k(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=f&65535;h=(b|0)==0;if(h)i=0;else i=d[b+156904+g>>0]|0;a:do if(g>>>0>=8192){if(g>>>0<12288){b=g+-8192|0;j=d[(c[(c[(c[e+12>>2]|0)+16>>2]|0)+(b>>7<<2)>>2]|0)+(b&127)>>0]|0;break}if(g>>>0<12544){j=c[e+44832+(g+-12288<<2)>>2]|0;break}if(g>>>0<12800){b=g+-12544|0;k=(b|0)/4|0;l=b&3;b=c[e+43536+(k<<4)+(l<<2)>>2]&127;j=(c[e+44560+(k<<2)>>2]&1<<l|0)==0?b:b|128;break}if(g>>>0<17152){b=g+-12800|0;l=(b|0)/68|0;k=b-(l*68|0)|0;if((k|0)Line truncated
|
||||||
|
function Wa(a){a=a|0;var b=0;b=Ia;Ia=Ia+a|0;Ia=Ia+15&-16;return b|0}function Xa(){return Ia|0}function Ya(a){a=a|0;Ia=a}function Za(a,b){a=a|0;b=b|0;Ia=a;Ja=b}function _a(){return c[(c[(c[c[742804]>>2]|0)+16>>2]|0)+12>>2]|0}function $a(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;if((c[780901]|0)!=0&(c[780894]|0)==1?a[3152374]&64:0)return;c[781024]=(c[781024]|0)-b;d=128-b|0;e=c[742782]|0;if((d|0)>0){f=e;g=0;while(1){Gp(f,f,0,g+b|0,0,g,128,1);g=g+1|0;h=c[742782]|0;if((g|0)==(d|0)){i=h;j=d;break}else f=h}}else{i=e;j=0}Pn(i,0,j,127,127,0);jh(65536);return}function ab(){var b=0,d=0;b=(c[781024]|0)+(c[781029]|0)|0;c[781024]=b;if((b|0)<=((c[781031]|0)+122|0))return;if((c[780901]|0)!=0&(c[780894]|0)==1?a[3152374]&64:0)return;c[781024]=b+-6;b=c[742782]|0;d=0;do{Gp(b,b,0,d+6|0,0,d,128,1);d=d+1|0;b=c[742782]|0}while((d|0)!=122);Pn(b,0,122,127,127,0);jh(65536);return}function bb(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;b=Ia;Ia=Ia+352|0;d=b+336|0;e=b+328|0;f=b+320|0;g=b+312|0;h=b+304|0;i=b+296|0;j=b+288|0;k=b+280|0;l=b+272|0;m=b+264|0;n=b+256|0;o=b+248|0;p=b+240|0;q=b+232|0;r=b+224|0;s=b+216|0;t=b+208|0;u=b+200|0;v=b+192|0;w=b+184|0;x=b+176|0;y=b+168|0;z=b+160|0;A=b+152|0;B=b+144|0;C=b+136|0;D=b+128|0;E=b+120|0;F=b+16|0;G=b+8|0;H=b;I=b+340|0;if(!(ut(a,35296,9)|0))Wo(a+10|0,3115688)|0;if(!(ut(a,35306,10)|0))Wo(a+11|0,3117736)|0;if(!(ut(a,35317,14)|0)){c[H>>2]=1938452;Su(a+14|0,96484,H)|0}if(!(ut(a,35332,15)|0)){c[G>>2]=1938456;Su(a+15|0,96484,G)|0}if(!(ut(a,35348,11)|0)){c[F>>2]=1938516;c[F+4>>2]=1938520;c[F+8>>2]=1938524;c[F+12>>2]=1938528;c[F+16>>2]=1938532;c[F+20>>2]=1938536;c[F+24>>2]=1938540;c[F+28>>2]=1938544;c[F+32>>2]=1938548;c[F+36>>2]=1938552;c[F+40>>2]=1938556;c[F+44>>2]=1938560;c[F+48>>2]=1938564;c[F+52>>2]=1938568;c[F+56>>2]=1938572;c[F+60>>2]=1938576;c[F+64>>2]=1938580;c[F+68>>2]=1938584;c[F+72>>2]=1938588;c[F+76>>2]=1938592;c[F+80>>2]=1938596;c[F+84>>2]=1938600;c[F+88>>2]=1938604;c[F+92>>2]=1938608;c[F+96>>2]=1938612;Su(a+11|0,35360,F)|0}if(!(ut(a,35436,10)|0)){c[E>>2]=1938772;Su(a+10|0,96484,E)|0}if(!(ut(a,35447,11)|0)){c[D>>2]=1938800;Su(a+11|0,96484,D)|0}if(!(ut(a,51100,7)|0)){c[C>>2]=1938804;Su(a+7|0,96484,C)|0}if((ut(a,93198,6)|0)==0?(c[B>>2]=2142440,Su(a+6|0,96484,B)|0,c[555247]|0):0)c[555247]=c[535610];if(!(ut(a,35459,9)|0)){c[A>>2]=1938820;Su(a+9|0,96484,A)|0}if(!(ut(a,51487,16)|0)){c[z>>2]=1938788;Su(a+16|0,96484,z)|0}if(!(ut(a,51388,9)|0)){c[y>>2]=1938792;Su(a+9|0,96484,y)|0}if(!(ut(a,35469,12)|0)){c[x>>2]=1938836;Su(a+12|0,96484,x)|0}if(!(ut(a,35482,20)|0)){c[w>>2]=2141880;Su(a+20|0,96484,w)|0}if(!(ut(a,35503,22)|0)){c[v>>2]=2141884;Su(a+22|0,96484,v)|0}if(!(ut(a,35526,14)|0)){c[u>>2]=I;Su(a+14|0,96484,u)|0;c[484711]=(c[I>>2]|0)==2&1}if(!(ut(a,50818,13)|0)){c[t>>2]=1938844;Su(a+13|0,96484,t)|0}if(!(ut(a,35541,14)|0)){c[s>>2]=1938848;Su(a+14|0,96484,s)|0}if(!(ut(a,51593,9)|0)){c[r>>2]=1938776;Su(a+9|0,96484,r)|0}if(!(ut(a,50604,9)|0)){c[q>>2]=1938780;Su(a+9|0,96484,q)|0}if(!(ut(a,35556,19)|0)){c[p>>2]=1938500;Su(a+19|0,96484,p)|0}if(!(ut(a,35576,19)|0)){c[o>>2]=1938496;Su(a+19|0,96484,o)|0}if(!(ut(a,35596,22)|0)){c[n>>2]=1938504;Su(a+22|0,96484,n)|0}if(!(ut(a,35619,11)|0)){c[m>>2]=1938828;Su(a+11|0,96484,m)|0}if(!(ut(a,35631,14)|0)){c[l>>2]=1938784;Su(a+14|0,96484,l)|0}if(!(ut(a,35646,22)|0)){c[k>>2]=1938492;Su(a+22|0,96484,k)|0}if(!(ut(a,35669,18)|0)){c[j>>2]=1938484;Su(a+18|0,96484,j)|0}if(!(ut(a,35688,16)|0)){c[i>>2]=1938488;Su(a+16|0,96484,i)|0}if(!(ut(a,35705,16)|0)){c[h>>2]=1938480;Su(a+16|0,96484,h)|0}if(!(ut(a,35722,14)|0)){c[g>>2]=1938476;Su(a+14|0,96484,g)|0}if(!(ut(a,35737,18)|0)){c[f>>2]=1938816;Su(a+18|0,96484,f)|0}if(!(ut(a,35756,20)|0)){c[e>>2]=1938512;Su(a+20|0,96484,e)|0}if(ut(a,35777,13)|0){Ia=b;return 0}c[d>>2]=1938448;Su(a+13|0,96484,d)|0;c[555803]=c[484612];Ia=b;return 0}function cb(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ja=0,Ka=0;b=Ia;Ia=Ia+432|0;d=b+424|0;e=b+416|0;f=b+408|0;g=b+400|0;h=b+392|0;i=b+384|0;j=b+376|0;k=b+368|0;l=b+360|0;m=b+352|0;n=b+344|0;o=b+336|0;p=b+328|0;q=b+320|0;r=b+312|0;s=b+304|0;t=b+296|0;u=b+288|0;v=b+280|0;w=b+272|0;x=b+264|0;y=b+256|0;z=b+248|0;A=b+240|0;B=b+232|0;C=b+224|0;D=b+216|0;E=b+208|0;F=b+200|0;G=b+192|0;H=b+184|0;I=b+176|0;J=b+168|0;K=b+160|0;L=b+152|0;M=b+144|0;N=b+136|0;O=b+128|0;P=b+120|0;Q=b+112|0;R=b+104|0;S=b+96|0;T=b+88|0;U=b+80|0;V=b+72|0;W=b+64|0;X=b+56|0;Y=b+48|0;Z=b+40|0;_=b+32|0;$=b+24|0;aa=b+16|0;ba=b+8|0;ca=b;da=a+8|0;a=c[da>>2]|0;c[ca>>2]=35804;_u(a,35791,ca)|0;hv(35810,25,1,c[da>>2]|0)|0;ca=c[da>>2]|0;c[ba>>2]=c[535610];_u(ca,35836,ba)|0;hv(35848,37,1,c[da>>2]|0)|0;ba=c[da>>2]Line truncated
|
||||||
|
function Si(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;b=a+112|0;d=c[b>>2]|0;do if((d|0)>0){e=a+8|0;f=c[e>>2]|0;g=0-d|0;h=f+(g<<3)|0;if((c[f+(g<<3)+4>>2]|0)==3){i=d;j=c[h>>2]|0}else{g=Gd(h)|0;i=c[b>>2]|0;j=g}if((i|0)>1){g=(c[e>>2]|0)+(0-i<<3)+8|0;if((c[g+4>>2]|0)==3){k=i;l=c[g>>2]|0}else{h=Gd(g)|0;k=c[b>>2]|0;l=h}if((k|0)>2){h=(c[e>>2]|0)+(0-k<<3)+16|0;if((c[h+4>>2]|0)==3){m=k;n=c[h>>2]|0}else{g=Gd(h)|0;m=c[b>>2]|0;n=g}if((m|0)>3){g=(c[e>>2]|0)+(0-m<<3)+24|0;if((c[g+4>>2]|0)==3){o=n;p=c[g>>2]|0;q=j;r=l;break}else{o=n;p=Gd(g)|0;q=j;r=l;break}}else{o=n;p=0;q=j;r=l}}else{o=0;p=0;q=j;r=l}}else{o=0;p=0;q=j;r=0}}else{o=0;p=0;q=0;r=0}while(0);c[781044]=0;j=qk(a,5)|0;a=c[781030]<<16;l=q-a>>16;q=c[781031]<<16;n=r-q>>16;r=o-a>>16;a=p-q>>16;q=(r|0)<(l|0);p=q?r:l;o=q?l:r;r=(a|0)<(n|0);l=r?a:n;q=r?n:a;a=c[742782]|0;do if(!(c[781044]|0)){n=c[a+28>>2]|0;r=(p|0)>(n|0)?p:n;n=(c[a+32>>2]|0)+-1|0;m=(o|0)<(n|0)?o:n;n=c[a+36>>2]|0;b=(l|0)>(n|0)?l:n;n=(c[a+40>>2]|0)+-1|0;k=(q|0)<(n|0)?q:n;if((m|0)<(r|0)|(k|0)<(b|0))return 0;if((m-r|0)<8&(k-b|0)>4){n=Kk(a,r,b,k,j)|0;if((m|0)<=(r|0)){s=n;break}i=n;n=r;while(1){n=n+1|0;d=(Kk(c[742782]|0,n,b,k,j)|0)+i|0;if((n|0)>=(m|0)){s=d;break}else i=d}}else{i=xk(a,r,m,b,j)|0;if((k|0)<=(b|0)){s=i;break}n=i;i=b;while(1){i=i+1|0;d=(xk(c[742782]|0,r,m,i,j)|0)+n|0;if((i|0)>=(k|0)){s=d;break}else n=d}}}else{n=Ck(a,-1,-1,128,l+-1|0,j)|0;k=(Ck(c[742782]|0,-1,q+1|0,128,128,j)|0)+n|0;n=k+(Ck(c[742782]|0,-1,l,p+-1|0,q,j)|0)|0;s=n+(Ck(c[742782]|0,o+1|0,l,128,q,j)|0)|0}while(0);jh((s|0)/16|0);return 0}function Ti(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;b=c[742782]|0;if((yd(a)|0)<2)return 0;if(!(Ed(a,1)|0))d=0;else d=(Fd(a,1,0)|0)>>16;if(!(Ed(a,2)|0))e=0;else e=(Fd(a,2,0)|0)>>16;if(!(Ed(a,3)|0))f=0;else f=(Fd(a,3,0)|0)>>16;if(!(Ed(a,4)|0))g=0;else g=(Fd(a,4,0)|0)>>16;if(!(Ed(a,5)|0))h=0;else h=(Fd(a,5,0)|0)>>16;i=pk(a,6,1)|0;a=d-(c[781030]|0)<<16>>16;d=e-(c[781031]|0)<<16>>16;if((f|0)<1|(g|0)<1)return 0;e=((((f|0)<(g|0)?f:g)|0)/2|0)+-1|0;j=(h|0)<(e|0)?h:e;if((j|0)<1){e=a+f+-1|0;h=d+g|0;k=h+-1|0;l=Ik(b,a,d,e,d,i)|0;if((k|0)==(d|0))m=l;else m=(Ik(b,a,k,e,k,i)|0)+l|0;l=k-d|0;k=d+1|0;n=h+-2|0;if((((l|0)<0?0-l|0:l)|0)>1){l=(Ik(b,a,k,a,n,i)|0)+m|0;o=l+(Ik(b,e,k,e,n,i)|0)|0}else o=m;jh((o|0)/2|0);return 0}else{o=j<<1;m=o+2|0;n=-2-o|0;o=Fk(b,a,d,a+m|0,d+m|0,f+-1+n|0,g+-1+n|0,i)|0;n=j+2|0;j=a+n|0;m=a+f|0;f=m-n|0;e=f+-1|0;k=d+n|0;l=d+g|0;g=l-n|0;n=g+-1|0;h=l+-1|0;if((f|0)>(j|0)){f=(Ik(b,j,d,e,d,i)|0)+o|0;p=f+(Ik(b,j,h,e,h,i)|0)|0}else p=o;o=m+-1|0;if((g|0)>(k|0)){g=(Ik(b,a,k,a,n,i)|0)+p|0;q=g+(Ik(b,o,k,o,n,i)|0)|0}else q=p;jh((q|0)/2|0);return 0}return 0}function Ui(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;b=c[742782]|0;if((yd(a)|0)<2)return 0;if(!(Ed(a,1)|0))d=0;else d=(Fd(a,1,0)|0)>>16;if(!(Ed(a,2)|0))e=0;else e=(Fd(a,2,0)|0)>>16;if(!(Ed(a,3)|0))f=0;else f=(Fd(a,3,0)|0)>>16;if(!(Ed(a,4)|0))g=0;else g=(Fd(a,4,0)|0)>>16;if(!(Ed(a,5)|0))h=0;else h=(Fd(a,5,0)|0)>>16;i=d-(c[781030]|0)<<16>>16;d=e-(c[781031]|0)<<16>>16;c[781044]=0;e=pk(a,6,1)|0;if((f|0)<1|(g|0)<1){if(!(c[781044]|0))return 0;jh((Ck(b,0,0,(c[b>>2]|0)+-1|0,(c[b+4>>2]|0)+-1|0,e)|0)/16|0);return 0}a=((((f|0)<(g|0)?f:g)|0)/2|0)+-1|0;j=(h|0)<(a|0)?h:a;a=(c[781044]|0)==0?1:2;if((j|0)>=1){h=j<<1;k=h+2|0;l=-2-h|0;h=f+-1|0;m=Gk(b,i,d,i+k|0,d+k|0,h+l|0,g+-1+l|0,e)|0;l=d+(j+2)|0;k=d+g+(-2-j)|0;if((l|0)<(k|0)){j=h+i|0;h=m;n=l;while(1){l=(Qa[a&3](b,i,j,n,e)|0)+h|0;n=n+1|0;if((n|0)>=(k|0)){o=l;break}else h=l}}else o=m;jh((o|0)/16|0);return 0}o=d+g|0;g=f+-1+i|0;f=0;m=d;do{f=(Qa[a&3](b,i,g,m,e)|0)+f|0;m=m+1|0}while((m|0)<(o|0));if(!(c[781044]|0))p=f;else{m=(Ck(b,-1,-1,c[b>>2]|0,d+-1|0,e)|0)+f|0;p=m+(Ck(b,-1,o,c[b>>2]|0,c[b+4>>2]|0,e)|0)|0}jh((p|0)/16|0);return 0}function Vi(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;d=yd(b)|0;if((d|0)<2)return 0;e=Fd(b,1,0)|0;f=Fd(b,2,0)|0;if((d|0)!=2){d=Fd(b,3,0)|0;if((d|0)<0)return 0;else{g=(a[3152374]&2)==0?0:d>>>15&1;h=d>>16}}else{g=0;h=4}d=pk(b,4,1)|0;b=e-(c[781030]<<16)>>16;e=f-(c[781031]<<16)>>16;f=h+g|0;jh((zk(c[742782]|0,b-h|0,e-h|0,f+b|0,f+e|0,d)|0)/2|0);return 0}function Wi(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=yd(b)|0;if((d|0)<2)return 0;e=Fd(b,1,0)|0;f=Fd(b,2,0)|0;c[781044]=0;g=pk(b,4,1)|0;do if((d|0)==2){h=0;i=4}else{j=Fd(b,3,0)|0;if((j|0)>=0){h=(a[3152374]&2)==0?0:j>>>15&1;i=j>>>16;break}if(!(c[781044]|0))return 0;jh((Ck(c[742782]|0,0,0,127,127,g)|0)/16|0);return 0}while(0);b=e-(c[781030]<<16)>>16;e=f-(c[781031]<<16)>>16;f=h+i|0;jh((Ek(c[742782]|0,b-i|0,e-i|0,f+b|0,f+e|0,g)|0)/16|0);return 0}function Xi(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=Fd(a,1,0)|0;d=Fd(a,2,0)|0;e=Fd(a,3,0)|0;f=Fd(a,4,0)|0;g=pk(a,5,1)|0;a=c[781030]<<16;h=b-a>>16;b=c[781031]<<16;i=d-b>>16;d=e-a>>16;a=f-b>>16;b=(d|0)<(h|0);f=(a|0)<(i|0);jh((zk(c[742782]|0,b?d:h,f?a:i,b?h:d,f?i:a,g)|0)/2|0);return 0}function Yi(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=Fd(a,1,0)|0;d=Fd(a,2,0)|0;e=Fd(a,3,0)|0;f=Fd(a,4,0)|0;c[781044]=0;g=pk(a,5,1)|0;a=c[781030]<<16;h=b-a>>16;b=Line truncated
|
||||||
|
function cs(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;e=Ia;Ia=Ia+16|0;f=e+12|0;g=e+8|0;h=e+4|0;i=e;j=ka(34)|0;if(!(c[554961]|0))k=1;else k=(ka(33)|0)==0;if((j|0)!=0&k){if(a|0)c[a>>2]=ka(35)|0;if(b|0)c[b>>2]=ka(36)|0;if(!d){Ia=e;return}c[d>>2]=ka(45)|0;Ia=e;return}k=(L(f|0,g|0)|0)&255;if(c[554961]|0?ka(33)|0:0){c[f>>2]=(c[742768]|0)/4|0;c[g>>2]=(c[742769]|0)/4|0}N(0,h|0,i|0);j=c[h>>2]|0;h=c[i>>2]|0;if((j|0)==0|(h|0)==0){Ia=e;return}i=c[742748]|0;l=c[742749]|0;if(!(+(j|0)/+(h|0)>=+(i|0)/+(l|0))){m=(h-((B(l,j)|0)/(i|0)|0)|0)/2|0;n=(c[g>>2]|0)-m|0;c[g>>2]=n;m=(B(c[742748]|0,c[f>>2]|0)|0)/(j|0)|0;c[f>>2]=m;o=j;p=m;q=B(c[742748]|0,n)|0}else{n=(j-((B(i,h)|0)/(l|0)|0)|0)/2|0;i=(B((c[f>>2]|0)-n|0,l)|0)/(h|0)|0;c[f>>2]=i;o=h;p=i;q=B(c[g>>2]|0,l)|0}l=(q|0)/(o|0)|0;c[g>>2]=l;if(a|0)c[a>>2]=p;if(b|0)c[b>>2]=l;if(!d){Ia=e;return}c[d>>2]=k<<1&4|k&1|k>>>1&2;Ia=e;return}function ds(a,b){a=a|0;b=b|0;var d=0,e=0;d=Ia;Ia=Ia+16|0;e=d;c[e>>2]=a;wt(b,103129,e)|0;Ia=d;return}function es(a,b){a=a|0;b=b|0;ku(b,a)|0;return}function fs(a,b){a=a|0;b=b|0;ku(b,a)|0;return}function gs(a,b){a=a|0;b=b|0;ku(b,a)|0;return}function hs(b){b=b|0;var c=0,d=0;if(!(ka(26)|0)){qv(103229)|0;return 0}ka(46)|0;c=bu(b)|0;if((c|0)>0){d=0;do{la(47,a[b+d>>0]|0)|0;d=d+1|0}while((d|0)!=(c|0))}ka(48)|0;return 0}function is(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=Ia;Ia=Ia+16|0;d=b+4|0;e=b;f=(a|0)==0;g=c[554961]|0;if(f|(g|0)!=0)h=g;else{L(d|0,e|0)|0;if(!(ka(34)|0))i=c[e>>2]|0;else{c[d>>2]=ka(35)|0;g=ka(36)|0;c[e>>2]=g;i=g}c[742768]=c[d>>2]<<2;c[742769]=i<<2;h=c[554961]|0}if(!(f&(h|0)!=0)){c[554961]=a;Ia=b;return}qv(103377)|0;ka(49)|0;c[554961]=a;Ia=b;return}function js(a){a=a|0;return}function ks(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=ts(a,104706)|0;if(e|0){Ho(b,1,d,e)|0;Ro(e)}e=c[a+1024>>2]|0;if(!e){zq(a);return}Sa[e&7](a);zq(a);return}function ls(a){a=a|0;var b=0,d=0;b=Ia;Ia=Ia+16|0;d=b;if(a|0){c[d>>2]=a;vv(103443,d)|0}Nu(c[8745]|0)|0;d=c[a+1028>>2]|0;if(!d){zq(a);Ia=b;return}Sa[d&7](a);zq(a);Ia=b;return}function ms(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=vq(1032)|0;ku(f,b)|0;c[f+1024>>2]=d;c[f+1028>>2]=e;qa(a|0,f|0,2,4);return 0}function ns(){var a=0;if(c[554962]|0){a=0;return a|0}a=ka(41)|0;return a|0}function os(a){a=a|0;var b=0;b=c[742772]|0;if(b|0)zq(b);b=vq((bu(a)|0)+1|0)|0;c[742772]=b;ku(b,a)|0;ka(50)|0;return 0}function ps(a){a=a|0;ka(51)|0;ma(52,a|0,bu(a)|0)|0;return ka(53)|0}function qs(){if(c[742767]|0)return;c[742767]=1;ka(54)|0;return}function rs(){var b=0,d=0,e=0;if(ka(55)|0){Wv(1802912,0,131073)|0;ma(56,1802912,131072)|0;b=xq((bu(1802912)|0)+1|0)|0;ku(b,1802912)|0;d=b;return d|0}b=c[742772]|0;if(!b){e=xq(2)|0;a[e>>0]=0;d=e;return d|0}else{e=vq((bu(b)|0)+1|0)|0;ku(e,c[742772]|0)|0;d=e;return d|0}return 0}function ss(a){a=a|0;return 0}function ts(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=Ia;Ia=Ia+1296|0;f=e+1280|0;g=e+1024|0;h=e+512|0;i=e;Zo(b,0,h,i);c[f>>2]=h;c[f+4>>2]=i;wt(g,104363,f)|0;f=c[742773]|0;a:do if((f|0)>0){i=0;while(1){h=c[1934e3+(i<<2)>>2]|0;i=i+1|0;if(!(au(g,h+24|0)|0)){j=h;break a}if((i|0)>=(f|0)){j=0;break}}}else j=0;while(0);switch(a[d>>0]|0){case 114:{if(!j){k=0;Ia=e;return k|0}c[j+20>>2]=0;k=j;Ia=e;return k|0}case 119:{if(!j){d=Aq(0)|0;c[d+4>>2]=1;Rs(d+24|0,g)|0;g=c[742773]|0;c[1934e3+(g<<2)>>2]=d;c[742773]=g+1;k=d;Ia=e;return k|0}else{c[j+16>>2]=0;c[j+20>>2]=0;k=j;Ia=e;return k|0}break}default:{k=0;Ia=e;return k|0}}return 0}function us(a){a=a|0;var b=0,d=0,e=0;b=c[742773]|0;a:do if((b|0)>0){d=0;while(1){if((c[1934e3+(d<<2)>>2]|0)==(a|0)){e=1;break a}d=d+1|0;if((d|0)>=(b|0)){e=0;break}}}else e=0;while(0);return e|0}function vs(){var a=0,b=0,d=0;a=xq(48036)|0;Wv(a|0,0,48036)|0;c[a>>2]=vq(65538)|0;b=a+4|0;c[b>>2]=Sn(128,128,8)|0;c[a+12>>2]=Sn(128,64,8)|0;c[a+8>>2]=c[b>>2];b=a+16|0;d=0;do{c[b+(d*680|0)+8>>2]=(d|0)==0?1:16;d=d+1|0}while((d|0)!=64);d=a+43536|0;b=0;do{c[d+(b<<4)>>2]=65;c[d+(b<<4)+4>>2]=66;c[d+(b<<4)+8>>2]=67;c[d+(b<<4)+12>>2]=68;b=b+1|0}while((b|0)!=64);c[a+45868>>2]=Ms()|0;c[a+45872>>2]=Ms()|0;c[a+45876>>2]=Ms()|0;c[a+45880>>2]=Ms()|0;Wv(a+45884|0,-1,2144)|0;return a|0}function ws(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;if(!a)return;Tn(c[a+4>>2]|0)|0;Tn(c[a+12>>2]|0)|0;er(a);$q(a+16|0);$q(a+696|0);$q(a+1376|0);$q(a+2056|0);$q(a+2736|0);$q(a+3416|0);$q(a+4096|0);$q(a+4776|0);$q(a+5456|0);$q(a+6136|0);$q(a+6816|0);$q(a+7496|0);$q(a+8176|0);$q(a+8856|0);$q(a+9536|0);$q(a+10216|0);$q(a+10896|0);$q(a+11576|0);$q(a+12256|0);$q(a+12936|0);$q(a+13616|0);$q(a+14296|0);$q(a+14976|0);$q(a+15656|0);$q(a+16336|0);$q(a+17016|0);$q(a+17696|0);$q(a+18376|0);$q(a+19056|0);$q(a+19736|0);$q(a+20416|0);$q(a+21096|0);$q(a+21776|0);$q(a+22456|0);$q(a+23136|0);$q(a+23816|0);$q(a+24496|0);$q(a+25176|0);$q(a+25856|0);$q(a+26536|0);$q(a+27216|0);$q(a+27896|0);$q(a+28576|0);$q(a+29256|0);$q(a+29936|0);$q(a+30616|0);$q(a+31296|0);$q(a+31976|0);$q(a+32656|0);$q(a+33336|0);$q(a+34016|0);$q(a+34696|0);$q(a+35376|0);$q(a+36056|0);$q(a+36736|0);$q(a+37416|0);$q(a+38096|0);$q(a+38776|0);$q(a+39456Line truncated
|
||||||
|
function be(e,f,g,h,i,j){e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;k=Ia;Ia=Ia+16|0;l=k;m=k+8|0;if(!h)n=0;else{o=c[e+16>>2]|0;do if((h|0)<=0){if((h|0)>=-1000999){p=(c[e+8>>2]|0)+(h<<3)|0;break}if((h|0)==-1001e3){p=(c[e+12>>2]|0)+36|0;break}q=-1001e3-h|0;r=c[o>>2]|0;if((c[r+4>>2]|32|0)==54)p=2217396;else{s=c[r>>2]|0;p=(q|0)>(d[s+6>>0]|0)?2217396:s+16+(q+-1<<3)|0}}else{q=(c[o>>2]|0)+(h<<3)|0;p=q>>>0<(c[e+8>>2]|0)>>>0?q:2217396}while(0);n=p-(c[e+28>>2]|0)|0}p=e+8|0;h=(c[p>>2]|0)+(~f<<3)|0;c[m>>2]=h;f=h;if((j|0)!=0?(b[e+36>>1]|0)==0:0){o=c[e+16>>2]|0;c[o+28>>2]=j;c[o+24>>2]=i;c[o+20>>2]=f-(c[e+28>>2]|0);a[o+36>>0]=a[e+41>>0]|0;i=e+68|0;j=o+32|0;c[j>>2]=c[i>>2];c[i>>2]=n;q=o+18|0;a[q>>0]=a[q>>0]|16;o=e+38|0;s=(b[o>>1]|0)+1<<16>>16;b[o>>1]=s;if((s&65535)>199){if(s<<16>>16==200)Ac(e,47199,l);if((s&65535)>224)yc(e,6)}if(!(Ec(e,h,g)|0))Fc(e);b[o>>1]=(b[o>>1]|0)+-1<<16>>16;a[q>>0]=a[q>>0]&-17;c[i>>2]=c[j>>2];t=0}else{c[m+4>>2]=g;t=de(e,3,m,f-(c[e+28>>2]|0)|0,n)|0}if((g|0)!=-1){Ia=k;return t|0}g=(c[e+16>>2]|0)+4|0;e=c[p>>2]|0;if((c[g>>2]|0)>>>0>=e>>>0){Ia=k;return t|0}c[g>>2]=e;Ia=k;return t|0}function ce(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=Ia;Ia=Ia+16|0;f=e;g=c[d>>2]|0;h=c[d+4>>2]|0;d=a+38|0;i=(b[d>>1]|0)+1<<16>>16;b[d>>1]=i;if((i&65535)>199){if(i<<16>>16==200)Ac(a,47199,f);if((i&65535)>224)yc(a,6)}i=a+36|0;b[i>>1]=(b[i>>1]|0)+1<<16>>16;if(!(Ec(a,g,h)|0))Fc(a);b[i>>1]=(b[i>>1]|0)+-1<<16>>16;b[d>>1]=(b[d>>1]|0)+-1<<16>>16;Ia=e;return}function de(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;i=d+16|0;j=c[i>>2]|0;k=d+41|0;l=a[k>>0]|0;m=d+36|0;n=b[m>>1]|0;o=d+68|0;p=c[o>>2]|0;c[o>>2]=h;h=xc(d,e,f)|0;if(!h){c[o>>2]=p;return h|0}f=d+28|0;e=(c[f>>2]|0)+g|0;Sc(d,e);switch(h|0){case 4:{g=c[(c[d+12>>2]|0)+152>>2]|0;c[e>>2]=g;q=(a[g+4>>0]|64)&255;break}case 6:{g=bd(d,47901,23)|0;c[e>>2]=g;q=(a[g+4>>0]|64)&255;break}default:{g=c[d+8>>2]|0;c[e>>2]=c[g+-8>>2];q=c[g+-4>>2]|0}}c[e+4>>2]=q;q=e+8|0;c[d+8>>2]=q;c[i>>2]=j;a[k>>0]=l;b[m>>1]=n;if(!j)r=q;else{n=j;j=q;while(1){q=c[n+4>>2]|0;m=j>>>0<q>>>0?q:j;n=c[n+8>>2]|0;if(!n){r=m;break}else j=m}}j=r-(c[f>>2]|0)|0;f=j>>3;r=f+11+((f+1|0)/8|0)|0;f=(r|0)<1e6?r:1e6;if((j|0)>7999992){c[o>>2]=p;return h|0}if((f|0)>=(c[d+32>>2]|0)){c[o>>2]=p;return h|0}zc(d,f);c[o>>2]=p;return h|0}function ee(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0;i=Ia;Ia=Ia+32|0;j=i;c[j+16>>2]=b;c[j+8>>2]=e;c[j+12>>2]=f;c[j>>2]=0;c[j+4>>2]=0;f=fe(b,j,(g|0)==0?80062:g,h)|0;if(f|0){Ia=i;return f|0}h=c[(c[b+8>>2]|0)+-8>>2]|0;if((a[h+6>>0]|0)!=1){Ia=i;return f|0}g=b+12|0;b=c[(c[g>>2]|0)+36>>2]|0;a:do if((c[b+28>>2]|0)>>>0>1)k=(c[b+12>>2]|0)+8|0;else{j=(c[b+16>>2]|0)+((131072%((1<<d[b+7>>0])+-1|1|0)|0)*20|0)|0;while(1){if((c[j+12>>2]|0)==3?(c[j+8>>2]|0)==131072:0)break;e=c[j+16>>2]|0;if(!e){k=2217396;break a}else j=e}k=j}while(0);b=h+16|0;h=c[(c[b>>2]|0)+8>>2]|0;c[h>>2]=c[k>>2];e=k+4|0;c[h+4>>2]=c[e>>2];if(!(c[e>>2]&64)){Ia=i;return f|0}e=c[k>>2]|0;if(!(a[e+5>>0]&3)){Ia=i;return f|0}k=(c[b>>2]|0)+5|0;b=a[k>>0]|0;if(!(b&4)){Ia=i;return f|0}h=c[g>>2]|0;if((d[h+49>>0]|0)<2){Jc(h,e);Ia=i;return f|0}else{a[k>>0]=a[h+48>>0]&3|b&-72;Ia=i;return f|0}return 0}function fe(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;g=Ia;Ia=Ia+64|0;h=g;i=a+36|0;b[i>>1]=(b[i>>1]|0)+1<<16>>16;c[h>>2]=d;c[h+56>>2]=e;c[h+52>>2]=f;f=h+16|0;c[f>>2]=0;e=h+24|0;c[e>>2]=0;d=h+28|0;c[d>>2]=0;j=h+36|0;c[j>>2]=0;k=h+40|0;c[k>>2]=0;l=h+48|0;c[l>>2]=0;m=h+4|0;c[m>>2]=0;n=h+12|0;c[n>>2]=0;o=de(a,4,h,(c[a+8>>2]|0)-(c[a+28>>2]|0)|0,c[a+68>>2]|0)|0;h=c[m>>2]|0;p=c[n>>2]|0;q=a+12|0;a=c[q>>2]|0;r=Pa[c[a>>2]&3](c[a+4>>2]|0,h,p,0)|0;s=a+12|0;c[s>>2]=(c[s>>2]|0)+((h|0)==0?0:0-p|0);c[m>>2]=r;c[n>>2]=0;n=c[f>>2]|0;f=c[e>>2]<<1;e=c[q>>2]|0;Pa[c[e>>2]&3](c[e+4>>2]|0,n,f,0)|0;r=e+12|0;c[r>>2]=(c[r>>2]|0)+((n|0)==0?0:0-f|0);f=c[d>>2]|0;d=c[j>>2]<<4;j=c[q>>2]|0;Pa[c[j>>2]&3](c[j+4>>2]|0,f,d,0)|0;n=j+12|0;c[n>>2]=(c[n>>2]|0)+((f|0)==0?0:0-d|0);d=c[k>>2]|0;k=c[l>>2]<<4;l=c[q>>2]|0;Pa[c[l>>2]&3](c[l+4>>2]|0,d,k,0)|0;q=l+12|0;c[q>>2]=(c[q>>2]|0)+((d|0)==0?0:0-k|0);b[i>>1]=(b[i>>1]|0)+-1<<16>>16;Ia=g;return o|0}function ge(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;f=Ia;Ia=Ia+32|0;g=f+8|0;h=f;i=f+16|0;j=c[e>>2]|0;k=c[j>>2]|0;c[j>>2]=k+-1;if(!k){k=Oa[c[j+8>>2]&7](c[j+16>>2]|0,c[j+12>>2]|0,i)|0;l=c[i>>2]|0;if((k|0)==0|(l|0)==0)m=-1;else{c[j>>2]=l+-1;c[j+4>>2]=k+1;m=d[k>>0]|0}n=m}else{m=j+4|0;j=c[m>>2]|0;c[m>>2]=j+1;n=d[j>>0]|0}j=c[e+52>>2]|0;m=(j|0)==0;if((n|0)==27){if(!m?(nu(j,98)|0)==0:0){c[h>>2]=71880;c[h+4>>2]=j;wd(b,47925,h)|0;yc(b,3)}o=he(b,c[e>>2]|0,e+4|0,c[e+56>>2]|0)|0}else{if(!m?(nu(j,116)|0)==0:0){c[g>>2]=47967;c[g+4>>2]=j;wd(b,47925,g)|0;yc(b,3)}o=ie(b,c[e>>2]|0,e+4|0,e+16|0,c[e+56>>2]|0,n)|0}n=o+6|0;if(!(a[n>>0]|0)){Ia=f;return}e=b+12|0;g=o+16|0;j=o+5|0;o=0;while(1){m=c[e>>2]|0;h=m+4|0;k=Pa[c[m>>2]&3](c[h>>2]|0,0,10,20)|0;if(!k){if(!(a[m+51>>0]|0)){p=20;break}Kc(b,1);l=Pa[c[m>>2]&3](c[h>>2]|0,0,10,20)|0;if(!l){p=2Line truncated
|
||||||
|
function Oe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0;af(a,b,d);e=(c[b>>2]|0)==10;f=b+8|0;do if(e?(g=c[b+4>>2]|0,(g|0)!=-1):0){h=c[f>>2]|0;if((h|0)==-1){c[f>>2]=g;i=g;break}j=c[(c[a>>2]|0)+12>>2]|0;k=h;while(1){l=j+(k<<2)|0;m=c[l>>2]|0;h=(m>>>14)+-131071|0;n=(h|0)==-1?-1:k+1+h|0;if((n|0)==-1)break;else k=n}j=g+~k|0;if((((j|0)>-1?j:0-j|0)|0)>131071)re(c[a+12>>2]|0,47972);else{c[l>>2]=(j<<14)+2147467264|m&16383;o=10;break}}else o=10;while(0);if((o|0)==10)i=c[f>>2]|0;m=b+12|0;l=c[m>>2]|0;if((i|0)==(l|0)){c[f>>2]=-1;c[m>>2]=-1;p=b+4|0;c[p>>2]=d;c[b>>2]=6;return}a:do if((i|0)==-1)o=19;else{j=c[(c[a>>2]|0)+12>>2]|0;n=i;while(1){h=j+(n<<2)|0;if((n|0)>0?(q=c[h+-4>>2]|0,((q&63)+-37|0)>>>0<5):0)r=q;else r=c[h>>2]|0;if((r&63|0)!=41){o=26;break a}q=((c[h>>2]|0)>>>14)+-131071|0;n=(q|0)==-1?-1:n+1+q|0;if((n|0)==-1){o=19;break}}}while(0);b:do if((o|0)==19)if((l|0)==-1){s=-1;t=-1}else{r=c[(c[a>>2]|0)+12>>2]|0;i=l;while(1){n=r+(i<<2)|0;if((i|0)>0?(j=c[n+-4>>2]|0,((j&63)+-37|0)>>>0<5):0)u=j;else u=c[n>>2]|0;if((u&63|0)!=41){o=26;break b}j=((c[n>>2]|0)>>>14)+-131071|0;i=(j|0)==-1?-1:i+1+j|0;if((i|0)==-1){s=-1;t=-1;break}}}while(0);do if((o|0)==26){u=a+28|0;do if(!e){l=c[u>>2]|0;c[u>>2]=-1;i=oe(a,2147450916)|0;if((l|0)!=-1)if((i|0)!=-1){r=c[(c[a>>2]|0)+12>>2]|0;j=i;while(1){v=r+(j<<2)|0;w=c[v>>2]|0;n=(w>>>14)+-131071|0;k=(n|0)==-1?-1:j+1+n|0;if((k|0)==-1)break;else j=k}r=l+~j|0;if((((r|0)>-1?r:0-r|0)|0)>131071)re(c[a+12>>2]|0,47972);else{c[v>>2]=(r<<14)+2147467264|w&16383;x=i;break}}else x=l;else x=i}else x=-1;while(0);r=a+20|0;k=a+24|0;c[k>>2]=c[r>>2];n=d<<6;g=oe(a,n|16387)|0;c[k>>2]=c[r>>2];q=oe(a,n|8388611)|0;c[k>>2]=c[r>>2];if((x|0)!=-1){r=c[u>>2]|0;if((r|0)==-1){c[u>>2]=x;s=g;t=q;break}k=c[(c[a>>2]|0)+12>>2]|0;n=r;while(1){y=k+(n<<2)|0;z=c[y>>2]|0;r=(z>>>14)+-131071|0;h=(r|0)==-1?-1:n+1+r|0;if((h|0)==-1)break;else n=h}k=x+~n|0;if((((k|0)>-1?k:0-k|0)|0)>131071)re(c[a+12>>2]|0,47972);else{c[y>>2]=(k<<14)+2147467264|z&16383;s=g;t=q;break}}else{s=g;t=q}}while(0);z=c[a+20>>2]|0;c[a+24>>2]=z;y=c[m>>2]|0;c:do if((y|0)!=-1){x=c[(c[a>>2]|0)+12>>2]|0;w=d<<6;v=w&16320;if((d|0)==255){e=y;while(1){k=x+(e<<2)|0;u=c[k>>2]|0;h=(u>>>14)+-131071|0;r=e;e=(h|0)==-1?-1:e+1+h|0;if((r|0)>0?(h=k+-4|0,A=c[h>>2]|0,((A&63)+-37|0)>>>0<5):0){B=A;C=h}else{B=u;C=k}if((B&63|0)!=41){h=s+~r|0;if((((h|0)>-1?h:0-h|0)|0)>131071){o=65;break}else{D=u;E=h}}else{c[C>>2]=B&8372224|B>>>23<<6|40;h=z+~r|0;if((((h|0)>-1?h:0-h|0)|0)>131071){o=62;break}D=c[k>>2]|0;E=h}c[k>>2]=D&16383|(E<<14)+2147467264;if((e|0)==-1)break c}if((o|0)==62){F=a+12|0;G=c[F>>2]|0;re(G,47972)}else if((o|0)==65){H=a+12|0;I=c[H>>2]|0;re(I,47972)}}e=y;while(1){q=x+(e<<2)|0;g=c[q>>2]|0;n=(g>>>14)+-131071|0;k=e;e=(n|0)==-1?-1:e+1+n|0;if((k|0)>0?(n=q+-4|0,h=c[n>>2]|0,((h&63)+-37|0)>>>0<5):0){J=h;K=n}else{J=g;K=q}if((J&63|0)!=41){n=s+~k|0;if((((n|0)>-1?n:0-n|0)|0)>131071){o=65;break}else{L=g;M=n}}else{if((J>>>23|0)==(d|0))N=J&8372224|w|40;else N=J&-16321|v;c[K>>2]=N;n=z+~k|0;if((((n|0)>-1?n:0-n|0)|0)>131071){o=62;break}L=c[q>>2]|0;M=n}c[q>>2]=L&16383|(M<<14)+2147467264;if((e|0)==-1)break c}if((o|0)==62){F=a+12|0;G=c[F>>2]|0;re(G,47972)}else if((o|0)==65){H=a+12|0;I=c[H>>2]|0;re(I,47972)}}while(0);I=c[f>>2]|0;if((I|0)==-1){c[f>>2]=-1;c[m>>2]=-1;p=b+4|0;c[p>>2]=d;c[b>>2]=6;return}H=c[(c[a>>2]|0)+12>>2]|0;G=d<<6;F=G&16320;if((d|0)==255){M=I;while(1){L=H+(M<<2)|0;N=c[L>>2]|0;K=(N>>>14)+-131071|0;J=M;M=(K|0)==-1?-1:M+1+K|0;if((J|0)>0?(K=L+-4|0,s=c[K>>2]|0,((s&63)+-37|0)>>>0<5):0){O=s;P=K}else{O=N;P=L}if((O&63|0)!=41){K=t+~J|0;if((((K|0)>-1?K:0-K|0)|0)>131071){o=90;break}else{Q=N;R=K}}else{c[P>>2]=O&8372224|O>>>23<<6|40;K=z+~J|0;if((((K|0)>-1?K:0-K|0)|0)>131071){o=87;break}Q=c[L>>2]|0;R=K}c[L>>2]=Q&16383|(R<<14)+2147467264;if((M|0)==-1){o=92;break}}if((o|0)==87){S=a+12|0;T=c[S>>2]|0;re(T,47972)}else if((o|0)==90){U=a+12|0;V=c[U>>2]|0;re(V,47972)}else if((o|0)==92){c[f>>2]=-1;c[m>>2]=-1;p=b+4|0;c[p>>2]=d;c[b>>2]=6;return}}M=I;while(1){I=H+(M<<2)|0;R=c[I>>2]|0;Q=(R>>>14)+-131071|0;O=M;M=(Q|0)==-1?-1:M+1+Q|0;if((O|0)>0?(Q=I+-4|0,P=c[Q>>2]|0,((P&63)+-37|0)>>>0<5):0){W=P;X=Q}else{W=R;X=I}if((W&63|0)!=41){Q=t+~O|0;if((((Q|0)>-1?Q:0-Q|0)|0)>131071){o=90;break}else{Y=R;Z=Q}}else{if((W>>>23|0)==(d|0))_=W&8372224|G|40;else _=W&-16321|F;c[X>>2]=_;Q=z+~O|0;if((((Q|0)>-1?Q:0-Q|0)|0)>131071){o=87;break}Y=c[I>>2]|0;Z=Q}c[I>>2]=Y&16383|(Z<<14)+2147467264;if((M|0)==-1){o=92;break}}if((o|0)==87){S=a+12|0;T=c[S>>2]|0;re(T,47972)}else if((o|0)==90){U=a+12|0;V=c[U>>2]|0;re(V,47972)}else if((o|0)==92){c[f>>2]=-1;c[m>>2]=-1;p=b+4|0;c[p>>2]=d;c[b>>2]=6;return}}function Pe(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;h=e-f|0;f=c[g>>2]|0;switch(f|0){case 13:case 12:{e=h+1|0;i=(e|0)>0?e:0;switch(f|0){case 12:{f=(c[(c[b>>2]|0)+12>>2]|0)+(c[g+4>>2]<<2)|0;c[f>>2]=c[f>>2]&-8372225|(i<<14)+16384&8372224;break}case 13:{f=c[b>>2]|Line truncated
|
||||||
|
function Fc(e){e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0;f=Ia;Ia=Ia+64|0;g=f+40|0;h=f+32|0;i=f+24|0;j=f+16|0;k=f+8|0;l=f;m=f+48|0;n=e+16|0;o=e+36|0;p=e+116|0;q=e+12|0;r=e+8|0;s=e+38|0;t=e+24|0;u=e+32|0;v=e+28|0;w=m+4|0;x=c[n>>2]|0;a:while(1){y=c[c[x>>2]>>2]|0;z=y+12|0;A=c[(c[z>>2]|0)+8>>2]|0;B=x+24|0;C=x+28|0;D=x+4|0;E=x+4|0;F=x+4|0;G=x+4|0;H=x+4|0;I=x+4|0;J=x+4|0;K=c[x+24>>2]|0;b:while(1){L=c[C>>2]|0;c[C>>2]=L+4;M=c[L>>2]|0;L=c[554353]|0;N=c[8722]|0;do if((L|c[554354]|0)>(N|0)){if(!((L|0)>(N|0)|(b[o>>1]|0)==0)){c[554354]=0;O=K;break}c[p>>2]=1;P=c[n>>2]|0;Q=P+18|0;R=d[Q>>0]|0;if(!(R&128)){S=7;break a}a[Q>>0]=R&127;O=c[B>>2]|0}else O=K;while(0);c[554353]=L+2;N=M>>>6&255;T=O+(N<<3)|0;c:do switch(M&63){case 44:{S=231;break b;break}case 0:{c[554353]=L+1;R=M>>>23;c[T>>2]=c[O+(R<<3)>>2];c[O+(N<<3)+4>>2]=c[O+(R<<3)+4>>2];U=O;break}case 1:{c[554353]=L+1;R=M>>>14;c[T>>2]=c[A+(R<<3)>>2];c[O+(N<<3)+4>>2]=c[A+(R<<3)+4>>2];U=O;break}case 2:{R=c[C>>2]|0;c[C>>2]=R+4;V=(c[R>>2]|0)>>>6;c[T>>2]=c[A+(V<<3)>>2];c[O+(N<<3)+4>>2]=c[A+(V<<3)+4>>2];U=O;break}case 3:{c[T>>2]=M>>>23;c[O+(N<<3)+4>>2]=1;if(!(M&8372224))U=O;else{c[C>>2]=(c[C>>2]|0)+4;U=O}break}case 4:{V=M>>>23;R=T;while(1){c[R+4>>2]=0;if(!V){U=O;break}else{V=V+-1|0;R=R+8|0}}break}case 5:{R=c[(c[y+16+(M>>>23<<2)>>2]|0)+8>>2]|0;c[T>>2]=c[R>>2];c[O+(N<<3)+4>>2]=c[R+4>>2];U=O;break}case 6:{R=M>>>14;Hc(e,c[(c[y+16+(M>>>23<<2)>>2]|0)+8>>2]|0,(M&4194304|0)==0?O+((R&511)<<3)|0:A+((R&255)<<3)|0,T);U=c[B>>2]|0;break}case 7:{R=M>>>14;Hc(e,O+(M>>>23<<3)|0,(M&4194304|0)==0?O+((R&511)<<3)|0:A+((R&255)<<3)|0,T);U=c[B>>2]|0;break}case 8:{R=M>>>23;V=M>>>14;Ic(e,c[(c[y+16+(N<<2)>>2]|0)+8>>2]|0,(M|0)<0?A+((R&255)<<3)|0:O+(R<<3)|0,(M&4194304|0)==0?O+((V&511)<<3)|0:A+((V&255)<<3)|0);U=c[B>>2]|0;break}case 9:{V=c[y+16+(M>>>23<<2)>>2]|0;R=c[V+8>>2]|0;c[R>>2]=c[T>>2];W=O+(N<<3)+4|0;c[R+4>>2]=c[W>>2];if(((c[W>>2]&64|0)!=0?(W=c[T>>2]|0,(a[W+5>>0]&3)!=0):0)?(R=V+5|0,V=a[R>>0]|0,(V&4)!=0):0){X=c[q>>2]|0;if((d[X+49>>0]|0)<2){Jc(X,W);U=O;break c}else{a[R>>0]=a[X+48>>0]&3|V&-72;U=O;break c}}else U=O;break}case 10:{V=M>>>23;X=M>>>14;Ic(e,T,(M|0)<0?A+((V&255)<<3)|0:O+(V<<3)|0,(M&4194304|0)==0?O+((X&511)<<3)|0:A+((X&255)<<3)|0);U=c[B>>2]|0;break}case 11:{X=M>>>23;V=M>>>14;R=V&511;W=c[q>>2]|0;Y=W+4|0;Z=Pa[c[W>>2]&3](c[Y>>2]|0,0,5,32)|0;if(!Z){if(!(a[W+51>>0]|0)){S=31;break a}Kc(e,1);_=Pa[c[W>>2]&3](c[Y>>2]|0,0,5,32)|0;if(!_){S=31;break a}else $=_}else $=Z;Z=W+12|0;c[Z>>2]=(c[Z>>2]|0)+32;Z=W+56|0;a[$+5>>0]=a[W+48>>0]&3;a[$+4>>0]=5;c[$>>2]=c[Z>>2];c[Z>>2]=$;c[$+8>>2]=0;a[$+6>>0]=-1;Z=$+12|0;c[Z>>2]=0;W=$+28|0;c[W>>2]=0;_=$+16|0;c[_>>2]=2217420;Y=$+7|0;a[Y>>0]=0;aa=$+20|0;c[aa>>2]=2217420;c[T>>2]=$;c[O+(N<<3)+4>>2]=69;if(R|X|0){ba=M>>>26&31;ca=(ba|0)==0?X:(X&7|8)<<ba+-1;ba=M>>>17&31;X=(ba|0)==0?R:(V&7|8)<<ba+-1;ba=c[W>>2]|0;V=a[Y>>0]|0;R=V&255;da=c[_>>2]|0;if((ba|0)<(ca|0)){if((ca+1|0)>>>0>536870911){S=35;break a}ea=c[Z>>2]|0;fa=ba<<3;ba=ca<<3;ga=c[q>>2]|0;ha=(ea|0)==0;ia=ga+4|0;ja=Pa[c[ga>>2]&3](c[ia>>2]|0,ea,fa,ba)|0;if((ba|0)!=0&(ja|0)==0){if(!(a[ga+51>>0]|0)){S=39;break a}Kc(e,1);ka=Pa[c[ga>>2]&3](c[ia>>2]|0,ea,fa,ba)|0;if(!ka){S=39;break a}else la=ka}else la=ja;ja=ga+12|0;c[ja>>2]=(ha?0:0-fa|0)+ba+(c[ja>>2]|0);c[Z>>2]=la;Z=c[W>>2]|0;if((Z|0)<(ca|0)){ja=Z;do{c[la+(ja<<3)+4>>2]=0;ja=ja+1|0}while((ja|0)!=(ca|0))}c[W>>2]=ca}if(!X){c[_>>2]=2217420;ma=2217420;na=0;oa=0}else{ja=X+-1|0;if(ja>>>0>255){Z=0;ba=ja;while(1){fa=Z+8|0;ha=ba>>>8;if(ba>>>0>65535){Z=fa;ba=ha}else{pa=fa;qa=ha;break}}}else{pa=0;qa=ja}ba=pa+(d[400+qa>>0]|0)|0;if((ba|0)>30){S=50;break a}Z=1<<ba;if((Z+1|0)>>>0>214748364){S=52;break a}X=20<<ba;ca=c[q>>2]|0;W=ca+4|0;ha=Pa[c[ca>>2]&3](c[W>>2]|0,0,0,X)|0;if(ba>>>0<30&(ha|0)==0){if(!(a[ca+51>>0]|0)){S=56;break a}Kc(e,1);fa=Pa[c[ca>>2]&3](c[W>>2]|0,0,0,X)|0;if(!fa){S=56;break a}else ra=fa}else ra=ha;ha=ca+12|0;c[ha>>2]=(c[ha>>2]|0)+X;c[_>>2]=ra;X=ra;ha=0;do{c[X+(ha*20|0)+16>>2]=0;c[X+(ha*20|0)+12>>2]=0;c[X+(ha*20|0)+4>>2]=0;ha=ha+1|0;X=c[_>>2]|0}while((ha|0)<(Z|0));ma=X;na=ba&255;oa=Z}a[Y>>0]=na;c[aa>>2]=ma+(oa*20|0);if(V<<24>>24!=31){ha=1<<R;do{_=ha;ha=ha+-1|0;ja=da+(ha*20|0)+4|0;if(c[ja>>2]|0){ca=da+(ha*20|0)+8|0;fa=Mc($,ca)|0;if((fa|0)==2217396)sa=Nc(e,$,ca)|0;else sa=fa;c[sa>>2]=c[da+(ha*20|0)>>2];c[sa+4>>2]=c[ja>>2]}}while((_|0)>1)}if((da|0)!=2217420){ha=20<<R;V=c[q>>2]|0;Pa[c[V>>2]&3](c[V+4>>2]|0,da,ha,0)|0;aa=V+12|0;c[aa>>2]=(c[aa>>2]|0)-((da|0)==0?0:ha)}}ha=c[q>>2]|0;aa=ha+12|0;V=c[aa>>2]|0;if((V|0)>0){c[r>>2]=T+8;if(!(a[ha+51>>0]|0)){Y=ha+8|0;c[Y>>2]=V+1600+(c[Y>>2]|0);c[aa>>2]=-1600}else Oc(e);c[r>>2]=c[I>>2]}U=c[B>>2]|0;break}case 12:{aa=M>>>23;Y=O+(aa<<3)|0;V=T+8|0;c[V>>2]=c[Y>>2];c[V+4>Line truncated
|
||||||
|
function oq(b,e,f,g,h,i){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0,kb=0,lb=0,mb=0,nb=0,ob=0,pb=0,qb=0,rb=0,sb=0,tb=0,ub=0,vb=0,wb=0,xb=0,yb=0,zb=0,Ab=0,Bb=0,Cb=0,Db=0,Eb=0,Fb=0,Gb=0,Hb=0,Ib=0,Jb=0,Kb=0,Lb=0,Mb=0,Nb=0,Ob=0,Pb=0,Qb=0,Rb=0,Sb=0,Tb=0,Ub=0,Vb=0,Wb=0,Xb=0,Yb=0,Zb=0,_b=0,$b=0,ac=0,bc=0,cc=0,dc=0,ec=0,fc=0,gc=0,hc=0,ic=0,jc=0,kc=0,lc=0,mc=0,nc=0,oc=0,pc=0,qc=0,rc=0,sc=0,tc=0,uc=0,vc=0,wc=0,xc=0,yc=0,zc=0,Ac=0,Bc=0,Cc=0,Dc=0,Ec=0,Fc=0,Gc=0,Hc=0,Ic=0,Jc=0,Kc=0,Lc=0,Mc=0,Nc=0,Oc=0,Pc=0,Qc=0,Rc=0,Sc=0,Tc=0,Uc=0,Vc=0,Wc=0,Xc=0,Yc=0,Zc=0,_c=0,$c=0,ad=0,bd=0,cd=0,dd=0,ed=0,fd=0,gd=0,hd=0,id=0,jd=0,kd=0,ld=0,md=0,nd=0,od=0,pd=0,qd=0,rd=0,sd=0,td=0,ud=0,vd=0,wd=0,xd=0,yd=0,zd=0,Ad=0,Bd=0,Cd=0,Dd=0,Ed=0,Fd=0,Gd=0,Hd=0,Id=0,Jd=0,Kd=0,Ld=0,Md=0,Nd=0,Od=0,Pd=0,Qd=0,Rd=0,Sd=0,Td=0,Ud=0,Vd=0,Wd=0,Xd=0,Yd=0,Zd=0,_d=0,$d=0,ae=0;j=Ia;Ia=Ia+192|0;k=j+176|0;l=j+20|0;m=j+8|0;n=j+4|0;o=j;c[n>>2]=0;c[o>>2]=0;c[e>>2]=0;c[f>>2]=0;p=b+216|0;c[p>>2]=0;Vv(l|0,b+28|0,156)|0;c[l>>2]=h;c[l+4>>2]=i;a:do if(c[b+12>>2]|0){q=B(i,h)|0;b:do switch(c[b+184>>2]|0){case 6:{r=(q|0)!=0;if((c[b+188>>2]|0)==8){if(!r)break b;s=0;while(1){if((a[g+(s<<2|3)>>0]|0)!=-1)break a;s=s+1|0;if(s>>>0>=q>>>0)break b}}if(r){s=0;do{t=s<<3;if((a[g+(t|6)>>0]|0)!=-1)break a;s=s+1|0;if((a[g+(t|7)>>0]|0)!=-1)break a}while(s>>>0<q>>>0)}break}case 4:{s=(q|0)!=0;if((c[b+188>>2]|0)==8){if(!s)break b;r=0;while(1){if((a[g+(r<<1|1)>>0]|0)!=-1)break a;r=r+1|0;if(r>>>0>=q>>>0)break b}}if(s){r=0;do{t=r<<2;if((a[g+(t|2)>>0]|0)!=-1)break a;r=r+1|0;if((a[g+(t|3)>>0]|0)!=-1)break a}while(r>>>0<q>>>0)}break}case 3:{r=c[b+192>>2]|0;s=c[b+196>>2]|0;if(s|0){t=0;do{if((a[r+(t<<2|3)>>0]|0)!=-1)break a;t=t+1|0}while(t>>>0<s>>>0)}break}default:break a}while(0);q=l+20|0;switch(c[q>>2]|0){case 6:{c[q>>2]=2;break a;break}case 4:{c[q>>2]=0;break a;break}default:break a}}while(0);if((c[b+8>>2]|0)>>>0>32768){c[p>>2]=60;Ia=j;return}if((c[b>>2]|0)>>>0>2){c[p>>2]=61;Ia=j;return}if((c[b+44>>2]|0)>>>0>1){c[p>>2]=71;Ia=j;return}q=l+20|0;s=c[q>>2]|0;t=l+24|0;r=c[t>>2]|0;switch(s|0){case 0:{switch(r|0){case 1:case 2:case 4:case 8:case 16:break;default:{u=37;v=42}}break}case 2:{switch(r|0){case 8:case 16:break;default:{u=37;v=42}}break}case 3:{switch(r|0){case 1:case 2:case 4:case 8:break;default:{u=37;v=42}}break}case 4:{switch(r|0){case 8:case 16:break;default:{u=37;v=42}}break}case 6:{switch(r|0){case 8:case 16:break;default:{u=37;v=42}}break}default:{u=31;v=42}}if((v|0)==42){c[p>>2]=u;Ia=j;return}c[p>>2]=0;u=b+184|0;w=c[u>>2]|0;x=c[b+188>>2]|0;switch(w|0){case 0:{switch(x|0){case 1:case 2:case 4:case 8:case 16:break;default:{y=37;v=49}}break}case 2:{switch(x|0){case 8:case 16:break;default:{y=37;v=49}}break}case 3:{switch(x|0){case 1:case 2:case 4:case 8:break;default:{y=37;v=49}}break}case 4:{switch(x|0){case 8:case 16:break;default:{y=37;v=49}}break}case 6:{switch(x|0){case 8:case 16:break;default:{y=37;v=49}}break}default:{y=31;v=49}}if((v|0)==49){c[p>>2]=y;Ia=j;return}c[p>>2]=0;do if((w|0)==(s|0)&(x|0)==(r|0))pq(n,o,g,l);else{y=B(i,h)|0;switch(s|0){case 3:case 0:{z=-1;v=55;break}case 2:{A=3;v=54;break}case 4:break;case 6:{A=4;v=54;break}default:{z=0;v=55}}if((v|0)==54){C=((B(B(r,y)|0,A)|0)+7|0)>>>3;v=56}else if((v|0)==55)switch(s|0){case 2:case 6:{C=((B(z&r,y)|0)+7|0)>>>3;v=56;break}default:{}}if((v|0)==56?(r|0)==8:0){y=xq(C)|0;if(!((C|0)!=0&(y|0)==0)){if((c[p>>2]|0)==0?(D=hq(y,g,q,u,h,i)|0,c[p>>2]=D,(D|0)==0):0)pq(n,o,y,l)}else c[p>>2]=9955;zq(y);break}c[p>>2]=59;Ia=j;return}while(0);c[m>>2]=0;u=m+8|0;c[u>>2]=0;g=m+4|0;c[g>>2]=0;c:do if(!(c[p>>2]|0)){C=yq(0,2)|0;if(!C){E=0;F=0}else{c[u>>2]=2;c[m>>2]=C;c[g>>2]=1;a[C>>0]=-119;E=c[g>>2]|0;F=c[u>>2]|0}C=E+1|0;if(F>>>0<C>>>0){r=C<<1;z=yq(c[m>>2]|0,r)|0;if(!z){G=F;H=E;I=C}else{c[u>>2]=r;c[m>>2]=z;J=z;v=72}}else{J=c[m>>2]|0;v=72}if((v|0)==72){c[g>>2]=C;a[J+E>>0]=80;C=c[g>>2]|0;G=c[u>>2]|0;H=C;I=C+1|0}if(G>>>0<I>>>0){C=I<<1;z=yq(c[m>>2]|0,C)|0;if(!z){K=G;L=H;M=I}else{c[u>>2]=C;c[m>>2]=z;N=z;v=77}}else{N=c[m>>2]|0;v=77}if((v|0)==77){c[g>>2]=I;a[N+H>>0]=78;z=c[g>>2]|0;K=c[u>>2]|0;L=z;M=z+1|0}if(K>>>0<M>>>0){z=M<<1;C=yq(c[m>>2]|0,z)|0;if(!C){O=K;P=L;Q=M}else{c[u>>2]=z;c[m>>2]=C;R=C;v=82}}else{R=c[m>>2]|0;v=82}if((v|0)==82){c[g>>2]=M;a[R+L>>0]=71;C=c[g>>2]|0;O=c[u>>2]|0;P=C;Q=C+1|0}if(O>>>0<Q>>>0){C=Q<<1;z=yq(c[m>>2]|0,C)|0;if(!z){S=O;T=P;U=Q}else{c[u>>2]=C;c[m>>2]=z;V=z;v=87}}else{V=c[m>>2]|0;v=87}if((v|0)==87){c[g>>2]=Q;a[V+P>>0]=13;z=c[g>>2]|0;S=c[u>>2]|0;T=z;U=z+1|0}if(S>>>0<U>>>0){z=U<<1;C=yq(c[m>>2]|0,z)|0;if(!C){W=S;X=T;Y=U}else{c[u>>2]=z;c[m>>2]=C;Z=C;v=92}}elseLine truncated
|
||||||
|
function Bo(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0;if((d|0)==0|(e|0)==0){j=g;return j|0}k=c[e+16>>2]|0;l=(k&255|0)==0;m=l?0:32;n=l?256:96;if(h&8){o=a[d>>0]|0;if(!(o<<24>>24)){p=1;q=0}else{r=o;o=0;s=d;while(1){t=r<<24>>24;if((m|0)>(t|0))u=o;else u=o+1+(c[c[(c[e>>2]|0)+(t-m<<2)>>2]>>2]|0)|0;s=s+1|0;r=a[s>>0]|0;if(!(r<<24>>24)){p=1;q=u;break}else o=u}}u=q-p|0;p=c[b+32>>2]|0;q=b+28|0;if((u|0)>(p-f|0)){c[q>>2]=(c[q>>2]|0)+15;v=1;w=p-u|0}else{v=0;w=f}}else{v=0;w=f}if(!(h&2))x=w;else{u=a[d>>0]|0;if(!(u<<24>>24)){y=1;z=0}else{p=u;u=0;q=d;while(1){o=p<<24>>24;if((m|0)>(o|0))A=u;else A=u+1+(c[c[(c[e>>2]|0)+(o-m<<2)>>2]>>2]|0)|0;q=q+1|0;p=a[q>>0]|0;if(!(p<<24>>24)){y=1;z=A;break}else u=A}}x=w-((z-y|0)/2|0)|0}if(!(h&4))B=x;else{y=a[d>>0]|0;if(!(y<<24>>24)){C=1;D=0}else{z=y;y=0;w=d;while(1){A=z<<24>>24;if((m|0)>(A|0))E=y;else E=y+1+(c[c[(c[e>>2]|0)+(A-m<<2)>>2]>>2]|0)|0;w=w+1|0;z=a[w>>0]|0;if(!(z<<24>>24)){C=1;D=E;break}else y=E}}B=C+x-D|0}a:do if(!(h&1)){D=c[e>>2]|0;x=c[b+8>>2]|0;C=h;E=0;while(1){if((c[(c[D+(E<<2)>>2]|0)+8>>2]|0)==(x|0)){F=C;G=E;H=0;break a}y=E+n|0;z=(y|0)<(k|0);w=C|(z^1)&1;A=z?y:E;if(!(w&1)){C=w;E=A}else{F=w;G=A;H=1;break}}}else{F=h;G=0;H=1}while(0);h=a[d>>0]|0;if(h<<24>>24){k=l?256:128;l=G-m|0;G=(F&16|0)==0;F=b+32|0;if(H){H=h;n=0;E=d;C=B;x=g;while(1){D=H&255;if(m>>>0<=D>>>0&k>>>0>D>>>0){A=c[(c[e>>2]|0)+(l+D<<2)>>2]|0;D=A+4|0;co(A,b,0,0,C,x,c[A>>2]|0,c[D>>2]|0,i,0);w=1+(c[A>>2]|0)|0;A=c[D>>2]|0;I=a[E>>0]|0;J=w;K=(n|0)>(A|0)?n:A;L=w+C|0}else{I=H;J=0;K=n;L=C}if(I<<24>>24!=10)if(!G?(L|0)>((c[F>>2]|0)-J|0):0)M=37;else{N=K;O=L;P=x}else M=37;if((M|0)==37){M=0;N=0;O=f;P=K+x+1|0}E=E+1|0;H=a[E>>0]|0;if(!(H<<24>>24)){Q=P;break}else{n=N;C=O;x=P}}}else{P=h;h=0;x=d;d=B;B=g;while(1){O=P&255;if(m>>>0<=O>>>0&k>>>0>O>>>0){C=c[(c[e>>2]|0)+(l+O<<2)>>2]|0;O=C+4|0;Rn(C,b,0,0,d,B,c[C>>2]|0,c[O>>2]|0);N=1+(c[C>>2]|0)|0;C=c[O>>2]|0;R=a[x>>0]|0;S=N;T=(h|0)>(C|0)?h:C;U=N+d|0}else{R=P;S=0;T=h;U=d}if(R<<24>>24!=10)if(!G?(U|0)>((c[F>>2]|0)-S|0):0)M=44;else{V=T;W=U;X=B}else M=44;if((M|0)==44){M=0;V=0;W=f;X=T+B+1|0}x=x+1|0;P=a[x>>0]|0;if(!(P<<24>>24)){Q=X;break}else{h=V;d=W;B=X}}}}else Q=g;if(!v){j=Q;return j|0}else{j=b+28|0;v=(c[j>>2]|0)+-15|0;c[j>>2]=v;Bo(b,96845,c[557113]|0,v,Q,0,0)|0;return Q|0}return 0}function Co(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;Bo(a,b,c,d,e,0,0)|0;return}function Do(a){a=a|0;c[557115]=a;return}function Eo(a){a=a|0;c[557116]=a;return}function Fo(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;switch(c[e>>2]|0){case 0:{f=tv(a,b,d,c[e+8>>2]|0)|0;return f|0}case 1:{g=B(d,b)|0;b=e+20|0;d=c[b>>2]|0;h=(c[e+16>>2]|0)-d|0;i=(g|0)<(h|0)?g:h;h=(i|0)>0?i:0;Vv(a|0,(c[e+12>>2]|0)+d|0,h|0)|0;c[b>>2]=h+(c[b>>2]|0);f=h;return f|0}default:{f=0;return f|0}}return 0}function Go(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;e=Ia;Ia=Ia+16|0;f=e;c[f>>2]=b;switch(c[d>>2]|0){case 0:{g=d+20|0;c[g>>2]=(c[g>>2]|0)+1;g=d+16|0;c[g>>2]=(c[g>>2]|0)+1;hv(f,4,1,c[d+8>>2]|0)|0;Ia=e;return}case 1:{f=d+20|0;if(c[d+88>>2]|0)Bq(d,(c[f>>2]|0)+4|0)|0;g=(c[d+12>>2]|0)+(c[f>>2]|0)|0;a[g>>0]=b;a[g+1>>0]=b>>8;a[g+2>>0]=b>>16;a[g+3>>0]=b>>24;b=(c[f>>2]|0)+4|0;c[f>>2]=b;f=d+16|0;d=c[f>>2]|0;c[f>>2]=(d|0)>(b|0)?d:b;Ia=e;return}default:{Ia=e;return}}}function Ho(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;switch(c[e>>2]|0){case 0:{f=e+20|0;c[f>>2]=(c[f>>2]|0)+d;f=e+16|0;c[f>>2]=(c[f>>2]|0)+d;g=hv(a,b,d,c[e+8>>2]|0)|0;return g|0}case 1:{f=B(d,b)|0;do if(c[e+88>>2]|0){b=e+20|0;Bq(e,(c[b>>2]|0)+f|0)|0;d=(c[e+12>>2]|0)+(c[b>>2]|0)|0;if(!a){wq(d,0,f);h=b;break}else{Vv(d|0,a|0,f|0)|0;h=b;break}}else{b=e+20|0;Vv((c[e+12>>2]|0)+(c[b>>2]|0)|0,a|0,f|0)|0;h=b}while(0);a=(c[h>>2]|0)+f|0;c[h>>2]=a;h=e+16|0;e=c[h>>2]|0;c[h>>2]=(e|0)>(a|0)?e:a;g=f;return g|0}default:{g=0;return g|0}}return 0}function Io(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;e=Ia;Ia=Ia+16|0;f=e;c[f>>2]=b;switch(c[d>>2]|0){case 0:{g=d+20|0;c[g>>2]=(c[g>>2]|0)+1;g=d+16|0;c[g>>2]=(c[g>>2]|0)+1;hv(f,4,1,c[d+8>>2]|0)|0;Ia=e;return}case 1:{f=d+20|0;if(c[d+88>>2]|0)Bq(d,(c[f>>2]|0)+4|0)|0;g=(c[d+12>>2]|0)+(c[f>>2]|0)|0;a[g>>0]=b;a[g+1>>0]=b>>8;a[g+2>>0]=b>>16;a[g+3>>0]=b>>24;b=(c[f>>2]|0)+4|0;c[f>>2]=b;f=d+16|0;d=c[f>>2]|0;c[f>>2]=(d|0)>(b|0)?d:b;Ia=e;return}default:{Ia=e;return}}}function Jo(b,d){b=b|0;d=d|0;var e=0;switch(c[d>>2]|0){case 0:{e=d+20|0;c[e>>2]=(c[e>>2]|0)+1;e=d+16|0;c[e>>2]=(c[e>>2]|0)+1;nv(b<<24>>24,c[d+8>>2]|0)|0;return}case 1:{e=d+20|0;if(c[d+88>>2]|0)Bq(d,(c[e>>2]|0)+1|0)|0;a[(c[d+12>>2]|0)+(c[e>>2]|0)>>0]=b;b=(c[e>>2]|0)+1|0;c[e>>2]=b;e=d+16|0;d=c[e>>2]|0;c[e>>2]=(d|0)>(b|0)?d:b;return}default:return}}function Ko(d,e){d=d|0;e=e|0;var f=0,g=0,h=0;f=Ia;Ia=Ia+16|0;g=f;b[g>>1]=d;switch(c[e>>2]|0){case 0:{h=e+20|0;c[h>>2]=(c[h>>2]|0)+1;h=e+16|0;c[h>>2]=(c[h>>2]|0)+1;hv(g,2,1,c[e+8>>2]|0)|0;Ia=f;return}case 1:{g=e+20|0;if(c[e+88>>2]|0)Bq(e,(c[g>>2]|0)+2|0)|0;h=(c[e+12>>2]|0)+(c[g>>2]|0)|0;a[h>>0]=d;a[h+1>>0]=d>>8;Line truncated
|
||||||
|
function Vp(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0,kb=0,lb=0,mb=0,nb=0,ob=0,pb=0,qb=0,rb=0,sb=0,tb=0,ub=0,vb=0,wb=0,xb=0,yb=0,zb=0,Ab=0,Bb=0,Cb=0,Db=0,Eb=0,Fb=0,Gb=0,Hb=0,Ib=0,Jb=0,Kb=0,Lb=0,Mb=0,Nb=0,Ob=0,Pb=0,Qb=0,Rb=0,Sb=0,Tb=0,Ub=0,Vb=0,Wb=0,Xb=0,Yb=0,Zb=0,_b=0,$b=0,ac=0,bc=0,cc=0,dc=0,ec=0,fc=0,gc=0,hc=0,ic=0,jc=0,kc=0,lc=0,mc=0,nc=0,oc=0,pc=0,qc=0,rc=0,sc=0,tc=0,uc=0,vc=0,wc=0,xc=0,yc=0,zc=0,Ac=0,Bc=0,Cc=0,Dc=0,Ec=0,Fc=0,Gc=0,Hc=0,Ic=0,Jc=0,Kc=0,Lc=0,Mc=0,Nc=0,Oc=0,Pc=0,Qc=0,Rc=0,Sc=0,Tc=0,Uc=0,Vc=0,Wc=0,Xc=0,Yc=0,Zc=0,_c=0,$c=0,ad=0,bd=0,cd=0,dd=0,ed=0,fd=0,gd=0,hd=0,id=0,jd=0,kd=0,ld=0,md=0,nd=0,od=0,pd=0,qd=0,rd=0,sd=0,td=0,ud=0,vd=0,wd=0,xd=0,yd=0,zd=0,Ad=0,Bd=0,Cd=0,Dd=0,Ed=0,Fd=0,Gd=0,Hd=0,Id=0,Jd=0,Kd=0,Ld=0,Md=0,Nd=0,Od=0,Pd=0,Qd=0,Rd=0,Sd=0,Td=0,Ud=0,Vd=0,Wd=0,Xd=0,Yd=0,Zd=0,_d=0,$d=0,ae=0,be=0,ce=0,de=0,ee=0,fe=0,ge=0,he=0,ie=0,je=0,ke=0,le=0,me=0,ne=0,oe=0,pe=0,qe=0,re=0,se=0,te=0,ue=0,ve=0,we=0,xe=0,ye=0,ze=0,Ae=0,Be=0,Ce=0,De=0,Ee=0,Fe=0,Ge=0,He=0,Ie=0,Je=0,Ke=0,Le=0,Me=0,Ne=0,Oe=0,Pe=0,Qe=0,Re=0,Se=0,Te=0,Ue=0,Ve=0,We=0,Xe=0,Ye=0,Ze=0,_e=0,$e=0,af=0,bf=0,cf=0,df=0,ef=0,ff=0,gf=0,hf=0,jf=0,kf=0,lf=0,mf=0,nf=0,of=0,pf=0,qf=0,rf=0,sf=0,tf=0,uf=0,vf=0,wf=0,xf=0,yf=0,zf=0,Af=0,Bf=0,Cf=0,Df=0,Ef=0,Ff=0,Gf=0,Hf=0,If=0,Jf=0,Kf=0,Lf=0,Mf=0,Nf=0,Of=0,Pf=0,Qf=0,Rf=0,Sf=0,Tf=0,Uf=0,Vf=0,Wf=0,Xf=0,Yf=0,Zf=0,_f=0,$f=0,ag=0,bg=0,cg=0,dg=0,eg=0,fg=0,gg=0,hg=0,ig=0,jg=0,kg=0,lg=0,mg=0,ng=0,og=0,pg=0,qg=0,rg=0,sg=0,tg=0,ug=0,vg=0,wg=0,xg=0,yg=0,zg=0,Ag=0,Bg=0,Cg=0,Dg=0,Eg=0,Fg=0,Gg=0,Hg=0,Ig=0,Jg=0,Kg=0,Lg=0,Mg=0,Ng=0,Og=0,Pg=0,Qg=0,Rg=0,Sg=0,Tg=0,Ug=0,Vg=0,Wg=0,Xg=0,Yg=0,Zg=0,_g=0,$g=0,ah=0,bh=0,ch=0,dh=0,eh=0,fh=0,gh=0,hh=0,ih=0,jh=0,kh=0,lh=0,mh=0,nh=0,oh=0,ph=0,qh=0,rh=0,sh=0,th=0,uh=0,vh=0,wh=0,xh=0,yh=0,zh=0,Ah=0,Bh=0,Ch=0,Dh=0,Eh=0,Fh=0,Gh=0,Hh=0,Ih=0,Jh=0;h=Ia;Ia=Ia+192|0;i=h+136|0;j=h+92|0;k=h+48|0;l=h+4|0;m=h;switch(c[g>>2]|0){case 0:{n=f>>>16;o=b+4|0;p=b+8|0;q=0;r=0;while(1){s=(r|0)==(n|0);t=s&1;u=c[o>>2]|0;v=u+1|0;if((c[p>>2]|0)>>>0<v>>>0){w=v<<1;x=yq(c[b>>2]|0,w)|0;if(x|0){c[p>>2]=w;c[b>>2]=x;y=x;z=7}}else{y=c[b>>2]|0;z=7}if((z|0)==7){z=0;c[o>>2]=v;a[y+u>>0]=t}t=f-q|0;u=t>>>0<65535?t:65535;t=u^65535;v=u&255;x=c[o>>2]|0;w=x+1|0;if((c[p>>2]|0)>>>0<w>>>0){A=w<<1;B=yq(c[b>>2]|0,A)|0;if(B|0){c[p>>2]=A;c[b>>2]=B;C=B;z=12}}else{C=c[b>>2]|0;z=12}if((z|0)==12){z=0;c[o>>2]=w;a[C+x>>0]=v}v=u>>>8&255;u=c[o>>2]|0;x=u+1|0;if((c[p>>2]|0)>>>0<x>>>0){w=x<<1;B=yq(c[b>>2]|0,w)|0;if(B|0){c[p>>2]=w;c[b>>2]=B;D=B;z=17}}else{D=c[b>>2]|0;z=17}if((z|0)==17){z=0;c[o>>2]=x;a[D+u>>0]=v}v=t&255;u=c[o>>2]|0;x=u+1|0;if((c[p>>2]|0)>>>0<x>>>0){B=x<<1;w=yq(c[b>>2]|0,B)|0;if(w|0){c[p>>2]=B;c[b>>2]=w;E=w;z=22}}else{E=c[b>>2]|0;z=22}if((z|0)==22){z=0;c[o>>2]=x;a[E+u>>0]=v}v=t>>>8&255;t=c[o>>2]|0;u=t+1|0;if((c[p>>2]|0)>>>0<u>>>0){x=u<<1;w=yq(c[b>>2]|0,x)|0;if(w|0){c[p>>2]=x;c[b>>2]=w;F=w;z=27}}else{F=c[b>>2]|0;z=27}if((z|0)==27){z=0;c[o>>2]=u;a[F+t>>0]=v}if(q>>>0<f>>>0){v=q;t=0;while(1){u=v+1|0;w=a[e+v>>0]|0;x=c[o>>2]|0;B=x+1|0;if((c[p>>2]|0)>>>0<B>>>0){A=B<<1;G=yq(c[b>>2]|0,A)|0;if(G|0){c[p>>2]=A;c[b>>2]=G;H=G;z=34}}else{H=c[b>>2]|0;z=34}if((z|0)==34){z=0;c[o>>2]=B;a[H+x>>0]=w}t=t+1|0;if(!(t>>>0<65535&u>>>0<f>>>0)){I=u;break}else v=u}}else I=q;if(s){J=0;break}else{q=I;r=r+1|0}}Ia=h;return J|0}case 1:{c[k>>2]=0;K=i;L=K+36|0;do{c[K>>2]=0;K=K+4|0}while((K|0)<(L|0));K=j;L=K+36|0;do{c[K>>2]=0;K=K+4|0}while((K|0)<(L|0));Rp(i);Sp(j);r=b+4|0;I=c[r>>2]|0;q=I+1|0;H=b+8|0;if((c[H>>2]|0)>>>0<q>>>0){o=q<<1;p=yq(c[b>>2]|0,o)|0;if(!p)M=b;else{c[H>>2]=o;c[b>>2]=p;N=b;O=p;z=41}}else{N=b;O=c[b>>2]|0;z=41}if((z|0)==41){c[r>>2]=q;a[O+I>>0]=0;M=N}N=(c[M>>2]|0)+((c[r>>2]|0)+-1)|0;a[N>>0]=a[N>>0]|1;N=(c[M>>2]|0)+((c[r>>2]|0)+-1)|0;a[N>>0]=a[N>>0]|2;N=(c[g+4>>2]|0)==0;c[k>>2]=3;do if(N)if(!f)z=60;else{I=c[i+12>>2]|0;O=c[i+24>>2]|0;q=0;p=3;while(1){o=d[e+q>>0]|0;F=c[I+(o<<2)>>2]|0;E=c[O+(o<<2)>>2]|0;if(!E)P=p;else{o=E+-1|0;D=0;C=p;while(1){y=F>>>(o-D|0)&1;n=C&7;do if(!n){v=c[r>>2]|0;t=v+1|0;if((c[H>>2]|0)>>>0<t>>>0){u=t<<1;w=yq(c[M>>2]|0,u)|0;if(!w)break;c[H>>2]=u;c[M>>2]=w;Q=w}else Q=c[M>>2]|0;c[r>>2]=t;a[Q+v>>0]=0}while(0);v=(c[M>>2]|0)+((c[r>>2]|0)+-1)|0;a[v>>0]=y<<n|(d[v>>0]|0);D=D+1|0;if((D|0)==(E|0))break;else C=C+1|0}P=E+p|0}q=q+1|0;if((q|0)==(f|0))break;else p=P}c[k>>2]=P;z=60}else{c[l>>2]=0;p=l+8|0;c[p>>2]=0;q=l+4|0;c[q>>2]=0;O=Wp(l,e,f,c[g+8>>2]|0)|0;if(!O){Xp(k,b,l,i,j);c[p>>2]=0;c[q>>2]=0;zq(c[l>>2]|0);z=60;break}else{c[p>>2]=0;c[q>>2]=0;zq(c[l>>2]|0);R=c[i+12>>2]|0;S=c[i+24>>2]|0;T=O;break}}while(0);if((z|0)==60){P=c[i+12>>2]|0;Q=c[P+1024>>2]|0;N=cLine truncated
|
||||||
|
function yu(a,b,e,f,g,h){a=a|0;b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,C=0,D=0,E=0,F=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0.0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0.0,fb=0,gb=0.0,hb=0.0,ib=0.0,jb=0.0,kb=0.0,lb=0.0,mb=0.0,nb=0.0,ob=0.0,pb=0,qb=0.0;i=Ia;Ia=Ia+512|0;j=i;k=f+e|0;l=0-k|0;m=a+4|0;n=a+104|0;o=b;b=0;a:while(1){switch(o|0){case 46:{p=7;break a;break}case 48:break;default:{q=0;r=0;s=o;t=b;v=0;break a}}w=c[m>>2]|0;if(w>>>0<(c[n>>2]|0)>>>0){c[m>>2]=w+1;x=d[w>>0]|0}else x=Yt(a)|0;o=x;b=1}if((p|0)==7){x=c[m>>2]|0;if(x>>>0<(c[n>>2]|0)>>>0){c[m>>2]=x+1;y=d[x>>0]|0}else y=Yt(a)|0;if((y|0)==48){x=0;o=0;while(1){w=Hv(x|0,o|0,-1,-1)|0;z=G()|0;A=c[m>>2]|0;if(A>>>0<(c[n>>2]|0)>>>0){c[m>>2]=A+1;C=d[A>>0]|0}else C=Yt(a)|0;if((C|0)==48){x=w;o=z}else{q=w;r=z;s=C;t=1;v=1;break}}}else{q=0;r=0;s=y;t=b;v=1}}c[j>>2]=0;b=s+-48|0;y=(s|0)==46;b:do if(y|b>>>0<10){C=j+496|0;o=q;x=r;z=0;w=0;A=s;D=y;E=t;F=v;H=0;I=0;J=0;K=b;c:while(1){do if(D)if(!F){L=z;M=w;N=z;O=w;P=E;Q=1;R=H;S=I;T=J}else break c;else{U=Hv(z|0,w|0,1,0)|0;V=G()|0;W=(A|0)!=48;if((I|0)>=125){if(!W){L=o;M=x;N=U;O=V;P=E;Q=F;R=H;S=I;T=J;break}c[C>>2]=c[C>>2]|1;L=o;M=x;N=U;O=V;P=E;Q=F;R=H;S=I;T=J;break}X=j+(I<<2)|0;if(!H)Y=K;else Y=A+-48+((c[X>>2]|0)*10|0)|0;c[X>>2]=Y;X=H+1|0;Z=(X|0)==9;L=o;M=x;N=U;O=V;P=1;Q=F;R=Z?0:X;S=I+(Z&1)|0;T=W?U:J}while(0);U=c[m>>2]|0;if(U>>>0<(c[n>>2]|0)>>>0){c[m>>2]=U+1;_=d[U>>0]|0}else _=Yt(a)|0;K=_+-48|0;D=(_|0)==46;if(!(D|K>>>0<10)){$=N;aa=L;ba=O;ca=M;da=_;ea=P;fa=Q;ga=R;ha=S;ia=T;p=31;break b}else{o=L;x=M;z=N;w=O;A=_;E=P;F=Q;H=R;I=S;J=T}}ja=z;ka=w;la=o;ma=x;na=H;oa=I;pa=J;qa=(E|0)!=0;p=39}else{$=0;aa=q;ba=0;ca=r;da=s;ea=t;fa=v;ga=0;ha=0;ia=0;p=31}while(0);do if((p|0)==31){v=(fa|0)==0;t=v?$:aa;s=v?ba:ca;v=(ea|0)!=0;if(!(v&(da|32|0)==101))if((da|0)>-1){ja=$;ka=ba;la=t;ma=s;na=ga;oa=ha;pa=ia;qa=v;p=39;break}else{ra=$;sa=ba;ta=t;ua=s;va=ga;wa=ha;xa=ia;ya=v;p=41;break}v=zu(a,h)|0;r=G()|0;if((v|0)==0&(r|0)==-2147483648){if(!h){Wt(a,0,0);za=0.0;break}if(!(c[n>>2]|0)){Aa=0;Ba=0}else{c[m>>2]=(c[m>>2]|0)+-1;Aa=0;Ba=0}}else{Aa=v;Ba=r}r=Hv(Aa|0,Ba|0,t|0,s|0)|0;Ca=r;Da=$;Ea=G()|0;Fa=ba;Ga=ga;Ha=ha;Ja=ia;p=43}while(0);if((p|0)==39)if(c[n>>2]|0){c[m>>2]=(c[m>>2]|0)+-1;if(qa){Ca=la;Da=ja;Ea=ma;Fa=ka;Ga=na;Ha=oa;Ja=pa;p=43}else p=42}else{ra=ja;sa=ka;ta=la;ua=ma;va=na;wa=oa;xa=pa;ya=qa;p=41}if((p|0)==41)if(ya){Ca=ta;Da=ra;Ea=ua;Fa=sa;Ga=va;Ha=wa;Ja=xa;p=43}else p=42;do if((p|0)==42){c[(gt()|0)>>2]=22;Wt(a,0,0);za=0.0}else if((p|0)==43){xa=c[j>>2]|0;if(!xa){za=+(g|0)*0.0;break}if(((Fa|0)<0|(Fa|0)==0&Da>>>0<10)&((Ca|0)==(Da|0)&(Ea|0)==(Fa|0))?(e|0)>30|(xa>>>e|0)==0:0){za=+(g|0)*+(xa>>>0);break}xa=(f|0)/-2|0;wa=((xa|0)<0)<<31>>31;if((Ea|0)>(wa|0)|(Ea|0)==(wa|0)&Ca>>>0>xa>>>0){c[(gt()|0)>>2]=34;za=+(g|0)*1797693134862315708145274.0e284*1797693134862315708145274.0e284;break}xa=f+-106|0;wa=((xa|0)<0)<<31>>31;if((Ea|0)<(wa|0)|(Ea|0)==(wa|0)&Ca>>>0<xa>>>0){c[(gt()|0)>>2]=34;za=+(g|0)*2.2250738585072014e-308*2.2250738585072014e-308;break}if(!Ga)Ka=Ha;else{if((Ga|0)<9){xa=j+(Ha<<2)|0;wa=Ga;va=c[xa>>2]|0;while(1){va=va*10|0;if((wa|0)>=8)break;else wa=wa+1|0}c[xa>>2]=va}Ka=Ha+1|0}if((Ja|0)<9?(Ja|0)<=(Ca|0)&(Ca|0)<18:0){if((Ca|0)==9){za=+(g|0)*+((c[j>>2]|0)>>>0);break}if((Ca|0)<9){za=+(g|0)*+((c[j>>2]|0)>>>0)/+(c[34544+(8-Ca<<2)>>2]|0);break}wa=e+27+(B(Ca,-3)|0)|0;E=c[j>>2]|0;if((wa|0)>30|(E>>>wa|0)==0){za=+(g|0)*+(E>>>0)*+(c[34544+(Ca+-10<<2)>>2]|0);break}}E=(Ca|0)%9|0;if(!E){La=0;Ma=Ca;Na=Ka}else{wa=(Ca|0)>-1?E:E+9|0;E=c[34544+(8-wa<<2)>>2]|0;if(Ka){J=1e9/(E|0)|0;I=0;H=0;x=0;o=Ca;do{w=j+(x<<2)|0;z=c[w>>2]|0;sa=(z>>>0)/(E>>>0)|0;ua=z-(B(sa,E)|0)|0;z=sa+H|0;c[w>>2]=z;H=B(J,ua)|0;ua=(x|0)==(I|0)&(z|0)==0;o=ua?o+-9|0:o;I=ua?I+1&127:I;x=x+1|0}while((x|0)!=(Ka|0));if(!H){Oa=I;Pa=o;Qa=Ka}else{c[j+(Ka<<2)>>2]=H;Oa=I;Pa=o;Qa=Ka+1|0}}else{Oa=0;Pa=Ca;Qa=0}La=Oa;Ma=9-wa+Pa|0;Na=Qa}x=La;J=0;E=Ma;va=Na;d:while(1){xa=(E|0)<18;ua=(E|0)==18;z=j+(x<<2)|0;Ra=J;Sa=va;while(1){if(!xa){if(!ua){Ta=E;break d}if((c[z>>2]|0)>>>0>=9007199){Ta=18;break d}}w=0;sa=Sa+127|0;Ua=Sa;while(1){ra=sa&127;ta=j+(ra<<2)|0;ya=Rv(c[ta>>2]|0,0,29)|0;qa=Hv(ya|0,G()|0,w|0,0)|0;ya=G()|0;if(ya>>>0>0|(ya|0)==0&qa>>>0>1e9){pa=Ov(qa|0,ya|0,1e9,0)|0;oa=Nv(pa|0,G()|0,1e9,0)|0;na=Iv(qa|0,ya|0,oa|0,G()|0)|0;G()|0;Va=na;Wa=pa}else{Va=qa;Wa=0}c[ta>>2]=Va;ta=(ra|0)==(x|0);Xa=(ra|0)!=(Ua+127&127|0)|ta?Ua:(Va|0)==0?ra:Ua;if(ta)break;else{w=Wa;sa=ra+-1|0;Ua=Xa}}Ya=Ra+-29|0;if(!Wa){Ra=Ya;Sa=Ua}else break}z=x+127&127;ua=Xa+127&127;xa=j+((Xa+126&127)<<2)|0;if((z|0)==(Xa|0)){c[xa>>2]=c[xa>>2]|c[j+(ua<<2)>>2];Za=ua}else Za=Ua;c[j+(z<<2)>>2]=Wa;x=z;J=Ya;E=E+9|0;va=Za}va=x;E=Ra;J=Ta;wa=Sa;e:while(1){o=wa+1&127;I=j+((wa+127&127)<<2)|0;H=va;z=E;ua=J;while(1){xa=(ua|0)==18;sa=(Line truncated
|
||||||
|
|
||||||
|
// EMSCRIPTEN_END_FUNCS
|
||||||
|
var La=[hw,ct,bb,cb,Xf,_f,di,Yf,$f,ei,$h,fi,gi,hi,ii,cg,Wf,bg,ji,ki,li,mi,ni,oi,pi,qi,ri,si,ti,ui,vi,wi,xi,qg,pg,rg,sg,zi,Ai,Bi,Ci,Di,Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi,_i,$i,aj,bj,cj,dj,ej,fj,gj,hj,ij,jj,kj,lj,mj,nj,oj,pj,qj,rj,sj,tj,uj,vj,wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj,Kj,Lj,Mj,Nj,Oj,Pj,Qj,Rj,Sj,Tj,Uj,Vj,Wj,Xj,Yj,Zj,_j,$j,ak,bk,ck,dk,ek,Rf,Qf,Sf,Tf,Uf,Vf,ag,kg,fk,mg,ug,tg,ng,gk,hk,ik,jk,kk,lk,mk,nk,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw,hw];var Ma=[iw,At];var Na=[jw,Mf,Lm,Mm];var Oa=[kw,it,Vt,Hf,jt,dt,Uu,kw];var Pa=[lw,et,Yk,lw];var Qa=[mw,xk,Bk,mw];var Ra=[nw,Gn];var Sa=[ow,eb,Dm,Em,ls,ow,ow,ow];var Ta=[pw,nn,wc,ce,ge,Nf,gg,hg,Bt,pw,pw,pw,pw,pw,pw,pw];var Ua=[qw,db,ks,qw];var Va=[rw];return{___divdi3:Lv,___emscripten_environ_constructor:Cv,___errno_location:gt,___muldi3:Nv,___udivdi3:Ov,__get_daylight:Ev,__get_environ:Gv,__get_timezone:Fv,__get_tzname:Dv,_bitshift64Ashr:Pv,_bitshift64Lshr:Qv,_bitshift64Shl:Rv,_codo_mixer_callback:Iq,_free:Zs,_i64Add:Hv,_i64Subtract:Iv,_main:Jb,_malloc:Ys,_memcpy:Vv,_memset:Wv,_mix_0:Jr,_realloc:$s,_saveSetjmp:Sv,_sbrk:Xv,_setThrew:Uv,_testSetjmp:Tv,dynCall_ii:Yv,dynCall_iidiiii:Zv,dynCall_iii:_v,dynCall_iiii:$v,dynCall_iiiii:aw,dynCall_iiiiii:bw,dynCall_v:cw,dynCall_vi:dw,dynCall_vii:ew,dynCall_viii:fw,dynCall_viiiii:gw,establishStackSpace:Za,stackAlloc:Wa,stackRestore:Ya,stackSave:Xa}})
|
||||||
|
|
||||||
|
|
||||||
|
// EMSCRIPTEN_END_ASM
|
||||||
|
(asmGlobalArg,asmLibraryArg,buffer);var ___divdi3=Module["___divdi3"]=asm["___divdi3"];var ___emscripten_environ_constructor=Module["___emscripten_environ_constructor"]=asm["___emscripten_environ_constructor"];var ___errno_location=Module["___errno_location"]=asm["___errno_location"];var ___muldi3=Module["___muldi3"]=asm["___muldi3"];var ___udivdi3=Module["___udivdi3"]=asm["___udivdi3"];var __get_daylight=Module["__get_daylight"]=asm["__get_daylight"];var __get_environ=Module["__get_environ"]=asm["__get_environ"];var __get_timezone=Module["__get_timezone"]=asm["__get_timezone"];var __get_tzname=Module["__get_tzname"]=asm["__get_tzname"];var _bitshift64Ashr=Module["_bitshift64Ashr"]=asm["_bitshift64Ashr"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _codo_mixer_callback=Module["_codo_mixer_callback"]=asm["_codo_mixer_callback"];var _free=Module["_free"]=asm["_free"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var _main=Module["_main"]=asm["_main"];var _malloc=Module["_malloc"]=asm["_malloc"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var _memset=Module["_memset"]=asm["_memset"];var _mix_0=Module["_mix_0"]=asm["_mix_0"];var _realloc=Module["_realloc"]=asm["_realloc"];var _saveSetjmp=Module["_saveSetjmp"]=asm["_saveSetjmp"];var _sbrk=Module["_sbrk"]=asm["_sbrk"];var _setThrew=Module["_setThrew"]=asm["_setThrew"];var _testSetjmp=Module["_testSetjmp"]=asm["_testSetjmp"];var establishStackSpace=Module["establishStackSpace"]=asm["establishStackSpace"];var stackAlloc=Module["stackAlloc"]=asm["stackAlloc"];var stackRestore=Module["stackRestore"]=asm["stackRestore"];var stackSave=Module["stackSave"]=asm["stackSave"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_iidiiii=Module["dynCall_iidiiii"]=asm["dynCall_iidiiii"];var dynCall_iii=Module["dynCall_iii"]=asm["dynCall_iii"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_iiiii=Module["dynCall_iiiii"]=asm["dynCall_iiiii"];var dynCall_iiiiii=Module["dynCall_iiiiii"]=asm["dynCall_iiiiii"];var dynCall_v=Module["dynCall_v"]=asm["dynCall_v"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_vii=Module["dynCall_vii"]=asm["dynCall_vii"];var dynCall_viii=Module["dynCall_viii"]=asm["dynCall_viii"];var dynCall_viiiii=Module["dynCall_viiiii"]=asm["dynCall_viiiii"];Module["asm"]=asm;Module["ccall"]=ccall;Module["getValue"]=getValue;Module["getMemory"]=getMemory;Module["UTF8ToString"]=UTF8ToString;Module["stringToUTF8"]=stringToUTF8;Module["addRunDependency"]=addRunDependency;Module["removeRunDependency"]=removeRunDependency;Module["FS_createFolder"]=FS.createFolder;Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createLink"]=FS.createLink;Module["FS_createDevice"]=FS.createDevice;Module["FS_unlink"]=FS.unlink;if(memoryInitializer){if(!isDataURI(memoryInitializer)){memoryInitializer=locateFile(memoryInitializer)}if(ENVIRONMENT_IS_NODE||ENVIRONMENT_IS_SHELL){var data=Module["readBinary"](memoryInitializer);HEAPU8.set(data,GLOBAL_BASE)}else{addRunDependency("memory initializer");var applyMemoryInitializer=function(data){if(data.byteLength)data=new Uint8Array(data);HEAPU8.set(data,GLOBAL_BASE);if(Module["memoryInitializerRequest"])delete Module["memoryInitializerRequest"].response;removeRunDependency("memory initializer")};var doBrowserLoad=function(){Module["readAsync"](memoryInitializer,applyMemoryInitializer,function(){throw"could not load memory initializer "+memoryInitializer})};var memoryInitializerBytes=tryParseAsDataURI(memoryInitializer);if(memoryInitializerBytes){applyMemoryInitializer(memoryInitializerBytes.buffer)}else if(Module["memoryInitializerRequest"]){var useRequest=function(){var request=Module["memoryInitializerRequest"];var response=request.response;if(request.status!==200&&request.status!==0){var data=tryParseAsDataURI(Module["memoryInitializerRequestURL"]);if(data){response=data.buffer}else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+request.status+", retrying "+memoryInitializer);doBrowserLoad();return}}applyMemoryInitializer(response)};if(Module["memoryInitializerRequest"].response){setTimeout(useRequest,0)}else{Module["memoryInitializerRequest"].addEventListener("load",useRequest)}}else{doBrowserLoad()}}}function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var calledMain=false;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};Module["callMain"]=function callMain(args){args=args||[];ensureInitRuntime();var argc=args.length+1;vLine truncated
|
||||||
|
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>PICO-8 Player</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background: #000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
#canvas {
|
||||||
|
image-rendering: pixelated;
|
||||||
|
image-rendering: crisp-edges;
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
#p8_container {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="p8_container">
|
||||||
|
<canvas id="canvas"></canvas>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
// Cart will be injected here
|
||||||
|
window.PICO8_CART_DATA = null;
|
||||||
|
</script>
|
||||||
|
<script src="pico8_player.js"></script>
|
||||||
|
<script>
|
||||||
|
Module = {
|
||||||
|
arguments: ['-run'],
|
||||||
|
canvas: document.getElementById('canvas'),
|
||||||
|
preRun: [],
|
||||||
|
postRun: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// Wait for cart data to be set
|
||||||
|
if (window.PICO8_CART_DATA) {
|
||||||
|
// Create virtual file system entry
|
||||||
|
Module.preRun.push(function() {
|
||||||
|
FS.createDataFile('/', 'cart.p8', window.PICO8_CART_DATA, true, true, true);
|
||||||
|
});
|
||||||
|
Module.arguments.push('/cart.p8');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/**
|
||||||
|
* Downloads the latest PICO-8 Education Edition player JS from pico-8-edu.com.
|
||||||
|
* Run with: node scripts/ci/find-edu-js.js
|
||||||
|
*/
|
||||||
|
const https = require('https');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const INDEX_URL = 'https://www.pico-8-edu.com/';
|
||||||
|
const PUBLIC_DIR = path.join(__dirname, '../../public');
|
||||||
|
|
||||||
|
function fetchText(url) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
https.get(url, res => {
|
||||||
|
const chunks = [];
|
||||||
|
res.on('data', d => chunks.push(d));
|
||||||
|
res.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
|
||||||
|
}).on('error', reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchBinary(url) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
https.get(url, res => {
|
||||||
|
const chunks = [];
|
||||||
|
res.on('data', d => chunks.push(d));
|
||||||
|
res.on('end', () => resolve(Buffer.concat(chunks)));
|
||||||
|
}).on('error', reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
console.log('Fetching index to find current edu player version...');
|
||||||
|
const html = await fetchText(INDEX_URL);
|
||||||
|
|
||||||
|
const match = html.match(/['"]\/play\/(pico8_edu[^'"]+\.js)['"]/);
|
||||||
|
if (!match) {
|
||||||
|
console.error('Could not find edu player JS path in page HTML.');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const jsPath = match[1];
|
||||||
|
const jsUrl = `https://www.pico-8-edu.com/play/${jsPath}`;
|
||||||
|
const outFile = path.join(PUBLIC_DIR, 'pico8_edu.js');
|
||||||
|
|
||||||
|
console.log(`Found: ${jsPath}`);
|
||||||
|
console.log(`Downloading from ${jsUrl}...`);
|
||||||
|
|
||||||
|
const buf = await fetchBinary(jsUrl);
|
||||||
|
fs.writeFileSync(outFile, buf);
|
||||||
|
console.log(`Saved to public/pico8_edu.js (${buf.length} bytes)`);
|
||||||
|
}
|
||||||
|
|
||||||
|
main().catch(e => { console.error(e); process.exit(1); });
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
* @property {string} id Unique pin identifier scoped to the node.
|
* @property {string} id Unique pin identifier scoped to the node.
|
||||||
* @property {string} name Public display name.
|
* @property {string} name Public display name.
|
||||||
* @property {('input'|'output')} direction Pin direction relative to the node.
|
* @property {('input'|'output')} direction Pin direction relative to the node.
|
||||||
* @property {('exec'|'number'|'boolean'|'string'|'table'|'any')} kind Pin kind describing blueprint behavior.
|
* @property {('exec'|'number'|'boolean'|'string'|'table'|'any'|'color')} kind Pin kind describing blueprint behavior.
|
||||||
* @property {string} [description] Optional tooltip/description.
|
* @property {string} [description] Optional tooltip/description.
|
||||||
* @property {unknown} [defaultValue] Default value for data pins.
|
* @property {unknown} [defaultValue] Default value for data pins.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export class Connection {
|
|||||||
/**
|
/**
|
||||||
* @param {PinReference} from Origin pin (must be output).
|
* @param {PinReference} from Origin pin (must be output).
|
||||||
* @param {PinReference} to Target pin (must be input).
|
* @param {PinReference} to Target pin (must be input).
|
||||||
* @param {('exec'|'number'|'boolean'|'string'|'table'|'any')} kind Pin kind carried by the connection.
|
* @param {('exec'|'number'|'boolean'|'string'|'table'|'any'|'color')} kind Pin kind carried by the connection.
|
||||||
* @param {string} [id] Optional connection identifier.
|
* @param {string} [id] Optional connection identifier.
|
||||||
*/
|
*/
|
||||||
constructor(from, to, kind, id) {
|
constructor(from, to, kind, id) {
|
||||||
|
|||||||
+114
-99
@@ -1,3 +1,6 @@
|
|||||||
|
import { formatLiteral, defaultLiteralForKind } from './lua/LuaLiteralTypes.js';
|
||||||
|
import { normalizeVariableType, getTypeConverter } from '../types/TypeRegistry.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import('./NodeGraph.js').NodeGraph} NodeGraph
|
* @typedef {import('./NodeGraph.js').NodeGraph} NodeGraph
|
||||||
*/
|
*/
|
||||||
@@ -278,7 +281,7 @@ export class LuaGenerator {
|
|||||||
findExecTargets: (pinId) => this.#findExecTargets(node.id, pinId),
|
findExecTargets: (pinId) => this.#findExecTargets(node.id, pinId),
|
||||||
sanitizeIdentifier: (value) => this.#sanitizeIdentifier(String(value)),
|
sanitizeIdentifier: (value) => this.#sanitizeIdentifier(String(value)),
|
||||||
sanitizeOperator: (value) => this.#sanitizeOperator(String(value)),
|
sanitizeOperator: (value) => this.#sanitizeOperator(String(value)),
|
||||||
formatLiteral: (kind, value) => this.#formatLiteral(kind, value),
|
formatLiteral,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,7 +341,7 @@ export class LuaGenerator {
|
|||||||
this.#resolveValueInput(node, inputPinId, fallback),
|
this.#resolveValueInput(node, inputPinId, fallback),
|
||||||
sanitizeIdentifier: (value) => this.#sanitizeIdentifier(String(value)),
|
sanitizeIdentifier: (value) => this.#sanitizeIdentifier(String(value)),
|
||||||
sanitizeOperator: (value) => this.#sanitizeOperator(String(value)),
|
sanitizeOperator: (value) => this.#sanitizeOperator(String(value)),
|
||||||
formatLiteral: (kind, value) => this.#formatLiteral(kind, value),
|
formatLiteral,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,7 +519,7 @@ export class LuaGenerator {
|
|||||||
const argEntries = signature.map((entry) => {
|
const argEntries = signature.map((entry) => {
|
||||||
const fallback = entry.optional
|
const fallback = entry.optional
|
||||||
? "nil"
|
? "nil"
|
||||||
: this.#defaultLiteralForKind(entry.kind);
|
: defaultLiteralForKind(entry.kind);
|
||||||
const value = this.#resolveValueInput(
|
const value = this.#resolveValueInput(
|
||||||
node,
|
node,
|
||||||
entry.inputPinId,
|
entry.inputPinId,
|
||||||
@@ -602,6 +605,49 @@ export class LuaGenerator {
|
|||||||
.map((connection) => connection.to);
|
.map((connection) => connection.to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies Lua type conversion when source and target types differ.
|
||||||
|
*
|
||||||
|
* @param {string} expression Source expression to convert.
|
||||||
|
* @param {string} fromType Source type identifier.
|
||||||
|
* @param {string} toType Target type identifier.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
#applyTypeConversion(expression, fromType, toType) {
|
||||||
|
if (fromType === toType || toType === "any" || fromType === "any") {
|
||||||
|
return expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
const converter = getTypeConverter(fromType, toType);
|
||||||
|
if (!converter) {
|
||||||
|
return expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate Lua code for type conversions
|
||||||
|
if ((fromType === "number" || fromType === "color") && toType === "boolean") {
|
||||||
|
return `(${expression}) ~= 0`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fromType === "boolean" && toType === "number") {
|
||||||
|
return `((${expression}) and 1 or 0)`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fromType === "boolean" && toType === "color") {
|
||||||
|
return `((${expression}) and 7 or 0)`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fromType === "boolean" && toType === "string") {
|
||||||
|
return `((${expression}) and "true" or "false")`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fromType === "number" && toType === "color") {
|
||||||
|
return `flr(${expression}) % 16`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No conversion needed for color to number (colors are numbers in PICO-8)
|
||||||
|
return expression;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves the expression bound to an input pin.
|
* Resolves the expression bound to an input pin.
|
||||||
*
|
*
|
||||||
@@ -613,7 +659,17 @@ export class LuaGenerator {
|
|||||||
#resolveValueInput(node, pinId, fallback) {
|
#resolveValueInput(node, pinId, fallback) {
|
||||||
const connection = this.#getConnectionTo(node.id, pinId);
|
const connection = this.#getConnectionTo(node.id, pinId);
|
||||||
if (connection) {
|
if (connection) {
|
||||||
return this.#evaluateValue(connection.from.nodeId, connection.from.pinId);
|
const sourceExpression = this.#evaluateValue(connection.from.nodeId, connection.from.pinId);
|
||||||
|
const targetPin = this.#findPin(node, pinId);
|
||||||
|
const targetType = targetPin?.kind ?? "any";
|
||||||
|
|
||||||
|
// Get the actual source type, handling special cases like get_var
|
||||||
|
const sourceNode = this.nodes.get(connection.from.nodeId);
|
||||||
|
const sourceType = sourceNode
|
||||||
|
? this.#getOutputPinType(sourceNode, connection.from.pinId)
|
||||||
|
: connection.kind ?? "any";
|
||||||
|
|
||||||
|
return this.#applyTypeConversion(sourceExpression, sourceType, targetType);
|
||||||
}
|
}
|
||||||
|
|
||||||
const pin = this.#findPin(node, pinId);
|
const pin = this.#findPin(node, pinId);
|
||||||
@@ -621,12 +677,12 @@ export class LuaGenerator {
|
|||||||
if (Object.prototype.hasOwnProperty.call(node.properties, inlineKey)) {
|
if (Object.prototype.hasOwnProperty.call(node.properties, inlineKey)) {
|
||||||
const inlineValue = node.properties[inlineKey];
|
const inlineValue = node.properties[inlineKey];
|
||||||
if (inlineValue !== undefined && inlineValue !== null) {
|
if (inlineValue !== undefined && inlineValue !== null) {
|
||||||
return this.#formatLiteral(pin?.kind ?? "any", inlineValue);
|
return formatLiteral(pin?.kind ?? "any", inlineValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pin && pin.defaultValue !== undefined && pin.defaultValue !== null) {
|
if (pin && pin.defaultValue !== undefined && pin.defaultValue !== null) {
|
||||||
return this.#formatLiteral(pin.kind, pin.defaultValue);
|
return formatLiteral(pin.kind, pin.defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fallback;
|
return fallback;
|
||||||
@@ -691,24 +747,6 @@ export class LuaGenerator {
|
|||||||
|
|
||||||
if (expression === undefined) {
|
if (expression === undefined) {
|
||||||
switch (node.type) {
|
switch (node.type) {
|
||||||
case "number_literal":
|
|
||||||
expression = this.#formatLiteral(
|
|
||||||
"number",
|
|
||||||
node.properties.value ?? 0
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case "string_literal":
|
|
||||||
expression = this.#formatLiteral(
|
|
||||||
"string",
|
|
||||||
node.properties.value ?? ""
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case "boolean_literal":
|
|
||||||
expression = this.#formatLiteral(
|
|
||||||
"boolean",
|
|
||||||
node.properties.value ?? "true"
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case "get_var": {
|
case "get_var": {
|
||||||
const name = this.#resolveWorkspaceVariableName(node);
|
const name = this.#resolveWorkspaceVariableName(node);
|
||||||
expression = name;
|
expression = name;
|
||||||
@@ -721,18 +759,32 @@ export class LuaGenerator {
|
|||||||
expression = parameterName ?? "nil";
|
expression = parameterName ?? "nil";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "add_number": {
|
case "add_number":
|
||||||
|
case "math_add": {
|
||||||
const a = this.#resolveValueInput(node, "a", "0");
|
const a = this.#resolveValueInput(node, "a", "0");
|
||||||
const b = this.#resolveValueInput(node, "b", "0");
|
const b = this.#resolveValueInput(node, "b", "0");
|
||||||
expression = `(${a}) + (${b})`;
|
expression = `(${a}) + (${b})`;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "multiply_number": {
|
case "math_subtract": {
|
||||||
|
const a = this.#resolveValueInput(node, "a", "0");
|
||||||
|
const b = this.#resolveValueInput(node, "b", "0");
|
||||||
|
expression = `(${a}) - (${b})`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "multiply_number":
|
||||||
|
case "math_multiply": {
|
||||||
const a = this.#resolveValueInput(node, "a", "1");
|
const a = this.#resolveValueInput(node, "a", "1");
|
||||||
const b = this.#resolveValueInput(node, "b", "1");
|
const b = this.#resolveValueInput(node, "b", "1");
|
||||||
expression = `(${a}) * (${b})`;
|
expression = `(${a}) * (${b})`;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "math_divide": {
|
||||||
|
const a = this.#resolveValueInput(node, "a", "0");
|
||||||
|
const b = this.#resolveValueInput(node, "b", "1");
|
||||||
|
expression = `(${a}) / (${b})`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "compare": {
|
case "compare": {
|
||||||
const a = this.#resolveValueInput(node, "a", "0");
|
const a = this.#resolveValueInput(node, "a", "0");
|
||||||
const b = this.#resolveValueInput(node, "b", "0");
|
const b = this.#resolveValueInput(node, "b", "0");
|
||||||
@@ -788,60 +840,6 @@ export class LuaGenerator {
|
|||||||
return "==";
|
return "==";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Formats a literal based on pin kind.
|
|
||||||
*
|
|
||||||
* @param {string} kind Pin kind.
|
|
||||||
* @param {unknown} value Raw value.
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
#formatLiteral(kind, value) {
|
|
||||||
switch (kind) {
|
|
||||||
case "number": {
|
|
||||||
const numeric = Number(value);
|
|
||||||
return Number.isFinite(numeric) ? String(numeric) : "0";
|
|
||||||
}
|
|
||||||
case "boolean": {
|
|
||||||
if (typeof value === "string") {
|
|
||||||
return value === "false" ? "false" : "true";
|
|
||||||
}
|
|
||||||
return value ? "true" : "false";
|
|
||||||
}
|
|
||||||
case "table": {
|
|
||||||
if (typeof value === "string") {
|
|
||||||
const trimmed = value.trim();
|
|
||||||
return trimmed.length ? trimmed : "{}";
|
|
||||||
}
|
|
||||||
return "{}";
|
|
||||||
}
|
|
||||||
case "string":
|
|
||||||
return JSON.stringify(String(value ?? ""));
|
|
||||||
default:
|
|
||||||
return JSON.stringify(String(value ?? ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides a default literal for the supplied pin kind.
|
|
||||||
*
|
|
||||||
* @param {string} kind Pin kind reference.
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
#defaultLiteralForKind(kind) {
|
|
||||||
switch (kind) {
|
|
||||||
case "number":
|
|
||||||
return "0";
|
|
||||||
case "boolean":
|
|
||||||
return "false";
|
|
||||||
case "string":
|
|
||||||
return '""';
|
|
||||||
case "table":
|
|
||||||
return "{}";
|
|
||||||
default:
|
|
||||||
return "nil";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the display name for a custom event node.
|
* Determines the display name for a custom event node.
|
||||||
*
|
*
|
||||||
@@ -1012,14 +1010,11 @@ export class LuaGenerator {
|
|||||||
const value = variable?.defaultValue;
|
const value = variable?.defaultValue;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "number": {
|
case "number":
|
||||||
const numeric = Number(value);
|
|
||||||
return Number.isFinite(numeric) ? String(numeric) : "0";
|
|
||||||
}
|
|
||||||
case "boolean":
|
case "boolean":
|
||||||
return value ? "true" : "false";
|
|
||||||
case "string":
|
case "string":
|
||||||
return JSON.stringify(String(value ?? ""));
|
case "color":
|
||||||
|
return formatLiteral(type, value);
|
||||||
case "table": {
|
case "table": {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
const fragments = value
|
const fragments = value
|
||||||
@@ -1137,6 +1132,38 @@ export class LuaGenerator {
|
|||||||
return this.#sanitizeIdentifier(fallback);
|
return this.#sanitizeIdentifier(fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type of a workspace variable by its ID.
|
||||||
|
*
|
||||||
|
* @param {string} variableId Variable identifier.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
#getVariableType(variableId) {
|
||||||
|
const variable = this.variables.find((v) => v.id === variableId);
|
||||||
|
return variable?.type ?? "any";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the output type for a node's output pin.
|
||||||
|
*
|
||||||
|
* @param {BlueprintNode} node Source node.
|
||||||
|
* @param {string} pinId Output pin identifier.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
#getOutputPinType(node, pinId) {
|
||||||
|
// For get_var nodes, return the actual variable type
|
||||||
|
if (node.type === "get_var") {
|
||||||
|
const variableId = node.properties?.variableId;
|
||||||
|
if (variableId) {
|
||||||
|
return this.#getVariableType(variableId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, use the pin's declared kind
|
||||||
|
const pin = this.#findPin(node, pinId);
|
||||||
|
return pin?.kind ?? "any";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes a variable type descriptor.
|
* Normalizes a variable type descriptor.
|
||||||
*
|
*
|
||||||
@@ -1144,19 +1171,7 @@ export class LuaGenerator {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
#normalizeVariableType(value) {
|
#normalizeVariableType(value) {
|
||||||
if (typeof value === "string") {
|
return normalizeVariableType(value);
|
||||||
const normalized = value.trim().toLowerCase();
|
|
||||||
switch (normalized) {
|
|
||||||
case "number":
|
|
||||||
case "string":
|
|
||||||
case "boolean":
|
|
||||||
case "table":
|
|
||||||
return normalized;
|
|
||||||
default:
|
|
||||||
return "any";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "any";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { BlueprintNode } from "./BlueprintNode.js";
|
import { BlueprintNode } from "./BlueprintNode.js";
|
||||||
import { Connection } from "./Connection.js";
|
import { Connection } from "./Connection.js";
|
||||||
|
import { areTypesCompatible } from "../types/TypeRegistry.js";
|
||||||
|
|
||||||
/** @typedef {import('./BlueprintNode.js').BlueprintNodeInit} BlueprintNodeInit */
|
/** @typedef {import('./BlueprintNode.js').BlueprintNodeInit} BlueprintNodeInit */
|
||||||
/** @typedef {import('./BlueprintNode.js').PinDescriptor} PinDescriptor */
|
/** @typedef {import('./BlueprintNode.js').PinDescriptor} PinDescriptor */
|
||||||
@@ -321,11 +322,7 @@ export class NodeGraph extends EventTarget {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (!areTypesCompatible(fromPin.kind, toPin.kind)) {
|
||||||
toPin.kind !== "any" &&
|
|
||||||
fromPin.kind !== "any" &&
|
|
||||||
fromPin.kind !== toPin.kind
|
|
||||||
) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,268 @@
|
|||||||
|
/**
|
||||||
|
* Manages PICO-8 sprite sheet data with 256 8x8 sprites.
|
||||||
|
* Total sheet size: 128x128 pixels, 16-color palette.
|
||||||
|
*/
|
||||||
|
export class SpriteSheet {
|
||||||
|
/**
|
||||||
|
* @param {Object} [options={}] Configuration options.
|
||||||
|
*/
|
||||||
|
constructor(options = {}) {
|
||||||
|
/** @type {Uint8Array} Pixel data (128x128, each byte is a palette index 0-15) */
|
||||||
|
this.pixels = new Uint8Array(128 * 128);
|
||||||
|
|
||||||
|
/** @type {Uint8Array} Sprite flags (256 sprites, 8 flags each) */
|
||||||
|
this.flags = new Uint8Array(256);
|
||||||
|
|
||||||
|
/** @type {Array<string>} PICO-8 default 16-color palette */
|
||||||
|
this.palette = [
|
||||||
|
"#000000", "#1D2B53", "#7E2553", "#008751",
|
||||||
|
"#AB5236", "#5F574F", "#C2C3C7", "#FFF1E8",
|
||||||
|
"#FF004D", "#FFA300", "#FFEC27", "#00E436",
|
||||||
|
"#29ADFF", "#83769C", "#FF77A8", "#FFCCAA"
|
||||||
|
];
|
||||||
|
|
||||||
|
this.#initialize(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes sprite sheet data.
|
||||||
|
*
|
||||||
|
* @param {Object} options Configuration options.
|
||||||
|
*/
|
||||||
|
#initialize(options) {
|
||||||
|
if (options.pixels instanceof Uint8Array && options.pixels.length === 128 * 128) {
|
||||||
|
this.pixels.set(options.pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.flags instanceof Uint8Array && options.flags.length === 256) {
|
||||||
|
this.flags.set(options.flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets pixel color at coordinates.
|
||||||
|
*
|
||||||
|
* @param {number} x X coordinate (0-127).
|
||||||
|
* @param {number} y Y coordinate (0-127).
|
||||||
|
* @returns {number} Palette index (0-15).
|
||||||
|
*/
|
||||||
|
getPixel(x, y) {
|
||||||
|
if (x < 0 || x >= 128 || y < 0 || y >= 128) return 0;
|
||||||
|
return this.pixels[y * 128 + x];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets pixel color at coordinates.
|
||||||
|
*
|
||||||
|
* @param {number} x X coordinate (0-127).
|
||||||
|
* @param {number} y Y coordinate (0-127).
|
||||||
|
* @param {number} color Palette index (0-15).
|
||||||
|
*/
|
||||||
|
setPixel(x, y, color) {
|
||||||
|
if (x < 0 || x >= 128 || y < 0 || y >= 128) return;
|
||||||
|
this.pixels[y * 128 + x] = Math.max(0, Math.min(15, color));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all pixels for a specific sprite.
|
||||||
|
*
|
||||||
|
* @param {number} spriteIndex Sprite number (0-255).
|
||||||
|
* @returns {Uint8Array} 8x8 pixel array.
|
||||||
|
*/
|
||||||
|
getSprite(spriteIndex) {
|
||||||
|
const spriteData = new Uint8Array(8 * 8);
|
||||||
|
const sx = (spriteIndex % 16) * 8;
|
||||||
|
const sy = Math.floor(spriteIndex / 16) * 8;
|
||||||
|
|
||||||
|
for (let y = 0; y < 8; y++) {
|
||||||
|
for (let x = 0; x < 8; x++) {
|
||||||
|
spriteData[y * 8 + x] = this.getPixel(sx + x, sy + y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return spriteData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets all pixels for a specific sprite.
|
||||||
|
*
|
||||||
|
* @param {number} spriteIndex Sprite number (0-255).
|
||||||
|
* @param {Uint8Array} data 8x8 pixel array.
|
||||||
|
*/
|
||||||
|
setSprite(spriteIndex, data) {
|
||||||
|
if (data.length !== 64) return;
|
||||||
|
|
||||||
|
const sx = (spriteIndex % 16) * 8;
|
||||||
|
const sy = Math.floor(spriteIndex / 16) * 8;
|
||||||
|
|
||||||
|
for (let y = 0; y < 8; y++) {
|
||||||
|
for (let x = 0; x < 8; x++) {
|
||||||
|
this.setPixel(sx + x, sy + y, data[y * 8 + x]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets flags for a sprite.
|
||||||
|
*
|
||||||
|
* @param {number} spriteIndex Sprite number (0-255).
|
||||||
|
* @returns {number} 8-bit flag value.
|
||||||
|
*/
|
||||||
|
getFlags(spriteIndex) {
|
||||||
|
if (spriteIndex < 0 || spriteIndex >= 256) return 0;
|
||||||
|
return this.flags[spriteIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets flags for a sprite.
|
||||||
|
*
|
||||||
|
* @param {number} spriteIndex Sprite number (0-255).
|
||||||
|
* @param {number} flagValue 8-bit flag value.
|
||||||
|
*/
|
||||||
|
setFlags(spriteIndex, flagValue) {
|
||||||
|
if (spriteIndex < 0 || spriteIndex >= 256) return;
|
||||||
|
this.flags[spriteIndex] = flagValue & 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a specific flag is set.
|
||||||
|
*
|
||||||
|
* @param {number} spriteIndex Sprite number (0-255).
|
||||||
|
* @param {number} flagBit Flag bit (0-7).
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
hasFlag(spriteIndex, flagBit) {
|
||||||
|
if (flagBit < 0 || flagBit > 7) return false;
|
||||||
|
return (this.getFlags(spriteIndex) & (1 << flagBit)) !== 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a specific flag.
|
||||||
|
*
|
||||||
|
* @param {number} spriteIndex Sprite number (0-255).
|
||||||
|
* @param {number} flagBit Flag bit (0-7).
|
||||||
|
* @param {boolean} value Flag state.
|
||||||
|
*/
|
||||||
|
setFlag(spriteIndex, flagBit, value) {
|
||||||
|
if (flagBit < 0 || flagBit > 7) return;
|
||||||
|
|
||||||
|
const currentFlags = this.getFlags(spriteIndex);
|
||||||
|
const mask = 1 << flagBit;
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
this.setFlags(spriteIndex, currentFlags | mask);
|
||||||
|
} else {
|
||||||
|
this.setFlags(spriteIndex, currentFlags & ~mask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears all sprite data.
|
||||||
|
*/
|
||||||
|
clear() {
|
||||||
|
this.pixels.fill(0);
|
||||||
|
this.flags.fill(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serializes sprite sheet to JSON.
|
||||||
|
*
|
||||||
|
* @returns {Object}
|
||||||
|
*/
|
||||||
|
toJSON() {
|
||||||
|
return {
|
||||||
|
pixels: Array.from(this.pixels),
|
||||||
|
flags: Array.from(this.flags)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates sprite sheet from JSON data.
|
||||||
|
*
|
||||||
|
* @param {Object} data Serialized sprite data.
|
||||||
|
* @returns {SpriteSheet}
|
||||||
|
*/
|
||||||
|
static fromJSON(data) {
|
||||||
|
return new SpriteSheet({
|
||||||
|
pixels: new Uint8Array(data.pixels || []),
|
||||||
|
flags: new Uint8Array(data.flags || [])
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports to PICO-8 .p8 format gfx section.
|
||||||
|
*
|
||||||
|
* @returns {string} Hex string for __gfx__ section.
|
||||||
|
*/
|
||||||
|
toP8Gfx() {
|
||||||
|
const lines = [];
|
||||||
|
|
||||||
|
for (let row = 0; row < 128; row++) {
|
||||||
|
let line = "";
|
||||||
|
for (let col = 0; col < 128; col += 2) {
|
||||||
|
const p1 = this.getPixel(col, row);
|
||||||
|
const p2 = this.getPixel(col + 1, row);
|
||||||
|
line += p1.toString(16) + p2.toString(16);
|
||||||
|
}
|
||||||
|
lines.push(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines.join("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Imports from PICO-8 .p8 format gfx section.
|
||||||
|
*
|
||||||
|
* @param {string} gfxData Hex string from __gfx__ section.
|
||||||
|
*/
|
||||||
|
fromP8Gfx(gfxData) {
|
||||||
|
const lines = gfxData.trim().split("\n");
|
||||||
|
|
||||||
|
for (let row = 0; row < 128 && row < lines.length; row++) {
|
||||||
|
const line = lines[row].trim();
|
||||||
|
for (let col = 0; col < 128; col += 2) {
|
||||||
|
const hexPair = line.substring(col, col + 2);
|
||||||
|
if (hexPair.length === 2) {
|
||||||
|
this.setPixel(col, row, parseInt(hexPair[0], 16));
|
||||||
|
this.setPixel(col + 1, row, parseInt(hexPair[1], 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports sprite flags to PICO-8 .p8 format.
|
||||||
|
*
|
||||||
|
* @returns {string} Hex string for __gff__ section.
|
||||||
|
*/
|
||||||
|
toP8Flags() {
|
||||||
|
const lines = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < 256; i += 2) {
|
||||||
|
const f1 = this.getFlags(i).toString(16).padStart(2, "0");
|
||||||
|
const f2 = this.getFlags(i + 1).toString(16).padStart(2, "0");
|
||||||
|
lines.push(f1 + f2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines.join("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Imports sprite flags from PICO-8 .p8 format.
|
||||||
|
*
|
||||||
|
* @param {string} flagData Hex string from __gff__ section.
|
||||||
|
*/
|
||||||
|
fromP8Flags(flagData) {
|
||||||
|
const lines = flagData.trim().split("\n");
|
||||||
|
|
||||||
|
for (let i = 0; i < 128 && i < lines.length; i++) {
|
||||||
|
const line = lines[i].trim();
|
||||||
|
if (line.length >= 2) {
|
||||||
|
this.setFlags(i * 2, parseInt(line.substring(0, 2), 16));
|
||||||
|
}
|
||||||
|
if (line.length >= 4) {
|
||||||
|
this.setFlags(i * 2 + 1, parseInt(line.substring(2, 4), 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
/**
|
||||||
|
* Represents a single tileset with 8x8 tiles (128x128px total, 16x16 grid).
|
||||||
|
*/
|
||||||
|
export class TileSet {
|
||||||
|
/**
|
||||||
|
* @param {Object} options Configuration options.
|
||||||
|
* @param {string} options.id Unique identifier.
|
||||||
|
* @param {string} options.name Display name.
|
||||||
|
* @param {string} options.filePath Path or URL to PNG file (file:// or blob:).
|
||||||
|
* @param {string} [options.nativePath] Native file system path (for Electron).
|
||||||
|
* @param {number} [options.tileWidth=8] Tile width in pixels.
|
||||||
|
* @param {number} [options.tileHeight=8] Tile height in pixels.
|
||||||
|
* @param {number} [options.columns=16] Number of tiles per row (128px / 8px = 16).
|
||||||
|
* @param {number} [options.rows=16] Number of tile rows (128px / 8px = 16).
|
||||||
|
*/
|
||||||
|
constructor(options) {
|
||||||
|
this.id = options.id || this.#generateId();
|
||||||
|
this.name = options.name || "Untitled Tileset";
|
||||||
|
this.filePath = options.filePath || "";
|
||||||
|
this.nativePath = options.nativePath || "";
|
||||||
|
this.tileWidth = options.tileWidth || 8;
|
||||||
|
this.tileHeight = options.tileHeight || 8;
|
||||||
|
this.columns = options.columns || 16;
|
||||||
|
this.rows = options.rows || 16;
|
||||||
|
|
||||||
|
/** @type {HTMLImageElement | null} */
|
||||||
|
this.image = null;
|
||||||
|
|
||||||
|
/** @type {boolean} */
|
||||||
|
this.isLoaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a unique identifier.
|
||||||
|
*
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
#generateId() {
|
||||||
|
return `tileset_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the total number of tiles.
|
||||||
|
*
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
getTileCount() {
|
||||||
|
return this.columns * this.rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the total width of the tileset image.
|
||||||
|
*
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
getWidth() {
|
||||||
|
return this.columns * this.tileWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the total height of the tileset image.
|
||||||
|
*
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
getHeight() {
|
||||||
|
return this.rows * this.tileHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the tileset image from file path.
|
||||||
|
*
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async load() {
|
||||||
|
if (!this.filePath) {
|
||||||
|
throw new Error("No file path specified");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const img = new Image();
|
||||||
|
|
||||||
|
img.onload = () => {
|
||||||
|
// Validate image is exactly 128x128px
|
||||||
|
if (img.width !== 128 || img.height !== 128) {
|
||||||
|
reject(new Error(`Tileset must be exactly 128x128px (found ${img.width}x${img.height}px)`));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.image = img;
|
||||||
|
this.isLoaded = true;
|
||||||
|
|
||||||
|
// Fixed grid: 16x16 tiles for 128x128 image with 8x8 tiles
|
||||||
|
this.columns = 16;
|
||||||
|
this.rows = 16;
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
|
||||||
|
img.onerror = () => {
|
||||||
|
reject(new Error(`Failed to load image: ${this.filePath}`));
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add cache-busting for file:// URLs to ensure reload works
|
||||||
|
const cacheBuster = this.filePath.startsWith("file://")
|
||||||
|
? `?t=${Date.now()}`
|
||||||
|
: "";
|
||||||
|
img.src = this.filePath + cacheBuster;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reloads the tileset image.
|
||||||
|
*
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async reload() {
|
||||||
|
this.isLoaded = false;
|
||||||
|
this.image = null;
|
||||||
|
return this.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets tile coordinates for a specific tile index.
|
||||||
|
*
|
||||||
|
* @param {number} tileIndex Tile index (0-based).
|
||||||
|
* @returns {{x: number, y: number, width: number, height: number}}
|
||||||
|
*/
|
||||||
|
getTileRect(tileIndex) {
|
||||||
|
const col = tileIndex % this.columns;
|
||||||
|
const row = Math.floor(tileIndex / this.columns);
|
||||||
|
|
||||||
|
return {
|
||||||
|
x: col * this.tileWidth,
|
||||||
|
y: row * this.tileHeight,
|
||||||
|
width: this.tileWidth,
|
||||||
|
height: this.tileHeight
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serializes tileset to JSON.
|
||||||
|
*
|
||||||
|
* @returns {Object}
|
||||||
|
*/
|
||||||
|
toJSON() {
|
||||||
|
return {
|
||||||
|
id: this.id,
|
||||||
|
name: this.name,
|
||||||
|
filePath: this.filePath,
|
||||||
|
nativePath: this.nativePath,
|
||||||
|
tileWidth: this.tileWidth,
|
||||||
|
tileHeight: this.tileHeight,
|
||||||
|
columns: this.columns,
|
||||||
|
rows: this.rows
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates tileset from JSON data.
|
||||||
|
*
|
||||||
|
* @param {Object} data Serialized tileset.
|
||||||
|
* @returns {TileSet}
|
||||||
|
*/
|
||||||
|
static fromJSON(data) {
|
||||||
|
return new TileSet(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('./LuaLiteralTypes.js').LuaLiteralHandler} LuaLiteralHandler
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {LuaLiteralHandler} */
|
||||||
|
export const LuaLiteralBoolean = {
|
||||||
|
/**
|
||||||
|
* @param {unknown} value
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
format(value) {
|
||||||
|
if (typeof value === "string") {
|
||||||
|
return value === "false" ? "false" : "true";
|
||||||
|
}
|
||||||
|
return value ? "true" : "false";
|
||||||
|
},
|
||||||
|
|
||||||
|
/** @returns {string} */
|
||||||
|
defaultLiteral() {
|
||||||
|
return "false";
|
||||||
|
},
|
||||||
|
|
||||||
|
spawnableByDefault: true,
|
||||||
|
|
||||||
|
nodeModule: {
|
||||||
|
definition: {
|
||||||
|
id: "boolean_literal",
|
||||||
|
title: "Boolean",
|
||||||
|
category: "Values",
|
||||||
|
description: "Constant boolean literal.",
|
||||||
|
searchTags: ["boolean", "literal", "true", "false"],
|
||||||
|
inputs: [],
|
||||||
|
outputs: [{ id: "value", name: "Value", direction: "output", kind: "boolean" }],
|
||||||
|
properties: [{ key: "value", label: "Value", type: "boolean", defaultValue: true }],
|
||||||
|
},
|
||||||
|
behavior: {
|
||||||
|
evaluateValue: ({ node, formatLiteral }) =>
|
||||||
|
formatLiteral("boolean", node.properties.value ?? true),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('./LuaLiteralTypes.js').LuaLiteralHandler} LuaLiteralHandler
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {LuaLiteralHandler} */
|
||||||
|
export const LuaLiteralColor = {
|
||||||
|
/**
|
||||||
|
* @param {unknown} value
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
format(value) {
|
||||||
|
const n = Math.max(0, Math.min(15, Math.floor(Number(value) || 0)));
|
||||||
|
return String(n);
|
||||||
|
},
|
||||||
|
|
||||||
|
/** @returns {string} */
|
||||||
|
defaultLiteral() {
|
||||||
|
return "7";
|
||||||
|
},
|
||||||
|
|
||||||
|
spawnableByDefault: true,
|
||||||
|
|
||||||
|
nodeModule: {
|
||||||
|
definition: {
|
||||||
|
id: "color_literal",
|
||||||
|
title: "Color",
|
||||||
|
category: "Values",
|
||||||
|
description: "Constant color literal (0-15).",
|
||||||
|
searchTags: ["color", "literal", "constant", "value"],
|
||||||
|
inputs: [],
|
||||||
|
outputs: [{ id: "value", name: "Value", direction: "output", kind: "color" }],
|
||||||
|
properties: [{ key: "value", label: "Color", type: "number", defaultValue: 7 }],
|
||||||
|
},
|
||||||
|
behavior: {
|
||||||
|
evaluateValue: ({ node, formatLiteral }) =>
|
||||||
|
formatLiteral("color", node.properties.value ?? 7),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('./LuaLiteralTypes.js').LuaLiteralHandler} LuaLiteralHandler
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {LuaLiteralHandler} */
|
||||||
|
export const LuaLiteralNumber = {
|
||||||
|
/**
|
||||||
|
* @param {unknown} value
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
format(value) {
|
||||||
|
const numeric = Number(value);
|
||||||
|
return Number.isFinite(numeric) ? String(numeric) : "0";
|
||||||
|
},
|
||||||
|
|
||||||
|
/** @returns {string} */
|
||||||
|
defaultLiteral() {
|
||||||
|
return "0";
|
||||||
|
},
|
||||||
|
|
||||||
|
spawnableByDefault: true,
|
||||||
|
|
||||||
|
nodeModule: {
|
||||||
|
definition: {
|
||||||
|
id: "number_literal",
|
||||||
|
title: "Number",
|
||||||
|
category: "Values",
|
||||||
|
description: "Constant numeric literal.",
|
||||||
|
searchTags: ["number", "literal", "constant", "value"],
|
||||||
|
inputs: [],
|
||||||
|
outputs: [{ id: "value", name: "Value", direction: "output", kind: "number" }],
|
||||||
|
properties: [{ key: "value", label: "Number", type: "number", defaultValue: 0 }],
|
||||||
|
},
|
||||||
|
behavior: {
|
||||||
|
evaluateValue: ({ node, formatLiteral }) =>
|
||||||
|
formatLiteral("number", node.properties.value ?? 0),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('./LuaLiteralTypes.js').LuaLiteralHandler} LuaLiteralHandler
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {LuaLiteralHandler} */
|
||||||
|
export const LuaLiteralString = {
|
||||||
|
/**
|
||||||
|
* @param {unknown} value
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
format(value) {
|
||||||
|
return JSON.stringify(String(value ?? ""));
|
||||||
|
},
|
||||||
|
|
||||||
|
/** @returns {string} */
|
||||||
|
defaultLiteral() {
|
||||||
|
return '""';
|
||||||
|
},
|
||||||
|
|
||||||
|
spawnableByDefault: true,
|
||||||
|
|
||||||
|
nodeModule: {
|
||||||
|
definition: {
|
||||||
|
id: "string_literal",
|
||||||
|
title: "String",
|
||||||
|
category: "Values",
|
||||||
|
description: "Constant string literal.",
|
||||||
|
searchTags: ["string", "literal", "text", "value"],
|
||||||
|
inputs: [],
|
||||||
|
outputs: [{ id: "value", name: "Value", direction: "output", kind: "string" }],
|
||||||
|
properties: [{ key: "value", label: "Text", type: "string", defaultValue: "hello" }],
|
||||||
|
},
|
||||||
|
behavior: {
|
||||||
|
evaluateValue: ({ node, formatLiteral }) =>
|
||||||
|
formatLiteral("string", node.properties.value ?? ""),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('./LuaLiteralTypes.js').LuaLiteralHandler} LuaLiteralHandler
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {LuaLiteralHandler} */
|
||||||
|
export const LuaLiteralTable = {
|
||||||
|
/**
|
||||||
|
* @param {unknown} value
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
format(value) {
|
||||||
|
if (typeof value === "string") {
|
||||||
|
const trimmed = value.trim();
|
||||||
|
return trimmed.length ? trimmed : "{}";
|
||||||
|
}
|
||||||
|
return "{}";
|
||||||
|
},
|
||||||
|
|
||||||
|
/** @returns {string} */
|
||||||
|
defaultLiteral() {
|
||||||
|
return "{}";
|
||||||
|
},
|
||||||
|
|
||||||
|
spawnableByDefault: false,
|
||||||
|
|
||||||
|
nodeModule: null,
|
||||||
|
};
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import { LuaLiteralNumber } from "./LuaLiteralNumber.js";
|
||||||
|
import { LuaLiteralBoolean } from "./LuaLiteralBoolean.js";
|
||||||
|
import { LuaLiteralString } from "./LuaLiteralString.js";
|
||||||
|
import { LuaLiteralTable } from "./LuaLiteralTable.js";
|
||||||
|
import { LuaLiteralColor } from "./LuaLiteralColor.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} LuaLiteralHandler
|
||||||
|
* @property {(value: unknown) => string} format Formats a raw value into a Lua literal string.
|
||||||
|
* @property {() => string} defaultLiteral Returns the default Lua literal string for this type.
|
||||||
|
* @property {boolean} [spawnableByDefault] Whether this type creates a spawnable literal node in the graph.
|
||||||
|
* @property {import('../../nodes/nodeTypes.js').NodeModule | null} [nodeModule] Node module definition, or null if no literal node exists.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {Map<string, LuaLiteralHandler>} */
|
||||||
|
const HANDLERS = new Map([
|
||||||
|
["number", LuaLiteralNumber],
|
||||||
|
["boolean", LuaLiteralBoolean],
|
||||||
|
["string", LuaLiteralString],
|
||||||
|
["table", LuaLiteralTable],
|
||||||
|
["color", LuaLiteralColor],
|
||||||
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats a raw value into a Lua literal string for the given pin kind.
|
||||||
|
*
|
||||||
|
* @param {string} kind Pin kind.
|
||||||
|
* @param {unknown} value Raw value.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function formatLiteral(kind, value) {
|
||||||
|
const handler = HANDLERS.get(kind);
|
||||||
|
return handler ? handler.format(value) : LuaLiteralString.format(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the default Lua literal string for the given pin kind.
|
||||||
|
*
|
||||||
|
* @param {string} kind Pin kind.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function defaultLiteralForKind(kind) {
|
||||||
|
const handler = HANDLERS.get(kind);
|
||||||
|
return handler ? handler.defaultLiteral() : "nil";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all node modules defined by literal handlers that have a nodeModule.
|
||||||
|
*
|
||||||
|
* @returns {Array<import('../../nodes/nodeTypes.js').NodeModule>}
|
||||||
|
*/
|
||||||
|
export function getLiteralNodeModules() {
|
||||||
|
return [...HANDLERS.values()]
|
||||||
|
.map((handler) => handler.nodeModule)
|
||||||
|
.filter(Boolean);
|
||||||
|
}
|
||||||
+202
-69
@@ -1,9 +1,31 @@
|
|||||||
import { BlueprintWorkspace } from "./ui/BlueprintWorkspace.js";
|
import { BlueprintWorkspace } from "./ui/BlueprintWorkspace.js";
|
||||||
import { NodeRegistry } from "./nodes/NodeRegistry.js";
|
import { NodeRegistry } from "./nodes/NodeRegistry.js";
|
||||||
import { LuaGenerator } from "./core/LuaGenerator.js";
|
import { LuaGenerator } from "./core/LuaGenerator.js";
|
||||||
|
import { EmbeddedPreview } from "./ui/EmbeddedPreview.js";
|
||||||
|
import { TileManager } from "./ui/TileManager.js";
|
||||||
|
|
||||||
|
// Global error handlers
|
||||||
|
window.addEventListener('error', (event) => {
|
||||||
|
console.error('Global error:', event.error);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('unhandledrejection', (event) => {
|
||||||
|
console.error('Unhandled promise rejection:', event.reason);
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{ compileLua(source: string): Promise<{ filePath: string }> }} ElectronAPI
|
* @typedef {{
|
||||||
|
* compileLua(source: string): Promise<{ filePath: string }>;
|
||||||
|
* previewCart?(cartContent: string): Promise<{ filePath: string }>;
|
||||||
|
* writePlayerHtml?(htmlContent: string): Promise<{ filePath: string }>;
|
||||||
|
* writePlayerCart?(cartContent: string): Promise<{ filePath: string }>;
|
||||||
|
* getCartStats?(cartContent: string): Promise<{ tokens: number, lines: number, chars: number, rawOutput: string }>;
|
||||||
|
* minimizeWindow?(): Promise<void>;
|
||||||
|
* toggleMaximizeWindow?(): Promise<boolean>;
|
||||||
|
* closeWindow?(): Promise<void>;
|
||||||
|
* getWindowMaximized?(): Promise<boolean>;
|
||||||
|
* onWindowMaximizedChanged?(callback: (isMaximized: boolean) => void): () => void;
|
||||||
|
* }} ElectronAPI
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,8 +92,11 @@ const deleteNodeButton = /** @type {HTMLButtonElement} */ (
|
|||||||
"deleteNodeButton"
|
"deleteNodeButton"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const compileButton = /** @type {HTMLButtonElement} */ (
|
const saveButton = /** @type {HTMLButtonElement} */ (
|
||||||
requireElement(document.getElementById("compileButton"), "compileButton")
|
requireElement(document.getElementById("saveButton"), "saveButton")
|
||||||
|
);
|
||||||
|
const previewButton = /** @type {HTMLButtonElement} */ (
|
||||||
|
requireElement(document.getElementById("previewButton"), "previewButton")
|
||||||
);
|
);
|
||||||
const exportLuaButton = /** @type {HTMLButtonElement} */ (
|
const exportLuaButton = /** @type {HTMLButtonElement} */ (
|
||||||
requireElement(document.getElementById("exportLuaButton"), "exportLuaButton")
|
requireElement(document.getElementById("exportLuaButton"), "exportLuaButton")
|
||||||
@@ -94,6 +119,24 @@ const frameSelectionButton = /** @type {HTMLButtonElement} */ (
|
|||||||
"frameSelectionButton"
|
"frameSelectionButton"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
const windowControls = /** @type {HTMLElement} */ (
|
||||||
|
requireElement(document.getElementById("windowControls"), "windowControls")
|
||||||
|
);
|
||||||
|
const minimizeWindowButton = /** @type {HTMLButtonElement} */ (
|
||||||
|
requireElement(
|
||||||
|
document.getElementById("minimizeWindowButton"),
|
||||||
|
"minimizeWindowButton"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const maximizeWindowButton = /** @type {HTMLButtonElement} */ (
|
||||||
|
requireElement(
|
||||||
|
document.getElementById("maximizeWindowButton"),
|
||||||
|
"maximizeWindowButton"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const closeWindowButton = /** @type {HTMLButtonElement} */ (
|
||||||
|
requireElement(document.getElementById("closeWindowButton"), "closeWindowButton")
|
||||||
|
);
|
||||||
const luaModal = /** @type {HTMLElement} */ (
|
const luaModal = /** @type {HTMLElement} */ (
|
||||||
requireElement(document.getElementById("luaModal"), "luaModal")
|
requireElement(document.getElementById("luaModal"), "luaModal")
|
||||||
);
|
);
|
||||||
@@ -115,6 +158,12 @@ const closeLuaModalButton = /** @type {HTMLButtonElement} */ (
|
|||||||
"closeLuaModalButton"
|
"closeLuaModalButton"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
const tileManagerButton = /** @type {HTMLButtonElement} */ (
|
||||||
|
requireElement(
|
||||||
|
document.getElementById("tileManagerButton"),
|
||||||
|
"tileManagerButton"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
const registry = new NodeRegistry();
|
const registry = new NodeRegistry();
|
||||||
const generator = new LuaGenerator(registry);
|
const generator = new LuaGenerator(registry);
|
||||||
@@ -133,6 +182,7 @@ const workspace = new BlueprintWorkspace({
|
|||||||
eventList,
|
eventList,
|
||||||
variableList,
|
variableList,
|
||||||
addVariableButton,
|
addVariableButton,
|
||||||
|
saveButton,
|
||||||
projectSettingsButton,
|
projectSettingsButton,
|
||||||
paletteToggleButton,
|
paletteToggleButton,
|
||||||
appBodyElement,
|
appBodyElement,
|
||||||
@@ -141,12 +191,106 @@ const workspace = new BlueprintWorkspace({
|
|||||||
|
|
||||||
workspace.initialize();
|
workspace.initialize();
|
||||||
|
|
||||||
|
// Initialize preview system
|
||||||
|
const embeddedPreview = new EmbeddedPreview({
|
||||||
|
getLuaCode: () => {
|
||||||
|
return workspace.exportLua();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Initialize tile manager
|
||||||
|
const tileManager = new TileManager();
|
||||||
|
tileManager.initialize();
|
||||||
|
|
||||||
/** @type {ElectronAPI | undefined} */
|
/** @type {ElectronAPI | undefined} */
|
||||||
const electronAPI =
|
const electronAPI =
|
||||||
typeof window !== "undefined" && "electronAPI" in window
|
typeof window !== "undefined" && "electronAPI" in window
|
||||||
? /** @type {ElectronAPI} */ (window.electronAPI)
|
? /** @type {ElectronAPI} */ (window.electronAPI)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
// Get titlebar element
|
||||||
|
const titleBarElement = document.querySelector('.header-title');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the window titlebar with token count information.
|
||||||
|
*
|
||||||
|
* @param {number} tokenCount Number of tokens in the cart
|
||||||
|
*/
|
||||||
|
function updateTitleBarWithTokens(tokenCount) {
|
||||||
|
if (titleBarElement) {
|
||||||
|
const maxTokens = 8192;
|
||||||
|
const percentage = ((tokenCount / maxTokens) * 100).toFixed(1);
|
||||||
|
titleBarElement.textContent = `picoGraph - ${tokenCount} / ${maxTokens} tokens (${percentage}%)`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates cart content from Lua code.
|
||||||
|
*
|
||||||
|
* @param {string} luaCode Generated Lua code
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function generateCartContent(luaCode) {
|
||||||
|
const hasUpdateCallback = /function\s+_update(?:60)?\b|_update(?:60)?\s*=/.test(luaCode);
|
||||||
|
const hasDrawCallback = /function\s+_draw\b|_draw\s*=/.test(luaCode);
|
||||||
|
const fallback = (hasUpdateCallback && hasDrawCallback) ? '' :
|
||||||
|
(!hasUpdateCallback ? '\nfunction _update()\nend\n' : '') +
|
||||||
|
(!hasDrawCallback ? '\nfunction _draw()\n cls()\n print("picograph ok",2,60,7)\nend\n' : '');
|
||||||
|
return `pico-8 cartridge // http://www.pico-8.com
|
||||||
|
version 41
|
||||||
|
__lua__
|
||||||
|
${luaCode}${fallback}
|
||||||
|
__gfx__
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates token count display after workspace changes.
|
||||||
|
*/
|
||||||
|
async function updateTokenCount() {
|
||||||
|
if (!electronAPI?.getCartStats) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const luaCode = workspace.exportLua();
|
||||||
|
let cartContent = generateCartContent(luaCode);
|
||||||
|
// Ensure Unix line endings (p8tool requires \n, not \r\n)
|
||||||
|
cartContent = cartContent.replace(/\r\n/g, '\n');
|
||||||
|
const stats = await electronAPI.getCartStats(cartContent);
|
||||||
|
updateTitleBarWithTokens(stats.tokens);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to update token count:", error);
|
||||||
|
if (titleBarElement) {
|
||||||
|
titleBarElement.textContent = "picoGraph";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override handlePersistenceStateChange to also update token count
|
||||||
|
const originalHandlePersistenceStateChange = workspace.handlePersistenceStateChange.bind(workspace);
|
||||||
|
workspace.handlePersistenceStateChange = function(state) {
|
||||||
|
originalHandlePersistenceStateChange(state);
|
||||||
|
|
||||||
|
// Update token count when save completes (both auto and manual)
|
||||||
|
if (state?.status === "saved") {
|
||||||
|
updateTokenCount();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Initial token count update after workspace loads
|
||||||
|
if (electronAPI?.getCartStats) {
|
||||||
|
updateTokenCount();
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener("contextmenu", (event) => {
|
document.addEventListener("contextmenu", (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
@@ -212,7 +356,6 @@ let isLuaModalOpen = false;
|
|||||||
let lastFocusedElement = /** @type {HTMLElement | null} */ (null);
|
let lastFocusedElement = /** @type {HTMLElement | null} */ (null);
|
||||||
let copyFeedbackTimeout = /** @type {number | null} */ (null);
|
let copyFeedbackTimeout = /** @type {number | null} */ (null);
|
||||||
let currentLuaSource = "";
|
let currentLuaSource = "";
|
||||||
let compileFeedbackTimeout = /** @type {number | null} */ (null);
|
|
||||||
|
|
||||||
const scheduleMicrotask = (callback) => {
|
const scheduleMicrotask = (callback) => {
|
||||||
if (typeof queueMicrotask === "function") {
|
if (typeof queueMicrotask === "function") {
|
||||||
@@ -354,77 +497,67 @@ const closeLuaModal = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
previewButton.addEventListener("click", () => {
|
||||||
* Restores the compile button to its idle appearance.
|
embeddedPreview.open();
|
||||||
*
|
});
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
const resetCompileButton = () => {
|
|
||||||
if (compileFeedbackTimeout !== null) {
|
|
||||||
window.clearTimeout(compileFeedbackTimeout);
|
|
||||||
compileFeedbackTimeout = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
compileButton.classList.remove("is-success", "is-error", "is-busy");
|
const setMaximizeButtonState = (isMaximized) => {
|
||||||
compileButton.disabled = false;
|
maximizeWindowButton.classList.toggle("is-active", Boolean(isMaximized));
|
||||||
compileButton.textContent = "Compile";
|
maximizeWindowButton.setAttribute(
|
||||||
|
"title",
|
||||||
|
isMaximized ? "Restore" : "Maximize"
|
||||||
|
);
|
||||||
|
maximizeWindowButton.setAttribute(
|
||||||
|
"aria-label",
|
||||||
|
isMaximized ? "Restore window" : "Maximize window"
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
if (
|
||||||
* Handles compile button clicks by requesting a Lua export from Electron.
|
electronAPI &&
|
||||||
*
|
typeof electronAPI.minimizeWindow === "function" &&
|
||||||
* @returns {Promise<void>}
|
typeof electronAPI.toggleMaximizeWindow === "function" &&
|
||||||
*/
|
typeof electronAPI.closeWindow === "function"
|
||||||
const handleCompileClick = async () => {
|
) {
|
||||||
if (!electronAPI) {
|
minimizeWindowButton.addEventListener("click", () => {
|
||||||
return;
|
electronAPI.minimizeWindow().catch((error) => {
|
||||||
}
|
console.error("Failed to minimize window", error);
|
||||||
|
|
||||||
if (compileFeedbackTimeout !== null) {
|
|
||||||
window.clearTimeout(compileFeedbackTimeout);
|
|
||||||
compileFeedbackTimeout = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
compileButton.classList.remove("is-success", "is-error");
|
|
||||||
compileButton.classList.add("is-busy");
|
|
||||||
compileButton.disabled = true;
|
|
||||||
compileButton.textContent = "Compiling...";
|
|
||||||
|
|
||||||
const source = workspace.exportLua();
|
|
||||||
|
|
||||||
try {
|
|
||||||
const result = await electronAPI.compileLua(source);
|
|
||||||
console.info("Lua compiled to", result.filePath);
|
|
||||||
compileButton.classList.remove("is-busy");
|
|
||||||
compileButton.classList.add("is-success");
|
|
||||||
compileButton.disabled = false;
|
|
||||||
compileButton.textContent = "Compiled!";
|
|
||||||
compileFeedbackTimeout = window.setTimeout(() => {
|
|
||||||
resetCompileButton();
|
|
||||||
}, 1800);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to compile Lua", error);
|
|
||||||
compileButton.classList.remove("is-busy");
|
|
||||||
compileButton.classList.add("is-error");
|
|
||||||
compileButton.disabled = false;
|
|
||||||
compileButton.textContent = "Failed";
|
|
||||||
compileFeedbackTimeout = window.setTimeout(() => {
|
|
||||||
resetCompileButton();
|
|
||||||
}, 2200);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (electronAPI && typeof electronAPI.compileLua === "function") {
|
|
||||||
compileButton.disabled = false;
|
|
||||||
compileButton.addEventListener("click", () => {
|
|
||||||
handleCompileClick().catch((error) => {
|
|
||||||
console.error("Unhandled compile error", error);
|
|
||||||
resetCompileButton();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
maximizeWindowButton.addEventListener("click", () => {
|
||||||
|
electronAPI.toggleMaximizeWindow()
|
||||||
|
.then((isMaximized) => {
|
||||||
|
setMaximizeButtonState(isMaximized);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("Failed to toggle maximize state", error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
closeWindowButton.addEventListener("click", () => {
|
||||||
|
electronAPI.closeWindow().catch((error) => {
|
||||||
|
console.error("Failed to close window", error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (typeof electronAPI.getWindowMaximized === "function") {
|
||||||
|
electronAPI.getWindowMaximized()
|
||||||
|
.then((isMaximized) => {
|
||||||
|
setMaximizeButtonState(isMaximized);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("Failed to query maximize state", error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof electronAPI.onWindowMaximizedChanged === "function") {
|
||||||
|
electronAPI.onWindowMaximizedChanged((isMaximized) => {
|
||||||
|
setMaximizeButtonState(isMaximized);
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
compileButton.disabled = true;
|
windowControls.hidden = true;
|
||||||
compileButton.title = "Compile is available in the desktop app";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exportLuaButton.addEventListener("click", () => {
|
exportLuaButton.addEventListener("click", () => {
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
import { createNodeModule } from "../nodeTypes.js";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constant boolean literal.
|
|
||||||
*/
|
|
||||||
export const booleanLiteralNode = createNodeModule(
|
|
||||||
{
|
|
||||||
id: "boolean_literal",
|
|
||||||
title: "Boolean",
|
|
||||||
category: "Values",
|
|
||||||
description: "Constant boolean literal.",
|
|
||||||
searchTags: ["boolean", "literal", "true", "false"],
|
|
||||||
inputs: [],
|
|
||||||
outputs: [
|
|
||||||
{ id: "value", name: "Value", direction: "output", kind: "boolean" },
|
|
||||||
],
|
|
||||||
properties: [
|
|
||||||
{ key: "value", label: "Value", type: "boolean", defaultValue: true },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
evaluateValue: ({ node, formatLiteral }) => {
|
|
||||||
return formatLiteral("boolean", node.properties.value ?? true);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { createNodeModule } from "../../nodeTypes.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a color value to a numeric value.
|
||||||
|
*/
|
||||||
|
export const colorToNumberNode = createNodeModule(
|
||||||
|
{
|
||||||
|
id: "convert_color_to_number",
|
||||||
|
title: "Color to Number",
|
||||||
|
category: "Converters",
|
||||||
|
description: "Convert a color value to a numeric value.",
|
||||||
|
searchTags: ["color", "number", "convert", "cast"],
|
||||||
|
inputs: [
|
||||||
|
{ id: "color", name: "Color", direction: "input", kind: "color" }
|
||||||
|
],
|
||||||
|
outputs: [
|
||||||
|
{ id: "number", name: "Number", direction: "output", kind: "number" }
|
||||||
|
],
|
||||||
|
properties: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
evaluateValue: ({ resolveValueInput }) => {
|
||||||
|
return resolveValueInput("color", "0");
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { colorToNumberNode } from "./colorToNumber.js";
|
||||||
|
import { numberToColorNode } from "./numberToColor.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All type conversion nodes.
|
||||||
|
*/
|
||||||
|
export const converterNodes = [colorToNumberNode, numberToColorNode];
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { createNodeModule } from "../../nodeTypes.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a numeric value to a color value.
|
||||||
|
*/
|
||||||
|
export const numberToColorNode = createNodeModule(
|
||||||
|
{
|
||||||
|
id: "convert_number_to_color",
|
||||||
|
title: "Number to Color",
|
||||||
|
category: "Converters",
|
||||||
|
description: "Convert a numeric value to a color value.",
|
||||||
|
searchTags: ["number", "color", "convert", "cast"],
|
||||||
|
inputs: [
|
||||||
|
{ id: "number", name: "Number", direction: "input", kind: "number" }
|
||||||
|
],
|
||||||
|
outputs: [
|
||||||
|
{ id: "color", name: "Color", direction: "output", kind: "color" }
|
||||||
|
],
|
||||||
|
properties: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
evaluateValue: ({ resolveValueInput }) => {
|
||||||
|
return resolveValueInput("number", "0");
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -33,7 +33,7 @@ export const circNode = createNodeModule(
|
|||||||
kind: "number",
|
kind: "number",
|
||||||
defaultValue: 4,
|
defaultValue: 4,
|
||||||
},
|
},
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export const circfillNode = createNodeModule(
|
|||||||
kind: "number",
|
kind: "number",
|
||||||
defaultValue: 4,
|
defaultValue: 4,
|
||||||
},
|
},
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const clsNode = createNodeModule(
|
|||||||
searchTags: ["cls", "clear", "screen", "background"],
|
searchTags: ["cls", "clear", "screen", "background"],
|
||||||
inputs: [
|
inputs: [
|
||||||
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const colorNode = createNodeModule(
|
|||||||
searchTags: ["color", "color", "ink", "draw"],
|
searchTags: ["color", "color", "ink", "draw"],
|
||||||
inputs: [
|
inputs: [
|
||||||
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export const cursorNode = createNodeModule(
|
|||||||
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
||||||
{ id: "x", name: "X", direction: "input", kind: "number" },
|
{ id: "x", name: "X", direction: "input", kind: "number" },
|
||||||
{ id: "y", name: "Y", direction: "input", kind: "number" },
|
{ id: "y", name: "Y", direction: "input", kind: "number" },
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const lineNode = createNodeModule(
|
|||||||
},
|
},
|
||||||
{ id: "x1", name: "X1", direction: "input", kind: "number" },
|
{ id: "x1", name: "X1", direction: "input", kind: "number" },
|
||||||
{ id: "y1", name: "Y1", direction: "input", kind: "number" },
|
{ id: "y1", name: "Y1", direction: "input", kind: "number" },
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const ovalNode = createNodeModule(
|
|||||||
kind: "number",
|
kind: "number",
|
||||||
defaultValue: 8,
|
defaultValue: 8,
|
||||||
},
|
},
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const ovalfillNode = createNodeModule(
|
|||||||
kind: "number",
|
kind: "number",
|
||||||
defaultValue: 8,
|
defaultValue: 8,
|
||||||
},
|
},
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ export const palNode = createNodeModule(
|
|||||||
searchTags: ["pal", "palette", "color", "remap"],
|
searchTags: ["pal", "palette", "color", "remap"],
|
||||||
inputs: [
|
inputs: [
|
||||||
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
||||||
{ id: "c0", name: "Color 0", direction: "input", kind: "number" },
|
{ id: "c0", name: "Color 0", direction: "input", kind: "color" },
|
||||||
{
|
{
|
||||||
id: "c1",
|
id: "c1",
|
||||||
name: "Color 1",
|
name: "Color 1",
|
||||||
direction: "input",
|
direction: "input",
|
||||||
kind: "number",
|
kind: "color",
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
},
|
},
|
||||||
{ id: "p", name: "Palette", direction: "input", kind: "number" },
|
{ id: "p", name: "Palette", direction: "input", kind: "number" },
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const paltNode = createNodeModule(
|
|||||||
searchTags: ["palt", "transparency", "palette", "sprite"],
|
searchTags: ["palt", "transparency", "palette", "sprite"],
|
||||||
inputs: [
|
inputs: [
|
||||||
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
{
|
{
|
||||||
id: "transparent",
|
id: "transparent",
|
||||||
name: "Transparent",
|
name: "Transparent",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const pgetNode = createNodeModule(
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "value", name: "Color", direction: "output", kind: "number" },
|
{ id: "value", name: "Color", direction: "output", kind: "color" },
|
||||||
],
|
],
|
||||||
properties: [],
|
properties: [],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export const psetNode = createNodeModule(
|
|||||||
kind: "number",
|
kind: "number",
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
},
|
},
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const rectNode = createNodeModule(
|
|||||||
kind: "number",
|
kind: "number",
|
||||||
defaultValue: 8,
|
defaultValue: 8,
|
||||||
},
|
},
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const rectfillNode = createNodeModule(
|
|||||||
kind: "number",
|
kind: "number",
|
||||||
defaultValue: 8,
|
defaultValue: 8,
|
||||||
},
|
},
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export const rrectNode = createNodeModule(
|
|||||||
kind: "number",
|
kind: "number",
|
||||||
defaultValue: 2,
|
defaultValue: 2,
|
||||||
},
|
},
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export const rrectfillNode = createNodeModule(
|
|||||||
kind: "number",
|
kind: "number",
|
||||||
defaultValue: 2,
|
defaultValue: 2,
|
||||||
},
|
},
|
||||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
{ id: "color", name: "Color", direction: "input", kind: "color" },
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export const sgetNode = createNodeModule(
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{ id: "value", name: "Color", direction: "output", kind: "number" },
|
{ id: "value", name: "Color", direction: "output", kind: "color" },
|
||||||
],
|
],
|
||||||
properties: [],
|
properties: [],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export const ssetNode = createNodeModule(
|
|||||||
id: "color",
|
id: "color",
|
||||||
name: "Color",
|
name: "Color",
|
||||||
direction: "input",
|
direction: "input",
|
||||||
kind: "number",
|
kind: "color",
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
|
import { getLiteralNodeModules } from "../../core/lua/LuaLiteralTypes.js";
|
||||||
import { eventInitNode } from "./eventStart.js";
|
import { eventInitNode } from "./eventStart.js";
|
||||||
import { eventUpdateNode } from "./eventUpdate.js";
|
import { eventUpdateNode } from "./eventUpdate.js";
|
||||||
import { eventDrawNode } from "./eventDraw.js";
|
import { eventDrawNode } from "./eventDraw.js";
|
||||||
import { printNode } from "./print.js";
|
import { printNode } from "./print.js";
|
||||||
import { setVariableNode } from "./setVariable.js";
|
import { setVariableNode } from "./setVariable.js";
|
||||||
import { getVariableNode } from "./getVariable.js";
|
import { getVariableNode } from "./getVariable.js";
|
||||||
import { numberLiteralNode } from "./numberLiteral.js";
|
|
||||||
import { stringLiteralNode } from "./stringLiteral.js";
|
|
||||||
import { booleanLiteralNode } from "./booleanLiteral.js";
|
|
||||||
import { addNumberNode } from "./addNumber.js";
|
|
||||||
import { multiplyNumberNode } from "./multiplyNumber.js";
|
|
||||||
import { compareNode } from "./compare.js";
|
import { compareNode } from "./compare.js";
|
||||||
import { sequenceNode } from "./sequence.js";
|
import { sequenceNode } from "./sequence.js";
|
||||||
import { ifNode } from "./ifNode.js";
|
import { ifNode } from "./ifNode.js";
|
||||||
@@ -31,19 +27,17 @@ import { serialNodes, serialFunctionChecklist } from "./serial/index.js";
|
|||||||
import { devkitNodes, devkitFunctionChecklist } from "./devkit/index.js";
|
import { devkitNodes, devkitFunctionChecklist } from "./devkit/index.js";
|
||||||
import { luaNodes, luaFunctionChecklist } from "./lua/index.js";
|
import { luaNodes, luaFunctionChecklist } from "./lua/index.js";
|
||||||
import { localVariableNodes } from "./localVariables.js";
|
import { localVariableNodes } from "./localVariables.js";
|
||||||
|
import { converterNodes } from "./converters/index.js";
|
||||||
|
import { rerouteNode, rerouteExecNode } from "./reroute.js";
|
||||||
|
|
||||||
export const nodeModules = [
|
export const nodeModules = [
|
||||||
|
...getLiteralNodeModules(),
|
||||||
eventInitNode,
|
eventInitNode,
|
||||||
eventUpdateNode,
|
eventUpdateNode,
|
||||||
eventDrawNode,
|
eventDrawNode,
|
||||||
printNode,
|
printNode,
|
||||||
setVariableNode,
|
setVariableNode,
|
||||||
getVariableNode,
|
getVariableNode,
|
||||||
numberLiteralNode,
|
|
||||||
stringLiteralNode,
|
|
||||||
booleanLiteralNode,
|
|
||||||
addNumberNode,
|
|
||||||
multiplyNumberNode,
|
|
||||||
compareNode,
|
compareNode,
|
||||||
sequenceNode,
|
sequenceNode,
|
||||||
ifNode,
|
ifNode,
|
||||||
@@ -51,6 +45,9 @@ export const nodeModules = [
|
|||||||
customEventNode,
|
customEventNode,
|
||||||
callCustomEventNode,
|
callCustomEventNode,
|
||||||
...localVariableNodes,
|
...localVariableNodes,
|
||||||
|
...converterNodes,
|
||||||
|
rerouteNode,
|
||||||
|
rerouteExecNode,
|
||||||
...graphicsNodes,
|
...graphicsNodes,
|
||||||
...systemNodes,
|
...systemNodes,
|
||||||
...tableNodes,
|
...tableNodes,
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ export const controllerButtonsNode = createNodeModule(
|
|||||||
name: "Button",
|
name: "Button",
|
||||||
direction: "input",
|
direction: "input",
|
||||||
kind: "number",
|
kind: "number",
|
||||||
|
defaultValue: DEFAULT_BUTTON_VALUE,
|
||||||
|
options: BUTTON_OPTIONS,
|
||||||
description: "Optional button index override",
|
description: "Optional button index override",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -97,6 +99,8 @@ export const controllerButtonsNode = createNodeModule(
|
|||||||
name: "Player",
|
name: "Player",
|
||||||
direction: "input",
|
direction: "input",
|
||||||
kind: "number",
|
kind: "number",
|
||||||
|
defaultValue: DEFAULT_PLAYER_VALUE,
|
||||||
|
options: PLAYER_OPTIONS,
|
||||||
description: "Optional player index override",
|
description: "Optional player index override",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
import { createNodeModule } from "../nodeTypes.js";
|
import { createNodeModule } from "../nodeTypes.js";
|
||||||
|
import {
|
||||||
|
getLocalVariableTypeOptions,
|
||||||
|
variablePropertyKey,
|
||||||
|
localVariableDefault,
|
||||||
|
LOCAL_VARIABLE_TYPE_IDS,
|
||||||
|
} from "../../types/TypeRegistry.js";
|
||||||
|
|
||||||
const LOCAL_TYPES = [
|
const LOCAL_TYPES = getLocalVariableTypeOptions();
|
||||||
{ value: "number", label: "Number" },
|
|
||||||
{ value: "string", label: "String" },
|
|
||||||
{ value: "boolean", label: "Boolean" },
|
|
||||||
{ value: "table", label: "Table" },
|
|
||||||
];
|
|
||||||
|
|
||||||
const DEFAULT_LOCAL_TYPE = LOCAL_TYPES[0]?.value ?? "number";
|
const DEFAULT_LOCAL_TYPE = LOCAL_TYPES[0]?.value ?? "number";
|
||||||
|
|
||||||
const sanitizeType = (raw) => {
|
const sanitizeType = (raw) => {
|
||||||
const candidate = typeof raw === "string" ? raw.toLowerCase() : DEFAULT_LOCAL_TYPE;
|
const candidate = typeof raw === "string" ? raw.trim().toLowerCase() : "";
|
||||||
return LOCAL_TYPES.some((entry) => entry.value === candidate)
|
return LOCAL_VARIABLE_TYPE_IDS.has(candidate) ? candidate : DEFAULT_LOCAL_TYPE;
|
||||||
? candidate
|
|
||||||
: DEFAULT_LOCAL_TYPE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ensureName = (raw, fallback = "localVar") => {
|
const ensureName = (raw, fallback = "localVar") => {
|
||||||
@@ -21,33 +19,10 @@ const ensureName = (raw, fallback = "localVar") => {
|
|||||||
return value.length ? value : fallback;
|
return value.length ? value : fallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
const resolveValuePropertyKey = (type) => {
|
const resolveValuePropertyKey = variablePropertyKey;
|
||||||
switch (type) {
|
|
||||||
case "string":
|
const defaultValueForType = localVariableDefault;
|
||||||
return "valueString";
|
|
||||||
case "boolean":
|
|
||||||
return "valueBoolean";
|
|
||||||
case "table":
|
|
||||||
return "valueTable";
|
|
||||||
case "number":
|
|
||||||
default:
|
|
||||||
return "valueNumber";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const defaultValueForType = (type) => {
|
|
||||||
switch (type) {
|
|
||||||
case "string":
|
|
||||||
return "";
|
|
||||||
case "boolean":
|
|
||||||
return false;
|
|
||||||
case "table":
|
|
||||||
return "{}";
|
|
||||||
case "number":
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const initializeLocalProperties = (properties, { includeValue }) => {
|
const initializeLocalProperties = (properties, { includeValue }) => {
|
||||||
const type = sanitizeType(properties.variableType);
|
const type = sanitizeType(properties.variableType);
|
||||||
@@ -68,6 +43,15 @@ const initializeLocalProperties = (properties, { includeValue }) => {
|
|||||||
if (typeof properties.valueTable !== "string") {
|
if (typeof properties.valueTable !== "string") {
|
||||||
properties.valueTable = String(properties.valueTable ?? "{}");
|
properties.valueTable = String(properties.valueTable ?? "{}");
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
typeof properties.valueColor !== "number" ||
|
||||||
|
!Number.isFinite(properties.valueColor)
|
||||||
|
) {
|
||||||
|
const n = Number(properties.valueColor);
|
||||||
|
properties.valueColor = Number.isFinite(n)
|
||||||
|
? Math.max(0, Math.min(15, Math.round(n)))
|
||||||
|
: 7;
|
||||||
|
}
|
||||||
|
|
||||||
if (includeValue) {
|
if (includeValue) {
|
||||||
const key = resolveValuePropertyKey(type);
|
const key = resolveValuePropertyKey(type);
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { createNodeModule } from "../nodeTypes.js";
|
import { createNodeModule } from "../../nodeTypes.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds two numeric values.
|
* Adds two numeric values.
|
||||||
*/
|
*/
|
||||||
export const addNumberNode = createNodeModule(
|
export const mathAddNode = createNodeModule(
|
||||||
{
|
{
|
||||||
id: "add_number",
|
id: "math_add",
|
||||||
title: "Add",
|
title: "Add",
|
||||||
category: "Math",
|
category: "Math",
|
||||||
description: "Add two numbers.",
|
description: "Add two numbers.",
|
||||||
searchTags: ["add", "math", "sum", "number"],
|
searchTags: ["add", "math", "sum", "plus", "number", "+"],
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
id: "a",
|
id: "a",
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { createNodeModule } from "../../nodeTypes.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Divides one numeric value by another.
|
||||||
|
*/
|
||||||
|
export const mathDivideNode = createNodeModule(
|
||||||
|
{
|
||||||
|
id: "math_divide",
|
||||||
|
title: "Divide",
|
||||||
|
category: "Math",
|
||||||
|
description: "Divide one number by another (floating point division).",
|
||||||
|
searchTags: ["divide", "division", "math", "slash", "number", "/"],
|
||||||
|
inputs: [
|
||||||
|
{
|
||||||
|
id: "a",
|
||||||
|
name: "A",
|
||||||
|
direction: "input",
|
||||||
|
kind: "number",
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "b",
|
||||||
|
name: "B",
|
||||||
|
direction: "input",
|
||||||
|
kind: "number",
|
||||||
|
defaultValue: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
outputs: [
|
||||||
|
{ id: "res", name: "Result", direction: "output", kind: "number" },
|
||||||
|
],
|
||||||
|
properties: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
evaluateValue: ({ resolveValueInput }) => {
|
||||||
|
const a = resolveValueInput("a", "0");
|
||||||
|
const b = resolveValueInput("b", "1");
|
||||||
|
return `(${a}) / (${b})`;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
import { mathAddNode } from "./add.js";
|
||||||
|
import { mathSubtractNode } from "./subtract.js";
|
||||||
|
import { mathMultiplyNode } from "./multiply.js";
|
||||||
|
import { mathDivideNode } from "./divide.js";
|
||||||
import { mathMaxNode } from "./max.js";
|
import { mathMaxNode } from "./max.js";
|
||||||
import { mathMinNode } from "./min.js";
|
import { mathMinNode } from "./min.js";
|
||||||
import { mathMidNode } from "./mid.js";
|
import { mathMidNode } from "./mid.js";
|
||||||
@@ -25,6 +29,10 @@ import { mathDivNode } from "./div.js";
|
|||||||
* All math-related node modules backed by PICO-8 helpers.
|
* All math-related node modules backed by PICO-8 helpers.
|
||||||
*/
|
*/
|
||||||
export const mathNodes = [
|
export const mathNodes = [
|
||||||
|
mathAddNode,
|
||||||
|
mathSubtractNode,
|
||||||
|
mathMultiplyNode,
|
||||||
|
mathDivideNode,
|
||||||
mathMaxNode,
|
mathMaxNode,
|
||||||
mathMinNode,
|
mathMinNode,
|
||||||
mathMidNode,
|
mathMidNode,
|
||||||
@@ -54,6 +62,10 @@ export const mathNodes = [
|
|||||||
* @type {Array<{ function: string, nodeId: string, implemented: boolean }>}
|
* @type {Array<{ function: string, nodeId: string, implemented: boolean }>}
|
||||||
*/
|
*/
|
||||||
export const mathFunctionChecklist = [
|
export const mathFunctionChecklist = [
|
||||||
|
{ function: "+", nodeId: "math_add", implemented: true },
|
||||||
|
{ function: "-", nodeId: "math_subtract", implemented: true },
|
||||||
|
{ function: "*", nodeId: "math_multiply", implemented: true },
|
||||||
|
{ function: "/", nodeId: "math_divide", implemented: true },
|
||||||
{ function: "MAX", nodeId: "math_max", implemented: true },
|
{ function: "MAX", nodeId: "math_max", implemented: true },
|
||||||
{ function: "MIN", nodeId: "math_min", implemented: true },
|
{ function: "MIN", nodeId: "math_min", implemented: true },
|
||||||
{ function: "MID", nodeId: "math_mid", implemented: true },
|
{ function: "MID", nodeId: "math_mid", implemented: true },
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
import { createNodeModule } from "../nodeTypes.js";
|
import { createNodeModule } from "../../nodeTypes.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiplies two numeric values.
|
* Multiplies two numeric values.
|
||||||
*/
|
*/
|
||||||
export const multiplyNumberNode = createNodeModule(
|
export const mathMultiplyNode = createNodeModule(
|
||||||
{
|
{
|
||||||
id: "multiply_number",
|
id: "math_multiply",
|
||||||
title: "Multiply",
|
title: "Multiply",
|
||||||
category: "Math",
|
category: "Math",
|
||||||
description: "Multiply two numbers.",
|
description: "Multiply two numbers.",
|
||||||
searchTags: ["multiply", "product", "math", "number"],
|
searchTags: ["multiply", "product", "math", "times", "*"],
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
id: "a",
|
id: "a",
|
||||||
name: "A",
|
name: "A",
|
||||||
direction: "input",
|
direction: "input",
|
||||||
kind: "number",
|
kind: "number",
|
||||||
defaultValue: 1,
|
defaultValue: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "b",
|
id: "b",
|
||||||
name: "B",
|
name: "B",
|
||||||
direction: "input",
|
direction: "input",
|
||||||
kind: "number",
|
kind: "number",
|
||||||
defaultValue: 1,
|
defaultValue: 0,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
@@ -33,8 +33,8 @@ export const multiplyNumberNode = createNodeModule(
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
evaluateValue: ({ resolveValueInput }) => {
|
evaluateValue: ({ resolveValueInput }) => {
|
||||||
const a = resolveValueInput("a", "1");
|
const a = resolveValueInput("a", "0");
|
||||||
const b = resolveValueInput("b", "1");
|
const b = resolveValueInput("b", "0");
|
||||||
return `(${a}) * (${b})`;
|
return `(${a}) * (${b})`;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { createNodeModule } from "../../nodeTypes.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subtracts one numeric value from another.
|
||||||
|
*/
|
||||||
|
export const mathSubtractNode = createNodeModule(
|
||||||
|
{
|
||||||
|
id: "math_subtract",
|
||||||
|
title: "Subtract",
|
||||||
|
category: "Math",
|
||||||
|
description: "Subtract one number from another.",
|
||||||
|
searchTags: ["subtract", "math", "minus", "difference", "-"],
|
||||||
|
inputs: [
|
||||||
|
{
|
||||||
|
id: "a",
|
||||||
|
name: "A",
|
||||||
|
direction: "input",
|
||||||
|
kind: "number",
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "b",
|
||||||
|
name: "B",
|
||||||
|
direction: "input",
|
||||||
|
kind: "number",
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
outputs: [
|
||||||
|
{ id: "res", name: "Result", direction: "output", kind: "number" },
|
||||||
|
],
|
||||||
|
properties: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
evaluateValue: ({ resolveValueInput }) => {
|
||||||
|
const a = resolveValueInput("a", "0");
|
||||||
|
const b = resolveValueInput("b", "0");
|
||||||
|
return `(${a}) - (${b})`;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import { createNodeModule } from "../nodeTypes.js";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constant numeric literal.
|
|
||||||
*/
|
|
||||||
export const numberLiteralNode = createNodeModule(
|
|
||||||
{
|
|
||||||
id: "number_literal",
|
|
||||||
title: "Number",
|
|
||||||
category: "Values",
|
|
||||||
description: "Constant numeric literal.",
|
|
||||||
searchTags: ["number", "literal", "constant", "value"],
|
|
||||||
inputs: [],
|
|
||||||
outputs: [
|
|
||||||
{ id: "value", name: "Value", direction: "output", kind: "number" },
|
|
||||||
],
|
|
||||||
properties: [
|
|
||||||
{ key: "value", label: "Number", type: "number", defaultValue: 0 },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
evaluateValue: ({ node, formatLiteral }) => {
|
|
||||||
return formatLiteral("number", node.properties.value ?? 0);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@@ -37,7 +37,7 @@ export const printNode = createNodeModule(
|
|||||||
id: "color",
|
id: "color",
|
||||||
name: "Color",
|
name: "Color",
|
||||||
direction: "input",
|
direction: "input",
|
||||||
kind: "number",
|
kind: "color",
|
||||||
defaultValue: 7,
|
defaultValue: 7,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import { createNodeModule } from "../nodeTypes.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A transparent pass-through node for redirecting data wires.
|
||||||
|
* Emits no code on its own — the value resolves directly through the input.
|
||||||
|
*/
|
||||||
|
export const rerouteNode = createNodeModule(
|
||||||
|
{
|
||||||
|
id: "reroute",
|
||||||
|
title: "Reroute",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Redirects a data wire without affecting the value.",
|
||||||
|
searchTags: ["reroute", "redirect", "wire", "relay", "pass", "through"],
|
||||||
|
inputs: [
|
||||||
|
{ id: "value", name: "", direction: "input", kind: "any" },
|
||||||
|
],
|
||||||
|
outputs: [
|
||||||
|
{ id: "value", name: "", direction: "output", kind: "any" },
|
||||||
|
],
|
||||||
|
properties: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
evaluateValue: ({ resolveValueInput }) => {
|
||||||
|
return resolveValueInput("value", "nil");
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A transparent pass-through node for redirecting exec wires.
|
||||||
|
* Emits no code on its own — execution continues directly to the next node.
|
||||||
|
*/
|
||||||
|
export const rerouteExecNode = createNodeModule(
|
||||||
|
{
|
||||||
|
id: "reroute_exec",
|
||||||
|
title: "Reroute",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Redirects an exec wire without generating any code.",
|
||||||
|
searchTags: ["reroute", "redirect", "exec", "wire", "relay", "pass", "through"],
|
||||||
|
inputs: [
|
||||||
|
{ id: "exec_in", name: "", direction: "input", kind: "exec" },
|
||||||
|
],
|
||||||
|
outputs: [
|
||||||
|
{ id: "exec_out", name: "", direction: "output", kind: "exec" },
|
||||||
|
],
|
||||||
|
properties: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
emitExec: ({ emitNextExec }) => {
|
||||||
|
return emitNextExec("exec_out");
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import { createNodeModule } from "../nodeTypes.js";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constant string literal.
|
|
||||||
*/
|
|
||||||
export const stringLiteralNode = createNodeModule(
|
|
||||||
{
|
|
||||||
id: "string_literal",
|
|
||||||
title: "String",
|
|
||||||
category: "Values",
|
|
||||||
description: "Constant string literal.",
|
|
||||||
searchTags: ["string", "literal", "text", "value"],
|
|
||||||
inputs: [],
|
|
||||||
outputs: [
|
|
||||||
{ id: "value", name: "Value", direction: "output", kind: "string" },
|
|
||||||
],
|
|
||||||
properties: [
|
|
||||||
{ key: "value", label: "Text", type: "string", defaultValue: "hello" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
evaluateValue: ({ node, formatLiteral }) => {
|
|
||||||
return formatLiteral("string", node.properties.value ?? "");
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@@ -41,7 +41,7 @@ export const extcmdNode = createNodeModule(
|
|||||||
],
|
],
|
||||||
inputs: [
|
inputs: [
|
||||||
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
||||||
{ id: "command", name: "Command", direction: "input", kind: "string" },
|
{ id: "command", name: "Command", direction: "input", kind: "string", defaultValue: EXT_CMD_DEFAULT, options: EXT_CMD_OPTIONS },
|
||||||
{ id: "param1", name: "Param 1", direction: "input", kind: "number" },
|
{ id: "param1", name: "Param 1", direction: "input", kind: "number" },
|
||||||
{ id: "param2", name: "Param 2", direction: "input", kind: "number" },
|
{ id: "param2", name: "Param 2", direction: "input", kind: "number" },
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -13,9 +13,11 @@
|
|||||||
* @property {string} id Stable identifier unique within the node definition.
|
* @property {string} id Stable identifier unique within the node definition.
|
||||||
* @property {string} name Display name.
|
* @property {string} name Display name.
|
||||||
* @property {('input'|'output')} direction Pin direction relative to the node.
|
* @property {('input'|'output')} direction Pin direction relative to the node.
|
||||||
* @property {('exec'|'number'|'boolean'|'string'|'table'|'any')} kind Blueprint connection kind.
|
* @property {('exec'|'number'|'boolean'|'string'|'table'|'any'|'color')} kind Blueprint connection kind.
|
||||||
* @property {string} [description] Optional tooltip text.
|
* @property {string} [description] Optional tooltip text.
|
||||||
* @property {unknown} [defaultValue] Default literal for data pins.
|
* @property {unknown} [defaultValue] Default literal for data pins.
|
||||||
|
* @property {Array<{label: string, value: string}>} [options] Renders an inline select dropdown when the pin is unconnected.
|
||||||
|
* @property {boolean} [spawnLiteralNode] Whether dragging off this pin offers the default literal node. Defaults to the handler's spawnableByDefault.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('./TypeRegistry.js').TypeDescriptor} TypeDescriptor
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {TypeDescriptor} */
|
||||||
|
export const AnyType = {
|
||||||
|
id: "any",
|
||||||
|
label: "Any",
|
||||||
|
color: "#ff7f11",
|
||||||
|
isVariable: true,
|
||||||
|
isLocalVariable: false,
|
||||||
|
defaultValue: null,
|
||||||
|
};
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('./TypeRegistry.js').TypeDescriptor} TypeDescriptor
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {TypeDescriptor} */
|
||||||
|
export const BooleanType = {
|
||||||
|
id: "boolean",
|
||||||
|
label: "Boolean",
|
||||||
|
color: "#ff4f4f",
|
||||||
|
isVariable: true,
|
||||||
|
isLocalVariable: true,
|
||||||
|
defaultValue: false,
|
||||||
|
variablePropertyKey: "valueBoolean",
|
||||||
|
compatibleWith: [
|
||||||
|
{ type: "string", convert: (v) => v ? "true" : "false" },
|
||||||
|
{ type: "number", convert: (v) => v ? 1 : 0 },
|
||||||
|
{ type: "color", convert: (v) => v ? 7 : 0 }
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('./TypeRegistry.js').TypeDescriptor} TypeDescriptor
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {TypeDescriptor} */
|
||||||
|
export const ColorType = {
|
||||||
|
id: "color",
|
||||||
|
label: "Color",
|
||||||
|
color: "#5b8ef5",
|
||||||
|
isVariable: true,
|
||||||
|
isLocalVariable: true,
|
||||||
|
defaultValue: 7,
|
||||||
|
variablePropertyKey: "valueColor",
|
||||||
|
compatibleWith: [
|
||||||
|
{ type: "number", convert: (v) => Number(v) },
|
||||||
|
{ type: "boolean", convert: (v) => v !== 0 }
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Type descriptor for execution flow pins.
|
||||||
|
*
|
||||||
|
* @type {import('./TypeRegistry.js').TypeDescriptor}
|
||||||
|
*/
|
||||||
|
export const ExecType = {
|
||||||
|
id: "exec",
|
||||||
|
label: "Exec",
|
||||||
|
color: "#ffffff",
|
||||||
|
isVariable: false,
|
||||||
|
isLocalVariable: false,
|
||||||
|
defaultValue: null,
|
||||||
|
};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('./TypeRegistry.js').TypeDescriptor} TypeDescriptor
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {TypeDescriptor} */
|
||||||
|
export const NumberType = {
|
||||||
|
id: "number",
|
||||||
|
label: "Number",
|
||||||
|
color: "#3ee581",
|
||||||
|
isVariable: true,
|
||||||
|
isLocalVariable: true,
|
||||||
|
defaultValue: 0,
|
||||||
|
variablePropertyKey: "valueNumber",
|
||||||
|
compatibleWith: [
|
||||||
|
{ type: "color", convert: (v) => Math.floor(Number(v)) % 16 },
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('./TypeRegistry.js').TypeDescriptor} TypeDescriptor
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {TypeDescriptor} */
|
||||||
|
export const StringType = {
|
||||||
|
id: "string",
|
||||||
|
label: "String",
|
||||||
|
color: "#ff66ff",
|
||||||
|
isVariable: true,
|
||||||
|
isLocalVariable: true,
|
||||||
|
defaultValue: "",
|
||||||
|
variablePropertyKey: "valueString",
|
||||||
|
};
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('./TypeRegistry.js').TypeDescriptor} TypeDescriptor
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {TypeDescriptor} */
|
||||||
|
export const TableType = {
|
||||||
|
id: "table",
|
||||||
|
label: "Table",
|
||||||
|
color: "#5ec4ff",
|
||||||
|
isVariable: true,
|
||||||
|
isLocalVariable: true,
|
||||||
|
defaultValue: [],
|
||||||
|
localDefaultValue: "{}",
|
||||||
|
variablePropertyKey: "valueTable",
|
||||||
|
};
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
import { AnyType } from "./AnyType.js";
|
||||||
|
import { NumberType } from "./NumberType.js";
|
||||||
|
import { StringType } from "./StringType.js";
|
||||||
|
import { BooleanType } from "./BooleanType.js";
|
||||||
|
import { TableType } from "./TableType.js";
|
||||||
|
import { ColorType } from "./ColorType.js";
|
||||||
|
import { ExecType } from "./ExecType.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {'any'|'number'|'string'|'boolean'|'table'|'color'} VariableType
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} TypeCompatibility
|
||||||
|
* @property {string} type Target type ID this type can connect to.
|
||||||
|
* @property {(value: unknown) => unknown} [convert] Optional conversion function.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} TypeDescriptor
|
||||||
|
* @property {string} id Type identifier.
|
||||||
|
* @property {string} label Display label.
|
||||||
|
* @property {string} color Accent color used for pins, wires, and variable labels (hex or CSS variable).
|
||||||
|
* @property {string} [icon] Optional icon character or symbol shown in type labels.
|
||||||
|
* @property {boolean} isVariable Whether usable as a workspace variable type.
|
||||||
|
* @property {boolean} isLocalVariable Whether usable as a local variable node type.
|
||||||
|
* @property {unknown} defaultValue Default value for workspace variables.
|
||||||
|
* @property {unknown} [localDefaultValue] Default for local variable nodes when different from defaultValue.
|
||||||
|
* @property {string} [variablePropertyKey] Property key used in local variable nodes.
|
||||||
|
* @property {ReadonlyArray<TypeCompatibility>} [compatibleWith] Types this type can implicitly convert to.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {ReadonlyArray<TypeDescriptor>} */
|
||||||
|
export const ALL_TYPES = [
|
||||||
|
ExecType,
|
||||||
|
AnyType,
|
||||||
|
NumberType,
|
||||||
|
StringType,
|
||||||
|
BooleanType,
|
||||||
|
TableType,
|
||||||
|
ColorType,
|
||||||
|
];
|
||||||
|
|
||||||
|
/** @type {Map<string, TypeDescriptor>} */
|
||||||
|
const TYPE_MAP = new Map(ALL_TYPES.map((t) => [t.id, t]));
|
||||||
|
|
||||||
|
/** @type {ReadonlySet<string>} */
|
||||||
|
export const LOCAL_VARIABLE_TYPE_IDS = new Set(
|
||||||
|
ALL_TYPES.filter((t) => t.isLocalVariable).map((t) => t.id)
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns type options available for workspace variable type dropdowns.
|
||||||
|
*
|
||||||
|
* @returns {Array<{ value: string, label: string }>}
|
||||||
|
*/
|
||||||
|
export function getVariableTypeOptions() {
|
||||||
|
return ALL_TYPES.filter((t) => t.isVariable).map((t) => ({ value: t.id, label: t.label }));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns type options available for local variable node type dropdowns.
|
||||||
|
*
|
||||||
|
* @returns {Array<{ value: string, label: string }>}
|
||||||
|
*/
|
||||||
|
export function getLocalVariableTypeOptions() {
|
||||||
|
return ALL_TYPES.filter((t) => t.isLocalVariable).map((t) => ({ value: t.id, label: t.label }));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalizes an arbitrary value to a valid registered type id, falling back to "any".
|
||||||
|
*
|
||||||
|
* @param {unknown} value Candidate type value.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function normalizeVariableType(value) {
|
||||||
|
if (typeof value === "string") {
|
||||||
|
const normalized = value.trim().toLowerCase();
|
||||||
|
if (TYPE_MAP.has(normalized)) return normalized;
|
||||||
|
}
|
||||||
|
return "any";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the default value for a workspace variable of the given type.
|
||||||
|
*
|
||||||
|
* @param {string} type Type identifier.
|
||||||
|
* @returns {unknown}
|
||||||
|
*/
|
||||||
|
export function defaultVariableValue(type) {
|
||||||
|
return TYPE_MAP.get(type)?.defaultValue ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the default value for a local variable node property of the given type.
|
||||||
|
*
|
||||||
|
* @param {string} type Type identifier.
|
||||||
|
* @returns {unknown}
|
||||||
|
*/
|
||||||
|
export function localVariableDefault(type) {
|
||||||
|
const desc = TYPE_MAP.get(type);
|
||||||
|
if (!desc) return 0;
|
||||||
|
return desc.localDefaultValue !== undefined ? desc.localDefaultValue : desc.defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the property key used to store the typed value in a local variable node.
|
||||||
|
*
|
||||||
|
* @param {string} type Type identifier.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function variablePropertyKey(type) {
|
||||||
|
return TYPE_MAP.get(type)?.variablePropertyKey ?? "valueNumber";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the accent color for the given type (used for pins, wires, and variable labels).
|
||||||
|
*
|
||||||
|
* @param {string} type Type identifier.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function getTypeColor(type) {
|
||||||
|
return TYPE_MAP.get(type)?.color ?? "#ffffff";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if two types are compatible for pin connections.
|
||||||
|
*
|
||||||
|
* @param {string} outputType The output pin type.
|
||||||
|
* @param {string} inputType The input pin type.
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export function areTypesCompatible(outputType, inputType) {
|
||||||
|
if (inputType === "any" || outputType === "any") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (outputType === inputType) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const outputDesc = TYPE_MAP.get(outputType);
|
||||||
|
if (outputDesc?.compatibleWith?.some((c) => c.type === inputType)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const inputDesc = TYPE_MAP.get(inputType);
|
||||||
|
if (inputDesc?.compatibleWith?.some((c) => c.type === outputType)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the conversion function for converting from one type to another.
|
||||||
|
*
|
||||||
|
* @param {string} fromType Source type ID.
|
||||||
|
* @param {string} toType Target type ID.
|
||||||
|
* @returns {((value: unknown) => unknown) | undefined}
|
||||||
|
*/
|
||||||
|
export function getTypeConverter(fromType, toType) {
|
||||||
|
if (fromType === toType) {
|
||||||
|
return (v) => v;
|
||||||
|
}
|
||||||
|
const fromDesc = TYPE_MAP.get(fromType);
|
||||||
|
const compat = fromDesc?.compatibleWith?.find((c) => c.type === toType);
|
||||||
|
return compat?.convert;
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { NodeGraph } from "../core/NodeGraph.js";
|
import { NodeGraph } from "../core/NodeGraph.js";
|
||||||
|
import { createColorSwatchPicker } from "./ColorSwatchPicker.js";
|
||||||
import { WorkspaceGeometry } from "./workspace/WorkspaceGeometry.js";
|
import { WorkspaceGeometry } from "./workspace/WorkspaceGeometry.js";
|
||||||
import { WorkspaceDragManager } from "./workspace/WorkspaceDragManager.js";
|
import { WorkspaceDragManager } from "./workspace/WorkspaceDragManager.js";
|
||||||
import { WorkspaceHistoryManager } from "./workspace/WorkspaceHistoryManager.js";
|
import { WorkspaceHistoryManager } from "./workspace/WorkspaceHistoryManager.js";
|
||||||
@@ -6,34 +7,30 @@ import { WorkspaceClipboardManager } from "./workspace/WorkspaceClipboardManager
|
|||||||
import { WorkspacePersistenceManager } from "./workspace/WorkspacePersistenceManager.js";
|
import { WorkspacePersistenceManager } from "./workspace/WorkspacePersistenceManager.js";
|
||||||
import { WorkspaceMarqueeManager } from "./workspace/WorkspaceMarqueeManager.js";
|
import { WorkspaceMarqueeManager } from "./workspace/WorkspaceMarqueeManager.js";
|
||||||
import { WorkspaceContextMenuManager } from "./workspace/WorkspaceContextMenuManager.js";
|
import { WorkspaceContextMenuManager } from "./workspace/WorkspaceContextMenuManager.js";
|
||||||
|
import { WorkspaceNodeContextMenu } from "./workspace/WorkspaceNodeContextMenu.js";
|
||||||
import { WorkspacePaletteManager } from "./workspace/WorkspacePaletteManager.js";
|
import { WorkspacePaletteManager } from "./workspace/WorkspacePaletteManager.js";
|
||||||
import { WorkspaceDropManager } from "./workspace/WorkspaceDropManager.js";
|
import { WorkspaceDropManager } from "./workspace/WorkspaceDropManager.js";
|
||||||
import { WorkspaceInlineEditorManager } from "./workspace/WorkspaceInlineEditorManager.js";
|
import { WorkspaceInlineEditorManager } from "./workspace/WorkspaceInlineEditorManager.js";
|
||||||
import { WorkspaceNodeRenderer } from "./workspace/WorkspaceNodeRenderer.js";
|
import { WorkspaceNodeRenderer } from "./workspace/WorkspaceNodeRenderer.js";
|
||||||
import { WorkspaceNavigationManager } from "./workspace/WorkspaceNavigationManager.js";
|
import { WorkspaceNavigationManager } from "./workspace/WorkspaceNavigationManager.js";
|
||||||
|
import { WorkspaceWireCutManager } from "./workspace/WorkspaceWireCutManager.js";
|
||||||
import { renderEventList } from "./workspace/renderEventList.js";
|
import { renderEventList } from "./workspace/renderEventList.js";
|
||||||
import { renderVariableList } from "./workspace/renderVariableList.js";
|
import { renderVariableList } from "./workspace/renderVariableList.js";
|
||||||
import {
|
import {
|
||||||
WORKSPACE_SHORTCUTS,
|
WORKSPACE_SHORTCUTS,
|
||||||
} from "./WorkspaceSpawnShortcuts.js";
|
} from "./WorkspaceSpawnShortcuts.js";
|
||||||
|
import {
|
||||||
|
normalizeVariableType,
|
||||||
|
getVariableTypeOptions,
|
||||||
|
defaultVariableValue as getDefaultVariableValue,
|
||||||
|
getTypeColor,
|
||||||
|
areTypesCompatible,
|
||||||
|
} from "../types/TypeRegistry.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {'any'|'number'|'string'|'boolean'|'table'} VariableType
|
* @typedef {import('../types/TypeRegistry.js').VariableType} VariableType
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @type {Array<{ value: VariableType, label: string }>} */
|
|
||||||
const VARIABLE_TYPE_DEFINITIONS = [
|
|
||||||
{ value: "any", label: "Any" },
|
|
||||||
{ value: "number", label: "Number" },
|
|
||||||
{ value: "string", label: "String" },
|
|
||||||
{ value: "boolean", label: "Boolean" },
|
|
||||||
{ value: "table", label: "Table" },
|
|
||||||
];
|
|
||||||
|
|
||||||
const SUPPORTED_VARIABLE_TYPES = new Set(
|
|
||||||
VARIABLE_TYPE_DEFINITIONS.map((entry) => entry.value)
|
|
||||||
);
|
|
||||||
|
|
||||||
/** @typedef {import('./WorkspaceSpawnShortcuts.js').WorkspaceShortcut} WorkspaceShortcut */
|
/** @typedef {import('./WorkspaceSpawnShortcuts.js').WorkspaceShortcut} WorkspaceShortcut */
|
||||||
/** @typedef {import('./WorkspaceSpawnShortcuts.js').WorkspaceShortcutModifier} WorkspaceShortcutModifier */
|
/** @typedef {import('./WorkspaceSpawnShortcuts.js').WorkspaceShortcutModifier} WorkspaceShortcutModifier */
|
||||||
|
|
||||||
@@ -85,6 +82,7 @@ const SUPPORTED_VARIABLE_TYPES = new Set(
|
|||||||
* @property {HTMLUListElement} eventList Event summary list element.
|
* @property {HTMLUListElement} eventList Event summary list element.
|
||||||
* @property {HTMLUListElement} variableList Variable summary list element.
|
* @property {HTMLUListElement} variableList Variable summary list element.
|
||||||
* @property {HTMLButtonElement} addVariableButton Global variable creation button.
|
* @property {HTMLButtonElement} addVariableButton Global variable creation button.
|
||||||
|
* @property {HTMLButtonElement} saveButton Save action button.
|
||||||
* @property {HTMLButtonElement} projectSettingsButton Project settings toggle.
|
* @property {HTMLButtonElement} projectSettingsButton Project settings toggle.
|
||||||
* @property {HTMLButtonElement} paletteToggleButton Palette toggle control.
|
* @property {HTMLButtonElement} paletteToggleButton Palette toggle control.
|
||||||
* @property {HTMLElement} appBodyElement Layout container hosting the workspace panes.
|
* @property {HTMLElement} appBodyElement Layout container hosting the workspace panes.
|
||||||
@@ -143,6 +141,8 @@ export class BlueprintWorkspace {
|
|||||||
this.variableListElement = options.variableList;
|
this.variableListElement = options.variableList;
|
||||||
this.addVariableButton = options.addVariableButton;
|
this.addVariableButton = options.addVariableButton;
|
||||||
/** @type {HTMLButtonElement} */
|
/** @type {HTMLButtonElement} */
|
||||||
|
this.saveButton = options.saveButton;
|
||||||
|
/** @type {HTMLButtonElement} */
|
||||||
this.projectSettingsButton = options.projectSettingsButton;
|
this.projectSettingsButton = options.projectSettingsButton;
|
||||||
/** @type {HTMLButtonElement} */
|
/** @type {HTMLButtonElement} */
|
||||||
this.frameSelectionButton = options.frameSelectionButton;
|
this.frameSelectionButton = options.frameSelectionButton;
|
||||||
@@ -175,6 +175,12 @@ export class BlueprintWorkspace {
|
|||||||
this.nodeDragRotationDecayFrame = null;
|
this.nodeDragRotationDecayFrame = null;
|
||||||
/** @type {number | null} */
|
/** @type {number | null} */
|
||||||
this.connectionRefreshFrame = null;
|
this.connectionRefreshFrame = null;
|
||||||
|
/** @type {number | null} */
|
||||||
|
this.periodicUpdateTimer = null;
|
||||||
|
/** @type {number | null} */
|
||||||
|
this.saveFeedbackTimer = null;
|
||||||
|
/** @type {boolean} */
|
||||||
|
this.hasPendingSave = false;
|
||||||
|
|
||||||
this.graph = new NodeGraph();
|
this.graph = new NodeGraph();
|
||||||
/** @type {Map<string, WorkspaceVariable>} */
|
/** @type {Map<string, WorkspaceVariable>} */
|
||||||
@@ -240,6 +246,8 @@ export class BlueprintWorkspace {
|
|||||||
this.paletteManager = null;
|
this.paletteManager = null;
|
||||||
/** @type {WorkspaceContextMenuManager | null} */
|
/** @type {WorkspaceContextMenuManager | null} */
|
||||||
this.contextMenuManager = null;
|
this.contextMenuManager = null;
|
||||||
|
/** @type {WorkspaceNodeContextMenu | null} */
|
||||||
|
this.nodeContextMenu = null;
|
||||||
/** @type {WorkspaceDropManager | null} */
|
/** @type {WorkspaceDropManager | null} */
|
||||||
this.dropManager = null;
|
this.dropManager = null;
|
||||||
/** @type {WorkspaceMarqueeManager | null} */
|
/** @type {WorkspaceMarqueeManager | null} */
|
||||||
@@ -252,6 +260,8 @@ export class BlueprintWorkspace {
|
|||||||
this.navigationManager = null;
|
this.navigationManager = null;
|
||||||
/** @type {WorkspaceDragManager | null} */
|
/** @type {WorkspaceDragManager | null} */
|
||||||
this.dragManager = null;
|
this.dragManager = null;
|
||||||
|
/** @type {WorkspaceWireCutManager | null} */
|
||||||
|
this.wireCutManager = null;
|
||||||
/** @type {HTMLTemplateElement} */
|
/** @type {HTMLTemplateElement} */
|
||||||
this.nodeTemplate = BlueprintWorkspace.#requireTemplate(
|
this.nodeTemplate = BlueprintWorkspace.#requireTemplate(
|
||||||
"nodeTemplate",
|
"nodeTemplate",
|
||||||
@@ -349,6 +359,7 @@ export class BlueprintWorkspace {
|
|||||||
isTypeDropdownOpen: (context) => this.#isTypeDropdownOpen(context),
|
isTypeDropdownOpen: (context) => this.#isTypeDropdownOpen(context),
|
||||||
});
|
});
|
||||||
this.contextMenuManager = new WorkspaceContextMenuManager(this);
|
this.contextMenuManager = new WorkspaceContextMenuManager(this);
|
||||||
|
this.nodeContextMenu = new WorkspaceNodeContextMenu(this);
|
||||||
this.paletteManager = new WorkspacePaletteManager(this);
|
this.paletteManager = new WorkspacePaletteManager(this);
|
||||||
this.dropManager = new WorkspaceDropManager(this);
|
this.dropManager = new WorkspaceDropManager(this);
|
||||||
this.marqueeManager = new WorkspaceMarqueeManager(this);
|
this.marqueeManager = new WorkspaceMarqueeManager(this);
|
||||||
@@ -356,6 +367,7 @@ export class BlueprintWorkspace {
|
|||||||
renderConnections: () => this.#renderConnections(),
|
renderConnections: () => this.#renderConnections(),
|
||||||
schedulePersist: () => this.persistenceManager.schedulePersist(),
|
schedulePersist: () => this.persistenceManager.schedulePersist(),
|
||||||
});
|
});
|
||||||
|
this.wireCutManager = new WorkspaceWireCutManager(this);
|
||||||
this.nodeRenderer = new WorkspaceNodeRenderer(this, {
|
this.nodeRenderer = new WorkspaceNodeRenderer(this, {
|
||||||
inlineEditorManager: this.inlineEditorManager,
|
inlineEditorManager: this.inlineEditorManager,
|
||||||
applySelectionState: () => this.#applySelectionState(),
|
applySelectionState: () => this.#applySelectionState(),
|
||||||
@@ -380,12 +392,14 @@ export class BlueprintWorkspace {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.contextMenuManager.initialize();
|
this.contextMenuManager.initialize();
|
||||||
|
this.nodeContextMenu.initialize();
|
||||||
this.paletteManager.initialize();
|
this.paletteManager.initialize();
|
||||||
this.dropManager.initialize();
|
this.dropManager.initialize();
|
||||||
this.marqueeManager.ensureElement();
|
this.marqueeManager.ensureElement();
|
||||||
|
|
||||||
this.navigationManager.updateZoomDisplay();
|
this.navigationManager.updateZoomDisplay();
|
||||||
this.navigationManager.setBackgroundOffset({ x: 0, y: 0 });
|
this.navigationManager.setBackgroundOffset({ x: 0, y: 0 });
|
||||||
|
this.#resetSaveButtonAppearance();
|
||||||
|
|
||||||
if (typeof this.generator.setProjectSettings === "function") {
|
if (typeof this.generator.setProjectSettings === "function") {
|
||||||
this.generator.setProjectSettings({ ...this.projectSettings });
|
this.generator.setProjectSettings({ ...this.projectSettings });
|
||||||
@@ -405,6 +419,127 @@ export class BlueprintWorkspace {
|
|||||||
|
|
||||||
this.historyManager.initialize();
|
this.historyManager.initialize();
|
||||||
this.isInitialized = true;
|
this.isInitialized = true;
|
||||||
|
this.#startPeriodicUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a periodic update that refreshes the graph when idle.
|
||||||
|
*/
|
||||||
|
#startPeriodicUpdate() {
|
||||||
|
if (this.periodicUpdateTimer !== null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.periodicUpdateTimer = window.setInterval(() => {
|
||||||
|
if (!this.isDraggingNodes && this.workspaceDragDepth === 0) {
|
||||||
|
this.#renderConnections();
|
||||||
|
this.nodeRenderer?.refreshAllPinConnections();
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the periodic update timer.
|
||||||
|
*/
|
||||||
|
#stopPeriodicUpdate() {
|
||||||
|
if (this.periodicUpdateTimer !== null) {
|
||||||
|
window.clearInterval(this.periodicUpdateTimer);
|
||||||
|
this.periodicUpdateTimer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the active save feedback timer.
|
||||||
|
*/
|
||||||
|
#clearSaveFeedbackTimer() {
|
||||||
|
if (this.saveFeedbackTimer !== null && typeof window !== "undefined") {
|
||||||
|
window.clearTimeout(this.saveFeedbackTimer);
|
||||||
|
this.saveFeedbackTimer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restores the save button to its current base state.
|
||||||
|
*/
|
||||||
|
#resetSaveButtonAppearance() {
|
||||||
|
const button = this.saveButton;
|
||||||
|
if (!button) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.classList.remove("is-busy", "is-success", "is-error", "is-pending");
|
||||||
|
button.disabled = !this.persistenceManager?.isStorageAvailable;
|
||||||
|
button.setAttribute(
|
||||||
|
"title",
|
||||||
|
this.persistenceManager?.isStorageAvailable
|
||||||
|
? this.hasPendingSave
|
||||||
|
? "Unsaved changes"
|
||||||
|
: "Workspace saved"
|
||||||
|
: "Saving is unavailable"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (this.hasPendingSave) {
|
||||||
|
button.classList.add("is-pending");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies transient visual state to the save button.
|
||||||
|
*
|
||||||
|
* @param {{ status: 'idle'|'pending'|'saving'|'saved'|'error', source: 'manual'|'auto' }} state
|
||||||
|
*/
|
||||||
|
#updateSaveButtonAppearance(state) {
|
||||||
|
const button = this.saveButton;
|
||||||
|
if (!button) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#clearSaveFeedbackTimer();
|
||||||
|
this.#resetSaveButtonAppearance();
|
||||||
|
|
||||||
|
if (!this.persistenceManager?.isStorageAvailable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.status === "pending") {
|
||||||
|
button.classList.add("is-pending");
|
||||||
|
button.setAttribute("title", "Unsaved changes");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.status === "saving") {
|
||||||
|
button.classList.remove("is-pending");
|
||||||
|
button.classList.add("is-busy");
|
||||||
|
button.disabled = true;
|
||||||
|
button.setAttribute("title", "Saving workspace");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.status === "saved") {
|
||||||
|
button.classList.remove("is-pending");
|
||||||
|
button.classList.add("is-success");
|
||||||
|
button.setAttribute(
|
||||||
|
"title",
|
||||||
|
state.source === "auto" ? "Workspace autosaved" : "Workspace saved"
|
||||||
|
);
|
||||||
|
this.saveFeedbackTimer = window.setTimeout(() => {
|
||||||
|
this.#resetSaveButtonAppearance();
|
||||||
|
this.saveFeedbackTimer = null;
|
||||||
|
}, 1400);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.status === "error") {
|
||||||
|
button.classList.remove("is-pending");
|
||||||
|
button.classList.add("is-error");
|
||||||
|
button.setAttribute("title", "Workspace save failed");
|
||||||
|
this.saveFeedbackTimer = window.setTimeout(() => {
|
||||||
|
this.#resetSaveButtonAppearance();
|
||||||
|
this.saveFeedbackTimer = null;
|
||||||
|
}, 1800);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#resetSaveButtonAppearance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -428,6 +563,41 @@ export class BlueprintWorkspace {
|
|||||||
return this.#refreshLuaOutput();
|
return this.#refreshLuaOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Persists the current workspace state immediately.
|
||||||
|
*
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
saveWorkspace() {
|
||||||
|
if (!this.persistenceManager?.isStorageAvailable) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.persistenceManager.persistImmediately("manual");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reflects persistence lifecycle changes in the save button state.
|
||||||
|
*
|
||||||
|
* @param {{ status: 'idle'|'pending'|'saving'|'saved'|'error', source: 'manual'|'auto' }} state
|
||||||
|
*/
|
||||||
|
handlePersistenceStateChange(state) {
|
||||||
|
if (!state) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.status === "pending") {
|
||||||
|
this.hasPendingSave = true;
|
||||||
|
} else if (state.status === "saved") {
|
||||||
|
this.hasPendingSave = false;
|
||||||
|
} else if (state.status === "error") {
|
||||||
|
this.hasPendingSave = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#updateSaveButtonAppearance(state);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscribes to graph lifecycle changes.
|
* Subscribes to graph lifecycle changes.
|
||||||
*/
|
*/
|
||||||
@@ -661,6 +831,12 @@ export class BlueprintWorkspace {
|
|||||||
* Registers DOM event listeners for interactivity.
|
* Registers DOM event listeners for interactivity.
|
||||||
*/
|
*/
|
||||||
#bindUiEvents() {
|
#bindUiEvents() {
|
||||||
|
if (this.saveButton) {
|
||||||
|
this.saveButton.addEventListener("click", () => {
|
||||||
|
this.saveWorkspace();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (this.paletteToggleButton) {
|
if (this.paletteToggleButton) {
|
||||||
this.paletteToggleButton.addEventListener("click", () => {
|
this.paletteToggleButton.addEventListener("click", () => {
|
||||||
this.#togglePaletteVisibility();
|
this.#togglePaletteVisibility();
|
||||||
@@ -726,7 +902,7 @@ export class BlueprintWorkspace {
|
|||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const direction = event.deltaY < 0 ? 1 : -1;
|
const direction = event.deltaY < 0 ? 1 : -1;
|
||||||
this.navigationManager.zoomAt(pointer, direction, {
|
this.navigationManager.pushSmoothZoom(pointer, direction, {
|
||||||
clientX: event.clientX,
|
clientX: event.clientX,
|
||||||
clientY: event.clientY,
|
clientY: event.clientY,
|
||||||
});
|
});
|
||||||
@@ -754,10 +930,25 @@ export class BlueprintWorkspace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.nodeContextMenu?.isVisible()) {
|
||||||
|
if (
|
||||||
|
!(rawTarget instanceof Node) ||
|
||||||
|
!this.nodeContextMenu.isTargetInside(rawTarget)
|
||||||
|
) {
|
||||||
|
this.nodeContextMenu.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(rawTarget instanceof Element)) {
|
if (!(rawTarget instanceof Element)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Middle mouse starts a wire-cut gesture from anywhere in the workspace.
|
||||||
|
if (event.button === 1) {
|
||||||
|
this.wireCutManager?.beginCut(event);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.#isWorkspaceBackgroundTarget(rawTarget)) {
|
if (!this.#isWorkspaceBackgroundTarget(rawTarget)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -789,6 +980,7 @@ export class BlueprintWorkspace {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
this.nodeContextMenu?.hide();
|
||||||
this.contextMenuManager.show(event.clientX, event.clientY);
|
this.contextMenuManager.show(event.clientX, event.clientY);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -921,7 +1113,7 @@ export class BlueprintWorkspace {
|
|||||||
this.clipboardManager?.clearPointerPosition();
|
this.clipboardManager?.clearPointerPosition();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.connectionLayer.addEventListener("pointerdown", (event) => {
|
this.workspaceElement.addEventListener("pointerdown", (event) => {
|
||||||
this.#handleConnectionPointerDown(event);
|
this.#handleConnectionPointerDown(event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1031,6 +1223,72 @@ export class BlueprintWorkspace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refreshes a node by replacing it with a new instance, preserving connections.
|
||||||
|
*
|
||||||
|
* @param {string} nodeId Target node identifier.
|
||||||
|
* @returns {boolean} Whether the node was successfully refreshed.
|
||||||
|
*/
|
||||||
|
refreshNode(nodeId) {
|
||||||
|
const node = this.graph.nodes.get(nodeId);
|
||||||
|
if (!node) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const connections = this.graph.getConnectionsForNode(nodeId);
|
||||||
|
const position = { ...node.position };
|
||||||
|
const nodeType = node.type;
|
||||||
|
const properties = { ...node.properties };
|
||||||
|
|
||||||
|
this.historyManager.withSuspended(() => {
|
||||||
|
this.removeNode(nodeId);
|
||||||
|
|
||||||
|
const newNode = this.registry.createNode(nodeType, {
|
||||||
|
id: nodeId,
|
||||||
|
position,
|
||||||
|
});
|
||||||
|
|
||||||
|
newNode.properties = properties;
|
||||||
|
|
||||||
|
this.graph.addNode(newNode);
|
||||||
|
this.renderNode(newNode);
|
||||||
|
|
||||||
|
connections.forEach((connection) => {
|
||||||
|
const isSource = connection.from.nodeId === nodeId;
|
||||||
|
const isTarget = connection.to.nodeId === nodeId;
|
||||||
|
|
||||||
|
if (isSource) {
|
||||||
|
const fromPin = newNode.getPin(connection.from.pinId);
|
||||||
|
const toNode = this.graph.nodes.get(connection.to.nodeId);
|
||||||
|
const toPin = toNode?.getPin(connection.to.pinId);
|
||||||
|
|
||||||
|
if (fromPin && toNode && toPin) {
|
||||||
|
this.graph.connect(
|
||||||
|
{ nodeId: newNode.id, pinId: fromPin.id },
|
||||||
|
{ nodeId: toNode.id, pinId: toPin.id }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (isTarget) {
|
||||||
|
const fromNode = this.graph.nodes.get(connection.from.nodeId);
|
||||||
|
const fromPin = fromNode?.getPin(connection.from.pinId);
|
||||||
|
const toPin = newNode.getPin(connection.to.pinId);
|
||||||
|
|
||||||
|
if (fromNode && fromPin && toPin) {
|
||||||
|
this.graph.connect(
|
||||||
|
{ nodeId: fromNode.id, pinId: fromPin.id },
|
||||||
|
{ nodeId: newNode.id, pinId: toPin.id }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.#renderConnections();
|
||||||
|
this.nodeRenderer.refreshAllPinConnections();
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the current node selection.
|
* Clears the current node selection.
|
||||||
*/
|
*/
|
||||||
@@ -1635,18 +1893,7 @@ export class BlueprintWorkspace {
|
|||||||
* @returns {VariableDefaultValue}
|
* @returns {VariableDefaultValue}
|
||||||
*/
|
*/
|
||||||
#defaultVariableValue(type) {
|
#defaultVariableValue(type) {
|
||||||
switch (type) {
|
return /** @type {VariableDefaultValue} */ (getDefaultVariableValue(type));
|
||||||
case "number":
|
|
||||||
return 0;
|
|
||||||
case "string":
|
|
||||||
return "";
|
|
||||||
case "table":
|
|
||||||
return [];
|
|
||||||
case "boolean":
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1679,6 +1926,11 @@ export class BlueprintWorkspace {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
case "color": {
|
||||||
|
const n = typeof value === "number" ? value : Number(value);
|
||||||
|
const safe = Number.isFinite(n) ? Math.round(n) : 7;
|
||||||
|
return Math.max(0, Math.min(15, safe));
|
||||||
|
}
|
||||||
case "boolean": {
|
case "boolean": {
|
||||||
if (typeof value === "boolean") {
|
if (typeof value === "boolean") {
|
||||||
return value;
|
return value;
|
||||||
@@ -2013,6 +2265,18 @@ export class BlueprintWorkspace {
|
|||||||
this.#setVariableDefault(variable.id, defaultToggle.checked);
|
this.#setVariableDefault(variable.id, defaultToggle.checked);
|
||||||
});
|
});
|
||||||
defaultField.appendChild(defaultToggle);
|
defaultField.appendChild(defaultToggle);
|
||||||
|
} else if (variable.type === "color") {
|
||||||
|
const rawDefault = variable.defaultValue;
|
||||||
|
const n = typeof rawDefault === "number" ? rawDefault : Number(rawDefault);
|
||||||
|
const initialIndex = Number.isFinite(n) ? Math.max(0, Math.min(15, Math.round(n))) : 7;
|
||||||
|
const picker = createColorSwatchPicker({
|
||||||
|
id: defaultId,
|
||||||
|
value: initialIndex,
|
||||||
|
onChange: (index) => {
|
||||||
|
this.#setVariableDefault(variable.id, index);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
defaultField.appendChild(picker.element);
|
||||||
} else if (variable.type === "number") {
|
} else if (variable.type === "number") {
|
||||||
const defaultInput = document.createElement("input");
|
const defaultInput = document.createElement("input");
|
||||||
defaultInput.type = "number";
|
defaultInput.type = "number";
|
||||||
@@ -2487,6 +2751,7 @@ export class BlueprintWorkspace {
|
|||||||
option.type = "button";
|
option.type = "button";
|
||||||
option.className = "variable-type-option";
|
option.className = "variable-type-option";
|
||||||
option.dataset.variableType = entry.value;
|
option.dataset.variableType = entry.value;
|
||||||
|
option.style.setProperty("--overview-variable-color", getTypeColor(entry.value));
|
||||||
option.textContent = entry.label;
|
option.textContent = entry.label;
|
||||||
option.setAttribute("role", "menuitemradio");
|
option.setAttribute("role", "menuitemradio");
|
||||||
option.setAttribute(
|
option.setAttribute(
|
||||||
@@ -2908,12 +3173,8 @@ export class BlueprintWorkspace {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rect = workspaceElement.getBoundingClientRect();
|
// Use dragManager.clientToWorkspace for proper coordinate conversion
|
||||||
const screenPoint = {
|
const worldPoint = this.dragManager.clientToWorkspace(event.clientX, event.clientY);
|
||||||
x: Math.max(0, Math.min(rect.width, event.clientX - rect.left)),
|
|
||||||
y: Math.max(0, Math.min(rect.height, event.clientY - rect.top)),
|
|
||||||
};
|
|
||||||
const worldPoint = navigator.screenPointToWorld(screenPoint);
|
|
||||||
return this.addNode(shortcut.definitionId, worldPoint);
|
return this.addNode(shortcut.definitionId, worldPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3286,9 +3547,7 @@ export class BlueprintWorkspace {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
#formatVariableType(type) {
|
#formatVariableType(type) {
|
||||||
const entry = VARIABLE_TYPE_DEFINITIONS.find(
|
const entry = getVariableTypeOptions().find((opt) => opt.value === type);
|
||||||
(definition) => definition.value === type
|
|
||||||
);
|
|
||||||
return entry ? entry.label : "Any";
|
return entry ? entry.label : "Any";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3299,17 +3558,7 @@ export class BlueprintWorkspace {
|
|||||||
* @returns {VariableType}
|
* @returns {VariableType}
|
||||||
*/
|
*/
|
||||||
#normalizeVariableType(value) {
|
#normalizeVariableType(value) {
|
||||||
if (typeof value === "string") {
|
return /** @type {VariableType} */ (normalizeVariableType(value));
|
||||||
const normalized = value.trim().toLowerCase();
|
|
||||||
if (
|
|
||||||
SUPPORTED_VARIABLE_TYPES.has(
|
|
||||||
/** @type {VariableType} */ (normalized)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return /** @type {VariableType} */ (normalized);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "any";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3318,7 +3567,7 @@ export class BlueprintWorkspace {
|
|||||||
* @returns {Array<{ value: VariableType, label: string }>}
|
* @returns {Array<{ value: VariableType, label: string }>}
|
||||||
*/
|
*/
|
||||||
#getVariableTypeOptions() {
|
#getVariableTypeOptions() {
|
||||||
return VARIABLE_TYPE_DEFINITIONS.map((entry) => ({ ...entry }));
|
return getVariableTypeOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3521,12 +3770,14 @@ export class BlueprintWorkspace {
|
|||||||
node.type === "set_local_var" || node.type === "get_local_var";
|
node.type === "set_local_var" || node.type === "get_local_var";
|
||||||
article.classList.add("blueprint-node--variable");
|
article.classList.add("blueprint-node--variable");
|
||||||
article.dataset.variableType = binding.type;
|
article.dataset.variableType = binding.type;
|
||||||
|
article.style.setProperty("--overview-variable-color", getTypeColor(binding.type));
|
||||||
article.dataset.variableRole = role;
|
article.dataset.variableRole = role;
|
||||||
article.dataset.variableScope = isLocal ? "local" : "global";
|
article.dataset.variableScope = isLocal ? "local" : "global";
|
||||||
|
|
||||||
header.classList.add("node-header--variable");
|
header.classList.add("node-header--variable");
|
||||||
header.setAttribute("data-variable-role", role);
|
header.setAttribute("data-variable-role", role);
|
||||||
header.setAttribute("data-variable-type", binding.type);
|
header.setAttribute("data-variable-type", binding.type);
|
||||||
|
header.style.setProperty("--overview-variable-color", getTypeColor(binding.type));
|
||||||
header.setAttribute("data-variable-scope", isLocal ? "local" : "global");
|
header.setAttribute("data-variable-scope", isLocal ? "local" : "global");
|
||||||
const prefixBase = role === "set" ? "Set" : "Get";
|
const prefixBase = role === "set" ? "Set" : "Get";
|
||||||
const prefix = isLocal ? `${prefixBase} Local` : prefixBase;
|
const prefix = isLocal ? `${prefixBase} Local` : prefixBase;
|
||||||
@@ -4739,15 +4990,24 @@ export class BlueprintWorkspace {
|
|||||||
* @param {PointerEvent} event Pointer interaction payload.
|
* @param {PointerEvent} event Pointer interaction payload.
|
||||||
*/
|
*/
|
||||||
#handleConnectionPointerDown(event) {
|
#handleConnectionPointerDown(event) {
|
||||||
if (!(event.target instanceof SVGPathElement)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.button !== 0 || !event.altKey) {
|
if (event.button !== 0 || !event.altKey) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const path = /** @type {SVGPathElement} */ (event.target);
|
// The nodeLayer div sits above the SVG in z-order, so event.target is usually a
|
||||||
|
// node element rather than an SVGPathElement. Fall back to a point-based lookup.
|
||||||
|
let path = event.target instanceof SVGPathElement ? /** @type {SVGPathElement} */ (event.target) : null;
|
||||||
|
if (!path) {
|
||||||
|
const hits = document.elementsFromPoint(event.clientX, event.clientY);
|
||||||
|
path = /** @type {SVGPathElement | null} */ (
|
||||||
|
hits.find((el) => el instanceof SVGPathElement && /** @type {SVGPathElement} */ (el).dataset.connectionId) ?? null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!path) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const connectionId = path.dataset.connectionId;
|
const connectionId = path.dataset.connectionId;
|
||||||
if (!connectionId) {
|
if (!connectionId) {
|
||||||
return;
|
return;
|
||||||
@@ -4828,7 +5088,7 @@ export class BlueprintWorkspace {
|
|||||||
* Spawns a node at the requested context menu position.
|
* Spawns a node at the requested context menu position.
|
||||||
*
|
*
|
||||||
* @param {PaletteNodeDefinition} definition Node definition to instantiate.
|
* @param {PaletteNodeDefinition} definition Node definition to instantiate.
|
||||||
* @param {{ x: number, y: number }} spawnPosition Workspace-relative spawn coordinates.
|
* @param {{ x: number, y: number }} spawnPosition Screen-relative spawn coordinates (relative to workspace element).
|
||||||
* @returns {import('../core/BlueprintNode.js').BlueprintNode | null}
|
* @returns {import('../core/BlueprintNode.js').BlueprintNode | null}
|
||||||
*/
|
*/
|
||||||
spawnNodeFromContextMenu(definition, spawnPosition) {
|
spawnNodeFromContextMenu(definition, spawnPosition) {
|
||||||
@@ -4836,7 +5096,14 @@ export class BlueprintWorkspace {
|
|||||||
x: Math.max(0, spawnPosition.x),
|
x: Math.max(0, spawnPosition.x),
|
||||||
y: Math.max(0, spawnPosition.y),
|
y: Math.max(0, spawnPosition.y),
|
||||||
};
|
};
|
||||||
const worldSpawn = this.navigationManager.screenPointToWorld(clamped);
|
// Convert screen-relative position to world coordinates
|
||||||
|
const zoom = this.navigationManager?.getZoomLevel() ?? this.zoomLevel ?? 1;
|
||||||
|
const clampedZoom = Math.max(0.01, zoom);
|
||||||
|
const offset = this.navigationManager?.getEffectiveOffset() ?? { x: 0, y: 0 };
|
||||||
|
const worldSpawn = {
|
||||||
|
x: clamped.x / clampedZoom - offset.x,
|
||||||
|
y: clamped.y / clampedZoom - offset.y,
|
||||||
|
};
|
||||||
const spawn = WorkspaceGeometry.snapPositionToGrid(this, worldSpawn);
|
const spawn = WorkspaceGeometry.snapPositionToGrid(this, worldSpawn);
|
||||||
const pendingConnectionSnapshot = this.pendingConnectionSpawn
|
const pendingConnectionSnapshot = this.pendingConnectionSpawn
|
||||||
? {
|
? {
|
||||||
@@ -5179,23 +5446,20 @@ export class BlueprintWorkspace {
|
|||||||
const workspaceRect = this.workspaceElement.getBoundingClientRect();
|
const workspaceRect = this.workspaceElement.getBoundingClientRect();
|
||||||
const startRect = startHandle.getBoundingClientRect();
|
const startRect = startHandle.getBoundingClientRect();
|
||||||
const zoom = this.zoomLevel || 1;
|
const zoom = this.zoomLevel || 1;
|
||||||
|
const offset = this.navigationManager?.getEffectiveOffset() ?? this.workspaceBackgroundOffset ?? { x: 0, y: 0 };
|
||||||
const anchor = {
|
const anchor = {
|
||||||
x:
|
x: (startRect.left - workspaceRect.left + startRect.width / 2) / zoom - offset.x,
|
||||||
(startRect.left - workspaceRect.left + startRect.width / 2) /
|
y: (startRect.top - workspaceRect.top + startRect.height / 2) / zoom - offset.y,
|
||||||
zoom,
|
|
||||||
y:
|
|
||||||
(startRect.top - workspaceRect.top + startRect.height / 2) /
|
|
||||||
zoom,
|
|
||||||
};
|
};
|
||||||
const pointer = {
|
const pointer = {
|
||||||
x: (clientX - workspaceRect.left) / zoom,
|
x: (clientX - workspaceRect.left) / zoom - offset.x,
|
||||||
y: (clientY - workspaceRect.top) / zoom,
|
y: (clientY - workspaceRect.top) / zoom - offset.y,
|
||||||
};
|
};
|
||||||
|
|
||||||
const start = direction === "output" ? anchor : pointer;
|
const start = direction === "output" ? anchor : pointer;
|
||||||
const end = direction === "output" ? pointer : anchor;
|
const end = direction === "output" ? pointer : anchor;
|
||||||
|
|
||||||
const controlOffset = Math.max(60 / zoom, Math.abs(end.x - start.x) * 0.5);
|
const controlOffset = Math.max(60, Math.abs(end.x - start.x) * 0.5);
|
||||||
const d = `M ${start.x} ${start.y} C ${start.x + controlOffset} ${
|
const d = `M ${start.x} ${start.y} C ${start.x + controlOffset} ${
|
||||||
start.y
|
start.y
|
||||||
} ${end.x - controlOffset} ${end.y} ${end.x} ${end.y}`;
|
} ${end.x - controlOffset} ${end.y} ${end.x} ${end.y}`;
|
||||||
@@ -5374,10 +5638,88 @@ export class BlueprintWorkspace {
|
|||||||
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
||||||
path.classList.add("connection-path");
|
path.classList.add("connection-path");
|
||||||
path.dataset.type = kind;
|
path.dataset.type = kind;
|
||||||
|
path.style.stroke = getTypeColor(kind);
|
||||||
this.connectionLayer.appendChild(path);
|
this.connectionLayer.appendChild(path);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the SVG defs element on the connection layer, creating it if absent.
|
||||||
|
*
|
||||||
|
* @returns {SVGDefsElement}
|
||||||
|
*/
|
||||||
|
#getOrCreateSvgDefs() {
|
||||||
|
let defs = this.connectionLayer.querySelector("defs");
|
||||||
|
if (!defs) {
|
||||||
|
defs = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
||||||
|
this.connectionLayer.prepend(defs);
|
||||||
|
}
|
||||||
|
return /** @type {SVGDefsElement} */ (defs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates or updates a linearGradient element for a cross-type wire.
|
||||||
|
*
|
||||||
|
* @param {SVGDefsElement} defs Defs container.
|
||||||
|
* @param {string} connectionId Connection identifier.
|
||||||
|
* @param {string} fromKind Source pin kind.
|
||||||
|
* @param {string} toKind Target pin kind.
|
||||||
|
* @param {{x:number,y:number}} start Gradient start point.
|
||||||
|
* @param {{x:number,y:number}} end Gradient end point.
|
||||||
|
* @returns {string} The gradient element id.
|
||||||
|
*/
|
||||||
|
#upsertConnectionGradient(defs, connectionId, fromKind, toKind, start, end) {
|
||||||
|
const gradId = `cgrad-${connectionId}`;
|
||||||
|
let grad = defs.querySelector(`#${CSS.escape(gradId)}`);
|
||||||
|
if (!grad) {
|
||||||
|
grad = document.createElementNS(
|
||||||
|
"http://www.w3.org/2000/svg",
|
||||||
|
"linearGradient"
|
||||||
|
);
|
||||||
|
grad.id = gradId;
|
||||||
|
grad.setAttribute("gradientUnits", "userSpaceOnUse");
|
||||||
|
const stop1 = document.createElementNS(
|
||||||
|
"http://www.w3.org/2000/svg",
|
||||||
|
"stop"
|
||||||
|
);
|
||||||
|
stop1.setAttribute("offset", "0%");
|
||||||
|
const stop2 = document.createElementNS(
|
||||||
|
"http://www.w3.org/2000/svg",
|
||||||
|
"stop"
|
||||||
|
);
|
||||||
|
stop2.setAttribute("offset", "100%");
|
||||||
|
grad.appendChild(stop1);
|
||||||
|
grad.appendChild(stop2);
|
||||||
|
defs.appendChild(grad);
|
||||||
|
}
|
||||||
|
|
||||||
|
grad.setAttribute("x1", String(start.x));
|
||||||
|
grad.setAttribute("y1", String(start.y));
|
||||||
|
grad.setAttribute("x2", String(end.x));
|
||||||
|
grad.setAttribute("y2", String(end.y));
|
||||||
|
|
||||||
|
const style = getComputedStyle(this.workspaceElement);
|
||||||
|
const stops = grad.querySelectorAll("stop");
|
||||||
|
stops[0].setAttribute(
|
||||||
|
"stop-color",
|
||||||
|
this.#getPinKindColor(style, fromKind)
|
||||||
|
);
|
||||||
|
stops[1].setAttribute("stop-color", this.#getPinKindColor(style, toKind));
|
||||||
|
|
||||||
|
return gradId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves the color for a given pin kind.
|
||||||
|
*
|
||||||
|
* @param {CSSStyleDeclaration} _style Computed style (unused, kept for API compatibility).
|
||||||
|
* @param {string} kind Pin kind identifier.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
#getPinKindColor(_style, kind) {
|
||||||
|
return getTypeColor(kind);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests a connection re-render on the next animation frame.
|
* Requests a connection re-render on the next animation frame.
|
||||||
*/
|
*/
|
||||||
@@ -5445,6 +5787,7 @@ export class BlueprintWorkspace {
|
|||||||
const targetHeight = Math.max(1, workspaceRect.height / zoom);
|
const targetHeight = Math.max(1, workspaceRect.height / zoom);
|
||||||
this.connectionLayer.style.width = `${targetWidth}px`;
|
this.connectionLayer.style.width = `${targetWidth}px`;
|
||||||
this.connectionLayer.style.height = `${targetHeight}px`;
|
this.connectionLayer.style.height = `${targetHeight}px`;
|
||||||
|
this.connectionLayer.setAttribute("overflow", "visible");
|
||||||
if (this.connectionLayer.hasAttribute("viewBox")) {
|
if (this.connectionLayer.hasAttribute("viewBox")) {
|
||||||
this.connectionLayer.removeAttribute("viewBox");
|
this.connectionLayer.removeAttribute("viewBox");
|
||||||
}
|
}
|
||||||
@@ -5452,6 +5795,7 @@ export class BlueprintWorkspace {
|
|||||||
this.connectionLayer.removeAttribute("preserveAspectRatio");
|
this.connectionLayer.removeAttribute("preserveAspectRatio");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const defs = this.#getOrCreateSvgDefs();
|
||||||
const activeIds = new Set();
|
const activeIds = new Set();
|
||||||
this.graph.getConnections().forEach((connection) => {
|
this.graph.getConnections().forEach((connection) => {
|
||||||
activeIds.add(connection.id);
|
activeIds.add(connection.id);
|
||||||
@@ -5461,7 +5805,6 @@ export class BlueprintWorkspace {
|
|||||||
this.connectionElements.set(connection.id, path);
|
this.connectionElements.set(connection.id, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
path.dataset.type = connection.kind;
|
|
||||||
path.dataset.connectionId = connection.id;
|
path.dataset.connectionId = connection.id;
|
||||||
const geometry = this.#computeConnectionGeometry(
|
const geometry = this.#computeConnectionGeometry(
|
||||||
connection.from,
|
connection.from,
|
||||||
@@ -5472,18 +5815,53 @@ export class BlueprintWorkspace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { start, end } = geometry;
|
const { start, end } = geometry;
|
||||||
const controlOffset = Math.max(60 / zoom, Math.abs(end.x - start.x) * 0.5);
|
const controlOffset = Math.max(60, Math.abs(end.x - start.x) * 0.5);
|
||||||
const d = `M ${start.x} ${start.y} C ${start.x + controlOffset} ${
|
const d = `M ${start.x} ${start.y} C ${start.x + controlOffset} ${
|
||||||
start.y
|
start.y
|
||||||
} ${end.x - controlOffset} ${end.y} ${end.x} ${end.y}`;
|
} ${end.x - controlOffset} ${end.y} ${end.x} ${end.y}`;
|
||||||
path.dataset.active = "false";
|
path.dataset.active = "false";
|
||||||
path.setAttribute("d", d);
|
path.setAttribute("d", d);
|
||||||
|
|
||||||
|
const fromPin = this.graph.nodes
|
||||||
|
.get(connection.from.nodeId)
|
||||||
|
?.getPin(connection.from.pinId);
|
||||||
|
const toPin = this.graph.nodes
|
||||||
|
.get(connection.to.nodeId)
|
||||||
|
?.getPin(connection.to.pinId);
|
||||||
|
const fromKind = fromPin?.kind;
|
||||||
|
const toKind = toPin?.kind;
|
||||||
|
|
||||||
|
if (
|
||||||
|
fromKind &&
|
||||||
|
toKind &&
|
||||||
|
fromKind !== toKind &&
|
||||||
|
fromKind !== "any" &&
|
||||||
|
toKind !== "any"
|
||||||
|
) {
|
||||||
|
path.dataset.type = "mixed";
|
||||||
|
const gradId = this.#upsertConnectionGradient(
|
||||||
|
defs,
|
||||||
|
connection.id,
|
||||||
|
fromKind,
|
||||||
|
toKind,
|
||||||
|
start,
|
||||||
|
end
|
||||||
|
);
|
||||||
|
path.style.stroke = "";
|
||||||
|
path.setAttribute("stroke", `url(#${gradId})`);
|
||||||
|
} else {
|
||||||
|
path.dataset.type = connection.kind;
|
||||||
|
path.removeAttribute("stroke");
|
||||||
|
path.style.stroke = getTypeColor(connection.kind);
|
||||||
|
defs.querySelector(`#cgrad-${connection.id}`)?.remove();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.connectionElements.forEach((path, id) => {
|
this.connectionElements.forEach((path, id) => {
|
||||||
if (!activeIds.has(id)) {
|
if (!activeIds.has(id)) {
|
||||||
path.remove();
|
path.remove();
|
||||||
this.connectionElements.delete(id);
|
this.connectionElements.delete(id);
|
||||||
|
defs.querySelector(`#cgrad-${id}`)?.remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -5504,22 +5882,17 @@ export class BlueprintWorkspace {
|
|||||||
|
|
||||||
const workspaceRect = this.workspaceElement.getBoundingClientRect();
|
const workspaceRect = this.workspaceElement.getBoundingClientRect();
|
||||||
const zoom = this.zoomLevel || 1;
|
const zoom = this.zoomLevel || 1;
|
||||||
|
const offset = this.navigationManager?.getEffectiveOffset() ?? this.workspaceBackgroundOffset ?? { x: 0, y: 0 };
|
||||||
const startRect = startHandle.getBoundingClientRect();
|
const startRect = startHandle.getBoundingClientRect();
|
||||||
const endRect = endHandle.getBoundingClientRect();
|
const endRect = endHandle.getBoundingClientRect();
|
||||||
return {
|
return {
|
||||||
start: {
|
start: {
|
||||||
x:
|
x: (startRect.left - workspaceRect.left + startRect.width / 2) / zoom - offset.x,
|
||||||
(startRect.left - workspaceRect.left + startRect.width / 2) /
|
y: (startRect.top - workspaceRect.top + startRect.height / 2) / zoom - offset.y,
|
||||||
zoom,
|
|
||||||
y:
|
|
||||||
(startRect.top - workspaceRect.top + startRect.height / 2) /
|
|
||||||
zoom,
|
|
||||||
},
|
},
|
||||||
end: {
|
end: {
|
||||||
x:
|
x: (endRect.left - workspaceRect.left + endRect.width / 2) / zoom - offset.x,
|
||||||
(endRect.left - workspaceRect.left + endRect.width / 2) / zoom,
|
y: (endRect.top - workspaceRect.top + endRect.height / 2) / zoom - offset.y,
|
||||||
y:
|
|
||||||
(endRect.top - workspaceRect.top + endRect.height / 2) / zoom,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -5560,14 +5933,11 @@ export class BlueprintWorkspace {
|
|||||||
const rect = handle.getBoundingClientRect();
|
const rect = handle.getBoundingClientRect();
|
||||||
const workspaceRect = this.workspaceElement.getBoundingClientRect();
|
const workspaceRect = this.workspaceElement.getBoundingClientRect();
|
||||||
const zoom = this.zoomLevel || 1;
|
const zoom = this.zoomLevel || 1;
|
||||||
|
const offset = this.navigationManager?.getEffectiveOffset() ?? this.workspaceBackgroundOffset ?? { x: 0, y: 0 };
|
||||||
|
|
||||||
return {
|
return {
|
||||||
x:
|
x: (rect.left - workspaceRect.left + rect.width / 2) / zoom - offset.x,
|
||||||
(rect.left - workspaceRect.left + rect.width / 2) /
|
y: (rect.top - workspaceRect.top + rect.height / 2) / zoom - offset.y,
|
||||||
zoom,
|
|
||||||
y:
|
|
||||||
(rect.top - workspaceRect.top + rect.height / 2) /
|
|
||||||
zoom,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5767,10 +6137,7 @@ export class BlueprintWorkspace {
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
#arePinKindsCompatible(outputKind, inputKind) {
|
#arePinKindsCompatible(outputKind, inputKind) {
|
||||||
if (inputKind === "any" || outputKind === "any") {
|
return areTypesCompatible(outputKind, inputKind);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return outputKind === inputKind;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6078,12 +6445,14 @@ export class BlueprintWorkspace {
|
|||||||
row.className = "custom-event-parameter-row";
|
row.className = "custom-event-parameter-row";
|
||||||
row.dataset.parameterId = parameter.id;
|
row.dataset.parameterId = parameter.id;
|
||||||
row.dataset.parameterType = parameter.type;
|
row.dataset.parameterType = parameter.type;
|
||||||
|
row.style.setProperty("--overview-variable-color", getTypeColor(parameter.type));
|
||||||
|
|
||||||
const typeButton = document.createElement("button");
|
const typeButton = document.createElement("button");
|
||||||
typeButton.type = "button";
|
typeButton.type = "button";
|
||||||
typeButton.className =
|
typeButton.className =
|
||||||
"variable-type-button custom-event-parameter-type-button";
|
"variable-type-button custom-event-parameter-type-button";
|
||||||
typeButton.dataset.variableType = parameter.type;
|
typeButton.dataset.variableType = parameter.type;
|
||||||
|
typeButton.style.setProperty("--overview-variable-color", getTypeColor(parameter.type));
|
||||||
typeButton.setAttribute("aria-haspopup", "menu");
|
typeButton.setAttribute("aria-haspopup", "menu");
|
||||||
typeButton.setAttribute("aria-expanded", "false");
|
typeButton.setAttribute("aria-expanded", "false");
|
||||||
row.appendChild(typeButton);
|
row.appendChild(typeButton);
|
||||||
@@ -6099,7 +6468,9 @@ export class BlueprintWorkspace {
|
|||||||
const display = this.#formatVariableType(normalized);
|
const display = this.#formatVariableType(normalized);
|
||||||
const referenceName = nameInputElement.value.trim() || parameter.id;
|
const referenceName = nameInputElement.value.trim() || parameter.id;
|
||||||
row.dataset.parameterType = normalized;
|
row.dataset.parameterType = normalized;
|
||||||
|
row.style.setProperty("--overview-variable-color", getTypeColor(normalized));
|
||||||
typeButton.dataset.variableType = normalized;
|
typeButton.dataset.variableType = normalized;
|
||||||
|
typeButton.style.setProperty("--overview-variable-color", getTypeColor(normalized));
|
||||||
typeButton.title = `Type: ${display}`;
|
typeButton.title = `Type: ${display}`;
|
||||||
typeButton.setAttribute(
|
typeButton.setAttribute(
|
||||||
"aria-label",
|
"aria-label",
|
||||||
@@ -6356,10 +6727,12 @@ export class BlueprintWorkspace {
|
|||||||
*/
|
*/
|
||||||
applySerializedWorkspace(payload) {
|
applySerializedWorkspace(payload) {
|
||||||
this.isRestoring = true;
|
this.isRestoring = true;
|
||||||
|
this.#stopPeriodicUpdate();
|
||||||
try {
|
try {
|
||||||
this.persistenceManager.cancelScheduledPersist();
|
this.persistenceManager.cancelScheduledPersist();
|
||||||
|
|
||||||
this.contextMenuManager.hide();
|
this.contextMenuManager.hide();
|
||||||
|
this.nodeContextMenu?.hide();
|
||||||
this.#closeTypeDropdown();
|
this.#closeTypeDropdown();
|
||||||
this.dragManager.removePaletteGhost();
|
this.dragManager.removePaletteGhost();
|
||||||
this.dragManager.removeNodeGhost();
|
this.dragManager.removeNodeGhost();
|
||||||
@@ -6368,6 +6741,7 @@ export class BlueprintWorkspace {
|
|||||||
this.connectionElements.forEach((path) => path.remove());
|
this.connectionElements.forEach((path) => path.remove());
|
||||||
this.nodeElements.clear();
|
this.nodeElements.clear();
|
||||||
this.connectionElements.clear();
|
this.connectionElements.clear();
|
||||||
|
this.connectionLayer.querySelector("defs")?.remove();
|
||||||
this.inlineEditorManager.clear();
|
this.inlineEditorManager.clear();
|
||||||
this.nodeDragRotation.clear();
|
this.nodeDragRotation.clear();
|
||||||
this.dragManager.stopNodeRotationDecay();
|
this.dragManager.stopNodeRotationDecay();
|
||||||
@@ -6410,7 +6784,8 @@ export class BlueprintWorkspace {
|
|||||||
entry.type === "string" ||
|
entry.type === "string" ||
|
||||||
entry.type === "boolean" ||
|
entry.type === "boolean" ||
|
||||||
entry.type === "any" ||
|
entry.type === "any" ||
|
||||||
entry.type === "table"
|
entry.type === "table" ||
|
||||||
|
entry.type === "color"
|
||||||
? entry.type
|
? entry.type
|
||||||
: "any";
|
: "any";
|
||||||
const defaultValue = this.#normalizeVariableDefault(
|
const defaultValue = this.#normalizeVariableDefault(
|
||||||
@@ -6480,7 +6855,6 @@ export class BlueprintWorkspace {
|
|||||||
this.isPaletteVisible = paletteVisible;
|
this.isPaletteVisible = paletteVisible;
|
||||||
this.#applyPaletteVisibility(this.isPaletteVisible);
|
this.#applyPaletteVisibility(this.isPaletteVisible);
|
||||||
|
|
||||||
this.navigationManager.setBackgroundOffset({ x: 0, y: 0 });
|
|
||||||
this.#updateProjectSettingsToggle();
|
this.#updateProjectSettingsToggle();
|
||||||
this.#renderOverview();
|
this.#renderOverview();
|
||||||
this.#setInspectorView("default");
|
this.#setInspectorView("default");
|
||||||
@@ -6489,6 +6863,7 @@ export class BlueprintWorkspace {
|
|||||||
this.#refreshLuaOutput();
|
this.#refreshLuaOutput();
|
||||||
} finally {
|
} finally {
|
||||||
this.isRestoring = false;
|
this.isRestoring = false;
|
||||||
|
this.#startPeriodicUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,184 @@
|
|||||||
|
/**
|
||||||
|
* Ordered PICO-8 palette hex strings, indices 0–15.
|
||||||
|
*
|
||||||
|
* @type {ReadonlyArray<string>}
|
||||||
|
*/
|
||||||
|
const PICO8_COLORS = Object.freeze([
|
||||||
|
'#000002', '#1D2B53', '#7E2553', '#008751',
|
||||||
|
'#AB5236', '#5F574F', '#C2C3C7', '#FFF1E8',
|
||||||
|
'#FF004D', '#FFA300', '#FFEC27', '#00E436',
|
||||||
|
'#29ADFF', '#83769C', '#FF77A8', '#FFCCAA',
|
||||||
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {{ element: HTMLElement, setValue: (index: number) => void }} ColorSwatchPickerInstance
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds an inline PICO-8 color swatch picker control.
|
||||||
|
*
|
||||||
|
* Renders a colored trigger button that opens a 4×4 grid of all 16 PICO-8
|
||||||
|
* palette swatches. Clicking a swatch fires `onChange` with the selected
|
||||||
|
* palette index (0–15) and closes the dropdown.
|
||||||
|
*
|
||||||
|
* @param {{
|
||||||
|
* id?: string,
|
||||||
|
* value: number,
|
||||||
|
* onChange: (index: number) => void,
|
||||||
|
* }} options Picker configuration.
|
||||||
|
* @returns {ColorSwatchPickerInstance}
|
||||||
|
*/
|
||||||
|
export function createColorSwatchPicker({ id, value, onChange }) {
|
||||||
|
const wrapper = document.createElement('div');
|
||||||
|
wrapper.className = 'color-swatch-picker';
|
||||||
|
|
||||||
|
const trigger = document.createElement('button');
|
||||||
|
trigger.type = 'button';
|
||||||
|
trigger.className = 'color-swatch-trigger';
|
||||||
|
if (id) {
|
||||||
|
trigger.id = id;
|
||||||
|
}
|
||||||
|
trigger.setAttribute('aria-haspopup', 'menu');
|
||||||
|
trigger.setAttribute('aria-expanded', 'false');
|
||||||
|
wrapper.appendChild(trigger);
|
||||||
|
|
||||||
|
const dropdown = document.createElement('div');
|
||||||
|
dropdown.className = 'color-swatch-dropdown';
|
||||||
|
dropdown.setAttribute('role', 'menu');
|
||||||
|
// Appended to body on open so it escapes overflow:hidden on node cards.
|
||||||
|
|
||||||
|
/** @type {Array<HTMLButtonElement>} */
|
||||||
|
const swatchButtons = [];
|
||||||
|
|
||||||
|
/** @type {((event: MouseEvent) => void) | null} */
|
||||||
|
let outsideClickHandler = null;
|
||||||
|
|
||||||
|
/** @type {(() => void) | null} */
|
||||||
|
let scrollAbortHandler = null;
|
||||||
|
|
||||||
|
const repositionDropdown = () => {
|
||||||
|
const rect = trigger.getBoundingClientRect();
|
||||||
|
dropdown.style.top = `${rect.bottom + 4}px`;
|
||||||
|
dropdown.style.left = `${rect.left}px`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeDropdown = () => {
|
||||||
|
if (dropdown.isConnected) {
|
||||||
|
dropdown.remove();
|
||||||
|
}
|
||||||
|
trigger.setAttribute('aria-expanded', 'false');
|
||||||
|
if (outsideClickHandler) {
|
||||||
|
document.removeEventListener('click', outsideClickHandler, true);
|
||||||
|
outsideClickHandler = null;
|
||||||
|
}
|
||||||
|
if (scrollAbortHandler) {
|
||||||
|
document.removeEventListener('scroll', scrollAbortHandler, true);
|
||||||
|
scrollAbortHandler = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const openDropdown = () => {
|
||||||
|
repositionDropdown();
|
||||||
|
document.body.appendChild(dropdown);
|
||||||
|
trigger.setAttribute('aria-expanded', 'true');
|
||||||
|
outsideClickHandler = (event) => {
|
||||||
|
if (
|
||||||
|
!(event.target instanceof Node) ||
|
||||||
|
(!wrapper.contains(event.target) && !dropdown.contains(event.target))
|
||||||
|
) {
|
||||||
|
closeDropdown();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
scrollAbortHandler = () => closeDropdown();
|
||||||
|
document.addEventListener('click', outsideClickHandler, true);
|
||||||
|
document.addEventListener('scroll', scrollAbortHandler, true);
|
||||||
|
};
|
||||||
|
|
||||||
|
let currentIndex = clampColorIndex(value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the trigger button to reflect the supplied palette index.
|
||||||
|
*
|
||||||
|
* @param {number} index Palette index (0–15).
|
||||||
|
*/
|
||||||
|
const updateTrigger = (index) => {
|
||||||
|
const hex = PICO8_COLORS[index] ?? '#000000';
|
||||||
|
trigger.style.backgroundColor = hex;
|
||||||
|
trigger.title = `Color ${index}`;
|
||||||
|
trigger.setAttribute('aria-label', `Color ${index}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
PICO8_COLORS.forEach((hex, index) => {
|
||||||
|
const swatch = document.createElement('button');
|
||||||
|
swatch.type = 'button';
|
||||||
|
swatch.className = 'color-swatch-option';
|
||||||
|
swatch.style.backgroundColor = hex;
|
||||||
|
swatch.dataset.colorIndex = String(index);
|
||||||
|
swatch.title = String(index);
|
||||||
|
swatch.setAttribute('role', 'menuitemradio');
|
||||||
|
swatch.setAttribute('aria-label', `Color ${index}`);
|
||||||
|
swatch.setAttribute('aria-checked', 'false');
|
||||||
|
|
||||||
|
swatch.addEventListener('pointerdown', (event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
});
|
||||||
|
swatch.addEventListener('click', (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
const selected = index;
|
||||||
|
closeDropdown();
|
||||||
|
if (selected !== currentIndex) {
|
||||||
|
currentIndex = selected;
|
||||||
|
updateTrigger(selected);
|
||||||
|
swatchButtons.forEach((btn, i) => {
|
||||||
|
btn.setAttribute('aria-checked', i === selected ? 'true' : 'false');
|
||||||
|
});
|
||||||
|
onChange(selected);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dropdown.appendChild(swatch);
|
||||||
|
swatchButtons.push(swatch);
|
||||||
|
});
|
||||||
|
|
||||||
|
trigger.addEventListener('pointerdown', (event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
});
|
||||||
|
trigger.addEventListener('click', (event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
if (dropdown.isConnected) {
|
||||||
|
closeDropdown();
|
||||||
|
} else {
|
||||||
|
openDropdown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the picker display without firing `onChange`.
|
||||||
|
*
|
||||||
|
* @param {number} newIndex Palette index (0–15).
|
||||||
|
*/
|
||||||
|
const setValue = (newIndex) => {
|
||||||
|
currentIndex = clampColorIndex(newIndex);
|
||||||
|
updateTrigger(currentIndex);
|
||||||
|
swatchButtons.forEach((btn, i) => {
|
||||||
|
btn.setAttribute('aria-checked', i === currentIndex ? 'true' : 'false');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
setValue(currentIndex);
|
||||||
|
|
||||||
|
return { element: wrapper, setValue };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clamps an arbitrary value to a valid PICO-8 palette index (0–15).
|
||||||
|
*
|
||||||
|
* @param {unknown} value Raw index candidate.
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
function clampColorIndex(value) {
|
||||||
|
const n = typeof value === 'number' ? value : Number(value);
|
||||||
|
const safe = Number.isFinite(n) ? Math.round(n) : 0;
|
||||||
|
return Math.max(0, Math.min(15, safe));
|
||||||
|
}
|
||||||
@@ -0,0 +1,385 @@
|
|||||||
|
/**
|
||||||
|
* Manages embedded Pico-8 cart preview within the application.
|
||||||
|
*/
|
||||||
|
export class EmbeddedPreview {
|
||||||
|
/**
|
||||||
|
* @param {object} options Configuration options
|
||||||
|
* @param {() => string} options.getLuaCode Function to get generated Lua code
|
||||||
|
*/
|
||||||
|
constructor(options) {
|
||||||
|
this.getLuaCode = options.getLuaCode;
|
||||||
|
this.modal = null;
|
||||||
|
this.canvas = null;
|
||||||
|
this.isOpen = false;
|
||||||
|
this.isRunning = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the preview modal if it doesn't exist
|
||||||
|
*/
|
||||||
|
#ensureModal() {
|
||||||
|
if (this.modal) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create modal structure
|
||||||
|
this.modal = document.createElement('div');
|
||||||
|
this.modal.className = 'preview-modal';
|
||||||
|
this.modal.setAttribute('role', 'dialog');
|
||||||
|
this.modal.setAttribute('aria-modal', 'true');
|
||||||
|
this.modal.setAttribute('aria-labelledby', 'previewModalTitle');
|
||||||
|
this.modal.hidden = true;
|
||||||
|
|
||||||
|
const backdrop = document.createElement('div');
|
||||||
|
backdrop.className = 'preview-modal__backdrop';
|
||||||
|
backdrop.addEventListener('click', () => this.close());
|
||||||
|
|
||||||
|
const panel = document.createElement('div');
|
||||||
|
panel.className = 'preview-modal__panel';
|
||||||
|
|
||||||
|
const header = document.createElement('div');
|
||||||
|
header.className = 'preview-modal__header';
|
||||||
|
|
||||||
|
// Header controls (left side)
|
||||||
|
const headerControls = document.createElement('div');
|
||||||
|
headerControls.className = 'preview-header-controls';
|
||||||
|
|
||||||
|
const refreshButton = document.createElement('button');
|
||||||
|
refreshButton.type = 'button';
|
||||||
|
refreshButton.className = 'preview-header-btn';
|
||||||
|
refreshButton.setAttribute('aria-label', 'Reload cart');
|
||||||
|
refreshButton.innerHTML = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>';
|
||||||
|
refreshButton.addEventListener('click', () => this.#runCart());
|
||||||
|
|
||||||
|
const stopButton = document.createElement('button');
|
||||||
|
stopButton.type = 'button';
|
||||||
|
stopButton.className = 'preview-header-btn preview-header-btn--stop';
|
||||||
|
stopButton.setAttribute('aria-label', 'Stop cart');
|
||||||
|
stopButton.innerHTML = '<svg width="22" height="22" viewBox="0 0 24 24" fill="currentColor"><rect x="4" y="4" width="16" height="16" rx="2"/></svg>';
|
||||||
|
stopButton.addEventListener('click', () => this.#stopCart());
|
||||||
|
|
||||||
|
const saveButton = document.createElement('button');
|
||||||
|
saveButton.type = 'button';
|
||||||
|
saveButton.className = 'preview-header-btn preview-header-btn--save';
|
||||||
|
saveButton.setAttribute('aria-label', 'Save .p8');
|
||||||
|
saveButton.innerHTML = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>';
|
||||||
|
saveButton.addEventListener('click', () => this.#downloadCart());
|
||||||
|
|
||||||
|
headerControls.appendChild(refreshButton);
|
||||||
|
headerControls.appendChild(stopButton);
|
||||||
|
headerControls.appendChild(saveButton);
|
||||||
|
|
||||||
|
const closeButton = document.createElement('button');
|
||||||
|
closeButton.type = 'button';
|
||||||
|
closeButton.className = 'preview-modal__close';
|
||||||
|
closeButton.setAttribute('aria-label', 'Close preview');
|
||||||
|
closeButton.textContent = '×';
|
||||||
|
closeButton.addEventListener('click', () => this.close());
|
||||||
|
|
||||||
|
header.appendChild(headerControls);
|
||||||
|
header.appendChild(closeButton);
|
||||||
|
|
||||||
|
const content = document.createElement('div');
|
||||||
|
content.className = 'preview-modal__content';
|
||||||
|
|
||||||
|
// Create iframe for PICO-8 player
|
||||||
|
this.iframe = document.createElement('iframe');
|
||||||
|
this.iframe.className = 'preview-iframe';
|
||||||
|
this.iframe.allow = 'gamepad';
|
||||||
|
this.iframe.style.display = 'none';
|
||||||
|
|
||||||
|
// Create the canvas for rendering placeholder
|
||||||
|
this.canvas = document.createElement('canvas');
|
||||||
|
this.canvas.width = 128;
|
||||||
|
this.canvas.height = 128;
|
||||||
|
this.canvas.className = 'preview-canvas';
|
||||||
|
|
||||||
|
content.appendChild(this.iframe);
|
||||||
|
content.appendChild(this.canvas);
|
||||||
|
|
||||||
|
// Refocus iframe when clicking in the modal to ensure input keeps working
|
||||||
|
panel.addEventListener('click', (e) => {
|
||||||
|
if (this.iframe.style.display !== 'none') {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.iframe.focus();
|
||||||
|
if (this.iframe.contentWindow) {
|
||||||
|
this.iframe.contentWindow.focus();
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
panel.appendChild(header);
|
||||||
|
panel.appendChild(content);
|
||||||
|
|
||||||
|
this.modal.appendChild(backdrop);
|
||||||
|
this.modal.appendChild(panel);
|
||||||
|
document.body.appendChild(this.modal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the cart in the embedded preview
|
||||||
|
*/
|
||||||
|
async #runCart() {
|
||||||
|
try {
|
||||||
|
const luaCode = this.getLuaCode();
|
||||||
|
|
||||||
|
if (!luaCode || !luaCode.trim()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isRunning = true;
|
||||||
|
|
||||||
|
// Generate cart content
|
||||||
|
const cartContent = this.#generateCartContent(luaCode);
|
||||||
|
|
||||||
|
// Load cart in iframe using PICO-8 web player
|
||||||
|
await this.#loadCartInPlayer(cartContent);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error running cart:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a cart into the PICO-8 web player
|
||||||
|
*
|
||||||
|
* @param {string} cartData The .p8 cart file content as a string
|
||||||
|
*/
|
||||||
|
async #loadCartInPlayer(cartData) {
|
||||||
|
try {
|
||||||
|
const electronAPI = window.electronAPI;
|
||||||
|
if (!electronAPI?.writePlayerHtml) {
|
||||||
|
throw new Error('Player IPC not available');
|
||||||
|
}
|
||||||
|
|
||||||
|
const cartB64 = btoa(unescape(encodeURIComponent(cartData)));
|
||||||
|
|
||||||
|
// HTML references pico8_edu.js by relative path — both files live in public/.
|
||||||
|
const playerHtml = `<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<style>
|
||||||
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
|
body { background: #1a1a2e; display: flex; align-items: center; justify-content: center; width: 100vw; height: 100vh; overflow: hidden; }
|
||||||
|
#canvas { image-rendering: pixelated; image-rendering: crisp-edges; width: 512px !important; height: 512px !important; border: 8px solid #000; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<canvas id="canvas" width="128" height="128"></canvas>
|
||||||
|
<script>
|
||||||
|
var pico8_state = [];
|
||||||
|
var pico8_buttons = [0,0,0,0,0,0,0,0];
|
||||||
|
var codo_command = 0;
|
||||||
|
var _cartname = ['untitled.p8'];
|
||||||
|
var codo_key_buffer = [];
|
||||||
|
var p8_keyboard_state = 0;
|
||||||
|
var pico8_mouse = [];
|
||||||
|
var pico8_gamepads = { count: 0 };
|
||||||
|
var pico8_gpio = new Array(128).fill(0);
|
||||||
|
var p8_dropped_cart = null;
|
||||||
|
var p8_dropped_cart_name = '';
|
||||||
|
|
||||||
|
var CART_B64 = '${cartB64}';
|
||||||
|
|
||||||
|
// Silence all XHR — PICO-8 makes BBS metadata calls that crash from file:// origin.
|
||||||
|
(function() {
|
||||||
|
function MockXHR() {
|
||||||
|
this.onload = null; this.onerror = null; this.onreadystatechange = null;
|
||||||
|
this.readyState = 0; this.status = 0; this.statusText = '';
|
||||||
|
this.response = null; this.responseText = ''; this.responseType = '';
|
||||||
|
}
|
||||||
|
MockXHR.UNSENT=0; MockXHR.OPENED=1; MockXHR.HEADERS_RECEIVED=2; MockXHR.LOADING=3; MockXHR.DONE=4;
|
||||||
|
MockXHR.prototype.open = function() { this.readyState = 1; };
|
||||||
|
MockXHR.prototype.send = function() {
|
||||||
|
var self = this;
|
||||||
|
setTimeout(function() {
|
||||||
|
self.readyState = 4; self.status = 200; self.statusText = 'OK';
|
||||||
|
self.response = self.responseType === 'arraybuffer' ? new ArrayBuffer(0) : '';
|
||||||
|
self.responseText = '';
|
||||||
|
if (typeof self.onload === 'function') self.onload({ target: self });
|
||||||
|
if (typeof self.onreadystatechange === 'function') self.onreadystatechange();
|
||||||
|
}, 0);
|
||||||
|
};
|
||||||
|
MockXHR.prototype.setRequestHeader = function() {};
|
||||||
|
MockXHR.prototype.getResponseHeader = function() { return null; };
|
||||||
|
MockXHR.prototype.getAllResponseHeaders = function() { return ''; };
|
||||||
|
MockXHR.prototype.abort = function() {};
|
||||||
|
MockXHR.prototype.addEventListener = function(e, fn) {
|
||||||
|
if (e==='load') this.onload=fn;
|
||||||
|
if (e==='error') this.onerror=fn;
|
||||||
|
if (e==='readystatechange') this.onreadystatechange=fn;
|
||||||
|
};
|
||||||
|
MockXHR.prototype.removeEventListener = function() {};
|
||||||
|
window.XMLHttpRequest = MockXHR;
|
||||||
|
})();
|
||||||
|
|
||||||
|
var Module = {
|
||||||
|
arguments: [],
|
||||||
|
canvas: document.getElementById('canvas'),
|
||||||
|
preRun: [function() {
|
||||||
|
if (typeof IDBFS !== 'undefined' && typeof MEMFS !== 'undefined') {
|
||||||
|
var orig = FS.mount.bind(FS);
|
||||||
|
FS.mount = function(type, opts, mp) { return orig(type===IDBFS?MEMFS:type, opts, mp); };
|
||||||
|
}
|
||||||
|
FS.syncfs = function(populate, callback) {
|
||||||
|
var cb = typeof callback==='function' ? callback : typeof populate==='function' ? populate : null;
|
||||||
|
if (cb) setTimeout(function(){ cb(null); }, 0);
|
||||||
|
};
|
||||||
|
}],
|
||||||
|
postRun: [function() {
|
||||||
|
setTimeout(function() {
|
||||||
|
p8_dropped_cart = 'data:application/octet-stream;base64,' + CART_B64;
|
||||||
|
p8_dropped_cart_name = 'picograph.p8';
|
||||||
|
codo_command = 9;
|
||||||
|
|
||||||
|
// After cart loads, inject "run" + Enter to execute it
|
||||||
|
setTimeout(function() {
|
||||||
|
// Push keystrokes: r u n Enter (lowercase ASCII)
|
||||||
|
codo_key_buffer.push(114, 117, 110, 13);
|
||||||
|
}, 300);
|
||||||
|
}, 200);
|
||||||
|
}],
|
||||||
|
print: function(t) { console.log('P8:', t); },
|
||||||
|
printErr: function(t) { console.error('P8:', t); },
|
||||||
|
setStatus: function() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
function pico8_audio_context_suspended() { return false; }
|
||||||
|
</script>
|
||||||
|
<script src="./pico8_edu.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>`;
|
||||||
|
|
||||||
|
const { filePath } = await electronAPI.writePlayerHtml(playerHtml);
|
||||||
|
const fileUrl = 'file:///' + filePath.replace(/\\/g, '/') + '?t=' + Date.now();
|
||||||
|
|
||||||
|
this.iframe.src = 'about:blank';
|
||||||
|
this.iframe.src = fileUrl;
|
||||||
|
this.iframe.style.display = 'block';
|
||||||
|
this.canvas.style.display = 'none';
|
||||||
|
|
||||||
|
// Focus iframe once loaded so it captures keyboard/gamepad input
|
||||||
|
this.iframe.onload = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.iframe.focus();
|
||||||
|
if (this.iframe.contentWindow) {
|
||||||
|
this.iframe.contentWindow.focus();
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
};
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to load player:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the running cart
|
||||||
|
*/
|
||||||
|
#stopCart() {
|
||||||
|
this.isRunning = false;
|
||||||
|
|
||||||
|
// Hide iframe and show canvas
|
||||||
|
if (this.iframe) {
|
||||||
|
this.iframe.src = 'about:blank';
|
||||||
|
this.iframe.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.canvas) {
|
||||||
|
this.canvas.style.display = 'block';
|
||||||
|
const ctx = this.canvas.getContext('2d');
|
||||||
|
if (ctx) {
|
||||||
|
ctx.fillStyle = '#000';
|
||||||
|
ctx.fillRect(0, 0, 128, 128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downloads the current cart as a .p8 file
|
||||||
|
*/
|
||||||
|
#downloadCart() {
|
||||||
|
try {
|
||||||
|
const luaCode = this.getLuaCode();
|
||||||
|
const cartContent = this.#generateCartContent(luaCode);
|
||||||
|
|
||||||
|
const blob = new Blob([cartContent], { type: 'text/plain' });
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url;
|
||||||
|
a.download = `picograph_${Date.now()}.p8`;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
document.body.removeChild(a);
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error downloading cart:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates the .p8 cart file content
|
||||||
|
*
|
||||||
|
* @param {string} luaCode Generated Lua code
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
#generateCartContent(luaCode) {
|
||||||
|
const hasUpdateCallback = /function\s+_update(?:60)?\b|_update(?:60)?\s*=/.test(luaCode);
|
||||||
|
const hasDrawCallback = /function\s+_draw\b|_draw\s*=/.test(luaCode);
|
||||||
|
const fallback = (hasUpdateCallback && hasDrawCallback) ? '' :
|
||||||
|
(!hasUpdateCallback ? '\nfunction _update()\nend\n' : '') +
|
||||||
|
(!hasDrawCallback ? '\nfunction _draw()\n cls()\n print("picograph ok",2,60,7)\nend\n' : '');
|
||||||
|
const content = `pico-8 cartridge // http://www.pico-8.com
|
||||||
|
version 41
|
||||||
|
__lua__
|
||||||
|
${luaCode}${fallback}
|
||||||
|
__gfx__
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
`;
|
||||||
|
// Ensure Unix line endings (PICO-8 tools expect \n, not \r\n)
|
||||||
|
return content.replace(/\r\n/g, '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the preview modal
|
||||||
|
*/
|
||||||
|
open() {
|
||||||
|
this.#ensureModal();
|
||||||
|
this.modal.hidden = false;
|
||||||
|
this.isOpen = true;
|
||||||
|
|
||||||
|
// Auto-run the cart
|
||||||
|
this.#runCart();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the preview modal
|
||||||
|
*/
|
||||||
|
close() {
|
||||||
|
this.#stopCart();
|
||||||
|
if (this.modal) {
|
||||||
|
this.modal.hidden = true;
|
||||||
|
this.isOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles the preview modal
|
||||||
|
*/
|
||||||
|
toggle() {
|
||||||
|
if (this.isOpen) {
|
||||||
|
this.close();
|
||||||
|
} else {
|
||||||
|
this.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
import { spawn } from 'child_process';
|
||||||
|
import { writeFile } from 'fs/promises';
|
||||||
|
import { join } from 'path';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages cart preview functionality
|
||||||
|
*/
|
||||||
|
export class PreviewManager {
|
||||||
|
/**
|
||||||
|
* @param {object} options Configuration options
|
||||||
|
* @param {() => string} options.getLuaCode Function to get generated Lua code
|
||||||
|
* @param {string} options.fake08Path Path to fake-08 executable
|
||||||
|
*/
|
||||||
|
constructor(options) {
|
||||||
|
this.getLuaCode = options.getLuaCode;
|
||||||
|
this.fake08Path = options.fake08Path || null;
|
||||||
|
this.currentProcess = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports the current graph as a .p8 file
|
||||||
|
*
|
||||||
|
* @param {string} outputPath Path to save the .p8 file
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async exportCart(outputPath) {
|
||||||
|
const luaCode = this.getLuaCode();
|
||||||
|
|
||||||
|
// Create basic .p8 cart format
|
||||||
|
const cartContent = `pico-8 cartridge // http://www.pico-8.com
|
||||||
|
version 41
|
||||||
|
__lua__
|
||||||
|
${luaCode}
|
||||||
|
__gfx__
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
`;
|
||||||
|
|
||||||
|
await writeFile(outputPath, cartContent, 'utf8');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launches the preview with fake-08
|
||||||
|
*
|
||||||
|
* @param {string} cartPath Path to the .p8 file
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async launchPreview(cartPath) {
|
||||||
|
if (!this.fake08Path) {
|
||||||
|
throw new Error('fake-08 path not configured');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kill existing preview if running
|
||||||
|
if (this.currentProcess) {
|
||||||
|
this.currentProcess.kill();
|
||||||
|
this.currentProcess = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.currentProcess = spawn(this.fake08Path, [cartPath]);
|
||||||
|
|
||||||
|
this.currentProcess.on('error', (err) => {
|
||||||
|
console.error('Failed to launch preview:', err);
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.currentProcess.on('exit', (code) => {
|
||||||
|
console.log(`Preview exited with code ${code}`);
|
||||||
|
this.currentProcess = null;
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports and previews the current cart
|
||||||
|
*
|
||||||
|
* @param {string} [tempPath] Optional path for temporary cart file
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async exportAndPreview(tempPath = null) {
|
||||||
|
const outputPath = tempPath || join(process.cwd(), 'temp_preview.p8');
|
||||||
|
|
||||||
|
await this.exportCart(outputPath);
|
||||||
|
|
||||||
|
if (this.fake08Path) {
|
||||||
|
await this.launchPreview(outputPath);
|
||||||
|
} else {
|
||||||
|
console.log(`Cart exported to: ${outputPath}`);
|
||||||
|
console.log('fake-08 not configured - cannot launch preview');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops any running preview
|
||||||
|
*/
|
||||||
|
stopPreview() {
|
||||||
|
if (this.currentProcess) {
|
||||||
|
this.currentProcess.kill();
|
||||||
|
this.currentProcess = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,622 @@
|
|||||||
|
import { SpriteSheet } from "../core/SpriteSheet.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interactive sprite sheet editor for PICO-8.
|
||||||
|
*/
|
||||||
|
export class SpriteEditor {
|
||||||
|
/**
|
||||||
|
* @param {HTMLElement} container Parent element for the editor.
|
||||||
|
* @param {SpriteSheet} [spriteSheet] Existing sprite sheet or creates new one.
|
||||||
|
*/
|
||||||
|
constructor(container, spriteSheet = null) {
|
||||||
|
this.container = container;
|
||||||
|
this.spriteSheet = spriteSheet || new SpriteSheet();
|
||||||
|
|
||||||
|
/** @type {number} Currently selected color (0-15) */
|
||||||
|
this.selectedColor = 7;
|
||||||
|
|
||||||
|
/** @type {number} Currently selected sprite (0-255) */
|
||||||
|
this.selectedSprite = 0;
|
||||||
|
|
||||||
|
/** @type {string} Current tool: "pen", "fill", "line", "rect", "circle", "erase" */
|
||||||
|
this.currentTool = "pen";
|
||||||
|
|
||||||
|
/** @type {number} Zoom level for sprite sheet canvas */
|
||||||
|
this.sheetZoom = 2;
|
||||||
|
|
||||||
|
/** @type {number} Zoom level for sprite preview */
|
||||||
|
this.previewZoom = 8;
|
||||||
|
|
||||||
|
/** @type {Object|null} Drawing state for line/rect tools */
|
||||||
|
this.drawStart = null;
|
||||||
|
|
||||||
|
this.#createUI();
|
||||||
|
this.#attachEvents();
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the UI structure.
|
||||||
|
*/
|
||||||
|
#createUI() {
|
||||||
|
this.container.innerHTML = "";
|
||||||
|
this.container.className = "sprite-editor";
|
||||||
|
|
||||||
|
// Toolbar
|
||||||
|
const toolbar = document.createElement("div");
|
||||||
|
toolbar.className = "sprite-toolbar";
|
||||||
|
|
||||||
|
const tools = [
|
||||||
|
{ id: "pen", label: "Pen", icon: "✏️" },
|
||||||
|
{ id: "fill", label: "Fill", icon: "🪣" },
|
||||||
|
{ id: "line", label: "Line", icon: "📏" },
|
||||||
|
{ id: "rect", label: "Rect", icon: "⬜" },
|
||||||
|
{ id: "circle", label: "Circle", icon: "⭕" },
|
||||||
|
{ id: "erase", label: "Erase", icon: "🧹" }
|
||||||
|
];
|
||||||
|
|
||||||
|
tools.forEach((tool) => {
|
||||||
|
const btn = document.createElement("button");
|
||||||
|
btn.className = "sprite-tool-btn";
|
||||||
|
btn.dataset.tool = tool.id;
|
||||||
|
btn.title = tool.label;
|
||||||
|
btn.textContent = tool.icon;
|
||||||
|
if (tool.id === this.currentTool) {
|
||||||
|
btn.classList.add("active");
|
||||||
|
}
|
||||||
|
toolbar.appendChild(btn);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.container.appendChild(toolbar);
|
||||||
|
|
||||||
|
// Main content area
|
||||||
|
const content = document.createElement("div");
|
||||||
|
content.className = "sprite-content";
|
||||||
|
|
||||||
|
// Left panel: Sprite sheet
|
||||||
|
const leftPanel = document.createElement("div");
|
||||||
|
leftPanel.className = "sprite-panel sprite-sheet-panel";
|
||||||
|
|
||||||
|
const sheetLabel = document.createElement("div");
|
||||||
|
sheetLabel.className = "sprite-panel-label";
|
||||||
|
sheetLabel.textContent = "Sprite Sheet (128x128)";
|
||||||
|
leftPanel.appendChild(sheetLabel);
|
||||||
|
|
||||||
|
this.sheetCanvas = document.createElement("canvas");
|
||||||
|
this.sheetCanvas.className = "sprite-sheet-canvas";
|
||||||
|
this.sheetCanvas.width = 128 * this.sheetZoom;
|
||||||
|
this.sheetCanvas.height = 128 * this.sheetZoom;
|
||||||
|
this.sheetCtx = this.sheetCanvas.getContext("2d", { alpha: false });
|
||||||
|
this.sheetCtx.imageSmoothingEnabled = false;
|
||||||
|
leftPanel.appendChild(this.sheetCanvas);
|
||||||
|
|
||||||
|
content.appendChild(leftPanel);
|
||||||
|
|
||||||
|
// Right panel: Preview and palette
|
||||||
|
const rightPanel = document.createElement("div");
|
||||||
|
rightPanel.className = "sprite-panel sprite-controls-panel";
|
||||||
|
|
||||||
|
// Sprite preview
|
||||||
|
const previewContainer = document.createElement("div");
|
||||||
|
previewContainer.className = "sprite-preview-container";
|
||||||
|
|
||||||
|
const previewLabel = document.createElement("div");
|
||||||
|
previewLabel.className = "sprite-panel-label";
|
||||||
|
previewLabel.textContent = "Sprite Preview";
|
||||||
|
previewContainer.appendChild(previewLabel);
|
||||||
|
|
||||||
|
this.previewCanvas = document.createElement("canvas");
|
||||||
|
this.previewCanvas.className = "sprite-preview-canvas";
|
||||||
|
this.previewCanvas.width = 8 * this.previewZoom;
|
||||||
|
this.previewCanvas.height = 8 * this.previewZoom;
|
||||||
|
this.previewCtx = this.previewCanvas.getContext("2d", { alpha: false });
|
||||||
|
this.previewCtx.imageSmoothingEnabled = false;
|
||||||
|
previewContainer.appendChild(this.previewCanvas);
|
||||||
|
|
||||||
|
this.spriteIndexLabel = document.createElement("div");
|
||||||
|
this.spriteIndexLabel.className = "sprite-index-label";
|
||||||
|
this.spriteIndexLabel.textContent = `Sprite: ${this.selectedSprite}`;
|
||||||
|
previewContainer.appendChild(this.spriteIndexLabel);
|
||||||
|
|
||||||
|
rightPanel.appendChild(previewContainer);
|
||||||
|
|
||||||
|
// Color palette
|
||||||
|
const paletteContainer = document.createElement("div");
|
||||||
|
paletteContainer.className = "sprite-palette-container";
|
||||||
|
|
||||||
|
const paletteLabel = document.createElement("div");
|
||||||
|
paletteLabel.className = "sprite-panel-label";
|
||||||
|
paletteLabel.textContent = "Palette";
|
||||||
|
paletteContainer.appendChild(paletteLabel);
|
||||||
|
|
||||||
|
this.paletteElement = document.createElement("div");
|
||||||
|
this.paletteElement.className = "sprite-palette";
|
||||||
|
|
||||||
|
this.spriteSheet.palette.forEach((color, index) => {
|
||||||
|
const swatch = document.createElement("div");
|
||||||
|
swatch.className = "sprite-palette-swatch";
|
||||||
|
swatch.style.backgroundColor = color;
|
||||||
|
swatch.dataset.color = index;
|
||||||
|
swatch.title = `Color ${index}`;
|
||||||
|
if (index === this.selectedColor) {
|
||||||
|
swatch.classList.add("selected");
|
||||||
|
}
|
||||||
|
this.paletteElement.appendChild(swatch);
|
||||||
|
});
|
||||||
|
|
||||||
|
paletteContainer.appendChild(this.paletteElement);
|
||||||
|
rightPanel.appendChild(paletteContainer);
|
||||||
|
|
||||||
|
// Actions
|
||||||
|
const actionsContainer = document.createElement("div");
|
||||||
|
actionsContainer.className = "sprite-actions";
|
||||||
|
|
||||||
|
const clearBtn = document.createElement("button");
|
||||||
|
clearBtn.className = "sprite-action-btn";
|
||||||
|
clearBtn.textContent = "Clear Sprite";
|
||||||
|
clearBtn.dataset.action = "clear-sprite";
|
||||||
|
actionsContainer.appendChild(clearBtn);
|
||||||
|
|
||||||
|
const clearAllBtn = document.createElement("button");
|
||||||
|
clearAllBtn.className = "sprite-action-btn";
|
||||||
|
clearAllBtn.textContent = "Clear All";
|
||||||
|
clearAllBtn.dataset.action = "clear-all";
|
||||||
|
actionsContainer.appendChild(clearAllBtn);
|
||||||
|
|
||||||
|
rightPanel.appendChild(actionsContainer);
|
||||||
|
|
||||||
|
content.appendChild(rightPanel);
|
||||||
|
this.container.appendChild(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attaches event listeners.
|
||||||
|
*/
|
||||||
|
#attachEvents() {
|
||||||
|
// Tool selection
|
||||||
|
this.container.querySelectorAll(".sprite-tool-btn").forEach((btn) => {
|
||||||
|
btn.addEventListener("click", (e) => {
|
||||||
|
this.currentTool = btn.dataset.tool;
|
||||||
|
this.container.querySelectorAll(".sprite-tool-btn").forEach((b) => {
|
||||||
|
b.classList.remove("active");
|
||||||
|
});
|
||||||
|
btn.classList.add("active");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Color palette
|
||||||
|
this.paletteElement.querySelectorAll(".sprite-palette-swatch").forEach((swatch) => {
|
||||||
|
swatch.addEventListener("click", (e) => {
|
||||||
|
this.selectedColor = parseInt(swatch.dataset.color);
|
||||||
|
this.paletteElement.querySelectorAll(".sprite-palette-swatch").forEach((s) => {
|
||||||
|
s.classList.remove("selected");
|
||||||
|
});
|
||||||
|
swatch.classList.add("selected");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Actions
|
||||||
|
this.container.querySelectorAll(".sprite-action-btn").forEach((btn) => {
|
||||||
|
btn.addEventListener("click", (e) => {
|
||||||
|
const action = btn.dataset.action;
|
||||||
|
if (action === "clear-sprite") {
|
||||||
|
this.#clearCurrentSprite();
|
||||||
|
} else if (action === "clear-all") {
|
||||||
|
if (confirm("Clear all sprites? This cannot be undone.")) {
|
||||||
|
this.spriteSheet.clear();
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sheet canvas interactions
|
||||||
|
let isDrawing = false;
|
||||||
|
|
||||||
|
this.sheetCanvas.addEventListener("mousedown", (e) => {
|
||||||
|
isDrawing = true;
|
||||||
|
const coords = this.#getSheetCoords(e);
|
||||||
|
this.#handleToolStart(coords);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.sheetCanvas.addEventListener("mousemove", (e) => {
|
||||||
|
if (!isDrawing) return;
|
||||||
|
const coords = this.#getSheetCoords(e);
|
||||||
|
this.#handleToolMove(coords);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.sheetCanvas.addEventListener("mouseup", (e) => {
|
||||||
|
if (!isDrawing) return;
|
||||||
|
isDrawing = false;
|
||||||
|
const coords = this.#getSheetCoords(e);
|
||||||
|
this.#handleToolEnd(coords);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.sheetCanvas.addEventListener("mouseleave", () => {
|
||||||
|
isDrawing = false;
|
||||||
|
this.drawStart = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sprite selection
|
||||||
|
this.sheetCanvas.addEventListener("click", (e) => {
|
||||||
|
const coords = this.#getSheetCoords(e);
|
||||||
|
const spriteX = Math.floor(coords.x / 8);
|
||||||
|
const spriteY = Math.floor(coords.y / 8);
|
||||||
|
this.selectedSprite = spriteY * 16 + spriteX;
|
||||||
|
this.spriteIndexLabel.textContent = `Sprite: ${this.selectedSprite}`;
|
||||||
|
this.#renderPreview();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Preview canvas editing
|
||||||
|
let isDrawingPreview = false;
|
||||||
|
|
||||||
|
this.previewCanvas.addEventListener("mousedown", (e) => {
|
||||||
|
isDrawingPreview = true;
|
||||||
|
const coords = this.#getPreviewCoords(e);
|
||||||
|
this.#drawPixelInPreview(coords);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.previewCanvas.addEventListener("mousemove", (e) => {
|
||||||
|
if (!isDrawingPreview) return;
|
||||||
|
const coords = this.#getPreviewCoords(e);
|
||||||
|
this.#drawPixelInPreview(coords);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.previewCanvas.addEventListener("mouseup", () => {
|
||||||
|
isDrawingPreview = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.previewCanvas.addEventListener("mouseleave", () => {
|
||||||
|
isDrawingPreview = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets sheet coordinates from mouse event.
|
||||||
|
*
|
||||||
|
* @param {MouseEvent} e Mouse event.
|
||||||
|
* @returns {{x: number, y: number}}
|
||||||
|
*/
|
||||||
|
#getSheetCoords(e) {
|
||||||
|
const rect = this.sheetCanvas.getBoundingClientRect();
|
||||||
|
const x = Math.floor((e.clientX - rect.left) / this.sheetZoom);
|
||||||
|
const y = Math.floor((e.clientY - rect.top) / this.sheetZoom);
|
||||||
|
return { x, y };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets preview coordinates from mouse event.
|
||||||
|
*
|
||||||
|
* @param {MouseEvent} e Mouse event.
|
||||||
|
* @returns {{x: number, y: number}}
|
||||||
|
*/
|
||||||
|
#getPreviewCoords(e) {
|
||||||
|
const rect = this.previewCanvas.getBoundingClientRect();
|
||||||
|
const x = Math.floor((e.clientX - rect.left) / this.previewZoom);
|
||||||
|
const y = Math.floor((e.clientY - rect.top) / this.previewZoom);
|
||||||
|
return { x, y };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles tool start.
|
||||||
|
*
|
||||||
|
* @param {{x: number, y: number}} coords Coordinates.
|
||||||
|
*/
|
||||||
|
#handleToolStart(coords) {
|
||||||
|
if (this.currentTool === "pen") {
|
||||||
|
this.#drawPixel(coords);
|
||||||
|
} else if (this.currentTool === "erase") {
|
||||||
|
this.#erasePixel(coords);
|
||||||
|
} else if (this.currentTool === "fill") {
|
||||||
|
this.#floodFill(coords);
|
||||||
|
} else if (["line", "rect", "circle"].includes(this.currentTool)) {
|
||||||
|
this.drawStart = coords;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles tool move.
|
||||||
|
*
|
||||||
|
* @param {{x: number, y: number}} coords Coordinates.
|
||||||
|
*/
|
||||||
|
#handleToolMove(coords) {
|
||||||
|
if (this.currentTool === "pen") {
|
||||||
|
this.#drawPixel(coords);
|
||||||
|
} else if (this.currentTool === "erase") {
|
||||||
|
this.#erasePixel(coords);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles tool end.
|
||||||
|
*
|
||||||
|
* @param {{x: number, y: number}} coords Coordinates.
|
||||||
|
*/
|
||||||
|
#handleToolEnd(coords) {
|
||||||
|
if (!this.drawStart) return;
|
||||||
|
|
||||||
|
if (this.currentTool === "line") {
|
||||||
|
this.#drawLine(this.drawStart, coords);
|
||||||
|
} else if (this.currentTool === "rect") {
|
||||||
|
this.#drawRect(this.drawStart, coords);
|
||||||
|
} else if (this.currentTool === "circle") {
|
||||||
|
this.#drawCircle(this.drawStart, coords);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.drawStart = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a pixel.
|
||||||
|
*
|
||||||
|
* @param {{x: number, y: number}} coords Coordinates.
|
||||||
|
*/
|
||||||
|
#drawPixel(coords) {
|
||||||
|
this.spriteSheet.setPixel(coords.x, coords.y, this.selectedColor);
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erases a pixel.
|
||||||
|
*
|
||||||
|
* @param {{x: number, y: number}} coords Coordinates.
|
||||||
|
*/
|
||||||
|
#erasePixel(coords) {
|
||||||
|
this.spriteSheet.setPixel(coords.x, coords.y, 0);
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flood fill from a point.
|
||||||
|
*
|
||||||
|
* @param {{x: number, y: number}} coords Starting coordinates.
|
||||||
|
*/
|
||||||
|
#floodFill(coords) {
|
||||||
|
const targetColor = this.spriteSheet.getPixel(coords.x, coords.y);
|
||||||
|
if (targetColor === this.selectedColor) return;
|
||||||
|
|
||||||
|
const stack = [coords];
|
||||||
|
const visited = new Set();
|
||||||
|
|
||||||
|
while (stack.length > 0) {
|
||||||
|
const { x, y } = stack.pop();
|
||||||
|
const key = `${x},${y}`;
|
||||||
|
|
||||||
|
if (visited.has(key)) continue;
|
||||||
|
if (x < 0 || x >= 128 || y < 0 || y >= 128) continue;
|
||||||
|
if (this.spriteSheet.getPixel(x, y) !== targetColor) continue;
|
||||||
|
|
||||||
|
visited.add(key);
|
||||||
|
this.spriteSheet.setPixel(x, y, this.selectedColor);
|
||||||
|
|
||||||
|
stack.push({ x: x + 1, y });
|
||||||
|
stack.push({ x: x - 1, y });
|
||||||
|
stack.push({ x, y: y + 1 });
|
||||||
|
stack.push({ x, y: y - 1 });
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a line.
|
||||||
|
*
|
||||||
|
* @param {{x: number, y: number}} start Start coordinates.
|
||||||
|
* @param {{x: number, y: number}} end End coordinates.
|
||||||
|
*/
|
||||||
|
#drawLine(start, end) {
|
||||||
|
const dx = Math.abs(end.x - start.x);
|
||||||
|
const dy = Math.abs(end.y - start.y);
|
||||||
|
const sx = start.x < end.x ? 1 : -1;
|
||||||
|
const sy = start.y < end.y ? 1 : -1;
|
||||||
|
let err = dx - dy;
|
||||||
|
|
||||||
|
let x = start.x;
|
||||||
|
let y = start.y;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
this.spriteSheet.setPixel(x, y, this.selectedColor);
|
||||||
|
|
||||||
|
if (x === end.x && y === end.y) break;
|
||||||
|
|
||||||
|
const e2 = 2 * err;
|
||||||
|
if (e2 > -dy) {
|
||||||
|
err -= dy;
|
||||||
|
x += sx;
|
||||||
|
}
|
||||||
|
if (e2 < dx) {
|
||||||
|
err += dx;
|
||||||
|
y += sy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a rectangle.
|
||||||
|
*
|
||||||
|
* @param {{x: number, y: number}} start Start coordinates.
|
||||||
|
* @param {{x: number, y: number}} end End coordinates.
|
||||||
|
*/
|
||||||
|
#drawRect(start, end) {
|
||||||
|
const x1 = Math.min(start.x, end.x);
|
||||||
|
const y1 = Math.min(start.y, end.y);
|
||||||
|
const x2 = Math.max(start.x, end.x);
|
||||||
|
const y2 = Math.max(start.y, end.y);
|
||||||
|
|
||||||
|
for (let x = x1; x <= x2; x++) {
|
||||||
|
this.spriteSheet.setPixel(x, y1, this.selectedColor);
|
||||||
|
this.spriteSheet.setPixel(x, y2, this.selectedColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let y = y1; y <= y2; y++) {
|
||||||
|
this.spriteSheet.setPixel(x1, y, this.selectedColor);
|
||||||
|
this.spriteSheet.setPixel(x2, y, this.selectedColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a circle.
|
||||||
|
*
|
||||||
|
* @param {{x: number, y: number}} center Center coordinates.
|
||||||
|
* @param {{x: number, y: number}} edge Edge point.
|
||||||
|
*/
|
||||||
|
#drawCircle(center, edge) {
|
||||||
|
const radius = Math.round(
|
||||||
|
Math.sqrt((edge.x - center.x) ** 2 + (edge.y - center.y) ** 2)
|
||||||
|
);
|
||||||
|
|
||||||
|
let x = radius;
|
||||||
|
let y = 0;
|
||||||
|
let err = 0;
|
||||||
|
|
||||||
|
while (x >= y) {
|
||||||
|
this.spriteSheet.setPixel(center.x + x, center.y + y, this.selectedColor);
|
||||||
|
this.spriteSheet.setPixel(center.x + y, center.y + x, this.selectedColor);
|
||||||
|
this.spriteSheet.setPixel(center.x - y, center.y + x, this.selectedColor);
|
||||||
|
this.spriteSheet.setPixel(center.x - x, center.y + y, this.selectedColor);
|
||||||
|
this.spriteSheet.setPixel(center.x - x, center.y - y, this.selectedColor);
|
||||||
|
this.spriteSheet.setPixel(center.x - y, center.y - x, this.selectedColor);
|
||||||
|
this.spriteSheet.setPixel(center.x + y, center.y - x, this.selectedColor);
|
||||||
|
this.spriteSheet.setPixel(center.x + x, center.y - y, this.selectedColor);
|
||||||
|
|
||||||
|
y += 1;
|
||||||
|
err += 1 + 2 * y;
|
||||||
|
if (2 * (err - x) + 1 > 0) {
|
||||||
|
x -= 1;
|
||||||
|
err += 1 - 2 * x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a pixel in the preview canvas.
|
||||||
|
*
|
||||||
|
* @param {{x: number, y: number}} coords Coordinates (0-7).
|
||||||
|
*/
|
||||||
|
#drawPixelInPreview(coords) {
|
||||||
|
if (coords.x < 0 || coords.x >= 8 || coords.y < 0 || coords.y >= 8) return;
|
||||||
|
|
||||||
|
const sx = (this.selectedSprite % 16) * 8;
|
||||||
|
const sy = Math.floor(this.selectedSprite / 16) * 8;
|
||||||
|
|
||||||
|
const color = this.currentTool === "erase" ? 0 : this.selectedColor;
|
||||||
|
this.spriteSheet.setPixel(sx + coords.x, sy + coords.y, color);
|
||||||
|
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the currently selected sprite.
|
||||||
|
*/
|
||||||
|
#clearCurrentSprite() {
|
||||||
|
const clearData = new Uint8Array(64);
|
||||||
|
this.spriteSheet.setSprite(this.selectedSprite, clearData);
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders all canvases.
|
||||||
|
*/
|
||||||
|
#render() {
|
||||||
|
this.#renderSheet();
|
||||||
|
this.#renderPreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the sprite sheet canvas.
|
||||||
|
*/
|
||||||
|
#renderSheet() {
|
||||||
|
for (let y = 0; y < 128; y++) {
|
||||||
|
for (let x = 0; x < 128; x++) {
|
||||||
|
const color = this.spriteSheet.getPixel(x, y);
|
||||||
|
this.sheetCtx.fillStyle = this.spriteSheet.palette[color];
|
||||||
|
this.sheetCtx.fillRect(
|
||||||
|
x * this.sheetZoom,
|
||||||
|
y * this.sheetZoom,
|
||||||
|
this.sheetZoom,
|
||||||
|
this.sheetZoom
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw grid
|
||||||
|
this.sheetCtx.strokeStyle = "rgba(255, 255, 255, 0.2)";
|
||||||
|
this.sheetCtx.lineWidth = 1;
|
||||||
|
|
||||||
|
for (let i = 0; i <= 16; i++) {
|
||||||
|
const pos = i * 8 * this.sheetZoom;
|
||||||
|
this.sheetCtx.beginPath();
|
||||||
|
this.sheetCtx.moveTo(pos, 0);
|
||||||
|
this.sheetCtx.lineTo(pos, 128 * this.sheetZoom);
|
||||||
|
this.sheetCtx.stroke();
|
||||||
|
|
||||||
|
this.sheetCtx.beginPath();
|
||||||
|
this.sheetCtx.moveTo(0, pos);
|
||||||
|
this.sheetCtx.lineTo(128 * this.sheetZoom, pos);
|
||||||
|
this.sheetCtx.stroke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the sprite preview canvas.
|
||||||
|
*/
|
||||||
|
#renderPreview() {
|
||||||
|
const sx = (this.selectedSprite % 16) * 8;
|
||||||
|
const sy = Math.floor(this.selectedSprite / 16) * 8;
|
||||||
|
|
||||||
|
for (let y = 0; y < 8; y++) {
|
||||||
|
for (let x = 0; x < 8; x++) {
|
||||||
|
const color = this.spriteSheet.getPixel(sx + x, sy + y);
|
||||||
|
this.previewCtx.fillStyle = this.spriteSheet.palette[color];
|
||||||
|
this.previewCtx.fillRect(
|
||||||
|
x * this.previewZoom,
|
||||||
|
y * this.previewZoom,
|
||||||
|
this.previewZoom,
|
||||||
|
this.previewZoom
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw grid
|
||||||
|
this.previewCtx.strokeStyle = "rgba(255, 255, 255, 0.3)";
|
||||||
|
this.previewCtx.lineWidth = 1;
|
||||||
|
|
||||||
|
for (let i = 0; i <= 8; i++) {
|
||||||
|
const pos = i * this.previewZoom;
|
||||||
|
this.previewCtx.beginPath();
|
||||||
|
this.previewCtx.moveTo(pos, 0);
|
||||||
|
this.previewCtx.lineTo(pos, 8 * this.previewZoom);
|
||||||
|
this.previewCtx.stroke();
|
||||||
|
|
||||||
|
this.previewCtx.beginPath();
|
||||||
|
this.previewCtx.moveTo(0, pos);
|
||||||
|
this.previewCtx.lineTo(8 * this.previewZoom, pos);
|
||||||
|
this.previewCtx.stroke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sprite sheet data.
|
||||||
|
*
|
||||||
|
* @returns {SpriteSheet}
|
||||||
|
*/
|
||||||
|
getSpriteSheet() {
|
||||||
|
return this.spriteSheet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets sprite sheet data.
|
||||||
|
*
|
||||||
|
* @param {SpriteSheet} spriteSheet New sprite sheet.
|
||||||
|
*/
|
||||||
|
setSpriteSheet(spriteSheet) {
|
||||||
|
this.spriteSheet = spriteSheet;
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
import { SpriteEditor } from './SpriteEditor.js';
|
||||||
|
import { SpriteSheet } from '../core/SpriteSheet.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages the sprite editor modal integration.
|
||||||
|
*/
|
||||||
|
export class SpriteEditorManager {
|
||||||
|
/**
|
||||||
|
* @param {HTMLElement} modal Modal element.
|
||||||
|
* @param {HTMLElement} container Container for sprite editor.
|
||||||
|
*/
|
||||||
|
constructor(modal, container) {
|
||||||
|
this.modal = modal;
|
||||||
|
this.container = container;
|
||||||
|
this.spriteSheet = new SpriteSheet();
|
||||||
|
this.editor = null;
|
||||||
|
this.isOpen = false;
|
||||||
|
|
||||||
|
this.#setupModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up modal event listeners.
|
||||||
|
*/
|
||||||
|
#setupModal() {
|
||||||
|
// Close modal on backdrop click
|
||||||
|
const backdrop = this.modal.querySelector('.modal__backdrop');
|
||||||
|
backdrop?.addEventListener('click', () => this.close());
|
||||||
|
|
||||||
|
// Close modal on close button click
|
||||||
|
const closeButtons = this.modal.querySelectorAll('[data-modal-close]');
|
||||||
|
closeButtons.forEach((btn) => {
|
||||||
|
btn.addEventListener('click', () => this.close());
|
||||||
|
});
|
||||||
|
|
||||||
|
// Export to .p8
|
||||||
|
const exportBtn = document.getElementById('exportP8Button');
|
||||||
|
exportBtn?.addEventListener('click', () => this.#exportToP8());
|
||||||
|
|
||||||
|
// Import from .p8
|
||||||
|
const importBtn = document.getElementById('importP8Button');
|
||||||
|
importBtn?.addEventListener('click', () => this.#importFromP8());
|
||||||
|
|
||||||
|
// Initialize editor on first open
|
||||||
|
this.modal.addEventListener('transitionend', () => {
|
||||||
|
if (this.isOpen && !this.editor) {
|
||||||
|
this.#initializeEditor();
|
||||||
|
}
|
||||||
|
}, { once: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the sprite editor.
|
||||||
|
*/
|
||||||
|
#initializeEditor() {
|
||||||
|
if (this.editor) return;
|
||||||
|
|
||||||
|
this.editor = new SpriteEditor(this.container, this.spriteSheet);
|
||||||
|
console.log('Sprite editor initialized');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the sprite editor modal.
|
||||||
|
*/
|
||||||
|
open() {
|
||||||
|
if (this.isOpen) return;
|
||||||
|
|
||||||
|
this.isOpen = true;
|
||||||
|
this.modal.removeAttribute('hidden');
|
||||||
|
this.modal.setAttribute('aria-hidden', 'false');
|
||||||
|
document.body.classList.add('modal-open');
|
||||||
|
|
||||||
|
// Initialize editor immediately if not already done
|
||||||
|
if (!this.editor) {
|
||||||
|
this.#initializeEditor();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Focus trap
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
const closeBtn = this.modal.querySelector('[data-modal-close]');
|
||||||
|
closeBtn?.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the sprite editor modal.
|
||||||
|
*/
|
||||||
|
close() {
|
||||||
|
if (!this.isOpen) return;
|
||||||
|
|
||||||
|
this.isOpen = false;
|
||||||
|
this.modal.setAttribute('hidden', '');
|
||||||
|
this.modal.setAttribute('aria-hidden', 'true');
|
||||||
|
document.body.classList.remove('modal-open');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports sprite data to .p8 format.
|
||||||
|
*/
|
||||||
|
#exportToP8() {
|
||||||
|
if (!this.editor) return;
|
||||||
|
|
||||||
|
const gfxData = this.editor.getSpriteSheet().toP8Gfx();
|
||||||
|
const flagData = this.editor.getSpriteSheet().toP8Flags();
|
||||||
|
|
||||||
|
const p8Content = `pico-8 cartridge // http://www.pico-8.com
|
||||||
|
version 41
|
||||||
|
__lua__
|
||||||
|
-- generated by picoGraph
|
||||||
|
-- paste your blueprinted code here
|
||||||
|
|
||||||
|
__gfx__
|
||||||
|
${gfxData}
|
||||||
|
__gff__
|
||||||
|
${flagData}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const blob = new Blob([p8Content], { type: 'text/plain' });
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url;
|
||||||
|
a.download = 'sprites.p8';
|
||||||
|
a.click();
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
|
||||||
|
// Show success feedback
|
||||||
|
const exportBtn = document.getElementById('exportP8Button');
|
||||||
|
if (exportBtn) {
|
||||||
|
exportBtn.classList.add('is-success');
|
||||||
|
setTimeout(() => {
|
||||||
|
exportBtn.classList.remove('is-success');
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Imports sprite data from .p8 format.
|
||||||
|
*/
|
||||||
|
#importFromP8() {
|
||||||
|
if (!this.editor) return;
|
||||||
|
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'file';
|
||||||
|
input.accept = '.p8';
|
||||||
|
|
||||||
|
input.addEventListener('change', async (e) => {
|
||||||
|
const file = e.target.files[0];
|
||||||
|
if (!file) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const text = await file.text();
|
||||||
|
|
||||||
|
// Extract __gfx__ section
|
||||||
|
const gfxMatch = text.match(/__gfx__\s*\n([\s\S]*?)(?=\n__|$)/);
|
||||||
|
if (gfxMatch) {
|
||||||
|
this.editor.getSpriteSheet().fromP8Gfx(gfxMatch[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract __gff__ section
|
||||||
|
const gffMatch = text.match(/__gff__\s*\n([\s\S]*?)(?=\n__|$)/);
|
||||||
|
if (gffMatch) {
|
||||||
|
this.editor.getSpriteSheet().fromP8Flags(gffMatch[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-render
|
||||||
|
this.editor.setSpriteSheet(this.editor.getSpriteSheet());
|
||||||
|
|
||||||
|
// Show success feedback
|
||||||
|
const importBtn = document.getElementById('importP8Button');
|
||||||
|
if (importBtn) {
|
||||||
|
importBtn.classList.add('is-success');
|
||||||
|
setTimeout(() => {
|
||||||
|
importBtn.classList.remove('is-success');
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to import sprite data:', error);
|
||||||
|
alert('Failed to import sprite data. Please ensure the file is a valid .p8 file.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
input.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current sprite sheet data.
|
||||||
|
*
|
||||||
|
* @returns {SpriteSheet}
|
||||||
|
*/
|
||||||
|
getSpriteSheet() {
|
||||||
|
return this.spriteSheet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets sprite sheet data.
|
||||||
|
*
|
||||||
|
* @param {SpriteSheet} spriteSheet New sprite sheet.
|
||||||
|
*/
|
||||||
|
setSpriteSheet(spriteSheet) {
|
||||||
|
this.spriteSheet = spriteSheet;
|
||||||
|
if (this.editor) {
|
||||||
|
this.editor.setSpriteSheet(spriteSheet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
import { TileSetBrowser } from "./TileSetBrowser.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages the tile browser modal and provides access to tileset management.
|
||||||
|
*/
|
||||||
|
export class TileManager {
|
||||||
|
constructor() {
|
||||||
|
this.modal = null;
|
||||||
|
this.browser = null;
|
||||||
|
this.isOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the tile manager.
|
||||||
|
*/
|
||||||
|
initialize() {
|
||||||
|
this.modal = document.getElementById("tileModal");
|
||||||
|
if (!this.modal) {
|
||||||
|
console.error("Tile modal element not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const container = this.modal.querySelector(".tile-browser-container");
|
||||||
|
if (!container) {
|
||||||
|
console.error("Tile browser container not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.browser = new TileSetBrowser(container);
|
||||||
|
|
||||||
|
const closeBtn = this.modal.querySelector(".close-modal");
|
||||||
|
if (closeBtn) {
|
||||||
|
closeBtn.addEventListener("click", () => this.close());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.modal.addEventListener("click", (e) => {
|
||||||
|
if (e.target === this.modal) {
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("keydown", (e) => {
|
||||||
|
if (e.key === "Escape" && this.isOpen) {
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const tileBtn = document.getElementById("tileManagerButton");
|
||||||
|
if (tileBtn) {
|
||||||
|
tileBtn.addEventListener("click", () => this.open());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#loadFromLocalStorage();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the tile manager modal.
|
||||||
|
*/
|
||||||
|
open() {
|
||||||
|
if (!this.modal) return;
|
||||||
|
this.modal.style.display = "flex";
|
||||||
|
this.isOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the tile manager modal.
|
||||||
|
*/
|
||||||
|
close() {
|
||||||
|
if (!this.modal) return;
|
||||||
|
this.modal.style.display = "none";
|
||||||
|
this.isOpen = false;
|
||||||
|
this.#saveToLocalStorage();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all tilesets.
|
||||||
|
*
|
||||||
|
* @returns {Array<TileSet>}
|
||||||
|
*/
|
||||||
|
getTileSets() {
|
||||||
|
return this.browser ? this.browser.getTileSets() : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves tileset data to localStorage.
|
||||||
|
*/
|
||||||
|
#saveToLocalStorage() {
|
||||||
|
if (!this.browser) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = this.browser.toJSON();
|
||||||
|
localStorage.setItem("picograph_tilesets", JSON.stringify(data));
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to save tilesets:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads tileset data from localStorage.
|
||||||
|
*/
|
||||||
|
async #loadFromLocalStorage() {
|
||||||
|
if (!this.browser) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const stored = localStorage.getItem("picograph_tilesets");
|
||||||
|
if (stored) {
|
||||||
|
const data = JSON.parse(stored);
|
||||||
|
await this.browser.fromJSON(data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to load tilesets:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,511 @@
|
|||||||
|
import { TileSet } from "../core/TileSet.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages multiple tilesets (8x8 tiles in 128x128px sheets) and provides UI for browsing and editing externally.
|
||||||
|
*/
|
||||||
|
export class TileSetBrowser {
|
||||||
|
/**
|
||||||
|
* @param {HTMLElement} container Parent element for the browser.
|
||||||
|
*/
|
||||||
|
constructor(container) {
|
||||||
|
this.container = container;
|
||||||
|
|
||||||
|
/** @type {Map<string, TileSet>} */
|
||||||
|
this.tileSets = new Map();
|
||||||
|
|
||||||
|
/** @type {string | null} */
|
||||||
|
this.selectedTileSetId = null;
|
||||||
|
|
||||||
|
/** @type {number | null} */
|
||||||
|
this.selectedTileIndex = null;
|
||||||
|
|
||||||
|
this.#createUI();
|
||||||
|
this.#attachEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the UI structure.
|
||||||
|
*/
|
||||||
|
#createUI() {
|
||||||
|
this.container.innerHTML = "";
|
||||||
|
this.container.className = "tileset-browser";
|
||||||
|
|
||||||
|
// Header with actions
|
||||||
|
const header = document.createElement("div");
|
||||||
|
header.className = "tileset-header";
|
||||||
|
|
||||||
|
const title = document.createElement("div");
|
||||||
|
title.className = "tileset-title";
|
||||||
|
title.textContent = "Tilesets";
|
||||||
|
header.appendChild(title);
|
||||||
|
|
||||||
|
const actions = document.createElement("div");
|
||||||
|
actions.className = "tileset-actions";
|
||||||
|
|
||||||
|
const addBtn = document.createElement("button");
|
||||||
|
addBtn.className = "tileset-action-btn";
|
||||||
|
addBtn.textContent = "+ Add Tileset";
|
||||||
|
addBtn.dataset.action = "add";
|
||||||
|
actions.appendChild(addBtn);
|
||||||
|
|
||||||
|
header.appendChild(actions);
|
||||||
|
this.container.appendChild(header);
|
||||||
|
|
||||||
|
// Tileset list
|
||||||
|
this.tileSetList = document.createElement("div");
|
||||||
|
this.tileSetList.className = "tileset-list";
|
||||||
|
this.container.appendChild(this.tileSetList);
|
||||||
|
|
||||||
|
// Tile preview panel
|
||||||
|
this.previewPanel = document.createElement("div");
|
||||||
|
this.previewPanel.className = "tileset-preview-panel";
|
||||||
|
this.previewPanel.innerHTML = `
|
||||||
|
<div class="tileset-preview-header">
|
||||||
|
<span class="tileset-preview-title">Tile Preview</span>
|
||||||
|
</div>
|
||||||
|
<div class="tileset-preview-content">
|
||||||
|
<canvas class="tileset-preview-canvas"></canvas>
|
||||||
|
<div class="tileset-preview-info">Select a tileset to preview</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
this.container.appendChild(this.previewPanel);
|
||||||
|
|
||||||
|
this.previewCanvas = this.previewPanel.querySelector(".tileset-preview-canvas");
|
||||||
|
this.previewCtx = this.previewCanvas.getContext("2d", { alpha: false });
|
||||||
|
this.previewInfo = this.previewPanel.querySelector(".tileset-preview-info");
|
||||||
|
|
||||||
|
this.#renderEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attaches event listeners.
|
||||||
|
*/
|
||||||
|
#attachEvents() {
|
||||||
|
// Add tileset button
|
||||||
|
this.container.addEventListener("click", (e) => {
|
||||||
|
const target = e.target;
|
||||||
|
if (!(target instanceof HTMLElement)) return;
|
||||||
|
|
||||||
|
const actionBtn = target.closest("[data-action]");
|
||||||
|
if (actionBtn) {
|
||||||
|
const action = actionBtn.dataset.action;
|
||||||
|
|
||||||
|
if (action === "add") {
|
||||||
|
this.#addTileSet();
|
||||||
|
} else if (action === "open") {
|
||||||
|
const id = actionBtn.dataset.id;
|
||||||
|
if (id) this.#openExternal(id);
|
||||||
|
} else if (action === "reload") {
|
||||||
|
const id = actionBtn.dataset.id;
|
||||||
|
if (id) this.#reloadTileSet(id);
|
||||||
|
} else if (action === "remove") {
|
||||||
|
const id = actionBtn.dataset.id;
|
||||||
|
if (id) this.#removeTileSet(id);
|
||||||
|
} else if (action === "edit-settings") {
|
||||||
|
const id = actionBtn.dataset.id;
|
||||||
|
if (id) this.#editTileSetSettings(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tileset selection
|
||||||
|
const tilesetItem = target.closest(".tileset-item");
|
||||||
|
if (tilesetItem && tilesetItem.dataset.id) {
|
||||||
|
this.#selectTileSet(tilesetItem.dataset.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Canvas tile selection
|
||||||
|
this.previewCanvas.addEventListener("click", (e) => {
|
||||||
|
if (!this.selectedTileSetId) return;
|
||||||
|
|
||||||
|
const tileSet = this.tileSets.get(this.selectedTileSetId);
|
||||||
|
if (!tileSet || !tileSet.isLoaded) return;
|
||||||
|
|
||||||
|
const rect = this.previewCanvas.getBoundingClientRect();
|
||||||
|
const x = Math.floor((e.clientX - rect.left) / (this.previewCanvas.width / tileSet.columns));
|
||||||
|
const y = Math.floor((e.clientY - rect.top) / (this.previewCanvas.height / tileSet.rows));
|
||||||
|
|
||||||
|
this.selectedTileIndex = y * tileSet.columns + x;
|
||||||
|
this.#renderPreview();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new tileset.
|
||||||
|
*/
|
||||||
|
async #addTileSet() {
|
||||||
|
const input = document.createElement("input");
|
||||||
|
input.type = "file";
|
||||||
|
input.accept = "image/png";
|
||||||
|
|
||||||
|
input.addEventListener("change", async (e) => {
|
||||||
|
const file = e.target.files[0];
|
||||||
|
if (!file) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const name = file.name.replace(/\.[^/.]+$/, "");
|
||||||
|
|
||||||
|
let filePath;
|
||||||
|
let nativePath = "";
|
||||||
|
|
||||||
|
// If running in Electron, save the file to app data
|
||||||
|
if (window.electronAPI?.saveTileset) {
|
||||||
|
const arrayBuffer = await file.arrayBuffer();
|
||||||
|
const uint8Array = new Uint8Array(arrayBuffer);
|
||||||
|
const result = await window.electronAPI.saveTileset(uint8Array, file.name);
|
||||||
|
nativePath = result.filePath;
|
||||||
|
// Convert to file:// URL for loading in Image element
|
||||||
|
filePath = `file:///${result.filePath.replace(/\\/g, "/")}`;
|
||||||
|
} else {
|
||||||
|
// Fallback for non-Electron environments (dev/testing)
|
||||||
|
filePath = URL.createObjectURL(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
const tileSet = new TileSet({
|
||||||
|
name,
|
||||||
|
filePath,
|
||||||
|
nativePath,
|
||||||
|
tileWidth: 8,
|
||||||
|
tileHeight: 8
|
||||||
|
});
|
||||||
|
|
||||||
|
await tileSet.load();
|
||||||
|
|
||||||
|
this.tileSets.set(tileSet.id, tileSet);
|
||||||
|
this.#render();
|
||||||
|
this.#selectTileSet(tileSet.id);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to add tileset:", error);
|
||||||
|
alert(`Failed to load tileset:\n${error.message || error}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
input.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens tileset in external editor.
|
||||||
|
*
|
||||||
|
* @param {string} id Tileset ID.
|
||||||
|
*/
|
||||||
|
#openExternal(id) {
|
||||||
|
const tileSet = this.tileSets.get(id);
|
||||||
|
if (!tileSet) return;
|
||||||
|
|
||||||
|
// In Electron, show the file in explorer so user can open with their preferred editor
|
||||||
|
if (window.electronAPI?.showTilesetInFolder && tileSet.nativePath) {
|
||||||
|
window.electronAPI.showTilesetInFolder(tileSet.nativePath);
|
||||||
|
} else {
|
||||||
|
// Fallback: show message
|
||||||
|
const pathToShow = tileSet.nativePath || tileSet.filePath;
|
||||||
|
alert(`To edit this tileset, open:\n${pathToShow}\n\nIn your image editor of choice.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reloads a tileset from disk.
|
||||||
|
*
|
||||||
|
* @param {string} id Tileset ID.
|
||||||
|
*/
|
||||||
|
async #reloadTileSet(id) {
|
||||||
|
const tileSet = this.tileSets.get(id);
|
||||||
|
if (!tileSet) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await tileSet.reload();
|
||||||
|
this.#render();
|
||||||
|
if (this.selectedTileSetId === id) {
|
||||||
|
this.#renderPreview();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to reload tileset:", error);
|
||||||
|
alert(`Failed to reload tileset:\n${error.message || error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a tileset.
|
||||||
|
*
|
||||||
|
* @param {string} id Tileset ID.
|
||||||
|
*/
|
||||||
|
#removeTileSet(id) {
|
||||||
|
if (!confirm("Remove this tileset?")) return;
|
||||||
|
|
||||||
|
this.tileSets.delete(id);
|
||||||
|
|
||||||
|
if (this.selectedTileSetId === id) {
|
||||||
|
this.selectedTileSetId = null;
|
||||||
|
this.selectedTileIndex = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#render();
|
||||||
|
this.#renderPreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edits tileset settings.
|
||||||
|
*
|
||||||
|
* @param {string} id Tileset ID.
|
||||||
|
*/
|
||||||
|
#editTileSetSettings(id) {
|
||||||
|
const tileSet = this.tileSets.get(id);
|
||||||
|
if (!tileSet) return;
|
||||||
|
|
||||||
|
const name = prompt("Tileset name:", tileSet.name);
|
||||||
|
if (!name) return;
|
||||||
|
|
||||||
|
tileSet.name = name;
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects a tileset.
|
||||||
|
*
|
||||||
|
* @param {string} id Tileset ID.
|
||||||
|
*/
|
||||||
|
#selectTileSet(id) {
|
||||||
|
this.selectedTileSetId = id;
|
||||||
|
this.selectedTileIndex = null;
|
||||||
|
this.#render();
|
||||||
|
this.#renderPreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the tileset list.
|
||||||
|
*/
|
||||||
|
#render() {
|
||||||
|
if (this.tileSets.size === 0) {
|
||||||
|
this.#renderEmpty();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tileSetList.innerHTML = "";
|
||||||
|
|
||||||
|
this.tileSets.forEach((tileSet) => {
|
||||||
|
const item = document.createElement("div");
|
||||||
|
item.className = "tileset-item";
|
||||||
|
item.dataset.id = tileSet.id;
|
||||||
|
|
||||||
|
if (this.selectedTileSetId === tileSet.id) {
|
||||||
|
item.classList.add("selected");
|
||||||
|
}
|
||||||
|
|
||||||
|
const preview = document.createElement("div");
|
||||||
|
preview.className = "tileset-item-preview";
|
||||||
|
|
||||||
|
if (tileSet.isLoaded && tileSet.image) {
|
||||||
|
const canvas = document.createElement("canvas");
|
||||||
|
canvas.width = 64;
|
||||||
|
canvas.height = 64;
|
||||||
|
const ctx = canvas.getContext("2d");
|
||||||
|
ctx.imageSmoothingEnabled = false;
|
||||||
|
|
||||||
|
// Draw scaled down version
|
||||||
|
const scale = Math.min(64 / tileSet.image.width, 64 / tileSet.image.height);
|
||||||
|
const w = tileSet.image.width * scale;
|
||||||
|
const h = tileSet.image.height * scale;
|
||||||
|
ctx.drawImage(tileSet.image, 0, 0, w, h);
|
||||||
|
|
||||||
|
preview.appendChild(canvas);
|
||||||
|
} else {
|
||||||
|
preview.textContent = "?";
|
||||||
|
}
|
||||||
|
|
||||||
|
item.appendChild(preview);
|
||||||
|
|
||||||
|
const info = document.createElement("div");
|
||||||
|
info.className = "tileset-item-info";
|
||||||
|
|
||||||
|
const nameEl = document.createElement("div");
|
||||||
|
nameEl.className = "tileset-item-name";
|
||||||
|
nameEl.textContent = tileSet.name;
|
||||||
|
info.appendChild(nameEl);
|
||||||
|
|
||||||
|
const meta = document.createElement("div");
|
||||||
|
meta.className = "tileset-item-meta";
|
||||||
|
meta.textContent = `128×128px • ${tileSet.getTileCount()} tiles (${tileSet.tileWidth}×${tileSet.tileHeight}px each)`;
|
||||||
|
info.appendChild(meta);
|
||||||
|
|
||||||
|
item.appendChild(info);
|
||||||
|
|
||||||
|
const actions = document.createElement("div");
|
||||||
|
actions.className = "tileset-item-actions";
|
||||||
|
|
||||||
|
const openBtn = document.createElement("button");
|
||||||
|
openBtn.className = "tileset-item-btn";
|
||||||
|
openBtn.title = "Open in external editor";
|
||||||
|
openBtn.dataset.action = "open";
|
||||||
|
openBtn.dataset.id = tileSet.id;
|
||||||
|
openBtn.textContent = "✏️";
|
||||||
|
actions.appendChild(openBtn);
|
||||||
|
|
||||||
|
const reloadBtn = document.createElement("button");
|
||||||
|
reloadBtn.className = "tileset-item-btn";
|
||||||
|
reloadBtn.title = "Reload from disk";
|
||||||
|
reloadBtn.dataset.action = "reload";
|
||||||
|
reloadBtn.dataset.id = tileSet.id;
|
||||||
|
reloadBtn.textContent = "🔄";
|
||||||
|
actions.appendChild(reloadBtn);
|
||||||
|
|
||||||
|
const settingsBtn = document.createElement("button");
|
||||||
|
settingsBtn.className = "tileset-item-btn";
|
||||||
|
settingsBtn.title = "Settings";
|
||||||
|
settingsBtn.dataset.action = "edit-settings";
|
||||||
|
settingsBtn.dataset.id = tileSet.id;
|
||||||
|
settingsBtn.textContent = "⚙️";
|
||||||
|
actions.appendChild(settingsBtn);
|
||||||
|
|
||||||
|
const removeBtn = document.createElement("button");
|
||||||
|
removeBtn.className = "tileset-item-btn tileset-item-btn--danger";
|
||||||
|
removeBtn.title = "Remove tileset";
|
||||||
|
removeBtn.dataset.action = "remove";
|
||||||
|
removeBtn.dataset.id = tileSet.id;
|
||||||
|
removeBtn.textContent = "🗑️";
|
||||||
|
actions.appendChild(removeBtn);
|
||||||
|
|
||||||
|
item.appendChild(actions);
|
||||||
|
|
||||||
|
this.tileSetList.appendChild(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the preview panel.
|
||||||
|
*/
|
||||||
|
#renderPreview() {
|
||||||
|
if (!this.selectedTileSetId) {
|
||||||
|
this.previewInfo.textContent = "Select a tileset to preview";
|
||||||
|
this.previewInfo.style.display = "block";
|
||||||
|
this.previewCanvas.style.display = "none";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tileSet = this.tileSets.get(this.selectedTileSetId);
|
||||||
|
if (!tileSet || !tileSet.isLoaded || !tileSet.image) {
|
||||||
|
this.previewInfo.textContent = "Tileset not loaded";
|
||||||
|
this.previewInfo.style.display = "block";
|
||||||
|
this.previewCanvas.style.display = "none";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.previewInfo.style.display = "none";
|
||||||
|
this.previewCanvas.style.display = "block";
|
||||||
|
|
||||||
|
// Set canvas size
|
||||||
|
const scale = 2;
|
||||||
|
this.previewCanvas.width = tileSet.getWidth() * scale;
|
||||||
|
this.previewCanvas.height = tileSet.getHeight() * scale;
|
||||||
|
|
||||||
|
this.previewCtx.imageSmoothingEnabled = false;
|
||||||
|
|
||||||
|
// Draw tileset
|
||||||
|
this.previewCtx.drawImage(
|
||||||
|
tileSet.image,
|
||||||
|
0, 0,
|
||||||
|
tileSet.image.width, tileSet.image.height,
|
||||||
|
0, 0,
|
||||||
|
this.previewCanvas.width, this.previewCanvas.height
|
||||||
|
);
|
||||||
|
|
||||||
|
// Draw grid
|
||||||
|
this.previewCtx.strokeStyle = "rgba(255, 255, 255, 0.3)";
|
||||||
|
this.previewCtx.lineWidth = 1;
|
||||||
|
|
||||||
|
for (let x = 0; x <= tileSet.columns; x++) {
|
||||||
|
const px = x * tileSet.tileWidth * scale;
|
||||||
|
this.previewCtx.beginPath();
|
||||||
|
this.previewCtx.moveTo(px, 0);
|
||||||
|
this.previewCtx.lineTo(px, this.previewCanvas.height);
|
||||||
|
this.previewCtx.stroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let y = 0; y <= tileSet.rows; y++) {
|
||||||
|
const py = y * tileSet.tileHeight * scale;
|
||||||
|
this.previewCtx.beginPath();
|
||||||
|
this.previewCtx.moveTo(0, py);
|
||||||
|
this.previewCtx.lineTo(this.previewCanvas.width, py);
|
||||||
|
this.previewCtx.stroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Highlight selected tile
|
||||||
|
if (this.selectedTileIndex !== null) {
|
||||||
|
const rect = tileSet.getTileRect(this.selectedTileIndex);
|
||||||
|
this.previewCtx.strokeStyle = "rgba(255, 127, 17, 1)";
|
||||||
|
this.previewCtx.lineWidth = 2;
|
||||||
|
this.previewCtx.strokeRect(
|
||||||
|
rect.x * scale,
|
||||||
|
rect.y * scale,
|
||||||
|
rect.width * scale,
|
||||||
|
rect.height * scale
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders empty state.
|
||||||
|
*/
|
||||||
|
#renderEmpty() {
|
||||||
|
this.tileSetList.innerHTML = `
|
||||||
|
<div class="tileset-empty">
|
||||||
|
<div class="tileset-empty-icon">🎨</div>
|
||||||
|
<div class="tileset-empty-text">No tilesets added</div>
|
||||||
|
<div class="tileset-empty-hint">Click "+ Add Tileset" to import a 128x128px PNG</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
this.#renderPreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all tilesets.
|
||||||
|
*
|
||||||
|
* @returns {Array<TileSet>}
|
||||||
|
*/
|
||||||
|
getTileSets() {
|
||||||
|
return Array.from(this.tileSets.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a tileset programmatically.
|
||||||
|
*
|
||||||
|
* @param {TileSet} tileSet Tileset to add.
|
||||||
|
*/
|
||||||
|
addTileSet(tileSet) {
|
||||||
|
this.tileSets.set(tileSet.id, tileSet);
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serializes all tilesets to JSON.
|
||||||
|
*
|
||||||
|
* @returns {Object}
|
||||||
|
*/
|
||||||
|
toJSON() {
|
||||||
|
return {
|
||||||
|
tileSets: Array.from(this.tileSets.values()).map((ts) => ts.toJSON())
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads tilesets from JSON.
|
||||||
|
*
|
||||||
|
* @param {Object} data Serialized data.
|
||||||
|
*/
|
||||||
|
async fromJSON(data) {
|
||||||
|
if (!data.tileSets) return;
|
||||||
|
|
||||||
|
this.tileSets.clear();
|
||||||
|
|
||||||
|
for (const tsData of data.tileSets) {
|
||||||
|
try {
|
||||||
|
const tileSet = TileSet.fromJSON(tsData);
|
||||||
|
await tileSet.load();
|
||||||
|
this.tileSets.set(tileSet.id, tileSet);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to load tileset:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,6 +49,7 @@ export class WorkspaceDragManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the palette ghost transform to match the supplied position.
|
* Updates the palette ghost transform to match the supplied position.
|
||||||
|
* The ghost is offset so the cursor appears at its center.
|
||||||
*
|
*
|
||||||
* @param {{ x: number, y: number }} position Snapped workspace position.
|
* @param {{ x: number, y: number }} position Snapped workspace position.
|
||||||
*/
|
*/
|
||||||
@@ -57,8 +58,14 @@ export class WorkspaceDragManager {
|
|||||||
if (!paletteDragGhost) {
|
if (!paletteDragGhost) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const width = paletteDragGhost.width || 220;
|
||||||
|
const height = paletteDragGhost.height || 140;
|
||||||
|
const centered = {
|
||||||
|
x: position.x - width / 2,
|
||||||
|
y: position.y - height / 2,
|
||||||
|
};
|
||||||
paletteDragGhost.element.style.transform =
|
paletteDragGhost.element.style.transform =
|
||||||
WorkspaceGeometry.positionToTransform(position);
|
WorkspaceGeometry.positionToTransform(centered);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -210,7 +217,7 @@ export class WorkspaceDragManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pointerWorld = this.#clientToWorkspace(
|
const pointerWorld = this.clientToWorkspace(
|
||||||
hasClientX ? pointer.clientX : context.previousClientX,
|
hasClientX ? pointer.clientX : context.previousClientX,
|
||||||
hasClientY ? pointer.clientY : context.previousClientY
|
hasClientY ? pointer.clientY : context.previousClientY
|
||||||
);
|
);
|
||||||
@@ -526,7 +533,7 @@ export class WorkspaceDragManager {
|
|||||||
* @returns {{ x: number, y: number }}
|
* @returns {{ x: number, y: number }}
|
||||||
*/
|
*/
|
||||||
#eventToWorkspacePoint(event) {
|
#eventToWorkspacePoint(event) {
|
||||||
return this.#clientToWorkspace(event.clientX, event.clientY);
|
return this.clientToWorkspace(event.clientX, event.clientY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -560,14 +567,20 @@ export class WorkspaceDragManager {
|
|||||||
* @param {number | undefined} clientY Viewport Y coordinate.
|
* @param {number | undefined} clientY Viewport Y coordinate.
|
||||||
* @returns {{ x: number, y: number }}
|
* @returns {{ x: number, y: number }}
|
||||||
*/
|
*/
|
||||||
#clientToWorkspace(clientX, clientY) {
|
clientToWorkspace(clientX, clientY) {
|
||||||
const rect = this.workspace.workspaceElement.getBoundingClientRect();
|
const rect = this.workspace.workspaceElement.getBoundingClientRect();
|
||||||
const zoom = this.workspace.zoomLevel || 1;
|
const zoom = this.workspace.navigationManager?.getZoomLevel() ?? this.workspace.zoomLevel ?? 1;
|
||||||
|
const clampedZoom = Math.max(0.01, zoom);
|
||||||
const safeX = Number.isFinite(clientX) ? clientX : rect.left;
|
const safeX = Number.isFinite(clientX) ? clientX : rect.left;
|
||||||
const safeY = Number.isFinite(clientY) ? clientY : rect.top;
|
const safeY = Number.isFinite(clientY) ? clientY : rect.top;
|
||||||
|
const effectiveOffset = this.workspace.navigationManager?.getEffectiveOffset?.();
|
||||||
|
const offset = {
|
||||||
|
x: Number.isFinite(effectiveOffset?.x) ? effectiveOffset.x : 0,
|
||||||
|
y: Number.isFinite(effectiveOffset?.y) ? effectiveOffset.y : 0,
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
x: (safeX - rect.left) / zoom,
|
x: (safeX - rect.left) / clampedZoom - offset.x,
|
||||||
y: (safeY - rect.top) / zoom,
|
y: (safeY - rect.top) / clampedZoom - offset.y,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -188,10 +188,14 @@ export class WorkspaceDropManager {
|
|||||||
|
|
||||||
this.#workspace.paletteManager.handleDragEnd();
|
this.#workspace.paletteManager.handleDragEnd();
|
||||||
|
|
||||||
const spawn = WorkspaceGeometry.snapPositionToGrid(
|
// Snap to grid first, then offset for centering (consistent with ghost positioning)
|
||||||
this.#workspace,
|
const cursorWorld = WorkspaceGeometry.eventToWorkspacePoint(this.#workspace, event);
|
||||||
WorkspaceGeometry.eventToWorkspacePoint(this.#workspace, event)
|
const snapped = WorkspaceGeometry.snapPositionToGrid(this.#workspace, cursorWorld);
|
||||||
);
|
// Offset spawn to match the centered ghost position (roughly half ghost size)
|
||||||
|
const spawn = {
|
||||||
|
x: snapped.x - 110,
|
||||||
|
y: snapped.y - 70,
|
||||||
|
};
|
||||||
|
|
||||||
this.#workspace.addNode(definitionId, spawn);
|
this.#workspace.addNode(definitionId, spawn);
|
||||||
}
|
}
|
||||||
@@ -214,10 +218,12 @@ export class WorkspaceDropManager {
|
|||||||
|
|
||||||
const definitions = this.#getVariableSpawnDefinitions(variableId);
|
const definitions = this.#getVariableSpawnDefinitions(variableId);
|
||||||
if (!definitions.length) {
|
if (!definitions.length) {
|
||||||
const spawn = WorkspaceGeometry.snapPositionToGrid(
|
const cursorWorld = WorkspaceGeometry.eventToWorkspacePoint(this.#workspace, event);
|
||||||
this.#workspace,
|
const snapped = WorkspaceGeometry.snapPositionToGrid(this.#workspace, cursorWorld);
|
||||||
WorkspaceGeometry.eventToWorkspacePoint(this.#workspace, event)
|
const spawn = {
|
||||||
);
|
x: snapped.x - 110,
|
||||||
|
y: snapped.y - 70,
|
||||||
|
};
|
||||||
const fallback = this.#workspace.addNode("get_var", spawn);
|
const fallback = this.#workspace.addNode("get_var", spawn);
|
||||||
if (fallback) {
|
if (fallback) {
|
||||||
const nodeName = variable.name || variable.id;
|
const nodeName = variable.name || variable.id;
|
||||||
|
|||||||
@@ -29,20 +29,11 @@ export class WorkspaceGeometry {
|
|||||||
* Converts viewport coordinates into workspace-relative coordinates.
|
* Converts viewport coordinates into workspace-relative coordinates.
|
||||||
*
|
*
|
||||||
* @param {import('../BlueprintWorkspace.js').BlueprintWorkspace} workspace Workspace instance.
|
* @param {import('../BlueprintWorkspace.js').BlueprintWorkspace} workspace Workspace instance.
|
||||||
* @param {{ clientX: number, clientY: number }} event Pointer-like event payload.
|
* @param {{ clientX?: number, clientY?: number }} event Pointer-like event payload.
|
||||||
* @returns {{ x: number, y: number }}
|
* @returns {{ x: number, y: number }}
|
||||||
*/
|
*/
|
||||||
static eventToWorkspacePoint(workspace, event) {
|
static eventToWorkspacePoint(workspace, event) {
|
||||||
const rect = workspace.workspaceElement.getBoundingClientRect();
|
return workspace.dragManager.clientToWorkspace(event?.clientX, event?.clientY);
|
||||||
const rawX = event?.clientX ?? 0;
|
|
||||||
const rawY = event?.clientY ?? 0;
|
|
||||||
const x = rawX - rect.left;
|
|
||||||
const y = rawY - rect.top;
|
|
||||||
const zoom = workspace.zoomLevel || 1;
|
|
||||||
return {
|
|
||||||
x: Math.max(0, Math.min(rect.width, x)) / zoom,
|
|
||||||
y: Math.max(0, Math.min(rect.height, y)) / zoom,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,8 +45,9 @@ export class WorkspaceGeometry {
|
|||||||
*/
|
*/
|
||||||
static snapPositionToGrid(workspace, position) {
|
static snapPositionToGrid(workspace, position) {
|
||||||
const size = workspace.gridSize || DEFAULT_GRID_SIZE;
|
const size = workspace.gridSize || DEFAULT_GRID_SIZE;
|
||||||
const offsetX = workspace.workspaceBackgroundOffset?.x ?? 0;
|
const effectiveOffset = workspace.navigationManager?.getEffectiveOffset?.();
|
||||||
const offsetY = workspace.workspaceBackgroundOffset?.y ?? 0;
|
const offsetX = Number.isFinite(effectiveOffset?.x) ? effectiveOffset.x : 0;
|
||||||
|
const offsetY = Number.isFinite(effectiveOffset?.y) ? effectiveOffset.y : 0;
|
||||||
const snap = (value, offset) => {
|
const snap = (value, offset) => {
|
||||||
const local = value - offset;
|
const local = value - offset;
|
||||||
const snapped = Math.round(local / size) * size;
|
const snapped = Math.round(local / size) * size;
|
||||||
|
|||||||
@@ -302,7 +302,6 @@ export class WorkspaceHistoryManager {
|
|||||||
this.#pendingReason = null;
|
this.#pendingReason = null;
|
||||||
|
|
||||||
this.#workspace.applySerializedWorkspace(snapshot.workspace);
|
this.#workspace.applySerializedWorkspace(snapshot.workspace);
|
||||||
this.#workspace.applyHistoryView(snapshot.view);
|
|
||||||
this.#workspace.applyHistorySelection(snapshot.selection);
|
this.#workspace.applyHistorySelection(snapshot.selection);
|
||||||
|
|
||||||
this.isReady = wasReady;
|
this.isReady = wasReady;
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
import { createColorSwatchPicker } from '../ColorSwatchPicker.js';
|
||||||
|
import { getTypeColor } from '../../types/TypeRegistry.js';
|
||||||
|
|
||||||
/** @typedef {import('../../core/BlueprintNode.js').BlueprintNode} BlueprintNode */
|
/** @typedef {import('../../core/BlueprintNode.js').BlueprintNode} BlueprintNode */
|
||||||
/** @typedef {import('../../core/BlueprintNode.js').PinDescriptor} PinDescriptor */
|
/** @typedef {import('../../core/BlueprintNode.js').PinDescriptor} PinDescriptor */
|
||||||
/** @typedef {import('../../core/NodeGraph.js').NodeGraph} NodeGraph */
|
/** @typedef {import('../../core/NodeGraph.js').NodeGraph} NodeGraph */
|
||||||
@@ -75,6 +78,7 @@ export class WorkspaceInlineEditorManager {
|
|||||||
"number_literal",
|
"number_literal",
|
||||||
"string_literal",
|
"string_literal",
|
||||||
"boolean_literal",
|
"boolean_literal",
|
||||||
|
"color_literal",
|
||||||
]);
|
]);
|
||||||
if (!supported.has(node.type)) {
|
if (!supported.has(node.type)) {
|
||||||
return null;
|
return null;
|
||||||
@@ -100,6 +104,27 @@ export class WorkspaceInlineEditorManager {
|
|||||||
editor.appendChild(label);
|
editor.appendChild(label);
|
||||||
|
|
||||||
const graph = this.#getGraph();
|
const graph = this.#getGraph();
|
||||||
|
|
||||||
|
if (node.type === "color_literal") {
|
||||||
|
const picker = createColorSwatchPicker({
|
||||||
|
id: controlId,
|
||||||
|
value: node.properties.value ?? 7,
|
||||||
|
onChange: (index) => {
|
||||||
|
graph.setNodeProperty(node.id, "value", index);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
editor.appendChild(picker.element);
|
||||||
|
|
||||||
|
const setValue = (rawValue) => {
|
||||||
|
const n = Number(rawValue);
|
||||||
|
picker.setValue(Number.isFinite(n) ? n : 7);
|
||||||
|
};
|
||||||
|
|
||||||
|
const entry = this.#ensureEntry(node.id);
|
||||||
|
entry.literal = { setValue };
|
||||||
|
return entry.literal;
|
||||||
|
}
|
||||||
|
|
||||||
let control;
|
let control;
|
||||||
const commitNumber = () => {
|
const commitNumber = () => {
|
||||||
const numeric = Number(control.value);
|
const numeric = Number(control.value);
|
||||||
@@ -176,6 +201,7 @@ export class WorkspaceInlineEditorManager {
|
|||||||
{ value: "string", label: "String" },
|
{ value: "string", label: "String" },
|
||||||
{ value: "boolean", label: "Boolean" },
|
{ value: "boolean", label: "Boolean" },
|
||||||
{ value: "table", label: "Table" },
|
{ value: "table", label: "Table" },
|
||||||
|
{ value: "color", label: "Color" },
|
||||||
];
|
];
|
||||||
|
|
||||||
const ensureBody = () => {
|
const ensureBody = () => {
|
||||||
@@ -274,6 +300,8 @@ export class WorkspaceInlineEditorManager {
|
|||||||
return "valueBoolean";
|
return "valueBoolean";
|
||||||
case "table":
|
case "table":
|
||||||
return "valueTable";
|
return "valueTable";
|
||||||
|
case "color":
|
||||||
|
return "valueColor";
|
||||||
case "number":
|
case "number":
|
||||||
default:
|
default:
|
||||||
return "valueNumber";
|
return "valueNumber";
|
||||||
@@ -288,6 +316,8 @@ export class WorkspaceInlineEditorManager {
|
|||||||
return "string";
|
return "string";
|
||||||
case "table":
|
case "table":
|
||||||
return "table";
|
return "table";
|
||||||
|
case "color":
|
||||||
|
return "color";
|
||||||
default:
|
default:
|
||||||
return "number";
|
return "number";
|
||||||
}
|
}
|
||||||
@@ -301,6 +331,8 @@ export class WorkspaceInlineEditorManager {
|
|||||||
return false;
|
return false;
|
||||||
case "table":
|
case "table":
|
||||||
return "{}";
|
return "{}";
|
||||||
|
case "color":
|
||||||
|
return 7;
|
||||||
case "number":
|
case "number":
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
@@ -313,6 +345,7 @@ export class WorkspaceInlineEditorManager {
|
|||||||
const normalized = normalizeType(type);
|
const normalized = normalizeType(type);
|
||||||
activeType = normalized;
|
activeType = normalized;
|
||||||
typeButton.dataset.variableType = normalized;
|
typeButton.dataset.variableType = normalized;
|
||||||
|
typeButton.style.setProperty("--overview-variable-color", getTypeColor(normalized));
|
||||||
const label = formatType(normalized);
|
const label = formatType(normalized);
|
||||||
typeButton.title = `Type: ${label}`;
|
typeButton.title = `Type: ${label}`;
|
||||||
typeButton.setAttribute(
|
typeButton.setAttribute(
|
||||||
@@ -378,6 +411,20 @@ export class WorkspaceInlineEditorManager {
|
|||||||
graph.setNodeProperty(currentNode.id, key, textarea.value);
|
graph.setNodeProperty(currentNode.id, key, textarea.value);
|
||||||
});
|
});
|
||||||
control = textarea;
|
control = textarea;
|
||||||
|
} else if (desiredKind === "color") {
|
||||||
|
const rawColor = currentNode.properties?.[key];
|
||||||
|
const n = Number(rawColor);
|
||||||
|
const initialIndex = Number.isFinite(n) ? Math.max(0, Math.min(15, Math.round(n))) : 7;
|
||||||
|
const picker = createColorSwatchPicker({
|
||||||
|
value: initialIndex,
|
||||||
|
onChange: (index) => {
|
||||||
|
graph.setNodeProperty(currentNode.id, key, index);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
picker.element.dataset.localValueKind = "color";
|
||||||
|
/** @type {any} */ (picker.element)._setColorValue = picker.setValue;
|
||||||
|
valueField.appendChild(picker.element);
|
||||||
|
return picker.element;
|
||||||
} else {
|
} else {
|
||||||
const numberInput = document.createElement("input");
|
const numberInput = document.createElement("input");
|
||||||
numberInput.type = "number";
|
numberInput.type = "number";
|
||||||
@@ -407,6 +454,10 @@ export class WorkspaceInlineEditorManager {
|
|||||||
if (control.value !== nextValue) {
|
if (control.value !== nextValue) {
|
||||||
control.value = nextValue;
|
control.value = nextValue;
|
||||||
}
|
}
|
||||||
|
} else if (/** @type {any} */ (control)._setColorValue) {
|
||||||
|
const n = Number(current);
|
||||||
|
const index = Number.isFinite(n) ? Math.max(0, Math.min(15, Math.round(n))) : 7;
|
||||||
|
/** @type {any} */ (control)._setColorValue(index);
|
||||||
} else if (control instanceof HTMLTextAreaElement) {
|
} else if (control instanceof HTMLTextAreaElement) {
|
||||||
const nextValue = typeof current === "string" ? current : "{}";
|
const nextValue = typeof current === "string" ? current : "{}";
|
||||||
if (control.value !== nextValue) {
|
if (control.value !== nextValue) {
|
||||||
@@ -534,18 +585,10 @@ export class WorkspaceInlineEditorManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isIfCondition = node.type === "if" && pin.id === "condition";
|
const isIfCondition = node.type === "if" && pin.id === "condition";
|
||||||
const isExtcmdCommand =
|
const isColorPin = pin.kind === "color";
|
||||||
node.type === "system_extcmd" && pin.id === "command";
|
const pinOptions =
|
||||||
const isNamedButtonSelector =
|
Array.isArray(pin.options) && pin.options.length > 0 ? pin.options : null;
|
||||||
node.type === "input_button_constants" && pin.id === "button";
|
if (!isIfCondition && !pinOptions && !isColorPin) {
|
||||||
const isNamedPlayerSelector =
|
|
||||||
node.type === "input_button_constants" && pin.id === "player";
|
|
||||||
if (
|
|
||||||
!isIfCondition &&
|
|
||||||
!isExtcmdCommand &&
|
|
||||||
!isNamedButtonSelector &&
|
|
||||||
!isNamedPlayerSelector
|
|
||||||
) {
|
|
||||||
container.classList.remove("has-inline-dropdown");
|
container.classList.remove("has-inline-dropdown");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -555,31 +598,14 @@ export class WorkspaceInlineEditorManager {
|
|||||||
const graph = this.#getGraph();
|
const graph = this.#getGraph();
|
||||||
|
|
||||||
if (!(propertyKey in node.properties)) {
|
if (!(propertyKey in node.properties)) {
|
||||||
if (isExtcmdCommand || isNamedButtonSelector || isNamedPlayerSelector) {
|
if (pinOptions) {
|
||||||
const definition = this.registry.get(node.type);
|
const defaultStr =
|
||||||
const targetKey = isExtcmdCommand
|
pin.defaultValue != null
|
||||||
? "command"
|
? String(pin.defaultValue)
|
||||||
: isNamedButtonSelector
|
: String(pinOptions[0]?.value ?? "");
|
||||||
? "button"
|
node.properties[propertyKey] = defaultStr;
|
||||||
: "player";
|
if (!(pin.id in node.properties)) {
|
||||||
const schema = definition?.properties?.find(
|
node.properties[pin.id] = defaultStr;
|
||||||
(prop) => prop.key === targetKey
|
|
||||||
);
|
|
||||||
const options = Array.isArray(schema?.options) ? schema.options : [];
|
|
||||||
const defaultOption =
|
|
||||||
typeof node.properties[targetKey] === "string"
|
|
||||||
? node.properties[targetKey]
|
|
||||||
: String(schema?.defaultValue ?? options[0]?.value ?? "");
|
|
||||||
if (typeof node.properties[targetKey] !== "string") {
|
|
||||||
node.properties[targetKey] = defaultOption;
|
|
||||||
}
|
|
||||||
if (isExtcmdCommand) {
|
|
||||||
node.properties[propertyKey] = defaultOption;
|
|
||||||
} else {
|
|
||||||
const numericDefault = Number.parseInt(defaultOption, 10);
|
|
||||||
node.properties[propertyKey] = Number.isFinite(numericDefault)
|
|
||||||
? numericDefault
|
|
||||||
: 0;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
node.properties[propertyKey] = this.#defaultValueForPin(pin);
|
node.properties[propertyKey] = this.#defaultValueForPin(pin);
|
||||||
@@ -591,7 +617,7 @@ export class WorkspaceInlineEditorManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let wrapper;
|
let wrapper;
|
||||||
if (isExtcmdCommand || isNamedButtonSelector || isNamedPlayerSelector) {
|
if (pinOptions) {
|
||||||
wrapper = document.createElement("div");
|
wrapper = document.createElement("div");
|
||||||
wrapper.className = "pin-inline-control pin-inline-dropdown";
|
wrapper.className = "pin-inline-control pin-inline-dropdown";
|
||||||
container.appendChild(wrapper);
|
container.appendChild(wrapper);
|
||||||
@@ -631,29 +657,14 @@ export class WorkspaceInlineEditorManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isExtcmdCommand || isNamedButtonSelector || isNamedPlayerSelector) {
|
if (pinOptions) {
|
||||||
const definition = this.registry.get(node.type);
|
const optionValues = pinOptions.map((o) => String(o.value));
|
||||||
const targetKey = isExtcmdCommand
|
|
||||||
? "command"
|
|
||||||
: isNamedButtonSelector
|
|
||||||
? "button"
|
|
||||||
: "player";
|
|
||||||
const schema = definition?.properties?.find(
|
|
||||||
(prop) => prop.key === targetKey
|
|
||||||
);
|
|
||||||
const options = Array.isArray(schema?.options) ? schema.options : [];
|
|
||||||
|
|
||||||
const select = document.createElement("select");
|
const select = document.createElement("select");
|
||||||
select.className = "pin-inline-select";
|
select.className = "pin-inline-select";
|
||||||
const ariaLabel = isExtcmdCommand
|
select.setAttribute("aria-label", pin.name || pin.id);
|
||||||
? "Command"
|
|
||||||
: isNamedButtonSelector
|
|
||||||
? "Button"
|
|
||||||
: "Player";
|
|
||||||
select.setAttribute("aria-label", ariaLabel);
|
|
||||||
|
|
||||||
const values = options.map((option) => String(option.value));
|
pinOptions.forEach((option) => {
|
||||||
options.forEach((option) => {
|
|
||||||
const element = document.createElement("option");
|
const element = document.createElement("option");
|
||||||
element.value = String(option.value);
|
element.value = String(option.value);
|
||||||
element.textContent = option.label ?? String(option.value);
|
element.textContent = option.label ?? String(option.value);
|
||||||
@@ -661,30 +672,14 @@ export class WorkspaceInlineEditorManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const normalizeValue = (value) => {
|
const normalizeValue = (value) => {
|
||||||
const candidate =
|
const candidate = value == null ? "" : String(value);
|
||||||
typeof value === "string" ? value : String(value ?? "");
|
return optionValues.includes(candidate)
|
||||||
if (values.length === 0) {
|
? candidate
|
||||||
return candidate;
|
: (optionValues[0] ?? "");
|
||||||
}
|
|
||||||
if (values.includes(candidate)) {
|
|
||||||
return candidate;
|
|
||||||
}
|
|
||||||
const schemaDefault =
|
|
||||||
schema?.defaultValue != null ? String(schema.defaultValue) : null;
|
|
||||||
if (schemaDefault && values.includes(schemaDefault)) {
|
|
||||||
return schemaDefault;
|
|
||||||
}
|
|
||||||
return values[0];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const setValue = (value) => {
|
const setValue = (value) => {
|
||||||
const normalized = normalizeValue(
|
select.value = normalizeValue(value);
|
||||||
(isNamedButtonSelector || isNamedPlayerSelector) &&
|
|
||||||
typeof node.properties[targetKey] === "string"
|
|
||||||
? node.properties[targetKey]
|
|
||||||
: value
|
|
||||||
);
|
|
||||||
select.value = normalized;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const setConnected = (connected) => {
|
const setConnected = (connected) => {
|
||||||
@@ -694,23 +689,42 @@ export class WorkspaceInlineEditorManager {
|
|||||||
|
|
||||||
select.addEventListener("change", () => {
|
select.addEventListener("change", () => {
|
||||||
const nextValue = select.value;
|
const nextValue = select.value;
|
||||||
if (isExtcmdCommand) {
|
graph.setNodeProperty(node.id, propertyKey, nextValue);
|
||||||
graph.setNodeProperty(node.id, propertyKey, nextValue);
|
graph.setNodeProperty(node.id, pin.id, nextValue);
|
||||||
graph.setNodeProperty(node.id, "command", nextValue);
|
|
||||||
} else {
|
|
||||||
const normalized = normalizeValue(nextValue);
|
|
||||||
const numeric = Number.parseInt(normalized, 10);
|
|
||||||
graph.setNodeProperty(
|
|
||||||
node.id,
|
|
||||||
propertyKey,
|
|
||||||
Number.isFinite(numeric) ? numeric : 0
|
|
||||||
);
|
|
||||||
graph.setNodeProperty(node.id, targetKey, normalized);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapper.appendChild(select);
|
wrapper.appendChild(select);
|
||||||
|
|
||||||
|
entry.pinEditors.set(pin.id, { setValue, setConnected });
|
||||||
|
setValue(node.properties[propertyKey]);
|
||||||
|
setConnected(this.#hasConnection(node.id, pin.id));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isColorPin) {
|
||||||
|
const rawDefault = node.properties[propertyKey];
|
||||||
|
const n = Number(rawDefault);
|
||||||
|
const initialIndex = Number.isFinite(n)
|
||||||
|
? Math.max(0, Math.min(15, Math.round(n)))
|
||||||
|
: 7;
|
||||||
|
|
||||||
|
const picker = createColorSwatchPicker({
|
||||||
|
value: initialIndex,
|
||||||
|
onChange: (index) => {
|
||||||
|
graph.setNodeProperty(node.id, propertyKey, index);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
wrapper.appendChild(picker.element);
|
||||||
|
|
||||||
|
const setValue = (value) => {
|
||||||
|
const num = Number(value);
|
||||||
|
picker.setValue(Number.isFinite(num) ? num : 7);
|
||||||
|
};
|
||||||
|
|
||||||
|
const setConnected = (connected) => {
|
||||||
|
wrapper.classList.toggle("is-hidden", connected);
|
||||||
|
};
|
||||||
|
|
||||||
entry.pinEditors.set(pin.id, { setValue, setConnected });
|
entry.pinEditors.set(pin.id, { setValue, setConnected });
|
||||||
setValue(node.properties[propertyKey]);
|
setValue(node.properties[propertyKey]);
|
||||||
setConnected(this.#hasConnection(node.id, pin.id));
|
setConnected(this.#hasConnection(node.id, pin.id));
|
||||||
@@ -765,45 +779,12 @@ export class WorkspaceInlineEditorManager {
|
|||||||
const propertyKey = this.#pinPropertyKey(pinId);
|
const propertyKey = this.#pinPropertyKey(pinId);
|
||||||
let value;
|
let value;
|
||||||
|
|
||||||
if (node.type === "system_extcmd" && pinId === "command") {
|
if (Array.isArray(pin?.options) && pin.options.length > 0) {
|
||||||
const commandValue =
|
const canonical = node.properties[pinId];
|
||||||
typeof node.properties.command === "string"
|
if (canonical != null) {
|
||||||
? node.properties.command
|
const strValue = String(canonical);
|
||||||
: null;
|
if (node.properties[propertyKey] !== strValue) {
|
||||||
if (
|
node.properties[propertyKey] = strValue;
|
||||||
commandValue !== null &&
|
|
||||||
node.properties[propertyKey] !== commandValue
|
|
||||||
) {
|
|
||||||
node.properties[propertyKey] = commandValue;
|
|
||||||
}
|
|
||||||
} else if (node.type === "input_button_constants") {
|
|
||||||
if (pinId === "button") {
|
|
||||||
const rawButton =
|
|
||||||
typeof node.properties.button === "string"
|
|
||||||
? node.properties.button
|
|
||||||
: null;
|
|
||||||
if (rawButton !== null) {
|
|
||||||
const numericButton = Number.parseInt(rawButton, 10);
|
|
||||||
const safeButton = Number.isFinite(numericButton)
|
|
||||||
? numericButton
|
|
||||||
: 0;
|
|
||||||
if (node.properties[propertyKey] !== safeButton) {
|
|
||||||
node.properties[propertyKey] = safeButton;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (pinId === "player") {
|
|
||||||
const rawPlayer =
|
|
||||||
typeof node.properties.player === "string"
|
|
||||||
? node.properties.player
|
|
||||||
: null;
|
|
||||||
if (rawPlayer !== null) {
|
|
||||||
const numericPlayer = Number.parseInt(rawPlayer, 10);
|
|
||||||
const safePlayer = Number.isFinite(numericPlayer)
|
|
||||||
? numericPlayer
|
|
||||||
: 0;
|
|
||||||
if (node.properties[propertyKey] !== safePlayer) {
|
|
||||||
node.properties[propertyKey] = safePlayer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -905,6 +886,8 @@ export class WorkspaceInlineEditorManager {
|
|||||||
return 0;
|
return 0;
|
||||||
case "string":
|
case "string":
|
||||||
return "";
|
return "";
|
||||||
|
case "color":
|
||||||
|
return 7;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ export class WorkspaceNavigationManager {
|
|||||||
#zoomConfig;
|
#zoomConfig;
|
||||||
#panState;
|
#panState;
|
||||||
#lastPanTimestamp;
|
#lastPanTimestamp;
|
||||||
|
#targetZoomLevel;
|
||||||
|
#smoothZoomFocus;
|
||||||
|
#smoothZoomRafId;
|
||||||
|
#pendingLayerOffset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../BlueprintWorkspace.js").BlueprintWorkspace} workspace Owning workspace instance.
|
* @param {import("../BlueprintWorkspace.js").BlueprintWorkspace} workspace Owning workspace instance.
|
||||||
@@ -39,6 +43,10 @@ export class WorkspaceNavigationManager {
|
|||||||
this.#zoomConfig = { min: 0.25, max: 2.5, step: 0.1 };
|
this.#zoomConfig = { min: 0.25, max: 2.5, step: 0.1 };
|
||||||
this.#panState = null;
|
this.#panState = null;
|
||||||
this.#lastPanTimestamp = 0;
|
this.#lastPanTimestamp = 0;
|
||||||
|
this.#targetZoomLevel = 1;
|
||||||
|
this.#smoothZoomFocus = null;
|
||||||
|
this.#smoothZoomRafId = null;
|
||||||
|
this.#pendingLayerOffset = { x: 0, y: 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,18 +56,29 @@ export class WorkspaceNavigationManager {
|
|||||||
return this.#zoomLevel;
|
return this.#zoomLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the accumulated node-layer translate offset that is pending commit
|
||||||
|
* during a smooth zoom animation. This must be accounted for when converting
|
||||||
|
* screen/client coordinates to world coordinates mid-lerp.
|
||||||
|
*
|
||||||
|
* @returns {{ x: number, y: number }}
|
||||||
|
*/
|
||||||
|
getPendingLayerOffset() {
|
||||||
|
return { x: this.#pendingLayerOffset.x, y: this.#pendingLayerOffset.y };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjusts the zoom level within configured bounds.
|
* Adjusts the zoom level within configured bounds.
|
||||||
*
|
*
|
||||||
* @param {number} nextZoom Requested zoom multiplier.
|
* @param {number} nextZoom Requested zoom multiplier.
|
||||||
* @param {{ silent?: boolean }} [options] Behaviour overrides.
|
* @param {{ silent?: boolean, skipConnectionRender?: boolean }} [options] Behaviour overrides.
|
||||||
* @returns {boolean} Whether the zoom value changed.
|
* @returns {boolean} Whether the zoom value changed.
|
||||||
*/
|
*/
|
||||||
setZoomLevel(nextZoom, options = {}) {
|
setZoomLevel(nextZoom, options = {}) {
|
||||||
if (!Number.isFinite(nextZoom)) {
|
if (!Number.isFinite(nextZoom)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const { silent = false } = options;
|
const { silent = false, skipConnectionRender = false } = options;
|
||||||
const clamped = Math.max(
|
const clamped = Math.max(
|
||||||
this.#zoomConfig.min,
|
this.#zoomConfig.min,
|
||||||
Math.min(this.#zoomConfig.max, nextZoom)
|
Math.min(this.#zoomConfig.max, nextZoom)
|
||||||
@@ -68,12 +87,25 @@ export class WorkspaceNavigationManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#zoomLevel = clamped;
|
// Cancel any running smooth zoom so programmatic calls take immediate effect.
|
||||||
this.updateZoomDisplay();
|
if (this.#smoothZoomRafId !== null) {
|
||||||
if (!silent) {
|
cancelAnimationFrame(this.#smoothZoomRafId);
|
||||||
this.#markViewDirty("view", 200);
|
this.#smoothZoomRafId = null;
|
||||||
this.#schedulePersist();
|
this.#smoothZoomFocus = null;
|
||||||
|
// Commit any pending layer offset before the snap.
|
||||||
|
const pending = this.#pendingLayerOffset;
|
||||||
|
this.#pendingLayerOffset = { x: 0, y: 0 };
|
||||||
|
if (Math.abs(pending.x) > 0.0001 || Math.abs(pending.y) > 0.0001) {
|
||||||
|
this.setBackgroundOffset({
|
||||||
|
x: this.#backgroundOffset.x - pending.x,
|
||||||
|
y: this.#backgroundOffset.y - pending.y,
|
||||||
|
});
|
||||||
|
this.translateWorkspace(pending);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.#targetZoomLevel = clamped;
|
||||||
|
this.#zoomLevel = clamped;
|
||||||
|
this.updateZoomDisplay(skipConnectionRender);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,28 +118,38 @@ export class WorkspaceNavigationManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates workspace transforms to match the stored zoom level.
|
* Updates workspace transforms to match the stored zoom level.
|
||||||
|
*
|
||||||
|
* @param {boolean} [skipConnectionRender] When true, skips the connection re-render pass.
|
||||||
*/
|
*/
|
||||||
updateZoomDisplay() {
|
updateZoomDisplay(skipConnectionRender = false) {
|
||||||
const zoom = this.#zoomLevel || 1;
|
const zoom = this.#zoomLevel || 1;
|
||||||
const { nodeLayer, connectionLayer, workspaceElement } = this.#workspace;
|
const { nodeLayer, connectionLayer, workspaceElement } = this.#workspace;
|
||||||
|
|
||||||
|
const tx = (this.#backgroundOffset.x + this.#pendingLayerOffset.x) * zoom;
|
||||||
|
const ty = (this.#backgroundOffset.y + this.#pendingLayerOffset.y) * zoom;
|
||||||
|
|
||||||
if (nodeLayer) {
|
if (nodeLayer) {
|
||||||
nodeLayer.style.transformOrigin = "0 0";
|
nodeLayer.style.transformOrigin = "0 0";
|
||||||
nodeLayer.style.transform = `scale(${zoom})`;
|
nodeLayer.style.transform = `translate(${tx}px, ${ty}px) scale(${zoom})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connectionLayer) {
|
if (connectionLayer) {
|
||||||
connectionLayer.style.transformOrigin = "0 0";
|
connectionLayer.style.transformOrigin = "0 0";
|
||||||
connectionLayer.style.transform = `scale(${zoom})`;
|
connectionLayer.style.transform = `translate(${tx}px, ${ty}px) scale(${zoom})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
workspaceElement.style.setProperty("--workspace-zoom", `${zoom}`);
|
workspaceElement.style.setProperty("--workspace-zoom", `${zoom}`);
|
||||||
this.#applyBackgroundOffset();
|
this.#applyBackgroundOffset();
|
||||||
this.#renderConnections();
|
if (!skipConnectionRender) {
|
||||||
|
this.#renderConnections();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a screen-space point to workspace coordinates.
|
* Converts a screen-space point to workspace coordinates.
|
||||||
|
* Note: This returns screen coordinates divided by zoom only, without subtracting
|
||||||
|
* the background offset. This is intentional for zoom pivot calculations.
|
||||||
|
* For true world coordinates, use dragManager.clientToWorkspace().
|
||||||
*
|
*
|
||||||
* @param {{ x: number, y: number }} point Screen-space point relative to the workspace element.
|
* @param {{ x: number, y: number }} point Screen-space point relative to the workspace element.
|
||||||
* @returns {{ x: number, y: number }}
|
* @returns {{ x: number, y: number }}
|
||||||
@@ -134,6 +176,107 @@ export class WorkspaceNavigationManager {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queues a smooth animated zoom step centred on a screen-space point.
|
||||||
|
* Subsequent calls before the animation settles accumulate the target zoom.
|
||||||
|
*
|
||||||
|
* @param {{ x: number, y: number }} screenPoint Focus point in workspace-relative screen coordinates.
|
||||||
|
* @param {number} direction Positive to zoom in, negative to zoom out.
|
||||||
|
* @param {{ clientX?: number, clientY?: number }} [pointer] Pointer coordinates relative to the viewport.
|
||||||
|
*/
|
||||||
|
pushSmoothZoom(screenPoint, direction, pointer = {}) {
|
||||||
|
if (!direction) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const step = direction * this.#zoomConfig.step;
|
||||||
|
this.#targetZoomLevel = Math.max(
|
||||||
|
this.#zoomConfig.min,
|
||||||
|
Math.min(this.#zoomConfig.max, this.#targetZoomLevel + step)
|
||||||
|
);
|
||||||
|
this.#smoothZoomFocus = { screenPoint, pointer };
|
||||||
|
|
||||||
|
if (this.#smoothZoomRafId === null) {
|
||||||
|
this.#smoothZoomRafId = requestAnimationFrame(() => this.#tickSmoothZoom());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Advances one frame of the smooth zoom animation, easing toward the target.
|
||||||
|
*/
|
||||||
|
#tickSmoothZoom() {
|
||||||
|
this.#smoothZoomRafId = null;
|
||||||
|
|
||||||
|
if (!this.#smoothZoomFocus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const target = this.#targetZoomLevel;
|
||||||
|
const current = this.#zoomLevel;
|
||||||
|
const diff = target - current;
|
||||||
|
const settled = Math.abs(diff) < 0.001;
|
||||||
|
const newZoom = settled
|
||||||
|
? target
|
||||||
|
: Math.max(this.#zoomConfig.min, Math.min(this.#zoomConfig.max, current + diff * 0.25));
|
||||||
|
|
||||||
|
const { screenPoint, pointer } = this.#smoothZoomFocus;
|
||||||
|
const previousZoom = current;
|
||||||
|
|
||||||
|
// screenPointToWorld still uses the old zoom at this point, which is correct.
|
||||||
|
const worldPoint = this.screenPointToWorld(screenPoint);
|
||||||
|
this.#zoomLevel = newZoom;
|
||||||
|
|
||||||
|
const scale = previousZoom / newZoom;
|
||||||
|
const shift = {
|
||||||
|
x: worldPoint.x * (scale - 1),
|
||||||
|
y: worldPoint.y * (scale - 1),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Accumulate into a pending layer offset — O(1), no per-node work each frame.
|
||||||
|
this.#pendingLayerOffset.x += shift.x;
|
||||||
|
this.#pendingLayerOffset.y += shift.y;
|
||||||
|
|
||||||
|
// Rebase active interactions if needed.
|
||||||
|
if (Math.abs(shift.x) > 0.0001 || Math.abs(shift.y) > 0.0001) {
|
||||||
|
const { dragManager } = this.#workspace;
|
||||||
|
if (dragManager?.rebaseActiveDragPointer) {
|
||||||
|
dragManager.rebaseActiveDragPointer(pointer);
|
||||||
|
}
|
||||||
|
this.#rebasePanGestureAfterZoom(pointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply zoom + pending pivot as a single CSS transform on the node layer — O(1).
|
||||||
|
// Combined with background offset for pan.
|
||||||
|
const { nodeLayer, connectionLayer, workspaceElement } = this.#workspace;
|
||||||
|
const ox = (this.#backgroundOffset.x + this.#pendingLayerOffset.x) * newZoom;
|
||||||
|
const oy = (this.#backgroundOffset.y + this.#pendingLayerOffset.y) * newZoom;
|
||||||
|
if (nodeLayer) {
|
||||||
|
nodeLayer.style.transformOrigin = "0 0";
|
||||||
|
nodeLayer.style.transform = `translate(${ox}px, ${oy}px) scale(${newZoom})`;
|
||||||
|
}
|
||||||
|
if (connectionLayer) {
|
||||||
|
connectionLayer.style.transformOrigin = "0 0";
|
||||||
|
connectionLayer.style.transform = `translate(${ox}px, ${oy}px) scale(${newZoom})`;
|
||||||
|
}
|
||||||
|
workspaceElement.style.setProperty("--workspace-zoom", `${newZoom}`);
|
||||||
|
this.#applyBackgroundOffset();
|
||||||
|
this.#renderConnections();
|
||||||
|
|
||||||
|
if (settled) {
|
||||||
|
this.#smoothZoomFocus = null;
|
||||||
|
// Commit accumulated pivot to node positions in one pass, then restore clean transforms.
|
||||||
|
const finalOffset = this.#pendingLayerOffset;
|
||||||
|
this.#pendingLayerOffset = { x: 0, y: 0 };
|
||||||
|
if (Math.abs(finalOffset.x) > 0.0001 || Math.abs(finalOffset.y) > 0.0001) {
|
||||||
|
this.translateWorkspace(finalOffset);
|
||||||
|
}
|
||||||
|
// Restore clean scale-only transform now that node positions are committed.
|
||||||
|
this.updateZoomDisplay(false);
|
||||||
|
} else {
|
||||||
|
this.#smoothZoomRafId = requestAnimationFrame(() => this.#tickSmoothZoom());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies zoom centred at a screen-space location.
|
* Applies zoom centred at a screen-space location.
|
||||||
*
|
*
|
||||||
@@ -149,7 +292,7 @@ export class WorkspaceNavigationManager {
|
|||||||
const previousZoom = this.#zoomLevel || 1;
|
const previousZoom = this.#zoomLevel || 1;
|
||||||
const worldPoint = this.screenPointToWorld(screenPoint);
|
const worldPoint = this.screenPointToWorld(screenPoint);
|
||||||
const nextZoom = previousZoom + direction * this.#zoomConfig.step;
|
const nextZoom = previousZoom + direction * this.#zoomConfig.step;
|
||||||
const changed = this.setZoomLevel(nextZoom);
|
const changed = this.setZoomLevel(nextZoom, { skipConnectionRender: true });
|
||||||
if (!changed) {
|
if (!changed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -172,8 +315,10 @@ export class WorkspaceNavigationManager {
|
|||||||
dragManager.rebaseActiveDragPointer(pointer);
|
dragManager.rebaseActiveDragPointer(pointer);
|
||||||
}
|
}
|
||||||
this.#rebasePanGestureAfterZoom(pointer);
|
this.#rebasePanGestureAfterZoom(pointer);
|
||||||
this.#renderConnections();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.updateZoomDisplay(true);
|
||||||
|
this.#renderConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -197,6 +342,18 @@ export class WorkspaceNavigationManager {
|
|||||||
return this.#backgroundOffset;
|
return this.#backgroundOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the total effective viewport offset, including any pending zoom pivot.
|
||||||
|
*
|
||||||
|
* @returns {{ x: number, y: number }}
|
||||||
|
*/
|
||||||
|
getEffectiveOffset() {
|
||||||
|
return {
|
||||||
|
x: this.#backgroundOffset.x + this.#pendingLayerOffset.x,
|
||||||
|
y: this.#backgroundOffset.y + this.#pendingLayerOffset.y,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies a workspace translation to all nodes and the background.
|
* Applies a workspace translation to all nodes and the background.
|
||||||
*
|
*
|
||||||
@@ -212,22 +369,7 @@ export class WorkspaceNavigationManager {
|
|||||||
y: this.#backgroundOffset.y + delta.y,
|
y: this.#backgroundOffset.y + delta.y,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { graph, dragManager } = this.#workspace;
|
const { dragManager } = this.#workspace;
|
||||||
const panState = this.#panState;
|
|
||||||
const panDelta = panState ? panState.lastDelta : null;
|
|
||||||
|
|
||||||
graph.nodes.forEach((node) => {
|
|
||||||
const origin = panState?.nodeOrigins.get(node.id) ?? node.position;
|
|
||||||
const baseDelta = panDelta ?? { x: 0, y: 0 };
|
|
||||||
const next = {
|
|
||||||
x: origin.x + baseDelta.x + delta.x,
|
|
||||||
y: origin.y + baseDelta.y + delta.y,
|
|
||||||
};
|
|
||||||
graph.setNodePosition(node.id, next);
|
|
||||||
if (dragManager?.updateNodeDomPosition) {
|
|
||||||
dragManager.updateNodeDomPosition(node.id, next);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (dragManager?.applyActiveDragShift) {
|
if (dragManager?.applyActiveDragShift) {
|
||||||
dragManager.applyActiveDragShift(delta);
|
dragManager.applyActiveDragShift(delta);
|
||||||
@@ -273,6 +415,7 @@ export class WorkspaceNavigationManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.translateWorkspace(delta);
|
this.translateWorkspace(delta);
|
||||||
|
this.updateZoomDisplay(false);
|
||||||
this.#workspace.selectNode(nodeId);
|
this.#workspace.selectNode(nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,30 +488,29 @@ export class WorkspaceNavigationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
targetZoom = Math.max(this.#zoomConfig.min, Math.min(this.#zoomConfig.max, targetZoom));
|
targetZoom = Math.max(this.#zoomConfig.min, Math.min(this.#zoomConfig.max, targetZoom));
|
||||||
this.setZoomLevel(targetZoom);
|
|
||||||
|
|
||||||
const contentCenter = {
|
const contentCenter = {
|
||||||
x: minX + boundsWidth / 2,
|
x: minX + boundsWidth / 2,
|
||||||
y: minY + boundsHeight / 2,
|
y: minY + boundsHeight / 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
const viewportCenter = this.screenPointToWorld({
|
// Directly compute the background offset that places contentCenter at screen center,
|
||||||
x: rect.width / 2,
|
// then set zoom + offset together so a single updateZoomDisplay call applies both.
|
||||||
y: rect.height / 2,
|
const newOffsetX = rect.width / 2 / targetZoom - contentCenter.x;
|
||||||
});
|
const newOffsetY = rect.height / 2 / targetZoom - contentCenter.y;
|
||||||
|
|
||||||
const delta = {
|
// Cancel any running smooth zoom before snapping.
|
||||||
x: viewportCenter.x - contentCenter.x,
|
if (this.#smoothZoomRafId !== null) {
|
||||||
y: viewportCenter.y - contentCenter.y,
|
cancelAnimationFrame(this.#smoothZoomRafId);
|
||||||
};
|
this.#smoothZoomRafId = null;
|
||||||
|
this.#smoothZoomFocus = null;
|
||||||
if (Math.abs(delta.x) > 0.0001 || Math.abs(delta.y) > 0.0001) {
|
this.#pendingLayerOffset = { x: 0, y: 0 };
|
||||||
this.translateWorkspace(delta);
|
|
||||||
this.#renderConnections();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#markViewDirty("view", 200);
|
this.#targetZoomLevel = targetZoom;
|
||||||
this.#schedulePersist();
|
this.#zoomLevel = targetZoom;
|
||||||
|
this.setBackgroundOffset({ x: newOffsetX, y: newOffsetY });
|
||||||
|
this.updateZoomDisplay(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -381,25 +523,18 @@ export class WorkspaceNavigationManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { dragManager, contextMenuManager, graph, nodeElements } =
|
const { dragManager, contextMenuManager } = this.#workspace;
|
||||||
this.#workspace;
|
|
||||||
|
|
||||||
dragManager?.removeNodeGhost();
|
dragManager?.removeNodeGhost();
|
||||||
dragManager?.removePaletteGhost();
|
dragManager?.removePaletteGhost();
|
||||||
|
|
||||||
const nodeOrigins = new Map();
|
|
||||||
graph.nodes.forEach((node) => {
|
|
||||||
nodeOrigins.set(node.id, { x: node.position.x, y: node.position.y });
|
|
||||||
});
|
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
pointerId: event.pointerId,
|
pointerId: event.pointerId,
|
||||||
startX: event.clientX,
|
startX: event.clientX,
|
||||||
startY: event.clientY,
|
startY: event.clientY,
|
||||||
lastDelta: { x: 0, y: 0 },
|
|
||||||
hasMoved: false,
|
hasMoved: false,
|
||||||
nodeOrigins,
|
|
||||||
backgroundOrigin: { ...this.#backgroundOffset },
|
backgroundOrigin: { ...this.#backgroundOffset },
|
||||||
|
lastDelta: { x: 0, y: 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePointerMove = (moveEvent) => {
|
const handlePointerMove = (moveEvent) => {
|
||||||
@@ -413,7 +548,6 @@ export class WorkspaceNavigationManager {
|
|||||||
x: deltaXScreen,
|
x: deltaXScreen,
|
||||||
y: deltaYScreen,
|
y: deltaYScreen,
|
||||||
});
|
});
|
||||||
this.#panState.lastDelta = worldDelta;
|
|
||||||
|
|
||||||
if (!this.#panState.hasMoved) {
|
if (!this.#panState.hasMoved) {
|
||||||
const distance = Math.hypot(deltaXScreen, deltaYScreen);
|
const distance = Math.hypot(deltaXScreen, deltaYScreen);
|
||||||
@@ -422,32 +556,21 @@ export class WorkspaceNavigationManager {
|
|||||||
}
|
}
|
||||||
moveEvent.preventDefault();
|
moveEvent.preventDefault();
|
||||||
this.#panState.hasMoved = true;
|
this.#panState.hasMoved = true;
|
||||||
contextMenuManager?.hide();
|
contextMenuManager?.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.#panState.hasMoved) {
|
if (!this.#panState.hasMoved) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.#panState.lastDelta = worldDelta;
|
||||||
|
|
||||||
const backgroundOffset = {
|
const backgroundOffset = {
|
||||||
x: this.#panState.backgroundOrigin.x + worldDelta.x,
|
x: this.#panState.backgroundOrigin.x + worldDelta.x,
|
||||||
y: this.#panState.backgroundOrigin.y + worldDelta.y,
|
y: this.#panState.backgroundOrigin.y + worldDelta.y,
|
||||||
};
|
};
|
||||||
this.setBackgroundOffset(backgroundOffset);
|
this.setBackgroundOffset(backgroundOffset);
|
||||||
|
this.updateZoomDisplay(true);
|
||||||
this.#panState.nodeOrigins.forEach((origin, nodeId) => {
|
|
||||||
const element = nodeElements.get(nodeId);
|
|
||||||
if (!element) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const next = {
|
|
||||||
x: origin.x + worldDelta.x,
|
|
||||||
y: origin.y + worldDelta.y,
|
|
||||||
};
|
|
||||||
element.style.transform = WorkspaceGeometry.positionToTransform(next);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.#renderConnections();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePointerUp = (upEvent) => {
|
const handlePointerUp = (upEvent) => {
|
||||||
@@ -467,17 +590,7 @@ export class WorkspaceNavigationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.#lastPanTimestamp = this.#timestamp();
|
this.#lastPanTimestamp = this.#timestamp();
|
||||||
const delta = finalState.lastDelta;
|
this.#renderConnections();
|
||||||
this.setBackgroundOffset({
|
|
||||||
x: finalState.backgroundOrigin.x + delta.x,
|
|
||||||
y: finalState.backgroundOrigin.y + delta.y,
|
|
||||||
});
|
|
||||||
finalState.nodeOrigins.forEach((origin, nodeId) => {
|
|
||||||
graph.setNodePosition(nodeId, {
|
|
||||||
x: origin.x + delta.x,
|
|
||||||
y: origin.y + delta.y,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.#panState = state;
|
this.#panState = state;
|
||||||
@@ -527,8 +640,8 @@ export class WorkspaceNavigationManager {
|
|||||||
*/
|
*/
|
||||||
#applyBackgroundOffset() {
|
#applyBackgroundOffset() {
|
||||||
const zoom = this.#zoomLevel || 1;
|
const zoom = this.#zoomLevel || 1;
|
||||||
const scaledX = this.#backgroundOffset.x * zoom;
|
const scaledX = (this.#backgroundOffset.x + this.#pendingLayerOffset.x) * zoom;
|
||||||
const scaledY = this.#backgroundOffset.y * zoom;
|
const scaledY = (this.#backgroundOffset.y + this.#pendingLayerOffset.y) * zoom;
|
||||||
const position = `${scaledX}px ${scaledY}px`;
|
const position = `${scaledX}px ${scaledY}px`;
|
||||||
this.#workspace.workspaceElement.style.backgroundPosition = `${position}, ${position}, ${position}, ${position}`;
|
this.#workspace.workspaceElement.style.backgroundPosition = `${position}, ${position}, ${position}, ${position}`;
|
||||||
}
|
}
|
||||||
@@ -551,13 +664,6 @@ export class WorkspaceNavigationManager {
|
|||||||
x: this.#panState.backgroundOrigin.x + shift.x,
|
x: this.#panState.backgroundOrigin.x + shift.x,
|
||||||
y: this.#panState.backgroundOrigin.y + shift.y,
|
y: this.#panState.backgroundOrigin.y + shift.y,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.#panState.nodeOrigins.forEach((origin, nodeId, map) => {
|
|
||||||
map.set(nodeId, {
|
|
||||||
x: origin.x + shift.x,
|
|
||||||
y: origin.y + shift.y,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,227 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('../BlueprintWorkspace.js').BlueprintWorkspace} BlueprintWorkspace
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles node-specific context menu interactions (right-click on nodes).
|
||||||
|
*/
|
||||||
|
export class WorkspaceNodeContextMenu {
|
||||||
|
#workspace;
|
||||||
|
/** @type {HTMLDivElement | null} */
|
||||||
|
#container;
|
||||||
|
/** @type {boolean} */
|
||||||
|
#isVisible;
|
||||||
|
/** @type {string | null} */
|
||||||
|
#targetNodeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {BlueprintWorkspace} workspace Owning workspace instance.
|
||||||
|
*/
|
||||||
|
constructor(workspace) {
|
||||||
|
this.#workspace = workspace;
|
||||||
|
this.#container = null;
|
||||||
|
this.#isVisible = false;
|
||||||
|
this.#targetNodeId = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the node context menu DOM if it does not already exist.
|
||||||
|
*/
|
||||||
|
initialize() {
|
||||||
|
if (this.#container) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const container = document.createElement("div");
|
||||||
|
container.className = "node-context-menu";
|
||||||
|
container.setAttribute("role", "menu");
|
||||||
|
container.setAttribute("aria-label", "Node actions");
|
||||||
|
|
||||||
|
const deleteItem = this.#createMenuItem("Delete", () => {
|
||||||
|
this.#handleDelete();
|
||||||
|
});
|
||||||
|
deleteItem.dataset.action = "delete";
|
||||||
|
container.appendChild(deleteItem);
|
||||||
|
|
||||||
|
const copyItem = this.#createMenuItem("Copy", () => {
|
||||||
|
this.#handleCopy();
|
||||||
|
});
|
||||||
|
copyItem.dataset.action = "copy";
|
||||||
|
container.appendChild(copyItem);
|
||||||
|
|
||||||
|
const refreshItem = this.#createMenuItem("Refresh", () => {
|
||||||
|
this.#handleRefresh();
|
||||||
|
});
|
||||||
|
refreshItem.dataset.action = "refresh";
|
||||||
|
container.appendChild(refreshItem);
|
||||||
|
|
||||||
|
this.#workspace.workspaceElement.appendChild(container);
|
||||||
|
|
||||||
|
document.addEventListener("pointerdown", (event) => {
|
||||||
|
if (!this.#isVisible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(event.target instanceof Node)) {
|
||||||
|
this.hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!container.contains(event.target)) {
|
||||||
|
this.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("keydown", (event) => {
|
||||||
|
if (!this.#isVisible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.key === "Escape") {
|
||||||
|
event.preventDefault();
|
||||||
|
this.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.#container = container;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a menu item button with the specified label and click handler.
|
||||||
|
*
|
||||||
|
* @param {string} label Menu item label.
|
||||||
|
* @param {() => void} onClick Click handler.
|
||||||
|
* @returns {HTMLButtonElement}
|
||||||
|
*/
|
||||||
|
#createMenuItem(label, onClick) {
|
||||||
|
const button = document.createElement("button");
|
||||||
|
button.type = "button";
|
||||||
|
button.className = "node-context-menu-item";
|
||||||
|
button.setAttribute("role", "menuitem");
|
||||||
|
button.textContent = label;
|
||||||
|
button.addEventListener("click", () => {
|
||||||
|
onClick();
|
||||||
|
this.hide();
|
||||||
|
});
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the context menu is currently displayed.
|
||||||
|
*
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
isVisible() {
|
||||||
|
return this.#isVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the provided target node resides inside the context menu.
|
||||||
|
*
|
||||||
|
* @param {Node | null} target Target node.
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
isTargetInside(target) {
|
||||||
|
return Boolean(
|
||||||
|
this.#container && target && this.#container.contains(target)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the node context menu at the given viewport coordinates.
|
||||||
|
*
|
||||||
|
* @param {number} clientX Viewport X coordinate.
|
||||||
|
* @param {number} clientY Viewport Y coordinate.
|
||||||
|
* @param {string} nodeId Target node identifier.
|
||||||
|
*/
|
||||||
|
show(clientX, clientY, nodeId) {
|
||||||
|
this.initialize();
|
||||||
|
|
||||||
|
if (!this.#container) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const workspaceRect =
|
||||||
|
this.#workspace.workspaceElement.getBoundingClientRect();
|
||||||
|
const relativeX = Math.max(0, clientX - workspaceRect.left);
|
||||||
|
const relativeY = Math.max(0, clientY - workspaceRect.top);
|
||||||
|
|
||||||
|
this.#targetNodeId = nodeId;
|
||||||
|
|
||||||
|
this.#container.classList.add("is-visible");
|
||||||
|
this.#container.style.left = `${relativeX}px`;
|
||||||
|
this.#container.style.top = `${relativeY}px`;
|
||||||
|
this.#isVisible = true;
|
||||||
|
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
if (!this.#container) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const menuRect = this.#container.getBoundingClientRect();
|
||||||
|
let adjustedLeft = relativeX;
|
||||||
|
let adjustedTop = relativeY;
|
||||||
|
|
||||||
|
if (menuRect.right > workspaceRect.right) {
|
||||||
|
adjustedLeft -= menuRect.right - workspaceRect.right;
|
||||||
|
}
|
||||||
|
if (menuRect.bottom > workspaceRect.bottom) {
|
||||||
|
adjustedTop -= menuRect.bottom - workspaceRect.bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
adjustedLeft = Math.max(0, adjustedLeft);
|
||||||
|
adjustedTop = Math.max(0, adjustedTop);
|
||||||
|
|
||||||
|
this.#container.style.left = `${adjustedLeft}px`;
|
||||||
|
this.#container.style.top = `${adjustedTop}px`;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Conceals the node context menu and clears its state.
|
||||||
|
*/
|
||||||
|
hide() {
|
||||||
|
if (!this.#container || !this.#isVisible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#container.classList.remove("is-visible");
|
||||||
|
this.#isVisible = false;
|
||||||
|
this.#targetNodeId = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the delete action for the target node.
|
||||||
|
*/
|
||||||
|
#handleDelete() {
|
||||||
|
if (!this.#targetNodeId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#workspace.removeNode(this.#targetNodeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the copy action for the target node.
|
||||||
|
*/
|
||||||
|
#handleCopy() {
|
||||||
|
if (!this.#targetNodeId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wasSelected = this.#workspace.selectedNodeIds.has(this.#targetNodeId);
|
||||||
|
if (!wasSelected) {
|
||||||
|
this.#workspace.selectNode(this.#targetNodeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#workspace.clipboardManager.copySelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the refresh action for the target node.
|
||||||
|
*/
|
||||||
|
#handleRefresh() {
|
||||||
|
if (!this.#targetNodeId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#workspace.refreshNode(this.#targetNodeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { WorkspaceGeometry } from "./WorkspaceGeometry.js";
|
import { WorkspaceGeometry } from "./WorkspaceGeometry.js";
|
||||||
|
import { getTypeColor } from "../../types/TypeRegistry.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {"input"|"output"} PinDirection
|
* @typedef {"input"|"output"} PinDirection
|
||||||
@@ -152,6 +153,36 @@ export class WorkspaceNodeRenderer {
|
|||||||
article.classList.remove("is-hovered");
|
article.classList.remove("is-hovered");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
article.addEventListener("pointerdown", (event) => {
|
||||||
|
if (event.button === 2) {
|
||||||
|
this.#workspace.navigationManager?.beginPan(event);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
article.addEventListener("contextmenu", (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
if (this.#workspace.navigationManager?.isPanRecent(300)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const target = /** @type {EventTarget | null} */ (event.target);
|
||||||
|
if (!(target instanceof HTMLElement)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target.closest(".pin")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.#workspace.selectedNodeIds.has(node.id)) {
|
||||||
|
this.#callbacks.selectNode(node.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#workspace.nodeContextMenu.show(event.clientX, event.clientY, node.id);
|
||||||
|
});
|
||||||
|
|
||||||
this.#workspace.nodeLayer.appendChild(article);
|
this.#workspace.nodeLayer.appendChild(article);
|
||||||
this.#workspace.nodeElements.set(node.id, article);
|
this.#workspace.nodeElements.set(node.id, article);
|
||||||
this.#inlineEditors.syncNode(node.id);
|
this.#inlineEditors.syncNode(node.id);
|
||||||
@@ -270,6 +301,7 @@ export class WorkspaceNodeRenderer {
|
|||||||
container.dataset.pinId = pin.id;
|
container.dataset.pinId = pin.id;
|
||||||
container.dataset.nodeId = node.id;
|
container.dataset.nodeId = node.id;
|
||||||
container.dataset.type = pin.kind;
|
container.dataset.type = pin.kind;
|
||||||
|
container.style.setProperty("--pin-kind-color", getTypeColor(pin.kind));
|
||||||
const isStandardExec =
|
const isStandardExec =
|
||||||
pin.kind === "exec" && (pin.id === "exec_in" || pin.id === "exec_out");
|
pin.kind === "exec" && (pin.id === "exec_in" || pin.id === "exec_out");
|
||||||
if (isStandardExec) {
|
if (isStandardExec) {
|
||||||
|
|||||||
@@ -54,28 +54,48 @@ export class WorkspacePersistenceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.cancelScheduledPersist();
|
this.cancelScheduledPersist();
|
||||||
|
this.#workspace.handlePersistenceStateChange?.({
|
||||||
|
status: "pending",
|
||||||
|
source: "auto",
|
||||||
|
});
|
||||||
this.#timerId = window.setTimeout(() => {
|
this.#timerId = window.setTimeout(() => {
|
||||||
this.#timerId = null;
|
this.#timerId = null;
|
||||||
this.persistImmediately();
|
this.persistImmediately("auto");
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializes current workspace state and writes it to localStorage immediately.
|
* Serializes current workspace state and writes it to localStorage immediately.
|
||||||
|
*
|
||||||
|
* @param {'manual'|'auto'} [source]
|
||||||
*/
|
*/
|
||||||
persistImmediately() {
|
persistImmediately(source = "manual") {
|
||||||
if (!this.#storageAvailable || typeof window === "undefined") {
|
if (!this.#storageAvailable || typeof window === "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.cancelScheduledPersist();
|
||||||
|
this.#workspace.handlePersistenceStateChange?.({
|
||||||
|
status: "saving",
|
||||||
|
source,
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const payload = this.serializeWorkspace();
|
const payload = this.serializeWorkspace();
|
||||||
window.localStorage.setItem(
|
window.localStorage.setItem(
|
||||||
WORKSPACE_STORAGE_KEY,
|
WORKSPACE_STORAGE_KEY,
|
||||||
JSON.stringify(payload)
|
JSON.stringify(payload)
|
||||||
);
|
);
|
||||||
|
this.#workspace.handlePersistenceStateChange?.({
|
||||||
|
status: "saved",
|
||||||
|
source,
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to persist workspace state", error);
|
console.error("Failed to persist workspace state", error);
|
||||||
|
this.#workspace.handlePersistenceStateChange?.({
|
||||||
|
status: "error",
|
||||||
|
source,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +110,7 @@ export class WorkspacePersistenceManager {
|
|||||||
.filter((entry) => Boolean(entry))
|
.filter((entry) => Boolean(entry))
|
||||||
.map((entry) => {
|
.map((entry) => {
|
||||||
const variable =
|
const variable =
|
||||||
/** @type {{ id: string, name: string, type: 'any'|'number'|'string'|'boolean'|'table', defaultValue: import('../BlueprintWorkspace.js').VariableDefaultValue }} */ (
|
/** @type {{ id: string, name: string, type: 'any'|'number'|'string'|'boolean'|'table'|'color', defaultValue: import('../BlueprintWorkspace.js').VariableDefaultValue }} */ (
|
||||||
entry
|
entry
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -0,0 +1,259 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {import('../BlueprintWorkspace.js').BlueprintWorkspace} BlueprintWorkspace
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {{ x: number, y: number }} Point
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {{
|
||||||
|
* pointerId: number,
|
||||||
|
* startClient: Point,
|
||||||
|
* currentClient: Point,
|
||||||
|
* cutLine: SVGLineElement,
|
||||||
|
* hasMoved: boolean,
|
||||||
|
* }} CutState
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drives the middle-mouse wire-cut gesture.
|
||||||
|
* Hold middle mouse and drag a line across wires to disconnect them.
|
||||||
|
*/
|
||||||
|
export class WorkspaceWireCutManager {
|
||||||
|
/** @type {BlueprintWorkspace} */
|
||||||
|
#workspace;
|
||||||
|
/** @type {CutState | null} */
|
||||||
|
#state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {BlueprintWorkspace} workspace Owning workspace instance.
|
||||||
|
*/
|
||||||
|
constructor(workspace) {
|
||||||
|
this.#workspace = workspace;
|
||||||
|
this.#state = null;
|
||||||
|
|
||||||
|
this.handleMove = this.handleMove.bind(this);
|
||||||
|
this.handleUp = this.handleUp.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a cut gesture from a middle-mouse pointerdown event.
|
||||||
|
*
|
||||||
|
* @param {PointerEvent} event Middle-mouse pointerdown event.
|
||||||
|
*/
|
||||||
|
beginCut(event) {
|
||||||
|
if (this.#state) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const cutLine = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
||||||
|
cutLine.classList.add("wire-cut-line");
|
||||||
|
|
||||||
|
const svgPos = this.#clientToSvg(event.clientX, event.clientY);
|
||||||
|
cutLine.setAttribute("x1", String(svgPos.x));
|
||||||
|
cutLine.setAttribute("y1", String(svgPos.y));
|
||||||
|
cutLine.setAttribute("x2", String(svgPos.x));
|
||||||
|
cutLine.setAttribute("y2", String(svgPos.y));
|
||||||
|
this.#workspace.connectionLayer.appendChild(cutLine);
|
||||||
|
|
||||||
|
this.#state = {
|
||||||
|
pointerId: event.pointerId,
|
||||||
|
startClient: { x: event.clientX, y: event.clientY },
|
||||||
|
currentClient: { x: event.clientX, y: event.clientY },
|
||||||
|
cutLine,
|
||||||
|
hasMoved: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("pointermove", this.handleMove);
|
||||||
|
window.addEventListener("pointerup", this.handleUp);
|
||||||
|
window.addEventListener("pointercancel", this.handleUp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether a cut gesture is currently active.
|
||||||
|
*
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
isCutting() {
|
||||||
|
return this.#state !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts viewport client coordinates to SVG-layer space.
|
||||||
|
*
|
||||||
|
* @param {number} clientX
|
||||||
|
* @param {number} clientY
|
||||||
|
* @returns {Point}
|
||||||
|
*/
|
||||||
|
#clientToSvg(clientX, clientY) {
|
||||||
|
const zoom = this.#workspace.zoomLevel || 1;
|
||||||
|
const offset = this.#workspace.navigationManager?.getEffectiveOffset() ??
|
||||||
|
this.#workspace.workspaceBackgroundOffset ?? { x: 0, y: 0 };
|
||||||
|
const rect = this.#workspace.workspaceElement.getBoundingClientRect();
|
||||||
|
return {
|
||||||
|
x: (clientX - rect.left) / zoom - offset.x,
|
||||||
|
y: (clientY - rect.top) / zoom - offset.y,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {PointerEvent} event
|
||||||
|
*/
|
||||||
|
handleMove(event) {
|
||||||
|
if (!this.#state || event.pointerId !== this.#state.pointerId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#state.currentClient = { x: event.clientX, y: event.clientY };
|
||||||
|
|
||||||
|
const dx = event.clientX - this.#state.startClient.x;
|
||||||
|
const dy = event.clientY - this.#state.startClient.y;
|
||||||
|
if (!this.#state.hasMoved && Math.hypot(dx, dy) >= 4) {
|
||||||
|
this.#state.hasMoved = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const start = this.#clientToSvg(this.#state.startClient.x, this.#state.startClient.y);
|
||||||
|
const end = this.#clientToSvg(event.clientX, event.clientY);
|
||||||
|
|
||||||
|
this.#state.cutLine.setAttribute("x1", String(start.x));
|
||||||
|
this.#state.cutLine.setAttribute("y1", String(start.y));
|
||||||
|
this.#state.cutLine.setAttribute("x2", String(end.x));
|
||||||
|
this.#state.cutLine.setAttribute("y2", String(end.y));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {PointerEvent} event
|
||||||
|
*/
|
||||||
|
handleUp(event) {
|
||||||
|
if (!this.#state || event.pointerId !== this.#state.pointerId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.removeEventListener("pointermove", this.handleMove);
|
||||||
|
window.removeEventListener("pointerup", this.handleUp);
|
||||||
|
window.removeEventListener("pointercancel", this.handleUp);
|
||||||
|
|
||||||
|
const state = this.#state;
|
||||||
|
this.#state = null;
|
||||||
|
state.cutLine.remove();
|
||||||
|
|
||||||
|
if (!state.hasMoved) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const p1 = this.#clientToSvg(state.startClient.x, state.startClient.y);
|
||||||
|
const p2 = this.#clientToSvg(state.currentClient.x, state.currentClient.y);
|
||||||
|
this.#cutIntersecting(p1, p2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all connections whose bezier curves intersect the given line segment.
|
||||||
|
*
|
||||||
|
* @param {Point} p1 Start of cut segment in SVG space.
|
||||||
|
* @param {Point} p2 End of cut segment in SVG space.
|
||||||
|
*/
|
||||||
|
#cutIntersecting(p1, p2) {
|
||||||
|
const { connectionElements, graph, historyManager } = this.#workspace;
|
||||||
|
/** @type {string[]} */
|
||||||
|
const toRemove = [];
|
||||||
|
|
||||||
|
connectionElements.forEach((pathEl, connectionId) => {
|
||||||
|
const d = pathEl.getAttribute("d");
|
||||||
|
if (!d) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.#bezierIntersectsSegment(d, p1, p2)) {
|
||||||
|
toRemove.push(connectionId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!toRemove.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Batch all removals into a single undo step.
|
||||||
|
historyManager?.withSuspended(() => {
|
||||||
|
toRemove.forEach((id) => graph.removeConnection(id));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the cubic bezier described by a path `d` attribute crosses the segment p1→p2.
|
||||||
|
*
|
||||||
|
* @param {string} d SVG path `d` attribute value.
|
||||||
|
* @param {Point} p1
|
||||||
|
* @param {Point} p2
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
#bezierIntersectsSegment(d, p1, p2) {
|
||||||
|
const m = d.match(
|
||||||
|
/M\s*([\d.\-e]+)\s+([\d.\-e]+)\s+C\s*([\d.\-e]+)\s+([\d.\-e]+)\s+([\d.\-e]+)\s+([\d.\-e]+)\s+([\d.\-e]+)\s+([\d.\-e]+)/i
|
||||||
|
);
|
||||||
|
if (!m) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bp0 = { x: parseFloat(m[1]), y: parseFloat(m[2]) };
|
||||||
|
const bc1 = { x: parseFloat(m[3]), y: parseFloat(m[4]) };
|
||||||
|
const bc2 = { x: parseFloat(m[5]), y: parseFloat(m[6]) };
|
||||||
|
const bp3 = { x: parseFloat(m[7]), y: parseFloat(m[8]) };
|
||||||
|
|
||||||
|
const SAMPLES = 32;
|
||||||
|
let prev = bp0;
|
||||||
|
for (let i = 1; i <= SAMPLES; i++) {
|
||||||
|
const t = i / SAMPLES;
|
||||||
|
const curr = this.#cubicBezierPoint(bp0, bc1, bc2, bp3, t);
|
||||||
|
if (this.#segmentsIntersect(prev, curr, p1, p2)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
prev = curr;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluates a cubic bezier at parameter t.
|
||||||
|
*
|
||||||
|
* @param {Point} p0
|
||||||
|
* @param {Point} c1
|
||||||
|
* @param {Point} c2
|
||||||
|
* @param {Point} p3
|
||||||
|
* @param {number} t
|
||||||
|
* @returns {Point}
|
||||||
|
*/
|
||||||
|
#cubicBezierPoint(p0, c1, c2, p3, t) {
|
||||||
|
const mt = 1 - t;
|
||||||
|
return {
|
||||||
|
x: mt * mt * mt * p0.x + 3 * mt * mt * t * c1.x + 3 * mt * t * t * c2.x + t * t * t * p3.x,
|
||||||
|
y: mt * mt * mt * p0.y + 3 * mt * mt * t * c1.y + 3 * mt * t * t * c2.y + t * t * t * p3.y,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if line segments a1→a2 and b1→b2 cross each other.
|
||||||
|
*
|
||||||
|
* @param {Point} a1
|
||||||
|
* @param {Point} a2
|
||||||
|
* @param {Point} b1
|
||||||
|
* @param {Point} b2
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
#segmentsIntersect(a1, a2, b1, b2) {
|
||||||
|
const dx1 = a2.x - a1.x;
|
||||||
|
const dy1 = a2.y - a1.y;
|
||||||
|
const dx2 = b2.x - b1.x;
|
||||||
|
const dy2 = b2.y - b1.y;
|
||||||
|
const denom = dx1 * dy2 - dy1 * dx2;
|
||||||
|
if (Math.abs(denom) < 1e-10) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const dx3 = b1.x - a1.x;
|
||||||
|
const dy3 = b1.y - a1.y;
|
||||||
|
const t = (dx3 * dy2 - dy3 * dx2) / denom;
|
||||||
|
const u = (dx3 * dy1 - dy3 * dx1) / denom;
|
||||||
|
return t >= 0 && t <= 1 && u >= 0 && u <= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { VARIABLE_SORT_MIME } from "../BlueprintWorkspaceConstants.js";
|
import { VARIABLE_SORT_MIME } from "../BlueprintWorkspaceConstants.js";
|
||||||
|
import { getTypeColor } from "../../types/TypeRegistry.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the global variable summary list.
|
* Renders the global variable summary list.
|
||||||
@@ -225,6 +226,7 @@ export function renderVariableList({
|
|||||||
row.setAttribute("role", "button");
|
row.setAttribute("role", "button");
|
||||||
row.dataset.variableId = variable.id;
|
row.dataset.variableId = variable.id;
|
||||||
row.dataset.variableType = variable.type;
|
row.dataset.variableType = variable.type;
|
||||||
|
row.style.setProperty("--overview-variable-color", getTypeColor(variable.type));
|
||||||
row.draggable = true;
|
row.draggable = true;
|
||||||
row.setAttribute("aria-pressed", "false");
|
row.setAttribute("aria-pressed", "false");
|
||||||
|
|
||||||
@@ -330,6 +332,7 @@ export function renderVariableList({
|
|||||||
typeButton.type = "button";
|
typeButton.type = "button";
|
||||||
typeButton.className = "variable-type-button";
|
typeButton.className = "variable-type-button";
|
||||||
typeButton.dataset.variableType = variable.type;
|
typeButton.dataset.variableType = variable.type;
|
||||||
|
typeButton.style.setProperty("--overview-variable-color", getTypeColor(variable.type));
|
||||||
typeButton.setAttribute("aria-haspopup", "menu");
|
typeButton.setAttribute("aria-haspopup", "menu");
|
||||||
typeButton.setAttribute("aria-expanded", "false");
|
typeButton.setAttribute("aria-expanded", "false");
|
||||||
typeButton.title = `Type: ${formatVariableType(variable.type)}`;
|
typeButton.title = `Type: ${formatVariableType(variable.type)}`;
|
||||||
|
|||||||
@@ -0,0 +1,176 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>PICO-8 Sprite Editor - Picograph</title>
|
||||||
|
<link rel="stylesheet" href="styles/main.css">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#editor-container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sprite-editor-header {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto 1fr auto;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 0.5rem 0.75rem;
|
||||||
|
background: var(--surface-2);
|
||||||
|
border-bottom: 1px solid var(--edge);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sprite-editor-title {
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sprite-editor-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sprite-editor-btn {
|
||||||
|
padding: 0.4rem 0.75rem;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="sprite-editor-header">
|
||||||
|
<div class="sprite-editor-title">🎨 Sprite Editor</div>
|
||||||
|
<div></div>
|
||||||
|
<div class="sprite-editor-actions">
|
||||||
|
<button class="sprite-editor-btn" id="export-btn">Export to .p8</button>
|
||||||
|
<button class="sprite-editor-btn" id="import-btn">Import from .p8</button>
|
||||||
|
<button class="sprite-editor-btn" id="save-json-btn">Save JSON</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="editor-container"></div>
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
import { SpriteEditor } from './scripts/ui/SpriteEditor.js';
|
||||||
|
import { SpriteSheet } from './scripts/core/SpriteSheet.js';
|
||||||
|
|
||||||
|
// Initialize the sprite editor
|
||||||
|
const container = document.getElementById('editor-container');
|
||||||
|
const spriteSheet = new SpriteSheet();
|
||||||
|
const editor = new SpriteEditor(container, spriteSheet);
|
||||||
|
|
||||||
|
// Export to .p8 format
|
||||||
|
document.getElementById('export-btn').addEventListener('click', () => {
|
||||||
|
const gfxData = editor.getSpriteSheet().toP8Gfx();
|
||||||
|
const flagData = editor.getSpriteSheet().toP8Flags();
|
||||||
|
|
||||||
|
const p8Content = `pico-8 cartridge // http://www.pico-8.com
|
||||||
|
version 41
|
||||||
|
__lua__
|
||||||
|
-- your code here
|
||||||
|
__gfx__
|
||||||
|
${gfxData}
|
||||||
|
__gff__
|
||||||
|
${flagData}
|
||||||
|
`;
|
||||||
|
|
||||||
|
// Download the .p8 file
|
||||||
|
const blob = new Blob([p8Content], { type: 'text/plain' });
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url;
|
||||||
|
a.download = 'sprites.p8';
|
||||||
|
a.click();
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Import from .p8 format
|
||||||
|
document.getElementById('import-btn').addEventListener('click', () => {
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'file';
|
||||||
|
input.accept = '.p8';
|
||||||
|
|
||||||
|
input.addEventListener('change', async (e) => {
|
||||||
|
const file = e.target.files[0];
|
||||||
|
if (!file) return;
|
||||||
|
|
||||||
|
const text = await file.text();
|
||||||
|
|
||||||
|
// Extract __gfx__ section
|
||||||
|
const gfxMatch = text.match(/__gfx__\s*\n([\s\S]*?)(?=\n__|$)/);
|
||||||
|
if (gfxMatch) {
|
||||||
|
editor.getSpriteSheet().fromP8Gfx(gfxMatch[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract __gff__ section
|
||||||
|
const gffMatch = text.match(/__gff__\s*\n([\s\S]*?)(?=\n__|$)/);
|
||||||
|
if (gffMatch) {
|
||||||
|
editor.getSpriteSheet().fromP8Flags(gffMatch[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-render
|
||||||
|
editor.setSpriteSheet(editor.getSpriteSheet());
|
||||||
|
});
|
||||||
|
|
||||||
|
input.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Save as JSON
|
||||||
|
document.getElementById('save-json-btn').addEventListener('click', () => {
|
||||||
|
const json = JSON.stringify(editor.getSpriteSheet().toJSON(), null, 2);
|
||||||
|
const blob = new Blob([json], { type: 'application/json' });
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url;
|
||||||
|
a.download = 'sprites.json';
|
||||||
|
a.click();
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Example: Draw a smiley face on sprite 0
|
||||||
|
function drawExampleSprite() {
|
||||||
|
const sheet = editor.getSpriteSheet();
|
||||||
|
|
||||||
|
// Draw a simple smiley face
|
||||||
|
// Face outline (yellow)
|
||||||
|
for (let x = 1; x < 7; x++) {
|
||||||
|
sheet.setPixel(x, 1, 10); // Top
|
||||||
|
sheet.setPixel(x, 6, 10); // Bottom
|
||||||
|
}
|
||||||
|
for (let y = 2; y < 6; y++) {
|
||||||
|
sheet.setPixel(1, y, 10); // Left
|
||||||
|
sheet.setPixel(6, y, 10); // Right
|
||||||
|
}
|
||||||
|
|
||||||
|
// Eyes (black)
|
||||||
|
sheet.setPixel(2, 3, 0);
|
||||||
|
sheet.setPixel(5, 3, 0);
|
||||||
|
|
||||||
|
// Smile (black)
|
||||||
|
sheet.setPixel(2, 5, 0);
|
||||||
|
sheet.setPixel(3, 5, 0);
|
||||||
|
sheet.setPixel(4, 5, 0);
|
||||||
|
sheet.setPixel(5, 5, 0);
|
||||||
|
|
||||||
|
editor.setSpriteSheet(sheet);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uncomment to draw example sprite on load
|
||||||
|
// drawExampleSprite();
|
||||||
|
|
||||||
|
console.log('Sprite Editor initialized!');
|
||||||
|
console.log('Available tools: Pen, Fill, Line, Rect, Circle, Erase');
|
||||||
|
console.log('Click sprites in the sheet to edit them in the preview panel');
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+880
-179
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,302 @@
|
|||||||
|
pico-8 cartridge // http://www.pico-8.com
|
||||||
|
version 8
|
||||||
|
__lua__
|
||||||
|
print("0.1.10c")
|
||||||
|
|
||||||
|
__gfx__
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
|
||||||
|
__gff__
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
__map__
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
__sfx__
|
||||||
|
000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
__music__
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
00 41424344
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
pico-8 cartridge // http://www.pico-8.com
|
||||||
|
version 41
|
||||||
|
__lua__
|
||||||
|
function _init()
|
||||||
|
x=64
|
||||||
|
y=64
|
||||||
|
end
|
||||||
|
|
||||||
|
function _update()
|
||||||
|
end
|
||||||
|
|
||||||
|
function _draw()
|
||||||
|
cls()
|
||||||
|
print("picograph ok",2,60,7)
|
||||||
|
end
|
||||||
|
__gfx__
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
pico-8 cartridge // http://www.pico-8.com
|
||||||
|
version 41
|
||||||
|
__lua__
|
||||||
|
function _init()
|
||||||
|
x=64
|
||||||
|
end
|
||||||
|
__gfx__
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
Reference in new issue
Block a user