"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())}),posts_exports={};__export(posts_exports,{getPosts:()=>getPosts,getSearchPosts:()=>getSearchPosts});var defaultHeaders={Referer:"https://www.google.com","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36",Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language":"en-US,en;q=0.9",Pragma:"no-cache","Cache-Control":"no-cache"};function getPosts(_0){return __async(this,arguments,function*({filter:filter,page:page=1,signal:signal,providerContext:providerContext}){return fetchPosts({filter:filter,page:page,query:"",signal:signal,providerContext:providerContext})})}function getSearchPosts(_0){return __async(this,arguments,function*({searchQuery:searchQuery,page:page=1,signal:signal,providerContext:providerContext}){return fetchPosts({filter:"",page:page,query:searchQuery,signal:signal,providerContext:providerContext})})}function fetchPosts(_0){return __async(this,arguments,function*({filter:filter,query:query,page:page=1,signal:signal,providerContext:providerContext}){try{const baseUrl="https://ogomovies.mobi";let url;if(query&&query.trim()){const encodedQuery=encodeURIComponent(query.trim());url=page>1?`${baseUrl}/search-query/${encodedQuery}/page/${page}/`:`${baseUrl}/search-query/${encodedQuery}/`}else url=filter?filter.startsWith("/")?`${baseUrl}${filter.replace(/\/$/,"")}${page>1?`/page/${page}`:""}`:`${baseUrl}/${filter}${page>1?`/page/${page}`:""}`:`${baseUrl}${page>1?`/page/${page}`:""}`;const{axios:axios,cheerio:cheerio}=providerContext,res=yield axios.get(url,{headers:defaultHeaders,signal:signal}),$=cheerio.load(res.data||""),resolveUrl=__name(href=>(null==href?void 0:href.startsWith("http"))?href:new URL(href,baseUrl).href,"resolveUrl"),seen=new Set,catalog=[];return $(".ml-item").each((_,el)=>{var _a;const anchor=$(el).find("a.ml-mask");let link=anchor.attr("href")||"";if(!link)return;if(link=resolveUrl(link),seen.has(link))return;const title=(null==(_a=anchor.attr("title"))?void 0:_a.trim())||anchor.find("h2").text().trim()||"";let img=anchor.find("img").attr("data-original")||anchor.find("img").attr("src")||"";const image=img?resolveUrl(img):"";title&&image&&(seen.add(link),catalog.push({title:title,link:link,image:image}))}),catalog.slice(0,100)}catch(err){return console.error("fetchPosts error:",err instanceof Error?err.message:String(err)),[]}})}__name(getPosts,"getPosts"),__name(getSearchPosts,"getSearchPosts"),__name(fetchPosts,"fetchPosts"),exports.getPosts=getPosts,exports.getSearchPosts=getSearchPosts;