import{t as e}from"./parse-date-BdYTmLpo.mjs";import{t}from"./got-BBDj7u1e.mjs";import{load as n}from"cheerio";import{SourceMapConsumer as r}from"source-map";const i={path:`/essay`,categories:[`blog`],example:`/kunchengblog/essay`,parameters:{},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`kunchengblog.com/essay`]}],name:`Essay`,maintainers:[`nczitzk`],handler:a,url:`kunchengblog.com/essay`};async function a(i){let a=i.req.query(`limit`)?Number.parseInt(i.req.query(`limit`),10):100,o=`https://www.kunchengblog.com`,s=new URL(`essay`,o).href,{data:c}=await t(s),l=n(c),u=l(`title`).text(),d=new URL(`${l(`script`).first().prop(`src`)}.map`,o).href,{data:f}=await t(d),p=await r.with(f,null,t=>t.sources.filter(e=>/routes\/essays/.test(e)).toReversed().slice(0,a).map(r=>{let i=n(t.sourceContentFor(r).replaceAll(/\s\n/g,``).replaceAll(/(\w+)={+([^{}]+)}+/g,(e,t,n)=>`${t}="${n.slice(1,-1).replaceAll(`"`,`'`).trim()}"`));return{title:i(`title`).text(),pubDate:e(i(`p[className="App-essay-article"]`).last().find(`b`).first().text(),`MMM YYYY`),link:new URL(`essay/${r.match(/\/(\w+)\.js/)[1].toLowerCase()}`,s).href,description:i(`p[className="App-essay-article"]`).toArray().map(e=>i(e).html()).join(``),author:u}})),m=l(`meta[name="description"]`).prop(`content`),h=new URL(l(`link[rel="icon"]`).prop(`href`),o).href;return{item:p,title:`${u} - Essay`,link:s,description:m,language:l(`html`).prop(`lang`),image:h,icon:h,logo:h,subtitle:m,author:u,allowEmpty:!0}}export{i as route};