import { p as page, g as goto } from './index3-Cp9d5nmD.js';
import { T as Tabs, a as Tab } from './Tab-DMBlstpi.js';
import './state.svelte-DbqYHGBV.js';
import './context-B0vutJuA.js';
import './utils-KcIDVAAe.js';
import './index-BSa6KzSq.js';
import './index2-BpEbpEAf.js';
import './index-server-BI-Ep7Rw.js';

function _layout($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    let { children } = $$props;
    const activeViewTab = (() => {
      const tail = page.url.pathname.split("/").at(-1);
      return tail === "latency" ? "latency" : "traces";
    })();
    const viewBase = (() => page.url.pathname.startsWith("/view") ? "/view" : "/traces")();
    function buildConversationUrl(tab) {
      const conversationId = page.params.conversationId ?? "";
      const search = page.url.search;
      return `${viewBase}/conversations/${encodeURIComponent(conversationId)}/${tab}${search}`;
    }
    function handleViewTabChange({ value }) {
      if (value !== "traces" && value !== "latency") return;
      if (value === activeViewTab) return;
      void goto(buildConversationUrl(value));
    }
    $$renderer2.push(`<div class="flex h-full min-h-0 flex-col bg-rc-gray-980"><div class="flex-none border-b border-rc-gray-300/40 px-4 pt-3">`);
    Tabs($$renderer2, {
      value: activeViewTab,
      ariaLabel: "View conversation tabs",
      onChange: handleViewTabChange,
      children: ($$renderer3) => {
        Tab($$renderer3, {
          value: "traces",
          children: ($$renderer4) => {
            $$renderer4.push(`<!---->Traces`);
          }
        });
        $$renderer3.push(`<!----> `);
        Tab($$renderer3, {
          value: "latency",
          children: ($$renderer4) => {
            $$renderer4.push(`<!---->Latency`);
          }
        });
        $$renderer3.push(`<!---->`);
      },
      $$slots: { default: true }
    });
    $$renderer2.push(`<!----></div> <div class="min-h-0 flex-1">`);
    children($$renderer2);
    $$renderer2.push(`<!----></div></div>`);
  });
}

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