"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(e,t)=>__defProp(e,"name",{value:t,configurable:!0}),__export=(e,t)=>{for(var i in t)__defProp(e,i,{get:t[i],enumerable:!0})},__copyProps=(e,t,i,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of __getOwnPropNames(t))__hasOwnProp.call(e,r)||r===i||__defProp(e,r,{get:()=>t[r],enumerable:!(n=__getOwnPropDesc(t,r))||n.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__async=(e,t,i)=>new Promise((n,r)=>{var s=e=>{try{a(i.next(e))}catch(e){r(e)}},o=e=>{try{a(i.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(s,o);a((i=i.apply(e,t)).next())}),meta_exports={};__export(meta_exports,{fetchEpisodesFromSelectedLink:()=>fetchEpisodesFromSelectedLink,getMeta:()=>getMeta});var headers={Referer:"https://google.com","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"};function fetchEpisodesFromSelectedLink(e,t){return __async(this,null,function*(){const{axios:i,cheerio:n}=t,r=yield i.get(e,{headers:headers}),s=n.load(r.data),o=[];return s("h4").each((t,i)=>{const n=s(i).text().trim();if(!n)return;const r=[];s(i).nextUntil("h4, hr").find("a[href]").each((t,i)=>{let n=(s(i).attr("href")||"").trim();if(!n)return;n.startsWith("http")||(n=new URL(n,e).href);const o=s(i).text().trim()||"Watch Episode";r.push({link:n,title:o,quality:"AUTO",type:"episode"})}),r.length>0&&o.push({title:n,directLinks:r})}),o})}__name(fetchEpisodesFromSelectedLink,"fetchEpisodesFromSelectedLink");var getMeta=__name(function(e){return __async(this,arguments,function*({link:e,providerContext:t}){var i,n;const{axios:r,cheerio:s}=t;e.startsWith("http")||(e=new URL(e,"https://vgmlinks.click").href);try{const t=yield r.get(e,{headers:headers}),o=s.load(t.data),a=o(".entry-content, .post-inner").length?o(".entry-content, .post-inner"):o("body"),l=o("h1.entry-title").first().text().trim()||(null==(i=o("meta[property='og:title']").attr("content"))?void 0:i.trim())||"Unknown",c=a.text(),d=/Season\s*\d+/i.test(c)||/Episode\s*\d+/i.test(c)?"series":"movie";let p=o(".poster img").attr("src")||o("meta[property='og:image']").attr("content")||o("meta[name='twitter:image']").attr("content")||"";p&&!p.startsWith("http")&&(p=new URL(p,e).href);let h="";o(".entry-content p").each((e,t)=>{const i=o(t).text().trim();if(i.length>40&&!i.toLowerCase().includes("download"))return h=i,!1});const m=o("a[href*='imdb.com']").attr("href")||"",u=m?"tt"+((null==(n=m.split("/tt")[1])?void 0:n.split("/")[0])||""):"",f=[];o(".entry-content p strong").each((e,t)=>{const i=o(t).text().trim();i.match(/drama|biography|action|thriller|romance|adventure|animation/i)&&f.push(i)});const g={};o("p").each((e,t)=>{var i,n,r,s,a,l;const c=o(t).html()||"";c.includes("Series Name")&&(g.name=null==(i=o(t).text().split(":")[1])?void 0:i.trim()),c.includes("Language")&&(g.language=null==(n=o(t).text().split(":")[1])?void 0:n.trim()),c.includes("Released Year")&&(g.year=null==(r=o(t).text().split(":")[1])?void 0:r.trim()),c.includes("Quality")&&(g.quality=null==(s=o(t).text().split(":")[1])?void 0:s.trim()),c.includes("Episode Size")&&(g.size=null==(a=o(t).text().split(":")[1])?void 0:a.trim()),c.includes("Format")&&(g.format=null==(l=o(t).text().split(":")[1])?void 0:l.trim())});const _=[],y=[],x=__name(e=>{const t=e.toLowerCase();return t.includes("series info")||t.includes("series name")||t.includes("language")||t.includes("released year")||t.includes("episode size")||t.includes("format")||t.includes("imdb rating")||t.includes("winding up")||t.length<5&&!/\d/.test(t)},"isInformationalHeading");return"series"===d?a.find("h3").each((e,t)=>{var i;const n=o(t).text().trim();if(x(n))return;const r=(null==(i=n.match(/\d+p/))?void 0:i[0])||"AUTO",s=o(t).nextUntil("h3, hr").find("a").filter((e,t)=>/v-cloud|mega|gdrive|download/i.test(o(t).text())).first(),a=s.attr("href");if(a){const e=s.text().trim()||"Link";if(e.toLowerCase().includes("imdb rating")||e.toLowerCase().includes("winding up"))return;_.push({title:n,quality:r,episodesLink:a})}}):a.find("h3, h5").each((t,i)=>{var n;const r=o(i).text().trim();if(x(r))return;const s=(null==(n=r.match(/\d+p/))?void 0:n[0])||"AUTO",a=o(i).nextUntil("h3, h5, hr").find("a[href]").first(),l=a.attr("href");if(l){let t=l.trim();t.startsWith("http")||(t=new URL(t,e).href);const i=a.text().trim()||"Download Link";if(i.toLowerCase().includes("imdb rating")||i.toLowerCase().includes("winding up"))return;_.push({title:r,quality:s,episodesLink:"",directLinks:[{title:i,link:t,type:"movie"}]})}}),{title:l,synopsis:h,image:p,imdbId:u,type:d,tags:f,cast:[],rating:o(".entry-meta .entry-date").text().trim()||"",linkList:_,extraInfo:g,episodeList:y}}catch(e){return{title:"",synopsis:"",image:"",imdbId:"",type:"movie",tags:[],cast:[],rating:"",linkList:[],extraInfo:{},episodeList:[]}}})},"getMeta");exports.fetchEpisodesFromSelectedLink=fetchEpisodesFromSelectedLink,exports.getMeta=getMeta;