"""Load .js files from `js/` as strings, cached at import time."""
from __future__ import annotations

from functools import lru_cache
from pathlib import Path

_JS_DIR = Path(__file__).resolve().parent / "js"


@lru_cache(maxsize=None)
def load(name: str) -> str:
    """Return the contents of js/<name>.js. Raises FileNotFoundError if missing."""
    path = _JS_DIR / f"{name}.js"
    return path.read_text(encoding="utf-8")
