"use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,o){return new(i||(i=Promise))(function(a,n){function s(e){try{c(o.next(e))}catch(e){n(e)}}function r(e){try{c(o.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}c((o=o.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSearchPosts=exports.getPosts=void 0;const headers={Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","Cache-Control":"no-store","Accept-Language":"en-US,en;q=0.9",DNT:"1","sec-ch-ua":'"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1",Cookie:"_lscache_vary=62abf8b96599676eb8ec211cffaeb8ff; ext_name=ojplmecpdpgccookcobabopnaifgidhf; cf_clearance=n4Y1XTKZ5TfIMBNQuAXzerwKpx0U35KoOm3imfT0GpU-1732097818-1.2.1.1-ZeAnEu.8D9TSZHYDoj7vwo1A1rpdKl304ZpaBn_QbAQOr211JFAb7.JRQU3EL2eIy1Dfl8HhYvH7_259.22lUz8gbchHcQ8hvfuQXMtFMCbqDBLzjNUZa9stuk.39l28IcPhH9Z2szsf3SGtNI1sAfo66Djt7sOReLK3lHw9UkJp7BdGqt6a2X9qAc8EsAI3lE480Tmt0fkHv14Oc30LSbPB_WwFmiqAki2W.Gv9hV7TN_QBFESleTDlXd.6KGflfd4.KwWF7rpSRo_cgoc9ALLLIafpxHVbe7_g5r7zvpml_Pj8fEL75fw.1GBuy16bciHBuB8s_kahuJYUnhtQFFgfTQl8_Gn6KeovBWx.PJ7nFv5sklHUfAyBVq3t30xKe8ZDydsQ_G.yipfj_In5GmmWcXGb6E4.bioDOwW_sKLtxwdTQt7Nu.RkILX_mKvXNpyLqflIVj8G7X5E8I.unw","Upgrade-Insecure-Requests":"1","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 Edg/131.0.0.0"},getPosts=e=>__awaiter(void 0,[e],void 0,function*({filter:e,page:t,providerValue:i,signal:o,providerContext:a}){const{getBaseUrl:n,axios:s,cheerio:r}=a,c=yield n("Vega");return posts(c,`${c}/${e}/page/${t}/`,o,headers,s,r)});exports.getPosts=getPosts;const getSearchPosts=e=>__awaiter(void 0,[e],void 0,function*({searchQuery:e,page:t,providerValue:i,signal:o,providerContext:a}){const{getBaseUrl:n,axios:s,commonHeaders:r,cheerio:c}=a,l=yield n("Vega");return posts(l,`${l}/page/${t}/?s=${e}`,o,r,s,c)});function posts(e,t,i){return __awaiter(this,arguments,void 0,function*(e,t,i,o={},a,n){var s,r;try{const c=yield a.get(t,{headers:Object.assign(Object.assign({},o),{Referer:e}),signal:i}),l=n.load(c.data),d=[];return null===(r=null===(s=l(".blog-items,.post-list"))||void 0===s?void 0:s.children("article"))||void 0===r||r.each((e,t)=>{var i,o,a,n,s,r,c,v,u,p,f,g;const h={title:((null===(s=null===(n=null===(a=null===(o=null===(i=l(t))||void 0===i?void 0:i.find("a"))||void 0===o?void 0:o.attr("title"))||void 0===a?void 0:a.replace("Download",""))||void 0===n?void 0:n.match(/^(.*?)\s*\((\d{4})\)|^(.*?)\s*\((Season \d+)\)/))||void 0===s?void 0:s[0])||(null===(v=null===(c=null===(r=l(t))||void 0===r?void 0:r.find("a"))||void 0===c?void 0:c.attr("title"))||void 0===v?void 0:v.replace("Download",""))||(null===(p=null===(u=l(t))||void 0===u?void 0:u.find(".post-title").text())||void 0===p?void 0:p.replace("Download",""))||"").trim(),link:(null===(g=null===(f=l(t))||void 0===f?void 0:f.find("a"))||void 0===g?void 0:g.attr("href"))||"",image:l(t).find("a").find("img").attr("data-lazy-src")||l(t).find("a").find("img").attr("data-src")||l(t).find("a").find("img").attr("src")||""};h.image.startsWith("//")&&(h.image="https:"+h.image),d.push(h)}),d}catch(e){return[]}})}exports.getSearchPosts=getSearchPosts;