PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.8.1
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.8.1
2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 1.1.0 All 77 releases
fluent-community / assets / app.js

app.js in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses 2.8.1, at assets/app.js

17 lines 803.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import{D as n,F as c,K as l,ae as p,ab as x,L as R,S as a,I as r,E as y,O as _,Q as d,R as F,af as te,J as W,P as V,a7 as z,B as Y,ak as ge,ay as Te,W as re,az as Bs,aA as Ds,aj as oe,M as wt,V as Rs,a5 as Xt,G as qo,T as dt,a2 as Go,U as kt,at as Yo,al as Cs,am as $s,aB as Wo,ar as Ko}from"./vue.js?ver=2.8.1";import{c as Ss,a as Zo,b as Jo}from"./vue-router.js?ver=2.8.1";import{E as j,a as Qo,b as H,c as Z,d as ye,e as mt,f as se,g as he,h as Xe,i as ht,j as ft,k as Fe,l as Ne,m as ve,n as be,o as xs,p as Ee,q as ke,r as ne,s as le,t as Ct,u as ue,v as Hs,w as _e,x as Ue,y as ze,z as qe,A as Ge,B as Os,C as es,D as $t,F as St,G as Vt,H as ts,I as Re,J as Xo,K as js,L as Ns,M as ei,N as zs,O as ti,P as qs,Q as Le,R as Ye,S as et,T as ss,U as si,V as os,W as is,X as ns,Y as ls,Z as as,_ as oi,$ as ii,a0 as Yt}from"./element-plus.js?ver=2.8.1";import"./dayjs.js?ver=2.8.1";import{d as We,m as ni,a as Gs,c as li,s as ai}from"./pinia.js?ver=2.8.1";import{bd as rs,be as ri,bf as Mt,a5 as Wt,az as Vs,bg as Ys,bh as Ws,bi as Lt,bj as ci,bk as Ie,bl as di,bm as Ks,bn as Zs,bo as Js,bp as ui,bq as _i,br as mi,bs as hi,bt as Qs,bu as fi,bv as pi,bw as gi,bx as yi,by as Tt,bz as Xs,bA as eo,bB as to,bC as vi,bD as so,bE as bi,bF as ki,bG as wi,bH as Ci,bI as $i,bJ as Si,bK as Vi,bL as Mi,bM as Li,bN as Ti,bO as Fi,bP as Pi,bQ as Ii,bR as Ei,bS as Ui,bT as Ai,bU as Bi,bV as Di,bW as Ri,bX as xi,bY as Hi,bZ as Oi,b_ as ji,b$ as Ni,c0 as zi,c1 as qi,c2 as Gi,c3 as Yi,c4 as Wi,c5 as Ki,c6 as Zi,c7 as Ji,c8 as Qi,c9 as Xi,ca as en,cb as tn}from"./vendor.js?ver=2.8.1";import{_ as I,P as sn,E as on}from"./emoji-picker.js?ver=2.8.1";import{u as nn,v as cs,w as ln,x as Oe,y as an}from"./lodash.js?ver=2.8.1";import{H as rn,O as cn,m as dn,s as un,c as _n,a as mn,h as hn,b as fn,x as pn,P as gn,W as yn,U as vn,d as bn,_ as kn,u as Kt,$ as wn,w as Cn,r as $n,L as lt,e as Sn}from"./milkdown.js?ver=2.8.1";const ce=We("cache",{state:()=>({cache:{},stats:{hits:0,misses:0,size:0,totalSaved:0},maxSize:500,maxMemorySize:50*1024*1024}),getters:{getCacheHitRate:e=>{const t=e.stats.hits+e.stats.misses;return t>0?(e.stats.hits/t*100).toFixed(2):0},getCacheSize:e=>Object.keys(e.cache).length,getMemoryUsage:e=>{try{return(new Blob([JSON.stringify(e.cache)]).size/1024/1024).toFixed(2)+" MB"}catch{return"Unknown"}},getCacheKeys:e=>Object.keys(e.cache),getCacheEntry:e=>t=>e.cache[t]||null},actions:{get(e,t=null){const s=this.cache[e];if(!s)return this.stats.misses++,null;const u=Date.now()-s.timestamp,o=s.ttl||t||5*60*1e3;return u>o?(delete this.cache[e],this.stats.misses++,this.stats.size=Object.keys(this.cache).length,null):(this.stats.hits++,s.hits=(s.hits||0)+1,s.lastAccessed=Date.now(),s.data)},set(e,t,s=5*60*1e3){Object.keys(this.cache).length>=this.maxSize&&this.pruneLRU(50),this.cache[e]={data:t,timestamp:Date.now(),lastAccessed:Date.now(),hits:0,ttl:s},this.stats.size=Object.keys(this.cache).length,this.stats.totalSaved++},invalidate(e){this.cache[e]&&(delete this.cache[e],this.stats.size=Object.keys(this.cache).length)},invalidatePattern(e){let t=0;return Object.keys(this.cache).forEach(s=>{s.includes(e)&&(delete this.cache[s],t++)}),this.stats.size=Object.keys(this.cache).length,t},pruneLRU(e){const t=Object.entries(this.cache).map(([s,u])=>({key:s,lastAccessed:u.lastAccessed||u.timestamp})).sort((s,u)=>s.lastAccessed-u.lastAccessed).slice(0,e);return t.forEach(({key:s})=>{delete this.cache[s]}),this.stats.size=Object.keys(this.cache).length,t.length},pruneExpired(e=15*60*1e3){let t=0;const s=Date.now();return Object.entries(this.cache).forEach(([u,o])=>{s-o.timestamp>e&&(delete this.cache[u],t++)}),this.stats.size=Object.keys(this.cache).length,t},clear(){this.cache={},this.stats.hits=0,this.stats.misses=0,this.stats.size=0},getStats(){return{...this.stats,hitRate:this.getCacheHitRate,memoryUsage:this.getMemoryUsage,cacheSize:this.getCacheSize}},has(e){return e in this.cache},getKeysMatching(e){return Object.keys(this.cache).filter(t=>t.includes(e))},warmCache(e){Object.entries(e).forEach(([t,s])=>{this.set(t,s)})}}}),Ft=We("ui",{state:()=>({lastScrollPath:null,lastScrollPosition:0,lastViewedFeed:{},layoutStyle:null,sortBy:null,layoutStyleByContext:{},sortByContext:{},listSortByContext:{},modals:{feedModal:!1,createPostModal:!1,editPostModal:!1,shareModal:!1},globalLoading:!1,sidebarCollapsed:!1,searchQuery:"",activeSpace:null,activeTopic:null}),getters:{getLastViewedFeed:e=>t=>e.lastViewedFeed[t]||null,getLayoutStyle:e=>t=>e.layoutStyleByContext[t]||e.layoutStyle||"list",getSortBy:e=>t=>e.sortByContext[t]||e.sortBy||"latest",isModalOpen:e=>t=>e.modals[t]||!1},actions:{saveScrollPosition(e,t){this.lastScrollPath=e,this.lastScrollPosition=t},restoreScrollPosition(e){return this.lastScrollPath===e&&this.lastScrollPosition>0?this.lastScrollPosition:0},consumeScrollPosition(e){const t=this.restoreScrollPosition(e);return t>0&&(this.lastScrollPath=null,this.lastScrollPosition=0),t},saveLastViewedFeed(e,t,s){this.lastViewedFeed[e]={feedId:t,index:s,timestamp:Date.now()}},setLayoutStyle(e){this.layoutStyle=e;try{localStorage.setItem("fcom_feed_layout",e)}catch(t){console.error("Failed to save layout style:",t)}},setLayoutStyleForContext(e,t){this.layoutStyleByContext[e]=t;try{localStorage.setItem("fcom_layout_by_context",JSON.stringify(this.layoutStyleByContext))}catch(s){console.error("Failed to save layout style:",s)}},setSortBy(e){this.sortBy=e;try{localStorage.setItem("fcom_feed_sort",e)}catch(t){console.error("Failed to save sort preference:",t)}},setSortByForContext(e,t){this.sortByContext[e]=t;try{localStorage.setItem("fcom_sort_by_context",JSON.stringify(this.sortByContext))}catch(s){console.error("Failed to save sort preference:",s)}},setListSort(e,t,s){this.listSortByContext[e]={field:t,dir:s};try{localStorage.setItem("fcom_list_sort_by_context",JSON.stringify(this.listSortByContext))}catch(u){console.error("Failed to save list sort preference:",u)}},getListSort(e){return this.listSortByContext[e]||null},openModal(e){this.modals[e]=!0},closeModal(e){this.modals[e]=!1},toggleModal(e){this.modals[e]=!this.modals[e]},setGlobalLoading(e){this.globalLoading=e},toggleSidebar(){this.sidebarCollapsed=!this.sidebarCollapsed},setSidebar(e){this.sidebarCollapsed=e},setSearchQuery(e){this.searchQuery=e},setActiveSpace(e){this.activeSpace=e},setActiveTopic(e){this.activeTopic=e},clearScrollPosition(){this.lastScrollPath=null,this.lastScrollPosition=0},clearLastViewedFeeds(){this.lastViewedFeed={}},initialize(){try{const e=localStorage.getItem("fcom_feed_layout");e&&(this.layoutStyle=e);const t=localStorage.getItem("fcom_layout_by_context");t&&(this.layoutStyleByContext=JSON.parse(t))}catch(e){console.error("Failed to restore layout style:",e)}try{const e=localStorage.getItem("fcom_feed_sort");e&&(this.sortBy=e);const t=localStorage.getItem("fcom_sort_by_context");t&&(this.sortByContext=JSON.parse(t));const s=localStorage.getItem("fcom_list_sort_by_context");s&&(this.listSortByContext=JSON.parse(s))}catch(e){console.error("Failed to restore sort preference:",e)}},reset(){this.lastScrollPath=null,this.lastScrollPosition=0,this.lastViewedFeed={},this.modals={feedModal:!1,createPostModal:!1,editPostModal:!1,shareModal:!1},this.globalLoading=!1,this.sidebarCollapsed=!1,this.searchQuery="",this.activeSpace=null,this.activeTopic=null}}}),De=We("user",{state:()=>({currentUser:null,profilesByUsername:{},follows:{},followers:[],loading:{},lastFetched:{}}),getters:{getProfile:e=>t=>e.profilesByUsername[t]||null,isFollowing:e=>t=>{const s=e.follows[String(t)];return s!==void 0&&["1","2"].includes(String(s))},isBlocked:e=>t=>{const s=e.follows[String(t)];return s!==void 0&&String(s)==="0"},getFollowLevel:e=>t=>e.follows[String(t)],getCurrentUser:e=>e.currentUser,isLoading:e=>t=>e.loading[t]||!1,followingCount:e=>Object.values(e.follows).filter(t=>["1","2"].includes(String(t))).length,followersCount:e=>e.followers.length},actions:{initializeCurrentUser(){var e;(e=window.fluentComAdmin)!=null&&e.auth&&(this.currentUser=window.fluentComAdmin.auth)},setFollows(e){if(!(!e||typeof e!="object"))for(const[t,s]of Object.entries(e)){const u=String(t);s==null?delete this.follows[u]:this.follows[u]=String(s)}},removeFollow(e){delete this.follows[String(e)]},async fetchProfile(e,t=!1){const s=ce(),u=`user-profile:${e}`;if(!t){const o=s.get(u);if(o)return this.profilesByUsername[e]=o,o.follow!==void 0&&o.user_id&&this.setFollows({[o.user_id]:o.follow}),o}this.loading[e]=!0;try{const o=await this.$api.get(`profile/${e}`),i=o.profile;return i.follow!==void 0&&i.user_id&&this.setFollows({[i.user_id]:i.follow}),o.current_user_follows&&this.setFollows(o.current_user_follows),this.profilesByUsername[e]=i,this.lastFetched[e]=Date.now(),s.set(u,i,5*60*1e3),this.loading[e]=!1,i}catch(o){throw this.loading[e]=!1,console.error("Failed to fetch user profile:",o),o}},async updateProfile(e,t=null,s=null){var o,i;const u=ce();try{const m=s||((o=this.currentUser)==null?void 0:o.username),f=await this.$api.put(`profile/${m}`,{data:e}),h=f.profile||f.user||f;return this.currentUser={...this.currentUser,...h},t&&t!==h.username&&(delete this.profilesByUsername[t],u.invalidate(`user-profile:${t}`)),h.username&&(this.profilesByUsername[h.username]=h,u.invalidate(`user-profile:${h.username}`)),(i=window.fluentComAdmin)!=null&&i.auth&&(window.fluentComAdmin.auth={...window.fluentComAdmin.auth,...h}),h}catch(m){throw console.error("Failed to update profile:",m),m}},async toggleFollow(e,t=null){var f,h,g;const s=ce(),u=String(e),o=this.follows[u],i=o!==void 0&&["1","2"].includes(String(o)),m=o;i?(delete this.follows[u],t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count--,this.profilesByUsername[t].follow=void 0)):(this.follows[u]="1",t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count++,this.profilesByUsername[t].follow="1"));try{const w=i?`profile/${t}/unfollow`:`profile/${t}/follow`,b=await this.$api.post(w);return i?delete this.follows[u]:((f=b.follow)==null?void 0:f.level)!==void 0&&this.setFollows({[u]:b.follow.level}),t&&this.profilesByUsername[t]&&(((h=b.xprofile)==null?void 0:h.followers_count)!==void 0&&(this.profilesByUsername[t].followers_count=b.xprofile.followers_count),s.invalidate(`user-profile:${t}`)),(g=window.fluentFrameworkApp)!=null&&g.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("user_follow_toggled",{userId:e,isFollowing:!i}),b}catch(w){throw i?(this.follows[u]=m,t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count++,this.profilesByUsername[t].follow=m)):(delete this.follows[u],t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count--,this.profilesByUsername[t].follow=void 0)),console.error("Failed to toggle follow:",w),w}},invalidateProfile(e){ce().invalidate(`user-profile:${e}`),delete this.lastFetched[e]},clearAll(){this.currentUser=null,this.profilesByUsername={},this.follows={},this.followers=[],this.loading={},this.lastFetched={};const e=ce();e.invalidatePattern("user-profile:"),e.invalidate("user-following")}}}),Me=We("feed",{state:()=>({feedsByContext:{},feedsById:{},stickyFeeds:{},loading:{},pagination:{},filters:{},tickerIntervals:{},tickerEnabled:{},lastTickerCheck:{},tickerPending:{},newPostsCount:{},ticker:{count:0,lastFetched:0},executionTimes:{},_pendingRequests:{},_requestSeq:{},_recentContexts:[]}),getters:{getFeedsByContext:e=>t=>{const s=e.feedsByContext[t];return s?s.data||[]:[]},getFeedById:e=>t=>e.feedsById[t]||null,getStickyFeed:e=>t=>e.stickyFeeds[t]||null,getPagination:e=>t=>e.pagination[t]||{page:1,per_page:10,total:0,last_page:1,has_more:!1},isLoading:e=>t=>e.loading[t]||!1,getExecutionTime:e=>t=>e.executionTimes[t]||"",totalFeedsInMemory:e=>{let t=Object.keys(e.feedsById).length;return Object.values(e.feedsByContext).forEach(s=>{var u;t+=((u=s.data)==null?void 0:u.length)||0}),t},disableAutoLoad:e=>t=>{const s=e.loading[t]||!1,u=e.pagination[t];return u?s||u.has_more===!1:!0},getTickerCount:e=>e.ticker.count||0,getTickerLastFetched:e=>e.ticker.lastFetched||0,isTickerActive:e=>t=>e.tickerEnabled[t]&&e.tickerIntervals[t]!==null,getNewPostsCount:e=>t=>e.newPostsCount[t]||0,getMemoryStats:e=>{let t=0,s={};Object.keys(e.feedsByContext).forEach(i=>{var f,h;const m=((h=(f=e.feedsByContext[i])==null?void 0:f.data)==null?void 0:h.length)||0;s[i]=m,t+=m});const u=Object.keys(e.feedsById).length,o=(t*5/1024).toFixed(2);return{totalFeeds:t,feedsByContextCount:s,feedsByIdCount:u,estimatedMemoryMB:o,contexts:Object.keys(e.feedsByContext).length}}},actions:{async fetchFeeds(e,t={},s=!1){var w,b,S;if(console.log("[Feed Store] fetchFeeds called:",{context:e,loadMore:s,paramsPage:t.page,currentLoading:this.loading[e],currentPage:(w=this.pagination[e])==null?void 0:w.page}),this.loading[e]){console.log("[Feed Store] Already loading for context:",e,"- ignoring duplicate request");return}const u=(this._requestSeq[e]||0)+1;this._requestSeq[e]=u;const o=s?(((b=this.pagination[e])==null?void 0:b.page)||0)+1:t.page||1,i={...t,page:o,per_page:t.per_page||10},m=`feeds:${e}:${JSON.stringify(i)}`,f=ce(),h=JSON.stringify({search:i.search||"",order_by_type:i.order_by_type||"",topic_slug:i.topic_slug||"",status:i.status||""});if(!s&&o===1){const k=f.get(m,3e5);if(k)return this.feedsByContext[e]={...k.feedsByContext,filterKey:h},this.pagination[e]=k.pagination,this.executionTimes[e]=k.executionTime,this.touchContext(e),k.stickyFeed&&!window["viewed_sticky_posts_"+k.stickyFeed.id]?this.stickyFeeds[e]=k.stickyFeed:(this.stickyFeeds[e]=null,k.stickyFeed&&((S=this.feedsByContext[e])!=null&&S.data)&&(this.feedsByContext[e].data.some($=>$.id===k.stickyFeed.id)||this.feedsByContext[e].data.unshift(k.stickyFeed))),k.feedsByContext.data.forEach($=>{this.feedsById[$.id]=$}),this.loading[e]=!1,k}return this.loading[e]=!0,this.$api.get(t.feed_base_url||"feeds",i).then(k=>{var $,v,C,L;if(this._requestSeq[e]===u){if(k.sticky){const M="viewed_sticky_posts_"+k.sticky.id;window[M]?(k.feeds.data.some(E=>E.id===k.sticky.id)||k.feeds.data.unshift(k.sticky),this.stickyFeeds[e]=null):this.stickyFeeds[e]=k.sticky}else o===1&&(this.stickyFeeds[e]=null);if(s){const M=(($=this.feedsByContext[e])==null?void 0:$.data)||[];this.feedsByContext[e]={data:[...M,...k.feeds.data],timestamp:Date.now(),filterKey:h}}else this.feedsByContext[e]={data:k.feeds.data,timestamp:Date.now(),filterKey:h};if(this.pagination[e]={page:o,per_page:i.per_page,total:k.feeds.total,last_page:k.feeds.last_page,has_more:k.feeds.has_more},this.touchContext(e),console.log("[Feed Store] Updated pagination:",{context:e,page:o,has_more:k.feeds.has_more,total:k.feeds.total}),k.execution_time&&(this.executionTimes[e]=k.execution_time),k.feeds.data.forEach(M=>{this.feedsById[M.id]={...M,timestamp:Date.now()}}),s){const M=((C=(v=this.feedsByContext[e])==null?void 0:v.data)==null?void 0:C.length)||0;M>500&&(console.log("[Feed Store] Pruning feeds, count:",M),this.pruneOldFeeds(e))}return k.last_fetched_timestamp&&(this.ticker.lastFetched=k.last_fetched_timestamp,(L=window.fluentFrameworkApp)!=null&&L.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("newest_feed_fetched",{last_fetched_timestamp:k.last_fetched_timestamp})),k.current_user_follows&&De().setFollows(k.current_user_follows),!s&&o===1&&f.set(m,{feedsByContext:this.feedsByContext[e],pagination:this.pagination[e],stickyFeed:this.stickyFeeds[e],executionTime:this.executionTimes[e]}),console.log("[Feed Store] Fetch SUCCESS, stored feeds for context:",e,{feedCount:this.feedsByContext[e].data.length,pagination:this.pagination[e],hasSticky:!!this.stickyFeeds[e]}),this.loading[e]=!1,console.log("[Feed Store] Set loading to FALSE after success for context:",e),{feeds:this.feedsByContext[e].data,pagination:this.pagination[e],sticky:this.stickyFeeds[e]}}}).catch(k=>{throw console.error("[Feed Store] Failed to fetch feeds:",k),this._requestSeq[e]===u&&(this.loading[e]=!1),k})},async fetchFeedBySlug(e){const t=`feed:slug:${e}`,s=ce(),u=s.get(t,10*60*1e3);if(u)return this.feedsById[u.id]=u,u;try{const i=(await this.$api.get(`feeds/${e}/by-slug`)).feed;return this.feedsById[i.id]={...i,timestamp:Date.now()},s.set(t,i),window.appVars&&(window.appVars.last_feed_id=i.id),i}catch(o){throw console.error("Failed to fetch feed:",o),o}},_contextShowsUnlisted(e){const t=this.feedsByContext[e];if(!t||!t.filterKey)return!1;try{return JSON.parse(t.filterKey).status==="unlisted"}catch{return!1}},async createFeed(e,t){var s,u,o,i,m;try{const f=await this.$api.post("feeds",t),h=f.feed;if(this.feedsById[h.id]={...h,timestamp:Date.now()},!f.scheduled_at){const w=b=>{this.feedsByContext[b]||(this.feedsByContext[b]={data:[],timestamp:Date.now()}),this.stickyFeeds[b]&&(this.feedsByContext[b].data.some(k=>k.id===this.stickyFeeds[b].id)||this.feedsByContext[b].data.unshift(this.stickyFeeds[b]),this.stickyFeeds[b]=null);const S=this.feedsByContext[b].data.findIndex(k=>k.id===h.id);S===-1&&this.feedsByContext[b].data.unshift(h),this.pagination[b]?S===-1&&this.pagination[b].total++:this.pagination[b]={page:1,per_page:10,total:1,last_page:1,has_more:!1}};if(h.status==="unlisted")Object.keys(this.feedsByContext).forEach(b=>{this._contextShowsUnlisted(b)&&w(b)});else{w(e),h.space_id&&e!=="global"&&(w("global"),ce().invalidatePattern("feeds:global"));const b=`user-${h.user_id}`;this.feedsByContext[b]&&e!==b&&w(b)}(u=(s=window.fluentFrameworkApp)==null?void 0:s.$eventBus)==null||u.emit("recent_activities_refresh")}return f.last_fetched_timestamp&&(this.ticker.lastFetched=f.last_fetched_timestamp,(o=window.FluentCommunityUtil)!=null&&o.eventBus&&((m=(i=window.fluentFrameworkApp)==null?void 0:i.$eventBus)==null||m.emit("newest_feed_fetched",{last_fetched_timestamp:f.last_fetched_timestamp}))),ce().invalidatePattern(`feeds:${e}`),f}catch(f){throw console.error("Failed to create feed:",f),f}},async updateFeed(e,t){const s=this.feedsById[e]?{...this.feedsById[e]}:null;this.feedsById[e]&&(this.feedsById[e]={...this.feedsById[e],...t,timestamp:Date.now()}),Object.keys(this.feedsByContext).forEach(u=>{const o=this.feedsByContext[u].data.findIndex(i=>i.id===e);o!==-1&&(this.feedsByContext[u].data[o]={...this.feedsByContext[u].data[o],...t})});try{const o=(await this.$api.patch(`feeds/${e}`,t)).feed;return this.feedsById[e]={...this.feedsById[e],...o,timestamp:Date.now()},Object.keys(this.feedsByContext).forEach(m=>{const f=this.feedsByContext[m].data.findIndex(h=>h.id===e);f!==-1&&(this.feedsByContext[m].data[f]={...this.feedsByContext[m].data[f],...o})}),o.status==="unlisted"&&Object.keys(this.feedsByContext).forEach(m=>{if(this._contextShowsUnlisted(m))return;const f=this.feedsByContext[m];f!=null&&f.data&&(f.data=f.data.filter(h=>h.id!==e))}),ce().invalidatePattern("feed:"),o}catch(u){throw s&&(this.feedsById[e]=s,Object.keys(this.feedsByContext).forEach(o=>{const i=this.feedsByContext[o].data.findIndex(m=>m.id===e);i!==-1&&(this.feedsByContext[o].data[i]=s)})),console.error("Failed to update feed:",u),u}},async deleteFeed(e,t,s=null){try{return await this.$api.delete(`feeds/${t}`),delete this.feedsById[t],s!==null&&this.feedsByContext[e]?this.feedsByContext[e].data.splice(s,1):Object.keys(this.feedsByContext).forEach(o=>{var i;(i=this.feedsByContext[o])!=null&&i.data&&(this.feedsByContext[o].data=this.feedsByContext[o].data.filter(m=>m.id!==t))}),this.pagination[e]&&this.pagination[e].total--,ce().invalidatePattern("feed:"),!0}catch(u){throw console.error("Failed to delete feed:",u),u}},async fetchTicker(e){var t,s,u;try{const o=e||this.ticker.lastFetched;console.log("[Legacy Ticker] Fetching ticker with timestamp:",o);const i=await this.$api.get("feeds/ticker",{last_fetched_timestamp:o});if(console.log("[Legacy Ticker] Response:",{has_changes:i.has_changes,feeds:((t=i.feeds)==null?void 0:t.length)||0,new_items_count:i.new_items_count}),this.ticker={count:i.new_items_count||0,lastFetched:i.last_fetched_timestamp||Date.now()},console.log("[Legacy Ticker] Checking if we should process feeds:",{has_changes:i.has_changes,feeds_exists:!!i.feeds,feeds_length:((s=i.feeds)==null?void 0:s.length)||0,feeds_data:i.feeds}),i.has_changes&&i.feeds&&i.feeds.length>0){console.log(`[Legacy Ticker] ✅ Processing ${i.feeds.length} feed updates`);const m={};i.feeds.forEach(f=>{console.log("[Legacy Ticker] Processing feed update:",f);const h=f.context||"global";m[h]||(m[h]=[]),m[h].push(f)}),console.log("[Legacy Ticker] Updates grouped by context:",m);for(const f in m){console.log(`[Legacy Ticker] 📥 Processing context: ${f} (${m[f].length} updates)`);try{await this.processTickerUpdates(f,m[f]),console.log(`[Legacy Ticker] ✅ Successfully processed context: ${f}`)}catch(h){console.error(`[Legacy Ticker] ❌ Failed to process context: ${f}`,h)}}}else console.log("[Legacy Ticker] ⏭️ Skipping feed processing - no changes or no feeds in response");return(u=window.fluentFrameworkApp)!=null&&u.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("ticker_updated",i),this.ticker}catch(o){throw console.error("[Legacy Ticker] Failed to fetch ticker:",o),o}},resetTicker(){this.ticker.count=0},markStickyAsViewed(e,t){const s=this.stickyFeeds[e];s&&s.id===t&&(window["viewed_sticky_posts_"+t]=!0,this.feedsByContext[e]&&(this.feedsByContext[e].data.some(u=>u.id===s.id)||this.feedsByContext[e].data.unshift(s)),this.stickyFeeds[e]=null)},pruneOldFeeds(e=null){(e?[e]:Object.keys(this.feedsByContext)).forEach(u=>{var i;const o=((i=this.feedsByContext[u])==null?void 0:i.data)||[];if(o.length>500){const m=o.slice(0,o.length-500);this.feedsByContext[u].data=o.slice(o.length-500),console.log(`[Feed Store] Pruned ${m.length} old feeds from ${u}, kept ${this.feedsByContext[u].data.length}`),m.forEach(f=>{Object.values(this.feedsByContext).some(g=>{var w;return(w=g.data)==null?void 0:w.some(b=>b.id===f.id)})||delete this.feedsById[f.id]})}})},resetContext(e){this.feedsByContext[e]={data:[],timestamp:0},this.pagination[e]={page:1,per_page:10,total:0,last_page:1,has_more:!1},this.stickyFeeds[e]=null,this.loading[e]=!1,this.executionTimes[e]="",ce().invalidatePattern(`feeds:${e}`)},touchContext(e){if(!e)return;const t=this._recentContexts.indexOf(e);t>-1&&this._recentContexts.splice(t,1),this._recentContexts.push(e);const s=10;if(this._recentContexts.length<=s)return;let u=this._recentContexts.length-s;const o=[];for(const i of this._recentContexts)u>0&&!this.loading[i]?(delete this.feedsByContext[i],delete this.pagination[i],delete this.stickyFeeds[i],delete this.executionTimes[i],u--):o.push(i);this._recentContexts=o},async softRefreshContext(e,t={}){var s,u,o,i;if((u=(s=this.feedsByContext[e])==null?void 0:s.data)!=null&&u.length&&!this.loading[e]){this.touchContext(e);try{const m=await this.$api.get(t.feed_base_url||"feeds",{...t,page:1,per_page:t.per_page||10}),f=this.feedsByContext[e];if(!((o=f==null?void 0:f.data)!=null&&o.length))return;const h=f.data,g=((i=m.feeds)==null?void 0:i.data)||[];if(!g.length){f.timestamp=Date.now();return}const w=new Map(g.map(v=>[v.id,v])),b=new Set(h.map(v=>v.id)),S=h.map(v=>{const C=w.get(v.id);return C?{...v,...C}:v}),k=g.filter(v=>!b.has(v.id));this.feedsByContext[e]={...f,data:[...k,...S],timestamp:Date.now()};const $=Date.now();if(g.forEach(v=>{this.feedsById[v.id]={...this.feedsById[v.id]||{},...v,timestamp:$}}),m.sticky){const v="viewed_sticky_posts_"+m.sticky.id;window[v]||(this.stickyFeeds[e]=m.sticky)}}catch(m){console.warn("[Feed Store] Soft refresh failed for context",e,m)}}},startTicker(e="global",t=3e4){this.lastTickerCheck[e]||(this.lastTickerCheck[e]=new Date().toISOString()),this.stopTicker(e),this.tickerEnabled[e]=!0,this.newPostsCount[e]=0,this.tickerIntervals[e]=setInterval(()=>{this.checkForUpdates(e)},t),console.log(`[Feed Store] Ticker started for ${e} (interval: ${t}ms)`),this.checkForUpdates(e)},stopTicker(e){this.tickerIntervals[e]&&(clearInterval(this.tickerIntervals[e]),this.tickerIntervals[e]=null,this.tickerEnabled[e]=!1,console.log(`[Feed Store] Ticker stopped for ${e}`))},stopAllTickers(){Object.keys(this.tickerIntervals).forEach(e=>{this.stopTicker(e)})},async checkForUpdates(e="global"){if(!this.tickerPending[e]){this.tickerPending[e]=!0;try{const t=await this.$api.get("feeds/ticker-updates",{context:e,since:this.lastTickerCheck[e]||new Date().toISOString()});this.lastTickerCheck[e]=t.timestamp,t.has_changes&&t.updates.length>0&&(console.log(`[Feed Store] Ticker found ${t.updates.length} changes for ${e}`),await this.processTickerUpdates(e,t.updates))}catch(t){t.xhr_status!==404&&console.error("[Feed Store] Ticker check failed:",t)}finally{this.tickerPending[e]=!1}}},async processTickerUpdates(e,t){var o;console.log(`[processTickerUpdates] Called for context: ${e} with ${t.length} updates`),console.log("[processTickerUpdates] Updates:",t);const s=[],u=[];if(t.forEach(i=>{console.log("[processTickerUpdates] Processing update:",{id:i.id,action:i.action,updated_at:i.updated_at});const m=this.feedsById[i.id];console.log("[processTickerUpdates] Existing feed in store:",m?{id:m.id,updated_at:m.updated_at}:"NOT IN STORE"),i.action==="deleted"?(console.log(`[processTickerUpdates] ➡️ Marking feed ${i.id} for DELETION`),u.push(i.id)):i.action==="created"?(console.log(`[processTickerUpdates] ➡️ Marking feed ${i.id} for FETCH (CREATED)`),s.push(i.id)):i.action==="updated"&&(!m||new Date(m.updated_at)<new Date(i.updated_at)?(console.log(`[processTickerUpdates] ➡️ Marking feed ${i.id} for FETCH (UPDATED - ${m?"outdated":"not in store"})`),s.push(i.id)):console.log(`[processTickerUpdates] ⏭️ Skipping feed ${i.id} - already have latest version`))}),console.log("[processTickerUpdates] Summary:",{toFetch:s.length,toDelete:u.length,fetchIds:s,deleteIds:u}),u.length>0&&(console.log(`[processTickerUpdates] 🗑️ Deleting ${u.length} feeds from ${e}`),this.deleteFeedsFromStore(e,u)),s.length>0){console.log(`[processTickerUpdates] 📥 Fetching ${s.length} feeds for ${e}`),await this.fetchFeedsByIds(e,s);const i=t.filter(m=>m.action==="created").length;i>0&&(this.newPostsCount[e]=(this.newPostsCount[e]||0)+i)}(o=window.fluentFrameworkApp)!=null&&o.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("feeds_updated",{context:e,added:s.filter(i=>!this.feedsById[i]).length,updated:s.filter(i=>this.feedsById[i]).length,removed:u.length})},async fetchFeedsByIds(e,t){if(t.length===0)return;console.log("[Feed Store] fetchFeedsByIds called:",{context:e,count:t.length,ids:t});const s=20;try{if(t.length>s){console.log(`[Feed Store] Batching ${t.length} feeds into chunks of ${s}`);for(let u=0;u<t.length;u+=s){const o=t.slice(u,u+s);await this.fetchFeedBatch(e,o)}}else await this.fetchFeedBatch(e,t);console.log(`[Feed Store] Successfully fetched ${t.length} feeds for ${e}`)}catch(u){console.error("[Feed Store] Failed to fetch feeds by IDs:",{context:e,feedIds:t,error:u})}},async fetchFeedBatch(e,t){try{console.log("[Feed Store] Fetching feeds:",{context:e,feedIds:t});const s=await this.$api.post("feeds/batch",{feed_ids:t,context:e});if(console.log("[Feed Store] API response:",s),!s||!Array.isArray(s.feeds)){console.error("[Feed Store] Invalid response from /feeds/batch:",s);return}console.log(`[Feed Store] Received ${s.feeds.length} feeds for context: ${e}`),s.feeds.forEach(u=>{this.feedsById[u.id]=u,this.feedsByContext[e]||(this.feedsByContext[e]={data:[],timestamp:Date.now()});const o=this.feedsByContext[e].data,i=o.findIndex(m=>m.id===u.id);i===-1?o.unshift(u):o[i]=u})}catch(s){throw console.error("[Feed Store] Failed to fetch batch for context:",e,s),s}},deleteFeedsFromStore(e,t){t.forEach(s=>{var o;delete this.feedsById[s],(o=this.feedsByContext[e])!=null&&o.data&&(this.feedsByContext[e].data=this.feedsByContext[e].data.filter(i=>i.id!==s)),ce().invalidate(`feed:${s}`)}),console.log(`[Feed Store] Deleted ${t.length} feeds from ${e}`)},clearNewPostsCount(e){this.newPostsCount[e]=0},clearAll(){this.stopAllTickers(),this.feedsByContext={},this.feedsById={},this.stickyFeeds={},this.loading={},this.pagination={},this.filters={},this.ticker={count:0,lastFetched:0},this.executionTimes={},this._pendingRequests={},this.tickerIntervals={},this.tickerEnabled={},this.lastTickerCheck={},this.tickerPending={},this.newPostsCount={}}}}),je=We("space",{state:()=>({spacesBySlug:{},currentSpace:null,mySpaces:[],topicsBySpace:{},loading:{},mySpacesLoading:!1,lastFetched:{}}),getters:{getSpaceBySlug:e=>t=>e.spacesBySlug[t]||null,getCurrentSpace:e=>e.currentSpace,getSpaceTopics:e=>t=>e.topicsBySpace[t]||[],isJoinedSpace:e=>t=>e.mySpaces.some(s=>s.slug===t),getMySpaces:e=>[...e.mySpaces].sort((t,s)=>t.title.localeCompare(s.title)),isLoading:e=>t=>e.loading[t]||!1,joinedSpacesCount:e=>e.mySpaces.length},actions:{async fetchSpace(e,t=!1){const s=ce(),u=`space:${e}`;if(!t){const o=s.get(u);if(o)return this.spacesBySlug[e]=o,this.currentSpace=o,o}this.loading[e]=!0;try{const o=await this.$api.get(`spaces/${e}/by-slug`),i=o.space||o;return this.spacesBySlug[e]=i,this.currentSpace=i,this.lastFetched[e]=Date.now(),o.topics&&(this.topicsBySpace[e]=o.topics),o.pending_count!==void 0&&(i.pending_count=o.pending_count),s.set(u,i,15*60*1e3),typeof window<"u"&&(window.fcom_current_community=i),this.loading[e]=!1,i}catch(o){throw this.loading[e]=!1,console.error("Failed to fetch space:",o),o}},async joinSpace(e,t=null){var i,m,f;const s=ce(),u=t||this.spacesBySlug[e];if(!u)throw new Error("Space not found");const o=((i=u.user_status)==null?void 0:i.status)==="active";o||(u.user_status||(u.user_status={}),u.user_status.status="active",u.members_count=(u.members_count||0)+1,this.mySpaces.find(h=>h.slug===e)||this.mySpaces.push(u));try{const h=await this.$api.post(`spaces/${e}/join`),g=(m=h.membership)==null?void 0:m.status;if(g&&(u.user_status.status=g),g&&g!=="active"&&!o){u.members_count=Math.max(0,(u.members_count||1)-1);const w=this.mySpaces.findIndex(b=>b.slug===e);w!==-1&&this.mySpaces.splice(w,1)}return s.invalidate(`space:${e}`),s.invalidate("my-spaces"),(f=window.fluentFrameworkApp)!=null&&f.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("space_joined",u),h}catch(h){if(!o){u.user_status.status=null,u.members_count=Math.max(0,(u.members_count||1)-1);const g=this.mySpaces.findIndex(w=>w.slug===e);g!==-1&&this.mySpaces.splice(g,1)}throw console.error("Failed to join space:",h),h}},async leaveSpace(e){var m,f,h,g;const t=ce(),s=this.spacesBySlug[e];if(!s)throw new Error("Space not found");const u=((m=s.user_status)==null?void 0:m.status)==="active",o=(f=s.user_status)==null?void 0:f.status,i=s.members_count;if(u){s.user_status.status=null,s.members_count=Math.max(0,(s.members_count||1)-1);const w=this.mySpaces.findIndex(b=>b.slug===e);w!==-1&&this.mySpaces.splice(w,1)}try{const w=await this.$api.post(`spaces/${e}/leave`),b=w.space||w;return this.spacesBySlug[e]=b,((h=this.currentSpace)==null?void 0:h.slug)===e&&(this.currentSpace=b),t.invalidate(`space:${e}`),t.invalidate("my-spaces"),(g=window.fluentFrameworkApp)!=null&&g.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("space_left",b),b}catch(w){throw u&&(s.user_status.status=o,s.members_count=i,this.mySpaces.push(s)),console.error("Failed to leave space:",w),w}},setCurrentSpace(e){const t=this.spacesBySlug[e];t&&(this.currentSpace=t,typeof window<"u"&&(window.fcom_current_community=t))},clearCurrentSpace(){this.currentSpace=null,typeof window<"u"&&(window.fcom_current_community=null)},invalidateSpace(e){const t=ce();t.invalidate(`space:${e}`),t.invalidate(`space-topics:${e}`),delete this.lastFetched[e]},clearAll(){this.spacesBySlug={},this.currentSpace=null,this.mySpaces=[],this.topicsBySpace={},this.loading={},this.mySpacesLoading=!1,this.lastFetched={};const e=ce();e.invalidatePattern("space:"),e.invalidatePattern("space-topics:"),e.invalidate("my-spaces")}}}),ds=We("notification",{state:()=>({notifications:[],unreadCount:0,loading:!1,pagination:{page:1,per_page:20,total:0,has_more:!1},pollingInterval:null,pollingEnabled:!1,lastFetched:0}),getters:{getUnreadCount:e=>e.unreadCount,getNotifications:e=>e.notifications,getUnreadNotifications:e=>e.notifications.filter(t=>!t.is_read),isLoading:e=>e.loading,isPollingActive:e=>e.pollingEnabled&&e.pollingInterval!==null},actions:{async fetchNotifications(e=!1){this.loading=!0;const t=e?this.pagination.page+1:1;try{const s=await this.$api.get("notifications",{page:t,per_page:this.pagination.per_page});return e?this.notifications=[...this.notifications,...s.notifications.data]:this.notifications=s.notifications.data,this.pagination={page:t,per_page:this.pagination.per_page,total:s.notifications.total,has_more:s.notifications.has_more},this.unreadCount=s.unread_count||0,this.lastFetched=Date.now(),this.loading=!1,s}catch(s){throw this.loading=!1,console.error("Failed to fetch notifications:",s),s}},async fetchUnreadCount(){try{const e=await this.$api.get("notifications/unread");return this.unreadCount=e.unread_count||0,this.unreadCount}catch(e){return e.xhr_status!==404&&console.error("Failed to fetch unread count:",e),this.unreadCount}},async markAsRead(e){var s;const t=this.notifications.find(u=>u.id===e);t&&!t.is_read&&(t.is_read=!0,this.unreadCount=Math.max(0,this.unreadCount-1));try{const u=await this.$api.post(`notifications/mark-read/${e}`);this.unreadCount=u.unread_count??this.unreadCount,(s=window.fluentFrameworkApp)!=null&&s.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("notification_read",e)}catch(u){throw t&&(t.is_read=!1,this.unreadCount++),console.error("Failed to mark notification as read:",u),u}},async markFeedNotificationsAsRead(e){var u;const t=this.notifications.filter(o=>o.object_id===e&&!o.is_read),s=this.unreadCount;t.forEach(o=>{o.is_read=!0}),this.unreadCount=Math.max(0,this.unreadCount-t.length);try{const o=await this.$api.post(`notifications/mark-read/${e}/by-feed-id`);this.unreadCount=o.unread_notification_count??this.unreadCount,(u=window.fluentFrameworkApp)!=null&&u.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("feed_notifications_read",e)}catch(o){throw t.forEach(i=>{i.is_read=!1}),this.unreadCount=s,console.error("Failed to mark feed notifications as read:",o),o}},async markAllAsRead(){var s;const e=this.unreadCount,t=this.notifications.map(u=>({...u,is_read:u.is_read}));this.notifications.forEach(u=>{u.is_read=!0}),this.unreadCount=0;try{await this.$api.post("notifications/mark-all-read"),(s=window.fluentFrameworkApp)!=null&&s.$eventBus&&(window.fluentFrameworkApp.$eventBus.emit("all_notifications_read"),window.fluentFrameworkApp.$eventBus.emit("notification_count_updated",0))}catch(u){throw this.notifications=t,this.unreadCount=e,console.error("Failed to mark all notifications as read:",u),u}},startPolling(e=6e4){this.pollingInterval&&this.stopPolling(),this.pollingEnabled=!0,this.fetchUnreadCount(),this.pollingInterval=setInterval(()=>{this.fetchUnreadCount()},e),console.log(`[Notification Store] Polling started (interval: ${e}ms)`)},stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null,this.pollingEnabled=!1,console.log("[Notification Store] Polling stopped"))},clearAll(){this.notifications=[],this.unreadCount=0,this.loading=!1,this.pagination={page:1,per_page:20,total:0,has_more:!1},this.lastFetched=0,this.stopPolling()}}}),oo=We("ticker",{state:()=>({tickerInterval:null,enabled:!1,lastCheck:null,pending:!1,errorCount:0,minInterval:45e3,maxInterval:75e3,maxBackoff:6e4,maxErrors:5,paused:!1,visibilityHandler:null}),getters:{isActive:e=>e.enabled&&e.tickerInterval!==null,isPaused:e=>e.paused},actions:{start(e=45e3,t=75e3,s=5e4){this.tickerInterval&&this.stop(),this.minInterval=e,this.maxInterval=t,this.enabled=!0,this.errorCount=0,this.lastCheck=null,console.log(`[Global Ticker] Started (random interval: ${e}ms - ${t}ms, initial delay: ${s}ms)`),this.setupVisibilityHandler(),console.log(`[Global Ticker] First check scheduled in ${(s/1e3).toFixed(1)} seconds`),setTimeout(async()=>{this.enabled&&(await this.check(),this.scheduleNextCheck())},s)},scheduleNextCheck(){if(this.tickerInterval&&(clearTimeout(this.tickerInterval),this.tickerInterval=null),!this.enabled)return;let e;this.errorCount>0?e=Math.min(this.maxBackoff,1e3*Math.pow(2,this.errorCount)):e=Math.floor(Math.random()*(this.maxInterval-this.minInterval+1))+this.minInterval,console.log(`[Global Ticker] Next check in ${(e/1e3).toFixed(1)} seconds`),this.tickerInterval=setTimeout(async()=>{this.paused||await this.check(),this.scheduleNextCheck()},e)},stop(){const e=this.enabled||this.tickerInterval!==null;this.tickerInterval&&(clearTimeout(this.tickerInterval),this.tickerInterval=null),this.enabled=!1,this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),e&&console.log("[Global Ticker] Stopped")},pause(){this.paused=!0,console.log("[Global Ticker] Paused (tab hidden)")},resume(){this.paused=!1,console.log("[Global Ticker] Resumed (tab visible)"),this.check()},async check(){if(!this.pending){this.pending=!0;try{const e={};this.lastCheck&&(e.since=this.lastCheck),console.log("[Global Ticker] Check params:",e);const t=await this.$api.get("feeds/ticker",e);t&&t.timestamp&&(this.lastCheck=t.timestamp,console.log("[Global Ticker] Updated lastCheck to:",this.lastCheck)),this.errorCount=0,await this.processUpdates(t)}catch(e){this.handleError(e)}finally{this.pending=!1}}},async processUpdates(e){var i;const{feeds:t=[],notifications:s={},spaces:u=[],has_changes:o=!1}=e;if(s&&s.unread_count!==void 0&&this.processNotificationUpdates(s),!!o&&(console.log("[Global Ticker] Processing updates:",{feeds:t.length,notifications:s.unread_count||0,spaces:u.length}),t.length>0&&await this.processFeedUpdates(t),u.length>0&&this.processSpaceUpdates(u),(i=window.fluentFrameworkApp)!=null&&i.$eventBus)){const m={...e,unread_notification_count:s.unread_count||0};window.fluentFrameworkApp.$eventBus.emit("ticker_updated",m)}},async processFeedUpdates(e){console.log("[Ticker Debug] processFeedUpdates called with:",e);const t=Me();e.forEach(s=>{var m;const u=s.context||"global",o=s.id,i=[u];if(s.action!=="deleted"&&(u.startsWith("space-")&&i.push("global"),s.user_id&&i.push(`user-${s.user_id}`)),s.action==="deleted")console.log(`[Global Ticker] Deleting feed ${o} from contexts:`,i),i.forEach(f=>{t.deleteFeedsFromStore(f,[o])});else if(s.feed_data){const f=s.feed_data;console.log(`[Global Ticker] Updating feed ${o} in contexts:`,i),i.forEach(h=>{t.feedsById[f.id]=f,t.feedsByContext[h]||(t.feedsByContext[h]={data:[],timestamp:Date.now()});const g=t.feedsByContext[h].data,w=g.findIndex(b=>b.id===f.id);w===-1?(g.unshift(f),console.log(`[Global Ticker] Added feed ${f.id} to ${h}`),s.action==="created"&&(t.newPostsCount[h]=(t.newPostsCount[h]||0)+1)):(g[w]=f,console.log(`[Global Ticker] Updated feed ${f.id} in ${h}`))}),(m=window.fluentFrameworkApp)!=null&&m.$eventBus&&i.forEach(h=>{window.fluentFrameworkApp.$eventBus.emit("feeds_updated",{context:h,added:s.action==="created"?1:0,updated:s.action==="updated"?1:0,removed:0})})}else console.warn(`[Global Ticker] Feed ${o} has no feed_data, skipping update`)})},processNotificationUpdates(e){const t=ds();e.unread_count!==void 0&&(t.unreadCount=e.unread_count),e.new_count>0&&console.log("[Global Ticker] New notifications:",e.new_count)},processSpaceUpdates(e){console.log("[Global Ticker] Space updates:",e.length)},handleError(e){if(e&&e.xhr_status!==404&&console.error("[Global Ticker] Check failed:",e),this.errorCount++,this.errorCount>=this.maxErrors){console.warn("[Global Ticker] Too many consecutive failures — stopping ticker."),this.stop();return}},setupVisibilityHandler(){typeof document.hidden<"u"&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=()=>{document.hidden?this.pause():this.resume()},document.addEventListener("visibilitychange",this.visibilityHandler))}}}),Vn={name:"ChatIcon"},Mn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ln=l("path",{d:"M6.66732 11.25H13.334M6.66732 7.08333H10.0007",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Tn=l("path",{d:"M5.08267 15.833C3.99924 15.7264 3.18762 15.401 2.6433 14.8567C1.66699 13.8804 1.66699 12.309 1.66699 9.16634V8.74967C1.66699 5.60698 1.66699 4.03563 2.6433 3.05932C3.61961 2.08301 5.19096 2.08301 8.33366 2.08301H11.667C14.8097 2.08301 16.381 2.08301 17.3573 3.05932C18.3337 4.03563 18.3337 5.60698 18.3337 8.74967V9.16634C18.3337 12.309 18.3337 13.8804 17.3573 14.8567C16.381 15.833 14.8097 15.833 11.667 15.833C11.1999 15.8434 10.8279 15.879 10.4625 15.9622C9.46385 16.1921 8.5391 16.7031 7.62522 17.1487C6.32307 17.7837 5.67199 18.1012 5.2634 17.8039C4.48174 17.2218 5.24577 15.4179 5.41699 14.583",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),Fn=[Ln,Tn];function Pn(e,t,s,u,o,i){return n(),c("svg",Mn,Fn)}const tt=I(Vn,[["render",Pn]]),In={name:"HeartIcon",props:{filled:{default:!1}}},En={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},Un=l("g",null,[l("path",{d:"M20.884 13.19c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"})],-1),An=[Un],Bn={key:1,viewBox:"0 0 24 24","aria-hidden":"true"},Dn=l("g",null,[l("path",{d:"M16.697 5.5c-1.222-.06-2.679.51-3.89 2.16l-.805 1.09-.806-1.09C9.984 6.01 8.526 5.44 7.304 5.5c-1.243.07-2.349.78-2.91 1.91-.552 1.12-.633 2.78.479 4.82 1.074 1.97 3.257 4.27 7.129 6.61 3.87-2.34 6.052-4.64 7.126-6.61 1.111-2.04 1.03-3.7.477-4.82-.561-1.13-1.666-1.84-2.908-1.91zm4.187 7.69c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"})],-1),Rn=[Dn];function xn(e,t,s,u,o,i){return s.filled?(n(),c("svg",En,An)):(n(),c("svg",Bn,Rn))}const st=I(In,[["render",xn]]),Hn={name:"NotificationsBlock",emits:["close"],components:{ChatIcon:tt,HeartIcon:st},props:["notifications"],methods:{handleNotificationClick(e,t){var o,i;if(this.markRead(e,t),!["comment_added","mention_added","comment/react_added","child_comment_added"].includes(e.action))return;const u=(i=(o=this.getNotificationRoute(e))==null?void 0:o.query)==null?void 0:i.comment_id;u&&this.$eventBus.emit("scroll_to_comment",u)},markRead(e){e.subscriber&&e.subscriber.is_read==1||this.$post("notifications/mark-read/"+e.id).then(t=>{const s=e.feed_id;this.notifications.forEach(u=>{u.subscriber&&(u.id===e.id||s&&u.feed_id===s)&&(u.subscriber.is_read=1)}),this.$eventBus.emit("notification_count_updated",t.unread_count)})},getNotificationRoute(e){const{route:t,action:s,object_id:u,feed_id:o}=e;return{...t,query:{comment_added:{comment_id:u},mention_added:{comment_id:u},"comment/react_added":{comment_id:u},comment_report_added:{comment_id:o}}[s]??t.query??{}}}}},On={class:"notification_avatar"},jn={class:"fcom_notification_type"},Nn=l("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"},[l("path",{d:"M12.9915 20.5C13.7121 20.5 13.9925 20.4956 13.9925 20.4956C17.4088 20.471 19.2922 20.3099 20.5342 19.2552C22 18.0104 22 16.0069 22 12C22 7.99306 22 5.98959 20.5342 4.7448C19.0683 3.5 16.7091 3.5 11.9906 3.5C7.27213 3.5 4.91289 3.5 3.44705 4.7448C2.32426 5.69827 2.0615 7.09687 2 9.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M2.98242 19.5H2.9914",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M2 15.7349C4.49328 15.7349 6.77053 18 6.77053 20.4996M10 20.4996C10 16 5.99511 12.5 2.04522 12.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1),zn={class:"notification_content"},qn=["innerHTML"],Gn=["title"];function Yn(e,t,s,u,o,i){const m=p("UserAvatar"),f=p("ChatIcon"),h=j,g=p("HeartIcon"),w=p("router-link");return n(!0),c(F,null,x(s.notifications,(b,S)=>{var k;return n(),c("div",{class:R(["notification_wrap",{notification_wrap_unread:((k=b==null?void 0:b.subscriber)==null?void 0:k.is_read)=="0"}])},[a(w,{onClick:$=>i.handleNotificationClick(b,S),to:i.getNotificationRoute(b),class:"notification_item"},{default:r(()=>[l("div",On,[a(m,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"]),l("div",jn,[b.action=="comment_added"||b.action=="child_comment_added"?(n(),y(h,{key:0,class:"fcom_nt_comment"},{default:r(()=>[a(f)]),_:1})):b.action=="feed/react_added"||b.action=="comment/react_added"?(n(),y(h,{key:1,class:"fcom_nt_heart"},{default:r(()=>[a(g,{filled:!0})]),_:1})):b.action=="feed/mentioned"||b.action=="mention_added"?(n(),y(h,{key:2,class:"fcom_nt_mention"},{default:r(()=>[a(f)]),_:1})):b.action=="space_feed/created"?(n(),y(h,{key:3,class:"fcom_new_post"},{default:r(()=>[Nn]),_:1})):_("",!0)])]),l("div",zn,[l("div",{innerHTML:b.content},null,8,qn),l("span",{title:b.updated_at,class:"notification_time_stamp"},d(e.humanDateDiff(b.updated_at)),9,Gn)])]),_:2},1032,["onClick","to"])],2)}),256)}const io=I(Hn,[["render",Yn]]),Wn={name:"NotificationIcon"},Kn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Zn=l("path",{d:"M2.10794 11.9954C1.93073 13.1229 2.72301 13.9055 3.69305 14.2955C7.41201 15.7908 12.5873 15.7908 16.3063 14.2955C17.2763 13.9055 18.0686 13.1229 17.8914 11.9954C17.7825 11.3024 17.244 10.7254 16.845 10.162C16.3224 9.41493 16.2705 8.60009 16.2704 7.73317C16.2704 4.38291 13.4629 1.66699 9.99968 1.66699C6.53645 1.66699 3.72895 4.38291 3.72895 7.73317C3.72887 8.60009 3.67694 9.41493 3.15435 10.162C2.75537 10.7254 2.21685 11.3024 2.10794 11.9954Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Jn=l("path",{d:"M7.5 17.5C8.16345 18.0182 9.03956 18.3333 10 18.3333C10.9604 18.3333 11.8366 18.0182 12.5 17.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Qn=[Zn,Jn];function Xn(e,t,s,u,o,i){return n(),c("svg",Kn,Qn)}const el=I(Wn,[["render",Xn]]),tl={name:"Notifications",components:{NotificationsBlock:io,NotificationIcon:el},data(){return{unread_notifications:[],unread_count:parseInt(this.appVars.unread_notification_count),loading:!1,working:!1,visible:!1,notification_type:"all"}},methods:{onTickerUpdated(e){this.appVars.unread_notification_count=e.unread_notification_count,this.unread_count=e.unread_notification_count},onNotificationCountUpdated(e){this.appVars.unread_notification_count=e,this.unread_count=e},switchType(e){this.notification_type=e,this.fetchUnread()},toggleNotifications(){this.loading=!0,this.visible=!this.visible,this.visible?this.fetchUnread():this.loading=!1},handleClose(){this.$refs.notification_pop.hide(),this.visible=!1},fetchUnread(){this.loading=!0;const e={per_page:50};this.notification_type==="unread"?e.status="unread":e.notification_type=this.notification_type,this.$get("notifications",e).then(t=>{var s;this.unread_notifications=((s=t.notifications)==null?void 0:s.data)||[],this.appVars.unread_notification_count=t.unread_count,this.unread_count=t.unread_count}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})},markAllRead(){this.working=!0,this.$post("notifications/mark-all-read").then(e=>{this.$notify.success(e.message),this.fetchUnread()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1})},keyBind(e){e.code==="KeyN"&&e.altKey&&this.$refs.notification_icon.click()}},mounted(){var e;document.addEventListener("keydown",this.keyBind),(e=window.fcom_portal_general)!=null&&e.hide_header_on_scroll&&(this._scrollClose=()=>this.isMobile&&this.handleClose(),document.addEventListener("fcom_layout_scroll",this._scrollClose)),this.$eventBus.on("ticker_updated",this.onTickerUpdated),this.$eventBus.on("notification_count_updated",this.onNotificationCountUpdated)},beforeUnmount(){document.removeEventListener("keydown",this.keyBind),this._scrollClose&&document.removeEventListener("fcom_layout_scroll",this._scrollClose),this.$eventBus.off("ticker_updated",this.onTickerUpdated),this.$eventBus.off("notification_count_updated",this.onNotificationCountUpdated)}},sl=["aria-label"],ol={class:"notifications_wrap unread_notifications"},il={class:"norification_pop_header"},nl={class:"fcom_filter_menu"},ll={class:"fcom_filter_menu_ul"},al={key:2,class:"fcom_no_unread_notifications"};function rl(e,t,s,u,o,i){const m=p("NotificationIcon"),f=j,h=Qo,g=H,w=Z,b=p("notifications-block"),S=p("router-link"),k=ye,$=te("loading");return n(),y(k,{popperClass:"notification_pop","popper-options":{strategy:"fixed"},onBeforeEnter:t[7]||(t[7]=v=>i.toggleNotifications()),ref:"notification_pop",trigger:"click",placement:"bottom",width:500},{reference:r(()=>[a(h,{max:20,hidden:!o.unread_count,value:o.unread_count,class:"item"},{default:r(()=>[l("button",{class:"fcom_menu_button","aria-label":e.$t("Notifications"),ref:"notification_icon"},[a(f,null,{default:r(()=>[a(m)]),_:1})],8,sl)]),_:1},8,["hidden","value"])]),default:r(()=>[l("div",ol,[l("div",il,[l("h3",null,d(e.$t("Recent Notifications")),1),l("div",null,[W((n(),y(g,{disabled:o.working,size:"small",onClick:t[0]||(t[0]=v=>i.markAllRead())},{default:r(()=>[V(d(e.$t("Mark all as read")),1)]),_:1},8,["disabled"])),[[$,o.working]])])]),l("div",nl,[l("ul",ll,[l("li",null,[l("a",{onClick:t[1]||(t[1]=z(v=>i.switchType("all"),["prevent"])),class:R({"router-link-exact-active":o.notification_type=="all"}),href:"#"},d(e.$t("Recent")),3)]),l("li",null,[l("a",{onClick:t[2]||(t[2]=z(v=>i.switchType("unread"),["prevent"])),class:R({"router-link-exact-active":o.notification_type=="unread"}),href:"#"},d(e.$t("Unread")),3)]),l("li",null,[l("a",{onClick:t[3]||(t[3]=z(v=>i.switchType("mentioned"),["prevent"])),class:R({"router-link-exact-active":o.notification_type=="mentioned"}),href:"#"},d(e.$t("Mentions")),3)]),l("li",null,[l("a",{onClick:t[4]||(t[4]=z(v=>i.switchType("following"),["prevent"])),class:R({"router-link-exact-active":o.notification_type=="following"}),href:"#"},d(e.$t("Following")),3)])])]),o.loading?(n(),y(w,{key:0,style:{"margin-top":"15px"},animated:!0,rows:2})):o.unread_notifications.length?(n(),c("div",{key:1,onClick:t[6]||(t[6]=v=>e.$refs.notification_pop.hide()),class:"notifications fcom_thin_scrollbar"},[a(b,{onClose:t[5]||(t[5]=v=>i.handleClose()),notifications:o.unread_notifications},null,8,["notifications"])])):(n(),c("div",al,[l("p",null,d(e.$t("No notifications found")),1)])),a(S,{class:"fcom_view_all_notifications",to:{name:"notifications"},onClick:i.handleClose},{default:r(()=>[a(g,{class:"fcom_secondary_button"},{default:r(()=>[V(d(e.$t("View All")),1)]),_:1})]),_:1},8,["onClick"])])]),_:1},512)}const cl=I(tl,[["render",rl]]),dl={name:"ImageUploader",emits:["uploaded","completed","uploading"],data(){return{loading:!1}},props:{button_text:{type:String,default:""},remove_label:{type:String,default:""},additionalData:{type:Object,default:()=>({})},isMultiple:{type:Boolean,default:!1},can_remove:{type:Boolean,default:!1},confirm_remove:{type:Boolean,default:!1},isTextBtn:{type:Boolean,default:!0},removeIcon:{type:Boolean,default:!0},className:{type:String,default:"image-uploader"}},methods:{handleRemove(){if(!this.confirm_remove){this.$emit("uploaded","");return}this.$confirm(this.$t("Are you sure you want to remove this image?"),this.$t("Remove Image?"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.$emit("uploaded","")})},handleSuccess(e){this.$emit("uploaded",e.media.url),this.$emit("completed",e),this.loading=!1},handleError(e){this.$handleError(JSON.parse(e.message)),this.$emit("completed",e),this.loading=!1},inProgress(e){this.$emit("uploading"),this.loading=!0}},computed:{action_url(){return this.appVars.rest.url+"/feeds/media-upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}}}};function ul(e,t,s,u,o,i){const m=H,f=mt,h=p("CloseBold"),g=j,w=te("loading");return n(),c(F,null,[a(f,{class:R(s.className),multiple:s.isMultiple,action:i.action_url,headers:i.headers,accept:"image/*",data:s.additionalData,"on-success":i.handleSuccess,"on-progress":i.inProgress,"on-error":i.handleError,"show-file-list":!1},{default:r(()=>[Y(e.$slots,"trigger",{loading:o.loading},()=>[Y(e.$slots,"default",{loading:o.loading},()=>[W((n(),y(m,{disabled:o.loading,text:s.isTextBtn,class:"fcom_plain_button"},{default:r(()=>[V(d(s.button_text||e.$t("Upload Photo")),1)]),_:1},8,["disabled","text"])),[[w,o.loading]])])])]),_:3},8,["class","multiple","action","headers","data","on-success","on-progress","on-error"]),s.can_remove?(n(),y(m,{key:0,class:"remove_img",size:"small",type:"danger",plain:"",onClick:i.handleRemove,text:s.isTextBtn,"aria-label":s.remove_label||e.$t("Remove")},{default:r(()=>[Y(e.$slots,"remove",{},()=>[s.removeIcon?(n(),y(g,{key:0},{default:r(()=>[a(h)]),_:1})):_("",!0),l("span",null,d(e.$t("Remove")),1)])]),_:3},8,["onClick","text","aria-label"])):_("",!0)],64)}const xe=I(dl,[["render",ul]]),_l={name:"ImageIcon"},ml={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},hl=l("path",{d:"M7.49996 18.3327H12.5C16.6666 18.3327 18.3333 16.666 18.3333 12.4993V7.49935C18.3333 3.33268 16.6666 1.66602 12.5 1.66602H7.49996C3.33329 1.66602 1.66663 3.33268 1.66663 7.49935V12.4993C1.66663 16.666 3.33329 18.3327 7.49996 18.3327Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),fl=l("path",{d:"M7.50004 8.33333C8.42052 8.33333 9.16671 7.58714 9.16671 6.66667C9.16671 5.74619 8.42052 5 7.50004 5C6.57957 5 5.83337 5.74619 5.83337 6.66667C5.83337 7.58714 6.57957 8.33333 7.50004 8.33333Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),pl=l("path",{d:"M2.22498 15.7918L6.33331 13.0335C6.99164 12.5918 7.94164 12.6418 8.53331 13.1501L8.80831 13.3918C9.45831 13.9501 10.5083 13.9501 11.1583 13.3918L14.625 10.4168C15.275 9.85846 16.325 9.85846 16.975 10.4168L18.3333 11.5835",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),gl=[hl,fl,pl];function yl(e,t,s,u,o,i){return n(),c("svg",ml,gl)}const us=I(_l,[["render",yl]]),vl={name:"PollIcon"},bl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},kl=l("path",{d:"M1.66663 18.334H18.3333",stroke:"currentColor","stroke-width":"1.5","stroke-miterlimit":"10","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),wl=l("path",{d:"M8.125 3.33268V18.3327H11.875V3.33268C11.875 2.41602 11.5 1.66602 10.375 1.66602H9.625C8.5 1.66602 8.125 2.41602 8.125 3.33268Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Cl=l("path",{d:"M2.5 8.33268V18.3327H5.83333V8.33268C5.83333 7.41602 5.5 6.66602 4.5 6.66602H3.83333C2.83333 6.66602 2.5 7.41602 2.5 8.33268Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),$l=l("path",{d:"M14.1666 12.5007V18.334H17.5V12.5007C17.5 11.584 17.1666 10.834 16.1666 10.834H15.5C14.5 10.834 14.1666 11.584 14.1666 12.5007Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Sl=[kl,wl,Cl,$l];function Vl(e,t,s,u,o,i){return n(),c("svg",bl,Sl)}const Ml=I(vl,[["render",Vl]]),Ll={name:"SurveyEditForm",props:{form:{type:Object,required:!0},is_editing:{type:Boolean,default:!1}},emits:["cancel"],data(){return{}},methods:{addOption(){this.form.options.push({label:"",slug:""})},removeOption(e){this.form.options.splice(e,1)}}},Tl={class:"fcom_compose_app_form"},Fl={class:"fcom_app_header"},Pl={class:"fcom_app_options"},Il={class:"fcom_app_pref"},El={class:"fcom_app_footer"},Ul=l("br",null,null,-1),Al={style:{"font-weight":"500",color:"var(--el-text-color-regular)","font-size":"14px"}};function Bl(e,t,s,u,o,i){const m=H,f=se,h=p("Plus"),g=j,w=he,b=Xe;return n(),c("div",Tl,[l("div",Fl,[l("h5",null,d(e.$t("Poll Options")),1),l("div",null,[a(m,{onClick:t[0]||(t[0]=S=>e.$emit("cancel")),size:"small",text:""},{default:r(()=>[V(d(e.$t("cancel")),1)]),_:1})])]),l("div",Pl,[(n(!0),c(F,null,x(s.form.options,(S,k)=>(n(),c("div",{class:"fcom_app_option",key:"option_"+k},[a(f,{modelValue:S.label,"onUpdate:modelValue":$=>S.label=$,type:"text",placeholder:e.$t("Your option text")},ge({_:2},[!S.slug&&k!==0?{name:"suffix",fn:r(()=>[a(m,{onClick:$=>i.removeOption(k),text:"",size:"small"},{default:r(()=>[V("x")]),_:2},1032,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","onUpdate:modelValue","placeholder"])]))),128)),l("div",Il,[a(m,{onClick:i.addOption,text:"",size:"small"},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1}),l("span",null,d(e.$t("Add More")),1)]),_:1},8,["onClick"])])]),l("div",El,[l("h5",null,d(e.$t("Poll Settings")),1),s.is_editing?_("",!0):(n(),y(w,{key:0,modelValue:s.form.type,"onUpdate:modelValue":t[1]||(t[1]=S=>s.form.type=S),"true-value":"multi_choice","false-value":"single_choice",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Users can choose multiple options")),1)]),_:1},8,["modelValue"])),Ul,l("label",Al,d(e.$t("End Date:")),1),l("div",null,[a(b,{style:{"min-width":"50%"},placeholder:e.$t("Leave blank for not end"),clearable:!0,type:"datetime",modelValue:s.form.end_date,"onUpdate:modelValue":t[2]||(t[2]=S=>s.form.end_date=S),"value-format":"YYYY-MM-DD HH:mm:ss"},null,8,["placeholder","modelValue"])])])])}const Dl=I(Ll,[["render",Bl]]),Rl={name:"GiphyIcon"},xl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},Hl=Te('<path d="M12.9287 10.09H14.7095" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path><path d="M15.0781 8.20333H12.9277V11.98" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path><path d="M10.3458 8.19998V11.98" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path><path d="M7.74961 8.2H6.48961C5.44549 8.2 4.59961 9.04588 4.59961 10.09V10.09C4.59961 11.1341 5.44549 11.98 6.48961 11.98H7.74961V10.09H6.69961" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path><path d="M4.5 19C2.567 19 1 17.433 1 15.5L1 4.49999C1 2.567 2.567 0.999992 4.5 0.999992H15.5C17.433 0.999992 19 2.567 19 4.49999V15.5C19 17.433 17.433 19 15.5 19H4.5Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>',5),Ol=[Hl];function jl(e,t,s,u,o,i){return n(),c("svg",xl,Ol)}const Nl=I(Rl,[["render",jl]]),zl={name:"Giphy",components:{GiphyIcon:Nl},data(){return{gifs:[],searchQuery:"",offset:0,limit:20,loading:!1}},methods:{loadGifs(){var t,s;if(this.offset===0&&((s=(t=this.$gloablStorage)==null?void 0:t.gifs)==null?void 0:s.length)>0&&!this.searchQuery){this.gifs=this.$gloablStorage.gifs;return}this.loading=!0;const e={limit:this.limit,offset:this.offset,q:this.searchQuery.trim()};this.$get("giphy",e).then(u=>{this.gifs=this.offset===0?u.gifs:this.gifs.concat(u.gifs),!this.searchQuery&&this.offset===0&&(this.$gloablStorage.gifs=this.gifs),this.offset+=this.limit}).catch(u=>{this.$handleError(u)}).finally(()=>{this.loading=!1})},handleGiphyClick(){this.offset=0,this.searchQuery="",this.loadGifs()},handleSearch:nn(function(){this.offset=0,this.loadGifs()},300),handleScroll(e){e.target.scrollHeight-e.target.scrollTop===e.target.clientHeight&&!this.loading&&this.loadGifs()},selectGiphy(e){this.$emit("selected-giphy",e),this.$refs.popover.hide()}}},ql={class:"fcom_giphy_composer"},Gl={class:"search-container"},Yl=["onLoad","src","alt","onClick"],Wl={key:0,class:"img_loading"},Kl={key:1,class:"no_result"},Zl=l("div",{class:"fcom_giphy_powered_by"},[l("span",{class:"powered_by"},"POWERED BY "),l("span",null,"GIPHY")],-1);function Jl(e,t,s,u,o,i){const m=se,f=ht,h=ft,g=p("GiphyIcon"),w=j,b=H,S=ye,k=te("loading");return n(),c("div",ql,[a(S,{placement:"bottom-end",width:300,persistent:!1,trigger:"click",teleported:!1,"popper-class":"fcom_giphy_popover fcom_menu_below_nav",ref:"popover"},{reference:r(()=>[a(b,{"aria-label":"Pick GIF",text:"",onClick:i.handleGiphyClick},{default:r(()=>[a(w,{class:R(["fcom_apps_icon"])},{default:r(()=>[a(g)]),_:1})]),_:1},8,["onClick"])]),default:r(()=>[W((n(),c("div",Gl,[a(m,{modelValue:o.searchQuery,"onUpdate:modelValue":t[0]||(t[0]=$=>o.searchQuery=$),placeholder:e.$t("Search Gifs"),onInput:i.handleSearch},null,8,["modelValue","placeholder","onInput"]),l("div",{class:"gif_container",onScroll:t[1]||(t[1]=(...$)=>i.handleScroll&&i.handleScroll(...$))},[o.gifs.length>0?(n(),y(h,{key:0,gutter:5},{default:r(()=>[(n(!0),c(F,null,x(o.gifs,$=>(n(),y(f,{span:12,key:$.id,class:"gif_item"},{default:r(()=>[l("img",{alt:"",onLoad:v=>$.loaded=!0,src:$.images.preview_gif.url,onClick:v=>i.selectGiphy($)},null,40,Yl),$.loaded?_("",!0):(n(),c("p",Wl))]),_:2},1024))),128))]),_:1})):(n(),c("p",Kl,d(e.$t("No results")),1))],32),Zl])),[[k,o.loading]])]),_:1},512)])}const Ql=I(zl,[["render",Jl]]),Xl={name:"VideoIcon"},ea={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},ta=l("rect",{x:"1",y:"1",width:"18",height:"18",rx:"3.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),sa=l("path",{d:"M8.90484 7.14604L12.663 9.3589C13.1383 9.6384 13.1383 10.3237 12.663 10.6032L8.90484 12.816C8.4208 13.1013 7.80896 12.7534 7.80896 12.1934V7.76865C7.80896 7.20869 8.4208 6.86076 8.90484 7.14604Z",fill:"currentColor"},null,-1),oa=[ta,sa];function ia(e,t,s,u,o,i){return n(),c("svg",ea,oa)}const na=I(Xl,[["render",ia]]);const la={name:"FluentPlayerPreview",emits:["load-failed"],props:{media:{type:Object,required:!0}},data(){return{html:"",loading:!1,playerInstanceKey:"",fallbackGuardCleanups:[],guardGeneration:0}},watch:{"media.url"(){this.loadFluentPlayerContent()}},async mounted(){await this.loadFluentPlayerContent()},beforeUnmount(){this.clearFallbackGuard()},methods:{getFallbackTiming(e,t){var u,o;const s=Number((o=(u=this.appVars.features.fluent_player)==null?void 0:u.fallback)==null?void 0:o[e]);return!Number.isFinite(s)||s<500?t:s},getPlayerInstanceKey(){if(!this.playerInstanceKey){const e=Number.parseInt(this._uid,10);this.playerInstanceKey=Number.isSafeInteger(e)&&e>0?`i${e}`:`i${Math.random().toString(36).slice(2,8)}`}return this.playerInstanceKey},getStableMediaId(){var u,o,i,m,f,h,g,w,b,S,k,$;const e=Number.parseInt((u=this.media)==null?void 0:u.media_id,10);if(Number.isSafeInteger(e)&&e>0)return e;const t=[(o=this.media)==null?void 0:o.media_key,(i=this.media)==null?void 0:i.feed_id,(m=this.media)==null?void 0:m.share_url,(h=(f=this.media)==null?void 0:f.settings)==null?void 0:h.src,(g=this.media)==null?void 0:g.url,(w=this.media)==null?void 0:w.html,(b=this.media)==null?void 0:b.title,(S=this.media)==null?void 0:S.player,(k=this.media)==null?void 0:k.type,($=this.media)==null?void 0:$.provider].filter(Boolean).join("|");if(!t)return 1;let s=5381;for(let v=0;v<t.length;v++)s=(s<<5)+s+t.charCodeAt(v)>>>0;return s||1},async loadFluentPlayerContent(){this.clearFallbackGuard();const e=++this.guardGeneration;this.loading=!0;try{if(!this.appVars.features.has_fluent_player||this.appVars.features.enable_fluent_player!=="yes"){this.$emit("load-failed");return}const t=this.getStableMediaId(),s=await this.withTimeout(this.$get("fluent-player/video-content/"+t,{...this.media,media_id:t,player_instance_key:this.getPlayerInstanceKey()}),this.getFallbackTiming("content_timeout_ms",1e4));if(e!==this.guardGeneration)return;s.html?(this.html=s.html,this.$nextTick(()=>{if(e!==this.guardGeneration)return;const u=this.$el&&this.$el.querySelector(".fluent-player");if(!u){this.fallBack("player markup missing");return}this.startFallbackGuard(u,s.media)})):this.$emit("load-failed")}catch(t){if(e!==this.guardGeneration)return;console.warn("Failed to load fluent-player assets:",t),this.$emit("load-failed")}finally{e===this.guardGeneration&&(this.loading=!1)}},withTimeout(e,t){return Promise.race([e,new Promise((s,u)=>{const o=setTimeout(()=>u(new Error("fluent-player content request timed out")),t);this.fallbackGuardCleanups.push(()=>clearTimeout(o))})])},startFallbackGuard(e,t){const s=()=>{document.dispatchEvent(new CustomEvent("InitSingleFluentPlayer",{detail:{container:e,playerData:{media:t}}}))};this.waitForPlayerScript(this.getFallbackTiming("script_timeout_ms",12e3),u=>{if(!u){this.fallBack("player script never loaded");return}s(),this.verifyPlayerInit(e)})},waitForPlayerScript(e,t){const s=()=>typeof window.FluentPlayer=="function";if(s()){t(!0);return}const u=document.querySelector('script[src*="fluent-player.js"]');let o=!1;const i=()=>{o=!0};u&&u.addEventListener("error",i);const m=()=>!u||!window.performance||!performance.getEntriesByType?!1:performance.getEntriesByType("resource").some(S=>S.name===u.src&&S.responseEnd>0);let f=0,h=0;const g=this.getFallbackTiming("script_grace_ms",2e3),w=setInterval(()=>{if(f+=250,s()){b(),t(!0);return}u&&(o||m())&&(h+=250),(h>=g||f>=e)&&(b(),t(!1))},250),b=()=>{clearInterval(w),u&&u.removeEventListener("error",i)};this.fallbackGuardCleanups.push(b)},verifyPlayerInit(e){const t=()=>{const o=e.querySelector("media-player");return!!(o&&o.hasAttribute("data-media-player"))};if(t()){this.enhanceAudioSpeedLabel(e),this.watchCanPlay(e);return}let s=0;const u=setInterval(()=>{s+=250,t()?(clearInterval(u),this.enhanceAudioSpeedLabel(e),this.watchCanPlay(e)):s>=this.getFallbackTiming("init_timeout_ms",3e3)&&(clearInterval(u),this.fallBack("player did not initialize"))},250);this.fallbackGuardCleanups.push(()=>clearInterval(u))},enhanceAudioSpeedLabel(e){try{const t=e.querySelector("media-player");if(!(t&&(t.getAttribute("view-type")==="audio"||e.querySelector(".fp-audio-layout"))))return;const u=e.querySelector(".fp-speed-menu media-menu-button");if(!u)return;const o=u.querySelector('media-icon[type="odometer"]');o&&(o.style.display="none");let i=u.querySelector(".fcom_speed_label");i||(i=document.createElement("span"),i.className="fcom_speed_label",u.appendChild(i));const m=()=>{const f=Number(t.playbackRate)||1;i.textContent=(Number.isInteger(f)?f:f.toFixed(2).replace(/0+$/,"").replace(/\.$/,""))+"x"};m(),t.addEventListener("rate-change",m),this.fallbackGuardCleanups.push(()=>t.removeEventListener("rate-change",m))}catch{}},watchCanPlay(e){const t=e.querySelector("media-player");if(!t){this.fallBack("media-player element missing");return}if(t.hasAttribute("data-can-play"))return;let s=0,u=!1;const o=this.getFallbackTiming("stall_timeout_ms",12e3),i=1e3,m=()=>{s=0},f=["load-start","source-change","provider-change","loaded-metadata","loaded-data","progress","waiting","play"];f.forEach(L=>t.addEventListener(L,m));let h=null;const g=()=>{const L=t.querySelector("iframe");L&&L!==h&&(h=L,h.addEventListener("load",m),m())};g();let w=null;const b=()=>{w&&(clearInterval(w),w=null)},S=()=>{w||(w=setInterval(C,i))},k="IntersectionObserver"in window?new IntersectionObserver(L=>{const M=L[L.length-1];u=!!(M&&M.isIntersecting),u?(s=0,S()):b()}):null,$=()=>v();t.addEventListener("can-play",$);const v=()=>{b(),t.removeEventListener("can-play",$),f.forEach(L=>t.removeEventListener(L,m)),h&&h.removeEventListener("load",m),k&&k.disconnect()},C=()=>{if(!document.body.contains(t)||t.hasAttribute("data-can-play")){v();return}g(),!(!u||!t.hasAttribute("data-can-load"))&&(s+=i,s>=o&&(v(),this.fallBack("player stalled before becoming playable")))};k?k.observe(t):(u=!0,S()),this.fallbackGuardCleanups.push(v)},fallBack(e){this.clearFallbackGuard(),console.warn("FluentPlayer: switching to standard media render ("+e+")"),this.html="",this.$emit("load-failed")},clearFallbackGuard(){const e=this.fallbackGuardCleanups;this.fallbackGuardCleanups=[],e.forEach(t=>{try{t()}catch{}})}}},aa={class:"fluent-player-preview"},ra={key:0,class:"player-container"},ca=["innerHTML"];function da(e,t,s,u,o,i){const m=Z;return n(),c("div",aa,[o.html?(n(),c("div",ra,[l("div",{innerHTML:o.html},null,8,ca)])):_("",!0),o.loading?(n(),y(m,{key:1,animated:"",rows:5})):_("",!0)])}const Pt=I(la,[["render",da],["__scopeId","data-v-f5d37d95"]]),ua={name:"TuneIcon"},_a={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false"},ma=l("path",{d:"M6 4v6M6 14v6M12 4v3M12 11v9M18 4v9M18 17v3",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},null,-1),ha=l("path",{d:"M4 12h4M10 9h4M16 15h4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},null,-1),fa=[ma,ha];function pa(e,t,s,u,o,i){return n(),c("svg",_a,fa)}const ga=I(ua,[["render",pa]]),ya={name:"AudioList",components:{FluentPlayerPreview:Pt,TuneIcon:ga,Close:rs},emits:["remove","edit"],props:{feed:{type:Object,default:null},audios:{type:Array,default:()=>[]},editable:{type:Boolean,default:!1}},data(){return{failedItems:{}}},methods:{onLoadFailed(e){this.failedItems={...this.failedItems,[e]:!0}},audioUrl(e){var t;return((t=e.settings)==null?void 0:t.src)||e.url||""},audioType(e){const s=this.audioUrl(e).split("?")[0].split("#")[0].split(".").pop().toLowerCase();return{mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",ogg:"audio/ogg",oga:"audio/ogg",flac:"audio/flac",opus:"audio/opus",weba:"audio/webm"}[s]||"audio/mpeg"},audioKey(e,t){var o,i;const s=((o=e.settings)==null?void 0:o.posterSrc)||e.image||"",u=((i=e.settings)==null?void 0:i.title)||e.title||"";return(e.media_id||t)+"|"+s+"|"+u},playerMediaFor(e){var s,u;const t={...e,feed_id:((s=this.feed)==null?void 0:s.id)||e.feed_id||"",share_url:((u=this.feed)==null?void 0:u.permalink)||e.share_url||""};return this.editable&&(t.controls={...e.controls||{},settings:!1}),t}}},va={class:"fcom_audio_list"},ba={key:1,class:"fcom_audio_native_wrap"},ka={class:"fcom_audio_native",controls:"",preload:"metadata"},wa=["src","type"],Ca=["aria-label","onClick"],$a=["aria-label","onClick"];function Sa(e,t,s,u,o,i){const m=p("fluent-player-preview"),f=p("tune-icon"),h=p("Close"),g=j;return n(),c("div",va,[(n(!0),c(F,null,x(s.audios,(w,b)=>(n(),c("div",{key:i.audioKey(w,b),class:"fcom_audio_player_wrap"},[o.failedItems[w.media_id||b]?(n(),c("div",ba,[l("audio",ka,[l("source",{src:i.audioUrl(w),type:i.audioType(w)},null,8,wa)])])):(n(),y(m,{key:0,media:i.playerMediaFor(w),onLoadFailed:S=>i.onLoadFailed(w.media_id||b)},null,8,["media","onLoadFailed"])),s.editable?(n(),c(F,{key:2},[l("button",{type:"button",class:"fcom_audio_ctl fcom_audio_edit_btn","aria-label":e.$t("Edit audio"),onClick:S=>e.$emit("edit",b)},[a(f)],8,Ca),l("button",{type:"button",class:"fcom_audio_ctl fcom_audio_remove_btn","aria-label":e.$t("Remove audio"),onClick:S=>e.$emit("remove",b)},[a(g,null,{default:r(()=>[a(h)]),_:1})],8,$a)],64)):_("",!0)]))),128))])}const no=I(ya,[["render",Sa]]);const Va={name:"MediaPreview",components:{Postcard:ri,FluentPlayerPreview:Pt,AudioList:no},props:["feed","media_item","is_single"],data(){return{is_error:!1,isPlaying:!1,fluentPlayerFailed:!1}},watch:{"media.url"(){this.fluentPlayerFailed=!1}},computed:{media(){var e;return this.feed?(e=this.feed.meta)==null?void 0:e.media_preview:this.media_item},audioMedias(){var s,u,o,i,m;const e=(u=(s=this.feed)==null?void 0:s.meta)==null?void 0:u.audio_medias;if(Array.isArray(e)&&e.length)return e;const t=(i=(o=this.feed)==null?void 0:o.meta)==null?void 0:i.media_preview;return t&&(((m=t.settings)==null?void 0:m.viewType)==="audio"||t.content_type==="audio")?[t]:[]},playerMedia(){var e,t,s,u;return{...this.media,feed_id:((e=this.feed)==null?void 0:e.id)||((t=this.media)==null?void 0:t.feed_id)||"",share_url:((s=this.feed)==null?void 0:s.permalink)||((u=this.media)==null?void 0:u.share_url)||""}},mediaSrcUrl(){var e,t,s;return((t=(e=this.media)==null?void 0:e.settings)==null?void 0:t.src)||((s=this.media)==null?void 0:s.url)||""},mediaWrapperType(){return this.media.type==="oembed"&&!this.isVideoMedia?"meta_data":this.media.type},isVideoMedia(){return this.isYouTubePlaylistUrl(this.mediaSrcUrl)&&!this.media.html?!1:["oembed","iframe_html","video","fluent_player"].includes(this.media.type)},hasFluentPlayer(){var e;return this.appVars.features.has_fluent_player&&((e=this.appVars.features.fluent_player)==null?void 0:e.enable)},playEmbeddedVideos(){var e;return(e=this.appVars.features.fluent_player)==null?void 0:e.play_embedded_videos}},methods:{toAbsoluteUrl(e){return e?/^[a-z][\w+.-]*:/i.test(e)?e:`https://${e}`:""},getDomainName(e){const t=this.toAbsoluteUrl(e);if(!t)return"";try{return new URL(t).hostname.replace(/^www\./i,"")}catch{return""}},isYouTubePlaylistUrl(e){return e?/^(https?:\/\/)?([\w-]+\.)?youtube\.com\/playlist\?/i.test(e)&&/[?&]list=/i.test(e):!1},isYouTubePlaylistEmbed(){var t;const e=(((t=this.media)==null?void 0:t.html)||"").replace(/&amp;/gi,"&");return/youtube(-nocookie)?\.com\/embed\/[^"'\s]*[?&]list=/i.test(e)},isSupportedByFluentPlayer(){var s,u;const e=((u=(s=this.media)==null?void 0:s.settings)==null?void 0:u.src)||this.media.url;return!e||this.isYouTubePlaylistUrl(e)||this.isYouTubePlaylistEmbed()||!this.playEmbeddedVideos&&this.media.provider!=="upload"?!1:[{name:"youtube",regex:/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/.+$/},{name:"vimeo",regex:/^(https?:\/\/)?(www\.)?vimeo\.com\/\d+(\/[a-f0-9]+)?([?#].*)?$/},{name:"file",regex:/\.(mp4|m3u8|mpd|webm|mov|qt|mp3|wav|m4a|aac|ogg|oga|flac|opus|weba)(\?.*)?$/i}].some(o=>o.regex.test(e))},getAspectRatio(e,t){if(e&&t){let s=e/t;return s<1?16/9:s}return 16/9},handleImageError(){this.is_error=!0},getVideoType(e){const t={mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",qt:"video/quicktime"},s=e.split(".").pop().toLowerCase();return t[s]||"video/mp4"},isAudioUrl(e){return e?/\.(mp3|wav|m4a|aac|ogg|oga|flac|opus|weba)(\?.*)?$/i.test(e):!1},getAudioType(e){const t={mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",ogg:"audio/ogg",oga:"audio/ogg",flac:"audio/flac",opus:"audio/opus",weba:"audio/webm"},s=e.split("?")[0].split("#")[0].split(".").pop().toLowerCase();return t[s]||"audio/mpeg"},playVideo(){this.$refs.nativeVideo&&this.$refs.nativeVideo.play()},onVideoPause(){this.$refs.nativeVideo&&this.$refs.nativeVideo.currentTime>0&&(this.isPlaying=!0)}}},lo=e=>(Bs("data-v-7a204b64"),e=e(),Ds(),e),Ma={key:0,class:"feed_media feed_media_audio_list"},La={key:0},Ta={key:1},Fa=["innerHTML"],Pa={key:2,class:"native_audio_wrapper"},Ia=["preload"],Ea=["src","type"],Ua=["controls","preload","poster"],Aa=["src","type"],Ba=lo(()=>l("div",{class:"native_play_button"},[l("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[l("path",{d:"M8 5v14l11-7z"})])],-1)),Da=[Ba],Ra=["href"],xa={key:0,class:"feed_media_image"},Ha=lo(()=>l("span",null,null,-1)),Oa={key:1,class:"feed_media_content"},ja={class:"media_domain"},Na={class:"feed_media_title"},za={key:0,class:"feed_media_description"},qa={class:"feed_meta_desc"};function Ga(e,t,s,u,o,i){const m=p("audio-list"),f=p("fluent-player-preview"),h=Z,g=Fe;return i.audioMedias.length?(n(),c("div",Ma,[a(m,{feed:s.feed,audios:i.audioMedias},null,8,["feed","audios"])])):(n(),c("div",{key:1,class:R(["feed_media","feed_media_"+i.mediaWrapperType])},[i.isVideoMedia?(n(),c(F,{key:0},[i.hasFluentPlayer&&i.isSupportedByFluentPlayer()&&!o.fluentPlayerFailed?(n(),c("div",La,[a(f,{media:i.playerMedia,onLoadFailed:t[0]||(t[0]=w=>o.fluentPlayerFailed=!0)},null,8,["media"])])):i.media.html?(n(),c("div",Ta,[l("div",{class:"feed_media_ext_video",innerHTML:i.media.html},null,8,Fa)])):i.media.url&&i.isAudioUrl(i.media.url)?(n(),c("div",Pa,[l("audio",{class:"native_audio_player",controls:"",preload:s.is_single?"metadata":"none"},[l("source",{src:i.media.url,type:i.getAudioType(i.media.url)},null,8,Ea)],8,Ia)])):i.media.url?(n(),c("div",{key:3,class:R(["native_video_wrapper",{video_playing:o.isPlaying}])},[l("video",{ref:"nativeVideo",class:"native_video_player",controls:o.isPlaying,preload:s.is_single?"metadata":"none",poster:i.media.thumbnail,onPlay:t[1]||(t[1]=w=>o.isPlaying=!0),onPause:t[2]||(t[2]=(...w)=>i.onVideoPause&&i.onVideoPause(...w)),onEnded:t[3]||(t[3]=w=>o.isPlaying=!1)},[l("source",{src:i.media.url,type:i.getVideoType(i.media.url)},null,8,Aa)],40,Ua),o.isPlaying?_("",!0):(n(),c("div",{key:0,class:"native_video_overlay",onClick:t[4]||(t[4]=(...w)=>i.playVideo&&i.playVideo(...w))},Da))],2)):_("",!0)],64)):i.media.type=="image"||i.media.is_uploaded?(n(),c("div",{key:1,class:R(["feed_media_provider_"+i.media.provider,"feed_media_image feed_custom_uploaded"])},[i.media.image&&!o.is_error?(n(),y(g,{key:0,alt:"",style:re({width:"100%",aspectRatio:i.getAspectRatio(i.media.width,i.media.height)}),src:i.media.image,lazy:!0,previewSrcList:[i.media.image],loading:"lazy",onError:i.handleImageError,"zoom-rate":1.2,"max-scale":7,"hide-on-click-modal":!0,"preview-teleported":!0,"min-scale":.2,"initial-index":1,class:R("fcom_media_provider_"+i.media.provider),fit:"scale-down"},{placeholder:r(()=>[a(h,{animated:!0})]),_:1},8,["style","src","previewSrcList","onError","class"])):_("",!0)],2)):(n(),c("a",{key:2,href:i.toAbsoluteUrl(i.media.url),target:"_blank",rel:"noopener",class:"feed_media_link"},[i.media.image&&!o.is_error?(n(),c("div",xa,[a(g,{onError:t[5]||(t[5]=w=>i.handleImageError()),style:{width:"100%"},src:i.media.image},{error:r(()=>[Ha]),_:1},8,["src"])])):_("",!0),i.media.title||i.media.url?(n(),c("div",Oa,[l("div",ja,d(i.getDomainName(i.media.url)),1),l("div",Na,d(e.getExcerpt(i.media.title||i.media.url,88)),1),i.media.description?(n(),c("div",za,[l("div",qa,d(e.getExcerpt(i.media.description,160)),1)])):_("",!0)])):_("",!0)],8,Ra))],2))}const He=I(Va,[["render",Ga],["__scopeId","data-v-7a204b64"]]);const Ms={video:{extensions:[".mp4",".webm",".mov",".qt"],pattern:/\.(mp4|webm|mov|qt)$/i},audio:{extensions:[".mp3",".wav",".m4a",".aac",".ogg",".oga",".flac"],pattern:/\.(mp3|wav|m4a|aac|ogg|oga|flac)$/i}},Ls=[{name:"youtube",regex:/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/.+$/},{name:"vimeo",regex:/^(https?:\/\/)?(www\.)?vimeo\.com\/\d+(\/[a-f0-9]+)?([?#].*)?$/},{name:"file",regex:/\.(mp4|m3u8|mpd|webm|mov|qt|mp3|wav|m4a|aac|ogg|oga|flac|opus|weba)(\?.*)?$/i}],Ya={name:"FluentPlayerUploader",components:{UploadFilled:Mt},emits:["video-added","completed","uploading"],props:{className:{type:String,default:"video-uploader"},type:{type:String,default:"url"},media_kind:{type:String,default:"video"}},data(){return{videoUrl:"",processing:!1}},computed:{uploadKind(){return this.media_kind==="audio"?"audio":"video"},acceptTypes(){return Ms[this.uploadKind].extensions.join(",")},uploadButtonLabel(){return this.uploadKind==="audio"?this.$t("Upload Audio"):this.$t("Upload Video")},kindErrorMessage(){return this.uploadKind==="audio"?this.$t("The file must be a valid audio type (MP3, WAV, M4A, AAC, OGG, FLAC)"):this.$t("The file must be a valid video type (MP4, WebM, MOV)")},uploadData(){return{context:"fluent_player",media_kind:this.uploadKind}},action_url(){return this.appVars.rest.url+"/fluent-player/video-upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}}},methods:{beforeUpload(e){return Ms[this.uploadKind].pattern.test(e.name||"")?!0:(this.$handleError(this.kindErrorMessage),!1)},async handleUrlSubmit(){if(!this.videoUrl)return;const e=Ls.some(u=>u.name==="file"&&u.regex.test(this.videoUrl)),t=Ls.some(u=>u.name!=="file"&&u.regex.test(this.videoUrl));let s={type:"oembed",url:this.videoUrl,html:"",content_type:"video"};e?(s.player="fluent_player",s.provider="url",s.media_id=new Date().getTime()):t&&(s.player="fluent_player",s.media_id=new Date().getTime()),this.$emit("video-added",s)},handleVideoUploadSuccess(e){var t,s;try{if(!e||!e.media||!e.media.url)throw new Error("Invalid response: missing media.url");const{media:u}=e,o=((t=u.settings)==null?void 0:t.viewType)==="audio"||this.uploadKind==="audio",i={type:"upload",url:u.url,player:"fluent_player",provider:"upload",content_type:o?"audio":"video",html:"",title:((s=u.settings)==null?void 0:s.title)||"",media_id:u.media_id,settings:u.settings||{}};this.$emit("video-added",i)}catch(u){console.error("[FluentPlayerUploader] handleVideoUploadSuccess error:",u,e)}finally{this.$emit("completed",e),this.processing=!1}},handleError(e){try{let t=(e==null?void 0:e.message)||e;if(typeof t=="string")try{const s=JSON.parse(t);t=(s==null?void 0:s.message)||t}catch{}this.$handleError(t)}catch(t){console.error("[FluentPlayerUploader] handleError failed:",t,e)}finally{this.$emit("completed",e),this.processing=!1}},inProgress(e){this.$emit("uploading"),this.processing=!0}}},Wa=["element-loading-text"],Ka={key:0,class:"upload-options"},Za={class:"uploader-content"},Ja={class:"el-upload__text"},Qa={key:1,class:"url-input-section"};function Xa(e,t,s,u,o,i){const m=p("upload-filled"),f=j,h=H,g=mt,w=se,b=te("loading");return W((n(),c("div",{class:"fluent-player-uploader","element-loading-text":e.$t("Uploading media..."),"element-loading-background":"rgba(255, 255, 255, 0.85)"},[s.type==="upload"?(n(),c("div",Ka,[a(g,{drag:"",class:R([s.className,"video-drag-uploader"]),multiple:i.uploadKind==="audio",action:i.action_url,headers:i.headers,accept:i.acceptTypes,data:i.uploadData,"before-upload":i.beforeUpload,"on-success":i.handleVideoUploadSuccess,"on-progress":i.inProgress,"on-error":i.handleError,"show-file-list":!1,disabled:o.processing},{default:r(()=>[l("div",Za,[a(f,{class:"el-icon--upload"},{default:r(()=>[a(m)]),_:1}),l("div",Ja,[V(d(e.$t("Drop file here or"))+" ",1),l("em",null,d(e.$t("upload by clicking")),1)]),a(h,{type:"primary",class:"upload-button",loading:o.processing,disabled:o.processing},{default:r(()=>[Y(e.$slots,"trigger",{},()=>[Y(e.$slots,"default",{},()=>[V(d(o.processing?e.$t("Uploading..."):i.uploadButtonLabel),1)])])]),_:3},8,["loading","disabled"])])]),_:3},8,["class","multiple","action","headers","accept","data","before-upload","on-success","on-progress","on-error","disabled"])])):(n(),c("div",Qa,[a(w,{modelValue:o.videoUrl,"onUpdate:modelValue":t[0]||(t[0]=S=>o.videoUrl=S),type:"url",placeholder:e.$t("Enter video URL"),size:"large"},{append:r(()=>[a(h,{onClick:i.handleUrlSubmit,loading:o.processing},{default:r(()=>[V(d(e.$t("Embed")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["modelValue","placeholder"])]))],8,Wa)),[[b,o.processing]])}const er=I(Ya,[["render",Xa]]),tr={name:"MediaEmbeder",emits:["embeded"],props:{media:{type:Object,default:()=>({type:"oembed",url:"",inner_html:"",content_type:"video",html:"",provider:"",title:"",author_name:"",image:""})},box_title:{type:String,default:""},box_description:{type:String,default:""},has_iframe:{type:Boolean,default:!0},space:{type:String,default:""},is_feed:{type:Boolean,default:!1}},components:{MediaPreview:He,FluentPlayerUploader:er},computed:{showPreview(){return this.media.html&&!this.showInput},editorMode:{get(){return this.media.type},set(e){this.media.type=e}},hasFluentPlayer(){var e;return this.hasFluentPlayerInstalled&&((e=this.appVars.features.fluent_player)==null?void 0:e.enable)},hasFluentPlayerInstalled(){return this.appVars.features.has_fluent_player},hasUploadEnabled(){var e;return this.is_feed&&this.hasFluentPlayer&&((e=this.appVars.features.fluent_player)==null?void 0:e.has_video_upload)},uploadRole(){var e;return((e=this.appVars.features.fluent_player)==null?void 0:e.video_upload_role)||"admin"},getSpace(){return this.space||""},playEmbeddedVideos(){var e;return(e=this.appVars.features.fluent_player)==null?void 0:e.play_embedded_videos},editorTitle(){return this.box_title||this.$t("Featured media")},uploadHint(){return this.$t("The file must be a valid video type (MP4, WebM, MOV)")},hasUpload(){return this.hasUploadEnabled&&(this.uploadRole==="everyone"||this.uploadRole==="admin_moderator"&&(this.isModerator(this.getSpace)||this.isAdmin())||this.uploadRole==="admin"&&this.isAdmin())}},data(){return{appReady:!1,showInput:!1,fetching:!1,uploading:!1,uploadKind:"video"}},methods:{fetchData(){this.media.url&&(this.fetching=!0,this.$get("feeds/oembed",{url:this.media.url}).then(e=>{this.media.html=e.oembed.html,this.media.provider=e.oembed.provider,this.media.title=e.oembed.title,this.media.author_name=e.oembed.author_name,this.media.type=e.oembed.type,this.media.image=e.oembed.image,this.media.content_type="video",this.$emit("embeded",this.media),this.showInput=!1}).catch(e=>{this.$handleError(e)}).finally(()=>{this.fetching=!1}))},handleAddCustomHtml(){if(!/<iframe[\s>]/i.test(this.media.html||"")){this.$handleError(this.$t("Only iframe embed code is supported. Script-based embeds will not work."));return}this.media.content_type="video",this.$emit("embeded",this.media),this.showInput=!1},handleFluentPlayerVideo(e){Object.assign(this.media,e);const t=this.media.type==="upload"||this.media.provider==="url";if(this.media.player==="fluent_player"&&t){this.media.type="oembed",this.$emit("embeded",this.media);return}this.fetchData()}},mounted(){typeof this.media!="object"&&(this.media={type:"oembed",url:"",inner_html:"",content_type:"video"}),this.appReady=!0,this.media.html||this.fetchData()}},sr={key:0},or={key:0,class:"fcom_media_editor_actions"},ir={key:1,class:"fcom_media_editor fcom_media_embeder"},nr={key:0},lr={key:1},ar={key:2,class:"fcom_course_media"};function rr(e,t,s,u,o,i){var k;const m=H,f=Ne,h=ve,g=se,w=p("fluent-player-uploader"),b=p("media-preview"),S=te("loading");return o.appReady?W((n(),c("div",sr,[s.has_iframe||i.hasUpload?(n(),c("div",or,[i.showPreview?(n(),y(m,{key:0,onClick:t[0]||(t[0]=$=>o.showInput=!0),size:"small",text:""},{default:r(()=>[V(d(e.$t("Edit media")),1)]),_:1})):(n(),y(h,{key:1,onChange:t[1]||(t[1]=$=>{s.media.html="",s.media.url="",o.showInput=!0}),size:"small",modelValue:i.editorMode,"onUpdate:modelValue":t[2]||(t[2]=$=>i.editorMode=$),disabled:o.uploading,"aria-label":e.$t("Media source")},{default:r(()=>[a(f,{label:e.$t("Oembed"),value:"oembed"},null,8,["label"]),s.has_iframe?(n(),y(f,{key:0,label:e.$t("HTML Code"),value:"iframe_html"},null,8,["label"])):_("",!0),i.hasUpload?(n(),y(f,{key:1,label:e.$t("Upload Video"),value:"upload","data-testid":"upload-kind-video"},null,8,["label"])):_("",!0)]),_:1},8,["modelValue","disabled","aria-label"]))])):_("",!0),i.showPreview?(n(),c("div",ar,[a(b,{media_item:s.media},null,8,["media_item"])])):(n(),c("div",ir,[s.media.type=="iframe_html"&&s.has_iframe?(n(),c(F,{key:0},[l("h3",null,d(e.$t("Add Video from custom HTML Code")),1),a(g,{rows:5,modelValue:s.media.html,"onUpdate:modelValue":t[3]||(t[3]=$=>s.media.html=$),type:"textarea",placeholder:e.$t("Paste an iframe code")},null,8,["modelValue","placeholder"]),a(m,{class:"fcom_secondary_button fcom_mt_20",onClick:t[4]||(t[4]=$=>i.handleAddCustomHtml())},{default:r(()=>[V(d(e.$t("Embed")),1)]),_:1})],64)):(n(),c(F,{key:1},[l("h3",null,d(i.editorTitle),1),i.hasFluentPlayerInstalled&&s.media.type==="upload"?(n(),c("p",nr,d(i.uploadHint),1)):(n(),c("p",lr,d(s.box_description||e.$t("Embed from Vimeo, YouTube, Wistia and more")),1)),i.hasFluentPlayer&&(s.media.type==="upload"||i.playEmbeddedVideos)?(n(),y(w,{key:2,type:((k=s.media)==null?void 0:k.type)==="upload"?"upload":"url",media_kind:o.uploadKind,onVideoAdded:i.handleFluentPlayerVideo,onUploading:t[5]||(t[5]=$=>o.uploading=!0),onCompleted:t[6]||(t[6]=$=>o.uploading=!1)},null,8,["type","media_kind","onVideoAdded"])):(n(),y(g,{key:3,onKeydown:oe(i.fetchData,["enter"]),size:"large",modelValue:s.media.url,"onUpdate:modelValue":t[7]||(t[7]=$=>s.media.url=$),type:"url",placeholder:e.$t("Paste a URL to embed")},{append:r(()=>[a(m,{onClick:i.fetchData,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Embed")),1)]),_:1},8,["onClick"])]),_:1},8,["onKeydown","modelValue","placeholder"]))],64))]))])),[[S,o.fetching]]):_("",!0)}const _s=I(tr,[["render",rr]]),cr={name:"VideoEmbeder",emits:["embeded"],props:["is_admin","space"],components:{MediaEmbeder:_s,VideoIcon:na},data(){return{videoUrl:"",showVideoPop:!1,media:{type:"oembed",url:"",inner_html:"",content_type:"video"}}},watch:{showVideoPop(e){e||this.resetMedia()}},methods:{show(){this.showVideoPop=!0},resetMedia(){this.media={type:"oembed",url:"",inner_html:"",content_type:"video"}},embeded(e){var s;this.$emit("embeded",e),e&&(e.content_type==="audio"||((s=e.settings)==null?void 0:s.viewType)==="audio")||(this.showVideoPop=!1,this.resetMedia())}}},dr={class:"fcom_video_embeder"};function ur(e,t,s,u,o,i){const m=p("VideoIcon"),f=j,h=H,g=p("media-embeder"),w=be;return n(),c("div",dr,[a(h,{"aria-label":"Add Video",text:"",onClick:i.show},{default:r(()=>[a(f,{class:R(["fcom_apps_icon"])},{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClick"]),o.showVideoPop?(n(),y(w,{key:0,title:e.$t("Attach Media"),modelValue:o.showVideoPop,"onUpdate:modelValue":t[0]||(t[0]=b=>o.showVideoPop=b),width:e.dialogWidth,style:{"max-width":"600px"},"append-to-body":!0},{default:r(()=>[a(g,{box_title:e.$t("Add Featured Video for this post"),has_iframe:s.is_admin,is_feed:!0,onEmbeded:i.embeded,space:s.space,media:o.media},null,8,["box_title","has_iframe","onEmbeded","space","media"])]),_:1},8,["title","modelValue","width"])):_("",!0)])}const _r=I(cr,[["render",ur]]),mr="modulepreload",hr=function(e){return"/"+e},Ts={},at=function(t,s,u){if(!s||s.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(s.map(i=>{if(i=hr(i),i in Ts)return;Ts[i]=!0;const m=i.endsWith(".css"),f=m?'[rel="stylesheet"]':"";if(!!u)for(let w=o.length-1;w>=0;w--){const b=o[w];if(b.href===i&&(!m||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${f}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":mr,m||(g.as="script",g.crossOrigin=""),g.href=i,document.head.appendChild(g),m)return new Promise((w,b)=>{g.addEventListener("load",w),g.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t()).catch(i=>{const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=i,window.dispatchEvent(m),!m.defaultPrevented)throw i})};var ao=(e=>(e.CodeMirror="code-mirror",e.LinkTooltip="link-tooltip",e.Cursor="cursor",e.BlockEdit="block-edit",e.Toolbar="toolbar",e.Placeholder="placeholder",e.ImageBlock="image-block",e))(ao||{});const fr={cursor:!0,"link-tooltip":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,"image-block":!0};async function pr(e,t,s){switch(e){case"link-tooltip":{const{defineFeature:u}=await at(()=>import("./index.js?ver=2.8.1"),[]);return u(t,s)}case"block-edit":{const{defineFeature:u}=await at(()=>import("./index2.js?ver=2.8.1"),[]);return u(t,s)}case"placeholder":{const{defineFeature:u}=await at(()=>import("./index3.js?ver=2.8.1"),[]);return u(t,s)}case"toolbar":{const{defineFeature:u}=await at(()=>import("./index4.js?ver=2.8.1"),[]);return u(t,s)}case"image-block":{const{defineFeature:u}=await at(()=>import("./index5.js?ver=2.8.1"),[]);return u(t,s)}}}const gr=rn([],"FeaturesCtx");function yr(e){return t=>{t.inject(gr,e)}}var ms=(e,t,s)=>{if(!t.has(e))throw TypeError("Cannot "+s)},pe=(e,t,s)=>(ms(e,t,"read from private field"),s?s.call(e):t.get(e)),Je=(e,t,s)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,s)},rt=(e,t,s,u)=>(ms(e,t,"write to private field"),u?u.call(e,s):t.set(e,s),s),vr=(e,t,s)=>(ms(e,t,"access private method"),s),Ce,ct,ut,bt,Qe,Zt,ro;class co{constructor({root:t,features:s={},featureConfigs:u={},defaultValue:o="",onUpdate:i=f=>{},handleCommonActions:m=(f,h)=>{}}){var w;Je(this,Zt),Je(this,Ce,void 0),Je(this,ct,void 0),Je(this,ut,void 0),Je(this,bt,!0),Je(this,Qe,null);const f=Object.entries({...fr,...s}).filter(([,b])=>b).map(([b])=>b);rt(this,ut,(typeof t=="string"?document.querySelector(t):t)??document.body),rt(this,Ce,cn.make().config(yr(f)).config(b=>{b.set(dn,pe(this,ut)),b.set(un,o),b.set(_n,{editable:()=>pe(this,bt)})}).config(b=>{const S=async(k,$)=>await m("handleFileUpload",{ctx:b,files:k,schema:$});b.update(mn.key,k=>({...k,uploader:S}))}).config(b=>{const S=b.get(hn);S.markdownUpdated((k,$,v)=>{$!==v&&i($)}),S.updated((k,$,v)=>{m("editor_updated",k)})}).use(fn).use(pn).use(gn).use(yn).use(vn).use(bn).use(kn));const h=(w=u==null?void 0:u["block-edit"])==null?void 0:w.canAddImage;h&&pe(this,Ce).use(Kt(()=>new Wt({filterTransaction:b=>b.docChanged?!b.steps.some(k=>{var v,C;let $=!1;return(C=(v=k.slice)==null?void 0:v.content)==null||C.forEach(L=>{var M;L.type.name.includes("image")&&($=!0),(M=L.content)==null||M.forEach(E=>{E.type.name.includes("image")&&($=!0)})}),$})||h():!0}))),pe(this,Ce).use(Kt(()=>new Wt({props:{handleTextInput(b,S,k,$){const v=b.state.schema.marks.link;if($!==" "||!v)return!1;const C=b.state.doc.resolve(S),L=/(?:^|\s)((?:https?:\/\/|www\.)\S+)$/.exec(C.parent.textBetween(0,C.parentOffset,void 0,""));if(!L)return!1;const M=L[1].replace(/[.,)]+$/,""),E=S-L[1].length,T=E+M.length;if(b.state.doc.rangeHasMark(E,T,v))return!1;const P=(M.startsWith("http")?"":"https://")+M,U=b.state.tr.insertText($,S).addMark(E,T,v.create({href:P})).removeStoredMark(v);return b.dispatch(U),!0}},appendTransaction:(b,S,k)=>{const $=k.schema.marks.link,v=k.selection.$cursor;if(!$||!v||!b.some(U=>U.docChanged))return null;const C=U=>U==null?void 0:U.marks.find(D=>D.type===$);if((k.storedMarks??v.marks()).some(U=>U.type===$)&&!C(v.nodeBefore)&&!C(v.nodeAfter))return k.tr.removeStoredMark($);const E=v.pos;if(E<1||k.doc.textBetween(E-1,E)!==" "||!k.doc.rangeHasMark(E-1,E,$))return null;const T=C(k.doc.resolve(E-1).nodeBefore),P=C(k.doc.resolve(E).nodeAfter);return P&&(T==null?void 0:T.attrs.href)===P.attrs.href?null:k.tr.removeMark(E-1,E,$).removeStoredMark($)}}))),pe(this,Ce).use(Kt(()=>{let b=!1,S=!1;return new Wt({view:k=>({update(){var T;const $=k.state.schema.marks.link,v=k.state.selection.$cursor,C=P=>P.type===$,L=!!$&&!!(v!=null&&v.marks().some(C)),M=document.querySelector("milkdown-link-preview"),E=(M==null?void 0:M.style.display)==="none"&&!S;if(L&&!E){M&&S&&(M.style.display=""),S=!1;const P=k.coordsAtPos((T=v.nodeBefore)!=null&&T.marks.some(C)?v.pos-1:v.pos);k.dom.dispatchEvent(new MouseEvent("mousemove",{bubbles:!0,clientX:P.left+1,clientY:(P.top+P.bottom)/2}))}else!L&&b&&(k.dom.dispatchEvent(new MouseEvent("mouseleave",{bubbles:!0})),M&&(M.style.display="none"),S=!0);b=L}})})}));const g=[];f.forEach(b=>{const S=u[b];g.push(pr(b,pe(this,Ce),S))}),rt(this,ct,Promise.all(g))}async create(){await pe(this,ct);const t=await pe(this,Ce).create();return vr(this,Zt,ro).call(this),t}async destroy(){var t;return(t=pe(this,Qe))==null||t.disconnect(),await pe(this,ct),pe(this,Ce).destroy()}get editor(){return pe(this,Ce)}setReadonly(t){return rt(this,bt,!t),this}getMarkdown(){return pe(this,Ce).action(wn())}getEditor(){return pe(this,Ce)}destroyEditor(){this.destroy()}}Ce=new WeakMap;ct=new WeakMap;ut=new WeakMap;bt=new WeakMap;Qe=new WeakMap;Zt=new WeakSet;ro=function(){const e=pe(this,ut),t=u=>{parseFloat(u.style.left)<0&&(u.style.left="0px")},s=u=>{const o=e.querySelector(u);o&&(pe(this,Qe).observe(o,{attributes:!0,attributeFilter:["style"]}),setTimeout(()=>t(o),0))};rt(this,Qe,new MutationObserver(u=>{const o=u[0];o.type==="childList"?(s("milkdown-link-edit"),s("milkdown-link-preview")):t(o.target)})),pe(this,Qe).observe(e,{childList:!0,subtree:!0})};co.Feature=ao;const br={name:"CrepeEditor",emits:["update:modelValue","handleMediaUpload","editorCreated"],props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},autofocus:{type:Boolean,default:!1},mentionQuery:{type:Object,default:()=>({})},autofocus_changed:{type:[Boolean,Number],default:!1},disable_mention:{type:Boolean,default:!1},disable_media:{type:Boolean,default:!1},defaultMentions:{type:Array,default:()=>[]},context:{type:String,default:""},is_modal:{type:Boolean,default:!1},onInlineUpload:{type:Function,default:null},canAddImage:{type:Function,default:null}},components:{MilkdownProvider:Cn,ProsemirrorAdapterProvider:$n},data(){return{editor:null,currentContent:"",showMentionPop:!1,currentMentionSearch:"",mentionResults:[],justReplaced:!1,searchingMention:!1,hasUnsavedChanges:!1,pendingNavigation:null,activeUploadBlock:null}},watch:{autofocus_changed(e){e&&this.focusOnEditor()},currentContent(){var t;const e=this.context==="feed"||this.context==="comment";this.hasUnsavedChanges=e&&!!((t=this.currentContent)!=null&&t.replace(/&#x20;|\u00A0/gi,"").trim()),this.context==="comment"&&this.is_modal&&(window.fcom_modal_comment_unsaved=this.hasUnsavedChanges)}},methods:{onUnsavedChangesProceeded(){if(this.pendingNavigation){this.hasUnsavedChanges=!1,this.context==="comment"&&this.is_modal&&(window.fcom_modal_comment_unsaved=!1);const e=this.pendingNavigation;this.pendingNavigation=null,setTimeout(()=>e.click(),0)}},clearContent(){this.editor&&(this.editor.action(e=>{const t=e.get(lt),{state:s}=t,u=s.tr.replaceWith(0,s.doc.content.size,s.schema.nodes.paragraph.create());t.dispatch(u)}),this.currentContent="")},updateContent(e){this.editor.action(t=>{const s=t.get(lt),{state:u}=s,{from:o}=u.selection,i=e,m=u.tr.insertText(i,o),f=o+i.length,h=m.setSelection(Vs.create(m.doc,f));s.dispatch(h),s.focus()})},initEditor(){const e=this,t=new co({root:this.$refs.crepe_editor_vue,defaultValue:this.modelValue,featureConfigs:{placeholder:{text:this.placeholder||this.$t("Type your message here!"),mode:"doc"},"block-edit":{hasImageBlock:!this.disable_media&&!!this.onInlineUpload,canAddImage:this.canAddImage},"image-block":{onUpload:async s=>{if(!this.onInlineUpload)return null;this.activeUploadBlock&&this.activeUploadBlock.classList.add("uploading");try{return await this.onInlineUpload(s)}finally{this.activeUploadBlock&&(this.activeUploadBlock.classList.remove("uploading"),this.activeUploadBlock=null)}},blockUploadButton:()=>this.$t("Upload image"),blockConfirmButton:()=>this.$t("Confirm"),blockUploadPlaceholderText:this.$t("or paste link")},"link-tooltip":{inputPlaceholder:this.$t("Paste link...")}},onUpdate(s){s=s.replace(/!\[[^\]]*\]\(\s*\)/g,""),e.$emit("update:modelValue",s),e.currentContent=s},async handleCommonActions(s,u){if(s==="editor_updated"){if(e.disable_mention)return!1;e.checkforMention(u)}else if(s==="handleFileUpload")return e.disable_media?[]:await e.handleFileUpload(u)}});t.create().then(()=>{this.editor=t.getEditor(),this.focusOnEditor(),this.$emit("editorCreated")})},focusOnEditor(e=null){!e&&!this.autofocus||!this.editor||this.editor.action(t=>{const s=t.get(lt),{state:u}=s;let o=null;e&&u.doc.descendants((m,f)=>{if(m.isText&&m.text){const h=m.text.lastIndexOf(e);h!==-1&&(o=f+h+e.length+1)}});const i=o!==null?Math.min(o,u.doc.content.size-1):Math.max(1,u.doc.content.size-1);s.dispatch(u.tr.setSelection(Vs.create(u.doc,i))),s.focus()})},checkforMention(e){if(!this.currentContent.includes("@")||this.justReplaced){this.showMentionPop=!1,this.currentMentionSearch="";return}const s=e.get(lt),{state:u}=s,{selection:o}=u;if(!o)return;const m=u.doc.textBetween(0,o.to," ").match(/@([\p{L}\p{M}\p{N}_.-]+)$/u);if(!m){this.showMentionPop=!1,this.currentMentionSearch="";return}let f=m[1];if(!f||f.length<3){if(this.defaultMentions&&this.defaultMentions.length){let h=f.toLowerCase(),g=this.defaultMentions.filter(w=>w.username.toLowerCase().includes(h)||w.display_name.toLowerCase().includes(h));g.length&&(this.currentMentionSearch=f,this.mentionResults=g,this.showMentionPop=!0)}return}if(this.currentMentionSearch&&(this.currentMentionSearch=f,this.searchingMention))return!1;this.searchingMention=!0,this.currentMentionSearch=f,this.$get("members",{mention:this.currentMentionSearch,...this.mentionQuery}).then(h=>{this.mentionResults=h.members.data,this.showMentionPop=!0}).finally(()=>{this.searchingMention=!1})},addMention(e){if(this.disable_mention)return;const t=new RegExp(`@${this.currentMentionSearch}(?!.*@${this.currentMentionSearch})`);this.currentContent=this.currentContent.replace(t,e+" "),this.editor.action(Sn(this.currentContent)),this.focusOnEditor(e),this.showMentionPop=!1,this.currentMentionSearch="",this.justReplaced=!0,setTimeout(()=>{this.justReplaced=!1},2e3)},async handleFileUpload(e){const t=e.files;for(let s=0;s<t.length;s++){const u=t.item(s);if(u&&u.type.includes("image"))if(this.onInlineUpload){if(this.canAddImage&&!this.canAddImage())continue;await this.insertInlineImage(u)}else this.$emit("handleMediaUpload",u)}return[]},async insertInlineImage(e){try{const t=await this.onInlineUpload(e);if(!t)return;this.editor.action(s=>{const u=s.get(lt),{state:o}=u,i=o.schema.nodes["image-block"];if(!i)return;const m=i.create({src:t,caption:"",ratio:1}),{$from:f}=o.selection,h=f.after(1),g=o.tr.insert(h,m);u.dispatch(g),u.focus()})}catch{}},handleBeforeUnload(e){this.hasUnsavedChanges&&(e.preventDefault(),e.returnValue="")},handleLinkClick(e){const t=e.target.closest("a");if(!t||!this.hasUnsavedChanges||e.metaKey||e.ctrlKey)return;const s=t.getAttribute("href"),u=this.appVars.portal_url;if(!s)return;const o=s.startsWith(u)||s.startsWith("/"),i=s===window.location.href;o&&!i&&(e.preventDefault(),e.stopPropagation(),this.pendingNavigation=t,this.$eventBus.emit("showUnsavedChangesModal",this.context))},handleImageBlockClick(e){const t=e.target.closest("milkdown-image-block");t&&(this.activeUploadBlock=t,e.target.closest(".confirm")&&!this.canAddImage()&&(e.preventDefault(),e.stopPropagation()))}},mounted(){this.initEditor(),window.addEventListener("beforeunload",this.handleBeforeUnload),document.addEventListener("click",this.handleLinkClick,!0),this.onInlineUpload&&this.$refs.crepe_editor_vue.addEventListener("click",this.handleImageBlockClick,!0),this.$eventBus.on("unsavedChangesProceeded",this.onUnsavedChangesProceeded)},beforeUnmount(){var e;this.editor&&this.editor.destroy(),this.context==="comment"&&this.is_modal&&this.hasUnsavedChanges&&(window.fcom_modal_comment_unsaved=!1),window.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("click",this.handleLinkClick,!0),this.onInlineUpload&&((e=this.$refs.crepe_editor_vue)==null||e.removeEventListener("click",this.handleImageBlockClick,!0)),this.$eventBus.off("unsavedChangesProceeded",this.onUnsavedChangesProceeded)}},kr={style:{position:"relative"},class:"fcom_md_editor"},wr={ref:"crepe_editor_vue",class:"crepe-editor feed_md_content fcom_md_seditor_wrapper"},Cr={class:"fcom_mention_pop_wrap"},$r=l("span",{style:{}},null,-1),Sr={key:0},Vr={key:0},Mr=["onClick"],Lr=["src"],Tr={key:1};function Fr(e,t,s,u,o,i){const m=p("ProsemirrorAdapterProvider"),f=p("MilkdownProvider"),h=ye;return n(),c(F,null,[a(f,null,{default:r(()=>[a(m,null,{default:r(()=>[l("div",kr,[l("div",wr,null,512)])]),_:1})]),_:1}),l("div",Cr,[a(h,{"popper-class":"fcom_mention_pop",ref:"mentionPopoverRef",placement:"bottom",visible:o.showMentionPop,width:300,persistent:!1},{reference:r(()=>[$r]),default:r(()=>[o.justReplaced?_("",!0):(n(),c("div",Sr,[o.mentionResults.length?(n(),c("ul",Vr,[(n(!0),c(F,null,x(o.mentionResults,g=>(n(),c("li",{key:g.user_id,onClick:w=>i.addMention("@"+g.username)},[g.avatar?(n(),c("img",{key:0,alt:"",src:g.avatar},null,8,Lr)):_("",!0),l("span",null,d(g.display_name)+" (@"+d(g.username)+")",1)],8,Mr))),128))])):o.searchingMention?_("",!0):(n(),c("div",Tr,[l("p",null,d(e.$t("No results found. Please search by username")),1)]))]))]),_:1},8,["visible"])])],64)}const It=I(br,[["render",Fr]]);const Pr={name:"ActionPopover",emits:["show","hide"],props:{items:{type:Array,default:()=>[]},width:{type:[Number,String],default:150},placement:{type:String,default:"bottom",validator:e=>["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"].includes(e)},persistent:{type:Boolean,default:!1},teleported:{type:Boolean,default:!1}},data(){return{visible:!1}},watch:{visible(e){this.$emit(e?"show":"hide"),document[e?"addEventListener":"removeEventListener"]("click",this.onClickOutside,!0)}},methods:{toggle(){this.visible=!this.visible},hide(){this.visible=!1},onClickOutside(e){var s,u,o,i,m;const t=(u=(s=this.$refs.popoverRef)==null?void 0:s.popperRef)==null?void 0:u.contentRef;t!=null&&t.contains(e.target)||(o=this.$refs.triggerRef)!=null&&o.contains(e.target)||(m=(i=e.target).closest)!=null&&m.call(i,".el-popper")||this.hide()},handleAction(e){this.hide(),e.action&&e.action()},focusFirstItem(){this.focusItem(0)},focusItem(e){var u;const t=this.$refs.menuItems;if(!Array.isArray(t)||!t.length)return;const s=t[(e+t.length)%t.length];(u=s==null?void 0:s.focus)==null||u.call(s)},hideAndFocusTrigger(){this.hide(),this.$nextTick(()=>{var s,u;const e=this.$refs.triggerRef,t=((s=e==null?void 0:e.querySelector)==null?void 0:s.call(e,"button, a, [tabindex]"))||e;(u=t==null?void 0:t.focus)==null||u.call(t)})}},beforeUnmount(){document.removeEventListener("click",this.onClickOutside,!0)}},Ir=["onClick","onKeydown"];function Er(e,t,s,u,o,i){const m=p("MoreFilled"),f=j,h=H,g=ye;return n(),y(g,{trigger:"manual",placement:s.placement,persistent:s.persistent,width:s.width,visible:o.visible,teleported:s.teleported,"popper-class":"fcom_menu_below_nav",onAfterEnter:i.focusFirstItem,ref:"popoverRef"},{reference:r(()=>[l("span",{ref:"triggerRef",class:"fcom_action_popover_trigger",onClick:t[0]||(t[0]=(...w)=>i.toggle&&i.toggle(...w))},[Y(e.$slots,"trigger",{},()=>[a(h,{"aria-label":e.$t("View actions"),"aria-haspopup":"menu","aria-expanded":o.visible,class:"fcom_action_popover_default_trigger_button",size:"small"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label","aria-expanded"])])],512)]),default:r(()=>[Y(e.$slots,"default",{hide:i.hide},()=>[l("ul",{class:"actions_items",role:"menu","aria-orientation":"vertical",onKeydown:t[1]||(t[1]=oe(z((...w)=>i.hideAndFocusTrigger&&i.hideAndFocusTrigger(...w),["prevent","stop"]),["esc"]))},[(n(!0),c(F,null,x(s.items,(w,b)=>(n(),c("li",{key:b,ref_for:!0,ref:"menuItems",class:R(["fcom_action_popover_item",w.type?"fcom_action_popover_item_"+w.type:""]),role:"menuitem",tabindex:"0",onClick:S=>i.handleAction(w),onKeydown:[oe(z(S=>i.handleAction(w),["prevent"]),["enter"]),oe(z(S=>i.handleAction(w),["prevent"]),["space"]),oe(z(S=>i.focusItem(b+1),["prevent"]),["down"]),oe(z(S=>i.focusItem(b-1),["prevent"]),["up"])]},d(w.label),43,Ir))),128))],32)])]),_:3},8,["placement","persistent","width","visible","teleported","onAfterEnter"])}const Ke=I(Pr,[["render",Er]]),Ur={name:"SmilyIcon"},Ar={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Br=Te('<g><circle cx="9.99996" cy="10.0013" r="8.33333" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></circle><path d="M6.66663 12.5C7.42673 13.512 8.6369 14.1667 9.99996 14.1667C11.363 14.1667 12.5732 13.512 13.3333 12.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M6.6741 7.5L6.66663 7.5Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M13.3333 7.5L13.3258 7.5Z" fill="currentColor"></path><path d="M6.6741 7.5L6.66663 7.5M13.3333 7.5L13.3258 7.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></g>',1),Dr=[Br];function Rr(e,t,s,u,o,i){return n(),c("svg",Ar,Dr)}const xr=I(Ur,[["render",Rr]]),Hr={name:"EmojiPicker",components:{Picker:sn,ActionPopover:Ke,SmilyIcon:xr},emits:["emoji-selected"],props:{close_on_select:{type:Boolean,default:!1}},data(){return{emojiIndex:null,emojiLoading:!1,errorMessage:"",isLoading:!1}},methods:{onEmojiSelect(e,t){this.$emit("emoji-selected",e.native),this.close_on_select&&t&&t()},loadEmojiAssets(){if(this.isLoading)return;if(window.fcomEmojiIndex){this.emojiIndex=window.fcomEmojiIndex,this.emojiLoading=!1;return}this.isLoading=!0;let e=this.appVars.assets_url+"libs/static/tw_emojis.json";this.emojiLoading=!0,fetch(e).then(t=>t.json()).then(t=>{t?(window.fcomEmojiIndex=new on(t),this.emojiIndex=window.fcomEmojiIndex,this.emojiLoading=!1):this.errorMessage=this.$t("Emoji loading failed")}).catch(()=>{this.errorMessage=this.$t("Emoji loading failed")}).finally(()=>{this.isLoading=!1})}}},Or={class:"ffcom_emoji"},jr={key:0,class:"emoji-mart emoji-mart-static",style:{width:"320px",padding:"10px 20px"}},Nr={key:0},zr={style:{"text-align":"center","margin-bottom":"20px"}},qr={key:1,class:"fcom_emoji_holder"};function Gr(e,t,s,u,o,i){const m=p("SmilyIcon"),f=j,h=H,g=Z,w=p("Picker"),b=p("action-popover");return n(),y(b,{ref:"fcom_emoji_popover","close-on-click-outside":!0,placement:"bottom",persistent:!1,"trigger-interactive":!0,teleported:!0,width:350,onShow:i.loadEmojiAssets},{trigger:r(()=>[a(h,{"aria-label":"Pick Imoji",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})]),default:r(({hide:S})=>[l("div",Or,[o.emojiLoading?(n(),c("div",jr,[o.errorMessage?(n(),c("div",Nr,d(o.errorMessage),1)):(n(),c(F,{key:1},[l("div",zr,d(e.$t("Loading...")),1),a(g,{animated:!0,rows:3})],64))])):o.emojiIndex?(n(),c("div",qr,[a(w,{title:e.$t("Pick Emoji"),i18n:{search:e.$t("Search"),notfound:e.$t("No Emoji Found"),categories:{search:e.$t("Search Results"),recent:e.$t("Frequently Used"),smileys:e.$t("Smileys & Emotion"),people:e.$t("People & Body"),nature:e.$t("Animals & Nature"),foods:e.$t("Food & Drink"),activity:e.$t("Activity"),places:e.$t("Travel & Places"),objects:e.$t("Objects"),symbols:e.$t("Symbols"),flags:e.$t("Flags"),custom:e.$t("Custom")}},color:"#66b1ff",showPreview:!1,ref:"picker",data:o.emojiIndex,set:"twitter",onSelect:k=>i.onEmojiSelect(k,S),emojiSize:22,sheetSize:32,emojiTooltip:!1},null,8,["title","i18n","data","onSelect"])])):_("",!0)])]),_:1},8,["onShow"])}const uo=I(Hr,[["render",Gr]]),Yr={name:"AudioEditModal",components:{ImageUploader:xe,EditPen:Ys,Delete:Ws},emits:["update:visible","saved"],props:{media:{type:Object,required:!0},visible:{type:Boolean,default:!1}},data(){return{localTitle:this.readTitle(),localPoster:this.readPoster(),saving:!1}},watch:{visible(e){e&&(this.localTitle=this.readTitle(),this.localPoster=this.readPoster())}},methods:{readTitle(){var e,t,s;return((t=(e=this.media)==null?void 0:e.settings)==null?void 0:t.title)||((s=this.media)==null?void 0:s.title)||""},readPoster(){var e,t,s;return((t=(e=this.media)==null?void 0:e.settings)==null?void 0:t.posterSrc)||((s=this.media)==null?void 0:s.image)||""},save(){var e;if(!this.localTitle||!this.localTitle.trim()){this.$handleError(this.$t("Audio file name cannot be empty"));return}if(this.localTitle=this.localTitle.trim(),!((e=this.media)!=null&&e.media_id)){this.$emit("saved",this.buildLocalUpdate()),this.$emit("update:visible",!1);return}this.saving=!0,this.$post("fluent-player/audio-media/"+this.media.media_id,{title:this.localTitle,posterSrc:this.localPoster}).then(t=>{this.$emit("saved",{...this.media,...t.media}),this.$emit("update:visible",!1)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})},buildLocalUpdate(){var t;const e={...((t=this.media)==null?void 0:t.settings)||{},title:this.localTitle,posterSrc:this.localPoster,poster_is_custom:!!this.localPoster};return{...this.media,title:this.localTitle,image:this.localPoster,settings:e}}}},Wr={class:"fcom_audio_edit"},Kr={id:"fcom_audio_name_label",class:"fcom_audio_edit__label"},Zr={class:"fcom_audio_edit__label"},Jr={class:"fcom_audio_edit__thumb_row"},Qr={class:"fcom_image_uploader_wrapper"},Xr={class:"fcom_sr_only"};function ec(e,t,s,u,o,i){const m=se,f=Fe,h=p("EditPen"),g=j,w=H,b=p("Delete"),S=p("image-uploader"),k=be;return n(),y(k,{"model-value":s.visible,title:e.$t("Edit Audio"),width:"440px","append-to-body":"","onUpdate:modelValue":t[3]||(t[3]=$=>e.$emit("update:visible",$))},{footer:r(()=>[a(w,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=$=>e.$emit("update:visible",!1))},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1}),a(w,{class:"fcom_primary_button",loading:o.saving,disabled:!o.localTitle||!o.localTitle.trim(),onClick:i.save},{default:r(()=>[V(d(e.$t("Save")),1)]),_:1},8,["loading","disabled","onClick"])]),default:r(()=>[l("div",Wr,[l("label",Kr,d(e.$t("Audio file name")),1),a(m,{modelValue:o.localTitle,"onUpdate:modelValue":t[0]||(t[0]=$=>o.localTitle=$),placeholder:e.$t("Audio file name"),"aria-label":e.$t("Audio file name"),"aria-labelledby":"fcom_audio_name_label"},null,8,["modelValue","placeholder","aria-label"]),l("label",Zr,d(e.$t("Thumbnail")),1),l("div",Jr,[o.localPoster?(n(),y(f,{key:0,src:o.localPoster,alt:e.$t("Thumbnail"),style:{"max-width":"100px",height:"auto"}},null,8,["src","alt"])):_("",!0),l("div",Qr,[a(S,{isTextBtn:!1,removeIcon:!0,can_remove:!!o.localPoster,confirm_remove:!0,additionalData:{resize:!1,max_width:500,skip_convert:"yes"},onUploaded:t[1]||(t[1]=$=>{o.localPoster=$})},ge({remove:r(()=>[a(g,null,{default:r(()=>[a(b)]),_:1}),l("span",Xr,d(e.$t("Remove Thumbnail")),1)]),_:2},[o.localPoster?{name:"trigger",fn:r(({loading:$})=>[a(w,{class:"fcom_plain_button",loading:$,disabled:$,"aria-label":e.$t("Change Thumbnail"),title:e.$t("Change Thumbnail")},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1})]),_:2},1032,["loading","disabled","aria-label","title"])]),key:"0"}:void 0]),1032,["can_remove"])])])])]),_:1},8,["model-value","title"])}const tc=I(Yr,[["render",ec]]),sc={name:"MusicIcon"},oc={width:"22",height:"22",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",focusable:"false"},ic=l("path",{d:"M7.5 15V4.583l8.333-1.25V13.75",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),nc=l("path",{d:"M5.417 17.5c1.15 0 2.083-.84 2.083-1.875S6.567 13.75 5.417 13.75 3.333 14.59 3.333 15.625 4.266 17.5 5.417 17.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),lc=l("path",{d:"M13.75 15.625c1.15 0 2.083-.84 2.083-1.875s-.933-1.875-2.083-1.875-2.083.84-2.083 1.875.933 1.875 2.083 1.875Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),ac=[ic,nc,lc];function rc(e,t,s,u,o,i){return n(),c("svg",oc,ac)}const cc=I(sc,[["render",rc]]),dc={name:"AudioUploadButton",components:{MusicIcon:cc},emits:["audio-added","uploading","completed"],props:{space:{type:String,default:""},remaining:{type:Number,default:null}},data(){return{uploading:!1}},computed:{maxAudios(){var e;return((e=this.appVars.features.fluent_player)==null?void 0:e.max_audios_per_post)||10},capacity(){return this.remaining===null?this.maxAudios:Math.max(0,this.remaining)},canUpload(){const e=this.appVars.features.fluent_player;if(!this.appVars.features.has_fluent_player||!e||!e.enable||!e.has_audio_upload)return!1;const t=e.video_upload_role||"admin";return t==="everyone"?!0:t==="admin_moderator"?this.isModerator(this.space)||this.isAdmin():this.isAdmin()}},methods:{pickFiles(){this.$refs.fileInput&&this.$refs.fileInput.click()},async onFilesSelected(e){var s,u;let t=Array.from(e.target.files||[]);if(e.target.value="",!!t.length){if(this.capacity<=0){this.$handleError(this.$t("You can add a maximum of %s audios per post.",this.maxAudios));return}t.length>this.capacity&&((u=(s=this.$notify)==null?void 0:s.warning)==null||u.call(s,this.$t("You can add a maximum of %s audios per post.",this.maxAudios)),t=t.slice(0,this.capacity)),this.uploading=!0,this.$emit("uploading");for(const o of t)try{await this.uploadOne(o)}catch(i){this.$handleError(i&&i.message?i.message:i)}this.uploading=!1,this.$emit("completed")}},uploadOne(e){const t=new FormData;return t.append("file",e),t.append("context","fluent_player"),t.append("media_kind","audio"),fetch(this.appVars.rest.url+"/fluent-player/video-upload",{method:"POST",headers:{"X-WP-Nonce":this.appVars.rest.nonce},body:t}).then(s=>s.json().then(u=>({ok:s.ok,body:u}))).then(({ok:s,body:u})=>{if(!s||!u||!u.media||!u.media.url)throw new Error(u&&u.message||this.$t("Failed to upload audio"));const o=u.media;this.$emit("audio-added",{type:"upload",url:o.url,player:"fluent_player",provider:"upload",content_type:"audio",html:"",title:o.settings&&o.settings.title||e.name,media_id:o.media_id,settings:o.settings||{}})})}}};function uc(e,t,s,u,o,i){const m=p("MusicIcon"),f=j,h=H;return i.canUpload?(n(),y(h,{key:0,"aria-label":e.$t("Upload Audio"),title:e.$t("Upload Audio"),text:"",loading:o.uploading,onClick:i.pickFiles},{default:r(()=>[a(f,{class:"fcom_status_img_icon"},{default:r(()=>[a(m)]),_:1}),l("input",{ref:"fileInput",type:"file",accept:".mp3,.wav,.m4a,.aac,.ogg,.oga,.flac",multiple:"",hidden:"",onChange:t[0]||(t[0]=(...g)=>i.onFilesSelected&&i.onFilesSelected(...g))},null,544)]),_:1},8,["aria-label","title","loading","onClick"])):_("",!0)}const _c=I(dc,[["render",uc]]),mc={name:"DocumentsUploader",components:{UploadFilled:Mt,Document:Lt},emits:["filesChanged","fileAdded"],props:{is_multiple:{type:Boolean,default:!1},additional_data:{type:Object,default:()=>({})},showLists:{type:Boolean,default:!0},prevFiles:{type:Array,default:()=>[]}},computed:{action_url(){return this.appVars.rest.url+"/documents/upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}},uploadingFiles(){return this.fileList.filter(e=>e.status==="uploading")}},data(){return{fileList:[]}},methods:{handleSuccess(e){var t;console.log(e),(t=e==null?void 0:e.file)!=null&&t.media_key&&this.$emit("fileAdded",e==null?void 0:e.file)},handleChange(){let e=[];this.fileList.forEach(t=>{var s,u;(u=(s=t==null?void 0:t.response)==null?void 0:s.file)!=null&&u.media_key&&e.push({id:t.response.file.id,media_key:t.response.file.media_key,title:t.response.file.title,type:t.response.file.type})}),this.$emit("filesChanged",e)},handleError(e){this.$handleError(JSON.parse(e.message))}}},hc={class:"fcom_documents_uploader"},fc={class:"el-upload__text"},pc={key:0},gc={class:"fcom_document_lists"},yc={class:"fcom_each_document"},vc={class:"fcom_document_info"},bc={class:"fcom_document_icon"},kc={class:"fcom_document_title"},wc={class:"fcom_document_actions"};function Cc(e,t,s,u,o,i){const m=p("UploadFilled"),f=j,h=mt,g=p("Document"),w=H;return n(),c("div",hc,[a(h,{action:i.action_url,headers:i.headers,"file-list":o.fileList,"onUpdate:fileList":t[0]||(t[0]=b=>o.fileList=b),accept:"*/*",drag:"",class:"fcom_document_upload",multiple:s.is_multiple,data:s.additional_data,"show-file-list":s.showLists,"on-change":i.handleChange,"on-success":i.handleSuccess,"on-error":i.handleError,"on-remove":i.handleChange},{default:r(()=>[a(f,{class:"el-icon--upload"},{default:r(()=>[a(m)]),_:1}),l("div",fc,d(e.$t("Drop file here or click to upload")),1)]),_:1},8,["action","headers","file-list","multiple","data","show-file-list","on-change","on-success","on-error","on-remove"]),!s.showLists&&i.uploadingFiles.length?(n(),c("div",pc,[l("div",gc,[(n(!0),c(F,null,x(i.uploadingFiles,b=>(n(),c("div",yc,[l("div",vc,[l("div",bc,[a(f,null,{default:r(()=>[a(g)]),_:1})]),l("span",kc,d(b.name),1)]),l("div",wc,[a(w,{text:"",size:"small",loading:!0},{default:r(()=>[V(d(e.$t("Uploading...")),1)]),_:1})])]))),256))])])):_("",!0)])}const $c=I(mc,[["render",Cc]]),Sc={name:"PdfIcon"},Vc={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"},Mc=l("path",{opacity:"0.4",d:"M19 11C19 10.1825 19 9.4306 18.8478 9.06306C18.6955 8.69552 18.4065 8.40649 17.8284 7.82843L13.0919 3.09188C12.593 2.593 12.3436 2.34355 12.0345 2.19575C11.9702 2.165 11.9044 2.13772 11.8372 2.11401C11.5141 2 11.1614 2 10.4558 2C7.21082 2 5.58831 2 4.48933 2.88607C4.26731 3.06508 4.06508 3.26731 3.88607 3.48933C3 4.58831 3 6.21082 3 9.45584V14C3 17.7712 3 19.6569 4.17157 20.8284C5.34315 22 7.22876 22 11 22H19M12 2.5V3C12 5.82843 12 7.24264 12.8787 8.12132C13.7574 9 15.1716 9 18 9H18.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Lc=l("path",{d:"M21 14H19C18.4477 14 18 14.4477 18 15V16.5M18 16.5V19M18 16.5H20.5M7 19V17M7 17V14H8.5C9.32843 14 10 14.6716 10 15.5C10 16.3284 9.32843 17 8.5 17H7ZM12.5 14H13.7857C14.7325 14 15.5 14.7462 15.5 15.6667V17.3333C15.5 18.2538 14.7325 19 13.7857 19H12.5V14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Tc=[Mc,Lc];function Fc(e,t,s,u,o,i){return n(),c("svg",Vc,Tc)}const Pc=I(Sc,[["render",Fc]]),Ic={name:"ZipIcon"},Ec={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"},Uc=l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9.24643 13.7697C8.9545 13.7507 8.55839 13.75 8.00407 13.75H7.00391C6.58969 13.75 6.25391 13.4142 6.25391 13C6.25391 12.5858 6.58969 12.25 7.00391 12.25H8.00407C8.01907 12.25 8.03402 12.25 8.04892 12.25C8.66199 12.25 9.18423 12.25 9.57881 12.2929C9.93962 12.3322 10.469 12.4271 10.7888 12.8672C10.9627 13.1066 11.0272 13.3876 10.9857 13.67C10.9495 13.9166 10.8383 14.1258 10.7382 14.2819C10.5513 14.5734 10.2447 14.912 9.91903 15.2718C9.90537 15.2868 9.89169 15.3019 9.87798 15.3171L8.63592 16.6895C8.43153 16.9153 8.27429 17.0901 8.15532 17.2303C8.44726 17.2493 8.84336 17.25 9.39768 17.25H10.3978C10.8121 17.25 11.1478 17.5858 11.1478 18C11.1478 18.4142 10.8121 18.75 10.3978 18.75L9.35284 18.75C8.73977 18.75 8.21752 18.7501 7.82294 18.7071C7.46213 18.6678 6.93277 18.5729 6.61299 18.1328C6.43908 17.8934 6.37458 17.6124 6.41604 17.33C6.45224 17.0835 6.5634 16.8742 6.66351 16.7181C6.85041 16.4266 7.15703 16.088 7.48273 15.7283C7.49638 15.7132 7.51006 15.6981 7.52377 15.6829L8.76583 14.3105C8.97022 14.0847 9.12746 13.9099 9.24643 13.7697Z",fill:"currentColor"},null,-1),Ac=l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.1914 13C12.1914 12.5858 12.5272 12.25 12.9414 12.25H15.4869C15.9011 12.25 16.2369 12.5858 16.2369 13C16.2369 13.4142 15.9011 13.75 15.4869 13.75H14.9641V17.25H15.4869C15.9011 17.25 16.2369 17.5858 16.2369 18C16.2369 18.4142 15.9011 18.75 15.4869 18.75H12.9414C12.5272 18.75 12.1914 18.4142 12.1914 18C12.1914 17.5858 12.5272 17.25 12.9414 17.25H13.4641V13.75H12.9414C12.5272 13.75 12.1914 13.4142 12.1914 13Z",fill:"currentColor"},null,-1),Bc=l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M19.0189 12.25C19.0305 12.25 19.0419 12.25 19.0534 12.25H19.7321C20.8365 12.25 21.7549 13.1328 21.7549 14.25C21.7549 15.3673 20.8365 16.25 19.7321 16.25H18.7852V18C18.7852 18.4142 18.4494 18.75 18.0352 18.75C17.621 18.75 17.2852 18.4142 17.2852 18V14C17.2852 13.9885 17.2852 13.9769 17.2852 13.9653C17.2851 13.7605 17.285 13.5378 17.3107 13.3497C17.3411 13.1278 17.4193 12.8466 17.6588 12.6114C17.8964 12.378 18.1772 12.3037 18.3966 12.2748C18.5853 12.2499 18.8094 12.2499 19.0189 12.25ZM18.7852 14.75H19.7321C20.0336 14.75 20.2549 14.5135 20.2549 14.25C20.2549 13.9866 20.0336 13.75 19.7321 13.75H19.0534C18.9463 13.75 18.8604 13.7501 18.7863 13.7514C18.7852 13.8207 18.7852 13.9009 18.7852 14V14.75Z",fill:"currentColor"},null,-1),Dc=l("path",{opacity:"0.4",d:"M7.13841 20.7033C8.00786 20.7942 9.13899 20.7955 10.7476 20.7955H14.9079C15.4456 20.7955 15.8816 21.233 15.8816 21.7727C15.8816 22.3125 15.4456 22.75 14.9079 22.75H10.6927C9.15159 22.75 7.91879 22.75 6.93654 22.6473C5.92712 22.5417 5.0659 22.3186 4.32113 21.7919C3.93077 21.5159 3.58222 21.1871 3.28704 20.8146C2.71721 20.0956 2.47396 19.2577 2.35985 18.2843C2.24996 17.3469 2.24998 16.1743 2.25 14.7262V12.1428V12.1427C2.25 10.7244 2.24999 9.61179 2.30919 8.71107C2.36944 7.79422 2.49398 7.02952 2.77509 6.31755C3.61848 4.1815 5.39221 2.51875 7.61221 1.73658C8.99465 1.2495 10.6813 1.24971 13.5209 1.25007L13.7572 1.25009L13.9605 1.25004L13.9606 1.25004C15.5156 1.2495 16.548 1.24914 17.4068 1.55172C18.7834 2.03673 19.8918 3.071 20.4206 4.41031C20.6039 4.87447 20.6795 5.36014 20.7153 5.90477C20.75 6.43335 20.75 7.08083 20.75 7.87999V7.88006V10.0455C20.75 10.5852 20.3141 11.0228 19.7763 11.0228C19.2386 11.0228 18.8026 10.5852 18.8026 10.0455V7.91329C18.8026 7.07303 18.8021 6.49008 18.7721 6.03341C18.7427 5.58546 18.6879 5.32704 18.6102 5.1304C18.3001 4.34503 17.6344 3.70339 16.7618 3.39593C16.2584 3.21858 15.5913 3.20463 13.7572 3.20463C13.4591 3.20463 13.1023 3.2058 12.7641 3.20732C12.426 3.20885 11.8726 3.21134 11.4104 3.48025C11.1057 3.65756 10.8849 3.85945 10.7582 4.08004C10.5409 4.45845 10.4166 4.89711 10.4166 5.3648C10.4166 5.51193 10.4262 5.70446 10.4344 5.88206L10.4344 5.88212C10.4417 6.03696 10.4496 6.20566 10.4531 6.3737C10.461 6.75379 10.449 7.19733 10.3343 7.62548C10.1108 8.45945 9.4594 9.11086 8.62543 9.33432C8.19728 9.44904 7.75374 9.46105 7.37365 9.45315C7.20551 9.44966 7.03693 9.44174 6.88201 9.43446C6.70441 9.42622 6.48041 9.41667 6.33328 9.41667C5.88661 9.41667 5.46642 9.53003 5.09991 9.72955C4.87246 9.85337 4.65104 10.0965 4.47811 10.3875C4.19749 10.8596 4.19732 11.4982 4.19734 11.7652L4.19737 14.6653C4.19737 16.1888 4.19894 17.2461 4.29387 18.0559C4.38611 18.8427 4.55555 19.2754 4.81111 19.5979C4.9889 19.8223 5.20128 20.0234 5.44274 20.1941C5.80057 20.4472 6.28449 20.6139 7.13841 20.7033Z",fill:"currentColor"},null,-1),Rc=[Uc,Ac,Bc,Dc];function xc(e,t,s,u,o,i){return n(),c("svg",Ec,Rc)}const Hc=I(Ic,[["render",xc]]),Oc={name:"AudioIcon"},jc={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"},Nc=l("path",{d:"M5.5 21.5H18.5C20.1569 21.5 21.5 20.1569 21.5 18.5V5.5C21.5 3.84315 20.1569 2.5 18.5 2.5H5.5C3.84315 2.5 2.5 3.84315 2.5 5.5V18.5C2.5 20.1569 3.84315 21.5 5.5 21.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),zc=l("path",{d:"M10 15.5C10 16.3284 9.32843 17 8.5 17C7.67157 17 7 16.3284 7 15.5C7 14.6716 7.67157 14 8.5 14C9.32843 14 10 14.6716 10 15.5ZM10 15.5V8.5L16 7V13.5M16 13.5C16 14.3284 15.3284 15 14.5 15C13.6716 15 13 14.3284 13 13.5C13 12.6716 13.6716 12 14.5 12C15.3284 12 16 12.6716 16 13.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),qc=[Nc,zc];function Gc(e,t,s,u,o,i){return n(),c("svg",jc,qc)}const Yc=I(Oc,[["render",Gc]]),Wc={name:"DocIcon"},Kc={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"},Zc=l("path",{d:"M21 15C21 14.4477 20.5523 14 20 14H19C18.4477 14 18 14.4477 18 15V18C18 18.5523 18.4477 19 19 19H20C20.5523 19 21 18.5523 21 18M7 14H8C9.10457 14 10 14.8954 10 16V17C10 18.1046 9.10457 19 8 19H7V14ZM13.5 14H14.5C15.0523 14 15.5 14.4477 15.5 15V18C15.5 18.5523 15.0523 19 14.5 19H13.5C12.9477 19 12.5 18.5523 12.5 18V15C12.5 14.4477 12.9477 14 13.5 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Jc=l("path",{d:"M19 22H5C3.89543 22 3 21.1046 3 20L3 4C3 2.89543 3.89543 2 5 2H12L19 9V11M18.5 9H13.998C12.8935 9 11.998 8.10457 11.998 7V2.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Qc=[Zc,Jc];function Xc(e,t,s,u,o,i){return n(),c("svg",Kc,Qc)}const ed=I(Wc,[["render",Xc]]),td={name:"VideoFileIcon"},sd={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"},od=l("path",{d:"M19 13V9L12 2H5C3.89543 2 3 2.89543 3 4V20C3 21.1046 3.89543 22 5 22H9",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),id=l("path",{d:"M12 2V7C12 8.10457 12.8954 9 14 9H19",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),nd=l("path",{d:"M18 19.5L21 21V17L18 18.5M18 19.5V18.5M18 19.5V21C18 21.5523 17.5523 22 17 22H13C12.4477 22 12 21.5523 12 21V17C12 16.4477 12.4477 16 13 16H17C17.5523 16 18 16.4477 18 17V18.5",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),ld=[od,id,nd];function ad(e,t,s,u,o,i){return n(),c("svg",sd,ld)}const rd=I(td,[["render",ad]]);const cd={name:"DocumentLists",components:{Document:Lt,Download:ci,PdfIcon:Pc,ImageIcon:us,ZipIcon:Hc,AudioIcon:Yc,DocIcon:ed,VideoFileIcon:rd},props:["document_lists","additional_data","is_editable","allow_rename"],emits:["fileRemoved","documentsUpdated"],data(){return{editingIndex:null,editingTitle:"",isSaving:!1}},computed:{canEditTitle(){return this.is_editable||this.allow_rename}},methods:{removeDocument(e,t){if(!this.is_editable){this.$emit("fileRemoved",e);return}this.$confirm(this.$t("Are you sure you want to delete this document?"),this.$t("Warning"),{confirmButtonText:this.$t("OK"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.deleteDocument(e,t)})},deleteDocument(e,t){this.isSaving=!0,this.$post("documents/delete",{id:t.id}).then(s=>{this.$notify.success(s.message),this.document_lists.splice(e,1),this.$emit("documentsUpdated",this.document_lists)}).catch(s=>{this.$handleError(s)}).finally(()=>{this.isSaving=!1})},getIcon(e){return e=="application/pdf"?"pdf-icon":e.includes("image")?"image-icon":e=="application/zip"?"zip-icon":e.includes("audio")?"audio-icon":e.includes("video")?"video-file-icon":e.includes("openxmlformats")?"doc-icon":"document"},startEdit(e,t){this.editingIndex=e,this.editingTitle=this.getBaseName(t.title)},cancelEdit(){this.editingIndex=null,this.editingTitle=""},getFileExtension(e){if(!e)return"";const t=e.lastIndexOf(".");return t<=0||t===e.length-1?"":e.slice(t)},getBaseName(e){const t=this.getFileExtension(e);return t?e.slice(0,-t.length):e||""},saveDoc(e){const t=this.editingTitle.trim()+this.getFileExtension(e.title);this.isSaving=!0,this.$post("documents/update",{id:e.id,title:t,...this.additional_data}).then(s=>{e.title=t,this.$notify.success(s.message),this.isSaving=!1,this.editingIndex=null,this.$emit("documentsUpdated",this.document_lists)}).catch(s=>{this.$handleError(s)}).finally(()=>{this.isSaving=!1})}}},dd={class:"fcom_document_lists"},ud={class:"fcom_each_document"},_d={class:"fcom_document_info"},md={class:"fcom_document_icon"},hd={class:"fcom_document_ext"},fd={class:"fcom_rename_actions"},pd=["href"],gd={class:"fcom_document_actions"},yd=["href","aria-label"];function vd(e,t,s,u,o,i){const m=j,f=se,h=H,g=p("EditPen"),w=p("Download"),b=p("DeleteFilled"),S=te("loading");return n(),c("div",dd,[(n(!0),c(F,null,x(s.document_lists,(k,$)=>(n(),c("div",ud,[l("div",_d,[l("div",md,[a(m,null,{default:r(()=>[(n(),y(wt(i.getIcon(k.type))))]),_:2},1024)]),i.canEditTitle&&o.editingIndex==$?(n(),c(F,{key:0},[a(f,{readonly:o.isSaving,size:"small","aria-label":e.$t("Document name"),style:{flex:"1",width:"100%"},modelValue:o.editingTitle,"onUpdate:modelValue":t[0]||(t[0]=v=>o.editingTitle=v)},ge({_:2},[i.getFileExtension(k.title)?{name:"suffix",fn:r(()=>[l("span",hd,d(i.getFileExtension(k.title)),1)]),key:"0"}:void 0]),1032,["readonly","aria-label","modelValue"]),l("div",fd,[a(h,{disabled:o.isSaving||!o.editingTitle.trim(),loading:o.isSaving,onClick:v=>i.saveDoc(k),type:"primary",size:"small"},{default:r(()=>[V(d(e.$t("Update")),1)]),_:2},1032,["disabled","loading","onClick"]),a(h,{disabled:o.isSaving,onClick:i.cancelEdit,size:"small"},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1},8,["disabled","onClick"])])],64)):(n(),c("a",{key:1,href:k.url,target:"_blank",rel:"noopener",class:"fcom_document_title"},d(k.title),9,pd))]),W((n(),c("div",gd,[i.canEditTitle&&o.editingIndex!=$?(n(),y(h,{key:0,"aria-label":e.$t("Edit"),onClick:v=>i.startEdit($,k),plain:"",text:"",size:"small"},{default:r(()=>[a(m,null,{default:r(()=>[a(g)]),_:1})]),_:2},1032,["aria-label","onClick"])):_("",!0),!s.is_editable&&k.url?(n(),c("a",{key:1,href:k.url+"&force_download=1",target:"_blank","aria-label":e.$t("Download"),class:"el-button el-button--text"},[a(m,null,{default:r(()=>[a(w)]),_:1})],8,yd)):_("",!0),s.is_editable?(n(),y(h,{key:2,"aria-label":e.$t("Delete"),onClick:v=>i.removeDocument($,k),plain:"",text:"",size:"small"},{default:r(()=>[a(m,null,{default:r(()=>[a(b)]),_:1})]),_:2},1032,["aria-label","onClick"])):_("",!0)])),[[S,o.isSaving]])]))),256))])}const ot=I(cd,[["render",vd]]);const bd={name:"DocumentUploaderPop",components:{DocumentLists:ot,DocumentsUploader:$c,Document:Lt},props:["feed","space_id","is_inline"],methods:{reset(){delete this.feed.document_ids,this.feed.content_type=""},fileAdded(e){this.feed.document_ids||(this.feed.document_ids=[]),this.feed.document_ids.push(e),this.feed.content_type="document"},removeDocument(e){this.feed.document_ids.splice(e,1),(!this.feed.document_ids||this.feed.document_ids.length===0)&&(this.feed.content_type="")}}},kd={class:"fcom_inline_docs_form"},wd={class:"fcom_doc_upload_modal"};function Cd(e,t,s,u,o,i){var g;const m=H,f=p("documents-uploader"),h=p("document-lists");return n(),c("div",kd,[l("div",wd,[a(m,{onClick:t[0]||(t[0]=w=>i.reset()),class:"fcom_file_cancel_btn",text:"",size:"small"},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1}),a(f,{style:{"margin-bottom":"20px"},showLists:!1,additional_data:{space_id:s.space_id},is_multiple:!0,onFileAdded:i.fileAdded},null,8,["additional_data","onFileAdded"]),a(h,{class:"fcom_boxed_documents",additional_data:{space_id:s.space_id,feed_id:s.feed.id},is_editable:!0,document_lists:(g=s.feed)==null?void 0:g.document_ids,onFileRemoved:i.removeDocument},null,8,["additional_data","document_lists","onFileRemoved"])])])}const $d=I(bd,[["render",Cd]]),Sd={name:"PaperClipIcon"},Vd={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},Md=l("path",{d:"M18.1188 9.2622L11.431 16.6897C9.50497 18.8288 6.13081 18.9109 3.86828 16.8737C1.60575 14.8365 1.33471 11.4723 3.26079 9.33317L9.14601 2.79697C10.4836 1.31147 12.8106 1.25484 14.3818 2.66956C15.953 4.08428 16.1399 6.40445 14.8023 7.88995L9.45214 13.832C8.70311 14.6638 7.42326 14.695 6.54338 13.9027C5.66351 13.1105 5.5607 11.8344 6.30973 11.0025L10.8574 5.95182",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Ld=[Md];function Td(e,t,s,u,o,i){return n(),c("svg",Vd,Ld)}const _o=I(Sd,[["render",Td]]),Fd=window.fluentComAdmin.auth,Pd={name:"FeedTextComposer",components:{AudioEditModal:tc,AudioList:no,AudioUploadButton:_c,PaperClipIcon:_o,DocumentLists:ot,DocumentUploaderPop:$d,Document:Lt,MediaPreview:He,Giphy:Ql,ImageUploader:xe,SurveyEditForm:Dl,MarkdownEditor:It,EmojiPicker:uo,VideoEmbeder:_r,ImageIcon:us,PollIcon:Ml},emits:["editorCreated"],props:{placeholder:{type:String,default(){return"What's happening, "+Fd.first_name}},config:{type:Object,default(){return{multipleMedia:!1,surveyApp:!1,videoApp:!1,disableUpload:!1,documentsApp:!1,space_id:null,spaceSlug:null,isAdmin:!1}}},disabled:{type:Boolean,default(){return!1}},autofocus:{type:Boolean,default(){return!0}},content:{type:Object,default(){return{message:"",media_images:[]}}},mentionQuery:{type:Object,default(){return{}}},autofocus_changed:{type:[Boolean,Number],default(){return!1}},defaultMentions:{type:Array,default(){return[]}},context:{type:String,default(){return""}},is_editing:{type:Boolean,default(){return!1}},is_modal:{type:Boolean,default(){return!1}}},computed:{hasActiveApp(){return this.content.content_type=="document"},hasInlineImageUpload(){return this.appVars.features.has_inline_image_upload==="yes"},maxAudios(){var e;return((e=this.appVars.features.fluent_player)==null?void 0:e.max_audios_per_post)||10},audioRemaining(){var e,t;return Math.max(0,this.maxAudios-(((t=(e=this.content)==null?void 0:e.audio_medias)==null?void 0:t.length)||0))}},data(){return{mentionResults:[],mentionSearch:"",uploading:!1,isEmojiPickerVisible:!1,showAudioEdit:!1,composerEditIndex:null,maxMediaPerPost:this.appVars.features.max_media_per_post}},methods:{cencelSurvey(){this.content.survey=null},insertEmoji(e){this.$refs.markdownEditor&&this.$refs.markdownEditor.updateContent(e)},clearContent(){var e;this.content.message="",(e=this.$refs.markdownEditor)==null||e.clearContent()},checkHasImageForCommentsEdit(e){return e.media&&e.media.media_url},removeImageFromComments(){this.content.media=null},checkForImage(e){for(let t=0;t<e.clipboardData.items.length;++t){let s=e.clipboardData.items[t];if(s.kind=="file"&&s.type.startsWith("image/")){const u=s.getAsFile(),o=e.clipboardData.getData("text")||"clipboard-image.png";this.uploadImage(new File([u],o,{type:u.type}))}}},uploadImage(e,t=!0){if(this.config.disableUpload)return this.$notify.error(this.$t("You are not allowed to upload media here.")),!1;if(!this.canAddImage())return!1;t&&(this.uploading=!0);const s=new FormData;return s.append("file",e),s.append("max_width",1400),s.append("context",this.context),s.append("resize",!0),this.$uploadFile("feeds/media-upload",s).then(u=>(t&&this.handleMediaUpload(u.media.url),u.media.url)).catch(u=>{this.$handleError(u)}).finally(()=>{this.uploading=!1})},handleMediaUpload(e,t="uploader"){var s,u;if(this.content.media_images||(this.content.media_images=[]),(u=(s=this.content)==null?void 0:s.meta)!=null&&u.media_preview&&(this.content.meta.media_preview=null),this.config.multipleMedia||(this.content.media_images=[]),!this.canAddImage())return!1;this.content.media=null,this.content.meta=null,this.content.audio_medias=[],this.content.media_images.push({url:e,provider:t,type:"image",height:0,width:0})},initSurveyForm(){this.content.survey||(this.content.survey={type:"single_choice",options:[{slug:"",label:this.$t("First choice")},{slug:"",label:""}]})},selectedGiphy(e){var s,u;this.content.meta||(this.content.meta=[]),(s=this.content)!=null&&s.media_images&&(this.content.media_images=[]),(u=this.content)!=null&&u.media&&(this.content.media=null),this.content.audio_medias=[];const t={image:e.images.downsized_medium.url,height:e.images.downsized_medium.height,width:e.images.downsized_medium.width,type:"image",provider:"giphy"};this.content.meta={media_preview:t}},handleVideoAttachment(e){var s,u,o;if(e&&(e.content_type==="audio"||((s=e.settings)==null?void 0:s.viewType)==="audio")){if(this.content.media_images=[],this.content.media=null,this.content.meta&&!Array.isArray(this.content.meta)&&this.content.meta.media_preview&&(this.content.meta.media_preview=null),Array.isArray(this.content.audio_medias)||(this.content.audio_medias=[]),this.content.audio_medias.length>=this.maxAudios){(o=(u=this.$notify)==null?void 0:u.warning)==null||o.call(u,this.$t("You can add a maximum of %s audios per post.",this.maxAudios));return}this.content.audio_medias.push({...e,player:"fluent_player"}),this.syncAudioMediasToMeta();return}this.content.media_images=[],this.content.meta=[],this.content.audio_medias=[],this.content.media=e},syncAudioMediasToMeta(){const e=Array.isArray(this.content.audio_medias)?this.content.audio_medias:[];(!this.content.meta||Array.isArray(this.content.meta))&&(this.content.meta={...this.content.meta||{}}),e.length?this.content.meta.audio_medias=e:delete this.content.meta.audio_medias},removeComposerAudio(e){Array.isArray(this.content.audio_medias)&&(this.content.audio_medias.splice(e,1),this.syncAudioMediasToMeta())},openComposerAudioEdit(e){this.composerEditIndex=e,this.showAudioEdit=!0},onComposerAudioSaved(e){if(this.composerEditIndex===null)return;const t=this.content.audio_medias[this.composerEditIndex]||{};this.content.audio_medias.splice(this.composerEditIndex,1,{...t,...e}),this.syncAudioMediasToMeta()},getInlineImageCount(){var t,s;const e=(s=(t=this.$refs.markdownEditor)==null?void 0:t.$refs)==null?void 0:s.crepe_editor_vue;return e?e.querySelectorAll('img[src^="http"]').length:0},canAddImage(){var s;return(((s=this.content.media_images)==null?void 0:s.length)||0)+this.getInlineImageCount()>=this.maxMediaPerPost?(this.$notify.error(this.$t("You can upload a maximum of %s images per post.",this.maxMediaPerPost)),!1):!0}},mounted(){var t,s,u;const e=(s=(t=this.content)==null?void 0:t.meta)==null?void 0:s.audio_medias;Array.isArray(e)&&e.length&&!((u=this.content.audio_medias)!=null&&u.length)&&(this.content.audio_medias=[...e]),this.autofocus&&this.$nextTick(()=>{this.$refs.create_status&&this.$refs.create_status.focus()})}},Id={class:"fcom_text_composer"},Ed={class:"fcom_editor status_text_input"},Ud={key:1,class:"fcom_audio_compose_list"},Ad={key:2,style:{position:"relative","text-align":"center"}},Bd={key:3,class:"fcom_media_items"},Dd={key:0,class:"fcom_media_images"},Rd=["src","alt"],xd={key:1,class:"fcrom_media_images"},Hd={class:"fcrom_media_image"},Od=["src","alt"],jd={key:4,class:"fcrom_media_images"},Nd=["src","alt"],zd={key:5,class:"fcrom_media_images"},qd={class:"fcrom_media_image"},Gd=["src","alt"],Yd={class:"fcom_composer_footer"},Wd={class:"fcom_composer_apps"},Kd={key:0},Zd={class:"fcom_composer_actions"};function Jd(e,t,s,u,o,i){var A,q,O,N,G,ae,B,X,me,ee,Ve;const m=p("MarkdownEditor"),f=p("DocumentUploaderPop"),h=p("SurveyEditForm"),g=p("audio-list"),w=p("audio-edit-modal"),b=H,S=p("media-preview"),k=p("CloseBold"),$=j,v=p("ImageIcon"),C=p("image-uploader"),L=p("video-embeder"),M=p("audio-upload-button"),E=p("PaperClipIcon"),T=p("PollIcon"),P=p("EmojiPicker"),U=p("Giphy"),D=te("loading");return n(),c(F,null,[l("div",Id,[l("div",Ed,[Y(e.$slots,"before_input"),a(m,{ref:"markdownEditor",modelValue:s.content.message,"onUpdate:modelValue":t[0]||(t[0]=Q=>s.content.message=Q),context:s.context,is_modal:s.is_modal,autofocus:s.autofocus,placeholder:s.placeholder,mentionQuery:s.mentionQuery,defaultMentions:s.defaultMentions,autofocus_changed:s.autofocus_changed,onInlineUpload:i.hasInlineImageUpload?Q=>i.uploadImage(Q,!1):null,canAddImage:i.canAddImage,onHandleMediaUpload:i.uploadImage,onEditorCreated:t[1]||(t[1]=()=>{e.$emit("editorCreated")})},null,8,["modelValue","context","is_modal","autofocus","placeholder","mentionQuery","defaultMentions","autofocus_changed","onInlineUpload","canAddImage","onHandleMediaUpload"]),Y(e.$slots,"after_input")]),s.content.content_type=="document"?(n(),c(F,{key:0},[s.config.documentsApp&&s.config.space_id?(n(),y(f,{key:0,is_inline:!0,feed:s.content,space_id:s.config.space_id},null,8,["feed","space_id"])):_("",!0)],64)):(n(),c(F,{key:1},[s.content.survey?(n(),y(h,{key:0,onCancel:i.cencelSurvey,form:s.content.survey,is_editing:s.is_editing},null,8,["onCancel","form","is_editing"])):_("",!0),(q=(A=s.content)==null?void 0:A.audio_medias)!=null&&q.length?(n(),c("div",Ud,[a(g,{audios:s.content.audio_medias,editable:!0,onRemove:i.removeComposerAudio,onEdit:i.openComposerAudioEdit},null,8,["audios","onRemove","onEdit"]),o.composerEditIndex!==null?(n(),y(w,{key:0,media:s.content.audio_medias[o.composerEditIndex],visible:o.showAudioEdit,"onUpdate:visible":t[2]||(t[2]=Q=>o.showAudioEdit=Q),onSaved:i.onComposerAudioSaved},null,8,["media","visible","onSaved"])):_("",!0)])):(N=(O=s.content)==null?void 0:O.media)!=null&&N.type?(n(),c("div",Ad,[a(b,{onClick:t[3]||(t[3]=Q=>{s.content.media=null}),text:"",type:"danger"},{default:r(()=>[V(d(e.$t("Remove Media")),1)]),_:1}),a(S,{media_item:s.content.media},null,8,["media_item"])])):(G=s.content)!=null&&G.meta?(n(),c("div",Bd,[(B=(ae=s.content.meta)==null?void 0:ae.media_items)!=null&&B.length?(n(!0),c(F,{key:0},x(s.content.meta.media_items,(Q,J)=>(n(),c("div",{key:J},[Q.type=="image"?(n(),c("div",Dd,[l("img",{class:"fcom_media_image",src:Q.url,alt:e.$t("Media image")},null,8,Rd),a(b,{"aria-label":e.$t("Remove image"),class:"fcom_media_images_cross_button",link:"",onClick:ie=>s.content.meta.media_items.splice(J,1)},{default:r(()=>[a($,null,{default:r(()=>[a(k)]),_:1})]),_:2},1032,["aria-label","onClick"])])):_("",!0)]))),128)):((me=(X=s.content.meta)==null?void 0:X.media_preview)==null?void 0:me.type)=="image"||(Ve=(ee=s.content.meta)==null?void 0:ee.media_preview)!=null&&Ve.image?(n(),c("div",xd,[l("div",Hd,[l("img",{src:s.content.meta.media_preview.image,alt:e.$t("Media Preview image")},null,8,Od),a(b,{"aria-label":e.$t("Remove image"),link:"",onClick:t[4]||(t[4]=Q=>s.content.meta.media_preview=null)},{default:r(()=>[a($,null,{default:r(()=>[a(k)]),_:1})]),_:1},8,["aria-label"])])])):_("",!0)])):s.content.media_images&&s.content.media_images.length?(n(),c("div",jd,[(n(!0),c(F,null,x(s.content.media_images,(Q,J)=>(n(),c("div",{class:"fcrom_media_image",key:J},[l("img",{src:Q.url,alt:e.$t("Media image")},null,8,Nd),a(b,{"aria-label":e.$t("Remove image"),link:"",onClick:ie=>s.content.media_images.splice(J,1)},{default:r(()=>[a($,null,{default:r(()=>[a(k)]),_:1})]),_:2},1032,["aria-label","onClick"])]))),128))])):i.checkHasImageForCommentsEdit(s.content)?(n(),c("div",zd,[l("div",qd,[l("img",{src:s.content.media.media_url,alt:e.$t("Media image")},null,8,Gd),a(b,{"aria-label":e.$t("Remove image"),link:"",onClick:t[5]||(t[5]=Q=>i.removeImageFromComments())},{default:r(()=>[a($,null,{default:r(()=>[a(k)]),_:1})]),_:1},8,["aria-label"])])])):_("",!0)],64))]),Y(e.$slots,"before_composer_footer"),W((n(),c("div",Yd,[l("div",Wd,[i.hasActiveApp?_("",!0):(n(),c(F,{key:0},[o.maxMediaPerPost?(n(),y(C,{key:0,additionalData:{resize:!0,context:s.context,max_width:1400},isMultiple:s.config.multipleMedia,onUploading:t[6]||(t[6]=()=>{o.uploading=!0}),onCompleted:t[7]||(t[7]=()=>{o.uploading=!1}),onUploaded:i.handleMediaUpload},{default:r(()=>[a(b,{"aria-label":"Upload Media",loading:o.uploading,text:""},{default:r(()=>[a($,{class:"fcom_status_img_icon"},{default:r(()=>[a(v)]),_:1}),o.uploading?(n(),c("span",Kd,d(e.$t("Uploading...")),1)):_("",!0)]),_:1},8,["loading"])]),_:1},8,["additionalData","isMultiple","onUploaded"])):_("",!0),s.config.videoApp&&e.hasFeature("video_embeder")?(n(),y(L,{key:1,space:s.config.spaceSlug,is_admin:s.config.is_admin,onEmbeded:i.handleVideoAttachment},null,8,["space","is_admin","onEmbeded"])):_("",!0),s.config.videoApp&&e.hasFeature("video_embeder")?(n(),y(M,{key:2,space:s.config.spaceSlug,remaining:i.audioRemaining,onAudioAdded:i.handleVideoAttachment,onUploading:t[8]||(t[8]=()=>{o.uploading=!0}),onCompleted:t[9]||(t[9]=()=>{o.uploading=!1})},null,8,["space","remaining","onAudioAdded"])):_("",!0),s.config.documentsApp&&s.config.space_id?(n(),y(b,{key:3,"aria-label":e.$t("Add Documents"),title:e.$t("Upload Documents"),text:"",onClick:t[10]||(t[10]=Q=>s.content.content_type="document")},{default:r(()=>[a($,{class:R(["fcom_apps_icon"])},{default:r(()=>[a(E)]),_:1})]),_:1},8,["aria-label","title"])):_("",!0),s.config.surveyApp&&e.hasFeature("has_survey_poll")?(n(),y(b,{key:4,"aria-label":"Create Poll",onClick:i.initSurveyForm,text:""},{default:r(()=>[a($,{class:"fcom_apps_icon"},{default:r(()=>[a(T)]),_:1})]),_:1},8,["onClick"])):_("",!0),e.hasFeature("emoji_app")?(n(),y(P,{key:5,onEmojiSelected:i.insertEmoji},null,8,["onEmojiSelected"])):_("",!0),e.hasFeature("giphy_app")?(n(),y(U,{key:6,onSelectedGiphy:i.selectedGiphy},null,8,["onSelectedGiphy"])):_("",!0)],64))]),l("div",Zd,[Y(e.$slots,"default")])])),[[D,o.uploading]]),Y(e.$slots,"after_composer_footer")],64)}const pt=I(Pd,[["render",Jd]]),Qd={name:"ImageCarousel",props:["feed","is_single"],computed:{srcList(){return this.feed.meta.media_items.map(e=>e.url)},visibleMedia(){return this.feed.meta.media_items.map((e,t)=>({url:e.url,type:e.type,index:t})).slice(0,4)},overflowCount(){return this.srcList.length>4?this.srcList.length-4:0},carouselClass(){const e=this.srcList.length;return e===1?"fcom_image_carousel_num_1":e===3?"fcom_image_carousel_num_3":e===2||e===4||e>4?"fcom_image_carousel_num_2_or_4":""}},methods:{getVideoType(e){switch(e.split(".").pop().toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";default:return"video/mp4"}},isOverflowSlot(e){return e===3&&this.feed.meta.media_items.length>4}}},Xd={class:"fcom_image_carousel"},eu={key:0},tu=["preload","poster"],su=["src","type"],ou={key:1,class:"fcom_image_wrap"},iu={key:0,class:"fcom_image_overlay"};function nu(e,t,s,u,o,i){const m=Fe;return n(),c("div",Xd,[l("div",{class:R([i.carouselClass+" "+s.feed.type,"fcom_image_carousel__container"])},[(n(!0),c(F,null,x(i.visibleMedia,(f,h)=>(n(),c("div",{class:R(["fcom_carousel__image","fcom_media_type_"+f.type])},[f.type==="video"?(n(),c("div",eu,[l("video",{style:{width:"100%","aspect-ratio":"16/9"},controls:"",preload:s.is_single?"":"none",poster:f.thumbnail},[l("source",{src:f.url,type:i.getVideoType(f.url)},null,8,su)],8,tu)])):(n(),c("div",ou,[a(m,{lazy:"",alt:"",src:f.url,"zoom-rate":1.2,"max-scale":7,"min-scale":.5,"hide-on-click-modal":!0,"preview-teleported":!0,"initial-index":f.index,"preview-src-list":i.srcList,"show-progress":"",fit:"cover"},null,8,["src","initial-index","preview-src-list"]),i.isOverflowSlot(h)?(n(),c("div",iu,"+"+d(i.overflowCount),1)):_("",!0)]))],2))),256))],2)])}const Et=I(Qd,[["render",nu]]),lu={name:"ErrorIcon"},au={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"rgb(245 166 7)","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"h-3 w-3 ltr:mr-2 rtl:ml-2"},ru=l("circle",{cx:"12",cy:"12",r:"10"},null,-1),cu=l("line",{x1:"12",x2:"12",y1:"16",y2:"12"},null,-1),du=l("line",{x1:"12",x2:"12.01",y1:"8",y2:"8"},null,-1),uu=[ru,cu,du];function _u(e,t,s,u,o,i){return n(),c("svg",au,uu)}const mo=I(lu,[["render",_u]]),mu={name:"ReportReview",components:{ErrorIcon:mo},props:{feed:{type:Object,required:!0},type:{type:String,default:"post"}},emits:["updated"],methods:{openReportDetails(){this.$eventBus.emit("showReportReviewModal",{content:this.feed,type:this.type})},handleReportUpdate(e){var t,s;((t=e.content)==null?void 0:t.id)==((s=this.feed)==null?void 0:s.id)&&this.$emit("updated",e.content)}},mounted(){this.$eventBus.on("updateModerationReport",this.handleReportUpdate)},beforeUnmount(){this.$eventBus.off("updateModerationReport",this.handleReportUpdate)}},hu={class:"fcom_feed_report_wrap"},fu={class:"fcom_feed_report_content"},pu={key:0},gu={key:1},yu={key:2},vu={class:"fcom_feed_report_action"};function bu(e,t,s,u,o,i){const m=p("ErrorIcon"),f=H;return n(),c("div",hu,[l("div",fu,[a(m),s.feed.meta.auto_flagged=="yes"?(n(),c("span",pu,d(e.$t("This %s has been flagged automatically by the site rule.",s.type)),1)):s.feed.meta.reports_count>1?(n(),c("span",gu,d(e.$t("This %1$s has been flagged with %2$s reports",s.type,s.feed.meta.reports_count)),1)):(n(),c("span",yu,d(e.$t("This %1$s has been flagged with %2$s report",s.type,s.feed.meta.reports_count)),1))]),l("div",vu,[a(f,{onClick:t[0]||(t[0]=h=>i.openReportDetails())},{default:r(()=>[V(d(e.$t("Review")),1)]),_:1})])])}const ho=I(mu,[["render",bu]]),ku={name:"StickyIcon"},wu={viewBox:"0 0 24 24","aria-hidden":"true",class:"r-4qtqp9 r-yyyyoo r-dnmrzs r-bnwqim r-lrvibr r-m6rgpd r-14j79pv r-10ptun7 r-1janqcz"},Cu=l("g",null,[l("path",{d:"M7 4.5C7 3.12 8.12 2 9.5 2h5C15.88 2 17 3.12 17 4.5v5.26L20.12 16H13v5l-1 2-1-2v-5H3.88L7 9.76V4.5z"})],-1),$u=[Cu];function Su(e,t,s,u,o,i){return n(),c("svg",wu,$u)}const Ut=I(ku,[["render",Su]]),Vu={name:"FeedMdContent",props:["content","class_name"],data(){return{hoverTimeout:null,lightboxImages:[],lightboxIndex:0}},watch:{content(){this.$nextTick(()=>{this.cleanupListeners(),this.setupListeners()})}},methods:{setupListeners(){const e=this.$refs.content;if(!e)return;const t=/\/u\/([^\/]+)\/?$/;e.querySelectorAll("a").forEach(s=>{const u=s.getAttribute("href"),o=(u==null?void 0:u.startsWith(this.appVars.portal_url))&&u.match(t);if(!o)return;const i=o[1];s._mentionEnter=()=>{clearTimeout(this.hoverTimeout),this.hoverTimeout=setTimeout(()=>{this.$eventBus.emit("show_mention_popover",{username:i,triggerElement:s})},500)},s._mentionLeave=()=>{clearTimeout(this.hoverTimeout),this.$eventBus.emit("hide_mention_popover")},s.addEventListener("mouseenter",s._mentionEnter),s.addEventListener("mouseleave",s._mentionLeave)}),this._clickHandler=s=>{var m;const u=s.target.closest('img[src^="http"]');if(u){s.preventDefault();const f=Array.from(e.querySelectorAll('img[src^="http"]')).map(h=>h.src);this.lightboxImages=f,this.lightboxIndex=Math.max(0,f.indexOf(u.src));return}const o=s.target.closest(".fcom_copy_code_btn");if(!o)return;s.stopPropagation();const i=(m=o.parentElement)==null?void 0:m.querySelector("pre");i&&this.$toClipboard((i.querySelector("code")||i).innerText,"Code copied")},e.addEventListener("click",this._clickHandler),e.querySelectorAll("pre").forEach(s=>{var o;if((o=s.parentElement)!=null&&o.classList.contains("fcom_code_wrap"))return;const u=document.createElement("div");u.className="fcom_code_wrap",u.innerHTML='<button class="fcom_copy_code_btn" title="'+this.$t("Copy code")+'"></button>',s.replaceWith(u),u.prepend(s)})},cleanupListeners(){const e=this.$refs.content;e&&(e.querySelectorAll("a").forEach(t=>{t._mentionEnter&&(t.removeEventListener("mouseenter",t._mentionEnter),t.removeEventListener("mouseleave",t._mentionLeave))}),this.$eventBus.emit("hide_mention_popover"),clearTimeout(this.hoverTimeout),this._clickHandler&&(e.removeEventListener("click",this._clickHandler),this._clickHandler=null),e.querySelectorAll(".fcom_copy_code_btn").forEach(t=>t.remove()))}},mounted(){this.$nextTick(()=>this.setupListeners())},beforeUnmount(){this.cleanupListeners()}},Mu=["innerHTML"];function Lu(e,t,s,u,o,i){const m=xs;return n(),c(F,null,[l("div",{ref:"content",class:R(["feed_md_content",s.class_name]),innerHTML:s.content},null,10,Mu),o.lightboxImages.length?(n(),y(m,{key:0,"url-list":o.lightboxImages,"initial-index":o.lightboxIndex,"hide-on-click-modal":!0,onClose:t[0]||(t[0]=f=>o.lightboxImages=[]),"show-progress":o.lightboxImages.length>1},null,8,["url-list","initial-index","show-progress"])):_("",!0)],64)}const At=I(Vu,[["render",Lu]]),Tu=80,Fu=20,Pu=5e3,Bt={methods:{scrollCommentIntoView(e,t=null){var f;const s=this.$el instanceof Element?this.$el:(f=this.$el)==null?void 0:f.parentElement,u=(s==null?void 0:s.closest(".feed"))||document,o=h=>h&&u.querySelector("#comment_"+h),i=o(e)||o(t);if(!i)return;const m=i.querySelector(".comment_text")||i;m.classList.add("fcom_highlight_glow"),setTimeout(()=>m.classList.remove("fcom_highlight_glow"),Pu),setTimeout(()=>{const h=i.getBoundingClientRect();h.top>=Tu&&h.bottom<=window.innerHeight-Fu||i.scrollIntoView({behavior:"smooth",block:"center"})},50)}}},Iu={name:"SingleComment",mixins:[Bt],components:{ImageCarousel:Et,FeedTextComposer:pt,MediaPreview:He,ReportReview:ho,StickyIcon:Ut,FeedMdContent:At,ActionPopover:Ke},props:{comment:{type:Object,required:!0},show_header:{type:Boolean,default:!0},show_report:{type:Boolean,default:!1},space_id:{type:String,default:null}},emits:["deleted","updated","reload","copyLink"],watch:{isEdit(e){e||(this.expanded=!1,this.canExpand=!1,this.$nextTick(()=>{this.checkOverflow(),this.canExpand&&(this.expanded=!0)}))}},mounted(){this.$nextTick(()=>this.checkOverflow())},data(){return{working:!1,isEdit:!1,editingComment:null,focusTrigger:0,expanded:!1,canExpand:!1}},computed:{contentClass(){return"comment_text_body"+(this.expanded?"":" clamped")},isReportEnabled(){return this.has_pro&&this.appVars.moderationConfig.is_enabled},showReport(){var e;return this.hasSpaceModeratorAccess()&&this.isReportEnabled&&this.show_report&&(this.comment.status=="pending"||((e=this.comment.meta)==null?void 0:e.reports_count))},showReportOption(){return!(this.comment.user_id==this.auth.user_id)&&this.auth.user_id&&this.isReportEnabled},showStickyOption(){return!this.comment.parent_id&&this.hasSpaceModeratorAccess()},getReportComment(){return{...this.comment,space_id:this.space_id}},commentActions(){const e=[{label:this.$t("Copy Link"),action:()=>this.copyCommentLink(this.comment)}];return this.showStickyOption&&e.push({label:this.comment.is_sticky?this.$t("Unpin from Top"):this.$t("Pin to Top"),action:()=>this.toggleSticky()}),this.showReportOption&&e.push({label:this.$t("Report Comment"),action:()=>this.reportComment(this.comment)}),this.canEditComment(this.comment)&&e.push({label:this.$t("Edit"),action:()=>this.editComment()}),this.canDeleteComment(this.comment)&&e.push({label:this.$t("Delete"),type:"danger",action:()=>this.deleteComment()}),e}},methods:{maybeSave(e){(e.metaKey||e.ctrlKey)&&e.keyCode===13&&this.updateComment()},deleteComment(){this.$confirm(this.$t("Are you sure you want to delete this comment and associated data?"),this.$t("Warning"),{confirmButtonText:this.$t("Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.working=!0,this.$del("feeds/"+this.comment.post_id+"/comments/"+this.comment.id).then(e=>{this.$emit("deleted"),this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1})})},editComment(){this.working=!0,this.$get(`comments/${this.comment.id}`,{context:"edit"}).then(e=>{this.editingComment=e.comment,this.isEdit=!0}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1,this.$refs.comment_actions.hide()})},updateComment(){var t,s,u,o;const e=((t=this.editingComment.media_images)==null?void 0:t.length)>0||((u=(s=this.editingComment.meta)==null?void 0:s.media_preview)==null?void 0:u.image);if(!((o=this.editingComment.message)!=null&&o.replace(/&#x20;|\u00A0/gi,"").trim())&&!e){this.$notify.error(this.$t("Comment cannot be empty")),this.focusTrigger++;return}this.working=!0,this.isEdit=!0,this.$post(`feeds/${this.comment.post_id}/comments/${this.comment.id}`,{comment:this.editingComment.message,media_images:this.editingComment.media_images,meta:this.editingComment.meta}).then(i=>{this.$notify.success((i==null?void 0:i.message)||this.$t("Comment updated successfully")),Object.assign(this.comment,i.comment),this.comment.media_images=[],this.isEdit=!1,this.$nextTick(()=>{this.scrollCommentIntoView(this.comment.id)})}).catch(i=>{this.$handleError(i),this.focusTrigger++}).finally(()=>{this.isEdit=!1,this.working=!1})},toggleSticky(){this.hasSpaceModeratorAccess()&&(this.working=!0,this.comment.is_sticky=!this.comment.is_sticky,this.$patch("feeds/"+this.comment.post_id+"/comments/"+this.comment.id,{is_sticky:this.comment.is_sticky?1:0}).then(e=>{this.$notify.success(e.message),this.$emit("reload")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1}))},renderedComment(e){const s=/(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_-]+)/.exec(e);if(s&&s[1]){let i=s[1];if(i){let m=`<div class="feed_media_ext_video"><iframe src="https://www.youtube.com/embed/${i}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>`;e+=m}}let u=window.location.origin,o=new RegExp(u,"g");return e=e.replace(/<a(.*?)href="(.*?)"(.*?)>/g,(i,m,f,h)=>f.match(o)?`<a${m}href="${f}"${h}>`:`<a${m}href="${f}" target="_blank"${h}>`),e},copyCommentLink(e){this.$emit("copyLink",e),this.$refs.comment_actions.hide()},reportComment(e){this.$refs.comment_actions.hide(),this.$eventBus.emit("showReportContentModal",{reportConfig:e,type:"comment"})},checkOverflow(){var t,s;if(this.expanded)return;const e=(s=(t=this.$refs.commentBody)==null?void 0:t.$refs)==null?void 0:s.content;e&&(this.canExpand=e.scrollHeight>e.clientHeight+1)},toggleExpand(){this.expanded=!this.expanded},reportUpdated(e){var t;e.status=="unpublished"?this.$emit("deleted"):(this.comment.status=e.status,this.comment.meta&&(this.comment.meta.reports_count=((t=e.meta)==null?void 0:t.reports_count)||0),this.$emit("updated"))}}},Eu={key:1,class:"person_avatar"},Uu={class:"comment_wrap"},Au={key:0,class:"comment_text"},Bu={key:0,class:"comment_text_head"},Du={class:"comment_text_head_name"},Ru=["title"],xu={key:0,class:"comment_text_head_status"},Hu={class:"comment_actions"},Ou={key:2,class:"comment_text_media"},ju={key:3,class:"comment_text_media"};function Nu(e,t,s,u,o,i){const m=p("ReportReview"),f=p("UserAvatar"),h=p("UserRouteLink"),g=Ee,w=p("StickyIcon"),b=j,S=H,k=p("MoreFilled"),$=p("ActionPopover"),v=p("FeedMdContent"),C=p("MediaPreview"),L=p("ImageCarousel"),M=p("feed-text-composer"),E=te("loading");return n(),c(F,null,[i.showReport?(n(),y(m,{key:0,feed:i.getReportComment,type:"comment",onUpdated:i.reportUpdated},null,8,["feed","onUpdated"])):_("",!0),s.show_header&&s.comment.xprofile?(n(),c("div",Eu,[a(f,{with_level:!1,xprofile:s.comment.xprofile,is_rounded:!0},null,8,["xprofile"])])):_("",!0),W((n(),c("div",Uu,[o.isEdit?(n(),c("div",{key:1,onKeydown:t[4]||(t[4]=oe((...T)=>i.maybeSave&&i.maybeSave(...T),["enter"])),class:"comment_text"},[a(M,{context:"comment",config:{multipleMedia:!0},placeholder:e.$t("Write a comment"),content:o.editingComment,autofocus:!0,autofocus_changed:o.focusTrigger},{default:r(()=>[l("div",null,[a(S,{onClick:t[2]||(t[2]=T=>o.isEdit=!1),class:"fcom_secondary_button"},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1}),a(S,{class:"fcom_primary_button",onClick:t[3]||(t[3]=T=>i.updateComment(o.editingComment))},{default:r(()=>[V(d(e.$t("Update")),1)]),_:1})])]),_:1},8,["placeholder","content","autofocus_changed"])],32)):(n(),c("div",Au,[s.show_header?(n(),c("div",Bu,[l("div",Du,[a(h,{show_badge:!0,xprofile:s.comment.xprofile,show_follow:!0},null,8,["xprofile"]),l("div",{title:s.comment.created_at,class:"comment_text_head_time"},d(e.humanDateDiff(s.comment.created_at)),9,Ru),s.comment.status=="pending"?(n(),c("div",xu,[a(g,{type:"warning"},{default:r(()=>[V(d(e.$t("In Review")),1)]),_:1})])):_("",!0)]),l("div",Hu,[s.comment.is_sticky?(n(),y(S,{key:0,onClick:t[0]||(t[0]=T=>i.toggleSticky()),"aria-label":e.$t("Toggle Sticky"),class:"no_pad_btn",text:"",size:"small"},{default:r(()=>[a(b,{title:e.$t("Unpin from Top"),class:"fcom_sticky"},{default:r(()=>[a(w)]),_:1},8,["title"])]),_:1},8,["aria-label"])):_("",!0),a($,{ref:"comment_actions",items:i.commentActions,placement:"bottom",width:200},{trigger:r(()=>[a(S,{"aria-label":e.$t("View comment actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(b,null,{default:r(()=>[a(k)]),_:1})]),_:1},8,["aria-label"])]),_:1},8,["items"])])])):_("",!0),a(v,{ref:"commentBody",class_name:i.contentClass,content:i.renderedComment(s.comment.message_rendered)},null,8,["class_name","content"]),o.canExpand?(n(),c("button",{key:1,type:"button",class:"fcom_see_more_btn",onClick:t[1]||(t[1]=(...T)=>i.toggleExpand&&i.toggleExpand(...T))},d(o.expanded?e.$t("See less"):e.$t("See more")),1)):_("",!0),s.comment.meta.media_preview?(n(),c("div",Ou,[a(C,{media_item:s.comment.meta.media_preview},null,8,["media_item"])])):s.comment.meta.media_items?(n(),c("div",ju,[s.comment.meta.media_items?(n(),y(L,{key:0,feed:s.comment},null,8,["feed"])):_("",!0)])):_("",!0)])),Y(e.$slots,"after_comment_text")])),[[E,o.working]])],64)}const fo=I(Iu,[["render",Nu]]);function K(e){return window.fluentComAdmin.i18n[e]||e}const po={public:{label:K("Public"),description:K("__PUBLIC_SPACE_DESC"),space_description:K("__PIBLIC_SPACE_DESC_2")},private:{label:K("Private"),description:K("__PRIVATE_SPACE_DESC"),space_description:K("__PRIVATE_SPACE_DESC_2")},secret:{label:K("Secret"),description:K("Only invited members can view and post."),space_description:K("__SECRET_SPACE_DESC_2")}},zu={public:{label:K("Public"),description:K("Anyone can view and enroll the course for free")},private:{label:K("Private"),description:K("__PRIVATE_COURSE_DESC")},secret:{label:K("Secret"),description:K("Only invited students can view and enroll the course content.")}},qu={self_paced:{label:K("Self Paced"),description:K("__SELF_PAED_COURSE_DESC")},structured:{label:K("Structured"),description:K("__STRUCTURED_COURSE_DESC")},scheduled:{label:K("Scheduled"),description:K("Course starts on a specific date. Sections are dripped relative to that date.")}};K("Leaderboard Settings"),K("Settings for Leaderboard & Gamification features"),K("Get Leaderboard & Gamification Module"),K("Unlock potential by creating new feeds and earning points for likes. Advance in rank based on your total points using this module"),K("Emoji Module"),K("Settings for Emoji & Reaction features"),K("Get Emoji & Reaction Module"),K("Use emojis to add a personal touch and make your new article, post, or comment more expressive"),K("Giphy Module"),K("Customize Your Giphy Module Settings"),K("Get Giphy Module"),K("Want to use awesome GIFs? Upgrade to Pro plan now and enjoy surfing on FluentCommunity"),K("User Badge Module"),K("Add a badge next to user profile name to highlight valued users"),K("Get User Badge Module"),K("Show a customized badge on user profiles beside their names to easily recognize your admins or moderators, or to give appreciation to your power users."),K("Media Module"),K("Add a badge next to user profile name to highlight valued users"),K("Get Media Module"),K("Choose where to store your media files. Options include Local File System, Amazon S3, or Cloudflare R2 for storing and serving your media assets"),K("Progressive Web App (PWA)"),K("Let members install your community as an app on their phone"),K("Get Progressive Web App (PWA) Module"),K("Turn your community into an installable mobile app with your own name, icon and colors, plus an Install App option right in the portal menu.");const Be=e=>{e=parseInt(e);const t=Object.values(window.fluentComAdmin.leaderboard_levels);if(!e)return t[0];for(let s=0;s<t.length;s++)if(e>=t[s].min_points&&e<=t[s].max_points)return t[s];return t[t-1]},Gu={name:"SocialLinks",props:["xprofile","isOwn"],computed:{hasSocialLinks(){return this.socialLinks.length>0},socialLinks(){var u;if(!this.xprofile)return[];const e=[];this.xprofile.website&&e.push({title:this.$t("Website"),icon:'<svg viewBox="0 0 40 20" fill="currentColor"><path d="M3.8 10C3.8 6.58 6.58 3.8 10 3.8H18V0H10C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20H18V16.2H10C6.58 16.2 3.8 13.42 3.8 10ZM12 12H28V8H12V12ZM30 0H22V3.8H30C33.42 3.8 36.2 6.58 36.2 10C36.2 13.42 33.42 16.2 30 16.2H22V20H30C35.52 20 40 15.52 40 10C40 4.48 35.52 0 30 0Z"></path></svg>',url:this.xprofile.website});let t=this.xprofile.social_links;if(t||(t=(u=this.xprofile.meta)==null?void 0:u.social_links),cs(t))return e;const s=this.appVars.socialLinkProviders;return s&&this.each(s,(o,i)=>{t[i]&&e.push({title:o.title,icon:o.icon_svg,url:o.domain+t[i]})}),e}}},Yu={key:0,class:"fcom_social_links"},Wu=["href","title"];function Ku(e,t,s,u,o,i){const m=j,f=p("router-link");return i.hasSocialLinks?(n(),c("div",Yu,[(n(!0),c(F,null,x(i.socialLinks,h=>(n(),c("a",{rel:"noopener nofollow",target:"_blank",href:h.url,key:h.title,title:h.title},[a(m,{innerHTML:h.icon},null,8,["innerHTML"])],8,Wu))),128)),s.isOwn&&!i.hasSocialLinks?(n(),y(f,{key:0,to:{name:"update_profile",params:{username:s.xprofile.username}}},{default:r(()=>[V(d("+ "+e.$t("Add social links")),1)]),_:1},8,["to"])):_("",!0)])):_("",!0)}const Dt=I(Gu,[["render",Ku]]),Zu={name:"FollowAction",props:{profile:{type:Object,required:!0},followButtonText:{type:String,default:""}},emits:["refetch"],setup(){return{userStore:De()}},data(){return{loading:!1,hovering:!1}},watch:{profile:{immediate:!0,handler(e){e!=null&&e.user_id&&(e==null?void 0:e.follow)!==void 0&&this.userStore.setFollows({[e.user_id]:e.follow})}}},computed:{isFollowing(){var e;return(e=this.profile)!=null&&e.user_id?this.userStore.isFollowing(this.profile.user_id):!1},showFollowAction(){var s;const e=(s=this.profile)==null?void 0:s.user_id,t=this.auth.user_id;return this.hasFeature("followers_module")&&e&&t&&e!=t},isBlocked(){var e;return(e=this.profile)!=null&&e.user_id?this.userStore.isBlocked(this.profile.user_id):!1},followBtnText(){var e;return this.followButtonText?this.followButtonText:(e=this.profile)!=null&&e.is_follower?this.$t("Follow Back"):this.$t("Follow")}},methods:{confirmUnfollow(){this.unfollowUser()},async followUser(){this.loading=!0;try{const e=await this.userStore.toggleFollow(this.profile.user_id,this.profile.username);this.$notify.success((e==null?void 0:e.message)||this.$t("Successfully followed user")),this.$emit("refetch")}catch(e){this.$handleError(e)}finally{this.loading=!1}},async unfollowUser(){this.loading=!0;try{const e=await this.userStore.toggleFollow(this.profile.user_id,this.profile.username);this.$notify.success((e==null?void 0:e.message)||this.$t("Successfully unfollowed user")),this.$emit("refetch")}catch(e){this.$handleError(e)}finally{this.loading=!1}},unblockUser(){this.loading=!0,this.$post("profile/"+this.profile.username+"/unblock").then(e=>{this.userStore.removeFollow(this.profile.user_id),this.$notify.success(e.message)}).finally(()=>{this.loading=!1})}}},Ju={key:0},Qu={key:1},Xu={key:0},e_={key:1};function t_(e,t,s,u,o,i){const m=H;return i.showFollowAction?(n(),c(F,{key:0},[i.isBlocked?(n(),y(m,{key:0,class:"fcom_secondary_button danger_button",loading:o.loading,disabled:o.loading,style:{"min-width":"90px","max-height":"30px"},onClick:i.unblockUser,onMouseenter:t[0]||(t[0]=f=>o.hovering=!0),onMouseleave:t[1]||(t[1]=f=>o.hovering=!1)},{default:r(()=>[o.hovering?(n(),c("span",Qu,d(e.$t("Unblock")),1)):(n(),c("span",Ju,d(e.$t("Blocked")),1))]),_:1},8,["loading","disabled","onClick"])):i.isFollowing?(n(),y(m,{key:1,onClick:i.confirmUnfollow,class:R(["fcom_secondary_button",{danger_button:o.hovering}]),style:{"min-width":"95px","max-height":"30px"},loading:o.loading,disabled:o.loading,onMouseenter:t[2]||(t[2]=f=>o.hovering=!0),onMouseleave:t[3]||(t[3]=f=>o.hovering=!1)},{default:r(()=>[o.hovering?(n(),c("span",e_,d(e.$t("Unfollow")),1)):(n(),c("span",Xu,d(e.$t("Following")),1))]),_:1},8,["onClick","class","loading","disabled"])):(n(),y(m,{key:2,onClick:i.followUser,class:"fcom_color_button",style:{"max-height":"30px"},loading:o.loading,disabled:o.loading},{default:r(()=>[l("span",null,d(i.followBtnText),1)]),_:1},8,["onClick","loading","disabled"]))],64)):_("",!0)}const it=I(Zu,[["render",t_]]),s_={name:"UserRouteLink",props:{xprofile:{default:()=>({})},show_pop:{type:Boolean,default:!0},show_badge:{type:Boolean,default:!1},show_verified:{type:Boolean,default:!0},show_follow:{type:Boolean,default:!1},virtualRef:{default:null}},emits:["popover-mouseenter","popover-mouseleave"],components:{SocialLinks:Dt,FollowAction:it},data(){return{}},computed:{userLevel(){var e;return this.has_leaderboard&&((e=this.xprofile)!=null&&e.total_points)?Be(this.xprofile.total_points):null}},methods:{initShow(){document.addEventListener("scroll",this.onScroll,!0)},onHide(){document.removeEventListener("scroll",this.onScroll,!0)},onScroll(){var e,t;(t=(e=this.$refs.popoverRef)==null?void 0:e.hide)==null||t.call(e),this.virtualRef&&this.$eventBus.emit("hide_mention_popover")}},beforeUnmount(){document.removeEventListener("scroll",this.onScroll,!0)}},o_=["href"],i_={class:"fcom_user_display_name"},n_={key:1,class:"user_route"},l_=["href"],a_={class:"fcom_user_display_name"},r_={class:"fcom_profile_pop_avatar"},c_={key:0,class:"fcom_prfile_tagline"},d_={class:"fcom_level_name"},u_={style:{display:"block"},class:"fcoml_level_sub meta_line"},__={class:"fcom_profile_pop_info"},m_={class:"pop_info_header"},h_={class:"header_name"},f_=["href"],p_={class:"fcom_user_display_name"},g_={class:"fcom_user_name"},y_={key:0,class:"header_actions"},v_={key:0,class:"fcom_profile_pop_bio"},b_=["title"],k_=["title"],w_={class:"pop_info_btns"},C_=["href"],$_=["href"];function S_(e,t,s,u,o,i){const m=p("verified-sign"),f=p("UserBadge"),h=p("UserAvatar"),g=ht,w=p("follow-action"),b=p("SocialLinks"),S=ft,k=ye;return s.show_pop?(n(),c("span",n_,[a(k,{ref:"popoverRef",visible:s.virtualRef?!0:null,"virtual-ref":s.virtualRef,"virtual-triggering":!!s.virtualRef,width:500,"show-after":s.virtualRef?0:500,trigger:s.virtualRef?null:"hover",onShow:i.initShow,onHide:i.onHide,persistent:!1,"popper-class":"fcom_profile_popper",placement:"top","popper-style":"padding: 0;"},{reference:r(()=>[Y(e.$slots,"default",{},()=>[l("a",{href:e.$getRouteLink("u/:username",{username:s.xprofile.username}),class:"user_route"},[l("p",a_,d(s.xprofile.display_name),1)],8,l_)])]),default:r(()=>[l("div",{class:"fcom_profile_pop",onMouseenter:t[0]||(t[0]=$=>s.virtualRef&&e.$emit("popover-mouseenter")),onMouseleave:t[1]||(t[1]=$=>s.virtualRef&&e.$emit("popover-mouseleave"))},[s.xprofile&&s.xprofile.username?(n(),y(S,{key:0,gutter:20},{default:r(()=>[a(g,{sm:24,md:8},{default:r(()=>[l("div",r_,[a(h,{xprofile:s.xprofile},null,8,["xprofile"]),i.userLevel?(n(),c("div",c_,[l("div",d_,d(i.userLevel.title),1),l("div",u_,d(i.userLevel.tagline),1)])):_("",!0)])]),_:1}),a(g,{sm:24,md:16},{default:r(()=>{var $,v;return[l("div",__,[l("div",m_,[l("div",h_,[l("a",{href:e.$getRouteLink("u/:username",{username:s.xprofile.username}),class:"user_route"},[l("p",p_,d(s.xprofile.display_name),1),s.xprofile.is_verified?(n(),y(m,{key:0})):_("",!0),s.show_badge?(n(),y(f,{key:1,profile:s.xprofile},null,8,["profile"])):_("",!0)],8,f_),l("span",g_," @"+d(s.xprofile.username),1)]),s.show_follow?(n(),c("div",y_,[a(w,{profile:s.xprofile},null,8,["profile"])])):_("",!0)]),($=s.xprofile.meta)!=null&&$.short_description_rendered||s.xprofile.short_description_rendered?(n(),c("div",v_,d(e.getExcerpt(((v=s.xprofile.meta)==null?void 0:v.short_description_rendered)||s.xprofile.short_description_rendered,160)),1)):_("",!0),s.xprofile.created_at?(n(),c("div",{key:1,title:s.xprofile.created_at,class:"meta_line"},d(e.$t("Joined: %s",e.humanDateDiff(s.xprofile.created_at))),9,b_)):_("",!0),s.xprofile.last_activity?(n(),c("div",{key:2,title:s.xprofile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(s.xprofile.last_activity))),9,k_)):_("",!0),l("div",w_,[l("a",{class:"el-button el-button--primary is-text is-has-bg",href:e.$getRouteLink("u/:username",{username:s.xprofile.username})},d(e.$t("View Profile")),9,C_),e.appVars.has_chat&&e.hasPermission("can_initiate_message")?(n(),c("a",{key:0,class:"el-button el-button--primary is-text is-has-bg",href:e.$getRouteLink("chat/?user_id=:user_id",{user_id:s.xprofile.user_id})},d(e.$t("Message")),9,$_)):_("",!0)]),a(b,{style:{"justify-content":"left"},xprofile:s.xprofile,isOwn:!1},null,8,["xprofile"])])]}),_:1})]),_:1})):_("",!0)],32)]),_:3},8,["visible","virtual-ref","virtual-triggering","show-after","trigger","onShow","onHide"]),s.show_verified&&s.xprofile.is_verified?(n(),y(m,{key:0})):_("",!0),s.show_badge?(n(),y(f,{key:1,profile:s.xprofile},null,8,["profile"])):_("",!0)])):(n(),c("a",{key:0,href:e.$getRouteLink("u/:username",{username:s.xprofile.username}),class:"user_route"},[Y(e.$slots,"default",{},()=>[l("p",i_,d(s.xprofile.display_name),1)]),s.show_verified&&s.xprofile.is_verified?(n(),y(m,{key:0})):_("",!0),s.show_badge?(n(),y(f,{key:1,profile:s.xprofile},null,8,["profile"])):_("",!0)],8,o_))}const Pe=I(s_,[["render",S_]]),V_={name:"CommentReacts",components:{UserRouteLink:Pe},data(){return{centerDialogVisible:!1,reactions:null,loading:!1}},props:{comment:{required:!0,default:null}},methods:{getReactions(){this.reactions&&this.reactions.length===this.comment.reactions_count||(this.loading=!0,this.$get("comments/"+this.comment.id+"/reactions").then(e=>{this.reactions=e.reactions,e.current_user_follows&&this.setFollowIds(e.current_user_follows)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1}))}}},M_={style:{"margin-left":"5px"}},L_={key:0},T_={key:1},F_={class:"fcom_user_lists"},P_={key:2};function I_(e,t,s,u,o,i){const m=Z,f=p("UserAvatar"),h=p("UserRouteLink"),g=ke,w=ye;return n(),y(w,{persistent:!1,placement:"bottom",title:e.$t("Likes"),width:210,trigger:"click",teleported:!1,"popper-class":"fcom_menu_below_nav",onShow:i.getReactions},{reference:r(()=>[l("span",M_,d(s.comment.reactions_count),1)]),default:r(()=>[o.loading?(n(),c("div",L_,[a(m,{animated:!0,rows:1})])):o.reactions?(n(),c("div",T_,[a(g,{"max-height":"300px"},{default:r(()=>[l("ul",F_,[(n(!0),c(F,null,x(o.reactions,b=>(n(),c("li",null,[b.xprofile?(n(),c(F,{key:0},[a(f,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"]),a(h,{show_badge:!0,xprofile:b.xprofile,show_follow:!0},null,8,["xprofile"])],64)):_("",!0)]))),256))])]),_:1})])):(n(),c("div",P_,[l("p",null,d(e.$t("Failed to load the list")),1)]))]),_:1},8,["title","onShow"])}const E_=I(V_,[["render",I_]]),U_={name:"NestedReplyBox",mixins:[Bt],components:{SingleComment:fo,FeedTextComposer:pt,CommentReactions:E_,HeartIcon:st},props:["comment","feed","checkPermission","show_reacts_only","defaultMentions","is_modal"],emits:["commented","copyLink"],data(){return{open:!1,composerOpen:!1,replyingToId:null,autofocusInput:!1,focusTick:0,composerKey:0,commentReply:{message:"",media_images:[]},submitting:!1}},computed:{canComment(){return this.hasCommentPermission(this.feed)||!this.checkPermission}},methods:{maybeSave(e){(e.metaKey||e.ctrlKey)&&e.keyCode===13&&this.addComment()},addComment(){var t,s,u;const e=((t=this.commentReply.media_images)==null?void 0:t.length)>0||((u=(s=this.commentReply.meta)==null?void 0:s.media_preview)==null?void 0:u.image);!this.commentReply.message&&!e||!this.comment.id||(this.submitting=!0,this.$post("feeds/"+this.feed.id+"/comments",{comment:this.commentReply.message,parent_id:this.comment.id,media_images:this.commentReply.media_images,meta:this.commentReply.meta}).then(o=>{var i;this.comment.comments||(this.comment.comments=[]),this.commentReply={message:"",media_images:[]},(i=this.$refs.composer)==null||i.clearContent(),this.comment.comments.push(o.comment),Array.isArray(this.feed.comments)&&this.feed.comments.push(o.comment),this.$emit("commented",o.comment),this.$eventBus.emit("recent_activities_refresh"),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.$nextTick(()=>{this.scrollCommentIntoView(o.comment.id,this.comment.id)})}).catch(o=>{this.$handleError(o)}).finally(()=>{this.submitting=!1}))},toggleCommentBox(e,t=!0){var m;if(!this.hasCommentPermission(this.feed)){this.$notify({message:this.$t("Please join the Space to post a comment."),type:"warning"});return}const s=e==null?void 0:e.id,u=(m=e==null?void 0:e.xprofile)==null?void 0:m.username,o=t&&u&&e.user_id!=this.auth.user_id?u:"";if(!t){this.open=this.composerOpen=!this.open,this.replyingToId=null,this.autofocusInput=!1;return}if(this.composerOpen&&this.replyingToId===s){this.composerOpen=!1;return}const i=this.composerOpen;this.replyingToId=s,this.open=this.composerOpen=this.autofocusInput=!0,this.isComposerEmpty()?(this.commentReply.message=o?`@${o} `:"",i&&this.composerKey++):this.focusTick++},isComposerEmpty(){return!(this.commentReply.message||"").replace(/&#x20;|\u00A0/gi,"").trim()},handleCommentDelete(e){const t=this.comment.comments[e];this.comment.comments.splice(e,1),t!=null&&t.id&&Array.isArray(this.feed.comments)&&(this.feed.comments=this.feed.comments.filter(s=>s.id!==t.id)),this.feed.comments_count--},toggleLike(e){let t=!e.liked;this.$post("feeds/"+this.feed.id+"/comments/"+e.id+"/reactions",{state:t?1:0}).then(s=>{e.liked=s.liked,e.reactions_count=s.reactions_count}).catch(s=>{this.$handleError(s)})},emitCopyLink(e){this.$emit("copyLink",e)}}},A_={key:0,class:"reply_box"},B_=["aria-expanded"],D_={class:"fcom_comments_react fcom_reaction_list"},R_={class:"child_comments"},x_=["id"],H_={key:0,class:"reply_box"},O_=["onClick","aria-expanded"],j_={class:"fcom_comments_react fcom_reaction_list"},N_={key:0,class:"child_reply_wrap"},z_={class:"feed_commenting"},q_={class:"person_avatar"},G_=["alt","src"];function Y_(e,t,s,u,o,i){var S;const m=p("HeartIcon"),f=j,h=p("CommentReactions"),g=p("single-comment"),w=H,b=p("feed-text-composer");return n(),c(F,null,[i.canComment?(n(),c("div",A_,[((S=s.feed.meta)==null?void 0:S.comments_disabled)!=="yes"?(n(),c("button",{key:0,type:"button",onClick:t[0]||(t[0]=k=>i.toggleCommentBox(s.comment)),class:"reply_btn","aria-expanded":o.composerOpen&&o.replyingToId===s.comment.id},d(e.$t("Reply")),9,B_)):_("",!0),l("span",{class:R([{fcom_is_liked:s.comment.liked},"reply_btn"])},[l("div",D_,[a(f,{role:"button",tabindex:"0","aria-label":e.$t("React"),"aria-pressed":!!s.comment.liked,class:R({user_reacted:s.comment.liked}),onClick:t[1]||(t[1]=k=>i.toggleLike(s.comment)),onKeydown:[t[2]||(t[2]=oe(z(k=>i.toggleLike(s.comment),["prevent"]),["enter"])),t[3]||(t[3]=oe(z(k=>i.toggleLike(s.comment),["prevent"]),["space"]))]},{default:r(()=>[a(m,{filled:s.comment.liked},null,8,["filled"])]),_:1},8,["aria-label","aria-pressed","class"]),parseInt(s.comment.reactions_count)?(n(),y(h,{key:0,comment:s.comment},null,8,["comment"])):_("",!0)])],2),Y(e.$slots,"after_reply_box_text",{toggleOpen:()=>i.toggleCommentBox(s.comment,!1),open:o.open})])):_("",!0),!s.show_reacts_only||o.open?(n(),c(F,{key:1},[l("div",R_,[(n(!0),c(F,null,x(s.comment.comments,(k,$)=>(n(),c("div",{id:"comment_"+k.id,class:"each_comment"},[a(g,{onCopyLink:i.emitCopyLink,onDeleted:v=>i.handleCommentDelete($),comment:k,show_report:!0},{after_comment_text:r(()=>{var v;return[i.canComment?(n(),c("div",H_,[((v=s.feed.meta)==null?void 0:v.comments_disabled)!=="yes"?(n(),c("button",{key:0,type:"button",onClick:C=>i.toggleCommentBox(k),class:"reply_btn","aria-expanded":o.composerOpen&&o.replyingToId===k.id},d(e.$t("Reply")),9,O_)):_("",!0),l("span",{class:R([{fcom_is_liked:k.liked},"reply_btn"])},[l("div",j_,[a(f,{role:"button",tabindex:"0","aria-label":e.$t("React"),"aria-pressed":!!k.liked,class:R({user_reacted:k.liked}),onClick:C=>i.toggleLike(k),onKeydown:[oe(z(C=>i.toggleLike(k),["prevent"]),["enter"]),oe(z(C=>i.toggleLike(k),["prevent"]),["space"])]},{default:r(()=>[a(m,{filled:k.liked},null,8,["filled"])]),_:2},1032,["aria-label","aria-pressed","class","onClick","onKeydown"]),parseInt(k.reactions_count)?(n(),y(h,{key:0,comment:k},null,8,["comment"])):_("",!0)])],2)])):_("",!0)]}),_:2},1032,["onCopyLink","onDeleted","comment"])],8,x_))),256))]),o.composerOpen?(n(),c("div",N_,[l("div",z_,[l("div",q_,[l("img",{alt:e.$t("Your Photo"),src:e.auth.avatar},null,8,G_)]),l("div",{onKeydown:t[5]||(t[5]=oe((...k)=>i.maybeSave&&i.maybeSave(...k),["enter"])),class:"feed_comment_input comment_text"},[(n(),y(b,{ref:"composer",key:o.composerKey,config:{multipleMedia:!0},context:"comment",is_modal:s.is_modal,defaultMentions:s.defaultMentions?s.defaultMentions:[],disabled:o.submitting,autofocus:o.autofocusInput,autofocus_changed:o.focusTick,mentionQuery:{space_id:s.feed.space_id},content:o.commentReply,placeholder:e.$t("Leave a reply")},{default:r(()=>[a(w,{loading:o.submitting,disabled:o.submitting,onClick:t[4]||(t[4]=k=>i.addComment()),class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Reply")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["is_modal","defaultMentions","disabled","autofocus","autofocus_changed","mentionQuery","content","placeholder"]))],32)])])):_("",!0)],64)):_("",!0)],64)}const W_=I(U_,[["render",Y_]]),K_={name:"FeedComments",components:{SingleComment:fo,NestedReplyBox:W_},props:["feed","show_all","checkPermission","defaultMentions","sortBy","is_single","is_modal"],emits:["forceShowAll"],created(){this._lastSortBy=null,this._sortedTopLevelIds=null},data(){return{loading:!1}},computed:{_displayData(){const e=this.feed.comments;if(!e||!e.length)return{list:[],lastComment:null};const t={},s=[],u={};let o=null;for(let h=0;h<e.length;h++){const g=e[h];!o&&g.is_sticky&&(o=g),g.parent_id?(t[g.parent_id]||(t[g.parent_id]=[]),t[g.parent_id].push(g)):(s.push(g.id),u[g.id]=g)}for(const h of s)u[h].comments=t[h]||void 0;if(o&&u[o.id]){o=u[o.id];const h=s.indexOf(o.id);h!==-1&&s.splice(h,1),delete u[o.id]}const i=o||(s.length?u[s[s.length-1]]:null);if(!s.length&&!o)return{list:[],lastComment:null};const m=this.sortBy;if(this._lastSortBy!==m){let h=[...s];m==="oldest"||!m?h.sort((g,w)=>g-w):m==="latest"?h.sort((g,w)=>w-g):m==="popular"?h.sort((g,w)=>{var b,S;return(((b=u[w])==null?void 0:b.reactions_count)||0)-(((S=u[g])==null?void 0:S.reactions_count)||0)}):m==="most_replied"&&h.sort((g,w)=>{var b,S;return(((b=t[w])==null?void 0:b.length)||0)-(((S=t[g])==null?void 0:S.length)||0)}),this._sortedTopLevelIds=h,this._lastSortBy=m}let f;if(this._sortedTopLevelIds){const h=new Set(s),g=new Set(this._sortedTopLevelIds);f=this._sortedTopLevelIds.filter(w=>h.has(w)&&u[w]).map(w=>u[w]);for(let w=s.length-1;w>=0;w--)g.has(s[w])||f.unshift(u[s[w]])}else f=s.map(h=>u[h]);return o&&f.unshift(o),{list:f,lastComment:i}},displayComments(){return this._displayData.list},lastComment(){return this._displayData.lastComment}},methods:{fetchComments(){this.loading=!0,this.$get("feeds/"+this.feed.id+"/comments").then(e=>{this.feed.comments=e.comments}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},collectCommentIds(e){var u;const t=new Set([e.id]),s=e.comments?[...e.comments]:[];for(;s.length;){const o=s.pop();t.add(o.id),(u=o.comments)!=null&&u.length&&s.push(...o.comments)}return t},handleCommentDelete(e){const t=this.collectCommentIds(e);this.feed.comments=this.feed.comments.filter(s=>!t.has(s.id)),this.feed.comments_count-=t.size},handleStickyCommentDelete(){this.feed.sticky_comment=null,this.feed.comments_count--},copyCommentLink(e){let t={name:"single_feed",params:{feed_slug:this.feed.slug},query:{comment_id:e.id}};this.feed.course_id&&(t={name:"view_lesson",params:{lesson_slug:this.feed.slug},query:{comment_id:e.id}});let s=this.$router.resolve(t),u=this.appVars.urls.portal_base;u=u.replace(/\/$/,"");let o=u+s.fullPath;navigator.clipboard.writeText(o).then(()=>{this.$notify.success(this.$t("Link copied to clipboard"))}).catch(i=>{this.$notify.error(this.$t("Failed to copy the link"))})},maybeShowAllComments(){if(this.is_single||!this.hasFeature("show_post_modal")){this.$emit("forceShowAll");return}this.$eventBus.emit("showFeedModal",{feed:this.feed,view:"comments"})}},mounted(){!this.feed.comments&&this.feed.comments_count&&this.fetchComments()}},Z_={key:0,class:"feed_comments"},J_=["id"],Q_={key:1,class:"feed_comments"},X_=["id"],em=["onClick","aria-expanded"];function tm(e,t,s,u,o,i){const m=Z,f=p("nested-reply-box"),h=p("single-comment");return s.show_all?(n(),c("div",Z_,[o.loading?(n(),y(m,{key:0,row:5,class:"feed_comments_skeleton"})):(n(),c(F,{key:1},[Y(e.$slots,"before_comments_start"),(n(!0),c(F,null,x(i.displayComments,(g,w)=>(n(),c("div",{class:"each_comment",key:g.id,id:"comment_"+g.id},[a(h,{comment:g,space_id:s.feed.space_id,show_report:!0,onCopyLink:i.copyCommentLink,onReload:i.fetchComments,onDeleted:b=>i.handleCommentDelete(g)},ge({_:2},[g.parent_id?void 0:{name:"after_comment_text",fn:r(()=>[a(f,{feed:s.feed,comment:g,checkPermission:s.checkPermission,defaultMentions:s.defaultMentions?s.defaultMentions:[],is_modal:s.is_modal,onCopyLink:i.copyCommentLink},null,8,["feed","comment","checkPermission","defaultMentions","is_modal","onCopyLink"])]),key:"0"}]),1032,["comment","space_id","onCopyLink","onReload","onDeleted"])],8,J_))),128))],64))])):i.lastComment?(n(),c("div",Q_,[l("div",{class:"each_comment",id:"comment_"+i.lastComment.id},[a(h,{comment:i.lastComment,space_id:s.feed.space_id,show_report:!0,onCopyLink:i.copyCommentLink,onDeleted:t[0]||(t[0]=g=>i.handleCommentDelete(i.lastComment))},ge({_:2},[i.lastComment.parent_id?void 0:{name:"after_comment_text",fn:r(()=>[a(f,{defaultMentions:s.defaultMentions?s.defaultMentions:[],onCopyLink:i.copyCommentLink,show_reacts_only:!0,checkPermission:s.checkPermission,feed:s.feed,comment:i.lastComment,is_modal:s.is_modal},{after_reply_box_text:r(({toggleOpen:g,open:w})=>[i.lastComment.comments&&i.lastComment.comments.length?(n(),c("button",{key:0,type:"button",onClick:b=>g(),class:"reply_btn last_comment_reply_txt","aria-expanded":w},d(e.$_n("%d reply","%d replies",i.lastComment.comments.length)),9,em)):_("",!0)]),_:1},8,["defaultMentions","onCopyLink","checkPermission","feed","comment","is_modal"])]),key:"0"}]),1032,["comment","space_id","onCopyLink"])],8,X_),s.feed.comments_count>1?(n(),c("div",{key:0,onClick:t[1]||(t[1]=g=>i.maybeShowAllComments()),class:"each_comment show_all_comments"},d(e.$t("View more comments")),1)):_("",!0)])):_("",!0)}const go=I(K_,[["render",tm]]);const sm={name:"ReactedUsers",components:{UserRouteLink:Pe},data(){return{centerDialogVisible:!1,reactions:null,loading:!1}},props:{feed:{type:Object,required:!0,default:()=>({})}},computed:{reactedProfiles(){let e=[],t=this.auth.user_id;return this.feed.has_user_react&&e.push({user_id:t,avatar:this.auth.avatar}),this.each(this.feed.reactions,s=>{s.user_id!=t&&s.xprofile&&e.push({user_id:s.user_id,avatar:s.xprofile.avatar})}),e.slice(0,3)}},methods:{getReactions(){this.reactions&&this.reactions.length===this.feed.reactions_count||(this.loading=!0,this.$get("feeds/"+this.feed.id+"/reactions").then(e=>{this.reactions=e.reactions,e.current_user_follows&&this.setFollowIds(e.current_user_follows),this.$nextTick(()=>{var t,s,u,o;(o=(u=(s=(t=this.$refs.reactedPopover)==null?void 0:t.popperRef)==null?void 0:s.popperInstanceRef)==null?void 0:u.update)==null||o.call(u)})}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1}))}}},om=["title"],im={key:0,class:"reactions_avatars"},nm=["alt","src"],lm={key:0},am={key:1},rm={class:"fcom_user_lists"},cm={key:2};function dm(e,t,s,u,o,i){const m=Z,f=p("UserAvatar"),h=p("UserRouteLink"),g=ke,w=ye;return n(),y(w,{ref:"reactedPopover",persistent:!1,"popper-class":"fcom_feed_reacted_user_list",placement:"bottom",title:e.$t("Likes"),width:210,trigger:"click",onShow:i.getReactions},{reference:r(()=>[l("div",{title:e.$t("Click to view"),class:"fcom_reactions"},[i.reactedProfiles&&i.reactedProfiles.length?(n(),c("div",im,[(n(!0),c(F,null,x(i.reactedProfiles,b=>(n(),c("span",{key:b.id,class:"fcom_reaction_avatar fcom_avatar_is_rounded fcom_user_avatar"},[b!=null&&b.avatar?(n(),c("img",{key:0,alt:e.$t("Reacted Users"),src:b.avatar},null,8,nm)):_("",!0)]))),128))])):_("",!0),l("span",null,d(e.$_n("%s like","%s likes",s.feed.reactions_count)),1)],8,om)]),default:r(()=>[o.loading?(n(),c("div",lm,[a(m,{animated:!0,rows:3})])):o.reactions?(n(),c("div",am,[a(g,{"max-height":"300px"},{default:r(()=>[l("ul",rm,[(n(!0),c(F,null,x(o.reactions,b=>(n(),c("li",null,[b.xprofile?(n(),c(F,{key:0},[a(f,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"]),a(h,{show_badge:!0,xprofile:b.xprofile,show_follow:!0},null,8,["xprofile"])],64)):_("",!0)]))),256))])]),_:1})])):(n(),c("div",cm,[l("p",null,d(e.$t("Failed to load the list")),1)]))]),_:1},8,["title","onShow"])}const um=I(sm,[["render",dm]]),_m={name:"FeedFooter",mixins:[Bt],components:{ReactedUsers:um,FeedComments:go,FeedTextComposer:pt,ChatIcon:tt,HeartIcon:st},props:["feed","is_single","space_slug","is_modal"],emits:["commented","joinSpace"],data(){return{commenting:!1,comment:{message:"",media_images:[]},saving:!1,show_all_comments:this.is_single,reactions:[],isAutoFocus:!1,showCommentBox:!0,defaultMentions:[],sortBy:"oldest"}},methods:{maybeSave(e){(e.metaKey||e.ctrlKey)&&e.keyCode===13&&this.postComment()},postComment(){this.saving=!0,this.$post("feeds/"+this.feed.id+"/comments",{comment:this.comment.message,media_images:this.comment.media_images,meta:this.comment.meta}).then(e=>{var t;this.feed.comments||(this.feed.comments=[]),this.feed.comments.push(e.comment),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.comment={message:"",media_images:[]},this.commenting=!1,(t=this.$refs.composer)==null||t.clearContent(),this.$notify.success(e.message),this.$nextTick(()=>{this.$emit("commented",e.comment),this.scrollCommentIntoView(e.comment.id)})}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})},showCommentForm(){if(!this.is_single&&this.hasFeature("show_post_modal")){this.feed.auto_focus_comment=!0,this.$eventBus.emit("showFeedModal",{feed:this.feed,view:"comments",auto_focus_comment:!0});return}this.show_all_comments=!0,this.commenting?(this.commenting=!1,setTimeout(()=>{this.commenting=!0,this.isAutoFocus=!0},100)):(this.commenting=!0,this.isAutoFocus=!0),this.prepareDefaultMentions()},showAll(){this.show_all_comments=!this.show_all_comments,this.commenting=!this.commenting,this.isAutoFocus=!1,this.prepareDefaultMentions()},maybeShowFeedModal(){if(this.is_single){this.showAll();return}if(!this.hasFeature("show_post_modal")){this.showAll();return}this.feed.auto_focus_comment=!1,this.$eventBus.emit("showFeedModal",{feed:this.feed,view:"comments",auto_focus_comment:!1})},toggleReact(){const e={react_type:"like"};this.feed.has_user_react&&(e.remove=!0);let t=!this.feed.has_user_react;this.$post("feeds/"+this.feed.id+"/react",e).then(s=>{this.feed.has_user_react=t,this.feed.reactions_count=s.new_count}).catch(s=>{this.$handleError(s)})},prepareDefaultMentions(){if(!this.auth.user_id||this.defaultMentions.length)return;let e=this.auth.user_id,t=[];this.feed.user_id!=e&&t.push(this.feed.xprofile);let s=this.feed.comments.slice(-30);this.each(s,u=>{u.user_id!=e&&t.push(u.xprofile)}),this.defaultMentions=ln(t,"user_id")},changeCommentsSortBy(){this.$storeLocalData("comments_sort_by",this.sortBy)}},mounted(){let e=this.feed.default_comment_sort_by||"oldest";this.sortBy=this.$getLocalData("comments_sort_by",e),this.is_single&&this.prepareDefaultMentions(),this.feed.auto_focus_comment&&setTimeout(()=>{this.commenting=!0,this.isAutoFocus=!0},100)}},mm={ref:"feed_footer",class:"feed_footer"},hm={class:"fcom_feed_footer_actions"},fm=["aria-label","aria-pressed"],pm={class:"fcom_sr_only"},gm={class:"fcom_sr_only"},ym={class:"fcom_feed_footer_meta"},vm={key:0},bm={key:0,class:"fcom_reactions_count feed_reaction_meta"},km={class:"feed_comment_count"},wm={key:2,class:"feed_reaction_meta"},Cm={key:0,ref:"fcom_comment_sorting",class:"fcom_comment_sorting"},$m=["id"],Sm={key:0,style:{padding:"0",margin:"0","text-align":"center"}},Vm={key:1,class:"feed_commenting"},Mm={class:"person_avatar"},Lm=["src"],Tm={key:2,class:""},Fm={style:{padding:"0",margin:"0","text-align":"center"}},Pm={key:0,style:{margin:"10px 0"}},Im=["href"];function Em(e,t,s,u,o,i){var v,C,L,M;const m=p("HeartIcon"),f=j,h=p("ChatIcon"),g=p("ReactedUsers"),w=ne,b=le,S=p("feed-comments"),k=H,$=p("feed-text-composer");return n(),c(F,null,[l("div",mm,[l("div",hm,[l("ul",null,[l("li",{class:R(["fcom_reaction fcom_reaction_list",{react_active:s.feed.has_user_react}]),role:"button",tabindex:"0","aria-label":e.$t("React"),"aria-pressed":!!s.feed.has_user_react,onClick:t[0]||(t[0]=E=>i.toggleReact()),onKeydown:[t[1]||(t[1]=oe(z(E=>i.toggleReact(),["prevent"]),["enter"])),t[2]||(t[2]=oe(z(E=>i.toggleReact(),["prevent"]),["space"]))]},[a(f,{class:R({user_reacted:s.feed.has_user_react})},{default:r(()=>[a(m,{filled:s.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",null,[l("span",pm,d(e.$t("React")),1)])],42,fm),((v=s.feed.meta)==null?void 0:v.comments_disabled)!=="yes"?(n(),c("li",{key:0,class:"fcom_comment_btn_wrap",role:"button",tabindex:"0",onClick:t[3]||(t[3]=E=>i.showCommentForm()),onKeydown:[t[4]||(t[4]=oe(z(E=>i.showCommentForm(),["prevent"]),["enter"])),t[5]||(t[5]=oe(z(E=>i.showCommentForm(),["prevent"]),["space"]))]},[a(f,null,{default:r(()=>[a(h)]),_:1}),l("span",null,[l("span",gm,d(e.$t("Comment")),1)])],32)):_("",!0)])]),l("div",ym,[s.feed.reactions_count||s.feed.comments_count||((C=s.feed.meta)==null?void 0:C.comments_disabled)==="yes"?(n(),c("ul",vm,[s.feed.reactions_count?(n(),c("li",bm,[a(g,{feed:s.feed},null,8,["feed"])])):_("",!0),s.feed.comments_count>0?(n(),c("li",{key:1,onClick:t[6]||(t[6]=(...E)=>i.maybeShowFeedModal&&i.maybeShowFeedModal(...E)),class:"feed_reaction_meta"},[l("div",km,d(e.$_n("%d comment","%d comments",s.feed.comments_count)),1)])):((L=s.feed.meta)==null?void 0:L.comments_disabled)==="yes"?(n(),c("li",wm,d(e.$t("comments disabled")),1)):_("",!0)])):_("",!0)])],512),a(S,{sortBy:o.sortBy,defaultMentions:o.defaultMentions,onForceShowAll:i.showAll,show_all:o.show_all_comments,feed:s.feed,is_single:s.is_single,is_modal:s.is_modal},{before_comments_start:r(()=>[s.feed.comments_count>=2?(n(),c("div",Cm,[a(b,{"aria-label":e.$t("Sort comments by"),onChange:t[7]||(t[7]=E=>i.changeCommentsSortBy()),modelValue:o.sortBy,"onUpdate:modelValue":t[8]||(t[8]=E=>o.sortBy=E),class:"fcom_off_color fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Sort by")},{default:r(()=>[a(w,{value:"oldest",label:e.$t("Earliest")},null,8,["label"]),a(w,{value:"latest",label:e.$t("Latest")},null,8,["label"]),a(w,{value:"popular",label:e.$t("Popular")},null,8,["label"]),a(w,{value:"most_replied",label:e.$t("Most Replied")},null,8,["label"])]),_:1},8,["aria-label","modelValue","placeholder"])],512)):_("",!0)]),_:1},8,["sortBy","defaultMentions","onForceShowAll","show_all","feed","is_single","is_modal"]),o.commenting||s.is_single?(n(),c("div",{key:0,id:"feed_comment_form_"+s.feed.id,class:"feed_comment feed_commentbox_main"},[((M=s.feed.meta)==null?void 0:M.comments_disabled)==="yes"?(n(),c(F,{key:0},[s.feed.comments_count?(n(),c("p",Sm,d(e.$t("Comments are disabled for this post.")),1)):_("",!0)],64)):e.hasCommentPermission(s.feed)?(n(),c("div",Vm,[l("div",Mm,[l("img",{alt:"",src:e.auth.photo},null,8,Lm)]),o.showCommentBox?(n(),c("div",{key:0,onKeydown:t[10]||(t[10]=oe((...E)=>i.maybeSave&&i.maybeSave(...E),["enter"])),class:"feed_comment_input"},[a($,{ref:"composer",context:"comment",is_modal:s.is_modal,config:{multipleMedia:!0},mentionQuery:{space_id:s.feed.space_id},autofocus_changed:o.commenting,defaultMentions:o.defaultMentions,autofocus:o.isAutoFocus,disabled:o.saving,placeholder:e.$t("Write a comment"),content:o.comment},{default:r(()=>[a(k,{loading:o.saving,disabled:o.saving,class:"fcom_primary_button",onClick:t[9]||(t[9]=E=>i.postComment())},{default:r(()=>[V(d(e.$t("Post Comment")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["is_modal","mentionQuery","autofocus_changed","defaultMentions","autofocus","disabled","placeholder","content"])],32)):_("",!0)])):(n(),c("div",Tm,[l("p",Fm,[V(d(e.$t("Please join the Space to post a comment."))+" ",1),e.appVars.auth.user_id?(n(),c("div",Pm,[a(k,{class:"fcom_primary_button",onClick:t[11]||(t[11]=()=>{e.$emit("joinSpace")})},{default:r(()=>[V(d(e.$t("Join Space")),1)]),_:1})])):(n(),c("a",{key:1,href:e.getCurrentAuthUrl()},d(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,Im))])]))],8,$m)):_("",!0)],64)}const Um=I(_m,[["render",Em]]),Am={name:"SpaceIcon",props:["space_profile"]},Bm=["alt","src"],Dm={key:1,class:"fcom_emoji"},Rm={key:2,class:"fcom_shape"},xm={key:3,class:"fcom_no_avatar"};function Hm(e,t,s,u,o,i){var f,h,g,w;const m=j;return s.space_profile.logo?(n(),c("img",{key:0,alt:e.$t("Space Logo"),src:s.space_profile.logo},null,8,Bm)):(f=s.space_profile.settings)!=null&&f.emoji?(n(),c("span",Dm,d((h=s.space_profile.settings)==null?void 0:h.emoji),1)):(g=s.space_profile.settings)!=null&&g.shape_svg?(n(),c("span",Rm,[a(m,{innerHTML:(w=s.space_profile.settings)==null?void 0:w.shape_svg},null,8,["innerHTML"])])):(n(),c("span",xm))}const Ze=I(Am,[["render",Hm]]);const Om={name:"SingleLineTextarea",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},maxlength:{type:Number,default:500},isActive:{type:Boolean,default:!1}},emits:["update:modelValue","enter"],methods:{onInput(e){const t=e.target.value.replace(/\n/g,"");this.$emit("update:modelValue",t),this.$nextTick(this.adjustTextareaHeight)},adjustTextareaHeight(){const e=this.$refs.textarea;e.style.height="auto",e.style.height=e.scrollHeight+"px"}},mounted(){this.adjustTextareaHeight()},watch:{modelValue(){this.$nextTick(this.adjustTextareaHeight)},isActive(e){e&&setTimeout(()=>{this.$refs.textarea.focus()},100)}}},jm=["value","maxlength","placeholder"];function Nm(e,t,s,u,o,i){return n(),c("textarea",{value:s.modelValue,onInput:t[0]||(t[0]=(...m)=>i.onInput&&i.onInput(...m)),onKeydown:t[1]||(t[1]=oe(z(m=>e.$emit("enter"),["prevent"]),["enter"])),ref:"textarea",maxlength:s.maxlength,class:"fcom_status_title_input",rows:"1",placeholder:s.placeholder},null,40,jm)}const zm=I(Om,[["render",Nm]]),qm={name:"EyeIcon"},Gm={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ym=l("path",{d:"M17.9536 9.2035C18.207 9.55877 18.3337 9.7364 18.3337 9.99935C18.3337 10.2623 18.207 10.4399 17.9536 10.7952C16.8152 12.3915 13.908 15.8327 10.0003 15.8327C6.09264 15.8327 3.18541 12.3915 2.04703 10.7952C1.79367 10.4399 1.66699 10.2623 1.66699 9.99935C1.66699 9.7364 1.79367 9.55877 2.04703 9.2035C3.18541 7.60722 6.09264 4.16602 10.0003 4.16602C13.908 4.16602 16.8152 7.60722 17.9536 9.2035Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),Wm=l("path",{d:"M12.5 10C12.5 8.61929 11.3807 7.5 10 7.5C8.61929 7.5 7.5 8.61929 7.5 10C7.5 11.3807 8.61929 12.5 10 12.5C11.3807 12.5 12.5 11.3807 12.5 10Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),Km=[Ym,Wm];function Zm(e,t,s,u,o,i){return n(),c("svg",Gm,Km)}const Jm=I(qm,[["render",Zm]]),Qm={name:"CalendarIcon"},Xm={width:"14",height:"16",viewBox:"0 0 14 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},eh=Te('<path d="M11 1.3335V2.66683M3 1.3335V2.66683" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.99766 8.66699H7.00364M6.99766 11.3337H7.00364M9.66134 8.66699H9.66732M4.33398 8.66699H4.33997M4.33398 11.3337H4.33997" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.33398 5.3335H12.6673" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M0.666992 8.16216C0.666992 5.25729 0.666992 3.80486 1.50174 2.90243C2.33648 2 3.67999 2 6.36699 2H7.63366C10.3207 2 11.6642 2 12.4989 2.90243C13.3337 3.80486 13.3337 5.25729 13.3337 8.16216V8.5045C13.3337 11.4094 13.3337 12.8618 12.4989 13.7642C11.6642 14.6667 10.3207 14.6667 7.63366 14.6667H6.36699C3.67999 14.6667 2.33648 14.6667 1.50174 13.7642C0.666992 12.8618 0.666992 11.4094 0.666992 8.5045V8.16216Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1 5.3335H13" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path>',5),th=[eh];function sh(e,t,s,u,o,i){return n(),c("svg",Xm,th)}const yo=I(Qm,[["render",sh]]);const oh={name:"CreateStatusForm",emits:["updatePost","added"],props:{space:{type:String,default:""},btn_text:{type:String,default:"Post"},editing_feed:{type:Object,default:()=>({title:"",type:"text",message:"",media_image:"",topic_ids:[],send_announcement_email:"no",status:"published"})},defaultState:{type:String,default:"idle"},disableSpace:{type:Boolean,default:!1},default_placeholder:{type:String,default:""},initial_placeholder:{type:String,default:""},disableUpload:{type:Boolean,default:!1},saving:{type:Boolean,default:!1},author:{type:Object,default:()=>({})}},components:{SpaceIcon:Ze,FeedTextComposer:pt,SingleLineTextarea:zm,EyeIcon:Jm,CalendarIcon:yo},data(){return{feed:this.editing_feed,isAutoFocus:!1,state:this.defaultState,posting:!1,doingOembed:!1,oembed:null,postableSpaces:[],autofocus_changed:!1,globalDisabled:this.appVars.features.disable_global_posts,hasPostTitle:this.hasFeature("has_post_title"),scheduleModalVisible:!1,scheduleForm:{date:null,time:null},editorReady:!1}},watch:{"scheduleForm.date":{handler(e){this.scheduleForm.time=null}}},computed:{...ni(je,["spacesBySlug"]),allSpaces(){return this.space&&this.spacesBySlug[this.space]?{...this.appVars.auth.spaces,[this.space]:this.spacesBySlug[this.space]}:this.appVars.auth.spaces},isEditing(){var e;return(e=this.editing_feed)==null?void 0:e.id},isScheduleDisabled(){return!this.scheduleForm.date||!this.scheduleForm.time},showScheduleInfo(){return this.feed.scheduled_at&&!this.isEditing},showScheduleIcon(){return(this.isAdmin()||this.isCurrentSpaceAdmin)&&!this.isEditing&&this.has_pro},isDateDisabled(){return e=>e<new Date().setHours(0,0,0,0)},getPlaceholder(){const e=this.appVars.topicsConfig.max_topics_per_post;return this.isTopicRequired?this.$_n("Select a topic","Choose up to %s topics",e):this.$_n("Select a topic","Choose up to %s topics (optional)",e)},getButtonLabel(){return this.feed.scheduled_at&&!this.isEditing?this.$t("Schedule"):this.btn_text},getScheduleLabel(){return this.$t("Scheduled for %1$s at %2$s",this.formattedDate(this.feed.scheduled_at),this.formattedTime(this.feed.scheduled_at))},getStartTime(){if(!this.scheduleForm.date||!this.isToday(this.scheduleForm.date))return"00:00";const t=this.dayjs().add(30,"minute");if(!this.isToday(t.toDate()))return"23:50";const s=t.format("HH");let u=parseInt(t.format("mm"),10);return u=Math.ceil(u/10)*10,u===60?this.dayjs(t).add(1,"hour").format("HH")+":00":s+":"+(u<10?"0":"")+u},getPostTitle(){return this.isEditing?this.author.name||"":this.$t("Create Post")},canPost(){var e,t;return this.space?(t=(e=this.allSpaces[this.space])==null?void 0:e.permissions)==null?void 0:t.can_create_post:this.appVars.auth.user_id},isTopicRequired(){var e,t;return this.currentSpaceSlug?((t=(e=this.allSpaces[this.currentSpaceSlug])==null?void 0:e.settings)==null?void 0:t.topic_required)=="yes":!1},isStateActive(){return this.state=="active"},isCurrentSpaceAdmin(){var e,t;return this.currentSpaceSlug?(t=(e=this.allSpaces[this.currentSpaceSlug])==null?void 0:e.permissions)==null?void 0:t.community_moderator:!1},isCommunityAdmin(){return this.isAdmin()},currentPlaceHolder(){return this.isStateActive?this.default_placeholder?this.default_placeholder:this.$t("Write something here..."):this.initial_placeholder?this.initial_placeholder:this.$t("What's happening, %s",this.auth.first_name)},currentTopics(){var s;let e=this.currentSpaceSlug;if(!e)return[];let t=((s=this.allSpaces[e])==null?void 0:s.topics)||[];return t=Object.values(t),this.isModerator(e)?t:t.filter(u=>u.admin_only!="yes")},canUploadDoc(){var e,t;return this.currentSpaceSlug?(t=(e=this.allSpaces[this.currentSpaceSlug])==null?void 0:e.permissions)==null?void 0:t.can_upload_documents:!1},currentSpaceSlug(){if(this.space)return this.space;let e=this.feed.space;return e&&typeof e=="object"?e==null?void 0:e.slug:e},currentSpaceId(){var e;return this.currentSpaceSlug?(e=this.allSpaces[this.currentSpaceSlug])==null?void 0:e.id:null},feedContext(){const e=this.space||this.currentSpaceSlug;return e&&e!=="__self__post__"?`space-${e}`:"global"}},methods:{...Gs(Me,["createFeed"]),changeAutoFocus(){this.feed.title=this.feed.title.replace(/\n/g,""),this.updateAutofocus()},updateAutofocus(){this.autofocus_changed=!1,setTimeout(()=>{this.autofocus_changed=!0},100)},openScheduleModal(){this.scheduleModalVisible=!0},makeActive(){this.editorReady=!0,this.$nextTick(()=>{this.prepareData(),this.state="active",this.hasPostTitle||this.updateAutofocus()})},cancelPost(){this.state="idle",this.postableSpaces=[]},cancelSchedule(){this.scheduleModalVisible=!1,this.scheduleForm.date=null,this.scheduleForm.time=null,this.feed.scheduled_at=null},previewPost(){const e={...this.feed,space:this.space||this.feed.space,is_editing:this.isEditing,author:this.author};this.$eventBus.emit("showPreviewPostModal",e)},initFeed(){return{type:"text",message:"",media_image:"",topic_ids:[],scheduled_at:null,send_announcement_email:"no",status:"published"}},schedulePost(){if(this.scheduleModalVisible=!1,!this.scheduleForm.date||!this.scheduleForm.time){this.feed.scheduled_at=null;return}const e=this.convertTo24Hour(this.scheduleForm.time);this.feed.scheduled_at=`${this.scheduleForm.date} ${e}:00`},post(){if(!this.isStateActive)return;if(this.feed.id){this.$emit("updatePost",this.feed);return}const e=this.feed;if(this.space&&(e.space=this.space),!e.space){this.$refs.fcom_posting_space.classList.add("fcon_shake"),setTimeout(()=>{this.$refs.fcom_posting_space.classList.remove("fcon_shake")},500),this.$notify({title:this.$t("Error"),message:this.$t("Please select a space to post in."),type:"error"});return}if(e.space!="__self__post__"&&e.send_announcement_email=="yes"){let t=this.$t("Are you sure you want to send email to everyone? An automated email will be sent to all the members of the space after 5 minutes of this post");e.scheduled_at&&(t=this.$t("Are you sure you want to send email to everyone? An automated email will be sent to all the members of the space. The email will be sent at the scheduled time.")),this.$confirm(t,this.$t("Sending email to all members?"),{confirmButtonText:this.$t("Yes"),cancelButtonText:this.$t("No"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.postStatus(e)}).catch(()=>{this.feed.send_announcement_email="no",this.state="active",this.$notify({title:this.$t("Cancelled"),message:this.$t("You have cancelled the action."),type:"info"})})}else this.postStatus(e)},feedSpaceChanged(){this.$refs.fcom_posting_space_select.blur(),this.feed.topic_ids=""},goToCreatedFeed(e){if(!(e!=null&&e.slug))return;if(this.hasFeature("show_post_modal")){this.$eventBus.emit("showFeedModal",{feed:e});return}const t=e.space?{name:"space_feed",params:{feed_slug:e.slug,space:e.space.slug}}:{name:"single_feed",params:{feed_slug:e.slug}};this.$router.push(t)},async postStatus(e){var t,s;this.posting=!0;try{const o=await Me().createFeed(this.feedContext,e);if(o.scheduled_at||(this.$notify.success(o.message),this.$emit("added",o.feed),((t=o.feed)==null?void 0:t.status)==="unlisted"?this.goToCreatedFeed(o.feed):this.$nextTick(()=>{const i=document.getElementById("feed_id_"+o.feed.id);i&&(i.classList.add("fcom_highlight_glow"),setTimeout(()=>{i.classList.remove("fcom_highlight_glow")},4500))})),this.feed=this.initFeed(),this.state="idle",o.scheduled_at){const i=this.formattedDateTime(o.scheduled_at);this.$notify.success(this.$t("Your post has been scheduled for %s. Please find the scheduled post from your profile",i))}this.editorReady=!1}catch(u){this.$handleError(u),(s=u==null?void 0:u.shakes)!=null&&s.topic_ids&&(this.$refs.fcom_topics_input.classList.add("fcon_shake"),setTimeout(()=>{this.$refs.fcom_topics_input.classList.remove("fcon_shake")},500))}finally{this.posting=!1}},prepareData(){var m;if(this.space)return[];let e=Object.values(this.allSpaces),t=this.appVars.space_groups,s=[],u=[];this.each(t,f=>{let h=e.filter(g=>{let w=g.parent_id==f.id&&g.permissions&&g.permissions.can_create_post;return w&&u.push(g.slug),w});h.length&&s.push({label:f.title,spaces:h})});let o=e.filter(f=>!f.parent_id&&f.permissions&&f.permissions.can_create_post);o&&o.length&&s.push({label:this.$t("Others"),spaces:o}),this.globalDisabled||s.unshift({label:"",spaces:[{title:this.$t("On my profile"),slug:"__self__post__"}]}),this.postableSpaces=s;const i=this.appVars.default_post_space;!this.feed.space&&i&&["all_feeds","user_profile_feeds"].includes((m=this.$route)==null?void 0:m.name)&&this.postableSpaces.some(f=>f.spaces.some(h=>h.slug===i))&&(this.feed.space=i)}},mounted(){(this.editing_feed.id||this.defaultState=="active")&&(this.editorReady=!0)}},ih={class:"person_avatar"},nh=["alt","src"],lh={class:"create_header_content"},ah={key:0,class:"fcom_create_status_box_header"},rh={class:"user_infos"},ch={class:"feed_user_name"},dh={class:"feed_meta_info"},uh={key:1,class:"feed_timestamp"},_h={class:"create_header_action"},mh={key:0,ref:"fcom_topics_input",class:"fcom_topics_input"},hh={style:{margin:"0",display:"block",width:"100%",padding:"5px 0","font-weight":"500"}},fh={key:0,class:"fcom_meta_text"},ph={class:"fcom_post_actions"},gh={key:0,class:"fcom_post_space_name"},yh={class:"target_label"},vh={ref:"fcom_posting_space",style:{"margin-right":"10px"}},bh={key:0,class:"fcom_space_title"},kh={key:1},wh={class:"fcom_empty_spaces_dropdown"},Ch={key:0,class:"fcom_composer_admin_actions"},$h={key:0},Sh={class:"dialog_header"},Vh={class:"dialog_left schedule_header_left"},Mh={class:"dialog_body"},Lh={class:"fcom_input_help"},Th={class:"dialog_footer"};function Fh(e,t,s,u,o,i){const m=p("EditPen"),f=j,h=p("CalendarIcon"),g=H,w=p("EyeIcon"),b=p("Close"),S=p("SingleLineTextarea"),k=ne,$=le,v=p("SpaceIcon"),C=Ct,L=he,M=p("feed-text-composer"),E=Xe,T=ue,P=Hs,U=_e,D=be;return i.canPost?(n(),c("div",{key:0,class:R([{state_active:i.isStateActive},"create_status_holder"])},[l("div",{class:R(["create_header",{state_active:i.isStateActive}])},[l("div",ih,[l("img",{alt:s.author.name||e.$t("Your Photo"),src:s.author.avatar||e.auth.avatar},null,8,nh)]),l("div",lh,[i.isStateActive?_("",!0):(n(),c("div",{key:0,onClick:t[0]||(t[0]=(...A)=>i.makeActive&&i.makeActive(...A)),class:"form_placeholder"},d(i.currentPlaceHolder),1)),l("div",{class:R([{fcom_editor_with_title:o.hasPostTitle,"is-active":i.isStateActive},"fcom_create_status_box"])},[i.isStateActive?(n(),c("div",ah,[l("div",rh,[l("div",ch,d(i.getPostTitle),1),l("div",dh,[!s.editing_feed.id&&i.showScheduleInfo?(n(),c("div",{key:0,onClick:t[1]||(t[1]=(...A)=>i.openScheduleModal&&i.openScheduleModal(...A)),class:"feed_scheduled_info"},[l("span",null,d(i.getScheduleLabel),1),a(f,null,{default:r(()=>[a(m)]),_:1})])):(n(),c("span",uh,d(s.editing_feed.id?e.humanDateDiff(s.editing_feed.created_at):e.dayjs().format(e.siteDateTimeFormat)),1))])]),l("div",_h,[i.showScheduleIcon?(n(),y(g,{key:0,"aria-label":e.$t("Schedule post"),onClick:i.openScheduleModal,text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0),a(g,{"aria-label":e.$t("Preview"),onClick:i.previewPost,text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["aria-label","onClick"]),i.isEditing?_("",!0):(n(),y(g,{key:1,"aria-label":e.$t("Close"),class:"close_btn",onClick:i.cancelPost,text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["aria-label","onClick"]))])])):_("",!0),o.editorReady?(n(),y(M,{key:1,context:"feed",placeholder:i.currentPlaceHolder,config:{surveyApp:!0,space_id:i.currentSpaceId,is_admin:i.isCurrentSpaceAdmin||i.isCommunityAdmin,spaceSlug:i.currentSpaceSlug,disableUpload:s.disableUpload,multipleMedia:!0,documentsApp:i.canUploadDoc,videoApp:!0},autofocus:o.isAutoFocus||!o.hasPostTitle,onEditorCreated:t[9]||(t[9]=()=>{o.isAutoFocus=!0}),mentionQuery:i.currentSpaceSlug&&i.currentSpaceSlug!=="__self__post__"?{space:i.currentSpaceSlug}:{},disabled:o.posting,autofocus_changed:o.autofocus_changed,is_editing:!!i.isEditing,content:o.feed},{before_input:r(()=>[o.hasPostTitle?(n(),y(S,{key:0,maxlength:120,autofocus:!0,isActive:i.isStateActive,modelValue:o.feed.title,"onUpdate:modelValue":t[2]||(t[2]=A=>o.feed.title=A),onEnter:t[3]||(t[3]=A=>i.changeAutoFocus()),placeholder:o.hasPostTitle=="required"?e.$t("Short title of this post"):e.$t("Title (optional)")},null,8,["isActive","modelValue","placeholder"])):_("",!0)]),before_composer_footer:r(()=>[Y(e.$slots,"before_footer")]),after_input:r(()=>[e.has_pro&&i.currentTopics.length?(n(),c("div",mh,[a($,{"popper-class":"fcom_topics_select","multiple-limit":e.appVars.topicsConfig.max_topics_per_post,modelValue:o.feed.topic_ids,"onUpdate:modelValue":t[4]||(t[4]=A=>o.feed.topic_ids=A),multiple:e.appVars.topicsConfig.max_topics_per_post>1,placeholder:i.getPlaceholder},{default:r(()=>[(n(!0),c(F,null,x(i.currentTopics,A=>(n(),y(k,{key:A.slug,label:A.title,value:A.id},{default:r(()=>[l("span",hh,d(A.title),1),A.description?(n(),c("span",fh,d(A.description),1)):_("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["multiple-limit","modelValue","multiple","placeholder"])],512)):_("",!0)]),after_composer_footer:r(()=>[e.hasFeature("mention_mail")&&i.isCurrentSpaceAdmin&&o.feed.send_announcement_email?(n(),c("div",Ch,[a(L,{disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:o.feed.send_announcement_email,"onUpdate:modelValue":t[8]||(t[8]=A=>o.feed.send_announcement_email=A),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Send announcement email to space members"))+" ",1),e.has_pro?_("",!0):(n(),c("span",$h,"("+d(e.$t("Require Pro"))+")",1))]),_:1},8,["disabled","modelValue"])])):_("",!0)]),default:r(()=>[l("div",ph,[s.space&&i.isStateActive?(n(),c("div",gh,[l("span",null,"#"+d(s.space),1)])):_("",!0),!s.space&&!s.disableSpace?(n(),c(F,{key:1},[l("span",yh,d(e.$t("Posting in:")),1),l("span",vh,[a($,{modelValue:o.feed.space,"onUpdate:modelValue":t[5]||(t[5]=A=>o.feed.space=A),style:{width:"170px"},ref:"fcom_posting_space_select",class:"fcom_minimal_select","popper-class":"fcom_posting_space_select",placeholder:e.$t("Select Space"),onChange:t[6]||(t[6]=A=>i.feedSpaceChanged())},{empty:r(()=>[l("p",wh,d(Object.keys(i.allSpaces).length?e.$t("No spaces to post in"):e.$t("Join a space to post")),1)]),default:r(()=>[(n(!0),c(F,null,x(o.postableSpaces,A=>(n(),y(C,{key:A.label,label:A.label},{default:r(()=>[(n(!0),c(F,null,x(A.spaces,q=>(n(),y(k,{key:q.slug,label:q.title,value:q.slug},{default:r(()=>[q.id?(n(),c("span",bh,[a(v,{space_profile:q},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(q.title,30)),1)])):(n(),c("span",kh,d(e.getExcerpt(q.title,30)),1))]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","placeholder"])],512)],64)):_("",!0),Y(e.$slots,"before_submit_btn"),a(g,{onClick:t[7]||(t[7]=A=>i.post()),disabled:o.posting||i.isEditing&&s.saving,loading:i.isEditing?s.saving:o.posting,class:R(["fcom_primary_button",{fcom_update_button:i.isEditing}])},{default:r(()=>[V(d(i.getButtonLabel),1)]),_:1},8,["disabled","loading","class"])])]),_:3},8,["placeholder","config","autofocus","mentionQuery","disabled","autofocus_changed","is_editing","content"])):_("",!0),Y(e.$slots,"after_composer")],2)])],2),a(D,{modelValue:o.scheduleModalVisible,"onUpdate:modelValue":t[12]||(t[12]=A=>o.scheduleModalVisible=A),width:e.modalWidth,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1},{header:r(()=>[l("div",Sh,[l("div",Vh,[l("h4",null,d(e.$t("Schedule Post")),1),l("p",null,d(e.$t("Choose a date and time in the future when you want your post to be published")),1)])])]),footer:r(()=>[l("div",Th,[a(g,{class:"fcom_secondary_button",onClick:i.cancelSchedule},{default:r(()=>[V(d(e.$t("Remove Schedule")),1)]),_:1},8,["onClick"]),a(g,{class:"fcom_primary_button",disabled:i.isScheduleDisabled,onClick:i.schedulePost},{default:r(()=>[V(d(e.$t("Select Schedule")),1)]),_:1},8,["disabled","onClick"])])]),default:r(()=>[l("div",Mh,[a(U,{"label-position":"top",class:"fcom_schedule_form"},{default:r(()=>[a(T,{label:e.$t("Date")},{default:r(()=>[a(E,{modelValue:o.scheduleForm.date,"onUpdate:modelValue":t[10]||(t[10]=A=>o.scheduleForm.date=A),type:"date","value-format":"YYYY-MM-DD",format:e.siteDateFormat,placeholder:e.$t("Select Date"),"disabled-date":i.isDateDisabled},null,8,["modelValue","format","placeholder","disabled-date"])]),_:1},8,["label"]),a(T,{label:e.$t("Time")},{default:r(()=>[a(P,{modelValue:o.scheduleForm.time,"onUpdate:modelValue":t[11]||(t[11]=A=>o.scheduleForm.time=A),disabled:!o.scheduleForm.date,style:{width:"210px"},step:"00:10",format:e.siteTimeFormat,start:i.getStartTime,end:"23:59",placeholder:e.$t("Select Time")},null,8,["modelValue","disabled","format","start","placeholder"])]),_:1},8,["label"])]),_:1}),a(T,null,{default:r(()=>[l("p",Lh,d(e.$t("The date and time is based on your site's Timezone")),1)]),_:1})])]),_:1},8,["modelValue","width"])],2)):_("",!0)}const Rt=I(oh,[["render",Fh]]),Ph={name:"EditFeed",components:{SpaceIcon:Ze,CreateStatusForm:Rt},data(){return{loading:!1,saving:!1,localDialogVisible:this.dialogVisible,feed:{},autofocus_changed:!1,hasPostTitle:this.hasFeature("has_post_title"),changeSpace:!1,newSpaceId:null,makeUnlisted:!1}},props:{dialogVisible:{type:Boolean,required:!0},feedSlug:{type:String,required:!0},hide_create_form:{type:Boolean,default:!1},author:{type:Object,default:()=>({})}},computed:{canMovePost(){return this.has_pro&&this.hasSpaceModeratorAccess(this.feed.space)},profileOptionLabel(){return this.auth&&this.feed.user_id&&this.auth.user_id==this.feed.user_id?this.$t("On my profile"):this.$t("On author's profile")}},methods:{getFeed(){this.loading=!0,this.$get("feeds/"+this.feedSlug+"/by-slug",{context:"edit"}).then(e=>{this.feed=e.feed,this.makeUnlisted=e.feed.status==="unlisted"}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},handleUpdatePost(e){var s;let t={id:e.id,title:e.title,message:e.message,space:(s=e==null?void 0:e.space)==null?void 0:s.slug,meta:e.meta,content_type:e.content_type,document_ids:e.document_ids,media:e.media,media_images:e.media_images,survey:e.survey,topic_ids:e.topic_ids,send_announcement_email:e.send_announcement_email};this.changeSpace&&this.newSpaceId&&(this.newSpaceId==="profile"?t.move_to_profile=1:t.new_space_id=this.newSpaceId),["published","unlisted"].includes(this.feed.status)&&(t.status=this.makeUnlisted?"unlisted":"published"),this.saving=!0,this.$post(`feeds/${e.id}`,t).then(u=>{this.$notify.success(u.message),this.$emit("updated",u.feed),this.handleClose()}).catch(u=>{this.$handleError(u)}).finally(()=>{this.saving=!1})},handleClose(){this.localDialogVisible=!1,this.$emit("close")}},mounted(){this.getFeed()}},Ih={class:"fcom_feed_edit"},Eh={class:"fcom_feed_edit_dialog_header"},Uh={key:0,class:"fcom_feed_edit_dialog_body"},Ah={key:0},Bh={key:0,style:{"margin-top":"5px"}},Dh={class:"fcom_space_title"};function Rh(e,t,s,u,o,i){const m=p("Close"),f=j,h=he,g=ne,w=p("SpaceIcon"),b=le,S=Ue,k=p("create-status-form"),$=Z,v=be,C=te("loading");return n(),c("div",Ih,[a(v,{class:"fcom_feed_edit_dialog",modelValue:o.localDialogVisible,"onUpdate:modelValue":t[3]||(t[3]=L=>o.localDialogVisible=L),width:e.dialogWidth,"append-to-body":!0,overflow:"","before-close":()=>{},"show-close":!1},{default:r(()=>{var L,M;return[W((n(),c("div",null,[l("div",Eh,[l("span",null,d(e.$t("Edit Feed")),1),a(f,{onClick:i.handleClose},{default:r(()=>[a(m)]),_:1},8,["onClick"])]),o.feed.id?(n(),c("div",Uh,[!(s.hide_create_form&&e.auth.user_id)||e.canEditFeed(o.feed)?(n(),y(k,{key:0,"default-state":"active",btn_text:e.$t("Update"),editing_feed:o.feed,author:s.author,onUpdatePost:i.handleUpdatePost,saving:o.saving,disableSpace:!0,space:(M=(L=o.feed)==null?void 0:L.space)==null?void 0:M.slug},{after_composer:r(()=>[i.canMovePost?(n(),c("div",Ah,[a(h,{modelValue:o.changeSpace,"onUpdate:modelValue":t[0]||(t[0]=E=>o.changeSpace=E),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Move to a different space")),1)]),_:1},8,["modelValue"]),o.changeSpace?(n(),c("div",Bh,[a(b,{modelValue:o.newSpaceId,"onUpdate:modelValue":t[1]||(t[1]=E=>o.newSpaceId=E),placeholder:e.$t("Select destination"),style:{width:"100%"}},{default:r(()=>[a(g,{value:"profile",label:i.profileOptionLabel,disabled:!o.feed.space_id},{default:r(()=>[l("span",null,d(i.profileOptionLabel),1)]),_:1},8,["label","disabled"]),(n(!0),c(F,null,x(e.appVars.auth.spaces,E=>(n(),y(g,{disabled:o.feed.space_id==E.id,key:E.id,label:E.title,value:E.id},{default:r(()=>[l("span",Dh,[a(w,{space_profile:E},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(E.title,30)),1)])]),_:2},1032,["disabled","label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):_("",!0)])):_("",!0)]),before_submit_btn:r(()=>[e.has_pro&&e.isCommunityModerator()&&["published","unlisted"].includes(o.feed.status)?(n(),y(S,{key:0,content:e.$t("Hidden from all feeds and listings. Only reachable by its direct link."),placement:"top"},{default:r(()=>[a(h,{modelValue:o.makeUnlisted,"onUpdate:modelValue":t[2]||(t[2]=E=>o.makeUnlisted=E),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Make unlisted")),1)]),_:1},8,["modelValue"])]),_:1},8,["content"])):_("",!0)]),_:1},8,["btn_text","editing_feed","author","onUpdatePost","saving","space"])):_("",!0)])):(n(),y($,{key:1,rows:5,animated:!0}))])),[[C,o.loading]])]}),_:1},8,["modelValue","width"])])}const hs=I(Ph,[["render",Rh]]),xh={name:"Avatar",props:{xprofile:{default:()=>({})},with_level:{type:Boolean,default(){return!0}},is_rounded:{type:Boolean,default(){return!0}},with_completion:{type:Boolean,default(){return!1}},is_online:{type:Boolean,default(){return!1}}},computed:{level(){if(!this.with_level||!this.has_leaderboard)return"";const e=Be(this.xprofile.total_points);return e?e.level:0},withCompletion(){var s;if(!this.with_completion||!((s=this.xprofile)!=null&&s.total_points))return!1;const e=Be(this.xprofile.total_points),t=Be(e.max_points+1);return e.level!==t.level},getOutlineStyle(){if(!this.withCompletion)return{};const e=Be(this.xprofile.total_points),t=Be(e.max_points+1),s=this.xprofile.total_points-e.min_points,u=t.min_points-e.min_points,i=s/u*100/100*360;return{backgroundImage:`conic-gradient(rgb(56, 117, 223) ${i}deg, #D9D9D9 ${i}deg)`}}},methods:{setAltImg(e){e.target.src=this.appVars.assets_url+"images/placeholder.png"}}},Hh=["src"],Oh={key:1,class:"fcom_no_image"},jh={key:0,role:"region","aria-label":"User Level",class:"fcom_user_level_mark"};function Nh(e,t,s,u,o,i){return n(),c("div",{class:R([{fcom_avatar_is_rounded:s.is_rounded,is_member_online:s.is_online},"fcom_user_avatar"])},[l("span",{style:re(i.getOutlineStyle),class:R({fcom_compilation_avatar:i.withCompletion})},[s.xprofile?(n(),c("img",{key:0,onError:t[0]||(t[0]=(...m)=>i.setAltImg&&i.setAltImg(...m)),src:s.xprofile.avatar,alt:""},null,40,Hh)):(n(),c("span",Oh))],6),i.level||s.is_online?(n(),c("div",jh,[l("span",null,d(i.level),1)])):_("",!0)],2)}const fs=I(xh,[["render",Nh]]),zh={name:"SurveyVoters",props:["feed","option","options","totalCount"],components:{UserRouteLink:Pe,UserAvatar:fs},data(){return{voters:[],loading:!1,showVotersDialog:!0,cache:{},requestId:0}},watch:{option(){this.loadVoters()}},computed:{getVotePercentage(){return this.option.vote_counts?Math.floor(this.option.vote_counts/this.totalCount*100)+"%":"0%"}},methods:{switchOption(e){this.$emit("updateOption",e)},closeDialog(){this.showVotersDialog=!1,this.$emit("close")},loadVoters(){var u;const e=(u=this.option)==null?void 0:u.slug;if(!e)return;const t=++this.requestId,s=this.cache[e];s&&(this.voters=s),this.loading=!s,this.$get(`feeds/${this.feed.id}/apps/survey-voters/${e}`).then(({voters:o})=>{this.cache[e]=o,t===this.requestId&&(this.voters=o)}).catch(o=>{s||this.$handleError(o)}).finally(()=>{t===this.requestId&&(this.loading=!1)})}},mounted(){this.loadVoters()}},qh={class:"dialog_header"},Gh={class:"fcom_filter_menu"},Yh={class:"fcom_filter_menu_ul"},Wh=["onClick"],Kh={key:1},Zh={class:"feed_meta_info survey_voters_meta"},Jh={class:"meta_line"},Qh={class:"meta_line"},Xh={class:"voters_list"},ef={class:"voter_avatar"},tf={class:"voter_info"},sf=["title"],of={key:2,class:"not_found"};function nf(e,t,s,u,o,i){const m=Z,f=p("UserAvatar"),h=p("UserRouteLink"),g=ke,w=be;return n(),y(w,{modelValue:o.showVotersDialog,"onUpdate:modelValue":t[0]||(t[0]=b=>o.showVotersDialog=b),"modal-class":"fcom_common_dialog menu_dialog","close-on-click-modal":!0,"append-to-body":!0,width:e.dialogWidth,style:{"max-width":"800px"},direction:"rtl",onClose:i.closeDialog},{header:r(({close:b})=>[l("div",qh,[l("div",Gh,[l("ul",Yh,[(n(!0),c(F,null,x(s.options,S=>(n(),c("li",{key:S.slug},[l("a",{onClick:z(k=>i.switchOption(S.slug),["prevent"]),class:R({"router-link-exact-active":s.option.slug==S.slug}),href:"#"},d(S.label),11,Wh)]))),128))])])])]),default:r(()=>[o.loading?(n(),y(m,{key:0,animated:"",rows:4})):o.voters.length?(n(),c("div",Kh,[l("div",Zh,[l("span",Jh,d(i.getVotePercentage),1),l("span",Qh,d(e.$_n("%s Vote","%s Votes",s.option.vote_counts)),1)]),a(g,{"max-height":"800px"},{default:r(()=>[l("div",Xh,[(n(!0),c(F,null,x(o.voters,b=>(n(),c("div",{key:b.id,class:"voter_item"},[b.xprofile?(n(),c(F,{key:0},[l("div",ef,[a(f,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"])]),l("div",tf,[a(h,{show_badge:!0,xprofile:b.xprofile},null,8,["xprofile"]),b.xprofile.created_at?(n(),c("div",{key:0,title:b.xprofile.created_at,class:"voter_time"},d(e.$t("Joined %s",e.humanDateDiff(b.xprofile.created_at))),9,sf)):_("",!0)])],64)):_("",!0)]))),128))])]),_:1})])):(n(),c("div",of,[l("p",null,d(e.$t("No voters yet")),1)]))]),_:1},8,["modelValue","width","onClose"])}const lf=I(zh,[["render",nf]]),af={name:"SurveyRenderer",props:{feed:{type:Object,required:!0},is_preview:{type:Boolean,default:!1},hasTopMedia:{type:Boolean,default:!1},isChildFeed:{type:Boolean,default:!1}},components:{SurveyVoters:lf},data(){var e,t;return{inputType:(t=(e=this.feed.meta)==null?void 0:e.survey_config)==null?void 0:t.type,formattedOptions:[],working:!1,totalCount:0,showVotersDialog:!1,selectedOption:null,endingDate:null}},watch:{"feed.meta.survey_config":{handler(e,t){JSON.stringify(e)!==JSON.stringify(t)&&(this.inputType=t.type,this.setupData())},deep:!0}},computed:{isEnded(){return this.endingDate&&this.isPastDate(this.endingDate)},endedDateLabel(){return this.$t("ended %s",this.humanDateDiff(this.endingDate))},endingDateLabel(){return this.$t("ending %s",this.humanDateDiff(this.endingDate))},shouldHideBorder(){var e,t;return!this.hasTopMedia&&(((e=this.feed.meta)==null?void 0:e.media_items)||((t=this.feed.meta)==null?void 0:t.media_preview))||this.isChildFeed}},methods:{getVoteStyle(e){const t=e?e/this.totalCount*100:0,s={width:t+"%"};return t>0&&t<100&&(s["border-top-right-radius"]=0,s["border-bottom-right-radius"]=0),s},showVoters(e){this.selectedOption=e,this.showVotersDialog=!0},updateOption(e){this.selectedOption=this.formattedOptions.find(t=>t.slug===e)},toggleVote(e){if(this.isEnded){this.$notify.error(this.$t("This poll has ended."));return}if(this.showVotersDialog)return;let t=this.formattedOptions[e].voted;this.inputType=="single_choice"&&this.each(this.formattedOptions,s=>{s.voted=!1}),this.formattedOptions[e].voted=!t,this.syncVotes()},syncVotes(){if(this.is_preview)return;let e=[];this.each(this.formattedOptions,t=>{t.voted&&e.push(t.slug)}),this.working=!0,this.$post(`feeds/${this.feed.id}/apps/survey-vote`,{vote_indexes:e}).then(t=>{this.feed.meta.survey_config=t.survey_config,this.setupData()}).catch(t=>{this.$handleError(t)}).finally(()=>{this.working=!1})},setupData(){let e=[],t=0;this.feed.meta.survey_config&&(this.each(this.feed.meta.survey_config.options,s=>{e.push(s),s.vote_counts&&(t+=parseInt(s.vote_counts))}),this.formattedOptions=e,this.totalCount=t,this.endingDate=this.feed.meta.survey_config.end_date)}},mounted(){this.setupData()}},rf={class:"fcom_app_options"},cf=["onClick"],df={class:"fcom_app_text"},uf={class:"fcom_app_input_wrap"},_f={key:0,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 6"},mf=l("circle",{cx:"3",cy:"3",r:"2.5",fill:"currentColor"},null,-1),hf=[mf],ff={key:1,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8 8"},pf=l("path",{fill:"currentColor",d:"M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z"},null,-1),gf=[pf],yf=["onClick"],vf={key:0},bf={class:"feed_meta_info"},kf={key:0,class:"meta_line"},wf=["title"],Cf=["title"];function $f(e,t,s,u,o,i){const m=p("ArrowRight"),f=j,h=p("SurveyVoters");return n(),c(F,null,[l("div",{class:R(["fcom_app_render",{"no-border":i.shouldHideBorder}])},[l("div",rf,[(n(!0),c(F,null,x(o.formattedOptions,(g,w)=>(n(),c("div",{key:g.slug,onClick:b=>i.toggleVote(w),class:R([g.voted?"fcom_is_voted":"","fcom_app_option"])},[l("div",df,[l("span",uf,[l("span",{class:R("fcom_input_"+o.inputType)},[o.inputType=="single_choice"?(n(),c("svg",_f,hf)):(n(),c("svg",ff,gf))],2)]),l("span",null,d(g.label),1)]),l("div",{class:"fcom_app_counts",onClick:b=>i.showVoters(g)},[V(d(g.vote_counts?Math.floor(g.vote_counts/o.totalCount*100)+"%":"")+" ",1),g.vote_counts?(n(),c("span",vf,"("+d(g.vote_counts)+")",1)):_("",!0),g.vote_counts?(n(),y(f,{key:1,class:"fcom_arrow_icon"},{default:r(()=>[a(m)]),_:1})):_("",!0)],8,yf),o.totalCount?(n(),c("span",{key:0,style:re(i.getVoteStyle(g.vote_counts)),class:"fc_app_shadow"},null,4)):_("",!0)],10,cf))),128))]),l("div",bf,[o.totalCount?(n(),c("span",kf,d(e.$_n("%d vote","%d votes",o.totalCount)),1)):_("",!0),o.endingDate?(n(),c(F,{key:1},[i.isEnded?(n(),c("span",{key:0,title:e.$t("Ended at: %s",o.endingDate),class:"meta_line"},d(i.endedDateLabel),9,wf)):(n(),c("span",{key:1,title:e.$t("Will end at: %s",o.endingDate),class:"meta_line"},d(i.endingDateLabel),9,Cf))],64)):_("",!0)])],2),o.showVotersDialog?(n(),y(h,{key:0,feed:s.feed,option:o.selectedOption,options:o.formattedOptions,totalCount:o.totalCount,onUpdateOption:i.updateOption,onClose:t[0]||(t[0]=g=>o.showVotersDialog=!1)},null,8,["feed","option","options","totalCount","onUpdateOption"])):_("",!0)],64)}const vo=I(af,[["render",$f]]),Sf={name:"BookmarkIcon",props:["is_active"]},Vf={key:0,style:{color:"#1d9bf0"},class:"bookmark_icon_active",width:"16",height:"20",viewBox:"0 0 16 20",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},Mf=l("path",{d:"M1.33331 14.9839V8.08944C1.33331 5.06164 1.33331 3.54774 2.30962 2.60712C3.28593 1.6665 4.85728 1.6665 7.99998 1.6665C11.1427 1.6665 12.714 1.6665 13.6903 2.60712C14.6666 3.54774 14.6666 5.06164 14.6666 8.08944V14.9839C14.6666 16.9054 14.6666 17.8662 14.0226 18.2101C12.7754 18.876 10.436 16.6542 9.32498 15.9852C8.68064 15.5972 8.35847 15.4032 7.99998 15.4032C7.64148 15.4032 7.31932 15.5972 6.67498 15.9852C5.56398 16.6542 3.22454 18.876 1.97735 18.2101C1.33331 17.8662 1.33331 16.9054 1.33331 14.9839Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Lf=[Mf],Tf={key:1,width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ff=l("path",{d:"M1.33331 14.9839V8.08944C1.33331 5.06164 1.33331 3.54774 2.30962 2.60712C3.28593 1.6665 4.85728 1.6665 7.99998 1.6665C11.1427 1.6665 12.714 1.6665 13.6903 2.60712C14.6666 3.54774 14.6666 5.06164 14.6666 8.08944V14.9839C14.6666 16.9054 14.6666 17.8662 14.0226 18.2101C12.7754 18.876 10.436 16.6542 9.32498 15.9852C8.68064 15.5972 8.35847 15.4032 7.99998 15.4032C7.64148 15.4032 7.31932 15.5972 6.67498 15.9852C5.56398 16.6542 3.22454 18.876 1.97735 18.2101C1.33331 17.8662 1.33331 16.9054 1.33331 14.9839Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Pf=[Ff];function If(e,t,s,u,o,i){return s.is_active?(n(),c("svg",Vf,Lf)):(n(),c("svg",Tf,Pf))}const bo=I(Sf,[["render",If]]);const Ef={name:"RenderChildPost",components:{ImageCarousel:Et,SurveyRenderer:vo,DocumentLists:ot,UserRouteLink:Pe,MediaPreview:He,FeedMdContent:At},props:["feed_id"],data(){return{feed:null,loading:!1,notFound:null,in_space:this.$route.params.space,hasOverflowContent:!1}},computed:{hasTopMedia(){var t,s,u,o,i,m;if(this.appVars.features.post_layout!="modern"||!this.feed)return!1;let e=["oembed","iframe_html"].includes((s=(t=this.feed.meta)==null?void 0:t.media_preview)==null?void 0:s.type);return e||(e=(o=(u=this.feed.meta)==null?void 0:u.media_preview)==null?void 0:o.is_uploaded),e||(e=((m=(i=this.feed.meta)==null?void 0:i.media_items)==null?void 0:m.length)==1),e},feedClasses(){if(!this.feed)return[];let e=["feed_single"];return e.push("feed_type_"+this.feed.type),this.hasTopMedia&&e.push("feed_modern_layout"),e}},methods:{getFeed(){this.loading=!0,this.$get("feeds/"+this.feed_id+"/by-id").then(e=>{this.feed=e.feed,this.appVars.last_feed_id<e.feed.id&&(this.appVars.last_feed_id=e.feed.id),this.$nextTick(()=>{this.setOverFlow()})}).catch(e=>{typeof e=="object"&&e.xhr_status==404?this.notFound=!0:this.$handleError(e)}).finally(()=>{this.loading=!1})},handleFeedClick(e){e.preventDefault()&&e.stopPropagation();let t={name:"single_feed",params:{feed_slug:this.feed.slug}};this.feed.space&&(t={name:"space_feed",params:{feed_slug:this.feed.slug,space:this.feed.space.slug}}),this.$router.push(t)},setOverFlow(){let e=this.$refs.feed_body;if(!e)return;e.scrollHeight>400&&(this.hasOverflowContent=!0)}},mounted(){this.getFeed()}},Uf=["id"],Af={key:0,class:"fcom_top_media"},Bf={class:"fcom_feed_header_wrap"},Df={class:"feed_header"},Rf={key:0,class:"feed_user"},xf={class:"feed_user_name"},Hf={class:"feed_meta_info"},Of={key:0,class:"meta_line"},jf=["title","href"],Nf={key:1,class:"feed_timestamp"},zf={key:0,class:"feed_title"},qf={class:"feed_title_heading"},Gf={key:1,class:"expand-button"};function Yf(e,t,s,u,o,i){var $,v,C,L,M,E,T,P,U,D,A;const m=p("media-preview"),f=p("UserAvatar"),h=p("UserRouteLink"),g=p("FeedMdContent"),w=H,b=p("DocumentLists"),S=p("SurveyRenderer"),k=p("ImageCarousel");return o.feed?(n(),c("div",{key:0,onClick:t[0]||(t[0]=(...q)=>i.handleFeedClick&&i.handleFeedClick(...q)),class:"fcom_child_feed"},[l("div",{id:"feed_id_"+o.feed.id,class:R([i.feedClasses,"feed"])},[i.hasTopMedia?(n(),c("div",Af,[o.feed.meta&&o.feed.meta.media_preview?(n(),y(m,{key:0,feed:o.feed},null,8,["feed"])):_("",!0)])):_("",!0),l("div",Bf,[l("div",Df,[o.feed.xprofile?(n(),c("div",Rf,[a(f,{with_level:!1,xprofile:o.feed.xprofile},null,8,["xprofile"]),l("div",null,[l("div",xf,[a(h,{show_badge:!0,xprofile:o.feed.xprofile,show_follow:!0},null,8,["xprofile"])]),l("div",Hf,[o.feed.content_type=="survey"&&((L=(C=(v=($=o.feed)==null?void 0:$.meta)==null?void 0:v.survey_config)==null?void 0:C.options)!=null&&L.length)?(n(),c("span",Of,d(e.$t("created a poll")),1)):_("",!0),l("a",{title:o.feed.created_at,href:o.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(o.feed.created_at)),9,jf),!o.in_space&&o.feed.space?(n(),c("span",Nf,d(e.$t("Posted in %s",e.getExcerpt(o.feed.space.title,30))),1)):_("",!0)])])])):_("",!0)])]),l("div",{ref:"feed_body",class:R([{feed_is_overflow_content:o.hasOverflowContent},"feed_body"])},[o.feed.title?(n(),c("div",zf,[l("h2",qf,d(o.feed.title),1)])):_("",!0),a(g,{class_name:"feed_texts",content:o.feed.message_rendered},null,8,["content"]),o.hasOverflowContent?(n(),c("div",Gf,[a(w,{class:"btn_expand"},{default:r(()=>[V(d(e.$t("Show More")),1)]),_:1})])):_("",!0)],2),o.feed.content_type=="document"?(n(),y(b,{key:1,document_lists:((E=(M=o.feed)==null?void 0:M.meta)==null?void 0:E.document_lists)||[]},null,8,["document_lists"])):(n(),c(F,{key:2},[o.feed.content_type=="survey"&&((D=(U=(P=(T=o.feed)==null?void 0:T.meta)==null?void 0:P.survey_config)==null?void 0:U.options)!=null&&D.length)?(n(),y(S,{key:0,feed:o.feed,isChildFeed:!0},null,8,["feed"])):_("",!0),o.feed.meta?(n(),c(F,{key:1},[o.feed.meta.media_items?(n(),y(k,{key:0,feed:o.feed},null,8,["feed"])):!i.hasTopMedia&&(o.feed.meta.media_preview||(A=o.feed.meta.audio_medias)!=null&&A.length)?(n(),y(m,{key:1,feed:o.feed},null,8,["feed"])):_("",!0)],64)):_("",!0)],64))],10,Uf)])):_("",!0)}const Wf=I(Ef,[["render",Yf]]),Kf={name:"CustomAppMeta",components:{RenderChildPost:Wf},props:{feed:{type:Object,required:!0}}},Zf={ref:"fcom_custom_app"},Jf={key:0},Qf=["innerHTML"];function Xf(e,t,s,u,o,i){const m=p("RenderChildPost");return n(),c("div",Zf,[s.feed.meta.custom_app_preview.app_name=="child_post"&&s.feed.meta.custom_app_preview.feed_id?(n(),c("div",Jf,[a(m,{feed_id:s.feed.meta.custom_app_preview.feed_id},null,8,["feed_id"])])):s.feed.meta.custom_app_preview.custom_html?(n(),c("div",{key:1,innerHTML:s.feed.meta.custom_app_preview.custom_html},null,8,Qf)):_("",!0)],512)}const ep=I(Kf,[["render",Xf]]),tp={name:"FeedAction",components:{EditFeed:hs},props:{feed:{type:Object,required:!0},hide_create_form:{type:Boolean,default:!1}},emits:["updated","deleted"],data(){return{isEdit:!1,working:!1}},computed:{isReportEnabled(){return this.has_pro&&this.appVars.moderationConfig.is_enabled},showReportOption(){var t,s;return!(((t=this.feed)==null?void 0:t.user_id)==((s=this.auth)==null?void 0:s.user_id))&&this.auth.user_id&&this.isReportEnabled}},methods:{editItem(){this.$refs.popover.hide(),this.isEdit=!0},handleUpdate(e){this.$emit("updated",e);const t=document.getElementById("feed_id_"+e.id);t&&(t.classList.add("fcom_highlight_glow"),setTimeout(()=>{t.classList.remove("fcom_highlight_glow")},4500))},reportPost(){this.$refs.popover.hide(),this.$eventBus.emit("showReportContentModal",{reportConfig:this.feed,type:"post"})},copyFeedLink(){navigator.clipboard.writeText(this.feed.permalink).then(()=>{this.$notify.success(this.$t("Link copied to clipboard")),this.$refs.popover.hide()}).catch(e=>{this.$notify.error(this.$t("Failed to copy"))})},toggleSticky(){!this.feed.space_id||this.working||(this.working=!0,this.feed.is_sticky=!this.feed.is_sticky,this.$patch("feeds/"+this.feed.id,{is_sticky:this.feed.is_sticky?1:0}).then(e=>{this.feed.is_sticky=e.feed.is_sticky,this.$emit("reload")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1}))},toggleSidebarPin(){!this.feed.space_id||this.working||(this.$refs.popover.hide(),this.working=!0,this.feed.priority=!this.feed.priority,this.$patch("feeds/"+this.feed.id,{priority:this.feed.priority?1:0}).then(e=>{this.$notify.success(e.feed.priority?this.$t("Pinned to sidebar"):this.$t("Unpinned from sidebar")),this.feed.priority=e.feed.priority,this.$eventBus.emit("updateSpaceSidebar",this.feed.space_id)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1}))},toggleUnlist(){if(this.working)return;const e=this.feed.status!=="unlisted";this.$refs.popover.hide(),this.working=!0,this.$patch("feeds/"+this.feed.id,{status:e?"unlisted":"published"}).then(t=>{this.feed.status=t.feed.status,this.$notify.success(t.feed.status==="unlisted"?this.$t("Post has been unlisted."):this.$t("Post has been listed.")),this.$emit("updated",t.feed)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.working=!1})},toggleCommentStatus(){var t;if(this.working)return;let e=((t=this.feed.meta)==null?void 0:t.comments_disabled)=="yes";this.$refs.popover.hide(),this.working=!0,this.$patch("feeds/"+this.feed.id,{comments_disabled:e?0:1}).then(s=>{var o;let u=((o=s.feed.meta)==null?void 0:o.comments_disabled)=="yes";this.$notify.success(u?this.$t("Comments have been disabled."):this.$t("Comments have been enabled.")),this.feed.meta.comments_disabled=s.feed.meta.comments_disabled}).catch(s=>{this.$handleError(s)}).finally(()=>{this.working=!1})},removePreview(){this.$refs.popover.hide(),this.$confirm(this.$t("Are you sure you want to remove the preview image? This action cannot be undone."),this.$t("Remove Preview"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.working=!0,this.$del("feeds/"+this.feed.id+"/media-preview").then(e=>{this.feed.meta.media_preview=null}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1})}).catch(()=>{})},deleteItem(){this.working||(this.$refs.popover.hide(),this.$confirm(this.$t("Are you sure you want to delete this feed?"),this.$t("Warning"),{confirmButtonText:this.$t("Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.working||(this.working=!0,this.$emit("deleted"),this.working=!1)}).catch(()=>{}))}}},sp={class:"actions_items"},op={key:0},ip={key:1},np={key:0},lp={key:1},ap={key:0},rp={key:1},cp={key:0},dp={key:1};function up(e,t,s,u,o,i){var b,S;const m=p("MoreFilled"),f=j,h=H,g=ye,w=p("EditFeed");return n(),c(F,null,[a(g,{persistent:!1,ref:"popover",placement:"bottom",width:200,trigger:"click",teleported:!1,"popper-class":"fcom_menu_below_nav"},{reference:r(()=>[a(h,{"aria-label":e.$t("View Post actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>{var k,$;return[l("ul",sp,[Y(e.$slots,"before_feed_actions_pop"),l("li",{onClick:t[0]||(t[0]=v=>i.copyFeedLink())},d(e.$t("Copy Link")),1),i.showReportOption?(n(),c("li",{key:0,onClick:t[1]||(t[1]=v=>i.reportPost())},d(e.$t("Report Post")),1)):_("",!0),e.canEditFeed(s.feed)?(n(),c(F,{key:1},[l("li",{onClick:t[2]||(t[2]=v=>i.editItem())},d(e.$t("Edit")),1),e.has_pro&&e.isCommunityModerator()&&["published","unlisted"].includes(s.feed.status)?(n(),c("li",{key:0,onClick:t[3]||(t[3]=v=>i.toggleUnlist())},[s.feed.status=="unlisted"?(n(),c("span",op,d(e.$t("List Post")),1)):(n(),c("span",ip,d(e.$t("Unlist Post")),1))])):_("",!0),s.feed.space&&e.hasSpaceAdminAccess(s.feed.space)?(n(),c(F,{key:1},[l("li",{onClick:t[4]||(t[4]=v=>i.toggleSticky())},[s.feed.is_sticky?(n(),c("span",np,d(e.$t("Unpin from Top")),1)):(n(),c("span",lp,d(e.$t("Pin to top")),1))]),l("li",{onClick:t[5]||(t[5]=v=>i.toggleSidebarPin())},[s.feed.priority?(n(),c("span",rp,d(e.$t("Unpin from sidebar")),1)):(n(),c("span",ap,d(e.$t("Pin to sidebar")),1))])],64)):_("",!0),(k=s.feed.meta)!=null&&k.media_preview?(n(),c("li",{key:2,onClick:t[6]||(t[6]=v=>i.removePreview())},d(e.$t("Remove Preview")),1)):_("",!0),e.hasSpaceAdminAccess(s.feed.space)?(n(),c("li",{key:3,onClick:t[7]||(t[7]=v=>i.toggleCommentStatus())},[(($=s.feed.meta)==null?void 0:$.comments_disabled)=="yes"?(n(),c("span",cp,d(e.$t("Enable comments")),1)):(n(),c("span",dp,d(e.$t("Disable comments")),1))])):_("",!0)],64)):_("",!0),e.canDeleteFeed(s.feed)?(n(),c("li",{key:2,onClick:t[8]||(t[8]=v=>i.deleteItem())},d(e.$t("Delete")),1)):_("",!0),Y(e.$slots,"after_feed_actions_pop")])]}),_:3},512),o.isEdit?(n(),y(w,{key:0,feedSlug:s.feed.slug,dialogVisible:o.isEdit,hide_create_form:s.hide_create_form,author:{name:(b=s.feed.xprofile)==null?void 0:b.display_name,avatar:(S=s.feed.xprofile)==null?void 0:S.avatar},onUpdated:i.handleUpdate,onClose:t[9]||(t[9]=k=>o.isEdit=!1)},null,8,["feedSlug","dialogVisible","hide_create_form","author","onUpdated"])):_("",!0)],64)}const ko=I(tp,[["render",up]]);const _p={name:"Feed",components:{DocumentLists:ot,CustomAppMeta:ep,BookmarkIcon:bo,StickyIcon:Ut,UserRouteLink:Pe,EditFeed:hs,FeedFooter:Um,MediaPreview:He,ImageCarousel:Et,SurveyRenderer:vo,ReportReview:ho,FeedAction:ko,FeedMdContent:At},emits:["updated","deleted","removed","reload","commented"],props:{feed:{type:Object,required:!0},is_single:{type:Boolean,default:!1},is_route:{type:Boolean,default:!1},show_footer:{type:Boolean,default:!0},show_header:{type:Boolean,default:!0},show_report:{type:Boolean,default:!1},hide_create_form:{type:Boolean,default:!1},is_preview:{type:Boolean,default:!1},show_actions:{type:Boolean,default:!0},is_modal:{type:Boolean,default:!1},isSingleSpacePage:{type:Boolean,default:!1}},data(){return{in_space:this.$route.params.space,working:!1,hasOverflowContent:!1,isExpanded:!1,joiningSpace:!1}},computed:{isReportEnabled(){return this.has_pro&&this.appVars.moderationConfig.is_enabled},showReport(){var e;return this.hasSpaceModeratorAccess(this.feed.space)&&this.isReportEnabled&&this.show_report&&(this.feed.status=="pending"||((e=this.feed.meta)==null?void 0:e.reports_count))},space_slug(){let e=!1;return this.feed.space?e=this.feed.space.slug:this.$route.params.space&&(e=this.$route.params.space),e},feedClasses(){let e=[];return e.push("feed_type_"+this.feed.type),this.feed.type=="article"&&e.push(this.feed.featured_image?"feed_has_image":"feed_no_image"),this.is_preview&&e.push("feed_preview"),this.is_single?e.push("feed_single"):e.push("feed_list_item"),this.hasTopMedia&&e.push("feed_modern_layout"),e},feedRoute(){let e={name:"single_feed",params:{feed_slug:this.feed.slug}};return this.space_slug&&(e={name:"space_feed",params:{feed_slug:this.feed.slug,space:this.space_slug}}),e},hasTopMedia(){var t,s,u,o,i,m;if(this.appVars.features.post_layout!="modern")return!1;let e=["oembed","iframe_html"].includes((s=(t=this.feed.meta)==null?void 0:t.media_preview)==null?void 0:s.type);return e||(e=(o=(u=this.feed.meta)==null?void 0:u.media_preview)==null?void 0:o.is_uploaded),e||(e=((m=(i=this.feed.meta)==null?void 0:i.media_items)==null?void 0:m.length)==1),e},parsedMessage(){return this.parseMessage(this.feed.message_rendered)}},methods:{getTopicRoute(e){return this.space_slug?{name:"space_feeds",params:{space:this.space_slug},query:{topic:e}}:{name:"all_feeds",query:{topic:e}}},getScheduledTime(e){return this.$t("%1$s at %2$s",this.formattedDate(e),this.formattedTime(e))},gotoTopicUrl(e){let t=this.getTopicRoute(e);this.$router.push(t)},gotoFeed(e){e&&(e.metaKey||e.ctrlKey)||(e&&(e.preventDefault(),e.stopPropagation()),window.__showing_feed=this.feed,this.$router.push(this.feedRoute))},getSpaceRoute(e){return{name:"space_feeds",params:{space:e}}},getFeedContent(){return this.feed.title},expandInline(){this.hasOverflowContent=!1,this.isExpanded=!0},showFullContent(e){if(!this.hasFeature("show_post_modal")){this.expandInline();return}e&&e.stopPropagation(),this.$eventBus.emit("showFeedModal",{feed:this.feed})},parseMessage(e){if(!e)return"";const t=this.$route.params.space?`${this.appVars.urls.portal_base}space/${this.$route.params.space}/home`:this.appVars.urls.global_search;let s=e.replace(/<a\s(?:(?!target="_blank")[^>])*>|<[^>]+>|#([\p{L}\p{M}\p{N}_-]+)/gu,(o,i,m,f)=>o.startsWith("<a")&&!o.includes('target="_blank"')?o.includes(window.location.origin)?o:o.replace("<a",'<a target="_blank" rel="noopener noreferrer nofollow"'):i&&!this.isInsideHtmlTag(f,m)?`<a onclick="window.FluentCommunityUtil.handleSearchClick(event)" href="${t}?search=%23${i}">#${i}</a>`:o);return s.indexOf('<span class="fcom_dynamic_prop" data-type="timestamp"')===-1?s:(o=>o.replace(/<span class="fcom_dynamic_prop" data-type="timestamp" data-timestamp="(\d+)">([^<]+)<\/span>/g,(i,m,f)=>{try{const h=this.dayjs(m*1e3);if(!h.isValid())return i;const w=h.local().format(this.siteDateTimeFormat)+" ("+this.currentTimeZoneName+")";return`<span class="fcom_timestamp" title="${f}">${w}</span>`}catch{return i}}))(s)},isInsideHtmlTag(e,t){let s=!1;for(let u=0;u<t;u++)e[u]==="<"&&(s=!0),e[u]===">"&&(s=!1);return s},handleUpdate(e){this.$emit("updated",e),Object.assign(this.feed,e)},handleDelete(){this.$emit("deleted")},handleRemoveBookmark(){this.$emit("deleted")},toggleBookmark(){const e={react_type:"bookmark"};this.feed.bookmarked&&(e.remove=!0),this.feed.bookmarked=!this.feed.bookmarked,this.$post("feeds/"+this.feed.id+"/react",e).then(t=>{this.$notify.success(this.feed.bookmarked?this.$t("Bookmarked"):this.$t("Removed from bookmark")),!this.feed.bookmarked&&this.$route.name==="bookmarks"&&this.$emit("removeFromBookmark")}).catch(t=>{this.$handleError(t),this.feed.bookmarked=!this.feed.bookmarked})},toggleSticky(){this.feed.space_id&&(this.feed.is_sticky=!this.feed.is_sticky,this.$patch("feeds/"+this.feed.id,{is_sticky:this.feed.is_sticky?1:0}).then(e=>{this.feed.is_sticky=e.feed.is_sticky,this.$emit("reload")}).catch(e=>{this.$handleError(e)}))},joinSpace(){this.joiningSpace=!0,this.$post("spaces/"+this.feed.space.slug+"/join").then(e=>{this.appVars.user_membership_slugs.push(this.feed.space.slug),this.$notify.success(e.message),document.location.href=this.feed.permalink}).catch(e=>{this.$handleError(e)}).finally(()=>{this.joiningSpace=!1})},onModReport(e){var t,s;((t=e.content)==null?void 0:t.id)==((s=this.feed)==null?void 0:s.id)&&(e.action==="unpublished"&&e.type!=="comment"?this.$emit("removed"):(this.feed.meta={...this.feed.meta,...e.content.meta},e.content.status&&(this.feed.status=e.content.status)))}},created(){this.$eventBus.on("updateModerationReport",this.onModReport)},beforeUnmount(){this.$eventBus.off("updateModerationReport",this.onModReport)},mounted(){if(document.dispatchEvent(new CustomEvent("fcomFeedMounted",{detail:{isSingle:this.is_single,feed:this.feed,feedBody:this.$refs.feed_body}})),this.is_single||this.feed.is_sticky||this.feed.priority){this.isExpanded=!0;return}let e=this.$refs.feed_body;if(!e)return;e.scrollHeight>400&&(this.hasOverflowContent=!0)}},mp=["id"],hp={key:1,class:"fcom_top_media"},fp={key:2,class:"fcom_feed_header_wrap"},pp={class:"feed_actions fcom_concat_buttons"},gp={key:0,class:"fcom_feed_topics"},yp={class:"feed_header"},vp={key:0,class:"feed_user"},bp={class:"feed_user_info"},kp={class:"feed_user_name"},wp={key:0,class:"feed_status"},Cp={key:1,class:"feed_status"},$p={key:2,class:"feed_status"},Sp={class:"feed_meta_info"},Vp={key:0,class:"meta_line"},Mp=["title","href"],Lp=["title","href"],Tp={key:3},Fp={key:0,class:"feed_title"},Pp={key:0,class:"feed_title_heading"},Ip=["href"],Ep={key:1,class:"feed_title_heading"};function Up(e,t,s,u,o,i){var A,q,O,N,G,ae,B,X,me,ee,Ve,Q,J,ie,vt;const m=p("report-review"),f=p("media-preview"),h=H,g=p("StickyIcon"),w=j,b=p("BookmarkIcon"),S=p("FeedAction"),k=p("router-link"),$=p("UserAvatar"),v=p("UserRouteLink"),C=Ee,L=p("FeedMdContent"),M=p("SurveyRenderer"),E=p("ImageCarousel"),T=p("DocumentLists"),P=p("CustomAppMeta"),U=p("feed-footer"),D=te("loading");return W((n(),c("div",{id:"feed_id_"+((A=s.feed)==null?void 0:A.id),class:R([i.feedClasses,"feed"])},[i.showReport?(n(),y(m,{key:0,feed:s.feed},null,8,["feed"])):_("",!0),i.hasTopMedia?(n(),c("div",hp,[s.feed.meta&&s.feed.meta.media_preview?(n(),y(f,{key:0,feed:s.feed,is_preview:s.is_preview},null,8,["feed","is_preview"])):_("",!0)])):_("",!0),s.show_header?(n(),c("div",fp,[l("div",pp,[e.auth.user_id&&!e.hasSpaceAccess((q=s.feed.space)==null?void 0:q.slug)&&!s.is_single&&!s.isSingleSpacePage?(n(),y(h,{key:0,loading:o.joiningSpace,class:"fcom_secondary_button join_button",onClick:t[0]||(t[0]=fe=>i.joinSpace())},{default:r(()=>[V(d(e.$t("Join")),1)]),_:1},8,["loading"])):_("",!0),s.show_actions?(n(),c(F,{key:1},[s.feed.is_sticky&&o.in_space?(n(),y(h,{key:0,onClick:t[1]||(t[1]=fe=>i.toggleSticky()),"aria-label":e.$t("Toggle Sticky"),class:"no_pad_btn",text:"",size:"small"},{default:r(()=>[a(w,{class:"fcom_sticky"},{default:r(()=>[a(g)]),_:1})]),_:1},8,["aria-label"])):_("",!0),e.auth.user_id?(n(),y(h,{key:1,"aria-label":e.$t("Toggle Bookmark"),size:"small",text:"",onClick:t[2]||(t[2]=fe=>i.toggleBookmark()),class:R([{bookmark_active:s.feed.bookmarked},"feed_bookmark no_pad_btn"]),title:s.feed.bookmarked?e.$t("Remove From Bookmark"):e.$t("Bookmark this post")},{default:r(()=>[a(w,{style:{"font-size":"14px"}},{default:r(()=>[a(b,{is_active:s.feed.bookmarked},null,8,["is_active"])]),_:1})]),_:1},8,["aria-label","class","title"])):_("",!0),a(S,{feed:s.feed,hide_create_form:s.hide_create_form,onUpdated:i.handleUpdate,onDeleted:i.handleDelete},{before_feed_actions_pop:r(()=>[s.is_route?(n(),c("li",{key:0,onClick:t[3]||(t[3]=fe=>e.$emit("reload"))},d(e.$t("Refresh")),1)):_("",!0)]),_:1},8,["feed","hide_create_form","onUpdated","onDeleted"])],64)):_("",!0),Y(e.$slots,"after_feed_actions")]),((O=e.appVars.topicsConfig)==null?void 0:O.show_on_post_card)=="yes"&&s.feed.terms&&s.feed.terms.length?(n(),c("div",gp,[(n(!0),c(F,null,x(s.feed.terms,fe=>(n(),y(k,{onClick:z(CR=>i.gotoTopicUrl(fe.slug),["prevent"]),key:fe.slug,to:i.getTopicRoute(fe.slug),class:"feed_timestamp"},{default:r(()=>[V("#"+d(fe.title),1)]),_:2},1032,["onClick","to"]))),128))])):_("",!0),l("div",yp,[s.feed.xprofile?(n(),c("div",vp,[a($,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"]),l("div",bp,[l("div",kp,[a(v,{show_badge:!0,xprofile:s.feed.xprofile,show_follow:!0},null,8,["xprofile"]),s.feed.status=="pending"?(n(),c("span",wp,[a(C,{type:"warning"},{default:r(()=>[V(d(e.$t("In Review")),1)]),_:1})])):_("",!0),s.feed.status=="scheduled"?(n(),c("span",Cp,[a(C,{type:"warning"},{default:r(()=>[V(d(e.$t("Scheduled")),1)]),_:1})])):_("",!0),s.feed.status=="unlisted"&&!s.is_single?(n(),c("span",$p,[a(C,{class:"fcom_unlisted_tag"},{default:r(()=>[V(d(e.$t("Unlisted")),1)]),_:1})])):_("",!0)]),l("div",Sp,[s.feed.content_type=="survey"&&((B=(ae=(G=(N=s.feed)==null?void 0:N.meta)==null?void 0:G.survey_config)==null?void 0:ae.options)!=null&&B.length)?(n(),c("span",Vp,d(e.$t("created a poll")),1)):_("",!0),s.feed.status=="scheduled"?(n(),c("a",{key:1,title:s.feed.scheduled_at,onClick:t[4]||(t[4]=(...fe)=>i.gotoFeed&&i.gotoFeed(...fe)),href:s.feed.permalink,class:"feed_timestamp"},d(i.getScheduledTime(s.feed.scheduled_at)),9,Mp)):(n(),c("a",{key:2,title:s.feed.created_at,onClick:t[5]||(t[5]=(...fe)=>i.gotoFeed&&i.gotoFeed(...fe)),href:s.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(s.feed.created_at)),9,Lp)),!o.in_space&&s.feed.space?(n(),c("span",Tp,[a(k,{to:i.getSpaceRoute(s.feed.space.slug),class:"feed_timestamp"},{default:r(()=>[V(d(e.$t("Posted in %s",e.getExcerpt(s.feed.space.title,30))),1)]),_:1},8,["to"])])):_("",!0)])])])):_("",!0),Y(e.$slots,"after_feed_header")])])):_("",!0),l("div",{ref:"feed_body",class:R([{feed_is_overflow_content:o.hasOverflowContent},"feed_body"])},[s.feed.title?(n(),c("div",Fp,[s.is_single?(n(),c("h2",Ep,d(s.feed.title),1)):(n(),c("h2",Pp,[l("a",{onClick:t[6]||(t[6]=z((...fe)=>i.showFullContent&&i.showFullContent(...fe),["prevent"])),href:s.feed.permalink},d(s.feed.title),9,Ip)]))])):_("",!0),a(L,{class_name:"feed_texts",content:i.parsedMessage},null,8,["content"]),o.hasOverflowContent&&!o.isExpanded?(n(),c("div",{key:1,onClick:t[7]||(t[7]=fe=>i.expandInline()),class:"expand-button"},[a(h,{class:"btn_expand"},{default:r(()=>[V(d(e.$t("Show More")),1)]),_:1})])):_("",!0)],2),s.feed.content_type=="survey"&&((Ve=(ee=(me=(X=s.feed)==null?void 0:X.meta)==null?void 0:me.survey_config)==null?void 0:ee.options)!=null&&Ve.length)?(n(),c(F,{key:3},[a(M,{feed:s.feed,is_preview:s.is_preview,hasTopMedia:i.hasTopMedia},null,8,["feed","is_preview","hasTopMedia"]),s.feed.meta.media_items?(n(),y(E,{key:0,is_single:s.is_single,feed:s.feed},null,8,["is_single","feed"])):!i.hasTopMedia&&(s.feed.meta.media_preview||(Q=s.feed.meta.audio_medias)!=null&&Q.length)?(n(),y(f,{key:1,feed:s.feed},null,8,["feed"])):_("",!0)],64)):s.feed.content_type=="document"?(n(),y(T,{key:4,document_lists:((ie=(J=s.feed)==null?void 0:J.meta)==null?void 0:ie.document_lists)||[]},null,8,["document_lists"])):s.feed.meta?(n(),c(F,{key:5},[s.feed.meta.media_items?(n(),y(E,{key:0,is_single:s.is_single,feed:s.feed},null,8,["is_single","feed"])):!i.hasTopMedia&&(s.feed.meta.media_preview||(vt=s.feed.meta.audio_medias)!=null&&vt.length)?(n(),y(f,{key:1,feed:s.feed},null,8,["feed"])):_("",!0),s.feed.meta.custom_app_preview?(n(),y(P,{key:2,feed:s.feed},null,8,["feed"])):_("",!0)],64)):_("",!0),s.show_footer?(n(),y(U,{key:6,feed:s.feed,is_modal:s.is_modal,is_single:s.is_single,space_slug:i.space_slug,onJoinSpace:t[8]||(t[8]=()=>{i.joinSpace()}),onCommented:t[9]||(t[9]=fe=>{e.$emit("commented",fe)})},null,8,["feed","is_modal","is_single","space_slug"])):_("",!0),Y(e.$slots,"after_feed_footer")],10,mp)),[[D,o.working]])}const nt=I(_p,[["render",Up]]),Ap={data(){return{isDarkMode:!1}},methods:{updateDarkMode(){this.isDarkMode=document.documentElement.classList.contains("dark")}},mounted(){this.updateDarkMode(),this.observer=new MutationObserver(this.updateDarkMode),this.observer.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})},beforeUnmount(){this.observer&&this.observer.disconnect()}},Bp={name:"FeedCard",mixins:[Ap],components:{UserRouteLink:Pe,ChatIcon:tt,HeartIcon:st,StickyIcon:Ut,MediaPreview:He,ImageCarousel:Et,UserAvatar:fs,FeedAction:ko},props:{feed:{type:Object,required:!0},hide_create_form:{type:Boolean,default:!1}},emits:["updated","deleted"],computed:{feedRoute(){let e={name:"single_feed",params:{feed_slug:this.feed.slug}};return this.feed.space&&(e={name:"space_feed",params:{feed_slug:this.feed.slug,space:this.feed.space.slug}}),e},placeholderImageSrc(){const e=this.isDarkMode?"feed-placeholder-dark.png":"feed-placeholder.png";return this.appVars.assets_url+"images/"+e},cardImage(){var t,s,u,o,i;const e=this.feed.meta;return e?(t=e.media_preview)!=null&&t.image?e.media_preview.image:(u=(s=e.media_items)==null?void 0:s[0])!=null&&u.url?e.media_items[0].url:((o=e.media_preview)==null?void 0:o.type)==="iframe_html"&&((i=e.media_preview)!=null&&i.html)?this.extractIframeThumbnail(e.media_preview.html)||this.placeholderImageSrc:this.placeholderImageSrc:this.placeholderImageSrc}},data(){return{in_space:this.$route.params.space}},methods:{extractIframeThumbnail(e){const t=e.match(/src=["']([^"']+)["']/);if(!t)return null;const s=t[1],u=[[/youtube\.com\/embed\/([^?/]+)/,o=>"https://img.youtube.com/vi/"+o+"/hqdefault.jpg"],[/player\.vimeo\.com\/video\/([^?/]+)/,o=>"https://vumbnail.com/"+o+".jpg"],[/fast\.wistia\.net\/embed\/iframe\/([^?/]+)/,o=>"https://fast.wistia.net/embed/medias/"+o+"/swatch"],[/dailymotion\.com\/(?:embed\/video|player\.html\?video=)\/?([^?/&]+)/,o=>"https://www.dailymotion.com/thumbnail/video/"+o]];for(const[o,i]of u){const m=s.match(o);if(m)return i(m[1])}return null},handleUpdate(e){this.$emit("updated",e),Object.assign(this.feed,e)},handleDelete(){this.$emit("deleted")},getFeedHref(){return this.hasFeature("show_post_modal")?null:this.$router.resolve(this.feedRoute).href},getSpaceRoute(e){return{name:"space_feeds",params:{space:e}}},goToFeedView(e,t=!1){if(this.hasFeature("show_post_modal")){this.feed.auto_focus_comment=t,this.$eventBus.emit("showFeedModal",{feed:this.feed,view:t?"comments":"",auto_focus_comment:t});return}e.ctrlKey||e.metaKey||(e.preventDefault(),window.__showing_feed=this.feed,this.$router.push(this.feedRoute))},toggleReact(){const e={react_type:"like"};this.feed.has_user_react&&(e.remove=!0),this.feed.has_user_react=!this.feed.has_user_react,this.$post("feeds/"+this.feed.id+"/react",e).then(t=>{this.feed.reactions_count=t.new_count}).catch(t=>{this.$handleError(t),this.feed.has_user_react=!this.feed.has_user_react})}}},Dp=["id"],Rp={class:"fcom_feed_card_header"},xp=["src","alt"],Hp={class:"feed_card_user"},Op={class:"feed_card_body"},jp={class:"fcom_feed_title_row"},Np=["textContent"],zp={key:0,class:"feed_status"},qp={key:1,class:"feed_status"},Gp={class:"card_description feed_meta_info"},Yp=["title","href"],Wp={key:0},Kp={class:"fcom_feed_card_footer"},Zp={class:"num_label"},Jp={class:"num_label"},Qp={class:"fcom_feed_card_action"};function Xp(e,t,s,u,o,i){var v;const m=p("UserAvatar"),f=Ee,h=p("UserRouteLink"),g=p("router-link"),w=p("HeartIcon"),b=j,S=H,k=p("ChatIcon"),$=p("FeedAction");return n(),c("div",{id:"feed_id_"+((v=s.feed)==null?void 0:v.id),class:"fcom_feed_card"},[l("div",Rp,[l("div",{onClick:t[0]||(t[0]=(...C)=>i.goToFeedView&&i.goToFeedView(...C)),class:"feed_card_cover"},[l("img",{src:i.cardImage,class:"card_image",alt:s.feed.title||e.$t("Placeholder image")},null,8,xp)]),l("div",Hp,[a(m,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"])]),l("div",Op,[l("div",jp,[l("div",{onClick:t[1]||(t[1]=(...C)=>i.goToFeedView&&i.goToFeedView(...C)),class:"card_title feed_texts feed_md_content",textContent:d(e.getExcerpt(s.feed.title||s.feed.message_rendered,60))},null,8,Np),s.feed.status=="pending"?(n(),c("span",zp,[a(f,{type:"warning"},{default:r(()=>[V(d(e.$t("In Review")),1)]),_:1})])):_("",!0),s.feed.status=="unlisted"?(n(),c("span",qp,[a(f,{class:"fcom_unlisted_tag"},{default:r(()=>[V(d(e.$t("Unlisted")),1)]),_:1})])):_("",!0)]),l("div",Gp,[a(h,{xprofile:s.feed.xprofile,show_verified:!1,show_follow:!0},null,8,["xprofile"]),l("a",{title:s.feed.created_at,onClick:t[2]||(t[2]=(...C)=>i.goToFeedView&&i.goToFeedView(...C)),href:s.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(s.feed.created_at)),9,Yp),!o.in_space&&s.feed.space?(n(),c("span",Wp,[a(g,{to:i.getSpaceRoute(s.feed.space.slug),class:"feed_timestamp"},{default:r(()=>[V(d(e.$t(e.getExcerpt(s.feed.space.title,30))),1)]),_:1},8,["to"])])):_("",!0)])])]),l("div",Kp,[a(S,{"aria-label":e.$t("React"),text:""},{default:r(()=>[a(b,{class:R({user_reacted:s.feed.has_user_react}),onClick:t[3]||(t[3]=C=>i.toggleReact())},{default:r(()=>[a(w,{filled:s.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",Zp,d(s.feed.reactions_count),1)]),_:1},8,["aria-label"]),a(S,{"aria-label":e.$t("Comment"),onClick:t[4]||(t[4]=C=>i.goToFeedView(C,!0)),text:""},{default:r(()=>[a(b,null,{default:r(()=>[a(k)]),_:1}),l("span",Jp,d(s.feed.comments_count),1)]),_:1},8,["aria-label"])]),l("div",Qp,[a($,{feed:s.feed,hide_create_form:s.hide_create_form,onUpdated:i.handleUpdate,onDeleted:i.handleDelete},null,8,["feed","hide_create_form","onUpdated","onDeleted"])])],8,Dp)}const e1=I(Bp,[["render",Xp]]),t1={name:"FeedListItem",components:{UserRouteLink:Pe,ChatIcon:tt,HeartIcon:st,StickyIcon:Ut},props:["feed"],computed:{feedRoute(){let e={name:"single_feed",params:{feed_slug:this.feed.slug}};return this.feed.space&&(e={name:"space_feed",params:{feed_slug:this.feed.slug,space:this.feed.space.slug}}),e}},data(){return{in_space:this.$route.params.space}},methods:{getFeedHref(){return this.hasFeature("show_post_modal")?null:this.$router.resolve(this.feedRoute).href},parseMessage(e){if(!e)return"";const t=this.$route.params.space?`${this.appVars.urls.portal_base}space/${this.$route.params.space}/home`:this.appVars.urls.global_search;return e.replace(/<a\s(?:(?!target="_blank")[^>])*>|<[^>]+>|#([\p{L}\p{M}\p{N}_-]+)/gu,(s,u,o,i)=>s.startsWith("<a")&&!s.includes('target="_blank"')?s.includes(window.location.origin)?s:s.replace("<a",'<a target="_blank" rel="noopener"'):u&&!this.isInsideHtmlTag(i,o)?`<a onclick="window.FluentCommunityUtil.handleSearchClick(event)" href="${t}?search=%23${u}">#${u}</a>`:s)},isInsideHtmlTag(e,t){let s=!1;for(let u=0;u<t;u++)e[u]==="<"&&(s=!0),e[u]===">"&&(s=!1);return s},goToFeedView(e,t=!1){if(this.hasFeature("show_post_modal")){this.feed.auto_focus_comment=t,this.$eventBus.emit("showFeedModal",{feed:this.feed,view:t?"comments":"",auto_focus_comment:t});return}e.ctrlKey||e.metaKey||(e.preventDefault(),window.__showing_feed=this.feed,this.$router.push(this.feedRoute))},toggleReact(){const e={react_type:"like"};this.feed.has_user_react&&(e.remove=!0),this.feed.has_user_react=!this.feed.has_user_react,this.$post("feeds/"+this.feed.id+"/react",e).then(t=>{this.feed.reactions_count=t.new_count}).catch(t=>{this.$handleError(t),this.feed.has_user_react=!this.feed.has_user_react})}}},s1=["id"],o1={class:"fcom_feed_data"},i1={key:0,class:"fcom_sticky"},n1={class:"feed_user"},l1=["href"],a1=["href"],r1={class:"fcom_feed_title_row"},c1=["textContent"],d1={key:0,class:"feed_status"},u1={key:1,class:"feed_status"},_1={class:"fcom_feed_meta"},m1={key:0},h1={class:"feed_actions"},f1={class:"num_label"},p1={class:"num_label"};function g1(e,t,s,u,o,i){var k,$,v;const m=p("StickyIcon"),f=j,h=p("UserAvatar"),g=Ee,w=p("HeartIcon"),b=H,S=p("ChatIcon");return n(),c("div",{id:"feed_id_"+((k=s.feed)==null?void 0:k.id),class:"fcom_feed_list"},[l("div",o1,[s.feed.is_sticky?(n(),c("div",i1,[a(f,{class:"fcom_sticky"},{default:r(()=>[a(m)]),_:1})])):_("",!0),l("div",n1,[l("a",{href:i.getFeedHref(),onClick:t[0]||(t[0]=(...C)=>i.goToFeedView&&i.goToFeedView(...C))},[a(h,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"])],8,l1)]),l("a",{href:i.getFeedHref(),onClick:t[1]||(t[1]=(...C)=>i.goToFeedView&&i.goToFeedView(...C)),class:"feed_body"},[l("div",r1,[l("div",{class:"feed_texts feed_md_content",textContent:d(e.getExcerpt(s.feed.title||s.feed.message_rendered,250))},null,8,c1),s.feed.status=="pending"?(n(),c("span",d1,[a(g,{type:"warning"},{default:r(()=>[V(d(e.$t("In Review")),1)]),_:1})])):_("",!0),s.feed.status=="unlisted"?(n(),c("span",u1,[a(g,{class:"fcom_unlisted_tag"},{default:r(()=>[V(d(e.$t("Unlisted")),1)]),_:1})])):_("",!0)]),l("div",_1,[V(d(((v=($=s.feed)==null?void 0:$.xprofile)==null?void 0:v.display_name)||"No Name")+" • "+d(e.humanDateDiff(s.feed.created_at))+" ",1),!o.in_space&&s.feed.space?(n(),c("span",m1,"• #"+d(s.feed.space.slug),1)):_("",!0)])],8,a1)]),l("div",h1,[a(b,{"aria-label":e.$t("React"),text:""},{default:r(()=>[a(f,{class:R({user_reacted:s.feed.has_user_react}),onClick:t[2]||(t[2]=C=>i.toggleReact())},{default:r(()=>[a(w,{filled:s.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",f1,d(s.feed.reactions_count),1)]),_:1},8,["aria-label"]),a(b,{"aria-label":e.$t("Comment"),onClick:t[3]||(t[3]=C=>i.goToFeedView(C,!0)),text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(S)]),_:1}),l("span",p1,d(s.feed.comments_count),1)]),_:1},8,["aria-label"])])],8,s1)}const wo=I(t1,[["render",g1]]),y1={name:"SwitchTimelineIcon"},v1={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},b1=l("path",{d:"M4 1H13.75V2.5H4V1ZM1.375 2.875C1.07663 2.875 0.790483 2.75647 0.579505 2.5455C0.368526 2.33452 0.25 2.04837 0.25 1.75C0.25 1.45163 0.368526 1.16548 0.579505 0.954505C0.790483 0.743526 1.07663 0.625 1.375 0.625C1.67337 0.625 1.95952 0.743526 2.1705 0.954505C2.38147 1.16548 2.5 1.45163 2.5 1.75C2.5 2.04837 2.38147 2.33452 2.1705 2.5455C1.95952 2.75647 1.67337 2.875 1.375 2.875ZM1.375 8.125C1.07663 8.125 0.790483 8.00647 0.579505 7.7955C0.368526 7.58452 0.25 7.29837 0.25 7C0.25 6.70163 0.368526 6.41548 0.579505 6.2045C0.790483 5.99353 1.07663 5.875 1.375 5.875C1.67337 5.875 1.95952 5.99353 2.1705 6.2045C2.38147 6.41548 2.5 6.70163 2.5 7C2.5 7.29837 2.38147 7.58452 2.1705 7.7955C1.95952 8.00647 1.67337 8.125 1.375 8.125ZM1.375 13.3C1.07663 13.3 0.790483 13.1815 0.579505 12.9705C0.368526 12.7595 0.25 12.4734 0.25 12.175C0.25 11.8766 0.368526 11.5905 0.579505 11.3795C0.790483 11.1685 1.07663 11.05 1.375 11.05C1.67337 11.05 1.95952 11.1685 2.1705 11.3795C2.38147 11.5905 2.5 11.8766 2.5 12.175C2.5 12.4734 2.38147 12.7595 2.1705 12.9705C1.95952 13.1815 1.67337 13.3 1.375 13.3ZM4 6.25H13.75V7.75H4V6.25ZM4 11.5H13.75V13H4V11.5Z",fill:"currentColor"},null,-1),k1=[b1];function w1(e,t,s,u,o,i){return n(),c("svg",v1,k1)}const C1=I(y1,[["render",w1]]),$1={name:"SwitchListIcon"},S1={width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",role:"img",color:"#666666"},V1=l("path",{d:"M2.53168 9.32334C2.79738 9.26497 3.0942 9.25 3.4 9.25H20.6C20.9058 9.25 21.2026 9.26497 21.4683 9.32334C21.7425 9.38357 22.0291 9.49978 22.2647 9.73532C22.5002 9.97086 22.6164 10.2575 22.6767 10.5317C22.735 10.7974 22.75 11.0942 22.75 11.4V12.6C22.75 12.9058 22.735 13.2026 22.6767 13.4683C22.6164 13.7425 22.5002 14.0291 22.2647 14.2647C22.0291 14.5002 21.7425 14.6164 21.4683 14.6767C21.2026 14.735 20.9058 14.75 20.6 14.75H3.4C3.0942 14.75 2.79738 14.735 2.53168 14.6767C2.25749 14.6164 1.97086 14.5002 1.73532 14.2647C1.49978 14.0291 1.38357 13.7425 1.32334 13.4683C1.26497 13.2026 1.25 12.9058 1.25 12.6V11.4C1.25 11.0942 1.26497 10.7974 1.32334 10.5317C1.38357 10.2575 1.49978 9.97086 1.73532 9.73532C1.97086 9.49978 2.25749 9.38357 2.53168 9.32334Z",fill:"var(--fcom-primary-text)"},null,-1),M1=l("path",{opacity:"0.4",d:"M2.53168 1.32334C2.79738 1.26497 3.0942 1.25 3.4 1.25H20.6C20.9058 1.25 21.2026 1.26497 21.4683 1.32334C21.7425 1.38357 22.0291 1.49978 22.2647 1.73532C22.5002 1.97086 22.6164 2.25749 22.6767 2.53168C22.735 2.79738 22.75 3.0942 22.75 3.4V4.6C22.75 4.9058 22.735 5.20262 22.6767 5.46832C22.6164 5.74251 22.5002 6.02914 22.2647 6.26468C22.0291 6.50022 21.7425 6.61643 21.4683 6.67666C21.2026 6.73503 20.9058 6.75 20.6 6.75H3.4C3.0942 6.75 2.79738 6.73503 2.53168 6.67666C2.25749 6.61643 1.97086 6.50022 1.73532 6.26468C1.49978 6.02914 1.38357 5.74251 1.32334 5.46832C1.26497 5.20262 1.25 4.9058 1.25 4.6V3.4C1.25 3.0942 1.26497 2.79738 1.32334 2.53168C1.38357 2.25749 1.49978 1.97086 1.73532 1.73532C1.97086 1.49978 2.25749 1.38357 2.53168 1.32334Z",fill:"var(--fcom-primary-text)"},null,-1),L1=l("path",{opacity:"0.4",d:"M2.53168 17.3233C2.79738 17.265 3.0942 17.25 3.4 17.25H20.6C20.9058 17.25 21.2026 17.265 21.4683 17.3233C21.7425 17.3836 22.0291 17.4998 22.2647 17.7353C22.5002 17.9709 22.6164 18.2575 22.6767 18.5317C22.735 18.7974 22.75 19.0942 22.75 19.4V20.6C22.75 20.9058 22.735 21.2026 22.6767 21.4683C22.6164 21.7425 22.5002 22.0291 22.2647 22.2647C22.0291 22.5002 21.7425 22.6164 21.4683 22.6767C21.2026 22.735 20.9058 22.75 20.6 22.75H3.4C3.0942 22.75 2.79738 22.735 2.53168 22.6767C2.25749 22.6164 1.97086 22.5002 1.73532 22.2647C1.49978 22.0291 1.38357 21.7425 1.32334 21.4683C1.26497 21.2026 1.25 20.9058 1.25 20.6V19.4C1.25 19.0942 1.26497 18.7974 1.32334 18.5317C1.38357 18.2575 1.49978 17.9709 1.73532 17.7353C1.97086 17.4998 2.25749 17.3836 2.53168 17.3233Z",fill:"var(--fcom-primary-text)"},null,-1),T1=[V1,M1,L1];function F1(e,t,s,u,o,i){return n(),c("svg",S1,T1)}const P1=I($1,[["render",F1]]),I1={name:"SwitchCardIcon"},E1={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor"},U1=l("path",{d:"M3 4C3 3.44772 3.44772 3 4 3H10C10.5523 3 11 3.44772 11 4V10C11 10.5523 10.5523 11 10 11H4C3.44772 11 3 10.5523 3 10V4ZM3 14C3 13.4477 3.44772 13 4 13H10C10.5523 13 11 13.4477 11 14V20C11 20.5523 10.5523 21 10 21H4C3.44772 21 3 20.5523 3 20V14ZM13 4C13 3.44772 13.4477 3 14 3H20C20.5523 3 21 3.44772 21 4V10C21 10.5523 20.5523 11 20 11H14C13.4477 11 13 10.5523 13 10V4ZM13 14C13 13.4477 13.4477 13 14 13H20C20.5523 13 21 13.4477 21 14V20C21 20.5523 20.5523 21 20 21H14C13.4477 21 13 20.5523 13 20V14ZM15 5V9H19V5H15ZM15 15V19H19V15H15ZM5 5V9H9V5H5ZM5 15V19H9V15H5Z"},null,-1),A1=[U1];function B1(e,t,s,u,o,i){return n(),c("svg",E1,A1)}const D1=I(I1,[["render",B1]]),R1={name:"DoubleChevronUpIcon",props:{fill:{type:String,default:"currentColor"}}},x1=["fill"],H1=l("path",{d:"M5 13L10 8L15 13",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",fill:"none"},null,-1),O1=l("path",{d:"M5 8L10 3L15 8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",fill:"none"},null,-1),j1=[H1,O1];function N1(e,t,s,u,o,i){return n(),c("svg",{fill:s.fill,width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},j1,8,x1)}const z1=I(R1,[["render",N1]]),q1={name:"ScrollToTop",components:{DoubleChevronUpIcon:z1},props:{threshold:{type:Number,default:200}},data(){return{visible:!1}},methods:{onLayoutScroll(e){this.visible=e.detail.scrollTop>this.threshold},scrollToTop(){window.scrollTo({top:0,behavior:"smooth"})}},mounted(){document.addEventListener("fcom_layout_scroll",this.onLayoutScroll)},beforeUnmount(){document.removeEventListener("fcom_layout_scroll",this.onLayoutScroll)}},G1=["aria-label"],Y1={class:"fcom_scroll_to_top_icon"};function W1(e,t,s,u,o,i){const m=p("DoubleChevronUpIcon");return n(),y(Rs,{"enter-active-class":"fcom_scroll_to_top_enter_active","leave-active-class":"fcom_scroll_to_top_leave_active","enter-from-class":"fcom_scroll_to_top_enter_from","leave-to-class":"fcom_scroll_to_top_leave_to",duration:200},{default:r(()=>[o.visible?(n(),c("button",{key:0,type:"button",class:"fcom_scroll_to_top","aria-label":e.$t("Scroll to top"),onClick:t[0]||(t[0]=(...f)=>i.scrollToTop&&i.scrollToTop(...f))},[l("span",Y1,[a(m)])],8,G1)):_("",!0)]),_:1})}const K1=I(q1,[["render",W1]]);let Z1=0;const J1={name:"AllFeeds",emits:["refetch","update:loading"],inheritAttrs:!1,setup(){const e=Me(),t=Ft();return{feedStore:e,uiStore:t}},props:{space:{type:[String,Number],default(){return null}},user_id:{type:[String,Number],default(){return null}},hide_create_form:{type:Boolean,default(){return!1}},hide_filters:{type:Boolean,default(){return!1}},feed_base_url:{type:String,default(){return"feeds"}},default_search:{type:String,default(){return""}},searchIn:{type:Array,default(){return["post_content"]}},layout_style:{type:String,default(){return"timeline"}},feed_name:{type:String,default(){return""}},topic_slug:{type:[String,Number],default(){return null}},can_change_order:{type:Boolean,default(){return!0}},default_order_by:{type:String,default(){return""}},can_change_layout:{type:Boolean,default(){return!0}},context_suffix:{type:String,default(){return""}}},components:{CreateStatusForm:Rt,Feed:nt,FeedCard:e1,FeedListItem:wo,SwitchTimelineIcon:C1,SwitchListIcon:P1,SwitchCardIcon:D1,ScrollToTop:K1},watch:{space(e){this.canReuseCachedFeeds()?this.scheduleStalenessRefresh():this.fetchFeedsFromStore(),this.restoreLayoutPreference()},search(){this.fetchFeedsFromStore()},loading(e){this.$emit("update:loading",e)},topic_slug(){this.feedStore.resetContext(this.feedContext),this.fetchFeedsFromStore()},"$route.query.search"(e){this.search=e||""}},computed:{feedContext(){let e;return this.space?e=`space-${this.space}`:this.user_id?e=`user-${this.user_id}`:e="global",this.context_suffix?`${e}:${this.context_suffix}`:e},feeds(){return this.feedStore.getFeedsByContext(this.feedContext)},sticky(){return this.feedStore.getStickyFeed(this.feedContext)},pagination(){return this.feedStore.getPagination(this.feedContext)},loading(){return this.feedStore.isLoading(this.feedContext)},execution_time(){return this.feedStore.getExecutionTime(this.feedContext)},disableAutoLoad(){return this.feedStore.disableAutoLoad(this.feedContext)},currentLayoutStyle(){return this.can_change_layout?this.custom_layout_style:this.layout_style},computedPostOrderOptions(){return this.user_id?this.appVars.user_post_order_by_options:this.appVars.post_order_by_options},isOwnProfile(){return!!(this.user_id&&this.auth.user_id&&this.user_id==this.auth.user_id)},canFilterStatus(){return this.has_pro&&(this.isCommunityModerator()||this.isOwnProfile)},visibilityOptions(){return[{value:"",label:this.$t("All")},{value:"published",label:this.$t("Published")},{value:"unlisted",label:this.$t("Unlisted")},{value:"pending",label:this.$t("In Review")},{value:"scheduled",label:this.$t("Scheduled")}]},currentSortLabel(){const e=this.computedPostOrderOptions||{};return e[this.sort_by]||Object.values(e)[0]||this.$t("Latest")},sortGroupLabelId(){return"fcom_feed_filter_sort_"+this.filterUid},visibilityGroupLabelId(){return"fcom_feed_filter_visibility_"+this.filterUid},activeVisibilityLabel(){if(!this.status_filter)return"";const e=this.visibilityOptions.find(t=>t.value===this.status_filter);return e?e.label:""},triggerAriaLabel(){return this.activeVisibilityLabel?this.$t("Sort: %1$s, visibility: %2$s",this.currentSortLabel,this.activeVisibilityLabel):this.$t("Sort: %s",this.currentSortLabel)}},data(){return{appReady:!0,filterUid:Z1++,sort_by:"",status_filter:"",filterPopperOptions:{modifiers:[{name:"flip",options:{fallbackPlacements:["top-end","bottom-end"],padding:8}},{name:"preventOverflow",options:{boundary:"viewport",padding:8}}]},search:this.$route.query.search||"",custom_layout_style:this.layout_style,disable_sticky:!1,boundHandler:null}},methods:{...Gs(Me,["fetchFeeds","createFeed","updateFeed","deleteFeed","resetContext"]),currentFilterKey(){return JSON.stringify({search:this.search||"",order_by_type:this.sort_by||"",topic_slug:this.topic_slug||"",status:this.status_filter||""})},canReuseCachedFeeds(){var t,s;const e=(t=this.feedStore.feedsByContext)==null?void 0:t[this.feedContext];return(s=e==null?void 0:e.data)!=null&&s.length?e.filterKey===this.currentFilterKey():!1},scheduleStalenessRefresh(){var s;this.feedStore.touchContext(this.feedContext);const t=(s=this.feedStore.feedsByContext)==null?void 0:s[this.feedContext];t!=null&&t.timestamp&&(Date.now()-t.timestamp<6e4||this.feedStore.softRefreshContext(this.feedContext,{feed_base_url:this.feed_base_url,per_page:this.pagination.per_page||10,space:this.space,user_id:this.user_id,order_by_type:this.sort_by,search:this.search,disable_sticky:this.disable_sticky,topic_slug:this.topic_slug,status:this.status_filter,search_in:this.searchIn}))},async fetchFeedsFromStore(e=!1){try{await this.feedStore.fetchFeeds(this.feedContext,{feed_base_url:this.feed_base_url,page:e?this.pagination.page:1,per_page:this.pagination.per_page||10,space:this.space,user_id:this.user_id,order_by_type:this.sort_by,search:this.search,disable_sticky:this.disable_sticky,topic_slug:this.topic_slug,status:this.status_filter,search_in:this.searchIn},e)}catch(t){this.$handleError(t)}},selectSortBy(e){this.sort_by!==e&&(this.sort_by=e,this.resetFetch())},selectStatusFilter(e){this.status_filter!==e&&(this.status_filter=e,this.resetFetch())},async handleDelete(e){const t=this.feeds[e];if(t)try{await this.feedStore.deleteFeed(this.feedContext,t.id,e),this.$notify.success(this.$t("Post deleted successfully"))}catch(s){this.$handleError(s)}},handleRemoveFromList(e){const t=this.feeds[e];t&&this.feedStore.deleteFeedsFromStore(this.feedContext,[t.id])},async handleUpdate(e,t){try{await this.feedStore.updateFeed(e.id,e)}catch(s){this.$handleError(s)}},handleLoadMore(){var o;if(this.disableAutoLoad)return!1;if(this.pagination.last_page==this.pagination.page)return;let e=document.querySelector(".all_feeds_holder .feed_outer:last-child");if(!e)return;let t=e.getBoundingClientRect(),s=(o=window.fcomLayoutRef)==null?void 0:o.wrapRef;!s||t.bottom-s.getBoundingClientRect().bottom-t.height>100||this.loading||this.fetchFeedsFromStore(!0)},resetFetch(){!this.hide_filters&&!this.default_search&&!this.user_id&&(this.$storeLocalData("feed_sort_by",this.sort_by),this.$storeLocalData("feed_status_filter",this.status_filter)),this.disable_sticky="yes",this.feedStore.resetContext(this.feedContext),this.fetchFeedsFromStore()},spaceChanged(){this.feedStore.resetContext(this.feedContext),this.fetchFeedsFromStore()},routeNewArticle(){this.space?this.$router.push({name:"space_write_article",params:{space:this.space}}):this.$router.push({name:"write_article"})},switchView(e){this.custom_layout_style!=e&&(this.custom_layout_style=e,this.can_change_layout&&this.feed_name&&this.hasFeature("can_switch_layout")&&this.$storeLocalData("feed_layout_style_"+this.feed_name,e),this.$notify.success(this.$t("Layout changed")))},restoreLayoutPreference(){if(this.can_change_layout&&this.feed_name&&this.hasFeature("can_switch_layout")){let e=this.$getLocalData("feed_layout_style_"+this.feed_name);this.custom_layout_style=e||this.layout_style}else this.custom_layout_style=this.layout_style}},created(){if(this.default_search&&(this.search=this.default_search),this.default_order_by&&!this.can_change_order?this.sort_by=this.default_order_by:!this.hide_filters&&!this.default_search&&(this.user_id?this.sort_by="":this.sort_by=this.$getLocalData("feed_sort_by")||""),this.$route.query.sort_by&&(this.sort_by=this.$route.query.sort_by),this.sort_by||(this.sort_by=this.default_order_by||"latest"),this.isCommunityModerator()&&!this.hide_filters&&!this.default_search&&!this.user_id&&(this.status_filter=this.$getLocalData("feed_status_filter")||""),this.canReuseCachedFeeds()){this.scheduleStalenessRefresh();return}this.fetchFeedsFromStore()},mounted(){this.restoreLayoutPreference(),this.boundHandler=this.handleLoadMore.bind(this),document.addEventListener("fcom_layout_scroll",this.boundHandler),this.$eventBus.on("doGlobalSearch",e=>{this.loading||this.search!=e&&(this.search=e,this.pagination.page=1,this.$router.push({query:{search:e}}))})},beforeUnmount(){this.$eventBus.emit("leaving_all_feeds"),document.removeEventListener("fcom_layout_scroll",this.boundHandler),this.$eventBus.off("doGlobalSearch"),this.feeds&&this.feeds.length>50&&this.feedStore.pruneOldFeeds()}},Q1={key:1,class:"feed_filters"},X1=l("div",{class:"fcom_feed_divider"},null,-1),eg={class:"fcom_feed_filter_value"},tg={key:1,class:"fcom_feed_filter_active"},sg={key:0,role:"presentation",class:"fcom_feed_filter_group"},og=["id"],ig=["aria-labelledby"],ng={key:1,role:"presentation",class:"fcom_feed_filter_group"},lg=["id"],ag=["aria-labelledby"],rg={key:1,class:"fcom_layout_switch"},cg={class:"fcom_icon_menu"},dg={class:"fcom_icon_menu"},ug={class:"fcom_icon_menu"},_g={key:2,style:{margin:"0 0 10px"},class:"fcom_search_result_num"},mg={key:0},hg={key:3,class:"fcom_sticky_feed"},fg={class:"all_feeds_holder"},pg={key:0,style:{"margin-top":"20px","text-align":"center"}},gg={key:5},yg={class:"feed_outer"},vg={class:"feed"},bg={style:{"text-align":"center"},class:"feed_body not_found"},kg={key:0},wg={key:1},Cg={key:2};function $g(e,t,s,u,o,i){const m=p("create-status-form"),f=p("Operation"),h=j,g=p("ArrowDown"),w=H,b=ze,S=qe,k=Ge,$=p("SwitchCardIcon"),v=p("SwitchListIcon"),C=p("SwitchTimelineIcon"),L=p("feed"),M=p("FeedListItem"),E=p("FeedCard"),T=Z,P=p("ScrollToTop");return n(),c(F,null,[Y(e.$slots,"before_create_form"),!s.hide_create_form&&e.auth.user_id?(n(),y(m,{key:0,space:s.space,btn_text:e.$t("Post")},null,8,["space","btn_text"])):_("",!0),Y(e.$slots,"before_feeds"),s.hide_filters?_("",!0):(n(),c("div",Q1,[X1,s.can_change_order||i.canFilterStatus?(n(),y(k,{key:0,class:"fcom_feed_filter_dropdown","popper-class":"fcom_feed_filter_pop",trigger:"click",placement:"bottom-end","popper-options":o.filterPopperOptions},{dropdown:r(()=>[a(S,{class:"fcom_feed_filter_menu"},{default:r(()=>[s.can_change_order?(n(),c("li",sg,[l("span",{id:i.sortGroupLabelId,class:"fcom_feed_filter_group_label"},d(e.$t("Sort by")),9,og),l("ul",{role:"group","aria-labelledby":i.sortGroupLabelId,class:"fcom_feed_filter_group_list"},[(n(!0),c(F,null,x(i.computedPostOrderOptions,(U,D)=>(n(),y(b,{key:D,class:R({fcom_feed_filter_selected:o.sort_by===D}),onClick:A=>i.selectSortBy(D)},{default:r(()=>[V(d(U),1)]),_:2},1032,["class","onClick"]))),128))],8,ig)])):_("",!0),i.canFilterStatus?(n(),c("li",ng,[l("span",{id:i.visibilityGroupLabelId,class:R(["fcom_feed_filter_group_label",{fcom_feed_filter_group_divided:s.can_change_order}])},d(e.$t("Visibility")),11,lg),l("ul",{role:"group","aria-labelledby":i.visibilityGroupLabelId,class:"fcom_feed_filter_group_list"},[(n(!0),c(F,null,x(i.visibilityOptions,U=>(n(),y(b,{key:U.value,class:R({fcom_feed_filter_selected:o.status_filter===U.value}),onClick:D=>i.selectStatusFilter(U.value)},{default:r(()=>[V(d(U.label),1)]),_:2},1032,["class","onClick"]))),128))],8,ag)])):_("",!0)]),_:1})]),default:r(()=>[a(w,{text:"",class:"fcom_feed_filter_trigger","aria-label":i.triggerAriaLabel},{default:r(()=>[i.canFilterStatus?(n(),c("span",{key:0,class:R(["fcom_feed_filter_icon",{"is-active":!!o.status_filter}])},[a(h,null,{default:r(()=>[a(f)]),_:1})],2)):_("",!0),l("span",eg,d(i.currentSortLabel),1),i.activeVisibilityLabel?(n(),c("span",tg,"("+d(i.activeVisibilityLabel)+")",1)):_("",!0),a(h,{class:"fcom_feed_filter_caret"},{default:r(()=>[a(g)]),_:1})]),_:1},8,["aria-label"])]),_:1},8,["popper-options"])):_("",!0),s.can_change_layout&&s.feed_name&&e.hasFeature("can_switch_layout")?(n(),c("div",rg,[a(k,{"popper-class":"fcom_pop_buttons",trigger:"click"},{dropdown:r(()=>[a(S,{class:"fcom_layout_dropdown_menu"},{default:r(()=>[a(b,{onClick:t[0]||(t[0]=U=>i.switchView("card")),class:R({selected_layout:o.custom_layout_style==="card"})},{default:r(()=>[l("div",cg,[a($),l("span",null,d(e.$t("Card")),1)])]),_:1},8,["class"]),a(b,{onClick:t[1]||(t[1]=U=>i.switchView("list")),class:R({selected_layout:o.custom_layout_style==="list"})},{default:r(()=>[l("div",dg,[a(v),l("span",null,d(e.$t("List")),1)])]),_:1},8,["class"]),a(b,{onClick:t[2]||(t[2]=U=>i.switchView("timeline")),class:R({selected_layout:o.custom_layout_style==="timeline"})},{default:r(()=>[l("div",ug,[a(C),l("span",null,d(e.$t("Timeline")),1)])]),_:1},8,["class"])]),_:1})]),default:r(()=>[a(w,{type:"info",text:"",title:e.$t("Switch Layout View")},{default:r(()=>[a(h,{class:R(["fcom_layout_icon",o.custom_layout_style])},{default:r(()=>[o.custom_layout_style=="card"?(n(),y($,{key:0})):o.custom_layout_style=="list"?(n(),y(v,{key:1})):(n(),y(C,{key:2}))]),_:1},8,["class"])]),_:1},8,["title"])]),_:1})])):_("",!0)])),i.pagination.total&&o.search?(n(),c("div",_g,[V(d(e.$_n("%s result found","%s results found",i.pagination.total))+" ",1),i.execution_time?(n(),c("span",mg,d(e.$t("in %ss",i.execution_time.toFixed(2))),1)):_("",!0)])):_("",!0),i.sticky?(n(),c("div",hg,[a(L,{onReload:t[3]||(t[3]=U=>{i.sticky=null,e.fetchFeeds()}),onFeedUpdated:t[4]||(t[4]=U=>{i.sticky=U}),onDeleted:t[5]||(t[5]=()=>{i.sticky=null}),feed:i.sticky,show_report:!0,isSingleSpacePage:!!s.space},null,8,["feed","isSingleSpacePage"])])):_("",!0),i.feeds.length?(n(),c("div",{key:4,ref:"all_feeds_wrap",class:R(["fcom_feed_style_"+i.currentLayoutStyle,"all_feeds"])},[l("div",fg,[(n(!0),c(F,null,x(i.feeds,(U,D)=>(n(),c("div",{key:U.id,class:"feed_outer"},[i.currentLayoutStyle=="list"?(n(),y(M,{key:0,feed:U},null,8,["feed"])):i.currentLayoutStyle=="card"?(n(),y(E,{key:1,feed:U,hide_create_form:s.hide_create_form,onUpdated:A=>i.handleUpdate(A,D),onDeleted:()=>i.handleDelete(D),onRemoved:()=>i.handleRemoveFromList(D)},null,8,["feed","hide_create_form","onUpdated","onDeleted","onRemoved"])):(n(),y(L,{key:2,feed:U,isSingleSpacePage:!!s.space,show_report:!0,layout_style:i.currentLayoutStyle,hide_create_form:s.hide_create_form,onUpdated:A=>i.handleUpdate(A,D),onDeleted:()=>i.handleDelete(D),onRemoved:()=>i.handleRemoveFromList(D)},null,8,["feed","isSingleSpacePage","layout_style","hide_create_form","onUpdated","onDeleted","onRemoved"]))]))),128))]),i.pagination.has_more!==!1?(n(),c("div",pg,[a(w,{class:"fcom_secondary_button",disabled:i.loading,loading:i.loading,onClick:t[6]||(t[6]=U=>i.fetchFeedsFromStore(!0))},{default:r(()=>[V(d(e.$t("Load more")),1)]),_:1},8,["disabled","loading"])])):_("",!0)],2)):!i.loading&&!i.sticky?(n(),c("div",gg,[l("div",yg,[l("div",vg,[l("div",bg,[o.search?(n(),c("p",kg,d(e.$t("No results found based on your search criteria")),1)):s.topic_slug?(n(),c("p",wg,d(e.$t("No posts found for the selected topic")),1)):(n(),c("p",Cg,d(e.$t("No posts found!")),1))])])])])):_("",!0),i.loading&&!i.feeds.length?(n(),c(F,{key:6},[a(T,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5}),i.pagination.page==1?(n(),c(F,{key:0},[a(T,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5}),a(T,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5})],64)):_("",!0)],64)):_("",!0),a(P,{threshold:500})],64)}const gt=I(J1,[["render",$g]]),Sg={name:"SearchBar",components:{SpaceIcon:Ze,AllFeeds:gt,SearchIcon:Ie,Loading:di},data(){return{search:"",SearchIcon:Xt(Ie),showingSearch:!1,perform_search:!1,searching:!1,searchGroups:[],search_space:"__all__",searchIn:["post_content"]}},computed:{placeholder(){return this.search_space!="__all__"?this.$t("Search in %s","#"+this.search_space):this.$t("Search here...")}},methods:{onRouteUpdated(){this.showingSearch=!1},initSearch(){this.openSearch()},openSearch(){this.search||(this.perform_search=!1,this.search_space=this.$route.params.space||"__all__",this.searchIn=["post_content"]),this.showingSearch=!0,this.handleOpen()},toSearch(){if(!this.search){this.perform_search=!1;return}if(this.perform_search&&this.$refs.feedsRef){this.$refs.feedsRef.search=this.search;return}this.perform_search=!0},onClear(){this.search="",this.perform_search=!1},handleScroll(e){if(this.$refs.feedsScroller.wrapRef.scrollHeight-this.$refs.feedsScroller.wrapRef.clientHeight-e.scrollTop<100){let s=this.$refs.feedsRef;!s.loading&&s.pagination.page<s.pagination.last_page&&(s.pagination.page++,s.fetchFeeds(!0))}},keyBind(e){e.key==="k"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.showingSearch?this.showingSearch=!1:this.openSearch())},handleOpen(){this.formatSearchGroups()},focusInput(){this.$refs.seatch_input&&this.$refs.seatch_input.focus()},formatSearchGroups(){if(this.searchGroups.length)return;let e=this.appVars.auth.spaces;e=Object.values(e);let t=this.appVars.space_groups,s=[];this.each(t,u=>{let o=e.filter(i=>i.parent_id==u.id&&i.permissions&&i.permissions.can_view_posts);o.length&&s.push({label:u.title,spaces:o})}),this.searchGroups=s}},mounted(){document.addEventListener("keydown",this.keyBind),this.$eventBus.on("route_updated",this.onRouteUpdated)},beforeUnmount(){document.removeEventListener("keydown",this.keyBind),this.$eventBus.off("route_updated",this.onRouteUpdated)}},Vg=["aria-label"],Mg={class:"fcom_search_header"},Lg={key:0,class:"fcom_space_title"},Tg={key:1},Fg={style:{display:"flex","align-items":"center","flex-wrap":"wrap",gap:"10px",margin:"10px 20px 0","justify-content":"center"}},Pg={key:0,class:"fcom_search_results"},Ig={key:1,class:"fcom_search_welcome"},Eg=l("b",null,"⌘ + K",-1),Ug=l("b",null,"Ctrl + K",-1);function Ag(e,t,s,u,o,i){const m=p("SearchIcon"),f=j,h=p("Loading"),g=ne,w=p("SpaceIcon"),b=Ct,S=le,k=se,$=he,v=Os,C=p("all-feeds"),L=ke,M=be;return n(),c(F,null,[l("button",{class:"fcom_menu_button","aria-label":e.$t("Search"),onClick:t[0]||(t[0]=E=>i.initSearch())},[a(f,{id:"fcom_search_icon",class:"fcom_search_icon"},{default:r(()=>[a(m)]),_:1})],8,Vg),o.showingSearch?(n(),y(M,{key:0,top:"60px","append-to-body":!0,"lock-scroll":!0,"modal-class":"fcom_search_bar_visible",onOpened:i.focusInput,modelValue:o.showingSearch,"onUpdate:modelValue":t[5]||(t[5]=E=>o.showingSearch=E),"show-close":!1,style:{"max-width":"700px"},width:e.drawerWidth},{header:r(()=>[l("div",Mg,[a(k,{ref:"seatch_input",size:"large",type:"search",autocomplete:"off",inputmode:"search",modelValue:o.search,"onUpdate:modelValue":t[2]||(t[2]=E=>o.search=E),placeholder:i.placeholder,onKeyup:oe(i.toSearch,["enter"]),onClear:i.onClear,clearable:""},ge({prefix:r(()=>[a(f,{onClick:i.toSearch},{default:r(()=>[a(m)]),_:1},8,["onClick"])]),append:r(()=>[a(S,{class:"fcom_minimal_select fcom_global_search_append",modelValue:o.search_space,"onUpdate:modelValue":t[1]||(t[1]=E=>o.search_space=E),placeholder:e.$t("All Posts"),style:{width:"100px"}},{default:r(()=>[a(g,{label:e.$t("All Posts"),value:"__all__"},null,8,["label"]),(n(!0),c(F,null,x(o.searchGroups,E=>(n(),y(b,{key:E.label,label:E.label},{default:r(()=>[(n(!0),c(F,null,x(E.spaces,T=>(n(),y(g,{key:T.slug,label:T.title,value:T.slug},{default:r(()=>[T.id?(n(),c("span",Lg,[a(w,{space_profile:T},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(T.title,30)),1)])):(n(),c("span",Tg,d(e.getExcerpt(T.title,30)),1))]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:2},[o.searching?{name:"suffix",fn:r(()=>[a(f,{class:"is-loading fcom_search_spinner"},{default:r(()=>[a(h)]),_:1})]),key:"0"}:void 0]),1032,["modelValue","placeholder","onKeyup","onClear"]),l("div",Fg,[l("span",null,d(e.$t("Search in:")),1),a(v,{modelValue:o.searchIn,"onUpdate:modelValue":t[3]||(t[3]=E=>o.searchIn=E),class:"fcom_search_in"},{default:r(()=>[a($,{value:"post_content",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Post Title & Content")),1)]),_:1}),a($,{value:"post_comments",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Comments")),1)]),_:1})]),_:1},8,["modelValue"])])])]),default:r(()=>[o.perform_search?(n(),c("div",Pg,[a(L,{ref:"feedsScroller",onScroll:i.handleScroll,style:{"padding-right":"20px"},height:"70vh"},{default:r(()=>[a(C,{searchIn:o.searchIn,layout_style:"list",feed_name:"search_results",context_suffix:"search",space:o.search_space!="__all__"?o.search_space:"",ref:"feedsRef",default_search:o.search,hide_filters:!1,hide_create_form:!0,"onUpdate:loading":t[4]||(t[4]=E=>o.searching=E)},null,8,["searchIn","space","default_search"])]),_:1},8,["onScroll"])])):(n(),c("div",Ig,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h3",null,d(e.$t("Search for anything")),1),l("p",null,d(e.$t("Try searching for keywords in posts")),1),l("p",null,[V(d(e.$t("Tip: Quick-launch search with"))+" ",1),Eg,V(" (Mac) "+d(e.$t("or"))+" ",1),Ug,V(" (Windows/Linux)")])]))]),_:1},8,["onOpened","modelValue","width"])):_("",!0)],64)}const Bg=I(Sg,[["render",Ag]]),Dg={name:"Drawer",emits:["update:modelValue"],props:{modelValue:{type:Boolean,required:!0},title:{type:String,default:""},size:{type:String,default:"40%"},direction:{type:String,default:"right",validator:e=>["left","right","top","bottom"].includes(e)},closeOnClickModal:{type:Boolean,default:!1},appendToBody:{type:Boolean,default:!1},destroyOnClose:{type:Boolean,default:!1},modal:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},withHeader:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},openDelay:{type:Number,default:0},closeDelay:{type:Number,default:0},zIndex:{type:Number,default:null},id:{type:String,default:""},modalClass:{type:String,default:"fcom_common_dialog"},drawerClass:{type:String,default:"fcom_high_drawer"},headerClass:{type:String,default:""},bodyClass:{type:String,default:""},footerClass:{type:String,default:""},hasCloseConfirmation:{type:Boolean,default:!1},closeConfirmationMessage:{type:String,default:""},confirmLeaveAction:{type:Function,default:null},cancelLeaveAction:{type:Function,default:null},beforeClose:{type:Function,default:null}},computed:{elDirection(){return{left:"ltr",right:"rtl",top:"ttb",bottom:"btt"}[this.direction]||"rtl"}},methods:{handleBeforeClose(e){const t=()=>{this.beforeClose?this.beforeClose(e):e()};if(this.hasCloseConfirmation){const s=this.closeConfirmationMessage||this.$t("Are you sure you want to close this?");this.$confirm(s,this.$t("Confirm"),{confirmButtonText:this.$t("Yes"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.confirmLeaveAction&&this.confirmLeaveAction(),t()}).catch(()=>{this.cancelLeaveAction&&this.cancelLeaveAction()})}else t()}}},Rg=["id"];function xg(e,t,s,u,o,i){const m=es;return n(),y(m,qo({"model-value":s.modelValue,"onUpdate:modelValue":t[0]||(t[0]=f=>e.$emit("update:modelValue",f)),direction:i.elDirection,size:s.size,modal:s.modal,"modal-class":s.modalClass,class:s.drawerClass,"close-on-click-modal":s.closeOnClickModal,"append-to-body":s.appendToBody,"destroy-on-close":s.destroyOnClose,"show-close":s.showClose,"with-header":s.withHeader,"lock-scroll":s.lockScroll,"open-delay":s.openDelay,"close-delay":s.closeDelay},s.zIndex!==null?{"z-index":s.zIndex}:{},{id:s.id,"before-close":i.handleBeforeClose}),ge({default:r(()=>[l("div",{class:R(s.bodyClass)},[Y(e.$slots,"default")],2)]),_:2},[s.withHeader?{name:"header",fn:r(({close:f,titleId:h,titleClass:g})=>[Y(e.$slots,"header",{close:f,titleId:h,titleClass:g},()=>[s.title?(n(),c("h4",{key:0,id:h,class:R([g,s.headerClass]),style:{margin:"0"}},d(s.title),11,Rg)):_("",!0)])]),key:"0"}:void 0,e.$slots.footer?{name:"footer",fn:r(()=>[l("div",{class:R(s.footerClass)},[Y(e.$slots,"footer")],2)]),key:"1"}:void 0]),1040,["model-value","direction","size","modal","modal-class","class","close-on-click-modal","append-to-body","destroy-on-close","show-close","with-header","lock-scroll","open-delay","close-delay","id","before-close"])}const ps=I(Dg,[["render",xg]]);const Hg={name:"SvgShapeGenerator",emits:["update"],data(){return{currentColor:"",selectedShape:"circle"}},computed:{svgShapes(){return{circle:`<svg class="fcom_shape fcom_shape_circle" viewBox="0 0 24 24" fill="${this.currentColor}" width="24px" height="24px"><path d="M0 0h24v24H0z" fill="none"/><circle cx="12" cy="12" r="12"/></svg>`,square:`<svg class="fcom_shape fcom_shape_square" viewBox="0 0 24 24" fill="${this.currentColor}" width="24px" height="24px"><path d="M0 0h24v24H0z" fill="none"/><rect x="0" y="0" width="24" height="24"/></svg>`,triangle:`<svg class="fcom_shape fcom_shape_triangle" viewBox="0 0 24 24" fill="${this.currentColor}" width="24px" height="24px"><path d="M0 0h24v24H0z" fill="none"/><path d="M21 12L2 2v20z"/></svg>`,star:`<svg class="fcom_shape fcom_shape_star" viewBox="0 0 24 24" width="24" height="24"><polygon points="12,2.4 14.6,8.4 21.6,8.4 15.6,13.2 18,19.6 12,15.6 6,19.6 8.4,13.2 2.4,8.4 9.4,8.4" fill="${this.currentColor}"/></svg>`,heart:`<svg class="fcom_shape fcom_shape_heart" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" fill="${this.currentColor}"/></svg>`,diamond:`<svg class="fcom_shape fcom_shape_diamond" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><polygon points="12,2 22,12 12,22 2,12" fill="${this.currentColor}"/></svg>`}}},methods:{selectShape(e){this.selectedShape=e,this.$emit("update",this.svgShapes[e])},colorChanged(e){this.currentColor=e,this.$emit("update",this.svgShapes[this.selectedShape])}}},Og={class:"fcom_svg_generator"},jg={class:"fcom_form_item"},Ng={class:"fcom_form_item"},zg=["innerHTML"];function qg(e,t,s,u,o,i){const m=$t,f=Ne,h=ve;return n(),c("div",Og,[l("div",jg,[l("label",null,d(e.$t("Select Shape Color:")),1),a(m,{predefine:e.appVars.suggestedColors,modelValue:o.currentColor,"onUpdate:modelValue":t[0]||(t[0]=g=>o.currentColor=g),onActiveChange:i.colorChanged,size:"large","show-alpha":""},null,8,["predefine","modelValue","onActiveChange"])]),l("div",Ng,[l("label",null,d(e.$t("Select Shape:")),1),a(h,{onChange:t[1]||(t[1]=g=>i.selectShape(o.selectedShape)),modelValue:o.selectedShape,"onUpdate:modelValue":t[2]||(t[2]=g=>o.selectedShape=g)},{default:r(()=>[(n(!0),c(F,null,x(i.svgShapes,(g,w)=>(n(),y(f,{key:w,value:w},{default:r(()=>[l("div",{innerHTML:g},null,8,zg)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])])])}const Gg=I(Hg,[["render",qg]]),Yg={name:"LogoEmojiSelector",components:{EmojiPicker:uo,ImageUploader:xe,SvgShapeGenerator:Gg,ActionPopover:Ke},props:{config:{type:Object,required:!0,default:()=>({emoji:"",logo:"",shape_svg:""})},fallback_mark:{type:String,default:'<span class="fcom_no_avatar"></span>'},custom_svg:{type:Boolean,default:!1}},data(){return{emoji:this.config.emoji||"",logo:this.config.logo||"",shape_svg:this.config.shape_svg||"",selectedTab:"emoji"}},methods:{setData(e){e=="emoji"?(this.logo="",this.shape_svg=""):e=="shape_svg"?(this.emoji="",this.logo=""):(this.emoji="",this.shape_svg=""),this.$emit("update",{logo:this.logo,emoji:this.emoji,shape_svg:this.shape_svg})},handleLogoPhotoUpload(e){this.logo=e,this.setData("logo")},handleShapeChanged(e){this.shape_svg=e,this.setData("shape_svg")}},computed:{currentMark(){return this.logo?`<img alt="" src="${this.logo}" style="width: 20px; height: 20px; aspect-ratio: 1/1;">`:this.emoji.trim()?`<span style="font-size: 20px">${this.emoji.trim()}</span>`:this.shape_svg?'<i class="fcom_shape el-icon">'+this.shape_svg+"</i>":this.fallback_mark}},mounted(){if(this.logo)this.selectedTab="logo";else if(this.emoji)this.selectedTab="emoji";else if(this.shape_svg){if(this.custom_svg&&!/fcom_shape/.test(this.shape_svg)){this.selectedTab="shape_svg";return}this.selectedTab="shape"}}},Wg=["innerHTML"];function Kg(e,t,s,u,o,i){const m=H,f=p("EmojiPicker"),h=se,g=St,w=p("SvgShapeGenerator"),b=Fe,S=p("ImageUploader"),k=Vt,$=p("action-popover");return n(),y($,{ref:"iconPicker","close-on-click-outside":!0,"trigger-interactive":!0,teleported:!0,width:e.modalWidth},{trigger:r(()=>[a(m,{"aria-label":"Pick Emoji",style:{padding:"4px 16px",display:"flex","justify-content":"center","align-items":"center"}},{default:r(()=>[l("span",{class:"logo_emoji_holder",style:{cursor:"pointer"},innerHTML:i.currentMark||""},null,8,Wg)]),_:1})]),default:r(({hide:v})=>[l("div",null,[a(k,{modelValue:o.selectedTab,"onUpdate:modelValue":t[5]||(t[5]=C=>o.selectedTab=C),type:"border-card"},{default:r(()=>[a(g,{name:"emoji",label:e.$t("Emoji")},{default:r(()=>[a(h,{onChange:t[1]||(t[1]=C=>i.setData("emoji")),modelValue:o.emoji,"onUpdate:modelValue":t[2]||(t[2]=C=>o.emoji=C),placeholder:e.$t("Select or paste your emoji here"),style:{width:"100%"}},ge({_:2},[e.has_pro?{name:"append",fn:r(()=>[a(f,{close_on_select:!0,onEmojiSelected:t[0]||(t[0]=C=>{o.emoji=C,i.setData("emoji")})})]),key:"0"}:void 0]),1032,["modelValue","placeholder"])]),_:1},8,["label"]),a(g,{name:"shape",label:e.$t("Shape")},{default:r(()=>[a(w,{onUpdate:i.handleShapeChanged},null,8,["onUpdate"])]),_:1},8,["label"]),s.custom_svg?(n(),y(g,{key:0,name:"shape_svg",label:e.$t("Custom SVG")},{default:r(()=>[a(h,{rows:4,type:"textarea",onChange:t[3]||(t[3]=C=>i.setData("shape_svg")),modelValue:o.shape_svg,"onUpdate:modelValue":t[4]||(t[4]=C=>o.shape_svg=C),placeholder:e.$t("Paste your SVG here"),style:{width:"100%"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(g,{name:"logo",label:e.$t("Custom Image")},{default:r(()=>[o.logo?(n(),y(b,{key:0,alt:e.$t("Logo"),src:o.logo,style:{"max-width":"100px"}},null,8,["alt","src"])):_("",!0),a(S,{can_remove:!!o.logo,isTextBtn:!1,additionalData:{resize:!0,max_width:400},onUploaded:i.handleLogoPhotoUpload},null,8,["can_remove","onUploaded"])]),_:1},8,["label"])]),_:1},8,["modelValue"]),a(m,{onClick:C=>v(),type:"success",plain:"",class:"fcom_mt_20"},{default:r(()=>[V(d(e.$t("Close")),1)]),_:2},1032,["onClick"])])]),_:1},8,["width"])}const xt=I(Yg,[["render",Kg]]),Zg={name:"SlugInput",emits:["update:modelValue"],props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},is_inital_inactive:{type:Boolean,default:!1},edit_notice:{type:String,default:""},popMessage:{type:String,default:""},description:{type:String,default:""},prefix:{type:String,default:""}},watch:{modelValue(e){this.model=e}},data(){return{model:this.modelValue,showEdit:this.is_inital_inactive}},methods:{updateSlug(){this.model=this.model.replace(/\s/g,"-"),this.model=this.model.replace(/[^a-zA-Z0-9-_]/g,""),this.$emit("update:modelValue",this.model)},confirmEditInit(){this.$confirm(this.popMessage||this.$t("Are you sure you want to change the slug?"),this.$t("Warning"),{confirmButtonText:this.$t("Yes"),cancelButtonText:this.$t("No"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.showEdit=!1})}}},Jg={key:0,class:"fcom_slug_input_info"},Qg=["innerHTML"],Xg={key:1,class:"fcom_help_text"};function ey(e,t,s,u,o,i){const m=H,f=se;return n(),c(F,null,[a(f,{class:"fcom_slug_input",disabled:s.disabled,readonly:o.showEdit,modelValue:o.model,"onUpdate:modelValue":t[1]||(t[1]=h=>o.model=h),ref:"input",placeholder:s.placeholder,onInput:i.updateSlug},ge({_:2},[s.prefix?{name:"prepend",fn:r(()=>[l("span",null,d(s.prefix),1)]),key:"0"}:void 0,o.showEdit?{name:"append",fn:r(()=>[a(m,{onClick:t[0]||(t[0]=h=>i.confirmEditInit()),text:"",type:"info"},{default:r(()=>[V(d(e.$t("change")),1)]),_:1})]),key:"1"}:void 0]),1032,["disabled","readonly","modelValue","placeholder","onInput"]),!o.showEdit&&s.edit_notice?(n(),c("div",Jg,[l("p",{innerHTML:s.edit_notice},null,8,Qg)])):_("",!0),s.description?(n(),c("div",Xg,[l("p",null,d(s.description),1)])):_("",!0)],64)}const Ht=I(Zg,[["render",ey]]),ty={name:"ErrorAlerts",props:{errors:{type:Array,default:()=>[]},dismissable:{type:Boolean,default:!1}},data(){return{dismissed:!1}},watch:{errors(){this.dismissed=!1}}},sy={class:"fcom_errors_alert_list"};function oy(e,t,s,u,o,i){const m=ts;return s.errors.length&&!o.dismissed?(n(),y(m,{key:0,type:"warning",closable:s.dismissable,"show-icon":"",onClose:t[0]||(t[0]=f=>o.dismissed=!0)},{title:r(()=>[l("ul",sy,[(n(!0),c(F,null,x(s.errors,(f,h)=>(n(),c("li",{key:h},d(f),1))),128))])]),_:1},8,["closable"])):_("",!0)}const Ot=I(ty,[["render",oy]]),iy={name:"TopicSelector",props:["modelValue","creatable","space_id"],emits:["update:modelValue"],components:{SlugInput:Ht,ActionPopover:Ke,ErrorAlerts:Ot},data(){return{topics:[],selected:this.modelValue,loading:!1,creatingTopic:!1,newTopicErrors:[],newTopic:{title:"OK"}}},computed:{maxTopicsPerSpace(){var e;return((e=this.appVars.topicsConfig)==null?void 0:e.max_topics_per_space)||20},isTopicLimitReached(){var e;return((e=this.selected)==null?void 0:e.length)>=this.maxTopicsPerSpace}},methods:{getTopicsPlaceholder(){return this.$_n("Choose a topic","Choose up to %s topics",this.maxTopicsPerSpace)},initCreatetopic(){this.newTopicErrors=[],this.newTopic={title:"",description:"",slug:""}},validateForm(){return this.newTopicErrors=[],(!this.newTopic.title||!this.newTopic.title.trim())&&this.newTopicErrors.push(this.$t("Topic title is required.")),this.newTopicErrors.length===0},fetchTopics(){this.loading=!0,this.$get("admin/topics",{optionsOnly:!0,space_id:this.space_id}).then(e=>{this.topics=e.topics}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},createTopic(e){if(!this.validateForm())return;this.creatingTopic=!0;let t={title:this.newTopic.title,description:this.newTopic.description,slug:this.newTopic.slug,is_inline:!0};this.$post("admin/topics",t).then(s=>{this.$notify.success(s.message),this.fetchTopics(),this.selected.push(s.topic.id),e()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.creatingTopic=!1})}},watch:{selected(){this.$emit("update:modelValue",this.selected)}},mounted(){this.fetchTopics()}},ny={class:"fcom_topic_selector"},ly={key:0,class:"fcom_meta_text"};function ay(e,t,s,u,o,i){const m=ne,f=le,h=p("Plus"),g=j,w=H,b=se,S=ue,k=p("slug-input"),$=p("error-alerts"),v=_e,C=p("action-popover"),L=te("loading");return n(),c("div",ny,[W((n(),y(f,{modelValue:o.selected,"onUpdate:modelValue":t[0]||(t[0]=M=>o.selected=M),"popper-class":"fcom_topics_from_settings",style:{width:"100%"},filterable:!0,multiple:!0,clearable:"","multiple-limit":i.maxTopicsPerSpace,placeholder:i.getTopicsPlaceholder()},{default:r(()=>[(n(!0),c(F,null,x(o.topics,M=>(n(),y(m,{key:M.slug,label:M.title,value:M.id},{default:r(()=>[l("span",null,d(M.title),1),M.description?(n(),c("span",ly,d(M.description),1)):_("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","multiple-limit","placeholder"])),[[L,o.loading]]),e.isAdmin()&&s.creatable?(n(),y(C,{key:0,placement:"left",width:400,onShow:i.initCreatetopic},{trigger:r(()=>[a(w,{disabled:i.isTopicLimitReached,class:"fcom_secondary_button"},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1}),l("span",null,d(e.$t("New")),1)]),_:1},8,["disabled"])]),default:r(({hide:M})=>[a(v,{modelValue:o.newTopic,"onUpdate:modelValue":t[4]||(t[4]=E=>o.newTopic=E),"label-position":"top","require-asterisk-position":"right"},{default:r(()=>[a(S,{label:e.$t("Title"),required:""},{default:r(()=>[a(b,{modelValue:o.newTopic.title,"onUpdate:modelValue":t[1]||(t[1]=E=>o.newTopic.title=E),placeholder:e.$t("Title of the topic")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(S,{label:e.$t("Slug (optional)")},{default:r(()=>[a(k,{modelValue:o.newTopic.slug,"onUpdate:modelValue":t[2]||(t[2]=E=>o.newTopic.slug=E),placeholder:e.$t("Slug of the topic"),description:e.$t("No spaces or special characters allowed. Only letters, numbers, hyphens, and underscores.")},null,8,["modelValue","placeholder","description"])]),_:1},8,["label"]),a(S,{label:e.$t("Description (optional)")},{default:r(()=>[a(b,{modelValue:o.newTopic.description,"onUpdate:modelValue":t[3]||(t[3]=E=>o.newTopic.description=E),type:"textarea",rows:3,placeholder:e.$t("Description of the topic")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a($,{errors:o.newTopicErrors,style:{"margin-bottom":"16px"}},null,8,["errors"]),a(S,null,{default:r(()=>[a(w,{class:"fcom_primary_button",onClick:E=>i.createTopic(M),loading:o.creatingTopic},{default:r(()=>[V(d(e.$t("Create")),1)]),_:2},1032,["onClick","loading"])]),_:2},1024)]),_:2},1032,["modelValue"])]),_:1},8,["onShow"])):_("",!0)])}const Co=I(iy,[["render",ay]]),ry={name:"ListViewIcon"},cy={width:"160",height:"158",viewBox:"0 0 160 158",fill:"none",xmlns:"http://www.w3.org/2000/svg"},dy=Te('<rect x="0.5" y="0.5" width="159" height="157" rx="5.5" fill="transparent"></rect><rect x="0.5" y="0.5" width="159" height="157" rx="5.5" stroke="var(--fcom-secondary-border)"></rect><rect x="12.5" y="12.5" width="135" height="27" rx="3.5" fill="transparent"></rect><rect x="12.5" y="12.5" width="135" height="27" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 26C20 21.5817 23.5817 18 28 18C32.4183 18 36 21.5817 36 26C36 30.4183 32.4183 34 28 34C23.5817 34 20 30.4183 20 26Z" fill="var(--fcom-secondary-border)"></path><g clip-path="url(#clip0_3601_59265)"><ellipse cx="27.9996" cy="33.6" rx="6.4" ry="4.8" fill="var(--fcom-primary-bg)" fill-opacity="0.72"></ellipse><circle opacity="0.9" cx="27.9998" cy="24.4" r="3.2" fill="var(--fcom-primary-bg)"></circle></g><path d="M44 26C44 24.3431 45.3431 23 47 23H137C138.657 23 140 24.3431 140 26C140 27.6569 138.657 29 137 29H47C45.3431 29 44 27.6569 44 26Z" fill="var(--fcom-secondary-border)"></path><rect x="12.5" y="48.5" width="135" height="27" rx="3.5" fill="transparent"></rect><rect x="12.5" y="48.5" width="135" height="27" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 62C20 57.5817 23.5817 54 28 54C32.4183 54 36 57.5817 36 62C36 66.4183 32.4183 70 28 70C23.5817 70 20 66.4183 20 62Z" fill="var(--fcom-secondary-border)"></path><g clip-path="url(#clip1_3601_59265)"><ellipse cx="27.9996" cy="69.6001" rx="6.4" ry="4.8" fill="var(--fcom-primary-bg)" fill-opacity="0.72"></ellipse><circle opacity="0.9" cx="27.9998" cy="60.4" r="3.2" fill="var(--fcom-primary-bg)"></circle></g><path d="M44 62C44 60.3431 45.3431 59 47 59H137C138.657 59 140 60.3431 140 62C140 63.6569 138.657 65 137 65H47C45.3431 65 44 63.6569 44 62Z" fill="var(--fcom-secondary-border)"></path><rect x="12.5" y="84.5" width="135" height="27" rx="3.5" fill="transparent"></rect><rect x="12.5" y="84.5" width="135" height="27" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 98C20 93.5817 23.5817 90 28 90C32.4183 90 36 93.5817 36 98C36 102.418 32.4183 106 28 106C23.5817 106 20 102.418 20 98Z" fill="var(--fcom-secondary-border)"></path><g clip-path="url(#clip2_3601_59265)"><ellipse cx="27.9996" cy="105.6" rx="6.4" ry="4.8" fill="var(--fcom-primary-bg)" fill-opacity="0.72"></ellipse><circle opacity="0.9" cx="27.9998" cy="96.3999" r="3.2" fill="var(--fcom-primary-bg)"></circle></g><path d="M44 98C44 96.3431 45.3431 95 47 95H137C138.657 95 140 96.3431 140 98C140 99.6569 138.657 101 137 101H47C45.3431 101 44 99.6569 44 98Z" fill="var(--fcom-secondary-border)"></path><rect x="12.5" y="120.5" width="135" height="27" rx="3.5" fill="transparent"></rect><rect x="12.5" y="120.5" width="135" height="27" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 134C20 129.582 23.5817 126 28 126C32.4183 126 36 129.582 36 134C36 138.418 32.4183 142 28 142C23.5817 142 20 138.418 20 134Z" fill="var(--fcom-secondary-border)"></path><g clip-path="url(#clip3_3601_59265)"><ellipse cx="27.9996" cy="141.6" rx="6.4" ry="4.8" fill="var(--fcom-primary-bg)" fill-opacity="0.72"></ellipse><circle opacity="0.9" cx="27.9998" cy="132.4" r="3.2" fill="var(--fcom-primary-bg)"></circle></g><path d="M44 134C44 132.343 45.3431 131 47 131H137C138.657 131 140 132.343 140 134C140 135.657 138.657 137 137 137H47C45.3431 137 44 135.657 44 134Z" fill="var(--fcom-secondary-border)"></path><defs><clipPath id="clip0_3601_59265"><rect x="20" y="18" width="16" height="16" rx="8" fill="transparent"></rect></clipPath><clipPath id="clip1_3601_59265"><rect x="20" y="54" width="16" height="16" rx="8" fill="transparent"></rect></clipPath><clipPath id="clip2_3601_59265"><rect x="20" y="90" width="16" height="16" rx="8" fill="transparent"></rect></clipPath><clipPath id="clip3_3601_59265"><rect x="20" y="126" width="16" height="16" rx="8" fill="transparent"></rect></clipPath></defs>',23),uy=[dy];function _y(e,t,s,u,o,i){return n(),c("svg",cy,uy)}const my=I(ry,[["render",_y]]),hy={name:"TimelineViewIcon"},fy={width:"160",height:"158",viewBox:"0 0 160 158",fill:"none",xmlns:"http://www.w3.org/2000/svg"},py=Te('<rect x="0.5" y="0.5" width="159" height="157" rx="5.5" fill="transparent"></rect><rect x="0.5" y="0.5" width="159" height="157" rx="5.5" stroke="var(--fcom-secondary-border)"></rect><rect x="12.5" y="12.5" width="135" height="60" rx="3.5" fill="transparent"></rect><rect x="12.5" y="12.5" width="135" height="60" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 24C20 21.7909 21.7909 20 24 20H136C138.209 20 140 21.7909 140 24C140 26.2091 138.209 28 136 28H24C21.7909 28 20 26.2091 20 24Z" fill="var(--fcom-secondary-border)"></path><path d="M20 37C20 34.7909 21.7909 33 24 33H130.286C132.495 33 134.286 34.7909 134.286 37C134.286 39.2091 132.495 41 130.286 41H24C21.7909 41 20 39.2091 20 37Z" fill="var(--fcom-secondary-border)"></path><path d="M20 57C20 52.5817 23.5817 49 28 49C32.4183 49 36 52.5817 36 57C36 61.4183 32.4183 65 28 65C23.5817 65 20 61.4183 20 57Z" fill="var(--fcom-secondary-border)"></path><g clip-path="url(#clip0_3601_59186)"><ellipse cx="27.9996" cy="64.6001" rx="6.4" ry="4.8" fill="var(--fcom-primary-bg)" fill-opacity="0.72"></ellipse><circle opacity="0.9" cx="27.9998" cy="55.4" r="3.2" fill="var(--fcom-primary-bg)"></circle></g><path d="M44 53C44 51.3431 45.3431 50 47 50H81C82.6569 50 84 51.3431 84 53C84 54.6569 82.6569 56 81 56H47C45.3431 56 44 54.6569 44 53Z" fill="var(--fcom-secondary-border)"></path><path d="M44 62C44 60.8954 44.8954 60 46 60H66C67.1046 60 68 60.8954 68 62C68 63.1046 67.1046 64 66 64H46C44.8954 64 44 63.1046 44 62Z" fill="var(--fcom-secondary-border)"></path><rect x="12.5" y="85.5" width="135" height="60" rx="3.5" fill="transparent"></rect><rect x="12.5" y="85.5" width="135" height="60" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 97C20 94.7909 21.7909 93 24 93H136C138.209 93 140 94.7909 140 97C140 99.2091 138.209 101 136 101H24C21.7909 101 20 99.2091 20 97Z" fill="var(--fcom-secondary-border)"></path><path d="M20 110C20 107.791 21.7909 106 24 106H130.286C132.495 106 134.286 107.791 134.286 110C134.286 112.209 132.495 114 130.286 114H24C21.7909 114 20 112.209 20 110Z" fill="var(--fcom-secondary-border)"></path><path d="M20 130C20 125.582 23.5817 122 28 122C32.4183 122 36 125.582 36 130C36 134.418 32.4183 138 28 138C23.5817 138 20 134.418 20 130Z" fill="var(--fcom-secondary-border)"></path><g clip-path="url(#clip1_3601_59186)"><ellipse cx="27.9996" cy="137.6" rx="6.4" ry="4.8" fill="var(--fcom-primary-bg)" fill-opacity="0.72"></ellipse><circle opacity="0.9" cx="27.9998" cy="128.4" r="3.2" fill="var(--fcom-primary-bg)"></circle></g><path d="M44 126C44 124.343 45.3431 123 47 123H81C82.6569 123 84 124.343 84 126C84 127.657 82.6569 129 81 129H47C45.3431 129 44 127.657 44 126Z" fill="var(--fcom-secondary-border)"></path><path d="M44 135C44 133.895 44.8954 133 46 133H66C67.1046 133 68 133.895 68 135C68 136.105 67.1046 137 66 137H46C44.8954 137 44 136.105 44 135Z" fill="var(--fcom-secondary-border)"></path><defs><clipPath id="clip0_3601_59186"><rect x="20" y="49" width="16" height="16" rx="8" fill="transparent"></rect></clipPath><clipPath id="clip1_3601_59186"><rect x="20" y="122" width="16" height="16" rx="8" fill="transparent"></rect></clipPath></defs>',19),gy=[py];function yy(e,t,s,u,o,i){return n(),c("svg",fy,gy)}const vy=I(hy,[["render",yy]]),by={name:"SpaceGroupSelector",props:["modelValue","space_id"],emits:["update:modelValue"],data(){return{loading:!1,selected:this.modelValue,groups:[]}},watch:{selected(e){this.$emit("update:modelValue",e)}},methods:{getGroups(){this.loading=!0,this.$get("spaces/space_groups",{options_only:"yes",space_id:this.space_id}).then(e=>{this.groups=e.groups}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.getGroups()}};function ky(e,t,s,u,o,i){const m=ne,f=le,h=te("loading");return W((n(),y(f,{placeholder:e.$t("Select Menu Group"),clearable:"",modelValue:o.selected,"onUpdate:modelValue":t[0]||(t[0]=g=>o.selected=g)},{default:r(()=>[(n(!0),c(F,null,x(o.groups,g=>(n(),y(m,{key:g.id,value:g.id.toString(),label:g.title},null,8,["value","label"]))),128))]),_:1},8,["placeholder","modelValue"])),[[h,o.loading]])}const gs=I(by,[["render",ky]]),wy={name:"global_form_builder",props:{formData:{type:Object,required:!1,default(){return{}}},submitButtonText:{type:String,required:!1,default:"Save"},formFields:{type:Array,required:!0,default(){return[]}},disableSubmit:{type:Boolean,required:!1,default:!1}},methods:{handleSubmit(){this.$emit("submit",this.formData)}}},Cy={class:"fcom_form_builder"},$y=["innerHTML"],Sy={key:8},Vy={key:9,class:"fcom_help_text"},My=["innerHTML"];function Ly(e,t,s,u,o,i){const m=se,f=Re,h=ve,g=ne,w=le,b=he,S=Os,k=Xe,$=$t,v=ue,C=H,L=_e;return n(),c("div",Cy,[a(L,{"label-position":"top",model:s.formData,onSubmit:z(e.doNothing,["prevent"])},{default:r(()=>[(n(!0),c(F,null,x(s.formFields,(M,E)=>(n(),y(v,{key:e.index,label:M.label},ge({default:r(()=>[M.type=="text"?(n(),y(m,{key:0,modelValue:s.formData[E],"onUpdate:modelValue":T=>s.formData[E]=T,placeholder:M.placeholder,type:M.data_type||"text"},null,8,["modelValue","onUpdate:modelValue","placeholder","type"])):M.type=="radio"?(n(),y(h,{key:1,modelValue:s.formData[E],"onUpdate:modelValue":T=>s.formData[E]=T},{default:r(()=>[(n(!0),c(F,null,x(M.options,(T,P)=>(n(),y(f,{key:P,value:T.value,label:T.label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):M.type=="select"?(n(),y(w,{key:2,class:"fcom_select",multiple:M.is_multiple,clearable:"",filterable:"",modelValue:s.formData[E],"onUpdate:modelValue":T=>s.formData[E]=T,placeholder:M.placeholder},{default:r(()=>[(n(!0),c(F,null,x(M.options,(T,P)=>(n(),y(g,{key:P,label:T.label,value:T.value},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"])):M.type=="checkbox"?(n(),y(S,{key:3,modelValue:s.formData[E],"onUpdate:modelValue":T=>s.formData[E]=T},{default:r(()=>[(n(!0),c(F,null,x(M.options,(T,P)=>(n(),y(b,{key:P,value:T.value,label:T.label,class:"fcom_checkbox"},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):M.type=="inline_checkbox"?(n(),y(b,{key:4,modelValue:s.formData[E],"onUpdate:modelValue":T=>s.formData[E]=T,"true-value":M.true_value||"yes","false-value":M.false_value||"no",class:"fcom_checkbox"},{default:r(()=>[V(d(M.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","true-value","false-value"])):M.type=="date"?(n(),y(k,{key:5,modelValue:s.formData[E],"onUpdate:modelValue":T=>s.formData[E]=T,type:M.data_type||"date","value-format":M.value_format||"YYYY-MM-DD",format:M.value_format||"YYYY-MM-DD",placeholder:M.placeholder},null,8,["modelValue","onUpdate:modelValue","type","value-format","format","placeholder"])):M.type=="color_picker"?(n(),y($,{key:6,modelValue:s.formData[E],"onUpdate:modelValue":T=>s.formData[E]=T},null,8,["modelValue","onUpdate:modelValue"])):M.type=="raw_html"?(n(),c("div",{key:7,innerHTML:M.content},null,8,$y)):(n(),c("div",Sy,[l("pre",null,d(M),1)])),M.help_text?(n(),c("div",Vy,[l("p",{innerHTML:M.help_text},null,8,My)])):_("",!0)]),_:2},[M.label?{name:"label",fn:r(()=>[V(d(M.label),1)]),key:"0"}:void 0]),1032,["label"]))),128)),s.disableSubmit?_("",!0):(n(),y(v,{key:0},{default:r(()=>[a(C,{class:"fcom_primary_button",onClick:z(i.handleSubmit,["prevent"])},{default:r(()=>[V(d(s.submitButtonText),1)]),_:1},8,["onClick"])]),_:1}))]),_:1},8,["model","onSubmit"])])}const $o=I(wy,[["render",Ly]]),Ty={name:"CardViewIcon"},Fy={xmlns:"http://www.w3.org/2000/svg",width:"160",height:"158",viewBox:"0 0 160 158",fill:"none"},Py=Te('<rect x="0.5" y="0.5" width="159" height="157" rx="5.5" fill="transparent"></rect><rect x="0.5" y="0.5" width="159" height="157" rx="5.5" stroke="var(--fcom-secondary-border)"></rect><rect x="12.5" y="12.5" width="63" height="62" rx="3.5" fill="transparent"></rect><rect x="12.5" y="12.5" width="63" height="62" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 24.5714C20 22.0467 22.0467 20 24.5714 20H63.4286C65.9533 20 68 22.0467 68 24.5714V42.4286C68 44.9533 65.9533 47 63.4286 47H24.5714C22.0467 47 20 44.9533 20 42.4286V24.5714Z" fill="var(--fcom-primary-border)"></path><path d="M20 56C20 54.3431 21.3431 53 23 53H65C66.6569 53 68 54.3431 68 56C68 57.6569 66.6569 59 65 59H23C21.3431 59 20 57.6569 20 56Z" fill="var(--fcom-secondary-border)"></path><path d="M20 66C20 64.3431 21.3431 63 23 63H41C42.6569 63 44 64.3431 44 66C44 67.6569 42.6569 69 41 69H23C21.3431 69 20 67.6569 20 66Z" fill="var(--fcom-secondary-border)"></path><rect x="84.5" y="12.5" width="63" height="62" rx="3.5" fill="transparent"></rect><rect x="84.5" y="12.5" width="63" height="62" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M92 24.5714C92 22.0467 94.0467 20 96.5714 20H135.429C137.953 20 140 22.0467 140 24.5714V42.4286C140 44.9533 137.953 47 135.429 47H96.5714C94.0467 47 92 44.9533 92 42.4286V24.5714Z" fill="var(--fcom-primary-border)"></path><path d="M92 56C92 54.3431 93.3431 53 95 53H137C138.657 53 140 54.3431 140 56C140 57.6569 138.657 59 137 59H95C93.3431 59 92 57.6569 92 56Z" fill="var(--fcom-secondary-border)"></path><path d="M92 66C92 64.3431 93.3431 63 95 63H113C114.657 63 116 64.3431 116 66C116 67.6569 114.657 69 113 69H95C93.3431 69 92 67.6569 92 66Z" fill="var(--fcom-secondary-border)"></path><rect x="12.5" y="83.5" width="63" height="62" rx="3.5" fill="transparent"></rect><rect x="12.5" y="83.5" width="63" height="62" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 95.5714C20 93.0467 22.0467 91 24.5714 91H63.4286C65.9533 91 68 93.0467 68 95.5714V113.429C68 115.953 65.9533 118 63.4286 118H24.5714C22.0467 118 20 115.953 20 113.429V95.5714Z" fill="var(--fcom-primary-border)"></path><path d="M20 127C20 125.343 21.3431 124 23 124H65C66.6569 124 68 125.343 68 127C68 128.657 66.6569 130 65 130H23C21.3431 130 20 128.657 20 127Z" fill="var(--fcom-secondary-border)"></path><path d="M20 137C20 135.343 21.3431 134 23 134H41C42.6569 134 44 135.343 44 137C44 138.657 42.6569 140 41 140H23C21.3431 140 20 138.657 20 137Z" fill="var(--fcom-secondary-border)"></path><rect x="84.5" y="83.5" width="63" height="62" rx="3.5" fill="transparent"></rect><rect x="84.5" y="83.5" width="63" height="62" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M92 95.5714C92 93.0467 94.0467 91 96.5714 91H135.429C137.953 91 140 93.0467 140 95.5714V113.429C140 115.953 137.953 118 135.429 118H96.5714C94.0467 118 92 115.953 92 113.429V95.5714Z" fill="var(--fcom-primary-border)"></path><path d="M92 127C92 125.343 93.3431 124 95 124H137C138.657 124 140 125.343 140 127C140 128.657 138.657 130 137 130H95C93.3431 130 92 128.657 92 127Z" fill="var(--fcom-secondary-border)"></path><path d="M92 137C92 135.343 93.3431 134 95 134H113C114.657 134 116 135.343 116 137C116 138.657 114.657 140 113 140H95C93.3431 140 92 138.657 92 137Z" fill="var(--fcom-secondary-border)"></path>',22),Iy=[Py];function Ey(e,t,s,u,o,i){return n(),c("svg",Fy,Iy)}const Uy=I(Ty,[["render",Ey]]),Ay={name:"CreateSpaceForm",emits:["completed"],components:{SpaceGroupSelector:gs,SlugInput:Ht,ImageUploader:xe,LogoEmojiSelector:xt,TopicSelector:Co,ListViewIcon:my,TimelineViewIcon:vy,FormBuilder:$o,ErrorAlerts:Ot,CardViewIcon:Uy},props:{community:{required:!1,default:null},parent_id:{required:!1,default:null},savingCount:{required:!1,default:0},disable_redirect:{required:!1,default:!1}},data(){return{saving:!1,privacies:po,formErrors:[],form:{title:"",slug:"",privacy:"private",parent_id:"",description:"",settings:{custom_lock_screen:"no",restricted_post_only:"no",verified_post_only:"no",emoji:"🚀",shape_svg:"",can_request_join:"yes",layout_style:"timeline",disable_layout_style:"no",show_sidebar:"yes",members_page_status:"members_only",document_library:"no",document_access:"members_only",media_gallery:"no",media_access:"members_only",document_upload:"admin_only"},topic_ids:[]},dataLoaded:!1,showingSections:["basic"],postOrderOptions:this.appVars.post_order_by_options,commentOrderOptions:this.appVars.comment_order_by_options,metaSettings:null,fetchingMetaBoxes:!1}},watch:{savingCount(){this.submit()}},computed:{isDefaultLockscreen(){return this.form.settings.custom_lock_screen=="no"&&this.form.privacy=="private"}},methods:{goToCustomization(){this.validateForm()&&(this.showingSections=["customization"])},getValidationErrors(){var t,s;const e=[];return(!this.form.title||!this.form.title.trim())&&e.push(this.$t("Space title is required.")),((t=this.form.settings)==null?void 0:t.topic_required)==="yes"&&!((s=this.form.topic_ids)!=null&&s.length)&&e.push(this.$t("Please select at least one topic when members are required to select a topic.")),e},validateForm(){return this.formErrors=this.getValidationErrors(),this.formErrors.length===0},submit(){if(this.form.id){const u=this.getValidationErrors();if(u.length){this.$notify.error(u[0]);return}}else if(!this.validateForm())return;this.saving=!0;let e="spaces",t={space:this.form},s=this.$post;if(this.form.id&&(e+="/"+this.form.id+"/by-id",t={space_id:this.form.id,data:{slug:this.form.slug,title:this.form.title,privacy:this.form.privacy,description:this.form.description,group_chat_support:this.form.group_chat_support,settings:this.form.settings,logo:this.form.logo,parent_id:this.form.parent_id??"",cover_photo:this.form.cover_photo,topic_ids:this.form.topic_ids}},s=this.$put,this.metaSettings)){let u={};this.each(this.metaSettings,(o,i)=>{u[i]=o.settings}),t.meta_settings=u}s(e,t).then(u=>{if(this.$eventBus.emit("reloadMenu"),!this.form.id&&!this.disable_redirect){let o=this.$router.resolve({name:"space_feeds",params:{space:u.space.slug}}).href;window.location.href=o;return}this.$notify.success(u.message),this.$emit("completed",u.space),u.redirect_url&&!this.disable_redirect&&(window.location.href=u.redirect_url)}).catch(u=>{this.form.id||(this.showingSections=["basic"]),this.$handleError(u)}).finally(()=>{this.saving=!1})},handleCoverPhotoUpload(e){this.form.cover_photo=e},handleLogoPhotoUpload(e){this.form.logo=e},fetchMetaBoxes(){this.community.id&&(this.fetchingMetaBoxes=!0,this.$get("spaces/"+this.community.slug+"/meta-settings",{space_id:this.community.id}).then(e=>{this.metaSettings=e.meta_settings}).catch(e=>{this.$handleError(e)}).finally(()=>{this.fetchingMetaBoxes=!1}))}},mounted(){if(this.community&&this.community.id){this.community.chat_thread_id&&(this.community.group_chat_support="yes"),this.form=this.community;let e=[];this.community.topics&&this.each(this.community.topics,t=>{e.push(t.id)}),this.form.topic_ids=e,this.fetchMetaBoxes(this.community.id)}else this.parent_id?this.form.parent_id=this.parent_id:this.$route.query.parent_id&&(this.form.parent_id=this.$route.query.parent_id);this.form.id&&(this.showingSections=["basic","customization"]),this.dataLoaded=!0}},By={key:0},Dy={class:"fcom_form_section"},Ry={class:"fcom_help_text"},xy={class:"fcom_form_section"},Hy={style:{"font-weight":"bold"}},Oy=["innerHTML"],jy={key:0},Ny={class:"fcom_help_text"},zy={key:0},qy={key:1,class:"fcom_form_section"},Gy={class:"fcom_lined_checkboxes"},Yy={key:0,class:"fcom_pro_feature"},Wy={key:0,class:"fcom_feature_nested"},Ky={key:0,class:"fcom_pro_feature"},Zy={key:1,class:"fcom_feature_nested"},Jy={class:"fcom_form_section"},Qy={class:"fcom_svg_radio_item"},Xy={class:"svg_radio_label"},ev={class:"fcom_svg_radio_item"},tv={class:"svg_radio_label"},sv={class:"fcom_svg_radio_item"},ov={class:"svg_radio_label"},iv={class:"fcom_help_text"},nv={key:0},lv={key:1},av={class:"fcom_form_section"},rv={class:"fcom_help_text"},cv=["href"],dv={class:"fcom_image_uploader_wrapper"},uv={class:"fcom_help_text"},_v={class:"fcom_image_uploader_wrapper"},mv={class:"fcom_help_text"},hv={class:"fcom_space_form_bottom"},fv={class:"fcom_space_form_bottom"},pv=l("span",null,null,-1),gv={key:0},yv={class:"fcom_form_section fcom_mt_20"};function vv(e,t,s,u,o,i){const m=p("logo-emoji-selector"),f=se,h=ue,g=p("SlugInput"),w=p("space-group-selector"),b=ne,S=le,k=Re,$=ve,v=he,C=p("TimelineViewIcon"),L=p("ListViewIcon"),M=p("CardViewIcon"),E=p("topic-selector"),T=Fe,P=p("EditPen"),U=j,D=H,A=p("Delete"),q=p("ImageUploader"),O=p("error-alerts"),N=_e,G=p("form-builder"),ae=te("loading");return n(),c("div",null,[a(N,{onSubmit:t[32]||(t[32]=z(B=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[33]||(t[33]=B=>o.form=B),"label-position":"top","require-asterisk-position":"right",class:"fcom_space_form"},{default:r(()=>[o.showingSections.indexOf("basic")!==-1?(n(),c(F,{key:0},[o.form.id?_("",!0):(n(),c("h4",By,d(e.$t("Basic Info")),1)),l("div",Dy,[l("h4",null,d(e.$t("General")),1),a(h,{label:e.$t("Space Title"),required:""},{default:r(()=>[a(f,{type:"text",placeholder:e.$t("Your Space Title"),modelValue:o.form.title,"onUpdate:modelValue":t[1]||(t[1]=B=>o.form.title=B)},{prepend:r(()=>{var B,X;return[o.dataLoaded?(n(),y(m,{key:0,custom_svg:!0,onUpdate:t[0]||(t[0]=me=>{o.form.settings.emoji=me.emoji,o.form.logo=me.logo,o.form.settings.shape_svg=me.shape_svg}),config:{logo:o.form.logo,emoji:((B=o.form.settings)==null?void 0:B.emoji)||"",shape_svg:((X=o.form.settings)==null?void 0:X.shape_svg)||""}},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),o.dataLoaded?(n(),y(h,{key:0,label:e.$t("Slug (optional)")},{default:r(()=>[a(g,{popMessage:e.$t("The URLs of this space posts will be changed to the new slug. If you have lots of contents in this space, you should not change it. Are you sure you want to change it?"),is_inital_inactive:!!o.form.id,modelValue:o.form.slug,"onUpdate:modelValue":t[2]||(t[2]=B=>o.form.slug=B),description:e.$t("No spaces or special characters allowed. Only letters, numbers, hyphens, and underscores."),placeholder:e.$t("Space Slug (no space or special chars)")},null,8,["popMessage","is_inital_inactive","modelValue","description","placeholder"])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Description")},{default:r(()=>[a(f,{type:"textarea",rows:3,placeholder:e.$t("Space Description"),modelValue:o.form.description,"onUpdate:modelValue":t[3]||(t[3]=B=>o.form.description=B)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:r(()=>[o.dataLoaded?(n(),y(w,{key:0,modelValue:o.form.parent_id,"onUpdate:modelValue":t[4]||(t[4]=B=>o.form.parent_id=B),space_id:o.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",Ry,[l("p",null,d(e.$t("Select a menu group to where this space will be added to the sidebar. If you do not select a menu group, it will be available on the all spaces page.")),1)])]),_:1},8,["label"])]),l("div",xy,[l("h4",null,d(e.$t("Access Control")),1),a(h,{label:e.$t("Privacy")},{default:r(()=>[a(S,{"popper-class":"rich_select",modelValue:o.form.privacy,"onUpdate:modelValue":t[5]||(t[5]=B=>o.form.privacy=B),placeholder:e.$t("Select Privacy")},{default:r(()=>[(n(!0),c(F,null,x(o.privacies,(B,X)=>(n(),y(b,{key:X,label:B.label,value:X},{default:r(()=>[l("span",Hy,d(e.$labelize(B.label)),1),l("p",{innerHTML:B.description},null,8,Oy)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),o.form.privacy=="private"?(n(),c(F,{key:0},[a(h,{label:e.$t("Lock Screen Type")},{default:r(()=>[a($,{modelValue:o.form.settings.custom_lock_screen,"onUpdate:modelValue":t[6]||(t[6]=B=>o.form.settings.custom_lock_screen=B),class:""},{default:r(()=>[a(k,{value:"yes"},{default:r(()=>[V(d(e.$t("Custom Lock Screen")),1)]),_:1}),a(k,{value:"no"},{default:r(()=>[V(d(e.$t("Default Lock Screen")),1)]),_:1}),a(k,{disabled:!e.has_pro,value:"redirect"},{default:r(()=>[V(d(e.$t("Redirect to an URL"))+" ",1),e.has_pro?_("",!0):(n(),c("span",jy,d(e.$t("Require Pro")),1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),o.form.settings.custom_lock_screen=="redirect"&&e.has_pro?(n(),y(h,{key:0,label:e.$t("Provide the Redirect URL")},{default:r(()=>[a(f,{modelValue:o.form.settings.onboard_redirect_url,"onUpdate:modelValue":t[7]||(t[7]=B=>o.form.settings.onboard_redirect_url=B),type:"text",placeholder:e.$t("Redirect URL for unenrolled users")},null,8,["modelValue","placeholder"]),l("div",Ny,[l("p",null,d(e.$t("This link will be used to redirect the non-members. This may be your sales page for this space")),1)])]),_:1},8,["label"])):_("",!0)],64)):_("",!0),i.isDefaultLockscreen?(n(),y(h,{key:1,style:{"margin-bottom":"0"}},{default:r(()=>[a(v,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.can_request_join,"onUpdate:modelValue":t[8]||(t[8]=B=>o.form.settings.can_request_join=B),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Allow users to request to join this Space")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),i.isDefaultLockscreen?(n(),y(h,{key:2},{default:r(()=>[a(v,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_paywalls,"onUpdate:modelValue":t[9]||(t[9]=B=>o.form.settings.show_paywalls=B),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Show Paywalls in Default Lock Screen")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),a(h,{label:e.$t("Who can view space members")},{default:r(()=>[a(S,{modelValue:o.form.settings.members_page_status,"onUpdate:modelValue":t[10]||(t[10]=B=>o.form.settings.members_page_status=B)},{default:r(()=>[a(b,{value:"members_only",label:e.$t("Members Only")},null,8,["label"]),a(b,{value:"admin_only",label:e.$t("Admin/Moderators Only")},null,8,["label"]),a(b,{value:"logged_in",label:e.$t("Any Logged in users")},null,8,["label"]),a(b,{value:"everybody",label:e.$t("Anyone")},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"])])],64)):_("",!0),o.showingSections.indexOf("customization")!==-1?(n(),c(F,{key:1},[o.form.id?_("",!0):(n(),c("h4",zy,d(e.$t("Customization")),1)),o.form.settings?(n(),c("div",qy,[l("h4",null,d(e.$t("Features Customizations")),1),a(h,null,{default:r(()=>[l("div",Gy,[a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.restricted_post_only,"onUpdate:modelValue":t[11]||(t[11]=B=>o.form.settings.restricted_post_only=B)},{default:r(()=>[V(d(e.$t("Only admin or moderators can create post")),1)]),_:1},8,["modelValue"]),a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.verified_post_only,"onUpdate:modelValue":t[12]||(t[12]=B=>o.form.settings.verified_post_only=B)},{default:r(()=>[V(d(e.$t("Only verified members can create posts (admins and moderators can always post)")),1)]),_:1},8,["modelValue"]),a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.hide_members_count,"onUpdate:modelValue":t[13]||(t[13]=B=>o.form.settings.hide_members_count=B)},{default:r(()=>[V(d(e.$t("Hide Members count from spaces page (when members page access unavailable)")),1)]),_:1},8,["modelValue"]),a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.show_sidebar,"onUpdate:modelValue":t[14]||(t[14]=B=>o.form.settings.show_sidebar=B)},{default:r(()=>[V(d(e.$t("Show Right Sidebar on Space")),1)]),_:1},8,["modelValue"]),a(v,{class:"fcom_checkbox",disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:o.form.settings.document_library,"onUpdate:modelValue":t[15]||(t[15]=B=>o.form.settings.document_library=B)},{default:r(()=>[V(d(e.$t("Enable File/Document Library for this space"))+" ",1),e.has_pro?_("",!0):(n(),c("span",Yy," ("+d(e.$t("Pro Feature"))+") ",1))]),_:1},8,["disabled","modelValue"]),o.form.settings.document_library=="yes"?(n(),c("div",Wy,[a(h,{label:e.$t("Document Library Access (View & Download)")},{default:r(()=>[a($,{modelValue:o.form.settings.document_access,"onUpdate:modelValue":t[16]||(t[16]=B=>o.form.settings.document_access=B),class:"fcom_radio_group_inline"},{default:r(()=>[a(k,{value:"members_only"},{default:r(()=>[V(d(e.$t("Members of this space")),1)]),_:1}),a(k,{value:"logged_in"},{default:r(()=>[V(d(e.$t("Any Logged in users")),1)]),_:1}),a(k,{value:"everybody"},{default:r(()=>[V(d(e.$t("Public")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Who can upload the documents?")},{default:r(()=>[a($,{modelValue:o.form.settings.document_upload,"onUpdate:modelValue":t[17]||(t[17]=B=>o.form.settings.document_upload=B),class:"fcom_radio_group_inline"},{default:r(()=>[a(k,{value:"members_only"},{default:r(()=>[V(d(e.$t("Any Members")),1)]),_:1}),a(k,{value:"admin_only"},{default:r(()=>[V(d(e.$t("Admin/Moderators Only")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])])):_("",!0),a(v,{class:"fcom_checkbox",disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:o.form.settings.media_gallery,"onUpdate:modelValue":t[18]||(t[18]=B=>o.form.settings.media_gallery=B)},{default:r(()=>[V(d(e.$t("Enable Media Gallery for this space"))+" ",1),e.has_pro?_("",!0):(n(),c("span",Ky," ("+d(e.$t("Pro Feature"))+") ",1))]),_:1},8,["disabled","modelValue"]),e.has_pro&&o.form.settings.media_gallery=="yes"?(n(),c("div",Zy,[a(h,{label:e.$t("Media Gallery Access (View)")},{default:r(()=>[a($,{modelValue:o.form.settings.media_access,"onUpdate:modelValue":t[19]||(t[19]=B=>o.form.settings.media_access=B),class:"fcom_radio_group_inline"},{default:r(()=>[a(k,{value:"members_only"},{default:r(()=>[V(d(e.$t("Members of this space")),1)]),_:1}),a(k,{value:"logged_in"},{default:r(()=>[V(d(e.$t("Any Logged in users")),1)]),_:1}),a(k,{value:"everybody"},{default:r(()=>[V(d(e.$t("Public")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])])):_("",!0)])]),_:1}),a(h,{label:e.$t("Default Post Sort By")},{default:r(()=>[a(S,{modelValue:o.form.settings.default_post_sort_by,"onUpdate:modelValue":t[20]||(t[20]=B=>o.form.settings.default_post_sort_by=B),clearable:"",class:"fcom_select",placeholder:e.$t("Latest Posts Sort")},{default:r(()=>[(n(!0),c(F,null,x(o.postOrderOptions,(B,X)=>(n(),y(b,{key:X,value:X,label:B},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.disable_post_sort_by,"onUpdate:modelValue":t[21]||(t[21]=B=>o.form.settings.disable_post_sort_by=B)},{default:r(()=>[V(d(e.$t("Disable Post Sort By Options")),1)]),_:1},8,["modelValue"]),a(h,{label:e.$t("Default Comment Sort By")},{default:r(()=>[a(S,{modelValue:o.form.settings.default_comment_sort_by,"onUpdate:modelValue":t[22]||(t[22]=B=>o.form.settings.default_comment_sort_by=B),clearable:"",class:"fcom_select",placeholder:e.$t("Latest Comments Sort")},{default:r(()=>[(n(!0),c(F,null,x(o.commentOrderOptions,(B,X)=>(n(),y(b,{key:X,value:X,label:B},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])])):_("",!0),l("div",Jy,[l("h4",null,d(e.$t("Layout")),1),a(h,{label:e.$t("Default Layout Styles"),class:"fcom_mb_10"},{default:r(()=>[a($,{modelValue:o.form.settings.layout_style,"onUpdate:modelValue":t[23]||(t[23]=B=>o.form.settings.layout_style=B),class:"fcom_svg_radio_group"},{default:r(()=>[l("div",Qy,[a(k,{value:"timeline"},{default:r(()=>[a(C,{style:{width:"100px",height:"auto"}}),l("p",Xy,d(e.$t("Timeline")),1)]),_:1})]),l("div",ev,[a(k,{value:"list"},{default:r(()=>[a(L,{style:{width:"100px",height:"auto"}}),l("p",tv,d(e.$t("List")),1)]),_:1})]),l("div",sv,[a(k,{value:"card"},{default:r(()=>[a(M,{style:{width:"100px",height:"auto"}}),l("p",ov,d(e.$t("Card")),1)]),_:1})])]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(h,{style:{"margin-top":"0"}},{default:r(()=>[a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.disable_layout_style,"onUpdate:modelValue":t[24]||(t[24]=B=>o.form.settings.disable_layout_style=B)},{default:r(()=>[V(d(e.$t("Disable Layout Style Change Option")),1)]),_:1},8,["modelValue"]),l("div",iv,[o.form.settings.disable_layout_style==="yes"?(n(),c("p",nv,d(e.$t("The selected layout will be applied for all members. They cannot switch to a different view.")),1)):(n(),c("p",lv,d(e.$t("User can change the layout style to their own preference.")),1))])]),_:1})]),l("div",av,[l("h4",null,d(e.$t("Others")),1),e.has_pro&&o.dataLoaded?(n(),y(h,{key:0,label:e.$t("Topic navigation")},{default:r(()=>[a(E,{creatable:!0,space_id:o.form.id,modelValue:o.form.topic_ids,"onUpdate:modelValue":t[25]||(t[25]=B=>o.form.topic_ids=B)},null,8,["space_id","modelValue"]),l("div",rv,[l("p",null,[V(d(e.$t("Categorize your posts and allow members to filter spaces with the topic navigation bar. You can define up to 20 topics per space."))+" ",1),e.isAdmin()?(n(),c("a",{key:0,target:"_blank",rel:"noopener",href:e.$getRouteLink("admin/settings/topics-settings")},d(e.$t("Manage all topics.")),9,cv)):_("",!0)])]),a(v,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.topic_required,"onUpdate:modelValue":t[26]||(t[26]=B=>o.form.settings.topic_required=B),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Make members select a topic")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):_("",!0),e.appVars.has_chat?(n(),y(h,{key:1,label:e.$t("Group Chat?")},{default:r(()=>[a(v,{"true-value":"yes","false-value":"no",modelValue:o.form.group_chat_support,"onUpdate:modelValue":t[27]||(t[27]=B=>o.form.group_chat_support=B),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Enable group chat for this space members")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Thumbnail / Open Graph Image (Recommended Size: 1200 x 630)")},{default:r(()=>[o.form.settings.og_image?(n(),y(T,{key:0,alt:e.$t("Thumbnail / Open Graph Image"),src:o.form.settings.og_image,style:{"max-width":"100px",height:"auto"}},null,8,["alt","src"])):_("",!0),l("div",dv,[a(q,{isTextBtn:!1,removeIcon:!0,can_remove:!!o.form.settings.og_image,confirm_remove:!0,additionalData:{resize:!1,disable_convert:"yes",max_width:1200,max_height:630},onUploaded:t[28]||(t[28]=B=>{o.form.settings.og_image=B})},ge({remove:r(()=>[a(U,null,{default:r(()=>[a(A)]),_:1})]),_:2},[o.form.settings.og_image?{name:"trigger",fn:r(()=>[a(D,{"aria-label":e.$t("Edit image"),class:"fcom_plain_button"},{default:r(()=>[a(U,null,{default:r(()=>[a(P)]),_:1})]),_:1},8,["aria-label"])]),key:"0"}:void 0]),1032,["can_remove"])]),l("div",uv,[l("p",null,d(e.$t("Will be used on card preview and social sharing preview.")),1)])]),_:1},8,["label"]),a(h,{label:e.$t("Featured Image (Recommended size: 1600x500) - Optional")},{default:r(()=>[o.form.cover_photo?(n(),y(T,{key:0,src:o.form.cover_photo,alt:e.$t("Featured Image Preview"),style:{"max-width":"100px",height:"auto"}},null,8,["src","alt"])):_("",!0),l("div",_v,[a(q,{isTextBtn:!1,removeIcon:!0,can_remove:!!o.form.cover_photo,confirm_remove:!0,additionalData:{resize:!0,max_width:1600},onUploaded:i.handleCoverPhotoUpload},ge({remove:r(()=>[a(U,null,{default:r(()=>[a(A)]),_:1})]),_:2},[o.form.cover_photo?{name:"trigger",fn:r(()=>[a(D,{class:"fcom_plain_button"},{default:r(()=>[a(U,null,{default:r(()=>[a(P)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove","onUploaded"])]),l("div",mv,[l("p",null,d(e.$t("If you add this image, it will be shown on the space homepage")),1)])]),_:1},8,["label"]),a(O,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),o.form.id?_("",!0):(n(),y(h,{key:2,style:{"margin-top":"45px"}},{default:r(()=>[l("div",hv,[o.showingSections.indexOf("basic")===-1?(n(),y(D,{key:0,class:"plain_button",text:"",onClick:t[29]||(t[29]=()=>{o.showingSections=["basic"]})},{default:r(()=>[l("span",null,d(e.$t("Go Back")),1)]),_:1})):_("",!0),W((n(),y(D,{class:"fcom_primary_button",disabled:o.saving,onClick:t[30]||(t[30]=B=>i.submit())},{default:r(()=>[l("span",null,d(e.$t("Create")),1)]),_:1},8,["disabled"])),[[ae,o.saving]])])]),_:1}))])],64)):(n(),c(F,{key:2},[a(O,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),a(h,null,{default:r(()=>[l("div",fv,[pv,a(D,{onClick:t[31]||(t[31]=B=>i.goToCustomization()),class:"fcom_primary_button"},{default:r(()=>[l("span",null,d(e.$t("Next")),1)]),_:1})])]),_:1})],64))]),_:1},8,["modelValue"]),W((n(),c("div",null,[o.metaSettings&&Object.keys(o.metaSettings).length>0?(n(),c("div",gv,[(n(!0),c(F,null,x(o.metaSettings,B=>(n(),c("div",yv,[l("h4",null,d(B.section_title),1),a(G,{formData:B.settings,formFields:B.fields,disableSubmit:!0},null,8,["formData","formFields"])]))),256))])):_("",!0)])),[[ae,o.fetchingMetaBoxes]])])}const jt=I(Ay,[["render",vv]]),bv={name:"CreateCorseForm",components:{FormBuilder:$o,SpaceGroupSelector:gs,TopicSelector:Co,SlugInput:Ht,ImageUploader:xe,LogoEmojiSelector:xt,ErrorAlerts:Ot,CrepeEditor:It},emits:["completed","close"],props:{course:{required:!1,default:{title:"",description:"",privacy:"public",course_type:"self_paced",cover_photo:"",parent_id:"",status:"draft",category_ids:[],settings:{emoji:"",custom_lock_screen:"no",shape_svg:"",disable_comments:"no",hide_members_count:"no"}}},savingCount:{required:!1,default:0},parent_id:{required:!1,default:null},disable_redirect:{required:!1,default:!1}},data(){return{saving:!1,privacies:zu,formErrors:[],form:{slug:"",title:"",description:"",privacy:"public",course_type:"self_paced",cover_photo:"",parent_id:"",status:"draft",category_ids:[],settings:{emoji:"",custom_lock_screen:"no",shape_svg:"",course_details:"",course_layout:"classic"}},courseTypes:qu,dataLoaded:!1,metaSettings:null,fetchingMetaBoxes:!1,appReady:!1,courseInstructors:[],fetchingInstructors:!1}},watch:{savingCount(){this.submit(!1)}},methods:{getValidationErrors(){const e=[];return(!this.form.title||!this.form.title.trim())&&e.push(this.$t("Course title is required.")),(!this.form.description||!this.form.description.trim())&&e.push(this.$t("Short description is required.")),e},validateForm(){return this.formErrors=this.getValidationErrors(),this.formErrors.length===0},submit(e=!1){if(this.form.id){const o=this.getValidationErrors();if(o.length){this.$notify.error(o[0]);return}}else if(!this.validateForm())return;this.saving=!0;let t="admin/courses",s=this.form,u=this.$post;if(this.form.id&&(t+="/"+this.form.id,s={title:this.form.title,privacy:this.form.privacy,course_type:this.form.course_type,description:this.form.description,status:this.form.status,slug:this.form.slug,logo:this.form.logo,cover_photo:this.form.cover_photo,space_id:this.form.id,parent_id:this.form.parent_id,settings:this.form.settings,category_ids:this.form.category_ids},u=this.$put,this.form.created_by&&this.isAdmin()&&(s.created_by=this.form.created_by),this.metaSettings)){let o={};this.each(this.metaSettings,(i,m)=>{o[m]=i.settings}),s.meta_settings=o}u(t,s).then(o=>{if(!this.form.id&&!this.disable_redirect){let i=this.$getRouteLink("admin/manage-courses/edit/"+o.course.id+"/lessons");window.location.href=i,this.form={};return}this.$eventBus.emit("reloadMenu"),this.$notify.success(o.message||this.$t("Course has been created successfully")),this.$emit("completed",o.course),e&&this.$emit("close")}).catch(o=>{this.$handleError(o)}).finally(()=>{this.saving=!1})},searchUsers(e=""){e&&e.length<3||this.fetchCourseInstructors(e)},handlePhotoUpload(e){this.form.cover_photo=e},fetchMetaBoxes(){this.course.id&&(this.fetchingMetaBoxes=!0,this.$get("admin/courses/"+this.course.id+"/meta-settings").then(e=>{this.metaSettings=e.meta_settings}).catch(e=>{this.$handleError(e)}).finally(()=>{this.fetchingMetaBoxes=!1}))},fetchCourseInstructors(e=""){this.fetchingInstructors=!0,this.$get("admin/courses/"+this.course.id+"/instructors/search",{search:e}).then(t=>{this.courseInstructors=t.instructors}).catch(t=>{this.$handleError(t)}).finally(()=>{this.fetchingInstructors=!1})}},mounted(){var t,s,u,o,i;this.course.id?(this.form=this.course,this.form.created_by=parseInt(this.form.created_by),this.fetchMetaBoxes(),this.fetchCourseInstructors()):this.parent_id&&(this.form.parent_id=this.parent_id);const e=(s=(t=this.course)==null?void 0:t.settings)==null?void 0:s.course_type;e&&!((u=this.form)!=null&&u.course_type)&&(this.form.course_type=e),(!((i=(o=this.form)==null?void 0:o.settings)!=null&&i.course_layout)||!this.has_pro)&&(this.form.settings.course_layout="classic"),this.dataLoaded=!0,this.$nextTick(()=>{this.appReady=!0})}},kv={key:0},wv={class:"fcom_form_section"},Cv={class:"fcom_help_text"},$v={class:"fcom_help_text"},Sv={class:"fcom_form_section"},Vv={style:{"font-weight":"bold"}},Mv={key:0},Lv={class:"fcom_help_text"},Tv={style:{"font-weight":"bold"}},Fv={class:"fcom_form_section"},Pv={class:"fcom_lined_checkboxes"},Iv={class:"fcom_checkbox_with_tooltip"},Ev={key:0},Uv=l("br",null,null,-1),Av={key:0},Bv={class:"fcom_help_text"},Dv={key:0,class:"fcom_form_section"},Rv={class:"fcom_select_photo",style:{float:"left"}},xv=["src","alt"],Hv={style:{float:"right",color:"#8492a6","font-size":"13px"}},Ov={class:"fcom_lined_checkboxes"},jv={class:"fcom_form_section"},Nv={class:"fcom_help_text"},zv=["href"],qv={class:"fcom_image_uploader_wrapper"},Gv={class:"fcom_help_text"},Yv={class:"fcom_space_form_bottom"},Wv=l("span",null,null,-1),Kv={key:0},Zv={class:"fcom_form_section fcom_mt_20"},Jv={key:1},Qv=["href"];function Xv(e,t,s,u,o,i){const m=p("logo-emoji-selector"),f=se,h=ue,g=p("SlugInput"),w=p("crepe-editor"),b=p("space-group-selector"),S=Re,k=ve,$=ne,v=le,C=he,L=p("InfoFilled"),M=j,E=Ue,T=p("topic-selector"),P=Fe,U=p("EditPen"),D=H,A=p("Delete"),q=p("ImageUploader"),O=p("error-alerts"),N=_e,G=p("form-builder"),ae=te("loading");return e.hasFeature("has_course")?(n(),c("div",kv,[a(N,{onSubmit:t[23]||(t[23]=z(B=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[24]||(t[24]=B=>o.form=B),"label-position":"top","require-asterisk-position":"right"},{default:r(()=>[l("div",wv,[l("h4",null,d(e.$t("General")),1),a(h,{label:e.$t("Course Title"),required:""},{default:r(()=>[a(f,{type:"text",ref:"titleInput",placeholder:e.$t("Your Course Title"),modelValue:o.form.title,"onUpdate:modelValue":t[1]||(t[1]=B=>o.form.title=B)},{prepend:r(()=>{var B,X;return[o.dataLoaded?(n(),y(m,{key:0,custom_svg:!0,config:{logo:o.form.logo,emoji:(B=o.form.settings)==null?void 0:B.emoji,shape_svg:((X=o.form.settings)==null?void 0:X.shape_svg)||""},onUpdate:t[0]||(t[0]=me=>{o.form.settings.emoji=me.emoji,o.form.logo=me.logo,o.form.settings.shape_svg=me.shape_svg})},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),o.dataLoaded?(n(),y(h,{key:0,label:e.$t("Slug (optional)")},{default:r(()=>[a(g,{popMessage:e.$t("The URLs of this course lessons will be changed to the new slug. If you have lots of lessons and sections in this course, you should not change it. Are you sure you want to change it?"),is_inital_inactive:!!o.form.id,modelValue:o.form.slug,"onUpdate:modelValue":t[2]||(t[2]=B=>o.form.slug=B),description:e.$t("No spaces or special characters allowed. Only letters, numbers, hyphens, and underscores."),placeholder:e.$t("Course Slug (no spaces or special characters)")},null,8,["popMessage","is_inital_inactive","modelValue","description","placeholder"])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Short Description"),required:""},{default:r(()=>[a(f,{type:"textarea",placeholder:e.$t("Course Description"),modelValue:o.form.description,"onUpdate:modelValue":t[3]||(t[3]=B=>o.form.description=B)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{class:"form_label_with_tooltip",label:e.$t("Course Details")},{default:r(()=>[o.appReady?(n(),y(w,{key:0,modelValue:o.form.settings.course_details,"onUpdate:modelValue":t[4]||(t[4]=B=>o.form.settings.course_details=B),autofocus:!1,placeholder:e.$t("Add any additional information or notes about this course here"),disable_media:!0},null,8,["modelValue","placeholder"])):_("",!0),l("div",Cv,[l("p",null,d(e.$t("This section will be displayed on the course landing page. Add extra details, notes, or instructions to help learners understand the course better.")),1)])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:r(()=>[o.dataLoaded?(n(),y(b,{key:0,modelValue:o.form.parent_id,"onUpdate:modelValue":t[5]||(t[5]=B=>o.form.parent_id=B),space_id:o.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",$v,[l("p",null,d(e.$t("Select a menu group to where this course will be added to the sidebar. If you do not select a menu group, it will be available on the all courses page.")),1)])]),_:1},8,["label"]),a(h,{label:e.$t("Status")},{default:r(()=>[a(k,{modelValue:o.form.status,"onUpdate:modelValue":t[6]||(t[6]=B=>o.form.status=B),class:"fcom_radio_group"},{default:r(()=>[a(S,{value:"published"},{default:r(()=>[V(d(e.$t("Published")),1)]),_:1}),a(S,{value:"draft"},{default:r(()=>[V(d(e.$t("Draft")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])]),l("div",Sv,[l("h4",null,d(e.$t("Access Control")),1),a(h,{label:e.$t("Privacy")},{default:r(()=>[a(v,{"popper-class":"rich_select",modelValue:o.form.privacy,"onUpdate:modelValue":t[7]||(t[7]=B=>o.form.privacy=B),placeholder:e.$t("Select Privacy")},{default:r(()=>[(n(!0),c(F,null,x(o.privacies,(B,X)=>(n(),y($,{key:X,label:B.label,value:X},{default:r(()=>[l("span",Vv,d(B.label),1),l("p",null,d(B.description),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),o.form.privacy=="private"?(n(),c(F,{key:0},[a(h,{label:e.$t("Lock Screen Type")},{default:r(()=>[a(k,{modelValue:o.form.settings.custom_lock_screen,"onUpdate:modelValue":t[8]||(t[8]=B=>o.form.settings.custom_lock_screen=B),class:"fcom_radio_group"},{default:r(()=>[a(S,{value:"yes"},{default:r(()=>[V(d(e.$t("Custom")),1)]),_:1}),a(S,{value:"no"},{default:r(()=>[V(d(e.$t("Default")),1)]),_:1}),a(S,{disabled:!e.has_pro,value:"redirect"},{default:r(()=>[V(d(e.$t("Redirect to an URL"))+" ",1),e.has_pro?_("",!0):(n(),c("span",Mv,"("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),o.form.settings.custom_lock_screen=="redirect"&&e.has_pro?(n(),y(h,{key:0,label:e.$t("Provide the Redirect URL")},{default:r(()=>[a(f,{modelValue:o.form.settings.onboard_redirect_url,"onUpdate:modelValue":t[9]||(t[9]=B=>o.form.settings.onboard_redirect_url=B),type:"text",placeholder:e.$t("Redirect URL for unenrolled users")},null,8,["modelValue","placeholder"]),l("div",Lv,[l("p",null,d(e.$t("This link will be used to redirect the unenrolled or public users. This may be your sales page for this course")),1)])]),_:1},8,["label"])):_("",!0),o.form.settings.custom_lock_screen=="no"?(n(),y(h,{key:1,style:{"margin-bottom":"0"}},{default:r(()=>[a(C,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_paywalls,"onUpdate:modelValue":t[10]||(t[10]=B=>o.form.settings.show_paywalls=B),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Show Paywalls in the default lock screen")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),o.form.settings.custom_lock_screen=="no"?(n(),y(h,{key:2},{default:r(()=>[a(C,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_welcome_banner,"onUpdate:modelValue":t[11]||(t[11]=B=>o.form.settings.show_welcome_banner=B),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Show Welcome Banner in the default lock screen")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0)],64)):_("",!0),a(h,{label:e.$t("Enrollment Type")},{default:r(()=>[a(v,{"popper-class":"rich_select",modelValue:o.form.course_type,"onUpdate:modelValue":t[12]||(t[12]=B=>o.form.course_type=B),placeholder:e.$t("Select Type")},{default:r(()=>[(n(!0),c(F,null,x(o.courseTypes,(B,X)=>(n(),y($,{key:X,label:B.label,value:X},{default:r(()=>[l("span",Tv,d(B.label),1),l("p",null,d(B.description),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),l("div",Fv,[l("h4",null,d(e.$t("Features Customizations")),1),a(h,null,{default:r(()=>[l("div",Pv,[o.form.privacy=="public"&&o.form.course_type=="self_paced"?(n(),y(C,{key:0,"true-value":"yes","false-value":"no",modelValue:o.form.settings.public_lesson_view,"onUpdate:modelValue":t[13]||(t[13]=B=>o.form.settings.public_lesson_view=B),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Public users can view the lessons without enrolling in the course")),1)]),_:1},8,["modelValue"])):_("",!0),a(C,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.disable_comments,"onUpdate:modelValue":t[14]||(t[14]=B=>o.form.settings.disable_comments=B),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Disable comments for all the lessons for this course")),1)]),_:1},8,["modelValue"]),a(C,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.hide_members_count,"onUpdate:modelValue":t[15]||(t[15]=B=>o.form.settings.hide_members_count=B),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Hide students count from courses page")),1)]),_:1},8,["modelValue"]),l("div",Iv,[a(C,{disabled:!e.has_pro,"true-value":"yes","false-value":"no","model-value":e.has_pro?o.form.settings.sequential_lesson_order:"no","onUpdate:modelValue":t[16]||(t[16]=B=>{o.form.settings.sequential_lesson_order=B}),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Lesson order enforcement"))+" ",1),e.has_pro?_("",!0):(n(),c("span",Ev,"("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["disabled","model-value"]),a(E,{class:"box-item fcom_checkbox_tooltip",effect:"dark",placement:"right-end"},{content:r(()=>[V(d(e.$t("Your members will have to complete each lesson")),1),Uv,V(" "+d(e.$t("in order before moving onto the next one.")),1)]),default:r(()=>[a(M,null,{default:r(()=>[a(L)]),_:1})]),_:1})])])]),_:1}),a(h,{label:e.$t("Course Layout")},{default:r(()=>[a(k,{modelValue:o.form.settings.course_layout,"onUpdate:modelValue":t[17]||(t[17]=B=>o.form.settings.course_layout=B),class:"fcom_radio_group"},{default:r(()=>[a(S,{value:"classic"},{default:r(()=>[V(d(e.$t("Classic")),1)]),_:1}),a(S,{disabled:!e.has_pro,value:"modern"},{default:r(()=>[V(d(e.$t("Modern"))+" ",1),e.has_pro?_("",!0):(n(),c("span",Av,"("+d(e.$t("Available on Pro"))+")",1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),l("div",Bv,[l("p",null,d(e.$t("Classic is the default layout. For a more visual and engaging experience, the Modern layout displays the featured image or embedded video thumbnail.")),1)])]),_:1},8,["label"])]),o.form.id?(n(),c("div",Dv,[l("h4",null,d(e.$t("Course Instructor")),1),a(h,{label:e.$t("Instructor")},{default:r(()=>[a(v,{disabled:!e.isAdmin(),class:"rich_select","fit-input-width":"",filterable:"",remote:"",loading:o.fetchingInstructors,"remote-method":i.searchUsers,placeholder:e.$t("Select User"),modelValue:o.form.created_by,"onUpdate:modelValue":t[18]||(t[18]=B=>o.form.created_by=B)},{default:r(()=>[(n(!0),c(F,null,x(o.courseInstructors,B=>(n(),y($,{class:"fcom_with_photo_option",key:B.ID,label:B.display_name+" ("+(B.user_email||B.ID)+")",value:B.ID},{default:r(()=>[l("span",Rv,[l("img",{src:B.photo,alt:B.display_name},null,8,xv),l("span",null,d(B.display_name),1)]),l("span",Hv,d(B.user_email||B.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["disabled","loading","remote-method","placeholder","modelValue"])]),_:1},8,["label"]),a(h,null,{default:r(()=>[l("div",Ov,[a(C,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.hide_instructor_view,"onUpdate:modelValue":t[19]||(t[19]=B=>o.form.settings.hide_instructor_view=B),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Hide course instructor view from course overview page")),1)]),_:1},8,["modelValue"]),o.form.settings.hide_instructor_view!="yes"?(n(),y(C,{key:0,"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_instructor_students_count,"onUpdate:modelValue":t[20]||(t[20]=B=>o.form.settings.show_instructor_students_count=B),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Show students count in course instructor view")),1)]),_:1},8,["modelValue"])):_("",!0)])]),_:1})])):_("",!0),l("div",jv,[l("h4",null,d(e.$t("Others")),1),e.has_pro&&o.dataLoaded?(n(),y(h,{key:0,label:e.$t("Topic navigation")},{default:r(()=>[a(T,{modelValue:o.form.category_ids,"onUpdate:modelValue":t[21]||(t[21]=B=>o.form.category_ids=B),creatable:!0},null,8,["modelValue"]),l("div",Nv,[l("p",null,d(e.$t("Categorize your course and allow members to filter courses with the topic navigation bar in the courses directory. You can define up to 20 topics per course.")),1),l("p",null,[e.isAdmin()?(n(),c("a",{key:0,target:"_blank",rel:"noopener",href:e.$getRouteLink("admin/settings/topics-settings")},d(e.$t("Manage all topics")),9,zv)):_("",!0)])])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Thumbnail / Open Graph Image (Recommended Size: 1200 x 630)")},{default:r(()=>[o.form.cover_photo?(n(),y(P,{key:0,alt:e.$t("Cover Photo"),src:o.form.cover_photo,style:{"max-width":"100px",height:"auto"}},null,8,["alt","src"])):_("",!0),l("div",qv,[a(q,{isTextBtn:!1,can_remove:!!o.form.cover_photo,additionalData:{resize:!1,disable_convert:"yes",max_width:1200,max_height:630},onUploaded:i.handlePhotoUpload},ge({remove:r(()=>[a(M,null,{default:r(()=>[a(A)]),_:1})]),_:2},[o.form.cover_photo?{name:"trigger",fn:r(()=>[a(D,{class:"fcom_plain_button"},{default:r(()=>[a(M,null,{default:r(()=>[a(U)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove","onUploaded"])]),l("div",Gv,[l("p",null,d(e.$t("Will be used on course card preview and social sharing preview.")),1)])]),_:1},8,["label"]),a(O,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),o.form.id?_("",!0):(n(),y(h,{key:1,style:{"margin-top":"45px"}},{default:r(()=>[l("div",Yv,[Wv,a(D,{class:"fcom_primary_button",disabled:o.saving,onClick:t[22]||(t[22]=B=>i.submit()),loading:o.saving},{default:r(()=>[l("span",null,d(e.$t("Create")),1)]),_:1},8,["disabled","loading"])])]),_:1}))])]),_:1},8,["modelValue"]),W((n(),c("div",null,[o.metaSettings&&Object.keys(o.metaSettings).length>0?(n(),c("div",Kv,[(n(!0),c(F,null,x(o.metaSettings,B=>(n(),c("div",Zv,[l("h4",null,d(B.section_title),1),a(G,{formData:B.settings,formFields:B.fields,disableSubmit:!0},null,8,["formData","formFields"])]))),256))])):_("",!0)])),[[ae,o.fetchingMetaBoxes]])])):(n(),c("div",Jv,[l("p",null,d(e.$t("Course Module is disabled. Please enable the course module first")),1),l("a",{class:"el-button el-button--default fcom_primary_button fcom_mt_10",href:e.$getRouteLink("admin/settings/features")},d(e.$t("Go to features settings")),9,Qv)]))}const e2=I(bv,[["render",Xv]]),t2={name:"SpaceCourseSelector",components:{SpaceIcon:Ze},emits:["update:modelValue","selectedType","selectedSlug"],props:{modelValue:{type:[String,Number,Array],default:""},placeholder_text:{type:String,default:""},is_multiple:{type:Boolean,default:!1},memberships:{type:Array,default:[]}},data(){return{all_spaces:[],selected_spaces:"",loading:!1,formattedSpaceGroups:[],app_ready:!1}},watch:{selected_spaces(e){this.is_multiple?this.$emit("update:modelValue",Array.isArray(e)?e:[]):this.$emit("update:modelValue",e||"")}},methods:{isMemberOfSpace(e){return this.memberships&&this.memberships.includes(e.toString())},fetch(){this.loading=!0,this.$get("admin/all_space_courses").then(e=>{this.all_spaces=e.all_spaces,this.formatSpaceGroups()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},emitChanges(){this.$emit("update:modelValue",this.selected_spaces||"");const e=Array.isArray(this.selected_spaces)&&this.selected_spaces.length?this.selected_spaces[0]:this.selected_spaces,t=this.all_spaces.find(s=>s.id==e);this.$emit("selectedSlug",(t==null?void 0:t.slug)||""),this.$emit("selectedType",(t==null?void 0:t.type)=="course"?"course":"space")},formatSpaceGroups(){if(this.all_spaces.length==0)return;let e=this.all_spaces,t=this.appVars.space_groups,s=[],u=[];this.each(t,i=>{let m=e.filter(f=>{let h=f.parent_id==i.id;return h&&u.push(f.slug),h});m.length&&s.push({label:i.title,spaces:m})});let o=e.filter(i=>i.parent_id===null);o&&o.length&&s.push({label:this.$t("Uncategorized"),spaces:o}),this.formattedSpaceGroups=s}},mounted(){this.is_multiple?this.selected_spaces=Array.isArray(this.modelValue)?this.modelValue:[]:this.selected_spaces=this.modelValue||"",this.fetch(),this.app_ready=!0}},s2={key:0,class:"fcom_space_title"},o2={key:0},i2={key:1};function n2(e,t,s,u,o,i){const m=p("SpaceIcon"),f=ne,h=Ct,g=le,w=te("loading");return o.app_ready?(n(),y(g,{key:0,onChange:i.emitChanges,modelValue:o.selected_spaces,"onUpdate:modelValue":t[0]||(t[0]=b=>o.selected_spaces=b),filterable:"",multiple:s.is_multiple,placeholder:s.placeholder_text,style:{width:"100%"}},{default:r(()=>[(n(!0),c(F,null,x(o.formattedSpaceGroups,b=>W((n(),y(h,{key:b.label,label:b.label},{default:r(()=>[(n(!0),c(F,null,x(b.spaces,S=>(n(),y(f,{key:S.slug,label:S.title,disabled:i.isMemberOfSpace(S.id),value:S.id.toString()},{default:r(()=>[S.id?(n(),c("span",s2,[a(m,{space_profile:S},null,8,["space_profile"]),l("span",null,[V(d(e.getExcerpt(S.title,50))+" ",1),S.type=="course"?(n(),c("span",o2," ("+d(e.$t("course"))+")",1)):_("",!0)])])):(n(),c("span",i2,d(e.getExcerpt(S.title,50)),1))]),_:2},1032,["label","disabled","value"]))),128))]),_:2},1032,["label"])),[[w,o.loading]])),128))]),_:1},8,["onChange","modelValue","multiple","placeholder"])):_("",!0)}const Nt=I(t2,[["render",n2]]),l2={name:"SidebarLinkForm",components:{SpaceGroupSelector:gs,LogoEmojiSelector:xt,SpaceCourseSelector:Nt,ErrorAlerts:Ot},emits:["completed"],data(){return{saving:!1,formErrors:[],form:{title:"",privacy:"public",parent_id:"",settings:{permalink:"",new_tab:"yes",emoji:"🔗",shape_svg:"",memberships:[]}},dataLoaded:!1}},props:{link:{type:Object,default:()=>({})},parent_id:{type:[Number,String],default:null}},methods:{validateForm(){return this.formErrors=[],(!this.form.title||!this.form.title.trim())&&this.formErrors.push(this.$t("Link title is required.")),(!this.form.settings.permalink||!this.form.settings.permalink.trim())&&this.formErrors.push(this.$t("URL cannot be empty.")),this.formErrors.length===0},saveSettings(){this.validateForm()&&(this.saving=!0,this.$post("admin/links",{link:this.form}).then(e=>{this.$eventBus.emit("reloadMenu"),this.$emit("completed",e.link),this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1}))}},mounted(){this.link&&this.link.id?this.form=this.link:this.parent_id?this.form.parent_id=this.parent_id:this.$route.query.parent_id&&(this.form.parent_id=this.$route.query.parent_id),this.dataLoaded=!0}},a2={class:"fcom_form_section"},r2={class:"fcom_help_text"},c2={class:"fcom_help_text"},d2={class:"fcom_help_text"},u2={key:0},_2={key:1};function m2(e,t,s,u,o,i){const m=p("logo-emoji-selector"),f=se,h=ue,g=he,w=p("space-group-selector"),b=Re,S=ve,k=p("SpaceCourseSelector"),$=p("error-alerts"),v=H,C=_e,L=te("loading");return n(),y(C,{onSubmit:t[8]||(t[8]=z(M=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[9]||(t[9]=M=>o.form=M),"label-position":"top","require-asterisk-position":"right",class:"fcom_space_form"},{default:r(()=>[l("div",a2,[a(h,{label:e.$t("Link Title"),required:""},{default:r(()=>[a(f,{type:"text",placeholder:e.$t("Your Link Title"),modelValue:o.form.title,"onUpdate:modelValue":t[1]||(t[1]=M=>o.form.title=M)},{prepend:r(()=>{var M,E;return[o.dataLoaded?(n(),y(m,{key:0,custom_svg:!0,onUpdate:t[0]||(t[0]=T=>{o.form.settings.emoji=T.emoji,o.form.logo=T.logo,o.form.settings.shape_svg=T.shape_svg}),config:{logo:o.form.logo,emoji:((M=o.form.settings)==null?void 0:M.emoji)||"",shape_svg:((E=o.form.settings)==null?void 0:E.shape_svg)||""}},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Permalink"),required:""},{default:r(()=>[a(f,{placeholder:e.$t("URL of the link"),modelValue:o.form.settings.permalink,"onUpdate:modelValue":t[2]||(t[2]=M=>o.form.settings.permalink=M)},null,8,["placeholder","modelValue"]),l("div",r2,[a(g,{modelValue:o.form.settings.new_tab,"onUpdate:modelValue":t[3]||(t[3]=M=>o.form.settings.new_tab=M),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Open this link in new tab")),1)]),_:1},8,["modelValue"])])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:r(()=>[o.dataLoaded?(n(),y(w,{key:0,modelValue:o.form.parent_id,"onUpdate:modelValue":t[4]||(t[4]=M=>o.form.parent_id=M),space_id:o.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",c2,[l("p",null,d(e.$t("Select a menu group to where this link will be added to the sidebar.")),1)])]),_:1},8,["label"]),a(h,{label:e.$t("Visibility")},{default:r(()=>[a(S,{modelValue:o.form.privacy,"onUpdate:modelValue":t[5]||(t[5]=M=>o.form.privacy=M)},{default:r(()=>[a(b,{label:e.$t("Everyone"),value:"public"},null,8,["label"]),a(b,{label:e.$t("Logged-in users only"),value:"logged_in"},null,8,["label"]),a(b,{label:e.$t("By Space/Course Memberships"),value:"members_only"},null,8,["label"])]),_:1},8,["modelValue"]),l("div",d2,[l("p",null,d(e.$t("Select who can see this link.")),1)])]),_:1},8,["label"]),o.form.privacy=="members_only"?(n(),y(h,{key:0,label:e.$t("Select Space/Course Memberships")},{default:r(()=>[a(k,{modelValue:o.form.settings.membership_ids,"onUpdate:modelValue":t[6]||(t[6]=M=>o.form.settings.membership_ids=M),placeholder_text:e.$t("Select Memberships"),is_multiple:!0},null,8,["modelValue","placeholder_text"])]),_:1},8,["label"])):_("",!0),a($,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),a(h,{style:{"margin-top":"45px"}},{default:r(()=>[W((n(),y(v,{class:"fcom_primary_button",disabled:o.saving,onClick:t[7]||(t[7]=M=>i.saveSettings())},{default:r(()=>[o.form.id?(n(),c("span",u2,d(e.$t("Update")),1)):(n(),c("span",_2,d(e.$t("Create Link")),1))]),_:1},8,["disabled"])),[[L,o.saving]])]),_:1})])]),_:1},8,["modelValue"])}const h2=I(l2,[["render",m2]]),f2={name:"SpaceIcon"},p2={version:"1.1",viewBox:"0 0 128 128","xml:space":"preserve"},g2=Te('<g><path d="M64,42c-13.2,0-24,10.8-24,24s10.8,24,24,24s24-10.8,24-24S77.2,42,64,42z M64,82c-8.8,0-16-7.2-16-16s7.2-16,16-16 s16,7.2,16,16S72.8,82,64,82z"></path><path d="M64,100.8c-14.9,0-29.2,6.2-39.4,17.1l-2.7,2.9l5.8,5.5l2.7-2.9c8.8-9.4,20.7-14.6,33.6-14.6s24.8,5.2,33.6,14.6l2.7,2.9 l5.8-5.5l-2.7-2.9C93.2,107.1,78.9,100.8,64,100.8z"></path><path d="M97,47.9v8c9.4,0,18.1,3.8,24.6,10.7l5.8-5.5C119.6,52.7,108.5,47.9,97,47.9z"></path><path d="M116.1,20c0-10.5-8.6-19.1-19.1-19.1S77.9,9.5,77.9,20S86.5,39.1,97,39.1S116.1,30.5,116.1,20z M85.9,20 c0-6.1,5-11.1,11.1-11.1s11.1,5,11.1,11.1s-5,11.1-11.1,11.1S85.9,26.1,85.9,20z"></path><path d="M31,47.9c-11.5,0-22.6,4.8-30.4,13.2l5.8,5.5c6.4-6.9,15.2-10.7,24.6-10.7V47.9z"></path><path d="M50.1,20C50.1,9.5,41.5,0.9,31,0.9S11.9,9.5,11.9,20S20.5,39.1,31,39.1S50.1,30.5,50.1,20z M31,31.1 c-6.1,0-11.1-5-11.1-11.1S24.9,8.9,31,8.9s11.1,5,11.1,11.1S37.1,31.1,31,31.1z"></path></g>',1),y2=[g2];function v2(e,t,s,u,o,i){return n(),c("svg",p2,y2)}const b2=I(f2,[["render",v2]]),k2={name:"CourseIcon"},w2={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},C2=l("path",{d:"M10.734 5.84746L14.7114 6.9072M9.88139 9.01146L11.8701 9.54132M9.98031 14.9723L10.7758 15.1843C13.0258 15.7838 14.1508 16.0835 15.037 15.5747C15.9233 15.0659 16.2247 13.9473 16.8276 11.71L17.6802 8.54599C18.2831 6.3087 18.5845 5.19006 18.0728 4.30879C17.5611 3.42752 16.4362 3.12778 14.1862 2.52831L13.3907 2.31636C11.1407 1.71688 10.0157 1.41714 9.12948 1.92594C8.24322 2.43474 7.94178 3.55338 7.3389 5.79067L6.4863 8.95466C5.88342 11.1919 5.58198 12.3106 6.09367 13.1919C6.60536 14.0731 7.73034 14.3729 9.98031 14.9723Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),$2=l("path",{d:"M9.99996 17.4559L9.20634 17.672C6.96165 18.2832 5.83931 18.5889 4.95512 18.0701C4.07093 17.5513 3.7702 16.4107 3.16874 14.1295L2.31814 10.9035C1.71668 8.62232 1.41595 7.48174 1.92643 6.58318C2.36802 5.80591 3.33329 5.83421 4.58329 5.83411",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),S2=[C2,$2];function V2(e,t,s,u,o,i){return n(),c("svg",w2,S2)}const M2=I(k2,[["render",V2]]),L2={name:"SpaceCreateModal",components:{Drawer:ps,CreateSpaceForm:jt,CreateCourseForm:e2,SidebarLinkForm:h2,ArrowLeftBold:Ks,SpaceIcon:b2,CourseIcon:M2,Link:Zs},data(){return{step:"choose_type",parent_id:null,showCreateSpaceModal:!1,select_type:"space_form",disable_redirect:!1,enteredForm:!1}},computed:{currentTitle(){return this.step==="choose_type"?this.$t("Choose a Space Type"):this.step==="space_form"?this.$t("Create a Discussion Space"):this.step==="course_form"?this.$t("Create a Course"):this.step==="link_form"?this.$t("Create a Link"):""},leaveMessage(){return this.enteredForm?this.$t("Some settings have been changed. Are you sure to leave this page?"):this.$t("Closing will discard your changes. Are you sure?")}},watch:{showCreateSpaceModal(e){e||(this._resetState(),this._clearUrlQuery())}},methods:{handleNextStep(){this.enteredForm=!0,this.step=this.select_type},_resetState(){this.step="choose_type",this.select_type="space_form",this.enteredForm=!1},_clearUrlQuery(){const{create_space:e,parent_id:t,...s}=this.$route.query;e===void 0&&t===void 0||this.$router.replace({query:s})},handleCompleted(e){this.enteredForm=!1,this.parent_id=null,this.showCreateSpaceModal=!1,this.$eventBus.emit("spaceCreated",e)}},beforeUnmount(){this.$eventBus.off("createSpaceModal")},created(){this.$eventBus.on("createSpaceModal",e=>{const t=this.$route.query.parent_id||null;this._resetState(),this.showCreateSpaceModal=!0,this.parent_id=e&&e.parent_id||t||null,e&&(this.disable_redirect=!!e.disable_redirect,e.spaceConfig?(this.step="space_form",this.select_type="space_form",this.enteredForm=!0):e.course_config&&(this.select_type="course_form",this.step="course_form",this.enteredForm=!0))})},mounted(){this.$router.isReady().then(()=>{const{create_space:e,parent_id:t}=this.$route.query;e==="yes"&&t&&this.$eventBus.emit("createSpaceModal",{parent_id:t})})}},T2={class:"dialog_header"},F2={class:"dialog_left"},P2={class:"dialog_body"},I2={key:0,class:"space-type-selector"},E2={class:"space-cards"},U2={class:"space-card-label"},A2={class:"space-card-label"},B2={key:0,class:"space-card-note"},D2={class:"space-card-label"},R2={key:0,class:"space-card-note"},x2={class:"dialog_footer"};function H2(e,t,s,u,o,i){const m=p("ArrowLeftBold"),f=j,h=H,g=p("SpaceIcon"),w=p("CourseIcon"),b=p("Link"),S=p("create-space-form"),k=p("create-course-form"),$=p("sidebar-link-form"),v=p("Drawer");return n(),y(v,{modelValue:o.showCreateSpaceModal,"onUpdate:modelValue":t[5]||(t[5]=C=>o.showCreateSpaceModal=C),size:e.drawerWidth,"close-on-click-modal":!0,"has-close-confirmation":o.enteredForm,"close-confirmation-message":i.leaveMessage,drawerClass:"fcom_space_create_drawer"},ge({header:r(()=>[l("div",T2,[l("div",F2,[o.step!="choose_type"?(n(),y(h,{key:0,"aria-label":e.$t("Back"),onClick:t[0]||(t[0]=C=>o.step="choose_type"),text:"",size:"small"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])):_("",!0),l("h4",null,d(i.currentTitle),1)])])]),default:r(()=>[l("div",P2,[o.step=="choose_type"?(n(),c("div",I2,[l("div",E2,[l("div",{onClick:t[1]||(t[1]=C=>o.select_type="space_form"),class:R([{"is-active":o.select_type==="space_form"},"space-card"])},[a(f,{class:"space-card-icon"},{default:r(()=>[a(g)]),_:1}),l("span",U2,d(e.$t("Discussion Space")),1)],2),l("div",{onClick:t[2]||(t[2]=C=>!!e.hasFeature("has_course")&&(o.select_type="course_form")),class:R([{"is-active":o.select_type==="course_form","is-disabled":!e.hasFeature("has_course")},"space-card"])},[a(f,{class:"space-card-icon"},{default:r(()=>[a(w)]),_:1}),l("span",A2,d(e.$t("Course")),1),e.hasFeature("has_course")?_("",!0):(n(),c("span",B2,d(e.$t("Course Module is disabled")),1))],2),l("div",{onClick:t[3]||(t[3]=C=>!!e.appVars.pro&&(o.select_type="link_form")),class:R([{"is-active":o.select_type==="link_form","is-disabled":!e.appVars.pro},"space-card"])},[a(f,{class:"space-card-icon"},{default:r(()=>[a(b)]),_:1}),l("span",D2,d(e.$t("Link")),1),e.appVars.pro?_("",!0):(n(),c("span",R2,d(e.$t("Pro Required")),1))],2)])])):o.step=="space_form"?(n(),y(S,{key:1,disable_redirect:o.disable_redirect,parent_id:o.parent_id,onCompleted:i.handleCompleted},null,8,["disable_redirect","parent_id","onCompleted"])):o.step=="course_form"?(n(),y(k,{key:2,disable_redirect:o.disable_redirect,parent_id:o.parent_id,onCompleted:i.handleCompleted},null,8,["disable_redirect","parent_id","onCompleted"])):o.step=="link_form"?(n(),y($,{key:3,parent_id:o.parent_id,onCompleted:i.handleCompleted},null,8,["parent_id","onCompleted"])):_("",!0)])]),_:2},[o.step=="choose_type"?{name:"footer",fn:r(()=>[l("div",x2,[a(h,{disabled:!o.select_type,class:"fcom_primary_button",onClick:t[4]||(t[4]=C=>i.handleNextStep())},{default:r(()=>[V(d(e.$t("Next")),1)]),_:1},8,["disabled"])])]),key:"0"}:void 0]),1032,["modelValue","size","has-close-confirmation","close-confirmation-message"])}const O2=I(L2,[["render",H2]]),j2={name:"ExpandIcon"},N2={xmlns:"http://www.w3.org/2000/svg",id:"icon-20-expand",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},z2=l("path",{d:"M14 2H18V6",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),q2=l("path",{d:"M12 8L18 2",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),G2=l("path",{d:"M6 18H2V14",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),Y2=l("path",{d:"M8 12L2 18",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),W2=[z2,q2,G2,Y2];function K2(e,t,s,u,o,i){return n(),c("svg",N2,W2)}const ys=I(j2,[["render",K2]]),Z2={name:"ReportContentModal",data(){return{reportConfig:null,showModal:!1,saving:!1,contentType:"",reportReason:"",reportExplanation:""}},computed:{currentTitle(){return this.contentType=="comment"?this.$t("Report Comment"):this.$t("Report Post")}},methods:{closeModal(){this.showModal=!1},showReportContentModal(e){this.showModal=!0,this.reportReason="",this.reportExplanation="",this.contentType=e.type,this.reportConfig=e.reportConfig},validateAndSubmit(){if(!this.reportReason){this.$handleError(this.$t("Please select a reason for reporting this content"));return}this.submitReport()},getParentId(){return this.contentType=="comment"?this.reportConfig.id:null},getPostId(){return this.contentType=="post"?this.reportConfig.id:this.reportConfig.post_id},submitReport(){this.saving=!0,this.$post("moderation/report",{content_type:this.contentType,user_id:this.auth.user_id,post_id:this.getPostId(),parent_id:this.getParentId(),reason:this.reportReason,explanation:this.reportExplanation}).then(e=>{this.$notify.success(e.message),this.$eventBus.emit("updateModerationReport",{content:e.content,action:"reported"}),this.closeModal()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},created(){this.$eventBus.on("showReportContentModal",this.showReportContentModal)},beforeUnmount(){this.$eventBus.off("showReportContentModal",this.showReportContentModal)}},J2={class:"dialog_header"},Q2={class:"dialog_left"},X2={class:"dialog_body"},eb={class:"fcom_report_content_form"},tb={class:"dialog_footer"};function sb(e,t,s,u,o,i){const m=ne,f=le,h=ue,g=se,w=_e,b=H,S=be;return o.showModal?(n(),y(S,{key:0,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1,width:e.drawerWidth,modelValue:o.showModal,"onUpdate:modelValue":t[4]||(t[4]=k=>o.showModal=k),direction:"rtl",onClose:i.closeModal},{header:r(()=>[l("div",J2,[l("div",Q2,[l("h4",null,d(i.currentTitle),1)])])]),footer:r(()=>[l("div",tb,[a(b,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=k=>i.closeModal())},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1}),a(b,{class:"fcom_primary_button",onClick:t[3]||(t[3]=k=>i.validateAndSubmit()),loading:o.saving},{default:r(()=>[V(d(e.$t("Report")),1)]),_:1},8,["loading"])])]),default:r(()=>[l("div",X2,[l("div",eb,[a(w,{ref:"reportForm","label-position":"top"},{default:r(()=>[a(h,{label:e.$t("Reason")},{default:r(()=>[a(f,{modelValue:o.reportReason,"onUpdate:modelValue":t[0]||(t[0]=k=>o.reportReason=k),placeholder:e.$t("Please select a reason for reporting this content")},{default:r(()=>[(n(!0),c(F,null,x(e.appVars.report_reasons,(k,$)=>(n(),y(m,{key:$,label:k,value:$},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(h,{label:e.$t("Explanation")},{default:r(()=>[a(g,{modelValue:o.reportExplanation,"onUpdate:modelValue":t[1]||(t[1]=k=>o.reportExplanation=k),placeholder:e.$t("Provide an explanation (Optional)"),type:"textarea",rows:4,maxlength:1e3,"show-word-limit":""},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},512)])])]),_:1},8,["width","modelValue","onClose"])):_("",!0)}const ob=I(Z2,[["render",sb]]),ib={name:"Pagination",emits:["fetch","per_page_change"],props:{pagination:{required:!0,type:Object},extra_sizes:{required:!1,type:Array,default(){return[]}},hide_on_single:{required:!1,type:Boolean,default(){return!0}}},computed:{page_sizes(){const e=[];this.pagination.per_page<10&&e.push(this.pagination.per_page);const t=[10,20,50,80,100,120,150];return[...e,...t,...this.extra_sizes]},pager_layout(){return this.isMobile?"total, sizes, jumper, prev, next":"total, sizes, jumper , prev, pager, next"}},methods:{changePage(e){this.pagination.page=e,this.$emit("fetch")},changeSize(e){this.pagination.per_page=e,this.$emit("per_page_change",e),this.$emit("fetch")}}},nb={class:"fcom_pagination_wrap"};function lb(e,t,s,u,o,i){const m=Xo;return n(),c("div",nb,[a(m,{background:!1,size:"small","pager-count":5,layout:i.pager_layout,onCurrentChange:i.changePage,onSizeChange:i.changeSize,"hide-on-single-page":s.hide_on_single,"current-page":s.pagination.page,"page-sizes":i.page_sizes,"page-size":s.pagination.per_page,total:s.pagination.total},null,8,["layout","onCurrentChange","onSizeChange","hide-on-single-page","current-page","page-sizes","page-size","total"])])}const $e=I(ib,[["render",lb]]),ab={name:"ReportReviewModal",components:{Pagination:$e},data(){return{isOpen:!1,loading:!1,content:{},postReports:[],report:null,type:null,ignoring:!1,unpublishing:!1,pagination:{page:1,per_page:10,total:0}}},computed:{getReason(){return e=>this.appVars.report_reasons[e]},isContentLive(){var e;return((e=this.content)==null?void 0:e.status)=="published"},getPublishBtnText(){return this.isContentLive?this.$t("Dismiss Reports"):this.$t("Approve")+" "+this.$t(this.ucFirst(this.type))},getUnpublishBtnText(){return this.isContentLive?this.$t("Unpublish")+" "+this.$t(this.ucFirst(this.type)):this.$t("Remove")+" "+this.$t(this.ucFirst(this.type))}},methods:{closeModal(){this.isOpen=!1,this.content={},this.type=null,this.postReports=[],this.report=null,this.pagination={page:1,per_page:10,total:0}},showReportReviewModal(e){this.isOpen=!0,this.content=e.content,this.type=e.type,this.getPostReports()},getPostReports(){var t;this.loading=!0;let e={page:this.pagination.page,per_page:this.pagination.per_page,content_type:this.type,space_id:(t=this.content)==null?void 0:t.space_id};this.type=="comment"?e.parent_id=this.content.id:e.post_id=this.content.id,this.$get("moderation/reports",e).then(s=>{this.postReports=s.reports.data,this.report=s.reports.data[0]||null,this.pagination.total=s.reports.total}).catch(s=>{this.$handleError(s)}).finally(()=>{this.loading=!1})},ignoreReport(){var e,t;if(!((e=this.report)!=null&&e.id)){this.$notify.error(this.$t("No moderation report found for this content."));return}this.ignoring=!0,this.$put("moderation/reports/"+this.report.id,{space_id:(t=this.content)==null?void 0:t.space_id,status:"ignored"}).then(s=>{this.$notify.success(s.message),this.isOpen=!1,this.$eventBus.emit("updateModerationReport",{content:s.content,action:"ignored",type:this.type}),this.closeModal()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.ignoring=!1})},unpublishReport(){var e,t;if(!((e=this.report)!=null&&e.id)){this.$notify.error(this.$t("No moderation report found for this content."));return}this.unpublishing=!0,this.$put("moderation/reports/"+this.report.id,{space_id:(t=this.content)==null?void 0:t.space_id,status:"unpublished"}).then(s=>{this.$notify.success(s.message),this.isOpen=!1,this.$eventBus.emit("updateModerationReport",{content:s.content,action:"unpublished",type:this.type}),this.closeModal()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.unpublishing=!1})}},created(){this.$eventBus.on("showReportReviewModal",this.showReportReviewModal)},beforeUnmount(){this.$eventBus.off("showReportReviewModal",this.showReportReviewModal)}},rb={class:"dialog_body"},cb={class:"report_details"},db={class:"report_details_header"},ub={class:"report_details_header_left"},_b={class:"report_details_header_right"},mb={key:0},hb={key:1},fb={key:1},pb={class:"report_reason"},gb=["title"],yb={key:0,class:"report_details_body"},vb=["textContent"],bb={key:2,role:"region","aria-label":"Pagination",class:"pagination_wrap"},kb={class:"dialog_footer report_footer"};function wb(e,t,s,u,o,i){const m=p("UserAvatar"),f=p("UserRouteLink"),h=Z,g=p("Pagination"),w=H,b=be;return n(),y(b,{modelValue:o.isOpen,"onUpdate:modelValue":t[3]||(t[3]=S=>o.isOpen=S),"modal-class":"fcom_common_dialog",id:"fluent_comminity_body",width:e.dialogWidth,"append-to-body":!0,"close-on-click-modal":!1,direction:"rtl",onClose:i.closeModal},{footer:r(()=>[l("div",kb,[a(w,{class:"fcom_secondary_button",onClick:t[1]||(t[1]=S=>i.unpublishReport()),loading:o.unpublishing,disabled:!o.loading&&!o.report},{default:r(()=>[V(d(i.getUnpublishBtnText),1)]),_:1},8,["loading","disabled"]),a(w,{class:"fcom_primary_button",onClick:t[2]||(t[2]=S=>i.ignoreReport()),loading:o.ignoring,disabled:!o.loading&&!o.report},{default:r(()=>[V(d(i.getPublishBtnText),1)]),_:1},8,["loading","disabled"])])]),default:r(()=>{var S,k;return[l("div",rb,[l("h4",null,d(e.$t("Reports")+" ("+((k=(S=o.content)==null?void 0:S.meta)==null?void 0:k.reports_count)+")"),1),l("div",cb,[o.loading?(n(),y(h,{key:1,rows:5,animated:!0})):(n(!0),c(F,{key:0},x(o.postReports,$=>(n(),c("div",{key:$.id,class:"report_details_item"},[l("div",db,[l("div",ub,[$.reporter?(n(),y(m,{key:0,with_level:!1,xprofile:$.reporter},null,8,["xprofile"])):_("",!0)]),l("div",_b,[!$.reporter&&!i.getReason($.reason)?(n(),c("div",mb,d(e.$t("Flagged automatically by the site rule")),1)):(n(),c("div",hb,[$.reporter?(n(),y(f,{key:0,show_verified:!1,xprofile:$.reporter},null,8,["xprofile"])):(n(),c("span",fb,d(e.$t("By System ")),1)),i.getReason($.reason)?(n(),c(F,{key:2},[l("span",null,d(e.$t("reported for ")),1),l("span",pb,d(i.getReason($.reason)),1)],64)):_("",!0)])),l("div",{title:$.created_at,class:"meta_line"},d(e.humanDateDiff($.created_at)),9,gb)])]),$.explanation?(n(),c("div",yb,[l("div",{textContent:d($.explanation)},null,8,vb)])):_("",!0)]))),128)),o.pagination.total?(n(),c("div",bb,[a(g,{hide_on_single:!0,onFetch:t[0]||(t[0]=$=>i.getPostReports()),pagination:o.pagination},null,8,["pagination"])])):_("",!0)])])]}),_:1},8,["modelValue","width","onClose"])}const Cb=I(ab,[["render",wb]]),$b={name:"PreviewPostModal",components:{Feed:nt},data(){return{loading:!1,isOpen:!1,previewData:null,allSpaces:this.appVars.auth.spaces}},methods:{closeModal(){this.isOpen=!1,this.previewData=null},showPreviewPostModal(e){if(e!=null&&e.message){if(!(e!=null&&e.space)&&!(e!=null&&e.is_editing)){this.$handleError({message:this.$t("Please select a space to preview.")});return}}else{this.$handleError({message:this.$t("Please write a message to preview.")});return}this.isOpen=!0,this.preparePreviewData(e),this.generatePreview()},preparePreviewData(e){var t;this.previewData={...e,xprofile:(t=e.author)!=null&&t.name?{display_name:e.author.name,avatar:e.author.avatar}:this.appVars.auth,space:this.allSpaces[e==null?void 0:e.space],created_at:dayjs.utc().subtract(this.appVars.date_offset,"s").format("YYYY-MM-DD HH:mm:ss"),content_type:this.determineContentType(e),meta:this.prepareMetadata(e),terms:this.processTopicIds(e)}},determineContentType(e){return e!=null&&e.survey?"survey":e!=null&&e.document_ids?"document":"post"},prepareMetadata(e){return{...e==null?void 0:e.meta,survey_config:e==null?void 0:e.survey,document_lists:e==null?void 0:e.document_ids}},processTopicIds(e){let t=e==null?void 0:e.topic_ids;return t?(t=Array.isArray(t)?t:[t],t.map(s=>this.currentTopics(e==null?void 0:e.space).find(u=>u.id==s))):[]},currentTopics(e){var s;if(!e)return[];let t=((s=this.allSpaces[e])==null?void 0:s.topics)||[];return t=Object.values(t),this.isModerator(e)?t:t.filter(u=>u.admin_only!="yes")},generatePreview(){this.loading=!0,this.$post("feeds/markdown-preview",{text:this.previewData.message,feed:this.previewData,with:["meta"]}).then(e=>{this.previewData.message_rendered=e.html,this.previewData.meta={...this.previewData.meta,...e.meta}}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},created(){this.$eventBus.on("showPreviewPostModal",this.showPreviewPostModal)},beforeUnmount(){this.$eventBus.off("showPreviewPostModal",this.showPreviewPostModal)}};function Sb(e,t,s,u,o,i){const m=Z,f=H,h=p("Feed"),g=ke,w=be;return o.previewData?(n(),y(w,{key:0,modelValue:o.isOpen,"onUpdate:modelValue":t[0]||(t[0]=b=>o.isOpen=b),class:"fcom_feed_modal",width:e.dialogWidth,"align-center":!0,"append-to-body":!0,"close-on-click-modal":!1,onClose:i.closeModal},{default:r(()=>[a(g,{ref:"feed_dialog_scroller","max-height":"calc(100dvh - 40px)"},{default:r(()=>[o.loading?(n(),y(m,{key:0,rows:4,animated:!0})):(n(),y(h,{key:1,feed:o.previewData,is_single:!0,is_preview:!0,show_actions:!1,show_footer:!1},{after_feed_actions:r(()=>[a(f,{style:{padding:"0 5px"},class:"no_pad_bt fcom_close_pop",onClick:i.closeModal,text:""},null,8,["onClick"])]),_:1},8,["feed"]))]),_:1},512)]),_:1},8,["modelValue","width","onClose"])):_("",!0)}const Vb=I($b,[["render",Sb]]),Mb={name:"UnfinishedChangesModal",emits:["proceed"],data(){return{isVisible:!1,message:""}},methods:{handleCancel(){this.isVisible=!1,window.fcom_pending_modal_close=!1},handleProceed(){this.isVisible=!1,window.fcom_pending_modal_close?(this.$emit("proceed"),window.fcom_pending_modal_close=!1,window.fcom_modal_comment_unsaved=!1):this.$eventBus.emit("unsavedChangesProceeded")},showModal(e){e==="feed"?this.message=this.$t("You haven't finished your post yet. Do you want to leave without finishing?"):e==="comment"&&(this.message=this.$t("You haven't finished your comment yet. Do you want to leave without finishing?")),this.isVisible=!0}},mounted(){this.$eventBus.on("showUnsavedChangesModal",this.showModal)},beforeUnmount(){this.$eventBus.off("showUnsavedChangesModal",this.showModal)}},Lb={class:"dialog_header"},Tb={class:"dialog_left"},Fb={class:"dialog_body"},Pb={class:"dialog_footer"};function Ib(e,t,s,u,o,i){const m=H,f=be;return n(),y(f,{"modal-class":"fcom_common_dialog fcom_editor_unfinished_dialog",modelValue:o.isVisible,"onUpdate:modelValue":t[0]||(t[0]=h=>o.isVisible=h),width:e.modalWidth,"close-on-click-modal":!1,"close-on-press-escape":!1,"append-to-body":!0,"show-close":!1},{header:r(()=>[l("div",Lb,[l("div",Tb,[l("h4",null,d(e.$t("Leave Page?")),1)])])]),footer:r(()=>[l("div",Pb,[a(m,{class:"fcom_secondary_button",onClick:i.handleCancel},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1},8,["onClick"]),a(m,{class:"fcom_primary_button",onClick:i.handleProceed},{default:r(()=>[V(d(e.$t("Leave")),1)]),_:1},8,["onClick"])])]),default:r(()=>[l("div",Fb,[l("span",null,d(o.message),1)])]),_:1},8,["modelValue","width"])}const Eb=I(Mb,[["render",Ib]]),Ub={name:"MentionPopover",components:{UserRouteLink:Pe},setup(){return{userStore:De()}},data(){return{xprofile:null,virtualRef:null,hideTimeout:null,cache:{},cacheTTL:5*60*1e3,requestId:0}},methods:{getCached(e){const t=this.cache[e];return t?Date.now()-t.timestamp>this.cacheTTL?(delete this.cache[e],null):t.data:null},setCache(e,t){this.cache[e]={data:t,timestamp:Date.now()}},async showPopover({username:e,triggerElement:t}){this.cancelHide();const s=++this.requestId;let u=this.getCached(e);if(!u){try{u=await this.userStore.fetchProfile(e)}catch{return}this.setCache(e,u)}s===this.requestId&&(this.xprofile=u,this.virtualRef=t)},cancelHide(){clearTimeout(this.hideTimeout)},startHideTimeout(){this.cancelHide(),this.hideTimeout=setTimeout(()=>{this.virtualRef=null},200)}},mounted(){this.$eventBus.on("show_mention_popover",this.showPopover),this.$eventBus.on("hide_mention_popover",this.startHideTimeout)},beforeUnmount(){this.$eventBus.off("show_mention_popover",this.showPopover),this.$eventBus.off("hide_mention_popover",this.startHideTimeout),clearTimeout(this.hideTimeout)}};function Ab(e,t,s,u,o,i){const m=p("UserRouteLink");return o.virtualRef&&o.xprofile?(n(),y(m,{key:0,xprofile:o.xprofile,virtualRef:o.virtualRef,show_badge:!0,show_follow:!0,onPopoverMouseenter:i.cancelHide,onPopoverMouseleave:i.startHideTimeout},null,8,["xprofile","virtualRef","onPopoverMouseenter","onPopoverMouseleave"])):_("",!0)}const Bb=I(Ub,[["render",Ab]]);let Db=window.fluentComAdmin.el_i18n;for(const[e,t]of Object.entries(Db))js.el[e]=t;const Rb={name:"PortalApplication",components:{NotificationsPop:cl,SearchBar:Bg,Feed:nt,SpaceCreateModal:O2,ReportContentModal:ob,ElConfigProvider:Ns,ExpandIcon:ys,ReportReviewModal:Cb,PreviewPostModal:Vb,UnfinishedChangesModal:Eb,MentionPopover:Bb},setup(){const e=oo(),t=Me();return{tickerStore:e,feedStore:t}},data(){return{loading:!1,mobileMenuItems:this.appVars.mobileMenuItems,hasSearchHolder:!1,hasNotificationHolder:!1,isSmallScreen:!1,popFeed:null,shopPopFeed:!1,prevUrl:null,previousFocus:null,enLang:js,loadedStyles:{},tickerDismissed:!1}},computed:{newFeedsCount(){return this.feedStore.getNewPostsCount("global")||0}},watch:{$route(e,t){var i,m;if(this.popFeed&&(this.prevUrl=e.href,this.closeFeedModal()),(i=e.meta)!=null&&i.lazy_styles&&this.loadLazyStyles(e.meta.lazy_styles),(m=e.meta)!=null&&m.in_space&&e.params.space){let f=e.params.space;const h=document.querySelectorAll(`.fcom_space_${f} .fcom_unread_count`);for(let g=0,w=h.length;g<w;g++)h[g].remove()}if(e.name==t.name&&e.path===t.path&&e.query.topic!=t.query.topic){this.$eventBus.emit("topic_changed",e.query.topic);return}e.query.create_space&&e.query.parent_id&&this.$eventBus.emit("open_create_space_modal",e.query.create_space),this.$eventBus.emit("route_updated",{to:e,from:t});const s=e.name;document.body.setAttribute("data-route",s),document.dispatchEvent(new CustomEvent("route_updated",{detail:{to:e,from:t}})),document.querySelectorAll(".feed_layout").forEach(f=>{f.classList.remove("space_opened")}),this.isSmallScreen&&document.querySelector(".feed_layout")&&document.querySelector(".feed_layout").classList.remove("space_opened");const u=e.meta.active_menu;document.querySelectorAll(".fcom_general_menu a").forEach(f=>{f.classList.remove("router-link-exact-active")}),u&&document.querySelectorAll(".fcom_general_menu a.fcom_"+u).forEach(f=>{f.classList.add("router-link-exact-active")}),document.querySelectorAll(".fcom_sidebar_contents a").forEach(f=>{f.classList.remove("router-link-exact-active")}),u&&document.querySelectorAll(".fcom_sidebar_contents a.fcom_"+u).forEach(f=>{f.classList.add("router-link-exact-active")});const o=(f,h)=>{var g;if(h)try{(g=document.querySelector(f+h))==null||g.classList.add("router-link-exact-active")}catch(w){console.error(w)}};e.meta.in_course&&o(".fcom_space_",e.params.course_slug),e.meta.in_space&&o(".space_contents a.fcom_space_",e.params.space)}},methods:{dismissTicker(){this.tickerDismissed=!0,this.feedStore.clearNewPostsCount("global"),console.log("[App] Ticker dismissed")},routeToAllFeeds(){this.changeTitle(this.$t("Feeds")),this.tickerDismissed=!0,this.feedStore.clearNewPostsCount("global"),this.$router.push({name:"dashboard",query:{stamp:new Date().getTime(),sort_by:"latest"}})},reloadSidebarMenu(){this.$get("options/sidebar-menu-html").then(e=>{e.sidebar_html&&document.getElementById("fcom_sidebar_wrap")&&(document.getElementById("fcom_sidebar_wrap").innerHTML=e.sidebar_html,document.dispatchEvent(new CustomEvent("sidebar_menu_reloaded"))),e.auth_spaces&&(this.auth=e.auth_spaces)})},showFeedModal(e){e.feed&&(this.previousFocus=document.activeElement,this.popFeed=e.feed,this.shopPopFeed=!0,this.prevUrl=window.location.href,window.history.pushState({},"",e.feed.permalink),document.body.classList.add("fcom_post_modal_opened"),e.view=="comments"&&this.$nextTick(()=>{setTimeout(()=>{var m;const t=(m=this.$refs.feed_dialog_scroller)==null?void 0:m.wrapRef;if(!t)return;const s=e.highlight_comment_id,u=s?"instant":"smooth",o=s&&t.querySelector("#comment_"+s);if(o){t.querySelectorAll(".fcom_highlight_comment").forEach(f=>{f.classList.remove("fcom_highlight_comment")}),o.classList.add("fcom_highlight_comment"),t.scrollTo({top:o.offsetTop-100,behavior:u}),o.setAttribute("tabindex","-1"),o.focus({preventScroll:!0}),this.keepCommentInView(t,o);return}const i=t.querySelector(".feed_footer");i&&t.scrollTo({top:i.offsetTop-100,behavior:u})},100)}))},keepCommentInView(e,t){if(typeof ResizeObserver>"u")return;const s=new ResizeObserver(()=>{if(!e.contains(t)){s.disconnect();return}e.scrollTo({top:t.offsetTop-100,behavior:"instant"})});s.observe(e.firstElementChild||e),setTimeout(()=>s.disconnect(),2e3)},closeFeedModal(){if(window.fcom_modal_comment_unsaved){window.fcom_pending_modal_close=!0,this.$refs.unfinishedChangesModal.showModal("comment");return}this.proceedCloseFeedModal()},proceedCloseFeedModal(){this.shopPopFeed=!1,this.popFeed=null,this.prevUrl&&window.history.pushState({},"",this.prevUrl),document.body.classList.remove("fcom_post_modal_opened"),this.previousFocus&&typeof this.previousFocus.focus=="function"&&this.$nextTick(()=>{this.previousFocus.focus({preventScroll:!0}),this.previousFocus=null})},gotToFeed(){let e={name:"single_feed",params:{feed_slug:this.popFeed.slug}};this.popFeed.space&&(e={name:"space_feed",params:{feed_slug:this.popFeed.slug,space:this.popFeed.space.slug}}),this.popFeed.auto_focus_comment=!1,window.__showing_feed=this.popFeed,this.$router.push(e),this.$nextTick(()=>{this.closeFeedModal()})},async handleModalFeedDelete(){if(this.popFeed)try{const e=this.popFeed.space?`space-${this.popFeed.space.slug}`:"global";await this.feedStore.deleteFeed(e,this.popFeed.id),this.proceedCloseFeedModal(),this.$notify.success(this.$t("Post deleted successfully"))}catch(e){this.$handleError(e)}},loadLazyStyles(e){this.each(e,t=>{if(!this.appVars.lazy_styles[t]||this.loadedStyles[t])return;this.loadedStyles[t]=!0;let s=document.createElement("link");s.rel="stylesheet",s.href=this.appVars.lazy_styles[t],s.type="text/css",s.id=t,s.media="all",document.head.appendChild(s)})}},created(){const e=document.querySelector(".fcom_notification_holder");this.auth.user_id&&e&&(e.replaceChildren(),this.hasNotificationHolder=!0),this.hasSearchHolder=!!document.getElementsByClassName("fcom_search_holder").length,this.$eventBus.on("fresh_feeds_loaded",t=>{let s=t.space;s||(s="__all"),this.feedMonitorCache[s]=t.feeds[0].id}),document.addEventListener("doCustomGlobalSearch",t=>{this.$eventBus.emit("doGlobalSearch",t.detail.search)}),this.$eventBus.on("reloadMenu",()=>{this.reloadSidebarMenu()}),this.$eventBus.on("toTop",t=>{window.fcomLayoutRef&&(t||(t=0),window.fcomLayoutRef.scrollTo({top:t,behavior:"instant"}))}),this.isSmallScreen=window.innerWidth<=1024},mounted(){this.$eventBus.on("showFeedModal",this.showFeedModal),this.auth.user_id&&(console.log("[App] Starting new Pinia ticker with random intervals (45-75s)..."),this.tickerStore.start()),this.$watch("$route",e=>{e.name==="dashboard"&&(this.tickerDismissed=!1)})},beforeUnmount(){this.tickerStore.isActive&&(console.log("[App] Stopping Pinia ticker..."),this.tickerStore.stop())}},xb={key:0,class:"fcom_new_ticker"},Hb={key:1,class:"fcom_mobile_menu"},Ob={class:"focm_menu_items"},jb=["innerHTML"],Nb=["innerHTML"],zb=["href","aria-label"],qb=["innerHTML"],Gb=["innerHTML"];function Yb(e,t,s,u,o,i){const m=p("router-view"),f=j,h=p("router-link"),g=ei,w=p("ExpandIcon"),b=H,S=p("feed"),k=ke,$=be,v=p("search-bar"),C=p("notifications-pop"),L=p("space-create-modal"),M=p("unfinished-changes-modal"),E=p("preview-post-modal"),T=p("report-content-modal"),P=p("report-review-modal"),U=p("mention-popover"),D=Ns;return n(),y(D,{locale:o.enLang},{default:r(()=>[a(m,{class:R(e.appVars.route_classes)},null,8,["class"]),(n(),y(dt,{to:"body"},[u.tickerStore.isActive&&i.newFeedsCount>0&&!o.tickerDismissed?(n(),c("div",xb,[l("div",{onClick:t[0]||(t[0]=A=>i.routeToAllFeeds()),class:"fcom_ticker_menu"},d(e.$_n("A new post is available","%s new posts available",i.newFeedsCount)),1),l("div",{onClick:t[1]||(t[1]=A=>i.dismissTicker()),class:"fcom_ticker_dismiss"}," x ")])):_("",!0),o.mobileMenuItems&&o.mobileMenuItems.length?(n(),c("div",Hb,[l("div",Ob,[(n(!0),c(F,null,x(o.mobileMenuItems,A=>(n(),c("div",null,[A.route?(n(),y(h,{key:0,"aria-label":A.title?e.$t("Go to %s",A.title):e.$t("Menu item"),class:"focm_menu_item",to:A.route},{default:r(()=>[a(f,null,{default:r(()=>[A.icon?(n(),y(wt(A.icon),{key:0})):A.icon_svg?(n(),c("span",{key:1,innerHTML:A.icon_svg},null,8,jb)):_("",!0)]),_:2},1024),A.html?(n(),c("span",{key:0,innerHTML:A.html},null,8,Nb)):_("",!0)]),_:2},1032,["aria-label","to"])):(n(),c("a",{key:1,href:A.permalink,"aria-label":A.title?e.$t("Go to %s",A.title):e.$t("Menu item"),class:"focm_menu_item"},[A.icon_svg?(n(),y(f,{key:0},{default:r(()=>[l("span",{innerHTML:A.icon_svg},null,8,qb)]),_:2},1024)):_("",!0),l("span",{innerHTML:A.html},null,8,Gb)],8,zb))]))),256))])])):_("",!0),a($,{ref:"fcom_feed_modal","destroy-on-close":"",modelValue:o.shopPopFeed,"onUpdate:modelValue":t[2]||(t[2]=A=>o.shopPopFeed=A),"close-on-click-modal":!0,"close-on-press-escape":!0,"before-close":()=>{i.closeFeedModal()},class:"fcom_feed_modal",width:"100%"},{default:r(()=>[a(k,{ref:"feed_dialog_scroller","max-height":"calc(100dvh - 40px)"},{default:r(()=>[o.popFeed?(n(),y(S,{key:0,onDeleted:i.handleModalFeedDelete,is_single:!0,feed:o.popFeed,is_modal:!0,show_report:!0},{after_feed_actions:r(()=>[a(g,{direction:"vertical"}),a(b,{"aria-label":e.$t("Expand"),onClick:i.gotToFeed,class:"no_pad_btn",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["aria-label","onClick"]),a(b,{"aria-label":e.$t("Close"),style:{padding:"0 5px"},class:"no_pad_bt fcom_close_pop",onClick:i.closeFeedModal,text:""},null,8,["aria-label","onClick"])]),_:1},8,["onDeleted","feed"])):_("",!0)]),_:1},512)]),_:1},8,["modelValue","before-close"])])),o.hasSearchHolder?(n(),y(dt,{key:0,to:".fcom_search_holder"},[a(v)])):_("",!0),o.hasNotificationHolder?(n(),y(dt,{key:1,to:".fcom_notification_holder"},[a(C)])):_("",!0),e.isAdmin?(n(),y(L,{key:2})):_("",!0),a(M,{ref:"unfinishedChangesModal",onProceed:i.proceedCloseFeedModal},null,8,["onProceed"]),a(E),a(T),a(P),a(U)]),_:1},8,["locale"])}const Wb=I(Rb,[["render",Yb]]),Kb={name:"ContentLayout",props:["title","content_class","wrapper_class"]},Zb={key:0,class:"fhr_content_layout_header"},Jb={role:"region","aria-label":"Actions",class:"fhr_page_actions"};function Qb(e,t,s,u,o,i){return n(),c("div",{class:R([s.wrapper_class,"fhr_content_layout"])},[Y(e.$slots,"header",{},()=>[s.title?(n(),c("div",Zb,[Y(e.$slots,"title",{},()=>[l("h1",{role:"region","aria-label":"Page Title",style:{cursor:"pointer"},onClick:t[0]||(t[0]=m=>e.$eventBus.emit("toTop")),class:"fhr_page_title"},d(s.title),1)]),l("div",Jb,[Y(e.$slots,"actions")])])):_("",!0)]),Y(e.$slots,"sub_header"),l("div",{class:R([s.content_class,"fhr_content_layout_body"])},[Y(e.$slots,"default")],2)],2)}const we=I(Kb,[["render",Qb]]),Xb={name:"Dashboard",components:{Layout:we},data(){return{greetings:"",notices:[]}},mounted(){this.$route.query.sort_by=="latest"&&this.$storeLocalData("feed_sort_by",""),this.$router.push({name:"all_feeds"})}},e0={key:0,class:"dashboard_actions"},t0=["innerHTML"],s0={key:1};function o0(e,t,s,u,o,i){const m=p("layout");return n(),y(m,{title:o.greetings},{default:r(()=>[o.notices.length?(n(),c("div",e0,[l("h4",null,d(e.$t("Action required")),1),l("ul",null,[(n(!0),c(F,null,x(o.notices,f=>(n(),c("li",{innerHTML:f},null,8,t0))),256))])])):(n(),c("div",s0,[l("p",null,d(e.$t("All is well! This dashboard will be updated with something awesome!")),1)]))]),_:1},8,["title"])}const i0=I(Xb,[["render",o0]]),n0={name:"AppLayout",props:["wrapper_class"]},l0={class:"feeds_main"};function a0(e,t,s,u,o,i){const m=p("router-view");return n(),c("div",{class:R([s.wrapper_class,"feeds"])},[l("div",l0,[Y(e.$slots,"before_route_view"),Y(e.$slots,"default",{},()=>[a(m)]),Y(e.$slots,"after_route_view")])],2)}const Se=I(n0,[["render",a0]]),r0={name:"NotificationOnboard",data(){return{pushEnabled:!1,permission:"",requestInProgress:!1,confirmed:!1}},computed:{hasPush(){return this.appVars.has_push_notification&&this.pushEnabled&&this.permission!=="granted"}},methods:{async processSubscribe(){if(this.permission==="denied"){let t=`<div style="text-align: center; margin-bottom: 15px;">
2 <img src="${window.fluentNotifyPublic.assets_url+"images/instruction-unblock.png"}" alt="Unblock Notifications Instructions" style="max-width: 100%; height: auto; border: 1px solid #ddd; border-radius: 4px;"/>
3 </div>`;this.$messageBox.alert(this.$t('You have blocked or denied notifications for this site. Please reset permission and then click "Retry Button" to receive push notifications.')+t,this.$t("Notifications Blocked"),{dangerouslyUseHTMLString:!0,confirmButtonText:this.$t("Retry")}).then(()=>{window.fluentNotify&&(this.permission=window.fluentNotify.getPermission(),this.processSubscribe())});return}window.fluentNotify&&(this.requestInProgress=!0,await window.fluentNotify.subscribe()?(this.$notify.success(this.$t("You have successfully subscribed to push notifications.")),this.permission=window.fluentNotify.getPermission(),this.confirmed=!0):this.$notify.error(this.$t("Failed to subscribe to push notifications. Please try again.")),this.requestInProgress=!1,this.permission=window.fluentNotify.getPermission())},watchForPermissionChange(){var e,t;this.pushEnabled=(e=window.fluentNotify)==null?void 0:e.isAvailable,this.permission=(t=window.fluentNotify)==null?void 0:t.getPermission()}},mounted(){var e,t;window.fluentNotify?(this.pushEnabled=(e=window.fluentNotify)==null?void 0:e.isAvailable,this.permission=(t=window.fluentNotify)==null?void 0:t.getPermission()):document.addEventListener("fluent-notify-initialized",this.watchForPermissionChange)},beforeUnmount(){document.removeEventListener("fluent-notify-initialized",this.watchForPermissionChange)}},c0={key:0,class:"app_side_widget widget_push_notification"},d0={class:"widget_header"},u0={style:{display:"flex","column-gap":"8px","align-items":"center",color:"var(--el-color-danger, #f56c6c)"}},_0=l("svg",{width:"24px",height:"24px","stroke-width":"1.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",color:"currentColor"},[l("path",{d:"M18.1336 11C18.7155 16.3755 21 18 21 18H3C3 18 6 15.8667 6 8.4C6 6.70261 6.63214 5.07475 7.75736 3.87452C8.88258 2.67428 10.4087 2 12 2C12.3373 2 12.6717 2.0303 13 2.08949",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M19 8C20.6569 8 22 6.65685 22 5C22 3.34315 20.6569 2 19 2C17.3431 2 16 3.34315 16 5C16 6.65685 17.3431 8 19 8Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M13.73 21C13.5542 21.3031 13.3019 21.5547 12.9982 21.7295C12.6946 21.9044 12.3504 21.9965 12 21.9965C11.6496 21.9965 11.3054 21.9044 11.0018 21.7295C10.6982 21.5547 10.4458 21.3031 10.27 21",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1),m0={class:"widget_body notifications_wrap"},h0={class:"onboard_actions fcom_mt_10"},f0={key:0},p0={key:1},g0={key:0},y0={key:1,class:"app_side_widget widget_push_notification"};function v0(e,t,s,u,o,i){const m=j,f=H;return i.hasPush?(n(),c("div",c0,[l("div",d0,[l("h3",u0,[a(m,{style:{"font-size":"120%"}},{default:r(()=>[_0]),_:1}),l("span",null,d(e.$t("Never Miss a Reply")),1)])]),l("div",m0,[l("p",null,d(e.$t("Get notified about replies to your posts and important community updates via web push notifications.")),1),l("div",h0,[a(f,{loading:o.requestInProgress,type:"primary",onClick:t[0]||(t[0]=h=>i.processSubscribe())},{default:r(()=>[o.requestInProgress?(n(),c("span",p0,d(e.$t("Processing...")),1)):(n(),c("span",f0,d(e.$t("Turn On Push Notifications")),1))]),_:1},8,["loading"])]),o.requestInProgress?(n(),c("p",g0,d(e.$t("Please click Allow to enable notifications.")),1)):_("",!0)])])):o.confirmed?(n(),c("div",y0,[l("p",null,d(e.$t("You will get push notifications on replies and important updates.")),1)])):_("",!0)}const So=I(r0,[["render",v0]]),b0={name:"RecentActivities",components:{NotificationOnboard:So},props:{context:{default(){return{}}},widget_title:{type:String,default(){return""}},pinned_widget_title:{type:String,default(){return""}},with_pins:{type:Boolean,default(){return!1}},is_trending:{type:Boolean,default(){return!1}},with_pending_count:{type:Boolean,default(){return!1}}},data(){return{activities:[],loading:!1,pinned_posts:[],pending_count:0,after_contents:"",before_contents:""}},watch:{"context.space_id"(){this.getActivities()},"context.user_id"(){this.getActivities()}},methods:{getActivities(){this.loading=!0,this.$get("activities",{page:1,per_page:5,context:this.context,with_pins:this.with_pins?1:0,is_trending:this.is_trending?1:0,with_pending_count:this.with_pending_count?1:0}).then(e=>{this.activities=e.activities.data,this.after_contents=e.after_contents,this.before_contents=e.before_contents,e.pinned_posts&&(this.pinned_posts=e.pinned_posts),e.pending_count&&(this.pending_count=e.pending_count)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},goToActivity(e){this.$router.push(e.route)},getActivityLink(e){const t=this.$router.resolve(e.route);let s=this.appVars.urls.portal_base;return s=s.replace(/\/$/,""),s+t.fullPath}},mounted(){this.getActivities(),this.$eventBus.on("recent_activities_refresh",this.getActivities)},beforeUnmount(){this.$eventBus.off("recent_activities_refresh",this.getActivities)}},k0=["innerHTML"],w0={key:1,class:"app_side_widget fcom_widget_highlight"},C0={class:"widget_header"},$0={role:"region","aria-label":"Pending Members"},S0={class:"widget_body"},V0={key:2,role:"region","aria-label":"Featured Posts",class:"app_side_widget widget_recent_activities"},M0={class:"widget_header"},L0={class:"widget_body notifications_wrap"},T0={class:"notification_wrap"},F0=["href"],P0={class:"notification_item"},I0={class:"notification_avatar"},E0={class:"notification_content"},U0=["innerHTML"],A0={style:{"margin-top":"5px"},class:"feed_timestamp"},B0={role:"region","aria-label":"Space Activities",class:"app_side_widget widget_recent_activities"},D0={class:"widget_header"},R0={class:"widget_body notifications_wrap"},x0={class:"notification_wrap"},H0=["href"],O0={class:"notification_avatar"},j0={class:"notification_content"},N0=["innerHTML"],z0=["title"],q0={key:2,class:"notification_wrap"},G0={class:"notification_item"},Y0={class:"notification_content"},W0={class:"no_notifications"},K0=["innerHTML"];function Z0(e,t,s,u,o,i){const m=p("NotificationOnboard"),f=H,h=p("UserAvatar"),g=Z;return n(),c(F,null,[o.before_contents?(n(),c("div",{key:0,innerHTML:o.before_contents},null,8,k0)):_("",!0),a(m),o.pending_count&&s.with_pending_count?(n(),c("div",w0,[l("div",C0,[l("h3",$0,d(e.$t("Pending Members")),1)]),l("div",S0,[l("p",null,d(e.$t("%s people requested to join the community.",o.pending_count)),1)]),a(f,{role:"link","aria-label":"View pending members",onClick:t[0]||(t[0]=w=>e.$router.push({name:"space_members",query:{view_pending:"yes"}})),type:"danger"},{default:r(()=>[V(d(e.$t("View pending members")),1)]),_:1})])):_("",!0),s.with_pins&&o.pinned_posts.length?(n(),c("div",V0,[l("div",M0,[l("h3",null,d(s.pinned_widget_title||e.$t("Featured Posts")),1)]),l("div",L0,[(n(!0),c(F,null,x(o.pinned_posts,w=>{var b;return n(),c("div",T0,[l("a",{class:"no_style_link",href:w.permalink},[l("div",P0,[l("div",I0,[a(h,{with_level:!1,xprofile:w.xprofile},null,8,["xprofile"])]),l("div",E0,[l("div",{innerHTML:w.message},null,8,U0),l("span",A0,d((b=w.xprofile)==null?void 0:b.display_name),1)])])],8,F0)])}),256))])])):_("",!0),l("div",B0,[l("div",D0,[l("h3",null,d(s.widget_title||e.$t("Recent Activities")),1)]),l("div",R0,[o.loading?(n(),y(g,{key:0,animated:!0,rows:5})):o.activities.length?(n(!0),c(F,{key:1},x(o.activities,w=>(n(),c("div",x0,[l("a",{href:i.getActivityLink(w),class:"notification_item"},[l("div",O0,[a(h,{with_level:!1,xprofile:w.xprofile},null,8,["xprofile"])]),l("div",j0,[l("div",{innerHTML:w.message},null,8,N0),l("span",{title:w.updated_at,class:"notification_time_stamp"},d(e.humanDateDiff(w.updated_at)),9,z0)])],8,H0)]))),256)):(n(),c("div",q0,[l("div",G0,[l("div",Y0,[l("div",W0,d(e.$t("No recent activities found")),1)])])]))])]),o.after_contents?(n(),c("div",{key:3,innerHTML:o.after_contents},null,8,K0)):_("",!0)],64)}const zt=I(b0,[["render",Z0]]),J0={name:"BgImageUpload",emits:["update:modelValue"],props:{modelValue:{type:String,required:!1},button_text:{type:String,default(){return""}},can_remove:{type:Boolean,default:!1},is_multiple:{type:Boolean,default:!1},additional_data:{type:Object,default:()=>({})}},data(){return{imageUrl:this.modelValue}},computed:{action_url(){return this.appVars.rest.url+"/feeds/media-upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}}},methods:{handleSuccess(e){this.imageUrl=e.media.url,this.$emit("update:modelValue",this.imageUrl)},handleError(e){this.$handleError(JSON.parse(e.message))},removeImage(){this.imageUrl="",this.$emit("update:modelValue","")}}};function Q0(e,t,s,u,o,i){const m=Fe,f=H,h=mt,g=p("CloseBold"),w=j;return n(),c(F,null,[a(h,{action:i.action_url,headers:i.headers,accept:"image/*",class:"fcom_bg_upload",multiple:s.is_multiple,data:s.additional_data,"show-file-list":!1,"on-success":i.handleSuccess,"on-error":i.handleError},{default:r(()=>[Y(e.$slots,"trigger",{},()=>[Y(e.$slots,"default",{},()=>[o.imageUrl?(n(),y(m,{key:0,alt:e.$t("Image Preview"),src:o.imageUrl},null,8,["alt","src"])):(n(),y(f,{key:1,class:"fcom_btn_upload",text:""},{default:r(()=>[V(d(s.button_text||e.$t("Upload Image")),1)]),_:1}))])])]),_:3},8,["action","headers","multiple","data","on-success","on-error"]),o.imageUrl&&s.can_remove?(n(),y(f,{key:0,"aria-label":e.$t("Remove image"),class:"fcom_bg_remove",text:"",size:"small",onClick:i.removeImage},{default:r(()=>[a(w,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0)],64)}const Vo=I(J0,[["render",Q0]]),X0={name:"WelcomeBannerConfig",props:["savingCount"],emits:["saved"],components:{MediaEmbeder:_s,BgImageUpload:Vo,CrepeEditor:It},data(){return{saving:!1,loading:!1,currentTab:"login",appReady:!1,bannerData:{login:{enable:"no",mediaType:"image",title:"",description:"",allowClose:"yes",bannerImage:"",ctaButtons:[],bannerVideo:{}},logout:{enable:"no",mediaType:"image",title:"",description:"",bannerImage:"",ctaButtons:[],bannerVideo:{}}}}},watch:{savingCount(){this.saveSettings()}},computed:{isEnabled(){return this.bannerData[this.currentTab].enabled=="yes"}},methods:{switchOption(e){this.appReady=!1,this.currentTab=e,this.$nextTick(()=>{this.appReady=!0})},addButton(){this.bannerData[this.currentTab].ctaButtons.push({label:"",link:"",type:"primary",newTab:"yes"})},removeButton(e){this.bannerData[this.currentTab].ctaButtons.splice(e,1)},getSettings(){this.loading=!0,this.$get("admin/welcome-banner").then(e=>{this.bannerData=e.settings,this.appReady=!0}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},saveSettings(){this.saving=!0,this.$post("admin/welcome-banner",{settings:this.bannerData}).then(e=>{this.$notify.success(e.message),this.$emit("saved"),this.Storage.remove("fcom_welcome_banner_closed_auth"),this.Storage.remove("fcom_welcome_banner_closed_guest")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},mounted(){this.getSettings()}},ek={class:"fcom_customizer_container"},tk={class:"fcom_wc_banner_header"},sk={class:"fcom_wc_banner_options"},ok={class:"fcom_filter_menu"},ik={class:"fcom_filter_menu_ul"},nk={key:0,class:"fcom_wc_banner_content"},lk={class:"fcom_wc_banner_content_header"},ak={class:"fcom_wc_banner_media_type"},rk={key:0,class:"fcom_banner_image_holder"},ck={key:1,class:"fcom_banner_image_preview"},dk={key:0,class:"fcom_wc_banner_cta_buttons"},uk={class:"fcom_wc_help_text"},_k={class:"fcom_wc_banner_content_footer"};function mk(e,t,s,u,o,i){const m=zs,f=Re,h=ve,g=p("BgImageUpload"),w=Fe,b=p("CloseBold"),S=j,k=H,$=p("media-embeder"),v=se,C=ue,L=p("crepe-editor"),M=ne,E=le,T=p("Delete"),P=ti,U=he,D=_e,A=Z;return n(),c("div",ek,[l("div",tk,[l("h4",null,d(e.$t("Welcome Banner")),1)]),l("div",sk,[l("div",ok,[l("ul",ik,[l("li",null,[l("a",{onClick:t[0]||(t[0]=z(q=>i.switchOption("login"),["prevent"])),class:R({"router-link-exact-active":o.currentTab=="login"}),href:"#"},d(e.$t("Logged in")),3)]),l("li",null,[l("a",{onClick:t[1]||(t[1]=z(q=>i.switchOption("logout"),["prevent"])),class:R({"router-link-exact-active":o.currentTab=="logout"}),href:"#"},d(e.$t("Logged out")),3)])])])]),o.loading?(n(),y(A,{key:1,rows:5})):(n(),c("div",nk,[l("div",lk,[l("h4",null,d(o.currentTab==="login"?e.$t("Enable for logged in members"):e.$t("Enable for logged out members")),1),a(m,{modelValue:o.bannerData[o.currentTab].enabled,"onUpdate:modelValue":t[2]||(t[2]=q=>o.bannerData[o.currentTab].enabled=q),"active-value":"yes","inactive-value":"no",class:"fcom_switch"},null,8,["modelValue"])]),l("div",{class:R(["fcom_wc_banner_content_body",{fcom_wc_disabled:!i.isEnabled}])},[l("div",ak,[l("p",null,d(e.$t("Media type")),1),a(h,{modelValue:o.bannerData[o.currentTab].mediaType,"onUpdate:modelValue":t[3]||(t[3]=q=>o.bannerData[o.currentTab].mediaType=q),class:"fcom_radio_group"},{default:r(()=>[a(f,{label:e.$t("Image"),value:"image"},null,8,["label"]),a(f,{label:e.$t("Video"),value:"video"},null,8,["label"])]),_:1},8,["modelValue"])]),o.bannerData[o.currentTab].mediaType==="image"?(n(),c(F,{key:0},[o.bannerData[o.currentTab].bannerImage?(n(),c("div",ck,[a(w,{alt:e.$t("Image Preview"),src:o.bannerData[o.currentTab].bannerImage},null,8,["alt","src"]),a(k,{class:"fcom_secondary_button",text:"",onClick:t[5]||(t[5]=q=>o.bannerData[o.currentTab].bannerImage="")},{default:r(()=>[a(S,null,{default:r(()=>[a(b)]),_:1})]),_:1})])):(n(),c("div",rk,[l("h4",null,d(e.$t("Featured Image")),1),l("p",null,d(e.$t("Set a featured image at the top of the welcome banner. Recommended image dimension: 1680x600")),1),a(g,{modelValue:o.bannerData[o.currentTab].bannerImage,"onUpdate:modelValue":t[4]||(t[4]=q=>o.bannerData[o.currentTab].bannerImage=q)},null,8,["modelValue"])]))],64)):_("",!0),o.bannerData[o.currentTab].mediaType==="video"?(n(),y($,{key:1,media:o.bannerData[o.currentTab].bannerVideo},null,8,["media"])):_("",!0),a(D,{onSubmit:t[9]||(t[9]=z(q=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a(C,{label:e.$t("Title")},{default:r(()=>[a(v,{modelValue:o.bannerData[o.currentTab].title,"onUpdate:modelValue":t[6]||(t[6]=q=>o.bannerData[o.currentTab].title=q)},null,8,["modelValue"])]),_:1},8,["label"]),a(C,{label:e.$t("Description")},{default:r(()=>[o.appReady?(n(),y(L,{key:0,modelValue:o.bannerData[o.currentTab].description,"onUpdate:modelValue":t[7]||(t[7]=q=>o.bannerData[o.currentTab].description=q)},null,8,["modelValue"])):_("",!0)]),_:1},8,["label"]),a(C,{label:e.$t("Call to Action")},{default:r(()=>{var q;return[((q=o.bannerData[o.currentTab].ctaButtons)==null?void 0:q.length)>0?(n(),c("div",dk,[(n(!0),c(F,null,x(o.bannerData[o.currentTab].ctaButtons,(O,N)=>(n(),c("div",{key:N,class:"fcom_wc_banner_cta_button"},[a(C,{label:N&&!e.isMobile?"":e.$t("Button Label")},{default:r(()=>[a(v,{modelValue:O.label,"onUpdate:modelValue":G=>O.label=G},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),a(C,{label:N&&!e.isMobile?"":e.$t("Button Link")},{default:r(()=>[a(v,{modelValue:O.link,"onUpdate:modelValue":G=>O.link=G},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),a(C,{label:N&&!e.isMobile?"":e.$t("Button Type"),class:"fcom_wc_banner_select"},{default:r(()=>[a(E,{modelValue:O.type,"onUpdate:modelValue":G=>O.type=G,class:"fcom_select",placeholder:e.$t("Select type")},{default:r(()=>[a(M,{label:e.$t("Primary"),value:"primary"},null,8,["label"]),a(M,{label:e.$t("Secondary"),value:"secondary"},null,8,["label"]),a(M,{label:e.$t("Text"),value:"text"},null,8,["label"]),a(M,{label:e.$t("Link"),value:"link"},null,8,["label"])]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1032,["label"]),a(C,{label:N&&!e.isMobile?"":e.$t("Open in new tab"),class:"fcom_wc_banner_select"},{default:r(()=>[a(E,{modelValue:O.newTab,"onUpdate:modelValue":G=>O.newTab=G,class:"fcom_select"},{default:r(()=>[a(M,{label:e.$t("Yes"),value:"yes"},null,8,["label"]),a(M,{label:e.$t("No"),value:"no"},null,8,["label"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),a(k,{text:"",class:"wc_button_remove","aria-label":e.$t("Remove button"),onClick:G=>i.removeButton(N)},{default:r(()=>[a(S,null,{default:r(()=>[a(T)]),_:1})]),_:2},1032,["aria-label","onClick"])]))),128)),a(P,{underline:!1,onClick:i.addButton},{default:r(()=>[V(d("+ "+e.$t("Add button")),1)]),_:1},8,["onClick"])])):(n(),y(P,{key:1,underline:!1,onClick:i.addButton},{default:r(()=>[V(d("+ "+e.$t("Add button")),1)]),_:1},8,["onClick"]))]}),_:1},8,["label"]),o.currentTab=="login"?(n(),y(C,{key:0},{default:r(()=>[a(U,{modelValue:o.bannerData[o.currentTab].allowClose,"onUpdate:modelValue":t[8]||(t[8]=q=>o.bannerData[o.currentTab].allowClose=q),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Allow members to close the welcome banner")),1)]),_:1},8,["modelValue"]),l("span",uk,d(e.$t("If allowed, members will be able to hide the banner")),1)]),_:1})):_("",!0)]),_:1})],2),l("div",_k,[a(k,{class:"fcom_primary_button",disabled:o.saving,loading:o.saving,onClick:i.saveSettings},{default:r(()=>[V(d(e.$t("Update Info")),1)]),_:1},8,["disabled","loading","onClick"])])]))])}const hk=I(X0,[["render",mk]]);const fk={name:"FluentDnD",props:{items:{type:Array,required:!0},itemClass:{type:String},itemStyle:{type:String},rowKey:{type:String,default:"id"},group:{type:String,default:""},gap:{type:String,default:""},draggable:{type:Boolean,default:!0},keyboard:{type:Boolean,default:!0},itemLabel:{type:Function,default:null}},emits:["drop","crossDrop","drag-start"],data(){return{draggingIndex:null,startIndex:null,snapshotBeforeDrag:null}},computed:{keyboardEnabled(){return this.keyboard&&this.draggable}},methods:{itemAriaLabel(e,t){return this.itemLabel?this.itemLabel(e,t):this.$t("Sortable item %1$s of %2$s. Use the up and down arrow keys to reorder.",t+1,this.items.length)},onItemKeydown(e,t){if(!this.keyboardEnabled||e.target!==e.currentTarget)return;let s=0;if(e.key==="ArrowUp")s=-1;else if(e.key==="ArrowDown")s=1;else return;const u=t+s;u<0||u>=this.items.length||(e.preventDefault(),this.reorderItems(t,u),this.$emit("drop",{index:u,newItems:this.items}),this.$nextTick(()=>{var i;(i=this.$el.querySelectorAll(":scope > .drag-group > .drag-item")[u])==null||i.focus()}))},dragStart(e,t){e._fluentDndHandled||(e._fluentDndHandled=!0,this.draggingIndex=t,this.startIndex=t,this.snapshotBeforeDrag=[...this.items],this.$emit("drag-start",{index:t,items:this.items}),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",this.items[t][this.rowKey]),this.group&&e.dataTransfer.setData("source-group",this.group))},dragEnd(){this.snapshotBeforeDrag&&(this.items.splice(0,this.items.length,...this.snapshotBeforeDrag),this.snapshotBeforeDrag=null),this.draggingIndex=null},dragOver(e,t){if(e.preventDefault(),!this.group&&e.dataTransfer.types.includes("source-group")||this.draggingIndex===null)return;const s=this.items[this.draggingIndex],u=this.items[t];if(s===u)return;const o=e.currentTarget.getBoundingClientRect(),i=o.top+o.height/2,m=e.clientY;(this.draggingIndex<t&&m>i||this.draggingIndex>t&&m<i)&&(this.reorderItems(this.draggingIndex,t),this.draggingIndex=t)},dropEnd(e,t){const s=e.dataTransfer.getData("source-group");if(!(!this.group&&s)){if(this.group&&s&&s!==this.group){e.stopPropagation();const u=e.dataTransfer.getData("text/plain");this.$emit("crossDrop",{itemKey:u,sourceGroup:s,targetGroup:this.group,targetIndex:t});return}this.startIndex===null||this.startIndex===t||(e.stopPropagation(),this.snapshotBeforeDrag=null,this.draggingIndex=null,this.startIndex=null,this.$emit("drop",{index:t,newItems:this.items}))}},onContainerDragOver(e){e.preventDefault()},onContainerDrop(e){if(!this.group)return;const t=e.dataTransfer.getData("source-group");if(!t||t===this.group)return;const s=e.dataTransfer.getData("text/plain");this.$emit("crossDrop",{itemKey:s,sourceGroup:t,targetGroup:this.group,targetIndex:this.items.length})},reorderItems(e,t){const s=this.items.splice(e,1)[0];this.items.splice(t,0,s)}}},pk=["onDragstart","onDragover","onDrop","onKeydown","draggable","tabindex","aria-label"];function gk(e,t,s,u,o,i){return n(),c("div",{class:"drag-container",onDragover:t[1]||(t[1]=z((...m)=>i.onContainerDragOver&&i.onContainerDragOver(...m),["prevent"])),onDrop:t[2]||(t[2]=z((...m)=>i.onContainerDrop&&i.onContainerDrop(...m),["prevent"]))},[a(Go,{name:"flip-list",tag:"div",class:"drag-group",style:re(s.gap?{display:"flex",flexDirection:"column",gap:s.gap}:{})},{default:r(()=>[(n(!0),c(F,null,x(s.items,(m,f)=>(n(),c("div",{key:m[s.rowKey],onDragstart:h=>i.dragStart(h,f),onDragend:t[0]||(t[0]=(...h)=>i.dragEnd&&i.dragEnd(...h)),onDragover:z(h=>i.dragOver(h,f),["prevent"]),onDrop:z(h=>i.dropEnd(h,f),["prevent"]),onKeydown:h=>i.onItemKeydown(h,f),draggable:s.draggable,tabindex:i.keyboardEnabled?0:null,"aria-label":i.keyboardEnabled?i.itemAriaLabel(m,f):null,class:R(["drag-item",s.itemClass,{dragging:o.draggingIndex===f}]),style:re(s.itemStyle)},[Y(e.$slots,"item",{data:m,index:f},void 0,!0)],46,pk))),128))]),_:3},8,["style"])],32)}const yk=I(fk,[["render",gk],["__scopeId","data-v-e2a330da"]]),vk={name:"MenuGroupSettings",components:{SpaceCourseSelector:Nt,FluentDnD:yk,LogoEmojiSelector:xt,Drawer:ps,ActionPopover:Ke},data(){return{editingItem:null,originalItem:null,openEditLinkDrawer:!1,isDragging:!1,isSpaceDragging:!1,draggingIndex:null,draggedSpaceIndex:null,mode:null,urlErrors:[],validationAttempt:0}},computed:{isDirty(){return!this.editingItem||!this.originalItem?!1:JSON.stringify(this.editingItem)!==JSON.stringify(this.originalItem)}},emits:["save"],props:{menuItems:{type:Array,required:!0},saving:{type:Boolean,default:!1},title:{type:String,required:!0},has_svg:{type:Boolean,default:!0},use_icon_selector:{type:Boolean,default:!1},has_enable_disable:{type:Boolean,default:!0},custom_svg:{type:Boolean,default:!1}},methods:{linkRowActions(e,t){const s=[{label:this.$t("Edit"),action:()=>this.initEditLink(e,"edit")}];return e.is_system!="yes"&&s.push({label:this.$t("Delete"),type:"danger",action:()=>this.removeLink(t)}),s},validateLinkForm(){return this.urlErrors=[],this.validationAttempt++,(!this.editingItem.title||!this.editingItem.title.trim())&&this.urlErrors.push(this.$t("Link title cannot be empty.")),this.editingItem.is_system!=="yes"&&(!this.editingItem.permalink||!this.editingItem.permalink.trim())&&this.urlErrors.push(this.$t("URL or path cannot be empty.")),this.urlErrors.length===0},initEditLink(e,t="create"){e.privacy||(e.privacy="public",e.membership_ids=e.membership_ids||[]),this.mode=t,this.urlErrors=[],this.originalItem=e,this.editingItem=JSON.parse(JSON.stringify(e||{})),this.$nextTick(()=>{this.openEditLinkDrawer=!0})},removeLink(e){this.$confirm(this.$t("Are you sure you want to remove this link?"),this.$t("Warning"),{confirmButtonText:this.$t("Yes"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.menuItems.splice(e,1),this.saveMenuItems({customSuccessMessage:this.$t("Link deleted successfully.")})})},createOrUpdateLink(){if(!this.saving&&this.validateLinkForm()){if(!this.editingItem.slug)this.editingItem.slug="fcom_custom_"+this.editingItem.title.toLowerCase().replace(/[^a-z0-9]/g,"_"),this.menuItems.push(this.editingItem);else{const e=this.menuItems.findIndex(t=>t.slug===this.editingItem.slug);e!==-1?Object.assign(this.menuItems[e],this.editingItem):this.menuItems.push(this.editingItem)}this.openEditLinkDrawer=!1,this.editingItem=null,this.saveMenuItems()}},saveMenuItems({customSuccessMessage:e=null}={}){this.$emit("save",{customSuccessMessage:e})},drop({index:e}){this.draggingIndex=null,this.saveMenuItems()},beforeCloseDrawer(e){if(this.saving){this.$notify.info(this.$t("Please wait to complete."));return}this.editingItem=null,this.originalItem=null,this.mode=null,e()}}},bk={key:0,class:"fcom_section_primary fcom_menu_group_settings"},kk={class:"fcom_section_primary_item"},wk={class:"fcom_section_primary_item_title"},Ck={class:"fcom_heading_item"},$k={class:"fcom_section_item_actions"},Sk={class:"fcom_section_items menu-items-container"},Vk={key:0,style:{padding:"1rem"}},Mk={class:"fcom_section_item_title"},Lk={class:"fcom_heading_item"},Tk=l("div",{class:"fcom_drag_handle"}," ⋮⋮ ",-1),Fk={key:0,class:"community_avatar"},Pk=["src"],Ik={key:1,class:"fcom_emoji"},Ek={key:2,class:"fcom_shape"},Uk=["innerHTML"],Ak={class:"fcom_section_item_actions"},Bk={key:0},Dk={key:1},Rk={key:0},xk={class:"fcom_help_text"},Hk={class:"fcom_help_text"};function Ok(e,t,s,u,o,i){const m=H,f=j,h=Ee,g=p("action-popover"),w=p("FluentDnD"),b=p("logo-emoji-selector"),S=se,k=ue,$=he,v=Re,C=ve,L=p("SpaceCourseSelector"),M=ts,E=_e,T=p("drawer");return n(),c(F,null,[s.menuItems?(n(),c("div",bk,[l("div",kk,[l("div",wk,[l("div",Ck,[Y(e.$slots,"title",{},()=>[l("h4",null,d(s.title),1)])])]),l("div",$k,[a(m,{class:"fcom_primary_button",onClick:t[0]||(t[0]=P=>i.initEditLink({enabled:"yes",privacy:"public",membership_ids:[],new_tab:"yes"}))},{default:r(()=>[V(d(e.$t("Add New Link")),1)]),_:1})])]),l("div",Sk,[s.menuItems.length?_("",!0):(n(),c("div",Vk,[l("p",null,d(e.$t("No link has been added for this section")),1)])),a(w,{items:s.menuItems,"row-key":"slug",onDrop:i.drop,"item-class":"fcom_section_item"+(s.saving?"":" fcom_cursor_move"),"item-style":e.isMobile?"padding: 12px":"padding: 15px 15px 15px 35px"},{item:r(({data:P,index:U})=>[l("div",Mk,[l("p",Lk,[s.use_icon_selector?(n(),c(F,{key:0},[Tk,P.icon_image?(n(),c("div",Fk,[a(f,null,{default:r(()=>[l("img",{alt:"",style:{"max-width":"16px","max-height":"16px"},src:P.icon_image},null,8,Pk)]),_:2},1024)])):P.emoji?(n(),c("span",Ik,d(P.emoji),1)):P.shape_svg?(n(),c("span",Ek,[a(f,{innerHTML:P.shape_svg},null,8,["innerHTML"])])):_("",!0)],64)):P.icon_svg?(n(),y(f,{key:1},{default:r(()=>[l("span",{innerHTML:P.icon_svg},null,8,Uk)]),_:2},1024)):_("",!0),l("span",null,d(P.title),1),P.is_unavailable=="yes"?(n(),y(h,{key:2,type:"danger"},{default:r(()=>[V(d(e.$t("unavailable")),1)]),_:1})):P.enabled=="yes"?(n(),y(h,{key:3,type:"success"},{default:r(()=>[V(d(e.$t("enabled")),1)]),_:1})):(n(),y(h,{key:4,type:"info"},{default:r(()=>[V(d(e.$t("disabled")),1)]),_:1}))])]),l("div",Ak,[a(g,{items:i.linkRowActions(P,U),placement:"bottom-end"},null,8,["items"])])]),_:1},8,["items","onDrop","item-class","item-style"])])])):_("",!0),a(T,{modelValue:o.openEditLinkDrawer,"onUpdate:modelValue":t[11]||(t[11]=P=>o.openEditLinkDrawer=P),size:e.drawerWidth,"before-close":i.beforeCloseDrawer,id:"fluent_comminity_body","close-on-click-modal":!0,"has-close-confirmation":i.isDirty&&!s.saving,"close-confirmation-message":e.$t("Closing will discard your changes. Are you sure?")},{header:r(()=>[o.mode==="edit"?(n(),c("h4",Bk,d(e.$t("Edit Link")),1)):(n(),c("h4",Dk,d(e.$t("Add Custom Link")),1))]),default:r(()=>[o.editingItem?(n(),c("div",Rk,[a(E,{onSubmit:t[10]||(t[10]=z(P=>e.doNothing(),["prevent"])),"label-position":"top",disabled:s.saving},{default:r(()=>[a(k,{label:e.$t("Name of the Link")},{default:r(()=>[a(S,{disabled:s.saving,placeholder:e.$t("Public Name of the item"),modelValue:o.editingItem.title,"onUpdate:modelValue":t[2]||(t[2]=P=>o.editingItem.title=P)},ge({_:2},[s.use_icon_selector?{name:"prepend",fn:r(()=>[a(b,{custom_svg:s.custom_svg,fallback_mark:"<span style='font-size: 20px;'>☺</span>",onUpdate:t[1]||(t[1]=P=>{s.saving||(o.editingItem.emoji=P.emoji,o.editingItem.icon_image=P.logo,o.editingItem.shape_svg=P.shape_svg)}),config:{logo:o.editingItem.icon_image,emoji:o.editingItem.emoji||"",shape_svg:o.editingItem.shape_svg||""}},null,8,["custom_svg","config"])]),key:"0"}:void 0]),1032,["disabled","placeholder","modelValue"])]),_:1},8,["label"]),a(k,{label:e.$t("URL")},{default:r(()=>[a(S,{disabled:s.saving||o.editingItem.is_system=="yes",type:"text",placeholder:e.$t("URL or path (e.g. https://example.com or /members)"),modelValue:o.editingItem.permalink,"onUpdate:modelValue":t[3]||(t[3]=P=>o.editingItem.permalink=P)},null,8,["disabled","placeholder","modelValue"]),l("div",xk,[l("p",null,d(e.$t("For internal links, start with / (e.g. /members).")),1)])]),_:1},8,["label"]),s.has_svg?(n(),y(k,{key:0,label:e.$t("SVG Code for Icon (Simplified SVG Code) / Emoji")},{default:r(()=>[a(S,{disabled:s.saving,placeholder:e.$t("SVG Code. No url please / You can use emoji"),type:"textarea",rows:3,modelValue:o.editingItem.icon_svg,"onUpdate:modelValue":t[4]||(t[4]=P=>o.editingItem.icon_svg=P)},null,8,["disabled","placeholder","modelValue"])]),_:1},8,["label"])):_("",!0),s.has_enable_disable?(n(),y(k,{key:1,style:{"margin-bottom":"5px"}},{default:r(()=>[a($,{disabled:s.saving,"true-value":"yes","false-value":"no",modelValue:o.editingItem.enabled,"onUpdate:modelValue":t[5]||(t[5]=P=>o.editingItem.enabled=P),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Enable this link")),1)]),_:1},8,["disabled","modelValue"])]),_:1})):_("",!0),o.editingItem.is_system!="yes"?(n(),y(k,{key:2},{default:r(()=>[a($,{disabled:s.saving,"true-value":"yes","false-value":"no",modelValue:o.editingItem.new_tab,"onUpdate:modelValue":t[6]||(t[6]=P=>o.editingItem.new_tab=P),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Open this link in a new tab.")),1)]),_:1},8,["disabled","modelValue"])]),_:1})):_("",!0),a(k,{label:e.$t("Visibility")},{default:r(()=>[a(C,{disabled:s.saving,modelValue:o.editingItem.privacy,"onUpdate:modelValue":t[7]||(t[7]=P=>o.editingItem.privacy=P)},{default:r(()=>[a(v,{label:e.$t("Everyone"),value:"public"},null,8,["label"]),a(v,{label:e.$t("Logged-in only"),value:"logged_in"},null,8,["label"]),a(v,{label:e.$t("Public only"),value:"logged_out_only"},null,8,["label"]),a(v,{label:e.$t("By Space/Course Memberships"),value:"members_only"},null,8,["label"])]),_:1},8,["disabled","modelValue"]),l("div",Hk,d(e.$t("Select who can see this link.")),1)]),_:1},8,["label"]),o.editingItem.privacy=="members_only"?(n(),y(k,{key:3,label:e.$t("Select Space/Course Memberships")},{default:r(()=>[a(L,{disabled:s.saving,modelValue:o.editingItem.membership_ids,"onUpdate:modelValue":t[8]||(t[8]=P=>o.editingItem.membership_ids=P),placeholder_text:e.$t("Select Memberships"),is_multiple:!0},null,8,["disabled","modelValue","placeholder_text"])]),_:1},8,["label"])):_("",!0),o.urlErrors.length?(n(),y(M,{key:o.validationAttempt,type:"warning",closable:!0,"show-icon":"",style:{margin:"8px 0"}},{title:r(()=>[l("div",null,[l("ul",null,[(n(!0),c(F,null,x(o.urlErrors,(P,U)=>(n(),c("li",{style:{"margin-bottom":"0"},key:U},d(P),1))),128))])])]),_:1})):_("",!0),a(k,null,{default:r(()=>[a(m,{disabled:s.saving,class:"fcom_primary_button",onClick:t[9]||(t[9]=P=>i.createOrUpdateLink())},{default:r(()=>[V(d(s.saving?e.$t("Saving..."):e.$t("Save")),1)]),_:1},8,["disabled"])]),_:1})]),_:1},8,["disabled"])])):_("",!0)]),_:1},8,["modelValue","size","before-close","has-close-confirmation","close-confirmation-message"])],64)}const Mo=I(vk,[["render",Ok]]),jk={name:"ManageFeedLinks",components:{MenuGroupSettings:Mo},props:["savingCount"],emits:["saved"],data(){return{loading:!1,menuItems:[]}},watch:{savingCount(){this.saveMenuItems()}},methods:{getMenuItems(){this.loading=!0,this.$get("feeds/links").then(e=>{this.menuItems=e.links}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},saveMenuItems(){let e="feeds/links";this.$post(e,{links:this.menuItems}).then(t=>{this.$notify.success(t.message),this.menuItems=t.links,this.$emit("saved")}).catch(t=>{this.$handleError(t)})}},mounted(){this.getMenuItems()}},Nk={class:"fcom_customizer_container"},zk={key:0,class:"fcom_card_sections"};function qk(e,t,s,u,o,i){const m=p("menu-group-settings"),f=Z;return n(),c("div",Nk,[o.loading?_("",!0):(n(),c("div",zk,[a(m,{custom_svg:!0,use_icon_selector:!0,has_svg:!1,title:e.$t("Manage Links"),menuItems:o.menuItems,onSave:t[0]||(t[0]=h=>i.saveMenuItems())},null,8,["title","menuItems"])])),o.loading?(n(),y(f,{key:1,rows:5,animated:""})):_("",!0)])}const Gk=I(jk,[["render",qk]]),Yk={name:"FeedCustomizer",props:["customize_tab"],components:{WelcomeBannerConfig:hk,ManageFeedLinks:Gk},data(){return{saving:!1,savingCount:0,changesExist:!1,currentTab:this.customize_tab}},methods:{savedData(){this.saving=!1,this.changesExist=!0},saveChanges(){this.changesExist=!0,this.savingCount=this.savingCount+1},handleBack(){this.$emit("updated",this.changesExist)}}},Wk={class:"fcom_full_editor"},Kk={class:"fcom_full_editor_header"},Zk=["aria-label"],Jk={class:"fcom_editor_menu object_menu"},Qk={class:"fcom_space_menu_ul"},Xk={class:"full_editor_actions"};function ew(e,t,s,u,o,i){const m=p("ArrowLeft"),f=j,h=H,g=qs,w=p("welcome-banner-config"),b=ke,S=Le,k=p("manage-feed-links"),$=Ye;return n(),c("div",Wk,[a($,null,{default:r(()=>[a(g,{class:"fcom_full_editor_header_wrap"},{default:r(()=>[l("div",Kk,[l("button",{type:"button",onClick:t[0]||(t[0]=(...v)=>i.handleBack&&i.handleBack(...v)),class:"fcom_back_header","aria-label":e.$t("Back to %s",e.$t("Feed"))},[a(f,null,{default:r(()=>[a(m)]),_:1}),V(" "+d(e.$t("Feed")),1)],8,Zk),l("div",Jk,[l("ul",Qk,[e.has_pro?(n(),c("li",{key:0,onClick:t[1]||(t[1]=v=>o.currentTab="welcome")},[l("a",{class:R({"router-link-exact-active":o.currentTab==="welcome"}),href:"#"},d(e.$t("Welcome Banner")),3)])):_("",!0),l("li",{onClick:t[2]||(t[2]=v=>o.currentTab="manage_links")},[l("a",{class:R({"router-link-exact-active":o.currentTab==="manage_links"}),href:"#"},d(e.$t("Feed Links")),3)])])]),l("div",Xk,[a(h,{class:"fcom_primary_button",size:e.isMobile?"small":"default",disabled:o.saving,loading:o.saving,onClick:i.saveChanges},{default:r(()=>[V(d(e.$t("Save Changes")),1)]),_:1},8,["size","disabled","loading","onClick"])])])]),_:1}),a($,{class:"fcom_full_editor_container"},{default:r(()=>[o.currentTab=="welcome"?(n(),y(S,{key:0,class:"fcom_full_editor_main"},{default:r(()=>[a(b,null,{default:r(()=>[a(w,{savingCount:o.savingCount,onSaved:i.savedData},null,8,["savingCount","onSaved"])]),_:1})]),_:1})):o.currentTab=="manage_links"?(n(),y(S,{key:1,class:"fcom_full_editor_main"},{default:r(()=>[a(b,null,{default:r(()=>[a(k,{savingCount:o.savingCount,onSaved:i.savedData},null,8,["savingCount","onSaved"])]),_:1})]),_:1})):_("",!0)]),_:1})]),_:1})])}const tw=I(Yk,[["render",ew]]),sw={name:"FeedMenu",components:{FeedCustomizer:tw},data(){return{customizeTab:"welcome",customizeSpace:!1}},methods:{openCustomizer(e){var t;(t=this.$refs.feed_actions)==null||t.hide(),this.customizeTab=e,this.customizeSpace=!0},updatedFeedSettings(e){this.customizeSpace=!1,e&&location.reload()}}},ow={class:"actions_items"},iw={key:0};function nw(e,t,s,u,o,i){const m=p("MoreFilled"),f=j,h=H,g=ye,w=p("feed-customizer");return n(),c(F,null,[l("div",null,[a(g,{placement:"bottom",ref:"feed_actions",trigger:"click",persistent:!1,"popper-options":{strategy:"fixed"}},{reference:r(()=>[a(h,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[l("ul",ow,[e.has_pro?(n(),c("li",{key:0,onClick:t[0]||(t[0]=b=>i.openCustomizer("welcome"))},d(e.$t("Welcome Banner")),1)):_("",!0),l("li",{onClick:t[1]||(t[1]=b=>i.openCustomizer("manage_links"))},d(e.$t("Manage Links")),1)])]),_:1},512)]),o.customizeSpace?(n(),c("div",iw,[(n(),y(dt,{to:"body"},[a(w,{customize_tab:o.customizeTab,onClose:t[2]||(t[2]=b=>o.customizeSpace=!1),onUpdated:i.updatedFeedSettings},null,8,["customize_tab","onUpdated"])]))])):_("",!0)],64)}const lw=I(sw,[["render",nw]]),aw={name:"RenderSpaceLinks",props:{links:{type:Array,required:!0}},computed:{enabledLinks(){return this.links.filter(e=>e.enabled!=="no")}}},rw={class:"object_menu"},cw={class:"fcom_space_menu_ul"},dw=["target","href"],uw=["src"],_w={key:1,class:"fcom_emoji"},mw={key:2,style:{"font-size":"120%"},class:"fcom_shape"};function hw(e,t,s,u,o,i){const m=j;return n(),c("div",rw,[l("ul",cw,[(n(!0),c(F,null,x(i.enabledLinks,f=>(n(),c("li",{key:f.slug},[l("a",{target:f.new_tab=="yes"?"_blank":"",rel:"noopener nofollow",href:f.permalink},[f.icon_image?(n(),c("img",{key:0,alt:"",src:f.icon_image},null,8,uw)):f.emoji?(n(),c("span",_w,d(f.emoji),1)):f.shape_svg?(n(),c("span",mw,[a(m,{innerHTML:f.shape_svg},null,8,["innerHTML"])])):_("",!0),l("span",null,d(f.title),1)],8,dw)]))),128))])])}const vs=I(aw,[["render",hw]]),fw={name:"FeedsRoute",components:{SpaceIcon:Ze,Layout:we,AppLayout:Se,RecentActivities:zt,FeedMenu:lw,RenderSpaceLinks:vs},data(){return{transiting:!1}},methods:{goToProfile(){this.$router.push({name:"update_profile",params:{username:this.auth.username}})},resetRoute(){this.transiting=!0,this.$nextTick(()=>{this.transiting=!1})}},mounted(){window.scrollTo(0,0)}},pw={key:0,"aria-label":"Feed Links",class:"fcom_sub_header"},gw={key:0,class:"fcom_profile_complete_btn_wrap"},yw={key:1},vw={key:0,class:"fcom_feed_box"},bw={key:0,class:"fcom_main_side_wrap"},kw={class:"fcom_side_box"};function ww(e,t,s,u,o,i){const m=p("render-space-links"),f=H,h=p("feed-menu"),g=p("router-view"),w=Le,b=p("recent-activities"),S=et,k=Ye,$=p("layout"),v=p("app-layout");return n(),y(v,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a($,{wrapper_class:"no_bg_layout",title:e.$t("Feed")},{title:r(()=>[l("h1",{onClick:t[0]||(t[0]=C=>{e.$eventBus.emit("toTop"),i.resetRoute()}),class:"fcom_page_title clickable"},d(e.$t("Feed")),1)]),sub_header:r(()=>{var C;return[((C=e.appVars.feed_links)==null?void 0:C.length)>0?(n(),c("nav",pw,[a(m,{links:e.appVars.feed_links},null,8,["links"])])):_("",!0)]}),actions:r(()=>[e.auth.compilation_score<100?(n(),c("div",gw,[a(f,{onClick:i.goToProfile,type:"danger"},{default:r(()=>[V(d(e.$t("Complete your profile"))+" ("+d(e.auth.compilation_score)+"%)",1)]),_:1},8,["onClick"])])):_("",!0),e.isAdmin()?(n(),c("div",yw,[a(h)])):_("",!0)]),default:r(()=>[a(k,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(w,{class:"fcom_main"},{default:r(()=>[o.transiting?_("",!0):(n(),c("div",vw,[a(g)]))]),_:1}),a(S,{class:"fcom_resp_side",width:"306px"},{default:r(()=>[e.isMobile?_("",!0):(n(),c("div",bw,[l("div",kw,[a(b,{is_trending:!0,pinned_widget_title:e.$t("Trending Posts"),with_pins:!0},null,8,["pinned_widget_title"])])]))]),_:1})]),_:1})]),_:1},8,["title"])]),_:1})}const Cw=I(fw,[["render",ww]]);const $w={name:"NewPostsBanner",components:{ArrowUp:Js},props:{context:{type:String,default:"global"},minScrollToShow:{type:Number,default:500}},setup(){return{feedStore:Me()}},data(){return{show:!1,count:0,scrollPosition:0}},mounted(){this.$eventBus.on("feeds_updated",this.handleFeedUpdates),document.addEventListener("fcom_layout_scroll",this.handleScroll),this.checkNewPosts()},beforeUnmount(){this.$eventBus.off("feeds_updated",this.handleFeedUpdates),document.removeEventListener("fcom_layout_scroll",this.handleScroll)},methods:{handleFeedUpdates({context:e,added:t}){e===this.context&&t>0&&this.scrollPosition>this.minScrollToShow&&(this.count=this.feedStore.getNewPostsCount(this.context),this.show=!0)},handleScroll(e){this.scrollPosition=e.detail.scrollTop,this.scrollPosition<100&&this.show&&this.dismissBanner()},checkNewPosts(){const e=this.feedStore.getNewPostsCount(this.context);e>0&&this.scrollPosition>this.minScrollToShow&&(this.count=e,this.show=!0)},scrollToTop(){window.fcomLayoutRef&&window.fcomLayoutRef.setScrollTop(0),this.dismissBanner()},dismissBanner(){this.show=!1,this.feedStore.clearNewPostsCount(this.context),this.count=0}}},Sw={class:"fcom_new_posts_text"};function Vw(e,t,s,u,o,i){const m=p("ArrowUp"),f=j;return n(),y(Rs,{name:"slide-down"},{default:r(()=>[o.show?(n(),c("div",{key:0,class:"fcom_new_posts_banner",onClick:t[0]||(t[0]=(...h)=>i.scrollToTop&&i.scrollToTop(...h))},[a(f,{class:"fcom_new_posts_icon"},{default:r(()=>[a(m)]),_:1}),l("span",Sw,d(o.count===1?e.$t("1 new post available"):e.$t("{count} new posts available",{count:o.count})),1)])):_("",!0)]),_:1})}const Mw=I($w,[["render",Vw],["__scopeId","data-v-e4ec71f4"]]),Lw={name:"AllFeeds",components:{Feeds:gt,NewPostsBanner:Mw},setup(){return{tickerStore:oo()}},mounted(){var e,t;if(this.changeTitle(this.$t("All Feeds")),(e=this.appVars.features)!=null&&e.enable_feed_ticker){const s=((t=this.appVars.features)==null?void 0:t.ticker_interval)||3e4;this.tickerStore.start(s)}},beforeUnmount(){var e;(e=this.appVars.features)!=null&&e.enable_feed_ticker&&this.tickerStore.stop()}},Tw={key:0,class:"notices fcom_notice_wrap"},Fw=["innerHTML"];function Pw(e,t,s,u,o,i){var g;const m=p("WelcomeBanner"),f=p("NewPostsBanner"),h=p("feeds");return n(),c(F,null,[e.appVars.portal_notices&&e.appVars.portal_notices.length?(n(),c("div",Tw,[(n(!0),c(F,null,x(e.appVars.portal_notices,w=>(n(),c("div",{innerHTML:w},null,8,Fw))),256))])):_("",!0),e.appVars.welcome_banner?(n(),y(m,{key:1})):_("",!0),(g=e.appVars.features)!=null&&g.enable_feed_ticker?(n(),y(f,{key:2,context:"global"})):_("",!0),a(h,{space:"",feed_name:"all_feeds",can_change_order:e.appVars.features.disable_feed_sort_by!=="yes",default_order_by:e.appVars.features.default_feed_sort_by||"",layout_style:e.appVars.features.default_feed_layout,can_change_layout:e.appVars.features.can_switch_layout},null,8,["can_change_order","default_order_by","layout_style","can_change_layout"])],64)}const Iw=I(Lw,[["render",Pw]]),Ew={name:"ViewFeed",components:{Feed:nt},props:["feed_slug"],setup(){return{feedStore:Me()}},data(){return{loading:!0,feed:null,notFound:!1}},watch:{feed_slug(){this.feed=null,this.$nextTick(()=>{this.getFeed()})},"$route.query.comment_id"(e){e&&this.highlightComment(e)}},methods:{getFeed(){this.feed=null,this.loading=!0,this.$get("feeds/"+this.feed_slug+"/by-slug").then(e=>{if(this.isWrongSpaceContext(e.feed)){this.notFound=!0;return}this.feed=e.feed,this.appVars.last_feed_id<e.feed.id&&(this.appVars.last_feed_id=e.feed.id),e.current_user_follows&&this.setFollowIds(e.current_user_follows),this.changeFeedTitle(),this.$nextTick(()=>{this.checkCommentScroll()})}).catch(e=>{this.$handleError(e),typeof e=="object"&&e.xhr_status==404&&(this.notFound=!0)}).finally(()=>{this.loading=!1})},isWrongSpaceContext(e){var s;const t=this.$route.params.space;return t&&((s=e==null?void 0:e.space)==null?void 0:s.slug)!==t},changeFeedTitle(){this.changeTitle(this.feed.title||"Feed")},async handleDelete(){var e;if(this.feed)try{const t=this.feed.space?`space-${this.feed.space.slug}`:"global";await this.feedStore.deleteFeed(t,this.feed.id),(e=window.history.state)!=null&&e.back?this.$router.back():this.$router.push({name:"all_feeds"})}catch(t){this.$handleError(t)}},checkCommentScroll(){const e=this.$route.query.comment_id;e?this.highlightComment(e):this.$eventBus.emit("toTop",0)},highlightComment(e){e&&(document.querySelectorAll(".fcom_highlight_comment").forEach(t=>{t.classList.remove("fcom_highlight_comment")}),setTimeout(()=>{const t=document.getElementById("comment_"+e);if(!t){this.$eventBus.emit("toTop",0);return}t.classList.add("fcom_highlight_comment");const s=t.getBoundingClientRect(),u=window.innerHeight||document.documentElement.clientHeight;s.top>=0&&s.bottom<=u||(t.style.scrollMarginTop="100px",t.scrollIntoView({behavior:"instant"}))},100))}},mounted(){if(this.$eventBus.on("scroll_to_comment",this.highlightComment),window.__showing_feed&&window.__showing_feed.slug==this.feed_slug){if(this.isWrongSpaceContext(window.__showing_feed)){window.__showing_feed=null,this.notFound=!0,this.loading=!1;return}this.feed=window.__showing_feed,window.__showing_feed=null,this.$nextTick(()=>{this.changeFeedTitle(),this.checkCommentScroll()})}else this.getFeed()},beforeUnmount(){this.$eventBus.off("scroll_to_comment",this.highlightComment)}},Uw={key:0,class:"fcom_feed_report_wrap"},Aw={class:"fcom_feed_report_content"},Bw={key:1,class:"feed_outer"},Dw={key:3,class:"error-container"},Rw={style:{padding:"20px",background:"var(--fcom-primary-bg)","border-radius":"8px"},class:"error-content"},xw={class:"error-title"},Hw={class:"error-message"},Ow={class:"error-explanation"},jw={style:{"list-style":"disc",margin:"20px"},class:"error-reasons"},Nw={class:"error-actions"},zw=["href"];function qw(e,t,s,u,o,i){const m=p("Feed"),f=Z;return n(),c("div",null,[o.feed&&o.feed.status=="unpublished"?(n(),c("div",Uw,[l("div",Aw,[l("span",null,d(e.$t("This content has been unpublished by community moderation. Only the author and moderators can view it.")),1)])])):_("",!0),o.feed?(n(),c("div",Bw,[a(m,{is_single:!0,is_route:!0,show_report:!0,feed:o.feed,onReload:i.getFeed,onRemoved:i.getFeed,onDeleted:i.handleDelete},null,8,["feed","onReload","onRemoved","onDeleted"])])):o.loading?(n(),y(f,{key:2,rows:5,animated:!0,class:"white_loaded"})):o.notFound?(n(),c("div",Dw,[l("div",Rw,[l("h1",xw,d(e.$t("Post Not Found")),1),l("p",Hw,d(e.$t("Sorry, the requested post could not be found.")),1),l("p",Ow,d(e.$t("This may be due to one of the following reasons:")),1),l("ul",jw,[l("li",null,d(e.$t("You do not have permission to view this post")),1),l("li",null,d(e.$t("The post URL may be incorrect")),1),l("li",null,d(e.$t("The post has been deleted")),1)]),l("div",Nw,[l("a",{href:e.$getRouteLink(""),class:"el-button fcom_primary_button"},d(e.$t("Back to home")),9,zw)])])])):_("",!0)])}const Fs=I(Ew,[["render",qw]]),Gw={name:"SpaceHeader",emits:["refetch","doSearch"],components:{ImageUploader:xe},props:{space:{type:String,required:!0},space_profile:{required:!1}},data(){return{updating:!1}},computed:{profile(){return this.space_profile?(this.search="",this.space_profile):{title:".......",slug:"..",cover_photo:this.appVars.assets_url+"images/placeholer.png",permissions:{}}},isMod(){return this.profile.permissions.community_moderator}},methods:{removeCoverPhoto(){this.$confirm(this.$t("Are you sure you want to remove the cover photo?"),this.$t("Remove Space Cover Photo?"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.space_profile.cover_photo="",this.updateSpace({cover_photo:""})})},handleCoverPhotoUpload(e){this.space_profile.cover_photo=e,this.updateSpace({cover_photo:e})},updateSpace(e){this.space_profile.id&&(this.updating=!0,this.$put("spaces/"+this.space+"/by-slug",{data:e}).then(t=>{this.$notify.success(t.message),this.$emit("refetch"),this.$eventBus.emit("reloadMenu")}).catch(t=>{this.$handleError(t)}).finally(()=>{this.updating=!1}))}},mounted(){this.$eventBus.on("doGlobalSearch",e=>{this.search_term=e})}},Yw={key:0,class:"object_header space_header"},Ww={key:0,style:{"text-align":"right"},class:"object_media_uploader"};function Kw(e,t,s,u,o,i){const m=H,f=p("image-uploader"),h=te("loading");return i.profile.cover_photo?W((n(),c("div",Yw,[l("div",{style:re({backgroundImage:"url("+i.profile.cover_photo+")"}),class:"object_cover"},[i.isMod?(n(),c("div",Ww,[a(f,{additionalData:{resize:!0,max_width:1500},onUploaded:i.handleCoverPhotoUpload},{default:r(()=>[a(m,{size:"small",plain:"",type:"primary"},{default:r(()=>[V(d(e.$t("Change Cover")),1)]),_:1})]),_:1},8,["onUploaded"]),a(m,{class:"fcom_mt_10",size:"small",plain:"",type:"danger",onClick:z(i.removeCoverPhoto,["prevent"])},{default:r(()=>[V(d(e.$t("Remove")),1)]),_:1},8,["onClick"])])):_("",!0)],4)])),[[h,o.updating]]):_("",!0)}const Zw=I(Gw,[["render",Kw]]),Jw={name:"SpaceMenuItems",props:["space","profile"]},Qw={"aria-label":"Space menu"},Xw={class:"fcom_space_menu_ul"},e3=["innerHTML"],t3=["href","target","innerHTML"],s3={key:1};function o3(e,t,s,u,o,i){var f,h;const m=p("router-link");return n(),c("nav",Qw,[l("ul",Xw,[(h=(f=s.profile)==null?void 0:f.header_links)!=null&&h.length?(n(!0),c(F,{key:0},x(s.profile.header_links,g=>(n(),c("li",null,[g.route?(n(),y(m,{key:0,to:g.route},{default:r(()=>[l("span",{innerHTML:g.title},null,8,e3)]),_:2},1032,["to"])):(n(),c("a",{key:1,class:R(g.css_class??""),href:g.url,target:g.is_external?"_blank":"_self",innerHTML:g.title},null,10,t3))]))),256)):_("",!0),e.isMobile?(n(),c("li",s3,[a(m,{to:{name:"space_about"}},{default:r(()=>[V(d(e.$t("About")),1)]),_:1})])):_("",!0)])])}const i3=I(Jw,[["render",o3]]),n3={name:"ImagePlaceholder"},l3={width:"240",height:"240",viewBox:"0 0 240 240",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a3=l("rect",{width:"240",height:"240",fill:"#F5F6F7"},null,-1),r3=l("path",{d:"M133.125 121.65L129.33 116.7C129 116.26 128.56 116.04 128.01 116.04C127.46 116.04 127.02 116.26 126.69 116.7L121.163 123.96C120.723 124.51 120.654 125.088 120.956 125.693C121.259 126.298 121.768 126.6 122.483 126.6H148.718C149.433 126.6 149.941 126.298 150.244 125.693C150.546 125.088 150.478 124.51 150.038 123.96L142.035 113.483C141.705 113.043 141.265 112.823 140.715 112.823C140.165 112.823 139.725 113.043 139.395 113.483L133.125 121.65ZM115.8 139.8C113.985 139.8 112.431 139.154 111.139 137.861C109.846 136.569 109.2 135.015 109.2 133.2V93.6C109.2 91.785 109.846 90.2313 111.139 88.9388C112.431 87.6462 113.985 87 115.8 87H155.4C157.215 87 158.769 87.6462 160.061 88.9388C161.354 90.2313 162 91.785 162 93.6V133.2C162 135.015 161.354 136.569 160.061 137.861C158.769 139.154 157.215 139.8 155.4 139.8H115.8ZM115.8 133.2H155.4V93.6H115.8V133.2ZM102.6 153C100.785 153 99.2313 152.354 97.9388 151.061C96.6462 149.769 96 148.215 96 146.4V103.5C96 102.565 96.3163 101.781 96.9488 101.149C97.5813 100.516 98.365 100.2 99.3 100.2C100.235 100.2 101.019 100.516 101.651 101.149C102.284 101.781 102.6 102.565 102.6 103.5V146.4H145.5C146.435 146.4 147.219 146.716 147.851 147.349C148.484 147.981 148.8 148.765 148.8 149.7C148.8 150.635 148.484 151.419 147.851 152.051C147.219 152.684 146.435 153 145.5 153H102.6Z",fill:"#98A2B3"},null,-1),c3=[a3,r3];function d3(e,t,s,u,o,i){return n(),c("svg",l3,c3)}const qt=I(n3,[["render",d3]]),u3={name:"LockscreenPaywallMeta",components:{ImagePlaceholder:qt},props:{field:{type:Object,required:!0},space_id:{type:[String,Number],required:!0}},data(){return{loading:!1,editTab:"paywall",availablePaywalls:[]}},methods:{initAddPaywall(){this.field.paywalls=this.field.paywalls||[],this.field.paywalls.push("")},removePaywall(e){const t=this.field.paywalls||[];t.splice(t.indexOf(e),1),this.field.paywalls=t},isPaywallAdded(e){var t;return(t=this.field.paywalls)==null?void 0:t.includes(e.toString())},getAvailablePaywalls(){this.loading=!0,this.$get("cart/spaces/"+this.space_id+"/paywalls",{space_id:this.space_id}).then(e=>{this.availablePaywalls=e.paywalls}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.getAvailablePaywalls()}},_3={key:0,class:"fcom_paywalls"},m3={class:"fcom_paywall"},h3={class:"fcom_select_photo",style:{float:"left"}},f3=["src"],p3={key:0,class:"fcom_description"},g3={class:"fcom_paywall_actions"},y3={class:"fcom_color_input_wrap"},v3={class:"fcom_color_input_wrap"},b3={class:"fcom_color_input_wrap"},k3={class:"fcom_color_input_wrap"};function w3(e,t,s,u,o,i){const m=p("image-placeholder"),f=ne,h=Ct,g=le,w=p("Delete"),b=j,S=H,k=Z,$=St,v=se,C=ue,L=he,M=_e,E=$t,T=Vt;return n(),y(T,{modelValue:o.editTab,"onUpdate:modelValue":t[12]||(t[12]=P=>o.editTab=P)},{default:r(()=>[a($,{label:e.$t("Paywalls"),name:"paywall"},{default:r(()=>[o.loading?(n(),y(k,{key:1,rows:2,animated:""})):(n(),c("div",_3,[(n(!0),c(F,null,x(s.field.paywalls,(P,U)=>(n(),c("div",m3,[a(g,{"fit-input-width":"",modelValue:s.field.paywalls[U],"onUpdate:modelValue":D=>s.field.paywalls[U]=D,placeholder:e.$t("Select Paywall")},{default:r(()=>[(n(!0),c(F,null,x(o.availablePaywalls,D=>(n(),y(h,{key:D.ID,label:D.post_title},{default:r(()=>[(n(!0),c(F,null,x(D.variants,A=>(n(),y(f,{key:A.id,value:A.id.toString(),label:A.variation_title,disabled:i.isPaywallAdded(A.id),class:"fcom_with_photo_option"},{default:r(()=>[l("span",h3,[A.photo?(n(),c("img",{key:0,src:A.photo},null,8,f3)):(n(),y(m,{key:1})),l("span",null,d(A.variation_title),1)])]),_:2},1032,["value","label","disabled"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"]),a(b,{onClick:D=>i.removePaywall(P)},{default:r(()=>[a(w)]),_:2},1032,["onClick"])]))),256)),!s.field.paywalls||Object.keys(s.field.paywalls).length<1?(n(),c("div",p3,[l("p",null,d(e.$t("Please add paywall pricing options")),1)])):_("",!0),l("div",g3,[a(S,{style:{width:"100%"},class:"fcom_plain_button",onClick:i.initAddPaywall},{default:r(()=>[l("span",null,d("+ "+e.$t("Add Paywall")),1)]),_:1},8,["onClick"])])]))]),_:1},8,["label"]),a($,{label:e.$t("Content"),name:"content"},{default:r(()=>[a(M,{onSubmit:t[2]||(t[2]=z(P=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a(C,{label:e.$t("Button Label")},{default:r(()=>[a(v,{modelValue:s.field.button_text,"onUpdate:modelValue":t[0]||(t[0]=P=>s.field.button_text=P),placeholder:e.$t("Button Label")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(C,null,{default:r(()=>[a(L,{modelValue:s.field.show_description,"onUpdate:modelValue":t[1]||(t[1]=P=>s.field.show_description=P),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Show Paywall Description")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["label"]),a($,{label:e.$t("Design"),name:"design"},{default:r(()=>[a(M,{onSubmit:t[11]||(t[11]=z(P=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a(C,{label:e.$t("Background Color")},{default:r(()=>[l("div",y3,[a(E,{predefine:e.appVars.suggestedColors,modelValue:s.field.background_color,"onUpdate:modelValue":t[3]||(t[3]=P=>s.field.background_color=P)},null,8,["predefine","modelValue"]),a(v,{modelValue:s.field.background_color,"onUpdate:modelValue":t[4]||(t[4]=P=>s.field.background_color=P)},null,8,["modelValue"])])]),_:1},8,["label"]),a(C,{label:e.$t("Text Color")},{default:r(()=>[l("div",v3,[a(E,{predefine:e.appVars.suggestedColors,modelValue:s.field.text_color,"onUpdate:modelValue":t[5]||(t[5]=P=>s.field.text_color=P)},null,8,["predefine","modelValue"]),a(v,{modelValue:s.field.text_color,"onUpdate:modelValue":t[6]||(t[6]=P=>s.field.text_color=P)},null,8,["modelValue"])])]),_:1},8,["label"]),a(C,{label:e.$t("Button Label")},{default:r(()=>[l("div",b3,[a(E,{predefine:e.appVars.suggestedColors,modelValue:s.field.button_text_color,"onUpdate:modelValue":t[7]||(t[7]=P=>s.field.button_text_color=P)},null,8,["predefine","modelValue"]),a(v,{modelValue:s.field.button_text_color,"onUpdate:modelValue":t[8]||(t[8]=P=>s.field.button_text_color=P)},null,8,["modelValue"])])]),_:1},8,["label"]),a(C,{label:e.$t("Button Background")},{default:r(()=>[l("div",k3,[a(E,{predefine:e.appVars.suggestedColors,modelValue:s.field.button_color,"onUpdate:modelValue":t[9]||(t[9]=P=>s.field.button_color=P),"show-alpha":""},null,8,["predefine","modelValue"]),a(v,{modelValue:s.field.button_color,"onUpdate:modelValue":t[10]||(t[10]=P=>s.field.button_color=P)},null,8,["modelValue"])])]),_:1},8,["label"])]),_:1})]),_:1},8,["label"])]),_:1},8,["modelValue"])}const C3=I(u3,[["render",w3]]),$3={name:"LockscreenMeta",components:{BgImageUpload:Vo,LockscreenPaywallMeta:C3},props:["lockscreen","space_id"],emits:["editField","updatePaywalls"],data(){return{loading:!1,editing:!1,editTab:"content",editingField:null,availablePaywalls:[]}},computed:{lockscreenFields(){return this.lockscreen},getFieldIcon(){return e=>{const t={image:"Picture",block:"Tickets",lesson:"Memo",paywall:"Money",welcome_banner:"VideoPlay"};return e.name=="action"?"Iphone":t[e.type]}}},methods:{toggleHidden(e){e.hidden=!e.hidden,e.type=="paywall"&&!e.hidden&&this.updateField(e)},updateField(e){this.editing=!0,this.editingField=e;const t=e.type=="block"?e:null;this.$emit("editField",t)},backToFields(){this.editing=!1,this.editingField=null,this.$emit("editField",null)},moveUp(e){if(e==0)return;const t=this.lockscreen[e],s=this.lockscreen[e-1];this.lockscreen.splice(e-1,2,t,s)},moveDown(e){if(e==this.lockscreen.length-1)return;const t=this.lockscreen[e],s=this.lockscreen[e+1];this.lockscreen.splice(e,2,s,t)}}},S3={key:0,class:"fcom_lockscreen_meta"},V3={class:"fcom_meta_section lockscreen_meta"},M3={class:"fcom_description"},L3={class:"fcom_meta_section lockscreen_meta"},T3={class:"fcom_meta_label"},F3={class:"fcom_meta_content"},P3={class:"fcom_meta_block"},I3={class:"fcom_block_label"},E3={class:"fcom_meta_sorting"},U3={class:"fcom_block_action"},A3={key:1,class:"fcom_lockscreen_meta"},B3={class:"fcom_edit_title"},D3={class:"fcom_edit_content"},R3={class:"fcom_color_input_wrap"},x3={class:"fcom_color_input_wrap"},H3={class:"fcom_color_input_wrap"},O3={class:"fcom_color_input_wrap"},j3={class:"fcom_color_input_wrap"},N3={key:1,class:"fcom_description"},z3={key:2,class:"fcom_description"},q3={key:3,class:"fcom_description"};function G3(e,t,s,u,o,i){const m=j,f=p("Top"),h=p("Bottom"),g=p("EditPen"),w=p("Hide"),b=p("View"),S=p("Back"),k=se,$=ue,v=he,C=_e,L=St,M=p("BgImageUpload"),E=$t,T=Vt,P=p("lockscreen-paywall-meta");return o.editing?(n(),c("div",A3,[l("div",B3,[a(m,{onClick:i.backToFields},{default:r(()=>[a(S)]),_:1},8,["onClick"]),l("p",null,d(e.$labelize(o.editingField.label)),1)]),l("div",D3,[o.editingField.type=="image"?(n(),y(T,{key:0,modelValue:o.editTab,"onUpdate:modelValue":t[18]||(t[18]=U=>o.editTab=U)},{default:r(()=>[a(L,{label:e.$t("Content"),name:"content"},{default:r(()=>[a(C,{onSubmit:t[5]||(t[5]=z(U=>e.doNothing(),["prevent"])),model:o.editingField,"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a($,{label:e.$t("Heading")},{default:r(()=>[a(k,{modelValue:o.editingField.heading,"onUpdate:modelValue":t[0]||(t[0]=U=>o.editingField.heading=U),placeholder:e.$t("Heading")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a($,{label:e.$t("Description")},{default:r(()=>[a(k,{modelValue:o.editingField.description,"onUpdate:modelValue":t[1]||(t[1]=U=>o.editingField.description=U),type:"textarea",placeholder:e.$t("Description")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a($,{label:e.$t("Button Label")},{default:r(()=>[a(k,{modelValue:o.editingField.button_text,"onUpdate:modelValue":t[2]||(t[2]=U=>o.editingField.button_text=U),placeholder:e.$t("Button Label")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a($,{label:e.$t("Button Link")},{default:r(()=>[a(k,{modelValue:o.editingField.button_link,"onUpdate:modelValue":t[3]||(t[3]=U=>o.editingField.button_link=U)},null,8,["modelValue"])]),_:1},8,["label"]),o.editingField.type=="image"?(n(),y($,{key:0},{default:r(()=>[a(v,{modelValue:o.editingField.new_tab,"onUpdate:modelValue":t[4]||(t[4]=U=>o.editingField.new_tab=U),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Open in New Tab")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0)]),_:1},8,["model"])]),_:1},8,["label"]),a(L,{label:e.$t("Design"),name:"design"},{default:r(()=>[a(C,{onSubmit:t[17]||(t[17]=z(U=>e.doNothing(),["prevent"])),model:o.editingField,"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a($,{label:e.$t("Background Image"),class:"fcom_bg_image"},{default:r(()=>[a(M,{modelValue:o.editingField.background_image,"onUpdate:modelValue":t[6]||(t[6]=U=>o.editingField.background_image=U),can_remove:!0},null,8,["modelValue"])]),_:1},8,["label"]),a($,{label:e.$t("Overlay Color")},{default:r(()=>[l("div",R3,[a(E,{predefine:e.appVars.suggestedColors,modelValue:o.editingField.overlay_color,"onUpdate:modelValue":t[7]||(t[7]=U=>o.editingField.overlay_color=U)},null,8,["predefine","modelValue"]),a(k,{modelValue:o.editingField.overlay_color,"onUpdate:modelValue":t[8]||(t[8]=U=>o.editingField.overlay_color=U)},null,8,["modelValue"])])]),_:1},8,["label"]),a($,{label:e.$t("Heading Color")},{default:r(()=>[l("div",x3,[a(E,{predefine:e.appVars.suggestedColors,modelValue:o.editingField.heading_color,"onUpdate:modelValue":t[9]||(t[9]=U=>o.editingField.heading_color=U)},null,8,["predefine","modelValue"]),a(k,{modelValue:o.editingField.heading_color,"onUpdate:modelValue":t[10]||(t[10]=U=>o.editingField.heading_color=U)},null,8,["modelValue"])])]),_:1},8,["label"]),a($,{label:e.$t("Text Color")},{default:r(()=>[l("div",H3,[a(E,{predefine:e.appVars.suggestedColors,modelValue:o.editingField.text_color,"onUpdate:modelValue":t[11]||(t[11]=U=>o.editingField.text_color=U)},null,8,["predefine","modelValue"]),a(k,{modelValue:o.editingField.text_color,"onUpdate:modelValue":t[12]||(t[12]=U=>o.editingField.text_color=U)},null,8,["modelValue"])])]),_:1},8,["label"]),a($,{label:e.$t("Button Label")},{default:r(()=>[l("div",O3,[a(E,{predefine:e.appVars.suggestedColors,modelValue:o.editingField.button_text_color,"onUpdate:modelValue":t[13]||(t[13]=U=>o.editingField.button_text_color=U)},null,8,["predefine","modelValue"]),a(k,{modelValue:o.editingField.button_text_color,"onUpdate:modelValue":t[14]||(t[14]=U=>o.editingField.button_text_color=U)},null,8,["modelValue"])])]),_:1},8,["label"]),a($,{label:e.$t("Button Background")},{default:r(()=>[l("div",j3,[a(E,{predefine:e.appVars.suggestedColors,modelValue:o.editingField.button_color,"onUpdate:modelValue":t[15]||(t[15]=U=>o.editingField.button_color=U),"show-alpha":""},null,8,["predefine","modelValue"]),a(k,{modelValue:o.editingField.button_color,"onUpdate:modelValue":t[16]||(t[16]=U=>o.editingField.button_color=U)},null,8,["modelValue"])])]),_:1},8,["label"])]),_:1},8,["model"])]),_:1},8,["label"])]),_:1},8,["modelValue"])):o.editingField.type=="block"?(n(),c("div",N3,d(e.$t("Edit the field from block editor ")),1)):o.editingField.type=="lesson"?(n(),c("div",z3,d(e.$t("Edit lessons from lesson editor ")),1)):o.editingField.type=="welcome_banner"?(n(),c("div",q3,d(e.$t("__COURSE_BANNER_SOURCE_DESC")),1)):o.editingField.type=="paywall"?(n(),y(P,{key:4,field:o.editingField,space_id:s.space_id},null,8,["field","space_id"])):_("",!0)])])):(n(),c("div",S3,[l("div",V3,[l("div",M3,[l("p",null,d(e.$t("This page is only visible to non-members viewing a private space.")),1)])]),l("div",L3,[l("div",T3,d(e.$t("Page Blocks")),1),l("div",F3,[l("ul",P3,[(n(!0),c(F,null,x(i.lockscreenFields,(U,D)=>(n(),c("li",{class:R(["fcom_block_list",{block_hidden:U.hidden}])},[l("div",I3,[a(m,{class:"fcom_el_icon"},{default:r(()=>[(n(),y(wt(i.getFieldIcon(U))))]),_:2},1024),l("p",null,d(e.$labelize(U.label)),1)]),l("div",E3,[a(m,{onClick:A=>i.moveUp(D)},{default:r(()=>[a(f)]),_:2},1032,["onClick"]),a(m,{onClick:A=>i.moveDown(D)},{default:r(()=>[a(h)]),_:2},1032,["onClick"])]),l("div",U3,[a(m,{onClick:A=>i.updateField(U)},{default:r(()=>[a(g)]),_:2},1032,["onClick"]),U.hidden?(n(),y(m,{key:0,onClick:A=>i.toggleHidden(U)},{default:r(()=>[a(w)]),_:2},1032,["onClick"])):(n(),y(m,{key:1,onClick:A=>i.toggleHidden(U)},{default:r(()=>[a(b)]),_:2},1032,["onClick"]))])],2))),256))])])])]))}const Y3=I($3,[["render",G3]]),W3={name:"BlockEditor",emits:["update:modelValue"],props:{modelValue:{type:String,required:!1}},data(){return{loading:!0,has_error:!1,all_loaded:!1,html:this.modelValue}},methods:{attach(){const e=this.$refs.block_editor;this.loading=!1,this.all_loaded=!0,window.wp.attachEditor(e,{iso:{toolbar:{undo:!0,navigation:!0,documentInspector:null},blocks:{allowBlocks:["core/button","core/buttons","core/code","core/column","core/columns","core/embed","core/group","core/heading","core/image","core/list","core/list-item","core/missing","core/paragraph","core/preformatted","core/pullquote","core/quote","core/separator","core/spacer","core/table","core/verse","core/html"]},__experimentalOnChange:function(t){console.log(t)},sidebar:{inserter:!1,inspector:!0}},editor:{__experimentalOnChange:function(t){console.log(t)},__experimentalOnInput(t){console.log(t)},__experimentalOnSelection(t){console.log(t)},onSaveContent:function(t){console.log(t)}}}),e.addEventListener("change",t=>{this.html=t.target.value,this.$emit("update:modelValue",t.target.value)})},loadScript(e){return new Promise((t,s)=>{const u=document.createElement("script");u.src=e,u.onload=t,u.onerror=s,document.head.append(u)})},async loadScripts(){const e=this.appVars.block_editor_assets.scripts;for(const t in e)try{await this.loadScript(e[t]),console.log(`${t} JS loaded`)}catch(s){this.has_error=!0,console.error(`Failed to load js ${t}:`,s)}this.attach()},loadCSSFile(e){return new Promise((t,s)=>{const u=document.createElement("link");u.rel="stylesheet",u.href=e,u.onload=t,u.onerror=s,document.head.append(u)})},async loadCSSFiles(){const t=this.appVars.block_editor_assets.styles.map(this.loadCSSFile);try{await Promise.all(t),console.log("All CSS files loaded")}catch(s){console.error("Failed to load some CSS files:",s)}}},mounted(){window.fl_block_editor_loaded?this.attach():(this.loadCSSFiles(),this.loadScripts(),window.fl_block_editor_loaded=!0)},beforeUnmount(){window.wp.detachEditor(this.$refs.block_editor)}},K3={class:"fcom_block_editor"};function Z3(e,t,s,u,o,i){const m=Z;return n(),c("div",K3,[W(l("div",null,[l("textarea",{ref:"block_editor",id:"fcom_block_editor",name:"block_editor"},`
4 `+d(o.html)+`
5 `,513)],512),[[kt,o.all_loaded]]),o.all_loaded?_("",!0):(n(),y(m,{key:0,class:"white_loaded",rows:7,animated:!0}))])}const J3=I(W3,[["render",Z3]]);const Q3={name:"FullEditorFrame",emits:["update:modelValue","titleUpdated","featuredMediaUpdated","metaUpdated","manageDocuments","useAlternateEditor"],props:{editorPath:{type:String,default:"/editor"},modelValue:{type:String,default:""},editorParams:{type:Object,default:()=>({})},frameHeight:{type:String,default:"500px"},documentTitle:{type:String,default:""},featured_image_id:{type:[String,Number],default:""},metaSettings:{type:Object,default:()=>null}},data(){return{editorData:{content:""},editorFrame:null,editorOrigin:null,lastUpdate:"No updates yet",dataSent:!1,isFailing:!1}},computed:{notLoading(){return!this.dataSent&&this.isFailing}},mounted(){setTimeout(()=>{this.isFailing=!0},1e4),this.editorData.content=this.modelValue,this.editorData.title=this.documentTitle,this.editorData.featured_image_id=this.featured_image_id,this.metaSettings&&(this.editorData.metaSettings=this.metaSettings),this.createEditorIframe(),window.addEventListener("message",this.handleEditorMessage)},beforeUnmount(){window.removeEventListener("message",this.handleEditorMessage),this.editorFrame&&(this.editorFrame.onload=null,this.$refs.iframeContainer.removeChild(this.editorFrame),this.editorFrame=null)},methods:{createEditorIframe(){const e=new URL(this.editorPath,window.location.origin);this.editorOrigin=e.origin,this.editorFrame=document.createElement("iframe");let t=this.appVars.wp_lesson_editor_frame;if(this.editorParams){const s=new URLSearchParams(this.editorParams);t+="&"+s.toString()}this.editorFrame.src=t,this.editorFrame.style.width="100%",this.editorFrame.style.height=this.frameHeight,this.$refs.iframeContainer.appendChild(this.editorFrame)},editorFailed(){this.$emit("useAlternateEditor")},sendDataToEditor(){if(this.editorFrame&&this.editorFrame.contentWindow){const e=JSON.parse(JSON.stringify(this.editorData));this.editorFrame.contentWindow.postMessage({type:"UPDATE_EDITOR",data:e},"*"),this.dataSent=!0}else alert("Editor frame is not loaded or contentWindow is not accessible.")},syncMetaToEditor(e){this.editorFrame&&this.editorFrame.contentWindow&&this.editorFrame.contentWindow.postMessage({type:"SYNC_META",data:JSON.parse(JSON.stringify(e))},"*")},handleEditorMessage(e){const{action:t,content:s}=e.data;t==="EDITOR_UPDATED"?this.dataSent&&(this.editorData.content=s,this.$emit("update:modelValue",s)):t==="TITLE_UPDATED"?(this.editorData.title=s,this.$emit("titleUpdated",s)):t==="FEATURED_MEDIA_UPDATED"?this.$emit("featuredMediaUpdated",s):t==="META_UPDATED"?this.$emit("metaUpdated",s):t==="MANAGE_DOCUMENTS"?this.$emit("manageDocuments"):t==="EDITOR_READY"&&(console.log("EDITOR_READY"),this.sendDataToEditor())}}},X3={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},e8=["element-loading-text"],t8={ref:"iframeContainer",class:"iframe-container"};function s8(e,t,s,u,o,i){const m=H,f=Z,h=te("loading");return n(),c(F,null,[i.notLoading?(n(),c("div",X3,[l("p",null,d(e.$t("Problem with loading the editor?")),1),a(m,{onClick:t[0]||(t[0]=g=>i.editorFailed())},{default:r(()=>[V(d(e.$t("Use Alternative Editor")),1)]),_:1})])):_("",!0),W((n(),c("div",{"element-loading-text":e.$t("Loading editor. Please wait..."),class:"editor-container"},[o.dataSent?_("",!0):(n(),y(f,{key:0,style:{margin:"50px"},animated:!0,rows:2})),l("div",t8,null,512)],8,e8)),[[h,!o.dataSent]])],64)}const o8=I(Q3,[["render",s8],["__scopeId","data-v-9e1ae12e"]]),i8={name:"CircleIcon",props:{fill:{type:String,default:"currentColor"}}},n8=["fill"],l8=l("path",{d:"M10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5Z",fill:"none",stroke:"currentColor"},null,-1),a8=[l8];function r8(e,t,s,u,o,i){return n(),c("svg",{fill:s.fill,width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},a8,8,n8)}const bs=I(i8,[["render",r8]]),c8={name:"LessonIcon"},d8={width:"60",height:"48",viewBox:"0 0 60 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},u8=l("rect",{width:"60",height:"48",rx:"4",fill:"#F2F5F8"},null,-1),_8=l("path",{d:"M30 16.5L21 21.75L30 27L37.5 22.625V28.125H39V21.75L30 16.5ZM23.9993 25.1179V28.5001C25.3676 30.3217 27.5461 31.5001 29.9998 31.5001C32.4535 31.5001 34.6321 30.3217 36.0004 28.5001L36.0001 25.1185L30.0002 28.6184L23.9993 25.1179Z",fill:"#525866"},null,-1),m8=[u8,_8];function h8(e,t,s,u,o,i){return n(),c("svg",d8,m8)}const Lo=I(c8,[["render",h8]]),f8={name:"PlayIcon"},p8={width:"20",height:"19",viewBox:"0 0 20 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},g8=Te('<g filter="url(#filter0_d_6543_69201)"><path d="M10 16.5C5.85775 16.5 2.5 13.1422 2.5 9C2.5 4.85775 5.85775 1.5 10 1.5C14.1422 1.5 17.5 4.85775 17.5 9C17.5 13.1422 14.1422 16.5 10 16.5ZM8.9665 6.31125C8.92136 6.28113 8.8689 6.26383 8.8147 6.26117C8.76051 6.25851 8.7066 6.27059 8.65873 6.29615C8.61086 6.3217 8.57082 6.35975 8.54287 6.40626C8.51492 6.45277 8.5001 6.50599 8.5 6.56025V11.4398C8.5001 11.494 8.51492 11.5472 8.54287 11.5937C8.57082 11.6402 8.61086 11.6783 8.65873 11.7039C8.7066 11.7294 8.76051 11.7415 8.8147 11.7388C8.8689 11.7362 8.92136 11.7189 8.9665 11.6888L12.6258 9.24975C12.6669 9.22236 12.7006 9.18524 12.724 9.14166C12.7473 9.09809 12.7595 9.04943 12.7595 9C12.7595 8.95057 12.7473 8.90191 12.724 8.85834C12.7006 8.81476 12.6669 8.77764 12.6258 8.75025L8.96575 6.31125H8.9665Z" fill="white"></path></g><defs><filter id="filter0_d_6543_69201" x="0.5" y="0.5" width="19" height="19" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="1"></feOffset><feGaussianBlur stdDeviation="1"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0.0392157 0 0 0 0 0.0509804 0 0 0 0 0.0784314 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_6543_69201"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_6543_69201" result="shape"></feBlend></filter></defs>',2),y8=[g8];function v8(e,t,s,u,o,i){return n(),c("svg",p8,y8)}const To=I(f8,[["render",v8]]),b8={name:"PlayPlaceholderIcon"},k8={width:"60",height:"48",viewBox:"0 0 60 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},w8=Te('<rect width="60" height="48" rx="4" fill="#F2F5F8"></rect><g clip-path="url(#clip0_6463_70077)"><g filter="url(#filter0_d_6463_70077)"><path d="M30 31.5C25.8578 31.5 22.5 28.1423 22.5 24C22.5 19.8578 25.8578 16.5 30 16.5C34.1423 16.5 37.5 19.8578 37.5 24C37.5 28.1423 34.1423 31.5 30 31.5ZM28.9665 21.3112C28.9214 21.2811 28.8689 21.2638 28.8147 21.2612C28.7605 21.2585 28.7066 21.2706 28.6587 21.2961C28.6109 21.3217 28.5708 21.3598 28.5429 21.4063C28.5149 21.4528 28.5001 21.506 28.5 21.5602V26.4398C28.5001 26.494 28.5149 26.5472 28.5429 26.5937C28.5708 26.6402 28.6109 26.6783 28.6587 26.7039C28.7066 26.7294 28.7605 26.7415 28.8147 26.7388C28.8689 26.7362 28.9214 26.7189 28.9665 26.6888L32.6258 24.2498C32.6669 24.2224 32.7006 24.1852 32.724 24.1417C32.7473 24.0981 32.7595 24.0494 32.7595 24C32.7595 23.9506 32.7473 23.9019 32.724 23.8583C32.7006 23.8148 32.6669 23.7776 32.6258 23.7502L28.9658 21.3112H28.9665Z" fill="#525866"></path></g></g><defs><filter id="filter0_d_6463_70077" x="20.5" y="15.5" width="19" height="19" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="1"></feOffset><feGaussianBlur stdDeviation="1"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0.0392157 0 0 0 0 0.0509804 0 0 0 0 0.0784314 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_6463_70077"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_6463_70077" result="shape"></feBlend></filter><clipPath id="clip0_6463_70077"><rect width="20" height="20" fill="white" transform="translate(20 14)"></rect></clipPath></defs>',3),C8=[w8];function $8(e,t,s,u,o,i){return n(),c("svg",k8,C8)}const Fo=I(b8,[["render",$8]]),S8={name:"_LockscreenLessonEditor",components:{CircleIcon:bs,LessonIcon:Lo,PlayIcon:To,PlayPlaceholderIcon:Fo},props:{sections:{type:Array,required:!0},is_editor:{type:Boolean,default:!1},settings:{type:Object,required:!1}},computed:{lessonsCount(){return this.sections.reduce((e,t)=>e+t.lessons.length,0)},sectionsCount(){return this.sections.reduce((e,t)=>e+(t.lessons.length?1:0),0)},lessonDuration(){return e=>{const t=e.lessons.reduce((s,u)=>s+(u.meta.video_length||0),0);return this.formatSeconds(t)||null}}},methods:{isEnabledMedia(e){var t;return((t=e.meta)==null?void 0:t.enable_media)=="yes"},hasMediaVideo(e){var s;const t=(s=e.meta)==null?void 0:s.media;return this.isEnabledMedia(e)&&(t==null?void 0:t.content_type)=="video"&&(t==null?void 0:t.html)},showPlayIcon(e){return this.hasMediaVideo(e)&&(this.hasMediaImage(e)||e.featured_image)},hasMediaImage(e){var t,s;return this.isEnabledMedia(e)&&((s=(t=e.meta)==null?void 0:t.media)==null?void 0:s.image)},isModernLayout(){var e;return this.has_pro&&((e=this.settings)==null?void 0:e.course_layout)==="modern"},isFreePreview(e){var t;return this.has_pro&&((t=e==null?void 0:e.meta)==null?void 0:t.free_preview_lesson)=="yes"},maybeGotoLesson(e,t){if(!this.is_editor){if(this.isFreePreview(e)){this.gotoLesson(e);return}t.is_locked&&t.unlock_date&&this.$notify.info({message:this.$t("This lesson will be unlocked on %s",t.unlock_date),type:"info"})}},gotoLesson(e){this.$router.push({name:"view_lesson",params:{lesson_slug:e.slug}}),setTimeout(()=>{window.location.reload()},100)},formatSeconds(e){if(e<1)return null;let t=Math.floor(e/3600),s=Math.floor(e%3600/60),u=e%60,o="";return t>0&&(o+=this.$t("%dh ",t)),s>0&&(o+=this.$t("%dm ",s)),u>0&&(o+=this.$t("%ds",u)),o.trim()||null}}},V8={class:"fcom_course_sections"},M8={class:"fcom_course_intro"},L8={class:"fcom_course_labels"},T8={class:"fcom_course_info"},F8=l("span",null," • ",-1),P8={class:"fcom_card_sections"},I8={class:"fcom_section_items"},E8=["onClick"],U8={class:"fcom_section_primary_item_title"},A8={class:"title_line_container"},B8={class:"title_line"},D8={class:"fcom_meta_text"},R8={key:0,class:"fcom_meta_text"},x8={class:"fcom_section_primary_item_actions"},H8=["onClick"],O8={class:"fcom_heading_item clickable"},j8={class:"lesson_feature_media"},N8=["src","alt"],z8=["src","alt"],q8={class:"lesson_title"},G8=["innerHTML"],Y8={class:"lesson_duration"},W8={key:0},K8={key:1},Z8=["innerHTML"];function J8(e,t,s,u,o,i){const m=p("ArrowRight"),f=p("ArrowDown"),h=j,g=p("CircleIcon"),w=p("Lock"),b=p("PlayPlaceholderIcon"),S=p("LessonIcon"),k=p("PlayIcon");return n(),c("div",V8,[l("div",M8,[l("div",L8,[l("h3",null,d(e.$t("Course Content")),1),l("p",T8,[V(d(e.$_n("%s Topic","%s Topics",i.sectionsCount))+" ",1),F8,V(" "+d(e.$_n("%s Lesson","%s Lessons",i.lessonsCount)),1)])])]),l("div",P8,[l("div",I8,[(n(!0),c(F,null,x(s.sections,$=>(n(),c("div",{key:$.id,class:"fcom_section_primary"},[$.lessons.length?(n(),c("div",{key:0,onClick:v=>$.is_closed=!$.is_closed,class:R(["clickable fcom_section_primary_item",{is_closed:$.is_closed}])},[l("div",U8,[l("div",A8,[l("div",B8,[l("h4",null,d($.title),1)]),l("span",D8,d(e.$t("%d lessons",$.lessons.length)),1),i.lessonDuration($)?(n(),c("span",R8," • "+d(i.lessonDuration($)),1)):_("",!0)])]),l("div",x8,[a(h,{class:"clickable"},{default:r(()=>[$.is_closed?(n(),y(m,{key:0,class:"fcom_arrow_icon"})):(n(),y(f,{key:1}))]),_:2},1024)])],10,E8)):_("",!0),$.is_closed?_("",!0):(n(!0),c(F,{key:1},x($.lessons,v=>(n(),c("div",{key:v.id,class:R(["fcom_section_item",{is_locked:!i.isFreePreview(v)}])},[l("div",{onClick:C=>i.maybeGotoLesson(v,$),class:"fcom_section_item_title"},[l("p",O8,[a(h,null,{default:r(()=>[i.isFreePreview(v)?(n(),y(g,{key:0})):(n(),y(w,{key:1}))]),_:2},1024),i.isModernLayout?(n(),c(F,{key:0},[l("span",j8,[v.featured_image?(n(),c("img",{key:0,src:v.featured_image,alt:v.title},null,8,N8)):i.hasMediaImage(v)?(n(),c("img",{key:1,src:v.meta.media.image,alt:v.title},null,8,z8)):i.hasMediaVideo(v)?(n(),y(b,{key:2})):(n(),y(S,{key:3})),i.showPlayIcon(v)?(n(),y(k,{key:4,class:"play_icon"})):_("",!0)]),l("span",q8,[l("span",{innerHTML:v.title},null,8,G8),l("span",Y8,[v.meta.video_length?(n(),c("span",W8,d(i.formatSeconds(v.meta.video_length)),1)):(n(),c("span",K8,d("---")))])])],64)):(n(),c("span",{key:1,innerHTML:v.title},null,8,Z8))])],8,H8)],2))),128))]))),128))])])])}const Po=I(S8,[["render",J8]]),Q8={name:"LockscreenPaywallView",components:{ImagePlaceholder:qt},props:{space_id:{type:[String,Number],required:!0},field:{type:Object,required:!0},editable:{type:Boolean,default:!1}},data(){return{loading:!1,availablePaywalls:[]}},computed:{buttonStyles(){return{backgroundColor:this.field.button_color,borderColor:this.field.button_color,color:this.field.button_text_color}},cardStyles(){return{backgroundColor:this.field.background_color||"transparent",color:this.field.text_color||"var(--fcom-primary-text, #2B2E33)"}},filteredPaywalls(){return!Array.isArray(this.field.paywalls)||!Array.isArray(this.availablePaywalls)?[]:this.field.paywalls.map(e=>{for(const t of this.availablePaywalls)if(Array.isArray(t.variants)){const s=t.variants.find(u=>String(u.id)===String(e));if(s)return{...s,description:t.post_excerpt}}return null}).filter(Boolean)}},methods:{isSubscriptionPaywall(e){var t;return((t=e.other_info)==null?void 0:t.payment_type)=="subscription"},getRepeatInterval(e){var u;const t=(u=e.other_info)==null?void 0:u.repeat_interval;return t&&{daily:this.$t("day"),weekly:this.$t("week"),monthly:this.$t("month"),quarterly:this.$t("quarter"),half_yearly:this.$t("half year"),yearly:this.$t("year")}[t]||""},fetchAvailablePaywalls(){if(!this.space_id){this.availablePaywalls=[];return}const e={space_id:this.space_id};this.editable||(e.paywall_ids=this.field.paywalls),this.loading=!0,this.$get("cart/spaces/"+this.space_id+"/paywalls",e).then(t=>{this.availablePaywalls=t.paywalls||[]}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})}},mounted(){this.hasFeature("has_fluentcart")&&this.fetchAvailablePaywalls()}},X8={class:"fcom_paywall_cards"},e4={class:"paywall_header"},t4={class:"paywall_body"},s4=["innerHTML"],o4={key:0,class:"subscription"},i4={class:"paywall_footer"},n4={key:0,class:"fcom_mb_10"},l4=["href"];function a4(e,t,s,u,o,i){const m=Z,f=ss,h=p("ImagePlaceholder");return n(),c("div",X8,[o.loading?(n(),y(m,{key:0,rows:3,animated:!0})):(n(!0),c(F,{key:1},x(i.filteredPaywalls,g=>(n(),c("div",{key:g.id,class:"fcom_paywall",style:re(i.cardStyles)},[l("div",e4,[g.photo?(n(),y(f,{key:0,src:g.photo},null,8,["src"])):(n(),y(f,{key:1},{default:r(()=>[a(h)]),_:1})),l("span",null,d(g.variation_title),1)]),l("div",t4,[l("span",{innerHTML:g.total_price},null,8,s4),i.isSubscriptionPaywall(g)?(n(),c("span",o4," / "+d(i.getRepeatInterval(g)),1)):_("",!0)]),l("div",i4,[s.field.show_description=="yes"&&(g!=null&&g.description)?(n(),c("span",n4,d(g.description),1)):_("",!0),s.editable?W((n(),c("input",{key:1,class:"el-button fcom_primary_button link_button",style:re(i.buttonStyles),type:"text","onUpdate:modelValue":t[0]||(t[0]=w=>s.field.button_text=w)},null,4)),[[Yo,s.field.button_text]]):(n(),c("a",{key:2,class:"el-button fcom_primary_button link_button",style:re(i.buttonStyles),href:g.checkout_url},d(s.field.button_text),13,l4))])],4))),128))])}const Io=I(Q8,[["render",a4]]),r4={name:"LockScreenEditor",props:["title","lockscreen","sections","saving","loading","space_id","settings"],emits:["save","close"],components:{LockscreenLessonEditor:Po,MediaEmbeder:_s,BlockEditor:J3,LockscreenMeta:Y3,LockscreenPaywallView:Io,FullEditorFrame:o8},data(){return{editingField:null,useClassic:!1}},computed:{lockscreenFields(){return this.lockscreen.filter(e=>!e.hidden)},imageStyles(){return e=>({backgroundImage:`url(${e.background_image})`,backgroundColor:e.overlay_color})},headingStyles(){return e=>({color:e.heading_color})},descriptionStyles(){return e=>({color:e.text_color})},buttonStyles(){return e=>({backgroundColor:e.button_color,color:e.button_text_color})}},methods:{updateHeading(e,t){t.heading=e.target.innerText},updateDescription(e,t){t.description=e.target.innerText},updateButtonLabel(e,t){t.button_text=e.target.innerText},visibleBlock(e){this.editingField=e},updateEditField(e){this.editingField=e,(e==null?void 0:e.type)==="block"&&setTimeout(()=>{const t=document.getElementById("fcomBlockContent");t&&t.scrollIntoView({behavior:"smooth"})},300)},saveChanges(){this.editingField=null,this.$emit("save")},switchToClassic(){this.useClassic=!0}}},c4={class:"fcom_editor_topbar"},d4={class:"fcom_editor_content"},u4={class:"fcom_item"},_4={class:"fcom_content"},m4=["onBlur"],h4=["onBlur"],f4=["onBlur"],p4={key:1,class:"fcom_content_wrap"},g4={id:"fcomBlockContent"},y4={key:2,class:"fcom_content_wrap"},v4={key:1,class:"fcom_description"},b4={key:3,class:"fcom_content_wrap"},k4={key:4,class:"fcom_paywall_wrap"};function w4(e,t,s,u,o,i){const m=p("lockscreen-meta"),f=et,h=p("Lock"),g=j,w=p("block-editor"),b=p("FullEditorFrame"),S=p("welcome-banner"),k=p("lockscreen-lesson-editor"),$=Z,v=p("lockscreen-paywall-view"),C=ke,L=Le;return n(),c(F,null,[a(f,{class:"fcom_full_editor_side lockscreen_editor",width:"250px"},{default:r(()=>[Y(e.$slots,"before_meta"),a(m,{lockscreen:s.lockscreen,space_id:s.space_id,onEditField:i.updateEditField},null,8,["lockscreen","space_id","onEditField"])]),_:3}),a(L,{class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(C,null,{default:r(()=>[l("div",c4,[a(g,null,{default:r(()=>[a(h)]),_:1}),l("h3",null,d(s.title),1)]),l("div",d4,[(n(!0),c(F,null,x(i.lockscreenFields,M=>{var E;return n(),c("div",u4,[M.type=="image"?(n(),c("div",{key:0,class:"fcom_image_wrap",style:re(i.imageStyles(M))},[l("div",_4,[l("h2",{style:re(i.headingStyles(M)),contenteditable:"true",onBlur:T=>i.updateHeading(T,M)},d(M.heading),45,m4),M.description?(n(),c("p",{key:0,style:re(i.descriptionStyles(M)),contenteditable:"true",onBlur:T=>i.updateDescription(T,M)},d(M.description),45,h4)):_("",!0),M.button_text?(n(),c("button",{key:1,class:"fcom_btn",style:re(i.buttonStyles(M)),contenteditable:"true",onBlur:T=>i.updateButtonLabel(T,M)},d(M.button_text),45,f4)):_("",!0)])],4)):_("",!0),M.type=="block"?(n(),c("div",p4,[l("div",g4,[o.useClassic?(n(),y(w,{key:0,modelValue:M.content,"onUpdate:modelValue":T=>M.content=T},null,8,["modelValue","onUpdate:modelValue"])):(n(),y(b,{key:1,ref_for:!0,ref:"fullEditorFrame",onUseAlternateEditor:i.switchToClassic,editorParams:{context:"lockscreen",space_id:s.space_id},frameHeight:"calc(100vh - 160px)",documentTitle:"",modelValue:M.content,"onUpdate:modelValue":T=>M.content=T},null,8,["onUseAlternateEditor","editorParams","frameHeight","modelValue","onUpdate:modelValue"]))])])):_("",!0),M.type=="welcome_banner"?(n(),c("div",y4,[M.banner?(n(),y(S,{key:0,config:M.banner,"wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config"])):(n(),c("div",v4,d(e.$t("__COURSE_BANNER_EMPTY_DESC")),1))])):_("",!0),M.type=="lesson"?(n(),c("div",b4,[s.loading?(n(),y($,{key:1,rows:5,animated:!0})):(n(),y(k,{key:0,sections:s.sections,is_editor:!0,settings:s.settings},null,8,["sections","settings"]))])):_("",!0),M.type=="paywall"&&((E=M.paywalls)==null?void 0:E.length)>0?(n(),c("div",k4,[a(v,{space_id:s.space_id,field:M,editable:!0},null,8,["space_id","field"])])):_("",!0)])}),256))])]),_:1})]),_:1})],64)}const C4=I(r4,[["render",w4]]),$4={name:"SpaceLockscreen",props:["spaceProfile","savingCount"],emits:["close"],components:{LockScreenEditor:C4},data(){return{saving:!1,loading:!1,lockscreen:null}},watch:{savingCount(){this.saveChanges()}},methods:{saveChanges(){this.lockscreen&&(this.saving=!0,this.$put("spaces/"+this.spaceProfile.slug+"/lockscreens",{lockscreen:this.lockscreen}).then(e=>{this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1}))},getLockscreen(){this.loading=!0,this.$get("spaces/"+this.spaceProfile.slug+"/lockscreens").then(e=>{this.lockscreen=e.lockscreen}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.getLockscreen()}},S4={key:0,class:"fcom_lockscreen_meta"},V4={class:"fcom_description"},M4={class:"white_loaded"};function L4(e,t,s,u,o,i){const m=p("lock-screen-editor"),f=Z,h=Le;return o.lockscreen?(n(),y(m,{key:0,title:s.spaceProfile.title,space_id:s.spaceProfile.id,settings:s.spaceProfile.settings,lockscreen:o.lockscreen,saving:o.saving,loading:o.loading,onSave:i.saveChanges,onClose:t[0]||(t[0]=g=>e.$emit("close"))},{before_meta:r(()=>[s.spaceProfile.settings.custom_lock_screen!="yes"?(n(),c("div",S4,[l("div",V4,[l("p",null,d(e.$t("__LOCK_SCRREN_DESC")),1)])])):_("",!0)]),_:1},8,["title","space_id","settings","lockscreen","saving","loading","onSave"])):o.loading?(n(),y(h,{key:1,class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[l("div",M4,[a(f,{animated:!0,rows:10})])]),_:1})):_("",!0)}const T4=I($4,[["render",L4]]),F4={name:"ManageSpaceLinks",components:{MenuGroupSettings:Mo},props:["spaceProfile","savingCount"],emits:["close"],data(){return{saving:!1}},watch:{savingCount(){this.saveMenuItems(!0)}},methods:{saveMenuItems(e=!1){this.saving=!0;let t="spaces/"+this.spaceProfile.slug+"/links";this.spaceProfile.type=="course"&&(t="admin/courses/"+this.spaceProfile.id+"/links"),this.$post(t,{links:this.spaceProfile.settings.links,space_id:this.spaceProfile.id}).then(s=>{this.$notify.success(s.message),this.spaceProfile.settings.links=s.links,e&&this.$emit("close")}).catch(s=>{this.$handleError(s)}).finally(()=>{this.saving=!1})}}},P4={style:{"max-width":"800px",padding:"20px",margin:"0 auto"}},I4={class:"fcom_card_sections"};function E4(e,t,s,u,o,i){const m=p("menu-group-settings"),f=ke,h=Le;return n(),y(h,{class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(f,null,{default:r(()=>[l("div",P4,[l("div",I4,[a(m,{custom_svg:!0,use_icon_selector:!0,has_svg:!1,onSave:t[0]||(t[0]=g=>i.saveMenuItems()),title:e.$t("Manage Links"),menuItems:s.spaceProfile.settings.links},null,8,["title","menuItems"])])])]),_:1})]),_:1})}const U4=I(F4,[["render",E4]]),A4={name:"AddPaywallModal",props:{modelValue:{type:Boolean,default:!1},spaceProfile:{type:Object,required:!0}},emits:["update:modelValue","added"],data(){return{products:[],productID:null,saving:!1,creatingProduct:!1,fetchingProducts:!1,newPaywall:{title:"",price:0}}},computed:{addPaywallModal:{get(){return this.modelValue},set(e){this.$emit("update:modelValue",e)}}},methods:{isProductAdded(e){var t,s;return(s=(t=this.spaceProfile.settings)==null?void 0:t.cart_product_ids)==null?void 0:s.includes(e)},initCreateProduct(){this.productID=null,this.newPaywall={title:"",price:0}},createProduct(){var e,t;this.creatingProduct=!0,this.$post("cart/products/create",{title:(e=this.newPaywall)==null?void 0:e.title,price:(t=this.newPaywall)==null?void 0:t.price}).then(s=>{var u;this.products.push(s.product),this.productID=(u=s.product)==null?void 0:u.id,this.productID&&this.addPaywall()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.creatingProduct=!1})},searchProducts(e=""){e&&e.length<3||this.fetchProducts(e)},fetchProducts(e=""){this.fetchingProducts=!0,this.$get("cart/products/search",{search:e,space_id:this.spaceProfile.id}).then(t=>{this.products=t.products}).catch(t=>{this.$handleError(t)}).finally(()=>{this.fetchingProducts=!1})},addPaywall(){this.saving=!0,this.$post("cart/spaces/"+this.spaceProfile.id+"/paywalls",{cart_product_id:this.productID,space_id:this.spaceProfile.id}).then(e=>{var t;this.$notify.success(e.message),this.$emit("added",(t=e.paywall)==null?void 0:t.ID),this.addPaywallModal=!1}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},mounted(){this.fetchProducts()}},B4={class:"fcom_topic_selector"},D4={class:"fcom_select_photo",style:{float:"left"}},R4=["src","alt"],x4=["innerHTML"];function H4(e,t,s,u,o,i){const m=ne,f=le,h=p("Plus"),g=j,w=H,b=se,S=ue,k=_e,$=ye,v=es,C=te("loading");return n(),y(v,{"modal-class":"fcom_common_dialog",class:"fcom_high_drawer",size:e.drawerWidth,modelValue:i.addPaywallModal,"onUpdate:modelValue":t[6]||(t[6]=L=>i.addPaywallModal=L),"close-on-click-modal":!1,visible:i.addPaywallModal,direction:"rtl"},{header:r(()=>[l("h4",null,d(e.$t("Add Paywall")),1)]),default:r(()=>[a(k,{onSubmit:t[5]||(t[5]=z(L=>e.doNothing(),["prevent"])),"label-position":"top"},{default:r(()=>[a(S,null,{default:r(()=>[l("div",B4,[W((n(),y(f,{style:{width:"100%"},"fit-input-width":"",modelValue:o.productID,"onUpdate:modelValue":t[0]||(t[0]=L=>o.productID=L),filterable:"",clearable:"",remote:"",loading:o.fetchingProducts,"remote-method":i.searchProducts,placeholder:e.$t("Search Product")},{default:r(()=>[(n(!0),c(F,null,x(o.products,L=>(n(),y(m,{key:L.id,label:L.title,value:L.id,disabled:i.isProductAdded(L.id),class:"fcom_with_photo_option"},{default:r(()=>[l("span",D4,[l("img",{src:L.image,alt:L.title},null,8,R4),l("span",null,d(L.title),1)]),l("span",{style:{float:"right",color:"#8492a6","font-size":"13px"},innerHTML:L.price},null,8,x4)]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","loading","remote-method","placeholder"])),[[C,o.fetchingProducts]]),a($,{ref:"creating_product_ref",onShow:i.initCreateProduct,placement:"bottom",width:400,trigger:"click"},{reference:r(()=>[a(w,{class:"fcom_secondary_button"},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1}),l("span",null,d(e.$t("New")),1)]),_:1})]),default:r(()=>[a(k,{modelValue:o.newPaywall,"onUpdate:modelValue":t[4]||(t[4]=L=>o.newPaywall=L),"label-position":"top"},{default:r(()=>[a(S,{label:e.$t("Title")},{default:r(()=>[a(b,{modelValue:o.newPaywall.title,"onUpdate:modelValue":t[1]||(t[1]=L=>o.newPaywall.title=L),placeholder:e.$t("Title of the product")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(S,{label:e.$t("Price")},{default:r(()=>[a(b,{modelValue:o.newPaywall.price,"onUpdate:modelValue":t[2]||(t[2]=L=>o.newPaywall.price=L),type:"number",placeholder:e.$t("Price of the product"),min:0},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(S,null,{default:r(()=>[a(w,{class:"fcom_primary_button",onClick:t[3]||(t[3]=L=>i.createProduct()),loading:o.creatingProduct,disabled:o.creatingProduct},{default:r(()=>[V(d(e.$t("Create")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["onShow"])])]),_:1}),a(S,null,{default:r(()=>[a(w,{class:"fcom_primary_button",loading:o.saving,onClick:i.addPaywall},{default:r(()=>[V(d(e.$t("Add")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["size","modelValue","visible"])}const O4=I(A4,[["render",H4]]),j4={name:"ManagePaywalls",components:{ImagePlaceholder:qt,AddPaywallModal:O4},props:["spaceProfile","savingCount"],emits:["close"],data(){return{paywalls:[],loading:!1,removing:!1,addPaywallModal:!1,removePaywallModal:!1,revokeAccess:!1,removePaywall:null,installing:!1,hasFluentCart:this.hasFeature("has_fluentcart")}},computed:{spaceType(){return this.spaceProfile.type=="course"?this.$t("courses"):this.$t("spaces")}},methods:{copyCheckoutUrl(e){this.$toClipboard(e,this.$t("Checkout URL copied to clipboard"))},initRemovePaywall(e){this.$nextTick(()=>{this.removePaywallModal=!0,this.removePaywall=e})},initAddPaywall(){this.$nextTick(()=>{this.addPaywallModal=!0})},resetPaywall(){var t;const e=((t=this.spaceProfile.settings)==null?void 0:t.cart_product_ids)||[];e.splice(e.indexOf(this.removePaywall.ID),1),this.spaceProfile.settings.cart_product_ids=e,this.removePaywall=null,this.revokeAccess=!1,this.getPaywalls()},paywallAdded(e){var s;const t=((s=this.spaceProfile.settings)==null?void 0:s.cart_product_ids)||[];t.includes(e)||t.push(e),this.spaceProfile.settings.cart_product_ids=t,this.getPaywalls()},getPaywalls(){this.loading=!0,this.$get("cart/spaces/"+this.spaceProfile.id+"/paywalls",{space_id:this.spaceProfile.id}).then(e=>{this.paywalls=e.paywalls}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},deletePaywall(){this.removing=!0,this.$del("cart/spaces/"+this.spaceProfile.id+"/paywalls",{cart_product_id:this.removePaywall.ID,revoke_access:this.revokeAccess}).then(e=>{this.$notify.success(e.message),this.removePaywallModal=!1,this.resetPaywall()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.removing=!1})},installPlugin(){this.installing=!0,this.$post("settings/install_plugin",{plugin:"fluent-cart"}).then(e=>{e.is_installed?this.$notify.success(e.message):this.$handleError(this.$t("Sorry, FluentCart could not be installed")),this.hasFluentCart=!0,this.getPaywalls()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.installing=!1})}},mounted(){var t;(((t=this.spaceProfile.settings)==null?void 0:t.cart_product_ids)||[])&&this.hasFluentCart&&this.getPaywalls()}},N4={style:{"max-width":"800px",padding:"20px",margin:"0 auto"}},z4={class:"fcom_card_sections"},q4={class:"fcom_card_section_heading"},G4={class:"fcom_section_primary_item_title"},Y4={class:"fcom_heading_item"},W4={key:0,class:"fcom_section_item_actions"},K4={class:"fcom_section_primary"},Z4={class:"fcom_section_primary_item"},J4={class:"fcom_section_primary_item_title"},Q4={class:"fcom_heading_item"},X4={class:"fcom_shape"},eC={class:"fcom_section_item_actions"},tC=["href"],sC=["href"],oC={class:"fcom_section_items"},iC={class:"fcom_section_item_title"},nC={class:"fcom_heading_item"},lC={class:"fcom_shape"},aC={class:"fcom_section_item_actions"},rC=["innerHTML"],cC={key:2,style:{padding:"1rem"}},dC={key:1,class:"fcom_section_item"},uC={class:"fcom_section_primary"},_C={class:"fcom_section_primary_item"},mC=["disabled"],hC={class:"dialog_header"},fC={class:"dialog_left"},pC={class:"dialog_body"},gC={style:{"text-align":"center"}},yC={class:"fcom_heading_item",style:{"justify-content":"center"}},vC={class:"fcom_shape"},bC={style:{margin:"1rem 0px 0.8rem"}},kC={class:"dialog_footer"};function wC(e,t,s,u,o,i){const m=H,f=Z,h=ss,g=p("MoreFilled"),w=j,b=ze,S=qe,k=Ge,$=p("ImagePlaceholder"),v=ke,C=Le,L=p("AddPaywallModal"),M=he,E=be,T=te("loading");return n(),c(F,null,[a(C,{class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(v,null,{default:r(()=>[l("div",N4,[l("div",z4,[l("div",q4,[l("div",G4,[l("div",Y4,[Y(e.$slots,"title",{},()=>[l("h4",null,d(e.$t("Manage Paywalls")),1)])])]),o.hasFluentCart?(n(),c("div",W4,[a(m,{class:"fcom_primary_button",onClick:t[0]||(t[0]=P=>i.initAddPaywall())},{default:r(()=>[V(d(e.$t("Add Paywall")),1)]),_:1})])):_("",!0)]),o.hasFluentCart?(n(),c(F,{key:0},[o.loading||o.removing?(n(),y(f,{key:0,class:"white_loaded",rows:5,animated:!0})):o.paywalls.length?(n(!0),c(F,{key:1},x(o.paywalls,P=>(n(),c("div",{class:"fcom_section_item",key:P.ID},[l("div",K4,[l("div",Z4,[l("div",J4,[l("h4",Q4,[l("span",X4,[a(h,{src:P==null?void 0:P.thumbnail},null,8,["src"])]),l("span",null,d((P==null?void 0:P.post_title)||""),1)])]),l("div",eC,[a(k,{trigger:"click","popper-class":"fcom_pop_action"},{dropdown:r(()=>[a(S,null,{default:r(()=>[a(b,null,{default:r(()=>[l("a",{href:P==null?void 0:P.view_url,target:"_blank",rel:"noopener"},d(e.$t("View Product")),9,tC)]),_:2},1024),a(b,null,{default:r(()=>[l("a",{href:P==null?void 0:P.admin_url,target:"_blank",rel:"noopener"},d(e.$t("Edit Product")),9,sC)]),_:2},1024),a(b,{type:"danger",onClick:U=>i.initRemovePaywall(P)},{default:r(()=>[V(d(e.$t("Delete Paywall")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),default:r(()=>[a(m,{"aria-label":e.$t("View actions"),size:"small",class:"fcom_dot_menu",text:""},{default:r(()=>[a(w,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)])]),l("div",oC,[(n(!0),c(F,null,x(P.variants,U=>(n(),c("div",{class:"fcom_section_item",key:U.id},[l("div",iC,[l("div",nC,[l("span",lC,[U.photo?(n(),y(h,{key:0,src:U.photo},null,8,["src"])):(n(),y(h,{key:1},{default:r(()=>[a($)]),_:1}))]),l("span",null,d(U.variation_title),1)])]),l("div",aC,[l("span",{class:"fcom_price",innerHTML:U.total_price},null,8,rC),a(k,{trigger:"click"},{dropdown:r(()=>[a(S,null,{default:r(()=>[a(b,{onClick:D=>i.copyCheckoutUrl(U.checkout_url)},{default:r(()=>[V(d(e.$t("Copy Checkout URL")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),default:r(()=>[a(m,{"aria-label":e.$t("View actions"),size:"small",class:"fcom_dot_menu",text:"",style:{padding:"0 6px"}},{default:r(()=>[a(w,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)])]))),128))])])]))),128)):(n(),c("div",cC,[l("p",null,d(e.$t("No paywall has been added yet")),1)]))],64)):(n(),c("div",dC,[l("div",uC,[l("div",_C,[l("span",null,[V(d(e.$t("To monetize your ")+i.spaceType+", ")+" ",1),W((n(),c("a",{disabled:o.installing,onClick:t[1]||(t[1]=(...P)=>i.installPlugin&&i.installPlugin(...P)),class:"fcom_link"},[V(d(e.$t("click here")),1)],8,mC)),[[T,o.installing]]),V(" "+d(e.$t("to install and activate FluentCart.")),1)])])])]))])])]),_:3})]),_:3}),o.addPaywallModal?(n(),y(L,{key:0,modelValue:o.addPaywallModal,"onUpdate:modelValue":t[2]||(t[2]=P=>o.addPaywallModal=P),spaceProfile:s.spaceProfile,onAdded:i.paywallAdded},null,8,["modelValue","spaceProfile","onAdded"])):_("",!0),a(E,{"modal-class":"fcom_common_dialog","close-on-click-modal":!1,"append-to-body":!0,width:e.drawerWidth,modelValue:o.removePaywallModal,"onUpdate:modelValue":t[5]||(t[5]=P=>o.removePaywallModal=P),direction:"rtl",onClose:t[6]||(t[6]=P=>o.removePaywallModal=!1)},{header:r(()=>[l("div",hC,[l("div",fC,[l("h4",null,d(e.$t("Delete Paywall")),1)])])]),footer:r(()=>[l("div",kC,[a(m,{class:"fcom_primary_button",disabled:o.removing,onClick:i.deletePaywall},{default:r(()=>[V(d(e.$t("Delete")),1)]),_:1},8,["disabled","onClick"]),a(m,{class:"fcom_secondary_button",onClick:t[4]||(t[4]=P=>o.removePaywallModal=!1)},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1})])]),default:r(()=>{var P,U;return[l("div",pC,[l("div",gC,[l("h4",yC,[l("span",vC,[a(h,{src:(P=o.removePaywall)==null?void 0:P.thumbnail},null,8,["src"])]),l("span",null,d((U=o.removePaywall)==null?void 0:U.post_title),1)]),l("p",bC,d(e.$t("Are you sure you want to delete this paywall? This action cannot be undone.")),1),a(M,{class:"fcom_checkbox",modelValue:o.revokeAccess,"onUpdate:modelValue":t[3]||(t[3]=D=>o.revokeAccess=D),"true-value":"yes","false-value":"no"},{default:r(()=>[V(d(e.$t("Also remove the this space from the product integration?")),1)]),_:1},8,["modelValue"])])])]}),_:1},8,["width","modelValue"])],64)}const CC=I(j4,[["render",wC]]),$C={name:"SpaceCustomizer",props:["space_profile"],emits:["close","completed"],components:{SpaceLockscreen:T4,CreateSpaceForm:jt,ManageSpaceLinks:U4,ManagePaywalls:CC},data(){return{saving:!1,currentTab:"general",savingCount:0,hasPro:window.fluentComAdmin.pro}},methods:{saveChanges(){if(!this.hasPro&&this.currentTab=="lock_screen"){this.$notify({title:this.$t("Pro Required"),message:this.$t("This feature is only available in the pro version."),type:"error"});return}this.savingCount=this.savingCount+1}},mounted(){this.$router.push({query:{...this.$route.query,customize_space:1}})},unmounted(){const e={...this.$route.query};delete e.customize_space,this.$router.push({query:e})}},SC={key:0,class:"fcom_full_editor"},VC={class:"fcom_full_editor_header fcom_space_settings_nav"},MC=["aria-label"],LC={class:"fcom_editor_menu object_menu"},TC={class:"fcom_space_menu_ul"},FC={class:"full_editor_actions"},PC={style:{"max-width":"800px",margin:"0 auto"},class:"fcom_full_editor_content"};function IC(e,t,s,u,o,i){const m=p("ArrowLeft"),f=j,h=H,g=qs,w=p("create-space-form"),b=ke,S=Le,k=p("space-lockscreen"),$=p("manage-space-links"),v=p("manage-paywalls"),C=Ye;return s.space_profile?(n(),c("div",SC,[a(C,null,{default:r(()=>[a(g,{class:"fcom_full_editor_header_wrap"},{default:r(()=>{var L;return[l("div",VC,[l("button",{type:"button",onClick:t[0]||(t[0]=M=>e.$emit("completed")),class:"fcom_back_header","aria-label":e.$t("Back to %s",s.space_profile.title)},[a(f,null,{default:r(()=>[a(m)]),_:1}),V(" "+d(s.space_profile.title),1)],8,MC),l("div",LC,[l("ul",TC,[l("li",{onClick:t[1]||(t[1]=M=>o.currentTab="general")},[l("a",{class:R({"router-link-exact-active":o.currentTab==="general"}),href:"#"},d(e.$t("General Settings")),3)]),l("li",{onClick:t[2]||(t[2]=M=>o.currentTab="paywalls")},[l("a",{class:R({"router-link-exact-active":o.currentTab==="paywalls"}),href:"#"},d(e.$t("Paywalls")),3)]),s.space_profile.privacy=="private"&&((L=s.space_profile.settings)==null?void 0:L.custom_lock_screen)=="yes"?(n(),c("li",{key:0,onClick:t[3]||(t[3]=M=>o.currentTab="lock_screen")},[l("a",{class:R({"router-link-exact-active":o.currentTab==="lock_screen"}),href:"#"},d(e.$t("Lock Screen")),3)])):_("",!0),l("li",{onClick:t[4]||(t[4]=M=>o.currentTab="manage_links")},[l("a",{class:R({"router-link-exact-active":o.currentTab==="manage_links"}),href:"#"},d(e.$t("Space Links")),3)])])]),l("div",FC,[a(h,{class:"fcom_primary_button",disabled:o.saving,loading:o.saving,onClick:i.saveChanges},{default:r(()=>[V(d(!o.hasPro&&o.currentTab=="lock_screen"?e.$t("Save Changes (Pro Required)"):e.$t("Save Changes")),1)]),_:1},8,["disabled","loading","onClick"]),a(h,{onClick:t[5]||(t[5]=M=>e.$emit("completed")),text:""},{default:r(()=>[V(" X ")]),_:1})])])]}),_:1}),a(C,{class:"fcom_full_editor_container editor_customizer_container"},{default:r(()=>[o.currentTab=="general"?(n(),y(S,{key:0,class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(b,null,{default:r(()=>[l("div",PC,[a(w,{savingCount:o.savingCount,community:s.space_profile},null,8,["savingCount","community"])])]),_:1})]),_:1})):o.currentTab=="lock_screen"?(n(),y(k,{key:1,savingCount:o.savingCount,onClose:t[6]||(t[6]=L=>e.$emit("close")),spaceProfile:s.space_profile},null,8,["savingCount","spaceProfile"])):o.currentTab=="manage_links"?(n(),y($,{key:2,savingCount:o.savingCount,onClose:t[7]||(t[7]=L=>e.$emit("close")),spaceProfile:s.space_profile},null,8,["savingCount","spaceProfile"])):o.currentTab=="paywalls"?(n(),y(v,{key:3,savingCount:o.savingCount,onClose:t[8]||(t[8]=L=>e.$emit("close")),spaceProfile:s.space_profile},null,8,["savingCount","spaceProfile"])):_("",!0)]),_:1})]),_:1})])):_("",!0)}const EC=I($C,[["render",IC]]),UC={name:"SpaceMenu",emits:["refetch","doSearch"],components:{ImageUploader:xe,SpaceMenuItems:i3,SpaceCustomizer:EC},setup(){return{spaceStore:je()}},props:{space:{type:String,required:!0},space_profile:{required:!1}},data(){return{joining:!1,updating:!1,editLockscreen:!1,search_term:this.$route.query.search||"",SearchIcon:Xt(Ie),customizeSpace:!1,drawerVisible:!1}},computed:{profile(){return this.space_profile?(this.search="",this.space_profile):{title:".......",slug:"..",cover_photo:this.appVars.assets_url+"images/placeholer.png",permissions:{}}},showActions(){return this.profile.id?this.profile.membership||this.isAdmin()?!0:this.isMobile:!1},isMod(){return this.profile.permissions.community_moderator}},methods:{async join(){var e;this.joining=!0;try{const t=await this.spaceStore.joinSpace(this.space,this.space_profile);((e=t.membership)==null?void 0:e.status)==="active"&&!this.appVars.user_membership_slugs.includes(this.space)&&this.appVars.user_membership_slugs.push(this.space),this.$notify.success(t.message),this.$emit("refetch"),this.$eventBus.emit("reloadMenu")}catch(t){this.$handleError(t)}finally{this.joining=!1}},async leave(){try{await this.$confirm(this.$t("Are you sure you want to leave this community?"),this.$t("Leave Space"),{confirmButtonText:this.$t("Leave Space"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}),this.joining=!0;try{await this.spaceStore.leaveSpace(this.space);const e=this.appVars.user_membership_slugs.indexOf(this.space);e!==-1&&this.appVars.user_membership_slugs.splice(e,1),this.$notify.success(this.$t("Successfully left the space")),this.profile.membership=null,this.$emit("refetch"),this.$eventBus.emit("leaveCommunity",this.space),this.$eventBus.emit("reloadMenu")}catch(e){this.$handleError(e)}finally{this.joining=!1}}catch{}},initDeleteSpace(){this.$refs.space_actions.hide(),this.$confirm(this.$t("Are you sure you want to delete this space?"),this.$t("Warning"),{confirmButtonText:this.$t("Yes, Delete the Space"),cancelButtonText:this.$t("No"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.$promt(this.$t("Please Type %s to confirm. Please note, all the posts, comments, activities of this Space will be delete.",'"DELETE"'),this.$t("Delete Space"),{confirmButtonText:this.$t("Confirm Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button"}).then(e=>{e.value==="DELETE"?this.deleteSpace():this.$notify.error(this.$t("The verification string does not match"))})})},deleteSpace(){this.$del("spaces/"+this.space_profile.slug).then(e=>{this.$notify.success(e.message),this.$router.push({name:"all_feeds"}),this.$eventBus.emit("reloadMenu")}).catch(e=>{this.$handleError(e)})},initEdit(){this.customizeSpace=!0},performSearch(){this.$eventBus.emit("doGlobalSearch",this.search_term)}},mounted(){this.$eventBus.on("doGlobalSearch",e=>{this.search_term=e}),this.$route.query.customize_space&&(this.customizeSpace=!0)}},AC={class:"space_header"},BC={class:"object_menu"},DC={key:0,class:"menu_actions"},RC=["href"],xC={class:"actions_items"},HC=l("li",{class:"fcom_li_separator"},null,-1),OC={key:0};function jC(e,t,s,u,o,i){const m=p("space-menu-items"),f=H,h=p("MoreFilled"),g=j,w=ye,b=p("space-customizer"),S=te("loading");return n(),c(F,null,[W((n(),c("div",AC,[l("div",BC,[a(m,{space:s.space,profile:i.profile,class:"fcom_desktop_only"},null,8,["space","profile"]),i.profile.id?(n(),c("div",DC,[e.auth.user_id?i.profile.membership?_("",!0):(n(),y(f,{key:1,disabled:o.joining,loading:o.joining,onClick:t[0]||(t[0]=k=>i.join()),class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Join")),1)]),_:1},8,["disabled","loading"])):(n(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button fcom_join_space_auth"},d(e.$t("Join")),9,RC)),i.showActions?(n(),y(w,{key:2,persistent:!1,ref:"space_actions",placement:"bottom",width:200,"popper-options":{strategy:"fixed"},trigger:"click"},{reference:r(()=>[a(f,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[a(m,{space:s.space,profile:i.profile,class:"fcom_linked_menus fcom_sm_only"},null,8,["space","profile"]),l("ul",xC,[e.hasSpaceAdminAccess(i.profile)?(n(),c(F,{key:0},[l("li",{onClick:t[1]||(t[1]=()=>{i.initEdit(),e.$refs.space_actions.hide()})},d(e.$t("Space Settings")),1),HC],64)):_("",!0),i.profile.membership?(n(),c("li",{key:1,onClick:t[2]||(t[2]=()=>{e.$refs.space_actions.hide(),i.leave()})},d(e.$t("Leave Space")),1)):_("",!0),e.isAdmin()?(n(),c("li",{key:2,onClick:t[3]||(t[3]=(...k)=>i.initDeleteSpace&&i.initDeleteSpace(...k))},d(e.$t("Delete")),1)):_("",!0)])]),_:1},512)):_("",!0)])):_("",!0)])])),[[S,o.updating]]),o.customizeSpace&&s.space_profile?(n(),c("div",OC,[(n(),y(dt,{to:"body"},[a(b,{space_profile:s.space_profile,onClose:t[4]||(t[4]=k=>o.customizeSpace=null),onCompleted:t[5]||(t[5]=k=>{o.customizeSpace=!1,e.$emit("refetch")})},null,8,["space_profile"])]))])):_("",!0)],64)}const Eo=I(UC,[["render",jC]]),NC={name:"AboutSpace",components:{RecentActivities:zt},props:["space_profile","has_permission"],data(){return{privacies:po}}},zC={class:"fcom_main_side_wrap"},qC={role:"region","aria-label":"About Space",class:"app_side_widget widget_recent_activities"},GC={class:"widget_header"},YC={key:0,class:"widget_body"},WC=["innerHTML"],KC={class:"space_meta"},ZC={class:"space_meta_item"},JC={class:"meta_label"},QC={class:"meta_desc"};function XC(e,t,s,u,o,i){var w,b,S;const m=p("Guide"),f=j,h=Z,g=p("recent-activities");return n(),c("div",zC,[l("div",qC,[l("div",GC,[l("h3",null,d(e.$t("About")),1)]),s.space_profile?(n(),c("div",YC,[l("div",{class:"space_description",innerHTML:s.space_profile.description_rendered},null,8,WC),l("div",KC,[l("div",ZC,[l("div",JC,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("span",null,d((w=o.privacies[s.space_profile.privacy])==null?void 0:w.label),1)]),l("div",QC,d((b=o.privacies[s.space_profile.privacy])==null?void 0:b.space_description),1)])])])):(n(),y(h,{key:1,animated:!0}))]),s.space_profile&&s.has_permission?(n(),y(g,{key:0,with_pins:!0,with_pending_count:!0,widget_title:e.$t("Recent Space Activities"),context:{type:"space",space_slug:(S=s.space_profile)==null?void 0:S.slug,space_id:s.space_profile.id}},null,8,["widget_title","context"])):_("",!0)])}const Uo=I(NC,[["render",XC]]),e5={name:"CustomLockscreenView",props:["profile","sections"],components:{LockscreenLessonEditor:Po,LockscreenPaywallView:Io},computed:{lockscreenFields(){var e,t;return(t=(e=this.profile)==null?void 0:e.lockscreen_config.lockScreen)==null?void 0:t.filter(s=>!s.hidden)},buttonLink(){return e=>e.button_link||"javascript:void(0)"},imageStyles(){return e=>({backgroundImage:`url(${e.background_image})`,backgroundColor:e.overlay_color})},headingStyles(){return e=>({color:e.heading_color})},descriptionStyles(){return e=>({color:e.text_color})},buttonStyles(){return e=>({backgroundColor:e.button_color,color:e.button_text_color})}}},t5={class:"fcom_custom_lockscreen"},s5={class:"fcom_lockscreen_content"},o5={class:"fcom_item"},i5={class:"fcom_content"},n5=["href","target"],l5={key:1,class:"fcom_content_wrap"},a5=["innerHTML"],r5={key:2,class:"fcom_content_wrap"},c5={key:3,class:"fcom_content_wrap"},d5={key:4,class:"fcom_paywall_wrap"};function u5(e,t,s,u,o,i){const m=p("welcome-banner"),f=p("lockscreen-lesson-editor"),h=p("lockscreen-paywall-view");return n(),c("div",t5,[l("div",s5,[(n(!0),c(F,null,x(i.lockscreenFields,g=>{var w;return n(),c("div",o5,[g.type=="image"?(n(),c("div",{key:0,class:"fcom_image_wrap",style:re(i.imageStyles(g))},[l("div",i5,[l("h2",{style:re(i.headingStyles(g))},d(g.heading),5),l("p",{style:re(i.descriptionStyles(g))},d(g.description),5),g.button_text?(n(),c("a",{key:0,class:"fcom_btn",href:i.buttonLink(g),style:re(i.buttonStyles(g)),target:g.new_tab=="yes"?"_blank":"_self"},d(g.button_text),13,n5)):_("",!0)])],4)):_("",!0),g.type=="block"&&g.content?(n(),c("div",l5,[l("div",{class:"fcom_custom_editor_html",innerHTML:g.content},null,8,a5)])):_("",!0),g.type=="welcome_banner"&&g.banner?(n(),c("div",r5,[a(m,{config:g.banner,"close-key":"fcom_course_welcome_banner_closed_"+s.profile.id+"_not_enrolled","wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config","close-key"])])):_("",!0),g.type=="lesson"?(n(),c("div",c5,[a(f,{sections:s.sections,settings:s.profile.settings},null,8,["sections","settings"])])):_("",!0),g.type=="paywall"&&((w=g.paywalls)==null?void 0:w.length)>0?(n(),c("div",d5,[a(h,{space_id:s.profile.id,field:g},null,8,["space_id","field"])])):_("",!0)])}),256))])])}const Ao=I(e5,[["render",u5]]),_5={name:"DefaultLockscreenPaywall",components:{ImagePlaceholder:qt},props:{space_id:{type:[String,Number],required:!0}},data(){return{loading:!1,availablePaywalls:[]}},methods:{isSubscriptionPaywall(e){var t;return((t=e.other_info)==null?void 0:t.payment_type)=="subscription"},getRepeatInterval(e){var u;const t=(u=e.other_info)==null?void 0:u.repeat_interval;return{daily:this.$t("day"),weekly:this.$t("week"),monthly:this.$t("month"),quarterly:this.$t("quarter"),half_yearly:this.$t("half year"),yearly:this.$t("year")}[t]||""},fetchAvailablePaywalls(){this.loading=!0,this.$get("cart/spaces/"+this.space_id+"/paywalls",{space_id:this.space_id}).then(e=>{this.availablePaywalls=e.paywalls||[]}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.fetchAvailablePaywalls()}},m5={class:"space_default_lock_box fcom_paywall_cards"},h5={class:"paywall_header"},f5={class:"paywall_body"},p5=["innerHTML"],g5={key:0,class:"subscription"},y5={class:"paywall_footer"},v5={key:0,class:"fcom_mb_10"},b5=["href"];function k5(e,t,s,u,o,i){const m=Z,f=ss,h=p("ImagePlaceholder");return n(),c("div",m5,[o.loading?(n(),y(m,{key:0,rows:3,animated:!0})):(n(!0),c(F,{key:1},x(o.availablePaywalls,g=>(n(),c(F,{key:g.ID},[(n(!0),c(F,null,x(g.variants,w=>(n(),c("div",{key:w.id,class:"fcom_paywall"},[l("div",h5,[w.photo?(n(),y(f,{key:0,src:w.photo},null,8,["src"])):(n(),y(f,{key:1},{default:r(()=>[a(h)]),_:1})),l("span",null,d(w.variation_title),1)]),l("div",f5,[l("span",{innerHTML:w.total_price},null,8,p5),i.isSubscriptionPaywall(w)?(n(),c("span",g5," / "+d(i.getRepeatInterval(w)),1)):_("",!0)]),l("div",y5,[w!=null&&w.description?(n(),c("span",v5,d(g.post_excerpt),1)):_("",!0),l("a",{class:"el-button fcom_primary_button link_button",href:w.checkout_url},d(e.$t("Join Now")),9,b5)])]))),128))],64))),128))])}const Bo=I(_5,[["render",k5]]),w5={name:"LockscreenView",components:{CustomLockscreenView:Ao,DefaultLockscreenPaywall:Bo},props:["space_profile","joining"],emits:["join"],computed:{isDefaultScreen(){return this.space_profile},isNonMember(){var e;return(e=this.space_profile.permissions)==null?void 0:e.is_non_member}},mounted(){var e;(e=this.space_profile.lockscreen_config)!=null&&e.redirect_url&&(window.location.href=this.space_profile.lockscreen_config.redirect_url)}},C5={key:0,style:{margin:"30px","text-align":"center"}},$5={key:0,class:"space_lock_box space_default_lock_box"},S5={class:"space_lock_box space_default_lock_box"},V5={class:"lock_desc"},M5=["href"],L5={key:0,class:"lock_desc"},T5={key:1,class:"lock_desc"},F5=["href"],P5={key:2},I5={key:2,class:"space_lock_box"},E5={class:"lock_desc"},U5=["href"];function A5(e,t,s,u,o,i){var b,S;const m=p("Lock"),f=j,h=H,g=p("default-lockscreen-paywall"),w=p("custom-lockscreen-view");return(b=this.space_profile.lockscreen_config)!=null&&b.redirect_url?(n(),c("h3",C5,d(e.$t("Please wait...")),1)):s.space_profile.lockscreen_config?(n(),c(F,{key:1},[s.space_profile.permissions&&s.space_profile.permissions.is_pending?(n(),c("div",$5,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("Membership Request Under Review")),1)])):s.space_profile.lockscreen_config.showCustom?(n(),c("div",P5,[a(w,{profile:s.space_profile},null,8,["profile"])])):(n(),c(F,{key:1},[l("div",S5,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("This is a private space")),1),s.space_profile.lockscreen_config.canSendRequest?(n(),c(F,{key:0},[l("p",V5,d(e.$t("Please send a join request and an admin will review your join request.")),1),e.auth.user_id?(n(),y(h,{key:0,disabled:s.joining,loading:s.joining,class:"fcom_primary_button",onClick:t[0]||(t[0]=k=>e.$emit("join"))},{default:r(()=>[V(d(e.$t("Request Access")),1)]),_:1},8,["disabled","loading"])):(n(),c("a",{key:1,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login or Signup")),9,M5))],64)):(n(),c(F,{key:1},[s.space_profile.lockscreen_config.showPaywalls?(n(),c("p",L5,d(e.$t("Purchase access below or log in if you are already a member.")),1)):(n(),c("p",T5,d(e.$t("Members have to be invited to this space.")),1)),e.auth.user_id?_("",!0):(n(),c("a",{key:2,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.$t("Login or Signup")),9,F5))],64))]),s.space_profile.lockscreen_config.showPaywalls?(n(),y(g,{key:0,space_id:(S=s.space_profile)==null?void 0:S.id},null,8,["space_id"])):_("",!0)],64))],64)):e.auth.user_id?_("",!0):(n(),c("div",I5,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("Please login/signup to join this community")),1),l("p",E5,d(e.$t("To join the discussion of this community, please login or signup")),1),l("a",{href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,U5)]))}const B5=I(w5,[["render",A5]]),D5={name:"NotFoundResult",props:{title:{type:String,default:""},message:{type:String,default:""},icon:{type:String,default:"error"},actions:{type:Array,default:()=>[]}},computed:{displayActions(){return this.actions.length?this.actions:[{text:this.$t("Go to Home"),class:"fcom_primary_button",action:()=>this.$router.push({name:"all_feeds"})}]}}},R5={class:"fcom_404_container"},x5={class:"fcom_404_content"};function H5(e,t,s,u,o,i){const m=H,f=si;return n(),c("div",R5,[l("div",x5,[a(f,{icon:s.icon,title:s.title},{"sub-title":r(()=>[l("p",null,d(s.message),1)]),extra:r(()=>[Y(e.$slots,"actions",{},()=>[(n(!0),c(F,null,x(i.displayActions,(h,g)=>(n(),y(m,{key:g,class:R(["el-button",h.class]),onClick:w=>h.action&&h.action()},{default:r(()=>[V(d(h.text),1)]),_:2},1032,["class","onClick"]))),128))])]),_:3},8,["icon","title"])])])}const Do=I(D5,[["render",H5]]),O5={name:"SpaceView",components:{NotFoundResult:Do,RenderSpaceLinks:vs,AboutSpace:Uo,Layout:we,AppLayout:Se,SpaceHeader:Zw,RecentActivities:zt,CreateSpaceForm:jt,SpaceMenu:Eo,LockscreenView:B5,SpaceIcon:Ze},setup(){return{spaceStore:je()}},props:["space"],data(){return{search:"",joining:!1,pending_count:0,notFound:!1}},computed:{space_profile(){return this.spaceStore.getCurrentSpace},loading(){return this.spaceStore.isLoading(this.space)},has_permission(){return this.space_profile?!!this.space_profile.permissions.can_view_posts:!1},isDefaultScreen(){var e,t;return((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.custom_lock_screen)=="no"},isCustomLockScreen(){var e;return!!((e=this.space_profile)!=null&&e.lockscreen_config)&&!this.hasSpaceModeratorAccess(this.space_profile)},isNonMember(){var e,t;return(t=(e=this.space_profile)==null?void 0:e.permissions)==null?void 0:t.is_non_member},showSpaceHeader(){var e;return!this.isCustomLockScreen&&this.$route.name=="space_feeds"&&((e=this.space_profile)==null?void 0:e.cover_photo)},notFoundActions(){var e;return(e=this.auth)!=null&&e.username?[]:[{text:this.$t("Log in"),class:"fcom_primary_button",action:()=>{window.location.href=this.getCurrentAuthUrl()}},{text:this.$t("Go to Home"),class:"fcom_secondary_button",action:()=>this.$router.push({name:"all_feeds"})}]},showSideBar(){var e,t;return!this.notFound&&!this.isCustomLockScreen&&this.$route.meta.show_sidebar&&((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.show_sidebar)!="no"},showSpaceMenu(){return!this.notFound&&!this.isCustomLockScreen},showProfileLogo(){return!this.isCustomLockScreen},feedCssClasses(){var s,u;const e=[];e.push(this.showSideBar?"fcom_has_space_sidebar":"fcom_hide_space_sidebar");let t=((u=(s=this.space_profile)==null?void 0:s.settings)==null?void 0:u.layout_style)||"timeline";return e.push("fcom_layout_"+t),e.push("fcom_route_"+this.$route.name),e},wrapperLayoutClasses(){var e;return["fcom_single_layout","fcom_max_layout","fcom_space_"+((e=this.space_profile)==null?void 0:e.slug),"fcom_space_route_"+this.$route.name]}},watch:{space(){this.search="",this.getSpaceProfile()}},methods:{async getSpaceProfile(){this.notFound=!1;try{const e=await this.spaceStore.fetchSpace(this.space);this.auth.spaces[e.slug]=e,e.pending_count!==void 0&&(this.pending_count=e.pending_count),this.changeTitle(e.title)}catch(e){e.xhr_status===404?(this.notFound=!0,this.changeTitle(this.$t("Space Not Found"))):this.$handleError(e)}},async processJoin(){this.joining=!0;try{const e=await this.spaceStore.joinSpace(this.space);this.$notify.success(e.message),await this.getSpaceProfile()}catch(e){this.$handleError(e)}finally{this.joining=!1}},resetRoute(){this.$nextTick(()=>{})}},async mounted(){const e=this.spaceStore.getSpaceBySlug(this.space);e?(this.spaceStore.setCurrentSpace(this.space),this.changeTitle(e.title)):await this.getSpaceProfile()},beforeUnmount(){this.spaceStore.clearCurrentSpace()}},j5={key:0,"aria-label":"Space Links",class:"fcom_sub_header"},N5={class:"space_route"},z5={key:0},q5={key:2,class:"space_holder"},G5={key:3};function Y5(e,t,s,u,o,i){const m=p("Lock"),f=j,h=p("space-icon"),g=p("router-link"),w=p("space-menu"),b=p("render-space-links"),S=p("space-header"),k=Z,$=p("not-found-result"),v=p("lockscreen-view"),C=p("router-view"),L=Le,M=p("AboutSpace"),E=et,T=Ye,P=p("layout"),U=p("app-layout");return n(),y(U,{wrapper_class:i.wrapperLayoutClasses},{default:r(()=>[a(P,{wrapper_class:["no_bg_layout",{custom_lockscreen:i.isCustomLockScreen},"fcom_route_"+e.$route.name],title:"...."},{title:r(()=>[l("h1",{onClick:t[0]||(t[0]=D=>{e.$eventBus.emit("toTop"),i.resetRoute()}),class:"fcom_page_title"},[i.space_profile?(n(),y(g,{key:0,class:"fcom_space_title",to:{name:"space_feeds",params:{space:s.space}}},{default:r(()=>[i.isCustomLockScreen?(n(),y(f,{key:0},{default:r(()=>[a(m)]),_:1})):i.showProfileLogo?(n(),y(h,{key:1,space_profile:i.space_profile},null,8,["space_profile"])):_("",!0),l("span",null,d(i.space_profile.title),1)]),_:1},8,["to"])):_("",!0)])]),actions:r(()=>[i.showSpaceMenu?(n(),y(w,{key:0,space:s.space,space_profile:i.space_profile,onDoSearch:t[1]||(t[1]=D=>{o.search=D}),onRefetch:t[2]||(t[2]=D=>i.getSpaceProfile())},null,8,["space","space_profile"])):_("",!0)]),sub_header:r(()=>{var D,A;return[i.space_profile&&!i.isCustomLockScreen&&((A=(D=i.space_profile)==null?void 0:D.settings)!=null&&A.links.length)?(n(),c("nav",j5,[a(b,{links:i.space_profile.settings.links},null,8,["links"])])):_("",!0)]}),default:r(()=>[i.showSpaceHeader?(n(),y(S,{key:0,onRefetch:t[3]||(t[3]=D=>i.getSpaceProfile()),space:s.space,space_profile:i.space_profile},null,8,["space","space_profile"])):_("",!0),a(T,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(L,{class:"fcom_main"},{default:r(()=>[l("div",{class:R([i.feedCssClasses,"fcom_feed_box"])},[l("div",N5,[i.loading?(n(),c("div",z5,[a(k,{class:"white_loaded",rows:10,animated:!0})])):o.notFound?(n(),y($,{key:1,title:e.$t("Space Not Found"),message:e.$t("The space you are looking for does not exist or has been removed."),actions:i.notFoundActions},null,8,["title","message","actions"])):i.space_profile?(n(),c("div",q5,[i.isCustomLockScreen?(n(),y(v,{key:0,space_profile:i.space_profile,joining:o.joining,onJoin:t[4]||(t[4]=D=>i.processJoin())},null,8,["space_profile","joining"])):_("",!0),i.has_permission?(n(),y(C,{key:s.space,search:o.search,onRefetch:t[5]||(t[5]=D=>i.getSpaceProfile()),space_profile:i.space_profile,space_slug:s.space},null,8,["search","space_profile","space_slug"])):_("",!0)])):(n(),c("div",G5,[l("h4",null,d(e.$t("Sorry! this community could not be loaded")),1)]))])],2)]),_:1}),i.showSideBar?(n(),y(E,{key:0,class:"fcom_resp_side",width:"306px"},{default:r(()=>[a(M,{has_permission:i.has_permission,space_profile:i.space_profile},null,8,["has_permission","space_profile"])]),_:1})):_("",!0)]),_:1})]),_:1},8,["wrapper_class"])]),_:1},8,["wrapper_class"])}const W5=I(O5,[["render",Y5]]),K5={name:"CreateFeed",props:["space_slug","space_profile","space","search"],emits:["refetch"],components:{CreateStatusForm:Rt,Feeds:gt},setup(){return{spaceStore:je()}},data(){return{topic_slug:null}},methods:{setTopic(e){this.topic_slug=e;let t=JSON.parse(JSON.stringify(this.$route.query));e?t.topic=e:delete t.topic,this.$router.push({query:t})},watchTopicUrlChanged(e){this.topic_slug==e||!e||(this.topic_slug=e,this.$nextTick(()=>{window.fcomLayoutRef&&window.fcomLayoutRef.scrollTo({top:0,behavior:"smooth"})}))}},computed:{layout_style(){var e,t;return((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.layout_style)||"timeline"},spaceTopics(){var t,s;const e=this.spaceStore.getSpaceTopics(this.space_slug);return e&&e.length>0?e:cs((t=this.space_profile)==null?void 0:t.topics)?null:((s=this.space_profile)==null?void 0:s.topics)||null}},created(){this.$route.query.topic&&(this.topic_slug=this.$route.query.topic),this.$eventBus.on("topic_changed",this.watchTopicUrlChanged)},beforeUnmount(){this.$eventBus.off("topic_changed",this.watchTopicUrlChanged)}},Z5={key:0,class:"fcom_space_topics"},J5={ref:"fcom_topics_filters",class:"fcom_topics_filters"};function Q5(e,t,s,u,o,i){var g,w,b;const m=H,f=ke,h=p("feeds");return n(),c(F,null,[i.spaceTopics?(n(),c("div",Z5,[a(f,null,{default:r(()=>[l("div",J5,[a(m,{onClick:t[0]||(t[0]=S=>i.setTopic("")),class:R({fcom_active_topic:!o.topic_slug})},{default:r(()=>[V(d(e.$t("All")),1)]),_:1},8,["class"]),(n(!0),c(F,null,x(i.spaceTopics,S=>(n(),y(m,{key:S.slug,onClick:k=>i.setTopic(S.slug),class:R({fcom_active_topic:S.slug==o.topic_slug})},{default:r(()=>[V(d(S.title),1)]),_:2},1032,["onClick","class"]))),128))],512)]),_:1})])):_("",!0),a(h,{feed_name:"space_feed_"+s.space_slug,space:s.space_slug,topic_slug:o.topic_slug,default_search:s.search,layout_style:i.layout_style,can_change_order:((g=s.space_profile.settings)==null?void 0:g.disable_post_sort_by)!=="yes",default_order_by:((w=s.space_profile.settings)==null?void 0:w.default_post_sort_by)||"",can_change_layout:((b=s.space_profile.settings)==null?void 0:b.disable_layout_style)!=="yes",hide_create_form:!s.space_profile.permissions.can_create_post},null,8,["feed_name","space","topic_slug","default_search","layout_style","can_change_order","default_order_by","can_change_layout","hide_create_form"])],64)}const X5=I(K5,[["render",Q5]]),e6={name:"SpaceHomeRedirect",created(){this.$router.replace({name:"space_feeds",params:{space:this.$route.params.space}})}},t6={name:"InviationForm",emits:["completed"],data(){return{saving:!1,inviatation:{email:"",invitee_name:""}}},props:{space_id:{type:Number,default:null},default_value:{type:Object,default:()=>""}},methods:{sendInvitation(){this.saving=!0,this.$post("invitations",{...this.inviatation,space_id:this.space_id}).then(e=>{this.$notify.success(e.message),this.$emit("completed"),this.inviatation={email:"",invitee_name:""}}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},mounted(){this.default_value&&(this.inviatation.email=this.default_value)}},s6={class:"fcom_invitation_form",ref:"inviteForm"};function o6(e,t,s,u,o,i){const m=se,f=ue,h=ht,g=ft,w=H,b=_e,S=te("loading");return n(),c("div",s6,[a(b,{onSubmit:t[2]||(t[2]=z(k=>e.doNothing(),["prevent"])),modelValue:o.inviatation,"onUpdate:modelValue":t[3]||(t[3]=k=>o.inviatation=k),"label-position":"top"},{default:r(()=>[a(g,{gutter:30},{default:r(()=>[a(h,{sm:24,md:12},{default:r(()=>[a(f,{label:e.$t("Invitee email")},{default:r(()=>[a(m,{modelValue:o.inviatation.email,"onUpdate:modelValue":t[0]||(t[0]=k=>o.inviatation.email=k),placeholder:e.$t("Enter invitee email"),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),a(h,{sm:24,md:12},{default:r(()=>[a(f,{label:e.$t("Invitee Name (optional)")},{default:r(()=>[a(m,{modelValue:o.inviatation.invitee_name,"onUpdate:modelValue":t[1]||(t[1]=k=>o.inviatation.invitee_name=k),placeholder:e.$t("Enter invitee Name"),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1}),a(f,null,{default:r(()=>[W((n(),y(w,{disabled:o.saving,class:"fcom_primary_button",onClick:i.sendInvitation},{default:r(()=>[V(d(e.$t("Send Invitation")),1)]),_:1},8,["disabled","onClick"])),[[S,o.saving]])]),_:1})]),_:1},8,["modelValue"])],512)}const i6=I(t6,[["render",o6]]),n6={name:"AddMemberForm",components:{InviationForm:i6},props:["modelValue","space_profile"],emits:["completed"],data(){return{users:[],loading:!1,form:this.modelValue||{user_id:"",role:"",editing_user:null},adding:!1,invite_search:"",showingForm:"addByUser"}},methods:{fetchUsers(e=""){this.loading=!0,this.$get("spaces/users/search",{context:"add_member",search:e,space_id:this.space_profile.id}).then(t=>{this.users=t.users.data}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})},addMember(){if(!this.form.user_id||!this.form.role){this.$notify.error(this.$t("Please select a user and role"));return}this.adding=!0,this.$post("spaces/"+this.space_profile.slug+"/members",{user_id:this.form.user_id,role:this.form.role}).then(e=>{this.$notify.success(e.message),this.$emit("completed"),this.form={user_id:"",role:"",editing_user:null}}).catch(e=>{this.$handleError(e)}).finally(()=>{this.adding=!1})},invitePerson(){const e=this.$refs.invite_member.inputRef.value;if(!e){this.$notify.error(this.$t("Please enter an email address"));return}this.invite_search=e,this.showingForm="addByInvitations"}},mounted(){var e;(e=this.modelValue)!=null&&e.editing_user||this.fetchUsers()}},l6={class:"fcom_select_photo",style:{float:"left"}},a6=["src","alt"],r6={style:{float:"right",color:"#8492a6","font-size":"13px"}},c6={key:1},d6={class:"fcom_spaced_flex"},u6={key:0},_6={key:1},m6={key:1},h6={key:0},f6={key:1};function p6(e,t,s,u,o,i){const m=ne,f=H,h=le,g=ue,w=_e,b=p("InviationForm"),S=te("loading");return o.showingForm=="addByUser"?(n(),y(w,{key:0,onSubmit:t[4]||(t[4]=z(k=>e.doNothing(),["prevent"])),"label-position":"top",modelValue:o.form,"onUpdate:modelValue":t[5]||(t[5]=k=>o.form=k)},{default:r(()=>[o.form.editing_user?(n(),c("p",c6,d(e.$t("Editing manager role for"))+" "+d(o.form.editing_user.display_name),1)):(n(),y(g,{key:0,label:e.$t("Search for an existing user or Invite by Email")},{default:r(()=>[W((n(),y(h,{ref:"invite_member",class:"rich_select","fit-input-width":"",filterable:"",remote:"","remote-method":i.fetchUsers,placeholder:e.$t("Select User"),modelValue:o.form.user_id,"onUpdate:modelValue":t[1]||(t[1]=k=>o.form.user_id=k)},{empty:r(()=>[l("p",null,d(e.$t("No existing users found based on your search.")),1),a(f,{disabled:o.adding,loading:o.adding,type:"success",onClick:t[0]||(t[0]=k=>i.invitePerson())},{default:r(()=>[V(d(e.$t("Send Email Invitation")),1)]),_:1},8,["disabled","loading"])]),default:r(()=>[(n(!0),c(F,null,x(o.users,k=>(n(),y(m,{class:"fcom_with_photo_option",key:k.ID,label:k.display_name+" ("+(k.user_email||k.ID)+")",value:k.ID},{default:r(()=>[l("span",l6,[l("img",{src:k.photo,alt:k.display_name},null,8,a6),l("span",null,d(k.display_name),1)]),l("span",r6,d(k.user_email||k.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["remote-method","placeholder","modelValue"])),[[S,o.loading]])]),_:1},8,["label"])),a(g,{label:e.$t("Membership Role")},{default:r(()=>[a(h,{placeholder:e.$t("Select Role"),modelValue:o.form.role,"onUpdate:modelValue":t[2]||(t[2]=k=>o.form.role=k)},{default:r(()=>[a(m,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(m,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(m,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),Y(e.$slots,"after_form",{},()=>[l("div",d6,[a(f,{class:"fcom_primary_button",loading:o.adding,disabled:o.adding,onClick:t[3]||(t[3]=k=>i.addMember())},{default:r(()=>[o.form.editing_user?(n(),c("span",u6,d(e.$t("Update Role")),1)):(n(),c("span",_6,d(e.$t("Add as %s",o.form.role)),1))]),_:1},8,["loading","disabled"])])])]),_:3},8,["modelValue"])):(n(),c("div",m6,[e.has_pro?(n(),c("div",h6,[a(b,{space_id:s.space_profile.id,default_value:o.invite_search,onCompleted:t[6]||(t[6]=k=>e.$emit("completed"))},null,8,["space_id","default_value"])])):(n(),c("div",f6,[l("p",null,d(e.$t("Member Invitation feature is only available on the Pro version")),1)]))]))}const g6=I(n6,[["render",p6]]),y6={name:"AddMembersForm",components:{SpaceCourseSelector:Nt},props:{context:{type:String,required:!0},target:{type:Object,required:!0}},emits:["completed","membersAdded"],data(){return{sourceMode:"wp_users",wpUsers:[],wpLoading:!1,currentSearch:"",inviting:!1,selectedUserIds:[],role:"member",saving:!1,selectedSourceId:"",selectedSourceType:"",selectedSourceSlug:"",csvRows:[],csvFileName:"",createMissingUsers:!1,sendWelcomeEmailCsv:!1,sendWelcomeEmailCrm:!1,wpUsersLoaded:!1,crmTags:[],crmTagsLoading:!1,crmTagsLoaded:!1,selectedTagId:null,createMissingCrmUsers:!1,batchRunning:!1,batchProgress:0,batchProcessed:0,batchTotal:0,importDone:null}},computed:{isEmail(){return/^\S+@\S+\.\S+$/.test(this.currentSearch)}},watch:{sourceMode(e){e==="wp_users"&&!this.wpUsersLoaded&&this.fetchWpUsers(),e==="crm_tag"&&this.appVars.pro&&!this.crmTagsLoaded&&this.fetchCrmTags()},createMissingUsers(e){e||(this.sendWelcomeEmailCsv=!1)},createMissingCrmUsers(e){e||(this.sendWelcomeEmailCrm=!1)}},methods:{invitingLabel(e){return e?this.$t("Send Invitation to %s",e):this.$t("Send Invitation")},searchWpUsers(e=""){this.currentSearch=(e||"").trim(),!(e&&e.length<2)&&this.fetchWpUsers(e)},fetchWpUsers(e=""){this.wpLoading=!0;const t=this.context==="course",s=t?`admin/courses/${this.target.id}/users/search`:"spaces/users/search",u=t?{search:e}:{context:"add_member",search:e,space_id:this.target.id};this.$get(s,u).then(o=>{this.wpUsers=o.users.data,this.wpUsersLoaded=!0}).catch(o=>{this.$handleError(o)}).finally(()=>{this.wpLoading=!1})},addWpUsers(){if(!this.selectedUserIds.length)return;const e=this.context==="course";if(this.selectedUserIds.length===1){this.saving=!0;const u=e?"admin/courses/"+this.target.id+"/students":"spaces/"+this.target.slug+"/members",o=e?{user_id:this.selectedUserIds[0]}:{user_id:this.selectedUserIds[0],role:this.role};this.$post(u,o).then(i=>{this.$notify.success(i.message),this.$emit("completed")}).catch(i=>{this.$handleError(i)}).finally(()=>{this.saving=!1});return}const t=e?"admin/courses/"+this.target.id+"/students/bulk-add":"spaces/"+this.target.slug+"/members/bulk-add",s=e?{}:{role:this.role};this.runChunkedImport(this.selectedUserIds,u=>({url:t,data:{user_ids:u,...s}}))},inviteToSpace(){if(this.context!=="space")return;const e=this.currentSearch;this.inviting=!0,this.$post("invitations",{email:e,space_id:this.target.id}).then(t=>{this.$notify.success(t.message||this.$t("Invitation sent.")),this.currentSearch="",this.fetchWpUsers("")}).catch(t=>{this.$handleError(t)}).finally(()=>this.inviting=!1)},importFromSource(){if(!this.selectedSourceId){this.$notify.error(this.$t("Please select a source space or course."));return}const e=this.context==="course",t=this.selectedSourceType==="course";if(t&&!parseInt(this.selectedSourceId,10)){this.$notify.error(this.$t("Invalid source course."));return}if(!t&&!this.selectedSourceSlug){this.$notify.error(this.$t("Invalid source space."));return}const s=e?"admin/courses/"+this.target.id+"/students/bulk-add":"spaces/"+this.target.slug+"/members/bulk-add",u=t?{from_course_id:parseInt(this.selectedSourceId,10)}:{from_space_slug:this.selectedSourceSlug};this.runOffsetImport(s,u)},downloadSampleCsv(){this.$exportToCsv([{Name:"John Doe",Email:"john@example.com",Username:"johndoe"},{Name:"Jane Smith",Email:"jane@example.com",Username:"janesmith"},{Name:"Bob Lee",Email:"bob@example.com",Username:"boblee"}],"fcom-bulk-import-sample-"+this.context+".csv")},onCsvFileChange(e){if(e&&e.status&&e.status!=="ready")return;const t=e.raw||e;if(!t)return;this.csvFileName=t.name||"import.csv";const s=new FileReader;s.onload=u=>{this.csvRows=this.parseCsvText(u.target.result.trim()),this.csvRows.length||this.$notify.error(this.$t("No valid rows found. Ensure columns are Name, Email, Username."))},s.readAsText(t)},resetCsvImport(){this.csvRows=[],this.csvFileName=""},splitCsvLine(e){return e.split(/,(?=(?:[^"]*"[^"]*")*[^"]*$)/).map(t=>t.trim().replace(/^"|"$/g,"").replace(/""/g,'"'))},parseCsvText(e){const t=e.split(/\r?\n/).map(b=>b.trim()).filter(Boolean);if(!t.length)return[];const s=this.splitCsvLine(t[0]).map(b=>b.toLowerCase()),u=["name","email","username"],o=s.some(b=>u.includes(b));let i=0,m=1,f=2,h=0;o&&(h=1,i=s.indexOf("name"),m=s.indexOf("email"),f=s.indexOf("username"));const g=new Set,w=[];for(let b=h;b<t.length;b++){const S=this.splitCsvLine(t[b]),k=i>=0&&S[i]||"",$=m>=0?(S[m]||"").toLowerCase():"",v=f>=0&&S[f]||"";!$.includes("@")||g.has($)||(g.add($),w.push({name:k,email:$,username:v}))}return w},importCsv(){if(!this.csvRows.length)return;let e=`spaces/${this.target.slug}/members/bulk-import`;this.context==="course"&&(e=`admin/courses/${this.target.id}/students/bulk-import`);const t=100,s=this.csvRows.length,u={added:0,skipped:0,failed:0};this.batchRunning=!0,this.batchTotal=s,this.batchProcessed=0,this.batchProgress=0;const o=i=>{if(i>=s){this.batchRunning=!1,this.importDone={...u,total:s},this.$emit("membersAdded");return}const m=this.csvRows.slice(i,i+t);this.$post(e,{rows:m,create_missing:this.createMissingUsers,notify_new_users:this.sendWelcomeEmailCsv}).then(f=>{u.added+=f.added||0,u.skipped+=f.skipped||0,u.failed+=f.failed||0;const h=f.processed&&f.processed>0?f.processed:m.length,g=i+h;this.batchProcessed=Math.min(s,g),this.batchProgress=Math.round(this.batchProcessed/s*100),o(g)}).catch(f=>{this.$handleError(f),this.batchRunning=!1,this.importDone={...u,total:s},this.$emit("membersAdded")})};o(0)},fetchCrmTags(){this.crmTagsLoading=!0,this.$get("settings/crm-tagging-config").then(e=>{this.crmTags=e.crm_tags||[],this.crmTagsLoaded=!0}).catch(e=>{this.$handleError(e)}).finally(()=>{this.crmTagsLoading=!1})},addFromCrmTag(){if(!this.selectedTagId)return;const e=this.context==="course",t=e?`admin/courses/${this.target.id}/students/resolve-crm-tag`:`spaces/${this.target.slug}/members/resolve-crm-tag`,s=e?`admin/courses/${this.target.id}/students/bulk-add`:`spaces/${this.target.slug}/members/bulk-add`,u=[];let o=0;this.batchRunning=!0,this.batchTotal=0,this.batchProcessed=0,this.batchProgress=0;const i=()=>{this.batchRunning=!1;const f=u.length+o;this.importDone={added:0,skipped:0,failed:o,total:f},this.$emit("membersAdded")},m=f=>{this.$post(t,{tag_id:this.selectedTagId,create_missing:this.createMissingCrmUsers,notify_new_users:this.sendWelcomeEmailCrm,offset:f,per_page:200}).then(h=>{if(h.user_ids&&h.user_ids.length&&u.push(...h.user_ids),o+=h.failed||0,h.has_more){m(h.next_offset);return}if(!u.length){i();return}this.runChunkedImport(u,g=>({url:s,data:{user_ids:g}}),o)}).catch(h=>{this.$handleError(h),this.batchRunning=!1;const g=u.length+o;this.importDone={added:0,skipped:0,failed:o,total:g},this.$emit("membersAdded")})};m(0)},runChunkedImport(e,t,s=0){const o=e.length,i={added:0,skipped:0,failed:s},m=o+s;this.batchRunning=!0,this.batchTotal=o,this.batchProcessed=0,this.batchProgress=0;const f=h=>{if(h>=o){this.batchRunning=!1,this.importDone={...i,total:m},this.$emit("membersAdded");return}const g=e.slice(h,h+500),{url:w,data:b}=t(g);this.$post(w,b).then(S=>{i.added+=S.added||0,i.skipped+=S.skipped||0,i.failed+=S.failed||0;const k=S.processed&&S.processed>0?S.processed:g.length,$=h+k;this.batchProcessed=Math.min(o,$),this.batchProgress=Math.round(this.batchProcessed/o*100),f($)}).catch(S=>{this.$handleError(S),this.batchRunning=!1,this.importDone={...i,total:m},this.$emit("membersAdded")})};f(0)},runOffsetImport(e,t){const s={added:0,skipped:0,failed:0};this.batchRunning=!0,this.batchTotal=0,this.batchProcessed=0,this.batchProgress=0;const u=o=>{this.$post(e,{...t,offset:o,per_page:500}).then(i=>{s.added+=i.added||0,s.skipped+=i.skipped||0,s.failed+=i.failed||0,i.total&&!this.batchTotal&&(this.batchTotal=i.total),this.batchProcessed=i.next_offset||o+(i.processed||0),this.batchProgress=this.batchTotal?Math.min(99,Math.round(this.batchProcessed/this.batchTotal*100)):50,i.has_more?u(i.next_offset||this.batchProcessed):(this.batchProgress=100,this.batchRunning=!1,this.importDone={...s,total:this.batchTotal||s.added+s.skipped+s.failed},this.$emit("membersAdded"))}).catch(i=>{this.$handleError(i),this.batchRunning=!1,this.importDone={...s,total:this.batchTotal||s.added+s.skipped+s.failed},this.$emit("membersAdded")})};u(0)}},mounted(){this.sourceMode==="wp_users"&&!this.wpUsersLoaded&&this.fetchWpUsers()}},v6={class:"fcom_add_members_form"},b6={key:0,class:"fcom_source_selector_wrap fcom_mb_20"},k6={key:1,class:"fcom_import_done"},w6=l("div",{class:"fcom_done_icon_wrap"},[l("div",{class:"fcom_done_circle"},[l("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[l("path",{d:"M4 10l4.5 4.5L16 6",stroke:"white","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round"})])])],-1),C6={class:"fcom_done_title"},$6={class:"fcom_done_subtitle"},S6={class:"fcom_import_summary"},V6={class:"fcom_import_summary_title"},M6={class:"fcom_import_summary_row"},L6={class:"fcom_import_summary_row"},T6={key:0,class:"fcom_import_summary_row"},F6={key:1,class:"fcom_import_summary_row"},P6={key:2,class:"fcom_import_progress_wrap"},I6={class:"fcom_help_text fcom_mb_15"},E6={key:0,class:"fcom_muted_text fcom_mt_10"},U6={class:"fcom_select_photo",style:{float:"left"}},A6=["src","alt"],B6={style:{float:"right",color:"#8492a6","font-size":"13px"}},D6={style:{padding:"4px","text-align":"center"}},R6={style:{margin:"0 0 8px"}},x6={key:0},H6={key:1},O6={key:2},j6={key:1,style:{margin:"4px 0 0","font-size":"12px"}},N6={key:0,class:"fcom_help_text fcom_mb_10"},z6=["href"],q6={class:"fcom_help_text fcom_mb_15"},G6={key:0},Y6={key:2},W6={class:"fcom_spaced_flex fcom_mb_10"},K6=l("span",null,null,-1),Z6={class:"fcom_csv_drop_inner"},J6=l("div",{class:"fcom_csv_drop_arrow"},"↑",-1),Q6={class:"el-upload__text fcom_mt_10"},X6={key:0},e$={class:"el-upload__tip"},t$={class:"fcom_spaced_flex fcom_mb_10"},s$={class:"fcom_muted_text",style:{"margin-left":"8px"}},o$={key:0,class:"fcom_muted_text fcom_mb_10"},i$=["aria-label"],n$={class:"fcom_help_text fcom_mb_15"},l$=["aria-label"],a$={class:"fcom_help_text fcom_mb_15"},r$={key:0};function c$(e,t,s,u,o,i){const m=Ne,f=ve,h=os,g=ne,w=H,b=le,S=ue,k=_e,$=p("SpaceCourseSelector"),v=mt,C=is,L=ns,M=he,E=te("loading");return n(),c("div",v6,[!o.batchRunning&&!o.importDone?(n(),c("div",b6,[a(f,{modelValue:o.sourceMode,"onUpdate:modelValue":t[0]||(t[0]=T=>o.sourceMode=T),size:"small"},{default:r(()=>[a(m,{value:"wp_users"},{default:r(()=>[V(d(e.$t("WP Users")),1)]),_:1}),a(m,{value:"from_source"},{default:r(()=>[V(d(e.$t("From Space/Course")),1)]),_:1}),a(m,{value:"csv"},{default:r(()=>[V(d(e.$t("CSV Import")),1)]),_:1}),e.appVars.has_fluentcrm?(n(),y(m,{key:0,value:"crm_tag"},{default:r(()=>[V(d(e.$t("CRM Tag")),1)]),_:1})):_("",!0)]),_:1},8,["modelValue"])])):_("",!0),o.importDone?(n(),c("div",k6,[w6,l("h3",C6,d(e.$t("All Done!")),1),l("p",$6,d(e.$t("Import has been completed. You may close this now.")),1),l("div",S6,[l("strong",V6,d(e.$t("Import Summary")),1),l("p",M6,d(e.$t("Total Records:"))+" "+d(o.importDone.total),1),l("p",L6,d(s.context==="course"?e.$t("Enrolled:"):e.$t("Added:"))+" "+d(o.importDone.added),1),o.importDone.skipped?(n(),c("p",T6,d(e.$t("Skipped:"))+" "+d(o.importDone.skipped),1)):_("",!0),o.importDone.failed?(n(),c("p",F6,d(e.$t("Failed:"))+" "+d(o.importDone.failed),1)):_("",!0)])])):o.batchRunning?(n(),c("div",P6,[l("div",I6,[l("p",null,d(e.$t("Importing… Please do not close this window.")),1)]),a(h,{percentage:o.batchProgress,"stroke-width":12},null,8,["percentage"]),o.batchTotal?(n(),c("p",E6,d(o.batchProcessed)+" / "+d(o.batchTotal)+" "+d(e.$t("processed")),1)):_("",!0)])):(n(),c(F,{key:3},[o.sourceMode==="wp_users"?(n(),y(k,{key:0,onSubmit:t[5]||(t[5]=z(()=>{},["prevent"])),"label-position":"top"},{default:r(()=>[a(S,{label:e.$t("Users")},{default:r(()=>[a(b,{class:"rich_select","fit-input-width":"",multiple:"",filterable:"",remote:"","default-first-option":"","reserve-keyword":!1,loading:o.wpLoading,"remote-method":i.searchWpUsers,placeholder:e.$t("Search and select users"),modelValue:o.selectedUserIds,"onUpdate:modelValue":t[2]||(t[2]=T=>o.selectedUserIds=T)},{empty:r(()=>[l("div",D6,[l("p",R6,[i.isEmail?(n(),c("span",x6,[V(d(e.$t("User not registered:"))+" ",1),l("strong",null,d(o.currentSearch),1)])):o.currentSearch?(n(),c("span",H6,d(e.$t("No matching user found.")),1)):(n(),c("span",O6,d(e.$t("No data")),1))]),s.context==="space"?(n(),c(F,{key:0},[i.isEmail?(n(),y(w,{key:0,size:"small",class:"fcom_primary_button",loading:o.inviting,disabled:o.inviting,"aria-label":i.invitingLabel(o.currentSearch),onClick:t[1]||(t[1]=T=>i.inviteToSpace())},{default:r(()=>[V(d(e.$t("Send Email Invitation")),1)]),_:1},8,["loading","disabled","aria-label"])):o.currentSearch?(n(),c("p",j6,d(e.$t("Type a valid email to invite.")),1)):_("",!0)],64)):_("",!0)])]),default:r(()=>[(n(!0),c(F,null,x(o.wpUsers,T=>(n(),y(g,{class:"fcom_with_photo_option",key:T.ID,label:`${T.display_name} (${T.user_email||T.ID})`,value:T.ID},{default:r(()=>[l("span",U6,[l("img",{src:T.photo,alt:T.display_name},null,8,A6),l("span",null,d(T.display_name),1)]),l("span",B6,d(T.user_email||T.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["loading","remote-method","placeholder","modelValue"])]),_:1},8,["label"]),s.context==="space"?(n(),y(S,{key:0,label:e.$t("Membership Role")},{default:r(()=>[a(b,{modelValue:o.role,"onUpdate:modelValue":t[3]||(t[3]=T=>o.role=T),placeholder:e.$t("Select Role")},{default:r(()=>[a(g,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(g,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(g,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(S,null,{default:r(()=>[o.selectedUserIds.length>1&&!e.appVars.pro?(n(),c("div",N6,[l("p",null,[V(d(e.$t("Bulk adding requires FluentCommunity Pro."))+" ",1),e.appVars.upgrade_url?(n(),c("a",{key:0,href:e.$upgradeUrl("feature_lock_bulk_add_members"),target:"_blank"},d(e.$t("Upgrade")),9,z6)):_("",!0)])])):_("",!0),W((n(),y(w,{class:"fcom_primary_button",onClick:t[4]||(t[4]=T=>i.addWpUsers())},{default:r(()=>[V(d(s.context==="course"?e.$t("Add Students"):e.$t("Add as %s",o.role)),1)]),_:1})),[[E,o.saving]])]),_:1})]),_:1})):o.sourceMode==="from_source"?(n(),y(k,{key:1,"label-position":"top"},{default:r(()=>[a(S,{label:e.$t("Select Source Space or Course")},{default:r(()=>[a($,{modelValue:o.selectedSourceId,"onUpdate:modelValue":t[6]||(t[6]=T=>o.selectedSourceId=T),placeholder_text:e.$t("Select a space or course..."),memberships:[s.target.id.toString()],onSelectedType:t[7]||(t[7]=T=>o.selectedSourceType=T),onSelectedSlug:t[8]||(t[8]=T=>o.selectedSourceSlug=T)},null,8,["modelValue","placeholder_text","memberships"])]),_:1},8,["label"]),l("div",q6,[l("p",null,d(s.context==="course"?e.$t("All users will be enrolled as Student."):e.$t("All users will be added as Member.")),1)]),a(w,{class:"fcom_primary_button",onClick:t[9]||(t[9]=T=>i.importFromSource())},{default:r(()=>[V(d(s.context==="course"?e.$t("Import Students"):e.$t("Import Members"))+" ",1),e.appVars.pro?_("",!0):(n(),c("span",G6,"  ("+d(e.$t("Pro"))+")",1))]),_:1})]),_:1})):o.sourceMode==="csv"?(n(),c("div",Y6,[o.csvRows.length?(n(),c(F,{key:1},[l("div",t$,[l("div",null,[l("strong",null,d(o.csvFileName),1),l("span",s$,d(o.csvRows.length)+" "+d(e.$t("contacts")),1)]),a(w,{link:"",size:"small",onClick:t[11]||(t[11]=T=>i.resetCsvImport())},{default:r(()=>[V(d(e.$t("Change")),1)]),_:1})]),a(L,{data:o.csvRows.slice(0,5),size:"small",class:"fcom_mb_10"},{default:r(()=>[a(C,{prop:"name",label:e.$t("Name"),"min-width":"120"},null,8,["label"]),a(C,{prop:"email",label:e.$t("Email"),"min-width":"160"},null,8,["label"]),a(C,{prop:"username",label:e.$t("Username"),"min-width":"110"},null,8,["label"])]),_:1},8,["data"]),o.csvRows.length>5?(n(),c("p",o$," + "+d(o.csvRows.length-5)+" "+d(e.$t("more rows")),1)):_("",!0),a(k,{"label-position":"top"},{default:r(()=>[a(S,null,{default:r(()=>[l("div",{role:"group","aria-label":e.$t("Create WordPress accounts for new email addresses")},[l("div",null,[a(M,{modelValue:o.createMissingUsers,"onUpdate:modelValue":t[12]||(t[12]=T=>o.createMissingUsers=T),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Create WordPress accounts for new email addresses")),1)]),_:1},8,["modelValue"])]),l("div",null,[W(a(M,{modelValue:o.sendWelcomeEmailCsv,"onUpdate:modelValue":t[13]||(t[13]=T=>o.sendWelcomeEmailCsv=T),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Send default WordPress welcome email for new users")),1)]),_:1},8,["modelValue"]),[[kt,o.createMissingUsers]])])],8,i$)]),_:1}),l("div",n$,[l("p",null,d(s.context==="course"?e.$t("All contacts with this tag will be enrolled as Student."):e.$t("All contacts with this tag will be added as Member.")),1)]),a(S,null,{default:r(()=>[a(w,{class:"fcom_primary_button",onClick:t[14]||(t[14]=T=>i.importCsv())},{default:r(()=>[V(d(s.context==="course"?e.$t("Import Students"):e.$t("Import Members")),1)]),_:1})]),_:1})]),_:1})],64)):(n(),c(F,{key:0},[l("div",W6,[K6,e.appVars.pro?(n(),y(w,{key:0,link:"",size:"small",onClick:t[10]||(t[10]=T=>i.downloadSampleCsv())},{default:r(()=>[V("↓ "+d(e.$t("Sample CSV")),1)]),_:1})):_("",!0)]),a(v,{drag:"",accept:".csv,.txt","auto-upload":!1,"show-file-list":!1,"on-change":i.onCsvFileChange,disabled:!e.appVars.pro},{tip:r(()=>[l("div",e$,d(e.$t("Columns: Name, Email, Username")),1)]),default:r(()=>[l("div",Z6,[J6,l("div",Q6,[V(d(e.$t("Drop CSV here or"))+" ",1),l("em",null,d(e.$t("click to browse")),1),V(),e.appVars.pro?_("",!0):(n(),c("span",X6,"  ("+d(e.$t("Pro"))+")",1))])])]),_:1},8,["on-change","disabled"])],64))])):o.sourceMode==="crm_tag"?(n(),y(k,{key:3,"label-position":"top"},{default:r(()=>[a(S,{label:e.$t("FluentCRM Tag")},{default:r(()=>[a(b,{modelValue:o.selectedTagId,"onUpdate:modelValue":t[15]||(t[15]=T=>o.selectedTagId=T),loading:o.crmTagsLoading,placeholder:e.$t("Select a tag"),style:{width:"100%"}},{default:r(()=>[(n(!0),c(F,null,x(o.crmTags,T=>(n(),y(g,{key:T.id,label:T.title,value:T.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"])]),_:1},8,["label"]),a(S,null,{default:r(()=>[l("div",{role:"group","aria-label":e.$t("Create WordPress accounts for contacts without an existing account")},[l("div",null,[a(M,{modelValue:o.createMissingCrmUsers,"onUpdate:modelValue":t[16]||(t[16]=T=>o.createMissingCrmUsers=T),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Create WordPress accounts for contacts without an existing account")),1)]),_:1},8,["modelValue"])]),l("div",null,[W(a(M,{modelValue:o.sendWelcomeEmailCrm,"onUpdate:modelValue":t[17]||(t[17]=T=>o.sendWelcomeEmailCrm=T),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Send default WordPress welcome email for new users")),1)]),_:1},8,["modelValue"]),[[kt,o.createMissingCrmUsers]])])],8,l$)]),_:1}),l("div",a$,[l("p",null,d(s.context==="course"?e.$t("All contacts with this tag will be enrolled as Student."):e.$t("All contacts with this tag will be added as Member.")),1)]),a(w,{class:"fcom_primary_button",onClick:t[18]||(t[18]=T=>i.addFromCrmTag())},{default:r(()=>[V(d(s.context==="course"?e.$t("Add Students"):e.$t("Add Members")),1),e.appVars.pro?_("",!0):(n(),c("span",r$,"  ("+d(e.$t("Pro"))+")",1))]),_:1})]),_:1})):_("",!0)],64))])}const d$=I(y6,[["render",c$]]),u$={name:"SortDirIcon",props:{dir:{type:String,default:"desc"}},computed:{arrowPath(){return this.dir==="asc"?"M12 12.5 V4 M10 6 L12 4 L14 6":"M12 3.5 V12 M10 10 L12 12 L14 10"}}},_$={viewBox:"0 0 16 16",width:"1em",height:"1em",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},m$=l("line",{x1:"2.5",y1:"4",x2:"8.5",y2:"4"},null,-1),h$=l("line",{x1:"2.5",y1:"8",x2:"6.5",y2:"8"},null,-1),f$=l("line",{x1:"2.5",y1:"12",x2:"4.5",y2:"12"},null,-1),p$=["d"];function g$(e,t,s,u,o,i){return n(),c("svg",_$,[m$,h$,f$,l("path",{d:i.arrowPath},null,8,p$)])}const y$=I(u$,[["render",g$]]);let v$=0;const b$={name:"SortControl",components:{SortDirIcon:y$},emits:["update:field","update:dir","change"],props:{field:{type:String,required:!0},dir:{type:String,default:"desc",validator:e=>["asc","desc"].includes(e)},options:{type:Array,required:!0}},data(){const e=++v$;return{sortLabelId:"fcom_sort_by_"+e,orderLabelId:"fcom_sort_order_"+e}},computed:{currentLabel(){const e=this.options.find(t=>t.value===this.field);return e?e.label:""},ariaLabel(){const e=this.dir==="asc"?this.$t("Ascending"):this.$t("Descending");return this.$t("Sort by")+": "+this.currentLabel+", "+e}},methods:{selectField(e){e.value!==this.field&&(this.$emit("update:field",e.value),this.$emit("update:dir",e.defaultDir||"asc"),this.$emit("change"))},selectDir(e){e!==this.dir&&(this.$emit("update:dir",e),this.$emit("change"))}}},k$={class:"fcom_feed_filter_icon"},w$={class:"fcom_feed_filter_value"},C$={role:"presentation",class:"fcom_feed_filter_group"},$$=["id"],S$=["aria-labelledby"],V$={role:"presentation",class:"fcom_feed_filter_group"},M$=["id"],L$=["aria-labelledby"],T$={class:"fcom_sort_option"},F$={class:"fcom_sort_option"};function P$(e,t,s,u,o,i){const m=p("SortDirIcon"),f=p("ArrowDown"),h=j,g=H,w=ze,b=qe,S=Ge;return n(),y(S,{class:"fcom_feed_filter_dropdown","popper-class":"fcom_feed_filter_pop",trigger:"click",placement:"bottom-end","hide-on-click":!1},{dropdown:r(()=>[a(b,{class:"fcom_feed_filter_menu"},{default:r(()=>[l("li",C$,[l("span",{id:o.sortLabelId,class:"fcom_feed_filter_group_label"},d(e.$t("Sort by")),9,$$),l("ul",{role:"group","aria-labelledby":o.sortLabelId,class:"fcom_feed_filter_group_list"},[(n(!0),c(F,null,x(s.options,k=>(n(),y(w,{key:k.value,role:"menuitemradio","aria-checked":s.field===k.value,"aria-current":s.field===k.value?"true":void 0,class:R({fcom_feed_filter_selected:s.field===k.value}),onClick:$=>i.selectField(k)},{default:r(()=>[V(d(k.label),1)]),_:2},1032,["aria-checked","aria-current","class","onClick"]))),128))],8,S$)]),l("li",V$,[l("span",{id:o.orderLabelId,class:"fcom_feed_filter_group_label fcom_feed_filter_group_divided"},d(e.$t("Order")),9,M$),l("ul",{role:"group","aria-labelledby":o.orderLabelId,class:"fcom_feed_filter_group_list"},[a(w,{role:"menuitemradio","aria-checked":s.dir==="asc","aria-current":s.dir==="asc"?"true":void 0,class:R({fcom_feed_filter_selected:s.dir==="asc"}),onClick:t[0]||(t[0]=k=>i.selectDir("asc"))},{default:r(()=>[l("span",T$,[a(m,{dir:"asc"}),V(d(e.$t("Ascending")),1)])]),_:1},8,["aria-checked","aria-current","class"]),a(w,{role:"menuitemradio","aria-checked":s.dir==="desc","aria-current":s.dir==="desc"?"true":void 0,class:R({fcom_feed_filter_selected:s.dir==="desc"}),onClick:t[1]||(t[1]=k=>i.selectDir("desc"))},{default:r(()=>[l("span",F$,[a(m,{dir:"desc"}),V(d(e.$t("Descending")),1)])]),_:1},8,["aria-checked","aria-current","class"])],8,L$)])]),_:1})]),default:r(()=>[a(g,{text:"",class:"fcom_feed_filter_trigger","aria-label":i.ariaLabel},{default:r(()=>[l("span",k$,[a(m,{dir:s.dir},null,8,["dir"])]),l("span",w$,d(i.currentLabel),1),a(h,{class:"fcom_feed_filter_caret"},{default:r(()=>[a(f)]),_:1})]),_:1},8,["aria-label"])]),_:1})}const Ro=I(b$,[["render",P$]]),I$={name:"SpaceMembers",props:["space","space_profile"],components:{Search:Ie,Pagination:$e,FollowAction:it,AddMemberForm:g6,AddMembersForm:d$,SortControl:Ro,ActionPopover:Ke,Drawer:ps},setup(){return{uiStore:Ft()}},inheritAttrs:!1,data(){return{members:[],loading:!1,pagination:{page:1,per_page:20,total:0},status:"active",sort_by:"created_at",sort_dir:"asc",pending_count:0,workingIds:[],addingNewMember:!1,addingMember:!1,editing_member:{user_id:"",role:"member"},search:"",permission_failed:!1,memberLayout:this.appVars.features.member_list_layout||"classic"}},computed:{sortOptions(){return[{value:"last_activity",label:this.$t("Last Activity"),defaultDir:"desc"},{value:"display_name",label:this.$t("Display Name"),defaultDir:"asc"},{value:"created_at",label:this.$t("Joining Date"),defaultDir:"desc"}]}},methods:{onSortChange(){this.uiStore.setListSort("space-members",this.sort_by,this.sort_dir),this.toSearch()},restoreSortPreference(){const e=this.uiStore.getListSort("space-members");e&&this.sortOptions.some(t=>t.value===e.field)&&(this.sort_by=e.field,this.sort_dir=e.dir==="asc"?"asc":"desc")},handleBulkMemberAdded(){this.fetch(),this.addingNewMember=!1},handleMemberUpdated(){this.fetch(),this.addingMember=!1},fetch(){this.loading=!0,this.$get("spaces/"+this.space+"/members",{page:this.pagination.page,per_page:this.pagination.per_page,status:this.status,search:this.search,sort_by:this.sort_by,sort_dir:this.sort_dir}).then(e=>{this.members=e.members.data,this.pagination.total=e.members.total,e.pending_count&&(this.pending_count=e.pending_count),this.pagination.page!=1&&this.$nextTick(()=>{this.$refs.space_members&&this.$refs.space_members.scrollIntoView({behavior:"smooth"})}),e.current_user_follows&&this.setFollowIds(e.current_user_follows)}).catch(e=>{e.permission_failed?this.permission_failed=!0:this.$handleError(e)}).finally(()=>{this.loading=!1})},removeMemberPrompt(e,t){this.$confirm(this.$t("Are you sure you want to remove this member from this community?"),this.$t("Remove Member?"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"error"}).then(()=>{this.removeMember(e,t)})},removeMember(e,t){this.workingIds.push(e.user_id),this.$post("spaces/"+this.space+"/members/remove",{user_id:e.user_id}).then(s=>{this.$notify.success(s.message);const u=this.members.indexOf(e);u>-1&&this.members.splice(u,1),this.members.length||this.fetch()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.workingIds=this.workingIds.filter(s=>s!==e.user_id)})},approveMember(e,t=null){this.workingIds.push(e.user_id),this.$post("spaces/"+this.space+"/members",{user_id:e.user_id}).then(s=>{if(this.$notify.success(s.message),t===null){this.fetch();return}const u=this.members.indexOf(e);u>-1&&this.members.splice(u,1),this.members.length||this.fetch()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.workingIds=this.workingIds.filter(s=>s!==e.user_id)})},initAddMember(e){this.editing_member=e?{user_id:e.user_id,role:e.role,editing_user:e.xprofile}:{user_id:"",role:"member"},this.addingMember=!0},handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetch()}},mounted(){this.$route.query.view_pending&&(this.status="pending"),this.restoreSortPreference(),this.fetch()}},E$={ref:"space_members"},U$={key:0,class:"card_header"},A$={class:"member_status"},B$={class:"add_member"},D$={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},R$={class:"permission_failed"},x$=["href"],H$={key:2},O$={class:"search_member fcom_mb_20"},j$={key:0,class:"feed_filters"},N$=l("div",{class:"fcom_feed_divider"},null,-1),z$={class:"card_list"},q$={class:"card_content"},G$={class:"card_avatar"},Y$={class:"card_info"},W$={class:"card_name"},K$={class:"info_header"},Z$={class:"meta_line"},J$={key:0,class:"card_headline"},Q$={class:"feed_meta_info"},X$=["title"],eS=["title"],tS=["title"],sS={key:1,class:"card_description"},oS=l("div",{class:"card_break"},null,-1),iS={class:"card_footer"},nS={class:"card_action"},lS={class:"pagination_wrap"},aS={key:0,class:"loading"},rS={key:1,class:"no_members"};function cS(e,t,s,u,o,i){const m=Ne,f=ve,h=H,g=p("Search"),w=j,b=se,S=p("SortControl"),k=p("UserAvatar"),$=p("UserRouteLink"),v=Ee,C=p("FollowAction"),L=p("action-popover"),M=p("Pagination"),E=Z,T=p("add-members-form"),P=p("drawer"),U=p("add-member-form"),D=te("loading");return n(),c(F,null,[l("div",E$,null,512),e.hasSpaceAdminAccess(s.space_profile)?(n(),c("div",U$,[l("div",A$,[o.pending_count?(n(),y(f,{key:0,onChange:i.toSearch,modelValue:o.status,"onUpdate:modelValue":t[0]||(t[0]=A=>o.status=A),class:"status_group"},{default:r(()=>[a(m,{value:"active"},{default:r(()=>[V(d(e.$t("Active")),1)]),_:1}),a(m,{value:"pending"},{default:r(()=>[V(d(e.$t("Pending"))+" ("+d(o.pending_count)+")",1)]),_:1})]),_:1},8,["onChange","modelValue"])):_("",!0)]),l("div",B$,[a(h,{class:"fcom_primary_button",onClick:t[1]||(t[1]=A=>o.addingNewMember=!0)},{default:r(()=>[V(d(e.$t("Add Member")),1)]),_:1}),a(h,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=A=>e.$router.push({name:"space_invitations"}))},{default:r(()=>[V(d(e.$t("Invitations")),1)]),_:1})])])):_("",!0),o.permission_failed?(n(),c("div",D$,[l("div",R$,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view all members")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:s.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,x$)])])):(n(),c("div",H$,[l("div",O$,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:oe(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[3]||(t[3]=A=>o.search=A),placeholder:e.$t("Search...")},{prefix:r(()=>[a(w,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),o.status!="pending"?(n(),c("div",j$,[N$,a(S,{field:o.sort_by,"onUpdate:field":t[4]||(t[4]=A=>o.sort_by=A),dir:o.sort_dir,"onUpdate:dir":t[5]||(t[5]=A=>o.sort_dir=A),options:i.sortOptions,onChange:i.onSortChange},null,8,["field","dir","options","onChange"])])):_("",!0),l("div",{class:R(["fcom_dir_layout_"+o.memberLayout,"space_members fcom_dir_layout"])},[W((n(),c("div",z$,[(n(!0),c(F,null,x(o.members,(A,q)=>{var O,N,G,ae,B;return W((n(),c("div",{key:A.id,class:"each_card"},[l("div",q$,[l("div",G$,[a(k,{xprofile:A.xprofile,is_online:e.isOnline(A.xprofile.last_activity)},null,8,["xprofile","is_online"])]),l("div",Y$,[l("div",W$,[l("div",K$,[a($,{xprofile:A.xprofile,show_badge:!0,show_follow:!0},null,8,["xprofile"]),l("div",Z$,"@"+d((O=A.xprofile)==null?void 0:O.username),1)]),(G=(N=A.xprofile)==null?void 0:N.meta)!=null&&G.headline?(n(),c("div",J$,d(A.xprofile.meta.headline),1)):_("",!0),l("div",Q$,[o.status!="pending"&&A.created_at?(n(),c("div",{key:0,title:A.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(A.created_at))),9,X$)):A.created_at?(n(),c("div",{key:1,title:A.created_at,class:"meta_line"},d(e.$t("Requested %s",e.humanDateDiff(A.created_at))),9,eS)):_("",!0),A.xprofile.last_activity?(n(),c("div",{key:2,title:A.xprofile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(A.xprofile.last_activity))),9,tS)):_("",!0)]),(ae=A.xprofile)!=null&&ae.short_description?(n(),c("div",sS,d(e.getExcerpt(((B=A.xprofile.meta)==null?void 0:B.short_description_rendered)||A.xprofile.short_description,120)),1)):_("",!0),A.role!="member"?(n(),y(v,{key:2,type:"success"},{default:r(()=>[V(d(e.$labelize(A.role)),1)]),_:2},1024)):_("",!0)]),o.status=="pending"?(n(),c(F,{key:0},[oS,l("div",iS,[a(h,{class:"fcom_primary_button",onClick:X=>i.approveMember(A,q)},{default:r(()=>[V(d(e.$t("Approve")),1)]),_:2},1032,["onClick"]),a(h,{class:"fcom_secondary_button",onClick:X=>i.removeMember(A,q)},{default:r(()=>[V(d(e.$t("Decline")),1)]),_:2},1032,["onClick"])])],64)):_("",!0)])]),l("div",nS,[a(C,{profile:A.xprofile},null,8,["profile"]),o.status!="pending"&&s.space_profile&&e.hasInPermission("can_remove_member",s.space_profile.permissions)?(n(),y(L,{key:0,placement:"bottom",width:200,items:[{label:e.$t("Remove Member"),action:()=>{i.removeMemberPrompt(A,q)}},{label:e.$t("Change Membership"),action:()=>{i.initAddMember(A)}}]},null,8,["items"])):_("",!0)])])),[[D,o.workingIds.includes(A.user_id)]])}),128))])),[[D,o.loading]]),l("div",lS,[a(M,{hide_on_single:!0,onFetch:t[6]||(t[6]=A=>i.fetch()),pagination:o.pagination},null,8,["pagination"])]),o.loading&&!o.pagination.total?(n(),c("div",aS,[a(E,{class:"white_loaded",rows:3,animated:!0}),a(E,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):!o.loading&&!o.members.length?(n(),c("div",rS,d(e.$t("No %s members found in this community.",o.status)),1)):_("",!0)],2)])),o.addingNewMember?(n(),y(P,{key:3,modelValue:o.addingNewMember,"onUpdate:modelValue":t[8]||(t[8]=A=>o.addingNewMember=A),size:e.drawerWidth,"append-to-body":!0,title:e.$t("Add Member")},{default:r(()=>[o.addingNewMember?(n(),y(T,{key:0,context:"space",target:s.space_profile,onCompleted:i.handleBulkMemberAdded,onMembersAdded:t[7]||(t[7]=A=>i.fetch())},null,8,["target","onCompleted"])):_("",!0)]),_:1},8,["modelValue","size","title"])):_("",!0),o.addingMember?(n(),y(P,{key:4,modelValue:o.addingMember,"onUpdate:modelValue":t[10]||(t[10]=A=>o.addingMember=A),size:e.drawerWidth,"append-to-body":!0,"close-on-click-modal":!0,title:o.editing_member.editing_user?e.$t("Update Role"):e.$t("Add Member")},{default:r(()=>[o.addingMember?(n(),y(U,{key:0,space_profile:s.space_profile,modelValue:o.editing_member,"onUpdate:modelValue":t[9]||(t[9]=A=>o.editing_member=A),onCompleted:i.handleMemberUpdated},null,8,["space_profile","modelValue","onCompleted"])):_("",!0)]),_:1},8,["modelValue","size","title"])):_("",!0)],64)}const dS=I(I$,[["render",cS]]);const uS={name:"DocumentUploadForm",components:{CreateStatusForm:Rt},props:["space_profile"],emits:["refetch"],data(){return{post:{title:"",content_type:"document",message:"",media_image:"",topic_ids:[],status:"published",document_ids:[]},post_status:"published"}},watch:{"post.content_type"(){this.post.content_type="document"}},methods:{handleFilesChanged(e){this.post.document_ids=e,this.$refs.createStatusForm.feed.document_ids=e},resetForm(){this.post={title:"",content_type:"document",message:"",media_image:"",topic_ids:[],status:"unlisted",document_ids:[]},this.$emit("refetch")}}},_S={class:"fcom_document_upload_form"};function mS(e,t,s,u,o,i){const m=he,f=p("CreateStatusForm");return n(),c("div",_S,[a(f,{ref:"createStatusForm",default_placeholder:e.$t("About these files"),initial_placeholder:e.$t("Upload new"),btn_text:e.$t("Upload Files"),editing_feed:o.post,"default-state":"active",disableUpload:!0,space:s.space_profile.slug,onAdded:i.resetForm},{before_submit_btn:r(()=>[a(m,{onChange:t[0]||(t[0]=h=>{e.$refs.createStatusForm.feed.status=h}),"true-value":"published","false-value":"unlisted",modelValue:o.post_status,"onUpdate:modelValue":t[1]||(t[1]=h=>o.post_status=h),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Publish as a post")),1)]),_:1},8,["modelValue"])]),_:1},8,["default_placeholder","initial_placeholder","btn_text","editing_feed","space","onAdded"])])}const hS=I(uS,[["render",mS]]),fS={name:"DocumentFeedCard",components:{ChatIcon:tt,HeartIcon:st,DocumentLists:ot,UserRouteLink:Pe},props:["feed"],computed:{can_manage(){return this.canEditFeed(this.feed)}}},pS={class:"fcom_document_feed_card feed"},gS={class:"feed_header"},yS={key:0,class:"feed_user"},vS={class:"feed_user_name"},bS={class:"feed_title"},kS={class:"feed_title_heading"},wS=["href"],CS={class:"feed_meta_info"},$S=["href"],SS=["title"],VS=["href"],MS={style:{"margin-left":"5px","margin-right":"7px"}},LS=["href"],TS={style:{"margin-left":"5px"}},FS={class:"feed_body"};function PS(e,t,s,u,o,i){var w,b,S,k,$;const m=p("ChatIcon"),f=j,h=p("HeartIcon"),g=p("DocumentLists");return n(),c("div",pS,[l("div",gS,[s.feed.xprofile?(n(),c("div",yS,[l("div",vS,[l("div",bS,[l("h2",kS,[l("a",{href:s.feed.permalink},d(s.feed.title||e.$t("Uploaded %s files",((b=(w=s.feed.meta)==null?void 0:w.document_lists)==null?void 0:b.length)||"--")),9,wS)])])]),l("div",CS,[l("a",{onClick:t[0]||(t[0]=(...v)=>e.gotoFeed&&e.gotoFeed(...v)),href:s.feed.permalink,class:"feed_timestamp"},[l("span",{title:s.feed.created_at,style:{padding:"0 7px 0 0"}},d(e.humanDateDiff(s.feed.created_at))+" "+d(e.$t("by %s",(S=s.feed.xprofile)==null?void 0:S.display_name)),9,SS)],8,$S),s.feed.comments_count?(n(),c("a",{key:0,onClick:t[1]||(t[1]=(...v)=>e.gotoFeed&&e.gotoFeed(...v)),href:s.feed.permalink,class:"feed_timestamp"},[a(f,{style:{"margin-left":"7px"}},{default:r(()=>[a(m)]),_:1}),l("span",MS,d(s.feed.comments_count),1)],8,VS)):_("",!0),s.feed.reactions_count?(n(),c("a",{key:1,onClick:t[2]||(t[2]=(...v)=>e.gotoFeed&&e.gotoFeed(...v)),href:s.feed.permalink,class:"feed_timestamp"},[a(f,{style:{"margin-left":"7px"}},{default:r(()=>[a(h,{filled:!0})]),_:1}),l("span",TS,d(s.feed.reactions_count),1)],8,LS)):_("",!0)])])):_("",!0)]),l("div",FS,[a(g,{document_lists:($=(k=s.feed)==null?void 0:k.meta)==null?void 0:$.document_lists,allow_rename:i.can_manage,additional_data:{space_id:s.feed.space_id}},null,8,["document_lists","allow_rename","additional_data"])])])}const IS=I(fS,[["render",PS]]);const ES={name:"SpaceDocuments",props:["space","space_profile"],components:{FeedListItem:wo,Feed:nt,DocumentUploadForm:hS,UploadFilled:Mt,Search:Ie,Pagination:$e,DocumentFeedCard:IS},emits:["refetch"],inheritAttrs:!1,data(){return{documents:[],loading:!1,pagination:{page:1,per_page:20,total:0},working:!1,search:"",SearchIcon:Xt(Ie),permission_failed:!1,show_uploader:!1}},computed:{visibleDocuments(){return this.documents.filter(e=>{var t,s;return(s=(t=e==null?void 0:e.meta)==null?void 0:t.document_lists)==null?void 0:s.length})}},methods:{fetch(e=!1){this.loading=!0,this.$get("documents",{page:this.pagination.page,per_page:this.pagination.per_page,space_id:this.space_profile.id,search:this.search}).then(t=>{e?this.documents=this.documents.concat(t.documents.data):this.documents=t.documents.data,this.pagination.total=t.documents.total,this.pagination.last_page=t.documents.last_page}).catch(t=>{t.permission_failed?this.permission_failed=!0:this.$handleError(t)}).finally(()=>{this.loading=!1})},handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetch()},handleLoadMore(e){var i;if(this.pagination.last_page==this.pagination.page)return;let t=document.querySelector(".all_documents_wrap .feed_outer:last-child");if(!t)return;let s=t.getBoundingClientRect(),u=(i=window.fcomLayoutRef)==null?void 0:i.wrapRef;!u||s.bottom-u.getBoundingClientRect().bottom-s.height>100||this.loading||(this.loading=!0,this.pagination.page++,this.fetch(!0))}},mounted(){this.has_pro?(this.fetch(),document.addEventListener("fcom_layout_scroll",this.handleLoadMore)):this.permission_failed=!0,this.changeTitle(this.$t("Documents and Files in %s",this.space_profile.title))},beforeUnmount(){document.removeEventListener("fcom_layout_scroll",this.handleLoadMore)}},US={ref:"space_docs"},AS={class:"card_header"},BS={class:"member_status"},DS={key:0,class:"add_member"},RS={key:0},xS={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},HS={class:"permission_failed"},OS=["href"],jS={key:2},NS={class:"search_member"},zS={class:""},qS={class:"card_list"},GS={class:"all_documents_wrap"},YS={key:0,style:{"margin-top":"20px","text-align":"center"}},WS={key:1,class:"loading"},KS={key:2,class:"no_members"};function ZS(e,t,s,u,o,i){var $,v;const m=p("UploadFilled"),f=j,h=H,g=p("document-upload-form"),w=p("Search"),b=se,S=p("document-feed-card"),k=Z;return n(),c(F,null,[l("div",US,null,512),l("div",AS,[l("div",BS,[l("h3",null,d(e.$t("Documents and Files")),1)]),(v=($=s.space_profile)==null?void 0:$.permissions)!=null&&v.can_upload_documents?(n(),c("div",DS,[o.show_uploader?(n(),y(h,{key:1,plain:"",onClick:t[1]||(t[1]=C=>o.show_uploader=!1),size:"small"},{default:r(()=>[l("span",null,d(e.$t("Cancel")),1)]),_:1})):(n(),y(h,{key:0,onClick:t[0]||(t[0]=C=>o.show_uploader=!0),class:"fcom_primary_button"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1}),l("span",null,d(e.$t("New Documents")),1)]),_:1}))])):_("",!0)]),o.show_uploader?(n(),c("div",RS,[a(g,{onRefetch:t[2]||(t[2]=()=>{i.toSearch(),o.show_uploader=!1}),space_profile:s.space_profile,reload:i.toSearch},null,8,["space_profile","reload"])])):_("",!0),o.permission_failed?(n(),c("div",xS,[l("div",HS,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view this page")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:s.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,OS)])])):(n(),c("div",jS,[l("div",NS,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:oe(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[3]||(t[3]=C=>o.search=C),placeholder:e.$t("Search...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",zS,[l("div",qS,[l("div",GS,[(n(!0),c(F,null,x(i.visibleDocuments,C=>(n(),c("div",{key:C.id,class:"feed_outer"},[a(S,{feed:C},null,8,["feed"])]))),128))])]),!o.loading&&o.pagination.last_page!=o.pagination.page?(n(),c("div",YS,[a(h,{class:"fcom_secondary_button",disabled:o.loading,onClick:t[4]||(t[4]=C=>{o.pagination.page++,i.fetch(!0)})},{default:r(()=>[V(d(e.$t("Load more")),1)]),_:1},8,["disabled"])])):_("",!0),o.loading?(n(),c("div",WS,[a(k,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5})])):!o.loading&&!i.visibleDocuments.length?(n(),c("div",KS,d(e.$t("No documents found in this space based on your search criteria.")),1)):_("",!0)])]))],64)}const JS=I(ES,[["render",ZS]]),QS={name:"LightboxMeta",components:{TopRight:ui},props:{author:{type:Object,default:null},authorHref:{type:String,default:""},postDate:{type:String,default:""},permalink:{type:String,default:null}}},XS={class:"fcom_space_media_meta_group"},e7={key:0,class:"fcom_space_media_author_chip"},t7=["src","alt"],s7={class:"fcom_space_media_author_chip_text"},o7=["href"],i7={key:1,class:"fcom_space_media_author_chip_name"},n7={key:2,class:"fcom_space_media_author_chip_date"},l7=["href"];function a7(e,t,s,u,o,i){const m=Ue,f=p("TopRight"),h=j;return n(),c("div",XS,[s.author?(n(),c("div",e7,[s.author.avatar?(n(),c("img",{key:0,src:s.author.avatar,alt:s.author.name||"",class:"fcom_space_media_author_chip_avatar"},null,8,t7)):_("",!0),l("div",s7,[s.authorHref?(n(),y(m,{key:0,content:e.$t("View Profile"),placement:"top","show-after":200},{default:r(()=>[l("a",{href:s.authorHref,class:"fcom_space_media_author_chip_name fcom_space_media_author_chip_link"},d(s.author.name||e.$t("Member")),9,o7)]),_:1},8,["content"])):(n(),c("span",i7,d(s.author.name||e.$t("Member")),1)),s.postDate?(n(),c("span",n7,d(s.postDate),1)):_("",!0)])])):_("",!0),s.permalink?(n(),c("a",{key:1,href:s.permalink,class:"fcom_space_media_viewpost_btn"},[l("span",null,d(e.$t("View post")),1),a(h,{class:"fcom_space_media_viewpost_icon"},{default:r(()=>[a(f)]),_:1})],8,l7)):_("",!0)])}const r7=I(QS,[["render",a7]]),Ae=1,Ps=5,c7=.2,d7=50,Is=6,u7={data(){return{imageScale:Ae,imageOffsetX:0,imageOffsetY:0,isPanning:!1,panStartX:0,panStartY:0,panOriginX:0,panOriginY:0,touchMoved:!1}},computed:{canZoomOut(){return this.imageScale>Ae},canZoomIn(){return this.imageScale<Ps},canResetZoom(){return this.imageScale!==Ae||this.imageOffsetX!==0||this.imageOffsetY!==0},imageTransformStyle(){return{transform:`translate(${this.imageOffsetX}px, ${this.imageOffsetY}px) scale(${this.imageScale})`,transition:this.isPanning?"none":"transform 0.15s ease-out"}}},created(){this.boundPanMove=this.onImagePanMove.bind(this),this.boundPanEnd=this.onImagePanEnd.bind(this),this.boundWheelHandler=this.handleWheel.bind(this),this.touchValid=!1},methods:{resetImageZoom(){this.imageScale=Ae,this.imageOffsetX=0,this.imageOffsetY=0,this.stopPan()},stepZoom(e){const t=Math.min(Ps,Math.max(Ae,this.imageScale+e*c7));t!==this.imageScale&&(this.imageScale=Number(t.toFixed(2)),this.imageScale<=Ae&&(this.imageOffsetX=0,this.imageOffsetY=0))},toggleImageZoom(){this.imageScale>Ae?this.resetImageZoom():this.imageScale=2},handleWheel(e){this.currentKind==="image"&&(e.preventDefault(),this.stepZoom(e.deltaY<0?1:-1),this.showChrome())},syncWheelListener(){this.detachWheel(),this.modelValue&&this.currentKind==="image"&&document.addEventListener("wheel",this.boundWheelHandler,{passive:!1})},detachWheel(){document.removeEventListener("wheel",this.boundWheelHandler,{passive:!1})},anchorPan(e,t){this.panStartX=e,this.panStartY=t,this.panOriginX=this.imageOffsetX,this.panOriginY=this.imageOffsetY},movePan(e,t){this.imageOffsetX=this.panOriginX+(e-this.panStartX),this.imageOffsetY=this.panOriginY+(t-this.panStartY)},onImagePanStart(e){this.canZoomOut&&(this.isPanning=!0,this.anchorPan(e.clientX,e.clientY),document.addEventListener("mousemove",this.boundPanMove),document.addEventListener("mouseup",this.boundPanEnd))},onImagePanMove(e){this.isPanning&&this.movePan(e.clientX,e.clientY)},onImagePanEnd(){this.stopPan()},stopPan(){this.isPanning=!1,document.removeEventListener("mousemove",this.boundPanMove),document.removeEventListener("mouseup",this.boundPanEnd)},onImageTouchStart(e){if(e.touches.length!==1){this.touchValid=!1,this.isPanning=!1;return}const t=e.touches[0];this.touchValid=!0,this.anchorPan(t.clientX,t.clientY),this.touchMoved=!1,this.isPanning=this.imageScale>Ae,this.showChrome()},onImageTouchMove(e){if(!this.touchValid||e.touches.length!==1)return;const t=e.touches[0];(Math.abs(t.clientX-this.panStartX)>Is||Math.abs(t.clientY-this.panStartY)>Is)&&(this.touchMoved=!0),this.isPanning&&this.movePan(t.clientX,t.clientY)},onImageTouchEnd(e){if(!this.touchValid){this.isPanning=!1;return}if(this.isPanning){this.isPanning=!1;return}if(!this.touchMoved)return;const t=e.changedTouches[0],s=(t?t.clientX:this.panStartX)-this.panStartX,u=(t?t.clientY:this.panStartY)-this.panStartY;Math.abs(s)>d7&&Math.abs(s)>Math.abs(u)&&(s<0?this.next():this.prev())}}},_7={name:"MediaLightbox",mixins:[u7],components:{FluentPlayerPreview:Pt,LightboxMeta:r7,Close:rs,ArrowLeftBold:Ks,ArrowRightBold:_i},props:{modelValue:{type:Boolean,default:!1},items:{type:Array,default:()=>[]},initialIndex:{type:Number,default:0}},emits:["update:modelValue"],data(){return{currentIndex:0,fluentPlayerFailed:!1,chromeVisible:!0}},computed:{dialogOpen:{get(){return this.modelValue},set(e){this.$emit("update:modelValue",e)}},currentItem(){return this.items[this.currentIndex]||null},currentKind(){var e;return((e=this.currentItem)==null?void 0:e.kind)||null},currentMediaUrl(){var e;return((e=this.currentItem)==null?void 0:e.url)||null},hasFluentPlayer(){var e,t,s,u,o;return!!((t=(e=this.appVars)==null?void 0:e.features)!=null&&t.has_fluent_player&&((o=(u=(s=this.appVars)==null?void 0:s.features)==null?void 0:u.fluent_player)!=null&&o.enable))},playerMedia(){var s,u,o;const e=this.currentItem;if(!e||e.kind!=="video"&&e.kind!=="audio")return null;const t=e.settings&&typeof e.settings=="object"?{...e.settings}:{};return t.src||(t.src=e.url),{media_id:e.id,type:"fluent_player",provider:"upload",url:e.url,settings:t,feed_id:((s=e.feed)==null?void 0:s.id)||"",share_url:((u=e.feed)==null?void 0:u.permalink)||"",title:t.title||((o=e.feed)==null?void 0:o.title)||""}},author(){var e,t;return((t=(e=this.currentItem)==null?void 0:e.feed)==null?void 0:t.author)||null},authorProfileHref(){var t;const e=(t=this.author)==null?void 0:t.username;return!e||!this.$getRouteLink?"":this.$getRouteLink("u/:username",{username:e})},postDate(){var t,s,u,o,i,m;const e=((u=(s=(t=this.currentItem)==null?void 0:t.feed)==null?void 0:s.created_at)==null?void 0:u.date)||((i=(o=this.currentItem)==null?void 0:o.feed)==null?void 0:i.created_at)||((m=this.currentItem)==null?void 0:m.created_at);return e?this.humanDateDiff(e):""},safePermalink(){var t,s;const e=(s=(t=this.currentItem)==null?void 0:t.feed)==null?void 0:s.permalink;if(!e)return null;try{const u=new URL(e,window.location.origin);return u.protocol==="http:"||u.protocol==="https:"?e:null}catch{return null}},metaProps(){return{author:this.author,authorHref:this.authorProfileHref,postDate:this.postDate,permalink:this.safePermalink}},zoomButtons(){return[{label:this.$t("Zoom out"),icon:mi,disabled:!this.canZoomOut,action:()=>this.stepZoom(-1)},{label:this.$t("Zoom in"),icon:hi,disabled:!this.canZoomIn,action:()=>this.stepZoom(1)},{label:this.$t("Reset zoom"),icon:Qs,disabled:!this.canResetZoom,action:this.resetImageZoom}]},hasNav(){return this.items.length>1},hasPrev(){return this.hasNav&&this.currentIndex>0},hasNext(){return this.hasNav&&this.currentIndex<this.items.length-1},imageAlt(){var t,s;const e=this.currentItem;return e?(t=e.feed)!=null&&t.title?e.feed.title:(s=this.author)!=null&&s.name?this.$t("Photo by %s",this.author.name):this.$t("Photo %1$s of %2$s",this.currentIndex+1,this.items.length):this.$t("Media")},lightboxWidth(){return{image:"96vw",audio:"min(90vw, 720px)"}[this.currentKind]||"min(90vw, 1100px)"},dialogAriaLabel(){const e={image:"Photo viewer",video:"Video viewer",audio:"Audio viewer"};return this.$t(e[this.currentKind]||"Media viewer")},srAnnounce(){return!this.currentItem||this.items.length<=1?"":this.$t("Item %1$s of %2$s",this.currentIndex+1,this.items.length)}},watch:{modelValue(e){e&&(this.currentIndex=this.initialIndex,this.fluentPlayerFailed=!1,this.resetImageZoom())},currentKind(){this.syncWheelListener()}},created(){this.boundKeydownHandler=this.handleKeydown.bind(this),this.boundMouseMoveHandler=this.onPointerReveal.bind(this),this.boundFocusInHandler=this.showChrome.bind(this),this.chromeIdleTimer=null,this._lastReveal=0},methods:{onOpened(){this.detachDocListeners(),document.addEventListener("keydown",this.boundKeydownHandler),document.addEventListener("mousemove",this.boundMouseMoveHandler),document.addEventListener("focusin",this.boundFocusInHandler),this.syncWheelListener(),this.showChrome()},onClosed(){this.detachDocListeners(),this.stopPan(),this.resetImageZoom(),this.fluentPlayerFailed=!1,this.clearChromeTimer(),this.chromeVisible=!0},detachDocListeners(){document.removeEventListener("keydown",this.boundKeydownHandler),this.detachWheel(),document.removeEventListener("mousemove",this.boundMouseMoveHandler),document.removeEventListener("focusin",this.boundFocusInHandler)},showChrome(){this.chromeVisible=!0,this.scheduleChromeHide()},scheduleChromeHide(){clearTimeout(this.chromeIdleTimer),this.chromeIdleTimer=setTimeout(()=>{const e=document.activeElement,t=e&&typeof e.closest=="function"&&e.closest(".fcom_space_media_video_close, .fcom_space_media_video_nav, .fcom_space_media_lightbox_icon, .fcom_space_media_viewpost_btn, .fcom_space_media_author_chip_link");!this.isPanning&&!t&&(this.chromeVisible=!1)},2e3)},clearChromeTimer(){clearTimeout(this.chromeIdleTimer),this.chromeIdleTimer=null},onPointerReveal(){const e=Date.now();e-this._lastReveal<200||(this._lastReveal=e,this.showChrome())},handleKeydown(e){if(!this.modelValue||e.key!=="ArrowLeft"&&e.key!=="ArrowRight")return;const t=e.target;t&&typeof t.closest=="function"&&t.closest('audio, video, media-player, input, textarea, [contenteditable="true"]')||(e.key==="ArrowLeft"?this.prev():this.next())},goTo(e){const t=this.currentIndex+e;t<0||t>this.items.length-1||(this.stopActiveVideo(),this.fluentPlayerFailed=!1,this.resetImageZoom(),this.currentIndex=t,this.showChrome())},prev(){this.goTo(-1)},next(){this.goTo(1)},requestClose(){this.dialogOpen=!1},stopActiveVideo(){const e=this.$refs.mediaBody;e&&e.querySelectorAll("video, audio, media-player").forEach(t=>{try{t.muted=!0,typeof t.pause=="function"&&t.pause()}catch{}})},handleBeforeClose(e){this.stopActiveVideo(),e()}},beforeUnmount(){this.detachDocListeners(),this.stopPan(),this.clearChromeTimer()}},m7=["aria-label"],h7=["aria-label"],f7=["aria-label"],p7={class:"fcom_media_sr_only","aria-live":"polite"},g7=["src","alt"],y7=["src","aria-label"],v7=["src","aria-label"],b7={key:0,class:"fcom_space_media_meta_bar"},k7={key:1,class:"fcom_space_media_image_controls"},w7={class:"fcom_space_media_zoom_bar"},C7=["aria-label","disabled","onClick"];function $7(e,t,s,u,o,i){const m=p("Close"),f=j,h=p("ArrowLeftBold"),g=p("ArrowRightBold"),w=p("fluent-player-preview"),b=p("lightbox-meta"),S=be;return n(),y(S,{modelValue:i.dialogOpen,"onUpdate:modelValue":t[12]||(t[12]=k=>i.dialogOpen=k),width:i.lightboxWidth,"show-close":!1,"align-center":"","destroy-on-close":"","before-close":i.handleBeforeClose,"aria-label":i.dialogAriaLabel,class:R(["fcom_space_media_lightbox","fcom_space_media_video_dialog",{fcom_space_media_lightbox_image:i.currentKind==="image",fcom_chrome_hidden:!o.chromeVisible,fcom_space_media_panning:e.isPanning}]),onOpened:i.onOpened,onClosed:i.onClosed},{default:r(()=>{var k,$,v,C,L,M,E,T;return[l("button",{type:"button",class:"fcom_space_media_lightbox_icon fcom_space_media_video_close","aria-label":e.$t("Close"),onClick:t[0]||(t[0]=(...P)=>i.requestClose&&i.requestClose(...P))},[a(f,null,{default:r(()=>[a(m)]),_:1})],8,m7),i.hasPrev?(n(),c("button",{key:0,type:"button",class:"fcom_space_media_video_nav fcom_space_media_video_nav_prev","aria-label":e.$t("Previous"),onClick:t[1]||(t[1]=(...P)=>i.prev&&i.prev(...P))},[a(f,null,{default:r(()=>[a(h)]),_:1})],8,h7)):_("",!0),i.hasNext?(n(),c("button",{key:1,type:"button",class:"fcom_space_media_video_nav fcom_space_media_video_nav_next","aria-label":e.$t("Next"),onClick:t[2]||(t[2]=(...P)=>i.next&&i.next(...P))},[a(f,null,{default:r(()=>[a(g)]),_:1})],8,f7)):_("",!0),l("div",{class:"fcom_space_media_video_stage",onClick:t[11]||(t[11]=z((...P)=>i.requestClose&&i.requestClose(...P),["self"]))},[l("p",p7,d(i.srAnnounce),1),l("div",{ref:"mediaBody",class:R(["fcom_space_media_video_body",{fcom_space_media_zoomed:e.imageScale>1,fcom_space_media_body_image:i.currentKind==="image",fcom_space_media_body_audio:i.currentKind==="audio"}]),onClick:t[10]||(t[10]=z((...P)=>i.requestClose&&i.requestClose(...P),["self"]))},[i.currentKind==="image"?(n(),c("img",{key:0,src:i.currentItem.url,alt:i.imageAlt,draggable:"false",style:re(e.imageTransformStyle),class:R({fcom_space_media_dragging:e.isPanning}),onMousedown:t[3]||(t[3]=z((...P)=>e.onImagePanStart&&e.onImagePanStart(...P),["prevent"])),onTouchstart:t[4]||(t[4]=(...P)=>e.onImageTouchStart&&e.onImageTouchStart(...P)),onTouchmove:t[5]||(t[5]=z((...P)=>e.onImageTouchMove&&e.onImageTouchMove(...P),["prevent"])),onTouchend:t[6]||(t[6]=(...P)=>e.onImageTouchEnd&&e.onImageTouchEnd(...P)),onTouchcancel:t[7]||(t[7]=(...P)=>e.onImageTouchEnd&&e.onImageTouchEnd(...P)),onDblclick:t[8]||(t[8]=(...P)=>e.toggleImageZoom&&e.toggleImageZoom(...P))},null,46,g7)):i.currentKind==="video"||i.currentKind==="audio"?(n(),c(F,{key:1},[i.playerMedia&&i.hasFluentPlayer&&!o.fluentPlayerFailed?(n(),y(w,{key:i.playerMedia.media_id,media:i.playerMedia,onLoadFailed:t[9]||(t[9]=P=>o.fluentPlayerFailed=!0)},null,8,["media"])):i.currentKind==="video"&&i.currentMediaUrl?(n(),c("video",{key:1,src:i.currentMediaUrl,"aria-label":(($=(k=i.currentItem)==null?void 0:k.settings)==null?void 0:$.title)||((C=(v=i.currentItem)==null?void 0:v.feed)==null?void 0:C.title)||e.$t("Video"),controls:"",autoplay:"",playsinline:""},null,8,y7)):i.currentKind==="audio"&&i.currentMediaUrl?(n(),c("audio",{key:2,src:i.currentMediaUrl,"aria-label":((M=(L=i.currentItem)==null?void 0:L.settings)==null?void 0:M.title)||((T=(E=i.currentItem)==null?void 0:E.feed)==null?void 0:T.title)||e.$t("Audio"),controls:""},null,8,v7)):_("",!0)],64)):_("",!0)],2),i.currentKind==="video"||i.currentKind==="audio"?(n(),c("div",b7,[a(b,Cs($s(i.metaProps)),null,16)])):_("",!0),i.currentItem&&i.currentKind==="image"?(n(),c("div",k7,[a(b,Cs($s(i.metaProps)),null,16),l("div",w7,[(n(!0),c(F,null,x(i.zoomButtons,P=>(n(),c("button",{key:P.label,type:"button",class:"fcom_space_media_lightbox_icon","aria-label":P.label,disabled:P.disabled,onClick:P.action},[a(f,null,{default:r(()=>[(n(),y(wt(P.icon)))]),_:2},1024)],8,C7))),128))])])):_("",!0)])]}),_:1},8,["modelValue","width","before-close","aria-label","class","onOpened","onClosed"])}const S7=I(_7,[["render",$7]]),xo={data(){return{feedLoadingId:null}},methods:{feedRoute(e){var u,o,i;const t=(u=e.feed)==null?void 0:u.slug,s=((i=(o=e.feed)==null?void 0:o.space)==null?void 0:i.slug)||this.spaceSlug;return s?{name:"space_feed",params:{feed_slug:t,space:s}}:{name:"single_feed",params:{feed_slug:t}}},feedHref(e){var t;if((t=e.feed)!=null&&t.slug)return this.$router.resolve(this.feedRoute(e)).href},openFeed(e,t){var u;const s=(u=e.feed)==null?void 0:u.slug;if(s&&!(t&&(t.metaKey||t.ctrlKey))){if(!this.hasFeature("show_post_modal")){t&&t.preventDefault(),this.$router.push(this.feedRoute(e));return}t&&t.preventDefault(),this.feedLoadingId!==e.feed.id&&(this.feedLoadingId=e.feed.id,this.$get("feeds/"+s+"/by-slug").then(o=>{o!=null&&o.feed&&this.$eventBus.emit("showFeedModal",{feed:o.feed})}).catch(o=>{this.$handleError&&this.$handleError(o)}).finally(()=>{this.feedLoadingId=null}))}}}},V7={name:"MediaAudioList",components:{FluentPlayerPreview:Pt,ExpandIcon:ys},mixins:[xo],props:{items:{type:Array,default:()=>[]},spaceSlug:{type:String,default:""}},data(){return{visibleIds:{},failedIds:{},reloadKey:0}},computed:{hasFluentPlayer(){var e,t,s,u,o;return!!((t=(e=this.appVars)==null?void 0:e.features)!=null&&t.has_fluent_player&&((o=(u=(s=this.appVars)==null?void 0:s.features)==null?void 0:u.fluent_player)!=null&&o.enable))}},methods:{observeRow(e){!e||this.visibleIds[e.dataset.id]||(this._io?this._io.observe(e):this.visibleIds[e.dataset.id]=!0)},onRowVisible(e){e.forEach(t=>{t.isIntersecting&&(this.visibleIds[t.target.dataset.id]=!0,this._io.unobserve(t.target))})},playerMediaFor(e){var u,o,i;if(this._playerMediaCache[e.id])return this._playerMediaCache[e.id];const t=e.settings&&typeof e.settings=="object"?{...e.settings}:{};t.src||(t.src=e.url);const s={media_id:e.id,type:"fluent_player",provider:"upload",url:e.url,settings:t,feed_id:((u=e.feed)==null?void 0:u.id)||"",share_url:((o=e.feed)==null?void 0:o.permalink)||"",title:t.title||((i=e.feed)==null?void 0:i.title)||""};return this._playerMediaCache[e.id]=s,s}},created(){this._playerMediaCache={},typeof IntersectionObserver<"u"&&(this._io=new IntersectionObserver(this.onRowVisible,{rootMargin:"200px"}))},beforeUnmount(){this._io&&(this._io.disconnect(),this._io=null)},activated(){this._activatedOnce&&this.reloadKey++,this._activatedOnce=!0},deactivated(){var e,t;(t=(e=this.$el)==null?void 0:e.querySelectorAll)==null||t.call(e,"audio, video, media-player").forEach(s=>{try{typeof s.pause=="function"&&s.pause()}catch{}})}},M7={class:"fcom_space_media_audio_list all_media_holder"},L7=["data-id"],T7=["href","aria-label","onClick"],F7={key:1,class:"fcom_audio_row_placeholder","aria-hidden":"true"},P7=["src","aria-label"];function I7(e,t,s,u,o,i){const m=p("ExpandIcon"),f=Ue,h=p("fluent-player-preview");return n(),c("div",M7,[(n(!0),c(F,null,x(s.items,g=>{var w,b,S;return n(),c("div",{key:g.id,ref_for:!0,ref:i.observeRow,"data-id":g.id,class:"fcom_space_media_audio_row"},[(w=g.feed)!=null&&w.slug?(n(),y(f,{key:0,content:e.$t("Open post"),placement:"top","show-after":200},{default:r(()=>[l("a",{href:e.feedHref(g),class:"fcom_audio_row_open","aria-label":e.$t("Open post"),onClick:z(k=>e.openFeed(g,k),["stop"])},[a(m)],8,T7)]),_:2},1032,["content"])):_("",!0),i.hasFluentPlayer&&!o.failedIds[g.id]?(n(),c(F,{key:1},[o.visibleIds[g.id]?(n(),y(h,{key:g.id+"-"+o.reloadKey,media:i.playerMediaFor(g),onLoadFailed:k=>o.failedIds[g.id]=!0},null,8,["media","onLoadFailed"])):(n(),c("div",F7))],64)):g.url?(n(),c("audio",{key:2,src:g.url,"aria-label":((b=g.settings)==null?void 0:b.title)||((S=g.feed)==null?void 0:S.title)||e.$t("Audio"),controls:"",preload:"none",class:"fcom_audio_row_native"},null,8,P7)):_("",!0)],8,L7)}),128))])}const E7=I(V7,[["render",I7]]),U7={name:"SpaceMedia",components:{MediaLightbox:S7,MediaAudioList:E7,ExpandIcon:ys},mixins:[xo],props:["space","space_profile","space_slug"],emits:["refetch"],inheritAttrs:!1,data(){return{hasAudio:!1,items:[],cursor:0,hasMore:!1,loading:!1,fetchToken:0,permission_failed:!1,viewerIndex:0,mediaDialog:!1,boundScrollHandler:null,cache:{}}},computed:{activeType:{get(){const e=this.$route.query.type;return["photos","videos","audios"].includes(e)?e:"photos"},set(e){const t={...this.$route.query};e==="photos"?delete t.type:t.type=e,this.$router.push({query:t}).catch(()=>{})}},spaceSlug(){var e;return((e=this.space_profile)==null?void 0:e.slug)||this.space_slug||this.space},isVideoLightboxOpen(){var e;return this.mediaDialog&&((e=this.items[this.viewerIndex])==null?void 0:e.kind)==="video"}},watch:{activeType(){this.loadActiveType()}},methods:{async fetch(e=!1){if(e&&this.loading)return;const t=++this.fetchToken,s=this.activeType;this.loading=!0;try{const u={type:s,per_page:24};e&&this.cursor&&(u.cursor=this.cursor);const o=await this.$get("media-gallery/"+this.spaceSlug,u);if(t!==this.fetchToken||s!==this.activeType)return;const i=o.items||[];this.items=e?this.items.concat(i):i,this.hasMore=!!o.has_more,typeof o.has_audio<"u"&&(this.hasAudio=o.has_audio),this.cursor=o.cursor||0,this.cache[s]={items:this.items,cursor:this.cursor,hasMore:this.hasMore}}catch(u){if(t!==this.fetchToken)return;if(u!=null&&u.permission_failed){this.permission_failed=!0;return}this.$handleError&&this.$handleError(u)}finally{t===this.fetchToken&&(this.loading=!1)}},loadActiveType(){const e=this.cache[this.activeType];if(e){this.items=e.items,this.cursor=e.cursor,this.hasMore=e.hasMore;return}this.items=[],this.cursor=0,this.hasMore=!1,this.fetch(!1)},openItem(e){this.items[e]&&(this.viewerIndex=e,this.mediaDialog=!0)},handleScrollAutoLoad(){var i;if(!this.hasMore||this.loading)return;const e=document.querySelector(".all_media_holder"),t=e&&e.lastElementChild;if(!t)return;const s=(i=window.fcomLayoutRef)==null?void 0:i.wrapRef;if(!s)return;const u=t.getBoundingClientRect(),o=s.getBoundingClientRect();u.bottom-o.bottom<100&&this.fetch(!0)}},created(){this.fetch(!1)},mounted(){this.boundScrollHandler=this.handleScrollAutoLoad.bind(this),document.addEventListener("fcom_layout_scroll",this.boundScrollHandler)},beforeUnmount(){this.boundScrollHandler&&document.removeEventListener("fcom_layout_scroll",this.boundScrollHandler)}},A7={class:"card_header"},B7={class:"member_status"},D7={key:0,class:"fcom_space_media_tabs"},R7={key:0,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},x7={class:"permission_failed"},H7=["href"],O7={key:1,class:"fcom_space_media_card"},j7={key:1,class:"fcom_space_media_empty no_members"},N7={key:0},z7={key:1},q7={key:2},G7={key:0,class:"fcom_space_media_grid all_media_holder"},Y7=["aria-label","onClick","onKeydown"],W7=["src","alt"],K7=["src","poster"],Z7=l("span",{class:"fcom_space_media_overlay","aria-hidden":"true"},null,-1),J7={key:2,class:"fcom_space_media_play_badge","aria-hidden":"true"},Q7=["href","aria-label","onClick"],X7={key:3,class:"fcom_space_media_load_more",style:{"margin-top":"20px","text-align":"center"}};function e9(e,t,s,u,o,i){const m=Ne,f=ve,h=Z,g=p("media-audio-list"),w=p("ExpandIcon"),b=Ue,S=H,k=p("media-lightbox");return n(),c("div",{class:R(["fcom_space_media",{fcom_space_media_video_open:i.isVideoLightboxOpen}])},[l("div",A7,[l("div",B7,[l("h3",null,d(e.$t("Media Gallery")),1)]),o.permission_failed?_("",!0):(n(),c("div",D7,[a(f,{modelValue:i.activeType,"onUpdate:modelValue":t[0]||(t[0]=$=>i.activeType=$),size:"default"},{default:r(()=>[a(m,{label:"photos",value:"photos"},{default:r(()=>[V(d(e.$t("Photos")),1)]),_:1}),a(m,{label:"videos",value:"videos"},{default:r(()=>[V(d(e.$t("Videos")),1)]),_:1}),o.hasAudio?(n(),y(m,{key:0,label:"audios",value:"audios","data-testid":"tab-audios"},{default:r(()=>[V(d(e.$t("Audios")),1)]),_:1})):_("",!0)]),_:1},8,["modelValue"])]))]),o.permission_failed?(n(),c("div",R7,[l("div",x7,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view this page")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:s.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,H7)])])):(n(),c("div",O7,[o.loading&&!o.items.length?(n(),y(h,{key:0,class:"fcom_mt_20 white_loaded",animated:!0,rows:5})):o.items.length?(n(),c(F,{key:2},[(n(),y(Wo,null,[i.activeType==="audios"?(n(),y(g,{key:0,items:o.items,"space-slug":i.spaceSlug},null,8,["items","space-slug"])):_("",!0)],1024)),i.activeType!=="audios"?(n(),c("div",G7,[(n(!0),c(F,null,x(o.items,($,v)=>{var C,L,M,E,T;return n(),c("div",{key:$.id,class:R(["fcom_space_media_cell",["fcom_kind_"+$.kind]]),role:"button",tabindex:"0","aria-label":((C=$.settings)==null?void 0:C.title)||((L=$.feed)==null?void 0:L.title)||e.$t("Open media"),onClick:P=>i.openItem(v),onKeydown:[oe(P=>i.openItem(v),["enter"]),oe(z(P=>i.openItem(v),["prevent"]),["space"])]},[$.kind==="image"?(n(),c("img",{key:0,src:$.url,alt:((M=$.feed)==null?void 0:M.title)||"",loading:"lazy"},null,8,W7)):(n(),c("video",{key:1,src:$.url,poster:((E=$.settings)==null?void 0:E.posterSrc)||void 0,preload:"metadata",muted:"",playsinline:""},null,8,K7)),Z7,$.kind==="video"?(n(),c("span",J7)):_("",!0),(T=$.feed)!=null&&T.slug?(n(),y(b,{key:3,content:e.$t("Open post"),placement:"top","show-after":200},{default:r(()=>[l("a",{href:e.feedHref($),class:"fcom_space_media_feed_btn","aria-label":e.$t("Open post"),onClick:z(P=>e.openFeed($,P),["stop"]),onKeydown:t[1]||(t[1]=z(()=>{},["stop"]))},[a(w)],40,Q7)]),_:2},1032,["content"])):_("",!0)],42,Y7)}),128))])):_("",!0)],64)):(n(),c("div",j7,[i.activeType==="videos"?(n(),c("p",N7,d(e.$t("No videos yet. Videos shared in posts will appear here.")),1)):i.activeType==="audios"?(n(),c("p",z7,d(e.$t("No audios yet. Audio shared in posts will appear here.")),1)):(n(),c("p",q7,d(e.$t("No photos yet. Photos shared in posts will appear here.")),1))])),o.hasMore?(n(),c("div",X7,[a(S,{class:"fcom_secondary_button",disabled:o.loading,loading:o.loading,onClick:t[2]||(t[2]=$=>i.fetch(!0))},{default:r(()=>[V(d(e.$t("Load more")),1)]),_:1},8,["disabled","loading"])])):_("",!0)])),a(k,{modelValue:o.mediaDialog,"onUpdate:modelValue":t[3]||(t[3]=$=>o.mediaDialog=$),items:o.items,"initial-index":o.viewerIndex},null,8,["modelValue","items","initial-index"])],2)}const t9=I(U7,[["render",e9]]);const s9={name:"PendingInvitations",components:{Pagination:$e},data(){return{loading:!1,loadingMore:!1,invitations:[],status:"all",pagination:{page:1,total:0,per_page:10},is_mod:!1}},props:{space_id:{type:Number,default:null}},computed:{getEmptyText(){return this.has_pro?this.$t("No Pending Invitations Found"):this.$t("This feature is only available in the Pro version of FluentCommunity. Please upgrade")}},methods:{getInvitations(){this.loading=!0,this.$get("invitations",{space_id:this.space_id,page:this.pagination.page,per_page:this.pagination.per_page,status:this.status}).then(e=>{this.invitations=e.invitations.data,this.pagination.total=e.invitations.total,this.is_mod=e.is_mod}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},handleResend(e){this.loading=!0,this.$post("invitations/"+e.id+"/resend").then(t=>{this.$notify.success(t.message||this.$t("Invitation resent successfully"))}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})},handleDelete(e){this.$confirm(this.$t("Are you sure you want to delete this invitation?"),this.$t("Warning"),{confirmButtonText:this.$t("OK"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.loading=!0,this.$del("invitations/"+e.id).then(t=>{this.getInvitations()}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})})}},mounted(){this.has_pro&&this.getInvitations()}},o9={class:"fcom_invitations"},i9={style:{margin:"20px 0"},class:"fcom_spaced_flex"},n9={key:0},l9={key:0,class:"fcom_person_name"},a9={key:1,class:"fcom_person_name"},r9={key:3,style:{margin:"0",padding:"0"}},c9={class:"fcom_person_name"};function d9(e,t,s,u,o,i){const m=ne,f=le,h=p("CopyDocument"),g=j,w=H,b=is,S=p("UserRouteLink"),k=p("DeleteFilled"),$=ns,v=p("Pagination"),C=te("loading");return n(),c("div",o9,[l("div",i9,[l("h4",null,d(e.$t("Invitations")),1),e.has_pro?(n(),c("div",n9,[a(f,{style:{"min-width":"150px"},onChange:t[0]||(t[0]=L=>{o.pagination.page=1,i.getInvitations()}),modelValue:o.status,"onUpdate:modelValue":t[1]||(t[1]=L=>o.status=L)},{default:r(()=>[(n(),c(F,null,x(["all","pending","accepted","active","expired"],L=>a(m,{key:L,label:e.$labelize(L),value:L},null,8,["label","value"])),64))]),_:1},8,["modelValue"])])):_("",!0)]),W((n(),y($,{data:o.invitations,border:"","empty-text":i.getEmptyText,style:{width:"100%","border-radius":"8px"}},{default:r(()=>[a(b,{prop:"message",label:e.$t("Invitee"),"min-width":"180"},{default:r(L=>[L.row.message?(n(),c("span",l9,d(L.row.meta.invitee_name)+" <"+d(L.row.message)+"> ",1)):(n(),c("span",a9,d(L.row.meta.title)+" ("+d(e.$t("Invitation Link"))+") ",1)),L.row.access_url?(n(),y(w,{key:2,type:"info",size:"small",text:"",onClick:M=>e.$toClipboard(L.row.access_url,e.$t("Invitation link has been copied to clipboard"))},{default:r(()=>[a(g,{title:e.$t("Copy Invitation URl")},{default:r(()=>[a(h)]),_:1},8,["title"]),l("span",null,d(e.$t("Copy Link")),1)]),_:2},1032,["onClick"])):_("",!0),L.row.message?_("",!0):(n(),c("p",r9,d(L.row.meta.limit?e.$t("Limit")+": "+L.row.meta.limit:"")+" "+d(parseInt(L.row.reactions_count)>0?" | "+e.$t("Usage")+": "+L.row.reactions_count:"")+" "+d(L.row.meta.expire_date?" | "+e.$t("Expire Date")+": "+e.smartDate(L.row.meta.expire_date):""),1))]),_:1},8,["label"]),o.is_mod?(n(),y(b,{key:0,prop:"user_id",label:e.$t("Invited By"),width:"180"},{default:r(L=>[l("span",c9,[a(S,{xprofile:L.row.xprofile},null,8,["xprofile"])])]),_:1},8,["label"])):_("",!0),a(b,{prop:"status",label:e.$t("Status"),width:"120"},{default:r(L=>[l("span",null,d(e.$labelize(L.row.status)),1)]),_:1},8,["label"]),a(b,{label:e.$t("Actions")},{default:r(L=>[L.row.status=="pending"?W((n(),y(w,{key:0,size:"small",onClick:M=>i.handleResend(L.row)},{default:r(()=>[V(d(e.$t("Resend")),1)]),_:2},1032,["onClick"])),[[C,o.loading]]):_("",!0),a(w,{"aria-label":e.$t("Delete invitation"),onClick:M=>i.handleDelete(L.row),plain:"",type:"danger",size:"small"},{default:r(()=>[a(g,{title:e.$t("Delete invitation")},{default:r(()=>[a(k)]),_:1},8,["title"])]),_:2},1032,["aria-label","onClick"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[C,o.loading]]),a(v,{hide_on_single:!1,pagination:o.pagination,onFetch:i.getInvitations},null,8,["pagination","onFetch"])])}const u9=I(s9,[["render",d9]]);const _9={name:"CreateInvitationLink",props:["space_profile"],data(){return{form:{title:"",limit:"",expire_date:""},creating:!1,createdItem:null}},methods:{createLink(){this.has_pro&&(this.creating=!0,this.$post("invitations/link",{space_id:this.space_profile.id,...this.form}).then(e=>{this.$notify.success(e.message),this.createdItem=e.invitation,this.form={title:"",limit:"",expire_date:""}}).catch(e=>{this.$handleError(e)}).finally(()=>{this.creating=!1}))}}},m9={class:"fcom_invitation_link_wrap"},h9={class:"fcom_invite_head"},f9={class:"fcom_invite_body"},p9={key:1},g9={key:1,style:{padding:"20px"}},y9={style:{"font-size":"20px",margin:"20px 0","text-align":"center"}};function v9(e,t,s,u,o,i){const m=se,f=ue,h=Xe,g=H,w=_e,b=p("CopyDocument"),S=j;return n(),c("div",m9,[l("div",h9,[l("h4",null,d(e.$t("Create an invitation link")),1),l("p",null,d(e.$t("Create a simple link to share with potential members. Anyone with the link can join this space.")),1)]),l("div",f9,[o.createdItem?(n(),c("div",g9,[l("h4",y9,d(e.$t("Please share this url to your audience to join this space")),1),a(m,{modelValue:o.createdItem.access_url,"onUpdate:modelValue":t[6]||(t[6]=k=>o.createdItem.access_url=k),readonly:""},{suffix:r(()=>[a(g,{class:"fcomc_button_primary",onClick:t[5]||(t[5]=k=>e.$toClipboard(o.createdItem.access_url,e.$t("Invitation link has been copied to your clipboard")))},{default:r(()=>[a(S,null,{default:r(()=>[a(b)]),_:1}),l("span",null,d(e.$t("Copy")),1)]),_:1})]),_:1},8,["modelValue"])])):(n(),y(w,{key:0,onSubmit:t[3]||(t[3]=z(k=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[4]||(t[4]=k=>o.form=k),"label-position":"top"},{default:r(()=>[a(f,{label:e.$t("Invitation Link Title")},{default:r(()=>[a(m,{modelValue:o.form.title,"onUpdate:modelValue":t[0]||(t[0]=k=>o.form.title=k),placeholder:e.$t("Enter a title for the invitation link")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Limit the number of uses")},{default:r(()=>[a(m,{type:"number",modelValue:o.form.limit,"onUpdate:modelValue":t[1]||(t[1]=k=>o.form.limit=k),placeholder:e.$t("Leave empty for unlimited uses")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Expire Date (Leave empty for no expiration)")},{default:r(()=>[a(h,{style:{"min-width":"300px"},modelValue:o.form.expire_date,"onUpdate:modelValue":t[2]||(t[2]=k=>o.form.expire_date=k),type:"date",placeholder:e.$t("Leave empty for no expiration"),"value-format":"YYYY-MM-DD",format:e.siteDateFormat},null,8,["modelValue","placeholder","format"])]),_:1},8,["label"]),a(f,null,{default:r(()=>[e.has_pro?(n(),y(g,{key:0,onClick:i.createLink,loading:o.creating,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Create Invitation Link")),1)]),_:1},8,["onClick","loading"])):(n(),c("div",p9,[l("p",null,d(e.$t("This feature is only available in the Pro version of FluentCommunity. Please upgrade")),1)]))]),_:1})]),_:1},8,["modelValue"]))])])}const b9=I(_9,[["render",v9]]),k9={name:"InviteUser",props:["space_profile"],data(){return{inviteEmail:"",inviteName:"",role:"member",inviting:!1}},methods:{invite(){const e=(this.inviteEmail||"").trim();if(!/^\S+@\S+\.\S+$/.test(e)){this.$notify.error(this.$t("Please enter a valid email address."));return}this.inviting=!0,this.$get("spaces/users/search",{context:"add_member",search:e,space_id:this.space_profile.id}).then(t=>{const s=(t.users.data||[]).find(u=>(u.user_email||"").toLowerCase()===e.toLowerCase());return s?this.$post("spaces/"+this.space_profile.slug+"/members",{user_id:s.ID,role:this.role}).then(u=>{this.$notify.success(u.message),this.resetForm()}):this.$post("invitations",{email:e,invitee_name:(this.inviteName||"").trim(),space_id:this.space_profile.id}).then(u=>{this.$notify.success(u.message||this.$t("Invitation sent.")),this.resetForm(),this.$emit("invited")})}).catch(t=>{this.$handleError(t)}).finally(()=>this.inviting=!1)},resetForm(){this.inviteEmail="",this.inviteName="",this.role="member"}}},w9={class:"fcom_invitation_link_wrap"},C9={class:"fcom_invite_head"},$9={class:"fcom_invite_body"};function S9(e,t,s,u,o,i){const m=se,f=ue,h=ne,g=le,w=H,b=_e;return n(),c("div",w9,[l("div",C9,[l("h4",null,d(e.$t("Invite a user by email")),1),l("p",null,d(e.$t("If the user already exists, they will be added to the space directly. Otherwise, an email invitation will be sent.")),1)]),l("div",$9,[a(b,{onSubmit:t[6]||(t[6]=z(()=>{},["prevent"])),"label-position":"top"},{default:r(()=>[a(f,{label:e.$t("Email")},{default:r(()=>[a(m,{modelValue:o.inviteEmail,"onUpdate:modelValue":t[0]||(t[0]=S=>o.inviteEmail=S),type:"email",placeholder:e.$t("Enter email address"),onKeyup:t[1]||(t[1]=oe(S=>i.invite(),["enter"]))},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Invitee Name (optional)")},{default:r(()=>[a(m,{modelValue:o.inviteName,"onUpdate:modelValue":t[2]||(t[2]=S=>o.inviteName=S),placeholder:e.$t("Enter invitee Name"),onKeyup:t[3]||(t[3]=oe(S=>i.invite(),["enter"]))},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Membership Role")},{default:r(()=>[a(g,{modelValue:o.role,"onUpdate:modelValue":t[4]||(t[4]=S=>o.role=S),placeholder:e.$t("Select Role")},{default:r(()=>[a(h,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(h,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(h,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,null,{default:r(()=>[a(w,{class:"fcom_primary_button",loading:o.inviting,disabled:o.inviting,onClick:t[5]||(t[5]=S=>i.invite())},{default:r(()=>[V(d(e.$t("Send Invitation")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1})])])}const V9=I(k9,[["render",S9]]),M9={name:"SpaceInviations",components:{CreateInvitationLink:b9,PendingInvitations:u9,InviteUser:V9},props:["space_profile"],data(){return{currentTab:"invitations"}}},L9={key:0,class:"card_header"},T9={class:"permission_failed"},F9=["href"],P9={key:1};function I9(e,t,s,u,o,i){const m=p("pending-invitations"),f=St,h=p("CreateInvitationLink"),g=p("InviteUser"),w=Vt;return e.hasSpaceAdminAccess(s.space_profile)?(n(),c("div",P9,[a(w,{modelValue:o.currentTab,"onUpdate:modelValue":t[1]||(t[1]=b=>o.currentTab=b),type:"border-card"},{default:r(()=>[a(f,{name:"invitations",label:e.$t("Invitations")},{default:r(()=>[o.currentTab=="invitations"?(n(),y(m,{key:0,space_id:s.space_profile.id},null,8,["space_id"])):_("",!0)]),_:1},8,["label"]),a(f,{name:"invitation_links",label:e.$t("New Invitation Link")},{default:r(()=>[o.currentTab=="invitation_links"?(n(),y(h,{key:0,space_profile:s.space_profile},null,8,["space_profile"])):_("",!0)]),_:1},8,["label"]),a(f,{name:"invite_user",label:e.$t("Invite User")},{default:r(()=>[o.currentTab=="invite_user"?(n(),y(g,{key:0,space_profile:s.space_profile,onInvited:t[0]||(t[0]=b=>o.currentTab="invitations")},null,8,["space_profile"])):_("",!0)]),_:1},8,["label"])]),_:1},8,["modelValue"])])):(n(),c("div",L9,[l("div",T9,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view invitations")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:s.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,F9)])]))}const E9=I(M9,[["render",I9]]),U9={name:"GlobIcon"},A9={width:"14",height:"14",viewBox:"0 0 14 14",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},B9=l("path",{d:"M3.1564 3.30236C2.23368 4.26115 1.66634 5.5644 1.66634 7.00016C1.66634 9.9457 4.05415 12.3335 6.99967 12.3335C7.72021 12.3335 8.40741 12.1906 9.03441 11.9316C9.11107 11.4313 8.94287 10.9512 8.87407 10.7832C8.72101 10.4102 8.21574 9.7723 7.37227 8.88736C7.14714 8.6507 7.16161 8.46916 7.24207 7.9297L7.25134 7.86876C7.30601 7.49923 7.39774 7.28076 8.64114 7.08336C9.27281 6.98323 9.43894 7.2357 9.66921 7.5853C9.69467 7.62403 9.72014 7.66203 9.74621 7.7001C9.96494 8.01996 10.127 8.0931 10.3718 8.20443C10.4815 8.25416 10.6183 8.3169 10.8017 8.4211C11.2364 8.6695 11.2364 8.94996 11.2364 9.56496V9.6347C11.2364 9.89576 11.2109 10.125 11.1707 10.3241C11.8982 9.4125 12.333 8.2571 12.333 7.00016C12.333 4.80076 11.0017 2.9123 9.10094 2.09671C8.73214 2.34558 8.22621 2.69834 8.04967 2.94016C7.95941 3.06375 7.83181 3.6946 7.41681 3.74667C7.30807 3.76032 7.16221 3.75076 7.00767 3.74081C6.59334 3.71388 6.02647 3.67754 5.84501 4.17013C5.72981 4.4823 5.70954 5.3298 6.08227 5.7697C6.14194 5.83996 6.15347 5.96996 6.11294 6.11583C6.05967 6.30736 5.95207 6.4239 5.91854 6.44796C5.85427 6.41103 5.72607 6.26223 5.63926 6.16096C5.43003 5.91783 5.16904 5.61505 4.83165 5.52134C4.70897 5.48738 4.57411 5.45928 4.44333 5.43174C4.07727 5.35501 3.66263 5.26772 3.56629 5.06218C3.49595 4.91163 3.49626 4.7043 3.49653 4.48526C3.49653 4.20763 3.49653 3.89369 3.36053 3.58854C3.30798 3.47044 3.2376 3.37647 3.1564 3.30236ZM6.99967 13.6668C3.31777 13.6668 0.333008 10.682 0.333008 7.00016C0.333008 3.31826 3.31777 0.333496 6.99967 0.333496C10.6815 0.333496 13.6663 3.31826 13.6663 7.00016C13.6663 10.682 10.6815 13.6668 6.99967 13.6668Z",fill:"currentColor"},null,-1),D9=[B9];function R9(e,t,s,u,o,i){return n(),c("svg",A9,D9)}const Ho=I(U9,[["render",R9]]),x9={name:"GroupIcon"},H9={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},O9=l("path",{d:"M13.8494 12C14.3489 12 14.7462 11.6856 15.103 11.2461C15.8333 10.3463 14.6342 9.62723 14.1769 9.27507C13.712 8.91708 13.1929 8.71428 12.6667 8.66667M12 7.33333C12.9205 7.33333 13.6667 6.58714 13.6667 5.66667C13.6667 4.74619 12.9205 4 12 4",stroke:"currentColor","stroke-linecap":"round"},null,-1),j9=l("path",{d:"M2.15096 12C1.65143 12 1.2541 11.6856 0.897356 11.2461C0.167051 10.3463 1.36611 9.62723 1.82342 9.27507C2.28831 8.91708 2.80738 8.71428 3.33366 8.66667M3.66699 7.33333C2.74652 7.33333 2.00033 6.58714 2.00033 5.66667C2.00033 4.74619 2.74652 4 3.66699 4",stroke:"currentColor","stroke-linecap":"round"},null,-1),N9=l("path",{d:"M5.38953 10.0738C4.70834 10.495 2.92232 11.3551 4.01013 12.4313C4.54151 12.957 5.13334 13.333 5.87741 13.333H10.1232C10.8673 13.333 11.4591 12.957 11.9905 12.4313C13.0783 11.3551 11.2923 10.495 10.6111 10.0738C9.01375 9.08608 6.9869 9.08608 5.38953 10.0738Z",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),z9=l("path",{d:"M10.3337 4.99984C10.3337 6.2885 9.28899 7.33317 8.00033 7.33317C6.71166 7.33317 5.66699 6.2885 5.66699 4.99984C5.66699 3.71117 6.71166 2.6665 8.00033 2.6665C9.28899 2.6665 10.3337 3.71117 10.3337 4.99984Z",stroke:"currentColor"},null,-1),q9=[O9,j9,N9,z9];function G9(e,t,s,u,o,i){return n(),c("svg",H9,q9)}const Gt=I(x9,[["render",G9]]),Y9={name:"AllCommunities",components:{User:fi,GlobIcon:Ho,Layout:we,AppLayout:Se,CreateSpaceForm:jt,GroupIcon:Gt,Pagination:$e,Search:Ie},setup(){return{spaceStore:je()}},data(){return{communities:[],loading:!0,joining:null,pagination:{page:1,per_page:24,total:0},search:"",type:"all",sort_by:"alphabetical"}},methods:{getCommunities(){this.loading=!0,this.$get("spaces/discover",{type:this.type,search:this.search,sort_by:this.sort_by,page:this.pagination.page,per_page:this.pagination.per_page}).then(e=>{this.communities=e.spaces.data,this.pagination.total=e.spaces.total}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},goToSpaceFeeds(e){this.$router.push({name:"space_feeds",params:{space:e}})},getSpaceFeedsRoute(e){return{name:"space_feeds",params:{space:e}}},getExcerpt(e,t=50){if(!e)return"";let s=e.replace(/(<([^>]+)>)/ig,"");return typeof DOMParser<"u"&&(s=new DOMParser().parseFromString(s,"text/html").body.textContent||""),s.length>t&&(s=s.substring(0,t)+"..."),s},async join(e){if(e.privacy!="public"||!this.auth.user_id){this.$router.push({name:"space_feeds",params:{space:e.slug}});return}this.joining=e.slug;try{await this.spaceStore.joinSpace(e.slug,e),this.$notify.success(this.$t("Successfully joined the space")),this.$eventBus.emit("reloadMenu"),delete this.spaceStore.spacesBySlug[e.slug],this.$router.push({name:"space_feeds",params:{space:e.slug}})}catch(t){this.$handleError(t)}finally{this.joining=null}},fireCreateSpace(e=null){this.$eventBus.emit("createSpaceModal",e)},goToSpaceGroups(){window.location.href=this.$getRouteLink("admin/settings/space_groups")},SwitchToSpaceView(e){this.type=e,this.getCommunities()},handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.getCommunities()},changeSortBy(){this.$storeLocalData("space_sort_by",this.sort_by),this.toSearch()},openCreateSpace(e){e==="yes"&&this.fireCreateSpace()}},created(){this.$eventBus.on("open_create_space_modal",this.openCreateSpace)},mounted(){this.sort_by=this.$getLocalData("space_sort_by","alphabetical"),this.getCommunities(),this.$route.query.create_space=="yes"&&this.fireCreateSpace(),this.changeTitle(this.$t("Spaces"))},beforeUnmount(){this.$eventBus.off("open_create_space_modal",this.openCreateSpace)}},W9={class:"object_menu"},K9={class:"fcom_space_menu_ul"},Z9={key:0},J9={key:1},Q9={class:"actions_items"},X9={class:"search_member"},eV={class:"feed_filters"},tV=l("div",{class:"fcom_feed_divider"},null,-1),sV={id:"feed_short_by",class:"fcom_feed_filter_label"},oV={class:"fcom_communities"},iV={key:0,class:"fcom_no_items_wrap"},nV={key:1,class:"fcom_box_card_list"},lV={class:"fcom_box_card_avatar"},aV=["src"],rV=["src"],cV=["alt","src"],dV={class:"fcom_box_card_info"},uV={class:"fcom_box_card_name"},_V={key:0},mV={class:"fcom_box_card_details"},hV={class:"details_item"},fV={key:0,class:"details_item"},pV=["textContent"],gV={class:"fcom_box_card_action"},yV=["disabled","onClick"],vV=["onClick"];function bV(e,t,s,u,o,i){const m=H,f=p("MoreFilled"),h=j,g=ye,w=p("Search"),b=se,S=ne,k=le,$=p("router-link"),v=Ee,C=p("GlobIcon"),L=p("Lock"),M=p("GroupIcon"),E=p("pagination"),T=p("layout"),P=p("app-layout"),U=te("loading");return n(),y(P,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(T,{content_class:"no_bg_layout",title:e.$t("Spaces")+" "+(o.pagination.total?" ("+e.$formatNumber(o.pagination.total)+")":"")},{actions:r(()=>[l("div",W9,[l("ul",K9,[l("li",null,[l("a",{onClick:t[0]||(t[0]=z(D=>i.SwitchToSpaceView("all"),["prevent"])),class:R(o.type=="all"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("All Spaces")),3)]),e.auth.user_id?(n(),c("li",Z9,[l("a",{onClick:t[1]||(t[1]=z(D=>i.SwitchToSpaceView("joined"),["prevent"])),class:R(o.type=="joined"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("My Spaces")),3)])):_("",!0),e.isAdmin()?(n(),c("li",J9,[a(m,{onClick:t[2]||(t[2]=D=>i.fireCreateSpace()),class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("New Space")),1)]),_:1})])):_("",!0)]),e.isAdmin()?(n(),y(g,{key:0,persistent:!1,ref:"space_actions",placement:"bottom",width:200,trigger:"click"},{reference:r(()=>[a(m,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(f)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[l("ul",Q9,[l("li",{onClick:t[3]||(t[3]=(...D)=>i.goToSpaceGroups&&i.goToSpaceGroups(...D))},d(e.$t("View Space Groups")),1)])]),_:1},512)):_("",!0)])]),default:r(()=>[l("div",X9,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:oe(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[4]||(t[4]=D=>o.search=D),placeholder:e.$t("Search Space...")},{prefix:r(()=>[a(h,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",eV,[tV,l("span",sV,d(e.$t("Sort by:")),1),a(k,{"aria-label":e.$t("Sort Spaces by"),modelValue:o.sort_by,"onUpdate:modelValue":t[5]||(t[5]=D=>o.sort_by=D),class:"fcom_minimal_select space_sort_select","popper-class":"plain_select",onChange:t[6]||(t[6]=D=>i.changeSortBy())},{default:r(()=>[a(S,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"]),a(S,{value:"latest",label:e.$t("Latest Spaces")},null,8,["label"]),a(S,{value:"oldest",label:e.$t("Oldest Spaces")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),W((n(),c("div",oV,[!o.loading&&o.communities.length==0?(n(),c("div",iV,[o.search?(n(),c(F,{key:0},[l("h3",null,d(e.$t("No spaces found based on your search criteria")),1),l("p",null,d(e.$t("No spaces match your search criteria. Try adjusting your search terms or browse our space catalog.")),1)],64)):(n(),c(F,{key:1},[l("h3",null,d(e.$t("No spaces found")),1),l("p",null,d(e.$t("Please check back later. We are in a process to publish some spaces for you!")),1)],64))])):(n(),c("div",nV,[(n(!0),c(F,null,x(o.communities,D=>(n(),c("div",{role:"region","aria-label":"Space Lists",key:D.id,class:"fcom_each_box_card"},[l("div",lV,[a($,{"aria-label":"Go to Space",to:i.getSpaceFeedsRoute(D.slug)},{default:r(()=>{var A;return[(A=D.settings)!=null&&A.og_image?(n(),c("img",{key:0,src:D.settings.og_image,alt:""},null,8,aV)):D.cover_photo?(n(),c("img",{key:1,src:D.cover_photo,alt:""},null,8,rV)):(n(),c("img",{key:2,alt:e.$t("Placeholder image"),src:e.appVars.assets_url+"images/space-placeholder.jpg"},null,8,cV))]}),_:2},1032,["to"])]),l("div",dV,[l("div",uV,[a($,{to:i.getSpaceFeedsRoute(D.slug)},{default:r(()=>[V(d(i.getExcerpt(D.title,24))+" ",1),D.space_pivot?(n(),y(v,{key:0,type:"success"},{default:r(()=>[V(d(e.$labelize(D.space_pivot.role))+" ",1),D.space_pivot.status!="active"?(n(),c("span",_V," ("+d(e.$labelize(D.space_pivot.status))+") ",1)):_("",!0)]),_:2},1024)):_("",!0)]),_:2},1032,["to"])]),l("div",mV,[l("div",hV,[D.privacy==="public"?(n(),y(h,{key:0},{default:r(()=>[a(C)]),_:1})):(n(),y(h,{key:1},{default:r(()=>[a(L)]),_:1})),l("span",null,d(e.$labelize(D.privacy)),1)]),D.members_count?(n(),c("div",fV,[a(h,null,{default:r(()=>[a(M)]),_:1}),l("span",null,d(e.$_n("%s Member","%s Members",e.$formatNumber(D.members_count))),1)])):_("",!0)]),D.description?(n(),c("div",{key:0,class:"fcom_box_card_description",textContent:d(i.getExcerpt(D.description_rendered,85))},null,8,pV)):_("",!0),l("div",gV,[D.space_pivot?(n(),c("button",{key:1,class:"fcom_card_button",onClick:A=>i.goToSpaceFeeds(D.slug)},d(e.$t("View Space")),9,vV)):W((n(),c("button",{key:0,class:"fcom_card_button",disabled:o.joining===D.slug,onClick:A=>i.join(D)},[V(d(e.$t("Join")),1)],8,yV)),[[U,o.joining===D.slug]])])])]))),128))])),a(E,{hide_on_single:!0,onFetch:i.getCommunities,pagination:o.pagination},null,8,["onFetch","pagination"])])),[[U,o.loading]])]),_:1},8,["title"])]),_:1})}const kV=I(Y9,[["render",bV]]),wV={name:"UserBadge",props:["badge","is_preview","profile"],computed:{renderingBadges(){var e;if(!this.appVars.user_badges&&!this.is_preview)return null;if(this.profile){let t=this.profile.badge_slugs;if(t||(t=(e=this.profile.meta)==null?void 0:e.badge_slug,typeof t=="string"&&(t=[t])),!t||t.length==0)return null;let s=[];for(let u=0;u<t.length;u++){let o=this.appVars.user_badges[t[u]];o&&s.push(o)}return s}return[this.badge]}}},CV=["src"],$V={key:1,class:"fcom_emoji"},SV={key:2,class:"fcom_shape"},VV={key:1};function MV(e,t,s,u,o,i){const m=j,f=Ue;return i.renderingBadges?(n(!0),c(F,{key:0},x(i.renderingBadges,h=>(n(),c("div",{class:R([{user_icon_only:h.show_label!="yes"},"user_badge"])},[a(f,{content:h.title,placement:"top"},{default:r(()=>[l("div",{style:re({backgroundColor:h.background_color,color:h.color,borderColor:h.color}),class:"user_badge_inner"},[h.config?(n(),c(F,{key:0},[h.config.logo?(n(),c("img",{key:0,alt:"",src:h.config.logo},null,8,CV)):h.config.emoji?(n(),c("span",$V,d(h.config.emoji),1)):h.config.shape_svg?(n(),c("span",SV,[a(m,{innerHTML:h.config.shape_svg},null,8,["innerHTML"])])):_("",!0)],64)):_("",!0),h.show_label=="yes"?(n(),c("span",VV,d(h.title),1)):_("",!0)],4)]),_:2},1032,["content"])],2))),256)):_("",!0)}const Oo=I(wV,[["render",MV]]),LV={name:"AddNotificationIcon"},TV={viewBox:"0 0 24 24","aria-hidden":"true",color:"currentColor",class:"r-4qtqp9 r-yyyyoo r-dnmrzs r-bnwqim r-lrvibr r-m6rgpd r-z80fyv r-19wmn03"},FV=l("g",null,[l("path",{d:"M22 5v2h-3v3h-2V7h-3V5h3V2h2v3h3zm-.86 13h-4.241c-.464 2.281-2.482 4-4.899 4s-4.435-1.719-4.899-4H2.87L4 9.05C4.51 5.02 7.93 2 12 2v2C8.94 4 6.36 6.27 5.98 9.3L5.13 16h13.73l-.38-3h2.02l.64 5zm-6.323 0H9.183c.412 1.164 1.51 2 2.817 2s2.405-.836 2.817-2z"})],-1),PV=[FV];function IV(e,t,s,u,o,i){return n(),c("svg",TV,PV)}const EV=I(LV,[["render",IV]]),UV={name:"NotificationAddedIcon"},AV={viewBox:"0 0 24 24","aria-hidden":"true",color:"currentColor",class:"r-4qtqp9 r-yyyyoo r-dnmrzs r-bnwqim r-lrvibr r-m6rgpd r-z80fyv r-19wmn03"},BV=l("g",null,[l("path",{d:"M12 2C7.93 2 4.51 5.02 4 9.05L2.87 18H7.1c.46 2.28 2.48 4 4.9 4s4.44-1.72 4.9-4h4.24l-.64-5h-2.02l.38 3H5.13l.85-6.7C6.36 6.27 8.94 4 12 4V2zm0 18c-1.31 0-2.42-.83-2.83-2h5.66c-.41 1.17-1.52 2-2.83 2zm.3-12.29l1.41-1.42 1.76 1.76 4.29-4.72 1.48 1.34-5.7 6.28-3.24-3.24z"})],-1),DV=[BV];function RV(e,t,s,u,o,i){return n(),c("svg",AV,DV)}const xV=I(UV,[["render",RV]]),HV={name:"AddUserForm",components:{SpaceIcon:Ze,SpaceCourseSelector:Nt},props:["user_profile"],emits:["completed"],data(){return{loading:!0,saving:!1,selectedId:null,userMemberships:[],role:"member",selectedType:"space",selectedSlug:""}},methods:{updateSelectedType(e){this.selectedType=e},updateSelectedSlug(e){this.selectedSlug=e},fetchUserMemberships(){this.loading=!0,this.$get("profile/"+this.user_profile.username+"/memberships").then(e=>{this.userMemberships=e.memberships}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},addToSpace(){if(this.selectedType==="space"&&!this.role){this.$notify.error(this.$t("Please select a role"));return}this.saving=!0,this.$post("spaces/"+this.selectedSlug+"/members",{user_id:this.user_profile.user_id,role:this.role}).then(e=>{this.$notify.success(e.message),this.selectedId=null,this.role="member",this.$emit("completed")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})},addToCourse(){this.saving=!0,this.$post("admin/courses/"+this.selectedId+"/students",{user_id:this.user_profile.user_id}).then(e=>{this.$notify.success(e.message),this.selectedId=null,this.$emit("completed")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},mounted(){this.fetchUserMemberships()}};function OV(e,t,s,u,o,i){const m=se,f=ue,h=p("SpaceCourseSelector"),g=ne,w=le,b=H,S=_e,k=te("loading");return n(),y(S,{onSubmit:t[4]||(t[4]=z($=>e.doNothing(),["prevent"])),"label-position":"top"},{default:r(()=>[a(f,{label:e.$t("User")},{default:r(()=>[a(m,{modelValue:s.user_profile.display_name+" ("+s.user_profile.email+")",disabled:""},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("Select Space/Course")},{default:r(()=>[W(a(h,{modelValue:o.selectedId,"onUpdate:modelValue":t[0]||(t[0]=$=>o.selectedId=$),memberships:o.userMemberships,placeholder_text:e.$t("Select Space/Course"),onSelectedType:i.updateSelectedType,onSelectedSlug:i.updateSelectedSlug},null,8,["modelValue","memberships","placeholder_text","onSelectedType","onSelectedSlug"]),[[k,o.loading]])]),_:1},8,["label"]),o.selectedType==="space"?(n(),y(f,{key:0,label:e.$t("Membership Role")},{default:r(()=>[a(w,{placeholder:e.$t("Select Role"),modelValue:o.role,"onUpdate:modelValue":t[1]||(t[1]=$=>o.role=$)},{default:r(()=>[a(g,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(g,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(g,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"])):_("",!0),Y(e.$slots,"after_form",{},()=>[a(f,null,{default:r(()=>[o.selectedType==="course"?W((n(),y(b,{key:0,class:"fcom_primary_button",disabled:o.saving||!o.selectedId,onClick:t[2]||(t[2]=$=>i.addToCourse())},{default:r(()=>[V(d(e.$t("Add to Course")),1)]),_:1},8,["disabled"])),[[k,o.saving]]):W((n(),y(b,{key:1,class:"fcom_primary_button",disabled:o.saving||!o.selectedId,onClick:t[3]||(t[3]=$=>i.addToSpace())},{default:r(()=>[V(d(e.$t("Add to Space")),1)]),_:1},8,["disabled"])),[[k,o.saving]])]),_:1})])]),_:3})}const jV=I(HV,[["render",OV]]),NV={name:"ProfileHeader",emits:["refetch"],setup(){return{userStore:De()}},components:{UserBadge:Oo,ImageUploader:xe,BookmarkIcon:bo,FollowAction:it,AddNotificationIcon:EV,NotificationAddedIcon:xV,AddUserForm:jV},props:{profile:{required:!1},username:{required:!1},isOwn:{required:!1}},data(){return{updating:!1,isAddUserOpen:!1}},computed:{user_profile(){return this.profile?this.profile:{ID:0,title:".......",slug:"..",cover_photo:""}},isOwnProfile(){return this.auth&&this.user_profile.username==this.auth.username},level(){if(!this.has_leaderboard)return"";const e=Be(this.user_profile.total_points);return e?e.level:0},getCoverPhotoButtonText(){return this.user_profile.cover_photo?this.$t("Change Cover"):this.$t("Upload Cover")},isOtherProfile(){var s;const e=this.auth.user_id,t=(s=this.profile)==null?void 0:s.user_id;return t&&e&&t!=e},showActions(){var e,t;return((t=(e=this.profile)==null?void 0:e.profile_nav_actions)==null?void 0:t.length)||this.showFollowAction},showFollowAction(){return this.hasFeature("followers_module")&&this.isOtherProfile},showOtherActions(){return this.isOtherProfile&&this.hasPermission("super_admin")},showBlock(){var t,s;if(!((t=this.profile)!=null&&t.user_id)||this.userStore.isBlocked(this.profile.user_id))return!1;const e=(s=this.profile)==null?void 0:s.follow;return this.showFollowAction&&(!e||String(e)!=="0")},isFollowing(){var t,s;if(!((t=this.profile)!=null&&t.user_id))return!1;if(this.userStore.isFollowing(this.profile.user_id))return!0;const e=(s=this.profile)==null?void 0:s.follow;return e!==void 0&&["1","2"].includes(String(e))},isNotificationOn(){var t,s;if(!((t=this.profile)!=null&&t.user_id))return!1;const e=this.userStore.getFollowLevel(this.profile.user_id);return e!==void 0?String(e)==="2":String((s=this.profile)==null?void 0:s.follow)==="2"},getTitle(){return this.isNotificationOn?this.$t("Turn off Email Notification of This User"):this.$t("Turn on Email Notification of This User")}},methods:{handleCoverPhotoUpload(e){this.profile.cover_photo=e,this.updateProfile({cover_photo:e})},handlePhotoUpload(e){this.profile.avatar=e,this.updateProfile({avatar:e})},removeAvatar(){var t;(t=this.$refs.avatarPopover)==null||t.hide();const e=this.isOwnProfile?this.$t("Are you sure you want to remove your profile photo?"):this.$t("Are you sure you want to remove %s's profile photo?",this.user_profile.display_name);this.$confirm(e,this.$t("Remove Profile Photo?"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.profile.avatar="",this.profile.has_custom_avatar=!1,this.updateProfile({avatar:""})})},removeCoverPhoto(){const e=this.isOwnProfile?this.$t("Are you sure you want to remove your cover photo?"):this.$t("Are you sure you want to remove %s's cover photo?",this.user_profile.display_name);this.$confirm(e,this.$t("Remove Cover Photo?"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.profile.cover_photo="",this.updateProfile({cover_photo:""})})},confirmAndBlock(){this.$confirm(this.$t("Blocking this user will hide their posts from your feed and prevent them from interacting with you. Are you sure you want to block this user?"),{confirmButtonText:this.$t("Block"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.blockUser()})},blockUser(){this.updating=!0,this.$post("profile/"+this.profile.username+"/block").then(e=>{var t;this.userStore.setFollows({[(t=this.profile)==null?void 0:t.user_id]:"0"}),this.$notify.success(e.message),this.$emit("refetch")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.updating=!1})},toggleNotification(){var t;const e=this.profile.follow=="2"?"1":"2";(t=this.profile)!=null&&t.user_id&&this.userStore.setFollows({[this.profile.user_id]:e})},async updateProfile(e){if(this.user_profile.username){this.updating=!0;try{await this.userStore.updateProfile(e,this.user_profile.username,this.user_profile.username),this.$notify.success(this.$t("Profile updated successfully")),this.$emit("refetch")}catch(t){this.$handleError(t)}finally{this.updating=!1}}},toggleEmailNotification(){this.updating=!0,this.$post("profile/"+this.profile.username+"/notification").then(e=>{this.$notify.success(e.message),this.toggleNotification()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.updating=!1})},openAddToDrawer(){this.isAddUserOpen=!0},userAdded(){this.isAddUserOpen=!1},handleDrawerClose(e){this.$refs.addUserForm&&(this.$refs.addUserForm.selectedId=null,this.$refs.addUserForm.role="member"),e()}}},zV={ref:"fcom_user_profile",class:"object_header user_header"},qV={key:0,class:"object_media_uploader"},GV={class:"object_info"},YV={class:"object_avatar"},WV=["alt","src"],KV=["aria-label"],ZV={class:"fcom_avatar_actions"},JV={key:1,style:{position:"absolute",right:"calc(12.5% - 9px)",bottom:"calc(36.5% - 5px)","line-height":"0",background:"rgb(67, 87, 173)",width:"20px",height:"20px","font-size":"12px",display:"flex","align-items":"center","justify-content":"center","border-radius":"50%",color:"#fff",border:"1px solid white"},role:"region","aria-label":"User Level",class:"fcom_user_level_mark"},QV={class:"object_name"},XV={class:"object_meta"},eM={key:0,class:"object_meta follower"},tM={class:"object_menu"},sM={key:0,class:"fcom_profile_nav"},oM=["href","target"],iM={key:1,class:"fcom_profile_menu_actions"},nM=["target","href"];function lM(e,t,s,u,o,i){var A,q,O,N,G,ae,B,X,me;const m=H,f=p("image-uploader"),h=p("UploadFilled"),g=j,w=ye,b=p("verified-sign"),S=p("UserBadge"),k=p("router-link"),$=p("FollowAction"),v=p("NotificationAddedIcon"),C=p("AddNotificationIcon"),L=p("MoreFilled"),M=ze,E=qe,T=Ge,P=p("add-user-form"),U=es,D=te("loading");return W((n(),c("div",zV,[l("div",{style:re({backgroundImage:`url('${i.user_profile.cover_photo||""}')`}),class:R(["object_cover",{no_cover:!i.user_profile.cover_photo}])},[i.isOwnProfile||e.hasPermission("super_admin")?(n(),c("div",qV,[a(f,{additionalData:{resize:!0,max_width:1500},onUploaded:i.handleCoverPhotoUpload},{default:r(()=>[a(m,{title:e.$t("Recommended Size: 1200 x 375px"),size:"small",plain:"",type:"primary"},{default:r(()=>[V(d(i.getCoverPhotoButtonText),1)]),_:1},8,["title"])]),_:1},8,["onUploaded"]),i.user_profile.cover_photo?(n(),y(m,{key:0,class:"fcom_mt_10",size:"small",plain:"",type:"danger",onClick:z(i.removeCoverPhoto,["prevent"])},{default:r(()=>[V(d(e.$t("Remove")),1)]),_:1},8,["onClick"])):_("",!0)])):_("",!0)],6),l("div",GV,[l("div",YV,[l("img",{alt:e.$t("Placeholder Photo"),src:i.user_profile.avatar||e.appVars.assets_url+"/images/placeholder.png"},null,8,WV),i.isOwnProfile||e.hasPermission("super_admin")?(n(),y(w,{key:0,ref:"avatarPopover",trigger:"click",placement:"bottom",width:"fit-content","popper-class":"fcom_avatar_popover",teleported:!1},{reference:r(()=>[l("button",{class:"object_avatar_uploader",type:"button","aria-label":e.$t("Change profile photo")},[a(g,{class:"object_avatar_upload"},{default:r(()=>[a(h)]),_:1})],8,KV)]),default:r(()=>[l("div",ZV,[a(f,{additionalData:{resize:!0,max_width:200},onUploaded:i.handlePhotoUpload},{trigger:r(()=>[a(m,{size:"small",text:"",class:"fcom_avatar_action_btn"},{default:r(()=>[V(d(e.$t("Upload")),1)]),_:1})]),_:1},8,["onUploaded"]),i.user_profile.has_custom_avatar?(n(),y(m,{key:0,size:"small",text:"",type:"danger",class:"fcom_avatar_action_btn",onClick:i.removeAvatar},{default:r(()=>[V(d(e.$t("Remove")),1)]),_:1},8,["onClick"])):_("",!0)])]),_:1},512)):_("",!0),i.level?(n(),c("div",JV,[l("span",null,d(i.level),1)])):_("",!0)]),l("div",QV,[l("h3",null,[V(d((A=i.user_profile)==null?void 0:A.display_name)+" ",1),(q=i.user_profile)!=null&&q.is_verified?(n(),y(b,{key:0})):_("",!0),a(S,{profile:i.user_profile},null,8,["profile"])]),l("p",XV,"@"+d((O=i.user_profile)==null?void 0:O.username),1),e.hasFeature("followers_module")?(n(),c("div",eM,[((N=i.user_profile)==null?void 0:N.followings_count)!=null?(n(),y(k,{key:0,to:{name:"user_followings",params:{username:i.user_profile.username}}},{default:r(()=>[l("span",null,d(i.user_profile.followings_count),1),V(" "+d(e.$t("Following")),1)]),_:1},8,["to"])):_("",!0),((G=i.user_profile)==null?void 0:G.followers_count)!=null?(n(),y(k,{key:1,to:{name:"user_followers",params:{username:i.user_profile.username}}},{default:r(()=>[l("span",null,d(i.user_profile.followers_count),1),V(" "+d(e.$t("Followers")),1)]),_:1},8,["to"])):_("",!0)])):_("",!0)])]),l("div",tM,[(B=(ae=s.profile)==null?void 0:ae.profile_navs)!=null&&B.length?(n(),c("ul",sM,[(n(!0),c(F,null,x(s.profile.profile_navs,ee=>(n(),c("li",{class:R(ee.wrapper_class??"")},[ee.route?(n(),y(k,{key:0,class:R(ee.css_class??""),to:ee.route},{default:r(()=>[ee.svg_icon?(n(),y(g,{key:0,innerHTML:ee.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(ee.title),1)]),_:2},1032,["class","to"])):(n(),c("a",{key:1,href:ee.url,class:R(ee.css_class??""),target:ee.is_external?"_blank":"_self"},[ee.svg_icon?(n(),y(g,{key:0,innerHTML:ee.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(ee.title),1)],10,oM))],2))),256))])):_("",!0),i.showActions?(n(),c("div",iM,[(me=(X=s.profile)==null?void 0:X.profile_nav_actions)!=null&&me.length?(n(!0),c(F,{key:0},x(s.profile.profile_nav_actions,ee=>(n(),c("a",{class:R(ee.css_class),target:ee.is_external?"_blank":"_self",href:ee.url},[ee.svg_icon?(n(),y(g,{key:0,innerHTML:ee.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(ee.title),1)],10,nM))),256)):_("",!0),i.showFollowAction||i.showOtherActions?(n(),c(F,{key:1},[i.showFollowAction?(n(),c(F,{key:0},[s.profile?(n(),y($,{key:0,profile:s.profile,onRefetch:t[0]||(t[0]=ee=>e.$emit("refetch"))},null,8,["profile"])):_("",!0),i.isFollowing?(n(),y(m,{key:1,class:"fcom_secondary_button icon_button",title:i.getTitle,loading:o.updating,disabled:o.updating,onClick:i.toggleEmailNotification},{default:r(()=>[i.isNotificationOn?(n(),y(g,{key:0},{default:r(()=>[a(v)]),_:1})):(n(),y(g,{key:1},{default:r(()=>[a(C)]),_:1}))]),_:1},8,["title","loading","disabled","onClick"])):_("",!0)],64)):_("",!0),i.showBlock||i.showOtherActions?(n(),y(T,{key:1,"popper-class":"fcom_pop_buttons",trigger:"click"},{dropdown:r(()=>[a(E,null,{default:r(()=>[i.showBlock?(n(),y(M,{key:0,onClick:t[1]||(t[1]=ee=>i.confirmAndBlock())},{default:r(()=>[a(m,{"aria-label":e.$t("Block User"),class:"fcom_dot_menu edit_action",size:"small",text:"",type:"danger"},{default:r(()=>[V(d(e.$t("Block User")),1)]),_:1},8,["aria-label"])]),_:1})):_("",!0),i.showOtherActions?(n(),y(M,{key:1,onClick:t[2]||(t[2]=ee=>i.openAddToDrawer())},{default:r(()=>[a(m,{"aria-label":e.$t("Add User to Space/Course"),class:"fcom_dot_menu edit_action",size:"small",text:"",type:"primary"},{default:r(()=>[V(d(e.$t("Add To Space/Course")),1)]),_:1},8,["aria-label"])]),_:1})):_("",!0)]),_:1})]),default:r(()=>[a(m,{class:"fcom_dot_menu edit_action",size:"small",text:""},{default:r(()=>[a(g,null,{default:r(()=>[a(L)]),_:1})]),_:1})]),_:1})):_("",!0)],64)):_("",!0)])):_("",!0)]),a(U,{modelValue:o.isAddUserOpen,"onUpdate:modelValue":t[3]||(t[3]=ee=>o.isAddUserOpen=ee),"close-on-click-modal":!0,"before-close":i.handleDrawerClose,"append-to-body":!0,size:e.modalWidth,direction:"rtl"},{header:r(()=>[l("h4",null,d(e.$t("Add User to Space/Course")),1)]),default:r(()=>[a(P,{ref:"addUserForm",onCompleted:i.userAdded,user_profile:i.user_profile},null,8,["onCompleted","user_profile"])]),_:1},8,["modelValue","before-close","size"])])),[[D,o.updating]])}const aM=I(NV,[["render",lM]]),rM={name:"ProfileAbout",components:{SocialLinks:Dt},props:["profile","isOwn"]},cM={class:"app_side_widget"},dM={class:"widget_header"},uM={key:0,class:"widget_actions"},_M={key:0,class:"widget_body"},mM=["innerHTML"],hM={key:1,style:{"text-align":"center"}},fM=l("hr",null,null,-1),pM=l("hr",null,null,-1),gM=["title"],yM=["title"];function vM(e,t,s,u,o,i){const m=p("EditPen"),f=j,h=H,g=p("SocialLinks"),w=Z;return n(),c("div",cM,[l("div",dM,[l("h3",null,d(e.$t("About")),1),s.isOwn?(n(),c("div",uM,[a(h,{"aria-label":"Edit Your Profile",onClick:t[0]||(t[0]=b=>e.$router.push({name:"update_profile",params:{username:s.profile.username}})),text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})])):_("",!0)]),s.profile?(n(),c("div",_M,[s.profile.short_description_rendered?(n(),c("div",{key:0,class:"space_description feed_md_content",innerHTML:s.profile.short_description_rendered},null,8,mM)):s.isOwn?(n(),c("div",hM,[fM,a(h,{"aria-label":"Add your profile description",onClick:t[1]||(t[1]=b=>e.$router.push({name:"update_profile",params:{username:s.profile.username}})),type:"info"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1}),l("span",null,d(e.$t("Add your profile description")),1)]),_:1})])):_("",!0),pM,l("div",{title:s.profile.created_at,class:"meta_line"},d(e.$t("Joined: %s",e.humanDateDiff(s.profile.created_at))),9,gM),s.profile.last_activity?(n(),c("div",{key:2,title:s.profile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(s.profile.last_activity))),9,yM)):_("",!0),a(g,{xprofile:s.profile,isOwn:s.isOwn},null,8,["xprofile","isOwn"])])):(n(),y(w,{key:1,animated:!0}))])}const jo=I(rM,[["render",vM]]),bM={name:"FeedProfile",props:["username"],components:{NotFoundResult:Do,SpaceMenu:Eo,Layout:we,AppLayout:Se,UserHeader:aM,ProfileAbout:jo,RecentActivities:zt},setup(){return{userStore:De()}},data(){return{defaultRoute:this.appVars.default_profile_tab,notFound:!1}},computed:{profile(){return this.userStore.getProfile(this.username)},loading(){return this.userStore.isLoading(this.username)},isOwn(){return this.profile&&this.profile.user_id==this.auth.user_id},showWidget(){var s;const{disable_sidebar:e}=this.$route.meta||{},t=((s=this.profile)==null?void 0:s.is_restricted)??!1;return!e&&!this.notFound&&!t}},watch:{username(){this.notFound=!1,this.getProfile()}},methods:{async getProfile(e=!1){this.notFound=!1;try{const t=await this.userStore.fetchProfile(this.username,e);this.changeTitle(t==null?void 0:t.display_name),(t==null?void 0:t.user_id)==this.auth.user_id&&(this.auth.compilation_score=t.compilation_score)}catch(t){if(this.username==="__me__"&&this.auth.username){let s=this.$route.params;s.username=this.auth.username,this.$router.push({name:this.$route.name,params:s,query:{signed:Date.now()}});return}t.xhr_status===404?(this.notFound=!0,this.changeTitle(this.$t("Profile Not Found"))):this.$handleError(t)}},approveUser(){this.loading=!0,this.$patch("members/"+this.profile.user_id,{status:"active"}).then(e=>{this.$notify.success(e.message),this.profile.status="active",this.getProfile(!0)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){if(this.username=="__me__"&&this.auth.username){let s=this.$route.params;s.username=this.auth.username,this.$router.push({name:this.$route.name,params:s,query:{signed:Date.now()}});return}this.getProfile();const t={about:"user_profile",posts:"user_profile_feeds",spaces:"user_spaces",comments:"user_comments",courses:"user_courses"}[this.defaultRoute||""];t&&this.$route.name==="user_profile"&&t!==this.$route.name&&this.$router.replace({name:t,params:{username:this.username}})}},kM={key:0},wM={key:1},CM=l("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[l("path",{fill:"currentColor",d:"M512 128v64H256a64 64 0 0 0-64 64v512a64 64 0 0 0 64 64h512a64 64 0 0 0 64-64V512h64v256a128 128 0 0 1-128 128H256a128 128 0 0 1-128-128V256a128 128 0 0 1 128-128z"}),l("path",{fill:"currentColor",d:"M768 384a128 128 0 1 0 0-256 128 128 0 0 0 0 256m0 64a192 192 0 1 1 0-384 192 192 0 0 1 0 384"})],-1),$M={class:"edit_profile"},SM={class:"fcom_profile_box"},VM={key:1,class:"profile_holder"},MM={key:2},LM={class:"fcom_main_side_wrap"},TM={class:"widget_recent_activities"};function FM(e,t,s,u,o,i){const m=p("router-link"),f=ls,h=as,g=H,w=j,b=p("EditPen"),S=p("user-header"),k=p("not-found-result"),$=p("router-view"),v=Z,C=Le,L=p("ProfileAbout"),M=p("RecentActivities"),E=et,T=Ye,P=p("layout"),U=p("app-layout");return n(),y(U,{wrapper_class:"fcom_single_layout fcom_member_profile fcom_max_layout"},{default:r(()=>[a(P,{wrapper_class:"no_bg_layout",title:"...."},{title:r(()=>[a(h,null,{default:r(()=>[a(f,null,{default:r(()=>[a(m,{to:{name:"all_members"}},{default:r(()=>[V(d(e.$t("Members")),1)]),_:1})]),_:1}),i.profile?(n(),y(f,{key:0},{default:r(()=>[i.isOwn?(n(),c("span",kM,d(e.$t("My Profile")),1)):(n(),c("span",wM,d(i.profile.display_name),1))]),_:1})):_("",!0)]),_:1})]),actions:r(()=>[i.profile&&e.hasPermission("super_admin")&&i.profile.status!="active"?(n(),c(F,{key:0},[i.profile.status?(n(),c(F,{key:0},[l("span",null,d(e.$labelize(i.profile.status)),1),a(g,{type:"success",onClick:t[0]||(t[0]=D=>e.$confirm(e.$t("Are you sure you want to approve this user?"),e.$t("Warning"),{type:"warning"}).then(()=>{i.approveUser()}))},{default:r(()=>[V(d(e.$t("Approve Account")),1)]),_:1})],64)):(n(),y(g,{key:1,disabled:!0},{default:r(()=>[V(d(e.$t("Self Deactivated Account")),1)]),_:1}))],64)):_("",!0),i.profile&&(i.isOwn||e.hasPermission("super_admin"))?(n(),c(F,{key:1},[a(m,{to:{name:"user_notification_settings",params:{username:i.profile.username}},class:"el-button el-button--text fcom_secondary_button"},{default:r(()=>[a(w,null,{default:r(()=>[CM]),_:1}),l("span",null,d(e.$t("Notification Settings")),1)]),_:1},8,["to"]),e.$route.name!=="update_profile"?(n(),y(g,{key:0,onClick:t[1]||(t[1]=D=>e.$router.push({name:"update_profile",params:{username:i.profile.username}})),class:"fcom_primary_button edit_profile_button"},{default:r(()=>[a(w,null,{default:r(()=>[a(b)]),_:1}),l("span",$M,d(e.$t("Edit Profile")),1)]),_:1})):_("",!0)],64)):_("",!0)]),default:r(()=>[o.notFound?_("",!0):(n(),y(S,{key:0,username:s.username,isOwn:i.isOwn,profile:i.profile,onRefetch:i.getProfile},null,8,["username","isOwn","profile","onRefetch"])),a(T,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(C,{class:"fcom_main"},{default:r(()=>[l("div",SM,[o.notFound?(n(),y(k,{key:0,title:e.$t("Profile Not Found"),message:e.$t("The user profile you are looking for does not exist or has been removed.")},{actions:r(()=>[e.auth.user_id?(n(),y(g,{key:0,onClick:t[2]||(t[2]=D=>e.$router.push({name:"all_members"})),class:"el-button fcom_primary_button"},{default:r(()=>[V(d(e.$t("Browse Members")),1)]),_:1})):_("",!0),a(g,{onClick:t[3]||(t[3]=D=>e.$router.push({name:"all_feeds"})),class:"el-button fcom_secondary_button"},{default:r(()=>[V(d(e.$t("Go to Home")),1)]),_:1})]),_:1},8,["title","message"])):i.profile?(n(),c("div",VM,[a($,{isOwn:i.isOwn,username:s.username,profile:i.profile,onRefetch:i.getProfile},null,8,["isOwn","username","profile","onRefetch"])])):i.loading?(n(),c("div",MM,[a(v,{class:"white_loaded",rows:10,animated:!0})])):_("",!0)])]),_:1}),i.showWidget?(n(),y(E,{key:0,class:"fcom_resp_side",width:"306px"},{default:r(()=>[l("div",LM,[l("div",TM,[e.$route.name!=="user_profile"?(n(),y(L,{key:0,isOwn:i.isOwn,profile:i.profile},null,8,["isOwn","profile"])):i.profile?(n(),y(M,{key:1,widget_title:e.$t("Recent Activities"),context:{user_id:i.profile.user_id}},null,8,["widget_title","context"])):_("",!0)])])]),_:1})):_("",!0)]),_:1})]),_:1})]),_:1})}const PM=I(bM,[["render",FM]]),IM={name:"LockedProfile"},EM={class:"space_lock_box"},UM={class:"lock_header"},AM={class:"lock_desc"},BM=["href"];function DM(e,t,s,u,o,i){const m=p("Lock"),f=j;return n(),c("div",EM,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h3",UM,d(e.$t("This profile is private")),1),l("p",AM,d(e.$t("You do not have permission to view this profile's content.")),1),!e.auth.user_id&&e.appVars.allow_signup?(n(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button"},d(e.$t("Login / Signup")),9,BM)):_("",!0)])}const yt=I(IM,[["render",DM]]),RM={name:"ProfileFeeds",components:{AllFeeds:gt,ErrorIcon:mo,LockedProfile:yt},props:["profile","isOwn","username"],emits:["refetch"],methods:{openScheduledPosts(){this.$router.push({name:"user_scheduled_posts"})}}},xM={key:0,class:"fcom_feed_report_wrap"},HM={class:"fcom_feed_report_content"},OM={class:"fcom_feed_report_action"};function jM(e,t,s,u,o,i){const m=p("LockedProfile"),f=p("ErrorIcon"),h=H,g=p("all-feeds");return s.profile.is_restricted?(n(),y(m,{key:0})):(n(),c(F,{key:1},[s.profile.scheduled_posts_count?(n(),c("div",xM,[l("div",HM,[a(f),l("span",null,d(e.$t("You currently have %s scheduled posts to be published",s.profile.scheduled_posts_count)),1)]),l("div",OM,[a(h,{onClick:t[0]||(t[0]=w=>i.openScheduledPosts())},{default:r(()=>[V(d(e.$t("View Posts")),1)]),_:1})])])):_("",!0),a(g,{feed_name:"profile_feed",require_space_selection:e.appVars.features.disable_global_posts,user_id:s.profile.user_id,hide_create_form:s.profile.user_id!=e.auth.user_id},null,8,["require_space_selection","user_id","hide_create_form"])],64))}const NM=I(RM,[["render",jM]]),zM={name:"ScheduledPosts",components:{Feed:nt,Pagination:$e,EditFeed:hs,AlarmClock:pi},props:["profile","isOwn","username"],emits:["refetch"],data(){return{loading:!1,saving:!1,scheduleModalVisible:!1,popoverVisible:null,scheduleForm:this.initScheduleForm(),feeds:[],isEdit:!1,editingFeed:null,pagination:{page:1,per_page:10,total:0,last_page:0}}},computed:{isPostCount(){return this.profile.scheduled_posts_count},isPopoverVisible(){return e=>this.popoverVisible===e.id},isDateDisabled(){return e=>e<new Date().setHours(0,0,0,0)},getStartTime(){if(!this.scheduleForm.date||!this.isToday(this.scheduleForm.date))return"00:00";const t=this.dayjs().add(30,"minute");if(!this.isToday(t.toDate()))return"23:50";const s=t.format("HH");let u=parseInt(t.format("mm"),10);return u=Math.ceil(u/10)*10,u===60?this.dayjs(t).add(1,"hour").format("HH")+":00":s+":"+(u<10?"0":"")+u}},methods:{initScheduleForm(){return{id:null,date:"",time:""}},getScheduledTime(e){return this.$t("%1$s at %2$s",this.formattedDate(e),this.formattedTime(e))},getSpaceRoute(e){return{name:"space_feeds",params:{space:e}}},cancelReschedule(){this.scheduleModalVisible=!1},initReschedule(e){this.scheduleModalVisible=!0,this.scheduleForm.id=e.id,this.scheduleForm.date=this.dayjs(e.scheduled_at).format("YYYY-MM-DD"),this.scheduleForm.time=this.dayjs(e.scheduled_at).format(this.siteTimeFormat)},togglePopover(e){this.popoverVisible===e.id?this.popoverVisible=null:this.popoverVisible=e.id},hidePopover(e){this.popoverVisible===e.id&&(this.popoverVisible=null)},updateFeed(e){const t=this.feeds.findIndex(s=>s.id===e.id);t!==-1&&(this.feeds[t]=e),this.editingFeed=null},removeFeed(e){this.feeds=this.feeds.filter(t=>t.id!==e)},editItem(e){this.popoverVisible=!1,this.editingFeed=e,this.isEdit=!0},deleteItem(e){this.popoverVisible=!1,this.$confirm(this.$t("Are you sure you want to delete this feed?"),this.$t("Warning"),{confirmButtonText:this.$t("Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.saving=!0,this.$del("feeds/"+e.id).then(t=>{this.removeFeed(e.id),this.$notify.success(this.$t("Feed deleted successfully"))}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})})},copyFeedLink(e){this.popoverVisible=!1,this.$toClipboard(e.permalink)},publishNow(e){this.saving=!0,this.$post("scheduled-posts/publish/"+e.id).then(t=>{this.removeFeed(e.id),this.$notify.success(t.message)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})},reschedulePost(){this.saving=!0;const e=`${this.scheduleForm.date} ${this.convertTo24Hour(this.scheduleForm.time)}:00`;this.$put("scheduled-posts/"+this.scheduleForm.id,{scheduled_at:e}).then(t=>{this.scheduleModalVisible=!1,this.scheduleForm=this.initScheduleForm(),this.updateFeed(t.feed),this.$notify.success(t.message)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})},fetchFeeds(){this.loading=!0,this.$get("scheduled-posts",{page:this.pagination.page,per_page:this.pagination.per_page,user_id:this.profile.user_id}).then(e=>{this.feeds=e.feeds.data,this.pagination.total=e.feeds.total,this.pagination.last_page=e.feeds.last_page}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.changeTitle(this.$t("Scheduled Posts")),(this.isAdmin()||this.auth.user_id==this.profile.user_id)&&this.fetchFeeds()}},qM={class:"scheduled_posts_header"},GM={class:"fcom_scheduled_posts_title"},YM={key:0},WM={key:1},KM={key:1,class:"fcom_feed_style_timeline fcom_scheduled_posts"},ZM={class:"all_feeds_holder"},JM={class:"actions_items"},QM=["onClick"],XM=["onClick"],eL=["onClick"],tL={class:"feed_user"},sL={class:"feed_user_name"},oL={class:"feed_meta_info"},iL=["title","href"],nL={key:0},lL={class:"post_actions"},aL={key:2,class:"feed_outer"},rL={class:"feed"},cL={style:{"text-align":"center"},class:"feed_body not_found"},dL={class:"dialog_header"},uL={class:"dialog_left schedule_header_left"},_L={class:"dialog_body"},mL={class:"dialog_footer"};function hL(e,t,s,u,o,i){const m=p("AlarmClock"),f=j,h=Z,g=p("MoreFilled"),w=H,b=ye,S=p("UserAvatar"),k=p("UserRouteLink"),$=p("router-link"),v=p("feed"),C=p("edit-feed"),L=Xe,M=ue,E=Hs,T=_e,P=be,U=p("pagination");return n(),c(F,null,[l("div",qM,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("div",GM,[l("h3",null,d(e.$t("Scheduled Posts")),1),i.isPostCount?(n(),c("p",YM,d(e.$t("You currently have %s scheduled posts to be published",s.profile.scheduled_posts_count)),1)):(n(),c("p",WM,d(e.$t("You have no scheduled posts to be published")),1))])]),o.loading?(n(),y(h,{key:0,class:"fcom_mt_20 white_loaded",rows:5,animated:!0})):o.feeds.length?(n(),c("div",KM,[l("div",ZM,[(n(!0),c(F,null,x(o.feeds,D=>(n(),c("div",{key:D.id,class:"feed_outer"},[a(v,{feed:D,layout_style:"timeline",hide_create_form:!0,show_footer:!1,show_actions:!1},{after_feed_actions:r(()=>[a(b,{persistent:!1,ref_for:!0,ref:"actionsPopover",placement:"bottom",width:200,trigger:"click",visible:i.isPopoverVisible(D),teleported:!1,"popper-class":"fcom_menu_below_nav",onHide:A=>i.hidePopover(D)},{reference:r(()=>[a(w,{"aria-label":e.$t("View Post actions"),class:"fcom_dot_menu",size:"small",text:"",onClick:A=>i.togglePopover(D)},{default:r(()=>[a(f,null,{default:r(()=>[a(g)]),_:1})]),_:2},1032,["aria-label","onClick"])]),default:r(()=>[l("ul",JM,[l("li",{onClick:A=>i.copyFeedLink(D)},d(e.$t("Copy Link")),9,QM),e.canEditFeed(D)?(n(),c("li",{key:0,onClick:A=>i.editItem(D)},d(e.$t("Edit")),9,XM)):_("",!0),e.canDeleteFeed(D)?(n(),c("li",{key:1,onClick:A=>i.deleteItem(D)},d(e.$t("Delete")),9,eL)):_("",!0)])]),_:2},1032,["visible","onHide"])]),after_feed_header:r(()=>[l("div",tL,[a(S,{with_level:!1,xprofile:s.profile},null,8,["xprofile"]),l("div",null,[l("div",sL,[a(k,{show_badge:!0,xprofile:s.profile},null,8,["xprofile"])]),l("div",oL,[l("a",{title:D.created_at,onClick:t[0]||(t[0]=(...A)=>e.gotoFeed&&e.gotoFeed(...A)),href:D.permalink,class:"feed_timestamp"},d(i.getScheduledTime(D.scheduled_at)),9,iL),D.space?(n(),c("span",nL,[a($,{to:i.getSpaceRoute(D.space.slug),class:"feed_timestamp"},{default:r(()=>[V(d(e.$t("Posted in %s",e.getExcerpt(D.space.title,30))),1)]),_:2},1032,["to"])])):_("",!0)])])])]),after_feed_footer:r(()=>[l("div",lL,[a(w,{class:"fcom_secondary_button",onClick:A=>i.initReschedule(D),disabled:o.saving},{default:r(()=>[V(d(e.$t("Reschedule Post")),1)]),_:2},1032,["onClick","disabled"]),a(w,{class:"fcom_secondary_button",onClick:A=>i.publishNow(D),disabled:o.saving},{default:r(()=>[V(d(e.$t("Publish Now")),1)]),_:2},1032,["onClick","disabled"])])]),_:2},1032,["feed"])]))),128)),o.isEdit&&o.editingFeed?(n(),y(C,{key:0,feedSlug:o.editingFeed.slug,dialogVisible:o.isEdit,onUpdated:i.updateFeed,hide_create_form:!1,onClose:t[1]||(t[1]=D=>o.isEdit=!1)},null,8,["feedSlug","dialogVisible","onUpdated"])):_("",!0)])])):(n(),c("div",aL,[l("div",rL,[l("div",cL,[l("p",null,d(e.$t("No scheduled posts found!")),1)])])])),a(P,{modelValue:o.scheduleModalVisible,"onUpdate:modelValue":t[4]||(t[4]=D=>o.scheduleModalVisible=D),width:e.modalWidth,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1,onClose:i.cancelReschedule},{header:r(()=>[l("div",dL,[l("div",uL,[l("h4",null,d(e.$t("Reschedule Post")),1),l("p",null,d(e.$t("Choose a date and time in the future when you want your post to be published")),1)])])]),footer:r(()=>[l("div",mL,[a(w,{class:"fcom_secondary_button",disabled:o.saving,onClick:i.cancelReschedule},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1},8,["disabled","onClick"]),a(w,{class:"fcom_primary_button",disabled:o.saving,onClick:i.reschedulePost},{default:r(()=>[V(d(e.$t("Reschedule")),1)]),_:1},8,["disabled","onClick"])])]),default:r(()=>[l("div",_L,[a(T,{"label-position":"top",class:"fcom_schedule_form"},{default:r(()=>[a(M,{label:e.$t("Date")},{default:r(()=>[a(L,{modelValue:o.scheduleForm.date,"onUpdate:modelValue":t[2]||(t[2]=D=>o.scheduleForm.date=D),type:"date","value-format":"YYYY-MM-DD",format:e.siteDateFormat,placeholder:e.$t("Select Date"),"disabled-date":i.isDateDisabled},null,8,["modelValue","format","placeholder","disabled-date"])]),_:1},8,["label"]),a(M,{label:e.$t("Time")},{default:r(()=>[a(E,{modelValue:o.scheduleForm.time,"onUpdate:modelValue":t[3]||(t[3]=D=>o.scheduleForm.time=D),disabled:!o.scheduleForm.date,style:{width:"210px"},step:"00:10",format:e.siteTimeFormat,start:i.getStartTime,end:"23:59",placeholder:e.$t("Select Time")},null,8,["modelValue","disabled","format","start","placeholder"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["modelValue","width","onClose"]),a(U,{pagination:o.pagination,onFetch:i.fetchFeeds},null,8,["pagination","onFetch"])],64)}const fL=I(zM,[["render",hL]]),pL={name:"UserSpaces",props:["profile"],components:{Calendar:gi,Baseball:yi,GroupIcon:Gt,GlobIcon:Ho,LockedProfile:yt},data(){return{communities:[],loading:!1}},methods:{getBtnLevel(e){return e=="course"?this.$t("View Course"):this.$t("View Space")},goToSpaceFeeds(e){this.$router.push({name:"space_feeds",params:{space:e}})},getExcerpt(e,t){return e.length>t?e.substring(0,t)+"...":e},removeMembership(e){this.$confirm(this.$t("Are you sure you want to remove this space?"),this.$t("Remove Space")).then(()=>{this.$post("spaces/"+e+"/members/remove",{user_id:this.profile.user_id}).then(()=>{this.fetch()}).catch(t=>{this.$handleError(t)})})},fetch(){this.loading=!0,this.$get("profile/"+this.profile.username+"/spaces").then(e=>{this.communities=e.spaces}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){!this.profile.is_restricted&&this.profile.canViewUserSpaces&&this.fetch()}},gL={key:1,class:"user_spaces"},yL={class:"fcom_box_card_list"},vL=["onClick"],bL=["src"],kL=["src"],wL={key:2,class:"fcom_no_image"},CL={class:"fcom_box_card_info"},$L={class:"fcom_box_card_name"},SL={class:"fcom_box_card_details"},VL={class:"details_item"},ML={key:0,class:"details_item"},LL={class:"fcom_box_card_action"},TL=["onClick"],FL={key:0,class:"loading"},PL={key:1},IL={class:"no_members"},EL={key:2,class:"no_members"};function UL(e,t,s,u,o,i){const m=p("LockedProfile"),f=p("router-link"),h=p("MoreFilled"),g=j,w=H,b=ze,S=qe,k=Ge,$=p("GlobIcon"),v=p("Lock"),C=p("GroupIcon"),L=Z;return s.profile.is_restricted?(n(),y(m,{key:0})):(n(),c("div",gL,[l("div",yL,[(n(!0),c(F,null,x(o.communities,M=>{var E;return n(),c("div",{key:M.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:T=>i.goToSpaceFeeds(M.slug)},[(E=M.settings)!=null&&E.og_image?(n(),c("img",{key:0,src:M.settings.og_image,alt:""},null,8,bL)):M.cover_photo?(n(),c("img",{key:1,src:M.cover_photo,alt:""},null,8,kL)):(n(),c("div",wL))],8,vL),l("div",CL,[l("div",$L,[a(f,{class:"user_route",to:{name:"space_feeds",params:{space:M.slug}}},{default:r(()=>[V(d(i.getExcerpt(M.title,30)),1)]),_:2},1032,["to"]),e.isAdmin()?(n(),y(k,{key:0,trigger:"click"},{dropdown:r(()=>[a(S,null,{default:r(()=>[a(b,{onClick:T=>i.removeMembership(M.slug)},{default:r(()=>[V(d(e.$t("Remove from space")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),default:r(()=>[a(w,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)):_("",!0)]),l("div",SL,[l("div",VL,[M.privacy==="public"?(n(),y(g,{key:0},{default:r(()=>[a($)]),_:1})):(n(),y(g,{key:1},{default:r(()=>[a(v)]),_:1})),l("span",null,d(M.privacy==="public"?e.$t("Public"):e.$t("Private")),1)]),M.members_count?(n(),c("div",ML,[a(g,null,{default:r(()=>[a(C)]),_:1}),l("span",null,d(e.$_n("%s Member","%s Members",e.$formatNumber(M.members_count))),1)])):_("",!0)]),l("div",LL,[l("button",{class:"fcom_card_button",onClick:T=>i.goToSpaceFeeds(M.slug)},d(i.getBtnLevel(M.type)),9,TL)])])])}),128))]),o.loading?(n(),c("div",FL,[a(L,{class:"white_loaded",rows:3,animated:!0}),a(L,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):s.profile.canViewUserSpaces?!o.loading&&!o.communities.length?(n(),c("div",EL,d(e.$t("No Spaces found.")),1)):_("",!0):(n(),c("div",PL,[l("div",IL,d(e.$t("Sorry, you do not have permission to view this page")),1)]))]))}const AL=I(pL,[["render",UL]]),BL={name:"AccountDeactivation",props:["profile"],data(){return{selection:"init",working:!1}},methods:{deactivateAccount(){this.working=!0,this.$put("profile/"+this.profile.username,{data:{status:"deactivated"}}).then(e=>{this.$notify.success(e.message),window.location.reload(!0)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1})}}},DL={style:{"margin-top":"30px"},class:"fcom_account_deactivation about_wrap"},RL={class:"about_header"},xL={class:"about_body fcom_mt_10"},HL={class:"fcom_mt_20"};function OL(e,t,s,u,o,i){const m=H;return n(),c("div",DL,[l("div",RL,[l("h3",null,d(e.$t("Account Deactivation")),1)]),l("div",xL,[o.selection=="init"?(n(),c(F,{key:0},[l("p",null,d(e.$t("If you no longer wish to keep your community account, click button below to deactivate your account.")),1),a(m,{onClick:t[0]||(t[0]=f=>o.selection="deactivate"),class:"fcom_secondary_button fcom_mt_20"},{default:r(()=>[V(d(e.$t("Continue to Deactivate Account")),1)]),_:1})],64)):o.selection=="deactivate"?(n(),c(F,{key:1},[l("h4",null,d(e.$t("This will deactivate your account")),1),l("p",null,d(e.$t("Deactivating your account will make your content and profile invisible to others. You will also lose access to the community until you reactivate your account.")),1),l("div",HL,[a(m,{onClick:t[1]||(t[1]=f=>o.selection="init"),class:"fcom_secondary_button"},{default:r(()=>[V(d(e.$t("Go Back")),1)]),_:1}),a(m,{onClick:t[2]||(t[2]=f=>i.deactivateAccount()),type:"danger"},{default:r(()=>[V(d(e.$t("Confirm Account Deactivation")),1)]),_:1})])],64)):_("",!0)])])}const jL=I(BL,[["render",OL]]),NL={name:"UserProfileUpdate",props:["isOwn","profile","username"],emits:["refetch"],components:{SlugInput:Ht,MarkdownEditor:It,AccountDeactivation:jL,InfoFilled:Tt},setup(){const e=De(),t=ce();return{userStore:e,cacheStore:t}},data(){return{updating:!1,loading:!1,notification_settings:{email_on_comment:!1},profileData:{},fcom_is_dirty:!1,fcom_dirty_ready:!1,passwordData:{current_password:"",new_password:"",confirm_password:""},changingPassword:!1}},watch:{profile:{handler(e){e&&(this.fcom_dirty_ready=!1,this.profileData={username:e.username,display_name:e.display_name,first_name:e.first_name,last_name:e.last_name,email:e.email,website:e.website,headline:e.headline||"",short_description:e.short_description,user_id:e.user_id,is_verified:e.is_verified,is_flagged:e.is_flagged||"no",social_links:e.social_links||{},badge_slugs:e.badge_slugs,status:e.status,custom_fields:this.getCustomFieldValues(e)},this.$nextTick(()=>{this.fcom_is_dirty=!1,this.fcom_dirty_ready=!0}))},immediate:!0},profileData:{handler(){this.fcom_dirty_ready&&(this.fcom_is_dirty=!0)},deep:!0}},computed:{customFieldGroups(){return this.profile.custom_field_groups||[]},canFlagMember(){return this.has_pro&&this.appVars.moderationConfig&&this.appVars.moderationConfig.is_enabled==="yes"}},methods:{async updateProfile(){this.updating=!0;try{const e=await this.$post(`profile/${this.username}`,{data:this.profileData});if(e.redirect_url){window.location.href=e.redirect_url;return}const t=e.profile;this.username!==t.username&&(delete this.userStore.profilesByUsername[this.username],this.cacheStore.invalidate(`user-profile:${this.username}`)),this.userStore.profilesByUsername[t.username]=t,this.cacheStore.invalidate(`user-profile:${t.username}`),this.fcom_is_dirty=!1,this.$notify.success(this.$t("Profile updated successfully")),t.user_id==this.auth.user_id&&(this.auth.compilation_score=t.compilation_score),this.username!==t.username&&this.$router.push({name:"update_profile",params:{username:t.username}}),this.$emit("refetch")}catch(e){this.$handleError(e)}finally{this.updating=!1}},async changePassword(){var e;if(!this.passwordData.current_password||!this.passwordData.new_password){this.$notify.error(this.$t("Please fill in all password fields"));return}if(this.passwordData.new_password!==this.passwordData.confirm_password){this.$notify.error(this.$t("New password and confirmation do not match"));return}if(this.passwordData.current_password===this.passwordData.new_password){this.$notify.error(this.$t("New password must be different from your current password"));return}this.changingPassword=!0;try{const t=await this.$post(`profile/${this.username}/change-password`,{data:this.passwordData});t.rest_nonce&&((e=window.fluentComAdmin)!=null&&e.rest)&&(window.fluentComAdmin.rest.nonce=t.rest_nonce),t.ajax_nonce&&window.fluentComAdmin&&(window.fluentComAdmin.ajax_nonce=t.ajax_nonce),this.$notify.success(t.message||this.$t("Password changed successfully")),this.passwordData={current_password:"",new_password:"",confirm_password:""}}catch(t){this.$handleError(t)}finally{this.changingPassword=!1}},isEmpty:cs,getCustomFieldValues(e){const t={},s=e.custom_field_groups||[];for(const u of s)for(const o of u.fields||[])o.slug&&(t[o.slug]=o.value!==void 0?o.value:"");return t}},async mounted(){await this.userStore.fetchProfile(this.username,!0)}},zL={key:0,class:"fcom_sub_group fcom_additional_info"},qL={class:"fcom_sub_group_header"},GL={key:0},YL={class:"fcom_sub_group_content"},WL={key:0,class:"fcom_sub_group"},KL={class:"fcom_sub_group_header"},ZL={class:"fcom_sub_group_content"},JL={key:1,class:"fcom_mb_20"},QL={key:0,class:"fcom_sub_group"},XL={class:"fcom_sub_group_header"},eT={key:0,class:"fcom_help_text"},tT={id:"fcom_flag_member_help"},sT={key:2},oT={style:{color:"var(--el-color-danger, red)"},class:"help_msg"},iT={key:3,class:"help_msg"},nT={class:"fcom_sub_group"},lT={class:"fcom_fixed_bottom_overlay"},aT={key:0,class:"fcom_update_profile fcom_change_password"},rT={class:"fcom_sub_group"},cT={class:"fcom_sub_group_header"},dT={class:"fcom_change_password_content"};function uT(e,t,s,u,o,i){const m=se,f=ue,h=ht,g=ft,w=p("InfoFilled"),b=j,S=Ue,k=p("markdown-editor"),$=Xe,v=ne,C=le,L=Re,M=ve,E=he,T=p("UserBadge"),P=p("slug-input"),U=H,D=_e,A=p("account-deactivation"),q=te("loading");return n(),c(F,null,[l("div",{class:R([{fcom_is_dirty:o.fcom_is_dirty},"fcom_update_profile"])},[a(D,{onSubmit:t[11]||(t[11]=z(O=>e.doNothing(),["prevent"])),"label-position":"top",modelValue:o.profileData,"onUpdate:modelValue":t[12]||(t[12]=O=>o.profileData=O)},{default:r(()=>[a(g,{gutter:30},{default:r(()=>[a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("First Name"),required:""},{default:r(()=>[a(m,{modelValue:o.profileData.first_name,"onUpdate:modelValue":t[0]||(t[0]=O=>o.profileData.first_name=O)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("Last Name")},{default:r(()=>[a(m,{modelValue:o.profileData.last_name,"onUpdate:modelValue":t[1]||(t[1]=O=>o.profileData.last_name=O)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),a(g,{gutter:30},{default:r(()=>[a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("Email")},{default:r(()=>[a(m,{disabled:!s.profile.can_change_email,modelValue:o.profileData.email,"onUpdate:modelValue":t[2]||(t[2]=O=>o.profileData.email=O)},null,8,["disabled","modelValue"])]),_:1},8,["label"])]),_:1}),a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("Website URL")},{default:r(()=>[a(m,{type:"url",modelValue:o.profileData.website,"onUpdate:modelValue":t[3]||(t[3]=O=>o.profileData.website=O)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),a(f,null,{label:r(()=>[V(d(e.$t("Headline"))+" ",1),a(S,{effect:"dark",placement:"top",content:e.$t("A short tagline shown on the members list.")},{default:r(()=>[a(b,{class:"fcom_label_tooltip",role:"button",tabindex:"0","aria-label":e.$t("A short tagline shown on the members list.")},{default:r(()=>[a(w)]),_:1},8,["aria-label"])]),_:1},8,["content"])]),default:r(()=>[a(m,{modelValue:o.profileData.headline,"onUpdate:modelValue":t[4]||(t[4]=O=>o.profileData.headline=O),maxlength:"60","show-word-limit":""},null,8,["modelValue"])]),_:1}),a(f,{class:"fcom_editor_input_wrap",label:e.$t("Short Bio")},{default:r(()=>[a(k,{disable_mention:!0,disable_media:!0,modelValue:o.profileData.short_description,"onUpdate:modelValue":t[5]||(t[5]=O=>o.profileData.short_description=O)},null,8,["modelValue"])]),_:1},8,["label"]),(n(!0),c(F,null,x(i.customFieldGroups,O=>(n(),c(F,{key:O.slug},[O.fields&&O.fields.length?(n(),c("div",zL,[l("div",qL,[l("h5",null,d(O.label),1),O.edit_description?(n(),c("p",GL,d(O.edit_description),1)):_("",!0)]),l("div",YL,[(n(!0),c(F,null,x(O.fields,N=>(n(),y(f,{key:N.slug,label:N.label,required:N.is_required},{default:r(()=>[N.type==="text"?(n(),y(m,{key:0,modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[N.slug]=G,placeholder:N.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):N.type==="textarea"?(n(),y(m,{key:1,type:"textarea",rows:3,modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[N.slug]=G,placeholder:N.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):N.type==="number"?(n(),y(m,{key:2,type:"number",modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[N.slug]=G,placeholder:N.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):N.type==="date"?(n(),y($,{key:3,modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[N.slug]=G,type:"date","value-format":"YYYY-MM-DD",placeholder:N.placeholder,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"])):N.type==="select"?(n(),y(C,{key:4,modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[N.slug]=G,placeholder:N.placeholder,"value-on-clear":"",clearable:""},{default:r(()=>[(n(!0),c(F,null,x(N.options,G=>(n(),y(v,{key:G,label:G,value:G},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):N.type==="multiselect"?(n(),y(C,{key:5,modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[N.slug]=G,placeholder:N.placeholder,multiple:!0,clearable:""},{default:r(()=>[(n(!0),c(F,null,x(N.options,(G,ae)=>(n(),y(v,{key:ae,label:G,value:ae},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):N.type==="radio"?(n(),y(M,{key:6,modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[N.slug]=G},{default:r(()=>[(n(!0),c(F,null,x(N.options,G=>(n(),y(L,{key:G,value:G},{default:r(()=>[V(d(G),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):N.type==="url"?(n(),y(m,{key:7,type:"url",modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[N.slug]=G,placeholder:N.placeholder||"https://"},null,8,["modelValue","onUpdate:modelValue","placeholder"])):_("",!0)]),_:2},1032,["label","required"]))),128))])])):_("",!0)],64))),128)),i.isEmpty(e.appVars.socialLinkProviders)?_("",!0):(n(),c("div",WL,[l("div",KL,[l("h5",null,d(e.$t("Social Links")),1),l("p",null,d(e.$t("Add your social media profile link.")),1)]),l("div",ZL,[(n(!0),c(F,null,x(e.appVars.socialLinkProviders,(O,N)=>(n(),y(f,{key:N,label:O.title},{default:r(()=>[a(m,{placeholder:O.placeholder,modelValue:o.profileData.social_links[N],"onUpdate:modelValue":G=>o.profileData.social_links[N]=G},{prepend:r(()=>[a(b,{innerHTML:O.icon_svg},null,8,["innerHTML"]),l("span",null,d(O.domain),1)]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]))),128))])])),s.profile.can_change_username?(n(),c("div",JL,[e.hasPermission("super_admin")?(n(),c("div",QL,[l("div",XL,[l("h5",null,d(e.$t("Admin Actions")),1),l("p",null,d(e.$t("Admin tools for account verification and status management.")),1)]),a(f,{label:e.$t("Account Verification"),class:"checkbox_label"},{default:r(()=>[a(E,{"true-value":1,"false-value":0,modelValue:o.profileData.is_verified,"onUpdate:modelValue":t[6]||(t[6]=O=>o.profileData.is_verified=O),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Mark this account as verified")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"]),i.canFlagMember?(n(),y(f,{key:0,class:"checkbox_label"},{label:r(()=>[V(d(e.$t("Moderate Posts and Comments"))+" ",1),a(S,{effect:"dark",placement:"top",content:e.$t("Require all future posts or comments posted by this member to be approved by an admin")},{default:r(()=>[a(b,{class:"fcom_label_tooltip",role:"button",tabindex:"0","aria-label":e.$t("Require all future posts or comments posted by this member to be approved by an admin")},{default:r(()=>[a(w)]),_:1},8,["aria-label"])]),_:1},8,["content"])]),default:r(()=>[a(E,{disabled:s.profile.is_moderator==="yes","aria-describedby":s.profile.is_moderator==="yes"?"fcom_flag_member_help":null,"true-value":"yes","false-value":"no",modelValue:o.profileData.is_flagged,"onUpdate:modelValue":t[7]||(t[7]=O=>o.profileData.is_flagged=O),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Require approval for new posts and comments")),1)]),_:1},8,["disabled","aria-describedby","modelValue"]),s.profile.is_moderator==="yes"?(n(),c("div",eT,[l("p",tT,d(e.$t("Admin or moderator accounts cannot be moderated")),1)])):_("",!0)]),_:1})):_("",!0),e.appVars.user_badges?(n(),y(f,{key:1,label:e.$t("Profile Badges")},{default:r(()=>[a(C,{clearable:"",multiple:!0,modelValue:o.profileData.badge_slugs,"onUpdate:modelValue":t[8]||(t[8]=O=>o.profileData.badge_slugs=O),placeholder:e.$t("User Profile Badge")},{default:r(()=>[(n(!0),c(F,null,x(e.appVars.user_badges,O=>(n(),y(v,{key:O.slug,label:O.title,value:O.slug},{default:r(()=>[a(T,{badge:O,is_preview:!0},null,8,["badge"])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(f,{label:e.$t("Access Status")},{default:r(()=>[a(M,{modelValue:o.profileData.status,"onUpdate:modelValue":t[9]||(t[9]=O=>o.profileData.status=O),class:"fcom_radio_group"},{default:r(()=>[a(L,{value:"active"},{default:r(()=>[V(d(e.$t("Active")),1)]),_:1}),a(L,{value:"pending"},{default:r(()=>[V(d(e.$t("Pending")),1)]),_:1}),a(L,{value:"blocked"},{default:r(()=>[V(d(e.$t("Blocked")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),o.profileData.status?o.profileData.status!="active"?(n(),c("div",iT,[l("p",null,d(e.$t("The user cannot access the portal.")),1)])):_("",!0):(n(),c("div",sT,[l("p",oT,d(e.$t("This user deactivated his/her account from the self managed profile section. if you want to reactivate the account, please select an updated status.")),1)]))])):_("",!0),l("div",nT,[a(f,{label:e.$t("Community Account Username")},{default:r(()=>[a(P,{is_inital_inactive:!0,modelValue:o.profileData.username,"onUpdate:modelValue":t[10]||(t[10]=O=>o.profileData.username=O),prefix:"@","pop-message":e.$t("Are you sure you want to change username?"),edit_notice:e.$t("Please choose a username matching with your first/last name or full name"),placeholder:e.$t("Username")},null,8,["modelValue","pop-message","edit_notice","placeholder"])]),_:1},8,["label"])])])):_("",!0),a(f,null,{default:r(()=>[l("div",lT,[W((n(),y(U,{class:"fcom_primary_button",onClick:i.updateProfile,disabled:o.updating},{default:r(()=>[V(d(e.$t("Save Changes")),1)]),_:1},8,["onClick","disabled"])),[[q,o.updating]])])]),_:1})]),_:1},8,["modelValue"])],2),s.profile.username==e.appVars.auth.username&&s.profile.can_change_password?(n(),c("div",aT,[a(D,{onSubmit:t[16]||(t[16]=z(()=>{},["prevent"])),"label-position":"top"},{default:r(()=>[l("div",rT,[l("div",cT,[l("h5",null,d(e.$t("Change Password")),1),l("p",null,d(e.$t("Update the password you use to log in.")),1)]),l("div",dT,[a(f,{label:e.$t("Current Password"),required:""},{default:r(()=>[a(m,{type:"password","show-password":"",autocomplete:"current-password",modelValue:o.passwordData.current_password,"onUpdate:modelValue":t[13]||(t[13]=O=>o.passwordData.current_password=O)},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("New Password"),required:""},{default:r(()=>[a(m,{type:"password","show-password":"",autocomplete:"new-password",modelValue:o.passwordData.new_password,"onUpdate:modelValue":t[14]||(t[14]=O=>o.passwordData.new_password=O)},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("Confirm New Password"),required:""},{default:r(()=>[a(m,{type:"password","show-password":"",autocomplete:"new-password",modelValue:o.passwordData.confirm_password,"onUpdate:modelValue":t[15]||(t[15]=O=>o.passwordData.confirm_password=O)},null,8,["modelValue"])]),_:1},8,["label"]),a(f,null,{default:r(()=>[W((n(),y(U,{class:"fcom_primary_button",onClick:i.changePassword,disabled:o.changingPassword},{default:r(()=>[V(d(e.$t("Change Password")),1)]),_:1},8,["onClick","disabled"])),[[q,o.changingPassword]])]),_:1})])])]),_:1})])):_("",!0),e.hasFeature("can_deactivate_account")&&s.profile.username==e.appVars.auth.username?(n(),y(A,{key:1,profile:s.profile},null,8,["profile"])):_("",!0)],64)}const _T=I(NL,[["render",uT]]),mT={name:"UserAbout",props:["profile","isOwn"],components:{Timer:Xs,CalendarIcon:yo,LockedProfile:yt},computed:{hasSocialLinks(){return this.socialLinks.length>0},visibleGroups(){return(this.profile.custom_field_groups||[]).filter(t=>t.fields&&t.fields.some(s=>this.hasFieldValue(s.value)))},socialLinks(){var u,o;let e=(u=this.profile)==null?void 0:u.social_links;e||(e=(o=this.profile.meta)==null?void 0:o.social_links);const t=[];if(this.profile.website&&t.push({title:this.$t("Website"),icon:'<svg viewBox="0 0 40 20" fill="currentColor"><path d="M3.8 10C3.8 6.58 6.58 3.8 10 3.8H18V0H10C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20H18V16.2H10C6.58 16.2 3.8 13.42 3.8 10ZM12 12H28V8H12V12ZM30 0H22V3.8H30C33.42 3.8 36.2 6.58 36.2 10C36.2 13.42 33.42 16.2 30 16.2H22V20H30C35.52 20 40 15.52 40 10C40 4.48 35.52 0 30 0Z"></path></svg>',text:this.profile.website,url:this.profile.website}),!e)return t;const s=this.appVars.socialLinkProviders;return Object.entries(s).forEach(([i,m])=>{e[i]&&t.push({title:m.title,icon:m.icon_svg,text:e[i],url:m.domain+e[i]})}),t}},methods:{goToUpdateProfile(){this.$router.push({name:"update_profile",params:{username:this.profile.username}})},hasFieldValue(e){return Array.isArray(e)?e.length>0:e!=null&&e!==""},formatFieldValue(e){return e.type==="multiselect"&&Array.isArray(e.value)&&e.options?e.value.map(t=>e.options[t]||t).join(", "):e.value}}},hT={key:1,class:"about_wrap"},fT={class:"about_header"},pT={key:0,class:"about_body"},gT=["innerHTML"],yT={key:1},vT={class:"about_items"},bT=["title"],kT=["title"],wT={class:"items_title"},CT={key:0,class:"about_item"},$T={class:"about_item_label"},ST=["href"],VT={key:2,class:"about_items"},MT={key:0,class:"items_title"},LT=["href","title"];function TT(e,t,s,u,o,i){const m=p("LockedProfile"),f=p("EditPen"),h=j,g=H,w=p("CalendarIcon"),b=p("Timer"),S=Z;return s.profile.is_restricted?(n(),y(m,{key:0})):(n(),c("div",hT,[l("div",fT,[l("h3",null,d(e.$t("About")),1),s.isOwn?(n(),y(g,{key:0,"aria-label":"Edit your profile description",onClick:i.goToUpdateProfile,text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(f)]),_:1})]),_:1},8,["onClick"])):_("",!0)]),s.profile?(n(),c("div",pT,[s.profile.short_description_rendered?(n(),c("div",{key:0,class:"about_description feed_texts feed_md_content",innerHTML:s.profile.short_description_rendered},null,8,gT)):s.isOwn?(n(),c("div",yT,[a(g,{class:"fcom_plain_button",onClick:t[0]||(t[0]=k=>e.$router.push({name:"update_profile",params:{username:s.profile.username}}))},{default:r(()=>[l("span",null,d("+ "+e.$t("Add your profile description")),1)]),_:1})])):_("",!0),l("div",vT,[s.profile.created_at?(n(),c("div",{key:0,title:s.profile.created_at,class:"about_item"},[a(h,null,{default:r(()=>[a(w)]),_:1}),l("span",null,d(e.$t("Joined %s",e.humanDateDiff(s.profile.created_at))),1)],8,bT)):_("",!0),s.profile.last_activity?(n(),c("div",{key:1,title:s.profile.last_activity,class:"about_item"},[a(h,null,{default:r(()=>[a(b)]),_:1}),V(" "+d(e.$t("Last seen: %s",e.humanDateDiff(s.profile.last_activity))),1)],8,kT)):_("",!0)]),(n(!0),c(F,null,x(i.visibleGroups,k=>(n(),c("div",{key:k.slug,class:"about_items"},[l("div",wT,d(k.label),1),(n(!0),c(F,null,x(k.fields,$=>(n(),c(F,{key:$.slug},[i.hasFieldValue($.value)?(n(),c("div",CT,[l("span",$T,d($.label)+":",1),$.type==="url"&&$.value?(n(),c("a",{key:0,href:$.value,target:"_blank",rel:"noopener noreferrer"},d($.value),9,ST)):(n(),c("span",{key:1,class:R({about_item_multiline:$.type==="textarea"})},d(i.formatFieldValue($)),3))])):_("",!0)],64))),128))]))),128)),i.hasSocialLinks||s.isOwn?(n(),c("div",VT,[i.hasSocialLinks?(n(),c("div",MT,d(e.$t("Social Links")),1)):_("",!0),(n(!0),c(F,null,x(i.socialLinks,k=>(n(),c("a",{target:"_blank",rel:"noopener noreferrer",href:k.url,key:k.title,title:k.title,class:"about_item"},[a(h,{innerHTML:k.icon},null,8,["innerHTML"]),V(" "+d(k.text),1)],8,LT))),128)),s.isOwn&&!i.hasSocialLinks?(n(),y(g,{key:1,class:"fcom_plain_button",onClick:i.goToUpdateProfile},{default:r(()=>[l("span",null,d("+ "+e.$t("Add social links")),1)]),_:1},8,["onClick"])):_("",!0)])):_("",!0)])):(n(),y(S,{key:1,animated:!0}))]))}const FT=I(mT,[["render",TT]]),PT={name:"UserComments",props:["profile","username","isOwn"],emits:["refetch"],components:{Pagination:$e,Check:eo,ImageIcon:us,FeedMdContent:At,LockedProfile:yt},data(){return{comments:[],loading:!0,pagination:{page:1,per_page:10,total:0},working:!1,replyingComemnt:null,isReplying:!1,expandedMap:{},canExpandMap:{}}},methods:{fetchComments(){this.loading=!0,this.$get("profile/"+this.username+"/comments",{page:this.pagination.page,per_page:this.pagination.per_page}).then(e=>{this.comments=e.comments.data,this.pagination.total=e.comments.total,this.expandedMap={},this.canExpandMap={},window.scrollTo(0,0)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1,this.$nextTick(()=>{this.checkOverflow()})})},deleteComment(e,t){this.$confirm(this.$t("Are you sure you want to delete this comment and associated data?"),"Warning",{confirmButtonText:this.$t("Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.working=!0,this.$del("feeds/"+e.post_id+"/comments/"+e.id).then(s=>{this.comments.splice(t,1),this.$notify.success(s.message)}).catch(s=>{this.$handleError(s)}).finally(()=>{this.working=!1})})},initCommentReply(e){this.replyingComemnt=e,this.$nextTick(()=>{this.isReplying=!0})},limitCharacters(e,t){return e.slice(0,t)+(e.length>t?"...":"")},getPostRoute(e){var s;let t=(s=e.post)==null?void 0:s.type;return!t||!e.post?{name:"all_feeds"}:t=="text"||t=="article"?{name:"single_feed",params:{feed_slug:e.post.slug},query:{comment_id:e.id}}:t=="course_lesson"&&e.post.space?{name:"view_lesson",params:{course_slug:e.post.space.slug,lesson_slug:e.post.slug},query:{comment_id:e.id}}:{name:"all_feeds",query:{comment_id:e.id,post_id:e.post.id}}},getPostHref(e){return this.$router.resolve(this.getPostRoute(e)).href},canOpenInModal(e){var t,s;return!this.hasFeature("show_post_modal")||((t=e.post)==null?void 0:t.type)!="text"?!1:!!((s=e.post)!=null&&s.permalink)},openPost(e,t){if(!(t.ctrlKey||t.metaKey||t.shiftKey||t.button===1)){if(t.preventDefault(),!this.canOpenInModal(e)){this.$router.push(this.getPostRoute(e));return}this.$eventBus.emit("showFeedModal",{feed:e.post,view:"comments",highlight_comment_id:e.id})}},getPostExcerpt(e){if(!e)return"";let t=e.type;t=="text"&&(t="");let s="";return e.title?s=e.title:s=this.getExcerpt(e.message,50),s+(t?" ("+t+")":"")},contentClass(e){return"comment_text_body"+(this.expandedMap[e]?"":" clamped")},toggleExpand(e){this.expandedMap={...this.expandedMap,[e]:!this.expandedMap[e]}},checkOverflow(){const e=this.$refs.commentBody||[],t=this.comments.filter(u=>u.message_rendered),s={};e.forEach((u,o)=>{var f;const i=(f=u==null?void 0:u.$refs)==null?void 0:f.content,m=t[o];i&&m&&(s[m.id]=i.scrollHeight>i.clientHeight+1)}),this.canExpandMap=s}},mounted(){this.profile.is_restricted||this.fetchComments()}},IT={key:1,class:"white_loaded"},ET={class:"course_comments feed_comments user_comments"},UT=l("span",{class:"comment_icon"},null,-1),AT={class:"comment_text_head"},BT=["title"],DT={class:"comment_action"},RT={class:"comment_text_head_post"},xT=["href","aria-haspopup","onClick"],HT={class:"comment_text"},OT=["onClick"],jT={key:1,class:"comment_text_body feed_md_content media_only_content"},NT={key:0};function zT(e,t,s,u,o,i){const m=p("LockedProfile"),f=Z,h=p("Delete"),g=j,w=H,b=p("FeedMdContent"),S=p("ImageIcon"),k=p("pagination");return s.profile.is_restricted?(n(),y(m,{key:0})):o.loading?(n(),c("div",IT,[a(f,{row:5})])):(n(),c(F,{key:2},[l("div",ET,[(n(!0),c(F,null,x(o.comments,($,v)=>(n(),c("div",{key:$.id,class:"fcom_course_comment each_comment"},[UT,l("div",AT,[l("div",{title:$.created_at,class:"comment_text_head_time"},d(e.humanDateDiff($.created_at)),9,BT),l("div",DT,[s.isOwn?(n(),y(w,{key:0,class:"fcom_plain_button",onClick:C=>i.deleteComment($,v)},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1})]),_:2},1032,["onClick"])):_("",!0)])]),l("div",RT,[l("a",{class:"post_link",href:i.getPostHref($),"aria-haspopup":i.canOpenInModal($)?"dialog":null,onClick:C=>i.openPost($,C)},d(i.getPostExcerpt($.post)),9,xT)]),l("div",HT,[$.message_rendered?(n(),c(F,{key:0},[a(b,{ref_for:!0,ref:"commentBody",class_name:i.contentClass($.id),content:$.message_rendered},null,8,["class_name","content"]),o.canExpandMap[$.id]?(n(),c("button",{key:0,type:"button",class:"fcom_see_more_btn",onClick:C=>i.toggleExpand($.id)},d(o.expandedMap[$.id]?e.$t("See less"):e.$t("See more")),9,OT)):_("",!0)],64)):(n(),c("div",jT,[a(S,{class:"fcom_status_img_icon"})]))])]))),128)),o.pagination.total?_("",!0):(n(),c("div",NT,[l("h5",null,d(e.$t("%s did not add any comment to any posts yet",s.profile.display_name)),1)]))]),a(k,{pagination:o.pagination,onFetch:i.fetchComments},null,8,["pagination","onFetch"])],64))}const qT=I(PT,[["render",zT]]),GT={name:"UserCourses",props:["profile","isOwn"],components:{MoreFilled:to,GroupIcon:Gt,LockedProfile:yt},data(){return{courses:[],loading:!1}},watch:{"profile.user_id"(e,t){!e||e===t||(this.courses=[],this.hasFeature("has_course")&&!this.profile.is_restricted&&this.profile.canViewUserSpaces&&this.fetch())}},methods:{goToCourse(e){this.$router.push({name:"view_course",params:{course_slug:e}})},removeMembership(e){this.$confirm(this.$t("Are you sure you want to remove this course?"),this.$t("Remove Course")).then(()=>{this.$post("spaces/"+e+"/members/remove",{user_id:this.profile.user_id}).then(()=>{this.fetch()}).catch(t=>{this.$handleError(t)})})},fetch(){this.loading=!0,this.$get("profile/"+this.profile.username+"/courses").then(e=>{this.courses=e.courses||[]}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){if(!this.hasFeature("has_course")){this.$router.replace({name:"user_profile",params:{username:this.profile.username}});return}!this.profile.is_restricted&&this.profile.canViewUserSpaces&&this.fetch()}},YT={key:1,class:"user_courses"},WT={key:0,class:"fcom_box_card_list"},KT=["onClick"],ZT=["src","alt","onError"],JT={key:1,class:"fcom_no_image"},QT={class:"fcom_box_card_info"},XT={class:"fcom_box_card_name"},eF={class:"fcom_box_card_details"},tF={class:"inline_details"},sF=l("span",{class:"fcom_inline_separator"},null,-1),oF={key:0,class:"inline_details"},iF={key:0,class:"fcom_box_card_description"},nF=["innerHTML"],lF={class:"fcom_box_card_action"},aF=["onClick"],rF=["onClick"],cF={key:1,class:"loading"},dF={key:2},uF={class:"no_members"},_F={key:3,class:"fcom_no_items_wrap"},mF={key:0},hF={key:1};function fF(e,t,s,u,o,i){const m=p("LockedProfile"),f=Ee,h=p("router-link"),g=p("MoreFilled"),w=j,b=H,S=ze,k=qe,$=Ge,v=p("GroupIcon"),C=Z;return s.profile.is_restricted?(n(),y(m,{key:0})):(n(),c("div",YT,[o.courses.length?(n(),c("div",WT,[(n(!0),c(F,null,x(o.courses,L=>(n(),c("div",{key:L.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:M=>i.goToCourse(L.slug)},[L.cover_photo&&!L.coverError?(n(),c("img",{key:0,src:L.cover_photo,alt:L.title,onError:M=>L.coverError=!0},null,40,ZT)):(n(),c("div",JT))],8,KT),l("div",QT,[l("div",XT,[a(h,{class:"course_route",to:{name:"view_course",params:{course_slug:L.slug}}},{default:r(()=>[V(d(L.title)+" ",1),L.status=="draft"?(n(),y(f,{key:0,type:"info"},{default:r(()=>[V(d(L.status),1)]),_:2},1024)):_("",!0)]),_:2},1032,["to"]),e.isAdmin()?(n(),y($,{key:0,trigger:"click"},{dropdown:r(()=>[a(k,null,{default:r(()=>[a(S,{onClick:M=>i.removeMembership(L.slug)},{default:r(()=>[V(d(e.$t("Remove from course")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),default:r(()=>[a(b,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(w,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)):_("",!0)]),l("div",eF,[l("div",tF,[l("span",null,d(e.$_n("%d Section","%d Sections",L.sectionsCount)),1),sF,l("span",null,d(e.$_n("%d Lesson","%d Lessons",L.lessonsCount)),1)]),L.studentsCount?(n(),c("div",oF,[a(w,null,{default:r(()=>[a(v)]),_:1}),V(" "+d(e.$_n("%s student","%s students",e.$formatNumber(L.studentsCount))),1)])):_("",!0)]),L.description?(n(),c("div",iF,d(e.getExcerpt(L.description)),1)):_("",!0),L.custom_html?(n(),c("div",{key:1,class:"fcom_box_card_custom_html",innerHTML:L.custom_html},null,8,nF)):_("",!0),l("div",lF,[L.isEnrolled?(n(),c("button",{key:0,class:"fcom_card_button",onClick:M=>i.goToCourse(L.slug)},d(e.$t("%s Completed",L.progress+"%")),9,aF)):(n(),c("button",{key:1,class:"fcom_card_button",onClick:M=>i.goToCourse(L.slug)},d(e.$t("View Course")),9,rF))])])]))),128))])):_("",!0),o.loading?(n(),c("div",cF,[a(C,{class:"white_loaded",rows:3,animated:!0}),a(C,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):s.profile.canViewUserSpaces?o.courses.length?_("",!0):(n(),c("div",_F,[l("h3",null,d(e.$t("No courses yet")),1),s.isOwn?(n(),c("p",mF,d(e.$t("Courses you enroll in will appear here.")),1)):(n(),c("p",hF,d(e.$t("This member has not enrolled in any courses yet.")),1))])):(n(),c("div",dF,[l("div",uF,d(e.$t("Sorry, you do not have permission to view this page")),1)]))]))}const pF=I(GT,[["render",fF]]),gF={name:"GroupUsersIcon"},yF={viewBox:"0 0 128 128",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},vF=Te('<g><path d="M64,42c-13.2,0-24,10.8-24,24s10.8,24,24,24s24-10.8,24-24S77.2,42,64,42z M64,82c-8.8,0-16-7.2-16-16s7.2-16,16-16s16,7.2,16,16S72.8,82,64,82z"></path><path d="M64,100.8c-14.9,0-29.2,6.2-39.4,17.1l-2.7,2.9l5.8,5.5l2.7-2.9c8.8-9.4,20.7-14.6,33.6-14.6s24.8,5.2,33.6,14.6l2.7,2.9l5.8-5.5l-2.7-2.9C93.2,107.1,78.9,100.8,64,100.8z"></path><path d="M97,47.9v8c9.4,0,18.1,3.8,24.6,10.7l5.8-5.5C119.6,52.7,108.5,47.9,97,47.9z"></path><path d="M116.1,20c0-10.5-8.6-19.1-19.1-19.1S77.9,9.5,77.9,20S86.5,39.1,97,39.1S116.1,30.5,116.1,20z M85.9,20c0-6.1,5-11.1,11.1-11.1s11.1,5,11.1,11.1s-5,11.1-11.1,11.1S85.9,26.1,85.9,20z"></path><path d="M31,47.9c-11.5,0-22.6,4.8-30.4,13.2l5.8,5.5c6.4-6.9,15.2-10.7,24.6-10.7V47.9z"></path><path d="M50.1,20C50.1,9.5,41.5,0.9,31,0.9S11.9,9.5,11.9,20S20.5,39.1,31,39.1S50.1,30.5,50.1,20z M31,31.1c-6.1,0-11.1-5-11.1-11.1S24.9,8.9,31,8.9s11.1,5,11.1,11.1S37.1,31.1,31,31.1z"></path></g>',1),bF=[vF];function kF(e,t,s,u,o,i){return n(),c("svg",yF,bF)}const wF=I(gF,[["render",kF]]),CF={name:"NotificationPref",components:{NotificationOnboard:So,Notification:vi,GroupUsersIcon:wF},props:["username"],data(){return{pref:{},spaceGroups:[],is_custom:!1,loading:!1,error:"",saving:!1,digestEmailDay:"",initialState:null,default_messaging_email_frequency:"",crm_email_status:"",reconfirming:!1,reconfirm_sent:!1}},computed:{isOwn(){return this.username===this.auth.username},notificationRows(){const e=[];return this.spaceGroups.forEach(t=>{e.push({__group:!0,id:t.id,title:t.title}),t.spaces.forEach(s=>{e.push(s)})}),e},fcom_is_dirty(){return this.initialState?JSON.stringify(this.pref)+JSON.stringify(this.spaceGroups)!=this.initialState:!1}},methods:{getPrefs(){this.loading=!0,this.$get(`profile/${this.username}/notification-preferences`).then(e=>{this.pref=e.user_globals,this.spaceGroups=e.spaceGroups,this.digestEmailDay=e.digestEmailDay,this.default_messaging_email_frequency=e.default_messaging_email_frequency,this.crm_email_status=e.crm_email_status||"",this.initialState=JSON.stringify(this.pref)+JSON.stringify(this.spaceGroups)}).catch(e=>{this.error=e==null?void 0:e.message,this.$handleError(e)}).finally(()=>{this.loading=!1})},reconfirmEmail(){this.reconfirming=!0,this.$post(`profile/${this.username}/reconfirm-email`).then(e=>{this.reconfirm_sent=!0,this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.reconfirming=!1})},saveSettings(){this.saving=!0;let e={};this.spaceGroups.forEach(t=>{t.spaces.forEach(s=>{e[s.id]=s.pref})}),this.$post(`profile/${this.username}/notification-preferences`,{user_globals:this.pref,space_prefs:e}).then(t=>{this.$notify.success(t.message),this.initialState=JSON.stringify(this.pref)+JSON.stringify(this.spaceGroups)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})}},mounted(){this.isOwn||this.hasPermission("super_admin")?this.getPrefs():this.error=this.$t("You can only manage your own notification preferences.")}},$F={class:"fcom_notification_config"},SF={key:0},VF=["innerHTML"],MF={key:1,class:"white_loaded"},LF={class:"fcom_notification_card"},TF={class:"fcom_notification_card__header"},FF={class:"fcom_notification_card__title"},PF={class:"fcom_notification_card__body"},IF={key:0,class:"fcom_input_wrap"},EF={style:{margin:"0 0 10px 0","font-size":"12px"}},UF={key:0,style:{margin:"0","font-weight":"500"}},AF={class:"fcom_input_wrap"},BF={key:0},DF={key:1,class:"fcom_not_enabled"},RF={class:"fcom_input_wrap"},xF={key:0},HF={key:1,class:"fcom_not_enabled"},OF={class:"fcom_input_wrap"},jF={key:0},NF={key:1,class:"fcom_not_enabled"},zF={class:"fcom_input_wrap"},qF={key:0},GF={key:1,class:"fcom_not_enabled"},YF={key:1,class:"fcom_input_wrap"},WF={style:{"font-weight":"500","font-size":"16px",margin:"10px 0 5px 0"}},KF={key:0,class:"fcom_not_enabled"},ZF={key:1,class:"fcom_not_enabled"},JF={key:2,class:"fcom_not_enabled"},QF={class:"fcom_notification_card"},XF={class:"fcom_notification_card__header"},eP={class:"fcom_notification_card__title"},tP={class:"fcom_np_table_wrap"},sP={key:0,class:"fcom_np_group_title"},oP={key:1,class:"fcom_np_space"},iP=["innerHTML"],nP=["innerHTML"],lP={key:2,class:"fcom_np_icon fcom_no_avatar"},aP={class:"fcom_np_name"},rP={class:"fcom_sr_only"},cP={class:"fcom_sr_only"},dP={class:"fcom_sr_only"},uP={key:0,class:"fcom_notification_card fcom_fixed_bottom_overlay"},_P={key:3},mP={key:0},hP=["href"];function fP(e,t,s,u,o,i){const m=Z,f=p("NotificationOnboard"),h=p("Notification"),g=j,w=H,b=ts,S=he,k=Re,$=ve,v=p("GroupUsersIcon"),C=is,L=ne,M=le,E=ns;return n(),c("div",$F,[o.error?(n(),c("div",SF,[l("p",{innerHTML:o.error},null,8,VF)])):o.loading?(n(),c("div",MF,[a(m,{rows:10,animated:!0})])):e.auth.user_id||e.hasPermission("super_admin")&&o.pref?(n(),c("div",{key:2,class:R([{fcom_is_dirty:i.fcom_is_dirty},"fcom_notification_config_body"])},[a(f),l("div",LF,[l("div",TF,[a(g,{style:{"font-size":"30px"}},{default:r(()=>[a(h)]),_:1}),l("div",FF,[l("h3",null,d(e.$t("Global Email Notifications")),1),l("p",null,d(e.$t("These settings will be applied across all spaces you're a member of.")),1)])]),l("div",PF,[o.crm_email_status?(n(),c("div",IF,[a(b,{class:"fcom_email_paused_alert",type:"warning",closable:!1,"show-icon":""},{title:r(()=>[V(d(e.$t("Your email notifications are currently paused")),1)]),default:r(()=>[l("p",EF,d(e.$t("Emails to your address previously failed to deliver, so notification emails are paused for your account. Please re-confirm your email address to resume them.")),1),o.reconfirm_sent?(n(),c("p",UF,d(e.$t("Confirmation email sent! Please check your inbox and click the confirmation link.")),1)):(n(),y(w,{key:1,size:"small",type:"warning",loading:o.reconfirming,onClick:i.reconfirmEmail},{default:r(()=>[V(d(e.$t("Re-confirm my email address")),1)]),_:1},8,["loading","onClick"]))]),_:1})])):_("",!0),l("div",AF,[a(S,{"true-value":"yes","false-value":"no",modelValue:o.pref.com_my_post_mail,"onUpdate:modelValue":t[0]||(t[0]=T=>o.pref.com_my_post_mail=T),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Email me when someone comments on my post")),1)]),_:1},8,["modelValue"]),o.pref.com_my_post_mail=="yes"?(n(),c("p",BF,d(e.$t("You will receive an email when someone leaves a comment on your post.")),1)):(n(),c("p",DF,d(e.$t("No email will be sent for comments on your post.")),1))]),l("div",RF,[a(S,{"true-value":"yes","false-value":"no",modelValue:o.pref.reply_my_com_mail,"onUpdate:modelValue":t[1]||(t[1]=T=>o.pref.reply_my_com_mail=T),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Email me when someone replies to my comments")),1)]),_:1},8,["modelValue"]),o.pref.reply_my_com_mail=="yes"?(n(),c("p",xF,d(e.$t("You will receive an email when someone replies to your comments.")),1)):(n(),c("p",HF,d(e.$t("No email will be sent when someone replies to your comments.")),1))]),l("div",OF,[a(S,{"true-value":"yes","false-value":"no",modelValue:o.pref.mention_mail,"onUpdate:modelValue":t[2]||(t[2]=T=>o.pref.mention_mail=T),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Email me when someone mentions me in a post or comment")),1)]),_:1},8,["modelValue"]),o.pref.mention_mail=="yes"?(n(),c("p",jF,d(e.$t("You will receive an email when someone mentions you in a comment or post.")),1)):(n(),c("p",NF,d(e.$t("No emails will be sent when someone mentions you.")),1))]),l("div",zF,[a(S,{"true-value":"yes","false-value":"no",modelValue:o.pref.digest_mail,"onUpdate:modelValue":t[3]||(t[3]=T=>o.pref.digest_mail=T),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Weekly digest on %s",o.digestEmailDay)),1)]),_:1},8,["modelValue"]),o.pref.digest_mail=="yes"?(n(),c("p",qF,d(e.$t("You will get a digest email with curated activities in the community")),1)):(n(),c("p",GF,d(e.$t("No digest email will be sent.")),1))]),e.appVars.has_chat&&o.default_messaging_email_frequency!="no"?(n(),c("div",YF,[l("p",WF,d(e.$t("Email sending frequency for one-to-one messages")),1),a($,{modelValue:o.pref.message_email_frequency,"onUpdate:modelValue":t[4]||(t[4]=T=>o.pref.message_email_frequency=T),class:"fcom_radio_group"},{default:r(()=>[o.default_messaging_email_frequency!=="disabled"?(n(),y(k,{key:0,value:"default",label:e.$t("Community Default")},null,8,["label"])):_("",!0),a(k,{value:"hourly",label:e.$t("Hourly")},null,8,["label"]),a(k,{value:"daily",label:e.$t("Daily")},null,8,["label"]),a(k,{value:"weekly",label:e.$t("Weekly")},null,8,["label"]),a(k,{value:"disabled",label:e.$t("Disable")},null,8,["label"])]),_:1},8,["modelValue"]),o.pref.message_email_frequency=="disabled"?(n(),c("p",KF,d(e.$t("You will not get any email on new messages from any members")),1)):o.pref.message_email_frequency=="default"?(n(),c("p",ZF,[o.default_messaging_email_frequency=="disabled"?(n(),c(F,{key:0},[V(d(e.$t("Email notification is disabled for one-to-one messages as per global community settings.")),1)],64)):(n(),c(F,{key:1},[V(d(e.$t("You will get email notifications on new messages from your last notification. Frequency: %s",e.$labelize(o.default_messaging_email_frequency))),1)],64))])):(n(),c("p",JF,d(e.$t("You will get email notifications on new messages from your last notification. Frequency: %s",e.$labelize(o.pref.message_email_frequency))),1))])):_("",!0)])]),l("div",QF,[l("div",XF,[a(g,{style:{"font-size":"30px"}},{default:r(()=>[a(v)]),_:1}),l("div",eP,[l("h3",null,d(e.$t("New Posts Notifications")),1),l("p",null,d(e.$t("Subscribe to new posts notifications by space")),1)])]),l("div",tP,[a(E,{data:i.notificationRows,"row-class-name":({row:T})=>T.__group?"fcom_np_group_row":"",class:"fcom_np_table fcom_table"},{empty:r(()=>[V(d(e.$t("No spaces found")),1)]),default:r(()=>[a(C,{label:e.$t("Space"),"min-width":"220",fixed:""},{default:r(({row:T})=>[T.__group?(n(),c("div",sP,d(T.title),1)):(n(),c("div",oP,[T.icon?(n(),y(g,{key:0,class:"fcom_np_icon"},{default:r(()=>[l("span",{innerHTML:T.icon},null,8,iP)]),_:2},1024)):T.shape_svg?(n(),c("span",{key:1,class:"fcom_np_icon",innerHTML:T.shape_svg},null,8,nP)):(n(),c("span",lP)),l("span",aP,d(T.title),1)]))]),_:1},8,["label"]),e.isMobile?(n(),y(C,{key:1,label:e.$t("Notifications"),"min-width":"200"},{default:r(({row:T})=>[T.__group?_("",!0):(n(),y(M,{key:0,placeholder:e.$t("Email Disabled"),modelValue:T.pref,"onUpdate:modelValue":P=>T.pref=P},{default:r(()=>[a(L,{label:e.$t("Email Disabled"),value:""},null,8,["label"]),a(L,{label:e.$t("Notify only for Admin Posts"),value:"admin_only_posts"},null,8,["label"]),a(L,{label:e.$t("Notify for all posts"),value:"all_member_posts"},null,8,["label"])]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue"]))]),_:1},8,["label"])):(n(),c(F,{key:0},[a(C,{label:e.$t("Email Disabled"),align:"center",width:"180"},{default:r(({row:T})=>[T.__group?_("",!0):(n(),y(k,{key:0,modelValue:T.pref,"onUpdate:modelValue":P=>T.pref=P,value:"",name:"space-pref-"+T.id,class:"fcom_np_radio"},{default:r(()=>[l("span",rP,d(e.$t("Email Disabled")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","name"]))]),_:1},8,["label"]),a(C,{label:e.$t("Notify only for Admin Posts"),align:"center",width:"220"},{default:r(({row:T})=>[T.__group?_("",!0):(n(),y(k,{key:0,modelValue:T.pref,"onUpdate:modelValue":P=>T.pref=P,value:"admin_only_posts",name:"space-pref-"+T.id,class:"fcom_np_radio"},{default:r(()=>[l("span",cP,d(e.$t("Notify only for Admin Posts")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","name"]))]),_:1},8,["label"]),a(C,{label:e.$t("Notify for all posts"),align:"center",width:"180"},{default:r(({row:T})=>[T.__group?_("",!0):(n(),y(k,{key:0,modelValue:T.pref,"onUpdate:modelValue":P=>T.pref=P,value:"all_member_posts",name:"space-pref-"+T.id,class:"fcom_np_radio"},{default:r(()=>[l("span",dP,d(e.$t("Notify for all posts")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","name"]))]),_:1},8,["label"])],64))]),_:1},8,["data","row-class-name"])])]),i.isOwn?(n(),c("div",uP,[a(w,{onClick:i.saveSettings,disabled:o.saving,loading:o.saving,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Save Changes")),1)]),_:1},8,["onClick","disabled","loading"])])):_("",!0)],2)):(n(),c("div",_P,[l("h3",null,d(e.$t("Sorry you do not have permission to access this.")),1),e.auth.user_id?_("",!0):(n(),c("div",mP,[l("p",null,d(e.$t("Please login to access this page.")),1),l("a",{href:e.appVars.auth_url,class:"el-button fcom_primary_button link_button"},d(e.$t("Login")),9,hP)]))]))])}const pP=I(CF,[["render",fP]]),gP={name:"UserNotificationSettings",props:["username"],components:{NotificationPrefForm:pP}},yP={class:"fcom_routed_notification_settings"};function vP(e,t,s,u,o,i){const m=p("notification-pref-form");return n(),c("div",yP,[a(m,{username:s.username},null,8,["username"])])}const bP=I(gP,[["render",vP]]),kP={name:"UserFollowers",components:{Pagination:$e,FollowAction:it},props:["isOwn","profile"],emits:["refetch"],data(){return{loading:!1,follows:[],search:"",sort_by:"id",pagination:{page:1,per_page:20,total:0}}},watch:{profile(e){this.fetchFollowers()}},computed:{showPagination(){return this.pagination.total>this.pagination.per_page}},methods:{handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetchFollowers()},fetchFollowers(){this.loading=!0,this.$get("profile/"+this.profile.username+"/followers",{per_page:this.pagination.per_page,page:this.pagination.page,search:this.search,sort_by:this.sort_by}).then(e=>{this.follows=e.followers.data,this.pagination.total=e.followers.total}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.fetchFollowers(),this.changeTitle(this.$t("Followers"))}},wP={class:"fcom_dir_layout_classic space_members fcom_dir_layout"},CP={class:"search_member"},$P={class:"feed_filters"},SP=l("div",{class:"fcom_feed_divider"},null,-1),VP={id:"feed_short_by",class:"fcom_feed_filter_label"},MP={key:0,class:"loading"},LP={key:1,class:"no_follow"},TP={key:2,class:"card_list"},FP={role:"region","aria-label":"User Info",class:"card_content"},PP={class:"card_avatar"},IP={class:"card_info"},EP={class:"info_header"},UP={class:"meta_line"},AP={key:0,class:"card_headline"},BP={class:"feed_meta_info"},DP=["title"],RP=["title"],xP={key:1,class:"card_description"},HP={class:"card_action"},OP={key:3,role:"region","aria-label":"Pagination",class:"pagination_wrap"};function jP(e,t,s,u,o,i){const m=p("Search"),f=j,h=se,g=ne,w=le,b=Z,S=p("UserAvatar"),k=p("UserRouteLink"),$=p("FollowAction"),v=p("Pagination");return n(),c("div",wP,[l("div",CP,[a(h,{clearable:"",onClear:i.toSearch,onKeydown:oe(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[0]||(t[0]=C=>o.search=C),placeholder:e.$t("Search Followers...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",$P,[SP,l("span",VP,d(e.$t("Sort by:")),1),a(w,{"aria-label":e.$t("Sort followers by"),modelValue:o.sort_by,"onUpdate:modelValue":t[1]||(t[1]=C=>o.sort_by=C),class:"fcom_minimal_select","popper-class":"plain_select",onChange:t[2]||(t[2]=C=>i.toSearch())},{default:r(()=>[a(g,{value:"id",label:e.$t("Most Recent")},null,8,["label"]),a(g,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),o.loading&&!o.follows.length?(n(),c("div",MP,[a(b,{class:"white_loaded",rows:3,animated:!0})])):!o.loading&&!o.follows.length?(n(),c("div",LP,[o.search?(n(),c(F,{key:0},[V(d(e.$t("No results found")),1)],64)):(n(),c(F,{key:1},[V(d(e.$t("No one is following this account yet. Posting and interacting with others helps boost followers!")),1)],64))])):(n(),c("div",TP,[(n(!0),c(F,null,x(o.follows,C=>{var L,M,E,T,P,U,D,A,q,O;return n(),c("div",{key:C.followed_id,class:"each_card"},[l("div",FP,[l("div",PP,[a(S,{is_online:e.isOnline((L=C.follower)==null?void 0:L.last_activity),xprofile:C.follower},null,8,["is_online","xprofile"])]),l("div",IP,[l("div",EP,[a(k,{show_pop:!0,show_badge:!0,xprofile:C.follower,show_follow:!0},null,8,["xprofile"]),l("div",UP,"@"+d((M=C.follower)==null?void 0:M.username),1)]),(T=(E=C.follower)==null?void 0:E.meta)!=null&&T.headline?(n(),c("div",AP,d(C.follower.meta.headline),1)):_("",!0),l("div",BP,[(P=C.follower)!=null&&P.created_at?(n(),c("div",{key:0,title:(U=C.follower)==null?void 0:U.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(C.follower.created_at))),9,DP)):_("",!0),(D=C.follower)!=null&&D.last_activity?(n(),c("div",{key:1,title:(A=C.follower)==null?void 0:A.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(C.follower.last_activity))),9,RP)):_("",!0)]),(q=C.follower)!=null&&q.short_description?(n(),c("div",xP,d(e.getExcerpt(((O=C.follower.meta)==null?void 0:O.short_description_rendered)||C.follower.short_description,120)),1)):_("",!0)])]),l("div",HP,[a($,{profile:C.follower,onRefetch:t[3]||(t[3]=N=>e.$emit("refetch"))},null,8,["profile"])])])}),128))])),i.showPagination?(n(),c("div",OP,[a(v,{hide_on_single:!0,onFetch:t[4]||(t[4]=C=>i.fetchFollowers()),pagination:o.pagination},null,8,["pagination"])])):_("",!0)])}const NP=I(kP,[["render",jP]]),zP={name:"UserFollowings",props:["isOwn","profile"],emits:["refetch"],components:{Pagination:$e,FollowAction:it},data(){return{loading:!1,follows:[],search:"",sort_by:"id",pagination:{page:1,per_page:20,total:0}}},computed:{showPagination(){return this.pagination.total>this.pagination.per_page}},methods:{handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetchFollowings()},fetchFollowings(){this.loading=!0,this.$get("profile/"+this.profile.username+"/followings",{per_page:this.pagination.per_page,page:this.pagination.page,search:this.search,sort_by:this.sort_by}).then(e=>{this.follows=e.followings.data,this.pagination.total=e.followings.total}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.fetchFollowings(),this.changeTitle(this.$t("Followings"))}},qP={class:"fcom_dir_layout_classic space_members fcom_dir_layout"},GP={class:"search_member"},YP={class:"feed_filters"},WP=l("div",{class:"fcom_feed_divider"},null,-1),KP={id:"feed_short_by",class:"fcom_feed_filter_label"},ZP={key:0,class:"loading"},JP={key:1,class:"no_follow"},QP={key:2,class:"card_list"},XP={role:"region","aria-label":"User Info",class:"card_content"},eI={class:"card_avatar"},tI={class:"card_info"},sI={class:"info_header"},oI={class:"meta_line"},iI={key:0,class:"card_headline"},nI={class:"feed_meta_info"},lI=["title"],aI=["title"],rI={key:1,class:"card_description"},cI={class:"card_action"},dI={key:3,role:"region","aria-label":"Pagination",class:"pagination_wrap"};function uI(e,t,s,u,o,i){const m=p("Search"),f=j,h=se,g=ne,w=le,b=Z,S=p("UserAvatar"),k=p("UserRouteLink"),$=p("FollowAction"),v=p("Pagination");return n(),c("div",qP,[l("div",GP,[a(h,{clearable:"",onClear:i.toSearch,onKeydown:oe(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[0]||(t[0]=C=>o.search=C),placeholder:e.$t("Search Followings...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",YP,[WP,l("span",KP,d(e.$t("Sort by:")),1),a(w,{"aria-label":e.$t("Sort followings by"),modelValue:o.sort_by,"onUpdate:modelValue":t[1]||(t[1]=C=>o.sort_by=C),class:"fcom_minimal_select","popper-class":"plain_select",onChange:t[2]||(t[2]=C=>i.toSearch())},{default:r(()=>[a(g,{value:"id",label:e.$t("Most Recent")},null,8,["label"]),a(g,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),o.loading&&!o.follows.length?(n(),c("div",ZP,[a(b,{class:"white_loaded",rows:3,animated:!0})])):!o.loading&&!o.follows.length?(n(),c("div",JP,[o.search?(n(),c(F,{key:0},[V(d(e.$t("No results found")),1)],64)):s.isOwn?(n(),c(F,{key:1},[V(d(e.$t("You aren't following anyone yet. Start following other members to connect and keep up with their activity!")),1)],64)):(n(),c(F,{key:2},[V(d(e.$t("This user isn't following anyone yet. Once they follow accounts, they'll show up here.")),1)],64))])):(n(),c("div",QP,[(n(!0),c(F,null,x(o.follows,C=>{var L,M,E,T,P,U,D,A,q,O;return n(),c("div",{key:C.followed_id,class:"each_card"},[l("div",XP,[l("div",eI,[a(S,{is_online:e.isOnline((L=C.followed)==null?void 0:L.last_activity),xprofile:C.followed},null,8,["is_online","xprofile"])]),l("div",tI,[l("div",sI,[a(k,{show_pop:!0,show_badge:!0,xprofile:C.followed,show_follow:!0},null,8,["xprofile"]),l("div",oI,"@"+d((M=C.followed)==null?void 0:M.username),1)]),(T=(E=C.followed)==null?void 0:E.meta)!=null&&T.headline?(n(),c("div",iI,d(C.followed.meta.headline),1)):_("",!0),l("div",nI,[(P=C.followed)!=null&&P.created_at?(n(),c("div",{key:0,title:(U=C.followed)==null?void 0:U.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(C.followed.created_at))),9,lI)):_("",!0),(D=C.followed)!=null&&D.last_activity?(n(),c("div",{key:1,title:(A=C.followed)==null?void 0:A.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(C.followed.last_activity))),9,aI)):_("",!0)]),(q=C.followed)!=null&&q.short_description?(n(),c("div",rI,d(e.getExcerpt(((O=C.followed.meta)==null?void 0:O.short_description_rendered)||C.followed.short_description,120)),1)):_("",!0)])]),l("div",cI,[a($,{profile:C.followed,onRefetch:t[3]||(t[3]=N=>e.$emit("refetch"))},null,8,["profile"])])])}),128))])),i.showPagination?(n(),c("div",dI,[a(v,{hide_on_single:!0,onFetch:t[4]||(t[4]=C=>i.fetchFollowings()),pagination:o.pagination},null,8,["pagination"])])):_("",!0)])}const _I=I(zP,[["render",uI]]),mI={props:["profile","username","isOwn"],emits:["refetch"],data(){return{currentRoute:this.$route.name}},watch:{$route(e,t){this.currentRoute=e.name}},methods:{isActive(e){return this.currentRoute==e},switchRoute(e){this.currentRoute=e,this.$router.push({name:e,params:{username:this.username}})}}},hI={class:"follow_header"},fI={class:"fcom_filter_menu"},pI={class:"fcom_filter_menu_ul"},gI={key:0},yI={key:1},vI={class:"follow_body"};function bI(e,t,s,u,o,i){var f,h;const m=p("router-view");return n(),c(F,null,[l("div",hI,[l("div",fI,[l("ul",pI,[((f=s.profile)==null?void 0:f.followings_count)!=null?(n(),c("li",gI,[l("a",{href:"#",onClick:t[0]||(t[0]=z(g=>i.switchRoute("user_followings"),["prevent"])),class:R({"router-link-exact-active":i.isActive("user_followings")})},d(e.$t("Following")),3)])):_("",!0),((h=s.profile)==null?void 0:h.followers_count)!=null?(n(),c("li",yI,[l("a",{href:"#",onClick:t[1]||(t[1]=z(g=>i.switchRoute("user_followers"),["prevent"])),class:R({"router-link-exact-active":i.isActive("user_followers")})},d(e.$t("Followers")),3)])):_("",!0)])])]),l("div",vI,[a(m,{isOwn:s.isOwn,profile:s.profile,onRefetch:t[2]||(t[2]=g=>e.$emit("refetch"))},null,8,["isOwn","profile"])])],64)}const kI=I(mI,[["render",bI]]),wI={name:"MemberAction",props:["member","openedMemberId"],data(){return{status:this.member.status,working:!1,isOpened:!1}},watch:{openedMemberId(e){this.isOpened=e===this.member.user_id}},methods:{changeMemberStatus(){this.working=!0,this.$patch("members/"+this.member.user_id,{status:this.status}).then(e=>{this.member.status=this.status,this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1,this.isOpened=!1})},togglePopover(){this.$emit("togglePopover")}}};function CI(e,t,s,u,o,i){const m=p("MoreFilled"),f=j,h=H,g=Ne,w=ve,b=ue,S=_e,k=ye,$=te("loading");return n(),y(k,{persistent:!1,placement:"bottom",width:270,visible:o.isOpened,onHide:t[2]||(t[2]=v=>o.isOpened=!1)},{reference:r(()=>[a(h,{"aria-label":e.$t("View actions"),onClick:i.togglePopover,size:"small",text:""},{default:r(()=>[a(f,{class:"fcom_more_icon"},{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:r(()=>[a(S,{onSubmit:t[1]||(t[1]=z(v=>e.doNothing(),["prevent"])),"label-position":"top"},{default:r(()=>[a(b,{label:e.$t("Status")},{default:r(()=>[a(w,{modelValue:o.status,"onUpdate:modelValue":t[0]||(t[0]=v=>o.status=v)},{default:r(()=>[a(g,{label:e.$t("Active"),value:"active"},null,8,["label"]),a(g,{label:e.$t("Pending"),value:"pending"},null,8,["label"]),a(g,{label:e.$t("Blocked"),value:"blocked"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(b,null,{default:r(()=>[W((n(),y(h,{disabled:o.working,onClick:i.changeMemberStatus,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Update Status")),1)]),_:1},8,["disabled","onClick"])),[[$,o.working]])]),_:1})]),_:1})]),_:1},8,["visible"])}const $I=I(wI,[["render",CI]]),SI={name:"AllMembers",components:{SocialLinks:Dt,Layout:we,AppLayout:Se,Pagination:$e,MemberAction:$I,FollowAction:it,SortControl:Ro},setup(){return{uiStore:Ft()}},data(){return{loading:!1,members:[],pagination:{page:1,per_page:24,total:0},permission_failed:!1,search:"",status:"active",sort_by:"last_activity",sort_dir:"desc",workingIds:[],openedMemberId:null,memberLayout:this.appVars.features.member_list_layout||"classic"}},computed:{sortOptions(){return[{value:"last_activity",label:this.$t("Last Activity"),defaultDir:"desc"},{value:"display_name",label:this.$t("Display Name"),defaultDir:"asc"},{value:"created_at",label:this.$t("Joining Date"),defaultDir:"desc"}]}},methods:{onSortChange(){this.uiStore.setListSort("members",this.sort_by,this.sort_dir),this.fetch()},restoreSortPreference(){const e=this.uiStore.getListSort("members");e&&this.sortOptions.some(t=>t.value===e.field)&&(this.sort_by=e.field,this.sort_dir=e.dir==="asc"?"asc":"desc")},fetch(){this.loading=!0,this.$get("members",{per_page:this.pagination.per_page,page:this.pagination.page,search:this.search,status:this.status,sort_by:this.sort_by,sort_dir:this.sort_dir}).then(e=>{window.scrollTo({top:0,behavior:"smooth"}),this.members=e.members.data,this.pagination.total=e.members.total,e.current_user_follows&&this.setFollowIds(e.current_user_follows)}).catch(e=>{e.permission_failed?this.permission_failed=!0:this.$handleError(e)}).finally(()=>{this.loading=!1})},changeMemberStatus(e,t){this.workingIds.push(e.user_id),this.$patch("members/"+e.user_id,{status:t}).then(s=>{this.$notify.success(s.message),e.status=t}).catch(s=>{this.$handleError(s)}).finally(()=>{this.workingIds=this.workingIds.filter(s=>s!==e.user_id)})},handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetch()},handleTogglePopover(e){this.openedMemberId=this.openedMemberId===e?null:e}},mounted(){const e=["active","pending","blocked"];this.hasFeature("can_deactivate_account")&&e.push("deactivated");const t=this.$route.query.status,s=this.$route.query.inactives?"blocked":null,u=t||s;u&&e.includes(u)&&(this.status=u),this.restoreSortPreference(),this.fetch(),this.changeTitle(this.$t("All Members"))}},VI={key:0,class:"card_header"},MI={role:"region","aria-label":"Member Navigation",class:"member_status"};const LI={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},TI={class:"permission_failed"},FI=["href"],PI={class:"search_member"},II={class:"feed_filters"},EI=l("div",{class:"fcom_feed_divider"},null,-1),UI={key:0,class:"loading"},AI={key:1,class:"no_members"},BI={key:2,class:"card_list"},DI={role:"region","aria-label":"User Info",class:"card_content"},RI={class:"card_avatar"},xI={class:"card_info"},HI={class:"info_header"},OI={class:"meta_line"},jI={key:0,class:"card_headline"},NI={class:"feed_meta_info"},zI=["title"],qI=["title"],GI={key:1,class:"card_description"},YI={key:2,class:"card_footer"},WI={class:"card_action"},KI={key:3,role:"region","aria-label":"Pagination",class:"pagination_wrap"};function ZI(e,t,s,u,o,i){const m=Ne,f=ve,h=H,g=p("Search"),w=j,b=se,S=p("SortControl"),k=Z,$=p("UserAvatar"),v=p("UserRouteLink"),C=p("SocialLinks"),L=p("FollowAction"),M=p("MemberAction"),E=p("Pagination"),T=p("layout"),P=p("app-layout");return n(),y(P,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(T,{use_scroll:!0,class:"no_bg_layout",title:e.$t("All Members")+" "+(typeof o.pagination.total=="number"?" ("+e.$formatNumber(o.pagination.total)+")":"")},{default:r(()=>[e.isAdmin()?(n(),c("div",VI,[l("div",MI,[a(f,{onChange:i.toSearch,modelValue:o.status,"onUpdate:modelValue":t[0]||(t[0]=U=>o.status=U),class:"status_group"},{default:r(()=>[a(m,{value:"active"},{default:r(()=>[V(d(e.$t("Active")),1)]),_:1}),a(m,{value:"pending"},{default:r(()=>[V(d(e.$t("Pending")),1)]),_:1}),a(m,{value:"blocked"},{default:r(()=>[V(d(e.$t("Blocked")),1)]),_:1}),e.hasFeature("can_deactivate_account")?(n(),y(m,{key:0,value:"deactivated"},{default:r(()=>[V(d(e.$t("Deactivated (self)")),1)]),_:1})):_("",!0)]),_:1},8,["onChange","modelValue"])]),_("",!0)])):_("",!0),o.permission_failed?(n(),c("div",LI,[l("div",TI,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view all members")),1),l("a",{href:e.$getRouteLink("/"),class:"el-button fcom_primary_button"},d(e.$t("Go To All Feeds")),9,FI)])])):(n(),c(F,{key:2},[l("div",PI,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:oe(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[2]||(t[2]=U=>o.search=U),placeholder:e.$t("Search Members...")},{prefix:r(()=>[a(w,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",II,[EI,a(S,{field:o.sort_by,"onUpdate:field":t[3]||(t[3]=U=>o.sort_by=U),dir:o.sort_dir,"onUpdate:dir":t[4]||(t[4]=U=>o.sort_dir=U),options:i.sortOptions,onChange:i.onSortChange},null,8,["field","dir","options","onChange"])]),l("div",{class:R(["fcom_dir_layout_"+o.memberLayout,"space_members fcom_dir_layout"])},[o.loading?(n(),c("div",UI,[a(k,{class:"white_loaded",rows:3,animated:!0})])):!o.loading&&!o.members.length?(n(),c("div",AI,d(e.$t("No members found")),1)):(n(),c("div",BI,[(n(!0),c(F,null,x(o.members,(U,D)=>{var A,q;return n(),c("div",{key:U.user_id,class:"each_card"},[l("div",DI,[l("div",RI,[a($,{is_online:e.isOnline(U.last_activity),xprofile:U},null,8,["is_online","xprofile"])]),l("div",xI,[l("div",HI,[a(v,{show_pop:!0,show_badge:!0,xprofile:U,show_follow:!0},null,8,["xprofile"]),l("div",OI,"@"+d(U.username),1)]),(A=U.meta)!=null&&A.headline?(n(),c("div",jI,d(U.meta.headline),1)):_("",!0),l("div",NI,[U.created_at?(n(),c("div",{key:0,title:U.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(U.created_at))),9,zI)):_("",!0),U.last_activity?(n(),c("div",{key:1,title:U.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(U.last_activity))),9,qI)):_("",!0)]),U.short_description?(n(),c("div",GI,d(e.getExcerpt(((q=U.meta)==null?void 0:q.short_description_rendered)||U.short_description,120)),1)):_("",!0),a(C,{style:{"justify-content":"left"},xprofile:U,isOwn:!1},null,8,["xprofile"]),U.status!="active"?(n(),c("div",YI,[l("div",{style:re({color:U.status==="pending"?"var(--el-color-warning)":"var(--el-color-danger)",display:"flex",gap:"10px"}),class:"meta_line"},[U.status==="pending"?(n(),c(F,{key:0},[l("span",null,d(e.$t("Status:"))+" "+d(e.$labelize(U.status)),1),a(h,{onClick:O=>i.changeMemberStatus(U,"active"),type:"primary",size:"small",disabled:o.workingIds.includes(U.user_id),loading:o.workingIds.includes(U.user_id)},{default:r(()=>[V(d(e.$t("Approve")),1)]),_:2},1032,["onClick","disabled","loading"])],64)):U.status==="blocked"?(n(),c(F,{key:1},[l("span",null,d(e.$t("Status:"))+" "+d(e.$labelize(U.status)),1),a(h,{onClick:O=>i.changeMemberStatus(U,"active"),type:"danger",size:"small",disabled:o.workingIds.includes(U.user_id),loading:o.workingIds.includes(U.user_id)},{default:r(()=>[V(d(e.$t("Unblock")),1)]),_:2},1032,["onClick","disabled","loading"])],64)):(n(),c(F,{key:2},[l("span",null,d(e.$t("Status:"))+" "+d(e.$t("Self Deactivated")),1),a(h,{onClick:O=>i.changeMemberStatus(U,"active"),type:"danger",size:"small",disabled:o.workingIds.includes(U.user_id),loading:o.workingIds.includes(U.user_id)},{default:r(()=>[V(d(e.$t("Reactivate")),1)]),_:2},1032,["onClick","disabled","loading"])],64))],4)])):_("",!0)])]),l("div",WI,[a(L,{profile:U},null,8,["profile"]),e.isAdmin()?(n(),y(M,{key:0,member:U,openedMemberId:o.openedMemberId,onTogglePopover:O=>i.handleTogglePopover(U.user_id)},null,8,["member","openedMemberId","onTogglePopover"])):_("",!0)])])}),128))])),o.pagination.total?(n(),c("div",KI,[a(E,{hide_on_single:!0,onFetch:t[5]||(t[5]=U=>i.fetch()),pagination:o.pagination},null,8,["pagination"])])):_("",!0)],2)],64))]),_:1},8,["title"])]),_:1})}const JI=I(SI,[["render",ZI]]),QI={name:"Notifications",components:{AppLayout:Se,Layout:we,NotificationsBlock:io,Pagination:$e},setup(){return{notificationStore:ds()}},data(){return{status:"all",loading:!1,notifications:[],pagination:{page:1,per_page:20,total:0},working:!1,notification_type:"all"}},methods:{switchType(e){e==="unread"?(this.notification_type="all",this.status="unread"):(this.notification_type=e,this.status="all"),this.pagination.page=1,this.fetch()},fetch(){this.loading=!0,this.$get("notifications",{per_page:this.pagination.per_page,page:this.pagination.page,status:this.status,notification_type:this.notification_type}).then(e=>{this.notifications=e.notifications.data,this.pagination.total=e.notifications.total}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1,window.scrollTo(0,0)})},async markAllRead(){this.working=!0;try{await this.notificationStore.markAllAsRead(),this.$notify.success(this.$t("All notifications marked as read")),this.fetch()}catch(e){this.$handleError(e)}finally{this.working=!1}}},mounted(){this.fetch(),this.changeTitle(this.$t("All Notifications")),window.scrollTo(0,0)}},XI={class:"fcom_filter_menu"},eE={class:"fcom_filter_menu_ul fcom_notification_types"},tE={style:{"border-top-left-radius":"0","border-top-right-radius":"0"},class:"space_members"},sE={key:0,class:"notifications notifications_wrap"},oE={class:"pagination_wrap"},iE={key:1,style:{"margin-top":"15px"}},nE={key:2};function lE(e,t,s,u,o,i){const m=H,f=zs,h=p("notifications-block"),g=p("Pagination"),w=Z,b=p("layout"),S=p("app-layout"),k=te("loading");return n(),y(S,{wrapper_class:"fcom_single_layout"},{default:r(()=>[a(b,{content_class:"no_bg_layout notification_layout",title:e.$t("Notifications")},{actions:r(()=>[a(m,{class:"fcom_primary_button",disabled:o.working,onClick:t[0]||(t[0]=$=>i.markAllRead())},{default:r(()=>[V(d(e.$t("Mark all as read")),1)]),_:1},8,["disabled"])]),default:r(()=>[l("div",XI,[l("ul",eE,[l("li",null,[l("a",{onClick:t[1]||(t[1]=z($=>i.switchType("all"),["prevent"])),class:R({"router-link-exact-active":o.notification_type=="all"&&o.status!="unread"}),href:"#"},d(e.$t("All")),3)]),l("li",null,[l("a",{onClick:t[2]||(t[2]=z($=>i.switchType("unread"),["prevent"])),class:R({"router-link-exact-active":o.status=="unread"}),href:"#"},d(e.$t("Unread")),3)]),l("li",null,[l("a",{onClick:t[3]||(t[3]=z($=>i.switchType("mentioned"),["prevent"])),class:R({"router-link-exact-active":o.notification_type=="mentioned"}),href:"#"},d(e.$t("Mentions")),3)]),l("li",null,[l("a",{onClick:t[4]||(t[4]=z($=>i.switchType("following"),["prevent"])),class:R({"router-link-exact-active":o.notification_type=="following"}),href:"#"},d(e.$t("Following")),3)])]),a(f,{onChange:t[5]||(t[5]=$=>i.fetch()),style:{"--el-switch-on-color":"#2271b1"},"active-value":"unread","inactive-value":"all","active-text":e.$t("Unread only"),modelValue:o.status,"onUpdate:modelValue":t[6]||(t[6]=$=>o.status=$),class:"fcom_switch"},null,8,["active-text","modelValue"])]),l("div",tE,[o.notifications.length?W((n(),c("div",sE,[a(h,{notifications:o.notifications},null,8,["notifications"]),l("div",oE,[a(g,{hide_on_single:!0,onFetch:t[7]||(t[7]=$=>i.fetch()),pagination:o.pagination},null,8,["pagination"])])])),[[k,o.loading]]):o.loading?(n(),c("div",nE,[a(w,{animated:!0,rows:5})])):(n(),c("div",iE,[l("p",null,d(e.$t("No notifications found")),1)]))])]),_:1},8,["title"])]),_:1})}const aE=I(QI,[["render",lE]]),rE={name:"Bookmarks",components:{Feeds:gt,AppLayout:Se,Layout:we},data(){return{search:""}},methods:{handleSearch(){this.search&&this.search.length<3||this.$router.replace({query:{...this.$route.query,search:this.search}})}},computed:{feed_base_url(){return"feeds/bookmarks"}},mounted(){this.changeTitle(this.$t("Your Bookmarks"))}},cE={style:{"margin-bottom":"16px"}},dE={class:"search_member"},uE={key:1};function _E(e,t,s,u,o,i){const m=p("Search"),f=j,h=se,g=p("feeds"),w=p("layout"),b=p("app-layout");return n(),y(b,{wrapper_class:"fcom_single_layout fcom_compact_layout"},{default:r(()=>[a(w,{wrapper_class:"no_bg_layout",title:e.$t("Your Bookmarks")},{default:r(()=>[l("h4",cE,d(e.$t("Your saved posts")),1),l("div",dE,[a(h,{clearable:"",onClear:i.handleSearch,onKeydown:oe(i.handleSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[0]||(t[0]=S=>o.search=S),placeholder:e.$t("Search Posts...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),e.appVars.auth.user_id?(n(),y(g,{key:0,feed_base_url:i.feed_base_url,hide_create_form:!0,space:"",feed_name:"all_feeds",context_suffix:"bookmarks",layout_style:e.appVars.features.default_feed_layout,default_order_by:e.appVars.features.default_feed_sort_by||"",can_change_order:e.appVars.features.disable_feed_sort_by!=="yes",can_change_layout:e.appVars.features.can_switch_layout},null,8,["feed_base_url","layout_style","default_order_by","can_change_order","can_change_layout"])):(n(),c("div",uE,[l("p",null,d(e.$t("Please login to view your bookmarks")),1)]))]),_:1},8,["title"])]),_:1})}const mE=I(rE,[["render",_E]]);const hE={name:"AllCourses",components:{AppLayout:Se,Layout:we,GroupIcon:Gt,Pagination:$e,Search:Ie},data(){return{courses:[],loading:!0,pagination:{page:1,per_page:24,total:0},type:"all",newCourseModal:!1,is_admin:!1,courseCategories:null,topic_slug:null,search:"",sort_by:"alphabetical"}},methods:{fetchCourses(){this.loading=!0,this.$get("courses",{type:this.type,search:this.search,sort_by:this.sort_by,topic_slug:this.topic_slug,page:this.pagination.page,per_page:this.pagination.per_page,with_categories:!this.courseCategories}).then(e=>{this.courses=e.courses.data,this.is_admin=e.is_admin,this.pagination.total=e.courses.total,e.course_categories&&e.course_categories.length&&(this.courseCategories=e.course_categories)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},setTopic(e){this.topic_slug=e;let t=JSON.parse(JSON.stringify(this.$route.query));e?(t.topic=e,this.$router.push({query:t})):(delete t.topic,this.$router.push({query:t})),this.fetchCourses()},SwitchToCourseView(e){this.type=e,this.$router.push({name:"courses",query:{type:e}}),this.fetchCourses()},getExcerpt(e){if(!e)return"";let t=e.replace(/(<([^>]+)>)/ig,"");return t.length>200&&(t=t.substring(0,200)+"..."),t},emitCreateCourse(){this.$eventBus.emit("createSpaceModal",{course_config:!0})},handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetchCourses()},changeSortBy(){this.$storeLocalData("course_sort_by",this.sort_by),this.toSearch()},watchTopicUrlChanged(e){this.setTopic(e),this.$nextTick(()=>{window.fcomLayoutRef&&window.fcomLayoutRef.scrollTo({top:0,behavior:"smooth"})})}},created(){this.$eventBus.on("topic_changed",this.watchTopicUrlChanged)},mounted(){this.$route.query.type&&(this.type=this.$route.query.type),this.$route.query.topic&&(this.topic_slug=this.$route.query.topic),this.sort_by=this.$getLocalData("course_sort_by","alphabetical"),this.changeTitle(this.$t("Courses")),this.hasFeature("has_course")?this.fetchCourses():this.loading=!1},beforeUnmount(){this.$eventBus.off("topic_changed",this.watchTopicUrlChanged)}},No=e=>(Bs("data-v-6ac627c3"),e=e(),Ds(),e),fE={class:"object_menu"},pE={class:"fcom_space_menu_ul"},gE={key:0},yE={key:1},vE={key:0,class:"fcom_space_topics"},bE={class:"fcom_topics_filters"},kE={class:"search_member"},wE={class:"feed_filters"},CE=No(()=>l("div",{class:"fcom_feed_divider"},null,-1)),$E={id:"feed_short_by",class:"fcom_feed_filter_label"},SE={class:"fcom_courses"},VE={key:0,class:"fcom_no_items_wrap"},ME={key:2},LE=["href"],TE={class:"fcom_box_card_list"},FE=["onClick"],PE=["src","onError"],IE={key:1,class:"fcom_no_image"},EE={class:"fcom_box_card_info"},UE={class:"fcom_box_card_name"},AE={class:"fcom_box_card_details"},BE={class:"inline_details"},DE=No(()=>l("span",{class:"fcom_inline_separator"},null,-1)),RE={key:0,class:"inline_details"},xE={key:0,class:"fcom_box_card_description"},HE=["innerHTML"],OE={class:"fcom_box_card_action"},jE=["onClick"],NE=["onClick"];function zE(e,t,s,u,o,i){const m=H,f=ke,h=p("Search"),g=j,w=se,b=ne,S=le,k=Ee,$=p("router-link"),v=p("GroupIcon"),C=p("pagination"),L=p("layout"),M=p("app-layout"),E=te("loading");return n(),y(M,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(L,{wrapper_class:"no_bg_layout",title:e.$t("Courses")+" "+(o.pagination.total?" ("+e.$formatNumber(o.pagination.total)+")":"")},{actions:r(()=>[l("div",fE,[l("ul",pE,[l("li",null,[l("a",{onClick:t[0]||(t[0]=z(T=>i.SwitchToCourseView("all"),["prevent"])),class:R(o.type=="all"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("All Courses")),3)]),e.auth.user_id?(n(),c("li",gE,[l("a",{onClick:t[1]||(t[1]=z(T=>i.SwitchToCourseView("enrolled"),["prevent"])),class:R(o.type=="enrolled"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("My Courses")),3)])):_("",!0),e.hasCourseCreatorAccess()?(n(),c("li",yE,[a(m,{onClick:t[2]||(t[2]=T=>i.emitCreateCourse()),class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("New Course")),1)]),_:1})])):_("",!0)])])]),default:r(()=>[o.courseCategories&&o.courseCategories.length?(n(),c("div",vE,[a(f,null,{default:r(()=>[l("div",bE,[a(m,{onClick:t[3]||(t[3]=T=>i.setTopic("")),class:R({fcom_active_topic:!o.topic_slug})},{default:r(()=>[V(d(e.$t("All")),1)]),_:1},8,["class"]),(n(!0),c(F,null,x(o.courseCategories,T=>(n(),y(m,{key:T.slug,onClick:P=>i.setTopic(T.slug),class:R({fcom_active_topic:T.slug==o.topic_slug})},{default:r(()=>[V(d(T.title),1)]),_:2},1032,["onClick","class"]))),128))])]),_:1})])):_("",!0),l("div",kE,[a(w,{clearable:"",onClear:i.toSearch,onKeydown:oe(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[4]||(t[4]=T=>o.search=T),placeholder:e.$t("Search Courses...")},{prefix:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",wE,[CE,l("span",$E,d(e.$t("Sort by:")),1),a(S,{"aria-label":e.$t("Sort Courses by"),modelValue:o.sort_by,"onUpdate:modelValue":t[5]||(t[5]=T=>o.sort_by=T),class:"fcom_minimal_select space_sort_select","popper-class":"plain_select",onChange:t[6]||(t[6]=T=>i.changeSortBy())},{default:r(()=>[a(b,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"]),a(b,{value:"latest",label:e.$t("Latest Courses")},null,8,["label"]),a(b,{value:"oldest",label:e.$t("Oldest Courses")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),W((n(),c("div",SE,[!o.loading&&!o.courses.length?(n(),c("div",VE,[o.topic_slug?(n(),c(F,{key:0},[l("h3",null,d(e.$t("No courses found in this topic")),1),l("p",null,d(e.$t("No courses found based on your search criteria")),1)],64)):o.type=="all"?(n(),c(F,{key:1},[o.search?(n(),c(F,{key:0},[l("h3",null,d(e.$t("No courses found based on your search criteria")),1),l("p",null,d(e.$t("No courses match your search criteria. Try adjusting your search terms or browse our course catalog.")),1)],64)):e.isAdmin()?(n(),c(F,{key:1},[l("h3",null,d(e.$t("Create your first course")),1),l("p",null,d(e.$t("Deliver engaging & high-performance learning experiences in your community.")),1),a(m,{onClick:t[7]||(t[7]=T=>i.emitCreateCourse()),class:"fcom_primary_button fcom_mt_10"},{default:r(()=>[V(d(e.$t("Create a Course")),1)]),_:1})],64)):(n(),c("div",ME,[l("h3",null,d(e.$t("No published courses found")),1),l("p",null,d(e.$t("Please check back later. We are in a process to publish some courses for you!")),1)]))],64)):(n(),c(F,{key:2},[o.search?(n(),c(F,{key:0},[l("h3",null,d(e.$t("No courses found based on your search criteria")),1),l("p",null,d(e.$t("No courses match your search criteria. Try adjusting your search terms or browse our course catalog.")),1)],64)):e.auth.user_id?(n(),c(F,{key:2},[l("h3",null,d(e.$t("Your enrolled courses will be shown here")),1),l("p",null,d(e.$t("Once you enroll some courses, those will be shown here")),1),l("a",{onClick:t[8]||(t[8]=z(T=>i.SwitchToCourseView("all"),["prevent"])),class:"el-button fcom_primary_button fcom_mt_10",href:"#"},d(e.$t("View all courses")),1)],64)):(n(),c(F,{key:1},[l("h3",null,d(e.$t("Login to see your courses")),1),l("p",null,d(e.$t("Once you login, your enrolled courses will be shown here.")),1),l("a",{href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button"},d(e.$t("Login")),9,LE)],64))],64))])):_("",!0),l("div",TE,[(n(!0),c(F,null,x(o.courses,T=>(n(),c("div",{key:T.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:P=>e.$router.push({name:"view_course",params:{course_slug:T.slug}})},[T.cover_photo&&!T.coverError?(n(),c("img",{key:0,src:T.cover_photo,alt:"",onError:P=>T.coverError=!0},null,40,PE)):(n(),c("div",IE))],8,FE),l("div",EE,[l("div",UE,[a($,{class:"course_route",to:{name:"view_course",params:{course_slug:T.slug}}},{default:r(()=>[V(d(T.title)+" ",1),T.status=="draft"?(n(),y(k,{key:0,type:"info"},{default:r(()=>[V(d(T.status),1)]),_:2},1024)):_("",!0)]),_:2},1032,["to"])]),l("div",AE,[l("div",BE,[l("span",null,d(e.$_n("%d Section","%d Sections",T.sectionsCount)),1),DE,l("span",null,d(e.$_n("%d Lesson","%d Lessons",T.lessonsCount)),1)]),T.studentsCount?(n(),c("div",RE,[a(g,null,{default:r(()=>[a(v)]),_:1}),V(" "+d(e.$_n("%s student","%s students",e.$formatNumber(T.studentsCount))),1)])):_("",!0)]),T.description?(n(),c("div",xE,d(i.getExcerpt(T.description)),1)):_("",!0),T.custom_html?(n(),c("div",{key:1,class:"fcom_box_card_custom_html",innerHTML:T.custom_html},null,8,HE)):_("",!0),l("div",OE,[T.isEnrolled?(n(),c("button",{key:0,class:R(["fcom_card_button",T.progress>=100?"fcom_card_button_success":"fcom_card_button_progress"]),onClick:P=>e.$router.push({name:"view_course",params:{course_slug:T.slug}})},d(e.$t("%s Completed",T.progress+"%")),11,jE)):(n(),c("button",{key:1,class:"fcom_card_button",onClick:P=>e.$router.push({name:"view_course",params:{course_slug:T.slug}})},d(e.$t("View Course")),9,NE))])])]))),128))]),a(C,{hide_on_single:!0,onFetch:i.fetchCourses,pagination:o.pagination},null,8,["onFetch","pagination"])])),[[E,o.loading]])]),_:1},8,["title"])]),_:1})}const qE=I(hE,[["render",zE],["__scopeId","data-v-6ac627c3"]]),GE={name:"ViewCoursesRoute",components:{Layout:we,AppLayout:Se},props:["course_slug"],data(){return{course:{},sections:[],track:{},loading:!1,currentLessonIndex:null,currentLesson:null}},watch:{course_slug(){this.fetchCourse()}},computed:{allLessons(){let e=[];return Oe(this.sections,t=>{Oe(t.lessons,s=>{e.push(s)})}),e},lessonsCount(){return this.allLessons.length}},methods:{fetchCourse(){this.loading=!0,this.$get("courses/"+this.course_slug+"/by-slug",{intended_lesson_slug:this.$route.params.lesson_slug||null}).then(e=>{this.sections=e.sections,this.track=e.track,this.$route.params.lesson_slug&&this.goToLesson(this.$route.params.lesson_slug,!0),this.course=e.course,this.changeTitle(this.course.title)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},handleNextLesson(){let e=null;if(this.currentLessonIndex===null){if(Oe(this.allLessons,(t,s)=>{if(!this.track.completed_lessons.includes(t.id.toString()))return e=t,!1}),!e)if(this.allLessons.length)e=this.allLessons[0];else return this.$notify.error(this.$t("Sorry, no lesson found")),!1}else Oe(this.allLessons,(t,s)=>{if(s>this.currentLessonIndex)return e=t,!1});e&&this.goToLesson(e.slug)},setPrevLesson(){let e=this.currentLessonIndex-1;if(e<0||!this.allLessons[e])return this.$notify.error(this.$t("Sorry, no lesson found")),!1;let t=this.allLessons[e];t&&this.goToLesson(t.slug)},goToLesson(e,t=!1){let s=null,u=null;Oe(this.allLessons,(o,i)=>{if(o.slug==e)return s=o,u=i,!1}),s&&(this.loading=!0,this.currentLesson=null,this.currentLessonIndex=null,this.$nextTick(()=>{this.currentLessonIndex=u,this.currentLesson=s,this.currentLesson.lazy_load&&(this.currentLesson.content_loading=!0,this.fetchLesson(s.slug,o=>{o.slug==this.currentLesson.slug&&(this.currentLesson.can_view=o.can_view,this.currentLesson.is_locked=o.is_locked,this.currentLesson.lock_type=o.lock_type,this.currentLesson.access_message=o.access_message,this.currentLesson.meta=o.meta,this.currentLesson.content=o.content,this.currentLesson.content_loading=!1)})),this.changeTitle(this.currentLesson.title),this.$router.push({name:"view_lesson",params:{lesson_slug:s.slug},query:t?this.$route.query:{}}),this.loading=!1}))},fetchLesson(e,t=null){this.$get("courses/"+this.course.slug+"/lessons/"+e+"/by-slug").then(s=>{t&&t(s.lesson)}).catch(s=>{this.$handleError(s),t&&t({slug:e,content:"<p>"+this.$t("Sorry, the lesson content could not be loaded.")+"</p>"})})}},created(){this.fetchCourse()}},YE={key:0},WE={style:{padding:"20px"},class:"fcom_course_sections fcom_white_loaded"},KE={key:1},ZE={key:2,style:{padding:"1rem 2rem"}};function JE(e,t,s,u,o,i){const m=ls,f=as,h=Z,g=p("layout"),w=p("app-layout"),b=p("router-view");return o.loading?(n(),c("div",YE,[a(w,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(g,{title:"...."},{title:r(()=>[a(f,{"separator-class":"el-icon-arrow-right"},{default:r(()=>[a(m,{to:{name:"courses"}},{default:r(()=>[V(d(e.$t("Courses")),1)]),_:1}),a(m,null,{default:r(()=>[V("....")]),_:1})]),_:1})]),default:r(()=>[l("div",WE,[a(h,{rows:10,animated:!0})])]),_:1})]),_:1})])):o.course.id?(n(),c("div",KE,[a(b,{track:o.track,course:o.course,sections:o.sections,lessonsCount:i.lessonsCount,currentLesson:o.currentLesson,currentLessonIndex:o.currentLessonIndex,onSetNextLesson:i.handleNextLesson,onSetPrevLesson:i.setPrevLesson,onGoToLesson:i.goToLesson,onReload:i.fetchCourse,onUpdateTrack:t[0]||(t[0]=S=>{o.track=S})},null,8,["track","course","sections","lessonsCount","currentLesson","currentLessonIndex","onSetNextLesson","onSetPrevLesson","onGoToLesson","onReload"])])):(n(),c("div",ZE,[l("h3",null,d(e.$t("Sorry, the course could not be loaded.")),1)]))}const QE=I(GE,[["render",JE]]),XE={name:"LockIcon",props:{fill:{type:String,default:"currentColor"}}},eU={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},tU=l("path",{d:"M10 13.7497V12.083",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),sU=l("path",{d:"M3.55618 15.704C3.74358 17.0958 4.89645 18.1863 6.29939 18.2508C7.4799 18.305 8.67909 18.3333 9.99967 18.3333C11.3203 18.3333 12.5194 18.305 13.7 18.2508C15.1029 18.1863 16.2558 17.0958 16.4432 15.704C16.5655 14.7956 16.6663 13.8647 16.6663 12.9167C16.6663 11.9686 16.5655 11.0378 16.4432 10.1294C16.2558 8.73752 15.1029 7.64707 13.7 7.58258C12.5194 7.52831 11.3203 7.5 9.99967 7.5C8.67909 7.5 7.4799 7.52831 6.29939 7.58258C4.89645 7.64707 3.74358 8.73752 3.55618 10.1294C3.43388 11.0378 3.33301 11.9686 3.33301 12.9167C3.33301 13.8647 3.43388 14.7956 3.55618 15.704Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),oU=l("path",{d:"M6.25 7.50033V5.41699C6.25 3.34592 7.92893 1.66699 10 1.66699C12.0711 1.66699 13.75 3.34592 13.75 5.41699V7.50033",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),iU=[tU,sU,oU];function nU(e,t,s,u,o,i){return n(),c("svg",eU,iU)}const lU=I(XE,[["render",nU]]),aU={name:"WelcomeBanner",components:{MediaPreview:He},props:{config:{type:Object,default:null},closeKey:{type:String,default:""},wrapperClass:{type:String,default:""},contentClass:{type:String,default:""}},data(){return{dismissed:!1}},computed:{effectiveConfig(){return this.config!==null?this.config:this.appVars.welcome_banner},showMedia(){return this.effectiveConfig&&this.effectiveConfig.mediaType=="video"&&this.effectiveConfig.bannerVideo},showCtaButtons(){var e;return this.effectiveConfig&&((e=this.effectiveConfig.ctaButtons)==null?void 0:e.length)&&this.effectiveConfig.ctaButtons.some(t=>t.link&&t.label)},isRemovable(){return this.effectiveConfig&&this.effectiveConfig.allowClose=="yes"},effectiveCloseKey(){return this.closeKey?this.closeKey:this.appVars.user_id?"fcom_welcome_banner_closed_auth":"fcom_welcome_banner_closed_guest"},showBanner(){if(this.dismissed)return!1;if(!this.isRemovable)return!0;const e=this.Storage.get(this.effectiveCloseKey,!1);return e?new Date().getTime()>e:!0}},methods:{closeBanner(){const e=new Date().getTime()+6048e5;this.Storage.set(this.effectiveCloseKey,e),this.dismissed=!0}}},rU={key:0,class:"fcom_welcome_title"},cU=["innerHTML"],dU={key:2,class:"fcom_welcome_cta_buttons"},uU=["href","target"];function _U(e,t,s,u,o,i){const m=p("media-preview"),f=Fe,h=p("MoreFilled"),g=j,w=H,b=ze,S=qe,k=Ge;return i.effectiveConfig&&i.showBanner?(n(),c("div",{key:0,class:R(["fcom_welcome_box",s.wrapperClass])},[i.showMedia?(n(),y(m,{key:0,media_item:i.effectiveConfig.bannerVideo},null,8,["media_item"])):i.effectiveConfig.bannerImage?(n(),y(f,{key:1,class:"feed_media",alt:e.$t("Image Preview"),src:i.effectiveConfig.bannerImage},null,8,["alt","src"])):_("",!0),l("div",{class:R(s.contentClass)},[i.effectiveConfig.title?(n(),c("h2",rU,d(i.effectiveConfig.title),1)):_("",!0),i.effectiveConfig.description_rendered?(n(),c("div",{key:1,class:"fcom_welcome_sub",innerHTML:i.effectiveConfig.description_rendered},null,8,cU)):_("",!0),i.showCtaButtons?(n(),c("div",dU,[(n(!0),c(F,null,x(i.effectiveConfig.ctaButtons,$=>(n(),c(F,null,[$.link&&$.label?(n(),c("a",{key:0,href:$.link,target:$.newTab=="yes"?"_blank":"",class:R({"el-button fcom_primary_button":$.type=="primary","el-button fcom_secondary_button":$.type=="secondary","el-button is-text":$.type=="text","el-link fcom_link_button":$.type=="link"})},d($.label),11,uU)):_("",!0)],64))),256))])):_("",!0)],2),i.isRemovable?(n(),y(k,{key:2,trigger:"click",class:"fcom_welcome_close"},{dropdown:r(()=>[a(S,null,{default:r(()=>[a(b,{onClick:i.closeBanner},{default:r(()=>[V(d(e.$t("Hide Banner")),1)]),_:1},8,["onClick"])]),_:1})]),default:r(()=>[a(w,{"aria-label":e.$t("Hide Banner"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),_:1})):_("",!0)],2)):_("",!0)}const ks=I(aU,[["render",_U]]),mU={name:"LockscreenView",components:{CustomLockscreenView:Ao,DefaultLockscreenPaywall:Bo,WelcomeBanner:ks},props:["space_profile","sections"],emits:["join"],data(){return{isRedirecting:!1}},created(){var e,t,s,u;((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.custom_lock_screen)=="redirect"&&((u=(s=this.space_profile)==null?void 0:s.settings)!=null&&u.onboard_redirect_url)&&(this.isRedirecting=!0,window.location.href=this.space_profile.settings.onboard_redirect_url)}},hU={key:0,style:{"text-align":"center",margin:"50px 0"}},fU={key:0,class:"space_default_lockscreen"},pU={class:"space_lock_box space_default_lock_box"},gU={key:0,class:"lock_desc"},yU={key:1,class:"lock_desc"},vU=["href"],bU={key:1,class:"space_lock_box"},kU={key:2,class:"space_lock_box"},wU=["href"];function CU(e,t,s,u,o,i){var b;const m=p("welcome-banner"),f=p("Lock"),h=j,g=p("default-lockscreen-paywall"),w=p("custom-lockscreen-view");return o.isRedirecting?(n(),c("h3",hU,d(e.$t("Please wait...")),1)):(n(),c(F,{key:1},[s.space_profile.lockscreen_config?(n(),c(F,{key:0},[s.space_profile.lockscreen_config.showCustom?(n(),y(w,{key:1,sections:s.sections,profile:s.space_profile},null,8,["sections","profile"])):(n(),c("div",fU,[s.space_profile.welcome_banner&&s.space_profile.lockscreen_config.showWelcomeBanner?(n(),y(m,{key:0,config:s.space_profile.welcome_banner,"close-key":"fcom_course_welcome_banner_closed_"+s.space_profile.id+(s.space_profile.isEnrolled?"_enrolled":"_not_enrolled"),"wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config","close-key"])):_("",!0),l("div",pU,[a(h,null,{default:r(()=>[a(f)]),_:1}),l("h4",null,d(e.$t("This is a private course")),1),s.space_profile.lockscreen_config.showPaywalls?(n(),c("p",gU,d(e.$t("Purchase access below or log in if you are already a member.")),1)):(n(),c("p",yU,d(e.$t("Members have to be invited to this course.")),1)),e.auth.user_id?_("",!0):(n(),c("a",{key:2,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.$t("Login or Signup")),9,vU))]),s.space_profile.lockscreen_config.showPaywalls?(n(),y(g,{key:1,space_id:(b=s.space_profile)==null?void 0:b.id},null,8,["space_id"])):_("",!0)]))],64)):s.space_profile.permissions.is_pending?(n(),c("div",bU,[a(h,null,{default:r(()=>[a(f)]),_:1}),l("h4",null,d(e.$t("Your request to join this course is pending")),1)])):e.auth.user_id?_("",!0):(n(),c("div",kU,[a(h,null,{default:r(()=>[a(f)]),_:1}),l("h4",null,d(e.$t("Please login/signup to enroll this course")),1),l("a",{href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,wU)]))],64))}const $U=I(mU,[["render",CU]]),SU={name:"CollapseIcon"},VU={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},MU=l("path",{d:"M16 4V13H18.25L15.25 16.75L12.25 13H14.5V4H16ZM10 14.5V16H3.25V14.5H10ZM11.5 9.25V10.75H3.25V9.25H11.5ZM11.5 4V5.5H3.25V4H11.5Z",fill:"currentColor"},null,-1),LU=[MU];function TU(e,t,s,u,o,i){return n(),c("svg",VU,LU)}const FU=I(SU,[["render",TU]]),PU={name:"ViewCourse",components:{VideoPlay:so,RenderSpaceLinks:vs,LockScreenView:$U,AppLayout:Se,Layout:we,CircleIcon:bs,LockIcon:lU,SocialLinks:Dt,PlayIcon:To,LessonIcon:Lo,PlayPlaceholderIcon:Fo,CollapseIcon:FU,WelcomeBanner:ks,ActionPopover:Ke},props:["course","sections","track","lessonsCount"],$emit:["setNextLesson","goToLesson","reload"],data(){return{enrolling:!1,restarting:!1}},computed:{sectionsCount(){return this.sections.reduce((e,t)=>e+(t.lessons.length?1:0),0)},isCustomLockScreen(){var e,t;return((t=(e=this.course)==null?void 0:e.settings)==null?void 0:t.custom_lock_screen)==="yes"},showCourseSections(){return this.track.isEnrolled||this.course.is_course_admin||!this.course.lockscreen_config},isModernLayout(){var e,t;return this.has_pro&&((t=(e=this.course)==null?void 0:e.settings)==null?void 0:t.course_layout)==="modern"},lessonDuration(){return e=>{const t=e.lessons.reduce((s,u)=>s+(u.meta.video_length||0),0);return this.formatSeconds(t)||null}},isCollapsed(){return this.sections.some(e=>e.is_closed)},showSidebar(){return!this.isMobile&&(this.track.isEnrolled||this.course.creator)}},methods:{toggleAllSections(){const e=this.isCollapsed;this.sections.forEach(t=>{t.is_closed=!e})},isEnabledMedia(e){var t;return((t=e.meta)==null?void 0:t.enable_media)=="yes"},showPlayIcon(e){return this.hasMediaVideo(e)&&(this.hasMediaImage(e)||e.featured_image)},hasMediaVideo(e){var s;const t=(s=e.meta)==null?void 0:s.media;return this.isEnabledMedia(e)&&(t==null?void 0:t.content_type)=="video"&&(!!(t!=null&&t.html)||(t==null?void 0:t.type)=="fluent_player")},hasMediaImage(e){var t,s;return this.isEnabledMedia(e)&&((s=(t=e.meta)==null?void 0:t.media)==null?void 0:s.image)},isFreePreview(e){var t;return this.has_pro&&((t=e==null?void 0:e.meta)==null?void 0:t.free_preview_lesson)=="yes"},isLockLesson(e,t){return!t.can_view&&!this.isFreePreview(t)},editLessonLink(){return this.$getRouteLink("admin/manage-courses/edit/:course_id/lessons",{course_id:this.course.id})},enroll(){this.enrolling=!0,this.$post("courses/"+this.course.id+"/enroll").then(e=>{this.$emit("reload"),this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.enrolling=!1})},continueCourse(){this.$emit("setNextLesson")},handleRestartCourse(e){!this.track.progress||this.restarting||(e(),this.restartCourse())},restartCourse(){this.$confirm(this.$t("This will reset your progress for this course to 0%. Continue?"),this.$t("Restart Course"),{confirmButtonText:this.$t("Yes, restart"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.restarting=!0,this.$del("courses/"+this.course.id+"/progress").then(e=>{this.$notify.success(e.message),this.$emit("reload")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.restarting=!1})}).catch(()=>{})},maybeGotoLesson(e,t,s){if(e.can_view){this.$emit("goToLesson",e.slug);return}if(!t.isEnrolled){this.$notify.info({message:this.$t("You need to enroll in this course to access this lesson"),type:"info"});return}if(s.is_locked){s.unlock_date&&this.$notify.info({message:this.$t("This lesson will be unlocked on %s",s.unlock_date),type:"info"});return}if(e.lock_type==="sequential"){this.$notify.info({message:this.$t("Complete the previous lesson to unlock this one."),type:"info"});return}this.$notify.info({message:this.$t("This lesson is locked."),type:"info"})},formatSeconds(e){if(e<1)return null;let t=Math.floor(e/3600),s=Math.floor(e%3600/60),u=e%60,o="";return t>0&&(o+=this.$t("%dh ",t)),s>0&&(o+=this.$t("%dm ",s)),u>0&&(o+=this.$t("%ds",u)),o.trim()||null}},mounted(){this.appVars.course_sections_collapsed=="yes"&&this.toggleAllSections()}},IU=["href"],EU={class:"fcom_course_actions"},UU=["href"];const AU={key:0,class:"fcom_sub_header"},BU={key:0,class:"fcom_notice"},DU={class:"fcom_feed_box course_box"},RU={class:"fcom_course_sections"},xU={class:"fcom_course_intro"},HU={class:"fcom_course_labels"},OU={class:"fcom_course_info"},jU=l("span",null," • ",-1),NU=["innerHTML"],zU={class:"fcom_card_sections"},qU={class:"fcom_section_items"},GU=["onClick"],YU={class:"fcom_section_primary_item_title"},WU={class:"title_line_container"},KU={class:"title_line"},ZU={key:0,class:"section_lock_badge"},JU={class:"fcom_meta_text"},QU={key:0,class:"fcom_meta_text"},XU={class:"fcom_section_primary_item_actions"},eA=["onClick"],tA={class:"fcom_heading_item clickable"},sA={class:"lesson_feature_media"},oA=["src","alt"],iA=["src","alt"],nA={class:"lesson_title"},lA=["innerHTML"],aA={class:"lesson_duration"},rA={key:0},cA={key:1},dA=["innerHTML"],uA={key:0,class:"fcom_section_item_actions"},_A={class:"fcom_meta_text"},mA={class:"fcom_main_side_wrap"},hA={class:"fcom_side_box"},fA={key:0,class:"app_side_widget course_widget"},pA={class:"widget_header"},gA={class:"widget_body"},yA={class:"progress_label"},vA={key:0,style:{margin:"20px 0"}},bA={key:1,class:"app_side_widget course_widget"},kA={class:"widget_header"},wA={class:"widget_body"},CA={class:"creator_details"},$A={class:"creator_details_item"},SA={class:"creator_details_info"},VA={class:"info_text"},MA={class:"details_name"},LA={class:"details_meta"},TA={class:"fcom_meta_text"},FA={key:0,class:"fcom_meta_text"},PA=["innerHTML"],IA={key:2};function EA(e,t,s,u,o,i){const m=ls,f=as,h=H,g=p("action-popover"),w=p("render-space-links"),b=p("welcome-banner"),S=p("CollapseIcon"),k=p("Lock"),$=j,v=p("ArrowRight"),C=p("ArrowDown"),L=p("SuccessFilled"),M=p("LockIcon"),E=p("CircleIcon"),T=p("PlayPlaceholderIcon"),P=p("LessonIcon"),U=p("PlayIcon"),D=p("VideoPlay"),A=Le,q=os,O=p("UserAvatar"),N=p("UserRouteLink"),G=p("SocialLinks"),ae=et,B=Ye,X=p("LockScreenView"),me=p("layout"),ee=p("app-layout"),Ve=te("loading");return n(),y(ee,{wrapper_class:"fcom_single_layout fcom_max_layout fcom_course_view_layout"},{default:r(()=>[a(me,{wrapper_class:["no_bg_layout",{custom_lockscreen:!i.showCourseSections}],title:e.$t("Courses")},{title:r(()=>[a(f,{"separator-class":"el-icon-arrow-right"},{default:r(()=>[a(m,{to:{name:"courses"}},{default:r(()=>[V(d(e.$t("Courses")),1)]),_:1}),a(m,null,{default:r(()=>[V(d(s.course.title)+" ",1),s.course.is_course_admin?(n(),c("a",{key:0,class:"fcom_edit_course fcom_secondary_button",style:{cursor:"pointer"},href:i.editLessonLink()},d(e.$t("Edit Lessons")),9,IU)):_("",!0)]),_:1})]),_:1})]),actions:r(()=>[l("div",EU,[e.auth.user_id?!s.track.isEnrolled&&s.course.id&&s.course.can_self_enroll?W((n(),y(h,{key:1,disabled:o.enrolling,onClick:i.enroll,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[Ve,o.enrolling]]):s.track.isEnrolled?(n(),c(F,{key:2},[s.track.progress!=100?(n(),y(h,{key:0,class:"fcom_primary_button",onClick:i.continueCourse},{default:r(()=>[V(d(e.$t("Continue Course")),1)]),_:1},8,["onClick"])):_("",!0),_("",!0)],64)):_("",!0):(n(),c(F,{key:0},[i.isCustomLockScreen?_("",!0):(n(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login to enroll this course")),9,UU))],64))])]),sub_header:r(()=>{var Q,J;return[s.course&&i.showCourseSections&&((J=(Q=s.course)==null?void 0:Q.settings)!=null&&J.links.length)?(n(),c("div",AU,[a(w,{links:s.course.settings.links},null,8,["links"])])):_("",!0)]}),default:r(()=>[s.course.status==="draft"?(n(),c("div",BU,[l("p",null,d(e.$t("This course is in Draft status and only visible to Admin / Moderators")),1)])):_("",!0),i.showCourseSections?(n(),y(B,{key:1,class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(A,{class:"fcom_main"},{default:r(()=>{var Q;return[s.course.welcome_banner?(n(),y(b,{key:0,config:s.course.welcome_banner,"close-key":"fcom_course_welcome_banner_closed_"+s.course.id+(s.course.isEnrolled?"_enrolled":"_not_enrolled"),"wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config","close-key"])):_("",!0),l("div",DU,[l("div",RU,[l("div",xU,[l("div",HU,[l("h3",null,d(s.course.title),1),l("p",OU,[V(d(e.$_n("%s Topic","%s Topics",i.sectionsCount))+" ",1),jU,V(" "+d(e.$_n("%s Lesson","%s Lessons",s.lessonsCount)),1)])])]),(Q=s.course.settings)!=null&&Q.course_details_rendered?(n(),c("div",{key:0,class:"fcom_course_details feed_md_content",innerHTML:s.course.settings.course_details_rendered},null,8,NU)):_("",!0),l("div",{class:R(["course_contents_header",{is_collapsed:i.isCollapsed}])},[l("h4",null,d(e.$t("Course Contents")),1),i.sectionsCount>1?(n(),y(S,{key:0,class:"collapse_icon clickable",onClick:i.toggleAllSections},null,8,["onClick"])):_("",!0)],2),l("div",zU,[l("div",qU,[(n(!0),c(F,null,x(s.sections,J=>(n(),c("div",{key:J.id,class:"fcom_section_primary"},[l("div",{onClick:ie=>J.is_closed=!J.is_closed,class:R(["clickable fcom_section_primary_item",{is_closed:J.is_closed}])},[l("div",YU,[l("div",WU,[l("div",KU,[l("h4",null,d(J.title),1),J.unlock_date?(n(),c("span",ZU,[J.is_locked?(n(),y($,{key:0},{default:r(()=>[a(k)]),_:1})):_("",!0),l("span",null," ("+d(e.$t("will unlock at %s",e.smartDate(J.unlock_date,!0,!0)))+") ",1)])):_("",!0)]),l("span",JU,d(e.$_n("%s lesson","%s lessons",J.lessons.length)),1),i.lessonDuration(J)?(n(),c("span",QU," • "+d(i.lessonDuration(J)),1)):_("",!0)])]),l("div",XU,[a($,null,{default:r(()=>[J.is_closed?(n(),y(v,{key:0,class:"fcom_arrow_icon"})):(n(),y(C,{key:1}))]),_:2},1024)])],10,GU),J.is_closed?_("",!0):(n(!0),c(F,{key:0},x(J.lessons,ie=>(n(),c("div",{key:ie.id,class:R(["fcom_section_item",{is_locked:i.isLockLesson(J,ie)}])},[l("div",{onClick:vt=>i.maybeGotoLesson(ie,s.track,J),class:"fcom_section_item_title"},[l("p",tA,[s.track.completed_lessons.includes(ie.id.toString())?(n(),y($,{key:0,style:{color:"#008a2e"}},{default:r(()=>[a(L)]),_:1})):i.isLockLesson(J,ie)?(n(),y($,{key:1},{default:r(()=>[a(M)]),_:1})):(n(),y($,{key:2},{default:r(()=>[a(E)]),_:1})),i.isModernLayout?(n(),c(F,{key:3},[l("span",sA,[ie.featured_image?(n(),c("img",{key:0,src:ie.featured_image,alt:ie.title},null,8,oA)):i.hasMediaImage(ie)?(n(),c("img",{key:1,src:ie.meta.media.image,alt:ie.title},null,8,iA)):i.hasMediaVideo(ie)?(n(),y(T,{key:2})):(n(),y(P,{key:3})),i.showPlayIcon(ie)?(n(),y(U,{key:4,class:"play_icon"})):_("",!0)]),l("span",nA,[l("span",{innerHTML:ie.title},null,8,lA),l("span",aA,[ie.meta.video_length?(n(),c("span",rA,d(i.formatSeconds(ie.meta.video_length)),1)):(n(),c("span",cA,d("---")))])])],64)):(n(),c("span",{key:4,innerHTML:ie.title},null,8,dA))])],8,eA),!i.isModernLayout&&ie.meta.enable_media=="yes"&&ie.meta.video_length?(n(),c("div",uA,[l("span",_A,[ie.meta.video_length?(n(),y(h,{key:0,onClick:vt=>i.maybeGotoLesson(ie,s.track,J),text:""},{default:r(()=>[a($,{class:"fcom_play_btn_icon"},{default:r(()=>[a(D)]),_:1}),l("span",null,d(i.formatSeconds(ie.meta.video_length)),1)]),_:2},1032,["onClick"])):_("",!0)])])):_("",!0)],2))),128))]))),128))])])])])]}),_:1}),i.showSidebar?(n(),y(ae,{key:0,class:"fcom_resp_side",width:"306px"},{default:r(()=>[l("div",mA,[l("div",hA,[s.track.isEnrolled?(n(),c("div",fA,[l("div",pA,[l("h3",null,d(e.$t("Course progress")),1)]),l("div",gA,[l("div",yA,[l("p",null,d(e.$t("Completed %1$s of %2$s",s.track.completed_lessons.length,s.lessonsCount)),1),l("span",null,d(parseInt(s.track.progress))+"%",1)]),a(q,{class:"fcom_progress","stroke-width":10,percentage:parseInt(s.track.progress),"show-text":!1},null,8,["percentage"]),s.track.progress==100?(n(),c("div",vA,[l("h5",null,d(e.$t("Congratulations! Course completed! 🎉")),1)])):_("",!0)])])):_("",!0),s.course.creator?(n(),c("div",bA,[l("div",kA,[l("h3",null,d(e.$t("Course Instructor")),1)]),l("div",wA,[l("div",CA,[l("div",$A,[l("div",SA,[a(O,{with_level:!1,xprofile:s.course.creator},null,8,["xprofile"]),l("div",VA,[l("div",MA,[a(N,{show_badge:!0,xprofile:s.course.creator},null,8,["xprofile"])]),l("div",LA,[l("span",TA,d(e.$_n("%d Course","%d Courses",s.course.creator.total_courses)),1),s.course.creator.total_students?(n(),c("span",FA," • "+d(e.$_n("%d Student","%d Students",s.course.creator.total_students)),1)):_("",!0)])])]),s.course.creator.short_description_rendered?(n(),c("div",{key:0,class:"creator_details_description feed_md_content",innerHTML:s.course.creator.short_description_rendered},null,8,PA)):_("",!0)]),a(G,{xprofile:s.course.creator},null,8,["xprofile"])])])])):_("",!0)])])]),_:1})):_("",!0)]),_:1})):_("",!0),i.showCourseSections?_("",!0):(n(),c("div",IA,[a(X,{space_profile:s.course,sections:s.sections},null,8,["space_profile","sections"])]))]),_:1},8,["wrapper_class","title"])]),_:1})}const UA=I(PU,[["render",EA]]),AA={name:"CommentBox",mixins:[Bt],components:{FeedComments:go,FeedTextComposer:pt},props:{feed:{type:Object,required:!0},showAll:{type:Boolean,default:!0},checkPermission:{type:Boolean,default:!0},is_single:{type:Boolean,default:!0},show_comment_form:{type:Boolean,default:!0}},data(){return{show_all_comments:this.showAll,commenting:!1,comment:{message:"",media_images:[]},saving:!1,showCommentBox:!0,sortBy:"oldest"}},methods:{postComment(){var t,s,u;const e=((t=this.comment.media_images)==null?void 0:t.length)>0||((u=(s=this.comment.meta)==null?void 0:s.media_preview)==null?void 0:u.image);!this.comment.message&&!e||(this.saving=!0,this.$post("feeds/"+this.feed.id+"/comments",{comment:this.comment.message,media_images:this.comment.media_images,meta:this.comment.meta}).then(o=>{this.feed.comments||(this.feed.comments=[]),this.feed.comments.unshift(o.comment),this.$emit("commented",o.comment),this.$eventBus.emit("recent_activities_refresh"),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.commenting=!1,this.comment=null,this.showCommentBox=!1,this.$nextTick(()=>{this.scrollCommentIntoView(o.comment.id),this.comment={message:"",media_image:""}}),this.showCommentBox=!0}).catch(o=>{this.$handleError(o)}).finally(()=>{this.saving=!1}))},showCommentForm(){this.show_all_comments=!0,this.commenting=!0,this.$nextTick(()=>{this.$refs.commentInput&&this.$refs.commentInput.focus()})},showAllComments(){this.show_all_comments=!0,this.commenting=!0},getSpaceId(){var e,t;return((e=this.feed)==null?void 0:e.course_id)||((t=this.feed)==null?void 0:t.space_id)},changeCommentsSortBy(){this.$storeLocalData("comments_sort_by",this.sortBy)}},mounted(){let e=this.feed.default_comment_sort_by||"oldest";this.sortBy=this.$getLocalData("comments_sort_by",e)}},BA=["id"],DA={key:0,class:"feed_commenting"},RA={class:"person_avatar"},xA=["src"],HA={key:0,class:"feed_comment_input"},OA={key:1,class:""},jA={style:{padding:"0",margin:"0","text-align":"center"}},NA={key:0,class:"fcom_comment_sorting"};function zA(e,t,s,u,o,i){const m=H,f=p("feed-text-composer"),h=p("router-link"),g=ne,w=le,b=p("feed-comments");return n(),c("div",{class:R(["fcom_comment_box","fcom_comment_box_"+s.feed.type])},[Y(e.$slots,"before_comment_box"),(o.commenting||s.is_single)&&s.show_comment_form?(n(),c("div",{key:0,id:"feed_comment_form_"+s.feed.id,class:"feed_comment"},[!s.checkPermission||e.hasCommentPermission(s.feed)?(n(),c(F,{key:0},[o.comment?(n(),c("div",DA,[l("div",RA,[l("img",{alt:"",src:e.auth.avatar},null,8,xA)]),o.showCommentBox?(n(),c("div",HA,[a(f,{context:"comment",mentionQuery:{space_id:i.getSpaceId()},autofocus_changed:o.commenting,autofocus:o.commenting,disabled:o.saving,placeholder:e.$t("Write a comment"),content:o.comment},{default:r(()=>[a(m,{loading:o.saving,disabled:o.saving,class:"fcom_primary_button",size:"small",onClick:t[0]||(t[0]=S=>i.postComment())},{default:r(()=>[V(d(e.$t("Post Comment")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["mentionQuery","autofocus_changed","autofocus","disabled","placeholder","content"])])):_("",!0)])):_("",!0)],64)):(n(),c("div",OA,[l("p",jA,[V(d(e.$t("Please join the Space to post a comment."))+" ",1),s.feed.space?(n(),y(h,{key:0,to:{name:"space_feeds",params:{space:s.feed.space.slug}}},{default:r(()=>[V(d(e.$t("Go to community")),1)]),_:1},8,["to"])):_("",!0)])]))],8,BA)):_("",!0),a(b,{sortBy:o.sortBy,checkPermission:s.checkPermission,onForceShowAll:i.showAllComments,show_all:o.show_all_comments,feed:s.feed},{before_comments_start:r(()=>[s.feed.comments_count>=2?(n(),c("div",NA,[a(w,{"aria-label":e.$t("Sort comments by"),onChange:t[1]||(t[1]=S=>i.changeCommentsSortBy()),modelValue:o.sortBy,"onUpdate:modelValue":t[2]||(t[2]=S=>o.sortBy=S),class:"fcom_off_color fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Sort by")},{default:r(()=>[a(g,{value:"oldest",label:e.$t("Earliest")},null,8,["label"]),a(g,{value:"latest",label:e.$t("Latest")},null,8,["label"]),a(g,{value:"popular",label:e.$t("Popular")},null,8,["label"]),a(g,{value:"most_replied",label:e.$t("Most Replied")},null,8,["label"])]),_:1},8,["aria-label","modelValue","placeholder"])])):_("",!0)]),_:1},8,["sortBy","checkPermission","onForceShowAll","show_all","feed"]),Y(e.$slots,"after_comment_box")],2)}const qA=I(AA,[["render",zA]]),GA={name:"ExitFullScreen"},YA={viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"},WA=l("path",{d:"M5.5 0a.5.5 0 0 1 .5.5v4A1.5 1.5 0 0 1 4.5 6h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5zm5 0a.5.5 0 0 1 .5.5v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 1 0 1h-4A1.5 1.5 0 0 1 10 4.5v-4a.5.5 0 0 1 .5-.5zM0 10.5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 6 11.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5zm10 1a1.5 1.5 0 0 1 1.5-1.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0v-4z"},null,-1),KA=[WA];function ZA(e,t,s,u,o,i){return n(),c("svg",YA,KA)}const JA=I(GA,[["render",ZA]]),QA={name:"QuizView",props:{lesson:{type:Object,required:!0},isEnrolled:{type:Boolean,required:!0},questions:{type:Array,required:!0}},components:{Check:eo},data(){return{userResult:{},answers:this.initAnswers(),isNew:!1,submitting:!1,loading:!1}},computed:{alreadyAttempted(){var e;return(e=this.userResult)==null?void 0:e.id},isAllAnswersSelected(){return this.questions.every(e=>this.isSingleChoice(e)?this.answers[e.slug]!==null:this.isWrittenAnswer(e)?this.answers[e.slug]&&this.answers[e.slug].trim()!=="":this.answers[e.slug]&&this.answers[e.slug].length>0)},quizSettings(){return this.lesson.meta},showResult(){var e;return this.quizSettings.hide_result=="no"&&((e=this.userResult)==null?void 0:e.id)},isPassed(){var e;return((e=this.userResult)==null?void 0:e.status)==="passed"}},methods:{initAnswers(){return this.questions.reduce((e,t)=>(t.type=="single_choice"?e[t.slug]=null:t.type=="written_answer"?e[t.slug]="":e[t.slug]=[],e),{})},syncAnswers(){var t;const e=((t=this.userResult)==null?void 0:t.message)||[];this.answers=this.initAnswers(),e&&an.each(e,(s,u)=>{this.answers[u]=s.user_answer})},retakeQuiz(){this.answers=this.initAnswers(),this.userResult={},this.submitting=!1,this.loading=!1,this.isNew=!0},showQuestion(e){var s;if(!this.alreadyAttempted)return!0;const t=((s=this.userResult)==null?void 0:s.message)||[];return!!(this.isNew||t[e.slug])},isSingleChoice(e){return e.type=="single_choice"},isMultipleChoice(e){return e.type=="multiple_choice"},isWrittenAnswer(e){return e.type=="written_answer"},isExactMatchQuestion(e){return e.grading_mode==="exact_match"},freeTextBadgeClass(e){return this.isExactMatchQuestion(e)?this.isQuestionCorrect(e)?"correct":"incorrect":"correct"},showQuestionImage(e){return e.image_enabled&&e.image_url},isQuestionCorrect(e){var t,s,u;return(u=(s=(t=this.userResult)==null?void 0:t.message)==null?void 0:s[e.slug])==null?void 0:u.is_correct},isOptionSelected(e,t){return this.isSingleChoice(e)?this.answers[e.slug]===t.label:(this.answers[e.slug]||[]).includes(t.label)},handleOptionChange(e,t){if(this.isSingleChoice(e)&&(this.answers[e.slug]===t.label?this.answers[e.slug]=null:this.answers[e.slug]=t.label),this.isMultipleChoice(e)){const s=this.answers[e.slug]||[];s.indexOf(t.label)>-1?this.answers[e.slug]=s.filter(o=>o!==t.label):this.answers[e.slug]=[...s,t.label]}},fetchAnswers(){this.loading=!0,this.$get("courses/"+this.lesson.course_id+"/lessons/"+this.lesson.id+"/quiz/result").then(e=>{this.userResult=e.result||{},this.syncAnswers()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},submitQuiz(){this.has_pro&&(this.submitting=!0,this.$post("courses/"+this.lesson.course_id+"/lessons/"+this.lesson.id+"/quiz/submit",{course_id:this.lesson.course_id,lesson_id:this.lesson.id,answers:this.answers}).then(e=>{this.$notify.success(e.message),this.userResult=e.result,this.isNew=!1,this.syncAnswers()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.submitting=!1}))}},mounted(){this.isEnrolled&&this.has_pro&&this.fetchAnswers()}},XA={key:0,class:"fcom_questions_wrap"},eB={key:0,class:"fcom_quiz_result"},tB={class:"result_status"},sB={key:0,class:"result_status_text"},oB={key:0},iB={key:1},nB={class:"result_score"},lB={class:"score_part"},aB={class:"part_label"},rB={class:"part_value"},cB={class:"score_part"},dB={class:"part_label"},uB={class:"part_value"},_B={key:0,class:"fcom_question_image"},mB={class:"fcom_question_header"},hB=["innerHTML"],fB={class:"fcom_question_body"},pB={key:0,class:"correct_text"},gB={key:1,class:"correct_text"},yB={class:"fcom_written_answer_answer"},vB={key:1,class:"fcom_user_answer_text"},bB={key:0,class:"correct_text"},kB={key:1,class:"correct_text"},wB={class:"fcom_question_options"},CB={key:2,class:"question_help_text"},$B={key:2,class:"fcom_quiz_footer"},SB={key:0},VB={key:1},MB={key:0};function LB(e,t,s,u,o,i){var $,v;const m=H,f=Fe,h=p("Check"),g=j,w=p("Close"),b=se,S=he,k=Z;return n(),c(F,null,[o.loading?(n(),y(k,{key:1,rows:5,animated:""})):(n(),c("div",XA,[i.alreadyAttempted?(n(),c("div",eB,[l("div",tB,[["passed","failed"].includes(o.userResult.status)?(n(),c("div",sB,[l("p",null,[i.isPassed?(n(),c("span",oB,"🎉 ")):(n(),c("span",iB,"😞 ")),l("span",null,d(e.$t("You")),1),l("span",{style:re({color:i.isPassed?"green":"red"})},d(i.isPassed?" "+e.$t("passed")+" ":" "+e.$t("failed")+" "),5),l("span",null,d(e.$t("the quiz.")),1)]),l("p",null,d(i.isPassed?e.$t("Great job!"):e.$t("Try again!")),1)])):(n(),c(F,{key:1},[l("p",null,d(e.$t("We have saved your quiz results.")),1),l("p",null,d(e.$t("Please await the grading.")),1)],64)),a(m,{class:"fcom_secondary_button",onClick:i.retakeQuiz},{default:r(()=>[V(d(e.$t("Retake Quiz")),1)]),_:1},8,["onClick"])]),l("div",nB,[l("div",lB,[l("span",aB,d(e.$t("Score")),1),l("span",rB,d(o.userResult.score)+"%",1)]),l("div",cB,[l("span",dB,d(e.$t("Correct Answers")),1),l("span",uB,d((($=o.userResult.meta)==null?void 0:$.correct_answers)+" / "+((v=o.userResult.meta)==null?void 0:v.total_questions)),1)])])])):_("",!0),(n(!0),c(F,null,x(s.questions,C=>(n(),c(F,{key:C.slug},[i.showQuestion(C)?(n(),c("div",{key:0,class:R(["fcom_question",C.type])},[i.showQuestionImage(C)?(n(),c("div",_B,[a(f,{src:C.image_url},null,8,["src"])])):_("",!0),l("div",mB,[l("div",{innerHTML:C.label_rendered,class:"fcom_question_label"},null,8,hB)]),l("div",fB,[i.isWrittenAnswer(C)?(n(),c(F,{key:0},[i.showResult?(n(),c("div",{key:0,class:R(["fcom_is_correct",i.freeTextBadgeClass(C)])},[i.isExactMatchQuestion(C)?(n(),c("p",pB,[i.isQuestionCorrect(C)?(n(),c(F,{key:0},[a(g,null,{default:r(()=>[a(h)]),_:1}),V(" "+d(e.$t("Correct")),1)],64)):(n(),c(F,{key:1},[a(g,null,{default:r(()=>[a(w)]),_:1}),V(" "+d(e.$t("Incorrect")),1)],64))])):(n(),c("p",gB,[a(g,null,{default:r(()=>[a(h)]),_:1}),V(" "+d(e.$t("Answered")),1)]))],2)):_("",!0),l("div",yB,[!i.alreadyAttempted||o.isNew?(n(),c(F,{key:0},[i.isExactMatchQuestion(C)?(n(),y(b,{key:0,type:"text",modelValue:o.answers[C.slug],"onUpdate:modelValue":L=>o.answers[C.slug]=L,placeholder:e.$t("Type your answer"),maxlength:500},null,8,["modelValue","onUpdate:modelValue","placeholder"])):(n(),y(b,{key:1,type:"textarea",rows:4,modelValue:o.answers[C.slug],"onUpdate:modelValue":L=>o.answers[C.slug]=L,placeholder:e.$t("Write your answer here..."),maxlength:1e4,"show-word-limit":""},null,8,["modelValue","onUpdate:modelValue","placeholder"]))],64)):(n(),c("div",vB,d(o.answers[C.slug]),1))])],64)):(n(),c(F,{key:1},[i.showResult?(n(),c("div",{key:0,class:R(["fcom_is_correct",i.isQuestionCorrect(C)?"correct":"incorrect"])},[i.isQuestionCorrect(C)?(n(),c("p",bB,[a(g,null,{default:r(()=>[a(h)]),_:1}),V(" "+d(e.$t("Correct")),1)])):(n(),c("p",kB,[a(g,null,{default:r(()=>[a(w)]),_:1}),V(" "+d(e.$t("Incorrect")),1)]))],2)):_("",!0),l("div",wB,[(n(!0),c(F,null,x(C.options,L=>(n(),c("div",{key:L.label,class:"fcom_question_option"},[a(S,{class:R({single_choice:i.isSingleChoice(C)}),"model-value":i.isOptionSelected(C,L),onChange:M=>i.handleOptionChange(C,L)},{default:r(()=>[V(d(L.label),1)]),_:2},1032,["class","model-value","onChange"])]))),128))])],64)),C.help_text?(n(),c("div",CB,d(C.help_text),1)):_("",!0)])],2)):_("",!0)],64))),128))])),!o.loading&&!i.alreadyAttempted?(n(),c("div",$B,[s.isEnrolled?(n(),c("p",VB,d(e.$t("Answer all questions to submit")),1)):(n(),c("p",SB,d(e.$t("You need to enroll in this course to take this quiz.")),1)),a(m,{class:"fcom_primary_button",onClick:i.submitQuiz,loading:o.submitting,disabled:o.submitting||!s.isEnrolled||!i.isAllAnswersSelected},{default:r(()=>[V(d(e.$t("Submit Quiz"))+" ",1),e.has_pro?_("",!0):(n(),c("span",MB," ("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["onClick","loading","disabled"])])):_("",!0)],64)}const TB=I(QA,[["render",LB]]),FB={name:"ViewLesson",components:{PaperClipIcon:_o,DocumentLists:ot,CircleIcon:bs,AppLayout:Se,Layout:we,MediaPreview:He,CommentBox:qA,ChatIcon:tt,ExitFullScreen:JA,QuizView:TB},props:["course","sections","track","currentLesson","lessonsCount","lesson_slug","currentLessonIndex"],emits:["setNextLesson","setPrevLesson","goToLesson","reload"],data(){return{completing:!1,isFullScreen:!1,sm_side_show:!1,isTransiting:!1,enrolling:!1,lightboxImages:[],lightboxIndex:0,_lightboxHandler:null}},watch:{currentLessonIndex(){this.sm_side_show=!1},lesson_slug(){this._autoCompleteTimer&&(clearTimeout(this._autoCompleteTimer),this._autoCompleteTimer=null),this.currentLesson.slug&&this.currentLesson.slug!=this.lesson_slug&&this.gotoLesson({slug:this.lesson_slug})},"currentLesson.content":{handler(e){e&&this.$nextTick(()=>{var t;e.includes("<media-player")&&e.includes("fluent-player")&&document.dispatchEvent(new CustomEvent("FComMediaReady",{detail:{media:((t=this.currentLesson.meta)==null?void 0:t.media)||{},feed:this.currentLesson}})),this.setupLightboxImages()})},immediate:!0}},computed:{isCompleted(){return this.track.completed_lessons.includes(this.currentLesson.id.toString())},isQuizContent(){return this.currentLesson.content_type=="quiz"},commentsEnabled(){return this.course.settings.disable_comments!="yes"&&this.currentLesson.can_view&&this.currentLesson.meta.enable_comments==="yes"},containerHeight(){if(!this.isFullScreen){const e=document.querySelector(".fcom_mobile_menu");return`calc(100dvh - (var(--fcom-header-height, 0px) + ${e?e.offsetHeight:0}px))`}return"100dvh !important"},hasDocuments(){return this.currentLesson.meta.document_lists&&this.currentLesson.meta.document_lists.length>0},showMediaPreview(){var e,t,s,u,o,i;return((s=(t=(e=this.currentLesson)==null?void 0:e.meta)==null?void 0:t.media)==null?void 0:s.url)||((i=(o=(u=this.currentLesson)==null?void 0:u.meta)==null?void 0:o.media)==null?void 0:i.html)},isVideoGated(){var e,t;return!!((t=(e=this.currentLesson)==null?void 0:e.meta)!=null&&t.is_video_gated)},isVideoGateLocked(){var e,t;return this.isCompleted||this.course.is_course_admin?!1:this.isVideoGated&&!((t=(e=this.currentLesson)==null?void 0:e.meta)!=null&&t.video_watched)}},methods:{markAsComplete(){if(this.isVideoGateLocked||this.completing)return;this.completing=!0;let e=this.isCompleted?"incomplete":"completed";this.$put("courses/"+this.course.id+"/lessons/"+this.currentLesson.id+"/completion",{state:e}).then(t=>{this.track.completed_lessons=t.track.completed_lessons,this.$emit("updateTrack",t.track),e=="completed"?this.$emit("setNextLesson"):this.isVideoGated&&(this.currentLesson.meta.video_watched=!1,document.dispatchEvent(new CustomEvent("FComLessonVideoUnwatched",{detail:{lessonId:this.currentLesson.id}})))}).catch(t=>{this.$handleError(t)}).finally(()=>{this.completing=!1})},toggleFullScreen(){this.isFullScreen=!this.isFullScreen,this.$storeLocalData("lesson_fs",this.isFullScreen?"yes":"no")},onFullScreenKeydown(e){e.key==="Escape"&&this.isFullScreen&&this.toggleFullScreen()},scrollToComments(){this.$refs.lesson_scroller&&this.$refs.lesson_scroller.scrollTo({top:this.$refs.fcom_course_comments.offsetTop-100})},enroll(){this.enrolling=!0,this.$post("courses/"+this.course.id+"/enroll").then(e=>{this.$emit("reload"),this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.enrolling=!1})},scrollToDocuments(){this.$refs.lesson_scroller&&this.$refs.lesson_scroller.scrollTo({top:this.$refs.fcom_course_documents.offsetTop-100})},gotoLesson(e){this.$emit("goToLesson",e.slug)},setupLightboxImages(){const e=this.$refs.lessonContent;if(!e)return;const t=e.querySelectorAll(".wp-lightbox-container img");if(!t.length)return;const s=Array.from(t).map(u=>u.src).filter(Boolean);s.length&&(this._lightboxHandler&&e.removeEventListener("click",this._lightboxHandler),this._lightboxHandler=u=>{const o=u.target.closest("img");u.target.closest(".wp-lightbox-container")&&o&&(u.preventDefault(),u.stopPropagation(),this.lightboxImages=s,this.lightboxIndex=Math.max(0,s.indexOf(o.src)))},e.addEventListener("click",this._lightboxHandler))},setSidebarScroll(){let e=document.getElementById("fcom_lesson_title_"+this.currentLesson.id),t=this.$refs.lesson_index_sidebar.wrapRef;const s=e.getBoundingClientRect(),u=t.getBoundingClientRect();s.top>=u.top&&s.bottom<=u.bottom&&s.left>=u.left&&s.right<=u.right||e.scrollIntoView({behavior:"instant",block:"center"})}},mounted(){this.isFullScreen=this.$getLocalData("lesson_fs",this.appVars.course_lesson_fullscreen)=="yes",window.scrollTo(0,0),this.$refs.lesson_scroller&&this.$refs.lesson_scroller.setScrollTop(0),this.$route.query.comment_id&&setTimeout(()=>{let t=document.getElementById("comment_"+this.$route.query.comment_id);t&&(this.$refs.lesson_scroller&&this.$refs.lesson_scroller.setScrollTop(t.offsetTop),t.classList.add("fcom_highlight_comment"))},500),document.body.classList.add("fcom-no-scroll"),document.addEventListener("keydown",this.onFullScreenKeydown),this._videoWatchedHandler=t=>{var s,u,o;((s=t.detail)==null?void 0:s.lessonId)==((u=this.currentLesson)==null?void 0:u.id)&&((o=this.currentLesson)!=null&&o.meta)&&(this.currentLesson.meta.video_watched=!0)},document.addEventListener("FComLessonVideoWatched",this._videoWatchedHandler),this._videoFullyWatchedHandler=t=>{var o,i,m,f,h;const s=(o=t.detail)==null?void 0:o.lessonId;if(s!=((i=this.currentLesson)==null?void 0:i.id)||!((f=(m=this.currentLesson)==null?void 0:m.meta)!=null&&f.video_auto_complete)||!this.track.isEnrolled||this.isCompleted||this._autoCompleteTimer)return;const u=parseInt((h=window.fcomLessonVideoGate)==null?void 0:h.auto_complete_delay);this._autoCompleteTimer=setTimeout(()=>{var g;this._autoCompleteTimer=null,((g=this.currentLesson)==null?void 0:g.id)==s&&!this.isCompleted&&this.markAsComplete()},(isNaN(u)?3:u)*1e3)},document.addEventListener("FComLessonVideoFullyWatched",this._videoFullyWatchedHandler),this.setSidebarScroll();const e=document.getElementById("fcom_lesson_inline_css");if(e&&e.remove(),this.currentLesson.inline_css){const t=document.createElement("style");t.type="text/css",t.id="fcom_lesson_inline_css",t.appendChild(document.createTextNode(this.currentLesson.inline_css)),document.head.appendChild(t)}},beforeUnmount(){document.body.classList.remove("fcom-no-scroll"),document.removeEventListener("keydown",this.onFullScreenKeydown),this._videoWatchedHandler&&document.removeEventListener("FComLessonVideoWatched",this._videoWatchedHandler),this._videoFullyWatchedHandler&&document.removeEventListener("FComLessonVideoFullyWatched",this._videoFullyWatchedHandler),this._autoCompleteTimer&&(clearTimeout(this._autoCompleteTimer),this._autoCompleteTimer=null),this._lightboxHandler&&this.$refs.lessonContent&&this.$refs.lessonContent.removeEventListener("click",this._lightboxHandler)}},PB={key:0},IB={class:"fcom_back_space"},EB={class:"fcom_lesson_details",style:{padding:"2rem"}},UB={class:"fcom_back_space"},AB={class:"fcom_lesson_name"},BB={class:"fcom_lesson_nav"},DB={key:1},RB=["href"],xB={class:"fcom_lesson_details"},HB={class:"fcom_lesson_header"},OB={class:"fcom_lesson_title"},jB={class:"fcom_lesson_number"},NB=["href"],zB=["innerHTML"],qB={class:"fcom_lesson_nav"},GB=["innerHTML"],YB={class:"fcom_lesson_body feed_texts"},WB={key:0,class:"fcom_lesson_content"},KB=["innerHTML"],ZB={key:0,class:"fcom_lesson_quiz"},JB={key:1,ref:"fcom_course_documents",class:"fcom_lesson_documents"},QB={class:"fcom_lesson_documents_header"},XB={key:0,class:"fcom_lesson_documents_list"},eD={key:0,ref:"fcom_course_comments",class:"fcom_lesson_comments"},tD={class:"fcom_lesson_comment_box"},sD={key:0,style:{"text-align":"center",padding:"20px","margin-top":"30px","border-radius":"8px","background-color":"var(--fcom-primary-bg, white)"}},oD={style:{padding:"0",margin:"0 0 20px"}},iD=["href"],nD={class:"fcom_section_sidebar_title"},lD={class:"fcom_section_items"},aD={class:"fcom_section_primary_item"},rD={class:"fcom_section_primary_item_title"},cD=["id","onClick"],dD={class:"fcom_heading_item clickable"},uD=["innerHTML"],_D={key:0,class:"fcom_section_footer course_progress_footer_wrap"},mD={class:"fcom_course_progress_footer"};function hD(e,t,s,u,o,i){const m=Z,f=p("ArrowLeft"),h=j,g=p("FullScreen"),w=p("ExitFullScreen"),b=H,S=p("ChatIcon"),k=p("PaperClipIcon"),$=p("Lock"),v=p("ArrowRight"),C=Ue,L=p("Operation"),M=p("media-preview"),E=p("QuizView"),T=p("DocumentLists"),P=p("CommentBox"),U=ke,D=Le,A=p("Close"),q=p("ArrowDown"),O=p("SuccessFilled"),N=p("CircleIcon"),G=os,ae=et,B=xs,X=Ye,me=p("layout"),ee=p("app-layout"),Ve=te("loading");return n(),y(ee,{class:R({fcom_full_screen:o.isFullScreen,fcom_show_right_aside:o.sm_side_show}),wrapper_class:"fcom_single_layout fcom_full_layout"},{default:r(()=>[s.course&&s.currentLesson?(n(),y(me,{key:0,wrapper_class:"no_bg_layout"},{default:r(()=>[a(X,{class:"fcom_lesson_container fcom_resp_container"},{default:r(()=>[a(D,{style:re({height:i.containerHeight}),class:"fcom_lesson_wrap"},{default:r(()=>[o.isTransiting?(n(),c("div",PB,[W((n(),c("div",IB,[V(" ...... ")])),[[Ve,!0]]),l("div",EB,[a(m,{rows:10,animated:!0})])])):(n(),y(U,{key:1,ref:"lesson_scroller"},{default:r(()=>{var Q;return[l("div",UB,[l("div",{class:"clickable fcom_go_back",onClick:t[0]||(t[0]=J=>e.$router.push({name:"view_course"}))},[a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(f)]),_:1}),l("span",AB,d(s.course.title),1)]),l("div",BB,[a(b,{title:o.isFullScreen?e.$t("Exit Full Screen"):e.$t("Go Full Screen"),onClick:i.toggleFullScreen,size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[o.isFullScreen?(n(),y(w,{key:1})):(n(),y(g,{key:0}))]),_:1})]),_:1},8,["title","onClick"]),s.currentLesson.can_view?(n(),c(F,{key:0},[i.commentsEnabled?(n(),y(b,{key:0,"aria-label":e.$t("Comments"),onClick:i.scrollToComments,bg:"",size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(S)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0),i.hasDocuments?(n(),y(b,{key:1,"aria-label":e.$t("Documents"),onClick:i.scrollToDocuments,bg:"",size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(k)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0),s.track.isEnrolled?(n(),y(C,{key:2,disabled:!i.isVideoGateLocked,content:e.$t("Watch the video to complete this lesson"),trigger:["hover","focus"],placement:"bottom"},{default:r(()=>[a(b,{class:R([i.isCompleted||i.isVideoGateLocked?"":"fcom_primary_button",{"is-disabled":i.isVideoGateLocked}]),"aria-disabled":i.isVideoGateLocked?"true":void 0,"aria-label":i.isVideoGateLocked?e.$t("Watch the video to complete this lesson"):void 0,loading:o.completing,style:{"margin-left":"15px"},type:"info",onClick:i.markAsComplete,size:"small"},{default:r(()=>[i.isCompleted?(n(),c("span",DB,d(e.$t("Completed")),1)):(n(),c(F,{key:0},[i.isVideoGateLocked?(n(),y(h,{key:0},{default:r(()=>[a($)]),_:1})):_("",!0),l("span",null,d(e.$t("Complete Lesson")),1),i.isVideoGateLocked?_("",!0):(n(),y(h,{key:1,class:"fcom_arrow_icon"},{default:r(()=>[a(v)]),_:1}))],64))]),_:1},8,["class","aria-disabled","aria-label","loading","onClick"])]),_:1},8,["disabled","content"])):e.auth.user_id?!s.track.isEnrolled&&s.course.id&&s.course.can_self_enroll?W((n(),y(b,{key:4,disabled:o.enrolling,onClick:i.enroll,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[Ve,o.enrolling]]):_("",!0):(n(),c("a",{key:3,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login to enroll this course")),9,RB))],64)):_("",!0),s.sections&&s.sections.length?(n(),y(b,{key:1,style:{"margin-left":"15px"},size:"small",text:"",class:"fcom_toc_control","aria-label":e.$t("Toggle lessons"),onClick:t[1]||(t[1]=J=>o.sm_side_show=!o.sm_side_show)},{default:r(()=>[a(h,null,{default:r(()=>[a(L)]),_:1})]),_:1},8,["aria-label"])):_("",!0)])]),l("div",xB,[l("div",HB,[l("div",OB,[l("p",jB,[V(d(e.$t("Lesson %1$s of %2$s",s.currentLessonIndex+1,s.lessonsCount))+" ",1),e.isAdmin()?(n(),c("a",{key:0,target:"_blank",rel:"noopener",style:{"margin-left":"8px"},class:"el-button el-button--small",href:e.$getRouteLink("admin/manage-courses/edit/:course_id/lessons?lesson_id=:lesson_id",{course_id:s.course.id,lesson_id:s.currentLesson.id})},d(i.isQuizContent?e.$t("Edit Quiz"):e.$t("Edit Lesson")),9,NB)):_("",!0)]),l("h1",{innerHTML:s.currentLesson.title},null,8,zB)]),l("div",qB,[a(b,{"aria-label":e.$t("Previous lesson"),onClick:t[2]||(t[2]=J=>e.$emit("setPrevLesson")),disabled:s.currentLessonIndex===0,size:"small"},{default:r(()=>[a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(f)]),_:1})]),_:1},8,["aria-label","disabled"]),a(b,{"aria-label":e.$t("Next lesson"),onClick:t[3]||(t[3]=J=>e.$emit("setNextLesson")),disabled:s.currentLessonIndex+1===s.lessonsCount,size:"small"},{default:r(()=>[a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(v)]),_:1})]),_:1},8,["aria-label","disabled"])])]),s.currentLesson.can_view?(n(),c(F,{key:1},[i.showMediaPreview?(n(),y(M,{key:0,media_item:s.currentLesson.meta.media},null,8,["media_item"])):_("",!0),l("div",YB,[s.currentLesson.content_loading?(n(),c("div",WB,[a(m,{rows:5,animated:!0})])):(n(),c(F,{key:1},[l("div",{ref:"lessonContent",class:"fcom_lesson_content feed_md_content",innerHTML:s.currentLesson.content},null,8,KB),(Q=s.currentLesson.meta)!=null&&Q.quiz_questions?(n(),c("div",ZB,[a(E,{lesson:s.currentLesson,isEnrolled:s.track.isEnrolled,questions:s.currentLesson.meta.quiz_questions},null,8,["lesson","isEnrolled","questions"])])):_("",!0)],64))]),i.hasDocuments&&!s.currentLesson.content_loading?(n(),c("div",JB,[l("div",QB,[l("h3",null,d(e.$t("Documents & Files")),1)]),e.has_pro?(n(),c("div",XB,[a(T,{class:"fcom_boxed_documents",document_lists:s.currentLesson.meta.document_lists},null,8,["document_lists"])])):_("",!0)],512)):_("",!0)],64)):(n(),c("div",{key:0,class:"fcom_locked_container",innerHTML:s.currentLesson.access_message},null,8,GB))]),i.commentsEnabled&&!s.currentLesson.content_loading?(n(),c("div",eD,[l("div",tD,[a(P,{show_comment_form:s.track.isEnrolled,feed:s.currentLesson,showAll:!0,checkPermission:!0},ge({before_comment_box:r(()=>[l("h3",null,d(e.$t("Lesson Discussions")),1)]),_:2},[s.track.isEnrolled?void 0:{name:"after_comment_box",fn:r(()=>[!e.auth.user_id||s.course.can_self_enroll?(n(),c("div",sD,[l("p",oD,d(e.$t("Please enroll the course to join the conversation.")),1),e.auth.user_id?!s.track.isEnrolled&&s.course.id&&s.course.can_self_enroll?W((n(),y(b,{key:1,disabled:o.enrolling,onClick:i.enroll,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[Ve,o.enrolling]]):_("",!0):(n(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login to enroll this course")),9,iD))])):_("",!0)]),key:"0"}]),1032,["show_comment_form","feed"])])],512)):_("",!0)]}),_:1},512))]),_:1},8,["style"]),o.sm_side_show?(n(),c("div",{key:0,class:"fcom_toc_backdrop fcom_toc_control",onClick:t[4]||(t[4]=Q=>o.sm_side_show=!1)})):_("",!0),a(ae,{class:"fcom_lesson_sidebar fcom_resp_side",width:"320px"},{default:r(()=>[a(U,{ref:"lesson_index_sidebar",height:i.containerHeight},{default:r(()=>[l("div",nD,[l("h3",null,d(e.$t("Lessons")),1),a(b,{class:"fcom_toc_control fcom_toc_close",text:"","aria-label":e.$t("Close"),onClick:t[5]||(t[5]=Q=>o.sm_side_show=!1)},{default:r(()=>[a(h,null,{default:r(()=>[a(A)]),_:1})]),_:1},8,["aria-label"])]),l("div",lD,[(n(!0),c(F,null,x(s.sections,Q=>(n(),c("div",{key:Q.id,class:"fcom_section_primary"},[l("div",aD,[l("div",rD,[a(h,{class:"clickable",onClick:J=>Q.is_closed=!Q.is_closed},{default:r(()=>[Q.is_closed?(n(),y(v,{key:0,class:"fcom_arrow_icon"})):(n(),y(q,{key:1}))]),_:2},1032,["onClick"]),l("h4",null,d(Q.title),1)])]),Q.is_closed?_("",!0):(n(!0),c(F,{key:0},x(Q.lessons,J=>(n(),c("div",{class:R([{fcom_current_lesson:J.id==s.currentLesson.id},"fcom_section_item"]),key:J.id},[l("div",{id:"fcom_lesson_title_"+J.id,onClick:ie=>i.gotoLesson(J),class:"fcom_section_item_title"},[l("p",dD,[s.track.completed_lessons.includes(J.id.toString())?(n(),y(h,{key:0,style:{color:"#008a2e"}},{default:r(()=>[a(O)]),_:1})):J.can_view?(n(),y(h,{key:2},{default:r(()=>[a(N)]),_:1})):(n(),y(h,{key:1},{default:r(()=>[a($)]),_:1})),l("span",{innerHTML:J.title},null,8,uD)])],8,cD)],2))),128))]))),128))]),s.track.progress?(n(),c("div",_D,[l("div",mD,[l("p",null,d(e.$t("Course progress")),1),a(G,{class:"fcom_progress","stroke-width":8,percentage:parseInt(s.track.progress)},null,8,["percentage"])])])):_("",!0)]),_:1},8,["height"])]),_:1}),o.lightboxImages.length?(n(),y(B,{key:1,"url-list":o.lightboxImages,"initial-index":o.lightboxIndex,"hide-on-click-modal":!0,"show-progress":o.lightboxImages.length>1,onClose:t[6]||(t[6]=Q=>o.lightboxImages=[])},null,8,["url-list","initial-index","show-progress"])):_("",!0)]),_:1})]),_:1})):_("",!0)]),_:1},8,["class"])}const fD=I(FB,[["render",hD]]),pD={name:"LeaderLists",props:["leaders"],computed:{isAll(){return this.leaders.key==="all_time"}}},gD={class:"fcom_box_list"},yD={class:"fcom_box_list_header"},vD={class:"fcom_box_list_body"},bD={class:"fcom_person_lists"},kD={class:"fcom_leader"},wD={key:0,class:"fcom_serial_suffix"},CD=l("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[l("path",{d:"M0 0L11 0V10.0442L5.73392 6.32786L0 10.0442L0 0Z",fill:"currentColor"})],-1),$D=[CD],SD={key:0,class:"fcom_leader_stat"};function VD(e,t,s,u,o,i){const m=p("UserAvatar"),f=p("UserRouteLink");return n(),c("div",gD,[l("div",yD,d(s.leaders.title),1),l("div",vD,[l("ul",bD,[(n(!0),c(F,null,x(s.leaders.items,(h,g)=>(n(),c("li",{key:h.user_id},[l("div",kD,[l("div",{class:R(["fcom_serial_"+(g+1),"fcom_serial"])},[l("span",null,d(g+1),1),g<3?(n(),c("div",wD,$D)):_("",!0)],2),a(m,{with_level:!1,xprofile:h.xprofile},null,8,["xprofile"]),a(f,{show_badge:!0,xprofile:h.xprofile,show_follow:!0},null,8,["xprofile"])]),parseInt(h.total_points)?(n(),c("div",SD,[W(l("span",null,"+",512),[[kt,!i.isAll]]),V(" "+d(h.total_points),1)])):_("",!0)]))),128))])])])}const MD=I(pD,[["render",VD]]),LD={name:"LeaderTooltip",components:{InfoFilled:Tt},props:{levelChunks:{type:Array,required:!0}}},TD={class:"fcoml_tooltip_content"},FD={class:"fcoml_tooltip_title"},PD={class:"fcoml_tooltip_subtitle"},ID=["innerHTML"],ED={class:"fcoml_tooltip_subtitle"},UD={class:"fcoml_tooltip_desc"},AD={class:"fcoml_tooltip_levels"},BD={class:"levels_list"},DD={class:"level_title"},RD={class:"level_points"};function xD(e,t,s,u,o,i){const m=p("InfoFilled"),f=j,h=H,g=ye;return n(),y(g,{persistent:!1,"popper-class":"fcoml_tooltip_popover",width:550,effect:"dark",trigger:"click"},{reference:r(()=>[a(h,{"aria-label":e.$t("More info"),text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[l("div",TD,[l("h5",FD,d(e.$t("Leaderboard Points")),1),l("p",PD,d(e.$t("1 Like = 1 Point")),1),l("p",{class:"fcoml_tooltip_desc",innerHTML:e.$t("__LEADERBOARD_DESC_INS")},null,8,ID),l("p",ED,d(e.$t("Levels")),1),l("p",UD,d(e.$t("As you gain points, you level up. Your level is shown at the bottom right of your avatar.")),1),l("div",AD,[(n(!0),c(F,null,x(s.levelChunks,(w,b)=>(n(),c("div",{key:b},[l("ul",BD,[(n(!0),c(F,null,x(w,S=>(n(),c("li",{key:S.level,class:"level_item"},[l("div",DD,d(S.title),1),l("div",RD,d(e.$_n("%d point","%d points",S.min_points)),1)]))),128))])]))),128))])])]),_:1})}const HD=I(LD,[["render",xD]]),OD={name:"LeaderBoard",components:{InfoFilled:Tt,LeaderLists:MD,AppLayout:Se,Layout:we,LeaderTooltip:HD},data(){return{leaderboard:[],loading:!1}},computed:{userLevel(){return this.appVars.auth.user_id?Be(this.appVars.auth.total_points):null},requiredPoints(){return parseInt(this.userLevel.max_points)-parseInt(this.appVars.auth.total_points)+1},levelChunks(){let e=Object.values(this.appVars.leaderboard_levels);const t=Math.ceil(e.length/3);return e.reduce((s,u,o)=>{const i=Math.floor(o/t);return s[i]||(s[i]=[]),s[i].push(u),s},[])}},methods:{fetchLeaders(){this.loading=!0,this.$get("leaderboard").then(e=>{this.leaderboard=e.leaderboard,e.current_user_follows&&this.setFollowIds(e.current_user_follows)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.appVars.view_leaderboard_members&&this.fetchLeaders(),this.changeTitle(this.$t("Leaderboard"))}},jD={key:0,style:{"text-align":"center",padding:"20px 20px 40px"}},ND={class:"permission_failed"},zD=["href"],qD={key:0,class:"fcom_leaderboard_profile"},GD={class:"fcom_leaderboard_profile_inner"},YD={class:"fcom_profile_header"},WD={class:"fcom_profile_info"},KD={class:"info_avatar"},ZD={class:"info_user"},JD={class:"fcom_level_name"},QD={class:"fcoml_level_sub"},XD={class:"fcoml_level_sub_icon"},eR={class:"fcoml_level_sub_text"},tR={class:"fcom_leaderboard_profile_avatar"},sR={class:"fcom_leaderboard_levels"},oR=["title"],iR={key:1},nR={class:"fcoml_level_detail"},lR={class:"fcoml_level_title"},aR={class:"fcoml_level_sub"},rR={class:"fcom_leaderboard_items"},cR={key:1,class:"white_loaded"};function dR(e,t,s,u,o,i){const m=p("UserAvatar"),f=p("UserRouteLink"),h=p("LeaderTooltip"),g=p("Lock"),w=j,b=ht,S=ft,k=p("leader-lists"),$=Z,v=p("layout"),C=p("app-layout");return n(),y(C,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(v,{wrapper_class:"no_bg_layout",title:e.$t("Leaderboards")},{default:r(()=>[e.appVars.view_leaderboard_members?(n(),c(F,{key:1},[i.userLevel?(n(),c("div",qD,[l("div",GD,[l("div",YD,[l("div",WD,[l("div",KD,[a(m,{with_level:!0,with_completion:!0,xprofile:e.appVars.auth},null,8,["xprofile"])]),l("div",ZD,[a(f,{show_badge:!0,show_pop:!1,xprofile:e.appVars.auth},null,8,["xprofile"]),l("div",JD,d(i.userLevel.title),1)])]),l("div",QD,[l("div",XD,[l("span",null,"🏆 "+d(e.auth.total_points),1),V(" | "),l("span",null,d(e.$t("Level %d",i.userLevel.level)),1)]),l("div",eR,[V(d(e.$t("%d points to level up!",i.requiredPoints))+" ",1),a(h,{levelChunks:i.levelChunks},null,8,["levelChunks"])])])]),l("div",tR,[a(S,{gutter:20},{default:r(()=>[(n(!0),c(F,null,x(i.levelChunks,L=>(n(),y(b,{sm:24,md:8},{default:r(()=>[l("ul",sR,[(n(!0),c(F,null,x(L,M=>(n(),c("li",null,[l("div",{title:`${M.min_points} points`,class:R(["fcom_level_icon",{fcom_is_in_level:i.userLevel.max_points>=M.max_points}])},[i.userLevel.max_points<M.max_points?(n(),y(w,{key:0},{default:r(()=>[a(g)]),_:1})):(n(),c("span",iR,d(M.level),1))],10,oR),l("div",nR,[l("div",lR,d(M.title),1),l("div",aR,d(M.tagline),1)])]))),256))])]),_:2},1024))),256))]),_:1})])])])):_("",!0),l("div",rR,[a(S,{gutter:20},{default:r(()=>[(n(!0),c(F,null,x(o.leaderboard,L=>(n(),y(b,{key:L.key,md:8,sm:24},{default:r(()=>[a(k,{leaders:L},null,8,["leaders"])]),_:2},1024))),128))]),_:1})]),o.loading?(n(),c("div",cR,[a($,{rows:16,animated:!0})])):_("",!0)],64)):(n(),c("div",jD,[l("div",ND,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view the leaderboard")),1),l("a",{href:e.$getRouteLink("/"),class:"el-button fcom_primary_button"},d(e.$t("Go To All Feeds")),9,zD)])]))]),_:1},8,["title"])]),_:1})}const uR=I(OD,[["render",dR]]),_R=[{name:"dashboard",path:"/dashboard",component:i0,meta:{active_menu:"dashboard",title:"Dashboard"}},{path:"/",component:Cw,meta:{active_menu:"dashboard"},children:[{name:"all_feeds",path:"",component:Iw},{name:"single_feed",path:"post/:feed_slug",component:Fs,props:!0}]},{path:"/space/:space/",component:W5,props:!0,meta:{in_space:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]},children:[{name:"space_home",path:"",component:e6,props:!0,meta:{show_sidebar:!0}},{name:"space_feeds",path:"home",component:X5,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_about",path:"about",component:Uo,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_feed",path:"post/:feed_slug",component:Fs,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_members",path:"members",component:dS,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_invitations",path:"invitations",component:E9,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_documents",path:"documents",component:JS,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_media",path:"media",component:t9,props:!0,meta:{in_space:!0,show_sidebar:!1}}]},{path:"/discover/spaces",name:"spaces",component:kV,meta:{active_menu:"spaces"}},{name:"all_members",path:"/members",component:JI,props:!0,meta:{active_menu:"all_members"}},{path:"/u/:username/",component:PM,props:!0,meta:{active_menu:"all_members"},children:[{name:"user_profile",path:"",component:FT,meta:{active_menu:"all_members"}},{name:"user_spaces",path:"spaces",component:AL,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"update_profile",path:"update",component:_T,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_profile_about",path:"about",component:jo,meta:{active_menu:"all_members"}},{name:"user_profile_feeds",path:"posts",component:NM,meta:{active_menu:"all_members"}},{name:"user_scheduled_posts",path:"scheduled-posts",component:fL,meta:{active_menu:"all_members"}},{name:"user_comments",path:"comments",component:qT,meta:{active_menu:"all_members"}},{name:"user_courses",path:"courses",component:pF,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_notification_settings",path:"notification-settings",component:bP,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_follows",path:"follow",component:kI,meta:{active_menu:"all_members"},children:[{name:"user_followers",path:"followers",component:NP,props:!0,meta:{active_menu:"all_members"}},{name:"user_followings",path:"followings",props:!0,component:_I,meta:{active_menu:"all_members"}}]}]},{path:"/notifications",name:"notifications",component:aE,meta:{}},{name:"bookmarks",path:"/bookmarks",component:mE,meta:{active_menu:"bookmarks"}},{name:"courses",path:"/courses",component:qE,meta:{active_menu:"courses",lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}},{path:"/course/:course_slug",component:QE,props:!0,meta:{active_menu:"courses",in_course:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]},children:[{props:!0,path:"lessons",component:UA,name:"view_course",meta:{in_course:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}},{props:!0,path:"lessons/:lesson_slug/view",component:fD,name:"view_lesson",meta:{in_course:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}}]},{name:"leaderboards",path:"/leaderboards",component:uR,meta:{active_menu:"leaderboards"}}],mR={name:"NotFound",data(){return{message:this.$t("Please wait while we redirect you to the appropriate page..."),is404:!1,require_auth:!1}},methods:{lookForPost(e){this.$get("feeds/"+e+"/by-slug").then(t=>{this.$router.push({name:"single_feed",params:{feed_slug:e}})}).catch(t=>{this.$router.push({name:"all_feeds"}),this.is404=!0})}},mounted(){let e=this.$route.path;if(!e){this.message=this.$t("The requested page could not be found");return}e=e.replace(/^\/+/,"");let s=e.split("/")[0];if(s=="community"){e=e.replace(/^community\//,"/space/"),this.$router.push(e);return}else if(s=="fcom_route"){if(this.$route.query.route=="user_notification_settings")if(this.auth.username){this.$router.push({name:"user_notification_settings",params:{username:this.auth.username}});return}else{window.location.href=this.getCurrentAuthUrl();return}}else if(s=="u")if(this.auth.username){this.$router.push({name:"user_profile",params:{username:this.auth.username}});return}else{window.location.href=this.appVars.auth_url;return}this.lookForPost(s)}};function hR(e,t,s,u,o,i){return n(),c("h1",null,d(o.message),1)}const fR=I(mR,[["render",hR]]),pR=(e,{maxWaitMs:t=600,signal:s}={})=>new Promise(u=>{if(s!=null&&s.aborted)return u();const o=performance.now()+t,i=()=>{var h;if(s!=null&&s.aborted)return u();const m=(h=window.fcomLayoutRef)==null?void 0:h.wrapRef;m&&m.scrollHeight-m.clientHeight>=e||performance.now()>=o?u():requestAnimationFrame(i)};requestAnimationFrame(i)}),gR={name:"VerifiedSign"},yR=l("span",{class:"fcom_verified"},[l("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img","data-testid":"icon-verified"},[l("g",null,[l("path",{d:"M20.396 11c-.018-.646-.215-1.275-.57-1.816-.354-.54-.852-.972-1.438-1.246.223-.607.27-1.264.14-1.897-.131-.634-.437-1.218-.882-1.687-.47-.445-1.053-.75-1.687-.882-.633-.13-1.29-.083-1.897.14-.273-.587-.704-1.086-1.245-1.44S11.647 1.62 11 1.604c-.646.017-1.273.213-1.813.568s-.969.854-1.24 1.44c-.608-.223-1.267-.272-1.902-.14-.635.13-1.22.436-1.69.882-.445.47-.749 1.055-.878 1.688-.13.633-.08 1.29.144 1.896-.587.274-1.087.705-1.443 1.245-.356.54-.555 1.17-.574 1.817.02.647.218 1.276.574 1.817.356.54.856.972 1.443 1.245-.224.606-.274 1.263-.144 1.896.13.634.433 1.218.877 1.688.47.443 1.054.747 1.687.878.633.132 1.29.084 1.897-.136.274.586.705 1.084 1.246 1.439.54.354 1.17.551 1.816.569.647-.016 1.276-.213 1.817-.567s.972-.854 1.245-1.44c.604.239 1.266.296 1.903.164.636-.132 1.22-.447 1.68-.907.46-.46.776-1.044.908-1.681s.075-1.299-.165-1.903c.586-.274 1.084-.705 1.439-1.246.354-.54.551-1.17.569-1.816zM9.662 14.85l-3.429-3.428 1.293-1.302 2.072 2.072 4.4-4.794 1.347 1.246z"})])])],-1);function vR(e,t,s,u,o,i){const m=Ue;return n(),y(m,{content:e.$t("Verified"),placement:"top"},{default:r(()=>[yR]),_:1},8,["content"])}const bR=I(gR,[["render",vR]]),kR=[ki,Zs,wi,Ci,Ys,$i,Si,Vi,Mi,Li,Ti,Fi,Pi,Ii,Ei,Ui,Ai,Bi,Js,Qs,Di,Ri,xi,Xs,Hi,Oi,ji,to,Mt,Ni,zi,qi,Gi,rs,Yi,Wi,Ki,Zi,Ji,Qi,Xi,Ws,en,Tt,Ie,tn,so];function _t(e){const t=[];if(typeof e=="object"&&e.join===void 0)for(const s in e)t.push(_t(e[s]));else if(typeof e=="object"&&e.join!==void 0)for(const s in e)t.push(_t(e[s]));else typeof e=="function"||typeof e=="string"&&t.push(e);return t.join("<br />")}function wR(e){let t;try{t=new URL(e)}catch{t=new URL(e,"https://fluentcommunity.co")}let s=t.pathname;return s=s.replace(/^\//,""),s.split("/")[0]||""}const de=Ko(Wb),ws=li();ws.use(ai);ws.use(({store:e})=>{e.$api={get:(t,s)=>window.FluentCommunityUtil.Rest.get(t,s),post:(t,s)=>window.FluentCommunityUtil.Rest.post(t,s),put:(t,s)=>window.FluentCommunityUtil.Rest.put(t,s),patch:(t,s)=>window.FluentCommunityUtil.Rest.patch(t,s),delete:t=>window.FluentCommunityUtil.Rest.delete(t)}});de.use(ws);de.use(oi);var Us,As;de.use(bi,{loading:(((Us=window.fluentComAdmin)==null?void 0:Us.assets_url)||"")+"images/image-loader.svg",error:(((As=window.fluentComAdmin)==null?void 0:As.assets_url)||"")+"images/image-placeholder.png",lifecycle:{loading:e=>{e.classList.add("fcom-img-loading")},loaded:e=>{e.classList.remove("fcom-img-loading"),e.classList.add("fcom-img-loaded")},error:e=>{e.classList.remove("fcom-img-loading"),e.classList.add("fcom-img-error")}}});de.config.globalProperties.appVars=window.fluentComAdmin;de.config.globalProperties.auth=window.fluentComAdmin.auth;de.config.globalProperties.has_pro=!!window.fluentComAdmin.pro;let Jt="40%",Qt="60%",zo="500px";window.innerWidth<600?(Qt="95%",Jt="90%",zo="90%"):window.innerWidth<800&&(Qt="80%",Jt="80%");kR.forEach(e=>{de.component(e.name,e)});de.component("VerifiedSign",bR);de.component("UserAvatar",fs);de.component("UserRouteLink",Pe);de.component("WelcomeBanner",ks);de.component("UserBadge",Oo);function Es(){var w,b,S,k,$;de.use(window.FluentCommunityUtil.eventBus);const e=window.FluentCommunityUtil.Rest;de.mixin({data(){return{Storage:window.FluentCommunityUtil.Storage,is_rtl:!1,drawerWidth:Jt,dialogWidth:Qt,modalWidth:zo,feedMonitorCache:{},mounted:!1,isMobile:window.innerWidth<=768,has_leaderboard:this.appVars.features.leaderboard}},computed:{siteDateFormat(){return this.appVars.date_formatter||"MMM D, YYYY"},siteTimeFormat(){return this.appVars.time_formatter||"HH:mm"},siteDateTimeFormat(){return this.appVars.date_time_formatter||"MMM D, YYYY HH:mm"}},methods:{$get:e.get,$post:e.post,$uploadFile:e.uploadFile,$put:e.put,$del:e.delete,$patch:e.patch,$ajax:e.ajax,changeTitle(v){document.title=v+" - "+this.appVars.site_title},$handleError(v){let C="";typeof v=="string"?C=v:v&&v.message?C=v.message:C=_t(v),C||(C="Something is wrong!"),typeof C!="string"&&(C=_t(C)),this.$notify({type:"error",title:this.$t("Error"),message:C,dangerouslyUseHTMLString:!0})},convertToText:_t,$t(v){v=window.fluentComAdmin.i18n[v]||v;const C=Array.prototype.slice.call(arguments,1);if(C.length===0)return v;const L=/%(\d*)\$?s|%d/g;let M=0;return v=v.replace(L,(E,T)=>{if(T){const P=parseInt(T,10)-1;return P<C.length?C[P]:E}else return M<C.length?C[M++]:E}),v},$_n(v,C,L){return parseInt(L.toString().replace(/,/g,""),10)>1?this.$t(C,L):this.$t(v,L)},$labelize(v){return v?(v=v.charAt(0).toUpperCase()+v.slice(1),window.fluentComAdmin.i18n[v]?window.fluentComAdmin.i18n[v]:v.replace(/_/g," ").replace(/\b\w/g,C=>C.toUpperCase())):""},$toClipboard(v,C="Copied to clipboard"){navigator.clipboard.writeText(v).then(()=>{this.$notify.success(this.$t(C))}).catch(L=>{this.$notify.error(this.$t("Failed to copy"))})},dayjs,relativeTimeFromUtc(v){return dayjs.utc(v).local().fromNow()},$storeLocalData(v,C){this.Storage.set(v,C)},$getLocalData(v,C=""){return this.Storage.get(v,C)},ucFirst(v){return v?v.charAt(0).toUpperCase()+v.slice(1):""},convertTo24Hour(v){if(!v)return v;const C=v.match(/^(\d{1,2}):(\d{2})(?::\d{2})?\s*([AaPp][Mm])?$/);if(!C)return v;let L=parseInt(C[1],10);const M=C[2],E=C[3];if(E){const T=E.toUpperCase()==="PM";T&&L!==12&&(L+=12),!T&&L===12&&(L=0)}return String(L).padStart(2,"0")+":"+M},ucWords(v){return v?v.replace(/\b[a-z]/g,function(C){return C.toUpperCase()}):""},smartDate(v,C=!1,L=!1){if(!v)return"";const M=this.siteTimeFormat;let E="D MMM, YYYY";dayjs(v).isSame(new Date,"year")?(E="D MMM",C&&(Math.abs(dayjs(v).diff(new Date,"days"))<=5||L)&&(E="D MMM, "+M)):C&&L&&(E="D MMM, YYYY, "+M);const T=dayjs(v);return T.isValid()?T.format(E):null},hasPermission(v){return this.appVars.permissions[v]},isAdmin(){return!!this.appVars.permissions.community_admin},hasCourseAdminAccess(){return!!this.appVars.permissions.course_admin},hasCourseCreatorAccess(){return!!this.appVars.permissions.course_creator},hasSpaceAdminAccess(v=null){return this.hasPermissionOrInCurrentSpace("community_admin")||v&&this.isSpaceAdmin(v)},hasSpaceModeratorAccess(v=null){return this.hasPermissionOrInCurrentSpace("community_moderator")||v&&this.isSpaceModerator(v)},canDeleteFeed(v){return this.auth.user_id&&(v.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("delete_any_feed"))},canEditFeed(v){return this.auth.user_id&&(v.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("edit_any_feed"))},canDeleteComment(v){return this.auth.user_id&&(v.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("delete_any_comment"))},canEditComment(v){return this.auth.user_id&&(v.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("edit_any_comment"))},hasSpaceAccess(v){return v?this.appVars.user_membership_slugs.indexOf(v)!==-1:!0},$upgradeUrl(v,C){const L=this.appVars&&this.appVars.upgrade_url;if(!L)return L;try{const M=new URL(L);return v&&M.searchParams.set("utm_content",v),C&&M.searchParams.set("utm_campaign",C),M.toString()}catch{return L}},hasInPermission(v,C){return!C||typeof C!="object"?!1:C[v]},hasCurrentSpacePermission(v){return window.fcom_current_community?this.hasInPermission(v,window.fcom_current_community.permissions):!1},hasPermissionOrInCurrentSpace(v){return this.hasPermission(v)?!0:this.hasCurrentSpacePermission(v)},humanDateDiff(v){if(!v)return"";const C=dayjs.utc(v,"YYYY-MM-DD HH:mm:ss");if(!C.isValid())return"";const L=C.add(this.appVars.date_offset,"s");return dayjs(L.format("YYYY-MM-DD HH:mm:ss")).from(dayjs(dayjs.utc().format("YYYY-MM-DD HH:mm:ss")))},isToday(v){return dayjs(v).isSame(dayjs(),"day")},isPastDate(v){if(!v)return!0;const C=dayjs.utc(v,"YYYY-MM-DD HH:mm:ss");return C.isValid()?C.add(this.appVars.date_offset,"s").isBefore(dayjs(dayjs.utc().format("YYYY-MM-DD HH:mm:ss"))):!0},formattedDate(v){return dayjs(v).format(this.siteDateFormat)},formattedTime(v){return dayjs(v).format(this.siteTimeFormat)},formattedDateTime(v){return dayjs(v).format(this.siteDateTimeFormat)},hasCommentPermission(v){var C;return this.auth.user_id?!v.space_id&&!v.course_id?this.auth.user_id&&(v.user_id==this.auth.user_id||v.privacy=="public"):this.hasSpaceAccess((C=v.space)==null?void 0:C.slug):!1},getExcerpt(v,C=250){if(!v)return"";let L=v.replace(/(<([^>]+)>)/ig,"");return L=L.replace(/(\*\*|__)(.*?)\1/g,"$2"),L=L.replace(/(#+)(.*)/g,"$2"),L=L.replace(/\[(.*?)\]\((.*?)\)/g,"$1"),typeof DOMParser<"u"&&(L=new DOMParser().parseFromString(L,"text/html").body.textContent||""),L.length>C&&(L=L.substring(0,C)+"..."),L},mdToHtml(v){return v?(v=v.replace("&#x20;","",v),v=v.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>"),v=v.replace(/\*(.*?)\*/g,"<em>$1</em>"),v=v.replace(/\~\~(.*?)\~\~/g,"<del>$1</del>"),v=v.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>'),v=v.replace(/<(https?:\/\/[^\s>]+)>/g,'<a href="$1">$1</a>'),v=v.replace(/^##\s+(.*?)$/gm,"<h2>$1</h2>"),v=v.replace(/^###\s+(.*?)$/gm,"<h3>$1</h3>"),v=v.replace(/^####\s+(.*?)$/gm,"<h4>$1</h4>"),v=v.replace(/^>\s+(.*?)$/gm,"<blockquote>$1</blockquote>"),v=v.replace(/`{3}([\s\S]*?)`{3}/g,"<pre><code>$1</code></pre>"),v=v.replace(/`([^`]+)`/g,"<code>$1</code>"),v=v.replace(/^([\*\-])\s+(.*)$/gm,"<li>$2</li>"),v=v.replace(/(<li>.*?<\/li>(?:\n<li>.*?<\/li>)*)/g,function(C){return"<ul>"+C.replace(/\n/g,"")+"</ul>"}),v=v.replace(/\n/g,"<br>"),v):""},$convertToBoolean(v){return v==="true"||v===!0||v===1||v==="1"||v==="yes"||v==="on"},each:Oe,hasFeature(v){return this.appVars.features[v]},isCommunityModerator(){return window.fluentComAdmin.auth.community_roles.some(v=>v==="admin"||v==="moderator")},isSpaceModerator(v){var L,M;return["admin","moderator"].includes((M=(L=v==null?void 0:v.membership)==null?void 0:L.pivot)==null?void 0:M.role)},isSpaceAdmin(v){var C,L;return((L=(C=v==null?void 0:v.membership)==null?void 0:C.pivot)==null?void 0:L.role)=="admin"},isModerator(v){if(this.isCommunityModerator())return!0;if(!v)return!1;const C=this.auth.spaces[v];return this.isSpaceModerator(C)},getCurrentAuthUrl(){let v=window.location.href,C=this.appVars.auth_url;return C=C.replace(/(\?|&)redirect_to=[^&]+/,""),C.indexOf("?")===-1?C+="?":C+="&",C+"redirect_to="+encodeURIComponent(v)},$formatNumber(v){return v&&v.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},$getRouteLink(v,C={}){return Oe(C,(L,M)=>{v=v.replace(":"+M,L)}),this.appVars.portal_url+v},isOnline(v){if(!v)return!1;const L=dayjs.utc(v,"YYYY-MM-DD HH:mm:ss").add(this.appVars.date_offset,"seconds").diff(dayjs.utc(),"minutes");return L<=5&&L>=0},setFollowIds(v){De().setFollows(v)},$exportToCsv(v,C="fcom-export.csv"){if(!v||!Array.isArray(v)||v.length===0){this.$notify({type:"error",title:this.$t("Error"),message:this.$t("No data available to export.")});return}const L=Object.keys(v[0]),M=[L.join(",")];v.forEach(U=>{const D=L.map(A=>`"${String(U[A]??"").replace(/"/g,'""')}"`);M.push(D.join(","))});const E="\uFEFF"+M.join(`
6 `),T=new Blob([E],{type:"text/csv;charset=utf-8;"}),P=document.createElement("a");P.href=URL.createObjectURL(T),P.download=C,document.body.appendChild(P),P.click(),document.body.removeChild(P),URL.revokeObjectURL(P.href)},doNothing(){console.log("OK")}},mounted(){if(window.fcom_mounted)return;this.isMobile&&document.body.classList.add("fcom-is-mobile"),window.fcom_mounted=!0,document.addEventListener("click",C=>{if(C.metaKey||C.ctrlKey)return;const L=C.target.closest("a");if(L&&L.target==="_blank")return;let M=C.target.getAttribute("href");if(M||L&&(M=L.getAttribute("href")),!!M){if(window.fluentComAdmin.is_absolute_url){let E=wR(M);if(E){if(window.fluentComAdmin.portal_paths.indexOf(E)===-1){document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:M}}));return}}else{let T=window.location.origin,P=new URL(M).origin;if(T==P&&new URL(M).search){document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:M}}));return}}}if(M.startsWith(window.fluentComAdmin.urls.portal_base)){if(M.indexOf("fcom_action")!==-1||M.startsWith(window.fluentComAdmin.urls.portal_base+"admin"))return;C.preventDefault(),M=M.replace(window.fluentComAdmin.urls.portal_base,"/"),this.$router.push(M)}else document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:M}}))}});let v=window.fluentComAdmin.dateTime18n;dayjs.updateLocale("en",{weekdays:v.weekdays.split("_"),months:v.months.split("_"),weekdaysShort:v.weekdaysShort.split("_"),monthsShort:v.monthsShort.split("_"),weekdaysMin:v.weekdaysMin.split("_"),formats:{LT:"h:mm A",LTS:"h:mm:ss A",L:"YYYY-MM-DD",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},relativeTime:this.isMobile?v.relativeTimeMobile:v.relativeTime}),document.addEventListener("fcom_renew_rest_nonce",C=>{if(window.__fcomNonceRenewInFlight)return;window.__fcomNonceRenewInFlight=!0;const L=()=>{window.__fcomSessionExpiredShown||(window.__fcomSessionExpiredShown=!0,window.fluentFrameworkApp.$messageBox.alert(this.$t("Your session has expired due to inactivity. Please refresh the page to continue."),this.$t("Session Expired"),{confirmButtonText:this.$t("Refresh"),callback:M=>{location.reload()}}))};this.$ajax("GET","fluent_community_renew_nonce",{ajax_nonce:window.fluentComAdmin.ajax_nonce}).then(M=>{M&&M.rest_nonce?(window.fluentComAdmin.rest.nonce=M.rest_nonce,window.fluentComAdmin.ajax_nonce=M.ajax_nonce,window.__fcomNonceRenewInFlight=!1):L()}).catch(()=>{L()})})}}),de.config.globalProperties.$notify=ii,de.config.globalProperties.$confirm=Yt.confirm,de.config.globalProperties.$promt=Yt.prompt,de.config.globalProperties.$messageBox=Yt,de.config.globalProperties.$gloablStorage={},de.config.globalProperties.currentTimeZoneName=window.dayjs.tz.guess();const t=window.FluentCommunityUtil.hooks.applyFilters("fluent_com_portal_routes",_R);t.push({path:"/:catchAll(.*)",name:"not-found",component:fR});let s=null;const u=["all_feeds","space_feeds","user_profile_feeds"];let o=null;const i=(v,C,L)=>{if(o&&o.abort(),C&&v.path===C.path&&v.query.comment_id!==C.query.comment_id)return!1;if(!u.includes(v==null?void 0:v.name))return L||{top:0};if(!L)return{top:0};o=new AbortController;const M=o.signal;return pR(L.top,{signal:M}).then(()=>M.aborted?!1:L)};window.fluentComAdmin.routing_system=="hash"?s=Ss({routes:t,history:Zo(),scrollBehavior:i}):s=Ss({routes:t,history:Jo(window.fluentComAdmin.portal_slug),scrollBehavior:i});const m=window.FluentCommunityUtil.hooks.applyFilters("fluent_com_portal_app",de),f=Ft();f.initialize(),window.fluentFrameworkApp=m.use(s).mount("#fluent_com_portal");const h=De();h.initializeCurrentUser();const g=ds();(b=(w=window.fluentComAdmin)==null?void 0:w.auth)!=null&&b.user_id&&((k=(S=window.fluentComAdmin)==null?void 0:S.features)!=null&&k.notifications_polling)&&g.startPolling(6e4),($=window.fluentComAdmin)!=null&&$.debug_mode&&(window.fcomDevTools={stores:{feed:Me(),space:je(),cache:ce(),ui:f,user:h,notification:g},memory:{getStats:()=>{const v=Me(),C=ce(),L=je(),M={feeds:v.getMemoryStats,cache:C.getCacheStats,spaces:{total:Object.keys(L.spacesBySlug).length,mySpaces:L.mySpaces.length}};if("memory"in performance){const E=performance.memory;M.browser={usedMB:(E.usedJSHeapSize/1048576).toFixed(2),totalMB:(E.totalJSHeapSize/1048576).toFixed(2),limitMB:(E.jsHeapSizeLimit/1048576).toFixed(2),percentage:(E.usedJSHeapSize/E.jsHeapSizeLimit*100).toFixed(2)+"%"}}return console.table(M),M},cleanup:()=>{const v=Me(),C=ce();console.log("🧹 Running memory cleanup..."),v.pruneOldFeeds(),C.pruneLRU(),console.log("✅ Cleanup complete"),window.fcomDevTools.memory.getStats()}},help:()=>{console.log(`
7 🛠️ FluentCommunity DevTools
8
9 Available commands:
10 fcomDevTools.memory.getStats() - Show memory statistics
11 fcomDevTools.memory.cleanup() - Run memory cleanup
12 fcomDevTools.stores.feed - Access Feed Store
13 fcomDevTools.stores.space - Access Space Store
14 fcomDevTools.stores.cache - Access Cache Store
15 fcomDevTools.stores.ui - Access UI Store
16 `)}},console.log("🛠️ FluentCommunity DevTools loaded. Type fcomDevTools.help() for available commands.")),document.dispatchEvent(new Event("fluentComPortalAppReady")),window.fluentFrameworkAppRouter=s}window.FluentCommunityUtil?Es():document.addEventListener("fluentCommunityUtilReady",function(){Es()});
17