geometryview 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,11 +18,13 @@ models: [atharvaaalok.github.io/geometryview](https://atharvaaalok.github.io/geo
18
18
 
19
19
  ## Use it from your AI app
20
20
 
21
- `geometryview --mcp` is a tool server (MCP) with four tools:
21
+ `geometryview --mcp` is a tool server (MCP) with five tools:
22
22
 
23
23
  - `open_model` opens a file and sums it up.
24
24
  - `get_structure` lists its assemblies and parts.
25
25
  - `render_view` returns a picture: any view, any of six styles, sections, parts alone.
26
+ - `view_folder` pictures a whole folder on one contact sheet, with a numbered index of sizes and
27
+ parts. It needs the native engine (a Mac with Apple silicon and macOS 26).
26
28
  - `open_in_viewer` shows it to you, live.
27
29
 
28
30
  ```sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geometryview",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "View STEP and STL models in your browser, and let AI apps open, inspect and picture them (MCP).",
5
5
  "keywords": [
6
6
  "step",
package/src/mcp.mjs CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { createInterface } from "node:readline";
6
6
 
7
- const SERVER = { name: "geometryview", version: "0.1.2" };
7
+ const SERVER = { name: "geometryview", version: "0.3.0" };
8
8
  const LATEST_PROTOCOL = "2025-06-18";
9
9
 
10
10
  /// Serves `tools` until standard input closes. Each tool is { name, description, inputSchema,
package/src/native.mjs CHANGED
@@ -2,11 +2,11 @@
2
2
  // read its assembly tree and statistics, and render it to a PNG. The universal WebAssembly engine
3
3
  // will take this module's place on other machines.
4
4
 
5
- import { execFile } from "node:child_process";
5
+ import { execFile, spawn } from "node:child_process";
6
6
  import { createHash } from "node:crypto";
7
7
  import { existsSync } from "node:fs";
8
- import { mkdir, open, readFile, rename, rm, stat } from "node:fs/promises";
9
- import { homedir, release, tmpdir } from "node:os";
8
+ import { mkdir, open, readdir, readFile, rename, rm, stat, utimes } from "node:fs/promises";
9
+ import { cpus, homedir, release, tmpdir } from "node:os";
10
10
  import { basename, dirname, join, resolve } from "node:path";
11
11
  import { fileURLToPath } from "node:url";
12
12
  import { promisify } from "node:util";
@@ -63,6 +63,66 @@ function binaries() {
63
63
 
64
64
  const cacheDirectory = join(homedir(), "Library/Caches/geometryview");
65
65
 
66
+ // Imports and renders at once: a third of the cores, at most four, so a folder's worth of files
67
+ // leaves the machine usable (ADR 0016).
68
+ const slots = Math.max(1, Math.min(4, Math.floor(cpus().length / 3)));
69
+ let busy = 0;
70
+ const queued = [];
71
+
72
+ /// Runs `work` once a slot is free.
73
+ export async function withSlot(work) {
74
+ if (busy >= slots) await new Promise((resolve) => queued.push(resolve));
75
+ busy += 1;
76
+ try {
77
+ return await work();
78
+ } finally {
79
+ busy -= 1;
80
+ queued.shift()?.();
81
+ }
82
+ }
83
+
84
+ // Imports under way, by cache file, so the same file asked for twice is imported once.
85
+ const importing = new Map();
86
+
87
+ // The cache's budget: GEOMETRYVIEW_CACHE_BYTES, else 4 GB. Past it, the files used longest ago go,
88
+ // down to 80% of it, in a sweep run 30 s after the last import; a cache file's time is its last use.
89
+ // Partial files left by an import that died go once they are an hour old.
90
+ const kCacheBudget = Number(process.env.GEOMETRYVIEW_CACHE_BYTES) || 4 * 1024 ** 3;
91
+ let sweepTimer = null;
92
+
93
+ function scheduleSweep() {
94
+ clearTimeout(sweepTimer);
95
+ sweepTimer = setTimeout(() => sweepCache().catch(() => {}), 30_000);
96
+ sweepTimer.unref?.();
97
+ }
98
+
99
+ /// Keeps the cache within `budget` bytes, sparing files used in the last minute. Returns the bytes
100
+ /// it holds after.
101
+ export async function sweepCache(directory = cacheDirectory, budget = kCacheBudget, now = Date.now()) {
102
+ const names = await readdir(directory).catch(() => []);
103
+ const files = [];
104
+ for (const name of names) {
105
+ const path = join(directory, name);
106
+ const info = await stat(path).catch(() => null);
107
+ if (!info?.isFile()) continue;
108
+ if (name.endsWith(".partial")) {
109
+ if (now - info.mtimeMs > 3600_000) await rm(path, { force: true });
110
+ continue;
111
+ }
112
+ if (name.endsWith(".geoblob")) files.push({ path, bytes: info.size, used: info.mtimeMs });
113
+ }
114
+ let total = files.reduce((sum, file) => sum + file.bytes, 0);
115
+ if (total <= budget) return total;
116
+ files.sort((a, b) => a.used - b.used);
117
+ for (const file of files) {
118
+ if (total <= budget * 0.8) break;
119
+ if (now - file.used < 60_000) continue;
120
+ await rm(file.path, { force: true });
121
+ total -= file.bytes;
122
+ }
123
+ return total;
124
+ }
125
+
66
126
  /// Imports `path` unless an import of the same file, unchanged, is cached. Returns the cache file.
67
127
  // The cache file version gcli writes and reads, from Import/format/blob.h.
68
128
  export const kCacheVersion = 5;
@@ -96,23 +156,95 @@ export async function importModel(path) {
96
156
  .slice(0, 32);
97
157
  const blob = join(cacheDirectory, `${key}.geoblob`);
98
158
  if (existsSync(blob)) {
99
- // One in an older format is made again: gcli reads only its own.
100
- if (await isCurrent(blob)) return { blob, source, fromCache: true };
159
+ // One in an older format is made again: gcli reads only its own. Its time marks its use.
160
+ if (await isCurrent(blob)) {
161
+ const now = new Date();
162
+ await utimes(blob, now, now).catch(() => {});
163
+ return { blob, source, fromCache: true };
164
+ }
101
165
  await rm(blob, { force: true });
102
166
  }
103
- await mkdir(cacheDirectory, { recursive: true });
104
- const { gcli, worker } = binaries();
105
- const partial = `${blob}.${process.pid}.partial`;
106
- try {
107
- await run(gcli, ["import", source, partial, worker], { maxBuffer: 1 << 20 });
108
- } catch (error) {
109
- await rm(partial, { force: true });
110
- throw new Error(`Could not import ${basename(source)}: ${(error.stderr || error.message).trim()}`);
167
+ if (!importing.has(blob)) {
168
+ const work = withSlot(async () => {
169
+ await mkdir(cacheDirectory, { recursive: true });
170
+ const { gcli, worker } = binaries();
171
+ const partial = `${blob}.${process.pid}.partial`;
172
+ try {
173
+ await run(gcli, ["import", source, partial, worker], { maxBuffer: 1 << 20 });
174
+ } catch (error) {
175
+ await rm(partial, { force: true });
176
+ throw new Error(`Could not import ${basename(source)}: ${(error.stderr || error.message).trim()}`);
177
+ }
178
+ await rename(partial, blob);
179
+ scheduleSweep();
180
+ }).finally(() => importing.delete(blob));
181
+ importing.set(blob, work);
111
182
  }
112
- await rename(partial, blob);
183
+ await importing.get(blob);
113
184
  return { blob, source, fromCache: false };
114
185
  }
115
186
 
187
+ /// The STEP and STL files in `folder`, and with `recursive` in its folders too, hidden ones left
188
+ /// out: at most 20,000, 32 folders deep.
189
+ export async function listModels(folder, { recursive = false } = {}) {
190
+ const root = resolve(folder);
191
+ const info = await stat(root).catch(() => {
192
+ throw new Error(`There is no folder at ${root}.`);
193
+ });
194
+ if (!info.isDirectory()) throw new Error(`${root} is not a folder.`);
195
+ const found = [];
196
+ const walk = async (directory, depth) => {
197
+ const entries = await readdir(directory, { withFileTypes: true }).catch(() => []);
198
+ for (const entry of entries) {
199
+ if (found.length >= 20000 || entry.name.startsWith(".")) continue;
200
+ const path = join(directory, entry.name);
201
+ if (entry.isDirectory()) {
202
+ if (recursive && depth < 32) await walk(path, depth + 1);
203
+ } else if (entry.isFile() && /\.(step|stp|stl)$/i.test(entry.name)) {
204
+ found.push(path);
205
+ }
206
+ }
207
+ };
208
+ await walk(root, 0);
209
+ return found;
210
+ }
211
+
212
+ /// A cache file's facts: its box in millimetres, parts, bodies, faces, triangles and the name
213
+ /// inside it (scene::Facts).
214
+ export async function readFacts(blob) {
215
+ const { gcli } = binaries();
216
+ const { stdout } = await run(gcli, ["facts", blob], { maxBuffer: 1 << 20 });
217
+ return JSON.parse(stdout);
218
+ }
219
+
220
+ /// Draws cache files on one contact sheet, as the gallery draws them: `tiles` are { blob, label,
221
+ /// sub }. Returns the PNG's bytes and, for each tile, its cell and any error.
222
+ export async function contactSheet(tiles, { cell = 192, columns, style = "illustration", colour = "parts",
223
+ sameScale = false, title } = {}) {
224
+ const { gcli, shaders } = binaries();
225
+ const png = join(tmpdir(), `geometry-view-sheet-${process.pid}-${Date.now()}.png`);
226
+ const args = ["sheet", shaders, png, "--cell", String(cell), "--style", String(style),
227
+ "--colour", String(colour)];
228
+ if (columns) args.push("--columns", String(columns));
229
+ if (sameScale) args.push("--same-scale");
230
+ if (title) args.push("--title", title);
231
+ try {
232
+ const stdout = await withSlot(() => new Promise((resolve, reject) => {
233
+ const child = spawn(gcli, args, { stdio: ["pipe", "pipe", "pipe"] });
234
+ let out = "", err = "";
235
+ child.stdout.on("data", (chunk) => { out += chunk; });
236
+ child.stderr.on("data", (chunk) => { err += chunk; });
237
+ child.on("error", reject);
238
+ child.on("close", (code) => (code === 0 ? resolve(out) : reject(new Error(err.trim() || `gcli sheet failed (${code})`))));
239
+ child.stdin.end(tiles.map((tile) => JSON.stringify(tile)).join("\n") + "\n");
240
+ }));
241
+ const placed = stdout.split("\n").filter(Boolean).map((line) => JSON.parse(line));
242
+ return { png: await readFile(png), tiles: placed };
243
+ } finally {
244
+ await rm(png, { force: true });
245
+ }
246
+ }
247
+
116
248
  /// The assembly tree: one node per entry, depth-first, with parent, kind, name and body range.
117
249
  export async function readTree(blob) {
118
250
  const { gcli } = binaries();
@@ -142,7 +274,7 @@ export async function render(blob, view) {
142
274
  (view.isolate ?? []).join(","),
143
275
  ];
144
276
  try {
145
- await run(gcli, args, { maxBuffer: 1 << 20 });
277
+ await withSlot(() => run(gcli, args, { maxBuffer: 1 << 20 }));
146
278
  return await readFile(png);
147
279
  } catch (error) {
148
280
  throw new Error((error.stderr || error.message).trim());
package/src/tools.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  // The tools an AI app can call: open a model, read its parts, picture it, and show it to the user.
2
2
 
3
- import { basename } from "node:path";
4
- import { importModel, nativeAvailable, openInViewer, readStats, readTree, render,
5
- viewerApplication } from "./native.mjs";
3
+ import { basename, relative, resolve } from "node:path";
4
+ import { contactSheet, importModel, listModels, nativeAvailable, openInViewer, readFacts, readStats,
5
+ readTree, render, viewerApplication } from "./native.mjs";
6
6
  import { linkToPage, openInPage, pageRender, pageTree, showInPage, viewerServer } from "./page.mjs";
7
7
 
8
8
  export const instructions =
@@ -14,8 +14,10 @@ export const instructions =
14
14
  "studio). To study a part, pass names from get_structure as isolate, and use section to cut " +
15
15
  "through the model. open_in_viewer shows the model to the user, live: in the GeometryView app, " +
16
16
  "in their browser, or, when they want to see it inside this chat app, as a link to open in " +
17
- "the app's own browser (where: link). Where this computer has no native engine, the viewer " +
18
- "opens in the user's browser and the pictures come from it, so the user sees what you look at.";
17
+ "the app's own browser (where: link). view_folder pictures a whole folder of models on one " +
18
+ "contact sheet with a numbered index, to survey a library or find a part by eye. Where this " +
19
+ "computer has no native engine, the viewer opens in the user's browser and the pictures come " +
20
+ "from it, so the user sees what you look at.";
19
21
 
20
22
  const STYLES = ["illustration", "metal", "clay", "blueprint", "technical", "studio"];
21
23
  const COLOURS = ["material", "parts", "mono", "file"];
@@ -27,6 +29,35 @@ const VIEWS = {
27
29
 
28
30
  const path = { type: "string", description: "Absolute path to a .step, .stp or .stl file." };
29
31
 
32
+ // How long view_folder waits for imports before drawing what it has; the rest keep importing, so
33
+ // asking again shows them.
34
+ const kFolderDeadline = 90_000;
35
+
36
+ const naturalOrder = new Intl.Collator("en", { numeric: true, sensitivity: "base" }).compare;
37
+
38
+ /// A box's sides in millimetres, as the gallery writes them: 40 × 30 × 26.
39
+ function sides(facts) {
40
+ if (!Array.isArray(facts?.min) || !Array.isArray(facts?.max)) return "";
41
+ return facts.max.map((high, axis) => {
42
+ const value = high - facts.min[axis];
43
+ return value >= 100 ? String(Math.round(value)) : String(Number(value.toPrecision(3)));
44
+ }).join(" × ");
45
+ }
46
+
47
+ function largestSide(facts) {
48
+ if (!Array.isArray(facts?.min) || !Array.isArray(facts?.max)) return Infinity;
49
+ return Math.max(...facts.max.map((high, axis) => high - facts.min[axis]));
50
+ }
51
+
52
+ /// Waits for `work`, or rejects with `kLate` once `deadline` passes; the work carries on.
53
+ const kLate = Symbol("late");
54
+ function byDeadline(work, deadline) {
55
+ work.catch(() => {});
56
+ return Promise.race([work, new Promise((_, reject) => {
57
+ setTimeout(() => reject(kLate), Math.max(0, deadline - Date.now())).unref?.();
58
+ })]);
59
+ }
60
+
30
61
  // ---- The tree as an outline ---------------------------------------------------------------------
31
62
 
32
63
  function annotate(nodes) {
@@ -215,6 +246,105 @@ export const tools = [
215
246
  ];
216
247
  },
217
248
  },
249
+ {
250
+ name: "view_folder",
251
+ description: "Pictures a folder of 3D CAD models (STEP and STL files) on one contact sheet, " +
252
+ "each part drawn over its name and number, for you to look at, with a numbered " +
253
+ "index of the files: their paths, sizes in millimetres, parts and triangles. Use it " +
254
+ "to survey a library, find a part by eye, or compare sizes (same_scale). Files are " +
255
+ "taken in name order, max_files of them; those still importing after 90 seconds " +
256
+ "are listed, and asking again shows them.",
257
+ inputSchema: {
258
+ type: "object",
259
+ properties: {
260
+ path: { type: "string", description: "Absolute path to a folder." },
261
+ recursive: { type: "boolean", default: false, description: "Include the folders inside." },
262
+ max_files: { type: "integer", minimum: 1, maximum: 144, default: 36 },
263
+ filter: { type: "string", description: "Only files whose path inside the folder contains this." },
264
+ sort: { type: "string", enum: ["name", "size"], default: "name",
265
+ description: "Order on the sheet: by path, or smallest to largest measured size." },
266
+ style: { type: "string", enum: STYLES, default: "illustration" },
267
+ colour: { type: "string", enum: COLOURS, default: "parts" },
268
+ same_scale: { type: "boolean", default: false,
269
+ description: "Draw every part at one scale, so sizes compare." },
270
+ cell: { type: "integer", minimum: 96, maximum: 384, default: 192,
271
+ description: "Each picture's size in points." },
272
+ columns: { type: "integer", minimum: 1, maximum: 12 },
273
+ },
274
+ required: ["path"],
275
+ },
276
+ async call(args) {
277
+ if (!nativeAvailable()) {
278
+ throw new Error("view_folder needs GeometryView's native engine, on a Mac with Apple silicon " +
279
+ "and macOS 26 or later. Use render_view to picture files one by one.");
280
+ }
281
+ const folder = resolve(args.path);
282
+ const max = Math.min(144, Math.max(1, args.max_files ?? 36));
283
+ const filter = (args.filter ?? "").toLowerCase();
284
+ const found = (await listModels(folder, { recursive: args.recursive ?? false }))
285
+ .map((file) => ({ file, path: relative(folder, file) }))
286
+ .filter(({ path: inside }) => !filter || inside.toLowerCase().includes(filter))
287
+ .sort((a, b) => naturalOrder(a.path, b.path));
288
+ const where = `${folder}${args.recursive ? " and its folders" : ""}`;
289
+ if (found.length === 0) {
290
+ return [{ type: "text", text: `No STEP or STL files${filter ? ` matching "${args.filter}"` : ""} in ${where}.` }];
291
+ }
292
+ const chosen = found.slice(0, max);
293
+ // Imported a few at a time, by the deadline.
294
+ const deadline = Date.now() + kFolderDeadline;
295
+ const done = await Promise.all(chosen.map(async (entry) => {
296
+ try {
297
+ const read = (async () => {
298
+ const { blob } = await importModel(entry.file);
299
+ return { blob, facts: await readFacts(blob) };
300
+ })();
301
+ return { ...entry, ...(await byDeadline(read, deadline)) };
302
+ } catch (error) {
303
+ return error === kLate ? { ...entry, late: true } : { ...entry, error: String(error.message ?? error) };
304
+ }
305
+ }));
306
+ const drawn = done.filter((entry) => entry.blob);
307
+ if (args.sort === "size") drawn.sort((a, b) => largestSide(a.facts) - largestSide(b.facts));
308
+ const lines = [];
309
+ let png = null;
310
+ if (drawn.length > 0) {
311
+ const tiles = drawn.map((entry, index) => ({
312
+ blob: entry.blob,
313
+ label: basename(entry.path).replace(/\.(step|stp|stl)$/i, ""),
314
+ sub: [`#${index + 1}`, sides(entry.facts)].filter(Boolean).join(" · "),
315
+ }));
316
+ const sheet = await contactSheet(tiles, {
317
+ cell: args.cell ?? 192, columns: args.columns, style: args.style ?? "illustration",
318
+ colour: args.colour ?? "parts", sameScale: args.same_scale ?? false, title: basename(folder),
319
+ });
320
+ png = sheet.png;
321
+ drawn.forEach((entry, index) => {
322
+ const f = entry.facts ?? {};
323
+ const failed = sheet.tiles[index]?.error;
324
+ const parts = f.parts ? `${f.parts} part${f.parts === 1 ? "" : "s"}` : null;
325
+ const size = sides(f) ? `${sides(f)} mm` : null;
326
+ const triangles = f.triangles ? `${f.triangles.toLocaleString("en-US")} triangles` : null;
327
+ const name = f.name && f.name !== basename(entry.path).replace(/\.[^.]+$/, "") ? `"${f.name}"` : null;
328
+ lines.push(`${index + 1}. ${entry.path}: ${[size, parts, triangles, name, failed && `not drawn: ${failed}`]
329
+ .filter(Boolean).join(", ")}`);
330
+ });
331
+ }
332
+ const late = done.filter((entry) => entry.late).map((entry) => entry.path);
333
+ const failed = done.filter((entry) => entry.error);
334
+ const header = `${drawn.length} of ${found.length} STEP and STL files in ${where}` +
335
+ (filter ? ` matching "${args.filter}"` : "") +
336
+ `, ${args.style ?? "illustration"} style, ${args.sort === "size" ? "smallest to largest" : "by name"}` +
337
+ (args.same_scale ? ", at one scale" : "") + ". Numbered in reading order, as on the sheet.";
338
+ const text = [header, "", ...lines];
339
+ if (found.length > chosen.length) text.push("", `${found.length - chosen.length} more not shown: raise max_files (up to 144) or use filter.`);
340
+ if (late.length) text.push("", `Still importing, not drawn yet (ask again to see them): ${late.join(", ")}.`);
341
+ if (failed.length) text.push("", "Could not be read:", ...failed.map((entry) => `- ${entry.path}: ${entry.error}`));
342
+ const content = [];
343
+ if (png) content.push({ type: "image", data: png.toString("base64"), mimeType: "image/png" });
344
+ content.push({ type: "text", text: text.join("\n") });
345
+ return content;
346
+ },
347
+ },
218
348
  {
219
349
  name: "open_in_viewer",
220
350
  description: "Shows a STEP or STL model to the user, live, where they can turn it, select " +
@@ -0,0 +1,2 @@
1
+ async function createThumbs(moduleArg={}){var Module=moduleArg;var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){if(Module["locateFile"])return Module["locateFile"](path,scriptDirectory);return scriptDirectory+path}var readAsync,readBinary;if(false,true){try{scriptDirectory=new URL(".",_scriptName).href}catch{}if(true)readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)};readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok)return response.arrayBuffer();throw new Error(response.status+" : "+response.url)}}var out=console.log.bind(console);var err=console.error.bind(console);var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition)abort(text)}function getMemoryBuffer(){return wasmMemory.buffer}function updateMemoryViews(){if(HEAP8?.buffer?.resizable)return;var b=getMemoryBuffer();HEAP8=new Int8Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b)}function preRun(){var preRun=Module["preRun"];if(preRun){if(typeof preRun==="function")preRun=[preRun];onPreRuns.push(...preRun)}callRuntimeCallbacks(onPreRuns)}function initRuntime(){0;wasmExports["ja"]()}function postRun(){var postRun=Module["postRun"];if(postRun){if(typeof postRun==="function")postRun=[postRun];onPostRuns.push(...postRun)}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what=`Aborted(${what})`;err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";throw new WebAssembly.RuntimeError(what)}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"])return locateFile("geometryview-thumbs-web.wasm");return new URL("geometryview-thumbs-web.wasm",import.meta.url).href}function getBinarySync(file){if(readBinary)return readBinary(file);throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(true)try{return await readAsync(binaryFile)}catch{}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary)try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var HEAP8;var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0)callbacks.shift()(Module)};var onPostRuns=[];var onPreRuns=[];var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func)wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr);return func};var runtimeKeepaliveCounter=0;var handleException=e=>{if(e instanceof ExitStatus||e=="unwind")return EXITSTATUS;quit_(0,e)};var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(0,new ExitStatus(code))};var maybeExit=()=>{if(!keepRuntimeAlive())try{_exit(EXITSTATUS)}catch(e){handleException(e)}};var callUserCallback=(func,...args)=>{if(ABORT)return;try{return func(...args)}catch(e){handleException(e)}finally{maybeExit()}};var timers={};var _emscripten_get_now=()=>performance.now();var HEAP32;var HEAPU32;var HEAPU8;var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{outIdx>>>=0;if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++>>>0]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++>>>0]=192|u>>6;heap[outIdx++>>>0]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++>>>0]=224|u>>12;heap[outIdx++>>>0]=128|u>>6&63;heap[outIdx++>>>0]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++>>>0]=240|u>>18;heap[outIdx++>>>0]=128|u>>12&63;heap[outIdx++>>>0]=128|u>>6&63;heap[outIdx++>>>0]=128|u&63;i++}}heap[outIdx>>>0]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var getHeapMax=()=>4294901760;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var HEAPF32;var HEAPF64;var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{idx>>>=0;var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder)return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr));var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224)u0=(u0&15)<<12|u1<<6|u2;else u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63;if(u0<65536)str+=String.fromCharCode(u0);else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>{ptr>>>=0;return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):""};var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127)len++;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else{len+=4;i++}}return len};var readI53FromI64=ptr=>HEAPU32[ptr>>>2>>>0]+HEAP32[ptr+4>>>2>>>0]*4294967296;var stringToNewUTF8=str=>{var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8(str,ret,size);return ret};var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var writeI53ToI64=(ptr,num)=>{HEAPU32[ptr>>>2>>>0]=num;var lower=HEAPU32[ptr>>>2>>>0];HEAPU32[ptr+4>>>2>>>0]=(num-lower)/4294967296};var WebGPU={Internals:{jsObjects:[],jsObjectInsert:(ptr,jsObject)=>{ptr>>>=0;WebGPU.Internals.jsObjects[ptr]=jsObject},bufferOnUnmaps:[],futures:[],futureInsert:()=>{}},getJsObject:ptr=>{if(!ptr)return;ptr>>>=0;return WebGPU.Internals.jsObjects[ptr]},importJsAdapter:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateAdapter(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsBindGroup:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateBindGroup(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsBindGroupLayout:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateBindGroupLayout(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsBuffer:(buffer,parentPtr=0)=>{assert(buffer.mapState==="unmapped");var bufferPtr=_emwgpuImportBuffer(parentPtr);WebGPU.Internals.jsObjectInsert(bufferPtr,buffer);return bufferPtr},importJsCommandBuffer:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateCommandBuffer(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsCommandEncoder:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateCommandEncoder(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsComputePassEncoder:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateComputePassEncoder(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsComputePipeline:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateComputePipeline(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsDevice:(device,parentPtr=0)=>{var queuePtr=_emwgpuCreateQueue(parentPtr);var devicePtr=_emwgpuCreateDevice(parentPtr,queuePtr);WebGPU.Internals.jsObjectInsert(queuePtr,device.queue);WebGPU.Internals.jsObjectInsert(devicePtr,device);return devicePtr},importJsExternalTexture:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateExternalTexture(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsPipelineLayout:(obj,parentPtr=0)=>{var ptr=_emwgpuCreatePipelineLayout(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsQuerySet:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateQuerySet(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsQueue:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateQueue(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsRenderBundle:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateRenderBundle(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsRenderBundleEncoder:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateRenderBundleEncoder(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsRenderPassEncoder:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateRenderPassEncoder(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsRenderPipeline:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateRenderPipeline(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsSampler:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateSampler(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsShaderModule:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateShaderModule(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsSurface:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateSurface(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsTexture:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateTexture(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},importJsTextureView:(obj,parentPtr=0)=>{var ptr=_emwgpuCreateTextureView(parentPtr);WebGPU.Internals.jsObjects[ptr]=obj;return ptr},errorCallback:(callback,type,message,userdata)=>{var sp=stackSave();var messagePtr=stringToUTF8OnStack(message);getWasmTableEntry(callback)(type,messagePtr,userdata);stackRestore(sp)},iterateExtensions:(root,handlers)=>{for(var ptr=HEAPU32[root>>>2>>>0];ptr;ptr=HEAPU32[ptr>>>2>>>0]){var sType=HEAP32[ptr+4>>>2>>>0];handlers[sType](ptr)}},setStringView:(ptr,data,length)=>{HEAPU32[ptr>>>2>>>0]=data;HEAPU32[ptr+4>>>2>>>0]=length},makeStringFromStringView:stringViewPtr=>{var ptr=HEAPU32[stringViewPtr>>>2>>>0];var length=HEAPU32[stringViewPtr+4>>>2>>>0];return UTF8ToString(ptr,length)},makeStringFromOptionalStringView:stringViewPtr=>{var ptr=HEAPU32[stringViewPtr>>>2>>>0];var length=HEAPU32[stringViewPtr+4>>>2>>>0];if(!ptr){if(length===0)return"";return}return UTF8ToString(ptr,length)},makeColor:ptr=>({r:HEAPF64[ptr>>>3>>>0],g:HEAPF64[ptr+8>>>3>>>0],b:HEAPF64[ptr+16>>>3>>>0],a:HEAPF64[ptr+24>>>3>>>0]}),makeExtent3D:ptr=>({width:HEAPU32[ptr>>>2>>>0],height:HEAPU32[ptr+4>>>2>>>0],depthOrArrayLayers:HEAPU32[ptr+8>>>2>>>0]}),makeOrigin3D:ptr=>({x:HEAPU32[ptr>>>2>>>0],y:HEAPU32[ptr+4>>>2>>>0],z:HEAPU32[ptr+8>>>2>>>0]}),makeTexelCopyTextureInfo:ptr=>({texture:WebGPU.getJsObject(HEAPU32[ptr>>>2>>>0]),mipLevel:HEAPU32[ptr+4>>>2>>>0],origin:WebGPU.makeOrigin3D(ptr+8),aspect:WebGPU.TextureAspect[HEAP32[ptr+20>>>2>>>0]]}),makeTexelCopyBufferLayout:ptr=>{var bytesPerRow=HEAPU32[ptr+8>>>2>>>0];var rowsPerImage=HEAPU32[ptr+12>>>2>>>0];return{offset:readI53FromI64(ptr),bytesPerRow:bytesPerRow===4294967295?void 0:bytesPerRow,rowsPerImage:rowsPerImage===4294967295?void 0:rowsPerImage}},makeTexelCopyBufferInfo:ptr=>{var layoutPtr=ptr+0;var bufferCopyView=WebGPU.makeTexelCopyBufferLayout(layoutPtr);bufferCopyView["buffer"]=WebGPU.getJsObject(HEAPU32[ptr+16>>>2>>>0]);return bufferCopyView},makePassTimestampWrites:ptr=>{if(ptr===0)return;return{querySet:WebGPU.getJsObject(HEAPU32[ptr+4>>>2>>>0]),beginningOfPassWriteIndex:HEAPU32[ptr+8>>>2>>>0],endOfPassWriteIndex:HEAPU32[ptr+12>>>2>>>0]}},makePipelineConstants:(constantCount,constantsPtr)=>{if(!constantCount)return;var constants={};for(var i=0;i<constantCount;++i){var entryPtr=constantsPtr+24*i;var key=WebGPU.makeStringFromStringView(entryPtr+4);constants[key]=HEAPF64[entryPtr+16>>>3>>>0]}return constants},makePipelineLayout:layoutPtr=>{if(!layoutPtr)return"auto";return WebGPU.getJsObject(layoutPtr)},makeComputeState:ptr=>{if(!ptr)return;var desc={module:WebGPU.getJsObject(HEAPU32[ptr+4>>>2>>>0]),constants:WebGPU.makePipelineConstants(HEAPU32[ptr+16>>>2>>>0],HEAPU32[ptr+20>>>2>>>0]),entryPoint:WebGPU.makeStringFromOptionalStringView(ptr+8)};return desc},makeComputePipelineDesc:descriptor=>{var desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4),layout:WebGPU.makePipelineLayout(HEAPU32[descriptor+12>>>2>>>0]),compute:WebGPU.makeComputeState(descriptor+16)};return desc},makeRenderPipelineDesc:descriptor=>{function makeBlendComponent(bdPtr){if(!bdPtr)return;return{operation:WebGPU.BlendOperation[HEAP32[bdPtr>>>2>>>0]],srcFactor:WebGPU.BlendFactor[HEAP32[bdPtr+4>>>2>>>0]],dstFactor:WebGPU.BlendFactor[HEAP32[bdPtr+8>>>2>>>0]]}}function makeBlendState(bsPtr){if(!bsPtr)return;return{alpha:makeBlendComponent(bsPtr+12),color:makeBlendComponent(bsPtr+0)}}function makeColorState(csPtr){var format=WebGPU.TextureFormat[HEAP32[csPtr+4>>>2>>>0]];return format?{format,blend:makeBlendState(HEAPU32[csPtr+8>>>2>>>0]),writeMask:HEAPU32[csPtr+16>>>2>>>0]}:void 0}function makeColorStates(count,csArrayPtr){var states=[];for(var i=0;i<count;++i)states.push(makeColorState(csArrayPtr+24*i));return states}function makeStencilStateFace(ssfPtr){return{compare:WebGPU.CompareFunction[HEAP32[ssfPtr>>>2>>>0]],failOp:WebGPU.StencilOperation[HEAP32[ssfPtr+4>>>2>>>0]],depthFailOp:WebGPU.StencilOperation[HEAP32[ssfPtr+8>>>2>>>0]],passOp:WebGPU.StencilOperation[HEAP32[ssfPtr+12>>>2>>>0]]}}function makeVertexAttribute(vaPtr){return{format:WebGPU.VertexFormat[HEAP32[vaPtr+4>>>2>>>0]],offset:readI53FromI64(vaPtr+8),shaderLocation:HEAPU32[vaPtr+16>>>2>>>0]}}function makeVertexAttributes(count,vaArrayPtr){var vas=[];for(var i=0;i<count;++i)vas.push(makeVertexAttribute(vaArrayPtr+i*24));return vas}function makeVertexBuffer(vbPtr){if(!vbPtr)return;var stepMode=WebGPU.VertexStepMode[HEAP32[vbPtr+4>>>2>>>0]];var attributeCount=HEAPU32[vbPtr+16>>>2>>>0];if(!stepMode&&!attributeCount)return null;return{arrayStride:readI53FromI64(vbPtr+8),stepMode,attributes:makeVertexAttributes(attributeCount,HEAPU32[vbPtr+20>>>2>>>0])}}function makeVertexBuffers(count,vbArrayPtr){if(!count)return;var vbs=[];for(var i=0;i<count;++i)vbs.push(makeVertexBuffer(vbArrayPtr+i*24));return vbs}var desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4),layout:WebGPU.makePipelineLayout(HEAPU32[descriptor+12>>>2>>>0]),vertex:function(viPtr){if(!viPtr)return;var desc={module:WebGPU.getJsObject(HEAPU32[viPtr+4>>>2>>>0]),constants:WebGPU.makePipelineConstants(HEAPU32[viPtr+16>>>2>>>0],HEAPU32[viPtr+20>>>2>>>0]),buffers:makeVertexBuffers(HEAPU32[viPtr+24>>>2>>>0],HEAPU32[viPtr+28>>>2>>>0]),entryPoint:WebGPU.makeStringFromOptionalStringView(viPtr+8)};return desc}(descriptor+16),primitive:function(psPtr){if(!psPtr)return;return{topology:WebGPU.PrimitiveTopology[HEAP32[psPtr+4>>>2>>>0]],stripIndexFormat:WebGPU.IndexFormat[HEAP32[psPtr+8>>>2>>>0]],frontFace:WebGPU.FrontFace[HEAP32[psPtr+12>>>2>>>0]],cullMode:WebGPU.CullMode[HEAP32[psPtr+16>>>2>>>0]],unclippedDepth:!!HEAPU32[psPtr+20>>>2>>>0]}}(descriptor+48),depthStencil:function(dssPtr){if(!dssPtr)return;return{format:WebGPU.TextureFormat[HEAP32[dssPtr+4>>>2>>>0]],depthWriteEnabled:!!HEAPU32[dssPtr+8>>>2>>>0],depthCompare:WebGPU.CompareFunction[HEAP32[dssPtr+12>>>2>>>0]],stencilFront:makeStencilStateFace(dssPtr+16),stencilBack:makeStencilStateFace(dssPtr+32),stencilReadMask:HEAPU32[dssPtr+48>>>2>>>0],stencilWriteMask:HEAPU32[dssPtr+52>>>2>>>0],depthBias:HEAP32[dssPtr+56>>>2>>>0],depthBiasSlopeScale:HEAPF32[dssPtr+60>>>2>>>0],depthBiasClamp:HEAPF32[dssPtr+64>>>2>>>0]}}(HEAPU32[descriptor+72>>>2>>>0]),multisample:function(msPtr){if(!msPtr)return;return{count:HEAPU32[msPtr+4>>>2>>>0],mask:HEAPU32[msPtr+8>>>2>>>0],alphaToCoverageEnabled:!!HEAPU32[msPtr+12>>>2>>>0]}}(descriptor+76),fragment:function(fsPtr){if(!fsPtr)return;var desc={module:WebGPU.getJsObject(HEAPU32[fsPtr+4>>>2>>>0]),constants:WebGPU.makePipelineConstants(HEAPU32[fsPtr+16>>>2>>>0],HEAPU32[fsPtr+20>>>2>>>0]),targets:makeColorStates(HEAPU32[fsPtr+24>>>2>>>0],HEAPU32[fsPtr+28>>>2>>>0]),entryPoint:WebGPU.makeStringFromOptionalStringView(fsPtr+8)};return desc}(HEAPU32[descriptor+92>>>2>>>0])};return desc},fillLimitStruct:(limits,limitsOutPtr)=>{var nextInChainPtr=HEAPU32[limitsOutPtr>>>2>>>0];function setLimitValueU32(name,basePtr,limitOffset,fallbackValue=0){var limitValue=limits[name]??fallbackValue;HEAPU32[basePtr+limitOffset>>>2>>>0]=limitValue}function setLimitValueU64(name,basePtr,limitOffset,fallbackValue=0){var limitValue=limits[name]??fallbackValue;writeI53ToI64(basePtr+limitOffset,limitValue)}setLimitValueU32("maxTextureDimension1D",limitsOutPtr,4);setLimitValueU32("maxTextureDimension2D",limitsOutPtr,8);setLimitValueU32("maxTextureDimension3D",limitsOutPtr,12);setLimitValueU32("maxTextureArrayLayers",limitsOutPtr,16);setLimitValueU32("maxBindGroups",limitsOutPtr,20);setLimitValueU32("maxBindGroupsPlusVertexBuffers",limitsOutPtr,24);setLimitValueU32("maxBindingsPerBindGroup",limitsOutPtr,28);setLimitValueU32("maxDynamicUniformBuffersPerPipelineLayout",limitsOutPtr,32);setLimitValueU32("maxDynamicStorageBuffersPerPipelineLayout",limitsOutPtr,36);setLimitValueU32("maxSampledTexturesPerShaderStage",limitsOutPtr,40);setLimitValueU32("maxSamplersPerShaderStage",limitsOutPtr,44);setLimitValueU32("maxStorageBuffersPerShaderStage",limitsOutPtr,48);setLimitValueU32("maxStorageTexturesPerShaderStage",limitsOutPtr,52);setLimitValueU32("maxUniformBuffersPerShaderStage",limitsOutPtr,56);setLimitValueU32("minUniformBufferOffsetAlignment",limitsOutPtr,80);setLimitValueU32("minStorageBufferOffsetAlignment",limitsOutPtr,84);setLimitValueU64("maxUniformBufferBindingSize",limitsOutPtr,64);setLimitValueU64("maxStorageBufferBindingSize",limitsOutPtr,72);setLimitValueU32("maxVertexBuffers",limitsOutPtr,88);setLimitValueU64("maxBufferSize",limitsOutPtr,96);setLimitValueU32("maxVertexAttributes",limitsOutPtr,104);setLimitValueU32("maxVertexBufferArrayStride",limitsOutPtr,108);setLimitValueU32("maxInterStageShaderVariables",limitsOutPtr,112);setLimitValueU32("maxColorAttachments",limitsOutPtr,116);setLimitValueU32("maxColorAttachmentBytesPerSample",limitsOutPtr,120);setLimitValueU32("maxComputeWorkgroupStorageSize",limitsOutPtr,124);setLimitValueU32("maxComputeInvocationsPerWorkgroup",limitsOutPtr,128);setLimitValueU32("maxComputeWorkgroupSizeX",limitsOutPtr,132);setLimitValueU32("maxComputeWorkgroupSizeY",limitsOutPtr,136);setLimitValueU32("maxComputeWorkgroupSizeZ",limitsOutPtr,140);setLimitValueU32("maxComputeWorkgroupsPerDimension",limitsOutPtr,144);setLimitValueU32("maxImmediateSize",limitsOutPtr,148);if(nextInChainPtr!==0){HEAP32[nextInChainPtr+4>>>2>>>0];var compatibilityModeLimitsPtr=nextInChainPtr;setLimitValueU32("maxStorageBuffersInVertexStage",compatibilityModeLimitsPtr,8,limits.maxStorageBuffersPerShaderStage);setLimitValueU32("maxStorageBuffersInFragmentStage",compatibilityModeLimitsPtr,16,limits.maxStorageBuffersPerShaderStage);setLimitValueU32("maxStorageTexturesInVertexStage",compatibilityModeLimitsPtr,12,limits.maxStorageTexturesPerShaderStage);setLimitValueU32("maxStorageTexturesInFragmentStage",compatibilityModeLimitsPtr,20,limits.maxStorageTexturesPerShaderStage)}},fillAdapterInfoStruct:(info,infoStruct)=>{HEAPU32[infoStruct+52>>>2>>>0]=info.subgroupMinSize;HEAPU32[infoStruct+56>>>2>>>0]=info.subgroupMaxSize;var strs=info.vendor+info.architecture+info.device+info.description;var strPtr=stringToNewUTF8(strs);var vendorLen=lengthBytesUTF8(info.vendor);WebGPU.setStringView(infoStruct+4,strPtr,vendorLen);strPtr+=vendorLen;var architectureLen=lengthBytesUTF8(info.architecture);WebGPU.setStringView(infoStruct+12,strPtr,architectureLen);strPtr+=architectureLen;var deviceLen=lengthBytesUTF8(info.device);WebGPU.setStringView(infoStruct+20,strPtr,deviceLen);strPtr+=deviceLen;var descriptionLen=lengthBytesUTF8(info.description);WebGPU.setStringView(infoStruct+28,strPtr,descriptionLen);strPtr+=descriptionLen;HEAP32[infoStruct+36>>>2>>>0]=2;var adapterType=info.isFallbackAdapter?3:4;HEAP32[infoStruct+40>>>2>>>0]=adapterType;HEAPU32[infoStruct+44>>>2>>>0]=0;HEAPU32[infoStruct+48>>>2>>>0]=0},AddressMode:[,"clamp-to-edge","repeat","mirror-repeat"],BlendFactor:[,"zero","one","src","one-minus-src","src-alpha","one-minus-src-alpha","dst","one-minus-dst","dst-alpha","one-minus-dst-alpha","src-alpha-saturated","constant","one-minus-constant","src1","one-minus-src1","src1-alpha","one-minus-src1-alpha"],BlendOperation:[,"add","subtract","reverse-subtract","min","max"],BufferBindingType:[,,"uniform","storage","read-only-storage"],BufferMapState:[,"unmapped","pending","mapped"],CompareFunction:[,"never","less","equal","less-equal","greater","not-equal","greater-equal","always"],CompilationInfoRequestStatus:[,"success","callback-cancelled"],ComponentSwizzle:[,"0","1","r","g","b","a"],CompositeAlphaMode:[,"opaque","premultiplied","unpremultiplied","inherit"],CullMode:[,"none","front","back"],ErrorFilter:[,"validation","out-of-memory","internal"],FeatureLevel:[,"compatibility","core"],FeatureName:{1:"core-features-and-limits",2:"depth-clip-control",3:"depth32float-stencil8",4:"texture-compression-bc",5:"texture-compression-bc-sliced-3d",6:"texture-compression-etc2",7:"texture-compression-astc",8:"texture-compression-astc-sliced-3d",9:"timestamp-query",10:"indirect-first-instance",11:"shader-f16",12:"rg11b10ufloat-renderable",13:"bgra8unorm-storage",14:"float32-filterable",15:"float32-blendable",16:"clip-distances",17:"dual-source-blending",18:"subgroups",19:"texture-formats-tier1",20:"texture-formats-tier2",21:"primitive-index",22:"texture-component-swizzle",327692:"chromium-experimental-unorm16-texture-formats",327729:"chromium-experimental-multi-draw-indirect"},FilterMode:[,"nearest","linear"],FrontFace:[,"ccw","cw"],IndexFormat:[,"uint16","uint32"],InstanceFeatureName:[,"timed-wait-any","shader-source-spirv","multiple-devices-per-adapter"],LoadOp:[,"load","clear"],MipmapFilterMode:[,"nearest","linear"],OptionalBool:["false","true"],PowerPreference:[,"low-power","high-performance"],PredefinedColorSpace:[,"srgb","display-p3"],PrimitiveTopology:[,"point-list","line-list","line-strip","triangle-list","triangle-strip"],QueryType:[,"occlusion","timestamp"],SamplerBindingType:[,,"filtering","non-filtering","comparison"],Status:[,"success","error"],StencilOperation:[,"keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"],StorageTextureAccess:[,,"write-only","read-only","read-write"],StoreOp:[,"store","discard"],SurfaceGetCurrentTextureStatus:[,"success-optimal","success-suboptimal","timeout","outdated","lost","error"],TextureAspect:[,"all","stencil-only","depth-only"],TextureDimension:[,"1d","2d","3d"],TextureFormat:[,"r8unorm","r8snorm","r8uint","r8sint","r16unorm","r16snorm","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32float","r32uint","r32sint","rg16unorm","rg16snorm","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb10a2uint","rgb10a2unorm","rg11b10ufloat","rgb9e5ufloat","rg32float","rg32uint","rg32sint","rgba16unorm","rgba16snorm","rgba16uint","rgba16sint","rgba16float","rgba32float","rgba32uint","rgba32sint","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb","etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm","astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"],TextureSampleType:[,,"float","unfilterable-float","depth","sint","uint"],TextureViewDimension:[,"1d","2d","2d-array","cube","cube-array","3d"],ToneMappingMode:[,"standard","extended"],VertexFormat:[,"uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra"],VertexStepMode:[,"vertex","instance"],WGSLLanguageFeatureName:[,"readonly_and_readwrite_storage_textures","packed_4x8_integer_dot_product","unrestricted_pointer_parameters","pointer_composite_access","uniform_buffer_standard_layout","subgroup_id","texture_and_sampler_let","subgroup_uniformity","texture_formats_tier1","linear_indexing"]};var bigintToI53Checked=num=>num<-9007199254740992||num>9007199254740992?NaN:Number(num);var emwgpuStringToInt_DeviceLostReason={undefined:1,unknown:1,destroyed:2};var ENV={};var getExecutableName=()=>thisProgram;var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV)if(ENV[x]===void 0)delete env[x];else env[x]=ENV[x];var strings=[];for(var x in env)strings.push(`${x}=${env[x]}`);getEnvStrings.strings=strings}return getEnvStrings.strings};var printCharBuffers=[null,[],[]];var printChar=(stream,curr)=>{var buffer=printCharBuffers[stream];if(!curr||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer));buffer.length=0}else buffer.push(curr)};var HEAPU16;var _exit=status=>{EXITSTATUS=status;_proc_exit(status)};if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["arguments"])Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];var preInit=Module["preInit"];if(preInit){if(typeof preInit==="function")Module["preInit"]=preInit=[preInit];while(preInit.length>0)preInit.shift()()}Module["UTF8ToString"]=UTF8ToString;var _free,_emwgpuCreateBindGroup,_emwgpuCreateBindGroupLayout,_emwgpuCreateCommandBuffer,_emwgpuCreateCommandEncoder,_emwgpuCreateComputePassEncoder,_emwgpuCreateComputePipeline,_emwgpuCreateExternalTexture,_emwgpuCreatePipelineLayout,_emwgpuCreateQuerySet,_emwgpuCreateRenderBundle,_emwgpuCreateRenderBundleEncoder,_emwgpuCreateRenderPassEncoder,_emwgpuCreateRenderPipeline,_emwgpuCreateSampler,_emwgpuCreateSurface,_emwgpuCreateTexture,_emwgpuCreateTextureView,_emwgpuCreateAdapter,_emwgpuImportBuffer,_emwgpuCreateDevice,_emwgpuCreateQueue,_emwgpuCreateShaderModule,_emwgpuOnDeviceLostCompleted,_emwgpuOnMapAsyncCompleted,_emwgpuOnPopErrorScopeCompleted,_emwgpuOnRequestAdapterCompleted,_emwgpuOnRequestDeviceCompleted,_emwgpuOnUncapturedError,__emscripten_timeout,_malloc,_memalign,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,wasmMemory,wasmTable;function assignWasmExports(wasmExports){Module["_thumbs_start"]=wasmExports["ka"];Module["_thumbs_staging"]=wasmExports["la"];Module["_thumbs_draw"]=wasmExports["ma"];Module["_thumbs_facts"]=wasmExports["na"];Module["_thumbs_trim"]=wasmExports["oa"];Module["_thumbs_heap_bytes"]=wasmExports["pa"];_free=Module["_free"]=wasmExports["qa"];_emwgpuCreateBindGroup=wasmExports["ra"];_emwgpuCreateBindGroupLayout=wasmExports["sa"];_emwgpuCreateCommandBuffer=wasmExports["ta"];_emwgpuCreateCommandEncoder=wasmExports["ua"];_emwgpuCreateComputePassEncoder=wasmExports["va"];_emwgpuCreateComputePipeline=wasmExports["wa"];_emwgpuCreateExternalTexture=wasmExports["xa"];_emwgpuCreatePipelineLayout=wasmExports["ya"];_emwgpuCreateQuerySet=wasmExports["za"];_emwgpuCreateRenderBundle=wasmExports["Aa"];_emwgpuCreateRenderBundleEncoder=wasmExports["Ba"];_emwgpuCreateRenderPassEncoder=wasmExports["Ca"];_emwgpuCreateRenderPipeline=wasmExports["Da"];_emwgpuCreateSampler=wasmExports["Ea"];_emwgpuCreateSurface=wasmExports["Fa"];_emwgpuCreateTexture=wasmExports["Ga"];_emwgpuCreateTextureView=wasmExports["Ha"];_emwgpuCreateAdapter=wasmExports["Ia"];_emwgpuImportBuffer=wasmExports["Ja"];_emwgpuCreateDevice=wasmExports["Ka"];_emwgpuCreateQueue=wasmExports["La"];_emwgpuCreateShaderModule=wasmExports["Ma"];_emwgpuOnDeviceLostCompleted=wasmExports["Na"];_emwgpuOnMapAsyncCompleted=wasmExports["Oa"];_emwgpuOnPopErrorScopeCompleted=wasmExports["Pa"];_emwgpuOnRequestAdapterCompleted=wasmExports["Qa"];_emwgpuOnRequestDeviceCompleted=wasmExports["Ra"];_emwgpuOnUncapturedError=wasmExports["Sa"];__emscripten_timeout=wasmExports["Ua"];_malloc=Module["_malloc"]=wasmExports["Va"];_memalign=wasmExports["Wa"];__emscripten_stack_restore=wasmExports["Xa"];__emscripten_stack_alloc=wasmExports["Ya"];_emscripten_stack_get_current=wasmExports["Za"];wasmMemory=wasmExports["ia"];wasmTable=wasmExports["Ta"]}var wasmImports={P:function(fp,sig){fp>>>=0;return getWasmTableEntry(fp)(sig)},V:()=>abort(""),R:()=>{noExitRuntime=false;runtimeKeepaliveCounter=0},K:(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which]}if(!timeout_ms)return 0;var id=setTimeout(()=>{delete timers[which];callUserCallback(__emscripten_timeout,which,_emscripten_get_now())},timeout_ms);timers[which]={id,timeout_ms};return 0},L:function(timezone,daylight,std_name,dst_name){timezone>>>=0;daylight>>>=0;std_name>>>=0;dst_name>>>=0;var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>>2>>>0]=stdTimezoneOffset*60;HEAP32[daylight>>>2>>>0]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17)}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17)}},N:function(requestedSize){requestedSize>>>=0;var oldSize=HEAPU8.length;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize)return false;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement)return true}return false},Z:function(adapterPtr,futureId,deviceLostFutureId,devicePtr,queuePtr,descriptor){adapterPtr>>>=0;futureId=bigintToI53Checked(futureId);deviceLostFutureId=bigintToI53Checked(deviceLostFutureId);devicePtr>>>=0;queuePtr>>>=0;descriptor>>>=0;var adapter=WebGPU.getJsObject(adapterPtr);var desc={};if(descriptor){var requiredFeatureCount=HEAPU32[descriptor+12>>>2>>>0];if(requiredFeatureCount){var requiredFeaturesPtr=HEAPU32[descriptor+16>>>2>>>0];desc["requiredFeatures"]=Array.from(HEAPU32.subarray(requiredFeaturesPtr>>>2>>>0,requiredFeaturesPtr+requiredFeatureCount*4>>>2>>>0),feature=>WebGPU.FeatureName[feature])}var limitsPtr=HEAPU32[descriptor+20>>>2>>>0];if(limitsPtr){var nextInChainPtr=HEAPU32[limitsPtr>>>2>>>0];var requiredLimits={};function setLimitU32IfDefined(name,basePtr,limitOffset,ignoreIfZero=false){var ptr=basePtr+limitOffset;var value=HEAPU32[ptr>>>2>>>0];if(value!=4294967295&&(!ignoreIfZero||value!=0))requiredLimits[name]=value}function setLimitU64IfDefined(name,basePtr,limitOffset){var ptr=basePtr+limitOffset;var limitPart1=HEAPU32[ptr>>>2>>>0];var limitPart2=HEAPU32[ptr+4>>>2>>>0];if(limitPart1!=4294967295||limitPart2!=4294967295)requiredLimits[name]=readI53FromI64(ptr)}setLimitU32IfDefined("maxTextureDimension1D",limitsPtr,4);setLimitU32IfDefined("maxTextureDimension2D",limitsPtr,8);setLimitU32IfDefined("maxTextureDimension3D",limitsPtr,12);setLimitU32IfDefined("maxTextureArrayLayers",limitsPtr,16);setLimitU32IfDefined("maxBindGroups",limitsPtr,20);setLimitU32IfDefined("maxBindGroupsPlusVertexBuffers",limitsPtr,24);setLimitU32IfDefined("maxBindingsPerBindGroup",limitsPtr,28);setLimitU32IfDefined("maxDynamicUniformBuffersPerPipelineLayout",limitsPtr,32);setLimitU32IfDefined("maxDynamicStorageBuffersPerPipelineLayout",limitsPtr,36);setLimitU32IfDefined("maxSampledTexturesPerShaderStage",limitsPtr,40);setLimitU32IfDefined("maxSamplersPerShaderStage",limitsPtr,44);setLimitU32IfDefined("maxStorageBuffersPerShaderStage",limitsPtr,48);setLimitU32IfDefined("maxStorageTexturesPerShaderStage",limitsPtr,52);setLimitU32IfDefined("maxUniformBuffersPerShaderStage",limitsPtr,56);setLimitU32IfDefined("minUniformBufferOffsetAlignment",limitsPtr,80);setLimitU32IfDefined("minStorageBufferOffsetAlignment",limitsPtr,84);setLimitU64IfDefined("maxUniformBufferBindingSize",limitsPtr,64);setLimitU64IfDefined("maxStorageBufferBindingSize",limitsPtr,72);setLimitU32IfDefined("maxVertexBuffers",limitsPtr,88);setLimitU64IfDefined("maxBufferSize",limitsPtr,96);setLimitU32IfDefined("maxVertexAttributes",limitsPtr,104);setLimitU32IfDefined("maxVertexBufferArrayStride",limitsPtr,108);setLimitU32IfDefined("maxInterStageShaderVariables",limitsPtr,112);setLimitU32IfDefined("maxColorAttachments",limitsPtr,116);setLimitU32IfDefined("maxColorAttachmentBytesPerSample",limitsPtr,120);setLimitU32IfDefined("maxComputeWorkgroupStorageSize",limitsPtr,124);setLimitU32IfDefined("maxComputeInvocationsPerWorkgroup",limitsPtr,128);setLimitU32IfDefined("maxComputeWorkgroupSizeX",limitsPtr,132);setLimitU32IfDefined("maxComputeWorkgroupSizeY",limitsPtr,136);setLimitU32IfDefined("maxComputeWorkgroupSizeZ",limitsPtr,140);setLimitU32IfDefined("maxComputeWorkgroupsPerDimension",limitsPtr,144);setLimitU32IfDefined("maxImmediateSize",limitsPtr,148,true);if(nextInChainPtr!==0){HEAP32[nextInChainPtr+4>>>2>>>0];var compatibilityModeLimitsPtr=nextInChainPtr;if("maxStorageBuffersInVertexStage"in GPUSupportedLimits.prototype){setLimitU32IfDefined("maxStorageBuffersInVertexStage",compatibilityModeLimitsPtr,8);setLimitU32IfDefined("maxStorageTexturesInVertexStage",compatibilityModeLimitsPtr,12);setLimitU32IfDefined("maxStorageBuffersInFragmentStage",compatibilityModeLimitsPtr,16);setLimitU32IfDefined("maxStorageTexturesInFragmentStage",compatibilityModeLimitsPtr,20)}}desc["requiredLimits"]=requiredLimits}var defaultQueuePtr=HEAPU32[descriptor+24>>>2>>>0];if(defaultQueuePtr){var defaultQueueDesc={label:WebGPU.makeStringFromOptionalStringView(defaultQueuePtr+4)};desc["defaultQueue"]=defaultQueueDesc}desc["label"]=WebGPU.makeStringFromOptionalStringView(descriptor+4)}WebGPU.Internals.futureInsert(futureId,adapter.requestDevice(desc).then(device=>{callUserCallback(()=>{WebGPU.Internals.jsObjectInsert(queuePtr,device.queue);WebGPU.Internals.jsObjectInsert(devicePtr,device);WebGPU.Internals.futureInsert(deviceLostFutureId,device.lost.then(info=>{callUserCallback(()=>{device.onuncapturederror=()=>{};var sp=stackSave();var messagePtr=stringToUTF8OnStack(info.message);_emwgpuOnDeviceLostCompleted(deviceLostFutureId,emwgpuStringToInt_DeviceLostReason[info.reason],messagePtr);stackRestore(sp)})}));device.onuncapturederror=ev=>{var type=5;if(ev.error instanceof GPUValidationError)type=2;else if(ev.error instanceof GPUOutOfMemoryError)type=3;else if(ev.error instanceof GPUInternalError)type=4;var sp=stackSave();var messagePtr=stringToUTF8OnStack(ev.error.message);_emwgpuOnUncapturedError(devicePtr,type,messagePtr);stackRestore(sp)};_emwgpuOnRequestDeviceCompleted(futureId,1,devicePtr,0)})},ex=>{callUserCallback(()=>{var sp=stackSave();var messagePtr=stringToUTF8OnStack(ex.message);_emwgpuOnRequestDeviceCompleted(futureId,3,devicePtr,messagePtr);if(deviceLostFutureId)_emwgpuOnDeviceLostCompleted(deviceLostFutureId,4,messagePtr);stackRestore(sp)})}))},u:function(bufferPtr,offset,size){bufferPtr>>>=0;offset>>>=0;size>>>=0;var buffer=WebGPU.getJsObject(bufferPtr);if(size==4294967295)size=void 0;var mapped;try{mapped=buffer.getMappedRange(offset,size)}catch(ex){return 0}var data=_memalign(16,mapped.byteLength);HEAPU8.set(new Uint8Array(mapped),data>>>0);WebGPU.Internals.bufferOnUnmaps[bufferPtr].push(()=>_free(data));return data},$:function(bufferPtr,futureId,mode,offset,size){bufferPtr>>>=0;futureId=bigintToI53Checked(futureId);mode=bigintToI53Checked(mode);offset>>>=0;size>>>=0;var buffer=WebGPU.getJsObject(bufferPtr);WebGPU.Internals.bufferOnUnmaps[bufferPtr]=[];if(size==4294967295)size=void 0;WebGPU.Internals.futureInsert(futureId,buffer.mapAsync(mode,offset,size).then(()=>{callUserCallback(()=>{_emwgpuOnMapAsyncCompleted(futureId,1,0)})},ex=>{callUserCallback(()=>{stackSave();var messagePtr=stringToUTF8OnStack(ex.message);var status=ex.name==="AbortError"?4:ex.name==="OperationError"?3:0;_emwgpuOnMapAsyncCompleted(futureId,status,messagePtr);delete WebGPU.Internals.bufferOnUnmaps[bufferPtr]})}))},t:function(bufferPtr){bufferPtr>>>=0;var buffer=WebGPU.getJsObject(bufferPtr);var onUnmap=WebGPU.Internals.bufferOnUnmaps[bufferPtr];if(!onUnmap)return;for(var i=0;i<onUnmap.length;++i)onUnmap[i]();delete WebGPU.Internals.bufferOnUnmaps[bufferPtr];buffer.unmap()},a:function(ptr){ptr>>>=0;delete WebGPU.Internals.jsObjects[ptr]},c:function(devicePtr,descriptor,bufferPtr){devicePtr>>>=0;descriptor>>>=0;bufferPtr>>>=0;var mappedAtCreation=!!HEAPU32[descriptor+32>>>2>>>0];var desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4),usage:HEAPU32[descriptor+16>>>2>>>0],size:readI53FromI64(descriptor+24),mappedAtCreation};var device=WebGPU.getJsObject(devicePtr);var buffer;try{buffer=device.createBuffer(desc)}catch(ex){return false}WebGPU.Internals.jsObjectInsert(bufferPtr,buffer);if(mappedAtCreation)WebGPU.Internals.bufferOnUnmaps[bufferPtr]=[];return true},k:function(devicePtr,descriptor,shaderModulePtr){devicePtr>>>=0;descriptor>>>=0;shaderModulePtr>>>=0;var nextInChainPtr=HEAPU32[descriptor>>>2>>>0];var sType=HEAP32[nextInChainPtr+4>>>2>>>0];var desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4),code:""};switch(sType){case 2:desc["code"]=WebGPU.makeStringFromStringView(nextInChainPtr+8);break}var device=WebGPU.getJsObject(devicePtr);WebGPU.Internals.jsObjectInsert(shaderModulePtr,device.createShaderModule(desc))},_:devicePtr=>{const device=WebGPU.getJsObject(devicePtr);device.onuncapturederror=null;device.destroy()},Y:function(devicePtr,futureId){devicePtr>>>=0;futureId=bigintToI53Checked(futureId);var device=WebGPU.getJsObject(devicePtr);WebGPU.Internals.futureInsert(futureId,device.popErrorScope().then(gpuError=>{callUserCallback(()=>{var type=5;if(!gpuError)type=1;else if(gpuError instanceof GPUValidationError)type=2;else if(gpuError instanceof GPUOutOfMemoryError)type=3;else if(gpuError instanceof GPUInternalError)type=4;var sp=stackSave();var messagePtr=gpuError?stringToUTF8OnStack(gpuError.message):0;_emwgpuOnPopErrorScopeCompleted(futureId,1,type,messagePtr);stackRestore(sp)})},ex=>{callUserCallback(()=>{var sp=stackSave();var messagePtr=stringToUTF8OnStack(ex.message);_emwgpuOnPopErrorScopeCompleted(futureId,1,5,messagePtr);stackRestore(sp)})}))},X:function(instancePtr,futureId,options,adapterPtr){instancePtr>>>=0;futureId=bigintToI53Checked(futureId);options>>>=0;adapterPtr>>>=0;var opts;if(options){opts={featureLevel:WebGPU.FeatureLevel[HEAP32[options+4>>>2>>>0]],powerPreference:WebGPU.PowerPreference[HEAP32[options+8>>>2>>>0]],forceFallbackAdapter:!!HEAPU32[options+12>>>2>>>0]};var nextInChainPtr=HEAPU32[options>>>2>>>0];if(nextInChainPtr!==0){HEAP32[nextInChainPtr+4>>>2>>>0];var webxrOptions=nextInChainPtr;opts.xrCompatible=!!HEAPU32[webxrOptions+8>>>2>>>0]}}if(!("gpu"in navigator)){var sp=stackSave();var messagePtr=stringToUTF8OnStack("WebGPU not available on this browser (navigator.gpu is not available)");_emwgpuOnRequestAdapterCompleted(futureId,3,adapterPtr,messagePtr);stackRestore(sp);return}WebGPU.Internals.futureInsert(futureId,navigator.gpu.requestAdapter(opts).then(adapter=>{callUserCallback(()=>{if(adapter){WebGPU.Internals.jsObjectInsert(adapterPtr,adapter);_emwgpuOnRequestAdapterCompleted(futureId,1,adapterPtr,0)}else{var sp=stackSave();var messagePtr=stringToUTF8OnStack("WebGPU not available on this browser (requestAdapter returned null)");_emwgpuOnRequestAdapterCompleted(futureId,3,adapterPtr,messagePtr);stackRestore(sp)}})},ex=>{callUserCallback(()=>{var sp=stackSave();var messagePtr=stringToUTF8OnStack(ex.message);_emwgpuOnRequestAdapterCompleted(futureId,4,adapterPtr,messagePtr);stackRestore(sp)})}))},W:function(futurePtr,futureCount,timeoutMSPtr){futurePtr>>>=0;futureCount>>>=0;timeoutMSPtr>>>=0;abort("TODO: Implement asyncify-free WaitAny for timeout=0")},S:function(__environ,environ_buf){__environ>>>=0;environ_buf>>>=0;var bufSize=0;var envp=0;for(var string of getEnvStrings()){var ptr=environ_buf+bufSize;HEAPU32[__environ+envp>>>2>>>0]=ptr;bufSize+=stringToUTF8(string,ptr,1/0)+1;envp+=4}return 0},T:function(penviron_count,penviron_buf_size){penviron_count>>>=0;penviron_buf_size>>>=0;var strings=getEnvStrings();HEAPU32[penviron_count>>>2>>>0]=strings.length;var bufSize=0;for(var string of strings)bufSize+=lengthBytesUTF8(string)+1;HEAPU32[penviron_buf_size>>>2>>>0]=bufSize;return 0},U:()=>52,O:function(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);newOffset>>>=0;return 70},D:function(fd,iov,iovcnt,pnum){iov>>>=0;iovcnt>>>=0;pnum>>>=0;var num=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>>2>>>0];var len=HEAPU32[iov+4>>>2>>>0];iov+=8;for(var j=0;j<len;j++)printChar(fd,HEAPU8[ptr+j>>>0]);num+=len}HEAPU32[pnum>>>2>>>0]=num;return 0},s:function(pixels,width,height,worldPerPixel,rects,message){Module.thumbsHost.drawn(pixels?HEAPU8.slice(pixels,pixels+width*height*4):null,width,height,worldPerPixel,Array.from(HEAPU32.subarray(rects>>>2,8+(rects>>2)>>>0)),UTF8ToString(message))},C:function(message){Module.thumbsHost.failed(UTF8ToString(message))},ha:function(){Module.thumbsHost.ready()},Q:_proc_exit,da:function(adapterPtr,limitsOutPtr){adapterPtr>>>=0;limitsOutPtr>>>=0;var adapter=WebGPU.getJsObject(adapterPtr);WebGPU.fillLimitStruct(adapter.limits,limitsOutPtr);return 1},p:function(bufferPtr){bufferPtr>>>=0;var ret=(()=>{var buffer=WebGPU.getJsObject(bufferPtr);return buffer.size})();return BigInt(ret)},H:function(encoderPtr,descriptor){encoderPtr>>>=0;descriptor>>>=0;var desc;if(descriptor)desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4),timestampWrites:WebGPU.makePassTimestampWrites(HEAPU32[descriptor+12>>>2>>>0])};var commandEncoder=WebGPU.getJsObject(encoderPtr);var ptr=_emwgpuCreateComputePassEncoder(0);WebGPU.Internals.jsObjectInsert(ptr,commandEncoder.beginComputePass(desc));return ptr},m:function(encoderPtr,descriptor){encoderPtr>>>=0;descriptor>>>=0;function makeColorAttachment(caPtr){var viewPtr=HEAPU32[caPtr+4>>>2>>>0];if(viewPtr===0)return;var depthSlice=HEAPU32[caPtr+8>>>2>>>0];if(depthSlice==4294967295)depthSlice=void 0;return{view:WebGPU.getJsObject(viewPtr),depthSlice,resolveTarget:WebGPU.getJsObject(HEAPU32[caPtr+12>>>2>>>0]),clearValue:WebGPU.makeColor(caPtr+24),loadOp:WebGPU.LoadOp[HEAP32[caPtr+16>>>2>>>0]],storeOp:WebGPU.StoreOp[HEAP32[caPtr+20>>>2>>>0]]}}function makeColorAttachments(count,caPtr){var attachments=[];for(var i=0;i<count;++i)attachments.push(makeColorAttachment(caPtr+56*i));return attachments}function makeDepthStencilAttachment(dsaPtr){if(dsaPtr===0)return;return{view:WebGPU.getJsObject(HEAPU32[dsaPtr+4>>>2>>>0]),depthClearValue:HEAPF32[dsaPtr+16>>>2>>>0],depthLoadOp:WebGPU.LoadOp[HEAP32[dsaPtr+8>>>2>>>0]],depthStoreOp:WebGPU.StoreOp[HEAP32[dsaPtr+12>>>2>>>0]],depthReadOnly:!!HEAPU32[dsaPtr+20>>>2>>>0],stencilClearValue:HEAPU32[dsaPtr+32>>>2>>>0],stencilLoadOp:WebGPU.LoadOp[HEAP32[dsaPtr+24>>>2>>>0]],stencilStoreOp:WebGPU.StoreOp[HEAP32[dsaPtr+28>>>2>>>0]],stencilReadOnly:!!HEAPU32[dsaPtr+36>>>2>>>0]}}var desc=function(descriptor){var nextInChainPtr=HEAPU32[descriptor>>>2>>>0];var maxDrawCount=void 0;if(nextInChainPtr!==0){HEAP32[nextInChainPtr+4>>>2>>>0];var renderPassMaxDrawCount=nextInChainPtr;maxDrawCount=readI53FromI64(renderPassMaxDrawCount+8)}var desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4),colorAttachments:makeColorAttachments(HEAPU32[descriptor+12>>>2>>>0],HEAPU32[descriptor+16>>>2>>>0]),depthStencilAttachment:makeDepthStencilAttachment(HEAPU32[descriptor+20>>>2>>>0]),occlusionQuerySet:WebGPU.getJsObject(HEAPU32[descriptor+24>>>2>>>0]),timestampWrites:WebGPU.makePassTimestampWrites(HEAPU32[descriptor+28>>>2>>>0]),maxDrawCount};return desc}(descriptor);var commandEncoder=WebGPU.getJsObject(encoderPtr);var ptr=_emwgpuCreateRenderPassEncoder(0);WebGPU.Internals.jsObjectInsert(ptr,commandEncoder.beginRenderPass(desc));return ptr},I:function(encoderPtr,srcPtr,srcOffset,dstPtr,dstOffset,size){encoderPtr>>>=0;srcPtr>>>=0;srcOffset=bigintToI53Checked(srcOffset);dstPtr>>>=0;dstOffset=bigintToI53Checked(dstOffset);size=bigintToI53Checked(size);var commandEncoder=WebGPU.getJsObject(encoderPtr);var src=WebGPU.getJsObject(srcPtr);var dst=WebGPU.getJsObject(dstPtr);commandEncoder.copyBufferToBuffer(src,srcOffset,dst,dstOffset,size)},i:function(encoderPtr,srcPtr,dstPtr,copySizePtr){encoderPtr>>>=0;srcPtr>>>=0;dstPtr>>>=0;copySizePtr>>>=0;var commandEncoder=WebGPU.getJsObject(encoderPtr);var copySize=WebGPU.makeExtent3D(copySizePtr);commandEncoder.copyTextureToBuffer(WebGPU.makeTexelCopyTextureInfo(srcPtr),WebGPU.makeTexelCopyBufferInfo(dstPtr),copySize)},y:function(encoderPtr,descriptor){encoderPtr>>>=0;descriptor>>>=0;var commandEncoder=WebGPU.getJsObject(encoderPtr);var ptr=_emwgpuCreateCommandBuffer(0);WebGPU.Internals.jsObjectInsert(ptr,commandEncoder.finish());return ptr},ba:function(encoderPtr,querySetPtr,firstQuery,queryCount,destinationPtr,destinationOffset){encoderPtr>>>=0;querySetPtr>>>=0;destinationPtr>>>=0;destinationOffset=bigintToI53Checked(destinationOffset);var commandEncoder=WebGPU.getJsObject(encoderPtr);var querySet=WebGPU.getJsObject(querySetPtr);var destination=WebGPU.getJsObject(destinationPtr);commandEncoder.resolveQuerySet(querySet,firstQuery,queryCount,destination,destinationOffset)},n:function(passPtr,x,y,z){passPtr>>>=0;var pass=WebGPU.getJsObject(passPtr);pass.dispatchWorkgroups(x,y,z)},G:function(passPtr){passPtr>>>=0;var pass=WebGPU.getJsObject(passPtr);pass.end()},w:function(passPtr,groupIndex,groupPtr,dynamicOffsetCount,dynamicOffsetsPtr){passPtr>>>=0;groupPtr>>>=0;dynamicOffsetCount>>>=0;dynamicOffsetsPtr>>>=0;var pass=WebGPU.getJsObject(passPtr);var group=WebGPU.getJsObject(groupPtr);if(dynamicOffsetCount==0)pass.setBindGroup(groupIndex,group);else pass.setBindGroup(groupIndex,group,HEAPU32,dynamicOffsetsPtr>>>2,dynamicOffsetCount)},o:function(passPtr,pipelinePtr){passPtr>>>=0;pipelinePtr>>>=0;var pass=WebGPU.getJsObject(passPtr);var pipeline=WebGPU.getJsObject(pipelinePtr);pass.setPipeline(pipeline)},ea:function(devicePtr,descriptor){devicePtr>>>=0;descriptor>>>=0;function makeEntry(entryPtr){var bufferPtr=HEAPU32[entryPtr+8>>>2>>>0];var samplerPtr=HEAPU32[entryPtr+32>>>2>>>0];var textureViewPtr=HEAPU32[entryPtr+36>>>2>>>0];var externalTexturePtr=0;WebGPU.iterateExtensions(entryPtr,{14:ptr=>{externalTexturePtr=HEAPU32[ptr+8>>>2>>>0]}});var resource;if(bufferPtr){var size=readI53FromI64(entryPtr+24);if(size==-1)size=void 0;resource={buffer:WebGPU.getJsObject(bufferPtr),offset:readI53FromI64(entryPtr+16),size}}else resource=WebGPU.getJsObject(samplerPtr||textureViewPtr||externalTexturePtr);return{binding:HEAPU32[entryPtr+4>>>2>>>0],resource}}var desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4),layout:WebGPU.getJsObject(HEAPU32[descriptor+12>>>2>>>0]),entries:function(count,entriesPtrs){var entries=[];for(var i=0;i<count;++i)entries.push(makeEntry(entriesPtrs+40*i));return entries}(HEAPU32[descriptor+16>>>2>>>0],HEAPU32[descriptor+20>>>2>>>0])};var device=WebGPU.getJsObject(devicePtr);var ptr=_emwgpuCreateBindGroup(0);WebGPU.Internals.jsObjectInsert(ptr,device.createBindGroup(desc));return ptr},h:function(devicePtr,descriptor){devicePtr>>>=0;descriptor>>>=0;function makeBufferEntry(substructPtr){var typeInt=HEAPU32[substructPtr+4>>>2>>>0];if(!typeInt)return;return{type:WebGPU.BufferBindingType[typeInt],hasDynamicOffset:!!HEAPU32[substructPtr+8>>>2>>>0],minBindingSize:readI53FromI64(substructPtr+16)}}function makeSamplerEntry(substructPtr){var typeInt=HEAPU32[substructPtr+4>>>2>>>0];if(!typeInt)return;return{type:WebGPU.SamplerBindingType[typeInt]}}function makeTextureEntry(substructPtr){var sampleTypeInt=HEAPU32[substructPtr+4>>>2>>>0];if(!sampleTypeInt)return;return{sampleType:WebGPU.TextureSampleType[sampleTypeInt],viewDimension:WebGPU.TextureViewDimension[HEAP32[substructPtr+8>>>2>>>0]],multisampled:!!HEAPU32[substructPtr+12>>>2>>>0]}}function makeStorageTextureEntry(substructPtr){var accessInt=HEAPU32[substructPtr+4>>>2>>>0];if(!accessInt)return;return{access:WebGPU.StorageTextureAccess[accessInt],format:WebGPU.TextureFormat[HEAP32[substructPtr+8>>>2>>>0]],viewDimension:WebGPU.TextureViewDimension[HEAP32[substructPtr+12>>>2>>>0]]}}function makeEntry(entryPtr){var entry={binding:HEAPU32[entryPtr+4>>>2>>>0],visibility:HEAPU32[entryPtr+8>>>2>>>0],buffer:makeBufferEntry(entryPtr+24),sampler:makeSamplerEntry(entryPtr+48),texture:makeTextureEntry(entryPtr+56),storageTexture:makeStorageTextureEntry(entryPtr+72)};WebGPU.iterateExtensions(entryPtr,{13:()=>{entry["externalTexture"]={}}});return entry}var desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4),entries:function(count,entriesPtrs){var entries=[];for(var i=0;i<count;++i)entries.push(makeEntry(entriesPtrs+88*i));return entries}(HEAPU32[descriptor+12>>>2>>>0],HEAPU32[descriptor+16>>>2>>>0])};var device=WebGPU.getJsObject(devicePtr);var ptr=_emwgpuCreateBindGroupLayout(0);WebGPU.Internals.jsObjectInsert(ptr,device.createBindGroupLayout(desc));return ptr},z:function(devicePtr,descriptor){devicePtr>>>=0;descriptor>>>=0;var desc;if(descriptor)desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4)};var device=WebGPU.getJsObject(devicePtr);var ptr=_emwgpuCreateCommandEncoder(0);WebGPU.Internals.jsObjectInsert(ptr,device.createCommandEncoder(desc));return ptr},j:function(devicePtr,descriptor){devicePtr>>>=0;descriptor>>>=0;var desc=WebGPU.makeComputePipelineDesc(descriptor);var device=WebGPU.getJsObject(devicePtr);var ptr=_emwgpuCreateComputePipeline(0);WebGPU.Internals.jsObjectInsert(ptr,device.createComputePipeline(desc));return ptr},M:function(devicePtr,descriptor){devicePtr>>>=0;descriptor>>>=0;var bglCount=HEAPU32[descriptor+12>>>2>>>0];var bglPtr=HEAPU32[descriptor+16>>>2>>>0];var bgls=[];for(var i=0;i<bglCount;++i)bgls.push(WebGPU.getJsObject(HEAPU32[bglPtr+4*i>>>2>>>0]));var desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4),bindGroupLayouts:bgls};var device=WebGPU.getJsObject(devicePtr);var ptr=_emwgpuCreatePipelineLayout(0);WebGPU.Internals.jsObjectInsert(ptr,device.createPipelineLayout(desc));return ptr},fa:function(devicePtr,descriptor){devicePtr>>>=0;descriptor>>>=0;var desc={type:WebGPU.QueryType[HEAP32[descriptor+12>>>2>>>0]],count:HEAPU32[descriptor+16>>>2>>>0]};var device=WebGPU.getJsObject(devicePtr);var ptr=_emwgpuCreateQuerySet(0);WebGPU.Internals.jsObjectInsert(ptr,device.createQuerySet(desc));return ptr},A:function(devicePtr,descriptor){devicePtr>>>=0;descriptor>>>=0;var desc=WebGPU.makeRenderPipelineDesc(descriptor);var device=WebGPU.getJsObject(devicePtr);var ptr=_emwgpuCreateRenderPipeline(0);WebGPU.Internals.jsObjectInsert(ptr,device.createRenderPipeline(desc));return ptr},J:function(devicePtr,descriptor){devicePtr>>>=0;descriptor>>>=0;var desc;if(descriptor)desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4),addressModeU:WebGPU.AddressMode[HEAP32[descriptor+12>>>2>>>0]],addressModeV:WebGPU.AddressMode[HEAP32[descriptor+16>>>2>>>0]],addressModeW:WebGPU.AddressMode[HEAP32[descriptor+20>>>2>>>0]],magFilter:WebGPU.FilterMode[HEAP32[descriptor+24>>>2>>>0]],minFilter:WebGPU.FilterMode[HEAP32[descriptor+28>>>2>>>0]],mipmapFilter:WebGPU.MipmapFilterMode[HEAP32[descriptor+32>>>2>>>0]],lodMinClamp:HEAPF32[descriptor+36>>>2>>>0],lodMaxClamp:HEAPF32[descriptor+40>>>2>>>0],compare:WebGPU.CompareFunction[HEAP32[descriptor+44>>>2>>>0]],maxAnisotropy:HEAPU16[descriptor+48>>>1>>>0]};var device=WebGPU.getJsObject(devicePtr);var ptr=_emwgpuCreateSampler(0);WebGPU.Internals.jsObjectInsert(ptr,device.createSampler(desc));return ptr},f:function(devicePtr,descriptor){devicePtr>>>=0;descriptor>>>=0;var nextInChainPtr=HEAPU32[descriptor>>>2>>>0];var textureBindingViewDimension;if(nextInChainPtr!==0){HEAP32[nextInChainPtr+4>>>2>>>0];var textureBindingViewDimensionDescriptor=nextInChainPtr;textureBindingViewDimension=WebGPU.TextureViewDimension[HEAP32[textureBindingViewDimensionDescriptor+8>>>2>>>0]]}var desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4),size:WebGPU.makeExtent3D(descriptor+28),mipLevelCount:HEAPU32[descriptor+44>>>2>>>0],sampleCount:HEAPU32[descriptor+48>>>2>>>0],dimension:WebGPU.TextureDimension[HEAP32[descriptor+24>>>2>>>0]],format:WebGPU.TextureFormat[HEAP32[descriptor+40>>>2>>>0]],usage:HEAPU32[descriptor+16>>>2>>>0],textureBindingViewDimension};var viewFormatCount=HEAPU32[descriptor+52>>>2>>>0];if(viewFormatCount){var viewFormatsPtr=HEAPU32[descriptor+56>>>2>>>0];desc["viewFormats"]=Array.from(HEAP32.subarray(viewFormatsPtr>>>2>>>0,viewFormatsPtr+viewFormatCount*4>>>2>>>0),format=>WebGPU.TextureFormat[format])}var device=WebGPU.getJsObject(devicePtr);var ptr=_emwgpuCreateTexture(0);WebGPU.Internals.jsObjectInsert(ptr,device.createTexture(desc));return ptr},aa:function(devicePtr,limitsOutPtr){devicePtr>>>=0;limitsOutPtr>>>=0;var device=WebGPU.getJsObject(devicePtr);WebGPU.fillLimitStruct(device.limits,limitsOutPtr);return 1},ga:function(devicePtr,featureEnumValue){devicePtr>>>=0;var device=WebGPU.getJsObject(devicePtr);return device.features.has(WebGPU.FeatureName[featureEnumValue])},B:function(devicePtr,filter){devicePtr>>>=0;var device=WebGPU.getJsObject(devicePtr);device.pushErrorScope(WebGPU.ErrorFilter[filter])},x:function(queuePtr,commandCount,commands){queuePtr>>>=0;commandCount>>>=0;commands>>>=0;var queue=WebGPU.getJsObject(queuePtr);var cmds=Array.from(HEAP32.subarray(commands>>>2>>>0,commands+commandCount*4>>>2>>>0),id=>WebGPU.getJsObject(id));queue.submit(cmds)},d:function(queuePtr,bufferPtr,bufferOffset,data,size){queuePtr>>>=0;bufferPtr>>>=0;bufferOffset=bigintToI53Checked(bufferOffset);data>>>=0;size>>>=0;var queue=WebGPU.getJsObject(queuePtr);var buffer=WebGPU.getJsObject(bufferPtr);var subarray=HEAPU8.subarray(data>>>0,data+size>>>0);queue.writeBuffer(buffer,bufferOffset,subarray,0,size)},q:function(passPtr,vertexCount,instanceCount,firstVertex,firstInstance){passPtr>>>=0;firstVertex>>>=0;firstInstance>>>=0;var pass=WebGPU.getJsObject(passPtr);pass.draw(vertexCount,instanceCount,firstVertex,firstInstance)},r:function(passPtr,indirectBufferPtr,indirectOffset){passPtr>>>=0;indirectBufferPtr>>>=0;indirectOffset=bigintToI53Checked(indirectOffset);var pass=WebGPU.getJsObject(passPtr);var indirectBuffer=WebGPU.getJsObject(indirectBufferPtr);pass.drawIndexedIndirect(indirectBuffer,indirectOffset)},E:function(passPtr,indirectBufferPtr,indirectOffset){passPtr>>>=0;indirectBufferPtr>>>=0;indirectOffset=bigintToI53Checked(indirectOffset);var pass=WebGPU.getJsObject(passPtr);var indirectBuffer=WebGPU.getJsObject(indirectBufferPtr);pass.drawIndirect(indirectBuffer,indirectOffset)},l:function(encoderPtr){encoderPtr>>>=0;var encoder=WebGPU.getJsObject(encoderPtr);encoder.end()},e:function(passPtr,groupIndex,groupPtr,dynamicOffsetCount,dynamicOffsetsPtr){passPtr>>>=0;groupPtr>>>=0;dynamicOffsetCount>>>=0;dynamicOffsetsPtr>>>=0;var pass=WebGPU.getJsObject(passPtr);var group=WebGPU.getJsObject(groupPtr);if(dynamicOffsetCount==0)pass.setBindGroup(groupIndex,group);else pass.setBindGroup(groupIndex,group,HEAPU32,dynamicOffsetsPtr>>>2,dynamicOffsetCount)},ca:function(passPtr,colorPtr){passPtr>>>=0;colorPtr>>>=0;var pass=WebGPU.getJsObject(passPtr);var color=WebGPU.makeColor(colorPtr);pass.setBlendConstant(color)},v:function(passPtr,bufferPtr,format,offset,size){passPtr>>>=0;bufferPtr>>>=0;offset=bigintToI53Checked(offset);size=bigintToI53Checked(size);var pass=WebGPU.getJsObject(passPtr);var buffer=WebGPU.getJsObject(bufferPtr);if(size==-1)size=void 0;pass.setIndexBuffer(buffer,WebGPU.IndexFormat[format],offset,size)},g:function(passPtr,pipelinePtr){passPtr>>>=0;pipelinePtr>>>=0;var pass=WebGPU.getJsObject(passPtr);var pipeline=WebGPU.getJsObject(pipelinePtr);pass.setPipeline(pipeline)},F:function(passPtr,x,y,w,h,minDepth,maxDepth){passPtr>>>=0;var pass=WebGPU.getJsObject(passPtr);pass.setViewport(x,y,w,h,minDepth,maxDepth)},b:function(texturePtr,descriptor){texturePtr>>>=0;descriptor>>>=0;var desc;if(descriptor){var swizzle;var nextInChainPtr=HEAPU32[descriptor>>>2>>>0];if(nextInChainPtr!==0){HEAP32[nextInChainPtr+4>>>2>>>0];var swizzleDescriptor=nextInChainPtr;var swizzlePtr=swizzleDescriptor+8;var r=WebGPU.ComponentSwizzle[HEAP32[swizzlePtr>>>2>>>0]]||"r";var g=WebGPU.ComponentSwizzle[HEAP32[swizzlePtr+4>>>2>>>0]]||"g";var b=WebGPU.ComponentSwizzle[HEAP32[swizzlePtr+8>>>2>>>0]]||"b";var a=WebGPU.ComponentSwizzle[HEAP32[swizzlePtr+12>>>2>>>0]]||"a";swizzle=`${r}${g}${b}${a}`}var mipLevelCount=HEAPU32[descriptor+24>>>2>>>0];var arrayLayerCount=HEAPU32[descriptor+32>>>2>>>0];desc={label:WebGPU.makeStringFromOptionalStringView(descriptor+4),format:WebGPU.TextureFormat[HEAP32[descriptor+12>>>2>>>0]],dimension:WebGPU.TextureViewDimension[HEAP32[descriptor+16>>>2>>>0]],baseMipLevel:HEAPU32[descriptor+20>>>2>>>0],mipLevelCount:mipLevelCount===4294967295?void 0:mipLevelCount,baseArrayLayer:HEAPU32[descriptor+28>>>2>>>0],arrayLayerCount:arrayLayerCount===4294967295?void 0:arrayLayerCount,aspect:WebGPU.TextureAspect[HEAP32[descriptor+36>>>2>>>0]],usage:HEAPU32[descriptor+40>>>2>>>0],swizzle}}var texture=WebGPU.getJsObject(texturePtr);var ptr=_emwgpuCreateTextureView(0);WebGPU.Internals.jsObjectInsert(ptr,texture.createView(desc));return ptr}};function applySignatureConversions(wasmExports){var makeWrapper_pp=f=>a0=>f(a0)>>>0;var origExports=wasmExports;wasmExports={};wasmExports["Va"]=makeWrapper_pp(origExports["Va"]);wasmExports["Wa"]=(f=>(a0,a1)=>f(a0,a1)>>>0)(origExports["Wa"]);wasmExports["Ya"]=makeWrapper_pp(origExports["Ya"]);wasmExports["Za"]=(f=>()=>f()>>>0)(origExports["Za"]);Object.setPrototypeOf(wasmExports,origExports);return wasmExports}var wasmExports;wasmExports=await async function(){function receiveInstance(instance){wasmExports=instance.exports;wasmExports=applySignatureConversions(wasmExports);assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}var info=getWasmImports();var instantiateWasm=Module["instantiateWasm"];if(instantiateWasm)return new Promise(resolve=>{instantiateWasm(info,inst=>resolve(receiveInstance(inst)))});wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(void 0,wasmBinaryFile,info);var exports=function(result){return receiveInstance(result["instance"])}(result);return exports}();await async function(){preRun();var setStatus=Module["setStatus"];if(setStatus){setStatus("Running...");await new Promise(resolve=>setTimeout(resolve,1));setTimeout(setStatus,1,"")}if(ABORT)return;initRuntime();Module["onRuntimeInitialized"]?.();postRun()}();
2
+ ;return Module}export default createThumbs;