import{d as b,e,f as l,F as i,u as k,k as o,w as s,bf as c,j as C,y,x as I,q as g,Y as m,H as j,A as D,h as E}from"./@vue-a481fc63.js";import{$ as N,a0 as U}from"./@vicons-f0266f88.js";import{j as $,V as A,W as V,m as R,X as F,e as L,i as P}from"./naive-ui-eecf2ec3.js";import{_ as B,V as T,W as M}from"./index-16dc1f8e.js";import{e as O}from"./paopao-video-player-2fe58954.js";const W={class:"link-wrap"},Z={class:"link-txt-wrap"},q=["href"],z={class:"link-txt"},H=b({__name:"post-link",props:{links:{default:()=>[]}},setup(d){const r=d;return(a,p)=>{const x=$;return e(),l("div",W,[(e(!0),l(i,null,k(r.links,n=>(e(),l("div",{class:"link-item",key:n.id},[o(x,{class:"hash-link"},{default:s(()=>[o(c(N))]),_:1}),C("div",Z,[C("a",{href:n.content,class:"hash-link",target:"_blank",onClick:p[0]||(p[0]=y(()=>{},["stop"]))},[C("span",z,I(n.content),1)],8,q)])]))),128))])}}});const st=B(H,[["__scopeId","data-v-36eef76b"]]),X={key:0},ot=b({__name:"post-video",props:{videos:{default:()=>[]},full:{type:Boolean,default:!1}},setup(d){const r=d;return(a,p)=>{const x=A,n=V;return r.videos.length>0?(e(),l("div",X,[o(n,{"x-gap":4,"y-gap":4,cols:a.full?1:5},{default:s(()=>[o(x,{span:a.full?1:3},{default:s(()=>[(e(!0),l(i,null,k(r.videos,u=>(e(),g(c(O),{onClick:p[0]||(p[0]=y(()=>{},["stop"])),key:u.id,src:u.content,colors:["#18a058","#2aca75"],hoverable:!0,theme:"gradient"},null,8,["src"]))),128))]),_:1},8,["span"])]),_:1},8,["cols"])])):m("",!0)}}}),Y={class:"images-wrap"},rt=b({__name:"post-image",props:{imgs:{default:()=>[]}},setup(d){const r=d,a="https://paopao-assets.oss-cn-shanghai.aliyuncs.com/public/404.png",p="?x-oss-process=image/resize,m_fill,w_300,h_300,limit_0/auto-orient,1/format,png";return(x,n)=>{const u=R,f=A,v=V,w=F;return e(),l("div",Y,[[1].includes(r.imgs.length)?(e(),g(w,{key:0},{default:s(()=>[o(v,{"x-gap":4,"y-gap":4,cols:2},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,t=>(e(),g(f,{key:t.id},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[0]||(n[0]=y(()=>{},["stop"])),class:"post-img x1","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024))),128))]),_:1})]),_:1})):m("",!0),[2,3].includes(r.imgs.length)?(e(),g(w,{key:1},{default:s(()=>[o(v,{"x-gap":4,"y-gap":4,cols:3},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,t=>(e(),g(f,{key:t.id},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[1]||(n[1]=y(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024))),128))]),_:1})]),_:1})):m("",!0),[4].includes(r.imgs.length)?(e(),g(w,{key:2},{default:s(()=>[o(v,{"x-gap":4,"y-gap":4,cols:4},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,t=>(e(),g(f,{key:t.id},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[2]||(n[2]=y(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024))),128))]),_:1})]),_:1})):m("",!0),[5].includes(r.imgs.length)?(e(),g(w,{key:3},{default:s(()=>[o(v,{"x-gap":4,"y-gap":4,cols:3},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,(t,_)=>(e(),l(i,{key:t.id},[_<3?(e(),g(f,{key:0},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[3]||(n[3]=y(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):m("",!0)],64))),128))]),_:1}),o(v,{"x-gap":4,"y-gap":4,cols:2,style:{"margin-top":"4px"}},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,(t,_)=>(e(),l(i,{key:t.id},[_>=3?(e(),g(f,{key:0},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[4]||(n[4]=y(()=>{},["stop"])),class:"post-img x1","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):m("",!0)],64))),128))]),_:1})]),_:1})):m("",!0),[6].includes(r.imgs.length)?(e(),g(w,{key:4},{default:s(()=>[o(v,{"x-gap":4,"y-gap":4,cols:3},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,(t,_)=>(e(),l(i,{key:t.id},[_<3?(e(),g(f,{key:0},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[5]||(n[5]=y(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):m("",!0)],64))),128))]),_:1}),o(v,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,(t,_)=>(e(),l(i,{key:t.id},[_>=3?(e(),g(f,{key:0},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[6]||(n[6]=y(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):m("",!0)],64))),128))]),_:1})]),_:1})):m("",!0),r.imgs.length===7?(e(),g(w,{key:5},{default:s(()=>[o(v,{"x-gap":4,"y-gap":4,cols:4},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,(t,_)=>(e(),l(i,null,[_<4?(e(),g(f,{key:t.id},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[7]||(n[7]=y(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):m("",!0)],64))),256))]),_:1}),o(v,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,(t,_)=>(e(),l(i,null,[_>=4?(e(),g(f,{key:t.id},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[8]||(n[8]=y(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):m("",!0)],64))),256))]),_:1})]),_:1})):m("",!0),r.imgs.length===8?(e(),g(w,{key:6},{default:s(()=>[o(v,{"x-gap":4,"y-gap":4,cols:4},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,(t,_)=>(e(),l(i,null,[_<4?(e(),g(f,{key:t.id},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[9]||(n[9]=y(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):m("",!0)],64))),256))]),_:1}),o(v,{"x-gap":4,"y-gap":4,cols:4,style:{"margin-top":"4px"}},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,(t,_)=>(e(),l(i,null,[_>=4?(e(),g(f,{key:t.id},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[10]||(n[10]=y(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):m("",!0)],64))),256))]),_:1})]),_:1})):m("",!0),r.imgs.length===9?(e(),g(w,{key:7},{default:s(()=>[o(v,{"x-gap":4,"y-gap":4,cols:3},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,(t,_)=>(e(),l(i,null,[_<3?(e(),g(f,{key:t.id},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[11]||(n[11]=y(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):m("",!0)],64))),256))]),_:1}),o(v,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,(t,_)=>(e(),l(i,null,[_>=3&&_<6?(e(),g(f,{key:t.id},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[12]||(n[12]=y(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):m("",!0)],64))),256))]),_:1}),o(v,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:s(()=>[(e(!0),l(i,null,k(r.imgs,(t,_)=>(e(),l(i,null,[_>=6?(e(),g(f,{key:t.id},{default:s(()=>[o(u,{onError:()=>t.content=c(a),onClick:n[13]||(n[13]=y(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(p),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):m("",!0)],64))),256))]),_:1})]),_:1})):m("",!0)])}}});const G={class:"attachment-wrap"},J=b({__name:"post-attachment",props:{attachments:{default:()=>[]},price:{default:0}},setup(d){const r=d,a=j(!1),p=j(""),x=j(0),n=f=>{a.value=!0,x.value=f.id,p.value="这是一个免费附件,您可以直接下载?",f.type===8&&(p.value=()=>E("div",{},[E("p",{},"这是一个收费附件,下载将收取"+(r.price/100).toFixed(2)+"元")]),T({id:x.value}).then(v=>{v.paid&&(p.value=()=>E("div",{},[E("p",{},"此次下载您已支付或无需付费,请确认下载")]))}).catch(v=>{a.value=!1}))},u=()=>{M({id:x.value}).then(f=>{window.open(f.signed_url.replace("http://","https://"),"_blank")}).catch(f=>{console.log(f)})};return(f,v)=>{const w=$,t=L,_=P;return e(),l("div",G,[(e(!0),l(i,null,k(f.attachments,h=>(e(),l("div",{class:"attach-item",key:h.id},[o(t,{onClick:y(K=>n(h),["stop"]),type:"primary",size:"tiny",dashed:""},{icon:s(()=>[o(w,null,{default:s(()=>[o(c(U))]),_:1})]),default:s(()=>[D(" "+I(h.type===8?"收费":"免费")+"附件 ",1)]),_:2},1032,["onClick"])]))),128)),o(_,{show:a.value,"onUpdate:show":v[0]||(v[0]=h=>a.value=h),"mask-closable":!1,preset:"dialog",title:"下载提示",content:p.value,"positive-text":"确认下载","negative-text":"取消","icon-placement":"top",onPositiveClick:u},null,8,["show","content"])])}}});const lt=B(J,[["__scopeId","data-v-22563084"]]),at=d=>{const r=[],a=[];var p=/(#|#)([^#@\s])+?\s+?/g,x=/@([a-zA-Z0-9])+?\s+?/g;return d=d.replace(/<[^>]*?>/gi,"").replace(/(.*?)<\/[^>]*?>/gi,"").replace(p,n=>(r.push(n.substr(1).trim()),''+n.trim()+" ")).replace(x,n=>(a.push(n.substr(1).trim()),''+n.trim()+" ")),{content:d,tags:r,users:a}},ct=(d,r,a)=>{let p=!1;if(d.length>a){d=d.substring(0,a),p=!0;let u=d.charAt(a-1);(u=="#"||u=="#"||u=="@")&&(d=d.substring(0,a-1))}const x=/(#|#)([^#@\s])+?\s+?/g,n=/@([a-zA-Z0-9])+?\s+?/g;return d=d.replace(/<[^>]*?>/gi,"").replace(/(.*?)<\/[^>]*?>/gi,"").replace(x,u=>''+u.trim()+" ").replace(n,u=>''+u.trim()+" "),p&&(d=d.trimEnd()+' ...'+r+" "),d};export{rt as _,lt as a,ot as b,st as c,ct as d,at as p};