import{D as n,F as r,K as l,ae as g,ab as R,L as D,S as a,I as d,E as y,O as _,Q as c,R as F,af as se,J as Y,P as M,a7 as q,y as Rt,B as K,ak as ye,ay as Le,W as ue,aj as te,U as bt,M as Yt,V as Es,a5 as Wt,G as Oo,T as xt,at as Ho,al as vs,am as bs,az as jo,a2 as No,ar as zo}from"./vue.js?ver=2.11.0";import{c as ks,a as qo,b as Go}from"./vue-router.js?ver=2.11.0";import{E as j,a as O,b as Kt,c as Yo,d as Q,e as fe,f as kt,g as oe,h as ve,i as Ye,j as dt,k as ct,l as Ie,m as je,n as be,o as ke,p as As,q as De,r as Pe,s as le,t as ae,u as Zt,v as pe,w as Us,x as ge,y as Ee,z as We,A as Ke,B as Ze,C as Bs,D as Ds,F as Rs,G as xs,H as Os,I as Qe,J as Wo,K as Hs,L as js,M as Ko,N as ut,O as _t,P as mt,Q as Ns,R as Zo,S as wt,T as Qt,U as Jt,V as Xt,W as es,X as Qo,Y as Jo,Z as Xo,_ as Ot}from"./element-plus.js?ver=2.11.0";import"./dayjs.js?ver=2.11.0";import{d as Ne,m as ei,a as zs,c as ti,s as si}from"./pinia.js?ver=2.11.0";import{bc as qs,b as Ct,bd as oi,be as $t,a5 as Ht,az as ws,bf as Gs,a1 as Ys,a0 as St,bg as ii,bh as Fe,l as ni,bi as Ws,bj as Ks,n as Zs,bk as li,bl as ai,L as ri,M as di,J as Qs,bm as ci,bn as ui,m as _i,bo as mi,d as Vt,bp as Js,U as Xs,R as eo,bq as hi,br as to,bs as fi,bt as pi,bu as gi,bv as yi,bw as vi,bx as bi,by as ki,bz as wi,bA as Ci,bB as $i,bC as Si,bD as Vi,v as Mi,j as Li,bE as Ti,bF as Fi,bG as Ii,bH as Pi,s as Ei,D as Ai,C as Ui,p as Bi,bI as Di,bJ as Ri,bK as xi,bL as Oi,bM as Hi,bN as ji,bO as Ni,$ as zi,bP as qi,bQ as Gi,bR as Yi,N as Wi,bS as Ki}from"./vendor.js?ver=2.11.0";import{_ as I,P as Zi,E as Qi}from"./emoji-picker.js?ver=2.11.0";import{u as Ji,v as ts,w as Xi,x as Oe,y as jt}from"./fcom-utils.js?ver=2.11.0";import{H as en,O as tn,m as sn,s as on,c as nn,a as ln,h as an,b as rn,x as dn,P as cn,W as un,U as _n,d as mn,_ as hn,u as Nt,$ as fn,w as pn,r as gn,L as it,e as yn}from"./milkdown.js?ver=2.11.0";const re=Ne("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)})}}}),Mt=Ne("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}}}),Be=Ne("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=re(),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=re();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,p;const s=re(),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 k=i?`profile/${t}/unfollow`:`profile/${t}/follow`,b=await this.$api.post(k);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}`)),(p=window.fluentFrameworkApp)!=null&&p.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("user_follow_toggled",{userId:e,isFollowing:!i}),b}catch(k){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:",k),k}},invalidateProfile(e){re().invalidate(`user-profile:${e}`),delete this.lastFetched[e]},clearAll(){this.currentUser=null,this.profilesByUsername={},this.follows={},this.followers=[],this.loading={},this.lastFetched={};const e=re();e.invalidatePattern("user-profile:"),e.invalidate("user-following")}}}),Me=Ne("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 k,b,$;if(console.log("[Feed Store] fetchFeeds called:",{context:e,loadMore:s,paramsPage:t.page,currentLoading:this.loading[e],currentPage:(k=this.pagination[e])==null?void 0:k.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=re(),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 w=f.get(m,3e5);if(w)return this.feedsByContext[e]={...w.feedsByContext,filterKey:h},this.pagination[e]=w.pagination,this.executionTimes[e]=w.executionTime,this.touchContext(e),w.stickyFeed&&!window["viewed_sticky_posts_"+w.stickyFeed.id]?this.stickyFeeds[e]=w.stickyFeed:(this.stickyFeeds[e]=null,w.stickyFeed&&(($=this.feedsByContext[e])!=null&&$.data)&&(this.feedsByContext[e].data.some(C=>C.id===w.stickyFeed.id)||this.feedsByContext[e].data.unshift(w.stickyFeed))),w.feedsByContext.data.forEach(C=>{this.feedsById[C.id]=C}),this.loading[e]=!1,w}return this.loading[e]=!0,this.$api.get(t.feed_base_url||"feeds",i).then(w=>{var C,v,S,T;if(this._requestSeq[e]===u){if(w.sticky){const V="viewed_sticky_posts_"+w.sticky.id;window[V]?(w.feeds.data.some(P=>P.id===w.sticky.id)||w.feeds.data.unshift(w.sticky),this.stickyFeeds[e]=null):this.stickyFeeds[e]=w.sticky}else o===1&&(this.stickyFeeds[e]=null);if(s){const V=((C=this.feedsByContext[e])==null?void 0:C.data)||[];this.feedsByContext[e]={data:[...V,...w.feeds.data],timestamp:Date.now(),filterKey:h}}else this.feedsByContext[e]={data:w.feeds.data,timestamp:Date.now(),filterKey:h};if(this.pagination[e]={page:o,per_page:i.per_page,total:w.feeds.total,last_page:w.feeds.last_page,has_more:w.feeds.has_more},this.touchContext(e),console.log("[Feed Store] Updated pagination:",{context:e,page:o,has_more:w.feeds.has_more,total:w.feeds.total}),w.execution_time&&(this.executionTimes[e]=w.execution_time),w.feeds.data.forEach(V=>{this.feedsById[V.id]={...V,timestamp:Date.now()}}),s){const V=((S=(v=this.feedsByContext[e])==null?void 0:v.data)==null?void 0:S.length)||0;V>500&&(console.log("[Feed Store] Pruning feeds, count:",V),this.pruneOldFeeds(e))}return w.last_fetched_timestamp&&(this.ticker.lastFetched=w.last_fetched_timestamp,(T=window.fluentFrameworkApp)!=null&&T.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("newest_feed_fetched",{last_fetched_timestamp:w.last_fetched_timestamp})),w.current_user_follows&&Be().setFollows(w.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(w=>{throw console.error("[Feed Store] Failed to fetch feeds:",w),this._requestSeq[e]===u&&(this.loading[e]=!1),w})},async fetchFeedBySlug(e){const t=`feed:slug:${e}`,s=re(),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 k=b=>{this.feedsByContext[b]||(this.feedsByContext[b]={data:[],timestamp:Date.now()}),this.stickyFeeds[b]&&(this.feedsByContext[b].data.some(w=>w.id===this.stickyFeeds[b].id)||this.feedsByContext[b].data.unshift(this.stickyFeeds[b]),this.stickyFeeds[b]=null);const $=this.feedsByContext[b].data.findIndex(w=>w.id===h.id);$===-1&&this.feedsByContext[b].data.unshift(h),this.pagination[b]?$===-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)&&k(b)});else{k(e),h.space_id&&e!=="global"&&(k("global"),re().invalidatePattern("feeds:global"));const b=`user-${h.user_id}`;this.feedsByContext[b]&&e!==b&&k(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}))),re().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))}),re().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--,re().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(p=>{var k;return(k=p.data)==null?void 0:k.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]="",re().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,p=((i=m.feeds)==null?void 0:i.data)||[];if(!p.length){f.timestamp=Date.now();return}const k=new Map(p.map(v=>[v.id,v])),b=new Set(h.map(v=>v.id)),$=h.map(v=>{const S=k.get(v.id);return S?{...v,...S}:v}),w=p.filter(v=>!b.has(v.id));this.feedsByContext[e]={...f,data:[...w,...$],timestamp:Date.now()};const C=Date.now();if(p.forEach(v=>{this.feedsById[v.id]={...this.feedsById[v.id]||{},...v,timestamp:C}}),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)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{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)),re().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={}}}}),He=Ne("space",{state:()=>({spacesBySlug:{},currentSpace:null,currentPageLayout: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=re(),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=re(),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`),p=(m=h.membership)==null?void 0:m.status;if(p&&(u.user_status.status=p),p&&p!=="active"&&!o){u.members_count=Math.max(0,(u.members_count||1)-1);const k=this.mySpaces.findIndex(b=>b.slug===e);k!==-1&&this.mySpaces.splice(k,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 p=this.mySpaces.findIndex(k=>k.slug===e);p!==-1&&this.mySpaces.splice(p,1)}throw console.error("Failed to join space:",h),h}},async leaveSpace(e){var m,f,h,p;const t=re(),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 k=this.mySpaces.findIndex(b=>b.slug===e);k!==-1&&this.mySpaces.splice(k,1)}try{const k=await this.$api.post(`spaces/${e}/leave`),b=k.space||k;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"),(p=window.fluentFrameworkApp)!=null&&p.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("space_left",b),b}catch(k){throw u&&(s.user_status.status=o,s.members_count=i,this.mySpaces.push(s)),console.error("Failed to leave space:",k),k}},setCurrentSpace(e){const t=this.spacesBySlug[e];t&&(this.currentSpace=t,typeof window<"u"&&(window.fcom_current_community=t))},setCurrentPageLayout(e){this.currentPageLayout=e||null},clearCurrentSpace(){this.currentSpace=null,typeof window<"u"&&(window.fcom_current_community=null)},invalidateSpace(e){const t=re();t.invalidate(`space:${e}`),t.invalidate(`space-topics:${e}`),delete this.lastFetched[e],this.currentSpace&&this.currentSpace.slug===e&&(this.currentSpace=null),delete this.spacesBySlug[e],delete this.topicsBySpace[e]},clearAll(){this.spacesBySlug={},this.currentSpace=null,this.mySpaces=[],this.topicsBySpace={},this.loading={},this.mySpacesLoading=!1,this.lastFetched={};const e=re();e.invalidatePattern("space:"),e.invalidatePattern("space-topics:"),e.invalidate("my-spaces")}}}),ss=Ne("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()}}}),os=Ne("ticker",{state:()=>({tickerInterval:null,enabled:!1,lastCheck:null,pending:!1,errorCount:0,minInterval:45e3,maxInterval:75e3,maxBackoff:6e4,maxErrors:5,paused:!1,visibilityHandler:null,focusHandler: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),this.focusHandler&&(window.removeEventListener("focus",this.focusHandler),this.focusHandler=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 p=t.feedsByContext[h].data,k=p.findIndex(b=>b.id===f.id);k===-1?(p.unshift(f),console.log(`[Global Ticker] Added feed ${f.id} to ${h}`),s.action==="created"&&(t.newPostsCount[h]=(t.newPostsCount[h]||0)+1)):(p[k]=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){var u,o,i,m;const t=ss();e.unread_count!==void 0&&(t.unreadCount=e.unread_count,(o=(u=window.fluentFrameworkApp)==null?void 0:u.$eventBus)==null||o.emit("notification_count_updated",e.unread_count));const s=e.new_items;Array.isArray(s)&&s.length&&((m=(i=window.fluentFrameworkApp)==null?void 0:i.$eventBus)==null||m.emit("new_notifications_received",s))},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)),this.focusHandler&&window.removeEventListener("focus",this.focusHandler),this.focusHandler=()=>{document.hidden||this.check()},window.addEventListener("focus",this.focusHandler)}}}),vn={name:"ChatIcon"},bn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function kn(e,t,s,u,o,i){return n(),r("svg",bn,[...t[0]||(t[0]=[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),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)])])}const Je=I(vn,[["render",kn]]),wn={name:"HeartIcon",props:{filled:{default:!1}}},Cn={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},$n={key:1,viewBox:"0 0 24 24","aria-hidden":"true"};function Sn(e,t,s,u,o,i){return s.filled?(n(),r("svg",Cn,[...t[0]||(t[0]=[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)])])):(n(),r("svg",$n,[...t[1]||(t[1]=[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)])]))}const Xe=I(wn,[["render",Sn]]),so=["comment_added","mention_added","comment/react_added","child_comment_added"];function oo(e){const t=(e==null?void 0:e.route)||{},{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??{}}}const Vn={name:"NotificationsBlock",emits:["close"],components:{ChatIcon:Je,HeartIcon:Xe},props:["notifications"],methods:{handleNotificationClick(e,t){var u,o;if(this.markRead(e,t),!so.includes(e.action))return;const s=(o=(u=this.getNotificationRoute(e))==null?void 0:u.query)==null?void 0:o.comment_id;s&&this.$eventBus.emit("scroll_to_comment",s)},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){return oo(e)}}},Mn={class:"notification_avatar"},Ln={class:"fcom_notification_type"},Tn={class:"notification_content"},Fn=["innerHTML"],In=["title"];function Pn(e,t,s,u,o,i){const m=g("UserAvatar"),f=g("ChatIcon"),h=j,p=g("HeartIcon"),k=g("router-link");return n(!0),r(F,null,R(s.notifications,(b,$)=>{var w;return n(),r("div",{class:D(["notification_wrap",{notification_wrap_unread:((w=b==null?void 0:b.subscriber)==null?void 0:w.is_read)=="0"}])},[a(k,{onClick:C=>i.handleNotificationClick(b,$),to:i.getNotificationRoute(b),class:"notification_item"},{default:d(()=>[l("div",Mn,[a(m,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"]),l("div",Ln,[b.action=="comment_added"||b.action=="child_comment_added"?(n(),y(h,{key:0,class:"fcom_nt_comment"},{default:d(()=>[a(f)]),_:1})):b.action=="feed/react_added"||b.action=="comment/react_added"?(n(),y(h,{key:1,class:"fcom_nt_heart"},{default:d(()=>[a(p,{filled:!0})]),_:1})):b.action=="feed/mentioned"||b.action=="mention_added"?(n(),y(h,{key:2,class:"fcom_nt_mention"},{default:d(()=>[a(f)]),_:1})):b.action=="space_feed/created"?(n(),y(h,{key:3,class:"fcom_new_post"},{default:d(()=>[...t[0]||(t[0]=[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)])]),_:1})):_("",!0)])]),l("div",Tn,[l("div",{innerHTML:b.content},null,8,Fn),l("span",{title:b.updated_at,class:"notification_time_stamp"},c(e.humanDateDiff(b.updated_at)),9,In)])]),_:2},1032,["onClick","to"])],2)}),256)}const io=I(Vn,[["render",Pn]]),En={name:"NotificationIcon"},An={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Un(e,t,s,u,o,i){return n(),r("svg",An,[...t[0]||(t[0]=[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),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)])])}const Bn=I(En,[["render",Un]]),Dn={name:"NotificationOnboard",components:{Bell:qs,Close:Ct},emits:["before-prompt"],props:{placement:{type:String,default:"feed_sidebar"},shouldShowCloseButton:{type:Boolean,default:!0}},data(){return{pushEnabled:!1,permission:"",requestInProgress:!1,confirmed:!1,dismissed:!1}},computed:{hasPush(){if(!this.appVars.has_push_notification||!this.pushEnabled||this.permission==="granted"||!this.appVars.push_prompt_placements.includes(this.placement)||this.dismissed)return!1;const e=this.Storage.get("fcom_push_prompt_closed",0);return!e||new Date().getTime()>e}},methods:{dismiss(){this.Storage.set("fcom_push_prompt_closed",new Date().getTime()+7*24*60*60*1e3),this.dismissed=!0},async processSubscribe(){if(this.$emit("before-prompt"),this.permission==="denied"){const t='',s=this.$t("Notifications are blocked for this site. Reset the permission in your browser settings, come back, and reload the page.")+" "+this.$t("Not sure how? %1$sFollow this guide%2$s.",t,"");this.$messageBox.alert(s,this.$t("Notifications Blocked"),{dangerouslyUseHTMLString:!0,confirmButtonText:this.$t("Close"),closeOnClickModal:!0,closeOnPressEscape:!0}).catch(()=>{});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)}},Rn={key:0,class:"app_side_widget widget_push_notification"},xn={class:"widget_header"},On={style:{display:"flex","column-gap":"8px","align-items":"center",color:"var(--el-color-danger, #f56c6c)"}},Hn=["aria-label"],jn={class:"widget_body notifications_wrap"},Nn={class:"onboard_actions fcom_mt_10"},zn={key:0},qn={key:1},Gn={key:0,style:{"margin-top":"10px"}},Yn={key:1,class:"app_side_widget widget_push_notification"};function Wn(e,t,s,u,o,i){const m=g("Bell"),f=j,h=g("Close"),p=O,k=Kt;return i.hasPush?(n(),r("div",Rn,[l("div",xn,[l("h3",On,[a(f,{style:{"font-size":"120%"}},{default:d(()=>[a(m)]),_:1}),l("span",null,c(e.$t("Never Miss a Reply")),1)]),s.shouldShowCloseButton?(n(),r("button",{key:0,type:"button",class:"fcom_push_prompt_dismiss","aria-label":e.$t("Dismiss push notification prompt"),onClick:t[0]||(t[0]=b=>i.dismiss())},[a(f,null,{default:d(()=>[a(h)]),_:1})],8,Hn)):_("",!0)]),l("div",jn,[l("p",null,c(e.$t("Get notified about replies to your posts and important community updates via web push notifications.")),1),l("div",Nn,[a(p,{loading:o.requestInProgress,class:"fcom_primary_button",onClick:t[1]||(t[1]=b=>i.processSubscribe())},{default:d(()=>[o.requestInProgress?(n(),r("span",qn,c(e.$t("Processing...")),1)):(n(),r("span",zn,c(e.$t("Turn On Push Notifications")),1))]),_:1},8,["loading"])]),o.requestInProgress?(n(),r("p",Gn,c(e.$t("Please click Allow to enable notifications.")),1)):_("",!0)])])):o.confirmed?(n(),r("div",Yn,[a(k,{type:"success",closable:!1,"show-icon":"",title:e.$t("You will get push notifications on replies and important updates.")},null,8,["title"])])):_("",!0)}const is=I(Dn,[["render",Wn]]),Kn={name:"Notifications",components:{NotificationsBlock:io,NotificationIcon:Bn,NotificationOnboard:is},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=!0,this.fetchUnread()},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,this.$eventBus.emit("notification_count_updated",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)}},Zn=["aria-label"],Qn={class:"notifications_wrap unread_notifications"},Jn={class:"norification_pop_header"},Xn={class:"fcom_filter_menu"},el={class:"fcom_filter_menu_ul"},tl={key:2,class:"fcom_no_unread_notifications"};function sl(e,t,s,u,o,i){const m=g("NotificationIcon"),f=j,h=Yo,p=O,k=Q,b=g("notifications-block"),$=g("router-link"),w=g("notification-onboard"),C=fe,v=se("loading");return n(),y(C,{popperClass:"notification_pop","popper-options":{strategy:"fixed"},onBeforeEnter:t[8]||(t[8]=S=>i.toggleNotifications()),ref:"notification_pop",trigger:"click",placement:"bottom",width:500},{reference:d(()=>[a(h,{max:20,hidden:!o.unread_count,value:o.unread_count,class:"item"},{default:d(()=>[l("button",{class:"fcom_menu_button","aria-label":e.$t("Notifications"),ref:"notification_icon"},[a(f,null,{default:d(()=>[a(m)]),_:1})],8,Zn)]),_:1},8,["hidden","value"])]),default:d(()=>[l("div",Qn,[l("div",Jn,[l("h3",null,c(e.$t("Recent Notifications")),1),l("div",null,[Y((n(),y(p,{disabled:o.working,size:"small",onClick:t[0]||(t[0]=S=>i.markAllRead())},{default:d(()=>[M(c(e.$t("Mark all as read")),1)]),_:1},8,["disabled"])),[[v,o.working]])])]),l("div",Xn,[l("ul",el,[l("li",null,[l("a",{onClick:t[1]||(t[1]=q(S=>i.switchType("all"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="all"}),href:"#"},c(e.$t("Recent")),3)]),l("li",null,[l("a",{onClick:t[2]||(t[2]=q(S=>i.switchType("unread"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="unread"}),href:"#"},c(e.$t("Unread")),3)]),l("li",null,[l("a",{onClick:t[3]||(t[3]=q(S=>i.switchType("mentioned"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="mentioned"}),href:"#"},c(e.$t("Mentions")),3)]),l("li",null,[l("a",{onClick:t[4]||(t[4]=q(S=>i.switchType("following"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="following"}),href:"#"},c(e.$t("Following")),3)])])]),o.loading?(n(),y(k,{key:0,style:{"margin-top":"15px"},animated:!0,rows:2})):o.unread_notifications.length?(n(),r("div",{key:1,onClick:t[6]||(t[6]=S=>e.$refs.notification_pop.hide()),class:"notifications fcom_thin_scrollbar"},[a(b,{onClose:t[5]||(t[5]=S=>i.handleClose()),notifications:o.unread_notifications},null,8,["notifications"])])):(n(),r("div",tl,[l("p",null,c(e.$t("No notifications found")),1)])),a($,{class:"fcom_view_all_notifications",to:{name:"notifications"},onClick:i.handleClose},{default:d(()=>[a(p,{class:"fcom_secondary_button"},{default:d(()=>[M(c(e.$t("View All")),1)]),_:1})]),_:1},8,["onClick"]),a(w,{placement:"notification_popover",onBeforePrompt:t[7]||(t[7]=S=>i.handleClose())})])]),_:1},512)}const ol=I(Kn,[["render",sl]]),il=40,nl={name:"NotificationToaster",data(){return{duration:12e3,maxVisible:2,seenKeys:[]}},computed:{storageKey(){var e;return"fcom_seen_toasts_"+(((e=this.auth)==null?void 0:e.user_id)||0)}},created(){this.seenKeys=this.readSeenKeys(),this.$eventBus.on("new_notifications_received",this.handleNewNotifications)},beforeUnmount(){this.$eventBus.off("new_notifications_received",this.handleNewNotifications)},methods:{handleNewNotifications(e){if(!Array.isArray(e)||!e.length)return;if(document.hidden){this.rememberKeys(e.map(s=>this.getKey(s)));return}const t=e.filter(s=>s&&!this.seenKeys.includes(this.getKey(s)));t.length&&(this.rememberKeys(t.map(s=>this.getKey(s))),t.slice(0,this.maxVisible).reverse().forEach(s=>this.showToast(s)))},showToast(e){const t=window.innerWidth<=1024,s={message:this.renderBody(e),duration:this.duration,position:t?"top-left":"bottom-left",showClose:!0,customClass:"fcom_notification_toast",onClick:()=>{u&&u.close(),this.openNotification(e)}};t&&(s.offset=20);const u=this.$notify(s)},renderBody(e){const t=[];return e.avatar&&t.push(Rt("img",{class:"fcom_toast_avatar",src:e.avatar,alt:"",onError:this.setAltImg})),t.push(Rt("span",{class:"fcom_toast_text"},e.text||"")),Rt("div",{class:"fcom_toast_body"},t)},openNotification(e){var u;this.markRead(e);const t=oo(e);if(this.$router.push(t),!so.includes(e.action))return;const s=(u=t==null?void 0:t.query)==null?void 0:u.comment_id;s&&this.$eventBus.emit("scroll_to_comment",s)},markRead(e){this.$post("notifications/mark-read/"+e.id).then(t=>{this.$eventBus.emit("notification_count_updated",t.unread_count)}).catch(()=>{})},getKey(e){return e.id+":"+(e.notified_at||"")},rememberKeys(e){if(!e.length)return;const t=this.seenKeys.concat(e.filter(s=>!this.seenKeys.includes(s)));this.seenKeys=t.slice(-il),this.writeSeenKeys(this.seenKeys)},readSeenKeys(){try{const e=window.localStorage.getItem(this.storageKey),t=e?JSON.parse(e):[];return Array.isArray(t)?t:[]}catch{return[]}},writeSeenKeys(e){try{window.localStorage.setItem(this.storageKey,JSON.stringify(e))}catch{}},setAltImg(e){e.target.src=this.appVars.assets_url+"images/placeholder.png"}},render(){return null}},ll={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 al(e,t,s,u,o,i){const m=O,f=kt,h=g("CloseBold"),p=j,k=se("loading");return n(),r(F,null,[a(f,{class:D(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:d(()=>[K(e.$slots,"trigger",{loading:o.loading},()=>[K(e.$slots,"default",{loading:o.loading},()=>[Y((n(),y(m,{disabled:o.loading,text:s.isTextBtn,class:"fcom_plain_button"},{default:d(()=>[M(c(s.button_text||e.$t("Upload Photo")),1)]),_:1},8,["disabled","text"])),[[k,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:d(()=>[K(e.$slots,"remove",{},()=>[s.removeIcon?(n(),y(p,{key:0},{default:d(()=>[a(h)]),_:1})):_("",!0),l("span",null,c(e.$t("Remove")),1)])]),_:3},8,["onClick","text","aria-label"])):_("",!0)],64)}const Re=I(ll,[["render",al]]),rl={name:"ImageIcon"},dl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function cl(e,t,s,u,o,i){return n(),r("svg",dl,[...t[0]||(t[0]=[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),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),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)])])}const ns=I(rl,[["render",cl]]),ul={name:"PollIcon"},_l={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function ml(e,t,s,u,o,i){return n(),r("svg",_l,[...t[0]||(t[0]=[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),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),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("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)])])}const hl=I(ul,[["render",ml]]),fl={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)}}},pl={class:"fcom_compose_app_form"},gl={class:"fcom_app_header"},yl={class:"fcom_app_options"},vl={class:"fcom_app_pref"},bl={class:"fcom_app_footer"},kl={style:{"font-weight":"500",color:"var(--el-text-color-regular)","font-size":"14px"}};function wl(e,t,s,u,o,i){const m=O,f=oe,h=g("Plus"),p=j,k=ve,b=Ye;return n(),r("div",pl,[l("div",gl,[l("h5",null,c(e.$t("Poll Options")),1),l("div",null,[a(m,{onClick:t[0]||(t[0]=$=>e.$emit("cancel")),size:"small",text:""},{default:d(()=>[M(c(e.$t("cancel")),1)]),_:1})])]),l("div",yl,[(n(!0),r(F,null,R(s.form.options,($,w)=>(n(),r("div",{class:"fcom_app_option",key:"option_"+w},[a(f,{modelValue:$.label,"onUpdate:modelValue":C=>$.label=C,type:"text",placeholder:e.$t("Your option text")},ye({_:2},[!$.slug&&w!==0?{name:"suffix",fn:d(()=>[a(m,{onClick:C=>i.removeOption(w),text:"",size:"small"},{default:d(()=>[...t[3]||(t[3]=[M("x",-1)])]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","onUpdate:modelValue","placeholder"])]))),128)),l("div",vl,[a(m,{onClick:i.addOption,text:"",size:"small"},{default:d(()=>[a(p,null,{default:d(()=>[a(h)]),_:1}),l("span",null,c(e.$t("Add More")),1)]),_:1},8,["onClick"])])]),l("div",bl,[l("h5",null,c(e.$t("Poll Settings")),1),s.is_editing?_("",!0):(n(),y(k,{key:0,modelValue:s.form.type,"onUpdate:modelValue":t[1]||(t[1]=$=>s.form.type=$),"true-value":"multi_choice","false-value":"single_choice",class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Users can choose multiple options")),1)]),_:1},8,["modelValue"])),t[4]||(t[4]=l("br",null,null,-1)),l("label",kl,c(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.form.end_date=$),"value-format":"YYYY-MM-DD HH:mm:ss"},null,8,["placeholder","modelValue"])])])])}const Cl=I(fl,[["render",wl]]),$l={name:"GiphyIcon"},Sl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Vl(e,t,s,u,o,i){return n(),r("svg",Sl,[...t[0]||(t[0]=[Le('',5)])])}const Ml=I($l,[["render",Vl]]),Ll={name:"Giphy",components:{GiphyIcon:Ml},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:Ji(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()}}},Tl={class:"fcom_giphy_composer"},Fl={class:"search-container"},Il=["onLoad","src","alt","onClick"],Pl={key:0,class:"img_loading"},El={key:1,class:"no_result"};function Al(e,t,s,u,o,i){const m=oe,f=dt,h=ct,p=g("GiphyIcon"),k=j,b=O,$=fe,w=se("loading");return n(),r("div",Tl,[a($,{placement:"bottom-end",width:300,persistent:!1,trigger:"click",teleported:!1,"popper-class":"fcom_giphy_popover fcom_menu_below_nav",ref:"popover"},{reference:d(()=>[a(b,{"aria-label":e.$t("Pick GIF"),text:"",onClick:i.handleGiphyClick},{default:d(()=>[a(k,{class:D(["fcom_apps_icon"])},{default:d(()=>[a(p)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:d(()=>[Y((n(),r("div",Fl,[a(m,{modelValue:o.searchQuery,"onUpdate:modelValue":t[0]||(t[0]=C=>o.searchQuery=C),placeholder:e.$t("Search Gifs"),onInput:i.handleSearch},null,8,["modelValue","placeholder","onInput"]),l("div",{class:"gif_container",onScroll:t[1]||(t[1]=(...C)=>i.handleScroll&&i.handleScroll(...C))},[o.gifs.length>0?(n(),y(h,{key:0,gutter:5},{default:d(()=>[(n(!0),r(F,null,R(o.gifs,C=>(n(),y(f,{span:12,key:C.id,class:"gif_item"},{default:d(()=>[l("img",{alt:"",onLoad:v=>C.loaded=!0,src:C.images.preview_gif.url,onClick:v=>i.selectGiphy(C)},null,40,Il),C.loaded?_("",!0):(n(),r("p",Pl))]),_:2},1024))),128))]),_:1})):(n(),r("p",El,c(e.$t("No results")),1))],32),t[2]||(t[2]=l("div",{class:"fcom_giphy_powered_by"},[l("span",{class:"powered_by"},"POWERED BY "),l("span",null,"GIPHY")],-1))])),[[w,o.loading]])]),_:1},512)])}const Ul=I(Ll,[["render",Al]]),Bl={name:"VideoIcon"},Dl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Rl(e,t,s,u,o,i){return n(),r("svg",Dl,[...t[0]||(t[0]=[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),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)])])}const xl=I(Bl,[["render",Rl]]);const Ol={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,p,k,b,$,w,C;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,(p=this.media)==null?void 0:p.url,(k=this.media)==null?void 0:k.html,(b=this.media)==null?void 0:b.title,($=this.media)==null?void 0:$.player,(w=this.media)==null?void 0:w.type,(C=this.media)==null?void 0:C.provider].filter(Boolean).join("|");if(!t)return 1;let s=5381;for(let v=0;v>>0;return s||1},async loadFluentPlayerContent(){var t,s,u,o,i,m;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 f=this.getStableMediaId(),h=await this.withTimeout(this.$get("fluent-player/video-content/"+f,{media_id:f,player_instance_key:this.getPlayerInstanceKey(),share_url:((t=this.media)==null?void 0:t.share_url)||"",url:((s=this.media)==null?void 0:s.url)||"",title:((u=this.media)==null?void 0:u.title)||"",image:((o=this.media)==null?void 0:o.image)||"",provider:((i=this.media)==null?void 0:i.provider)||"",type:((m=this.media)==null?void 0:m.type)||""}),this.getFallbackTiming("content_timeout_ms",1e4));if(e!==this.guardGeneration)return;h.html?(this.html=h.html,this.$nextTick(()=>{if(e!==this.guardGeneration)return;const p=this.$el&&this.$el.querySelector(".fluent-player");if(!p){this.fallBack("player markup missing");return}this.startFallbackGuard(p,h.media)})):this.$emit("load-failed")}catch(f){if(e!==this.guardGeneration)return;console.warn("Failed to load fluent-player assets:",f),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($=>$.name===u.src&&$.responseEnd>0);let f=0,h=0;const p=this.getFallbackTiming("script_grace_ms",2e3),k=setInterval(()=>{if(f+=250,s()){b(),t(!0);return}u&&(o||m())&&(h+=250),(h>=p||f>=e)&&(b(),t(!1))},250),b=()=>{clearInterval(k),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(T=>t.addEventListener(T,m));let h=null;const p=()=>{const T=t.querySelector("iframe");T&&T!==h&&(h=T,h.addEventListener("load",m),m())};p();let k=null;const b=()=>{k&&(clearInterval(k),k=null)},$=()=>{k||(k=setInterval(S,i))},w="IntersectionObserver"in window?new IntersectionObserver(T=>{const V=T[T.length-1];u=!!(V&&V.isIntersecting),u?(s=0,$()):b()}):null,C=()=>v();t.addEventListener("can-play",C);const v=()=>{b(),t.removeEventListener("can-play",C),f.forEach(T=>t.removeEventListener(T,m)),h&&h.removeEventListener("load",m),w&&w.disconnect()},S=()=>{if(!document.body.contains(t)||t.hasAttribute("data-can-play")){v();return}p(),!(!u||!t.hasAttribute("data-can-load"))&&(s+=i,s>=o&&(v(),this.fallBack("player stalled before becoming playable")))};w?w.observe(t):(u=!0,$()),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{}})}}},Hl={class:"fluent-player-preview"},jl={key:0,class:"player-container"},Nl=["innerHTML"];function zl(e,t,s,u,o,i){const m=Q;return n(),r("div",Hl,[o.html?(n(),r("div",jl,[l("div",{innerHTML:o.html},null,8,Nl)])):_("",!0),o.loading?(n(),y(m,{key:1,animated:"",rows:5})):_("",!0)])}const Lt=I(Ol,[["render",zl],["__scopeId","data-v-a381802f"]]),ql={name:"TuneIcon"},Gl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false"};function Yl(e,t,s,u,o,i){return n(),r("svg",Gl,[...t[0]||(t[0]=[l("path",{d:"M6 4v6M6 14v6M12 4v3M12 11v9M18 4v9M18 17v3",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},null,-1),l("path",{d:"M4 12h4M10 9h4M16 15h4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},null,-1)])])}const Wl=I(ql,[["render",Yl]]),Kl={name:"AudioList",components:{FluentPlayerPreview:Lt,TuneIcon:Wl,Close:Ct},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}}},Zl={class:"fcom_audio_list"},Ql={key:1,class:"fcom_audio_native_wrap"},Jl={class:"fcom_audio_native",controls:"",preload:"metadata"},Xl=["src","type"],ea=["aria-label","onClick"],ta=["aria-label","onClick"];function sa(e,t,s,u,o,i){const m=g("fluent-player-preview"),f=g("tune-icon"),h=g("Close"),p=j;return n(),r("div",Zl,[(n(!0),r(F,null,R(s.audios,(k,b)=>(n(),r("div",{key:i.audioKey(k,b),class:"fcom_audio_player_wrap"},[o.failedItems[k.media_id||b]?(n(),r("div",Ql,[l("audio",Jl,[l("source",{src:i.audioUrl(k),type:i.audioType(k)},null,8,Xl)])])):(n(),y(m,{key:0,media:i.playerMediaFor(k),onLoadFailed:$=>i.onLoadFailed(k.media_id||b)},null,8,["media","onLoadFailed"])),s.editable?(n(),r(F,{key:2},[l("button",{type:"button",class:"fcom_audio_ctl fcom_audio_edit_btn","aria-label":e.$t("Edit audio"),onClick:$=>e.$emit("edit",b)},[a(f)],8,ea),l("button",{type:"button",class:"fcom_audio_ctl fcom_audio_remove_btn","aria-label":e.$t("Remove audio"),onClick:$=>e.$emit("remove",b)},[a(p,null,{default:d(()=>[a(h)]),_:1})],8,ta)],64)):_("",!0)]))),128))])}const no=I(Kl,[["render",sa]]);const oa={name:"MediaPreview",components:{Postcard:oi,FluentPlayerPreview:Lt,AudioList:no},props:["feed","media_item","is_single"],data(){return{is_error:!1,isPlaying:!1,videoFailed:!1,fluentPlayerFailed:!1}},watch:{"media.url"(){this.fluentPlayerFailed=!1,this.videoFailed=!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(/&/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)}}},ia={key:0,class:"feed_media feed_media_audio_list"},na={key:0},la={key:1},aa=["innerHTML"],ra={key:2,class:"native_audio_wrapper"},da=["preload"],ca=["src","type"],ua=["controls","preload","poster"],_a=["src","type"],ma={key:4,class:"native_video_wrapper"},ha={key:1,class:"fcom_media_load_error"},fa=["href"],pa={key:0,class:"feed_media_image"},ga={key:1,class:"feed_media_content"},ya={class:"media_domain"},va={class:"feed_media_title"},ba={key:0,class:"feed_media_description"},ka={class:"feed_meta_desc"};function wa(e,t,s,u,o,i){const m=g("audio-list"),f=g("fluent-player-preview"),h=Ie,p=Q;return i.audioMedias.length?(n(),r("div",ia,[a(m,{feed:s.feed,audios:i.audioMedias},null,8,["feed","audios"])])):(n(),r("div",{key:1,class:D(["feed_media","feed_media_"+i.mediaWrapperType])},[i.isVideoMedia?(n(),r(F,{key:0},[i.hasFluentPlayer&&i.isSupportedByFluentPlayer()&&!o.fluentPlayerFailed?(n(),r("div",na,[a(f,{media:i.playerMedia,onLoadFailed:t[0]||(t[0]=k=>o.fluentPlayerFailed=!0)},null,8,["media"])])):i.media.html?(n(),r("div",la,[l("div",{class:"feed_media_ext_video",innerHTML:i.media.html},null,8,aa)])):i.media.url&&i.isAudioUrl(i.media.url)?(n(),r("div",ra,[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,ca)],8,da)])):i.media.url&&!o.videoFailed?(n(),r("div",{key:3,class:D(["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[2]||(t[2]=k=>o.isPlaying=!0),onPause:t[3]||(t[3]=(...k)=>i.onVideoPause&&i.onVideoPause(...k)),onEnded:t[4]||(t[4]=k=>o.isPlaying=!1)},[l("source",{src:i.media.url,type:i.getVideoType(i.media.url),onError:t[1]||(t[1]=k=>o.videoFailed=!0)},null,40,_a)],40,ua),o.isPlaying?_("",!0):(n(),r("div",{key:0,class:"native_video_overlay",onClick:t[5]||(t[5]=(...k)=>i.playVideo&&i.playVideo(...k))},[...t[7]||(t[7]=[l("div",{class:"native_play_button"},[l("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[l("path",{d:"M8 5v14l11-7z"})])],-1)])]))],2)):i.media.url?(n(),r("div",ma,[i.media.thumbnail?(n(),y(h,{key:0,src:i.media.thumbnail,alt:"",style:{width:"100%"}},null,8,["src"])):(n(),r("p",ha,c(e.$t("This video could not be played.")),1))])):_("",!0)],64)):i.media.type=="image"||i.media.is_uploaded?(n(),r("div",{key:1,class:D(["feed_media_provider_"+i.media.provider,"feed_media_image feed_custom_uploaded"])},[i.media.image&&!o.is_error?(n(),y(h,{key:0,alt:"",style:ue({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:D("fcom_media_provider_"+i.media.provider),fit:"scale-down"},{placeholder:d(()=>[a(p,{animated:!0})]),_:1},8,["style","src","previewSrcList","onError","class"])):_("",!0)],2)):(n(),r("a",{key:2,href:i.toAbsoluteUrl(i.media.url),target:"_blank",rel:"noopener",class:"feed_media_link"},[i.media.image&&!o.is_error?(n(),r("div",pa,[a(h,{onError:t[6]||(t[6]=k=>i.handleImageError()),style:{width:"100%"},src:i.media.image},{error:d(()=>[...t[8]||(t[8]=[l("span",null,null,-1)])]),_:1},8,["src"])])):_("",!0),i.media.title||i.media.url?(n(),r("div",ga,[l("div",ya,c(i.getDomainName(i.media.url)),1),l("div",va,c(e.getExcerpt(i.media.title||i.media.url,88)),1),i.media.description?(n(),r("div",ba,[l("div",ka,c(e.getExcerpt(i.media.description,160)),1)])):_("",!0)])):_("",!0)],8,fa))],2))}const xe=I(oa,[["render",wa],["__scopeId","data-v-de1ae8ac"]]);const Cs={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}},$s=[{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}],Ca={name:"FluentPlayerUploader",components:{UploadFilled:$t},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 Cs[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 Cs[this.uploadKind].pattern.test(e.name||"")?!0:(this.$handleError(this.kindErrorMessage),!1)},async handleUrlSubmit(){if(!this.videoUrl)return;const e=$s.some(u=>u.name==="file"&&u.regex.test(this.videoUrl)),t=$s.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}}},$a=["element-loading-text"],Sa={key:0,class:"upload-options"},Va={class:"uploader-content"},Ma={class:"el-upload__text"},La={key:1,class:"url-input-section"};function Ta(e,t,s,u,o,i){const m=g("upload-filled"),f=j,h=O,p=kt,k=oe,b=se("loading");return Y((n(),r("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(),r("div",Sa,[a(p,{drag:"",class:D([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:d(()=>[l("div",Va,[a(f,{class:"el-icon--upload"},{default:d(()=>[a(m)]),_:1}),l("div",Ma,[M(c(e.$t("Drop file here or"))+" ",1),l("em",null,c(e.$t("upload by clicking")),1)]),a(h,{type:"primary",class:"upload-button",loading:o.processing,disabled:o.processing},{default:d(()=>[K(e.$slots,"trigger",{},()=>[K(e.$slots,"default",{},()=>[M(c(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(),r("div",La,[a(k,{modelValue:o.videoUrl,"onUpdate:modelValue":t[0]||(t[0]=$=>o.videoUrl=$),type:"url",placeholder:e.$t("Enter video URL"),size:"large"},{append:d(()=>[a(h,{onClick:i.handleUrlSubmit,loading:o.processing},{default:d(()=>[M(c(e.$t("Embed")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["modelValue","placeholder"])]))],8,$a)),[[b,o.processing]])}const Fa=I(Ca,[["render",Ta]]),Ia={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:xe,FluentPlayerUploader:Fa},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(!/]/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()}},Pa={key:0},Ea={key:0,class:"fcom_media_editor_actions"},Aa={key:1,class:"fcom_media_editor fcom_media_embeder"},Ua={key:0},Ba={key:1},Da={key:2,class:"fcom_course_media"};function Ra(e,t,s,u,o,i){var w;const m=O,f=je,h=be,p=oe,k=g("fluent-player-uploader"),b=g("media-preview"),$=se("loading");return o.appReady?Y((n(),r("div",Pa,[s.has_iframe||i.hasUpload?(n(),r("div",Ea,[i.showPreview?(n(),y(m,{key:0,onClick:t[0]||(t[0]=C=>o.showInput=!0),size:"small",text:""},{default:d(()=>[M(c(e.$t("Edit media")),1)]),_:1})):(n(),y(h,{key:1,onChange:t[1]||(t[1]=C=>{s.media.html="",s.media.url="",o.showInput=!0}),size:"small",modelValue:i.editorMode,"onUpdate:modelValue":t[2]||(t[2]=C=>i.editorMode=C),disabled:o.uploading,"aria-label":e.$t("Media source")},{default:d(()=>[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(),r("div",Da,[a(b,{media_item:s.media},null,8,["media_item"])])):(n(),r("div",Aa,[s.media.type=="iframe_html"&&s.has_iframe?(n(),r(F,{key:0},[l("h3",null,c(e.$t("Add Video from custom HTML Code")),1),a(p,{rows:5,modelValue:s.media.html,"onUpdate:modelValue":t[3]||(t[3]=C=>s.media.html=C),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]=C=>i.handleAddCustomHtml())},{default:d(()=>[M(c(e.$t("Embed")),1)]),_:1})],64)):(n(),r(F,{key:1},[l("h3",null,c(i.editorTitle),1),i.hasFluentPlayerInstalled&&s.media.type==="upload"?(n(),r("p",Ua,c(i.uploadHint),1)):(n(),r("p",Ba,c(s.box_description||e.$t("Embed from Vimeo, YouTube, Wistia and more")),1)),i.hasFluentPlayer&&(s.media.type==="upload"||i.playEmbeddedVideos)?(n(),y(k,{key:2,type:((w=s.media)==null?void 0:w.type)==="upload"?"upload":"url",media_kind:o.uploadKind,onVideoAdded:i.handleFluentPlayerVideo,onUploading:t[5]||(t[5]=C=>o.uploading=!0),onCompleted:t[6]||(t[6]=C=>o.uploading=!1)},null,8,["type","media_kind","onVideoAdded"])):(n(),y(p,{key:3,onKeydown:te(i.fetchData,["enter"]),size:"large",modelValue:s.media.url,"onUpdate:modelValue":t[7]||(t[7]=C=>s.media.url=C),type:"url",placeholder:e.$t("Paste a URL to embed")},{append:d(()=>[a(m,{onClick:i.fetchData,class:"fcom_primary_button"},{default:d(()=>[M(c(e.$t("Embed")),1)]),_:1},8,["onClick"])]),_:1},8,["onKeydown","modelValue","placeholder"]))],64))]))])),[[$,o.fetching]]):_("",!0)}const xa=I(Ia,[["render",Ra]]),Oa={name:"VideoEmbeder",emits:["embeded"],props:["is_admin","space"],components:{MediaEmbeder:xa,VideoIcon:xl},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())}}},Ha={class:"fcom_video_embeder"};function ja(e,t,s,u,o,i){const m=g("VideoIcon"),f=j,h=O,p=g("media-embeder"),k=ke;return n(),r("div",Ha,[a(h,{"aria-label":e.$t("Add Video"),text:"",onClick:i.show},{default:d(()=>[a(f,{class:D(["fcom_apps_icon"])},{default:d(()=>[a(m)]),_:1})]),_:1},8,["aria-label","onClick"]),o.showVideoPop?(n(),y(k,{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:d(()=>[a(p,{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 Na=I(Oa,[["render",ja]]),za="modulepreload",qa=function(e){return"/"+e},Ss={},he=function(t,s,u){if(!s||s.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(s.map(i=>{if(i=qa(i),i in Ss)return;Ss[i]=!0;const m=i.endsWith(".css"),f=m?'[rel="stylesheet"]':"";if(!!u)for(let k=o.length-1;k>=0;k--){const b=o[k];if(b.href===i&&(!m||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${f}`))return;const p=document.createElement("link");if(p.rel=m?"stylesheet":za,m||(p.as="script",p.crossOrigin=""),p.href=i,document.head.appendChild(p),m)return new Promise((k,b)=>{p.addEventListener("load",k),p.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 lo=(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))(lo||{});const Ga={cursor:!0,"link-tooltip":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,"image-block":!0};async function Ya(e,t,s){switch(e){case"link-tooltip":{const{defineFeature:u}=await he(()=>import("./index.js?ver=2.11.0"),[]);return u(t,s)}case"block-edit":{const{defineFeature:u}=await he(()=>import("./index2.js?ver=2.11.0"),[]);return u(t,s)}case"placeholder":{const{defineFeature:u}=await he(()=>import("./index3.js?ver=2.11.0"),[]);return u(t,s)}case"toolbar":{const{defineFeature:u}=await he(()=>import("./index4.js?ver=2.11.0"),[]);return u(t,s)}case"image-block":{const{defineFeature:u}=await he(()=>import("./index5.js?ver=2.11.0"),[]);return u(t,s)}}}const Wa=en([],"FeaturesCtx");function Ka(e){return t=>{t.inject(Wa,e)}}var ls=(e,t,s)=>{if(!t.has(e))throw TypeError("Cannot "+s)},me=(e,t,s)=>(ls(e,t,"read from private field"),s?s.call(e):t.get(e)),qe=(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)},nt=(e,t,s,u)=>(ls(e,t,"write to private field"),u?u.call(e,s):t.set(e,s),s),Za=(e,t,s)=>(ls(e,t,"access private method"),s),Ce,lt,at,vt,Ge,zt,ao;class ro{constructor({root:t,features:s={},featureConfigs:u={},defaultValue:o="",onUpdate:i=f=>{},handleCommonActions:m=(f,h)=>{}}){var k;qe(this,zt),qe(this,Ce,void 0),qe(this,lt,void 0),qe(this,at,void 0),qe(this,vt,!0),qe(this,Ge,null);const f=Object.entries({...Ga,...s}).filter(([,b])=>b).map(([b])=>b);nt(this,at,(typeof t=="string"?document.querySelector(t):t)??document.body),nt(this,Ce,tn.make().config(Ka(f)).config(b=>{b.set(sn,me(this,at)),b.set(on,o),b.set(nn,{editable:()=>me(this,vt)})}).config(b=>{const $=async(w,C)=>await m("handleFileUpload",{ctx:b,files:w,schema:C});b.update(ln.key,w=>({...w,uploader:$}))}).config(b=>{const $=b.get(an);$.markdownUpdated((w,C,v)=>{C!==v&&i(C)}),$.updated((w,C,v)=>{m("editor_updated",w)})}).use(rn).use(dn).use(cn).use(un).use(_n).use(mn).use(hn));const h=(k=u==null?void 0:u["block-edit"])==null?void 0:k.canAddImage;h&&me(this,Ce).use(Nt(()=>new Ht({filterTransaction:b=>b.docChanged?!b.steps.some(w=>{var v,S;let C=!1;return(S=(v=w.slice)==null?void 0:v.content)==null||S.forEach(T=>{var V;T.type.name.includes("image")&&(C=!0),(V=T.content)==null||V.forEach(P=>{P.type.name.includes("image")&&(C=!0)})}),C})||h():!0}))),me(this,Ce).use(Nt(()=>new Ht({props:{handleTextInput(b,$,w,C){const v=b.state.schema.marks.link;if(C!==" "||!v)return!1;const S=b.state.doc.resolve($),T=/(?:^|\s)((?:https?:\/\/|www\.)\S+)$/.exec(S.parent.textBetween(0,S.parentOffset,void 0,"๏ฟผ"));if(!T)return!1;const V=T[1].replace(/[.,)]+$/,""),P=$-T[1].length,L=P+V.length;if(b.state.doc.rangeHasMark(P,L,v))return!1;const x=(V.startsWith("http")?"":"https://")+V,A=b.state.tr.insertText(C,$).addMark(P,L,v.create({href:x})).removeStoredMark(v);return b.dispatch(A),!0}},appendTransaction:(b,$,w)=>{const C=w.schema.marks.link,v=w.selection.$cursor;if(!C||!v||!b.some(A=>A.docChanged))return null;const S=A=>A==null?void 0:A.marks.find(U=>U.type===C);if((w.storedMarks??v.marks()).some(A=>A.type===C)&&!S(v.nodeBefore)&&!S(v.nodeAfter))return w.tr.removeStoredMark(C);const P=v.pos;if(P<1||w.doc.textBetween(P-1,P)!==" "||!w.doc.rangeHasMark(P-1,P,C))return null;const L=S(w.doc.resolve(P-1).nodeBefore),x=S(w.doc.resolve(P).nodeAfter);return x&&(L==null?void 0:L.attrs.href)===x.attrs.href?null:w.tr.removeMark(P-1,P,C).removeStoredMark(C)}}))),me(this,Ce).use(Nt(()=>{let b=!1,$=!1;return new Ht({view:w=>({update(){var L;const C=w.state.schema.marks.link,v=w.state.selection.$cursor,S=x=>x.type===C,T=!!C&&!!(v!=null&&v.marks().some(S)),V=document.querySelector("milkdown-link-preview"),P=(V==null?void 0:V.style.display)==="none"&&!$;if(T&&!P){V&&$&&(V.style.display=""),$=!1;const x=w.coordsAtPos((L=v.nodeBefore)!=null&&L.marks.some(S)?v.pos-1:v.pos);w.dom.dispatchEvent(new MouseEvent("mousemove",{bubbles:!0,clientX:x.left+1,clientY:(x.top+x.bottom)/2}))}else!T&&b&&(w.dom.dispatchEvent(new MouseEvent("mouseleave",{bubbles:!0})),V&&(V.style.display="none"),$=!0);b=T}})})}));const p=[];f.forEach(b=>{const $=u[b];p.push(Ya(b,me(this,Ce),$))}),nt(this,lt,Promise.all(p))}async create(){await me(this,lt);const t=await me(this,Ce).create();return Za(this,zt,ao).call(this),t}async destroy(){var t;return(t=me(this,Ge))==null||t.disconnect(),await me(this,lt),me(this,Ce).destroy()}get editor(){return me(this,Ce)}setReadonly(t){return nt(this,vt,!t),this}getMarkdown(){return me(this,Ce).action(fn())}getEditor(){return me(this,Ce)}destroyEditor(){this.destroy()}}Ce=new WeakMap;lt=new WeakMap;at=new WeakMap;vt=new WeakMap;Ge=new WeakMap;zt=new WeakSet;ao=function(){const e=me(this,at),t=u=>{parseFloat(u.style.left)<0&&(u.style.left="0px")},s=u=>{const o=e.querySelector(u);o&&(me(this,Ge).observe(o,{attributes:!0,attributeFilter:["style"]}),setTimeout(()=>t(o),0))};nt(this,Ge,new MutationObserver(u=>{const o=u[0];o.type==="childList"?(s("milkdown-link-edit"),s("milkdown-link-preview")):t(o.target)})),me(this,Ge).observe(e,{childList:!0,subtree:!0})};ro.Feature=lo;const Qa={name:"CrepeEditor",emits:["update:modelValue","handleMediaUpload","editorCreated","editor-escape"],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:pn,ProsemirrorAdapterProvider:gn},data(){return{editor:null,editorFailed:!1,currentContent:"",showMentionPop:!1,currentMentionSearch:"",mentionResults:[],justReplaced:!1,searchingMention:!1,hasUnsavedChanges:!1,pendingNavigation:null,activeUploadBlock:null}},watch:{autofocus_changed(e){e&&this.focusOnEditor()},editorFailed(e){e&&this.$nextTick(this.resizeFallback)},modelValue(){this.editorFailed&&this.$nextTick(this.resizeFallback)},currentContent(){var t;const e=this.context==="feed"||this.context==="comment";this.hasUnsavedChanges=e&&!!((t=this.currentContent)!=null&&t.replace(/ |\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(){if(!this.editor){this.currentContent="",this.$emit("update:modelValue",""),this.$refs.fallbackInput&&(this.$refs.fallbackInput.style.height="");return}this.editor.action(e=>{const t=e.get(it),{state:s}=t,u=s.tr.replaceWith(0,s.doc.content.size,s.schema.nodes.paragraph.create());t.dispatch(u)}),this.currentContent=""},updateContent(e){if(!this.editor){this.currentContent=(this.modelValue||"")+e,this.$emit("update:modelValue",this.currentContent);return}this.editor.action(t=>{const s=t.get(it),{state:u}=s,{from:o}=u.selection,i=e,m=u.tr.insertText(i,o),f=o+i.length,h=m.setSelection(ws.create(m.doc,f));s.dispatch(h),s.focus()})},initEditor(){const e=this,t=new ro({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")}).catch(s=>{console.error("FluentCommunity: rich editor failed to load, falling back to plain text",s),this.editorFailed=!0,this.$emit("editorCreated")})},onFallbackInput(e){this.currentContent=e.target.value,this.$emit("update:modelValue",e.target.value),this.resizeFallback()},resizeFallback(){const e=this.$refs.fallbackInput;e&&(e.style.height="auto",e.style.height=e.scrollHeight+"px")},focusOnEditor(e=null){!e&&!this.autofocus||!this.editor||this.editor.action(t=>{const s=t.get(it),{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(ws.create(u.doc,i))),s.focus()})},checkforMention(e){if(!this.currentContent.includes("@")||this.justReplaced){this.showMentionPop=!1,this.currentMentionSearch="";return}const s=e.get(it),{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(),p=this.defaultMentions.filter(k=>k.username.toLowerCase().includes(h)||k.display_name.toLowerCase().includes(h));p.length&&(this.currentMentionSearch=f,this.mentionResults=p,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||!this.editor)return;const t=new RegExp(`@${this.currentMentionSearch}(?!.*@${this.currentMentionSearch})`);this.currentContent=this.currentContent.replace(t,e+"ย "),this.editor.action(yn(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{const u=s.get(it),{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),p=o.tr.insert(h,m);u.dispatch(p),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()))},handleEditorKeydown(e){const t=this.$refs.crepe_editor_vue;e.key!=="Escape"||!(t!=null&&t.contains(e.target))||this.showMentionPop||t.querySelector('milkdown-slash-menu[data-show="true"], milkdown-toolbar[data-show="true"], milkdown-link-preview[data-show="true"], milkdown-link-edit[data-show="true"]')||this.$emit("editor-escape")}},mounted(){this.initEditor(),window.addEventListener("beforeunload",this.handleBeforeUnload),document.addEventListener("click",this.handleLinkClick,!0),document.addEventListener("keydown",this.handleEditorKeydown,!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),document.removeEventListener("keydown",this.handleEditorKeydown,!0),this.onInlineUpload&&((e=this.$refs.crepe_editor_vue)==null||e.removeEventListener("click",this.handleImageBlockClick,!0)),this.$eventBus.off("unsavedChangesProceeded",this.onUnsavedChangesProceeded)}},Ja={style:{position:"relative"},class:"fcom_md_editor"},Xa={ref:"crepe_editor_vue",class:"crepe-editor feed_md_content fcom_md_seditor_wrapper"},er=["placeholder","value"],tr={class:"fcom_mention_pop_wrap"},sr={key:0},or={key:0},ir=["onClick"],nr=["src"],lr={key:1};function ar(e,t,s,u,o,i){const m=g("ProsemirrorAdapterProvider"),f=g("MilkdownProvider"),h=fe;return n(),r(F,null,[a(f,null,{default:d(()=>[a(m,null,{default:d(()=>[l("div",Ja,[Y(l("div",Xa,null,512),[[bt,!o.editorFailed]]),o.editorFailed?(n(),r("textarea",{key:0,ref:"fallbackInput",class:"fcom_md_editor_fallback",placeholder:s.placeholder||e.$t("Type your message here!"),value:s.modelValue,onInput:t[0]||(t[0]=(...p)=>i.onFallbackInput&&i.onFallbackInput(...p))},null,40,er)):_("",!0)])]),_:1})]),_:1}),l("div",tr,[a(h,{"popper-class":"fcom_mention_pop",ref:"mentionPopoverRef",placement:"bottom",visible:o.showMentionPop,width:300,persistent:!1},{reference:d(()=>[...t[1]||(t[1]=[l("span",{style:{}},null,-1)])]),default:d(()=>[o.justReplaced?_("",!0):(n(),r("div",sr,[o.mentionResults.length?(n(),r("ul",or,[(n(!0),r(F,null,R(o.mentionResults,p=>(n(),r("li",{key:p.user_id,onClick:k=>i.addMention("@"+p.username)},[p.avatar?(n(),r("img",{key:0,alt:"",src:p.avatar},null,8,nr)):_("",!0),l("span",null,c(p.display_name)+" (@"+c(p.username)+")",1)],8,ir))),128))])):o.searchingMention?_("",!0):(n(),r("div",lr,[l("p",null,c(e.$t("No results found. Please search by username")),1)]))]))]),_:1},8,["visible"])])],64)}const as=I(Qa,[["render",ar]]);const rr={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){e.disabled||(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)}},dr=["aria-disabled","onClick","onKeydown"];function cr(e,t,s,u,o,i){const m=g("MoreFilled"),f=j,h=O,p=fe;return n(),y(p,{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:d(()=>[l("span",{ref:"triggerRef",class:"fcom_action_popover_trigger",onClick:t[0]||(t[0]=(...k)=>i.toggle&&i.toggle(...k))},[K(e.$slots,"trigger",{visible:o.visible},()=>[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:d(()=>[a(f,null,{default:d(()=>[a(m)]),_:1})]),_:1},8,["aria-label","aria-expanded"])])],512)]),default:d(()=>[K(e.$slots,"default",{hide:i.hide},()=>[l("ul",{class:"actions_items",role:"menu","aria-orientation":"vertical",onKeydown:t[1]||(t[1]=te(q((...k)=>i.hideAndFocusTrigger&&i.hideAndFocusTrigger(...k),["prevent","stop"]),["esc"]))},[(n(!0),r(F,null,R(s.items,(k,b)=>(n(),r("li",{key:b,ref_for:!0,ref:"menuItems",class:D(["fcom_action_popover_item",[k.type?"fcom_action_popover_item_"+k.type:"",{"is-disabled":k.disabled}]]),role:"menuitem","aria-disabled":k.disabled?"true":null,tabindex:"0",onClick:$=>i.handleAction(k),onKeydown:[te(q($=>i.handleAction(k),["prevent"]),["enter"]),te(q($=>i.handleAction(k),["prevent"]),["space"]),te(q($=>i.focusItem(b+1),["prevent"]),["down"]),te(q($=>i.focusItem(b-1),["prevent"]),["up"])]},c(k.label),43,dr))),128))],32)])]),_:3},8,["placement","persistent","width","visible","teleported","onAfterEnter"])}const et=I(rr,[["render",cr]]),ur={name:"SmilyIcon"},_r={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function mr(e,t,s,u,o,i){return n(),r("svg",_r,[...t[0]||(t[0]=[Le('',1)])])}const hr=I(ur,[["render",mr]]),fr={name:"EmojiPicker",components:{Picker:Zi,ActionPopover:et,SmilyIcon:hr},emits:["emoji-selected"],props:{close_on_select:{type:Boolean,default:!1}},data(){return{emojiIndex:null,emojiLoading:!1,errorMessage:"",isLoading:!1}},methods:{onEmojiSelect(e){this.$emit("emoji-selected",e.native),this.close_on_select&&this.closeAndRefocus()},closeAndRefocus(){var e;(e=this.$refs.fcom_emoji_popover)==null||e.hideAndFocusTrigger()},applyEmojiIndex(){this.emojiIndex=window.fcomEmojiIndex,this.emojiLoading=!1,this.focusSearchInput()},focusSearchInput(){this.$nextTick(()=>{var s,u,o,i;const e=document.activeElement,t=(s=this.$refs.emojiTrigger)==null?void 0:s.$el;e&&e!==document.body&&e!==t&&!e.closest(".ffcom_emoji")||(i=(o=(u=this.$refs.picker)==null?void 0:u.$el)==null?void 0:o.querySelector("input"))==null||i.focus()})},loadEmojiAssets(){if(this.isLoading)return;if(window.fcomEmojiIndex){this.applyEmojiIndex();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 Qi(t),this.applyEmojiIndex()):this.errorMessage=this.$t("Emoji loading failed")}).catch(()=>{this.errorMessage=this.$t("Emoji loading failed")}).finally(()=>{this.isLoading=!1})}}},pr={key:0,class:"emoji-mart emoji-mart-static",style:{width:"320px",padding:"10px 20px"}},gr={key:0},yr={style:{"text-align":"center","margin-bottom":"20px"}},vr={key:1,class:"fcom_emoji_holder"};function br(e,t,s,u,o,i){const m=g("SmilyIcon"),f=j,h=O,p=Q,k=g("Picker"),b=g("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:d(({visible:$})=>[a(h,{ref:"emojiTrigger","aria-label":e.$t("Pick Emoji"),"aria-haspopup":"dialog","aria-expanded":$?"true":"false",onKeydown:te(w=>$&&i.closeAndRefocus(),["esc"]),text:""},{default:d(()=>[a(f,null,{default:d(()=>[a(m)]),_:1})]),_:1},8,["aria-label","aria-expanded","onKeydown"])]),default:d(()=>[l("div",{class:"ffcom_emoji",onKeydown:t[0]||(t[0]=te(q($=>i.closeAndRefocus(),["prevent","stop"]),["esc"]))},[o.emojiLoading?(n(),r("div",pr,[o.errorMessage?(n(),r("div",gr,c(o.errorMessage),1)):(n(),r(F,{key:1},[l("div",yr,c(e.$t("Loading...")),1),a(p,{animated:!0,rows:3})],64))])):o.emojiIndex?(n(),r("div",vr,[a(k,{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:i.onEmojiSelect,emojiSize:22,sheetSize:32,emojiTooltip:!1},null,8,["title","i18n","data","onSelect"])])):_("",!0)],32)]),_:1},8,["onShow"])}const co=I(fr,[["render",br]]),kr={name:"AudioEditModal",components:{ImageUploader:Re,EditPen:Gs,Delete:Ys},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"},Cr={id:"fcom_audio_name_label",class:"fcom_audio_edit__label"},$r={class:"fcom_audio_edit__label"},Sr={class:"fcom_audio_edit__thumb_row"},Vr={class:"fcom_image_uploader_wrapper"},Mr={class:"fcom_sr_only"};function Lr(e,t,s,u,o,i){const m=oe,f=Ie,h=g("EditPen"),p=j,k=O,b=g("Delete"),$=g("image-uploader"),w=ke;return n(),y(w,{"model-value":s.visible,title:e.$t("Edit Audio"),width:"440px","append-to-body":"","onUpdate:modelValue":t[3]||(t[3]=C=>e.$emit("update:visible",C))},{footer:d(()=>[a(k,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=C=>e.$emit("update:visible",!1))},{default:d(()=>[M(c(e.$t("Cancel")),1)]),_:1}),a(k,{class:"fcom_primary_button",loading:o.saving,disabled:!o.localTitle||!o.localTitle.trim(),onClick:i.save},{default:d(()=>[M(c(e.$t("Save")),1)]),_:1},8,["loading","disabled","onClick"])]),default:d(()=>[l("div",wr,[l("label",Cr,c(e.$t("Audio file name")),1),a(m,{modelValue:o.localTitle,"onUpdate:modelValue":t[0]||(t[0]=C=>o.localTitle=C),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",$r,c(e.$t("Thumbnail")),1),l("div",Sr,[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",Vr,[a($,{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]=C=>{o.localPoster=C})},ye({remove:d(()=>[a(p,null,{default:d(()=>[a(b)]),_:1}),l("span",Mr,c(e.$t("Remove Thumbnail")),1)]),_:2},[o.localPoster?{name:"trigger",fn:d(({loading:C})=>[a(k,{class:"fcom_plain_button",loading:C,disabled:C,"aria-label":e.$t("Change Thumbnail"),title:e.$t("Change Thumbnail")},{default:d(()=>[a(p,null,{default:d(()=>[a(h)]),_:1})]),_:1},8,["loading","disabled","aria-label","title"])]),key:"0"}:void 0]),1032,["can_remove"])])])])]),_:1},8,["model-value","title"])}const Tr=I(kr,[["render",Lr]]),Fr={name:"MusicIcon"},Ir={width:"22",height:"22",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",focusable:"false"};function Pr(e,t,s,u,o,i){return n(),r("svg",Ir,[...t[0]||(t[0]=[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),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),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)])])}const Er=I(Fr,[["render",Pr]]),Ar={name:"AudioUploadButton",components:{MusicIcon:Er},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 Ur(e,t,s,u,o,i){const m=g("MusicIcon"),f=j,h=O;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:d(()=>[a(f,{class:"fcom_status_img_icon"},{default:d(()=>[a(m)]),_:1}),l("input",{ref:"fileInput",type:"file",accept:".mp3,.wav,.m4a,.aac,.ogg,.oga,.flac",multiple:"",hidden:"",onChange:t[0]||(t[0]=(...p)=>i.onFilesSelected&&i.onFilesSelected(...p))},null,544)]),_:1},8,["aria-label","title","loading","onClick"])):_("",!0)}const Br=I(Ar,[["render",Ur]]),Dr={name:"DocumentsUploader",components:{UploadFilled:$t,Document:St},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))}}},Rr={class:"fcom_documents_uploader"},xr={class:"el-upload__text"},Or={key:0},Hr={class:"fcom_document_lists"},jr={class:"fcom_each_document"},Nr={class:"fcom_document_info"},zr={class:"fcom_document_icon"},qr={class:"fcom_document_title"},Gr={class:"fcom_document_actions"};function Yr(e,t,s,u,o,i){const m=g("UploadFilled"),f=j,h=kt,p=g("Document"),k=O;return n(),r("div",Rr,[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:d(()=>[a(f,{class:"el-icon--upload"},{default:d(()=>[a(m)]),_:1}),l("div",xr,c(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(),r("div",Or,[l("div",Hr,[(n(!0),r(F,null,R(i.uploadingFiles,b=>(n(),r("div",jr,[l("div",Nr,[l("div",zr,[a(f,null,{default:d(()=>[a(p)]),_:1})]),l("span",qr,c(b.name),1)]),l("div",Gr,[a(k,{text:"",size:"small",loading:!0},{default:d(()=>[M(c(e.$t("Uploading...")),1)]),_:1})])]))),256))])])):_("",!0)])}const Wr=I(Dr,[["render",Yr]]),Kr={name:"PdfIcon"},Zr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function Qr(e,t,s,u,o,i){return n(),r("svg",Zr,[...t[0]||(t[0]=[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),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)])])}const Jr=I(Kr,[["render",Qr]]),Xr={name:"ZipIcon"},ed={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function td(e,t,s,u,o,i){return n(),r("svg",ed,[...t[0]||(t[0]=[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),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),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),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)])])}const sd=I(Xr,[["render",td]]),od={name:"AudioIcon"},id={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function nd(e,t,s,u,o,i){return n(),r("svg",id,[...t[0]||(t[0]=[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),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)])])}const ld=I(od,[["render",nd]]),ad={name:"DocIcon"},rd={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function dd(e,t,s,u,o,i){return n(),r("svg",rd,[...t[0]||(t[0]=[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),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)])])}const cd=I(ad,[["render",dd]]),ud={name:"VideoFileIcon"},_d={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function md(e,t,s,u,o,i){return n(),r("svg",_d,[...t[0]||(t[0]=[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),l("path",{d:"M12 2V7C12 8.10457 12.8954 9 14 9H19",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),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)])])}const hd=I(ud,[["render",md]]);const fd={name:"DocumentLists",components:{Document:St,Download:ii,PdfIcon:Jr,ImageIcon:ns,ZipIcon:sd,AudioIcon:ld,DocIcon:cd,VideoFileIcon:hd},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})}}},pd={class:"fcom_document_lists"},gd={class:"fcom_each_document"},yd={class:"fcom_document_info"},vd={class:"fcom_document_icon"},bd={class:"fcom_document_ext"},kd={class:"fcom_rename_actions"},wd=["href"],Cd={class:"fcom_document_actions"},$d=["href","aria-label"];function Sd(e,t,s,u,o,i){const m=j,f=oe,h=O,p=g("EditPen"),k=g("Download"),b=g("DeleteFilled"),$=se("loading");return n(),r("div",pd,[(n(!0),r(F,null,R(s.document_lists,(w,C)=>(n(),r("div",gd,[l("div",yd,[l("div",vd,[a(m,null,{default:d(()=>[(n(),y(Yt(i.getIcon(w.type))))]),_:2},1024)]),i.canEditTitle&&o.editingIndex==C?(n(),r(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)},ye({_:2},[i.getFileExtension(w.title)?{name:"suffix",fn:d(()=>[l("span",bd,c(i.getFileExtension(w.title)),1)]),key:"0"}:void 0]),1032,["readonly","aria-label","modelValue"]),l("div",kd,[a(h,{disabled:o.isSaving||!o.editingTitle.trim(),loading:o.isSaving,onClick:v=>i.saveDoc(w),type:"primary",size:"small"},{default:d(()=>[M(c(e.$t("Update")),1)]),_:1},8,["disabled","loading","onClick"]),a(h,{disabled:o.isSaving,onClick:i.cancelEdit,size:"small"},{default:d(()=>[M(c(e.$t("Cancel")),1)]),_:1},8,["disabled","onClick"])])],64)):(n(),r("a",{key:1,href:w.url,target:"_blank",rel:"noopener",class:"fcom_document_title"},c(w.title),9,wd))]),Y((n(),r("div",Cd,[i.canEditTitle&&o.editingIndex!=C?(n(),y(h,{key:0,"aria-label":e.$t("Edit"),onClick:v=>i.startEdit(C,w),plain:"",text:"",size:"small"},{default:d(()=>[a(m,null,{default:d(()=>[a(p)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0),!s.is_editable&&w.url?(n(),r("a",{key:1,href:w.url+"&force_download=1",target:"_blank","aria-label":e.$t("Download"),class:"el-button el-button--text"},[a(m,null,{default:d(()=>[a(k)]),_:1})],8,$d)):_("",!0),s.is_editable?(n(),y(h,{key:2,"aria-label":e.$t("Delete"),onClick:v=>i.removeDocument(C,w),plain:"",text:"",size:"small"},{default:d(()=>[a(m,null,{default:d(()=>[a(b)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0)])),[[$,o.isSaving]])]))),256))])}const tt=I(fd,[["render",Sd]]);const Vd={name:"DocumentUploaderPop",components:{DocumentLists:tt,DocumentsUploader:Wr,Document:St},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="")}}},Md={class:"fcom_inline_docs_form"},Ld={class:"fcom_doc_upload_modal"};function Td(e,t,s,u,o,i){var p;const m=O,f=g("documents-uploader"),h=g("document-lists");return n(),r("div",Md,[l("div",Ld,[a(m,{onClick:t[0]||(t[0]=k=>i.reset()),class:"fcom_file_cancel_btn",text:"",size:"small"},{default:d(()=>[M(c(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:(p=s.feed)==null?void 0:p.document_ids,onFileRemoved:i.removeDocument},null,8,["additional_data","document_lists","onFileRemoved"])])])}const Fd=I(Vd,[["render",Td]]),Id={name:"PaperClipIcon"},Pd={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Ed(e,t,s,u,o,i){return n(),r("svg",Pd,[...t[0]||(t[0]=[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)])])}const uo=I(Id,[["render",Ed]]),Ad=window.fluentComAdmin.auth,Ud={name:"FeedTextComposer",components:{AudioEditModal:Tr,AudioList:no,AudioUploadButton:Br,PaperClipIcon:uo,DocumentLists:tt,DocumentUploaderPop:Fd,Document:St,MediaPreview:xe,Giphy:Ul,ImageUploader:Re,SurveyEditForm:Cl,MarkdownEditor:as,EmojiPicker:co,VideoEmbeder:Na,ImageIcon:ns,PollIcon:hl},emits:["editorCreated"],props:{placeholder:{type:String,default(){return"What's happening, "+Ad.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)},focusComposerAction(){var t,s,u;const e=((t=this.$refs.composerActions)==null?void 0:t.querySelector("button:not([disabled])"))||((u=(s=this.$refs.composerActions)==null?void 0:s.parentElement)==null?void 0:u.querySelector("button:not([disabled])"));e==null||e.focus()},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(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()})}},Bd={class:"fcom_text_composer"},Dd={class:"fcom_editor status_text_input"},Rd={key:1,class:"fcom_audio_compose_list"},xd={key:2,style:{position:"relative","text-align":"center"}},Od={key:3,class:"fcom_media_items"},Hd={key:0,class:"fcom_media_images"},jd=["src","alt"],Nd={key:1,class:"fcrom_media_images"},zd={class:"fcrom_media_image"},qd=["src","alt"],Gd={key:4,class:"fcrom_media_images"},Yd=["src","alt"],Wd={key:5,class:"fcrom_media_images"},Kd={class:"fcrom_media_image"},Zd=["src","alt"],Qd={class:"fcom_composer_footer"},Jd={class:"fcom_composer_apps"},Xd={key:0},ec={ref:"composerActions",class:"fcom_composer_actions"};function tc(e,t,s,u,o,i){var B,N,H,z,G,ne,E,J,ce,X,Ve;const m=g("MarkdownEditor"),f=g("DocumentUploaderPop"),h=g("SurveyEditForm"),p=g("audio-list"),k=g("audio-edit-modal"),b=O,$=g("media-preview"),w=g("CloseBold"),C=j,v=g("ImageIcon"),S=g("image-uploader"),T=g("video-embeder"),V=g("audio-upload-button"),P=g("PaperClipIcon"),L=g("PollIcon"),x=g("EmojiPicker"),A=g("Giphy"),U=se("loading");return n(),r(F,null,[l("div",Bd,[l("div",Dd,[K(e.$slots,"before_input"),a(m,{ref:"markdownEditor",modelValue:s.content.message,"onUpdate:modelValue":t[0]||(t[0]=ee=>s.content.message=ee),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?ee=>i.uploadImage(ee,!1):null,canAddImage:i.canAddImage,onHandleMediaUpload:i.uploadImage,onEditorCreated:t[1]||(t[1]=()=>{e.$emit("editorCreated")}),onEditorEscape:i.focusComposerAction},null,8,["modelValue","context","is_modal","autofocus","placeholder","mentionQuery","defaultMentions","autofocus_changed","onInlineUpload","canAddImage","onHandleMediaUpload","onEditorEscape"]),K(e.$slots,"after_input")]),s.content.content_type=="document"?(n(),r(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(),r(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),(N=(B=s.content)==null?void 0:B.audio_medias)!=null&&N.length?(n(),r("div",Rd,[a(p,{audios:s.content.audio_medias,editable:!0,onRemove:i.removeComposerAudio,onEdit:i.openComposerAudioEdit},null,8,["audios","onRemove","onEdit"]),o.composerEditIndex!==null?(n(),y(k,{key:0,media:s.content.audio_medias[o.composerEditIndex],visible:o.showAudioEdit,"onUpdate:visible":t[2]||(t[2]=ee=>o.showAudioEdit=ee),onSaved:i.onComposerAudioSaved},null,8,["media","visible","onSaved"])):_("",!0)])):(z=(H=s.content)==null?void 0:H.media)!=null&&z.type?(n(),r("div",xd,[a(b,{onClick:t[3]||(t[3]=ee=>{s.content.media=null}),text:"",type:"danger"},{default:d(()=>[M(c(e.$t("Remove Media")),1)]),_:1}),a($,{media_item:s.content.media},null,8,["media_item"])])):(G=s.content)!=null&&G.meta?(n(),r("div",Od,[(E=(ne=s.content.meta)==null?void 0:ne.media_items)!=null&&E.length?(n(!0),r(F,{key:0},R(s.content.meta.media_items,(ee,Z)=>(n(),r("div",{key:Z},[ee.type=="image"?(n(),r("div",Hd,[l("img",{class:"fcom_media_image",src:ee.url,alt:e.$t("Media image")},null,8,jd),a(b,{"aria-label":e.$t("Remove image"),class:"fcom_media_images_cross_button",link:"",onClick:ie=>s.content.meta.media_items.splice(Z,1)},{default:d(()=>[a(C,null,{default:d(()=>[a(w)]),_:1})]),_:1},8,["aria-label","onClick"])])):_("",!0)]))),128)):((ce=(J=s.content.meta)==null?void 0:J.media_preview)==null?void 0:ce.type)=="image"||(Ve=(X=s.content.meta)==null?void 0:X.media_preview)!=null&&Ve.image?(n(),r("div",Nd,[l("div",zd,[l("img",{src:s.content.meta.media_preview.image,alt:e.$t("Media Preview image")},null,8,qd),a(b,{"aria-label":e.$t("Remove image"),link:"",onClick:t[4]||(t[4]=ee=>s.content.meta.media_preview=null)},{default:d(()=>[a(C,null,{default:d(()=>[a(w)]),_:1})]),_:1},8,["aria-label"])])])):_("",!0)])):s.content.media_images&&s.content.media_images.length?(n(),r("div",Gd,[(n(!0),r(F,null,R(s.content.media_images,(ee,Z)=>(n(),r("div",{class:"fcrom_media_image",key:Z},[l("img",{src:ee.url,alt:e.$t("Media image")},null,8,Yd),a(b,{"aria-label":e.$t("Remove image"),link:"",onClick:ie=>s.content.media_images.splice(Z,1)},{default:d(()=>[a(C,null,{default:d(()=>[a(w)]),_:1})]),_:1},8,["aria-label","onClick"])]))),128))])):i.checkHasImageForCommentsEdit(s.content)?(n(),r("div",Wd,[l("div",Kd,[l("img",{src:s.content.media.media_url,alt:e.$t("Media image")},null,8,Zd),a(b,{"aria-label":e.$t("Remove image"),link:"",onClick:t[5]||(t[5]=ee=>i.removeImageFromComments())},{default:d(()=>[a(C,null,{default:d(()=>[a(w)]),_:1})]),_:1},8,["aria-label"])])])):_("",!0)],64))]),K(e.$slots,"before_composer_footer"),Y((n(),r("div",Qd,[l("div",Jd,[i.hasActiveApp?_("",!0):(n(),r(F,{key:0},[o.maxMediaPerPost?(n(),y(S,{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:d(()=>[a(b,{"aria-label":e.$t("Upload Media"),loading:o.uploading,text:""},{default:d(()=>[a(C,{class:"fcom_status_img_icon"},{default:d(()=>[a(v)]),_:1}),o.uploading?(n(),r("span",Xd,c(e.$t("Uploading...")),1)):_("",!0)]),_:1},8,["aria-label","loading"])]),_:1},8,["additionalData","isMultiple","onUploaded"])):_("",!0),s.config.videoApp&&e.hasFeature("video_embeder")?(n(),y(T,{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(V,{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]=ee=>s.content.content_type="document")},{default:d(()=>[a(C,{class:D(["fcom_apps_icon"])},{default:d(()=>[a(P)]),_:1})]),_:1},8,["aria-label","title"])):_("",!0),s.config.surveyApp&&e.hasFeature("has_survey_poll")?(n(),y(b,{key:4,"aria-label":e.$t("Create Poll"),onClick:i.initSurveyForm,text:""},{default:d(()=>[a(C,{class:"fcom_apps_icon"},{default:d(()=>[a(L)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0),e.hasFeature("emoji_app")?(n(),y(x,{key:5,onEmojiSelected:i.insertEmoji},null,8,["onEmojiSelected"])):_("",!0),e.hasFeature("giphy_app")?(n(),y(A,{key:6,onSelectedGiphy:i.selectedGiphy},null,8,["onSelectedGiphy"])):_("",!0)],64))]),l("div",ec,[K(e.$slots,"default")],512)])),[[U,o.uploading]]),K(e.$slots,"after_composer_footer")],64)}const ht=I(Ud,[["render",tc]]),sc={name:"ImageCarousel",props:["feed","is_single"],data(){return{failedMedia:{}}},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}}},oc={class:"fcom_image_carousel"},ic={key:0},nc=["preload","poster"],lc=["src","type","onError"],ac={key:1,class:"fcom_media_load_error"},rc={key:1,class:"fcom_image_wrap"},dc={key:0,class:"fcom_image_overlay"};function cc(e,t,s,u,o,i){const m=Ie;return n(),r("div",oc,[l("div",{class:D([i.carouselClass+" "+s.feed.type,"fcom_image_carousel__container"])},[(n(!0),r(F,null,R(i.visibleMedia,(f,h)=>(n(),r("div",{class:D(["fcom_carousel__image","fcom_media_type_"+f.type])},[f.type==="video"?(n(),r("div",ic,[o.failedMedia[f.url]?(n(),r("p",ac,c(e.$t("This video could not be played.")),1)):(n(),r("video",{key:0,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),onError:p=>o.failedMedia[f.url]=!0},null,40,lc)],8,nc))])):(n(),r("div",rc,[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(),r("div",dc,"+"+c(i.overflowCount),1)):_("",!0)]))],2))),256))],2)])}const Tt=I(sc,[["render",cc]]),uc={name:"ErrorIcon"},_c={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"};function mc(e,t,s,u,o,i){return n(),r("svg",_c,[...t[0]||(t[0]=[l("circle",{cx:"12",cy:"12",r:"10"},null,-1),l("line",{x1:"12",x2:"12",y1:"16",y2:"12"},null,-1),l("line",{x1:"12",x2:"12.01",y1:"8",y2:"8"},null,-1)])])}const _o=I(uc,[["render",mc]]),hc={name:"ReportReview",components:{ErrorIcon:_o},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)}},fc={class:"fcom_feed_report_wrap"},pc={class:"fcom_feed_report_content"},gc={key:0},yc={key:1},vc={key:2},bc={class:"fcom_feed_report_action"};function kc(e,t,s,u,o,i){const m=g("ErrorIcon"),f=O;return n(),r("div",fc,[l("div",pc,[a(m),s.feed.meta.auto_flagged=="yes"?(n(),r("span",gc,c(e.$t("This %s has been flagged automatically by the site rule.",s.type)),1)):s.feed.meta.reports_count>1?(n(),r("span",yc,c(e.$t("This %1$s has been flagged with %2$s reports",s.type,s.feed.meta.reports_count)),1)):(n(),r("span",vc,c(e.$t("This %1$s has been flagged with %2$s report",s.type,s.feed.meta.reports_count)),1))]),l("div",bc,[a(f,{onClick:t[0]||(t[0]=h=>i.openReportDetails())},{default:d(()=>[M(c(e.$t("Review")),1)]),_:1})])])}const mo=I(hc,[["render",kc]]),wc={name:"StickyIcon"},Cc={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"};function $c(e,t,s,u,o,i){return n(),r("svg",Cc,[...t[0]||(t[0]=[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)])])}const Ft=I(wc,[["render",$c]]),Sc={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='',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()}},Vc=["innerHTML"];function Mc(e,t,s,u,o,i){const m=As;return n(),r(F,null,[l("div",{ref:"content",class:D(["feed_md_content",s.class_name]),innerHTML:s.content},null,10,Vc),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 ft=I(Sc,[["render",Mc]]),Lc=80,Tc=20,Fc=5e3,It={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"),Fc),setTimeout(()=>{const h=i.getBoundingClientRect();h.top>=Lc&&h.bottom<=window.innerHeight-Tc||i.scrollIntoView({behavior:"smooth",block:"center"})},50)}}},Ic={name:"SingleComment",mixins:[It],components:{ImageCarousel:Tt,FeedTextComposer:ht,MediaPreview:xe,ReportReview:mo,StickyIcon:Ft,FeedMdContent:ft,ActionPopover:et},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(/ |\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=`
`;e+=m}}let u=window.location.origin,o=new RegExp(u,"g");return e=e.replace(//g,(i,m,f,h)=>f.match(o)?``:``),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"))}}},Pc={key:1,class:"person_avatar"},Ec={class:"comment_wrap"},Ac={key:0,class:"comment_text"},Uc={key:0,class:"comment_text_head"},Bc={class:"comment_text_head_name"},Dc=["title"],Rc={key:0,class:"comment_text_head_status"},xc={class:"comment_actions"},Oc={key:2,class:"comment_text_media"},Hc={key:3,class:"comment_text_media"};function jc(e,t,s,u,o,i){const m=g("ReportReview"),f=g("UserAvatar"),h=g("UserRouteLink"),p=De,k=g("StickyIcon"),b=j,$=O,w=g("MoreFilled"),C=g("ActionPopover"),v=g("FeedMdContent"),S=g("MediaPreview"),T=g("ImageCarousel"),V=g("feed-text-composer"),P=se("loading");return n(),r(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(),r("div",Pc,[a(f,{with_level:!1,xprofile:s.comment.xprofile,is_rounded:!0},null,8,["xprofile"])])):_("",!0),Y((n(),r("div",Ec,[o.isEdit?(n(),r("div",{key:1,onKeydown:t[4]||(t[4]=te((...L)=>i.maybeSave&&i.maybeSave(...L),["enter"])),class:"comment_text"},[a(V,{context:"comment",config:{multipleMedia:!0},placeholder:e.$t("Write a comment"),content:o.editingComment,autofocus:!0,autofocus_changed:o.focusTrigger},{default:d(()=>[l("div",null,[a($,{onClick:t[2]||(t[2]=L=>o.isEdit=!1),class:"fcom_secondary_button"},{default:d(()=>[M(c(e.$t("Cancel")),1)]),_:1}),a($,{class:"fcom_primary_button",onClick:t[3]||(t[3]=L=>i.updateComment(o.editingComment))},{default:d(()=>[M(c(e.$t("Update")),1)]),_:1})])]),_:1},8,["placeholder","content","autofocus_changed"])],32)):(n(),r("div",Ac,[s.show_header?(n(),r("div",Uc,[l("div",Bc,[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"},c(e.humanDateDiff(s.comment.created_at)),9,Dc),s.comment.status=="pending"?(n(),r("div",Rc,[a(p,{type:"warning"},{default:d(()=>[M(c(e.$t("In Review")),1)]),_:1})])):_("",!0)]),l("div",xc,[s.comment.is_sticky?(n(),y($,{key:0,onClick:t[0]||(t[0]=L=>i.toggleSticky()),"aria-label":e.$t("Toggle Sticky"),class:"no_pad_btn",text:"",size:"small"},{default:d(()=>[a(b,{title:e.$t("Unpin from Top"),class:"fcom_sticky"},{default:d(()=>[a(k)]),_:1},8,["title"])]),_:1},8,["aria-label"])):_("",!0),a(C,{ref:"comment_actions",items:i.commentActions,placement:"bottom",width:200},{trigger:d(()=>[a($,{"aria-label":e.$t("View comment actions"),class:"fcom_dot_menu",size:"small",text:""},{default:d(()=>[a(b,null,{default:d(()=>[a(w)]),_: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(),r("button",{key:1,type:"button",class:"fcom_see_more_btn",onClick:t[1]||(t[1]=(...L)=>i.toggleExpand&&i.toggleExpand(...L))},c(o.expanded?e.$t("See less"):e.$t("See more")),1)):_("",!0),s.comment.meta.media_preview?(n(),r("div",Oc,[a(S,{media_item:s.comment.meta.media_preview},null,8,["media_item"])])):s.comment.meta.media_items?(n(),r("div",Hc,[s.comment.meta.media_items?(n(),y(T,{key:0,feed:s.comment},null,8,["feed"])):_("",!0)])):_("",!0)])),K(e.$slots,"after_comment_text")])),[[P,o.working]])],64)}const ho=I(Ic,[["render",jc]]);function W(e){return window.fluentComAdmin.i18n[e]||e}const fo={public:{label:W("Public"),description:W("__PUBLIC_SPACE_DESC"),space_description:W("__PIBLIC_SPACE_DESC_2")},private:{label:W("Private"),description:W("__PRIVATE_SPACE_DESC"),space_description:W("__PRIVATE_SPACE_DESC_2")},secret:{label:W("Secret"),description:W("Only invited members can view and post."),space_description:W("__SECRET_SPACE_DESC_2")}},Nc={public:{label:W("Public"),description:W("Anyone can view and enroll the course for free")},private:{label:W("Private"),description:W("__PRIVATE_COURSE_DESC")},secret:{label:W("Secret"),description:W("Only invited students can view and enroll the course content.")}},zc={self_paced:{label:W("Self Paced"),description:W("__SELF_PAED_COURSE_DESC")},structured:{label:W("Structured"),description:W("__STRUCTURED_COURSE_DESC")},scheduled:{label:W("Scheduled"),description:W("Course starts on a specific date. Sections are dripped relative to that date.")}};W("Leaderboard Settings"),W("Settings for Leaderboard & Gamification features"),W("Get Leaderboard & Gamification Module"),W("Unlock potential by creating new feeds and earning points for likes. Advance in rank based on your total points using this module"),W("Emoji Module"),W("Settings for Emoji & Reaction features"),W("Get Emoji & Reaction Module"),W("Use emojis to add a personal touch and make your new article, post, or comment more expressive"),W("Giphy Module"),W("Customize Your Giphy Module Settings"),W("Get Giphy Module"),W("Want to use awesome GIFs? Upgrade to Pro plan now and enjoy surfing on FluentCommunity"),W("User Badge Module"),W("Add a badge next to user profile name to highlight valued users"),W("Get User Badge Module"),W("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."),W("Media Module"),W("Add a badge next to user profile name to highlight valued users"),W("Get Media Module"),W("Choose where to store your media files. Options include Local File System, Amazon S3, or Cloudflare R2 for storing and serving your media assets"),W("Progressive Web App (PWA)"),W("Let members install your community as an app on their phone"),W("Get Progressive Web App (PWA) Module"),W("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 Ue=e=>{e=parseInt(e);const t=Object.values(window.fluentComAdmin.leaderboard_levels);if(!e)return t[0];for(let s=0;s=t[s].min_points&&e<=t[s].max_points)return t[s];return t[t-1]},qc={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:'',url:this.xprofile.website});let t=this.xprofile.social_links;if(t||(t=(u=this.xprofile.meta)==null?void 0:u.social_links),ts(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}}},Gc={key:0,class:"fcom_social_links"},Yc=["href","title"];function Wc(e,t,s,u,o,i){const m=j,f=g("router-link");return i.hasSocialLinks?(n(),r("div",Gc,[(n(!0),r(F,null,R(i.socialLinks,h=>(n(),r("a",{rel:"noopener nofollow",target:"_blank",href:h.url,key:h.title,title:h.title},[a(m,{innerHTML:h.icon},null,8,["innerHTML"])],8,Yc))),128)),s.isOwn&&!i.hasSocialLinks?(n(),y(f,{key:0,to:{name:"update_profile",params:{username:s.xprofile.username}}},{default:d(()=>[M(c("+ "+e.$t("Add social links")),1)]),_:1},8,["to"])):_("",!0)])):_("",!0)}const Pt=I(qc,[["render",Wc]]),Kc={name:"FollowAction",props:{profile:{type:Object,required:!0},followButtonText:{type:String,default:""}},emits:["refetch"],setup(){return{userStore:Be()}},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})}}},Zc={key:0},Qc={key:1},Jc={key:0},Xc={key:1};function eu(e,t,s,u,o,i){const m=O;return i.showFollowAction?(n(),r(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:d(()=>[o.hovering?(n(),r("span",Qc,c(e.$t("Unblock")),1)):(n(),r("span",Zc,c(e.$t("Blocked")),1))]),_:1},8,["loading","disabled","onClick"])):i.isFollowing?(n(),y(m,{key:1,onClick:i.confirmUnfollow,class:D(["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:d(()=>[o.hovering?(n(),r("span",Xc,c(e.$t("Unfollow")),1)):(n(),r("span",Jc,c(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:d(()=>[l("span",null,c(i.followBtnText),1)]),_:1},8,["onClick","loading","disabled"]))],64)):_("",!0)}const st=I(Kc,[["render",eu]]),tu={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:Pt,FollowAction:st},data(){return{}},computed:{userLevel(){var e;return this.has_leaderboard&&((e=this.xprofile)!=null&&e.total_points)?Ue(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)}},su=["href"],ou={class:"fcom_user_display_name"},iu={key:1,class:"user_route"},nu=["href"],lu={class:"fcom_user_display_name"},au={class:"fcom_profile_pop_avatar"},ru={key:0,class:"fcom_prfile_tagline"},du={class:"fcom_level_name"},cu={style:{display:"block"},class:"fcoml_level_sub meta_line"},uu={class:"fcom_profile_pop_info"},_u={class:"pop_info_header"},mu={class:"header_name"},hu=["href"],fu={class:"fcom_user_display_name"},pu={class:"fcom_user_name"},gu={key:0,class:"header_actions"},yu={key:0,class:"fcom_profile_pop_bio"},vu=["title"],bu=["title"],ku={class:"pop_info_btns"},wu=["href"],Cu=["href"];function $u(e,t,s,u,o,i){const m=g("verified-sign"),f=g("UserBadge"),h=g("UserAvatar"),p=dt,k=g("follow-action"),b=g("SocialLinks"),$=ct,w=fe;return s.show_pop?(n(),r("span",iu,[a(w,{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:d(()=>[K(e.$slots,"default",{},()=>[l("a",{href:e.$getRouteLink("u/:username",{username:s.xprofile.username}),class:"user_route"},[l("p",lu,c(s.xprofile.display_name),1)],8,nu)])]),default:d(()=>[l("div",{class:"fcom_profile_pop",onMouseenter:t[0]||(t[0]=C=>s.virtualRef&&e.$emit("popover-mouseenter")),onMouseleave:t[1]||(t[1]=C=>s.virtualRef&&e.$emit("popover-mouseleave"))},[s.xprofile&&s.xprofile.username?(n(),y($,{key:0,gutter:20},{default:d(()=>[a(p,{sm:24,md:8},{default:d(()=>[l("div",au,[a(h,{xprofile:s.xprofile},null,8,["xprofile"]),i.userLevel?(n(),r("div",ru,[l("div",du,c(i.userLevel.title),1),l("div",cu,c(i.userLevel.tagline),1)])):_("",!0)])]),_:1}),a(p,{sm:24,md:16},{default:d(()=>{var C,v;return[l("div",uu,[l("div",_u,[l("div",mu,[l("a",{href:e.$getRouteLink("u/:username",{username:s.xprofile.username}),class:"user_route"},[l("p",fu,c(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,hu),l("span",pu," @"+c(s.xprofile.username),1)]),s.show_follow?(n(),r("div",gu,[a(k,{profile:s.xprofile},null,8,["profile"])])):_("",!0)]),(C=s.xprofile.meta)!=null&&C.short_description_rendered||s.xprofile.short_description_rendered?(n(),r("div",yu,c(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(),r("div",{key:1,title:s.xprofile.created_at,class:"meta_line"},c(e.$t("Joined: %s",e.humanDateDiff(s.xprofile.created_at))),9,vu)):_("",!0),s.xprofile.last_activity?(n(),r("div",{key:2,title:s.xprofile.last_activity,class:"meta_line"},c(e.$t("Last seen: %s",e.humanDateDiff(s.xprofile.last_activity))),9,bu)):_("",!0),l("div",ku,[l("a",{class:"el-button el-button--primary is-text is-has-bg",href:e.$getRouteLink("u/:username",{username:s.xprofile.username})},c(e.$t("View Profile")),9,wu),e.appVars.has_chat&&e.hasPermission("can_initiate_message")?(n(),r("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})},c(e.$t("Message")),9,Cu)):_("",!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(),r("a",{key:0,href:e.$getRouteLink("u/:username",{username:s.xprofile.username}),class:"user_route"},[K(e.$slots,"default",{},()=>[l("p",ou,c(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,su))}const Te=I(tu,[["render",$u]]),Su={name:"CommentReacts",components:{UserRouteLink:Te},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}))}}},Vu={style:{"margin-left":"5px"}},Mu={key:0},Lu={key:1},Tu={class:"fcom_user_lists"},Fu={key:2};function Iu(e,t,s,u,o,i){const m=Q,f=g("UserAvatar"),h=g("UserRouteLink"),p=Pe,k=fe;return n(),y(k,{persistent:!1,placement:"bottom",title:e.$t("Likes"),width:210,trigger:"click","popper-class":"fcom_menu_below_nav",onShow:i.getReactions},{reference:d(()=>[l("span",Vu,c(s.comment.reactions_count),1)]),default:d(()=>[o.loading?(n(),r("div",Mu,[a(m,{animated:!0,rows:1})])):o.reactions?(n(),r("div",Lu,[a(p,{"max-height":"300px"},{default:d(()=>[l("ul",Tu,[(n(!0),r(F,null,R(o.reactions,b=>(n(),r("li",null,[b.xprofile?(n(),r(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(),r("div",Fu,[l("p",null,c(e.$t("Failed to load the list")),1)]))]),_:1},8,["title","onShow"])}const Pu=I(Su,[["render",Iu]]),Eu={name:"NestedReplyBox",mixins:[It],components:{SingleComment:ho,FeedTextComposer:ht,CommentReactions:Pu,HeartIcon:Xe},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"),o.comment.status==="published"&&(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(/ |\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)}}},Au={key:0,class:"reply_box"},Uu=["aria-expanded"],Bu={class:"fcom_comments_react fcom_reaction_list"},Du={class:"child_comments"},Ru=["id"],xu={key:0,class:"reply_box"},Ou=["onClick","aria-expanded"],Hu={class:"fcom_comments_react fcom_reaction_list"},ju={key:0,class:"child_reply_wrap"},Nu={class:"feed_commenting"},zu={class:"person_avatar"},qu=["alt","src"];function Gu(e,t,s,u,o,i){var $;const m=g("HeartIcon"),f=j,h=g("CommentReactions"),p=g("single-comment"),k=O,b=g("feed-text-composer");return n(),r(F,null,[i.canComment?(n(),r("div",Au,[(($=s.feed.meta)==null?void 0:$.comments_disabled)!=="yes"?(n(),r("button",{key:0,type:"button",onClick:t[0]||(t[0]=w=>i.toggleCommentBox(s.comment)),class:"reply_btn","aria-expanded":o.composerOpen&&o.replyingToId===s.comment.id},c(e.$t("Reply")),9,Uu)):_("",!0),l("span",{class:D([{fcom_is_liked:s.comment.liked},"reply_btn"])},[l("div",Bu,[a(f,{role:"button",tabindex:"0","aria-label":e.$t("React"),"aria-pressed":!!s.comment.liked,class:D({user_reacted:s.comment.liked}),onClick:t[1]||(t[1]=w=>i.toggleLike(s.comment)),onKeydown:[t[2]||(t[2]=te(q(w=>i.toggleLike(s.comment),["prevent"]),["enter"])),t[3]||(t[3]=te(q(w=>i.toggleLike(s.comment),["prevent"]),["space"]))]},{default:d(()=>[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),K(e.$slots,"after_reply_box_text",{toggleOpen:()=>i.toggleCommentBox(s.comment,!1),open:o.open})])):_("",!0),!s.show_reacts_only||o.open?(n(),r(F,{key:1},[l("div",Du,[(n(!0),r(F,null,R(s.comment.comments,(w,C)=>(n(),r("div",{id:"comment_"+w.id,class:"each_comment"},[a(p,{onCopyLink:i.emitCopyLink,onDeleted:v=>i.handleCommentDelete(C),comment:w,show_report:!0},{after_comment_text:d(()=>{var v;return[i.canComment?(n(),r("div",xu,[((v=s.feed.meta)==null?void 0:v.comments_disabled)!=="yes"?(n(),r("button",{key:0,type:"button",onClick:S=>i.toggleCommentBox(w),class:"reply_btn","aria-expanded":o.composerOpen&&o.replyingToId===w.id},c(e.$t("Reply")),9,Ou)):_("",!0),l("span",{class:D([{fcom_is_liked:w.liked},"reply_btn"])},[l("div",Hu,[a(f,{role:"button",tabindex:"0","aria-label":e.$t("React"),"aria-pressed":!!w.liked,class:D({user_reacted:w.liked}),onClick:S=>i.toggleLike(w),onKeydown:[te(q(S=>i.toggleLike(w),["prevent"]),["enter"]),te(q(S=>i.toggleLike(w),["prevent"]),["space"])]},{default:d(()=>[a(m,{filled:w.liked},null,8,["filled"])]),_:2},1032,["aria-label","aria-pressed","class","onClick","onKeydown"]),parseInt(w.reactions_count)?(n(),y(h,{key:0,comment:w},null,8,["comment"])):_("",!0)])],2)])):_("",!0)]}),_:2},1032,["onCopyLink","onDeleted","comment"])],8,Ru))),256))]),o.composerOpen?(n(),r("div",ju,[l("div",Nu,[l("div",zu,[l("img",{alt:e.$t("Your Photo"),src:e.auth.avatar},null,8,qu)]),l("div",{onKeydown:t[5]||(t[5]=te((...w)=>i.maybeSave&&i.maybeSave(...w),["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:d(()=>[a(k,{loading:o.submitting,disabled:o.submitting,onClick:t[4]||(t[4]=w=>i.addComment()),class:"fcom_primary_button"},{default:d(()=>[M(c(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 Yu=I(Eu,[["render",Gu]]),Wu={name:"FeedComments",components:{SingleComment:ho,NestedReplyBox:Yu},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;hp-k):m==="latest"?h.sort((p,k)=>k-p):m==="popular"?h.sort((p,k)=>{var b,$;return(((b=u[k])==null?void 0:b.reactions_count)||0)-((($=u[p])==null?void 0:$.reactions_count)||0)}):m==="most_replied"&&h.sort((p,k)=>{var b,$;return(((b=t[k])==null?void 0:b.length)||0)-((($=t[p])==null?void 0:$.length)||0)}),this._sortedTopLevelIds=h,this._lastSortBy=m}let f;if(this._sortedTopLevelIds){const h=new Set(s),p=new Set(this._sortedTopLevelIds);f=this._sortedTopLevelIds.filter(k=>h.has(k)&&u[k]).map(k=>u[k]);for(let k=s.length-1;k>=0;k--)p.has(s[k])||f.unshift(u[s[k]])}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()}},Ku={key:0,class:"feed_comments"},Zu=["id"],Qu={key:1,class:"feed_comments"},Ju=["id"],Xu=["onClick","aria-expanded"];function e_(e,t,s,u,o,i){const m=Q,f=g("nested-reply-box"),h=g("single-comment");return s.show_all?(n(),r("div",Ku,[o.loading?(n(),y(m,{key:0,row:5,class:"feed_comments_skeleton"})):(n(),r(F,{key:1},[K(e.$slots,"before_comments_start"),(n(!0),r(F,null,R(i.displayComments,(p,k)=>(n(),r("div",{class:"each_comment",key:p.id,id:"comment_"+p.id},[a(h,{comment:p,space_id:s.feed.space_id,show_report:!0,onCopyLink:i.copyCommentLink,onReload:i.fetchComments,onDeleted:b=>i.handleCommentDelete(p)},ye({_:2},[p.parent_id?void 0:{name:"after_comment_text",fn:d(()=>[a(f,{feed:s.feed,comment:p,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,Zu))),128))],64))])):i.lastComment?(n(),r("div",Qu,[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]=p=>i.handleCommentDelete(i.lastComment))},ye({_:2},[i.lastComment.parent_id?void 0:{name:"after_comment_text",fn:d(()=>[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:d(({toggleOpen:p,open:k})=>[i.lastComment.comments&&i.lastComment.comments.length?(n(),r("button",{key:0,type:"button",onClick:b=>p(),class:"reply_btn last_comment_reply_txt","aria-expanded":k},c(e.$_n("%d reply","%d replies",i.lastComment.comments.length)),9,Xu)):_("",!0)]),_:1},8,["defaultMentions","onCopyLink","checkPermission","feed","comment","is_modal"])]),key:"0"}]),1032,["comment","space_id","onCopyLink"])],8,Ju),s.feed.comments_count>1?(n(),r("div",{key:0,onClick:t[1]||(t[1]=p=>i.maybeShowAllComments()),class:"each_comment show_all_comments"},c(e.$t("View more comments")),1)):_("",!0)])):_("",!0)}const po=I(Wu,[["render",e_]]);const t_={name:"ReactedUsers",components:{UserRouteLink:Te},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}))}}},s_=["title"],o_={key:0,class:"reactions_avatars"},i_=["alt","src"],n_={key:0},l_={key:1},a_={class:"fcom_user_lists"},r_={key:2};function d_(e,t,s,u,o,i){const m=Q,f=g("UserAvatar"),h=g("UserRouteLink"),p=Pe,k=fe;return n(),y(k,{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:d(()=>[l("div",{title:e.$t("Click to view"),class:"fcom_reactions"},[i.reactedProfiles&&i.reactedProfiles.length?(n(),r("div",o_,[(n(!0),r(F,null,R(i.reactedProfiles,b=>(n(),r("span",{key:b.id,class:"fcom_reaction_avatar fcom_avatar_is_rounded fcom_user_avatar"},[b!=null&&b.avatar?(n(),r("img",{key:0,alt:e.$t("Reacted Users"),src:b.avatar},null,8,i_)):_("",!0)]))),128))])):_("",!0),l("span",null,c(e.$_n("%s like","%s likes",s.feed.reactions_count)),1)],8,s_)]),default:d(()=>[o.loading?(n(),r("div",n_,[a(m,{animated:!0,rows:3})])):o.reactions?(n(),r("div",l_,[a(p,{"max-height":"300px"},{default:d(()=>[l("ul",a_,[(n(!0),r(F,null,R(o.reactions,b=>(n(),r("li",null,[b.xprofile?(n(),r(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(),r("div",r_,[l("p",null,c(e.$t("Failed to load the list")),1)]))]),_:1},8,["title","onShow"])}const c_=I(t_,[["render",d_]]),u_={name:"FeedFooter",mixins:[It],components:{ReactedUsers:c_,FeedComments:po,FeedTextComposer:ht,ChatIcon:Je,HeartIcon:Xe},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),e.comment.status==="published"&&(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=Xi(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)}},__={ref:"feed_footer",class:"feed_footer"},m_={class:"fcom_feed_footer_actions"},h_=["aria-label","aria-pressed"],f_={class:"fcom_sr_only"},p_={class:"fcom_sr_only"},g_={class:"fcom_feed_footer_meta"},y_={key:0},v_={key:0,class:"fcom_reactions_count feed_reaction_meta"},b_={class:"feed_comment_count"},k_={key:2,class:"feed_reaction_meta"},w_={key:0,ref:"fcom_comment_sorting",class:"fcom_comment_sorting"},C_=["id"],$_={key:0,style:{padding:"0",margin:"0","text-align":"center"}},S_={key:1,class:"feed_commenting"},V_={class:"person_avatar"},M_=["src"],L_={key:2,class:""},T_={style:{padding:"0",margin:"0","text-align":"center"}},F_={key:0,style:{margin:"10px 0"}},I_=["href"];function P_(e,t,s,u,o,i){var v,S,T,V;const m=g("HeartIcon"),f=j,h=g("ChatIcon"),p=g("ReactedUsers"),k=le,b=ae,$=g("feed-comments"),w=O,C=g("feed-text-composer");return n(),r(F,null,[l("div",__,[l("div",m_,[l("ul",null,[l("li",{class:D(["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]=P=>i.toggleReact()),onKeydown:[t[1]||(t[1]=te(q(P=>i.toggleReact(),["prevent"]),["enter"])),t[2]||(t[2]=te(q(P=>i.toggleReact(),["prevent"]),["space"]))]},[a(f,{class:D({user_reacted:s.feed.has_user_react})},{default:d(()=>[a(m,{filled:s.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",null,[l("span",f_,c(e.$t("React")),1)])],42,h_),((v=s.feed.meta)==null?void 0:v.comments_disabled)!=="yes"?(n(),r("li",{key:0,class:"fcom_comment_btn_wrap",role:"button",tabindex:"0",onClick:t[3]||(t[3]=P=>i.showCommentForm()),onKeydown:[t[4]||(t[4]=te(q(P=>i.showCommentForm(),["prevent"]),["enter"])),t[5]||(t[5]=te(q(P=>i.showCommentForm(),["prevent"]),["space"]))]},[a(f,null,{default:d(()=>[a(h)]),_:1}),l("span",null,[l("span",p_,c(e.$t("Comment")),1)])],32)):_("",!0)])]),l("div",g_,[s.feed.reactions_count||s.feed.comments_count||((S=s.feed.meta)==null?void 0:S.comments_disabled)==="yes"?(n(),r("ul",y_,[s.feed.reactions_count?(n(),r("li",v_,[a(p,{feed:s.feed},null,8,["feed"])])):_("",!0),s.feed.comments_count>0?(n(),r("li",{key:1,onClick:t[6]||(t[6]=(...P)=>i.maybeShowFeedModal&&i.maybeShowFeedModal(...P)),class:"feed_reaction_meta"},[l("div",b_,c(e.$_n("%d comment","%d comments",s.feed.comments_count)),1)])):((T=s.feed.meta)==null?void 0:T.comments_disabled)==="yes"?(n(),r("li",k_,c(e.$t("comments disabled")),1)):_("",!0)])):_("",!0)])],512),a($,{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:d(()=>[s.feed.comments_count>=2?(n(),r("div",w_,[a(b,{"aria-label":e.$t("Sort comments by"),onChange:t[7]||(t[7]=P=>i.changeCommentsSortBy()),modelValue:o.sortBy,"onUpdate:modelValue":t[8]||(t[8]=P=>o.sortBy=P),class:"fcom_off_color fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Sort by")},{default:d(()=>[a(k,{value:"oldest",label:e.$t("Earliest")},null,8,["label"]),a(k,{value:"latest",label:e.$t("Latest")},null,8,["label"]),a(k,{value:"popular",label:e.$t("Popular")},null,8,["label"]),a(k,{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(),r("div",{key:0,id:"feed_comment_form_"+s.feed.id,class:"feed_comment feed_commentbox_main"},[((V=s.feed.meta)==null?void 0:V.comments_disabled)==="yes"?(n(),r(F,{key:0},[s.feed.comments_count?(n(),r("p",$_,c(e.$t("Comments are disabled for this post.")),1)):_("",!0)],64)):e.hasCommentPermission(s.feed)?(n(),r("div",S_,[l("div",V_,[l("img",{alt:"",src:e.auth.photo},null,8,M_)]),o.showCommentBox?(n(),r("div",{key:0,onKeydown:t[10]||(t[10]=te((...P)=>i.maybeSave&&i.maybeSave(...P),["enter"])),class:"feed_comment_input"},[a(C,{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:d(()=>[a(w,{loading:o.saving,disabled:o.saving,class:"fcom_primary_button",onClick:t[9]||(t[9]=P=>i.postComment())},{default:d(()=>[M(c(e.$t("Post Comment")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["is_modal","mentionQuery","autofocus_changed","defaultMentions","autofocus","disabled","placeholder","content"])],32)):_("",!0)])):(n(),r("div",L_,[l("p",T_,[M(c(e.$t("Please join the Space to post a comment."))+" ",1),e.appVars.auth.user_id?(n(),r("div",F_,[a(w,{class:"fcom_primary_button",onClick:t[11]||(t[11]=()=>{e.$emit("joinSpace")})},{default:d(()=>[M(c(e.$t("Join Space")),1)]),_:1})])):(n(),r("a",{key:1,href:e.getCurrentAuthUrl()},c(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,I_))])]))],8,C_)):_("",!0)],64)}const E_=I(u_,[["render",P_]]),A_={name:"SpaceIcon",props:["space_profile"]},U_=["alt","src"],B_={key:1,class:"fcom_emoji"},D_={key:2,class:"fcom_shape"},R_={key:3,class:"fcom_no_avatar"};function x_(e,t,s,u,o,i){var f,h,p,k;const m=j;return s.space_profile.logo?(n(),r("img",{key:0,alt:e.$t("Space Logo"),src:s.space_profile.logo},null,8,U_)):(f=s.space_profile.settings)!=null&&f.emoji?(n(),r("span",B_,c((h=s.space_profile.settings)==null?void 0:h.emoji),1)):(p=s.space_profile.settings)!=null&&p.shape_svg?(n(),r("span",D_,[a(m,{innerHTML:(k=s.space_profile.settings)==null?void 0:k.shape_svg},null,8,["innerHTML"])])):(n(),r("span",R_))}const ze=I(A_,[["render",x_]]);const O_={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)}}},H_=["value","maxlength","placeholder"];function j_(e,t,s,u,o,i){return n(),r("textarea",{value:s.modelValue,onInput:t[0]||(t[0]=(...m)=>i.onInput&&i.onInput(...m)),onKeydown:t[1]||(t[1]=te(q(m=>e.$emit("enter"),["prevent"]),["enter"])),ref:"textarea",maxlength:s.maxlength,class:"fcom_status_title_input",rows:"1",placeholder:s.placeholder},null,40,H_)}const N_=I(O_,[["render",j_]]),z_={name:"EyeIcon"},q_={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function G_(e,t,s,u,o,i){return n(),r("svg",q_,[...t[0]||(t[0]=[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),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)])])}const Y_=I(z_,[["render",G_]]),W_={name:"CalendarIcon"},K_={width:"14",height:"16",viewBox:"0 0 14 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Z_(e,t,s,u,o,i){return n(),r("svg",K_,[...t[0]||(t[0]=[Le('',5)])])}const go=I(W_,[["render",Z_]]);const Q_={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:ht,SingleLineTextarea:N_,EyeIcon:Y_,CalendarIcon:go},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:{...ei(He,["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=>eu.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:{...zs(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(p=>{let k=p.parent_id==f.id&&p.permissions&&p.permissions.can_create_post;return k&&u.push(p.slug),k});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)}},J_={class:"person_avatar"},X_=["alt","src"],em={class:"create_header_content"},tm={key:0,class:"fcom_create_status_box_header"},sm={class:"user_infos"},om={class:"feed_user_name"},im={class:"feed_meta_info"},nm={key:1,class:"feed_timestamp"},lm={class:"create_header_action"},am={key:0,ref:"fcom_topics_input",class:"fcom_topics_input"},rm={style:{margin:"0",display:"block",width:"100%",padding:"5px 0","font-weight":"500"}},dm={key:0,class:"fcom_meta_text"},cm={class:"fcom_post_actions"},um={key:0,class:"fcom_post_space_name"},_m={class:"target_label"},mm={ref:"fcom_posting_space",style:{"margin-right":"10px"}},hm={key:0,class:"fcom_space_title"},fm={key:1},pm={class:"fcom_empty_spaces_dropdown"},gm={key:0,class:"fcom_composer_admin_actions"},ym={key:0},vm={class:"dialog_header"},bm={class:"dialog_left schedule_header_left"},km={class:"dialog_body"},wm={class:"fcom_input_help"},Cm={class:"dialog_footer"};function $m(e,t,s,u,o,i){const m=g("EditPen"),f=j,h=g("CalendarIcon"),p=O,k=g("EyeIcon"),b=g("Close"),$=g("SingleLineTextarea"),w=le,C=ae,v=g("SpaceIcon"),S=Zt,T=ve,V=g("feed-text-composer"),P=Ye,L=pe,x=Us,A=ge,U=ke;return i.canPost?(n(),r("div",{key:0,class:D([{state_active:i.isStateActive},"create_status_holder"])},[l("div",{class:D(["create_header",{state_active:i.isStateActive}])},[l("div",J_,[l("img",{alt:s.author.name||e.$t("Your Photo"),src:s.author.avatar||e.auth.avatar},null,8,X_)]),l("div",em,[i.isStateActive?_("",!0):(n(),r("div",{key:0,onClick:t[0]||(t[0]=(...B)=>i.makeActive&&i.makeActive(...B)),class:"form_placeholder"},c(i.currentPlaceHolder),1)),l("div",{class:D([{fcom_editor_with_title:o.hasPostTitle,"is-active":i.isStateActive},"fcom_create_status_box"])},[i.isStateActive?(n(),r("div",tm,[l("div",sm,[l("div",om,c(i.getPostTitle),1),l("div",im,[!s.editing_feed.id&&i.showScheduleInfo?(n(),r("div",{key:0,onClick:t[1]||(t[1]=(...B)=>i.openScheduleModal&&i.openScheduleModal(...B)),class:"feed_scheduled_info"},[l("span",null,c(i.getScheduleLabel),1),a(f,null,{default:d(()=>[a(m)]),_:1})])):(n(),r("span",nm,c(s.editing_feed.id?e.humanDateDiff(s.editing_feed.created_at):e.dayjs().format(e.siteDateTimeFormat)),1))])]),l("div",lm,[i.showScheduleIcon?(n(),y(p,{key:0,"aria-label":e.$t("Schedule post"),onClick:i.openScheduleModal,text:""},{default:d(()=>[a(f,null,{default:d(()=>[a(h)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0),a(p,{"aria-label":e.$t("Preview"),onClick:i.previewPost,text:""},{default:d(()=>[a(f,null,{default:d(()=>[a(k)]),_:1})]),_:1},8,["aria-label","onClick"]),i.isEditing?_("",!0):(n(),y(p,{key:1,"aria-label":e.$t("Close"),class:"close_btn",onClick:i.cancelPost,text:""},{default:d(()=>[a(f,null,{default:d(()=>[a(b)]),_:1})]),_:1},8,["aria-label","onClick"]))])])):_("",!0),o.editorReady?(n(),y(V,{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:d(()=>[o.hasPostTitle?(n(),y($,{key:0,maxlength:120,autofocus:!0,isActive:i.isStateActive,modelValue:o.feed.title,"onUpdate:modelValue":t[2]||(t[2]=B=>o.feed.title=B),onEnter:t[3]||(t[3]=B=>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:d(()=>[K(e.$slots,"before_footer")]),after_input:d(()=>[e.has_pro&&i.currentTopics.length?(n(),r("div",am,[a(C,{"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]=B=>o.feed.topic_ids=B),multiple:e.appVars.topicsConfig.max_topics_per_post>1,placeholder:i.getPlaceholder},{default:d(()=>[(n(!0),r(F,null,R(i.currentTopics,B=>(n(),y(w,{key:B.slug,label:B.title,value:B.id},{default:d(()=>[l("span",rm,c(B.title),1),B.description?(n(),r("span",dm,c(B.description),1)):_("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["multiple-limit","modelValue","multiple","placeholder"])],512)):_("",!0)]),after_composer_footer:d(()=>[e.hasFeature("mention_mail")&&i.isCurrentSpaceAdmin&&o.feed.send_announcement_email?(n(),r("div",gm,[a(T,{disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:o.feed.send_announcement_email,"onUpdate:modelValue":t[8]||(t[8]=B=>o.feed.send_announcement_email=B),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Send announcement email to space members"))+" ",1),e.has_pro?_("",!0):(n(),r("span",ym,"("+c(e.$t("Require Pro"))+")",1))]),_:1},8,["disabled","modelValue"])])):_("",!0)]),default:d(()=>[l("div",cm,[s.space&&i.isStateActive?(n(),r("div",um,[l("span",null,"#"+c(s.space),1)])):_("",!0),!s.space&&!s.disableSpace?(n(),r(F,{key:1},[l("span",_m,c(e.$t("Posting in:")),1),l("span",mm,[a(C,{modelValue:o.feed.space,"onUpdate:modelValue":t[5]||(t[5]=B=>o.feed.space=B),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]=B=>i.feedSpaceChanged())},{empty:d(()=>[l("p",pm,c(Object.keys(i.allSpaces).length?e.$t("No spaces to post in"):e.$t("Join a space to post")),1)]),default:d(()=>[(n(!0),r(F,null,R(o.postableSpaces,B=>(n(),y(S,{key:B.label,label:B.label},{default:d(()=>[(n(!0),r(F,null,R(B.spaces,N=>(n(),y(w,{key:N.slug,label:N.title,value:N.slug},{default:d(()=>[N.id?(n(),r("span",hm,[a(v,{space_profile:N},null,8,["space_profile"]),l("span",null,c(e.getExcerpt(N.title,30)),1)])):(n(),r("span",fm,c(e.getExcerpt(N.title,30)),1))]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","placeholder"])],512)],64)):_("",!0),K(e.$slots,"before_submit_btn"),a(p,{onClick:t[7]||(t[7]=B=>i.post()),disabled:o.posting||i.isEditing&&s.saving,loading:i.isEditing?s.saving:o.posting,class:D(["fcom_primary_button",{fcom_update_button:i.isEditing}])},{default:d(()=>[M(c(i.getButtonLabel),1)]),_:1},8,["disabled","loading","class"])])]),_:3},8,["placeholder","config","autofocus","mentionQuery","disabled","autofocus_changed","is_editing","content"])):_("",!0),K(e.$slots,"after_composer")],2)])],2),a(U,{modelValue:o.scheduleModalVisible,"onUpdate:modelValue":t[12]||(t[12]=B=>o.scheduleModalVisible=B),width:e.modalWidth,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1},{header:d(()=>[l("div",vm,[l("div",bm,[l("h4",null,c(e.$t("Schedule Post")),1),l("p",null,c(e.$t("Choose a date and time in the future when you want your post to be published")),1)])])]),footer:d(()=>[l("div",Cm,[a(p,{class:"fcom_secondary_button",onClick:i.cancelSchedule},{default:d(()=>[M(c(e.$t("Remove Schedule")),1)]),_:1},8,["onClick"]),a(p,{class:"fcom_primary_button",disabled:i.isScheduleDisabled,onClick:i.schedulePost},{default:d(()=>[M(c(e.$t("Select Schedule")),1)]),_:1},8,["disabled","onClick"])])]),default:d(()=>[l("div",km,[a(A,{"label-position":"top",class:"fcom_schedule_form"},{default:d(()=>[a(L,{label:e.$t("Date")},{default:d(()=>[a(P,{modelValue:o.scheduleForm.date,"onUpdate:modelValue":t[10]||(t[10]=B=>o.scheduleForm.date=B),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(L,{label:e.$t("Time")},{default:d(()=>[a(x,{modelValue:o.scheduleForm.time,"onUpdate:modelValue":t[11]||(t[11]=B=>o.scheduleForm.time=B),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(L,null,{default:d(()=>[l("p",wm,c(e.$t("The date and time is based on your site's Timezone")),1)]),_:1})])]),_:1},8,["modelValue","width"])],2)):_("",!0)}const Et=I(Q_,[["render",$m]]),Sm={name:"EditFeed",components:{SpaceIcon:ze,CreateStatusForm:Et},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()}},Vm={class:"fcom_feed_edit"},Mm={class:"fcom_feed_edit_dialog_header"},Lm={key:0,class:"fcom_feed_edit_dialog_body"},Tm={key:0},Fm={key:0,style:{"margin-top":"5px"}},Im={class:"fcom_space_title"};function Pm(e,t,s,u,o,i){const m=g("Close"),f=j,h=ve,p=le,k=g("SpaceIcon"),b=ae,$=Ee,w=g("create-status-form"),C=Q,v=ke,S=se("loading");return n(),r("div",Vm,[a(v,{class:"fcom_feed_edit_dialog",modelValue:o.localDialogVisible,"onUpdate:modelValue":t[3]||(t[3]=T=>o.localDialogVisible=T),width:e.dialogWidth,"append-to-body":!0,overflow:"","before-close":()=>{},"show-close":!1},{default:d(()=>{var T,V;return[Y((n(),r("div",null,[l("div",Mm,[l("span",null,c(e.$t("Edit Feed")),1),a(f,{onClick:i.handleClose},{default:d(()=>[a(m)]),_:1},8,["onClick"])]),o.feed.id?(n(),r("div",Lm,[!(s.hide_create_form&&e.auth.user_id)||e.canEditFeed(o.feed)?(n(),y(w,{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:(V=(T=o.feed)==null?void 0:T.space)==null?void 0:V.slug},{after_composer:d(()=>[i.canMovePost?(n(),r("div",Tm,[a(h,{modelValue:o.changeSpace,"onUpdate:modelValue":t[0]||(t[0]=P=>o.changeSpace=P),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Move to a different space")),1)]),_:1},8,["modelValue"]),o.changeSpace?(n(),r("div",Fm,[a(b,{modelValue:o.newSpaceId,"onUpdate:modelValue":t[1]||(t[1]=P=>o.newSpaceId=P),placeholder:e.$t("Select destination"),style:{width:"100%"}},{default:d(()=>[a(p,{value:"profile",label:i.profileOptionLabel,disabled:!o.feed.space_id},{default:d(()=>[l("span",null,c(i.profileOptionLabel),1)]),_:1},8,["label","disabled"]),(n(!0),r(F,null,R(e.appVars.auth.spaces,P=>(n(),y(p,{disabled:o.feed.space_id==P.id,key:P.id,label:P.title,value:P.id},{default:d(()=>[l("span",Im,[a(k,{space_profile:P},null,8,["space_profile"]),l("span",null,c(e.getExcerpt(P.title,30)),1)])]),_:2},1032,["disabled","label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):_("",!0)])):_("",!0)]),before_submit_btn:d(()=>[e.has_pro&&e.isCommunityModerator()&&["published","unlisted"].includes(o.feed.status)?(n(),y($,{key:0,content:e.$t("Hidden from all feeds and listings. Only reachable by its direct link."),placement:"top"},{default:d(()=>[a(h,{modelValue:o.makeUnlisted,"onUpdate:modelValue":t[2]||(t[2]=P=>o.makeUnlisted=P),class:"fcom_checkbox"},{default:d(()=>[M(c(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(C,{key:1,rows:5,animated:!0}))])),[[S,o.loading]])]}),_:1},8,["modelValue","width"])])}const rs=I(Sm,[["render",Pm]]),Em={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=Ue(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=Ue(this.xprofile.total_points),t=Ue(e.max_points+1);return e.level!==t.level},getOutlineStyle(){if(!this.withCompletion)return{};const e=Ue(this.xprofile.total_points),t=Ue(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"}}},Am=["src"],Um={key:1,class:"fcom_no_image"},Bm=["aria-label"];function Dm(e,t,s,u,o,i){return n(),r("div",{class:D([{fcom_avatar_is_rounded:s.is_rounded,is_member_online:s.is_online},"fcom_user_avatar"])},[l("span",{style:ue(i.getOutlineStyle),class:D({fcom_compilation_avatar:i.withCompletion})},[s.xprofile?(n(),r("img",{key:0,onError:t[0]||(t[0]=(...m)=>i.setAltImg&&i.setAltImg(...m)),src:s.xprofile.avatar,alt:""},null,40,Am)):(n(),r("span",Um))],6),i.level||s.is_online?(n(),r("div",{key:0,role:"region","aria-label":e.$t("User Level"),class:"fcom_user_level_mark"},[l("span",null,c(i.level),1)],8,Bm)):_("",!0)],2)}const ds=I(Em,[["render",Dm]]),Rm={name:"SurveyVoters",props:["feed","option","options","totalCount"],components:{UserRouteLink:Te,UserAvatar:ds},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()}},xm={class:"dialog_header"},Om={class:"fcom_filter_menu"},Hm={class:"fcom_filter_menu_ul"},jm=["onClick"],Nm={key:1},zm={class:"feed_meta_info survey_voters_meta"},qm={class:"meta_line"},Gm={class:"meta_line"},Ym={class:"voters_list"},Wm={class:"voter_avatar"},Km={class:"voter_info"},Zm=["title"],Qm={key:2,class:"not_found"};function Jm(e,t,s,u,o,i){const m=Q,f=g("UserAvatar"),h=g("UserRouteLink"),p=Pe,k=ke;return n(),y(k,{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:d(({close:b})=>[l("div",xm,[l("div",Om,[l("ul",Hm,[(n(!0),r(F,null,R(s.options,$=>(n(),r("li",{key:$.slug},[l("a",{onClick:q(w=>i.switchOption($.slug),["prevent"]),class:D({"router-link-exact-active":s.option.slug==$.slug}),href:"#"},c($.label),11,jm)]))),128))])])])]),default:d(()=>[o.loading?(n(),y(m,{key:0,animated:"",rows:4})):o.voters.length?(n(),r("div",Nm,[l("div",zm,[l("span",qm,c(i.getVotePercentage),1),l("span",Gm,c(e.$_n("%s Vote","%s Votes",s.option.vote_counts)),1)]),a(p,{"max-height":"800px"},{default:d(()=>[l("div",Ym,[(n(!0),r(F,null,R(o.voters,b=>(n(),r("div",{key:b.id,class:"voter_item"},[b.xprofile?(n(),r(F,{key:0},[l("div",Wm,[a(f,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"])]),l("div",Km,[a(h,{show_badge:!0,xprofile:b.xprofile},null,8,["xprofile"]),b.xprofile.created_at?(n(),r("div",{key:0,title:b.xprofile.created_at,class:"voter_time"},c(e.$t("Joined %s",e.humanDateDiff(b.xprofile.created_at))),9,Zm)):_("",!0)])],64)):_("",!0)]))),128))])]),_:1})])):(n(),r("div",Qm,[l("p",null,c(e.$t("No voters yet")),1)]))]),_:1},8,["modelValue","width","onClose"])}const Xm=I(Rm,[["render",Jm]]),eh={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:Xm},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()}},th={class:"fcom_app_options"},sh=["onClick"],oh={class:"fcom_app_text"},ih={class:"fcom_app_input_wrap"},nh={key:0,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 6"},lh={key:1,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8 8"},ah=["onClick"],rh={key:0},dh={class:"feed_meta_info"},ch={key:0,class:"meta_line"},uh=["title"],_h=["title"];function mh(e,t,s,u,o,i){const m=g("ArrowRight"),f=j,h=g("SurveyVoters");return n(),r(F,null,[l("div",{class:D(["fcom_app_render",{"no-border":i.shouldHideBorder}])},[l("div",th,[(n(!0),r(F,null,R(o.formattedOptions,(p,k)=>(n(),r("div",{key:p.slug,onClick:b=>i.toggleVote(k),class:D([p.voted?"fcom_is_voted":"","fcom_app_option"])},[l("div",oh,[l("span",ih,[l("span",{class:D("fcom_input_"+o.inputType)},[o.inputType=="single_choice"?(n(),r("svg",nh,[...t[1]||(t[1]=[l("circle",{cx:"3",cy:"3",r:"2.5",fill:"currentColor"},null,-1)])])):(n(),r("svg",lh,[...t[2]||(t[2]=[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)])]))],2)]),l("span",null,c(p.label),1)]),l("div",{class:"fcom_app_counts",onClick:b=>i.showVoters(p)},[M(c(p.vote_counts?Math.floor(p.vote_counts/o.totalCount*100)+"%":"")+" ",1),p.vote_counts?(n(),r("span",rh,"("+c(p.vote_counts)+")",1)):_("",!0),p.vote_counts?(n(),y(f,{key:1,class:"fcom_arrow_icon"},{default:d(()=>[a(m)]),_:1})):_("",!0)],8,ah),o.totalCount?(n(),r("span",{key:0,style:ue(i.getVoteStyle(p.vote_counts)),class:"fc_app_shadow"},null,4)):_("",!0)],10,sh))),128))]),l("div",dh,[o.totalCount?(n(),r("span",ch,c(e.$_n("%d vote","%d votes",o.totalCount)),1)):_("",!0),o.endingDate?(n(),r(F,{key:1},[i.isEnded?(n(),r("span",{key:0,title:e.$t("Ended at: %s",o.endingDate),class:"meta_line"},c(i.endedDateLabel),9,uh)):(n(),r("span",{key:1,title:e.$t("Will end at: %s",o.endingDate),class:"meta_line"},c(i.endingDateLabel),9,_h))],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]=p=>o.showVotersDialog=!1)},null,8,["feed","option","options","totalCount","onUpdateOption"])):_("",!0)],64)}const yo=I(eh,[["render",mh]]),hh={name:"BookmarkIcon",props:["is_active"]},fh={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"},ph={key:1,width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function gh(e,t,s,u,o,i){return s.is_active?(n(),r("svg",fh,[...t[0]||(t[0]=[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)])])):(n(),r("svg",ph,[...t[1]||(t[1]=[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)])]))}const vo=I(hh,[["render",gh]]);const yh={name:"RenderChildPost",components:{ImageCarousel:Tt,SurveyRenderer:yo,DocumentLists:tt,UserRouteLink:Te,MediaPreview:xe,FeedMdContent:ft},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{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()}},vh=["id"],bh={key:0,class:"fcom_top_media"},kh={class:"fcom_feed_header_wrap"},wh={class:"feed_header"},Ch={key:0,class:"feed_user"},$h={class:"feed_user_name"},Sh={class:"feed_meta_info"},Vh={key:0,class:"meta_line"},Mh=["title","href"],Lh={key:1,class:"feed_timestamp"},Th={key:0,class:"feed_title"},Fh={class:"feed_title_heading"},Ih={key:1,class:"expand-button"};function Ph(e,t,s,u,o,i){var C,v,S,T,V,P,L,x,A,U,B;const m=g("media-preview"),f=g("UserAvatar"),h=g("UserRouteLink"),p=g("FeedMdContent"),k=O,b=g("DocumentLists"),$=g("SurveyRenderer"),w=g("ImageCarousel");return o.feed?(n(),r("div",{key:0,onClick:t[0]||(t[0]=(...N)=>i.handleFeedClick&&i.handleFeedClick(...N)),class:"fcom_child_feed"},[l("div",{id:"feed_id_"+o.feed.id,class:D([i.feedClasses,"feed"])},[i.hasTopMedia?(n(),r("div",bh,[o.feed.meta&&o.feed.meta.media_preview?(n(),y(m,{key:0,feed:o.feed},null,8,["feed"])):_("",!0)])):_("",!0),l("div",kh,[l("div",wh,[o.feed.xprofile?(n(),r("div",Ch,[a(f,{with_level:!1,xprofile:o.feed.xprofile},null,8,["xprofile"]),l("div",null,[l("div",$h,[a(h,{show_badge:!0,xprofile:o.feed.xprofile,show_follow:!0},null,8,["xprofile"])]),l("div",Sh,[o.feed.content_type=="survey"&&((T=(S=(v=(C=o.feed)==null?void 0:C.meta)==null?void 0:v.survey_config)==null?void 0:S.options)!=null&&T.length)?(n(),r("span",Vh,c(e.$t("created a poll")),1)):_("",!0),l("a",{title:o.feed.created_at,href:o.feed.permalink,class:"feed_timestamp"},c(e.humanDateDiff(o.feed.created_at)),9,Mh),!o.in_space&&o.feed.space?(n(),r("span",Lh,c(e.$t("Posted in %s",e.getExcerpt(o.feed.space.title,30))),1)):_("",!0)])])])):_("",!0)])]),l("div",{ref:"feed_body",class:D([{feed_is_overflow_content:o.hasOverflowContent},"feed_body"])},[o.feed.title?(n(),r("div",Th,[l("h2",Fh,c(o.feed.title),1)])):_("",!0),a(p,{class_name:"feed_texts",content:o.feed.message_rendered},null,8,["content"]),o.hasOverflowContent?(n(),r("div",Ih,[a(k,{class:"btn_expand"},{default:d(()=>[M(c(e.$t("Show More")),1)]),_:1})])):_("",!0)],2),o.feed.content_type=="document"?(n(),y(b,{key:1,document_lists:((P=(V=o.feed)==null?void 0:V.meta)==null?void 0:P.document_lists)||[]},null,8,["document_lists"])):(n(),r(F,{key:2},[o.feed.content_type=="survey"&&((U=(A=(x=(L=o.feed)==null?void 0:L.meta)==null?void 0:x.survey_config)==null?void 0:A.options)!=null&&U.length)?(n(),y($,{key:0,feed:o.feed,isChildFeed:!0},null,8,["feed"])):_("",!0),o.feed.meta?(n(),r(F,{key:1},[o.feed.meta.media_items?(n(),y(w,{key:0,feed:o.feed},null,8,["feed"])):!i.hasTopMedia&&(o.feed.meta.media_preview||(B=o.feed.meta.audio_medias)!=null&&B.length)?(n(),y(m,{key:1,feed:o.feed},null,8,["feed"])):_("",!0)],64)):_("",!0)],64))],10,vh)])):_("",!0)}const Eh=I(yh,[["render",Ph]]),Ah={name:"CustomAppMeta",components:{RenderChildPost:Eh},props:{feed:{type:Object,required:!0}}},Uh={ref:"fcom_custom_app"},Bh={key:0},Dh=["innerHTML"];function Rh(e,t,s,u,o,i){const m=g("RenderChildPost");return n(),r("div",Uh,[s.feed.meta.custom_app_preview.app_name=="child_post"&&s.feed.meta.custom_app_preview.feed_id?(n(),r("div",Bh,[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(),r("div",{key:1,innerHTML:s.feed.meta.custom_app_preview.custom_html},null,8,Dh)):_("",!0)],512)}const xh=I(Ah,[["render",Rh]]),Oh={name:"FeedAction",components:{EditFeed:rs},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(()=>{}))}}},Hh={class:"actions_items"},jh={key:0},Nh={key:1},zh={key:0},qh={key:1},Gh={key:0},Yh={key:1},Wh={key:0},Kh={key:1};function Zh(e,t,s,u,o,i){var b,$;const m=g("MoreFilled"),f=j,h=O,p=fe,k=g("EditFeed");return n(),r(F,null,[a(p,{persistent:!1,ref:"popover",placement:"bottom",width:200,trigger:"click",teleported:!1,"popper-class":"fcom_menu_below_nav"},{reference:d(()=>[a(h,{"aria-label":e.$t("View Post actions"),class:"fcom_dot_menu",size:"small",text:""},{default:d(()=>[a(f,null,{default:d(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])]),default:d(()=>{var w,C;return[l("ul",Hh,[K(e.$slots,"before_feed_actions_pop"),l("li",{onClick:t[0]||(t[0]=v=>i.copyFeedLink())},c(e.$t("Copy Link")),1),i.showReportOption?(n(),r("li",{key:0,onClick:t[1]||(t[1]=v=>i.reportPost())},c(e.$t("Report Post")),1)):_("",!0),e.canEditFeed(s.feed)?(n(),r(F,{key:1},[l("li",{onClick:t[2]||(t[2]=v=>i.editItem())},c(e.$t("Edit")),1),e.has_pro&&e.isCommunityModerator()&&["published","unlisted"].includes(s.feed.status)?(n(),r("li",{key:0,onClick:t[3]||(t[3]=v=>i.toggleUnlist())},[s.feed.status=="unlisted"?(n(),r("span",jh,c(e.$t("List Post")),1)):(n(),r("span",Nh,c(e.$t("Unlist Post")),1))])):_("",!0),s.feed.space&&e.hasSpaceAdminAccess(s.feed.space)?(n(),r(F,{key:1},[l("li",{onClick:t[4]||(t[4]=v=>i.toggleSticky())},[s.feed.is_sticky?(n(),r("span",zh,c(e.$t("Unpin from Top")),1)):(n(),r("span",qh,c(e.$t("Pin to top")),1))]),l("li",{onClick:t[5]||(t[5]=v=>i.toggleSidebarPin())},[s.feed.priority?(n(),r("span",Yh,c(e.$t("Unpin from sidebar")),1)):(n(),r("span",Gh,c(e.$t("Pin to sidebar")),1))])],64)):_("",!0),(w=s.feed.meta)!=null&&w.media_preview?(n(),r("li",{key:2,onClick:t[6]||(t[6]=v=>i.removePreview())},c(e.$t("Remove Preview")),1)):_("",!0),e.hasSpaceAdminAccess(s.feed.space)?(n(),r("li",{key:3,onClick:t[7]||(t[7]=v=>i.toggleCommentStatus())},[((C=s.feed.meta)==null?void 0:C.comments_disabled)=="yes"?(n(),r("span",Wh,c(e.$t("Enable comments")),1)):(n(),r("span",Kh,c(e.$t("Disable comments")),1))])):_("",!0)],64)):_("",!0),e.canDeleteFeed(s.feed)?(n(),r("li",{key:2,onClick:t[8]||(t[8]=v=>i.deleteItem())},c(e.$t("Delete")),1)):_("",!0),K(e.$slots,"after_feed_actions_pop")])]}),_:3},512),o.isEdit?(n(),y(k,{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.feed.xprofile)==null?void 0:$.avatar},onUpdated:i.handleUpdate,onClose:t[9]||(t[9]=w=>o.isEdit=!1)},null,8,["feedSlug","dialogVisible","hide_create_form","author","onUpdated"])):_("",!0)],64)}const bo=I(Oh,[["render",Zh]]);const Qh={name:"Feed",components:{DocumentLists:tt,CustomAppMeta:xh,BookmarkIcon:vo,StickyIcon:Ft,UserRouteLink:Te,EditFeed:rs,FeedFooter:E_,MediaPreview:xe,ImageCarousel:Tt,SurveyRenderer:yo,ReportReview:mo,FeedAction:bo,FeedMdContent:ft},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(/])*>|<[^>]+>|#([\p{L}\p{M}\p{N}_-]+)/gu,(o,i,m,f)=>o.startsWith("#${i}`:o);return s.indexOf('o.replace(/([^<]+)<\/span>/g,(i,m,f)=>{try{const h=this.dayjs(m*1e3);if(!h.isValid())return i;const k=h.local().format(this.siteDateTimeFormat)+" ("+this.currentTimeZoneName+")";return`${k}`}catch{return i}}))(s)},isInsideHtmlTag(e,t){let s=!1;for(let u=0;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)}},Jh=["id"],Xh={key:1,class:"fcom_top_media"},ef={key:2,class:"fcom_feed_header_wrap"},tf={class:"feed_actions fcom_concat_buttons"},sf={key:0,class:"fcom_feed_topics"},of={class:"feed_header"},nf={key:0,class:"feed_user"},lf={class:"feed_user_info"},af={class:"feed_user_name"},rf={key:0,class:"feed_status"},df={key:1,class:"feed_status"},cf={key:2,class:"feed_status"},uf={class:"feed_meta_info"},_f={key:0,class:"meta_line"},mf=["title","href"],hf=["title","href"],ff={key:3},pf={key:0,class:"feed_title"},gf={key:0,class:"feed_title_heading"},yf=["href"],vf={key:1,class:"feed_title_heading"};function bf(e,t,s,u,o,i){var B,N,H,z,G,ne,E,J,ce,X,Ve,ee,Z,ie,yt;const m=g("report-review"),f=g("media-preview"),h=O,p=g("StickyIcon"),k=j,b=g("BookmarkIcon"),$=g("FeedAction"),w=g("router-link"),C=g("UserAvatar"),v=g("UserRouteLink"),S=De,T=g("FeedMdContent"),V=g("SurveyRenderer"),P=g("ImageCarousel"),L=g("DocumentLists"),x=g("CustomAppMeta"),A=g("feed-footer"),U=se("loading");return Y((n(),r("div",{id:"feed_id_"+((B=s.feed)==null?void 0:B.id),class:D([i.feedClasses,"feed"])},[i.showReport?(n(),y(m,{key:0,feed:s.feed},null,8,["feed"])):_("",!0),i.hasTopMedia?(n(),r("div",Xh,[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(),r("div",ef,[l("div",tf,[e.auth.user_id&&!e.hasSpaceAccess((N=s.feed.space)==null?void 0:N.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]=_e=>i.joinSpace())},{default:d(()=>[M(c(e.$t("Join")),1)]),_:1},8,["loading"])):_("",!0),s.show_actions?(n(),r(F,{key:1},[s.feed.is_sticky&&o.in_space?(n(),y(h,{key:0,onClick:t[1]||(t[1]=_e=>i.toggleSticky()),"aria-label":e.$t("Toggle Sticky"),class:"no_pad_btn",text:"",size:"small"},{default:d(()=>[a(k,{class:"fcom_sticky"},{default:d(()=>[a(p)]),_: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]=_e=>i.toggleBookmark()),class:D([{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:d(()=>[a(k,{style:{"font-size":"14px"}},{default:d(()=>[a(b,{is_active:s.feed.bookmarked},null,8,["is_active"])]),_:1})]),_:1},8,["aria-label","class","title"])):_("",!0),a($,{feed:s.feed,hide_create_form:s.hide_create_form,onUpdated:i.handleUpdate,onDeleted:i.handleDelete},{before_feed_actions_pop:d(()=>[s.is_route?(n(),r("li",{key:0,onClick:t[3]||(t[3]=_e=>e.$emit("reload"))},c(e.$t("Refresh")),1)):_("",!0)]),_:1},8,["feed","hide_create_form","onUpdated","onDeleted"])],64)):_("",!0),K(e.$slots,"after_feed_actions")]),((H=e.appVars.topicsConfig)==null?void 0:H.show_on_post_card)=="yes"&&s.feed.terms&&s.feed.terms.length?(n(),r("div",sf,[(n(!0),r(F,null,R(s.feed.terms,_e=>(n(),y(w,{onClick:q(KP=>i.gotoTopicUrl(_e.slug),["prevent"]),key:_e.slug,to:i.getTopicRoute(_e.slug),class:"feed_timestamp"},{default:d(()=>[M("#"+c(_e.title),1)]),_:2},1032,["onClick","to"]))),128))])):_("",!0),l("div",of,[s.feed.xprofile?(n(),r("div",nf,[a(C,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"]),l("div",lf,[l("div",af,[a(v,{show_badge:!0,xprofile:s.feed.xprofile,show_follow:!0},null,8,["xprofile"]),s.feed.status=="pending"?(n(),r("span",rf,[a(S,{type:"warning"},{default:d(()=>[M(c(e.$t("In Review")),1)]),_:1})])):_("",!0),s.feed.status=="scheduled"?(n(),r("span",df,[a(S,{type:"warning"},{default:d(()=>[M(c(e.$t("Scheduled")),1)]),_:1})])):_("",!0),s.feed.status=="unlisted"&&!s.is_single?(n(),r("span",cf,[a(S,{class:"fcom_unlisted_tag"},{default:d(()=>[M(c(e.$t("Unlisted")),1)]),_:1})])):_("",!0)]),l("div",uf,[s.feed.content_type=="survey"&&((E=(ne=(G=(z=s.feed)==null?void 0:z.meta)==null?void 0:G.survey_config)==null?void 0:ne.options)!=null&&E.length)?(n(),r("span",_f,c(e.$t("created a poll")),1)):_("",!0),s.feed.status=="scheduled"?(n(),r("a",{key:1,title:s.feed.scheduled_at,onClick:t[4]||(t[4]=(..._e)=>i.gotoFeed&&i.gotoFeed(..._e)),href:s.feed.permalink,class:"feed_timestamp"},c(i.getScheduledTime(s.feed.scheduled_at)),9,mf)):(n(),r("a",{key:2,title:s.feed.created_at,onClick:t[5]||(t[5]=(..._e)=>i.gotoFeed&&i.gotoFeed(..._e)),href:s.feed.permalink,class:"feed_timestamp"},c(e.humanDateDiff(s.feed.created_at)),9,hf)),!o.in_space&&s.feed.space?(n(),r("span",ff,[a(w,{to:i.getSpaceRoute(s.feed.space.slug),class:"feed_timestamp"},{default:d(()=>[M(c(e.$t("Posted in %s",e.getExcerpt(s.feed.space.title,30))),1)]),_:1},8,["to"])])):_("",!0)])])])):_("",!0),K(e.$slots,"after_feed_header")])])):_("",!0),l("div",{ref:"feed_body",class:D([{feed_is_overflow_content:o.hasOverflowContent},"feed_body"])},[s.feed.title?(n(),r("div",pf,[s.is_single?(n(),r("h2",vf,c(s.feed.title),1)):(n(),r("h2",gf,[l("a",{onClick:t[6]||(t[6]=q((..._e)=>i.showFullContent&&i.showFullContent(..._e),["prevent"])),href:s.feed.permalink},c(s.feed.title),9,yf)]))])):_("",!0),a(T,{class_name:"feed_texts",content:i.parsedMessage},null,8,["content"]),o.hasOverflowContent&&!o.isExpanded?(n(),r("div",{key:1,onClick:t[7]||(t[7]=_e=>i.expandInline()),class:"expand-button"},[a(h,{class:"btn_expand"},{default:d(()=>[M(c(e.$t("Show More")),1)]),_:1})])):_("",!0)],2),s.feed.content_type=="survey"&&((Ve=(X=(ce=(J=s.feed)==null?void 0:J.meta)==null?void 0:ce.survey_config)==null?void 0:X.options)!=null&&Ve.length)?(n(),r(F,{key:3},[a(V,{feed:s.feed,is_preview:s.is_preview,hasTopMedia:i.hasTopMedia},null,8,["feed","is_preview","hasTopMedia"]),s.feed.meta.media_items?(n(),y(P,{key:0,is_single:s.is_single,feed:s.feed},null,8,["is_single","feed"])):!i.hasTopMedia&&(s.feed.meta.media_preview||(ee=s.feed.meta.audio_medias)!=null&&ee.length)?(n(),y(f,{key:1,feed:s.feed},null,8,["feed"])):_("",!0)],64)):s.feed.content_type=="document"?(n(),y(L,{key:4,document_lists:((ie=(Z=s.feed)==null?void 0:Z.meta)==null?void 0:ie.document_lists)||[]},null,8,["document_lists"])):s.feed.meta?(n(),r(F,{key:5},[s.feed.meta.media_items?(n(),y(P,{key:0,is_single:s.is_single,feed:s.feed},null,8,["is_single","feed"])):!i.hasTopMedia&&(s.feed.meta.media_preview||(yt=s.feed.meta.audio_medias)!=null&&yt.length)?(n(),y(f,{key:1,feed:s.feed},null,8,["feed"])):_("",!0),s.feed.meta.custom_app_preview?(n(),y(x,{key:2,feed:s.feed},null,8,["feed"])):_("",!0)],64)):_("",!0),s.show_footer?(n(),y(A,{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]=_e=>{e.$emit("commented",_e)})},null,8,["feed","is_modal","is_single","space_slug"])):_("",!0),K(e.$slots,"after_feed_footer")],10,Jh)),[[U,o.working]])}const ot=I(Qh,[["render",bf]]),kf={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()}},Vs=/\.(mp4|webm|mov|m4v|ogv|m3u8|mpd|qt)([?#]|$)/i,wf=/\.(mp3|m4a|aac|wav|ogg|oga|flac|opus|weba)([?#]|$)/i,Cf={name:"FeedCardCover",mixins:[kf],props:{feed:{type:Object,required:!0}},computed:{placeholderImageSrc(){const e=this.isDarkMode?"feed-placeholder-dark.png":"feed-placeholder.png";return this.appVars.assets_url+"images/"+e},media(){var s;const e=this.feed.meta,t=e==null?void 0:e.media_preview;return t&&(t.thumbnail||t.image||t.html||this.videoSrcOf(t))?t:((s=e==null?void 0:e.media_items)==null?void 0:s[0])||null},videoSrc(){const e=this.media;return!e||e.thumbnail||e.html||e.image&&!Vs.test(e.image)?null:this.videoSrcOf(e)},imageSrc(){const e=this.media;return e?e.thumbnail?e.thumbnail:e.image?e.image:e.html?this.extractIframeThumbnail(e.html)||this.placeholderImageSrc:e.url||this.placeholderImageSrc:this.placeholderImageSrc}},data(){return{video_failed:!1,cover_visible:!1}},methods:{videoSrcOf(e){const t=e.url||e.image;return!t||wf.test(t)?null:Vs.test(t)?t.split("#")[0]:(e.type==="video"||e.content_type==="video")&&e.url?e.url:null},markVideoFailed(){this.video_failed=!0},checkVideoTrack(e){e.target.videoWidth||(this.video_failed=!0)},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}},mounted(){if(this.videoSrc){if(typeof IntersectionObserver>"u"){this.cover_visible=!0;return}this._io=new IntersectionObserver(e=>{e.some(t=>t.isIntersecting)&&(this.cover_visible=!0,this._io.disconnect(),this._io=null)},{rootMargin:"200px"}),this._io.observe(this.$el)}},beforeUnmount(){this._io&&(this._io.disconnect(),this._io=null)}},$f=["src"],Sf=["src","alt"];function Vf(e,t,s,u,o,i){return i.videoSrc&&o.cover_visible&&!o.video_failed?(n(),r("video",{key:0,class:"card_image",src:i.videoSrc+"#t=0.1",preload:"metadata",muted:"",playsinline:"","aria-hidden":"true",onError:t[0]||(t[0]=(...m)=>i.markVideoFailed&&i.markVideoFailed(...m)),onLoadedmetadata:t[1]||(t[1]=(...m)=>i.checkVideoTrack&&i.checkVideoTrack(...m))},null,40,$f)):(n(),r("img",{key:1,src:i.videoSrc?i.placeholderImageSrc:i.imageSrc,class:"card_image",alt:s.feed.title||e.$t("Placeholder image")},null,8,Sf))}const Mf=I(Cf,[["render",Vf]]),Lf={name:"FeedCard",components:{UserRouteLink:Te,ChatIcon:Je,HeartIcon:Xe,StickyIcon:Ft,MediaPreview:xe,ImageCarousel:Tt,UserAvatar:ds,FeedAction:bo,FeedCardCover:Mf},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}},data(){return{in_space:this.$route.params.space}},methods:{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(!(e.ctrlKey||e.metaKey)){if(e.preventDefault(),e.stopPropagation(),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}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})}}},Tf=["id"],Ff={class:"fcom_feed_card_header"},If={class:"feed_card_user"},Pf={class:"feed_card_body"},Ef={class:"fcom_feed_title_row"},Af=["textContent"],Uf={key:0,class:"feed_status"},Bf={key:1,class:"feed_status"},Df={class:"card_description feed_meta_info"},Rf=["title","href"],xf={key:0},Of={class:"fcom_feed_card_footer"},Hf={class:"num_label"},jf={class:"num_label"},Nf={class:"fcom_feed_card_action"};function zf(e,t,s,u,o,i){var S;const m=g("FeedCardCover"),f=g("UserAvatar"),h=De,p=g("UserRouteLink"),k=g("router-link"),b=g("HeartIcon"),$=j,w=O,C=g("ChatIcon"),v=g("FeedAction");return n(),r("div",{id:"feed_id_"+((S=s.feed)==null?void 0:S.id),class:"fcom_feed_card"},[l("div",Ff,[l("div",{onClick:t[0]||(t[0]=(...T)=>i.goToFeedView&&i.goToFeedView(...T)),class:"feed_card_cover"},[a(m,{feed:s.feed},null,8,["feed"])]),l("div",If,[a(f,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"])]),l("div",Pf,[l("div",Ef,[l("div",{onClick:t[1]||(t[1]=(...T)=>i.goToFeedView&&i.goToFeedView(...T)),class:"card_title feed_texts feed_md_content",textContent:c(e.getExcerpt(s.feed.title||s.feed.message_rendered,60))},null,8,Af),s.feed.status=="pending"?(n(),r("span",Uf,[a(h,{type:"warning"},{default:d(()=>[M(c(e.$t("In Review")),1)]),_:1})])):_("",!0),s.feed.status=="unlisted"?(n(),r("span",Bf,[a(h,{class:"fcom_unlisted_tag"},{default:d(()=>[M(c(e.$t("Unlisted")),1)]),_:1})])):_("",!0)]),l("div",Df,[a(p,{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]=(...T)=>i.goToFeedView&&i.goToFeedView(...T)),href:s.feed.permalink,class:"feed_timestamp"},c(e.humanDateDiff(s.feed.created_at)),9,Rf),!o.in_space&&s.feed.space?(n(),r("span",xf,[a(k,{to:i.getSpaceRoute(s.feed.space.slug),class:"feed_timestamp"},{default:d(()=>[M(c(e.$t(e.getExcerpt(s.feed.space.title,30))),1)]),_:1},8,["to"])])):_("",!0)])])]),l("div",Of,[a(w,{"aria-label":e.$t("React"),text:""},{default:d(()=>[a($,{class:D({user_reacted:s.feed.has_user_react}),onClick:t[3]||(t[3]=T=>i.toggleReact())},{default:d(()=>[a(b,{filled:s.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",Hf,c(s.feed.reactions_count),1)]),_:1},8,["aria-label"]),a(w,{"aria-label":e.$t("Comment"),onClick:t[4]||(t[4]=T=>i.goToFeedView(T,!0)),text:""},{default:d(()=>[a($,null,{default:d(()=>[a(C)]),_:1}),l("span",jf,c(s.feed.comments_count),1)]),_:1},8,["aria-label"])]),l("div",Nf,[a(v,{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,Tf)}const qf=I(Lf,[["render",zf]]),Gf={name:"FeedListItem",components:{UserRouteLink:Te,ChatIcon:Je,HeartIcon:Xe,StickyIcon:Ft},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(/])*>|<[^>]+>|#([\p{L}\p{M}\p{N}_-]+)/gu,(s,u,o,i)=>s.startsWith("#${u}`:s)},isInsideHtmlTag(e,t){let s=!1;for(let u=0;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})}}},Yf=["id"],Wf={class:"fcom_feed_data"},Kf={key:0,class:"fcom_sticky"},Zf={class:"feed_user"},Qf=["href"],Jf=["href"],Xf={class:"fcom_feed_title_row"},ep=["textContent"],tp={key:0,class:"feed_status"},sp={key:1,class:"feed_status"},op={class:"fcom_feed_meta"},ip={key:0},np={class:"feed_actions"},lp={class:"num_label"},ap={class:"num_label"};function rp(e,t,s,u,o,i){var w,C,v;const m=g("StickyIcon"),f=j,h=g("UserAvatar"),p=De,k=g("HeartIcon"),b=O,$=g("ChatIcon");return n(),r("div",{id:"feed_id_"+((w=s.feed)==null?void 0:w.id),class:"fcom_feed_list"},[l("div",Wf,[s.feed.is_sticky?(n(),r("div",Kf,[a(f,{class:"fcom_sticky"},{default:d(()=>[a(m)]),_:1})])):_("",!0),l("div",Zf,[l("a",{href:i.getFeedHref(),onClick:t[0]||(t[0]=(...S)=>i.goToFeedView&&i.goToFeedView(...S))},[a(h,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"])],8,Qf)]),l("a",{href:i.getFeedHref(),onClick:t[1]||(t[1]=(...S)=>i.goToFeedView&&i.goToFeedView(...S)),class:"feed_body"},[l("div",Xf,[l("div",{class:"feed_texts feed_md_content",textContent:c(e.getExcerpt(s.feed.title||s.feed.message_rendered,250))},null,8,ep),s.feed.status=="pending"?(n(),r("span",tp,[a(p,{type:"warning"},{default:d(()=>[M(c(e.$t("In Review")),1)]),_:1})])):_("",!0),s.feed.status=="unlisted"?(n(),r("span",sp,[a(p,{class:"fcom_unlisted_tag"},{default:d(()=>[M(c(e.$t("Unlisted")),1)]),_:1})])):_("",!0)]),l("div",op,[M(c(((v=(C=s.feed)==null?void 0:C.xprofile)==null?void 0:v.display_name)||"No Name")+" โ€ข "+c(e.humanDateDiff(s.feed.created_at))+" ",1),!o.in_space&&s.feed.space?(n(),r("span",ip,"โ€ข #"+c(s.feed.space.slug),1)):_("",!0)])],8,Jf)]),l("div",np,[a(b,{"aria-label":e.$t("React"),text:""},{default:d(()=>[a(f,{class:D({user_reacted:s.feed.has_user_react}),onClick:t[2]||(t[2]=S=>i.toggleReact())},{default:d(()=>[a(k,{filled:s.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",lp,c(s.feed.reactions_count),1)]),_:1},8,["aria-label"]),a(b,{"aria-label":e.$t("Comment"),onClick:t[3]||(t[3]=S=>i.goToFeedView(S,!0)),text:""},{default:d(()=>[a(f,null,{default:d(()=>[a($)]),_:1}),l("span",ap,c(s.feed.comments_count),1)]),_:1},8,["aria-label"])])],8,Yf)}const ko=I(Gf,[["render",rp]]),dp={name:"SwitchTimelineIcon"},cp={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function up(e,t,s,u,o,i){return n(),r("svg",cp,[...t[0]||(t[0]=[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)])])}const _p=I(dp,[["render",up]]),mp={name:"SwitchListIcon"},hp={width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",role:"img",color:"#666666"};function fp(e,t,s,u,o,i){return n(),r("svg",hp,[...t[0]||(t[0]=[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),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),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)])])}const pp=I(mp,[["render",fp]]),gp={name:"SwitchCardIcon"},yp={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor"};function vp(e,t,s,u,o,i){return n(),r("svg",yp,[...t[0]||(t[0]=[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)])])}const bp=I(gp,[["render",vp]]),kp={name:"DoubleChevronUpIcon",props:{fill:{type:String,default:"currentColor"}}},wp=["fill"];function Cp(e,t,s,u,o,i){return n(),r("svg",{fill:s.fill,width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[l("path",{d:"M5 13L10 8L15 13",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",fill:"none"},null,-1),l("path",{d:"M5 8L10 3L15 8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",fill:"none"},null,-1)])],8,wp)}const $p=I(kp,[["render",Cp]]),Sp={name:"ScrollToTop",components:{DoubleChevronUpIcon:$p},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)}},Vp=["aria-label"],Mp={class:"fcom_scroll_to_top_icon"};function Lp(e,t,s,u,o,i){const m=g("DoubleChevronUpIcon");return n(),y(Es,{"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:d(()=>[o.visible?(n(),r("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",Mp,[a(m)])],8,Vp)):_("",!0)]),_:1})}const Tp=I(Sp,[["render",Lp]]);let Fp=0;const Ip={name:"AllFeeds",emits:["refetch","update:loading"],inheritAttrs:!1,setup(){const e=Me(),t=Mt();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:Et,Feed:ot,FeedCard:qf,FeedListItem:ko,SwitchTimelineIcon:_p,SwitchListIcon:pp,SwitchCardIcon:bp,ScrollToTop:Tp},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:Fp++,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:{...zs(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()}},Pp={key:1,class:"feed_filters"},Ep={class:"fcom_feed_filter_value"},Ap={key:1,class:"fcom_feed_filter_active"},Up={key:0,role:"presentation",class:"fcom_feed_filter_group"},Bp=["id"],Dp=["aria-labelledby"],Rp={key:1,role:"presentation",class:"fcom_feed_filter_group"},xp=["id"],Op=["aria-labelledby"],Hp={key:1,class:"fcom_layout_switch"},jp={class:"fcom_icon_menu"},Np={class:"fcom_icon_menu"},zp={class:"fcom_icon_menu"},qp={key:2,style:{margin:"0 0 10px"},class:"fcom_search_result_num"},Gp={key:0},Yp={key:3,class:"fcom_sticky_feed"},Wp={class:"all_feeds_holder"},Kp={key:0,style:{"margin-top":"20px","text-align":"center"}},Zp={key:5},Qp={class:"feed_outer"},Jp={class:"feed"},Xp={style:{"text-align":"center"},class:"feed_body not_found"},e1={key:0},t1={key:1},s1={key:2};function o1(e,t,s,u,o,i){const m=g("create-status-form"),f=g("Operation"),h=j,p=g("ArrowDown"),k=O,b=We,$=Ke,w=Ze,C=g("SwitchCardIcon"),v=g("SwitchListIcon"),S=g("SwitchTimelineIcon"),T=g("feed"),V=g("FeedListItem"),P=g("FeedCard"),L=Q,x=g("ScrollToTop");return n(),r(F,null,[K(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),K(e.$slots,"before_feeds"),s.hide_filters?_("",!0):(n(),r("div",Pp,[t[7]||(t[7]=l("div",{class:"fcom_feed_divider"},null,-1)),s.can_change_order||i.canFilterStatus?(n(),y(w,{key:0,class:"fcom_feed_filter_dropdown","popper-class":"fcom_feed_filter_pop",trigger:"click",placement:"bottom-end","popper-options":o.filterPopperOptions},{dropdown:d(()=>[a($,{class:"fcom_feed_filter_menu"},{default:d(()=>[s.can_change_order?(n(),r("li",Up,[l("span",{id:i.sortGroupLabelId,class:"fcom_feed_filter_group_label"},c(e.$t("Sort by")),9,Bp),l("ul",{role:"group","aria-labelledby":i.sortGroupLabelId,class:"fcom_feed_filter_group_list"},[(n(!0),r(F,null,R(i.computedPostOrderOptions,(A,U)=>(n(),y(b,{key:U,class:D({fcom_feed_filter_selected:o.sort_by===U}),onClick:B=>i.selectSortBy(U)},{default:d(()=>[M(c(A),1)]),_:2},1032,["class","onClick"]))),128))],8,Dp)])):_("",!0),i.canFilterStatus?(n(),r("li",Rp,[l("span",{id:i.visibilityGroupLabelId,class:D(["fcom_feed_filter_group_label",{fcom_feed_filter_group_divided:s.can_change_order}])},c(e.$t("Visibility")),11,xp),l("ul",{role:"group","aria-labelledby":i.visibilityGroupLabelId,class:"fcom_feed_filter_group_list"},[(n(!0),r(F,null,R(i.visibilityOptions,A=>(n(),y(b,{key:A.value,class:D({fcom_feed_filter_selected:o.status_filter===A.value}),onClick:U=>i.selectStatusFilter(A.value)},{default:d(()=>[M(c(A.label),1)]),_:2},1032,["class","onClick"]))),128))],8,Op)])):_("",!0)]),_:1})]),default:d(()=>[a(k,{text:"",class:"fcom_feed_filter_trigger","aria-label":i.triggerAriaLabel},{default:d(()=>[i.canFilterStatus?(n(),r("span",{key:0,class:D(["fcom_feed_filter_icon",{"is-active":!!o.status_filter}])},[a(h,null,{default:d(()=>[a(f)]),_:1})],2)):_("",!0),l("span",Ep,c(i.currentSortLabel),1),i.activeVisibilityLabel?(n(),r("span",Ap,"("+c(i.activeVisibilityLabel)+")",1)):_("",!0),a(h,{class:"fcom_feed_filter_caret"},{default:d(()=>[a(p)]),_:1})]),_:1},8,["aria-label"])]),_:1},8,["popper-options"])):_("",!0),s.can_change_layout&&s.feed_name&&e.hasFeature("can_switch_layout")?(n(),r("div",Hp,[a(w,{"popper-class":"fcom_pop_buttons",trigger:"click"},{dropdown:d(()=>[a($,{class:"fcom_layout_dropdown_menu"},{default:d(()=>[a(b,{onClick:t[0]||(t[0]=A=>i.switchView("card")),class:D({selected_layout:o.custom_layout_style==="card"})},{default:d(()=>[l("div",jp,[a(C),l("span",null,c(e.$t("Card")),1)])]),_:1},8,["class"]),a(b,{onClick:t[1]||(t[1]=A=>i.switchView("list")),class:D({selected_layout:o.custom_layout_style==="list"})},{default:d(()=>[l("div",Np,[a(v),l("span",null,c(e.$t("List")),1)])]),_:1},8,["class"]),a(b,{onClick:t[2]||(t[2]=A=>i.switchView("timeline")),class:D({selected_layout:o.custom_layout_style==="timeline"})},{default:d(()=>[l("div",zp,[a(S),l("span",null,c(e.$t("Timeline")),1)])]),_:1},8,["class"])]),_:1})]),default:d(()=>[a(k,{type:"info",text:"",title:e.$t("Switch Layout View")},{default:d(()=>[a(h,{class:D(["fcom_layout_icon","fcom_layout_icon_"+o.custom_layout_style])},{default:d(()=>[o.custom_layout_style=="card"?(n(),y(C,{key:0})):o.custom_layout_style=="list"?(n(),y(v,{key:1})):(n(),y(S,{key:2}))]),_:1},8,["class"])]),_:1},8,["title"])]),_:1})])):_("",!0)])),i.pagination.total&&o.search?(n(),r("div",qp,[M(c(e.$_n("%s result found","%s results found",i.pagination.total))+" ",1),i.execution_time?(n(),r("span",Gp,c(e.$t("in %ss",i.execution_time.toFixed(2))),1)):_("",!0)])):_("",!0),i.sticky?(n(),r("div",Yp,[a(T,{onReload:t[3]||(t[3]=A=>{i.sticky=null,e.fetchFeeds()}),onFeedUpdated:t[4]||(t[4]=A=>{i.sticky=A}),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(),r("div",{key:4,ref:"all_feeds_wrap",class:D(["fcom_feed_style_"+i.currentLayoutStyle,"all_feeds"])},[l("div",Wp,[(n(!0),r(F,null,R(i.feeds,(A,U)=>(n(),r("div",{key:A.id,class:"feed_outer"},[i.currentLayoutStyle=="list"?(n(),y(V,{key:0,feed:A},null,8,["feed"])):i.currentLayoutStyle=="card"?(n(),y(P,{key:1,feed:A,hide_create_form:s.hide_create_form,onUpdated:B=>i.handleUpdate(B,U),onDeleted:()=>i.handleDelete(U),onRemoved:()=>i.handleRemoveFromList(U)},null,8,["feed","hide_create_form","onUpdated","onDeleted","onRemoved"])):(n(),y(T,{key:2,feed:A,isSingleSpacePage:!!s.space,show_report:!0,layout_style:i.currentLayoutStyle,hide_create_form:s.hide_create_form,onUpdated:B=>i.handleUpdate(B,U),onDeleted:()=>i.handleDelete(U),onRemoved:()=>i.handleRemoveFromList(U)},null,8,["feed","isSingleSpacePage","layout_style","hide_create_form","onUpdated","onDeleted","onRemoved"]))]))),128))]),i.pagination.has_more!==!1?(n(),r("div",Kp,[a(k,{class:"fcom_secondary_button",disabled:i.loading,loading:i.loading,onClick:t[6]||(t[6]=A=>i.fetchFeedsFromStore(!0))},{default:d(()=>[M(c(e.$t("Load more")),1)]),_:1},8,["disabled","loading"])])):_("",!0)],2)):!i.loading&&!i.sticky?(n(),r("div",Zp,[l("div",Qp,[l("div",Jp,[l("div",Xp,[o.search?(n(),r("p",e1,c(e.$t("No results found based on your search criteria")),1)):s.topic_slug?(n(),r("p",t1,c(e.$t("No posts found for the selected topic")),1)):(n(),r("p",s1,c(e.$t("No posts found!")),1))])])])])):_("",!0),i.loading&&!i.feeds.length?(n(),r(F,{key:6},[a(L,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5}),i.pagination.page==1?(n(),r(F,{key:0},[a(L,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5}),a(L,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5})],64)):_("",!0)],64)):_("",!0),a(x,{threshold:500})],64)}const pt=I(Ip,[["render",o1]]),i1={name:"SearchBar",components:{SpaceIcon:ze,AllFeeds:pt,SearchIcon:Fe,Loading:ni},data(){return{search:"",SearchIcon:Wt(Fe),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{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)}},n1=["aria-label"],l1={class:"fcom_search_header"},a1={key:0,class:"fcom_space_title"},r1={key:1},d1={style:{display:"flex","align-items":"center","flex-wrap":"wrap",gap:"10px",margin:"10px 20px 0","justify-content":"center"}},c1={key:0,class:"fcom_search_results"},u1={key:1,class:"fcom_search_welcome"};function _1(e,t,s,u,o,i){const m=g("SearchIcon"),f=j,h=g("Loading"),p=le,k=g("SpaceIcon"),b=Zt,$=ae,w=oe,C=ve,v=Bs,S=g("all-feeds"),T=Pe,V=ke;return n(),r(F,null,[l("button",{class:"fcom_menu_button","aria-label":e.$t("Search"),onClick:t[0]||(t[0]=P=>i.initSearch())},[a(f,{id:"fcom_search_icon",class:"fcom_search_icon"},{default:d(()=>[a(m)]),_:1})],8,n1),o.showingSearch?(n(),y(V,{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]=P=>o.showingSearch=P),"show-close":!1,style:{"max-width":"700px"},width:e.drawerWidth},{header:d(()=>[l("div",l1,[a(w,{ref:"seatch_input",size:"large",type:"search",autocomplete:"off",inputmode:"search",modelValue:o.search,"onUpdate:modelValue":t[2]||(t[2]=P=>o.search=P),placeholder:i.placeholder,onKeyup:te(i.toSearch,["enter"]),onClear:i.onClear,clearable:""},ye({prefix:d(()=>[a(f,{onClick:i.toSearch},{default:d(()=>[a(m)]),_:1},8,["onClick"])]),append:d(()=>[a($,{class:"fcom_minimal_select fcom_global_search_append",modelValue:o.search_space,"onUpdate:modelValue":t[1]||(t[1]=P=>o.search_space=P),placeholder:e.$t("All Posts"),style:{width:"100px"}},{default:d(()=>[a(p,{label:e.$t("All Posts"),value:"__all__"},null,8,["label"]),(n(!0),r(F,null,R(o.searchGroups,P=>(n(),y(b,{key:P.label,label:P.label},{default:d(()=>[(n(!0),r(F,null,R(P.spaces,L=>(n(),y(p,{key:L.slug,label:L.title,value:L.slug},{default:d(()=>[L.id?(n(),r("span",a1,[a(k,{space_profile:L},null,8,["space_profile"]),l("span",null,c(e.getExcerpt(L.title,30)),1)])):(n(),r("span",r1,c(e.getExcerpt(L.title,30)),1))]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:2},[o.searching?{name:"suffix",fn:d(()=>[a(f,{class:"is-loading fcom_search_spinner"},{default:d(()=>[a(h)]),_:1})]),key:"0"}:void 0]),1032,["modelValue","placeholder","onKeyup","onClear"]),l("div",d1,[l("span",null,c(e.$t("Search in:")),1),a(v,{modelValue:o.searchIn,"onUpdate:modelValue":t[3]||(t[3]=P=>o.searchIn=P),class:"fcom_search_in"},{default:d(()=>[a(C,{value:"post_content",class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Post Title & Content")),1)]),_:1}),a(C,{value:"post_comments",class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Comments")),1)]),_:1})]),_:1},8,["modelValue"])])])]),default:d(()=>[o.perform_search?(n(),r("div",c1,[a(T,{ref:"feedsScroller",onScroll:i.handleScroll,style:{"padding-right":"20px"},height:"70vh"},{default:d(()=>[a(S,{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]=P=>o.searching=P)},null,8,["searchIn","space","default_search"])]),_:1},8,["onScroll"])])):(n(),r("div",u1,[a(f,null,{default:d(()=>[a(m)]),_:1}),l("h3",null,c(e.$t("Search for anything")),1),l("p",null,c(e.$t("Try searching for keywords in posts")),1),l("p",null,[M(c(e.$t("Tip: Quick-launch search with"))+" ",1),t[6]||(t[6]=l("b",null,"โŒ˜ + K",-1)),M(" (Mac) "+c(e.$t("or"))+" ",1),t[7]||(t[7]=l("b",null,"Ctrl + K",-1)),t[8]||(t[8]=M(" (Windows/Linux)",-1))])]))]),_:1},8,["onOpened","modelValue","width"])):_("",!0)],64)}const m1=I(i1,[["render",_1]]),h1={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()}}},f1=["id"];function p1(e,t,s,u,o,i){const m=Ds;return n(),y(m,Oo({"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}),ye({default:d(()=>[l("div",{class:D(s.bodyClass)},[K(e.$slots,"default")],2)]),_:2},[s.withHeader?{name:"header",fn:d(({close:f,titleId:h,titleClass:p})=>[K(e.$slots,"header",{close:f,titleId:h,titleClass:p},()=>[s.title?(n(),r("h4",{key:0,id:h,class:D([p,s.headerClass]),style:{margin:"0"}},c(s.title),11,f1)):_("",!0)])]),key:"0"}:void 0,e.$slots.footer?{name:"footer",fn:d(()=>[l("div",{class:D(s.footerClass)},[K(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 wo=I(h1,[["render",p1]]);const g1={name:"SvgShapeGenerator",emits:["update"],data(){return{currentColor:"",selectedShape:"circle"}},computed:{svgShapes(){return{circle:``,square:``,triangle:``,star:``,heart:``,diamond:``}}},methods:{selectShape(e){this.selectedShape=e,this.$emit("update",this.svgShapes[e])},colorChanged(e){this.currentColor=e,this.$emit("update",this.svgShapes[this.selectedShape])}}},y1={class:"fcom_svg_generator"},v1={class:"fcom_form_item"},b1={class:"fcom_form_item"},k1=["innerHTML"];function w1(e,t,s,u,o,i){const m=Rs,f=je,h=be;return n(),r("div",y1,[l("div",v1,[l("label",null,c(e.$t("Select Shape Color:")),1),a(m,{predefine:e.appVars.suggestedColors,modelValue:o.currentColor,"onUpdate:modelValue":t[0]||(t[0]=p=>o.currentColor=p),onActiveChange:i.colorChanged,size:"large","show-alpha":""},null,8,["predefine","modelValue","onActiveChange"])]),l("div",b1,[l("label",null,c(e.$t("Select Shape:")),1),a(h,{onChange:t[1]||(t[1]=p=>i.selectShape(o.selectedShape)),modelValue:o.selectedShape,"onUpdate:modelValue":t[2]||(t[2]=p=>o.selectedShape=p)},{default:d(()=>[(n(!0),r(F,null,R(i.svgShapes,(p,k)=>(n(),y(f,{key:k,value:k},{default:d(()=>[l("div",{innerHTML:p},null,8,k1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])])])}const C1=I(g1,[["render",w1]]),$1={name:"LogoEmojiSelector",components:{EmojiPicker:co,ImageUploader:Re,SvgShapeGenerator:C1,ActionPopover:et},props:{config:{type:Object,required:!0,default:()=>({emoji:"",logo:"",shape_svg:""})},fallback_mark:{type:String,default:''},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?``:this.emoji.trim()?`${this.emoji.trim()}`:this.shape_svg?''+this.shape_svg+"":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"}}},S1=["innerHTML"];function V1(e,t,s,u,o,i){const m=O,f=g("EmojiPicker"),h=oe,p=xs,k=g("SvgShapeGenerator"),b=Ie,$=g("ImageUploader"),w=Os,C=g("action-popover");return n(),y(C,{ref:"iconPicker","close-on-click-outside":!0,"trigger-interactive":!0,teleported:!0,width:e.modalWidth},{trigger:d(()=>[a(m,{"aria-label":e.$t("Pick Emoji"),style:{padding:"4px 16px",display:"flex","justify-content":"center","align-items":"center"}},{default:d(()=>[l("span",{class:"logo_emoji_holder",style:{cursor:"pointer"},innerHTML:i.currentMark||""},null,8,S1)]),_:1},8,["aria-label"])]),default:d(({hide:v})=>[l("div",null,[a(w,{modelValue:o.selectedTab,"onUpdate:modelValue":t[5]||(t[5]=S=>o.selectedTab=S),type:"border-card"},{default:d(()=>[a(p,{name:"emoji",label:e.$t("Emoji")},{default:d(()=>[a(h,{onChange:t[1]||(t[1]=S=>i.setData("emoji")),modelValue:o.emoji,"onUpdate:modelValue":t[2]||(t[2]=S=>o.emoji=S),placeholder:e.$t("Select or paste your emoji here"),style:{width:"100%"}},ye({_:2},[e.has_pro?{name:"append",fn:d(()=>[a(f,{close_on_select:!0,onEmojiSelected:t[0]||(t[0]=S=>{o.emoji=S,i.setData("emoji")})})]),key:"0"}:void 0]),1032,["modelValue","placeholder"])]),_:1},8,["label"]),a(p,{name:"shape",label:e.$t("Shape")},{default:d(()=>[a(k,{onUpdate:i.handleShapeChanged},null,8,["onUpdate"])]),_:1},8,["label"]),s.custom_svg?(n(),y(p,{key:0,name:"shape_svg",label:e.$t("Custom SVG")},{default:d(()=>[a(h,{rows:4,type:"textarea",onChange:t[3]||(t[3]=S=>i.setData("shape_svg")),modelValue:o.shape_svg,"onUpdate:modelValue":t[4]||(t[4]=S=>o.shape_svg=S),placeholder:e.$t("Paste your SVG here"),style:{width:"100%"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(p,{name:"logo",label:e.$t("Custom Image")},{default:d(()=>[o.logo?(n(),y(b,{key:0,alt:e.$t("Logo"),src:o.logo,style:{"max-width":"100px"}},null,8,["alt","src"])):_("",!0),a($,{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:S=>v(),type:"success",plain:"",class:"fcom_mt_20"},{default:d(()=>[M(c(e.$t("Close")),1)]),_:1},8,["onClick"])])]),_:1},8,["width"])}const cs=I($1,[["render",V1]]),M1={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})}}},L1={key:0,class:"fcom_slug_input_info"},T1=["innerHTML"],F1={key:1,class:"fcom_help_text"};function I1(e,t,s,u,o,i){const m=O,f=oe;return n(),r(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},ye({_:2},[s.prefix?{name:"prepend",fn:d(()=>[l("span",null,c(s.prefix),1)]),key:"0"}:void 0,o.showEdit?{name:"append",fn:d(()=>[a(m,{onClick:t[0]||(t[0]=h=>i.confirmEditInit()),text:"",type:"info"},{default:d(()=>[M(c(e.$t("change")),1)]),_:1})]),key:"1"}:void 0]),1032,["disabled","readonly","modelValue","placeholder","onInput"]),!o.showEdit&&s.edit_notice?(n(),r("div",L1,[l("p",{innerHTML:s.edit_notice},null,8,T1)])):_("",!0),s.description?(n(),r("div",F1,[l("p",null,c(s.description),1)])):_("",!0)],64)}const At=I(M1,[["render",I1]]),P1={name:"ErrorAlerts",props:{errors:{type:Array,default:()=>[]},dismissable:{type:Boolean,default:!1}},data(){return{dismissed:!1}},watch:{errors(){this.dismissed=!1}}},E1={class:"fcom_errors_alert_list"};function A1(e,t,s,u,o,i){const m=Kt;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:d(()=>[l("ul",E1,[(n(!0),r(F,null,R(s.errors,(f,h)=>(n(),r("li",{key:h},c(f),1))),128))])]),_:1},8,["closable"])):_("",!0)}const Ut=I(P1,[["render",A1]]),U1={name:"TopicSelector",props:["modelValue","creatable","space_id"],emits:["update:modelValue"],components:{SlugInput:At,ActionPopover:et,ErrorAlerts:Ut},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()}},B1={class:"fcom_topic_selector"},D1={key:0,class:"fcom_meta_text"};function R1(e,t,s,u,o,i){const m=le,f=ae,h=g("Plus"),p=j,k=O,b=oe,$=pe,w=g("slug-input"),C=g("error-alerts"),v=ge,S=g("action-popover"),T=se("loading");return n(),r("div",B1,[Y((n(),y(f,{modelValue:o.selected,"onUpdate:modelValue":t[0]||(t[0]=V=>o.selected=V),"popper-class":"fcom_topics_from_settings",style:{width:"100%"},filterable:!0,multiple:!0,clearable:"","multiple-limit":i.maxTopicsPerSpace,placeholder:i.getTopicsPlaceholder()},{default:d(()=>[(n(!0),r(F,null,R(o.topics,V=>(n(),y(m,{key:V.slug,label:V.title,value:V.id},{default:d(()=>[l("span",null,c(V.title),1),V.description?(n(),r("span",D1,c(V.description),1)):_("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","multiple-limit","placeholder"])),[[T,o.loading]]),e.isAdmin()&&s.creatable?(n(),y(S,{key:0,placement:"left",width:400,onShow:i.initCreatetopic},{trigger:d(()=>[a(k,{disabled:i.isTopicLimitReached,class:"fcom_secondary_button"},{default:d(()=>[a(p,null,{default:d(()=>[a(h)]),_:1}),l("span",null,c(e.$t("New")),1)]),_:1},8,["disabled"])]),default:d(({hide:V})=>[a(v,{modelValue:o.newTopic,"onUpdate:modelValue":t[4]||(t[4]=P=>o.newTopic=P),"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[a($,{label:e.$t("Title"),required:""},{default:d(()=>[a(b,{modelValue:o.newTopic.title,"onUpdate:modelValue":t[1]||(t[1]=P=>o.newTopic.title=P),placeholder:e.$t("Title of the topic")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a($,{label:e.$t("Slug (optional)")},{default:d(()=>[a(w,{modelValue:o.newTopic.slug,"onUpdate:modelValue":t[2]||(t[2]=P=>o.newTopic.slug=P),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($,{label:e.$t("Description (optional)")},{default:d(()=>[a(b,{modelValue:o.newTopic.description,"onUpdate:modelValue":t[3]||(t[3]=P=>o.newTopic.description=P),type:"textarea",rows:3,placeholder:e.$t("Description of the topic")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(C,{errors:o.newTopicErrors,style:{"margin-bottom":"16px"}},null,8,["errors"]),a($,null,{default:d(()=>[a(k,{class:"fcom_primary_button",onClick:P=>i.createTopic(V),loading:o.creatingTopic},{default:d(()=>[M(c(e.$t("Create")),1)]),_:1},8,["onClick","loading"])]),_:2},1024)]),_:2},1032,["modelValue"])]),_:1},8,["onShow"])):_("",!0)])}const Co=I(U1,[["render",R1]]),x1={name:"ListViewIcon"},O1={width:"160",height:"158",viewBox:"0 0 160 158",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function H1(e,t,s,u,o,i){return n(),r("svg",O1,[...t[0]||(t[0]=[Le('',23)])])}const j1=I(x1,[["render",H1]]),N1={name:"TimelineViewIcon"},z1={width:"160",height:"158",viewBox:"0 0 160 158",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function q1(e,t,s,u,o,i){return n(),r("svg",z1,[...t[0]||(t[0]=[Le('',19)])])}const G1=I(N1,[["render",q1]]),Y1={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 W1(e,t,s,u,o,i){const m=le,f=ae,h=se("loading");return Y((n(),y(f,{placeholder:e.$t("Select Menu Group"),clearable:"",modelValue:o.selected,"onUpdate:modelValue":t[0]||(t[0]=p=>o.selected=p)},{default:d(()=>[(n(!0),r(F,null,R(o.groups,p=>(n(),y(m,{key:p.id,value:p.id.toString(),label:p.title},null,8,["value","label"]))),128))]),_:1},8,["placeholder","modelValue"])),[[h,o.loading]])}const us=I(Y1,[["render",W1]]),K1={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)}}},Z1={class:"fcom_form_builder"},Q1=["innerHTML"],J1={key:8},X1={key:9,class:"fcom_help_text"},eg=["innerHTML"];function tg(e,t,s,u,o,i){const m=oe,f=Qe,h=be,p=le,k=ae,b=ve,$=Bs,w=Ye,C=Rs,v=pe,S=O,T=ge;return n(),r("div",Z1,[a(T,{"label-position":"top",model:s.formData,onSubmit:q(e.doNothing,["prevent"])},{default:d(()=>[(n(!0),r(F,null,R(s.formFields,(V,P)=>(n(),y(v,{key:e.index,label:V.label},ye({default:d(()=>[V.type=="text"?(n(),y(m,{key:0,modelValue:s.formData[P],"onUpdate:modelValue":L=>s.formData[P]=L,placeholder:V.placeholder,type:V.data_type||"text"},null,8,["modelValue","onUpdate:modelValue","placeholder","type"])):V.type=="radio"?(n(),y(h,{key:1,modelValue:s.formData[P],"onUpdate:modelValue":L=>s.formData[P]=L},{default:d(()=>[(n(!0),r(F,null,R(V.options,(L,x)=>(n(),y(f,{key:x,value:L.value,label:L.label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):V.type=="select"?(n(),y(k,{key:2,class:"fcom_select",multiple:V.is_multiple,clearable:"",filterable:"",modelValue:s.formData[P],"onUpdate:modelValue":L=>s.formData[P]=L,placeholder:V.placeholder},{default:d(()=>[(n(!0),r(F,null,R(V.options,(L,x)=>(n(),y(p,{key:x,label:L.label,value:L.value},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"])):V.type=="checkbox"?(n(),y($,{key:3,modelValue:s.formData[P],"onUpdate:modelValue":L=>s.formData[P]=L},{default:d(()=>[(n(!0),r(F,null,R(V.options,(L,x)=>(n(),y(b,{key:x,value:L.value,label:L.label,class:"fcom_checkbox"},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):V.type=="inline_checkbox"?(n(),y(b,{key:4,modelValue:s.formData[P],"onUpdate:modelValue":L=>s.formData[P]=L,"true-value":V.true_value||"yes","false-value":V.false_value||"no",class:"fcom_checkbox"},{default:d(()=>[M(c(V.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","true-value","false-value"])):V.type=="date"?(n(),y(w,{key:5,modelValue:s.formData[P],"onUpdate:modelValue":L=>s.formData[P]=L,type:V.data_type||"date","value-format":V.value_format||"YYYY-MM-DD",format:V.value_format||"YYYY-MM-DD",placeholder:V.placeholder},null,8,["modelValue","onUpdate:modelValue","type","value-format","format","placeholder"])):V.type=="color_picker"?(n(),y(C,{key:6,modelValue:s.formData[P],"onUpdate:modelValue":L=>s.formData[P]=L},null,8,["modelValue","onUpdate:modelValue"])):V.type=="raw_html"?(n(),r("div",{key:7,innerHTML:V.content},null,8,Q1)):(n(),r("div",J1,[l("pre",null,c(V),1)])),V.help_text?(n(),r("div",X1,[l("p",{innerHTML:V.help_text},null,8,eg)])):_("",!0)]),_:2},[V.label?{name:"label",fn:d(()=>[M(c(V.label),1)]),key:"0"}:void 0]),1032,["label"]))),128)),s.disableSubmit?_("",!0):(n(),y(v,{key:0},{default:d(()=>[a(S,{class:"fcom_primary_button",onClick:q(i.handleSubmit,["prevent"])},{default:d(()=>[M(c(s.submitButtonText),1)]),_:1},8,["onClick"])]),_:1}))]),_:1},8,["model","onSubmit"])])}const $o=I(K1,[["render",tg]]),sg={name:"CardViewIcon"},og={xmlns:"http://www.w3.org/2000/svg",width:"160",height:"158",viewBox:"0 0 160 158",fill:"none"};function ig(e,t,s,u,o,i){return n(),r("svg",og,[...t[0]||(t[0]=[Le('',22)])])}const ng=I(sg,[["render",ig]]),lg={name:"CreateSpaceForm",emits:["completed"],components:{SpaceGroupSelector:us,SlugInput:At,ImageUploader:Re,LogoEmojiSelector:cs,TopicSelector:Co,ListViewIcon:j1,TimelineViewIcon:G1,FormBuilder:$o,ErrorAlerts:Ut,CardViewIcon:ng},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:fo,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}},ag={key:0},rg={class:"fcom_form_section"},dg={class:"fcom_help_text"},cg={class:"fcom_form_section"},ug={style:{"font-weight":"bold"}},_g=["innerHTML"],mg={key:0},hg={class:"fcom_help_text"},fg={key:0},pg={key:1,class:"fcom_form_section"},gg={class:"fcom_lined_checkboxes"},yg={key:0,class:"fcom_pro_feature"},vg={key:0,class:"fcom_feature_nested"},bg={key:0,class:"fcom_pro_feature"},kg={key:1,class:"fcom_feature_nested"},wg={class:"fcom_form_section"},Cg={class:"fcom_svg_radio_item"},$g={class:"svg_radio_label"},Sg={class:"fcom_svg_radio_item"},Vg={class:"svg_radio_label"},Mg={class:"fcom_svg_radio_item"},Lg={class:"svg_radio_label"},Tg={class:"fcom_help_text"},Fg={key:0},Ig={key:1},Pg={class:"fcom_form_section"},Eg={class:"fcom_help_text"},Ag=["href"],Ug={class:"fcom_image_uploader_wrapper"},Bg={class:"fcom_help_text"},Dg={class:"fcom_image_uploader_wrapper"},Rg={class:"fcom_help_text"},xg={class:"fcom_space_form_bottom"},Og={class:"fcom_space_form_bottom"},Hg={key:0},jg={class:"fcom_form_section fcom_mt_20"};function Ng(e,t,s,u,o,i){const m=g("logo-emoji-selector"),f=oe,h=pe,p=g("SlugInput"),k=g("space-group-selector"),b=le,$=ae,w=Qe,C=be,v=ve,S=g("TimelineViewIcon"),T=g("ListViewIcon"),V=g("CardViewIcon"),P=g("topic-selector"),L=Ie,x=g("EditPen"),A=j,U=O,B=g("Delete"),N=g("ImageUploader"),H=g("error-alerts"),z=ge,G=g("form-builder"),ne=se("loading");return n(),r("div",null,[a(z,{onSubmit:t[32]||(t[32]=q(E=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[33]||(t[33]=E=>o.form=E),"label-position":"top","require-asterisk-position":"right",class:"fcom_space_form"},{default:d(()=>[o.showingSections.indexOf("basic")!==-1?(n(),r(F,{key:0},[o.form.id?_("",!0):(n(),r("h4",ag,c(e.$t("Basic Info")),1)),l("div",rg,[l("h4",null,c(e.$t("General")),1),a(h,{label:e.$t("Space Title"),required:""},{default:d(()=>[a(f,{type:"text",placeholder:e.$t("Your Space Title"),modelValue:o.form.title,"onUpdate:modelValue":t[1]||(t[1]=E=>o.form.title=E)},{prepend:d(()=>{var E,J;return[o.dataLoaded?(n(),y(m,{key:0,custom_svg:!0,onUpdate:t[0]||(t[0]=ce=>{o.form.settings.emoji=ce.emoji,o.form.logo=ce.logo,o.form.settings.shape_svg=ce.shape_svg}),config:{logo:o.form.logo,emoji:((E=o.form.settings)==null?void 0:E.emoji)||"",shape_svg:((J=o.form.settings)==null?void 0:J.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:d(()=>[a(p,{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]=E=>o.form.slug=E),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:d(()=>[a(f,{type:"textarea",rows:3,placeholder:e.$t("Space Description"),modelValue:o.form.description,"onUpdate:modelValue":t[3]||(t[3]=E=>o.form.description=E)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:d(()=>[o.dataLoaded?(n(),y(k,{key:0,modelValue:o.form.parent_id,"onUpdate:modelValue":t[4]||(t[4]=E=>o.form.parent_id=E),space_id:o.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",dg,[l("p",null,c(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",cg,[l("h4",null,c(e.$t("Access Control")),1),a(h,{label:e.$t("Privacy")},{default:d(()=>[a($,{"popper-class":"rich_select",modelValue:o.form.privacy,"onUpdate:modelValue":t[5]||(t[5]=E=>o.form.privacy=E),placeholder:e.$t("Select Privacy")},{default:d(()=>[(n(!0),r(F,null,R(o.privacies,(E,J)=>(n(),y(b,{key:J,label:E.label,value:J},{default:d(()=>[l("span",ug,c(e.$labelize(E.label)),1),l("p",{innerHTML:E.description},null,8,_g)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),o.form.privacy=="private"?(n(),r(F,{key:0},[a(h,{label:e.$t("Lock Screen Type")},{default:d(()=>[a(C,{modelValue:o.form.settings.custom_lock_screen,"onUpdate:modelValue":t[6]||(t[6]=E=>o.form.settings.custom_lock_screen=E),class:""},{default:d(()=>[a(w,{value:"yes"},{default:d(()=>[M(c(e.$t("Custom Lock Screen")),1)]),_:1}),a(w,{value:"no"},{default:d(()=>[M(c(e.$t("Default Lock Screen")),1)]),_:1}),a(w,{disabled:!e.has_pro,value:"redirect"},{default:d(()=>[M(c(e.$t("Redirect to an URL"))+" ",1),e.has_pro?_("",!0):(n(),r("span",mg,c(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:d(()=>[a(f,{modelValue:o.form.settings.onboard_redirect_url,"onUpdate:modelValue":t[7]||(t[7]=E=>o.form.settings.onboard_redirect_url=E),type:"text",placeholder:e.$t("Redirect URL for unenrolled users")},null,8,["modelValue","placeholder"]),l("div",hg,[l("p",null,c(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:d(()=>[a(v,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.can_request_join,"onUpdate:modelValue":t[8]||(t[8]=E=>o.form.settings.can_request_join=E),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Allow users to request to join this Space")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),i.isDefaultLockscreen?(n(),y(h,{key:2},{default:d(()=>[a(v,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_paywalls,"onUpdate:modelValue":t[9]||(t[9]=E=>o.form.settings.show_paywalls=E),class:"fcom_checkbox"},{default:d(()=>[M(c(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:d(()=>[a($,{modelValue:o.form.settings.members_page_status,"onUpdate:modelValue":t[10]||(t[10]=E=>o.form.settings.members_page_status=E)},{default:d(()=>[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(),r(F,{key:1},[o.form.id?_("",!0):(n(),r("h4",fg,c(e.$t("Customization")),1)),o.form.settings?(n(),r("div",pg,[l("h4",null,c(e.$t("Features Customizations")),1),a(h,null,{default:d(()=>[l("div",gg,[a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.restricted_post_only,"onUpdate:modelValue":t[11]||(t[11]=E=>o.form.settings.restricted_post_only=E)},{default:d(()=>[M(c(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]=E=>o.form.settings.verified_post_only=E)},{default:d(()=>[M(c(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]=E=>o.form.settings.hide_members_count=E)},{default:d(()=>[M(c(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]=E=>o.form.settings.show_sidebar=E)},{default:d(()=>[M(c(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]=E=>o.form.settings.document_library=E)},{default:d(()=>[M(c(e.$t("Enable File/Document Library for this space"))+" ",1),e.has_pro?_("",!0):(n(),r("span",yg," ("+c(e.$t("Pro Feature"))+") ",1))]),_:1},8,["disabled","modelValue"]),o.form.settings.document_library=="yes"?(n(),r("div",vg,[a(h,{label:e.$t("Document Library Access (View & Download)")},{default:d(()=>[a(C,{modelValue:o.form.settings.document_access,"onUpdate:modelValue":t[16]||(t[16]=E=>o.form.settings.document_access=E),class:"fcom_radio_group_inline"},{default:d(()=>[a(w,{value:"members_only"},{default:d(()=>[M(c(e.$t("Members of this space")),1)]),_:1}),a(w,{value:"logged_in"},{default:d(()=>[M(c(e.$t("Any Logged in users")),1)]),_:1}),a(w,{value:"everybody"},{default:d(()=>[M(c(e.$t("Public")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Who can upload the documents?")},{default:d(()=>[a(C,{modelValue:o.form.settings.document_upload,"onUpdate:modelValue":t[17]||(t[17]=E=>o.form.settings.document_upload=E),class:"fcom_radio_group_inline"},{default:d(()=>[a(w,{value:"members_only"},{default:d(()=>[M(c(e.$t("Any Members")),1)]),_:1}),a(w,{value:"admin_only"},{default:d(()=>[M(c(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]=E=>o.form.settings.media_gallery=E)},{default:d(()=>[M(c(e.$t("Enable Media Gallery for this space"))+" ",1),e.has_pro?_("",!0):(n(),r("span",bg," ("+c(e.$t("Pro Feature"))+") ",1))]),_:1},8,["disabled","modelValue"]),e.has_pro&&o.form.settings.media_gallery=="yes"?(n(),r("div",kg,[a(h,{label:e.$t("Media Gallery Access (View)")},{default:d(()=>[a(C,{modelValue:o.form.settings.media_access,"onUpdate:modelValue":t[19]||(t[19]=E=>o.form.settings.media_access=E),class:"fcom_radio_group_inline"},{default:d(()=>[a(w,{value:"members_only"},{default:d(()=>[M(c(e.$t("Members of this space")),1)]),_:1}),a(w,{value:"logged_in"},{default:d(()=>[M(c(e.$t("Any Logged in users")),1)]),_:1}),a(w,{value:"everybody"},{default:d(()=>[M(c(e.$t("Public")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])])):_("",!0)])]),_:1}),a(h,{label:e.$t("Default Post Sort By")},{default:d(()=>[a($,{modelValue:o.form.settings.default_post_sort_by,"onUpdate:modelValue":t[20]||(t[20]=E=>o.form.settings.default_post_sort_by=E),clearable:"",class:"fcom_select",placeholder:e.$t("Latest Posts Sort")},{default:d(()=>[(n(!0),r(F,null,R(o.postOrderOptions,(E,J)=>(n(),y(b,{key:J,value:J,label:E},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]=E=>o.form.settings.disable_post_sort_by=E)},{default:d(()=>[M(c(e.$t("Disable Post Sort By Options")),1)]),_:1},8,["modelValue"]),a(h,{label:e.$t("Default Comment Sort By")},{default:d(()=>[a($,{modelValue:o.form.settings.default_comment_sort_by,"onUpdate:modelValue":t[22]||(t[22]=E=>o.form.settings.default_comment_sort_by=E),clearable:"",class:"fcom_select",placeholder:e.$t("Latest Comments Sort")},{default:d(()=>[(n(!0),r(F,null,R(o.commentOrderOptions,(E,J)=>(n(),y(b,{key:J,value:J,label:E},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])])):_("",!0),l("div",wg,[l("h4",null,c(e.$t("Layout")),1),a(h,{label:e.$t("Default Layout Styles"),class:"fcom_mb_10"},{default:d(()=>[a(C,{modelValue:o.form.settings.layout_style,"onUpdate:modelValue":t[23]||(t[23]=E=>o.form.settings.layout_style=E),class:"fcom_svg_radio_group"},{default:d(()=>[l("div",Cg,[a(w,{value:"timeline"},{default:d(()=>[a(S,{style:{width:"100px",height:"auto"}}),l("p",$g,c(e.$t("Timeline")),1)]),_:1})]),l("div",Sg,[a(w,{value:"list"},{default:d(()=>[a(T,{style:{width:"100px",height:"auto"}}),l("p",Vg,c(e.$t("List")),1)]),_:1})]),l("div",Mg,[a(w,{value:"card"},{default:d(()=>[a(V,{style:{width:"100px",height:"auto"}}),l("p",Lg,c(e.$t("Card")),1)]),_:1})])]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(h,{style:{"margin-top":"0"}},{default:d(()=>[a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.disable_layout_style,"onUpdate:modelValue":t[24]||(t[24]=E=>o.form.settings.disable_layout_style=E)},{default:d(()=>[M(c(e.$t("Disable Layout Style Change Option")),1)]),_:1},8,["modelValue"]),l("div",Tg,[o.form.settings.disable_layout_style==="yes"?(n(),r("p",Fg,c(e.$t("The selected layout will be applied for all members. They cannot switch to a different view.")),1)):(n(),r("p",Ig,c(e.$t("User can change the layout style to their own preference.")),1))])]),_:1})]),l("div",Pg,[l("h4",null,c(e.$t("Others")),1),e.has_pro&&o.dataLoaded?(n(),y(h,{key:0,label:e.$t("Topic navigation")},{default:d(()=>[a(P,{creatable:!0,space_id:o.form.id,modelValue:o.form.topic_ids,"onUpdate:modelValue":t[25]||(t[25]=E=>o.form.topic_ids=E)},null,8,["space_id","modelValue"]),l("div",Eg,[l("p",null,[M(c(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(),r("a",{key:0,target:"_blank",rel:"noopener",href:e.$getRouteLink("admin/settings/topics-settings")},c(e.$t("Manage all topics.")),9,Ag)):_("",!0)])]),a(v,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.topic_required,"onUpdate:modelValue":t[26]||(t[26]=E=>o.form.settings.topic_required=E),class:"fcom_checkbox"},{default:d(()=>[M(c(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("Space Chat")},{default:d(()=>[a(v,{"true-value":"yes","false-value":"no",modelValue:o.form.group_chat_support,"onUpdate:modelValue":t[27]||(t[27]=E=>o.form.group_chat_support=E),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Enable chat for this space's members")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Thumbnail / Open Graph Image (Recommended Size: 1200 x 630)")},{default:d(()=>[o.form.settings.og_image?(n(),y(L,{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",Ug,[a(N,{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]=E=>{o.form.settings.og_image=E})},ye({remove:d(()=>[a(A,null,{default:d(()=>[a(B)]),_:1})]),_:2},[o.form.settings.og_image?{name:"trigger",fn:d(()=>[a(U,{"aria-label":e.$t("Edit image"),class:"fcom_plain_button"},{default:d(()=>[a(A,null,{default:d(()=>[a(x)]),_:1})]),_:1},8,["aria-label"])]),key:"0"}:void 0]),1032,["can_remove"])]),l("div",Bg,[l("p",null,c(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:d(()=>[o.form.cover_photo?(n(),y(L,{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",Dg,[a(N,{isTextBtn:!1,removeIcon:!0,can_remove:!!o.form.cover_photo,confirm_remove:!0,additionalData:{resize:!0,max_width:1600},onUploaded:i.handleCoverPhotoUpload},ye({remove:d(()=>[a(A,null,{default:d(()=>[a(B)]),_:1})]),_:2},[o.form.cover_photo?{name:"trigger",fn:d(()=>[a(U,{class:"fcom_plain_button"},{default:d(()=>[a(A,null,{default:d(()=>[a(x)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove","onUploaded"])]),l("div",Rg,[l("p",null,c(e.$t("If you add this image, it will be shown on the space homepage")),1)])]),_:1},8,["label"]),a(H,{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:d(()=>[l("div",xg,[o.showingSections.indexOf("basic")===-1?(n(),y(U,{key:0,class:"plain_button",text:"",onClick:t[29]||(t[29]=()=>{o.showingSections=["basic"]})},{default:d(()=>[l("span",null,c(e.$t("Go Back")),1)]),_:1})):_("",!0),Y((n(),y(U,{class:"fcom_primary_button",disabled:o.saving,onClick:t[30]||(t[30]=E=>i.submit())},{default:d(()=>[l("span",null,c(e.$t("Create")),1)]),_:1},8,["disabled"])),[[ne,o.saving]])])]),_:1}))])],64)):(n(),r(F,{key:2},[a(H,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),a(h,null,{default:d(()=>[l("div",Og,[t[34]||(t[34]=l("span",null,null,-1)),a(U,{onClick:t[31]||(t[31]=E=>i.goToCustomization()),class:"fcom_primary_button"},{default:d(()=>[l("span",null,c(e.$t("Next")),1)]),_:1})])]),_:1})],64))]),_:1},8,["modelValue"]),Y((n(),r("div",null,[o.metaSettings&&Object.keys(o.metaSettings).length>0?(n(),r("div",Hg,[(n(!0),r(F,null,R(o.metaSettings,E=>(n(),r("div",jg,[l("h4",null,c(E.section_title),1),a(G,{formData:E.settings,formFields:E.fields,disableSubmit:!0},null,8,["formData","formFields"])]))),256))])):_("",!0)])),[[ne,o.fetchingMetaBoxes]])])}const _s=I(lg,[["render",Ng]]),zg={name:"CreateCorseForm",components:{FormBuilder:$o,SpaceGroupSelector:us,TopicSelector:Co,SlugInput:At,ImageUploader:Re,LogoEmojiSelector:cs,ErrorAlerts:Ut,CrepeEditor:as},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:Nc,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:zc,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})}},qg={key:0},Gg={class:"fcom_form_section"},Yg={class:"fcom_help_text"},Wg={class:"fcom_help_text"},Kg={class:"fcom_form_section"},Zg={style:{"font-weight":"bold"}},Qg={key:0},Jg={class:"fcom_help_text"},Xg={style:{"font-weight":"bold"}},ey={class:"fcom_form_section"},ty={class:"fcom_lined_checkboxes"},sy={class:"fcom_checkbox_with_tooltip"},oy={key:0},iy={key:0},ny={class:"fcom_help_text"},ly={key:0,class:"fcom_form_section"},ay={class:"fcom_select_photo",style:{float:"left"}},ry=["src","alt"],dy={style:{float:"right",color:"#8492a6","font-size":"13px"}},cy={class:"fcom_lined_checkboxes"},uy={class:"fcom_form_section"},_y={class:"fcom_help_text"},my=["href"],hy={class:"fcom_image_uploader_wrapper"},fy={class:"fcom_help_text"},py={class:"fcom_space_form_bottom"},gy={key:0},yy={class:"fcom_form_section fcom_mt_20"},vy={key:1},by=["href"];function ky(e,t,s,u,o,i){const m=g("logo-emoji-selector"),f=oe,h=pe,p=g("SlugInput"),k=g("crepe-editor"),b=g("space-group-selector"),$=Qe,w=be,C=le,v=ae,S=ve,T=g("InfoFilled"),V=j,P=Ee,L=g("topic-selector"),x=Ie,A=g("EditPen"),U=O,B=g("Delete"),N=g("ImageUploader"),H=g("error-alerts"),z=ge,G=g("form-builder"),ne=se("loading");return e.hasFeature("has_course")?(n(),r("div",qg,[a(z,{onSubmit:t[23]||(t[23]=q(E=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[24]||(t[24]=E=>o.form=E),"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[l("div",Gg,[l("h4",null,c(e.$t("General")),1),a(h,{label:e.$t("Course Title"),required:""},{default:d(()=>[a(f,{type:"text",ref:"titleInput",placeholder:e.$t("Your Course Title"),modelValue:o.form.title,"onUpdate:modelValue":t[1]||(t[1]=E=>o.form.title=E)},{prepend:d(()=>{var E,J;return[o.dataLoaded?(n(),y(m,{key:0,custom_svg:!0,config:{logo:o.form.logo,emoji:(E=o.form.settings)==null?void 0:E.emoji,shape_svg:((J=o.form.settings)==null?void 0:J.shape_svg)||""},onUpdate:t[0]||(t[0]=ce=>{o.form.settings.emoji=ce.emoji,o.form.logo=ce.logo,o.form.settings.shape_svg=ce.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:d(()=>[a(p,{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]=E=>o.form.slug=E),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:d(()=>[a(f,{type:"textarea",placeholder:e.$t("Course Description"),modelValue:o.form.description,"onUpdate:modelValue":t[3]||(t[3]=E=>o.form.description=E)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{class:"form_label_with_tooltip",label:e.$t("Course Details")},{default:d(()=>[o.appReady?(n(),y(k,{key:0,modelValue:o.form.settings.course_details,"onUpdate:modelValue":t[4]||(t[4]=E=>o.form.settings.course_details=E),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",Yg,[l("p",null,c(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:d(()=>[o.dataLoaded?(n(),y(b,{key:0,modelValue:o.form.parent_id,"onUpdate:modelValue":t[5]||(t[5]=E=>o.form.parent_id=E),space_id:o.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",Wg,[l("p",null,c(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:d(()=>[a(w,{modelValue:o.form.status,"onUpdate:modelValue":t[6]||(t[6]=E=>o.form.status=E),class:"fcom_radio_group"},{default:d(()=>[a($,{value:"published"},{default:d(()=>[M(c(e.$t("Published")),1)]),_:1}),a($,{value:"draft"},{default:d(()=>[M(c(e.$t("Draft")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])]),l("div",Kg,[l("h4",null,c(e.$t("Access Control")),1),a(h,{label:e.$t("Privacy")},{default:d(()=>[a(v,{"popper-class":"rich_select",modelValue:o.form.privacy,"onUpdate:modelValue":t[7]||(t[7]=E=>o.form.privacy=E),placeholder:e.$t("Select Privacy")},{default:d(()=>[(n(!0),r(F,null,R(o.privacies,(E,J)=>(n(),y(C,{key:J,label:E.label,value:J},{default:d(()=>[l("span",Zg,c(E.label),1),l("p",null,c(E.description),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),o.form.privacy=="private"?(n(),r(F,{key:0},[a(h,{label:e.$t("Lock Screen Type")},{default:d(()=>[a(w,{modelValue:o.form.settings.custom_lock_screen,"onUpdate:modelValue":t[8]||(t[8]=E=>o.form.settings.custom_lock_screen=E),class:"fcom_radio_group"},{default:d(()=>[a($,{value:"yes"},{default:d(()=>[M(c(e.$t("Custom")),1)]),_:1}),a($,{value:"no"},{default:d(()=>[M(c(e.$t("Default")),1)]),_:1}),a($,{disabled:!e.has_pro,value:"redirect"},{default:d(()=>[M(c(e.$t("Redirect to an URL"))+" ",1),e.has_pro?_("",!0):(n(),r("span",Qg,"("+c(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:d(()=>[a(f,{modelValue:o.form.settings.onboard_redirect_url,"onUpdate:modelValue":t[9]||(t[9]=E=>o.form.settings.onboard_redirect_url=E),type:"text",placeholder:e.$t("Redirect URL for unenrolled users")},null,8,["modelValue","placeholder"]),l("div",Jg,[l("p",null,c(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:d(()=>[a(S,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_paywalls,"onUpdate:modelValue":t[10]||(t[10]=E=>o.form.settings.show_paywalls=E),class:"fcom_checkbox"},{default:d(()=>[M(c(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:d(()=>[a(S,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_welcome_banner,"onUpdate:modelValue":t[11]||(t[11]=E=>o.form.settings.show_welcome_banner=E),class:"fcom_checkbox"},{default:d(()=>[M(c(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:d(()=>[a(v,{"popper-class":"rich_select",modelValue:o.form.course_type,"onUpdate:modelValue":t[12]||(t[12]=E=>o.form.course_type=E),placeholder:e.$t("Select Type")},{default:d(()=>[(n(!0),r(F,null,R(o.courseTypes,(E,J)=>(n(),y(C,{key:J,label:E.label,value:J},{default:d(()=>[l("span",Xg,c(E.label),1),l("p",null,c(E.description),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),l("div",ey,[l("h4",null,c(e.$t("Features Customizations")),1),a(h,null,{default:d(()=>[l("div",ty,[o.form.privacy=="public"&&o.form.course_type=="self_paced"?(n(),y(S,{key:0,"true-value":"yes","false-value":"no",modelValue:o.form.settings.public_lesson_view,"onUpdate:modelValue":t[13]||(t[13]=E=>o.form.settings.public_lesson_view=E),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Public users can view the lessons without enrolling in the course")),1)]),_:1},8,["modelValue"])):_("",!0),a(S,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.disable_comments,"onUpdate:modelValue":t[14]||(t[14]=E=>o.form.settings.disable_comments=E),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Disable comments for all the lessons for this course")),1)]),_:1},8,["modelValue"]),a(S,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.hide_members_count,"onUpdate:modelValue":t[15]||(t[15]=E=>o.form.settings.hide_members_count=E),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Hide students count from courses page")),1)]),_:1},8,["modelValue"]),l("div",sy,[a(S,{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]=E=>{o.form.settings.sequential_lesson_order=E}),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Lesson order enforcement"))+" ",1),e.has_pro?_("",!0):(n(),r("span",oy,"("+c(e.$t("Pro Required"))+")",1))]),_:1},8,["disabled","model-value"]),a(P,{class:"box-item fcom_checkbox_tooltip",effect:"dark",placement:"right-end"},{content:d(()=>[M(c(e.$t("Your members will have to complete each lesson")),1),t[25]||(t[25]=l("br",null,null,-1)),M(" "+c(e.$t("in order before moving onto the next one.")),1)]),default:d(()=>[a(V,null,{default:d(()=>[a(T)]),_:1})]),_:1})])])]),_:1}),a(h,{label:e.$t("Course Layout")},{default:d(()=>[a(w,{modelValue:o.form.settings.course_layout,"onUpdate:modelValue":t[17]||(t[17]=E=>o.form.settings.course_layout=E),class:"fcom_radio_group"},{default:d(()=>[a($,{value:"classic"},{default:d(()=>[M(c(e.$t("Classic")),1)]),_:1}),a($,{disabled:!e.has_pro,value:"modern"},{default:d(()=>[M(c(e.$t("Modern"))+" ",1),e.has_pro?_("",!0):(n(),r("span",iy,"("+c(e.$t("Available on Pro"))+")",1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),l("div",ny,[l("p",null,c(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(),r("div",ly,[l("h4",null,c(e.$t("Course Instructor")),1),a(h,{label:e.$t("Instructor")},{default:d(()=>[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]=E=>o.form.created_by=E)},{default:d(()=>[(n(!0),r(F,null,R(o.courseInstructors,E=>(n(),y(C,{class:"fcom_with_photo_option",key:E.ID,label:E.display_name+" ("+(E.user_email||E.ID)+")",value:E.ID},{default:d(()=>[l("span",ay,[l("img",{src:E.photo,alt:E.display_name},null,8,ry),l("span",null,c(E.display_name),1)]),l("span",dy,c(E.user_email||E.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["disabled","loading","remote-method","placeholder","modelValue"])]),_:1},8,["label"]),a(h,null,{default:d(()=>[l("div",cy,[a(S,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.hide_instructor_view,"onUpdate:modelValue":t[19]||(t[19]=E=>o.form.settings.hide_instructor_view=E),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Hide course instructor view from course overview page")),1)]),_:1},8,["modelValue"]),o.form.settings.hide_instructor_view!="yes"?(n(),y(S,{key:0,"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_instructor_students_count,"onUpdate:modelValue":t[20]||(t[20]=E=>o.form.settings.show_instructor_students_count=E),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Show students count in course instructor view")),1)]),_:1},8,["modelValue"])):_("",!0)])]),_:1})])):_("",!0),l("div",uy,[l("h4",null,c(e.$t("Others")),1),e.has_pro&&o.dataLoaded?(n(),y(h,{key:0,label:e.$t("Topic navigation")},{default:d(()=>[a(L,{modelValue:o.form.category_ids,"onUpdate:modelValue":t[21]||(t[21]=E=>o.form.category_ids=E),creatable:!0},null,8,["modelValue"]),l("div",_y,[l("p",null,c(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(),r("a",{key:0,target:"_blank",rel:"noopener",href:e.$getRouteLink("admin/settings/topics-settings")},c(e.$t("Manage all topics")),9,my)):_("",!0)])])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Thumbnail / Open Graph Image (Recommended Size: 1200 x 630)")},{default:d(()=>[o.form.cover_photo?(n(),y(x,{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",hy,[a(N,{isTextBtn:!1,can_remove:!!o.form.cover_photo,additionalData:{resize:!1,disable_convert:"yes",max_width:1200,max_height:630},onUploaded:i.handlePhotoUpload},ye({remove:d(()=>[a(V,null,{default:d(()=>[a(B)]),_:1})]),_:2},[o.form.cover_photo?{name:"trigger",fn:d(()=>[a(U,{class:"fcom_plain_button"},{default:d(()=>[a(V,null,{default:d(()=>[a(A)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove","onUploaded"])]),l("div",fy,[l("p",null,c(e.$t("Will be used on course card preview and social sharing preview.")),1)])]),_:1},8,["label"]),a(H,{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:d(()=>[l("div",py,[t[26]||(t[26]=l("span",null,null,-1)),a(U,{class:"fcom_primary_button",disabled:o.saving,onClick:t[22]||(t[22]=E=>i.submit()),loading:o.saving},{default:d(()=>[l("span",null,c(e.$t("Create")),1)]),_:1},8,["disabled","loading"])])]),_:1}))])]),_:1},8,["modelValue"]),Y((n(),r("div",null,[o.metaSettings&&Object.keys(o.metaSettings).length>0?(n(),r("div",gy,[(n(!0),r(F,null,R(o.metaSettings,E=>(n(),r("div",yy,[l("h4",null,c(E.section_title),1),a(G,{formData:E.settings,formFields:E.fields,disableSubmit:!0},null,8,["formData","formFields"])]))),256))])):_("",!0)])),[[ne,o.fetchingMetaBoxes]])])):(n(),r("div",vy,[l("p",null,c(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")},c(e.$t("Go to features settings")),9,by)]))}const wy=I(zg,[["render",ky]]),Cy={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}},$y={key:0,class:"fcom_space_title"},Sy={key:0},Vy={key:1};function My(e,t,s,u,o,i){const m=g("SpaceIcon"),f=le,h=Zt,p=ae,k=se("loading");return o.app_ready?(n(),y(p,{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:d(()=>[(n(!0),r(F,null,R(o.formattedSpaceGroups,b=>Y((n(),y(h,{key:b.label,label:b.label},{default:d(()=>[(n(!0),r(F,null,R(b.spaces,$=>(n(),y(f,{key:$.slug,label:$.title,disabled:i.isMemberOfSpace($.id),value:$.id.toString()},{default:d(()=>[$.id?(n(),r("span",$y,[a(m,{space_profile:$},null,8,["space_profile"]),l("span",null,[M(c(e.getExcerpt($.title,50))+" ",1),$.type=="course"?(n(),r("span",Sy," ("+c(e.$t("course"))+")",1)):_("",!0)])])):(n(),r("span",Vy,c(e.getExcerpt($.title,50)),1))]),_:2},1032,["label","disabled","value"]))),128))]),_:2},1032,["label"])),[[k,o.loading]])),128))]),_:1},8,["onChange","modelValue","multiple","placeholder"])):_("",!0)}const ms=I(Cy,[["render",My]]),Ly={name:"SidebarLinkForm",components:{SpaceGroupSelector:us,LogoEmojiSelector:cs,SpaceCourseSelector:ms,ErrorAlerts:Ut},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}},Ty={class:"fcom_form_section"},Fy={class:"fcom_help_text"},Iy={class:"fcom_help_text"},Py={class:"fcom_help_text"},Ey={key:0},Ay={key:1};function Uy(e,t,s,u,o,i){const m=g("logo-emoji-selector"),f=oe,h=pe,p=ve,k=g("space-group-selector"),b=Qe,$=be,w=g("SpaceCourseSelector"),C=g("error-alerts"),v=O,S=ge,T=se("loading");return n(),y(S,{onSubmit:t[8]||(t[8]=q(V=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[9]||(t[9]=V=>o.form=V),"label-position":"top","require-asterisk-position":"right",class:"fcom_space_form"},{default:d(()=>[l("div",Ty,[a(h,{label:e.$t("Link Title"),required:""},{default:d(()=>[a(f,{type:"text",placeholder:e.$t("Your Link Title"),modelValue:o.form.title,"onUpdate:modelValue":t[1]||(t[1]=V=>o.form.title=V)},{prepend:d(()=>{var V,P;return[o.dataLoaded?(n(),y(m,{key:0,custom_svg:!0,onUpdate:t[0]||(t[0]=L=>{o.form.settings.emoji=L.emoji,o.form.logo=L.logo,o.form.settings.shape_svg=L.shape_svg}),config:{logo:o.form.logo,emoji:((V=o.form.settings)==null?void 0:V.emoji)||"",shape_svg:((P=o.form.settings)==null?void 0:P.shape_svg)||""}},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Permalink"),required:""},{default:d(()=>[a(f,{placeholder:e.$t("URL of the link"),modelValue:o.form.settings.permalink,"onUpdate:modelValue":t[2]||(t[2]=V=>o.form.settings.permalink=V)},null,8,["placeholder","modelValue"]),l("div",Fy,[a(p,{modelValue:o.form.settings.new_tab,"onUpdate:modelValue":t[3]||(t[3]=V=>o.form.settings.new_tab=V),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Open this link in new tab")),1)]),_:1},8,["modelValue"])])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:d(()=>[o.dataLoaded?(n(),y(k,{key:0,modelValue:o.form.parent_id,"onUpdate:modelValue":t[4]||(t[4]=V=>o.form.parent_id=V),space_id:o.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",Iy,[l("p",null,c(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:d(()=>[a($,{modelValue:o.form.privacy,"onUpdate:modelValue":t[5]||(t[5]=V=>o.form.privacy=V)},{default:d(()=>[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",Py,[l("p",null,c(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:d(()=>[a(w,{modelValue:o.form.settings.membership_ids,"onUpdate:modelValue":t[6]||(t[6]=V=>o.form.settings.membership_ids=V),placeholder_text:e.$t("Select Memberships"),is_multiple:!0},null,8,["modelValue","placeholder_text"])]),_:1},8,["label"])):_("",!0),a(C,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),a(h,{style:{"margin-top":"45px"}},{default:d(()=>[Y((n(),y(v,{class:"fcom_primary_button",disabled:o.saving,onClick:t[7]||(t[7]=V=>i.saveSettings())},{default:d(()=>[o.form.id?(n(),r("span",Ey,c(e.$t("Update")),1)):(n(),r("span",Ay,c(e.$t("Create Link")),1))]),_:1},8,["disabled"])),[[T,o.saving]])]),_:1})])]),_:1},8,["modelValue"])}const By=I(Ly,[["render",Uy]]),Dy={name:"SpaceIcon"},Ry={version:"1.1",viewBox:"0 0 128 128","xml:space":"preserve"};function xy(e,t,s,u,o,i){return n(),r("svg",Ry,[...t[0]||(t[0]=[Le('',1)])])}const Oy=I(Dy,[["render",xy]]),Hy={name:"CourseIcon"},jy={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Ny(e,t,s,u,o,i){return n(),r("svg",jy,[...t[0]||(t[0]=[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),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)])])}const zy=I(Hy,[["render",Ny]]),qy={name:"SpaceCreateModal",components:{Drawer:wo,CreateSpaceForm:_s,CreateCourseForm:wy,SidebarLinkForm:By,ArrowLeftBold:Ws,SpaceIcon:Oy,CourseIcon:zy,Link:Ks},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})})}},Gy={class:"dialog_header"},Yy={class:"dialog_left"},Wy={class:"dialog_body"},Ky={key:0,class:"space-type-selector"},Zy={class:"space-cards"},Qy={class:"space-card-label"},Jy={class:"space-card-label"},Xy={key:0,class:"space-card-note"},ev={class:"space-card-label"},tv={key:0,class:"space-card-note"},sv={class:"dialog_footer"};function ov(e,t,s,u,o,i){const m=g("ArrowLeftBold"),f=j,h=O,p=g("SpaceIcon"),k=g("CourseIcon"),b=g("Link"),$=g("create-space-form"),w=g("create-course-form"),C=g("sidebar-link-form"),v=g("Drawer");return n(),y(v,{modelValue:o.showCreateSpaceModal,"onUpdate:modelValue":t[5]||(t[5]=S=>o.showCreateSpaceModal=S),size:e.drawerWidth,"close-on-click-modal":!0,"has-close-confirmation":o.enteredForm,"close-confirmation-message":i.leaveMessage,drawerClass:"fcom_space_create_drawer"},ye({header:d(()=>[l("div",Gy,[l("div",Yy,[o.step!="choose_type"?(n(),y(h,{key:0,"aria-label":e.$t("Back"),onClick:t[0]||(t[0]=S=>o.step="choose_type"),text:"",size:"small"},{default:d(()=>[a(f,null,{default:d(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])):_("",!0),l("h4",null,c(i.currentTitle),1)])])]),default:d(()=>[l("div",Wy,[o.step=="choose_type"?(n(),r("div",Ky,[l("div",Zy,[l("div",{onClick:t[1]||(t[1]=S=>o.select_type="space_form"),class:D([{"is-active":o.select_type==="space_form"},"space-card"])},[a(f,{class:"space-card-icon"},{default:d(()=>[a(p)]),_:1}),l("span",Qy,c(e.$t("Discussion Space")),1)],2),l("div",{onClick:t[2]||(t[2]=S=>!!e.hasFeature("has_course")&&(o.select_type="course_form")),class:D([{"is-active":o.select_type==="course_form","is-disabled":!e.hasFeature("has_course")},"space-card"])},[a(f,{class:"space-card-icon"},{default:d(()=>[a(k)]),_:1}),l("span",Jy,c(e.$t("Course")),1),e.hasFeature("has_course")?_("",!0):(n(),r("span",Xy,c(e.$t("Course Module is disabled")),1))],2),l("div",{onClick:t[3]||(t[3]=S=>!!e.appVars.pro&&(o.select_type="link_form")),class:D([{"is-active":o.select_type==="link_form","is-disabled":!e.appVars.pro},"space-card"])},[a(f,{class:"space-card-icon"},{default:d(()=>[a(b)]),_:1}),l("span",ev,c(e.$t("Link")),1),e.appVars.pro?_("",!0):(n(),r("span",tv,c(e.$t("Pro Required")),1))],2)])])):o.step=="space_form"?(n(),y($,{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(w,{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(C,{key:3,parent_id:o.parent_id,onCompleted:i.handleCompleted},null,8,["parent_id","onCompleted"])):_("",!0)])]),_:2},[o.step=="choose_type"?{name:"footer",fn:d(()=>[l("div",sv,[a(h,{disabled:!o.select_type,class:"fcom_primary_button",onClick:t[4]||(t[4]=S=>i.handleNextStep())},{default:d(()=>[M(c(e.$t("Next")),1)]),_:1},8,["disabled"])])]),key:"0"}:void 0]),1032,["modelValue","size","has-close-confirmation","close-confirmation-message"])}const iv=I(qy,[["render",ov]]),nv={name:"ExpandIcon"},lv={xmlns:"http://www.w3.org/2000/svg",id:"icon-20-expand",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function av(e,t,s,u,o,i){return n(),r("svg",lv,[...t[0]||(t[0]=[l("path",{d:"M14 2H18V6",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M12 8L18 2",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M6 18H2V14",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M8 12L2 18",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const hs=I(nv,[["render",av]]),rv={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)}},dv={class:"dialog_header"},cv={class:"dialog_left"},uv={class:"dialog_body"},_v={class:"fcom_report_content_form"},mv={class:"dialog_footer"};function hv(e,t,s,u,o,i){const m=le,f=ae,h=pe,p=oe,k=ge,b=O,$=ke;return o.showModal?(n(),y($,{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]=w=>o.showModal=w),direction:"rtl",onClose:i.closeModal},{header:d(()=>[l("div",dv,[l("div",cv,[l("h4",null,c(i.currentTitle),1)])])]),footer:d(()=>[l("div",mv,[a(b,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=w=>i.closeModal())},{default:d(()=>[M(c(e.$t("Cancel")),1)]),_:1}),a(b,{class:"fcom_primary_button",onClick:t[3]||(t[3]=w=>i.validateAndSubmit()),loading:o.saving},{default:d(()=>[M(c(e.$t("Report")),1)]),_:1},8,["loading"])])]),default:d(()=>[l("div",uv,[l("div",_v,[a(k,{ref:"reportForm","label-position":"top"},{default:d(()=>[a(h,{label:e.$t("Reason")},{default:d(()=>[a(f,{modelValue:o.reportReason,"onUpdate:modelValue":t[0]||(t[0]=w=>o.reportReason=w),placeholder:e.$t("Please select a reason for reporting this content")},{default:d(()=>[(n(!0),r(F,null,R(e.appVars.report_reasons,(w,C)=>(n(),y(m,{key:C,label:w,value:C},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(h,{label:e.$t("Explanation")},{default:d(()=>[a(p,{modelValue:o.reportExplanation,"onUpdate:modelValue":t[1]||(t[1]=w=>o.reportExplanation=w),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 fv=I(rv,[["render",hv]]),pv={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")}}},gv={class:"fcom_pagination_wrap"};function yv(e,t,s,u,o,i){const m=Wo;return n(),r("div",gv,[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(pv,[["render",yv]]),vv={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)}},bv={class:"dialog_body"},kv={class:"report_details"},wv={class:"report_details_header"},Cv={class:"report_details_header_left"},$v={class:"report_details_header_right"},Sv={key:0},Vv={key:1},Mv={key:1},Lv={class:"report_reason"},Tv=["title"],Fv={key:0,class:"report_details_body"},Iv=["textContent"],Pv=["aria-label"],Ev={class:"dialog_footer report_footer"};function Av(e,t,s,u,o,i){const m=g("UserAvatar"),f=g("UserRouteLink"),h=Q,p=g("Pagination"),k=O,b=ke;return n(),y(b,{modelValue:o.isOpen,"onUpdate:modelValue":t[3]||(t[3]=$=>o.isOpen=$),"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:d(()=>[l("div",Ev,[a(k,{class:"fcom_secondary_button",onClick:t[1]||(t[1]=$=>i.unpublishReport()),loading:o.unpublishing,disabled:!o.loading&&!o.report},{default:d(()=>[M(c(i.getUnpublishBtnText),1)]),_:1},8,["loading","disabled"]),a(k,{class:"fcom_primary_button",onClick:t[2]||(t[2]=$=>i.ignoreReport()),loading:o.ignoring,disabled:!o.loading&&!o.report},{default:d(()=>[M(c(i.getPublishBtnText),1)]),_:1},8,["loading","disabled"])])]),default:d(()=>{var $,w;return[l("div",bv,[l("h4",null,c(e.$t("Reports")+" ("+((w=($=o.content)==null?void 0:$.meta)==null?void 0:w.reports_count)+")"),1),l("div",kv,[o.loading?(n(),y(h,{key:1,rows:5,animated:!0})):(n(!0),r(F,{key:0},R(o.postReports,C=>(n(),r("div",{key:C.id,class:"report_details_item"},[l("div",wv,[l("div",Cv,[C.reporter?(n(),y(m,{key:0,with_level:!1,xprofile:C.reporter},null,8,["xprofile"])):_("",!0)]),l("div",$v,[!C.reporter&&!i.getReason(C.reason)?(n(),r("div",Sv,c(e.$t("Flagged automatically by the site rule")),1)):(n(),r("div",Vv,[C.reporter?(n(),y(f,{key:0,show_verified:!1,xprofile:C.reporter},null,8,["xprofile"])):(n(),r("span",Mv,c(e.$t("By System ")),1)),i.getReason(C.reason)?(n(),r(F,{key:2},[l("span",null,c(e.$t("reported for ")),1),l("span",Lv,c(i.getReason(C.reason)),1)],64)):_("",!0)])),l("div",{title:C.created_at,class:"meta_line"},c(e.humanDateDiff(C.created_at)),9,Tv)])]),C.explanation?(n(),r("div",Fv,[l("div",{textContent:c(C.explanation)},null,8,Iv)])):_("",!0)]))),128)),o.pagination.total?(n(),r("div",{key:2,role:"region","aria-label":e.$t("Pagination"),class:"pagination_wrap"},[a(p,{hide_on_single:!0,onFetch:t[0]||(t[0]=C=>i.getPostReports()),pagination:o.pagination},null,8,["pagination"])],8,Pv)):_("",!0)])])]}),_:1},8,["modelValue","width","onClose"])}const Uv=I(vv,[["render",Av]]),Bv={name:"PreviewPostModal",components:{Feed:ot},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 Dv(e,t,s,u,o,i){const m=Q,f=O,h=g("Feed"),p=Pe,k=ke;return o.previewData?(n(),y(k,{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:d(()=>[a(p,{ref:"feed_dialog_scroller","max-height":"calc(100dvh - 40px)"},{default:d(()=>[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:d(()=>[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 Rv=I(Bv,[["render",Dv]]),xv={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)}},Ov={class:"dialog_header"},Hv={class:"dialog_left"},jv={class:"dialog_body"},Nv={class:"dialog_footer"};function zv(e,t,s,u,o,i){const m=O,f=ke;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:d(()=>[l("div",Ov,[l("div",Hv,[l("h4",null,c(e.$t("Leave Page?")),1)])])]),footer:d(()=>[l("div",Nv,[a(m,{class:"fcom_secondary_button",onClick:i.handleCancel},{default:d(()=>[M(c(e.$t("Cancel")),1)]),_:1},8,["onClick"]),a(m,{class:"fcom_primary_button",onClick:i.handleProceed},{default:d(()=>[M(c(e.$t("Leave")),1)]),_:1},8,["onClick"])])]),default:d(()=>[l("div",jv,[l("span",null,c(o.message),1)])]),_:1},8,["modelValue","width"])}const qv=I(xv,[["render",zv]]),Gv={name:"MentionPopover",components:{UserRouteLink:Te},setup(){return{userStore:Be()}},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 Yv(e,t,s,u,o,i){const m=g("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 Wv=I(Gv,[["render",Yv]]);let Kv=window.fluentComAdmin.el_i18n;for(const[e,t]of Object.entries(Kv))Hs.el[e]=t;const Zv={name:"PortalApplication",components:{NotificationsPop:ol,NotificationToaster:nl,SearchBar:m1,Feed:ot,SpaceCreateModal:iv,ReportContentModal:fv,ElConfigProvider:js,ExpandIcon:hs,ReportReviewModal:Uv,PreviewPostModal:Rv,UnfinishedChangesModal:qv,MentionPopover:Wv},setup(){const e=os(),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:Hs,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 p=0,k=h.length;p{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 p;if(h)try{(p=document.querySelector(f+h))==null||p.classList.add("router-link-exact-active")}catch(k){console.error(k)}};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:{markPushNotificationsRead(){this.$router.isReady().then(()=>{if(!this.$route.query.fcom_pn)return;const e=parseInt(this.$route.query.feed_id,10),t=new URL(window.location.href);["fcom_pn","feed_id","nc"].forEach(s=>t.searchParams.delete(s)),window.history.replaceState(window.history.state,"",t.href),e&&this.$post(`notifications/mark-read/${e}/by-feed-id`).then(s=>{this.$eventBus.emit("notification_count_updated",s.unread_notification_count)}).catch(()=>{})})},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.markPushNotificationsRead()),this.$watch("$route",e=>{e.name==="dashboard"&&(this.tickerDismissed=!1)})},beforeUnmount(){this.tickerStore.isActive&&(console.log("[App] Stopping Pinia ticker..."),this.tickerStore.stop())}},Qv={key:0,class:"fcom_new_ticker"},Jv={key:1,class:"fcom_mobile_menu"},Xv={class:"focm_menu_items"},e0=["innerHTML"],t0=["innerHTML"],s0=["href","aria-label"],o0=["innerHTML"],i0=["innerHTML"];function n0(e,t,s,u,o,i){const m=g("router-view"),f=j,h=g("router-link"),p=Ko,k=g("ExpandIcon"),b=O,$=g("feed"),w=Pe,C=ke,v=g("search-bar"),S=g("notifications-pop"),T=g("notification-toaster"),V=g("space-create-modal"),P=g("unfinished-changes-modal"),L=g("preview-post-modal"),x=g("report-content-modal"),A=g("report-review-modal"),U=g("mention-popover"),B=js;return n(),y(B,{locale:o.enLang},{default:d(()=>[a(m,{class:D(e.appVars.route_classes)},null,8,["class"]),(n(),y(xt,{to:"body"},[u.tickerStore.isActive&&i.newFeedsCount>0&&!o.tickerDismissed?(n(),r("div",Qv,[l("div",{onClick:t[0]||(t[0]=N=>i.routeToAllFeeds()),class:"fcom_ticker_menu"},c(e.$_n("A new post is available","%s new posts available",i.newFeedsCount)),1),l("div",{onClick:t[1]||(t[1]=N=>i.dismissTicker()),class:"fcom_ticker_dismiss"}," x ")])):_("",!0),o.mobileMenuItems&&o.mobileMenuItems.length?(n(),r("div",Jv,[l("div",Xv,[(n(!0),r(F,null,R(o.mobileMenuItems,N=>(n(),r("div",null,[N.route?(n(),y(h,{key:0,"aria-label":N.title||e.$t("Menu item"),class:"focm_menu_item",to:N.route},{default:d(()=>[a(f,null,{default:d(()=>[N.icon?(n(),y(Yt(N.icon),{key:0})):N.icon_svg?(n(),r("span",{key:1,innerHTML:N.icon_svg},null,8,e0)):_("",!0)]),_:2},1024),N.html?(n(),r("span",{key:0,innerHTML:N.html},null,8,t0)):_("",!0)]),_:2},1032,["aria-label","to"])):(n(),r("a",{key:1,href:N.permalink,"aria-label":N.title||e.$t("Menu item"),class:"focm_menu_item"},[N.icon_svg?(n(),y(f,{key:0},{default:d(()=>[l("span",{innerHTML:N.icon_svg},null,8,o0)]),_:2},1024)):_("",!0),l("span",{innerHTML:N.html},null,8,i0)],8,s0))]))),256))])])):_("",!0),a(C,{ref:"fcom_feed_modal","destroy-on-close":"",modelValue:o.shopPopFeed,"onUpdate:modelValue":t[2]||(t[2]=N=>o.shopPopFeed=N),"close-on-click-modal":!0,"close-on-press-escape":!0,"before-close":()=>{i.closeFeedModal()},class:"fcom_feed_modal",width:"100%"},{default:d(()=>[a(w,{ref:"feed_dialog_scroller","max-height":"calc(100dvh - 40px)"},{default:d(()=>[o.popFeed?(n(),y($,{key:0,onDeleted:i.handleModalFeedDelete,is_single:!0,feed:o.popFeed,is_modal:!0,show_report:!0},{after_feed_actions:d(()=>[a(p,{direction:"vertical"}),a(b,{"aria-label":e.$t("Expand"),onClick:i.gotToFeed,class:"no_pad_btn",text:""},{default:d(()=>[a(f,null,{default:d(()=>[a(k)]),_: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(xt,{key:0,to:".fcom_search_holder"},[a(v)])):_("",!0),o.hasNotificationHolder?(n(),y(xt,{key:1,to:".fcom_notification_holder"},[a(S)])):_("",!0),e.auth.user_id?(n(),y(T,{key:2})):_("",!0),e.isAdmin?(n(),y(V,{key:3})):_("",!0),a(P,{ref:"unfinishedChangesModal",onProceed:i.proceedCloseFeedModal},null,8,["onProceed"]),a(L),a(x),a(A),a(U)]),_:1},8,["locale"])}const l0=I(Zv,[["render",n0]]),a0={name:"ContentLayout",props:["title","content_class","wrapper_class"]},r0={key:0,class:"fhr_content_layout_header"},d0=["aria-label"],c0=["aria-label"];function u0(e,t,s,u,o,i){return n(),r("div",{class:D([s.wrapper_class,"fhr_content_layout"])},[K(e.$slots,"header",{},()=>[s.title?(n(),r("div",r0,[K(e.$slots,"title",{},()=>[l("h1",{role:"region","aria-label":e.$t("Page Title"),style:{cursor:"pointer"},onClick:t[0]||(t[0]=m=>e.$eventBus.emit("toTop")),class:"fhr_page_title"},c(s.title),9,d0)]),l("div",{role:"region","aria-label":e.$t("Actions"),class:"fhr_page_actions"},[K(e.$slots,"actions")],8,c0)])):_("",!0)]),K(e.$slots,"sub_header"),l("div",{class:D([s.content_class,"fhr_content_layout_body"])},[K(e.$slots,"default")],2)],2)}const we=I(a0,[["render",u0]]),_0={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"})}},m0={key:0,class:"dashboard_actions"},h0=["innerHTML"],f0={key:1};function p0(e,t,s,u,o,i){const m=g("layout");return n(),y(m,{title:o.greetings},{default:d(()=>[o.notices.length?(n(),r("div",m0,[l("h4",null,c(e.$t("Action required")),1),l("ul",null,[(n(!0),r(F,null,R(o.notices,f=>(n(),r("li",{innerHTML:f},null,8,h0))),256))])])):(n(),r("div",f0,[l("p",null,c(e.$t("All is well! This dashboard will be updated with something awesome!")),1)]))]),_:1},8,["title"])}const g0=I(_0,[["render",p0]]),y0={name:"AppLayout",props:["wrapper_class"]},v0={class:"feeds_main"};function b0(e,t,s,u,o,i){const m=g("router-view");return n(),r("div",{class:D([s.wrapper_class,"feeds fcom_feeds"])},[l("div",v0,[K(e.$slots,"before_route_view"),K(e.$slots,"default",{},()=>[a(m)]),K(e.$slots,"after_route_view")])],2)}const Se=I(y0,[["render",b0]]),k0={name:"RecentActivities",components:{NotificationOnboard:is},props:{context:{default(){return{}}},prompt_placement:{type:String,default:"feed_sidebar"},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)}},w0=["innerHTML"],C0={key:1,class:"app_side_widget fcom_widget_highlight"},$0={class:"widget_header"},S0=["aria-label"],V0={class:"widget_body"},M0=["aria-label"],L0={class:"widget_header"},T0={class:"widget_body notifications_wrap"},F0={class:"notification_wrap"},I0=["href"],P0={class:"notification_item"},E0={class:"notification_avatar"},A0={class:"notification_content"},U0=["innerHTML"],B0={style:{"margin-top":"5px"},class:"feed_timestamp"},D0=["aria-label"],R0={class:"widget_header"},x0={class:"widget_body notifications_wrap"},O0={class:"notification_wrap"},H0=["href"],j0={class:"notification_avatar"},N0={class:"notification_content"},z0=["innerHTML"],q0=["title"],G0={key:2,class:"notification_wrap"},Y0={class:"notification_item"},W0={class:"notification_content"},K0={class:"no_notifications"},Z0=["innerHTML"];function Q0(e,t,s,u,o,i){const m=g("NotificationOnboard"),f=O,h=g("UserAvatar"),p=Q;return n(),r(F,null,[o.before_contents?(n(),r("div",{key:0,innerHTML:o.before_contents},null,8,w0)):_("",!0),a(m,{placement:s.prompt_placement},null,8,["placement"]),o.pending_count&&s.with_pending_count?(n(),r("div",C0,[l("div",$0,[l("h3",{role:"region","aria-label":e.$t("Pending Members")},c(e.$t("Pending Members")),9,S0)]),l("div",V0,[l("p",null,c(e.$t("%s people requested to join the community.",o.pending_count)),1)]),a(f,{role:"link","aria-label":e.$t("View pending members"),onClick:t[0]||(t[0]=k=>e.$router.push({name:"space_members",query:{view_pending:"yes"}})),type:"danger"},{default:d(()=>[M(c(e.$t("View pending members")),1)]),_:1},8,["aria-label"])])):_("",!0),s.with_pins&&o.pinned_posts.length?(n(),r("div",{key:2,role:"region","aria-label":e.$t("Featured Posts"),class:"app_side_widget widget_recent_activities"},[l("div",L0,[l("h3",null,c(s.pinned_widget_title||e.$t("Featured Posts")),1)]),l("div",T0,[(n(!0),r(F,null,R(o.pinned_posts,k=>{var b;return n(),r("div",F0,[l("a",{class:"no_style_link",href:k.permalink},[l("div",P0,[l("div",E0,[a(h,{with_level:!1,xprofile:k.xprofile},null,8,["xprofile"])]),l("div",A0,[l("div",{innerHTML:k.message},null,8,U0),l("span",B0,c((b=k.xprofile)==null?void 0:b.display_name),1)])])],8,I0)])}),256))])],8,M0)):_("",!0),l("div",{role:"region","aria-label":e.$t("Space Activities"),class:"app_side_widget widget_recent_activities"},[l("div",R0,[l("h3",null,c(s.widget_title||e.$t("Recent Activities")),1)]),l("div",x0,[o.loading?(n(),y(p,{key:0,animated:!0,rows:5})):o.activities.length?(n(!0),r(F,{key:1},R(o.activities,k=>(n(),r("div",O0,[l("a",{href:i.getActivityLink(k),class:"notification_item"},[l("div",j0,[a(h,{with_level:!1,xprofile:k.xprofile},null,8,["xprofile"])]),l("div",N0,[l("div",{innerHTML:k.message},null,8,z0),l("span",{title:k.updated_at,class:"notification_time_stamp"},c(e.humanDateDiff(k.updated_at)),9,q0)])],8,H0)]))),256)):(n(),r("div",G0,[l("div",Y0,[l("div",W0,[l("div",K0,c(e.$t("No recent activities found")),1)])])]))])],8,D0),o.after_contents?(n(),r("div",{key:3,innerHTML:o.after_contents},null,8,Z0)):_("",!0)],64)}const Bt=I(k0,[["render",Q0]]),J0={name:"FeedMenu",methods:{openCustomizer(e){var t;(t=this.$refs.feed_actions)==null||t.hide(),this.$router.push({name:e})}}},X0={class:"actions_items"};function e2(e,t,s,u,o,i){const m=g("MoreFilled"),f=j,h=O,p=fe;return n(),r("div",null,[a(p,{placement:"bottom",ref:"feed_actions",trigger:"click",persistent:!1,"popper-options":{strategy:"fixed"}},{reference:d(()=>[a(h,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:d(()=>[a(f,null,{default:d(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])]),default:d(()=>[l("ul",X0,[e.has_pro?(n(),r("li",{key:0,onClick:t[0]||(t[0]=k=>i.openCustomizer("feed_settings_welcome_banner"))},c(e.$t("Welcome Banner")),1)):_("",!0),l("li",{onClick:t[1]||(t[1]=k=>i.openCustomizer("feed_settings_links"))},c(e.$t("Manage Links")),1)])]),_:1},512)])}const t2=I(J0,[["render",e2]]),s2={name:"RenderSpaceLinks",props:{links:{type:Array,required:!0}},computed:{enabledLinks(){return this.links.filter(e=>e.enabled!=="no")},currentUrl(){return window.location.origin+this.$router.resolve(this.$route.fullPath).href}}},o2={class:"object_menu"},i2={class:"fcom_space_menu_ul"},n2=["target","href"],l2=["src"],a2={key:1,class:"fcom_emoji"},r2={key:2,style:{"font-size":"120%"},class:"fcom_shape"};function d2(e,t,s,u,o,i){const m=j;return n(),r("div",o2,[l("ul",i2,[(n(!0),r(F,null,R(i.enabledLinks,f=>(n(),r("li",{key:f.slug},[l("a",{target:f.new_tab=="yes"?"_blank":"",rel:"noopener nofollow",class:D(["fcom_custom_link",{"router-link-exact-active":f.permalink===i.currentUrl}]),href:f.permalink},[f.icon_image?(n(),r("img",{key:0,alt:"",src:f.icon_image},null,8,l2)):f.emoji?(n(),r("span",a2,c(f.emoji),1)):f.shape_svg?(n(),r("span",r2,[a(m,{innerHTML:f.shape_svg},null,8,["innerHTML"])])):_("",!0),l("span",null,c(f.title),1)],10,n2)]))),128))])])}const fs=I(s2,[["render",d2]]),c2={name:"FeedsRoute",components:{SpaceIcon:ze,Layout:we,AppLayout:Se,RecentActivities:Bt,FeedMenu:t2,RenderSpaceLinks:fs},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)}},u2=["aria-label"],_2={key:0,class:"fcom_profile_complete_btn_wrap"},m2={key:1},h2={key:0,class:"fcom_feed_box"},f2={key:0,class:"fcom_main_side_wrap"},p2={class:"fcom_side_box"};function g2(e,t,s,u,o,i){const m=g("render-space-links"),f=O,h=g("feed-menu"),p=g("router-view"),k=ut,b=g("recent-activities"),$=_t,w=mt,C=g("layout"),v=g("app-layout");return n(),y(v,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:d(()=>[a(C,{wrapper_class:"no_bg_layout",title:e.$t("Feed")},{title:d(()=>[l("h1",{onClick:t[0]||(t[0]=S=>{e.$eventBus.emit("toTop"),i.resetRoute()}),class:"fcom_page_title clickable"},c(e.$t("Feed")),1)]),sub_header:d(()=>{var S;return[((S=e.appVars.feed_links)==null?void 0:S.length)>0?(n(),r("nav",{key:0,"aria-label":e.$t("Feed Links"),class:"fcom_sub_header"},[a(m,{links:e.appVars.feed_links},null,8,["links"])],8,u2)):_("",!0)]}),actions:d(()=>[e.auth.compilation_score<100?(n(),r("div",_2,[a(f,{onClick:i.goToProfile,type:"danger"},{default:d(()=>[M(c(e.$t("Complete your profile"))+" ("+c(e.auth.compilation_score)+"%)",1)]),_:1},8,["onClick"])])):_("",!0),e.isAdmin()?(n(),r("div",m2,[a(h)])):_("",!0)]),default:d(()=>[a(w,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:d(()=>[a(k,{class:"fcom_main"},{default:d(()=>[o.transiting?_("",!0):(n(),r("div",h2,[a(p)]))]),_:1}),a($,{class:"fcom_resp_side",width:"306px"},{default:d(()=>[e.isMobile?_("",!0):(n(),r("div",f2,[l("div",p2,[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 y2=I(c2,[["render",g2]]);const v2={name:"NewPostsBanner",components:{ArrowUp:Zs},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}}},b2={class:"fcom_new_posts_text"};function k2(e,t,s,u,o,i){const m=g("ArrowUp"),f=j;return n(),y(Es,{name:"slide-down"},{default:d(()=>[o.show?(n(),r("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:d(()=>[a(m)]),_:1}),l("span",b2,c(o.count===1?e.$t("1 new post available"):e.$t("{count} new posts available",{count:o.count})),1)])):_("",!0)]),_:1})}const w2=I(v2,[["render",k2],["__scopeId","data-v-e4ec71f4"]]),C2={name:"AllFeeds",components:{Feeds:pt,NewPostsBanner:w2},setup(){return{tickerStore:os()}},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()}},$2={key:0,class:"notices fcom_notice_wrap"},S2=["innerHTML"];function V2(e,t,s,u,o,i){var p;const m=g("WelcomeBanner"),f=g("NewPostsBanner"),h=g("feeds");return n(),r(F,null,[e.appVars.portal_notices&&e.appVars.portal_notices.length?(n(),r("div",$2,[(n(!0),r(F,null,R(e.appVars.portal_notices,k=>(n(),r("div",{innerHTML:k},null,8,S2))),256))])):_("",!0),e.appVars.welcome_banner?(n(),y(m,{key:1})):_("",!0),(p=e.appVars.features)!=null&&p.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 M2=I(C2,[["render",V2]]),L2={name:"ViewFeed",components:{Feed:ot},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{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)}},T2={key:0,class:"fcom_feed_report_wrap"},F2={class:"fcom_feed_report_content"},I2={key:1,class:"feed_outer"},P2={key:3,class:"error-container"},E2={style:{padding:"20px",background:"var(--fcom-primary-bg)","border-radius":"8px"},class:"error-content"},A2={class:"error-title"},U2={class:"error-message"},B2={class:"error-explanation"},D2={style:{"list-style":"disc",margin:"20px"},class:"error-reasons"},R2={class:"error-actions"},x2=["href"];function O2(e,t,s,u,o,i){const m=g("Feed"),f=Q;return n(),r("div",null,[o.feed&&o.feed.status=="unpublished"?(n(),r("div",T2,[l("div",F2,[l("span",null,c(e.$t("This content has been unpublished by community moderation. Only the author and moderators can view it.")),1)])])):_("",!0),o.feed?(n(),r("div",I2,[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(),r("div",P2,[l("div",E2,[l("h1",A2,c(e.$t("Post Not Found")),1),l("p",U2,c(e.$t("Sorry, the requested post could not be found.")),1),l("p",B2,c(e.$t("This may be due to one of the following reasons:")),1),l("ul",D2,[l("li",null,c(e.$t("You do not have permission to view this post")),1),l("li",null,c(e.$t("The post URL may be incorrect")),1),l("li",null,c(e.$t("The post has been deleted")),1)]),l("div",R2,[l("a",{href:e.$getRouteLink(""),class:"el-button fcom_primary_button"},c(e.$t("Back to home")),9,x2)])])])):_("",!0)])}const Ms=I(L2,[["render",O2]]),H2={name:"SpaceHeader",emits:["refetch","doSearch"],components:{ImageUploader:Re},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})}},j2={key:0,class:"object_header space_header"},N2={key:0,style:{"text-align":"right"},class:"object_media_uploader"};function z2(e,t,s,u,o,i){const m=O,f=g("image-uploader"),h=se("loading");return i.profile.cover_photo?Y((n(),r("div",j2,[l("div",{style:ue({backgroundImage:"url("+i.profile.cover_photo+")"}),class:"object_cover"},[i.isMod?(n(),r("div",N2,[a(f,{additionalData:{resize:!0,max_width:1500},onUploaded:i.handleCoverPhotoUpload},{default:d(()=>[a(m,{size:"small",plain:"",type:"primary"},{default:d(()=>[M(c(e.$t("Change Cover")),1)]),_:1})]),_:1},8,["onUploaded"]),a(m,{class:"fcom_mt_10",size:"small",plain:"",type:"danger",onClick:q(i.removeCoverPhoto,["prevent"])},{default:d(()=>[M(c(e.$t("Remove")),1)]),_:1},8,["onClick"])])):_("",!0)],4)])),[[h,o.updating]]):_("",!0)}const q2=I(H2,[["render",z2]]),G2={name:"MenuLinkIcon",props:{link:{type:Object,required:!0}}},Y2=["src"],W2=["textContent"];function K2(e,t,s,u,o,i){return s.link.icon_image?(n(),r("img",{key:0,src:s.link.icon_image,alt:"",class:"fcom_menu_link_icon"},null,8,Y2)):s.link.emoji?(n(),r("span",{key:1,class:"fcom_emoji",textContent:c(s.link.emoji)},null,8,W2)):_("",!0)}const Z2=I(G2,[["render",K2]]),Q2={name:"SpaceMenuLink",components:{MenuLinkIcon:Z2},props:{link:{type:Object,required:!0}},computed:{safeHref(){const e=this.link.url||"";return/^(https?:|mailto:|tel:)/i.test(e)||e.startsWith("/")||e.startsWith("#")?e:"#"}}},J2=["textContent"],X2=["href","target"],eb=["textContent"];function tb(e,t,s,u,o,i){const m=g("menu-link-icon"),f=g("router-link");return s.link.route?(n(),y(f,{key:0,to:s.link.route},{default:d(()=>[a(m,{link:s.link},null,8,["link"]),l("span",{textContent:c(s.link.title)},null,8,J2)]),_:1},8,["to"])):(n(),r("a",{key:1,class:D(s.link.css_class??""),href:i.safeHref,rel:"noopener nofollow",target:s.link.is_external?"_blank":"_self"},[a(m,{link:s.link},null,8,["link"]),l("span",{textContent:c(s.link.title)},null,8,eb)],10,X2))}const sb=I(Q2,[["render",tb]]),ob=90,ib={name:"SpaceMenuItems",components:{SpaceMenuLink:sb},props:["profile","flat"],data(){return{visibleCount:null,resizeObserver:null,resizeTimer:null}},computed:{allLinks(){var e;return((e=this.profile)==null?void 0:e.header_links)||[]},flatLinks(){const e=[...this.allLinks],t=e.findIndex(s=>{var u;return((u=s.route)==null?void 0:u.name)==="space_feeds"});return e.splice(t===-1?1:t+1,0,{title:this.$t("About"),route:{name:"space_about"}}),e},visibleLinks(){return this.flat?this.flatLinks:this.visibleCount===null?this.allLinks:this.allLinks.slice(0,this.visibleCount)},overflowLinks(){return this.visibleCount===null?[]:this.allLinks.slice(this.visibleCount)}},watch:{allLinks(){this.flat||this.scheduleFit()}},methods:{linkKey(e,t){var s;return(((s=e.route)==null?void 0:s.name)||e.url||e.title||"link")+"_"+t},closeMore(){this.$refs.more_menu&&this.$refs.more_menu.hide()},scheduleFit(){clearTimeout(this.resizeTimer),this.resizeTimer=setTimeout(()=>{this.fitLinks()},80)},fitLinks(){this.flat||!this.allLinks.length||(this.visibleCount=null,this.$nextTick(()=>{const e=this.$refs.nav,t=this.$refs.list;if(!e||!t)return;const s=e.clientWidth;if(!s)return;const u=Array.from(t.children).filter(i=>!i.classList.contains("fcom_space_menu_more")).map(i=>i.offsetWidth),o=i=>{let m=0,f=0;for(let h=0;hi));h++)f++;return f};if(o(s)>=this.allLinks.length){this.visibleCount=this.allLinks.length;return}this.visibleCount=Math.max(o(s-ob),1)}))}},mounted(){this.flat||(this.fitLinks(),typeof ResizeObserver<"u"&&this.$refs.nav?(this.resizeObserver=new ResizeObserver(()=>{this.scheduleFit()}),this.resizeObserver.observe(this.$refs.nav)):window.addEventListener("resize",this.scheduleFit))},beforeUnmount(){clearTimeout(this.resizeTimer),this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.scheduleFit)}},nb=["aria-label"],lb={key:0,class:"fcom_space_menu_more"},ab=["aria-label"],rb={class:"fcom_space_menu_ul fcom_linked_menus fcom_space_menu_overflow"};function db(e,t,s,u,o,i){const m=g("space-menu-link"),f=g("ArrowDown"),h=j,p=fe;return n(),r("nav",{ref:"nav","aria-label":e.$t("Space menu"),class:"fcom_space_menu_nav"},[l("ul",{ref:"list",class:D(["fcom_space_menu_ul",{fcom_space_menu_overflow:s.flat}])},[(n(!0),r(F,null,R(i.visibleLinks,(k,b)=>(n(),r("li",{key:i.linkKey(k,b)},[a(m,{link:k},null,8,["link"])]))),128)),i.overflowLinks.length?(n(),r("li",lb,[a(p,{ref:"more_menu",persistent:!1,placement:"bottom-end",width:220,"popper-options":{strategy:"fixed"},trigger:"click"},{reference:d(()=>[l("button",{type:"button",class:"fcom_space_menu_more_btn","aria-label":e.$t("More menu items")},[l("span",null,c(e.$t("More")),1),a(h,null,{default:d(()=>[a(f)]),_:1})],8,ab)]),default:d(()=>[l("ul",rb,[(n(!0),r(F,null,R(i.overflowLinks,(k,b)=>(n(),r("li",{key:i.linkKey(k,b),onClick:t[0]||(t[0]=$=>i.closeMore())},[a(m,{link:k},null,8,["link"])]))),128))])]),_:1},512)])):_("",!0)],2)],8,nb)}const cb=I(ib,[["render",db]]),ub={name:"MenuIcon"},_b={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor"};function mb(e,t,s,u,o,i){return n(),r("svg",_b,[...t[0]||(t[0]=[l("path",{d:"M1 2.75A.75.75 0 0 1 1.75 2h12.5a.75.75 0 0 1 0 1.5H1.75A.75.75 0 0 1 1 2.75Z"},null,-1),l("path",{d:"M1 7.75A.75.75 0 0 1 1.75 7h7.5a.75.75 0 0 1 0 1.5h-7.5A.75.75 0 0 1 1 7.75Z"},null,-1),l("path",{d:"M1 12.75a.75.75 0 0 1 .75-.75h12.5a.75.75 0 0 1 0 1.5H1.75a.75.75 0 0 1-.75-.75Z"},null,-1)])])}const hb=I(ub,[["render",mb]]),fb={name:"SpaceMenu",emits:["refetch","doSearch"],components:{ImageUploader:Re,SpaceMenuItems:cb,MenuIcon:hb},setup(){return{spaceStore:He()}},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:Wt(Fe),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},currentSectionTitle(){const e=(this.profile.header_links||[]).find(t=>{var u,o,i;if(((u=t.route)==null?void 0:u.name)!==this.$route.name)return!1;const s=(i=(o=t.route)==null?void 0:o.params)==null?void 0:i.page_slug;return!s||s===this.$route.params.page_slug});return e?e.title:this.$route.name==="space_about"?this.$t("About"):this.$t("Space menu")}},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)})},goToSettings(){this.$router.push({name:"space_settings_general",params:{space:this.space}})},performSearch(){this.$eventBus.emit("doGlobalSearch",this.search_term)}},mounted(){this.$eventBus.on("doGlobalSearch",e=>{this.search_term=e}),this.$route.query.customize_space&&this.$router.replace({name:"space_settings_general",params:{space:this.space}})}},pb={class:"space_header"},gb={class:"object_menu"},yb={key:0,class:"menu_actions"},vb=["href"],bb={class:"fcom_space_menu_trigger"},kb=["textContent"],wb={class:"actions_items"};function Cb(e,t,s,u,o,i){const m=g("space-menu-items"),f=O,h=g("MoreFilled"),p=j,k=g("MenuIcon"),b=fe,$=se("loading");return Y((n(),r("div",pb,[l("div",gb,[a(m,{profile:i.profile,class:"fcom_desktop_only"},null,8,["profile"]),i.profile.id?(n(),r("div",yb,[e.auth.user_id?i.profile.membership?_("",!0):(n(),y(f,{key:1,disabled:o.joining,loading:o.joining,onClick:t[0]||(t[0]=w=>i.join()),class:"fcom_primary_button"},{default:d(()=>[M(c(e.$t("Join")),1)]),_:1},8,["disabled","loading"])):(n(),r("a",{key:0,href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button fcom_join_space_auth"},c(e.$t("Join")),9,vb)),i.showActions?(n(),y(b,{key:2,persistent:!1,ref:"space_actions",placement:"bottom-end",width:200,"popper-options":{strategy:"fixed"},"popper-class":"fcom_space_actions_pop",trigger:"click"},{reference:d(()=>[a(f,{"aria-label":e.$t("Space menu"),class:"fcom_dot_menu fcom_space_actions_trigger",size:"small",text:""},{default:d(()=>[a(p,{class:"fcom_space_actions_dots"},{default:d(()=>[a(h)]),_:1}),l("span",bb,[a(p,null,{default:d(()=>[a(k)]),_:1}),l("span",{class:"fcom_space_menu_trigger_label",textContent:c(i.currentSectionTitle)},null,8,kb)])]),_:1},8,["aria-label"])]),default:d(()=>[a(m,{profile:i.profile,flat:!0,class:"fcom_linked_menus fcom_sm_only",onClick:t[1]||(t[1]=w=>e.$refs.space_actions.hide())},null,8,["profile"]),l("ul",wb,[e.hasSpaceAdminAccess(i.profile)?(n(),r(F,{key:0},[l("li",{onClick:t[2]||(t[2]=()=>{e.$refs.space_actions.hide(),i.goToSettings()})},c(e.$t("Space Settings")),1),t[5]||(t[5]=l("li",{class:"fcom_li_separator"},null,-1))],64)):_("",!0),i.profile.membership?(n(),r("li",{key:1,onClick:t[3]||(t[3]=()=>{e.$refs.space_actions.hide(),i.leave()})},c(e.$t("Leave Space")),1)):_("",!0),e.isAdmin()?(n(),r("li",{key:2,onClick:t[4]||(t[4]=(...w)=>i.initDeleteSpace&&i.initDeleteSpace(...w))},c(e.$t("Delete")),1)):_("",!0)])]),_:1},512)):_("",!0)])):_("",!0)])])),[[$,o.updating]])}const So=I(fb,[["render",Cb]]),$b={name:"AboutSpace",components:{RecentActivities:Bt},props:["space_profile","has_permission"],data(){return{privacies:fo}}},Sb={class:"fcom_main_side_wrap"},Vb=["aria-label"],Mb={class:"widget_header"},Lb={key:0,class:"widget_body"},Tb=["innerHTML"],Fb={class:"space_meta"},Ib={class:"space_meta_item"},Pb={class:"meta_label"},Eb={class:"meta_desc"};function Ab(e,t,s,u,o,i){var k,b,$;const m=g("Guide"),f=j,h=Q,p=g("recent-activities");return n(),r("div",Sb,[l("div",{role:"region","aria-label":e.$t("About Space"),class:"app_side_widget widget_recent_activities"},[l("div",Mb,[l("h3",null,c(e.$t("About")),1)]),s.space_profile?(n(),r("div",Lb,[l("div",{class:"space_description",innerHTML:s.space_profile.description_rendered},null,8,Tb),l("div",Fb,[l("div",Ib,[l("div",Pb,[a(f,null,{default:d(()=>[a(m)]),_:1}),l("span",null,c((k=o.privacies[s.space_profile.privacy])==null?void 0:k.label),1)]),l("div",Eb,c((b=o.privacies[s.space_profile.privacy])==null?void 0:b.space_description),1)])])])):(n(),y(h,{key:1,animated:!0}))],8,Vb),s.space_profile?(n(),y(p,{key:0,with_pins:!0,with_pending_count:!0,widget_title:e.$t("Recent Space Activities"),context:{type:"space",space_slug:($=s.space_profile)==null?void 0:$.slug,space_id:s.space_profile.id}},null,8,["widget_title","context"])):_("",!0)])}const Vo=I($b,[["render",Ab]]),Ub={name:"CircleIcon",props:{fill:{type:String,default:"currentColor"}}},Bb=["fill"];function Db(e,t,s,u,o,i){return n(),r("svg",{fill:s.fill,width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[...t[0]||(t[0]=[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)])],8,Bb)}const ps=I(Ub,[["render",Db]]),Rb={name:"LessonIcon"},xb={width:"60",height:"48",viewBox:"0 0 60 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ob(e,t,s,u,o,i){return n(),r("svg",xb,[...t[0]||(t[0]=[l("rect",{width:"60",height:"48",rx:"4",fill:"#F2F5F8"},null,-1),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)])])}const Mo=I(Rb,[["render",Ob]]),Hb={name:"PlayIcon"},jb={width:"20",height:"19",viewBox:"0 0 20 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Nb(e,t,s,u,o,i){return n(),r("svg",jb,[...t[0]||(t[0]=[Le('',2)])])}const Lo=I(Hb,[["render",Nb]]),zb={name:"PlayPlaceholderIcon"},qb={width:"60",height:"48",viewBox:"0 0 60 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Gb(e,t,s,u,o,i){return n(),r("svg",qb,[...t[0]||(t[0]=[Le('',3)])])}const To=I(zb,[["render",Gb]]),Yb={name:"_LockscreenLessonEditor",components:{CircleIcon:ps,LessonIcon:Mo,PlayIcon:Lo,PlayPlaceholderIcon:To},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}}},Wb={class:"fcom_course_sections"},Kb={class:"fcom_course_intro"},Zb={class:"fcom_course_labels"},Qb={class:"fcom_course_info"},Jb={class:"fcom_card_sections"},Xb={class:"fcom_section_items"},ek=["onClick"],tk={class:"fcom_section_primary_item_title"},sk={class:"title_line_container"},ok={class:"title_line"},ik={class:"fcom_meta_text"},nk={key:0,class:"fcom_meta_text"},lk={class:"fcom_section_primary_item_actions"},ak=["onClick"],rk={class:"fcom_heading_item clickable"},dk={class:"lesson_feature_media"},ck=["src","alt"],uk=["src","alt"],_k={class:"lesson_title"},mk=["innerHTML"],hk={class:"lesson_duration"},fk={key:0},pk={key:1},gk=["innerHTML"];function yk(e,t,s,u,o,i){const m=g("ArrowRight"),f=g("ArrowDown"),h=j,p=g("CircleIcon"),k=g("Lock"),b=g("PlayPlaceholderIcon"),$=g("LessonIcon"),w=g("PlayIcon");return n(),r("div",Wb,[l("div",Kb,[l("div",Zb,[l("h3",null,c(e.$t("Course Content")),1),l("p",Qb,[M(c(e.$_n("%s Topic","%s Topics",i.sectionsCount))+" ",1),t[0]||(t[0]=l("span",null," โ€ข ",-1)),M(" "+c(e.$_n("%s Lesson","%s Lessons",i.lessonsCount)),1)])])]),l("div",Jb,[l("div",Xb,[(n(!0),r(F,null,R(s.sections,C=>(n(),r("div",{key:C.id,class:"fcom_section_primary"},[C.lessons.length?(n(),r("div",{key:0,onClick:v=>C.is_closed=!C.is_closed,class:D(["clickable fcom_section_primary_item",{is_closed:C.is_closed}])},[l("div",tk,[l("div",sk,[l("div",ok,[l("h4",null,c(C.title),1)]),l("span",ik,c(e.$t("%d lessons",C.lessons.length)),1),i.lessonDuration(C)?(n(),r("span",nk," โ€ข "+c(i.lessonDuration(C)),1)):_("",!0)])]),l("div",lk,[a(h,{class:"clickable"},{default:d(()=>[C.is_closed?(n(),y(m,{key:0,class:"fcom_arrow_icon"})):(n(),y(f,{key:1}))]),_:2},1024)])],10,ek)):_("",!0),C.is_closed?_("",!0):(n(!0),r(F,{key:1},R(C.lessons,v=>(n(),r("div",{key:v.id,class:D(["fcom_section_item",{is_locked:!i.isFreePreview(v)}])},[l("div",{onClick:S=>i.maybeGotoLesson(v,C),class:"fcom_section_item_title"},[l("p",rk,[a(h,null,{default:d(()=>[i.isFreePreview(v)?(n(),y(p,{key:0})):(n(),y(k,{key:1}))]),_:2},1024),i.isModernLayout?(n(),r(F,{key:0},[l("span",dk,[v.featured_image?(n(),r("img",{key:0,src:v.featured_image,alt:v.title},null,8,ck)):i.hasMediaImage(v)?(n(),r("img",{key:1,src:v.meta.media.image,alt:v.title},null,8,uk)):i.hasMediaVideo(v)?(n(),y(b,{key:2})):(n(),y($,{key:3})),i.showPlayIcon(v)?(n(),y(w,{key:4,class:"play_icon"})):_("",!0)]),l("span",_k,[l("span",{innerHTML:v.title},null,8,mk),l("span",hk,[v.meta.video_length?(n(),r("span",fk,c(i.formatSeconds(v.meta.video_length)),1)):(n(),r("span",pk,c("---")))])])],64)):(n(),r("span",{key:1,innerHTML:v.title},null,8,gk))])],8,ak)],2))),128))]))),128))])])])}const vk=I(Yb,[["render",yk]]),bk={name:"ImagePlaceholder"},kk={width:"240",height:"240",viewBox:"0 0 240 240",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function wk(e,t,s,u,o,i){return n(),r("svg",kk,[...t[0]||(t[0]=[l("rect",{width:"240",height:"240",fill:"#F5F6F7"},null,-1),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)])])}const Fo=I(bk,[["render",wk]]),Ck={name:"LockscreenPaywallView",components:{ImagePlaceholder:Fo},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()}},$k={class:"fcom_paywall_cards"},Sk={class:"paywall_header"},Vk={class:"paywall_body"},Mk=["innerHTML"],Lk={key:0,class:"subscription"},Tk={class:"paywall_footer"},Fk={key:0,class:"fcom_mb_10"},Ik=["href"];function Pk(e,t,s,u,o,i){const m=Q,f=Ns,h=g("ImagePlaceholder");return n(),r("div",$k,[o.loading?(n(),y(m,{key:0,rows:3,animated:!0})):(n(!0),r(F,{key:1},R(i.filteredPaywalls,p=>(n(),r("div",{key:p.id,class:"fcom_paywall",style:ue(i.cardStyles)},[l("div",Sk,[p.photo?(n(),y(f,{key:0,src:p.photo},null,8,["src"])):(n(),y(f,{key:1},{default:d(()=>[a(h)]),_:1})),l("span",null,c(p.variation_title),1)]),l("div",Vk,[l("span",{innerHTML:p.total_price},null,8,Mk),i.isSubscriptionPaywall(p)?(n(),r("span",Lk,"ย / "+c(i.getRepeatInterval(p)),1)):_("",!0)]),l("div",Tk,[s.field.show_description=="yes"&&(p!=null&&p.description)?(n(),r("span",Fk,c(p.description),1)):_("",!0),s.editable?Y((n(),r("input",{key:1,class:"el-button fcom_primary_button link_button",style:ue(i.buttonStyles),type:"text","onUpdate:modelValue":t[0]||(t[0]=k=>s.field.button_text=k)},null,4)),[[Ho,s.field.button_text]]):(n(),r("a",{key:2,class:"el-button fcom_primary_button link_button",style:ue(i.buttonStyles),href:p.checkout_url},c(s.field.button_text),13,Ik))])],4))),128))])}const Ek=I(Ck,[["render",Pk]]),Ak={name:"CustomLockscreenView",props:["profile","sections"],components:{LockscreenLessonEditor:vk,LockscreenPaywallView:Ek},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})}}},Uk={class:"fcom_custom_lockscreen"},Bk={class:"fcom_lockscreen_content"},Dk={class:"fcom_item"},Rk={class:"fcom_content"},xk=["href","target"],Ok={key:1,class:"fcom_content_wrap"},Hk=["innerHTML"],jk={key:2,class:"fcom_content_wrap"},Nk={key:3,class:"fcom_content_wrap"},zk={key:4,class:"fcom_paywall_wrap"};function qk(e,t,s,u,o,i){const m=g("welcome-banner"),f=g("lockscreen-lesson-editor"),h=g("lockscreen-paywall-view");return n(),r("div",Uk,[l("div",Bk,[(n(!0),r(F,null,R(i.lockscreenFields,p=>{var k;return n(),r("div",Dk,[p.type=="image"?(n(),r("div",{key:0,class:"fcom_image_wrap",style:ue(i.imageStyles(p))},[l("div",Rk,[l("h2",{style:ue(i.headingStyles(p))},c(p.heading),5),l("p",{style:ue(i.descriptionStyles(p))},c(p.description),5),p.button_text?(n(),r("a",{key:0,class:"fcom_btn",href:i.buttonLink(p),style:ue(i.buttonStyles(p)),target:p.new_tab=="yes"?"_blank":"_self"},c(p.button_text),13,xk)):_("",!0)])],4)):_("",!0),p.type=="block"&&p.content?(n(),r("div",Ok,[l("div",{class:"fcom_custom_editor_html",innerHTML:p.content},null,8,Hk)])):_("",!0),p.type=="welcome_banner"&&p.banner?(n(),r("div",jk,[a(m,{config:p.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),p.type=="lesson"?(n(),r("div",Nk,[a(f,{sections:s.sections,settings:s.profile.settings},null,8,["sections","settings"])])):_("",!0),p.type=="paywall"&&((k=p.paywalls)==null?void 0:k.length)>0?(n(),r("div",zk,[a(h,{space_id:s.profile.id,field:p},null,8,["space_id","field"])])):_("",!0)])}),256))])])}const Io=I(Ak,[["render",qk]]),Gk={name:"DefaultLockscreenPaywall",components:{ImagePlaceholder:Fo},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()}},Yk={class:"space_default_lock_box fcom_paywall_cards"},Wk={class:"paywall_header"},Kk={class:"paywall_body"},Zk=["innerHTML"],Qk={key:0,class:"subscription"},Jk={class:"paywall_footer"},Xk={key:0,class:"fcom_mb_10"},ew=["href"];function tw(e,t,s,u,o,i){const m=Q,f=Ns,h=g("ImagePlaceholder");return n(),r("div",Yk,[o.loading?(n(),y(m,{key:0,rows:3,animated:!0})):(n(!0),r(F,{key:1},R(o.availablePaywalls,p=>(n(),r(F,{key:p.ID},[(n(!0),r(F,null,R(p.variants,k=>(n(),r("div",{key:k.id,class:"fcom_paywall"},[l("div",Wk,[k.photo?(n(),y(f,{key:0,src:k.photo},null,8,["src"])):(n(),y(f,{key:1},{default:d(()=>[a(h)]),_:1})),l("span",null,c(k.variation_title),1)]),l("div",Kk,[l("span",{innerHTML:k.total_price},null,8,Zk),i.isSubscriptionPaywall(k)?(n(),r("span",Qk,"ย / "+c(i.getRepeatInterval(k)),1)):_("",!0)]),l("div",Jk,[k!=null&&k.description?(n(),r("span",Xk,c(p.post_excerpt),1)):_("",!0),l("a",{class:"el-button fcom_primary_button link_button",href:k.checkout_url},c(e.$t("Join Now")),9,ew)])]))),128))],64))),128))])}const Po=I(Gk,[["render",tw]]),sw={name:"LockscreenView",components:{CustomLockscreenView:Io,DefaultLockscreenPaywall:Po},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)}},ow={key:0,style:{margin:"30px","text-align":"center"}},iw={key:0,class:"space_lock_box space_default_lock_box"},nw={class:"space_lock_box space_default_lock_box"},lw={class:"lock_desc"},aw=["href"],rw={key:0,class:"lock_desc"},dw={key:1,class:"lock_desc"},cw=["href"],uw={key:2},_w={key:2,class:"space_lock_box"},mw={class:"lock_desc"},hw=["href"];function fw(e,t,s,u,o,i){var b,$;const m=g("Lock"),f=j,h=O,p=g("default-lockscreen-paywall"),k=g("custom-lockscreen-view");return(b=this.space_profile.lockscreen_config)!=null&&b.redirect_url?(n(),r("h3",ow,c(e.$t("Please wait...")),1)):s.space_profile.lockscreen_config?(n(),r(F,{key:1},[s.space_profile.permissions&&s.space_profile.permissions.is_pending?(n(),r("div",iw,[a(f,null,{default:d(()=>[a(m)]),_:1}),l("h4",null,c(e.$t("Membership Request Under Review")),1)])):s.space_profile.lockscreen_config.showCustom?(n(),r("div",uw,[a(k,{profile:s.space_profile},null,8,["profile"])])):(n(),r(F,{key:1},[l("div",nw,[a(f,null,{default:d(()=>[a(m)]),_:1}),l("h4",null,c(e.$t("This is a private space")),1),s.space_profile.lockscreen_config.canSendRequest?(n(),r(F,{key:0},[l("p",lw,c(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]=w=>e.$emit("join"))},{default:d(()=>[M(c(e.$t("Request Access")),1)]),_:1},8,["disabled","loading"])):(n(),r("a",{key:1,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},c(e.$t("Login or Signup")),9,aw))],64)):(n(),r(F,{key:1},[s.space_profile.lockscreen_config.showPaywalls?(n(),r("p",rw,c(e.$t("Purchase access below or log in if you are already a member.")),1)):(n(),r("p",dw,c(e.$t("Members have to be invited to this space.")),1)),e.auth.user_id?_("",!0):(n(),r("a",{key:2,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},c(e.$t("Login or Signup")),9,cw))],64))]),s.space_profile.lockscreen_config.showPaywalls?(n(),y(p,{key:0,space_id:($=s.space_profile)==null?void 0:$.id},null,8,["space_id"])):_("",!0)],64))],64)):e.auth.user_id?_("",!0):(n(),r("div",_w,[a(f,null,{default:d(()=>[a(m)]),_:1}),l("h4",null,c(e.$t("Please login/signup to join this community")),1),l("p",mw,c(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"},c(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,hw)]))}const pw=I(sw,[["render",fw]]),gw={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"})}]}}},yw={class:"fcom_404_container"},vw={class:"fcom_404_content"};function bw(e,t,s,u,o,i){const m=O,f=Zo;return n(),r("div",yw,[l("div",vw,[a(f,{icon:s.icon,title:s.title},{"sub-title":d(()=>[l("p",null,c(s.message),1)]),extra:d(()=>[K(e.$slots,"actions",{},()=>[(n(!0),r(F,null,R(i.displayActions,(h,p)=>(n(),y(m,{key:p,class:D(["el-button",h.class]),onClick:k=>h.action&&h.action()},{default:d(()=>[M(c(h.text),1)]),_:2},1032,["class","onClick"]))),128))])]),_:3},8,["icon","title"])])])}const Eo=I(gw,[["render",bw]]),kw={name:"SpaceView",components:{NotFoundResult:Eo,RenderSpaceLinks:fs,AboutSpace:Vo,Layout:we,AppLayout:Se,SpaceHeader:q2,RecentActivities:Bt,CreateSpaceForm:_s,SpaceMenu:So,LockscreenView:pw,SpaceIcon:ze},setup(){return{spaceStore:He()}},props:["space"],data(){return{search:"",joining:!1,pending_count:0,notFound:!1}},computed:{hasEnabledSpaceLinks(){var t,s;return(((s=(t=this.space_profile)==null?void 0:t.settings)==null?void 0:s.links)||[]).some(u=>u.enabled!=="no")},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||((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.show_sidebar)=="no"?!1:this.$route.meta.show_sidebar==="from_page_layout"?!!this.spaceStore.currentPageLayout:!!this.$route.meta.show_sidebar},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()},"$route.name"(){this.space_profile&&this.setSpaceTitle(this.space_profile.title)}},methods:{setSpaceTitle(e){this.$route.meta.owns_title||this.changeTitle(e)},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.setSpaceTitle(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.setSpaceTitle(e.title)):await this.getSpaceProfile()},beforeUnmount(){this.spaceStore.clearCurrentSpace()}},ww=["aria-label"],Cw={class:"space_route"},$w={key:0},Sw={key:2,class:"space_holder"},Vw={key:3};function Mw(e,t,s,u,o,i){const m=g("Lock"),f=j,h=g("space-icon"),p=g("router-link"),k=g("space-menu"),b=g("render-space-links"),$=g("space-header"),w=Q,C=g("not-found-result"),v=g("lockscreen-view"),S=g("router-view"),T=ut,V=g("AboutSpace"),P=_t,L=mt,x=g("layout"),A=g("app-layout");return n(),y(A,{wrapper_class:i.wrapperLayoutClasses},{default:d(()=>[a(x,{wrapper_class:["no_bg_layout",{custom_lockscreen:i.isCustomLockScreen},"fcom_route_"+e.$route.name],title:"...."},{title:d(()=>[l("h1",{onClick:t[0]||(t[0]=U=>{e.$eventBus.emit("toTop"),i.resetRoute()}),class:"fcom_page_title"},[i.space_profile?(n(),y(p,{key:0,class:"fcom_space_title",to:{name:"space_feeds",params:{space:s.space}}},{default:d(()=>[i.isCustomLockScreen?(n(),y(f,{key:0},{default:d(()=>[a(m)]),_:1})):i.showProfileLogo?(n(),y(h,{key:1,space_profile:i.space_profile},null,8,["space_profile"])):_("",!0),l("span",null,c(i.space_profile.title),1)]),_:1},8,["to"])):_("",!0)])]),actions:d(()=>[i.showSpaceMenu?(n(),y(k,{key:0,space:s.space,space_profile:i.space_profile,onDoSearch:t[1]||(t[1]=U=>{o.search=U}),onRefetch:t[2]||(t[2]=U=>i.getSpaceProfile())},null,8,["space","space_profile"])):_("",!0)]),sub_header:d(()=>[i.space_profile&&!i.isCustomLockScreen&&i.hasEnabledSpaceLinks?(n(),r("nav",{key:0,"aria-label":e.$t("Space Links"),class:"fcom_sub_header"},[a(b,{links:i.space_profile.settings.links},null,8,["links"])],8,ww)):_("",!0)]),default:d(()=>[i.showSpaceHeader?(n(),y($,{key:0,onRefetch:t[3]||(t[3]=U=>i.getSpaceProfile()),space:s.space,space_profile:i.space_profile},null,8,["space","space_profile"])):_("",!0),a(L,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:d(()=>[a(T,{class:"fcom_main"},{default:d(()=>[l("div",{class:D([i.feedCssClasses,"fcom_feed_box"])},[l("div",Cw,[i.loading?(n(),r("div",$w,[a(w,{class:"white_loaded",rows:10,animated:!0})])):o.notFound?(n(),y(C,{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(),r("div",Sw,[i.isCustomLockScreen?(n(),y(v,{key:0,space_profile:i.space_profile,joining:o.joining,onJoin:t[4]||(t[4]=U=>i.processJoin())},null,8,["space_profile","joining"])):_("",!0),i.has_permission?(n(),y(S,{key:s.space,search:o.search,onRefetch:t[5]||(t[5]=U=>i.getSpaceProfile()),space_profile:i.space_profile,space_slug:s.space},null,8,["search","space_profile","space_slug"])):_("",!0)])):(n(),r("div",Vw,[l("h4",null,c(e.$t("Sorry! this community could not be loaded")),1)]))])],2)]),_:1}),i.showSideBar?(n(),y(P,{key:0,class:"fcom_resp_side",width:"306px"},{default:d(()=>[a(V,{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 Lw=I(kw,[["render",Mw]]),Tw={name:"CreateFeed",props:["space_slug","space_profile","space","search"],emits:["refetch"],components:{CreateStatusForm:Et,Feeds:pt},setup(){return{spaceStore:He()}},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:ts((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)}},Fw={key:0,class:"fcom_space_topics"},Iw={ref:"fcom_topics_filters",class:"fcom_topics_filters"};function Pw(e,t,s,u,o,i){var p,k,b;const m=O,f=Pe,h=g("feeds");return n(),r(F,null,[i.spaceTopics?(n(),r("div",Fw,[a(f,null,{default:d(()=>[l("div",Iw,[a(m,{onClick:t[0]||(t[0]=$=>i.setTopic("")),class:D({fcom_active_topic:!o.topic_slug})},{default:d(()=>[M(c(e.$t("All")),1)]),_:1},8,["class"]),(n(!0),r(F,null,R(i.spaceTopics,$=>(n(),y(m,{key:$.slug,onClick:w=>i.setTopic($.slug),class:D({fcom_active_topic:$.slug==o.topic_slug})},{default:d(()=>[M(c($.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:((p=s.space_profile.settings)==null?void 0:p.disable_post_sort_by)!=="yes",default_order_by:((k=s.space_profile.settings)==null?void 0:k.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 Ew=I(Tw,[["render",Pw]]),Aw={name:"SpaceHomeRedirect",created(){this.$router.replace({name:"space_feeds",params:{space:this.$route.params.space}})}},Uw={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)}},Bw={class:"fcom_invitation_form",ref:"inviteForm"};function Dw(e,t,s,u,o,i){const m=oe,f=pe,h=dt,p=ct,k=O,b=ge,$=se("loading");return n(),r("div",Bw,[a(b,{onSubmit:t[2]||(t[2]=q(w=>e.doNothing(),["prevent"])),modelValue:o.inviatation,"onUpdate:modelValue":t[3]||(t[3]=w=>o.inviatation=w),"label-position":"top"},{default:d(()=>[a(p,{gutter:30},{default:d(()=>[a(h,{sm:24,md:12},{default:d(()=>[a(f,{label:e.$t("Invitee email")},{default:d(()=>[a(m,{modelValue:o.inviatation.email,"onUpdate:modelValue":t[0]||(t[0]=w=>o.inviatation.email=w),placeholder:e.$t("Enter invitee email"),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),a(h,{sm:24,md:12},{default:d(()=>[a(f,{label:e.$t("Invitee Name (optional)")},{default:d(()=>[a(m,{modelValue:o.inviatation.invitee_name,"onUpdate:modelValue":t[1]||(t[1]=w=>o.inviatation.invitee_name=w),placeholder:e.$t("Enter invitee Name"),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1}),a(f,null,{default:d(()=>[Y((n(),y(k,{disabled:o.saving,class:"fcom_primary_button",onClick:i.sendInvitation},{default:d(()=>[M(c(e.$t("Send Invitation")),1)]),_:1},8,["disabled","onClick"])),[[$,o.saving]])]),_:1})]),_:1},8,["modelValue"])],512)}const Rw=I(Uw,[["render",Dw]]),xw={name:"AddMemberForm",components:{InviationForm:Rw},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()}},Ow={class:"fcom_select_photo",style:{float:"left"}},Hw=["src","alt"],jw={style:{float:"right",color:"#8492a6","font-size":"13px"}},Nw={key:1},zw={class:"fcom_spaced_flex"},qw={key:0},Gw={key:1},Yw={key:1},Ww={key:0},Kw={key:1};function Zw(e,t,s,u,o,i){const m=le,f=O,h=ae,p=pe,k=ge,b=g("InviationForm"),$=se("loading");return o.showingForm=="addByUser"?(n(),y(k,{key:0,onSubmit:t[4]||(t[4]=q(w=>e.doNothing(),["prevent"])),"label-position":"top",modelValue:o.form,"onUpdate:modelValue":t[5]||(t[5]=w=>o.form=w)},{default:d(()=>[o.form.editing_user?(n(),r("p",Nw,c(e.$t("Editing manager role for"))+" "+c(o.form.editing_user.display_name),1)):(n(),y(p,{key:0,label:e.$t("Search for an existing user or Invite by Email")},{default:d(()=>[Y((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]=w=>o.form.user_id=w)},{empty:d(()=>[l("p",null,c(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]=w=>i.invitePerson())},{default:d(()=>[M(c(e.$t("Send Email Invitation")),1)]),_:1},8,["disabled","loading"])]),default:d(()=>[(n(!0),r(F,null,R(o.users,w=>(n(),y(m,{class:"fcom_with_photo_option",key:w.ID,label:w.display_name+" ("+(w.user_email||w.ID)+")",value:w.ID},{default:d(()=>[l("span",Ow,[l("img",{src:w.photo,alt:w.display_name},null,8,Hw),l("span",null,c(w.display_name),1)]),l("span",jw,c(w.user_email||w.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["remote-method","placeholder","modelValue"])),[[$,o.loading]])]),_:1},8,["label"])),a(p,{label:e.$t("Membership Role")},{default:d(()=>[a(h,{placeholder:e.$t("Select Role"),modelValue:o.form.role,"onUpdate:modelValue":t[2]||(t[2]=w=>o.form.role=w)},{default:d(()=>[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"]),K(e.$slots,"after_form",{},()=>[l("div",zw,[a(f,{class:"fcom_primary_button",loading:o.adding,disabled:o.adding,onClick:t[3]||(t[3]=w=>i.addMember())},{default:d(()=>[o.form.editing_user?(n(),r("span",qw,c(e.$t("Update Role")),1)):(n(),r("span",Gw,c(e.$t("Add as %s",o.form.role)),1))]),_:1},8,["loading","disabled"])])])]),_:3},8,["modelValue"])):(n(),r("div",Yw,[e.has_pro?(n(),r("div",Ww,[a(b,{space_id:s.space_profile.id,default_value:o.invite_search,onCompleted:t[6]||(t[6]=w=>e.$emit("completed"))},null,8,["space_id","default_value"])])):(n(),r("div",Kw,[l("p",null,c(e.$t("Member Invitation feature is only available on the Pro version")),1)]))]))}const Qw=I(xw,[["render",Zw]]),Jw={name:"AddMembersForm",components:{SpaceCourseSelector:ms},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 p=new Set,k=[];for(let b=h;b=0&&$[i]||"",C=m>=0?($[m]||"").toLowerCase():"",v=f>=0&&$[f]||"";!C.includes("@")||p.has(C)||(p.add(C),k.push({name:w,email:C,username:v}))}return k},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,p=i+h;this.batchProcessed=Math.min(s,p),this.batchProgress=Math.round(this.batchProcessed/s*100),o(p)}).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,p=>({url:s,data:{user_ids:p}}),o)}).catch(h=>{this.$handleError(h),this.batchRunning=!1;const p=u.length+o;this.importDone={added:0,skipped:0,failed:o,total:p},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 p=e.slice(h,h+500),{url:k,data:b}=t(p);this.$post(k,b).then($=>{i.added+=$.added||0,i.skipped+=$.skipped||0,i.failed+=$.failed||0;const w=$.processed&&$.processed>0?$.processed:p.length,C=h+w;this.batchProcessed=Math.min(o,C),this.batchProgress=Math.round(this.batchProcessed/o*100),f(C)}).catch($=>{this.$handleError($),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()}},Xw={class:"fcom_add_members_form"},e3={key:0,class:"fcom_source_selector_wrap fcom_mb_20"},t3={key:1,class:"fcom_import_done"},s3={class:"fcom_done_title"},o3={class:"fcom_done_subtitle"},i3={class:"fcom_import_summary"},n3={class:"fcom_import_summary_title"},l3={class:"fcom_import_summary_row"},a3={class:"fcom_import_summary_row"},r3={key:0,class:"fcom_import_summary_row"},d3={key:1,class:"fcom_import_summary_row"},c3={key:2,class:"fcom_import_progress_wrap"},u3={class:"fcom_help_text fcom_mb_15"},_3={key:0,class:"fcom_muted_text fcom_mt_10"},m3={class:"fcom_select_photo",style:{float:"left"}},h3=["src","alt"],f3={style:{float:"right",color:"#8492a6","font-size":"13px"}},p3={style:{padding:"4px","text-align":"center"}},g3={style:{margin:"0 0 8px"}},y3={key:0},v3={key:1},b3={key:2},k3={key:1,style:{margin:"4px 0 0","font-size":"12px"}},w3={key:0,class:"fcom_help_text fcom_mb_10"},C3=["href"],$3={class:"fcom_help_text fcom_mb_15"},S3={key:0},V3={key:2},M3={class:"fcom_spaced_flex fcom_mb_10"},L3={class:"fcom_csv_drop_inner"},T3={class:"el-upload__text fcom_mt_10"},F3={key:0},I3={class:"el-upload__tip"},P3={class:"fcom_spaced_flex fcom_mb_10"},E3={class:"fcom_muted_text",style:{"margin-left":"8px"}},A3={key:0,class:"fcom_muted_text fcom_mb_10"},U3=["aria-label"],B3={class:"fcom_help_text fcom_mb_15"},D3=["aria-label"],R3={class:"fcom_help_text fcom_mb_15"},x3={key:0};function O3(e,t,s,u,o,i){const m=je,f=be,h=wt,p=le,k=O,b=ae,$=pe,w=ge,C=g("SpaceCourseSelector"),v=kt,S=Qt,T=Jt,V=ve,P=se("loading");return n(),r("div",Xw,[!o.batchRunning&&!o.importDone?(n(),r("div",e3,[a(f,{modelValue:o.sourceMode,"onUpdate:modelValue":t[0]||(t[0]=L=>o.sourceMode=L),size:"small"},{default:d(()=>[a(m,{value:"wp_users"},{default:d(()=>[M(c(e.$t("WP Users")),1)]),_:1}),a(m,{value:"from_source"},{default:d(()=>[M(c(e.$t("From Space/Course")),1)]),_:1}),a(m,{value:"csv"},{default:d(()=>[M(c(e.$t("CSV Import")),1)]),_:1}),e.appVars.has_fluentcrm?(n(),y(m,{key:0,value:"crm_tag"},{default:d(()=>[M(c(e.$t("CRM Tag")),1)]),_:1})):_("",!0)]),_:1},8,["modelValue"])])):_("",!0),o.importDone?(n(),r("div",t3,[t[19]||(t[19]=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)),l("h3",s3,c(e.$t("All Done!")),1),l("p",o3,c(e.$t("Import has been completed. You may close this now.")),1),l("div",i3,[l("strong",n3,c(e.$t("Import Summary")),1),l("p",l3,c(e.$t("Total Records:"))+" "+c(o.importDone.total),1),l("p",a3,c(s.context==="course"?e.$t("Enrolled:"):e.$t("Added:"))+" "+c(o.importDone.added),1),o.importDone.skipped?(n(),r("p",r3,c(e.$t("Skipped:"))+" "+c(o.importDone.skipped),1)):_("",!0),o.importDone.failed?(n(),r("p",d3,c(e.$t("Failed:"))+" "+c(o.importDone.failed),1)):_("",!0)])])):o.batchRunning?(n(),r("div",c3,[l("div",u3,[l("p",null,c(e.$t("Importingโ€ฆ Please do not close this window.")),1)]),a(h,{percentage:o.batchProgress,"stroke-width":12},null,8,["percentage"]),o.batchTotal?(n(),r("p",_3,c(o.batchProcessed)+" / "+c(o.batchTotal)+" "+c(e.$t("processed")),1)):_("",!0)])):(n(),r(F,{key:3},[o.sourceMode==="wp_users"?(n(),y(w,{key:0,onSubmit:t[5]||(t[5]=q(()=>{},["prevent"])),"label-position":"top"},{default:d(()=>[a($,{label:e.$t("Users")},{default:d(()=>[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]=L=>o.selectedUserIds=L)},{empty:d(()=>[l("div",p3,[l("p",g3,[i.isEmail?(n(),r("span",y3,[M(c(e.$t("User not registered:"))+" ",1),l("strong",null,c(o.currentSearch),1)])):o.currentSearch?(n(),r("span",v3,c(e.$t("No matching user found.")),1)):(n(),r("span",b3,c(e.$t("No data")),1))]),s.context==="space"?(n(),r(F,{key:0},[i.isEmail?(n(),y(k,{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]=L=>i.inviteToSpace())},{default:d(()=>[M(c(e.$t("Send Email Invitation")),1)]),_:1},8,["loading","disabled","aria-label"])):o.currentSearch?(n(),r("p",k3,c(e.$t("Type a valid email to invite.")),1)):_("",!0)],64)):_("",!0)])]),default:d(()=>[(n(!0),r(F,null,R(o.wpUsers,L=>(n(),y(p,{class:"fcom_with_photo_option",key:L.ID,label:`${L.display_name} (${L.user_email||L.ID})`,value:L.ID},{default:d(()=>[l("span",m3,[l("img",{src:L.photo,alt:L.display_name},null,8,h3),l("span",null,c(L.display_name),1)]),l("span",f3,c(L.user_email||L.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["loading","remote-method","placeholder","modelValue"])]),_:1},8,["label"]),s.context==="space"?(n(),y($,{key:0,label:e.$t("Membership Role")},{default:d(()=>[a(b,{modelValue:o.role,"onUpdate:modelValue":t[3]||(t[3]=L=>o.role=L),placeholder:e.$t("Select Role")},{default:d(()=>[a(p,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(p,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(p,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a($,null,{default:d(()=>[o.selectedUserIds.length>1&&!e.appVars.pro?(n(),r("div",w3,[l("p",null,[M(c(e.$t("Bulk adding requires FluentCommunity Pro."))+" ",1),e.appVars.upgrade_url?(n(),r("a",{key:0,href:e.$upgradeUrl("feature_lock_bulk_add_members"),target:"_blank"},c(e.$t("Upgrade")),9,C3)):_("",!0)])])):_("",!0),Y((n(),y(k,{class:"fcom_primary_button",onClick:t[4]||(t[4]=L=>i.addWpUsers())},{default:d(()=>[M(c(s.context==="course"?e.$t("Add Students"):e.$t("Add as %s",o.role)),1)]),_:1})),[[P,o.saving]])]),_:1})]),_:1})):o.sourceMode==="from_source"?(n(),y(w,{key:1,"label-position":"top"},{default:d(()=>[a($,{label:e.$t("Select Source Space or Course")},{default:d(()=>[a(C,{modelValue:o.selectedSourceId,"onUpdate:modelValue":t[6]||(t[6]=L=>o.selectedSourceId=L),placeholder_text:e.$t("Select a space or course..."),memberships:[s.target.id.toString()],onSelectedType:t[7]||(t[7]=L=>o.selectedSourceType=L),onSelectedSlug:t[8]||(t[8]=L=>o.selectedSourceSlug=L)},null,8,["modelValue","placeholder_text","memberships"])]),_:1},8,["label"]),l("div",$3,[l("p",null,c(s.context==="course"?e.$t("All users will be enrolled as Student."):e.$t("All users will be added as Member.")),1)]),a(k,{class:"fcom_primary_button",onClick:t[9]||(t[9]=L=>i.importFromSource())},{default:d(()=>[M(c(s.context==="course"?e.$t("Import Students"):e.$t("Import Members"))+" ",1),e.appVars.pro?_("",!0):(n(),r("span",S3," ย ("+c(e.$t("Pro"))+")",1))]),_:1})]),_:1})):o.sourceMode==="csv"?(n(),r("div",V3,[o.csvRows.length?(n(),r(F,{key:1},[l("div",P3,[l("div",null,[l("strong",null,c(o.csvFileName),1),l("span",E3,c(o.csvRows.length)+" "+c(e.$t("contacts")),1)]),a(k,{link:"",size:"small",onClick:t[11]||(t[11]=L=>i.resetCsvImport())},{default:d(()=>[M(c(e.$t("Change")),1)]),_:1})]),a(T,{data:o.csvRows.slice(0,5),size:"small",class:"fcom_mb_10"},{default:d(()=>[a(S,{prop:"name",label:e.$t("Name"),"min-width":"120"},null,8,["label"]),a(S,{prop:"email",label:e.$t("Email"),"min-width":"160"},null,8,["label"]),a(S,{prop:"username",label:e.$t("Username"),"min-width":"110"},null,8,["label"])]),_:1},8,["data"]),o.csvRows.length>5?(n(),r("p",A3," + "+c(o.csvRows.length-5)+" "+c(e.$t("more rows")),1)):_("",!0),a(w,{"label-position":"top"},{default:d(()=>[a($,null,{default:d(()=>[l("div",{role:"group","aria-label":e.$t("Create WordPress accounts for new email addresses")},[l("div",null,[a(V,{modelValue:o.createMissingUsers,"onUpdate:modelValue":t[12]||(t[12]=L=>o.createMissingUsers=L),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Create WordPress accounts for new email addresses")),1)]),_:1},8,["modelValue"])]),l("div",null,[Y(a(V,{modelValue:o.sendWelcomeEmailCsv,"onUpdate:modelValue":t[13]||(t[13]=L=>o.sendWelcomeEmailCsv=L),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Send default WordPress welcome email for new users")),1)]),_:1},8,["modelValue"]),[[bt,o.createMissingUsers]])])],8,U3)]),_:1}),l("div",B3,[l("p",null,c(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($,null,{default:d(()=>[a(k,{class:"fcom_primary_button",onClick:t[14]||(t[14]=L=>i.importCsv())},{default:d(()=>[M(c(s.context==="course"?e.$t("Import Students"):e.$t("Import Members")),1)]),_:1})]),_:1})]),_:1})],64)):(n(),r(F,{key:0},[l("div",M3,[t[20]||(t[20]=l("span",null,null,-1)),e.appVars.pro?(n(),y(k,{key:0,link:"",size:"small",onClick:t[10]||(t[10]=L=>i.downloadSampleCsv())},{default:d(()=>[M("โ†“ "+c(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:d(()=>[l("div",I3,c(e.$t("Columns: Name, Email, Username")),1)]),default:d(()=>[l("div",L3,[t[22]||(t[22]=l("div",{class:"fcom_csv_drop_arrow"},"โ†‘",-1)),l("div",T3,[M(c(e.$t("Drop CSV here or"))+" ",1),l("em",null,c(e.$t("click to browse")),1),t[21]||(t[21]=M()),e.appVars.pro?_("",!0):(n(),r("span",F3," ย ("+c(e.$t("Pro"))+")",1))])])]),_:1},8,["on-change","disabled"])],64))])):o.sourceMode==="crm_tag"?(n(),y(w,{key:3,"label-position":"top"},{default:d(()=>[a($,{label:e.$t("FluentCRM Tag")},{default:d(()=>[a(b,{modelValue:o.selectedTagId,"onUpdate:modelValue":t[15]||(t[15]=L=>o.selectedTagId=L),loading:o.crmTagsLoading,placeholder:e.$t("Select a tag"),style:{width:"100%"}},{default:d(()=>[(n(!0),r(F,null,R(o.crmTags,L=>(n(),y(p,{key:L.id,label:L.title,value:L.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"])]),_:1},8,["label"]),a($,null,{default:d(()=>[l("div",{role:"group","aria-label":e.$t("Create WordPress accounts for contacts without an existing account")},[l("div",null,[a(V,{modelValue:o.createMissingCrmUsers,"onUpdate:modelValue":t[16]||(t[16]=L=>o.createMissingCrmUsers=L),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Create WordPress accounts for contacts without an existing account")),1)]),_:1},8,["modelValue"])]),l("div",null,[Y(a(V,{modelValue:o.sendWelcomeEmailCrm,"onUpdate:modelValue":t[17]||(t[17]=L=>o.sendWelcomeEmailCrm=L),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Send default WordPress welcome email for new users")),1)]),_:1},8,["modelValue"]),[[bt,o.createMissingCrmUsers]])])],8,D3)]),_:1}),l("div",R3,[l("p",null,c(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(k,{class:"fcom_primary_button",onClick:t[18]||(t[18]=L=>i.addFromCrmTag())},{default:d(()=>[M(c(s.context==="course"?e.$t("Add Students"):e.$t("Add Members")),1),e.appVars.pro?_("",!0):(n(),r("span",x3," ย ("+c(e.$t("Pro"))+")",1))]),_:1})]),_:1})):_("",!0)],64))])}const H3=I(Jw,[["render",O3]]),j3={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"}}},N3={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"},z3=["d"];function q3(e,t,s,u,o,i){return n(),r("svg",N3,[t[0]||(t[0]=l("line",{x1:"2.5",y1:"4",x2:"8.5",y2:"4"},null,-1)),t[1]||(t[1]=l("line",{x1:"2.5",y1:"8",x2:"6.5",y2:"8"},null,-1)),t[2]||(t[2]=l("line",{x1:"2.5",y1:"12",x2:"4.5",y2:"12"},null,-1)),l("path",{d:i.arrowPath},null,8,z3)])}const G3=I(j3,[["render",q3]]);let Y3=0;const W3={name:"SortControl",components:{SortDirIcon:G3},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=++Y3;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"))}}},K3={class:"fcom_feed_filter_icon"},Z3={class:"fcom_feed_filter_value"},Q3={role:"presentation",class:"fcom_feed_filter_group"},J3=["id"],X3=["aria-labelledby"],e8={role:"presentation",class:"fcom_feed_filter_group"},t8=["id"],s8=["aria-labelledby"],o8={class:"fcom_sort_option"},i8={class:"fcom_sort_option"};function n8(e,t,s,u,o,i){const m=g("SortDirIcon"),f=g("ArrowDown"),h=j,p=O,k=We,b=Ke,$=Ze;return n(),y($,{class:"fcom_feed_filter_dropdown","popper-class":"fcom_feed_filter_pop",trigger:"click",placement:"bottom-end","hide-on-click":!1},{dropdown:d(()=>[a(b,{class:"fcom_feed_filter_menu"},{default:d(()=>[l("li",Q3,[l("span",{id:o.sortLabelId,class:"fcom_feed_filter_group_label"},c(e.$t("Sort by")),9,J3),l("ul",{role:"group","aria-labelledby":o.sortLabelId,class:"fcom_feed_filter_group_list"},[(n(!0),r(F,null,R(s.options,w=>(n(),y(k,{key:w.value,role:"menuitemradio","aria-checked":s.field===w.value,"aria-current":s.field===w.value?"true":void 0,class:D({fcom_feed_filter_selected:s.field===w.value}),onClick:C=>i.selectField(w)},{default:d(()=>[M(c(w.label),1)]),_:2},1032,["aria-checked","aria-current","class","onClick"]))),128))],8,X3)]),l("li",e8,[l("span",{id:o.orderLabelId,class:"fcom_feed_filter_group_label fcom_feed_filter_group_divided"},c(e.$t("Order")),9,t8),l("ul",{role:"group","aria-labelledby":o.orderLabelId,class:"fcom_feed_filter_group_list"},[a(k,{role:"menuitemradio","aria-checked":s.dir==="asc","aria-current":s.dir==="asc"?"true":void 0,class:D({fcom_feed_filter_selected:s.dir==="asc"}),onClick:t[0]||(t[0]=w=>i.selectDir("asc"))},{default:d(()=>[l("span",o8,[a(m,{dir:"asc"}),M(c(e.$t("Ascending")),1)])]),_:1},8,["aria-checked","aria-current","class"]),a(k,{role:"menuitemradio","aria-checked":s.dir==="desc","aria-current":s.dir==="desc"?"true":void 0,class:D({fcom_feed_filter_selected:s.dir==="desc"}),onClick:t[1]||(t[1]=w=>i.selectDir("desc"))},{default:d(()=>[l("span",i8,[a(m,{dir:"desc"}),M(c(e.$t("Descending")),1)])]),_:1},8,["aria-checked","aria-current","class"])],8,s8)])]),_:1})]),default:d(()=>[a(p,{text:"",class:"fcom_feed_filter_trigger","aria-label":i.ariaLabel},{default:d(()=>[l("span",K3,[a(m,{dir:s.dir},null,8,["dir"])]),l("span",Z3,c(i.currentLabel),1),a(h,{class:"fcom_feed_filter_caret"},{default:d(()=>[a(f)]),_:1})]),_:1},8,["aria-label"])]),_:1})}const Ao=I(W3,[["render",n8]]),l8={name:"SpaceMembers",props:["space","space_profile"],components:{Search:Fe,Pagination:$e,FollowAction:st,AddMemberForm:Qw,AddMembersForm:H3,SortControl:Ao,ActionPopover:et,Drawer:wo},setup(){return{uiStore:Mt()}},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()}},a8={ref:"space_members"},r8={key:0,class:"card_header"},d8={class:"member_status"},c8={class:"add_member"},u8={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},_8={class:"permission_failed"},m8=["href"],h8={key:2},f8={class:"search_member fcom_mb_20"},p8={key:0,class:"feed_filters"},g8={class:"card_list"},y8={class:"card_content"},v8={class:"card_avatar"},b8={class:"card_info"},k8={class:"card_name"},w8={class:"info_header"},C8={class:"meta_line"},$8={key:0,class:"card_headline"},S8={class:"feed_meta_info"},V8=["title"],M8=["title"],L8=["title"],T8={key:1,class:"card_description"},F8={class:"card_footer"},I8={class:"card_action"},P8={class:"pagination_wrap"},E8={key:0,class:"loading"},A8={key:1,class:"no_members"};function U8(e,t,s,u,o,i){const m=je,f=be,h=O,p=g("Search"),k=j,b=oe,$=g("SortControl"),w=g("UserAvatar"),C=g("UserRouteLink"),v=De,S=g("FollowAction"),T=g("action-popover"),V=g("Pagination"),P=Q,L=g("add-members-form"),x=g("drawer"),A=g("add-member-form"),U=se("loading");return n(),r(F,null,[l("div",a8,null,512),e.hasSpaceAdminAccess(s.space_profile)?(n(),r("div",r8,[l("div",d8,[o.pending_count?(n(),y(f,{key:0,onChange:i.toSearch,modelValue:o.status,"onUpdate:modelValue":t[0]||(t[0]=B=>o.status=B),class:"status_group"},{default:d(()=>[a(m,{value:"active"},{default:d(()=>[M(c(e.$t("Active")),1)]),_:1}),a(m,{value:"pending"},{default:d(()=>[M(c(e.$t("Pending"))+" ("+c(o.pending_count)+")",1)]),_:1})]),_:1},8,["onChange","modelValue"])):_("",!0)]),l("div",c8,[a(h,{class:"fcom_primary_button",onClick:t[1]||(t[1]=B=>o.addingNewMember=!0)},{default:d(()=>[M(c(e.$t("Add Member")),1)]),_:1}),a(h,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=B=>e.$router.push({name:"space_invitations"}))},{default:d(()=>[M(c(e.$t("Invitations")),1)]),_:1})])])):_("",!0),o.permission_failed?(n(),r("div",u8,[l("div",_8,[l("h3",null,c(e.$t("Permission Denied")),1),l("p",null,c(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"},c(e.$t("Go to Space Home")),9,m8)])])):(n(),r("div",h8,[l("div",f8,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[3]||(t[3]=B=>o.search=B),placeholder:e.$t("Search...")},{prefix:d(()=>[a(k,null,{default:d(()=>[a(p)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),o.status!="pending"?(n(),r("div",p8,[t[11]||(t[11]=l("div",{class:"fcom_feed_divider"},null,-1)),a($,{field:o.sort_by,"onUpdate:field":t[4]||(t[4]=B=>o.sort_by=B),dir:o.sort_dir,"onUpdate:dir":t[5]||(t[5]=B=>o.sort_dir=B),options:i.sortOptions,onChange:i.onSortChange},null,8,["field","dir","options","onChange"])])):_("",!0),l("div",{class:D(["fcom_dir_layout_"+o.memberLayout,"space_members fcom_dir_layout"])},[Y((n(),r("div",g8,[(n(!0),r(F,null,R(o.members,(B,N)=>{var H,z,G,ne,E;return Y((n(),r("div",{key:B.id,class:"each_card"},[l("div",y8,[l("div",v8,[a(w,{xprofile:B.xprofile,is_online:e.isOnline(B.xprofile.last_activity)},null,8,["xprofile","is_online"])]),l("div",b8,[l("div",k8,[l("div",w8,[a(C,{xprofile:B.xprofile,show_badge:!0,show_follow:!0},null,8,["xprofile"]),l("div",C8,"@"+c((H=B.xprofile)==null?void 0:H.username),1)]),(G=(z=B.xprofile)==null?void 0:z.meta)!=null&&G.headline?(n(),r("div",$8,c(B.xprofile.meta.headline),1)):_("",!0),l("div",S8,[o.status!="pending"&&B.created_at?(n(),r("div",{key:0,title:B.created_at,class:"meta_line"},c(e.$t("Joined %s",e.humanDateDiff(B.created_at))),9,V8)):B.created_at?(n(),r("div",{key:1,title:B.created_at,class:"meta_line"},c(e.$t("Requested %s",e.humanDateDiff(B.created_at))),9,M8)):_("",!0),B.xprofile.last_activity?(n(),r("div",{key:2,title:B.xprofile.last_activity,class:"meta_line"},c(e.$t("Last seen: %s",e.humanDateDiff(B.xprofile.last_activity))),9,L8)):_("",!0)]),(ne=B.xprofile)!=null&&ne.short_description?(n(),r("div",T8,c(e.getExcerpt(((E=B.xprofile.meta)==null?void 0:E.short_description_rendered)||B.xprofile.short_description,120)),1)):_("",!0),B.role!="member"?(n(),y(v,{key:2,type:"success"},{default:d(()=>[M(c(e.$labelize(B.role)),1)]),_:2},1024)):_("",!0)]),o.status=="pending"?(n(),r(F,{key:0},[t[12]||(t[12]=l("div",{class:"card_break"},null,-1)),l("div",F8,[a(h,{class:"fcom_primary_button",onClick:J=>i.approveMember(B,N)},{default:d(()=>[M(c(e.$t("Approve")),1)]),_:1},8,["onClick"]),a(h,{class:"fcom_secondary_button",onClick:J=>i.removeMember(B,N)},{default:d(()=>[M(c(e.$t("Decline")),1)]),_:1},8,["onClick"])])],64)):_("",!0)])]),l("div",I8,[a(S,{profile:B.xprofile},null,8,["profile"]),o.status!="pending"&&s.space_profile&&e.hasInPermission("can_remove_member",s.space_profile.permissions)?(n(),y(T,{key:0,placement:"bottom",width:200,items:[{label:e.$t("Remove Member"),action:()=>{i.removeMemberPrompt(B,N)}},{label:e.$t("Change Membership"),action:()=>{i.initAddMember(B)}}]},null,8,["items"])):_("",!0)])])),[[U,o.workingIds.includes(B.user_id)]])}),128))])),[[U,o.loading]]),l("div",P8,[a(V,{hide_on_single:!0,onFetch:t[6]||(t[6]=B=>i.fetch()),pagination:o.pagination},null,8,["pagination"])]),o.loading&&!o.pagination.total?(n(),r("div",E8,[a(P,{class:"white_loaded",rows:3,animated:!0}),a(P,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):!o.loading&&!o.members.length?(n(),r("div",A8,c(e.$t("No %s members found in this community.",o.status)),1)):_("",!0)],2)])),o.addingNewMember?(n(),y(x,{key:3,modelValue:o.addingNewMember,"onUpdate:modelValue":t[8]||(t[8]=B=>o.addingNewMember=B),size:e.drawerWidth,"append-to-body":!0,title:e.$t("Add Member")},{default:d(()=>[o.addingNewMember?(n(),y(L,{key:0,context:"space",target:s.space_profile,onCompleted:i.handleBulkMemberAdded,onMembersAdded:t[7]||(t[7]=B=>i.fetch())},null,8,["target","onCompleted"])):_("",!0)]),_:1},8,["modelValue","size","title"])):_("",!0),o.addingMember?(n(),y(x,{key:4,modelValue:o.addingMember,"onUpdate:modelValue":t[10]||(t[10]=B=>o.addingMember=B),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:d(()=>[o.addingMember?(n(),y(A,{key:0,space_profile:s.space_profile,modelValue:o.editing_member,"onUpdate:modelValue":t[9]||(t[9]=B=>o.editing_member=B),onCompleted:i.handleMemberUpdated},null,8,["space_profile","modelValue","onCompleted"])):_("",!0)]),_:1},8,["modelValue","size","title"])):_("",!0)],64)}const B8=I(l8,[["render",U8]]);const D8={name:"DocumentUploadForm",components:{CreateStatusForm:Et},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")}}},R8={class:"fcom_document_upload_form"};function x8(e,t,s,u,o,i){const m=ve,f=g("CreateStatusForm");return n(),r("div",R8,[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:d(()=>[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:d(()=>[M(c(e.$t("Publish as a post")),1)]),_:1},8,["modelValue"])]),_:1},8,["default_placeholder","initial_placeholder","btn_text","editing_feed","space","onAdded"])])}const O8=I(D8,[["render",x8]]),H8={name:"DocumentFeedCard",components:{ChatIcon:Je,HeartIcon:Xe,DocumentLists:tt,UserRouteLink:Te},props:["feed"],computed:{can_manage(){return this.canEditFeed(this.feed)}}},j8={class:"fcom_document_feed_card feed"},N8={class:"feed_header"},z8={key:0,class:"feed_user"},q8={class:"feed_user_name"},G8={class:"feed_title"},Y8={class:"feed_title_heading"},W8=["href"],K8={class:"feed_meta_info"},Z8=["href"],Q8=["title"],J8=["href"],X8={style:{"margin-left":"5px","margin-right":"7px"}},e4=["href"],t4={style:{"margin-left":"5px"}},s4={class:"feed_body"};function o4(e,t,s,u,o,i){var k,b,$,w,C;const m=g("ChatIcon"),f=j,h=g("HeartIcon"),p=g("DocumentLists");return n(),r("div",j8,[l("div",N8,[s.feed.xprofile?(n(),r("div",z8,[l("div",q8,[l("div",G8,[l("h2",Y8,[l("a",{href:s.feed.permalink},c(s.feed.title||e.$t("Uploaded %s files",((b=(k=s.feed.meta)==null?void 0:k.document_lists)==null?void 0:b.length)||"--")),9,W8)])])]),l("div",K8,[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"}},c(e.humanDateDiff(s.feed.created_at))+" "+c(e.$t("by %s",($=s.feed.xprofile)==null?void 0:$.display_name)),9,Q8)],8,Z8),s.feed.comments_count?(n(),r("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:d(()=>[a(m)]),_:1}),l("span",X8,c(s.feed.comments_count),1)],8,J8)):_("",!0),s.feed.reactions_count?(n(),r("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:d(()=>[a(h,{filled:!0})]),_:1}),l("span",t4,c(s.feed.reactions_count),1)],8,e4)):_("",!0)])])):_("",!0)]),l("div",s4,[a(p,{document_lists:(C=(w=s.feed)==null?void 0:w.meta)==null?void 0:C.document_lists,allow_rename:i.can_manage,additional_data:{space_id:s.feed.space_id}},null,8,["document_lists","allow_rename","additional_data"])])])}const i4=I(H8,[["render",o4]]);const n4={name:"SpaceDocuments",props:["space","space_profile"],components:{FeedListItem:ko,Feed:ot,DocumentUploadForm:O8,UploadFilled:$t,Search:Fe,Pagination:$e,DocumentFeedCard:i4},emits:["refetch"],inheritAttrs:!1,data(){return{documents:[],loading:!1,pagination:{page:1,per_page:20,total:0},working:!1,search:"",SearchIcon:Wt(Fe),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)}},l4={ref:"space_docs"},a4={class:"card_header"},r4={class:"member_status"},d4={key:0,class:"add_member"},c4={key:0},u4={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},_4={class:"permission_failed"},m4=["href"],h4={key:2},f4={class:"search_member"},p4={class:""},g4={class:"card_list"},y4={class:"all_documents_wrap"},v4={key:0,style:{"margin-top":"20px","text-align":"center"}},b4={key:1,class:"loading"},k4={key:2,class:"no_members"};function w4(e,t,s,u,o,i){var C,v;const m=g("UploadFilled"),f=j,h=O,p=g("document-upload-form"),k=g("Search"),b=oe,$=g("document-feed-card"),w=Q;return n(),r(F,null,[l("div",l4,null,512),l("div",a4,[l("div",r4,[l("h3",null,c(e.$t("Documents and Files")),1)]),(v=(C=s.space_profile)==null?void 0:C.permissions)!=null&&v.can_upload_documents?(n(),r("div",d4,[o.show_uploader?(n(),y(h,{key:1,plain:"",onClick:t[1]||(t[1]=S=>o.show_uploader=!1),size:"small"},{default:d(()=>[l("span",null,c(e.$t("Cancel")),1)]),_:1})):(n(),y(h,{key:0,onClick:t[0]||(t[0]=S=>o.show_uploader=!0),class:"fcom_primary_button"},{default:d(()=>[a(f,null,{default:d(()=>[a(m)]),_:1}),l("span",null,c(e.$t("New Documents")),1)]),_:1}))])):_("",!0)]),o.show_uploader?(n(),r("div",c4,[a(p,{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(),r("div",u4,[l("div",_4,[l("h3",null,c(e.$t("Permission Denied")),1),l("p",null,c(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"},c(e.$t("Go to Space Home")),9,m4)])])):(n(),r("div",h4,[l("div",f4,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[3]||(t[3]=S=>o.search=S),placeholder:e.$t("Search...")},{prefix:d(()=>[a(f,null,{default:d(()=>[a(k)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",p4,[l("div",g4,[l("div",y4,[(n(!0),r(F,null,R(i.visibleDocuments,S=>(n(),r("div",{key:S.id,class:"feed_outer"},[a($,{feed:S},null,8,["feed"])]))),128))])]),!o.loading&&o.pagination.last_page!=o.pagination.page?(n(),r("div",v4,[a(h,{class:"fcom_secondary_button",disabled:o.loading,onClick:t[4]||(t[4]=S=>{o.pagination.page++,i.fetch(!0)})},{default:d(()=>[M(c(e.$t("Load more")),1)]),_:1},8,["disabled"])])):_("",!0),o.loading?(n(),r("div",b4,[a(w,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5})])):!o.loading&&!i.visibleDocuments.length?(n(),r("div",k4,c(e.$t("No documents found in this space based on your search criteria.")),1)):_("",!0)])]))],64)}const C4=I(n4,[["render",w4]]),$4={name:"LightboxMeta",components:{TopRight:li},props:{author:{type:Object,default:null},authorHref:{type:String,default:""},postDate:{type:String,default:""},permalink:{type:String,default:null}}},S4={class:"fcom_space_media_meta_group"},V4={key:0,class:"fcom_space_media_author_chip"},M4=["src","alt"],L4={class:"fcom_space_media_author_chip_text"},T4=["href"],F4={key:1,class:"fcom_space_media_author_chip_name"},I4={key:2,class:"fcom_space_media_author_chip_date"},P4=["href"];function E4(e,t,s,u,o,i){const m=Ee,f=g("TopRight"),h=j;return n(),r("div",S4,[s.author?(n(),r("div",V4,[s.author.avatar?(n(),r("img",{key:0,src:s.author.avatar,alt:s.author.name||"",class:"fcom_space_media_author_chip_avatar"},null,8,M4)):_("",!0),l("div",L4,[s.authorHref?(n(),y(m,{key:0,content:e.$t("View Profile"),placement:"top","show-after":200},{default:d(()=>[l("a",{href:s.authorHref,class:"fcom_space_media_author_chip_name fcom_space_media_author_chip_link"},c(s.author.name||e.$t("Member")),9,T4)]),_:1},8,["content"])):(n(),r("span",F4,c(s.author.name||e.$t("Member")),1)),s.postDate?(n(),r("span",I4,c(s.postDate),1)):_("",!0)])])):_("",!0),s.permalink?(n(),r("a",{key:1,href:s.permalink,class:"fcom_space_media_viewpost_btn"},[l("span",null,c(e.$t("View post")),1),a(h,{class:"fcom_space_media_viewpost_icon"},{default:d(()=>[a(f)]),_:1})],8,P4)):_("",!0)])}const A4=I($4,[["render",E4]]),Ae=1,Ls=5,U4=.2,B4=50,Ts=6,D4={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.imageScaleAe?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)>Ts||Math.abs(t.clientY-this.panStartY)>Ts)&&(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)>B4&&Math.abs(s)>Math.abs(u)&&(s<0?this.next():this.prev())}}},R4={name:"MediaLightbox",mixins:[D4],components:{FluentPlayerPreview:Lt,LightboxMeta:A4,Close:Ct,ArrowLeftBold:Ws,ArrowRightBold:ai},props:{modelValue:{type:Boolean,default:!1},items:{type:Array,default:()=>[]},initialIndex:{type:Number,default:0}},emits:["update:modelValue"],data(){return{currentIndex:0,fluentPlayerFailed:!1,nativeVideoFailed:!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:ri,disabled:!this.canZoomOut,action:()=>this.stepZoom(-1)},{label:this.$t("Zoom in"),icon:di,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{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.nativeVideoFailed=!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()}},x4=["aria-label"],O4=["aria-label"],H4=["aria-label"],j4={class:"fcom_media_sr_only","aria-live":"polite"},N4=["src","alt"],z4=["src","aria-label"],q4={key:2,class:"fcom_media_load_error"},G4=["src","aria-label"],Y4={key:0,class:"fcom_space_media_meta_bar"},W4={key:1,class:"fcom_space_media_image_controls"},K4={class:"fcom_space_media_zoom_bar"},Z4=["aria-label","disabled","onClick"];function Q4(e,t,s,u,o,i){const m=g("Close"),f=j,h=g("ArrowLeftBold"),p=g("ArrowRightBold"),k=g("fluent-player-preview"),b=g("lightbox-meta"),$=ke;return n(),y($,{modelValue:i.dialogOpen,"onUpdate:modelValue":t[13]||(t[13]=w=>i.dialogOpen=w),width:i.lightboxWidth,"show-close":!1,"align-center":"","destroy-on-close":"","before-close":i.handleBeforeClose,"aria-label":i.dialogAriaLabel,class:D(["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:d(()=>{var w,C,v,S,T,V,P,L;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]=(...x)=>i.requestClose&&i.requestClose(...x))},[a(f,null,{default:d(()=>[a(m)]),_:1})],8,x4),i.hasPrev?(n(),r("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]=(...x)=>i.prev&&i.prev(...x))},[a(f,null,{default:d(()=>[a(h)]),_:1})],8,O4)):_("",!0),i.hasNext?(n(),r("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]=(...x)=>i.next&&i.next(...x))},[a(f,null,{default:d(()=>[a(p)]),_:1})],8,H4)):_("",!0),l("div",{class:"fcom_space_media_video_stage",onClick:t[12]||(t[12]=q((...x)=>i.requestClose&&i.requestClose(...x),["self"]))},[l("p",j4,c(i.srAnnounce),1),l("div",{ref:"mediaBody",class:D(["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[11]||(t[11]=q((...x)=>i.requestClose&&i.requestClose(...x),["self"]))},[i.currentKind==="image"?(n(),r("img",{key:0,src:i.currentItem.url,alt:i.imageAlt,draggable:"false",style:ue(e.imageTransformStyle),class:D({fcom_space_media_dragging:e.isPanning}),onMousedown:t[3]||(t[3]=q((...x)=>e.onImagePanStart&&e.onImagePanStart(...x),["prevent"])),onTouchstart:t[4]||(t[4]=(...x)=>e.onImageTouchStart&&e.onImageTouchStart(...x)),onTouchmove:t[5]||(t[5]=q((...x)=>e.onImageTouchMove&&e.onImageTouchMove(...x),["prevent"])),onTouchend:t[6]||(t[6]=(...x)=>e.onImageTouchEnd&&e.onImageTouchEnd(...x)),onTouchcancel:t[7]||(t[7]=(...x)=>e.onImageTouchEnd&&e.onImageTouchEnd(...x)),onDblclick:t[8]||(t[8]=(...x)=>e.toggleImageZoom&&e.toggleImageZoom(...x))},null,46,N4)):i.currentKind==="video"||i.currentKind==="audio"?(n(),r(F,{key:1},[i.playerMedia&&i.hasFluentPlayer&&!o.fluentPlayerFailed?(n(),y(k,{key:i.playerMedia.media_id,media:i.playerMedia,onLoadFailed:t[9]||(t[9]=x=>o.fluentPlayerFailed=!0)},null,8,["media"])):i.currentKind==="video"&&i.currentMediaUrl&&!o.nativeVideoFailed?(n(),r("video",{key:1,src:i.currentMediaUrl,"aria-label":((C=(w=i.currentItem)==null?void 0:w.settings)==null?void 0:C.title)||((S=(v=i.currentItem)==null?void 0:v.feed)==null?void 0:S.title)||e.$t("Video"),controls:"",autoplay:"",playsinline:"",onError:t[10]||(t[10]=x=>o.nativeVideoFailed=!0)},null,40,z4)):i.currentKind==="video"&&i.currentMediaUrl?(n(),r("p",q4,c(e.$t("This video could not be played.")),1)):i.currentKind==="audio"&&i.currentMediaUrl?(n(),r("audio",{key:3,src:i.currentMediaUrl,"aria-label":((V=(T=i.currentItem)==null?void 0:T.settings)==null?void 0:V.title)||((L=(P=i.currentItem)==null?void 0:P.feed)==null?void 0:L.title)||e.$t("Audio"),controls:""},null,8,G4)):_("",!0)],64)):_("",!0)],2),i.currentKind==="video"||i.currentKind==="audio"?(n(),r("div",Y4,[a(b,vs(bs(i.metaProps)),null,16)])):_("",!0),i.currentItem&&i.currentKind==="image"?(n(),r("div",W4,[a(b,vs(bs(i.metaProps)),null,16),l("div",K4,[(n(!0),r(F,null,R(i.zoomButtons,x=>(n(),r("button",{key:x.label,type:"button",class:"fcom_space_media_lightbox_icon","aria-label":x.label,disabled:x.disabled,onClick:x.action},[a(f,null,{default:d(()=>[(n(),y(Yt(x.icon)))]),_:2},1024)],8,Z4))),128))])])):_("",!0)])]}),_:1},8,["modelValue","width","before-close","aria-label","class","onOpened","onClosed"])}const J4=I(R4,[["render",Q4]]),Uo={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}))}}}},X4={name:"MediaAudioList",components:{FluentPlayerPreview:Lt,ExpandIcon:hs},mixins:[Uo],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{}})}},e5={class:"fcom_space_media_audio_list all_media_holder"},t5=["data-id"],s5=["href","aria-label","onClick"],o5={key:1,class:"fcom_audio_row_placeholder","aria-hidden":"true"},i5=["src","aria-label"];function n5(e,t,s,u,o,i){const m=g("ExpandIcon"),f=Ee,h=g("fluent-player-preview");return n(),r("div",e5,[(n(!0),r(F,null,R(s.items,p=>{var k,b,$;return n(),r("div",{key:p.id,ref_for:!0,ref:i.observeRow,"data-id":p.id,class:"fcom_space_media_audio_row"},[(k=p.feed)!=null&&k.slug?(n(),y(f,{key:0,content:e.$t("Open post"),placement:"top","show-after":200},{default:d(()=>[l("a",{href:e.feedHref(p),class:"fcom_audio_row_open","aria-label":e.$t("Open post"),onClick:q(w=>e.openFeed(p,w),["stop"])},[a(m)],8,s5)]),_:2},1032,["content"])):_("",!0),i.hasFluentPlayer&&!o.failedIds[p.id]?(n(),r(F,{key:1},[o.visibleIds[p.id]?(n(),y(h,{key:p.id+"-"+o.reloadKey,media:i.playerMediaFor(p),onLoadFailed:w=>o.failedIds[p.id]=!0},null,8,["media","onLoadFailed"])):(n(),r("div",o5))],64)):p.url?(n(),r("audio",{key:2,src:p.url,"aria-label":((b=p.settings)==null?void 0:b.title)||(($=p.feed)==null?void 0:$.title)||e.$t("Audio"),controls:"",preload:"none",class:"fcom_audio_row_native"},null,8,i5)):_("",!0)],8,t5)}),128))])}const l5=I(X4,[["render",n5]]),a5={name:"SpaceMedia",components:{MediaLightbox:J4,MediaAudioList:l5,ExpandIcon:hs},mixins:[Uo],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,failedMedia:{},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)}},r5={class:"card_header"},d5={class:"member_status"},c5={key:0,class:"fcom_space_media_tabs"},u5={key:0,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},_5={class:"permission_failed"},m5=["href"],h5={key:1,class:"fcom_space_media_card"},f5={key:1,class:"fcom_space_media_empty no_members"},p5={key:0},g5={key:1},y5={key:2},v5={key:0,class:"fcom_space_media_grid all_media_holder"},b5=["aria-label","onClick","onKeydown"],k5=["src","alt"],w5=["src","poster","onError"],C5=["src","alt"],$5={key:3,class:"fcom_space_media_play_badge","aria-hidden":"true"},S5=["href","aria-label","onClick"],V5={key:3,class:"fcom_space_media_load_more",style:{"margin-top":"20px","text-align":"center"}};function M5(e,t,s,u,o,i){const m=je,f=be,h=Q,p=g("media-audio-list"),k=g("ExpandIcon"),b=Ee,$=O,w=g("media-lightbox");return n(),r("div",{class:D(["fcom_space_media",{fcom_space_media_video_open:i.isVideoLightboxOpen}])},[l("div",r5,[l("div",d5,[l("h3",null,c(e.$t("Media Gallery")),1)]),o.permission_failed?_("",!0):(n(),r("div",c5,[a(f,{modelValue:i.activeType,"onUpdate:modelValue":t[0]||(t[0]=C=>i.activeType=C),size:"default"},{default:d(()=>[a(m,{label:"photos",value:"photos"},{default:d(()=>[M(c(e.$t("Photos")),1)]),_:1}),a(m,{label:"videos",value:"videos"},{default:d(()=>[M(c(e.$t("Videos")),1)]),_:1}),o.hasAudio?(n(),y(m,{key:0,label:"audios",value:"audios","data-testid":"tab-audios"},{default:d(()=>[M(c(e.$t("Audios")),1)]),_:1})):_("",!0)]),_:1},8,["modelValue"])]))]),o.permission_failed?(n(),r("div",u5,[l("div",_5,[l("h3",null,c(e.$t("Permission Denied")),1),l("p",null,c(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"},c(e.$t("Go to Space Home")),9,m5)])])):(n(),r("div",h5,[o.loading&&!o.items.length?(n(),y(h,{key:0,class:"fcom_mt_20 white_loaded",animated:!0,rows:5})):o.items.length?(n(),r(F,{key:2},[(n(),y(jo,null,[i.activeType==="audios"?(n(),y(p,{key:0,items:o.items,"space-slug":i.spaceSlug},null,8,["items","space-slug"])):_("",!0)],1024)),i.activeType!=="audios"?(n(),r("div",v5,[(n(!0),r(F,null,R(o.items,(C,v)=>{var S,T,V,P,L,x,A;return n(),r("div",{key:C.id,class:D(["fcom_space_media_cell",["fcom_kind_"+C.kind]]),role:"button",tabindex:"0","aria-label":((S=C.settings)==null?void 0:S.title)||((T=C.feed)==null?void 0:T.title)||e.$t("Open media"),onClick:U=>i.openItem(v),onKeydown:[te(U=>i.openItem(v),["enter"]),te(q(U=>i.openItem(v),["prevent"]),["space"])]},[C.kind==="image"?(n(),r("img",{key:0,src:C.url,alt:((V=C.feed)==null?void 0:V.title)||"",loading:"lazy"},null,8,k5)):o.failedMedia[C.url]?(L=C.settings)!=null&&L.posterSrc?(n(),r("img",{key:2,src:C.settings.posterSrc,alt:((x=C.feed)==null?void 0:x.title)||"",loading:"lazy"},null,8,C5)):_("",!0):(n(),r("video",{key:1,src:C.url,poster:((P=C.settings)==null?void 0:P.posterSrc)||void 0,preload:"metadata",muted:"",playsinline:"",onError:U=>o.failedMedia[C.url]=!0},null,40,w5)),t[4]||(t[4]=l("span",{class:"fcom_space_media_overlay","aria-hidden":"true"},null,-1)),C.kind==="video"?(n(),r("span",$5)):_("",!0),(A=C.feed)!=null&&A.slug?(n(),y(b,{key:4,content:e.$t("Open post"),placement:"top","show-after":200},{default:d(()=>[l("a",{href:e.feedHref(C),class:"fcom_space_media_feed_btn","aria-label":e.$t("Open post"),onClick:q(U=>e.openFeed(C,U),["stop"]),onKeydown:t[1]||(t[1]=q(()=>{},["stop"]))},[a(k)],40,S5)]),_:2},1032,["content"])):_("",!0)],42,b5)}),128))])):_("",!0)],64)):(n(),r("div",f5,[i.activeType==="videos"?(n(),r("p",p5,c(e.$t("No videos yet. Videos shared in posts will appear here.")),1)):i.activeType==="audios"?(n(),r("p",g5,c(e.$t("No audios yet. Audio shared in posts will appear here.")),1)):(n(),r("p",y5,c(e.$t("No photos yet. Photos shared in posts will appear here.")),1))])),o.hasMore?(n(),r("div",V5,[a($,{class:"fcom_secondary_button",disabled:o.loading,loading:o.loading,onClick:t[2]||(t[2]=C=>i.fetch(!0))},{default:d(()=>[M(c(e.$t("Load more")),1)]),_:1},8,["disabled","loading"])])):_("",!0)])),a(w,{modelValue:o.mediaDialog,"onUpdate:modelValue":t[3]||(t[3]=C=>o.mediaDialog=C),items:o.items,"initial-index":o.viewerIndex},null,8,["modelValue","items","initial-index"])],2)}const L5=I(a5,[["render",M5]]);const T5={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()}},F5={class:"fcom_invitations"},I5={style:{margin:"20px 0"},class:"fcom_spaced_flex"},P5={key:0},E5={key:0,class:"fcom_person_name"},A5={key:1,class:"fcom_person_name"},U5={key:3,style:{margin:"0",padding:"0"}},B5={class:"fcom_person_name"};function D5(e,t,s,u,o,i){const m=le,f=ae,h=g("CopyDocument"),p=j,k=O,b=Qt,$=g("UserRouteLink"),w=g("DeleteFilled"),C=Jt,v=g("Pagination"),S=se("loading");return n(),r("div",F5,[l("div",I5,[l("h4",null,c(e.$t("Invitations")),1),e.has_pro?(n(),r("div",P5,[a(f,{style:{"min-width":"150px"},onChange:t[0]||(t[0]=T=>{o.pagination.page=1,i.getInvitations()}),modelValue:o.status,"onUpdate:modelValue":t[1]||(t[1]=T=>o.status=T)},{default:d(()=>[(n(),r(F,null,R(["all","pending","accepted","active","expired"],T=>a(m,{key:T,label:e.$labelize(T),value:T},null,8,["label","value"])),64))]),_:1},8,["modelValue"])])):_("",!0)]),Y((n(),y(C,{data:o.invitations,border:"","empty-text":i.getEmptyText,style:{width:"100%","border-radius":"8px"}},{default:d(()=>[a(b,{prop:"message",label:e.$t("Invitee"),"min-width":"180"},{default:d(T=>[T.row.message?(n(),r("span",E5,c(T.row.meta.invitee_name)+" <"+c(T.row.message)+"> ",1)):(n(),r("span",A5,c(T.row.meta.title)+" ("+c(e.$t("Invitation Link"))+") ",1)),T.row.access_url?(n(),y(k,{key:2,type:"info",size:"small",text:"",onClick:V=>e.$toClipboard(T.row.access_url,e.$t("Invitation link has been copied to clipboard"))},{default:d(()=>[a(p,{title:e.$t("Copy Invitation URl")},{default:d(()=>[a(h)]),_:1},8,["title"]),l("span",null,c(e.$t("Copy Link")),1)]),_:1},8,["onClick"])):_("",!0),T.row.message?_("",!0):(n(),r("p",U5,c(T.row.meta.limit?e.$t("Limit")+": "+T.row.meta.limit:"")+" "+c(parseInt(T.row.reactions_count)>0?" | "+e.$t("Usage")+": "+T.row.reactions_count:"")+" "+c(T.row.meta.expire_date?" | "+e.$t("Expire Date")+": "+e.smartDate(T.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:d(T=>[l("span",B5,[a($,{xprofile:T.row.xprofile},null,8,["xprofile"])])]),_:1},8,["label"])):_("",!0),a(b,{prop:"status",label:e.$t("Status"),width:"120"},{default:d(T=>[l("span",null,c(e.$labelize(T.row.status)),1)]),_:1},8,["label"]),a(b,{label:e.$t("Actions")},{default:d(T=>[T.row.status=="pending"?Y((n(),y(k,{key:0,size:"small",onClick:V=>i.handleResend(T.row)},{default:d(()=>[M(c(e.$t("Resend")),1)]),_:1},8,["onClick"])),[[S,o.loading]]):_("",!0),a(k,{"aria-label":e.$t("Delete invitation"),onClick:V=>i.handleDelete(T.row),plain:"",type:"danger",size:"small"},{default:d(()=>[a(p,{title:e.$t("Delete invitation")},{default:d(()=>[a(w)]),_:1},8,["title"])]),_:1},8,["aria-label","onClick"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[S,o.loading]]),a(v,{hide_on_single:!1,pagination:o.pagination,onFetch:i.getInvitations},null,8,["pagination","onFetch"])])}const R5=I(T5,[["render",D5]]);const x5={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}))}}},O5={class:"fcom_invitation_link_wrap"},H5={class:"fcom_invite_head"},j5={class:"fcom_invite_body"},N5={key:1},z5={key:1,style:{padding:"20px"}},q5={style:{"font-size":"20px",margin:"20px 0","text-align":"center"}};function G5(e,t,s,u,o,i){const m=oe,f=pe,h=Ye,p=O,k=ge,b=g("CopyDocument"),$=j;return n(),r("div",O5,[l("div",H5,[l("h4",null,c(e.$t("Create an invitation link")),1),l("p",null,c(e.$t("Create a simple link to share with potential members. Anyone with the link can join this space.")),1)]),l("div",j5,[o.createdItem?(n(),r("div",z5,[l("h4",q5,c(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]=w=>o.createdItem.access_url=w),readonly:""},{suffix:d(()=>[a(p,{class:"fcomc_button_primary",onClick:t[5]||(t[5]=w=>e.$toClipboard(o.createdItem.access_url,e.$t("Invitation link has been copied to your clipboard")))},{default:d(()=>[a($,null,{default:d(()=>[a(b)]),_:1}),l("span",null,c(e.$t("Copy")),1)]),_:1})]),_:1},8,["modelValue"])])):(n(),y(k,{key:0,onSubmit:t[3]||(t[3]=q(w=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[4]||(t[4]=w=>o.form=w),"label-position":"top"},{default:d(()=>[a(f,{label:e.$t("Invitation Link Title")},{default:d(()=>[a(m,{modelValue:o.form.title,"onUpdate:modelValue":t[0]||(t[0]=w=>o.form.title=w),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:d(()=>[a(m,{type:"number",modelValue:o.form.limit,"onUpdate:modelValue":t[1]||(t[1]=w=>o.form.limit=w),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:d(()=>[a(h,{style:{"min-width":"300px"},modelValue:o.form.expire_date,"onUpdate:modelValue":t[2]||(t[2]=w=>o.form.expire_date=w),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:d(()=>[e.has_pro?(n(),y(p,{key:0,onClick:i.createLink,loading:o.creating,class:"fcom_primary_button"},{default:d(()=>[M(c(e.$t("Create Invitation Link")),1)]),_:1},8,["onClick","loading"])):(n(),r("div",N5,[l("p",null,c(e.$t("This feature is only available in the Pro version of FluentCommunity. Please upgrade")),1)]))]),_:1})]),_:1},8,["modelValue"]))])])}const Y5=I(x5,[["render",G5]]),W5={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"}}},K5={class:"fcom_invitation_link_wrap"},Z5={class:"fcom_invite_head"},Q5={class:"fcom_invite_body"};function J5(e,t,s,u,o,i){const m=oe,f=pe,h=le,p=ae,k=O,b=ge;return n(),r("div",K5,[l("div",Z5,[l("h4",null,c(e.$t("Invite a user by email")),1),l("p",null,c(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",Q5,[a(b,{onSubmit:t[6]||(t[6]=q(()=>{},["prevent"])),"label-position":"top"},{default:d(()=>[a(f,{label:e.$t("Email")},{default:d(()=>[a(m,{modelValue:o.inviteEmail,"onUpdate:modelValue":t[0]||(t[0]=$=>o.inviteEmail=$),type:"email",placeholder:e.$t("Enter email address"),onKeyup:t[1]||(t[1]=te($=>i.invite(),["enter"]))},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Invitee Name (optional)")},{default:d(()=>[a(m,{modelValue:o.inviteName,"onUpdate:modelValue":t[2]||(t[2]=$=>o.inviteName=$),placeholder:e.$t("Enter invitee Name"),onKeyup:t[3]||(t[3]=te($=>i.invite(),["enter"]))},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Membership Role")},{default:d(()=>[a(p,{modelValue:o.role,"onUpdate:modelValue":t[4]||(t[4]=$=>o.role=$),placeholder:e.$t("Select Role")},{default:d(()=>[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:d(()=>[a(k,{class:"fcom_primary_button",loading:o.inviting,disabled:o.inviting,onClick:t[5]||(t[5]=$=>i.invite())},{default:d(()=>[M(c(e.$t("Send Invitation")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1})])])}const X5=I(W5,[["render",J5]]),eC={name:"SpaceInviations",components:{CreateInvitationLink:Y5,PendingInvitations:R5,InviteUser:X5},props:["space_profile"],data(){return{currentTab:"invitations"}}},tC={key:0,class:"card_header"},sC={class:"permission_failed"},oC=["href"],iC={key:1};function nC(e,t,s,u,o,i){const m=g("pending-invitations"),f=xs,h=g("CreateInvitationLink"),p=g("InviteUser"),k=Os;return e.hasSpaceAdminAccess(s.space_profile)?(n(),r("div",iC,[a(k,{modelValue:o.currentTab,"onUpdate:modelValue":t[1]||(t[1]=b=>o.currentTab=b),type:"border-card"},{default:d(()=>[a(f,{name:"invitations",label:e.$t("Invitations")},{default:d(()=>[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:d(()=>[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:d(()=>[o.currentTab=="invite_user"?(n(),y(p,{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(),r("div",tC,[l("div",sC,[l("h3",null,c(e.$t("Permission Denied")),1),l("p",null,c(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"},c(e.$t("Go to Space Home")),9,oC)])]))}const lC=I(eC,[["render",nC]]),aC={name:"GlobIcon"},rC={width:"14",height:"14",viewBox:"0 0 14 14",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};function dC(e,t,s,u,o,i){return n(),r("svg",rC,[...t[0]||(t[0]=[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)])])}const Bo=I(aC,[["render",dC]]),cC={name:"GroupIcon"},uC={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function _C(e,t,s,u,o,i){return n(),r("svg",uC,[...t[0]||(t[0]=[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),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),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),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)])])}const Dt=I(cC,[["render",_C]]),mC={name:"AllCommunities",components:{User:ci,GlobIcon:Bo,Layout:we,AppLayout:Se,CreateSpaceForm:_s,GroupIcon:Dt,Pagination:$e,Search:Fe},setup(){return{spaceStore:He()}},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)}},hC={class:"object_menu"},fC={class:"fcom_space_menu_ul"},pC={key:0},gC={key:1},yC={class:"actions_items"},vC={class:"search_member"},bC={class:"feed_filters"},kC={id:"feed_short_by",class:"fcom_feed_filter_label"},wC={class:"fcom_communities"},CC={key:0,class:"fcom_no_items_wrap"},$C={key:1,class:"fcom_box_card_list"},SC=["aria-label"],VC={class:"fcom_box_card_avatar"},MC=["src"],LC=["src"],TC=["alt","src"],FC={class:"fcom_box_card_info"},IC={class:"fcom_box_card_name"},PC={key:0},EC={class:"fcom_box_card_details"},AC={class:"details_item"},UC={key:0,class:"details_item"},BC=["textContent"],DC={class:"fcom_box_card_action"},RC=["disabled","onClick"],xC=["onClick"];function OC(e,t,s,u,o,i){const m=O,f=g("MoreFilled"),h=j,p=fe,k=g("Search"),b=oe,$=le,w=ae,C=g("router-link"),v=De,S=g("GlobIcon"),T=g("Lock"),V=g("GroupIcon"),P=g("pagination"),L=g("layout"),x=g("app-layout"),A=se("loading");return n(),y(x,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:d(()=>[a(L,{content_class:"no_bg_layout",title:e.$t("Spaces")+" "+(o.pagination.total?" ("+e.$formatNumber(o.pagination.total)+")":"")},{actions:d(()=>[l("div",hC,[l("ul",fC,[l("li",null,[l("a",{onClick:t[0]||(t[0]=q(U=>i.SwitchToSpaceView("all"),["prevent"])),class:D(o.type=="all"?"router-link-active router-link-exact-active":""),href:"#"},c(e.$t("All Spaces")),3)]),e.auth.user_id?(n(),r("li",pC,[l("a",{onClick:t[1]||(t[1]=q(U=>i.SwitchToSpaceView("joined"),["prevent"])),class:D(o.type=="joined"?"router-link-active router-link-exact-active":""),href:"#"},c(e.$t("My Spaces")),3)])):_("",!0),e.isAdmin()?(n(),r("li",gC,[a(m,{onClick:t[2]||(t[2]=U=>i.fireCreateSpace()),class:"fcom_primary_button"},{default:d(()=>[M(c(e.$t("New Space")),1)]),_:1})])):_("",!0)]),e.isAdmin()?(n(),y(p,{key:0,persistent:!1,ref:"space_actions",placement:"bottom",width:200,trigger:"click"},{reference:d(()=>[a(m,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:d(()=>[a(h,null,{default:d(()=>[a(f)]),_:1})]),_:1},8,["aria-label"])]),default:d(()=>[l("ul",yC,[l("li",{onClick:t[3]||(t[3]=(...U)=>i.goToSpaceGroups&&i.goToSpaceGroups(...U))},c(e.$t("View Space Groups")),1)])]),_:1},512)):_("",!0)])]),default:d(()=>[l("div",vC,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[4]||(t[4]=U=>o.search=U),placeholder:e.$t("Search Space...")},{prefix:d(()=>[a(h,null,{default:d(()=>[a(k)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",bC,[t[7]||(t[7]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",kC,c(e.$t("Sort by:")),1),a(w,{"aria-label":e.$t("Sort Spaces by"),modelValue:o.sort_by,"onUpdate:modelValue":t[5]||(t[5]=U=>o.sort_by=U),class:"fcom_minimal_select space_sort_select","popper-class":"plain_select",onChange:t[6]||(t[6]=U=>i.changeSortBy())},{default:d(()=>[a($,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"]),a($,{value:"latest",label:e.$t("Latest Spaces")},null,8,["label"]),a($,{value:"oldest",label:e.$t("Oldest Spaces")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),Y((n(),r("div",wC,[!o.loading&&o.communities.length==0?(n(),r("div",CC,[o.search?(n(),r(F,{key:0},[l("h3",null,c(e.$t("No spaces found based on your search criteria")),1),l("p",null,c(e.$t("No spaces match your search criteria. Try adjusting your search terms or browse our space catalog.")),1)],64)):(n(),r(F,{key:1},[l("h3",null,c(e.$t("No spaces found")),1),l("p",null,c(e.$t("Please check back later. We are in a process to publish some spaces for you!")),1)],64))])):(n(),r("div",$C,[(n(!0),r(F,null,R(o.communities,U=>(n(),r("div",{role:"region","aria-label":e.$t("Space Lists"),key:U.id,class:"fcom_each_box_card"},[l("div",VC,[a(C,{"aria-label":e.$t("Go to Space"),to:i.getSpaceFeedsRoute(U.slug)},{default:d(()=>{var B;return[(B=U.settings)!=null&&B.og_image?(n(),r("img",{key:0,src:U.settings.og_image,alt:""},null,8,MC)):U.cover_photo?(n(),r("img",{key:1,src:U.cover_photo,alt:""},null,8,LC)):(n(),r("img",{key:2,alt:e.$t("Placeholder image"),src:e.appVars.assets_url+"images/space-placeholder.jpg"},null,8,TC))]}),_:2},1032,["aria-label","to"])]),l("div",FC,[l("div",IC,[a(C,{to:i.getSpaceFeedsRoute(U.slug)},{default:d(()=>[M(c(i.getExcerpt(U.title,24))+" ",1),U.space_pivot?(n(),y(v,{key:0,type:"success"},{default:d(()=>[M(c(e.$labelize(U.space_pivot.role))+" ",1),U.space_pivot.status!="active"?(n(),r("span",PC," ("+c(e.$labelize(U.space_pivot.status))+") ",1)):_("",!0)]),_:2},1024)):_("",!0)]),_:2},1032,["to"])]),l("div",EC,[l("div",AC,[U.privacy==="public"?(n(),y(h,{key:0},{default:d(()=>[a(S)]),_:1})):(n(),y(h,{key:1},{default:d(()=>[a(T)]),_:1})),l("span",null,c(e.$labelize(U.privacy)),1)]),U.members_count?(n(),r("div",UC,[a(h,null,{default:d(()=>[a(V)]),_:1}),l("span",null,c(e.$_n("%s Member","%s Members",e.$formatNumber(U.members_count))),1)])):_("",!0)]),U.description?(n(),r("div",{key:0,class:"fcom_box_card_description",textContent:c(i.getExcerpt(U.description_rendered,85))},null,8,BC)):_("",!0),l("div",DC,[U.space_pivot?(n(),r("button",{key:1,class:"fcom_card_button",onClick:B=>i.goToSpaceFeeds(U.slug)},c(e.$t("View Space")),9,xC)):Y((n(),r("button",{key:0,class:"fcom_card_button",disabled:o.joining===U.slug,onClick:B=>i.join(U)},[M(c(e.$t("Join")),1)],8,RC)),[[A,o.joining===U.slug]])])])],8,SC))),128))])),a(P,{hide_on_single:!0,onFetch:i.getCommunities,pagination:o.pagination},null,8,["onFetch","pagination"])])),[[A,o.loading]])]),_:1},8,["title"])]),_:1})}const HC=I(mC,[["render",OC]]),jC={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;const s=new Set(t);return Object.keys(this.appVars.user_badges).filter(u=>s.has(u)).map(u=>this.appVars.user_badges[u])}return[this.badge]}}},NC=["src"],zC={key:1,class:"fcom_emoji"},qC={key:2,class:"fcom_shape"},GC={key:1};function YC(e,t,s,u,o,i){const m=j,f=Ee;return i.renderingBadges?(n(!0),r(F,{key:0},R(i.renderingBadges,h=>(n(),r("div",{class:D([{user_icon_only:h.show_label!="yes"},"user_badge"])},[a(f,{content:h.title,placement:"top"},{default:d(()=>[l("div",{style:ue({backgroundColor:h.background_color,color:h.color,borderColor:h.color}),class:"user_badge_inner"},[h.config?(n(),r(F,{key:0},[h.config.logo?(n(),r("img",{key:0,alt:"",src:h.config.logo},null,8,NC)):h.config.emoji?(n(),r("span",zC,c(h.config.emoji),1)):h.config.shape_svg?(n(),r("span",qC,[a(m,{innerHTML:h.config.shape_svg},null,8,["innerHTML"])])):_("",!0)],64)):_("",!0),h.show_label=="yes"?(n(),r("span",GC,c(h.title),1)):_("",!0)],4)]),_:2},1032,["content"])],2))),256)):_("",!0)}const Do=I(jC,[["render",YC]]),WC={name:"AddNotificationIcon"},KC={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"};function ZC(e,t,s,u,o,i){return n(),r("svg",KC,[...t[0]||(t[0]=[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)])])}const QC=I(WC,[["render",ZC]]),JC={name:"NotificationAddedIcon"},XC={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"};function e6(e,t,s,u,o,i){return n(),r("svg",XC,[...t[0]||(t[0]=[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)])])}const t6=I(JC,[["render",e6]]),s6={name:"AddUserForm",components:{SpaceIcon:ze,SpaceCourseSelector:ms},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 o6(e,t,s,u,o,i){const m=oe,f=pe,h=g("SpaceCourseSelector"),p=le,k=ae,b=O,$=ge,w=se("loading");return n(),y($,{onSubmit:t[4]||(t[4]=q(C=>e.doNothing(),["prevent"])),"label-position":"top"},{default:d(()=>[a(f,{label:e.$t("User")},{default:d(()=>[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:d(()=>[Y(a(h,{modelValue:o.selectedId,"onUpdate:modelValue":t[0]||(t[0]=C=>o.selectedId=C),memberships:o.userMemberships,placeholder_text:e.$t("Select Space/Course"),onSelectedType:i.updateSelectedType,onSelectedSlug:i.updateSelectedSlug},null,8,["modelValue","memberships","placeholder_text","onSelectedType","onSelectedSlug"]),[[w,o.loading]])]),_:1},8,["label"]),o.selectedType==="space"?(n(),y(f,{key:0,label:e.$t("Membership Role")},{default:d(()=>[a(k,{placeholder:e.$t("Select Role"),modelValue:o.role,"onUpdate:modelValue":t[1]||(t[1]=C=>o.role=C)},{default:d(()=>[a(p,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(p,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(p,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"])):_("",!0),K(e.$slots,"after_form",{},()=>[a(f,null,{default:d(()=>[o.selectedType==="course"?Y((n(),y(b,{key:0,class:"fcom_primary_button",disabled:o.saving||!o.selectedId,onClick:t[2]||(t[2]=C=>i.addToCourse())},{default:d(()=>[M(c(e.$t("Add to Course")),1)]),_:1},8,["disabled"])),[[w,o.saving]]):Y((n(),y(b,{key:1,class:"fcom_primary_button",disabled:o.saving||!o.selectedId,onClick:t[3]||(t[3]=C=>i.addToSpace())},{default:d(()=>[M(c(e.$t("Add to Space")),1)]),_:1},8,["disabled"])),[[w,o.saving]])]),_:1})])]),_:3})}const i6=I(s6,[["render",o6]]),n6={name:"ProfileHeader",emits:["refetch"],setup(){return{userStore:Be()}},components:{UserBadge:Do,ImageUploader:Re,BookmarkIcon:vo,FollowAction:st,AddNotificationIcon:QC,NotificationAddedIcon:t6,AddUserForm:i6},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=Ue(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 the profile photo of %s?",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 the cover photo of %s?",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()}}},l6={ref:"fcom_user_profile",class:"object_header user_header"},a6={key:0,class:"object_media_uploader"},r6={class:"object_info"},d6={class:"object_avatar"},c6=["alt","src"],u6=["aria-label"],_6={class:"fcom_avatar_actions"},m6=["aria-label"],h6={class:"object_name"},f6={class:"object_meta"},p6={key:0,class:"object_meta follower"},g6={class:"object_menu"},y6={key:0,class:"fcom_profile_nav"},v6=["href","target"],b6={key:1,class:"fcom_profile_menu_actions"},k6=["target","href"];function w6(e,t,s,u,o,i){var B,N,H,z,G,ne,E,J,ce;const m=O,f=g("image-uploader"),h=g("UploadFilled"),p=j,k=fe,b=g("verified-sign"),$=g("UserBadge"),w=g("router-link"),C=g("FollowAction"),v=g("NotificationAddedIcon"),S=g("AddNotificationIcon"),T=g("MoreFilled"),V=We,P=Ke,L=Ze,x=g("add-user-form"),A=Ds,U=se("loading");return Y((n(),r("div",l6,[l("div",{style:ue({backgroundImage:`url('${i.user_profile.cover_photo||""}')`}),class:D(["object_cover",{no_cover:!i.user_profile.cover_photo}])},[i.isOwnProfile||e.hasPermission("super_admin")?(n(),r("div",a6,[a(f,{additionalData:{resize:!0,max_width:1500},onUploaded:i.handleCoverPhotoUpload},{default:d(()=>[a(m,{title:e.$t("Recommended Size: 1200 x 375px"),size:"small",plain:"",type:"primary"},{default:d(()=>[M(c(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:q(i.removeCoverPhoto,["prevent"])},{default:d(()=>[M(c(e.$t("Remove")),1)]),_:1},8,["onClick"])):_("",!0)])):_("",!0)],6),l("div",r6,[l("div",d6,[l("img",{alt:e.$t("Placeholder Photo"),src:i.user_profile.avatar||e.appVars.assets_url+"/images/placeholder.png"},null,8,c6),i.isOwnProfile||e.hasPermission("super_admin")?(n(),y(k,{key:0,ref:"avatarPopover",trigger:"click",placement:"bottom",width:"fit-content","popper-class":"fcom_avatar_popover",teleported:!1},{reference:d(()=>[l("button",{class:"object_avatar_uploader",type:"button","aria-label":e.$t("Change profile photo")},[a(p,{class:"object_avatar_upload"},{default:d(()=>[a(h)]),_:1})],8,u6)]),default:d(()=>[l("div",_6,[a(f,{additionalData:{resize:!0,max_width:200},onUploaded:i.handlePhotoUpload},{trigger:d(()=>[a(m,{size:"small",text:"",class:"fcom_avatar_action_btn"},{default:d(()=>[M(c(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:d(()=>[M(c(e.$t("Remove")),1)]),_:1},8,["onClick"])):_("",!0)])]),_:1},512)):_("",!0),i.level?(n(),r("div",{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":e.$t("User Level"),class:"fcom_user_level_mark"},[l("span",null,c(i.level),1)],8,m6)):_("",!0)]),l("div",h6,[l("h3",null,[M(c((B=i.user_profile)==null?void 0:B.display_name)+" ",1),(N=i.user_profile)!=null&&N.is_verified?(n(),y(b,{key:0})):_("",!0),a($,{profile:i.user_profile},null,8,["profile"])]),l("p",f6,"@"+c((H=i.user_profile)==null?void 0:H.username),1),e.hasFeature("followers_module")?(n(),r("div",p6,[((z=i.user_profile)==null?void 0:z.followings_count)!=null?(n(),y(w,{key:0,to:{name:"user_followings",params:{username:i.user_profile.username}}},{default:d(()=>[l("span",null,c(i.user_profile.followings_count),1),M(" "+c(e.$t("Following")),1)]),_:1},8,["to"])):_("",!0),((G=i.user_profile)==null?void 0:G.followers_count)!=null?(n(),y(w,{key:1,to:{name:"user_followers",params:{username:i.user_profile.username}}},{default:d(()=>[l("span",null,c(i.user_profile.followers_count),1),M(" "+c(e.$t("Followers")),1)]),_:1},8,["to"])):_("",!0)])):_("",!0)])]),l("div",g6,[(E=(ne=s.profile)==null?void 0:ne.profile_navs)!=null&&E.length?(n(),r("ul",y6,[(n(!0),r(F,null,R(s.profile.profile_navs,X=>(n(),r("li",{class:D(X.wrapper_class??"")},[X.route?(n(),y(w,{key:0,class:D(X.css_class??""),to:X.route},{default:d(()=>[X.svg_icon?(n(),y(p,{key:0,innerHTML:X.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,c(X.title),1)]),_:2},1032,["class","to"])):(n(),r("a",{key:1,href:X.url,class:D(X.css_class??""),target:X.is_external?"_blank":"_self"},[X.svg_icon?(n(),y(p,{key:0,innerHTML:X.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,c(X.title),1)],10,v6))],2))),256))])):_("",!0),i.showActions?(n(),r("div",b6,[(ce=(J=s.profile)==null?void 0:J.profile_nav_actions)!=null&&ce.length?(n(!0),r(F,{key:0},R(s.profile.profile_nav_actions,X=>(n(),r("a",{class:D(X.css_class),target:X.is_external?"_blank":"_self",href:X.url},[X.svg_icon?(n(),y(p,{key:0,innerHTML:X.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,c(X.title),1)],10,k6))),256)):_("",!0),i.showFollowAction||i.showOtherActions?(n(),r(F,{key:1},[i.showFollowAction?(n(),r(F,{key:0},[s.profile?(n(),y(C,{key:0,profile:s.profile,onRefetch:t[0]||(t[0]=X=>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:d(()=>[i.isNotificationOn?(n(),y(p,{key:0},{default:d(()=>[a(v)]),_:1})):(n(),y(p,{key:1},{default:d(()=>[a(S)]),_:1}))]),_:1},8,["title","loading","disabled","onClick"])):_("",!0)],64)):_("",!0),i.showBlock||i.showOtherActions?(n(),y(L,{key:1,"popper-class":"fcom_pop_buttons",trigger:"click"},{dropdown:d(()=>[a(P,null,{default:d(()=>[i.showBlock?(n(),y(V,{key:0,onClick:t[1]||(t[1]=X=>i.confirmAndBlock())},{default:d(()=>[a(m,{"aria-label":e.$t("Block User"),class:"fcom_dot_menu edit_action",size:"small",text:"",type:"danger"},{default:d(()=>[M(c(e.$t("Block User")),1)]),_:1},8,["aria-label"])]),_:1})):_("",!0),i.showOtherActions?(n(),y(V,{key:1,onClick:t[2]||(t[2]=X=>i.openAddToDrawer())},{default:d(()=>[a(m,{"aria-label":e.$t("Add User to Space/Course"),class:"fcom_dot_menu edit_action",size:"small",text:"",type:"primary"},{default:d(()=>[M(c(e.$t("Add To Space/Course")),1)]),_:1},8,["aria-label"])]),_:1})):_("",!0)]),_:1})]),default:d(()=>[a(m,{class:"fcom_dot_menu edit_action",size:"small",text:""},{default:d(()=>[a(p,null,{default:d(()=>[a(T)]),_:1})]),_:1})]),_:1})):_("",!0)],64)):_("",!0)])):_("",!0)]),a(A,{modelValue:o.isAddUserOpen,"onUpdate:modelValue":t[3]||(t[3]=X=>o.isAddUserOpen=X),"close-on-click-modal":!0,"before-close":i.handleDrawerClose,"append-to-body":!0,size:e.modalWidth,direction:"rtl"},{header:d(()=>[l("h4",null,c(e.$t("Add User to Space/Course")),1)]),default:d(()=>[a(x,{ref:"addUserForm",onCompleted:i.userAdded,user_profile:i.user_profile},null,8,["onCompleted","user_profile"])]),_:1},8,["modelValue","before-close","size"])])),[[U,o.updating]])}const C6=I(n6,[["render",w6]]),$6={name:"ProfileAbout",components:{SocialLinks:Pt},props:["profile","isOwn"]},S6={class:"app_side_widget"},V6={class:"widget_header"},M6={key:0,class:"widget_actions"},L6={key:0,class:"widget_body"},T6=["innerHTML"],F6={key:1,style:{"text-align":"center"}},I6=["title"],P6=["title"];function E6(e,t,s,u,o,i){const m=g("EditPen"),f=j,h=O,p=g("SocialLinks"),k=Q;return n(),r("div",S6,[l("div",V6,[l("h3",null,c(e.$t("About")),1),s.isOwn?(n(),r("div",M6,[a(h,{"aria-label":e.$t("Edit Your Profile"),onClick:t[0]||(t[0]=b=>e.$router.push({name:"update_profile",params:{username:s.profile.username}})),text:""},{default:d(()=>[a(f,null,{default:d(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])])):_("",!0)]),s.profile?(n(),r("div",L6,[s.profile.short_description_rendered?(n(),r("div",{key:0,class:"space_description feed_md_content",innerHTML:s.profile.short_description_rendered},null,8,T6)):s.isOwn?(n(),r("div",F6,[t[2]||(t[2]=l("hr",null,null,-1)),a(h,{"aria-label":e.$t("Add your profile description"),onClick:t[1]||(t[1]=b=>e.$router.push({name:"update_profile",params:{username:s.profile.username}})),type:"info"},{default:d(()=>[a(f,null,{default:d(()=>[a(m)]),_:1}),l("span",null,c(e.$t("Add your profile description")),1)]),_:1},8,["aria-label"])])):_("",!0),t[3]||(t[3]=l("hr",null,null,-1)),l("div",{title:s.profile.created_at,class:"meta_line"},c(e.$t("Joined: %s",e.humanDateDiff(s.profile.created_at))),9,I6),s.profile.last_activity?(n(),r("div",{key:2,title:s.profile.last_activity,class:"meta_line"},c(e.$t("Last seen: %s",e.humanDateDiff(s.profile.last_activity))),9,P6)):_("",!0),a(p,{xprofile:s.profile,isOwn:s.isOwn},null,8,["xprofile","isOwn"])])):(n(),y(k,{key:1,animated:!0}))])}const Ro=I($6,[["render",E6]]),A6={name:"FeedProfile",props:["username"],components:{NotFoundResult:Eo,SpaceMenu:So,Layout:we,AppLayout:Se,UserHeader:C6,ProfileAbout:Ro,RecentActivities:Bt},setup(){return{userStore:Be()}},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}})}},U6={key:0},B6={key:1},D6={class:"edit_profile"},R6={class:"fcom_profile_box"},x6={key:1,class:"profile_holder"},O6={key:2},H6={class:"fcom_main_side_wrap"},j6={class:"widget_recent_activities"};function N6(e,t,s,u,o,i){const m=g("router-link"),f=Xt,h=es,p=O,k=j,b=g("EditPen"),$=g("user-header"),w=g("not-found-result"),C=g("router-view"),v=Q,S=ut,T=g("ProfileAbout"),V=g("RecentActivities"),P=_t,L=mt,x=g("layout"),A=g("app-layout");return n(),y(A,{wrapper_class:"fcom_single_layout fcom_member_profile fcom_max_layout"},{default:d(()=>[a(x,{wrapper_class:"no_bg_layout",title:"...."},{title:d(()=>[a(h,null,{default:d(()=>[a(f,null,{default:d(()=>[a(m,{to:{name:"all_members"}},{default:d(()=>[M(c(e.$t("Members")),1)]),_:1})]),_:1}),i.profile?(n(),y(f,{key:0},{default:d(()=>[i.isOwn?(n(),r("span",U6,c(e.$t("My Profile")),1)):(n(),r("span",B6,c(i.profile.display_name),1))]),_:1})):_("",!0)]),_:1})]),actions:d(()=>[i.profile&&e.hasPermission("super_admin")&&i.profile.status!="active"?(n(),r(F,{key:0},[i.profile.status?(n(),r(F,{key:0},[l("span",null,c(e.$labelize(i.profile.status)),1),a(p,{type:"success",onClick:t[0]||(t[0]=U=>e.$confirm(e.$t("Are you sure you want to approve this user?"),e.$t("Warning"),{type:"warning"}).then(()=>{i.approveUser()}))},{default:d(()=>[M(c(e.$t("Approve Account")),1)]),_:1})],64)):(n(),y(p,{key:1,disabled:!0},{default:d(()=>[M(c(e.$t("Self Deactivated Account")),1)]),_:1}))],64)):_("",!0),i.profile&&(i.isOwn||e.hasPermission("super_admin"))?(n(),r(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:d(()=>[a(k,null,{default:d(()=>[...t[4]||(t[4]=[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)])]),_:1}),l("span",null,c(e.$t("Notification Settings")),1)]),_:1},8,["to"]),e.$route.name!=="update_profile"?(n(),y(p,{key:0,onClick:t[1]||(t[1]=U=>e.$router.push({name:"update_profile",params:{username:i.profile.username}})),class:"fcom_primary_button edit_profile_button"},{default:d(()=>[a(k,null,{default:d(()=>[a(b)]),_:1}),l("span",D6,c(e.$t("Edit Profile")),1)]),_:1})):_("",!0)],64)):_("",!0)]),default:d(()=>[o.notFound?_("",!0):(n(),y($,{key:0,username:s.username,isOwn:i.isOwn,profile:i.profile,onRefetch:i.getProfile},null,8,["username","isOwn","profile","onRefetch"])),a(L,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:d(()=>[a(S,{class:"fcom_main"},{default:d(()=>[l("div",R6,[o.notFound?(n(),y(w,{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:d(()=>[e.auth.user_id?(n(),y(p,{key:0,onClick:t[2]||(t[2]=U=>e.$router.push({name:"all_members"})),class:"el-button fcom_primary_button"},{default:d(()=>[M(c(e.$t("Browse Members")),1)]),_:1})):_("",!0),a(p,{onClick:t[3]||(t[3]=U=>e.$router.push({name:"all_feeds"})),class:"el-button fcom_secondary_button"},{default:d(()=>[M(c(e.$t("Go to Home")),1)]),_:1})]),_:1},8,["title","message"])):i.profile?(n(),r("div",x6,[a(C,{isOwn:i.isOwn,username:s.username,profile:i.profile,onRefetch:i.getProfile},null,8,["isOwn","username","profile","onRefetch"])])):i.loading?(n(),r("div",O6,[a(v,{class:"white_loaded",rows:10,animated:!0})])):_("",!0)])]),_:1}),i.showWidget?(n(),y(P,{key:0,class:"fcom_resp_side",width:"306px"},{default:d(()=>[l("div",H6,[l("div",j6,[e.$route.name!=="user_profile"?(n(),y(T,{key:0,isOwn:i.isOwn,profile:i.profile},null,8,["isOwn","profile"])):i.profile?(n(),y(V,{key:1,widget_title:e.$t("Recent Activities"),context:{user_id:i.profile.user_id},prompt_placement:"profile_sidebar"},null,8,["widget_title","context"])):_("",!0)])])]),_:1})):_("",!0)]),_:1})]),_:1})]),_:1})}const z6=I(A6,[["render",N6]]),q6={name:"LockedProfile"},G6={class:"space_lock_box"},Y6={class:"lock_header"},W6={class:"lock_desc"},K6=["href"];function Z6(e,t,s,u,o,i){const m=g("Lock"),f=j;return n(),r("div",G6,[a(f,null,{default:d(()=>[a(m)]),_:1}),l("h3",Y6,c(e.$t("This profile is private")),1),l("p",W6,c(e.$t("You do not have permission to view this profile's content.")),1),!e.auth.user_id&&e.appVars.allow_signup?(n(),r("a",{key:0,href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button"},c(e.$t("Login / Signup")),9,K6)):_("",!0)])}const gt=I(q6,[["render",Z6]]),Q6={name:"ProfileFeeds",components:{AllFeeds:pt,ErrorIcon:_o,LockedProfile:gt},props:["profile","isOwn","username"],emits:["refetch"],methods:{openScheduledPosts(){this.$router.push({name:"user_scheduled_posts"})}}},J6={key:0,class:"fcom_feed_report_wrap"},X6={class:"fcom_feed_report_content"},e$={class:"fcom_feed_report_action"};function t$(e,t,s,u,o,i){const m=g("LockedProfile"),f=g("ErrorIcon"),h=O,p=g("all-feeds");return s.profile.is_restricted?(n(),y(m,{key:0})):(n(),r(F,{key:1},[s.profile.scheduled_posts_count?(n(),r("div",J6,[l("div",X6,[a(f),l("span",null,c(e.$t("You currently have %s scheduled posts to be published",s.profile.scheduled_posts_count)),1)]),l("div",e$,[a(h,{onClick:t[0]||(t[0]=k=>i.openScheduledPosts())},{default:d(()=>[M(c(e.$t("View Posts")),1)]),_:1})])])):_("",!0),a(p,{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 s$=I(Q6,[["render",t$]]),o$={name:"ScheduledPosts",components:{Feed:ot,Pagination:$e,EditFeed:rs,AlarmClock:ui},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=>es.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()}},i$={class:"scheduled_posts_header"},n$={class:"fcom_scheduled_posts_title"},l$={key:0},a$={key:1},r$={key:1,class:"fcom_feed_style_timeline fcom_scheduled_posts"},d$={class:"all_feeds_holder"},c$={class:"actions_items"},u$=["onClick"],_$=["onClick"],m$=["onClick"],h$={class:"feed_user"},f$={class:"feed_user_name"},p$={class:"feed_meta_info"},g$=["title","href"],y$={key:0},v$={class:"post_actions"},b$={key:2,class:"feed_outer"},k$={class:"feed"},w$={style:{"text-align":"center"},class:"feed_body not_found"},C$={class:"dialog_header"},$$={class:"dialog_left schedule_header_left"},S$={class:"dialog_body"},V$={class:"dialog_footer"};function M$(e,t,s,u,o,i){const m=g("AlarmClock"),f=j,h=Q,p=g("MoreFilled"),k=O,b=fe,$=g("UserAvatar"),w=g("UserRouteLink"),C=g("router-link"),v=g("feed"),S=g("edit-feed"),T=Ye,V=pe,P=Us,L=ge,x=ke,A=g("pagination");return n(),r(F,null,[l("div",i$,[a(f,null,{default:d(()=>[a(m)]),_:1}),l("div",n$,[l("h3",null,c(e.$t("Scheduled Posts")),1),i.isPostCount?(n(),r("p",l$,c(e.$t("You currently have %s scheduled posts to be published",s.profile.scheduled_posts_count)),1)):(n(),r("p",a$,c(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(),r("div",r$,[l("div",d$,[(n(!0),r(F,null,R(o.feeds,U=>(n(),r("div",{key:U.id,class:"feed_outer"},[a(v,{feed:U,layout_style:"timeline",hide_create_form:!0,show_footer:!1,show_actions:!1},{after_feed_actions:d(()=>[a(b,{persistent:!1,ref_for:!0,ref:"actionsPopover",placement:"bottom",width:200,trigger:"click",visible:i.isPopoverVisible(U),teleported:!1,"popper-class":"fcom_menu_below_nav",onHide:B=>i.hidePopover(U)},{reference:d(()=>[a(k,{"aria-label":e.$t("View Post actions"),class:"fcom_dot_menu",size:"small",text:"",onClick:B=>i.togglePopover(U)},{default:d(()=>[a(f,null,{default:d(()=>[a(p)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:d(()=>[l("ul",c$,[l("li",{onClick:B=>i.copyFeedLink(U)},c(e.$t("Copy Link")),9,u$),e.canEditFeed(U)?(n(),r("li",{key:0,onClick:B=>i.editItem(U)},c(e.$t("Edit")),9,_$)):_("",!0),e.canDeleteFeed(U)?(n(),r("li",{key:1,onClick:B=>i.deleteItem(U)},c(e.$t("Delete")),9,m$)):_("",!0)])]),_:2},1032,["visible","onHide"])]),after_feed_header:d(()=>[l("div",h$,[a($,{with_level:!1,xprofile:s.profile},null,8,["xprofile"]),l("div",null,[l("div",f$,[a(w,{show_badge:!0,xprofile:s.profile},null,8,["xprofile"])]),l("div",p$,[l("a",{title:U.created_at,onClick:t[0]||(t[0]=(...B)=>e.gotoFeed&&e.gotoFeed(...B)),href:U.permalink,class:"feed_timestamp"},c(i.getScheduledTime(U.scheduled_at)),9,g$),U.space?(n(),r("span",y$,[a(C,{to:i.getSpaceRoute(U.space.slug),class:"feed_timestamp"},{default:d(()=>[M(c(e.$t("Posted in %s",e.getExcerpt(U.space.title,30))),1)]),_:2},1032,["to"])])):_("",!0)])])])]),after_feed_footer:d(()=>[l("div",v$,[a(k,{class:"fcom_secondary_button",onClick:B=>i.initReschedule(U),disabled:o.saving},{default:d(()=>[M(c(e.$t("Reschedule Post")),1)]),_:1},8,["onClick","disabled"]),a(k,{class:"fcom_secondary_button",onClick:B=>i.publishNow(U),disabled:o.saving},{default:d(()=>[M(c(e.$t("Publish Now")),1)]),_:1},8,["onClick","disabled"])])]),_:2},1032,["feed"])]))),128)),o.isEdit&&o.editingFeed?(n(),y(S,{key:0,feedSlug:o.editingFeed.slug,dialogVisible:o.isEdit,onUpdated:i.updateFeed,hide_create_form:!1,onClose:t[1]||(t[1]=U=>o.isEdit=!1)},null,8,["feedSlug","dialogVisible","onUpdated"])):_("",!0)])])):(n(),r("div",b$,[l("div",k$,[l("div",w$,[l("p",null,c(e.$t("No scheduled posts found!")),1)])])])),a(x,{modelValue:o.scheduleModalVisible,"onUpdate:modelValue":t[4]||(t[4]=U=>o.scheduleModalVisible=U),width:e.modalWidth,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1,onClose:i.cancelReschedule},{header:d(()=>[l("div",C$,[l("div",$$,[l("h4",null,c(e.$t("Reschedule Post")),1),l("p",null,c(e.$t("Choose a date and time in the future when you want your post to be published")),1)])])]),footer:d(()=>[l("div",V$,[a(k,{class:"fcom_secondary_button",disabled:o.saving,onClick:i.cancelReschedule},{default:d(()=>[M(c(e.$t("Cancel")),1)]),_:1},8,["disabled","onClick"]),a(k,{class:"fcom_primary_button",disabled:o.saving,onClick:i.reschedulePost},{default:d(()=>[M(c(e.$t("Reschedule")),1)]),_:1},8,["disabled","onClick"])])]),default:d(()=>[l("div",S$,[a(L,{"label-position":"top",class:"fcom_schedule_form"},{default:d(()=>[a(V,{label:e.$t("Date")},{default:d(()=>[a(T,{modelValue:o.scheduleForm.date,"onUpdate:modelValue":t[2]||(t[2]=U=>o.scheduleForm.date=U),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(V,{label:e.$t("Time")},{default:d(()=>[a(P,{modelValue:o.scheduleForm.time,"onUpdate:modelValue":t[3]||(t[3]=U=>o.scheduleForm.time=U),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(A,{pagination:o.pagination,onFetch:i.fetchFeeds},null,8,["pagination","onFetch"])],64)}const L$=I(o$,[["render",M$]]),T$={name:"UserSpaces",props:["profile"],components:{Calendar:_i,Baseball:mi,GroupIcon:Dt,GlobIcon:Bo,LockedProfile:gt},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()}},F$={key:1,class:"user_spaces"},I$={class:"fcom_box_card_list"},P$=["onClick"],E$=["src"],A$=["src"],U$={key:2,class:"fcom_no_image"},B$={class:"fcom_box_card_info"},D$={class:"fcom_box_card_name"},R$={class:"fcom_box_card_details"},x$={class:"details_item"},O$={key:0,class:"details_item"},H$={class:"fcom_box_card_action"},j$=["onClick"],N$={key:0,class:"loading"},z$={key:1},q$={class:"no_members"},G$={key:2,class:"no_members"};function Y$(e,t,s,u,o,i){const m=g("LockedProfile"),f=g("router-link"),h=g("MoreFilled"),p=j,k=O,b=We,$=Ke,w=Ze,C=g("GlobIcon"),v=g("Lock"),S=g("GroupIcon"),T=Q;return s.profile.is_restricted?(n(),y(m,{key:0})):(n(),r("div",F$,[l("div",I$,[(n(!0),r(F,null,R(o.communities,V=>{var P;return n(),r("div",{key:V.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:L=>i.goToSpaceFeeds(V.slug)},[(P=V.settings)!=null&&P.og_image?(n(),r("img",{key:0,src:V.settings.og_image,alt:""},null,8,E$)):V.cover_photo?(n(),r("img",{key:1,src:V.cover_photo,alt:""},null,8,A$)):(n(),r("div",U$))],8,P$),l("div",B$,[l("div",D$,[a(f,{class:"user_route",to:{name:"space_feeds",params:{space:V.slug}}},{default:d(()=>[M(c(i.getExcerpt(V.title,30)),1)]),_:2},1032,["to"]),e.isAdmin()?(n(),y(w,{key:0,trigger:"click"},{dropdown:d(()=>[a($,null,{default:d(()=>[a(b,{onClick:L=>i.removeMembership(V.slug)},{default:d(()=>[M(c(e.$t("Remove from space")),1)]),_:1},8,["onClick"])]),_:2},1024)]),default:d(()=>[a(k,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:d(()=>[a(p,null,{default:d(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)):_("",!0)]),l("div",R$,[l("div",x$,[V.privacy==="public"?(n(),y(p,{key:0},{default:d(()=>[a(C)]),_:1})):(n(),y(p,{key:1},{default:d(()=>[a(v)]),_:1})),l("span",null,c(V.privacy==="public"?e.$t("Public"):e.$t("Private")),1)]),V.members_count?(n(),r("div",O$,[a(p,null,{default:d(()=>[a(S)]),_:1}),l("span",null,c(e.$_n("%s Member","%s Members",e.$formatNumber(V.members_count))),1)])):_("",!0)]),l("div",H$,[l("button",{class:"fcom_card_button",onClick:L=>i.goToSpaceFeeds(V.slug)},c(i.getBtnLevel(V.type)),9,j$)])])])}),128))]),o.loading?(n(),r("div",N$,[a(T,{class:"white_loaded",rows:3,animated:!0}),a(T,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):s.profile.canViewUserSpaces?!o.loading&&!o.communities.length?(n(),r("div",G$,c(e.$t("No Spaces found.")),1)):_("",!0):(n(),r("div",z$,[l("div",q$,c(e.$t("Sorry, you do not have permission to view this page")),1)]))]))}const W$=I(T$,[["render",Y$]]),K$={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})}}},Z$={style:{"margin-top":"30px"},class:"fcom_account_deactivation about_wrap"},Q$={class:"about_header"},J$={class:"about_body fcom_mt_10"},X$={class:"fcom_mt_20"};function e7(e,t,s,u,o,i){const m=O;return n(),r("div",Z$,[l("div",Q$,[l("h3",null,c(e.$t("Account Deactivation")),1)]),l("div",J$,[o.selection=="init"?(n(),r(F,{key:0},[l("p",null,c(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:d(()=>[M(c(e.$t("Continue to Deactivate Account")),1)]),_:1})],64)):o.selection=="deactivate"?(n(),r(F,{key:1},[l("h4",null,c(e.$t("This will deactivate your account")),1),l("p",null,c(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",X$,[a(m,{onClick:t[1]||(t[1]=f=>o.selection="init"),class:"fcom_secondary_button"},{default:d(()=>[M(c(e.$t("Go Back")),1)]),_:1}),a(m,{onClick:t[2]||(t[2]=f=>i.deactivateAccount()),type:"danger"},{default:d(()=>[M(c(e.$t("Confirm Account Deactivation")),1)]),_:1})])],64)):_("",!0)])])}const t7=I(K$,[["render",e7]]),s7={name:"UserProfileUpdate",props:["isOwn","profile","username"],emits:["refetch"],components:{SlugInput:At,MarkdownEditor:as,AccountDeactivation:t7,InfoFilled:Vt},setup(){const e=Be(),t=re();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:ts,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)}},o7={key:0,class:"fcom_sub_group fcom_additional_info"},i7={class:"fcom_sub_group_header"},n7={key:0},l7={class:"fcom_sub_group_content"},a7={key:0,class:"fcom_sub_group"},r7={class:"fcom_sub_group_header"},d7={class:"fcom_sub_group_content"},c7={key:1,class:"fcom_mb_20"},u7={key:0,class:"fcom_sub_group"},_7={class:"fcom_sub_group_header"},m7={key:0,class:"fcom_help_text"},h7={id:"fcom_flag_member_help"},f7={key:2},p7={style:{color:"var(--el-color-danger, red)"},class:"help_msg"},g7={key:3,class:"help_msg"},y7={class:"fcom_sub_group"},v7={class:"fcom_fixed_bottom_overlay"},b7={key:0,class:"fcom_update_profile fcom_change_password"},k7={class:"fcom_sub_group"},w7={class:"fcom_sub_group_header"},C7={class:"fcom_change_password_content"};function $7(e,t,s,u,o,i){const m=oe,f=pe,h=dt,p=ct,k=g("InfoFilled"),b=j,$=Ee,w=g("markdown-editor"),C=Ye,v=le,S=ae,T=Qe,V=be,P=ve,L=g("UserBadge"),x=g("slug-input"),A=O,U=ge,B=g("account-deactivation"),N=se("loading");return n(),r(F,null,[l("div",{class:D([{fcom_is_dirty:o.fcom_is_dirty},"fcom_update_profile"])},[a(U,{onSubmit:t[11]||(t[11]=q(H=>e.doNothing(),["prevent"])),"label-position":"top",modelValue:o.profileData,"onUpdate:modelValue":t[12]||(t[12]=H=>o.profileData=H)},{default:d(()=>[a(p,{gutter:30},{default:d(()=>[a(h,{xs:24,md:12},{default:d(()=>[a(f,{label:e.$t("First Name"),required:""},{default:d(()=>[a(m,{modelValue:o.profileData.first_name,"onUpdate:modelValue":t[0]||(t[0]=H=>o.profileData.first_name=H)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),a(h,{xs:24,md:12},{default:d(()=>[a(f,{label:e.$t("Last Name")},{default:d(()=>[a(m,{modelValue:o.profileData.last_name,"onUpdate:modelValue":t[1]||(t[1]=H=>o.profileData.last_name=H)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),a(p,{gutter:30},{default:d(()=>[a(h,{xs:24,md:12},{default:d(()=>[a(f,{label:e.$t("Email")},{default:d(()=>[a(m,{disabled:!s.profile.can_change_email,modelValue:o.profileData.email,"onUpdate:modelValue":t[2]||(t[2]=H=>o.profileData.email=H)},null,8,["disabled","modelValue"])]),_:1},8,["label"])]),_:1}),a(h,{xs:24,md:12},{default:d(()=>[a(f,{label:e.$t("Website URL")},{default:d(()=>[a(m,{type:"url",modelValue:o.profileData.website,"onUpdate:modelValue":t[3]||(t[3]=H=>o.profileData.website=H)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),a(f,null,{label:d(()=>[M(c(e.$t("Headline"))+" ",1),a($,{effect:"dark",placement:"top",content:e.$t("A short tagline shown on the members list.")},{default:d(()=>[a(b,{class:"fcom_label_tooltip",role:"button",tabindex:"0","aria-label":e.$t("A short tagline shown on the members list.")},{default:d(()=>[a(k)]),_:1},8,["aria-label"])]),_:1},8,["content"])]),default:d(()=>[a(m,{modelValue:o.profileData.headline,"onUpdate:modelValue":t[4]||(t[4]=H=>o.profileData.headline=H),maxlength:"60","show-word-limit":""},null,8,["modelValue"])]),_:1}),a(f,{class:"fcom_editor_input_wrap",label:e.$t("Short Bio")},{default:d(()=>[a(w,{disable_mention:!0,disable_media:!0,placeholder:e.$t("Write a short bio about yourself"),modelValue:o.profileData.short_description,"onUpdate:modelValue":t[5]||(t[5]=H=>o.profileData.short_description=H)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),(n(!0),r(F,null,R(i.customFieldGroups,H=>(n(),r(F,{key:H.slug},[H.fields&&H.fields.length?(n(),r("div",o7,[l("div",i7,[l("h5",null,c(H.label),1),H.edit_description?(n(),r("p",n7,c(H.edit_description),1)):_("",!0)]),l("div",l7,[(n(!0),r(F,null,R(H.fields,z=>(n(),y(f,{key:z.slug,label:z.label,required:z.is_required},{default:d(()=>[z.type==="text"?(n(),y(m,{key:0,modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,placeholder:z.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):z.type==="textarea"?(n(),y(m,{key:1,type:"textarea",rows:3,modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,placeholder:z.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):z.type==="number"?(n(),y(m,{key:2,type:"number",modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,placeholder:z.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):z.type==="date"?(n(),y(C,{key:3,modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,type:"date","value-format":"YYYY-MM-DD",placeholder:z.placeholder,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"])):z.type==="select"?(n(),y(S,{key:4,modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,placeholder:z.placeholder,"value-on-clear":"",clearable:""},{default:d(()=>[(n(!0),r(F,null,R(z.options,G=>(n(),y(v,{key:G,label:G,value:G},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):z.type==="multiselect"?(n(),y(S,{key:5,modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,placeholder:z.placeholder,multiple:!0,clearable:""},{default:d(()=>[(n(!0),r(F,null,R(z.options,(G,ne)=>(n(),y(v,{key:ne,label:G,value:ne},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):z.type==="radio"?(n(),y(V,{key:6,modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G},{default:d(()=>[(n(!0),r(F,null,R(z.options,G=>(n(),y(T,{key:G,value:G},{default:d(()=>[M(c(G),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):z.type==="url"?(n(),y(m,{key:7,type:"url",modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,placeholder:z.placeholder||"https://"},null,8,["modelValue","onUpdate:modelValue","placeholder"])):_("",!0)]),_:2},1032,["label","required"]))),128))])])):_("",!0)],64))),128)),i.isEmpty(e.appVars.socialLinkProviders)?_("",!0):(n(),r("div",a7,[l("div",r7,[l("h5",null,c(e.$t("Social Links")),1),l("p",null,c(e.$t("Add your social media profile link.")),1)]),l("div",d7,[(n(!0),r(F,null,R(e.appVars.socialLinkProviders,(H,z)=>(n(),y(f,{key:z,label:H.title},{default:d(()=>[a(m,{placeholder:H.placeholder,modelValue:o.profileData.social_links[z],"onUpdate:modelValue":G=>o.profileData.social_links[z]=G},{prepend:d(()=>[a(b,{innerHTML:H.icon_svg},null,8,["innerHTML"]),l("span",null,c(H.domain),1)]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]))),128))])])),s.profile.can_change_username?(n(),r("div",c7,[e.hasPermission("super_admin")?(n(),r("div",u7,[l("div",_7,[l("h5",null,c(e.$t("Admin Actions")),1),l("p",null,c(e.$t("Admin tools for account verification and status management.")),1)]),a(f,{label:e.$t("Account Verification"),class:"checkbox_label"},{default:d(()=>[a(P,{"true-value":1,"false-value":0,modelValue:o.profileData.is_verified,"onUpdate:modelValue":t[6]||(t[6]=H=>o.profileData.is_verified=H),class:"fcom_checkbox"},{default:d(()=>[M(c(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:d(()=>[M(c(e.$t("Moderate Posts and Comments"))+" ",1),a($,{effect:"dark",placement:"top",content:e.$t("Require all future posts or comments posted by this member to be approved by an admin")},{default:d(()=>[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:d(()=>[a(k)]),_:1},8,["aria-label"])]),_:1},8,["content"])]),default:d(()=>[a(P,{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]=H=>o.profileData.is_flagged=H),class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Require approval for new posts and comments")),1)]),_:1},8,["disabled","aria-describedby","modelValue"]),s.profile.is_moderator==="yes"?(n(),r("div",m7,[l("p",h7,c(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:d(()=>[a(S,{clearable:"",multiple:!0,modelValue:o.profileData.badge_slugs,"onUpdate:modelValue":t[8]||(t[8]=H=>o.profileData.badge_slugs=H),placeholder:e.$t("User Profile Badge")},{default:d(()=>[(n(!0),r(F,null,R(e.appVars.user_badges,H=>(n(),y(v,{key:H.slug,label:H.title,value:H.slug},{default:d(()=>[a(L,{badge:H,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:d(()=>[a(V,{modelValue:o.profileData.status,"onUpdate:modelValue":t[9]||(t[9]=H=>o.profileData.status=H),class:"fcom_radio_group"},{default:d(()=>[a(T,{value:"active"},{default:d(()=>[M(c(e.$t("Active")),1)]),_:1}),a(T,{value:"pending"},{default:d(()=>[M(c(e.$t("Pending")),1)]),_:1}),a(T,{value:"blocked"},{default:d(()=>[M(c(e.$t("Blocked")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),o.profileData.status?o.profileData.status!="active"?(n(),r("div",g7,[l("p",null,c(e.$t("The user cannot access the portal.")),1)])):_("",!0):(n(),r("div",f7,[l("p",p7,c(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",y7,[a(f,{label:e.$t("Community Account Username")},{default:d(()=>[a(x,{is_inital_inactive:!0,modelValue:o.profileData.username,"onUpdate:modelValue":t[10]||(t[10]=H=>o.profileData.username=H),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:d(()=>[l("div",v7,[Y((n(),y(A,{class:"fcom_primary_button",onClick:i.updateProfile,disabled:o.updating},{default:d(()=>[M(c(e.$t("Save Changes")),1)]),_:1},8,["onClick","disabled"])),[[N,o.updating]])])]),_:1})]),_:1},8,["modelValue"])],2),s.profile.username==e.appVars.auth.username&&s.profile.can_change_password?(n(),r("div",b7,[a(U,{onSubmit:t[16]||(t[16]=q(()=>{},["prevent"])),"label-position":"top"},{default:d(()=>[l("div",k7,[l("div",w7,[l("h5",null,c(e.$t("Change Password")),1),l("p",null,c(e.$t("Update the password you use to log in.")),1)]),l("div",C7,[a(f,{label:e.$t("Current Password"),required:""},{default:d(()=>[a(m,{type:"password","show-password":"",autocomplete:"current-password",modelValue:o.passwordData.current_password,"onUpdate:modelValue":t[13]||(t[13]=H=>o.passwordData.current_password=H)},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("New Password"),required:""},{default:d(()=>[a(m,{type:"password","show-password":"",autocomplete:"new-password",modelValue:o.passwordData.new_password,"onUpdate:modelValue":t[14]||(t[14]=H=>o.passwordData.new_password=H)},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("Confirm New Password"),required:""},{default:d(()=>[a(m,{type:"password","show-password":"",autocomplete:"new-password",modelValue:o.passwordData.confirm_password,"onUpdate:modelValue":t[15]||(t[15]=H=>o.passwordData.confirm_password=H)},null,8,["modelValue"])]),_:1},8,["label"]),a(f,null,{default:d(()=>[Y((n(),y(A,{class:"fcom_primary_button",onClick:i.changePassword,disabled:o.changingPassword},{default:d(()=>[M(c(e.$t("Change Password")),1)]),_:1},8,["onClick","disabled"])),[[N,o.changingPassword]])]),_:1})])])]),_:1})])):_("",!0),e.hasFeature("can_deactivate_account")&&s.profile.username==e.appVars.auth.username?(n(),y(B,{key:1,profile:s.profile},null,8,["profile"])):_("",!0)],64)}const S7=I(s7,[["render",$7]]),V7={name:"UserAbout",props:["profile","isOwn"],components:{Timer:Js,CalendarIcon:go,LockedProfile:gt},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:'',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}}},M7={key:1,class:"about_wrap"},L7={class:"about_header"},T7={key:0,class:"about_body"},F7=["innerHTML"],I7={key:1},P7={class:"about_items"},E7=["title"],A7=["title"],U7={class:"items_title"},B7={key:0,class:"about_item"},D7={class:"about_item_label"},R7=["href"],x7={key:2,class:"about_items"},O7={key:0,class:"items_title"},H7=["href","title"];function j7(e,t,s,u,o,i){const m=g("LockedProfile"),f=g("EditPen"),h=j,p=O,k=g("CalendarIcon"),b=g("Timer"),$=Q;return s.profile.is_restricted?(n(),y(m,{key:0})):(n(),r("div",M7,[l("div",L7,[l("h3",null,c(e.$t("About")),1),s.isOwn?(n(),y(p,{key:0,"aria-label":e.$t("Edit your profile description"),onClick:i.goToUpdateProfile,text:""},{default:d(()=>[a(h,null,{default:d(()=>[a(f)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0)]),s.profile?(n(),r("div",T7,[s.profile.short_description_rendered?(n(),r("div",{key:0,class:"about_description feed_texts feed_md_content",innerHTML:s.profile.short_description_rendered},null,8,F7)):s.isOwn?(n(),r("div",I7,[a(p,{class:"fcom_plain_button",onClick:t[0]||(t[0]=w=>e.$router.push({name:"update_profile",params:{username:s.profile.username}}))},{default:d(()=>[l("span",null,c("+ "+e.$t("Add your profile description")),1)]),_:1})])):_("",!0),l("div",P7,[s.profile.created_at?(n(),r("div",{key:0,title:s.profile.created_at,class:"about_item"},[a(h,null,{default:d(()=>[a(k)]),_:1}),l("span",null,c(e.$t("Joined %s",e.humanDateDiff(s.profile.created_at))),1)],8,E7)):_("",!0),s.profile.last_activity?(n(),r("div",{key:1,title:s.profile.last_activity,class:"about_item"},[a(h,null,{default:d(()=>[a(b)]),_:1}),M(" "+c(e.$t("Last seen: %s",e.humanDateDiff(s.profile.last_activity))),1)],8,A7)):_("",!0)]),(n(!0),r(F,null,R(i.visibleGroups,w=>(n(),r("div",{key:w.slug,class:"about_items"},[l("div",U7,c(w.label),1),(n(!0),r(F,null,R(w.fields,C=>(n(),r(F,{key:C.slug},[i.hasFieldValue(C.value)?(n(),r("div",B7,[l("span",D7,c(C.label)+":",1),C.type==="url"&&C.value?(n(),r("a",{key:0,href:C.value,target:"_blank",rel:"noopener noreferrer"},c(C.value),9,R7)):(n(),r("span",{key:1,class:D({about_item_multiline:C.type==="textarea"})},c(i.formatFieldValue(C)),3))])):_("",!0)],64))),128))]))),128)),i.hasSocialLinks||s.isOwn?(n(),r("div",x7,[i.hasSocialLinks?(n(),r("div",O7,c(e.$t("Social Links")),1)):_("",!0),(n(!0),r(F,null,R(i.socialLinks,w=>(n(),r("a",{target:"_blank",rel:"noopener noreferrer",href:w.url,key:w.title,title:w.title,class:"about_item"},[a(h,{innerHTML:w.icon},null,8,["innerHTML"]),M(" "+c(w.text),1)],8,H7))),128)),s.isOwn&&!i.hasSocialLinks?(n(),y(p,{key:1,class:"fcom_plain_button",onClick:i.goToUpdateProfile},{default:d(()=>[l("span",null,c("+ "+e.$t("Add social links")),1)]),_:1},8,["onClick"])):_("",!0)])):_("",!0)])):(n(),y($,{key:1,animated:!0}))]))}const N7=I(V7,[["render",j7]]),z7={name:"UserComments",props:["profile","username","isOwn"],emits:["refetch"],components:{Pagination:$e,Check:Xs,ImageIcon:ns,FeedMdContent:ft,LockedProfile:gt},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()}},q7={key:1,class:"white_loaded"},G7={class:"course_comments feed_comments user_comments"},Y7={class:"comment_text_head"},W7=["title"],K7={class:"comment_action"},Z7={class:"comment_text_head_post"},Q7=["href","aria-haspopup","onClick"],J7={class:"comment_text"},X7=["onClick"],eS={key:1,class:"comment_text_body feed_md_content media_only_content"},tS={key:0};function sS(e,t,s,u,o,i){const m=g("LockedProfile"),f=Q,h=g("Delete"),p=j,k=O,b=g("FeedMdContent"),$=g("ImageIcon"),w=g("pagination");return s.profile.is_restricted?(n(),y(m,{key:0})):o.loading?(n(),r("div",q7,[a(f,{row:5})])):(n(),r(F,{key:2},[l("div",G7,[(n(!0),r(F,null,R(o.comments,(C,v)=>(n(),r("div",{key:C.id,class:"fcom_course_comment each_comment"},[t[0]||(t[0]=l("span",{class:"comment_icon"},null,-1)),l("div",Y7,[l("div",{title:C.created_at,class:"comment_text_head_time"},c(e.humanDateDiff(C.created_at)),9,W7),l("div",K7,[s.isOwn?(n(),y(k,{key:0,class:"fcom_plain_button",onClick:S=>i.deleteComment(C,v)},{default:d(()=>[a(p,null,{default:d(()=>[a(h)]),_:1})]),_:1},8,["onClick"])):_("",!0)])]),l("div",Z7,[l("a",{class:"post_link",href:i.getPostHref(C),"aria-haspopup":i.canOpenInModal(C)?"dialog":null,onClick:S=>i.openPost(C,S)},c(i.getPostExcerpt(C.post)),9,Q7)]),l("div",J7,[C.message_rendered?(n(),r(F,{key:0},[a(b,{ref_for:!0,ref:"commentBody",class_name:i.contentClass(C.id),content:C.message_rendered},null,8,["class_name","content"]),o.canExpandMap[C.id]?(n(),r("button",{key:0,type:"button",class:"fcom_see_more_btn",onClick:S=>i.toggleExpand(C.id)},c(o.expandedMap[C.id]?e.$t("See less"):e.$t("See more")),9,X7)):_("",!0)],64)):(n(),r("div",eS,[a($,{class:"fcom_status_img_icon"})]))])]))),128)),o.pagination.total?_("",!0):(n(),r("div",tS,[l("h5",null,c(e.$t("%s did not add any comment to any posts yet",s.profile.display_name)),1)]))]),a(w,{pagination:o.pagination,onFetch:i.fetchComments},null,8,["pagination","onFetch"])],64))}const oS=I(z7,[["render",sS]]),iS={name:"UserCourses",props:["profile","isOwn"],components:{MoreFilled:eo,GroupIcon:Dt,LockedProfile:gt},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()}},nS={key:1,class:"user_courses"},lS={key:0,class:"fcom_box_card_list"},aS=["onClick"],rS=["src","alt","onError"],dS={key:1,class:"fcom_no_image"},cS={class:"fcom_box_card_info"},uS={class:"fcom_box_card_name"},_S={class:"fcom_box_card_details"},mS={class:"inline_details"},hS={key:0,class:"inline_details"},fS={key:0,class:"fcom_box_card_description"},pS=["innerHTML"],gS={class:"fcom_box_card_action"},yS=["onClick"],vS=["onClick"],bS={key:1,class:"loading"},kS={key:2},wS={class:"no_members"},CS={key:3,class:"fcom_no_items_wrap"},$S={key:0},SS={key:1};function VS(e,t,s,u,o,i){const m=g("LockedProfile"),f=De,h=g("router-link"),p=g("MoreFilled"),k=j,b=O,$=We,w=Ke,C=Ze,v=g("GroupIcon"),S=Q;return s.profile.is_restricted?(n(),y(m,{key:0})):(n(),r("div",nS,[o.courses.length?(n(),r("div",lS,[(n(!0),r(F,null,R(o.courses,T=>(n(),r("div",{key:T.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:V=>i.goToCourse(T.slug)},[T.cover_photo&&!T.coverError?(n(),r("img",{key:0,src:T.cover_photo,alt:T.title,onError:V=>T.coverError=!0},null,40,rS)):(n(),r("div",dS))],8,aS),l("div",cS,[l("div",uS,[a(h,{class:"course_route",to:{name:"view_course",params:{course_slug:T.slug}}},{default:d(()=>[M(c(T.title)+" ",1),T.status=="draft"?(n(),y(f,{key:0,type:"info"},{default:d(()=>[M(c(T.status),1)]),_:2},1024)):_("",!0)]),_:2},1032,["to"]),e.isAdmin()?(n(),y(C,{key:0,trigger:"click"},{dropdown:d(()=>[a(w,null,{default:d(()=>[a($,{onClick:V=>i.removeMembership(T.slug)},{default:d(()=>[M(c(e.$t("Remove from course")),1)]),_:1},8,["onClick"])]),_:2},1024)]),default:d(()=>[a(b,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:d(()=>[a(k,null,{default:d(()=>[a(p)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)):_("",!0)]),l("div",_S,[l("div",mS,[l("span",null,c(e.$_n("%d Section","%d Sections",T.sectionsCount)),1),t[0]||(t[0]=l("span",{class:"fcom_inline_separator"},null,-1)),l("span",null,c(e.$_n("%d Lesson","%d Lessons",T.lessonsCount)),1)]),T.studentsCount?(n(),r("div",hS,[a(k,null,{default:d(()=>[a(v)]),_:1}),M(" "+c(e.$_n("%s student","%s students",e.$formatNumber(T.studentsCount))),1)])):_("",!0)]),T.description?(n(),r("div",fS,c(e.getExcerpt(T.description)),1)):_("",!0),T.custom_html?(n(),r("div",{key:1,class:"fcom_box_card_custom_html",innerHTML:T.custom_html},null,8,pS)):_("",!0),l("div",gS,[T.isEnrolled?(n(),r("button",{key:0,class:"fcom_card_button",onClick:V=>i.goToCourse(T.slug)},c(e.$t("%s Completed",T.progress+"%")),9,yS)):(n(),r("button",{key:1,class:"fcom_card_button",onClick:V=>i.goToCourse(T.slug)},c(e.$t("View Course")),9,vS))])])]))),128))])):_("",!0),o.loading?(n(),r("div",bS,[a(S,{class:"white_loaded",rows:3,animated:!0}),a(S,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):s.profile.canViewUserSpaces?o.courses.length?_("",!0):(n(),r("div",CS,[l("h3",null,c(e.$t("No courses yet")),1),s.isOwn?(n(),r("p",$S,c(e.$t("Courses you enroll in will appear here.")),1)):(n(),r("p",SS,c(e.$t("This member has not enrolled in any courses yet.")),1))])):(n(),r("div",kS,[l("div",wS,c(e.$t("Sorry, you do not have permission to view this page")),1)]))]))}const MS=I(iS,[["render",VS]]),LS={name:"GroupUsersIcon"},TS={viewBox:"0 0 128 128",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};function FS(e,t,s,u,o,i){return n(),r("svg",TS,[...t[0]||(t[0]=[Le('',1)])])}const IS=I(LS,[["render",FS]]),PS={name:"NotificationPref",components:{NotificationOnboard:is,Notification:hi,GroupUsersIcon:IS},props:["username"],data(){return{pref:{},spaceGroups:[],is_custom:!1,loading:!1,error:"",saving:!1,digestEmailDay:"",initialState:null,default_messaging_email_frequency:"",crm_email_status:"",push_available:!1,reconfirming:!1,reconfirm_sent:!1}},computed:{isOwn(){return this.username===this.auth.username},showPush(){return this.push_available},channelRows(){return[{key:"comment",label:this.$t("Someone comments on my post"),mail:"com_my_post_mail",push:"com_my_post_push"},{key:"reply",label:this.$t("Someone replies to my comment"),mail:"reply_my_com_mail",push:"reply_my_com_push"},{key:"mention",label:this.$t("Someone mentions me"),mail:"mention_mail",push:"mention_push"},{key:"co_comment",label:this.$t("Someone also comments on a post I commented on"),push:"co_com_push"},{key:"digest",label:this.$t("Weekly digest on %s",this.digestEmailDay),mail:"digest_mail",push:""}]},visibleChannelRows(){return this.channelRows.filter(e=>e.mail||e.push&&this.showPush)},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||(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.push_available=!!e.push_available,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(){if(this.saving)return;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.")}},ES={class:"fcom_notification_config"},AS={key:0},US=["innerHTML"],BS={key:1,class:"white_loaded"},DS={class:"fcom_notification_card"},RS={class:"fcom_notification_card__header"},xS={class:"fcom_notification_card__title"},OS={key:0,class:"fcom_gn_alert_wrap"},HS={style:{margin:"0 0 10px 0","font-size":"12px"}},jS={key:0,style:{margin:"0","font-weight":"500"}},NS={class:"fcom_gn_table_wrap"},zS={class:"fcom_gn_event"},qS={class:"fcom_gn_cell_checks"},GS={key:1,class:"fcom_input_wrap fcom_gn_freq"},YS={style:{"font-weight":"500","font-size":"16px",margin:"10px 0 5px 0"}},WS={key:0,class:"fcom_not_enabled"},KS={key:1,class:"fcom_not_enabled"},ZS={key:2,class:"fcom_not_enabled"},QS={class:"fcom_notification_card"},JS={class:"fcom_notification_card__header"},XS={class:"fcom_notification_card__title"},e9={class:"fcom_np_table_wrap"},t9={key:0,class:"fcom_np_group_title"},s9={key:1,class:"fcom_np_space"},o9=["innerHTML"],i9=["innerHTML"],n9={key:2,class:"fcom_np_icon fcom_no_avatar"},l9={class:"fcom_np_name"},a9={class:"fcom_sr_only"},r9={class:"fcom_sr_only"},d9={class:"fcom_sr_only"},c9={key:0,class:"fcom_np_cell_radios"},u9={key:0,class:"fcom_notification_card fcom_fixed_bottom_overlay"},_9={key:3},m9={key:0},h9=["href"];function f9(e,t,s,u,o,i){const m=Q,f=g("NotificationOnboard"),h=g("Notification"),p=j,k=O,b=Kt,$=Qt,w=ve,C=Jt,v=Qe,S=be,T=g("GroupUsersIcon");return n(),r("div",ES,[o.error?(n(),r("div",AS,[l("p",{innerHTML:o.error},null,8,US)])):o.loading?(n(),r("div",BS,[a(m,{rows:10,animated:!0})])):e.auth.user_id||e.hasPermission("super_admin")&&o.pref?(n(),r("div",{key:2,class:D([{fcom_is_dirty:i.fcom_is_dirty},"fcom_notification_config_body"])},[a(f,{placement:"profile_notification_prefs","should-show-close-button":!1}),l("div",DS,[l("div",RS,[a(p,{style:{"font-size":"30px"}},{default:d(()=>[a(h)]),_:1}),l("div",xS,[l("h3",null,c(e.$t("Global Notifications")),1),l("p",null,c(e.$t("These settings will be applied across all spaces you're a member of.")),1)])]),o.crm_email_status?(n(),r("div",OS,[a(b,{class:"fcom_email_paused_alert",type:"warning",closable:!1,"show-icon":""},{title:d(()=>[M(c(e.$t("Your email notifications are currently paused")),1)]),default:d(()=>[l("p",HS,c(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(),r("p",jS,c(e.$t("Confirmation email sent! Please check your inbox and click the confirmation link.")),1)):(n(),y(k,{key:1,size:"small",type:"warning",loading:o.reconfirming,onClick:i.reconfirmEmail},{default:d(()=>[M(c(e.$t("Re-confirm my email address")),1)]),_:1},8,["loading","onClick"]))]),_:1})])):_("",!0),l("div",NS,[a(C,{data:i.visibleChannelRows,class:"fcom_gn_table fcom_table"},{default:d(()=>[a($,{label:e.$t("Notify me when"),"min-width":e.isMobile?180:220,fixed:""},{default:d(({row:V})=>[l("span",zS,c(V.label),1)]),_:1},8,["label","min-width"]),e.isMobile?(n(),y($,{key:1,label:e.$t("Notifications"),"min-width":"170"},{default:d(({row:V})=>[l("div",qS,[V.mail?(n(),y(w,{key:0,"true-value":"yes","false-value":"no",modelValue:o.pref[V.mail],"onUpdate:modelValue":P=>o.pref[V.mail]=P,class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Email")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])):_("",!0),i.showPush&&V.push?(n(),y(w,{key:1,"true-value":"yes","false-value":"no",modelValue:o.pref[V.push],"onUpdate:modelValue":P=>o.pref[V.push]=P,class:"fcom_checkbox"},{default:d(()=>[M(c(e.$t("Push")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])):_("",!0)])]),_:1},8,["label"])):(n(),r(F,{key:0},[a($,{label:e.$t("Email"),align:"center",width:"150"},{default:d(({row:V})=>[V.mail?(n(),y(w,{key:0,"true-value":"yes","false-value":"no",modelValue:o.pref[V.mail],"onUpdate:modelValue":P=>o.pref[V.mail]=P,class:"fcom_checkbox fcom_gn_check","aria-label":V.label},null,8,["modelValue","onUpdate:modelValue","aria-label"])):_("",!0)]),_:1},8,["label"]),i.showPush?(n(),y($,{key:0,label:e.$t("Push"),align:"center",width:"150"},{default:d(({row:V})=>[V.push?(n(),y(w,{key:0,"true-value":"yes","false-value":"no",modelValue:o.pref[V.push],"onUpdate:modelValue":P=>o.pref[V.push]=P,class:"fcom_checkbox fcom_gn_check","aria-label":V.label},null,8,["modelValue","onUpdate:modelValue","aria-label"])):_("",!0)]),_:1},8,["label"])):_("",!0)],64))]),_:1},8,["data"])]),e.appVars.has_chat&&o.default_messaging_email_frequency!="no"?(n(),r("div",GS,[l("p",YS,c(e.$t("Email sending frequency for one-to-one messages")),1),a(S,{modelValue:o.pref.message_email_frequency,"onUpdate:modelValue":t[0]||(t[0]=V=>o.pref.message_email_frequency=V),class:"fcom_radio_group"},{default:d(()=>[o.default_messaging_email_frequency!=="disabled"?(n(),y(v,{key:0,value:"default",label:e.$t("Community Default")},null,8,["label"])):_("",!0),a(v,{value:"hourly",label:e.$t("Hourly")},null,8,["label"]),a(v,{value:"daily",label:e.$t("Daily")},null,8,["label"]),a(v,{value:"weekly",label:e.$t("Weekly")},null,8,["label"]),a(v,{value:"disabled",label:e.$t("Disable")},null,8,["label"])]),_:1},8,["modelValue"]),o.pref.message_email_frequency=="disabled"?(n(),r("p",WS,c(e.$t("You will not get any email on new messages from any members")),1)):o.pref.message_email_frequency=="default"?(n(),r("p",KS,[o.default_messaging_email_frequency=="disabled"?(n(),r(F,{key:0},[M(c(e.$t("Email notification is disabled for one-to-one messages as per global community settings.")),1)],64)):(n(),r(F,{key:1},[M(c(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(),r("p",ZS,c(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",QS,[l("div",JS,[a(p,{style:{"font-size":"30px"}},{default:d(()=>[a(T)]),_:1}),l("div",XS,[l("h3",null,c(e.$t("New Posts Notifications")),1),l("p",null,c(e.$t("Subscribe to new posts notifications by space")),1)])]),l("div",e9,[a(C,{data:i.notificationRows,"row-class-name":({row:V})=>V.__group?"fcom_np_group_row":"",class:"fcom_np_table fcom_table"},{empty:d(()=>[M(c(e.$t("No spaces found")),1)]),default:d(()=>[a($,{label:e.$t("Space"),"min-width":e.isMobile?180:220,fixed:""},{default:d(({row:V})=>[V.__group?(n(),r("div",t9,c(V.title),1)):(n(),r("div",s9,[V.icon?(n(),y(p,{key:0,class:"fcom_np_icon"},{default:d(()=>[l("span",{innerHTML:V.icon},null,8,o9)]),_:2},1024)):V.shape_svg?(n(),r("span",{key:1,class:"fcom_np_icon",innerHTML:V.shape_svg},null,8,i9)):(n(),r("span",n9)),l("span",l9,c(V.title),1)]))]),_:1},8,["label","min-width"]),e.isMobile?(n(),y($,{key:1,label:e.$t("Notifications"),"min-width":"200"},{default:d(({row:V})=>[V.__group?_("",!0):(n(),r("div",c9,[a(v,{modelValue:V.pref,"onUpdate:modelValue":P=>V.pref=P,value:"",name:"space-pref-"+V.id},{default:d(()=>[M(c(e.$t("Email Disabled")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]),a(v,{modelValue:V.pref,"onUpdate:modelValue":P=>V.pref=P,value:"admin_only_posts",name:"space-pref-"+V.id},{default:d(()=>[M(c(e.$t("Notify only for Admin Posts")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]),a(v,{modelValue:V.pref,"onUpdate:modelValue":P=>V.pref=P,value:"all_member_posts",name:"space-pref-"+V.id},{default:d(()=>[M(c(e.$t("Notify for all posts")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"])]))]),_:1},8,["label"])):(n(),r(F,{key:0},[a($,{label:e.$t("Email Disabled"),align:"center",width:"180"},{default:d(({row:V})=>[V.__group?_("",!0):(n(),y(v,{key:0,modelValue:V.pref,"onUpdate:modelValue":P=>V.pref=P,value:"",name:"space-pref-"+V.id,class:"fcom_np_radio"},{default:d(()=>[l("span",a9,c(e.$t("Email Disabled")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]))]),_:1},8,["label"]),a($,{label:e.$t("Notify only for Admin Posts"),align:"center",width:"220"},{default:d(({row:V})=>[V.__group?_("",!0):(n(),y(v,{key:0,modelValue:V.pref,"onUpdate:modelValue":P=>V.pref=P,value:"admin_only_posts",name:"space-pref-"+V.id,class:"fcom_np_radio"},{default:d(()=>[l("span",r9,c(e.$t("Notify only for Admin Posts")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]))]),_:1},8,["label"]),a($,{label:e.$t("Notify for all posts"),align:"center",width:"180"},{default:d(({row:V})=>[V.__group?_("",!0):(n(),y(v,{key:0,modelValue:V.pref,"onUpdate:modelValue":P=>V.pref=P,value:"all_member_posts",name:"space-pref-"+V.id,class:"fcom_np_radio"},{default:d(()=>[l("span",d9,c(e.$t("Notify for all posts")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]))]),_:1},8,["label"])],64))]),_:1},8,["data","row-class-name"])])]),i.isOwn?(n(),r("div",u9,[a(k,{onClick:i.saveSettings,disabled:o.saving,loading:o.saving,class:"fcom_primary_button"},{default:d(()=>[M(c(e.$t("Save Changes")),1)]),_:1},8,["onClick","disabled","loading"])])):_("",!0)],2)):(n(),r("div",_9,[l("h3",null,c(e.$t("Sorry you do not have permission to access this.")),1),e.auth.user_id?_("",!0):(n(),r("div",m9,[l("p",null,c(e.$t("Please login to access this page.")),1),l("a",{href:e.appVars.auth_url,class:"el-button fcom_primary_button link_button"},c(e.$t("Login")),9,h9)]))]))])}const p9=I(PS,[["render",f9]]),g9={name:"UserNotificationSettings",props:["username"],components:{NotificationPrefForm:p9}},y9={class:"fcom_routed_notification_settings"};function v9(e,t,s,u,o,i){const m=g("notification-pref-form");return n(),r("div",y9,[a(m,{username:s.username},null,8,["username"])])}const b9=I(g9,[["render",v9]]),k9={name:"UserFollowers",components:{Pagination:$e,FollowAction:st},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"))}},w9={class:"fcom_dir_layout_classic space_members fcom_dir_layout"},C9={class:"search_member"},$9={class:"feed_filters"},S9={id:"feed_short_by",class:"fcom_feed_filter_label"},V9={key:0,class:"loading"},M9={key:1,class:"no_follow"},L9={key:2,class:"card_list"},T9=["aria-label"],F9={class:"card_avatar"},I9={class:"card_info"},P9={class:"info_header"},E9={class:"meta_line"},A9={key:0,class:"card_headline"},U9={class:"feed_meta_info"},B9=["title"],D9=["title"],R9={key:1,class:"card_description"},x9={class:"card_action"},O9=["aria-label"];function H9(e,t,s,u,o,i){const m=g("Search"),f=j,h=oe,p=le,k=ae,b=Q,$=g("UserAvatar"),w=g("UserRouteLink"),C=g("FollowAction"),v=g("Pagination");return n(),r("div",w9,[l("div",C9,[a(h,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[0]||(t[0]=S=>o.search=S),placeholder:e.$t("Search Followers...")},{prefix:d(()=>[a(f,null,{default:d(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",$9,[t[5]||(t[5]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",S9,c(e.$t("Sort by:")),1),a(k,{"aria-label":e.$t("Sort followers by"),modelValue:o.sort_by,"onUpdate:modelValue":t[1]||(t[1]=S=>o.sort_by=S),class:"fcom_minimal_select","popper-class":"plain_select",onChange:t[2]||(t[2]=S=>i.toSearch())},{default:d(()=>[a(p,{value:"id",label:e.$t("Most Recent")},null,8,["label"]),a(p,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),o.loading&&!o.follows.length?(n(),r("div",V9,[a(b,{class:"white_loaded",rows:3,animated:!0})])):!o.loading&&!o.follows.length?(n(),r("div",M9,[o.search?(n(),r(F,{key:0},[M(c(e.$t("No results found")),1)],64)):(n(),r(F,{key:1},[M(c(e.$t("No one is following this account yet. Posting and interacting with others helps boost followers!")),1)],64))])):(n(),r("div",L9,[(n(!0),r(F,null,R(o.follows,S=>{var T,V,P,L,x,A,U,B,N,H;return n(),r("div",{key:S.followed_id,class:"each_card"},[l("div",{role:"region","aria-label":e.$t("User Info"),class:"card_content"},[l("div",F9,[a($,{is_online:e.isOnline((T=S.follower)==null?void 0:T.last_activity),xprofile:S.follower},null,8,["is_online","xprofile"])]),l("div",I9,[l("div",P9,[a(w,{show_pop:!0,show_badge:!0,xprofile:S.follower,show_follow:!0},null,8,["xprofile"]),l("div",E9,"@"+c((V=S.follower)==null?void 0:V.username),1)]),(L=(P=S.follower)==null?void 0:P.meta)!=null&&L.headline?(n(),r("div",A9,c(S.follower.meta.headline),1)):_("",!0),l("div",U9,[(x=S.follower)!=null&&x.created_at?(n(),r("div",{key:0,title:(A=S.follower)==null?void 0:A.created_at,class:"meta_line"},c(e.$t("Joined %s",e.humanDateDiff(S.follower.created_at))),9,B9)):_("",!0),(U=S.follower)!=null&&U.last_activity?(n(),r("div",{key:1,title:(B=S.follower)==null?void 0:B.last_activity,class:"meta_line"},c(e.$t("Last seen: %s",e.humanDateDiff(S.follower.last_activity))),9,D9)):_("",!0)]),(N=S.follower)!=null&&N.short_description?(n(),r("div",R9,c(e.getExcerpt(((H=S.follower.meta)==null?void 0:H.short_description_rendered)||S.follower.short_description,120)),1)):_("",!0)])],8,T9),l("div",x9,[a(C,{profile:S.follower,onRefetch:t[3]||(t[3]=z=>e.$emit("refetch"))},null,8,["profile"])])])}),128))])),i.showPagination?(n(),r("div",{key:3,role:"region","aria-label":e.$t("Pagination"),class:"pagination_wrap"},[a(v,{hide_on_single:!0,onFetch:t[4]||(t[4]=S=>i.fetchFollowers()),pagination:o.pagination},null,8,["pagination"])],8,O9)):_("",!0)])}const j9=I(k9,[["render",H9]]),N9={name:"UserFollowings",props:["isOwn","profile"],emits:["refetch"],components:{Pagination:$e,FollowAction:st},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"))}},z9={class:"fcom_dir_layout_classic space_members fcom_dir_layout"},q9={class:"search_member"},G9={class:"feed_filters"},Y9={id:"feed_short_by",class:"fcom_feed_filter_label"},W9={key:0,class:"loading"},K9={key:1,class:"no_follow"},Z9={key:2,class:"card_list"},Q9=["aria-label"],J9={class:"card_avatar"},X9={class:"card_info"},eV={class:"info_header"},tV={class:"meta_line"},sV={key:0,class:"card_headline"},oV={class:"feed_meta_info"},iV=["title"],nV=["title"],lV={key:1,class:"card_description"},aV={class:"card_action"},rV=["aria-label"];function dV(e,t,s,u,o,i){const m=g("Search"),f=j,h=oe,p=le,k=ae,b=Q,$=g("UserAvatar"),w=g("UserRouteLink"),C=g("FollowAction"),v=g("Pagination");return n(),r("div",z9,[l("div",q9,[a(h,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[0]||(t[0]=S=>o.search=S),placeholder:e.$t("Search Followings...")},{prefix:d(()=>[a(f,null,{default:d(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",G9,[t[5]||(t[5]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",Y9,c(e.$t("Sort by:")),1),a(k,{"aria-label":e.$t("Sort followings by"),modelValue:o.sort_by,"onUpdate:modelValue":t[1]||(t[1]=S=>o.sort_by=S),class:"fcom_minimal_select","popper-class":"plain_select",onChange:t[2]||(t[2]=S=>i.toSearch())},{default:d(()=>[a(p,{value:"id",label:e.$t("Most Recent")},null,8,["label"]),a(p,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),o.loading&&!o.follows.length?(n(),r("div",W9,[a(b,{class:"white_loaded",rows:3,animated:!0})])):!o.loading&&!o.follows.length?(n(),r("div",K9,[o.search?(n(),r(F,{key:0},[M(c(e.$t("No results found")),1)],64)):s.isOwn?(n(),r(F,{key:1},[M(c(e.$t("You aren't following anyone yet. Start following other members to connect and keep up with their activity!")),1)],64)):(n(),r(F,{key:2},[M(c(e.$t("This user isn't following anyone yet. Once they follow accounts, they'll show up here.")),1)],64))])):(n(),r("div",Z9,[(n(!0),r(F,null,R(o.follows,S=>{var T,V,P,L,x,A,U,B,N,H;return n(),r("div",{key:S.followed_id,class:"each_card"},[l("div",{role:"region","aria-label":e.$t("User Info"),class:"card_content"},[l("div",J9,[a($,{is_online:e.isOnline((T=S.followed)==null?void 0:T.last_activity),xprofile:S.followed},null,8,["is_online","xprofile"])]),l("div",X9,[l("div",eV,[a(w,{show_pop:!0,show_badge:!0,xprofile:S.followed,show_follow:!0},null,8,["xprofile"]),l("div",tV,"@"+c((V=S.followed)==null?void 0:V.username),1)]),(L=(P=S.followed)==null?void 0:P.meta)!=null&&L.headline?(n(),r("div",sV,c(S.followed.meta.headline),1)):_("",!0),l("div",oV,[(x=S.followed)!=null&&x.created_at?(n(),r("div",{key:0,title:(A=S.followed)==null?void 0:A.created_at,class:"meta_line"},c(e.$t("Joined %s",e.humanDateDiff(S.followed.created_at))),9,iV)):_("",!0),(U=S.followed)!=null&&U.last_activity?(n(),r("div",{key:1,title:(B=S.followed)==null?void 0:B.last_activity,class:"meta_line"},c(e.$t("Last seen: %s",e.humanDateDiff(S.followed.last_activity))),9,nV)):_("",!0)]),(N=S.followed)!=null&&N.short_description?(n(),r("div",lV,c(e.getExcerpt(((H=S.followed.meta)==null?void 0:H.short_description_rendered)||S.followed.short_description,120)),1)):_("",!0)])],8,Q9),l("div",aV,[a(C,{profile:S.followed,onRefetch:t[3]||(t[3]=z=>e.$emit("refetch"))},null,8,["profile"])])])}),128))])),i.showPagination?(n(),r("div",{key:3,role:"region","aria-label":e.$t("Pagination"),class:"pagination_wrap"},[a(v,{hide_on_single:!0,onFetch:t[4]||(t[4]=S=>i.fetchFollowings()),pagination:o.pagination},null,8,["pagination"])],8,rV)):_("",!0)])}const cV=I(N9,[["render",dV]]),uV={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}})}}},_V={class:"follow_header"},mV={class:"fcom_filter_menu"},hV={class:"fcom_filter_menu_ul"},fV={key:0},pV={key:1},gV={class:"follow_body"};function yV(e,t,s,u,o,i){var f,h;const m=g("router-view");return n(),r(F,null,[l("div",_V,[l("div",mV,[l("ul",hV,[((f=s.profile)==null?void 0:f.followings_count)!=null?(n(),r("li",fV,[l("a",{href:"#",onClick:t[0]||(t[0]=q(p=>i.switchRoute("user_followings"),["prevent"])),class:D({"router-link-exact-active":i.isActive("user_followings")})},c(e.$t("Following")),3)])):_("",!0),((h=s.profile)==null?void 0:h.followers_count)!=null?(n(),r("li",pV,[l("a",{href:"#",onClick:t[1]||(t[1]=q(p=>i.switchRoute("user_followers"),["prevent"])),class:D({"router-link-exact-active":i.isActive("user_followers")})},c(e.$t("Followers")),3)])):_("",!0)])])]),l("div",gV,[a(m,{isOwn:s.isOwn,profile:s.profile,onRefetch:t[2]||(t[2]=p=>e.$emit("refetch"))},null,8,["isOwn","profile"])])],64)}const vV=I(uV,[["render",yV]]),bV={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 kV(e,t,s,u,o,i){const m=g("MoreFilled"),f=j,h=O,p=je,k=be,b=pe,$=ge,w=fe,C=se("loading");return n(),y(w,{persistent:!1,placement:"bottom",width:270,visible:o.isOpened,onHide:t[2]||(t[2]=v=>o.isOpened=!1)},{reference:d(()=>[a(h,{"aria-label":e.$t("View actions"),onClick:i.togglePopover,size:"small",text:""},{default:d(()=>[a(f,{class:"fcom_more_icon"},{default:d(()=>[a(m)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:d(()=>[a($,{onSubmit:t[1]||(t[1]=q(v=>e.doNothing(),["prevent"])),"label-position":"top"},{default:d(()=>[a(b,{label:e.$t("Status")},{default:d(()=>[a(k,{modelValue:o.status,"onUpdate:modelValue":t[0]||(t[0]=v=>o.status=v)},{default:d(()=>[a(p,{label:e.$t("Active"),value:"active"},null,8,["label"]),a(p,{label:e.$t("Pending"),value:"pending"},null,8,["label"]),a(p,{label:e.$t("Blocked"),value:"blocked"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(b,null,{default:d(()=>[Y((n(),y(h,{disabled:o.working,onClick:i.changeMemberStatus,class:"fcom_primary_button"},{default:d(()=>[M(c(e.$t("Update Status")),1)]),_:1},8,["disabled","onClick"])),[[C,o.working]])]),_:1})]),_:1})]),_:1},8,["visible"])}const wV=I(bV,[["render",kV]]),CV={name:"AllMembers",components:{SocialLinks:Pt,Layout:we,AppLayout:Se,Pagination:$e,MemberAction:wV,FollowAction:st,SortControl:Ao},setup(){return{uiStore:Mt()}},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"))}},$V={key:0,class:"card_header"},SV=["aria-label"];const VV={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},MV={class:"permission_failed"},LV=["href"],TV={class:"search_member"},FV={class:"feed_filters"},IV={key:0,class:"loading"},PV={key:1,class:"no_members"},EV={key:2,class:"card_list"},AV=["aria-label"],UV={class:"card_avatar"},BV={class:"card_info"},DV={class:"info_header"},RV={class:"meta_line"},xV={key:0,class:"card_headline"},OV={class:"feed_meta_info"},HV=["title"],jV=["title"],NV={key:1,class:"card_description"},zV={key:2,class:"card_footer"},qV={class:"card_action"},GV=["aria-label"];function YV(e,t,s,u,o,i){const m=je,f=be,h=O,p=g("Search"),k=j,b=oe,$=g("SortControl"),w=Q,C=g("UserAvatar"),v=g("UserRouteLink"),S=g("SocialLinks"),T=g("FollowAction"),V=g("MemberAction"),P=g("Pagination"),L=g("layout"),x=g("app-layout");return n(),y(x,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:d(()=>[a(L,{use_scroll:!0,class:"no_bg_layout",title:e.$t("All Members")+" "+(typeof o.pagination.total=="number"?" ("+e.$formatNumber(o.pagination.total)+")":"")},{default:d(()=>[e.isAdmin()?(n(),r("div",$V,[l("div",{role:"region","aria-label":e.$t("Member Navigation"),class:"member_status"},[a(f,{onChange:i.toSearch,modelValue:o.status,"onUpdate:modelValue":t[0]||(t[0]=A=>o.status=A),class:"status_group"},{default:d(()=>[a(m,{value:"active"},{default:d(()=>[M(c(e.$t("Active")),1)]),_:1}),a(m,{value:"pending"},{default:d(()=>[M(c(e.$t("Pending")),1)]),_:1}),a(m,{value:"blocked"},{default:d(()=>[M(c(e.$t("Blocked")),1)]),_:1}),e.hasFeature("can_deactivate_account")?(n(),y(m,{key:0,value:"deactivated"},{default:d(()=>[M(c(e.$t("Deactivated (self)")),1)]),_:1})):_("",!0)]),_:1},8,["onChange","modelValue"])],8,SV),_("",!0)])):_("",!0),o.permission_failed?(n(),r("div",VV,[l("div",MV,[l("h3",null,c(e.$t("Permission Denied")),1),l("p",null,c(e.$t("You do not have permission to view all members")),1),l("a",{href:e.$getRouteLink("/"),class:"el-button fcom_primary_button"},c(e.$t("Go To All Feeds")),9,LV)])])):(n(),r(F,{key:2},[l("div",TV,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[2]||(t[2]=A=>o.search=A),placeholder:e.$t("Search Members...")},{prefix:d(()=>[a(k,null,{default:d(()=>[a(p)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",FV,[t[6]||(t[6]=l("div",{class:"fcom_feed_divider"},null,-1)),a($,{field:o.sort_by,"onUpdate:field":t[3]||(t[3]=A=>o.sort_by=A),dir:o.sort_dir,"onUpdate:dir":t[4]||(t[4]=A=>o.sort_dir=A),options:i.sortOptions,onChange:i.onSortChange},null,8,["field","dir","options","onChange"])]),l("div",{class:D(["fcom_dir_layout_"+o.memberLayout,"space_members fcom_dir_layout"])},[o.loading?(n(),r("div",IV,[a(w,{class:"white_loaded",rows:3,animated:!0})])):!o.loading&&!o.members.length?(n(),r("div",PV,c(e.$t("No members found")),1)):(n(),r("div",EV,[(n(!0),r(F,null,R(o.members,(A,U)=>{var B,N;return n(),r("div",{key:A.user_id,class:"each_card"},[l("div",{role:"region","aria-label":e.$t("User Info"),class:"card_content"},[l("div",UV,[a(C,{is_online:e.isOnline(A.last_activity),xprofile:A},null,8,["is_online","xprofile"])]),l("div",BV,[l("div",DV,[a(v,{show_pop:!0,show_badge:!0,xprofile:A,show_follow:!0},null,8,["xprofile"]),l("div",RV,"@"+c(A.username),1)]),(B=A.meta)!=null&&B.headline?(n(),r("div",xV,c(A.meta.headline),1)):_("",!0),l("div",OV,[A.created_at?(n(),r("div",{key:0,title:A.created_at,class:"meta_line"},c(e.$t("Joined %s",e.humanDateDiff(A.created_at))),9,HV)):_("",!0),A.last_activity?(n(),r("div",{key:1,title:A.last_activity,class:"meta_line"},c(e.$t("Last seen: %s",e.humanDateDiff(A.last_activity))),9,jV)):_("",!0)]),A.short_description?(n(),r("div",NV,c(e.getExcerpt(((N=A.meta)==null?void 0:N.short_description_rendered)||A.short_description,120)),1)):_("",!0),a(S,{style:{"justify-content":"left"},xprofile:A,isOwn:!1},null,8,["xprofile"]),A.status!="active"?(n(),r("div",zV,[l("div",{style:ue({color:A.status==="pending"?"var(--el-color-warning)":"var(--el-color-danger)",display:"flex",gap:"10px"}),class:"meta_line"},[A.status==="pending"?(n(),r(F,{key:0},[l("span",null,c(e.$t("Status:"))+" "+c(e.$labelize(A.status)),1),a(h,{onClick:H=>i.changeMemberStatus(A,"active"),type:"primary",size:"small",disabled:o.workingIds.includes(A.user_id),loading:o.workingIds.includes(A.user_id)},{default:d(()=>[M(c(e.$t("Approve")),1)]),_:1},8,["onClick","disabled","loading"])],64)):A.status==="blocked"?(n(),r(F,{key:1},[l("span",null,c(e.$t("Status:"))+" "+c(e.$labelize(A.status)),1),a(h,{onClick:H=>i.changeMemberStatus(A,"active"),type:"danger",size:"small",disabled:o.workingIds.includes(A.user_id),loading:o.workingIds.includes(A.user_id)},{default:d(()=>[M(c(e.$t("Unblock")),1)]),_:1},8,["onClick","disabled","loading"])],64)):(n(),r(F,{key:2},[l("span",null,c(e.$t("Status:"))+" "+c(e.$t("Self Deactivated")),1),a(h,{onClick:H=>i.changeMemberStatus(A,"active"),type:"danger",size:"small",disabled:o.workingIds.includes(A.user_id),loading:o.workingIds.includes(A.user_id)},{default:d(()=>[M(c(e.$t("Reactivate")),1)]),_:1},8,["onClick","disabled","loading"])],64))],4)])):_("",!0)])],8,AV),l("div",qV,[a(T,{profile:A},null,8,["profile"]),e.isAdmin()?(n(),y(V,{key:0,member:A,openedMemberId:o.openedMemberId,onTogglePopover:H=>i.handleTogglePopover(A.user_id)},null,8,["member","openedMemberId","onTogglePopover"])):_("",!0)])])}),128))])),o.pagination.total?(n(),r("div",{key:3,role:"region","aria-label":e.$t("Pagination"),class:"pagination_wrap"},[a(P,{hide_on_single:!0,onFetch:t[5]||(t[5]=A=>i.fetch()),pagination:o.pagination},null,8,["pagination"])],8,GV)):_("",!0)],2)],64))]),_:1},8,["title"])]),_:1})}const WV=I(CV,[["render",YV]]),KV={name:"Notifications",components:{AppLayout:Se,Layout:we,NotificationsBlock:io,Pagination:$e},setup(){return{notificationStore:ss()}},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)}},ZV={class:"fcom_filter_menu"},QV={class:"fcom_filter_menu_ul fcom_notification_types"},JV={style:{"border-top-left-radius":"0","border-top-right-radius":"0"},class:"space_members"},XV={key:0,class:"notifications notifications_wrap"},eM={class:"pagination_wrap"},tM={key:1,style:{"margin-top":"15px"}},sM={key:2};function oM(e,t,s,u,o,i){const m=Qo,f=O,h=g("notifications-block"),p=g("Pagination"),k=Q,b=g("layout"),$=g("app-layout"),w=se("loading");return n(),y($,{wrapper_class:"fcom_single_layout"},{default:d(()=>[a(b,{content_class:"no_bg_layout notification_layout",title:e.$t("Notifications")},{actions:d(()=>[a(m,{onChange:t[0]||(t[0]=C=>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[1]||(t[1]=C=>o.status=C),class:"fcom_switch"},null,8,["active-text","modelValue"]),a(f,{class:"fcom_primary_button",disabled:o.working,onClick:t[2]||(t[2]=C=>i.markAllRead())},{default:d(()=>[M(c(e.$t("Mark all as read")),1)]),_:1},8,["disabled"])]),default:d(()=>[l("div",ZV,[l("ul",QV,[l("li",null,[l("a",{onClick:t[3]||(t[3]=q(C=>i.switchType("all"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="all"&&o.status!="unread"}),href:"#"},c(e.$t("All")),3)]),l("li",null,[l("a",{onClick:t[4]||(t[4]=q(C=>i.switchType("unread"),["prevent"])),class:D({"router-link-exact-active":o.status=="unread"}),href:"#"},c(e.$t("Unread")),3)]),l("li",null,[l("a",{onClick:t[5]||(t[5]=q(C=>i.switchType("mentioned"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="mentioned"}),href:"#"},c(e.$t("Mentions")),3)]),l("li",null,[l("a",{onClick:t[6]||(t[6]=q(C=>i.switchType("following"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="following"}),href:"#"},c(e.$t("Following")),3)])])]),l("div",JV,[o.notifications.length?Y((n(),r("div",XV,[a(h,{notifications:o.notifications},null,8,["notifications"]),l("div",eM,[a(p,{hide_on_single:!0,onFetch:t[7]||(t[7]=C=>i.fetch()),pagination:o.pagination},null,8,["pagination"])])])),[[w,o.loading]]):o.loading?(n(),r("div",sM,[a(k,{animated:!0,rows:5})])):(n(),r("div",tM,[l("p",null,c(e.$t("No notifications found")),1)]))])]),_:1},8,["title"])]),_:1})}const iM=I(KV,[["render",oM]]),nM={name:"Bookmarks",components:{Feeds:pt,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"))}},lM={style:{"margin-bottom":"16px"}},aM={class:"search_member"},rM={key:1};function dM(e,t,s,u,o,i){const m=g("Search"),f=j,h=oe,p=g("feeds"),k=g("layout"),b=g("app-layout");return n(),y(b,{wrapper_class:"fcom_single_layout fcom_compact_layout"},{default:d(()=>[a(k,{wrapper_class:"no_bg_layout",title:e.$t("Your Bookmarks")},{default:d(()=>[l("h4",lM,c(e.$t("Your saved posts")),1),l("div",aM,[a(h,{clearable:"",onClear:i.handleSearch,onKeydown:te(i.handleSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[0]||(t[0]=$=>o.search=$),placeholder:e.$t("Search Posts...")},{prefix:d(()=>[a(f,null,{default:d(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),e.appVars.auth.user_id?(n(),y(p,{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(),r("div",rM,[l("p",null,c(e.$t("Please login to view your bookmarks")),1)]))]),_:1},8,["title"])]),_:1})}const cM=I(nM,[["render",dM]]);const uM={name:"AllCourses",components:{AppLayout:Se,Layout:we,GroupIcon:Dt,Pagination:$e,Search:Fe},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)}},_M={class:"object_menu"},mM={class:"fcom_space_menu_ul"},hM={key:0},fM={key:1},pM={key:0,class:"fcom_space_topics"},gM={class:"fcom_topics_filters"},yM={class:"search_member"},vM={class:"feed_filters"},bM={id:"feed_short_by",class:"fcom_feed_filter_label"},kM={class:"fcom_courses"},wM={key:0,class:"fcom_no_items_wrap"},CM={key:2},$M=["href"],SM={class:"fcom_box_card_list"},VM=["onClick"],MM=["src","onError"],LM={key:1,class:"fcom_no_image"},TM={class:"fcom_box_card_info"},FM={class:"fcom_box_card_name"},IM={class:"fcom_box_card_details"},PM={class:"inline_details"},EM={key:0,class:"inline_details"},AM={key:0,class:"fcom_box_card_description"},UM=["innerHTML"],BM={class:"fcom_box_card_action"},DM=["onClick"],RM=["onClick"];function xM(e,t,s,u,o,i){const m=O,f=Pe,h=g("Search"),p=j,k=oe,b=le,$=ae,w=De,C=g("router-link"),v=g("GroupIcon"),S=g("pagination"),T=g("layout"),V=g("app-layout"),P=se("loading");return n(),y(V,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:d(()=>[a(T,{wrapper_class:"no_bg_layout",title:e.$t("Courses")+" "+(o.pagination.total?" ("+e.$formatNumber(o.pagination.total)+")":"")},{actions:d(()=>[l("div",_M,[l("ul",mM,[l("li",null,[l("a",{onClick:t[0]||(t[0]=q(L=>i.SwitchToCourseView("all"),["prevent"])),class:D(o.type=="all"?"router-link-active router-link-exact-active":""),href:"#"},c(e.$t("All Courses")),3)]),e.auth.user_id?(n(),r("li",hM,[l("a",{onClick:t[1]||(t[1]=q(L=>i.SwitchToCourseView("enrolled"),["prevent"])),class:D(o.type=="enrolled"?"router-link-active router-link-exact-active":""),href:"#"},c(e.$t("My Courses")),3)])):_("",!0),e.hasCourseCreatorAccess()?(n(),r("li",fM,[a(m,{onClick:t[2]||(t[2]=L=>i.emitCreateCourse()),class:"fcom_primary_button"},{default:d(()=>[M(c(e.$t("New Course")),1)]),_:1})])):_("",!0)])])]),default:d(()=>[o.courseCategories&&o.courseCategories.length?(n(),r("div",pM,[a(f,null,{default:d(()=>[l("div",gM,[a(m,{onClick:t[3]||(t[3]=L=>i.setTopic("")),class:D({fcom_active_topic:!o.topic_slug})},{default:d(()=>[M(c(e.$t("All")),1)]),_:1},8,["class"]),(n(!0),r(F,null,R(o.courseCategories,L=>(n(),y(m,{key:L.slug,onClick:x=>i.setTopic(L.slug),class:D({fcom_active_topic:L.slug==o.topic_slug})},{default:d(()=>[M(c(L.title),1)]),_:2},1032,["onClick","class"]))),128))])]),_:1})])):_("",!0),l("div",yM,[a(k,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[4]||(t[4]=L=>o.search=L),placeholder:e.$t("Search Courses...")},{prefix:d(()=>[a(p,null,{default:d(()=>[a(h)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",vM,[t[9]||(t[9]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",bM,c(e.$t("Sort by:")),1),a($,{"aria-label":e.$t("Sort Courses by"),modelValue:o.sort_by,"onUpdate:modelValue":t[5]||(t[5]=L=>o.sort_by=L),class:"fcom_minimal_select space_sort_select","popper-class":"plain_select",onChange:t[6]||(t[6]=L=>i.changeSortBy())},{default:d(()=>[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"])]),Y((n(),r("div",kM,[!o.loading&&!o.courses.length?(n(),r("div",wM,[o.topic_slug?(n(),r(F,{key:0},[l("h3",null,c(e.$t("No courses found in this topic")),1),l("p",null,c(e.$t("No courses found based on your search criteria")),1)],64)):o.type=="all"?(n(),r(F,{key:1},[o.search?(n(),r(F,{key:0},[l("h3",null,c(e.$t("No courses found based on your search criteria")),1),l("p",null,c(e.$t("No courses match your search criteria. Try adjusting your search terms or browse our course catalog.")),1)],64)):e.isAdmin()?(n(),r(F,{key:1},[l("h3",null,c(e.$t("Create your first course")),1),l("p",null,c(e.$t("Deliver engaging & high-performance learning experiences in your community.")),1),a(m,{onClick:t[7]||(t[7]=L=>i.emitCreateCourse()),class:"fcom_primary_button fcom_mt_10"},{default:d(()=>[M(c(e.$t("Create a Course")),1)]),_:1})],64)):(n(),r("div",CM,[l("h3",null,c(e.$t("No published courses found")),1),l("p",null,c(e.$t("Please check back later. We are in a process to publish some courses for you!")),1)]))],64)):(n(),r(F,{key:2},[o.search?(n(),r(F,{key:0},[l("h3",null,c(e.$t("No courses found based on your search criteria")),1),l("p",null,c(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(),r(F,{key:2},[l("h3",null,c(e.$t("Your enrolled courses will be shown here")),1),l("p",null,c(e.$t("Once you enroll some courses, those will be shown here")),1),l("a",{onClick:t[8]||(t[8]=q(L=>i.SwitchToCourseView("all"),["prevent"])),class:"el-button fcom_primary_button fcom_mt_10",href:"#"},c(e.$t("View all courses")),1)],64)):(n(),r(F,{key:1},[l("h3",null,c(e.$t("Login to see your courses")),1),l("p",null,c(e.$t("Once you login, your enrolled courses will be shown here.")),1),l("a",{href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button"},c(e.$t("Login")),9,$M)],64))],64))])):_("",!0),l("div",SM,[(n(!0),r(F,null,R(o.courses,L=>(n(),r("div",{key:L.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:x=>e.$router.push({name:"view_course",params:{course_slug:L.slug}})},[L.cover_photo&&!L.coverError?(n(),r("img",{key:0,src:L.cover_photo,alt:"",onError:x=>L.coverError=!0},null,40,MM)):(n(),r("div",LM))],8,VM),l("div",TM,[l("div",FM,[a(C,{class:"course_route",to:{name:"view_course",params:{course_slug:L.slug}}},{default:d(()=>[M(c(L.title)+" ",1),L.status=="draft"?(n(),y(w,{key:0,type:"info"},{default:d(()=>[M(c(L.status),1)]),_:2},1024)):_("",!0)]),_:2},1032,["to"])]),l("div",IM,[l("div",PM,[l("span",null,c(e.$_n("%d Section","%d Sections",L.sectionsCount)),1),t[10]||(t[10]=l("span",{class:"fcom_inline_separator"},null,-1)),l("span",null,c(e.$_n("%d Lesson","%d Lessons",L.lessonsCount)),1)]),L.studentsCount?(n(),r("div",EM,[a(p,null,{default:d(()=>[a(v)]),_:1}),M(" "+c(e.$_n("%s student","%s students",e.$formatNumber(L.studentsCount))),1)])):_("",!0)]),L.description?(n(),r("div",AM,c(i.getExcerpt(L.description)),1)):_("",!0),L.custom_html?(n(),r("div",{key:1,class:"fcom_box_card_custom_html",innerHTML:L.custom_html},null,8,UM)):_("",!0),l("div",BM,[L.isEnrolled?(n(),r("button",{key:0,class:D(["fcom_card_button",L.progress>=100?"fcom_card_button_success":"fcom_card_button_progress"]),onClick:x=>e.$router.push({name:"view_course",params:{course_slug:L.slug}})},c(e.$t("%s Completed",L.progress+"%")),11,DM)):(n(),r("button",{key:1,class:"fcom_card_button",onClick:x=>e.$router.push({name:"view_course",params:{course_slug:L.slug}})},c(e.$t("View Course")),9,RM))])])]))),128))]),a(S,{hide_on_single:!0,onFetch:i.fetchCourses,pagination:o.pagination},null,8,["onFetch","pagination"])])),[[P,o.loading]])]),_:1},8,["title"])]),_:1})}const OM=I(uM,[["render",xM],["__scopeId","data-v-6ac627c3"]]),HM={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:"

"+this.$t("Sorry, the lesson content could not be loaded.")+"

"})})}},created(){this.fetchCourse()}},jM={key:0},NM={style:{padding:"20px"},class:"fcom_course_sections fcom_white_loaded"},zM={key:1},qM={key:2,style:{padding:"1rem 2rem"}};function GM(e,t,s,u,o,i){const m=Xt,f=es,h=Q,p=g("layout"),k=g("app-layout"),b=g("router-view");return o.loading?(n(),r("div",jM,[a(k,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:d(()=>[a(p,{title:"...."},{title:d(()=>[a(f,{"separator-class":"el-icon-arrow-right"},{default:d(()=>[a(m,{to:{name:"courses"}},{default:d(()=>[M(c(e.$t("Courses")),1)]),_:1}),a(m,null,{default:d(()=>[...t[1]||(t[1]=[M("....",-1)])]),_:1})]),_:1})]),default:d(()=>[l("div",NM,[a(h,{rows:10,animated:!0})])]),_:1})]),_:1})])):o.course.id?(n(),r("div",zM,[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]=$=>{o.track=$})},null,8,["track","course","sections","lessonsCount","currentLesson","currentLessonIndex","onSetNextLesson","onSetPrevLesson","onGoToLesson","onReload"])])):(n(),r("div",qM,[l("h3",null,c(e.$t("Sorry, the course could not be loaded.")),1)]))}const YM=I(HM,[["render",GM]]),WM={name:"LockIcon",props:{fill:{type:String,default:"currentColor"}}},KM={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ZM(e,t,s,u,o,i){return n(),r("svg",KM,[...t[0]||(t[0]=[l("path",{d:"M10 13.7497V12.083",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),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),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)])])}const QM=I(WM,[["render",ZM]]),JM={name:"WelcomeBanner",components:{MediaPreview:xe},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}}},XM={key:0,class:"fcom_welcome_title"},eL=["innerHTML"],tL={key:2,class:"fcom_welcome_cta_buttons"},sL=["href","target"];function oL(e,t,s,u,o,i){const m=g("media-preview"),f=Ie,h=g("MoreFilled"),p=j,k=O,b=We,$=Ke,w=Ze;return i.effectiveConfig&&i.showBanner?(n(),r("div",{key:0,class:D(["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:D(s.contentClass)},[i.effectiveConfig.title?(n(),r("h2",XM,c(i.effectiveConfig.title),1)):_("",!0),i.effectiveConfig.description_rendered?(n(),r("div",{key:1,class:"fcom_welcome_sub",innerHTML:i.effectiveConfig.description_rendered},null,8,eL)):_("",!0),i.showCtaButtons?(n(),r("div",tL,[(n(!0),r(F,null,R(i.effectiveConfig.ctaButtons,C=>(n(),r(F,null,[C.link&&C.label?(n(),r("a",{key:0,href:C.link,target:C.newTab=="yes"?"_blank":"",class:D({"el-button fcom_primary_button":C.type=="primary","el-button fcom_secondary_button":C.type=="secondary","el-button is-text":C.type=="text","el-link fcom_link_button":C.type=="link"})},c(C.label),11,sL)):_("",!0)],64))),256))])):_("",!0)],2),i.isRemovable?(n(),y(w,{key:2,trigger:"click",class:"fcom_welcome_close"},{dropdown:d(()=>[a($,null,{default:d(()=>[a(b,{onClick:i.closeBanner},{default:d(()=>[M(c(e.$t("Hide Banner")),1)]),_:1},8,["onClick"])]),_:1})]),default:d(()=>[a(k,{"aria-label":e.$t("Hide Banner"),class:"fcom_dot_menu",size:"small",text:""},{default:d(()=>[a(p,null,{default:d(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),_:1})):_("",!0)],2)):_("",!0)}const gs=I(JM,[["render",oL]]),iL={name:"LockscreenView",components:{CustomLockscreenView:Io,DefaultLockscreenPaywall:Po,WelcomeBanner:gs},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)}},nL={key:0,style:{"text-align":"center",margin:"50px 0"}},lL={key:0,class:"space_default_lockscreen"},aL={class:"space_lock_box space_default_lock_box"},rL={key:0,class:"lock_desc"},dL={key:1,class:"lock_desc"},cL=["href"],uL={key:1,class:"space_lock_box"},_L={key:2,class:"space_lock_box"},mL=["href"];function hL(e,t,s,u,o,i){var b;const m=g("welcome-banner"),f=g("Lock"),h=j,p=g("default-lockscreen-paywall"),k=g("custom-lockscreen-view");return o.isRedirecting?(n(),r("h3",nL,c(e.$t("Please wait...")),1)):(n(),r(F,{key:1},[s.space_profile.lockscreen_config?(n(),r(F,{key:0},[s.space_profile.lockscreen_config.showCustom?(n(),y(k,{key:1,sections:s.sections,profile:s.space_profile},null,8,["sections","profile"])):(n(),r("div",lL,[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",aL,[a(h,null,{default:d(()=>[a(f)]),_:1}),l("h4",null,c(e.$t("This is a private course")),1),s.space_profile.lockscreen_config.showPaywalls?(n(),r("p",rL,c(e.$t("Purchase access below or log in if you are already a member.")),1)):(n(),r("p",dL,c(e.$t("Members have to be invited to this course.")),1)),e.auth.user_id?_("",!0):(n(),r("a",{key:2,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},c(e.$t("Login or Signup")),9,cL))]),s.space_profile.lockscreen_config.showPaywalls?(n(),y(p,{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(),r("div",uL,[a(h,null,{default:d(()=>[a(f)]),_:1}),l("h4",null,c(e.$t("Your request to join this course is pending")),1)])):e.auth.user_id?_("",!0):(n(),r("div",_L,[a(h,null,{default:d(()=>[a(f)]),_:1}),l("h4",null,c(e.$t("Please login/signup to enroll this course")),1),l("a",{href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},c(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,mL)]))],64))}const fL=I(iL,[["render",hL]]),pL={name:"CollapseIcon"},gL={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function yL(e,t,s,u,o,i){return n(),r("svg",gL,[...t[0]||(t[0]=[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)])])}const vL=I(pL,[["render",yL]]),bL={name:"ViewCourse",components:{VideoPlay:to,RenderSpaceLinks:fs,LockScreenView:fL,AppLayout:Se,Layout:we,CircleIcon:ps,LockIcon:QM,SocialLinks:Pt,PlayIcon:Lo,LessonIcon:Mo,PlayPlaceholderIcon:To,CollapseIcon:vL,WelcomeBanner:gs,ActionPopover:et},props:["course","sections","track","lessonsCount"],$emit:["setNextLesson","goToLesson","reload"],data(){return{enrolling:!1,restarting:!1}},computed:{courseActions(){return[{label:this.$t("Restart Course"),disabled:!this.track.progress||this.restarting,action:this.restartCourse}]},hasEnabledCourseLinks(){var t,s;return(((s=(t=this.course)==null?void 0:t.settings)==null?void 0:s.links)||[]).some(u=>u.enabled!=="no")},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")},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()}},kL=["href"],wL={class:"fcom_course_actions"},CL=["href"],$L={key:0,class:"fcom_sub_header"},SL={key:0,class:"fcom_notice"},VL={class:"fcom_feed_box course_box"},ML={class:"fcom_course_sections"},LL={class:"fcom_course_intro"},TL={class:"fcom_course_labels"},FL={class:"fcom_course_info"},IL=["innerHTML"],PL={class:"fcom_card_sections"},EL={class:"fcom_section_items"},AL=["onClick"],UL={class:"fcom_section_primary_item_title"},BL={class:"title_line_container"},DL={class:"title_line"},RL={key:0,class:"section_lock_badge"},xL={class:"fcom_meta_text"},OL={key:0,class:"fcom_meta_text"},HL={class:"fcom_section_primary_item_actions"},jL=["onClick"],NL={class:"fcom_heading_item clickable"},zL={class:"lesson_feature_media"},qL=["src","alt"],GL=["src","alt"],YL={class:"lesson_title"},WL=["innerHTML"],KL={class:"lesson_duration"},ZL={key:0},QL={key:1},JL=["innerHTML"],XL={key:0,class:"fcom_section_item_actions"},eT={class:"fcom_meta_text"},tT={class:"fcom_main_side_wrap"},sT={class:"fcom_side_box"},oT={key:0,class:"app_side_widget course_widget"},iT={class:"widget_header"},nT={class:"widget_body"},lT={class:"progress_label"},aT={key:0,style:{margin:"20px 0"}},rT={key:1,class:"app_side_widget course_widget"},dT={class:"widget_header"},cT={class:"widget_body"},uT={class:"creator_details"},_T={class:"creator_details_item"},mT={class:"creator_details_info"},hT={class:"info_text"},fT={class:"details_name"},pT={class:"details_meta"},gT={class:"fcom_meta_text"},yT={key:0,class:"fcom_meta_text"},vT=["innerHTML"],bT={key:2};function kT(e,t,s,u,o,i){const m=Xt,f=es,h=O,p=g("action-popover"),k=g("render-space-links"),b=g("welcome-banner"),$=g("CollapseIcon"),w=g("Lock"),C=j,v=g("ArrowRight"),S=g("ArrowDown"),T=g("SuccessFilled"),V=g("LockIcon"),P=g("CircleIcon"),L=g("PlayPlaceholderIcon"),x=g("LessonIcon"),A=g("PlayIcon"),U=g("VideoPlay"),B=ut,N=wt,H=g("UserAvatar"),z=g("UserRouteLink"),G=g("SocialLinks"),ne=_t,E=mt,J=g("LockScreenView"),ce=g("layout"),X=g("app-layout"),Ve=se("loading");return n(),y(X,{wrapper_class:"fcom_single_layout fcom_max_layout fcom_course_view_layout"},{default:d(()=>[a(ce,{wrapper_class:["no_bg_layout",{custom_lockscreen:!i.showCourseSections}],title:e.$t("Courses")},{title:d(()=>[a(f,{"separator-class":"el-icon-arrow-right"},{default:d(()=>[a(m,{to:{name:"courses"}},{default:d(()=>[M(c(e.$t("Courses")),1)]),_:1}),a(m,null,{default:d(()=>[M(c(s.course.title)+" ",1),s.course.is_course_admin?(n(),r("a",{key:0,class:"fcom_edit_course fcom_secondary_button",style:{cursor:"pointer"},href:i.editLessonLink()},c(e.$t("Edit Lessons")),9,kL)):_("",!0)]),_:1})]),_:1})]),actions:d(()=>[l("div",wL,[e.auth.user_id?!s.track.isEnrolled&&s.course.id&&s.course.can_self_enroll?Y((n(),y(h,{key:1,disabled:o.enrolling,onClick:i.enroll,class:"fcom_primary_button"},{default:d(()=>[M(c(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[Ve,o.enrolling]]):s.track.isEnrolled?(n(),r(F,{key:2},[s.track.progress!=100?(n(),y(h,{key:0,class:"fcom_primary_button",onClick:i.continueCourse},{default:d(()=>[M(c(e.$t("Continue Course")),1)]),_:1},8,["onClick"])):_("",!0),a(p,{items:i.courseActions,placement:"bottom-end",teleported:!0},null,8,["items"])],64)):_("",!0):(n(),r(F,{key:0},[i.isCustomLockScreen?_("",!0):(n(),r("a",{key:0,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},c(e.$t("Login to enroll this course")),9,CL))],64))])]),sub_header:d(()=>[s.course&&i.showCourseSections&&i.hasEnabledCourseLinks?(n(),r("div",$L,[a(k,{links:s.course.settings.links},null,8,["links"])])):_("",!0)]),default:d(()=>[s.course.status==="draft"?(n(),r("div",SL,[l("p",null,c(e.$t("This course is in Draft status and only visible to Admin / Moderators")),1)])):_("",!0),i.showCourseSections?(n(),y(E,{key:1,class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:d(()=>[a(B,{class:"fcom_main"},{default:d(()=>{var ee;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",VL,[l("div",ML,[l("div",LL,[l("div",TL,[l("h3",null,c(s.course.title),1),l("p",FL,[M(c(e.$_n("%s Topic","%s Topics",i.sectionsCount))+" ",1),t[0]||(t[0]=l("span",null," โ€ข ",-1)),M(" "+c(e.$_n("%s Lesson","%s Lessons",s.lessonsCount)),1)])])]),(ee=s.course.settings)!=null&&ee.course_details_rendered?(n(),r("div",{key:0,class:"fcom_course_details feed_md_content",innerHTML:s.course.settings.course_details_rendered},null,8,IL)):_("",!0),l("div",{class:D(["course_contents_header",{is_collapsed:i.isCollapsed}])},[l("h4",null,c(e.$t("Course Contents")),1),i.sectionsCount>1?(n(),y($,{key:0,class:"collapse_icon clickable",onClick:i.toggleAllSections},null,8,["onClick"])):_("",!0)],2),l("div",PL,[l("div",EL,[(n(!0),r(F,null,R(s.sections,Z=>(n(),r("div",{key:Z.id,class:"fcom_section_primary"},[l("div",{onClick:ie=>Z.is_closed=!Z.is_closed,class:D(["clickable fcom_section_primary_item",{is_closed:Z.is_closed}])},[l("div",UL,[l("div",BL,[l("div",DL,[l("h4",null,c(Z.title),1),Z.unlock_date?(n(),r("span",RL,[Z.is_locked?(n(),y(C,{key:0},{default:d(()=>[a(w)]),_:1})):_("",!0),l("span",null," ("+c(e.$t("will unlock at %s",e.smartDate(Z.unlock_date,!0,!0)))+") ",1)])):_("",!0)]),l("span",xL,c(e.$_n("%s lesson","%s lessons",Z.lessons.length)),1),i.lessonDuration(Z)?(n(),r("span",OL," โ€ข "+c(i.lessonDuration(Z)),1)):_("",!0)])]),l("div",HL,[a(C,null,{default:d(()=>[Z.is_closed?(n(),y(v,{key:0,class:"fcom_arrow_icon"})):(n(),y(S,{key:1}))]),_:2},1024)])],10,AL),Z.is_closed?_("",!0):(n(!0),r(F,{key:0},R(Z.lessons,ie=>(n(),r("div",{key:ie.id,class:D(["fcom_section_item",{is_locked:i.isLockLesson(Z,ie)}])},[l("div",{onClick:yt=>i.maybeGotoLesson(ie,s.track,Z),class:"fcom_section_item_title"},[l("p",NL,[s.track.completed_lessons.includes(ie.id.toString())?(n(),y(C,{key:0,style:{color:"#008a2e"}},{default:d(()=>[a(T)]),_:1})):i.isLockLesson(Z,ie)?(n(),y(C,{key:1},{default:d(()=>[a(V)]),_:1})):(n(),y(C,{key:2},{default:d(()=>[a(P)]),_:1})),i.isModernLayout?(n(),r(F,{key:3},[l("span",zL,[ie.featured_image?(n(),r("img",{key:0,src:ie.featured_image,alt:ie.title},null,8,qL)):i.hasMediaImage(ie)?(n(),r("img",{key:1,src:ie.meta.media.image,alt:ie.title},null,8,GL)):i.hasMediaVideo(ie)?(n(),y(L,{key:2})):(n(),y(x,{key:3})),i.showPlayIcon(ie)?(n(),y(A,{key:4,class:"play_icon"})):_("",!0)]),l("span",YL,[l("span",{innerHTML:ie.title},null,8,WL),l("span",KL,[ie.meta.video_length?(n(),r("span",ZL,c(i.formatSeconds(ie.meta.video_length)),1)):(n(),r("span",QL,c("---")))])])],64)):(n(),r("span",{key:4,innerHTML:ie.title},null,8,JL))])],8,jL),!i.isModernLayout&&ie.meta.enable_media=="yes"&&ie.meta.video_length?(n(),r("div",XL,[l("span",eT,[ie.meta.video_length?(n(),y(h,{key:0,onClick:yt=>i.maybeGotoLesson(ie,s.track,Z),text:""},{default:d(()=>[a(C,{class:"fcom_play_btn_icon"},{default:d(()=>[a(U)]),_:1}),l("span",null,c(i.formatSeconds(ie.meta.video_length)),1)]),_:2},1032,["onClick"])):_("",!0)])])):_("",!0)],2))),128))]))),128))])])])])]}),_:1}),i.showSidebar?(n(),y(ne,{key:0,class:"fcom_resp_side",width:"306px"},{default:d(()=>[l("div",tT,[l("div",sT,[s.track.isEnrolled?(n(),r("div",oT,[l("div",iT,[l("h3",null,c(e.$t("Course progress")),1)]),l("div",nT,[l("div",lT,[l("p",null,c(e.$t("Completed %1$s of %2$s",s.track.completed_lessons.length,s.lessonsCount)),1),l("span",null,c(parseInt(s.track.progress))+"%",1)]),a(N,{class:"fcom_progress","stroke-width":10,percentage:parseInt(s.track.progress),"show-text":!1},null,8,["percentage"]),s.track.progress==100?(n(),r("div",aT,[l("h5",null,c(e.$t("Congratulations! Course completed! ๐ŸŽ‰")),1)])):_("",!0)])])):_("",!0),s.course.creator?(n(),r("div",rT,[l("div",dT,[l("h3",null,c(e.$t("Course Instructor")),1)]),l("div",cT,[l("div",uT,[l("div",_T,[l("div",mT,[a(H,{with_level:!1,xprofile:s.course.creator},null,8,["xprofile"]),l("div",hT,[l("div",fT,[a(z,{show_badge:!0,xprofile:s.course.creator},null,8,["xprofile"])]),l("div",pT,[l("span",gT,c(e.$_n("%d Course","%d Courses",s.course.creator.total_courses)),1),s.course.creator.total_students?(n(),r("span",yT," โ€ข "+c(e.$_n("%d Student","%d Students",s.course.creator.total_students)),1)):_("",!0)])])]),s.course.creator.short_description_rendered?(n(),r("div",{key:0,class:"creator_details_description feed_md_content",innerHTML:s.course.creator.short_description_rendered},null,8,vT)):_("",!0)]),a(G,{xprofile:s.course.creator},null,8,["xprofile"])])])])):_("",!0)])])]),_:1})):_("",!0)]),_:1})):_("",!0),i.showCourseSections?_("",!0):(n(),r("div",bT,[a(J,{space_profile:s.course,sections:s.sections},null,8,["space_profile","sections"])]))]),_:1},8,["wrapper_class","title"])]),_:1})}const wT=I(bL,[["render",kT]]),CT={name:"CommentBox",mixins:[It],components:{FeedComments:po,FeedTextComposer:ht},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"),o.comment.status==="published"&&(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)}},$T=["id"],ST={key:0,class:"feed_commenting"},VT={class:"person_avatar"},MT=["src"],LT={key:0,class:"feed_comment_input"},TT={key:1,class:""},FT={style:{padding:"0",margin:"0","text-align":"center"}},IT={key:0,class:"fcom_comment_sorting"};function PT(e,t,s,u,o,i){const m=O,f=g("feed-text-composer"),h=g("router-link"),p=le,k=ae,b=g("feed-comments");return n(),r("div",{class:D(["fcom_comment_box","fcom_comment_box_"+s.feed.type])},[K(e.$slots,"before_comment_box"),(o.commenting||s.is_single)&&s.show_comment_form?(n(),r("div",{key:0,id:"feed_comment_form_"+s.feed.id,class:"feed_comment"},[!s.checkPermission||e.hasCommentPermission(s.feed)?(n(),r(F,{key:0},[o.comment?(n(),r("div",ST,[l("div",VT,[l("img",{alt:"",src:e.auth.avatar},null,8,MT)]),o.showCommentBox?(n(),r("div",LT,[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:d(()=>[a(m,{loading:o.saving,disabled:o.saving,class:"fcom_primary_button",size:"small",onClick:t[0]||(t[0]=$=>i.postComment())},{default:d(()=>[M(c(e.$t("Post Comment")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["mentionQuery","autofocus_changed","autofocus","disabled","placeholder","content"])])):_("",!0)])):_("",!0)],64)):(n(),r("div",TT,[l("p",FT,[M(c(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:d(()=>[M(c(e.$t("Go to community")),1)]),_:1},8,["to"])):_("",!0)])]))],8,$T)):_("",!0),a(b,{sortBy:o.sortBy,checkPermission:s.checkPermission,onForceShowAll:i.showAllComments,show_all:o.show_all_comments,feed:s.feed},{before_comments_start:d(()=>[s.feed.comments_count>=2?(n(),r("div",IT,[a(k,{"aria-label":e.$t("Sort comments by"),onChange:t[1]||(t[1]=$=>i.changeCommentsSortBy()),modelValue:o.sortBy,"onUpdate:modelValue":t[2]||(t[2]=$=>o.sortBy=$),class:"fcom_off_color fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Sort by")},{default:d(()=>[a(p,{value:"oldest",label:e.$t("Earliest")},null,8,["label"]),a(p,{value:"latest",label:e.$t("Latest")},null,8,["label"]),a(p,{value:"popular",label:e.$t("Popular")},null,8,["label"]),a(p,{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"]),K(e.$slots,"after_comment_box")],2)}const ET=I(CT,[["render",PT]]),AT={name:"ExitFullScreen"},UT={viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"};function BT(e,t,s,u,o,i){return n(),r("svg",UT,[...t[0]||(t[0]=[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)])])}const DT=I(AT,[["render",BT]]),RT={name:"LightBulbIcon"},xT={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 64 64",fill:"none"};function OT(e,t,s,u,o,i){return n(),r("svg",xT,[...t[0]||(t[0]=[Le('',7)])])}const HT=I(RT,[["render",OT]]);let jT=0;const NT={name:"BlankAnswer",props:{segments:{type:Array,default:()=>[]},modelValue:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1}},emits:["update:modelValue"],data(){return{sentenceId:"fcom_blank_sentence_"+ ++jT}},computed:{blankCount(){return Math.max(this.segments.length-1,0)},sentenceText(){return this.segments.map((e,t)=>t(n(),r(F,{key:h},[l("span",GT,c(f),1),hi.updateBlank(h,p)},null,8,["model-value","aria-label","aria-describedby","onUpdate:modelValue"]))],64)):_("",!0)],64))),128))])}const KT=I(NT,[["render",WT]]);const ZT={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},handle:{type:String,default:""}},emits:["drop","crossDrop","drag-start"],data(){return{draggingIndex:null,startIndex:null,snapshotBeforeDrag:null,handleIndex:null,liveMessage:""}},computed:{keyboardEnabled(){return this.keyboard&&this.draggable}},methods:{isItemDraggable(e){return this.draggable?this.handle?this.handleIndex===e:!0:!1},onItemMouseDown(e,t){var s,u;!this.handle||!this.draggable||(this.handleIndex=(u=(s=e.target)==null?void 0:s.closest)!=null&&u.call(s,this.handle)?t:null)},releaseHandle(){this.handleIndex=null},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.liveMessage="",this.$nextTick(()=>{var i;(i=this.$el.querySelectorAll(":scope > .drag-group > .drag-item")[u])==null||i.focus(),this.liveMessage=this.$t("Moved to position %1$s of %2$s",u+1,this.items.length)}))},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.handleIndex=null,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.draggingIndexi||this.draggingIndex>t&&mi.onContainerDragOver&&i.onContainerDragOver(...m),["prevent"])),onDrop:t[3]||(t[3]=q((...m)=>i.onContainerDrop&&i.onContainerDrop(...m),["prevent"]))},[a(No,{name:"flip-list",tag:"div",class:"drag-group",style:ue(s.gap?{display:"flex",flexDirection:"column",gap:s.gap}:{})},{default:d(()=>[(n(!0),r(F,null,R(s.items,(m,f)=>(n(),r("div",{key:m[s.rowKey],onDragstart:h=>i.dragStart(h,f),onDragend:t[0]||(t[0]=(...h)=>i.dragEnd&&i.dragEnd(...h)),onDragover:q(h=>i.dragOver(h,f),["prevent"]),onDrop:q(h=>i.dropEnd(h,f),["prevent"]),onKeydown:h=>i.onItemKeydown(h,f),onMousedown:h=>i.onItemMouseDown(h,f),onMouseup:t[1]||(t[1]=(...h)=>i.releaseHandle&&i.releaseHandle(...h)),draggable:i.isItemDraggable(f),tabindex:i.keyboardEnabled?0:null,"aria-label":i.keyboardEnabled?i.itemAriaLabel(m,f):null,class:D(["drag-item",s.itemClass,{dragging:o.draggingIndex===f}]),style:ue(s.itemStyle)},[K(e.$slots,"item",{data:m,index:f},void 0,!0)],46,QT))),128))]),_:3},8,["style"]),i.keyboardEnabled?(n(),r("span",JT,c(o.liveMessage),1)):_("",!0)],32)}const eF=I(ZT,[["render",XT],["__scopeId","data-v-7267c3a1"]]),tF={name:"OrderingAnswer",components:{FluentDnD:eF},props:{modelValue:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1}},emits:["update:modelValue"],data(){return{items:this.toItems(this.modelValue)}},watch:{modelValue(e){JSON.stringify(e)!==JSON.stringify(this.items.map(t=>t.label))&&(this.items=this.toItems(e))}},methods:{toItems(e){return e.map((t,s)=>({label:t,_key:s}))},itemLabel(e,t){return this.$t("%1$s, position %2$s. Use the up and down arrow keys to reorder.",e.label,t+1)},emitOrder(){this.$emit("update:modelValue",this.items.map(e=>e.label))}}},sF={key:0,class:"fcom_ordering_answer is_readonly"},oF={key:1,class:"fcom_ordering_answer"},iF={class:"fcom_help_text"},nF={class:"fcom_ordering_item"},lF={class:"fcom_order_number"};function aF(e,t,s,u,o,i){const m=g("FluentDnD");return s.readonly?(n(),r("ol",sF,[(n(!0),r(F,null,R(s.modelValue,(f,h)=>(n(),r("li",{key:h},c(f),1))),128))])):(n(),r("div",oF,[l("p",iF,c(e.$t("Drag the items, or focus one and use the arrow keys, to put them in the right order.")),1),a(m,{items:o.items,"row-key":"_key","item-label":i.itemLabel,onDrop:i.emitOrder},{item:d(({data:f,index:h})=>[l("div",nF,[t[0]||(t[0]=l("span",{class:"fcom_drag_handle","aria-hidden":"true"},"โ‹ฎโ‹ฎ",-1)),l("span",lF,c(h+1),1),l("span",null,c(f.label),1)])]),_:1},8,["items","item-label","onDrop"])]))}const rF=I(tF,[["render",aF]]),dF={name:"PairsAnswer",props:{options:{type:Array,default:()=>[]},choices:{type:Array,default:()=>[]},modelValue:{type:Array,default:()=>[]},withImages:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1}},emits:["update:modelValue"],methods:{matchLabel(e,t){return this.withImages?this.$t("Label for image %s",t+1):this.$t("Match for %s",e.label)},updateMatch(e,t){const s=[...this.modelValue];s[e]=t,this.$emit("update:modelValue",s)}}},cF={key:1,class:"fcom_pair_prompt"},uF={key:2,class:"fcom_pair_value"};function _F(e,t,s,u,o,i){const m=Ie,f=le,h=ae;return n(),r("div",{class:D(["fcom_pairs_answer",{with_images:s.withImages}])},[(n(!0),r(F,null,R(s.options,(p,k)=>(n(),r("div",{key:k,class:"fcom_pairs_answer_row"},[s.withImages?(n(),y(m,{key:0,class:"fcom_pair_image",src:p.image_url,alt:e.$t("Image %s",k+1),fit:"cover"},null,8,["src","alt"])):(n(),r("span",cF,c(p.label),1)),s.readonly?(n(),r("span",uF,c(s.modelValue[k]||"-"),1)):(n(),y(h,{key:3,class:"fcom_pair_select","model-value":s.modelValue[k]||"",placeholder:e.$t("Choose a match"),"aria-label":i.matchLabel(p,k),"onUpdate:modelValue":b=>i.updateMatch(k,b)},{default:d(()=>[(n(!0),r(F,null,R(s.choices,b=>(n(),y(f,{key:b,label:b,value:b},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","aria-label","onUpdate:modelValue"]))]))),128))],2)}const mF=I(dF,[["render",_F]]),hF={name:"TypedAnswer",components:{BlankAnswer:KT,OrderingAnswer:rF,PairsAnswer:mF},props:{question:{type:Object,required:!0},modelValue:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1}},emits:["update:modelValue"]};function fF(e,t,s,u,o,i){const m=g("BlankAnswer"),f=g("OrderingAnswer"),h=g("PairsAnswer");return s.question.type==="fill_in_the_blank"?(n(),y(m,{key:0,segments:s.question.blank_segments||[],"model-value":s.modelValue,readonly:s.readonly,"onUpdate:modelValue":t[0]||(t[0]=p=>e.$emit("update:modelValue",p))},null,8,["segments","model-value","readonly"])):s.question.type==="ordering"?(n(),y(f,{key:1,"model-value":s.modelValue,readonly:s.readonly,"onUpdate:modelValue":t[1]||(t[1]=p=>e.$emit("update:modelValue",p))},null,8,["model-value","readonly"])):s.question.type==="matching"||s.question.type==="image_matching"?(n(),y(h,{key:2,options:s.question.options||[],choices:s.question.match_choices||[],"with-images":s.question.type==="image_matching","model-value":s.modelValue,readonly:s.readonly,"onUpdate:modelValue":t[2]||(t[2]=p=>e.$emit("update:modelValue",p))},null,8,["options","choices","with-images","model-value","readonly"])):_("",!0)}const pF=I(hF,[["render",fF]]),gF=["fill_in_the_blank","ordering","matching","image_matching"];function yF(e,t,s){return e.type!=="true_false"?t.label:t.label==="True"?s("True"):t.label==="False"?s("False"):t.label}const vF={name:"QuizView",props:{lesson:{type:Object,required:!0},isEnrolled:{type:Boolean,required:!0},questions:{type:Array,required:!0}},components:{Check:Xs,FeedMdContent:ft,LightBulbIcon:HT,TypedAnswer:pF},data(){return{userResult:{},answers:this.initAnswers(),shuffledOptions:this.buildShuffledOptions(),shuffledQuestions:this.buildShuffledQuestions(),isNew:!1,submitting:!1,loading:!1,openExplanations:{},currentIndex:0}},computed:{alreadyAttempted(){var e;return(e=this.userResult)==null?void 0:e.id},isAllAnswersSelected(){return this.questions.every(e=>this.isQuestionAnswered(e))},isPaged(){return this.quizSettings.layout==="one_by_one"&&this.isAnswering},currentQuestion(){return this.displayQuestions[this.currentIndex]},isLastQuestion(){return this.currentIndex>=this.displayQuestions.length-1},progressPercentage(){return Math.round((this.currentIndex+1)/this.displayQuestions.length*100)},quizSettings(){return this.lesson.meta},isAnswering(){return!this.alreadyAttempted||this.isNew},displayQuestions(){return this.isAnswering?this.shuffledQuestions:this.questions},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:{buildShuffledOptions(){var t;const e=((t=this.lesson.meta)==null?void 0:t.shuffle_options)==="yes";return this.questions.reduce((s,u)=>(s[u.slug]=e&&!this.isTypedAnswer(u)?jt.shuffle(u.options||[]):u.options,s),{})},buildShuffledQuestions(){var e;return((e=this.lesson.meta)==null?void 0:e.shuffle_questions)==="yes"?jt.shuffle(this.questions):this.questions},displayOptions(e){return this.isAnswering?this.shuffledOptions[e.slug]:e.options},initAnswers(){return this.questions.reduce((e,t)=>(this.isSingleChoice(t)?e[t.slug]=null:t.type=="written_answer"?e[t.slug]="":t.type==="ordering"?e[t.slug]=(t.options||[]).map(s=>s.label):t.type==="fill_in_the_blank"?e[t.slug]=Array((t.blank_segments||[]).length?t.blank_segments.length-1:0).fill(""):this.isTypedAnswer(t)?e[t.slug]=Array((t.options||[]).length).fill(""):e[t.slug]=[],e),{})},syncAnswers(){var t;const e=((t=this.userResult)==null?void 0:t.message)||[];this.answers=this.initAnswers(),e&&jt.each(e,(s,u)=>{this.answers[u]=s.user_answer})},retakeQuiz(){this.answers=this.initAnswers(),this.shuffledOptions=this.buildShuffledOptions(),this.shuffledQuestions=this.buildShuffledQuestions(),this.userResult={},this.submitting=!1,this.loading=!1,this.isNew=!0,this.openExplanations={},this.currentIndex=0},isQuestionAnswered(e){const t=this.answers[e.slug];if(this.isSingleChoice(e))return t!==null;if(this.isWrittenAnswer(e))return!!t&&t.trim()!=="";if(this.isTypedAnswer(e)){const s=e.type==="fill_in_the_blank"?Math.max((e.blank_segments||[]).length-1,0):(e.options||[]).length,u=t||[];return u.length===s&&u.every(o=>typeof o=="string"&&o.trim()!=="")}return!!t&&t.length>0},goToQuestion(e){this.currentIndex=e,this.$nextTick(()=>{var t,s;(s=(t=this.$refs.pagedQuestion)==null?void 0:t[0])==null||s.focus()})},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"||e.type==="true_false"},isTypedAnswer(e){return gF.includes(e.type)},optionLabel(e,t){return yF(e,t,this.$t)},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},questionExplanation(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.explanation_rendered)||e.explanation_rendered||""},toggleExplanation(e){this.openExplanations={...this.openExplanations,[e]:!this.openExplanations[e]}},isExplanationOpen(e){return!!this.openExplanations[e]},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()}},bF={key:0,class:"fcom_questions_wrap"},kF={key:0,class:"fcom_quiz_result"},wF={class:"result_status"},CF={key:0,class:"result_status_text"},$F={key:0},SF={key:1},VF={class:"result_score"},MF={class:"score_part"},LF={class:"part_label"},TF={class:"part_value"},FF={class:"score_part"},IF={class:"part_label"},PF={class:"part_value"},EF={key:1,class:"fcom_quiz_progress"},AF={class:"fcom_quiz_progress_label","aria-live":"polite"},UF=["tabindex"],BF={key:0,class:"fcom_question_image"},DF={class:"fcom_question_header"},RF=["innerHTML"],xF={class:"fcom_question_body"},OF={key:0,class:"correct_text"},HF={key:1,class:"correct_text"},jF={class:"fcom_written_answer_answer"},NF={key:1,class:"fcom_user_answer_text"},zF={key:0,class:"correct_text"},qF={key:1,class:"correct_text"},GF={key:2,class:"fcom_question_options"},YF={key:2,class:"question_help_text"},WF={key:3,class:"fcom_question_explanation"},KF={key:2,class:"fcom_quiz_footer"},ZF={key:0},QF={key:1},JF={key:2},XF={class:"fcom_quiz_nav"},eI={key:0};function tI(e,t,s,u,o,i){var V,P;const m=O,f=wt,h=Ie,p=g("Check"),k=j,b=g("Close"),$=oe,w=g("TypedAnswer"),C=ve,v=g("LightBulbIcon"),S=g("FeedMdContent"),T=Q;return n(),r(F,null,[o.loading?(n(),y(T,{key:1,rows:5,animated:""})):(n(),r("div",bF,[i.alreadyAttempted?(n(),r("div",kF,[l("div",wF,[["passed","failed"].includes(o.userResult.status)?(n(),r("div",CF,[l("p",null,[i.isPassed?(n(),r("span",$F,"๐ŸŽ‰ ")):(n(),r("span",SF,"๐Ÿ˜ž ")),l("span",null,c(e.$t("You")),1),l("span",{style:ue({color:i.isPassed?"green":"red"})},c(i.isPassed?" "+e.$t("passed")+" ":" "+e.$t("failed")+" "),5),l("span",null,c(e.$t("the quiz.")),1)]),l("p",null,c(i.isPassed?e.$t("Great job!"):e.$t("Try again!")),1)])):(n(),r(F,{key:1},[l("p",null,c(e.$t("We have saved your quiz results.")),1),l("p",null,c(e.$t("Please await the grading.")),1)],64)),a(m,{class:"fcom_secondary_button",onClick:i.retakeQuiz},{default:d(()=>[M(c(e.$t("Retake Quiz")),1)]),_:1},8,["onClick"])]),l("div",VF,[l("div",MF,[l("span",LF,c(e.$t("Score")),1),l("span",TF,c(o.userResult.score)+"%",1)]),l("div",FF,[l("span",IF,c(e.$t("Correct Answers")),1),l("span",PF,c(((V=o.userResult.meta)==null?void 0:V.correct_answers)+" / "+((P=o.userResult.meta)==null?void 0:P.total_questions)),1)])])])):_("",!0),i.isPaged?(n(),r("div",EF,[l("p",AF,c(e.$t("Question %1$s of %2$s",o.currentIndex+1,i.displayQuestions.length)),1),a(f,{percentage:i.progressPercentage,"stroke-width":8,"show-text":!1,"aria-label":e.$t("Quiz progress")},null,8,["percentage","aria-label"])])):_("",!0),(n(!0),r(F,null,R(i.displayQuestions,(L,x)=>(n(),r(F,{key:L.slug},[i.showQuestion(L)&&(!i.isPaged||x===o.currentIndex)?(n(),r("div",{key:0,ref_for:!0,ref:i.isPaged?"pagedQuestion":void 0,tabindex:i.isPaged?-1:void 0,class:D(["fcom_question",L.type])},[i.showQuestionImage(L)?(n(),r("div",BF,[a(h,{src:L.image_url},null,8,["src"])])):_("",!0),l("div",DF,[l("div",{innerHTML:L.label_rendered,class:"fcom_question_label"},null,8,RF)]),l("div",xF,[i.isWrittenAnswer(L)?(n(),r(F,{key:0},[i.showResult?(n(),r("div",{key:0,class:D(["fcom_is_correct",i.freeTextBadgeClass(L)])},[i.isExactMatchQuestion(L)?(n(),r("p",OF,[i.isQuestionCorrect(L)?(n(),r(F,{key:0},[a(k,null,{default:d(()=>[a(p)]),_:1}),M(" "+c(e.$t("Correct")),1)],64)):(n(),r(F,{key:1},[a(k,null,{default:d(()=>[a(b)]),_:1}),M(" "+c(e.$t("Incorrect")),1)],64))])):(n(),r("p",HF,[a(k,null,{default:d(()=>[a(p)]),_:1}),M(" "+c(e.$t("Answered")),1)]))],2)):_("",!0),l("div",jF,[!i.alreadyAttempted||o.isNew?(n(),r(F,{key:0},[i.isExactMatchQuestion(L)?(n(),y($,{key:0,type:"text",modelValue:o.answers[L.slug],"onUpdate:modelValue":A=>o.answers[L.slug]=A,placeholder:e.$t("Type your answer"),maxlength:500},null,8,["modelValue","onUpdate:modelValue","placeholder"])):(n(),y($,{key:1,type:"textarea",rows:4,modelValue:o.answers[L.slug],"onUpdate:modelValue":A=>o.answers[L.slug]=A,placeholder:e.$t("Write your answer here..."),maxlength:1e4,"show-word-limit":""},null,8,["modelValue","onUpdate:modelValue","placeholder"]))],64)):(n(),r("div",NF,c(o.answers[L.slug]),1))])],64)):(n(),r(F,{key:1},[i.showResult?(n(),r("div",{key:0,class:D(["fcom_is_correct",i.isQuestionCorrect(L)?"correct":"incorrect"])},[i.isQuestionCorrect(L)?(n(),r("p",zF,[a(k,null,{default:d(()=>[a(p)]),_:1}),M(" "+c(e.$t("Correct")),1)])):(n(),r("p",qF,[a(k,null,{default:d(()=>[a(b)]),_:1}),M(" "+c(e.$t("Incorrect")),1)]))],2)):_("",!0),i.isTypedAnswer(L)?(n(),y(w,{key:1,modelValue:o.answers[L.slug],"onUpdate:modelValue":A=>o.answers[L.slug]=A,question:L,readonly:!i.isAnswering},null,8,["modelValue","onUpdate:modelValue","question","readonly"])):(n(),r("div",GF,[(n(!0),r(F,null,R(i.displayOptions(L),A=>(n(),r("div",{key:A.label,class:"fcom_question_option"},[a(C,{class:D({single_choice:i.isSingleChoice(L)}),"model-value":i.isOptionSelected(L,A),onChange:U=>i.handleOptionChange(L,A)},{default:d(()=>[M(c(i.optionLabel(L,A)),1)]),_:2},1032,["class","model-value","onChange"])]))),128))]))],64)),L.help_text?(n(),r("div",YF,c(L.help_text),1)):_("",!0),i.showResult&&i.questionExplanation(L)?(n(),r("div",WF,[a(m,{text:"",class:"fcom_explanation_toggle",onClick:A=>i.toggleExplanation(L.slug)},{default:d(()=>[a(k,{class:"fcom_explanation_icon"},{default:d(()=>[a(v)]),_:1}),l("span",null,c(i.isExplanationOpen(L.slug)?e.$t("Hide Explanation"):e.$t("View Explanation")),1)]),_:2},1032,["onClick"]),i.isExplanationOpen(L.slug)?(n(),y(S,{key:0,content:i.questionExplanation(L),class_name:"fcom_explanation_body"},null,8,["content"])):_("",!0)])):_("",!0)])],10,UF)):_("",!0)],64))),128))])),!o.loading&&!i.alreadyAttempted?(n(),r("div",KF,[s.isEnrolled?i.isPaged&&!i.isLastQuestion?(n(),r("p",QF,c(e.$t("Answer this question to continue")),1)):(n(),r("p",JF,c(e.$t("Answer all questions to submit")),1)):(n(),r("p",ZF,c(e.$t("You need to enroll in this course to take this quiz.")),1)),l("div",XF,[i.isPaged&&o.currentIndex>0?(n(),y(m,{key:0,class:"fcom_secondary_button",onClick:t[0]||(t[0]=L=>i.goToQuestion(o.currentIndex-1))},{default:d(()=>[M(c(e.$t("Previous")),1)]),_:1})):_("",!0),i.isPaged&&!i.isLastQuestion?(n(),y(m,{key:1,class:"fcom_primary_button",disabled:!i.isQuestionAnswered(i.currentQuestion),onClick:t[1]||(t[1]=L=>i.goToQuestion(o.currentIndex+1))},{default:d(()=>[M(c(e.$t("Next")),1)]),_:1},8,["disabled"])):(n(),y(m,{key:2,class:"fcom_primary_button",onClick:i.submitQuiz,loading:o.submitting,disabled:o.submitting||!s.isEnrolled||!i.isAllAnswersSelected},{default:d(()=>[M(c(e.$t("Submit Quiz"))+" ",1),e.has_pro?_("",!0):(n(),r("span",eI,"ย ("+c(e.$t("Pro Required"))+")",1))]),_:1},8,["onClick","loading","disabled"]))])])):_("",!0)],64)}const sI=I(vF,[["render",tI]]),oI={name:"ViewLesson",components:{PaperClipIcon:uo,DocumentLists:tt,CircleIcon:ps,AppLayout:Se,Layout:we,MediaPreview:xe,CommentBox:ET,ChatIcon:Je,ExitFullScreen:DT,QuizView:sI},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("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 p;this._autoCompleteTimer=null,((p=this.currentLesson)==null?void 0:p.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)}},iI={key:0},nI={class:"fcom_back_space"},lI={class:"fcom_lesson_details",style:{padding:"2rem"}},aI={class:"fcom_back_space"},rI={class:"fcom_lesson_name"},dI={class:"fcom_lesson_nav"},cI={key:1},uI=["href"],_I={class:"fcom_lesson_details"},mI={class:"fcom_lesson_header"},hI={class:"fcom_lesson_title"},fI={class:"fcom_lesson_number"},pI=["href"],gI=["innerHTML"],yI={class:"fcom_lesson_nav"},vI=["innerHTML"],bI={class:"fcom_lesson_body feed_texts"},kI={key:0,class:"fcom_lesson_content"},wI=["innerHTML"],CI={key:0,class:"fcom_lesson_quiz"},$I={key:1,ref:"fcom_course_documents",class:"fcom_lesson_documents"},SI={class:"fcom_lesson_documents_header"},VI={key:0,class:"fcom_lesson_documents_list"},MI={key:0,ref:"fcom_course_comments",class:"fcom_lesson_comments"},LI={class:"fcom_lesson_comment_box"},TI={key:0,style:{"text-align":"center",padding:"20px","margin-top":"30px","border-radius":"8px","background-color":"var(--fcom-primary-bg, white)"}},FI={style:{padding:"0",margin:"0 0 20px"}},II=["href"],PI={class:"fcom_section_sidebar_title"},EI={class:"fcom_section_items"},AI={class:"fcom_section_primary_item"},UI={class:"fcom_section_primary_item_title"},BI=["id","onClick"],DI={class:"fcom_heading_item clickable"},RI=["innerHTML"],xI={key:0,class:"fcom_section_footer course_progress_footer_wrap"},OI={class:"fcom_course_progress_footer"};function HI(e,t,s,u,o,i){const m=Q,f=g("ArrowLeft"),h=j,p=g("FullScreen"),k=g("ExitFullScreen"),b=O,$=g("ChatIcon"),w=g("PaperClipIcon"),C=g("Lock"),v=g("ArrowRight"),S=Ee,T=g("Operation"),V=g("media-preview"),P=g("QuizView"),L=g("DocumentLists"),x=g("CommentBox"),A=Pe,U=ut,B=g("Close"),N=g("ArrowDown"),H=g("SuccessFilled"),z=g("CircleIcon"),G=wt,ne=_t,E=As,J=mt,ce=g("layout"),X=g("app-layout"),Ve=se("loading");return n(),y(X,{class:D({fcom_full_screen:o.isFullScreen,fcom_show_right_aside:o.sm_side_show}),wrapper_class:"fcom_single_layout fcom_full_layout"},{default:d(()=>[s.course&&s.currentLesson?(n(),y(ce,{key:0,wrapper_class:"no_bg_layout"},{default:d(()=>[a(J,{class:"fcom_lesson_container fcom_resp_container"},{default:d(()=>[a(U,{style:ue({height:i.containerHeight}),class:"fcom_lesson_wrap"},{default:d(()=>[o.isTransiting?(n(),r("div",iI,[Y((n(),r("div",nI,[...t[7]||(t[7]=[M(" ...... ",-1)])])),[[Ve,!0]]),l("div",lI,[a(m,{rows:10,animated:!0})])])):(n(),y(A,{key:1,ref:"lesson_scroller"},{default:d(()=>{var ee;return[l("div",aI,[l("div",{class:"clickable fcom_go_back",onClick:t[0]||(t[0]=Z=>e.$router.push({name:"view_course"}))},[a(h,{class:"fcom_arrow_icon"},{default:d(()=>[a(f)]),_:1}),l("span",rI,c(s.course.title),1)]),l("div",dI,[a(b,{title:o.isFullScreen?e.$t("Exit Full Screen"):e.$t("Go Full Screen"),onClick:i.toggleFullScreen,size:"small",text:""},{default:d(()=>[a(h,null,{default:d(()=>[o.isFullScreen?(n(),y(k,{key:1})):(n(),y(p,{key:0}))]),_:1})]),_:1},8,["title","onClick"]),s.currentLesson.can_view?(n(),r(F,{key:0},[i.commentsEnabled?(n(),y(b,{key:0,"aria-label":e.$t("Comments"),onClick:i.scrollToComments,bg:"",size:"small",text:""},{default:d(()=>[a(h,null,{default:d(()=>[a($)]),_: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:d(()=>[a(h,null,{default:d(()=>[a(w)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0),s.track.isEnrolled?(n(),y(S,{key:2,disabled:!i.isVideoGateLocked,content:e.$t("Watch the video to complete this lesson"),trigger:["hover","focus"],placement:"bottom"},{default:d(()=>[a(b,{class:D([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:d(()=>[i.isCompleted?(n(),r("span",cI,c(e.$t("Completed")),1)):(n(),r(F,{key:0},[i.isVideoGateLocked?(n(),y(h,{key:0},{default:d(()=>[a(C)]),_:1})):_("",!0),l("span",null,c(e.$t("Complete Lesson")),1),i.isVideoGateLocked?_("",!0):(n(),y(h,{key:1,class:"fcom_arrow_icon"},{default:d(()=>[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?Y((n(),y(b,{key:4,disabled:o.enrolling,onClick:i.enroll,class:"fcom_primary_button"},{default:d(()=>[M(c(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[Ve,o.enrolling]]):_("",!0):(n(),r("a",{key:3,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},c(e.$t("Login to enroll this course")),9,uI))],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]=Z=>o.sm_side_show=!o.sm_side_show)},{default:d(()=>[a(h,null,{default:d(()=>[a(T)]),_:1})]),_:1},8,["aria-label"])):_("",!0)])]),l("div",_I,[l("div",mI,[l("div",hI,[l("p",fI,[M(c(e.$t("Lesson %1$s of %2$s",s.currentLessonIndex+1,s.lessonsCount))+" ",1),e.isAdmin()?(n(),r("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})},c(i.isQuizContent?e.$t("Edit Quiz"):e.$t("Edit Lesson")),9,pI)):_("",!0)]),l("h1",{innerHTML:s.currentLesson.title},null,8,gI)]),l("div",yI,[a(b,{"aria-label":e.$t("Previous lesson"),onClick:t[2]||(t[2]=Z=>e.$emit("setPrevLesson")),disabled:s.currentLessonIndex===0,size:"small"},{default:d(()=>[a(h,{class:"fcom_arrow_icon"},{default:d(()=>[a(f)]),_:1})]),_:1},8,["aria-label","disabled"]),a(b,{"aria-label":e.$t("Next lesson"),onClick:t[3]||(t[3]=Z=>e.$emit("setNextLesson")),disabled:s.currentLessonIndex+1===s.lessonsCount,size:"small"},{default:d(()=>[a(h,{class:"fcom_arrow_icon"},{default:d(()=>[a(v)]),_:1})]),_:1},8,["aria-label","disabled"])])]),s.currentLesson.can_view?(n(),r(F,{key:1},[i.showMediaPreview?(n(),y(V,{key:0,media_item:s.currentLesson.meta.media},null,8,["media_item"])):_("",!0),l("div",bI,[s.currentLesson.content_loading?(n(),r("div",kI,[a(m,{rows:5,animated:!0})])):(n(),r(F,{key:1},[l("div",{ref:"lessonContent",class:"fcom_lesson_content feed_md_content",innerHTML:s.currentLesson.content},null,8,wI),(ee=s.currentLesson.meta)!=null&&ee.quiz_questions?(n(),r("div",CI,[a(P,{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(),r("div",$I,[l("div",SI,[l("h3",null,c(e.$t("Documents & Files")),1)]),e.has_pro?(n(),r("div",VI,[a(L,{class:"fcom_boxed_documents",document_lists:s.currentLesson.meta.document_lists},null,8,["document_lists"])])):_("",!0)],512)):_("",!0)],64)):(n(),r("div",{key:0,class:"fcom_locked_container",innerHTML:s.currentLesson.access_message},null,8,vI))]),i.commentsEnabled&&!s.currentLesson.content_loading?(n(),r("div",MI,[l("div",LI,[a(x,{show_comment_form:s.track.isEnrolled,feed:s.currentLesson,showAll:!0,checkPermission:!0},ye({before_comment_box:d(()=>[l("h3",null,c(e.$t("Lesson Discussions")),1)]),_:2},[s.track.isEnrolled?void 0:{name:"after_comment_box",fn:d(()=>[!e.auth.user_id||s.course.can_self_enroll?(n(),r("div",TI,[l("p",FI,c(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?Y((n(),y(b,{key:1,disabled:o.enrolling,onClick:i.enroll,class:"fcom_primary_button"},{default:d(()=>[M(c(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[Ve,o.enrolling]]):_("",!0):(n(),r("a",{key:0,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},c(e.$t("Login to enroll this course")),9,II))])):_("",!0)]),key:"0"}]),1032,["show_comment_form","feed"])])],512)):_("",!0)]}),_:1},512))]),_:1},8,["style"]),o.sm_side_show?(n(),r("div",{key:0,class:"fcom_toc_backdrop fcom_toc_control",onClick:t[4]||(t[4]=ee=>o.sm_side_show=!1)})):_("",!0),a(ne,{class:"fcom_lesson_sidebar fcom_resp_side",width:"320px"},{default:d(()=>[a(A,{ref:"lesson_index_sidebar",height:i.containerHeight},{default:d(()=>[l("div",PI,[l("h3",null,c(e.$t("Lessons")),1),a(b,{class:"fcom_toc_control fcom_toc_close",text:"","aria-label":e.$t("Close"),onClick:t[5]||(t[5]=ee=>o.sm_side_show=!1)},{default:d(()=>[a(h,null,{default:d(()=>[a(B)]),_:1})]),_:1},8,["aria-label"])]),l("div",EI,[(n(!0),r(F,null,R(s.sections,ee=>(n(),r("div",{key:ee.id,class:"fcom_section_primary"},[l("div",AI,[l("div",UI,[a(h,{class:"clickable",onClick:Z=>ee.is_closed=!ee.is_closed},{default:d(()=>[ee.is_closed?(n(),y(v,{key:0,class:"fcom_arrow_icon"})):(n(),y(N,{key:1}))]),_:2},1032,["onClick"]),l("h4",null,c(ee.title),1)])]),ee.is_closed?_("",!0):(n(!0),r(F,{key:0},R(ee.lessons,Z=>(n(),r("div",{class:D([{fcom_current_lesson:Z.id==s.currentLesson.id},"fcom_section_item"]),key:Z.id},[l("div",{id:"fcom_lesson_title_"+Z.id,onClick:ie=>i.gotoLesson(Z),class:"fcom_section_item_title"},[l("p",DI,[s.track.completed_lessons.includes(Z.id.toString())?(n(),y(h,{key:0,style:{color:"#008a2e"}},{default:d(()=>[a(H)]),_:1})):Z.can_view?(n(),y(h,{key:2},{default:d(()=>[a(z)]),_:1})):(n(),y(h,{key:1},{default:d(()=>[a(C)]),_:1})),l("span",{innerHTML:Z.title},null,8,RI)])],8,BI)],2))),128))]))),128))]),s.track.progress?(n(),r("div",xI,[l("div",OI,[l("p",null,c(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(E,{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]=ee=>o.lightboxImages=[])},null,8,["url-list","initial-index","show-progress"])):_("",!0)]),_:1})]),_:1})):_("",!0)]),_:1},8,["class"])}const jI=I(oI,[["render",HI]]),NI={name:"LeaderLists",props:["leaders"],computed:{isAll(){return this.leaders.key==="all_time"}}},zI={class:"fcom_box_list"},qI={class:"fcom_box_list_header"},GI={class:"fcom_box_list_body"},YI={class:"fcom_person_lists"},WI={class:"fcom_leader"},KI={key:0,class:"fcom_serial_suffix"},ZI={key:0,class:"fcom_leader_stat"};function QI(e,t,s,u,o,i){const m=g("UserAvatar"),f=g("UserRouteLink");return n(),r("div",zI,[l("div",qI,c(s.leaders.title),1),l("div",GI,[l("ul",YI,[(n(!0),r(F,null,R(s.leaders.items,(h,p)=>(n(),r("li",{key:h.user_id},[l("div",WI,[l("div",{class:D(["fcom_serial_"+(p+1),"fcom_serial"])},[l("span",null,c(p+1),1),p<3?(n(),r("div",KI,[...t[0]||(t[0]=[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)])])):_("",!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(),r("div",ZI,[Y(l("span",null,"+",512),[[bt,!i.isAll]]),M(" "+c(h.total_points),1)])):_("",!0)]))),128))])])])}const JI=I(NI,[["render",QI]]),XI={name:"LeaderTooltip",components:{InfoFilled:Vt},props:{levelChunks:{type:Array,required:!0}}},eP={class:"fcoml_tooltip_content"},tP={class:"fcoml_tooltip_title"},sP={class:"fcoml_tooltip_subtitle"},oP=["innerHTML"],iP={class:"fcoml_tooltip_subtitle"},nP={class:"fcoml_tooltip_desc"},lP={class:"fcoml_tooltip_levels"},aP={class:"levels_list"},rP={class:"level_title"},dP={class:"level_points"};function cP(e,t,s,u,o,i){const m=g("InfoFilled"),f=j,h=O,p=fe;return n(),y(p,{persistent:!1,"popper-class":"fcoml_tooltip_popover",width:550,effect:"dark",trigger:"click"},{reference:d(()=>[a(h,{"aria-label":e.$t("More info"),text:""},{default:d(()=>[a(f,null,{default:d(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])]),default:d(()=>[l("div",eP,[l("h5",tP,c(e.$t("Leaderboard Points")),1),l("p",sP,c(e.$t("1 Like = 1 Point")),1),l("p",{class:"fcoml_tooltip_desc",innerHTML:e.$t("__LEADERBOARD_DESC_INS")},null,8,oP),l("p",iP,c(e.$t("Levels")),1),l("p",nP,c(e.$t("As you gain points, you level up. Your level is shown at the bottom right of your avatar.")),1),l("div",lP,[(n(!0),r(F,null,R(s.levelChunks,(k,b)=>(n(),r("div",{key:b},[l("ul",aP,[(n(!0),r(F,null,R(k,$=>(n(),r("li",{key:$.level,class:"level_item"},[l("div",rP,c($.title),1),l("div",dP,c(e.$_n("%d point","%d points",$.min_points)),1)]))),128))])]))),128))])])]),_:1})}const uP=I(XI,[["render",cP]]),_P={name:"LeaderBoard",components:{InfoFilled:Vt,LeaderLists:JI,AppLayout:Se,Layout:we,LeaderTooltip:uP},data(){return{leaderboard:[],loading:!1}},computed:{userLevel(){return this.appVars.auth.user_id?Ue(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"))}},mP={key:0,style:{"text-align":"center",padding:"20px 20px 40px"}},hP={class:"permission_failed"},fP=["href"],pP={key:0,class:"fcom_leaderboard_profile"},gP={class:"fcom_leaderboard_profile_inner"},yP={class:"fcom_profile_header"},vP={class:"fcom_profile_info"},bP={class:"info_avatar"},kP={class:"info_user"},wP={class:"fcom_level_name"},CP={class:"fcoml_level_sub"},$P={class:"fcoml_level_sub_icon"},SP={class:"fcoml_level_sub_text"},VP={class:"fcom_leaderboard_profile_avatar"},MP={class:"fcom_leaderboard_levels"},LP=["title"],TP={key:1},FP={class:"fcoml_level_detail"},IP={class:"fcoml_level_title"},PP={class:"fcoml_level_sub"},EP={class:"fcom_leaderboard_items"},AP={key:1,class:"white_loaded"};function UP(e,t,s,u,o,i){const m=g("UserAvatar"),f=g("UserRouteLink"),h=g("LeaderTooltip"),p=g("Lock"),k=j,b=dt,$=ct,w=g("leader-lists"),C=Q,v=g("layout"),S=g("app-layout");return n(),y(S,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:d(()=>[a(v,{wrapper_class:"no_bg_layout",title:e.$t("Leaderboards")},{default:d(()=>[e.appVars.view_leaderboard_members?(n(),r(F,{key:1},[i.userLevel?(n(),r("div",pP,[l("div",gP,[l("div",yP,[l("div",vP,[l("div",bP,[a(m,{with_level:!0,with_completion:!0,xprofile:e.appVars.auth},null,8,["xprofile"])]),l("div",kP,[a(f,{show_badge:!0,show_pop:!1,xprofile:e.appVars.auth},null,8,["xprofile"]),l("div",wP,c(i.userLevel.title),1)])]),l("div",CP,[l("div",$P,[l("span",null,"๐Ÿ† "+c(e.auth.total_points),1),t[0]||(t[0]=M(" | ",-1)),l("span",null,c(e.$t("Level %d",i.userLevel.level)),1)]),l("div",SP,[M(c(e.$t("%d points to level up!",i.requiredPoints))+" ",1),a(h,{levelChunks:i.levelChunks},null,8,["levelChunks"])])])]),l("div",VP,[a($,{gutter:20},{default:d(()=>[(n(!0),r(F,null,R(i.levelChunks,T=>(n(),y(b,{sm:24,md:8},{default:d(()=>[l("ul",MP,[(n(!0),r(F,null,R(T,V=>(n(),r("li",null,[l("div",{title:`${V.min_points} points`,class:D(["fcom_level_icon",{fcom_is_in_level:i.userLevel.max_points>=V.max_points}])},[i.userLevel.max_points[a(p)]),_:1})):(n(),r("span",TP,c(V.level),1))],10,LP),l("div",FP,[l("div",IP,c(V.title),1),l("div",PP,c(V.tagline),1)])]))),256))])]),_:2},1024))),256))]),_:1})])])])):_("",!0),l("div",EP,[a($,{gutter:20},{default:d(()=>[(n(!0),r(F,null,R(o.leaderboard,T=>(n(),y(b,{key:T.key,md:8,sm:24},{default:d(()=>[a(w,{leaders:T},null,8,["leaders"])]),_:2},1024))),128))]),_:1})]),o.loading?(n(),r("div",AP,[a(C,{rows:16,animated:!0})])):_("",!0)],64)):(n(),r("div",mP,[l("div",hP,[l("h3",null,c(e.$t("Permission Denied")),1),l("p",null,c(e.$t("You do not have permission to view the leaderboard")),1),l("a",{href:e.$getRouteLink("/"),class:"el-button fcom_primary_button"},c(e.$t("Go To All Feeds")),9,fP)])]))]),_:1},8,["title"])]),_:1})}const BP=I(_P,[["render",UP]]),DP=[{name:"dashboard",path:"/dashboard",component:g0,meta:{active_menu:"dashboard",title:"Dashboard"}},{path:"/",component:y2,meta:{active_menu:"dashboard"},children:[{name:"all_feeds",path:"",component:M2},{name:"single_feed",path:"post/:feed_slug",component:Ms,props:!0}]},{path:"/feed-settings",component:()=>he(()=>import("./FeedSettingsRoute.js?ver=2.11.0"),[]),redirect:()=>({name:"feed_settings_links"}),meta:{active_menu:"dashboard"},children:[{name:"feed_settings_welcome_banner",path:"welcome-banner",component:()=>he(()=>import("./WelcomeBannerConfig.js?ver=2.11.0"),[])},{name:"feed_settings_links",path:"links",component:()=>he(()=>import("./ManageFeedLinks.js?ver=2.11.0"),[])}]},{path:"/space/:space/settings",component:()=>he(()=>import("./SpaceSettingsRoute.js?ver=2.11.0"),[]),props:!0,redirect:e=>({name:"space_settings_general",params:e.params}),meta:{in_space:!0,back_route:"space_feeds"},children:[{name:"space_settings_general",path:"general",component:()=>he(()=>import("./SpaceGeneralTab.js?ver=2.11.0"),[])},{name:"space_settings_paywalls",path:"paywalls",component:()=>he(()=>import("./ManagePaywalls.js?ver=2.11.0"),[])},{name:"space_settings_lockscreen",path:"lock-screen",component:()=>he(()=>import("./SpaceLockscreen.js?ver=2.11.0"),[])},{name:"space_settings_links",path:"links",component:()=>he(()=>import("./ManageSpaceMenu.js?ver=2.11.0"),[])},{name:"space_settings_pages",path:"pages",component:()=>he(()=>import("./ManageSpacePages.js?ver=2.11.0"),[])}]},{path:"/space/:space/",component:Lw,props:!0,meta:{in_space:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]},children:[{name:"space_home",path:"",component:Aw,props:!0,meta:{show_sidebar:!0}},{name:"space_feeds",path:"home",component:Ew,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_about",path:"about",component:Vo,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_feed",path:"post/:feed_slug",component:Ms,props:!0,meta:{in_space:!0,show_sidebar:!0,owns_title:!0}},{name:"space_members",path:"members",component:B8,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_invitations",path:"invitations",component:lC,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_documents",path:"documents",component:C4,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_media",path:"media",component:L5,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_page",path:"page/:page_slug",component:()=>he(()=>import("./ViewSpacePage.js?ver=2.11.0"),[]),props:!0,meta:{in_space:!0,show_sidebar:"from_page_layout",lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}},{name:"space_not_found",path:":pathMatch(.*)*",component:()=>he(()=>import("./SpaceNotFound.js?ver=2.11.0"),[]),props:!0,meta:{in_space:!0,show_sidebar:!1}}]},{path:"/discover/spaces",name:"spaces",component:HC,meta:{active_menu:"spaces"}},{name:"all_members",path:"/members",component:WV,props:!0,meta:{active_menu:"all_members"}},{path:"/u/:username/",component:z6,props:!0,meta:{active_menu:"all_members"},children:[{name:"user_profile",path:"",component:N7,meta:{active_menu:"all_members"}},{name:"user_spaces",path:"spaces",component:W$,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"update_profile",path:"update",component:S7,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_profile_about",path:"about",component:Ro,meta:{active_menu:"all_members"}},{name:"user_profile_feeds",path:"posts",component:s$,meta:{active_menu:"all_members"}},{name:"user_scheduled_posts",path:"scheduled-posts",component:L$,meta:{active_menu:"all_members"}},{name:"user_comments",path:"comments",component:oS,meta:{active_menu:"all_members"}},{name:"user_courses",path:"courses",component:MS,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_notification_settings",path:"notification-settings",component:b9,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_follows",path:"follow",component:vV,meta:{active_menu:"all_members"},children:[{name:"user_followers",path:"followers",component:j9,props:!0,meta:{active_menu:"all_members"}},{name:"user_followings",path:"followings",props:!0,component:cV,meta:{active_menu:"all_members"}}]}]},{path:"/notifications",name:"notifications",component:iM,meta:{}},{name:"bookmarks",path:"/bookmarks",component:cM,meta:{active_menu:"bookmarks"}},{name:"courses",path:"/courses",component:OM,meta:{active_menu:"courses",lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}},{path:"/course/:course_slug",component:YM,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:wT,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:jI,name:"view_lesson",meta:{in_course:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}}]},{name:"leaderboards",path:"/leaderboards",component:BP,meta:{active_menu:"leaderboards"}}],RP={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 xP(e,t,s,u,o,i){return n(),r("h1",null,c(o.message),1)}const OP=I(RP,[["render",xP]]),HP=(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)}),jP={name:"VerifiedSign"},NP={class:"fcom_verified"},zP=["aria-label"];function qP(e,t,s,u,o,i){const m=Ee;return n(),y(m,{content:e.$t("Verified"),placement:"top"},{default:d(()=>[l("span",NP,[(n(),r("svg",{viewBox:"0 0 22 22","aria-label":e.$t("Verified account"),role:"img","data-testid":"icon-verified"},[...t[0]||(t[0]=[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)])],8,zP))])]),_:1},8,["content"])}const GP=I(jP,[["render",qP]]),YP=[pi,Ks,gi,yi,Gs,vi,bi,ki,wi,Ci,$i,Si,Vi,Mi,Li,Ti,Fi,Ii,Zs,Qs,Pi,Ei,Ai,Js,Ui,Bi,Di,eo,$t,Ri,xi,Oi,Hi,Ct,ji,Ni,zi,qi,qs,Gi,Yi,Ys,Wi,Vt,Fe,Ki,to];function rt(e){const t=[];if(typeof e=="object"&&e.join===void 0)for(const s in e)t.push(rt(e[s]));else if(typeof e=="object"&&e.join!==void 0)for(const s in e)t.push(rt(e[s]));else typeof e=="function"||typeof e=="string"&&t.push(e);return t.join("
")}function WP(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=zo(l0),ys=ti();ys.use(si);ys.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(ys);de.use(Jo);var Is,Ps;de.use(fi,{loading:(((Is=window.fluentComAdmin)==null?void 0:Is.assets_url)||"")+"images/image-loader.svg",error:(((Ps=window.fluentComAdmin)==null?void 0:Ps.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 qt="40%",Gt="60%",xo="500px";window.innerWidth<600?(Gt="95%",qt="90%",xo="90%"):window.innerWidth<800&&(Gt="80%",qt="80%");YP.forEach(e=>{de.component(e.name,e)});de.component("VerifiedSign",GP);de.component("UserAvatar",ds);de.component("UserRouteLink",Te);de.component("WelcomeBanner",gs);de.component("UserBadge",Do);function Fs(){var k,b,$,w,C;if(window.fluentFrameworkApp){console.warn("FluentCommunity: the portal app is already mounted, skipping duplicate initialization.");return}de.use(window.FluentCommunityUtil.eventBus);const e=window.FluentCommunityUtil.Rest;de.mixin({data(){return{Storage:window.FluentCommunityUtil.Storage,is_rtl:!1,drawerWidth:qt,dialogWidth:Gt,modalWidth:xo,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 S="";typeof v=="string"?S=v:v&&v.message?S=v.message:S=rt(v),S||(S="Something is wrong!"),typeof S!="string"&&(S=rt(S)),this.$notify({type:"error",title:this.$t("Error"),message:S,dangerouslyUseHTMLString:!0})},convertToText:rt,$t(v){v=window.fluentComAdmin.i18n[v]||v;const S=Array.prototype.slice.call(arguments,1);if(S.length===0)return v;const T=/%(\d*)\$?s|%d/g;let V=0;return v=v.replace(T,(P,L)=>{if(L){const x=parseInt(L,10)-1;return x1?this.$t(S,T):this.$t(v,T)},$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,S=>S.toUpperCase())):""},$toClipboard(v,S="Copied to clipboard"){navigator.clipboard.writeText(v).then(()=>{this.$notify.success(this.$t(S))}).catch(T=>{this.$notify.error(this.$t("Failed to copy"))})},dayjs,relativeTimeFromUtc(v){return dayjs.utc(v).local().fromNow()},$storeLocalData(v,S){this.Storage.set(v,S)},$getLocalData(v,S=""){return this.Storage.get(v,S)},ucFirst(v){return v?v.charAt(0).toUpperCase()+v.slice(1):""},convertTo24Hour(v){if(!v)return v;const S=v.match(/^(\d{1,2}):(\d{2})(?::\d{2})?\s*([AaPp][Mm])?$/);if(!S){const L=dayjs(v,this.siteTimeFormat);return L.isValid()?L.format("HH:mm"):v}let T=parseInt(S[1],10);const V=S[2],P=S[3];if(P){const L=P.toUpperCase()==="PM";L&&T!==12&&(T+=12),!L&&T===12&&(T=0)}return String(T).padStart(2,"0")+":"+V},ucWords(v){return v?v.replace(/\b[a-z]/g,function(S){return S.toUpperCase()}):""},smartDate(v,S=!1,T=!1){if(!v)return"";const V=this.siteTimeFormat;let P="D MMM, YYYY";dayjs(v).isSame(new Date,"year")?(P="D MMM",S&&(Math.abs(dayjs(v).diff(new Date,"days"))<=5||T)&&(P="D MMM, "+V)):S&&T&&(P="D MMM, YYYY, "+V);const L=dayjs(v);return L.isValid()?L.format(P):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,S){const T=this.appVars&&this.appVars.upgrade_url;if(!T)return T;try{const V=new URL(T);return v&&V.searchParams.set("utm_content",v),S&&V.searchParams.set("utm_campaign",S),V.toString()}catch{return T}},hasInPermission(v,S){return!S||typeof S!="object"?!1:S[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 S=dayjs.utc(v,"YYYY-MM-DD HH:mm:ss");if(!S.isValid())return"";const T=S.add(this.appVars.date_offset,"s");return dayjs(T.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 S=dayjs.utc(v,"YYYY-MM-DD HH:mm:ss");if(!S.isValid())return!0;const T=S.add(this.appVars.date_offset,"s");return dayjs(T.format("YYYY-MM-DD HH:mm:ss")).isBefore(dayjs(dayjs.utc().format("YYYY-MM-DD HH:mm:ss")))},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 S;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((S=v.space)==null?void 0:S.slug):!1},getExcerpt(v,S=250){if(!v)return"";let T=v.replace(/(<([^>]+)>)/ig,"");return T=T.replace(/(\*\*|__)(.*?)\1/g,"$2"),T=T.replace(/(#+)(.*)/g,"$2"),T=T.replace(/\[(.*?)\]\((.*?)\)/g,"$1"),typeof DOMParser<"u"&&(T=new DOMParser().parseFromString(T,"text/html").body.textContent||""),T.length>S&&(T=T.substring(0,S)+"..."),T},mdToHtml(v){return v?(v=v.replace(" ","",v),v=v.replace(/\*\*(.*?)\*\*/g,"$1"),v=v.replace(/\*(.*?)\*/g,"$1"),v=v.replace(/\~\~(.*?)\~\~/g,"$1"),v=v.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'$1'),v=v.replace(/<(https?:\/\/[^\s>]+)>/g,'$1'),v=v.replace(/^##\s+(.*?)$/gm,"

$1

"),v=v.replace(/^###\s+(.*?)$/gm,"

$1

"),v=v.replace(/^####\s+(.*?)$/gm,"

$1

"),v=v.replace(/^>\s+(.*?)$/gm,"
$1
"),v=v.replace(/`{3}([\s\S]*?)`{3}/g,"
$1
"),v=v.replace(/`([^`]+)`/g,"$1"),v=v.replace(/^([\*\-])\s+(.*)$/gm,"
  • $2
  • "),v=v.replace(/(
  • .*?<\/li>(?:\n
  • .*?<\/li>)*)/g,function(S){return"
      "+S.replace(/\n/g,"")+"
    "}),v=v.replace(/\n/g,"
    "),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 T,V;return["admin","moderator"].includes((V=(T=v==null?void 0:v.membership)==null?void 0:T.pivot)==null?void 0:V.role)},isSpaceAdmin(v){var S,T;return((T=(S=v==null?void 0:v.membership)==null?void 0:S.pivot)==null?void 0:T.role)=="admin"},isModerator(v){if(this.isCommunityModerator())return!0;if(!v)return!1;const S=this.auth.spaces[v];return this.isSpaceModerator(S)},getCurrentAuthUrl(){let v=window.location.href,S=this.appVars.auth_url;return S=S.replace(/(\?|&)redirect_to=[^&]+/,""),S.indexOf("?")===-1?S+="?":S+="&",S+"redirect_to="+encodeURIComponent(v)},$formatNumber(v){return v&&v.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},$getRouteLink(v,S={}){return Oe(S,(T,V)=>{v=v.replace(":"+V,T)}),this.appVars.portal_url+v},isOnline(v){if(!v)return!1;const T=dayjs.utc(v,"YYYY-MM-DD HH:mm:ss").add(this.appVars.date_offset,"seconds").diff(dayjs.utc(),"minutes");return T<=5&&T>=0},setFollowIds(v){Be().setFollows(v)},$exportToCsv(v,S="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 T=Object.keys(v[0]),V=[T.join(",")];v.forEach(A=>{const U=T.map(B=>`"${String(A[B]??"").replace(/"/g,'""')}"`);V.push(U.join(","))});const P="\uFEFF"+V.join(` `),L=new Blob([P],{type:"text/csv;charset=utf-8;"}),x=document.createElement("a");x.href=URL.createObjectURL(L),x.download=S,document.body.appendChild(x),x.click(),document.body.removeChild(x),URL.revokeObjectURL(x.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",S=>{if(S.metaKey||S.ctrlKey)return;const T=S.target.closest("a");if(T&&T.target==="_blank")return;let V=S.target.getAttribute("href");if(V||T&&(V=T.getAttribute("href")),!!V){if(window.fluentComAdmin.is_absolute_url){let P=WP(V);if(P){if(window.fluentComAdmin.portal_paths.indexOf(P)===-1){document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:V}}));return}}else{let L=window.location.origin,x=new URL(V).origin;if(L==x&&new URL(V).search){document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:V}}));return}}}if(V.startsWith(window.fluentComAdmin.urls.portal_base)){if(V.indexOf("fcom_action")!==-1||V.startsWith(window.fluentComAdmin.urls.portal_base+"admin"))return;S.preventDefault(),V=V.replace(window.fluentComAdmin.urls.portal_base,"/"),this.$router.push(V)}else document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:V}}))}});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",S=>{if(window.__fcomNonceRenewInFlight)return;window.__fcomNonceRenewInFlight=!0;const T=()=>{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:V=>{location.reload()}}))};this.$ajax("GET","fluent_community_renew_nonce",{ajax_nonce:window.fluentComAdmin.ajax_nonce}).then(V=>{V&&V.rest_nonce?(window.fluentComAdmin.rest.nonce=V.rest_nonce,window.fluentComAdmin.ajax_nonce=V.ajax_nonce,window.__fcomNonceRenewInFlight=!1):T()}).catch(()=>{T()})})}}),de.config.globalProperties.$notify=Xo,de.config.globalProperties.$confirm=Ot.confirm,de.config.globalProperties.$promt=Ot.prompt,de.config.globalProperties.$messageBox=Ot,de.config.globalProperties.$gloablStorage={},de.config.globalProperties.currentTimeZoneName=window.dayjs.tz.guess();const t=window.FluentCommunityUtil.hooks.applyFilters("fluent_com_portal_routes",DP);t.push({path:"/:catchAll(.*)",name:"not-found",component:OP});let s=null;const u=["all_feeds","space_feeds","user_profile_feeds"];let o=null;const i=(v,S,T)=>{if(o&&o.abort(),S&&v.path===S.path&&v.query.comment_id!==S.query.comment_id)return!1;if(!u.includes(v==null?void 0:v.name))return T||{top:0};if(!T)return{top:0};o=new AbortController;const V=o.signal;return HP(T.top,{signal:V}).then(()=>V.aborted?!1:T)};window.fluentComAdmin.routing_system=="hash"?s=ks({routes:t,history:qo(),scrollBehavior:i}):s=ks({routes:t,history:Go(window.fluentComAdmin.portal_slug),scrollBehavior:i});const m=window.FluentCommunityUtil.hooks.applyFilters("fluent_com_portal_app",de),f=Mt();f.initialize(),window.fluentFrameworkApp=m.use(s).mount("#fluent_com_portal");const h=Be();h.initializeCurrentUser();const p=ss();document.addEventListener("fluent-notify-message",()=>os().check()),(b=(k=window.fluentComAdmin)==null?void 0:k.auth)!=null&&b.user_id&&((w=($=window.fluentComAdmin)==null?void 0:$.features)!=null&&w.notifications_polling)&&p.startPolling(6e4),(C=window.fluentComAdmin)!=null&&C.debug_mode&&(window.fcomDevTools={stores:{feed:Me(),space:He(),cache:re(),ui:f,user:h,notification:p},memory:{getStats:()=>{const v=Me(),S=re(),T=He(),V={feeds:v.getMemoryStats,cache:S.getCacheStats,spaces:{total:Object.keys(T.spacesBySlug).length,mySpaces:T.mySpaces.length}};if("memory"in performance){const P=performance.memory;V.browser={usedMB:(P.usedJSHeapSize/1048576).toFixed(2),totalMB:(P.totalJSHeapSize/1048576).toFixed(2),limitMB:(P.jsHeapSizeLimit/1048576).toFixed(2),percentage:(P.usedJSHeapSize/P.jsHeapSizeLimit*100).toFixed(2)+"%"}}return console.table(V),V},cleanup:()=>{const v=Me(),S=re();console.log("๐Ÿงน Running memory cleanup..."),v.pruneOldFeeds(),S.pruneLRU(),console.log("โœ… Cleanup complete"),window.fcomDevTools.memory.getStats()}},help:()=>{console.log(` ๐Ÿ› ๏ธ FluentCommunity DevTools Available commands: fcomDevTools.memory.getStats() - Show memory statistics fcomDevTools.memory.cleanup() - Run memory cleanup fcomDevTools.stores.feed - Access Feed Store fcomDevTools.stores.space - Access Space Store fcomDevTools.stores.cache - Access Cache Store fcomDevTools.stores.ui - Access UI Store `)}},console.log("๐Ÿ› ๏ธ FluentCommunity DevTools loaded. Type fcomDevTools.help() for available commands.")),document.dispatchEvent(new Event("fluentComPortalAppReady")),window.fluentFrameworkAppRouter=s}window.FluentCommunityUtil?Fs():document.addEventListener("fluentCommunityUtilReady",function(){Fs()});export{et as A,as as C,wo as D,eF as F,Fo as I,vk as L,xa as M,Eo as N,ms as S,_s as a,Ek as b,cs as c,ft as d,ET as e,He as u};