(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1715],{9561:function(o,e,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/download",function(){return n(69531)}])},69531:function(o,e,n){"use strict";n.r(e);var l=n(85893),a=n(67294),r=n(9008),i=n.n(r),d=n(39332),t=n(2873),s=n(40326),c=n.n(s);e.default=()=>{var o,e,n;let r=(0,d.useSearchParams)(),[s,u]=(0,a.useState)(!0),[v,_]=(0,a.useState)(""),[p,h]=(0,a.useState)(),[m,f]=(0,a.useState)(),[w,D]=(0,a.useState)(),[g,b]=(0,a.useState)(),[x,P]=(0,a.useState)(),[S,j]=(0,a.useState)(!0),[N,y]=(0,a.useState)(!0),[E,k]=(0,a.useState)([]),[L,C]=(0,a.useState)([]),[F,I]=(0,a.useState)([]),[G,T]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{u(!0),_(null==r?void 0:r.get("type")),h(null==r?void 0:r.get("id")),f(null==r?void 0:r.get("season")),D(null==r?void 0:r.get("episode"))},[r]),(0,a.useEffect)(()=>{let o=document.createElement("script");return o.src="//adbpage.com/adblock?v=3&format=js",o.async=!0,o.onload=()=>{"undefined"!=typeof aclib?"rivestream.net"===window.location.hostname?aclib.runPop({zoneId:"9582638"}):"rivestream.live"===window.location.hostname?aclib.runPop({zoneId:"8723078"}):"rivestream.pages.dev"===window.location.hostname?aclib.runPop({zoneId:"8723158"}):aclib.runPop({zoneId:"9596958"}):console.error("aclib is not defined after script load")},document.body.appendChild(o),()=>{document.body.removeChild(o)}},[r,p,m,w]),(0,a.useEffect)(()=>{let o=new AbortController,e=o.signal,n=async()=>{u(!0);try{var o;let e=await (0,t.Z)({requestID:"".concat(v,"Data"),id:p,season:m});b(e);let n=await (0,t.Z)({requestID:"".concat(v,"TorrentProvider"),id:p,season:m,episode:w,service:"movie"===v?"yts":"tvx"});P(null==n?void 0:null===(o=n.data)||void 0===o?void 0:o.sources),j(!1)}catch(o){console.error(o)}finally{u(!1)}},l=async()=>{var o,n,l,a,r,i,d,s;T(!1);let c=await (0,t.Z)({requestID:"VideoProviderServices"});if(e.aborted)return;I(null==c?void 0:null===(o=c.data)||void 0===o?void 0:o.map(o=>({name:o,status:"available"})));let u={sources:[],captions:[]};if(!e.aborted){for(let o of(null==c?void 0:c.data)||[]){if(e.aborted)return;I(e=>e.map(e=>e.name===o?{...e,status:"fetching"}:e));try{if(e.aborted)return;let n=await (0,t.Z)({requestID:"".concat(v,"VideoProvider"),id:p,season:m,episode:w,service:o});if(console.log({tempRes:n}),null==n||null===(a=n.data)||void 0===a||null===(l=a.sources)||void 0===l||l.forEach(o=>{u.sources.push(o)}),null==n||null===(i=n.data)||void 0===i||null===(r=i.captions)||void 0===r||r.forEach(o=>{u.captions.push(o)}),e.aborted||(I(e=>e.map(e=>{if(e.name===o){var l,a;return{...e,status:(null==n?void 0:null===(a=n.data)||void 0===a?void 0:null===(l=a.sources)||void 0===l?void 0:l.length)>0?"success":"error"}}return e})),e.aborted))return;if((null==n?void 0:null===(s=n.data)||void 0===s?void 0:null===(d=s.sources)||void 0===d?void 0:d.length)>0){if(e.aborted)return;k(o=>{var e;return[...o,...null==n?void 0:null===(e=n.data)||void 0===e?void 0:e.sources]}),C(o=>{var e,l;let a=Array.isArray(null==n?void 0:null===(e=n.data)||void 0===e?void 0:e.captions)?null==n?void 0:null===(l=n.data)||void 0===l?void 0:l.captions:[];return[...o,...a]}),T(!1)}}catch(n){if(e.aborted)return;console.error("Error fetching data for provider ".concat(o,":"),n),I(e=>e.map(e=>e.name===o?{...e,status:"error"}:e))}}if(!e.aborted){if((null==u?void 0:null===(n=u.sources)||void 0===n?void 0:n.length)>0){if(e.aborted)return;k(null==u?void 0:u.sources),C(null==u?void 0:u.captions),T(!1)}else{if(e.aborted)return;T(!0)}}}};return p&&(n(),l()),()=>{o.abort()}},[r,p,v,m,w]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i(),{children:(0,l.jsxs)("title",{children:["Rive | Download"," ",null!=p?"| ".concat((null==g?void 0:g.name)||(null==g?void 0:g.title)||p):null," ",null!=m?"| S".concat(m,"-E").concat(w):null]})}),(0,l.jsxs)("div",{className:"".concat(c().watch," ").concat(c().torrentWatchPage),style:{background:"".concat((null==g?void 0:g.backdrop_path)?"linear-gradient(var(--bg-gradient), var(--bg-color)), url(".concat("https://image.tmdb.org/t/p/original"+(null==g?void 0:g.backdrop_path),") no-repeat center center/cover"):"var(--bg-color)")},children:[(0,l.jsxs)("div",{className:c().header,children:[(0,l.jsxs)("h1",{children:[(null==g?void 0:g.name)||(null==g?void 0:g.title)||p," ","movie"===v&&(null==g?void 0:g.release_date)?"(".concat(null===(o=new Date(null==g?void 0:g.release_date).getFullYear())||void 0===o?void 0:o.toString(),")"):""]}),(0,l.jsxs)("p",{children:[m&&(0,l.jsxs)("span",{children:["S",m]})," ",w&&(0,l.jsxs)("span",{children:["E",m]})]})]}),(0,l.jsxs)("div",{className:c().sourceGroupDiv,children:[(0,l.jsx)("h1",{children:"Torrents"}),S&&(0,l.jsx)("div",{className:"".concat(c().sourceGroup),children:(0,l.jsx)("p",{className:"".concat(c().scanner),children:(0,l.jsx)("span",{children:"Loading.."})})}),(0,l.jsxs)("div",{className:c().sourceGroup,children:[null==x?void 0:x.map(o=>(0,l.jsxs)("a",{href:null==o?void 0:o.url,className:c().sourceLink,children:[null==o?void 0:o.name," | ",(null==o?void 0:o.quality)||"Torrent"," | ",null==o?void 0:o.type," |"," ",null==o?void 0:o.size," "]})),!S&&(!x||(null==x?void 0:x.length)===0)&&(0,l.jsx)("p",{children:"No Torrents Found"})]})]}),(0,l.jsxs)("div",{className:c().sourceGroupDiv,children:[(0,l.jsx)("h1",{children:"HLS Streams"}),(0,l.jsx)("div",{className:"".concat(c().sourceGroup),children:null!=p&&(null==F?void 0:F.find(o=>(null==o?void 0:o.status)==="fetching"))&&(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("p",{className:"".concat(c().sourceProvider),children:["Connecting to"," ",(0,l.jsx)("span",{children:null==F?void 0:null===(n=F.find(o=>(null==o?void 0:o.status)==="fetching"))||void 0===n?void 0:null===(e=n.name)||void 0===e?void 0:e.toUpperCase()})]})})}),(0,l.jsxs)("div",{className:"".concat(c().sourceGroup," ").concat(c().hls),children:[null==E?void 0:E.map(o=>(0,l.jsxs)("a",{href:(null==o?void 0:o.format)==="hls"?"https://hlsforge.com/?url=".concat(encodeURIComponent(null==o?void 0:o.url),"&id=").concat(p).concat("tv"===v?"&season=".concat(m,"&episode=").concat(w):"","&title=").concat((null==g?void 0:g.name)||(null==g?void 0:g.title),"&downloadTitle=").concat((null==g?void 0:g.name)||(null==g?void 0:g.title)).concat("movie"!==v?"-".concat(m,"-").concat(w):""):null==o?void 0:o.url,className:c().sourceLink,target:"_blank",children:[null==o?void 0:o.source," (",(null==o?void 0:o.quality)||"HLS",")"]})),G&&(!E||(null==E?void 0:E.length)==0)&&(0,l.jsx)("p",{children:"No HLS Media Found"})]})]})]})]})}},40326:function(o){o.exports={watch:"Download_watch__Vww5B",header:"Download_header__ZyIqq",sourceGroupDiv:"Download_sourceGroupDiv__kDtrV",sourceGroup:"Download_sourceGroup__swFlO",sourceLink:"Download_sourceLink__BTn4l",sourceProvider:"Download_sourceProvider__qyEkq",loader:"Download_loader__dtCc6",videoProvidersGradient:"Download_videoProvidersGradient__F4WII",videoProviders:"Download_videoProviders__DJSAg",videoProvidersList:"Download_videoProvidersList__QLoSf",videoProvidersListTop:"Download_videoProvidersListTop__txJ6c",videoProvidersListMid:"Download_videoProvidersListMid__pBBxH",videoProvider:"Download_videoProvider__bW4O3",videoProviderName:"Download_videoProviderName__zlWre",videoProviderStatus:"Download_videoProviderStatus__N45ic",available:"Download_available__VlNRq",success:"Download_success__iFc8D",error:"Download_error__O1IDM",para:"Download_para__ASgxC",para2:"Download_para2__WDr3x",nonEmbedSourcesNotFoundCnt:"Download_nonEmbedSourcesNotFoundCnt__n_3Js",fetching:"Download_fetching__EClnc",full:"Download_full__KbpFU",scanner:"Download_scanner__PLHkH",loadingText:"Download_loadingText__fBpSB",notFound:"Download_notFound___xQ7u"}}},function(o){o.O(0,[2888,9774,179],function(){return o(o.s=9561)}),_N_E=o.O()}]);