(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3508,6557],{6557:(e,t,r)=>{"use strict";r.d(t,{MediaProvider:()=>s,Q:()=>l});var i=r(95155),a=r(12115);let n=(0,a.createContext)(void 0);function s(e){let{children:t}=e,[r,s]=(0,a.useState)([]),[l,o]=(0,a.useState)([]),[c,d]=(0,a.useState)([]),[m,u]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=localStorage.getItem("watchlist"),t=localStorage.getItem("favorites"),r=localStorage.getItem("watchHistory");s(e?JSON.parse(e):[]),o(t?JSON.parse(t):[]),d(r?JSON.parse(r):[]),u(!0)},[]),(0,a.useEffect)(()=>{m&&(localStorage.setItem("watchlist",JSON.stringify(r)),localStorage.setItem("favorites",JSON.stringify(l)),localStorage.setItem("watchHistory",JSON.stringify(c)))},[r,l,c,m]),(0,i.jsx)(n.Provider,{value:{watchlist:r,favorites:l,watchHistory:c,addToWatchlist:e=>{s(t=>t.some(t=>t.id===e.id)?t:[...t,e])},removeFromWatchlist:e=>{s(t=>t.filter(t=>t.id!==e))},addToFavorites:e=>{o(t=>t.some(t=>t.id===e.id)?t:[...t,e])},removeFromFavorites:e=>{o(t=>t.filter(t=>t.id!==e))},addToWatchHistory:e=>{d(t=>{let r=t.filter(t=>t.id!==e.id);return[e,...r]})},removeFromWatchHistory:e=>{d(t=>t.filter(t=>t.id!==e))},clearWatchHistory:()=>{d([])},isInWatchlist:e=>r.some(t=>t.id===e),isInFavorites:e=>l.some(t=>t.id===e),isInWatchHistory:e=>c.some(t=>t.id===e)},children:t})}function l(){let e=(0,a.useContext)(n);if(void 0===e)throw Error("useMedia must be used within a MediaProvider");return e}},11913:(e,t,r)=>{"use strict";r.d(t,{mq:()=>s,U:()=>l});var i=r(12115);let a=i.useLayoutEffect,n={base:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},s=e=>"(min-width: ".concat(n[e],"px)");function l(e){let{defaultValue:t=!1,initializeWithValue:r=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e=>window.matchMedia(e).matches,[s,l]=(0,i.useState)(()=>r?n(e):t);function o(){l(n(e))}return(a(()=>{let t=window.matchMedia(e);return o(),t.addListener?t.addListener(o):t.addEventListener("change",o),()=>{t.removeListener?t.removeListener(o):t.removeEventListener("change",o)}},[e]),!function(){let[e,t]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{t(!0)},[]),e}())?t:s}},19619:(e,t,r)=>{"use strict";r.r(t),r.d(t,{FadeInContent:()=>n});var i=r(95155);r(12115);var a=r(5242);function n(e){let{children:t,classCSS:r,duration:n,delay:s,index:l,scale:o}=e;return s&&void 0!==l?(0,i.jsx)(a.P.div,{whileHover:{scale:o},whileTap:{scale:o?o-.03:.95},initial:{opacity:0},animate:{opacity:1,transition:{duration:.5,delay:l/5}},className:r||"",children:t}):(0,i.jsx)(a.P.main,{initial:{opacity:0},animate:{opacity:1},transition:{duration:n||.5},className:r||"",children:t})}},22602:(e,t,r)=>{Promise.resolve().then(r.bind(r,37617))},35695:(e,t,r)=>{"use strict";r.r(t);var i=r(18999),a={};for(let e in i)"default"!==e&&(a[e]=()=>i[e]);r.d(t,a)},37617:(e,t,r)=>{"use strict";r.d(t,{default:()=>x});var i=r(95155),a=r(19619),n=r(52596),s=r(5242),l=r(12115),o=r(86519),c=r(14549),d=r(11913),m=r(6874),u=r.n(m),p=r(35695),h=r(6557);let f=[{id:"watched",label:"Last Seen"},{id:"watchlist",label:"Watch Lists"},{id:"favorite",label:"Favorites"}];function x(){let[e,t]=(0,l.useState)(f[0]),[r,m]=(0,l.useState)(!1),x=(0,p.useSearchParams)(),b=x.get("tab"),{watchlist:v,watchHistory:g,favorites:y}=(0,h.Q)(),j=(0,d.U)((0,d.mq)("sm")),w=e=>{let t=new URLSearchParams(x.toString());t.set("tab",e),console.log(t.toString()),window.history.pushState(null,"","?".concat(t.toString()))},N=()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur()};return(0,l.useEffect)(()=>{if(b){let e=f.find(e=>e.id===b);e&&t(e)}},[b,f]),(0,l.useEffect)(()=>{("watched"===e.id&&0===g.length||"watchlist"===e.id&&0===v.length||"favorite"===e.id&&0===y.length)&&m(!1)},[e,v,g,y]),(0,i.jsxs)(a.FadeInContent,{duration:.5,classCSS:"mt-32 space-y-10 flex-1",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-6 px-3 sm:px-16",children:[j?(0,i.jsx)("div",{className:"flex flex-wrap items-center space-x-1",children:f.map(r=>(0,i.jsxs)("button",{onClick:()=>{t(r),w(r.id)},className:(0,n.A)("relative rounded-full px-3 py-1.5 text-xl font-semibold transition focus-visible:outline-2",e.id===r.id?"text-primary-content":"hover:text-white/60"),style:{WebkitTapHighlightColor:"transparent"},children:[e.id===r.id&&(0,i.jsx)(s.P.span,{layoutId:"bubble",className:"absolute inset-0 -z-[1] bg-primary mix-blend-difference",style:{borderRadius:9999},transition:{type:"spring",bounce:.2,duration:.6}}),r.label]},r.id))}):(0,i.jsxs)("div",{className:"dropdown",children:[(0,i.jsxs)("div",{tabIndex:0,role:"button",className:"btn btn-primary btn-sm m-1",children:[(0,i.jsx)("span",{children:e.label}),(0,i.jsx)("span",{children:(0,i.jsx)(c.zrT,{})})]}),(0,i.jsx)("ul",{tabIndex:0,className:"menu dropdown-content z-[1] w-52 rounded-box bg-base-100 p-2 shadow",children:f.map(r=>(0,i.jsx)("li",{onClick:()=>{t(r),w(r.id),N()},className:(0,n.A)(r.id===e.id&&"text-primary"),children:(0,i.jsx)("a",{children:r.label})},r.id))})]}),(0,i.jsxs)("button",{className:(0,n.A)("btn btn-neutral btn-sm ml-auto flex items-center gap-2"),onClick:()=>m(!r),disabled:"watched"===e.id&&0===g.length||"watchlist"===e.id&&0===v.length||"favorite"===e.id&&0===y.length,children:[(0,i.jsx)("span",{children:r?(0,i.jsx)(c.SXS,{}):(0,i.jsx)(c.H6t,{})}),r?(0,i.jsx)("span",{children:"Stop Editing"}):(0,i.jsx)("span",{children:"Edit Lists"})]})]}),(0,i.jsxs)("div",{className:"px-3 sm:px-16",children:["watched"===e.id&&(0,i.jsx)(i.Fragment,{children:g.length>0?(0,i.jsx)("div",{className:"grid-cols-2 flex-wrap items-center gap-4 max-sm:grid sm:flex",children:g.map((e,t)=>(0,i.jsx)(o.Z,{...e,index:t,typeMedia:"watched",isEditMode:r},e.id))}):(0,i.jsxs)("div",{className:"flex h-96 flex-col items-center justify-center gap-4",children:[(0,i.jsx)("p",{className:"text-center",children:"You haven't watched any content yet."}),(0,i.jsx)(u(),{href:"/",className:"btn btn-outline btn-primary btn-sm w-max sm:btn-md",children:"Explore Now"})]})}),"watchlist"===e.id&&(0,i.jsx)(i.Fragment,{children:v.length>0?(0,i.jsx)("div",{className:"grid-cols-2 flex-wrap items-center gap-4 max-sm:grid sm:flex",children:v.map((e,t)=>(0,i.jsx)(o.Z,{...e,index:t,typeMedia:"watchlist",isEditMode:r},e.id))}):(0,i.jsxs)("div",{className:"flex h-96 flex-col items-center justify-center gap-4",children:[(0,i.jsx)("p",{className:"text-center",children:"You haven't added any content to your watchlist yet."}),(0,i.jsx)(u(),{href:"/",className:"btn btn-outline btn-primary btn-sm w-max sm:btn-md",children:"Explore Now"})]})}),"favorite"===e.id&&(0,i.jsx)(i.Fragment,{children:y.length>0?(0,i.jsx)("div",{className:"grid-cols-2 flex-wrap items-center gap-4 max-sm:grid sm:flex",children:y.map((e,t)=>(0,i.jsx)(o.Z,{...e,index:t,typeMedia:"favorite",isEditMode:r},e.id))}):(0,i.jsxs)("div",{className:"flex h-96 flex-col items-center justify-center gap-4",children:[(0,i.jsx)("p",{className:"text-center",children:"You haven't added any content to your favorites yet."}),(0,i.jsx)(u(),{href:"/",className:"btn btn-outline btn-primary btn-sm w-max sm:btn-md",children:"Explore Now"})]})})]})]})}},59434:(e,t,r)=>{"use strict";r.d(t,{cn:()=>n});var i=r(52596),a=r(39688);function n(){for(var e=arguments.length,t=Array(e),r=0;r{"use strict";r.d(t,{k5:()=>d});var i=r(12115),a={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},n=i.createContext&&i.createContext(a),s=["attr","size","title"];function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;ti.createElement(m,l({attr:c({},e.attr)},t),function e(t){return t&&t.map((t,r)=>i.createElement(t.tag,c({key:r},t.attr),e(t.child)))}(e.child))}function m(e){var t=t=>{var r,{attr:a,size:n,title:o}=e,d=function(e,t){if(null==e)return{};var r,i,a=function(e,t){if(null==e)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(t.indexOf(i)>=0)continue;r[i]=e[i]}return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(e,s),m=n||t.size||"1em";return t.className&&(r=t.className),e.className&&(r=(r?r+" ":"")+e.className),i.createElement("svg",l({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,a,d,{className:r,style:c(c({color:e.color||t.color},t.style),e.style),height:m,width:m,xmlns:"http://www.w3.org/2000/svg"}),o&&i.createElement("title",null,o),e.children)};return void 0!==n?i.createElement(n.Consumer,null,e=>t(e)):t(a)}},86519:(e,t,r)=>{"use strict";r.d(t,{Z:()=>u});var i=r(95155),a=r(12115),n=r(6874),s=r.n(n),l=r(89863),o=r(19619),c=r(52596),d=r(14549),m=r(6557);function u(e){let{title:t,name:r,poster_path:n,media_type:u,id:p,index:h,contentType:f,bigCard:x,typeMedia:b,isEditMode:v,season_number:g,episode_number:y}=e,{removeFromFavorites:j,removeFromWatchHistory:w,removeFromWatchlist:N}=(0,m.Q)(),S=(0,a.useCallback)(()=>{"watchlist"===b?N(p):"favorite"===b?j(p):w(p)},[b,f,p]);return(0,i.jsxs)(o.FadeInContent,{duration:1,delay:!0,index:h>20?h-(h-20)*2:h,scale:1.05,classCSS:(0,c.A)("group relative overflow-hidden rounded-xl hover:ring-2",x?"max-w-[275px]":"max-w-[200px]",v?"ring-error":"ring-primary"),children:[(0,i.jsxs)(s(),{href:{pathname:"/".concat(u||f,"/").concat(p),query:"tv"===u?{season:g,episode:y}:null},"aria-label":"Link to details of ".concat(t||r),children:[(0,i.jsx)(l.FadeInImage,{src:n,type:"poster",alt:"Poster de ".concat(t||r),title:t||r,width:275,height:412.5,classCSS:"".concat(x?"h-auto sm:h-[412.5px] w-[275px]":"h-auto sm:h-[300px] w-[200px]"),imageSize:x?"bigCard":"poster"}),(0,i.jsx)("div",{className:"absolute inset-0 grid place-content-center bg-transparent transition-colors ease-in-out group-hover:bg-black/40",children:(0,i.jsx)("div",{className:"grid h-10 w-10 scale-0 place-content-center rounded-full bg-primary text-primary-content transition-transform ease-in-out group-hover:scale-100",children:(0,i.jsx)(d.Ajr,{size:24})})}),"watched"===b&&"tv"===u&&g&&y&&(0,i.jsxs)("div",{className:"absolute inset-x-0 bottom-0 flex h-1/2 items-end justify-between gap-4 bg-gradient-to-t from-black/80 to-transparent p-4 text-xs",children:[(0,i.jsx)("p",{className:"font-semibold",children:"Season ".concat(g)}),(0,i.jsx)("p",{className:"font-semibold",children:"Episode ".concat(y)})]})]}),(0,i.jsx)("div",{className:(0,c.A)("absolute inset-0 grid place-content-center bg-black/40 transition-all ease-in-out",v?"pointer-events-auto visible opacity-100":"pointer-events-none invisible opacity-0"),children:(0,i.jsx)("button",{className:(0,c.A)("grid h-10 w-10 place-content-center rounded-full bg-error text-primary-content transition-transform ease-in-out hover:scale-110",v?"pointer-events-auto scale-100":"pointer-events-none scale-0"),onClick:S,children:(0,i.jsx)(d.SXS,{size:24})})})]})}},89863:(e,t,r)=>{"use strict";r.d(t,{FadeInImage:()=>d});var i=r(95155),a=r(12115),n=r(66766),s=r(5242),l=r(52596),o=r(59434),c=r(14549);function d(e){let{src:t,type:r,alt:d="",width:m=500,height:u=500,classCSS:p="",title:h,imageSize:f="backdrop",priority:x}=e,[b,v]=(0,a.useState)(!0),[g,y]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{v(!0),y(!1)},[t]),(0,i.jsxs)(i.Fragment,{children:[g?(0,i.jsxs)("div",{className:(0,o.cn)("relative border border-base-200 bg-base-100","banner"===r&&"mask-default-img","profile"===r&&"m-auto h-24 w-24","poster"===r&&"h-60 w-40",p),children:[(0,i.jsx)("span",{className:"absolute inset-0 flex w-full flex-col items-center justify-center gap-4 p-2 text-center text-base-content opacity-30",children:(0,i.jsx)(c.uOi,{size:32,strokeWidth:1})}),"poster"===r&&h&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)("p",{className:"absolute inset-x-2 bottom-8 line-clamp-2 text-center font-semibold",children:h})})]}):(0,i.jsx)(n.default,{src:"https://image.tmdb.org/t/p/"+"".concat("backdrop"===f?"w1280":"poster"===f?"w342":"bigCard"===f?"w342":"profile"===f?"w185":"w1280","/").concat(t),alt:d,width:m,height:u,unoptimized:!0,priority:x,onLoad:()=>v(!1),onError:()=>y(!0),className:(0,l.A)("rounded-xl object-cover transition-opacity duration-300 ease-in",p,b?"invisible opacity-0":"visible opacity-100"),loading:x?"eager":"lazy"}),(0,i.jsx)(s.P.div,{initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},className:(0,l.A)("absolute inset-0 m-auto flex w-28 items-center justify-center",b&&!g?"block":"hidden"),children:(0,i.jsx)("span",{className:"loading loading-spinner loading-lg text-primary"})})]})}}},e=>{var t=t=>e(e.s=t);e.O(0,[2150,6874,5242,4277,6766,8441,1684,7358],()=>t(22602)),_N_E=e.O()}]);