import{t as e}from"./cache-DUthuMSu.mjs";import{t}from"./parse-date-BdYTmLpo.mjs";import{i as n}from"./common-utils-B6fqqa3X.mjs";import{t as r}from"./got-BBDj7u1e.mjs";import{Fragment as i,jsx as a,jsxs as o}from"hono/jsx/jsx-runtime";import{load as s}from"cheerio";import{renderToString as c}from"hono/jsx/dom/server";import{raw as l}from"hono/html";const u=({image:e,description:t})=>o(i,{children:[e?a(`img`,{src:e}):null,t?l(t):null]}),d=e=>c(a(u,{...e})),f={path:`*`,name:`Unknown`,maintainers:[],handler:p};async function p(i){let a=`https://www.thenewslens.com${n(i)===`/`?`/latest-article`:n(i)}`,o=s((await r({method:`get`,url:a})).data);o(`h1.title`).remove();let c=o(`.regular-article-list, #list-container, .list-container`).find(`.article-title, .title`).find(`a`).slice(0,i.req.query(`limit`)?Number.parseInt(i.req.query(`limit`)):25).toArray().map(e=>{e=o(e);let t=e.attr(`href`);return{title:e.text(),link:/\/article\//.test(t)?`${t}/fullpage`:t}});return c=await Promise.all(c.map(n=>e.tryGet(n.link,async()=>{let e=s((await r({method:`get`,url:n.link})).data);return e(`#salon_comment_widget-anchor`).remove(),e(`ad2-recommender, footer, noscript`).remove(),e(`a[data-sk="tooltip_parent"]`).parent().remove(),e(`.ad-section, .recommender-title, .navigation-content`).remove(),e(`.article-img-container`).each(function(){e(this).replaceWith(d({image:e(this).find(`img`)?.attr(`data-srcset`).split(`?`)[0]??void 0}))}),n.author=e(`meta[property="article:author"]`).attr(`content`),n.pubDate=t(e(`meta[property="article:published_time"]`).attr(`content`)),n.category=e(`meta[property="article:tag"]`).toArray().map(t=>e(t).attr(`content`)),n.description=d({image:e(`meta[property="og:image"]`)?.attr(`content`).split(`?`)[0]??void 0,description:e(`.article-main-box, article[itemprop="articleBody"]`).html()}),n}))),{title:o(`title`).text(),link:a,item:c}}export{f as route};