1import{c as e,l as t,o as n,s as r}from"./apiResponse-C8fEm_-L.js";import{_ as i,o as a}from"./commentApi-CZfXaEOY.js";import{a as o,o as s}from"./blogMeta-BvgcPzkT.js";import{i as c,n as l,r as u,t as d}from"./blogEmbed-C2PhCk_j.js";function f(e,t=!1){let n=a(e),r=t||!Array.isArray(e.child_comments)?void 0:e.child_comments.map(e=>f(e,!0));return{bcid:String(e.bcid),parentBcid:String(e.parent_bcid),uid:String(e.uid),content:e.content,time:e.time,childCommentNum:Number(e.child_comment_num)||0,childComments:r,ifMyComment:!!e.if_my_comment,username:e.username,honour:e.honour,avatarUrl:e.avatar_url,isPinned:n.isPinned,pinOrder:n.pinOrder}}function p(e){if(e.bid==null)return null;let t=e.channel_detail,n=null;t&&Number(t.channel_id)>0&&(n={channelId:Number(t.channel_id),channelName:String(t.channel_name??``),channelTitle:String(t.channel_title??``),channelDescription:t.channel_description?String(t.channel_description):void 0,channelCoverUrl:t.channel_cover_url?String(t.channel_cover_url):void 0});let r=u(e.attached_vid),i=c(e.forward_bid);return{bid:String(e.bid),uid:String(e.uid),title:String(e.title??``),content:String(e.content??``),time:String(e.time??``),likeCount:Number(e.like_count)||0,favoriteCount:Number(e.favorite_count)||0,viewCount:Number(e.view_count)||0,avatarUrl:String(e.avatar_url??``),username:e.username?String(e.username):void 0,commentCount:Number(e.comment_count)||0,parentCommentCount:Number(e.parent_comment_count??e.comment_count)||0,ifLike:!!e.if_like,ifFavorite:!!e.if_favorite,thumbnails:Array.isArray(e.thumbnails)?e.thumbnails.map(String):[],attachedVid:r,attachedVideo:r?d(e.attached_video):null,forwardBid:i,forward:i>0?l(e.forward):null,channelDetail:n,tags:o(e.tag),isGore:s(e.is_gore),auditStatus:e.audit_status==null?void 0:Number(e.audit_status)}}function m(e){if(!e||typeof e!=`object`)return null;let t=e;return t.status===`error`?null:Array.isArray(t.blog_list)&&t.blog_list.length>0?p(t.blog_list[0]):t.bid==null?null:p(t)}function h(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.status===`error`)return null;let n=typeof t.collection==`string`?t.collection:``,r=Array.isArray(t.blog_list)?t.blog_list:[];return!n||r.length===0?null:{name:n,items:r.map(e=>{let t=e;return{bid:String(t.bid),title:String(t.title??``),time:t.time?String(t.time):void 0,likeCount:t.like_count==null?void 0:Number(t.like_count),favoriteCount:t.favorite_count==null?void 0:Number(t.favorite_count),viewCount:t.view_count==null?void 0:Number(t.view_count)}})}}async function g(e,n){let r=t(`/api/blog/${encodeURIComponent(e)}/detail`,{token:n||void 0}),a=await i(r,{cache:n?`no-store`:`default`});if(a&&typeof a==`object`&&a.status===`error`){let e=a,t=String(e.message||``);return e.error_bid||t.includes(`error_bid`)?{ok:!1,reason:`not_found`}:t.toLowerCase().includes(`too_many_request`)||t.toLowerCase().includes(`too many request`)?{ok:!1,reason:`too_many_request`,message:t||`访é®é¢çè¿é«`}:{ok:!1,reason:`error`,message:t||`è·åå¨æè¯¦æ
失败`}}let o=m(a);if(!o){let e=a&&typeof a==`object`?a:null;return{ok:!1,reason:`error`,message:(e?.message?String(e.message):null)||`è·åå¨æè¯¦æ
失败`}}return{ok:!0,detail:o}}async function _(e){try{let r=t(`/api/collection/blogs/${encodeURIComponent(e)}/collection`),i=await fetch(r,{cache:`default`}),a=await n(i);return!i.ok&&!a?null:h(a)}catch{return null}}async function v(t,i){let a=await fetch(`${e}/api/blog/like/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:i}),cache:`no-store`}),o=await n(a);if(r(a,o))return null;let s=o,c=s.data,l=c&&typeof c==`object`?c:s;return{ifLike:!!l.if_like,likeCount:Number(l.like_count)||0}}async function y(t,i){let a=await fetch(`${e}/api/blog/favorite/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:i}),cache:`no-store`}),o=await n(a);if(r(a,o))return null;let s=o,c=s.data,l=c&&typeof c==`object`?c:s;return{ifFavorite:!!l.if_favorite,favoriteCount:Number(l.favorite_count)||0}}async function b(t,i,a){let o=await fetch(`${e}/api/moderation/blogs/${encodeURIComponent(t)}/report`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:i,reason:a}),cache:`no-store`}),s=await n(o);return!r(o,s)}async function x(t,i,a){let o=await fetch(`${e}/api/moderation/blog-comments/${encodeURIComponent(t)}/report`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:i,reason:a}),cache:`no-store`}),s=await n(o);return!r(o,s)}export{x as a,b as i,g as n,y as o,f as r,v as s,_ as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.