(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5398],{13057:(e,t,s)=>{"use strict";s.d(t,{Loading:()=>l});var r=s(95155);s(12115);var a=s(5242),n=s(59434);function l(e){let{className:t}=e;return(0,r.jsx)(a.P.div,{initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},transition:{duration:.8},className:(0,n.cn)("z-10 mt-20 flex items-center justify-center",t),children:(0,r.jsx)("span",{className:"loading loading-spinner loading-lg text-neutral"})})}},37035:(e,t,s)=>{Promise.resolve().then(s.bind(s,57827)),Promise.resolve().then(s.bind(s,37111))},37111:(e,t,s)=>{"use strict";s.d(t,{SportSourcesProvider:()=>l,g:()=>i});var r=s(95155),a=s(12115);let n=(0,a.createContext)(void 0),l=e=>{let{children:t}=e,[s,l]=(0,a.useState)(!1),[i,c]=(0,a.useState)(null),[o,d]=(0,a.useState)(void 0);return(0,a.useEffect)(()=>{i&&i.sources.length>0&&d(i.sources[0])},[i]),(0,r.jsx)(n.Provider,{value:{isOpen:s,setIsOpen:l,sources:i,setSources:e=>{c(e)},selectedSource:o,setSelectedSource:d},children:t})},i=()=>{let e=(0,a.useContext)(n);if(!e)throw Error("useSportSources must be used within a SportSourcesProvider");return e}},54353:(e,t,s)=>{"use strict";s.d(t,{F:()=>n});var r=s(95838),a=s(12115);function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{type:t="matches",enabled:s,staleTime:n=36e5,...l}=e,i=(0,a.useMemo)(()=>{if("sports"===t)return"sports";let{sport:e,category:s="all",popular:r=!1}=l;return e?"matches/".concat(e).concat(r?"/popular":""):"matches/".concat(s).concat(r?"/popular":"")},[t,l]),c=(0,a.useMemo)(()=>{if("sports"===t)return["sports"];let{sport:e,category:s,popular:r}=l;return["matches",{sport:e,category:s,popular:r}]},[t,l]);return(0,r.I)({queryKey:c,queryFn:async()=>{let e="".concat("https://streamed.su/api","/").concat(i);try{let s=await fetch(e);if(!s.ok)throw Error("Failed to fetch data: ".concat(s.statusText));let r=await s.json();if("sports"===t){if(!(Array.isArray(r)&&r.every(e=>"id"in e&&"name"in e&&2===Object.keys(e).length)))throw Error("Invalid sports data format")}return r}catch(e){throw console.error("Error fetching ".concat(t,":"),e),e}},enabled:s})}},57827:(e,t,s)=>{"use strict";s.d(t,{default:()=>L});var r=s(95155),a=s(95838),n=s(12115),l=s(37111),i=s(57728),c=s(76168),o=s(50430),d=s(7471);class u extends n.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,s=e instanceof HTMLElement&&e.offsetWidth||0,r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft,r.right=s-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}}function m(e){let{children:t,isPresent:s,anchorX:a}=e,l=(0,n.useId)(),i=(0,n.useRef)(null),c=(0,n.useRef)({width:0,height:0,top:0,left:0,right:0}),{nonce:o}=(0,n.useContext)(d.Q);return(0,n.useInsertionEffect)(()=>{let{width:e,height:t,top:r,left:n,right:d}=c.current;if(s||!i.current||!e||!t)return;i.current.dataset.motionPopId=l;let u=document.createElement("style");return o&&(u.nonce=o),document.head.appendChild(u),u.sheet&&u.sheet.insertRule('\n [data-motion-pop-id="'.concat(l,'"] {\n position: absolute !important;\n width: ').concat(e,"px !important;\n height: ").concat(t,"px !important;\n ").concat("left"===a?"left: ".concat(n):"right: ".concat(d),"px !important;\n top: ").concat(r,"px !important;\n }\n ")),()=>{document.head.removeChild(u)}},[s]),(0,r.jsx)(u,{isPresent:s,childRef:i,sizeRef:c,children:n.cloneElement(t,{ref:i})})}let h=e=>{let{children:t,initial:s,isPresent:a,onExitComplete:l,custom:i,presenceAffectsLayout:d,mode:u,anchorX:h}=e,f=(0,c.M)(p),x=(0,n.useId)(),v=(0,n.useCallback)(e=>{for(let t of(f.set(e,!0),f.values()))if(!t)return;l&&l()},[f,l]),g=(0,n.useMemo)(()=>({id:x,initial:s,isPresent:a,custom:i,onExitComplete:v,register:e=>(f.set(e,!1),()=>f.delete(e))}),d?[Math.random(),v]:[a,v]);return(0,n.useMemo)(()=>{f.forEach((e,t)=>f.set(t,!1))},[a]),n.useEffect(()=>{a||f.size||!l||l()},[a]),"popLayout"===u&&(t=(0,r.jsx)(m,{isPresent:a,anchorX:h,children:t})),(0,r.jsx)(o.t.Provider,{value:g,children:t})};function p(){return new Map}var f=s(14905);let x=e=>e.key||"";function v(e){let t=[];return n.Children.forEach(e,e=>{(0,n.isValidElement)(e)&&t.push(e)}),t}var g=s(69025);let j=e=>{let{children:t,custom:s,initial:a=!0,onExitComplete:l,presenceAffectsLayout:o=!0,mode:d="sync",propagate:u=!1,anchorX:m="left"}=e,[p,j]=(0,f.xQ)(u),y=(0,n.useMemo)(()=>v(t),[t]),b=u&&!p?[]:y.map(x),N=(0,n.useRef)(!0),w=(0,n.useRef)(y),C=(0,c.M)(()=>new Map),[k,E]=(0,n.useState)(y),[P,S]=(0,n.useState)(y);(0,g.E)(()=>{N.current=!1,w.current=y;for(let e=0;e
{let t=x(e),n=(!u||!!p)&&(y===P||b.includes(t));return(0,r.jsx)(h,{isPresent:n,initial:(!N.current||!!a)&&void 0,custom:s,presenceAffectsLayout:o,mode:d,onExitComplete:n?void 0:()=>{if(!C.has(t))return;C.set(t,!0);let e=!0;C.forEach(t=>{t||(e=!1)}),e&&(null==L||L(),S(w.current),u&&(null==j||j()),l&&l())},anchorX:m,children:e},t)})})};var y=s(21061),b=s(13057),N=s(52596),w=s(14549),C=s(54353),k=s(55028),E=s(62292);let P=(0,k.default)(()=>Promise.all([s.e(5891),s.e(8787)]).then(s.bind(s,78787)).then(e=>e.Carousel),{loadableGenerated:{webpack:()=>[78787]},ssr:!1,loading:()=>(0,r.jsx)(E.A,{})}),S=(0,k.default)(()=>Promise.all([s.e(6766),s.e(5988)]).then(s.bind(s,45934)),{loadableGenerated:{webpack:()=>[45934]},ssr:!1,loading:()=>(0,r.jsx)(E.A,{})}),A=(0,k.default)(()=>Promise.all([s.e(6874),s.e(4989)]).then(s.bind(s,4989)),{loadableGenerated:{webpack:()=>[4989]},ssr:!1,loading:()=>(0,r.jsx)(E.A,{})}),L=()=>{var e;let[t,s]=n.useState(null),i=n.useRef(!1),{sources:c,selectedSource:o,setSelectedSource:d,isOpen:u,setIsOpen:m}=(0,l.g)(),{data:h,isLoading:p}=function(e){let{id:t,streamChannel:s}=e,r=n.useCallback(async()=>{let e=await fetch("".concat("https://streamed.su/api/stream","/").concat(s,"/").concat(t),{next:{revalidate:36e5}});return await e.json()},[t,s]);return(0,a.I)({queryKey:["episode",t,s],queryFn:r,staleTime:36e5,enabled:!!t&&!!s})}({id:null==o?void 0:o.id,streamChannel:null!==(e=null==o?void 0:o.source)&&void 0!==e?e:"alpha"}),{data:f,isLoading:x}=(0,C.F)({category:"live",popular:!0,enabled:!0}),{data:v,isLoading:g}=(0,C.F)({type:"sports",enabled:!0});n.useEffect(()=>{!i.current&&h&&h.length>0&&o&&(s(h[0]),i.current=!0)},[h,o]);let k=c&&0===c.sources.length||h&&0===h.length;n.useEffect(()=>{u?document.body.style.overflow="hidden":document.body.style.overflow="auto"},[u]);let L=()=>{d(void 0),s(null),i.current=!1},M=()=>{m(!1),L()};return(0,r.jsx)(j,{initial:!1,children:u?(0,r.jsx)(y.P.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex flex-col justify-end gap-4",children:(0,r.jsxs)(j,{propagate:!0,children:[(0,r.jsxs)(y.P.div,{initial:{opacity:0,y:200},animate:{opacity:1,y:0},exit:{opacity:0,y:200},className:"max-h-screen w-full space-y-8 overflow-y-auto rounded-t-3xl bg-base-300 p-4 md:p-16 md:py-10 md:scrollbar-thin",children:[k?(0,r.jsx)("div",{className:"flex h-60 w-full items-center justify-center",children:(0,r.jsx)("h1",{className:"max-w-xl text-center text-xl opacity-50",children:"No sources found."})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,r.jsxs)("div",{className:"flex h-max flex-1 flex-grow flex-wrap items-center gap-2 bg-base-300 py-4 max-sm:max-w-60 md:sticky",children:[(0,r.jsx)("p",{className:"font-semibold capitalize opacity-70 md:text-xl",children:null==c?void 0:c.category}),(0,r.jsx)("div",{className:"hidden h-1 w-1 rounded-full bg-white/50 md:block"}),(0,r.jsx)("p",{className:"truncate font-semibold opacity-70 md:text-xl",children:null==c?void 0:c.title})]}),(0,r.jsx)("button",{className:"btn btn-circle btn-primary btn-sm",onClick:M,children:(0,r.jsx)(w.SXS,{})})]}),(0,r.jsxs)("div",{className:"grid-cols-1 gap-10 md:grid-cols-4",children:[(0,r.jsx)("div",{className:"md:col-span-3",children:(0,r.jsx)("div",{className:"h-72 w-full overflow-hidden rounded-xl bg-base-100 md:h-[65vh]",children:t?(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("iframe",{title:null==o?void 0:o.id,src:t.embedUrl,allowFullScreen:!0,allow:"encrypted-media; picture-in-picture;",width:"100%",height:"100%"})}):(0,r.jsx)(b.Loading,{className:"mt-0 h-full w-full"})})}),(0,r.jsxs)("div",{className:"space-y-4 md:mt-4",children:[(0,r.jsx)("h3",{className:"section-title",children:"Servers"}),c&&c.sources.map((e,a)=>(0,r.jsxs)("div",{className:"collapse collapse-arrow bg-base-200",onClick:()=>{d(e)},children:[(0,r.jsx)("input",{type:"radio",name:"servers-accordion",defaultChecked:"alpha"===e.source}),(0,r.jsx)("div",{className:"collapse-title font-bold",children:(0,r.jsx)("span",{className:"capitalize",children:e.source})}),(0,r.jsx)("div",{className:"collapse-content",children:(null==o?void 0:o.source)===e.source&&p?(0,r.jsx)("div",{children:(0,r.jsx)(b.Loading,{className:"mt-0 h-20"})}):(0,r.jsx)("div",{className:"flex flex-col gap-4",children:(null==o?void 0:o.source)===e.source&&h&&h.map((e,a)=>(0,r.jsx)("div",{className:"group cursor-pointer",onClick:()=>{s(e)},children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("p",{className:(0,N.A)("transition-colors ease-in-out group-hover:text-primary",(null==t?void 0:t.streamNo)===e.streamNo&&t.source===e.source?"text-primary":"text-base-content"),children:"Stream ".concat(e.streamNo)}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"badge badge-info",children:e.language}),(0,r.jsx)("div",{className:"badge badge-neutral",children:e.hd?"HD":"SD"})]})]})},"stream-".concat(e.streamNo,"-").concat(a)))})})]},"source-".concat(a)))]})]})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h3",{className:"section-title",children:"Popular Live"}),x?(0,r.jsx)(E.A,{}):f&&(0,r.jsx)(P,{itemsClassName:"gap-4",children:f.filter(e=>o&&Array.isArray(e.sources)&&e.sources.some(e=>e.id!==o.id)).map((e,t)=>(0,r.jsx)(S,{data:e,onClick:L},"match-".concat(e.id,"-").concat(t)))})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h3",{className:"section-title",children:"Sports"}),g?(0,r.jsx)(E.A,{}):v&&(0,r.jsx)(P,{itemsClassName:"gap-4",children:v.map((e,t)=>(0,r.jsx)(A,{category:e},"c-".concat(e.id,"-").concat(t)))})]})]},"sport-stream-screen-content"),(0,r.jsx)(y.P.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 -z-[1] bg-black/50",onClick:M},"sport-stream-screen-overlay")]})},"sport-stream-screen"):null})}},59434:(e,t,s)=>{"use strict";s.d(t,{cn:()=>n});var r=s(52596),a=s(39688);function n(){for(var e=arguments.length,t=Array(e),s=0;s{"use strict";s.d(t,{A:()=>n});var r=s(95155),a=s(59434);let n=e=>{let{count:t,className:s}=e;return(0,r.jsx)("div",{className:(0,a.cn)("flex items-center gap-4",s),children:[...Array(null!=t?t:3)].map((e,t)=>(0,r.jsx)("div",{className:"skeleton h-32 w-60"},"wew-skele-".concat(t)))})}},80793:(e,t,s)=>{"use strict";function r(e,t,s){var r;if(e instanceof EventTarget)return[e];if("string"==typeof e){let a=document;t&&(a=t.current);let n=null!==(r=null==s?void 0:s[e])&&void 0!==r?r:a.querySelectorAll(e);return n?Array.from(n):[]}return Array.from(e)}s.d(t,{K:()=>r})},95838:(e,t,s)=>{"use strict";s.d(t,{I:()=>n});var r=s(76347),a=s(42248);function n(e,t){return(0,a.t)(e,r.$,t)}}},e=>{var t=t=>e(e.s=t);e.O(0,[2150,5242,4277,6967,4258,5557,1061,8441,1684,7358],()=>t(37035)),_N_E=e.O()}]);