1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2959],{45212:(e,a,r)=>{"use strict";r.r(a),r.d(a,{default:()=>U,dynamic:()=>O});var t=r(95155),s=r(12115),l=r(65142),n=r(65541),i=r(52619),o=r.n(i),c=r(26549),d=r(31719),g=r(83693),h=r.n(g),u=r(20063),m=r(85400),x=r(64868);let p=new Map;var b=r(48754),f=r(19402),v=r(24033),y=r(90368),w=r(27937),j=r(91897),N=r(96093),k=r(26333),S=r(5917),_=r(13125),C=r(77258),A=r(21887),L=r(92297),P=r(95058),R=r(29978);let{useSession:M}=(0,r(11131).M)(),E=e=>{let{result:a}=e,[r,l]=(0,s.useState)(!1),[n,i]=(0,s.useState)(!1),[c,d]=(0,s.useState)(null),g=(0,s.useRef)(null),{data:h}=M(),{onOpen:u}=(0,R.X)(),{addItem:m,removeItem:x,isInList:p}=(0,P.C)("watchlist",!1),[v,y]=(0,s.useState)(!1),w=a.media_type||(a.title?"movie":"tv"),[j,k]=(0,s.useState)(null),[S,_]=(0,s.useState)(!1);(0,s.useEffect)(()=>{h&&y(p(a.id.toString(),w))},[a.id,w,p,h]);let A=e=>{if(e.preventDefault(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),!h)return void u();let r={mediaId:a.id.toString(),mediaType:w,title:a.title||a.name||"",backdrop_path:a.backdrop_path||a.poster_path||"",addedAt:new Date().toISOString(),_id:a.id.toString(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v?(x(a.id.toString(),w),y(!1)):(m(r),y(!0))},E=(0,s.useCallback)(async()=>{if(!S&&!j)try{_(!0);let e=await fetch("https://api.themoviedb.org/3/".concat(w,"/").concat(a.id,"?language=en-US&api_key=").concat("ef311eb0b9b07b9c73e9fb0a732cc150")),r=await e.json();k({overview:(null==r?void 0:r.overview)||"",backdrop_path:(null==r?void 0:r.backdrop_path)||(null==r?void 0:r.poster_path)||a.poster_path,original_language:(null==r?void 0:r.original_language)||"en",release_date:null==r?void 0:r.release_date,first_air_date:null==r?void 0:r.first_air_date})}catch(e){}finally{_(!1)}},[w,a.id,a.poster_path,S,j]);return(0,t.jsxs)("div",{ref:g,className:"relative overflow-hidden rounded-md hover:text-white aspect-[2/3]",onMouseEnter:()=>{i(!0),g.current&&d(g.current.getBoundingClientRect()),("movie"===w||"tv"===w)&&E()},onMouseLeave:()=>i(!1),children:[(0,t.jsx)(o(),{href:"/".concat(w,"/").concat(a.id),prefetch:!1,children:(0,t.jsxs)("div",{className:"relative rounded-sm w-full h-full",children:[!r&&(0,t.jsx)("div",{className:"absolute inset-0 bg-gray-200 animate-pulse"}),(0,t.jsx)("img",{className:"transition-opacity duration-300 ".concat(r?"opacity-100":"opacity-0"),src:(0,N.W9)(a.poster_path,"w500"),alt:a.title||a.name,width:300,height:450,style:{objectFit:"cover"},onLoad:()=>l(!0)}),(0,t.jsx)("button",{onClick:A,onMouseDown:A,className:(0,C.cn)("absolute top-0 left-0 z-10 flex items-center justify-center w-8 h-8 rounded-tl-sm rounded-br-lg transition-all duration-200","backdrop-blur-sm border border-white/20 border-t-0 border-l-0","hover:scale-110 active:scale-95",v?"bg-blue-500/80 text-white shadow-lg shadow-blue-500/25":"bg-black/50 text-white/70 hover:bg-blue-500/50 hover:text-white"),"aria-label":v?"Remove from watchlist":"Add to watchlist",children:v?(0,t.jsx)(b.A,{className:"h-5 w-5"}):(0,t.jsx)(f.A,{className:"h-5 w-5"})}),(0,t.jsxs)("div",{className:"absolute right-0 top-2 flex gap-1 rounded-l bg-black bg-opacity-50 pl-1 text-xs font-semibold text-white",children:[(0,t.jsx)("svg",{className:"h-4 w-4 fill-yellow-500",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z"})}),a.vote_average.toFixed(1)]})]})}),n&&c&&("movie"===w||"tv"===w)&&(0,t.jsx)(L.A,{data:{id:a.id,title:a.title,name:a.name,overview:(null==j?void 0:j.overview)||"",backdrop_path:(null==j?void 0:j.backdrop_path)||a.poster_path,vote_average:a.vote_average,original_language:(null==j?void 0:j.original_language)||"en",release_date:(null==j?void 0:j.release_date)||a.release_date,first_air_date:(null==j?void 0:j.first_air_date)||a.first_air_date},mediaType:w,anchorRect:c,onRequestClose:()=>i(!1)})]})},T=e=>{var a,r,l;let{currentType:i,currentGenre:o,currentSort:g,currentYear:h,currentCountry:m,currentRating:x,currentWatchProvider:p,genres:b,watchProviders:f,handleReset:y,updateSearchParams:w}=e,N=(0,u.useRouter)(),L=(0,u.useSearchParams)(),P=(0,u.usePathname)(),{start:R}=(0,A.useTopLoader)(),M=e=>{let a=new URLSearchParams(Array.from(L.entries()));
1a.set("page","1"),Object.entries(e).forEach(e=>{let[r,t]=e;"all"===t?a.delete(r):a.set(r,t)}),N.push("".concat(P,"?").concat(a.toString()))},[E,T]=(0,s.useState)(""),[q,O]=(0,s.useState)(""),[U,V]=(0,s.useState)(""),[F,I]=(0,s.useState)(""),[$,D]=(0,s.useState)(!1),[G,B]=(0,s.useState)(!1),[W,z]=(0,s.useState)(!1),[Z,Y]=(0,s.useState)(!1);return(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4 xl:flex xl:items-center xl:gap-0 xl:space-x-2",children:[(0,t.jsxs)(n.l6,{value:i,onValueChange:e=>{if("manga"===e){R(),N.push("/manga");return}if("asian-drama"===e){R(),N.push("/asian-drama");return}if("anime"===e){R(),N.push("/search/anime");return}M({type:e})},children:[(0,t.jsx)(n.bq,{className:"w-full xl:w-[180px] bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:(0,t.jsx)(n.yv,{placeholder:"Type"})}),(0,t.jsxs)(n.gC,{className:"bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:[(0,t.jsx)(n.eb,{value:"all",children:"Type"}),(0,t.jsx)(n.eb,{value:"movie",children:"Movies"}),(0,t.jsx)(n.eb,{value:"tv",children:"TV Shows"}),(0,t.jsx)(n.eb,{value:"anime",children:"Anime"}),(0,t.jsx)(n.eb,{value:"asian-drama",children:"Drama"}),(0,t.jsx)(n.eb,{value:"manga",children:"Manga"})]})]}),(0,t.jsxs)(k.AM,{open:$,onOpenChange:D,children:[(0,t.jsx)(k.Wv,{asChild:!0,children:(0,t.jsxs)(_.$,{variant:"outline",role:"combobox",className:"w-full xl:w-[180px] justify-between bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:[(null==(a=b.find(e=>e.id.toString()===o))?void 0:a.name)||"Genre",(0,t.jsx)(v.A,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(k.hl,{className:"w-[200px] p-0 bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:(0,t.jsxs)(j.uB,{className:"bg-[#f3f4f6] dark:bg-[#2a2a30]",children:[(0,t.jsx)(j.G7,{placeholder:"Search genre...",className:"h-9 bg-[#f3f4f6] dark:bg-[#2a2a30]",value:E,onValueChange:T}),(0,t.jsxs)(j.L$,{className:"max-h-[200px] overflow-auto",children:[(0,t.jsxs)(j.h_,{value:"all",onSelect:()=>{M({genre:"all"}),D(!1)},className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-[#3f3f46]",children:[(0,t.jsx)(S.A,{className:(0,C.cn)("mr-2 h-4 w-4",o&&"all"!==o?"opacity-0":"opacity-100")}),"All Genres"]}),b.filter(e=>e.name.toLowerCase().includes(E.toLowerCase())).map(e=>(0,t.jsxs)(j.h_,{value:e.name,onSelect:()=>{M({genre:e.id.toString()}),D(!1)},className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-[#3f3f46]",children:[(0,t.jsx)(S.A,{className:(0,C.cn)("mr-2 h-4 w-4",o===e.id.toString()?"opacity-100":"opacity-0")}),e.name]},e.id))]})]})})]}),(0,t.jsxs)(n.l6,{value:g,onValueChange:e=>M({sort:e}),children:[(0,t.jsx)(n.bq,{className:"w-full xl:w-[180px] bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:(0,t.jsx)(n.yv,{placeholder:"Sort by"})}),(0,t.jsxs)(n.gC,{className:"bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:[(0,t.jsx)(n.eb,{value:"popularity",children:"Popular"}),(0,t.jsx)(n.eb,{value:"rating",children:"Top Rated"}),(0,t.jsx)(n.eb,{value:"a-z",children:"Title A-Z"}),(0,t.jsx)(n.eb,{value:"z-a",children:"Title Z-A"}),(0,t.jsx)(n.eb,{value:"latest",children:"Latest Release"}),(0,t.jsx)(n.eb,{value:"oldest",children:"Oldest Release"}),(0,t.jsx)(n.eb,{value:"revenue",children:"Revenue"}),(0,t.jsx)(n.eb,{value:"vote_count",children:"Most Voted"})]})]}),(0,t.jsxs)(k.AM,{open:G,onOpenChange:B,children:[(0,t.jsx)(k.Wv,{asChild:!0,children:(0,t.jsxs)(_.$,{variant:"outline",role:"combobox",className:"w-full xl:w-[180px] justify-between bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:["all"===h?"Year":h,(0,t.jsx)(v.A,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(k.hl,{className:"w-[200px] p-0 bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:(0,t.jsxs)(j.uB,{className:"bg-[#f3f4f6] dark:bg-[#2a2a30]",children:[(0,t.jsx)(j.G7,{placeholder:"Search year...",className:"h-9 bg-[#f3f4f6] dark:bg-[#2a2a30]",value:q,onValueChange:O}),(0,t.jsxs)(j.L$,{className:"max-h-[200px] overflow-auto",children:[(0,t.jsxs)(j.h_,{value:"all",onSelect:()=>{M({year:"all"}),B(!1)},className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-[#3f3f46]",children:[(0,t.jsx)(S.A,{className:(0,C.cn)("mr-2 h-4 w-4","all"===h?"opacity-100":"opacity-0")}),"Year"]}),(()=>{let e=new Date().getFullYear(),a=[];for(let r=e;r>=1950;r--)a.push(r);return a})().filter(e=>e.toString().includes(q)).map(e=>(0,t.jsxs)(j.h_,{value:e.toString(),onSelect:()=>{M({year:e.toString()}),B(!1)},className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-[#3f3f46]",children:[(0,t.jsx)(S.A,{className:(0,C.cn)("mr-2 h-4 w-4",h===e.toString()?"opacity-100":"opacity-0")}),e]},e))]})]})})]}),(0,t.jsxs)(k.AM,{open:W,onOpenChange:z,children:[(0,t.jsx)(k.Wv,{asChild:!0,children:(0,t.jsxs)(_.$,{variant:"outline",role:"combobox",className:"w-full xl:w-[180px] justify-between bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:[(0,t.jsx)("span",{className:"block max-w-[120px] truncate text-left",children:(null==(r=f.find(e=>e.provider_id.toString()===p))?void 0:r.provider_name)||"Networks"}),(0,t.jsx)(v.A,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(k.hl,{className:"w-[200px] p-0 bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:(0,t.jsxs)(j.uB,{className:"bg-[#f3f4f6] dark:bg-[#2a2a30]",children:[(0,t.jsx)(j.G7,{placeholder:"Search network...",className:"h-9 bg-[#f3f4f6] dark:bg-[#2a2a30]",value:U,onValueChange:V}),(0,t.jsxs)(j.L$,{className:"max-h-[200px] overflow-auto",children:[(0,t.jsxs)(j.h_,{value:"all",onSelect:()=>{M({watch_provider:"all"}),z(!1)},className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-[#3f3f46]",children:[(0,t.jsx)(S.A,{className:(0,C.cn)("mr-2 h-4 w-4",p&&"all"!==p?"opacity-0":"opacity-100")}),"All Networks"]}),f.filter(e=>e.provider_name.toLowerCase().includes(U.toLowerCase())).map(e=>(0,t.jsxs)(j.h_,{value:e.provider_name,onSelect:()=>{M({watch_provider:e.provider_id.toString()}),z(!1)},className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-[#3f3f46]",children:[(0,t.jsx)(S.A,{className:(0,C.cn)("mr-2 h-4 w-4",p===e.provider_id.toString()?"opacity-100":"opacity-0")}),e.provider_name]},e.provider_id))]})]})})]}),(0,t.jsxs)(k.AM,{open:Z,onOpenChange:Y,children:[(0,t.jsx)(k.Wv,{asChild:!0,children:(0,t.jsxs)(_.$,{variant:"outline",role:"combobox",className:"w-full xl:w-[180px] justify-between bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:["all"===m?"Country":(null==(l=c.$T.find(e=>e.value===m))?void 0:l.label)||"Country",(0,t.jsx)(v.A,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(k.hl,{className:"w-[200px] p-0 bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:(0,t.jsxs)(j.uB,{className:"bg-[#f3f4f6] dark:bg-[#2a2a30]",children:[(0,t.jsx)(j.G7,{placeholder:"Search country...",className:"h-9 bg-[#f3f4f6] dark:bg-[#2a2a30]",value:F,onValueChange:I}),(0,t.jsxs)(j.L$,{className:"max-h-[200px] overflow-auto",children:[(0,t.jsxs)(j.h_,{value:"all",onSelect:()=>{M({country:"all"}),Y(!1)},className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-[#3f3f46]",children:[(0,t.jsx)(S.A,{className:(0,C.cn)("mr-2 h-4 w-4","all"===m?"opacity-100":"opacity-0")}),"Country"]}),c.$T.filter(e=>e.label.toLowerCase().includes(F.toLowerCase())).map(e=>(0,t.jsxs)(j.h_,{value:e.label,onSelect:()=>{M({country:e.value}),Y(!1)},className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-[#3f3f46]",children:[(0,t.jsx)(S.A,{className:(0,C.cn)("mr-2 h-4 w-4",m===e.value?"opacity-100":"opacity-0")}),e.label]},e.value))]})]})})]}),(0,t.jsxs)(n.l6,{value:x,onValueChange:e=>M({rating:e}),children:[(0,t.jsx)(n.bq,{className:"w-full xl:w-[180px] bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:(0,t.jsx)(n.yv,{placeholder:"Rating"})}),(0,t.jsxs)(n.gC,{className:"bg-[#f3f4f6] dark:bg-[#2a2a30] border-0",children:[(0,t.jsx)(n.eb,{value:"all",children:"Ratings"}),(0,t.jsx)(n.eb,{value:"9",children:"9+ â"}),(0,t.jsx)(n.eb,{value:"8",children:"8+ â"}),(0,t.jsx)(n.eb,{value:"7",children:"7+ â"}),(0,t.jsx)(n.eb,{value:"6",children:"6+ â"}),(0,t.jsx)(n.eb,{value:"5",children:"5+ â"}),(0,t.jsx)(n.eb,{value:"4",children:"4+ â"})]})]}),(0,t.jsxs)("button",{onClick:y,className:"flex items-center justify-center gap-x-2 rounded-md bg-red-500 px-3 py-2 text-sm font-medium text-destructive-foreground hover:bg-destructive/90",children:[(0,t.jsx)(d.NAP,{}),"Reset"]})]})},q=()=>{let e=(0,u.useSearchParams)(),a=(0,u.useRouter)(),r=(0,u.usePathname)(),n=e.get("q")||"",i=e.toString(),[o,c]=(0,s.use
1State)(n),[d,g]=(0,s.useState)(!1),{resultsMap:b,loading:f,error:v,currentType:j,currentGenre:N,currentSort:k,currentYear:S,currentCountry:_,currentRating:A,currentWatchProvider:L,currentCastName:P,isNowPlaying:R,isTrending:M,genres:q,watchProviders:O,handleReset:U,updateSearchParams:V,currentPage:F,totalPages:I,handlePageChange:$,generatePaginationRange:D}=function(){let e=(0,u.useSearchParams)(),a=(0,u.useRouter)(),r=(0,u.usePathname)(),t=e.get("q")||"",l=parseInt(e.get("page")||"1",10),[n,i]=(0,s.useState)(new Map),[o,c]=(0,s.useState)(t),[d,g]=(0,s.useState)(t),[b,f]=(0,s.useState)(l-1),[v,y]=(0,s.useState)(null),[w,j]=(0,s.useState)([]),[N,k]=(0,s.useState)([]),[S,_]=(0,s.useState)(1),C=e.get("type")||"all",A=e.get("genre")||"all",L=e.get("sort")||"popularity",P=e.get("year")||"all",R=e.get("watch_provider")||"all",M=e.get("country")||"all",E=e.get("rating")||"all",T=e.get("cast")||"",q="true"===e.get("now_playing"),O="true"===e.get("trending"),U=async()=>{try{let e=await fetch("/api/search/meta?country=".concat(M)),a=await e.json(),r=(null==a?void 0:a.movieGenres)||[],t=(null==a?void 0:a.tvGenres)||[];if("all"===C){let e=[...r,...t];j(Array.from(new Map(e.map(e=>[e.id,e])).values()))}else"movie"===C?j(r):"tv"===C?j(t):j([])}catch(e){console.error("Error fetching genres:",e),j([])}},V=async()=>{try{let e=await fetch("/api/search/meta?country=".concat(M)),a=await e.json(),r=(null==a?void 0:a.watchProviders)||[];k(r),"all"===R||r.some(e=>e.provider_id.toString()===R)||W({watch_provider:"all"})}catch(e){console.error("Error fetching watch providers:",e),k([])}},F=(e=>{let{type:a,query:r,page:t,sort:s,genre:l,year:n,watchProvider:i,country:o,rating:c,castName:d,nowPlaying:g,trending:h}=e;if(d){let e=new URLSearchParams({name:d,page:t.toString(),type:a||"all",genre:l||"all",year:n||"all",sort:s||"popularity",rating:c||"all",watch_provider:i||"all",country:o||"all"});return"/api/cast?".concat(e.toString())}let u=new URLSearchParams({type:a,page:t.toString(),sort:s||"popularity",genre:l||"all",year:n||"all",watch_provider:i||"all",country:o||"all",rating:c||"all",now_playing:g?"true":"false",trending:h?"true":"false"});return r&&u.set("q",r),"/api/search/discover?".concat(u.toString())})({type:C,query:o,page:b+1,sort:L,genre:A,year:P,watchProvider:R,country:M,rating:E,castName:T,nowPlaying:q,trending:O}),I=(0,s.cache)(async e=>{if(Array.isArray(e)){let a=await Promise.all(e.map(async e=>{if(p.has(e))return p.get(e);try{let a=await fetch(e);if(!a.ok){if(422===a.status||404===a.status)return{results:[],total_pages:1};throw Error("An error occurred while fetching the data.")}let r=await a.json();return p.set(e,r),r}catch(e){return{results:[],total_pages:1}}}));return{results:[...a[0].results.map(e=>({...e,media_type:"movie"})),...a[1].results.map(e=>({...e,media_type:"tv"}))],total_pages:Math.max(a[0].total_pages,a[1].total_pages)}}if(p.has(e))return p.get(e);if("string"==typeof e&&e.startsWith("/api/cast"))try{let a=await fetch(e);if(!a.ok)throw Error("An error occurred while fetching the data.");let r=await a.json();return p.set(e,r),r}catch(e){return{results:[],total_pages:1}}try{let a=await fetch(e);if(!a.ok){if(422===a.status||404===a.status)return{results:[],total_pages:1};throw Error("An error occurred while fetching the data.")}let r=await a.json();return p.set(e,r),r}catch(e){return{results:[],total_pages:1}}}),{data:$,error:D,isLoading:G}=(0,m.Ay)(F,I,{revalidateOnFocus:!1,revalidateOnReconnect:!1,dedupingInterval:1e4,keepPreviousData:!0,fallbackData:p.get(Array.isArray(F)?F[0]:F)});(0,s.useEffect)(()=>{(null==$?void 0:$.results)&&(_(Math.min($.total_pages,500)),i(new Map($.results.filter(e=>e.poster_path).map(e=>{let a=e.id;return[a,{...e,id:a,media_type:e.media_type||C}]}))))},[$,C,T]),(0,s.useEffect)(()=>{y(D?D.message:null)},[D]);let B=(0,s.useCallback)(async t=>{let s=Math.min(S,500);if(t>=0&&t<s){let s=new URLSearchParams(Array.from(e.entries()));s.set("page",(t+1).toString()),a.push("".concat(r,"?").concat(s.toString())),f(t)}else if(t>=s){let t=new URLSearchParams(Array.from(e.entries()));t.set("page",s.toString()),a.push("".concat(r,"?").concat(t.toString())),f(s-1)}},[r,a,e,S]),W=t=>{let s=new URLSearchParams(Array.from(e.entries()));
1Object.entries(t).forEach(e=>{let[a,r]=e;""===r?s.delete(a):s.set(a,r)}),a.push("".concat(r,"?").concat(s.toString()))},z=(0,s.useCallback)(h()(t=>{let s=new URLSearchParams(e);s.set("q",t),a.push("".concat(r,"?").concat(s.toString()))},300),[e,r,a]),Z=(0,s.useCallback)(t=>{if(g(t),f(0),t!==o){let s=new URLSearchParams(e);s.set("q",t),s.set("page","1"),a.push("".concat(r,"?").concat(s.toString()),{scroll:!1})}},[r,a,e,o]),Y=(0,s.useCallback)(()=>{if(g(""),c(""),f(0),i(new Map),T){let t=new URLSearchParams(e);t.delete("cast"),a.push("".concat(r,"?").concat(t.toString()))}else a.push(r);(0,x.j)(F)},[r,a,F,T,e]);return(0,s.useEffect)(()=>{let a=e.get("q")||"";c(a),g(a)},[e]),(0,s.useEffect)(()=>{U(),V()},[C,M]),(0,s.useEffect)(()=>()=>{z.cancel()},[z]),(0,s.useEffect)(()=>()=>{p.clear()},[]),{resultsMap:n,loading:G,error:(null==D?void 0:D.message)||v,searchQuery:o,inputValue:d,genres:w,watchProviders:N,currentType:C,currentGenre:A,currentSort:L,currentYear:P,currentCountry:M,currentRating:E,currentWatchProvider:R,currentCastName:T,isNowPlaying:q,isTrending:O,totalPages:S,currentPage:b,setInputValue:g,handleSearch:Z,handleReset:Y,updateSearchParams:W,handlePageChange:B,generatePaginationRange:(e,a)=>{let r=Math.min(a,500);return r<=5?Array.from({length:r},(e,a)=>a):e<3?[0,1,2,"ellipsis",r-1]:e>r-4?[0,"ellipsis",r-3,r-2,r-1]:[0,"ellipsis",e-1,e,e+1,"ellipsis",r-1]},setResultsMap:i}}(),G=(0,s.useCallback)(e=>{var t;let s=new URLSearchParams(i);e!==(null!=(t=s.get("q"))?t:"")&&(e?s.set("q",e):s.delete("q"),s.set("page","1"),a.push("".concat(r,"?").concat(s.toString()),{scroll:!1}))},[r,a,i]);return((0,s.useEffect)(()=>{let e=setTimeout(()=>{G(o)},300);return()=>clearTimeout(e)},[G,o]),(0,s.useEffect)(()=>{d||n!==o&&c(n)},[n,d,o]),v)?(0,t.jsx)("div",{className:"flex min-h-[80vh] items-center justify-center",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("p",{className:"text-red-500 mb-4",children:v}),(0,t.jsx)("button",{onClick:()=>window.location.reload(),className:"rounded-md bg-red-500 px-4 py-2 text-white hover:bg-red-600",children:"Retry"})]})}):(0,t.jsxs)("div",{className:"mx-auto w-full max-w-[1440px] pt-20 space-y-4 px-4 md:px-6 lg:px-8 py-6 min-h-[80vh]",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)(l.p,{placeholder:"Search...",className:"w-full rounded-lg py-4 capitalize text-black dark:text-white outline-none ring-0 focus:outline-none focus-visible:outline-none focus:ring-0 focus-visible:ring-0 caret-white",value:o,onChange:e=>{c(e.target.value)},onFocus:()=>g(!0),onBlur:()=>g(!1),autoComplete:"off",autoCorrect:"off",spellCheck:!1}),(0,t.jsx)("div",{className:"flex flex-col gap-4",children:(0,t.jsx)(T,{currentType:j,currentGenre:N,currentSort:k,currentYear:S,currentCountry:_,currentRating:A,currentWatchProvider:L,genres:q,watchProviders:O,updateSearchParams:V,handleReset:U})})]}),P&&(0,t.jsx)("div",{className:"mb-4 sm:mb-6 p-3 sm:p-4 bg-gray-900/50 dark:bg-gray-900/50 bg-gray-900/95 rounded-lg border border-gray-700 dark:border-gray-700 border-gray-600",children:(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sm:gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("h2",{className:"text-base sm:text-lg md:text-xl font-bold text-white dark:text-white leading-tight",children:["Movies & TV Shows featuring ",(0,t.jsx)("span",{className:"text-blue-400 dark:text-blue-400 break-words",children:P})]}),(0,t.jsxs)("p",{className:"text-gray-400 dark:text-gray-400 text-xs sm:text-sm mt-1 leading-relaxed",children:["Showing all movies and TV shows starring ",P]})]}),(0,t.jsx)("button",{onClick:()=>{let t=new URLSearchParams(e);t.delete("cast"),a.push("".concat(r,"?").concat(t.toString()))},className:"px-3 py-2 sm:px-4 sm:py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors text-xs sm:text-sm font-medium whitespace-nowrap flex-shrink-0",children:"Clear Cast Filter"})]})}),R&&(0,t.jsx)("div",{className:"mb-4 sm:mb-6 p-3 sm:p-4 bg-gray-900/50 dark:bg-gray-900/50 bg-gray-900/95 rounded-lg border border-gray-700 dark:border-gray-700 border-gray-600",children:(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sm:gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("h2",{className:"text-base sm:text-lg md:text-xl font-bold text-white dark:text-white leading-tight",children:[(0,t.jsx)("span",{className:"bg-gradient-to-r from-red-400 to-orange-500 bg-clip-text text-transparent",children:"Now Playing"})," Movies"]}),(0,t.jsx)("p",{className:"text-gray-300 dark:text-gray-300 text-xs sm:text-sm mt-1 leading-relaxed",children:"Showing movies currently in theaters from the last 30 days, sorted by popularity"})]}),(0,t.jsx)("button",{onClick:()=>{let t=new URLSearchParams(e);t.delete("now_playing"),a.push("".concat(r,"?").concat(t.toString()))},className:"px-3 py-2 sm:px-4 sm:py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors text-xs sm:text-sm font-medium whitespace-nowrap flex-shrink-0",children:"Clear Now Playing Filter"})]})}),M&&(0,t.jsx)("div",{className:"mb-4 sm:mb-6 p-3 sm:p-4 bg-gray-900/50 dark:bg-gray-900/50 bg-gray-900/95 rounded-lg border border-gray-700 dark:border-gray-700 border-gray-600",children:(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sm:gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("h2",{className:"text-base sm:text-lg md:text-xl font-bold text-white dark:text-white leading-tight",children:[(0,t.jsx)("span",{className:"bg-gradient-to-r from-blue-400 to-purple-500 bg-clip-text text-transparent",children:"Trending"})," ","movie"===j?"Movies":"TV Shows"]}),(0,t.jsxs)("p",{className:"text-gray-300 dark:text-gray-300 text-xs sm:text-sm mt-1 leading-relaxed",children:["Showing trending ","movie"===j?"movies":"TV shows"," for today"]})]}),(0,t.jsx)("button",{onClick:()=>{let t=new URLSearchParams(e);t.delete("trending"),a.push("".concat(r,"?").concat(t.toString()))},className:"px-3 py-2 sm:px-4 sm:py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors text-xs sm:text-sm font-medium whitespace-nowrap flex-shrink-0",children:"Clear Trending Filter"})]})}),f?(0,t.jsx)("div",{className:"flex min-h-[50vh] items-center justify-center",children:(0,t.jsx)("div",{className:"animate-spin rounded-full h-32 w-32 border-t-2 border-b-2 border-red-500"})}):0===b.size?(0,t.jsx)("div",{className:"flex min-h-[50vh] items-center justify-center",children:(0,t.jsx)("p",{className:"text-gray-500",children:"No results found"})}):(0,t.jsx)("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7",children:Array.from(b.values()).map(e=>(0,t.jsx)(E,{result:e},e.id))}),I>1&&(0,t.jsx)("nav",{className:"mt-12 mx-auto w-full","aria-label":"Pagination",children:(0,t.jsxs)("div",{className:"mx-auto max-w-[1440px] px-4 md:px-6 lg:px-8",children:[(0,t.jsx)("div",{className:"flex items-center justify-center px-2",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-1 sm:gap-2 rounded-lg bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 p-1 sm:p-2 shadow-lg max-w-full overflow-hidden",children:[(0,t.jsxs)("button",{onClick:()=>$(0),disabled:0===F||f,className:"flex h-7 w-7 sm:h-10 sm:w-10 items-center justify-center rounded-md bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-red-500 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-gray-100 dark:disabled:hover:bg-gray-700","aria-label":"First page",children:[(0,t.jsx)(y.A,{className:"h-2.5 w-2.5 sm:h-4 sm:w-4"}),(0,t.jsx)(y.A,{className:"h-2.5 w-2.5 sm:h-4 sm:w-4 -ml-0.5 sm:-ml-2"})]}),(0,t.jsx)("button",{onClick:()=>$(F-1),disabled:0===F||f,className:"flex h-7 w-7 sm:h-10 sm:w-10 items-center justify-center rounded-md bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-red-500 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-gray-100 dark:disabled:hover:bg-gray-700","aria-label":"Previous page",children:(0,t.jsx)(y.A,{className:"h-2.5 w-2.5 sm:h-4 sm:w-4"})}),(0,t.jsx)("div",{className:"flex items-center gap-1 overflow-visible",children:D(F,I).map((e,a)=>{if("ellipsis"===e)return(0,t.jsx)("span",{className:"px-1 sm:px-2 py-1 text-xs sm:text-sm text-gray-500 dark:text-gray-400",children:"â¯"},"ellipsis-".concat(a));let r=F===e;return(0,t.jsx)("button",{onClick:()=>$(e),disabled:f,"aria-current":r?"page":void 0,className:(0,C.cn)("flex h-7 sm:h-10 min-w-7 sm:min-w-10 items-center justify-center rounded-md font-medium transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-red-500 disabled:cursor-not-allowed px-1 sm:px-2 text-xs sm:text-sm",r?"bg-red-600 text-white shadow-md hover:bg-red-700":"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white"),children:(e+1).toLocaleStr
1ing()},e)})}),(0,t.jsx)("button",{onClick:()=>$(F+1),disabled:F>=I-1||f,className:"flex h-7 w-7 sm:h-10 sm:w-10 items-center justify-center rounded-md bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-red-500 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-gray-100 dark:disabled:hover:bg-gray-700","aria-label":"Next page",children:(0,t.jsx)(w.A,{className:"h-2.5 w-2.5 sm:h-4 sm:w-4"})}),(0,t.jsxs)("button",{onClick:()=>$(I-1),disabled:F>=I-1||f,className:"flex h-7 w-7 sm:h-10 sm:w-10 items-center justify-center rounded-md bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-red-500 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-gray-100 dark:disabled:hover:bg-gray-700","aria-label":"Last page",children:[(0,t.jsx)(w.A,{className:"h-2.5 w-2.5 sm:h-4 sm:w-4"}),(0,t.jsx)(w.A,{className:"h-2.5 w-2.5 sm:h-4 sm:w-4 -ml-0.5 sm:-ml-2"})]})]})}),(0,t.jsx)("div",{className:"mt-4 text-center",children:(0,t.jsxs)("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Page ",F+1," of ",I.toLocaleString()]})})]})})]})},O="force-dynamic",U=(0,s.memo)(function(){return(0,t.jsx)(s.Suspense,{fallback:(0,t.jsx)("div",{className:"flex min-h-screen min-w-full items-center justify-center",children:(0,t.jsxs)("div",{role:"status",children:[(0,t.jsxs)("svg",{"aria-hidden":"true",className:"size-7 animate-spin fill-red-600 text-gray-200 dark:text-gray-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),(0,t.jsx)("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),(0,t.jsx)("span",{className:"sr-only",children:"Loading..."})]})}),children:(0,t.jsx)(q,{})})})},48645:(e,a,r)=>{Promise.resolve().then(r.bind(r,45212))}},e=>{e.O(0,[7405,2076,8096,7358],()=>e(e.s=48645)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.