3188 lines
121 KiB
JavaScript
3188 lines
121 KiB
JavaScript
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-C8VhAaUk.js';
|
|
import 'clsx';
|
|
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, j as addEventListener, r as isTouch, t as removeUndefined$1, s as styleToString, p as portalAttr, e as effect, h as isBrowser, v as dequal, x as isObject, y as stripValues, l as disabledAttr, k as kbd, z as isHTMLButtonElement, a as isHTMLElement, F as FIRST_LAST_KEYS, f as isElementDisabled, u as useEscapeKeydown, A as isElement, B as createHiddenInput, g as safeOnMount, n as noop, C as isDocument, D as getElementByMeltId, E as isHTMLLabelElement, G as isHTMLInputElement } from './index3-4H3SMWet.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 { d as derived, a as readonly, w as writable } from './index2-D4yenS_5.js';
|
|
import { t as tick } from './scheduler-1Ju9dhbL.js';
|
|
import { f as toast, c as createDispatcher, a as createBitAttrs, r as removeUndefined, g as getOptionUpdater, o as overridable, e as toWritableStores } from './index-pRP-dlMc.js';
|
|
import { D as Dialog_content$1, a as Dialog_close, X as X$1, b as Dialog, c as Dialog_trigger, x as getCtx$3, d as Dialog_portal$1, e as Dialog_overlay$1, y as scale, h as fade, k as generateIds, m as getPortalDestination, o as usePortal, z as useFloating, g as generateId, i as getPositioningUpdater, j as createTypeaheadSearch, l as derivedVisible, A as last, B as back, C as forward, E as prev, F as next, u as usePopper, G as generateId$1, w as addHighlight, r as removeHighlight, q as removeScroll, H as toggle } from './x-BYSy-ttj.js';
|
|
import { B as Button, c as cn, f as flyAndScale } from './button-CeH7Xj2c.js';
|
|
import { tv } from 'tailwind-variants';
|
|
import { F as Form_field, C as Control, a as Form_label, I as Input$1, b as Form_field_errors, L as Label, S as Switch, T as Textarea, c as createLabel } from './textarea-CILqUx6U.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-qIYb_UNQ.js';
|
|
import { I as Icon$1 } from './Icon-a6cUNPyd.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 makeHull(points) {
|
|
const newPoints = points.slice();
|
|
newPoints.sort(POINT_COMPARATOR);
|
|
return makeHullPresorted(newPoints);
|
|
}
|
|
function makeHullPresorted(points) {
|
|
if (points.length <= 1)
|
|
return points.slice();
|
|
const upperHull = [];
|
|
for (let i = 0; i < points.length; i++) {
|
|
const p = points[i];
|
|
while (upperHull.length >= 2) {
|
|
const q = upperHull[upperHull.length - 1];
|
|
const r = upperHull[upperHull.length - 2];
|
|
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x))
|
|
upperHull.pop();
|
|
else
|
|
break;
|
|
}
|
|
upperHull.push(p);
|
|
}
|
|
upperHull.pop();
|
|
const lowerHull = [];
|
|
for (let i = points.length - 1; i >= 0; i--) {
|
|
const p = points[i];
|
|
while (lowerHull.length >= 2) {
|
|
const q = lowerHull[lowerHull.length - 1];
|
|
const r = lowerHull[lowerHull.length - 2];
|
|
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x))
|
|
lowerHull.pop();
|
|
else
|
|
break;
|
|
}
|
|
lowerHull.push(p);
|
|
}
|
|
lowerHull.pop();
|
|
if (upperHull.length == 1 && lowerHull.length == 1 && upperHull[0].x == lowerHull[0].x && upperHull[0].y == lowerHull[0].y)
|
|
return upperHull;
|
|
else
|
|
return upperHull.concat(lowerHull);
|
|
}
|
|
function POINT_COMPARATOR(a, b) {
|
|
if (a.x < b.x)
|
|
return -1;
|
|
else if (a.x > b.x)
|
|
return 1;
|
|
else if (a.y < b.y)
|
|
return -1;
|
|
else if (a.y > b.y)
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
function getPointsFromEl(el) {
|
|
const rect = el.getBoundingClientRect();
|
|
return [
|
|
{ x: rect.left, y: rect.top },
|
|
{ x: rect.right, y: rect.top },
|
|
{ x: rect.right, y: rect.bottom },
|
|
{ x: rect.left, y: rect.bottom }
|
|
];
|
|
}
|
|
function makeHullFromElements(els) {
|
|
const points = els.flatMap((el) => getPointsFromEl(el));
|
|
return makeHull(points);
|
|
}
|
|
function pointInPolygon(point, polygon) {
|
|
let inside = false;
|
|
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
const xi = polygon[i].x;
|
|
const yi = polygon[i].y;
|
|
const xj = polygon[j].x;
|
|
const yj = polygon[j].y;
|
|
const intersect = yi > point.y !== yj > point.y && point.x < (xj - xi) * (point.y - yi) / (yj - yi) + xi;
|
|
if (intersect)
|
|
inside = !inside;
|
|
}
|
|
return inside;
|
|
}
|
|
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$2 = {
|
|
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$2, ...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$1 = {
|
|
perPage: 1,
|
|
siblingCount: 1,
|
|
defaultPage: 1
|
|
};
|
|
const { name: name$1, selector } = createElHelpers("pagination");
|
|
function createPagination(props) {
|
|
const withDefaults = { ...defaults$1, ...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$1(), {
|
|
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$1("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$1("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$1("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
|
|
}
|
|
};
|
|
}
|
|
const defaults = {
|
|
positioning: {
|
|
placement: "bottom"
|
|
},
|
|
arrowSize: 8,
|
|
defaultOpen: false,
|
|
closeOnPointerDown: true,
|
|
openDelay: 1e3,
|
|
closeDelay: 0,
|
|
forceVisible: false,
|
|
portal: void 0,
|
|
closeOnEscape: true,
|
|
disableHoverableContent: false,
|
|
group: void 0
|
|
};
|
|
const { name } = createElHelpers("tooltip");
|
|
const groupMap = /* @__PURE__ */ new Map();
|
|
const tooltipIdParts = ["trigger", "content"];
|
|
function createTooltip(props) {
|
|
const withDefaults = { ...defaults, ...props };
|
|
const options = toWritableStores(omit(withDefaults, "open", "ids"));
|
|
const { positioning, arrowSize, closeOnPointerDown, openDelay, closeDelay, forceVisible, portal, closeOnEscape, disableHoverableContent, group } = options;
|
|
const openWritable = withDefaults.open ?? writable(withDefaults.defaultOpen);
|
|
const open = overridable(openWritable, withDefaults?.onOpenChange);
|
|
const openReason = writable(null);
|
|
const ids = toWritableStores({ ...generateIds(tooltipIdParts), ...withDefaults.ids });
|
|
let clickedTrigger = false;
|
|
const getEl = (part) => {
|
|
if (!isBrowser)
|
|
return null;
|
|
return document.getElementById(ids[part].get());
|
|
};
|
|
let openTimeout = null;
|
|
let closeTimeout = null;
|
|
function openTooltip(reason) {
|
|
if (closeTimeout) {
|
|
window.clearTimeout(closeTimeout);
|
|
closeTimeout = null;
|
|
}
|
|
if (!openTimeout) {
|
|
openTimeout = window.setTimeout(() => {
|
|
open.set(true);
|
|
openReason.update((prev2) => prev2 ?? reason);
|
|
openTimeout = null;
|
|
}, openDelay.get());
|
|
}
|
|
}
|
|
function closeTooltip(isBlur) {
|
|
if (openTimeout) {
|
|
window.clearTimeout(openTimeout);
|
|
openTimeout = null;
|
|
}
|
|
if (isBlur && isMouseInTooltipArea) {
|
|
openReason.set("pointer");
|
|
return;
|
|
}
|
|
if (!closeTimeout) {
|
|
closeTimeout = window.setTimeout(() => {
|
|
open.set(false);
|
|
openReason.set(null);
|
|
if (isBlur)
|
|
clickedTrigger = false;
|
|
closeTimeout = null;
|
|
}, closeDelay.get());
|
|
}
|
|
}
|
|
const isVisible = derived([open, forceVisible], ([$open, $forceVisible]) => {
|
|
return $open || $forceVisible;
|
|
});
|
|
const trigger = makeElement(name("trigger"), {
|
|
stores: [ids.content, ids.trigger, open],
|
|
returned: ([$contentId, $triggerId, $open]) => {
|
|
return {
|
|
"aria-describedby": $contentId,
|
|
id: $triggerId,
|
|
"data-state": $open ? "open" : "closed"
|
|
};
|
|
},
|
|
action: (node) => {
|
|
const keydownHandler = (e) => {
|
|
if (closeOnEscape.get() && e.key === kbd.ESCAPE) {
|
|
if (openTimeout) {
|
|
window.clearTimeout(openTimeout);
|
|
openTimeout = null;
|
|
}
|
|
open.set(false);
|
|
}
|
|
};
|
|
const unsub = executeCallbacks(addMeltEventListener(node, "pointerdown", () => {
|
|
const $closeOnPointerDown = closeOnPointerDown.get();
|
|
if (!$closeOnPointerDown)
|
|
return;
|
|
open.set(false);
|
|
clickedTrigger = true;
|
|
if (openTimeout) {
|
|
window.clearTimeout(openTimeout);
|
|
openTimeout = null;
|
|
}
|
|
}), addMeltEventListener(node, "pointerenter", (e) => {
|
|
if (isTouch(e))
|
|
return;
|
|
openTooltip("pointer");
|
|
}), addMeltEventListener(node, "pointerleave", (e) => {
|
|
if (isTouch(e))
|
|
return;
|
|
if (openTimeout) {
|
|
window.clearTimeout(openTimeout);
|
|
openTimeout = null;
|
|
}
|
|
}), addMeltEventListener(node, "focus", () => {
|
|
if (clickedTrigger)
|
|
return;
|
|
openTooltip("focus");
|
|
}), addMeltEventListener(node, "blur", () => closeTooltip(true)), addMeltEventListener(node, "keydown", keydownHandler), addEventListener(document, "keydown", keydownHandler));
|
|
return {
|
|
destroy: unsub
|
|
};
|
|
}
|
|
});
|
|
const content = makeElement(name("content"), {
|
|
stores: [isVisible, open, portal, ids.content],
|
|
returned: ([$isVisible, $open, $portal, $contentId]) => {
|
|
return removeUndefined$1({
|
|
role: "tooltip",
|
|
hidden: $isVisible ? void 0 : true,
|
|
tabindex: -1,
|
|
style: $isVisible ? void 0 : styleToString({ display: "none" }),
|
|
id: $contentId,
|
|
"data-portal": portalAttr($portal),
|
|
"data-state": $open ? "open" : "closed"
|
|
});
|
|
},
|
|
action: (node) => {
|
|
let unsubFloating = noop;
|
|
let unsubPortal = noop;
|
|
const unsubDerived = effect([isVisible, positioning, portal], ([$isVisible, $positioning, $portal]) => {
|
|
unsubPortal();
|
|
unsubFloating();
|
|
const triggerEl = getEl("trigger");
|
|
if (!$isVisible || !triggerEl)
|
|
return;
|
|
tick().then(() => {
|
|
unsubPortal();
|
|
unsubFloating();
|
|
const portalDest = getPortalDestination(node, $portal);
|
|
if (portalDest)
|
|
unsubPortal = usePortal(node, portalDest).destroy;
|
|
unsubFloating = useFloating(triggerEl, node, $positioning).destroy;
|
|
});
|
|
});
|
|
function handleScroll(e) {
|
|
if (!open.get())
|
|
return;
|
|
const target = e.target;
|
|
if (!isElement(target) && !isDocument(target))
|
|
return;
|
|
const triggerEl = getEl("trigger");
|
|
if (triggerEl && target.contains(triggerEl)) {
|
|
closeTooltip();
|
|
}
|
|
}
|
|
const unsubEvents = executeCallbacks(addMeltEventListener(node, "pointerenter", () => openTooltip("pointer")), addMeltEventListener(node, "pointerdown", () => openTooltip("pointer")), addEventListener(window, "scroll", handleScroll, { capture: true }));
|
|
return {
|
|
destroy() {
|
|
unsubEvents();
|
|
unsubPortal();
|
|
unsubFloating();
|
|
unsubDerived();
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const arrow = makeElement(name("arrow"), {
|
|
stores: arrowSize,
|
|
returned: ($arrowSize) => ({
|
|
"data-arrow": true,
|
|
style: styleToString({
|
|
position: "absolute",
|
|
width: `var(--arrow-size, ${$arrowSize}px)`,
|
|
height: `var(--arrow-size, ${$arrowSize}px)`
|
|
})
|
|
})
|
|
});
|
|
let isMouseInTooltipArea = false;
|
|
effect(open, ($open) => {
|
|
const currentGroup = group.get();
|
|
if (currentGroup === void 0 || currentGroup === false) {
|
|
return;
|
|
}
|
|
if (!$open) {
|
|
if (groupMap.get(currentGroup) === open) {
|
|
groupMap.delete(currentGroup);
|
|
}
|
|
return;
|
|
}
|
|
const currentOpen = groupMap.get(currentGroup);
|
|
currentOpen?.set(false);
|
|
groupMap.set(currentGroup, open);
|
|
});
|
|
effect([open, openReason], ([$open, $openReason]) => {
|
|
if (!$open || !isBrowser)
|
|
return;
|
|
return executeCallbacks(addEventListener(document, "mousemove", (e) => {
|
|
const contentEl = getEl("content");
|
|
const triggerEl = getEl("trigger");
|
|
if (!contentEl || !triggerEl)
|
|
return;
|
|
const polygonElements = disableHoverableContent.get() ? [triggerEl] : [triggerEl, contentEl];
|
|
const polygon = makeHullFromElements(polygonElements);
|
|
isMouseInTooltipArea = pointInPolygon({
|
|
x: e.clientX,
|
|
y: e.clientY
|
|
}, polygon);
|
|
if ($openReason !== "pointer")
|
|
return;
|
|
if (!isMouseInTooltipArea) {
|
|
closeTooltip();
|
|
}
|
|
}));
|
|
});
|
|
return {
|
|
ids,
|
|
elements: {
|
|
trigger,
|
|
content,
|
|
arrow
|
|
},
|
|
states: { open },
|
|
options
|
|
};
|
|
}
|
|
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$3();
|
|
$$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) ? "" : `</${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$3();
|
|
$$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 }) : ``}` : `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</div>`}`;
|
|
});
|
|
function getPaginationData() {
|
|
const NAME = "pagination";
|
|
const PARTS = ["root", "prev-button", "next-button", "page"];
|
|
return {
|
|
NAME,
|
|
PARTS
|
|
};
|
|
}
|
|
function setCtx$2(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$2() {
|
|
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$2({
|
|
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 }) : ``}` : `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder, pages: $pages, range: $range }) : ``}</div>`}`;
|
|
});
|
|
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$2();
|
|
$$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 }) : ``}` : `<button${spread([{ type: "button" }, escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ` ${escape(page2.value)} `}</button>`}`;
|
|
});
|
|
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$1() {
|
|
const { NAME } = getSelectData();
|
|
return getContext(NAME);
|
|
}
|
|
function setCtx$1(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$1();
|
|
return { group, id, getAttrs };
|
|
}
|
|
function setItemCtx(value) {
|
|
const { ITEM_NAME } = getSelectData();
|
|
const select = getCtx$1();
|
|
setContext(ITEM_NAME, value);
|
|
return select;
|
|
}
|
|
function getItemIndicator() {
|
|
const { ITEM_NAME } = getSelectData();
|
|
const { helpers: { isSelected }, getAttrs } = getCtx$1();
|
|
const value = getContext(ITEM_NAME);
|
|
return {
|
|
value,
|
|
isSelected,
|
|
getAttrs
|
|
};
|
|
}
|
|
function updatePositioning$1(props) {
|
|
const defaultPlacement = {
|
|
side: "bottom",
|
|
align: "center",
|
|
sameWidth: true
|
|
};
|
|
const withDefaults = { ...defaultPlacement, ...props };
|
|
const { options: { positioning } } = getCtx$1();
|
|
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$1({
|
|
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$1();
|
|
$$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$1({
|
|
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 ? `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</div>` : `${inTransition && outTransition && $open ? `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</div>` : `${inTransition && $open ? `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</div>` : `${outTransition && $open ? `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</div>` : `${$open ? `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</div>` : ``}`}`}`}`}`}`;
|
|
});
|
|
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 }) : ``}` : `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</div>`}`;
|
|
});
|
|
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$1();
|
|
$$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 }) : ``}` : `<input${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>`}`;
|
|
});
|
|
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 }) : ``}` : `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder, isSelected }) : ` ${escape(label || value)} `}</div>`}`;
|
|
});
|
|
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) }) : ``}` : `<div${spread([escape_object($$restProps), escape_object(attrs)], {})}${add_attribute("this", el, 0)}>${$isSelected(value) ? `${slots.default ? slots.default({ attrs, isSelected: $isSelected(value) }) : ``}` : ``}</div>`}`;
|
|
});
|
|
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$1();
|
|
$$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 }) : ``}` : `<button${spread([escape_object(builder), { type: "button" }, escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</button>`}`;
|
|
});
|
|
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$1();
|
|
$$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 }) : ``}` : `<span${spread(
|
|
[
|
|
escape_object($$restProps),
|
|
escape_object(attrs),
|
|
{
|
|
"data-placeholder": escape_attribute_value(!label ? "" : void 0)
|
|
}
|
|
],
|
|
{}
|
|
)}${add_attribute("this", el, 0)}>${escape(label || placeholder)}</span>`}`;
|
|
});
|
|
function getTooltipData() {
|
|
const NAME = "tooltip";
|
|
const PARTS = ["arrow", "content", "trigger"];
|
|
return {
|
|
NAME,
|
|
PARTS
|
|
};
|
|
}
|
|
function setCtx(props) {
|
|
const { NAME, PARTS } = getTooltipData();
|
|
const getAttrs = createBitAttrs(NAME, PARTS);
|
|
const tooltip = {
|
|
...createTooltip({
|
|
positioning: {
|
|
placement: "top",
|
|
gutter: 0
|
|
},
|
|
openDelay: 700,
|
|
...removeUndefined(props),
|
|
forceVisible: true
|
|
}),
|
|
getAttrs
|
|
};
|
|
setContext(NAME, tooltip);
|
|
return {
|
|
...tooltip,
|
|
updateOption: getOptionUpdater(tooltip.options)
|
|
};
|
|
}
|
|
function getCtx() {
|
|
const { NAME } = getTooltipData();
|
|
return getContext(NAME);
|
|
}
|
|
function updatePositioning(props) {
|
|
const defaultPlacement = {
|
|
side: "top",
|
|
align: "center",
|
|
sideOffset: 1
|
|
};
|
|
const withDefaults = { ...defaultPlacement, ...props };
|
|
const { options: { positioning } } = getCtx();
|
|
const updater = getPositioningUpdater(positioning);
|
|
updater({ ...withDefaults });
|
|
}
|
|
const Tooltip = create_ssr_component(($$result, $$props, $$bindings, slots) => {
|
|
let $idValues, $$unsubscribe_idValues;
|
|
let { closeOnEscape = void 0 } = $$props;
|
|
let { portal = void 0 } = $$props;
|
|
let { closeOnPointerDown = void 0 } = $$props;
|
|
let { openDelay = void 0 } = $$props;
|
|
let { closeDelay = void 0 } = $$props;
|
|
let { open = void 0 } = $$props;
|
|
let { onOpenChange = void 0 } = $$props;
|
|
let { disableHoverableContent = void 0 } = $$props;
|
|
let { group = void 0 } = $$props;
|
|
const { states: { open: localOpen }, updateOption, ids } = setCtx({
|
|
closeOnEscape,
|
|
portal,
|
|
closeOnPointerDown,
|
|
openDelay,
|
|
closeDelay,
|
|
forceVisible: true,
|
|
defaultOpen: open,
|
|
disableHoverableContent,
|
|
group,
|
|
onOpenChange: ({ next: next2 }) => {
|
|
if (open !== next2) {
|
|
onOpenChange?.(next2);
|
|
open = next2;
|
|
}
|
|
return next2;
|
|
},
|
|
positioning: { gutter: 0, offset: { mainAxis: 1 } }
|
|
});
|
|
const idValues = derived([ids.content, ids.trigger], ([$contentId, $triggerId]) => ({ content: $contentId, trigger: $triggerId }));
|
|
$$unsubscribe_idValues = subscribe(idValues, (value) => $idValues = value);
|
|
if ($$props.closeOnEscape === void 0 && $$bindings.closeOnEscape && closeOnEscape !== void 0)
|
|
$$bindings.closeOnEscape(closeOnEscape);
|
|
if ($$props.portal === void 0 && $$bindings.portal && portal !== void 0)
|
|
$$bindings.portal(portal);
|
|
if ($$props.closeOnPointerDown === void 0 && $$bindings.closeOnPointerDown && closeOnPointerDown !== void 0)
|
|
$$bindings.closeOnPointerDown(closeOnPointerDown);
|
|
if ($$props.openDelay === void 0 && $$bindings.openDelay && openDelay !== void 0)
|
|
$$bindings.openDelay(openDelay);
|
|
if ($$props.closeDelay === void 0 && $$bindings.closeDelay && closeDelay !== void 0)
|
|
$$bindings.closeDelay(closeDelay);
|
|
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.disableHoverableContent === void 0 && $$bindings.disableHoverableContent && disableHoverableContent !== void 0)
|
|
$$bindings.disableHoverableContent(disableHoverableContent);
|
|
if ($$props.group === void 0 && $$bindings.group && group !== void 0)
|
|
$$bindings.group(group);
|
|
open !== void 0 && localOpen.set(open);
|
|
{
|
|
updateOption("closeOnEscape", closeOnEscape);
|
|
}
|
|
{
|
|
updateOption("portal", portal);
|
|
}
|
|
{
|
|
updateOption("closeOnPointerDown", closeOnPointerDown);
|
|
}
|
|
{
|
|
updateOption("openDelay", openDelay);
|
|
}
|
|
{
|
|
updateOption("closeDelay", closeDelay);
|
|
}
|
|
{
|
|
updateOption("group", group);
|
|
}
|
|
{
|
|
updateOption("disableHoverableContent", disableHoverableContent);
|
|
}
|
|
$$unsubscribe_idValues();
|
|
return `${slots.default ? slots.default({ ids: $idValues }) : ``}`;
|
|
});
|
|
const Tooltip_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 $content, $$unsubscribe_content;
|
|
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 = "top" } = $$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 = false } = $$props;
|
|
let { fitViewport = false } = $$props;
|
|
let { strategy = "absolute" } = $$props;
|
|
let { overlap = false } = $$props;
|
|
let { el = void 0 } = $$props;
|
|
const { elements: { content }, states: { open }, ids, getAttrs } = getCtx();
|
|
$$unsubscribe_content = subscribe(content, (value) => $content = 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.content.set(id);
|
|
}
|
|
}
|
|
builder = $content;
|
|
{
|
|
Object.assign(builder, attrs);
|
|
}
|
|
{
|
|
if ($open) {
|
|
updatePositioning({
|
|
side,
|
|
align,
|
|
sideOffset,
|
|
alignOffset,
|
|
collisionPadding,
|
|
avoidCollisions,
|
|
collisionBoundary,
|
|
sameWidth,
|
|
fitViewport,
|
|
strategy,
|
|
overlap
|
|
});
|
|
}
|
|
}
|
|
$$unsubscribe_open();
|
|
$$unsubscribe_content();
|
|
return `${asChild && $open ? `${slots.default ? slots.default({ builder }) : ``}` : `${transition && $open ? `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</div>` : `${inTransition && outTransition && $open ? `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</div>` : `${inTransition && $open ? `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</div>` : `${outTransition && $open ? `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</div>` : `${$open ? `<div${spread([escape_object(builder), escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</div>` : ``}`}`}`}`}`}`;
|
|
});
|
|
const Tooltip_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 }) : ``}` : `<button${spread([escape_object(builder), { type: "button" }, escape_object($$restProps)], {})}${add_attribute("this", el, 0)}>${slots.default ? slots.default({ builder }) : ``}</button>`}`;
|
|
});
|
|
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 `<div${spread(
|
|
[
|
|
{
|
|
class: escape_attribute_value(cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className))
|
|
},
|
|
escape_object($$restProps)
|
|
],
|
|
{}
|
|
)}>${slots.default ? slots.default({}) : ``}</div>`;
|
|
});
|
|
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 `<div${spread(
|
|
[
|
|
{
|
|
class: escape_attribute_value(cn("flex flex-col space-y-1.5 text-center sm:text-left", className))
|
|
},
|
|
escape_object($$restProps)
|
|
],
|
|
{}
|
|
)}>${slots.default ? slots.default({}) : ``}</div>`;
|
|
});
|
|
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" }, {}, {})} <span class="sr-only" data-svelte-h="svelte-1pewzs3">Close</span>`;
|
|
}
|
|
}
|
|
)}`;
|
|
}
|
|
}
|
|
)}`;
|
|
}
|
|
})}`;
|
|
});
|
|
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$2 = Dialog;
|
|
const Trigger$1 = 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 Tooltip_content = create_ssr_component(($$result, $$props, $$bindings, slots) => {
|
|
let $$restProps = compute_rest_props($$props, ["class", "sideOffset", "transition", "transitionConfig"]);
|
|
let { class: className = void 0 } = $$props;
|
|
let { sideOffset = 4 } = $$props;
|
|
let { transition = flyAndScale } = $$props;
|
|
let { transitionConfig = { y: 8, duration: 150 } } = $$props;
|
|
if ($$props.class === void 0 && $$bindings.class && className !== void 0)
|
|
$$bindings.class(className);
|
|
if ($$props.sideOffset === void 0 && $$bindings.sideOffset && sideOffset !== void 0)
|
|
$$bindings.sideOffset(sideOffset);
|
|
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(Tooltip_content$1, "TooltipPrimitive.Content").$$render(
|
|
$$result,
|
|
Object.assign(
|
|
{},
|
|
{ transition },
|
|
{ transitionConfig },
|
|
{ sideOffset },
|
|
{
|
|
class: cn("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md", className)
|
|
},
|
|
$$restProps
|
|
),
|
|
{},
|
|
{
|
|
default: () => {
|
|
return `${slots.default ? slots.default({}) : ``}`;
|
|
}
|
|
}
|
|
)}`;
|
|
});
|
|
const Root$1 = Tooltip;
|
|
const Trigger = Tooltip_trigger;
|
|
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$1, "Tooltip.Root").$$render($$result, {}, {}, {
|
|
default: () => {
|
|
return `${validate_component(Trigger, "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 `<p>${escape(tip)}</p>`;
|
|
}
|
|
})}`;
|
|
}
|
|
})}`;
|
|
});
|
|
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) ? "" : `</${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 `<span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">${validate_component(Select_item_indicator, "SelectPrimitive.ItemIndicator").$$render($$result, {}, {}, {
|
|
default: () => {
|
|
return `${validate_component(Check$1, "Check").$$render($$result, { class: "h-4 w-4" }, {}, {})}`;
|
|
}
|
|
})}</span> ${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 `<div class="w-full p-1">${slots.default ? slots.default({}) : ``}</div>`;
|
|
}
|
|
}
|
|
)}`;
|
|
});
|
|
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$2, "Dialog.Root").$$render(
|
|
$$result,
|
|
{ open },
|
|
{
|
|
open: ($$value) => {
|
|
open = $$value;
|
|
$$settled = false;
|
|
}
|
|
},
|
|
{
|
|
default: () => {
|
|
return `${validate_component(Trigger$1, "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!`;
|
|
}
|
|
})}`;
|
|
}
|
|
})} <form method="POST" name="blog-converter" id="blog-converter" action="?/create">${validate_component(Form_field, "Form.Field").$$render($$result, { form, name: "video_id" }, {}, {
|
|
default: () => {
|
|
return `${validate_component(Control, "Form.Control").$$render($$result, {}, {}, {
|
|
default: ({ attrs }) => {
|
|
return `<div class="mb-4 grid gap-4" style="margin-bottom: 0.5rem !important"><div class="grid grid-cols-4 items-center gap-4">${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 ` <div${spread(
|
|
[
|
|
escape_object(builder),
|
|
{ class: "col-span-2 w-[300px]" }
|
|
],
|
|
{}
|
|
)}>${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;
|
|
}
|
|
},
|
|
{}
|
|
)}`;
|
|
}
|
|
})}</div>`;
|
|
}
|
|
}
|
|
)} ${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;
|
|
}
|
|
},
|
|
{}
|
|
)}`;
|
|
}
|
|
})} </div></div>`;
|
|
}
|
|
})} <div class="grid grid-cols-4 items-center gap-4 mb" style="margin-top: 0.5rem !important">${validate_component(Form_field_errors, "Form.FieldErrors").$$render($$result, { class: "col-start-2 mb-2" }, {}, {})}</div> `;
|
|
}
|
|
})} </form> ${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$2, "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, {}, {}, {})}`;
|
|
}
|
|
})} <form id="blog_editor" action="?/edit" method="post">${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
|
|
},
|
|
{},
|
|
{}
|
|
)} <div>${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;
|
|
}
|
|
},
|
|
{}
|
|
)}</div> <div>${validate_component(Input$1, "Input").$$render(
|
|
$$result,
|
|
{
|
|
value: article_data?.title,
|
|
name: "title"
|
|
},
|
|
{},
|
|
{}
|
|
)}</div> <div>${validate_component(Textarea, "Textarea").$$render(
|
|
$$result,
|
|
{
|
|
name: "content",
|
|
value: article_data?.content,
|
|
class: "h-80"
|
|
},
|
|
{},
|
|
{}
|
|
)} <p class="text-sm text-muted-foreground" data-svelte-h="svelte-1cl6ia">Manually edit your article with <a href="https://www.markdownguide.org/basic-syntax" class="font-bold underline">Markdown</a></p></div>`;
|
|
}
|
|
})}`;
|
|
}
|
|
})}</form> ${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$2, "Dialog.Root").$$render(
|
|
$$result,
|
|
{ open },
|
|
{
|
|
open: ($$value) => {
|
|
open = $$value;
|
|
$$settled = false;
|
|
}
|
|
},
|
|
{
|
|
default: () => {
|
|
return `${validate_component(Trigger$1, "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 ? `<p class="pt-12 text-center text-gray-400" data-svelte-h="svelte-khfoxh">No articles are currently being generated!</p>` : `${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 `<p class="w-[100px] overflow-hidden text-ellipsis whitespace-nowrap text-nowrap font-medium">${escape(item.source_id.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/)[2])}</p> `;
|
|
}
|
|
})} ${validate_component(Table_cell, "Table.Cell").$$render($$result, { class: "w-[200px]" }, {}, {
|
|
default: () => {
|
|
return `<p class="w-[200px] overflow-hidden text-ellipsis whitespace-nowrap text-nowrap font-medium">${escape(item.title)}</p> `;
|
|
}
|
|
})} ${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 `<nav${spread(
|
|
[
|
|
escape_object(builder),
|
|
{
|
|
class: escape_attribute_value(cn("mx-auto flex w-full flex-col items-center", className))
|
|
}
|
|
],
|
|
{}
|
|
)}>${slots.default ? slots.default({ pages, range, currentPage }) : ``}</nav>`;
|
|
}
|
|
}
|
|
)}`;
|
|
} 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 `<ul${spread(
|
|
[
|
|
{
|
|
class: escape_attribute_value(cn("flex flex-row items-center gap-1", className))
|
|
},
|
|
escape_object($$restProps)
|
|
],
|
|
{}
|
|
)}>${slots.default ? slots.default({}) : ``}</ul>`;
|
|
});
|
|
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 `<li${spread(
|
|
[
|
|
{
|
|
class: escape_attribute_value(cn("", className))
|
|
},
|
|
escape_object($$restProps)
|
|
],
|
|
{}
|
|
)}>${slots.default ? slots.default({}) : ``}</li>`;
|
|
});
|
|
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 `<span${spread(
|
|
[
|
|
{ "aria-hidden": true },
|
|
{
|
|
class: escape_attribute_value(cn("flex h-9 w-9 items-center justify-center", className))
|
|
},
|
|
escape_object($$restProps)
|
|
],
|
|
{}
|
|
)}>${validate_component(Ellipsis$1, "Ellipsis").$$render($$result, { class: "h-4 w-4" }, {}, {})} <span class="sr-only" data-svelte-h="svelte-1krwd1q">More pages</span></span>`;
|
|
});
|
|
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 = `<div class="mx-auto w-full max-w-[1000px] relative">${validate_component(CreateArticleDialog, "CreateArticleDialog").$$render(
|
|
$$result,
|
|
{
|
|
form: data.createForm,
|
|
videos: data.videos,
|
|
tier: data.me.subscription_tier
|
|
},
|
|
{},
|
|
{}
|
|
)} <div class="float-right">${validate_component(ArticleQueue, "ArticleQueue").$$render($$result, {}, {}, {})}</div> ${data.articles.length > 0 ? `${isLoading ? `<div class="w-full h-full bg-[rgb(255 255 255 / 20%)] backdrop-blur-sm absolute z-40 flex justify-center items-center">${validate_component(Loader2, "Loader2").$$render(
|
|
$$result,
|
|
{
|
|
class: "w-12 h-12 z-50 text-white animate-spin"
|
|
},
|
|
{},
|
|
{}
|
|
)}</div>` : ``} ${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)} `;
|
|
}
|
|
}
|
|
)} `;
|
|
}
|
|
})}`}`;
|
|
})} `;
|
|
}
|
|
})}`;
|
|
}
|
|
}
|
|
)}` : `<p class="pt-12 text-center text-gray-400" data-svelte-h="svelte-8zzzra">You don't have any articles yet. Start by making one!</p>`}</div> ${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-DSx8I6bu.js.map
|