/** * Single entry point for both the host shell and the embedded app. * * Rendering decision * ────────────────── * url has `?embed=1` → we're inside the host's iframe; load * `./embed` (the Marionette UI). * otherwise → we're the top-level visit; load the * host shell from `@reachy-mini/host/auto` * and let it iframe us back via `?embed=1`. * * Host delivery strategy * ────────────────────── * Today the host ships inside this bundle through a `file:` npm dep * (`./vendor/reachy-mini-host`). Once `@reachy-mini/host` is published * to npm + jsdelivr we will swap the static import for a dynamic CDN * import; that single-line change moves the host out of every app's * bundle and lets a single publish update every deployed Space on the * next visit. */ const params = new URLSearchParams(window.location.search); const isEmbed = params.get("embed") === "1"; if (isEmbed) { void import("./embed"); } else { void import("@reachy-mini/host/auto").then(({ mountHost }) => { mountHost({ appName: "Marionette", appIconUrl: "/icon.svg", appEmoji: "🎭", enableMicrophone: true, devToken: import.meta.env.VITE_HF_TOKEN && import.meta.env.VITE_HF_USERNAME ? { token: import.meta.env.VITE_HF_TOKEN as string, userName: import.meta.env.VITE_HF_USERNAME as string, } : undefined, clientId: import.meta.env.VITE_HF_OAUTH_CLIENT_ID as string | undefined, }); }); }