// Import first, then load viewer modules with dynamic import(): bare 'three' resolves as in index.html.
import { register } from 'node:module';
import { readFileSync } from 'node:fs';
export const HTML = readFileSync(new URL('../index.html', import.meta.url), 'utf8');
export const IMPORTS = JSON.parse(HTML.match(/<script type="importmap">([\s\S]*?)<\/script>/)[1]).imports;
register('./importmap-hooks.mjs', import.meta.url, { data: { imports: IMPORTS, base: new URL('../', import.meta.url).href } });
export function fakeCanvas(width = 800, height = 400) {
const c = new EventTarget();
Object.assign(c, { style: {}, ownerDocument: new EventTarget(), setPointerCapture() {}, releasePointerCapture() {},
getRootNode: () => new EventTarget(), getBoundingClientRect: () => ({ left: 0, top: 0, width, height }) });
return c;
}
export const fakeRenderer = () => ({ domElement: fakeCanvas(), render() {} });