import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{t}from"./cache-DUthuMSu.mjs";import{Fragment as n,jsx as r,jsxs as i}from"hono/jsx/jsx-runtime";import a from"dayjs";import{renderToString as o}from"hono/jsx/dom/server";import s from"dayjs/plugin/localizedFormat.js";import"dayjs/locale/zh-cn.js";import c from"dayjs/plugin/timezone.js";import l from"dayjs/plugin/utc.js";a.extend(s),a.extend(c),a.extend(l);const u=async()=>(await e(`https://m.mi.com/v1/crowd/crowd_home`,{headers:{referer:`https://m.mi.com/`},method:`POST`})).data.list,d=n=>t.tryGet(`mi:crowdfunding:${n.project_id}`,async()=>{let t=await e(`https://m.mi.com/v1/crowd/crowd_detail`,{headers:{referer:`https://m.mi.com/crowdfunding/home`},method:`POST`,query:{project_id:n.project_id}});return t.data.crowd_funding_info.product_market_price===void 0&&(t.data.crowd_funding_info.product_market_price=n.product_market_price),t.data.crowd_funding_info.start_time_desc===void 0&&(t.data.crowd_funding_info.start_time_desc=m(t.data.crowd_funding_info.start_time)),t.data.crowd_funding_info.end_time_desc===void 0&&(t.data.crowd_funding_info.end_time_desc=m(t.data.crowd_funding_info.end_time)),t.data.crowd_funding_info}),f=({item:e})=>i(n,{children:[r(`img`,{src:e.big_image}),r(`br`,{}),e.project_name,r(`br`,{}),e.project_desc,r(`br`,{}),`众筹价：`,e.price,` 元，建议零售价：`,e.product_market_price,` 元`,r(`br`,{}),`众筹开始：`,e.start_time_desc,`，众筹结束：`,e.end_time_desc,r(`br`,{}),`物流：`,e.send_info,r(`br`,{}),r(`table`,{children:i(`tbody`,{children:[i(`tr`,{children:[r(`th`,{children:`档位`}),r(`th`,{children:`价格`}),r(`th`,{children:`描述`})]}),e.support_list.map((e,t)=>i(`tr`,{children:[r(`td`,{children:e.name}),i(`td`,{children:[e.price,` 元`]}),r(`td`,{children:e.support_desc})]},`${e.name}-${t}`))]})})]}),p=e=>o(r(f,{item:e})),m=e=>a.unix(e).tz(`Asia/Shanghai`).locale(`zh-cn`).format(`lll`);var h={getCrowdfundingList:u,getCrowdfundingItem:d,renderCrowdfunding:p};const g={path:`/crowdfunding`,categories:[`shopping`],example:`/mi/crowdfunding`,name:`小米众筹`,maintainers:[`DIYgod`,`nuomi1`],handler:y,features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportRadar:!0,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`m.mi.com/crowdfunding/home`],target:`/crowdfunding`}],view:5},_=async e=>{let t=e.flatMap(e=>e.items.map(e=>h.getCrowdfundingItem(e)));return await Promise.all(t)},v=e=>({title:e.project_name,description:h.renderCrowdfunding(e),link:`https://m.mi.com/crowdfunding/proddetail/${e.project_id}`,image:e.big_image,language:`zh-cn`});async function y(){return{title:`小米众筹`,link:`https://m.mi.com/crowdfunding/home`,item:(await _(await h.getCrowdfundingList())).map(e=>v(e)),allowEmpty:!0,image:`https://m.mi.com/static/img/icons/apple-touch-icon-152x152.png`,language:`zh-cn`}}export{g as route};