import { c as create_ssr_component, o as onDestroy, v as validate_component, e as escape, b as add_attribute, g as getContext, s as setContext, d as compute_rest_props, f as createEventDispatcher, h as spread, i as escape_attribute_value, j as escape_object, a as subscribe, k as each, l as set_store_value, n as hasContext, p as compute_slots, q as split_css_unit } from './ssr-IdY0EU5r.js'; import './client-_MkdHwD5.js'; import { w as writable } from './index2-KUnGpG6g.js'; import { p as prefersReducedMotionStore } from './ProgressBar.svelte_svelte_type_style_lang-5Gb3pa2y.js'; import 'docx'; import 'file-saver'; import './exports-mq_1S73-.js'; const DRAWER_STORE_KEY = "drawerStore"; function initializeDrawerStore() { const drawerStore = drawerService(); return setContext(DRAWER_STORE_KEY, drawerStore); } function drawerService() { const { subscribe: subscribe2, set, update: update2 } = writable({}); return { subscribe: subscribe2, set, update: update2, /** Open the drawer. */ open: (newSettings) => update2(() => { return { open: true, ...newSettings }; }), /** Close the drawer. */ close: () => update2((d) => { d.open = false; return d; }) }; } const MODAL_STORE_KEY = "modalStore"; function initializeModalStore() { const modalStore = modalService(); return setContext(MODAL_STORE_KEY, modalStore); } function modalService() { const { subscribe: subscribe2, set, update: update2 } = writable([]); return { subscribe: subscribe2, set, update: update2, /** Append to end of queue. */ trigger: (modal) => update2((mStore) => { mStore.push(modal); return mStore; }), /** Remove first item in queue. */ close: () => update2((mStore) => { if (mStore.length > 0) mStore.shift(); return mStore; }), /** Remove all items from queue. */ clear: () => set([]) }; } const toastDefaults = { message: "Missing Toast Message", autohide: true, timeout: 5e3 }; const TOAST_STORE_KEY = "toastStore"; function getToastStore() { const toastStore = getContext(TOAST_STORE_KEY); if (!toastStore) throw new Error("toastStore is not initialized. Please ensure that `initializeStores()` is invoked in the root layout file of this app!"); return toastStore; } function initializeToastStore() { const toastStore = toastService(); return setContext(TOAST_STORE_KEY, toastStore); } function randomUUID() { const random = Math.random(); return Number(random).toString(32); } function toastService() { const { subscribe: subscribe2, set, update: update2 } = writable([]); const close = (id) => update2((tStore) => { if (tStore.length > 0) { const index = tStore.findIndex((t) => t.id === id); const selectedToast = tStore[index]; if (selectedToast) { if (selectedToast.callback) selectedToast.callback({ id, status: "closed" }); if (selectedToast.timeoutId) clearTimeout(selectedToast.timeoutId); tStore.splice(index, 1); } } return tStore; }); function handleAutoHide(toast) { if (toast.autohide === true) { return setTimeout(() => { close(toast.id); }, toast.timeout); } } return { subscribe: subscribe2, close, /** Add a new toast to the queue. */ trigger: (toast) => { const id = randomUUID(); update2((tStore) => { if (toast && toast.callback) toast.callback({ id, status: "queued" }); if (toast.hideDismiss) toast.autohide = true; const tMerged = { ...toastDefaults, ...toast, id }; tMerged.timeoutId = handleAutoHide(tMerged); tStore.push(tMerged); return tStore; }); return id; }, /** Remain visible on hover */ freeze: (index) => update2((tStore) => { if (tStore.length > 0) clearTimeout(tStore[index].timeoutId); return tStore; }), /** Cancel remain visible on leave */ unfreeze: (index) => update2((tStore) => { if (tStore.length > 0) tStore[index].timeoutId = handleAutoHide(tStore[index]); return tStore; }), /** Remove all toasts from queue */ clear: () => set([]) }; } function initializeStores() { initializeModalStore(); initializeToastStore(); initializeDrawerStore(); } function cubicOut(t) { const f = t - 1; return f * f * f + 1; } function fly(node, { delay = 0, duration = 400, easing = cubicOut, x = 0, y = 0, opacity = 0 } = {}) { const style = getComputedStyle(node); const target_opacity = +style.opacity; const transform = style.transform === "none" ? "" : style.transform; const od = target_opacity * (1 - opacity); const [xValue, xUnit] = split_css_unit(x); const [yValue, yUnit] = split_css_unit(y); return { delay, duration, easing, css: (t, u) => ` transform: ${transform} translate(${(1 - t) * xValue}${xUnit}, ${(1 - t) * yValue}${yUnit}); opacity: ${target_opacity - od * u}` }; } function slide(node, { delay = 0, duration = 400, easing = cubicOut, axis = "y" } = {}) { const style = getComputedStyle(node); const opacity = +style.opacity; const primary_property = axis === "y" ? "height" : "width"; const primary_property_value = parseFloat(style[primary_property]); const secondary_properties = axis === "y" ? ["top", "bottom"] : ["left", "right"]; const capitalized_secondary_properties = secondary_properties.map( (e) => `${e[0].toUpperCase()}${e.slice(1)}` ); const padding_start_value = parseFloat(style[`padding${capitalized_secondary_properties[0]}`]); const padding_end_value = parseFloat(style[`padding${capitalized_secondary_properties[1]}`]); const margin_start_value = parseFloat(style[`margin${capitalized_secondary_properties[0]}`]); const margin_end_value = parseFloat(style[`margin${capitalized_secondary_properties[1]}`]); const border_width_start_value = parseFloat( style[`border${capitalized_secondary_properties[0]}Width`] ); const border_width_end_value = parseFloat( style[`border${capitalized_secondary_properties[1]}Width`] ); return { delay, duration, easing, css: (t) => `overflow: hidden;opacity: ${Math.min(t * 20, 1) * opacity};${primary_property}: ${t * primary_property_value}px;padding-${secondary_properties[0]}: ${t * padding_start_value}px;padding-${secondary_properties[1]}: ${t * padding_end_value}px;margin-${secondary_properties[0]}: ${t * margin_start_value}px;margin-${secondary_properties[1]}: ${t * margin_end_value}px;border-${secondary_properties[0]}-width: ${t * border_width_start_value}px;border-${secondary_properties[1]}-width: ${t * border_width_end_value}px;` }; } const Accordion = create_ssr_component(($$result, $$props, $$bindings, slots) => { let classesBase; let $prefersReducedMotionStore, $$unsubscribe_prefersReducedMotionStore; $$unsubscribe_prefersReducedMotionStore = subscribe(prefersReducedMotionStore, (value) => $prefersReducedMotionStore = value); let { autocollapse = false } = $$props; let { width = "w-full" } = $$props; let { spacing = "space-y-1" } = $$props; let { disabled = false } = $$props; let { padding = "py-2 px-4" } = $$props; let { hover = "hover:bg-primary-hover-token" } = $$props; let { rounded = "rounded-container-token" } = $$props; let { caretOpen = "rotate-180" } = $$props; let { caretClosed = "" } = $$props; let { regionControl = "" } = $$props; let { regionPanel = "space-y-4" } = $$props; let { regionCaret = "" } = $$props; let { transitions = !$prefersReducedMotionStore } = $$props; let { transitionIn = slide } = $$props; let { transitionInParams = { duration: 200 } } = $$props; let { transitionOut = slide } = $$props; let { transitionOutParams = { duration: 200 } } = $$props; const active = writable(null); setContext("active", active); setContext("autocollapse", autocollapse); setContext("disabled", disabled); setContext("padding", padding); setContext("hover", hover); setContext("rounded", rounded); setContext("caretOpen", caretOpen); setContext("caretClosed", caretClosed); setContext("regionControl", regionControl); setContext("regionPanel", regionPanel); setContext("regionCaret", regionCaret); setContext("transitions", transitions); setContext("transitionIn", transitionIn); setContext("transitionInParams", transitionInParams); setContext("transitionOut", transitionOut); setContext("transitionOutParams", transitionOutParams); if ($$props.autocollapse === void 0 && $$bindings.autocollapse && autocollapse !== void 0) $$bindings.autocollapse(autocollapse); if ($$props.width === void 0 && $$bindings.width && width !== void 0) $$bindings.width(width); if ($$props.spacing === void 0 && $$bindings.spacing && spacing !== void 0) $$bindings.spacing(spacing); if ($$props.disabled === void 0 && $$bindings.disabled && disabled !== void 0) $$bindings.disabled(disabled); if ($$props.padding === void 0 && $$bindings.padding && padding !== void 0) $$bindings.padding(padding); if ($$props.hover === void 0 && $$bindings.hover && hover !== void 0) $$bindings.hover(hover); if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0) $$bindings.rounded(rounded); if ($$props.caretOpen === void 0 && $$bindings.caretOpen && caretOpen !== void 0) $$bindings.caretOpen(caretOpen); if ($$props.caretClosed === void 0 && $$bindings.caretClosed && caretClosed !== void 0) $$bindings.caretClosed(caretClosed); if ($$props.regionControl === void 0 && $$bindings.regionControl && regionControl !== void 0) $$bindings.regionControl(regionControl); if ($$props.regionPanel === void 0 && $$bindings.regionPanel && regionPanel !== void 0) $$bindings.regionPanel(regionPanel); if ($$props.regionCaret === void 0 && $$bindings.regionCaret && regionCaret !== void 0) $$bindings.regionCaret(regionCaret); if ($$props.transitions === void 0 && $$bindings.transitions && transitions !== void 0) $$bindings.transitions(transitions); if ($$props.transitionIn === void 0 && $$bindings.transitionIn && transitionIn !== void 0) $$bindings.transitionIn(transitionIn); if ($$props.transitionInParams === void 0 && $$bindings.transitionInParams && transitionInParams !== void 0) $$bindings.transitionInParams(transitionInParams); if ($$props.transitionOut === void 0 && $$bindings.transitionOut && transitionOut !== void 0) $$bindings.transitionOut(transitionOut); if ($$props.transitionOutParams === void 0 && $$bindings.transitionOutParams && transitionOutParams !== void 0) $$bindings.transitionOutParams(transitionOutParams); classesBase = `${width} ${spacing} ${$$props.class ?? ""}`; $$unsubscribe_prefersReducedMotionStore(); return `
${slots.default ? slots.default({}) : ``}
`; }); const cBase$3 = ""; const cControl = "text-start w-full flex items-center space-x-4"; const cControlIcons = "fill-current w-3 transition-transform duration-[200ms]"; const cPanel = ""; const AccordionItem = create_ssr_component(($$result, $$props, $$bindings, slots) => { let openState; let classesBase; let classesControl; let classesCaretState; let classesControlCaret; let classesControlIcons; let classesPanel; let $$slots = compute_slots(slots); let $active, $$unsubscribe_active; const dispatch = createEventDispatcher(); let { open = false } = $$props; let { id = String(Math.random()) } = $$props; let { autocollapse = getContext("autocollapse") } = $$props; let { active = getContext("active") } = $$props; $$unsubscribe_active = subscribe(active, (value) => $active = value); let { disabled = getContext("disabled") } = $$props; let { padding = getContext("padding") } = $$props; let { hover = getContext("hover") } = $$props; let { rounded = getContext("rounded") } = $$props; let { caretOpen = getContext("caretOpen") } = $$props; let { caretClosed = getContext("caretClosed") } = $$props; let { regionControl = getContext("regionControl") } = $$props; let { regionPanel = getContext("regionPanel") } = $$props; let { regionCaret = getContext("regionCaret") } = $$props; let { transitions = getContext("transitions") } = $$props; let { transitionIn = getContext("transitionIn") } = $$props; let { transitionInParams = getContext("transitionInParams") } = $$props; let { transitionOut = getContext("transitionOut") } = $$props; let { transitionOutParams = getContext("transitionOutParams") } = $$props; const svgCaretIcon = ` `; function setActive(event) { if (autocollapse === true) { active.set(id); } else { open = !open; } onToggle(event); } function onToggle(event) { const currentOpenState = autocollapse ? $active === id : open; dispatch("toggle", { event, id, panelId: `accordion-panel-${id}`, open: currentOpenState, autocollapse }); } if (autocollapse && open) setActive(); if ($$props.open === void 0 && $$bindings.open && open !== void 0) $$bindings.open(open); if ($$props.id === void 0 && $$bindings.id && id !== void 0) $$bindings.id(id); if ($$props.autocollapse === void 0 && $$bindings.autocollapse && autocollapse !== void 0) $$bindings.autocollapse(autocollapse); if ($$props.active === void 0 && $$bindings.active && active !== void 0) $$bindings.active(active); if ($$props.disabled === void 0 && $$bindings.disabled && disabled !== void 0) $$bindings.disabled(disabled); if ($$props.padding === void 0 && $$bindings.padding && padding !== void 0) $$bindings.padding(padding); if ($$props.hover === void 0 && $$bindings.hover && hover !== void 0) $$bindings.hover(hover); if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0) $$bindings.rounded(rounded); if ($$props.caretOpen === void 0 && $$bindings.caretOpen && caretOpen !== void 0) $$bindings.caretOpen(caretOpen); if ($$props.caretClosed === void 0 && $$bindings.caretClosed && caretClosed !== void 0) $$bindings.caretClosed(caretClosed); if ($$props.regionControl === void 0 && $$bindings.regionControl && regionControl !== void 0) $$bindings.regionControl(regionControl); if ($$props.regionPanel === void 0 && $$bindings.regionPanel && regionPanel !== void 0) $$bindings.regionPanel(regionPanel); if ($$props.regionCaret === void 0 && $$bindings.regionCaret && regionCaret !== void 0) $$bindings.regionCaret(regionCaret); if ($$props.transitions === void 0 && $$bindings.transitions && transitions !== void 0) $$bindings.transitions(transitions); if ($$props.transitionIn === void 0 && $$bindings.transitionIn && transitionIn !== void 0) $$bindings.transitionIn(transitionIn); if ($$props.transitionInParams === void 0 && $$bindings.transitionInParams && transitionInParams !== void 0) $$bindings.transitionInParams(transitionInParams); if ($$props.transitionOut === void 0 && $$bindings.transitionOut && transitionOut !== void 0) $$bindings.transitionOut(transitionOut); if ($$props.transitionOutParams === void 0 && $$bindings.transitionOutParams && transitionOutParams !== void 0) $$bindings.transitionOutParams(transitionOutParams); { if (open && autocollapse) setActive(); } openState = autocollapse ? $active === id : open; classesBase = `${cBase$3} ${$$props.class ?? ""}`; classesControl = `${cControl} ${padding} ${hover} ${rounded} ${regionControl}`; classesCaretState = openState ? caretOpen : caretClosed; classesControlCaret = `${cControlIcons} ${regionCaret} ${classesCaretState}`; classesControlIcons = `${cControlIcons} ${regionCaret}`; classesPanel = `${cPanel} ${padding} ${rounded} ${regionPanel}`; $$unsubscribe_active(); return `
${openState ? `
${slots.content ? slots.content({}) : `(content)`}
` : ``}
`; }); const cBase$2 = "p-1"; const RadioGroup = create_ssr_component(($$result, $$props, $$bindings, slots) => { let classesBase; let { display = "inline-flex" } = $$props; let { flexDirection = "flex-row" } = $$props; let { gap = "gap-1" } = $$props; let { background = "bg-surface-200-700-token" } = $$props; let { border = "border-token border-surface-400-500-token" } = $$props; let { rounded = "rounded-token" } = $$props; let { padding = "px-4 py-1" } = $$props; let { active = "variant-filled" } = $$props; let { hover = "hover:variant-soft" } = $$props; let { color = "" } = $$props; let { fill = "" } = $$props; let { regionLabel = "" } = $$props; let { labelledby = "" } = $$props; setContext("rounded", rounded); setContext("padding", padding); setContext("active", active); setContext("hover", hover); setContext("color", color); setContext("fill", fill); setContext("regionLabel", regionLabel); if ($$props.display === void 0 && $$bindings.display && display !== void 0) $$bindings.display(display); if ($$props.flexDirection === void 0 && $$bindings.flexDirection && flexDirection !== void 0) $$bindings.flexDirection(flexDirection); if ($$props.gap === void 0 && $$bindings.gap && gap !== void 0) $$bindings.gap(gap); if ($$props.background === void 0 && $$bindings.background && background !== void 0) $$bindings.background(background); if ($$props.border === void 0 && $$bindings.border && border !== void 0) $$bindings.border(border); if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0) $$bindings.rounded(rounded); if ($$props.padding === void 0 && $$bindings.padding && padding !== void 0) $$bindings.padding(padding); if ($$props.active === void 0 && $$bindings.active && active !== void 0) $$bindings.active(active); if ($$props.hover === void 0 && $$bindings.hover && hover !== void 0) $$bindings.hover(hover); if ($$props.color === void 0 && $$bindings.color && color !== void 0) $$bindings.color(color); if ($$props.fill === void 0 && $$bindings.fill && fill !== void 0) $$bindings.fill(fill); if ($$props.regionLabel === void 0 && $$bindings.regionLabel && regionLabel !== void 0) $$bindings.regionLabel(regionLabel); if ($$props.labelledby === void 0 && $$bindings.labelledby && labelledby !== void 0) $$bindings.labelledby(labelledby); classesBase = `${cBase$2} ${display} ${flexDirection} ${gap} ${background} ${border} ${rounded} ${$$props.class ?? ""}`; return `
${slots.default ? slots.default({}) : ``}
`; }); const cBase$1 = "flex-auto"; const cWrapper$1 = "text-base text-center cursor-pointer"; const cDisabled = "opacity-50 cursor-not-allowed"; const RadioItem = create_ssr_component(($$result, $$props, $$bindings, slots) => { let checked; let classesActive; let classesDisabled; let classsBase; let classesWrapper; let $$restProps = compute_rest_props($$props, [ "group", "name", "value", "title", "label", "rounded", "padding", "active", "hover", "color", "fill", "regionLabel" ]); let { group } = $$props; let { name } = $$props; let { value } = $$props; let { title = "" } = $$props; let { label = "" } = $$props; let { rounded = getContext("rounded") } = $$props; let { padding = getContext("padding") } = $$props; let { active = getContext("active") } = $$props; let { hover = getContext("hover") } = $$props; let { color = getContext("color") } = $$props; let { fill = getContext("fill") } = $$props; let { regionLabel = getContext("regionLabel") } = $$props; let elemInput; function prunedRestProps() { delete $$restProps.class; return $$restProps; } if ($$props.group === void 0 && $$bindings.group && group !== void 0) $$bindings.group(group); if ($$props.name === void 0 && $$bindings.name && name !== void 0) $$bindings.name(name); if ($$props.value === void 0 && $$bindings.value && value !== void 0) $$bindings.value(value); if ($$props.title === void 0 && $$bindings.title && title !== void 0) $$bindings.title(title); if ($$props.label === void 0 && $$bindings.label && label !== void 0) $$bindings.label(label); if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0) $$bindings.rounded(rounded); if ($$props.padding === void 0 && $$bindings.padding && padding !== void 0) $$bindings.padding(padding); if ($$props.active === void 0 && $$bindings.active && active !== void 0) $$bindings.active(active); if ($$props.hover === void 0 && $$bindings.hover && hover !== void 0) $$bindings.hover(hover); if ($$props.color === void 0 && $$bindings.color && color !== void 0) $$bindings.color(color); if ($$props.fill === void 0 && $$bindings.fill && fill !== void 0) $$bindings.fill(fill); if ($$props.regionLabel === void 0 && $$bindings.regionLabel && regionLabel !== void 0) $$bindings.regionLabel(regionLabel); checked = value === group; classesActive = checked ? `${active} ${color} ${fill}` : hover; classesDisabled = $$props.disabled ? cDisabled : ""; classsBase = `${cBase$1}`; classesWrapper = `${cWrapper$1} ${padding} ${rounded} ${classesActive} ${classesDisabled} ${$$props.class ?? ""}`; return ``; }); const cBase = "inline-block"; const cLabel = "unstyled flex items-center"; const cTrack = "flex transition-all duration-[200ms] cursor-pointer"; const cThumb = "w-[50%] h-full scale-[0.8] transition-all duration-[200ms] shadow"; const SlideToggle = create_ssr_component(($$result, $$props, $$bindings, slots) => { let cTrackActive; let cThumbBackground; let cThumbPos; let classesDisabled; let classesBase; let classesLabel; let classesTrack; let classesThumb; let $$restProps = compute_rest_props($$props, ["name", "checked", "size", "background", "active", "border", "rounded", "label"]); let $$slots = compute_slots(slots); createEventDispatcher(); let { name } = $$props; let { checked = false } = $$props; let { size = "md" } = $$props; let { background = "bg-surface-400 dark:bg-surface-700" } = $$props; let { active = "bg-surface-900 dark:bg-surface-300" } = $$props; let { border = "" } = $$props; let { rounded = "rounded-full" } = $$props; let { label = "" } = $$props; let trackSize; switch (size) { case "sm": trackSize = "w-12 h-6"; break; case "lg": trackSize = "w-20 h-10"; break; default: trackSize = "w-16 h-8"; } function prunedRestProps() { delete $$restProps.class; return $$restProps; } if ($$props.name === void 0 && $$bindings.name && name !== void 0) $$bindings.name(name); if ($$props.checked === void 0 && $$bindings.checked && checked !== void 0) $$bindings.checked(checked); if ($$props.size === void 0 && $$bindings.size && size !== void 0) $$bindings.size(size); if ($$props.background === void 0 && $$bindings.background && background !== void 0) $$bindings.background(background); if ($$props.active === void 0 && $$bindings.active && active !== void 0) $$bindings.active(active); if ($$props.border === void 0 && $$bindings.border && border !== void 0) $$bindings.border(border); if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0) $$bindings.rounded(rounded); if ($$props.label === void 0 && $$bindings.label && label !== void 0) $$bindings.label(label); cTrackActive = checked ? active : `${background} cursor-pointer`; cThumbBackground = checked ? "bg-white/75" : "bg-white"; cThumbPos = checked ? "translate-x-full" : ""; classesDisabled = $$props.disabled === true ? "opacity-50" : "hover:brightness-[105%] dark:hover:brightness-110 cursor-pointer"; classesBase = `${cBase} ${rounded} ${classesDisabled} ${$$props.class ?? ""}`; classesLabel = `${cLabel}`; classesTrack = `${cTrack} ${border} ${rounded} ${trackSize} ${cTrackActive}`; classesThumb = `${cThumb} ${rounded} ${cThumbBackground} ${cThumbPos}`; return ``; }); const cWrapper = "flex fixed top-0 left-0 right-0 bottom-0 pointer-events-none"; const cSnackbar = "flex flex-col gap-y-2"; const cToast = "flex justify-between items-center pointer-events-auto"; const cToastActions = "flex items-center space-x-2"; const Toast = create_ssr_component(($$result, $$props, $$bindings, slots) => { let classesWrapper; let classesSnackbar; let classesToast; let filteredToasts; let $toastStore, $$unsubscribe_toastStore; let $prefersReducedMotionStore, $$unsubscribe_prefersReducedMotionStore; $$unsubscribe_prefersReducedMotionStore = subscribe(prefersReducedMotionStore, (value) => $prefersReducedMotionStore = value); const toastStore = getToastStore(); $$unsubscribe_toastStore = subscribe(toastStore, (value) => $toastStore = value); let { position = "b" } = $$props; let { max = 3 } = $$props; let { background = "variant-filled-secondary" } = $$props; let { width = "max-w-[640px]" } = $$props; let { color = "" } = $$props; let { padding = "p-4" } = $$props; let { spacing = "space-x-4" } = $$props; let { rounded = "rounded-container-token" } = $$props; let { shadow = "shadow-lg" } = $$props; let { zIndex = "z-[888]" } = $$props; let { buttonAction = "btn variant-filled" } = $$props; let { buttonDismiss = "btn-icon btn-icon-sm variant-filled" } = $$props; let { buttonDismissLabel = "✕" } = $$props; let { transitions = !$prefersReducedMotionStore } = $$props; let { transitionIn = fly } = $$props; let { transitionInParams = { duration: 250 } } = $$props; let { transitionOut = fly } = $$props; let { transitionOutParams = { duration: 250 } } = $$props; let cPosition; let cAlign; switch (position) { case "t": cPosition = "justify-center items-start"; cAlign = "items-center"; break; case "b": cPosition = "justify-center items-end"; cAlign = "items-center"; break; case "l": cPosition = "justify-start items-center"; cAlign = "items-start"; break; case "r": cPosition = "justify-end items-center"; cAlign = "items-end"; break; case "tl": cPosition = "justify-start items-start"; cAlign = "items-start"; break; case "tr": cPosition = "justify-end items-start"; cAlign = "items-end"; break; case "bl": cPosition = "justify-start items-end"; cAlign = "items-start"; break; case "br": cPosition = "justify-end items-end"; cAlign = "items-end"; break; } if ($$props.position === void 0 && $$bindings.position && position !== void 0) $$bindings.position(position); if ($$props.max === void 0 && $$bindings.max && max !== void 0) $$bindings.max(max); if ($$props.background === void 0 && $$bindings.background && background !== void 0) $$bindings.background(background); if ($$props.width === void 0 && $$bindings.width && width !== void 0) $$bindings.width(width); if ($$props.color === void 0 && $$bindings.color && color !== void 0) $$bindings.color(color); if ($$props.padding === void 0 && $$bindings.padding && padding !== void 0) $$bindings.padding(padding); if ($$props.spacing === void 0 && $$bindings.spacing && spacing !== void 0) $$bindings.spacing(spacing); if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0) $$bindings.rounded(rounded); if ($$props.shadow === void 0 && $$bindings.shadow && shadow !== void 0) $$bindings.shadow(shadow); if ($$props.zIndex === void 0 && $$bindings.zIndex && zIndex !== void 0) $$bindings.zIndex(zIndex); if ($$props.buttonAction === void 0 && $$bindings.buttonAction && buttonAction !== void 0) $$bindings.buttonAction(buttonAction); if ($$props.buttonDismiss === void 0 && $$bindings.buttonDismiss && buttonDismiss !== void 0) $$bindings.buttonDismiss(buttonDismiss); if ($$props.buttonDismissLabel === void 0 && $$bindings.buttonDismissLabel && buttonDismissLabel !== void 0) $$bindings.buttonDismissLabel(buttonDismissLabel); if ($$props.transitions === void 0 && $$bindings.transitions && transitions !== void 0) $$bindings.transitions(transitions); if ($$props.transitionIn === void 0 && $$bindings.transitionIn && transitionIn !== void 0) $$bindings.transitionIn(transitionIn); if ($$props.transitionInParams === void 0 && $$bindings.transitionInParams && transitionInParams !== void 0) $$bindings.transitionInParams(transitionInParams); if ($$props.transitionOut === void 0 && $$bindings.transitionOut && transitionOut !== void 0) $$bindings.transitionOut(transitionOut); if ($$props.transitionOutParams === void 0 && $$bindings.transitionOutParams && transitionOutParams !== void 0) $$bindings.transitionOutParams(transitionOutParams); classesWrapper = `${cWrapper} ${cPosition} ${zIndex} ${$$props.class || ""}`; classesSnackbar = `${cSnackbar} ${cAlign} ${padding}`; classesToast = `${cToast} ${width} ${color} ${padding} ${spacing} ${rounded} ${shadow}`; filteredToasts = Array.from($toastStore).slice(0, max); $$unsubscribe_toastStore(); $$unsubscribe_prefersReducedMotionStore(); return `${$toastStore.length ? `
${each(filteredToasts, (t, i) => { return `
${t.message}
${t.action || !t.hideDismiss ? `
${t.action ? `${t.action.label}` : ``} ${!t.hideDismiss ? `${escape(buttonDismissLabel)}` : ``}
` : ``}
`; })}
` : ``}`; }); const gatheringKey = {}; const GatheringRound = create_ssr_component(($$result, $$props, $$bindings, slots) => { setContext(gatheringKey, true); return `${slots.default ? slots.default({}) : ``}`; }); const getDimensionName = (horizontal) => horizontal ? "height" : "width"; const css$8 = { code: 'div.splitpanes--horizontal.splitpanes--dragging{cursor:row-resize}div.splitpanes--vertical.splitpanes--dragging{cursor:col-resize}.splitpanes{display:flex;width:100%;height:100%}.splitpanes--vertical{flex-direction:row}.splitpanes--horizontal{flex-direction:column}.splitpanes--dragging *{-webkit-user-select:none;-moz-user-select:none;user-select:none}.splitpanes__pane{width:100%;height:100%;overflow:hidden}.splitpanes--vertical .splitpanes__pane{transition:width 0.2s ease-out}.splitpanes--horizontal .splitpanes__pane{transition:height 0.2s ease-out}.splitpanes--vertical>.splitpanes__pane{transition:width 0.2s ease-out}.splitpanes--horizontal>.splitpanes__pane{transition:height 0.2s ease-out}.splitpanes--dragging .splitpanes__pane{transition:none;pointer-events:none}.splitpanes--freeze .splitpanes__pane{transition:none}.splitpanes__splitter{touch-action:none}.splitpanes--vertical>.splitpanes__splitter{min-width:1px}.splitpanes--horizontal>.splitpanes__splitter{min-height:1px}.splitpanes.default-theme .splitpanes__pane{background-color:#f2f2f2}.splitpanes.default-theme .splitpanes__splitter{background-color:#fff;box-sizing:border-box;position:relative;flex-shrink:0}.splitpanes.default-theme .splitpanes__splitter:before,.splitpanes.default-theme .splitpanes__splitter:after{content:"";position:absolute;top:50%;left:50%;background-color:rgba(0, 0, 0, 0.15);transition:background-color 0.3s}.splitpanes.default-theme .splitpanes__splitter:hover:before,.splitpanes.default-theme .splitpanes__splitter:hover:after{background-color:rgba(0, 0, 0, 0.25)}.splitpanes.default-theme .splitpanes__splitter:first-child{cursor:auto}.default-theme.splitpanes .splitpanes .splitpanes__splitter{z-index:1}.default-theme.splitpanes--vertical>.splitpanes__splitter,.default-theme .splitpanes--vertical>.splitpanes__splitter{width:7px;border-left:1px solid #eee;cursor:col-resize}.default-theme.splitpanes--vertical>.splitpanes__splitter:before,.default-theme.splitpanes--vertical>.splitpanes__splitter:after,.default-theme .splitpanes--vertical>.splitpanes__splitter:before,.default-theme .splitpanes--vertical>.splitpanes__splitter:after{transform:translateY(-50%);width:1px;height:30px}.default-theme.splitpanes--vertical>.splitpanes__splitter:before,.default-theme .splitpanes--vertical>.splitpanes__splitter:before{margin-left:-2px}.default-theme.splitpanes--vertical>.splitpanes__splitter:after,.default-theme .splitpanes--vertical>.splitpanes__splitter:after{margin-left:1px}.default-theme.splitpanes--horizontal>.splitpanes__splitter,.default-theme .splitpanes--horizontal>.splitpanes__splitter{height:7px;border-top:1px solid #eee;cursor:row-resize}.default-theme.splitpanes--horizontal>.splitpanes__splitter:before,.default-theme.splitpanes--horizontal>.splitpanes__splitter:after,.default-theme .splitpanes--horizontal>.splitpanes__splitter:before,.default-theme .splitpanes--horizontal>.splitpanes__splitter:after{transform:translateX(-50%);width:30px;height:1px}.default-theme.splitpanes--horizontal>.splitpanes__splitter:before,.default-theme .splitpanes--horizontal>.splitpanes__splitter:before{margin-top:-2px}.default-theme.splitpanes--horizontal>.splitpanes__splitter:after,.default-theme .splitpanes--horizontal>.splitpanes__splitter:after{margin-top:1px}', map: null }; const KEY = {}; const Splitpanes = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $veryFirstPaneKey, $$unsubscribe_veryFirstPaneKey; let $showFirstSplitter, $$unsubscribe_showFirstSplitter; let $isHorizontal, $$unsubscribe_isHorizontal; let { id = void 0 } = $$props; let { horizontal = false } = $$props; let { pushOtherPanes = true } = $$props; let { dblClickSplitter = true } = $$props; let { rtl = "auto" } = $$props; let { firstSplitter = false } = $$props; let { style = null } = $$props; let { theme = "default-theme" } = $$props; let { class: clazz = "" } = $$props; createEventDispatcher(); let container; new Array(); let isHorizontal = writable(horizontal); $$unsubscribe_isHorizontal = subscribe(isHorizontal, (value) => $isHorizontal = value); const showFirstSplitter = writable(firstSplitter); $$unsubscribe_showFirstSplitter = subscribe(showFirstSplitter, (value) => $showFirstSplitter = value); const veryFirstPaneKey = writable(void 0); $$unsubscribe_veryFirstPaneKey = subscribe(veryFirstPaneKey, (value) => $veryFirstPaneKey = value); let ssrPaneDefinedSizeSum = 0; let ssrPaneUndefinedSizeCount = 0; function ssrRegisterPaneSize(size) { if (size == null) { ++ssrPaneUndefinedSizeCount; } else { ssrPaneDefinedSizeSum += size; } } const onPaneInit = (key) => { if ($veryFirstPaneKey === void 0) { set_store_value(veryFirstPaneKey, $veryFirstPaneKey = key, $veryFirstPaneKey); } return { undefinedPaneInitSize: (100 - ssrPaneDefinedSizeSum) / ssrPaneUndefinedSizeCount }; }; setContext(KEY, { showFirstSplitter, veryFirstPaneKey, isHorizontal, ssrRegisterPaneSize: ssrRegisterPaneSize, onPaneInit, clientOnly: void 0 }); if ($$props.id === void 0 && $$bindings.id && id !== void 0) $$bindings.id(id); if ($$props.horizontal === void 0 && $$bindings.horizontal && horizontal !== void 0) $$bindings.horizontal(horizontal); if ($$props.pushOtherPanes === void 0 && $$bindings.pushOtherPanes && pushOtherPanes !== void 0) $$bindings.pushOtherPanes(pushOtherPanes); if ($$props.dblClickSplitter === void 0 && $$bindings.dblClickSplitter && dblClickSplitter !== void 0) $$bindings.dblClickSplitter(dblClickSplitter); if ($$props.rtl === void 0 && $$bindings.rtl && rtl !== void 0) $$bindings.rtl(rtl); if ($$props.firstSplitter === void 0 && $$bindings.firstSplitter && firstSplitter !== void 0) $$bindings.firstSplitter(firstSplitter); if ($$props.style === void 0 && $$bindings.style && style !== void 0) $$bindings.style(style); if ($$props.theme === void 0 && $$bindings.theme && theme !== void 0) $$bindings.theme(theme); if ($$props.class === void 0 && $$bindings.class && clazz !== void 0) $$bindings.class(clazz); $$result.css.add(css$8); set_store_value(isHorizontal, $isHorizontal = horizontal, $isHorizontal); set_store_value(showFirstSplitter, $showFirstSplitter = firstSplitter, $showFirstSplitter); $$unsubscribe_veryFirstPaneKey(); $$unsubscribe_showFirstSplitter(); $$unsubscribe_isHorizontal(); return `${`${validate_component(GatheringRound, "GatheringRound").$$render($$result, {}, {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } })}` } ${slots.default ? slots.default({}) : ``} `; }); const Pane = create_ssr_component(($$result, $$props, $$bindings, slots) => { let dimension; let style; let $isHorizontal, $$unsubscribe_isHorizontal; let $veryFirstPaneKey, $$unsubscribe_veryFirstPaneKey; let $showFirstSplitter, $$unsubscribe_showFirstSplitter; const { ssrRegisterPaneSize, onPaneInit, clientOnly: clientOnlyContext, isHorizontal, showFirstSplitter, veryFirstPaneKey } = getContext(KEY); $$unsubscribe_isHorizontal = subscribe(isHorizontal, (value) => $isHorizontal = value); $$unsubscribe_showFirstSplitter = subscribe(showFirstSplitter, (value) => $showFirstSplitter = value); $$unsubscribe_veryFirstPaneKey = subscribe(veryFirstPaneKey, (value) => $veryFirstPaneKey = value); let { size = null } = $$props; let { minSize = 0 } = $$props; let { maxSize = 100 } = $$props; let { snapSize = 0 } = $$props; let { class: clazz = "" } = $$props; const key = {}; const gathering = hasContext(gatheringKey); const { undefinedPaneInitSize } = !gathering ? onPaneInit(key) : {}; let element; let sz = size ?? undefinedPaneInitSize; if (gathering) { ssrRegisterPaneSize(size); } if ($$props.size === void 0 && $$bindings.size && size !== void 0) $$bindings.size(size); if ($$props.minSize === void 0 && $$bindings.minSize && minSize !== void 0) $$bindings.minSize(minSize); if ($$props.maxSize === void 0 && $$bindings.maxSize && maxSize !== void 0) $$bindings.maxSize(maxSize); if ($$props.snapSize === void 0 && $$bindings.snapSize && snapSize !== void 0) $$bindings.snapSize(snapSize); if ($$props.class === void 0 && $$bindings.class && clazz !== void 0) $$bindings.class(clazz); dimension = getDimensionName($isHorizontal); style = `${dimension}: ${sz}%;`; $$unsubscribe_isHorizontal(); $$unsubscribe_veryFirstPaneKey(); $$unsubscribe_showFirstSplitter(); return `${!gathering ? ` ${$veryFirstPaneKey !== key || $showFirstSplitter ? `
` : ``} ${slots.default ? slots.default({}) : ``}` : ``}`; }); const LoadingSpinner = create_ssr_component(($$result, $$props, $$bindings, slots) => { let { size = 20 } = $$props; if ($$props.size === void 0 && $$bindings.size && size !== void 0) $$bindings.size(size); return ``; }); const css$7 = { code: ".llm-health-status.svelte-a20mi8{color:slategray;font-size:12px;display:inline-flex;align-items:center;min-width:200px\r\n }.dot.svelte-a20mi8{width:20px;height:20px}", map: null }; const LlmHealthStatus = create_ssr_component(($$result, $$props, $$bindings, slots) => { let { status = "unknown" } = $$props; let color = ""; let shadowColor = ""; let text = ""; switch (status) { case "ok": color = "#4CAF50"; shadowColor = "rgba(0, 128, 0, 0.7)"; text = "Сервис LLM работает"; break; case "error": text = "Сервис LLM не работает"; break; case "loading model": color = "yellow"; shadowColor = "rgba(255, 255, 0, 0.7)"; text = "Сервис LLM запускается..."; break; case "unavailable": color = "#af4f4c"; shadowColor = "#af4f4c"; text = "Сервис LLM не запущен"; break; case "unknown": color = "#af4f4c"; shadowColor = "#af4f4c"; text = "Сервис LLM недоступен"; break; } if ($$props.status === void 0 && $$bindings.status && status !== void 0) $$bindings.status(status); $$result.css.add(css$7); return `
${escape(text)}
`; }); const css$6 = { code: ".llm-health-status.svelte-1wcf73j{color:slategray;font-size:12px;display:inline-flex;align-items:center}.dot.svelte-1wcf73j{width:20px;height:20px}", map: null }; const SearchApiHealthStatus = create_ssr_component(($$result, $$props, $$bindings, slots) => { let { status = "unavailable" } = $$props; let color = ""; let shadowColor = ""; let text = ""; switch (status) { case "ok": color = "#4CAF50"; shadowColor = "rgba(0, 128, 0, 0.7)"; text = "Поиск работает"; break; case "unavailable": color = "#af4f4c"; shadowColor = "#af4f4c"; text = "Поиск не запущен"; break; case "unknown": color = "#af4f4c"; shadowColor = "#af4f4c"; text = "Поиск недоступен"; break; } if ($$props.status === void 0 && $$bindings.status && status !== void 0) $$bindings.status(status); $$result.css.add(css$6); return `
${escape(text)}
`; }); class SearchResultsSorter { static findDateInText(text) { const dateStringRegex = /\b\d{1,2}\.\d{1,2}\.\d{4}\b/g; const matches = text.match(dateStringRegex); if (matches && matches.length > 0) { const dateString = matches[0]; const [day, month, year] = dateString.split(".").map(Number); return new Date(year, month - 1, day); } return null; } static sortByRelevanceAndDate(data) { return data.sort((a, b) => { const relevanceComparison = b.relevance - a.relevance; if (relevanceComparison !== 0) { return relevanceComparison; } const dateA = SearchResultsSorter.findDateInText(a.title); const dateB = SearchResultsSorter.findDateInText(b.title); if (dateA && dateB) { return dateB.getTime() - dateA.getTime(); } else if (dateA) { return -1; } else if (dateB) { return 1; } else { return 0; } }); } static sortByDate(dataArray) { const entriesWithDates = dataArray.filter((item) => SearchResultsSorter.findDateInText(item.title)); const entriesWithoutDates = dataArray.filter((item) => !SearchResultsSorter.findDateInText(item.title)); const sortedEntriesWithDates = entriesWithDates.sort((a, b) => { const dateA = SearchResultsSorter.findDateInText(a.title); const dateB = SearchResultsSorter.findDateInText(b.title); if (dateA && dateB) { return dateB.getTime() - dateA.getTime(); } else if (dateA) { return -1; } else if (dateB) { return 1; } else { return 0; } }); const resultArray = []; let indexWithoutDates = 0; for (const entry of dataArray) { if (SearchResultsSorter.findDateInText(entry.title)) { let val = sortedEntriesWithDates.shift(); if (val) resultArray.push(val); } else { resultArray.push(entriesWithoutDates[indexWithoutDates]); indexWithoutDates++; } } return resultArray; } static sortByRelevance(data) { return data.sort((a, b) => { if (a.relevance && b.relevance) { return b.relevance - a.relevance; } else if (a.relevance) { return -1; } else if (b.relevance) { return 1; } else { return 0; } }); } static identifyDocumentType(data) { const regexps = [ { regexp: /(ФАС |АС |КС |ВС |[Сс]удебн|[Сс]уд)|(\(Судебный документ\))/, docType: "Решение суда" }, { regexp: /[Пп]исьмо [Мм]инфина/, docType: "Письмо Минфина" }, { regexp: /[Пп]исьмо (ФНС|фнс)/, docType: "Письмо ФНС" }, { regexp: /(НКРФ)|(НК РФ)/, docType: "Налоговый кодекс" }, { regexp: /(ГКРФ)|(ГК РФ)/, docType: "Гражданский кодекс" }, { regexp: /(ТКРФ)|(ТК РФ)/, docType: "Трудовой кодекс" }, { regexp: /Приказ ФНС РФ/, docType: "Приказ ФНС РФ" }, { regexp: /Постановление Правительства РФ/, docType: "Постановление Правительства РФ" }, { regexp: /Решение Коллегии Евразийской экономической комиссии/, docType: "Решение Коллегии ЕЭК" }, { regexp: /Федеральный закон/, docType: "Федеральные законы" }, { regexp: /\(Внутренний документ\)/, docType: "Внутренние документы" } ]; return data.map((result) => { for (const { regexp, docType } of regexps) { if (regexp.test(result.title)) { result.docType = docType; return result; } } result.docType = "Другие документы"; return result; }); } static mergeResultsByTitle(data) { const regex = /(ст\.\d+)\s(НКРФ|НК РФ|ГКРФ|ГК РФ|ТКРФ|ТК РФ)$/; const grouped = {}; const mergedResults = []; const extractArticleAndCode = (title) => { const match = title.match(regex); return match ? match[0] : null; }; data.forEach((item) => { const key = extractArticleAndCode(item.title); if (key) { if (grouped[key]) { grouped[key].relevance = Math.max( grouped[key].relevance, item.relevance ); const existingTitle = grouped[key].title.match(/п[\w\.]+/g) || []; const newTitle = item.title.match(/п[\w\.]+/g) || []; const combinedTitle = [.../* @__PURE__ */ new Set([...existingTitle, ...newTitle])].join(", "); grouped[key].title = `${combinedTitle} ст.${key.split(" ")[0].split(".")[1]} ${key.split(" ")[1]}`; grouped[key].text += ` ${item.title} ${item.text}`; } else { grouped[key] = { ...item }; } } else { mergedResults.push(item); } }); Object.keys(grouped).forEach((key) => { mergedResults.push(grouped[key]); }); return mergedResults; } } const css$5 = { code: ".search-result.svelte-1srbk6k{margin-bottom:20px}.title.svelte-1srbk6k{font-weight:bold}.annotation.svelte-1srbk6k{overflow:hidden;display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;text-overflow:ellipsis;white-space:normal}a.svelte-1srbk6k{cursor:pointer}.full-text.svelte-1srbk6k{display:block;white-space:normal}.title.svelte-1srbk6k{color:#1a0dab}", map: null }; const SearchResultsItem = create_ssr_component(($$result, $$props, $$bindings, slots) => { let { showFullText = Array(10).fill(false) } = $$props; let { useSearchResult } = $$props; let { index } = $$props; let { title } = $$props; let { teaser } = $$props; let { text } = $$props; let { enableDocumentDb = false } = $$props; let { documentDbUrl = "" } = $$props; let { enableSearchResultSelection = false } = $$props; if ($$props.showFullText === void 0 && $$bindings.showFullText && showFullText !== void 0) $$bindings.showFullText(showFullText); if ($$props.useSearchResult === void 0 && $$bindings.useSearchResult && useSearchResult !== void 0) $$bindings.useSearchResult(useSearchResult); if ($$props.index === void 0 && $$bindings.index && index !== void 0) $$bindings.index(index); if ($$props.title === void 0 && $$bindings.title && title !== void 0) $$bindings.title(title); if ($$props.teaser === void 0 && $$bindings.teaser && teaser !== void 0) $$bindings.teaser(teaser); if ($$props.text === void 0 && $$bindings.text && text !== void 0) $$bindings.text(text); if ($$props.enableDocumentDb === void 0 && $$bindings.enableDocumentDb && enableDocumentDb !== void 0) $$bindings.enableDocumentDb(enableDocumentDb); if ($$props.documentDbUrl === void 0 && $$bindings.documentDbUrl && documentDbUrl !== void 0) $$bindings.documentDbUrl(documentDbUrl); if ($$props.enableSearchResultSelection === void 0 && $$bindings.enableSearchResultSelection && enableSearchResultSelection !== void 0) $$bindings.enableSearchResultSelection(enableSearchResultSelection); $$result.css.add(css$5); return `
${showFullText[index] ? `
${each(text.split("\n"), (line) => { return `

${escape(line)}

`; })}
` : `
${escape(teaser)}
`} ${enableDocumentDb && documentDbUrl ? `Открыть документ` : ``} ${text.length > 100 ? `${showFullText[index] ? `свернуть` : `развернуть`}` : ``}
`; }); const css$4 = { code: ".search-results.svelte-1ptibtq.svelte-1ptibtq{flex:1;overflow-y:auto;padding:1rem}.settings-bar.svelte-1ptibtq.svelte-1ptibtq{margin-bottom:10px}.settings-bar.svelte-1ptibtq label.svelte-1ptibtq{margin-right:10px}", map: null }; const SearchResults = create_ssr_component(($$result, $$props, $$bindings, slots) => { let { enableDocumentDb = false } = $$props; let { documentDbUrl = "" } = $$props; let { showFullText = Array(10).fill(false) } = $$props; let { useSearchResult } = $$props; let groupByChecked = false; let sortSearchResultsBy = "rel"; let { searchResults = [] } = $$props; let groupedSearchResults; let { enableSearchResultSelection = false } = $$props; const groupByType = (searchResults2) => { return searchResults2.reduce( (result, item) => { const docType = item.docType || "Другие документы"; if (!result[docType]) { result[docType] = []; } result[docType].push(item); return result; }, {} ); }; if ($$props.enableDocumentDb === void 0 && $$bindings.enableDocumentDb && enableDocumentDb !== void 0) $$bindings.enableDocumentDb(enableDocumentDb); if ($$props.documentDbUrl === void 0 && $$bindings.documentDbUrl && documentDbUrl !== void 0) $$bindings.documentDbUrl(documentDbUrl); if ($$props.showFullText === void 0 && $$bindings.showFullText && showFullText !== void 0) $$bindings.showFullText(showFullText); if ($$props.useSearchResult === void 0 && $$bindings.useSearchResult && useSearchResult !== void 0) $$bindings.useSearchResult(useSearchResult); if ($$props.searchResults === void 0 && $$bindings.searchResults && searchResults !== void 0) $$bindings.searchResults(searchResults); if ($$props.enableSearchResultSelection === void 0 && $$bindings.enableSearchResultSelection && enableSearchResultSelection !== void 0) $$bindings.enableSearchResultSelection(enableSearchResultSelection); $$result.css.add(css$4); let $$settled; let $$rendered; let previous_head = $$result.head; do { $$settled = true; $$result.head = previous_head; { { if (groupByChecked) { groupedSearchResults = groupByType(searchResults); } if (sortSearchResultsBy == "date") { searchResults = SearchResultsSorter.sortByDate(searchResults); } else if (sortSearchResultsBy == "rel") { searchResults = SearchResultsSorter.sortByRelevance(searchResults); } } } { if (useSearchResult === void 0) { useSearchResult = {}; } } $$rendered = `
${searchResults && searchResults.length > 0 ? `
${validate_component(RadioGroup, "RadioGroup").$$render($$result, { background: "", border: "" }, {}, { default: () => { return `${validate_component(RadioItem, "RadioItem").$$render( $$result, { name: "sortBy", value: "rel", group: sortSearchResultsBy }, { group: ($$value) => { sortSearchResultsBy = $$value; $$settled = false; } }, { default: () => { return `релевантности`; } } )} ${validate_component(RadioItem, "RadioItem").$$render( $$result, { name: "sortBy", value: "date", group: sortSearchResultsBy }, { group: ($$value) => { sortSearchResultsBy = $$value; $$settled = false; } }, { default: () => { return `дате`; } } )}`; } })} ${validate_component(SlideToggle, "SlideToggle").$$render( $$result, { name: "groupByChecked", size: "sm", label: "Группировать по типу", checked: groupByChecked }, { checked: ($$value) => { groupByChecked = $$value; $$settled = false; } }, { default: () => { return `Группировать по типу`; } } )}
` : ``} ${groupByChecked && groupedSearchResults ? `${validate_component(Accordion, "Accordion").$$render($$result, {}, {}, { default: () => { return `${each(Object.entries(groupedSearchResults), ([docType, results]) => { return `${validate_component(AccordionItem, "AccordionItem").$$render($$result, {}, {}, { content: () => { return `${each(results, ({ title, text, teaser }, index) => { return `${validate_component(SearchResultsItem, "SearchResultsItem").$$render( $$result, { title, text, teaser, index, enableSearchResultSelection, useSearchResult, showFullText }, {}, {} )}`; })} `; }, summary: () => { return `${escape(docType)}`; }, lead: () => { return `${enableSearchResultSelection ? `` : ``} `; } })}`; })}`; } })}` : `${each(searchResults, ({ title, text, teaser }, index) => { return `${validate_component(SearchResultsItem, "SearchResultsItem").$$render( $$result, { title, text, teaser, index, enableSearchResultSelection, useSearchResult, showFullText, enableDocumentDb, documentDbUrl }, {}, {} )}`; })}`}
${``}`; } while (!$$settled); return $$rendered; }); const css$3 = { code: ".consultation-item.svelte-13z9n8v{margin-bottom:20px}.title.svelte-13z9n8v{font-weight:bold}.annotation.svelte-13z9n8v{overflow:hidden;display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;text-overflow:ellipsis;white-space:normal}a.svelte-13z9n8v{cursor:pointer;color:#1a0dab}.full-text.svelte-13z9n8v{display:block;white-space:normal}p.svelte-13z9n8v{margin-top:10px;margin-bottom:10px}", map: null }; const ConsultationItem = create_ssr_component(($$result, $$props, $$bindings, slots) => { let { showFullText = Array(10).fill(false) } = $$props; let { index } = $$props; let { title } = $$props; let { text } = $$props; if ($$props.showFullText === void 0 && $$bindings.showFullText && showFullText !== void 0) $$bindings.showFullText(showFullText); if ($$props.index === void 0 && $$bindings.index && index !== void 0) $$bindings.index(index); if ($$props.title === void 0 && $$bindings.title && title !== void 0) $$bindings.title(title); if ($$props.text === void 0 && $$bindings.text && text !== void 0) $$bindings.text(text); $$result.css.add(css$3); return `
${showFullText[index] ? `
${each(text.split("\n"), (line) => { return `

${escape(line)}

`; })}
` : ``}
`; }); const css$2 = { code: "h2.svelte-s2jiei{margin-bottom:10px;font-size:large}.relevant-consultations.svelte-s2jiei{flex:1;overflow-y:auto;padding:1rem}", map: null }; const RelevantConsultations = create_ssr_component(($$result, $$props, $$bindings, slots) => { let { showFullText = Array(10).fill(false) } = $$props; let { consultations = [] } = $$props; if ($$props.showFullText === void 0 && $$bindings.showFullText && showFullText !== void 0) $$bindings.showFullText(showFullText); if ($$props.consultations === void 0 && $$bindings.consultations && consultations !== void 0) $$bindings.consultations(consultations); $$result.css.add(css$2); return `

Релевантные консультации

${each(consultations, ({ title, text }, index) => { return `${validate_component(ConsultationItem, "ConsultationItem").$$render($$result, { title, text, index, showFullText }, {}, {})}`; })}
${``}`; }); const HISTORY_KEY_PREFIX = "clarificationHistory_"; const HISTORY_INDEX_KEY = "clarificationHistoryIndex"; const HISTORY_ITEMS_LIMIT = 2; class ClarificationHistoryService { // Загружает историю как массив, собирая данные из ключей с префиксом static loadHistory() { const history = []; const index = this.getHistoryIndex(); for (let i = 0; i < index; i++) { const item = localStorage.getItem(`${HISTORY_KEY_PREFIX}${i}`); if (item) { history.push(JSON.parse(item)); } } return history; } // Сохраняет элемент истории с новым индексом и управляет лимитом элементов static addHistoryItem(item) { const index = this.getHistoryIndex(); localStorage.setItem(`${HISTORY_KEY_PREFIX}${index}`, JSON.stringify(item)); this.setHistoryIndex(index + 1); this.manageHistoryLimit(); } // Обновляет элемент истории с заданным индексом static updateHistoryItem(index, item) { localStorage.setItem(`${HISTORY_KEY_PREFIX}${index}`, JSON.stringify(item)); } // Возвращает элемент истории по индексу static getHistoryItem(index) { const item = localStorage.getItem(`${HISTORY_KEY_PREFIX}${index}`); return item ? JSON.parse(item) : null; } // Возвращает количество элементов в истории static getHistoryLength() { return this.getHistoryIndex(); } // Удаляет все элементы истории static clearHistory() { const index = this.getHistoryIndex(); for (let i = 0; i < index; i++) { localStorage.removeItem(`${HISTORY_KEY_PREFIX}${i}`); } localStorage.removeItem(HISTORY_INDEX_KEY); } // Вспомогательная функция для управления лимитом истории static manageHistoryLimit() { const index = this.getHistoryIndex(); if (index > HISTORY_ITEMS_LIMIT) { const excessCount = index - HISTORY_ITEMS_LIMIT; for (let i = 0; i < excessCount; i++) { localStorage.removeItem(`${HISTORY_KEY_PREFIX}${i}`); } this.shiftHistoryKeys(excessCount); this.setHistoryIndex(HISTORY_ITEMS_LIMIT); } } // Смещает ключи истории при удалении старых элементов static shiftHistoryKeys(shiftAmount) { const index = this.getHistoryIndex(); for (let i = shiftAmount; i < index; i++) { const item = localStorage.getItem(`${HISTORY_KEY_PREFIX}${i}`); if (item) { localStorage.setItem(`${HISTORY_KEY_PREFIX}${i - shiftAmount}`, item); } localStorage.removeItem(`${HISTORY_KEY_PREFIX}${i}`); } } // Вспомогательная функция для получения текущего индекса истории static getHistoryIndex() { const index = localStorage.getItem(HISTORY_INDEX_KEY); return index ? parseInt(index, 10) : 0; } // Вспомогательная функция для установки индекса истории static setHistoryIndex(index) { localStorage.setItem(HISTORY_INDEX_KEY, index.toString()); } } const css$1 = { code: "textarea.svelte-wjelcf{border:1px solid #ccc;border-radius:4px;width:100%;font-size:14px;margin-bottom:10px;box-sizing:border-box;padding:1rem}button.svelte-wjelcf{margin:5px}", map: null }; const UserClarification = create_ssr_component(($$result, $$props, $$bindings, slots) => { let { userRequest = "" } = $$props; let { searchClarification = "" } = $$props; let { llmClarification = "" } = $$props; let { searchResults } = $$props; let { relevantConsultations } = $$props; let { llmResponse = "" } = $$props; let { historyIsNotEmpty = false } = $$props; let currentHistoryIndex = 0; let history = []; let historyLength = 0; function loadCurrentHistoryItem() { const item = ClarificationHistoryService.getHistoryItem(currentHistoryIndex); if (item) { searchClarification = item.searchClarification; llmClarification = item.llmClarification; searchResults = item.searchResults; relevantConsultations = item.relevantConsultations; llmResponse = item.llmResponse; userRequest = item.userRequest; } return item; } function getCurrentState() { return ClarificationHistoryService.getHistoryItem(currentHistoryIndex); } function addState(request) { console.log("addState called"); const newItem = { userRequest: request, searchClarification, llmClarification, searchResults: [], llmResponse: "", relevantConsultations: [], transactionMaps: [] }; historyLength = ClarificationHistoryService.getHistoryLength(); ClarificationHistoryService.addHistoryItem(newItem); currentHistoryIndex = historyLength - 1; } function updateCurrentState(request, searchResults2, llmResponse2, relevantConsultations2, transactionMaps) { console.log("updateCurrentState called"); const item = ClarificationHistoryService.getHistoryItem(currentHistoryIndex); if (item) { item.userRequest = request ?? item.userRequest; item.searchClarification = searchClarification ?? item.searchClarification; item.llmClarification = llmClarification ?? item.llmClarification; item.searchResults = searchResults2 ?? item.searchResults; item.llmResponse = llmResponse2 ?? item.llmResponse; item.relevantConsultations = relevantConsultations2 ?? item.relevantConsultations; item.transactionMaps = transactionMaps ?? item.transactionMaps; console.log(item); ClarificationHistoryService.updateHistoryItem(currentHistoryIndex, item); } } function prevHistory() { if (currentHistoryIndex > 0) { currentHistoryIndex -= 1; loadCurrentHistoryItem(); } } function nextHistory() { if (currentHistoryIndex < history.length - 1) { currentHistoryIndex += 1; loadCurrentHistoryItem(); } } function clear() { llmClarification = ""; searchClarification = ""; } if ($$props.userRequest === void 0 && $$bindings.userRequest && userRequest !== void 0) $$bindings.userRequest(userRequest); if ($$props.searchClarification === void 0 && $$bindings.searchClarification && searchClarification !== void 0) $$bindings.searchClarification(searchClarification); if ($$props.llmClarification === void 0 && $$bindings.llmClarification && llmClarification !== void 0) $$bindings.llmClarification(llmClarification); if ($$props.searchResults === void 0 && $$bindings.searchResults && searchResults !== void 0) $$bindings.searchResults(searchResults); if ($$props.relevantConsultations === void 0 && $$bindings.relevantConsultations && relevantConsultations !== void 0) $$bindings.relevantConsultations(relevantConsultations); if ($$props.llmResponse === void 0 && $$bindings.llmResponse && llmResponse !== void 0) $$bindings.llmResponse(llmResponse); if ($$props.historyIsNotEmpty === void 0 && $$bindings.historyIsNotEmpty && historyIsNotEmpty !== void 0) $$bindings.historyIsNotEmpty(historyIsNotEmpty); if ($$props.loadCurrentHistoryItem === void 0 && $$bindings.loadCurrentHistoryItem && loadCurrentHistoryItem !== void 0) $$bindings.loadCurrentHistoryItem(loadCurrentHistoryItem); if ($$props.getCurrentState === void 0 && $$bindings.getCurrentState && getCurrentState !== void 0) $$bindings.getCurrentState(getCurrentState); if ($$props.addState === void 0 && $$bindings.addState && addState !== void 0) $$bindings.addState(addState); if ($$props.updateCurrentState === void 0 && $$bindings.updateCurrentState && updateCurrentState !== void 0) $$bindings.updateCurrentState(updateCurrentState); if ($$props.prevHistory === void 0 && $$bindings.prevHistory && prevHistory !== void 0) $$bindings.prevHistory(prevHistory); if ($$props.nextHistory === void 0 && $$bindings.nextHistory && nextHistory !== void 0) $$bindings.nextHistory(nextHistory); if ($$props.clear === void 0 && $$bindings.clear && clear !== void 0) $$bindings.clear(clear); $$result.css.add(css$1); return `
${``}`; }); const referenceId = "66d6a6c5ac59a1dde4b24a6e"; const css = { code: '.loading-container.svelte-rgnwju.svelte-rgnwju{display:flex;justify-content:center;align-items:center;align-self:center;width:3rem;height:90%;margin-left:5px}.loading-status.svelte-rgnwju.svelte-rgnwju{display:flex;justify-content:center;align-items:center;align-self:center}.grow-wrap.svelte-rgnwju.svelte-rgnwju{display:grid}.grow-wrap.svelte-rgnwju.svelte-rgnwju::after{content:attr(data-replicated-value) " ";white-space:pre-wrap;visibility:hidden;max-width:100%;max-height:250px;display:block;overflow-x:hidden}.grow-wrap.svelte-rgnwju>textarea.svelte-rgnwju{resize:none}.grow-wrap.svelte-rgnwju>textarea.svelte-rgnwju,.grow-wrap.svelte-rgnwju.svelte-rgnwju::after{padding:1rem;border:1px solid #ccc;border-radius:4px;width:100%;font-size:14px;margin-bottom:10px;box-sizing:border-box;grid-area:1/1/2/2}.grow-wrap.svelte-rgnwju>textarea .svelte-rgnwju:focus,.grow-wrap.svelte-rgnwju::after .svelte-rgnwju:focus{outline:none;border-color:#1976d2}.grow-wrap.svelte-rgnwju>textarea .svelte-rgnwju:placeholder,.grow-wrap.svelte-rgnwju::after .svelte-rgnwju:placeholder{color:#aaa}.auto-expand-textarea.svelte-rgnwju.svelte-rgnwju{box-sizing:border-box;width:100%;font-size:16px;border:1px solid #ccc;resize:vertical;overflow-y:auto;min-height:1rem}.search-column.svelte-rgnwju.svelte-rgnwju{flex:1;display:flex;flex-direction:column;border-right:1px solid #ccc}.search-bar.svelte-rgnwju.svelte-rgnwju{padding:1rem}.search-bar.svelte-rgnwju textarea.svelte-rgnwju{width:100%;max-width:100%;padding:1rem;box-sizing:border-box}.textarea-column.svelte-rgnwju.svelte-rgnwju{flex:1;display:flex;flex-direction:column}.textarea.svelte-rgnwju.svelte-rgnwju{width:100%;height:100%;margin:10px;border:none;outline:none;resize:none;background:transparent}@media(max-width: 767px){.search-column.svelte-rgnwju.svelte-rgnwju,.textarea-column.svelte-rgnwju.svelte-rgnwju{border-right:none}}.search-second-bar.svelte-rgnwju.svelte-rgnwju{display:flex;justify-content:space-between;flex-wrap:wrap}.search-second-bar.svelte-rgnwju .status-components.svelte-rgnwju{flex:1;margin-right:10px;margin-top:10px}@media(max-width: 600px){.search-second-bar.svelte-rgnwju.svelte-rgnwju{flex-direction:column}.search-second-bar.svelte-rgnwju .status-components.svelte-rgnwju{width:100%;margin-right:0;margin-bottom:10px}}textarea.svelte-rgnwju.svelte-rgnwju{border:1px solid #ccc;border-radius:4px;width:100%;font-size:14px;margin-bottom:10px;box-sizing:border-box;padding:1rem}a.svelte-rgnwju.svelte-rgnwju{cursor:pointer}.reference-btn.svelte-rgnwju.svelte-rgnwju{text-decoration:none;color:black}.reference-btn.svelte-rgnwju svg.svelte-rgnwju{margin-right:10px}.reference-btn.svelte-rgnwju.svelte-rgnwju:hover{text-decoration:none;color:black}', map: null }; const Page = create_ssr_component(($$result, $$props, $$bindings, slots) => { let { data } = $$props; const { ENV_DOCUMENT_DB_URL, ENV_ENABLE_DOCUMENT_DB, ENV_ENABLE_DB_SUPPORT } = data; let userClarificationComponent; initializeStores(); getToastStore(); let userSearchClarification = ""; let userLlmClarification = ""; let historyIsNotEmpty = true; let llmHealthStatus = "unknown"; let searchHealthStatus = "unknown"; let healthInterval; onDestroy(() => { clearInterval(healthInterval); cancelLlmRequest(); }); let searchResults = []; let relevantConsultations = []; let isLlmLoading = false; let currentLlmResponse = ""; let baseLlmResponse = ""; let currentUserRequest = ""; let savedUserRequest = ""; let loadingStatusText = ""; let showFullText = Array(searchResults.length).fill(false); let showConsultationFullText = Array(relevantConsultations.length).fill(false); let useSearchResult; let enableSearchResultSelection = false; let enableLLMForTeasers = false; let doMultistepSearch = false; let useAccountingDocs = false; let useReranking = false; let useLLMForFiltering = false; let useKeywords = false; let disableThresholds = false; let searchInTransactionLedger = false; let searchInTransactionLedgerByQuestion = false; let searchInTransactionLedgerByOperation = false; let useShortestPrompt = false; let shortestPromptGenerationFinished = false; let enableRealtimeLlmReponse = false; let sendConsultationToLlm = false; let showClarifyLlmResponseButton = false; let abortController = new AbortController(); const cancelLlmRequest = () => { abortController.abort("user canceled"); abortController = new AbortController(); isLlmLoading = false; loadingStatusText = ""; }; if ($$props.data === void 0 && $$bindings.data && data !== void 0) $$bindings.data(data); $$result.css.add(css); let $$settled; let $$rendered; let previous_head = $$result.head; do { $$settled = true; $$result.head = previous_head; { { { searchInTransactionLedger = false; } if ( // clarificationEntry && // isClarificationPaneVisible && userLlmClarification && // clarificationEntry.userRequest == currentUserRequest && searchResults.length > 0 && baseLlmResponse && savedUserRequest == currentUserRequest && !isLlmLoading ) { showClarifyLlmResponseButton = true; } else { showClarifyLlmResponseButton = false; } } } $$rendered = `${$$result.head += `${$$result.title = `LLM demo app`, ""}`, ""} ${validate_component(Toast, "Toast").$$render($$result, {}, {}, {})}
`; } while (!$$settled); return $$rendered; }); export { Page as default }; //# sourceMappingURL=_page.svelte-IDJdT7Zl.js.map