1import{u as re,s as X,a as Z,b as de,c as H,_ as ie,d as se,e as fe,m as oe,o as pe,f as he,g as ge}from"./index-FzbD1TUl.js";import{F as be,c as O,r,a0 as ue,a1 as ce,C as xe,G as n,H as S,I as o,M as s,N as c,aF as _e,y as t,Q as m,Y as f,R as b,P as k,T as ye,aG as we,a7 as ke,ah as Ce,ag as Pe,U as me,K as $e,aH as Ue,aI as D,O as G,aJ as ze,aa as Re,ay as Me,L as ne}from"./ui-CfRGXzBA.js";import"./tiptap-DWpuzwU2.js";import"./cm-CwWG6HQl.js";const je={class:"flex flex-col items-center"},Ne={class:"absolute top-2 flex h-3/4 w-10/12 flex-row rounded bg-stone-700/80 text-stone-200 md:top-12"},Ae={class:"absolute flex bottom-0 left-1/3 z-10"},Be={class:"hidden flex-col p-3 md:ml-8 md:flex"},Ee={class:"flex"},Se={class:"text-sm font-bold md:text-xl"},Ie={key:0,class:"text-xs text-stone-300"},Oe=["href","title"],Ve={class:"mt-2 flex"},Te={class:"relative size-32"},Fe=["src"],Le={class:"ml-24 flex"},De={class:"flex w-full md:hidden"},Ge={class:"relative size-16"},He=["src"],Ke={class:"ml-4 grid grid-flow-row auto-rows-min justify-items-start py-1"},Ye={class:"flex"},qe={class:"text-sm font-medium"},Je={key:0,class:"text-xs text-stone-300"},Qe=["href","title"],We={class:"flex rounded bg-stone-700 p-2 md:hidden"},Xe={class:"flex w-full justify-center"},Ze={__name:"ProfileEditor",props:["uuid"],setup(e,{expose:z}){const{$gettext:w}=re(),{userIsAuthenticated:C}=X(Z()),{isAuthenticatedUser:d}=Z(),{setEditorProps:K}=de(),{profiles:u}=X(H()),{followChange:V,updateProfile:Y}=H(),T=be(),l=O(()=>u.value[e.uuid]??{}),p=()=>T.add({severity:"info",summary:w("Not implemented yet"),detail:w("This function will be implemented later"),life:5e3}),F=r(),P=a=>F.value.toggle(a),B=O(()=>[l.value.user_following?{label:w("Unfollow"),icon:"pi pi-minus text-blue-500",command:()=>V(e.uuid,!1)}:{label:w("Follow"),icon:"pi pi-plus text-blue-500",command:()=>V(e.uuid,!0)},{label:w("Bookmark"),icon:"pi pi-star text-blue-500",command:p},{label:w("Message"),icon:"pi pi-envelope text-blue-500",command:()=>K({mode:"create",recipient:`@${l.value.finger}`})},{label:w("Hide"),icon:"pi pi-eye text-blue-500",command:p},{label:w("Block"),icon:"pi pi-minus text-blue-500",command:p}]);let x=r(!1);const _=ue("avatarRef"),R=r(!1),U=r({url:l.value.avatar_url,description:"",type:"",accept:"image/*",category:"avatars"}),L=()=>R.value=!R.value,q=a=>{x.value=!0,u.value[e.uuid].avatar_url=a.url,y.avatar_url=a.url,Object.assign(U.value,a),R.value=!1},M=ue("pictureRef"),j=r(!1),$=r({url:l.value.picture_url,description:"",type:"",accept:"image/*",category:"pictures"}),i=()=>j.value=!j.value,E=a=>{x.value=!0,u.value[e.uuid].picture_url=a.url,y.picture_url=a.url,Object.assign($.value,a),j.value=!1},v=r(),N=a=>v.value.toggle(a),h=r(l.value.name),J=()=>{h.value!==l.value.name&&(x.value=!0,u.value[e.uuid].name=h.value,y.name=h.value),v.value.hide()};r();const ee=r(),I=r(!1),te=a=>{I.value=!I.value},ve=()=>{const a=ee.value.getContent();a!==l.value.bio&&(x.value=!0,y.bio=a,u.value[e.uuid].bio=a,u.value[e.uuid].rendered_bio=oe.parse(a)),I.value=!1};let y={},Q={};const W=r(!1),ae=async()=>{if(W.value=!0,y.avatar_url){const g=await _.value.mediaUploader(U.value);y.avatar_url=g.url}if(y.picture_url){const g=await M.value.mediaUploader($.value);y.picture_url=g.url}const a=await Y(e.uuid,y);W.value=!1,a||(x.value=!1,y={},Q={})},le=()=>{x.value=!1,Object.assign(u.value[e.uuid],Q),u.value[e.uuid].rendered_bio=oe.parse(u.value[e.uuid].bio),y={},U.value.url=u.value[e.uuid].avatar_url,$.value.url=u.value[e.uuid].picture_url};return ce(()=>{U.value.url=u.value[e.uuid].avatar_url,$.value.url=u.value[e.uuid].picture_url}),xe(()=>{U.value.url=u.value[e.uuid].avatar_url,$.value.url=u.value[e.uuid].picture_url,Q={avatar_url:u.value[e.uuid].avatar_url,picture_url:u.value[e.uuid].picture_url,bio:u.value[e.uuid].bio,name:u.value[e.uuid].name}}),z({hasChanges:x,commitChanges:ae,rejectChanges:le}),(a,g)=>(n(),S(me,null,[o("div",je,[s(t(we),{toggleable:"",header:t(d)(e.uuid)?a.__("Profile editor"):a.__("Profile info"),pt:{title:"font-medium"},class:"w-screen md:w-9/12"},{default:c(()=>[o("div",{class:"relative flex bg-cover bg-bottom h-24 justify-center md:h-96",style:_e(`background-image: url(${l.value.picture_url});`)},[o("div",Ne,[t(d)(e.uuid)?(n(),m(t(f),{key:0,title:a.__("Modify picture"),size:"small",icon:"pi pi-pencil",text:"",onClick:i,class:"absolute bottom-0 right-0 bg-stone-700/50 text-white md:bottom-4 md:right-4"},null,8,["title"])):b("",!0),o("div",Ae,[t(x)?(n(),m(t(f),{key:0,icon:"pi pi-save",text:"",label:a.__("Save changes"),onClick:ae,loading:W.value,class:"bg-stone-700/50 text-white md:bottom-2"},null,8,["label","loading"])):b("",!0),t(x)?(n(),m(t(f),{key:1,icon:"pi pi-undo",text:"",label:a.__("Cancel"),onClick:le,class:"bg-stone-700/50 text-white md:bottom-2"},null,8,["label"])):b("",!0)]),o("div",Be,[o("div",Ee,[o("span",Se,k(l.value.name),1),t(d)(e.uuid)?(n(),m(t(f),{key:0,title:a.__("Modify name"),onClick:N,size:"small",icon:"pi pi-pencil",text:"",class:"bg-stone-700/50 text-xs text-white"},null,8,["title"])):b("",!0)]),l.value.is_local?(n(),S("span",Ie,"@"+k(l.value.finger),1)):(n(),S("a",{key:1,href:l.value.home_url,title:l.value.home_url,rel:"nofollow",target:"_blank",class:"text-xs text-stone-300"},"@"+k(l.value.finger),9,Oe)),o("div",Ve,[o("div",Te,[o("img",{src:l.value.avatar_url,class:"h-full max-w-none rounded-lg opacity-100"},null,8,Fe),t(d)(e.uuid)?(n(),m(t(f),{key:0,title:a.__("Modify avatar"),onClick:L,size:"small",icon:"pi pi-pencil",text:"",class:"absolute bottom-0 right-0 bg-stone-700/50 text-xs text-white"},null,8,["title"])):b("",!0)]),o("div",Le,[t(d)(e.uuid)?(n(),m(t(f),{key:0,title:a.__("Modify bio"),onClick:te,size:"small",icon:"pi pi-pencil",text:"",class:"h-min bg-stone-700/50 text-xs text-white"},null,8,["title"])):b("",!0),s(ie,{class:"hidden h-24 max-w-none overflow-y-auto overscroll-contain text-xs text-stone-200 md:inline md:h-48",html:l.value.rendered_bio??l.value.bio??a.__("No bio")},null,8,["html"])])])]),o("div",De,[o("div",Ge,[o("img",{src:l.value.avatar_url,class:"m-1 h-full max-w-none rounded-lg opacity-100"},null,8,He),t(d)(e.uuid)?(n(),m(t(f),{key:0,title:a.__("Modify avatar"),size:"small",onClick:L,pt:{root:"size-fit p-0"},icon:"pi pi-pencil",text:"",class:"absolute bottom-0 right-0 bg-stone-700/50 text-xs text-white"},null,8,["title"])):b("",!0)]),o("div",Ke,[o("div",Ye,[o("span",qe,k(l.value.name),1),t(d)(e.uuid)?(n(),m(t(f),{key:0,title:a.__("Modify name"),onClick:N,pt:{root:"size-fit p-0"},size:"small",icon:"pi pi-pencil",text:"",class:"bg-stone-700/50 text-xs text-white"},null,8,["title"])):b("",!0)]),l.value.is_local?(n(),S("span",Je,"@"+k(l.value.finger),1)):(n(),S("a",{key:1,href:l.value.home_url,title:l.value.home_url,rel:"nofollow",target:"_blank",class:"text-xs text-stone-300"},"@"+k(l.value.finger),9,Qe))])]),!t(d)(e.uuid)&&t(C)?(n(),m(t(f),{key:1,text:"",onClick:P,id:"overlay_menu","aria-haspopup":"true","aria-controls":"overlay_menu",class:"right-0 top-0 h-min text-white",size:"small",icon:"pi pi-ellipsis-v",pt:{root:"absolute top-0 right-0 md:top-4 md:right-4 size-fit p-0"}})):b("",!0),s(t(ye),{ref_key:"actionMenu",ref:F,popup:"",model:B.value,class:"min-w-max border-none bg-stone-700 font-medium",pt:{itemContent:"text-white text-sm hover:text-stone-700"}},null,8,["model"])])],4),o("div",We,[t(d)(e.uuid)?(n(),m(t(f),{key:0,title:"Modify bio",onClick:te,size:"small",pt:{icon:"size-4"},icon:"pi pi-pencil",text:"",class:"h-min bg-stone-700/50 text-xs text-white md:hidden"})):b("",!0),s(ie,{class:"max-h-24 max-w-none overflow-y-auto overscroll-contain text-xs text-stone-200",html:l.value.rendered_bio??l.value.bio??a.__("No bio")},null,8,["html"])])]),_:1},8,["header"])]),s(se,{ref_key:"avatarRef",ref:_,visible:R.value,"onUpdate:visible":g[0]||(g[0]=A=>R.value=A),info:U.value,title:a.__("Update avatar"),onMediaSelected:q,defer:!0,uploadOnly:!0,cropperOptions:{canvas:{height:300,width:300},stencilProps:{aspectRatio:1}}},null,8,["visible","info","title"]),s(se,{ref_key:"pictureRef",ref:M,visible:j.value,"onUpdate:visible":g[1]||(g[1]=A=>j.value=A),info:$.value,onMediaSelected:E,defer:!0,uploadOnly:!0,title:a.__("Update profile picture")},null,8,["visible","info","title"]),s(t(Ce),{ref_key:"namePanel",ref:v},{default:c(()=>[o("form",{onSubmit:J,method:"dialog",class:"flex"},[s(t(ke),{modelValue:h.value,"onUpdate:modelValue":g[2]||(g[2]=A=>h.value=A),modelModifiers:{lazy:!0,trim:!0}},null,8,["modelValue"]),s(t(f),{text:"",type:"submit",label:a.__("Update")},null,8,["label"])],32)]),_:1},512),s(t(Pe),{visible:I.value,"onUpdate:visible":g[3]||(g[3]=A=>I.value=A),header:a.__("Edit profile bio"),class:"h-3/4 w-screen md:w-3/5",contentClass:"flex grow flex-col"},{default:c(()=>[s(fe,{ref_key:"mdEditor",ref:ee,content:l.value.bio,basic:!0},null,8,["content"]),o("div",Xe,[s(t(f),{text:"",type:"text",onClick:ve,label:a.__("Update"),icon:"pi pi-save",class:"w-min text-nowrap"},null,8,["label"])])]),_:1},8,["visible","header"])],64))}},et={class:"flex flex-col"},tt={class:"my-2 !p-0"},ot=Object.assign({inheritAttrs:!1,customOptions:{}},{__name:"ProfileContainer",props:["uuid"],setup(e){const z=ge(),w=$e(),{$gettext:C}
1=re(),{isAuthenticatedUser:d}=Z(),{profiles:K}=X(H()),{fetchContacts:u,fetchProfile:V}=H(),{hasContent:Y,updateStream:T}=de(),l=O(()=>K.value[e.uuid]??{}),p=r(z.currentRoute.value.name),F=i=>{console.log("tab change",i,p,z.currentRoute.value.name)};ce(()=>{z.currentRoute.value.name.startsWith("profile")&&(p.value=z.currentRoute.value.name)});const P=r(),B=r(),x=O(()=>B.value.hasChanges||P.value.hasChanges),_=r(!1),R=O(()=>_.value?C("Save order"):C("Reorder")),U=()=>{_.value=!_.value,!_.value&&P.value.hasChanges&&P.value.commitChanges()},L=async()=>{await B.value.commitChanges(),P.value.commitChanges()},q=()=>{B.value.rejectChanges(),P.value.rejectChanges(),M&&z.push(M),M=void 0};let M;const j=()=>{w.require({message:C("You have unsaved changes"),header:C("Profile editor"),icon:"pi pi-exclamation-triangle",rejectProps:{label:C("Ignore"),severity:"secondary",outlined:!0},acceptProps:{label:C("Save")},accept:()=>{L()},reject:()=>{q()}})},$=i=>{if(x.value)return M=i,j(),!1};return pe(async i=>{if($(i)===!1)return!1;_.value=!1;const{error:E,profile:v}=await V(i.params.uuid);if(E)return!1;if(!v.is_local&&i.name==="profile-pinned")return{name:"profile-all",params:{uuid:v.uuid}};if(i.meta?.contacts&&d(i.params.uuid)&&await u(i.name.split("-")[1],i.params.uuid))return!1;const N=`streams/${i.name}/${i.params.uuid}`,h=C("Posts from %{ name }",{name:v?.name||v?.finger});if(Y(i.name))T(i,{apiEndpoint:N,title:h});else if(await T(i,{apiEndpoint:N,title:h}))return!1}),he(i=>(_.value=!1,$(i))),(i,E)=>{const v=ne("router-link"),N=ne("router-view");return n(),S(me,null,[l.value?(n(),m(Ze,{key:0,ref_key:"profileEditor",ref:B,uuid:e.uuid},null,8,["uuid"])):b("",!0),o("div",et,[s(t(ze),{value:p.value,"onUpdate:value":[E[0]||(E[0]=h=>p.value=h),F],scrollable:"",pt:{root:"items-center"}},{default:c(()=>[s(t(Ue),{scrollable:"",pt:{activeBar:"z-0 border-b-4 border-emerald-600",tabList:"w-screen sm:w-full px-2 bg-inherit rounded"}},{default:c(()=>[s(t(D),{value:"profile-pinned",as:"div",disabled:!l.value.is_local,pt:{root:"text-stone-700 font-medium hover:bg-stone-300/80"}},{default:c(()=>[s(v,{to:{name:"profile-pinned",params:{uuid:e.uuid}}},{default:c(()=>[G(k(i.__("Pinned posts")),1)]),_:1},8,["to"])]),_:1},8,["disabled"]),s(t(D),{value:"profile-all",as:"div",pt:{root:"text-stone-700 font-medium hover:bg-stone-300/80"}},{default:c(()=>[s(v,{to:{name:"profile-all",params:{uuid:e.uuid}}},{default:c(()=>[G(k(i.__("All posts")),1)]),_:1},8,["to"])]),_:1}),s(t(D),{value:"profile-following",as:"div",disabled:!t(d)(e.uuid),pt:{root:"text-stone-700 font-medium hover:bg-stone-300/80"}},{default:c(()=>[s(v,{to:{name:"profile-following",params:{uuid:e.uuid}}},{default:c(()=>[G(k(i.__("Following")),1)]),_:1},8,["to"])]),_:1},8,["disabled"]),s(t(D),{value:"profile-followers",as:"div",disabled:!t(d)(e.uuid),pt:{root:"text-stone-700 font-medium hover:bg-stone-300/80"}},{default:c(()=>[s(v,{to:{name:"profile-followers",params:{uuid:e.uuid}}},{default:c(()=>[G(k(i.__("Followers")),1)]),_:1},8,["to"])]),_:1},8,["disabled"]),p.value==="profile-pinned"&&t(d)(e.uuid)?(n(),m(t(f),{key:0,text:"",class:"hidden justify-self-end whitespace-nowrap md:inline-flex",label:R.value,onClick:U,icon:"pi pi-sort-alt",disabled:_.value&&!P.value?.hasChanges},null,8,["label","disabled"])):b("",!0)]),_:1})]),_:1},8,["value"])]),o("div",tt,[s(N,{name:p.value.split("-")[1]},{default:c(({Component:h})=>[(n(),m(Me,null,[(n(),m(Re(h),{ref_key:"streamContainer",ref:P,draggable:_.value,streamName:p.value,key:p.value},null,8,["draggable","streamName"]))],1024))]),_:1},8,["name"])])],64)}}});export{ot as default};
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.