import{d as G,r as u,_ as de,o as n,c as r,a as d,L as t,Y as a,e as x,M as I,K as z,O as i,U as e,Z as D,n as se,a3 as Te,F as oe,$ as ne,j as me,a4 as fe,a5 as ge,H as Ue,w as ze}from"./@vue-f70ab1bd.js";import{u as Z}from"./vuex-cc1858c6.js";import{f as ae}from"./formatTime-000dbebb.js";import{t as Pe,d as Re,e as Se,_ as W,f as Le,h as Ae,i as Me,j as Oe,g as De,k as qe,l as Ee,m as Be,n as je,o as Ne,s as He,v as Ve,p as Fe,q as Ye,r as Ke,u as Je}from"./index-4c6fee52.js";import{Y as le,V as Q}from"./IEnum-a180d93e.js";import{T as ye,e as ie,f as ke,g as ce,h as we,I as Ge,i as Qe,j as Ze,k as We,l as Xe,m as et,n as tt,o as st}from"./@vicons-477062ff.js";import{j as X,e as ee,J as be,b as ot,K as nt,o as ve,L as $e,v as at,w as lt,x as it,y as ct,z as ut,B as rt,M as _t,O as pt,i as dt,P as mt,a as vt,F as ht,I as ft,k as gt,H as yt,f as kt,g as wt}from"./naive-ui-f5d716a8.js";import{p as he,_ as Ce,a as bt,b as $t,c as Ct}from"./content-1b847a5c.js";import{u as xe,b as xt}from"./vue-router-29025daf.js";import{_ as It}from"./post-skeleton-e325d641.js";import{l as Tt}from"./lodash-3329902d.js";import{a as Ut}from"./copy-to-clipboard-ca358197.js";import{_ as zt}from"./main-nav.vue_vue_type_style_index_0_lang-6ebbfbfb.js";import"./moment-b7869f98.js";import"./axios-707ed124.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-804c4158.js";import"./evtd-b614532e.js";import"./@css-render-66126308.js";import"./vooks-dfdd6eef.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./nonesir-video-29a967e9.js";import"./toggle-selection-93f4ad84.js";const Pt={class:"reply-item"},Rt={class:"header-wrap"},St={class:"username"},Lt={class:"reply-name"},At={class:"timestamp"},Mt={class:"base-wrap"},Ot={class:"content"},Dt={class:"reply-switch"},qt={class:"time-item"},Et={class:"actions"},Bt={class:"upvote-count"},jt=["onClick"],Nt={class:"upvote-count"},Ht={key:2,class:"action-item"},Vt=["onClick"],Ft=G({__name:"reply-item",props:{tweetId:null,reply:null},emits:["focusReply","reload"],setup(L,{emit:A}){const l=L,c=Z(),g=u(l.reply.is_thumbs_up==le.YES),y=u(l.reply.is_thumbs_down==le.YES),k=u(l.reply.thumbs_up_count),P=()=>{Pe({tweet_id:l.tweetId,comment_id:l.reply.comment_id,reply_id:l.reply.id}).then(h=>{g.value=!g.value,g.value?(k.value++,y.value=!1):k.value--}).catch(h=>{console.log(h)})},_=()=>{Re({tweet_id:l.tweetId,comment_id:l.reply.comment_id,reply_id:l.reply.id}).then(h=>{y.value=!y.value,y.value&&g.value&&(k.value--,g.value=!1)}).catch(h=>{console.log(h)})},T=()=>{A("focusReply",l.reply)},C=()=>{Se({id:l.reply.id}).then(h=>{window.$message.success("删除成功"),setTimeout(()=>{A("reload")},50)}).catch(h=>{console.log(h)})};return(h,U)=>{const s=de("router-link"),w=X,$=ee,m=be;return n(),r("div",Pt,[d("div",Rt,[d("div",St,[t(s,{class:"user-link",to:{name:"user",query:{username:l.reply.user.username}}},{default:a(()=>[x(I(l.reply.user.username),1)]),_:1},8,["to"]),d("span",Lt,I(l.reply.at_user_id>0?"回复":":"),1),l.reply.at_user_id>0?(n(),z(s,{key:0,class:"user-link",to:{name:"user",query:{username:l.reply.at_user.username}}},{default:a(()=>[x(I(l.reply.at_user.username),1)]),_:1},8,["to"])):i("",!0)]),d("div",At,[x(I(l.reply.ip_loc)+" ",1),e(c).state.userInfo.is_admin||e(c).state.userInfo.id===l.reply.user.id?(n(),z(m,{key:0,"negative-text":"取消","positive-text":"确认",onPositiveClick:C},{trigger:a(()=>[t($,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:a(()=>[t(w,null,{default:a(()=>[t(e(ye))]),_:1})]),_:1})]),default:a(()=>[x(" 是否确认删除? ")]),_:1})):i("",!0)])]),d("div",Mt,[d("div",Ot,I(l.reply.content),1),d("div",Dt,[d("span",qt,I(e(ae)(l.reply.created_on)),1),d("div",Et,[e(c).state.userLogined?i("",!0):(n(),r("div",{key:0,class:"action-item",onClick:U[0]||(U[0]=D(()=>{},["stop"]))},[t(w,{size:"medium"},{default:a(()=>[t(e(ie))]),_:1}),d("span",Bt,I(k.value),1)])),e(c).state.userLogined?(n(),r("div",{key:1,class:"action-item hover",onClick:D(P,["stop"])},[t(w,{size:"medium"},{default:a(()=>[g.value?i("",!0):(n(),z(e(ie),{key:0})),g.value?(n(),z(e(ke),{key:1,class:"show"})):i("",!0)]),_:1}),d("span",Nt,I(k.value),1)],8,jt)):i("",!0),e(c).state.userLogined?i("",!0):(n(),r("div",Ht,[t(w,{size:"medium"},{default:a(()=>[t(e(ce))]),_:1})])),e(c).state.userLogined?(n(),r("div",{key:3,class:"action-item hover",onClick:D(_,["stop"])},[t(w,{size:"medium"},{default:a(()=>[y.value?i("",!0):(n(),z(e(ce),{key:0})),y.value?(n(),z(e(we),{key:1,class:"show"})):i("",!0)]),_:1})],8,Vt)):i("",!0),e(c).state.userLogined?(n(),r("span",{key:4,class:"show opacity-item reply-btn",onClick:T}," 回复 ")):i("",!0)])])])])}}});const Yt=W(Ft,[["__scopeId","data-v-954cc779"]]),Kt={class:"reply-compose-wrap"},Jt={class:"reply-switch"},Gt={class:"time-item"},Qt={class:"actions"},Zt={key:0,class:"action-item"},Wt={class:"upvote-count"},Xt=["onClick"],es={class:"upvote-count"},ts={key:2,class:"action-item"},ss=["onClick"],os={key:0,class:"reply-input-wrap"},ns=G({__name:"compose-reply",props:{comment:null,atUserid:{default:0},atUsername:{default:""}},emits:["reload","reset"],setup(L,{expose:A,emit:l}){const c=L,g=Z(),y=u(),k=u(!1),P=u(""),_=u(!1),T=u(c.comment.is_thumbs_up==le.YES),C=u(c.comment.is_thumbs_down==le.YES),h=u(c.comment.thumbs_up_count),U=()=>{Le({tweet_id:c.comment.post_id,comment_id:c.comment.id}).then(m=>{T.value=!T.value,T.value?(h.value++,C.value=!1):h.value--}).catch(m=>{console.log(m)})},s=()=>{Ae({tweet_id:c.comment.post_id,comment_id:c.comment.id}).then(m=>{C.value=!C.value,C.value&&T.value&&(h.value--,T.value=!1)}).catch(m=>{console.log(m)})},w=m=>{k.value=m,m?setTimeout(()=>{var b;(b=y.value)==null||b.focus()},10):(_.value=!1,P.value="",l("reset"))},$=()=>{_.value=!0,Me({comment_id:c.comment.id,at_user_id:c.atUserid,content:P.value}).then(m=>{w(!1),window.$message.success("评论成功"),l("reload")}).catch(m=>{_.value=!1})};return A({switchReply:w}),(m,b)=>{const O=X,N=ot,B=ee,H=nt;return n(),r("div",Kt,[d("div",Jt,[d("span",Gt,I(e(ae)(L.comment.created_on)),1),d("div",Qt,[e(g).state.userLogined?i("",!0):(n(),r("div",Zt,[t(O,{size:"medium"},{default:a(()=>[t(e(ie))]),_:1}),d("span",Wt,I(h.value),1)])),e(g).state.userLogined?(n(),r("div",{key:1,class:"action-item hover",onClick:D(U,["stop"])},[t(O,{size:"medium"},{default:a(()=>[T.value?i("",!0):(n(),z(e(ie),{key:0})),T.value?(n(),z(e(ke),{key:1,class:"show"})):i("",!0)]),_:1}),d("span",es,I(h.value),1)],8,Xt)):i("",!0),e(g).state.userLogined?i("",!0):(n(),r("div",ts,[t(O,{size:"medium"},{default:a(()=>[t(e(ce))]),_:1})])),e(g).state.userLogined?(n(),r("div",{key:3,class:"action-item hover",onClick:D(s,["stop"])},[t(O,{size:"medium"},{default:a(()=>[C.value?i("",!0):(n(),z(e(ce),{key:0})),C.value?(n(),z(e(we),{key:1,class:"show"})):i("",!0)]),_:1})],8,ss)):i("",!0),e(g).state.userLogined&&!k.value?(n(),r("span",{key:4,class:"show reply-btn",onClick:b[0]||(b[0]=M=>w(!0))}," 回复 ")):i("",!0),e(g).state.userLogined&&k.value?(n(),r("span",{key:5,class:"hide reply-btn",onClick:b[1]||(b[1]=M=>w(!1))}," 取消 ")):i("",!0)])]),k.value?(n(),r("div",os,[t(H,null,{default:a(()=>[t(N,{ref_key:"inputInstRef",ref:y,size:"small",placeholder:c.atUsername?"@"+c.atUsername:"请输入回复内容..",maxlength:"100",value:P.value,"onUpdate:value":b[2]||(b[2]=M=>P.value=M),"show-count":"",clearable:""},null,8,["placeholder","value"]),t(B,{type:"primary",size:"small",ghost:"",loading:_.value,onClick:$},{default:a(()=>[x(" 回复 ")]),_:1},8,["loading"])]),_:1})])):i("",!0)])}}});const as=W(ns,[["__scopeId","data-v-25b679c1"]]),ls={class:"comment-item"},is={class:"nickname-wrap"},cs={class:"username-wrap"},us={class:"opt-wrap"},rs={class:"timestamp"},_s=["innerHTML"],ps={class:"reply-wrap"},ds=G({__name:"comment-item",props:{comment:null},emits:["reload"],setup(L,{emit:A}){const l=L,c=Z(),g=xe(),y=u(0),k=u(""),P=u(),_=se(()=>{let w=Object.assign({texts:[],imgs:[]},l.comment);return w.contents.map($=>{(+$.type==1||+$.type==2)&&w.texts.push($),+$.type==3&&w.imgs.push($)}),w}),T=(w,$)=>{let m=w.target;if(m.dataset.detail){const b=m.dataset.detail.split(":");b.length===2&&(c.commit("refresh"),b[0]==="tag"?window.$message.warning("评论内的无效话题"):g.push({name:"user",query:{username:b[1]}}))}},C=w=>{var $,m;y.value=w.user_id,k.value=(($=w.user)==null?void 0:$.username)||"",(m=P.value)==null||m.switchReply(!0)},h=()=>{A("reload")},U=()=>{y.value=0,k.value=""},s=()=>{Oe({id:_.value.id}).then(w=>{window.$message.success("删除成功"),setTimeout(()=>{h()},50)}).catch(w=>{})};return(w,$)=>{const m=ve,b=de("router-link"),O=X,N=ee,B=be,H=Ce,M=as,F=Yt,Y=$e;return n(),r("div",ls,[t(Y,{"content-indented":""},Te({avatar:a(()=>[t(m,{round:"",size:30,src:e(_).user.avatar},null,8,["src"])]),header:a(()=>[d("span",is,[t(b,{onClick:$[0]||($[0]=D(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e(_).user.username}}},{default:a(()=>[x(I(e(_).user.nickname),1)]),_:1},8,["to"])]),d("span",cs," @"+I(e(_).user.username),1)]),"header-extra":a(()=>[d("div",us,[d("span",rs,I(e(_).ip_loc),1),e(c).state.userInfo.is_admin||e(c).state.userInfo.id===e(_).user.id?(n(),z(B,{key:0,"negative-text":"取消","positive-text":"确认",onPositiveClick:s},{trigger:a(()=>[t(N,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:a(()=>[t(O,null,{default:a(()=>[t(e(ye))]),_:1})]),_:1})]),default:a(()=>[x(" 是否确认删除? ")]),_:1})):i("",!0)])]),footer:a(()=>[e(_).imgs.length>0?(n(),z(H,{key:0,imgs:e(_).imgs},null,8,["imgs"])):i("",!0),t(M,{ref_key:"replyComposeRef",ref:P,comment:e(_),"at-userid":y.value,"at-username":k.value,onReload:h,onReset:U},null,8,["comment","at-userid","at-username"]),d("div",ps,[(n(!0),r(oe,null,ne(e(_).replies,o=>(n(),z(F,{key:o.id,reply:o,"tweet-id":e(_).post_id,onFocusReply:C,onReload:h},null,8,["reply","tweet-id"]))),128))])]),_:2},[e(_).texts.length>0?{name:"description",fn:a(()=>[(n(!0),r(oe,null,ne(e(_).texts,o=>(n(),r("span",{key:o.id,class:"comment-text",onClick:$[1]||($[1]=D(p=>T(p,e(_).id),["stop"])),innerHTML:e(he)(o.content).content},null,8,_s))),128))]),key:"0"}:void 0]),1024)])}}});const ms=W(ds,[["__scopeId","data-v-f206d4d8"]]),vs=L=>(fe("data-v-ca3e6071"),L=L(),ge(),L),hs={key:0,class:"compose-wrap"},fs={class:"compose-line"},gs={class:"compose-user"},ys={class:"compose-line compose-options"},ks={class:"attachment"},ws={class:"submit-wrap"},bs={class:"attachment-list-wrap"},$s={key:1,class:"compose-wrap"},Cs=vs(()=>d("div",{class:"login-wrap"},[d("span",{class:"login-banner"}," 登录后,精彩更多")],-1)),xs={key:0,class:"login-only-wrap"},Is={key:1,class:"login-wrap"},Ts=G({__name:"compose-comment",props:{lock:{default:0},postId:{default:0}},emits:["post-success"],setup(L,{emit:A}){const l=L,c=Z(),g=u([]),y=u(!1),k=u(!1),P=u(!1),_=u(""),T=u(),C=u("public/image"),h=u([]),U=u([]),s=u("true".toLowerCase()==="true"),w="/v1/attachment",$=u(),m=Tt.debounce(v=>{De({k:v}).then(f=>{let R=[];f.suggest.map(S=>{R.push({label:S,value:S})}),g.value=R,k.value=!1}).catch(f=>{k.value=!1})},200),b=(v,f)=>{k.value||(k.value=!0,f==="@"&&m(v))},O=v=>{v.length>200||(_.value=v)},N=v=>{C.value=v},B=v=>{h.value=v},H=async v=>{var f,R;return C.value==="public/image"&&!["image/png","image/jpg","image/jpeg","image/gif"].includes((f=v.file.file)==null?void 0:f.type)?(window.$message.warning("图片仅允许 png/jpg/gif 格式"),!1):C.value==="image"&&((R=v.file.file)==null?void 0:R.size)>10485760?(window.$message.warning("图片大小不能超过10MB"),!1):!0},M=({file:v,event:f})=>{var R;try{let S=JSON.parse((R=f.target)==null?void 0:R.response);S.code===0&&C.value==="public/image"&&U.value.push({id:v.id,content:S.data.content})}catch{window.$message.error("上传失败")}},F=({file:v,event:f})=>{var R;try{let S=JSON.parse((R=f.target)==null?void 0:R.response);if(S.code!==0){let V=S.msg||"上传失败";S.details&&S.details.length>0&&S.details.map(q=>{V+=":"+q}),window.$message.error(V)}}catch{window.$message.error("上传失败")}},Y=({file:v})=>{let f=U.value.findIndex(R=>R.id===v.id);f>-1&&U.value.splice(f,1)},o=()=>{y.value=!0},p=()=>{var v;y.value=!1,(v=T.value)==null||v.clear(),h.value=[],_.value="",U.value=[]},j=()=>{if(_.value.trim().length===0){window.$message.warning("请输入内容哦");return}let{users:v}=he(_.value);const f=[];let R=100;f.push({content:_.value,type:2,sort:R}),U.value.map(S=>{R++,f.push({content:S.content,type:3,sort:R})}),P.value=!0,qe({contents:f,post_id:l.postId,users:Array.from(new Set(v))}).then(S=>{window.$message.success("发布成功"),P.value=!1,A("post-success"),p()}).catch(S=>{P.value=!1})},K=v=>{c.commit("triggerAuth",!0),c.commit("triggerAuthKey",v)};return me(()=>{$.value="Bearer "+localStorage.getItem("PAOPAO_TOKEN")}),(v,f)=>{const R=ve,S=at,V=X,q=ee,ue=lt,re=it,_e=ct,te=ut,pe=rt;return n(),r("div",null,[e(c).state.userInfo.id>0?(n(),r("div",hs,[d("div",fs,[d("div",gs,[t(R,{round:"",size:30,src:e(c).state.userInfo.avatar},null,8,["src"])]),t(S,{type:"textarea",size:"large",autosize:"",bordered:!1,options:g.value,prefix:["@"],loading:k.value,value:_.value,disabled:l.lock===1,"onUpdate:value":O,onSearch:b,onFocus:o,placeholder:l.lock===1?"泡泡已被锁定,回复功能已关闭":"快来评论两句吧..."},null,8,["options","loading","value","disabled","placeholder"])]),y.value?(n(),z(pe,{key:0,ref_key:"uploadRef",ref:T,abstract:"","list-type":"image",multiple:!0,max:9,action:w,headers:{Authorization:$.value},data:{type:C.value},onBeforeUpload:H,onFinish:M,onError:F,onRemove:Y,"onUpdate:fileList":B},{default:a(()=>[d("div",ys,[d("div",ks,[t(ue,{abstract:""},{default:a(({handleClick:J})=>[t(q,{disabled:h.value.length>0&&C.value==="public/video"||h.value.length===9,onClick:()=>{N("public/image"),J()},quaternary:"",circle:"",type:"primary"},{icon:a(()=>[t(V,{size:"20",color:"var(--primary-color)"},{default:a(()=>[t(e(Ge))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1}),t(_e,{trigger:"hover",placement:"bottom"},{trigger:a(()=>[t(re,{class:"text-statistic",type:"circle","show-indicator":!1,status:"success","stroke-width":10,percentage:_.value.length/200*100},null,8,["percentage"])]),default:a(()=>[x(" "+I(_.value.length)+" / 200 ",1)]),_:1})]),d("div",ws,[t(q,{quaternary:"",round:"",type:"tertiary",class:"cancel-btn",size:"small",onClick:p},{default:a(()=>[x(" 取消 ")]),_:1}),t(q,{loading:P.value,onClick:j,type:"primary",secondary:"",size:"small",round:""},{default:a(()=>[x(" 发布 ")]),_:1},8,["loading"])])]),d("div",bs,[t(te)])]),_:1},8,["headers","data"])):i("",!0)])):(n(),r("div",$s,[Cs,s.value?i("",!0):(n(),r("div",xs,[t(q,{strong:"",secondary:"",round:"",type:"primary",onClick:f[0]||(f[0]=J=>K("signin"))},{default:a(()=>[x(" 登录 ")]),_:1})])),s.value?(n(),r("div",Is,[t(q,{strong:"",secondary:"",round:"",type:"primary",onClick:f[1]||(f[1]=J=>K("signin"))},{default:a(()=>[x(" 登录 ")]),_:1}),t(q,{strong:"",secondary:"",round:"",type:"info",onClick:f[2]||(f[2]=J=>K("signup"))},{default:a(()=>[x(" 注册 ")]),_:1})])):i("",!0)]))])}}});const Us=W(Ts,[["__scopeId","data-v-ca3e6071"]]),zs={class:"username-wrap"},Ps={key:0,class:"options"},Rs={key:0},Ss=["innerHTML"],Ls={class:"timestamp"},As={key:0},Ms={key:1},Os={class:"opts-wrap"},Ds=["onClick"],qs={class:"opt-item"},Es=["onClick"],Bs=["onClick"],js=G({__name:"post-detail",props:{post:null},emits:["reload"],setup(L,{emit:A}){const l=L,c=Z(),g=xe(),y=u(!1),k=u(!1),P=u(!1),_=u(!1),T=u(!1),C=u(!1),h=u(!1),U=u(Q.PUBLIC),s=se({get:()=>{let o=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},l.post);return o.contents.map(p=>{(+p.type==1||+p.type==2)&&o.texts.push(p),+p.type==3&&o.imgs.push(p),+p.type==4&&o.videos.push(p),+p.type==6&&o.links.push(p),+p.type==7&&o.attachments.push(p),+p.type==8&&o.charge_attachments.push(p)}),o},set:o=>{l.post.upvote_count=o.upvote_count,l.post.comment_count=o.comment_count,l.post.collection_count=o.collection_count}}),w=se(()=>{let o=[{label:"删除",key:"delete"}];return s.value.is_lock===0?o.push({label:"锁定",key:"lock"}):o.push({label:"解锁",key:"unlock"}),c.state.userInfo.is_admin&&(s.value.is_top===0?o.push({label:"置顶",key:"stick"}):o.push({label:"取消置顶",key:"unstick"})),s.value.visibility===Q.PUBLIC?o.push({label:"公开",key:"vpublic",children:[{label:"私密",key:"vprivate"},{label:"好友可见",key:"vfriend"}]}):s.value.visibility===Q.PRIVATE?o.push({label:"私密",key:"vprivate",children:[{label:"公开",key:"vpublic"},{label:"好友可见",key:"vfriend"}]}):o.push({label:"好友可见",key:"vfriend",children:[{label:"公开",key:"vpublic"},{label:"私密",key:"vprivate"}]}),o}),$=o=>{g.push({name:"post",query:{id:o}})},m=(o,p)=>{if(o.target.dataset.detail){const j=o.target.dataset.detail.split(":");if(j.length===2){c.commit("refresh"),j[0]==="tag"?g.push({name:"home",query:{q:j[1],t:"tag"}}):g.push({name:"user",query:{username:j[1]}});return}}$(p)},b=o=>{switch(o){case"delete":P.value=!0;break;case"lock":case"unlock":_.value=!0;break;case"stick":case"unstick":T.value=!0;break;case"vpublic":U.value=0,C.value=!0;break;case"vprivate":U.value=1,C.value=!0;break;case"vfriend":U.value=2,C.value=!0;break}},O=()=>{je({id:s.value.id}).then(o=>{window.$message.success("删除成功"),g.replace("/"),setTimeout(()=>{c.commit("refresh")},50)}).catch(o=>{h.value=!1})},N=()=>{Ne({id:s.value.id}).then(o=>{A("reload"),o.lock_status===1?window.$message.success("锁定成功"):window.$message.success("解锁成功")}).catch(o=>{h.value=!1})},B=()=>{He({id:s.value.id}).then(o=>{A("reload"),o.top_status===1?window.$message.success("置顶成功"):window.$message.success("取消置顶成功")}).catch(o=>{h.value=!1})},H=()=>{Ve({id:s.value.id,visibility:U.value}).then(o=>{A("reload"),window.$message.success("修改可见性成功")}).catch(o=>{h.value=!1})},M=()=>{Fe({id:s.value.id}).then(o=>{y.value=o.status,o.status?s.value={...s.value,upvote_count:s.value.upvote_count+1}:s.value={...s.value,upvote_count:s.value.upvote_count-1}}).catch(o=>{console.log(o)})},F=()=>{Ye({id:s.value.id}).then(o=>{k.value=o.status,o.status?s.value={...s.value,collection_count:s.value.collection_count+1}:s.value={...s.value,collection_count:s.value.collection_count-1}}).catch(o=>{console.log(o)})},Y=()=>{Ut(`${window.location.origin}/#/post?id=${s.value.id}`),window.$message.success("链接已复制到剪贴板")};return me(()=>{c.state.userInfo.id>0&&(Ee({id:s.value.id}).then(o=>{y.value=o.status}).catch(o=>{console.log(o)}),Be({id:s.value.id}).then(o=>{k.value=o.status}).catch(o=>{console.log(o)}))}),(o,p)=>{const j=ve,K=de("router-link"),v=_t,f=X,R=ee,S=pt,V=dt,q=bt,ue=Ce,re=$t,_e=Ct,te=mt,pe=vt,J=$e;return n(),r("div",{class:"detail-item",onClick:p[6]||(p[6]=E=>$(e(s).id))},[t(J,null,{avatar:a(()=>[t(j,{round:"",size:30,src:e(s).user.avatar},null,8,["src"])]),header:a(()=>[t(K,{onClick:p[0]||(p[0]=D(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e(s).user.username}}},{default:a(()=>[x(I(e(s).user.nickname),1)]),_:1},8,["to"]),d("span",zs," @"+I(e(s).user.username),1),e(s).is_top?(n(),z(v,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:a(()=>[x(" 置顶 ")]),_:1})):i("",!0),e(s).visibility==e(Q).PRIVATE?(n(),z(v,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:a(()=>[x(" 私密 ")]),_:1})):i("",!0),e(s).visibility==e(Q).FRIEND?(n(),z(v,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:a(()=>[x(" 好友可见 ")]),_:1})):i("",!0)]),"header-extra":a(()=>[e(c).state.userInfo.is_admin||e(c).state.userInfo.id===e(s).user.id?(n(),r("div",Ps,[t(S,{placement:"bottom-end",trigger:"click",size:"small",options:e(w),onSelect:b},{default:a(()=>[t(R,{quaternary:"",circle:""},{icon:a(()=>[t(f,null,{default:a(()=>[t(e(Qe))]),_:1})]),_:1})]),_:1},8,["options"])])):i("",!0),t(V,{show:P.value,"onUpdate:show":p[1]||(p[1]=E=>P.value=E),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定删除该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:O},null,8,["show"]),t(V,{show:_.value,"onUpdate:show":p[2]||(p[2]=E=>_.value=E),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定"+(e(s).is_lock?"解锁":"锁定")+"该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:N},null,8,["show","content"]),t(V,{show:T.value,"onUpdate:show":p[3]||(p[3]=E=>T.value=E),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定"+(e(s).is_top?"取消置顶":"置顶")+"该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:B},null,8,["show","content"]),t(V,{show:C.value,"onUpdate:show":p[4]||(p[4]=E=>C.value=E),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定将该泡泡动态可见度修改为"+(U.value==0?"公开":U.value==1?"私密":"好友可见")+"吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:H},null,8,["show","content"])]),footer:a(()=>[t(q,{attachments:e(s).attachments},null,8,["attachments"]),t(q,{attachments:e(s).charge_attachments,price:e(s).attachment_price},null,8,["attachments","price"]),t(ue,{imgs:e(s).imgs},null,8,["imgs"]),t(re,{videos:e(s).videos,full:!0},null,8,["videos"]),t(_e,{links:e(s).links},null,8,["links"]),d("div",Ls,[x(" 发布于 "+I(e(ae)(e(s).created_on))+" ",1),e(s).ip_loc?(n(),r("span",As,[t(te,{vertical:""}),x(" "+I(e(s).ip_loc),1)])):i("",!0),!e(c).state.collapsedLeft&&e(s).created_on!=e(s).latest_replied_on?(n(),r("span",Ms,[t(te,{vertical:""}),x(" 最后回复 "+I(e(ae)(e(s).latest_replied_on)),1)])):i("",!0)])]),action:a(()=>[d("div",Os,[t(pe,{justify:"space-between"},{default:a(()=>[d("div",{class:"opt-item hover",onClick:D(M,["stop"])},[t(f,{size:"20",class:"opt-item-icon"},{default:a(()=>[y.value?i("",!0):(n(),z(e(Ze),{key:0})),y.value?(n(),z(e(We),{key:1,color:"red"})):i("",!0)]),_:1}),x(" "+I(e(s).upvote_count),1)],8,Ds),d("div",qs,[t(f,{size:"20",class:"opt-item-icon"},{default:a(()=>[t(e(Xe))]),_:1}),x(" "+I(e(s).comment_count),1)]),d("div",{class:"opt-item hover",onClick:D(F,["stop"])},[t(f,{size:"20",class:"opt-item-icon"},{default:a(()=>[k.value?i("",!0):(n(),z(e(et),{key:0})),k.value?(n(),z(e(tt),{key:1,color:"#ff7600"})):i("",!0)]),_:1}),x(" "+I(e(s).collection_count),1)],8,Es),d("div",{class:"opt-item hover",onClick:D(Y,["stop"])},[t(f,{size:"20",class:"opt-item-icon"},{default:a(()=>[t(e(st))]),_:1}),x(" "+I(e(s).share_count),1)],8,Bs)]),_:1})])]),default:a(()=>[e(s).texts.length>0?(n(),r("div",Rs,[(n(!0),r(oe,null,ne(e(s).texts,E=>(n(),r("span",{key:E.id,class:"post-text",onClick:p[5]||(p[5]=D(Ie=>m(Ie,e(s).id),["stop"])),innerHTML:e(he)(E.content).content},null,8,Ss))),128))])):i("",!0)]),_:1})])}}});const Ns=L=>(fe("data-v-cba0d907"),L=L(),ge(),L),Hs={key:0,class:"detail-wrap"},Vs={key:1,class:"empty-wrap"},Fs={key:0,class:"comment-opts-wrap"},Ys=Ns(()=>d("span",{class:"comment-title-item"},"评论",-1)),Ks={key:2},Js={key:0,class:"skeleton-wrap"},Gs={key:1},Qs={key:0,class:"empty-wrap"},Zs=G({__name:"Post",setup(L){const A=xt(),l=u({}),c=u(!1),g=u(!1),y=u([]),k=se(()=>+A.query.id),P=u("default"),_=u(null),T=u(1),C=u(!1),h=m=>{P.value=m,s()},U=()=>{l.value={id:0},c.value=!0,Ke({id:k.value}).then(m=>{c.value=!1,l.value=m,s()}).catch(m=>{c.value=!1})},s=(m=!1)=>{y.value.length===0&&(g.value=!0),Je({id:l.value.id,sort_strategy:P.value,page:T.value,page_size:20}).then(b=>{b.list.length===0&&(C.value=!0),T.value===1?y.value=b.list:y.value=y.value.concat(b.list),g.value=!1,m&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(b=>{g.value=!1})},w=()=>{!g.value&&y.value.length>0&&(T.value=T.value+1,s())},$=new IntersectionObserver(m=>{m.forEach(b=>{b.isIntersecting&&w()})},{root:null,rootMargin:"0px",threshold:1});return me(()=>{_.value&&$.observe(_.value),U()}),Ue(()=>{$.disconnect()}),ze(k,()=>{k.value>0&&A.name==="post"&&U()}),(m,b)=>{const O=zt,N=js,B=ft,H=gt,M=yt,F=kt,Y=wt,o=Us,p=It,j=ms,K=ht;return n(),r("div",null,[t(O,{title:"泡泡详情",back:!0}),t(K,{class:"main-content-wrap",bordered:""},{default:a(()=>[t(M,null,{default:a(()=>[t(H,{show:c.value},{default:a(()=>[l.value.id>1?(n(),r("div",Hs,[t(N,{post:l.value,onReload:U},null,8,["post"])])):(n(),r("div",Vs,[t(B,{size:"large",description:"暂无数据"})]))]),_:1},8,["show"])]),_:1}),l.value.id>0?(n(),r("div",Fs,[t(Y,{type:"bar","justify-content":"end",size:"small",animated:"","onUpdate:value":h},{prefix:a(()=>[Ys]),default:a(()=>[t(F,{name:"default",tab:"默认"}),t(F,{name:"newest",tab:"最新"})]),_:1})])):i("",!0),l.value.id>0?(n(),z(M,{key:1},{default:a(()=>[t(o,{lock:l.value.is_lock,"post-id":l.value.id,onPostSuccess:b[0]||(b[0]=v=>s(!0))},null,8,["lock","post-id"])]),_:1})):i("",!0),l.value.id>0?(n(),r("div",Ks,[g.value?(n(),r("div",Js,[t(p,{num:5})])):(n(),r("div",Gs,[y.value.length===0?(n(),r("div",Qs,[t(B,{size:"large",description:"暂无评论,快来抢沙发"})])):i("",!0),(n(!0),r(oe,null,ne(y.value,v=>(n(),z(M,{key:v.id},{default:a(()=>[t(j,{comment:v,onReload:s},null,8,["comment"])]),_:2},1024))),128))]))])):i("",!0),C.value?i("",!0):(n(),r("div",{key:3,class:"load-more-ele",ref_key:"bottomElement",ref:_}," 加载更多... ",512))]),_:1})])}}});const Po=W(Zs,[["__scopeId","data-v-cba0d907"]]);export{Po as default};