import { a2 as push, ao as ensure_array_like, ap as push_element, aq as attr, ar as pop_element, as as escape_html, a4 as pop, at as hash, a0 as FILENAME } from './exports-5bDEyudc.js';
import './client-CmENaDmn.js';
import { g as globalState } from './globalState.svelte-DvsudVyF.js';
import { B as Button } from './Tabs.svelte_svelte_type_style_lang-Dnl7UCWg.js';
import { p as prevent_snippet_stringification } from './validate-DIfOr8HB.js';
import './utils2-BNPuf_o4.js';

function html(value) {
  var html2 = String(value ?? "");
  var open = `<!--${hash(html2)}-->`;
  return open + html2 + "<!---->";
}
const iconSpinner = `<symbol viewBox="0 0 24 24" id="iconSpinner"><path fill="currentColor" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity=".25"></path><circle cx="12" cy="2.5" r="1.5" fill="currentColor"><animateTransform attributeName="transform" dur="0.75s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"></animateTransform></circle></symbol>`;
const svgDefinitions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  iconSpinner
}, Symbol.toStringTag, { value: "Module" }));
_layout[FILENAME] = "src/routes/+layout.svelte";
function _layout($$payload, $$props) {
  push(_layout);
  let { children, data } = $$props;
  globalState.user = data.user;
  const allLinks = [
    { label: "Home", href: "/" },
    { label: "Sign In", href: "/sign-in", onlyShowFor: "GUEST" },
    { label: "Sign Up", href: "/sign-up", onlyShowFor: "GUEST" },
    { label: "Dashboard", href: "/dashboard", onlyShowFor: "USER" }
  ];
  let navLinks = (() => {
    return allLinks.filter((link) => {
      if (link.onlyShowFor === void 0) {
        return true;
      }
      if (globalState.user) {
        return link.onlyShowFor === "USER";
      }
      return link.onlyShowFor === "GUEST";
    });
  })();
  let signoutPending = false;
  let isMenuOpen = false;
  const each_array = ensure_array_like(navLinks);
  $$payload.out.push(`<nav class="flex flex.end p.2">`);
  push_element($$payload, "nav", 87, 0);
  $$payload.out.push(`<button${attr("aria-expanded", isMenuOpen)} type="button" class="main-nav__toggle btn savnac h5 svelte-1lj5aue">`);
  push_element($$payload, "button", 88, 1);
  $$payload.out.push(`<svg class="icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">`);
  push_element($$payload, "svg", 97, 2);
  $$payload.out.push(`<path d="M5 6.5H19V8H5V6.5Z">`);
  push_element($$payload, "path", 103, 3);
  $$payload.out.push(`</path>`);
  pop_element();
  $$payload.out.push(`<path d="M5 16.5H19V18H5V16.5Z">`);
  push_element($$payload, "path", 104, 3);
  $$payload.out.push(`</path>`);
  pop_element();
  $$payload.out.push(`<path d="M5 11.5H19V13H5V11.5Z">`);
  push_element($$payload, "path", 105, 3);
  $$payload.out.push(`</path>`);
  pop_element();
  $$payload.out.push(`</svg>`);
  pop_element();
  $$payload.out.push(` <span class="visually-hidden">`);
  push_element($$payload, "span", 107, 2);
  $$payload.out.push(`Toggle Menu</span>`);
  pop_element();
  $$payload.out.push(`</button>`);
  pop_element();
  $$payload.out.push(` <ul class="main-nav flex gap.4 flex.center svelte-1lj5aue">`);
  push_element($$payload, "ul", 110, 1);
  $$payload.out.push(`<!--[-->`);
  for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
    let item = each_array[$$index];
    $$payload.out.push(`<li>`);
    push_element($$payload, "li", 120, 3);
    $$payload.out.push(`<a${attr("href", item.href)} class="d.iblock p.2">`);
    push_element($$payload, "a", 121, 4);
    $$payload.out.push(`${escape_html(item.label)}</a>`);
    pop_element();
    $$payload.out.push(`</li>`);
    pop_element();
  }
  $$payload.out.push(`<!--]--> `);
  if (globalState.user) {
    $$payload.out.push("<!--[-->");
    $$payload.out.push(`<li>`);
    push_element($$payload, "li", 126, 3);
    $$payload.out.push(`<form action="/?/signout" method="POST">`);
    push_element($$payload, "form", 127, 4);
    Button($$payload, {
      type: "submit",
      loading: signoutPending,
      children: prevent_snippet_stringification(($$payload2) => {
        $$payload2.out.push(`<!---->Sign Out`);
      }),
      $$slots: { default: true }
    });
    $$payload.out.push(`<!----></form>`);
    pop_element();
    $$payload.out.push(`</li>`);
    pop_element();
  } else {
    $$payload.out.push("<!--[!-->");
  }
  $$payload.out.push(`<!--]--></ul>`);
  pop_element();
  $$payload.out.push(`</nav>`);
  pop_element();
  $$payload.out.push(` <main class="p.4">`);
  push_element($$payload, "main", 146, 0);
  children($$payload);
  $$payload.out.push(`<!----></main>`);
  pop_element();
  $$payload.out.push(` <svg aria-hidden="true" style="position: absolute; width: 0; height: 0; overflow: hidden" version="1.1" xmlns="http://www.w3.org/2000/svg">`);
  push_element($$payload, "svg", 150, 0);
  $$payload.out.push(`<defs>`);
  push_element($$payload, "defs", 156, 1);
  $$payload.out.push(`${html(Object.values(svgDefinitions).join(""))}</defs>`);
  pop_element();
  $$payload.out.push(`</svg>`);
  pop_element();
  pop();
}
_layout.render = function() {
  throw new Error("Component.render(...) is no longer valid in Svelte 5. See https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes for more information");
};

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