import{t as e}from"./cache-DUthuMSu.mjs";import{t}from"./got-BBDj7u1e.mjs";import{n,r,t as i}from"./utils-DrF58ByG.mjs";const a={path:[`/`,`/category/:category`],radar:[{source:[`www.4gamers.com.tw/news`,`www.4gamers.com.tw/`],target:``}],name:`Unknown`,maintainers:[`TonyRL`],handler:o,url:`www.4gamers.com.tw/news`};async function o(a){let o=a.req.param(`category`),s=a.req.query(`limit`)?Number.parseInt(a.req.query(`limit`)):25,c=!o,{data:l}=await t(`https://www.4gamers.com.tw/site/api/news/${c?`latest`:`by-category/${o}`}`,{searchParams:{nextStart:0,pageSize:s}}),u=r(l.data.results),d=await Promise.all(u.map(t=>e.tryGet(t.link,()=>n(t)))),f=`最新消息`;return c||(f=(await i(e.tryGet)).find(e=>e.id===Number.parseInt(o)).name),{title:`4Gamers - ${f}`,link:`https://www.4gamers.com.tw/news${c?``:`/category/${o}/${f}`}`,item:d}}export{a as route};