(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[607],{7282:function(e,a,t){Promise.resolve().then(t.bind(t,5188))},5188:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return u}});var s=t(7437),l=t(2265),r=t(8463),i=t(9102),c=t(6722),n=t(3464),o=t(6867),d=t(3818);function u(){let[e,a]=(0,l.useState)([]),[t,u]=(0,l.useState)(!0),[m,x]=(0,l.useState)(!1),[p,h]=(0,l.useState)(1),[b,f]=(0,l.useState)(!0),[g,y]=(0,l.useState)(""),[j,N]=(0,l.useState)([]),[w,k]=(0,l.useState)(!1);(0,l.useEffect)(()=>{v(1)},[]);let v=async e=>{try{1===e?u(!0):x(!0);let t=await n.Z.get("/api/drama/list?page=".concat(e,"&limit=72"));1===e?a(t.data.sources):a(e=>[...e,...t.data.sources]),f(t.data.hasMore),h(e)}catch(e){console.error("Failed to fetch sources",e)}finally{u(!1),x(!1)}},S=async e=>{if(e.preventDefault(),g.trim()){k(!0);try{let e=await n.Z.get("/api/drama/search?q=".concat(encodeURIComponent(g)));N(e.data.results||[])}catch(e){console.error("Search failed",e)}finally{k(!1)}}},E=g?j:e;return(0,s.jsxs)("main",{className:"min-h-screen bg-black text-white pb-24 font-sans",children:[(0,s.jsx)(i.a$,{}),(0,s.jsxs)("header",{className:"sticky top-0 z-50 bg-black/80 backdrop-blur-xl border-b border-white/5 px-4 py-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,s.jsx)(o.Z,{className:"text-yellow-500",size:24}),(0,s.jsx)("h1",{className:"text-xl font-black tracking-tight",children:"Explore"})]}),(0,s.jsxs)("form",{onSubmit:S,className:"relative",children:[(0,s.jsx)("input",{type:"text",placeholder:"Cari drama, film...",value:g,onChange:e=>{y(e.target.value),""===e.target.value&&N([])},className:"w-full bg-white/10 border border-white/10 rounded-xl py-3 pl-12 pr-4 text-sm text-white focus:outline-none focus:bg-black/60 focus:border-yellow-500/50 transition-all placeholder-gray-400"}),(0,s.jsx)(d.Z,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:18})]})]}),(0,s.jsxs)("div",{className:"p-4 max-w-[1600px] mx-auto",children:[(0,s.jsx)(i.fD,{placement:"EXPLORE_TOP",className:"mt-2"}),(0,s.jsx)(i.dW,{position:"top",className:"mt-2"}),t?(0,s.jsx)("div",{className:"flex justify-center py-20",children:(0,s.jsx)("div",{className:"w-8 h-8 border-4 border-yellow-500 border-t-transparent rounded-full animate-spin"})}):(0,s.jsxs)(s.Fragment,{children:[0===E.length&&g&&!w&&(0,s.jsx)("div",{className:"text-center py-20 text-gray-500",children:"Tidak ada hasil ditemukan."}),(0,s.jsx)("div",{className:"grid grid-cols-3 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-3 md:gap-6",children:E.map((e,a)=>(0,s.jsx)(c.Z,{source:e,idx:a},a))}),!g&&b&&(0,s.jsx)("div",{className:"mt-10 flex justify-center",children:(0,s.jsx)("button",{onClick:()=>{!m&&b&&v(p+1)},disabled:m,className:"px-8 py-3 bg-yellow-500 text-black font-bold rounded-full hover:bg-yellow-400 disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:m?"Memuat...":"Muat Lebih Banyak"})})]})]}),(0,s.jsx)(i.fD,{placement:"EXPLORE_BOTTOM"}),(0,s.jsx)(i.dW,{position:"bottom"}),(0,s.jsx)(r.Z,{})]})}}},function(e){e.O(0,[174,648,900,961,971,117,744],function(){return e(e.s=7282)}),_N_E=e.O()}]);