import{m as i,a,b as o,c as r}from"./vendor-alpine-CYw8GRfW.js";/* empty css                           */import"./vendor-CMBiYTiD.js";i.plugin(a);i.plugin(o);i.plugin(r);i.store("siteLayout",{mobileMenuOpen:!1,scrolled:!1,init(){window.addEventListener("scroll",()=>{this.scrolled=window.scrollY>50},{passive:!0})},toggleMobileMenu(){this.mobileMenuOpen=!this.mobileMenuOpen,document.body.style.overflow=this.mobileMenuOpen?"hidden":""},closeMobileMenu(){this.mobileMenuOpen=!1,document.body.style.overflow=""}});i.data("siteHeader",()=>({notifications:[],currentNotificationIndex:0,notificationTimer:null,notificationPaused:!1,megaMenuOpen:null,mobileExpanded:{},init(){const e=this.$el.dataset.notifications;if(e)try{this.notifications=JSON.parse(e),this.notifications.length>1&&this.startNotificationRotation()}catch(t){console.warn("siteHeader: failed to parse notifications",t)}document.addEventListener("keydown",t=>{t.key==="Escape"&&(this.closeMegaMenu(),i.store("siteLayout").closeMobileMenu())}),document.addEventListener("click",t=>{if(this.megaMenuOpen===null||this.$el.contains(t.target))return;const s=document.querySelectorAll("[data-mega-panel]");for(const n of s)if(n.contains(t.target))return;this.closeMegaMenu()},!0)},startNotificationRotation(){this.notificationTimer=setInterval(()=>{this.notificationPaused||(this.currentNotificationIndex=(this.currentNotificationIndex+1)%this.notifications.length)},4e3)},pauseNotificationRotation(){this.notificationPaused=!0},resumeNotificationRotation(){this.notificationPaused=!1},getCurrentNotification(){return this.notifications[this.currentNotificationIndex]??null},truncateText(e,t=30){if(!e)return"";const s=e.split(" ");return s.length<=t?e:s.slice(0,t).join(" ")+"…"},toggleMegaMenu(e){this.megaMenuOpen=this.megaMenuOpen===e?null:e},closeMegaMenu(){this.megaMenuOpen=null},getNavbarBottom(){const e=document.querySelector("[data-navbar]");return e?Math.round(e.getBoundingClientRect().bottom):56},toggleMobileSection(e){this.mobileExpanded[e]=!this.mobileExpanded[e]},isMobileSectionExpanded(e){return this.mobileExpanded[e]??!1}}));i.data("newsletterForm",()=>({email:"",loading:!1,success:!1,error:"",async submit(){var e;if(!this.isValidEmail(this.email)){this.error="Please enter a valid email address.";return}this.loading=!0,this.error="",this.success=!1;try{const t=await fetch("/subscribe",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":((e=document.querySelector('meta[name="csrf-token"]'))==null?void 0:e.content)??""},body:JSON.stringify({email:this.email})});if(!t.ok){const s=await t.json().catch(()=>({}));throw new Error(s.message||"Subscription failed. Please try again.")}this.success=!0,this.email="",setTimeout(()=>{this.success=!1},6e3)}catch(t){this.error=t.message||"Failed to subscribe. Please try again."}finally{this.loading=!1}},isValidEmail(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}}));i.data("chatWidget",()=>({open:!1,visitorName:"",visitorEmail:"",initialMessage:"",toggle(){this.open=!this.open},close(){this.open=!1},startChat(){if(!this.initialMessage.trim()){alert("Please enter a message to start the chat.");return}const e=new URLSearchParams;this.visitorName&&e.append("name",this.visitorName),this.visitorEmail&&e.append("email",this.visitorEmail),e.append("message",this.initialMessage),window.location.href=`/chat/start?${e.toString()}`}}));i.data("scrollToTop",()=>({visible:!1,init(){window.addEventListener("scroll",()=>{this.visible=window.scrollY>300},{passive:!0})},scrollToTop(){window.scrollTo({top:0,behavior:"smooth"})}}));document.addEventListener("DOMContentLoaded",()=>{if(!("IntersectionObserver"in window))return;const e=new IntersectionObserver(t=>{t.forEach(s=>{if(s.isIntersecting){const n=s.target;n.dataset.src&&(n.src=n.dataset.src,n.removeAttribute("data-src")),e.unobserve(n)}})});document.querySelectorAll('img[loading="lazy"]').forEach(t=>e.observe(t))});window.Alpine=i;i.start();
