import{b as Q,w as X,f as v,E as n,A as $,j as l,g as c,i as r,k as i,q as o,T as Y,u as e,p as u,F as w,G as I,D as f,l as m,H as h,J as Z,a as P}from"./vue-Cm77DuTi.js";import{ax as tt,aA as et,M as x,b as p,am as st,d as y,aq as A,n as ot,_ as lt}from"./app-QjDgb7aF.js";import{M as at}from"./MkContainer-CNBcUt5w.js";import{M as nt}from"./MkPagination-DzUgufpZ.js";import{M as it}from"./MkGalleryPostPreview-tyRKvgNM.js";import{s as rt}from"./share-available-Drgr3YiT.js";import"./charts-3gEHPHRq.js";import"./media-DuCIZ-3n.js";const ut={class:"_root"},dt={key:0,class:"rkxwuolj"},ct={class:"files"},pt=["src"],kt={class:"body _block"},mt={class:"title"},ht={class:"description"},_t={class:"info"},vt={class:"actions"},ft={class:"like"},gt={key:0,class:"count"},yt={key:0,class:"count"},Mt={class:"other"},bt={class:"user"},Ct={class:"name"},$t={class:"sdrarzaf"},wt=Q({__name:"post",props:{postId:{}},setup(N){const T=tt(),_=N;let t=P(null),M=P(null);const B={endpoint:"users/gallery/posts",limit:6,params:v(()=>({userId:t.value.user.id}))};function L(){t.value=null,y("gallery/posts/show",{postId:_.postId}).then(a=>{t.value=a}).catch(a=>{M.value=a})}function S(){navigator.share({title:t.value.title,text:t.value.description,url:`${A}/gallery/${t.value.id}`})}function D(){ot({initialText:`${t.value.title} ${A}/gallery/${t.value.id}`})}function E(){y("gallery/posts/like",{postId:_.postId}).then(()=>{t.value.isLiked=!0,t.value.likedCount++})}async function V(){y("gallery/posts/unlike",{postId:_.postId}).then(()=>{t.value.isLiked=!1,t.value.likedCount--})}function b(){T.push(`/gallery/${t.value.id}/edit`)}X(()=>_.postId,L,{immediate:!0});const F=v(()=>[{icon:"ph-pencil ph-bold ph-lg",text:p.ts.edit,handler:b}]),H=v(()=>[]);return et(v(()=>t.value?{title:t.value.title,avatar:t.value.user}:null)),(a,s)=>{const j=n("MkPageHeader"),q=n("Mfm"),G=n("MkTime"),R=n("MkAvatar"),U=n("MkUserName"),W=n("MkAcct"),z=n("MkError"),J=n("MkLoading"),K=n("MkSpacer"),O=n("MkStickyContainer"),k=$("tooltip"),g=$("click-anime");return l(),c(O,null,{header:r(()=>[i(j,{actions:F.value,tabs:H.value},null,8,["actions","tabs"])]),default:r(()=>[i(K,{"content-max":1e3,"margin-min":16,"margin-max":32},{default:r(()=>[o("div",ut,[i(Y,{name:a.$store.state.animation?"fade":"",mode:"out-in"},{default:r(()=>[e(t)?(l(),u("div",dt,[o("div",ct,[(l(!0),u(w,null,I(e(t).files,d=>(l(),u("div",{key:d.id,class:"file"},[o("img",{src:d.url},null,8,pt)]))),128))]),o("div",kt,[o("div",mt,f(e(t).title),1),o("div",ht,[i(q,{text:e(t).description},null,8,["text"])]),o("div",_t,[s[3]||(s[3]=o("i",{class:"ph-clock ph-bold ph-lg"},null,-1)),i(G,{time:e(t).createdAt,mode:"detail"},null,8,["time"])]),o("div",vt,[o("div",ft,[e(t).isLiked?m((l(),c(x,{key:0,class:"button",primary:"",onClick:s[0]||(s[0]=d=>V())},{default:r(()=>[s[4]||(s[4]=o("i",{class:"ph-heart ph-fill ph-lg"},null,-1)),e(t).likedCount>0?(l(),u("span",gt,f(e(t).likedCount),1)):h("",!0)]),_:1})),[[k,e(p).ts._gallery.unlike]]):m((l(),c(x,{key:1,class:"button",onClick:s[1]||(s[1]=d=>E())},{default:r(()=>[s[5]||(s[5]=o("i",{class:"ph-heart ph-bold"},null,-1)),e(t).likedCount>0?(l(),u("span",yt,f(e(t).likedCount),1)):h("",!0)]),_:1})),[[k,e(p).ts._gallery.like]])]),o("div",Mt,[a.$i&&a.$i.id===e(t).user.id?m((l(),u("button",{key:0,class:"_button",onClick:b},[...s[6]||(s[6]=[o("i",{class:"ph-pencil ph-bold ph-lg ph-fw ph-lg"},null,-1)])])),[[k,e(p).ts.edit],[g]]):h("",!0),m((l(),u("button",{class:"_button",onClick:D},[...s[7]||(s[7]=[o("i",{class:"ph-repeat ph-bold ph-lg ph-fw ph-lg"},null,-1)])])),[[k,e(p).ts.shareWithNote],[g]]),e(rt)()?m((l(),u("button",{key:1,class:"_button",onClick:S},[...s[8]||(s[8]=[o("i",{class:"ph-share-network ph-bold ph-lg ph-fw ph-lg"},null,-1)])])),[[k,e(p).ts.share],[g]]):h("",!0)])]),o("div",bt,[i(R,{user:e(t).user,class:"avatar"},null,8,["user"]),o("div",Ct,[i(U,{user:e(t).user,style:{display:"block"}},null,8,["user"]),i(W,{user:e(t).user},null,8,["user"])]),!a.$i||a.$i.id!=e(t).user.id?(l(),c(st,{key:0,user:e(t).user,inline:!0,transparent:!1,full:!0,large:"",class:"koudoku"},null,8,["user"])):h("",!0)])]),i(at,{"max-height":300,foldable:!0,class:"other"},{header:r(()=>[s[9]||(s[9]=o("i",{class:"ph-clock ph-bold ph-lg"},null,-1)),Z(" "+f(e(p).ts.recentPosts),1)]),default:r(()=>[i(nt,{pagination:B},{default:r(({items:d})=>[o("div",$t,[(l(!0),u(w,null,I(d,C=>(l(),c(it,{key:C.id,post:C,class:"post"},null,8,["post"]))),128))])]),_:1})]),_:1})])):e(M)?(l(),c(z,{key:1,onRetry:s[2]||(s[2]=d=>a.fetch())})):(l(),c(J,{key:2}))]),_:1},8,["name"])])]),_:1})]),_:1})}}}),St=lt(wt,[["__scopeId","data-v-f4f4ad21"]]);export{St as default};
//# sourceMappingURL=post-CaWacS21.js.map
