export default async function(req: Request): Promise<Response> {
const url = new URL(req.url);
const passedUrl = url.searchParams.get("url");
const passedSvg = url.searchParams.get("svg");
return new Response(
`<html>
<head>
<script
src="https://cdn.jsdelivr.net/npm/@electric-sql/pglite@0.2.0/dist/index.js"
type="module"
></script>
</head>
<body>
<!-- Include the Repl web component in your page -->
<pglite-repl id="repl"></pglite-repl>
<script type="module">
import { PGlite } from 'https://cdn.jsdelivr.net/npm/@electric-sql/pglite/dist/index.js'
// Create a PGlite instance
const pg = new PGlite()
// Retrieve the Repl element
const repl = document.getElementById('repl')
// REPL to your PGlite instance
repl.pg = pg
</script>
</body>
</html>`,
{ headers: { "Content-Type": "text/html" } },
);
}