"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())}),meta_exports={};__export(meta_exports,{getMeta:()=>getMeta});var kmmHeaders={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"},getMeta=__name(function(_0){return __async(this,arguments,function*({link:link,providerContext:providerContext}){var _a,_b;try{const{axios:axios,cheerio:cheerio}=providerContext;link.startsWith("http")||(link=`${yield providerContext.getBaseUrl("kmmovies")}${link.startsWith("/")?"":"/"}${link}`);const res=yield axios.get(link,{headers:kmmHeaders}),$=cheerio.load(res.data),title=$("h1, h2, .animated-text").first().text().trim()||(null==(_a=$("meta[property='og:title']").attr("content"))?void 0:_a.trim())||$("title").text().trim()||"Unknown";let image=$("div.wp-slider-container img").first().attr("src")||$("meta[property='og:image']").attr("content")||$("meta[name='twitter:image']").attr("content")||"";image&&image.startsWith("http")||(image=new URL(image||"/placeholder.png",link).href);let synopsis="";$("p").each((_,el)=>{const text=$(el).text().trim();if(text&&text.length>40&&!text.toLowerCase().includes("download")&&!text.toLowerCase().includes("quality"))return synopsis=text,!1}),synopsis||(synopsis=$("meta[property='og:description']").attr("content")||$("meta[name='description']").attr("content")||"");const tags=[];res.data.toLowerCase().includes("action")&&tags.push("Action"),res.data.toLowerCase().includes("drama")&&tags.push("Drama"),res.data.toLowerCase().includes("romance")&&tags.push("Romance"),res.data.toLowerCase().includes("thriller")&&tags.push("Thriller");const cast=[];$("p").each((_,el)=>{const text=$(el).text().trim();/starring|cast/i.test(text)&&text.split(",").forEach(name=>cast.push(name.trim()))});let rating=(null==(_b=$("p").text().match(/IMDb Rating[:\s]*([0-9.]+)/i))?void 0:_b[1])||"";rating&&!rating.includes("/")&&(rating+="/10");const imdbLink=$("p a[href*='imdb.com']").attr("href")||"",imdbId=imdbLink&&imdbLink.includes("/tt")?"tt"+imdbLink.split("/tt")[1].split("/")[0]:"",linkList=[],isSeries=$(".download-options-grid").length>0;return isSeries?$(".download-card").each((_,card)=>{const card$=$(card),quality=card$.find(".download-quality-text").text().trim(),size=card$.find(".download-size-info").text().trim()||"",href=card$.find("a.tabs-download-button").attr("href")||"";if(href){const titleText=`Download ${quality} ${size}`.trim();linkList.push({title:titleText,quality:quality||"AUTO",directLinks:[{link:href,title:titleText,type:"series"}]})}}):$("a.modern-download-button").each((_,a)=>{const quality=$(a).closest(".modern-option-card").find(".modern-badge").text().trim()||"AUTO",href=$(a).attr("href")||"",titleText=`Download ${quality}`;href&&linkList.push({title:titleText,quality:quality,directLinks:[{link:href,title:titleText,type:"movie"}]})}),{title:title,synopsis:synopsis,image:image,imdbId:imdbId,type:isSeries?"series":"movie",tags:tags,cast:cast,rating:rating,linkList:linkList}}catch(err){return console.error("KMMOVIES getMeta error:",err),{title:"",synopsis:"",image:"https://via.placeholder.com/300x450",imdbId:"",type:"movie",tags:[],cast:[],rating:"",linkList:[]}}})},"getMeta");exports.getMeta=getMeta;