import{t as e}from"./parse-date-BdYTmLpo.mjs";import{t}from"./got-BBDj7u1e.mjs";import{t as n}from"./invalid-parameter-DLv2wPKB.mjs";import{t as r}from"./valid-host-CeDzTNj_.mjs";const i={path:`/user/:name?`,categories:[`social-media`],example:`/lofter/user/i`,view:0,parameters:{name:`Lofter user name, can be found in the URL`},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`User`,maintainers:[`hondajojo`,`nczitzk`,`LucunJi`],handler:a};async function a(i){let a=i.req.param(`name`)??`i`,o=i.req.query(`limit`)?Number.parseInt(i.req.query(`limit`)):`50`;if(!r(a))throw new n(`Invalid name`);let s=`${a}.lofter.com`,c=await t({method:`post`,url:`http://api.lofter.com/v2.0/blogHomePage.api?product=lofter-iphone-10.0.0`,body:new URLSearchParams({blogdomain:s,checkpwd:`1`,following:`0`,limit:o,method:`getPostLists`,needgetpoststat:`1`,offset:`0`,postdigestnew:`1`,supportposttypes:`1,2,3,4,5,6`})});if(!c.data.response||c.data.response.posts.length===0)throw Error(`Blog Not Found`);let l=c.data.response.posts.map(t=>({title:t.post.title||t.post.noticeLinkTitle,link:t.post.blogPageUrl,description:JSON.parse(t.post.photoLinks||`[]`).map(e=>(e.raw?.match(/\/\/nos\.netease\.com\//)&&(e.raw=`https://${e.raw.match(/(imglf\d)/)[0]}.lf127.net${e.raw.match(/\/\/nos\.netease\.com\/imglf\d(.*)/)[1]}`),`<img src="${e.raw||e.orign}">`)).join(``)+JSON.parse(t.post.embed?`[${t.post.embed}]`:`[]`).map(e=>`<video src="${e.originUrl}" poster="${e.video_img_url}" controls="controls"></video>`).join(``)+t.post.content,pubDate:e(t.post.publishTime),author:t.post.blogInfo.blogNickName,category:t.post.tag.split(`,`)}));return{title:`${l[0].author} | LOFTER`,link:`https://${s}`,item:l,description:c.data.response.posts[0].post.blogInfo.selfIntro}}export{i as route};