<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>ImJoy Plugin Template</title>
  <meta name="description" content="Template for ImJoy plugin">
  <meta name="author" content="ImJoy-Team">
  <script src="https://cdn.jsdelivr.net/npm/imjoy-rpc@0.3.31/dist/imjoy-rpc-socketio.min.js"></script>
</head>

<body>
    <script>
        const config = Object.fromEntries(new URLSearchParams(window.location.search))
        if(!config.server_url) config.server_url = window.location.origin;
        
        imjoyRPCSocketIO.connectToServer(config).then(async (api)=>{
            await imjoyRPCSocketIO.loadRequirements([{% for req in requirements %}"{{req}}", {% endfor %}])
            {{ script | safe }}
        }).catch(console.error)
    </script>
</body>
</html>