import r from"react";import{renderToString as n}from"react-dom/server";import{fromCurrentDir as s}from"../utils/index.js";async function a(){return await import(s(import.meta.url,"../../client/app/pages/CompilationError/CompilationError.js?"+new Date))}async function d(o){const{CompilationError:t}=await a(),e=n(r.createElement(t,{compilationErrors:o}));return{html:`<!doctype html>
      <html>
      <head>
       <script>
        ${i}
        </script>
      </head>
      <body>
        ${e}
      </body>
      </html>
      
      `,statusCode:200}}const i=`
(() => {
    function handleWebSocketClose() {
    console.log('[connection closed] reloading page');
    window.location.reload();
    }

    function setupWebSocketListeners(ws) {
    ws.addEventListener('message', handleWebSocketMessage);
    ws.addEventListener('close', handleWebSocketClose);
    }

    function handleWebSocketMessage(event) {
    const message = JSON.parse(event.data);

    if (message.type === 'build-updated') {
        window.location.reload();
    }
    }

    const url = new URL(window.location.href);
    url.hash = '';
    url.pathname = '/';
    url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
    const socket = new WebSocket(url.toString());

    setupWebSocketListeners(socket);
})()
`;export{d as renderCompilationError};
