import{f as a,m as t,a as o,b as l,c as n,d as h}from"./fetch-0a44356a.js";window.fetchEventSource=a;const c=localStorage.getItem("lqdDarkMode"),d=localStorage.getItem("docsViewMode"),g=localStorage.getItem("lqdNavbarShrinked");window.Alpine=t;t.plugin([o,l,n,h]);t.store("navbarShrink",{active:t.$persist(!!g).as("lqdNavbarShrinked"),toggle(e){this.active=e?e==="shrink":!this.active,document.body.classList.toggle("navbar-shrinked",this.active)}});t.data("navbarItem",()=>({dropdownOpen:!1,toggleDropdownOpen(e){this.dropdownOpen=e?e==="collapse":!this.dropdownOpen},item:{["x-ref"]:"item",["@mouseenter"](){if(!t.store("navbarShrink").active)return;const e=this.$el.getBoundingClientRect(),s=this.$refs.item.querySelector(".lqd-navbar-dropdown");if(["y","height","bottom"].forEach(r=>this.$refs.item.style.setProperty(`--item-${r}`,`${e[r]}px`)),s){const r=s.getBoundingClientRect();["height"].forEach(i=>this.$refs.item.style.setProperty(`--dropdown-${i}`,`${r[i]}px`))}}}}));t.store("mobileNav",{navCollapse:!0,toggleNav(e){this.navCollapse=e?e==="collapse":!this.navCollapse},templatesCollapse:!0,toggleTemplates(e){this.templatesCollapse=e?e==="collapse":!this.templatesCollapse},searchCollapse:!0,toggleSearch(e){this.searchCollapse=e?e==="collapse":!this.searchCollapse}});t.store("darkMode",{on:t.$persist(!!c).as("lqdDarkMode"),toggle(){this.on=!this.on,document.body.classList.toggle("theme-dark",this.on),document.body.classList.toggle("theme-light",!this.on)}});t.store("appLoadingIndicator",{showing:!1,show(){this.showing=!0},hide(){this.showing=!1},toggle(){this.showing=!this.showing}});t.store("docsViewMode",{docsViewMode:t.$persist(d||"list").as("docsViewMode"),change(e){this.docsViewMode=e}});t.store("generatorsFilter",{init(){const e=new URLSearchParams(window.location.search);this.filter=e.get("filter")||"all"},filter:"all",changeFilter(e){if(this.filter!==e){if(!document.startViewTransition)return this.filter=e;document.startViewTransition(()=>this.filter=e)}}});t.store("documentsFilter",{init(){const e=new URLSearchParams(window.location.search);this.sort=e.get("sort")||"created_at",this.sortAscDesc=e.get("sortAscDesc")||"desc",this.filter=e.get("filter")||"all",this.page=e.get("page")||"1"},sort:"created_at",sortAscDesc:"desc",filter:"all",page:"1",changeSort(e){e===this.sort?this.sortAscDesc=this.sortAscDesc==="desc"?"asc":"desc":this.sortAscDesc="desc",this.sort=e},changeAscDesc(e){this.ascDesc!==e&&(this.ascDesc=e)},changeFilter(e){this.filter!==e&&(this.filter=e)},changePage(e){(e===">"||e==="<")&&(e=e===">"?Number(this.page)+1:Number(this.page)-1),this.page!==e&&(this.page=e)}});t.store("chatsFilter",{init(){const e=new URLSearchParams(window.location.search);this.filter=e.get("filter")||"all",this.setSearchStr(e.get("search")||"")},searchStr:"",setSearchStr(e){this.searchStr=e.trim().toLowerCase()},filter:"all",changeFilter(e){if(this.filter!==e){if(!document.startViewTransition)return this.filter=e;document.startViewTransition(()=>this.filter=e)}}});t.data("generatorV2",()=>({itemsSearchStr:"",setItemsSearchStr(e){this.itemsSearchStr=e.trim().toLowerCase(),this.itemsSearchStr!==""?this.$el.closest(".lqd-generator-sidebar").classList.add("lqd-showing-search-results"):this.$el.closest(".lqd-generator-sidebar").classList.remove("lqd-showing-search-results")},sideNavCollapsed:!1,toggleSideNavCollapse(e){var s;this.sideNavCollapsed=e?e==="collapse":!this.sideNavCollapsed,this.sideNavCollapsed&&((s=tinymce==null?void 0:tinymce.activeEditor)==null||s.focus())},generatorStep:0,setGeneratorStep(e){if(e!==this.generatorStep){if(!document.startViewTransition)return this.generatorStep=Number(e);document.startViewTransition(()=>this.generatorStep=Number(e))}},selectedGenerator:null}));t.store("mobileChat",{sidebarOpen:!1,toggleSidebar(e){this.sidebarOpen=e?!1:!this.sidebarOpen}});t.data("dropdown",({triggerType:e="hover"})=>({open:!1,toggle(s){this.open=s?s!=="collapse":!this.open,this.$refs.parent.classList.toggle("lqd-is-active",this.open)},parent:{["@mouseenter"](){e==="hover"&&this.toggle("expand")},["@mouseleave"](){e==="hover"&&this.toggle("collapse")},["@click.outside"](){this.toggle("collapse")}},trigger:{["@click.prevent"](){e==="click"&&this.toggle()}},dropdown:{}}));t.start();
