import { X as escape_html } from './context-B0vutJuA.js';
import { s as setAgentsContext } from './agents-context-DJAK2Ml6.js';
import { p as page, g as goto } from './index3-Cp9d5nmD.js';
import './state.svelte-DbqYHGBV.js';
import './utils-KcIDVAAe.js';
import './index-BSa6KzSq.js';

function _layout($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    let { children } = $$props;
    let error = "";
    function handleError(errorMessage) {
      error = errorMessage;
      setTimeout(
        () => {
          error = "";
        },
        5e3
      );
      console.error(errorMessage);
    }
    setAgentsContext({
      onAgentSelect: (agentId) => {
        const search = new URLSearchParams(page.url.search);
        search.get("step");
        goto();
      },
      onError: handleError
    });
    $$renderer2.push(`<main class="h-screen overflow-hidden bg-gray-600">`);
    children($$renderer2);
    $$renderer2.push(`<!----> `);
    if (error) {
      $$renderer2.push("<!--[-->");
      $$renderer2.push(`<div class="absolute bottom-0 right-0 z-50 m-4 rounded-sm border border-red-500 bg-red-50 px-4 py-2 text-red-800 focus:outline-none focus:ring-0">${escape_html(error)}</div>`);
    } else {
      $$renderer2.push("<!--[!-->");
    }
    $$renderer2.push(`<!--]--></main>`);
  });
}

export { _layout as default };
//# sourceMappingURL=_layout.svelte-B3_pVwfN.js.map
