"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(target,value)=>__defProp(target,"name",{value:value,configurable:!0}),__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),__async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())}),episodes_exports={};__export(episodes_exports,{extractKmhdLink:()=>extractKmhdLink,getEpisodes:()=>getEpisodes});var getEpisodes=__name(function(_0){return __async(this,arguments,function*({url:url,providerContext:providerContext}){var _a;const{axios:axios,cheerio:cheerio}=providerContext,episodesLink=[];try{if(url.includes("gdflix")){const baseUrl=null==(_a=url.split("/pack"))?void 0:_a[0],data=(yield axios.get(url)).data,$2=cheerio.load(data),links2=$2(".list-group-item");if(null==links2||links2.map((i,link)=>{episodesLink.push({title:$2(link).text()||"",link:baseUrl+$2(link).find("a").attr("href")||""})}),episodesLink.length>0)return episodesLink}if(url.includes("/pack")){const epIds=yield extractKmhdEpisodes(url,providerContext);null==epIds||epIds.forEach((id,index)=>{episodesLink.push({title:`Episode ${index+1}`,link:url.split("/pack")[0]+"/file/"+id})})}const episodeData=(yield axios.get(url,{headers:{Cookie:"_ga_GNR438JY8N=GS1.1.1722240350.5.0.1722240350.0.0.0; _ga=GA1.1.372196696.1722150754; unlocked=true"}})).data,$=cheerio.load(episodeData),links=$(".autohyperlink");return null==links||links.map((i,link)=>{episodesLink.push({title:$(link).parent().children().remove().end().text()||"",link:$(link).attr("href")||""})}),episodesLink}catch(err){return console.error(err),[]}})},"getEpisodes");function extractKmhdLink(katlink,providerContext){return __async(this,null,function*(){const{axios:axios}=providerContext,data=(yield axios.get(katlink)).data,hubDriveRes=data.match(/hubdrive_res:\s*"([^"]+)"/)[1];return data.match(/hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/)[1]+hubDriveRes})}function extractKmhdEpisodes(katlink,providerContext){return __async(this,null,function*(){const{axios:axios}=providerContext;return(yield axios.get(katlink)).data.match(/[\w]+_[a-f0-9]{8}/g)})}__name(extractKmhdLink,"extractKmhdLink"),__name(extractKmhdEpisodes,"extractKmhdEpisodes"),exports.extractKmhdLink=extractKmhdLink,exports.getEpisodes=getEpisodes;