import { c as create_ssr_component, v as validate_component, a as each, e as escape, s as spread, f as escape_object, d as escape_attribute_value, b as add_attribute } from './ssr-ipqebOFl.js'; import { T as Table, a as Table_header, b as Table_row, c as Table_head, d as Table_body, e as Table_cell } from './table-row-CK5I-4oy.js'; import 'clsx'; import { R as Root$2, T as Trigger$1, a as Tooltip_content, F as Form_field, C as Control, b as Form_label, I as Input$1, c as Form_description, d as Form_field_errors, L as Label, S as Switch, e as Textarea, f as createLabel } from './textarea-bqlfV9dO.js'; import { q as buttonVariants, i as is_void, o as omit, w as withGet, m as makeElement, b as executeCallbacks, d as addMeltEventListener, c as createElHelpers, r as dequal, t as isObject, v as stripValues, l as disabledAttr, k as kbd, x as isHTMLButtonElement, a as isHTMLElement, F as FIRST_LAST_KEYS, f as isElementDisabled, u as useEscapeKeydown, s as styleToString, e as effect, y as isElement, z as createHiddenInput, g as safeOnMount, h as isBrowser, A as getElementByMeltId, B as isHTMLLabelElement, C as isHTMLInputElement, n as noop } from './index3-JA_ucGjW.js'; import { B as Button, c as cn, I as Icon$1, f as flyAndScale } from './button-JMjD_Bg6.js'; import { c as compute_rest_props, a as subscribe, o as onDestroy, s as setContext, b as getContext, g as get_store_value } from './lifecycle-px-3doLe.js'; import { tv } from 'tailwind-variants'; import { D as Dialog_content$1, a as Dialog_close, X as X$1, b as Dialog, c as Dialog_trigger, q as getCtx$2, d as Dialog_portal$1, e as Dialog_overlay$1, t as scale, h as fade, g as generateId, i as createTypeaheadSearch, j as derivedVisible, v as last, w as back, x as forward, y as prev, z as next, u as usePopper, p as addHighlight, r as removeHighlight, m as removeScroll, A as toggle } from './x-DHy0k1TI.js'; import { d as derived, a as readonly, w as writable } from './index2-D4yenS_5.js'; import { k as toast, c as createDispatcher, a as createBitAttrs, r as removeUndefined, g as getOptionUpdater, o as overridable, e as toWritableStores, f as getPositioningUpdater, h as generateIds, i as getPortalDestination, l as generateId$1 } from './Toaster.svelte_svelte_type_style_lang-Bhmi0dH5.js'; import { t as tick } from './scheduler-1Ju9dhbL.js'; import { p as page } from './stores-Cv0rQqhp.js'; import { g as superForm } from './index-CUXxL1oq.js'; import './index-Ddp2AB5f.js'; import { b as zodClient } from './zod-D1iX83g6.js'; import { c as createFormSchema, e as editFormSchema } from './5-B8ZlkgVJ.js'; import './config-BHx687w1.js'; import './ssr2-BVSPLo1E.js'; import 'tailwind-merge'; import './exports-DuWZopOC.js'; import './stringify-D5iWhcfN.js'; import 'zod'; import './shared-server-i79vVjEm.js'; function getOptions(el) { return Array.from(el.querySelectorAll('[role="option"]:not([data-disabled])')).filter((el2) => isHTMLElement(el2)); } function createClickOutsideIgnore(meltId) { return (e) => { const target = e.target; const triggerEl = getElementByMeltId(meltId); if (!triggerEl || !isElement(target)) return false; const id = triggerEl.id; if (isHTMLLabelElement(target) && id === target.htmlFor) { return true; } if (target.closest(`label[for="${id}"]`)) { return true; } return false; }; } const INTERACTION_KEYS = [kbd.ARROW_LEFT, kbd.ESCAPE, kbd.ARROW_RIGHT, kbd.SHIFT, kbd.CAPS_LOCK, kbd.CONTROL, kbd.ALT, kbd.META, kbd.ENTER, kbd.F1, kbd.F2, kbd.F3, kbd.F4, kbd.F5, kbd.F6, kbd.F7, kbd.F8, kbd.F9, kbd.F10, kbd.F11, kbd.F12]; const defaults$1 = { positioning: { placement: "bottom", sameWidth: true }, scrollAlignment: "nearest", loop: true, defaultOpen: false, closeOnOutsideClick: true, preventScroll: true, closeOnEscape: true, forceVisible: false, portal: void 0, builder: "listbox", disabled: false, required: false, name: void 0, typeahead: true, highlightOnHover: true, onOutsideClick: void 0 }; const listboxIdParts = ["trigger", "menu", "label"]; function createListbox(props) { const withDefaults = { ...defaults$1, ...props }; const activeTrigger = withGet(writable(null)); const highlightedItem = withGet(writable(null)); const selectedWritable = withDefaults.selected ?? writable(withDefaults.defaultSelected); const selected = overridable(selectedWritable, withDefaults?.onSelectedChange); const highlighted = derived(highlightedItem, ($highlightedItem) => $highlightedItem ? getOptionProps($highlightedItem) : void 0); const openWritable = withDefaults.open ?? writable(withDefaults.defaultOpen); const open = overridable(openWritable, withDefaults?.onOpenChange); const options = toWritableStores({ ...omit(withDefaults, "open", "defaultOpen", "builder", "ids"), multiple: withDefaults.multiple ?? false }); const { scrollAlignment, loop, closeOnOutsideClick, closeOnEscape, preventScroll, portal, forceVisible, positioning, multiple, arrowSize, disabled, required, typeahead, name: nameProp, highlightOnHover, onOutsideClick } = options; const { name: name2, selector: selector2 } = createElHelpers(withDefaults.builder); const ids = toWritableStores({ ...generateIds(listboxIdParts), ...withDefaults.ids }); const { handleTypeaheadSearch } = createTypeaheadSearch({ onMatch: (element) => { highlightedItem.set(element); element.scrollIntoView({ block: scrollAlignment.get() }); }, getCurrentItem() { return highlightedItem.get(); } }); function getOptionProps(el) { const value = el.getAttribute("data-value"); const label2 = el.getAttribute("data-label"); const disabled2 = el.hasAttribute("data-disabled"); return { value: value ? JSON.parse(value) : value, label: label2 ?? el.textContent ?? void 0, disabled: disabled2 ? true : false }; } const setOption = (newOption) => { selected.update(($option) => { const $multiple = multiple.get(); if ($multiple) { const optionArr = Array.isArray($option) ? [...$option] : []; return toggle(newOption, optionArr, (itemA, itemB) => dequal(itemA.value, itemB.value)); } return newOption; }); }; function selectItem(item) { const props2 = getOptionProps(item); setOption(props2); } async function openMenu() { open.set(true); const triggerEl = document.getElementById(ids.trigger.get()); if (!triggerEl) return; if (triggerEl !== activeTrigger.get()) activeTrigger.set(triggerEl); await tick(); const menuElement = document.getElementById(ids.menu.get()); if (!isHTMLElement(menuElement)) return; const selectedItem = menuElement.querySelector("[aria-selected=true]"); if (!isHTMLElement(selectedItem)) return; highlightedItem.set(selectedItem); } function closeMenu() { open.set(false); highlightedItem.set(null); } const isVisible = derivedVisible({ open, forceVisible, activeTrigger }); const isSelected = derived([selected], ([$selected]) => { return (value) => { if (Array.isArray($selected)) { return $selected.some((o) => dequal(o.value, value)); } if (isObject(value)) { return dequal($selected?.value, stripValues(value, void 0)); } return dequal($selected?.value, value); }; }); const isHighlighted = derived([highlighted], ([$value]) => { return (item) => { return dequal($value?.value, item); }; }); const trigger = makeElement(name2("trigger"), { stores: [open, highlightedItem, disabled, ids.menu, ids.trigger, ids.label], returned: ([$open, $highlightedItem, $disabled, $menuId, $triggerId, $labelId]) => { return { "aria-activedescendant": $highlightedItem?.id, "aria-autocomplete": "list", "aria-controls": $menuId, "aria-expanded": $open, "aria-labelledby": $labelId, // autocomplete: 'off', id: $triggerId, role: "combobox", disabled: disabledAttr($disabled), type: withDefaults.builder === "select" ? "button" : void 0 }; }, action: (node) => { const isInput = isHTMLInputElement(node); const unsubscribe = executeCallbacks( addMeltEventListener(node, "click", () => { node.focus(); const $open = open.get(); if ($open) { closeMenu(); } else { openMenu(); } }), // Handle all input key events including typing, meta, and navigation. addMeltEventListener(node, "keydown", (e) => { const $open = open.get(); if (!$open) { if (INTERACTION_KEYS.includes(e.key)) { return; } if (e.key === kbd.TAB) { return; } if (e.key === kbd.BACKSPACE && isInput && node.value === "") { return; } if (e.key === kbd.SPACE && isHTMLButtonElement(node)) { return; } openMenu(); tick().then(() => { const $selectedItem = selected.get(); if ($selectedItem) return; const menuEl = document.getElementById(ids.menu.get()); if (!isHTMLElement(menuEl)) return; const enabledItems = Array.from(menuEl.querySelectorAll(`${selector2("item")}:not([data-disabled]):not([data-hidden])`)).filter((item) => isHTMLElement(item)); if (!enabledItems.length) return; if (e.key === kbd.ARROW_DOWN) { highlightedItem.set(enabledItems[0]); enabledItems[0].scrollIntoView({ block: scrollAlignment.get() }); } else if (e.key === kbd.ARROW_UP) { highlightedItem.set(last(enabledItems)); last(enabledItems).scrollIntoView({ block: scrollAlignment.get() }); } }); } if (e.key === kbd.TAB) { closeMenu(); return; } if (e.key === kbd.ENTER && !e.isComposing || e.key === kbd.SPACE && isHTMLButtonElement(node)) { e.preventDefault(); const $highlightedItem = highlightedItem.get(); if ($highlightedItem) { selectItem($highlightedItem); } if (!multiple.get()) { closeMenu(); } } if (e.key === kbd.ARROW_UP && e.altKey) { closeMenu(); } if (FIRST_LAST_KEYS.includes(e.key)) { e.preventDefault(); const menuElement = document.getElementById(ids.menu.get()); if (!isHTMLElement(menuElement)) return; const itemElements = getOptions(menuElement); if (!itemElements.length) return; const candidateNodes = itemElements.filter((opt) => !isElementDisabled(opt) && opt.dataset.hidden === void 0); const $currentItem = highlightedItem.get(); const currentIndex = $currentItem ? candidateNodes.indexOf($currentItem) : -1; const $loop = loop.get(); const $scrollAlignment = scrollAlignment.get(); let nextItem; switch (e.key) { case kbd.ARROW_DOWN: nextItem = next(candidateNodes, currentIndex, $loop); break; case kbd.ARROW_UP: nextItem = prev(candidateNodes, currentIndex, $loop); break; case kbd.PAGE_DOWN: nextItem = forward(candidateNodes, currentIndex, 10, $loop); break; case kbd.PAGE_UP: nextItem = back(candidateNodes, currentIndex, 10, $loop); break; case kbd.HOME: nextItem = candidateNodes[0]; break; case kbd.END: nextItem = last(candidateNodes); break; default: return; } highlightedItem.set(nextItem); nextItem?.scrollIntoView({ block: $scrollAlignment }); } else if (typeahead.get()) { const menuEl = document.getElementById(ids.menu.get()); if (!isHTMLElement(menuEl)) return; handleTypeaheadSearch(e.key, getOptions(menuEl)); } }) ); let unsubEscapeKeydown = noop; const escape2 = useEscapeKeydown(node, { handler: closeMenu, enabled: derived([open, closeOnEscape], ([$open, $closeOnEscape]) => { return $open && $closeOnEscape; }) }); if (escape2 && escape2.destroy) { unsubEscapeKeydown = escape2.destroy; } return { destroy() { unsubscribe(); unsubEscapeKeydown(); } }; } }); const menu = makeElement(name2("menu"), { stores: [isVisible, ids.menu], returned: ([$isVisible, $menuId]) => { return { hidden: $isVisible ? void 0 : true, id: $menuId, role: "listbox", style: styleToString({ display: $isVisible ? void 0 : "none" }) }; }, action: (node) => { let unsubPopper = noop; const unsubscribe = executeCallbacks( // Bind the popper portal to the input element. effect([isVisible, portal, closeOnOutsideClick, positioning, activeTrigger], ([$isVisible, $portal, $closeOnOutsideClick, $positioning, $activeTrigger]) => { unsubPopper(); if (!$isVisible || !$activeTrigger) return; tick().then(() => { unsubPopper(); const ignoreHandler = createClickOutsideIgnore(ids.trigger.get()); unsubPopper = usePopper(node, { anchorElement: $activeTrigger, open, options: { floating: $positioning, focusTrap: null, modal: { closeOnInteractOutside: $closeOnOutsideClick, onClose: closeMenu, open: $isVisible, shouldCloseOnInteractOutside: (e) => { onOutsideClick.get()?.(e); if (e.defaultPrevented) return false; const target = e.target; if (!isElement(target)) return false; if (target === $activeTrigger || $activeTrigger.contains(target)) { return false; } if (ignoreHandler(e)) return false; return true; } }, escapeKeydown: null, portal: getPortalDestination(node, $portal) } }).destroy; }); }) ); return { destroy: () => { unsubscribe(); unsubPopper(); } }; } }); const { elements: { root: labelBuilder } } = createLabel(); const { action: labelAction } = get_store_value(labelBuilder); const label = makeElement(name2("label"), { stores: [ids.label, ids.trigger], returned: ([$labelId, $triggerId]) => { return { id: $labelId, for: $triggerId }; }, action: labelAction }); const option = makeElement(name2("option"), { stores: [isSelected], returned: ([$isSelected]) => (props2) => { const selected2 = $isSelected(props2.value); return { "data-value": JSON.stringify(props2.value), "data-label": props2.label, "data-disabled": disabledAttr(props2.disabled), "aria-disabled": props2.disabled ? true : void 0, "aria-selected": selected2, "data-selected": selected2 ? "" : void 0, id: generateId$1(), role: "option" }; }, action: (node) => { const unsubscribe = executeCallbacks(addMeltEventListener(node, "click", (e) => { if (isElementDisabled(node)) { e.preventDefault(); return; } selectItem(node); if (!multiple.get()) { closeMenu(); } }), effect(highlightOnHover, ($highlightOnHover) => { if (!$highlightOnHover) return; const unsub = executeCallbacks(addMeltEventListener(node, "mouseover", () => { highlightedItem.set(node); }), addMeltEventListener(node, "mouseleave", () => { highlightedItem.set(null); })); return unsub; })); return { destroy: unsubscribe }; } }); const group = makeElement(name2("group"), { returned: () => { return (groupId) => ({ role: "group", "aria-labelledby": groupId }); } }); const groupLabel = makeElement(name2("group-label"), { returned: () => { return (groupId) => ({ id: groupId }); } }); const hiddenInput = createHiddenInput({ value: derived([selected], ([$selected]) => { const value = Array.isArray($selected) ? $selected.map((o) => o.value) : $selected?.value; return typeof value === "string" ? value : JSON.stringify(value); }), name: readonly(nameProp), required, prefix: withDefaults.builder }); const arrow = makeElement(name2("arrow"), { stores: arrowSize, returned: ($arrowSize) => ({ "data-arrow": true, style: styleToString({ position: "absolute", width: `var(--arrow-size, ${$arrowSize}px)`, height: `var(--arrow-size, ${$arrowSize}px)` }) }) }); safeOnMount(() => { if (!isBrowser) return; const menuEl = document.getElementById(ids.menu.get()); const triggerEl = document.getElementById(ids.trigger.get()); if (triggerEl) { activeTrigger.set(triggerEl); } if (!menuEl) return; const selectedEl = menuEl.querySelector("[data-selected]"); if (!isHTMLElement(selectedEl)) return; }); effect([highlightedItem], ([$highlightedItem]) => { if (!isBrowser) return; const menuElement = document.getElementById(ids.menu.get()); if (!isHTMLElement(menuElement)) return; getOptions(menuElement).forEach((node) => { if (node === $highlightedItem) { addHighlight(node); } else { removeHighlight(node); } }); }); effect([open], ([$open]) => { if (!isBrowser) return; let unsubScroll = noop; if (preventScroll.get() && $open) { unsubScroll = removeScroll(); } return () => { unsubScroll(); }; }); return { ids, elements: { trigger, group, option, menu, groupLabel, label, hiddenInput, arrow }, states: { open, selected, highlighted, highlightedItem }, helpers: { isSelected, isHighlighted, closeMenu }, options }; } function getPageItems({ page: page2 = 1, totalPages, siblingCount = 1 }) { const pageItems = []; const pagesToShow = /* @__PURE__ */ new Set([1, totalPages]); const firstItemWithSiblings = 3 + siblingCount; const lastItemWithSiblings = totalPages - 2 - siblingCount; if (firstItemWithSiblings > lastItemWithSiblings) { for (let p = 2; p <= totalPages - 1; p++) { pagesToShow.add(p); } } else if (page2 < firstItemWithSiblings) { for (let p = 2; p <= Math.min(firstItemWithSiblings, totalPages); p++) { pagesToShow.add(p); } } else if (page2 > lastItemWithSiblings) { for (let p = totalPages - 1; p >= Math.max(lastItemWithSiblings, 2); p--) { pagesToShow.add(p); } } else { for (let p = Math.max(page2 - siblingCount, 2); p <= Math.min(page2 + siblingCount, totalPages); p++) { pagesToShow.add(p); } } const addPage = (value) => { pageItems.push({ type: "page", value, key: `page-${value}` }); }; const addEllipsis = () => { pageItems.push({ type: "ellipsis", key: `ellipsis-${pageItems.length}` }); }; let lastNumber = 0; for (const page3 of Array.from(pagesToShow).sort((a, b) => a - b)) { if (page3 - lastNumber > 1) { addEllipsis(); } addPage(page3); lastNumber = page3; } return pageItems; } const defaults = { perPage: 1, siblingCount: 1, defaultPage: 1 }; const { name, selector } = createElHelpers("pagination"); function createPagination(props) { const withDefaults = { ...defaults, ...props }; const pageWritable = withDefaults.page ?? writable(withDefaults.defaultPage); const page2 = overridable(pageWritable, withDefaults?.onPageChange); const options = toWritableStores(omit(withDefaults, "page", "onPageChange", "defaultPage")); const { perPage, siblingCount, count } = options; const totalPages = withGet.derived([count, perPage], ([$count, $perPage]) => { return Math.ceil($count / $perPage); }); const range = derived([page2, perPage, count], ([$page, $perPage, $count]) => { const start = ($page - 1) * $perPage; const end = Math.min(start + $perPage, $count); return { start, end }; }); const root = makeElement(name(), { returned: () => ({ "data-scope": "pagination" }) }); const pages = derived([page2, totalPages, siblingCount], ([$page, $totalPages, $siblingCount]) => { return getPageItems({ page: $page, totalPages: $totalPages, siblingCount: $siblingCount }); }); const keydown = (e) => { const thisEl = e.target; if (!isHTMLElement(thisEl)) return; const rootEl = thisEl.closest('[data-scope="pagination"]'); if (!isHTMLElement(rootEl)) return; const triggers = Array.from(rootEl.querySelectorAll(selector("page"))).filter((el) => isHTMLElement(el)); const prevButton2 = rootEl.querySelector(selector("prev")); const nextButton2 = rootEl.querySelector(selector("next")); if (isHTMLElement(prevButton2)) { triggers.unshift(prevButton2); } if (isHTMLElement(nextButton2)) { triggers.push(nextButton2); } const index = triggers.indexOf(thisEl); if (e.key === kbd.ARROW_LEFT && index !== 0) { e.preventDefault(); triggers[index - 1].focus(); } else if (e.key === kbd.ARROW_RIGHT && index !== triggers.length - 1) { e.preventDefault(); triggers[index + 1].focus(); } else if (e.key === kbd.HOME) { e.preventDefault(); triggers[0].focus(); } else if (e.key === kbd.END) { e.preventDefault(); triggers[triggers.length - 1].focus(); } }; const pageTrigger = makeElement(name("page"), { stores: page2, returned: ($page) => { return (pageItem) => { return { "aria-label": `Page ${pageItem.value}`, "data-value": pageItem.value, "data-selected": pageItem.value === $page ? "" : void 0 }; }; }, action: (node) => { const unsub = executeCallbacks(addMeltEventListener(node, "click", () => { const value = node.dataset.value; if (!value || Number.isNaN(+value)) return; page2.set(Number(value)); }), addMeltEventListener(node, "keydown", keydown)); return { destroy: unsub }; } }); const prevButton = makeElement(name("prev"), { stores: page2, returned: ($page) => { return { "aria-label": "Previous", disabled: $page <= 1 }; }, action: (node) => { const unsub = executeCallbacks(addMeltEventListener(node, "click", () => { page2.update((p) => Math.max(p - 1, 1)); }), addMeltEventListener(node, "keydown", keydown)); return { destroy: unsub }; } }); const nextButton = makeElement(name("next"), { stores: [page2, totalPages], returned: ([$page, $totalPages]) => { return { "aria-label": "Next", disabled: $page >= $totalPages }; }, action: (node) => { const unsub = executeCallbacks(addMeltEventListener(node, "click", () => { const $totalPages = totalPages.get(); page2.update((p) => Math.min(p + 1, $totalPages)); }), addMeltEventListener(node, "keydown", keydown)); return { destroy: unsub }; } }); return { elements: { root, pageTrigger, prevButton, nextButton }, states: { range: readonly(range), page: page2, pages: readonly(pages), totalPages: readonly(totalPages) }, options }; } function createSelect(props) { const listbox = createListbox({ ...props, builder: "select" }); const selectedLabel = derived(listbox.states.selected, ($selected) => { if (Array.isArray($selected)) { return $selected.map((o) => o.label).join(", "); } return $selected?.label ?? ""; }); return { ...listbox, elements: { ...listbox.elements }, states: { ...listbox.states, selectedLabel } }; } function arraysAreEqual(arr1, arr2) { if (arr1.length !== arr2.length) { return false; } return arr1.every((value, index) => value === arr2[index]); } const Dialog_title$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => { let builder; let $$restProps = compute_rest_props($$props, ["level", "asChild", "id", "el"]); let $title, $$unsubscribe_title; let { level = "h2" } = $$props; let { asChild = false } = $$props; let { id = void 0 } = $$props; let { el = void 0 } = $$props; const { elements: { title }, ids, getAttrs } = getCtx$2(); $$unsubscribe_title = subscribe(title, (value) => $title = value); const attrs = getAttrs("title"); if ($$props.level === void 0 && $$bindings.level && level !== void 0) $$bindings.level(level); if ($$props.asChild === void 0 && $$bindings.asChild && asChild !== void 0) $$bindings.asChild(asChild); if ($$props.id === void 0 && $$bindings.id && id !== void 0) $$bindings.id(id); if ($$props.el === void 0 && $$bindings.el && el !== void 0) $$bindings.el(el); { if (id) { ids.title.set(id); } } builder = $title; { Object.assign(builder, attrs); } $$unsubscribe_title(); return `${asChild ? `${slots.default ? slots.default({ builder }) : ``}` : `${((tag) => { return tag ? `<${level}${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${is_void(tag) ? "" : `${slots.default ? slots.default({ builder }) : ``}`}${is_void(tag) ? "" : ``}` : ""; })(level)}`}`; }); const Dialog_description$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => { let builder; let $$restProps = compute_rest_props($$props, ["asChild", "id", "el"]); let $description, $$unsubscribe_description; let { asChild = false } = $$props; let { id = void 0 } = $$props; let { el = void 0 } = $$props; const { elements: { description }, ids, getAttrs } = getCtx$2(); $$unsubscribe_description = subscribe(description, (value) => $description = value); const attrs = getAttrs("description"); if ($$props.asChild === void 0 && $$bindings.asChild && asChild !== void 0) $$bindings.asChild(asChild); if ($$props.id === void 0 && $$bindings.id && id !== void 0) $$bindings.id(id); if ($$props.el === void 0 && $$bindings.el && el !== void 0) $$bindings.el(el); { if (id) { ids.description.set(id); } } builder = $description; { Object.assign(builder, attrs); } $$unsubscribe_description(); return `${asChild ? `${slots.default ? slots.default({ builder }) : ``}` : `${slots.default ? slots.default({ builder }) : ``}`}`; }); function getPaginationData() { const NAME = "pagination"; const PARTS = ["root", "prev-button", "next-button", "page"]; return { NAME, PARTS }; } function setCtx$1(props) { const { NAME, PARTS } = getPaginationData(); const getAttrs = createBitAttrs(NAME, PARTS); const pagination = { ...createPagination(removeUndefined(props)), getAttrs }; setContext(NAME, pagination); return { ...pagination, updateOption: getOptionUpdater(pagination.options) }; } function getCtx$1() { const { NAME } = getPaginationData(); return getContext(NAME); } const Pagination$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => { let builder; let $$restProps = compute_rest_props($$props, ["count", "page", "onPageChange", "perPage", "siblingCount", "asChild", "el"]); let $root, $$unsubscribe_root; let $pages, $$unsubscribe_pages; let $range, $$unsubscribe_range; let { count } = $$props; let { page: page2 = void 0 } = $$props; let { onPageChange = void 0 } = $$props; let { perPage = void 0 } = $$props; let { siblingCount = void 0 } = $$props; let { asChild = false } = $$props; let { el = void 0 } = $$props; const { elements: { root }, states: { pages, range, page: localPage }, getAttrs, updateOption } = setCtx$1({ count, perPage, siblingCount, defaultPage: page2, onPageChange: ({ next: next2 }) => { if (page2 !== next2) { onPageChange?.(next2); page2 = next2; } return next2; } }); $$unsubscribe_root = subscribe(root, (value) => $root = value); $$unsubscribe_pages = subscribe(pages, (value) => $pages = value); $$unsubscribe_range = subscribe(range, (value) => $range = value); const attrs = getAttrs("root"); if ($$props.count === void 0 && $$bindings.count && count !== void 0) $$bindings.count(count); if ($$props.page === void 0 && $$bindings.page && page2 !== void 0) $$bindings.page(page2); if ($$props.onPageChange === void 0 && $$bindings.onPageChange && onPageChange !== void 0) $$bindings.onPageChange(onPageChange); if ($$props.perPage === void 0 && $$bindings.perPage && perPage !== void 0) $$bindings.perPage(perPage); if ($$props.siblingCount === void 0 && $$bindings.siblingCount && siblingCount !== void 0) $$bindings.siblingCount(siblingCount); if ($$props.asChild === void 0 && $$bindings.asChild && asChild !== void 0) $$bindings.asChild(asChild); if ($$props.el === void 0 && $$bindings.el && el !== void 0) $$bindings.el(el); page2 !== void 0 && localPage.set(page2); builder = $root; { Object.assign(builder, attrs); } { updateOption("count", count); } { updateOption("perPage", perPage); } { updateOption("siblingCount", siblingCount); } $$unsubscribe_root(); $$unsubscribe_pages(); $$unsubscribe_range(); return `${asChild ? `${slots.default ? slots.default({ builder, pages: $pages, range: $range }) : ``}` : `${slots.default ? slots.default({ builder, pages: $pages, range: $range }) : ``}`}`; }); const Pagination_page = create_ssr_component(($$result, $$props, $$bindings, slots) => { let builder; let $$restProps = compute_rest_props($$props, ["asChild", "page", "el"]); let $pageTrigger, $$unsubscribe_pageTrigger; let { asChild = void 0 } = $$props; let { page: page2 } = $$props; let { el = void 0 } = $$props; const { elements: { pageTrigger }, getAttrs } = getCtx$1(); $$unsubscribe_pageTrigger = subscribe(pageTrigger, (value) => $pageTrigger = value); const attrs = getAttrs("page"); createDispatcher(); if ($$props.asChild === void 0 && $$bindings.asChild && asChild !== void 0) $$bindings.asChild(asChild); if ($$props.page === void 0 && $$bindings.page && page2 !== void 0) $$bindings.page(page2); if ($$props.el === void 0 && $$bindings.el && el !== void 0) $$bindings.el(el); builder = $pageTrigger(page2); { Object.assign(builder, attrs); } $$unsubscribe_pageTrigger(); return `${asChild ? `${slots.default ? slots.default({ builder }) : ``}` : `${slots.default ? slots.default({ builder }) : ` ${escape(page2.value)} `}`}`; }); function getSelectData() { const NAME = "select"; const GROUP_NAME = "select-group"; const ITEM_NAME = "select-item"; const PARTS = [ "arrow", "content", "group", "item", "indicator", "input", "label", "trigger", "value" ]; return { NAME, GROUP_NAME, ITEM_NAME, PARTS }; } function getCtx() { const { NAME } = getSelectData(); return getContext(NAME); } function setCtx(props) { const { NAME, PARTS } = getSelectData(); const getAttrs = createBitAttrs(NAME, PARTS); const select = { ...createSelect({ ...removeUndefined(props), forceVisible: true }), getAttrs }; setContext(NAME, select); return { ...select, updateOption: getOptionUpdater(select.options) }; } function setGroupCtx() { const { GROUP_NAME } = getSelectData(); const id = generateId(); setContext(GROUP_NAME, id); const { elements: { group }, getAttrs } = getCtx(); return { group, id, getAttrs }; } function setItemCtx(value) { const { ITEM_NAME } = getSelectData(); const select = getCtx(); setContext(ITEM_NAME, value); return select; } function getItemIndicator() { const { ITEM_NAME } = getSelectData(); const { helpers: { isSelected }, getAttrs } = getCtx(); const value = getContext(ITEM_NAME); return { value, isSelected, getAttrs }; } function updatePositioning(props) { const defaultPlacement = { side: "bottom", align: "center", sameWidth: true }; const withDefaults = { ...defaultPlacement, ...props }; const { options: { positioning } } = getCtx(); const updater = getPositioningUpdater(positioning); updater(withDefaults); } const Select = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $idValues, $$unsubscribe_idValues; let { required = void 0 } = $$props; let { disabled = void 0 } = $$props; let { preventScroll = void 0 } = $$props; let { loop = void 0 } = $$props; let { closeOnEscape = void 0 } = $$props; let { closeOnOutsideClick = void 0 } = $$props; let { portal = void 0 } = $$props; let { name: name2 = void 0 } = $$props; let { multiple = false } = $$props; let { selected = void 0 } = $$props; let { onSelectedChange = void 0 } = $$props; let { open = void 0 } = $$props; let { onOpenChange = void 0 } = $$props; let { items = [] } = $$props; let { onOutsideClick = void 0 } = $$props; const { states: { open: localOpen, selected: localSelected }, updateOption, ids } = setCtx({ required, disabled, preventScroll, loop, closeOnEscape, closeOnOutsideClick, portal, name: name2, onOutsideClick, multiple, forceVisible: true, defaultSelected: Array.isArray(selected) ? [...selected] : selected, defaultOpen: open, onSelectedChange: ({ next: next2 }) => { if (Array.isArray(next2)) { if (!Array.isArray(selected) || !arraysAreEqual(selected, next2)) { onSelectedChange?.(next2); selected = next2; return next2; } return next2; } if (selected !== next2) { onSelectedChange?.(next2); selected = next2; } return next2; }, onOpenChange: ({ next: next2 }) => { if (open !== next2) { onOpenChange?.(next2); open = next2; } return next2; }, items }); const idValues = derived([ids.menu, ids.trigger, ids.label], ([$menuId, $triggerId, $labelId]) => ({ menu: $menuId, trigger: $triggerId, label: $labelId })); $$unsubscribe_idValues = subscribe(idValues, (value) => $idValues = value); if ($$props.required === void 0 && $$bindings.required && required !== void 0) $$bindings.required(required); if ($$props.disabled === void 0 && $$bindings.disabled && disabled !== void 0) $$bindings.disabled(disabled); if ($$props.preventScroll === void 0 && $$bindings.preventScroll && preventScroll !== void 0) $$bindings.preventScroll(preventScroll); if ($$props.loop === void 0 && $$bindings.loop && loop !== void 0) $$bindings.loop(loop); if ($$props.closeOnEscape === void 0 && $$bindings.closeOnEscape && closeOnEscape !== void 0) $$bindings.closeOnEscape(closeOnEscape); if ($$props.closeOnOutsideClick === void 0 && $$bindings.closeOnOutsideClick && closeOnOutsideClick !== void 0) $$bindings.closeOnOutsideClick(closeOnOutsideClick); if ($$props.portal === void 0 && $$bindings.portal && portal !== void 0) $$bindings.portal(portal); if ($$props.name === void 0 && $$bindings.name && name2 !== void 0) $$bindings.name(name2); if ($$props.multiple === void 0 && $$bindings.multiple && multiple !== void 0) $$bindings.multiple(multiple); if ($$props.selected === void 0 && $$bindings.selected && selected !== void 0) $$bindings.selected(selected); if ($$props.onSelectedChange === void 0 && $$bindings.onSelectedChange && onSelectedChange !== void 0) $$bindings.onSelectedChange(onSelectedChange); if ($$props.open === void 0 && $$bindings.open && open !== void 0) $$bindings.open(open); if ($$props.onOpenChange === void 0 && $$bindings.onOpenChange && onOpenChange !== void 0) $$bindings.onOpenChange(onOpenChange); if ($$props.items === void 0 && $$bindings.items && items !== void 0) $$bindings.items(items); if ($$props.onOutsideClick === void 0 && $$bindings.onOutsideClick && onOutsideClick !== void 0) $$bindings.onOutsideClick(onOutsideClick); open !== void 0 && localOpen.set(open); selected !== void 0 && localSelected.set(Array.isArray(selected) ? [...selected] : selected); { updateOption("required", required); } { updateOption("disabled", disabled); } { updateOption("preventScroll", preventScroll); } { updateOption("loop", loop); } { updateOption("closeOnEscape", closeOnEscape); } { updateOption("closeOnOutsideClick", closeOnOutsideClick); } { updateOption("portal", portal); } { updateOption("name", name2); } { updateOption("multiple", multiple); } { updateOption("onOutsideClick", onOutsideClick); } $$unsubscribe_idValues(); return `${slots.default ? slots.default({ ids: $idValues }) : ``}`; }); const Select_content$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => { let builder; let $$restProps = compute_rest_props($$props, [ "transition", "transitionConfig", "inTransition", "inTransitionConfig", "outTransition", "outTransitionConfig", "asChild", "id", "side", "align", "sideOffset", "alignOffset", "collisionPadding", "avoidCollisions", "collisionBoundary", "sameWidth", "fitViewport", "strategy", "overlap", "el" ]); let $open, $$unsubscribe_open; let $menu, $$unsubscribe_menu; let { transition = void 0 } = $$props; let { transitionConfig = void 0 } = $$props; let { inTransition = void 0 } = $$props; let { inTransitionConfig = void 0 } = $$props; let { outTransition = void 0 } = $$props; let { outTransitionConfig = void 0 } = $$props; let { asChild = false } = $$props; let { id = void 0 } = $$props; let { side = "bottom" } = $$props; let { align = "center" } = $$props; let { sideOffset = 0 } = $$props; let { alignOffset = 0 } = $$props; let { collisionPadding = 8 } = $$props; let { avoidCollisions = true } = $$props; let { collisionBoundary = void 0 } = $$props; let { sameWidth = true } = $$props; let { fitViewport = false } = $$props; let { strategy = "absolute" } = $$props; let { overlap = false } = $$props; let { el = void 0 } = $$props; const { elements: { menu }, states: { open }, ids, getAttrs } = getCtx(); $$unsubscribe_menu = subscribe(menu, (value) => $menu = value); $$unsubscribe_open = subscribe(open, (value) => $open = value); createDispatcher(); const attrs = getAttrs("content"); if ($$props.transition === void 0 && $$bindings.transition && transition !== void 0) $$bindings.transition(transition); if ($$props.transitionConfig === void 0 && $$bindings.transitionConfig && transitionConfig !== void 0) $$bindings.transitionConfig(transitionConfig); if ($$props.inTransition === void 0 && $$bindings.inTransition && inTransition !== void 0) $$bindings.inTransition(inTransition); if ($$props.inTransitionConfig === void 0 && $$bindings.inTransitionConfig && inTransitionConfig !== void 0) $$bindings.inTransitionConfig(inTransitionConfig); if ($$props.outTransition === void 0 && $$bindings.outTransition && outTransition !== void 0) $$bindings.outTransition(outTransition); if ($$props.outTransitionConfig === void 0 && $$bindings.outTransitionConfig && outTransitionConfig !== void 0) $$bindings.outTransitionConfig(outTransitionConfig); if ($$props.asChild === void 0 && $$bindings.asChild && asChild !== void 0) $$bindings.asChild(asChild); if ($$props.id === void 0 && $$bindings.id && id !== void 0) $$bindings.id(id); if ($$props.side === void 0 && $$bindings.side && side !== void 0) $$bindings.side(side); if ($$props.align === void 0 && $$bindings.align && align !== void 0) $$bindings.align(align); if ($$props.sideOffset === void 0 && $$bindings.sideOffset && sideOffset !== void 0) $$bindings.sideOffset(sideOffset); if ($$props.alignOffset === void 0 && $$bindings.alignOffset && alignOffset !== void 0) $$bindings.alignOffset(alignOffset); if ($$props.collisionPadding === void 0 && $$bindings.collisionPadding && collisionPadding !== void 0) $$bindings.collisionPadding(collisionPadding); if ($$props.avoidCollisions === void 0 && $$bindings.avoidCollisions && avoidCollisions !== void 0) $$bindings.avoidCollisions(avoidCollisions); if ($$props.collisionBoundary === void 0 && $$bindings.collisionBoundary && collisionBoundary !== void 0) $$bindings.collisionBoundary(collisionBoundary); if ($$props.sameWidth === void 0 && $$bindings.sameWidth && sameWidth !== void 0) $$bindings.sameWidth(sameWidth); if ($$props.fitViewport === void 0 && $$bindings.fitViewport && fitViewport !== void 0) $$bindings.fitViewport(fitViewport); if ($$props.strategy === void 0 && $$bindings.strategy && strategy !== void 0) $$bindings.strategy(strategy); if ($$props.overlap === void 0 && $$bindings.overlap && overlap !== void 0) $$bindings.overlap(overlap); if ($$props.el === void 0 && $$bindings.el && el !== void 0) $$bindings.el(el); { if (id) { ids.menu.set(id); } } builder = $menu; { Object.assign(builder, attrs); } { if ($open) { updatePositioning({ side, align, sideOffset, alignOffset, collisionPadding, avoidCollisions, collisionBoundary, sameWidth, fitViewport, strategy, overlap }); } } $$unsubscribe_open(); $$unsubscribe_menu(); return ` ${asChild && $open ? `${slots.default ? slots.default({ builder }) : ``}` : `${transition && $open ? `${slots.default ? slots.default({ builder }) : ``}` : `${inTransition && outTransition && $open ? `${slots.default ? slots.default({ builder }) : ``}` : `${inTransition && $open ? `${slots.default ? slots.default({ builder }) : ``}` : `${outTransition && $open ? `${slots.default ? slots.default({ builder }) : ``}` : `${$open ? `${slots.default ? slots.default({ builder }) : ``}` : ``}`}`}`}`}`}`; }); const Select_group = create_ssr_component(($$result, $$props, $$bindings, slots) => { let builder; let $$restProps = compute_rest_props($$props, ["asChild", "el"]); let $group, $$unsubscribe_group; let { asChild = false } = $$props; let { el = void 0 } = $$props; const { group, id, getAttrs } = setGroupCtx(); $$unsubscribe_group = subscribe(group, (value) => $group = value); const attrs = getAttrs("group"); if ($$props.asChild === void 0 && $$bindings.asChild && asChild !== void 0) $$bindings.asChild(asChild); if ($$props.el === void 0 && $$bindings.el && el !== void 0) $$bindings.el(el); builder = $group(id); { Object.assign(builder, attrs); } $$unsubscribe_group(); return `${asChild ? `${slots.default ? slots.default({ builder }) : ``}` : `${slots.default ? slots.default({ builder }) : ``}`}`; }); const Select_input = create_ssr_component(($$result, $$props, $$bindings, slots) => { let attrs; let builder; let $$restProps = compute_rest_props($$props, ["asChild", "el"]); let $hiddenInput, $$unsubscribe_hiddenInput; let $disabled, $$unsubscribe_disabled; let { asChild = false } = $$props; let { el = void 0 } = $$props; const { elements: { hiddenInput }, options: { disabled }, getAttrs } = getCtx(); $$unsubscribe_hiddenInput = subscribe(hiddenInput, (value) => $hiddenInput = value); $$unsubscribe_disabled = subscribe(disabled, (value) => $disabled = value); if ($$props.asChild === void 0 && $$bindings.asChild && asChild !== void 0) $$bindings.asChild(asChild); if ($$props.el === void 0 && $$bindings.el && el !== void 0) $$bindings.el(el); attrs = { ...getAttrs("input"), disabled: $disabled ? true : void 0 }; builder = $hiddenInput; { Object.assign(builder, attrs); } $$unsubscribe_hiddenInput(); $$unsubscribe_disabled(); return `${asChild ? `${slots.default ? slots.default({ builder }) : ``}` : ``}`; }); const Select_item$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => { let builder; let isSelected; let $$restProps = compute_rest_props($$props, ["value", "disabled", "label", "asChild", "el"]); let $isSelectedStore, $$unsubscribe_isSelectedStore; let $item, $$unsubscribe_item; let { value } = $$props; let { disabled = void 0 } = $$props; let { label = void 0 } = $$props; let { asChild = false } = $$props; let { el = void 0 } = $$props; const { elements: { option: item }, helpers: { isSelected: isSelectedStore }, getAttrs } = setItemCtx(value); $$unsubscribe_item = subscribe(item, (value2) => $item = value2); $$unsubscribe_isSelectedStore = subscribe(isSelectedStore, (value2) => $isSelectedStore = value2); createDispatcher(); const attrs = getAttrs("item"); if ($$props.value === void 0 && $$bindings.value && value !== void 0) $$bindings.value(value); if ($$props.disabled === void 0 && $$bindings.disabled && disabled !== void 0) $$bindings.disabled(disabled); if ($$props.label === void 0 && $$bindings.label && label !== void 0) $$bindings.label(label); if ($$props.asChild === void 0 && $$bindings.asChild && asChild !== void 0) $$bindings.asChild(asChild); if ($$props.el === void 0 && $$bindings.el && el !== void 0) $$bindings.el(el); builder = $item({ value, disabled, label }); { Object.assign(builder, attrs); } isSelected = $isSelectedStore(value); $$unsubscribe_isSelectedStore(); $$unsubscribe_item(); return ` ${asChild ? `${slots.default ? slots.default({ builder, isSelected }) : ``}` : `${slots.default ? slots.default({ builder, isSelected }) : ` ${escape(label || value)} `}`}`; }); const Select_item_indicator = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["asChild", "el"]); let $isSelected, $$unsubscribe_isSelected; let { asChild = false } = $$props; let { el = void 0 } = $$props; const { isSelected, value, getAttrs } = getItemIndicator(); $$unsubscribe_isSelected = subscribe(isSelected, (value2) => $isSelected = value2); const attrs = getAttrs("indicator"); if ($$props.asChild === void 0 && $$bindings.asChild && asChild !== void 0) $$bindings.asChild(asChild); if ($$props.el === void 0 && $$bindings.el && el !== void 0) $$bindings.el(el); $$unsubscribe_isSelected(); return `${asChild ? `${slots.default ? slots.default({ attrs, isSelected: $isSelected(value) }) : ``}` : `${$isSelected(value) ? `${slots.default ? slots.default({ attrs, isSelected: $isSelected(value) }) : ``}` : ``}`}`; }); const Select_trigger = create_ssr_component(($$result, $$props, $$bindings, slots) => { let builder; let $$restProps = compute_rest_props($$props, ["asChild", "id", "el"]); let $trigger, $$unsubscribe_trigger; let { asChild = false } = $$props; let { id = void 0 } = $$props; let { el = void 0 } = $$props; const { elements: { trigger }, ids, getAttrs } = getCtx(); $$unsubscribe_trigger = subscribe(trigger, (value) => $trigger = value); createDispatcher(); const attrs = getAttrs("trigger"); if ($$props.asChild === void 0 && $$bindings.asChild && asChild !== void 0) $$bindings.asChild(asChild); if ($$props.id === void 0 && $$bindings.id && id !== void 0) $$bindings.id(id); if ($$props.el === void 0 && $$bindings.el && el !== void 0) $$bindings.el(el); { if (id) { ids.trigger.set(id); } } builder = $trigger; { Object.assign(builder, attrs); } $$unsubscribe_trigger(); return `${asChild ? `${slots.default ? slots.default({ builder }) : ``}` : `${slots.default ? slots.default({ builder }) : ``}`}`; }); const Select_value = create_ssr_component(($$result, $$props, $$bindings, slots) => { let label; let $$restProps = compute_rest_props($$props, ["placeholder", "asChild", "el"]); let $selectedLabel, $$unsubscribe_selectedLabel; let { placeholder = "" } = $$props; let { asChild = false } = $$props; let { el = void 0 } = $$props; const { states: { selectedLabel }, getAttrs } = getCtx(); $$unsubscribe_selectedLabel = subscribe(selectedLabel, (value) => $selectedLabel = value); const attrs = getAttrs("value"); if ($$props.placeholder === void 0 && $$bindings.placeholder && placeholder !== void 0) $$bindings.placeholder(placeholder); if ($$props.asChild === void 0 && $$bindings.asChild && asChild !== void 0) $$bindings.asChild(asChild); if ($$props.el === void 0 && $$bindings.el && el !== void 0) $$bindings.el(el); label = $selectedLabel; $$unsubscribe_selectedLabel(); return `${asChild ? `${slots.default ? slots.default({ label, attrs }) : ``}` : `${escape(label || placeholder)}`}`; }); const Check = create_ssr_component(($$result, $$props, $$bindings, slots) => { const iconNode = [["path", { "d": "M20 6 9 17l-5-5" }]]; return `${validate_component(Icon$1, "Icon").$$render($$result, Object.assign({}, { name: "check" }, $$props, { iconNode }), {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } })}`; }); const Check$1 = Check; const Dialog_title = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class"]); let { class: className = void 0 } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); return `${validate_component(Dialog_title$1, "DialogPrimitive.Title").$$render( $$result, Object.assign( {}, { class: cn("text-lg font-semibold leading-none tracking-tight", className) }, $$restProps ), {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } } )}`; }); const Dialog_portal = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, []); return `${validate_component(Dialog_portal$1, "DialogPrimitive.Portal").$$render($$result, Object.assign({}, $$restProps), {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } })}`; }); const Dialog_footer = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class"]); let { class: className = void 0 } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); return `${slots.default ? slots.default({}) : ``}`; }); const Dialog_header = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class"]); let { class: className = void 0 } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); return `${slots.default ? slots.default({}) : ``}`; }); const Dialog_overlay = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class", "transition", "transitionConfig"]); let { class: className = void 0 } = $$props; let { transition = fade } = $$props; let { transitionConfig = { duration: 150 } } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); if ($$props.transition === void 0 && $$bindings.transition && transition !== void 0) $$bindings.transition(transition); if ($$props.transitionConfig === void 0 && $$bindings.transitionConfig && transitionConfig !== void 0) $$bindings.transitionConfig(transitionConfig); return `${validate_component(Dialog_overlay$1, "DialogPrimitive.Overlay").$$render( $$result, Object.assign( {}, { transition }, { transitionConfig }, { class: cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm", className) }, $$restProps ), {}, {} )}`; }); const Dialog_content = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class", "transition", "transitionConfig"]); let { class: className = void 0 } = $$props; let { transition = flyAndScale } = $$props; let { transitionConfig = { duration: 200 } } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); if ($$props.transition === void 0 && $$bindings.transition && transition !== void 0) $$bindings.transition(transition); if ($$props.transitionConfig === void 0 && $$bindings.transitionConfig && transitionConfig !== void 0) $$bindings.transitionConfig(transitionConfig); return `${validate_component(Dialog_portal, "Dialog.Portal").$$render($$result, {}, {}, { default: () => { return `${validate_component(Dialog_overlay, "Dialog.Overlay").$$render($$result, {}, {}, {})} ${validate_component(Dialog_content$1, "DialogPrimitive.Content").$$render( $$result, Object.assign( {}, { transition }, { transitionConfig }, { class: cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg sm:rounded-lg md:w-full", className) }, $$restProps ), {}, { default: () => { return `${slots.default ? slots.default({}) : ``} ${validate_component(Dialog_close, "DialogPrimitive.Close").$$render( $$result, { class: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground" }, {}, { default: () => { return `${validate_component(X$1, "X").$$render($$result, { class: "h-4 w-4" }, {}, {})} Close`; } } )}`; } } )}`; } })}`; }); const Dialog_description = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class"]); let { class: className = void 0 } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); return `${validate_component(Dialog_description$1, "DialogPrimitive.Description").$$render( $$result, Object.assign( {}, { class: cn("text-sm text-muted-foreground", className) }, $$restProps ), {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } } )}`; }); const Root$1 = Dialog; const Trigger = Dialog_trigger; const Ellipsis = create_ssr_component(($$result, $$props, $$bindings, slots) => { const iconNode = [ ["circle", { "cx": "12", "cy": "12", "r": "1" }], ["circle", { "cx": "19", "cy": "12", "r": "1" }], ["circle", { "cx": "5", "cy": "12", "r": "1" }] ]; return `${validate_component(Icon$1, "Icon").$$render($$result, Object.assign({}, { name: "ellipsis" }, $$props, { iconNode }), {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } })}`; }); const Ellipsis$1 = Ellipsis; const External_link = create_ssr_component(($$result, $$props, $$bindings, slots) => { const iconNode = [ ["path", { "d": "M15 3h6v6" }], ["path", { "d": "M10 14 21 3" }], [ "path", { "d": "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" } ] ]; return `${validate_component(Icon$1, "Icon").$$render($$result, Object.assign({}, { name: "external-link" }, $$props, { iconNode }), {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } })}`; }); const ExternalLink = External_link; const Eye_off = create_ssr_component(($$result, $$props, $$bindings, slots) => { const iconNode = [ ["path", { "d": "M9.88 9.88a3 3 0 1 0 4.24 4.24" }], [ "path", { "d": "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" } ], [ "path", { "d": "M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" } ], [ "line", { "x1": "2", "x2": "22", "y1": "2", "y2": "22" } ] ]; return `${validate_component(Icon$1, "Icon").$$render($$result, Object.assign({}, { name: "eye-off" }, $$props, { iconNode }), {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } })}`; }); const EyeOff = Eye_off; const Eye = create_ssr_component(($$result, $$props, $$bindings, slots) => { const iconNode = [ [ "path", { "d": "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" } ], ["circle", { "cx": "12", "cy": "12", "r": "3" }] ]; return `${validate_component(Icon$1, "Icon").$$render($$result, Object.assign({}, { name: "eye" }, $$props, { iconNode }), {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } })}`; }); const Eye$1 = Eye; const Loader_circle = create_ssr_component(($$result, $$props, $$bindings, slots) => { const iconNode = [["path", { "d": "M21 12a9 9 0 1 1-6.219-8.56" }]]; return `${validate_component(Icon$1, "Icon").$$render($$result, Object.assign({}, { name: "loader-circle" }, $$props, { iconNode }), {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } })}`; }); const Loader2 = Loader_circle; const Pen = create_ssr_component(($$result, $$props, $$bindings, slots) => { const iconNode = [ [ "path", { "d": "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z" } ] ]; return `${validate_component(Icon$1, "Icon").$$render($$result, Object.assign({}, { name: "pen" }, $$props, { iconNode }), {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } })}`; }); const Pen$1 = Pen; const Trash = create_ssr_component(($$result, $$props, $$bindings, slots) => { const iconNode = [ ["path", { "d": "M3 6h18" }], [ "path", { "d": "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" } ], [ "path", { "d": "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" } ] ]; return `${validate_component(Icon$1, "Icon").$$render($$result, Object.assign({}, { name: "trash" }, $$props, { iconNode }), {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } })}`; }); const Trash$1 = Trash; const Tooltipbutton = create_ssr_component(($$result, $$props, $$bindings, slots) => { let { tip = "" } = $$props; let { variant = "" } = $$props; let { size = "" } = $$props; let { class: className = "" } = $$props; if ($$props.tip === void 0 && $$bindings.tip && tip !== void 0) $$bindings.tip(tip); if ($$props.variant === void 0 && $$bindings.variant && variant !== void 0) $$bindings.variant(variant); if ($$props.size === void 0 && $$bindings.size && size !== void 0) $$bindings.size(size); if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); return `${validate_component(Root$2, "Tooltip.Root").$$render($$result, {}, {}, { default: () => { return `${validate_component(Trigger$1, "Tooltip.Trigger").$$render($$result, { asChild: true }, {}, { default: ({ builder }) => { return `${validate_component(Button, "Button").$$render( $$result, { class: className, builders: [builder], variant, size }, {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } } )}`; } })} ${validate_component(Tooltip_content, "Tooltip.Content").$$render($$result, {}, {}, { default: () => { return `

${escape(tip)}

`; } })}`; } })}`; }); const Badge = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class", "href", "variant"]); let { class: className = void 0 } = $$props; let { href = void 0 } = $$props; let { variant = "default" } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); if ($$props.href === void 0 && $$bindings.href && href !== void 0) $$bindings.href(href); if ($$props.variant === void 0 && $$bindings.variant && variant !== void 0) $$bindings.variant(variant); return `${((tag) => { return tag ? `<${href ? "a" : "span"}${spread( [ { href: escape_attribute_value(href) }, { class: escape_attribute_value(cn(badgeVariants({ variant, className }))) }, escape_object($$restProps) ], {} )}>${is_void(tag) ? "" : `${slots.default ? slots.default({}) : ``}`}${is_void(tag) ? "" : ``}` : ""; })(href ? "a" : "span")}`; }); const badgeVariants = tv({ base: "inline-flex select-none items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", variants: { variant: { default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", outline: "text-foreground" } }, defaultVariants: { variant: "default" } }); const Select_item = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class", "value", "label", "disabled"]); let { class: className = void 0 } = $$props; let { value } = $$props; let { label = void 0 } = $$props; let { disabled = void 0 } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); if ($$props.value === void 0 && $$bindings.value && value !== void 0) $$bindings.value(value); if ($$props.label === void 0 && $$bindings.label && label !== void 0) $$bindings.label(label); if ($$props.disabled === void 0 && $$bindings.disabled && disabled !== void 0) $$bindings.disabled(disabled); return `${validate_component(Select_item$1, "SelectPrimitive.Item").$$render( $$result, Object.assign( {}, { value }, { disabled }, { label }, { class: cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50", className) }, $$restProps ), {}, { default: () => { return `${validate_component(Select_item_indicator, "SelectPrimitive.ItemIndicator").$$render($$result, {}, {}, { default: () => { return `${validate_component(Check$1, "Check").$$render($$result, { class: "h-4 w-4" }, {}, {})}`; } })} ${slots.default ? slots.default({}) : ` ${escape(label || value)} `}`; } } )}`; }); const Select_content = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, [ "sideOffset", "inTransition", "inTransitionConfig", "outTransition", "outTransitionConfig", "class" ]); let { sideOffset = 4 } = $$props; let { inTransition = flyAndScale } = $$props; let { inTransitionConfig = void 0 } = $$props; let { outTransition = scale } = $$props; let { outTransitionConfig = { start: 0.95, opacity: 0, duration: 50 } } = $$props; let { class: className = void 0 } = $$props; if ($$props.sideOffset === void 0 && $$bindings.sideOffset && sideOffset !== void 0) $$bindings.sideOffset(sideOffset); if ($$props.inTransition === void 0 && $$bindings.inTransition && inTransition !== void 0) $$bindings.inTransition(inTransition); if ($$props.inTransitionConfig === void 0 && $$bindings.inTransitionConfig && inTransitionConfig !== void 0) $$bindings.inTransitionConfig(inTransitionConfig); if ($$props.outTransition === void 0 && $$bindings.outTransition && outTransition !== void 0) $$bindings.outTransition(outTransition); if ($$props.outTransitionConfig === void 0 && $$bindings.outTransitionConfig && outTransitionConfig !== void 0) $$bindings.outTransitionConfig(outTransitionConfig); if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); return `${validate_component(Select_content$1, "SelectPrimitive.Content").$$render( $$result, Object.assign( {}, { inTransition }, { inTransitionConfig }, { outTransition }, { outTransitionConfig }, { sideOffset }, { class: cn("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md outline-none", className) }, $$restProps ), {}, { default: () => { return `
${slots.default ? slots.default({}) : ``}
`; } } )}`; }); const Root = Select; const Group = Select_group; const Input = Select_input; const CreateArticleDialog = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["videos", "tier", "form"]); let $formData, $$unsubscribe_formData; let $$unsubscribe_errors; let $page, $$unsubscribe_page; $$unsubscribe_page = subscribe(page, (value) => $page = value); let { videos } = $$props; let { tier } = $$props; let { form: data = $page.data.switch } = $$props; const form = superForm(data, { validators: zodClient(createFormSchema) }); const { form: formData, enhance, errors } = form; $$unsubscribe_formData = subscribe(formData, (value) => $formData = value); $$unsubscribe_errors = subscribe(errors, (value) => value); let open = false; errors.subscribe((x) => { x._errors?.forEach((x2) => toast.error(x2, { dismissable: true, duration: 0 })); }); if ($$props.videos === void 0 && $$bindings.videos && videos !== void 0) $$bindings.videos(videos); if ($$props.tier === void 0 && $$bindings.tier && tier !== void 0) $$bindings.tier(tier); if ($$props.form === void 0 && $$bindings.form && data !== void 0) $$bindings.form(data); let $$settled; let $$rendered; let previous_head = $$result.head; do { $$settled = true; $$result.head = previous_head; { { console.log($formData.video_id); } } $$rendered = `${validate_component(Root$1, "Dialog.Root").$$render( $$result, { open }, { open: ($$value) => { open = $$value; $$settled = false; } }, { default: () => { return `${validate_component(Trigger, "Dialog.Trigger").$$render( $$result, { class: buttonVariants({ variant: "default" }) }, {}, { default: () => { return `Create Article`; } } )} ${validate_component(Dialog_content, "Dialog.Content").$$render($$result, { class: "w-full sm:max-w-[750px]" }, {}, { default: () => { return `${validate_component(Dialog_header, "Dialog.Header").$$render($$result, {}, {}, { default: () => { return `${validate_component(Dialog_title, "Dialog.Title").$$render($$result, {}, {}, { default: () => { return `Create Article`; } })} ${validate_component(Dialog_description, "Dialog.Description").$$render($$result, {}, {}, { default: () => { return `Configure your article and let our AI do the writing!`; } })}`; } })}
${validate_component(Form_field, "Form.Field").$$render($$result, { form, name: "video_id" }, {}, { default: () => { return `${validate_component(Control, "Form.Control").$$render($$result, {}, {}, { default: ({ attrs }) => { return `
${validate_component(Form_label, "Form.Label").$$render($$result, { class: "text-right" }, {}, { default: () => { return `Youtube video link*`; } })} ${validate_component(Root, "Select.Root").$$render($$result, {}, {}, { default: () => { return `${validate_component(Select_trigger, "SelectPrimitive.Trigger").$$render( $$result, Object.assign( {}, { class: cn("col-span-2 flex h-10 w-[300px] items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1") }, $$restProps, { asChild: true } ), {}, { default: ({ builder }) => { return ` ${validate_component(Select_value, "SelectPrimitive.Value").$$render($$result, { asChild: true }, {}, { default: () => { return `${validate_component(Input$1, "Input").$$render( $$result, Object.assign( {}, { placeholder: "Paste a video link or select a video" }, { class: "col-span-2 w-[300px]" }, attrs, { value: $formData.video_id } ), { value: ($$value) => { $formData.video_id = $$value; $$settled = false; } }, {} )}`; } })}
`; } } )} ${validate_component(Select_content, "Select.Content").$$render($$result, {}, {}, { default: () => { return `${validate_component(Group, "Select.Group").$$render($$result, {}, {}, { default: () => { return `${each(videos, (video) => { return `${validate_component(Select_item, "Select.Item").$$render( $$result, { value: video.snippet.resourceId.videoId, label: video.snippet.title }, {}, { default: () => { return `${escape(video.snippet.title)} `; } } )}`; })}`; } })}`; } })} ${validate_component(Input, "Select.Input").$$render( $$result, Object.assign({}, attrs, { value: $formData.video_id }), { value: ($$value) => { $formData.video_id = $$value; $$settled = false; } }, {} )}`; } })}
${validate_component(Form_description, "Form.Description").$$render($$result, {}, {}, { default: () => { return `The video must have English captions`; } })}`; } })}
${validate_component(Form_field_errors, "Form.FieldErrors").$$render($$result, { class: "col-start-2 mb-2" }, {}, {})}
`; } })}
${validate_component(Dialog_footer, "Dialog.Footer").$$render($$result, {}, {}, { default: () => { return `${validate_component(Button, "Button").$$render($$result, { type: "submit", form: "blog-converter" }, {}, { default: () => { return `Create`; } })}`; } })}`; } })}`; } } )}`; } while (!$$settled); $$unsubscribe_formData(); $$unsubscribe_errors(); $$unsubscribe_page(); return $$rendered; }); const EditArticleDialog = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $page, $$unsubscribe_page; let $formData, $$unsubscribe_formData; $$unsubscribe_page = subscribe(page, (value) => $page = value); let { form: data = $page.data.switch } = $$props; let { article_data } = $$props; const form = superForm(data, { validators: zodClient(editFormSchema), onSubmit: ({}) => { toast.success("Article edited successfully."); article_data = null; } }); const { form: formData, enhance } = form; $$unsubscribe_formData = subscribe(formData, (value) => $formData = value); if ($$props.form === void 0 && $$bindings.form && data !== void 0) $$bindings.form(data); if ($$props.article_data === void 0 && $$bindings.article_data && article_data !== void 0) $$bindings.article_data(article_data); let $$settled; let $$rendered; let previous_head = $$result.head; do { $$settled = true; $$result.head = previous_head; { { if (article_data !== null) formData.set(article_data || {}); } } $$rendered = `${validate_component(Root$1, "Dialog.Root").$$render($$result, { open: article_data !== null }, {}, { default: () => { return `${validate_component(Dialog_content, "Dialog.Content").$$render($$result, { class: "w-full sm:max-w-[750px]" }, {}, { default: () => { return `${validate_component(Dialog_header, "Dialog.Header").$$render($$result, {}, {}, { default: () => { return `${validate_component(Dialog_title, "Dialog.Title").$$render($$result, {}, {}, { default: () => { return `Edit Article`; } })} ${validate_component(Dialog_description, "Dialog.Description").$$render($$result, {}, {}, {})}`; } })}
${validate_component(Form_field, "Form.Field").$$render($$result, { form, name: "blog_editor" }, {}, { default: () => { return `${validate_component(Control, "Form.Control").$$render($$result, {}, {}, { default: ({ attrs }) => { return `${validate_component(Input$1, "Input").$$render( $$result, { name: "id", id: "id", value: article_data?.id, class: "hidden", readonly: true }, {}, {} )}
${validate_component(Label, "Label").$$render($$result, { for: "is_public_switch" }, {}, { default: () => { return `Public`; } })} ${validate_component(Switch, "Switch").$$render( $$result, { name: "is_public", checked: $formData.is_public }, { checked: ($$value) => { $formData.is_public = $$value; $$settled = false; } }, {} )}
${validate_component(Input$1, "Input").$$render( $$result, { value: article_data?.title, name: "title" }, {}, {} )}
${validate_component(Textarea, "Textarea").$$render( $$result, { name: "content", value: article_data?.content, class: "h-80" }, {}, {} )}

Manually edit your article with Markdown

`; } })}`; } })}
${validate_component(Dialog_footer, "Dialog.Footer").$$render($$result, {}, {}, { default: () => { return `${validate_component(Button, "Button").$$render($$result, { type: "submit", form: "blog_editor" }, {}, { default: () => { return `Submit`; } })}`; } })}`; } })}`; } })}`; } while (!$$settled); $$unsubscribe_page(); $$unsubscribe_formData(); return $$rendered; }); const ArticleQueue = create_ssr_component(($$result, $$props, $$bindings, slots) => { let queue; let open = false; onDestroy(() => { }); let $$settled; let $$rendered; let previous_head = $$result.head; do { $$settled = true; $$result.head = previous_head; $$rendered = `${validate_component(Root$1, "Dialog.Root").$$render( $$result, { open }, { open: ($$value) => { open = $$value; $$settled = false; } }, { default: () => { return `${validate_component(Trigger, "Dialog.Trigger").$$render( $$result, { class: buttonVariants({ variant: "outline" }) }, {}, { default: () => { return `${validate_component(Badge, "Badge").$$render($$result, { class: "p-1.5 w-5 h-5 text-center mr-2" }, {}, { default: () => { return `${escape(0)}`; } })}Queue`; } } )} ${validate_component(Dialog_content, "Dialog.Content").$$render($$result, { class: "w-full sm:max-w-[750px]" }, {}, { default: () => { return `${validate_component(Dialog_header, "Dialog.Header").$$render($$result, {}, {}, { default: () => { return `${validate_component(Dialog_title, "Dialog.Title").$$render($$result, {}, {}, { default: () => { return `Queue`; } })} ${validate_component(Dialog_description, "Dialog.Description").$$render($$result, {}, {}, {})}`; } })} ${queue.find((x) => !["done", "error"].includes(x.status)) === 0 ? `

No articles are currently being generated!

` : `${validate_component(Table, "Table.Root").$$render($$result, {}, {}, { default: () => { return `${validate_component(Table_header, "Table.Header").$$render($$result, {}, {}, { default: () => { return `${validate_component(Table_row, "Table.Row").$$render($$result, {}, {}, { default: () => { return `${validate_component(Table_head, "Table.Head").$$render($$result, { class: "w-[100px]" }, {}, { default: () => { return `Video ID`; } })} ${validate_component(Table_head, "Table.Head").$$render($$result, { class: "w-[200px]" }, {}, { default: () => { return `Title`; } })} ${validate_component(Table_head, "Table.Head").$$render($$result, {}, {}, { default: () => { return `Status`; } })}`; } })}`; } })} ${validate_component(Table_body, "Table.Body").$$render($$result, {}, {}, { default: () => { return `${each(queue, (item, i) => { return `${validate_component(Table_row, "Table.Row").$$render($$result, {}, {}, { default: () => { return `${validate_component(Table_cell, "Table.Cell").$$render($$result, { class: "font-medium" }, {}, { default: () => { return `

${escape(item.source_id)}

`; } })} ${validate_component(Table_cell, "Table.Cell").$$render($$result, { class: "w-[200px]" }, {}, { default: () => { return `

${escape(item.title)}

`; } })} ${validate_component(Table_cell, "Table.Cell").$$render($$result, {}, {}, { default: () => { return `${escape(item.status)}`; } })} `; } })}`; })}`; } })}`; } })}`} ${validate_component(Dialog_footer, "Dialog.Footer").$$render($$result, {}, {}, { default: () => { return `${validate_component(Button, "Button").$$render($$result, {}, {}, { default: () => { return `Close`; } })}`; } })}`; } })}`; } } )}`; } while (!$$settled); return $$rendered; }); const Pagination = create_ssr_component(($$result, $$props, $$bindings, slots) => { let currentPage; let $$restProps = compute_rest_props($$props, ["class", "count", "perPage", "page", "siblingCount"]); let { class: className = void 0 } = $$props; let { count = 0 } = $$props; let { perPage = 10 } = $$props; let { page: page2 = 1 } = $$props; let { siblingCount = 1 } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); if ($$props.count === void 0 && $$bindings.count && count !== void 0) $$bindings.count(count); if ($$props.perPage === void 0 && $$bindings.perPage && perPage !== void 0) $$bindings.perPage(perPage); if ($$props.page === void 0 && $$bindings.page && page2 !== void 0) $$bindings.page(page2); if ($$props.siblingCount === void 0 && $$bindings.siblingCount && siblingCount !== void 0) $$bindings.siblingCount(siblingCount); let $$settled; let $$rendered; let previous_head = $$result.head; do { $$settled = true; $$result.head = previous_head; currentPage = page2; $$rendered = `${validate_component(Pagination$1, "PaginationPrimitive.Root").$$render( $$result, Object.assign({}, { count }, { perPage }, { siblingCount }, { asChild: true }, $$restProps, { page: page2 }), { page: ($$value) => { page2 = $$value; $$settled = false; } }, { default: ({ builder, pages, range }) => { return `${slots.default ? slots.default({ pages, range, currentPage }) : ``}`; } } )}`; } while (!$$settled); return $$rendered; }); const Pagination_content = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class"]); let { class: className = void 0 } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); return `${slots.default ? slots.default({}) : ``}`; }); const Pagination_item = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class"]); let { class: className = void 0 } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); return `${slots.default ? slots.default({}) : ``}`; }); const Pagination_link = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class", "page", "size", "isActive"]); let { class: className = void 0 } = $$props; let { page: page2 } = $$props; let { size = "icon" } = $$props; let { isActive = false } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); if ($$props.page === void 0 && $$bindings.page && page2 !== void 0) $$bindings.page(page2); if ($$props.size === void 0 && $$bindings.size && size !== void 0) $$bindings.size(size); if ($$props.isActive === void 0 && $$bindings.isActive && isActive !== void 0) $$bindings.isActive(isActive); let $$settled; let $$rendered; let previous_head = $$result.head; do { $$settled = true; $$result.head = previous_head; $$rendered = `${validate_component(Pagination_page, "PaginationPrimitive.Page").$$render( $$result, Object.assign( {}, { class: cn( buttonVariants({ variant: isActive ? "outline" : "ghost", size }), className ) }, $$restProps, { page: page2 } ), { page: ($$value) => { page2 = $$value; $$settled = false; } }, { default: () => { return `${slots.default ? slots.default({}) : `${escape(page2.value)}`}`; } } )}`; } while (!$$settled); return $$rendered; }); const Pagination_ellipsis = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class"]); let { class: className = void 0 } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); return `${validate_component(Ellipsis$1, "Ellipsis").$$render($$result, { class: "h-4 w-4" }, {}, {})} More pages`; }); const articlesPerPage = 10; const Page = create_ssr_component(($$result, $$props, $$bindings, slots) => { let { data } = $$props; let editingContent = null; let currentPage; let isLoading = true; if ($$props.data === void 0 && $$bindings.data && data !== void 0) $$bindings.data(data); let $$settled; let $$rendered; let previous_head = $$result.head; do { $$settled = true; $$result.head = previous_head; { { if (data) { isLoading = false; } } } $$rendered = `
${validate_component(CreateArticleDialog, "CreateArticleDialog").$$render( $$result, { form: data.createForm, videos: data.videos, tier: data.me.subscription_tier }, {}, {} )}
${validate_component(ArticleQueue, "ArticleQueue").$$render($$result, {}, {}, {})}
${data.articles.length > 0 ? `${isLoading ? `
${validate_component(Loader2, "Loader2").$$render( $$result, { class: "w-12 h-12 z-50 text-white animate-spin" }, {}, {} )}
` : ``} ${validate_component(Table, "Table.Root").$$render($$result, {}, {}, { default: () => { return `${validate_component(Table_header, "Table.Header").$$render($$result, {}, {}, { default: () => { return `${validate_component(Table_row, "Table.Row").$$render($$result, {}, {}, { default: () => { return `${validate_component(Table_head, "Table.Head").$$render($$result, { class: "w-[25px]" }, {}, { default: () => { return `Visibility`; } })} ${validate_component(Table_head, "Table.Head").$$render($$result, { class: "max-w-[300px]" }, {}, { default: () => { return `Title`; } })} ${validate_component(Table_head, "Table.Head").$$render($$result, { class: "text-end" }, {}, { default: () => { return `Source`; } })} ${validate_component(Table_head, "Table.Head").$$render($$result, { class: "text-end" }, {}, { default: () => { return `Views`; } })} ${validate_component(Table_head, "Table.Head").$$render($$result, { class: "text-end" }, {}, { default: () => { return `Actions`; } })}`; } })}`; } })} ${validate_component(Table_body, "Table.Body").$$render($$result, {}, {}, { default: () => { return `${each(data.articles, (article, i) => { return `${validate_component(Table_row, "Table.Row").$$render($$result, { name: "article-row-" + article.id }, {}, { default: () => { return `${validate_component(Table_cell, "Table.Cell").$$render($$result, { class: "font-medium" }, {}, { default: () => { return `${article.is_public ? `${validate_component(Eye$1, "Eye").$$render($$result, { class: "mx-auto h-5 w-5" }, {}, {})}` : `${validate_component(EyeOff, "EyeOff").$$render($$result, { class: "mx-auto h-5 w-5" }, {}, {})}`} `; } })} ${validate_component(Table_cell, "Table.Cell").$$render( $$result, { class: "max-w-[300px] overflow-hidden overflow-ellipsis text-nowrap" }, {}, { default: () => { return `${escape(article.title)}`; } } )} ${validate_component(Table_cell, "Table.Cell").$$render($$result, { class: "text-end" }, {}, { default: () => { return `${escape("Youtube")}`; } })} ${validate_component(Table_cell, "Table.Cell").$$render($$result, { class: "text-end" }, {}, { default: () => { return `${escape(article.views)}`; } })} ${validate_component(Table_cell, "Table.Cell").$$render($$result, { class: "w-fit text-end" }, {}, { default: () => { return `${validate_component(Tooltipbutton, "TooltipButton").$$render( $$result, { class: "hover:bg-blue-600", variant: "outline", size: "icon", tip: "Preview" }, {}, { default: () => { return `${validate_component(ExternalLink, "ExternalLink").$$render($$result, { size: "1rem" }, {}, {})} `; } } )} ${validate_component(Tooltipbutton, "TooltipButton").$$render( $$result, { variant: "outline", size: "icon", tip: "Edit" }, {}, { default: () => { return `${validate_component(Pen$1, "Pen").$$render($$result, { size: "1rem" }, {}, {})} `; } } )} ${validate_component(Tooltipbutton, "TooltipButton").$$render( $$result, { class: "hover:bg-red-600", variant: "outline", size: "icon", tip: "Delete" }, {}, { default: () => { return `${validate_component(Trash$1, "Trash").$$render($$result, { size: "1rem" }, {}, {})} `; } } )} `; } })} `; } })}`; })}`; } })}`; } })} ${validate_component(Pagination, "Pagination.Root").$$render( $$result, { count: data.total_articles, perPage: articlesPerPage, currentPage }, {}, { default: ({ pages }) => { return `${validate_component(Pagination_content, "Pagination.Content").$$render($$result, {}, {}, { default: () => { return ` ${each(pages, (page2) => { return `${page2.type === "ellipsis" ? `${validate_component(Pagination_item, "Pagination.Item").$$render($$result, {}, {}, { default: () => { return `${validate_component(Pagination_ellipsis, "Pagination.Ellipsis").$$render($$result, {}, {}, {})} `; } })}` : `${validate_component(Pagination_item, "Pagination.Item").$$render($$result, {}, {}, { default: () => { return `${validate_component(Pagination_link, "Pagination.Link").$$render( $$result, { page: page2, isActive: currentPage === page2.value }, {}, { default: () => { return `${escape(page2.value)} `; } } )} `; } })}`}`; })} `; } })}`; } } )}` : `

You don't have any articles yet. Start by making one!

`}
${validate_component(EditArticleDialog, "EditArticleDialog").$$render( $$result, { form: data.editForm, article_data: editingContent }, { article_data: ($$value) => { editingContent = $$value; $$settled = false; } }, {} )} `; } while (!$$settled); return $$rendered; }); export { Page as default }; //# sourceMappingURL=_page.svelte-nrr5Txli.js.map