import{t as e}from"./cache-DUthuMSu.mjs";import{t}from"./parse-date-BdYTmLpo.mjs";import{t as n}from"./got-BBDj7u1e.mjs";import{t as r}from"./timezone-keeL11Io.mjs";import{load as i}from"cheerio";const a={path:[`/zhengce/zuixin`,`/zhengce/:category{.+}?`],categories:[`government`],example:`/gov/zhengce/zuixin`,parameters:{},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`www.gov.cn/zhengce/zuixin.htm`,`www.gov.cn/`]}],name:`最新政策`,maintainers:[`SettingDust`,`nczitzk`],handler:o,url:`www.gov.cn/zhengce/zuixin.htm`};async function o(a){let{category:o=`zuixin`}=a.req.param(),s=a.req.query(`limit`)?Number.parseInt(a.req.query(`limit`),10):20,c=`https://www.gov.cn`,l=new URL(`zhengce/${o.replace(/\/$/,``)}/`,c).href,{data:u}=await n(l),d=i(u),f=d(`h4 a, div.subtitle a[title]`).toArray().map(e=>{e=d(e);let t=e.prop(`href`);return{title:e.text(),link:t.startsWith(`http`)?t:new URL(t,l).href}});f=await Promise.all(f.filter(e=>/https?:\/\/www\.gov\.cn\/zhengce.*content_\d+\.htm/.test(e.link)).slice(0,s).map(a=>e.tryGet(a.link,async()=>{let{data:e}=await n(a.link),o=i(e),s=e=>o(e).text().split(/：/).pop().trim()||o(e).next().text().trim(),c=o(`meta[name="author"]`).prop(`content`),l=o(`table.bd1`).find(`td`).toArray().findLast(e=>o(e).text().startsWith(`发文机关`)),u=o(`span.font-zyygwj`).toArray().findLast(e=>o(e).text().startsWith(`来源`)),d=o(`table.bd1`).find(`td`).toArray().findLast(e=>o(e).text().startsWith(`主题分类`)),f=l?s(l):void 0,p=u?s(u):void 0,m=d?s(d):o(`td.zcwj_ztfl`).text(),h=o(`meta[name="lanmu"]`).prop(`content`),g=o(`meta[name="keywords"]`).prop(`content`)?.split(/;|,/)??[],_=o(`meta[name="manuscriptId"]`).prop(`content`);return a.title=o(`div.share-title`).text()||a.title,a.description=o(`div.TRS_UEDITOR`).first().html()||o(`div#UCAP-CONTENT, td#UCAP-CONTENT`).first().html(),a.author=[f,p,c].filter(Boolean).join(`/`),a.category=[...new Set([m,h,...g].filter(Boolean))],a.guid=`gov-zhengce-${_}`,a.pubDate=r(t(o(`meta[name="firstpublishedtime"]`).prop(`content`),`YYYY-MM-DD-HH:mm:ss`),8),a.updated=r(t(o(`meta[name="lastmodifiedtime"]`).prop(`content`),`YYYY-MM-DD-HH:mm:ss`),8),a})));let p=new URL(d(`img.wordlogo`).prop(`src`),c).href,m=new URL(d(`link[rel="icon"]`).prop(`href`),c).href,h=d(`meta[name="lanmu"]`).prop(`content`),g=d(`div.header_logo a[aria-label]`).prop(`aria-label`);return{item:f,title:g&&h?`${g} - ${h}`:d(`title`).text(),link:l,description:d(`meta[name="description"]`).prop(`content`),language:`zh-CN`,image:p,icon:m,logo:m,subtitle:h,author:g}}export{a as route};