Skip to content

[SIGGRAPH Asia 2026] 4DAnyone: Create Anyone in 4D from a Casual Monocular Video

Add a Gradio GUI for inference and result viewing (#40)

Yudong Jinc16451230ee0
diff --git a/README.md b/README.md
index f4325a2..3a7c4a3 100644
--- a/README.md
+++ b/README.md
@@ -110,7 +110,7 @@ Run `python inference.py --help` for the full list.
- `video_path`: path to the source video.
- `output_dir`: output directory for the current clip. Defaults to `data/fdanyone/<clip>`.
-- `views_per_layer`: number of evenly spaced views per pitch layer. It must be divisible by 4 or 6.
+- `views_per_layer`: number of evenly spaced views per pitch layer. The total number of views must be divisible by 4 or 6.
- `layer_pitches`: pitch angles in degrees, one per layer. Positive values place cameras above the subject. Total views are `views_per_layer × len(layer_pitches)`.
- `start_yaw`: horizontal angle of the first view, in degrees. Yaw `0` is the front view.
- `yaw_span`: horizontal range covered by each camera layer, in degrees.
@@ -144,6 +144,55 @@ Use an input video with:
- no large camera movements, clear footage.
- 1080p or higher, 9:16 portrait aspect ratio, at least 121 frames.
+## GUI
+
+We provide a Gradio space for interactive inference and visualization. It is built with [Rerun](https://rerun.io/), inspired by the community [4DAnyone-Rerun Space](https://huggingface.co/spaces/rerun/4danyone-rerun).
+
+<p align="center"><img src="docs/assets/space-viewer.gif" width="100%" alt="4DAnyone GUI viewer"></p>
+
+### Installation
+
+Follow the [installation instructions](#installation) above, then install the GUI packages in the same environment:
+
+```bash
+pip install -r requirements-gui.txt
+```
+
+### Viewer
+
+Pass an existing output directory:
+
+```bash
+python app.py \
+ --output_dir "data/fdanyone/pexels/2785536-uhd_2160_3840_25fps" \
+ --server_port 7860
+```
+
+Open **http://127.0.0.1:7860** to view the inference results. You can also resume unfinished inference runs.
+
+### Runner
+
+Choose a source video and a new output directory:
+
+```bash
+python app.py \
+ --video_path "data/source/pexels/2785536-uhd_2160_3840_25fps.mp4" \
+ --output_dir "data/fdanyone/pexels/2785536-uhd_2160_3840_25fps" \
+ --server_port 7860
+```
+
+Open **http://127.0.0.1:7860**, adjust the settings and click **Run Inference**.
+
+<!-- Runner video: paste the uploaded GitHub attachment URL here. -->
+
+### Remote Access
+
+Start the GUI on your GPU server using the commands above, then forward the port from your local computer:
+
+```bash
+ssh -N -L 7860:127.0.0.1:7860 user@gpu-host
+```
+
## 3DGS Reconstruction
See the [nerfstudio guide](docs/nerfstudio.md) for details.
diff --git a/app.py b/app.py
new file mode 100644
index 0000000..c17e8a5
--- /dev/null
+++ b/app.py
@@ -0,0 +1,110 @@
+"""Launch 4DAnyone Space in the inference environment."""
+
+from __future__ import annotations
+
+import atexit
+import os
+import signal
+import sys
+
+from fdanyone.attention import validate_attention_backend
+from fdanyone.errors import ConfigurationError, FourDAnyoneError
+from fdanyone.space.task import SpaceConfig, repository_path, resolve_task
+
+
+def launch(
+ video_path: str | None = None,
+ output_dir: str | None = None,
+ model_dir: str = "models",
+ gvhmr_root: str = "third_party/GVHMR",
+ cache_dir: str = "outputs/space",
+ gpu_ids: list[int] | None = None,
+ attention_backend: str = "auto",
+ server_name: str = "127.0.0.1",
+ server_port: int = 7860,
+) -> None:
+ """Launch 4DAnyone Space for interactive inference and visualization.
+
+ Relative paths use the code repository root.
+
+ Args:
+ video_path: Source video for a new task.
+ output_dir: Task result directory. Omit video_path to view or resume it.
+ New tasks default to a new directory under data/fdanyone/<clip>/.
+ model_dir: Model root; missing public checkpoints download here.
+ gvhmr_root: Path to the GVHMR source checkout.
+ cache_dir: Logs, body geometry, and scene recordings.
+ gpu_ids: Initially selected GPU IDs, e.g. [0] or [0,1].
+ Omit to select all CUDA-visible GPUs, as in the CLI.
+ attention_backend: auto, sdpa, sageattention, or flash_attn_3.
+ server_name: Server bind address.
+ server_port: Server port, from 1 to 65535.
+ """
+ validate_attention_backend(attention_backend)
+ if isinstance(server_port, bool) or not isinstance(server_port, int) or not 1 <= server_port <= 65535:
+ raise ConfigurationError("server_port must be an integer from 1 to 65535.")
+ video_path, output_dir = resolve_task(video_path, output_dir)
+ config = SpaceConfig(
+ output_dir=output_dir,
+ cache_dir=repository_path(cache_dir).resolve(),
+ model_dir=repository_path(model_dir).resolve(),
+ gvhmr_root=repository_path(gvhmr_root).resolve(),
+ gpu_ids=tuple(gpu_ids) if gpu_ids is not None else None,
+ attention_backend=attention_backend,
+ video_path=video_path,
+ )
+ _serve(config, server_name=server_name, server_port=server_port)
+
+
+def _serve(config: SpaceConfig, *, server_name: str, server_port: int) -> None:
+ cache_dir = config.cache_dir
+ cache_dir.mkdir(parents=True, exist_ok=True)
+ # Gradio's shared /tmp/gradio may belong to another user on a GPU host.
+ # Set this before importing Gradio, which initializes its upload cache.
+ os.environ.setdefault("GRADIO_TEMP_DIR", str(cache_dir / "gradio"))
+ try:
+ from fdanyone.space.jobs import JobManager
+ from fdanyone.space.theme import CSS, THEME
+ from fdanyone.space.ui import build_space
+ except ImportError as exc:
+ raise SystemExit(
+ f"GUI dependency unavailable: {exc}. Install requirements.txt and requirements-gui.txt."
+ ) from exc
+ manager = JobManager(config)
+ atexit.register(manager.close)
+
+ def shutdown(_signum, _frame):
+ raise SystemExit(0)
+
+ previous_sigterm = signal.signal(signal.SIGTERM, shutdown)
+ try:
+ print(f"Output Directory: {config.output_dir}", flush=True)
+ space = build_space(manager)
+ space.queue(default_concurrency_limit=8, max_size=32).launch(
+ server_name=server_name,
+ server_port=server_port,
+ ssr_mode=False,
+ css=CSS,
+ theme=THEME,
+ allowed_paths=[str(config.cache_dir)],
+ max_file_size="500mb",
+ show_error=True,
+ )
+ finally:
+ manager.close()
+ signal.signal(signal.SIGTERM, previous_sigterm)
+
+
+def main() -> None:
+ from fire import Fire
+
+ try:
+ Fire(launch)
+ except FourDAnyoneError as exc:
+ message = " ".join(line.strip() for line in str(exc).splitlines())
+ print(f"error: {message}", file=sys.stderr)
+ raise SystemExit(1) from None
+
+
+if __name__ == "__main__":
+ main()
diff --git a/docs/THIRD_PARTY_NOTICES.md b/docs/THIRD_PARTY_NOTICES.md
index e018b14..aa8f8db 100644
--- a/docs/THIRD_PARTY_NOTICES.md
+++ b/docs/THIRD_PARTY_NOTICES.md
@@ -39,7 +39,7 @@ Classic GVHMR imports PyTorch3D rotation conversions through a broader training-
- Location: `data/source/pexels`
- Terms: <https://www.pexels.com/license/>
-The companion Hugging Face repository distributes 20 modified 121-frame excerpts for running the public demo. They are installed under the location above on demand. Their filenames, source videos, extraction ranges, and checksums are recorded in the pinned [Pexels asset manifest](https://huggingface.co/AntResearch/4DAnyone/blob/4c80e87b805a5f8461cf339cdbe2fb4249e585aa/data/source/pexels/README.md). Pexels permits its media to be used and modified for free and does not require attribution. The source links are retained for provenance and creator credit.
+The companion Hugging Face repository distributes 20 modified 121-frame excerpts for CLI inference and 4DAnyone Space. They are installed under the location above on demand. Their filenames, source videos, extraction ranges, and checksums are recorded in the pinned [Pexels asset manifest](https://huggingface.co/AntResearch/4DAnyone/blob/4c80e87b805a5f8461cf339cdbe2fb4249e585aa/data/source/pexels/README.md). Pexels permits its media to be used and modified for free and does not require attribution. The source links are retained for provenance and creator credit.
## DiffSynth-Studio inference runtime
diff --git a/docs/assets/space-viewer.gif b/docs/assets/space-viewer.gif
new file mode 100644
index 0000000..e4914c0
Binary files /dev/null and b/docs/assets/space-viewer.gif differ
diff --git a/docs/assets/teaser.gif b/docs/assets/teaser.gif
index d778d1a..7721d6f 100644
Binary files a/docs/assets/teaser.gif and b/docs/assets/teaser.gif differ
diff --git a/fdanyone/device.py b/fdanyone/device.py
index 1c49f39..390d33d 100644
--- a/fdanyone/device.py
+++ b/fdanyone/device.py
@@ -121,16 +121,12 @@ def select_cuda_device(device: str) -> tuple[str, int]:
return f"cuda:{index}", index
-def select_cuda_devices(gpu_ids: Sequence[int] | None = None) -> tuple[str, ...]:
- """Select an ordered set of CUDA-visible devices for one inference run."""
-
- import torch
-
- if not torch.cuda.is_available() or torch.cuda.device_count() <= 0:
+def validate_gpu_ids(gpu_ids: Sequence[int] | None, available: int) -> tuple[int, ...]:
+ """Validate logical indices without initializing CUDA or selecting a device."""
+ if available <= 0:
raise ConfigurationError("4DAnyone requires at least one available CUDA device.")
-
if gpu_ids is None:
- selected = tuple(range(torch.cuda.device_count()))
+ selected = tuple(range(available))
else:
if isinstance(gpu_ids, (str, bytes)) or not isinstance(gpu_ids, Sequence) or not gpu_ids:
raise ConfigurationError("gpu_ids must be a non-empty list of CUDA-visible device IDs.")
@@ -141,11 +137,18 @@ def select_cuda_devices(gpu_ids: Sequence[int] | None = None) -> tuple[str, ...]
if len(set(selected)) != len(selected):
raise ConfigurationError(f"gpu_ids must not contain duplicates, got {list(selected)!r}.")
- available = torch.cuda.device_count()
unavailable = [gpu_id for gpu_id in selected if gpu_id < 0 or gpu_id >= available]
if unavailable:
raise ConfigurationError(
f"gpu_ids contains unavailable CUDA-visible device IDs {unavailable}; visible device count is {available}."
)
+ return selected
+
+
+def select_cuda_devices(gpu_ids: Sequence[int] | None = None) -> tuple[str, ...]:
+ """Select an ordered set of CUDA-visible devices for one inference run."""
+ import torch
+
+ selected = validate_gpu_ids(gpu_ids, torch.cuda.device_count() if torch.cuda.is_available() else 0)
torch.cuda.set_device(selected[0])
return tuple(f"cuda:{gpu_id}" for gpu_id in selected)
diff --git a/fdanyone/model/routing.py b/fdanyone/model/routing.py
index 7bfa089..5da58b3 100644
--- a/fdanyone/model/routing.py
+++ b/fdanyone/model/routing.py
@@ -17,9 +17,9 @@ Routes = tuple[StepGroups, ...]
def denoising_camera_order(view_plan: ViewPlan) -> CameraOrder:
"""Return one deterministic cycle over the plan's canonical camera IDs.
- A single layer keeps its public yaw order. Multiple layers form a
- Hamiltonian cycle in the open pitch-by-yaw grid, so partial yaw layouts do
- not need a false edge between their horizontal endpoints.
+ A single row or column keeps its angular order. A two-dimensional layout
+ forms a Hamiltonian cycle in the open pitch-by-yaw grid, so partial yaw
+ layouts do not need a false edge between their horizontal endpoints.
"""
views_per_layer = view_plan.views_per_layer
@@ -30,23 +30,30 @@ def denoising_camera_order(view_plan: ViewPlan) -> CameraOrder:
raise ValueError("A denoising camera order requires distinct pitch layers.")
if num_layers == 1:
return tuple(range(views_per_layer))
- if views_per_layer % 2:
- raise ValueError("A multi-layer camera ring requires an even number of views per layer.")
+ if views_per_layer > 1 and views_per_layer % 2 and num_layers % 2:
+ raise ValueError("A multi-layer camera grid requires an even number of cameras.")
# Public IDs follow input layer order. Physical vertical neighbors follow
# pitch order, so this mapping changes traversal without changing identity.
layers_by_pitch = tuple(sorted(range(num_layers), key=view_plan.layer_pitches.__getitem__))
+ if views_per_layer == 1:
+ return layers_by_pitch
- def camera_id(pitch_rank: int, yaw_index: int) -> int:
+ # Keep the released traversal when yaw is even. Odd yaw counts have an even
+ # layer count, so transposing the grid gives the same adjacent-cycle construction.
+ transpose = views_per_layer % 2 == 1
+ rows, columns = (views_per_layer, num_layers) if transpose else (num_layers, views_per_layer)
+
+ def camera_id(row: int, column: int) -> int:
+ pitch_rank, yaw_index = (column, row) if transpose else (row, column)
return layers_by_pitch[pitch_rank] * views_per_layer + yaw_index
- # Reserve the lowest-pitch row as the return lane: descend the first yaw
- # column, snake through the remaining rows, then traverse that row backward.
- order = [camera_id(pitch_rank, 0) for pitch_rank in range(num_layers)]
- for yaw_index in range(1, views_per_layer):
- pitch_ranks = range(num_layers - 1, 0, -1) if yaw_index % 2 else range(1, num_layers)
- order.extend(camera_id(pitch_rank, yaw_index) for pitch_rank in pitch_ranks)
- order.extend(camera_id(0, yaw_index) for yaw_index in range(views_per_layer - 1, 0, -1))
+ # Reserve the first row as the return lane, then snake through the other rows.
+ order = [camera_id(row, 0) for row in range(rows)]
+ for column in range(1, columns):
+ row_order = range(rows - 1, 0, -1) if column % 2 else range(1, rows)
+ order.extend(camera_id(row, column) for row in row_order)
+ order.extend(camera_id(0, column) for column in range(columns - 1, 0, -1))
return tuple(order)
diff --git a/fdanyone/output_directory.py b/fdanyone/output_directory.py
index 0693191..89a8965 100644
--- a/fdanyone/output_directory.py
+++ b/fdanyone/output_directory.py
@@ -11,6 +11,7 @@ from typing import TYPE_CHECKING
from fdanyone.errors import ConfigurationError, FourDAnyoneError
from fdanyone.io import lock_output, remove_tree, resolve_output_path
+from fdanyone.run_request import REQUEST_FILE, read_run_request
if TYPE_CHECKING:
from fdanyone.motion.result import MotionResult
@@ -58,7 +59,8 @@ class OutputDirectory:
raise ConfigurationError(f"Output path already exists: {self.destination}. Choose a new --output_dir.")
if os.path.lexists(self.destination / "metadata.json"):
raise ConfigurationError(f"4DAnyone output already exists: {self.destination}. Choose a new --output_dir.")
- allowed = {"gvhmr", ".inference"}
+ allowed = {"gvhmr", ".inference", REQUEST_FILE}
+ read_run_request(self.destination)
if self._owner.is_file() and self._publishing.is_file():
allowed.update(_GENERATED[:-1])
self._check_entries(self.destination, allowed)
diff --git a/fdanyone/pipeline.py b/fdanyone/pipeline.py
index f304701..d7adf7e 100644
--- a/fdanyone/pipeline.py
+++ b/fdanyone/pipeline.py
@@ -31,6 +31,7 @@ from fdanyone.io import remove_tree, resolve_output_path, write_json
from fdanyone.motion.gvhmr import validate_gvhmr
from fdanyone.motion.result import MotionResult
from fdanyone.output_directory import OutputDirectory
+from fdanyone.run_request import save_run_request
from fdanyone.video import (
decode_canonical_clip,
validate_clip_options,
@@ -41,6 +42,9 @@ from fdanyone.video import (
from fdanyone.views import ViewPlan, resolve_view_plan
LOGGER = logging.getLogger("fdanyone")
+PROGRESS = logging.getLogger("fdanyone.progress")
+PROGRESS.addHandler(logging.NullHandler())
+PROGRESS.propagate = False
def _resolve_output_dir(output_dir: str | None, video_path: str) -> Path:
@@ -195,8 +199,10 @@ def run_pipeline(
) -> dict:
"""Execute inference for one clip, retaining reusable motion."""
+ request_options = locals().copy()
pipeline_started = time.monotonic()
logging.basicConfig(level=logging.INFO, format="%(asctime)s | %(levelname)s | %(message)s")
+ PROGRESS.info("Checking input and settings", extra={"fraction": 0.02})
if seed < 0:
raise ConfigurationError(f"seed must be non-negative, got {seed}.")
if not isinstance(enable_turbo, bool):
@@ -232,6 +238,7 @@ def run_pipeline(
attention_backend = get_attention_backend(attention_backend)
LOGGER.info("Using attention backend: %s", attention_backend)
+ PROGRESS.info("Preparing model assets", extra={"fraction": 0.05})
ensure_example_video(video_path)
# Resolve the licensed body model before starting the much larger public
# model download. Interactive use continues automatically after setup;
@@ -247,6 +254,7 @@ def run_pipeline(
base_assets = resolve_base_assets(model_dir)
regressor = resolve_regressor(mhr70_regressor_path, model_dir=model_dir)
foreground_model = resolve_foreground_model(model_dir)
+ PROGRESS.info("Preparing the 121-frame clip", extra={"fraction": 0.10})
clip = decode_canonical_clip(
video_path,
num_frames=INFERENCE.num_frames,
@@ -261,10 +269,12 @@ def run_pipeline(
working_video = write_gvhmr_video(clip, scratch / "canonical_clip.mp4")
with output.stage() as work:
+ PROGRESS.info("Recovering human motion with GVHMR", extra={"fraction": 0.15})
if output.motion_dir.exists():
LOGGER.info("Reusing GVHMR motion from %s", output.motion_dir)
motion = MotionResult.load(output.motion_dir)
else:
+ save_run_request(destination, request_options)
motion = _run_motion(
working_video=working_video,
output_dir=scratch / "gvhmr",
@@ -279,7 +289,9 @@ def run_pipeline(
"Choose a new --output_dir to recover motion with the current GVHMR version."
)
motion.validate_against_clip(clip)
- if not output.motion_dir.exists():
+ if output.motion_dir.exists():
+ save_run_request(destination, request_options)
+ else:
output.save_motion(motion)
# Record the published identity only for the published checkpoint; an
@@ -300,6 +312,7 @@ def run_pipeline(
from fdanyone.model.inference import generate_views
from fdanyone.output_writer import write_output
+ PROGRESS.info("Building foreground masks and skeletons", extra={"fraction": 0.30})
conditioning = _build_conditioning(
working_video=working_video,
clip_metadata=clip_metadata,
@@ -322,6 +335,7 @@ def run_pipeline(
raise ConfigurationError("Skeleton conditioning does not match the canonical clip timeline.")
# Re-decode the worker-produced source before it becomes a model tensor.
verify_lossless_video(clip, conditioning.source_video)
+ PROGRESS.info("Generating target-view videos", extra={"fraction": 0.45})
generated = generate_views(
clip=clip,
conditioning=conditioning,
@@ -334,6 +348,7 @@ def run_pipeline(
devices=devices,
seed=seed,
)
+ PROGRESS.info("Saving and validating generated videos", extra={"fraction": 0.92})
summary = write_output(
clip=clip,
conditioning=conditioning,
@@ -346,4 +361,5 @@ def run_pipeline(
finally:
_discard_scratch(scratch)
summary["output_dir"] = str(destination)
+ PROGRESS.info("Inference complete", extra={"fraction": 1.0})
return summary
diff --git a/fdanyone/run_request.py b/fdanyone/run_request.py
new file mode 100644
index 0000000..b8491ff
--- /dev/null
+++ b/fdanyone/run_request.py
@@ -0,0 +1,59 @@
+"""Persist the original inference request independently of output publication."""
+
+from __future__ import annotations
+
+import json
+from datetime import datetime, timezone
+from pathlib import Path
+
+from fdanyone.errors import ConfigurationError
+from fdanyone.io import sha256_file, write_json
+
+REQUEST_FILE = ".4danyone-request.json"
+
+
+def read_run_request(directory: str | Path) -> dict | None:
+ path = Path(directory) / REQUEST_FILE
+ if not path.exists() and not path.is_symlink():
+ return None
+ try:
+ if path.is_symlink():
+ raise ValueError("The request must be a regular file")
+ value = json.loads(path.read_text())
+ if value["version"] != 1 or not isinstance(value["options"], dict):
+ raise ValueError("Unsupported request format")
+ if not isinstance(value["options"]["video_path"], str) or not isinstance(value["source"], dict):
+ raise ValueError("Invalid source identity")
+ return value
+ except (OSError, ValueError, KeyError, TypeError) as exc:
+ raise ConfigurationError(f"Cannot read saved inference settings: {path}.") from exc
+
+
+def save_run_request(directory: str | Path, options: dict, **fields) -> dict:
+ """Call while reserving the output; never place orchestration files in staging."""
+
+ directory = Path(directory)
+ previous = read_run_request(directory) or {}
+ source = Path(options["video_path"]).resolve()
+ stat = source.stat()
+ identity = {"path": str(source), "filename": source.name, "size_bytes": stat.st_size, "mtime_ns": stat.st_mtime_ns}
+ old_source = previous.get("source", {})
+ identity["sha256"] = (
+ old_source["sha256"]
+ if old_source.get("sha256") and all(old_source.get(key) == value for key, value in identity.items())
+ else sha256_file(source)
+ )
+ options = dict(options)
+ for key in ("model_dir", "gvhmr_root", "checkpoint_path", "mhr70_regressor_path"):
+ if options.get(key):
+ options[key] = str(Path(options[key]).expanduser().resolve())
+ value = {
+ **previous,
+ "version": 1,
+ "created_at": previous.get("created_at", datetime.now(timezone.utc).isoformat()),
+ "options": {**options, "video_path": str(source), "output_dir": str(directory.resolve())},
+ "source": identity,
+ **fields,
+ }
+ write_json(directory / REQUEST_FILE, value)
+ return value
diff --git a/fdanyone/skeleton/pipeline.py b/fdanyone/skeleton/pipeline.py
index 211fb8d..b3632e3 100644
--- a/fdanyone/skeleton/pipeline.py
+++ b/fdanyone/skeleton/pipeline.py
@@ -125,6 +125,8 @@ class _BodyGeometry:
keypoints_incam: np.ndarray
motion_world_to_canonical_world: np.ndarray
regressor_metadata: dict[str, int | str]
+ mesh_world: np.ndarray | None = None
+ mesh_faces: np.ndarray | None = None
def _video_tensor(path: Path, num_frames: int, *, crop: Crop | None = None):
@@ -191,6 +193,8 @@ def _body_geometry(
regressor_path: Path,
gvhmr_root: Path,
device: str,
+ *,
+ include_mesh: bool = False,
) -> _BodyGeometry:
import torch
@@ -238,6 +242,12 @@ def _body_geometry(
vertices_world = apply_T_on_points(vertices_offset, transform)
keypoints_world = apply_T_on_points(keypoints_global - offset, transform)
joints_world = torch.einsum("jv,lvi->lji", joint_regressor, vertices_world)
+ mesh_world = (
+ apply_T_on_points(vertices_global - offset, transform).detach().cpu().numpy().astype(np.float32)
+ if include_mesh
+ else None
+ )
+ mesh_faces = np.asarray(smplx.faces, dtype=np.uint32) if include_mesh else None
world_transform = transform[0].detach().clone()
world_transform[:3, 3] -= world_transform[:3, :3] @ offset
@@ -248,6 +258,8 @@ def _body_geometry(
keypoints_incam.detach().cpu().numpy().astype(np.float32),
world_transform.detach().cpu().numpy().astype(np.float64),
regressor_metadata,
+ mesh_world,
+ mesh_faces,
)
del smplx, vertices_global, vertices_incam, vertices_smpl, vertices_world, keypoints_global, keypoints_world
torch.cuda.empty_cache()
diff --git a/fdanyone/space/__init__.py b/fdanyone/space/__init__.py
new file mode 100644
index 0000000..92ccd1b
--- /dev/null
+++ b/fdanyone/space/__init__.py
@@ -0,0 +1 @@
+"""Optional local UI; importing the inference pipeline never imports this package."""
diff --git a/fdanyone/space/assets/OFL.txt b/fdanyone/space/assets/OFL.txt
new file mode 100644
index 0000000..4d308fb
--- /dev/null
+++ b/fdanyone/space/assets/OFL.txt
@@ -0,0 +1,93 @@
+Copyright (c) 2010-2014 by tyPoland Lukasz Dziedzic ([email protected]) with Reserved Font Name "Lato"
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/fdanyone/space/assets/delete.html b/fdanyone/space/assets/delete.html
new file mode 100644
index 0000000..a8666c3
--- /dev/null
+++ b/fdanyone/space/assets/delete.html
@@ -0,0 +1,10 @@
+<button type="button" class="delete-output" disabled>Delete Output</button>
+<dialog class="delete-dialog" aria-labelledby="delete-title" aria-describedby="delete-description">
+ <h3 id="delete-title">Delete Output?</h3>
+ <p id="delete-description">Permanently delete this task's saved settings, recovered motion and generated videos. The source video is kept. This cannot be undone.</p>
+ <code class="delete-path"></code>
+ <div class="delete-actions">
+ <button type="button" class="keep-output" autofocus>Keep Output</button>
+ <button type="button" class="confirm-delete">Delete Output</button>
+ </div>
+</dialog>
diff --git a/fdanyone/space/assets/delete.js b/fdanyone/space/assets/delete.js
new file mode 100644
index 0000000..8cf7772
--- /dev/null
+++ b/fdanyone/space/assets/delete.js
@@ -0,0 +1,17 @@
+const button = element.querySelector('.delete-output');
+const dialog = element.querySelector('dialog');
+dialog.addEventListener('keydown', event => event.stopPropagation());
+function update() {
+ dialog.close();
+ button.disabled = !props.value;
+ dialog.querySelector('.delete-path').textContent = props.value?.output || '';
+}
+button.addEventListener('click', () => dialog.showModal());
+dialog.querySelector('.keep-output').addEventListener('click', () => dialog.close());
+dialog.querySelector('.confirm-delete').addEventListener('click', () => {
+ dialog.close();
+ button.disabled = true;
+ trigger('click');
+});
+watch('value', update);
+update();
diff --git a/fdanyone/space/assets/display.css b/fdanyone/space/assets/display.css
new file mode 100644
index 0000000..f6f0cb5
--- /dev/null
+++ b/fdanyone/space/assets/display.css
@@ -0,0 +1,71 @@
+#space-viewer { width: 100%; height: 100%; min-width: 0 !important; min-height: 0 !important;
+ padding: 0 !important; border: none !important; border-radius: 0 !important; overflow: hidden; }
+#space-viewer .html-container { padding: 0 !important; height: 100% !important; }
+#space-viewer .html-container > div { height: 100%; min-height: 0; }
+.space-display { position: relative; width: 100%; height: 100%; min-height: 0; overflow: hidden;
+ display: grid; grid-template-columns: minmax(0, 1fr);
+ grid-template-rows: minmax(0, 1fr) minmax(0, var(--target-panel-height, 30%)); background: #121214; }
+.scene-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
+/* Rerun 0.37.1 draws its recording strip and view title inside the canvas.
+ Keep those 52 px above this single-scene viewport without rescaling the scene. */
+.rerun-canvas { position: relative; width: 100%; height: calc(100% + 52px); top: -52px; }
+.rerun-canvas > canvas { display: block; width: 100% !important; height: 100% !important; }
+.scene-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2;
+ display: grid; place-items: center; width: 72px; height: 72px; padding: 0; border-radius: 50%;
+ border: 1px solid #ffffff55; background: #121214b3; color: #f5f5f7; cursor: pointer; }
+.scene-play svg { width: 36px; height: 36px; fill: currentColor; pointer-events: none; }
+.scene-play:hover { background: #343437e6; }
+.scene-play:focus-visible { outline: 2px solid #3274d8; outline-offset: 3px; }
+.scene-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; z-index: 4;
+ background: #121214; color: #b5b5ba; font-size: var(--space-body-size); }
+.scene-spinner { width: 22px; height: 22px; box-sizing: border-box; border: 2px solid #343437;
+ border-top-color: #8eb4f1; border-radius: 50%; animation: scene-spin .8s linear infinite; }
+.scene-loading.failed .scene-spinner { display: none; }
+@keyframes scene-spin { to { transform: rotate(360deg); } }
+@media (prefers-reduced-motion: reduce) { .scene-spinner { animation: none; } }
+.scene-loading[hidden], .scene-play[hidden], .source-preview[hidden], .media-enlarged[hidden], .target-empty[hidden],
+.display-note[hidden] { display: none; }
+.space-display[data-ready="false"] .target-scroll { visibility: hidden; }
+.source-preview { position: absolute; bottom: 12px; right: 12px;
+ width: var(--source-tile-width, 135px); height: var(--source-tile-height, 240px); z-index: 3;
+ box-sizing: content-box; border: 1px solid #424245; border-radius: 5px; overflow: hidden; background: #121214; }
+.source-preview .media-tile { width: 100%; height: 100%; border: none; border-radius: 0; }
+.source-preview .source-title { position: absolute; top: 4px; left: 5px; padding: 2px 4px;
+ color: #f5f5f7; background: #121214d9; border-radius: 3px; font-size: var(--space-body-size); pointer-events: none; }
+.source-preview .video-enlarge { top: auto; bottom: 4px; }
+.target-panel { display: flex; flex-direction: column; min-height: 0; border-top: 1px solid #343437; }
+.media-heading { display: flex; align-items: center; justify-content: space-between;
+ height: 36px; flex: 0 0 36px; gap: 8px; padding: 0 10px; color: #f5f5f7;
+ font-size: var(--space-section-size); background: #121214; border-bottom: 1px solid #2a2a2d; }
+.target-count { font-size: var(--space-body-size); color: #8e8e93; }
+.target-panel > .media-heading { border-bottom: none; }
+.target-scroll { flex: 1; min-height: 0; overflow: auto; padding: 8px; overscroll-behavior: contain;
+ scrollbar-width: thin; scrollbar-color: #55555a #121214; scrollbar-gutter: stable; }
+.target-grid { --target-min-width: 120px;
+ display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--target-min-width)), 1fr));
+ align-items: start; gap: 6px; }
+.target-grid .media-tile { box-sizing: border-box; width: 100%; aspect-ratio: var(--video-aspect); }
+.media-tile { box-sizing: content-box; min-width: 0; position: relative; background: #09090b; border: 1px solid #343437;
+ border-radius: 4px; overflow: hidden; }
+.video-content { width: 100%; height: 100%; position: relative; min-height: 0; }
+.video-content video { display: block; width: 100%; height: 100%; object-fit: contain; }
+.source-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
+.view-number { position: absolute; top: 4px; left: 5px; font-size: var(--space-body-size); line-height: 20px;
+ color: #fff; text-shadow: none; pointer-events: none; }
+.video-enlarge { position: absolute; top: 4px; right: 4px; width: 25px; height: 25px; padding: 0;
+ border: none; border-radius: 4px; background: #121214cf; color: #f5f5f7;
+ cursor: pointer; line-height: 25px; font-size: var(--space-section-size); }
+.video-enlarge:hover { background: #38383f; }
+.video-enlarge:focus-visible, .media-back:focus-visible { outline: 2px solid #3274d8; }
+.target-empty { display: grid; place-content: center; height: 100%; font-size: var(--space-body-size); color: #8e8e93; }
+.media-enlarged { position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; background: #09090b; }
+.media-enlarged .media-heading { height: 40px; flex-basis: 40px; }
+.enlarged-content { flex: 1; min-height: 0; }
+.media-back { border: 1px solid #424245; border-radius: 999px; padding: 3px 12px;
+ background: #1d1d1f; color: #f5f5f7; cursor: pointer; font: inherit; }
+.display-note { position: absolute; left: 12px; bottom: calc(var(--target-panel-height, 30%) + 12px); max-width: calc(100% - 24px);
+ z-index: 5; padding: 7px 10px; background: #121214e8; color: #c2c2c8; font-size: var(--space-body-size);
+ border-radius: 4px; overflow-wrap: anywhere; }
+@media (max-width: 760px) {
+ .source-preview { right: 8px; bottom: 8px; }
+}
diff --git a/fdanyone/space/assets/display.js b/fdanyone/space/assets/display.js
new file mode 100644
index 0000000..25235cc
--- /dev/null
+++ b/fdanyone/space/assets/display.js
@@ -0,0 +1,79 @@
+// Gradio boundary: replace recordings, serialize camera deltas and own teardown.
+const root = element.querySelector('.space-display');
+const loading = root.querySelector('.scene-loading');
+const note = root.querySelector('.display-note');
+const modules = Promise.all(['scene', 'media'].map(key => import(new URL(props.assets[key], document.baseURI).href)));
+let scene, media, revision = 0, disposed = false;
+let abort = new AbortController(), queue = Promise.resolve();
+
+function showNote(message) {
+ note.textContent = message || '';
+ note.hidden = !message;
+}
+function setLoading(message = 'Loading Scene', failed = false) {
+ loading.querySelector('.scene-loading-text').textContent = message;
+ loading.classList.toggle('failed', failed);
+ loading.setAttribute('aria-busy', String(!failed));
+ loading.hidden = false;
+ root.querySelector('.scene-play').hidden = true;
+ root.dataset.ready = 'false';
+}
+function clear() {
+ media?.dispose(); scene?.dispose();
+ media = scene = null;
+}
+async function load(data, token, signal) {
+ if (token !== revision || disposed) return;
+ if (data?.layout_only) {
+ if (!scene) throw new Error('Reload The Page To Restore The Camera Preview');
+ await scene.append(data, signal);
+ root.dataset.cameraCount = String(data.camera_count);
+ return;
+ }
+ clear();
+ if (!data) { setLoading('Preparing Preview'); return; }
+ const [{openScene}, {createMediaView}] = await modules;
+ signal.throwIfAborted();
+ showNote(data.notes.join(' '));
+ media = createMediaView(root, data, showNote);
+ const overlay = media.loadOverlay(signal).catch(error => {
+ if (!signal.aborted) showNote(`Source Overlay Unavailable: ${error.message}`);
+ });
+ scene = await openScene(root.querySelector('.rerun-canvas'), props.assets.wasm, data, signal);
+ if (token !== revision || disposed) { clear(); return; }
+ await media.connect(scene, signal);
+ if (token !== revision || disposed) { clear(); return; }
+ root.dataset.cameraCount = String(data.camera_count);
+ root.dataset.recording = data.recording_id;
+ root.dataset.ready = 'true';
+ loading.hidden = true;
+ await overlay;
+}
+function update() {
+ const data = props.value;
+ // Camera edits retain the current recording; a new scene cancels old work.
+ if (!data?.layout_only) {
+ revision++;
+ abort.abort(); abort = new AbortController();
+ setLoading();
+ }
+ const token = revision, signal = abort.signal;
+ queue = queue.catch(() => {}).then(() => load(data, token, signal)).catch(error => {
+ if (signal.aborted || token !== revision || disposed) return;
+ clear();
+ console.error('4DAnyone display:', error);
+ setLoading('Cannot Open Scene', true); showNote(error.message);
+ });
+}
+function dispose() {
+ if (disposed) return;
+ disposed = true; revision++;
+ abort.abort(); removal.disconnect();
+ clear();
+ window.removeEventListener('pagehide', dispose);
+}
+const removal = new MutationObserver(() => { if (!root.isConnected) dispose(); });
+removal.observe(document.body, {childList: true, subtree: true});
+window.addEventListener('pagehide', dispose);
+watch('value', update);
+update();
diff --git a/fdanyone/space/assets/fonts.css b/fdanyone/space/assets/fonts.css
new file mode 100644
index 0000000..253b960
--- /dev/null
+++ b/fdanyone/space/assets/fonts.css
@@ -0,0 +1,43 @@
+@font-face {
+ font-family: "Lato";
+ font-style: normal;
+ font-weight: 400;
+ font-display: swap;
+ src: url("../fonts/lato-latin-400-normal.woff2") format("woff2");
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
+ U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
+ U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: "Lato";
+ font-style: normal;
+ font-weight: 700;
+ font-display: swap;
+ src: url("../fonts/lato-latin-700-normal.woff2") format("woff2");
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
+ U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
+ U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: "Lato";
+ font-style: normal;
+ font-weight: 400;
+ font-display: swap;
+ src: url("../fonts/lato-latin-ext-400-normal.woff2") format("woff2");
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
+ U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
+ U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
+}
+
+@font-face {
+ font-family: "Lato";
+ font-style: normal;
+ font-weight: 700;
+ font-display: swap;
+ src: url("../fonts/lato-latin-ext-700-normal.woff2") format("woff2");
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
+ U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
+ U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
+}
diff --git a/fdanyone/space/assets/frame_scheduler.js b/fdanyone/space/assets/frame_scheduler.js
new file mode 100644
index 0000000..ec3079f
--- /dev/null
+++ b/fdanyone/space/assets/frame_scheduler.js
@@ -0,0 +1,107 @@
+// One Rerun instance, one pending browser frame. Eframe's recursive rAF request
+// stays queued while idle; input, new data and decoded frames wake it explicitly.
+export function createFrameScheduler(fps) {
+ const callbacks = new Map();
+ const observers = new Set();
+ let nextId = 0, timer = null, frame = null, disposed = false;
+ let loading = true, playing = false, visible = true;
+ let awakeUntil = 0, interactiveUntil = 0;
+ let deadline = 0, lastFrame = -Infinity, interval = 0;
+
+ function cancelPending() {
+ if (timer !== null) clearTimeout(timer);
+ if (frame !== null) cancelAnimationFrame(frame);
+ timer = frame = null;
+ }
+ function active(now) {
+ return visible && (loading || playing || now < awakeUntil);
+ }
+ function schedule() {
+ if (disposed || !callbacks.size) return;
+ const now = performance.now();
+ if (!active(now)) { cancelPending(); return; }
+ const period = 1000 / (loading || now < interactiveUntil ? Math.max(60, fps) : fps);
+ if (period !== interval) {
+ interval = period;
+ deadline = lastFrame + period;
+ cancelPending();
+ }
+ if (timer !== null || frame !== null) return;
+ const enqueue = () => {
+ timer = null;
+ frame = requestAnimationFrame(draw);
+ };
+ // Queue rAF slightly early: browser timers may be coalesced with vsync,
+ // and requesting at the deadline can otherwise miss an entire video frame.
+ const delay = deadline - now - Math.min(1000 / 60, interval / 2);
+ if (delay > 0) timer = setTimeout(enqueue, delay);
+ else enqueue();
+ }
+ function draw(now) {
+ frame = null;
+ if (disposed || !active(now)) return;
+ lastFrame = now;
+ // Keep the cadence when the display rate is not a multiple of the video
+ // rate. Skip missed slots after a stall instead of drawing catch-up frames.
+ deadline = now - deadline >= interval ? now + interval : deadline + interval;
+ const batch = [...callbacks.keys()];
+ for (const id of batch) {
+ const callback = callbacks.get(id);
+ callbacks.delete(id);
+ callback?.(now);
+ }
+ for (const callback of observers) callback(now);
+ schedule();
+ }
+ function invalidate() {
+ if (disposed) return;
+ awakeUntil = performance.now() + 1000;
+ schedule();
+ }
+ return {
+ request(callback) {
+ if (disposed) return 0;
+ const id = ++nextId;
+ callbacks.set(id, callback);
+ schedule();
+ return id;
+ },
+ cancel(id) {
+ callbacks.delete(id);
+ if (!callbacks.size) cancelPending();
+ },
+ invalidate,
+ onFrame(callback) {
+ observers.add(callback);
+ return () => observers.delete(callback);
+ },
+ alignTime(seconds) {
+ if (!playing || performance.now() < interactiveUntil || !Number.isFinite(seconds)) return;
+ // Present near the middle of the next video frame, not its boundary.
+ // Display/vsync jitter would otherwise repeat one frame and skip the next.
+ deadline = lastFrame + ((Math.floor(seconds * fps) + 1.5) / fps - seconds) * 1000;
+ cancelPending();
+ schedule();
+ },
+ interact() {
+ interactiveUntil = performance.now() + 250;
+ invalidate();
+ },
+ setPlaying(value) {
+ loading = false;
+ playing = value;
+ invalidate();
+ },
+ setVisible(value) {
+ visible = value;
+ if (visible) invalidate();
+ else cancelPending();
+ },
+ dispose() {
+ disposed = true;
+ cancelPending();
+ callbacks.clear();
+ observers.clear();
+ }
+ };
+}
diff --git a/fdanyone/space/assets/help.js b/fdanyone/space/assets/help.js
new file mode 100644
index 0000000..d9242d3
--- /dev/null
+++ b/fdanyone/space/assets/help.js
@@ -0,0 +1,41 @@
+const sidebar = element.closest('#space-sidebar');
+sidebar.addEventListener('beforetoggle', event => {
+ const card = event.target;
+ if (!card.matches('.option-help') || event.newState !== 'open') return;
+ const anchor = sidebar.querySelector(`.help-button[popovertarget="${card.id}"]`);
+ const box = anchor.getBoundingClientRect();
+ const width = Math.min(320, window.innerWidth - 24);
+ card.style.visibility = 'hidden';
+ card.style.width = `${width}px`;
+ card.style.left = `${Math.max(12, Math.min(box.left - width - 12, window.innerWidth - width - 12))}px`;
+ card.style.top = `${Math.max(12, box.top)}px`;
+}, true);
+sidebar.addEventListener('toggle', event => {
+ const card = event.target;
+ if (!card.matches('.option-help')) return;
+ const anchor = sidebar.querySelector(`.help-button[popovertarget="${card.id}"]`);
+ anchor?.setAttribute('aria-expanded', String(event.newState === 'open'));
+ if (event.newState === 'open') {
+ const box = card.getBoundingClientRect();
+ card.style.top = `${Math.max(12, Math.min(box.top, window.innerHeight - box.height - 12))}px`;
+ card.style.visibility = 'visible';
+ }
+}, true);
+sidebar.addEventListener('keydown', event => {
+ const card = sidebar.querySelector('.option-help:popover-open');
+ if (!card) return;
+ // Description shortcuts must not reach the scene's keyboard controls.
+ event.stopPropagation();
+ if (event.key === 'Escape') {
+ event.preventDefault();
+ card.hidePopover();
+ sidebar.querySelector(`.help-button[popovertarget="${card.id}"]`)?.focus();
+ }
+});
+for (const type of ['wheel', 'touchmove']) {
+ sidebar.addEventListener(type, event => {
+ if (!event.target.closest('.option-help')) {
+ sidebar.querySelector('.option-help:popover-open')?.hidePopover();
+ }
+ }, {capture: true, passive: true});
+}
diff --git a/fdanyone/space/assets/lato-latin-400-normal.woff2 b/fdanyone/space/assets/lato-latin-400-normal.woff2
new file mode 100644
index 0000000..56e968d
Binary files /dev/null and b/fdanyone/space/assets/lato-latin-400-normal.woff2 differ
diff --git a/fdanyone/space/assets/lato-latin-700-normal.woff2 b/fdanyone/space/assets/lato-latin-700-normal.woff2
new file mode 100644
index 0000000..95c63e0
Binary files /dev/null and b/fdanyone/space/assets/lato-latin-700-normal.woff2 differ
diff --git a/fdanyone/space/assets/lato-latin-ext-400-normal.woff2 b/fdanyone/space/assets/lato-latin-ext-400-normal.woff2
new file mode 100644
index 0000000..bb52c72
Binary files /dev/null and b/fdanyone/space/assets/lato-latin-ext-400-normal.woff2 differ
diff --git a/fdanyone/space/assets/lato-latin-ext-700-normal.woff2 b/fdanyone/space/assets/lato-latin-ext-700-normal.woff2
new file mode 100644
index 0000000..9fd071a
Binary files /dev/null and b/fdanyone/space/assets/lato-latin-ext-700-normal.woff2 differ
diff --git a/fdanyone/space/assets/media.js b/fdanyone/space/assets/media.js
new file mode 100644
index 0000000..50e0d1f
--- /dev/null
+++ b/fdanyone/space/assets/media.js
@@ -0,0 +1,313 @@
+import {createOverlay} from './overlay.js';
+import {createVideoCache} from './video_cache.js';
+import {createVideoPlayback} from './video_playback.js';
+
+export function createMediaView(root, data, showNote) {
+ const sourceHost = root.querySelector('.source-preview');
+ const grid = root.querySelector('.target-grid');
+ const scroller = root.querySelector('.target-scroll');
+ const enlarged = root.querySelector('.media-enlarged');
+ const playButton = root.querySelector('.scene-play');
+ const listeners = new AbortController();
+ const events = {signal: listeners.signal};
+ const cache = createVideoCache();
+ const media = [];
+ const period = Math.max(1 / data.fps, (data.frames - 1) / data.fps);
+ let source, overlay, scene, stopFrames, disposed = false, connected = false;
+ let tickHandle = null, viewportHandle = null, maximized = null, enlargedPlayback = null;
+
+ function requestTick() {
+ if (!disposed && tickHandle === null) tickHandle = requestAnimationFrame(tick);
+ }
+ function requestViewport() {
+ if (!disposed && viewportHandle === null) viewportHandle = requestAnimationFrame(updateViewport);
+ }
+ function releaseVideo(item) {
+ clearTimeout(item.releaseTimer);
+ item.releaseTimer = null;
+ item.onLoaded?.(false);
+ item.onLoaded = null;
+ const lease = item.lease;
+ item.lease = null;
+ item.preparing = null;
+ item.playback.pause();
+ item.playback.reset();
+ item.video.removeAttribute('src');
+ item.video.load();
+ lease?.release();
+ item.presentedTime = null;
+ }
+ function prepareVideo(item) {
+ clearTimeout(item.releaseTimer);
+ item.releaseTimer = null;
+ if (item.preparing) return item.preparing;
+ const lease = item.lease = cache.acquire(item.url);
+ item.preparing = (async () => {
+ const url = await lease.ready;
+ if (disposed || item.lease !== lease) return false;
+ const decoded = new Promise(resolve => { item.onLoaded = resolve; });
+ item.video.src = url;
+ item.video.load();
+ return await decoded;
+ })().catch(error => {
+ if (!disposed && item.lease === lease && error.name !== 'AbortError') showNote(`Cannot Play ${item.id}: ${error.message}`);
+ return false;
+ });
+ return item.preparing;
+ }
+ function masterTime() {
+ if (maximized) return enlargedPlayback.ready ? maximized.video.currentTime : enlargedPlayback.time;
+ return scene?.time ?? 0;
+ }
+ function isPlaying() { return maximized ? enlargedPlayback.playing : !!scene?.playing; }
+ function togglePlayback() {
+ if (root.dataset.ready !== 'true') return;
+ const playing = !isPlaying();
+ if (maximized) enlargedPlayback.playing = playing;
+ else scene.playing = playing;
+ if (!playing) for (const item of media) item.playback.pause();
+ requestTick();
+ }
+ playButton.addEventListener('click', event => {
+ event.stopPropagation();
+ scene.playing = true;
+ scene.focus();
+ requestTick();
+ }, events);
+
+ function updateViewport() {
+ cancelAnimationFrame(viewportHandle);
+ viewportHandle = null;
+ if (disposed) return;
+ const bounds = scroller.getBoundingClientRect();
+ const nearby = [];
+ for (const item of media) {
+ if (item === source) continue;
+ const tile = item.tile.getBoundingClientRect();
+ const overlap = Math.min(tile.bottom, bounds.bottom) - Math.max(tile.top, bounds.top);
+ const visible = overlap > Math.min(24, tile.height * 0.1);
+ const center = (tile.top + tile.bottom) / 2;
+ const near = center > bounds.top - bounds.height && center < bounds.bottom + bounds.height;
+ if (near) nearby.push(item.url);
+ if (visible) {
+ if (!item.visible) item.playback.reset();
+ prepareVideo(item);
+ } else if (item !== maximized) {
+ item.playback.pause();
+ if (!near && item.lease) releaseVideo(item);
+ else if (item.lease && item.releaseTimer === null) {
+ // Retain a just-hidden decoder briefly for quick scroll reversals.
+ item.releaseTimer = setTimeout(() => {
+ if (!item.visible && item !== maximized) releaseVideo(item);
+ }, 1500);
+ }
+ }
+ item.visible = visible;
+ }
+ // Offscreen clips must not compete with the initial scene download.
+ if (connected) cache.prefetch(nearby);
+ requestTick();
+ }
+ scroller.addEventListener('scroll', requestViewport, {...events, passive: true});
+ function resizeMedia() {
+ const style = getComputedStyle(grid);
+ const gap = parseFloat(style.columnGap);
+ const minimum = parseFloat(style.getPropertyValue('--target-min-width'));
+ const columns = style.gridTemplateColumns.split(' ').filter(size => parseFloat(size) > 0).length
+ || Math.max(1, Math.floor((grid.clientWidth + gap) / (minimum + gap)));
+ const width = Math.max(1, (grid.clientWidth - (columns - 1) * gap) / columns - 2);
+ const aspect = data.targets.length ? Math.max(...data.targets.map(video => video.width / video.height)) : 0.55;
+ const height = width / aspect;
+ root.style.setProperty('--target-panel-height', `${Math.min(Math.max(180, height + 54), root.clientHeight * 0.55)}px`);
+ root.dataset.targetColumns = String(columns);
+ const sourceAspect = source?.aspect || 9 / 16;
+ const stage = root.querySelector('.scene-stage');
+ const sourceHeight = Math.max(1, Math.min(height, stage.clientHeight - 26, (stage.clientWidth * 0.4 - 2) / sourceAspect));
+ root.style.setProperty('--source-tile-width', `${sourceHeight * sourceAspect}px`);
+ root.style.setProperty('--source-tile-height', `${sourceHeight}px`);
+ requestViewport();
+ }
+ const sizes = new ResizeObserver(resizeMedia);
+ sizes.observe(scroller);
+ sizes.observe(grid);
+ sizes.observe(root.querySelector('.scene-stage'));
+
+ function maximize(item) {
+ restore();
+ enlargedPlayback = {time: masterTime(), playing: isPlaying(), ready: false};
+ maximized = item;
+ playButton.hidden = true;
+ scene.playing = false;
+ for (const other of media) other.playback.pause();
+ item.playback.reset();
+ prepareVideo(item);
+ item.placeholder = document.createComment('video-position');
+ item.content.before(item.placeholder);
+ enlarged.querySelector('.enlarged-content').append(item.content);
+ enlarged.querySelector('.enlarged-title').textContent = item === source ? 'Source Video' : `View ${item.id}`;
+ enlarged.hidden = false;
+ enlarged.querySelector('.media-back').focus();
+ requestTick();
+ }
+ function restore() {
+ if (!maximized) return;
+ const seconds = masterTime(), playing = isPlaying();
+ const item = maximized;
+ item.placeholder.replaceWith(item.content);
+ maximized = null;
+ enlargedPlayback = null;
+ enlarged.hidden = true;
+ scene.time = Math.min(seconds, period);
+ scene.playing = playing;
+ for (const video of media) video.playback.reset();
+ item.button.focus({preventScroll: true});
+ requestViewport();
+ requestTick();
+ }
+ enlarged.querySelector('.media-back').addEventListener('click', restore, events);
+ root.addEventListener('keydown', event => {
+ if (event.code === 'Space' && !event.isComposing
+ && !event.target.closest('input, textarea, select, [contenteditable="true"]')) {
+ event.preventDefault();
+ event.stopPropagation();
+ if (!event.repeat) togglePlayback();
+ }
+ if (event.key === 'Escape' && maximized) {
+ event.preventDefault();
+ event.stopPropagation();
+ restore();
+ }
+ }, {...events, capture: true});
+ sourceHost.addEventListener('wheel', event => event.stopPropagation(), events);
+ sourceHost.addEventListener('pointerdown', event => event.stopPropagation(), events);
+
+ function createVideo(description, isSource = false) {
+ const tile = document.createElement('div');
+ tile.className = 'media-tile';
+ const aspect = description.width / description.height;
+ tile.style.setProperty('--video-aspect', aspect);
+ const content = document.createElement('div');
+ content.className = 'video-content';
+ const video = document.createElement('video');
+ video.muted = true;
+ video.playsInline = true;
+ video.loop = true;
+ video.preload = 'auto';
+ video.disablePictureInPicture = true;
+ video.disableRemotePlayback = true;
+ video.setAttribute('aria-label', isSource ? 'Source Video' : `Target View ${description.id}`);
+ content.append(video);
+ const id = isSource ? 'Source Video' : String(description.id).padStart(2, '0');
+ const title = document.createElement('span');
+ title.className = isSource ? 'source-title' : 'view-number';
+ title.textContent = id;
+ const button = document.createElement('button');
+ button.className = 'video-enlarge';
+ button.type = 'button';
+ button.textContent = '↗';
+ button.setAttribute('aria-label', isSource ? 'Enlarge Source Video' : `Enlarge View ${id}`);
+ tile.append(content, title, button);
+ const playback = createVideoPlayback(video, data.fps, period);
+ const item = {tile, content, video, playback, button, id, aspect, url: description.url,
+ visible: isSource, lease: null, preparing: null, onLoaded: null, releaseTimer: null};
+ button.addEventListener('click', () => maximize(item), events);
+ video.addEventListener('loadeddata', () => {
+ item.onLoaded?.(true);
+ item.onLoaded = null;
+ requestTick();
+ }, events);
+ video.addEventListener('error', () => {
+ item.onLoaded?.(false);
+ item.onLoaded = null;
+ if (item.lease) showNote(`Cannot Play ${id}`);
+ }, events);
+ if (isSource && data.overlay) {
+ const onFrame = (_, metadata) => {
+ item.presentedTime = metadata.mediaTime;
+ if (overlay && (!maximized || maximized === source)) overlay.draw(metadata.mediaTime);
+ if (!disposed) item.frameCallback = video.requestVideoFrameCallback(onFrame);
+ };
+ item.frameCallback = video.requestVideoFrameCallback(onFrame);
+ }
+ for (const name of ['timeupdate', 'seeked']) video.addEventListener(name, requestTick, events);
+ media.push(item);
+ if (isSource) {
+ sourceHost.append(tile);
+ sourceHost.hidden = false;
+ } else grid.append(tile);
+ return item;
+ }
+
+ document.addEventListener('visibilitychange', () => {
+ for (const item of media) {
+ if (document.hidden) item.playback.pause();
+ else item.playback.reset();
+ }
+ requestTick();
+ }, events);
+ if (data.source) {
+ source = createVideo(data.source, true);
+ prepareVideo(source);
+ }
+ for (const target of data.targets) createVideo(target);
+ resizeMedia();
+ updateViewport();
+ root.querySelector('.target-count').textContent = data.targets.length ? `${data.targets.length} Views` : '';
+ root.querySelector('.target-empty').hidden = !!data.targets.length;
+
+ function tick() {
+ tickHandle = null;
+ if (disposed) return;
+ const seconds = masterTime(), playing = isPlaying() && !document.hidden;
+ const hidePlay = playing || !!maximized || document.hidden || root.dataset.ready !== 'true';
+ if (playButton.hidden !== hidePlay) playButton.hidden = hidePlay;
+ root.dataset.time = seconds.toFixed(4);
+ for (const item of media) {
+ const visible = !document.hidden && (item === maximized || (!maximized && item.visible));
+ if (!visible) { item.playback.pause(); continue; }
+ if (!item.video.getAttribute('src')) continue;
+ const clock = item === maximized && enlargedPlayback.ready ? null : seconds;
+ const ready = item.playback.sync(clock, playing);
+ if (ready && item === maximized) enlargedPlayback.ready = true;
+ }
+ if (overlay && source && (!maximized || maximized === source)) overlay.draw(source.presentedTime ?? source.video.currentTime);
+ }
+
+ return {
+ async connect(viewer, signal) {
+ scene = viewer;
+ stopFrames = scene.onFrame(requestTick);
+ updateViewport();
+ await Promise.all(media.filter(item => item.visible).map(prepareVideo));
+ signal.throwIfAborted();
+ connected = true;
+ scene.playing = true;
+ updateViewport();
+ requestTick();
+ },
+ async loadOverlay(signal) {
+ if (data.overlay && source) overlay = await createOverlay(source.content, data.overlay, data.fps, signal);
+ requestTick();
+ },
+ dispose() {
+ if (disposed) return;
+ disposed = true;
+ stopFrames?.();
+ cancelAnimationFrame(tickHandle);
+ cancelAnimationFrame(viewportHandle);
+ listeners.abort();
+ sizes.disconnect();
+ for (const item of media) {
+ if (item.frameCallback) item.video.cancelVideoFrameCallback(item.frameCallback);
+ releaseVideo(item);
+ }
+ cache.dispose();
+ overlay?.dispose();
+ sourceHost.replaceChildren();
+ sourceHost.hidden = true;
+ grid.replaceChildren();
+ enlarged.querySelector('.enlarged-content').replaceChildren();
+ enlarged.hidden = true;
+ }
+ };
+}
diff --git a/fdanyone/space/assets/media_cache.js b/fdanyone/space/assets/media_cache.js
new file mode 100644
index 0000000..e738f7d
--- /dev/null
+++ b/fdanyone/space/assets/media_cache.js
@@ -0,0 +1,54 @@
+// Large RRD/WASM files exceed some browsers' normal HTTP cache entry limits.
+// Keep a bounded, per-origin cache; URL revisions identify immutable previews.
+const CACHE_NAME = '4danyone-space-media-v1';
+const MAX_BYTES = 256 * 1024 * 1024;
+const VIDEO_CACHE_NAME = '4danyone-space-videos-v1';
+const VIDEO_MAX_BYTES = 128 * 1024 * 1024;
+let pruning = Promise.resolve();
+
+export async function fetchBytes(url, signal) {
+ const response = await fetchCached(url, {signal});
+ if (!response.ok) throw new Error(`Cannot Load Media (${response.status})`);
+ return response.arrayBuffer();
+}
+
+async function trim(cache, maximum) {
+ const keys = await cache.keys();
+ const runtime = [...keys].reverse().find(key => new URL(key.url).pathname.endsWith('.wasm'))?.url;
+ const sizes = await Promise.all(keys.map(async key => Number((await cache.match(key))?.headers.get('content-length')) || 0));
+ let total = sizes.reduce((sum, bytes) => sum + bytes, 0);
+ for (let index = 0; total > maximum && index < keys.length; index++) {
+ // Retain the shared runtime when replacing older scene previews.
+ if (keys[index].url === runtime) continue;
+ await cache.delete(keys[index]);
+ total -= sizes[index];
+ }
+}
+
+export async function fetchCached(url, options = {}) {
+ options.signal?.throwIfAborted();
+ const address = new URL(url, document.baseURI).href;
+ const video = new URL(address).pathname.endsWith('.mp4');
+ const maximum = video ? VIDEO_MAX_BYTES : MAX_BYTES;
+ let cache;
+ try {
+ cache = await globalThis.caches?.open(video ? VIDEO_CACHE_NAME : CACHE_NAME);
+ const hit = await cache?.match(address);
+ options.signal?.throwIfAborted();
+ if (hit) return hit;
+ } catch (error) {
+ if (options.signal?.aborted) throw error;
+ // Storage restrictions must not prevent playback.
+ }
+ const response = await fetch(address, options);
+ const size = Number(response.headers.get('content-length'));
+ if (cache && response.status === 200 && size > 0 && size <= maximum) {
+ // Read the network response and store its clone concurrently, so WASM
+ // compilation can still stream while the download is in progress.
+ cache.put(address, response.clone()).then(() => {
+ pruning = pruning.catch(() => {}).then(() => trim(cache, maximum));
+ return pruning;
+ }).catch(() => {});
+ }
+ return response;
+}
diff --git a/fdanyone/space/assets/monitor.css b/fdanyone/space/assets/monitor.css
new file mode 100644
index 0000000..e285bed
--- /dev/null
+++ b/fdanyone/space/assets/monitor.css
@@ -0,0 +1,50 @@
+#run-monitor { padding: 0 !important; margin: 0 !important; min-width: 0; }
+#run-monitor .html-container { padding: 0 !important; }
+#run-monitor:has(.run-monitor[hidden]), .run-monitor[hidden], .console-follow[hidden] { display: none !important; }
+.run-monitor { min-width: 0; }
+.run-stages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
+.run-stage { display: flex; flex-direction: column; }
+.stage-label { display: flex; align-items: flex-start; gap: 5px; font-size: var(--space-body-size); font-weight: 700;
+ flex: 1; line-height: 24px; white-space: normal; color: #8e8e93; }
+.stage-icon { width: 15px; flex: 0 0 15px; font-size: var(--space-body-size); text-align: center; color: #8e8e93; }
+.stage-track { position: relative; overflow: hidden; flex: 0 0 6px; margin-top: 7px;
+ background: #343437; border-radius: 4px; }
+.stage-fill { height: 100%; width: 0; background: #3274d8; transition: width .25s ease; }
+.run-stage:is([data-state="starting"], [data-state="queued"], [data-state="running"]) .stage-label { color: #f5f5f7; }
+.run-stage:is([data-state="starting"], [data-state="queued"], [data-state="running"]) .stage-track::after {
+ content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, #9ebfeb66, transparent);
+ transform: translateX(-100%); animation: run-progress-sweep 1.8s linear infinite; }
+.run-stage[data-state="complete"] .stage-icon { color: #52bbb1; }
+.run-stage[data-state="complete"] .stage-fill { background: #52bbb1; }
+.run-stage[data-state="failed"] .stage-fill { background: #e57373; }
+.run-stage[data-state="failed"] .stage-icon { color: #e57373; }
+.run-stage[data-state="cancelled"] .stage-fill { background: #8e8e93; }
+.run-detail { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0 10px;
+ line-height: 24px; font-size: var(--space-body-size); color: #b5b5ba; }
+.run-step { flex: 1; min-width: 0; overflow-wrap: anywhere; max-height: 72px; overflow: auto; }
+.run-elapsed { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: #8e8e93; }
+.run-console { min-width: 0; border: 1px solid #343437; border-radius: 6px; overflow: hidden; background: #101012; }
+.console-heading { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px;
+ background: #1d1d1f; border-bottom: 1px solid #343437; }
+.console-heading button { padding: 0; border: none; border-radius: 0; background: transparent;
+ color: #f5f5f7; font: inherit; font-size: var(--space-body-size); cursor: pointer; white-space: nowrap; }
+.console-toggle { display: flex; align-items: center; gap: 6px; font-weight: 700 !important; font-size: var(--space-section-size) !important; }
+.console-toggle span { color: #8e8e93; }
+.console-heading .console-follow { color: #8eb4f1; }
+.console-heading button:focus-visible, .console-log:focus-visible { outline: 2px solid #3274d8; outline-offset: -2px; }
+.console-run { flex: 1; min-width: 0; font-size: var(--space-body-size); color: #8e8e93; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.run-console .console-log { box-sizing: border-box; height: clamp(120px, 22dvh, 220px); margin: 0 !important;
+ padding: 8px; background: #101012; color: #d8d8dc; border: none; border-radius: 0;
+ font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
+ white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; overscroll-behavior: contain;
+ scrollbar-width: thin; scrollbar-color: #55555a transparent; }
+.run-console[data-expanded="false"] .console-log { display: none; }
+.run-console[data-expanded="false"] .console-heading { border-bottom: none; }
+@keyframes run-progress-sweep { to { transform: translateX(100%); } }
+@media (prefers-reduced-motion: reduce) {
+ .stage-track::after { animation: none !important; }
+ .stage-fill { transition: none; }
+}
+@media (min-width: 761px) and (max-height: 700px) {
+ .run-console .console-log { height: 110px; }
+}
diff --git a/fdanyone/space/assets/monitor.js b/fdanyone/space/assets/monitor.js
new file mode 100644
index 0000000..8eab3d3
--- /dev/null
+++ b/fdanyone/space/assets/monitor.js
@@ -0,0 +1,83 @@
+const root = element.querySelector('.run-monitor');
+const stages = [...root.querySelectorAll('.run-stage')];
+const detail = root.querySelector('.run-step');
+const elapsed = root.querySelector('.run-elapsed');
+const consolePanel = root.querySelector('.run-console');
+const log = root.querySelector('.console-log');
+const toggle = root.querySelector('.console-toggle');
+const followButton = root.querySelector('.console-follow');
+const runName = root.querySelector('.console-run');
+let token, follow = true, expanded = true, latest = '', drawn = '', placeholder = '';
+
+function drawLog() {
+ const text = latest || placeholder;
+ if (!follow || !expanded || text === drawn) return;
+ log.textContent = text;
+ drawn = text;
+ log.scrollTop = log.scrollHeight;
+}
+function setExpanded(value) {
+ expanded = value;
+ consolePanel.dataset.expanded = String(value);
+ toggle.setAttribute('aria-expanded', String(value));
+ toggle.querySelector('span').textContent = value ? '▾' : '▸';
+ if (value) drawLog();
+}
+toggle.addEventListener('click', () => setExpanded(!expanded));
+log.addEventListener('scroll', () => {
+ if (!expanded) return;
+ follow = log.scrollHeight - log.scrollTop - log.clientHeight < 24;
+ followButton.hidden = follow;
+ if (follow) drawLog();
+});
+followButton.addEventListener('click', () => {
+ follow = true;
+ followButton.hidden = true;
+ drawLog();
+ log.scrollTop = log.scrollHeight;
+});
+
+function render() {
+ const value = props.value;
+ root.hidden = !value;
+ if (!value) {
+ token = undefined;
+ latest = drawn = '';
+ return;
+ }
+ const active = ['starting', 'queued', 'running'].includes(value.state);
+ placeholder = active ? 'Waiting For Console Output…' : 'No Console Output';
+ if (token !== value.token) {
+ const submitting = token === 'preparing' && active;
+ token = value.token;
+ latest = '';
+ follow = true;
+ drawn = null;
+ followButton.hidden = true;
+ if (!submitting) setExpanded(active);
+ }
+ root.dataset.state = value.state;
+ stages.forEach((stage, index) => {
+ const done = index < value.stage || value.state === 'complete';
+ const current = index === value.stage && !done;
+ stage.dataset.state = done ? 'complete' : current ? value.state : 'pending';
+ stage.querySelector('.stage-icon').textContent = done ? '✓' : value.state === 'failed' && current ? '!' : String(index + 1);
+ stage.querySelector('.stage-fill').style.width = `${Math.round(value.progress[index] * 100)}%`;
+ const bar = stage.querySelector('[role="progressbar"]');
+ bar.setAttribute('aria-valuenow', String(Math.round(value.progress[index] * 100)));
+ bar.setAttribute('aria-valuetext', done ? 'Complete' : current ? value.detail : 'Waiting');
+ });
+ detail.textContent = value.detail;
+ if (value.elapsed == null) elapsed.textContent = '';
+ else {
+ const seconds = Math.floor(value.elapsed);
+ elapsed.textContent = `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, '0')}`;
+ }
+ elapsed.title = 'Elapsed Time';
+ runName.textContent = value.name;
+ runName.title = value.name ? `Run ${value.name}` : '';
+ if (typeof value.log === 'string') latest = value.log;
+ drawLog();
+}
+watch('value', render);
+render();
diff --git a/fdanyone/space/assets/overlay.js b/fdanyone/space/assets/overlay.js
new file mode 100644
index 0000000..a178065
--- /dev/null
+++ b/fdanyone/space/assets/overlay.js
@@ -0,0 +1,118 @@
+import {fetchBytes} from './media_cache.js';
+
+export async function createOverlay(content, description, fps, signal) {
+ const buffers = await Promise.all(['vertices', 'faces', 'keypoints'].map(key => fetchBytes(description[key], signal)));
+ signal.throwIfAborted();
+ const vertices = new Float32Array(buffers[0]);
+ const faces = new Uint32Array(buffers[1]);
+ const points = new Float32Array(buffers[2]);
+ const meshCanvas = document.createElement('canvas');
+ const skeletonCanvas = document.createElement('canvas');
+ meshCanvas.className = skeletonCanvas.className = 'source-overlay';
+ meshCanvas.setAttribute('aria-label', 'Recovered SMPL-X Mesh');
+ skeletonCanvas.setAttribute('aria-label', 'Recovered Skeleton');
+ content.append(meshCanvas, skeletonCanvas);
+ const gl = meshCanvas.getContext('webgl2', {alpha: true, antialias: true, premultipliedAlpha: false});
+ try {
+ if (!gl) throw new Error('Source Overlay Requires WebGL 2');
+ const ctx = skeletonCanvas.getContext('2d');
+ const shader = (type, code) => {
+ const result = gl.createShader(type);
+ gl.shaderSource(result, code);
+ gl.compileShader(result);
+ if (!gl.getShaderParameter(result, gl.COMPILE_STATUS)) throw new Error(gl.getShaderInfoLog(result));
+ return result;
+ };
+ const vertex = shader(gl.VERTEX_SHADER, `#version 300 es
+ in vec3 position;
+ uniform vec4 calibration;
+ uniform vec2 resolution;
+ uniform vec2 fit;
+ out vec3 cameraPosition;
+ void main() {
+ float z = position.z;
+ vec2 pixel = position.xy * calibration.xy + calibration.zw * z;
+ vec2 clip = (2.0 * pixel / resolution - vec2(z));
+ gl_Position = vec4(clip * vec2(1.0, -1.0) * fit, 1.0002 * z - 0.020002, z);
+ cameraPosition = position;
+ }`);
+ const fragment = shader(gl.FRAGMENT_SHADER, `#version 300 es
+ precision highp float;
+ in vec3 cameraPosition;
+ uniform vec3 color;
+ out vec4 outputColor;
+ void main() {
+ vec3 normal = normalize(cross(dFdx(cameraPosition), dFdy(cameraPosition)));
+ float light = 0.65 + 0.35 * abs(dot(normal, normalize(vec3(0.2, -0.4, -1.0))));
+ outputColor = vec4(color * light, 0.34);
+ }`);
+ const program = gl.createProgram();
+ gl.attachShader(program, vertex); gl.attachShader(program, fragment); gl.linkProgram(program);
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS)) throw new Error(gl.getProgramInfoLog(program));
+ const vertexBuffer = gl.createBuffer(), faceBuffer = gl.createBuffer();
+ gl.useProgram(program);
+ gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
+ gl.bufferData(gl.ARRAY_BUFFER, description.vertex_count * 3 * 4, gl.DYNAMIC_DRAW);
+ const position = gl.getAttribLocation(program, 'position');
+ gl.enableVertexAttribArray(position); gl.vertexAttribPointer(position, 3, gl.FLOAT, false, 0, 0);
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, faceBuffer); gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, faces, gl.STATIC_DRAW);
+ const uniforms = Object.fromEntries(['calibration', 'resolution', 'fit', 'color'].map(key => [key, gl.getUniformLocation(program, key)]));
+ gl.uniform3fv(uniforms.color, description.color.map(value => value / 255));
+ gl.enable(gl.DEPTH_TEST); gl.enable(gl.BLEND); gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
+ let previous = -1;
+ return {
+ draw(time) {
+ const frame = Math.max(0, Math.min(description.frames - 1, Math.floor(time * fps + 0.0001)));
+ const bounds = content.getBoundingClientRect();
+ const width = Math.max(1, Math.round(bounds.width * devicePixelRatio));
+ const height = Math.max(1, Math.round(bounds.height * devicePixelRatio));
+ if (previous === frame && meshCanvas.width === width && meshCanvas.height === height) return;
+ previous = frame;
+ if (meshCanvas.width !== width || meshCanvas.height !== height) {
+ meshCanvas.width = skeletonCanvas.width = width;
+ meshCanvas.height = skeletonCanvas.height = height;
+ }
+ const [sw, sh] = description.source_size;
+ const scale = Math.min(width / sw, height / sh), ox = (width - sw * scale) / 2, oy = (height - sh * scale) / 2;
+ const k = description.intrinsics[frame];
+ gl.viewport(0, 0, width, height); gl.clearColor(0, 0, 0, 0); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+ gl.useProgram(program); gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
+ const start = frame * description.vertex_count * 3;
+ gl.bufferSubData(gl.ARRAY_BUFFER, 0, vertices.subarray(start, start + description.vertex_count * 3));
+ gl.uniform4f(uniforms.calibration, k[0][0], k[1][1], k[0][2], k[1][2]);
+ gl.uniform2f(uniforms.resolution, sw, sh); gl.uniform2f(uniforms.fit, sw * scale / width, sh * scale / height);
+ gl.drawElements(gl.TRIANGLES, faces.length, gl.UNSIGNED_INT, 0);
+ ctx.clearRect(0, 0, width, height);
+ const at = index => {
+ const offset = (frame * description.keypoint_count + index) * 3;
+ const z = points[offset + 2];
+ return z > 0 ? [ox + (points[offset] * k[0][0] / z + k[0][2]) * scale,
+ oy + (points[offset + 1] * k[1][1] / z + k[1][2]) * scale] : null;
+ };
+ ctx.lineCap = 'round';
+ for (const [a, b, color, major] of description.links) {
+ const first = at(a), second = at(b);
+ if (!first || !second) continue;
+ ctx.strokeStyle = `rgb(${color.join(',')})`; ctx.lineWidth = Math.max(1, height / 520) * (major ? 1.8 : 1);
+ ctx.beginPath(); ctx.moveTo(...first); ctx.lineTo(...second); ctx.stroke();
+ }
+ for (const [index, color] of description.joints) {
+ const point = at(index);
+ if (!point) continue;
+ ctx.fillStyle = `rgb(${color.join(',')})`;
+ ctx.beginPath(); ctx.arc(...point, Math.max(1.3, height / 350), 0, Math.PI * 2); ctx.fill();
+ }
+ },
+ dispose() {
+ gl.deleteBuffer(vertexBuffer); gl.deleteBuffer(faceBuffer);
+ gl.deleteShader(vertex); gl.deleteShader(fragment); gl.deleteProgram(program);
+ gl.getExtension('WEBGL_lose_context')?.loseContext();
+ meshCanvas.remove(); skeletonCanvas.remove();
+ }
+ };
+ } catch (error) {
+ gl?.getExtension('WEBGL_lose_context')?.loseContext();
+ meshCanvas.remove(); skeletonCanvas.remove();
+ throw error;
+ }
+}
diff --git a/fdanyone/space/assets/pitches.html b/fdanyone/space/assets/pitches.html
new file mode 100644
index 0000000..6d86a29
--- /dev/null
+++ b/fdanyone/space/assets/pitches.html
@@ -0,0 +1,15 @@
+<div class="pitches-control">
+ <div class="layer-count inline-slider discrete">
+ <span class="slider-label">{{layers_label}}</span>
+ <span class="slider-track">
+ <span class="slider-rail">
+ <input id="camera-layers" type="range" min="1" max="5" step="1" value="1" aria-label="No. Layers">
+ </span>
+ <output class="slider-value" aria-hidden="true">1</output>
+ </span>
+ </div>
+ <div class="pitch-group">
+ <div class="pitch-heading">{{pitches_label}}</div>
+ <div class="pitch-fields" role="group" aria-label="Pitches" tabindex="-1"></div>
+ </div>
+</div>
diff --git a/fdanyone/space/assets/pitches.js b/fdanyone/space/assets/pitches.js
new file mode 100644
index 0000000..1d59a69
--- /dev/null
+++ b/fdanyone/space/assets/pitches.js
@@ -0,0 +1,85 @@
+const fields = element.querySelector('.pitch-fields');
+const row = element.querySelector('.layer-count');
+const count = row.querySelector('input');
+let dirty = false;
+
+function update() {
+ const pitches = props.value;
+ count.value = pitches.length;
+ count.max = props.max_layers;
+ count.disabled = props.interactive === false;
+ count.setAttribute('aria-valuetext', String(pitches.length));
+ row.querySelector('output').textContent = pitches.length;
+ row.style.setProperty('--range-progress', `${(Number(count.value) - 1) / (props.max_layers - 1) * 100}%`);
+ row.style.setProperty('--tick-count', props.max_layers);
+ row.classList.toggle('disabled', count.disabled);
+ fields.style.setProperty('--pitch-columns', pitches.length);
+ while (fields.children.length > pitches.length) fields.lastElementChild.remove();
+ pitches.forEach((value, i) => {
+ if (!fields.children[i]) {
+ const label = document.createElement('label');
+ const input = document.createElement('input');
+ input.type = 'number'; input.step = 1; input.required = true;
+ input.dataset.pitch = i;
+ input.setAttribute('aria-label', `Pitch ${i + 1} In Degrees`);
+ label.append(input);
+ fields.append(label);
+ }
+ const input = fields.children[i].querySelector('input');
+ input.min = props.min_pitch; input.max = props.max_pitch;
+ input.title = `Layer ${i + 1} · ${props.min_pitch}° To ${props.max_pitch}°`;
+ if (document.activeElement !== input) input.value = value ?? '';
+ input.style.width = `${Math.max(1, input.value.length)}ch`;
+ input.disabled = count.disabled;
+ input.setCustomValidity(pitches.some((other, index) => index !== i && other === value)
+ ? 'Use a different angle for each layer.' : '');
+ });
+ if (count.disabled) dirty = false;
+ const total = element.closest('#settings-grid')?.querySelector('.camera-view-count');
+ if (total) total.textContent = `${pitches.length * props.views} views in total`;
+}
+
+function changeCount() {
+ if (count.disabled || !Number.isFinite(count.valueAsNumber)) return;
+ const layers = Math.max(1, Math.min(props.max_layers, Math.round(count.valueAsNumber)));
+ if (layers === props.value.length) return;
+ dirty = false;
+ props.value = [...props.pitch_presets[layers - 1]];
+ update();
+ // Both controls must be current before Gradio snapshots the layout.
+ element.closest('#settings-grid')?.querySelector('#camera-views .inline-slider')?.dispatchEvent(
+ new CustomEvent('view-counts', {detail: props.view_counts[layers], bubbles: true})
+ );
+ trigger('input');
+}
+
+function commit() {
+ if (!dirty || props.interactive === false) return;
+ dirty = false;
+ if (!fields.querySelector('input:invalid')) props.value = [...props.value].sort((a, b) => b - a);
+ update();
+ trigger('input');
+}
+
+count.addEventListener('input', changeCount);
+fields.addEventListener('input', event => {
+ const input = event.target;
+ if (input.dataset.pitch === undefined || props.interactive === false) return;
+ const pitches = [...props.value];
+ pitches[Number(input.dataset.pitch)] = Number.isFinite(input.valueAsNumber) ? input.valueAsNumber : null;
+ dirty = true;
+ props.value = pitches;
+ update();
+});
+fields.addEventListener('focusout', event => {
+ if (!fields.contains(event.relatedTarget)) commit();
+});
+fields.addEventListener('keydown', event => {
+ if (event.key === 'Enter') { event.preventDefault(); event.target.blur(); }
+});
+element.addEventListener('view-count', event => {
+ props.views = Number(event.detail);
+ update();
+});
+watch(['value', 'min_pitch', 'max_pitch', 'max_layers', 'views', 'interactive'], update);
+update();
diff --git a/fdanyone/space/assets/rerun/LICENSE-MIT b/fdanyone/space/assets/rerun/LICENSE-MIT
new file mode 100644
index 0000000..79a5d00
--- /dev/null
+++ b/fdanyone/space/assets/rerun/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2022 Rerun Technologies AB <[email protected]>
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/fdanyone/space/assets/rerun/UPSTREAM.md b/fdanyone/space/assets/rerun/UPSTREAM.md
new file mode 100644
index 0000000..33b7999
--- /dev/null
+++ b/fdanyone/space/assets/rerun/UPSTREAM.md
@@ -0,0 +1,25 @@
+# Rerun Web Viewer
+
+These two JavaScript files come from the MIT-licensed
+[`@rerun-io/web-viewer` 0.37.1 package](https://www.npmjs.com/package/@rerun-io/web-viewer/v/0.37.1).
+The npm archive was verified against its published SHA-512 integrity:
+
+```text
+sha512-po+PoR60eb9O9lexMdFUlgNnfvtohuKeBlPCWQI/6I9XU9tQZpcptQb6R4ZKsXPntnSQEZrFAtGVqlI74+wUPQ==
+```
+
+Changes are the browser-resolvable `.js` extension on the dynamic
+`./re_viewer.js` import in `index.js`, removal of trailing whitespace, and using
+the Space's `media_cache.js` fetch helper for the version-pinned WASM file.
+The helper preserves streaming responses and bounds persistent browser storage.
+`index.js` also passes a per-viewer frame scheduler to the binding factory.
+In `re_viewer.js`, animation requests/cancellations use that scheduler; decoded
+video frames and resize notifications wake an idle scene. The scheduler is required; the adapter has no native scheduling fallback.
+These hooks leave browser globals and video decoding unchanged. Scheduling policy lives in
+`../frame_scheduler.js`, not in the generated bindings.
+The accompanying WASM is taken from the
+already installed, version-matched `gradio-rerun` wheel and checked against its
+SHA-256 before serving. It is not duplicated in this repository.
+
+Keep these files, the WASM digest in `web_assets.py`, `gradio-rerun`, and
+`rerun-sdk` on the same version. Readers do not need npm or a frontend build.
diff --git a/fdanyone/space/assets/rerun/index.js b/fdanyone/space/assets/rerun/index.js
new file mode 100644
index 0000000..b941962
--- /dev/null
+++ b/fdanyone/space/assets/rerun/index.js
@@ -0,0 +1,902 @@
+import {fetchCached} from "../media_cache.js";
+
+let get_wasm_bindgen = null;
+let _wasm_module = null;
+/**
+ * Feature-detect WebAssembly SIMD (`simd128`).
+ *
+ * The viewer .wasm is compiled with `-Ctarget-feature=+simd128`, so a browser
+ * without SIMD support will fail to instantiate the module with a cryptic
+ * `CompileError`. We probe up-front and surface a clear error instead.
+ *
+ * The probe is a minimal module that uses the `v128.any_true` instruction.
+ * Supported in: Chrome 91+, Firefox 89+, Safari 16.4+.
+ */
+function has_wasm_simd() {
+ try {
+ return WebAssembly.validate(new Uint8Array([
+ 0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0,
+ 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11,
+ ]));
+ }
+ catch {
+ return false;
+ }
+}
+const UNSUPPORTED_BROWSER_MESSAGE = "Your browser is too old to run the Rerun Viewer. " +
+ "The Viewer requires WebAssembly SIMD support, available in " +
+ "Chrome 91+, Firefox 89+, Safari 16.4+, or any modern Chromium-based browser. " +
+ "Please update your browser and try again.";
+// The public export API uses streams so the private Wasm API can switch to incremental encoding
+// without requiring a breaking JavaScript API change.
+function export_stream(bytes) {
+ return new ReadableStream({
+ start(controller) {
+ controller.enqueue(bytes);
+ controller.close();
+ },
+ });
+}
+async function fetch_viewer_js(base_url) {
+ // @ts-ignore
+ return (await import("./re_viewer.js")).default;
+}
+async function fetch_viewer_wasm(base_url, on_progress) {
+ //!<INLINE-MARKER-OPEN>
+ const url = base_url
+ ? new URL("./re_viewer_bg.wasm", base_url)
+ : new URL("./re_viewer_bg.wasm", import.meta.url);
+ const response = await fetchCached(url);
+ if (!response.ok) {
+ throw new Error(`Failed to fetch viewer Wasm: ${response.status} ${response.statusText}`);
+ }
+ return wrap_fetch_with_progress(response, on_progress);
+ //!<INLINE-MARKER-CLOSE>
+}
+/**
+ * Estimates total uncompressed bytes for progress display.
+ * This is a rough estimate — do NOT use for truncation detection.
+ */
+function estimate_total_bytes(response) {
+ // When served with `rerun-final-length`, use that (set by `re_web_viewer_server`).
+ const final_length = response.headers.get("rerun-final-length");
+ if (final_length != null)
+ return parseInt(final_length, 10);
+ // When gzip-compressed, try the GCS uncompressed-size header.
+ if (response.headers.get("content-encoding") === "gzip") {
+ const uncompressed = response.headers.get("x-goog-meta-uncompressed-size");
+ if (uncompressed != null)
+ return parseInt(uncompressed, 10);
+ // Fall back to content-length * 3 (good empirical approximation for gzip'd wasm).
+ const cl = response.headers.get("content-length");
+ if (cl != null)
+ return parseInt(cl, 10) * 3;
+ }
+ // Uncompressed: content-length is the exact size.
+ const cl = response.headers.get("content-length");
+ if (cl != null)
+ return parseInt(cl, 10);
+ return null;
+}
+/**
+ * Wraps a fetch response to track download progress.
+ */
+function wrap_fetch_with_progress(response, on_progress) {
+ const total_bytes = estimate_total_bytes(response);
+ if (!response.body)
+ return response;
+ let received = 0;
+ const body = response.body;
+ const tracked = new ReadableStream({
+ async start(controller) {
+ const reader = body.getReader();
+ while (true) {
+ const { done, value } = await reader.read();
+ if (done)
+ break;
+ received += value.byteLength;
+ on_progress?.(received, total_bytes);
+ controller.enqueue(value);
+ }
+ controller.close();
+ },
+ });
+ return new Response(tracked, {
+ status: response.status,
+ statusText: response.statusText,
+ headers: response.headers,
+ });
+}
+function format_mib(bytes) {
+ return (bytes / (1024 * 1024)).toFixed(1) + " MiB";
+}
+async function load(base_url, on_progress, frame_scheduler) {
+ if (!has_wasm_simd()) {
+ throw new Error(UNSUPPORTED_BROWSER_MESSAGE);
+ }
+ // instantiate wbg globals+module for every invocation of `load`,
+ // but don't load the JS/Wasm source every time
+ if (!get_wasm_bindgen || !_wasm_module) {
+ [get_wasm_bindgen, _wasm_module] = await Promise.all([
+ fetch_viewer_js(base_url),
+ WebAssembly.compileStreaming(fetch_viewer_wasm(base_url, on_progress)),
+ ]);
+ }
+ let bindgen = get_wasm_bindgen(frame_scheduler);
+ await bindgen({ module_or_path: _wasm_module });
+ return class extends bindgen.WebHandle {
+ free() {
+ super.free();
+ // @ts-ignore
+ bindgen.deinit();
+ }
+ };
+}
+let _minimize_current_fullscreen_viewer = null;
+function randomId() {
+ const bytes = new Uint8Array(16);
+ crypto.getRandomValues(bytes);
+ return Array.from(bytes)
+ .map((byte) => byte.toString(16).padStart(2, "0"))
+ .join("");
+}
+function delay(ms) {
+ return new Promise((resolve) => setTimeout(resolve, ms));
+}
+/** Resolve a potentially relative URL against the current origin. */
+function resolveAbsoluteUrl(url) {
+ return new URL(url, window.location.href).toString();
+}
+/**
+ * Rerun Web Viewer
+ *
+ * ```ts
+ * const viewer = new WebViewer();
+ * await viewer.start();
+ * ```
+ *
+ * Data may be provided to the Viewer as:
+ * - An HTTP file URL, e.g. `viewer.start("https://app.rerun.io/version/0.37.1/examples/dna.rrd")`
+ * - A Rerun gRPC URL, e.g. `viewer.start("rerun+http://127.0.0.1:9876/proxy")`
+ * - A stream of log messages, via {@link WebViewer.open_channel}.
+ *
+ * Callbacks may be attached for various events using {@link WebViewer.on}:
+ *
+ * ```ts
+ * viewer.on("time_update", (time) => console.log(`current time: {time}`));
+ * ```
+ *
+ * For the full list of available events, see {@link ViewerEvent}.
+ */
+export class WebViewer {
+ #id = randomId();
+ // NOTE: Using the handle requires wrapping all calls to its methods in try/catch.
+ // On failure, call `this.stop` to prevent a memory leak, then re-throw the error.
+ #handle = null;
+ #canvas = null;
+ #loader = null;
+ #state = "stopped";
+ #fullscreen = false;
+ #allow_fullscreen = false;
+ constructor() {
+ injectStyle();
+ setupGlobalEventListeners();
+ }
+ /**
+ * Start the viewer.
+ *
+ * @param rrd URLs to `.rrd` files or gRPC connections to our SDK.
+ * @param parent The element to attach the canvas onto.
+ * @param options Web Viewer configuration.
+ */
+ async start(rrd, parent, options) {
+ parent ??= document.body;
+ options ??= {};
+ options = options ? { ...options } : options;
+ this.#allow_fullscreen = options.allow_fullscreen || false;
+ if (this.#state !== "stopped")
+ return;
+ this.#state = "starting";
+ this.#clearLoader();
+ this.#canvas = document.createElement("canvas");
+ this.#canvas.style.width = options.width ?? "640px";
+ this.#canvas.style.height = options.height ?? "360px";
+ parent.append(this.#canvas);
+ // Show loading progress bar
+ this.#loader = document.createElement("div");
+ this.#loader.innerHTML = `
+ <div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; background-color: #1c1c1c; font-family: sans-serif; color: white;">
+ <div style="margin-bottom: 16px;">Loading Rerun\u2026</div>
+ <div style="width: 200px;">
+ <div style="background: #333; border-radius: 4px; height: 6px; overflow: hidden;">
+ <div class="rerun-progress-bar" style="background: white; height: 100%; width: 0%; transition: width 0.2s;"></div>
+ </div>
+ <div class="rerun-progress-text" style="margin-top: 6px; font-size: 12px; color: #999;"></div>
+ </div>
+ </div>
+ `;
+ this.#loader.style.position = "absolute";
+ this.#loader.style.inset = "0";
+ parent.style.position = "relative";
+ parent.append(this.#loader);
+ const progress_bar = this.#loader.querySelector(".rerun-progress-bar");
+ const progress_text = this.#loader.querySelector(".rerun-progress-text");
+ const on_progress = (received, total) => {
+ if (total != null && total > 0) {
+ const pct = Math.min((received / total) * 100, 100);
+ progress_bar.style.width = pct.toFixed(1) + "%";
+ progress_text.textContent = `${Math.round(pct)}%`;
+ }
+ else {
+ progress_text.textContent = format_mib(received);
+ }
+ };
+ // This yield appears to be necessary to ensure that the canvas is attached to the DOM
+ // and visible. Without it we get occasionally get a panic about a failure to find a canvas
+ // element with the given ID.
+ await delay(0);
+ let base_url = options?.base_url;
+ if (base_url) {
+ delete options.base_url;
+ }
+ let WebHandle_class;
+ const frame_scheduler = options.frame_scheduler;
+ delete options.frame_scheduler;
+ try {
+ WebHandle_class = await load(base_url, on_progress, frame_scheduler);
+ }
+ catch (e) {
+ this.#clearLoader();
+ this.#fail("Failed to load rerun", String(e));
+ throw e;
+ }
+ if (this.#state !== "starting") {
+ this.#clearLoader();
+ return;
+ }
+ const fullscreen = this.#allow_fullscreen
+ ? {
+ get_state: () => this.#fullscreen,
+ on_toggle: () => this.toggle_fullscreen(),
+ }
+ : undefined;
+ const on_viewer_event = (event_json) => {
+ // for notebooks/gradio, we can avoid a whole layer
+ // of serde by sending over the raw json directly,
+ // which will be deserialized in Python instead
+ this.#dispatch_raw_event(event_json);
+ // for JS users, we dispatch the parsed event
+ let event = JSON.parse(event_json);
+ this.#dispatch_event(event.type, event);
+ };
+ const login = options.login
+ ? {
+ signed_in_url: resolveAbsoluteUrl(options.login.signed_in_url),
+ signed_out_url: resolveAbsoluteUrl(options.login.signed_out_url),
+ }
+ : undefined;
+ this.#handle = new WebHandle_class({
+ ...options,
+ login,
+ fullscreen,
+ on_viewer_event,
+ });
+ try {
+ await this.#handle.start(this.#canvas);
+ }
+ catch (e) {
+ this.#clearLoader();
+ this.#fail("Failed to start", String(e));
+ throw e;
+ }
+ if (this.#state !== "starting") {
+ this.#clearLoader();
+ return;
+ }
+ this.#clearLoader();
+ this.#state = "ready";
+ this.#dispatch_event("ready");
+ if (rrd) {
+ this.open(rrd);
+ }
+ let self = this;
+ function check_for_panic() {
+ if (self.#handle?.has_panicked()) {
+ self.#fail("Rerun has crashed.", self.#handle?.panic_message());
+ }
+ else {
+ let delay_ms = 1000;
+ setTimeout(check_for_panic, delay_ms);
+ }
+ }
+ check_for_panic();
+ return;
+ }
+ #raw_events = new Set();
+ #dispatch_raw_event(event_json) {
+ for (const callback of this.#raw_events) {
+ callback(event_json);
+ }
+ }
+ /** Internal interface */
+ // NOTE: Callbacks passed to this function must NOT invoke any viewer methods!
+ // The `setTimeout` is omitted to avoid the 1-tick delay, as it is unnecessary,
+ // because this is only meant to be used for sending events to Jupyter/Gradio.
+ //
+ // Do not change this without searching for grepping for usage!
+ _on_raw_event(callback) {
+ this.#raw_events.add(callback);
+ return () => this.#raw_events.delete(callback);
+ }
+ #event_map = new Map();
+ #dispatch_event(event, ...args) {
+ // Dispatch events on next tick.
+ // This is necessary because we may have been called somewhere deep within the viewer's call stack,
+ // which means that `app` may be locked. The event will not actually be dispatched until the
+ // full call stack has returned or the current task has yielded to the event loop. It does not
+ // guarantee that we will be able to acquire the lock here, but it makes it a lot more likely.
+ setTimeout(() => {
+ const callbacks = this.#event_map.get(event);
+ if (callbacks) {
+ for (const [callback, { once }] of [...callbacks.entries()]) {
+ callback(...args);
+ if (once)
+ callbacks.delete(callback);
+ }
+ }
+ }, 0);
+ }
+ on(event, callback) {
+ const callbacks = this.#event_map.get(event) ?? new Map();
+ callbacks.set(callback, { once: false });
+ this.#event_map.set(event, callbacks);
+ return () => callbacks.delete(callback);
+ }
+ once(event, callback) {
+ const callbacks = this.#event_map.get(event) ?? new Map();
+ callbacks.set(callback, { once: true });
+ this.#event_map.set(event, callbacks);
+ return () => callbacks.delete(callback);
+ }
+ off(event, callback) {
+ const callbacks = this.#event_map.get(event);
+ if (callbacks) {
+ callbacks.delete(callback);
+ }
+ else {
+ console.warn("Attempted to call `WebViewer.off` with an unregistered callback. Are you passing in the same function instance?");
+ }
+ }
+ /**
+ * The underlying canvas element.
+ */
+ get canvas() {
+ return this.#canvas;
+ }
+ /**
+ * Returns `true` if the viewer is ready to connect to data sources.
+ */
+ get ready() {
+ return this.#state === "ready";
+ }
+ /**
+ * Open a recording.
+ *
+ * The viewer must have been started via {@link WebViewer.start}.
+ *
+ * @param rrd URLs to `.rrd` files or gRPC connections to our SDK.
+ */
+ open(rrd) {
+ if (!this.#handle) {
+ throw new Error(`attempted to open \`${rrd}\` in a stopped viewer`);
+ }
+ const urls = Array.isArray(rrd) ? rrd : [rrd];
+ for (const url of urls) {
+ try {
+ this.#handle.add_receiver(url);
+ }
+ catch (e) {
+ this.#fail("Failed to open recording", String(e));
+ throw e;
+ }
+ }
+ }
+ /**
+ * Close a recording.
+ *
+ * The viewer must have been started via {@link WebViewer.start}.
+ *
+ * @param rrd URLs to `.rrd` files or gRPC connections to our SDK.
+ */
+ close(rrd) {
+ if (!this.#handle) {
+ throw new Error(`attempted to close \`${rrd}\` in a stopped viewer`);
+ }
+ const urls = Array.isArray(rrd) ? rrd : [rrd];
+ for (const url of urls) {
+ try {
+ this.#handle.remove_receiver(url);
+ }
+ catch (e) {
+ this.#fail("Failed to close recording", String(e));
+ throw e;
+ }
+ }
+ }
+ /**
+ * Save the active recording as an `.rrd` byte stream.
+ *
+ * The snapshot is selected when this method is called.
+ * Concatenate all stream byte sequences to obtain one valid file.
+ * An individual sequence is not independently accepted by {@link WebViewer.open_channel}.
+ *
+ * @throws If the viewer is stopped or has no active recording.
+ */
+ save_recording() {
+ if (!this.#handle) {
+ throw new Error(`attempted to save recording in a stopped web viewer`);
+ }
+ const bytes = this.#handle.save_recording();
+ return export_stream(bytes);
+ }
+ /**
+ * Save the active blueprint as an `.rbl` byte stream.
+ *
+ * The snapshot is selected when this method is called.
+ * Concatenate all stream byte sequences to obtain one valid file.
+ * An individual sequence is not independently accepted by {@link WebViewer.open_channel}.
+ *
+ * @throws If the viewer is stopped or has no active blueprint.
+ */
+ save_blueprint() {
+ if (!this.#handle) {
+ throw new Error(`attempted to save blueprint in a stopped web viewer`);
+ }
+ const bytes = this.#handle.save_blueprint();
+ return export_stream(bytes);
+ }
+ /**
+ * Stop the viewer, freeing all associated memory.
+ *
+ * The same viewer instance may be started multiple times.
+ */
+ stop() {
+ if (this.#state === "stopped")
+ return;
+ if (this.#allow_fullscreen && this.#canvas && this.#fullscreen) {
+ this.#minimize();
+ }
+ this.#state = "stopped";
+ this.#canvas?.remove();
+ this.#clearLoader();
+ try {
+ this.#handle?.destroy();
+ this.#handle?.free();
+ }
+ catch (e) {
+ this.#handle = null;
+ throw e;
+ }
+ this.#canvas = null;
+ this.#handle = null;
+ this.#loader = null;
+ this.#fullscreen = false;
+ this.#allow_fullscreen = false;
+ }
+ #fail(message, error_message) {
+ console.error("WebViewer failure:", message, error_message);
+ if (this.canvas?.parentElement) {
+ const parent = this.canvas.parentElement;
+ parent.innerHTML = `
+ <div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: white; font-family: sans-serif; background-color: #1c1c1c;">
+ <h1 class="rerun-fail-message"></h1>
+ <pre class="rerun-fail-error" style="text-align: left; white-space: pre-wrap; word-break: break-word; max-width: 90vw;"></pre>
+ <button class="rerun-fail-clear-cache">Clear caches and reload</button>
+ </div>
+ `;
+ parent.querySelector(".rerun-fail-message").textContent = message;
+ const errorEl = parent.querySelector(".rerun-fail-error");
+ if (error_message) {
+ errorEl.textContent = error_message;
+ }
+ else {
+ errorEl.remove();
+ }
+ parent.querySelector(".rerun-fail-clear-cache").addEventListener("click", async () => {
+ if ("caches" in window) {
+ const keys = await caches.keys();
+ await Promise.all(keys.map((key) => caches.delete(key)));
+ }
+ window.location.reload();
+ });
+ }
+ this.stop();
+ }
+ #clearLoader() {
+ this.#loader?.remove();
+ this.#loader = null;
+ }
+ /**
+ * Opens a new channel for sending log messages.
+ *
+ * The channel can be used to incrementally push `rrd` chunks into the viewer.
+ *
+ * @param channel_name used to identify the channel.
+ */
+ open_channel(channel_name = "rerun-io/web-viewer") {
+ if (!this.#handle) {
+ throw new Error(`attempted to open channel \"${channel_name}\" in a stopped web viewer`);
+ }
+ const id = crypto.randomUUID();
+ try {
+ this.#handle.open_channel(id, channel_name);
+ }
+ catch (e) {
+ this.#fail("Failed to open channel", String(e));
+ throw e;
+ }
+ const on_send = (/** @type {Uint8Array} */ data) => {
+ if (!this.#handle) {
+ throw new Error(`attempted to send data through channel \"${channel_name}\" to a stopped web viewer`);
+ }
+ try {
+ this.#handle.send_rrd_to_channel(id, data);
+ }
+ catch (e) {
+ this.#fail("Failed to send data", String(e));
+ throw e;
+ }
+ };
+ const on_send_table = (/** @type {Uint8Array} */ data) => {
+ if (!this.#handle) {
+ throw new Error(`attempted to send data through channel \"${channel_name}\" to a stopped web viewer`);
+ }
+ try {
+ this.#handle.send_table_to_channel(id, data);
+ }
+ catch (e) {
+ this.#fail("Failed to send table", String(e));
+ throw e;
+ }
+ };
+ const on_close = () => {
+ if (!this.#handle) {
+ throw new Error(`attempted to send data through channel \"${channel_name}\" to a stopped web viewer`);
+ }
+ try {
+ this.#handle.close_channel(id);
+ }
+ catch (e) {
+ this.#fail("Failed to close channel", String(e));
+ throw e;
+ }
+ };
+ const get_state = () => this.#state;
+ return new LogChannel(on_send, on_send_table, on_close, get_state);
+ }
+ /**
+ * Force a panel to a specific state.
+ *
+ * @param panel which panel to configure
+ * @param state which state to force the panel into
+ */
+ override_panel_state(panel, state) {
+ if (!this.#handle) {
+ throw new Error(`attempted to set ${panel} panel to ${state} in a stopped web viewer`);
+ }
+ try {
+ this.#handle.override_panel_state(panel, state);
+ }
+ catch (e) {
+ this.#fail("Failed to override panel state", String(e));
+ throw e;
+ }
+ }
+ /**
+ * Toggle panel overrides set via `override_panel_state`.
+ *
+ * @param value set to a specific value. Toggles the previous value if not provided.
+ */
+ toggle_panel_overrides(value) {
+ if (!this.#handle) {
+ throw new Error(`attempted to toggle panel overrides in a stopped web viewer`);
+ }
+ try {
+ this.#handle.toggle_panel_overrides(value);
+ }
+ catch (e) {
+ this.#fail("Failed to toggle panel overrides", String(e));
+ throw e;
+ }
+ }
+ /**
+ * Get the active recording id.
+ */
+ get_active_recording_id() {
+ if (!this.#handle) {
+ throw new Error(`attempted to get active recording id in a stopped web viewer`);
+ }
+ return this.#handle.get_active_recording_id() ?? null;
+ }
+ /**
+ * Set the active recording id.
+ *
+ * This is the same as clicking on the recording in the Viewer's left panel.
+ */
+ set_active_recording_id(value) {
+ if (!this.#handle) {
+ throw new Error(`attempted to set active recording id to ${value} in a stopped web viewer`);
+ }
+ this.#handle.set_active_recording_id(value);
+ }
+ /**
+ * Get the play state.
+ *
+ * This always returns `false` if the recording can't be found.
+ */
+ get_playing(recording_id) {
+ if (!this.#handle) {
+ throw new Error(`attempted to get play state in a stopped web viewer`);
+ }
+ return this.#handle.get_playing(recording_id) || false;
+ }
+ /**
+ * Set the play state.
+ *
+ * This does nothing if the recording can't be found.
+ */
+ set_playing(recording_id, value) {
+ if (!this.#handle) {
+ throw new Error(`attempted to set play state to ${value ? "playing" : "paused"} in a stopped web viewer`);
+ }
+ this.#handle.set_playing(recording_id, value);
+ }
+ /**
+ * Get the current time.
+ *
+ * The interpretation of time depends on what kind of timeline it is:
+ *
+ * - For time timelines, this is the time in nanoseconds.
+ * - For sequence timelines, this is the sequence number.
+ *
+ * This always returns `0` if the recording or timeline can't be found.
+ */
+ get_current_time(recording_id, timeline) {
+ if (!this.#handle) {
+ throw new Error(`attempted to get current time in a stopped web viewer`);
+ }
+ return this.#handle.get_time_for_timeline(recording_id, timeline) || 0;
+ }
+ /**
+ * Set the current time.
+ *
+ * Equivalent to clicking on the timeline in the time panel at the specified `time`.
+ * The interpretation of `time` depends on what kind of timeline it is:
+ *
+ * - For time timelines, this is the time in nanoseconds.
+ * - For sequence timelines, this is the sequence number.
+ *
+ * This does nothing if the recording or timeline can't be found.
+ */
+ set_current_time(recording_id, timeline, time) {
+ if (!this.#handle) {
+ throw new Error(`attempted to set current time to ${time} in a stopped web viewer`);
+ }
+ this.#handle.set_time_for_timeline(recording_id, timeline, time);
+ }
+ /**
+ * Get the active timeline.
+ *
+ * This always returns `null` if the recording can't be found.
+ */
+ get_active_timeline(recording_id) {
+ if (!this.#handle) {
+ throw new Error(`attempted to get active timeline in a stopped web viewer`);
+ }
+ return this.#handle.get_active_timeline(recording_id) ?? null;
+ }
+ /**
+ * Set the active timeline.
+ *
+ * This does nothing if the recording or timeline can't be found.
+ */
+ set_active_timeline(recording_id, timeline) {
+ if (!this.#handle) {
+ throw new Error(`attempted to set active timeline to ${timeline} in a stopped web viewer`);
+ }
+ this.#handle.set_active_timeline(recording_id, timeline);
+ }
+ /**
+ * Get the time range for a timeline.
+ *
+ * This always returns `null` if the recording or timeline can't be found.
+ */
+ get_time_range(recording_id, timeline) {
+ if (!this.#handle) {
+ throw new Error(`attempted to get time range in a stopped web viewer`);
+ }
+ return this.#handle.get_timeline_time_range(recording_id, timeline);
+ }
+ /**
+ * Toggle fullscreen mode.
+ *
+ * This does nothing if `allow_fullscreen` was not set to `true` when starting the viewer.
+ *
+ * Fullscreen mode works by updating the underlying `<canvas>` element's `style`:
+ * - `position` to `fixed`
+ * - width/height/top/left to cover the entire viewport
+ *
+ * When fullscreen mode is toggled off, the style is restored to its previous values.
+ *
+ * When fullscreen mode is toggled on, any other instance of the viewer on the page
+ * which is already in fullscreen mode is toggled off. This means that it doesn't
+ * have to be tracked manually.
+ *
+ * This functionality can also be directly accessed in the viewer:
+ * - The maximize/minimize top panel button
+ * - The `Toggle fullscreen` UI command (accessible via the command palette, CTRL+P)
+ */
+ toggle_fullscreen() {
+ if (!this.#allow_fullscreen)
+ return;
+ if (!this.#handle || !this.#canvas) {
+ throw new Error(`attempted to toggle fullscreen mode in a stopped web viewer`);
+ }
+ if (this.#fullscreen) {
+ this.#minimize();
+ }
+ else {
+ this.#maximize();
+ }
+ }
+ set_credentials(access_token, email) {
+ if (!this.#handle) {
+ throw new Error(`attempted to set credentials in a stopped web viewer`);
+ }
+ this.#handle.set_credentials(access_token, email);
+ }
+ #minimize = () => { };
+ #maximize = () => {
+ _minimize_current_fullscreen_viewer?.();
+ const canvas = this.#canvas;
+ const rect = canvas.getBoundingClientRect();
+ const sync_style_to_rect = () => {
+ canvas.style.left = rect.left + "px";
+ canvas.style.top = rect.top + "px";
+ canvas.style.width = rect.width + "px";
+ canvas.style.height = rect.height + "px";
+ };
+ const undo_style = () => canvas.removeAttribute("style");
+ const transition = (callback) => setTimeout(() => requestAnimationFrame(callback), transition_delay_ms);
+ canvas.classList.add(classes.fullscreen_base, classes.fullscreen_rect);
+ sync_style_to_rect();
+ requestAnimationFrame(() => {
+ if (!this.#fullscreen)
+ return;
+ canvas.classList.add(classes.transition);
+ transition(() => {
+ if (!this.#fullscreen)
+ return;
+ undo_style();
+ document.body.classList.add(classes.hide_scrollbars);
+ document.documentElement.classList.add(classes.hide_scrollbars);
+ this.#dispatch_event("fullscreen", true);
+ });
+ });
+ this.#minimize = () => {
+ document.body.classList.remove(classes.hide_scrollbars);
+ document.documentElement.classList.remove(classes.hide_scrollbars);
+ sync_style_to_rect();
+ canvas.classList.remove(classes.fullscreen_rect);
+ transition(() => {
+ if (this.#fullscreen)
+ return;
+ undo_style();
+ canvas.classList.remove(classes.fullscreen_base, classes.transition);
+ });
+ _minimize_current_fullscreen_viewer = null;
+ this.#fullscreen = false;
+ this.#dispatch_event("fullscreen", false);
+ };
+ _minimize_current_fullscreen_viewer = () => this.#minimize();
+ this.#fullscreen = true;
+ };
+}
+export class LogChannel {
+ #on_send;
+ #on_send_table;
+ #on_close;
+ #get_state;
+ #closed = false;
+ /**
+ * @param on_send
+ * @param on_close
+ * @param get_state
+ */
+ constructor(on_send, on_send_table, on_close, get_state) {
+ this.#on_send = on_send;
+ this.#on_send_table = on_send_table;
+ this.#on_close = on_close;
+ this.#get_state = get_state;
+ }
+ get ready() {
+ return !this.#closed && this.#get_state() === "ready";
+ }
+ /**
+ * Send an `rrd` containing log messages to the viewer.
+ *
+ * Does nothing if `!this.ready`.
+ *
+ * @param rrd_bytes Is an rrd file stored in a byte array, received via some other side channel.
+ */
+ send_rrd(rrd_bytes) {
+ if (!this.ready)
+ return;
+ this.#on_send(rrd_bytes);
+ }
+ send_table(table_bytes) {
+ if (!this.ready)
+ return;
+ this.#on_send_table(table_bytes);
+ }
+ /**
+ * Close the channel.
+ *
+ * Does nothing if `!this.ready`.
+ */
+ close() {
+ if (!this.ready)
+ return;
+ this.#on_close();
+ this.#closed = true;
+ }
+}
+const classes = {
+ hide_scrollbars: "rerun-viewer-hide-scrollbars",
+ fullscreen_base: "rerun-viewer-fullscreen-base",
+ fullscreen_rect: "rerun-viewer-fullscreen-rect",
+ transition: "rerun-viewer-transition",
+};
+const transition_delay_ms = 100;
+const css = `
+ html.${classes.hide_scrollbars},
+ body.${classes.hide_scrollbars} {
+ scrollbar-gutter: auto !important;
+ overflow: hidden !important;
+ }
+
+ .${classes.fullscreen_base} {
+ position: fixed;
+ z-index: 99999;
+ }
+
+ .${classes.transition} {
+ transition: all ${transition_delay_ms / 1000}s linear;
+ }
+
+ .${classes.fullscreen_rect} {
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ }
+`;
+function injectStyle() {
+ const ID = "__rerun_viewer_style";
+ if (document.getElementById(ID)) {
+ // already injected
+ return;
+ }
+ const style = document.createElement("style");
+ style.id = ID;
+ style.appendChild(document.createTextNode(css));
+ document.head.appendChild(style);
+}
+function setupGlobalEventListeners() {
+ window.addEventListener("keyup", (e) => {
+ if (e.code === "Escape") {
+ _minimize_current_fullscreen_viewer?.();
+ }
+ });
+}
+//# sourceMappingURL=index.js.map
diff --git a/fdanyone/space/assets/rerun/re_viewer.js b/fdanyone/space/assets/rerun/re_viewer.js
new file mode 100644
index 0000000..8ac2e0a
--- /dev/null
+++ b/fdanyone/space/assets/rerun/re_viewer.js
@@ -0,0 +1,4797 @@
+
+export default function(frame_scheduler) {
+const exports = { __proto__: null };
+
+ let script_src;
+ if (typeof document !== 'undefined' && document.currentScript !== null) {
+ script_src = new URL(document.currentScript.src, location.href).toString();
+ }
+
+ class IntoUnderlyingByteSource {
+ __destroy_into_raw() {
+ const ptr = this.__wbg_ptr;
+ this.__wbg_ptr = 0;
+ IntoUnderlyingByteSourceFinalization.unregister(this);
+ return ptr;
+ }
+ free() {
+ const ptr = this.__destroy_into_raw();
+ wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
+ }
+ /**
+ * @returns {number}
+ */
+ get autoAllocateChunkSize() {
+ const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
+ return ret >>> 0;
+ }
+ cancel() {
+ const ptr = this.__destroy_into_raw();
+ wasm.intounderlyingbytesource_cancel(ptr);
+ }
+ /**
+ * @param {ReadableByteStreamController} controller
+ * @returns {Promise<any>}
+ */
+ pull(controller) {
+ const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
+ return ret;
+ }
+ /**
+ * @param {ReadableByteStreamController} controller
+ */
+ start(controller) {
+ wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
+ }
+ /**
+ * @returns {ReadableStreamType}
+ */
+ get type() {
+ const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
+ return __wbindgen_enum_ReadableStreamType[ret];
+ }
+ }
+ if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
+ exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
+
+ class IntoUnderlyingSink {
+ __destroy_into_raw() {
+ const ptr = this.__wbg_ptr;
+ this.__wbg_ptr = 0;
+ IntoUnderlyingSinkFinalization.unregister(this);
+ return ptr;
+ }
+ free() {
+ const ptr = this.__destroy_into_raw();
+ wasm.__wbg_intounderlyingsink_free(ptr, 0);
+ }
+ /**
+ * @param {any} reason
+ * @returns {Promise<any>}
+ */
+ abort(reason) {
+ const ptr = this.__destroy_into_raw();
+ const ret = wasm.intounderlyingsink_abort(ptr, reason);
+ return ret;
+ }
+ /**
+ * @returns {Promise<any>}
+ */
+ close() {
+ const ptr = this.__destroy_into_raw();
+ const ret = wasm.intounderlyingsink_close(ptr);
+ return ret;
+ }
+ /**
+ * @param {any} chunk
+ * @returns {Promise<any>}
+ */
+ write(chunk) {
+ const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
+ return ret;
+ }
+ }
+ if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
+ exports.IntoUnderlyingSink = IntoUnderlyingSink;
+
+ class IntoUnderlyingSource {
+ __destroy_into_raw() {
+ const ptr = this.__wbg_ptr;
+ this.__wbg_ptr = 0;
+ IntoUnderlyingSourceFinalization.unregister(this);
+ return ptr;
+ }
+ free() {
+ const ptr = this.__destroy_into_raw();
+ wasm.__wbg_intounderlyingsource_free(ptr, 0);
+ }
+ cancel() {
+ const ptr = this.__destroy_into_raw();
+ wasm.intounderlyingsource_cancel(ptr);
+ }
+ /**
+ * @param {ReadableStreamDefaultController} controller
+ * @returns {Promise<any>}
+ */
+ pull(controller) {
+ const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller);
+ return ret;
+ }
+ }
+ if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
+ exports.IntoUnderlyingSource = IntoUnderlyingSource;
+
+ class WebHandle {
+ __destroy_into_raw() {
+ const ptr = this.__wbg_ptr;
+ this.__wbg_ptr = 0;
+ WebHandleFinalization.unregister(this);
+ return ptr;
+ }
+ free() {
+ const ptr = this.__destroy_into_raw();
+ wasm.__wbg_webhandle_free(ptr, 0);
+ }
+ /**
+ * Add a new receiver streaming data from the given url.
+ *
+ * Websocket streams are always opened in `Following` mode.
+ *
+ * It is an error to open a channel twice with the same id.
+ * @param {string} url
+ */
+ add_receiver(url) {
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ wasm.webhandle_add_receiver(this.__wbg_ptr, ptr0, len0);
+ }
+ /**
+ * Close an existing channel for streaming data.
+ *
+ * No-op if the channel is already closed.
+ * @param {string} id
+ */
+ close_channel(id) {
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ wasm.webhandle_close_channel(this.__wbg_ptr, ptr0, len0);
+ }
+ destroy() {
+ wasm.webhandle_destroy(this.__wbg_ptr);
+ }
+ /**
+ * @returns {string | undefined}
+ */
+ get_active_recording_id() {
+ const ret = wasm.webhandle_get_active_recording_id(this.__wbg_ptr);
+ let v1;
+ if (ret[0] !== 0) {
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
+ }
+ return v1;
+ }
+ /**
+ * @param {string} recording_id
+ * @returns {string | undefined}
+ */
+ get_active_timeline(recording_id) {
+ const ptr0 = passStringToWasm0(recording_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ const ret = wasm.webhandle_get_active_timeline(this.__wbg_ptr, ptr0, len0);
+ let v2;
+ if (ret[0] !== 0) {
+ v2 = getStringFromWasm0(ret[0], ret[1]).slice();
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
+ }
+ return v2;
+ }
+ /**
+ * @param {string} recording_id
+ * @returns {boolean | undefined}
+ */
+ get_playing(recording_id) {
+ const ptr0 = passStringToWasm0(recording_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ const ret = wasm.webhandle_get_playing(this.__wbg_ptr, ptr0, len0);
+ return ret === 0xFFFFFF ? undefined : ret !== 0;
+ }
+ /**
+ * @param {string} recording_id
+ * @param {string} timeline_name
+ * @returns {number | undefined}
+ */
+ get_time_for_timeline(recording_id, timeline_name) {
+ const ptr0 = passStringToWasm0(recording_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ const ptr1 = passStringToWasm0(timeline_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ const ret = wasm.webhandle_get_time_for_timeline(this.__wbg_ptr, ptr0, len0, ptr1, len1);
+ return ret[0] === 0 ? undefined : ret[1];
+ }
+ /**
+ * @param {string} recording_id
+ * @param {string} timeline_name
+ * @returns {any}
+ */
+ get_timeline_time_range(recording_id, timeline_name) {
+ const ptr0 = passStringToWasm0(recording_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ const ptr1 = passStringToWasm0(timeline_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ const ret = wasm.webhandle_get_timeline_time_range(this.__wbg_ptr, ptr0, len0, ptr1, len1);
+ return ret;
+ }
+ /**
+ * @returns {boolean}
+ */
+ has_panicked() {
+ const ret = wasm.webhandle_has_panicked(this.__wbg_ptr);
+ return ret !== 0;
+ }
+ /**
+ * Handle an encoded `egui_inspection` request.
+ * @param {Uint8Array} request_bytes
+ * @returns {Promise<Uint8Array>}
+ */
+ inspect(request_bytes) {
+ const ptr0 = passArray8ToWasm0(request_bytes, wasm.__wbindgen_malloc);
+ const len0 = WASM_VECTOR_LEN;
+ const ret = wasm.webhandle_inspect(this.__wbg_ptr, ptr0, len0);
+ return ret;
+ }
+ /**
+ * @param {any} app_options
+ */
+ constructor(app_options) {
+ const ret = wasm.webhandle_new(app_options);
+ if (ret[2]) {
+ throw takeFromExternrefTable0(ret[1]);
+ }
+ this.__wbg_ptr = ret[0];
+ WebHandleFinalization.register(this, this.__wbg_ptr, this);
+ return this;
+ }
+ /**
+ * Open a new channel for streaming data.
+ *
+ * It is an error to open a channel twice with the same id.
+ * @param {string} id
+ * @param {string} channel_name
+ */
+ open_channel(id, channel_name) {
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ const ptr1 = passStringToWasm0(channel_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ wasm.webhandle_open_channel(this.__wbg_ptr, ptr0, len0, ptr1, len1);
+ }
+ /**
+ * @param {string} panel
+ * @param {string | null} [state]
+ */
+ override_panel_state(panel, state) {
+ const ptr0 = passStringToWasm0(panel, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ var ptr1 = isLikeNone(state) ? 0 : passStringToWasm0(state, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ var len1 = WASM_VECTOR_LEN;
+ const ret = wasm.webhandle_override_panel_state(this.__wbg_ptr, ptr0, len0, ptr1, len1);
+ if (ret[1]) {
+ throw takeFromExternrefTable0(ret[0]);
+ }
+ }
+ /**
+ * @returns {string | undefined}
+ */
+ panic_callstack() {
+ const ret = wasm.webhandle_panic_callstack(this.__wbg_ptr);
+ let v1;
+ if (ret[0] !== 0) {
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
+ }
+ return v1;
+ }
+ /**
+ * @returns {string | undefined}
+ */
+ panic_message() {
+ const ret = wasm.webhandle_panic_message(this.__wbg_ptr);
+ let v1;
+ if (ret[0] !== 0) {
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
+ }
+ return v1;
+ }
+ /**
+ * @param {string} url
+ */
+ remove_receiver(url) {
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ wasm.webhandle_remove_receiver(this.__wbg_ptr, ptr0, len0);
+ }
+ /**
+ * Encode the active blueprint as RRD data.
+ * @returns {Uint8Array}
+ */
+ save_blueprint() {
+ const ret = wasm.webhandle_save_blueprint(this.__wbg_ptr);
+ if (ret[3]) {
+ throw takeFromExternrefTable0(ret[2]);
+ }
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
+ return v1;
+ }
+ /**
+ * Encode the active recording as RRD data.
+ * @returns {Uint8Array}
+ */
+ save_recording() {
+ const ret = wasm.webhandle_save_recording(this.__wbg_ptr);
+ if (ret[3]) {
+ throw takeFromExternrefTable0(ret[2]);
+ }
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
+ return v1;
+ }
+ /**
+ * Add an rrd to the viewer directly from a byte array.
+ * @param {string} id
+ * @param {Uint8Array} data
+ */
+ send_rrd_to_channel(id, data) {
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
+ const len1 = WASM_VECTOR_LEN;
+ wasm.webhandle_send_rrd_to_channel(this.__wbg_ptr, ptr0, len0, ptr1, len1);
+ }
+ /**
+ * @param {string} id
+ * @param {Uint8Array} data
+ */
+ send_table_to_channel(id, data) {
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
+ const len1 = WASM_VECTOR_LEN;
+ wasm.webhandle_send_table_to_channel(this.__wbg_ptr, ptr0, len0, ptr1, len1);
+ }
+ /**
+ * @param {string} recording_id
+ */
+ set_active_recording_id(recording_id) {
+ const ptr0 = passStringToWasm0(recording_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ wasm.webhandle_set_active_recording_id(this.__wbg_ptr, ptr0, len0);
+ }
+ /**
+ * Set the active timeline.
+ *
+ * This does nothing if the timeline can't be found.
+ * @param {string} recording_id
+ * @param {string} timeline_name
+ */
+ set_active_timeline(recording_id, timeline_name) {
+ const ptr0 = passStringToWasm0(recording_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ const ptr1 = passStringToWasm0(timeline_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ wasm.webhandle_set_active_timeline(this.__wbg_ptr, ptr0, len0, ptr1, len1);
+ }
+ /**
+ * @param {string} access_token
+ * @param {string} email
+ */
+ set_credentials(access_token, email) {
+ const ptr0 = passStringToWasm0(access_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ const ptr1 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ wasm.webhandle_set_credentials(this.__wbg_ptr, ptr0, len0, ptr1, len1);
+ }
+ /**
+ * @param {string} recording_id
+ * @param {boolean} value
+ */
+ set_playing(recording_id, value) {
+ const ptr0 = passStringToWasm0(recording_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ wasm.webhandle_set_playing(this.__wbg_ptr, ptr0, len0, value);
+ }
+ /**
+ * @param {string} recording_id
+ * @param {string} timeline_name
+ * @param {number} time
+ */
+ set_time_for_timeline(recording_id, timeline_name, time) {
+ const ptr0 = passStringToWasm0(recording_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len0 = WASM_VECTOR_LEN;
+ const ptr1 = passStringToWasm0(timeline_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ wasm.webhandle_set_time_for_timeline(this.__wbg_ptr, ptr0, len0, ptr1, len1, time);
+ }
+ /**
+ * @param {any} canvas
+ * @returns {Promise<void>}
+ */
+ start(canvas) {
+ const ret = wasm.webhandle_start(this.__wbg_ptr, canvas);
+ return ret;
+ }
+ /**
+ * @param {boolean | null} [value]
+ */
+ toggle_panel_overrides(value) {
+ wasm.webhandle_toggle_panel_overrides(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value ? 1 : 0);
+ }
+ }
+ if (Symbol.dispose) WebHandle.prototype[Symbol.dispose] = WebHandle.prototype.free;
+ exports.WebHandle = WebHandle;
+ function __wbg_get_imports() {
+ const import0 = {
+ __proto__: null,
+ __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
+ const ret = Error(getStringFromWasm0(arg0, arg1));
+ return ret;
+ },
+ __wbg_Number_9a4e0ecb0fa16705: function(arg0) {
+ const ret = Number(arg0);
+ return ret;
+ },
+ __wbg_Window_afcc911b2f9c92e2: function(arg0) {
+ const ret = arg0.Window;
+ return ret;
+ },
+ __wbg_WorkerGlobalScope_5d19ebc889ff397e: function(arg0) {
+ const ret = arg0.WorkerGlobalScope;
+ return ret;
+ },
+ __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
+ const v = arg0;
+ const ret = typeof(v) === 'boolean' ? v : undefined;
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
+ },
+ __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
+ const ret = debugString(arg1);
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
+ const ret = arg0 in arg1;
+ return ret;
+ },
+ __wbg___wbindgen_is_falsy_a6dfe792ff282f10: function(arg0) {
+ const ret = !arg0;
+ return ret;
+ },
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
+ const ret = typeof(arg0) === 'function';
+ return ret;
+ },
+ __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
+ const ret = arg0 === null;
+ return ret;
+ },
+ __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
+ const val = arg0;
+ const ret = typeof(val) === 'object' && val !== null;
+ return ret;
+ },
+ __wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
+ const ret = typeof(arg0) === 'string';
+ return ret;
+ },
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
+ const ret = arg0 === undefined;
+ return ret;
+ },
+ __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
+ const ret = arg0 == arg1;
+ return ret;
+ },
+ __wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
+ const obj = arg1;
+ const ret = typeof(obj) === 'number' ? obj : undefined;
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
+ },
+ __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
+ const obj = arg1;
+ const ret = typeof(obj) === 'string' ? obj : undefined;
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ var len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
+ throw new Error(getStringFromWasm0(arg0, arg1));
+ },
+ __wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
+ arg0._wbg_cb_unref();
+ },
+ __wbg_abort_807c9d22f53767f5: function(arg0) {
+ const ret = arg0.abort();
+ return ret;
+ },
+ __wbg_abort_8bae0f33e7833997: function(arg0) {
+ arg0.abort();
+ },
+ __wbg_abort_eee9248a6d680839: function(arg0, arg1) {
+ arg0.abort(arg1);
+ },
+ __wbg_activeElement_4bc99dc1a7094c27: function(arg0) {
+ const ret = arg0.activeElement;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_activeElement_b85d218c5f49326e: function(arg0) {
+ const ret = arg0.activeElement;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_activeTexture_92b04d918019d603: function(arg0, arg1) {
+ arg0.activeTexture(arg1 >>> 0);
+ },
+ __wbg_activeTexture_d12958674e97a118: function(arg0, arg1) {
+ arg0.activeTexture(arg1 >>> 0);
+ },
+ __wbg_addEventListener_520e749bbae24529: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
+ arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3, arg4);
+ }, arguments); },
+ __wbg_addEventListener_d85450ee1320c989: function() { return handleError(function (arg0, arg1, arg2, arg3) {
+ arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3);
+ }, arguments); },
+ __wbg_altKey_50f830d1793a2eea: function(arg0) {
+ const ret = arg0.altKey;
+ return ret;
+ },
+ __wbg_altKey_f3e24c4c9cfcf271: function(arg0) {
+ const ret = arg0.altKey;
+ return ret;
+ },
+ __wbg_appendChild_f553e8704c4f14a6: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.appendChild(arg1);
+ return ret;
+ }, arguments); },
+ __wbg_append_01c74e5c6b58aa64: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
+ }, arguments); },
+ __wbg_append_1e60bd927c609246: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
+ },
+ __wbg_arrayBuffer_3b637f0fa65c5351: function() { return handleError(function (arg0) {
+ const ret = arg0.arrayBuffer();
+ return ret;
+ }, arguments); },
+ __wbg_arrayBuffer_a158e423a87ee756: function(arg0) {
+ const ret = arg0.arrayBuffer();
+ return ret;
+ },
+ __wbg_assign_7e262bdaf75bb707: function() { return handleError(function (arg0, arg1, arg2) {
+ arg0.assign(getStringFromWasm0(arg1, arg2));
+ }, arguments); },
+ __wbg_at_031a0b72e465b17e: function(arg0, arg1) {
+ const ret = arg0.at(arg1);
+ return ret;
+ },
+ __wbg_attachShader_5f7f4077e124e23b: function(arg0, arg1, arg2) {
+ arg0.attachShader(arg1, arg2);
+ },
+ __wbg_attachShader_8971266b4c9bc514: function(arg0, arg1, arg2) {
+ arg0.attachShader(arg1, arg2);
+ },
+ __wbg_back_939cbdbdfad8aff7: function() { return handleError(function (arg0) {
+ arg0.back();
+ }, arguments); },
+ __wbg_beginQuery_042a1f99e870066c: function(arg0, arg1, arg2) {
+ arg0.beginQuery(arg1 >>> 0, arg2);
+ },
+ __wbg_beginRenderPass_aa22c432e793359a: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.beginRenderPass(arg1);
+ return ret;
+ }, arguments); },
+ __wbg_bindAttribLocation_0fe5da7e01ac0d15: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.bindAttribLocation(arg1, arg2 >>> 0, getStringFromWasm0(arg3, arg4));
+ },
+ __wbg_bindAttribLocation_94202d7a59ab7863: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.bindAttribLocation(arg1, arg2 >>> 0, getStringFromWasm0(arg3, arg4));
+ },
+ __wbg_bindBufferRange_f5c29912db0476e9: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.bindBufferRange(arg1 >>> 0, arg2 >>> 0, arg3, arg4, arg5);
+ },
+ __wbg_bindBuffer_1e00cfb4321ef9a4: function(arg0, arg1, arg2) {
+ arg0.bindBuffer(arg1 >>> 0, arg2);
+ },
+ __wbg_bindBuffer_a01497b1abdcdd9a: function(arg0, arg1, arg2) {
+ arg0.bindBuffer(arg1 >>> 0, arg2);
+ },
+ __wbg_bindFramebuffer_390311eff3896937: function(arg0, arg1, arg2) {
+ arg0.bindFramebuffer(arg1 >>> 0, arg2);
+ },
+ __wbg_bindFramebuffer_658e4b06f7ee8bb4: function(arg0, arg1, arg2) {
+ arg0.bindFramebuffer(arg1 >>> 0, arg2);
+ },
+ __wbg_bindRenderbuffer_75e8469e930840fa: function(arg0, arg1, arg2) {
+ arg0.bindRenderbuffer(arg1 >>> 0, arg2);
+ },
+ __wbg_bindRenderbuffer_c3d0c4b8cd1c3891: function(arg0, arg1, arg2) {
+ arg0.bindRenderbuffer(arg1 >>> 0, arg2);
+ },
+ __wbg_bindSampler_ce608f0de9d31acf: function(arg0, arg1, arg2) {
+ arg0.bindSampler(arg1 >>> 0, arg2);
+ },
+ __wbg_bindTexture_28eff4bbd8aaab54: function(arg0, arg1, arg2) {
+ arg0.bindTexture(arg1 >>> 0, arg2);
+ },
+ __wbg_bindTexture_9b04b1b7c00d4dd6: function(arg0, arg1, arg2) {
+ arg0.bindTexture(arg1 >>> 0, arg2);
+ },
+ __wbg_bindVertexArrayOES_5cad2205a17e8990: function(arg0, arg1) {
+ arg0.bindVertexArrayOES(arg1);
+ },
+ __wbg_bindVertexArray_427eeac0c1764d8a: function(arg0, arg1) {
+ arg0.bindVertexArray(arg1);
+ },
+ __wbg_blendColor_793b560dc69ddd0b: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.blendColor(arg1, arg2, arg3, arg4);
+ },
+ __wbg_blendColor_eae0cd578a2c7d15: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.blendColor(arg1, arg2, arg3, arg4);
+ },
+ __wbg_blendEquationSeparate_043e2f50f6ecb2d3: function(arg0, arg1, arg2) {
+ arg0.blendEquationSeparate(arg1 >>> 0, arg2 >>> 0);
+ },
+ __wbg_blendEquationSeparate_c7e2b2261c94e1c5: function(arg0, arg1, arg2) {
+ arg0.blendEquationSeparate(arg1 >>> 0, arg2 >>> 0);
+ },
+ __wbg_blendEquation_455b8986ededabc0: function(arg0, arg1) {
+ arg0.blendEquation(arg1 >>> 0);
+ },
+ __wbg_blendEquation_f5c5272993f6cb01: function(arg0, arg1) {
+ arg0.blendEquation(arg1 >>> 0);
+ },
+ __wbg_blendFuncSeparate_37156309688f8f88: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.blendFuncSeparate(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0);
+ },
+ __wbg_blendFuncSeparate_3ee6d939a9f3938b: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.blendFuncSeparate(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0);
+ },
+ __wbg_blendFunc_114dc7056ccfeb8d: function(arg0, arg1, arg2) {
+ arg0.blendFunc(arg1 >>> 0, arg2 >>> 0);
+ },
+ __wbg_blendFunc_a854d7e4459150ba: function(arg0, arg1, arg2) {
+ arg0.blendFunc(arg1 >>> 0, arg2 >>> 0);
+ },
+ __wbg_blitFramebuffer_a1215976f663b058: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) {
+ arg0.blitFramebuffer(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10 >>> 0);
+ },
+ __wbg_blockSize_5af477b962b2b031: function(arg0) {
+ const ret = arg0.blockSize;
+ return ret;
+ },
+ __wbg_blur_e902dcc79406e89c: function() { return handleError(function (arg0) {
+ arg0.blur();
+ }, arguments); },
+ __wbg_body_18c9f2ac15ead4b2: function(arg0) {
+ const ret = arg0.body;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_body_40ec34e0a2931fe8: function(arg0) {
+ const ret = arg0.body;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_bottom_e6ed49b80d965dae: function(arg0) {
+ const ret = arg0.bottom;
+ return ret;
+ },
+ __wbg_bufferData_073a7c6abef7a55f: function(arg0, arg1, arg2, arg3) {
+ arg0.bufferData(arg1 >>> 0, arg2, arg3 >>> 0);
+ },
+ __wbg_bufferData_3d4f29bdfb1fa46c: function(arg0, arg1, arg2, arg3) {
+ arg0.bufferData(arg1 >>> 0, arg2, arg3 >>> 0);
+ },
+ __wbg_bufferData_90ef588bac2be2f5: function(arg0, arg1, arg2, arg3) {
+ arg0.bufferData(arg1 >>> 0, arg2, arg3 >>> 0);
+ },
+ __wbg_bufferData_ce4f44d56e9ddab5: function(arg0, arg1, arg2, arg3) {
+ arg0.bufferData(arg1 >>> 0, arg2, arg3 >>> 0);
+ },
+ __wbg_bufferSubData_bae930b21e9c1c48: function(arg0, arg1, arg2, arg3) {
+ arg0.bufferSubData(arg1 >>> 0, arg2, arg3);
+ },
+ __wbg_bufferSubData_ce9854d3d337e2cf: function(arg0, arg1, arg2, arg3) {
+ arg0.bufferSubData(arg1 >>> 0, arg2, arg3);
+ },
+ __wbg_buffer_54b87055582c8a81: function(arg0) {
+ const ret = arg0.buffer;
+ return ret;
+ },
+ __wbg_button_f6a9a7b725f1838e: function(arg0) {
+ const ret = arg0.button;
+ return ret;
+ },
+ __wbg_byobRequest_06b654bb15590436: function(arg0) {
+ const ret = arg0.byobRequest;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_byteLength_41862ca4020b9c43: function(arg0) {
+ const ret = arg0.byteLength;
+ return ret;
+ },
+ __wbg_byteOffset_d42e18c4441f628b: function(arg0) {
+ const ret = arg0.byteOffset;
+ return ret;
+ },
+ __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.call(arg1);
+ return ret;
+ }, arguments); },
+ __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.call(arg1, arg2);
+ return ret;
+ }, arguments); },
+ __wbg_cancelAnimationFrame_086d6084925c4e06: function() { return handleError(function (arg0, arg1) {
+ frame_scheduler.cancel(arg1);
+ }, arguments); },
+ __wbg_cancel_3983a93e24cc66b3: function(arg0) {
+ const ret = arg0.cancel();
+ return ret;
+ },
+ __wbg_catch_c1a60df4c30d76d3: function(arg0, arg1) {
+ const ret = arg0.catch(arg1);
+ return ret;
+ },
+ __wbg_changedTouches_dbf6eeabddd3c2da: function(arg0) {
+ const ret = arg0.changedTouches;
+ return ret;
+ },
+ __wbg_clearBufferfv_2e0f1a0ea56de859: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.clearBufferfv(arg1 >>> 0, arg2, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_clearBufferiv_0360269bf6e34c54: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.clearBufferiv(arg1 >>> 0, arg2, getArrayI32FromWasm0(arg3, arg4));
+ },
+ __wbg_clearBufferuiv_df94a395d4915377: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.clearBufferuiv(arg1 >>> 0, arg2, getArrayU32FromWasm0(arg3, arg4));
+ },
+ __wbg_clearDepth_8b5d226aae155082: function(arg0, arg1) {
+ arg0.clearDepth(arg1);
+ },
+ __wbg_clearDepth_ca9b22d41551b513: function(arg0, arg1) {
+ arg0.clearDepth(arg1);
+ },
+ __wbg_clearInterval_2e2069e95ad09d4f: function(arg0, arg1) {
+ arg0.clearInterval(arg1);
+ },
+ __wbg_clearStencil_58f2af46612bccae: function(arg0, arg1) {
+ arg0.clearStencil(arg1);
+ },
+ __wbg_clearStencil_a66fe23df6313fc7: function(arg0, arg1) {
+ arg0.clearStencil(arg1);
+ },
+ __wbg_clearTimeout_6b8d9a38b9263d65: function(arg0) {
+ const ret = clearTimeout(arg0);
+ return ret;
+ },
+ __wbg_clearTimeout_8f80437be2324e09: function(arg0, arg1) {
+ arg0.clearTimeout(arg1);
+ },
+ __wbg_clearTimeout_ef38e23d3d8f7baf: function(arg0) {
+ const ret = clearTimeout(arg0);
+ return ret;
+ },
+ __wbg_clear_53d71d234e14e4c1: function(arg0, arg1) {
+ arg0.clear(arg1 >>> 0);
+ },
+ __wbg_clear_dd06a0da4ce8e13f: function(arg0, arg1) {
+ arg0.clear(arg1 >>> 0);
+ },
+ __wbg_click_22281da934e153f5: function(arg0) {
+ arg0.click();
+ },
+ __wbg_clientWaitSync_cf8e49f8ba228377: function(arg0, arg1, arg2, arg3) {
+ const ret = arg0.clientWaitSync(arg1, arg2 >>> 0, arg3 >>> 0);
+ return ret;
+ },
+ __wbg_clientX_c396b0fb11d601d3: function(arg0) {
+ const ret = arg0.clientX;
+ return ret;
+ },
+ __wbg_clientX_e8c6c674634344de: function(arg0) {
+ const ret = arg0.clientX;
+ return ret;
+ },
+ __wbg_clientY_a4650836fdf58f01: function(arg0) {
+ const ret = arg0.clientY;
+ return ret;
+ },
+ __wbg_clientY_ffea953797502d5d: function(arg0) {
+ const ret = arg0.clientY;
+ return ret;
+ },
+ __wbg_clipboardData_b99e24e2d915217c: function(arg0) {
+ const ret = arg0.clipboardData;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_clipboard_cc7335fcba1a9a80: function(arg0) {
+ const ret = arg0.clipboard;
+ return ret;
+ },
+ __wbg_close_1f3dc5faf2043944: function() { return handleError(function (arg0) {
+ arg0.close();
+ }, arguments); },
+ __wbg_close_249a23304523681b: function() { return handleError(function (arg0) {
+ arg0.close();
+ }, arguments); },
+ __wbg_close_72d318d9c16e83ef: function() { return handleError(function (arg0) {
+ arg0.close();
+ }, arguments); },
+ __wbg_close_90cc288ec0e6eb50: function() { return handleError(function (arg0) {
+ arg0.close();
+ }, arguments); },
+ __wbg_close_adb3a7073894d04e: function(arg0) {
+ arg0.close();
+ },
+ __wbg_closed_a9e0ba86bfa233c0: function() { return handleError(function (arg0) {
+ const ret = arg0.closed;
+ return ret;
+ }, arguments); },
+ __wbg_code_89c999e407c79eef: function(arg0, arg1) {
+ const ret = arg1.code;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_code_cb4327cfc515673b: function(arg0) {
+ const ret = arg0.code;
+ return ret;
+ },
+ __wbg_colorMask_44ebb91cad2502f2: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.colorMask(arg1 !== 0, arg2 !== 0, arg3 !== 0, arg4 !== 0);
+ },
+ __wbg_colorMask_a4d164c2039b5731: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.colorMask(arg1 !== 0, arg2 !== 0, arg3 !== 0, arg4 !== 0);
+ },
+ __wbg_compileShader_9bdfd792722cf704: function(arg0, arg1) {
+ arg0.compileShader(arg1);
+ },
+ __wbg_compileShader_fc2e4b73240d4fd7: function(arg0, arg1) {
+ arg0.compileShader(arg1);
+ },
+ __wbg_compressedTexSubImage2D_c1362291573c7268: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.compressedTexSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8, arg9);
+ },
+ __wbg_compressedTexSubImage2D_da01674d2975d1ae: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
+ arg0.compressedTexSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8);
+ },
+ __wbg_compressedTexSubImage2D_dd6dc580749eb5cf: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
+ arg0.compressedTexSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8);
+ },
+ __wbg_compressedTexSubImage3D_04cb8b046c4321fe: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
+ arg0.compressedTexSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10, arg11);
+ },
+ __wbg_compressedTexSubImage3D_af0228a80ffd5993: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) {
+ arg0.compressedTexSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10);
+ },
+ __wbg_configure_0e4789c0f6b35c8e: function() { return handleError(function (arg0, arg1) {
+ arg0.configure(arg1);
+ }, arguments); },
+ __wbg_configure_84a31356970a404e: function() { return handleError(function (arg0, arg1) {
+ arg0.configure(arg1);
+ }, arguments); },
+ __wbg_contentBoxSize_74fbbc51859ff90e: function(arg0) {
+ const ret = arg0.contentBoxSize;
+ return ret;
+ },
+ __wbg_contentRect_1d6e15e2e0d3e3c3: function(arg0) {
+ const ret = arg0.contentRect;
+ return ret;
+ },
+ __wbg_copyBufferSubData_cdf61f74aa6e0902: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.copyBufferSubData(arg1 >>> 0, arg2 >>> 0, arg3, arg4, arg5);
+ },
+ __wbg_copyBufferToBuffer_5e2cd8f10ae78183: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
+ arg0.copyBufferToBuffer(arg1, arg2, arg3, arg4);
+ }, arguments); },
+ __wbg_copyBufferToBuffer_ca30deb8de65f5d5: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.copyBufferToBuffer(arg1, arg2, arg3, arg4, arg5);
+ }, arguments); },
+ __wbg_copyBufferToTexture_29b9d26780296819: function() { return handleError(function (arg0, arg1, arg2, arg3) {
+ arg0.copyBufferToTexture(arg1, arg2, arg3);
+ }, arguments); },
+ __wbg_copyExternalImageToTexture_4df105bb39517948: function() { return handleError(function (arg0, arg1, arg2, arg3) {
+ arg0.copyExternalImageToTexture(arg1, arg2, arg3);
+ }, arguments); },
+ __wbg_copyTexSubImage2D_8daea651fc408645: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
+ arg0.copyTexSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+ },
+ __wbg_copyTexSubImage2D_c73f91f1d7022402: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
+ arg0.copyTexSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+ },
+ __wbg_copyTexSubImage3D_bfe7a14dac9ad777: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.copyTexSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+ },
+ __wbg_copyTextureToBuffer_ed6e67a77ecb768d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
+ arg0.copyTextureToBuffer(arg1, arg2, arg3);
+ }, arguments); },
+ __wbg_createBindGroupLayout_49a7e2b3d076afcf: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.createBindGroupLayout(arg1);
+ return ret;
+ }, arguments); },
+ __wbg_createBindGroup_655c6e6c0258530e: function(arg0, arg1) {
+ const ret = arg0.createBindGroup(arg1);
+ return ret;
+ },
+ __wbg_createBuffer_01568a9d930d90dd: function(arg0) {
+ const ret = arg0.createBuffer();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createBuffer_0726dd2ab09ea1d2: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.createBuffer(arg1);
+ return ret;
+ }, arguments); },
+ __wbg_createBuffer_2075765bde5035d5: function(arg0) {
+ const ret = arg0.createBuffer();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createCommandEncoder_ec1f40f0cb4d09df: function(arg0, arg1) {
+ const ret = arg0.createCommandEncoder(arg1);
+ return ret;
+ },
+ __wbg_createElement_fcbc0805de826d62: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.createElement(getStringFromWasm0(arg1, arg2));
+ return ret;
+ }, arguments); },
+ __wbg_createFramebuffer_b24d2c80a8b9e7cc: function(arg0) {
+ const ret = arg0.createFramebuffer();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createFramebuffer_de0d521f546e7534: function(arg0) {
+ const ret = arg0.createFramebuffer();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createImageBitmap_5dbcdc6d11d377bd: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.createImageBitmap(arg1);
+ return ret;
+ }, arguments); },
+ __wbg_createObjectURL_416e527781e6fd6d: function() { return handleError(function (arg0, arg1) {
+ const ret = URL.createObjectURL(arg1);
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_createPipelineLayout_2c8cd4528b06c108: function(arg0, arg1) {
+ const ret = arg0.createPipelineLayout(arg1);
+ return ret;
+ },
+ __wbg_createProgram_118becaac3a20318: function(arg0) {
+ const ret = arg0.createProgram();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createProgram_538c9777a4ac084f: function(arg0) {
+ const ret = arg0.createProgram();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createQuery_047c7c524e4ac4f8: function(arg0) {
+ const ret = arg0.createQuery();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createRenderPipeline_cf98d4d699bfb03c: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.createRenderPipeline(arg1);
+ return ret;
+ }, arguments); },
+ __wbg_createRenderbuffer_71af5c0d615e9271: function(arg0) {
+ const ret = arg0.createRenderbuffer();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createRenderbuffer_9d801bf44c314f44: function(arg0) {
+ const ret = arg0.createRenderbuffer();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createSampler_70c8392d98896235: function(arg0) {
+ const ret = arg0.createSampler();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createSampler_c8ffb3c8d565f704: function(arg0, arg1) {
+ const ret = arg0.createSampler(arg1);
+ return ret;
+ },
+ __wbg_createShaderModule_2e44fc7677c6288b: function(arg0, arg1) {
+ const ret = arg0.createShaderModule(arg1);
+ return ret;
+ },
+ __wbg_createShader_78bc8b7e9a88e1a8: function(arg0, arg1) {
+ const ret = arg0.createShader(arg1 >>> 0);
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createShader_7d139f2d50f77365: function(arg0, arg1) {
+ const ret = arg0.createShader(arg1 >>> 0);
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createTexture_0ee0fa5f924f3d14: function(arg0) {
+ const ret = arg0.createTexture();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createTexture_1bac74c999b8a48e: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.createTexture(arg1);
+ return ret;
+ }, arguments); },
+ __wbg_createTexture_d13f98e0d3d912f4: function(arg0) {
+ const ret = arg0.createTexture();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createVertexArrayOES_2fa3e59eebd5f674: function(arg0) {
+ const ret = arg0.createVertexArrayOES();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createVertexArray_baf9eef7ea5a2c7a: function(arg0) {
+ const ret = arg0.createVertexArray();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_createView_ceaf2f5881adbd34: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.createView(arg1);
+ return ret;
+ }, arguments); },
+ __wbg_createWritable_659288d5245034d3: function(arg0) {
+ const ret = arg0.createWritable();
+ return ret;
+ },
+ __wbg_ctrlKey_2e52816fa7160097: function(arg0) {
+ const ret = arg0.ctrlKey;
+ return ret;
+ },
+ __wbg_ctrlKey_50bd8324959ca786: function(arg0) {
+ const ret = arg0.ctrlKey;
+ return ret;
+ },
+ __wbg_cullFace_62bbea3bef0e6b99: function(arg0, arg1) {
+ arg0.cullFace(arg1 >>> 0);
+ },
+ __wbg_cullFace_f1c75ae19b07eaf3: function(arg0, arg1) {
+ arg0.cullFace(arg1 >>> 0);
+ },
+ __wbg_dataTransfer_c1c4745cee7e05f1: function(arg0) {
+ const ret = arg0.dataTransfer;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_data_328de4280640da92: function(arg0) {
+ const ret = arg0.data;
+ return ret;
+ },
+ __wbg_debug_87fd9b1a625b7efb: function(arg0) {
+ console.debug(arg0);
+ },
+ __wbg_debug_cf53e2612c84e4ee: function(arg0, arg1, arg2, arg3) {
+ console.debug(arg0, arg1, arg2, arg3);
+ },
+ __wbg_decode_02f9ccfc83b87859: function() { return handleError(function (arg0, arg1) {
+ arg0.decode(arg1);
+ }, arguments); },
+ __wbg_deleteBuffer_08eb938e35c27967: function(arg0, arg1) {
+ arg0.deleteBuffer(arg1);
+ },
+ __wbg_deleteBuffer_1ca3ffe668a488e7: function(arg0, arg1) {
+ arg0.deleteBuffer(arg1);
+ },
+ __wbg_deleteFramebuffer_963cd69957209d37: function(arg0, arg1) {
+ arg0.deleteFramebuffer(arg1);
+ },
+ __wbg_deleteFramebuffer_d1a36e889b009344: function(arg0, arg1) {
+ arg0.deleteFramebuffer(arg1);
+ },
+ __wbg_deleteProgram_09bd45a51105b2f6: function(arg0, arg1) {
+ arg0.deleteProgram(arg1);
+ },
+ __wbg_deleteProgram_132e191baa9fa84f: function(arg0, arg1) {
+ arg0.deleteProgram(arg1);
+ },
+ __wbg_deleteQuery_0d1dcc4402a86ee1: function(arg0, arg1) {
+ arg0.deleteQuery(arg1);
+ },
+ __wbg_deleteRenderbuffer_52bdbf5ab2cbe62a: function(arg0, arg1) {
+ arg0.deleteRenderbuffer(arg1);
+ },
+ __wbg_deleteRenderbuffer_ca999f7883b777af: function(arg0, arg1) {
+ arg0.deleteRenderbuffer(arg1);
+ },
+ __wbg_deleteSampler_0abb528566c4ab3b: function(arg0, arg1) {
+ arg0.deleteSampler(arg1);
+ },
+ __wbg_deleteShader_3120790d36063afe: function(arg0, arg1) {
+ arg0.deleteShader(arg1);
+ },
+ __wbg_deleteShader_993edb4beb3c4d53: function(arg0, arg1) {
+ arg0.deleteShader(arg1);
+ },
+ __wbg_deleteSync_9b0e43580942a0f6: function(arg0, arg1) {
+ arg0.deleteSync(arg1);
+ },
+ __wbg_deleteTexture_2b163b157ea1be24: function(arg0, arg1) {
+ arg0.deleteTexture(arg1);
+ },
+ __wbg_deleteTexture_bdc2202d7a50dcea: function(arg0, arg1) {
+ arg0.deleteTexture(arg1);
+ },
+ __wbg_deleteVertexArrayOES_7fa59c32cfdfa6fa: function(arg0, arg1) {
+ arg0.deleteVertexArrayOES(arg1);
+ },
+ __wbg_deleteVertexArray_475d4e969aac1dd0: function(arg0, arg1) {
+ arg0.deleteVertexArray(arg1);
+ },
+ __wbg_delete_50c5af3bd629e1bf: function() { return handleError(function (arg0, arg1, arg2) {
+ delete arg0[getStringFromWasm0(arg1, arg2)];
+ }, arguments); },
+ __wbg_deltaMode_d869228efd74f393: function(arg0) {
+ const ret = arg0.deltaMode;
+ return ret;
+ },
+ __wbg_deltaX_5d829ffba565ed10: function(arg0) {
+ const ret = arg0.deltaX;
+ return ret;
+ },
+ __wbg_deltaY_6cfce8f8da250c23: function(arg0) {
+ const ret = arg0.deltaY;
+ return ret;
+ },
+ __wbg_depthFunc_455cfeb8a9d2fb4c: function(arg0, arg1) {
+ arg0.depthFunc(arg1 >>> 0);
+ },
+ __wbg_depthFunc_74a8f8acf8973c86: function(arg0, arg1) {
+ arg0.depthFunc(arg1 >>> 0);
+ },
+ __wbg_depthMask_4bd6c73b1339d257: function(arg0, arg1) {
+ arg0.depthMask(arg1 !== 0);
+ },
+ __wbg_depthMask_a644a67deced3257: function(arg0, arg1) {
+ arg0.depthMask(arg1 !== 0);
+ },
+ __wbg_depthRange_38b2287ffbea14fd: function(arg0, arg1, arg2) {
+ arg0.depthRange(arg1, arg2);
+ },
+ __wbg_depthRange_5e90d4d236280ff5: function(arg0, arg1, arg2) {
+ arg0.depthRange(arg1, arg2);
+ },
+ __wbg_description_02485704e69b1e7f: function(arg0, arg1) {
+ const ret = arg1.description;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_destroy_7ae6d79c9c5ca8d9: function(arg0) {
+ arg0.destroy();
+ },
+ __wbg_destroy_fe937f756bf8df37: function(arg0) {
+ arg0.destroy();
+ },
+ __wbg_devicePixelContentBoxSize_dca8701a53307aca: function(arg0) {
+ const ret = arg0.devicePixelContentBoxSize;
+ return ret;
+ },
+ __wbg_devicePixelRatio_1c0e0ed7deb19cd8: function(arg0) {
+ const ret = arg0.devicePixelRatio;
+ return ret;
+ },
+ __wbg_disableVertexAttribArray_160060fbd7e97de0: function(arg0, arg1) {
+ arg0.disableVertexAttribArray(arg1 >>> 0);
+ },
+ __wbg_disableVertexAttribArray_c7915eb0de6dd8f1: function(arg0, arg1) {
+ arg0.disableVertexAttribArray(arg1 >>> 0);
+ },
+ __wbg_disable_1659d1b7d50c31e7: function(arg0, arg1) {
+ arg0.disable(arg1 >>> 0);
+ },
+ __wbg_disable_40c3975167c1ee07: function(arg0, arg1) {
+ arg0.disable(arg1 >>> 0);
+ },
+ __wbg_disconnect_39bfdcb35b1fc7b9: function(arg0) {
+ arg0.disconnect();
+ },
+ __wbg_displayHeight_f06554969d4d6de8: function(arg0) {
+ const ret = arg0.displayHeight;
+ return ret;
+ },
+ __wbg_displayWidth_fdcc0a114d98d13e: function(arg0) {
+ const ret = arg0.displayWidth;
+ return ret;
+ },
+ __wbg_document_179650d6cb13c263: function(arg0) {
+ const ret = arg0.document;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_done_89b2b13e91a60321: function(arg0) {
+ const ret = arg0.done;
+ return ret;
+ },
+ __wbg_drawArraysInstancedANGLE_d58dbd2d38fdebaa: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.drawArraysInstancedANGLE(arg1 >>> 0, arg2, arg3, arg4);
+ },
+ __wbg_drawArraysInstanced_51b161548a3f10c4: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.drawArraysInstanced(arg1 >>> 0, arg2, arg3, arg4);
+ },
+ __wbg_drawArrays_676becae0149ed65: function(arg0, arg1, arg2, arg3) {
+ arg0.drawArrays(arg1 >>> 0, arg2, arg3);
+ },
+ __wbg_drawArrays_b0c59a6e158122f2: function(arg0, arg1, arg2, arg3) {
+ arg0.drawArrays(arg1 >>> 0, arg2, arg3);
+ },
+ __wbg_drawBuffersWEBGL_c9b47f7f207125cf: function(arg0, arg1) {
+ arg0.drawBuffersWEBGL(arg1);
+ },
+ __wbg_drawBuffers_1c1ec9b292442a2a: function(arg0, arg1) {
+ arg0.drawBuffers(arg1);
+ },
+ __wbg_drawElementsInstancedANGLE_9b58c4013373b180: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.drawElementsInstancedANGLE(arg1 >>> 0, arg2, arg3 >>> 0, arg4, arg5);
+ },
+ __wbg_drawElementsInstanced_c7f96ea02e6d5326: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.drawElementsInstanced(arg1 >>> 0, arg2, arg3 >>> 0, arg4, arg5);
+ },
+ __wbg_drawIndexed_d31913e79d58fbac: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.drawIndexed(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4, arg5 >>> 0);
+ },
+ __wbg_draw_6877f98847e1e36c: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.draw(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0);
+ },
+ __wbg_elementFromPoint_082557ad1c446761: function(arg0, arg1, arg2) {
+ const ret = arg0.elementFromPoint(arg1, arg2);
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_elementFromPoint_49d780c87b3d05b7: function(arg0, arg1, arg2) {
+ const ret = arg0.elementFromPoint(arg1, arg2);
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_enableVertexAttribArray_4c08219124740f14: function(arg0, arg1) {
+ arg0.enableVertexAttribArray(arg1 >>> 0);
+ },
+ __wbg_enableVertexAttribArray_7470ba2dcf2606e3: function(arg0, arg1) {
+ arg0.enableVertexAttribArray(arg1 >>> 0);
+ },
+ __wbg_enable_28bbeed576131d1f: function(arg0, arg1) {
+ arg0.enable(arg1 >>> 0);
+ },
+ __wbg_enable_611804c0ac1504ce: function(arg0, arg1) {
+ arg0.enable(arg1 >>> 0);
+ },
+ __wbg_endQuery_a50f7fc49cfe56e9: function(arg0, arg1) {
+ arg0.endQuery(arg1 >>> 0);
+ },
+ __wbg_end_f99ebed53d4e198a: function(arg0) {
+ arg0.end();
+ },
+ __wbg_enqueue_6d83b4c6281bafd6: function() { return handleError(function (arg0, arg1) {
+ arg0.enqueue(arg1);
+ }, arguments); },
+ __wbg_entries_015dc610cd81ede0: function(arg0) {
+ const ret = Object.entries(arg0);
+ return ret;
+ },
+ __wbg_error_622f41c5c32a13db: function(arg0) {
+ const ret = arg0.error;
+ return ret;
+ },
+ __wbg_error_657700d53a73881f: function(arg0, arg1, arg2, arg3) {
+ console.error(arg0, arg1, arg2, arg3);
+ },
+ __wbg_error_744744ff0c9861e6: function(arg0) {
+ console.error(arg0);
+ },
+ __wbg_error_7da16e6957d93dfc: function(arg0, arg1) {
+ let deferred0_0;
+ let deferred0_1;
+ try {
+ deferred0_0 = arg0;
+ deferred0_1 = arg1;
+ console.error(getStringFromWasm0(arg0, arg1));
+ } finally {
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
+ }
+ },
+ __wbg_features_2b07a28fe18ad0ce: function(arg0) {
+ const ret = arg0.features;
+ return ret;
+ },
+ __wbg_fenceSync_fe2cdba4a0d73679: function(arg0, arg1, arg2) {
+ const ret = arg0.fenceSync(arg1 >>> 0, arg2 >>> 0);
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_fetch_737feb0f4e4769cd: function(arg0, arg1) {
+ const ret = fetch(arg0, arg1);
+ return ret;
+ },
+ __wbg_fetch_9dad4fe911207b37: function(arg0) {
+ const ret = fetch(arg0);
+ return ret;
+ },
+ __wbg_fetch_b371b952a61cca04: function(arg0) {
+ const ret = fetch(arg0);
+ return ret;
+ },
+ __wbg_fetch_b5951fc96f52f786: function(arg0, arg1) {
+ const ret = arg0.fetch(arg1);
+ return ret;
+ },
+ __wbg_fetch_fadfd227089fdf80: function(arg0, arg1, arg2) {
+ const ret = arg0.fetch(arg1, arg2);
+ return ret;
+ },
+ __wbg_files_116196bc012ac3c8: function(arg0) {
+ const ret = arg0.files;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_files_a4eb87e5e4343c46: function(arg0) {
+ const ret = arg0.files;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_finish_126e6f2ac71e3096: function(arg0) {
+ arg0.finish();
+ },
+ __wbg_finish_4d91de5e927dd13f: function(arg0, arg1) {
+ const ret = arg0.finish(arg1);
+ return ret;
+ },
+ __wbg_finish_6e06b68ab68cd9f6: function(arg0) {
+ const ret = arg0.finish();
+ return ret;
+ },
+ __wbg_finish_cbe7ec8675dd7705: function(arg0) {
+ arg0.finish();
+ },
+ __wbg_flush_67fbd850838f4562: function(arg0) {
+ const ret = arg0.flush();
+ return ret;
+ },
+ __wbg_flush_db77b4a63d6b337d: function(arg0) {
+ arg0.flush();
+ },
+ __wbg_flush_e03c08da6863b5ab: function(arg0) {
+ arg0.flush();
+ },
+ __wbg_focus_5ecef5db03850e25: function() { return handleError(function (arg0, arg1) {
+ arg0.focus(arg1);
+ }, arguments); },
+ __wbg_force_368c1897f399d783: function(arg0) {
+ const ret = arg0.force;
+ return ret;
+ },
+ __wbg_forward_4bb54c7f45451c64: function() { return handleError(function (arg0) {
+ arg0.forward();
+ }, arguments); },
+ __wbg_framebufferRenderbuffer_4404cf9f9cb76937: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.framebufferRenderbuffer(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4);
+ },
+ __wbg_framebufferRenderbuffer_ba8bd5e008ee87eb: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.framebufferRenderbuffer(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4);
+ },
+ __wbg_framebufferTexture2D_3c2abd606fc53f31: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.framebufferTexture2D(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4, arg5);
+ },
+ __wbg_framebufferTexture2D_e1fb64212fcda219: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.framebufferTexture2D(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4, arg5);
+ },
+ __wbg_framebufferTextureLayer_f2d9db097bfbb863: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.framebufferTextureLayer(arg1 >>> 0, arg2 >>> 0, arg3, arg4, arg5);
+ },
+ __wbg_framebufferTextureMultiviewOVR_28d492b9dc484220: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
+ arg0.framebufferTextureMultiviewOVR(arg1 >>> 0, arg2 >>> 0, arg3, arg4, arg5, arg6);
+ },
+ __wbg_frontFace_29ef7151de8b5ed9: function(arg0, arg1) {
+ arg0.frontFace(arg1 >>> 0);
+ },
+ __wbg_frontFace_fc6d98dafa42de87: function(arg0, arg1) {
+ arg0.frontFace(arg1 >>> 0);
+ },
+ __wbg_getBindGroupLayout_8b86af56ae09c095: function(arg0, arg1) {
+ const ret = arg0.getBindGroupLayout(arg1 >>> 0);
+ return ret;
+ },
+ __wbg_getBoundingClientRect_e828e6c31c66dea6: function(arg0) {
+ const ret = arg0.getBoundingClientRect();
+ return ret;
+ },
+ __wbg_getBufferSubData_11018928c908ac2c: function(arg0, arg1, arg2, arg3) {
+ arg0.getBufferSubData(arg1 >>> 0, arg2, arg3);
+ },
+ __wbg_getComputedStyle_961681bdf7e518e8: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.getComputedStyle(arg1);
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ }, arguments); },
+ __wbg_getContext_7476e39fa008047e: function() { return handleError(function (arg0, arg1, arg2, arg3) {
+ const ret = arg0.getContext(getStringFromWasm0(arg1, arg2), arg3);
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ }, arguments); },
+ __wbg_getContext_ca12bb65aab778a4: function() { return handleError(function (arg0, arg1, arg2, arg3) {
+ const ret = arg0.getContext(getStringFromWasm0(arg1, arg2), arg3);
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ }, arguments); },
+ __wbg_getContext_e79ddf6a9cb3cc76: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.getContext(getStringFromWasm0(arg1, arg2));
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ }, arguments); },
+ __wbg_getContext_fd298c901058eb31: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.getContext(getStringFromWasm0(arg1, arg2));
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ }, arguments); },
+ __wbg_getCurrentTexture_20714d1bd9051cab: function() { return handleError(function (arg0) {
+ const ret = arg0.getCurrentTexture();
+ return ret;
+ }, arguments); },
+ __wbg_getData_fcb88fae21d94f1e: function() { return handleError(function (arg0, arg1, arg2, arg3) {
+ const ret = arg1.getData(getStringFromWasm0(arg2, arg3));
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_getDirectoryHandle_10036853d1aefa39: function(arg0, arg1, arg2) {
+ const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2));
+ return ret;
+ },
+ __wbg_getDirectoryHandle_cf175faf1a75a384: function(arg0, arg1, arg2, arg3) {
+ const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
+ return ret;
+ },
+ __wbg_getDirectory_389283588dfb8117: function(arg0) {
+ const ret = arg0.getDirectory();
+ return ret;
+ },
+ __wbg_getElementById_1cbd8f06dbe8eb8e: function(arg0, arg1, arg2) {
+ const ret = arg0.getElementById(getStringFromWasm0(arg1, arg2));
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_getExtension_101c7e41de3e4d90: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.getExtension(getStringFromWasm0(arg1, arg2));
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ }, arguments); },
+ __wbg_getFileHandle_72de55ab3ca9ad57: function(arg0, arg1, arg2, arg3) {
+ const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
+ return ret;
+ },
+ __wbg_getFileHandle_96903ab38e634823: function(arg0, arg1, arg2) {
+ const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2));
+ return ret;
+ },
+ __wbg_getFile_bdc0144baa662031: function(arg0) {
+ const ret = arg0.getFile();
+ return ret;
+ },
+ __wbg_getIndexedParameter_6d7a5bcccaa0f3e2: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.getIndexedParameter(arg1 >>> 0, arg2 >>> 0);
+ return ret;
+ }, arguments); },
+ __wbg_getItem_b96269ddc16cf24a: function() { return handleError(function (arg0, arg1, arg2, arg3) {
+ const ret = arg1.getItem(getStringFromWasm0(arg2, arg3));
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ var len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_getMappedRange_d0bf3141224111b6: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.getMappedRange(arg1, arg2);
+ return ret;
+ }, arguments); },
+ __wbg_getParameter_039a5899307fab55: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.getParameter(arg1 >>> 0);
+ return ret;
+ }, arguments); },
+ __wbg_getParameter_d39f59581389af1b: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.getParameter(arg1 >>> 0);
+ return ret;
+ }, arguments); },
+ __wbg_getPreferredCanvasFormat_8b57039d1801a506: function(arg0) {
+ const ret = arg0.getPreferredCanvasFormat();
+ return (__wbindgen_enum_GpuTextureFormat.indexOf(ret) + 1 || 102) - 1;
+ },
+ __wbg_getProgramInfoLog_c4762e0513468a26: function(arg0, arg1, arg2) {
+ const ret = arg1.getProgramInfoLog(arg2);
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ var len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_getProgramInfoLog_d1ce570463a68779: function(arg0, arg1, arg2) {
+ const ret = arg1.getProgramInfoLog(arg2);
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ var len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_getProgramParameter_b9995b56c258ac86: function(arg0, arg1, arg2) {
+ const ret = arg0.getProgramParameter(arg1, arg2 >>> 0);
+ return ret;
+ },
+ __wbg_getProgramParameter_c8d1154fbb3c0890: function(arg0, arg1, arg2) {
+ const ret = arg0.getProgramParameter(arg1, arg2 >>> 0);
+ return ret;
+ },
+ __wbg_getPropertyValue_dc6b061239dad6f1: function() { return handleError(function (arg0, arg1, arg2, arg3) {
+ const ret = arg1.getPropertyValue(getStringFromWasm0(arg2, arg3));
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_getQueryParameter_919125495ccb17ca: function(arg0, arg1, arg2) {
+ const ret = arg0.getQueryParameter(arg1, arg2 >>> 0);
+ return ret;
+ },
+ __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
+ }, arguments); },
+ __wbg_getRandomValues_ceb34d8ffce7e87f: function() { return handleError(function (arg0, arg1) {
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
+ }, arguments); },
+ __wbg_getReader_b4b1868fbca77dbe: function() { return handleError(function (arg0) {
+ const ret = arg0.getReader();
+ return ret;
+ }, arguments); },
+ __wbg_getRootNode_f724c3be671a9a57: function(arg0) {
+ const ret = arg0.getRootNode();
+ return ret;
+ },
+ __wbg_getShaderInfoLog_5cee2add982c7165: function(arg0, arg1, arg2) {
+ const ret = arg1.getShaderInfoLog(arg2);
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ var len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_getShaderInfoLog_bc236afe696c1283: function(arg0, arg1, arg2) {
+ const ret = arg1.getShaderInfoLog(arg2);
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ var len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_getShaderParameter_3394e75dcb97f380: function(arg0, arg1, arg2) {
+ const ret = arg0.getShaderParameter(arg1, arg2 >>> 0);
+ return ret;
+ },
+ __wbg_getShaderParameter_cbcc0995e8e16214: function(arg0, arg1, arg2) {
+ const ret = arg0.getShaderParameter(arg1, arg2 >>> 0);
+ return ret;
+ },
+ __wbg_getSupportedExtensions_2a7458ec45e82560: function(arg0) {
+ const ret = arg0.getSupportedExtensions();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_getSupportedProfiles_90a4f330938d0241: function(arg0) {
+ const ret = arg0.getSupportedProfiles();
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_getSyncParameter_d8f6c145657a3550: function(arg0, arg1, arg2) {
+ const ret = arg0.getSyncParameter(arg1, arg2 >>> 0);
+ return ret;
+ },
+ __wbg_getTime_d6f070c088c9b5ed: function(arg0) {
+ const ret = arg0.getTime();
+ return ret;
+ },
+ __wbg_getUniformBlockIndex_cfee6ff6d323c784: function(arg0, arg1, arg2, arg3) {
+ const ret = arg0.getUniformBlockIndex(arg1, getStringFromWasm0(arg2, arg3));
+ return ret;
+ },
+ __wbg_getUniformLocation_24ef46cdda2148ab: function(arg0, arg1, arg2, arg3) {
+ const ret = arg0.getUniformLocation(arg1, getStringFromWasm0(arg2, arg3));
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_getUniformLocation_788a34295dd6fabe: function(arg0, arg1, arg2, arg3) {
+ const ret = arg0.getUniformLocation(arg1, getStringFromWasm0(arg2, arg3));
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_get_507a50627bffa49b: function(arg0, arg1) {
+ const ret = arg0[arg1 >>> 0];
+ return ret;
+ },
+ __wbg_get_757c867e2520bbc4: function(arg0, arg1) {
+ const ret = arg0[arg1 >>> 0];
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
+ const ret = Reflect.get(arg0, arg1);
+ return ret;
+ }, arguments); },
+ __wbg_get_b2053e9bfdf3ca8e: function(arg0, arg1) {
+ const ret = arg0[arg1 >>> 0];
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
+ const ret = Reflect.get(arg0, arg1);
+ return ret;
+ }, arguments); },
+ __wbg_get_ddcbbb3501c3011e: function(arg0, arg1) {
+ const ret = arg0[arg1 >>> 0];
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_get_done_670108eb06ecbe46: function(arg0) {
+ const ret = arg0.done;
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
+ },
+ __wbg_get_e73985d6689d2245: function(arg0, arg1) {
+ const ret = arg0[arg1 >>> 0];
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
+ const ret = arg0[arg1 >>> 0];
+ return ret;
+ },
+ __wbg_get_value_f465f5be30aa0963: function(arg0) {
+ const ret = arg0.value;
+ return ret;
+ },
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
+ const ret = arg0[arg1];
+ return ret;
+ },
+ __wbg_gpu_2ccc250735d24a2a: function(arg0) {
+ const ret = arg0.gpu;
+ return ret;
+ },
+ __wbg_hasOwn_f2591afb8975e2fd: function(arg0, arg1) {
+ const ret = Object.hasOwn(arg0, arg1);
+ return ret;
+ },
+ __wbg_has_0c97053e877f47cc: function(arg0, arg1, arg2) {
+ const ret = arg0.has(getStringFromWasm0(arg1, arg2));
+ return ret;
+ },
+ __wbg_has_8374cf06984d8bfc: function() { return handleError(function (arg0, arg1) {
+ const ret = Reflect.has(arg0, arg1);
+ return ret;
+ }, arguments); },
+ __wbg_has_ce7fd01110e4972f: function(arg0, arg1, arg2) {
+ const ret = arg0.has(getStringFromWasm0(arg1, arg2));
+ return ret;
+ },
+ __wbg_hash_508149c4291ec8c2: function() { return handleError(function (arg0, arg1) {
+ const ret = arg1.hash;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_headers_7b59c5203c8c475d: function(arg0) {
+ const ret = arg0.headers;
+ return ret;
+ },
+ __wbg_headers_cf9c80f30e2a4eff: function(arg0) {
+ const ret = arg0.headers;
+ return ret;
+ },
+ __wbg_height_1ac64d880e0a71ae: function(arg0) {
+ const ret = arg0.height;
+ return ret;
+ },
+ __wbg_height_46f95580d0507f0a: function(arg0) {
+ const ret = arg0.height;
+ return ret;
+ },
+ __wbg_height_5b881707f59cdee5: function(arg0) {
+ const ret = arg0.height;
+ return ret;
+ },
+ __wbg_height_6eec812c213259a1: function(arg0) {
+ const ret = arg0.height;
+ return ret;
+ },
+ __wbg_height_9f27216001e3c804: function(arg0) {
+ const ret = arg0.height;
+ return ret;
+ },
+ __wbg_height_f2cc35b336f266f1: function(arg0) {
+ const ret = arg0.height;
+ return ret;
+ },
+ __wbg_hidden_c08eb1c29c138ab0: function(arg0) {
+ const ret = arg0.hidden;
+ return ret;
+ },
+ __wbg_history_e648b4314d9b256e: function() { return handleError(function (arg0) {
+ const ret = arg0.history;
+ return ret;
+ }, arguments); },
+ __wbg_host_21c8d54c9bdcd04a: function() { return handleError(function (arg0, arg1) {
+ const ret = arg1.host;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_hostname_6a4adb791d7e7242: function() { return handleError(function (arg0, arg1) {
+ const ret = arg1.hostname;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_href_0259f7f614252f13: function() { return handleError(function (arg0, arg1) {
+ const ret = arg1.href;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_href_bc4909da4ed58381: function(arg0, arg1) {
+ const ret = arg1.href;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_identifier_d30bb260fab6b02a: function(arg0) {
+ const ret = arg0.identifier;
+ return ret;
+ },
+ __wbg_includes_78c9a3115b08eddc: function(arg0, arg1, arg2) {
+ const ret = arg0.includes(arg1, arg2);
+ return ret;
+ },
+ __wbg_info_79f5309d69d9c70e: function(arg0, arg1, arg2, arg3) {
+ console.info(arg0, arg1, arg2, arg3);
+ },
+ __wbg_info_cf0d9a286850cd24: function(arg0) {
+ const ret = arg0.info;
+ return ret;
+ },
+ __wbg_info_eadbe775a8e2e9eb: function(arg0) {
+ console.info(arg0);
+ },
+ __wbg_inlineSize_3c8412828bef21eb: function(arg0) {
+ const ret = arg0.inlineSize;
+ return ret;
+ },
+ __wbg_inputType_37c59110203135d8: function(arg0, arg1) {
+ const ret = arg1.inputType;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_insertBefore_9121f73148bc4f7c: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.insertBefore(arg1, arg2);
+ return ret;
+ }, arguments); },
+ __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof ArrayBuffer;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_Document_d1955f84f5d0351c: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof Document;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_DomException_952faa8037702c00: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof DOMException;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_Element_beebfaab75d12d9d: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof Element;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_Error_1fdac9f13a8181ba: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof Error;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_FileSystemDirectoryHandle_c9ab7c5cdb7a7c30: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof FileSystemDirectoryHandle;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_FileSystemFileHandle_68e80b30532d5f04: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof FileSystemFileHandle;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_FileSystemWritableFileStream_bbd33ec1789b2714: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof FileSystemWritableFileStream;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_File_ee62de53bca2e697: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof File;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_GpuOutOfMemoryError_6429c750997f1c8d: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof GPUOutOfMemoryError;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_GpuValidationError_75fa3611f065f4df: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof GPUValidationError;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_HtmlAnchorElement_0b37fbaa9075f12c: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof HTMLAnchorElement;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_HtmlButtonElement_2798f3f046c1c446: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof HTMLButtonElement;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_HtmlCanvasElement_ed02ed9136056019: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof HTMLCanvasElement;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_HtmlElement_4493a09212d3586f: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof HTMLElement;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_HtmlInputElement_ad3be04339d0e4df: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof HTMLInputElement;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_ImageBitmap_859f193922076b2b: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof ImageBitmap;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_MessageEvent_7d226bddd45cb41d: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof MessageEvent;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_Promise_4cb210c0b8f8c959: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof Promise;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_ReadableStream_3bdc7d10b03fd402: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof ReadableStream;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_ResizeObserverEntry_5d9f44b2d0d4bd47: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof ResizeObserverEntry;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_ResizeObserverSize_52b48dee6a4ab521: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof ResizeObserverSize;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_Response_c8b64b2256f01bec: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof Response;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_ShadowRoot_8ab3038bc5e14d84: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof ShadowRoot;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_TypeError_aa4c0c0517d53151: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof TypeError;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof Uint8Array;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_WebGl2RenderingContext_90225152e4e3c799: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof WebGL2RenderingContext;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_instanceof_Window_05ba1ee4f6781663: function(arg0) {
+ let result;
+ try {
+ result = arg0 instanceof Window;
+ } catch (_) {
+ result = false;
+ }
+ const ret = result;
+ return ret;
+ },
+ __wbg_invalidateFramebuffer_343bbfb15e6835fd: function() { return handleError(function (arg0, arg1, arg2) {
+ arg0.invalidateFramebuffer(arg1 >>> 0, arg2);
+ }, arguments); },
+ __wbg_isActive_9e21f95da89fce93: function(arg0) {
+ const ret = arg0.isActive;
+ return ret;
+ },
+ __wbg_isArray_0677c962b281d01a: function(arg0) {
+ const ret = Array.isArray(arg0);
+ return ret;
+ },
+ __wbg_isComposing_3022d9ff79b517bd: function(arg0) {
+ const ret = arg0.isComposing;
+ return ret;
+ },
+ __wbg_isComposing_919a0fdf6ac030c9: function(arg0) {
+ const ret = arg0.isComposing;
+ return ret;
+ },
+ __wbg_isFallbackAdapter_8ccb967428491dcb: function(arg0) {
+ const ret = arg0.isFallbackAdapter;
+ return ret;
+ },
+ __wbg_isSafeInteger_04f36e4056f1b851: function(arg0) {
+ const ret = Number.isSafeInteger(arg0);
+ return ret;
+ },
+ __wbg_isSecureContext_d2e906a088ea2127: function(arg0) {
+ const ret = arg0.isSecureContext;
+ return ret;
+ },
+ __wbg_is_7b9d0b289033c7de: function(arg0, arg1) {
+ const ret = Object.is(arg0, arg1);
+ return ret;
+ },
+ __wbg_item_4b2887fd8cb17be5: function(arg0, arg1) {
+ const ret = arg0.item(arg1 >>> 0);
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_items_350b6f2d566d3def: function(arg0) {
+ const ret = arg0.items;
+ return ret;
+ },
+ __wbg_iterator_6f722e4a93058b71: function() {
+ const ret = Symbol.iterator;
+ return ret;
+ },
+ __wbg_keyCode_f9ab89c2dd6c3770: function(arg0) {
+ const ret = arg0.keyCode;
+ return ret;
+ },
+ __wbg_key_803dca86cdcfa8dd: function(arg0, arg1) {
+ const ret = arg1.key;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_key_c3e1e6137d321e2c: function(arg0, arg1) {
+ const ret = arg1.key;
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ var len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_label_7ed42f25f841996b: function(arg0, arg1) {
+ const ret = arg1.label;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_left_7e76a74d0db1754f: function(arg0) {
+ const ret = arg0.left;
+ return ret;
+ },
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
+ const ret = arg0.length;
+ return ret;
+ },
+ __wbg_length_370319915dc99107: function(arg0) {
+ const ret = arg0.length;
+ return ret;
+ },
+ __wbg_length_e08fc23135c66d6f: function(arg0) {
+ const ret = arg0.length;
+ return ret;
+ },
+ __wbg_length_eea4bfa35e75c87c: function(arg0) {
+ const ret = arg0.length;
+ return ret;
+ },
+ __wbg_length_ef21514bf74fe712: function(arg0) {
+ const ret = arg0.length;
+ return ret;
+ },
+ __wbg_limits_20c6f56636df7d38: function(arg0) {
+ const ret = arg0.limits;
+ return ret;
+ },
+ __wbg_limits_328c61cd41512420: function(arg0) {
+ const ret = arg0.limits;
+ return ret;
+ },
+ __wbg_linkProgram_4e047fb3197a0348: function(arg0, arg1) {
+ arg0.linkProgram(arg1);
+ },
+ __wbg_linkProgram_d7c71c539c8c6a43: function(arg0, arg1) {
+ arg0.linkProgram(arg1);
+ },
+ __wbg_localStorage_5bf6ce3f8e51412a: function() { return handleError(function (arg0) {
+ const ret = arg0.localStorage;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ }, arguments); },
+ __wbg_location_c9a2271428996698: function(arg0) {
+ const ret = arg0.location;
+ return ret;
+ },
+ __wbg_mapAsync_52b01fa9e8f765fd: function(arg0, arg1, arg2, arg3) {
+ const ret = arg0.mapAsync(arg1 >>> 0, arg2, arg3);
+ return ret;
+ },
+ __wbg_matchMedia_9968278b31706f78: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.matchMedia(getStringFromWasm0(arg1, arg2));
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ }, arguments); },
+ __wbg_matches_978994974df1e85b: function(arg0) {
+ const ret = arg0.matches;
+ return ret;
+ },
+ __wbg_maxBindGroupsPlusVertexBuffers_33e5006b23e20478: function(arg0) {
+ const ret = arg0.maxBindGroupsPlusVertexBuffers;
+ return ret;
+ },
+ __wbg_maxBindGroups_f6d26f3a67826666: function(arg0) {
+ const ret = arg0.maxBindGroups;
+ return ret;
+ },
+ __wbg_maxBindingsPerBindGroup_edab2e8dabbf6060: function(arg0) {
+ const ret = arg0.maxBindingsPerBindGroup;
+ return ret;
+ },
+ __wbg_maxBufferSize_bbc69284c14aa7da: function(arg0) {
+ const ret = arg0.maxBufferSize;
+ return ret;
+ },
+ __wbg_maxColorAttachmentBytesPerSample_63ebe4f81de2f34c: function(arg0) {
+ const ret = arg0.maxColorAttachmentBytesPerSample;
+ return ret;
+ },
+ __wbg_maxColorAttachments_aed8c38beabf3a5c: function(arg0) {
+ const ret = arg0.maxColorAttachments;
+ return ret;
+ },
+ __wbg_maxComputeInvocationsPerWorkgroup_2d964564c37f1c65: function(arg0) {
+ const ret = arg0.maxComputeInvocationsPerWorkgroup;
+ return ret;
+ },
+ __wbg_maxComputeWorkgroupSizeX_a3e3206570da184f: function(arg0) {
+ const ret = arg0.maxComputeWorkgroupSizeX;
+ return ret;
+ },
+ __wbg_maxComputeWorkgroupSizeY_dffa4a62244b7563: function(arg0) {
+ const ret = arg0.maxComputeWorkgroupSizeY;
+ return ret;
+ },
+ __wbg_maxComputeWorkgroupSizeZ_976ebcb760f6d07d: function(arg0) {
+ const ret = arg0.maxComputeWorkgroupSizeZ;
+ return ret;
+ },
+ __wbg_maxComputeWorkgroupStorageSize_2e8dbece6e532e2a: function(arg0) {
+ const ret = arg0.maxComputeWorkgroupStorageSize;
+ return ret;
+ },
+ __wbg_maxComputeWorkgroupsPerDimension_bb7d36b4d20c80f4: function(arg0) {
+ const ret = arg0.maxComputeWorkgroupsPerDimension;
+ return ret;
+ },
+ __wbg_maxDynamicStorageBuffersPerPipelineLayout_1ca859cb96a414e0: function(arg0) {
+ const ret = arg0.maxDynamicStorageBuffersPerPipelineLayout;
+ return ret;
+ },
+ __wbg_maxDynamicUniformBuffersPerPipelineLayout_e968f2c8cd8f4d46: function(arg0) {
+ const ret = arg0.maxDynamicUniformBuffersPerPipelineLayout;
+ return ret;
+ },
+ __wbg_maxInterStageShaderVariables_138ac882c4d6a3d3: function(arg0) {
+ const ret = arg0.maxInterStageShaderVariables;
+ return ret;
+ },
+ __wbg_maxSampledTexturesPerShaderStage_bb3e6b2698321fa6: function(arg0) {
+ const ret = arg0.maxSampledTexturesPerShaderStage;
+ return ret;
+ },
+ __wbg_maxSamplersPerShaderStage_98c00a1829fa414b: function(arg0) {
+ const ret = arg0.maxSamplersPerShaderStage;
+ return ret;
+ },
+ __wbg_maxStorageBufferBindingSize_e500e31f479e669e: function(arg0) {
+ const ret = arg0.maxStorageBufferBindingSize;
+ return ret;
+ },
+ __wbg_maxStorageBuffersPerShaderStage_eb663f6d7521b6a7: function(arg0) {
+ const ret = arg0.maxStorageBuffersPerShaderStage;
+ return ret;
+ },
+ __wbg_maxStorageTexturesPerShaderStage_bb3ad93b53e618c0: function(arg0) {
+ const ret = arg0.maxStorageTexturesPerShaderStage;
+ return ret;
+ },
+ __wbg_maxTextureArrayLayers_2a56d05fb261c99a: function(arg0) {
+ const ret = arg0.maxTextureArrayLayers;
+ return ret;
+ },
+ __wbg_maxTextureDimension1D_84590c1d4770d319: function(arg0) {
+ const ret = arg0.maxTextureDimension1D;
+ return ret;
+ },
+ __wbg_maxTextureDimension2D_7f2b5c8b2727e3fc: function(arg0) {
+ const ret = arg0.maxTextureDimension2D;
+ return ret;
+ },
+ __wbg_maxTextureDimension3D_7f3babddf55c32a6: function(arg0) {
+ const ret = arg0.maxTextureDimension3D;
+ return ret;
+ },
+ __wbg_maxUniformBufferBindingSize_d80a09e23c0b284c: function(arg0) {
+ const ret = arg0.maxUniformBufferBindingSize;
+ return ret;
+ },
+ __wbg_maxUniformBuffersPerShaderStage_0b8b2de676fa740e: function(arg0) {
+ const ret = arg0.maxUniformBuffersPerShaderStage;
+ return ret;
+ },
+ __wbg_maxVertexAttributes_a693dd921316649b: function(arg0) {
+ const ret = arg0.maxVertexAttributes;
+ return ret;
+ },
+ __wbg_maxVertexBufferArrayStride_f256d91f281076cb: function(arg0) {
+ const ret = arg0.maxVertexBufferArrayStride;
+ return ret;
+ },
+ __wbg_maxVertexBuffers_70ab564b25d5ac20: function(arg0) {
+ const ret = arg0.maxVertexBuffers;
+ return ret;
+ },
+ __wbg_message_4ada57a3710f1502: function(arg0, arg1) {
+ const ret = arg1.message;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_message_fb0e6e7854e6ea7a: function(arg0, arg1) {
+ const ret = arg1.message;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_metaKey_d961c7572a9f84f5: function(arg0) {
+ const ret = arg0.metaKey;
+ return ret;
+ },
+ __wbg_metaKey_f934f09e37889d70: function(arg0) {
+ const ret = arg0.metaKey;
+ return ret;
+ },
+ __wbg_minStorageBufferOffsetAlignment_3248ed00dcdbf79f: function(arg0) {
+ const ret = arg0.minStorageBufferOffsetAlignment;
+ return ret;
+ },
+ __wbg_minUniformBufferOffsetAlignment_3b9fa4caae03e903: function(arg0) {
+ const ret = arg0.minUniformBufferOffsetAlignment;
+ return ret;
+ },
+ __wbg_name_9d2bcd24d4433cef: function(arg0, arg1) {
+ const ret = arg1.name;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_name_d7d79f5466e37447: function(arg0, arg1) {
+ const ret = arg1.name;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_navigator_51379c10a84aeec9: function(arg0) {
+ const ret = arg0.navigator;
+ return ret;
+ },
+ __wbg_navigator_99621db14b3f1099: function(arg0) {
+ const ret = arg0.navigator;
+ return ret;
+ },
+ __wbg_newValue_6d3d665995a61f5e: function(arg0, arg1) {
+ const ret = arg1.newValue;
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ var len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_new_08cb2fa678b17a48: function() { return handleError(function (arg0, arg1) {
+ const ret = new URL(getStringFromWasm0(arg0, arg1));
+ return ret;
+ }, arguments); },
+ __wbg_new_0_3da9e97f24fc69be: function() {
+ const ret = new Date();
+ return ret;
+ },
+ __wbg_new_0d809930cd1354c6: function() { return handleError(function () {
+ const ret = new Headers();
+ return ret;
+ }, arguments); },
+ __wbg_new_25e75d1f0df4d87a: function() { return handleError(function (arg0, arg1) {
+ const ret = new OffscreenCanvas(arg0 >>> 0, arg1 >>> 0);
+ return ret;
+ }, arguments); },
+ __wbg_new_32b398fb48b6d94a: function() {
+ const ret = new Array();
+ return ret;
+ },
+ __wbg_new_363c1767d99fa32f: function() {
+ const ret = new Error();
+ return ret;
+ },
+ __wbg_new_4339b2a2675a03e3: function() { return handleError(function () {
+ const ret = new AbortController();
+ return ret;
+ }, arguments); },
+ __wbg_new_51c73e5617fb3fad: function() { return handleError(function (arg0) {
+ const ret = new EncodedVideoChunk(arg0);
+ return ret;
+ }, arguments); },
+ __wbg_new_5394f65338077341: function() { return handleError(function (arg0) {
+ const ret = new ResizeObserver((...args) => {
+ arg0(...args);
+ frame_scheduler.invalidate();
+ });
+ return ret;
+ }, arguments); },
+ __wbg_new_5e245ef5857d7f33: function(arg0, arg1) {
+ const ret = new TypeError(getStringFromWasm0(arg0, arg1));
+ return ret;
+ },
+ __wbg_new_a211ccc53aa68944: function() { return handleError(function (arg0) {
+ const ret = new VideoDecoder({...arg0, output(frame) {
+ arg0.output(frame);
+ frame_scheduler.invalidate();
+ }});
+ return ret;
+ }, arguments); },
+ __wbg_new_aec3e25493d729fe: function(arg0, arg1) {
+ try {
+ var state0 = {a: arg0, b: arg1};
+ var cb0 = (arg0, arg1) => {
+ const a = state0.a;
+ state0.a = 0;
+ try {
+ return wasm_bindgen__convert__closures_____invoke__h10b6862cecdf1332(a, state0.b, arg0, arg1);
+ } finally {
+ state0.a = a;
+ }
+ };
+ const ret = new Promise(cb0);
+ return ret;
+ } finally {
+ state0.a = 0;
+ }
+ },
+ __wbg_new_b667d279fd5aa943: function(arg0, arg1) {
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
+ return ret;
+ },
+ __wbg_new_c9eb879b62d87c93: function() {
+ const ret = new Error();
+ return ret;
+ },
+ __wbg_new_cbb95886ce0eb0cb: function(arg0, arg1) {
+ const ret = new Intl.DateTimeFormat(arg0, arg1);
+ return ret;
+ },
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
+ const ret = new Uint8Array(arg0);
+ return ret;
+ },
+ __wbg_new_da52cf8fe3429cb2: function() {
+ const ret = new Object();
+ return ret;
+ },
+ __wbg_new_f0787df90791d9ba: function() { return handleError(function () {
+ const ret = new URLSearchParams();
+ return ret;
+ }, arguments); },
+ __wbg_new_from_slice_77cdfb7977362f3c: function(arg0, arg1) {
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
+ return ret;
+ },
+ __wbg_new_typed_1824d93f294193e5: function(arg0, arg1) {
+ try {
+ var state0 = {a: arg0, b: arg1};
+ var cb0 = (arg0, arg1) => {
+ const a = state0.a;
+ state0.a = 0;
+ try {
+ return wasm_bindgen__convert__closures_____invoke__h10b6862cecdf1332(a, state0.b, arg0, arg1);
+ } finally {
+ state0.a = a;
+ }
+ };
+ const ret = new Promise(cb0);
+ return ret;
+ } finally {
+ state0.a = 0;
+ }
+ },
+ __wbg_new_typed_4148bd5ae72ab3f0: function() {
+ const ret = new Object();
+ return ret;
+ },
+ __wbg_new_with_byte_offset_and_length_54c7724ee3ec7d82: function(arg0, arg1, arg2) {
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
+ return ret;
+ },
+ __wbg_new_with_image_bitmap_and_video_frame_init_0db8a370be656c2c: function() { return handleError(function (arg0, arg1) {
+ const ret = new VideoFrame(arg0, arg1);
+ return ret;
+ }, arguments); },
+ __wbg_new_with_length_e6785c33c8e4cce8: function(arg0) {
+ const ret = new Uint8Array(arg0 >>> 0);
+ return ret;
+ },
+ __wbg_new_with_record_from_str_to_blob_promise_6112280bc8a0f052: function() { return handleError(function (arg0) {
+ const ret = new ClipboardItem(arg0);
+ return ret;
+ }, arguments); },
+ __wbg_new_with_str_454324b233393719: function() { return handleError(function (arg0, arg1) {
+ const ret = new URLSearchParams(getStringFromWasm0(arg0, arg1));
+ return ret;
+ }, arguments); },
+ __wbg_new_with_str_and_init_d95cbe11ce28e65e: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
+ return ret;
+ }, arguments); },
+ __wbg_new_with_u8_array_sequence_and_options_2c1900e5a5c93850: function() { return handleError(function (arg0, arg1) {
+ const ret = new Blob(arg0, arg1);
+ return ret;
+ }, arguments); },
+ __wbg_nextSibling_0e94ccfa3c22fa3c: function(arg0) {
+ const ret = arg0.nextSibling;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_next_6dbf2c0ac8cde20f: function(arg0) {
+ const ret = arg0.next;
+ return ret;
+ },
+ __wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
+ const ret = arg0.next();
+ return ret;
+ }, arguments); },
+ __wbg_now_390768da5ee9e776: function(arg0) {
+ const ret = arg0.now();
+ return ret;
+ },
+ __wbg_now_86c0d4ba3fa605b8: function() {
+ const ret = Date.now();
+ return ret;
+ },
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
+ const ret = arg0.now();
+ return ret;
+ },
+ __wbg_observe_615bef91ee28c925: function(arg0, arg1, arg2) {
+ arg0.observe(arg1, arg2);
+ },
+ __wbg_of_85f52f8b6491a7ca: function(arg0) {
+ const ret = Array.of(arg0);
+ return ret;
+ },
+ __wbg_offsetLeft_57573e1411874d68: function(arg0) {
+ const ret = arg0.offsetLeft;
+ return ret;
+ },
+ __wbg_offsetTop_eb7a93213506ba96: function(arg0) {
+ const ret = arg0.offsetTop;
+ return ret;
+ },
+ __wbg_ok_acc5e3fb89668864: function(arg0) {
+ const ret = arg0.ok;
+ return ret;
+ },
+ __wbg_onSubmittedWorkDone_270d6b5a45520e79: function(arg0) {
+ const ret = arg0.onSubmittedWorkDone();
+ return ret;
+ },
+ __wbg_open_1a1b29d8bfde6885: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
+ const ret = arg0.open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6));
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ }, arguments); },
+ __wbg_open_221b279749ba2e4e: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
+ const ret = arg0.open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ }, arguments); },
+ __wbg_origin_ed66c06e67ad2049: function() { return handleError(function (arg0, arg1) {
+ const ret = arg1.origin;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_parentNode_fecbbdea2a930547: function(arg0) {
+ const ret = arg0.parentNode;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_performance_3ef602e13d6c3b56: function(arg0) {
+ const ret = arg0.performance;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
+ const ret = arg0.performance;
+ return ret;
+ },
+ __wbg_persist_5ddcf223b47da9ba: function() { return handleError(function (arg0) {
+ const ret = arg0.persist();
+ return ret;
+ }, arguments); },
+ __wbg_pipeTo_3ecb20e17416edd6: function(arg0, arg1) {
+ const ret = arg0.pipeTo(arg1);
+ return ret;
+ },
+ __wbg_pixelStorei_2a93b18efde9acf8: function(arg0, arg1, arg2) {
+ arg0.pixelStorei(arg1 >>> 0, arg2);
+ },
+ __wbg_pixelStorei_c844cd0db4f1fde6: function(arg0, arg1, arg2) {
+ arg0.pixelStorei(arg1 >>> 0, arg2);
+ },
+ __wbg_polygonOffset_4eb460adf41db6cd: function(arg0, arg1, arg2) {
+ arg0.polygonOffset(arg1, arg2);
+ },
+ __wbg_polygonOffset_eccb68e40a18f861: function(arg0, arg1, arg2) {
+ arg0.polygonOffset(arg1, arg2);
+ },
+ __wbg_port_e2c291cf8fd5fc40: function() { return handleError(function (arg0, arg1) {
+ const ret = arg1.port;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_preventDefault_b64888c857500682: function(arg0) {
+ arg0.preventDefault();
+ },
+ __wbg_protocol_0598aef25eb71eae: function() { return handleError(function (arg0, arg1) {
+ const ret = arg1.protocol;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
+ },
+ __wbg_pushState_3d01701623122bc8: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.pushState(arg1, getStringFromWasm0(arg2, arg3), arg4 === 0 ? undefined : getStringFromWasm0(arg4, arg5));
+ }, arguments); },
+ __wbg_push_d2ae3af0c1217ae6: function(arg0, arg1) {
+ const ret = arg0.push(arg1);
+ return ret;
+ },
+ __wbg_queryCounterEXT_b74a4567ddfeecf0: function(arg0, arg1, arg2) {
+ arg0.queryCounterEXT(arg1, arg2 >>> 0);
+ },
+ __wbg_querySelectorAll_7e98cbe256deaadd: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.querySelectorAll(getStringFromWasm0(arg1, arg2));
+ return ret;
+ }, arguments); },
+ __wbg_querySelector_fd7d157ebe17cd16: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.querySelector(getStringFromWasm0(arg1, arg2));
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ }, arguments); },
+ __wbg_queueMicrotask_0ab5b2d2393e99b9: function(arg0) {
+ const ret = arg0.queueMicrotask;
+ return ret;
+ },
+ __wbg_queueMicrotask_6a09b7bc46549209: function(arg0) {
+ queueMicrotask(arg0);
+ },
+ __wbg_queue_adce34608fd0c893: function(arg0) {
+ const ret = arg0.queue;
+ return ret;
+ },
+ __wbg_readBuffer_4271437a70aae481: function(arg0, arg1) {
+ arg0.readBuffer(arg1 >>> 0);
+ },
+ __wbg_readPixels_5f013a7d85b23800: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
+ arg0.readPixels(arg1, arg2, arg3, arg4, arg5 >>> 0, arg6 >>> 0, arg7);
+ }, arguments); },
+ __wbg_readPixels_82c9dee754d58176: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
+ arg0.readPixels(arg1, arg2, arg3, arg4, arg5 >>> 0, arg6 >>> 0, arg7);
+ }, arguments); },
+ __wbg_readPixels_c7861e25836bf57b: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
+ arg0.readPixels(arg1, arg2, arg3, arg4, arg5 >>> 0, arg6 >>> 0, arg7);
+ }, arguments); },
+ __wbg_read_8afa15f12a160ef8: function(arg0) {
+ const ret = arg0.read();
+ return ret;
+ },
+ __wbg_releaseLock_5b92874cad775644: function(arg0) {
+ arg0.releaseLock();
+ },
+ __wbg_removeChild_8d9536328d674d54: function() { return handleError(function (arg0, arg1) {
+ const ret = arg0.removeChild(arg1);
+ return ret;
+ }, arguments); },
+ __wbg_removeEventListener_a3f23c70077bdcc1: function() { return handleError(function (arg0, arg1, arg2, arg3) {
+ arg0.removeEventListener(getStringFromWasm0(arg1, arg2), arg3);
+ }, arguments); },
+ __wbg_removeItem_78e03a38da96e0ae: function() { return handleError(function (arg0, arg1, arg2) {
+ arg0.removeItem(getStringFromWasm0(arg1, arg2));
+ }, arguments); },
+ __wbg_remove_ce1b54059317fe8a: function(arg0) {
+ arg0.remove();
+ },
+ __wbg_renderbufferStorageMultisample_5c6e5d20c0eaa6ba: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.renderbufferStorageMultisample(arg1 >>> 0, arg2, arg3 >>> 0, arg4, arg5);
+ },
+ __wbg_renderbufferStorage_0a8de92542893819: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.renderbufferStorage(arg1 >>> 0, arg2 >>> 0, arg3, arg4);
+ },
+ __wbg_renderbufferStorage_ab5f745ff8efce3d: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.renderbufferStorage(arg1 >>> 0, arg2 >>> 0, arg3, arg4);
+ },
+ __wbg_replaceState_9a0a4a53d3bf3439: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.replaceState(arg1, getStringFromWasm0(arg2, arg3), arg4 === 0 ? undefined : getStringFromWasm0(arg4, arg5));
+ }, arguments); },
+ __wbg_requestAdapter_2e6718811c735a57: function(arg0, arg1) {
+ const ret = arg0.requestAdapter(arg1);
+ return ret;
+ },
+ __wbg_requestAdapter_fedd76261c649e55: function(arg0) {
+ const ret = arg0.requestAdapter();
+ return ret;
+ },
+ __wbg_requestAnimationFrame_1a85deeab66448c2: function() { return handleError(function (arg0, arg1) {
+ const ret = frame_scheduler.request(arg1);
+ return ret;
+ }, arguments); },
+ __wbg_requestDevice_ab46d0519ea1cc34: function(arg0, arg1) {
+ const ret = arg0.requestDevice(arg1);
+ return ret;
+ },
+ __wbg_reset_5f89fa780634d36d: function() { return handleError(function (arg0) {
+ arg0.reset();
+ }, arguments); },
+ __wbg_resolve_2191a4dfe481c25b: function(arg0) {
+ const ret = Promise.resolve(arg0);
+ return ret;
+ },
+ __wbg_resolvedOptions_ce0ede387898d6bd: function(arg0) {
+ const ret = arg0.resolvedOptions();
+ return ret;
+ },
+ __wbg_respond_510e32df8aeb6817: function() { return handleError(function (arg0, arg1) {
+ arg0.respond(arg1 >>> 0);
+ }, arguments); },
+ __wbg_right_36c53e00496f4f0a: function(arg0) {
+ const ret = arg0.right;
+ return ret;
+ },
+ __wbg_samplerParameterf_0b3308eeb1faa3a1: function(arg0, arg1, arg2, arg3) {
+ arg0.samplerParameterf(arg1, arg2 >>> 0, arg3);
+ },
+ __wbg_samplerParameteri_7b1b4091de49aabb: function(arg0, arg1, arg2, arg3) {
+ arg0.samplerParameteri(arg1, arg2 >>> 0, arg3);
+ },
+ __wbg_scissor_105e756596bc35df: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.scissor(arg1, arg2, arg3, arg4);
+ },
+ __wbg_scissor_573b844152316b8d: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.scissor(arg1, arg2, arg3, arg4);
+ },
+ __wbg_searchParams_23a839468a61ef4c: function(arg0) {
+ const ret = arg0.searchParams;
+ return ret;
+ },
+ __wbg_search_af2555aa41bd23cc: function() { return handleError(function (arg0, arg1) {
+ const ret = arg1.search;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_selectionEnd_bc4cb81b30d7175a: function() { return handleError(function (arg0) {
+ const ret = arg0.selectionEnd;
+ return isLikeNone(ret) ? Number.MAX_SAFE_INTEGER : (ret) >>> 0;
+ }, arguments); },
+ __wbg_selectionStart_965d703fd02aafa2: function() { return handleError(function (arg0) {
+ const ret = arg0.selectionStart;
+ return isLikeNone(ret) ? Number.MAX_SAFE_INTEGER : (ret) >>> 0;
+ }, arguments); },
+ __wbg_setAttribute_71039043be82d098: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
+ arg0.setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
+ }, arguments); },
+ __wbg_setBindGroup_268fd1714fff0ef5: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
+ arg0.setBindGroup(arg1 >>> 0, arg2, getArrayU32FromWasm0(arg3, arg4), arg5, arg6 >>> 0);
+ }, arguments); },
+ __wbg_setBindGroup_f0de6cb2c7dbfc2c: function(arg0, arg1, arg2) {
+ arg0.setBindGroup(arg1 >>> 0, arg2);
+ },
+ __wbg_setIndexBuffer_2531a9103450445e: function(arg0, arg1, arg2, arg3) {
+ arg0.setIndexBuffer(arg1, __wbindgen_enum_GpuIndexFormat[arg2], arg3);
+ },
+ __wbg_setIndexBuffer_7f3cf667b4d71566: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.setIndexBuffer(arg1, __wbindgen_enum_GpuIndexFormat[arg2], arg3, arg4);
+ },
+ __wbg_setItem_364a11cf21db9039: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
+ arg0.setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
+ }, arguments); },
+ __wbg_setPipeline_c41bf46790f27f9e: function(arg0, arg1) {
+ arg0.setPipeline(arg1);
+ },
+ __wbg_setProperty_e4e51b1b1d681d15: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
+ arg0.setProperty(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
+ }, arguments); },
+ __wbg_setScissorRect_42511fefb18b86ef: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.setScissorRect(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0);
+ },
+ __wbg_setTimeout_91734b3436ad0e03: function(arg0, arg1) {
+ const ret = setTimeout(arg0, arg1);
+ return ret;
+ },
+ __wbg_setTimeout_cfa2cf195c3738db: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.setTimeout(arg1, arg2);
+ return ret;
+ }, arguments); },
+ __wbg_setTimeout_f757f00851f76c42: function(arg0, arg1) {
+ const ret = setTimeout(arg0, arg1);
+ return ret;
+ },
+ __wbg_setVertexBuffer_1e448859663dd400: function(arg0, arg1, arg2, arg3) {
+ arg0.setVertexBuffer(arg1 >>> 0, arg2, arg3);
+ },
+ __wbg_setVertexBuffer_7cf533d694e747f3: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.setVertexBuffer(arg1 >>> 0, arg2, arg3, arg4);
+ },
+ __wbg_setViewport_d9fc3eac343de7d0: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
+ arg0.setViewport(arg1, arg2, arg3, arg4, arg5, arg6);
+ },
+ __wbg_set_0de9c62c23d04ad5: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
+ arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
+ }, arguments); },
+ __wbg_set_4d7dd76f3dae2926: function(arg0, arg1, arg2) {
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
+ },
+ __wbg_set_61e45ae8061eca11: function(arg0, arg1, arg2) {
+ arg0.set(arg1, arg2 >>> 0);
+ },
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
+ arg0[arg1] = arg2;
+ },
+ __wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = Reflect.set(arg0, arg1, arg2);
+ return ret;
+ }, arguments); },
+ __wbg_set_a_88262a42340d0b1c: function(arg0, arg1) {
+ arg0.a = arg1;
+ },
+ __wbg_set_accept_5906cb0d4eb6ea4d: function(arg0, arg1, arg2) {
+ arg0.accept = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_access_9a5092f05dc45fad: function(arg0, arg1) {
+ arg0.access = __wbindgen_enum_GpuStorageTextureAccess[arg1];
+ },
+ __wbg_set_address_mode_u_9e2695575a219e33: function(arg0, arg1) {
+ arg0.addressModeU = __wbindgen_enum_GpuAddressMode[arg1];
+ },
+ __wbg_set_address_mode_v_f479b2e6cccbcac4: function(arg0, arg1) {
+ arg0.addressModeV = __wbindgen_enum_GpuAddressMode[arg1];
+ },
+ __wbg_set_address_mode_w_46273e153230180d: function(arg0, arg1) {
+ arg0.addressModeW = __wbindgen_enum_GpuAddressMode[arg1];
+ },
+ __wbg_set_alpha_bfd2df62e7bc581b: function(arg0, arg1) {
+ arg0.alpha = arg1;
+ },
+ __wbg_set_alpha_mode_df805952892caa9c: function(arg0, arg1) {
+ arg0.alphaMode = __wbindgen_enum_GpuCanvasAlphaMode[arg1];
+ },
+ __wbg_set_alpha_to_coverage_enabled_8b5dc2b0a225b3b2: function(arg0, arg1) {
+ arg0.alphaToCoverageEnabled = arg1 !== 0;
+ },
+ __wbg_set_array_layer_count_7312f0f31af94e7c: function(arg0, arg1) {
+ arg0.arrayLayerCount = arg1 >>> 0;
+ },
+ __wbg_set_array_stride_f64_27ffaf4fffd74e61: function(arg0, arg1) {
+ arg0.arrayStride = arg1;
+ },
+ __wbg_set_aspect_0d453bca3d012f02: function(arg0, arg1) {
+ arg0.aspect = __wbindgen_enum_GpuTextureAspect[arg1];
+ },
+ __wbg_set_aspect_210da747c9d77aba: function(arg0, arg1) {
+ arg0.aspect = __wbindgen_enum_GpuTextureAspect[arg1];
+ },
+ __wbg_set_aspect_4962514fe99e68e6: function(arg0, arg1) {
+ arg0.aspect = __wbindgen_enum_GpuTextureAspect[arg1];
+ },
+ __wbg_set_attributes_7537844a7e6dafdc: function(arg0, arg1, arg2) {
+ arg0.attributes = getArrayJsValueViewFromWasm0(arg1, arg2);
+ },
+ __wbg_set_b_c47befe0af3261eb: function(arg0, arg1) {
+ arg0.b = arg1;
+ },
+ __wbg_set_base_array_layer_f176bb9f1b37b342: function(arg0, arg1) {
+ arg0.baseArrayLayer = arg1 >>> 0;
+ },
+ __wbg_set_base_mip_level_1df145d9f8db32a9: function(arg0, arg1) {
+ arg0.baseMipLevel = arg1 >>> 0;
+ },
+ __wbg_set_bbfffe9b60e58c38: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
+ },
+ __wbg_set_beginning_of_pass_write_index_e9f5d016947893bd: function(arg0, arg1) {
+ arg0.beginningOfPassWriteIndex = arg1 >>> 0;
+ },
+ __wbg_set_bind_group_layouts_5a9cfea401c020ab: function(arg0, arg1, arg2) {
+ arg0.bindGroupLayouts = getArrayJsValueViewFromWasm0(arg1, arg2);
+ },
+ __wbg_set_binding_155b0440b4307793: function(arg0, arg1) {
+ arg0.binding = arg1 >>> 0;
+ },
+ __wbg_set_binding_f74df3510792aba1: function(arg0, arg1) {
+ arg0.binding = arg1 >>> 0;
+ },
+ __wbg_set_blend_7493c2066c3e9970: function(arg0, arg1) {
+ arg0.blend = arg1;
+ },
+ __wbg_set_body_029f2d171e0a005f: function(arg0, arg1) {
+ arg0.body = arg1;
+ },
+ __wbg_set_box_223b9bc0b7f548f6: function(arg0, arg1) {
+ arg0.box = __wbindgen_enum_ResizeObserverBoxOptions[arg1];
+ },
+ __wbg_set_buffer_9c01e3b6d6765ea2: function(arg0, arg1) {
+ arg0.buffer = arg1;
+ },
+ __wbg_set_buffer_c3410572051920ba: function(arg0, arg1) {
+ arg0.buffer = arg1;
+ },
+ __wbg_set_buffer_ef7f75306cf663ed: function(arg0, arg1) {
+ arg0.buffer = arg1;
+ },
+ __wbg_set_buffers_7d0d8f507699e956: function(arg0, arg1, arg2) {
+ arg0.buffers = getArrayJsValueViewFromWasm0(arg1, arg2);
+ },
+ __wbg_set_bytes_per_row_c54ca96953f35774: function(arg0, arg1) {
+ arg0.bytesPerRow = arg1 >>> 0;
+ },
+ __wbg_set_bytes_per_row_d69b88eee3929c07: function(arg0, arg1) {
+ arg0.bytesPerRow = arg1 >>> 0;
+ },
+ __wbg_set_cache_b4a740b195c051f4: function(arg0, arg1) {
+ arg0.cache = __wbindgen_enum_RequestCache[arg1];
+ },
+ __wbg_set_className_e0b1e805ac9ecbf4: function(arg0, arg1, arg2) {
+ arg0.className = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_clear_value_gpu_color_dict_6211425789c76e59: function(arg0, arg1) {
+ arg0.clearValue = arg1;
+ },
+ __wbg_set_code_b4f37f81f45b5b25: function(arg0, arg1, arg2) {
+ arg0.code = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_codec_73803202999ff3ab: function(arg0, arg1, arg2) {
+ arg0.codec = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_coded_height_5cf9f82bfb61b098: function(arg0, arg1) {
+ arg0.codedHeight = arg1 >>> 0;
+ },
+ __wbg_set_coded_width_e7ada372e1276c51: function(arg0, arg1) {
+ arg0.codedWidth = arg1 >>> 0;
+ },
+ __wbg_set_color_83aa977526e88cbb: function(arg0, arg1) {
+ arg0.color = arg1;
+ },
+ __wbg_set_color_attachments_581fdb3310e4abfa: function(arg0, arg1, arg2) {
+ arg0.colorAttachments = getArrayJsValueViewFromWasm0(arg1, arg2);
+ },
+ __wbg_set_compare_cd9b62cdb92eb580: function(arg0, arg1) {
+ arg0.compare = __wbindgen_enum_GpuCompareFunction[arg1];
+ },
+ __wbg_set_compare_f36b34abfaa08ccb: function(arg0, arg1) {
+ arg0.compare = __wbindgen_enum_GpuCompareFunction[arg1];
+ },
+ __wbg_set_count_069a4eac409bac55: function(arg0, arg1) {
+ arg0.count = arg1 >>> 0;
+ },
+ __wbg_set_create_a807a6e9ac628698: function(arg0, arg1) {
+ arg0.create = arg1 !== 0;
+ },
+ __wbg_set_create_fa1dfa475fac91e9: function(arg0, arg1) {
+ arg0.create = arg1 !== 0;
+ },
+ __wbg_set_credentials_bb34a40189e3b43b: function(arg0, arg1) {
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
+ },
+ __wbg_set_cull_mode_fc649853947a3d0c: function(arg0, arg1) {
+ arg0.cullMode = __wbindgen_enum_GpuCullMode[arg1];
+ },
+ __wbg_set_data_353846afd42a10b1: function(arg0, arg1) {
+ arg0.data = arg1;
+ },
+ __wbg_set_depth_bias_clamp_1c0d695df7f092e5: function(arg0, arg1) {
+ arg0.depthBiasClamp = arg1;
+ },
+ __wbg_set_depth_bias_d7cd16096242a657: function(arg0, arg1) {
+ arg0.depthBias = arg1;
+ },
+ __wbg_set_depth_bias_slope_scale_c4e52ec743ef55ba: function(arg0, arg1) {
+ arg0.depthBiasSlopeScale = arg1;
+ },
+ __wbg_set_depth_clear_value_beda3ec5b1a5c43a: function(arg0, arg1) {
+ arg0.depthClearValue = arg1;
+ },
+ __wbg_set_depth_compare_0c8631eb2eae98e3: function(arg0, arg1) {
+ arg0.depthCompare = __wbindgen_enum_GpuCompareFunction[arg1];
+ },
+ __wbg_set_depth_fail_op_668155ae33d3c06f: function(arg0, arg1) {
+ arg0.depthFailOp = __wbindgen_enum_GpuStencilOperation[arg1];
+ },
+ __wbg_set_depth_load_op_511c513eab4e56a9: function(arg0, arg1) {
+ arg0.depthLoadOp = __wbindgen_enum_GpuLoadOp[arg1];
+ },
+ __wbg_set_depth_or_array_layers_89371305ed0bd962: function(arg0, arg1) {
+ arg0.depthOrArrayLayers = arg1 >>> 0;
+ },
+ __wbg_set_depth_read_only_7f41a74741c144ec: function(arg0, arg1) {
+ arg0.depthReadOnly = arg1 !== 0;
+ },
+ __wbg_set_depth_stencil_97506c7bea4f53da: function(arg0, arg1) {
+ arg0.depthStencil = arg1;
+ },
+ __wbg_set_depth_stencil_attachment_73b79e8b4e948222: function(arg0, arg1) {
+ arg0.depthStencilAttachment = arg1;
+ },
+ __wbg_set_depth_store_op_c89f33b39b43361c: function(arg0, arg1) {
+ arg0.depthStoreOp = __wbindgen_enum_GpuStoreOp[arg1];
+ },
+ __wbg_set_depth_write_enabled_ce89750042940350: function(arg0, arg1) {
+ arg0.depthWriteEnabled = arg1 !== 0;
+ },
+ __wbg_set_description_1ca246c5902e3ff8: function(arg0, arg1) {
+ arg0.description = arg1;
+ },
+ __wbg_set_device_e275d1d4f3c9eb74: function(arg0, arg1) {
+ arg0.device = arg1;
+ },
+ __wbg_set_dimension_868eee80f4b90011: function(arg0, arg1) {
+ arg0.dimension = __wbindgen_enum_GpuTextureDimension[arg1];
+ },
+ __wbg_set_dimension_e325282e613ca0a4: function(arg0, arg1) {
+ arg0.dimension = __wbindgen_enum_GpuTextureViewDimension[arg1];
+ },
+ __wbg_set_download_67c3dbb2b32b18d0: function(arg0, arg1, arg2) {
+ arg0.download = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_dst_factor_ec7407f19be1aff9: function(arg0, arg1) {
+ arg0.dstFactor = __wbindgen_enum_GpuBlendFactor[arg1];
+ },
+ __wbg_set_duration_f64_d850447775429a67: function(arg0, arg1) {
+ arg0.duration = arg1;
+ },
+ __wbg_set_end_of_pass_write_index_0d546e46b86ea069: function(arg0, arg1) {
+ arg0.endOfPassWriteIndex = arg1 >>> 0;
+ },
+ __wbg_set_entries_86a29dd6291c95e7: function(arg0, arg1, arg2) {
+ arg0.entries = getArrayJsValueViewFromWasm0(arg1, arg2);
+ },
+ __wbg_set_entries_a12aca1e458b0456: function(arg0, arg1, arg2) {
+ arg0.entries = getArrayJsValueViewFromWasm0(arg1, arg2);
+ },
+ __wbg_set_entry_point_207540f042015ce5: function(arg0, arg1, arg2) {
+ arg0.entryPoint = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_entry_point_e87e79251dd3144f: function(arg0, arg1, arg2) {
+ arg0.entryPoint = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_error_e0fdb5ef69612720: function(arg0, arg1) {
+ arg0.error = arg1;
+ },
+ __wbg_set_external_texture_386483d8dd82ab56: function(arg0, arg1) {
+ arg0.externalTexture = arg1;
+ },
+ __wbg_set_fail_op_92f716dbc88b6973: function(arg0, arg1) {
+ arg0.failOp = __wbindgen_enum_GpuStencilOperation[arg1];
+ },
+ __wbg_set_flip_y_4e1632b36ad0413a: function(arg0, arg1) {
+ arg0.flipY = arg1 !== 0;
+ },
+ __wbg_set_format_1fcaa7d60546b490: function(arg0, arg1) {
+ arg0.format = __wbindgen_enum_GpuTextureFormat[arg1];
+ },
+ __wbg_set_format_2c1414a817c213f8: function(arg0, arg1) {
+ arg0.format = __wbindgen_enum_GpuTextureFormat[arg1];
+ },
+ __wbg_set_format_533f9ffa7eef563d: function(arg0, arg1) {
+ arg0.format = __wbindgen_enum_GpuTextureFormat[arg1];
+ },
+ __wbg_set_format_5d2f25cc93654ecc: function(arg0, arg1) {
+ arg0.format = __wbindgen_enum_GpuVertexFormat[arg1];
+ },
+ __wbg_set_format_5ff53724ed6cedf2: function(arg0, arg1) {
+ arg0.format = __wbindgen_enum_GpuTextureFormat[arg1];
+ },
+ __wbg_set_format_815efd4dc4817bbb: function(arg0, arg1) {
+ arg0.format = __wbindgen_enum_GpuTextureFormat[arg1];
+ },
+ __wbg_set_format_e52bdcca880d2c8e: function(arg0, arg1) {
+ arg0.format = __wbindgen_enum_GpuTextureFormat[arg1];
+ },
+ __wbg_set_fragment_8b780f00a0b0e6f3: function(arg0, arg1) {
+ arg0.fragment = arg1;
+ },
+ __wbg_set_front_face_28ffdf524eedce5b: function(arg0, arg1) {
+ arg0.frontFace = __wbindgen_enum_GpuFrontFace[arg1];
+ },
+ __wbg_set_g_5983abfc46e0cf4e: function(arg0, arg1) {
+ arg0.g = arg1;
+ },
+ __wbg_set_hardware_acceleration_e0184d39413599b8: function(arg0, arg1) {
+ arg0.hardwareAcceleration = __wbindgen_enum_HardwareAcceleration[arg1];
+ },
+ __wbg_set_has_dynamic_offset_62bc230bdb7c54d0: function(arg0, arg1) {
+ arg0.hasDynamicOffset = arg1 !== 0;
+ },
+ __wbg_set_headers_9c61d123c3ee1f10: function(arg0, arg1) {
+ arg0.headers = arg1;
+ },
+ __wbg_set_height_14335c4047cf9c1b: function(arg0, arg1) {
+ arg0.height = arg1 >>> 0;
+ },
+ __wbg_set_height_7d9d8f892e6964c6: function(arg0, arg1) {
+ arg0.height = arg1 >>> 0;
+ },
+ __wbg_set_height_bbeef8f354041577: function(arg0, arg1) {
+ arg0.height = arg1 >>> 0;
+ },
+ __wbg_set_href_25786788ec7ffedd: function(arg0, arg1, arg2) {
+ arg0.href = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_id_4beae8b813c092d8: function(arg0, arg1, arg2) {
+ arg0.id = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_innerHTML_f78a45a07f97e136: function(arg0, arg1, arg2) {
+ arg0.innerHTML = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_innerText_847403b9d4f38f77: function(arg0, arg1, arg2) {
+ arg0.innerText = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_integrity_13c390f33acee59c: function(arg0, arg1, arg2) {
+ arg0.integrity = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_08d9be3e4719c226: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_17eb9fe3a02f62b0: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_48e6b787d256f621: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_547d0d4aec39fbe9: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_5ee7427342869829: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_60ad96c811e0d109: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_72bb4f41ef0cb893: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_79387decda299036: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_9556af8b5cda3c9d: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_d010f237b26f2c55: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_e16e2dbe51349c7f: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_e3944e54881b8c50: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_label_e922700240417ab5: function(arg0, arg1, arg2) {
+ arg0.label = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_layout_50ab727f44b38f26: function(arg0, arg1) {
+ arg0.layout = arg1;
+ },
+ __wbg_set_layout_913d53c17194c989: function(arg0, arg1) {
+ arg0.layout = arg1;
+ },
+ __wbg_set_layout_gpu_auto_layout_mode_aeba193938b47882: function(arg0, arg1) {
+ arg0.layout = __wbindgen_enum_GpuAutoLayoutMode[arg1];
+ },
+ __wbg_set_load_op_99661da6c4eab9b0: function(arg0, arg1) {
+ arg0.loadOp = __wbindgen_enum_GpuLoadOp[arg1];
+ },
+ __wbg_set_lod_max_clamp_dd2d9f9f052f4f44: function(arg0, arg1) {
+ arg0.lodMaxClamp = arg1;
+ },
+ __wbg_set_lod_min_clamp_6d20c97916baeb93: function(arg0, arg1) {
+ arg0.lodMinClamp = arg1;
+ },
+ __wbg_set_mag_filter_b5adebc99cb938e1: function(arg0, arg1) {
+ arg0.magFilter = __wbindgen_enum_GpuFilterMode[arg1];
+ },
+ __wbg_set_mapped_at_creation_81b586dc90a50347: function(arg0, arg1) {
+ arg0.mappedAtCreation = arg1 !== 0;
+ },
+ __wbg_set_mask_70a8a59ce09e5997: function(arg0, arg1) {
+ arg0.mask = arg1 >>> 0;
+ },
+ __wbg_set_max_anisotropy_2beada0e2db62c45: function(arg0, arg1) {
+ arg0.maxAnisotropy = arg1;
+ },
+ __wbg_set_method_5532d59b92d76467: function(arg0, arg1, arg2) {
+ arg0.method = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_min_binding_size_f64_5005a6904cdf43da: function(arg0, arg1) {
+ arg0.minBindingSize = arg1;
+ },
+ __wbg_set_min_filter_c72f17375e135f0a: function(arg0, arg1) {
+ arg0.minFilter = __wbindgen_enum_GpuFilterMode[arg1];
+ },
+ __wbg_set_mip_level_13253f3afc7aa58a: function(arg0, arg1) {
+ arg0.mipLevel = arg1 >>> 0;
+ },
+ __wbg_set_mip_level_count_534caaa7e68e68b8: function(arg0, arg1) {
+ arg0.mipLevelCount = arg1 >>> 0;
+ },
+ __wbg_set_mip_level_count_776c8c218b65bc08: function(arg0, arg1) {
+ arg0.mipLevelCount = arg1 >>> 0;
+ },
+ __wbg_set_mip_level_f7ac79e8c54f59ad: function(arg0, arg1) {
+ arg0.mipLevel = arg1 >>> 0;
+ },
+ __wbg_set_mipmap_filter_5bf66195a3639700: function(arg0, arg1) {
+ arg0.mipmapFilter = __wbindgen_enum_GpuMipmapFilterMode[arg1];
+ },
+ __wbg_set_mode_66c79886ad78fc05: function(arg0, arg1) {
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
+ },
+ __wbg_set_mode_9990b3393ba469ae: function(arg0, arg1) {
+ arg0.mode = __wbindgen_enum_GpuCanvasToneMappingMode[arg1];
+ },
+ __wbg_set_module_d0e2098713606cae: function(arg0, arg1) {
+ arg0.module = arg1;
+ },
+ __wbg_set_module_f02e076ca7e7daf8: function(arg0, arg1) {
+ arg0.module = arg1;
+ },
+ __wbg_set_multiple_682a70d088570168: function(arg0, arg1) {
+ arg0.multiple = arg1 !== 0;
+ },
+ __wbg_set_multisample_37ddafe88b5cd466: function(arg0, arg1) {
+ arg0.multisample = arg1;
+ },
+ __wbg_set_multisampled_7913fd7183272840: function(arg0, arg1) {
+ arg0.multisampled = arg1 !== 0;
+ },
+ __wbg_set_offset_f64_28c24dc15000932e: function(arg0, arg1) {
+ arg0.offset = arg1;
+ },
+ __wbg_set_offset_f64_89f0ce01a689839e: function(arg0, arg1) {
+ arg0.offset = arg1;
+ },
+ __wbg_set_offset_f64_b562d1367e34ef93: function(arg0, arg1) {
+ arg0.offset = arg1;
+ },
+ __wbg_set_offset_f64_fa66068813376ca3: function(arg0, arg1) {
+ arg0.offset = arg1;
+ },
+ __wbg_set_once_51a9fb6b8af8a72b: function(arg0, arg1) {
+ arg0.once = arg1 !== 0;
+ },
+ __wbg_set_onclick_527135192dd54d92: function(arg0, arg1) {
+ arg0.onclick = arg1;
+ },
+ __wbg_set_onuncapturederror_c8a77eb8695205a0: function(arg0, arg1) {
+ arg0.onuncapturederror = arg1;
+ },
+ __wbg_set_operation_62ce44e1728c4047: function(arg0, arg1) {
+ arg0.operation = __wbindgen_enum_GpuBlendOperation[arg1];
+ },
+ __wbg_set_optimize_for_latency_3e3786621aaf6f56: function(arg0, arg1) {
+ arg0.optimizeForLatency = arg1 !== 0;
+ },
+ __wbg_set_origin_gpu_origin_2d_dict_1240202973e56f92: function(arg0, arg1) {
+ arg0.origin = arg1;
+ },
+ __wbg_set_origin_gpu_origin_3d_dict_37222d7b3d238123: function(arg0, arg1) {
+ arg0.origin = arg1;
+ },
+ __wbg_set_origin_gpu_origin_3d_dict_631c04520718091f: function(arg0, arg1) {
+ arg0.origin = arg1;
+ },
+ __wbg_set_output_6401c39ffe15258f: function(arg0, arg1) {
+ arg0.output = arg1;
+ },
+ __wbg_set_pass_op_cf02fa088d6352a7: function(arg0, arg1) {
+ arg0.passOp = __wbindgen_enum_GpuStencilOperation[arg1];
+ },
+ __wbg_set_power_preference_8fdca0b7af640d49: function(arg0, arg1) {
+ arg0.powerPreference = __wbindgen_enum_GpuPowerPreference[arg1];
+ },
+ __wbg_set_premultiplied_alpha_3f27816ad319d5a9: function(arg0, arg1) {
+ arg0.premultipliedAlpha = arg1 !== 0;
+ },
+ __wbg_set_prevent_scroll_82778f333ef22ca8: function(arg0, arg1) {
+ arg0.preventScroll = arg1 !== 0;
+ },
+ __wbg_set_primitive_43c23761a55b4088: function(arg0, arg1) {
+ arg0.primitive = arg1;
+ },
+ __wbg_set_query_set_41de86d2401aee04: function(arg0, arg1) {
+ arg0.querySet = arg1;
+ },
+ __wbg_set_r_c6f4c68f4804d655: function(arg0, arg1) {
+ arg0.r = arg1;
+ },
+ __wbg_set_redirect_badd73a0bcb765e3: function(arg0, arg1) {
+ arg0.redirect = __wbindgen_enum_RequestRedirect[arg1];
+ },
+ __wbg_set_referrer_02890bb2de855af1: function(arg0, arg1, arg2) {
+ arg0.referrer = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_referrer_policy_e49a6d0d7473fd16: function(arg0, arg1) {
+ arg0.referrerPolicy = __wbindgen_enum_ReferrerPolicy[arg1];
+ },
+ __wbg_set_required_features_1baf274a8669db60: function(arg0, arg1, arg2) {
+ arg0.requiredFeatures = getArrayJsValueViewFromWasm0(arg1, arg2);
+ },
+ __wbg_set_required_limits_871ed33c68613dcb: function(arg0, arg1) {
+ arg0.requiredLimits = arg1;
+ },
+ __wbg_set_resolve_target_gpu_texture_view_b19a4f2debf79b96: function(arg0, arg1) {
+ arg0.resolveTarget = arg1;
+ },
+ __wbg_set_resource_5ae7b5e67924f234: function(arg0, arg1) {
+ arg0.resource = arg1;
+ },
+ __wbg_set_resource_gpu_buffer_binding_e5dbca063e7cb67b: function(arg0, arg1) {
+ arg0.resource = arg1;
+ },
+ __wbg_set_resource_gpu_texture_view_eb46c355d51ad7e5: function(arg0, arg1) {
+ arg0.resource = arg1;
+ },
+ __wbg_set_rows_per_image_5011f97318ee71af: function(arg0, arg1) {
+ arg0.rowsPerImage = arg1 >>> 0;
+ },
+ __wbg_set_rows_per_image_59a813ac5006e10e: function(arg0, arg1) {
+ arg0.rowsPerImage = arg1 >>> 0;
+ },
+ __wbg_set_sample_count_eb86a8b18545b54f: function(arg0, arg1) {
+ arg0.sampleCount = arg1 >>> 0;
+ },
+ __wbg_set_sample_type_c32e1dfff94e63eb: function(arg0, arg1) {
+ arg0.sampleType = __wbindgen_enum_GpuTextureSampleType[arg1];
+ },
+ __wbg_set_sampler_c0e1258543a33bce: function(arg0, arg1) {
+ arg0.sampler = arg1;
+ },
+ __wbg_set_shader_location_7e1832a74f912217: function(arg0, arg1) {
+ arg0.shaderLocation = arg1 >>> 0;
+ },
+ __wbg_set_signal_c4ef8faddb4c1446: function(arg0, arg1) {
+ arg0.signal = arg1;
+ },
+ __wbg_set_size_f64_6bcd40704bf4cfdc: function(arg0, arg1) {
+ arg0.size = arg1;
+ },
+ __wbg_set_size_f64_8b8f6bba5d678162: function(arg0, arg1) {
+ arg0.size = arg1;
+ },
+ __wbg_set_size_gpu_extent_3d_dict_7e42e1c98fa36434: function(arg0, arg1) {
+ arg0.size = arg1;
+ },
+ __wbg_set_source_0c40b87cfdd5d704: function(arg0, arg1) {
+ arg0.source = arg1;
+ },
+ __wbg_set_source_html_canvas_element_f657e39507ba2fe5: function(arg0, arg1) {
+ arg0.source = arg1;
+ },
+ __wbg_set_source_html_image_element_fcc7cba0635adac1: function(arg0, arg1) {
+ arg0.source = arg1;
+ },
+ __wbg_set_source_html_video_element_e63a39653665f651: function(arg0, arg1) {
+ arg0.source = arg1;
+ },
+ __wbg_set_source_image_data_68478f1afce208b8: function(arg0, arg1) {
+ arg0.source = arg1;
+ },
+ __wbg_set_source_offscreen_canvas_266a3de949693e62: function(arg0, arg1) {
+ arg0.source = arg1;
+ },
+ __wbg_set_source_video_frame_3083c0ce54b9cb73: function(arg0, arg1) {
+ arg0.source = arg1;
+ },
+ __wbg_set_src_factor_9bfe84af9b7b5cac: function(arg0, arg1) {
+ arg0.srcFactor = __wbindgen_enum_GpuBlendFactor[arg1];
+ },
+ __wbg_set_stencil_back_85b22f1db5b1940a: function(arg0, arg1) {
+ arg0.stencilBack = arg1;
+ },
+ __wbg_set_stencil_clear_value_42be608809151e2a: function(arg0, arg1) {
+ arg0.stencilClearValue = arg1 >>> 0;
+ },
+ __wbg_set_stencil_front_525526164a798a44: function(arg0, arg1) {
+ arg0.stencilFront = arg1;
+ },
+ __wbg_set_stencil_load_op_31838c036993098a: function(arg0, arg1) {
+ arg0.stencilLoadOp = __wbindgen_enum_GpuLoadOp[arg1];
+ },
+ __wbg_set_stencil_read_mask_5cc26495e8b3ae82: function(arg0, arg1) {
+ arg0.stencilReadMask = arg1 >>> 0;
+ },
+ __wbg_set_stencil_read_only_bf1d0c1897e25c62: function(arg0, arg1) {
+ arg0.stencilReadOnly = arg1 !== 0;
+ },
+ __wbg_set_stencil_store_op_e6be1cbc3a8fc210: function(arg0, arg1) {
+ arg0.stencilStoreOp = __wbindgen_enum_GpuStoreOp[arg1];
+ },
+ __wbg_set_stencil_write_mask_d9cb40ec4b4bee5b: function(arg0, arg1) {
+ arg0.stencilWriteMask = arg1 >>> 0;
+ },
+ __wbg_set_step_mode_a97bb24714da41a9: function(arg0, arg1) {
+ arg0.stepMode = __wbindgen_enum_GpuVertexStepMode[arg1];
+ },
+ __wbg_set_storage_texture_939a097db4b18bd4: function(arg0, arg1) {
+ arg0.storageTexture = arg1;
+ },
+ __wbg_set_store_op_b5fdf672436f13f3: function(arg0, arg1) {
+ arg0.storeOp = __wbindgen_enum_GpuStoreOp[arg1];
+ },
+ __wbg_set_strip_index_format_9f787be6c5fc9e87: function(arg0, arg1) {
+ arg0.stripIndexFormat = __wbindgen_enum_GpuIndexFormat[arg1];
+ },
+ __wbg_set_tabIndex_70047c7d062bb928: function(arg0, arg1) {
+ arg0.tabIndex = arg1;
+ },
+ __wbg_set_targets_c38bd200c836d66f: function(arg0, arg1, arg2) {
+ arg0.targets = getArrayJsValueViewFromWasm0(arg1, arg2);
+ },
+ __wbg_set_texture_016561d5911339e5: function(arg0, arg1) {
+ arg0.texture = arg1;
+ },
+ __wbg_set_texture_1f64653a5d2d7b4d: function(arg0, arg1) {
+ arg0.texture = arg1;
+ },
+ __wbg_set_texture_9dcedde1bb31eda6: function(arg0, arg1) {
+ arg0.texture = arg1;
+ },
+ __wbg_set_timestamp_244da668ac8da67a: function(arg0, arg1) {
+ arg0.timestamp = arg1;
+ },
+ __wbg_set_timestamp_25d4d8d3cdbe80a2: function(arg0, arg1) {
+ arg0.timestamp = arg1;
+ },
+ __wbg_set_timestamp_f64_47419c7ea896d17c: function(arg0, arg1) {
+ arg0.timestamp = arg1;
+ },
+ __wbg_set_timestamp_writes_98bed1a8bbc6682d: function(arg0, arg1) {
+ arg0.timestampWrites = arg1;
+ },
+ __wbg_set_tone_mapping_b3464f1baa4cff92: function(arg0, arg1) {
+ arg0.toneMapping = arg1;
+ },
+ __wbg_set_topology_da25f2cc5af203d2: function(arg0, arg1) {
+ arg0.topology = __wbindgen_enum_GpuPrimitiveTopology[arg1];
+ },
+ __wbg_set_type_57a3257a711da878: function(arg0, arg1) {
+ arg0.type = __wbindgen_enum_EncodedVideoChunkType[arg1];
+ },
+ __wbg_set_type_8ce203e412e28cf6: function(arg0, arg1, arg2) {
+ arg0.type = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_type_ccf8472d40abcddf: function(arg0, arg1) {
+ arg0.type = __wbindgen_enum_GpuSamplerBindingType[arg1];
+ },
+ __wbg_set_type_d09829f59932a0fc: function(arg0, arg1) {
+ arg0.type = __wbindgen_enum_GpuBufferBindingType[arg1];
+ },
+ __wbg_set_type_d2a9a3c584ce2f9a: function(arg0, arg1, arg2) {
+ arg0.type = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_unclipped_depth_04524a2b44e1e3c1: function(arg0, arg1) {
+ arg0.unclippedDepth = arg1 !== 0;
+ },
+ __wbg_set_usage_a137f82ca163b0a9: function(arg0, arg1) {
+ arg0.usage = arg1 >>> 0;
+ },
+ __wbg_set_usage_b2a2935f37bf3d08: function(arg0, arg1) {
+ arg0.usage = arg1 >>> 0;
+ },
+ __wbg_set_usage_ba5b0f8b333ab325: function(arg0, arg1) {
+ arg0.usage = arg1 >>> 0;
+ },
+ __wbg_set_usage_ddd42599bbba7779: function(arg0, arg1) {
+ arg0.usage = arg1 >>> 0;
+ },
+ __wbg_set_value_e5d078763e63e81e: function(arg0, arg1, arg2) {
+ arg0.value = getStringFromWasm0(arg1, arg2);
+ },
+ __wbg_set_vertex_0be5d146f9ff6f36: function(arg0, arg1) {
+ arg0.vertex = arg1;
+ },
+ __wbg_set_view_dimension_0df554032f1f3a85: function(arg0, arg1) {
+ arg0.viewDimension = __wbindgen_enum_GpuTextureViewDimension[arg1];
+ },
+ __wbg_set_view_dimension_4818d4c18ce5815e: function(arg0, arg1) {
+ arg0.viewDimension = __wbindgen_enum_GpuTextureViewDimension[arg1];
+ },
+ __wbg_set_view_formats_4347dc8363331086: function(arg0, arg1, arg2) {
+ arg0.viewFormats = getArrayJsValueViewFromWasm0(arg1, arg2);
+ },
+ __wbg_set_view_formats_5797d2fff3c11808: function(arg0, arg1, arg2) {
+ arg0.viewFormats = getArrayJsValueViewFromWasm0(arg1, arg2);
+ },
+ __wbg_set_view_gpu_texture_view_9b2d86b6b99d9fd9: function(arg0, arg1) {
+ arg0.view = arg1;
+ },
+ __wbg_set_view_gpu_texture_view_c0f35f8857c25206: function(arg0, arg1) {
+ arg0.view = arg1;
+ },
+ __wbg_set_visibility_9570b037224c4cc2: function(arg0, arg1) {
+ arg0.visibility = arg1 >>> 0;
+ },
+ __wbg_set_width_49ac9b7d914afc85: function(arg0, arg1) {
+ arg0.width = arg1 >>> 0;
+ },
+ __wbg_set_width_8e30d010cd66830d: function(arg0, arg1) {
+ arg0.width = arg1 >>> 0;
+ },
+ __wbg_set_width_9f685402c2cbee70: function(arg0, arg1) {
+ arg0.width = arg1 >>> 0;
+ },
+ __wbg_set_write_mask_d45279e56abbfcb5: function(arg0, arg1) {
+ arg0.writeMask = arg1 >>> 0;
+ },
+ __wbg_set_x_232d24fdc32d8351: function(arg0, arg1) {
+ arg0.x = arg1 >>> 0;
+ },
+ __wbg_set_x_876d592971db129a: function(arg0, arg1) {
+ arg0.x = arg1 >>> 0;
+ },
+ __wbg_set_y_18fe375093e59dfb: function(arg0, arg1) {
+ arg0.y = arg1 >>> 0;
+ },
+ __wbg_set_y_2b1f5ac0dd5586a5: function(arg0, arg1) {
+ arg0.y = arg1 >>> 0;
+ },
+ __wbg_set_z_ef005d82bc9d24e3: function(arg0, arg1) {
+ arg0.z = arg1 >>> 0;
+ },
+ __wbg_shaderSource_4cf90af97621ff49: function(arg0, arg1, arg2, arg3) {
+ arg0.shaderSource(arg1, getStringFromWasm0(arg2, arg3));
+ },
+ __wbg_shaderSource_c3469dc2221dd528: function(arg0, arg1, arg2, arg3) {
+ arg0.shaderSource(arg1, getStringFromWasm0(arg2, arg3));
+ },
+ __wbg_shiftKey_9bcb8bdd60c2f152: function(arg0) {
+ const ret = arg0.shiftKey;
+ return ret;
+ },
+ __wbg_shiftKey_9f797da486b2ade8: function(arg0) {
+ const ret = arg0.shiftKey;
+ return ret;
+ },
+ __wbg_signal_dad7cb35193abd31: function(arg0) {
+ const ret = arg0.signal;
+ return ret;
+ },
+ __wbg_size_6304a694765921a9: function(arg0) {
+ const ret = arg0.size;
+ return ret;
+ },
+ __wbg_size_79acc354d385bbfe: function(arg0) {
+ const ret = arg0.size;
+ return ret;
+ },
+ __wbg_slice_2b88ff0ac64039d6: function(arg0, arg1) {
+ const ret = arg1.slice();
+ const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_malloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_slice_7c7553e3b38b0ddb: function() { return handleError(function (arg0, arg1, arg2) {
+ const ret = arg0.slice(arg1, arg2);
+ return ret;
+ }, arguments); },
+ __wbg_stack_12be8432da3b35d0: function(arg0, arg1) {
+ const ret = arg1.stack;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_stack_9ed1bd1924f4f869: function(arg0, arg1) {
+ const ret = arg1.stack;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_state_c83ca713bb9cda98: function(arg0) {
+ const ret = arg0.state;
+ return ret;
+ },
+ __wbg_state_d4cb8ed54a665e6e: function(arg0) {
+ const ret = arg0.state;
+ return (__wbindgen_enum_CodecState.indexOf(ret) + 1 || 4) - 1;
+ },
+ __wbg_state_edcc5b2da67f07f2: function() { return handleError(function (arg0) {
+ const ret = arg0.state;
+ return ret;
+ }, arguments); },
+ __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
+ const ret = typeof global === 'undefined' ? null : global;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_static_accessor_SELF_146583524fe1469b: function() {
+ const ret = typeof self === 'undefined' ? null : self;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
+ const ret = typeof window === 'undefined' ? null : window;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_statusText_9f08c32741a99815: function(arg0, arg1) {
+ const ret = arg1.statusText;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_status_c45b3b9b3033184a: function(arg0) {
+ const ret = arg0.status;
+ return ret;
+ },
+ __wbg_stencilFuncSeparate_35136c4e5153406f: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.stencilFuncSeparate(arg1 >>> 0, arg2 >>> 0, arg3, arg4 >>> 0);
+ },
+ __wbg_stencilFuncSeparate_814300446c2969ef: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.stencilFuncSeparate(arg1 >>> 0, arg2 >>> 0, arg3, arg4 >>> 0);
+ },
+ __wbg_stencilMaskSeparate_49367b0b5883a8bd: function(arg0, arg1, arg2) {
+ arg0.stencilMaskSeparate(arg1 >>> 0, arg2 >>> 0);
+ },
+ __wbg_stencilMaskSeparate_63976cc45fb94d84: function(arg0, arg1, arg2) {
+ arg0.stencilMaskSeparate(arg1 >>> 0, arg2 >>> 0);
+ },
+ __wbg_stencilMask_1c99b79b516d12dd: function(arg0, arg1) {
+ arg0.stencilMask(arg1 >>> 0);
+ },
+ __wbg_stencilMask_9a844dc58a89992f: function(arg0, arg1) {
+ arg0.stencilMask(arg1 >>> 0);
+ },
+ __wbg_stencilOpSeparate_b2cb9af05b803e02: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.stencilOpSeparate(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0);
+ },
+ __wbg_stencilOpSeparate_c77fcb47561d0aee: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.stencilOpSeparate(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0);
+ },
+ __wbg_stopPropagation_4c4ff88c29f9bc38: function(arg0) {
+ arg0.stopPropagation();
+ },
+ __wbg_storage_756400487605531a: function(arg0) {
+ const ret = arg0.storage;
+ return ret;
+ },
+ __wbg_stream_0ea97b74f081f92b: function(arg0) {
+ const ret = arg0.stream();
+ return ret;
+ },
+ __wbg_stringify_b54333f60f1e4dad: function() { return handleError(function (arg0) {
+ const ret = JSON.stringify(arg0);
+ return ret;
+ }, arguments); },
+ __wbg_structuredClone_93aecf316c984721: function() { return handleError(function (arg0) {
+ const ret = window.structuredClone(arg0);
+ return ret;
+ }, arguments); },
+ __wbg_style_6657aed849e5d757: function(arg0) {
+ const ret = arg0.style;
+ return ret;
+ },
+ __wbg_subgroupMaxSize_1527c5f7a8fe91bb: function(arg0) {
+ const ret = arg0.subgroupMaxSize;
+ return ret;
+ },
+ __wbg_subgroupMinSize_d6c5ad4bddc828e9: function(arg0) {
+ const ret = arg0.subgroupMinSize;
+ return ret;
+ },
+ __wbg_submit_ce44115121cd166c: function(arg0, arg1, arg2) {
+ arg0.submit(getArrayJsValueViewFromWasm0(arg1, arg2));
+ },
+ __wbg_texImage2D_3813406af5bf54c8: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.texImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
+ }, arguments); },
+ __wbg_texImage2D_5abd8779d1d033c7: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.texImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
+ }, arguments); },
+ __wbg_texImage2D_8d168171984f2a40: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.texImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
+ }, arguments); },
+ __wbg_texImage3D_bdd9bebe42ed1f52: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) {
+ arg0.texImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8 >>> 0, arg9 >>> 0, arg10);
+ }, arguments); },
+ __wbg_texImage3D_ef16a1f721b3f908: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) {
+ arg0.texImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8 >>> 0, arg9 >>> 0, arg10);
+ }, arguments); },
+ __wbg_texParameteri_1fc451e0964fc91c: function(arg0, arg1, arg2, arg3) {
+ arg0.texParameteri(arg1 >>> 0, arg2 >>> 0, arg3);
+ },
+ __wbg_texParameteri_9d0daa263d3a863f: function(arg0, arg1, arg2, arg3) {
+ arg0.texParameteri(arg1 >>> 0, arg2 >>> 0, arg3);
+ },
+ __wbg_texStorage2D_7f947efc63dac273: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.texStorage2D(arg1 >>> 0, arg2, arg3 >>> 0, arg4, arg5);
+ },
+ __wbg_texStorage3D_f8f2e4b3386736f9: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
+ arg0.texStorage3D(arg1 >>> 0, arg2, arg3 >>> 0, arg4, arg5, arg6);
+ },
+ __wbg_texSubImage2D_047380bb2660e4f9: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
+ }, arguments); },
+ __wbg_texSubImage2D_5058af3d30a8e205: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
+ }, arguments); },
+ __wbg_texSubImage2D_6a376bfc3a31436b: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
+ }, arguments); },
+ __wbg_texSubImage2D_98c43894eb217aa7: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
+ }, arguments); },
+ __wbg_texSubImage2D_bed5e7a3cd81d409: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
+ }, arguments); },
+ __wbg_texSubImage2D_cccafa6de64f2781: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
+ }, arguments); },
+ __wbg_texSubImage2D_d1af697e69f8a9e4: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
+ }, arguments); },
+ __wbg_texSubImage2D_d3cd09d0ffcb27be: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
+ }, arguments); },
+ __wbg_texSubImage2D_e107b4f88c19b920: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
+ arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
+ }, arguments); },
+ __wbg_texSubImage3D_3711a86f03ffceef: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
+ arg0.texSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10 >>> 0, arg11);
+ }, arguments); },
+ __wbg_texSubImage3D_45e498ae6298998c: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
+ arg0.texSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10 >>> 0, arg11);
+ }, arguments); },
+ __wbg_texSubImage3D_4fdd4cd95a2925c2: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
+ arg0.texSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10 >>> 0, arg11);
+ }, arguments); },
+ __wbg_texSubImage3D_6cb6cfd732dad145: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
+ arg0.texSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10 >>> 0, arg11);
+ }, arguments); },
+ __wbg_texSubImage3D_8077e90ec309c414: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
+ arg0.texSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10 >>> 0, arg11);
+ }, arguments); },
+ __wbg_texSubImage3D_93b38c69acb735c8: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
+ arg0.texSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10 >>> 0, arg11);
+ }, arguments); },
+ __wbg_texSubImage3D_c9e5a071796d412f: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
+ arg0.texSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10 >>> 0, arg11);
+ }, arguments); },
+ __wbg_texSubImage3D_feebaf7f0f4594c6: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
+ arg0.texSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10 >>> 0, arg11);
+ }, arguments); },
+ __wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
+ const ret = arg0.then(arg1, arg2);
+ return ret;
+ },
+ __wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
+ const ret = arg0.then(arg1);
+ return ret;
+ },
+ __wbg_timestamp_263c471d3598c2cc: function(arg0) {
+ const ret = arg0.timestamp;
+ return ret;
+ },
+ __wbg_toString_b201c2690bbe445a: function(arg0) {
+ const ret = arg0.toString();
+ return ret;
+ },
+ __wbg_toString_bac9199ff382784d: function(arg0) {
+ const ret = arg0.toString();
+ return ret;
+ },
+ __wbg_top_fe120acfa924a430: function(arg0) {
+ const ret = arg0.top;
+ return ret;
+ },
+ __wbg_touches_a631c50f1b367753: function(arg0) {
+ const ret = arg0.touches;
+ return ret;
+ },
+ __wbg_type_fa708ab6c8b1b8ab: function(arg0, arg1) {
+ const ret = arg1.type;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_unconfigure_0a07a0a40de8988d: function(arg0) {
+ arg0.unconfigure();
+ },
+ __wbg_uniform1f_62692c8fa8e7bf1e: function(arg0, arg1, arg2) {
+ arg0.uniform1f(arg1, arg2);
+ },
+ __wbg_uniform1f_b79d0c5667f9fb40: function(arg0, arg1, arg2) {
+ arg0.uniform1f(arg1, arg2);
+ },
+ __wbg_uniform1i_5830de6702add20a: function(arg0, arg1, arg2) {
+ arg0.uniform1i(arg1, arg2);
+ },
+ __wbg_uniform1i_7621f908f78177df: function(arg0, arg1, arg2) {
+ arg0.uniform1i(arg1, arg2);
+ },
+ __wbg_uniform1ui_cd7ad5581093b3df: function(arg0, arg1, arg2) {
+ arg0.uniform1ui(arg1, arg2 >>> 0);
+ },
+ __wbg_uniform2fv_1b43656b33177d21: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform2fv(arg1, getArrayF32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform2fv_948dab6a82b428ac: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform2fv(arg1, getArrayF32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform2iv_859048b9d60f46ae: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform2iv(arg1, getArrayI32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform2iv_f84a24961c0cfcd0: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform2iv(arg1, getArrayI32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform2uiv_8a9cb3155271213b: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform2uiv(arg1, getArrayU32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform3fv_8ecb5ebb510b7bce: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform3fv(arg1, getArrayF32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform3fv_95d1933ea1440725: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform3fv(arg1, getArrayF32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform3iv_09abae5eabd6b9d6: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform3iv(arg1, getArrayI32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform3iv_a3a7008990fd84f0: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform3iv(arg1, getArrayI32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform3uiv_3c0b163732f5b8f0: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform3uiv(arg1, getArrayU32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform4f_9ff60fc65b0ed726: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.uniform4f(arg1, arg2, arg3, arg4, arg5);
+ },
+ __wbg_uniform4f_b25e39808b830021: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.uniform4f(arg1, arg2, arg3, arg4, arg5);
+ },
+ __wbg_uniform4fv_4ca8c114ca3de099: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform4fv(arg1, getArrayF32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform4fv_674a247aeb15012d: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform4fv(arg1, getArrayF32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform4iv_45ab52abcb3f882c: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform4iv(arg1, getArrayI32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform4iv_d02934d7b94df609: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform4iv(arg1, getArrayI32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniform4uiv_0d1a8ed214f10c31: function(arg0, arg1, arg2, arg3) {
+ arg0.uniform4uiv(arg1, getArrayU32FromWasm0(arg2, arg3));
+ },
+ __wbg_uniformBlockBinding_a9ed6b750199e03c: function(arg0, arg1, arg2, arg3) {
+ arg0.uniformBlockBinding(arg1, arg2 >>> 0, arg3 >>> 0);
+ },
+ __wbg_uniformMatrix2fv_769725d64641341f: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.uniformMatrix2fv(arg1, arg2 !== 0, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_uniformMatrix2fv_9284424cc6aac672: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.uniformMatrix2fv(arg1, arg2 !== 0, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_uniformMatrix2x3fv_dba00c4fc8eefe47: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.uniformMatrix2x3fv(arg1, arg2 !== 0, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_uniformMatrix2x4fv_d801a561c3c18169: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.uniformMatrix2x4fv(arg1, arg2 !== 0, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_uniformMatrix3fv_33e96c7d29dc1e22: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.uniformMatrix3fv(arg1, arg2 !== 0, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_uniformMatrix3fv_568aa181379c8a75: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.uniformMatrix3fv(arg1, arg2 !== 0, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_uniformMatrix3x2fv_ce43e8186ea60a1e: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.uniformMatrix3x2fv(arg1, arg2 !== 0, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_uniformMatrix3x4fv_8abccc5745b0dd90: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.uniformMatrix3x4fv(arg1, arg2 !== 0, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_uniformMatrix4fv_25115a23e04f6db7: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.uniformMatrix4fv(arg1, arg2 !== 0, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_uniformMatrix4fv_423b958042692150: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.uniformMatrix4fv(arg1, arg2 !== 0, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_uniformMatrix4x2fv_1ac2bf986a322e3f: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.uniformMatrix4x2fv(arg1, arg2 !== 0, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_uniformMatrix4x3fv_8640fa85b90ea910: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.uniformMatrix4x3fv(arg1, arg2 !== 0, getArrayF32FromWasm0(arg3, arg4));
+ },
+ __wbg_unmap_adaf93276fdf9aaf: function(arg0) {
+ arg0.unmap();
+ },
+ __wbg_url_abdb8fb08377f8c0: function(arg0, arg1) {
+ const ret = arg1.url;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_usage_437399485b209edf: function(arg0) {
+ const ret = arg0.usage;
+ return ret;
+ },
+ __wbg_useProgram_182d120fe476921b: function(arg0, arg1) {
+ arg0.useProgram(arg1);
+ },
+ __wbg_useProgram_49495850b446fa56: function(arg0, arg1) {
+ arg0.useProgram(arg1);
+ },
+ __wbg_userActivation_61228a123251b08f: function(arg0) {
+ const ret = arg0.userActivation;
+ return ret;
+ },
+ __wbg_userAgent_0558f0ac642f7771: function() { return handleError(function (arg0, arg1) {
+ const ret = arg1.userAgent;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ }, arguments); },
+ __wbg_valueOf_64f89f12f08671ee: function(arg0) {
+ const ret = arg0.valueOf();
+ return ret;
+ },
+ __wbg_value_1f687dfa7d6c3d08: function(arg0, arg1) {
+ const ret = arg1.value;
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ const len1 = WASM_VECTOR_LEN;
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
+ },
+ __wbg_value_a5d5488a9589444a: function(arg0) {
+ const ret = arg0.value;
+ return ret;
+ },
+ __wbg_vertexAttribDivisorANGLE_978337b09d11ed84: function(arg0, arg1, arg2) {
+ arg0.vertexAttribDivisorANGLE(arg1 >>> 0, arg2 >>> 0);
+ },
+ __wbg_vertexAttribDivisor_fb31b5ed9bc856da: function(arg0, arg1, arg2) {
+ arg0.vertexAttribDivisor(arg1 >>> 0, arg2 >>> 0);
+ },
+ __wbg_vertexAttribIPointer_de08a8d8b625e253: function(arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.vertexAttribIPointer(arg1 >>> 0, arg2, arg3 >>> 0, arg4, arg5);
+ },
+ __wbg_vertexAttribPointer_a8f0af57269c2067: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
+ arg0.vertexAttribPointer(arg1 >>> 0, arg2, arg3 >>> 0, arg4 !== 0, arg5, arg6);
+ },
+ __wbg_vertexAttribPointer_b300c8e000cdac93: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
+ arg0.vertexAttribPointer(arg1 >>> 0, arg2, arg3 >>> 0, arg4 !== 0, arg5, arg6);
+ },
+ __wbg_videoHeight_1420ccecd0b8b9a1: function(arg0) {
+ const ret = arg0.videoHeight;
+ return ret;
+ },
+ __wbg_videoWidth_3c582f863b387cd5: function(arg0) {
+ const ret = arg0.videoWidth;
+ return ret;
+ },
+ __wbg_view_21f1d4a4f175dfa9: function(arg0) {
+ const ret = arg0.view;
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
+ },
+ __wbg_viewport_affdf15c559df1e2: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.viewport(arg1, arg2, arg3, arg4);
+ },
+ __wbg_viewport_e8a16ca4a5085e5f: function(arg0, arg1, arg2, arg3, arg4) {
+ arg0.viewport(arg1, arg2, arg3, arg4);
+ },
+ __wbg_warn_77c4eb4a21e10a21: function(arg0, arg1, arg2, arg3) {
+ console.warn(arg0, arg1, arg2, arg3);
+ },
+ __wbg_warn_b1370d804fa3e259: function(arg0) {
+ console.warn(arg0);
+ },
+ __wbg_width_05a6fecf7eca198d: function(arg0) {
+ const ret = arg0.width;
+ return ret;
+ },
+ __wbg_width_20c45c895834b83f: function(arg0) {
+ const ret = arg0.width;
+ return ret;
+ },
+ __wbg_width_6d9315ecc7140ff6: function(arg0) {
+ const ret = arg0.width;
+ return ret;
+ },
+ __wbg_width_c1e3781335067e0c: function(arg0) {
+ const ret = arg0.width;
+ return ret;
+ },
+ __wbg_width_d2f212a0df13e242: function(arg0) {
+ const ret = arg0.width;
+ return ret;
+ },
+ __wbg_width_f9b3cbe357a34b85: function(arg0) {
+ const ret = arg0.width;
+ return ret;
+ },
+ __wbg_writeBuffer_8b5bd251a89198bc: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
+ arg0.writeBuffer(arg1, arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
+ }, arguments); },
+ __wbg_writeText_34bfead2ae78e5bb: function(arg0, arg1, arg2) {
+ const ret = arg0.writeText(getStringFromWasm0(arg1, arg2));
+ return ret;
+ },
+ __wbg_writeTexture_53ba204c494b042c: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
+ arg0.writeTexture(arg1, getArrayU8FromWasm0(arg2, arg3), arg4, arg5);
+ }, arguments); },
+ __wbg_write_2d484d0dddfacea9: function(arg0, arg1) {
+ const ret = arg0.write(arg1);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 30866, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h764f62e2e9f0b28a);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 35570, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hf5ab2b0e699d4375);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 25362, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1b8e70bf81932a72);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Error")], shim_idx: 28853, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h04afcae3e0839798);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 25362, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1b8e70bf81932a72_4);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 25601, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h52e74acfe7eba3a3);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000007: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 25602, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h991044b12b207aeb);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000008: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PopStateEvent")], shim_idx: 8, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h5a4a279089dfc290);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("StorageEvent")], shim_idx: 4680, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__ha617783b6c8d7033);
+ return ret;
+ },
+ __wbindgen_cast_000000000000000a: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("VideoFrame")], shim_idx: 28853, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h04afcae3e0839798_9);
+ return ret;
+ },
+ __wbindgen_cast_000000000000000b: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 25601, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h52e74acfe7eba3a3_10);
+ return ret;
+ },
+ __wbindgen_cast_000000000000000c: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 25601, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h52e74acfe7eba3a3_11);
+ return ret;
+ },
+ __wbindgen_cast_000000000000000d: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 28852, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hb3308f9470298f68);
+ return ret;
+ },
+ __wbindgen_cast_000000000000000e: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2104, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__ha5a90c0ae8ed2257);
+ return ret;
+ },
+ __wbindgen_cast_000000000000000f: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 25363, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h5532da4c0e334d68);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000010: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 29477, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h5906433b3b84f0a2);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000011: function(arg0, arg1) {
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 7596, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h10a72af867dc4fc9);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000012: function(arg0) {
+ // Cast intrinsic for `F64 -> Externref`.
+ const ret = arg0;
+ return ret;
+ },
+ __wbindgen_cast_0000000000000013: function(arg0, arg1) {
+ // Cast intrinsic for `Ref(Slice(F32)) -> NamedExternref("Float32Array")`.
+ const ret = getArrayF32FromWasm0(arg0, arg1);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000014: function(arg0, arg1) {
+ // Cast intrinsic for `Ref(Slice(I16)) -> NamedExternref("Int16Array")`.
+ const ret = getArrayI16FromWasm0(arg0, arg1);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000015: function(arg0, arg1) {
+ // Cast intrinsic for `Ref(Slice(I32)) -> NamedExternref("Int32Array")`.
+ const ret = getArrayI32FromWasm0(arg0, arg1);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000016: function(arg0, arg1) {
+ // Cast intrinsic for `Ref(Slice(I8)) -> NamedExternref("Int8Array")`.
+ const ret = getArrayI8FromWasm0(arg0, arg1);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000017: function(arg0, arg1) {
+ // Cast intrinsic for `Ref(Slice(U16)) -> NamedExternref("Uint16Array")`.
+ const ret = getArrayU16FromWasm0(arg0, arg1);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000018: function(arg0, arg1) {
+ // Cast intrinsic for `Ref(Slice(U32)) -> NamedExternref("Uint32Array")`.
+ const ret = getArrayU32FromWasm0(arg0, arg1);
+ return ret;
+ },
+ __wbindgen_cast_0000000000000019: function(arg0, arg1) {
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
+ const ret = getArrayU8FromWasm0(arg0, arg1);
+ return ret;
+ },
+ __wbindgen_cast_000000000000001a: function(arg0, arg1) {
+ // Cast intrinsic for `Ref(String) -> Externref`.
+ const ret = getStringFromWasm0(arg0, arg1);
+ return ret;
+ },
+ __wbindgen_cast_000000000000001b: function(arg0, arg1) {
+ var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
+ wasm.__wbindgen_free(arg0, arg1 * 1, 1);
+ // Cast intrinsic for `Vector(U8) -> Externref`.
+ const ret = v0;
+ return ret;
+ },
+ __wbindgen_init_externref_table: function() {
+ const table = wasm.__wbindgen_externrefs;
+ const offset = table.grow(4);
+ table.set(0, undefined);
+ table.set(offset + 0, undefined);
+ table.set(offset + 1, null);
+ table.set(offset + 2, true);
+ table.set(offset + 3, false);
+ },
+ };
+ return {
+ __proto__: null,
+ "./re_viewer_bg.js": import0,
+ };
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__ha5a90c0ae8ed2257(arg0, arg1) {
+ wasm.wasm_bindgen__convert__closures_____invoke__ha5a90c0ae8ed2257(arg0, arg1);
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h5906433b3b84f0a2(arg0, arg1) {
+ wasm.wasm_bindgen__convert__closures_____invoke__h5906433b3b84f0a2(arg0, arg1);
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h10a72af867dc4fc9(arg0, arg1) {
+ wasm.wasm_bindgen__convert__closures_____invoke__h10a72af867dc4fc9(arg0, arg1);
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h5532da4c0e334d68(arg0, arg1) {
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h5532da4c0e334d68(arg0, arg1);
+ if (ret[1]) {
+ throw takeFromExternrefTable0(ret[0]);
+ }
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h764f62e2e9f0b28a(arg0, arg1, arg2) {
+ wasm.wasm_bindgen__convert__closures_____invoke__h764f62e2e9f0b28a(arg0, arg1, arg2);
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h1b8e70bf81932a72(arg0, arg1, arg2) {
+ wasm.wasm_bindgen__convert__closures_____invoke__h1b8e70bf81932a72(arg0, arg1, arg2);
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h04afcae3e0839798(arg0, arg1, arg2) {
+ wasm.wasm_bindgen__convert__closures_____invoke__h04afcae3e0839798(arg0, arg1, arg2);
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h1b8e70bf81932a72_4(arg0, arg1, arg2) {
+ wasm.wasm_bindgen__convert__closures_____invoke__h1b8e70bf81932a72_4(arg0, arg1, arg2);
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h991044b12b207aeb(arg0, arg1, arg2) {
+ wasm.wasm_bindgen__convert__closures_____invoke__h991044b12b207aeb(arg0, arg1, arg2);
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__ha617783b6c8d7033(arg0, arg1, arg2) {
+ wasm.wasm_bindgen__convert__closures_____invoke__ha617783b6c8d7033(arg0, arg1, arg2);
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h04afcae3e0839798_9(arg0, arg1, arg2) {
+ wasm.wasm_bindgen__convert__closures_____invoke__h04afcae3e0839798_9(arg0, arg1, arg2);
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__hf5ab2b0e699d4375(arg0, arg1, arg2) {
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hf5ab2b0e699d4375(arg0, arg1, arg2);
+ if (ret[1]) {
+ throw takeFromExternrefTable0(ret[0]);
+ }
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h52e74acfe7eba3a3(arg0, arg1, arg2) {
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h52e74acfe7eba3a3(arg0, arg1, arg2);
+ if (ret[1]) {
+ throw takeFromExternrefTable0(ret[0]);
+ }
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h5a4a279089dfc290(arg0, arg1, arg2) {
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h5a4a279089dfc290(arg0, arg1, arg2);
+ if (ret[1]) {
+ throw takeFromExternrefTable0(ret[0]);
+ }
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h52e74acfe7eba3a3_10(arg0, arg1, arg2) {
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h52e74acfe7eba3a3_10(arg0, arg1, arg2);
+ if (ret[1]) {
+ throw takeFromExternrefTable0(ret[0]);
+ }
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h52e74acfe7eba3a3_11(arg0, arg1, arg2) {
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h52e74acfe7eba3a3_11(arg0, arg1, arg2);
+ if (ret[1]) {
+ throw takeFromExternrefTable0(ret[0]);
+ }
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__hb3308f9470298f68(arg0, arg1, arg2) {
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hb3308f9470298f68(arg0, arg1, arg2);
+ if (ret[1]) {
+ throw takeFromExternrefTable0(ret[0]);
+ }
+ }
+
+ function wasm_bindgen__convert__closures_____invoke__h10b6862cecdf1332(arg0, arg1, arg2, arg3) {
+ wasm.wasm_bindgen__convert__closures_____invoke__h10b6862cecdf1332(arg0, arg1, arg2, arg3);
+ }
+
+
+ const __wbindgen_enum_CodecState = ["unconfigured", "configured", "closed"];
+
+
+ const __wbindgen_enum_EncodedVideoChunkType = ["key", "delta"];
+
+
+ const __wbindgen_enum_GpuAddressMode = ["clamp-to-edge", "repeat", "mirror-repeat"];
+
+
+ const __wbindgen_enum_GpuAutoLayoutMode = ["auto"];
+
+
+ const __wbindgen_enum_GpuBlendFactor = ["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"];
+
+
+ const __wbindgen_enum_GpuBlendOperation = ["add", "subtract", "reverse-subtract", "min", "max"];
+
+
+ const __wbindgen_enum_GpuBufferBindingType = ["uniform", "storage", "read-only-storage"];
+
+
+ const __wbindgen_enum_GpuCanvasAlphaMode = ["opaque", "premultiplied"];
+
+
+ const __wbindgen_enum_GpuCanvasToneMappingMode = ["standard", "extended"];
+
+
+ const __wbindgen_enum_GpuCompareFunction = ["never", "less", "equal", "less-equal", "greater", "not-equal", "greater-equal", "always"];
+
+
+ const __wbindgen_enum_GpuCullMode = ["none", "front", "back"];
+
+
+ const __wbindgen_enum_GpuFilterMode = ["nearest", "linear"];
+
+
+ const __wbindgen_enum_GpuFrontFace = ["ccw", "cw"];
+
+
+ const __wbindgen_enum_GpuIndexFormat = ["uint16", "uint32"];
+
+
+ const __wbindgen_enum_GpuLoadOp = ["load", "clear"];
+
+
+ const __wbindgen_enum_GpuMipmapFilterMode = ["nearest", "linear"];
+
+
+ const __wbindgen_enum_GpuPowerPreference = ["low-power", "high-performance"];
+
+
+ const __wbindgen_enum_GpuPrimitiveTopology = ["point-list", "line-list", "line-strip", "triangle-list", "triangle-strip"];
+
+
+ const __wbindgen_enum_GpuSamplerBindingType = ["filtering", "non-filtering", "comparison"];
+
+
+ const __wbindgen_enum_GpuStencilOperation = ["keep", "zero", "replace", "invert", "increment-clamp", "decrement-clamp", "increment-wrap", "decrement-wrap"];
+
+
+ const __wbindgen_enum_GpuStorageTextureAccess = ["write-only", "read-only", "read-write"];
+
+
+ const __wbindgen_enum_GpuStoreOp = ["store", "discard"];
+
+
+ const __wbindgen_enum_GpuTextureAspect = ["all", "stencil-only", "depth-only"];
+
+
+ const __wbindgen_enum_GpuTextureDimension = ["1d", "2d", "3d"];
+
+
+ const __wbindgen_enum_GpuTextureFormat = ["r8unorm", "r8snorm", "r8uint", "r8sint", "r16unorm", "r16snorm", "r16uint", "r16sint", "r16float", "rg8unorm", "rg8snorm", "rg8uint", "rg8sint", "r32uint", "r32sint", "r32float", "rg16unorm", "rg16snorm", "rg16uint", "rg16sint", "rg16float", "rgba8unorm", "rgba8unorm-srgb", "rgba8snorm", "rgba8uint", "rgba8sint", "bgra8unorm", "bgra8unorm-srgb", "rgb9e5ufloat", "rgb10a2uint", "rgb10a2unorm", "rg11b10ufloat", "rg32uint", "rg32sint", "rg32float", "rgba16unorm", "rgba16snorm", "rgba16uint", "rgba16sint", "rgba16float", "rgba32uint", "rgba32sint", "rgba32float", "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"];
+
+
+ const __wbindgen_enum_GpuTextureSampleType = ["float", "unfilterable-float", "depth", "sint", "uint"];
+
+
+ const __wbindgen_enum_GpuTextureViewDimension = ["1d", "2d", "2d-array", "cube", "cube-array", "3d"];
+
+
+ const __wbindgen_enum_GpuVertexFormat = ["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"];
+
+
+ const __wbindgen_enum_GpuVertexStepMode = ["vertex", "instance"];
+
+
+ const __wbindgen_enum_HardwareAcceleration = ["no-preference", "prefer-hardware", "prefer-software"];
+
+
+ const __wbindgen_enum_ReadableStreamType = ["bytes"];
+
+
+ const __wbindgen_enum_ReferrerPolicy = ["", "no-referrer", "no-referrer-when-downgrade", "origin", "origin-when-cross-origin", "unsafe-url", "same-origin", "strict-origin", "strict-origin-when-cross-origin"];
+
+
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
+
+
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
+
+
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
+
+
+ const __wbindgen_enum_RequestRedirect = ["follow", "error", "manual"];
+
+
+ const __wbindgen_enum_ResizeObserverBoxOptions = ["border-box", "content-box", "device-pixel-content-box"];
+ const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
+ ? { register: () => {}, unregister: () => {} }
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr, 1));
+ const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
+ ? { register: () => {}, unregister: () => {} }
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr, 1));
+ const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
+ ? { register: () => {}, unregister: () => {} }
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr, 1));
+ const WebHandleFinalization = (typeof FinalizationRegistry === 'undefined')
+ ? { register: () => {}, unregister: () => {} }
+ : new FinalizationRegistry(ptr => wasm.__wbg_webhandle_free(ptr, 1));
+
+ function addToExternrefTable0(obj) {
+ const idx = wasm.__externref_table_alloc();
+ wasm.__wbindgen_externrefs.set(idx, obj);
+ return idx;
+ }
+
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
+ ? { register: () => {}, unregister: () => {} }
+ : new FinalizationRegistry(state => {
+ if (wasm) wasm.__wbindgen_destroy_closure(state.a, state.b);
+ });
+
+ function debugString(val) {
+ // primitive types
+ const type = typeof val;
+ if (type == 'number' || type == 'boolean' || val == null) {
+ return `${val}`;
+ }
+ if (type == 'string') {
+ return `"${val}"`;
+ }
+ if (type == 'symbol') {
+ const description = val.description;
+ if (description == null) {
+ return 'Symbol';
+ } else {
+ return `Symbol(${description})`;
+ }
+ }
+ if (type == 'function') {
+ const name = val.name;
+ if (typeof name == 'string' && name.length > 0) {
+ return `Function(${name})`;
+ } else {
+ return 'Function';
+ }
+ }
+ // objects
+ if (Array.isArray(val)) {
+ const length = val.length;
+ let debug = '[';
+ if (length > 0) {
+ debug += debugString(val[0]);
+ }
+ for(let i = 1; i < length; i++) {
+ debug += ', ' + debugString(val[i]);
+ }
+ debug += ']';
+ return debug;
+ }
+ // Test for built-in
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
+ let className;
+ if (builtInMatches && builtInMatches.length > 1) {
+ className = builtInMatches[1];
+ } else {
+ // Failed to match the standard '[object ClassName]'
+ return toString.call(val);
+ }
+ if (className == 'Object') {
+ // we're a user defined class or Object
+ // JSON.stringify avoids problems with cycles, and is generally much
+ // easier than looping through ownProperties of `val`.
+ try {
+ return 'Object(' + JSON.stringify(val) + ')';
+ } catch (_) {
+ return 'Object';
+ }
+ }
+ // errors
+ if (val instanceof Error) {
+ return `${val.name}: ${val.message}\n${val.stack}`;
+ }
+ // TODO we could test for more things here, like `Set`s and `Map`s.
+ return className;
+ }
+
+ function getArrayF32FromWasm0(ptr, len) {
+ ptr = ptr >>> 0;
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
+ }
+
+ function getArrayI16FromWasm0(ptr, len) {
+ ptr = ptr >>> 0;
+ return getInt16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
+ }
+
+ function getArrayI32FromWasm0(ptr, len) {
+ ptr = ptr >>> 0;
+ return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
+ }
+
+ function getArrayI8FromWasm0(ptr, len) {
+ ptr = ptr >>> 0;
+ return getInt8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
+ }
+
+ function getArrayJsValueViewFromWasm0(ptr, len) {
+ ptr = ptr >>> 0;
+ const mem = getDataViewMemory0();
+ const result = [];
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
+ }
+ return result;
+ }
+
+ function getArrayU16FromWasm0(ptr, len) {
+ ptr = ptr >>> 0;
+ return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
+ }
+
+ function getArrayU32FromWasm0(ptr, len) {
+ ptr = ptr >>> 0;
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
+ }
+
+ function getArrayU8FromWasm0(ptr, len) {
+ ptr = ptr >>> 0;
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
+ }
+
+ let cachedDataViewMemory0 = null;
+ function getDataViewMemory0() {
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
+ }
+ return cachedDataViewMemory0;
+ }
+
+ let cachedFloat32ArrayMemory0 = null;
+ function getFloat32ArrayMemory0() {
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
+ }
+ return cachedFloat32ArrayMemory0;
+ }
+
+ let cachedInt16ArrayMemory0 = null;
+ function getInt16ArrayMemory0() {
+ if (cachedInt16ArrayMemory0 === null || cachedInt16ArrayMemory0.byteLength === 0) {
+ cachedInt16ArrayMemory0 = new Int16Array(wasm.memory.buffer);
+ }
+ return cachedInt16ArrayMemory0;
+ }
+
+ let cachedInt32ArrayMemory0 = null;
+ function getInt32ArrayMemory0() {
+ if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) {
+ cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer);
+ }
+ return cachedInt32ArrayMemory0;
+ }
+
+ let cachedInt8ArrayMemory0 = null;
+ function getInt8ArrayMemory0() {
+ if (cachedInt8ArrayMemory0 === null || cachedInt8ArrayMemory0.byteLength === 0) {
+ cachedInt8ArrayMemory0 = new Int8Array(wasm.memory.buffer);
+ }
+ return cachedInt8ArrayMemory0;
+ }
+
+ function getStringFromWasm0(ptr, len) {
+ return decodeText(ptr >>> 0, len);
+ }
+
+ let cachedUint16ArrayMemory0 = null;
+ function getUint16ArrayMemory0() {
+ if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
+ cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
+ }
+ return cachedUint16ArrayMemory0;
+ }
+
+ let cachedUint32ArrayMemory0 = null;
+ function getUint32ArrayMemory0() {
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
+ }
+ return cachedUint32ArrayMemory0;
+ }
+
+ let cachedUint8ArrayMemory0 = null;
+ function getUint8ArrayMemory0() {
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
+ }
+ return cachedUint8ArrayMemory0;
+ }
+
+ function handleError(f, args) {
+ try {
+ return f.apply(this, args);
+ } catch (e) {
+ const idx = addToExternrefTable0(e);
+ wasm.__wbindgen_exn_store(idx);
+ }
+ }
+
+ function isLikeNone(x) {
+ return x === undefined || x === null;
+ }
+
+ function makeMutClosure(arg0, arg1, f) {
+ const state = { a: arg0, b: arg1, cnt: 1 };
+ const real = (...args) => {
+ state.cnt++;
+ const a = state.a;
+ state.a = 0;
+ try {
+ if (!wasm) return;
+ return f(a, state.b, ...args);
+ } finally {
+ state.a = a;
+ real._wbg_cb_unref();
+ }
+ };
+ real._wbg_cb_unref = () => {
+ if (--state.cnt === 0) {
+ if (wasm) wasm.__wbindgen_destroy_closure(state.a, state.b);
+ state.a = 0;
+ CLOSURE_DTORS.unregister(state);
+ }
+ };
+ CLOSURE_DTORS.register(real, state, state);
+ return real;
+ }
+
+ function passArray8ToWasm0(arg, malloc) {
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
+ getUint8ArrayMemory0().set(arg, ptr / 1);
+ WASM_VECTOR_LEN = arg.length;
+ return ptr;
+ }
+
+ function passArrayJsValueToWasm0(array, malloc) {
+ const ptr = malloc(array.length * 4, 4) >>> 0;
+ for (let i = 0; i < array.length; i++) {
+ const add = addToExternrefTable0(array[i]);
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
+ }
+ WASM_VECTOR_LEN = array.length;
+ return ptr;
+ }
+
+ function passStringToWasm0(arg, malloc, realloc) {
+ if (realloc === undefined) {
+ const buf = cachedTextEncoder.encode(arg);
+ const ptr = malloc(buf.length, 1) >>> 0;
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
+ WASM_VECTOR_LEN = buf.length;
+ return ptr;
+ }
+
+ let len = arg.length;
+ let ptr = malloc(len, 1) >>> 0;
+
+ const mem = getUint8ArrayMemory0();
+
+ let offset = 0;
+
+ for (; offset < len; offset++) {
+ const code = arg.charCodeAt(offset);
+ if (code > 0x7F) break;
+ mem[ptr + offset] = code;
+ }
+ if (offset !== len) {
+ if (offset !== 0) {
+ arg = arg.slice(offset);
+ }
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
+ const ret = cachedTextEncoder.encodeInto(arg, view);
+
+ offset += ret.written;
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
+ }
+
+ WASM_VECTOR_LEN = offset;
+ return ptr;
+ }
+
+ function takeFromExternrefTable0(idx) {
+ const value = wasm.__wbindgen_externrefs.get(idx);
+ wasm.__externref_table_dealloc(idx);
+ return value;
+ }
+
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
+ cachedTextDecoder.decode();
+ function decodeText(ptr, len) {
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
+ }
+
+ const cachedTextEncoder = new TextEncoder();
+
+ if (!('encodeInto' in cachedTextEncoder)) {
+ cachedTextEncoder.encodeInto = function (arg, view) {
+ const buf = cachedTextEncoder.encode(arg);
+ view.set(buf);
+ return {
+ read: arg.length,
+ written: buf.length
+ };
+ };
+ }
+
+ let WASM_VECTOR_LEN = 0;
+
+ let wasmModule, wasmInstance, wasm;
+ function __wbg_finalize_init(instance, module) {
+ wasmInstance = instance;
+ wasm = instance.exports;
+ wasmModule = module;
+ cachedDataViewMemory0 = null;
+ cachedFloat32ArrayMemory0 = null;
+ cachedInt16ArrayMemory0 = null;
+ cachedInt32ArrayMemory0 = null;
+ cachedInt8ArrayMemory0 = null;
+ cachedUint16ArrayMemory0 = null;
+ cachedUint32ArrayMemory0 = null;
+ cachedUint8ArrayMemory0 = null;
+ wasm.__wbindgen_start();
+ return wasm;
+ }
+
+ async function __wbg_load(module, imports) {
+ if (typeof Response === 'function' && module instanceof Response) {
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
+ try {
+ return await WebAssembly.instantiateStreaming(module, imports);
+ } catch (e) {
+ const validResponse = module.ok && expectedResponseType(module.type);
+
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
+
+ } else { throw e; }
+ }
+ }
+
+ const bytes = await module.arrayBuffer();
+ return await WebAssembly.instantiate(bytes, imports);
+ } else {
+ const instance = await WebAssembly.instantiate(module, imports);
+
+ if (instance instanceof WebAssembly.Instance) {
+ return { instance, module };
+ } else {
+ return instance;
+ }
+ }
+
+ function expectedResponseType(type) {
+ switch (type) {
+ case 'basic': case 'cors': case 'default': return true;
+ }
+ return false;
+ }
+ }
+
+ function initSync(module) {
+ if (wasm !== undefined) return wasm;
+
+
+ if (module !== undefined) {
+ if (Object.getPrototypeOf(module) === Object.prototype) {
+ ({module} = module)
+ } else {
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
+ }
+ }
+
+ const imports = __wbg_get_imports();
+ if (!(module instanceof WebAssembly.Module)) {
+ module = new WebAssembly.Module(module);
+ }
+ const instance = new WebAssembly.Instance(module, imports);
+ return __wbg_finalize_init(instance, module);
+ }
+
+ async function __wbg_init(module_or_path) {
+ if (wasm !== undefined) return wasm;
+
+
+ if (module_or_path !== undefined) {
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
+ ({module_or_path} = module_or_path)
+ } else {
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
+ }
+ }
+
+
+ const imports = __wbg_get_imports();
+
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
+ module_or_path = fetch(module_or_path);
+ }
+
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
+
+ return __wbg_finalize_init(instance, module);
+ }
+
+
+
+
+function deinit() {
+ __wbg_init.__wbindgen_wasm_module = null;
+ wasmModule = null;
+ wasm = null;
+ cachedDataViewMemory0 = null;
+ cachedFloat32ArrayMemory0 = null;
+ cachedInt16ArrayMemory0 = null;
+ cachedInt32ArrayMemory0 = null;
+ cachedInt8ArrayMemory0 = null;
+ cachedUint16ArrayMemory0 = null;
+ cachedUint32ArrayMemory0 = null;
+ cachedUint8ArrayMemory0 = null;
+}
+
+return Object.assign(__wbg_init, { initSync, deinit }, exports);
+}
diff --git a/fdanyone/space/assets/scene.js b/fdanyone/space/assets/scene.js
new file mode 100644
index 0000000..d765c45
--- /dev/null
+++ b/fdanyone/space/assets/scene.js
@@ -0,0 +1,98 @@
+import {WebViewer} from './rerun/index.js';
+import {fetchBytes} from './media_cache.js';
+import {createFrameScheduler} from './frame_scheduler.js';
+
+// One recording owns the Rerun viewer, channel and rendering schedule.
+export async function openScene(host, wasm, data, signal) {
+ const viewer = new WebViewer();
+ const frames = createFrameScheduler(data.fps);
+ const listeners = new AbortController();
+ const events = {signal: listeners.signal, capture: true, passive: true};
+ let recording, playing = false, seekTime = null;
+ function applyPlayback() {
+ const visible = !document.hidden;
+ frames.setVisible(visible);
+ if (recording) frames.setPlaying(playing && visible);
+ }
+ let dragging = false;
+ host.addEventListener('pointerdown', () => { dragging = true; frames.interact(); }, events);
+ document.addEventListener('pointermove', () => { if (dragging) frames.interact(); }, events);
+ for (const name of ['pointerup', 'pointercancel']) {
+ document.addEventListener(name, () => { if (dragging) frames.interact(); dragging = false; }, events);
+ }
+ for (const name of ['pointermove', 'pointerleave', 'wheel', 'keydown', 'keyup', 'focus', 'blur']) {
+ host.addEventListener(name, () => frames.interact(), events);
+ }
+ document.addEventListener('visibilitychange', applyPlayback, events);
+ applyPlayback();
+ function dispose() {
+ listeners.abort();
+ // Destroy wasm while its queued callbacks still exist, then drop the scheduler.
+ try { viewer.stop(); } finally { frames.dispose(); }
+ }
+ try {
+ const [download, initialization] = await Promise.allSettled([
+ fetchBytes(data.recording, signal),
+ viewer.start(null, host, {
+ base_url: new URL(wasm, document.baseURI).href, hide_welcome_screen: true,
+ allow_fullscreen: false, theme: 'dark', width: '100%', height: '100%',
+ frame_scheduler: frames
+ })
+ ]);
+ signal.throwIfAborted();
+ if (download.status === 'rejected') throw download.reason;
+ if (initialization.status === 'rejected') throw initialization.reason;
+ for (const panel of ['top', 'blueprint', 'selection', 'time']) viewer.override_panel_state(panel, 'hidden');
+ const channel = viewer.open_channel('4danyone-space');
+ channel.send_rrd(new Uint8Array(download.value));
+ for (let index = 0; index < 300; index++) {
+ await new Promise(resolve => requestAnimationFrame(resolve));
+ signal.throwIfAborted();
+ const active = viewer.get_active_recording_id();
+ if (active && (viewer.get_time_range(active, 'time') || !data.frames)) {
+ recording = active;
+ break;
+ }
+ }
+ if (!recording) throw new Error('The Scene Recording Did Not Open');
+ applyPlayback();
+ frames.onFrame(() => {
+ // Rerun applies commands during rendering. Reconcile the latest
+ // intent afterward so queued pauses and seeks cannot overwrite it.
+ const seconds = viewer.get_current_time(recording, 'time') / 1e9;
+ if (seekTime !== null) {
+ if (Math.abs(seconds - seekTime) < 0.001) seekTime = null;
+ else viewer.set_current_time(recording, 'time', seekTime * 1e9);
+ }
+ const desired = playing && !document.hidden && seekTime === null;
+ if (viewer.get_playing(recording) !== desired) viewer.set_playing(recording, desired);
+ frames.alignTime(seconds);
+ });
+ return {
+ get time() { return seekTime ?? viewer.get_current_time(recording, 'time') / 1e9; },
+ set time(seconds) {
+ seekTime = Math.max(0, Math.min(seconds, (data.frames - 1) / data.fps));
+ frames.invalidate();
+ },
+ get playing() { return playing; },
+ set playing(value) {
+ // Playback intent survives hidden tabs and queued Rerun commands.
+ playing = value;
+ applyPlayback();
+ },
+ focus() { viewer.canvas.focus({preventScroll: true}); },
+ onFrame: frames.onFrame,
+ async append(update, signal) {
+ if (data.recording_id !== update.recording_id) throw new Error('Reload The Page To Restore The Camera Preview');
+ const bytes = await fetchBytes(update.recording, signal);
+ signal.throwIfAborted();
+ channel.send_rrd(new Uint8Array(bytes));
+ frames.invalidate();
+ },
+ dispose
+ };
+ } catch (error) {
+ dispose();
+ throw error;
+ }
+}
diff --git a/fdanyone/space/assets/slider.html b/fdanyone/space/assets/slider.html
new file mode 100644
index 0000000..4e2ded7
--- /dev/null
+++ b/fdanyone/space/assets/slider.html
@@ -0,0 +1,7 @@
+<div class="inline-slider">
+ <span class="slider-label"></span>
+ <span class="slider-track">
+ <span class="slider-rail"><input type="range"></span>
+ <output class="slider-value" aria-hidden="true"></output>
+ </span>
+</div>
diff --git a/fdanyone/space/assets/slider.js b/fdanyone/space/assets/slider.js
new file mode 100644
index 0000000..932d8f9
--- /dev/null
+++ b/fdanyone/space/assets/slider.js
@@ -0,0 +1,57 @@
+const root = element.querySelector('.inline-slider');
+const range = root.querySelector('input');
+const output = root.querySelector('output');
+root.querySelector('.slider-label').innerHTML = props.label_html;
+range.id = props.input_id;
+function choices() { return Array.isArray(props.counts) && props.counts.length ? props.counts : null; }
+function publishViewCount() {
+ element.closest('#settings-grid')?.querySelector('.pitches-control')?.dispatchEvent(
+ new CustomEvent('view-count', {detail: props.value, bubbles: true})
+ );
+}
+function update() {
+ const counts = choices();
+ const minimum = counts ? 0 : Number(props.minimum);
+ const maximum = counts ? counts.length - 1 : Number(props.maximum);
+ const value = Number(props.value ?? minimum);
+ const position = counts ? Math.max(0, counts.indexOf(value)) : value;
+ range.min = minimum; range.max = maximum; range.step = counts ? 1 : props.step;
+ range.value = position;
+ range.disabled = props.interactive === false || maximum <= minimum;
+ const text = value.toLocaleString('en-US', {
+ minimumFractionDigits: props.minimum_decimals ?? 0,
+ maximumFractionDigits: props.precision ?? 0,
+ useGrouping: false,
+ }) + (props.suffix || '');
+ range.setAttribute('aria-label', props.label);
+ range.setAttribute('aria-valuetext', text);
+ output.textContent = text;
+ const fraction = maximum > minimum ? Math.max(0, Math.min(1, (position - minimum) / (maximum - minimum))) : 0;
+ root.style.setProperty('--range-progress', `${fraction * 100}%`);
+ root.style.setProperty('--tick-count', counts?.length || 0);
+ root.classList.toggle('discrete', !!counts);
+ root.classList.toggle('disabled', range.disabled);
+}
+element.addEventListener('view-counts', event => {
+ const counts = event.detail;
+ const current = Number(props.value);
+ props.counts = counts;
+ props.value = counts.reduce((best, value) => Math.abs(value - current) < Math.abs(best - current) ? value : best);
+ update();
+ publishViewCount();
+});
+range.addEventListener('input', () => {
+ if (range.disabled) return;
+ const counts = choices();
+ props.value = counts ? counts[Number(range.value)] : Number(range.value);
+ update();
+ if (counts) {
+ publishViewCount();
+ }
+ if (!props.commit_on_change) trigger('input');
+});
+range.addEventListener('change', () => {
+ if (!range.disabled && props.commit_on_change) trigger('input');
+});
+watch(['value', 'minimum', 'maximum', 'step', 'precision', 'minimum_decimals', 'suffix', 'counts', 'interactive'], update);
+update();
diff --git a/fdanyone/space/assets/video_cache.js b/fdanyone/space/assets/video_cache.js
new file mode 100644
index 0000000..308dcdb
--- /dev/null
+++ b/fdanyone/space/assets/video_cache.js
@@ -0,0 +1,99 @@
+import {fetchCached} from './media_cache.js';
+
+// Keep compressed media across scrolls; only visible cards own native decoders.
+export function createVideoCache({maxBytes = 64 * 1024 * 1024, concurrency = 3} = {}) {
+ const entries = new Map();
+ let warm = new Set(), active = 0, sequence = 0, disposed = false;
+ function remove(entry) {
+ entries.delete(entry.address);
+ entry.abort.abort();
+ if (entry.url) URL.revokeObjectURL(entry.url);
+ if (entry.state === 'queued') entry.reject(new DOMException('Media released', 'AbortError'));
+ }
+ function trim() {
+ let bytes = [...entries.values()].reduce((sum, entry) => sum + entry.bytes, 0);
+ const unused = [...entries.values()].filter(entry => !entry.users && entry.state === 'ready')
+ .sort((a, b) => Number(warm.has(a.address)) - Number(warm.has(b.address)) || a.used - b.used);
+ for (const entry of unused) {
+ if (bytes <= maxBytes) break;
+ bytes -= entry.bytes;
+ remove(entry);
+ }
+ }
+ async function load(entry) {
+ active++;
+ entry.state = 'loading';
+ try {
+ const response = await fetchCached(entry.address, {signal: entry.abort.signal});
+ if (!response.ok) throw new Error(`Cannot Load Video (${response.status})`);
+ const blob = await response.blob();
+ entry.abort.signal.throwIfAborted();
+ entry.url = URL.createObjectURL(blob);
+ entry.bytes = blob.size;
+ entry.state = 'ready';
+ entry.resolve(entry.url);
+ trim();
+ } catch (error) {
+ if (entries.get(entry.address) === entry) entries.delete(entry.address);
+ entry.reject(error);
+ } finally {
+ active--;
+ pump();
+ }
+ }
+ function pump() {
+ if (disposed) return;
+ const queue = [...entries.values()].filter(entry => entry.state === 'queued')
+ .sort((a, b) => b.priority - a.priority || a.used - b.used);
+ while (active < concurrency && queue.length) void load(queue.shift());
+ }
+ function ensure(address, priority) {
+ if (disposed) throw new Error('Video Cache Is Closed');
+ let entry = entries.get(address);
+ if (!entry) {
+ let resolve, reject;
+ const ready = new Promise((yes, no) => { resolve = yes; reject = no; });
+ ready.catch(() => {}); // Consumers still receive the original rejection.
+ entry = {address, ready, resolve, reject, abort: new AbortController(),
+ users: 0, bytes: 0, url: null, state: 'queued', priority, used: ++sequence};
+ entries.set(address, entry);
+ }
+ entry.priority = Math.max(entry.priority, priority);
+ entry.used = ++sequence;
+ return entry;
+ }
+ return {
+ acquire(address) {
+ const entry = ensure(address, 1);
+ entry.users++;
+ pump();
+ let released = false;
+ return {
+ ready: entry.ready,
+ release() {
+ if (released) return;
+ released = true;
+ entry.users--;
+ if (!entry.users && !warm.has(address) && entry.state !== 'ready') remove(entry);
+ trim();
+ }
+ };
+ },
+ prefetch(addresses) {
+ const previous = warm;
+ warm = new Set(addresses);
+ for (const entry of entries.values()) {
+ if (!entry.users && !warm.has(entry.address) && entry.state !== 'ready') remove(entry);
+ }
+ // Do not repeatedly reload nearby clips evicted by the byte budget.
+ for (const address of addresses) if (!previous.has(address) || entries.has(address)) ensure(address, 0);
+ trim();
+ pump();
+ },
+ dispose() {
+ disposed = true;
+ for (const entry of entries.values()) remove(entry);
+ warm.clear();
+ }
+ };
+}
diff --git a/fdanyone/space/assets/video_playback.js b/fdanyone/space/assets/video_playback.js
new file mode 100644
index 0000000..6f69065
--- /dev/null
+++ b/fdanyone/space/assets/video_playback.js
@@ -0,0 +1,37 @@
+// Native videos run continuously; the scene clock only corrects their phase.
+export function createVideoPlayback(video, fps, period) {
+ let aligned = false, pausedTarget = null;
+ function pause() { if (!video.paused) video.pause(); }
+ function setPlaying(playing) {
+ // A suspended decoder may need play() before it can finish a seek.
+ if (playing && video.paused) video.play().catch(() => {});
+ else if (!playing) pause();
+ }
+ function setRate(rate) {
+ if (rate === 1 ? video.playbackRate !== 1 : Math.abs(video.playbackRate - rate) > 0.01) video.playbackRate = rate;
+ }
+ return {
+ pause,
+ reset() { aligned = false; pausedTarget = null; },
+ sync(seconds, playing) {
+ setPlaying(playing);
+ if (video.readyState < 2 || video.seeking) return false;
+ if (seconds === null) { setRate(1); return true; }
+ const wanted = Math.max(0, Math.min(seconds, Math.max(0, video.duration - 0.001)));
+ const difference = wanted - video.currentTime;
+ const samePausedTarget = pausedTarget !== null && Math.abs(wanted - pausedTarget) < 0.25 / fps;
+ const seek = (!aligned || (!playing && !samePausedTarget)) && Math.abs(difference) > 0.5 / fps;
+ aligned = true;
+ pausedTarget = playing ? null : wanted;
+ if (seek) {
+ setRate(1);
+ video.currentTime = wanted;
+ return !video.seeking;
+ }
+ // Wrap phase at the clip boundary so each native loop needs no seek.
+ const phase = period > 0 ? difference - Math.round(difference / period) * period : difference;
+ setRate(playing ? 1 + Math.max(-0.25, Math.min(0.25, phase * 0.8)) : 1);
+ return true;
+ }
+ };
+}
diff --git a/fdanyone/space/assets/workbench.css b/fdanyone/space/assets/workbench.css
new file mode 100644
index 0000000..e1ef207
--- /dev/null
+++ b/fdanyone/space/assets/workbench.css
@@ -0,0 +1,222 @@
+body, .gradio-container { background: #000 !important; color-scheme: dark; }
+body { margin: 0; overflow: hidden; }
+.gradio-container { width: 100% !important; max-width: none !important; margin: 0 !important;
+ padding: 0 !important; box-sizing: border-box;
+ --space-title-size: 28px; --space-section-size: 18px; --space-body-size: 16px;
+ --space-control-height: 34px; --space-label-width: 120px; --space-option-gap: 12px;
+ --space-row-height: 36px; --space-row-gap: 6px;
+ font-size: var(--space-body-size); line-height: 1.5;
+ --text-xxs: var(--space-body-size); --text-xs: var(--space-body-size);
+ --text-sm: var(--space-body-size); --text-md: var(--space-body-size); --text-lg: var(--space-section-size);
+ --body-text-size: var(--space-body-size); --block-label-text-size: var(--space-body-size);
+ --block-title-text-size: var(--space-body-size); --input-text-size: var(--space-body-size);
+ --button-small-text-size: var(--space-body-size); --button-medium-text-size: var(--space-body-size);
+ --button-large-text-size: var(--space-body-size); }
+.gradio-container > .main { width: 100%; max-width: none !important; margin: 0 !important; padding: 0 !important; }
+#space-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 380px;
+ gap: 0; height: 100dvh; overflow: hidden; align-items: stretch; }
+#space-sidebar { display: grid; grid-template-rows: 56px auto minmax(0, 1fr) auto;
+ gap: 0; min-height: 0; height: 100%; min-width: 0 !important; background: #121214;
+ border-left: 1px solid #343437; }
+#space-heading { display: flex; align-items: center; padding: 0 14px; }
+#space-heading, #task-panel { position: relative; }
+#space-heading::after, #task-panel::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 0;
+ border-bottom: 1px solid #343437; pointer-events: none; }
+#space-sidebar .block { border-radius: 0; }
+#space-heading h1 { margin: 0 !important; font-size: var(--space-title-size) !important; font-weight: 700; letter-spacing: -.4px;
+ background: linear-gradient(90deg, #6e85df 0%, #40a5eb 25%, #52bbb1 50%, #40a5eb 75%, #6e85df 100%);
+ background-size: 200% 100%; animation: space-gradient-drift 8s ease-in-out infinite alternate;
+ background-clip: text; -webkit-text-fill-color: transparent; width: fit-content; }
+@keyframes space-gradient-drift {
+ from { background-position: 0% 50%; }
+ to { background-position: 100% 50%; }
+}
+@media (prefers-reduced-motion: reduce) { #space-heading h1 { animation: none; } }
+#task-panel { min-width: 0 !important; gap: var(--space-row-gap); padding: 12px 14px;
+ overflow: auto; scrollbar-gutter: stable; }
+#task-panel .block { border: none !important; background: transparent !important; padding: 0 !important; }
+#task-panel .html-container { padding: 0 !important; }
+#task-info { min-width: 0; }
+#data-heading h3 { margin: 0 !important; font-size: var(--space-section-size) !important;
+ line-height: 1.5; font-weight: 700 !important; color: #f5f5f7; }
+.task-paths { display: grid; gap: var(--space-row-gap); margin: 0; }
+.task-path dt { color: #8e8e93; font-size: var(--space-body-size); }
+.task-path dd { margin: 0; min-width: 0; }
+.task-path code { display: block; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 0;
+ background: transparent; color: #b5b5ba; font: inherit; user-select: all;
+ font-size: var(--space-body-size); scrollbar-width: thin; scrollbar-color: #55555a transparent; }
+.task-path code:focus-visible { outline: 2px solid #3274d8; outline-offset: 2px; }
+#space-controls { display: flex; flex-direction: column; gap: 0; min-height: 0; min-width: 0 !important; overflow: hidden; }
+#parameters-scroll { flex: 1 1 0; min-width: 0 !important; min-height: 0; gap: 10px; overflow: auto;
+ padding: 14px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #55555a transparent;
+ scrollbar-gutter: stable; }
+#parameters-scroll > * { flex: 0 0 auto; }
+#parameter-note { min-height: 0; margin: 0; color: #b5b5ba; font-size: var(--space-body-size); }
+#settings-grid { gap: 12px; min-width: 0 !important; flex: 0 0 auto !important; }
+.settings-section { min-width: 0 !important; gap: var(--space-row-gap); flex: 0 0 auto !important; }
+.settings-section + .settings-section { padding-top: 12px; border-top: 1px solid #343437; }
+.settings-section h3, .saved-section h3 { margin: 0 !important; font-size: var(--space-section-size) !important;
+ font-weight: 700 !important; line-height: 1.5; color: #f5f5f7; }
+.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
+.camera-view-count { flex: 0 0 auto; font-size: var(--space-body-size); color: #f5f5f7;
+ font-variant-numeric: tabular-nums; }
+.settings-section .block { border: none !important; background: transparent !important; padding: 0 !important; }
+.settings-section .html-container { padding: 0 !important; }
+.settings-section .form { border: none; border-radius: 0 !important; overflow: visible;
+ background: transparent; box-shadow: none; gap: var(--space-row-gap); }
+.settings-section .row { gap: 12px; flex-wrap: nowrap; align-items: flex-start; }
+.settings-section .block-label, .settings-section .block > span,
+.settings-section .block > label > span { font-size: var(--space-body-size) !important; }
+.settings-section [data-testid="block-info"], .model-toggle .label-text { color: #8e8e93 !important; }
+.settings-section input, .settings-section textarea { font-size: var(--space-body-size); }
+/* All options share a label column; native range inputs retain a generous hit area. */
+.inline-slider, .layer-count, .pitch-group, .option-row,
+.saved-option, .task-path {
+ display: grid; grid-template-columns: var(--space-label-width) minmax(0, 1fr);
+ align-items: center; gap: var(--space-option-gap); min-width: 0;
+ min-height: var(--space-row-height); box-sizing: border-box; }
+.inline-slider { width: 100%; }
+.settings-section .option-row { gap: var(--space-option-gap); align-items: center; }
+.option-row > * { min-width: 0 !important; }
+.slider-label { color: #8e8e93; font-size: var(--space-body-size); white-space: nowrap; line-height: 24px; }
+.slider-track { display: grid; grid-template-columns: minmax(0, 1fr) max-content;
+ align-items: center; gap: 10px; min-width: 0; height: var(--space-control-height); }
+.slider-rail { display: flex; align-items: center; position: relative; min-width: 0; height: 100%; }
+/* Center ticks on the thumb endpoints, leaving room for the final 1px tick. */
+.discrete .slider-rail::before { content: ''; position: absolute; left: 8.5px; right: 8.5px;
+ top: 50%; height: 8px; transform: translateY(-50%); pointer-events: none;
+ background: linear-gradient(to right, #3274d8 var(--range-progress), #77777d var(--range-progress));
+ mask-image: repeating-linear-gradient(to right, #000 0 1px, transparent 1px calc((100% - 1px) / (var(--tick-count) - 1))); }
+.inline-slider input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%;
+ position: relative;
+ height: 28px; margin: 0; padding: 0; border: none !important; cursor: grab;
+ background: transparent !important;
+ touch-action: pan-y; }
+.inline-slider input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 99px;
+ background: linear-gradient(to right, #3274d8 var(--range-progress), #424245 var(--range-progress)); }
+.inline-slider input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none;
+ width: 18px; height: 18px; margin-top: -7px; border: none; border-radius: 50%;
+ background: #3274d8; box-shadow: none; }
+.inline-slider input[type="range"]::-moz-range-track { height: 4px; border-radius: 99px;
+ background: linear-gradient(to right, #3274d8 var(--range-progress), #424245 var(--range-progress)); }
+.inline-slider input[type="range"]::-moz-range-thumb { width: 18px; height: 18px;
+ border: none; border-radius: 50%; background: #3274d8; box-shadow: none; }
+.slider-value { min-width: 56px; line-height: 24px; text-align: right; color: #f5f5f7; font-size: var(--space-body-size);
+ font-variant-numeric: tabular-nums; pointer-events: none; user-select: none; }
+.inline-slider input:focus-visible::-webkit-slider-thumb { outline: 2px solid #8eb4f1; outline-offset: 3px; }
+.inline-slider input:focus-visible::-moz-range-thumb { outline: 2px solid #8eb4f1; outline-offset: 3px; }
+.inline-slider input:focus-visible { outline: none; }
+.inline-slider input:active { cursor: grabbing; }
+.inline-slider.disabled .slider-track { opacity: .45; }
+.inline-slider input:disabled { cursor: default; }
+.pitches-control { display: flex; flex-direction: column; gap: var(--space-row-gap); }
+.layer-count, .pitch-group {
+ color: #8e8e93; font-size: var(--space-body-size); }
+.pitch-heading { line-height: var(--space-control-height); }
+.pitch-fields { display: grid; grid-template-columns: repeat(var(--pitch-columns, 1), minmax(0, 1fr));
+ min-width: 0; height: var(--space-control-height); box-sizing: border-box; overflow: hidden;
+ background: #1d1d1f; border: 1px solid #424245; border-radius: 8px; outline: none; }
+.pitch-fields label { display: flex; align-items: center; justify-content: center; position: relative; min-width: 0; }
+.pitch-fields label + label::before { content: ''; position: absolute; left: 0; height: 14px; width: 1px; background: #424245; }
+.pitch-fields label::after { content: '°'; color: #a1a1a6; }
+.pitch-fields label:focus-within { background: #262b35; border-radius: 7px; box-shadow: inset 0 0 0 1px #3274d8; }
+.pitch-fields input { box-sizing: border-box; min-width: 1ch; max-width: calc(100% - 10px);
+ padding: 0; background: transparent; border: none; border-radius: 0; outline: none;
+ color: #f5f5f7; text-align: center; font-size: var(--space-body-size); font-variant-numeric: tabular-nums; }
+.pitch-fields input[type="number"] { appearance: textfield; }
+.pitch-fields input::-webkit-inner-spin-button, .pitch-fields input::-webkit-outer-spin-button { appearance: none; margin: 0; }
+.pitches-control input:disabled { opacity: .45; cursor: default; }
+#attention-backend .container > [data-testid="block-info"] { margin: 0; }
+#attention-backend .container > .wrap { border: 1px solid #424245; border-radius: 8px;
+ height: var(--space-control-height); min-height: var(--space-control-height); box-sizing: border-box; }
+#attention-backend .wrap-inner { display: flex; align-items: center; padding: 0 12px;
+ height: calc(var(--space-control-height) - 2px); box-sizing: border-box; }
+#attention-backend .secondary-wrap { width: 100%; }
+.model-toggle label { display: flex; width: 100%; margin: 0; color: #8e8e93; }
+.model-toggle { overflow: visible !important; }
+.model-toggle label span { order: -1; font-size: var(--space-body-size); }
+.model-toggle .label-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
+ overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
+.model-toggle input { appearance: none; -webkit-appearance: none; justify-self: start;
+ width: 36px !important; height: 22px !important; min-height: 0; margin: 0; border: none !important;
+ border-radius: 99px !important; background: #55555a !important; box-shadow: none; position: relative; cursor: pointer; }
+.model-toggle input::after { content: ''; position: absolute; top: 3px; left: 3px;
+ width: 16px; height: 16px; border-radius: 50%; background: #f5f5f7; transition: transform .15s ease; }
+.model-toggle input:checked { background: #3274d8 !important; }
+.model-toggle input:checked::after { transform: translateX(14px); }
+.model-toggle input:focus-visible { outline: 2px solid #8eb4f1; outline-offset: 3px; }
+.gpu-description { display: block; margin: 0; color: #f5f5f7;
+ font-size: var(--space-body-size); font-weight: 400; text-align: right; white-space: pre-line; overflow-wrap: anywhere; }
+#gpu-selection { overflow: visible !important; padding-bottom: 2px !important; }
+#gpu-selection label { display: flex; align-items: center; min-height: var(--space-control-height); box-sizing: border-box;
+ font-size: var(--space-body-size); padding: 7px 10px !important; border-radius: 8px !important; }
+#saved-parameters { padding: 0 !important; min-width: 0; }
+#saved-parameters .html-container { padding: 0 !important; }
+.saved-section + .saved-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid #343437; }
+.saved-section dl { display: grid; gap: var(--space-row-gap); margin: var(--space-row-gap) 0 0; }
+.saved-section dt { color: #8e8e93; font-size: var(--space-body-size); margin: 0; }
+.saved-section dd { color: #f5f5f7; font-size: var(--space-body-size); margin: 0; overflow-wrap: anywhere; }
+.saved-gpus { margin-top: var(--space-row-gap); color: #f5f5f7; font-size: var(--space-body-size); line-height: var(--space-row-height); }
+.clip-summary { margin: 0; }
+.clip-summary dt { margin: 0; color: #8e8e93; font-size: var(--space-body-size); }
+.clip-summary dd { margin: 0; color: #f5f5f7; font-size: var(--space-body-size); }
+#execution-area { position: relative; gap: 7px; padding: 12px 14px; min-width: 0 !important;
+ border-top: 1px solid #343437; background: #171719; }
+#run-actions { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
+#run-inference { flex: 1 1 calc(50% - 4px) !important; box-sizing: border-box;
+ min-width: 0 !important; width: auto; border-color: #55555a; }
+#run-inference, #stop-inference, .delete-output { height: 42px; min-height: 42px; padding: 0 12px;
+ font-size: var(--space-body-size); border-radius: 8px; }
+#delete-output { flex: 1 1 calc(50% - 4px) !important; box-sizing: border-box;
+ width: auto; min-width: 0 !important; margin: 0;
+ padding: 0 !important; border: 0 !important; background: transparent !important; }
+#delete-output .html-container { padding: 0 !important; }
+.delete-output { display: flex; align-items: center; justify-content: center; width: 100%; }
+.delete-output, .delete-actions button { padding: 5px 12px; color: #f5f5f7; background: #1d1d1f;
+ border: 1px solid #424245; border-radius: 8px; cursor: pointer; font: inherit; }
+.delete-actions button:hover { background: #2a2a2d; }
+.delete-dialog { box-sizing: border-box; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
+ padding: 22px; color: #f5f5f7; background: #1d1d1f; border: 1px solid #55555a; border-radius: 14px;
+ box-shadow: 0 12px 48px #0009; font-size: var(--space-body-size); }
+.delete-dialog::backdrop { background: #0009; }
+.delete-dialog h3 { margin: 0 0 12px; font-size: var(--space-section-size); }
+.delete-dialog p { margin: 0 0 12px; }
+.delete-path { display: block; margin-bottom: 20px; overflow-wrap: anywhere; color: #b5b5ba; font: inherit; }
+.delete-actions { display: flex; justify-content: flex-end; gap: 10px; }
+.delete-output, .delete-actions .confirm-delete { color: var(--space-red);
+ background: color-mix(in srgb, var(--space-red) 12%, #1d1d1f);
+ border-color: color-mix(in srgb, var(--space-red) 45%, #424245); }
+.delete-output:hover, .delete-actions .confirm-delete:hover {
+ background: color-mix(in srgb, var(--space-red) 24%, #1d1d1f);
+ border-color: color-mix(in srgb, var(--space-red) 70%, #424245); }
+.option-label { display: inline-flex; align-items: center; min-width: 0; color: #8e8e93; }
+.section-heading h3 .option-label { color: #f5f5f7; }
+.option-label > .option-help { color: #f5f5f7; }
+.help-button { padding: 0; color: inherit; border: 0; background: transparent; cursor: pointer;
+ font: inherit; white-space: nowrap; text-align: left; text-underline-offset: 4px; }
+.help-button:hover, .help-button[aria-expanded="true"] { color: #f5f5f7; text-decoration: underline dotted; }
+.help-button:focus-visible, .option-help button:focus-visible, .delete-dialog button:focus-visible {
+ outline: 2px solid #3274d8; outline-offset: 2px; }
+.option-help { position: fixed; inset: auto; margin: 0; box-sizing: border-box; max-height: calc(100dvh - 24px);
+ padding: 14px 16px; background: #252528; color: #f5f5f7; border: 1px solid #55555a; border-radius: 10px;
+ box-shadow: 0 6px 28px #0008; font: 400 var(--space-body-size)/1.5 Lato, sans-serif;
+ white-space: normal; text-align: left; }
+.help-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
+.help-heading > strong { color: #f5f5f7; }
+.help-heading > button { background: transparent; border: 0; padding: 0; width: 24px; height: 24px;
+ color: #b5b5ba; cursor: pointer; font: inherit; }
+.help-description { display: block; color: #d2d2d7; }
+#run-status, #scene-status { min-height: 0; margin: 0; font-size: var(--space-body-size); overflow-wrap: anywhere; }
+#run-status:not(:has(p)), #scene-status:not(:has(p)) { display: none; }
+button:disabled { opacity: .45 !important; }
+footer { display: none !important; }
+@media (min-width: 761px) and (max-width: 1200px) {
+ #space-workspace { grid-template-columns: minmax(0, 1fr) 340px; }
+}
+@media (max-width: 760px) {
+ body { overflow: auto; }
+ #space-workspace { grid-template-columns: minmax(0, 1fr); height: auto; overflow: visible; }
+ #space-viewer { height: 72dvh !important; min-height: 420px !important; }
+ #space-sidebar { height: 900px; border-left: none; border-top: 1px solid #343437;
+ grid-template-rows: 56px auto minmax(0, 1fr) auto; }
+}
diff --git a/fdanyone/space/body.py b/fdanyone/space/body.py
new file mode 100644
index 0000000..6207d5b
--- /dev/null
+++ b/fdanyone/space/body.py
@@ -0,0 +1,129 @@
+"""Prepare reusable SMPL-X geometry on the CPU in an isolated process."""
+
+from __future__ import annotations
+
+import hashlib
+import json
+import os
+import subprocess
+import sys
+import time
+import uuid
+from pathlib import Path
+
+import numpy as np
+
+from fdanyone.assets import MHR70_REGRESSOR, SMPLX_MODEL
+from fdanyone.errors import FourDAnyoneError
+
+
+def source_transforms(points_incam: np.ndarray, points_world: np.ndarray) -> np.ndarray:
+ """Fit the rigid source-camera pose between two versions of the same body."""
+
+ source = np.asarray(points_incam, dtype=np.float64)
+ target = np.asarray(points_world, dtype=np.float64)
+ source_mean = source.mean(axis=1)
+ target_mean = target.mean(axis=1)
+ covariance = np.swapaxes(source - source_mean[:, None], 1, 2) @ (target - target_mean[:, None])
+ left, _, right = np.linalg.svd(covariance)
+ correction = np.broadcast_to(np.eye(3), covariance.shape).copy()
+ correction[:, 2, 2] = np.linalg.det(left @ right)
+ row_rotation = left @ correction @ right
+ transforms = np.broadcast_to(np.eye(4), (len(source), 4, 4)).copy()
+ transforms[:, :3, :3] = np.swapaxes(row_rotation, 1, 2)
+ transforms[:, :3, 3] = target_mean - np.einsum("fi,fij->fj", source_mean, row_rotation)
+ return transforms
+
+
+def prepare_body(request: dict) -> None:
+ from fdanyone.motion.result import MotionResult
+ from fdanyone.skeleton.pipeline import _body_geometry
+
+ motion = MotionResult.load(request["motion_dir"])
+ geometry = _body_geometry(
+ motion,
+ Path(request["model_dir"]) / MHR70_REGRESSOR,
+ Path(request["gvhmr_root"]),
+ "cpu",
+ include_mesh=True,
+ )
+ destination = Path(request["destination"])
+ temporary = destination.with_name(f".{uuid.uuid4().hex}.npz")
+ try:
+ np.savez_compressed(
+ temporary,
+ vertices=geometry.mesh_world,
+ faces=geometry.mesh_faces,
+ keypoints=geometry.keypoints_world,
+ source_camera_to_world=source_transforms(geometry.keypoints_incam, geometry.keypoints_world),
+ intrinsics=motion.K_fullimg.numpy(),
+ source_indices=np.asarray(motion.source_frame_indices),
+ source_size=np.asarray([motion.image_width, motion.image_height]),
+ )
+ temporary.replace(destination)
+ finally:
+ temporary.unlink(missing_ok=True)
+
+
+def load_body(motion_dir: Path, model_dir: Path, gvhmr_root: Path, cache_dir: Path, check_cancelled) -> dict:
+ files = [
+ motion_dir / "motion.json",
+ motion_dir / "motion.safetensors",
+ model_dir / SMPLX_MODEL,
+ model_dir / MHR70_REGRESSOR,
+ ]
+ for path in files:
+ if not path.is_file():
+ raise FourDAnyoneError(f"Body preview needs {path.name}. Check the model and motion files.")
+ metadata = json.loads((motion_dir / "motion.json").read_text())
+ if metadata.get("tensor_file") != "motion.safetensors" or any(
+ not path.resolve().is_relative_to(motion_dir.resolve()) for path in files[:2]
+ ):
+ raise FourDAnyoneError("The result must contain its own motion.json and motion.safetensors files.")
+ identity = [(str(path.resolve()), path.stat().st_size, path.stat().st_mtime_ns) for path in files]
+ key = hashlib.sha256(json.dumps([1, identity]).encode()).hexdigest()[:24]
+ directory = cache_dir / "body" / key
+ directory.mkdir(parents=True, exist_ok=True)
+ destination = directory / "body.npz"
+ if not destination.is_file():
+ request = directory / "request.json"
+ request.write_text(
+ json.dumps(
+ {
+ "motion_dir": str(motion_dir),
+ "model_dir": str(model_dir),
+ "gvhmr_root": str(gvhmr_root),
+ "destination": str(destination),
+ }
+ )
+ )
+ environment = os.environ.copy()
+ environment["CUDA_VISIBLE_DEVICES"] = ""
+ environment["PYTHONPATH"] = str(Path(__file__).resolve().parents[2])
+ environment.setdefault("OMP_NUM_THREADS", "8")
+ with (directory / "body.log").open("w") as log:
+ process = subprocess.Popen(
+ [sys.executable, "-m", "fdanyone.space.body", str(request)],
+ env=environment,
+ stdout=log,
+ stderr=subprocess.STDOUT,
+ stdin=subprocess.DEVNULL,
+ start_new_session=True,
+ )
+ try:
+ while process.poll() is None:
+ check_cancelled()
+ time.sleep(0.1)
+ if process.returncode:
+ raise FourDAnyoneError(f"Body preview preparation failed. See {directory / 'body.log'}.")
+ finally:
+ if process.poll() is None:
+ from fdanyone.space.jobs import stop_process_group
+
+ stop_process_group(process)
+ with np.load(destination, allow_pickle=False) as data:
+ return {name: data[name] for name in data.files}
+
+
+if __name__ == "__main__":
+ prepare_body(json.loads(Path(sys.argv[1]).read_text()))
diff --git a/fdanyone/space/controls.py b/fdanyone/space/controls.py
new file mode 100644
index 0000000..27be3ac
--- /dev/null
+++ b/fdanyone/space/controls.py
@@ -0,0 +1,50 @@
+"""Shared widget templates, view counts and CUDA labels."""
+
+from __future__ import annotations
+
+import re
+from pathlib import Path
+
+from fdanyone.errors import ConfigurationError
+
+PITCH_PRESETS = ((15,), (15, 0), (30, 15, 0), (30, 15, 0, -15), (45, 30, 15, 0, -15))
+MAX_LAYERS = len(PITCH_PRESETS)
+VIEWS_PER_GROUP = 6
+_ASSETS = Path(__file__).with_name("assets")
+SLIDER_HTML = (_ASSETS / "slider.html").read_text()
+SLIDER_JS = (_ASSETS / "slider.js").read_text()
+PITCHES_HTML = (_ASSETS / "pitches.html").read_text()
+PITCHES_JS = (_ASSETS / "pitches.js").read_text()
+
+
+def view_counts(num_layers: int) -> tuple[int, ...]:
+ return (6, 8, 12, 16, 24, 36, 48) if num_layers == 3 else (6, 12, 18, 24, 36, 48)
+
+
+def validate_view_count(views, num_layers):
+ if not 1 <= num_layers <= MAX_LAYERS:
+ raise ConfigurationError(f"No. Layers must be between 1 and {MAX_LAYERS}.")
+ counts = view_counts(num_layers)
+ if views not in counts:
+ raise ConfigurationError(f"With {num_layers} layers, choose {', '.join(map(str, counts))} views per layer.")
+
+
+def gpu_model(name: str) -> str:
+ """Shorten a driver-provided model name for the GPU heading."""
+ name = re.sub(r"\b(NVIDIA|GeForce|Tesla|Quadro)\s*", "", name, flags=re.IGNORECASE)
+ name = re.sub(r"\bRTX\s+(?=A\d)", "", name, flags=re.IGNORECASE)
+ name = re.sub(r"-(?:SXM\d*|PCIE)-", " ", name, flags=re.IGNORECASE)
+ name = re.sub(r"\s+HBM\w*\b", "", name, flags=re.IGNORECASE)
+ return name.strip()
+
+
+def describe_gpus(models: dict[int, str]) -> str:
+ """Keep common models concise and mixed-device assignments unambiguous."""
+ groups = {}
+ for index, name in models.items():
+ groups.setdefault(name, []).append(str(index))
+ if not groups:
+ return "No CUDA GPUs Available"
+ if len(groups) == 1:
+ return next(iter(groups))
+ return "\n".join(f"{', '.join(indices)} · {name}" for name, indices in groups.items())
diff --git a/fdanyone/space/display.py b/fdanyone/space/display.py
new file mode 100644
index 0000000..2ab94b9
--- /dev/null
+++ b/fdanyone/space/display.py
@@ -0,0 +1,30 @@
+"""One Rerun scene and a synchronized, independently scrollable media surface."""
+
+from pathlib import Path
+
+DISPLAY_HTML = """
+<div class="space-display" aria-label="Scene And Videos">
+ <div class="scene-stage">
+ <div class="rerun-canvas" aria-label="Rerun Scene"></div>
+ <button class="scene-play" type="button" aria-label="Play" aria-keyshortcuts="Space" title="Play (Space)" hidden>
+ <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5v14l11-7z" /></svg>
+ </button>
+ <div class="source-preview" hidden></div>
+ <div class="scene-loading" role="status" aria-busy="true">
+ <span class="scene-spinner" aria-hidden="true"></span><span class="scene-loading-text">Loading Scene</span>
+ </div>
+ </div>
+ <section class="target-panel" aria-label="Target Videos">
+ <div class="media-heading"><span>Target Videos</span><span class="target-count"></span></div>
+ <div class="target-scroll"><div class="target-grid"></div><div class="target-empty">No Results Yet</div></div>
+ </section>
+ <div class="media-enlarged" hidden>
+ <div class="media-heading"><span class="enlarged-title"></span>
+ <button type="button" class="media-back">Back</button></div>
+ <div class="enlarged-content"></div>
+ </div>
+ <div class="display-note" role="status" hidden></div>
+</div>
+"""
+
+DISPLAY_JS = Path(__file__).with_name("assets").joinpath("display.js").read_text()
diff --git a/fdanyone/space/form.py b/fdanyone/space/form.py
new file mode 100644
index 0000000..d823d49
--- /dev/null
+++ b/fdanyone/space/form.py
@@ -0,0 +1,284 @@
+"""Named inference controls and a read-only rendering of the saved CLI arguments."""
+
+from __future__ import annotations
+
+import html
+
+import gradio as gr
+
+from fdanyone.device import validate_gpu_ids
+from fdanyone.space.controls import (
+ MAX_LAYERS,
+ PITCH_PRESETS,
+ PITCHES_HTML,
+ PITCHES_JS,
+ SLIDER_HTML,
+ SLIDER_JS,
+ VIEWS_PER_GROUP,
+ describe_gpus,
+ gpu_model,
+ validate_view_count,
+ view_counts,
+)
+from fdanyone.space.gpus import available_gpus
+from fdanyone.space.help import option_label
+from fdanyone.space.settings import complete_options, layout_options, make_options, validate_options
+from fdanyone.space.source import ClipTiming
+from fdanyone.space.task import SavedTask, SpaceConfig
+from fdanyone.views import MAX_PITCH, MIN_PITCH
+
+ATTENTION_LABELS = {
+ "auto": "Auto",
+ "sdpa": "SDPA",
+ "flash_attn_3": "Flash Attention 3",
+ "sageattention": "SageAttention",
+}
+
+
+class InferenceForm:
+ def __init__(self, config: SpaceConfig):
+ self.config = config
+ models = available_gpus()
+ self.gpus = list(range(len(models)))
+ self.gpu_description = describe_gpus({index: gpu_model(name) for index, name in enumerate(models)})
+ timing = ClipTiming.read(config.video_path)
+ self.start_max = timing.start_max("auto") if timing else 0
+ self.defaults = complete_options(
+ dict(views_per_layer=6, gpu_ids=config.gpu_ids, attention_backend=config.attention_backend)
+ )
+ self.fields = {}
+
+ def slider(self, name, label, elem_id, **props):
+ self.fields[name] = gr.HTML(
+ value=self.defaults[name],
+ label=label,
+ label_html=option_label(label),
+ input_id=f"{elem_id}-input",
+ interactive=True,
+ html_template=SLIDER_HTML,
+ js_on_load=SLIDER_JS,
+ apply_default_css=False,
+ elem_id=elem_id,
+ **props,
+ )
+ return self.fields[name]
+
+ def clip_control(self):
+ self.slider(
+ "start_time",
+ "Clip Start",
+ "clip-start",
+ minimum=0,
+ maximum=self.start_max,
+ step=0.01,
+ precision=2,
+ minimum_decimals=1,
+ suffix=" s",
+ commit_on_change=True,
+ )
+ self.saved_clip = gr.HTML("", visible=False, elem_id="saved-clip-start")
+
+ def parameters(self):
+ self.note = gr.Markdown("", elem_id="parameter-note")
+ self.saved = gr.HTML("", visible=False, elem_id="saved-parameters")
+ with gr.Column(min_width=0, elem_id="settings-grid") as self.panel:
+ with gr.Column(min_width=0, elem_classes="settings-section"):
+ gr.HTML(
+ '<div class="section-heading"><h3>Camera Layout</h3>'
+ '<output class="camera-view-count" aria-live="polite">6 views in total</output></div>',
+ elem_id="camera-heading",
+ )
+ self.fields["layer_pitches"] = gr.HTML(
+ value=self.defaults["layer_pitches"],
+ views=6,
+ min_pitch=MIN_PITCH,
+ max_pitch=MAX_PITCH,
+ max_layers=MAX_LAYERS,
+ pitch_presets=[list(pitches) for pitches in PITCH_PRESETS],
+ view_counts={str(count): list(view_counts(count)) for count in range(1, MAX_LAYERS + 1)},
+ interactive=True,
+ html_template=PITCHES_HTML.replace("{{layers_label}}", option_label("No. Layers")).replace(
+ "{{pitches_label}}", option_label("Pitches")
+ ),
+ js_on_load=PITCHES_JS,
+ apply_default_css=False,
+ elem_id="camera-pitches",
+ )
+ self.slider("views_per_layer", "Views Per Layer", "camera-views", counts=list(view_counts(1)))
+ self.slider("start_yaw", "Start Yaw", "camera-yaw", minimum=-180, maximum=180, step=1, suffix="°")
+ self.slider("yaw_span", "Yaw Span", "camera-span", minimum=1, maximum=360, step=1, suffix="°")
+ with gr.Column(min_width=0, elem_classes="settings-section"):
+ gr.Markdown("### Model")
+ with gr.Row(elem_classes="option-row"):
+ gr.HTML(option_label("Attention"), min_width=0)
+ self.fields["attention_backend"] = gr.Dropdown(
+ [(label, value) for value, label in ATTENTION_LABELS.items()],
+ value=self.config.attention_backend,
+ label="Attention",
+ show_label=False,
+ min_width=0,
+ elem_id="attention-backend",
+ )
+ for name, label in [("turbo", "Turbo Model"), ("rcp", "RCP"), ("tcr", "TCR")]:
+ with gr.Row(elem_classes="option-row"):
+ gr.HTML(option_label(label), min_width=0)
+ self.fields[f"enable_{name}"] = gr.Checkbox(
+ value=self.defaults[f"enable_{name}"],
+ label=label,
+ show_label=False,
+ min_width=0,
+ elem_id=f"enable-{name}",
+ elem_classes="model-toggle",
+ )
+ with gr.Column(min_width=0, elem_classes="settings-section"):
+ gr.HTML(
+ '<div class="section-heading"><h3>'
+ + option_label("GPUs")
+ + '</h3><span class="gpu-description">'
+ + html.escape(self.gpu_description)
+ + "</span></div>",
+ elem_id="gpu-heading",
+ )
+ self.fields["gpu_ids"] = gr.CheckboxGroup(
+ choices=[(str(index), index) for index in self.gpus],
+ value=self.gpus if self.config.gpu_ids is None else list(self.config.gpu_ids),
+ label="GPUs",
+ show_label=False,
+ elem_id="gpu-selection",
+ )
+
+ @property
+ def inputs(self):
+ return list(self.fields.values())
+
+ @property
+ def outputs(self):
+ return [self.saved_clip, self.note, self.saved, self.panel, *self.inputs]
+
+ def decode(self, values) -> dict:
+ return dict(zip(self.fields, values, strict=True))
+
+ def values(self, task: SavedTask | None) -> dict:
+ options = task.options if task else self.defaults
+ return {
+ **{name: options[name] for name in self.fields},
+ "gpu_ids": list(self.gpus if options["gpu_ids"] is None else options["gpu_ids"]),
+ }
+
+ @staticmethod
+ def layout(values, *, editable=False) -> dict:
+ layout = layout_options(
+ *(values[name] for name in ("views_per_layer", "layer_pitches", "start_yaw", "yaw_span"))
+ )
+ if editable:
+ validate_view_count(layout["views_per_layer"], len(layout["layer_pitches"]))
+ layout["layer_pitches"] = sorted(layout["layer_pitches"], reverse=True)
+ return layout
+
+ def options(self, values) -> dict:
+ layout = self.layout(values, editable=True)
+ validate_gpu_ids(values["gpu_ids"], len(self.gpus))
+ options = make_options(
+ str(self.config.video_path),
+ layout["views_per_layer"],
+ layout["layer_pitches"],
+ layout["start_yaw"],
+ layout["yaw_span"],
+ values["enable_turbo"],
+ min(values["start_time"], self.start_max),
+ )
+ options.update(
+ gpu_ids=None if values["gpu_ids"] == self.gpus else values["gpu_ids"],
+ target_fps="auto",
+ views_per_group=VIEWS_PER_GROUP,
+ **{name: values[name] for name in ("enable_rcp", "enable_tcr", "attention_backend")},
+ model_dir=str(self.config.model_dir),
+ gvhmr_root=str(self.config.gvhmr_root),
+ )
+ validate_options(options)
+ return options
+
+ def update(self, task: SavedTask | None, values: dict) -> dict:
+ locked = task is not None
+ detail = task.error if task else ""
+ if task and not task.complete and task.source is None:
+ detail = "Original Source Video Unavailable Or Changed"
+ updates = {
+ self.note: gr.update(value=html.escape(detail), visible=bool(detail)),
+ self.panel: gr.update(visible=not locked),
+ self.saved: gr.update(value=self.summary(task) if task else "", visible=locked),
+ self.saved_clip: gr.update(
+ value='<dl class="clip-summary">'
+ + saved_row("Clip Start", f"{float(values['start_time'])} s")
+ + "</dl>",
+ visible=locked,
+ ),
+ **self.field_updates(values, interactive=not locked),
+ }
+ updates[self.fields["start_time"]]["visible"] = not locked
+ return updates
+
+ def field_updates(self, values: dict, *, interactive: bool) -> dict:
+ """Send complete HTML props so controls survive hiding and remounting."""
+ props = {
+ name: {
+ **(component.props if isinstance(component, gr.HTML) else {}),
+ "value": values[name],
+ "interactive": interactive,
+ }
+ for name, component in self.fields.items()
+ }
+ props["start_time"].update(
+ maximum=max(self.start_max, values["start_time"]),
+ interactive=interactive and self.start_max > 0,
+ )
+ props["layer_pitches"]["views"] = values["views_per_layer"]
+ props["views_per_layer"]["counts"] = list(view_counts(len(values["layer_pitches"])))
+ choices = sorted(set(self.gpus) | set(values["gpu_ids"])) if not interactive else self.gpus
+ props["gpu_ids"]["choices"] = [(str(index), index) for index in choices]
+ return {component: gr.update(**props[name]) for name, component in self.fields.items()}
+
+ def summary(self, task: SavedTask) -> str:
+ options = task.options
+ pitches = options["layer_pitches"]
+ gpu_ids = options["gpu_ids"]
+ gpu_names = ", ".join(map(str, self.gpus if gpu_ids is None else gpu_ids))
+ if gpu_ids is None:
+ gpu_names = f"All Available · {gpu_names}"
+ camera = [
+ ("No. Layers", len(pitches)),
+ ("Pitches", ", ".join(f"{pitch}°" for pitch in pitches)),
+ ("Views Per Layer", options["views_per_layer"]),
+ ("Start Yaw", f"{options['start_yaw']}°"),
+ ("Yaw Span", f"{options['yaw_span']}°"),
+ ]
+ model = [
+ ("Attention", ATTENTION_LABELS[options["attention_backend"]]),
+ ("Turbo Model", "On" if options["enable_turbo"] else "Off"),
+ ("RCP", "On" if options["enable_rcp"] else "Off"),
+ ("TCR", "On" if options["enable_tcr"] else "Off"),
+ ]
+ total = options["views_per_layer"] * len(pitches)
+ return (
+ '<section class="saved-section"><div class="section-heading"><h3>Camera Layout</h3>'
+ f'<span class="camera-view-count">{total} views in total</span></div><dl>'
+ + "".join(saved_row(*row) for row in camera)
+ + '</dl></section><section class="saved-section"><div class="section-heading"><h3>Model</h3></div><dl>'
+ + "".join(saved_row(*row) for row in model)
+ + '</dl></section><section class="saved-section"><div class="section-heading"><h3>'
+ + option_label("GPUs", context="saved")
+ + "</h3>"
+ + '<span class="gpu-description">'
+ + html.escape(self.gpu_description)
+ + '</span></div><div class="saved-gpus" data-parameter="GPUs">'
+ + html.escape(gpu_names or "Unavailable")
+ + "</div></section>"
+ )
+
+
+def saved_row(label, value):
+ return (
+ f'<div class="saved-option" data-parameter="{label}"><dt>'
+ + option_label(label, context="saved")
+ + f"</dt><dd>{html.escape(str(value))}</dd></div>"
+ )
diff --git a/fdanyone/space/gpus.py b/fdanyone/space/gpus.py
new file mode 100644
index 0000000..106941c
--- /dev/null
+++ b/fdanyone/space/gpus.py
@@ -0,0 +1,41 @@
+"""Inspect CUDA's logical devices in a short-lived process, outside the web server."""
+
+from __future__ import annotations
+
+import json
+import subprocess
+import sys
+from pathlib import Path
+
+
+def available_gpus() -> list[str]:
+ """Keep CUDA ordering/masking while releasing the probe's CUDA context on exit."""
+ result = subprocess.run(
+ [sys.executable, "-m", "fdanyone.space.gpus"],
+ cwd=Path(__file__).resolve().parents[2],
+ capture_output=True,
+ text=True,
+ check=True,
+ timeout=30,
+ )
+ return json.loads(result.stdout)
+
+
+def main() -> None:
+ try:
+ import torch
+ except ModuleNotFoundError as exc:
+ if exc.name != "torch":
+ raise
+ names = []
+ else:
+ names = (
+ [torch.cuda.get_device_name(index) for index in range(torch.cuda.device_count())]
+ if torch.cuda.is_available()
+ else []
+ )
+ print(json.dumps(names))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/fdanyone/space/help.py b/fdanyone/space/help.py
new file mode 100644
index 0000000..78f9abe
--- /dev/null
+++ b/fdanyone/space/help.py
@@ -0,0 +1,57 @@
+"""Short option descriptions shared by editable controls and saved arguments."""
+
+import html
+from pathlib import Path
+
+DESCRIPTIONS = {
+ "Source": "The input video for this task. It must contain at least 121 usable frames after Clip Start.",
+ "Output": "The folder for this task's saved settings, recovered motion and generated videos.",
+ "Clip Start": (
+ "Where to start in the source video, in seconds. Inference uses the next 121 frames; "
+ "the slider leaves enough video for a full clip."
+ ),
+ "No. Layers": (
+ "Use one to five camera rings around the person. Each layer has its own pitch and the same number of views."
+ ),
+ "Pitches": (
+ "Each layer's camera elevation, in degrees. Positive angles look down from above; negative angles look up. "
+ "Use distinct integers from −15° to 45°."
+ ),
+ "Views Per Layer": (
+ "Evenly spaced cameras on each layer. More views give more angles and take longer to generate. "
+ "Available values keep the total view count divisible by six."
+ ),
+ "Start Yaw": (
+ "The first camera's horizontal angle on every layer. 0° faces the person; change this to rotate the whole rig."
+ ),
+ "Yaw Span": (
+ "How far each layer wraps around the person. 360° makes a full ring; smaller spans cover an arc. "
+ "The end angle is excluded to avoid duplicate views."
+ ),
+ "Attention": "Auto selects a suitable attention backend for your GPUs.",
+ "Turbo Model": "Use 4DAnyone-Turbo for faster generation. Turn this off to use the Base model.",
+ "RCP": "Use shared reference views to improve appearance consistency across generated views.",
+ "TCR": "Share context between view groups to improve structural consistency across generated views.",
+ "GPUs": (
+ "Select one or more CUDA GPUs for inference. All available GPUs are selected by default. "
+ "Numbers follow CUDA_VISIBLE_DEVICES when it is set."
+ ),
+}
+HELP_JS = Path(__file__).with_name("assets").joinpath("help.js").read_text()
+
+
+def option_label(label: str, *, context: str = "edit") -> str:
+ """Native popovers keep click-away, Escape and keyboard focus in the browser."""
+ identifier = f"help-{context}-{label.lower().replace(' ', '-').replace('.', '')}"
+ text = html.escape(label)
+ return (
+ '<span class="option-label">'
+ f'<button type="button" class="help-button" popovertarget="{identifier}" '
+ f'aria-label="About {text}">{text}</button>'
+ f'<span id="{identifier}" class="option-help" popover="auto" role="note" '
+ f'aria-labelledby="{identifier}-title">'
+ f'<span class="help-heading"><strong id="{identifier}-title">{text}</strong>'
+ f'<button type="button" popovertarget="{identifier}" popovertargetaction="hide" '
+ 'aria-label="Close Description">×</button></span>'
+ f'<span class="help-description">{html.escape(DESCRIPTIONS[label])}</span></span></span>'
+ )
diff --git a/fdanyone/space/jobs.py b/fdanyone/space/jobs.py
new file mode 100644
index 0000000..5dd90f4
--- /dev/null
+++ b/fdanyone/space/jobs.py
@@ -0,0 +1,368 @@
+"""Queue local inference and own the complete lifetime of its subprocesses."""
+
+from __future__ import annotations
+
+import concurrent.futures
+import json
+import os
+import signal
+import subprocess
+import sys
+import threading
+import time
+import uuid
+from contextlib import suppress
+from dataclasses import dataclass, field, replace
+from pathlib import Path
+
+from fdanyone.errors import ConfigurationError, FourDAnyoneError
+from fdanyone.io import lock_output, remove_tree, resolve_output_path, sha256_file
+from fdanyone.output_directory import OutputDirectory
+from fdanyone.run_request import REQUEST_FILE, read_run_request, save_run_request
+from fdanyone.space.monitor import RunMonitor
+from fdanyone.space.previews import PreviewLoader
+from fdanyone.space.settings import complete_options
+from fdanyone.space.source import probe_input
+from fdanyone.space.task import SavedTask, SpaceConfig, ensure_new_output, read_task, saved_request, source_matches
+
+FINISHED = {"complete", "failed", "cancelled"}
+REPOSITORY = Path(__file__).resolve().parents[2]
+
+
+@dataclass
+class Job:
+ token: str
+ directory: Path
+ output_dir: Path
+ options: dict
+ state: str = "queued"
+ message: str = "Preparing Inference"
+ started: float = field(default_factory=time.monotonic)
+ cancel_event: threading.Event = field(default_factory=threading.Event)
+ future: concurrent.futures.Future | None = None
+ finished: float | None = None
+ monitor: RunMonitor = field(default_factory=RunMonitor)
+
+ def check_cancelled(self) -> None:
+ if self.cancel_event.is_set():
+ raise concurrent.futures.CancelledError
+
+
+def stop_process_group(process: subprocess.Popen, grace_seconds: float = 3.0) -> None:
+ """Terminate this job's workers, including grandchildren, on POSIX hosts."""
+
+ if os.name != "posix":
+ process.kill()
+ process.wait()
+ return
+ try:
+ os.killpg(process.pid, signal.SIGTERM)
+ except ProcessLookupError:
+ process.wait()
+ return
+ deadline = time.monotonic() + grace_seconds
+ while time.monotonic() < deadline:
+ process.poll()
+ try:
+ os.killpg(process.pid, 0)
+ except ProcessLookupError:
+ process.wait()
+ return
+ time.sleep(0.05)
+ with suppress(ProcessLookupError):
+ os.killpg(process.pid, signal.SIGKILL)
+ process.wait()
+
+
+class JobManager:
+ """One output and its inference lifetime, shared by all browser sessions."""
+
+ def __init__(self, config: SpaceConfig):
+ if config.video_path is None:
+ source = Path(saved_request(config.output_dir)["options"]["video_path"])
+ config = replace(config, video_path=source)
+ self.config = config
+ self.revision = 0
+ self.job: Job | None = None
+ self.lock = threading.RLock()
+ self.executor = concurrent.futures.ThreadPoolExecutor(max_workers=1, thread_name_prefix="inference")
+ self.closed = False
+ self.previews = PreviewLoader()
+
+ def current_job(self) -> Job | None:
+ with self.lock:
+ return self.job
+
+ def record(self) -> SavedTask | None:
+ with self.lock:
+ directory = self.config.output_dir
+ if not (directory / REQUEST_FILE).exists():
+ return None
+ return read_task(directory, self.config.cache_dir)
+
+ def signature(self) -> list:
+ with self.lock:
+ return [self.revision, self.job.state if self.job else None]
+
+ def deletion_key(self) -> list:
+ with self.lock:
+ return [self.revision, sha256_file(self.config.output_dir / REQUEST_FILE)]
+
+ def delete_output(self, expected: list) -> None:
+ """Delete only the confirmed, inactive task while holding the CLI's lock."""
+ with self.lock:
+ if self.closed or self.job and self.job.state not in FINISHED:
+ raise ConfigurationError("Wait for inference to stop before deleting its output.")
+ output = resolve_output_path(self.config.output_dir)
+ if output != self.config.output_dir or output.is_symlink() or not output.is_dir():
+ raise ConfigurationError("The output directory changed. Reload the Space before deleting it.")
+ with lock_output(output):
+ if expected != self.deletion_key():
+ raise ConfigurationError("The task changed. Review its current state before deleting output.")
+ record = self.record()
+ if record is None or record.complete:
+ raise ConfigurationError("Only unfinished task output can be deleted in the Space.")
+ protected = [
+ REPOSITORY,
+ self.config.video_path,
+ self.config.cache_dir,
+ self.config.model_dir,
+ self.config.gvhmr_root,
+ *(
+ Path(record.options[key])
+ for key in ("video_path", "model_dir", "gvhmr_root", "checkpoint_path", "mhr70_regressor_path")
+ if record.options.get(key)
+ ),
+ ]
+ if any(path.resolve().is_relative_to(output) for path in protected):
+ raise ConfigurationError("Cannot delete an output folder containing source, models, code or cache.")
+ self.previews.discard_all(wait=True)
+ remove_tree(output)
+ self.job = None
+ self.revision += 1
+
+ def resume(self) -> Job:
+ with self.lock:
+ record = self.record()
+ if record and record.complete:
+ raise ConfigurationError("This result is complete.")
+ if not record or not record.resumable:
+ raise ConfigurationError("Cannot resume: the saved settings or original source video are unavailable.")
+ return self.submit(record.options, resume=True)
+
+ def submit(self, options: dict, *, resume: bool = False) -> Job:
+ from fdanyone.assets import SMPLX_MODEL
+
+ options = complete_options(
+ {
+ "model_dir": str(self.config.model_dir),
+ "gvhmr_root": str(self.config.gvhmr_root),
+ "gpu_ids": self.config.gpu_ids,
+ "attention_backend": self.config.attention_backend,
+ **options,
+ }
+ )
+ model_dir = Path(options["model_dir"]).expanduser().resolve()
+ gvhmr_root = Path(options["gvhmr_root"]).expanduser().resolve()
+ if not (model_dir / SMPLX_MODEL).is_file():
+ raise ConfigurationError(
+ "SMPL-X is not installed. Run python scripts/download_smplx.py "
+ "in the terminal with the same model directory, then try again."
+ )
+ source = Path(options["video_path"]).resolve()
+ probe_input(source, options["start_time"], options["target_fps"])
+ with self.lock:
+ if self.closed:
+ raise ConfigurationError("The Space is shutting down.")
+ current = self.current_job()
+ if current and current.state not in FINISHED:
+ raise ConfigurationError("This task already has an active inference run.")
+ output_dir = resolve_output_path(self.config.output_dir)
+ output_dir.parent.mkdir(parents=True, exist_ok=True)
+ with lock_output(output_dir):
+ if not resume:
+ ensure_new_output(output_dir)
+ else:
+ OutputDirectory(output_dir).validate_available()
+ previous = read_run_request(output_dir)
+ if previous and not source_matches(source, previous["source"], self.config.cache_dir):
+ raise ConfigurationError("The source video differs from the saved request.")
+ token = uuid.uuid4().hex
+ directory = self.config.cache_dir / "jobs" / token
+ directory.mkdir(parents=True)
+ gpu_ids = options["gpu_ids"]
+ payload = {
+ **options,
+ "video_path": str(source),
+ "output_dir": str(output_dir),
+ "model_dir": str(model_dir),
+ "gvhmr_root": str(gvhmr_root),
+ "gpu_ids": list(gpu_ids) if gpu_ids is not None else None,
+ }
+ save_run_request(output_dir, payload, space_job=str(directory))
+ # Write before queueing so reloads can recover the request/log
+ # even if the process stops before the worker starts.
+ (directory / "request.json").write_text(json.dumps(payload) + "\n")
+ job = Job(token, directory, output_dir, payload)
+ self.job = job
+ self.revision += 1
+ job.future = self.executor.submit(self._run, job)
+ return job
+
+ def get(self, token: str) -> Job:
+ with self.lock:
+ if self.job is None or self.job.token != token:
+ raise ConfigurationError("This run is no longer available. Start a new run.")
+ return self.job
+
+ def cancel(self, token: str | None) -> str:
+ if not token:
+ return "No active run."
+ with self.lock:
+ job = self.get(token)
+ if job.state in FINISHED:
+ return job.message
+ job.cancel_event.set()
+ if job.future is not None and job.future.cancel():
+ job.state, job.message = "cancelled", "Stopped. Resume inference or delete the saved output."
+ job.finished = time.monotonic()
+ else:
+ job.message = "Stopping the inference workers…"
+ return job.message
+
+ def snapshot(self, token: str) -> dict:
+ with self.lock:
+ job = self.get(token)
+ elapsed = (job.finished or time.monotonic()) - job.started
+ return {
+ "state": job.state,
+ "message": job.message,
+ "elapsed": elapsed,
+ "output_dir": job.output_dir,
+ "monitor": job.monitor.payload(
+ token=token,
+ name=job.output_dir.name,
+ state=job.state,
+ message=job.message,
+ elapsed=elapsed,
+ log_path=job.directory / "inference.log",
+ stopping=job.cancel_event.is_set(),
+ ),
+ }
+
+ def monitor(self, record: SavedTask | None) -> dict | None:
+ """Recover this task's current run or the directly indexed saved log."""
+
+ with self.lock:
+ job = self.current_job()
+ if job is not None:
+ return self.snapshot(job.token)["monitor"]
+ if not record or record.log_dir is None:
+ return None
+ directory = record.log_dir.resolve()
+ if not directory.is_relative_to((self.config.cache_dir / "jobs").resolve()):
+ return None
+ try:
+ request = json.loads((directory / "request.json").read_text())
+ if Path(request["output_dir"]).resolve() != record.directory.resolve():
+ return None
+ if not (directory / "inference.log").is_file():
+ return None
+ status = json.loads((directory / "status.json").read_text())
+ except (OSError, ValueError, KeyError):
+ return None
+ monitor = RunMonitor()
+ monitor.status(status)
+ state = "complete" if record.complete else "failed" if status.get("error") else "cancelled"
+ return monitor.payload(
+ token=directory.name,
+ name=record.directory.name,
+ state=state,
+ message=status.get("message", ""),
+ elapsed=status.get("summary", {}).get("total_pipeline_elapsed_seconds"),
+ log_path=directory / "inference.log",
+ )
+
+ def _update(self, job: Job, **fields) -> None:
+ with self.lock:
+ for name, value in fields.items():
+ setattr(job, name, value)
+ if fields.get("state") in FINISHED and job.finished is None:
+ job.finished = time.monotonic()
+
+ def _status(self, job: Job, status: dict) -> None:
+ with self.lock:
+ job.message = status["message"]
+ job.monitor.status(status)
+
+ def _command(self, request: Path) -> list[str]:
+ return [sys.executable, "-u", "-m", "fdanyone.space.worker", str(request)]
+
+ def _run(self, job: Job) -> None:
+ process = None
+ try:
+ job.check_cancelled()
+ request = job.directory / "request.json"
+ self._update(job, state="running", message="Starting inference")
+ environment = os.environ.copy()
+ environment["PYTHONPATH"] = str(REPOSITORY)
+ environment.pop("PYTHONHOME", None)
+ # Avoid oversubscribing a shared workstation during video preparation.
+ environment.setdefault("OMP_NUM_THREADS", "8")
+ with (job.directory / "inference.log").open("w") as log:
+ process = subprocess.Popen(
+ self._command(request),
+ cwd=REPOSITORY,
+ env=environment,
+ stdin=subprocess.DEVNULL,
+ stdout=log,
+ stderr=subprocess.STDOUT,
+ start_new_session=True,
+ )
+ while process.poll() is None:
+ job.check_cancelled()
+ try:
+ status = json.loads((job.directory / "status.json").read_text())
+ except (OSError, ValueError):
+ pass
+ else:
+ self._status(job, status)
+ job.cancel_event.wait(0.3)
+ job.check_cancelled()
+ if process.returncode:
+ # A crashed parent may leave a model worker in its process group.
+ stop_process_group(process)
+ try:
+ status = json.loads((job.directory / "status.json").read_text())
+ except (OSError, ValueError, KeyError):
+ status = {}
+ if status.get("error") and status.get("message"):
+ message = status["message"]
+ else:
+ message = f"Inference exited with code {process.returncode}. See the run log."
+ if status.get("message"):
+ message += f" Last stage: {status['message']}."
+ raise FourDAnyoneError(message)
+ from fdanyone.space.viewer import read_result
+
+ # Inference completes when its published result is valid. Scene
+ # preparation belongs to PreviewLoader and cannot fail the run.
+ read_result(job.output_dir)
+ job.check_cancelled()
+ self._update(job, state="complete", message="Complete")
+ except concurrent.futures.CancelledError:
+ if process is not None:
+ stop_process_group(process)
+ self._update(job, state="cancelled", message="Stopped. Resume inference or delete the saved output.")
+ except Exception as exc:
+ if process is not None and process.poll() is None:
+ stop_process_group(process)
+ self._update(job, state="failed", message=f"Failed: {exc}")
+
+ def close(self) -> None:
+ with self.lock:
+ self.closed = True
+ if self.job:
+ self.cancel(self.job.token)
+ self.previews.close()
+ self.executor.shutdown(wait=True, cancel_futures=True)
diff --git a/fdanyone/space/monitor.py b/fdanyone/space/monitor.py
new file mode 100644
index 0000000..bd6451b
--- /dev/null
+++ b/fdanyone/space/monitor.py
@@ -0,0 +1,215 @@
+"""Bounded console output and two-stage progress from the ordinary CLI run."""
+
+from __future__ import annotations
+
+import codecs
+import re
+from collections import deque
+from pathlib import Path
+
+MAX_LOG_BYTES = 64 * 1024
+MAX_READ_BYTES = 128 * 1024
+MAX_LOG_LINES = 500
+ANSI = re.compile(r"\x1b(?:\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1b\\))")
+COUNTER = re.compile(r"^([^:]+):\s*\d+%.*?\|\s*(\d+)/(\d+)\s+\[")
+DISTRIBUTED_STEP = re.compile(r"Completed target denoising step (\d+)/(\d+)")
+
+
+class ConsoleTail:
+ """Read appended bytes, retaining terminal carriage-return behavior."""
+
+ def __init__(self):
+ self.offset = 0
+ self.identity = None
+ self.lines = deque(maxlen=MAX_LOG_LINES)
+ self.line = ""
+ self.escape = ""
+ self.decoder = codecs.getincrementaldecoder("utf-8")("replace")
+
+ def read(self, path: Path, observe=lambda line: None) -> str:
+ try:
+ stat = path.stat()
+ identity = (stat.st_dev, stat.st_ino)
+ if self.identity != identity or stat.st_size < self.offset:
+ self.__init__()
+ self.identity = identity
+ if stat.st_size == self.offset:
+ return self.text
+ with path.open("rb") as stream:
+ if stat.st_size - self.offset > MAX_READ_BYTES:
+ # A browser joining a long run needs the latest output.
+ self.offset = max(0, stat.st_size - MAX_READ_BYTES)
+ self.lines.clear()
+ self.line = self.escape = ""
+ self.decoder.reset()
+ stream.seek(self.offset)
+ else:
+ stream.seek(self.offset)
+ chunk = stream.read(MAX_READ_BYTES)
+ self.offset = stream.tell()
+ except FileNotFoundError:
+ return self.text
+ text = self.escape + self.decoder.decode(chunk)
+ self.escape = ""
+ last_escape = text.rfind("\x1b")
+ if last_escape >= 0 and not ANSI.fullmatch(text[last_escape:]) and not ANSI.match(text[last_escape:]):
+ self.escape, text = text[last_escape:][-256:], text[:last_escape]
+ for fragment in re.split(r"([\r\n\b])", ANSI.sub("", text)):
+ if fragment in {"\r", "\n"}:
+ observe(self.line)
+ if fragment == "\n":
+ self.lines.append(self.line)
+ self.line = ""
+ elif fragment == "\b":
+ self.line = self.line[:-1]
+ else:
+ fragment = re.sub(r"[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]", "", fragment)
+ self.line = (self.line + fragment)[-MAX_LOG_BYTES:]
+ observe(self.line)
+ # Bound server memory as well as each browser update.
+ size = len(self.line)
+ for line in reversed(self.lines):
+ size += len(line) + 1
+ while self.lines and size > MAX_LOG_BYTES:
+ size -= len(self.lines.popleft()) + 1
+ return self.text
+
+ @property
+ def text(self) -> str:
+ return "\n".join([*self.lines, self.line]).rstrip("\n")[-MAX_LOG_BYTES:]
+
+
+class RunMonitor:
+ """Progress advances on stage events and completed work, never on a timer.
+
+ Segment positions represent pipeline milestones, not elapsed-time estimates.
+ Actual frame/batch/denoising counters are shown in the accompanying detail.
+ Unknown-duration preparation and saving retain their milestone position.
+ """
+
+ def __init__(self):
+ self.console = ConsoleTail()
+ self.stage = 0
+ self.progress = [0.0, 0.0]
+ self.detail = "Preparing Inference"
+ self.last_status = None
+
+ def advance(self, stage: int, fraction: float, detail: str):
+ if stage < self.stage or fraction < self.progress[stage]:
+ return
+ self.stage = stage
+ if stage == 1:
+ self.progress[0] = 1.0
+ self.progress[stage] = min(fraction, 0.99)
+ self.detail = detail
+
+ def status(self, status: dict):
+ identity = (status.get("fraction"), status.get("message"), status.get("error"))
+ if identity == self.last_status or status.get("error"):
+ return
+ self.last_status = identity
+ fraction = float(status.get("fraction", 0))
+ if fraction >= 1:
+ self.advance(1, 0.97, "Finishing Inference")
+ elif fraction >= 0.92:
+ self.advance(1, 0.94, "Validating Videos")
+ elif fraction >= 0.45:
+ self.advance(1, 0.15, "Loading Models And Encoding Input")
+ elif fraction >= 0.30:
+ self.advance(1, 0.03, "Preparing Masks And Skeletons")
+ elif fraction >= 0.15:
+ self.advance(0, 0.15, "Recovering 3D Motion")
+ elif fraction >= 0.10:
+ self.advance(0, 0.10, "Preparing Input Clip")
+ elif fraction >= 0.05:
+ self.advance(0, 0.04, "Preparing Model Assets")
+ else:
+ self.advance(0, 0.01, "Checking Input And Settings")
+
+ def observe(self, line: str):
+ if match := COUNTER.search(line.strip()):
+ label, done, total = match.groups()
+ done, total = int(done), int(total)
+ if total <= 0 or done > total:
+ return
+ part = done / total
+ if label == "YoloV8 Tracking":
+ self.advance(0, 0.15 + 0.40 * part, f"Tracking Person · {done}/{total} Frames")
+ elif label == "ViTPose":
+ self.advance(0, 0.55 + 0.15 * part, f"Estimating Pose · {done}/{total} Batches")
+ elif label == "HMR2 Feature":
+ self.advance(0, 0.70 + 0.15 * part, f"Extracting Features · {done}/{total} Batches")
+ elif label.startswith("RCP 1-to-"):
+ self.advance(1, 0.20 + 0.15 * part, f"Reference Views · Step {done}/{total}")
+ elif re.fullmatch(r"Generate \d+ target views", label):
+ self.advance(1, 0.40 + 0.45 * part, f"Target Views · Step {done}/{total}")
+ elif match := DISTRIBUTED_STEP.search(line):
+ done, total = map(int, match.groups())
+ if total > 0 and done <= total:
+ self.advance(1, 0.40 + 0.45 * done / total, f"Target Views · Step {done}/{total}")
+ elif "[Preprocess] End." in line:
+ self.advance(0, 0.88, "Recovering 3D Motion")
+ elif "Reusing GVHMR motion from " in line:
+ self.advance(0, 0.95, "Reusing Recovered Motion")
+ elif "Publishing target camera " in line:
+ self.advance(1, 0.90, "Encoding And Saving Videos")
+
+ def payload(self, *, token, name, state, message, elapsed, log_path=None, stopping=False) -> dict:
+ if log_path is not None:
+ self.console.read(log_path, self.observe)
+ stage, progress, detail = self.stage, list(self.progress), self.detail
+ if state == "queued":
+ detail = "Preparing Inference"
+ elif state == "complete":
+ stage, progress, detail = 1, [1.0, 1.0], "Complete"
+ elif state == "failed":
+ detail = message
+ elif state == "cancelled":
+ detail = "Stopped · Saved Results Are Kept"
+ if stopping and state not in {"complete", "failed", "cancelled"}:
+ detail = "Stopping Inference"
+ return {
+ "token": token,
+ "name": name,
+ "state": state,
+ "stage": stage,
+ "progress": progress,
+ "detail": detail,
+ "elapsed": elapsed,
+ "log": self.console.text,
+ }
+
+
+def preparing_monitor() -> dict:
+ return RunMonitor().payload(token="preparing", name="", state="starting", message="", elapsed=None)
+
+
+MONITOR_HTML = """
+<section class="run-monitor" aria-label="Inference Progress" hidden>
+ <div class="run-stages">
+ <div class="run-stage" data-stage="0">
+ <div class="stage-label"><span class="stage-icon">1</span>Recovering Motion</div>
+ <div class="stage-track" role="progressbar" aria-label="Recovering Motion" aria-valuemin="0" aria-valuemax="100">
+ <div class="stage-fill"></div>
+ </div>
+ </div>
+ <div class="run-stage" data-stage="1">
+ <div class="stage-label"><span class="stage-icon">2</span>Generating Videos</div>
+ <div class="stage-track" role="progressbar" aria-label="Generating Videos" aria-valuemin="0" aria-valuemax="100">
+ <div class="stage-fill"></div>
+ </div>
+ </div>
+ </div>
+ <div class="run-detail"><span class="run-step" role="status"></span><span class="run-elapsed"></span></div>
+ <section class="run-console" aria-label="Console">
+ <div class="console-heading">
+ <button type="button" class="console-toggle" aria-expanded="true">Console <span>▾</span></button>
+ <span class="console-run"></span>
+ <button type="button" class="console-follow" hidden>Follow</button>
+ </div>
+ <pre class="console-log" tabindex="0" aria-label="Inference Console" aria-live="off"></pre>
+ </section>
+</section>
+"""
+
+MONITOR_JS = Path(__file__).with_name("assets").joinpath("monitor.js").read_text()
diff --git a/fdanyone/space/overlay.py b/fdanyone/space/overlay.py
new file mode 100644
index 0000000..1675efe
--- /dev/null
+++ b/fdanyone/space/overlay.py
@@ -0,0 +1,46 @@
+"""Export the recovered mesh in the source camera for a lightweight WebGL overlay."""
+
+from __future__ import annotations
+
+import uuid
+from pathlib import Path
+
+import numpy as np
+
+from fdanyone.skeleton.keypoints import BLUE, LINKS, VISIBLE_KEYPOINT_IDS, keypoint_color
+
+
+def camera_points(points: np.ndarray, transforms: np.ndarray) -> np.ndarray:
+ """Invert per-frame OpenCV camera-to-world poses without changing geometry."""
+ return np.einsum("fvi,fij->fvj", points - transforms[:, None, :3, 3], transforms[:, :3, :3]).astype("<f4")
+
+
+def export_overlay(body: dict, directory: Path) -> dict:
+ directory.mkdir(parents=True, exist_ok=True)
+ paths = {}
+ for name in ("vertices", "faces", "keypoints"):
+ destination = directory / f"{name}.bin"
+ if not destination.is_file():
+ array = (
+ np.asarray(body[name], dtype="<u4")
+ if name == "faces"
+ else camera_points(body[name], body["source_camera_to_world"])
+ )
+ temporary = directory / f".{name}-{uuid.uuid4().hex}.bin"
+ try:
+ array.tofile(temporary)
+ temporary.replace(destination)
+ finally:
+ temporary.unlink(missing_ok=True)
+ paths[name] = str(destination)
+ return {
+ **paths,
+ "vertex_count": int(body["vertices"].shape[1]),
+ "keypoint_count": int(body["keypoints"].shape[1]),
+ "frames": int(body["vertices"].shape[0]),
+ "source_size": np.asarray(body["source_size"]).tolist(),
+ "intrinsics": np.asarray(body["intrinsics"]).tolist(),
+ "color": list(BLUE),
+ "links": [[a, b, list(color), major] for _, a, b, color, major in LINKS],
+ "joints": [[index, list(keypoint_color(index))] for index in sorted(VISIBLE_KEYPOINT_IDS)],
+ }
diff --git a/fdanyone/space/previews.py b/fdanyone/space/previews.py
new file mode 100644
index 0000000..02ffaa7
--- /dev/null
+++ b/fdanyone/space/previews.py
@@ -0,0 +1,104 @@
+"""Prepare scenes independently of inference and discard obsolete preview requests."""
+
+from __future__ import annotations
+
+import threading
+import uuid
+from concurrent.futures import CancelledError, ThreadPoolExecutor
+from concurrent.futures import wait as wait_futures
+from pathlib import Path
+
+from fdanyone.space.viewer import export_input, export_recording, read_result
+
+
+def motion_available(output: Path) -> bool:
+ """The CLI atomically publishes these two files as one motion directory."""
+ return all((output / "gvhmr" / name).is_file() for name in ("motion.json", "motion.safetensors"))
+
+
+def prepare_preview(config, task, layout, start_time, has_motion, *, check_cancelled):
+ """Build the current task's input, recovered body or completed result preview."""
+ source = task.source if task else config.video_path
+ options = (
+ task.options if task else {"model_dir": config.model_dir, "gvhmr_root": config.gvhmr_root, "target_fps": "auto"}
+ )
+ directories = {key: Path(options[key]) for key in ("model_dir", "gvhmr_root")}
+ if task and task.complete:
+ return export_recording(
+ read_result(config.output_dir),
+ config.cache_dir / "viewer",
+ source=source,
+ **directories,
+ check_cancelled=check_cancelled,
+ )
+ return export_input(
+ source,
+ config.cache_dir / "viewer",
+ layout,
+ start_time=start_time,
+ target_fps=options["target_fps"],
+ motion_dir=config.output_dir / "gvhmr" if has_motion else None,
+ **directories,
+ check_cancelled=check_cancelled,
+ )
+
+
+class PreviewLoader:
+ def __init__(self):
+ self.executor = ThreadPoolExecutor(max_workers=2, thread_name_prefix="space-preview")
+ self.pending = {}
+ self.futures = set()
+ self.lock = threading.RLock()
+
+ def submit(self, previous, function, *args, **kwargs):
+ with self.lock:
+ self.discard(previous)
+ # A closed/reloaded tab may never collect its last preview.
+ while len(self.pending) >= 32:
+ self.discard(next(iter(self.pending)))
+ token = uuid.uuid4().hex
+ cancelled = threading.Event()
+
+ def check_cancelled():
+ if cancelled.is_set():
+ raise CancelledError
+
+ future = self.executor.submit(function, *args, check_cancelled=check_cancelled, **kwargs)
+ self.futures.add(future)
+ future.add_done_callback(self._finished)
+ self.pending[token] = (future, cancelled)
+ return token
+
+ def _finished(self, future):
+ with self.lock:
+ self.futures.discard(future)
+
+ def take(self, token):
+ with self.lock:
+ if not token or token not in self.pending:
+ return None
+ future, _ = self.pending[token]
+ if not future.done():
+ return None
+ del self.pending[token]
+ return future.result()
+
+ def discard(self, token):
+ with self.lock:
+ pending = self.pending.pop(token, None)
+ if pending:
+ future, cancelled = pending
+ cancelled.set()
+ future.cancel()
+
+ def discard_all(self, *, wait=False):
+ with self.lock:
+ futures = list(self.futures)
+ for token in list(self.pending):
+ self.discard(token)
+ if wait:
+ wait_futures(futures)
+
+ def close(self):
+ self.discard_all()
+ self.executor.shutdown(wait=True, cancel_futures=True)
diff --git a/fdanyone/space/scene.py b/fdanyone/space/scene.py
new file mode 100644
index 0000000..6e74f18
--- /dev/null
+++ b/fdanyone/space/scene.py
@@ -0,0 +1,299 @@
+"""Rerun scene geometry and native-video logging; no task or cache ownership."""
+
+from __future__ import annotations
+
+from fractions import Fraction
+from pathlib import Path
+
+import numpy as np
+
+from fdanyone.errors import FourDAnyoneError
+from fdanyone.skeleton.keypoints import BLUE, LINKS, VISIBLE_KEYPOINT_IDS, keypoint_color
+
+CAMERA_PLANE_DISTANCE = 0.36
+
+
+def log_video(recording, entity: str, video: Path, fps, frames: int) -> None:
+ import rerun as rr
+
+ asset = rr.AssetVideo(path=video)
+ timestamps = asset.read_frame_timestamps_nanos()
+ if len(timestamps) != frames:
+ raise FourDAnyoneError(f"Video preview has {len(timestamps)} frames, expected {frames}.")
+ recording.log(entity, asset, static=True)
+ recording.send_columns(
+ entity,
+ indexes=[rr.TimeColumn("time", duration=np.arange(frames) / float(fps))],
+ columns=rr.VideoFrameReference.columns_nanos(timestamps),
+ )
+
+
+def log_cameras(recording, cameras, *, videos=(), fps=None, frames=121) -> None:
+ """An editable empty rig, or the fixed calibrated cameras of a result."""
+ import rerun as rr
+
+ if videos:
+ for camera, video in zip(cameras, videos, strict=True):
+ entity = f"world/cameras/{camera['camera_id']:02d}"
+ transform = np.asarray(camera["camera_to_world"])
+ recording.log(entity, rr.TransformAxes3D(0, show_frame=False), static=True)
+ recording.log(entity, rr.Transform3D(mat3x3=transform[:3, :3], translation=transform[:3, 3]), static=True)
+ recording.log(
+ entity,
+ rr.Pinhole(
+ image_from_camera=np.asarray(camera["K"]),
+ resolution=[camera["image_width"], camera["image_height"]],
+ camera_xyz=rr.ViewCoordinates.RDF,
+ image_plane_distance=CAMERA_PLANE_DISTANCE,
+ color=BLUE,
+ line_width=0,
+ ),
+ static=True,
+ )
+ log_video(recording, f"{entity}/image", video, fps, frames)
+ _log_camera_frames(
+ recording,
+ [(camera, (camera["image_width"], camera["image_height"]), bool(videos)) for camera in cameras],
+ )
+ recording.log(
+ "world/labels",
+ rr.Points3D(
+ [np.asarray(camera["camera_to_world"])[:3, 3] for camera in cameras],
+ colors=BLUE,
+ radii=0.018,
+ labels=[f"{camera['camera_id']:02d}" for camera in cameras],
+ show_labels=True,
+ ),
+ static=True,
+ )
+
+
+def blueprint(context: dict, count: int):
+ import rerun.blueprint as rrb
+
+ center = np.asarray(context["center"]) + [0, context["target_height"], 0]
+ scene = rrb.Spatial3DView(
+ origin="world",
+ name="Scene",
+ contents=[
+ "world/body/**",
+ "world/cameras/**",
+ "world/camera_frames/**",
+ "world/labels/**",
+ "world/stage/**",
+ "world/reference/**",
+ ],
+ eye_controls=rrb.EyeControls3D(
+ position=center + np.array([0.85, 0.55, 1.1]) * context["radius"] * (1.25 if count >= 12 else 1),
+ look_target=center,
+ eye_up=[0, 1, 0],
+ ),
+ )
+ return rrb.Blueprint(
+ scene,
+ rrb.TimePanel(timeline="time", play_state="playing", loop_mode="all", state="hidden"),
+ rrb.BlueprintPanel(state="hidden"),
+ rrb.SelectionPanel(state="hidden"),
+ )
+
+
+def _log_camera_frames(recording, frames: list) -> None:
+ """Batch static rig geometry so repaint cost does not grow by entity per camera."""
+ import rerun as rr
+
+ entity = "world/camera_frames"
+ # Only display geometry lives here, so clearing it never masks video frames.
+ recording.log(entity, rr.Clear(recursive=True), static=True)
+ lines, fills, bezels = [], [], []
+ for camera, size, has_video in frames:
+ width, height = size
+ outline, bezel, faces = _rounded_frame(width, height, min(size) * 0.075, min(size) * 0.02)
+ transform = np.asarray(camera["camera_to_world"])
+ origin = transform[:3, 3]
+ projection = np.linalg.inv(camera["K"]).T @ transform[:3, :3].T * CAMERA_PLANE_DISTANCE
+ plane = np.column_stack([outline + [width / 2, height / 2], np.ones(len(outline))]) @ projection + origin
+ corners = plane[np.arange(4) * (len(outline) // 4) + len(outline) // 8]
+ lines.extend([np.vstack([plane, plane[0]]), *[np.stack([origin, corner]) for corner in corners]])
+ if has_video:
+ vertices = np.column_stack([bezel + [width / 2, height / 2], np.ones(len(bezel))]) @ projection + origin
+ for direction in (-1, 1):
+ bezels.append((vertices + transform[:3, 2] * (direction * 0.0005), faces))
+ else:
+ count = len(plane)
+ fills.append(
+ (
+ np.vstack([plane.mean(axis=0), plane]),
+ np.column_stack([np.zeros(count), np.arange(count) + 1, (np.arange(count) + 1) % count + 1]),
+ )
+ )
+ recording.log(
+ f"{entity}/lines",
+ rr.LineStrips3D(lines, colors=BLUE, radii=rr.Radius.ui_points(0.75)),
+ static=True,
+ )
+ for name, meshes, color in [("fill", fills, [*BLUE, 65]), ("bezel", bezels, BLUE)]:
+ if not meshes:
+ continue
+ vertices, faces, offset = [], [], 0
+ for points, triangles in meshes:
+ vertices.append(points)
+ faces.append(triangles + offset)
+ offset += len(points)
+ recording.log(
+ f"{entity}/{name}",
+ rr.Mesh3D(
+ vertex_positions=np.concatenate(vertices),
+ triangle_indices=np.concatenate(faces).astype(np.uint32),
+ albedo_factor=color,
+ ),
+ static=True,
+ )
+
+
+def log_stage(recording, context: dict) -> None:
+ """A thin disk matching the camera ring, just below the original ground grid."""
+ import rerun as rr
+
+ count = 128
+ angles = np.arange(count) * (2 * np.pi / count)
+ center = np.asarray(context["center"], dtype=np.float64) - [0, 0.005, 0]
+ radius = context["radius"]
+ rim = center + np.column_stack([np.cos(angles), np.zeros(count), np.sin(angles)]) * radius
+ indices = np.arange(count)
+ next_indices = (indices + 1) % count
+ recording.log(
+ "world/stage/top",
+ rr.Mesh3D(
+ vertex_positions=np.vstack([center, rim]),
+ triangle_indices=np.column_stack([np.zeros(count), next_indices + 1, indices + 1]).astype(np.uint32),
+ vertex_normals=np.tile([0, 1, 0], (count + 1, 1)),
+ albedo_factor=[32, 34, 39],
+ ),
+ static=True,
+ )
+ recording.log(
+ "world/stage/edge",
+ rr.Mesh3D(
+ vertex_positions=np.vstack([rim, rim - [0, 0.005, 0]]),
+ triangle_indices=np.vstack(
+ [
+ np.column_stack([indices, next_indices, next_indices + count]),
+ np.column_stack([indices, next_indices + count, indices + count]),
+ ]
+ ),
+ albedo_factor=[22, 24, 28],
+ ),
+ static=True,
+ )
+ recording.log(
+ "world/stage/rim",
+ rr.LineStrips3D([np.vstack([rim, rim[0]])], radii=rr.Radius.ui_points(0.6), colors=[68, 72, 80]),
+ static=True,
+ )
+
+
+def _rounded_outline(width: float, height: float, radius: float) -> np.ndarray:
+ centers = [(width / 2 - radius, height / 2 - radius), (-width / 2 + radius, height / 2 - radius)]
+ centers += [(-width / 2 + radius, -height / 2 + radius), (width / 2 - radius, -height / 2 + radius)]
+ angles = np.linspace(0, np.pi / 2, 13)[None, :] + np.arange(4)[:, None] * (np.pi / 2)
+ arcs = np.stack([np.cos(angles), np.sin(angles)], axis=-1)
+ return (np.asarray(centers)[:, None, :] + radius * arcs).reshape(-1, 2)
+
+
+def _rounded_frame(width: float, height: float, radius: float, border: float):
+ inner = _rounded_outline(width, height, radius)
+ # A tighter outer curve keeps the video's square corners under even a thin bezel.
+ outer = _rounded_outline(width + border * 2, height + border * 2, min(radius + border, border * 3))
+ count = len(inner)
+ indices, next_indices = np.arange(count), (np.arange(count) + 1) % count
+ faces = np.vstack(
+ [
+ np.column_stack([indices, next_indices, next_indices + count]),
+ np.column_stack([indices, next_indices + count, indices + count]),
+ ]
+ )
+ return outer, np.vstack([outer, inner]), faces
+
+
+def log_source_card(recording, context: dict, video: Path, source_info: dict) -> None:
+ """A rounded video screen: full brightness toward +Z and dimmed on the back."""
+ import rerun as rr
+
+ width, height = source_info["width"], source_info["height"]
+ card_height = 2 * context["target_height"]
+ card_width = card_height * width / height
+ radius, border = min(card_width, card_height) * np.array([0.06, 0.012])
+ center = np.asarray(context["center"]) + [0, card_height / 2 + border, 0]
+ outer, bezel, faces = _rounded_frame(card_width, card_height, radius, border)
+ count = len(outer)
+ indices, next_indices = np.arange(count), (np.arange(count) + 1) % count
+ frame = np.column_stack([bezel, np.zeros(count * 2)]) + center
+ # One double-sided video needs one decoder. A back-facing translucent mesh
+ # dims its reverse side; the bezels mask the rectangular video corners.
+ recording.log(
+ "world/reference/back_tint",
+ rr.Mesh3D(
+ vertex_positions=np.vstack([center, np.column_stack([outer, np.zeros(count)]) + center]) - [0, 0, 0.001],
+ triangle_indices=np.column_stack([np.zeros(count), indices + 1, next_indices + 1]).astype(np.uint32),
+ albedo_factor=[12, 14, 18, 178],
+ face_rendering=rr.components.MeshFaceRendering.Back,
+ ),
+ static=True,
+ )
+ for side, direction in [("front", 1), ("back", -1)]:
+ recording.log(
+ f"world/reference/{side}_bezel",
+ rr.Mesh3D(
+ vertex_positions=frame + [0, 0, direction * 0.002], triangle_indices=faces, albedo_factor=[30, 33, 39]
+ ),
+ static=True,
+ )
+ entity = "world/reference/screen"
+ recording.log(entity, rr.TransformAxes3D(0, show_frame=False), static=True)
+ recording.log(
+ entity,
+ rr.Transform3D(mat3x3=np.diag([1, -1, -1]), translation=center + [0, 0, card_height]),
+ static=True,
+ )
+ recording.log(
+ entity,
+ rr.Pinhole(
+ focal_length=height,
+ resolution=[width, height],
+ camera_xyz=rr.ViewCoordinates.RDF,
+ image_plane_distance=card_height,
+ line_width=0,
+ ),
+ static=True,
+ )
+ log_video(recording, f"{entity}/video", video, Fraction(source_info["fps"]), source_info["frames"])
+
+
+def log_body(recording, body: dict, fps, check_cancelled) -> None:
+ import rerun as rr
+
+ point_ids = sorted(VISIBLE_KEYPOINT_IDS)
+ recording.log(
+ "world/body/mesh",
+ rr.Mesh3D.from_fields(triangle_indices=body["faces"], albedo_factor=[180, 180, 180, 75]),
+ static=True,
+ )
+ recording.log(
+ "world/body/skeleton",
+ rr.LineStrips3D.from_fields(radii=0.008, colors=[color for _, _, _, color, _ in LINKS]),
+ static=True,
+ )
+ recording.log(
+ "world/body/joints",
+ rr.Points3D.from_fields(radii=0.012, colors=[keypoint_color(i) for i in point_ids]),
+ static=True,
+ )
+ for index, vertices in enumerate(body["vertices"]):
+ check_cancelled()
+ recording.set_time("time", duration=index / float(fps))
+ keypoints = body["keypoints"][index]
+ recording.log("world/body/mesh", rr.Mesh3D.from_fields(vertex_positions=vertices))
+ recording.log(
+ "world/body/skeleton", rr.LineStrips3D.from_fields(strips=[keypoints[[a, b]] for _, a, b, _, _ in LINKS])
+ )
+ recording.log("world/body/joints", rr.Points3D.from_fields(positions=keypoints[point_ids]))
diff --git a/fdanyone/space/settings.py b/fdanyone/space/settings.py
new file mode 100644
index 0000000..1ae48bd
--- /dev/null
+++ b/fdanyone/space/settings.py
@@ -0,0 +1,71 @@
+"""Normalize Space arguments through the CLI contract."""
+
+from __future__ import annotations
+
+import inspect
+import math
+from pathlib import Path
+
+from fdanyone.errors import ConfigurationError
+from fdanyone.views import resolve_view_plan
+
+
+def complete_options(options: dict) -> dict:
+ from inference import inference
+
+ defaults = {
+ name: parameter.default
+ for name, parameter in inspect.signature(inference).parameters.items()
+ if parameter.default is not inspect.Parameter.empty
+ }
+ return {**defaults, **options}
+
+
+def validate_options(options: dict) -> None:
+ """Apply the CLI camera grouping and clip contracts before submission."""
+
+ from fdanyone.video import validate_clip_options
+
+ options = complete_options(options)
+ resolve_view_plan(
+ **{
+ key: options[key]
+ for key in (
+ "views_per_layer",
+ "layer_pitches",
+ "start_yaw",
+ "yaw_span",
+ "views_per_group",
+ "enable_rcp",
+ "enable_tcr",
+ )
+ }
+ )
+ fps = options["target_fps"]
+ validate_clip_options(start_time=options["start_time"], fps=None if str(fps).lower() == "auto" else fps)
+
+
+def make_options(video, views, pitches, start_yaw, yaw_span, turbo, start_time) -> dict:
+ """Translate the editable Space form into the CLI's inference arguments."""
+ from fdanyone.video import validate_clip_options
+
+ if not video or not Path(video).is_file():
+ raise ConfigurationError("The source video is unavailable. Check --video_path.")
+ validate_clip_options(start_time=start_time, fps=None)
+ return {
+ "video_path": str(Path(video).resolve()),
+ **layout_options(views, pitches, start_yaw, yaw_span),
+ "enable_turbo": bool(turbo),
+ "start_time": float(start_time),
+ }
+
+
+def layout_options(views, pitches, start_yaw, yaw_span) -> dict:
+ values = {"views_per_layer": views, "start_yaw": start_yaw, "yaw_span": yaw_span}
+ for name, value in values.items():
+ if value is None or not math.isfinite(float(value)) or int(value) != float(value):
+ raise ConfigurationError(f"{name} must be an integer.")
+ values = {name: int(value) for name, value in values.items()}
+ values["layer_pitches"] = pitches
+ resolve_view_plan(**values)
+ return values
diff --git a/fdanyone/space/source.py b/fdanyone/space/source.py
new file mode 100644
index 0000000..ea2627b
--- /dev/null
+++ b/fdanyone/space/source.py
@@ -0,0 +1,260 @@
+"""Read clip timing and prepare native-resolution synchronized source previews."""
+
+from __future__ import annotations
+
+import hashlib
+import json
+import uuid
+from dataclasses import dataclass
+from fractions import Fraction
+from pathlib import Path
+
+import av
+
+from fdanyone.config import INFERENCE
+from fdanyone.errors import ConfigurationError, FourDAnyoneError
+from fdanyone.video import _decode_frames, _rotation_degrees, _stream_rate, choose_canonical_fps, validate_clip_options
+
+
+def _remux_source(source, destination, *, fps, indices, start_time, check_cancelled):
+ """Keep the compressed frames when the entire input already matches the clip."""
+
+ if start_time or (indices is not None and list(indices) != list(range(INFERENCE.num_frames))):
+ return None
+ with av.open(str(source)) as container:
+ video = container.streams.video[0]
+ rate = Fraction(fps or choose_canonical_fps(_stream_rate(video)))
+ codec = video.codec_context
+ if (
+ codec.name != "h264"
+ or codec.format is None
+ or codec.format.name != "yuv420p"
+ or video.frames != INFERENCE.num_frames
+ or _stream_rate(video) != rate
+ or _rotation_degrees(video)
+ or video.width % 2
+ or video.height % 2
+ ):
+ return None
+ timestamps = []
+ with av.open(str(destination), "w", options={"movflags": "+faststart"}) as output:
+ stream = output.add_stream_from_template(video)
+ for packet in container.demux(video):
+ check_cancelled()
+ if not packet.size:
+ continue
+ if (
+ packet.pts is None
+ or packet.dts is None
+ or (not timestamps and not packet.is_keyframe)
+ or packet.duration * packet.time_base != 1 / rate
+ ):
+ return None
+ timestamps.append(packet.pts * packet.time_base)
+ if len(timestamps) > INFERENCE.num_frames:
+ return None
+ packet.stream = stream
+ output.mux(packet)
+ if sorted(timestamps) != [index / rate for index in range(INFERENCE.num_frames)]:
+ return None
+ return {
+ "width": video.width,
+ "height": video.height,
+ "frames": INFERENCE.num_frames,
+ "fps": str(rate),
+ "source_indices": list(range(INFERENCE.num_frames)),
+ }
+
+
+def prepare_source(
+ source: Path, cache_dir: Path, *, fps=None, indices=None, start_time=0.0, check_cancelled=lambda: None
+):
+ """Share source media across input, motion and result previews with the same timeline."""
+
+ check_cancelled()
+ source = source.resolve()
+ if fps is None:
+ with av.open(str(source)) as container:
+ fps = choose_canonical_fps(_stream_rate(container.streams.video[0]))
+ fps = Fraction(fps)
+ stat = source.stat()
+ identity = [1, str(source), stat.st_size, stat.st_mtime_ns, float(start_time), str(fps)]
+ key = hashlib.sha256(json.dumps(identity).encode()).hexdigest()[:24]
+ destination = cache_dir / "sources" / key / "source.mp4"
+ if indices is not None:
+ indices = [int(index) for index in indices]
+ info_path = destination.with_suffix(".json")
+ if destination.is_file() and info_path.is_file():
+ info = json.loads(info_path.read_text())
+ if indices is None or info["source_indices"] == indices:
+ return {**info, "path": str(destination)}
+ if indices is not None:
+ # A saved motion can use a different sampling timeline. Keep both files
+ # immutable so an open input preview continues to use its own frames.
+ timeline = hashlib.sha256(json.dumps(indices).encode()).hexdigest()[:24]
+ destination = destination.with_name(f"{timeline}.mp4")
+ info = encode_source(
+ source, destination, fps=fps, indices=indices, start_time=start_time, check_cancelled=check_cancelled
+ )
+ return {**info, "path": str(destination)}
+
+
+def encode_source(
+ source: Path,
+ destination: Path,
+ *,
+ fps=None,
+ indices=None,
+ start_time=0.0,
+ check_cancelled=lambda: None,
+) -> dict:
+ """Reuse matching compressed frames or resample with two decoded frames in memory."""
+
+ info_path = destination.with_suffix(".json")
+ if destination.is_file() and info_path.is_file():
+ return json.loads(info_path.read_text())
+ temporary = destination.with_name(f".{uuid.uuid4().hex}.mp4")
+ destination.parent.mkdir(parents=True, exist_ok=True)
+ try:
+ info = _remux_source(
+ source, temporary, fps=fps, indices=indices, start_time=start_time, check_cancelled=check_cancelled
+ )
+ if info is not None:
+ temporary.replace(destination)
+ info_path.write_text(json.dumps(info) + "\n")
+ return info
+ with (
+ av.open(str(source)) as container,
+ av.open(str(temporary), "w", options={"movflags": "+faststart"}) as output,
+ ):
+ video = container.streams.video[0]
+ fps = fps or choose_canonical_fps(_stream_rate(video))
+ frames = iter(_decode_frames(container, video, _rotation_degrees(video)))
+ previous = next(frames)
+ height, width = previous.rgb.shape[:2]
+ size = max(2, round(width / 2) * 2), max(2, round(height / 2) * 2)
+ stream = output.add_stream("libx264", rate=fps)
+ stream.width, stream.height = size
+ stream.pix_fmt = "yuv420p"
+ stream.codec_context.max_b_frames = 0
+ stream.codec_context.gop_size = max(1, round(fps))
+ stream.options = {"crf": "18", "preset": "veryfast"}
+ count = 0
+ source_indices = []
+
+ def write(frame):
+ nonlocal count
+ check_cancelled()
+ resized = av.VideoFrame.from_ndarray(frame.rgb, format="rgb24").reformat(
+ width=size[0], height=size[1], format="yuv420p"
+ )
+ resized.pts = count
+ resized.time_base = 1 / fps
+ for packet in stream.encode(resized):
+ output.mux(packet)
+ source_indices.append(frame.index)
+ count += 1
+
+ if indices is not None:
+ indices = list(indices)
+ current = previous
+ while count < len(indices):
+ check_cancelled()
+ if current.index == indices[count]:
+ write(current)
+ elif current.index < indices[count]:
+ current = next(frames)
+ else:
+ raise FourDAnyoneError("The source video does not match the saved motion timeline.")
+ else:
+ origin = float(previous.timestamp) + start_time
+ current = previous
+ for current in frames:
+ check_cancelled()
+ while count < INFERENCE.num_frames and origin + count / float(fps) <= float(current.timestamp):
+ target = origin + count / float(fps)
+ write(
+ previous
+ if abs(float(previous.timestamp) - target) <= abs(float(current.timestamp) - target)
+ else current
+ )
+ if count == INFERENCE.num_frames:
+ break
+ previous = current
+ if count < INFERENCE.num_frames and abs(
+ float(current.timestamp) - (origin + count / float(fps))
+ ) <= 0.75 / float(fps):
+ write(current)
+ if not count:
+ raise FourDAnyoneError("No source frames are available after Clip Start.")
+ for packet in stream.encode():
+ output.mux(packet)
+ info = {
+ "width": size[0],
+ "height": size[1],
+ "frames": count,
+ "fps": str(fps),
+ "source_indices": source_indices,
+ }
+ temporary.replace(destination)
+ info_path.write_text(json.dumps(info) + "\n")
+ return info
+ except (StopIteration, IndexError) as exc:
+ raise FourDAnyoneError("The original source clip is missing required frames.") from exc
+ finally:
+ temporary.unlink(missing_ok=True)
+
+
+@dataclass(frozen=True)
+class ClipTiming:
+ source_fps: Fraction
+ duration: Fraction | None
+
+ @classmethod
+ def read(cls, path: Path | None):
+ """Read the selected video's header once, without decoding its frames."""
+ if path is None:
+ return None
+ try:
+ with av.open(str(path)) as container:
+ stream = container.streams.video[0]
+ rate = stream.average_rate or stream.guessed_rate or stream.base_rate
+ if rate is None or rate <= 0:
+ return None
+ duration = stream.duration * stream.time_base if stream.duration is not None else None
+ if duration is None and stream.frames:
+ duration = Fraction(stream.frames) / rate
+ if duration is None and container.duration is not None:
+ duration = Fraction(container.duration, av.time_base)
+ return cls(Fraction(rate), Fraction(duration) if duration is not None else None)
+ except (OSError, ValueError, IndexError):
+ return None
+
+ def start_max(self, target_fps) -> float:
+ rate = validate_clip_options(
+ start_time=0, fps=None if str(target_fps).strip().lower() == "auto" else target_fps
+ ) or choose_canonical_fps(self.source_fps)
+ if self.duration is None:
+ return 0.0
+ # The last frame's timestamp precedes the container's end by one source
+ # frame. Round down so the slider endpoint still contains all 121 frames.
+ last = self.duration - 1 / self.source_fps
+ maximum = max(Fraction(0), last - Fraction(INFERENCE.num_frames - 1) / rate)
+ return float(maximum * 100 // 1) / 100
+
+
+def probe_input(video: Path, start_time: float, target_fps="auto") -> None:
+ """Reject unreadable or short clips before queuing GPU work."""
+ rate = validate_clip_options(
+ start_time=start_time,
+ fps=None if str(target_fps).lower() == "auto" else target_fps,
+ )
+ timing = ClipTiming.read(video)
+ if timing is None:
+ raise ConfigurationError("Cannot read the source video's frame rate.")
+ needed = (INFERENCE.num_frames - 1) / float(rate or choose_canonical_fps(timing.source_fps))
+ if timing.duration is not None and float(timing.duration) - start_time <= needed:
+ raise ConfigurationError(
+ f"Need 121 frames after the selected start, about {needed:.2f} seconds. "
+ "Choose an earlier start or a longer video."
+ )
diff --git a/fdanyone/space/task.py b/fdanyone/space/task.py
new file mode 100644
index 0000000..19c58cd
--- /dev/null
+++ b/fdanyone/space/task.py
@@ -0,0 +1,136 @@
+"""One output directory, its saved CLI request and original source identity."""
+
+from __future__ import annotations
+
+import hashlib
+import json
+import os
+import re
+import uuid
+from contextlib import suppress
+from dataclasses import dataclass
+from datetime import datetime
+from pathlib import Path
+
+from fdanyone.download import ensure_example_video
+from fdanyone.errors import ConfigurationError, FourDAnyoneError
+from fdanyone.io import resolve_output_path, sha256_file, write_json
+from fdanyone.run_request import REQUEST_FILE, read_run_request
+from fdanyone.space.settings import complete_options, validate_options
+from fdanyone.space.viewer import read_result
+
+REPOSITORY = Path(__file__).resolve().parents[2]
+
+
+@dataclass(frozen=True)
+class SpaceConfig:
+ output_dir: Path
+ cache_dir: Path
+ model_dir: Path
+ gvhmr_root: Path
+ gpu_ids: tuple[int, ...] | None = None
+ attention_backend: str = "auto"
+ video_path: Path | None = None
+
+
+def repository_path(value: str | Path) -> Path:
+ path = Path(value).expanduser()
+ return Path(os.path.abspath(path if path.is_absolute() else REPOSITORY / path))
+
+
+def path_label(value: str | Path) -> str:
+ path = repository_path(value)
+ return str(path.relative_to(REPOSITORY)) if path.is_relative_to(REPOSITORY) else str(path)
+
+
+def saved_request(directory: Path) -> dict:
+ request = read_run_request(directory)
+ if request is None:
+ raise ConfigurationError(f"No saved 4DAnyone task: {directory}. A {REQUEST_FILE} file is required.")
+ return request
+
+
+def ensure_new_output(directory: Path) -> None:
+ if directory.is_symlink() or directory.exists() and (not directory.is_dir() or any(directory.iterdir())):
+ raise ConfigurationError(
+ f"Output directory is not empty: {directory}. Choose a new --output_dir, "
+ "or omit --video_path to open the saved task."
+ )
+
+
+def resolve_task(video_path: str | Path | None, output_dir: str | Path | None) -> tuple[Path | None, Path]:
+ if video_path is None and output_dir is None:
+ raise ConfigurationError("Provide --video_path for a new task, or --output_dir to open a saved task.")
+ source = repository_path(video_path).resolve() if video_path is not None else None
+ if output_dir is None:
+ stem = re.sub(r"[^\w-]", "_", source.stem)[:60] or "clip"
+ output_dir = Path("data/fdanyone") / stem / f"{datetime.now():%Y%m%d-%H%M%S}-{uuid.uuid4().hex[:6]}"
+ destination = resolve_output_path(repository_path(output_dir))
+ if source is not None:
+ ensure_new_output(destination)
+ ensure_example_video(source)
+ else:
+ saved_request(destination)
+ return source, destination
+
+
+def source_matches(source: Path, identity: dict, cache_dir: Path) -> bool:
+ """Use the saved content hash and the motion cache's exact source clock."""
+ try:
+ stat = source.stat()
+ if (stat.st_size, stat.st_mtime_ns) != (identity["size_bytes"], identity["mtime_ns"]):
+ return False
+ key = hashlib.sha256(f"{source.resolve()}:{stat.st_size}:{stat.st_mtime_ns}".encode()).hexdigest()
+ cached = cache_dir / "identities" / f"{key}.json"
+ with suppress(OSError, ValueError, KeyError):
+ return json.loads(cached.read_text())["sha256"] == identity["sha256"]
+ digest = sha256_file(source)
+ if source.stat().st_mtime_ns != stat.st_mtime_ns:
+ return False
+ write_json(cached, {"sha256": digest})
+ return digest == identity["sha256"]
+ except (OSError, KeyError):
+ return False
+
+
+@dataclass(frozen=True)
+class SavedTask:
+ directory: Path
+ options: dict
+ source: Path | None
+ complete: bool
+ error: str = ""
+ log_dir: Path | None = None
+
+ @property
+ def resumable(self) -> bool:
+ return not self.complete and not self.error and self.source is not None
+
+
+def read_task(directory: Path, cache_dir: Path) -> SavedTask:
+ request = saved_request(directory)
+ try:
+ options = complete_options(request["options"])
+ validate_options(options)
+ source = Path(options["video_path"])
+ except (ValueError, TypeError, KeyError) as exc:
+ raise ConfigurationError(f"Invalid saved inference settings in {directory}.") from exc
+ if not source_matches(source, request["source"], cache_dir):
+ source = None
+ complete, error = False, ""
+ try:
+ read_result(directory)
+ complete = True
+ except (FourDAnyoneError, OSError, ValueError) as exc:
+ # An absent metadata file means the CLI has not published a result yet.
+ # An invalid published result requires repair, not another inference run.
+ if (directory / "metadata.json").exists():
+ error = str(exc)
+ return SavedTask(
+ directory,
+ options,
+ source,
+ complete,
+ error,
+ Path(request["space_job"]) if request.get("space_job") else None,
+ )
diff --git a/fdanyone/space/theme.py b/fdanyone/space/theme.py
new file mode 100644
index 0000000..050a41f
--- /dev/null
+++ b/fdanyone/space/theme.py
@@ -0,0 +1,106 @@
+"""Use the project page's black surfaces, fine borders and quiet pill buttons."""
+
+import base64
+from pathlib import Path
+
+import gradio as gr
+
+from fdanyone.skeleton.keypoints import RED
+
+COLORS = {
+ "body_background_fill": "#000000",
+ "body_text_color": "#F5F5F7",
+ "body_text_color_subdued": "#8E8E93",
+ "background_fill_primary": "#121214",
+ "background_fill_secondary": "#1D1D1F",
+ "block_background_fill": "#121214",
+ "block_border_color": "#424245",
+ "block_label_background_fill": "transparent",
+ "block_label_text_color": "#8E8E93",
+ "block_title_text_color": "#F5F5F7",
+ "block_info_text_color": "#8E8E93",
+ "panel_background_fill": "#121214",
+ "panel_border_color": "#424245",
+ "border_color_primary": "#424245",
+ "border_color_accent": "#55555A",
+ "border_color_accent_subdued": "#424245",
+ "color_accent_soft": "#1D1D1F",
+ "input_background_fill": "#1D1D1F",
+ "input_background_fill_focus": "#1D1D1F",
+ "input_background_fill_hover": "#2A2A2D",
+ "input_border_color": "#424245",
+ "input_border_color_focus": "#3274D8",
+ "input_border_color_hover": "#55555A",
+ "input_placeholder_color": "#76767B",
+ "checkbox_background_color": "#1D1D1F",
+ "checkbox_background_color_selected": "#3274D8",
+ "checkbox_border_color": "#55555A",
+ "checkbox_border_color_selected": "#3274D8",
+ "checkbox_label_background_fill": "#1D1D1F",
+ "checkbox_label_background_fill_hover": "#2A2A2D",
+ "checkbox_label_background_fill_selected": "#2A2A2D",
+ "checkbox_label_border_color": "#424245",
+ "checkbox_label_border_color_selected": "#3274D8",
+ "checkbox_label_text_color": "#F5F5F7",
+ "checkbox_label_text_color_selected": "#F5F5F7",
+ "link_text_color": "#3274D8",
+ "link_text_color_hover": "#4685E3",
+ "slider_color": "#3274D8",
+ "loader_color": "#3274D8",
+ "accordion_text_color": "#F5F5F7",
+ "error_background_fill": "#1D1D1F",
+ "error_text_color": "#F5F5F7",
+ "error_border_color": "#55555A",
+}
+for variant in ("primary", "secondary", "cancel"):
+ COLORS.update(
+ {
+ f"button_{variant}_background_fill": "#1D1D1F",
+ f"button_{variant}_background_fill_hover": "#2A2A2D",
+ f"button_{variant}_border_color": "#424245",
+ f"button_{variant}_border_color_hover": "#55555A",
+ f"button_{variant}_text_color": "#F5F5F7",
+ f"button_{variant}_text_color_hover": "#F5F5F7",
+ f"button_{variant}_shadow": "none",
+ f"button_{variant}_shadow_hover": "none",
+ f"button_{variant}_shadow_active": "none",
+ }
+ )
+
+THEME = gr.themes.Base(font=["Lato", "system-ui", "sans-serif"]).set(
+ **COLORS,
+ **{f"{key}_dark": value for key, value in COLORS.items()},
+ color_accent="#3274D8",
+ block_shadow="none",
+ block_shadow_dark="none",
+ input_shadow="none",
+ input_shadow_dark="none",
+ block_radius="12px",
+ input_radius="8px",
+ button_border_width="1px",
+ button_border_width_dark="1px",
+ checkbox_label_border_width="1px",
+ checkbox_label_border_width_dark="1px",
+ button_large_radius="999px",
+ button_medium_radius="999px",
+ button_small_radius="999px",
+ button_large_text_weight="400",
+ button_medium_text_weight="400",
+ button_small_text_weight="400",
+ button_transform_hover="none",
+ button_transform_active="none",
+ block_title_text_weight="400",
+ layout_gap="16px",
+)
+
+# Embed the project's small font files so localhost use needs no font CDN or extra route.
+_assets = Path(__file__).with_name("assets")
+_fonts = (_assets / "fonts.css").read_text()
+for _path in _assets.glob("*.woff2"):
+ _encoded = base64.b64encode(_path.read_bytes()).decode("ascii")
+ _fonts = _fonts.replace(f"../fonts/{_path.name}", f"data:font/woff2;base64,{_encoded}")
+CSS = (
+ _fonts
+ + f".gradio-container {{ --space-red: rgb{RED}; }}\n"
+ + "".join((_assets / name).read_text() for name in ("workbench.css", "display.css", "monitor.css"))
+)
diff --git a/fdanyone/space/ui.py b/fdanyone/space/ui.py
new file mode 100644
index 0000000..42a0a0b
--- /dev/null
+++ b/fdanyone/space/ui.py
@@ -0,0 +1,360 @@
+"""Single-task page: render controls, submit work and collect independent previews."""
+
+from __future__ import annotations
+
+import html
+from concurrent.futures import CancelledError
+from dataclasses import dataclass
+from pathlib import Path
+
+import gradio as gr
+
+from fdanyone.errors import FourDAnyoneError
+from fdanyone.space.display import DISPLAY_HTML, DISPLAY_JS
+from fdanyone.space.form import InferenceForm
+from fdanyone.space.help import HELP_JS, option_label
+from fdanyone.space.jobs import FINISHED, JobManager
+from fdanyone.space.monitor import MONITOR_HTML, MONITOR_JS, preparing_monitor
+from fdanyone.space.previews import motion_available, prepare_preview
+from fdanyone.space.task import path_label
+from fdanyone.space.viewer import export_layout_update, scene_info
+from fdanyone.space.web_assets import display_payload, prepare_web_assets
+
+ERRORS = (FourDAnyoneError, OSError, ValueError, TypeError, KeyError)
+ASSETS = Path(__file__).with_name("assets")
+
+
+@dataclass
+class Session:
+ """One tab's observation and pending preview; inference belongs to JobManager."""
+
+ signature: list | None = None
+ preview: str | None = None
+ scene: dict | None = None
+ motion_requested: bool = False
+ submitting: bool = False
+ console: str | None = None
+
+
+def build_space(manager: JobManager) -> gr.Blocks:
+ config = manager.config
+ form = InferenceForm(config)
+ assets = prepare_web_assets(config.cache_dir)
+ with gr.Blocks(title="4DAnyone Space", analytics_enabled=False) as space:
+ session = gr.State(Session())
+ timer = gr.Timer(1)
+ with gr.Row(elem_id="space-workspace"):
+ viewer = gr.HTML(
+ value=None,
+ assets=assets,
+ html_template=DISPLAY_HTML,
+ js_on_load=DISPLAY_JS,
+ apply_default_css=False,
+ elem_id="space-viewer",
+ )
+ with gr.Column(min_width=0, elem_id="space-sidebar"):
+ gr.Markdown("# 4DAnyone Space", elem_id="space-heading")
+ with gr.Column(min_width=0, elem_id="task-panel"):
+ gr.Markdown("### Data", elem_id="data-heading")
+ task_info = gr.HTML("", js_on_load=HELP_JS, elem_id="task-info")
+ form.clip_control()
+ with (
+ gr.Column(min_width=0, elem_id="space-controls"),
+ gr.Column(min_width=0, elem_id="parameters-scroll"),
+ ):
+ form.parameters()
+ with gr.Column(min_width=0, elem_id="execution-area"):
+ scene_status = gr.Markdown("", elem_id="scene-status")
+ status = gr.Markdown("", elem_id="run-status")
+ run_monitor = gr.HTML(
+ value=None,
+ html_template=MONITOR_HTML,
+ js_on_load=MONITOR_JS,
+ apply_default_css=False,
+ elem_id="run-monitor",
+ )
+ with gr.Row(elem_id="run-actions"):
+ run = gr.Button(
+ "Run Inference",
+ variant="primary",
+ interactive=False,
+ min_width=0,
+ elem_id="run-inference",
+ )
+ stop = gr.Button(
+ "Stop",
+ interactive=False,
+ visible=False,
+ elem_id="stop-inference",
+ min_width=60,
+ scale=0,
+ )
+ delete = gr.HTML(
+ value=None,
+ html_template=(ASSETS / "delete.html").read_text(),
+ js_on_load=(ASSETS / "delete.js").read_text(),
+ apply_default_css=False,
+ visible=False,
+ min_width=0,
+ scale=0,
+ elem_id="delete-output",
+ )
+ log_download = gr.DownloadButton("Run Log", visible=False, size="sm", min_width=0)
+
+ outputs = [
+ session,
+ timer,
+ task_info,
+ run,
+ stop,
+ delete,
+ status,
+ run_monitor,
+ log_download,
+ scene_status,
+ viewer,
+ *form.outputs,
+ ]
+
+ def skip():
+ return {component: gr.skip() for component in outputs}
+
+ def controls(record, values):
+ job = manager.current_job()
+ active = job is not None and job.state not in FINISHED
+ action = "Inference Running" if active else "Run Inference"
+ if not active and record:
+ action = "Completed" if record.complete else "Resume Inference"
+ source = record.options["video_path"] if record else config.video_path
+ summary = (
+ '<dl class="task-paths">'
+ + "".join(
+ f'<div class="task-path"><dt>{option_label(label)}</dt><dd>'
+ f'<code tabindex="0" aria-label="{label} Path" '
+ f'title="{html.escape(str(path), quote=True)}">'
+ f"{html.escape(path_label(path))}</code></dd></div>"
+ for label, path in [("Source", source), ("Output", config.output_dir)]
+ )
+ + "</dl>"
+ )
+ return {
+ **form.update(record, values),
+ task_info: summary,
+ run: gr.update(
+ value=action, interactive=not active and bool(record.resumable if record else source.is_file())
+ ),
+ stop: gr.update(value="Stop", interactive=active, visible=active),
+ delete: gr.update(
+ value={"key": manager.deletion_key(), "output": path_label(config.output_dir)}
+ if record and not record.complete and not active
+ else None,
+ visible=bool(record and not record.complete and not active),
+ ),
+ }
+
+ def show_recording(tab, path):
+ tab.scene = info = scene_info(path)
+ return {
+ session: tab,
+ viewer: display_payload(path, info),
+ scene_status: "",
+ timer: gr.update(active=not info["target_count"]),
+ }
+
+ def show_monitor(tab, payload):
+ if payload is None:
+ tab.console = None
+ return {session: tab, run_monitor: None}
+ previous, tab.console = tab.console, payload["log"]
+ if tab.console == previous:
+ payload = {key: value for key, value in payload.items() if key != "log"}
+ return {session: tab, run_monitor: payload}
+
+ def request_preview(tab, record, values):
+ tab.motion_requested = record is not None and motion_available(config.output_dir)
+ tab.preview = manager.previews.submit(
+ tab.preview,
+ prepare_preview,
+ config,
+ record,
+ form.layout(values, editable=record is None),
+ values["start_time"],
+ tab.motion_requested,
+ )
+ return {
+ session: tab,
+ scene_status: "Preparing Preview…",
+ timer: gr.update(active=True),
+ }
+
+ def initialize(tab):
+ record = manager.record()
+ values = form.values(record)
+ tab.signature = manager.signature()
+ return {
+ **controls(record, values),
+ **show_monitor(tab, manager.monitor(record)),
+ **request_preview(tab, record, values),
+ }
+
+ def reset_task(tab):
+ tab.scene = None
+ return {
+ **initialize(tab),
+ viewer: None,
+ status: "",
+ log_download: gr.update(value=None, visible=False),
+ }
+
+ def delete_run(confirmation, tab, *raw_values):
+ try:
+ manager.delete_output(confirmation["key"])
+ return reset_task(tab)
+ except ERRORS as exc:
+ record = manager.record()
+ return {
+ **controls(record, form.values(record) if record else form.decode(raw_values)),
+ status: f"Cannot Delete Output: {html.escape(str(exc))}",
+ }
+
+ def start_run(tab, *raw_values):
+ values = form.decode(raw_values)
+ tab.submitting = True
+ try:
+ yield {
+ **form.field_updates(values, interactive=False),
+ run: gr.update(value="Starting Inference", interactive=False),
+ delete: gr.update(value=None, visible=False),
+ **show_monitor(tab, preparing_monitor()),
+ status: "",
+ }
+ # Every tab resumes the saved request; editable browser values
+ # can only create the first request for this output directory.
+ record = manager.record()
+ job = manager.resume() if record else manager.submit(form.options(values))
+ record = manager.record()
+ tab.signature = None
+ updates = {
+ **controls(record, form.values(record)),
+ **show_monitor(tab, manager.snapshot(job.token)["monitor"]),
+ status: "",
+ log_download: gr.update(visible=False),
+ }
+ except (*ERRORS, ImportError) as exc:
+ record = manager.record()
+ updates = {
+ **controls(record, form.values(record) if record else values),
+ **show_monitor(tab, manager.monitor(record)),
+ status: f"Cannot Start: {html.escape(str(exc))}",
+ }
+ finally:
+ tab.submitting = False
+ yield updates
+
+ def change_layout(tab, *raw_values):
+ if manager.record():
+ return skip()
+ values = form.decode(raw_values)
+ try:
+ layout = form.layout(values, editable=True)
+ if tab.scene is None or tab.preview:
+ return request_preview(tab, None, values)
+ path, tab.scene = export_layout_update(tab.scene, config.cache_dir / "viewer", layout)
+ return {session: tab, viewer: display_payload(path, tab.scene, layout_only=True), scene_status: ""}
+ except ERRORS as exc:
+ return {scene_status: f"Camera Layout: {html.escape(str(exc))}"}
+
+ def change_start(tab, *raw_values):
+ if manager.record():
+ return skip()
+ values = form.decode(raw_values)
+ try:
+ selected = float(values["start_time"])
+ values["start_time"] = min(max(0, selected), form.start_max)
+ updates = request_preview(tab, None, values)
+ # Valid slider values already live in the browser. Echoing a
+ # delayed callback could replace a newer selection.
+ if selected != values["start_time"]:
+ field = form.fields["start_time"]
+ updates[field] = form.field_updates(values, interactive=True)[field]
+ return updates
+ except ERRORS as exc:
+ return {scene_status: f"Clip Start: {html.escape(str(exc))}"}
+
+ def follow_task(tab, *raw_values):
+ with manager.lock:
+ if tab.submitting:
+ return skip()
+ updates = {session: tab}
+ job = manager.current_job()
+ signature = manager.signature()
+ if job is None and tab.signature != signature:
+ return reset_task(tab)
+ if job and (job.state not in FINISHED or signature != tab.signature):
+ snapshot = manager.snapshot(job.token)
+ updates.update(show_monitor(tab, snapshot["monitor"]))
+ if signature != tab.signature:
+ record = manager.record()
+ updates.update(controls(record, form.values(record) if record else form.decode(raw_values)))
+ tab.signature = signature
+ if snapshot["state"] in FINISHED:
+ updates[status] = ""
+ if snapshot["state"] == "failed" and (job.directory / "inference.log").is_file():
+ updates[log_download] = gr.update(
+ value=str(job.directory / "inference.log"), visible=True
+ )
+ manager.previews.discard(tab.preview)
+ tab.preview = None
+ if record:
+ updates.update(request_preview(tab, record, form.values(record)))
+ if (
+ snapshot["state"] == "running"
+ and not tab.motion_requested
+ and motion_available(config.output_dir)
+ ):
+ record = manager.record()
+ updates.update(request_preview(tab, record, form.values(record)))
+ try:
+ ready = manager.previews.take(tab.preview)
+ if ready:
+ updates.update(show_recording(tab, ready))
+ tab.preview = None
+ except CancelledError:
+ tab.preview = None
+ except Exception as exc:
+ tab.preview = None
+ updates[scene_status] = f"Preview Unavailable: {html.escape(str(exc))}"
+ return updates
+
+ def cancel_run():
+ job = manager.current_job()
+ message = manager.cancel(job.token if job else None)
+ return {status: message, stop: gr.update(value="Stopping…", interactive=False)}
+
+ events = dict(outputs=outputs, concurrency_id="space-controls", concurrency_limit=1, show_progress="hidden")
+ space.load(initialize, session, **events)
+ gr.on(
+ [form.fields[name].input for name in ("views_per_layer", "layer_pitches", "start_yaw", "yaw_span")],
+ change_layout,
+ [session, *form.inputs],
+ trigger_mode="always_last",
+ **events,
+ )
+ form.fields["start_time"].input(
+ change_start,
+ [session, *form.inputs],
+ trigger_mode="always_last",
+ **events,
+ )
+ run.click(start_run, [session, *form.inputs], api_name="run", **events)
+ stop.click(cancel_run, outputs=outputs, queue=False, api_name="stop")
+ delete.click(delete_run, [delete, session, *form.inputs], api_name=False, **events)
+ timer.tick(
+ follow_task,
+ [session, *form.inputs],
+ outputs=outputs,
+ queue=False,
+ show_progress="hidden",
+ api_name=False,
+ )
+ return space
diff --git a/fdanyone/space/viewer.py b/fdanyone/space/viewer.py
new file mode 100644
index 0000000..005ee99
--- /dev/null
+++ b/fdanyone/space/viewer.py
@@ -0,0 +1,437 @@
+"""A synchronized body, source overlay and complete target-video scene."""
+
+from __future__ import annotations
+
+import hashlib
+import json
+import shutil
+import threading
+import uuid
+from collections.abc import Callable
+from concurrent.futures import CancelledError, ThreadPoolExecutor
+from dataclasses import dataclass
+from fractions import Fraction
+from pathlib import Path
+
+import av
+import numpy as np
+
+from fdanyone.config import FRAMING
+from fdanyone.errors import FourDAnyoneError
+from fdanyone.geometry.cameras import camera_grid, reference_intrinsics
+from fdanyone.output_directory import read_output_metadata
+from fdanyone.space import scene
+
+_EXPORT_LOCK = threading.Lock()
+RECORDING_VERSION = 17
+
+
+@dataclass(frozen=True)
+class Result:
+ directory: Path
+ metadata: dict
+ cameras: tuple[dict, ...]
+ videos: tuple[Path, ...]
+ fps: Fraction
+ frames: int
+
+
+def _contained_file(root: Path, relative: str) -> Path:
+ path = root / relative
+ if not path.is_file() or not path.resolve().is_relative_to(root):
+ raise FourDAnyoneError(f"Missing or external result file: {relative}")
+ return path
+
+
+def read_result(directory: str | Path) -> Result:
+ root = Path(directory).expanduser().resolve()
+ _contained_file(root, "metadata.json")
+ metadata = read_output_metadata(root)
+ try:
+ rig = json.loads(_contained_file(root, "cameras.json").read_text())
+ cameras = rig["cameras"]
+ if rig.get("camera_model") != "OPENCV" or not isinstance(cameras, list) or not cameras:
+ raise ValueError("Expected a nonempty OPENCV camera rig")
+ if rig["world_frame"]["name"] != "canonical_human_world" or rig["camera_frame"]["name"] != "opencv_camera":
+ raise ValueError("Unsupported camera coordinate system")
+ if [camera["camera_id"] for camera in cameras] != list(range(len(cameras))):
+ raise ValueError("Cameras must be ordered by camera ID")
+ fps = Fraction(metadata["output"]["fps"])
+ frames = int(metadata["output"]["frames_per_video"])
+ if fps <= 0 or frames != 121 or metadata["output"]["target_views"] != len(cameras):
+ raise ValueError("Output does not describe synchronized 121-frame videos")
+ videos = []
+ for camera in cameras:
+ camera_id = camera["camera_id"]
+ relative = f"videos/dense/{camera_id:02d}.mp4"
+ if camera["video"] != relative:
+ raise ValueError(f"Unexpected video path for camera {camera_id}")
+ intrinsic = np.asarray(camera["K"], dtype=np.float64)
+ transform = np.asarray(camera["camera_to_world"], dtype=np.float64)
+ if (
+ intrinsic.shape != (3, 3)
+ or transform.shape != (4, 4)
+ or not np.isfinite(intrinsic).all()
+ or not np.isfinite(transform).all()
+ or not np.allclose(transform[3], [0, 0, 0, 1])
+ ):
+ raise ValueError(f"Invalid calibration for camera {camera_id}")
+ if min(camera["image_width"], camera["image_height"]) <= 0:
+ raise ValueError("Invalid camera image dimensions")
+ videos.append(_contained_file(root, relative))
+ except (OSError, ValueError, TypeError, KeyError, ZeroDivisionError) as exc:
+ raise FourDAnyoneError(f"Cannot open this 4DAnyone output: {exc}") from exc
+ return Result(root, metadata, tuple(cameras), tuple(videos), fps, frames)
+
+
+def _target_video(result: Result, camera_id: int, destination: Path, check_cancelled: Callable) -> tuple[int, int]:
+ """Keep the generated H.264 bytes, including their native resolution and quality."""
+
+ camera = result.cameras[camera_id]
+ size = camera["image_width"], camera["image_height"]
+ if destination.exists():
+ return size
+ temporary = destination.with_name(f".{destination.stem}-{uuid.uuid4().hex}.mp4")
+ count = 0
+ try:
+ with av.open(str(result.videos[camera_id])) as source:
+ source.streams.video[0].codec_context.thread_count = 2
+ if source.streams.video[0].average_rate != result.fps:
+ raise FourDAnyoneError(f"Camera {camera_id} video FPS does not match its metadata.")
+ for count, frame in enumerate(source.decode(video=0), start=1):
+ check_cancelled()
+ if count > result.frames:
+ raise FourDAnyoneError(f"Camera {camera_id} has more than {result.frames} frames.")
+ if (frame.width, frame.height) != (camera["image_width"], camera["image_height"]):
+ raise FourDAnyoneError(f"Camera {camera_id} video dimensions do not match its calibration.")
+ if count != result.frames:
+ raise FourDAnyoneError(f"Camera {camera_id} has {count} frames; expected {result.frames}.")
+ check_cancelled()
+ shutil.copyfile(result.videos[camera_id], temporary)
+ temporary.replace(destination)
+ finally:
+ temporary.unlink(missing_ok=True)
+ return size
+
+
+def _prepare_targets(result: Result, media: Path, check_cancelled: Callable) -> dict:
+ stopped = threading.Event()
+
+ def check():
+ check_cancelled()
+ if stopped.is_set():
+ raise CancelledError
+
+ def prepare(index):
+ check()
+ return _target_video(result, index, media / f"{index:02d}.mp4", check)
+
+ with ThreadPoolExecutor(max_workers=min(4, len(result.videos)), thread_name_prefix="space-video") as pool:
+ futures = [pool.submit(prepare, index) for index in range(len(result.videos))]
+ try:
+ return {index: future.result() for index, future in enumerate(futures)}
+ finally:
+ stopped.set()
+ for future in futures:
+ future.cancel()
+
+
+def scene_info(recording: Path) -> dict:
+ return json.loads(recording.with_suffix(".json").read_text())
+
+
+def _identity(path: Path | None):
+ if path is None or not path.is_file():
+ return None
+ stat = path.stat()
+ return str(path.resolve()), stat.st_size, stat.st_mtime_ns
+
+
+def _cache_key(identity) -> str:
+ return hashlib.sha256(json.dumps(identity, sort_keys=True).encode()).hexdigest()[:24]
+
+
+def _body_identity(motion_dir, model_dir, gvhmr_root):
+ from fdanyone.assets import MHR70_REGRESSOR, SMPLX_MODEL
+
+ if motion_dir is None:
+ return None
+ return [
+ [_identity(motion_dir / name) for name in ("motion.json", "motion.safetensors")],
+ [_identity(model_dir / name) for name in (MHR70_REGRESSOR, SMPLX_MODEL)] if model_dir else None,
+ str(gvhmr_root.resolve()) if gvhmr_root else None,
+ ]
+
+
+def _cached_recording(destination: Path, *, require_body: bool) -> bool:
+ try:
+ # Failed body preparation must remain retryable, including after a
+ # transient failure that did not change any of the input files.
+ if not destination.is_file():
+ return False
+ info = scene_info(destination)
+ return not require_body or info["body_frames"] > 0
+ except (OSError, ValueError, KeyError):
+ return False
+
+
+def _result_context(result: Result) -> dict:
+ framing = result.metadata.get("preprocessing", {}).get("framing", {})
+ radius = framing.get("radius", FRAMING.reference_radius)
+ height = framing.get("target_height", FRAMING.reference_target_height)
+ first = result.cameras[0]
+ transform = np.asarray(first["camera_to_world"])
+ center = transform[:3, 3] + transform[:3, 2] * radius / np.linalg.norm(transform[[0, 2], 2])
+ center[1] = 0
+ return {
+ "center": center.tolist(),
+ "radius": radius,
+ "target_height": height,
+ "K": first["K"],
+ "image_width": first["image_width"],
+ "image_height": first["image_height"],
+ }
+
+
+def layout_cameras(context: dict, layout: dict) -> list[dict]:
+ cameras = camera_grid(
+ center=np.asarray(context["center"]),
+ front_direction=np.array([0, 0, -1]),
+ K=np.asarray(context["K"]),
+ image_height=context["image_height"],
+ image_width=context["image_width"],
+ radius=context["radius"],
+ target_height=context["target_height"],
+ **layout,
+ )
+ return [
+ {
+ "camera_id": c.camera_id,
+ "K": c.K,
+ "camera_to_world": c.camera_to_world,
+ "image_width": c.image_width,
+ "image_height": c.image_height,
+ "yaw": c.yaw_degrees,
+ "pitch": c.pitch_degrees,
+ }
+ for c in cameras
+ ]
+
+
+def _save_recording(destination: Path, info: dict, log_scene) -> Path:
+ import rerun as rr
+
+ temporary = destination.with_name(f".{uuid.uuid4().hex}.rrd")
+ recording = rr.RecordingStream(info["application_id"], recording_id=info["recording_id"])
+ try:
+ recording.save(str(temporary), default_blueprint=scene.blueprint(info["context"], info["target_count"]))
+ recording.log("world", rr.ViewCoordinates.RIGHT_HAND_Y_UP, static=True)
+ scene.log_stage(recording, info["context"])
+ log_scene(recording)
+ recording.flush()
+ recording.disconnect()
+ temporary.replace(destination)
+ destination.with_suffix(".json").write_text(json.dumps(info) + "\n")
+ finally:
+ recording.disconnect()
+ temporary.unlink(missing_ok=True)
+ return destination
+
+
+def _prepare_body(motion_dir, model_dir, gvhmr_root, cache_dir, check_cancelled):
+ from fdanyone.space.body import load_body
+
+ if motion_dir is None:
+ return None, []
+ if model_dir is None or gvhmr_root is None:
+ return None, ["Set the model and GVHMR directories to show the recovered body."]
+ try:
+ return load_body(motion_dir, model_dir, gvhmr_root, cache_dir, check_cancelled), []
+ except (FourDAnyoneError, OSError, ValueError) as exc:
+ return None, [str(exc)]
+
+
+def export_recording(
+ result: Result,
+ cache_dir: Path,
+ *,
+ source: Path | None = None,
+ model_dir: Path | None = None,
+ gvhmr_root: Path | None = None,
+ check_cancelled: Callable = lambda: None,
+) -> Path:
+ from fdanyone.space.overlay import export_overlay
+ from fdanyone.space.source import prepare_source
+
+ body_identity = _body_identity(result.directory / "gvhmr", model_dir, gvhmr_root)
+ identity = [
+ RECORDING_VERSION,
+ str(result.directory),
+ result.metadata,
+ result.cameras,
+ [_identity(p) for p in result.videos],
+ _identity(source),
+ body_identity,
+ ]
+ key = _cache_key(identity)
+ recording_id = uuid.uuid4().hex
+ destination = cache_dir / f"{key}.rrd"
+ with _EXPORT_LOCK:
+ check_cancelled()
+ if _cached_recording(destination, require_body=bool(model_dir and gvhmr_root)):
+ return destination
+ media = cache_dir / key
+ media.mkdir(parents=True, exist_ok=True)
+ sizes = _prepare_targets(result, media, check_cancelled)
+ body, notes = _prepare_body(result.directory / "gvhmr", model_dir, gvhmr_root, cache_dir, check_cancelled)
+ source_info = None
+ if source is not None:
+ indices = body["source_indices"] if body is not None else None
+ source_info = prepare_source(
+ source,
+ cache_dir,
+ fps=result.fps,
+ indices=indices,
+ start_time=result.metadata["input"].get("start_time_seconds", 0),
+ check_cancelled=check_cancelled,
+ )
+ else:
+ notes.append("Original Source Video Unavailable. Restore the source at its saved path.")
+ info = {
+ "application_id": f"4danyone_space_{recording_id}",
+ "recording_id": recording_id,
+ "context": _result_context(result),
+ "target_count": len(result.cameras),
+ "camera_count": len(result.cameras),
+ "notes": notes,
+ "source": str(source) if source else None,
+ "body_frames": len(body["vertices"]) if body is not None else 0,
+ "fps": float(result.fps),
+ "frames": result.frames,
+ "media": {
+ "source": source_info,
+ "targets": [
+ {"id": index, "path": str(media / f"{index:02d}.mp4"), "width": size[0], "height": size[1]}
+ for index, size in sizes.items()
+ ],
+ "overlay": export_overlay(body, cache_dir / "overlays" / _cache_key([1, body_identity]))
+ if body is not None
+ else None,
+ },
+ }
+
+ def log_scene(recording):
+ scene.log_cameras(
+ recording,
+ result.cameras,
+ videos=[media / f"{index:02d}.mp4" for index in sizes],
+ fps=result.fps,
+ frames=result.frames,
+ )
+ if body is not None:
+ scene.log_body(recording, body, result.fps, check_cancelled)
+ check_cancelled()
+
+ return _save_recording(destination, info, log_scene)
+
+
+def export_input(
+ source: Path | None,
+ cache_dir: Path,
+ layout: dict,
+ *,
+ start_time=0.0,
+ target_fps="auto",
+ motion_dir: Path | None = None,
+ model_dir: Path | None = None,
+ gvhmr_root: Path | None = None,
+ check_cancelled: Callable = lambda: None,
+) -> Path:
+ from fdanyone.space.overlay import export_overlay
+ from fdanyone.space.source import prepare_source
+ from fdanyone.video import validate_clip_options
+
+ rate = validate_clip_options(start_time=start_time, fps=None if str(target_fps).lower() == "auto" else target_fps)
+ body_identity = _body_identity(motion_dir, model_dir, gvhmr_root)
+ key = _cache_key(
+ [RECORDING_VERSION, "input", _identity(source), float(start_time), str(rate), layout, body_identity]
+ )
+ destination = cache_dir / f"input-{key}.rrd"
+
+ with _EXPORT_LOCK:
+ check_cancelled()
+ if _cached_recording(destination, require_body=bool(motion_dir and model_dir and gvhmr_root)):
+ return destination
+ cache_dir.mkdir(parents=True, exist_ok=True)
+ body, notes = _prepare_body(motion_dir, model_dir, gvhmr_root, cache_dir, check_cancelled)
+ source_info = (
+ prepare_source(
+ source,
+ cache_dir,
+ start_time=start_time,
+ fps=rate,
+ check_cancelled=check_cancelled,
+ indices=body["source_indices"] if body is not None else None,
+ )
+ if source
+ else None
+ )
+ width, height = (source_info["width"], source_info["height"]) if source_info else (360, 640)
+ context = {
+ "center": [0, 0, 0],
+ "radius": FRAMING.reference_radius,
+ "target_height": FRAMING.reference_target_height,
+ "image_width": width,
+ "image_height": height,
+ "K": reference_intrinsics(height, width).tolist(),
+ }
+ cameras = layout_cameras(context, layout)
+ recording_id = uuid.uuid4().hex
+ info = {
+ "application_id": f"4danyone_space_{recording_id}",
+ "recording_id": recording_id,
+ "context": context,
+ "target_count": 0,
+ "camera_count": len(cameras),
+ "notes": notes,
+ "body_frames": len(body["vertices"]) if body is not None else 0,
+ "source": str(source) if source else None,
+ "fps": float(Fraction(source_info["fps"])) if source_info else 25.0,
+ "frames": source_info["frames"] if source_info else 0,
+ "media": {
+ "source": source_info,
+ "targets": [],
+ "overlay": export_overlay(body, cache_dir / "overlays" / _cache_key([1, body_identity]))
+ if body is not None
+ else None,
+ },
+ }
+
+ def log_scene(recording):
+ scene.log_cameras(recording, cameras)
+ if source_info and body is None:
+ scene.log_source_card(recording, context, Path(source_info["path"]), source_info)
+ if body is not None:
+ scene.log_body(recording, body, info["fps"], check_cancelled)
+
+ return _save_recording(destination, info, log_scene)
+
+
+def export_layout_update(info: dict, cache_dir: Path, layout: dict) -> tuple[Path, dict]:
+ """Append a small camera update to the active store without reloading its videos."""
+
+ import rerun as rr
+
+ if info["target_count"]:
+ raise FourDAnyoneError("Saved result cameras are read-only.")
+ cameras = layout_cameras(info["context"], layout)
+ destination = cache_dir / f"layout-{uuid.uuid4().hex}.rrd"
+ cache_dir.mkdir(parents=True, exist_ok=True)
+ recording = rr.RecordingStream(info["application_id"], recording_id=info["recording_id"])
+ try:
+ recording.save(str(destination))
+ scene.log_cameras(recording, cameras)
+ recording.flush()
+ finally:
+ recording.disconnect()
+ return destination, {**info, "camera_count": len(cameras)}
diff --git a/fdanyone/space/web_assets.py b/fdanyone/space/web_assets.py
new file mode 100644
index 0000000..1f7de78
--- /dev/null
+++ b/fdanyone/space/web_assets.py
@@ -0,0 +1,115 @@
+"""Serve the pinned Web Viewer API with the runtime already in gradio-rerun."""
+
+from __future__ import annotations
+
+import base64
+import hashlib
+import importlib.metadata
+import re
+import tempfile
+import threading
+import uuid
+from pathlib import Path
+from urllib.parse import quote
+
+from fdanyone.errors import FourDAnyoneError
+
+VERSION = "0.37.1"
+WASM_SHA256 = "a5119572793205c35f682546b30882152fd3e2869b24c82226f852dfa6db7fe3"
+ASSETS = Path(__file__).with_name("assets")
+_LOCK = threading.Lock()
+
+
+def file_url(path: Path | str, *, revision: str | None = None) -> str:
+ """Relative to the mounted Space, including deployments behind a path prefix."""
+ url = "./gradio_api/file=" + quote(str(Path(path).resolve()), safe="/")
+ return url + "?v=" + quote(revision, safe="") if revision else url
+
+
+def _cache_modules(directory: Path) -> Path:
+ # Version the whole import graph: a query on scene.js would leave its relative
+ # imports cached at their old URLs, mixing code from different Space versions.
+ files = {path.relative_to(ASSETS): path.read_bytes() for path in sorted(ASSETS.rglob("*.js"))}
+ digest = hashlib.sha256()
+ for path, data in files.items():
+ digest.update(path.as_posix().encode() + b"\0" + hashlib.sha256(data).digest())
+ modules = directory / "modules" / digest.hexdigest()[:16]
+ if not modules.is_dir():
+ modules.parent.mkdir(parents=True, exist_ok=True)
+ with tempfile.TemporaryDirectory(dir=modules.parent) as temporary:
+ staged = Path(temporary) / "assets"
+ for path, data in files.items():
+ target = staged / path
+ target.parent.mkdir(parents=True, exist_ok=True)
+ target.write_bytes(data)
+ try:
+ staged.rename(modules)
+ except OSError:
+ if not modules.is_dir():
+ raise
+ return modules
+
+
+def prepare_web_assets(cache_dir: Path) -> dict:
+ import gradio as gr
+ import gradio_rerun
+
+ version = importlib.metadata.version("gradio-rerun")
+ if version != VERSION:
+ raise FourDAnyoneError(f"The Space viewer needs gradio-rerun=={VERSION}; found {version}.")
+ directory = cache_dir / "web-viewer" / VERSION
+ destination = directory / "re_viewer_bg.wasm"
+ with _LOCK:
+ if not destination.is_file():
+ directory.mkdir(parents=True, exist_ok=True)
+ package = Path(gradio_rerun.__file__).parent / "templates/component/index.js"
+ match = re.search(r"data:application/wasm;base64,([A-Za-z0-9+/=]+)", package.read_text())
+ if match is None:
+ raise FourDAnyoneError(
+ "Cannot locate the installed Rerun viewer runtime. Reinstall requirements-gui.txt."
+ )
+ data = base64.b64decode(match[1], validate=True)
+ if hashlib.sha256(data).hexdigest() != WASM_SHA256:
+ raise FourDAnyoneError("The installed Rerun viewer runtime does not match this Space version.")
+ temporary = directory / f".{uuid.uuid4().hex}.wasm"
+ try:
+ temporary.write_bytes(data)
+ temporary.replace(destination)
+ finally:
+ temporary.unlink(missing_ok=True)
+ modules = _cache_modules(directory)
+ gr.set_static_paths(paths=[ASSETS.resolve(), directory.resolve()])
+ return {
+ "scene": file_url(modules / "scene.js"),
+ "media": file_url(modules / "media.js"),
+ "wasm": file_url(destination),
+ }
+
+
+def display_payload(recording: Path, info: dict, *, layout_only: bool = False) -> dict:
+ """Convert only exported cache files into browser media URLs."""
+ revision = info["recording_id"]
+ payload = {
+ "recording": file_url(recording, revision=revision),
+ "recording_id": revision,
+ "layout_only": layout_only,
+ "camera_count": info["camera_count"],
+ }
+ if layout_only:
+ return payload
+ media = info["media"]
+ source, overlay = media["source"], media["overlay"]
+ if overlay:
+ overlay = {
+ **overlay,
+ **{key: file_url(overlay[key]) for key in ("vertices", "faces", "keypoints")},
+ }
+ return {
+ **payload,
+ "fps": info["fps"],
+ "frames": info["frames"],
+ "source": {**source, "url": file_url(source["path"])} if source else None,
+ "overlay": overlay,
+ "targets": [{**target, "url": file_url(target["path"])} for target in media["targets"]],
+ "notes": info["notes"],
+ }
diff --git a/fdanyone/space/worker.py b/fdanyone/space/worker.py
new file mode 100644
index 0000000..8213333
--- /dev/null
+++ b/fdanyone/space/worker.py
@@ -0,0 +1,52 @@
+"""Execute the ordinary inference entrypoint in an owned, cancellable process."""
+
+from __future__ import annotations
+
+import json
+import logging
+import sys
+import traceback
+from pathlib import Path
+
+
+def write_status(path: Path, message: str, fraction: float, **fields) -> None:
+ """Readers always see one complete status document."""
+
+ temporary = path.with_suffix(".tmp")
+ temporary.write_text(json.dumps({"message": message, "fraction": fraction, **fields}) + "\n")
+ temporary.replace(path)
+
+
+class ProgressHandler(logging.Handler):
+ def __init__(self, path: Path):
+ super().__init__()
+ self.path = path
+
+ def emit(self, record: logging.LogRecord) -> None:
+ write_status(self.path, record.getMessage(), float(record.fraction))
+
+
+def main(request_path: str) -> int:
+ request = Path(request_path)
+ status = request.with_name("status.json")
+ logger = logging.getLogger("fdanyone.progress")
+ logger.setLevel(logging.INFO)
+ handler = ProgressHandler(status)
+ logger.addHandler(handler)
+ try:
+ from inference import inference
+
+ options = json.loads(request.read_text())
+ summary = inference(**options)
+ write_status(status, "Inference complete", 1.0, summary=summary)
+ except Exception as exc:
+ write_status(status, str(exc) or type(exc).__name__, 0.0, error=True)
+ traceback.print_exc()
+ return 1
+ finally:
+ logger.removeHandler(handler)
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main(sys.argv[1]))
diff --git a/fdanyone/views.py b/fdanyone/views.py
index af5742b..4436d66 100644
--- a/fdanyone/views.py
+++ b/fdanyone/views.py
@@ -131,12 +131,12 @@ def _layer_pitches(value: object) -> tuple[int, ...]:
return pitches
-def _group_size(value: int | str, views_per_layer: int) -> int:
+def _group_size(value: int | str, num_target_views: int) -> int:
if isinstance(value, str):
if value.lower() == "auto":
- divisors = tuple(size for size in VALID_VIEWS_PER_GROUP if views_per_layer % size == 0)
+ divisors = tuple(size for size in VALID_VIEWS_PER_GROUP if num_target_views % size == 0)
if not divisors:
- raise ConfigurationError(f"views_per_layer ({views_per_layer}) must be divisible by 4 or 6.")
+ raise ConfigurationError(f"Total target views ({num_target_views}) must be divisible by 4 or 6.")
return max(divisors)
try:
value = int(value)
@@ -147,8 +147,10 @@ def _group_size(value: int | str, views_per_layer: int) -> int:
value = _integer("views_per_group", value)
if value not in VALID_VIEWS_PER_GROUP:
raise ConfigurationError(f"views_per_group must be one of {VALID_VIEWS_PER_GROUP}, got {value!r}.")
- if views_per_layer % value:
- raise ConfigurationError(f"views_per_layer ({views_per_layer}) must be divisible by views_per_group ({value}).")
+ if num_target_views % value:
+ raise ConfigurationError(
+ f"Total target views ({num_target_views}) must be divisible by views_per_group ({value})."
+ )
return value
@@ -173,7 +175,7 @@ def resolve_view_plan(
yaw_span = _integer("yaw_span", yaw_span)
if not 0 < yaw_span <= 360:
raise ConfigurationError(f"yaw_span must be between 1 and 360 degrees, got {yaw_span}.")
- resolved_group_size = _group_size(views_per_group, views_per_layer)
+ resolved_group_size = _group_size(views_per_group, views_per_layer * len(pitches))
if not isinstance(enable_rcp, bool):
raise ConfigurationError(f"enable_rcp must be True or False, got {enable_rcp!r}.")
if not isinstance(enable_tcr, bool):
diff --git a/inference.py b/inference.py
index ee81ed8..bad5c72 100644
--- a/inference.py
+++ b/inference.py
@@ -35,8 +35,8 @@ def inference(
Args:
video_path: Input video; it must contain at least 121 usable frames.
output_dir: Output directory for this clip. Defaults to data/fdanyone/<clip>.
- views_per_layer: Number of evenly spaced yaw views at each pitch. It
- must be divisible by 4 or 6.
+ views_per_layer: Number of evenly spaced yaw views at each pitch.
+ Total views (this number times the layer count) must be divisible by 4 or 6.
layer_pitches: Camera pitch for each layer in degrees, for example
[-10,15,35]. Positive values place the camera above the subject;
each value must be between -15 and 45.
@@ -45,7 +45,7 @@ def inference(
The end angle is excluded so a full ring never duplicates a view.
views_per_group: Maximum target views generated together. auto chooses
6 when possible and otherwise 4; a manual value must be 4 or 6 and
- divide views_per_layer.
+ divide the total view count.
enable_rcp: Use proposal views before generating more than six targets.
The proposal count follows views_per_group.
enable_tcr: Shift view groups cyclically between denoising steps.
diff --git a/requirements-gui.txt b/requirements-gui.txt
new file mode 100644
index 0000000..2990c96
--- /dev/null
+++ b/requirements-gui.txt
@@ -0,0 +1,6 @@
+# Install alongside requirements.txt in the same Python environment.
+# Keep the embedded viewer and SDK matched. Gradio 6.20 avoids the custom
+# component remount regression observed in the newer 6.21-6.26 frontend.
+gradio==6.20.0
+gradio-rerun==0.37.1
+rerun-sdk==0.37.1
diff --git a/requirements.txt b/requirements.txt
index 65b1733..c45bd1c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,13 +3,13 @@ colorlog>=6,<7
einops>=0.8,<1
ffmpeg-python>=0.2,<1
fire>=0.7,<1
-huggingface-hub>=0.36,<1
+huggingface-hub>=1.5,<2
hydra-core>=1.3,<2
hydra-zen>=0.16,<1
imageio>=2.34,<3
kornia>=0.7,<1
lapx>=0.5,<1
-numpy>=1.26,<2
+numpy>=2,<3
opencv-python>=4.10,<5
pillow>=10,<13
pytorch-lightning>=2.3,<3
@@ -20,7 +20,7 @@ timm==0.9.12
torch>=2.8,<2.9
torchvision>=0.23,<0.24
tqdm>=4.66,<5
-transformers>=4.57,<5
+transformers>=5.17,<5.18
typing-extensions>=4.10,<5
-ultralytics==8.2.42
+ultralytics==8.3.253
yacs>=0.1,<1