{# Base-path bootstrap. Must be the FIRST element in : it detects the reverse-proxy subpath (e.g. "/comfyui" when served via llama-swap, or "/ComfyBackendDirect" via SwarmUI) from the current page URL and, only when a prefix exists, patches fetch/XHR/WebSocket/innerHTML/DOM URL setters so that root-absolute URLs ("/api/lm/...", "/loras_static/...") generated anywhere in the frontend or in backend JSON payloads get the prefix prepended. When no prefix is detected (normal or standalone deployment) nothing is patched and behavior is byte-identical to before. #}