import{t as e}from"./cache-DUthuMSu.mjs";import{t}from"./got-BBDj7u1e.mjs";import{n,r,t as i}from"./utils-Bn_I3Ssm.mjs";import{load as a}from"cheerio";const o={path:`/topic/:topic`,categories:[`social-media`],view:1,example:`/plurk/topic/standwithukraine`,parameters:{topic:`Topic ID, can be found in URL`},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`plurk.com/topic/:topic`]}],name:`Topic`,maintainers:[`TonyRL`],handler:s};async function s(o){let s=o.req.param(`topic`),{data:c}=await t(`${i}/topic/${s}`),{data:l}=await t(`${i}/topic/getPlurks`,{searchParams:{topic:s,offset:0,limit:o.req.query(`limit`)?Number(o.req.query(`limit`)):30}}),u=a(c);delete l.pids,delete l.count;let d=await n(Object.values(l).map(e=>e.user_id)),f=await Promise.all(Object.values(l).map(t=>r(`plurk:${t.plurk_id}`,t,d[t.user_id].display_name,e.tryGet)));return{title:u(`head title`).text(),description:u(`meta[property=og:description]`).attr(`content`),image:u(`meta[property=og:image]`).attr(`content`)||u(`meta[name=msapplication-TileImage]`).attr(`content`),link:`${i}/topic/${s}`,item:f}}export{o as route};