import { a2 as push, ap as push_element, aw as element, ar as pop_element, a4 as pop, ax as spread_attributes, ao as ensure_array_like, aq as attr, as as escape_html, ay as maybe_selected, az as stringify, a0 as FILENAME, aA as clsx } from './exports-5bDEyudc.js';
import { v as validate_void_dynamic_element, a as validate_dynamic_element_tag } from './validate-DIfOr8HB.js';
import './client-CmENaDmn.js';
import { r as randomString } from './utils2-BNPuf_o4.js';

Svg[FILENAME] = "src/lib/components/Svg.svelte";
function Svg($$payload, $$props) {
  push(Svg);
  let {
    alt,
    href,
    icon,
    class: className,
    $$slots,
    $$events,
    ...attrs
  } = $$props;
  $$payload.out.push(`<svg${spread_attributes(
    {
      class: clsx({
        [String(className)]: !!className,
        icon: !!icon,
        [String(icon)]: !!icon
      }),
      role: "presentation",
      ...attrs
    },
    null,
    void 0,
    void 0,
    3
  )}>`);
  push_element($$payload, "svg", 16, 0);
  $$payload.out.push(`<use${attr("href", `#${href || icon}`)}>`);
  push_element($$payload, "use", 25, 2);
  $$payload.out.push(`</use>`);
  pop_element();
  $$payload.out.push(`</svg>`);
  pop_element();
  $$payload.out.push(` <span class="visually-hidden">`);
  push_element($$payload, "span", 27, 0);
  $$payload.out.push(`${escape_html(alt)}</span>`);
  pop_element();
  pop();
}
Svg.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");
};
Button[FILENAME] = "src/lib/components/Button.svelte";
function Button($$payload, $$props) {
  push(Button);
  let {
    loading,
    children,
    class: className,
    $$slots,
    $$events,
    ...attrs
  } = $$props;
  let tag = "button";
  if (attrs.href) {
    tag = "a";
  }
  if (tag === "button") {
    attrs = { type: "button", ...attrs };
  }
  validate_void_dynamic_element(() => tag);
  validate_dynamic_element_tag(() => tag);
  push_element($$payload, tag, 25, 0);
  element(
    $$payload,
    tag,
    () => {
      $$payload.out.push(`${spread_attributes(
        {
          class: clsx({ [String(className)]: !!className, "btn savnac": true }),
          ...attrs
        }
      )}`);
    },
    () => {
      if (loading) {
        $$payload.out.push("<!--[-->");
        Svg($$payload, { alt: "Loading", icon: "iconSpinner" });
      } else {
        $$payload.out.push("<!--[!-->");
        children?.($$payload);
        $$payload.out.push(`<!---->`);
      }
      $$payload.out.push(`<!--]-->`);
    }
  );
  pop_element();
  pop();
}
Button.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");
};
Form[FILENAME] = "src/lib/components/Form.svelte";
function Form($$payload, $$props) {
  push(Form);
  let {
    children,
    content,
    onrequest,
    onresponse,
    $$slots,
    $$events,
    ...attrs
  } = $$props;
  const state = { isLoading: false };
  $$payload.out.push(`<form${spread_attributes(
    {
      method: "POST",
      ...// @ts-ignore
      attrs
    }
  )}>`);
  push_element($$payload, "form", 17, 0);
  if (content) {
    $$payload.out.push("<!--[-->");
    content($$payload, state);
    $$payload.out.push(`<!---->`);
  } else {
    $$payload.out.push("<!--[!-->");
    children?.($$payload);
    $$payload.out.push(`<!---->`);
  }
  $$payload.out.push(`<!--]--></form>`);
  pop_element();
  pop();
}
Form.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");
};
Input[FILENAME] = "src/lib/components/Input.svelte";
function Input($$payload, $$props) {
  push(Input);
  let {
    id = randomString(),
    label,
    options = [],
    description,
    $$slots,
    $$events,
    ...attrs
  } = $$props;
  $$payload.out.push(`<div>`);
  push_element($$payload, "div", 22, 0);
  if (["radio", "checkbox"].includes(attrs.type) && options.length) {
    $$payload.out.push("<!--[-->");
    const each_array = ensure_array_like(options);
    $$payload.out.push(`<p aria-hidden="true">`);
    push_element($$payload, "p", 24, 4);
    $$payload.out.push(`${escape_html(label)}</p>`);
    pop_element();
    $$payload.out.push(` <fieldset${attr("aria-describedby", description ?? `${id}__desctiption`)}>`);
    push_element($$payload, "fieldset", 25, 4);
    $$payload.out.push(`<legend class="visually-hidden">`);
    push_element($$payload, "legend", 26, 6);
    $$payload.out.push(`${escape_html(label)}</legend>`);
    pop_element();
    $$payload.out.push(` <div class="px-2 pb-1">`);
    push_element($$payload, "div", 27, 6);
    $$payload.out.push(`<!--[-->`);
    for (let i = 0, $$length = each_array.length; i < $$length; i++) {
      let option = each_array[i];
      $$payload.out.push(`<div>`);
      push_element($$payload, "div", 29, 10);
      $$payload.out.push(`<input${spread_attributes(
        {
          id: `${id}_${i}`,
          checked: attrs.value === option.value || attrs.value === option.label || option.selected,
          ...attrs,
          value: option.value
        }
      )}/>`);
      push_element($$payload, "input", 30, 12);
      pop_element();
      $$payload.out.push(` <label${attr("for", `${id}_${i}`)}>`);
      push_element($$payload, "label", 38, 12);
      $$payload.out.push(`${escape_html(option.label)}</label>`);
      pop_element();
      $$payload.out.push(`</div>`);
      pop_element();
    }
    $$payload.out.push(`<!--]--></div>`);
    pop_element();
    $$payload.out.push(`</fieldset>`);
    pop_element();
  } else {
    $$payload.out.push("<!--[!-->");
    if (!["radio", "checkbox"].includes(attrs.type)) {
      $$payload.out.push("<!--[-->");
      $$payload.out.push(`<label${attr("for", id)}>`);
      push_element($$payload, "label", 45, 6);
      $$payload.out.push(`${escape_html(label)}</label>`);
      pop_element();
    } else {
      $$payload.out.push("<!--[!-->");
    }
    $$payload.out.push(`<!--]--> `);
    if (attrs.type === "select") {
      $$payload.out.push("<!--[-->");
      const each_array_1 = ensure_array_like(options);
      $$payload.out.push(`<select${spread_attributes(
        {
          id,
          ...attrs,
          "aria-describedby": description ?? `${id}__desctiption`
        }
      )}>`);
      push_element($$payload, "select", 49, 6);
      $$payload.select_value = {
        ...attrs
      }?.value;
      $$payload.out.push(`<!--[-->`);
      for (let $$index_1 = 0, $$length = each_array_1.length; $$index_1 < $$length; $$index_1++) {
        let option = each_array_1[$$index_1];
        $$payload.out.push(`<option${attr("value", option.value ?? option.label)}${maybe_selected($$payload, option.value ?? option.label)}>`);
        push_element($$payload, "option", 55, 10);
        $$payload.out.push(`${escape_html(option.label)}</option>`);
        pop_element();
      }
      $$payload.out.push(`<!--]-->`);
      $$payload.select_value = void 0;
      $$payload.out.push(`</select>`);
      pop_element();
    } else {
      $$payload.out.push("<!--[!-->");
      if (attrs.type === "textarea") {
        $$payload.out.push("<!--[-->");
        $$payload.out.push(`<textarea${spread_attributes(
          {
            id,
            ...attrs,
            "aria-describedby": description ?? `${id}__desctiption`
          }
        )}>`);
        push_element($$payload, "textarea", 59, 6);
        const $$body = escape_html(`        ${stringify(attrs.value)}
      `);
        if ($$body) {
          $$payload.out.push(`${$$body}`);
        }
        $$payload.out.push(`</textarea>`);
        pop_element();
      } else {
        $$payload.out.push("<!--[!-->");
        $$payload.out.push(`<input${spread_attributes(
          {
            id,
            ...attrs,
            "aria-describedby": description ?? `${id}__desctiption`
          }
        )}/>`);
        push_element($$payload, "input", 67, 6);
        pop_element();
      }
      $$payload.out.push(`<!--]-->`);
    }
    $$payload.out.push(`<!--]--> `);
    if (["radio", "checkbox"].includes(attrs.type)) {
      $$payload.out.push("<!--[-->");
      $$payload.out.push(`<label${attr("for", id)}>`);
      push_element($$payload, "label", 75, 6);
      $$payload.out.push(`${escape_html(label)}</label>`);
      pop_element();
    } else {
      $$payload.out.push("<!--[!-->");
    }
    $$payload.out.push(`<!--]--> `);
    if (description) {
      $$payload.out.push("<!--[-->");
      $$payload.out.push(`<p${attr("id", `${id}__description`)}>`);
      push_element($$payload, "p", 79, 6);
      $$payload.out.push(`<small>`);
      push_element($$payload, "small", 79, 35);
      $$payload.out.push(`${escape_html(description)}</small>`);
      pop_element();
      $$payload.out.push(`</p>`);
      pop_element();
    } else {
      $$payload.out.push("<!--[!-->");
    }
    $$payload.out.push(`<!--]-->`);
  }
  $$payload.out.push(`<!--]--></div>`);
  pop_element();
  pop();
}
Input.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");
};
Table[FILENAME] = "src/lib/components/Table.svelte";
function Table($$payload, $$props) {
  push(Table);
  const { $$slots, $$events, ...props } = $$props;
  let { id, caption, headers } = props;
  id = id ?? randomString();
  const each_array_1 = ensure_array_like(
    // localSortBy: this.sortBy,
    // localSortDirection: this.sortDirection
    //   ? this.sortDirection.toUpperCase()
    //   : '',
    // localPage: Number(this.page),
    // localPerPage: Number(this.perPage),
    // /** @returns {ComputedHeader[]} */
    // computedHeaders() {
    //   const { headers, sortable, localSortBy, localSortDirection } = this;
    //   const computedHeaders = [];
    //   headers.forEach((header) => {
    //     /** @type {ComputedHeader} */
    //     const computedHeader = {
    //       ...header,
    //       bind: {},
    //       sortBtn: {
    //         bind: { 'aria-label': `toggle sort direction` },
    //         on: { click: () => this.onSort(header.key) },
    //       },
    //     };
    //     if (computedHeader.sortable === undefined) {
    //       computedHeader.sortable = !!computedHeader.sort || sortable;
    //     }
    //     if (computedHeader.sortable) {
    //       if (localSortBy === header.key && localSortDirection) {
    //         if (localSortDirection === 'ASC') {
    //           computedHeader.bind['aria-sort'] = 'ascending';
    //         } else {
    //           computedHeader.bind['aria-sort'] = 'descending';
    //         }
    //       }
    //     }
    //     computedHeaders.push(computedHeader);
    //   });
    //   return computedHeaders;
    // },
    // /** @returns {Array} */
    // computedItems() {
    //   const {
    //     computedHeaders,
    //     items,
    //     localSortBy,
    //     localSortDirection,
    //     localPage,
    //     localPerPage,
    //   } = this;
    //   let computedItems = [...items];
    //   if (localSortBy && localSortDirection) {
    //     const targetColumn = computedHeaders.find((header) => {
    //       return header.key === localSortBy;
    //     });
    //     let compareFn = this.defaultComparisonFn;
    //     if (typeof targetColumn.sort === 'function') {
    //       compareFn = targetColumn.sort;
    //     }
    //     computedItems = computedItems.sort((a, b) => {
    //       return compareFn(a, b, localSortDirection === 'ASC');
    //     });
    //   }
    //   if (localPerPage > -1) {
    //     const offset = (Math.max(localPage, 1) - 1) * localPerPage;
    //     computedItems = computedItems.slice(offset, offset + localPerPage);
    //   }
    //   return computedItems;
    // },
    // /** @returns {number} */
    // lastPage() {
    //   return Math.ceil(this.items.length / +this.perPage);
    // },
    // /**
    //  * @param a
    //  * @param b
    //  * @param {boolean} isAscending
    //  * @returns {number}
    //  */
    // defaultComparisonFn(a, b, isAscending) {
    //   const { localSortBy } = this;
    //   const multiplier = isAscending ? 1 : -1;
    //   const aVal = a[localSortBy];
    //   const bVal = b[localSortBy];
    //   const isNumeric = Number.isFinite(aVal) && Number.isFinite(bVal);
    //   if (isNumeric) {
    //     return (aVal - bVal) * multiplier;
    //   }
    //   if (aVal < bVal) return -1 * multiplier;
    //   if (aVal > bVal) return 1 * multiplier;
    //   return 0;
    // },
    // onSort(key) {
    //   const { localSortBy, localSortDirection } = this;
    //   this.localPage = 1;
    //   if (key !== localSortBy) {
    //     this.localSortBy = key;
    //     this.localSortDirection = 'ASC';
    //     return;
    //   }
    //   switch (localSortDirection) {
    //     case 'ASC':
    //       this.localSortDirection = 'DESC';
    //       break;
    //     case 'DESC':
    //       this.localSortDirection = '';
    //       break;
    //     default:
    //       this.localSortDirection = 'ASC';
    //   }
    // },
    // /**
    //  * @param page
    //  * @returns {void}
    //  */
    // goToPage(page) {
    //   const { lastPage } = this;
    //   this.localPage = Math.min(Math.max(1, page), lastPage);
    // },
    props.items
  );
  $$payload.out.push(`<div role="region"${attr("aria-labelledby", caption && `${id}__caption`)}>`);
  push_element($$payload, "div", 161, 0);
  $$payload.out.push(`<table>`);
  push_element($$payload, "table", 179, 2);
  if (caption) {
    $$payload.out.push("<!--[-->");
    $$payload.out.push(`<caption${attr("id", `${id}__caption`)}>`);
    push_element($$payload, "caption", 193, 6);
    $$payload.out.push(`${escape_html(caption)}</caption>`);
    pop_element();
  } else {
    $$payload.out.push("<!--[!-->");
  }
  $$payload.out.push(`<!--]-->`);
  if (headers.length) {
    $$payload.out.push("<!--[-->");
    const each_array = ensure_array_like(headers);
    $$payload.out.push(`<thead>`);
    push_element($$payload, "thead", 199, 6);
    $$payload.out.push(`<tr>`);
    push_element($$payload, "tr", 200, 8);
    $$payload.out.push(`<!--[-->`);
    for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
      let header = each_array[$$index];
      $$payload.out.push(`<th>`);
      push_element($$payload, "th", 202, 12);
      $$payload.out.push(`${escape_html(header.text || header.key)}</th>`);
      pop_element();
    }
    $$payload.out.push(`<!--]--></tr>`);
    pop_element();
    $$payload.out.push(`</thead>`);
    pop_element();
  } else {
    $$payload.out.push("<!--[!-->");
  }
  $$payload.out.push(`<!--]--><tbody>`);
  push_element($$payload, "tbody", 274, 4);
  $$payload.out.push(`<!--[-->`);
  for (let $$index_2 = 0, $$length = each_array_1.length; $$index_2 < $$length; $$index_2++) {
    let item = each_array_1[$$index_2];
    const each_array_2 = ensure_array_like(headers);
    $$payload.out.push(`<tr>`);
    push_element($$payload, "tr", 286, 8);
    $$payload.out.push(`<!--[-->`);
    for (let $$index_1 = 0, $$length2 = each_array_2.length; $$index_1 < $$length2; $$index_1++) {
      let column = each_array_2[$$index_1];
      $$payload.out.push(`<td>`);
      push_element($$payload, "td", 294, 12);
      if (props[`${column.key}Td`]) {
        $$payload.out.push("<!--[-->");
        props[`${column.key}Td`]($$payload, item);
        $$payload.out.push(`<!---->`);
      } else {
        $$payload.out.push("<!--[!-->");
        $$payload.out.push(`${escape_html(item[column.key])}`);
      }
      $$payload.out.push(`<!--]--></td>`);
      pop_element();
    }
    $$payload.out.push(`<!--]--></tr>`);
    pop_element();
  }
  $$payload.out.push(`<!--]--></tbody>`);
  pop_element();
  $$payload.out.push(`</table>`);
  pop_element();
  $$payload.out.push(`</div>`);
  pop_element();
  pop();
}
Table.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 { Button as B, Form as F, Input as I, Table as T };
//# sourceMappingURL=Tabs.svelte_svelte_type_style_lang-Dnl7UCWg.js.map
