import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{Fragment as t,jsx as n,jsxs as r}from"hono/jsx/jsx-runtime";import{load as i}from"cheerio";import{renderToString as a}from"hono/jsx/dom/server";const o=async o=>{let s=Number.parseInt(o.req.query(`limit`)??`50`,10),c=`https://coolbuy.com`,l=new URL(`api/v1.4/product_preview`,c).href,u=await e(l,{query:{order_by:`-id`,limit:s,page:0,offset:0}}),d=i(await e(c)),f=d(`html`).attr(`lang`)??`zh`,p=u.objects.slice(0,s).map(e=>{let i=e.title,o=e.cover_image?.split(/\?/)?.[0],s=[e.display_image?.split(/\?/)?.[0],o].filter(Boolean).map(e=>({src:e,alt:i})),l=a(r(t,{children:[n(`table`,{children:r(`tbody`,{children:[e.summary?r(`tr`,{children:[n(`th`,{children:`简介`}),n(`td`,{children:e.summary})]}):null,e.price?r(`tr`,{children:[n(`th`,{children:`价格`}),n(`td`,{children:e.price})]}):null,e.original_price?r(`tr`,{children:[n(`th`,{children:`原价`}),n(`td`,{children:e.original_price})]}):null,e.highest_price?r(`tr`,{children:[n(`th`,{children:`价格（最高）`}),n(`td`,{children:e.highest_price})]}):null,e.highest_original_price?r(`tr`,{children:[n(`th`,{children:`原价（最高）`}),n(`td`,{children:e.highest_original_price})]}):null]})}),s?.length?s.map(e=>e?.src?n(`figure`,{children:e.alt?n(`img`,{src:e.src,alt:e.alt}):n(`img`,{src:e.src})}):null):null]})),u=e.visit_url,d=`coolbuy-${e.id}#${e.price}`;return{title:i,description:l,link:u??new URL(e.id,c).href,guid:d,id:d,content:{html:l,text:l},image:o,banner:o,language:f}});return{title:d(`title`).text(),description:d(`meta[property="og:description"]`).attr(`content`),link:c,item:p,allowEmpty:!0,image:new URL(`static/coolbuy/packages/dongguan/dist/images/97be46f6.png`,`https://mcache.ifanr.cn`).href,language:f,id:c}},s={path:`/`,name:`产品`,url:`coolbuy.com`,maintainers:[`nczitzk`],handler:o,example:`/coolbuy`,parameters:void 0,description:void 0,categories:[`shopping`],features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportRadar:!0,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`coolbuy.com`],target:`/`}],view:0};export{o as handler,s as route};