(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{283:(e,t,a)=>{"use strict";a.d(t,{A:()=>o,AuthProvider:()=>n});var i=a(5155),s=a(2115),r=a(2099);let l=(0,s.createContext)(void 0);function n(e){let{children:t}=e,[a,n]=(0,s.useState)(null),[o,d]=(0,s.useState)(null),[c,m]=(0,s.useState)(!0);(0,s.useEffect)(()=>{r.N.auth.getSession().then(e=>{var t;let{data:{session:a}}=e;d(a),n(null!=(t=null==a?void 0:a.user)?t:null),m(!1)});let{data:{subscription:e}}=r.N.auth.onAuthStateChange(async(e,t)=>{var a;d(t),n(null!=(a=null==t?void 0:t.user)?a:null),m(!1),"SIGNED_IN"===e&&(null==t?void 0:t.user)&&!t.user.email_confirmed_at&&await p(t.user)});return()=>e.unsubscribe()},[]);let p=async e=>{try{var t,a;let{error:i}=await r.N.from("profiles").insert({id:e.id,email:e.email,full_name:(null==(t=e.user_metadata)?void 0:t.full_name)||null,avatar_url:(null==(a=e.user_metadata)?void 0:a.avatar_url)||null})}catch(e){}},h=async(e,t)=>{let{error:a}=await r.N.auth.signInWithPassword({email:e,password:t});return{error:a}},u=async(e,t,a)=>{let{error:i}=await r.N.auth.signUp({email:e,password:t,options:{data:{full_name:a}}});return{error:i}},x=async()=>{let{error:e}=await r.N.auth.signOut();return{error:e}},g=async e=>{let{error:t}=await r.N.auth.resetPasswordForEmail(e,{redirectTo:"".concat(window.location.origin,"/auth/reset-password")});return{error:t}};return(0,i.jsx)(l.Provider,{value:{user:a,session:o,loading:c,signIn:h,signUp:u,signOut:x,resetPassword:g},children:t})}function o(){let e=(0,s.useContext)(l);if(void 0===e)throw Error("useAuth must be used within an AuthProvider");return e}},2099:(e,t,a)=>{"use strict";a.d(t,{N:()=>l});var i=a(321);let s="https://eulbkkpnpzbydikovmcv.supabase.co",r="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImV1bGJra3BucHpieWRpa292bWN2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDkwNjc5NjgsImV4cCI6MjA2NDY0Mzk2OH0.zIKb8vKTTqmnH4jkLFGTNWEW1Pucrc0QMScG5IR6ETQ";if(!s||!r)throw Error("Missing Supabase environment variables");let l=(0,i.UU)(s,r,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!1,storageKey:"sb-auth-token",storage:window.localStorage,flowType:"pkce"},db:{schema:"public"},global:{headers:{"X-Client-Info":"movie-streaming-app"}},realtime:{params:{eventsPerSecond:2}}})},2373:(e,t,a)=>{"use strict";a.d(t,{U:()=>d});var i=a(2115),s=a(283),r=a(2099);let l=()=>{try{let e="__localStorage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}},n=e=>({media_id:"string"==typeof e.id?parseInt(e.id,10):e.id,media_type:e.media_type,title:"movie"===e.media_type?e.title:e.name,poster_path:e.poster_path||void 0,overview:e.overview,release_date:"movie"===e.media_type?e.release_date:e.first_air_date,vote_average:e.vote_average,backdrop_path:e.backdrop_path||void 0,genre_ids:e.genre_ids||[]}),o=e=>{let t={id:e.media_id,poster_path:e.poster_path||null,overview:e.overview||"",vote_average:e.vote_average||0,backdrop_path:e.backdrop_path||null,genre_ids:e.genre_ids||[],media_type:e.media_type};return"movie"===e.media_type?{...t,title:e.title,release_date:e.release_date||"",media_type:"movie"}:{...t,name:e.title,first_air_date:e.release_date||"",media_type:"tv"}},d=()=>{let{user:e}=(0,s.A)(),[t,a]=(0,i.useState)([]),[d,c]=(0,i.useState)([]),[m,p]=(0,i.useState)(!0),[h,u]=(0,i.useState)(!1),x=l();(0,i.useEffect)(()=>{x?u(!1):e&&u(!0)},[x,e]);let g=(0,i.useCallback)(async()=>{p(!0);try{if(h){if(e){let[t,i]=await Promise.all([r.N.from("watchlist").select("*").eq("user_id",e.id).order("created_at",{ascending:!1}),r.N.from("watch_history").select("*").eq("user_id",e.id).order("watched_at",{ascending:!1})]);if(t.error)throw t.error;if(i.error)throw i.error;a(t.data||[]),c(i.data||[])}}else{let e=localStorage.getItem("watchlist"),t=localStorage.getItem("watchHistory");a(e?JSON.parse(e):[]),c(t?JSON.parse(t):[])}}catch(e){a([]),c([])}finally{p(!1)}},[h,e]),v=(0,i.useCallback)(async t=>{try{h?e&&a(t):(localStorage.setItem("watchlist",JSON.stringify(t)),a(t))}catch(e){}},[h,e]),y=(0,i.useCallback)(async t=>{try{h?e&&c(t):(localStorage.setItem("watchHistory",JSON.stringify(t)),c(t))}catch(e){}},[h,e]),f=(0,i.useCallback)(async i=>{try{let s="media_id"in i?i:n(i),l={...s,id:crypto.randomUUID(),created_at:new Date().toISOString()};if(h){if(e){let{error:i}=await r.N.from("watchlist").insert({user_id:e.id,media_id:s.media_id,media_type:s.media_type,title:s.title,poster_path:s.poster_path,overview:s.overview,release_date:s.release_date});if(i)throw i;a([l,...t])}}else{let e=[l,...t];await v(e)}}catch(e){throw e}},[t,v,h,e]),b=(0,i.useCallback)(async(i,s)=>{try{let l="string"==typeof i?parseInt(i,10):i;if(h){if(e){let{error:i}=await r.N.from("watchlist").delete().eq("user_id",e.id).eq("media_id",l).eq("media_type",s);if(i)throw i;let n=t.filter(e=>e.media_id!==l||e.media_type!==s);a(n)}}else{let e=t.filter(e=>e.media_id!==l||e.media_type!==s);await v(e)}}catch(e){throw e}},[t,v,h,e]),w=(0,i.useCallback)(async t=>{try{let a={...t,id:crypto.randomUUID(),watched_at:new Date().toISOString(),created_at:new Date().toISOString()};if(h){if(e){let{error:i}=await r.N.from("watch_history").insert({user_id:e.id,media_id:t.media_id,media_type:t.media_type,title:t.title,poster_path:t.poster_path,season_number:t.season_number,episode_number:t.episode_number,progress:t.progress});if(i)throw i;c([a,...d])}}else{let e=[a,...d];await y(e)}}catch(e){throw e}},[d,y,h,e]),_=(0,i.useCallback)(async(t,a,i,s,l)=>{try{if(h){if(e){let{error:n}=await r.N.from("watch_history").upsert({user_id:e.id,media_id:t,media_type:a,season_number:s,episode_number:l,progress:i,watched_at:new Date().toISOString()});if(n)throw n;await g()}}else{let e,r=d.findIndex(e=>e.media_id===t&&e.media_type===a&&e.season_number===s&&e.episode_number===l);r>=0?(e=[...d])[r]={...e[r],progress:i,watched_at:new Date().toISOString()}:e=[{id:crypto.randomUUID(),media_id:t,media_type:a,title:"".concat(a," ").concat(t),progress:i,season_number:s,episode_number:l,watched_at:new Date().toISOString(),created_at:new Date().toISOString()},...d],await y(e)}}catch(e){throw e}},[d,y,h,e,g]),j=(0,i.useCallback)(async()=>{try{if(h){if(e){let{error:t}=await r.N.from("watchlist").delete().eq("user_id",e.id);if(t)throw t;a([])}}else localStorage.setItem("watchlist",JSON.stringify([])),a([])}catch(e){throw e}},[h,e]),N=(0,i.useCallback)((e,a)=>{let i="string"==typeof e?parseInt(e,10):e;return t.some(e=>e.media_id===i&&e.media_type===a)},[t]),k=(0,i.useCallback)((e,t,a,i)=>{let s=d.find(s=>s.media_id===e&&s.media_type===t&&s.season_number===a&&s.episode_number===i);return(null==s?void 0:s.progress)||0},[d]),S=(0,i.useCallback)(async()=>{if(x&&e&&h)try{let t=localStorage.getItem("watchlist"),a=localStorage.getItem("watchHistory");if(t||a){if(t)for(let a of JSON.parse(t))await r.N.from("watchlist").upsert({user_id:e.id,media_id:a.media_id,media_type:a.media_type,title:a.title,poster_path:a.poster_path,overview:a.overview,release_date:a.release_date});if(a)for(let t of JSON.parse(a))await r.N.from("watch_history").upsert({user_id:e.id,media_id:t.media_id,media_type:t.media_type,title:t.title,poster_path:t.poster_path,season_number:t.season_number,episode_number:t.episode_number,progress:t.progress,watched_at:t.watched_at})}}catch(e){}},[x,e,h]);return(0,i.useEffect)(()=>{g()},[g]),(0,i.useEffect)(()=>{e&&!h&&x&&S()},[e,h,x,S]),{watchlist:t.map(o),rawWatchlist:t,watchHistory:d,isLoading:m,useSupabase:!x&&!!e,storageType:h?"supabase":"localStorage",addToWatchlist:f,removeFromWatchlist:b,clearWatchlist:j,isInWatchlist:N,addToWatchHistory:w,updateWatchProgress:_,getWatchProgress:k,loadData:g,syncData:S}}},4356:(e,t,a)=>{Promise.resolve().then(a.bind(a,8478))},6288:(e,t,a)=>{"use strict";a.d(t,{X:()=>i.A});var i=a(4416)},6982:(e,t,a)=>{"use strict";a.d(t,{dj:()=>n,tE:()=>o});var i=a(5155),s=a(2115),r=a(6288);let l=(0,s.createContext)(void 0),n=()=>{let e=(0,s.useContext)(l);if(!e)throw Error("useToast must be used within a ToastProvider");return e},o=e=>{let{children:t}=e,[a,n]=(0,s.useState)([]),o=(0,s.useCallback)((e,t)=>{let a=Math.random().toString(36).substring(2,9);return n(i=>[...i,{id:a,message:e,type:t}]),setTimeout(()=>{d(a)},4e3),a},[]),d=(0,s.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e))},[]);return(0,i.jsxs)(l.Provider,{value:{toasts:a,showToast:o,hideToast:d},children:[" ",t,(0,i.jsx)("div",{className:"fixed top-4 right-4 z-[200] flex flex-col gap-2",children:a.map(e=>(0,i.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-lg p-3 shadow-lg transition-all transform animate-slide-in-top\n ".concat("success"===e.type?"bg-green-600/90 text-white":"error"===e.type?"bg-red-600/90 text-white":"bg-blue-600/90 text-white"," \n backdrop-blur-sm border border-white/10 min-w-[300px] max-w-sm"),children:[(0,i.jsx)("p",{className:"text-sm font-medium flex-1",children:e.message}),(0,i.jsx)("button",{onClick:()=>d(e.id),className:"rounded-full p-1 hover:bg-white/20 transition-colors",children:(0,i.jsx)(r.X,{size:16})})]},e.id))})]})}},8478:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>I});var i=a(5155),s=a(2115),r=a(8e3),l=a(1066),n=a(6932),o=a(6618);let d=e=>{let{title:t,movieData:a,tvData:d,isLoading:c=!1,error:m=null,onRetry:p,layout:h="carousel"}=e,[u,x]=function(e,t){let[a,i]=(0,s.useState)(()=>{{let a=localStorage.getItem(e);return null!==a?JSON.parse(a):t}});return(0,s.useEffect)(()=>{localStorage.setItem(e,JSON.stringify(a))},[e,a]),[a,i]}("tab-preference-".concat(t?t.toLowerCase().replace(/\s+/g,"-"):"default"),"movie"),[g,v]=(0,s.useState)(u),[y,f]=(0,s.useState)(!1),[b,w]=(0,s.useState)({movie:[],tv:[]}),[_,j]=(0,s.useState)(null),[N,k]=(0,s.useState)(null),[S,T]=(0,s.useState)([]),[I,C]=(0,s.useState)([]),[E,A]=(0,s.useState)(!1);(0,s.useEffect)(()=>{(async()=>{A(!0);try{if(a instanceof Promise){let e=await a;T(e||[])}else T(a||[]);if(d instanceof Promise){let e=await d;C(e||[])}else C(d||[])}catch(e){}finally{A(!1)}})()},[a,d]);let M=S&&S.length>0,W=I&&I.length>0,L=M&&W,O=t.toLowerCase().replace(/\s+/g,"-"),z=t.toLowerCase().includes("trending");(0,s.useEffect)(()=>{(async()=>{k(null);try{let e=await fetch("/api/genres");if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to fetch genres")}let t=await e.json();w(t)}catch(e){k(e instanceof Error?e.message:"Could not load genres")}})()},[]),(0,s.useEffect)(()=>{!M&&W?(v("tv"),x("tv")):M&&!W&&(v("movie"),x("movie"))},[M,W,x]);let P=e=>{v(e),x(e),j(null)},R=_?("movie"===g?S:I).filter(e=>{var t;return null==(t=e.genre_ids)?void 0:t.includes(_)}):"movie"===g?S:I,F=b[g]||[],D=c||E;return(0,i.jsxs)("section",{"aria-labelledby":"".concat(O,"-heading"),className:"py-4 animate-fadeIn",children:[(0,i.jsxs)("div",{className:"flex items-center mb-5 ".concat(L?"justify-between":"justify-start"," flex-col sm:flex-row gap-4"),children:[(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,i.jsx)("h2",{id:"".concat(O,"-heading"),className:"text-xl md:text-2xl font-bold text-white",children:t}),z&&(0,i.jsx)("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-600 text-white animate-pulse",children:"Live"})]}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[!D&&R.length>0&&F.length>0&&!N&&(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)("button",{onClick:()=>f(!y),className:"p-1.5 text-gray-400 hover:text-white transition-colors rounded-full hover:bg-gray-800","aria-label":"Toggle filters",title:"Filter content",children:(0,i.jsx)(n.A,{size:18})}),y&&(0,i.jsxs)("div",{className:"absolute right-0 mt-2 w-48 bg-gray-800 rounded-lg shadow-lg p-4 z-10",children:[(0,i.jsx)("h3",{className:"text-sm font-semibold text-white mb-2",children:"Filter by Genre"}),(0,i.jsxs)("select",{value:_||"",onChange:e=>j(e.target.value?Number(e.target.value):null),className:"w-full bg-gray-700 text-white rounded-md p-2 text-sm",children:[(0,i.jsx)("option",{value:"",children:"All Genres"}),F.map(e=>(0,i.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]}),N&&(0,i.jsx)("span",{className:"text-xs text-red-400",title:N,children:"Filter Error"}),L&&(0,i.jsxs)("div",{className:"flex rounded-full bg-gray-800 p-1",role:"tablist","aria-orientation":"horizontal",children:[(0,i.jsxs)("button",{onClick:()=>P("movie"),role:"tab","aria-selected":"movie"===g,"aria-controls":"".concat(O,"-panel"),className:"flex items-center px-3 py-1 text-sm font-medium rounded-full transition-colors ".concat("movie"===g?"bg-blue-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-700"),children:[(0,i.jsx)(l.A,{size:16,className:"mr-1"})," Movies"]}),(0,i.jsxs)("button",{onClick:()=>P("tv"),role:"tab","aria-selected":"tv"===g,"aria-controls":"".concat(O,"-panel"),className:"flex items-center px-3 py-1 text-sm font-medium rounded-full transition-colors ".concat("tv"===g?"bg-blue-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-700"),children:[(0,i.jsx)(o.A,{size:16,className:"mr-1"})," TV Shows"]})]})]})]}),(0,i.jsx)("div",{id:"".concat(O,"-panel"),role:"tabpanel",children:(0,i.jsx)(r.default,{items:R,listTitle:"".concat(t," - ").concat("movie"===g?"Movies":"TV Shows"),isLoading:D,error:m,onRetry:p,layout:h})})]})},c=(e,t,a)=>{(0,s.useEffect)(()=>{if(!e.current)return;let i=e.current,s=new IntersectionObserver(e=>{e[0].isIntersecting&&t()},{threshold:.1,...a});return s.observe(i),()=>{s.unobserve(i)}},[e,t,a])};var m=a(2373),p=a(5028),h=a(2108),u=a(2355),x=a(3052),g=a(5695),v=a(6766),y=a(6982),f=a(3096);let b=(0,s.memo)(function(e){let{src:t,alt:a,className:r="",priority:l=!1,onError:n,fallbackComponent:o,maxHeight:d=96,maxWidth:c=384}=e,[m,p]=(0,s.useState)(!1),[h,u]=(0,s.useState)(!1),[x,g]=(0,f.Wx)({triggerOnce:!0,rootMargin:"100px",skip:l}),y=g||l,b=(0,s.useCallback)(()=>{p(!0)},[]),w=(0,s.useCallback)(()=>{u(!0),null==n||n()},[n]);return h&&o?(0,i.jsx)(i.Fragment,{children:o}):h?null:y?(0,i.jsx)("div",{ref:x,className:"relative ".concat(r),style:{maxHeight:d,maxWidth:c},children:(0,i.jsx)(v.default,{src:t,alt:a,width:c,height:d,sizes:"(max-width: 640px) 240px, (max-width: 768px) 320px, (max-width: 1024px) 400px, 500px",className:"object-contain transition-all duration-500 drop-shadow-2xl filter brightness-110 contrast-110 ".concat(m?"opacity-100 blur-0":"opacity-0 blur-sm"),style:{filter:"drop-shadow(0 4px 20px rgba(0, 0, 0, 0.8)) brightness(1.1) contrast(1.1)",width:"auto",height:"auto",maxHeight:d,maxWidth:c},priority:l,quality:90,loading:l?"eager":"lazy",onLoad:b,onError:w})}):(0,i.jsx)("div",{ref:x,className:"bg-transparent animate-pulse ".concat(r),style:{height:d,maxWidth:c,aspectRatio:"auto"}})}),w=()=>{let[e,t]=(0,s.useState)([]),[a,l]=(0,s.useState)(!0),[n,o]=(0,s.useState)(null);return((0,s.useEffect)(()=>{(async()=>{try{l(!0);let e=await fetch("/api/discover?mediaType=anime&limit=20");if(!e.ok)throw Error("Failed to fetch anime");let a=await e.json();t(a.results||[])}catch(e){o(e)}finally{l(!1)}})()},[]),n)?(0,i.jsxs)("div",{className:"mb-6 sm:mb-8",children:[(0,i.jsx)("h2",{className:"text-xl sm:text-2xl font-bold text-white mb-4",children:"Popular Anime"}),(0,i.jsxs)("div",{className:"bg-red-900/20 border border-red-500/30 rounded-lg p-4 text-center",children:[(0,i.jsx)("p",{className:"text-red-400 mb-2",children:"Failed to load anime content"}),(0,i.jsx)("button",{onClick:()=>{o(null),t([])},className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-md transition-colors",children:"Try Again"})]})]}):a?(0,i.jsxs)("div",{className:"mb-6 sm:mb-8",children:[(0,i.jsx)("h2",{className:"text-xl sm:text-2xl font-bold text-white mb-4",children:"Popular Anime"}),(0,i.jsx)("div",{className:"flex space-x-4 overflow-x-auto pb-4",children:Array(10).fill(0).map((e,t)=>(0,i.jsxs)("div",{className:"flex-shrink-0 w-36 sm:w-48",children:[(0,i.jsx)("div",{className:"aspect-[2/3] bg-gray-800 rounded-lg animate-pulse"}),(0,i.jsx)("div",{className:"mt-2 h-4 bg-gray-800 rounded animate-pulse"})]},t))})]}):0===e.length?(0,i.jsxs)("div",{className:"mb-6 sm:mb-8",children:[(0,i.jsx)("h2",{className:"text-xl sm:text-2xl font-bold text-white mb-4",children:"Popular Anime"}),(0,i.jsx)("div",{className:"text-center py-8 text-gray-400",children:(0,i.jsx)("p",{children:"No anime content available at the moment"})})]}):(0,i.jsxs)("div",{className:"mb-6 sm:mb-8",children:[(0,i.jsx)("h2",{className:"text-xl sm:text-2xl font-bold text-white mb-4",children:"Popular Anime"})," ",(0,i.jsx)(r.default,{items:e,layout:"carousel"})]})};var _=a(2690),j=a(6874),N=a.n(j);function k(e){let{className:t="",excludeId:a,excludeType:r}=e,[l,n]=(0,s.useState)([]),[o,d]=(0,s.useState)([]),[c,m]=(0,s.useState)(!0);return((0,s.useEffect)(()=>{(async()=>{try{m(!0);let e=await fetch("/api/trending?mediaType=movie&timeWindow=day"),t=await e.json(),i=await fetch("/api/trending?mediaType=tv&timeWindow=day"),s=await i.json(),l=Array.isArray(t)?t:[],o=Array.isArray(s)?s:[];if(l.length<6){let e=await fetch("/api/discover?mediaType=movie&page=1&sortBy=popularity.desc"),t=(await e.json()).results||[],a=new Set(l.map(e=>e.id)),i=t.filter(e=>!a.has(e.id));l=[...l,...i]}if(o.length<6){let e=await fetch("/api/discover?mediaType=tv&page=1&sortBy=popularity.desc"),t=(await e.json()).results||[],a=new Set(o.map(e=>e.id)),i=t.filter(e=>!a.has(e.id));o=[...o,...i]}let c=l.filter(e=>"movie"!==r||e.id!==a).slice(0,6),p=o.filter(e=>"tv"!==r||e.id!==a).slice(0,6);n(c),d(p)}catch(e){n([]),d([])}finally{m(!1)}})()},[a,r]),c)?(0,i.jsxs)("div",{className:"bg-gray-800/30 rounded-lg p-4 ".concat(t),children:[(0,i.jsx)("h3",{className:"text-lg font-semibold text-white mb-3",children:"Featured Content"}),(0,i.jsx)("div",{className:"animate-pulse",children:(0,i.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"h-4 bg-gray-700 rounded mb-2"}),(0,i.jsx)("div",{className:"space-y-2",children:[...Array(6)].map((e,t)=>(0,i.jsx)("div",{className:"h-3 bg-gray-700 rounded"},t))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"h-4 bg-gray-700 rounded mb-2"}),(0,i.jsx)("div",{className:"space-y-2",children:[...Array(6)].map((e,t)=>(0,i.jsx)("div",{className:"h-3 bg-gray-700 rounded"},t))})]})]})})]}):(0,i.jsxs)("div",{className:"bg-gray-800/30 rounded-lg p-4 ".concat(t),children:[(0,i.jsx)("h3",{className:"text-lg font-semibold text-white mb-3",children:"Trending & Latest Content"}),(0,i.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-sm font-medium text-gray-300 mb-2",children:"Trending Movies"}),(0,i.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,i.jsxs)(N(),{href:(0,_.GV)(e.id,e.title),className:"block text-sm text-blue-400 hover:text-blue-300 transition-colors truncate",title:e.title,children:[e.title," (",e.release_date?new Date(e.release_date).getFullYear():"N/A",")"]},e.id))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-sm font-medium text-gray-300 mb-2",children:"Trending TV Shows"}),(0,i.jsx)("div",{className:"space-y-2",children:o.map(e=>(0,i.jsxs)(N(),{href:(0,_.pK)(e.id,e.name),className:"block text-sm text-blue-400 hover:text-blue-300 transition-colors truncate",title:e.name,children:[e.name," (",e.first_air_date?new Date(e.first_air_date).getFullYear():"N/A",")"]},e.id))})]})]}),(0,i.jsx)("div",{className:"mt-4 pt-3 border-t border-gray-700",children:(0,i.jsxs)("div",{className:"flex flex-wrap gap-3 text-sm",children:[(0,i.jsx)(N(),{href:"/browse/movies",className:"text-gray-400 hover:text-white transition-colors",children:"All Movies"}),(0,i.jsx)(N(),{href:"/browse/tv",className:"text-gray-400 hover:text-white transition-colors",children:"All TV Shows"}),(0,i.jsx)(N(),{href:"/browse/anime",className:"text-gray-400 hover:text-white transition-colors",children:"Anime"})]})})]})}let S=(0,p.default)(()=>a.e(5901).then(a.bind(a,5901)).catch(()=>({default:e=>{let{children:t,...a}=e;return(0,i.jsx)("div",{...a,children:t})}})),{loadableGenerated:{webpack:()=>[5901]},ssr:!1,loading:()=>(0,i.jsx)("div",{className:"w-full h-20 bg-gray-800/50 rounded-lg animate-pulse flex items-center justify-center",children:(0,i.jsxs)("div",{className:"flex space-x-2",children:[(0,i.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full animate-bounce"}),(0,i.jsx)("div",{className:"w-2 h-2 bg-purple-500 rounded-full animate-bounce [animation-delay:100ms]"}),(0,i.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce [animation-delay:200ms]"})]})})}),T=(0,p.default)(()=>a.e(5516).then(a.bind(a,5516)).catch(()=>({default:e=>{let{children:t}=e;return(0,i.jsx)(i.Fragment,{children:t})}})),{loadableGenerated:{webpack:()=>[5516]},ssr:!1,loading:()=>(0,i.jsx)("div",{className:"contents"})});function I(){var e,t,a,r,l,n,o,p,f,j,N,I,C;let E,[A,M]=(0,s.useState)([]),[W,L]=(0,s.useState)([]),[O,z]=(0,s.useState)([]),[P,R]=(0,s.useState)([]),[F,D]=(0,s.useState)([]),[B,J]=(0,s.useState)([]),[U,H]=(0,s.useState)([]),[q,G]=(0,s.useState)([]),[V,K]=(0,s.useState)([]),[X,Y]=(0,s.useState)([]),[Q,Z]=(0,s.useState)({}),[$,ee]=(0,s.useState)(0),[et,ea]=(0,s.useState)(!0),[ei,es]=(0,s.useState)(new Set),{showToast:er}=(0,y.dj)(),el=(0,s.useRef)(null),en=(0,s.useRef)(null),eo=(0,s.useRef)(null),ed=(0,s.useRef)(null),ec=(0,s.useRef)(null),em=(0,s.useRef)(null),ep=(0,g.useRouter)(),{addToWatchlist:eh,removeFromWatchlist:eu,isInWatchlist:ex}=(0,m.U)(),[eg,ev]=(0,s.useState)([]);(0,s.useEffect)(()=>{{let e=localStorage.getItem("continueWatching");e&&ev(JSON.parse(e))}},[]);let ey=(e,t)=>{let a=eg.filter(a=>a.id!==e||a.media_type!==t);ev(a),localStorage.setItem("continueWatching",JSON.stringify(a)),er("Removed from continue watching","info")},ef=(e,t)=>{let a=eg.find(a=>a.id===e&&a.media_type===t);if(a){let i,s=[];{let e=localStorage.getItem("watchedHistory");e&&(s=JSON.parse(e))}let r=s.findIndex(a=>a.id===e&&a.media_type===t),l={...a,progress:100,watchedAt:new Date().toISOString()};-1!==r?((i=[...s]).splice(r,1),i.unshift(l)):i=[l,...s];let n=eg.filter(a=>a.id!==e||a.media_type!==t);ev(n),eu(e,t),localStorage.setItem("watchedHistory",JSON.stringify(i)),localStorage.setItem("continueWatching",JSON.stringify(n)),er('Marked "'.concat(a.title||a.name,'" as finished'),"success")}},eb=(e,t)=>{let a=eg.find(a=>a.id===e&&a.media_type===t);if(a){if(ex(e,t)){ey(e,t),er('"'.concat(a.title||a.name,'" is already in your watchlist'),"info");return}eh({id:a.id,title:a.title||a.name,name:a.name||a.title,poster_path:a.poster_path,backdrop_path:a.backdrop_path,release_date:a.release_date||a.first_air_date,first_air_date:a.first_air_date||a.release_date,overview:a.overview,vote_average:a.vote_average,media_type:a.media_type,genre_ids:a.genre_ids||[]}),ey(e,t),er('Moved "'.concat(a.title||a.name,'" to your watchlist'),"success")}},ew=(e,t,a)=>{e.stopPropagation();let i=document.querySelector(".action-options-menu");i&&i.remove();let s=document.createElement("div");s.className="action-options-menu",s.innerHTML='\n