1"use strict";(self["webpackChunkclient"]=self["webpackChunkclient"]||[]).push([[667],{80667:function(e,t,i){i.r(t),i.d(t,{default:function(){return qe}});var s=i(20641),n=i(90033),o=i(53751);const a={class:"event-feed"},r={class:"icon is-small"},d={key:3,class:"event-feed__category-bar"},l={class:"icon is-small"},c=["onClick"],p=["aria-label"],h={class:"event-feed__skeleton-head"},m={class:"event-feed__skeleton-body"},u={class:"event-feed__skeleton-actions"},g={key:5,class:"event-feed__empty"},f=["id"],v=["title","aria-label","onClick"],y=["title"],C={class:"is-sr-only"},b=["title","aria-label","onClick"],k=["title","aria-label","onClick"],_=["onClick"],$={class:"icon is-small"},F={key:0,class:"discuss-card-like-count"},M={class:"event-feed__reaction-picker"},E=["title","onClick"],P={class:"icon"},w={key:0,class:"event-feed__comments"};function I(e,t,i,I,A,R){const L=(0,s.g2)("font-awesome-icon"),D=(0,s.g2)("DiscussCreateBar"),S=(0,s.g2)("EventFeedPostFormModal"),X=(0,s.g2)("b-skeleton"),T=(0,s.g2)("b-dropdown"),x=(0,s.g2)("DiscussionCardComfortable"),U=(0,s.g2)("EventFeedCommentNode"),O=(0,s.g2)("EventFeedCommentComposer"),V=(0,s.g2)("ReactionsModal");return(0,s.uX)(),(0,s.CE)("div",a,[R.isDetailView?((0,s.uX)(),(0,s.CE)("button",{key:0,type:"button",class:"button is-rounded event-feed__detail-back",onClick:t[0]||(t[0]=(...e)=>R.goBackToFeed&&R.goBackToFeed(...e))},[(0,s.Lk)("span",r,[(0,s.bF)(L,{icon:"fa-light fa-chevron-left"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Back to feed")),1)])):(0,s.Q3)("",!0),R.canPost&&!R.isDetailView?((0,s.uX)(),(0,s.Wv)(D,{key:1,"show-sort-bar":!1,onOpenCreateModal:R.onCreateBarAction},null,8,["onOpenCreateModal"])):(0,s.Q3)("",!0),(0,s.Lk)("input",{ref:"shortcutImagePicker",type:"file",accept:"image/*",multiple:"",hidden:"",onChange:t[1]||(t[1]=e=>R.onShortcutPicked(e))},null,544),(0,s.Lk)("input",{ref:"shortcutVideoPicker",type:"file",accept:"video/*",multiple:"",hidden:"",onChange:t[2]||(t[2]=e=>R.onShortcutPicked(e))},null,544),(0,s.Lk)("input",{ref:"shortcutFilePicker",type:"file",multiple:"",hidden:"",onChange:t[3]||(t[3]=e=>R.onShortcutPicked(e))},null,544),A.isPostModalVisible?((0,s.uX)(),(0,s.Wv)(S,{key:2,event:i.event,categories:A.categories,"initial-files":A.pendingFiles,"editing-post":A.editingPost,onPostCreated:R.onPostCreated,onPostUpdated:R.onPostUpdated,onPostDeleted:R.onPostDeleted,onCategoryCreated:R.onCategoryCreated,onClose:R.closePostModal},null,8,["event","categories","initial-files","editing-post","onPostCreated","onPostUpdated","onPostDeleted","onCategoryCreated","onClose"])):(0,s.Q3)("",!0),R.hasCategoryBar&&!R.isDetailView?((0,s.uX)(),(0,s.CE)("div",d,[(0,s.Lk)("button",{type:"button",class:(0,n.C4)(["event-feed__category-chip",{"is-active":"all"===A.activeFilter}]),onClick:t[4]||(t[4]=e=>R.setActiveFilter("all",e.currentTarget))},(0,n.v_)(e.$t("All")),3),(0,s.Lk)("button",{type:"button",class:(0,n.C4)(["event-feed__category-chip event-feed__category-chip--pinned",{"is-active":"pinned"===A.activeFilter}]),onClick:t[5]||(t[5]=e=>R.setActiveFilter("pinned",e.currentTarget))},[(0,s.Lk)("span",l,[(0,s.bF)(L,{icon:"fa-light fa-thumbtack"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Pinned")),1)],2),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(A.categories,e=>((0,s.uX)(),(0,s.CE)("button",{key:e.id,type:"button",class:(0,n.C4)(["event-feed__category-chip",{"is-active":A.activeFilter==="category:"+e.id}]),onClick:t=>R.setActiveFilter("category:"+e.id,t.currentTarget)},[e.color?((0,s.uX)(),(0,s.CE)("span",{key:0,class:"event-feed__category-chip-dot",style:(0,n.Tr)({background:e.color})},null,4)):(0,s.Q3)("",!0),(0,s.eW)(" "+(0,n.v_)(e.name),1)],10,c))),128))])):(0,s.Q3)("",!0),A.isLoading&&0===A.posts.length?((0,s.uX)(),(0,s.CE)("div",{key:4,class:"event-feed__skeleton","aria-busy":"true","aria-label":e.$t("Loading")},[((0,s.uX)(),(0,s.CE)(s.FK,null,(0,s.pI)(3,e=>(0,s.Lk)("div",{key:"sk-post-"+e,class:"event-feed__skeleton-card"},[(0,s.Lk)("div",h,[(0,s.bF)(X,{circle:"",width:"40px",height:"40px",animated:""})]),(0,s.Lk)("div",m,[(0,s.bF)(X,{width:"95%",height:"12px",animated:""}),(0,s.bF)(X,{width:"88%",height:"12px",animated:""}),(0,s.bF)(X,{width:"62%",height:"12px",animated:""})]),(0,s.Lk)("div",u,[(0,s.bF)(X,{width:"64px",height:"22px",animated:""}),(0,s.bF)(X,{width:"84px",height:"22px",animated:""}
1)])])),64))],8,p)):R.isDetailView||0!==A.posts.length?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("p",g,(0,n.v_)(e.$t("No posts yet.")),1)),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(R.displayedPosts,a=>((0,s.uX)(),(0,s.CE)("div",{id:"event-feed-post-"+a.id,key:a.id,class:"event-feed__post-wrapper"},[(0,s.bF)(x,{post:a,"to-route":"EventAppFeedPost","to-params":{item:e.$route.params.item,postId:a.id},"reactions-count":R.reactionsTotal(a),"posts-count":a.childrenCount||0,"force-expanded":R.isDetailView,onOpenDiscussion:e=>R.openPost(a),onReact:e=>R.quickReact(a),onOpenReactions:e=>R.openReactionsModal(a)},(0,s.eX)({"like-button":(0,s.k6)(({onClick:t,hasMyReaction:i,myReactionIcon:r,myReactionId:d,reactionsCount:l})=>[(0,s.bF)(T,{triggers:["hover"],"aria-role":"list",position:"is-top-right","mobile-modal":!0},{trigger:(0,s.k6)(()=>[(0,s.Lk)("div",{class:(0,n.C4)(["discuss-card-like-btn is-clickable",i?"reacted reaction-"+d:""]),onClick:(0,o.D$)(t,["stop"])},[(0,s.Lk)("span",$,[(0,s.bF)(L,{icon:r},null,8,["icon"])]),l>0?((0,s.uX)(),(0,s.CE)("span",F,(0,n.v_)(l),1)):(0,s.Q3)("",!0)],10,_)]),default:(0,s.k6)(()=>[(0,s.Lk)("div",M,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(R.reactionTypes,t=>((0,s.uX)(),(0,s.CE)("span",{key:"fr_"+t.id,class:(0,n.C4)(["event-feed__reaction-pick",["reaction-"+t.id,{"is-my-reaction":R.isMyReaction(a,t.id)}]]),title:e.$t(t.title),onClick:(0,o.D$)(e=>R.react(a,t),["stop"])},[(0,s.Lk)("span",P,[(0,s.bF)(L,{icon:t.icon},null,8,["icon"])])],10,E))),128))])]),_:2},1024)]),_:2},[a.eventFeedCategory?{name:"header-extra",fn:(0,s.k6)(()=>[t[7]||(t[7]=(0,s.Lk)("span",{class:"discuss-card-head-dot"},"·",-1)),(0,s.Lk)("span",{class:"event-feed__post-category",style:(0,n.Tr)(R.categoryChipStyle(a.eventFeedCategory))},(0,n.v_)(a.eventFeedCategory.name),5)]),key:"0"}:void 0,a.pinnedAt||R.canManagePins||R.canEditPost(a)?{name:"header-actions",fn:(0,s.k6)(()=>[a.pinnedAt&&R.canManagePins?((0,s.uX)(),(0,s.CE)("button",{key:0,type:"button",class:"event-feed__pinned-badge event-feed__pinned-badge--clickable",title:e.$t("Unpin"),"aria-label":e.$t("Unpin"),onClick:e=>R.togglePin(a)},[(0,s.bF)(L,{icon:"fa-light fa-thumbtack",class:"event-feed__pinned-badge-default"}),(0,s.bF)(L,{icon:"fa-light fa-thumbtack-slash",class:"event-feed__pinned-badge-hover"})],8,v)):a.pinnedAt?((0,s.uX)(),(0,s.CE)("span",{key:1,class:"event-feed__pinned-badge",title:e.$t("Pinned")},[(0,s.bF)(L,{icon:"fa-light fa-thumbtack"}),(0,s.Lk)("span",C,(0,n.v_)(e.$t("Pinned")),1)],8,y)):R.canManagePins?((0,s.uX)(),(0,s.CE)("button",{key:2,type:"button",class:"event-feed__post-action-btn",title:e.$t("Pin"),"aria-label":e.$t("Pin"),onClick:e=>R.togglePin(a)},[(0,s.bF)(L,{icon:"fa-light fa-thumbtack"})],8,b)):(0,s.Q3)("",!0),R.canEditPost(a)?((0,s.uX)(),(0,s.CE)("button",{key:3,type:"button",class:"event-feed__post-action-btn",title:e.$t("Edit"),"aria-label":e.$t("Edit"),onClick:e=>R.editPost(a)},[(0,s.bF)(L,{icon:"fa-light fa-pen"})],8,k)):(0,s.Q3)("",!0)]),key:"1"}:void 0]),1032,["post","to-params","reactions-count","posts-count","force-expanded","onOpenDiscussion","onReact","onOpenReactions"]),A.openReplies[a.id]?((0,s.uX)(),(0,s.CE)("div",w,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(A.replies[a.id]||[],e=>((0,s.uX)(),(0,s.Wv)(U,{key:e.id,comment:e,"parent-post":a,reactions:R.reactions,"event-id":i.event&&i.event.id,"replies-map":A.replies,"auto-expand":R.isDetailView},null,8,["comment","parent-post","reactions","event-id","replies-map","auto-expand"]))),128)),(0,s.bF)(O,{ref_for:!0,ref:e=>R.registerComposerRef(a.id,e),"parent-id":a.id,"avatar-size":"roundSmall",class:(0,n.C4)({"event-feed__comment-composer--sticky":R.isDetailView}),onReplySaved:e=>R.onReplySaved(a,e)},null,8,["parent-id","class","onReplySaved"])])):(0,s.Q3)("",!0)],8,f))),128)),(0,s.bF)(V,{"is-active":A.isReactionsModalActive,reactions:R.reactions,"reaction-data":A.reactionsListData,"onUpdate:isActive":t[6]||(t[6]=e=>A.isReactionsModalActive=e)},null,8,["is-active","reactions","reaction-data"])])}i(44114),i(18111),i(22489),i(20116),i(7588),i(18237);var A=i(40834),R=i(60770),L=i(9044),D=i(19328),S=i(28782),X={computed:{...(0,A.L8)(["user","tenant"])},methods:{feedMercureDiscovery(){if("undefined"!==typeof S.uW&&!1===S.uW)return;if(!1===this.tenant?.settingFeatures?.realtime?.isActive)return;if(!this.feedEventId)return;if("contact"===this.user?.kind)return;const e="event_feed_"+this.feedEventId;this.$http.plain.get("/mercure-token/"+e).then(e=>{this.feedMercureSubscribe(e.data)}).catch(e=>console.log(e))},feedMercureSubscribe(e){this.$store.commit("resetEventSource"),this.$store.commit("initEventSource",{token:e.token,hubUrl:e.hubUrl,topic:"event_feed_"+this.feedEventId}),this.$store.state.currentMercureEvent.onmessage=e=>{this.handleFeedMercureMessage(e)}},handleFeedMercureMessage(e){let t;try{t=JSON.parse(e.data)}catch(i){return void console.log("Invalid event feed Mercure message:",i)}t&&"object"===typeof t&&t.action&&("new_post"===t.action?this.feedHandleNewPost(t):"new_reply"===t.action?this.feedHandleNewReply(t):"reaction"===t.action?this.feedHandleReaction(t):"pinned"!==t.action&&"unpinned"!==t.action||this.feedHandlePinChange(t))},feedHandlePinChange(e){const t=this.posts.find(t=>
1t.id===e.postId);t&&(t.pinnedAt=e.pinnedAt||null,"function"===typeof this.resortPosts&&this.resortPosts())},feedHandleNewPost(e){this.posts.find(t=>t.id===e.postId)||this.$http.plain.get("/event-feed-posts/"+e.postId).then(e=>{this.posts.find(t=>t.id===e.data.id)||this.posts.unshift(e.data)}).catch(e=>console.log(e))},feedHandleNewReply(e){const t=e.parentId;if(!t)return;const i=this.posts.find(e=>e.id===t);i&&this.$http.plain.get("/event-feed-posts/"+e.postId).then(e=>{this.replies[t]||(this.replies[t]=[]),this.replies[t].find(t=>t.id===e.data.id)||(this.replies[t].push(e.data),i.childrenCount=(i.childrenCount||0)+1)}).catch(e=>console.log(e))},feedHandleReaction(e){const t=this.posts.find(t=>t.id===e.postId);if(t)t.reactionData=e.reactionData;else for(const i in this.replies){const t=this.replies[i].find(t=>t.id===e.postId);if(t)return void(t.reactionData=e.reactionData)}}}};const T={class:"event-feed-post-modal__category-field"},x={class:"event-feed-post-modal__field-label"},U={class:"event-feed-post-modal__field-label-hint"},O={class:"event-feed-post-modal__category-chips"},V=["onClick"],j=["title","aria-label"],N={key:1,class:"event-feed-post-modal__category-input-wrap"},B=["placeholder","disabled"],K=["disabled","aria-label"],Q=["aria-label","disabled"],W={class:"icon"},z={class:"event-feed-post-modal__posting-in"};function G(e,t,i,a,r,d){const l=(0,s.g2)("font-awesome-icon"),c=(0,s.g2)("b-tooltip"),p=(0,s.g2)("BaseFormModal"),h=(0,s.g2)("b-modal");return(0,s.uX)(),(0,s.Wv)(h,{"model-value":!0,"has-modal-card":"","full-screen":e.$isMobile(),"can-cancel":["escape","outside","x"],class:(0,n.C4)({"event-feed-post-modal":!0,"has-media":r.hasMedia}),"onUpdate:modelValue":d.onModalVisibilityChange},{default:(0,s.k6)(()=>[(0,s.bF)(p,{ref:"baseModal","title-placeholder":d.titlePlaceholder,"default-title":d.modalTitle,"save-button-text":d.saveButtonText,"title-required":!1,"fullscreen-storage-key":"eventFeedPostFormModalFullscreen",onSave:d.savePost,onClose:d.emitClose,onInlineMentionsChanged:d.onInlineMentionsChanged},(0,s.eX)({"additional-fields":(0,s.k6)(()=>[(0,s.Lk)("div",T,[(0,s.Lk)("label",x,[(0,s.eW)((0,n.v_)(e.$t("Category"))+" ",1),(0,s.Lk)("span",U,(0,n.v_)(e.$t("optional")),1)]),(0,s.Lk)("div",O,[(0,s.Lk)("button",{type:"button",class:(0,n.C4)(["event-feed-post-modal__category-chip",{"is-active":null===r.selectedCategoryId}]),onClick:t[0]||(t[0]=e=>d.selectCategory(null))},(0,n.v_)(e.$t("None")),3),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.categories,e=>((0,s.uX)(),(0,s.CE)("button",{key:e.id,type:"button",class:(0,n.C4)(["event-feed-post-modal__category-chip",{"is-active":r.selectedCategoryId===e.id}]),onClick:t=>d.selectCategory(e.id)},[e.color?((0,s.uX)(),(0,s.CE)("span",{key:0,class:"event-feed-post-modal__category-chip-dot",style:(0,n.Tr)({background:e.color})},null,4)):(0,s.Q3)("",!0),(0,s.eW)(" "+(0,n.v_)(e.name),1)],10,V))),128)),r.isAddingCategory?((0,s.uX)(),(0,s.CE)("div",N,[(0,s.bo)((0,s.Lk)("input",{ref:"categoryInput","onUpdate:modelValue":t[2]||(t[2]=e=>r.newCategoryName=e),type:"text",class:"event-feed-post-modal__category-input",placeholder:e.$t("New categoryâ¦"),disabled:r.isCreatingCategory,onKeydown:[t[3]||(t[3]=(0,o.jR)((0,o.D$)((...e)=>d.createCategory&&d.createCategory(...e),["prevent"]),["enter"])),t[4]||(t[4]=(0,o.jR)((0,o.D$)((...e)=>d.cancelCategoryInput&&d.cancelCategoryInput(...e),["prevent"]),["esc"]))],onBlur:t[5]||(t[5]=(...e)=>d.onCategoryInputBlur&&d.onCategoryInputBlur(...e))},null,40,B),[[o.Jo,r.newCategoryName]]),(0,s.Lk)("button",{type:"button",class:"event-feed-post-modal__category-input-submit",disabled:!d.canCreateCategory,"aria-label":e.$t("Add"),onMousedown:t[6]||(t[6]=(0,o.D$)(()=>{},["prevent"])),onClick:t[7]||(t[7]=(...e)=>d.createCategory&&d.createCategory(...e))},[(0,s.bF)(l,{icon:r.isCreatingCategory?"fa-light fa-spinner":"fa-light fa-check",spin:r.isCreatingCategory},null,8,["icon","spin"])],40,K)])):((0,s.uX)(),(0,s.CE)("button",{key:0,type:"button",class:"event-feed-post-modal__category-add-btn",title:e.$t("Add category"),"aria-label":e.$t("Add category"),onClick:t[1]||(t[1]=(...e)=>d.openCategoryInput&&d.openCategoryInput(...e))},[(0,s.bF)(l,{icon:"fa-light fa-plus"})],8,j))])])]),"footer-right":(0,s.k6)(()=>[(0,s.Lk)("span",z,[(0,s.Lk)("span",null,[(0,s.eW)((0,n.v_)(e.$t("Posting in"))+": ",1),(0,s.Lk)("strong",null,(0,n.v_)(i.event?i.event.name:""),1)])])]),_:2},[d.isEditing?{name:"footer-before-save",fn:(0,s.k6)(()=>[(0,s.bF)(c,{label:e.$t("Delete post"),position:"is-top"},{default:(0,s.k6)(()=>[(0,s.Lk)("button",{type:"button",class:"button is-rounded is-danger is-outlined event-feed-post-modal__delete-btn","aria-label":e.$t("Delete post"),disabled:r.isDeleting,onClick:t[8]||(t[8]=(...e)=>d.confirmDelete&&d.confirmDelete(...e))},[(0,s.Lk)("span",W,[(0,s.bF)(l,{icon:r.isDeleting?"fa-light fa-spinner":"fa-light fa-trash",spin:r.isDeleting},null,8,["icon","spin"])])],8,Q)]),_:1},8,["label"])]),key:"0"}:void 0]),1032,["title-placeholder","default-title","save-button-text","onSave","onClose","onInlineMentionsChanged"])]),_:1},8,["full-screen","class","onUpdate:modelValue"])}var q=i(72623),H={name:"EventFeedPostFormModal",components:{BaseFormModal:q.A},props:{event:{type:Object,required:!0},categories:{type:Array,default:()=>[]},initialFiles:{type:Array,default:()=>[]},editingPost:{type:Object,default:null}},emits:["post-created","post-updated","post-deleted","category-created","close"],data(){return{inlineMentions:[],hasMedia:!1,selectedCategoryId:null,newCategoryName:"",isCreatingCategory:!1,isAddingCategory:!1,isDeleting:!1}},computed:{isEditing(){return!(!this.editingPost||!this.editingPost.id)},titlePlaceholder(){return this.$t("Title")+" ("+this.$t("optional")+")"},modalTitle(){return this.isEditing?this.$t("modify"):this.$t("Create post")},saveButtonText(){return this.isEditing?this.$t("save"):this.$t("post")},canCreateCategory(){return!this.isCreatingCategory&&(this.newCategoryName||"").trim().length>0}},mounted(){if(this.$refs.baseModal){const e=this.isEditing?this.editInitData():{title:null,content:null,medias:[],uploadedMedia:[],removedMedia:[],openGraphEmbed:null};this.$refs.baseModal.initItem(e)}this.isEditing&&this.editingPost.eventFeedCategory&&(this.selectedCategoryId=this.editingPost.eventFeedCategory.id||null),Array.isArray(this.initialFiles)&&this.initialFiles.length>0&&this.$nextTick(()=>{const e=this.$refs.baseModal&&this.$refs.baseModal.$refs.mediaUpload;e&&"function"===typeof e.addExternalFiles&&e.addExternalFiles(this.initialFiles,!1)}),this.$watch(()=>{const e=this.$refs.baseModal&&this.$refs.baseModal.itemData;if(!e)return 0;const t=Array.isArray(e.uploadedMedia)?e.uploadedMedia.length:0,i=Array.isArray(e.medias)?e.medias.length:0;return t+i},e=>{this.hasMedia=e>0},{immediate:!0})},methods:{emitClose(){this.$emit("close")},onModalVisibilityChange(e){e||this.emitClose()},onInlineMentionsChanged(e){this.inlineMentions=Array.isArray(e)?[...e]:[]},editInitData(){const e=this.editingPost||{},t=e.content||"",i=t.match(/^<strong>([^<]+)<\/strong>(?:\n\n|<br\s*\/?>(?:\s*<br\s*\/?>)?)?/i);let s=null,n=t;return i&&(s=i[1],n=t.slice(i[0].length)),{title:s,content:n,medias:Array.isArray(e.medias)?[...e.medias]:[],uploadedMedia:[],removedMedia:[],openGraphEmbed:e.embedOpenGraph?e.embedOpenGraph.id:null}},selectCategory(e){this.selectedCategoryId=e},openCategoryInput(){this.isAddingCategory=!0,this.$nextTick(()=>{this.$refs.categoryInput&&this.$refs.categoryInput.focus()})},cancelCategoryInput(){this.isAddingCategory=!1,this.newCategoryName=""},onCategoryInputBlur(){setTimeout(()=>{this.newCategoryName.trim()||this.isCreatingCategory||(this.isAddingCategory=!1)},120)},createCategory(){this.canCreateCategory&&(this.isCreatingCategory=!0,this.$http.plain.post("/event-feed-categories",{event:this.event.id,name:this.newCategoryName.trim()}).then(e=>{this.$emit("category-created",e.data),this.selectedCategoryId=e.data.id,this.newCategoryName="",this.isAddingCategory=!1}).catch(e=>
1{console.log(e),this.$buefy.toast.open({message:this.$t("Could not create category."),type:"is-danger"})}).finally(()=>{this.isCreatingCategory=!1}))},ensurePendingCategoryCreated(){if(!this.isAddingCategory)return Promise.resolve();const e=(this.newCategoryName||"").trim();return e?(this.isCreatingCategory=!0,this.$http.plain.post("/event-feed-categories",{event:this.event.id,name:e}).then(e=>{this.$emit("category-created",e.data),this.selectedCategoryId=e.data.id,this.newCategoryName="",this.isAddingCategory=!1}).finally(()=>{this.isCreatingCategory=!1})):Promise.resolve()},savePost(e){this.$refs.baseModal.setLoading(!0),Promise.resolve().then(()=>this.$refs.baseModal.uploadMedia("postimage")).then(()=>this.$refs.baseModal.uploadMedia("postvideo")).then(()=>this.$refs.baseModal.uploadMedia("postfile")).then(()=>this.ensurePendingCategoryCreated()).then(()=>{const t=this.$refs.baseModal.$refs.mediaUpload?.removedMedia||[];if(this.isEditing){const i={title:e.title||null,content:e.content||"",uploadedMedia:e.uploadedMedia||[],removedMedia:t,openGraphEmbed:e.openGraphEmbed||null,eventFeedCategory:this.selectedCategoryId};return this.$http.plain.patch("/event-feed-posts/"+this.editingPost.id+"/edit",i,{headers:{"Content-Type":"application/merge-patch+json"}})}const i={event:this.event.id,title:e.title||null,content:e.content||"",uploadedMedia:e.uploadedMedia||[],removedMedia:t,mentions:[...this.inlineMentions],openGraphEmbed:e.openGraphEmbed||null,eventFeedCategory:this.selectedCategoryId};return this.$http.plain.post("/event-feed-posts",i)}).then(e=>{this.$buefy.snackbar.open({message:this.$t("saved")}),this.isEditing?this.$emit("post-updated",e.data):this.$emit("post-created",e.data),this.emitClose()}).catch(e=>{console.log(e);const t=e?.response?.data?.detail||e?.response?.data?.["hydra:description"]||this.$t("Could not publish the post.");this.$buefy.snackbar.open({message:t,type:"is-danger",position:"is-top",actionText:this.$t("Close"),duration:6e3})}).finally(()=>{this.$refs.baseModal&&this.$refs.baseModal.setLoading(!1)})},confirmDelete(){if(!this.isEditing||this.isDeleting)return;this.$refs.baseModal&&this.$refs.baseModal.setBypassDirtyCheck(!0);const e=()=>{this.$refs.baseModal&&this.$refs.baseModal.setBypassDirtyCheck(!1)};this.$buefy.dialog.confirm({title:this.$t("Delete post"),message:this.$t("Are you sure you want to delete this post?"),confirmText:this.$t("delete"),cancelText:this.$t("Cancel"),type:"is-danger",hasIcon:!0,onConfirm:()=>this.deletePost(),onCancel:e})},deletePost(){this.isDeleting=!0,this.$refs.baseModal&&this.$refs.baseModal.setLoading(!0);const e=this.editingPost.id;this.$http.plain.delete("/event-feed-posts/"+e).then(()=>{this.$buefy.snackbar.open({message:this.$t("Post deleted")}),this.$emit("post-deleted",{id:e}),this.emitClose()}).catch(e=>{console.log(e);const t=e?.response?.data?.detail||this.$t("Could not delete the post.");this.$buefy.snackbar.open({message:t,type:"is-danger",position:"is-top",actionText:this.$t("Close"),duration:6e3})}).finally(()=>{this.isDeleting=!1,this.$refs.baseModal&&this.$refs.baseModal.setLoading(!1)})}}},J=i(66262);const Z=(0,J.A)(H,[["render",G],["__scopeId","data-v-5fa4d453"]]);var Y=Z;const ee={class:"event-feed__comment-body"},te={class:"event-feed__comment-main"},ie={key:0,class:"event-feed__comment-bubble"},se={class:"event-feed__comment-bubble-head"},ne={class:"event-feed__comment-author"},oe={key:0,class:"event-feed__comment-author-tag"},ae=["title","aria-label"],re={class:"event-feed__comment-time"},de={key:0,class:"event-feed__comment-content"},le={key:1,class:"event-feed__comment-gallery"},ce={key:0,class:"event-feed__comment-gallery-item"},pe=["href"],he=["src","alt"],me={key:2,class:"event-feed__comment-files"},ue={key:0,class:"event-feed__comment-file"},ge=["href"],fe={key:2,class:"event-feed__comment-actions"},ve={class:"event-feed__reaction-picker"},ye=["title","onClick"],Ce={class:"icon"},be={class:"is-small"},ke={class:"event-feed__comment-reactions-total"},_e={key:0,class:"event-feed__nested-comments"},$e=["title","aria-label"],Fe={class:"event-feed__thread-collapse-dot event-feed__thread-collapse-dot--inline"},Me={class:"event-feed__thread-collapsed-text"};function Ee(e,t,i,a,r,d){const l=(0,s.g2)("LogoThumbnail"),c=(0,s.g2)("font-awesome-icon"),p=(0,s.g2)("EventFeedCommentComposer"),h=(0,s.g2)("b-dropdown"),m=(0,s.g2)("EventFeedCommentNode",!0),u=(0,s.g2)("ReactionsModal"),g=(0,s.gN)("safe-html");return(0,s.uX)(),(0,s.CE)("div",{class:(0,n.C4)(["event-feed__comment",{"event-feed__comment--has-thread":d.children.length>0&&r.expanded,"event-feed__comment--thread-collapsed":d.children.length>0&&r.expanded&&r.threadCollapsed,"event-feed__comment--nested":i.depth>=2}])},[(0,s.bF)(l,{item:d.commentOwner,"is-type":d.avatarSize},null,8,["item","is-type"]),(0,s.Lk)("div",ee,[(0,s.Lk)("div",te,[r.isEditing?((0,s.uX)(),(0,s.Wv)(p,{key:1,class:"event-feed__comment-composer--inline event-feed__comment-composer--edit",mode:"edit","post-id":i.comment.id,"parent-id":i.comment.id,"initial-content":i.comment.content||"","initial-medias":d.commentMedias,"auto-focus":!0,"avatar-size":d.avatarSize,"hide-avatar":!0,onUpdated:d.onCommentUpdated,onCancel:d.cancelEdit},null,8,["post-id","parent-id","initial-content","initial-medias","avatar-size","onUpdated","onCancel"])):((0,s.uX)(),(0,s.CE)("div",ie,[(0,s.Lk)("div",se,[(0,s.Lk)("span",ne,(0,n.v_)(d.ownerFullName),1),d.isPostAuthor?((0,s.uX)(),(0,s.CE)("span",oe," · "+(0,n.v_)(e.$t("Author")),1)):(0,s.Q3)("",!0),d.canEditSelf?((0,s.uX)(),(0,s.CE)("button",{key:1,type:"button",class:"event-feed__comment-menu-btn",t
1itle:e.$t("Edit"),"aria-label":e.$t("Edit"),onClick:t[0]||(t[0]=(...e)=>d.startEdit&&d.startEdit(...e))},[(0,s.bF)(c,{icon:"fa-light fa-ellipsis"})],8,ae)):(0,s.Q3)("",!0)]),(0,s.Lk)("div",re,(0,n.v_)(e.$filters.format(i.comment.dateCreated,"HH:mm")),1),i.comment.content?(0,s.bo)(((0,s.uX)(),(0,s.CE)("div",de,null,512)),[[g,d.renderedContent]]):(0,s.Q3)("",!0),d.hasMediaImages?((0,s.uX)(),(0,s.CE)("div",le,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(d.commentMedias,t=>((0,s.uX)(),(0,s.CE)(s.FK,{key:"img_"+t.id},["postimage"===t.type?((0,s.uX)(),(0,s.CE)("figure",ce,[(0,s.Lk)("a",{href:d.mediaSrc(t),target:"_blank",rel:"noopener noreferrer"},[(0,s.Lk)("img",{src:d.mediaSrc(t),alt:e.$t("Attachment")},null,8,he)],8,pe)])):(0,s.Q3)("",!0)],64))),128))])):(0,s.Q3)("",!0),d.hasMediaFiles?((0,s.uX)(),(0,s.CE)("div",me,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(d.commentMedias,t=>((0,s.uX)(),(0,s.CE)(s.FK,{key:"file_"+t.id},["postfile"===t.type?((0,s.uX)(),(0,s.CE)("p",ue,[(0,s.bF)(c,{icon:"fa-light fa-file"}),(0,s.Lk)("a",{href:d.mediaSrc(t),target:"_blank",rel:"noopener noreferrer"},(0,n.v_)(t.originalName||e.$t("Attachment")),9,ge)])):(0,s.Q3)("",!0)],64))),128))])):(0,s.Q3)("",!0)])),r.isEditing?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",fe,[(0,s.bF)(h,{triggers:["hover"],"aria-role":"list",position:"is-top-right","mobile-modal":!0},{trigger:(0,s.k6)(()=>[(0,s.Lk)("span",{class:(0,n.C4)(["event-feed__comment-action-link",[{"is-active":d.hasMyReaction},d.myReactionClass]]),onClick:t[1]||(t[1]=(...e)=>d.quickReact&&d.quickReact(...e))},(0,n.v_)(d.hasMyReaction?e.$t("Liked"):e.$t("Like")),3)]),default:(0,s.k6)(()=>[(0,s.Lk)("div",ve,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.reactions,t=>((0,s.uX)(),(0,s.CE)("span",{key:"r_"+t.id,class:(0,n.C4)(["event-feed__reaction-pick",["reaction-"+t.id,{"is-my-reaction":d.isMyReaction(t.id)}]]),title:e.$t(t.title),onClick:e=>d.react(t)},[(0,s.Lk)("span",Ce,[(0,s.bF)(c,{icon:t.icon},null,8,["icon"])])],10,ye))),128))])]),_:1}),t[8]||(t[8]=(0,s.Lk)("span",{class:"event-feed__comment-action-sep"},"|",-1)),(0,s.Lk)("span",{class:(0,n.C4)(["event-feed__comment-action-link",{"is-active":r.inlineComposerOpen}]),onClick:t[2]||(t[2]=(...e)=>d.toggleInlineComposer&&d.toggleInlineComposer(...e))},(0,n.v_)(e.$t("Reply")),3),d.reactionsTotal>0?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[t[7]||(t[7]=(0,s.Lk)("span",{class:"event-feed__comment-action-sep-dot"},"·",-1)),(0,s.Lk)("span",{class:"event-feed__comment-reactions-inline",onClick:t[3]||(t[3]=(...e)=>d.openReactionsModal&&d.openReactionsModal(...e))},[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.reactions,e=>((0,s.uX)(),(0,s.CE)(s.FK,{key:"rb_"+e.id},[i.comment.reactionData&&i.comment.reactionData[e.id]>0?((0,s.uX)(),(0,s.CE)("span",{key:0,class:(0,n.C4)(["event-feed__reaction-badge","reaction-"+e.id])},[(0,s.Lk)("span",be,[(0,s.bF)(c,{icon:e.icon},null,8,["icon"])])],2)):(0,s.Q3)("",!0)],64))),128)),(0,s.Lk)("span",ke,(0,n.v_)(d.reactionsTotal),1)])],64)):(0,s.Q3)("",!0)])),(0,s.bF)(o.eB,{name:"slide-reply"},{default:(0,s.k6)(()=>[r.inlineComposerOpen?((0,s.uX)(),(0,s.Wv)(p,{key:0,class:"event-feed__comment-composer--inline","parent-id":i.comment.id,"auto-focus":!0,"avatar-size":d.avatarSize,onReplySaved:d.onSubReplySaved},null,8,["parent-id","avatar-size","onReplySaved"])):(0,s.Q3)("",!0)]),_:1})]),d.children.length>0&&r.expanded?((0,s.uX)(),(0,s.CE)("div",_e,[r.threadCollapsed?((0,s.uX)(),(0,s.CE)("button",{key:1,type:"button",class:"event-feed__thread-collapsed-row",onClick:t[5]||(t[5]=e=>r.threadCollapsed=!1)},[(0,s.Lk)("span",Fe,[(0,s.bF)(c,{icon:"fa-light fa-plus"})]),(0,s.Lk)("span",Me,(0,n.v_)(d.expandedToggleLabel),1)])):((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[(0,s.Lk)("button",{type:"button",class:"event-feed__thread-collapse-dot",title:e.$t("Collapse"),"aria-label":e.$t("Collapse"),onClick:t[4]||(t[4]=e=>r.threadCollapsed=!0)},[(0,s.bF)(c,{icon:"fa-light fa-minus"})],8,$e),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(d.children,e=>((0,s.uX)(),(0,s.Wv)(m,{key:e.id,comment:e,"parent-post":i.parentPost,reactions:i.reactions,depth:i.depth+1,"event-id":i.eventId,"replies-map":i.repliesMap,"auto-expand":i.autoExpand},null,8,["comment","parent-post","reactions","depth","event-id","replies-map","auto-expand"]))),128))],64))])):(0,s.Q3)("",!0)]),(0,s.bF)(u,{"is-active":r.isReactionsModalActive,reactions:i.reactions,"reaction-data":r.reactionsListData,"onUpdate:isActive":t[6]||(t[6]=e=>r.isReactionsModalActive=e)},null,8,["is-active","reactions","reaction-data"])],2)}i(13579);var Pe=i(31823);const we={class:"event-feed__comment-composer"},Ie={class:"event-feed__comment-composer-pill"},Ae={class:"event-feed__comment-composer-pill-row"},Re=["placeholder","disabled"],Le={key:0,class:"event-feed__comment-composer-icons"},De=["aria-label"],Se=["disabled","aria-label"],Xe={key:0,class:"event-feed__comment-composer-actions"};function Te(e,t,i,a,r,d){const l=(0,s.g2)("LogoThumbnail"),c=(0,s.g2)("font-awesome-icon"),p=(0,s.g2)("EmojiPicker"),h=(0,s.g2)("MediaUpload");return(0,s.uX)(),(0,s.CE)("div",we,[i.hideAvatar?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.Wv)(l,{key:0,item:e.user,"is-type":i.avatarSize},null,8,["item","is-type"])),(0,s.Lk)("div",Ie,[(0,s.Lk)("div",Ae,[(0,s.bo)((0,s.Lk)("input",{ref:"input","onUpdate:modelValue":t[0]||(t[0]=e=>r.draft=e),type:"text",class:"event-feed__comment-composer-input",placeholder:e.$t("Write a commentâ¦"),disabled:r.submitting,onFocus:t[1]||(t[1]=(...e)=>d.onFocus&&d.onFocus(...e)),onBlur:t[2]||(t[2]=(...e)=>d.onBlur&&d.onBlur(...e)),onKeydown:[t[3]||(t[3]=(0,o.jR)((0,o.D$)((...e)=>d.submit&&d.submit(...e),["prevent"]),["enter"])),t[4]||(t[4]=(0,o.jR)((0,o.D$)((...e)=>d.onEsc&&d.onEsc(...e),["prevent"]),["esc"]))]},null,40,Re),[[o.Jo,r.draft]]),(0,s.bF)(o.eB,{name:"fade-icons"},{default:(0,s.k6)(()=>[d.isExpanded?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",Le,[(0,s.Lk)("span",{class:"event-feed__comment-composer-icon",onMousedown:t[5]||(t[5]=(0,o.D$)(()=>{},["prevent"])),onClick:t[6]||(t[6]=e=>d.toggleEmojiPicker("right"))},[(0,s.bF)(c,{icon:"fa-light fa-smile"})],32),(0,s.Lk)("span",{class:"event-feed__comment-composer-icon",onMousedown:t[7]||(t[7]=(0,o.D$)(()=>{},["prevent"])),onClick:t[8]||(t[8]=(...e)=>d.triggerPhotoUpload&&d.triggerPhotoUpload(...e))},[(0,s.bF)(c,{icon:"fa-light fa-image"})],32),(0,s.Lk)("span",{class:"event-feed__comment-composer-icon",onMousedown:t[9]||(t[9]=(0,o.D$)(()=>{}
1,["prevent"])),onClick:t[10]||(t[10]=(...e)=>d.triggerFileUpload&&d.triggerFileUpload(...e))},[(0,s.bF)(c,{icon:"fa-light fa-folder"})],32)]))]),_:1}),"edit"===i.mode?((0,s.uX)(),(0,s.CE)("button",{key:0,type:"button",class:"event-feed__comment-composer-send event-feed__comment-composer-send--cancel","aria-label":e.$t("Cancel"),onMousedown:t[11]||(t[11]=(0,o.D$)(()=>{},["prevent"])),onClick:t[12]||(t[12]=(...e)=>d.cancel&&d.cancel(...e))},[(0,s.bF)(c,{icon:"fa-light fa-xmark"})],40,De)):(0,s.Q3)("",!0),(0,s.Lk)("button",{type:"button",class:"event-feed__comment-composer-send",disabled:!d.canSubmit,"aria-label":e.$t("Send"),onClick:t[13]||(t[13]=(...e)=>d.submit&&d.submit(...e))},[r.submitting?((0,s.uX)(),(0,s.Wv)(c,{key:1,icon:"fa-light fa-spinner",spin:""})):((0,s.uX)(),(0,s.Wv)(c,{key:0,icon:"fa-light fa-paper-plane"}))],8,Se)]),(0,s.bF)(o.eB,{name:"slide-actions"},{default:(0,s.k6)(()=>[d.isExpanded?((0,s.uX)(),(0,s.CE)("div",Xe,[(0,s.Lk)("span",{class:"event-feed__comment-composer-icon",onMousedown:t[14]||(t[14]=(0,o.D$)(()=>{},["prevent"])),onClick:t[15]||(t[15]=e=>d.toggleEmojiPicker("left"))},[(0,s.bF)(c,{icon:"fa-light fa-smile"})],32),(0,s.Lk)("span",{class:"event-feed__comment-composer-icon",onMousedown:t[16]||(t[16]=(0,o.D$)(()=>{},["prevent"])),onClick:t[17]||(t[17]=(...e)=>d.triggerPhotoUpload&&d.triggerPhotoUpload(...e))},[(0,s.bF)(c,{icon:"fa-light fa-image"})],32),(0,s.Lk)("span",{class:"event-feed__comment-composer-icon",onMousedown:t[18]||(t[18]=(0,o.D$)(()=>{},["prevent"])),onClick:t[19]||(t[19]=(...e)=>d.triggerFileUpload&&d.triggerFileUpload(...e))},[(0,s.bF)(c,{icon:"fa-light fa-folder"})],32)])):(0,s.Q3)("",!0)]),_:1}),r.showEmojiPicker&&!e.$isMobile()?((0,s.uX)(),(0,s.CE)("div",{key:0,class:"emoji-picker-backdrop",onClick:t[20]||(t[20]=e=>r.showEmojiPicker=!1)})):(0,s.Q3)("",!0),r.showEmojiPicker&&!e.$isMobile()?((0,s.uX)(),(0,s.Wv)(p,{key:1,native:!0,class:(0,n.C4)(["emoji-picker",{"emoji-picker-left":"left"===r.emojiSide,"emoji-picker-right":"right"===r.emojiSide}]),theme:e.$store.state.theme,onSelect:d.onEmojiSelect},null,8,["class","theme","onSelect"])):(0,s.Q3)("",!0),(0,s.bF)(h,{ref:"mediaUpload",item:null,medias:r.mediasState,"is-comment":!0,"is-dragging":r.isDragging,"hide-buttons":!0,"onUpdate:modelValue":d.onMediaUpload,onSelectionChanged:d.onSelectionChanged},null,8,["medias","is-dragging","onUpdate:modelValue","onSelectionChanged"])])])}var xe=i(86827),Ue=i(51114),Oe={name:"EventFeedCommentComposer",components:{LogoThumbnail:Pe.A,MediaUpload:xe.A,EmojiPicker:Ue.A},props:{parentId:{type:Number,required:!0},autoFocus:{type:Boolean,default:!1},avatarSize:{type:String,default:"roundSmall"},hideAvatar:{type:Boolean,default:!1},mode:{type:String,default:"reply"},postId:{type:Number,default:null},initialContent:{type:String,default:""},initialMedias:{type:Array,default:()=>[]}},emits:["reply-saved","updated","cancel"],data(){return{draft:"edit"===this.mode&&this.initialContent||"",mediasState:[...this.initialMedias||[]],submitting:!1,isFocused:!1,isDragging:!1,showEmojiPicker:!1,emojiSide:"right",selectionTick:0}},computed:{...(0,A.L8)(["user"]),isExpanded(){return this.isFocused||(this.draft||"").length>0},canSubmit(){this.selectionTick;const e=(this.draft||"").trim().length>0,t=this.$refs.mediaUpload,i=!!t&&t.photos.length+t.files.length+t.uploadedMedia.length>0,s=this.mediasState.length>0;return!this.submitting&&(e||i||s)},removedMediaIds(){return this.$refs.mediaUpload?.removedMedia||[]}},mounted(){this.autoFocus&&this.$nextTick(()=>this.focusInput())},methods:{focusInput(){this.$refs.input?.focus()},scrollIntoView(){const e=this.$el;e&&"function"===typeof e.scrollIntoView&&e.scrollIntoView({behavior:"smooth",block:"center"})},onFocus(){this.isFocused=!0},onBlur(){setTimeout(()=>{this.isFocused=!1},80)},onEsc(){"edit"===this.mode&&this.cancel()},toggleEmojiPicker(e){this.emojiSide=e||"right",this.showEmojiPicker=!this.showEmojiPicker,this.showEmojiPicker&&this.$nextTick(()=>this.focusInput())},onEmojiSelect(e){this.draft=(this.draft||"")+(e?.i||"")},triggerPhotoUpload(){this.$refs.mediaUpload?.triggerPhotoUpload()},triggerFileUpload(){this.$refs.mediaUpload?.triggerFileUpload()},onMediaUpload(){this.selectionTick++},onSelectionChanged(){this.selectionTick++},cancel(){this.$emit("cancel")},submit(){if(!this.canSubmit)return;this.submitting=!0;const e=(this.draft||"").trim();Promise.resolve().then(()=>this.$refs.mediaUpload?this.$refs.mediaUpload.uploadMedia("postimage"):null).then(()=>this.$refs.mediaUpload?this.$refs.mediaUpload.uploadMedia("postfile"):null).then(()=>{const t=this.$refs.mediaUpload?.uploadedMedia||[];if("edit"===this.mode){const i={content:e,uploadedMedia:t,removedMedia:this.removedMediaIds};return this.$http.plain.patch("/event-feed-posts/"+this.postId+"/edit",i)}const i={parent:this.parentId,content:e,uploadedMedia:t};return this.$http.plain.post("/event-feed-replies",i)}).then(e=>{e&&("edit"===this.mode?this.$emit("updated",e.data):(this.$emit("reply-saved",e.data),this.reset()))}).catch(e=>
1{console.log(e),this.$buefy.toast.open({message:this.$t("Could not post the comment."),type:"is-danger"})}).finally(()=>{this.submitting=!1})},reset(){this.draft="",this.$refs.mediaUpload&&(this.$refs.mediaUpload.photos=[],this.$refs.mediaUpload.videos=[],this.$refs.mediaUpload.files=[],this.$refs.mediaUpload.uploadedMedia=[],this.$refs.mediaUpload.removedMedia=[]),this.mediasState=[],this.selectionTick++}}};const Ve=(0,J.A)(Oe,[["render",Te],["__scopeId","data-v-74666076"]]);var je=Ve,Ne=i(95256),Be={name:"EventFeedCommentNode",components:{LogoThumbnail:Pe.A,ReactionsModal:R.A,EventFeedCommentComposer:je},props:{comment:{type:Object,required:!0},parentPost:{type:Object,required:!0},reactions:{type:Object,required:!0},depth:{type:Number,default:1},eventId:{type:Number,default:null},repliesMap:{type:Object,default:()=>({})},autoExpand:{type:Boolean,default:!1}},emits:[],data(){return{inlineComposerOpen:!1,isEditing:!1,reacting:!1,isReactionsModalActive:!1,reactionsListData:{},expanded:this.autoExpand,threadCollapsed:!1}},computed:{...(0,A.L8)(["user","isGranted"]),avatarSize(){return this.depth>=2?"roundSmaller":"roundSmall"},commentOwner(){return this.comment.owner||this.comment.ownerContact||null},commentOwnerKey(){const e=this.commentOwner;return e?(this.comment.ownerContact?"contact:":"user:")+e.id:null},parentOwnerKey(){const e=this.parentPost.owner||this.parentPost.ownerContact||null;return e?(this.parentPost.ownerContact?"contact:":"user:")+e.id:null},myPrincipalKey(){return this.user&&this.user.id?("contact"===this.user.kind?"contact:":"user:")+this.user.id:null},ownerFullName(){const e=this.commentOwner||{};return[e.firstName,e.lastName].filter(Boolean).join(" ")},renderedContent(){return(0,Ne.HA)(this.comment.content||"")},commentMedias(){return this.comment.medias||[]},hasMediaImages(){return this.commentMedias.some(e=>"postimage"===e.type)},hasMediaFiles(){return this.commentMedias.some(e=>"postfile"===e.type)},isPostAuthor(){return null!==this.commentOwnerKey&&null!==this.parentOwnerKey&&this.commentOwnerKey===this.parentOwnerKey},canEditSelf(){return!!this.user&&(!(!this.commentOwnerKey||this.commentOwnerKey!==this.myPrincipalKey)||(!(!this.parentOwnerKey||this.parentOwnerKey!==this.myPrincipalKey)||"contact"!==this.user.kind&&this.isGranted("ADMIN_TENANT")))},hasChildren(){return(this.comment.childrenCount||0)>0},children(){return this.repliesMap[this.comment.id]||[]},hasMyReaction(){return Array.isArray(this.comment.myReactions)&&this.comment.myReactions.length>0},myReactionClass(){return this.hasMyReaction?"event-feed__comment-action-link--reaction-"+this.comment.myReactions[0]:null},reactionsTotal(){return this.comment.reactionData?Object.values(this.comment.reactionData).reduce((e,t)=>e+(parseInt(t,10)||0),0):0},expandedToggleLabel(){const e=this.comment.childrenCount||0;return 1===e?this.$t("1 reply"):e+" "+this.$t("replies")}},methods:{mediaSrc:Ne.F9,isMyReaction(e){return Array.isArray(this.comment.myReactions)&&this.comment.myReactions.includes(e)},toggleInlineComposer(){this.inlineComposerOpen=!this.inlineComposerOpen},startEdit(){this.inlineComposerOpen=!1,this.isEditing=!0},cancelEdit(){this.isEditing=!1},onCommentUpdated(e){e?(this.comment.content=e.content,this.comment.medias=e.medias||[],this.isEditing=!1):this.isEditing=!1},openReactionsModal(){this.isReactionsModalActive=!0,this.$http.plain.get("/posts/get_reactions_list/"+this.comment.id).then(e=>{this.reactionsListData=e.data||{}}).catch(e=>console.log(e))},onSubReplySaved(e){e&&(this.repliesMap[this.comment.id]||(this.repliesMap[this.comment.id]=[]),this.repliesMap[this.comment.id].find(t=>t.id===e.id)||this.repliesMap[this.comment.id].push(e),this.comment.childrenCount=(this.comment.childrenCount||0)+1,this.expanded=!0,this.inlineComposerOpen=!1)},quickReact(){const e=this.comment.myReactions||[];if(e.length>0){const t=this.reactions[e[0]];return void(t&&this.react(t))}const t=this.reactions[1]||Object.values(this.reactions)[0];t&&this.react(t)},react(e){if(this.reacting)return;const t={...this.comment.reactionData||{}},i=Array.isArray(this.comment.myReactions)?[...this.comment.myReactions]:[],s=1===i.length&&i[0]===e.id,n={...t};
1i.forEach(e=>{n[e]>0&&(n[e]-=1),n[e]<=0&&delete n[e]}),s||(n[e.id]=(n[e.id]||0)+1),this.comment.reactionData=n,this.comment.myReactions=s?[]:[e.id],this.reacting=!0;const o=s?this.$http.plain.delete("/post_user_reactions?post="+this.comment.id):this.$http.plain.post("/event-feed-reactions",{post:"/api/v1/posts/"+this.comment.id,reaction:"/api/v1/reactions/"+e.id});o.catch(e=>{console.log(e),this.comment.reactionData=t,this.comment.myReactions=i,this.$buefy.toast.open({message:this.$t(s?"Could not remove your reaction.":"Could not save your reaction."),type:"is-danger"})}).finally(()=>{this.reacting=!1})}}};const Ke=(0,J.A)(Be,[["render",Ee]]);var Qe=Ke,We=i(74961),ze={name:"EventAppFeed",components:{ReactionsModal:R.A,DiscussionCardComfortable:L.A,DiscussCreateBar:D.A,EventFeedPostFormModal:Y,EventFeedCommentNode:Qe,EventFeedCommentComposer:je},mixins:[X],props:{event:{type:Object,default:null}},data(){return{posts:[],replies:{},openReplies:{},reactingPosts:{},isReactionsModalActive:!1,reactionsListData:{},composerRefs:{},isLoading:!1,isPostModalVisible:!1,pendingFiles:[],editingPost:null,categories:[],activeFilter:"all"}},computed:{...(0,A.L8)(["user","isGranted"]),reactions(){return We.Z3},reactionTypes(){return We.oj},feedEventId(){return this.event?.id||null},isContactViewer(){return this.user&&"contact"===this.user.kind},canPost(){return!(!this.event||!this.user)&&(!this.isContactViewer&&(!(!this.event.owner||this.event.owner.id!==this.user.id)||(!!this.event.canManageEventApp||(this.isGranted("ADMIN_TENANT")||this.isGranted("EVENT_LOCAL",this.event)))))},canManagePins(){return this.canPost},hasCategoryBar(){return!0},currentPostId(){const e=this.$route.params.postId;return e?parseInt(e,10):null},isDetailView(){return null!==this.currentPostId},displayedPosts(){return this.isDetailView?this.posts.filter(e=>e.id===this.currentPostId):this.posts}},watch:{"event.id"(e){e&&this.bootstrap()},currentPostId(e){e&&this.ensurePostInView(e)}},created(){this.event?.id&&this.bootstrap()},beforeUnmount(){this.$store.commit("resetEventSource")},beforeRouteLeave(e,t,i){const s="EventAppFeed"!==e.name&&"EventAppFeedPost"!==e.name;if(s)this.$store.state.eventAppFeedCache=null,this.$store.state.eventAppFeedPendingScrollRestore=!1;else if(!this.isDetailView&&"EventAppFeedPost"===e.name){const e=this.getEventFeedScrollContainer();this.$store.state.eventAppFeedCache={posts:this.posts,categories:this.categories,activeFilter:this.activeFilter,scrollTop:e?e.scrollTop:0,eventId:this.event?.id||null},this.$store.state.eventAppFeedPendingScrollRestore=!0}i()},methods:{bootstrap(){const e=this.$store.state.eventAppFeedCache;if(!this.isDetailView&&e&&e.eventId===this.event?.id)return this.posts=e.posts,this.categories=e.categories,this.activeFilter=e.activeFilter,this.$nextTick(()=>{this.restoreCachedFeedScroll(e.scrollTop||0)}),void this.feedMercureDiscovery();this.loadCategories(),this.isDetailView?this.ensurePostInView(this.currentPostId):this.loadPosts(),this.feedMercureDiscovery()},getEventFeedScrollContainer(){return document.querySelector(".event-app__content")||document.getElementById("oMain")},restoreCachedFeedScroll(e){const t=this.getEventFeedScrollContainer();if(!t)return this.$store.state.eventAppFeedCache=null,void(this.$store.state.eventAppFeedPendingScrollRestore=!1);let i=null,s=null,n=!1;const o=()=>{n||(n=!0,i&&i.disconnect(),s&&clearTimeout(s),this.$store.state.eventAppFeedCache=null,this.$store.state.eventAppFeedPendingScrollRestore=!1)},a=()=>{n||(t.scrollTop=e,t.scrollTop===e&&o())};if(a(),!n){if("undefined"!==typeof ResizeObserver){i=new ResizeObserver(()=>a());const e=t.firstElementChild;e?i.observe(e):i.observe(t)}s=setTimeout(()=>o(),3e3)}},ensurePostInView(e){const t=this.posts.find(t=>t.id===e);t?this.autoOpenReplies(t):(this.isLoading=!0,this.$http.plain.get("/event-feed-posts/"+e).then(e=>{const t=e.data;if(!t)return void this.goBackToFeed();const i=this.extractEventKey(t.event),s=this.event&&this.event.uuid;i&&s&&i!==s?this.goBackToFeed():(this.posts.find(e=>e.id===t.id)||this.posts.push(t),this.autoOpenReplies(t))}).catch(e=>
1{console.log(e),this.$buefy.toast.open({message:this.$t("Post not found"),type:"is-danger"}),this.goBackToFeed()}).finally(()=>{this.isLoading=!1}))},extractEventKey(e){return e?"object"===typeof e?e.uuid||null:String(e).split("/").pop()||null:null},autoOpenReplies(e){this.openReplies[e.id]||(this.openReplies[e.id]=!0,this.loadReplies(e)),this.isDetailView&&this.focusReplyComposer(e)},openPost(e){this.isDetailView||this.$router.push({name:"EventAppFeedPost",params:{item:this.$route.params.item,postId:e.id}})},goBackToFeed(){this.$router.push({name:"EventAppFeed",params:{item:this.$route.params.item}})},loadPosts(){if(!this.event?.id)return;this.isLoading=!0;const e={event:this.event.id};"pinned"===this.activeFilter?e["exists[pinnedAt]"]="true":this.activeFilter.startsWith("category:")&&(e.eventFeedCategory=this.activeFilter.slice(9)),this.$http.plain.get("/event-feed-posts",{params:e}).then(e=>{this.posts=e.data["hydra:member"]||[]}).catch(e=>console.log(e)).finally(()=>{this.isLoading=!1})},loadCategories(){this.event?.id&&this.$http.plain.get("/event-feed-categories",{params:{event:this.event.id}}).then(e=>{this.categories=e.data["hydra:member"]||[]}).catch(e=>console.log(e))},setActiveFilter(e,t){this.scrollChipIntoView(t),this.activeFilter!==e&&(this.activeFilter=e,this.loadPosts())},scrollChipIntoView(e){if(!e||"function"!==typeof e.scrollIntoView)return;const t=e.parentElement;!t||t.scrollWidth<=t.clientWidth||e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},onCategoryCreated(e){e&&!this.categories.find(t=>t.id===e.id)&&this.categories.push(e)},loadReplies(e){this.$http.plain.get("/event-feed-posts",{params:{event:this.event.id,rootPost:e.id,includeReplies:1}}).then(t=>{const i=t.data["hydra:member"]||[];i.forEach(t=>{t.parentId&&t.id!==e.id&&(this.replies[t.parentId]||(this.replies[t.parentId]=[]),this.replies[t.parentId].find(e=>e.id===t.id)||this.replies[t.parentId].push(t))})}).catch(e=>console.log(e))},openPostModal(){this.pendingFiles=[],this.editingPost=null,this.isPostModalVisible=!0},editPost(e){this.pendingFiles=[],this.editingPost=e,this.isPostModalVisible=!0},canEditPost(e){if(!this.user||!e)return!1;const t=this.postOwner(e);if(!t)return!1;const i=(e.ownerContact?"contact:":"user:")+t.id,s=("contact"===this.user.kind?"contact:":"user:")+this.user.id;return i===s||"contact"!==this.user.kind&&this.canPost},isPostOwner(e,t){return!!(e&&t&&e.owner&&t.owner)&&e.owner.id===t.owner.id},focusReplyComposer(e){setTimeout(()=>{const t=this.composerRefs[e.id];t&&(t.scrollIntoView(),t.focusInput())},50)},registerComposerRef(e,t){t?this.composerRefs[e]=t:delete this.composerRefs[e]},onReplySaved(e,t){t&&(this.replies[e.id]||(this.replies[e.id]=[]),this.replies[e.id].find(e=>e.id===t.id)||(this.replies[e.id].push(t),e.childrenCount=(e.childrenCount||0)+1))},onPostUpdated(e){if(this.closePostModal(),!e)return;const t=this.posts.findIndex(t=>t.id===e.id);-1!==t&&this.posts.splice(t,1,e)},onPostDeleted(e){this.closePostModal();const t=e&&e.id;if(null==t)return;const i=this.posts.findIndex(e=>e.id===t);-1!==i&&this.posts.splice(i,1)},onCreateBarAction(e){if("text"===e)return void this.openPostModal();const t="photos"===e?"shortcutImagePicker":"videos"===e?"shortcutVideoPicker":"shortcutFilePicker",i=this.$refs[t];i?i.click():this.openPostModal()},onShortcutPicked(e){const t=Array.from(e.target.files||[]);e.target.value="",0!==t.length&&(this.pendingFiles=t,this.isPostModalVisible=!0)},closePostModal(){this.isPostModalVisible=!1,this.pendingFiles=[],this.editingPost=null},onPostCreated(e){this.closePostModal(),e&&!this.posts.find(t=>t.id===e.id)&&this.posts.unshift(e)},react(e,t){if(this.reactingPosts[e.id])return;const i={...e.reactionData||{}},s=Array.isArray(e.myReactions)?[...e.myReactions]:[],n=1===s.length&&s[0]===t.id,o={...i};s.forEach(e=>{o[e]>0&&(o[e]-=1),o[e]<=0&&delete o[e]}),n||(o[t.id]=(o[t.id]||0)+1),e.reactionData=o,e.myReactions=n?[]:[t.id],this.reactingPosts[e.id]=!0;const a=n?this.$http.plain.delete("/post_user_reactions?post="+e.id):this.$http.plain.post("/event-feed-reactions",{post:"/api/v1/posts/"+e.id,reaction:"/api/v1/reactions/"+t.id});a.catch(t=>{console.log(t),e.reactionData=i,e.myReactions=s,this.$buefy.toast.o
1pen({message:this.$t(n?"Could not remove your reaction.":"Could not save your reaction."),type:"is-danger"})}).finally(()=>{this.reactingPosts[e.id]=!1})},openReactionsModal(e){this.isReactionsModalActive=!0,this.$http.plain.get("/posts/get_reactions_list/"+e.id).then(e=>{this.reactionsListData=e.data||{}}).catch(e=>console.log(e))},quickReact(e){const t=e.myReactions||[];if(t.length>0){const i=this.reactions[t[0]];return void(i&&this.react(e,i))}const i=this.reactions[1]||Object.values(this.reactions)[0];i&&this.react(e,i)},hasMyReaction(e){return Array.isArray(e.myReactions)&&e.myReactions.length>0},isMyReaction(e,t){return Array.isArray(e.myReactions)&&e.myReactions.includes(t)},reactionsTotal(e){return e.reactionData?Object.values(e.reactionData).reduce((e,t)=>e+(parseInt(t,10)||0),0):0},postOwner(e){return e&&(e.owner||e.ownerContact)||null},togglePin(e){const t=!!e.pinnedAt;e.pinnedAt=t?null:(new Date).toISOString(),this.$http.plain.patch("/event-feed-posts/"+e.id+"/pin",{pinned:!t},{headers:{"Content-Type":"application/merge-patch+json"}}).then(()=>{this.resortPosts(),t||this.$nextTick(()=>this.scrollPostIntoView(e.id))}).catch(i=>{console.log(i),e.pinnedAt=t?(new Date).toISOString():null,this.$buefy.toast.open({message:this.$t("Could not change pin state."),type:"is-danger"})})},scrollPostIntoView(e){const t=document.getElementById("event-feed-post-"+e);t&&t.scrollIntoView({behavior:"smooth",block:"start"})},resortPosts(){this.posts.sort((e,t)=>{const i=e.pinnedAt?new Date(e.pinnedAt).getTime():0,s=t.pinnedAt?new Date(t.pinnedAt).getTime():0;if(i!==s)return s-i;const n=e.dateCreated?new Date(e.dateCreated).getTime():0,o=t.dateCreated?new Date(t.dateCreated).getTime():0;return o-n})},categoryChipStyle(e){return e&&e.color?{background:e.color+"1f",color:e.color,borderColor:e.color+"4d"}:{}}}};const Ge=(0,J.A)(ze,[["render",I]]);var qe=Ge}}]);
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.