document.addEventListener("alpine:init",()=>{Alpine.data("dataBukuMimpi",()=>({isLoad:!0,type:"2D",search:"",data:[],init(){this.getData()},changeType(t){this.type!=t&&(this.type=t,this.search="",this.isLoad=!0,this.getData())},getData(t=null){this.isLoad=!0,t=t==null?"/proxy.php?tab=bukuMimpi":t;let i={type:this.type,q:this.search},s=Object.keys(i).reduce((e,a)=>(e.push(a+"="+i[a]),e),[]).join("&");t=t+(t.includes("?")?"&":"?")+s,axios.get(t).then(e=>{e.data.links=e.data.links.filter((a,h)=>h!=0&&h!=e.data.links.length-1),this.data=e.data,setTimeout(()=>{this.isLoad=!1,scrollInMenuHome(),setTimeout(()=>this.highLight())},500)}).catch(e=>{setTimeout(()=>{this.isLoad=!1,Toast(e.message)},500)})},changePage(t){t!=null&&this.getData(t)},highLight(){const t=this.search,i=t.charAt(0).toUpperCase()+t.slice(1),s=t.toUpperCase();let e=document.querySelectorAll(".hlsText");[...e].forEach(a=>highLightSearch(t,a)),[...e].forEach(a=>highLightSearch(i,a)),[...e].forEach(a=>highLightSearch(s,a))}}))});