import{A as i,B as c,H as l,ae as g,a7 as D,I as R,P as a,F as r,E as v,K as _,M as d,O as L,ak as Q,G,L as V,_ as Y,z as q,ad as be,aw as Te,X as re,ab as ye,J as zt,ah as qt,C as vo,a3 as ot,Y as bo,T as ko,Q as ys,al as wo,aq as Co}from"./vue.js?ver=2.4.01";import{c as ds,a as $o,b as So}from"./vue-router.js?ver=2.4.01";import{d as He,m as Vo,a as vs,c as Lo,s as Mo}from"./pinia.js?ver=2.4.01";import{b6 as Fo,b7 as gt,$ as us,_ as To,a1 as Po,b8 as Io,at as _s,V as yt,b9 as Uo,ba as Fe,bb as Bo,bc as bs,m as ks,bd as Eo,be as Ao,k as Do,bf as Ro,bg as ws,M as Cs,bh as Ho,bi as xo,b as Gt,bj as jo,bk as Oo,bl as No,bm as zo,bn as qo,bo as Go,bp as Yo,bq as Wo,br as Zo,bs as Ko,bt as Jo,bu as Qo,bv as Xo,v as ei,h as ti,bw as si,bx as oi,by as ii,B as ni,bz as li,s as ai,x as ri,q as ci,n as di,bA as ui,L as _i,bB as mi,bC as hi,bD as fi,bE as pi,c as gi,bF as yi,bG as vi,R as bi,bH as ki,bI as wi,bJ as Ci,bK as $i,W as Si,G as Vi,bL as Li}from"./vendor.js?ver=2.4.01";import{E as N,a as Mi,b as O,c as W,d as fe,e as lt,f as X,g as _e,h as Ge,i as at,j as rt,k as Pe,l as Ye,m as ve,n as Ce,o as $s,p as Be,q as ge,r as oe,s as ie,t as vt,u as de,v as Ss,w as ue,x as ct,y as dt,z as ut,A as Vs,B as bt,C as kt,D as wt,F as Ct,G as Ls,H as Ee,I as Fi,J as Ms,K as Fs,L as Ti,M as Ts,N as Pi,O as Ps,P as Le,Q as xe,R as We,S as Yt,T as Wt,U as Is,V as Us,W as Bs,X as Zt,Y as Kt,Z as Ii,_ as Ui,$ as Bi,a0 as Ht}from"./element-plus.js?ver=2.4.01";import{_ as P,P as Ei,E as Ai}from"./emoji-picker.js?ver=2.4.01";import{o as Di,q as Jt,u as Ri,r as Hi,v as De,w as xi}from"./lodash.js?ver=2.4.01";import{H as ji,O as Oi,m as Ni,s as zi,c as qi,a as Gi,h as Yi,b as Wi,x as Zi,P as Ki,W as Ji,U as Qi,d as Xi,_ as en,u as xt,$ as tn,w as sn,r as on,L as ft,e as nn}from"./milkdown.js?ver=2.4.01";import"./dayjs.js?ver=2.4.01";const le=He("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 o=this.cache[e];if(!o)return this.stats.misses++,null;const u=Date.now()-o.timestamp,s=o.ttl||t||5*60*1e3;return u>s?(delete this.cache[e],this.stats.misses++,this.stats.size=Object.keys(this.cache).length,null):(this.stats.hits++,o.hits=(o.hits||0)+1,o.lastAccessed=Date.now(),o.data)},set(e,t,o=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:o},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(o=>{o.includes(e)&&(delete this.cache[o],t++)}),this.stats.size=Object.keys(this.cache).length,t},pruneLRU(e){const t=Object.entries(this.cache).map(([o,u])=>({key:o,lastAccessed:u.lastAccessed||u.timestamp})).sort((o,u)=>o.lastAccessed-u.lastAccessed).slice(0,e);return t.forEach(({key:o})=>{delete this.cache[o]}),this.stats.size=Object.keys(this.cache).length,t.length},pruneExpired(e=15*60*1e3){let t=0;const o=Date.now();return Object.entries(this.cache).forEach(([u,s])=>{o-s.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,o])=>{this.set(t,o)})}}}),qe=He("ui",{state:()=>({lastScrollPath:null,lastScrollPosition:0,lastViewedFeed:{},layoutStyle:null,sortBy:null,layoutStyleByContext:{},sortByContext:{},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},saveLastViewedFeed(e,t,o){this.lastViewedFeed[e]={feedId:t,index:o,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(o){console.error("Failed to save layout style:",o)}},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(o){console.error("Failed to save sort preference:",o)}},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))}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}}}),Ue=He("user",{state:()=>({currentUser:null,profilesByUsername:{},follows:{},followers:[],loading:{},lastFetched:{}}),getters:{getProfile:e=>t=>e.profilesByUsername[t]||null,isFollowing:e=>t=>{const o=e.follows[String(t)];return o!==void 0&&["1","2"].includes(String(o))},isBlocked:e=>t=>{const o=e.follows[String(t)];return o!==void 0&&String(o)==="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,o]of Object.entries(e)){const u=String(t);o==null?delete this.follows[u]:this.follows[u]=String(o)}},removeFollow(e){delete this.follows[String(e)]},async fetchProfile(e,t=!1){const o=le(),u=`user-profile:${e}`;if(!t){const s=o.get(u);if(s)return this.profilesByUsername[e]=s,s.follow!==void 0&&s.user_id&&this.setFollows({[s.user_id]:s.follow}),s}this.loading[e]=!0;try{const s=await this.$api.get(`profile/${e}`),n=s.profile;return n.follow!==void 0&&n.user_id&&this.setFollows({[n.user_id]:n.follow}),s.current_user_follows&&this.setFollows(s.current_user_follows),this.profilesByUsername[e]=n,this.lastFetched[e]=Date.now(),o.set(u,n,5*60*1e3),this.loading[e]=!1,n}catch(s){throw this.loading[e]=!1,console.error("Failed to fetch user profile:",s),s}},async updateProfile(e,t=null,o=null){var s;const u=le();try{const n=o?await this.$api.put(`profile/${o}`,{data:e}):await this.$api.put("profile",e),m=n.profile||n.user||n;return this.currentUser={...this.currentUser,...m},t&&t!==m.username&&(delete this.profilesByUsername[t],u.invalidate(`user-profile:${t}`)),m.username&&(this.profilesByUsername[m.username]=m,u.invalidate(`user-profile:${m.username}`)),(s=window.fluentComAdmin)!=null&&s.auth&&(window.fluentComAdmin.auth={...window.fluentComAdmin.auth,...m}),m}catch(n){throw console.error("Failed to update profile:",n),n}},async toggleFollow(e,t=null){var f,h,y;const o=le(),u=String(e),s=this.follows[u],n=s!==void 0&&["1","2"].includes(String(s)),m=s;n?(delete this.follows[u],t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count--,this.profilesByUsername[t].follow=void 0)):(this.follows[u]="1",t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count++,this.profilesByUsername[t].follow="1"));try{const w=n?`profile/${t}/unfollow`:`profile/${t}/follow`,b=await this.$api.post(w);return n?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),o.invalidate(`user-profile:${t}`)),(y=window.fluentFrameworkApp)!=null&&y.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("user_follow_toggled",{userId:e,isFollowing:!n}),b}catch(w){throw n?(this.follows[u]=m,t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count++,this.profilesByUsername[t].follow=m)):(delete this.follows[u],t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count--,this.profilesByUsername[t].follow=void 0)),console.error("Failed to toggle follow:",w),w}},async fetchFollowing(){const e=le(),t="user-following",o=e.get(t);if(o)return o;try{const u=await this.$api.get("profile/following"),s=u.following||u;return u.current_user_follows&&this.setFollows(u.current_user_follows),e.set(t,s,5*60*1e3),s}catch(u){throw console.error("Failed to fetch following:",u),u}},invalidateProfile(e){le().invalidate(`user-profile:${e}`),delete this.lastFetched[e]},clearAll(){this.currentUser=null,this.profilesByUsername={},this.follows={},this.followers=[],this.loading={},this.lastFetched={};const e=le();e.invalidatePattern("user-profile:"),e.invalidate("user-following")}}}),Ve=He("feed",{state:()=>({feedsByContext:{},feedsById:{},stickyFeeds:{},loading:{},pagination:{},filters:{},tickerIntervals:{},tickerEnabled:{},lastTickerCheck:{},tickerPending:{},newPostsCount:{},ticker:{count:0,lastFetched:0},executionTimes:{},_pendingRequests:{}}),getters:{getFeedsByContext:e=>t=>{const o=e.feedsByContext[t];return o?o.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(o=>{var u;t+=((u=o.data)==null?void 0:u.length)||0}),t},disableAutoLoad:e=>t=>{const o=e.loading[t]||!1,u=e.pagination[t];return u?o||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,o={};Object.keys(e.feedsByContext).forEach(n=>{var f,h;const m=((h=(f=e.feedsByContext[n])==null?void 0:f.data)==null?void 0:h.length)||0;o[n]=m,t+=m});const u=Object.keys(e.feedsById).length,s=(t*5/1024).toFixed(2);return{totalFeeds:t,feedsByContextCount:o,feedsByIdCount:u,estimatedMemoryMB:s,contexts:Object.keys(e.feedsByContext).length}}},actions:{async fetchFeeds(e,t={},o=!1){var h,y,w;if(console.log("[Feed Store] fetchFeeds called:",{context:e,loadMore:o,paramsPage:t.page,currentLoading:this.loading[e],currentPage:(h=this.pagination[e])==null?void 0:h.page}),this.loading[e]){console.log("[Feed Store] Already loading for context:",e,"- ignoring duplicate request");return}const u=o?(((y=this.pagination[e])==null?void 0:y.page)||0)+1:t.page||1,s={...t,page:u,per_page:t.per_page||10},n=`feeds:${e}:${JSON.stringify(s)}`,m=le();if(!o&&u===1){const b=m.get(n,3e5);if(b)return this.feedsByContext[e]=b.feedsByContext,this.pagination[e]=b.pagination,this.executionTimes[e]=b.executionTime,b.stickyFeed&&!window["viewed_sticky_posts_"+b.stickyFeed.id]?this.stickyFeeds[e]=b.stickyFeed:(this.stickyFeeds[e]=null,b.stickyFeed&&((w=this.feedsByContext[e])!=null&&w.data)&&(this.feedsByContext[e].data.some(C=>C.id===b.stickyFeed.id)||this.feedsByContext[e].data.unshift(b.stickyFeed))),b.feedsByContext.data.forEach(C=>{this.feedsById[C.id]=C}),this.loading[e]=!1,b}return this.loading[e]=!0,this.$api.get(t.feed_base_url||"feeds",s).then(b=>{var C,p,k,S;if(b.sticky){const $="viewed_sticky_posts_"+b.sticky.id;window[$]?(b.feeds.data.some(I=>I.id===b.sticky.id)||b.feeds.data.unshift(b.sticky),this.stickyFeeds[e]=null):this.stickyFeeds[e]=b.sticky}else u===1&&(this.stickyFeeds[e]=null);if(o){const $=((C=this.feedsByContext[e])==null?void 0:C.data)||[];this.feedsByContext[e]={data:[...$,...b.feeds.data],timestamp:Date.now()}}else this.feedsByContext[e]={data:b.feeds.data,timestamp:Date.now()};if(this.pagination[e]={page:u,per_page:s.per_page,total:b.feeds.total,last_page:b.feeds.last_page,has_more:b.feeds.has_more},console.log("[Feed Store] Updated pagination:",{context:e,page:u,has_more:b.feeds.has_more,total:b.feeds.total}),b.execution_time&&(this.executionTimes[e]=b.execution_time),b.feeds.data.forEach($=>{this.feedsById[$.id]={...$,timestamp:Date.now()}}),o){const $=((k=(p=this.feedsByContext[e])==null?void 0:p.data)==null?void 0:k.length)||0;$>500&&(console.log("[Feed Store] Pruning feeds, count:",$),this.pruneOldFeeds(e))}return b.last_fetched_timestamp&&(this.ticker.lastFetched=b.last_fetched_timestamp,(S=window.fluentFrameworkApp)!=null&&S.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("newest_feed_fetched",{last_fetched_timestamp:b.last_fetched_timestamp})),b.current_user_follows&&Ue().setFollows(b.current_user_follows),!o&&u===1&&m.set(n,{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(b=>{throw console.error("[Feed Store] Failed to fetch feeds:",b),this.loading[e]=!1,console.log("[Feed Store] Set loading to FALSE after error for context:",e),b})},async fetchFeedBySlug(e){const t=`feed:slug:${e}`,o=le(),u=o.get(t,10*60*1e3);if(u)return this.feedsById[u.id]=u,u;try{const n=(await this.$api.get(`feeds/${e}/by-slug`)).feed;return this.feedsById[n.id]={...n,timestamp:Date.now()},o.set(t,n),window.appVars&&(window.appVars.last_feed_id=n.id),n}catch(s){throw console.error("Failed to fetch feed:",s),s}},async createFeed(e,t){var o,u,s;try{const n=await this.$api.post("feeds",t),m=n.feed;if(this.feedsById[m.id]={...m,timestamp:Date.now()},!n.scheduled_at){const h=w=>{this.feedsByContext[w]||(this.feedsByContext[w]={data:[],timestamp:Date.now()}),this.stickyFeeds[w]&&(this.feedsByContext[w].data.some(C=>C.id===this.stickyFeeds[w].id)||this.feedsByContext[w].data.unshift(this.stickyFeeds[w]),this.stickyFeeds[w]=null);const b=this.feedsByContext[w].data.findIndex(C=>C.id===m.id);b===-1&&this.feedsByContext[w].data.unshift(m),this.pagination[w]?b===-1&&this.pagination[w].total++:this.pagination[w]={page:1,per_page:10,total:1,last_page:1,has_more:!1}};h(e),m.space_id&&e!=="global"&&(h("global"),le().invalidatePattern("feeds:global"));const y=`user-${m.user_id}`;this.feedsByContext[y]&&e!==y&&h(y)}return n.last_fetched_timestamp&&(this.ticker.lastFetched=n.last_fetched_timestamp,(o=window.FluentCommunityUtil)!=null&&o.eventBus&&((s=(u=window.fluentFrameworkApp)==null?void 0:u.$eventBus)==null||s.emit("newest_feed_fetched",{last_fetched_timestamp:n.last_fetched_timestamp}))),le().invalidatePattern(`feeds:${e}`),n}catch(n){throw console.error("Failed to create feed:",n),n}},async updateFeed(e,t){const o=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 s=this.feedsByContext[u].data.findIndex(n=>n.id===e);s!==-1&&(this.feedsByContext[u].data[s]={...this.feedsByContext[u].data[s],...t})});try{const s=(await this.$api.patch(`feeds/${e}`,t)).feed;return this.feedsById[e]={...this.feedsById[e],...s,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],...s})}),le().invalidatePattern("feed:"),s}catch(u){throw o&&(this.feedsById[e]=o,Object.keys(this.feedsByContext).forEach(s=>{const n=this.feedsByContext[s].data.findIndex(m=>m.id===e);n!==-1&&(this.feedsByContext[s].data[n]=o)})),console.error("Failed to update feed:",u),u}},async deleteFeed(e,t,o=null){try{return await this.$api.delete(`feeds/${t}`),delete this.feedsById[t],o!==null&&this.feedsByContext[e]?this.feedsByContext[e].data.splice(o,1):Object.keys(this.feedsByContext).forEach(s=>{var n;(n=this.feedsByContext[s])!=null&&n.data&&(this.feedsByContext[s].data=this.feedsByContext[s].data.filter(m=>m.id!==t))}),this.pagination[e]&&this.pagination[e].total--,le().invalidatePattern("feed:"),!0}catch(u){throw console.error("Failed to delete feed:",u),u}},async toggleBookmark(e){const t=this.feedsById[e];if(!t)return;const o=t.is_bookmarked;t.is_bookmarked=!o,Object.keys(this.feedsByContext).forEach(u=>{var n;const s=(n=this.feedsByContext[u].data)==null?void 0:n.findIndex(m=>m.id===e);s!==-1&&(this.feedsByContext[u].data[s].is_bookmarked=!o)});try{const u=await this.$api.post(`feeds/${e}/toggle-bookmark`);return t.is_bookmarked=u.is_bookmarked,Object.keys(this.feedsByContext).forEach(s=>{var m;const n=(m=this.feedsByContext[s].data)==null?void 0:m.findIndex(f=>f.id===e);n!==-1&&(this.feedsByContext[s].data[n].is_bookmarked=u.is_bookmarked)}),u}catch(u){throw t.is_bookmarked=o,Object.keys(this.feedsByContext).forEach(s=>{var m;const n=(m=this.feedsByContext[s].data)==null?void 0:m.findIndex(f=>f.id===e);n!==-1&&(this.feedsByContext[s].data[n].is_bookmarked=o)}),u}},async fetchTicker(e){var t,o,u;try{const s=e||this.ticker.lastFetched;console.log("[Legacy Ticker] Fetching ticker with timestamp:",s);const n=await this.$api.get("feeds/ticker",{last_fetched_timestamp:s});if(console.log("[Legacy Ticker] Response:",{has_changes:n.has_changes,feeds:((t=n.feeds)==null?void 0:t.length)||0,new_items_count:n.new_items_count}),this.ticker={count:n.new_items_count||0,lastFetched:n.last_fetched_timestamp||Date.now()},console.log("[Legacy Ticker] Checking if we should process feeds:",{has_changes:n.has_changes,feeds_exists:!!n.feeds,feeds_length:((o=n.feeds)==null?void 0:o.length)||0,feeds_data:n.feeds}),n.has_changes&&n.feeds&&n.feeds.length>0){console.log(`[Legacy Ticker] โœ… Processing ${n.feeds.length} feed updates`);const m={};n.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",n),this.ticker}catch(s){throw console.error("[Legacy Ticker] Failed to fetch ticker:",s),s}},resetTicker(){this.ticker.count=0},markStickyAsViewed(e,t){const o=this.stickyFeeds[e];o&&o.id===t&&(window["viewed_sticky_posts_"+t]=!0,this.feedsByContext[e]&&(this.feedsByContext[e].data.some(u=>u.id===o.id)||this.feedsByContext[e].data.unshift(o)),this.stickyFeeds[e]=null)},pruneOldFeeds(e=null){(e?[e]:Object.keys(this.feedsByContext)).forEach(u=>{var n;const s=((n=this.feedsByContext[u])==null?void 0:n.data)||[];if(s.length>500){const m=s.slice(0,s.length-500);this.feedsByContext[u].data=s.slice(s.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(y=>{var w;return(w=y.data)==null?void 0:w.some(b=>b.id===f.id)})||delete this.feedsById[f.id]})}})},resetContext(e){this.feedsByContext[e]={data:[],timestamp:0},this.pagination[e]={page:1,per_page:10,total:0,last_page:1,has_more:!1},this.stickyFeeds[e]=null,this.loading[e]=!1,this.executionTimes[e]="",le().invalidatePattern(`feeds:${e}`)},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 s;console.log(`[processTickerUpdates] Called for context: ${e} with ${t.length} updates`),console.log("[processTickerUpdates] Updates:",t);const o=[],u=[];if(t.forEach(n=>{console.log("[processTickerUpdates] Processing update:",{id:n.id,action:n.action,updated_at:n.updated_at});const m=this.feedsById[n.id];console.log("[processTickerUpdates] Existing feed in store:",m?{id:m.id,updated_at:m.updated_at}:"NOT IN STORE"),n.action==="deleted"?(console.log(`[processTickerUpdates] โžก๏ธ Marking feed ${n.id} for DELETION`),u.push(n.id)):n.action==="created"?(console.log(`[processTickerUpdates] โžก๏ธ Marking feed ${n.id} for FETCH (CREATED)`),o.push(n.id)):n.action==="updated"&&(!m||new Date(m.updated_at)0&&(console.log(`[processTickerUpdates] ๐Ÿ—‘๏ธ Deleting ${u.length} feeds from ${e}`),this.deleteFeedsFromStore(e,u)),o.length>0){console.log(`[processTickerUpdates] ๐Ÿ“ฅ Fetching ${o.length} feeds for ${e}`),await this.fetchFeedsByIds(e,o);const n=t.filter(m=>m.action==="created").length;n>0&&(this.newPostsCount[e]=(this.newPostsCount[e]||0)+n)}(s=window.fluentFrameworkApp)!=null&&s.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("feeds_updated",{context:e,added:o.filter(n=>!this.feedsById[n]).length,updated:o.filter(n=>this.feedsById[n]).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 o=20;try{if(t.length>o){console.log(`[Feed Store] Batching ${t.length} feeds into chunks of ${o}`);for(let u=0;u{this.feedsById[u.id]=u,this.feedsByContext[e]||(this.feedsByContext[e]={data:[],timestamp:Date.now()});const s=this.feedsByContext[e].data,n=s.findIndex(m=>m.id===u.id);n===-1?s.unshift(u):s[n]=u})}catch(o){throw console.error("[Feed Store] Failed to fetch batch for context:",e,o),o}},deleteFeedsFromStore(e,t){t.forEach(o=>{var s;delete this.feedsById[o],(s=this.feedsByContext[e])!=null&&s.data&&(this.feedsByContext[e].data=this.feedsByContext[e].data.filter(n=>n.id!==o)),le().invalidate(`feed:${o}`)}),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={}}}}),Re=He("space",{state:()=>({spacesBySlug:{},currentSpace:null,mySpaces:[],topicsBySpace:{},loading:{},mySpacesLoading:!1,lastFetched:{}}),getters:{getSpaceBySlug:e=>t=>e.spacesBySlug[t]||null,getCurrentSpace:e=>e.currentSpace,getSpaceTopics:e=>t=>e.topicsBySpace[t]||[],isJoinedSpace:e=>t=>e.mySpaces.some(o=>o.slug===t),getMySpaces:e=>[...e.mySpaces].sort((t,o)=>t.title.localeCompare(o.title)),isLoading:e=>t=>e.loading[t]||!1,joinedSpacesCount:e=>e.mySpaces.length},actions:{async fetchSpace(e,t=!1){const o=le(),u=`space:${e}`;if(!t){const s=o.get(u);if(s)return this.spacesBySlug[e]=s,this.currentSpace=s,s}this.loading[e]=!0;try{const s=await this.$api.get(`spaces/${e}/by-slug`),n=s.space||s;return this.spacesBySlug[e]=n,this.currentSpace=n,this.lastFetched[e]=Date.now(),s.topics&&(this.topicsBySpace[e]=s.topics),s.pending_count!==void 0&&(n.pending_count=s.pending_count),o.set(u,n,15*60*1e3),typeof window<"u"&&(window.fcom_current_community=n),this.loading[e]=!1,n}catch(s){throw this.loading[e]=!1,console.error("Failed to fetch space:",s),s}},async fetchMySpaces(e=!1){const t=le(),o="my-spaces";if(!e){const u=t.get(o);if(u)return this.mySpaces=u,u}this.mySpacesLoading=!0;try{const u=await this.$api.get("spaces/my-spaces"),s=u.spaces||u;return this.mySpaces=s,s.forEach(n=>{this.spacesBySlug[n.slug]=n}),t.set(o,s,10*60*1e3),this.mySpacesLoading=!1,s}catch(u){throw this.mySpacesLoading=!1,console.error("Failed to fetch my spaces:",u),u}},async joinSpace(e,t=null){var n,m,f;const o=le(),u=t||this.spacesBySlug[e];if(!u)throw new Error("Space not found");const s=((n=u.user_status)==null?void 0:n.status)==="active";s||(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`),y=h.space||h;this.spacesBySlug[e]=y,((m=this.currentSpace)==null?void 0:m.slug)===e&&(this.currentSpace=y);const w=this.mySpaces.findIndex(b=>b.slug===e);return w!==-1?this.mySpaces[w]=y:this.mySpaces.push(y),o.invalidate(`space:${e}`),o.invalidate("my-spaces"),(f=window.fluentFrameworkApp)!=null&&f.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("space_joined",y),y}catch(h){if(!s){u.user_status.status=null,u.members_count=Math.max(0,(u.members_count||1)-1);const y=this.mySpaces.findIndex(w=>w.slug===e);y!==-1&&this.mySpaces.splice(y,1)}throw console.error("Failed to join space:",h),h}},async leaveSpace(e){var m,f,h,y;const t=le(),o=this.spacesBySlug[e];if(!o)throw new Error("Space not found");const u=((m=o.user_status)==null?void 0:m.status)==="active",s=(f=o.user_status)==null?void 0:f.status,n=o.members_count;if(u){o.user_status.status=null,o.members_count=Math.max(0,(o.members_count||1)-1);const w=this.mySpaces.findIndex(b=>b.slug===e);w!==-1&&this.mySpaces.splice(w,1)}try{const w=await this.$api.post(`spaces/${e}/leave`),b=w.space||w;return this.spacesBySlug[e]=b,((h=this.currentSpace)==null?void 0:h.slug)===e&&(this.currentSpace=b),t.invalidate(`space:${e}`),t.invalidate("my-spaces"),(y=window.fluentFrameworkApp)!=null&&y.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("space_left",b),b}catch(w){throw u&&(o.user_status.status=s,o.members_count=n,this.mySpaces.push(o)),console.error("Failed to leave space:",w),w}},async fetchSpaceTopics(e,t=!1){const o=le(),u=`space-topics:${e}`;if(!t){const s=o.get(u);if(s)return this.topicsBySpace[e]=s,s}try{const s=await this.$api.get(`spaces/${e}/topics`),n=s.topics||s;return this.topicsBySpace[e]=n,o.set(u,n,30*60*1e3),n}catch(s){throw console.error("Failed to fetch space topics:",s),s}},setCurrentSpace(e){const t=this.spacesBySlug[e];t&&(this.currentSpace=t,typeof window<"u"&&(window.fcom_current_community=t))},clearCurrentSpace(){this.currentSpace=null,typeof window<"u"&&(window.fcom_current_community=null)},invalidateSpace(e){const t=le();t.invalidate(`space:${e}`),t.invalidate(`space-topics:${e}`),delete this.lastFetched[e]},clearAll(){this.spacesBySlug={},this.currentSpace=null,this.mySpaces=[],this.topicsBySpace={},this.loading={},this.mySpacesLoading=!1,this.lastFetched={};const e=le();e.invalidatePattern("space:"),e.invalidatePattern("space-topics:"),e.invalidate("my-spaces")}}}),Qt=He("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 o=await this.$api.get("notifications",{page:t,per_page:this.pagination.per_page});return e?this.notifications=[...this.notifications,...o.notifications.data]:this.notifications=o.notifications.data,this.pagination={page:t,per_page:this.pagination.per_page,total:o.notifications.total,has_more:o.notifications.has_more},this.unreadCount=o.unread_count||0,this.lastFetched=Date.now(),this.loading=!1,o}catch(o){throw this.loading=!1,console.error("Failed to fetch notifications:",o),o}},async fetchUnreadCount(){try{const e=await this.$api.get("notifications/unread-count");return this.unreadCount=e.count||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 o;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{await this.$api.post(`notifications/${e}/mark-read`),(o=window.fluentFrameworkApp)!=null&&o.$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(s=>s.object_id===e&&!s.is_read),o=this.unreadCount;t.forEach(s=>{s.is_read=!0}),this.unreadCount=Math.max(0,this.unreadCount-t.length);try{await this.$api.post(`notifications/mark-read-by-feed/${e}`),(u=window.fluentFrameworkApp)!=null&&u.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("feed_notifications_read",e)}catch(s){throw t.forEach(n=>{n.is_read=!1}),this.unreadCount=o,console.error("Failed to mark feed notifications as read:",s),s}},async markAllAsRead(){var o;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"),(o=window.fluentFrameworkApp)!=null&&o.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("all_notifications_read")}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"))},async deleteNotification(e){const t=this.notifications.findIndex(u=>u.id===e);let o=null;t!==-1&&(o=this.notifications[t],this.notifications.splice(t,1),o.is_read||(this.unreadCount=Math.max(0,this.unreadCount-1)));try{await this.$api.delete(`notifications/${e}`)}catch(u){throw o&&t!==-1&&(this.notifications.splice(t,0,o),o.is_read||this.unreadCount++),console.error("Failed to delete notification:",u),u}},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()}}}),Es=He("ticker",{state:()=>({tickerInterval:null,enabled:!1,lastCheck:null,pending:!1,errorCount:0,minInterval:45e3,maxInterval:75e3,paused:!1,visibilityHandler:null}),getters:{isActive:e=>e.enabled&&e.tickerInterval!==null,isPaused:e=>e.paused},actions:{start(e=45e3,t=75e3,o=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: ${o}ms)`),this.setupVisibilityHandler(),console.log(`[Global Ticker] First check scheduled in ${(o/1e3).toFixed(1)} seconds`),setTimeout(()=>{this.enabled&&(this.check(),this.scheduleNextCheck())},o)},scheduleNextCheck(){const 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(()=>{this.paused||this.check(),this.enabled&&this.scheduleNextCheck()},e)},stop(){this.tickerInterval&&(clearTimeout(this.tickerInterval),this.tickerInterval=null,this.enabled=!1,this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),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 n;const{feeds:t=[],notifications:o={},spaces:u=[],has_changes:s=!1}=e;if(o&&o.unread_count!==void 0&&this.processNotificationUpdates(o),!!s&&(console.log("[Global Ticker] Processing updates:",{feeds:t.length,notifications:o.unread_count||0,spaces:u.length}),t.length>0&&await this.processFeedUpdates(t),u.length>0&&this.processSpaceUpdates(u),(n=window.fluentFrameworkApp)!=null&&n.$eventBus)){const m={...e,unread_notification_count:o.unread_count||0};window.fluentFrameworkApp.$eventBus.emit("ticker_updated",m)}},async processFeedUpdates(e){console.log("[Ticker Debug] processFeedUpdates called with:",e);const t=Ve();e.forEach(o=>{var m;const u=o.context||"global",s=o.id,n=[u];if(o.action!=="deleted"&&(u.startsWith("space-")&&n.push("global"),o.user_id&&n.push(`user-${o.user_id}`)),o.action==="deleted")console.log(`[Global Ticker] Deleting feed ${s} from contexts:`,n),n.forEach(f=>{t.deleteFeedsFromStore(f,[s])});else if(o.feed_data){const f=o.feed_data;console.log(`[Global Ticker] Updating feed ${s} in contexts:`,n),n.forEach(h=>{t.feedsById[f.id]=f,t.feedsByContext[h]||(t.feedsByContext[h]={data:[],timestamp:Date.now()});const y=t.feedsByContext[h].data,w=y.findIndex(b=>b.id===f.id);w===-1?(y.unshift(f),console.log(`[Global Ticker] Added feed ${f.id} to ${h}`),o.action==="created"&&(t.newPostsCount[h]=(t.newPostsCount[h]||0)+1)):(y[w]=f,console.log(`[Global Ticker] Updated feed ${f.id} in ${h}`))}),(m=window.fluentFrameworkApp)!=null&&m.$eventBus&&n.forEach(h=>{window.fluentFrameworkApp.$eventBus.emit("feeds_updated",{context:h,added:o.action==="created"?1:0,updated:o.action==="updated"?1:0,removed:0})})}else console.warn(`[Global Ticker] Feed ${s} has no feed_data, skipping update`)})},processNotificationUpdates(e){const t=Qt();e.unread_count!==void 0&&(t.unreadCount=e.unread_count),e.new_count>0&&console.log("[Global Ticker] New notifications:",e.new_count)},processSpaceUpdates(e){console.log("[Global Ticker] Space updates:",e.length)},handleError(e){e.xhr_status!==404&&console.error("[Global Ticker] Check failed:",e),this.errorCount++;const t=Math.min(6e4,1e3*Math.pow(2,this.errorCount));console.warn(`[Global Ticker] Backing off for ${t}ms`),setTimeout(()=>{this.enabled&&!this.paused&&this.check()},t)},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))}}}),ln={name:"ChatIcon"},an={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function rn(e,t,o,u,s,n){return i(),c("svg",an,[...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 Ze=P(ln,[["render",rn]]),cn={name:"HeartIcon",props:{filled:{default:!1}}},dn={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},un={key:1,viewBox:"0 0 24 24","aria-hidden":"true"};function _n(e,t,o,u,s,n){return o.filled?(i(),c("svg",dn,[...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)])])):(i(),c("svg",un,[...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 Ke=P(cn,[["render",_n]]),mn={name:"NotificationsBlock",emits:["close"],components:{ChatIcon:Ze,HeartIcon:Ke},props:["notifications"],methods:{markRead(e,t){e.subscriber&&!e.subscriber.is_read||(this.notifications.splice(t,1),this.$post("notifications/mark-read/"+e.id).then(o=>{this.$eventBus.emit("notification_count_updated",o.unread_count)}))},getNotificationRoute(e){const{route:t,action:o,object_id:u,feed_id:s}=e;return{...t,query:{comment_added:{comment_id:u},mention_added:{comment_id:u},comment_report_added:{comment_id:s}}[o]??t.query??{}}}}},hn={class:"notification_avatar"},fn={class:"fcom_notification_type"},pn={class:"notification_content"},gn=["innerHTML"],yn=["title"];function vn(e,t,o,u,s,n){const m=g("UserAvatar"),f=g("ChatIcon"),h=N,y=g("HeartIcon"),w=g("router-link");return i(!0),c(L,null,D(o.notifications,(b,C)=>{var p;return i(),c("div",{class:R(["notification_wrap",{notification_wrap_unread:((p=b==null?void 0:b.subscriber)==null?void 0:p.is_read)=="0"}])},[a(w,{onClick:k=>n.markRead(b,C),to:n.getNotificationRoute(b),class:"notification_item"},{default:r(()=>[l("div",hn,[a(m,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"]),l("div",fn,[b.action=="comment_added"||b.action=="child_comment_added"?(i(),v(h,{key:0,class:"fcom_nt_comment"},{default:r(()=>[a(f)]),_:1})):b.action=="feed/react_added"?(i(),v(h,{key:1,class:"fcom_nt_heart"},{default:r(()=>[a(y,{filled:!0})]),_:1})):b.action=="feed/mentioned"||b.action=="mention_added"?(i(),v(h,{key:2,class:"fcom_nt_mention"},{default:r(()=>[a(f)]),_:1})):b.action=="space_feed/created"?(i(),v(h,{key:3,class:"fcom_new_post"},{default:r(()=>[...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",pn,[l("div",{innerHTML:b.content},null,8,gn),l("span",{title:b.updated_at,class:"notification_time_stamp"},d(e.humanDateDiff(b.updated_at)),9,yn)])]),_:2},1032,["onClick","to"])],2)}),256)}const As=P(mn,[["render",vn]]),bn={name:"NotificationIcon"},kn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function wn(e,t,o,u,s,n){return i(),c("svg",kn,[...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 Cn=P(bn,[["render",wn]]),$n={name:"Notifications",components:{NotificationsBlock:As,NotificationIcon:Cn},data(){return{unread_notifications:[],unread_count:parseInt(this.appVars.unread_notification_count),loading:!1,working:!1,visible:!1,notification_type:"all"}},methods:{switchType(e){this.notification_type=e,this.fetchUnread()},toggleNotifications(){this.loading=!0,this.visible=!this.visible,this.visible?this.fetchUnread():this.loading=!1},handleClose(){this.$refs.notification_pop.hide(),this.visible=!1},fetchUnread(){this.loading=!0,this.$get("notifications/unread",{notification_type:this.notification_type}).then(e=>{this.unread_notifications=e.notifications,this.appVars.unread_notification_count=e.unread_count,this.unread_count=e.unread_count}).catch(e=>{this.$handleError(e)}).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(){document.addEventListener("keydown",this.keyBind),this.$eventBus.on("ticker_updated",e=>{this.appVars.unread_notification_count=e.unread_notification_count,this.unread_count=e.unread_notification_count}),this.$eventBus.on("notification_count_updated",e=>{this.appVars.unread_notification_count=e,this.unread_count=e}),this.$eventBus.on("feed_interaction",e=>{e=e+"",this.appVars.unread_feed_ids&&this.appVars.unread_feed_ids.indexOf(e)!==-1&&this.$post("notifications/mark-read/"+e+"/by-feed-id").then(t=>{this.unread_count=t.unread_notification_count,this.appVars.unread_feed_ids=t.unread_feed_ids})})},beforeUnmount(){document.removeEventListener("keydown",this.keyBind)}},Sn={class:"fcom_menu_button",ref:"notification_icon"},Vn={class:"notifications_wrap unread_notifications"},Ln={class:"norification_pop_header"},Mn={class:"fcom_filter_menu"},Fn={class:"fcom_filter_menu_ul"},Tn={key:2,class:"fcom_no_unread_notifications"};function Pn(e,t,o,u,s,n){const m=g("NotificationIcon"),f=N,h=Mi,y=O,w=W,b=g("notifications-block"),C=g("router-link"),p=fe,k=Q("loading");return i(),v(p,{popperClass:"notification_pop",onBeforeEnter:t[6]||(t[6]=S=>n.toggleNotifications()),ref:"notification_pop",trigger:"click",placement:"bottom",width:500},{reference:r(()=>[a(h,{max:20,hidden:!s.unread_count,value:s.unread_count,class:"item"},{default:r(()=>[l("button",Sn,[a(f,null,{default:r(()=>[a(m)]),_:1})],512)]),_:1},8,["hidden","value"])]),default:r(()=>[l("div",Vn,[l("div",Ln,[l("h3",null,d(e.$t("Unread Notifications")),1),l("div",null,[G((i(),v(y,{disabled:s.working,size:"small",onClick:t[0]||(t[0]=S=>n.markAllRead())},{default:r(()=>[V(d(e.$t("Mark all as read")),1)]),_:1},8,["disabled"])),[[k,s.working]])])]),l("div",Mn,[l("ul",Fn,[l("li",null,[l("a",{onClick:t[1]||(t[1]=Y(S=>n.switchType("all"),["prevent"])),class:R({"router-link-exact-active":s.notification_type=="all"}),href:"#"},d(e.$t("All")),3)]),l("li",null,[l("a",{onClick:t[2]||(t[2]=Y(S=>n.switchType("mentioned"),["prevent"])),class:R({"router-link-exact-active":s.notification_type=="mentioned"}),href:"#"},d(e.$t("Mentions")),3)]),l("li",null,[l("a",{onClick:t[3]||(t[3]=Y(S=>n.switchType("following"),["prevent"])),class:R({"router-link-exact-active":s.notification_type=="following"}),href:"#"},d(e.$t("Following")),3)])])]),s.loading?(i(),v(w,{key:0,style:{"margin-top":"15px"},animated:!0,rows:2})):s.unread_notifications.length?(i(),c("div",{key:1,onClick:t[5]||(t[5]=S=>e.$refs.notification_pop.hide()),class:"notifications"},[a(b,{onClose:t[4]||(t[4]=S=>n.handleClose()),notifications:s.unread_notifications},null,8,["notifications"])])):(i(),c("div",Tn,[l("p",null,d(e.$t("No unread notifications found")),1)])),a(C,{class:"fcom_view_all_notifications",to:{name:"notifications"},onClick:n.handleClose},{default:r(()=>[a(y,{class:"fcom_secondary_button"},{default:r(()=>[V(d(e.$t("View All")),1)]),_:1})]),_:1},8,["onClick"])])]),_:1},512)}const In=P($n,[["render",Pn]]),Un={name:"ImageUploader",emits:["uploaded","completed","uploading"],data(){return{loading:!1}},props:{button_text:{type:String,default:""},additionalData:{type:Object,default:()=>({})},isMultiple:{type:Boolean,default:!1},can_remove:{type:Boolean,default:!1},isTextBtn:{type:Boolean,default:!0},removeIcon:{type:Boolean,default:!0},className:{type:String,default:"image-uploader"}},methods:{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 Bn(e,t,o,u,s,n){const m=O,f=lt,h=g("CloseBold"),y=N,w=Q("loading");return i(),c(L,null,[a(f,{class:R(o.className),multiple:o.isMultiple,action:n.action_url,headers:n.headers,accept:"image/*",data:o.additionalData,"on-success":n.handleSuccess,"on-progress":n.inProgress,"on-error":n.handleError,"show-file-list":!1},{default:r(()=>[q(e.$slots,"trigger",{},()=>[q(e.$slots,"default",{},()=>[G((i(),v(m,{disabled:s.loading,text:o.isTextBtn,class:"fcom_plain_button"},{default:r(()=>[V(d(o.button_text||e.$t("Upload Photo")),1)]),_:1},8,["disabled","text"])),[[w,s.loading]])])])]),_:3},8,["class","multiple","action","headers","data","on-success","on-progress","on-error"]),o.can_remove?(i(),v(m,{key:0,class:"remove_img",size:"small",type:"danger",plain:"",onClick:t[0]||(t[0]=b=>e.$emit("uploaded","")),text:o.isTextBtn},{default:r(()=>[q(e.$slots,"remove",{},()=>[o.removeIcon?(i(),v(y,{key:0},{default:r(()=>[a(h)]),_:1})):_("",!0),l("span",null,d(e.$t("Remove")),1)])]),_:3},8,["text"])):_("",!0)],64)}const je=P(Un,[["render",Bn]]),En={name:"ImageIcon"},An={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Dn(e,t,o,u,s,n){return i(),c("svg",An,[...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 Xt=P(En,[["render",Dn]]),Rn={name:"PollIcon"},Hn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function xn(e,t,o,u,s,n){return i(),c("svg",Hn,[...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 jn=P(Rn,[["render",xn]]),On={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)}}},Nn={class:"fcom_compose_app_form"},zn={class:"fcom_app_header"},qn={class:"fcom_app_options"},Gn={class:"fcom_app_pref"},Yn={class:"fcom_app_footer"},Wn={style:{"font-weight":"500",color:"var(--el-text-color-regular)","font-size":"14px"}};function Zn(e,t,o,u,s,n){const m=O,f=X,h=g("Plus"),y=N,w=_e,b=Ge;return i(),c("div",Nn,[l("div",zn,[l("h5",null,d(e.$t("Poll Options")),1),l("div",null,[a(m,{onClick:t[0]||(t[0]=C=>e.$emit("cancel")),size:"small",text:""},{default:r(()=>[V(d(e.$t("cancel")),1)]),_:1})])]),l("div",qn,[(i(!0),c(L,null,D(o.form.options,(C,p)=>(i(),c("div",{class:"fcom_app_option",key:"option_"+p},[a(f,{modelValue:C.label,"onUpdate:modelValue":k=>C.label=k,type:"text",placeholder:e.$t("Your option text")},be({_:2},[!C.slug&&p!==0?{name:"suffix",fn:r(()=>[a(m,{onClick:k=>n.removeOption(p),text:"",size:"small"},{default:r(()=>[...t[3]||(t[3]=[V("x",-1)])]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","onUpdate:modelValue","placeholder"])]))),128)),l("div",Gn,[a(m,{onClick:n.addOption,text:"",size:"small"},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1}),l("span",null,d(e.$t("Add More")),1)]),_:1},8,["onClick"])])]),l("div",Yn,[l("h5",null,d(e.$t("Poll Settings")),1),o.is_editing?_("",!0):(i(),v(w,{key:0,modelValue:o.form.type,"onUpdate:modelValue":t[1]||(t[1]=C=>o.form.type=C),"true-value":"multi_choice","false-value":"single_choice",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Users can choose multiple options")),1)]),_:1},8,["modelValue"])),t[4]||(t[4]=l("br",null,null,-1)),l("label",Wn,d(e.$t("End Date:")),1),l("div",null,[a(b,{style:{"min-width":"50%"},placeholder:e.$t("Leave blank for not end"),clearable:!0,type:"datetime",modelValue:o.form.end_date,"onUpdate:modelValue":t[2]||(t[2]=C=>o.form.end_date=C),"value-format":"YYYY-MM-DD HH:mm:ss"},null,8,["placeholder","modelValue"])])])])}const Kn=P(On,[["render",Zn]]),Jn={name:"GiphyIcon"},Qn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Xn(e,t,o,u,s,n){return i(),c("svg",Qn,[...t[0]||(t[0]=[Te('',5)])])}const el=P(Jn,[["render",Xn]]),tl={name:"Giphy",components:{GiphyIcon:el},data(){return{gifs:[],searchQuery:"",offset:0,limit:20,loading:!1}},methods:{loadGifs(){var t,o;if(((o=(t=this.$gloablStorage)==null?void 0:t.gifs)==null?void 0:o.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:Di(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()}}},sl={class:"fcom_giphy_composer"},ol={class:"search-container"},il=["onLoad","src","alt","onClick"],nl={key:0,class:"img_loading"},ll={key:1,class:"no_result"};function al(e,t,o,u,s,n){const m=X,f=at,h=rt,y=g("GiphyIcon"),w=N,b=O,C=fe,p=Q("loading");return i(),c("div",sl,[a(C,{placement:"bottom-end",width:300,persistent:!1,trigger:"click","popper-class":"fcom_giphy_popover",ref:"popover"},{reference:r(()=>[a(b,{"aria-label":"Pick GIF",text:"",onClick:n.handleGiphyClick},{default:r(()=>[a(w,{class:R(["fcom_apps_icon"])},{default:r(()=>[a(y)]),_:1})]),_:1},8,["onClick"])]),default:r(()=>[G((i(),c("div",ol,[a(m,{modelValue:s.searchQuery,"onUpdate:modelValue":t[0]||(t[0]=k=>s.searchQuery=k),placeholder:e.$t("Search Gifs"),onInput:n.handleSearch},null,8,["modelValue","placeholder","onInput"]),l("div",{class:"gif_container",onScroll:t[1]||(t[1]=(...k)=>n.handleScroll&&n.handleScroll(...k))},[s.gifs.length>0?(i(),v(h,{key:0,gutter:5},{default:r(()=>[(i(!0),c(L,null,D(s.gifs,k=>(i(),v(f,{span:12,key:k.id,class:"gif_item"},{default:r(()=>[l("img",{alt:"",onLoad:S=>k.loaded=!0,src:k.images.preview_gif.url,onClick:S=>n.selectGiphy(k)},null,40,il),k.loaded?_("",!0):(i(),c("p",nl))]),_:2},1024))),128))]),_:1})):(i(),c("p",ll,d(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))])),[[p,s.loading]])]),_:1},512)])}const rl=P(tl,[["render",al]]),cl={name:"VideoIcon"},dl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function ul(e,t,o,u,s,n){return i(),c("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 _l=P(cl,[["render",ul]]);const ml={name:"FluentPlayerPreview",emits:["load-failed"],props:{media:{type:Object,required:!0}},data(){return{html:"",loading:!1,playerInstanceKey:""}},watch:{"media.url"(){this.loadFluentPlayerContent()}},async mounted(){await this.loadFluentPlayerContent()},methods:{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,s,n,m,f,h,y,w,b,C,p,k;const e=Number.parseInt((u=this.media)==null?void 0:u.media_id,10);if(Number.isSafeInteger(e)&&e>0)return e;const t=[(s=this.media)==null?void 0:s.media_key,(n=this.media)==null?void 0:n.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,(y=this.media)==null?void 0:y.url,(w=this.media)==null?void 0:w.html,(b=this.media)==null?void 0:b.title,(C=this.media)==null?void 0:C.player,(p=this.media)==null?void 0:p.type,(k=this.media)==null?void 0:k.provider].filter(Boolean).join("|");if(!t)return 1;let o=5381;for(let S=0;S>>0;return o||1},async loadFluentPlayerContent(){this.loading=!0;try{if(!this.appVars.features.has_fluent_player||this.appVars.features.enable_fluent_player!=="yes"){this.$emit("load-failed");return}const e=this.getStableMediaId(),t=await this.$get("fluent-player/video-content/"+e,{...this.media,media_id:e,player_instance_key:this.getPlayerInstanceKey()});t.html?(this.html=t.html,this.$nextTick(()=>{const o=this.$el.querySelector(".fluent-player");document.dispatchEvent(new CustomEvent("InitSingleFluentPlayer",{detail:{container:o,playerData:{media:t.media}}}))})):this.$emit("load-failed")}catch(e){console.warn("Failed to load fluent-player assets:",e),this.$emit("load-failed")}finally{this.loading=!1}}}},hl={class:"fluent-player-preview"},fl={key:0,class:"player-container"},pl=["innerHTML"];function gl(e,t,o,u,s,n){const m=W;return i(),c("div",hl,[s.html?(i(),c("div",fl,[l("div",{innerHTML:s.html},null,8,pl)])):_("",!0),s.loading?(i(),v(m,{key:1,animated:"",rows:5})):_("",!0)])}const yl=P(ml,[["render",gl],["__scopeId","data-v-53b0e6e6"]]);const vl={name:"MediaPreview",components:{Postcard:Fo,FluentPlayerPreview:yl},props:["feed","media_item","is_single"],data(){return{is_error:!1,isPlaying:!1,fluentPlayerFailed:!1}},watch:{"media.url"(){this.fluentPlayerFailed=!1}},computed:{media(){var e;return this.feed?(e=this.feed.meta)==null?void 0:e.media_preview:this.media_item},playerMedia(){var e,t,o,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:((o=this.feed)==null?void 0:o.permalink)||((u=this.media)==null?void 0:u.share_url)||""}},isVideoMedia(){return["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:{getDomainName(e){return e?e.split("/")[2].replace("www.",""):""},isSupportedByFluentPlayer(){var o,u;const e=((u=(o=this.media)==null?void 0:o.settings)==null?void 0:u.src)||this.media.url;return!e||!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)(\?.*)?$/i}].some(s=>s.regex.test(e))},getAspectRatio(e,t){if(e&&t){let o=e/t;return o<1?16/9:o}return 16/9},handleImageError(){this.is_error=!0},getVideoType(e){const t={mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg"},o=e.split(".").pop().toLowerCase();return t[o]||"video/mp4"},playVideo(){this.$refs.nativeVideo&&this.$refs.nativeVideo.play()},onVideoPause(){this.$refs.nativeVideo&&this.$refs.nativeVideo.currentTime>0&&(this.isPlaying=!0)}}},bl={key:0},kl={key:1},wl=["innerHTML"],Cl=["controls","preload","poster"],$l=["src","type"],Sl=["href"],Vl={key:0,class:"feed_media_image"},Ll={key:1,class:"feed_media_content"},Ml={class:"media_domain"},Fl={class:"feed_media_title"},Tl={key:0,class:"feed_media_description"},Pl={class:"feed_meta_desc"};function Il(e,t,o,u,s,n){const m=g("fluent-player-preview"),f=W,h=Pe;return i(),c("div",{class:R(["feed_media","feed_media_"+n.media.type])},[n.isVideoMedia?(i(),c(L,{key:0},[n.hasFluentPlayer&&n.isSupportedByFluentPlayer()&&!s.fluentPlayerFailed?(i(),c("div",bl,[a(m,{media:n.playerMedia,onLoadFailed:t[0]||(t[0]=y=>s.fluentPlayerFailed=!0)},null,8,["media"])])):n.media.html?(i(),c("div",kl,[l("div",{class:"feed_media_ext_video",innerHTML:n.media.html},null,8,wl)])):n.media.url?(i(),c("div",{key:2,class:R(["native_video_wrapper",{video_playing:s.isPlaying}])},[l("video",{ref:"nativeVideo",class:"native_video_player",controls:s.isPlaying,preload:o.is_single?"metadata":"none",poster:n.media.thumbnail,onPlay:t[1]||(t[1]=y=>s.isPlaying=!0),onPause:t[2]||(t[2]=(...y)=>n.onVideoPause&&n.onVideoPause(...y)),onEnded:t[3]||(t[3]=y=>s.isPlaying=!1)},[l("source",{src:n.media.url,type:n.getVideoType(n.media.url)},null,8,$l)],40,Cl),s.isPlaying?_("",!0):(i(),c("div",{key:0,class:"native_video_overlay",onClick:t[4]||(t[4]=(...y)=>n.playVideo&&n.playVideo(...y))},[...t[6]||(t[6]=[l("div",{class:"native_play_button"},[l("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[l("path",{d:"M8 5v14l11-7z"})])],-1)])]))],2)):_("",!0)],64)):n.media.type=="image"||n.media.is_uploaded?(i(),c("div",{key:1,class:R(["feed_media_provider_"+n.media.provider,"feed_media_image feed_custom_uploaded"])},[n.media.image&&!s.is_error?(i(),v(h,{key:0,alt:"",style:re({width:"100%",aspectRatio:n.getAspectRatio(n.media.width,n.media.height)}),src:n.media.image,lazy:!0,previewSrcList:[n.media.image],loading:"lazy",onError:n.handleImageError,"zoom-rate":1.2,"max-scale":7,"hide-on-click-modal":!0,"preview-teleported":!0,"min-scale":.2,"initial-index":1,class:R("fcom_media_provider_"+n.media.provider),fit:"scale-down"},{placeholder:r(()=>[a(f,{animated:!0})]),_:1},8,["style","src","previewSrcList","onError","class"])):_("",!0)],2)):(i(),c("a",{key:2,href:n.media.url,target:"_blank",rel:"noopener",class:"feed_media_link"},[n.media.image&&!s.is_error?(i(),c("div",Vl,[a(h,{onError:t[5]||(t[5]=y=>n.handleImageError()),style:{width:"100%"},src:n.media.image},{error:r(()=>[...t[7]||(t[7]=[l("span",null,null,-1)])]),_:1},8,["src"])])):_("",!0),n.media.title?(i(),c("div",Ll,[l("div",Ml,d(n.getDomainName(n.media.url)),1),l("div",Fl,d(e.getExcerpt(n.media.title,88)),1),n.media.description?(i(),c("div",Tl,[l("div",Pl,d(e.getExcerpt(n.media.description,160)),1)])):_("",!0)])):_("",!0)],8,Sl))],2)}const Ae=P(vl,[["render",Il],["__scopeId","data-v-c28b0c69"]]);const Ul=[{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)(\?.*)?$/i}],Bl={name:"FluentPlayerUploader",components:{UploadFilled:gt},emits:["video-added","completed","uploading"],props:{className:{type:String,default:"video-uploader"},type:{type:String,default:"url"}},data(){return{videoUrl:"",processing:!1}},computed:{uploadData(){return{context:"fluent_player"}},action_url(){return this.appVars.rest.url+"/fluent-player/video-upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}}},methods:{async handleUrlSubmit(){if(!this.videoUrl)return;const e=Ul.some(o=>o.regex.test(this.videoUrl));let t={};e?t={type:"oembed",url:this.videoUrl,html:"",content_type:"video",player:"fluent_player",media_id:new Date().getTime()}:t={type:"oembed",url:this.videoUrl,html:"",content_type:"video"},this.$emit("video-added",t)},handleVideoUploadSuccess(e){var t;try{if(!e||!e.media||!e.media.url)throw new Error("Invalid response: missing media.url");const{media:o}=e,u={type:"upload",url:o.url,player:"fluent_player",provider:"upload",content_type:"video",html:"",title:((t=o.settings)==null?void 0:t.title)||"",media_id:o.media_id};this.$emit("video-added",u)}catch(o){console.error("[FluentPlayerUploader] handleVideoUploadSuccess error:",o,e)}finally{this.$emit("completed",e),this.processing=!1}},handleError(e){try{const t=(e==null?void 0:e.message)||e;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}}},El=["element-loading-text"],Al={key:0,class:"upload-options"},Dl={class:"uploader-content"},Rl={key:1,class:"url-input-section"};function Hl(e,t,o,u,s,n){const m=g("upload-filled"),f=N,h=O,y=lt,w=X,b=Q("loading");return G((i(),c("div",{class:"fluent-player-uploader","element-loading-text":e.$t("Uploading video..."),"element-loading-background":"rgba(255, 255, 255, 0.85)"},[o.type==="upload"?(i(),c("div",Al,[a(y,{drag:"",class:R([o.className,"video-drag-uploader"]),multiple:!1,action:n.action_url,headers:n.headers,accept:"video/*",data:n.uploadData,"on-success":n.handleVideoUploadSuccess,"on-progress":n.inProgress,"on-error":n.handleError,"show-file-list":!1,disabled:s.processing},{default:r(()=>[l("div",Dl,[a(f,{class:"el-icon--upload"},{default:r(()=>[a(m)]),_:1}),t[1]||(t[1]=l("div",{class:"el-upload__text"},[V(" Drop file here or "),l("em",null,"upload by clicking")],-1)),a(h,{type:"primary",class:"upload-button",loading:s.processing,disabled:s.processing},{default:r(()=>[q(e.$slots,"trigger",{},()=>[q(e.$slots,"default",{},()=>[V(d(s.processing?e.$t("Uploading..."):e.$t("Upload Video")),1)])])]),_:3},8,["loading","disabled"])])]),_:3},8,["class","action","headers","data","on-success","on-progress","on-error","disabled"])])):(i(),c("div",Rl,[a(w,{modelValue:s.videoUrl,"onUpdate:modelValue":t[0]||(t[0]=C=>s.videoUrl=C),type:"url",placeholder:e.$t("Enter video URL"),size:"large"},{append:r(()=>[a(h,{onClick:n.handleUrlSubmit,loading:s.processing},{default:r(()=>[V(d(e.$t("Embed")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["modelValue","placeholder"])]))],8,El)),[[b,s.processing]])}const xl=P(Bl,[["render",Hl]]),jl={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:Ae,FluentPlayerUploader:xl},computed:{showPreview(){return this.media.html&&!this.showInput},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},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}},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(){this.media.content_type="video",this.$emit("embeded",this.media),this.showInput=!1},handleFluentPlayerVideo(e){if(Object.assign(this.media,e),this.media.player==="fluent_player"&&this.media.type==="upload"){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()}},Ol={key:0},Nl={key:0,class:"fcom_media_editor_actions"},zl={key:1,class:"fcom_media_editor fcom_media_embeder"},ql={key:0},Gl={key:1},Yl={key:2,class:"fcom_course_media"};function Wl(e,t,o,u,s,n){var p;const m=O,f=Ye,h=ve,y=X,w=g("fluent-player-uploader"),b=g("media-preview"),C=Q("loading");return s.appReady?G((i(),c("div",Ol,[o.has_iframe||n.hasUpload?(i(),c("div",Nl,[n.showPreview?(i(),v(m,{key:0,onClick:t[0]||(t[0]=k=>s.showInput=!0),type:"danger",size:"small",text:""},{default:r(()=>[V(d(e.$t("Edit media")),1)]),_:1})):(i(),v(h,{key:1,onChange:t[1]||(t[1]=k=>{o.media.html="",o.media.url="",s.showInput=!0}),size:"small",modelValue:o.media.type,"onUpdate:modelValue":t[2]||(t[2]=k=>o.media.type=k)},{default:r(()=>[a(f,{label:e.$t("Oembed"),value:"oembed"},null,8,["label"]),o.has_iframe?(i(),v(f,{key:0,label:e.$t("HTML Code"),value:"iframe_html"},null,8,["label"])):_("",!0),n.hasUpload?(i(),v(f,{key:1,label:e.$t("Upload Video"),value:"upload"},null,8,["label"])):_("",!0)]),_:1},8,["modelValue"]))])):_("",!0),n.showPreview?(i(),c("div",Yl,[a(b,{media_item:o.media},null,8,["media_item"])])):(i(),c("div",zl,[o.media.type=="iframe_html"&&o.has_iframe?(i(),c(L,{key:0},[l("h3",null,d(e.$t("Add Video from custom HTML Code")),1),a(y,{rows:5,modelValue:o.media.html,"onUpdate:modelValue":t[3]||(t[3]=k=>o.media.html=k),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]=k=>n.handleAddCustomHtml())},{default:r(()=>[V(d(e.$t("Embed")),1)]),_:1})],64)):(i(),c(L,{key:1},[l("h3",null,d(o.box_title||e.$t("Featured media")),1),n.hasFluentPlayerInstalled&&o.media.type==="upload"?(i(),c("p",ql,d(e.$t("The file must be a valid video type (MP4, M3U8, MPD, WebM, MOV)")),1)):(i(),c("p",Gl,d(o.box_description||e.$t("Embed from Vimeo, YouTube, Wistia and more")),1)),n.hasFluentPlayer&&(o.media.type==="upload"||n.playEmbeddedVideos)?(i(),v(w,{key:2,type:((p=o.media)==null?void 0:p.type)==="upload"?"upload":"url",onVideoAdded:n.handleFluentPlayerVideo},null,8,["type","onVideoAdded"])):(i(),v(y,{key:3,onKeydown:ye(n.fetchData,["enter"]),size:"large",modelValue:o.media.url,"onUpdate:modelValue":t[5]||(t[5]=k=>o.media.url=k),type:"url",placeholder:e.$t("Paste a URL to embed")},{append:r(()=>[a(m,{onClick:n.fetchData,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Embed")),1)]),_:1},8,["onClick"])]),_:1},8,["onKeydown","modelValue","placeholder"]))],64))]))])),[[C,s.fetching]]):_("",!0)}const es=P(jl,[["render",Wl]]),Zl={name:"VideoEmbeder",emits:["embeded"],props:["is_admin","space"],components:{MediaEmbeder:es,VideoIcon:_l},data(){return{videoUrl:"",showVideoPop:!1,media:{type:"oembed",url:"",inner_html:"",content_type:"video"}}},methods:{show(){this.showVideoPop=!0},embeded(e){this.$emit("embeded",e),this.showVideoPop=!1,this.media={type:"oembed",url:"",inner_html:"",content_type:"video"}}}},Kl={class:"fcom_video_embeder"};function Jl(e,t,o,u,s,n){const m=g("VideoIcon"),f=N,h=O,y=g("media-embeder"),w=Ce;return i(),c("div",Kl,[a(h,{"aria-label":"Add Video",text:"",onClick:n.show},{default:r(()=>[a(f,{class:R(["fcom_apps_icon"])},{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClick"]),s.showVideoPop?(i(),v(w,{key:0,title:e.$t("Attach Video"),modelValue:s.showVideoPop,"onUpdate:modelValue":t[0]||(t[0]=b=>s.showVideoPop=b),width:e.dialogWidth,style:{"max-width":"600px"},"append-to-body":!0},{default:r(()=>[a(y,{box_title:e.$t("Add Featured Video for this post"),has_iframe:o.is_admin,is_feed:!0,onEmbeded:n.embeded,space:o.space,media:s.media},null,8,["box_title","has_iframe","onEmbeded","space","media"])]),_:1},8,["title","modelValue","width"])):_("",!0)])}const Ql=P(Zl,[["render",Jl]]),Xl="modulepreload",ea=function(e){return"/"+e},ms={},et=function(t,o,u){if(!o||o.length===0)return t();const s=document.getElementsByTagName("link");return Promise.all(o.map(n=>{if(n=ea(n),n in ms)return;ms[n]=!0;const m=n.endsWith(".css"),f=m?'[rel="stylesheet"]':"";if(!!u)for(let w=s.length-1;w>=0;w--){const b=s[w];if(b.href===n&&(!m||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${f}`))return;const y=document.createElement("link");if(y.rel=m?"stylesheet":Xl,m||(y.as="script",y.crossOrigin=""),y.href=n,document.head.appendChild(y),m)return new Promise((w,b)=>{y.addEventListener("load",w),y.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${n}`)))})})).then(()=>t()).catch(n=>{const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=n,window.dispatchEvent(m),!m.defaultPrevented)throw n})};var Ds=(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))(Ds||{});const ta={cursor:!0,"link-tooltip":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,"image-block":!0};async function sa(e,t,o){switch(e){case"link-tooltip":{const{defineFeature:u}=await et(()=>import("./index.js?ver=2.4.01"),[]);return u(t,o)}case"block-edit":{const{defineFeature:u}=await et(()=>import("./index2.js?ver=2.4.01"),[]);return u(t,o)}case"placeholder":{const{defineFeature:u}=await et(()=>import("./index3.js?ver=2.4.01"),[]);return u(t,o)}case"toolbar":{const{defineFeature:u}=await et(()=>import("./index4.js?ver=2.4.01"),[]);return u(t,o)}case"image-block":{const{defineFeature:u}=await et(()=>import("./index5.js?ver=2.4.01"),[]);return u(t,o)}}}const oa=ji([],"FeaturesCtx");function ia(e){return t=>{t.inject(oa,e)}}var ts=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)},he=(e,t,o)=>(ts(e,t,"read from private field"),o?o.call(e):t.get(e)),Ne=(e,t,o)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,o)},tt=(e,t,o,u)=>(ts(e,t,"write to private field"),u?u.call(e,o):t.set(e,o),o),na=(e,t,o)=>(ts(e,t,"access private method"),o),we,st,it,pt,ze,jt,Rs;class Hs{constructor({root:t,features:o={},featureConfigs:u={},defaultValue:s="",onUpdate:n=f=>{},handleCommonActions:m=(f,h)=>{}}){var w;Ne(this,jt),Ne(this,we,void 0),Ne(this,st,void 0),Ne(this,it,void 0),Ne(this,pt,!0),Ne(this,ze,null);const f=Object.entries({...ta,...o}).filter(([,b])=>b).map(([b])=>b);tt(this,it,(typeof t=="string"?document.querySelector(t):t)??document.body),tt(this,we,Oi.make().config(ia(f)).config(b=>{b.set(Ni,he(this,it)),b.set(zi,s),b.set(qi,{editable:()=>he(this,pt)})}).config(b=>{const C=async(p,k)=>await m("handleFileUpload",{ctx:b,files:p,schema:k});b.update(Gi.key,p=>({...p,uploader:C}))}).config(b=>{const C=b.get(Yi);C.markdownUpdated((p,k,S)=>{k!==S&&n(k)}),C.updated((p,k,S)=>{m("editor_updated",p)})}).use(Wi).use(Zi).use(Ki).use(Ji).use(Qi).use(Xi).use(en));const h=(w=u==null?void 0:u["block-edit"])==null?void 0:w.canAddImage;h&&he(this,we).use(xt(()=>new us({filterTransaction:b=>b.docChanged?!b.steps.some(p=>{var S,$;let k=!1;return($=(S=p.slice)==null?void 0:S.content)==null||$.forEach(I=>{var F;I.type.name.includes("image")&&(k=!0),(F=I.content)==null||F.forEach(B=>{B.type.name.includes("image")&&(k=!0)})}),k})||h():!0}))),he(this,we).use(xt(()=>new us({key:new To("link-non-inclusive"),appendTransaction:(b,C,p)=>{var M,E;const k=p.schema.marks.link;if(!k||!b.some(A=>A.docChanged))return null;const S=p.selection.$cursor;if(!S||S.pos<2)return null;const $=S.pos-1,I=S.pos;if(p.doc.textBetween($,I)!==" "||!p.doc.rangeHasMark($,I,k))return null;const F=(M=p.doc.resolve($).nodeBefore)==null?void 0:M.marks.find(A=>A.type===k),B=(E=p.doc.resolve(I).nodeAfter)==null?void 0:E.marks.find(A=>A.type===k);return B&&(F==null?void 0:F.attrs.href)===B.attrs.href?null:p.tr.removeMark($,I,k)}}))),he(this,we).use(xt(()=>{const b=new Po(/(?:^|\s)((?:https?:\/\/|www\.)[^\s]+)\s$/,(C,p,k)=>{const S=C.schema.marks.link;if(!S)return null;const $=p[1].replace(/[.,)]+$/,""),I=k+p[0].indexOf($),F=I+$.length;if(C.doc.rangeHasMark(I,F,S))return null;const B=$.startsWith("http")?$:`https://${$}`;return C.tr.addMark(I,F,S.create({href:B}))});return Io({rules:[b]})}));const y=[];f.forEach(b=>{const C=u[b];y.push(sa(b,he(this,we),C))}),tt(this,st,Promise.all(y))}async create(){await he(this,st);const t=await he(this,we).create();return na(this,jt,Rs).call(this),t}async destroy(){var t;return(t=he(this,ze))==null||t.disconnect(),await he(this,st),he(this,we).destroy()}get editor(){return he(this,we)}setReadonly(t){return tt(this,pt,!t),this}getMarkdown(){return he(this,we).action(tn())}getEditor(){return he(this,we)}destroyEditor(){this.destroy()}}we=new WeakMap;st=new WeakMap;it=new WeakMap;pt=new WeakMap;ze=new WeakMap;jt=new WeakSet;Rs=function(){const e=he(this,it),t=u=>{parseFloat(u.style.left)<0&&(u.style.left="0px")},o=u=>{const s=e.querySelector(u);s&&(he(this,ze).observe(s,{attributes:!0,attributeFilter:["style"]}),setTimeout(()=>t(s),0))};tt(this,ze,new MutationObserver(u=>{const s=u[0];s.type==="childList"?(o("milkdown-link-edit"),o("milkdown-link-preview")):t(s.target)})),he(this,ze).observe(e,{childList:!0,subtree:!0})};Hs.Feature=Ds;const la={name:"CrepeEditor",emits:["update:modelValue","handleMediaUpload","editorCreated"],props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},autofocus:{type:Boolean,default:!1},mentionQuery:{type:Object,default:()=>({})},autofocus_changed:{type:[Boolean,Number],default:!1},disable_mention:{type:Boolean,default:!1},disable_media:{type:Boolean,default:!1},defaultMentions:{type:Array,default:()=>[]},context:{type:String,default:""},is_modal:{type:Boolean,default:!1},onInlineUpload:{type:Function,default:null},canAddImage:{type:Function,default:null}},components:{MilkdownProvider:sn,ProsemirrorAdapterProvider:on},data(){return{editor:null,currentContent:"",showMentionPop:!1,currentMentionSearch:"",mentionResults:[],justReplaced:!1,searchingMention:!1,hasUnsavedChanges:!1,pendingNavigation:null,activeUploadBlock:null}},watch:{autofocus_changed(e){e&&this.focusOnEditor()},currentContent(){var t;const e=this.context==="feed"||this.context==="comment";this.hasUnsavedChanges=e&&!!((t=this.currentContent)!=null&&t.replace(/ |\u00A0/gi,"").trim()),this.context==="comment"&&this.is_modal&&(window.fcom_modal_comment_unsaved=this.hasUnsavedChanges)}},methods:{updateContent(e){this.editor.action(t=>{const o=t.get(ft),{state:u}=o,{from:s}=u.selection,n=e,m=u.tr.insertText(n,s),f=s+n.length,h=m.setSelection(_s.create(m.doc,f));o.dispatch(h),o.focus()})},initEditor(){const e=this,t=new Hs({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 o=>{if(!this.onInlineUpload)return null;this.activeUploadBlock&&this.activeUploadBlock.classList.add("uploading");try{return await this.onInlineUpload(o)}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")}},onUpdate(o){o=o.replace(/!\[[^\]]*\]\(\s*\)/g,""),e.$emit("update:modelValue",o),e.currentContent=o},async handleCommonActions(o,u){if(o==="editor_updated"){if(e.disable_mention)return!1;e.checkforMention(u)}else if(o==="handleFileUpload")return e.disable_media?[]:await e.handleFileUpload(u)}});t.create().then(()=>{this.editor=t.getEditor(),this.focusOnEditor(),this.$emit("editorCreated")})},focusOnEditor(e=null){!e&&!this.autofocus||!this.editor||this.editor.action(t=>{const o=t.get(ft),{state:u}=o;let s=null;e&&u.doc.descendants((m,f)=>{if(m.isText&&m.text){const h=m.text.lastIndexOf(e);h!==-1&&(s=f+h+e.length+1)}});const n=s!==null?Math.min(s,u.doc.content.size-1):Math.max(1,u.doc.content.size-1);o.dispatch(u.tr.setSelection(_s.create(u.doc,n))),o.focus()})},checkforMention(e){if(!this.currentContent.includes("@")||this.justReplaced){this.showMentionPop=!1,this.currentMentionSearch="";return}const o=e.get(ft),{state:u}=o,{selection:s}=u;if(!s)return;const m=u.doc.textBetween(0,s.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(),y=this.defaultMentions.filter(w=>w.username.toLowerCase().includes(h)||w.display_name.toLowerCase().includes(h));y.length&&(this.currentMentionSearch=f,this.mentionResults=y,this.showMentionPop=!0)}return}if(this.currentMentionSearch&&(this.currentMentionSearch=f,this.searchingMention))return!1;this.searchingMention=!0,this.currentMentionSearch=f,this.$get("members",{mention:this.currentMentionSearch,...this.mentionQuery}).then(h=>{this.mentionResults=h.members.data,this.showMentionPop=!0}).finally(()=>{this.searchingMention=!1})},addMention(e){if(this.disable_mention)return;const t=new RegExp(`@${this.currentMentionSearch}(?!.*@${this.currentMentionSearch})`);this.currentContent=this.currentContent.replace(t,e+"ย "),this.editor.action(nn(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 o=0;o{const u=o.get(ft),{state:s}=u,n=s.schema.nodes["image-block"];if(!n)return;const m=n.create({src:t,caption:"",ratio:1}),{$from:f}=s.selection,h=f.after(1),y=s.tr.insert(h,m);u.dispatch(y),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 o=t.getAttribute("href"),u=this.appVars.portal_url;if(!o)return;const s=o.startsWith(u)||o.startsWith("/"),n=o===window.location.href;s&&!n&&(e.preventDefault(),e.stopPropagation(),this.pendingNavigation=t,this.$eventBus.emit("showUnsavedChangesModal",this.context))},handleImageBlockClick(e){const t=e.target.closest("milkdown-image-block");t&&(this.activeUploadBlock=t,e.target.closest(".confirm")&&!this.canAddImage()&&(e.preventDefault(),e.stopPropagation()))}},mounted(){this.initEditor(),window.addEventListener("beforeunload",this.handleBeforeUnload),document.addEventListener("click",this.handleLinkClick,!0),this.onInlineUpload&&this.$refs.crepe_editor_vue.addEventListener("click",this.handleImageBlockClick,!0),this.$eventBus.on("unsavedChangesProceeded",()=>{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)}})},beforeUnmount(){var e;this.editor&&this.editor.destroy(),this.context==="comment"&&this.is_modal&&this.hasUnsavedChanges&&(window.fcom_modal_comment_unsaved=!1),window.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("click",this.handleLinkClick,!0),this.onInlineUpload&&((e=this.$refs.crepe_editor_vue)==null||e.removeEventListener("click",this.handleImageBlockClick,!0))}},aa={style:{position:"relative"},class:"fcom_md_editor"},ra={ref:"crepe_editor_vue",class:"crepe-editor feed_md_content fcom_md_seditor_wrapper"},ca={class:"fcom_mention_pop_wrap"},da={key:0},ua={key:0},_a=["onClick"],ma=["src"],ha={key:1};function fa(e,t,o,u,s,n){const m=g("ProsemirrorAdapterProvider"),f=g("MilkdownProvider"),h=fe;return i(),c(L,null,[a(f,null,{default:r(()=>[a(m,null,{default:r(()=>[l("div",aa,[l("div",ra,null,512)])]),_:1})]),_:1}),l("div",ca,[a(h,{"popper-class":"fcom_mention_pop",ref:"mentionPopoverRef",placement:"bottom",visible:s.showMentionPop,width:300,persistent:!1},{reference:r(()=>[...t[0]||(t[0]=[l("span",{style:{}},null,-1)])]),default:r(()=>[s.justReplaced?_("",!0):(i(),c("div",da,[s.mentionResults.length?(i(),c("ul",ua,[(i(!0),c(L,null,D(s.mentionResults,y=>(i(),c("li",{key:y.user_id,onClick:w=>n.addMention("@"+y.username)},[y.avatar?(i(),c("img",{key:0,alt:"",src:y.avatar},null,8,ma)):_("",!0),l("span",null,d(y.display_name)+" (@"+d(y.username)+")",1)],8,_a))),128))])):s.searchingMention?_("",!0):(i(),c("div",ha,[l("p",null,d(e.$t("No results found. Please search by username")),1)]))]))]),_:1},8,["visible"])])],64)}const $t=P(la,[["render",fa]]);const pa={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}},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 o,u,s,n,m;const t=(u=(o=this.$refs.popoverRef)==null?void 0:o.popperRef)==null?void 0:u.contentRef;t!=null&&t.contains(e.target)||(s=this.$refs.triggerRef)!=null&&s.contains(e.target)||(m=(n=e.target).closest)!=null&&m.call(n,".el-popper")||this.hide()},handleAction(e){this.hide(),e.action&&e.action()}},beforeUnmount(){document.removeEventListener("click",this.onClickOutside,!0)}},ga={class:"actions_items",role:"menu"},ya=["onClick"];function va(e,t,o,u,s,n){const m=g("MoreFilled"),f=N,h=O,y=fe;return i(),v(y,{trigger:"manual",placement:o.placement,persistent:o.persistent,width:o.width,visible:s.visible,ref:"popoverRef"},{reference:r(()=>[l("span",{ref:"triggerRef",class:"fcom_action_popover_trigger",onClick:t[0]||(t[0]=(...w)=>n.toggle&&n.toggle(...w))},[q(e.$slots,"trigger",{},()=>[a(h,{"aria-label":e.$t("View actions"),class:"fcom_action_popover_default_trigger_button",size:"small"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])])],512)]),default:r(()=>[q(e.$slots,"default",{hide:n.hide},()=>[l("ul",ga,[(i(!0),c(L,null,D(o.items,(w,b)=>(i(),c("li",{key:b,class:R(["fcom_action_popover_item",w.type?"fcom_action_popover_item_"+w.type:""]),role:"menuitem",onClick:C=>n.handleAction(w)},d(w.label),11,ya))),128))])])]),_:3},8,["placement","persistent","width","visible"])}const ss=P(pa,[["render",va]]),ba={name:"SmilyIcon"},ka={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function wa(e,t,o,u,s,n){return i(),c("svg",ka,[...t[0]||(t[0]=[Te('',1)])])}const Ca=P(ba,[["render",wa]]),$a={name:"EmojiPicker",components:{Picker:Ei,ActionPopover:ss,SmilyIcon:Ca},emits:["emoji-selected"],props:{close_on_select:{type:Boolean,default:!1}},data(){return{emojiIndex:null,emojiLoading:!1,errorMessage:"",isLoading:!1}},methods:{onEmojiSelect(e,t){this.$emit("emoji-selected",e.native),this.close_on_select&&t&&t()},loadEmojiAssets(){if(this.isLoading)return;if(window.fcomEmojiIndex){this.emojiIndex=window.fcomEmojiIndex,this.emojiLoading=!1;return}this.isLoading=!0;let e=this.appVars.assets_url+"libs/static/tw_emojis.json";this.emojiLoading=!0,fetch(e).then(t=>t.json()).then(t=>{t?(window.fcomEmojiIndex=new Ai(t),this.emojiIndex=window.fcomEmojiIndex,this.emojiLoading=!1):this.errorMessage=this.$t("Emoji loading failed")}).catch(()=>{this.errorMessage=this.$t("Emoji loading failed")}).finally(()=>{this.isLoading=!1})}}},Sa={class:"ffcom_emoji"},Va={key:0,class:"emoji-mart emoji-mart-static",style:{width:"320px",padding:"10px 20px"}},La={key:0},Ma={style:{"text-align":"center","margin-bottom":"20px"}},Fa={key:1,class:"fcom_emoji_holder"};function Ta(e,t,o,u,s,n){const m=g("SmilyIcon"),f=N,h=O,y=W,w=g("Picker"),b=g("action-popover");return i(),v(b,{ref:"fcom_emoji_popover","close-on-click-outside":!0,placement:"bottom",persistent:!1,"trigger-interactive":!0,width:350,onShow:n.loadEmojiAssets},{trigger:r(()=>[a(h,{"aria-label":"Pick Imoji",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})]),default:r(({hide:C})=>[l("div",Sa,[s.emojiLoading?(i(),c("div",Va,[s.errorMessage?(i(),c("div",La,d(s.errorMessage),1)):(i(),c(L,{key:1},[l("div",Ma,d(e.$t("Loading.....")),1),a(y,{animated:!0,rows:3})],64))])):s.emojiIndex?(i(),c("div",Fa,[a(w,{title:e.$t("Pick Emoji"),i18n:{search:e.$t("Search"),notfound:e.$t("No Emoji Found"),categories:{search:e.$t("Search Results"),recent:e.$t("Frequently Used"),smileys:e.$t("Smileys & Emotion"),people:e.$t("People & Body"),nature:e.$t("Animals & Nature"),foods:e.$t("Food & Drink"),activity:e.$t("Activity"),places:e.$t("Travel & Places"),objects:e.$t("Objects"),symbols:e.$t("Symbols"),flags:e.$t("Flags"),custom:e.$t("Custom")}},color:"#66b1ff",showPreview:!1,ref:"picker",data:s.emojiIndex,set:"twitter",onSelect:p=>n.onEmojiSelect(p,C),emojiSize:22,sheetSize:32,emojiTooltip:!1},null,8,["title","i18n","data","onSelect"])])):_("",!0)])]),_:1},8,["onShow"])}const xs=P($a,[["render",Ta]]),Pa={name:"DocumentsUploader",components:{UploadFilled:gt,Document:yt},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 o,u;(u=(o=t==null?void 0:t.response)==null?void 0:o.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))}}},Ia={class:"fcom_documents_uploader"},Ua={class:"el-upload__text"},Ba={key:0},Ea={class:"fcom_document_lists"},Aa={class:"fcom_each_document"},Da={class:"fcom_document_info"},Ra={class:"fcom_document_icon"},Ha={class:"fcom_document_title"},xa={class:"fcom_document_actions"};function ja(e,t,o,u,s,n){const m=g("UploadFilled"),f=N,h=lt,y=g("Document"),w=O;return i(),c("div",Ia,[a(h,{action:n.action_url,headers:n.headers,"file-list":s.fileList,"onUpdate:fileList":t[0]||(t[0]=b=>s.fileList=b),accept:"*/*",drag:"",class:"fcom_document_upload",multiple:o.is_multiple,data:o.additional_data,"show-file-list":o.showLists,"on-change":n.handleChange,"on-success":n.handleSuccess,"on-error":n.handleError,"on-remove":n.handleChange},{default:r(()=>[a(f,{class:"el-icon--upload"},{default:r(()=>[a(m)]),_:1}),l("div",Ua,d(e.$t("Drop file here or click to upload")),1)]),_:1},8,["action","headers","file-list","multiple","data","show-file-list","on-change","on-success","on-error","on-remove"]),!o.showLists&&n.uploadingFiles.length?(i(),c("div",Ba,[l("div",Ea,[(i(!0),c(L,null,D(n.uploadingFiles,b=>(i(),c("div",Aa,[l("div",Da,[l("div",Ra,[a(f,null,{default:r(()=>[a(y)]),_:1})]),l("span",Ha,d(b.name),1)]),l("div",xa,[a(w,{text:"",size:"small",loading:!0},{default:r(()=>[V(d(e.$t("Uploading...")),1)]),_:1})])]))),256))])])):_("",!0)])}const Oa=P(Pa,[["render",ja]]),Na={name:"PdfIcon"},za={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function qa(e,t,o,u,s,n){return i(),c("svg",za,[...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 Ga=P(Na,[["render",qa]]),Ya={name:"ZipIcon"},Wa={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function Za(e,t,o,u,s,n){return i(),c("svg",Wa,[...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 Ka=P(Ya,[["render",Za]]),Ja={name:"AudioIcon"},Qa={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function Xa(e,t,o,u,s,n){return i(),c("svg",Qa,[...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 er=P(Ja,[["render",Xa]]),tr={name:"DocIcon"},sr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function or(e,t,o,u,s,n){return i(),c("svg",sr,[...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 ir=P(tr,[["render",or]]),nr={name:"VideoFileIcon"},lr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function ar(e,t,o,u,s,n){return i(),c("svg",lr,[...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 rr=P(nr,[["render",ar]]);const cr={name:"DocumentLists",components:{Document:yt,Download:Uo,PdfIcon:Ga,ImageIcon:Xt,ZipIcon:Ka,AudioIcon:er,DocIcon:ir,VideoFileIcon:rr},props:["document_lists","additional_data","is_editable"],emits:["fileRemoved","documentsUpdated"],data(){return{editingIndex:null,isSaving:!1}},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(o=>{this.$notify.success(o.message),this.document_lists.splice(e,1),this.$emit("documentsUpdated",this.document_lists)}).catch(o=>{this.$handleError(o)}).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"},saveDoc(e){this.isSaving=!0,this.$post("documents/update",{id:e.id,title:e.title,...this.additional_data}).then(t=>{this.$notify.success(t.message),this.isSaving=!1,this.editingIndex=null,this.$emit("documentsUpdated",this.document_lists)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.isSaving=!1})}}},dr={class:"fcom_document_lists"},ur={class:"fcom_each_document"},_r={class:"fcom_document_info"},mr={class:"fcom_document_icon"},hr=["href"],fr=["onClick"],pr={class:"fcom_document_actions"},gr=["href"];function yr(e,t,o,u,s,n){const m=N,f=g("EditPen"),h=O,y=X,w=g("Download"),b=g("DeleteFilled"),C=Q("loading");return i(),c("div",dr,[(i(!0),c(L,null,D(o.document_lists,(p,k)=>(i(),c("div",ur,[l("div",_r,[l("div",mr,[a(m,null,{default:r(()=>[(i(),v(zt(n.getIcon(p.type))))]),_:2},1024)]),o.is_editable?(i(),c(L,{key:1},[s.editingIndex!=k?(i(),c("span",{key:0,style:{cursor:"pointer"},onClick:S=>s.editingIndex=k,class:"fcom_document_title"},[l("span",null,d(p.title),1),a(m,{style:{"margin-left":"10px","font-size":"80%"}},{default:r(()=>[a(f)]),_:1})],8,fr)):(i(),v(y,{key:1,readonly:s.isSaving,size:"small",style:{width:"80%"},modelValue:p.title,"onUpdate:modelValue":S=>p.title=S},{append:r(()=>[a(h,{disabled:s.isSaving,loading:s.isSaving,onClick:S=>n.saveDoc(p)},{default:r(()=>[l("span",null,d(e.$t("Update")),1)]),_:1},8,["disabled","loading","onClick"])]),_:2},1032,["readonly","modelValue","onUpdate:modelValue"]))],64)):(i(),c("a",{key:0,href:p.url,target:"_blank",rel:"noopener",class:"fcom_document_title"},d(p.title),9,hr))]),G((i(),c("div",pr,[!o.is_editable&&p.url?(i(),c("a",{key:0,href:p.url+"&force_download=1",target:"_blank",class:"el-button el-button--text"},[a(m,null,{default:r(()=>[a(w)]),_:1})],8,gr)):_("",!0),o.is_editable?(i(),v(h,{key:1,onClick:S=>n.removeDocument(k,p),plain:"",text:"",size:"small"},{default:r(()=>[a(m,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"])):_("",!0)])),[[C,s.isSaving]])]))),256))])}const Je=P(cr,[["render",yr]]);const vr={name:"DocumentUploaderPop",components:{DocumentLists:Je,DocumentsUploader:Oa,Document:yt},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="")}}},br={class:"fcom_inline_docs_form"},kr={class:"fcom_doc_upload_modal"};function wr(e,t,o,u,s,n){var y;const m=O,f=g("documents-uploader"),h=g("document-lists");return i(),c("div",br,[l("div",kr,[a(m,{onClick:t[0]||(t[0]=w=>n.reset()),class:"fcom_file_cancel_btn",text:"",size:"small"},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1}),a(f,{style:{"margin-bottom":"20px"},showLists:!1,additional_data:{space_id:o.space_id},is_multiple:!0,onFileAdded:n.fileAdded},null,8,["additional_data","onFileAdded"]),a(h,{class:"fcom_boxed_documents",additional_data:{space_id:o.space_id,feed_id:o.feed.id},is_editable:!0,document_lists:(y=o.feed)==null?void 0:y.document_ids,onFileRemoved:n.removeDocument},null,8,["additional_data","document_lists","onFileRemoved"])])])}const Cr=P(vr,[["render",wr]]),$r={name:"PaperClipIcon"},Sr={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Vr(e,t,o,u,s,n){return i(),c("svg",Sr,[...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 js=P($r,[["render",Vr]]),Lr=window.fluentComAdmin.auth,Mr={name:"FeedTextComposer",components:{PaperClipIcon:js,DocumentLists:Je,DocumentUploaderPop:Cr,Document:yt,MediaPreview:Ae,Giphy:rl,ImageUploader:je,SurveyEditForm:Kn,MarkdownEditor:$t,EmojiPicker:xs,VideoEmbeder:Ql,ImageIcon:Xt,PollIcon:jn},emits:["editorCreated"],props:{placeholder:{type:String,default(){return"What's happening, "+Lr.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"}},data(){return{mentionResults:[],mentionSearch:"",uploading:!1,isEmojiPickerVisible:!1,maxMediaPerPost:this.appVars.features.max_media_per_post}},methods:{cencelSurvey(){this.content.survey=null},insertEmoji(e){this.$refs.markdownEditor&&this.$refs.markdownEditor.updateContent(e)},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 o,u;if(this.content.media_images||(this.content.media_images=[]),(u=(o=this.content)==null?void 0:o.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.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 o,u;this.content.meta||(this.content.meta=[]),(o=this.content)!=null&&o.media_images&&(this.content.media_images=[]),(u=this.content)!=null&&u.media&&(this.content.media=null);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){this.content.media_images=[],this.content.meta=[],this.content.media=e},getInlineImageCount(){var t,o;const e=(o=(t=this.$refs.markdownEditor)==null?void 0:t.$refs)==null?void 0:o.crepe_editor_vue;return e?e.querySelectorAll('img[src^="http"]').length:0},canAddImage(){var o;return(((o=this.content.media_images)==null?void 0:o.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(){this.autofocus&&this.$nextTick(()=>{this.$refs.create_status&&this.$refs.create_status.focus()})}},Fr={class:"fcom_text_composer"},Tr={class:"fcom_editor status_text_input"},Pr={key:1,style:{position:"relative","text-align":"center"}},Ir={key:2,class:"fcom_media_items"},Ur={key:0,class:"fcom_media_images"},Br=["src","alt"],Er={key:1,class:"fcrom_media_images"},Ar={class:"fcrom_media_image"},Dr=["src","alt"],Rr={key:3,class:"fcrom_media_images"},Hr=["src","alt"],xr={key:4,class:"fcrom_media_images"},jr={class:"fcrom_media_image"},Or=["src","alt"],Nr={class:"fcom_composer_footer"},zr={class:"fcom_composer_apps"},qr={key:0},Gr={class:"fcom_composer_actions"};function Yr(e,t,o,u,s,n){var E,A,U,T,j,z,ne,x,ee;const m=g("MarkdownEditor"),f=g("DocumentUploaderPop"),h=g("SurveyEditForm"),y=O,w=g("media-preview"),b=g("CloseBold"),C=N,p=g("ImageIcon"),k=g("image-uploader"),S=g("video-embeder"),$=g("PaperClipIcon"),I=g("PollIcon"),F=g("EmojiPicker"),B=g("Giphy"),M=Q("loading");return i(),c(L,null,[l("div",Fr,[l("div",Tr,[q(e.$slots,"before_input"),a(m,{ref:"markdownEditor",modelValue:o.content.message,"onUpdate:modelValue":t[0]||(t[0]=H=>o.content.message=H),context:o.context,is_modal:o.is_modal,autofocus:o.autofocus,placeholder:o.placeholder,mentionQuery:o.mentionQuery,defaultMentions:o.defaultMentions,autofocus_changed:o.autofocus_changed,onInlineUpload:n.hasInlineImageUpload?H=>n.uploadImage(H,!1):null,canAddImage:n.canAddImage,onHandleMediaUpload:n.uploadImage,onEditorCreated:t[1]||(t[1]=()=>{e.$emit("editorCreated")})},null,8,["modelValue","context","is_modal","autofocus","placeholder","mentionQuery","defaultMentions","autofocus_changed","onInlineUpload","canAddImage","onHandleMediaUpload"]),q(e.$slots,"after_input")]),o.content.content_type=="document"?(i(),c(L,{key:0},[o.config.documentsApp&&o.config.space_id?(i(),v(f,{key:0,is_inline:!0,feed:o.content,space_id:o.config.space_id},null,8,["feed","space_id"])):_("",!0)],64)):(i(),c(L,{key:1},[o.content.survey?(i(),v(h,{key:0,onCancel:n.cencelSurvey,form:o.content.survey,is_editing:o.is_editing},null,8,["onCancel","form","is_editing"])):_("",!0),(A=(E=o.content)==null?void 0:E.media)!=null&&A.type?(i(),c("div",Pr,[a(y,{onClick:t[2]||(t[2]=H=>{o.content.media=null}),text:"",type:"danger"},{default:r(()=>[V(d(e.$t("Remove Media")),1)]),_:1}),a(w,{media_item:o.content.media},null,8,["media_item"])])):(U=o.content)!=null&&U.meta?(i(),c("div",Ir,[(j=(T=o.content.meta)==null?void 0:T.media_items)!=null&&j.length?(i(!0),c(L,{key:0},D(o.content.meta.media_items,(H,te)=>(i(),c("div",{key:te},[H.type=="image"?(i(),c("div",Ur,[l("img",{class:"fcom_media_image",src:H.url,alt:e.$t("Media image")},null,8,Br),a(y,{class:"fcom_media_images_cross_button",link:"",onClick:K=>o.content.meta.media_items.splice(te,1)},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"])])):_("",!0)]))),128)):((ne=(z=o.content.meta)==null?void 0:z.media_preview)==null?void 0:ne.type)=="image"||(ee=(x=o.content.meta)==null?void 0:x.media_preview)!=null&&ee.image?(i(),c("div",Er,[l("div",Ar,[l("img",{src:o.content.meta.media_preview.image,alt:e.$t("Media Preview image")},null,8,Dr),a(y,{link:"",onClick:t[3]||(t[3]=H=>o.content.meta.media_preview=null)},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1})]),_:1})])])):_("",!0)])):o.content.media_images&&o.content.media_images.length?(i(),c("div",Rr,[(i(!0),c(L,null,D(o.content.media_images,(H,te)=>(i(),c("div",{class:"fcrom_media_image",key:te},[l("img",{src:H.url,alt:e.$t("Media image")},null,8,Hr),a(y,{link:"",onClick:K=>o.content.media_images.splice(te,1)},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"])]))),128))])):n.checkHasImageForCommentsEdit(o.content)?(i(),c("div",xr,[l("div",jr,[l("img",{src:o.content.media.media_url,alt:e.$t("Media image")},null,8,Or),a(y,{link:"",onClick:t[4]||(t[4]=H=>n.removeImageFromComments())},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1})]),_:1})])])):_("",!0)],64))]),q(e.$slots,"before_composer_footer"),G((i(),c("div",Nr,[l("div",zr,[n.hasActiveApp?_("",!0):(i(),c(L,{key:0},[s.maxMediaPerPost?(i(),v(k,{key:0,additionalData:{resize:!0,context:o.context,max_width:1400},isMultiple:o.config.multipleMedia,onUploading:t[5]||(t[5]=()=>{s.uploading=!0}),onCompleted:t[6]||(t[6]=()=>{s.uploading=!1}),onUploaded:n.handleMediaUpload},{default:r(()=>[a(y,{"aria-label":"Upload Media",loading:s.uploading,text:""},{default:r(()=>[a(C,{class:"fcom_status_img_icon"},{default:r(()=>[a(p)]),_:1}),s.uploading?(i(),c("span",qr,d(e.$t("Uploading...")),1)):_("",!0)]),_:1},8,["loading"])]),_:1},8,["additionalData","isMultiple","onUploaded"])):_("",!0),o.config.videoApp&&e.hasFeature("video_embeder")?(i(),v(S,{key:1,space:o.config.spaceSlug,is_admin:o.config.is_admin,onEmbeded:n.handleVideoAttachment},null,8,["space","is_admin","onEmbeded"])):_("",!0),o.config.documentsApp&&o.config.space_id?(i(),v(y,{key:2,"aria-label":e.$t("Add Documents"),title:e.$t("Upload Documents"),text:"",onClick:t[7]||(t[7]=H=>o.content.content_type="document")},{default:r(()=>[a(C,{class:R(["fcom_apps_icon"])},{default:r(()=>[a($)]),_:1})]),_:1},8,["aria-label","title"])):_("",!0),o.config.surveyApp&&e.hasFeature("has_survey_poll")?(i(),v(y,{key:3,"aria-label":"Create Poll",onClick:n.initSurveyForm,text:""},{default:r(()=>[a(C,{class:"fcom_apps_icon"},{default:r(()=>[a(I)]),_:1})]),_:1},8,["onClick"])):_("",!0),e.hasFeature("emoji_app")?(i(),v(F,{key:4,onEmojiSelected:n.insertEmoji},null,8,["onEmojiSelected"])):_("",!0),e.hasFeature("giphy_app")?(i(),v(B,{key:5,onSelectedGiphy:n.selectedGiphy},null,8,["onSelectedGiphy"])):_("",!0)],64))]),l("div",Gr,[q(e.$slots,"default")])])),[[M,s.uploading]]),q(e.$slots,"after_composer_footer")],64)}const _t=P(Mr,[["render",Yr]]),Wr={name:"ImageCarousel",props:["feed","is_single"],computed:{srcList(){return this.feed.meta.media_items.map(e=>e.url)},visibleMedia(){return this.feed.meta.media_items.map((e,t)=>({url:e.url,type:e.type,index:t})).slice(0,4)},overflowCount(){return this.srcList.length>4?this.srcList.length-4:0},carouselClass(){const e=this.srcList.length;return e===1?"fcom_image_carousel_num_1":e===3?"fcom_image_carousel_num_3":e===2||e===4||e>4?"fcom_image_carousel_num_2_or_4":""}},methods:{getVideoType(e){switch(e.split(".").pop().toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";default:return"video/mp4"}},isOverflowSlot(e){return e===3&&this.feed.meta.media_items.length>4}}},Zr={class:"fcom_image_carousel"},Kr={key:0},Jr=["preload","poster"],Qr=["src","type"],Xr={key:1,class:"fcom_image_wrap"},ec={key:0,class:"fcom_image_overlay"};function tc(e,t,o,u,s,n){const m=Pe;return i(),c("div",Zr,[l("div",{class:R([n.carouselClass+" "+o.feed.type,"fcom_image_carousel__container"])},[(i(!0),c(L,null,D(n.visibleMedia,(f,h)=>(i(),c("div",{class:R(["fcom_carousel__image","fcom_media_type_"+f.type])},[f.type==="video"?(i(),c("div",Kr,[l("video",{style:{width:"100%","aspect-ratio":"16/9"},controls:"",preload:o.is_single?"":"none",poster:f.thumbnail},[l("source",{src:f.url,type:n.getVideoType(f.url)},null,8,Qr)],8,Jr)])):(i(),c("div",Xr,[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":n.srcList,fit:"cover"},null,8,["src","initial-index","preview-src-list"]),n.isOverflowSlot(h)?(i(),c("div",ec,"+"+d(n.overflowCount),1)):_("",!0)]))],2))),256))],2)])}const St=P(Wr,[["render",tc]]),sc={name:"ErrorIcon"},oc={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 ic(e,t,o,u,s,n){return i(),c("svg",oc,[...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 Os=P(sc,[["render",ic]]),nc={name:"ReportReview",components:{ErrorIcon:Os},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,o;((t=e.content)==null?void 0:t.id)==((o=this.feed)==null?void 0:o.id)&&this.$emit("updated",e.content)}},mounted(){this.$eventBus.on("updateModerationReport",this.handleReportUpdate)},beforeUnmount(){this.$eventBus.off("updateModerationReport",this.handleReportUpdate)}},lc={class:"fcom_feed_report_wrap"},ac={class:"fcom_feed_report_content"},rc={key:0},cc={key:1},dc={key:2},uc={class:"fcom_feed_report_action"};function _c(e,t,o,u,s,n){const m=g("ErrorIcon"),f=O;return i(),c("div",lc,[l("div",ac,[a(m),o.feed.meta.auto_flagged=="yes"?(i(),c("span",rc,d(e.$t("This %s has been flagged automatically by the site rule.",o.type)),1)):o.feed.meta.reports_count>1?(i(),c("span",cc,d(e.$t("This %1$s has been flagged with %2$s reports",o.type,o.feed.meta.reports_count)),1)):(i(),c("span",dc,d(e.$t("This %1$s has been flagged with %2$s report",o.type,o.feed.meta.reports_count)),1))]),l("div",uc,[a(f,{onClick:t[0]||(t[0]=h=>n.openReportDetails())},{default:r(()=>[V(d(e.$t("Review")),1)]),_:1})])])}const Ns=P(nc,[["render",_c]]),mc={name:"StickyIcon"},hc={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 fc(e,t,o,u,s,n){return i(),c("svg",hc,[...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 Vt=P(mc,[["render",fc]]),pc={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(o=>{const u=o.getAttribute("href"),s=(u==null?void 0:u.startsWith(this.appVars.portal_url))&&u.match(t);if(!s)return;const n=s[1];o._mentionEnter=()=>{clearTimeout(this.hoverTimeout),this.hoverTimeout=setTimeout(()=>{this.$eventBus.emit("show_mention_popover",{username:n,triggerElement:o})},500)},o._mentionLeave=()=>{clearTimeout(this.hoverTimeout),this.$eventBus.emit("hide_mention_popover")},o.addEventListener("mouseenter",o._mentionEnter),o.addEventListener("mouseleave",o._mentionLeave)}),this._lightboxHandler=o=>{const u=o.target.closest('img[src^="http"]');if(!u)return;o.preventDefault();const s=Array.from(e.querySelectorAll('img[src^="http"]')).map(n=>n.src);this.lightboxImages=s,this.lightboxIndex=Math.max(0,s.indexOf(u.src))},e.addEventListener("click",this._lightboxHandler)},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._lightboxHandler&&(e.removeEventListener("click",this._lightboxHandler),this._lightboxHandler=null))}},mounted(){this.$nextTick(()=>this.setupListeners())},beforeUnmount(){this.cleanupListeners()}},gc=["innerHTML"];function yc(e,t,o,u,s,n){const m=$s;return i(),c(L,null,[l("div",{ref:"content",class:R(["feed_md_content",o.class_name]),innerHTML:o.content},null,10,gc),s.lightboxImages.length?(i(),v(m,{key:0,"url-list":s.lightboxImages,"initial-index":s.lightboxIndex,"hide-on-click-modal":!0,onClose:t[0]||(t[0]=f=>s.lightboxImages=[])},null,8,["url-list","initial-index"])):_("",!0)],64)}const Lt=P(pc,[["render",yc]]),vc={name:"SingleComment",components:{ImageCarousel:St,FeedTextComposer:_t,MediaPreview:Ae,ReportReview:Ns,StickyIcon:Vt,FeedMdContent:Lt},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"],data(){return{working:!1,isEdit:!1,editingComment:null,focusTrigger:0}},computed:{isReportEnabled(){return this.has_pro&&this.appVars.moderationConfig.is_enabled},showReport(){var e;return this.hasSpaceModeratorAccess()&&this.isReportEnabled&&this.show_report&&((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}}},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,o,u,s;const e=((t=this.editingComment.media_images)==null?void 0:t.length)>0||((u=(o=this.editingComment.meta)==null?void 0:o.media_preview)==null?void 0:u.image);if(!((s=this.editingComment.message)!=null&&s.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(n=>{this.$notify.success((n==null?void 0:n.message)||this.$t("Comment updated successfully")),Object.assign(this.comment,n.comment),this.comment.media_images=[]}).catch(n=>{this.$handleError(n),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 o=/(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_-]+)/.exec(e);if(o&&o[1]){let n=o[1];if(n){let m=`
`;e+=m}}let u=window.location.origin,s=new RegExp(u,"g");return e=e.replace(//g,(n,m,f,h)=>f.match(s)?``:``),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"})},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"))}}},bc={key:1,class:"person_avatar"},kc={class:"comment_wrap"},wc={key:0,class:"comment_text"},Cc={key:0,class:"comment_text_head"},$c={class:"comment_text_head_name"},Sc=["title"],Vc={key:0,class:"comment_text_head_status"},Lc={class:"comment_actions"},Mc={class:"actions_items"},Fc={key:1,class:"comment_text_media"},Tc={key:2,class:"comment_text_media"};function Pc(e,t,o,u,s,n){const m=g("ReportReview"),f=g("UserAvatar"),h=g("UserRouteLink"),y=Be,w=g("StickyIcon"),b=N,C=O,p=g("MoreFilled"),k=fe,S=g("FeedMdContent"),$=g("MediaPreview"),I=g("ImageCarousel"),F=g("feed-text-composer"),B=Q("loading");return i(),c(L,null,[n.showReport?(i(),v(m,{key:0,feed:n.getReportComment,type:"comment",onUpdated:n.reportUpdated},null,8,["feed","onUpdated"])):_("",!0),o.show_header&&o.comment.xprofile?(i(),c("div",bc,[a(f,{with_level:!1,xprofile:o.comment.xprofile,is_rounded:!0},null,8,["xprofile"])])):_("",!0),G((i(),c("div",kc,[s.isEdit?(i(),c("div",{key:1,onKeydown:t[9]||(t[9]=ye((...M)=>n.maybeSave&&n.maybeSave(...M),["enter"])),class:"comment_text"},[a(F,{context:"comment",config:{multipleMedia:!0},placeholder:e.$t("Write a comment"),content:s.editingComment,autofocus:!0,autofocus_changed:s.focusTrigger},{default:r(()=>[l("div",null,[a(C,{onClick:t[7]||(t[7]=M=>s.isEdit=!1),class:"fcom_secondary_button"},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1}),a(C,{class:"fcom_primary_button",onClick:t[8]||(t[8]=M=>n.updateComment(s.editingComment))},{default:r(()=>[V(d(e.$t("Update")),1)]),_:1})])]),_:1},8,["placeholder","content","autofocus_changed"])],32)):(i(),c("div",wc,[o.show_header?(i(),c("div",Cc,[l("div",$c,[a(h,{show_badge:!0,xprofile:o.comment.xprofile,show_follow:!0},null,8,["xprofile"]),l("div",{title:o.comment.created_at,class:"comment_text_head_time"},d(e.humanDateDiff(o.comment.created_at)),9,Sc),o.comment.status=="pending"?(i(),c("div",Vc,[a(y,{type:"warning"},{default:r(()=>[V(d(e.$t("In Review")),1)]),_:1})])):_("",!0)]),l("div",Lc,[o.comment.is_sticky?(i(),v(C,{key:0,onClick:t[0]||(t[0]=M=>n.toggleSticky()),"aria-label":e.$t("Toggle Sticky"),class:"no_pad_btn",text:"",size:"small"},{default:r(()=>[a(b,{title:e.$t("Unpin from Top"),class:"fcom_sticky"},{default:r(()=>[a(w)]),_:1},8,["title"])]),_:1},8,["aria-label"])):_("",!0),a(k,{persistent:!1,placement:"bottom",ref:"comment_actions",width:200,trigger:"click"},{reference:r(()=>[a(C,{"aria-label":e.$t("View comment actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(b,null,{default:r(()=>[a(p)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[l("ul",Mc,[l("li",{onClick:t[1]||(t[1]=M=>n.copyCommentLink(o.comment))},d(e.$t("Copy Link")),1),n.showStickyOption?(i(),c(L,{key:0},[o.comment.is_sticky?(i(),c("li",{key:0,onClick:t[2]||(t[2]=M=>n.toggleSticky())},d(e.$t("Unpin from Top")),1)):(i(),c("li",{key:1,onClick:t[3]||(t[3]=M=>n.toggleSticky())},d(e.$t("Pin to Top")),1))],64)):_("",!0),n.showReportOption?(i(),c("li",{key:1,onClick:t[4]||(t[4]=M=>n.reportComment(o.comment))},d(e.$t("Report Comment")),1)):_("",!0),e.canEditComment(o.comment)?(i(),c("li",{key:2,onClick:t[5]||(t[5]=M=>n.editComment())},d(e.$t("Edit")),1)):_("",!0),e.canDeleteComment(o.comment)?(i(),c("li",{key:3,onClick:t[6]||(t[6]=M=>n.deleteComment())},d(e.$t("Delete")),1)):_("",!0)])]),_:1},512)])])):_("",!0),a(S,{class_name:"comment_text_body",content:n.renderedComment(o.comment.message_rendered)},null,8,["content"]),o.comment.meta.media_preview?(i(),c("div",Fc,[a($,{media_item:o.comment.meta.media_preview},null,8,["media_item"])])):o.comment.meta.media_items?(i(),c("div",Tc,[o.comment.meta.media_items?(i(),v(I,{key:0,feed:o.comment},null,8,["feed"])):_("",!0)])):_("",!0)])),q(e.$slots,"after_comment_text")])),[[B,s.working]])],64)}const zs=P(vc,[["render",Pc]]);function Z(e){return window.fluentComAdmin.i18n[e]||e}const qs={public:{label:Z("Public"),description:Z("__PUBLIC_SPACE_DESC"),space_description:Z("__PIBLIC_SPACE_DESC_2")},private:{label:Z("Private"),description:Z("__PRIVATE_SPACE_DESC"),space_description:Z("__PRIVATE_SPACE_DESC_2")},secret:{label:Z("Secret"),description:Z("Only invited members can view and post."),space_description:Z("__SECRET_SPACE_DESC_2")}},Ic={public:{label:Z("Public"),description:Z("Anyone can view and enroll the course for free")},private:{label:Z("Private"),description:Z("__PRIVATE_COURSE_DESC")},secret:{label:Z("Secret"),description:Z("Only invited students can view and enroll the course content.")}},Uc={self_paced:{label:Z("Self Paced"),description:Z("__SELF_PAED_COURSE_DESC")},structured:{label:Z("Structured"),description:Z("__STRUCTURED_COURSE_DESC")},scheduled:{label:Z("Scheduled"),description:Z("Course starts on a specific date. Sections are dripped relative to that date.")}};Z("Leaderboard Settings"),Z("Settings for Leaderboard & Gamification features"),Z("Get Leaderboard & Gamification Module"),Z("Unlock potential by creating new feeds and earning points for likes. Advance in rank based on your total points using this module"),Z("Emoji Module"),Z("Settings for Emoji & Reaction features"),Z("Get Emoji & Reaction Module"),Z("Use emojis to add a personal touch and make your new article, post, or comment more expressive"),Z("Giphy Module"),Z("Customize Your Giphy Module Settings"),Z("Get Giphy Module"),Z("Want to use awesome GIFs? Upgrade to Pro plan now and enjoy surfing on FluentCommunity"),Z("User Badge Module"),Z("Add a badge next to user profile name to highlight valued users"),Z("Get User Badge Module"),Z("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."),Z("Media Module"),Z("Add a badge next to user profile name to highlight valued users"),Z("Get Media Module"),Z("Choose where to store your media files. Options include Local File System, Amazon S3, or Cloudflare R2 for storing and serving your media assets");const Ie=e=>{e=parseInt(e);const t=Object.values(window.fluentComAdmin.leaderboard_levels);if(!e)return t[0];for(let o=0;o=t[o].min_points&&e<=t[o].max_points)return t[o];return t[t-1]},Bc={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),Jt(t))return e;const o=this.appVars.socialLinkProviders;return o&&this.each(o,(s,n)=>{t[n]&&e.push({title:s.title,icon:s.icon_svg,url:s.domain+t[n]})}),e}}},Ec={key:0,class:"fcom_social_links"},Ac=["href","title"];function Dc(e,t,o,u,s,n){const m=N,f=g("router-link");return n.hasSocialLinks?(i(),c("div",Ec,[(i(!0),c(L,null,D(n.socialLinks,h=>(i(),c("a",{rel:"noopener nofollow",target:"_blank",href:h.url,key:h.title,title:h.title},[a(m,{innerHTML:h.icon},null,8,["innerHTML"])],8,Ac))),128)),o.isOwn&&!n.hasSocialLinks?(i(),v(f,{key:0,to:{name:"update_profile",params:{username:o.xprofile.username}}},{default:r(()=>[V(d("+ "+e.$t("Add social links")),1)]),_:1},8,["to"])):_("",!0)])):_("",!0)}const Mt=P(Bc,[["render",Dc]]),Rc={name:"FollowAction",props:{profile:{type:Object,required:!0},followButtonText:{type:String,default:""}},emits:["refetch"],setup(){return{userStore:Ue()}},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 o;const e=(o=this.profile)==null?void 0:o.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{await this.userStore.toggleFollow(this.profile.user_id,this.profile.username),this.$notify.success(this.$t("Successfully followed user")),this.$emit("refetch")}catch(e){this.$handleError(e)}finally{this.loading=!1}},async unfollowUser(){this.loading=!0;try{await this.userStore.toggleFollow(this.profile.user_id,this.profile.username),this.$notify.success(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})}}},Hc={key:0},xc={key:1},jc={key:0},Oc={key:1};function Nc(e,t,o,u,s,n){const m=O;return n.showFollowAction?(i(),c(L,{key:0},[n.isBlocked?(i(),v(m,{key:0,class:"fcom_secondary_button danger_button",loading:s.loading,disabled:s.loading,style:{"min-width":"90px","max-height":"30px"},onClick:n.unblockUser,onMouseenter:t[0]||(t[0]=f=>s.hovering=!0),onMouseleave:t[1]||(t[1]=f=>s.hovering=!1)},{default:r(()=>[s.hovering?(i(),c("span",xc,d(e.$t("Unblock")),1)):(i(),c("span",Hc,d(e.$t("Blocked")),1))]),_:1},8,["loading","disabled","onClick"])):n.isFollowing?(i(),v(m,{key:1,onClick:n.confirmUnfollow,class:R(["fcom_secondary_button",{danger_button:s.hovering}]),style:{"min-width":"95px","max-height":"30px"},loading:s.loading,disabled:s.loading,onMouseenter:t[2]||(t[2]=f=>s.hovering=!0),onMouseleave:t[3]||(t[3]=f=>s.hovering=!1)},{default:r(()=>[s.hovering?(i(),c("span",Oc,d(e.$t("Unfollow")),1)):(i(),c("span",jc,d(e.$t("Following")),1))]),_:1},8,["onClick","class","loading","disabled"])):(i(),v(m,{key:2,onClick:n.followUser,class:"fcom_color_button",style:{"max-height":"30px"},loading:s.loading,disabled:s.loading},{default:r(()=>[l("span",null,d(n.followBtnText),1)]),_:1},8,["onClick","loading","disabled"]))],64)):_("",!0)}const Qe=P(Rc,[["render",Nc]]),zc={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:Mt,FollowAction:Qe},data(){return{}},computed:{userLevel(){var e;return this.has_leaderboard&&((e=this.xprofile)!=null&&e.total_points)?Ie(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)}},qc=["href"],Gc={class:"fcom_user_display_name"},Yc={key:1,class:"user_route"},Wc=["href"],Zc={class:"fcom_user_display_name"},Kc={class:"fcom_profile_pop_avatar"},Jc={key:0,class:"fcom_prfile_tagline"},Qc={class:"fcom_level_name"},Xc={style:{display:"block"},class:"fcoml_level_sub meta_line"},ed={class:"fcom_profile_pop_info"},td={class:"pop_info_header"},sd={class:"header_name"},od=["href"],id={class:"fcom_user_display_name"},nd={class:"fcom_user_name"},ld={key:0,class:"header_actions"},ad={key:0,class:"fcom_profile_pop_bio"},rd=["title"],cd=["title"],dd={class:"pop_info_btns"},ud=["href"],_d=["href"];function md(e,t,o,u,s,n){const m=g("verified-sign"),f=g("UserBadge"),h=g("UserAvatar"),y=at,w=g("follow-action"),b=g("SocialLinks"),C=rt,p=fe;return o.show_pop?(i(),c("span",Yc,[a(p,{ref:"popoverRef",visible:o.virtualRef?!0:null,"virtual-ref":o.virtualRef,"virtual-triggering":!!o.virtualRef,width:500,"show-after":o.virtualRef?0:500,trigger:o.virtualRef?null:"hover",onShow:n.initShow,onHide:n.onHide,persistent:!1,"popper-class":"fcom_profile_popper",placement:"top","popper-style":"padding: 0;"},{reference:r(()=>[q(e.$slots,"default",{},()=>[l("a",{href:e.$getRouteLink("u/:username",{username:o.xprofile.username}),class:"user_route"},[l("p",Zc,d(o.xprofile.display_name),1)],8,Wc)])]),default:r(()=>[l("div",{class:"fcom_profile_pop",onMouseenter:t[0]||(t[0]=k=>o.virtualRef&&e.$emit("popover-mouseenter")),onMouseleave:t[1]||(t[1]=k=>o.virtualRef&&e.$emit("popover-mouseleave"))},[o.xprofile&&o.xprofile.username?(i(),v(C,{key:0,gutter:20},{default:r(()=>[a(y,{sm:24,md:8},{default:r(()=>[l("div",Kc,[a(h,{xprofile:o.xprofile},null,8,["xprofile"]),n.userLevel?(i(),c("div",Jc,[l("div",Qc,d(n.userLevel.title),1),l("div",Xc,d(n.userLevel.tagline),1)])):_("",!0)])]),_:1}),a(y,{sm:24,md:16},{default:r(()=>{var k,S;return[l("div",ed,[l("div",td,[l("div",sd,[l("a",{href:e.$getRouteLink("u/:username",{username:o.xprofile.username}),class:"user_route"},[l("p",id,d(o.xprofile.display_name),1),o.xprofile.is_verified?(i(),v(m,{key:0})):_("",!0),o.show_badge?(i(),v(f,{key:1,profile:o.xprofile},null,8,["profile"])):_("",!0)],8,od),l("span",nd," @"+d(o.xprofile.username),1)]),o.show_follow?(i(),c("div",ld,[a(w,{profile:o.xprofile},null,8,["profile"])])):_("",!0)]),(k=o.xprofile.meta)!=null&&k.short_description_rendered||o.xprofile.short_description_rendered?(i(),c("div",ad,d(e.getExcerpt(((S=o.xprofile.meta)==null?void 0:S.short_description_rendered)||o.xprofile.short_description_rendered,160)),1)):_("",!0),o.xprofile.created_at?(i(),c("div",{key:1,title:o.xprofile.created_at,class:"meta_line"},d(e.$t("Joined: %s",e.humanDateDiff(o.xprofile.created_at))),9,rd)):_("",!0),o.xprofile.last_activity?(i(),c("div",{key:2,title:o.xprofile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(o.xprofile.last_activity))),9,cd)):_("",!0),l("div",dd,[l("a",{class:"el-button el-button--primary is-text is-has-bg",href:e.$getRouteLink("u/:username",{username:o.xprofile.username})},d(e.$t("View Profile")),9,ud),e.appVars.has_chat&&e.hasPermission("can_initiate_message")?(i(),c("a",{key:0,class:"el-button el-button--primary is-text is-has-bg",href:e.$getRouteLink("chat/?user_id=:user_id",{user_id:o.xprofile.user_id})},d(e.$t("Message")),9,_d)):_("",!0)]),a(b,{style:{"justify-content":"left"},xprofile:o.xprofile,isOwn:!1},null,8,["xprofile"])])]}),_:1})]),_:1})):_("",!0)],32)]),_:3},8,["visible","virtual-ref","virtual-triggering","show-after","trigger","onShow","onHide"]),o.show_verified&&o.xprofile.is_verified?(i(),v(m,{key:0})):_("",!0),o.show_badge?(i(),v(f,{key:1,profile:o.xprofile},null,8,["profile"])):_("",!0)])):(i(),c("a",{key:0,href:e.$getRouteLink("u/:username",{username:o.xprofile.username}),class:"user_route"},[q(e.$slots,"default",{},()=>[l("p",Gc,d(o.xprofile.display_name),1)]),o.show_verified&&o.xprofile.is_verified?(i(),v(m,{key:0})):_("",!0),o.show_badge?(i(),v(f,{key:1,profile:o.xprofile},null,8,["profile"])):_("",!0)],8,qc))}const Me=P(zc,[["render",md]]),hd={name:"CommentReacts",components:{UserRouteLink:Me},data(){return{centerDialogVisible:!1,reactions:null,loading:!1}},props:{comment:{required:!0,default:null}},methods:{getReactions(){this.reactions||(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}))}}},fd={style:{"margin-left":"5px"}},pd={key:0},gd={key:1},yd={class:"fcom_user_lists"},vd={key:2};function bd(e,t,o,u,s,n){const m=W,f=g("UserAvatar"),h=g("UserRouteLink"),y=ge,w=fe;return i(),v(w,{persistent:!1,placement:"bottom",title:e.$t("Likes"),width:210,trigger:"click",onShow:n.getReactions},{reference:r(()=>[l("span",fd,d(o.comment.reactions_count),1)]),default:r(()=>[s.loading?(i(),c("div",pd,[a(m,{animated:!0,rows:1})])):s.reactions?(i(),c("div",gd,[a(y,{"max-height":"300px"},{default:r(()=>[l("ul",yd,[(i(!0),c(L,null,D(s.reactions,b=>(i(),c("li",null,[b.xprofile?(i(),c(L,{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})])):(i(),c("div",vd,[l("p",null,d(e.$t("Failed to load the list")),1)]))]),_:1},8,["title","onShow"])}const kd=P(hd,[["render",bd]]),wd={name:"NestedReplyBox",components:{SingleComment:zs,FeedTextComposer:_t,CommentReactions:kd,HeartIcon:Ke},props:["comment","feed","checkPermission","show_reacts_only","defaultMentions"],emits:["commented","copyLink"],data(){return{open:!1,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,o,u;const e=((t=this.commentReply.media_images)==null?void 0:t.length)>0||((u=(o=this.commentReply.meta)==null?void 0:o.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(s=>{this.comment.comments||(this.comment.comments=[]),this.commentReply={message:"",media_images:[]},this.comment.comments.push(s.comment),Array.isArray(this.feed.comments)&&this.feed.comments.push(s.comment),this.$emit("commented",s.comment),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.open=!1}).catch(s=>{this.$handleError(s)}).finally(()=>{this.submitting=!1}))},toggleCommentBox(e){var o;if(!this.hasCommentPermission(this.feed)){this.$notify({message:this.$t("Please join the Space to post a comment."),type:"warning"});return}this.open=!this.open;let t=(o=e==null?void 0:e.xprofile)==null?void 0:o.username;this.open&&t&&e.user_id!=this.auth.user_id&&(this.commentReply.message=`@${t} `)},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(o=>o.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(o=>{e.liked=o.liked,e.reactions_count=o.reactions_count}).catch(o=>{this.$handleError(o)})},emitCopyLink(e){this.$emit("copyLink",e)}}},Cd={key:0,class:"reply_box"},$d={class:"fcom_comments_react fcom_reaction_list"},Sd={class:"child_comments"},Vd=["id"],Ld={key:0,class:"reply_box"},Md=["onClick"],Fd={class:"fcom_comments_react fcom_reaction_list"},Td={key:0,class:"child_reply_wrap"},Pd={class:"feed_commenting"},Id={class:"person_avatar"},Ud=["alt","src"];function Bd(e,t,o,u,s,n){var C;const m=g("HeartIcon"),f=N,h=g("CommentReactions"),y=g("single-comment"),w=O,b=g("feed-text-composer");return i(),c(L,null,[n.canComment?(i(),c("div",Cd,[((C=o.feed.meta)==null?void 0:C.comments_disabled)!=="yes"?(i(),c("span",{key:0,onClick:t[0]||(t[0]=p=>n.toggleCommentBox(o.comment)),class:"reply_btn"},d(e.$t("Reply")),1)):_("",!0),l("span",{class:R([{fcom_is_liked:o.comment.liked},"reply_btn"])},[l("div",$d,[a(f,{class:R({user_reacted:o.comment.liked}),onClick:t[1]||(t[1]=p=>n.toggleLike(o.comment))},{default:r(()=>[a(m,{filled:o.comment.liked},null,8,["filled"])]),_:1},8,["class"]),parseInt(o.comment.reactions_count)?(i(),v(h,{key:0,comment:o.comment},null,8,["comment"])):_("",!0)])],2),q(e.$slots,"after_reply_box_text")])):_("",!0),!o.show_reacts_only||s.open?(i(),c(L,{key:1},[l("div",Sd,[(i(!0),c(L,null,D(o.comment.comments,(p,k)=>(i(),c("div",{id:"comment_"+p.id,class:"each_comment"},[a(y,{onCopyLink:n.emitCopyLink,onDeleted:S=>n.handleCommentDelete(k),comment:p,show_report:!0},{after_comment_text:r(()=>{var S;return[n.canComment?(i(),c("div",Ld,[((S=o.feed.meta)==null?void 0:S.comments_disabled)!=="yes"?(i(),c("span",{key:0,onClick:$=>n.toggleCommentBox(p),class:"reply_btn"},d(e.$t("Reply")),9,Md)):_("",!0),l("span",{class:R([{fcom_is_liked:p.liked},"reply_btn"])},[l("div",Fd,[a(f,{class:R({user_reacted:p.liked}),onClick:$=>n.toggleLike(p)},{default:r(()=>[a(m,{filled:p.liked},null,8,["filled"])]),_:2},1032,["class","onClick"]),parseInt(p.reactions_count)?(i(),v(h,{key:0,comment:p},null,8,["comment"])):_("",!0)])],2)])):_("",!0)]}),_:2},1032,["onCopyLink","onDeleted","comment"])],8,Vd))),256))]),s.open?(i(),c("div",Td,[l("div",Pd,[l("div",Id,[l("img",{alt:e.$t("Your Photo"),src:e.auth.avatar},null,8,Ud)]),l("div",{onKeydown:t[3]||(t[3]=ye((...p)=>n.maybeSave&&n.maybeSave(...p),["enter"])),class:"feed_comment_input comment_text"},[a(b,{config:{multipleMedia:!0},context:"comment",defaultMentions:o.defaultMentions?o.defaultMentions:[],disabled:s.submitting,autofocus:s.open,mentionQuery:{space_id:o.feed.space_id},content:s.commentReply,placeholder:e.$t("Leave a reply")},{default:r(()=>[a(w,{loading:s.submitting,disabled:s.submitting,onClick:t[2]||(t[2]=p=>n.addComment()),class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Reply")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["defaultMentions","disabled","autofocus","mentionQuery","content","placeholder"])],32)])])):_("",!0)],64)):_("",!0)],64)}const Ed=P(wd,[["render",Bd]]),Ad={name:"FeedComments",components:{SingleComment:zs,NestedReplyBox:Ed},props:["feed","show_all","checkPermission","defaultMentions","sortBy","is_single"],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={},o=[],u={};let s=null;for(let h=0;hy-w):m==="latest"?h.sort((y,w)=>w-y):m==="popular"?h.sort((y,w)=>{var b,C;return(((b=u[w])==null?void 0:b.reactions_count)||0)-(((C=u[y])==null?void 0:C.reactions_count)||0)}):m==="most_replied"&&h.sort((y,w)=>{var b,C;return(((b=t[w])==null?void 0:b.length)||0)-(((C=t[y])==null?void 0:C.length)||0)}),this._sortedTopLevelIds=h,this._lastSortBy=m}let f;if(this._sortedTopLevelIds){const h=new Set(o),y=new Set(this._sortedTopLevelIds);f=this._sortedTopLevelIds.filter(w=>h.has(w)&&u[w]).map(w=>u[w]);for(let w=o.length-1;w>=0;w--)y.has(o[w])||f.unshift(u[o[w]])}else f=o.map(h=>u[h]);return s&&f.unshift(s),{list:f,lastComment:n}},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,this.feed.type=="text"&&this.$eventBus.emit("feed_interaction",this.feed.id)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},collectCommentIds(e){var u;const t=new Set([e.id]),o=e.comments?[...e.comments]:[];for(;o.length;){const s=o.pop();t.add(s.id),(u=s.comments)!=null&&u.length&&o.push(...s.comments)}return t},handleCommentDelete(e){const t=this.collectCommentIds(e);this.feed.comments=this.feed.comments.filter(o=>!t.has(o.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 o=this.$router.resolve(t),u=this.appVars.urls.portal_base;u=u.replace(/\/$/,"");let s=u+o.fullPath;navigator.clipboard.writeText(s).then(()=>{this.$notify.success(this.$t("Link copied to clipboard"))}).catch(n=>{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()}},Dd={key:0,class:"feed_comments"},Rd=["id"],Hd={key:1,class:"feed_comments"},xd={class:"each_comment"};function jd(e,t,o,u,s,n){const m=W,f=g("nested-reply-box"),h=g("single-comment");return o.show_all?(i(),c("div",Dd,[s.loading?(i(),v(m,{key:0,row:5,class:"feed_comments_skeleton"})):(i(),c(L,{key:1},[q(e.$slots,"before_comments_start"),(i(!0),c(L,null,D(n.displayComments,(y,w)=>(i(),c("div",{class:"each_comment",key:y.id,id:"comment_"+y.id},[a(h,{comment:y,space_id:o.feed.space_id,show_report:!0,onCopyLink:n.copyCommentLink,onReload:n.fetchComments,onDeleted:b=>n.handleCommentDelete(y)},be({_:2},[y.parent_id?void 0:{name:"after_comment_text",fn:r(()=>[a(f,{feed:o.feed,comment:y,checkPermission:o.checkPermission,defaultMentions:o.defaultMentions?o.defaultMentions:[],onCopyLink:n.copyCommentLink},null,8,["feed","comment","checkPermission","defaultMentions","onCopyLink"])]),key:"0"}]),1032,["comment","space_id","onCopyLink","onReload","onDeleted"])],8,Rd))),128))],64))])):n.lastComment?(i(),c("div",Hd,[l("div",xd,[a(h,{comment:n.lastComment,space_id:o.feed.space_id,show_report:!0,onCopyLink:n.copyCommentLink,onDeleted:t[1]||(t[1]=y=>n.handleCommentDelete(n.lastComment))},be({_:2},[n.lastComment.parent_id?void 0:{name:"after_comment_text",fn:r(()=>[a(f,{defaultMentions:o.defaultMentions?o.defaultMentions:[],onCopyLink:n.copyCommentLink,show_reacts_only:!0,checkPermission:o.checkPermission,feed:o.feed,comment:n.lastComment},{after_reply_box_text:r(()=>[n.lastComment.comments&&n.lastComment.comments.length?(i(),c("span",{key:0,onClick:t[0]||(t[0]=y=>e.$emit("forceShowAll")),class:"reply_btn last_comment_reply_txt"},d(e.$_n("%d reply","%d replies",n.lastComment.comments.length)),1)):_("",!0)]),_:1},8,["defaultMentions","onCopyLink","checkPermission","feed","comment"])]),key:"0"}]),1032,["comment","space_id","onCopyLink"])]),o.feed.comments_count>1?(i(),c("div",{key:0,onClick:t[2]||(t[2]=y=>n.maybeShowAllComments()),class:"each_comment show_all_comments"},d(e.$t("View more comments")),1)):_("",!0)])):_("",!0)}const Gs=P(Ad,[["render",jd]]);const Od={name:"ReactedUsers",components:{UserRouteLink:Me},data(){return{centerDialogVisible:!1,reactions:null,loading:!1}},props:{feed:{type:Object,required:!0,default:()=>({})}},computed:{reactedProfiles(){let e=[],t=null;return this.feed.has_user_react&&(t=this.auth.user_id,e.push({user_id:t,avatar:this.auth.avatar})),this.each(this.feed.reactions,o=>{o.user_id!=t&&o.xprofile&&e.push({user_id:o.user_id,avatar:o.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,o,u,s;(s=(u=(o=(t=this.$refs.reactedPopover)==null?void 0:t.popperRef)==null?void 0:o.popperInstanceRef)==null?void 0:u.update)==null||s.call(u)})}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1}))}}},Nd=["title"],zd={key:0,class:"reactions_avatars"},qd=["alt","src"],Gd={key:0},Yd={key:1},Wd={class:"fcom_user_lists"},Zd={key:2};function Kd(e,t,o,u,s,n){const m=W,f=g("UserAvatar"),h=g("UserRouteLink"),y=ge,w=fe;return i(),v(w,{ref:"reactedPopover",persistent:!1,"popper-class":"fcom_feed_reacted_user_list",placement:"bottom",title:e.$t("Likes"),width:210,trigger:"click",onShow:n.getReactions},{reference:r(()=>[l("div",{title:e.$t("Click to view"),class:"fcom_reactions"},[n.reactedProfiles&&n.reactedProfiles.length?(i(),c("div",zd,[(i(!0),c(L,null,D(n.reactedProfiles,b=>(i(),c("span",{key:b.id,class:"fcom_reaction_avatar fcom_avatar_is_rounded fcom_user_avatar"},[b!=null&&b.avatar?(i(),c("img",{key:0,alt:e.$t("Reacted Users"),src:b.avatar},null,8,qd)):_("",!0)]))),128))])):_("",!0),l("span",null,d(e.$_n("%s like","%s likes",o.feed.reactions_count)),1)],8,Nd)]),default:r(()=>[s.loading?(i(),c("div",Gd,[a(m,{animated:!0,rows:3})])):s.reactions?(i(),c("div",Yd,[a(y,{"max-height":"300px"},{default:r(()=>[l("ul",Wd,[(i(!0),c(L,null,D(s.reactions,b=>(i(),c("li",null,[b.xprofile?(i(),c(L,{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})])):(i(),c("div",Zd,[l("p",null,d(e.$t("Failed to load the list")),1)]))]),_:1},8,["title","onShow"])}const Jd=P(Od,[["render",Kd]]),Qd={name:"FeedFooter",components:{ReactedUsers:Jd,FeedComments:Gs,FeedTextComposer:_t,ChatIcon:Ze,HeartIcon:Ke},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=>{this.feed.comments||(this.feed.comments=[]),this.feed.comments.push(e.comment),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.comment={message:"",media_images:[]},this.commenting=!1,this.showCommentBox=!1,this.$notify.success(e.message),this.$nextTick(()=>{this.showCommentBox=!0,this.$emit("commented",e.comment)})}).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(o=>{this.feed.has_user_react=t,this.feed.reactions_count=o.new_count}).catch(o=>{this.$handleError(o)})},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 o=this.feed.comments.slice(-30);this.each(o,u=>{u.user_id!=e&&t.push(u.xprofile)}),this.defaultMentions=Ri(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)}},Xd={ref:"feed_footer",class:"feed_footer"},eu={class:"fcom_feed_footer_actions"},tu={class:"fcom_sr_only"},su={class:"fcom_feed_footer_meta"},ou={key:0},iu={key:0,class:"fcom_reactions_count feed_reaction_meta"},nu={class:"feed_comment_count"},lu={key:2,class:"feed_reaction_meta"},au={key:0,ref:"fcom_comment_sorting",class:"fcom_comment_sorting"},ru=["id"],cu={key:0,style:{padding:"0",margin:"0","text-align":"center"}},du={key:1,class:"feed_commenting"},uu={class:"person_avatar"},_u=["src"],mu={key:2,class:""},hu={style:{padding:"0",margin:"0","text-align":"center"}},fu={key:0,style:{margin:"10px 0"}},pu=["href"];function gu(e,t,o,u,s,n){var S,$,I,F;const m=g("HeartIcon"),f=N,h=g("ChatIcon"),y=g("ReactedUsers"),w=oe,b=ie,C=g("feed-comments"),p=O,k=g("feed-text-composer");return i(),c(L,null,[l("div",Xd,[l("div",eu,[l("ul",null,[l("li",{class:R(["fcom_reaction fcom_reaction_list",{react_active:o.feed.has_user_react}]),onClick:t[0]||(t[0]=B=>n.toggleReact())},[a(f,{class:R({user_reacted:o.feed.has_user_react})},{default:r(()=>[a(m,{filled:o.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"])],2),((S=o.feed.meta)==null?void 0:S.comments_disabled)!=="yes"?(i(),c("li",{key:0,class:"fcom_comment_btn_wrap",onClick:t[1]||(t[1]=B=>n.showCommentForm())},[a(f,null,{default:r(()=>[a(h)]),_:1}),l("span",null,[l("span",tu,d(e.$t("Comment")),1)])])):_("",!0)])]),l("div",su,[o.feed.reactions_count||o.feed.comments_count||(($=o.feed.meta)==null?void 0:$.comments_disabled)==="yes"?(i(),c("ul",ou,[o.feed.reactions_count?(i(),c("li",iu,[a(y,{feed:o.feed},null,8,["feed"])])):_("",!0),o.feed.comments_count>0?(i(),c("li",{key:1,onClick:t[2]||(t[2]=(...B)=>n.maybeShowFeedModal&&n.maybeShowFeedModal(...B)),class:"feed_reaction_meta"},[l("div",nu,d(e.$_n("%d comment","%d comments",o.feed.comments_count)),1)])):((I=o.feed.meta)==null?void 0:I.comments_disabled)==="yes"?(i(),c("li",lu,d(e.$t("comments disabled")),1)):_("",!0)])):_("",!0)])],512),a(C,{sortBy:s.sortBy,defaultMentions:s.defaultMentions,onForceShowAll:n.showAll,show_all:s.show_all_comments,feed:o.feed,is_single:o.is_single},{before_comments_start:r(()=>[o.feed.comments_count>=2?(i(),c("div",au,[a(b,{"aria-label":e.$t("Sort comments by"),onChange:t[3]||(t[3]=B=>n.changeCommentsSortBy()),modelValue:s.sortBy,"onUpdate:modelValue":t[4]||(t[4]=B=>s.sortBy=B),class:"fcom_off_color fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Sort by")},{default:r(()=>[a(w,{value:"oldest",label:e.$t("Earliest")},null,8,["label"]),a(w,{value:"latest",label:e.$t("Latest")},null,8,["label"]),a(w,{value:"popular",label:e.$t("Popular")},null,8,["label"]),a(w,{value:"most_replied",label:e.$t("Most Replied")},null,8,["label"])]),_:1},8,["aria-label","modelValue","placeholder"])],512)):_("",!0)]),_:1},8,["sortBy","defaultMentions","onForceShowAll","show_all","feed","is_single"]),s.commenting||o.is_single?(i(),c("div",{key:0,id:"feed_comment_form_"+o.feed.id,class:"feed_comment feed_commentbox_main"},[((F=o.feed.meta)==null?void 0:F.comments_disabled)==="yes"?(i(),c(L,{key:0},[o.feed.comments_count?(i(),c("p",cu,d(e.$t("Comments are disabled for this post.")),1)):_("",!0)],64)):e.hasCommentPermission(o.feed)?(i(),c("div",du,[l("div",uu,[l("img",{alt:"",src:e.auth.photo},null,8,_u)]),s.showCommentBox?(i(),c("div",{key:0,onKeydown:t[6]||(t[6]=ye((...B)=>n.maybeSave&&n.maybeSave(...B),["enter"])),class:"feed_comment_input"},[a(k,{context:"comment",is_modal:o.is_modal,config:{multipleMedia:!0},mentionQuery:{space_id:o.feed.space_id},autofocus_changed:s.commenting,defaultMentions:s.defaultMentions,autofocus:s.isAutoFocus,disabled:s.saving,placeholder:e.$t("Write a comment"),content:s.comment},{default:r(()=>[a(p,{loading:s.saving,disabled:s.saving,class:"fcom_primary_button",onClick:t[5]||(t[5]=B=>n.postComment())},{default:r(()=>[V(d(e.$t("Post Comment")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["is_modal","mentionQuery","autofocus_changed","defaultMentions","autofocus","disabled","placeholder","content"])],32)):_("",!0)])):(i(),c("div",mu,[l("p",hu,[V(d(e.$t("Please join the Space to post a comment."))+" ",1),e.appVars.auth.user_id?(i(),c("div",fu,[a(p,{class:"fcom_primary_button",onClick:t[7]||(t[7]=()=>{e.$emit("joinSpace")})},{default:r(()=>[V(d(e.$t("Join Space")),1)]),_:1})])):(i(),c("a",{key:1,href:e.getCurrentAuthUrl()},d(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,pu))])]))],8,ru)):_("",!0)],64)}const yu=P(Qd,[["render",gu]]),vu={name:"SpaceIcon",props:["space_profile"]},bu=["alt","src"],ku={key:1,class:"fcom_emoji"},wu={key:2,class:"fcom_shape"},Cu={key:3,class:"fcom_no_avatar"};function $u(e,t,o,u,s,n){var f,h,y,w;const m=N;return o.space_profile.logo?(i(),c("img",{key:0,alt:e.$t("Space Logo"),src:o.space_profile.logo},null,8,bu)):(f=o.space_profile.settings)!=null&&f.emoji?(i(),c("span",ku,d((h=o.space_profile.settings)==null?void 0:h.emoji),1)):(y=o.space_profile.settings)!=null&&y.shape_svg?(i(),c("span",wu,[a(m,{innerHTML:(w=o.space_profile.settings)==null?void 0:w.shape_svg},null,8,["innerHTML"])])):(i(),c("span",Cu))}const Oe=P(vu,[["render",$u]]);const Su={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)}}},Vu=["value","maxlength","placeholder"];function Lu(e,t,o,u,s,n){return i(),c("textarea",{value:o.modelValue,onInput:t[0]||(t[0]=(...m)=>n.onInput&&n.onInput(...m)),onKeydown:t[1]||(t[1]=ye(Y(m=>e.$emit("enter"),["prevent"]),["enter"])),ref:"textarea",maxlength:o.maxlength,class:"fcom_status_title_input",rows:"1",placeholder:o.placeholder},null,40,Vu)}const Mu=P(Su,[["render",Lu]]),Fu={name:"EyeIcon"},Tu={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Pu(e,t,o,u,s,n){return i(),c("svg",Tu,[...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 Iu=P(Fu,[["render",Pu]]),Uu={name:"CalendarIcon"},Bu={width:"14",height:"16",viewBox:"0 0 14 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Eu(e,t,o,u,s,n){return i(),c("svg",Bu,[...t[0]||(t[0]=[Te('',5)])])}const Ys=P(Uu,[["render",Eu]]);const Au={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"})},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:Oe,FeedTextComposer:_t,SingleLineTextarea:Mu,EyeIcon:Iu,CalendarIcon:Ys},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:{...Vo(Re,["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.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:{...vs(Ve,["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"}},schedulePost(){if(this.scheduleModalVisible=!1,!this.scheduleForm.date||!this.scheduleForm.time){this.feed.scheduled_at=null;return}this.feed.scheduled_at=`${this.scheduleForm.date} ${this.scheduleForm.time}: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=""},async postStatus(e){var t;this.posting=!0;try{const u=await Ve().createFeed(this.feedContext,e);if(u.scheduled_at||(this.$notify.success(u.message),this.$emit("added",u.feed)),this.feed=this.initFeed(),this.state="idle",u.scheduled_at){const s=this.formattedDateTime(u.scheduled_at);this.$notify.success(this.$t("Your post has been scheduled for %s. Please find the scheduled post from your profile",s))}this.editorReady=!1}catch(o){this.$handleError(o),(t=o==null?void 0:o.shakes)!=null&&t.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(){if(this.space)return[];let e=Object.values(this.allSpaces),t=this.appVars.space_groups,o=[],u=[];this.each(t,n=>{let m=e.filter(f=>{let h=f.parent_id==n.id&&f.permissions&&f.permissions.can_create_post;return h&&u.push(f.slug),h});m.length&&o.push({label:n.title,spaces:m})});let s=e.filter(n=>!n.parent_id&&n.permissions&&n.permissions.can_create_post);s&&s.length&&o.push({label:this.$t("Others"),spaces:s}),this.globalDisabled||o.unshift({label:"",spaces:[{title:this.$t("On my profile"),slug:"__self__post__"}]}),this.postableSpaces=o}},mounted(){(this.editing_feed.id||this.defaultState=="active")&&(this.editorReady=!0)}},Du={class:"person_avatar"},Ru=["alt","src"],Hu={class:"create_header_content"},xu={key:0,class:"fcom_create_status_box_header"},ju={class:"user_infos"},Ou={class:"feed_user_name"},Nu={class:"feed_meta_info"},zu={key:1,class:"feed_timestamp"},qu={class:"create_header_action"},Gu={key:0,ref:"fcom_topics_input",class:"fcom_topics_input"},Yu={style:{margin:"0",display:"block",width:"100%",padding:"5px 0","font-weight":"500"}},Wu={key:0,class:"fcom_meta_text"},Zu={class:"fcom_post_actions"},Ku={key:0,class:"fcom_post_space_name"},Ju={class:"target_label"},Qu={ref:"fcom_posting_space",style:{"margin-right":"10px"}},Xu={key:0,class:"fcom_space_title"},e_={key:1},t_={class:"fcom_empty_spaces_dropdown"},s_={key:0,class:"fcom_composer_admin_actions"},o_={key:0},i_={class:"dialog_header"},n_={class:"dialog_left schedule_header_left"},l_={class:"dialog_body"},a_={class:"fcom_input_help"},r_={class:"dialog_footer"};function c_(e,t,o,u,s,n){const m=g("EditPen"),f=N,h=g("CalendarIcon"),y=O,w=g("EyeIcon"),b=g("Close"),C=g("SingleLineTextarea"),p=oe,k=ie,S=g("SpaceIcon"),$=vt,I=_e,F=g("feed-text-composer"),B=Ge,M=de,E=Ss,A=ue,U=Ce;return n.canPost?(i(),c("div",{key:0,class:R([{state_active:n.isStateActive},"create_status_holder"])},[l("div",{class:R(["create_header",{state_active:n.isStateActive}])},[l("div",Du,[l("img",{alt:o.author.name||e.$t("Your Photo"),src:o.author.avatar||e.auth.avatar},null,8,Ru)]),l("div",Hu,[n.isStateActive?_("",!0):(i(),c("div",{key:0,onClick:t[0]||(t[0]=(...T)=>n.makeActive&&n.makeActive(...T)),class:"form_placeholder"},d(n.currentPlaceHolder),1)),l("div",{class:R([{fcom_editor_with_title:s.hasPostTitle,"is-active":n.isStateActive},"fcom_create_status_box"])},[n.isStateActive?(i(),c("div",xu,[l("div",ju,[l("div",Ou,d(n.getPostTitle),1),l("div",Nu,[!o.editing_feed.id&&n.showScheduleInfo?(i(),c("div",{key:0,onClick:t[1]||(t[1]=(...T)=>n.openScheduleModal&&n.openScheduleModal(...T)),class:"feed_scheduled_info"},[l("span",null,d(n.getScheduleLabel),1),a(f,null,{default:r(()=>[a(m)]),_:1})])):(i(),c("span",zu,d(o.editing_feed.id?e.humanDateDiff(o.editing_feed.created_at):e.dayjs().format(e.appVars.date_time_formatter)),1))])]),l("div",qu,[n.showScheduleIcon?(i(),v(y,{key:0,onClick:n.openScheduleModal,text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["onClick"])):_("",!0),a(y,{onClick:n.previewPost,text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["onClick"]),n.isEditing?_("",!0):(i(),v(y,{key:1,class:"close_btn",onClick:n.cancelPost,text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"]))])])):_("",!0),s.editorReady?(i(),v(F,{key:1,context:"feed",placeholder:n.currentPlaceHolder,config:{surveyApp:!0,space_id:n.currentSpaceId,is_admin:n.isCurrentSpaceAdmin||n.isCommunityAdmin,spaceSlug:n.currentSpaceSlug,disableUpload:o.disableUpload,multipleMedia:!0,documentsApp:n.canUploadDoc,videoApp:!0},autofocus:s.isAutoFocus||!s.hasPostTitle,onEditorCreated:t[9]||(t[9]=()=>{s.isAutoFocus=!0}),mentionQuery:n.currentSpaceSlug&&n.currentSpaceSlug!=="__self__post__"?{space:n.currentSpaceSlug}:{},disabled:s.posting,autofocus_changed:s.autofocus_changed,is_editing:!!n.isEditing,content:s.feed},{before_input:r(()=>[s.hasPostTitle?(i(),v(C,{key:0,maxlength:120,autofocus:!0,isActive:n.isStateActive,modelValue:s.feed.title,"onUpdate:modelValue":t[2]||(t[2]=T=>s.feed.title=T),onEnter:t[3]||(t[3]=T=>n.changeAutoFocus()),placeholder:s.hasPostTitle=="required"?e.$t("Short title of this post"):e.$t("Title (optional)")},null,8,["isActive","modelValue","placeholder"])):_("",!0)]),before_composer_footer:r(()=>[q(e.$slots,"before_footer")]),after_input:r(()=>[e.has_pro&&n.currentTopics.length?(i(),c("div",Gu,[a(k,{"popper-class":"fcom_topics_select","multiple-limit":e.appVars.topicsConfig.max_topics_per_post,modelValue:s.feed.topic_ids,"onUpdate:modelValue":t[4]||(t[4]=T=>s.feed.topic_ids=T),multiple:e.appVars.topicsConfig.max_topics_per_post>1,placeholder:n.getPlaceholder},{default:r(()=>[(i(!0),c(L,null,D(n.currentTopics,T=>(i(),v(p,{key:T.slug,label:T.title,value:T.id},{default:r(()=>[l("span",Yu,d(T.title),1),T.description?(i(),c("span",Wu,d(T.description),1)):_("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["multiple-limit","modelValue","multiple","placeholder"])],512)):_("",!0)]),after_composer_footer:r(()=>[e.hasFeature("mention_mail")&&n.isCurrentSpaceAdmin&&s.feed.send_announcement_email?(i(),c("div",s_,[a(I,{disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:s.feed.send_announcement_email,"onUpdate:modelValue":t[8]||(t[8]=T=>s.feed.send_announcement_email=T)},{default:r(()=>[V(d(e.$t("Send announcement email to space members"))+" ",1),e.has_pro?_("",!0):(i(),c("span",o_,"("+d(e.$t("Require Pro"))+")",1))]),_:1},8,["disabled","modelValue"])])):_("",!0)]),default:r(()=>[l("div",Zu,[o.space&&n.isStateActive?(i(),c("div",Ku,[l("span",null,"#"+d(o.space),1)])):_("",!0),!o.space&&!o.disableSpace?(i(),c(L,{key:1},[l("span",Ju,d(e.$t("Posting in:")),1),l("span",Qu,[a(k,{modelValue:s.feed.space,"onUpdate:modelValue":t[5]||(t[5]=T=>s.feed.space=T),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]=T=>n.feedSpaceChanged())},{empty:r(()=>[l("p",t_,d(Object.keys(n.allSpaces).length?e.$t("No spaces to post in"):e.$t("Join a space to post")),1)]),default:r(()=>[(i(!0),c(L,null,D(s.postableSpaces,T=>(i(),v($,{key:T.label,label:T.label},{default:r(()=>[(i(!0),c(L,null,D(T.spaces,j=>(i(),v(p,{key:j.slug,label:j.title,value:j.slug},{default:r(()=>[j.id?(i(),c("span",Xu,[a(S,{space_profile:j},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(j.title,30)),1)])):(i(),c("span",e_,d(e.getExcerpt(j.title,30)),1))]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","placeholder"])],512)],64)):_("",!0),q(e.$slots,"before_submit_btn"),a(y,{onClick:t[7]||(t[7]=T=>n.post()),disabled:s.posting||n.isEditing&&o.saving,loading:n.isEditing?o.saving:s.posting,class:R(["fcom_primary_button",{fcom_update_button:n.isEditing}])},{default:r(()=>[V(d(n.getButtonLabel),1)]),_:1},8,["disabled","loading","class"])])]),_:3},8,["placeholder","config","autofocus","mentionQuery","disabled","autofocus_changed","is_editing","content"])):_("",!0),q(e.$slots,"after_composer")],2)])],2),a(U,{modelValue:s.scheduleModalVisible,"onUpdate:modelValue":t[12]||(t[12]=T=>s.scheduleModalVisible=T),width:e.modalWidth,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1},{header:r(()=>[l("div",i_,[l("div",n_,[l("h4",null,d(e.$t("Schedule Post")),1),l("p",null,d(e.$t("Choose a date and time in the future when you want your post to be published")),1)])])]),footer:r(()=>[l("div",r_,[a(y,{class:"fcom_secondary_button",onClick:n.cancelSchedule},{default:r(()=>[V(d(e.$t("Remove Schedule")),1)]),_:1},8,["onClick"]),a(y,{class:"fcom_primary_button",disabled:n.isScheduleDisabled,onClick:n.schedulePost},{default:r(()=>[V(d(e.$t("Select Schedule")),1)]),_:1},8,["disabled","onClick"])])]),default:r(()=>[l("div",l_,[a(A,{"label-position":"top",class:"fcom_schedule_form"},{default:r(()=>[a(M,{label:e.$t("Date")},{default:r(()=>[a(B,{modelValue:s.scheduleForm.date,"onUpdate:modelValue":t[10]||(t[10]=T=>s.scheduleForm.date=T),type:"date","value-format":"YYYY-MM-DD",format:"YYYY-MM-DD",placeholder:e.$t("Select Date"),"disabled-date":n.isDateDisabled},null,8,["modelValue","placeholder","disabled-date"])]),_:1},8,["label"]),a(M,{label:e.$t("Time")},{default:r(()=>[a(E,{modelValue:s.scheduleForm.time,"onUpdate:modelValue":t[11]||(t[11]=T=>s.scheduleForm.time=T),disabled:!s.scheduleForm.date,style:{width:"210px"},step:"00:10",start:n.getStartTime,end:"23:59",placeholder:e.$t("Select Time")},null,8,["modelValue","disabled","start","placeholder"])]),_:1},8,["label"])]),_:1}),a(M,null,{default:r(()=>[l("p",a_,d(e.$t("The date and time is based on your site's Timezone")),1)]),_:1})])]),_:1},8,["modelValue","width"])],2)):_("",!0)}const Ft=P(Au,[["render",c_]]),d_={name:"EditFeed",components:{SpaceIcon:Oe,CreateStatusForm:Ft},data(){return{loading:!1,saving:!1,localDialogVisible:this.dialogVisible,feed:{},autofocus_changed:!1,hasPostTitle:this.hasFeature("has_post_title"),changeSpace:!1,newSpaceId:null,makePublish:!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}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},handleUpdatePost(e){var o;let t={id:e.id,title:e.title,message:e.message,space:(o=e==null?void 0:e.space)==null?void 0:o.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),this.makePublish&&(t.status="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()}},u_={class:"fcom_feed_edit"},__={class:"fcom_feed_edit_dialog_header"},m_={key:0,class:"fcom_feed_edit_dialog_body"},h_={key:0},f_={key:0,style:{"margin-top":"5px"}},p_={class:"fcom_space_title"};function g_(e,t,o,u,s,n){const m=g("Close"),f=N,h=_e,y=oe,w=g("SpaceIcon"),b=ie,C=g("create-status-form"),p=W,k=Ce,S=Q("loading");return i(),c("div",u_,[a(k,{class:"fcom_feed_edit_dialog",modelValue:s.localDialogVisible,"onUpdate:modelValue":t[3]||(t[3]=$=>s.localDialogVisible=$),width:e.dialogWidth,"append-to-body":!0,overflow:"","before-close":()=>{},"show-close":!1},{default:r(()=>{var $,I;return[G((i(),c("div",null,[l("div",__,[l("span",null,d(e.$t("Edit Feed")),1),a(f,{onClick:n.handleClose},{default:r(()=>[a(m)]),_:1},8,["onClick"])]),s.feed.id?(i(),c("div",m_,[!(o.hide_create_form&&e.auth.user_id)||e.canEditFeed(s.feed)?(i(),v(C,{key:0,"default-state":"active",btn_text:e.$t("Update"),editing_feed:s.feed,author:o.author,onUpdatePost:n.handleUpdatePost,saving:s.saving,disableSpace:!0,space:(I=($=s.feed)==null?void 0:$.space)==null?void 0:I.slug},{after_composer:r(()=>[n.canMovePost?(i(),c("div",h_,[a(h,{modelValue:s.changeSpace,"onUpdate:modelValue":t[0]||(t[0]=F=>s.changeSpace=F)},{default:r(()=>[V(d(e.$t("Move to a different space")),1)]),_:1},8,["modelValue"]),s.changeSpace?(i(),c("div",f_,[a(b,{modelValue:s.newSpaceId,"onUpdate:modelValue":t[1]||(t[1]=F=>s.newSpaceId=F),placeholder:e.$t("Select destination"),style:{width:"100%"}},{default:r(()=>[a(y,{value:"profile",label:n.profileOptionLabel,disabled:!s.feed.space_id},{default:r(()=>[l("span",null,d(n.profileOptionLabel),1)]),_:1},8,["label","disabled"]),(i(!0),c(L,null,D(e.appVars.auth.spaces,F=>(i(),v(y,{disabled:s.feed.space_id==F.id,key:F.id,label:F.title,value:F.id},{default:r(()=>[l("span",p_,[a(w,{space_profile:F},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(F.title,30)),1)])]),_:2},1032,["disabled","label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):_("",!0)])):_("",!0)]),before_submit_btn:r(()=>[s.feed.status=="unlisted"?(i(),v(h,{key:0,modelValue:s.makePublish,"onUpdate:modelValue":t[2]||(t[2]=F=>s.makePublish=F)},{default:r(()=>[V(d(e.$t("Publish as a post")),1)]),_:1},8,["modelValue"])):_("",!0)]),_:1},8,["btn_text","editing_feed","author","onUpdatePost","saving","space"])):_("",!0)])):(i(),v(p,{key:1,rows:5,animated:!0}))])),[[S,s.loading]])]}),_:1},8,["modelValue","width"])])}const os=P(d_,[["render",g_]]),y_={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=Ie(this.xprofile.total_points);return e?e.level:0},withCompletion(){var o;if(!this.with_completion||!((o=this.xprofile)!=null&&o.total_points))return!1;const e=Ie(this.xprofile.total_points),t=Ie(e.max_points+1);return e.level!==t.level},getOutlineStyle(){if(!this.withCompletion)return{};const e=Ie(this.xprofile.total_points),t=Ie(e.max_points+1),o=this.xprofile.total_points-e.min_points,u=t.min_points-e.min_points,n=o/u*100/100*360;return{backgroundImage:`conic-gradient(rgb(56, 117, 223) ${n}deg, #D9D9D9 ${n}deg)`}}},methods:{setAltImg(e){e.target.src=this.appVars.assets_url+"images/placeholder.png"}}},v_=["src"],b_={key:1,class:"fcom_no_image"},k_={key:0,role:"region","aria-label":"User Level",class:"fcom_user_level_mark"};function w_(e,t,o,u,s,n){return i(),c("div",{class:R([{fcom_avatar_is_rounded:o.is_rounded,is_member_online:o.is_online},"fcom_user_avatar"])},[l("span",{style:re(n.getOutlineStyle),class:R({fcom_compilation_avatar:n.withCompletion})},[o.xprofile?(i(),c("img",{key:0,onError:t[0]||(t[0]=(...m)=>n.setAltImg&&n.setAltImg(...m)),src:o.xprofile.avatar,alt:""},null,40,v_)):(i(),c("span",b_))],6),n.level||o.is_online?(i(),c("div",k_,[l("span",null,d(n.level),1)])):_("",!0)],2)}const is=P(y_,[["render",w_]]),C_={name:"SurveyVoters",props:["feed","option","options","totalCount"],components:{UserRouteLink:Me,UserAvatar:is},data(){return{voters:[],loading:!1,showVotersDialog:!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 e;this.loading=!0,this.$get(`feeds/${this.feed.id}/apps/survey-voters/${(e=this.option)==null?void 0:e.slug}`).then(t=>{this.voters=t.voters}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})}},mounted(){this.loadVoters()}},$_={class:"dialog_header"},S_={class:"fcom_filter_menu"},V_={class:"fcom_filter_menu_ul"},L_=["onClick"],M_={key:1},F_={class:"feed_meta_info survey_voters_meta"},T_={class:"meta_line"},P_={class:"meta_line"},I_={class:"voters_list"},U_={class:"voter_avatar"},B_={class:"voter_info"},E_=["title"],A_={key:2,class:"not_found"};function D_(e,t,o,u,s,n){const m=W,f=g("UserAvatar"),h=g("UserRouteLink"),y=ge,w=Ce;return i(),v(w,{modelValue:s.showVotersDialog,"onUpdate:modelValue":t[0]||(t[0]=b=>s.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:n.closeDialog},{header:r(({close:b})=>[l("div",$_,[l("div",S_,[l("ul",V_,[(i(!0),c(L,null,D(o.options,C=>(i(),c("li",{key:C.slug},[l("a",{onClick:Y(p=>n.switchOption(C.slug),["prevent"]),class:R({"router-link-exact-active":o.option.slug==C.slug}),href:"#"},d(C.label),11,L_)]))),128))])])])]),default:r(()=>[s.loading?(i(),v(m,{key:0,animated:"",rows:4})):s.voters.length?(i(),c("div",M_,[l("div",F_,[l("span",T_,d(n.getVotePercentage),1),l("span",P_,d(e.$_n("%s Vote","%s Votes",o.option.vote_counts)),1)]),a(y,{"max-height":"800px"},{default:r(()=>[l("div",I_,[(i(!0),c(L,null,D(s.voters,b=>(i(),c("div",{key:b.id,class:"voter_item"},[b.xprofile?(i(),c(L,{key:0},[l("div",U_,[a(f,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"])]),l("div",B_,[a(h,{show_badge:!0,xprofile:b.xprofile},null,8,["xprofile"]),b.xprofile.created_at?(i(),c("div",{key:0,title:b.xprofile.created_at,class:"voter_time"},d(e.$t("Joined %s",e.humanDateDiff(b.xprofile.created_at))),9,E_)):_("",!0)])],64)):_("",!0)]))),128))])]),_:1})])):(i(),c("div",A_,[l("p",null,d(e.$t("No voters yet")),1)]))]),_:1},8,["modelValue","width","onClose"])}const R_=P(C_,[["render",D_]]),H_={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:R_},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,o={width:t+"%"};return t>0&&t<100&&(o["border-top-right-radius"]=0,o["border-bottom-right-radius"]=0),o},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,o=>{o.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,o=>{e.push(o),o.vote_counts&&(t+=parseInt(o.vote_counts))}),this.formattedOptions=e,this.totalCount=t,this.endingDate=this.feed.meta.survey_config.end_date)}},mounted(){this.setupData()}},x_={class:"fcom_app_options"},j_=["onClick"],O_={class:"fcom_app_text"},N_={class:"fcom_app_input_wrap"},z_={key:0,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 6"},q_={key:1,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8 8"},G_=["onClick"],Y_={key:0},W_={class:"feed_meta_info"},Z_={key:0,class:"meta_line"},K_=["title"],J_=["title"];function Q_(e,t,o,u,s,n){const m=g("ArrowRight"),f=N,h=g("SurveyVoters");return i(),c(L,null,[l("div",{class:R(["fcom_app_render",{"no-border":n.shouldHideBorder}])},[l("div",x_,[(i(!0),c(L,null,D(s.formattedOptions,(y,w)=>(i(),c("div",{key:y.slug,onClick:b=>n.toggleVote(w),class:R([y.voted?"fcom_is_voted":"","fcom_app_option"])},[l("div",O_,[l("span",N_,[l("span",{class:R("fcom_input_"+s.inputType)},[s.inputType=="single_choice"?(i(),c("svg",z_,[...t[1]||(t[1]=[l("circle",{cx:"3",cy:"3",r:"2.5",fill:"currentColor"},null,-1)])])):(i(),c("svg",q_,[...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,d(y.label),1)]),l("div",{class:"fcom_app_counts",onClick:b=>n.showVoters(y)},[V(d(y.vote_counts?Math.floor(y.vote_counts/s.totalCount*100)+"%":"")+" ",1),y.vote_counts?(i(),c("span",Y_,"("+d(y.vote_counts)+")",1)):_("",!0),y.vote_counts?(i(),v(f,{key:1,class:"fcom_arrow_icon"},{default:r(()=>[a(m)]),_:1})):_("",!0)],8,G_),s.totalCount?(i(),c("span",{key:0,style:re(n.getVoteStyle(y.vote_counts)),class:"fc_app_shadow"},null,4)):_("",!0)],10,j_))),128))]),l("div",W_,[s.totalCount?(i(),c("span",Z_,d(e.$_n("%d vote","%d votes",s.totalCount)),1)):_("",!0),s.endingDate?(i(),c(L,{key:1},[n.isEnded?(i(),c("span",{key:0,title:e.$t("Ended at: %s",s.endingDate),class:"meta_line"},d(n.endedDateLabel),9,K_)):(i(),c("span",{key:1,title:e.$t("Will end at: %s",s.endingDate),class:"meta_line"},d(n.endingDateLabel),9,J_))],64)):_("",!0)])],2),s.showVotersDialog?(i(),v(h,{key:0,feed:o.feed,option:s.selectedOption,options:s.formattedOptions,totalCount:s.totalCount,onUpdateOption:n.updateOption,onClose:t[0]||(t[0]=y=>s.showVotersDialog=!1)},null,8,["feed","option","options","totalCount","onUpdateOption"])):_("",!0)],64)}const Ws=P(H_,[["render",Q_]]),X_={name:"BookmarkIcon",props:["is_active"]},em={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"},tm={key:1,width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function sm(e,t,o,u,s,n){return o.is_active?(i(),c("svg",em,[...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)])])):(i(),c("svg",tm,[...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 Zs=P(X_,[["render",sm]]);const om={name:"RenderChildPost",components:{ImageCarousel:St,SurveyRenderer:Ws,DocumentLists:Je,UserRouteLink:Me,MediaPreview:Ae,FeedMdContent:Lt},props:["feed_id"],data(){return{feed:null,loading:!1,notFound:null,in_space:this.$route.params.space,hasOverflowContent:!1}},computed:{hasTopMedia(){var t,o,u,s,n,m;if(this.appVars.features.post_layout!="modern"||!this.feed)return!1;let e=["oembed","iframe_html"].includes((o=(t=this.feed.meta)==null?void 0:t.media_preview)==null?void 0:o.type);return e||(e=(s=(u=this.feed.meta)==null?void 0:u.media_preview)==null?void 0:s.is_uploaded),e||(e=((m=(n=this.feed.meta)==null?void 0:n.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()}},im=["id"],nm={key:0,class:"fcom_top_media"},lm={class:"fcom_feed_header_wrap"},am={class:"feed_header"},rm={key:0,class:"feed_user"},cm={class:"feed_user_name"},dm={class:"feed_meta_info"},um={key:0,class:"meta_line"},_m=["title","href"],mm={key:1,class:"feed_timestamp"},hm={key:0,class:"feed_title"},fm={class:"feed_title_heading"},pm={key:1,class:"expand-button"};function gm(e,t,o,u,s,n){var k,S,$,I,F,B,M,E,A,U;const m=g("media-preview"),f=g("UserAvatar"),h=g("UserRouteLink"),y=g("FeedMdContent"),w=O,b=g("DocumentLists"),C=g("SurveyRenderer"),p=g("ImageCarousel");return s.feed?(i(),c("div",{key:0,onClick:t[0]||(t[0]=(...T)=>n.handleFeedClick&&n.handleFeedClick(...T)),class:"fcom_child_feed"},[l("div",{id:"feed_id_"+s.feed.id,class:R([n.feedClasses,"feed"])},[n.hasTopMedia?(i(),c("div",nm,[s.feed.meta&&s.feed.meta.media_preview?(i(),v(m,{key:0,feed:s.feed},null,8,["feed"])):_("",!0)])):_("",!0),l("div",lm,[l("div",am,[s.feed.xprofile?(i(),c("div",rm,[a(f,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"]),l("div",null,[l("div",cm,[a(h,{show_badge:!0,xprofile:s.feed.xprofile,show_follow:!0},null,8,["xprofile"])]),l("div",dm,[s.feed.content_type=="survey"&&((I=($=(S=(k=s.feed)==null?void 0:k.meta)==null?void 0:S.survey_config)==null?void 0:$.options)!=null&&I.length)?(i(),c("span",um,d(e.$t("created a poll")),1)):_("",!0),l("a",{title:s.feed.created_at,href:s.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(s.feed.created_at)),9,_m),!s.in_space&&s.feed.space?(i(),c("span",mm,d(e.$t("Posted in %s",e.getExcerpt(s.feed.space.title,30))),1)):_("",!0)])])])):_("",!0)])]),l("div",{ref:"feed_body",class:R([{feed_is_overflow_content:s.hasOverflowContent},"feed_body"])},[s.feed.title?(i(),c("div",hm,[l("h2",fm,d(s.feed.title),1)])):_("",!0),a(y,{class_name:"feed_texts",content:s.feed.message_rendered},null,8,["content"]),s.hasOverflowContent?(i(),c("div",pm,[a(w,{class:"btn_expand"},{default:r(()=>[V(d(e.$t("Show More")),1)]),_:1})])):_("",!0)],2),s.feed.content_type=="document"?(i(),v(b,{key:1,document_lists:((B=(F=s.feed)==null?void 0:F.meta)==null?void 0:B.document_lists)||[]},null,8,["document_lists"])):(i(),c(L,{key:2},[s.feed.content_type=="survey"&&((U=(A=(E=(M=s.feed)==null?void 0:M.meta)==null?void 0:E.survey_config)==null?void 0:A.options)!=null&&U.length)?(i(),v(C,{key:0,feed:s.feed,isChildFeed:!0},null,8,["feed"])):_("",!0),s.feed.meta?(i(),c(L,{key:1},[s.feed.meta.media_items?(i(),v(p,{key:0,feed:s.feed},null,8,["feed"])):!n.hasTopMedia&&s.feed.meta.media_preview?(i(),v(m,{key:1,feed:s.feed},null,8,["feed"])):_("",!0)],64)):_("",!0)],64))],10,im)])):_("",!0)}const ym=P(om,[["render",gm]]),vm={name:"CustomAppMeta",components:{RenderChildPost:ym},props:{feed:{type:Object,required:!0}}},bm={ref:"fcom_custom_app"},km={key:0},wm=["innerHTML"];function Cm(e,t,o,u,s,n){const m=g("RenderChildPost");return i(),c("div",bm,[o.feed.meta.custom_app_preview.app_name=="child_post"&&o.feed.meta.custom_app_preview.feed_id?(i(),c("div",km,[a(m,{feed_id:o.feed.meta.custom_app_preview.feed_id},null,8,["feed_id"])])):o.feed.meta.custom_app_preview.custom_html?(i(),c("div",{key:1,innerHTML:o.feed.meta.custom_app_preview.custom_html},null,8,wm)):_("",!0)],512)}const $m=P(vm,[["render",Cm]]),Sm={name:"FeedAction",components:{EditFeed:os},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,o;return!(((t=this.feed)==null?void 0:t.user_id)==((o=this.auth)==null?void 0:o.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("fcon_shake"),setTimeout(()=>{t.classList.remove("fcon_shake")},1e3))},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}))},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(o=>{var s;let u=((s=o.feed.meta)==null?void 0:s.comments_disabled)=="yes";this.$notify.success(u?this.$t("Comments have been disabled."):this.$t("Comments have been enabled.")),this.feed.meta.comments_disabled=o.feed.meta.comments_disabled}).catch(o=>{this.$handleError(o)}).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(()=>{}))}}},Vm={class:"actions_items"},Lm={key:0},Mm={key:1},Fm={key:0},Tm={key:1},Pm={key:0},Im={key:1};function Um(e,t,o,u,s,n){var b,C;const m=g("MoreFilled"),f=N,h=O,y=fe,w=g("EditFeed");return i(),c(L,null,[a(y,{persistent:!1,ref:"popover",placement:"bottom",width:200,trigger:"click"},{reference:r(()=>[a(h,{"aria-label":e.$t("View Post actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>{var p,k;return[l("ul",Vm,[q(e.$slots,"before_feed_actions_pop"),l("li",{onClick:t[0]||(t[0]=S=>n.copyFeedLink())},d(e.$t("Copy Link")),1),n.showReportOption?(i(),c("li",{key:0,onClick:t[1]||(t[1]=S=>n.reportPost())},d(e.$t("Report Post")),1)):_("",!0),e.canEditFeed(o.feed)?(i(),c(L,{key:1},[l("li",{onClick:t[2]||(t[2]=S=>n.editItem())},d(e.$t("Edit")),1),o.feed.space&&e.hasSpaceAdminAccess(o.feed.space)?(i(),c(L,{key:0},[l("li",{onClick:t[3]||(t[3]=S=>n.toggleSticky())},[o.feed.is_sticky?(i(),c("span",Lm,d(e.$t("Unpin from Top")),1)):(i(),c("span",Mm,d(e.$t("Pin to top")),1))]),l("li",{onClick:t[4]||(t[4]=S=>n.toggleSidebarPin())},[o.feed.priority?(i(),c("span",Tm,d(e.$t("Unpin from sidebar")),1)):(i(),c("span",Fm,d(e.$t("Pin to sidebar")),1))])],64)):_("",!0),(p=o.feed.meta)!=null&&p.media_preview?(i(),c("li",{key:1,onClick:t[5]||(t[5]=S=>n.removePreview())},d(e.$t("Remove Preview")),1)):_("",!0),e.hasSpaceAdminAccess(o.feed.space)?(i(),c("li",{key:2,onClick:t[6]||(t[6]=S=>n.toggleCommentStatus())},[((k=o.feed.meta)==null?void 0:k.comments_disabled)=="yes"?(i(),c("span",Pm,d(e.$t("Enable comments")),1)):(i(),c("span",Im,d(e.$t("Disable comments")),1))])):_("",!0)],64)):_("",!0),e.canDeleteFeed(o.feed)?(i(),c("li",{key:2,onClick:t[7]||(t[7]=S=>n.deleteItem())},d(e.$t("Delete")),1)):_("",!0),q(e.$slots,"after_feed_actions_pop")])]}),_:3},512),s.isEdit?(i(),v(w,{key:0,feedSlug:o.feed.slug,dialogVisible:s.isEdit,hide_create_form:o.hide_create_form,author:{name:(b=o.feed.xprofile)==null?void 0:b.display_name,avatar:(C=o.feed.xprofile)==null?void 0:C.avatar},onUpdated:n.handleUpdate,onClose:t[8]||(t[8]=p=>s.isEdit=!1)},null,8,["feedSlug","dialogVisible","hide_create_form","author","onUpdated"])):_("",!0)],64)}const Ks=P(Sm,[["render",Um]]);const Bm={name:"Feed",components:{DocumentLists:Je,CustomAppMeta:$m,BookmarkIcon:Zs,StickyIcon:Vt,UserRouteLink:Me,EditFeed:os,FeedFooter:yu,MediaPreview:Ae,ImageCarousel:St,SurveyRenderer:Ws,ReportReview:Ns,FeedAction:Ks,FeedMdContent:Lt},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&&((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,o,u,s,n,m;if(this.appVars.features.post_layout!="modern")return!1;let e=["oembed","iframe_html"].includes((o=(t=this.feed.meta)==null?void 0:t.media_preview)==null?void 0:o.type);return e||(e=(s=(u=this.feed.meta)==null?void 0:u.media_preview)==null?void 0:s.is_uploaded),e||(e=((m=(n=this.feed.meta)==null?void 0:n.media_items)==null?void 0:m.length)==1),e}},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.formattedDate(e)+" at "+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},showFullContent(e){if(!this.hasFeature("show_post_modal")){this.hasOverflowContent=!1,this.isExpanded=!0;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 o=e.replace(/])*>|<[^>]+>|#([\p{L}\p{M}\p{N}_-]+)/gu,(s,n,m,f)=>s.startsWith("#${n}`:s);return o.indexOf('s.replace(/([^<]+)<\/span>/g,(n,m,f)=>{try{const h=this.dayjs(m*1e3);if(!h.isValid())return n;const w=h.local().format("D MMM YYYY, LT (")+this.currentTimeZoneName+")";return`${w}`}catch{return n}}))(o)},isInsideHtmlTag(e,t){let o=!1;for(let u=0;u"&&(o=!1);return o},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})}},created(){this.$eventBus.on("updateModerationReport",e=>{var t,o;((t=e.content)==null?void 0:t.id)==((o=this.feed)==null?void 0:o.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)))})},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)}},Em=["id"],Am={key:1,class:"fcom_top_media"},Dm={key:2,class:"fcom_feed_header_wrap"},Rm={class:"feed_actions fcom_concat_buttons"},Hm={key:0,class:"fcom_feed_topics"},xm={class:"feed_header"},jm={key:0,class:"feed_user"},Om={class:"feed_user_info"},Nm={class:"feed_user_name"},zm={key:0,class:"feed_status"},qm={key:1,class:"feed_status"},Gm={class:"feed_meta_info"},Ym={key:0,class:"meta_line"},Wm=["title","href"],Zm=["title","href"],Km={key:3},Jm={key:0,class:"feed_title"},Qm={key:0,class:"feed_title_heading"},Xm=["href"],eh={key:1,class:"feed_title_heading"};function th(e,t,o,u,s,n){var T,j,z,ne,x,ee,H,te,K,ce,J,se,ht;const m=g("report-review"),f=g("media-preview"),h=O,y=g("StickyIcon"),w=N,b=g("BookmarkIcon"),C=g("FeedAction"),p=g("router-link"),k=g("UserAvatar"),S=g("UserRouteLink"),$=Be,I=g("FeedMdContent"),F=g("SurveyRenderer"),B=g("ImageCarousel"),M=g("DocumentLists"),E=g("CustomAppMeta"),A=g("feed-footer"),U=Q("loading");return G((i(),c("div",{id:"feed_id_"+((T=o.feed)==null?void 0:T.id),class:R([n.feedClasses,"feed"])},[n.showReport?(i(),v(m,{key:0,feed:o.feed},null,8,["feed"])):_("",!0),n.hasTopMedia?(i(),c("div",Am,[o.feed.meta&&o.feed.meta.media_preview?(i(),v(f,{key:0,feed:o.feed,is_preview:o.is_preview},null,8,["feed","is_preview"])):_("",!0)])):_("",!0),o.show_header?(i(),c("div",Dm,[l("div",Rm,[e.auth.user_id&&!e.hasSpaceAccess((j=o.feed.space)==null?void 0:j.slug)&&!o.is_single&&!o.isSingleSpacePage?(i(),v(h,{key:0,loading:s.joiningSpace,class:"fcom_secondary_button join_button",onClick:t[0]||(t[0]=me=>n.joinSpace())},{default:r(()=>[V(d(e.$t("Join")),1)]),_:1},8,["loading"])):_("",!0),o.show_actions?(i(),c(L,{key:1},[o.feed.is_sticky&&s.in_space?(i(),v(h,{key:0,onClick:t[1]||(t[1]=me=>n.toggleSticky()),"aria-label":e.$t("Toggle Sticky"),class:"no_pad_btn",text:"",size:"small"},{default:r(()=>[a(w,{class:"fcom_sticky"},{default:r(()=>[a(y)]),_:1})]),_:1},8,["aria-label"])):_("",!0),e.auth.user_id?(i(),v(h,{key:1,"aria-label":e.$t("Toggle Bookmark"),size:"small",text:"",onClick:t[2]||(t[2]=me=>n.toggleBookmark()),class:R([{bookmark_active:o.feed.bookmarked},"feed_bookmark no_pad_btn"]),title:o.feed.bookmarked?e.$t("Remove From Bookmark"):e.$t("Bookmark this post")},{default:r(()=>[a(w,{style:{"font-size":"14px"}},{default:r(()=>[a(b,{is_active:o.feed.bookmarked},null,8,["is_active"])]),_:1})]),_:1},8,["aria-label","class","title"])):_("",!0),a(C,{feed:o.feed,hide_create_form:o.hide_create_form,onUpdated:n.handleUpdate,onDeleted:n.handleDelete},{before_feed_actions_pop:r(()=>[o.is_route?(i(),c("li",{key:0,onClick:t[3]||(t[3]=me=>e.$emit("reload"))},d(e.$t("Refresh")),1)):_("",!0)]),_:1},8,["feed","hide_create_form","onUpdated","onDeleted"])],64)):_("",!0),q(e.$slots,"after_feed_actions")]),((z=e.appVars.topicsConfig)==null?void 0:z.show_on_post_card)=="yes"&&o.feed.terms&&o.feed.terms.length?(i(),c("div",Hm,[(i(!0),c(L,null,D(o.feed.terms,me=>(i(),v(p,{onClick:Y(sP=>n.gotoTopicUrl(me.slug),["prevent"]),key:me.slug,to:n.getTopicRoute(me.slug),class:"feed_timestamp"},{default:r(()=>[V("#"+d(me.title),1)]),_:2},1032,["onClick","to"]))),128))])):_("",!0),l("div",xm,[o.feed.xprofile?(i(),c("div",jm,[a(k,{with_level:!1,xprofile:o.feed.xprofile},null,8,["xprofile"]),l("div",Om,[l("div",Nm,[a(S,{show_badge:!0,xprofile:o.feed.xprofile,show_follow:!0},null,8,["xprofile"]),o.feed.status=="pending"?(i(),c("span",zm,[a($,{type:"warning"},{default:r(()=>[V(d(e.$t("In Review")),1)]),_:1})])):_("",!0),o.feed.status=="scheduled"?(i(),c("span",qm,[a($,{type:"warning"},{default:r(()=>[V(d(e.$t("Scheduled")),1)]),_:1})])):_("",!0)]),l("div",Gm,[o.feed.content_type=="survey"&&((H=(ee=(x=(ne=o.feed)==null?void 0:ne.meta)==null?void 0:x.survey_config)==null?void 0:ee.options)!=null&&H.length)?(i(),c("span",Ym,d(e.$t("created a poll")),1)):_("",!0),o.feed.status=="scheduled"?(i(),c("a",{key:1,title:o.feed.scheduled_at,onClick:t[4]||(t[4]=(...me)=>n.gotoFeed&&n.gotoFeed(...me)),href:o.feed.permalink,class:"feed_timestamp"},d(n.getScheduledTime(o.feed.scheduled_at)),9,Wm)):(i(),c("a",{key:2,title:o.feed.created_at,onClick:t[5]||(t[5]=(...me)=>n.gotoFeed&&n.gotoFeed(...me)),href:o.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(o.feed.created_at)),9,Zm)),!s.in_space&&o.feed.space?(i(),c("span",Km,[a(p,{to:n.getSpaceRoute(o.feed.space.slug),class:"feed_timestamp"},{default:r(()=>[V(d(e.$t("Posted in %s",e.getExcerpt(o.feed.space.title,30))),1)]),_:1},8,["to"])])):_("",!0)])])])):_("",!0),q(e.$slots,"after_feed_header")])])):_("",!0),l("div",{ref:"feed_body",class:R([{feed_is_overflow_content:s.hasOverflowContent},"feed_body"])},[o.feed.title?(i(),c("div",Jm,[o.is_single?(i(),c("h2",eh,d(o.feed.title),1)):(i(),c("h2",Qm,[l("a",{onClick:t[6]||(t[6]=Y((...me)=>n.showFullContent&&n.showFullContent(...me),["prevent"])),href:o.feed.permalink},d(o.feed.title),9,Xm)]))])):_("",!0),a(I,{class_name:"feed_texts",content:n.parseMessage(o.feed.message_rendered)},null,8,["content"]),s.hasOverflowContent&&!s.isExpanded?(i(),c("div",{key:1,onClick:t[7]||(t[7]=me=>n.showFullContent()),class:"expand-button"},[a(h,{class:"btn_expand"},{default:r(()=>[V(d(e.$t("Show More")),1)]),_:1})])):_("",!0)],2),o.feed.content_type=="survey"&&((J=(ce=(K=(te=o.feed)==null?void 0:te.meta)==null?void 0:K.survey_config)==null?void 0:ce.options)!=null&&J.length)?(i(),c(L,{key:3},[a(F,{feed:o.feed,is_preview:o.is_preview,hasTopMedia:n.hasTopMedia},null,8,["feed","is_preview","hasTopMedia"]),o.feed.meta.media_items?(i(),v(B,{key:0,is_single:o.is_single,feed:o.feed},null,8,["is_single","feed"])):!n.hasTopMedia&&o.feed.meta.media_preview?(i(),v(f,{key:1,feed:o.feed},null,8,["feed"])):_("",!0)],64)):o.feed.content_type=="document"?(i(),v(M,{key:4,document_lists:((ht=(se=o.feed)==null?void 0:se.meta)==null?void 0:ht.document_lists)||[]},null,8,["document_lists"])):o.feed.meta?(i(),c(L,{key:5},[o.feed.meta.media_items?(i(),v(B,{key:0,is_single:o.is_single,feed:o.feed},null,8,["is_single","feed"])):!n.hasTopMedia&&o.feed.meta.media_preview?(i(),v(f,{key:1,feed:o.feed},null,8,["feed"])):_("",!0),o.feed.meta.custom_app_preview?(i(),v(E,{key:2,feed:o.feed},null,8,["feed"])):_("",!0)],64)):_("",!0),o.show_footer?(i(),v(A,{key:6,feed:o.feed,is_modal:o.is_modal,is_single:o.is_single,space_slug:n.space_slug,onJoinSpace:t[8]||(t[8]=()=>{n.joinSpace()}),onCommented:t[9]||(t[9]=me=>{e.$emit("commented",me)})},null,8,["feed","is_modal","is_single","space_slug"])):_("",!0),q(e.$slots,"after_feed_footer")],10,Em)),[[U,s.working]])}const Xe=P(Bm,[["render",th]]),sh={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()}},oh={name:"FeedCard",mixins:[sh],components:{UserRouteLink:Me,ChatIcon:Ze,HeartIcon:Ke,StickyIcon:Vt,MediaPreview:Ae,ImageCarousel:St,UserAvatar:is,FeedAction:Ks},props:{feed:{type:Object,required:!0},hide_create_form:{type:Boolean,default:!1}},emits:["updated","deleted"],computed:{feedRoute(){let e={name:"single_feed",params:{feed_slug:this.feed.slug}};return this.feed.space&&(e={name:"space_feed",params:{feed_slug:this.feed.slug,space:this.feed.space.slug}}),e},placeholderImageSrc(){const e=this.isDarkMode?"feed-placeholder-dark.png":"feed-placeholder.png";return this.appVars.assets_url+"images/"+e},cardImage(){var t,o,u,s,n;const e=this.feed.meta;return e?(t=e.media_preview)!=null&&t.image?e.media_preview.image:(u=(o=e.media_items)==null?void 0:o[0])!=null&&u.url?e.media_items[0].url:((s=e.media_preview)==null?void 0:s.type)==="iframe_html"&&((n=e.media_preview)!=null&&n.html)?this.extractIframeThumbnail(e.media_preview.html)||this.placeholderImageSrc:this.placeholderImageSrc:this.placeholderImageSrc}},data(){return{in_space:this.$route.params.space}},methods:{extractIframeThumbnail(e){const t=e.match(/src=["']([^"']+)["']/);if(!t)return null;const o=t[1],u=[[/youtube\.com\/embed\/([^?/]+)/,s=>"https://img.youtube.com/vi/"+s+"/hqdefault.jpg"],[/iframe\.mediadelivery\.net\/embed\/\d+\/([^?/]+)/,s=>"https://vz-cdn.net/"+s+"/thumbnail.jpg"],[/player\.vimeo\.com\/video\/([^?/]+)/,s=>"https://vumbnail.com/"+s+".jpg"],[/fast\.wistia\.net\/embed\/iframe\/([^?/]+)/,s=>"https://fast.wistia.net/embed/medias/"+s+"/swatch"],[/dailymotion\.com\/(?:embed\/video|player\.html\?video=)\/?([^?/&]+)/,s=>"https://www.dailymotion.com/thumbnail/video/"+s]];for(const[s,n]of u){const m=o.match(s);if(m)return n(m[1])}return null},handleUpdate(e){this.$emit("updated",e),Object.assign(this.feed,e)},handleDelete(){this.$emit("deleted")},getFeedHref(){return this.hasFeature("show_post_modal")?null:this.$router.resolve(this.feedRoute).href},getSpaceRoute(e){return{name:"space_feeds",params:{space:e}}},goToFeedView(e,t=!1){if(this.hasFeature("show_post_modal")){this.feed.auto_focus_comment=t,this.$eventBus.emit("showFeedModal",{feed:this.feed,view:t?"comments":"",auto_focus_comment:t});return}e.ctrlKey||e.metaKey||(e.preventDefault(),window.__showing_feed=this.feed,this.$router.push(this.feedRoute))},toggleReact(){const e={react_type:"like"};this.feed.has_user_react&&(e.remove=!0),this.feed.has_user_react=!this.feed.has_user_react,this.$post("feeds/"+this.feed.id+"/react",e).then(t=>{this.feed.reactions_count=t.new_count}).catch(t=>{this.$handleError(t),this.feed.has_user_react=!this.feed.has_user_react})}}},ih=["id"],nh={class:"fcom_feed_card_header"},lh=["src","alt"],ah={class:"feed_card_user"},rh={class:"feed_card_body"},ch={class:"fcom_feed_title_row"},dh=["innerHTML"],uh={key:0,class:"feed_status"},_h={class:"card_description feed_meta_info"},mh=["title","href"],hh={key:0},fh={class:"fcom_feed_card_footer"},ph={class:"num_label"},gh={class:"num_label"},yh={class:"fcom_feed_card_action"};function vh(e,t,o,u,s,n){var S;const m=g("UserAvatar"),f=Be,h=g("UserRouteLink"),y=g("router-link"),w=g("HeartIcon"),b=N,C=O,p=g("ChatIcon"),k=g("FeedAction");return i(),c("div",{id:"feed_id_"+((S=o.feed)==null?void 0:S.id),class:"fcom_feed_card"},[l("div",nh,[l("div",{onClick:t[0]||(t[0]=(...$)=>n.goToFeedView&&n.goToFeedView(...$)),class:"feed_card_cover"},[l("img",{src:n.cardImage,class:"card_image",alt:o.feed.title||e.$t("Placeholder image")},null,8,lh)]),l("div",ah,[a(m,{with_level:!1,xprofile:o.feed.xprofile},null,8,["xprofile"])]),l("div",rh,[l("div",ch,[l("div",{onClick:t[1]||(t[1]=(...$)=>n.goToFeedView&&n.goToFeedView(...$)),class:"card_title feed_texts feed_md_content",innerHTML:e.getExcerpt(o.feed.title||o.feed.message_rendered,60)},null,8,dh),o.feed.status=="pending"?(i(),c("span",uh,[a(f,{type:"warning"},{default:r(()=>[V(d(e.$t("In Review")),1)]),_:1})])):_("",!0)]),l("div",_h,[a(h,{xprofile:o.feed.xprofile,show_verified:!1,show_follow:!0},null,8,["xprofile"]),l("a",{title:o.feed.created_at,onClick:t[2]||(t[2]=(...$)=>n.goToFeedView&&n.goToFeedView(...$)),href:o.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(o.feed.created_at)),9,mh),!s.in_space&&o.feed.space?(i(),c("span",hh,[a(y,{to:n.getSpaceRoute(o.feed.space.slug),class:"feed_timestamp"},{default:r(()=>[V(d(e.$t(e.getExcerpt(o.feed.space.title,30))),1)]),_:1},8,["to"])])):_("",!0)])])]),l("div",fh,[a(C,{text:""},{default:r(()=>[a(b,{class:R({user_reacted:o.feed.has_user_react}),onClick:t[3]||(t[3]=$=>n.toggleReact())},{default:r(()=>[a(w,{filled:o.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",ph,d(o.feed.reactions_count),1)]),_:1}),a(C,{onClick:t[4]||(t[4]=$=>n.goToFeedView($,!0)),text:""},{default:r(()=>[a(b,null,{default:r(()=>[a(p)]),_:1}),l("span",gh,d(o.feed.comments_count),1)]),_:1})]),l("div",yh,[a(k,{feed:o.feed,hide_create_form:o.hide_create_form,onUpdated:n.handleUpdate,onDeleted:n.handleDelete},null,8,["feed","hide_create_form","onUpdated","onDeleted"])])],8,ih)}const bh=P(oh,[["render",vh]]),kh={name:"FeedListItem",components:{UserRouteLink:Me,ChatIcon:Ze,HeartIcon:Ke,StickyIcon:Vt},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,(o,u,s,n)=>o.startsWith("#${u}`:o)},isInsideHtmlTag(e,t){let o=!1;for(let u=0;u"&&(o=!1);return o},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})}}},wh=["id"],Ch={class:"fcom_feed_data"},$h={key:0,class:"fcom_sticky"},Sh={class:"feed_user"},Vh=["href"],Lh=["href"],Mh={class:"fcom_feed_title_row"},Fh=["innerHTML"],Th={key:0,class:"feed_status"},Ph={class:"fcom_feed_meta"},Ih={key:0},Uh={class:"feed_actions"},Bh={class:"num_label"},Eh={class:"num_label"};function Ah(e,t,o,u,s,n){var p,k,S;const m=g("StickyIcon"),f=N,h=g("UserAvatar"),y=Be,w=g("HeartIcon"),b=O,C=g("ChatIcon");return i(),c("div",{id:"feed_id_"+((p=o.feed)==null?void 0:p.id),class:"fcom_feed_list"},[l("div",Ch,[o.feed.is_sticky?(i(),c("div",$h,[a(f,{class:"fcom_sticky"},{default:r(()=>[a(m)]),_:1})])):_("",!0),l("div",Sh,[l("a",{href:n.getFeedHref(),onClick:t[0]||(t[0]=(...$)=>n.goToFeedView&&n.goToFeedView(...$))},[a(h,{with_level:!1,xprofile:o.feed.xprofile},null,8,["xprofile"])],8,Vh)]),l("a",{href:n.getFeedHref(),onClick:t[1]||(t[1]=(...$)=>n.goToFeedView&&n.goToFeedView(...$)),class:"feed_body"},[l("div",Mh,[l("div",{class:"feed_texts feed_md_content",innerHTML:e.getExcerpt(o.feed.title||o.feed.message_rendered,250)},null,8,Fh),o.feed.status=="pending"?(i(),c("span",Th,[a(y,{type:"warning"},{default:r(()=>[V(d(e.$t("In Review")),1)]),_:1})])):_("",!0)]),l("div",Ph,[V(d(((S=(k=o.feed)==null?void 0:k.xprofile)==null?void 0:S.display_name)||"No Name")+" โ€ข "+d(e.humanDateDiff(o.feed.created_at))+" ",1),!s.in_space&&o.feed.space?(i(),c("span",Ih,"โ€ข #"+d(o.feed.space.slug),1)):_("",!0)])],8,Lh)]),l("div",Uh,[a(b,{text:""},{default:r(()=>[a(f,{class:R({user_reacted:o.feed.has_user_react}),onClick:t[2]||(t[2]=$=>n.toggleReact())},{default:r(()=>[a(w,{filled:o.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",Bh,d(o.feed.reactions_count),1)]),_:1}),a(b,{onClick:t[3]||(t[3]=$=>n.goToFeedView($,!0)),text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(C)]),_:1}),l("span",Eh,d(o.feed.comments_count),1)]),_:1})])],8,wh)}const Js=P(kh,[["render",Ah]]),Dh={name:"SwitchTimelineIcon"},Rh={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Hh(e,t,o,u,s,n){return i(),c("svg",Rh,[...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 xh=P(Dh,[["render",Hh]]),jh={name:"SwitchListIcon"},Oh={width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",role:"img",color:"#666666"};function Nh(e,t,o,u,s,n){return i(),c("svg",Oh,[...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 zh=P(jh,[["render",Nh]]),qh={name:"SwitchCardIcon"},Gh={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor"};function Yh(e,t,o,u,s,n){return i(),c("svg",Gh,[...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 Wh=P(qh,[["render",Yh]]),Zh={name:"AllFeeds",emits:["refetch"],inheritAttrs:!1,setup(){const e=Ve(),t=qe();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}}},components:{CreateStatusForm:Ft,Feed:Xe,FeedCard:bh,FeedListItem:Js,SwitchTimelineIcon:xh,SwitchListIcon:zh,SwitchCardIcon:Wh},watch:{space(e){this.fetchFeedsFromStore(),this.restoreLayoutPreference()},search(){this.feedStore.resetContext(this.feedContext),this.fetchFeedsFromStore()},topic_slug(){this.feedStore.resetContext(this.feedContext),this.fetchFeedsFromStore()},"$route.query.search"(e){this.search=e||""}},computed:{feedContext(){return this.space?`space-${this.space}`:this.user_id?`user-${this.user_id}`:"global"},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}},data(){return{appReady:!0,sort_by:"",search:this.$route.query.search||"",custom_layout_style:this.layout_style,disable_sticky:!1,boundHandler:null}},methods:{...vs(Ve,["fetchFeeds","createFeed","updateFeed","deleteFeed","markStickyAsViewed","resetContext"]),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,search_in:this.searchIn},e)}catch(t){this.$handleError(t)}},handleSortByChange(){this.resetFetch()},feedAdded(e){this.sticky&&this.feedStore.markStickyAsViewed(this.feedContext,this.sticky.id)},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(o){this.$handleError(o)}},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(o){this.$handleError(o)}},handleLoadMore(){var s;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(),o=(s=window.fcomLayoutRef)==null?void 0:s.wrapRef;!o||t.bottom-o.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.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.sticky&&this.feedStore.markStickyAsViewed(this.feedContext,this.sticky.id),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(){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.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}}))}),this.$nextTick(()=>{var t;const e=this.uiStore.restoreScrollPosition(this.$route.path);e>0&&((t=window.fcomLayoutRef)!=null&&t.wrapRef)&&setTimeout(()=>{window.fcomLayoutRef.setScrollTop(e)},100)})},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(),this.sticky&&this.feedStore.markStickyAsViewed(this.feedContext,this.sticky.id)}},Kh={key:1,class:"feed_filters"},Jh={id:"feed_short_by",class:"fcom_feed_filter_label"},Qh={key:1,class:"fcom_layout_switch"},Xh={key:2,style:{margin:"0 0 10px"},class:"fcom_search_result_num"},ef={key:0},tf={key:3,class:"fcom_sticky_feed"},sf={class:"all_feeds_holder"},of={key:0,style:{"margin-top":"20px","text-align":"center"}},nf={key:5},lf={class:"feed_outer"},af={class:"feed"},rf={style:{"text-align":"center"},class:"feed_body not_found"},cf={key:0},df={key:1},uf={key:2};function _f(e,t,o,u,s,n){const m=g("create-status-form"),f=oe,h=ie,y=g("SwitchCardIcon"),w=g("SwitchListIcon"),b=g("SwitchTimelineIcon"),C=N,p=O,k=ct,S=dt,$=ut,I=g("feed"),F=g("FeedListItem"),B=g("FeedCard"),M=W;return i(),c(L,null,[q(e.$slots,"before_create_form"),!o.hide_create_form&&e.auth.user_id?(i(),v(m,{key:0,space:o.space,btn_text:e.$t("Post"),onAdded:n.feedAdded},null,8,["space","btn_text","onAdded"])):_("",!0),q(e.$slots,"before_feeds"),o.hide_filters?_("",!0):(i(),c("div",Kh,[t[9]||(t[9]=l("div",{class:"fcom_feed_divider"},null,-1)),o.can_change_order?(i(),c(L,{key:0},[l("span",Jh,d(e.$t("Sort by:")),1),a(h,{modelValue:s.sort_by,"onUpdate:modelValue":t[0]||(t[0]=E=>s.sort_by=E),"aria-label":e.$t("Posts Order by"),class:"fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Latest Posts"),onChange:t[1]||(t[1]=E=>n.handleSortByChange())},{default:r(()=>[(i(!0),c(L,null,D(n.computedPostOrderOptions,(E,A)=>(i(),v(f,{key:A,value:A,label:E},null,8,["value","label"]))),128))]),_:1},8,["modelValue","aria-label","placeholder"])],64)):_("",!0),o.can_change_layout&&o.feed_name&&e.hasFeature("can_switch_layout")?(i(),c("div",Qh,[a($,{"popper-class":"fcom_pop_buttons",trigger:"click"},{dropdown:r(()=>[a(S,{class:"fcom_layout_dropdown_menu"},{default:r(()=>[a(k,{class:R({selected_layout:s.custom_layout_style==="card"})},{default:r(()=>[l("div",{onClick:t[2]||(t[2]=E=>n.switchView("card")),class:"fcom_icon_menu"},[a(y),l("span",null,d(e.$t("Card")),1)])]),_:1},8,["class"]),a(k,{class:R({selected_layout:s.custom_layout_style==="list"})},{default:r(()=>[l("div",{onClick:t[3]||(t[3]=E=>n.switchView("list")),class:"fcom_icon_menu"},[a(w),l("span",null,d(e.$t("List")),1)])]),_:1},8,["class"]),a(k,{class:R({selected_layout:s.custom_layout_style==="timeline"})},{default:r(()=>[l("div",{onClick:t[4]||(t[4]=E=>n.switchView("timeline")),class:"fcom_icon_menu"},[a(b),l("span",null,d(e.$t("Timeline")),1)])]),_:1},8,["class"])]),_:1})]),default:r(()=>[a(p,{type:"info",text:"",title:e.$t("Switch Layout View")},{default:r(()=>[a(C,{class:R(["fcom_layout_icon",s.custom_layout_style])},{default:r(()=>[s.custom_layout_style=="card"?(i(),v(y,{key:0})):s.custom_layout_style=="list"?(i(),v(w,{key:1})):(i(),v(b,{key:2}))]),_:1},8,["class"])]),_:1},8,["title"])]),_:1})])):_("",!0)])),n.pagination.total&&s.search?(i(),c("div",Xh,[V(d(e.$_n("%s result found","%s results found",n.pagination.total))+" ",1),n.execution_time?(i(),c("span",ef,d(e.$t("in %ss",n.execution_time.toFixed(2))),1)):_("",!0)])):_("",!0),n.sticky?(i(),c("div",tf,[a(I,{onReload:t[5]||(t[5]=E=>{n.sticky=null,e.fetchFeeds()}),onFeedUpdated:t[6]||(t[6]=E=>{n.sticky=E}),onDeleted:t[7]||(t[7]=()=>{n.sticky=null}),feed:n.sticky,isSingleSpacePage:!!o.space},null,8,["feed","isSingleSpacePage"])])):_("",!0),n.feeds.length?(i(),c("div",{key:4,ref:"all_feeds_wrap",class:R(["fcom_feed_style_"+n.currentLayoutStyle,"all_feeds"])},[l("div",sf,[(i(!0),c(L,null,D(n.feeds,(E,A)=>(i(),c("div",{key:E.id,class:"feed_outer"},[n.currentLayoutStyle=="list"?(i(),v(F,{key:0,feed:E},null,8,["feed"])):n.currentLayoutStyle=="card"?(i(),v(B,{key:1,feed:E,hide_create_form:o.hide_create_form,onUpdated:U=>n.handleUpdate(U,A),onDeleted:()=>n.handleDelete(A),onRemoved:()=>n.handleRemoveFromList(A)},null,8,["feed","hide_create_form","onUpdated","onDeleted","onRemoved"])):(i(),v(I,{key:2,feed:E,isSingleSpacePage:!!o.space,show_report:!0,layout_style:n.currentLayoutStyle,hide_create_form:o.hide_create_form,onUpdated:U=>n.handleUpdate(U,A),onDeleted:()=>n.handleDelete(A),onRemoved:()=>n.handleRemoveFromList(A)},null,8,["feed","isSingleSpacePage","layout_style","hide_create_form","onUpdated","onDeleted","onRemoved"]))]))),128))]),n.disableAutoLoad?_("",!0):(i(),c("div",of,[a(p,{class:"fcom_secondary_button",disabled:n.loading,loading:n.loading,onClick:t[8]||(t[8]=E=>n.fetchFeedsFromStore(!0))},{default:r(()=>[V(d(e.$t("Load more")),1)]),_:1},8,["disabled","loading"])]))],2)):!n.loading&&!n.sticky?(i(),c("div",nf,[l("div",lf,[l("div",af,[l("div",rf,[s.search?(i(),c("p",cf,d(e.$t("No results found based on your search criteria")),1)):o.topic_slug?(i(),c("p",df,d(e.$t("No posts found for the selected topic")),1)):(i(),c("p",uf,d(e.$t("No posts found!")),1))])])])])):_("",!0),n.loading?(i(),c(L,{key:6},[a(M,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5}),n.pagination.page==1?(i(),c(L,{key:0},[a(M,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5}),a(M,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5})],64)):_("",!0)],64)):_("",!0)],64)}const mt=P(Zh,[["render",_f]]),mf={name:"SearchBar",components:{SpaceIcon:Oe,AllFeeds:mt,SearchIcon:Fe},data(){return{search:"",SearchIcon:qt(Fe),showingSearch:!1,perform_search:!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:{initSearch(){this.$route.params.space?this.search_space=this.$route.params.space:this.search_space="__all__",this.showingSearch=!0,this.handleOpen()},toSearch(){this.search&&(this.perform_search?(this.perform_search=!1,this.$nextTick(()=>{this.perform_search=!0})):this.perform_search=!0)},handleScroll(e){if(this.$refs.feedsScroller.wrapRef.scrollHeight-this.$refs.feedsScroller.wrapRef.clientHeight-e.scrollTop<100){let o=this.$refs.feedsRef;!o.loading&&o.pagination.page{this.$refs.seatch_input.focus()})},formatSearchGroups(){if(this.searchGroups.length)return;let e=this.appVars.auth.spaces;e=Object.values(e);let t=this.appVars.space_groups,o=[];this.each(t,u=>{let s=e.filter(n=>n.parent_id==u.id&&n.permissions&&n.permissions.can_view_posts);s.length&&o.push({label:u.title,spaces:s})}),this.searchGroups=o}},mounted(){document.addEventListener("keydown",this.keyBind),this.$eventBus.on("route_updated",()=>{this.showingSearch=!1})},beforeUnmount(){document.removeEventListener("keydown",this.keyBind)}},hf={class:"fcom_search_header"},ff={key:0,class:"fcom_space_title"},pf={key:1},gf={style:{display:"flex","align-items":"center","flex-wrap":"wrap",gap:"10px",margin:"10px 20px 0","justify-content":"center"}},yf={key:0,class:"fcom_search_results"},vf={key:1,class:"fcom_search_welcome"};function bf(e,t,o,u,s,n){const m=g("SearchIcon"),f=N,h=oe,y=g("SpaceIcon"),w=vt,b=ie,C=X,p=_e,k=Vs,S=g("all-feeds"),$=ge,I=Ce;return i(),c(L,null,[l("button",{class:"fcom_menu_button",onClick:t[0]||(t[0]=F=>n.initSearch())},[a(f,{id:"fcom_search_icon",class:"fcom_search_icon"},{default:r(()=>[a(m)]),_:1})]),s.showingSearch?(i(),v(I,{key:0,top:"60px",onClose:t[6]||(t[6]=F=>{s.perform_search=!1}),"append-to-body":!0,"lock-scroll":!0,"modal-class":"fcom_search_bar_visible",modelValue:s.showingSearch,"onUpdate:modelValue":t[7]||(t[7]=F=>s.showingSearch=F),"show-close":!1,style:{"max-width":"700px"},width:e.drawerWidth},{header:r(()=>[l("div",hf,[a(C,{ref:"seatch_input",size:"large",type:"search",autocomplete:"off",inputmode:"search",onClear:t[2]||(t[2]=F=>s.perform_search=!1),modelValue:s.search,"onUpdate:modelValue":t[3]||(t[3]=F=>s.search=F),placeholder:n.placeholder,onKeyup:ye(n.toSearch,["enter"]),onInput:t[4]||(t[4]=F=>s.perform_search=!1),clearable:""},{prefix:r(()=>[a(f,{onClick:n.toSearch},{default:r(()=>[a(m)]),_:1},8,["onClick"])]),append:r(()=>[a(b,{class:"fcom_minimal_select fcom_global_search_append",modelValue:s.search_space,"onUpdate:modelValue":t[1]||(t[1]=F=>s.search_space=F),placeholder:e.$t("All Posts"),style:{width:"100px"}},{default:r(()=>[a(h,{label:e.$t("All Posts"),value:"__all__"},null,8,["label"]),(i(!0),c(L,null,D(s.searchGroups,F=>(i(),v(w,{key:F.label,label:F.label},{default:r(()=>[(i(!0),c(L,null,D(F.spaces,B=>(i(),v(h,{key:B.slug,label:B.title,value:B.slug},{default:r(()=>[B.id?(i(),c("span",ff,[a(y,{space_profile:B},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(B.title,30)),1)])):(i(),c("span",pf,d(e.getExcerpt(B.title,30)),1))]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["modelValue","placeholder","onKeyup"]),l("div",gf,[l("span",null,d(e.$t("Search in:")),1),a(k,{modelValue:s.searchIn,"onUpdate:modelValue":t[5]||(t[5]=F=>s.searchIn=F),class:"fcom_search_in"},{default:r(()=>[a(p,{value:"post_content",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Post Title & Content")),1)]),_:1}),a(p,{value:"post_comments",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Comments")),1)]),_:1})]),_:1},8,["modelValue"])])])]),default:r(()=>[s.perform_search&&s.search?(i(),c("div",yf,[a($,{ref:"feedsScroller",onScroll:n.handleScroll,style:{"padding-right":"20px"},height:"70vh"},{default:r(()=>[a(S,{searchIn:s.searchIn,layout_style:"list",feed_name:"search_results",space:s.search_space!="__all__"?s.search_space:"",ref:"feedsRef",default_search:s.search,hide_filters:!1,hide_create_form:!0},null,8,["searchIn","space","default_search"])]),_:1},8,["onScroll"])])):(i(),c("div",vf,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h3",null,d(e.$t("Search for anything")),1),l("p",null,d(e.$t("Try searching for keywords in posts")),1),l("p",null,[V(d(e.$t("Tip: Quick-launch search with"))+" ",1),t[8]||(t[8]=l("b",null,"โŒ˜ + K",-1)),V(" (Mac) "+d(e.$t("or"))+" ",1),t[9]||(t[9]=l("b",null,"Ctrl + K",-1)),t[10]||(t[10]=V(" (Windows/Linux)",-1))])]))]),_:1},8,["modelValue","width"])):_("",!0)],64)}const kf=P(mf,[["render",bf]]),wf={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 o=this.closeConfirmationMessage||this.$t("Are you sure you want to close this?");this.$confirm(o,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()}}},Cf=["id"];function $f(e,t,o,u,s,n){const m=bt;return i(),v(m,vo({"model-value":o.modelValue,"onUpdate:modelValue":t[0]||(t[0]=f=>e.$emit("update:modelValue",f)),direction:n.elDirection,size:o.size,modal:o.modal,"modal-class":o.modalClass,class:o.drawerClass,"close-on-click-modal":o.closeOnClickModal,"append-to-body":o.appendToBody,"destroy-on-close":o.destroyOnClose,"show-close":o.showClose,"with-header":o.withHeader,"lock-scroll":o.lockScroll,"open-delay":o.openDelay,"close-delay":o.closeDelay},o.zIndex!==null?{"z-index":o.zIndex}:{},{id:o.id,"before-close":n.handleBeforeClose}),be({default:r(()=>[l("div",{class:R(o.bodyClass)},[q(e.$slots,"default")],2)]),_:2},[o.withHeader?{name:"header",fn:r(({close:f,titleId:h,titleClass:y})=>[q(e.$slots,"header",{close:f,titleId:h,titleClass:y},()=>[o.title?(i(),c("h4",{key:0,id:h,class:R([y,o.headerClass]),style:{margin:"0"}},d(o.title),11,Cf)):_("",!0)])]),key:"0"}:void 0,e.$slots.footer?{name:"footer",fn:r(()=>[l("div",{class:R(o.footerClass)},[q(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 Qs=P(wf,[["render",$f]]);const Sf={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])}}},Vf={class:"fcom_svg_generator"},Lf={class:"fcom_form_item"},Mf={class:"fcom_form_item"},Ff=["innerHTML"];function Tf(e,t,o,u,s,n){const m=kt,f=Ye,h=ve;return i(),c("div",Vf,[l("div",Lf,[l("label",null,d(e.$t("Select Shape Color:")),1),a(m,{predefine:e.appVars.suggestedColors,modelValue:s.currentColor,"onUpdate:modelValue":t[0]||(t[0]=y=>s.currentColor=y),onActiveChange:n.colorChanged,size:"large","show-alpha":""},null,8,["predefine","modelValue","onActiveChange"])]),l("div",Mf,[l("label",null,d(e.$t("Select Shape:")),1),a(h,{onChange:t[1]||(t[1]=y=>n.selectShape(s.selectedShape)),modelValue:s.selectedShape,"onUpdate:modelValue":t[2]||(t[2]=y=>s.selectedShape=y)},{default:r(()=>[(i(!0),c(L,null,D(n.svgShapes,(y,w)=>(i(),v(f,{key:w,value:w},{default:r(()=>[l("div",{innerHTML:y},null,8,Ff)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])])])}const Pf=P(Sf,[["render",Tf]]),If={name:"LogoEmojiSelector",components:{EmojiPicker:xs,ImageUploader:je,SvgShapeGenerator:Pf,ActionPopover:ss},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"}}},Uf=["innerHTML"];function Bf(e,t,o,u,s,n){const m=O,f=g("EmojiPicker"),h=X,y=wt,w=g("SvgShapeGenerator"),b=Pe,C=g("ImageUploader"),p=Ct,k=g("action-popover");return i(),v(k,{ref:"iconPicker","close-on-click-outside":!0,"trigger-interactive":!0,width:e.modalWidth},{trigger:r(()=>[a(m,{"aria-label":"Pick Emoji",style:{padding:"4px 16px",display:"flex","justify-content":"center","align-items":"center"}},{default:r(()=>[l("span",{class:"logo_emoji_holder",style:{cursor:"pointer"},innerHTML:n.currentMark||""},null,8,Uf)]),_:1})]),default:r(({hide:S})=>[l("div",null,[a(p,{modelValue:s.selectedTab,"onUpdate:modelValue":t[5]||(t[5]=$=>s.selectedTab=$),type:"border-card"},{default:r(()=>[a(y,{name:"emoji",label:e.$t("Emoji")},{default:r(()=>[a(h,{onChange:t[1]||(t[1]=$=>n.setData("emoji")),modelValue:s.emoji,"onUpdate:modelValue":t[2]||(t[2]=$=>s.emoji=$),placeholder:e.$t("Select or paste your emoji here"),style:{width:"100%"}},be({_:2},[e.has_pro?{name:"append",fn:r(()=>[a(f,{close_on_select:!0,onEmojiSelected:t[0]||(t[0]=$=>{s.emoji=$,n.setData("emoji")})})]),key:"0"}:void 0]),1032,["modelValue","placeholder"])]),_:1},8,["label"]),a(y,{name:"shape",label:e.$t("Shape")},{default:r(()=>[a(w,{onUpdate:n.handleShapeChanged},null,8,["onUpdate"])]),_:1},8,["label"]),o.custom_svg?(i(),v(y,{key:0,name:"shape_svg",label:e.$t("Custom SVG")},{default:r(()=>[a(h,{rows:4,type:"textarea",onChange:t[3]||(t[3]=$=>n.setData("shape_svg")),modelValue:s.shape_svg,"onUpdate:modelValue":t[4]||(t[4]=$=>s.shape_svg=$),placeholder:e.$t("Paste your SVG here"),style:{width:"100%"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(y,{name:"logo",label:e.$t("Custom Image")},{default:r(()=>[s.logo?(i(),v(b,{key:0,alt:e.$t("Logo"),src:s.logo,style:{"max-width":"100px"}},null,8,["alt","src"])):_("",!0),a(C,{can_remove:!!s.logo,additionalData:{resize:!0,max_width:400},onUploaded:n.handleLogoPhotoUpload},null,8,["can_remove","onUploaded"])]),_:1},8,["label"])]),_:1},8,["modelValue"]),a(m,{onClick:$=>S(),type:"success",plain:"",class:"fcom_mt_20"},{default:r(()=>[V(d(e.$t("Close")),1)]),_:1},8,["onClick"])])]),_:1},8,["width"])}const Tt=P(If,[["render",Bf]]),Ef={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})}}},Af={key:0,class:"fcom_slug_input_info"},Df=["innerHTML"],Rf={key:1,class:"fcom_help_text"};function Hf(e,t,o,u,s,n){const m=O,f=X;return i(),c(L,null,[a(f,{class:"fcom_slug_input",disabled:o.disabled,readonly:s.showEdit,modelValue:s.model,"onUpdate:modelValue":t[1]||(t[1]=h=>s.model=h),ref:"input",placeholder:o.placeholder,onInput:n.updateSlug},be({_:2},[o.prefix?{name:"prepend",fn:r(()=>[l("span",null,d(o.prefix),1)]),key:"0"}:void 0,s.showEdit?{name:"append",fn:r(()=>[a(m,{onClick:t[0]||(t[0]=h=>n.confirmEditInit()),text:"",type:"info"},{default:r(()=>[V(d(e.$t("change")),1)]),_:1})]),key:"1"}:void 0]),1032,["disabled","readonly","modelValue","placeholder","onInput"]),!s.showEdit&&o.edit_notice?(i(),c("div",Af,[l("p",{innerHTML:o.edit_notice},null,8,Df)])):_("",!0),o.description?(i(),c("div",Rf,[l("p",null,d(o.description),1)])):_("",!0)],64)}const Pt=P(Ef,[["render",Hf]]),xf={name:"ErrorAlerts",props:{errors:{type:Array,default:()=>[]},dismissable:{type:Boolean,default:!1}},data(){return{dismissed:!1}},watch:{errors(){this.dismissed=!1}}},jf={class:"fcom_errors_alert_list"};function Of(e,t,o,u,s,n){const m=Ls;return o.errors.length&&!s.dismissed?(i(),v(m,{key:0,type:"warning",closable:o.dismissable,"show-icon":"",onClose:t[0]||(t[0]=f=>s.dismissed=!0)},{title:r(()=>[l("ul",jf,[(i(!0),c(L,null,D(o.errors,(f,h)=>(i(),c("li",{key:h},[l("strong",null,d(f.title)+":",1),V(" "+d(f.description),1)]))),128))])]),_:1},8,["closable"])):_("",!0)}const It=P(xf,[["render",Of]]),pe=e=>{var t,o;return((o=(t=window.fluentComAdmin)==null?void 0:t.i18n)==null?void 0:o[e])||e},Nf=e=>{const t=[];return!e||!e.trim()?(t.push(pe("Path cannot be empty.")),{valid:!1,type:"path",errors:t}):(e=e.trim(),e.startsWith("/")||t.push(pe("Path must start with /")),/\s/.test(e)&&t.push(pe("Path cannot contain spaces.")),/[<>{}|\\^`"']/.test(e)&&t.push(pe("Path contains invalid characters: < > { } | \\ ^ ` \" '")),e.includes("..")&&t.push(pe('Path cannot contain ".." (directory traversal).')),/#.*#/.test(e)&&t.push(pe("Path cannot contain multiple hash fragments.")),{valid:t.length===0,type:"path",errors:t})},Xs=e=>{const t=[];if(!e||!e.trim())return t.push(pe("URL cannot be empty.")),{valid:!1,type:"url",errors:t};if(e=e.trim(),!/^https?:\/\//i.test(e))return t.push(pe("URL must start with http:// or https://")),{valid:!1,type:"url",errors:t};/\s/.test(e)&&t.push(pe("URL cannot contain spaces."));const o=e.replace(/^https?:\/\//i,"");(!o||o==="/")&&t.push(pe("URL must have a domain name (e.g. example.com)."));const u=o.split("/")[0].split("?")[0].split("#")[0],s=u.split(":")[0];if(!(s==="localhost"||s.startsWith("localhost."))&&!/^[a-zA-Z0-9][a-zA-Z0-9\-]*(\.[a-zA-Z0-9\-]+)*\.[a-zA-Z]{2,}$/.test(s)&&t.push(pe("Domain must include a valid TLD (e.g. .com, .org).")),/[^a-zA-Z0-9.\-:]/.test(u)&&t.push(pe("Domain contains invalid characters. Only letters, numbers, dots, hyphens, and port are allowed.")),u.includes(":")){const m=u.split(":")[1];m&&!/^\d+$/.test(m)&&t.push(pe("Port must be a number (e.g. :8080)."))}return(/javascript:/i.test(e)||/data:/i.test(e)||/vbscript:/i.test(e))&&t.push(pe("URL contains a blocked protocol (javascript:, data:, vbscript:).")),{valid:t.length===0,type:"url",errors:t}},Ut=e=>!e||!e.trim()?{valid:!1,type:null,errors:[pe("URL or path cannot be empty.")]}:(e=e.trim(),e.startsWith("/")?Nf(e):Xs(e)),zf={name:"TopicSelector",props:["modelValue","creatable","space_id"],emits:["update:modelValue"],components:{SlugInput:Pt,ActionPopover:ss,ErrorAlerts:It},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(){if(this.newTopicErrors=[],(!this.newTopic.title||!this.newTopic.title.trim())&&this.newTopicErrors.push({title:this.$t("Title"),description:this.$t("Topic title is required.")}),this.newTopic.slug&&this.newTopic.slug.trim()){const e=Ut("/"+this.newTopic.slug);e.valid||e.errors.forEach(t=>{this.newTopicErrors.push({title:this.$t("Slug"),description:this.$t(t)})})}return 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(o=>{this.$notify.success(o.message),this.fetchTopics(),this.selected.push(o.topic.id),e()}).catch(o=>{this.$handleError(o)}).finally(()=>{this.creatingTopic=!1})}},watch:{selected(){this.$emit("update:modelValue",this.selected)}},mounted(){this.fetchTopics()}},qf={class:"fcom_topic_selector"},Gf={key:0,class:"fcom_meta_text"};function Yf(e,t,o,u,s,n){const m=oe,f=ie,h=g("Plus"),y=N,w=O,b=X,C=de,p=g("slug-input"),k=g("error-alerts"),S=ue,$=g("action-popover"),I=Q("loading");return i(),c("div",qf,[G((i(),v(f,{modelValue:s.selected,"onUpdate:modelValue":t[0]||(t[0]=F=>s.selected=F),"popper-class":"fcom_topics_from_settings",style:{width:"100%"},filterable:!0,multiple:!0,clearable:"","multiple-limit":n.maxTopicsPerSpace,placeholder:n.getTopicsPlaceholder()},{default:r(()=>[(i(!0),c(L,null,D(s.topics,F=>(i(),v(m,{key:F.slug,label:F.title,value:F.id},{default:r(()=>[l("span",null,d(F.title),1),F.description?(i(),c("span",Gf,d(F.description),1)):_("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","multiple-limit","placeholder"])),[[I,s.loading]]),e.isAdmin()&&o.creatable?(i(),v($,{key:0,placement:"left",width:400,onShow:n.initCreatetopic},{trigger:r(()=>[a(w,{disabled:n.isTopicLimitReached,class:"fcom_secondary_button"},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1}),l("span",null,d(e.$t("New")),1)]),_:1},8,["disabled"])]),default:r(({hide:F})=>[a(S,{modelValue:s.newTopic,"onUpdate:modelValue":t[4]||(t[4]=B=>s.newTopic=B),"label-position":"top","require-asterisk-position":"right"},{default:r(()=>[a(C,{label:e.$t("Title"),required:""},{default:r(()=>[a(b,{modelValue:s.newTopic.title,"onUpdate:modelValue":t[1]||(t[1]=B=>s.newTopic.title=B),placeholder:e.$t("Title of the topic")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(C,{label:e.$t("Slug (optional)")},{default:r(()=>[a(p,{modelValue:s.newTopic.slug,"onUpdate:modelValue":t[2]||(t[2]=B=>s.newTopic.slug=B),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(C,{label:e.$t("Description (optional)")},{default:r(()=>[a(b,{modelValue:s.newTopic.description,"onUpdate:modelValue":t[3]||(t[3]=B=>s.newTopic.description=B),type:"textarea",rows:3,placeholder:e.$t("Description of the topic")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(k,{errors:s.newTopicErrors,style:{"margin-bottom":"16px"}},null,8,["errors"]),a(C,null,{default:r(()=>[a(w,{class:"fcom_primary_button",onClick:B=>n.createTopic(F),loading:s.creatingTopic},{default:r(()=>[V(d(e.$t("Create")),1)]),_:1},8,["onClick","loading"])]),_:2},1024)]),_:2},1032,["modelValue"])]),_:1},8,["onShow"])):_("",!0)])}const eo=P(zf,[["render",Yf]]),Wf={name:"ListViewIcon"},Zf={width:"160",height:"158",viewBox:"0 0 160 158",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Kf(e,t,o,u,s,n){return i(),c("svg",Zf,[...t[0]||(t[0]=[Te('',23)])])}const Jf=P(Wf,[["render",Kf]]),Qf={name:"TimelineViewIcon"},Xf={width:"160",height:"158",viewBox:"0 0 160 158",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ep(e,t,o,u,s,n){return i(),c("svg",Xf,[...t[0]||(t[0]=[Te('',19)])])}const tp=P(Qf,[["render",ep]]),sp={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 op(e,t,o,u,s,n){const m=oe,f=ie,h=Q("loading");return G((i(),v(f,{placeholder:e.$t("Select Menu Group"),clearable:"",modelValue:s.selected,"onUpdate:modelValue":t[0]||(t[0]=y=>s.selected=y)},{default:r(()=>[(i(!0),c(L,null,D(s.groups,y=>(i(),v(m,{key:y.id,value:y.id.toString(),label:y.title},null,8,["value","label"]))),128))]),_:1},8,["placeholder","modelValue"])),[[h,s.loading]])}const ns=P(sp,[["render",op]]),ip={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)}}},np={class:"fcom_form_builder"},lp=["innerHTML"],ap={key:8},rp={key:9,class:"fcom_help_text"},cp=["innerHTML"];function dp(e,t,o,u,s,n){const m=X,f=Ee,h=ve,y=oe,w=ie,b=_e,C=Vs,p=Ge,k=kt,S=de,$=O,I=ue;return i(),c("div",np,[a(I,{"label-position":"top",model:o.formData,onSubmit:Y(e.doNothing,["prevent"])},{default:r(()=>[(i(!0),c(L,null,D(o.formFields,(F,B)=>(i(),v(S,{key:e.index,label:F.label},be({default:r(()=>[F.type=="text"?(i(),v(m,{key:0,modelValue:o.formData[B],"onUpdate:modelValue":M=>o.formData[B]=M,placeholder:F.placeholder,type:F.data_type||"text"},null,8,["modelValue","onUpdate:modelValue","placeholder","type"])):F.type=="radio"?(i(),v(h,{key:1,modelValue:o.formData[B],"onUpdate:modelValue":M=>o.formData[B]=M},{default:r(()=>[(i(!0),c(L,null,D(F.options,(M,E)=>(i(),v(f,{key:E,value:M.value,label:M.label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):F.type=="select"?(i(),v(w,{key:2,class:"fcom_select",multiple:F.is_multiple,clearable:"",filterable:"",modelValue:o.formData[B],"onUpdate:modelValue":M=>o.formData[B]=M,placeholder:F.placeholder},{default:r(()=>[(i(!0),c(L,null,D(F.options,(M,E)=>(i(),v(y,{key:E,label:M.label,value:M.value},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"])):F.type=="checkbox"?(i(),v(C,{key:3,modelValue:o.formData[B],"onUpdate:modelValue":M=>o.formData[B]=M},{default:r(()=>[(i(!0),c(L,null,D(F.options,(M,E)=>(i(),v(b,{key:E,value:M.value,label:M.label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):F.type=="inline_checkbox"?(i(),v(b,{key:4,modelValue:o.formData[B],"onUpdate:modelValue":M=>o.formData[B]=M,"true-value":F.true_value||"yes","false-value":F.false_value||"no"},{default:r(()=>[V(d(F.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","true-value","false-value"])):F.type=="date"?(i(),v(p,{key:5,modelValue:o.formData[B],"onUpdate:modelValue":M=>o.formData[B]=M,type:F.data_type||"date","value-format":F.value_format||"YYYY-MM-DD",format:F.value_format||"YYYY-MM-DD",placeholder:F.placeholder},null,8,["modelValue","onUpdate:modelValue","type","value-format","format","placeholder"])):F.type=="color_picker"?(i(),v(k,{key:6,modelValue:o.formData[B],"onUpdate:modelValue":M=>o.formData[B]=M},null,8,["modelValue","onUpdate:modelValue"])):F.type=="raw_html"?(i(),c("div",{key:7,innerHTML:F.content},null,8,lp)):(i(),c("div",ap,[l("pre",null,d(F),1)])),F.help_text?(i(),c("div",rp,[l("p",{innerHTML:F.help_text},null,8,cp)])):_("",!0)]),_:2},[F.label?{name:"label",fn:r(()=>[V(d(F.label),1)]),key:"0"}:void 0]),1032,["label"]))),128)),o.disableSubmit?_("",!0):(i(),v(S,{key:0},{default:r(()=>[a($,{class:"fcom_primary_button",onClick:Y(n.handleSubmit,["prevent"])},{default:r(()=>[V(d(o.submitButtonText),1)]),_:1},8,["onClick"])]),_:1}))]),_:1},8,["model","onSubmit"])])}const to=P(ip,[["render",dp]]),up={name:"CardViewIcon"},_p={xmlns:"http://www.w3.org/2000/svg",width:"160",height:"158",viewBox:"0 0 160 158",fill:"none"};function mp(e,t,o,u,s,n){return i(),c("svg",_p,[...t[0]||(t[0]=[Te('',22)])])}const hp=P(up,[["render",mp]]),fp={name:"CreateSpaceForm",emits:["completed"],components:{SpaceGroupSelector:ns,SlugInput:Pt,ImageUploader:je,LogoEmojiSelector:Tt,TopicSelector:eo,ListViewIcon:Jf,TimelineViewIcon:tp,FormBuilder:to,ErrorAlerts:It,CardViewIcon:hp},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:qs,formErrors:[],form:{title:"",slug:"",privacy:"private",parent_id:"",description:"",settings:{custom_lock_screen:"no",restricted_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",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"])},validateForm(){if(this.formErrors=[],(!this.form.title||!this.form.title.trim())&&this.formErrors.push({title:this.$t("Space Title"),description:this.$t("Space title is required.")}),this.form.slug&&this.form.slug.trim()){const e=Ut("/"+this.form.slug);e.valid||e.errors.forEach(t=>{this.formErrors.push({title:this.$t("Slug"),description:this.$t(t)})})}return this.formErrors.length===0},submit(){if(!this.validateForm())return;this.saving=!0;let e="spaces",t={space:this.form},o=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}},o=this.$put,this.metaSettings)){let u={};this.each(this.metaSettings,(s,n)=>{u[n]=s.settings}),t.meta_settings=u}o(e,t).then(u=>{if(this.$eventBus.emit("reloadMenu"),!this.form.id&&!this.disable_redirect){let s=this.$router.resolve({name:"space_feeds",params:{space:u.space.slug}}).href;window.location.href=s;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}},pp={key:0},gp={class:"fcom_form_section"},yp={class:"fcom_help_text"},vp={class:"fcom_form_section"},bp={style:{"font-weight":"bold"}},kp=["innerHTML"],wp={key:0},Cp={class:"fcom_help_text"},$p={key:0},Sp={key:1,class:"fcom_form_section"},Vp={class:"fcom_lined_checkboxes"},Lp={key:0,class:"fcom_pro_feature"},Mp={key:0,style:{background:"var(--fcom-active-bg, #f0f3f5)",padding:"10px 15px","margin-bottom":"10px","border-radius":"8px"}},Fp={class:"fcom_form_section"},Tp={class:"fcom_svg_radio_item"},Pp={class:"svg_radio_label"},Ip={class:"fcom_svg_radio_item"},Up={class:"svg_radio_label"},Bp={class:"fcom_svg_radio_item"},Ep={class:"svg_radio_label"},Ap={class:"fcom_help_text"},Dp={key:0},Rp={key:1},Hp={class:"fcom_form_section"},xp={class:"fcom_help_text"},jp=["href"],Op={class:"fcom_image_uploader_wrapper"},Np={class:"fcom_help_text"},zp={class:"fcom_image_uploader_wrapper"},qp={class:"fcom_help_text"},Gp={class:"fcom_space_form_bottom"},Yp={class:"fcom_space_form_bottom"},Wp={key:0},Zp={class:"fcom_form_section fcom_mt_20"};function Kp(e,t,o,u,s,n){const m=g("logo-emoji-selector"),f=X,h=de,y=g("SlugInput"),w=g("space-group-selector"),b=oe,C=ie,p=Ee,k=ve,S=_e,$=g("TimelineViewIcon"),I=g("ListViewIcon"),F=g("CardViewIcon"),B=g("topic-selector"),M=Pe,E=g("EditPen"),A=N,U=O,T=g("Delete"),j=g("ImageUploader"),z=g("error-alerts"),ne=ue,x=g("form-builder"),ee=Q("loading");return i(),c("div",null,[a(ne,{onSubmit:t[29]||(t[29]=Y(H=>e.doNothing(),["prevent"])),modelValue:s.form,"onUpdate:modelValue":t[30]||(t[30]=H=>s.form=H),"label-position":"top","require-asterisk-position":"right",class:"fcom_space_form"},{default:r(()=>[s.showingSections.indexOf("basic")!==-1?(i(),c(L,{key:0},[s.form.id?_("",!0):(i(),c("h4",pp,d(e.$t("Basic Info")),1)),l("div",gp,[l("h4",null,d(e.$t("General")),1),a(h,{label:e.$t("Space Title"),required:""},{default:r(()=>[a(f,{type:"text",placeholder:e.$t("Your Space Title"),modelValue:s.form.title,"onUpdate:modelValue":t[1]||(t[1]=H=>s.form.title=H)},{prepend:r(()=>{var H,te;return[s.dataLoaded?(i(),v(m,{key:0,custom_svg:!0,onUpdate:t[0]||(t[0]=K=>{s.form.settings.emoji=K.emoji,s.form.logo=K.logo,s.form.settings.shape_svg=K.shape_svg}),config:{logo:s.form.logo,emoji:((H=s.form.settings)==null?void 0:H.emoji)||"",shape_svg:((te=s.form.settings)==null?void 0:te.shape_svg)||""}},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),s.dataLoaded?(i(),v(h,{key:0,label:e.$t("Slug (optional)")},{default:r(()=>[a(y,{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:!!s.form.id,modelValue:s.form.slug,"onUpdate:modelValue":t[2]||(t[2]=H=>s.form.slug=H),description:e.$t("No spaces or special characters allowed. Only letters, numbers, hyphens, and underscores."),placeholder:e.$t("Space Slug (no space or special chars)")},null,8,["popMessage","is_inital_inactive","modelValue","description","placeholder"])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Description")},{default:r(()=>[a(f,{type:"textarea",rows:3,placeholder:e.$t("Space Description"),modelValue:s.form.description,"onUpdate:modelValue":t[3]||(t[3]=H=>s.form.description=H)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:r(()=>[s.dataLoaded?(i(),v(w,{key:0,modelValue:s.form.parent_id,"onUpdate:modelValue":t[4]||(t[4]=H=>s.form.parent_id=H),space_id:s.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",yp,[l("p",null,d(e.$t("Select a menu group to where this space will be added to the sidebar. If you do not select a menu group, it will be available on the all spaces page.")),1)])]),_:1},8,["label"])]),l("div",vp,[l("h4",null,d(e.$t("Access Control")),1),a(h,{label:e.$t("Privacy")},{default:r(()=>[a(C,{"popper-class":"rich_select",modelValue:s.form.privacy,"onUpdate:modelValue":t[5]||(t[5]=H=>s.form.privacy=H),placeholder:e.$t("Select Privacy")},{default:r(()=>[(i(!0),c(L,null,D(s.privacies,(H,te)=>(i(),v(b,{key:te,label:H.label,value:te},{default:r(()=>[l("span",bp,d(e.$labelize(H.label)),1),l("p",{innerHTML:H.description},null,8,kp)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),s.form.privacy=="private"?(i(),c(L,{key:0},[a(h,{label:e.$t("Lock Screen Type")},{default:r(()=>[a(k,{modelValue:s.form.settings.custom_lock_screen,"onUpdate:modelValue":t[6]||(t[6]=H=>s.form.settings.custom_lock_screen=H),class:""},{default:r(()=>[a(p,{value:"yes"},{default:r(()=>[V(d(e.$t("Custom Lock Screen")),1)]),_:1}),a(p,{value:"no"},{default:r(()=>[V(d(e.$t("Default Lock Screen")),1)]),_:1}),a(p,{disabled:!e.has_pro,value:"redirect"},{default:r(()=>[V(d(e.$t("Redirect to an URL"))+" ",1),e.has_pro?_("",!0):(i(),c("span",wp,d(e.$t("Require Pro")),1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.form.settings.custom_lock_screen=="redirect"&&e.has_pro?(i(),v(h,{key:0,label:e.$t("Provide the Redirect URL")},{default:r(()=>[a(f,{modelValue:s.form.settings.onboard_redirect_url,"onUpdate:modelValue":t[7]||(t[7]=H=>s.form.settings.onboard_redirect_url=H),type:"text",placeholder:e.$t("Redirect URL for unenrolled users")},null,8,["modelValue","placeholder"]),l("div",Cp,[l("p",null,d(e.$t("This link will be used to redirect the non-members. This may be your sales page for this space")),1)])]),_:1},8,["label"])):_("",!0)],64)):_("",!0),n.isDefaultLockscreen?(i(),v(h,{key:1,style:{"margin-bottom":"0"}},{default:r(()=>[a(S,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.can_request_join,"onUpdate:modelValue":t[8]||(t[8]=H=>s.form.settings.can_request_join=H),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Allow users to request to join this Space")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),n.isDefaultLockscreen?(i(),v(h,{key:2},{default:r(()=>[a(S,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.show_paywalls,"onUpdate:modelValue":t[9]||(t[9]=H=>s.form.settings.show_paywalls=H),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Show Paywalls in Default Lock Screen")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),a(h,{label:e.$t("Who can view space members")},{default:r(()=>[a(C,{modelValue:s.form.settings.members_page_status,"onUpdate:modelValue":t[10]||(t[10]=H=>s.form.settings.members_page_status=H)},{default:r(()=>[a(b,{value:"members_only",label:e.$t("Members Only")},null,8,["label"]),a(b,{value:"admin_only",label:e.$t("Admin/Moderators Only")},null,8,["label"]),a(b,{value:"logged_in",label:e.$t("Any Logged in users")},null,8,["label"]),a(b,{value:"everybody",label:e.$t("Anyone")},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"])])],64)):_("",!0),s.showingSections.indexOf("customization")!==-1?(i(),c(L,{key:1},[s.form.id?_("",!0):(i(),c("h4",$p,d(e.$t("Customization")),1)),s.form.settings?(i(),c("div",Sp,[l("h4",null,d(e.$t("Features Customizations")),1),a(h,null,{default:r(()=>[l("div",Vp,[a(S,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:s.form.settings.restricted_post_only,"onUpdate:modelValue":t[11]||(t[11]=H=>s.form.settings.restricted_post_only=H)},{default:r(()=>[V(d(e.$t("Only admin or moderators can create post")),1)]),_:1},8,["modelValue"]),a(S,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:s.form.settings.show_sidebar,"onUpdate:modelValue":t[12]||(t[12]=H=>s.form.settings.show_sidebar=H)},{default:r(()=>[V(d(e.$t("Show Right Sidebar on Space")),1)]),_:1},8,["modelValue"]),a(S,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:s.form.settings.hide_members_count,"onUpdate:modelValue":t[13]||(t[13]=H=>s.form.settings.hide_members_count=H)},{default:r(()=>[V(d(e.$t("Hide Members count from spaces page (when members page access unavailable)")),1)]),_:1},8,["modelValue"]),a(S,{class:"fcom_checkbox",disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:s.form.settings.document_library,"onUpdate:modelValue":t[14]||(t[14]=H=>s.form.settings.document_library=H)},{default:r(()=>[V(d(e.$t("Enable File/Document Library for this space"))+" ",1),e.has_pro?_("",!0):(i(),c("span",Lp," ("+d(e.$t("Pro Feature"))+") ",1))]),_:1},8,["disabled","modelValue"])])]),_:1}),s.form.settings.document_library=="yes"?(i(),c("div",Mp,[a(h,{label:e.$t("Document Library Access (View & Download)")},{default:r(()=>[a(k,{modelValue:s.form.settings.document_access,"onUpdate:modelValue":t[15]||(t[15]=H=>s.form.settings.document_access=H),class:"fcom_radio_group_inline"},{default:r(()=>[a(p,{value:"members_only"},{default:r(()=>[V(d(e.$t("Members of this space")),1)]),_:1}),a(p,{value:"logged_in"},{default:r(()=>[V(d(e.$t("Any Logged in users")),1)]),_:1}),a(p,{value:"everybody"},{default:r(()=>[V(d(e.$t("Public")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Who can upload the documents?")},{default:r(()=>[a(k,{style:{"margin-bottom":"0"},modelValue:s.form.settings.document_upload,"onUpdate:modelValue":t[16]||(t[16]=H=>s.form.settings.document_upload=H),class:"fcom_radio_group_inline"},{default:r(()=>[a(p,{value:"members_only"},{default:r(()=>[V(d(e.$t("Any Members")),1)]),_:1}),a(p,{value:"admin_only"},{default:r(()=>[V(d(e.$t("Admin/Moderators Only")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])])):_("",!0),a(h,{label:e.$t("Default Post Sort By")},{default:r(()=>[a(C,{modelValue:s.form.settings.default_post_sort_by,"onUpdate:modelValue":t[17]||(t[17]=H=>s.form.settings.default_post_sort_by=H),clearable:"",class:"fcom_select",placeholder:e.$t("Latest Posts Sort")},{default:r(()=>[(i(!0),c(L,null,D(s.postOrderOptions,(H,te)=>(i(),v(b,{key:te,value:te,label:H},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(S,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:s.form.settings.disable_post_sort_by,"onUpdate:modelValue":t[18]||(t[18]=H=>s.form.settings.disable_post_sort_by=H)},{default:r(()=>[V(d(e.$t("Disable Post Sort By Options")),1)]),_:1},8,["modelValue"]),a(h,{label:e.$t("Default Comment Sort By")},{default:r(()=>[a(C,{modelValue:s.form.settings.default_comment_sort_by,"onUpdate:modelValue":t[19]||(t[19]=H=>s.form.settings.default_comment_sort_by=H),clearable:"",class:"fcom_select",placeholder:e.$t("Latest Comments Sort")},{default:r(()=>[(i(!0),c(L,null,D(s.commentOrderOptions,(H,te)=>(i(),v(b,{key:te,value:te,label:H},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])])):_("",!0),l("div",Fp,[l("h4",null,d(e.$t("Layout")),1),a(h,{label:e.$t("Default Layout Styles"),class:"fcom_mb_10"},{default:r(()=>[a(k,{modelValue:s.form.settings.layout_style,"onUpdate:modelValue":t[20]||(t[20]=H=>s.form.settings.layout_style=H),class:"fcom_svg_radio_group"},{default:r(()=>[l("div",Tp,[a(p,{value:"timeline"},{default:r(()=>[a($,{style:{width:"100px",height:"auto"}}),l("p",Pp,d(e.$t("Timeline")),1)]),_:1})]),l("div",Ip,[a(p,{value:"list"},{default:r(()=>[a(I,{style:{width:"100px",height:"auto"}}),l("p",Up,d(e.$t("List")),1)]),_:1})]),l("div",Bp,[a(p,{value:"card"},{default:r(()=>[a(F,{style:{width:"100px",height:"auto"}}),l("p",Ep,d(e.$t("Card")),1)]),_:1})])]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(h,{style:{"margin-top":"0"}},{default:r(()=>[a(S,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:s.form.settings.disable_layout_style,"onUpdate:modelValue":t[21]||(t[21]=H=>s.form.settings.disable_layout_style=H)},{default:r(()=>[V(d(e.$t("Disable Layout Style Change Option")),1)]),_:1},8,["modelValue"]),l("div",Ap,[s.form.settings.disable_layout_style==="yes"?(i(),c("p",Dp,d(e.$t("The selected layout will be applied for all members. They cannot switch to a different view.")),1)):(i(),c("p",Rp,d(e.$t("User can change the layout style to their own preference.")),1))])]),_:1})]),l("div",Hp,[l("h4",null,d(e.$t("Others")),1),e.has_pro&&s.dataLoaded?(i(),v(h,{key:0,label:e.$t("Topic navigation")},{default:r(()=>[a(B,{creatable:!0,space_id:s.form.id,modelValue:s.form.topic_ids,"onUpdate:modelValue":t[22]||(t[22]=H=>s.form.topic_ids=H)},null,8,["space_id","modelValue"]),l("div",xp,[l("p",null,[V(d(e.$t("Categorize your posts and allow members to filter spaces with the topic navigation bar. You can define up to 20 topics per space."))+" ",1),e.isAdmin()?(i(),c("a",{key:0,target:"_blank",rel:"noopener",href:e.$getRouteLink("admin/settings/topics-settings")},d(e.$t("Manage all topics.")),9,jp)):_("",!0)])]),a(S,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.topic_required,"onUpdate:modelValue":t[23]||(t[23]=H=>s.form.settings.topic_required=H)},{default:r(()=>[V(d(e.$t("Make members select a topic")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):_("",!0),e.appVars.has_chat?(i(),v(h,{key:1,label:e.$t("Group Chat?")},{default:r(()=>[a(S,{"true-value":"yes","false-value":"no",modelValue:s.form.group_chat_support,"onUpdate:modelValue":t[24]||(t[24]=H=>s.form.group_chat_support=H)},{default:r(()=>[V(d(e.$t("Enable group chat for this space members")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Thumbnail / Open Graph Image (Recommended Size: 1200 x 630)")},{default:r(()=>[s.form.settings.og_image?(i(),v(M,{key:0,alt:e.$t("Thumbnail / Open Graph Image"),src:s.form.settings.og_image,style:{"max-width":"100px",height:"auto"}},null,8,["alt","src"])):_("",!0),l("div",Op,[a(j,{isTextBtn:!1,removeIcon:!0,can_remove:!!s.form.settings.og_image,additionalData:{resize:!1,disable_convert:"yes",max_width:1200,max_height:630},onUploaded:t[25]||(t[25]=H=>{s.form.settings.og_image=H})},be({remove:r(()=>[a(A,null,{default:r(()=>[a(T)]),_:1})]),_:2},[s.form.settings.og_image?{name:"trigger",fn:r(()=>[a(U,{class:"fcom_plain_button"},{default:r(()=>[a(A,null,{default:r(()=>[a(E)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove"])]),l("div",Np,[l("p",null,d(e.$t("Will be used on card preview and social sharing preview.")),1)])]),_:1},8,["label"]),a(h,{label:e.$t("Featured Image (Recommended size: 1600x500) - Optional")},{default:r(()=>[s.form.cover_photo?(i(),v(M,{key:0,src:s.form.cover_photo,alt:e.$t("Featured Image Preview"),style:{"max-width":"100px",height:"auto"}},null,8,["src","alt"])):_("",!0),l("div",zp,[a(j,{isTextBtn:!1,removeIcon:!0,can_remove:!!s.form.cover_photo,additionalData:{resize:!0,max_width:1600},onUploaded:n.handleCoverPhotoUpload},be({remove:r(()=>[a(A,null,{default:r(()=>[a(T)]),_:1})]),_:2},[s.form.cover_photo?{name:"trigger",fn:r(()=>[a(U,{class:"fcom_plain_button"},{default:r(()=>[a(A,null,{default:r(()=>[a(E)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove","onUploaded"])]),l("div",qp,[l("p",null,d(e.$t("If you add this image, it will be shown on the space homepage")),1)])]),_:1},8,["label"]),s.form.id?_("",!0):(i(),v(h,{key:2,style:{"margin-top":"45px"}},{default:r(()=>[l("div",Gp,[s.showingSections.indexOf("basic")===-1?(i(),v(U,{key:0,class:"plain_button",text:"",onClick:t[26]||(t[26]=()=>{s.showingSections=["basic"]})},{default:r(()=>[l("span",null,d(e.$t("Go Back")),1)]),_:1})):_("",!0),G((i(),v(U,{class:"fcom_primary_button",disabled:s.saving,onClick:t[27]||(t[27]=H=>n.submit())},{default:r(()=>[l("span",null,d(e.$t("Create")),1)]),_:1},8,["disabled"])),[[ee,s.saving]])])]),_:1}))])],64)):(i(),c(L,{key:2},[a(z,{errors:s.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),a(h,null,{default:r(()=>[l("div",Yp,[t[31]||(t[31]=l("span",null,null,-1)),a(U,{onClick:t[28]||(t[28]=H=>n.goToCustomization()),class:"fcom_primary_button"},{default:r(()=>[l("span",null,d(e.$t("Next")),1)]),_:1})])]),_:1})],64))]),_:1},8,["modelValue"]),G((i(),c("div",null,[s.metaSettings&&Object.keys(s.metaSettings).length>0?(i(),c("div",Wp,[(i(!0),c(L,null,D(s.metaSettings,H=>(i(),c("div",Zp,[l("h4",null,d(H.section_title),1),a(x,{formData:H.settings,formFields:H.fields,disableSubmit:!0},null,8,["formData","formFields"])]))),256))])):_("",!0)])),[[ee,s.fetchingMetaBoxes]])])}const Bt=P(fp,[["render",Kp]]),Jp={name:"CreateCorseForm",components:{FormBuilder:to,SpaceGroupSelector:ns,TopicSelector:eo,SlugInput:Pt,ImageUploader:je,LogoEmojiSelector:Tt,ErrorAlerts:It,CrepeEditor:$t},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:Ic,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:Uc,dataLoaded:!1,metaSettings:null,fetchingMetaBoxes:!1,appReady:!1,courseInstructors:[],fetchingInstructors:!1}},watch:{savingCount(){this.submit(!0)}},methods:{validateForm(){var e;if(this.formErrors=[],(!this.form.title||!this.form.title.trim())&&this.formErrors.push({title:this.$t("Course Title"),description:this.$t("Course title is required.")}),(!this.form.description||!this.form.description.trim())&&this.formErrors.push({title:this.$t("Short Description"),description:this.$t("Short description is required.")}),(e=this.form.slug)!=null&&e.trim()){const t=Ut("/"+this.form.slug);t.valid||t.errors.forEach(o=>{this.formErrors.push({title:this.$t("Slug"),description:this.$t(o)})})}return this.formErrors.length===0},submit(e=!1){if(!this.form.id&&!this.validateForm())return;this.saving=!0;let t="admin/courses",o=this.form,u=this.$post;if(this.form.id&&(t+="/"+this.form.id,o={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()&&(o.created_by=this.form.created_by),this.metaSettings)){let s={};this.each(this.metaSettings,(n,m)=>{s[m]=n.settings}),o.meta_settings=s}u(t,o).then(s=>{if(!this.form.id&&!this.disable_redirect){let n=this.$getRouteLink("admin/manage-courses/edit/"+s.course.id+"/lessons");window.location.href=n,this.form={};return}this.$eventBus.emit("reloadMenu"),this.$notify.success(s.message||this.$t("Course has been created successfully")),this.$emit("completed",s.course),e&&this.$emit("close")}).catch(s=>{this.$handleError(s)}).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,o,u,s,n;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=(o=(t=this.course)==null?void 0:t.settings)==null?void 0:o.course_type;e&&!((u=this.form)!=null&&u.course_type)&&(this.form.course_type=e),(!((n=(s=this.form)==null?void 0:s.settings)!=null&&n.course_layout)||!this.has_pro)&&(this.form.settings.course_layout="classic"),this.dataLoaded=!0,this.$nextTick(()=>{this.appReady=!0})}},Qp={key:0},Xp={class:"fcom_form_section"},e1={class:"fcom_help_text"},t1={class:"fcom_help_text"},s1={class:"fcom_form_section"},o1={style:{"font-weight":"bold"}},i1={key:0},n1={class:"fcom_help_text"},l1={style:{"font-weight":"bold"}},a1={class:"fcom_form_section"},r1={class:"fcom_lined_checkboxes"},c1={key:0},d1={class:"fcom_help_text"},u1={key:0,class:"fcom_form_section"},_1={class:"fcom_select_photo",style:{float:"left"}},m1=["src","alt"],h1={style:{float:"right",color:"#8492a6","font-size":"13px"}},f1={class:"fcom_lined_checkboxes"},p1={class:"fcom_form_section"},g1={class:"fcom_help_text"},y1=["href"],v1={class:"fcom_image_uploader_wrapper"},b1={class:"fcom_help_text"},k1={class:"fcom_space_form_bottom"},w1={key:0},C1={class:"fcom_form_section fcom_mt_20"},$1={key:1},S1=["href"];function V1(e,t,o,u,s,n){const m=g("logo-emoji-selector"),f=X,h=de,y=g("SlugInput"),w=g("crepe-editor"),b=g("space-group-selector"),C=Ee,p=ve,k=oe,S=ie,$=_e,I=g("topic-selector"),F=Pe,B=g("EditPen"),M=N,E=O,A=g("Delete"),U=g("ImageUploader"),T=g("error-alerts"),j=ue,z=g("form-builder"),ne=Q("loading");return e.hasFeature("has_course")?(i(),c("div",Qp,[a(j,{onSubmit:t[21]||(t[21]=Y(x=>e.doNothing(),["prevent"])),modelValue:s.form,"onUpdate:modelValue":t[22]||(t[22]=x=>s.form=x),"label-position":"top","require-asterisk-position":"right"},{default:r(()=>[l("div",Xp,[l("h4",null,d(e.$t("General")),1),a(h,{label:e.$t("Course Title"),required:""},{default:r(()=>[a(f,{type:"text",ref:"titleInput",placeholder:e.$t("Your Course Title"),modelValue:s.form.title,"onUpdate:modelValue":t[1]||(t[1]=x=>s.form.title=x)},{prepend:r(()=>{var x,ee;return[s.dataLoaded?(i(),v(m,{key:0,custom_svg:!0,config:{logo:s.form.logo,emoji:(x=s.form.settings)==null?void 0:x.emoji,shape_svg:((ee=s.form.settings)==null?void 0:ee.shape_svg)||""},onUpdate:t[0]||(t[0]=H=>{s.form.settings.emoji=H.emoji,s.form.logo=H.logo,s.form.settings.shape_svg=H.shape_svg})},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),s.dataLoaded?(i(),v(h,{key:0,label:e.$t("Slug (optional)")},{default:r(()=>[a(y,{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:!!s.form.id,modelValue:s.form.slug,"onUpdate:modelValue":t[2]||(t[2]=x=>s.form.slug=x),description:e.$t("No spaces or special characters allowed. Only letters, numbers, hyphens, and underscores."),placeholder:e.$t("Course Slug (no spaces or special characters)")},null,8,["popMessage","is_inital_inactive","modelValue","description","placeholder"])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Short Description"),required:""},{default:r(()=>[a(f,{type:"textarea",placeholder:e.$t("Course Description"),modelValue:s.form.description,"onUpdate:modelValue":t[3]||(t[3]=x=>s.form.description=x)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{class:"form_label_with_tooltip",label:e.$t("Course Details")},{default:r(()=>[s.appReady?(i(),v(w,{key:0,modelValue:s.form.settings.course_details,"onUpdate:modelValue":t[4]||(t[4]=x=>s.form.settings.course_details=x),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",e1,[l("p",null,d(e.$t("This section will be displayed on the course landing page. Add extra details, notes, or instructions to help learners understand the course better.")),1)])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:r(()=>[s.dataLoaded?(i(),v(b,{key:0,modelValue:s.form.parent_id,"onUpdate:modelValue":t[5]||(t[5]=x=>s.form.parent_id=x),space_id:s.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",t1,[l("p",null,d(e.$t("Select a menu group to where this course will be added to the sidebar. If you do not select a menu group, it will be available on the all courses page.")),1)])]),_:1},8,["label"]),a(h,{label:e.$t("Status")},{default:r(()=>[a(p,{modelValue:s.form.status,"onUpdate:modelValue":t[6]||(t[6]=x=>s.form.status=x),class:"fcom_radio_group"},{default:r(()=>[a(C,{value:"published"},{default:r(()=>[V(d(e.$t("Published")),1)]),_:1}),a(C,{value:"draft"},{default:r(()=>[V(d(e.$t("Draft")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])]),l("div",s1,[l("h4",null,d(e.$t("Access Control")),1),a(h,{label:e.$t("Privacy")},{default:r(()=>[a(S,{"popper-class":"rich_select",modelValue:s.form.privacy,"onUpdate:modelValue":t[7]||(t[7]=x=>s.form.privacy=x),placeholder:e.$t("Select Privacy")},{default:r(()=>[(i(!0),c(L,null,D(s.privacies,(x,ee)=>(i(),v(k,{key:ee,label:x.label,value:ee},{default:r(()=>[l("span",o1,d(x.label),1),l("p",null,d(x.description),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),s.form.privacy=="private"?(i(),c(L,{key:0},[a(h,{label:e.$t("Lock Screen Type")},{default:r(()=>[a(p,{modelValue:s.form.settings.custom_lock_screen,"onUpdate:modelValue":t[8]||(t[8]=x=>s.form.settings.custom_lock_screen=x),class:"fcom_radio_group"},{default:r(()=>[a(C,{value:"yes"},{default:r(()=>[V(d(e.$t("Custom")),1)]),_:1}),a(C,{value:"no"},{default:r(()=>[V(d(e.$t("Default")),1)]),_:1}),a(C,{disabled:!e.has_pro,value:"redirect"},{default:r(()=>[V(d(e.$t("Redirect to an URL"))+" ",1),e.has_pro?_("",!0):(i(),c("span",i1,d(e.$t("Require Pro")),1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.form.settings.custom_lock_screen=="redirect"&&e.has_pro?(i(),v(h,{key:0,label:e.$t("Provide the Redirect URL")},{default:r(()=>[a(f,{modelValue:s.form.settings.onboard_redirect_url,"onUpdate:modelValue":t[9]||(t[9]=x=>s.form.settings.onboard_redirect_url=x),type:"text",placeholder:e.$t("Redirect URL for unenrolled users")},null,8,["modelValue","placeholder"]),l("div",n1,[l("p",null,d(e.$t("This link will be used to redirect the unenrolled or public users. This may be your sales page for this course")),1)])]),_:1},8,["label"])):_("",!0),s.form.settings.custom_lock_screen=="no"?(i(),v(h,{key:1},{default:r(()=>[a($,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.show_paywalls,"onUpdate:modelValue":t[10]||(t[10]=x=>s.form.settings.show_paywalls=x),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Show Paywalls in the default lock screen")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0)],64)):_("",!0),a(h,{label:e.$t("Enrollment Type")},{default:r(()=>[a(S,{"popper-class":"rich_select",modelValue:s.form.course_type,"onUpdate:modelValue":t[11]||(t[11]=x=>s.form.course_type=x),placeholder:e.$t("Select Type")},{default:r(()=>[(i(!0),c(L,null,D(s.courseTypes,(x,ee)=>(i(),v(k,{key:ee,label:x.label,value:ee},{default:r(()=>[l("span",l1,d(x.label),1),l("p",null,d(x.description),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),l("div",a1,[l("h4",null,d(e.$t("Features Customizations")),1),a(h,null,{default:r(()=>[l("div",r1,[s.form.privacy=="public"&&s.form.course_type=="self_paced"?(i(),v($,{key:0,"true-value":"yes","false-value":"no",modelValue:s.form.settings.public_lesson_view,"onUpdate:modelValue":t[12]||(t[12]=x=>s.form.settings.public_lesson_view=x),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Public users can view the lessons without enrolling in the course")),1)]),_:1},8,["modelValue"])):_("",!0),a($,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.disable_comments,"onUpdate:modelValue":t[13]||(t[13]=x=>s.form.settings.disable_comments=x),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Disable comments for all the lessons for this course")),1)]),_:1},8,["modelValue"]),a($,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.hide_members_count,"onUpdate:modelValue":t[14]||(t[14]=x=>s.form.settings.hide_members_count=x),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Hide students count from courses page")),1)]),_:1},8,["modelValue"])])]),_:1}),a(h,{label:e.$t("Course Layout")},{default:r(()=>[a(p,{modelValue:s.form.settings.course_layout,"onUpdate:modelValue":t[15]||(t[15]=x=>s.form.settings.course_layout=x),class:"fcom_radio_group"},{default:r(()=>[a(C,{value:"classic"},{default:r(()=>[V(d(e.$t("Classic")),1)]),_:1}),a(C,{disabled:!e.has_pro,value:"modern"},{default:r(()=>[V(d(e.$t("Modern"))+" ",1),e.has_pro?_("",!0):(i(),c("span",c1,"("+d(e.$t("Available on Pro"))+")",1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),l("div",d1,[l("p",null,d(e.$t("Classic is the default layout. For a more visual and engaging experience, the Modern layout displays the featured image or embedded video thumbnail.")),1)])]),_:1},8,["label"])]),s.form.id?(i(),c("div",u1,[l("h4",null,d(e.$t("Course Instructor")),1),a(h,{label:e.$t("Instructor")},{default:r(()=>[a(S,{disabled:!e.isAdmin(),class:"rich_select",filterable:"",remote:"",loading:s.fetchingInstructors,"remote-method":n.searchUsers,placeholder:e.$t("Select User"),modelValue:s.form.created_by,"onUpdate:modelValue":t[16]||(t[16]=x=>s.form.created_by=x)},{default:r(()=>[(i(!0),c(L,null,D(s.courseInstructors,x=>(i(),v(k,{class:"fcom_with_photo_option",key:x.ID,label:x.display_name+" ("+(x.user_email||x.ID)+")",value:x.ID},{default:r(()=>[l("span",_1,[l("img",{src:x.photo,alt:x.display_name},null,8,m1),l("span",null,d(x.display_name),1)]),l("span",h1,d(x.user_email||x.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["disabled","loading","remote-method","placeholder","modelValue"])]),_:1},8,["label"]),a(h,null,{default:r(()=>[l("div",f1,[a($,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.hide_instructor_view,"onUpdate:modelValue":t[17]||(t[17]=x=>s.form.settings.hide_instructor_view=x),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Hide course instructor view from course overview page")),1)]),_:1},8,["modelValue"]),s.form.settings.hide_instructor_view!="yes"?(i(),v($,{key:0,"true-value":"yes","false-value":"no",modelValue:s.form.settings.show_instructor_students_count,"onUpdate:modelValue":t[18]||(t[18]=x=>s.form.settings.show_instructor_students_count=x),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Show students count in course instructor view")),1)]),_:1},8,["modelValue"])):_("",!0)])]),_:1})])):_("",!0),l("div",p1,[l("h4",null,d(e.$t("Others")),1),e.has_pro&&s.dataLoaded?(i(),v(h,{key:0,label:e.$t("Topic navigation")},{default:r(()=>[a(I,{modelValue:s.form.category_ids,"onUpdate:modelValue":t[19]||(t[19]=x=>s.form.category_ids=x),creatable:!0},null,8,["modelValue"]),l("div",g1,[l("p",null,d(e.$t("Categorize your course and allow members to filter courses with the topic navigation bar in the courses directory. You can define up to 20 topics per course.")),1),l("p",null,[e.isAdmin()?(i(),c("a",{key:0,target:"_blank",rel:"noopener",href:e.$getRouteLink("admin/settings/topics-settings")},d(e.$t("Manage all topics")),9,y1)):_("",!0)])])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Thumbnail / Open Graph Image (Recommended Size: 1200 x 630)")},{default:r(()=>[s.form.cover_photo?(i(),v(F,{key:0,alt:e.$t("Cover Photo"),src:s.form.cover_photo,style:{"max-width":"100px",height:"auto"}},null,8,["alt","src"])):_("",!0),l("div",v1,[a(U,{isTextBtn:!1,can_remove:!!s.form.cover_photo,additionalData:{resize:!1,disable_convert:"yes",max_width:1200,max_height:630},onUploaded:n.handlePhotoUpload},be({remove:r(()=>[a(M,null,{default:r(()=>[a(A)]),_:1})]),_:2},[s.form.cover_photo?{name:"trigger",fn:r(()=>[a(E,{class:"fcom_plain_button"},{default:r(()=>[a(M,null,{default:r(()=>[a(B)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove","onUploaded"])]),l("div",b1,[l("p",null,d(e.$t("Will be used on course card preview and social sharing preview.")),1)])]),_:1},8,["label"]),a(T,{errors:s.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),s.form.id?_("",!0):(i(),v(h,{key:1,style:{"margin-top":"45px"}},{default:r(()=>[l("div",k1,[t[23]||(t[23]=l("span",null,null,-1)),a(E,{class:"fcom_primary_button",disabled:s.saving,onClick:t[20]||(t[20]=x=>n.submit()),loading:s.saving},{default:r(()=>[l("span",null,d(e.$t("Create")),1)]),_:1},8,["disabled","loading"])])]),_:1}))])]),_:1},8,["modelValue"]),G((i(),c("div",null,[s.metaSettings&&Object.keys(s.metaSettings).length>0?(i(),c("div",w1,[(i(!0),c(L,null,D(s.metaSettings,x=>(i(),c("div",C1,[l("h4",null,d(x.section_title),1),a(z,{formData:x.settings,formFields:x.fields,disableSubmit:!0},null,8,["formData","formFields"])]))),256))])):_("",!0)])),[[ne,s.fetchingMetaBoxes]])])):(i(),c("div",$1,[l("p",null,d(e.$t("Course Module is disabled. Please enable the course module first")),1),l("a",{class:"el-button el-button--default fcom_primary_button fcom_mt_10",href:e.$getRouteLink("admin/settings/features")},d(e.$t("Go to features settings")),9,S1)]))}const L1=P(Jp,[["render",V1]]),M1={name:"SpaceCourseSelector",components:{SpaceIcon:Oe},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(o=>o.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,o=[],u=[];this.each(t,n=>{let m=e.filter(f=>{let h=f.parent_id==n.id;return h&&u.push(f.slug),h});m.length&&o.push({label:n.title,spaces:m})});let s=e.filter(n=>n.parent_id===null);s&&s.length&&o.push({label:this.$t("Uncategorized"),spaces:s}),this.formattedSpaceGroups=o}},mounted(){this.is_multiple?this.selected_spaces=Array.isArray(this.modelValue)?this.modelValue:[]:this.selected_spaces=this.modelValue||"",this.fetch(),this.app_ready=!0}},F1={key:0,class:"fcom_space_title"},T1={key:0},P1={key:1};function I1(e,t,o,u,s,n){const m=g("SpaceIcon"),f=oe,h=vt,y=ie,w=Q("loading");return s.app_ready?(i(),v(y,{key:0,onChange:n.emitChanges,modelValue:s.selected_spaces,"onUpdate:modelValue":t[0]||(t[0]=b=>s.selected_spaces=b),filterable:"",multiple:o.is_multiple,placeholder:o.placeholder_text,style:{width:"100%"}},{default:r(()=>[(i(!0),c(L,null,D(s.formattedSpaceGroups,b=>G((i(),v(h,{key:b.label,label:b.label},{default:r(()=>[(i(!0),c(L,null,D(b.spaces,C=>(i(),v(f,{key:C.slug,label:C.title,disabled:n.isMemberOfSpace(C.id),value:C.id.toString()},{default:r(()=>[C.id?(i(),c("span",F1,[a(m,{space_profile:C},null,8,["space_profile"]),l("span",null,[V(d(e.getExcerpt(C.title,50))+" ",1),C.type=="course"?(i(),c("span",T1," ("+d(e.$t("course"))+")",1)):_("",!0)])])):(i(),c("span",P1,d(e.getExcerpt(C.title,50)),1))]),_:2},1032,["label","disabled","value"]))),128))]),_:2},1032,["label"])),[[w,s.loading]])),128))]),_:1},8,["onChange","modelValue","multiple","placeholder"])):_("",!0)}const Et=P(M1,[["render",I1]]),U1={name:"SidebarLinkForm",components:{SpaceGroupSelector:ns,LogoEmojiSelector:Tt,SpaceCourseSelector:Et,ErrorAlerts:It},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(){this.formErrors=[],(!this.form.title||!this.form.title.trim())&&this.formErrors.push({title:this.$t("Title"),description:this.$t("Link title is required.")});const e=Xs(this.form.settings.permalink);return e.valid||e.errors.forEach(t=>{this.formErrors.push({title:this.$t("Permalink"),description:this.$t(t)})}),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}},B1={class:"fcom_form_section"},E1={class:"fcom_help_text"},A1={class:"fcom_help_text"},D1={class:"fcom_help_text"},R1={key:0},H1={key:1};function x1(e,t,o,u,s,n){const m=g("logo-emoji-selector"),f=X,h=de,y=_e,w=g("space-group-selector"),b=Ee,C=ve,p=g("SpaceCourseSelector"),k=g("error-alerts"),S=O,$=ue,I=Q("loading");return i(),v($,{onSubmit:t[8]||(t[8]=Y(F=>e.doNothing(),["prevent"])),modelValue:s.form,"onUpdate:modelValue":t[9]||(t[9]=F=>s.form=F),"label-position":"top","require-asterisk-position":"right",class:"fcom_space_form"},{default:r(()=>[l("div",B1,[a(h,{label:e.$t("Link Title"),required:""},{default:r(()=>[a(f,{type:"text",placeholder:e.$t("Your Link Title"),modelValue:s.form.title,"onUpdate:modelValue":t[1]||(t[1]=F=>s.form.title=F)},{prepend:r(()=>{var F,B;return[s.dataLoaded?(i(),v(m,{key:0,custom_svg:!0,onUpdate:t[0]||(t[0]=M=>{s.form.settings.emoji=M.emoji,s.form.logo=M.logo,s.form.settings.shape_svg=M.shape_svg}),config:{logo:s.form.logo,emoji:((F=s.form.settings)==null?void 0:F.emoji)||"",shape_svg:((B=s.form.settings)==null?void 0:B.shape_svg)||""}},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Permalink"),required:""},{default:r(()=>[a(f,{placeholder:e.$t("URL of the link"),modelValue:s.form.settings.permalink,"onUpdate:modelValue":t[2]||(t[2]=F=>s.form.settings.permalink=F)},null,8,["placeholder","modelValue"]),l("div",E1,[a(y,{modelValue:s.form.settings.new_tab,"onUpdate:modelValue":t[3]||(t[3]=F=>s.form.settings.new_tab=F),"true-value":"yes","false-value":"no"},{default:r(()=>[V(d(e.$t("Open this link in new tab")),1)]),_:1},8,["modelValue"])])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:r(()=>[s.dataLoaded?(i(),v(w,{key:0,modelValue:s.form.parent_id,"onUpdate:modelValue":t[4]||(t[4]=F=>s.form.parent_id=F),space_id:s.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",A1,[l("p",null,d(e.$t("Select a menu group to where this link will be added to the sidebar.")),1)])]),_:1},8,["label"]),a(h,{label:e.$t("Visibility")},{default:r(()=>[a(C,{modelValue:s.form.privacy,"onUpdate:modelValue":t[5]||(t[5]=F=>s.form.privacy=F)},{default:r(()=>[a(b,{label:e.$t("Everyone"),value:"public"},null,8,["label"]),a(b,{label:e.$t("Logged-in users only"),value:"logged_in"},null,8,["label"]),a(b,{label:e.$t("By Space/Course Memberships"),value:"members_only"},null,8,["label"])]),_:1},8,["modelValue"]),l("div",D1,[l("p",null,d(e.$t("Select who can see this link.")),1)])]),_:1},8,["label"]),s.form.privacy=="members_only"?(i(),v(h,{key:0,label:e.$t("Select Space/Course Memberships")},{default:r(()=>[a(p,{modelValue:s.form.settings.membership_ids,"onUpdate:modelValue":t[6]||(t[6]=F=>s.form.settings.membership_ids=F),placeholder_text:e.$t("Select Memberships"),is_multiple:!0},null,8,["modelValue","placeholder_text"])]),_:1},8,["label"])):_("",!0),a(k,{errors:s.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),a(h,{style:{"margin-top":"45px"}},{default:r(()=>[G((i(),v(S,{class:"fcom_primary_button",disabled:s.saving,onClick:t[7]||(t[7]=F=>n.saveSettings())},{default:r(()=>[s.form.id?(i(),c("span",R1,d(e.$t("Update")),1)):(i(),c("span",H1,d(e.$t("Create Link")),1))]),_:1},8,["disabled"])),[[I,s.saving]])]),_:1})])]),_:1},8,["modelValue"])}const j1=P(U1,[["render",x1]]),O1={name:"SpaceIcon"},N1={version:"1.1",viewBox:"0 0 128 128","xml:space":"preserve"};function z1(e,t,o,u,s,n){return i(),c("svg",N1,[...t[0]||(t[0]=[Te('',1)])])}const q1=P(O1,[["render",z1]]),G1={name:"CourseIcon"},Y1={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function W1(e,t,o,u,s,n){return i(),c("svg",Y1,[...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 Z1=P(G1,[["render",W1]]),K1={name:"SpaceCreateModal",components:{Drawer:Qs,CreateSpaceForm:Bt,CreateCourseForm:L1,SidebarLinkForm:j1,ArrowLeftBold:Bo,SpaceIcon:q1,CourseIcon:Z1,Link:bs},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,...o}=this.$route.query;e===void 0&&t===void 0||this.$router.replace({query:o})},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})})}},J1={class:"dialog_header"},Q1={class:"dialog_left"},X1={class:"dialog_body"},eg={key:0,class:"space-type-selector"},tg={class:"space-cards"},sg={class:"space-card-label"},og={class:"space-card-label"},ig={key:0,class:"space-card-note"},ng={class:"space-card-label"},lg={key:0,class:"space-card-note"},ag={class:"dialog_footer"};function rg(e,t,o,u,s,n){const m=g("ArrowLeftBold"),f=N,h=O,y=g("SpaceIcon"),w=g("CourseIcon"),b=g("Link"),C=g("create-space-form"),p=g("create-course-form"),k=g("sidebar-link-form"),S=g("Drawer");return i(),v(S,{modelValue:s.showCreateSpaceModal,"onUpdate:modelValue":t[5]||(t[5]=$=>s.showCreateSpaceModal=$),size:e.drawerWidth,"close-on-click-modal":!0,"has-close-confirmation":s.enteredForm,"close-confirmation-message":n.leaveMessage,drawerClass:"fcom_space_create_drawer"},be({header:r(()=>[l("div",J1,[l("div",Q1,[s.step!="choose_type"?(i(),v(h,{key:0,onClick:t[0]||(t[0]=$=>s.step="choose_type"),text:"",size:"small"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})):_("",!0),l("h4",null,d(n.currentTitle),1)])])]),default:r(()=>[l("div",X1,[s.step=="choose_type"?(i(),c("div",eg,[l("div",tg,[l("div",{onClick:t[1]||(t[1]=$=>s.select_type="space_form"),class:R([{"is-active":s.select_type==="space_form"},"space-card"])},[a(f,{class:"space-card-icon"},{default:r(()=>[a(y)]),_:1}),l("span",sg,d(e.$t("Discussion Space")),1)],2),l("div",{onClick:t[2]||(t[2]=$=>!!e.hasFeature("has_course")&&(s.select_type="course_form")),class:R([{"is-active":s.select_type==="course_form","is-disabled":!e.hasFeature("has_course")},"space-card"])},[a(f,{class:"space-card-icon"},{default:r(()=>[a(w)]),_:1}),l("span",og,d(e.$t("Course")),1),e.hasFeature("has_course")?_("",!0):(i(),c("span",ig,d(e.$t("Course Module is disabled")),1))],2),l("div",{onClick:t[3]||(t[3]=$=>!!e.appVars.pro&&(s.select_type="link_form")),class:R([{"is-active":s.select_type==="link_form","is-disabled":!e.appVars.pro},"space-card"])},[a(f,{class:"space-card-icon"},{default:r(()=>[a(b)]),_:1}),l("span",ng,d(e.$t("Link")),1),e.appVars.pro?_("",!0):(i(),c("span",lg,d(e.$t("Pro Required")),1))],2)])])):s.step=="space_form"?(i(),v(C,{key:1,disable_redirect:s.disable_redirect,parent_id:s.parent_id,onCompleted:n.handleCompleted},null,8,["disable_redirect","parent_id","onCompleted"])):s.step=="course_form"?(i(),v(p,{key:2,disable_redirect:s.disable_redirect,parent_id:s.parent_id,onCompleted:n.handleCompleted},null,8,["disable_redirect","parent_id","onCompleted"])):s.step=="link_form"?(i(),v(k,{key:3,parent_id:s.parent_id,onCompleted:n.handleCompleted},null,8,["parent_id","onCompleted"])):_("",!0)])]),_:2},[s.step=="choose_type"?{name:"footer",fn:r(()=>[l("div",ag,[a(h,{disabled:!s.select_type,class:"fcom_primary_button",onClick:t[4]||(t[4]=$=>n.handleNextStep())},{default:r(()=>[V(d(e.$t("Next")),1)]),_:1},8,["disabled"])])]),key:"0"}:void 0]),1032,["modelValue","size","has-close-confirmation","close-confirmation-message"])}const cg=P(K1,[["render",rg]]),dg={name:"ExpandIcon"},ug={xmlns:"http://www.w3.org/2000/svg",id:"icon-20-expand",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function _g(e,t,o,u,s,n){return i(),c("svg",ug,[...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 mg=P(dg,[["render",_g]]),hg={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)}},fg={class:"dialog_header"},pg={class:"dialog_left"},gg={class:"dialog_body"},yg={class:"fcom_report_content_form"},vg={class:"dialog_footer"};function bg(e,t,o,u,s,n){const m=oe,f=ie,h=de,y=X,w=ue,b=O,C=Ce;return s.showModal?(i(),v(C,{key:0,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1,width:e.drawerWidth,modelValue:s.showModal,"onUpdate:modelValue":t[4]||(t[4]=p=>s.showModal=p),direction:"rtl",onClose:n.closeModal},{header:r(()=>[l("div",fg,[l("div",pg,[l("h4",null,d(n.currentTitle),1)])])]),footer:r(()=>[l("div",vg,[a(b,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=p=>n.closeModal())},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1}),a(b,{class:"fcom_primary_button",onClick:t[3]||(t[3]=p=>n.validateAndSubmit()),loading:s.saving},{default:r(()=>[V(d(e.$t("Report")),1)]),_:1},8,["loading"])])]),default:r(()=>[l("div",gg,[l("div",yg,[a(w,{ref:"reportForm","label-position":"top"},{default:r(()=>[a(h,{label:e.$t("Reason")},{default:r(()=>[a(f,{modelValue:s.reportReason,"onUpdate:modelValue":t[0]||(t[0]=p=>s.reportReason=p),placeholder:e.$t("Please select a reason for reporting this content")},{default:r(()=>[(i(!0),c(L,null,D(e.appVars.report_reasons,(p,k)=>(i(),v(m,{key:k,label:p,value:k},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(h,{label:e.$t("Explanation")},{default:r(()=>[a(y,{modelValue:s.reportExplanation,"onUpdate:modelValue":t[1]||(t[1]=p=>s.reportExplanation=p),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 kg=P(hg,[["render",bg]]),wg={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")}}},Cg={class:"fcom_pagination_wrap"};function $g(e,t,o,u,s,n){const m=Fi;return i(),c("div",Cg,[a(m,{background:!1,size:"small","pager-count":5,layout:n.pager_layout,onCurrentChange:n.changePage,onSizeChange:n.changeSize,"hide-on-single-page":o.hide_on_single,"current-page":o.pagination.page,"page-sizes":n.page_sizes,"page-size":o.pagination.per_page,total:o.pagination.total},null,8,["layout","onCurrentChange","onSizeChange","hide-on-single-page","current-page","page-sizes","page-size","total"])])}const $e=P(wg,[["render",$g]]),Sg={name:"ReportReviewModal",components:{Pagination:$e},data(){return{isOpen:!1,loading:!1,content:{},postReports:[],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.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(o=>{this.postReports=o.reports.data,this.report=o.reports.data[0],this.pagination.total=o.reports.total}).catch(o=>{this.$handleError(o)}).finally(()=>{this.loading=!1})},ignoreReport(){var e;this.ignoring=!0,this.$put("moderation/reports/"+this.report.id,{space_id:(e=this.content)==null?void 0:e.space_id,status:"ignored"}).then(t=>{this.$notify.success(t.message),this.isOpen=!1,this.$eventBus.emit("updateModerationReport",{content:t.content,action:"ignored",type:this.type}),this.closeModal()}).catch(t=>{this.$handleError(t)}).finally(()=>{this.ignoring=!1})},unpublishReport(){var e;this.unpublishing=!0,this.$put("moderation/reports/"+this.report.id,{space_id:(e=this.content)==null?void 0:e.space_id,status:"unpublished"}).then(t=>{this.$notify.success(t.message),this.isOpen=!1,this.$eventBus.emit("updateModerationReport",{content:t.content,action:"unpublished",type:this.type}),this.closeModal()}).catch(t=>{this.$handleError(t)}).finally(()=>{this.unpublishing=!1})}},created(){this.$eventBus.on("showReportReviewModal",this.showReportReviewModal)}},Vg={class:"dialog_body"},Lg={class:"report_details"},Mg={class:"report_details_header"},Fg={class:"report_details_header_left"},Tg={class:"report_details_header_right"},Pg={key:0},Ig={key:1},Ug={key:1},Bg={class:"report_reason"},Eg=["title"],Ag={key:0,class:"report_details_body"},Dg=["innerHTML"],Rg={key:2,role:"region","aria-label":"Pagination",class:"pagination_wrap"},Hg={class:"dialog_footer report_footer"};function xg(e,t,o,u,s,n){const m=g("UserAvatar"),f=g("UserRouteLink"),h=W,y=g("Pagination"),w=O,b=Ce;return i(),v(b,{modelValue:s.isOpen,"onUpdate:modelValue":t[3]||(t[3]=C=>s.isOpen=C),"modal-class":"fcom_common_dialog",id:"fluent_comminity_body",width:e.dialogWidth,"append-to-body":!0,"close-on-click-modal":!1,direction:"rtl",onClose:n.closeModal},{footer:r(()=>[l("div",Hg,[a(w,{class:"fcom_secondary_button",onClick:t[1]||(t[1]=C=>n.unpublishReport()),loading:s.unpublishing},{default:r(()=>[V(d(n.getUnpublishBtnText),1)]),_:1},8,["loading"]),a(w,{class:"fcom_primary_button",onClick:t[2]||(t[2]=C=>n.ignoreReport()),loading:s.ignoring},{default:r(()=>[V(d(n.getPublishBtnText),1)]),_:1},8,["loading"])])]),default:r(()=>{var C,p;return[l("div",Vg,[l("h4",null,d(e.$t("Reports")+" ("+((p=(C=s.content)==null?void 0:C.meta)==null?void 0:p.reports_count)+")"),1),l("div",Lg,[s.loading?(i(),v(h,{key:1,rows:5,animated:!0})):(i(!0),c(L,{key:0},D(s.postReports,k=>(i(),c("div",{key:k.id,class:"report_details_item"},[l("div",Mg,[l("div",Fg,[k.reporter?(i(),v(m,{key:0,with_level:!1,xprofile:k.reporter},null,8,["xprofile"])):_("",!0)]),l("div",Tg,[!k.reporter&&!n.getReason(k.reason)?(i(),c("div",Pg,d(e.$t("Flagged automatically by the site rule")),1)):(i(),c("div",Ig,[k.reporter?(i(),v(f,{key:0,show_verified:!1,xprofile:k.reporter},null,8,["xprofile"])):(i(),c("span",Ug,d(e.$t("By System ")),1)),n.getReason(k.reason)?(i(),c(L,{key:2},[l("span",null,d(e.$t("reported for ")),1),l("span",Bg,d(n.getReason(k.reason)),1)],64)):_("",!0)])),l("div",{title:k.created_at,class:"meta_line"},d(e.humanDateDiff(k.created_at)),9,Eg)])]),k.explanation?(i(),c("div",Ag,[l("div",{innerHTML:k.explanation},null,8,Dg)])):_("",!0)]))),128)),s.pagination.total?(i(),c("div",Rg,[a(y,{hide_on_single:!0,onFetch:t[0]||(t[0]=k=>n.getPostReports()),pagination:s.pagination},null,8,["pagination"])])):_("",!0)])])]}),_:1},8,["modelValue","width","onClose"])}const jg=P(Sg,[["render",xg]]),Og={name:"PreviewPostModal",components:{Feed:Xe},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(o=>this.currentTopics(e==null?void 0:e.space).find(u=>u.id==o))):[]},currentTopics(e){var o;if(!e)return[];let t=((o=this.allSpaces[e])==null?void 0:o.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)}};function Ng(e,t,o,u,s,n){const m=W,f=O,h=g("Feed"),y=ge,w=Ce;return s.previewData?(i(),v(w,{key:0,modelValue:s.isOpen,"onUpdate:modelValue":t[0]||(t[0]=b=>s.isOpen=b),class:"fcom_feed_modal",width:e.dialogWidth,"align-center":!0,"append-to-body":!0,"close-on-click-modal":!1,onClose:n.closeModal},{default:r(()=>[a(y,{ref:"feed_dialog_scroller","max-height":"calc(100dvh - 40px)"},{default:r(()=>[s.loading?(i(),v(m,{key:0,rows:4,animated:!0})):(i(),v(h,{key:1,feed:s.previewData,is_single:!0,is_preview:!0,show_actions:!1,show_footer:!1},{after_feed_actions:r(()=>[a(f,{style:{padding:"0 5px"},class:"no_pad_bt fcom_close_pop",onClick:n.closeModal,text:""},null,8,["onClick"])]),_:1},8,["feed"]))]),_:1},512)]),_:1},8,["modelValue","width","onClose"])):_("",!0)}const zg=P(Og,[["render",Ng]]),qg={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)}},Gg={class:"dialog_header"},Yg={class:"dialog_left"},Wg={class:"dialog_body"},Zg={class:"dialog_footer"};function Kg(e,t,o,u,s,n){const m=O,f=Ce;return i(),v(f,{"modal-class":"fcom_common_dialog fcom_editor_unfinished_dialog",modelValue:s.isVisible,"onUpdate:modelValue":t[0]||(t[0]=h=>s.isVisible=h),width:e.modalWidth,"close-on-click-modal":!1,"close-on-press-escape":!1,"append-to-body":!0,"show-close":!1},{header:r(()=>[l("div",Gg,[l("div",Yg,[l("h4",null,d(e.$t("Leave Page?")),1)])])]),footer:r(()=>[l("div",Zg,[a(m,{class:"fcom_secondary_button",onClick:n.handleCancel},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1},8,["onClick"]),a(m,{class:"fcom_primary_button",onClick:n.handleProceed},{default:r(()=>[V(d(e.$t("Leave")),1)]),_:1},8,["onClick"])])]),default:r(()=>[l("div",Wg,[l("span",null,d(s.message),1)])]),_:1},8,["modelValue","width"])}const Jg=P(qg,[["render",Kg]]),Qg={name:"MentionPopover",components:{UserRouteLink:Me},setup(){return{userStore:Ue()}},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 o=++this.requestId;let u=this.getCached(e);if(!u){try{u=await this.userStore.fetchProfile(e)}catch{return}this.setCache(e,u)}o===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 Xg(e,t,o,u,s,n){const m=g("UserRouteLink");return s.virtualRef&&s.xprofile?(i(),v(m,{key:0,xprofile:s.xprofile,virtualRef:s.virtualRef,show_badge:!0,show_follow:!0,onPopoverMouseenter:n.cancelHide,onPopoverMouseleave:n.startHideTimeout},null,8,["xprofile","virtualRef","onPopoverMouseenter","onPopoverMouseleave"])):_("",!0)}const ey=P(Qg,[["render",Xg]]);let ty=window.fluentComAdmin.el_i18n;for(const[e,t]of Object.entries(ty))Ms.el[e]=t;const sy={name:"PortalApplication",components:{NotificationsPop:In,SearchBar:kf,Feed:Xe,SpaceCreateModal:cg,ReportContentModal:kg,ElConfigProvider:Fs,ExpandIcon:mg,ReportReviewModal:jg,PreviewPostModal:zg,UnfinishedChangesModal:Jg,MentionPopover:ey},setup(){const e=Es(),t=Ve();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,enLang:Ms,loadedStyles:{},tickerDismissed:!1}},computed:{newFeedsCount(){return this.feedStore.getNewPostsCount("global")||0}},watch:{$route(e,t){var n,m;if(this.popFeed&&(this.prevUrl=e.href,this.closeFeedModal()),(n=e.meta)!=null&&n.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 y=0,w=h.length;y{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 s=(f,h)=>{var y;if(h)try{(y=document.querySelector(f+h))==null||y.classList.add("router-link-exact-active")}catch(w){console.error(w)}};e.meta.in_course&&s(".fcom_space_",e.params.course_slug),e.meta.in_space&&s(".space_contents a.fcom_space_",e.params.space)}},methods:{dismissTicker(){this.tickerDismissed=!0,this.feedStore.clearNewPostsCount("global"),console.log("[App] Ticker dismissed")},routeToAllFeeds(){this.changeTitle(this.$t("Feeds")),this.tickerDismissed=!0,this.feedStore.clearNewPostsCount("global"),this.$router.push({name:"dashboard",query:{stamp:new Date().getTime(),sort_by:"latest"}})},reloadSidebarMenu(){this.$get("options/sidebar-menu-html").then(e=>{e.sidebar_html&&document.getElementById("fcom_sidebar_wrap")&&(document.getElementById("fcom_sidebar_wrap").innerHTML=e.sidebar_html,document.dispatchEvent(new CustomEvent("sidebar_menu_reloaded"))),e.auth_spaces&&(this.auth=e.auth_spaces)})},showFeedModal(e){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 u;let t=(u=this.$refs.feed_dialog_scroller)==null?void 0:u.wrapRef;if(!t)return;let o=t.querySelector(".feed_footer");o&&t.scrollTo({top:o.offsetTop-100,behavior:"smooth"})},100)})},handleNewComment(e){this.$nextTick(()=>{var u;let t=(u=this.$refs.feed_dialog_scroller)==null?void 0:u.wrapRef;if(!t)return;let o=t.querySelector(".feed_single");o&&setTimeout(()=>{t.scrollTo({top:o.scrollHeight,behavior:"smooth"})},100)})},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")},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 o=document.createElement("link");o.rel="stylesheet",o.href=this.appVars.lazy_styles[t],o.type="text/css",o.id=t,o.media="all",document.head.appendChild(o)})}},created(){this.hasNotificationHolder=this.auth.user_id&&document.getElementsByClassName("fcom_notification_holder").length,this.hasSearchHolder=!!document.getElementsByClassName("fcom_search_holder").length,this.$eventBus.on("fresh_feeds_loaded",e=>{let t=e.space;t||(t="__all"),this.feedMonitorCache[t]=e.feeds[0].id}),document.addEventListener("doCustomGlobalSearch",e=>{this.$eventBus.emit("doGlobalSearch",e.detail.search)}),this.$eventBus.on("reloadMenu",()=>{this.reloadSidebarMenu()}),this.$eventBus.on("toTop",e=>{window.fcomLayoutRef&&(e||(e=0),window.fcomLayoutRef.scrollTo({top:e,behavior:"instant"}))}),this.isSmallScreen=window.innerWidth<=1024},mounted(){this.$eventBus.on("showFeedModal",this.showFeedModal),this.auth.user_id&&(console.log("[App] Starting new Pinia ticker with random intervals (45-75s)..."),this.tickerStore.start()),this.$watch("$route",e=>{e.name==="dashboard"&&(this.tickerDismissed=!1)})},beforeUnmount(){this.tickerStore.isActive&&(console.log("[App] Stopping Pinia ticker..."),this.tickerStore.stop())}},oy={key:0,class:"fcom_new_ticker"},iy={key:1,class:"fcom_mobile_menu"},ny={class:"focm_menu_items"},ly=["innerHTML"],ay=["innerHTML"],ry=["href"],cy=["innerHTML"],dy=["innerHTML"];function uy(e,t,o,u,s,n){const m=g("router-view"),f=N,h=g("router-link"),y=Ti,w=g("ExpandIcon"),b=O,C=g("feed"),p=ge,k=Ce,S=g("search-bar"),$=g("notifications-pop"),I=g("space-create-modal"),F=g("unfinished-changes-modal"),B=g("preview-post-modal"),M=g("report-content-modal"),E=g("report-review-modal"),A=g("mention-popover"),U=Fs;return i(),v(U,{locale:s.enLang},{default:r(()=>[a(m,{class:R(e.appVars.route_classes)},null,8,["class"]),(i(),v(ot,{to:"body"},[u.tickerStore.isActive&&n.newFeedsCount>0&&!s.tickerDismissed?(i(),c("div",oy,[l("div",{onClick:t[0]||(t[0]=T=>n.routeToAllFeeds()),class:"fcom_ticker_menu"},d(e.$_n("A new post is available","%s new posts available",n.newFeedsCount)),1),l("div",{onClick:t[1]||(t[1]=T=>n.dismissTicker()),class:"fcom_ticker_dismiss"}," x ")])):_("",!0),s.mobileMenuItems&&s.mobileMenuItems.length?(i(),c("div",iy,[l("div",ny,[(i(!0),c(L,null,D(s.mobileMenuItems,T=>(i(),c("div",null,[T.route?(i(),v(h,{key:0,"aria-label":e.$t("Go to %s",T.title),class:"focm_menu_item",to:T.route},{default:r(()=>[a(f,null,{default:r(()=>[T.icon?(i(),v(zt(T.icon),{key:0})):T.icon_svg?(i(),c("span",{key:1,innerHTML:T.icon_svg},null,8,ly)):_("",!0)]),_:2},1024),T.html?(i(),c("span",{key:0,innerHTML:T.html},null,8,ay)):_("",!0)]),_:2},1032,["aria-label","to"])):(i(),c("a",{key:1,href:T.permalink,class:"focm_menu_item"},[T.icon_svg?(i(),v(f,{key:0},{default:r(()=>[l("span",{innerHTML:T.icon_svg},null,8,cy)]),_:2},1024)):_("",!0),l("span",{innerHTML:T.html},null,8,dy)],8,ry))]))),256))])])):_("",!0),a(k,{ref:"fcom_feed_modal","destroy-on-close":"",modelValue:s.shopPopFeed,"onUpdate:modelValue":t[2]||(t[2]=T=>s.shopPopFeed=T),"close-on-click-modal":!0,"close-on-press-escape":!0,"before-close":()=>{n.closeFeedModal()},class:"fcom_feed_modal",width:"100%"},{default:r(()=>[a(p,{ref:"feed_dialog_scroller","max-height":"calc(100dvh - 40px)"},{default:r(()=>[s.popFeed?(i(),v(C,{key:0,onCommented:n.handleNewComment,onDeleted:n.handleModalFeedDelete,is_single:!0,feed:s.popFeed,is_modal:!0,show_report:!0},{after_feed_actions:r(()=>[a(y,{direction:"vertical"}),a(b,{onClick:n.gotToFeed,class:"no_pad_btn",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["onClick"]),a(b,{style:{padding:"0 5px"},class:"no_pad_bt fcom_close_pop",onClick:n.closeFeedModal,text:""},null,8,["onClick"])]),_:1},8,["onCommented","onDeleted","feed"])):_("",!0)]),_:1},512)]),_:1},8,["modelValue","before-close"])])),s.hasSearchHolder?(i(),v(ot,{key:0,to:".fcom_search_holder"},[a(S)])):_("",!0),s.hasNotificationHolder?(i(),v(ot,{key:1,to:".fcom_notification_holder"},[a($)])):_("",!0),e.isAdmin?(i(),v(I,{key:2})):_("",!0),a(F,{ref:"unfinishedChangesModal",onProceed:n.proceedCloseFeedModal},null,8,["onProceed"]),a(B),a(M),a(E),a(A)]),_:1},8,["locale"])}const _y=P(sy,[["render",uy]]),my={name:"ContentLayout",props:["title","content_class","wrapper_class"],data(){return{throttledScrollHandler:null,lastScrolledTop:0}},created(){this.throttledScrollHandler=Hi(e=>{e>this.lastScrolledTop?document.body.classList.add("fcom_scrolling-down"):document.body.classList.remove("fcom_scrolling-down"),this.lastScrolledTop=e,document.dispatchEvent(new CustomEvent("fcom_layout_scroll",{detail:{scrollTop:e}}))},1e3)},methods:{handleLayoutScroll(e){this.throttledScrollHandler(e.scrollTop)}},mounted(){window.fcomLayoutRef=this.$refs.layoutScrollbarRef}},hy={key:0,class:"fhr_content_layout_header"},fy={role:"region","aria-label":"Actions",class:"fhr_page_actions"};function py(e,t,o,u,s,n){const m=ge;return i(),c("div",{class:R([o.wrapper_class,"fhr_content_layout"])},[a(m,{"min-size":100,always:!0,noresize:!0,native:!0,onScroll:n.handleLayoutScroll,ref:"layoutScrollbarRef",height:"calc(100dvh - var(--fcom-header-height, 0px) - var(--fcom-mobile-menu-height, 0px))"},{default:r(()=>[q(e.$slots,"header",{},()=>[o.title?(i(),c("div",hy,[q(e.$slots,"title",{},()=>[l("h1",{role:"region","aria-label":"Page Title",style:{cursor:"pointer"},onClick:t[0]||(t[0]=f=>e.$eventBus.emit("toTop")),class:"fhr_page_title"},d(o.title),1)]),l("div",fy,[q(e.$slots,"actions")])])):_("",!0)]),q(e.$slots,"sub_header"),l("div",{class:R([o.content_class,"fhr_content_layout_body"])},[q(e.$slots,"default")],2)]),_:3},8,["onScroll"])],2)}const ke=P(my,[["render",py]]),gy={name:"Dashboard",components:{Layout:ke},data(){return{greetings:"",notices:[]}},mounted(){this.$route.query.sort_by=="latest"&&this.$storeLocalData("feed_sort_by",""),this.$router.push({name:"all_feeds"})}},yy={key:0,class:"dashboard_actions"},vy=["innerHTML"],by={key:1};function ky(e,t,o,u,s,n){const m=g("layout");return i(),v(m,{title:s.greetings},{default:r(()=>[s.notices.length?(i(),c("div",yy,[l("h4",null,d(e.$t("Action required")),1),l("ul",null,[(i(!0),c(L,null,D(s.notices,f=>(i(),c("li",{innerHTML:f},null,8,vy))),256))])])):(i(),c("div",by,[l("p",null,d(e.$t("All is well! This dashboard will be updated with something awesome!")),1)]))]),_:1},8,["title"])}const wy=P(gy,[["render",ky]]),Cy={name:"AppLayout",props:["wrapper_class"]},$y={class:"feeds_main"};function Sy(e,t,o,u,s,n){const m=g("router-view");return i(),c("div",{class:R([o.wrapper_class,"feeds"])},[l("div",$y,[q(e.$slots,"before_route_view"),q(e.$slots,"default",{},()=>[a(m)]),q(e.$slots,"after_route_view")])],2)}const Se=P(Cy,[["render",Sy]]),Vy={name:"NotificationOnboard",data(){return{pushEnabled:!1,permission:"",requestInProgress:!1,confirmed:!1}},computed:{hasPush(){return this.appVars.has_push_notification&&this.pushEnabled&&this.permission!=="granted"}},methods:{async processSubscribe(){if(this.permission==="denied"){let t=`
Unblock Notifications Instructions
`;this.$messageBox.alert(this.$t('You have blocked or denied notifications for this site. Please reset permission and then click "Retry Button" to receive push notifications.')+t,this.$t("Notifications Blocked"),{dangerouslyUseHTMLString:!0,confirmButtonText:this.$t("Retry")}).then(()=>{window.fluentNotify&&(this.permission=window.fluentNotify.getPermission(),this.processSubscribe())});return}window.fluentNotify&&(this.requestInProgress=!0,await window.fluentNotify.subscribe()?(this.$notify.success(this.$t("You have successfully subscribed to push notifications.")),this.permission=window.fluentNotify.getPermission(),this.confirmed=!0):this.$notify.error(this.$t("Failed to subscribe to push notifications. Please try again.")),this.requestInProgress=!1,this.permission=window.fluentNotify.getPermission())},watchForPermissionChange(){var e,t;this.pushEnabled=(e=window.fluentNotify)==null?void 0:e.isAvailable,this.permission=(t=window.fluentNotify)==null?void 0:t.getPermission()}},mounted(){var e,t;window.fluentNotify?(this.pushEnabled=(e=window.fluentNotify)==null?void 0:e.isAvailable,this.permission=(t=window.fluentNotify)==null?void 0:t.getPermission()):document.addEventListener("fluent-notify-initialized",this.watchForPermissionChange)},beforeUnmount(){document.removeEventListener("fluent-notify-initialized",this.watchForPermissionChange)}},Ly={key:0,class:"app_side_widget widget_push_notification"},My={class:"widget_header"},Fy={style:{display:"flex","column-gap":"8px","align-items":"center",color:"var(--el-color-danger, #f56c6c)"}},Ty={class:"widget_body notifications_wrap"},Py={class:"onboard_actions fcom_mt_10"},Iy={key:0},Uy={key:1},By={key:0},Ey={key:1,class:"app_side_widget widget_push_notification"};function Ay(e,t,o,u,s,n){const m=N,f=O;return n.hasPush?(i(),c("div",Ly,[l("div",My,[l("h3",Fy,[a(m,{style:{"font-size":"120%"}},{default:r(()=>[...t[1]||(t[1]=[l("svg",{width:"24px",height:"24px","stroke-width":"1.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",color:"currentColor"},[l("path",{d:"M18.1336 11C18.7155 16.3755 21 18 21 18H3C3 18 6 15.8667 6 8.4C6 6.70261 6.63214 5.07475 7.75736 3.87452C8.88258 2.67428 10.4087 2 12 2C12.3373 2 12.6717 2.0303 13 2.08949",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M19 8C20.6569 8 22 6.65685 22 5C22 3.34315 20.6569 2 19 2C17.3431 2 16 3.34315 16 5C16 6.65685 17.3431 8 19 8Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M13.73 21C13.5542 21.3031 13.3019 21.5547 12.9982 21.7295C12.6946 21.9044 12.3504 21.9965 12 21.9965C11.6496 21.9965 11.3054 21.9044 11.0018 21.7295C10.6982 21.5547 10.4458 21.3031 10.27 21",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1}),l("span",null,d(e.$t("Never Miss a Reply")),1)])]),l("div",Ty,[l("p",null,d(e.$t("Get notified about replies to your posts and important community updates via web push notifications.")),1),l("div",Py,[a(f,{loading:s.requestInProgress,type:"primary",onClick:t[0]||(t[0]=h=>n.processSubscribe())},{default:r(()=>[s.requestInProgress?(i(),c("span",Uy,d(e.$t("Processing...")),1)):(i(),c("span",Iy,d(e.$t("Turn On Push Notifications")),1))]),_:1},8,["loading"])]),s.requestInProgress?(i(),c("p",By,d(e.$t("Please click Allow to enable notifications.")),1)):_("",!0)])])):s.confirmed?(i(),c("div",Ey,[l("p",null,d(e.$t("You will get push notifications on replies and imprortant updates.")),1)])):_("",!0)}const so=P(Vy,[["render",Ay]]),Dy={name:"RecentActivities",components:{NotificationOnboard:so},props:{context:{default(){return{}}},widget_title:{type:String,default(){return""}},pinned_widget_title:{type:String,default(){return""}},with_pins:{type:Boolean,default(){return!1}},is_trending:{type:Boolean,default(){return!1}},with_pending_count:{type:Boolean,default(){return!1}}},data(){return{activities:[],loading:!1,pinned_posts:[],pending_count:0,after_contents:"",before_contents:""}},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 o=this.appVars.urls.portal_base;return o=o.replace(/\/$/,""),o+t.fullPath}},mounted(){this.getActivities()}},Ry=["innerHTML"],Hy={key:1,class:"app_side_widget fcom_widget_highlight"},xy={class:"widget_header"},jy={role:"region","aria-label":"Pending Members"},Oy={class:"widget_body"},Ny={key:2,role:"region","aria-label":"Featured Posts",class:"app_side_widget widget_recent_activities"},zy={class:"widget_header"},qy={class:"widget_body notifications_wrap"},Gy={class:"notification_wrap"},Yy=["href"],Wy={class:"notification_item"},Zy={class:"notification_avatar"},Ky={class:"notification_content"},Jy=["innerHTML"],Qy={style:{"margin-top":"5px"},class:"feed_timestamp"},Xy={role:"region","aria-label":"Space Activities",class:"app_side_widget widget_recent_activities"},ev={class:"widget_header"},tv={class:"widget_body notifications_wrap"},sv={class:"notification_wrap"},ov=["href"],iv={class:"notification_avatar"},nv={class:"notification_content"},lv=["innerHTML"],av=["title"],rv={key:2,class:"notification_wrap"},cv={class:"notification_item"},dv={class:"notification_content"},uv={class:"no_notifications"},_v=["innerHTML"];function mv(e,t,o,u,s,n){const m=g("NotificationOnboard"),f=O,h=g("UserAvatar"),y=W;return i(),c(L,null,[s.before_contents?(i(),c("div",{key:0,innerHTML:s.before_contents},null,8,Ry)):_("",!0),a(m),s.pending_count&&o.with_pending_count?(i(),c("div",Hy,[l("div",xy,[l("h3",jy,d(e.$t("Pending Members")),1)]),l("div",Oy,[l("p",null,d(e.$t("%s people requested to join the community.",s.pending_count)),1)]),a(f,{role:"link","aria-label":"View pending members",onClick:t[0]||(t[0]=w=>e.$router.push({name:"space_members",query:{view_pending:"yes"}})),type:"danger"},{default:r(()=>[V(d(e.$t("View pending members")),1)]),_:1})])):_("",!0),o.with_pins&&s.pinned_posts.length?(i(),c("div",Ny,[l("div",zy,[l("h3",null,d(o.pinned_widget_title||e.$t("Featured Posts")),1)]),l("div",qy,[(i(!0),c(L,null,D(s.pinned_posts,w=>{var b;return i(),c("div",Gy,[l("a",{class:"no_style_link",href:w.permalink},[l("div",Wy,[l("div",Zy,[a(h,{with_level:!1,xprofile:w.xprofile},null,8,["xprofile"])]),l("div",Ky,[l("div",{innerHTML:w.message},null,8,Jy),l("span",Qy,d((b=w.xprofile)==null?void 0:b.display_name),1)])])],8,Yy)])}),256))])])):_("",!0),l("div",Xy,[l("div",ev,[l("h3",null,d(o.widget_title||e.$t("Recent Activities")),1)]),l("div",tv,[s.loading?(i(),v(y,{key:0,style:{"min-width":"320px"},animated:!0,rows:5})):s.activities.length?(i(!0),c(L,{key:1},D(s.activities,w=>(i(),c("div",sv,[l("a",{href:n.getActivityLink(w),class:"notification_item"},[l("div",iv,[a(h,{with_level:!1,xprofile:w.xprofile},null,8,["xprofile"])]),l("div",nv,[l("div",{innerHTML:w.message},null,8,lv),l("span",{title:w.updated_at,class:"notification_time_stamp"},d(e.humanDateDiff(w.updated_at)),9,av)])],8,ov)]))),256)):(i(),c("div",rv,[l("div",cv,[l("div",dv,[l("div",uv,d(e.$t("No recent activities found")),1)])])]))])]),s.after_contents?(i(),c("div",{key:3,innerHTML:s.after_contents},null,8,_v)):_("",!0)],64)}const At=P(Dy,[["render",mv]]),hv={name:"BgImageUpload",emits:["update:modelValue"],props:{modelValue:{type:String,required:!1},button_text:{type:String,default(){return""}},can_remove:{type:Boolean,default:!1},is_multiple:{type:Boolean,default:!1},additional_data:{type:Object,default:()=>({})}},data(){return{imageUrl:this.modelValue}},computed:{action_url(){return this.appVars.rest.url+"/feeds/media-upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}}},methods:{handleSuccess(e){this.imageUrl=e.media.url,this.$emit("update:modelValue",this.imageUrl)},handleError(e){this.$handleError(JSON.parse(e.message))},removeImage(){this.imageUrl="",this.$emit("update:modelValue","")}}};function fv(e,t,o,u,s,n){const m=Pe,f=O,h=lt,y=g("CloseBold"),w=N;return i(),c(L,null,[a(h,{action:n.action_url,headers:n.headers,accept:"image/*",class:"fcom_bg_upload",multiple:o.is_multiple,data:o.additional_data,"show-file-list":!1,"on-success":n.handleSuccess,"on-error":n.handleError},{default:r(()=>[q(e.$slots,"trigger",{},()=>[q(e.$slots,"default",{},()=>[s.imageUrl?(i(),v(m,{key:0,alt:e.$t("Image Preview"),src:s.imageUrl},null,8,["alt","src"])):(i(),v(f,{key:1,class:"fcom_btn_upload",text:""},{default:r(()=>[V(d(o.button_text||e.$t("Upload Image")),1)]),_:1}))])])]),_:3},8,["action","headers","multiple","data","on-success","on-error"]),s.imageUrl&&o.can_remove?(i(),v(f,{key:0,class:"fcom_bg_remove",text:"",size:"small",onClick:n.removeImage},{default:r(()=>[a(w,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["onClick"])):_("",!0)],64)}const oo=P(hv,[["render",fv]]),pv={name:"WelcomeBannerConfig",props:["savingCount"],emits:["saved"],components:{MediaEmbeder:es,BgImageUpload:oo,CrepeEditor:$t},data(){return{saving:!1,loading:!1,currentTab:"login",appReady:!1,bannerData:{login:{enable:"no",mediaType:"image",title:"",description:"",allowClose:"yes",bannerImage:"",ctaButtons:[],bannerVideo:{}},logout:{enable:"no",mediaType:"image",title:"",description:"",bannerImage:"",ctaButtons:[],bannerVideo:{}}}}},watch:{savingCount(){this.saveSettings()}},computed:{isEnabled(){return this.bannerData[this.currentTab].enabled=="yes"}},methods:{switchOption(e){this.appReady=!1,this.currentTab=e,this.$nextTick(()=>{this.appReady=!0})},addButton(){this.bannerData[this.currentTab].ctaButtons.push({label:"",link:"",type:"primary",newTab:"yes"})},removeButton(e){this.bannerData[this.currentTab].ctaButtons.splice(e,1)},getSettings(){this.loading=!0,this.$get("admin/welcome-banner").then(e=>{this.bannerData=e.settings,this.appReady=!0}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},saveSettings(){this.saving=!0,this.$post("admin/welcome-banner",{settings:this.bannerData}).then(e=>{this.$notify.success(e.message),this.$emit("saved"),this.Storage.remove("fcom_welcome_banner_closed_auth"),this.Storage.remove("fcom_welcome_banner_closed_guest")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},mounted(){this.getSettings()}},gv={class:"fcom_customizer_container"},yv={class:"fcom_wc_banner_header"},vv={class:"fcom_wc_banner_options"},bv={class:"fcom_filter_menu"},kv={class:"fcom_filter_menu_ul"},wv={key:0,class:"fcom_wc_banner_content"},Cv={class:"fcom_wc_banner_content_header"},$v={class:"fcom_wc_banner_media_type"},Sv={key:0,class:"fcom_banner_image_holder"},Vv={key:1,class:"fcom_banner_image_preview"},Lv={key:0,class:"fcom_wc_banner_cta_buttons"},Mv={class:"fcom_wc_help_text"},Fv={class:"fcom_wc_banner_content_footer"};function Tv(e,t,o,u,s,n){const m=Ts,f=Ee,h=ve,y=g("BgImageUpload"),w=Pe,b=g("CloseBold"),C=N,p=O,k=g("media-embeder"),S=X,$=de,I=g("crepe-editor"),F=oe,B=ie,M=Pi,E=_e,A=ue,U=W;return i(),c("div",gv,[l("div",yv,[l("h4",null,d(e.$t("Welcome Banner")),1)]),l("div",vv,[l("div",bv,[l("ul",kv,[l("li",null,[l("a",{onClick:t[0]||(t[0]=Y(T=>n.switchOption("login"),["prevent"])),class:R({"router-link-exact-active":s.currentTab=="login"}),href:"#"},d(e.$t("Logged in")),3)]),l("li",null,[l("a",{onClick:t[1]||(t[1]=Y(T=>n.switchOption("logout"),["prevent"])),class:R({"router-link-exact-active":s.currentTab=="logout"}),href:"#"},d(e.$t("Logged out")),3)])])])]),s.loading?(i(),v(U,{key:1,rows:5})):(i(),c("div",wv,[l("div",Cv,[l("h4",null,d(s.currentTab==="login"?e.$t("Enable for logged in members"):e.$t("Enable for logged out members")),1),a(m,{modelValue:s.bannerData[s.currentTab].enabled,"onUpdate:modelValue":t[2]||(t[2]=T=>s.bannerData[s.currentTab].enabled=T),"active-value":"yes","inactive-value":"no",class:"fcom_switch"},null,8,["modelValue"])]),l("div",{class:R(["fcom_wc_banner_content_body",{fcom_wc_disabled:!n.isEnabled}])},[l("div",$v,[l("p",null,d(e.$t("Media type")),1),a(h,{modelValue:s.bannerData[s.currentTab].mediaType,"onUpdate:modelValue":t[3]||(t[3]=T=>s.bannerData[s.currentTab].mediaType=T),class:"fcom_radio_group"},{default:r(()=>[a(f,{label:e.$t("Image"),value:"image"},null,8,["label"]),a(f,{label:e.$t("Video"),value:"video"},null,8,["label"])]),_:1},8,["modelValue"])]),s.bannerData[s.currentTab].mediaType==="image"?(i(),c(L,{key:0},[s.bannerData[s.currentTab].bannerImage?(i(),c("div",Vv,[a(w,{alt:e.$t("Image Preview"),src:s.bannerData[s.currentTab].bannerImage},null,8,["alt","src"]),a(p,{class:"fcom_secondary_button",text:"",onClick:t[5]||(t[5]=T=>s.bannerData[s.currentTab].bannerImage="")},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1})]),_:1})])):(i(),c("div",Sv,[l("h4",null,d(e.$t("Featured Image")),1),l("p",null,d(e.$t("Set a featured image at the top of the welcome banner. Recommended image dimension: 1680x600")),1),a(y,{modelValue:s.bannerData[s.currentTab].bannerImage,"onUpdate:modelValue":t[4]||(t[4]=T=>s.bannerData[s.currentTab].bannerImage=T)},null,8,["modelValue"])]))],64)):_("",!0),s.bannerData[s.currentTab].mediaType==="video"?(i(),v(k,{key:1,media:s.bannerData[s.currentTab].bannerVideo},null,8,["media"])):_("",!0),a(A,{onSubmit:t[9]||(t[9]=Y(T=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a($,{label:e.$t("Title")},{default:r(()=>[a(S,{modelValue:s.bannerData[s.currentTab].title,"onUpdate:modelValue":t[6]||(t[6]=T=>s.bannerData[s.currentTab].title=T)},null,8,["modelValue"])]),_:1},8,["label"]),a($,{label:e.$t("Description")},{default:r(()=>[s.appReady?(i(),v(I,{key:0,modelValue:s.bannerData[s.currentTab].description,"onUpdate:modelValue":t[7]||(t[7]=T=>s.bannerData[s.currentTab].description=T)},null,8,["modelValue"])):_("",!0)]),_:1},8,["label"]),a($,{label:e.$t("Call to Action")},{default:r(()=>{var T;return[((T=s.bannerData[s.currentTab].ctaButtons)==null?void 0:T.length)>0?(i(),c("div",Lv,[(i(!0),c(L,null,D(s.bannerData[s.currentTab].ctaButtons,(j,z)=>{var ne;return i(),c("div",{key:z,class:"fcom_wc_banner_cta_button"},[a($,{label:z?"":e.$t("Button Label")},{default:r(()=>[a(S,{modelValue:j.label,"onUpdate:modelValue":x=>j.label=x},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),a($,{label:z?"":e.$t("Button Link")},{default:r(()=>[a(S,{modelValue:j.link,"onUpdate:modelValue":x=>j.link=x},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),a($,{label:z?"":e.$t("Button Type"),class:"fcom_wc_banner_select"},{default:r(()=>[a(B,{modelValue:j.type,"onUpdate:modelValue":x=>j.type=x,class:"fcom_select",placeholder:e.$t("Select type")},{default:r(()=>[a(F,{label:e.$t("Primary"),value:"primary"},null,8,["label"]),a(F,{label:e.$t("Secondary"),value:"secondary"},null,8,["label"]),a(F,{label:e.$t("Text"),value:"text"},null,8,["label"]),a(F,{label:e.$t("Link"),value:"link"},null,8,["label"])]),_:1},8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1032,["label"]),a($,{label:z?"":e.$t("Open in new tab"),class:"fcom_wc_banner_select"},{default:r(()=>[a(B,{modelValue:j.newTab,"onUpdate:modelValue":x=>j.newTab=x,class:"fcom_select"},{default:r(()=>[a(F,{label:e.$t("Yes"),value:"yes"},null,8,["label"]),a(F,{label:e.$t("No"),value:"no"},null,8,["label"])]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),((ne=s.bannerData[s.currentTab].ctaButtons)==null?void 0:ne.length)>1?(i(),v(p,{key:0,text:"",class:"wc_button_remove",onClick:x=>n.removeButton(z)},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"])):_("",!0)])}),128)),a(M,{underline:!1,onClick:n.addButton},{default:r(()=>[V(d("+ "+e.$t("Add button")),1)]),_:1},8,["onClick"])])):(i(),v(M,{key:1,underline:!1,onClick:n.addButton},{default:r(()=>[V(d("+ "+e.$t("Add button")),1)]),_:1},8,["onClick"]))]}),_:1},8,["label"]),s.currentTab=="login"?(i(),v($,{key:0},{default:r(()=>[a(E,{modelValue:s.bannerData[s.currentTab].allowClose,"onUpdate:modelValue":t[8]||(t[8]=T=>s.bannerData[s.currentTab].allowClose=T),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Allow members to close the welcome banner")),1)]),_:1},8,["modelValue"]),l("span",Mv,d(e.$t("If allowed, members will be able to hide the banner")),1)]),_:1})):_("",!0)]),_:1})],2),l("div",Fv,[a(p,{class:"fcom_primary_button",disabled:s.saving,loading:s.saving,onClick:n.saveSettings},{default:r(()=>[V(d(e.$t("Update Info")),1)]),_:1},8,["disabled","loading","onClick"])])]))])}const Pv=P(pv,[["render",Tv]]);const Iv={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}},emits:["drop","crossDrop","drag-start"],data(){return{draggingIndex:null,startIndex:null,snapshotBeforeDrag:null}},methods:{dragStart(e,t){e._fluentDndHandled||(e._fluentDndHandled=!0,this.draggingIndex=t,this.startIndex=t,this.snapshotBeforeDrag=[...this.items],this.$emit("drag-start",{index:t,items:this.items}),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",this.items[t][this.rowKey]),this.group&&e.dataTransfer.setData("source-group",this.group))},dragEnd(){this.snapshotBeforeDrag&&(this.items.splice(0,this.items.length,...this.snapshotBeforeDrag),this.snapshotBeforeDrag=null),this.draggingIndex=null},dragOver(e,t){if(e.preventDefault(),!this.group&&e.dataTransfer.types.includes("source-group")||this.draggingIndex===null)return;const o=this.items[this.draggingIndex],u=this.items[t];if(o===u)return;const s=e.currentTarget.getBoundingClientRect(),n=s.top+s.height/2,m=e.clientY;(this.draggingIndexn||this.draggingIndex>t&&mn.onContainerDragOver&&n.onContainerDragOver(...m),["prevent"])),onDrop:t[2]||(t[2]=Y((...m)=>n.onContainerDrop&&n.onContainerDrop(...m),["prevent"]))},[a(bo,{name:"flip-list",tag:"div",class:"drag-group",style:re(o.gap?{display:"flex",flexDirection:"column",gap:o.gap}:{})},{default:r(()=>[(i(!0),c(L,null,D(o.items,(m,f)=>(i(),c("div",{key:m[o.rowKey],onDragstart:h=>n.dragStart(h,f),onDragend:t[0]||(t[0]=(...h)=>n.dragEnd&&n.dragEnd(...h)),onDragover:Y(h=>n.dragOver(h,f),["prevent"]),onDrop:Y(h=>n.dropEnd(h,f),["prevent"]),draggable:o.draggable,class:R(["drag-item",o.itemClass,{dragging:s.draggingIndex===f}]),style:re(o.itemStyle)},[q(e.$slots,"item",{data:m,index:f},void 0,!0)],46,Uv))),128))]),_:3},8,["style"])],32)}const Ev=P(Iv,[["render",Bv],["__scopeId","data-v-97dc50e4"]]),Av={name:"MenuGroupSettings",components:{SpaceCourseSelector:Et,FluentDnD:Ev,LogoEmojiSelector:Tt,Drawer:Qs},data(){return{editingItem:null,originalItem:null,openEditLinkDrawer:!1,isDragging:!1,isSpaceDragging:!1,draggingIndex:null,draggedSpaceIndex:null,mode:null,urlErrors:[],validationAttempt:0}},computed:{isDirty(){return!this.editingItem||!this.originalItem?!1:JSON.stringify(this.editingItem)!==JSON.stringify(this.originalItem)}},emits:["save"],props:{menuItems:{type:Array,required:!0},saving:{type:Boolean,default:!1},title:{type:String,required:!0},has_svg:{type:Boolean,default:!0},use_icon_selector:{type:Boolean,default:!1},has_enable_disable:{type:Boolean,default:!0},custom_svg:{type:Boolean,default:!1}},methods:{validateLinkForm(){if(this.urlErrors=[],this.validationAttempt++,(!this.editingItem.title||!this.editingItem.title.trim())&&this.urlErrors.push(this.$t("Link title cannot be empty.")),this.editingItem.is_system!=="yes"){const e=Ut(this.editingItem.permalink);e.valid||this.urlErrors.push(...e.errors)}return this.urlErrors.length===0},initEditLink(e,t="create"){!e.is_system&&!e.privacy&&(e.privacy="public",e.membership_ids=[]),this.mode=t,this.urlErrors=[],this.originalItem=e,this.editingItem=JSON.parse(JSON.stringify(e||{})),this.$nextTick(()=>{this.openEditLinkDrawer=!0})},removeLink(e){this.$confirm(this.$t("Are you sure you want to remove this link?"),this.$t("Warning"),{confirmButtonText:this.$t("Yes"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.menuItems.splice(e,1),this.saveMenuItems({customSuccessMessage:this.$t("Link deleted successfully.")})})},createOrUpdateLink(){if(!this.saving&&this.validateLinkForm()){if(!this.editingItem.slug)this.editingItem.slug="fcom_custom_"+this.editingItem.title.toLowerCase().replace(/[^a-z0-9]/g,"_"),this.menuItems.push(this.editingItem);else{const e=this.menuItems.findIndex(t=>t.slug===this.editingItem.slug);e!==-1?Object.assign(this.menuItems[e],this.editingItem):this.menuItems.push(this.editingItem)}this.openEditLinkDrawer=!1,this.editingItem=null,this.saveMenuItems()}},saveMenuItems({customSuccessMessage:e=null}={}){this.$emit("save",{customSuccessMessage:e})},drop({index:e}){this.draggingIndex=null,this.saveMenuItems()},beforeCloseDrawer(e){if(this.saving){this.$notify.info(this.$t("Please wait to complete."));return}this.editingItem=null,this.originalItem=null,this.mode=null,e()}}},Dv={key:0,class:"fcom_section_primary"},Rv={class:"fcom_section_primary_item"},Hv={class:"fcom_section_primary_item_title"},xv={class:"fcom_heading_item"},jv={class:"fcom_section_item_actions"},Ov={class:"fcom_section_items menu-items-container"},Nv={key:0,style:{padding:"1rem"}},zv={class:"fcom_section_item_title"},qv={class:"fcom_heading_item"},Gv={key:0,class:"community_avatar"},Yv=["src"],Wv={key:1,class:"fcom_emoji"},Zv={key:2,class:"fcom_shape"},Kv=["innerHTML"],Jv={class:"fcom_section_item_actions"},Qv={key:0},Xv={key:1},e0={key:0},t0={class:"fcom_help_text"},s0={class:"fcom_help_text"};function o0(e,t,o,u,s,n){const m=O,f=N,h=Be,y=g("FluentDnD"),w=g("logo-emoji-selector"),b=X,C=de,p=_e,k=Ee,S=ve,$=g("SpaceCourseSelector"),I=Ls,F=ue,B=g("drawer");return i(),c(L,null,[o.menuItems?(i(),c("div",Dv,[l("div",Rv,[l("div",Hv,[l("div",xv,[q(e.$slots,"title",{},()=>[l("h4",null,d(o.title),1)])])]),l("div",jv,[a(m,{class:"fcom_primary_button",onClick:t[0]||(t[0]=M=>n.initEditLink({enabled:"yes",privacy:"public",membership_ids:[],new_tab:"yes"}))},{default:r(()=>[V(d(e.$t("Add New Link")),1)]),_:1})])]),l("div",Ov,[o.menuItems.length?_("",!0):(i(),c("div",Nv,[l("p",null,d(e.$t("No link has been added for this section")),1)])),a(y,{items:o.menuItems,"row-key":"slug",onDrop:n.drop,"item-class":"fcom_section_item"+(o.saving?"":" fcom_cursor_move"),"item-style":"padding: 15px 15px 15px 35px"},{item:r(({data:M,index:E})=>[l("div",zv,[l("p",qv,[o.use_icon_selector?(i(),c(L,{key:0},[t[12]||(t[12]=l("div",{class:"fcom_drag_handle"}," โ‹ฎโ‹ฎ ",-1)),M.icon_image?(i(),c("div",Gv,[a(f,null,{default:r(()=>[l("img",{alt:"",style:{"max-width":"16px","max-height":"16px"},src:M.icon_image},null,8,Yv)]),_:2},1024)])):M.emoji?(i(),c("span",Wv,d(M.emoji),1)):M.shape_svg?(i(),c("span",Zv,[a(f,{innerHTML:M.shape_svg},null,8,["innerHTML"])])):_("",!0)],64)):M.icon_svg?(i(),v(f,{key:1},{default:r(()=>[l("span",{innerHTML:M.icon_svg},null,8,Kv)]),_:2},1024)):_("",!0),l("span",null,d(M.title),1),M.is_unavailable=="yes"?(i(),v(h,{key:2,type:"danger"},{default:r(()=>[V(d(e.$t("unavailable")),1)]),_:1})):M.enabled=="yes"?(i(),v(h,{key:3,type:"success"},{default:r(()=>[V(d(e.$t("enabled")),1)]),_:1})):(i(),v(h,{key:4,type:"info"},{default:r(()=>[V(d(e.$t("disabled")),1)]),_:1}))])]),l("div",Jv,[l("div",null,[a(m,{onClick:A=>n.initEditLink(M,"edit"),size:"small"},{default:r(()=>[V(d(e.$t("Edit")),1)]),_:1},8,["onClick"]),M.is_system!="yes"?(i(),v(m,{key:0,onClick:A=>n.removeLink(E),type:"danger",plain:"",size:"small"},{default:r(()=>[V(d(e.$t("Delete")),1)]),_:1},8,["onClick"])):_("",!0)])])]),_:1},8,["items","onDrop","item-class"])])])):_("",!0),a(B,{modelValue:s.openEditLinkDrawer,"onUpdate:modelValue":t[11]||(t[11]=M=>s.openEditLinkDrawer=M),size:e.drawerWidth,"before-close":n.beforeCloseDrawer,id:"fluent_comminity_body","close-on-click-modal":!0,"has-close-confirmation":n.isDirty&&!o.saving,"close-confirmation-message":e.$t("Closing will discard your changes. Are you sure?")},{header:r(()=>[s.mode==="edit"?(i(),c("h4",Qv,d(e.$t("Edit Link")),1)):(i(),c("h4",Xv,d(e.$t("Add Custom Link")),1))]),default:r(()=>[s.editingItem?(i(),c("div",e0,[a(F,{onSubmit:t[10]||(t[10]=Y(M=>e.doNothing(),["prevent"])),"label-position":"top",disabled:o.saving},{default:r(()=>[a(C,{label:e.$t("Name of the Link")},{default:r(()=>[a(b,{disabled:o.saving,placeholder:e.$t("Public Name of the item"),modelValue:s.editingItem.title,"onUpdate:modelValue":t[2]||(t[2]=M=>s.editingItem.title=M)},be({_:2},[o.use_icon_selector?{name:"prepend",fn:r(()=>[a(w,{custom_svg:o.custom_svg,fallback_mark:"โ˜บ",onUpdate:t[1]||(t[1]=M=>{o.saving||(s.editingItem.emoji=M.emoji,s.editingItem.icon_image=M.logo,s.editingItem.shape_svg=M.shape_svg)}),config:{logo:s.editingItem.icon_image,emoji:s.editingItem.emoji||"",shape_svg:s.editingItem.shape_svg||""}},null,8,["custom_svg","config"])]),key:"0"}:void 0]),1032,["disabled","placeholder","modelValue"])]),_:1},8,["label"]),a(C,{label:e.$t("URL")},{default:r(()=>[a(b,{disabled:o.saving||s.editingItem.is_system=="yes",type:"text",placeholder:e.$t("URL or path (e.g. https://example.com or /members)"),modelValue:s.editingItem.permalink,"onUpdate:modelValue":t[3]||(t[3]=M=>s.editingItem.permalink=M)},null,8,["disabled","placeholder","modelValue"]),l("div",t0,[l("p",null,d(e.$t("For internal links, start with / (e.g. /members).")),1)])]),_:1},8,["label"]),o.has_svg?(i(),v(C,{key:0,label:e.$t("SVG Code for Icon (Simplified SVG Code) / Emoji")},{default:r(()=>[a(b,{disabled:o.saving,placeholder:e.$t("SVG Code. No url please / You can use emoji"),type:"textarea",rows:3,modelValue:s.editingItem.icon_svg,"onUpdate:modelValue":t[4]||(t[4]=M=>s.editingItem.icon_svg=M)},null,8,["disabled","placeholder","modelValue"])]),_:1},8,["label"])):_("",!0),o.has_enable_disable?(i(),v(C,{key:1,style:{"margin-bottom":"5px"}},{default:r(()=>[a(p,{disabled:o.saving,"true-value":"yes","false-value":"no",modelValue:s.editingItem.enabled,"onUpdate:modelValue":t[5]||(t[5]=M=>s.editingItem.enabled=M),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Enable this link")),1)]),_:1},8,["disabled","modelValue"])]),_:1})):_("",!0),s.editingItem.is_system?_("",!0):(i(),c(L,{key:2},[a(C,null,{default:r(()=>[a(p,{disabled:o.saving,"true-value":"yes","false-value":"no",modelValue:s.editingItem.new_tab,"onUpdate:modelValue":t[6]||(t[6]=M=>s.editingItem.new_tab=M),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Open this link in a new tab.")),1)]),_:1},8,["disabled","modelValue"])]),_:1}),a(C,{label:e.$t("Visibility")},{default:r(()=>[a(S,{disabled:o.saving,modelValue:s.editingItem.privacy,"onUpdate:modelValue":t[7]||(t[7]=M=>s.editingItem.privacy=M)},{default:r(()=>[a(k,{label:e.$t("Everyone"),value:"public"},null,8,["label"]),a(k,{label:e.$t("Logged-in only"),value:"logged_in"},null,8,["label"]),a(k,{label:e.$t("Public only"),value:"logged_out_only"},null,8,["label"]),a(k,{label:e.$t("By Space/Course Memberships"),value:"members_only"},null,8,["label"])]),_:1},8,["disabled","modelValue"]),l("div",s0,d(e.$t("Select who can see this link.")),1)]),_:1},8,["label"]),s.editingItem.privacy=="members_only"?(i(),v(C,{key:0,label:e.$t("Select Space/Course Memberships")},{default:r(()=>[a($,{disabled:o.saving,modelValue:s.editingItem.membership_ids,"onUpdate:modelValue":t[8]||(t[8]=M=>s.editingItem.membership_ids=M),placeholder_text:e.$t("Select Memberships"),is_multiple:!0},null,8,["disabled","modelValue","placeholder_text"])]),_:1},8,["label"])):_("",!0)],64)),s.urlErrors.length?(i(),v(I,{key:s.validationAttempt,type:"warning",closable:!0,"show-icon":"",style:{margin:"8px 0"}},{title:r(()=>[l("div",null,[l("ul",null,[(i(!0),c(L,null,D(s.urlErrors,(M,E)=>(i(),c("li",{style:{"margin-bottom":"0"},key:E},d(M),1))),128))])])]),_:1})):_("",!0),a(C,null,{default:r(()=>[a(m,{disabled:o.saving,class:"fcom_primary_button",onClick:t[9]||(t[9]=M=>n.createOrUpdateLink())},{default:r(()=>[V(d(o.saving?e.$t("Saving..."):e.$t("Save")),1)]),_:1},8,["disabled"])]),_:1})]),_:1},8,["disabled"])])):_("",!0)]),_:1},8,["modelValue","size","before-close","has-close-confirmation","close-confirmation-message"])],64)}const io=P(Av,[["render",o0]]),i0={name:"ManageFeedLinks",components:{MenuGroupSettings:io},props:["savingCount"],emits:["saved"],data(){return{loading:!1,menuItems:[]}},watch:{savingCount(){this.saveMenuItems()}},methods:{getMenuItems(){this.loading=!0,this.$get("feeds/links").then(e=>{this.menuItems=e.links}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},saveMenuItems(){let e="feeds/links";this.$post(e,{links:this.menuItems}).then(t=>{this.$notify.success(t.message),this.menuItems=t.links,this.$emit("saved")}).catch(t=>{this.$handleError(t)})}},mounted(){this.getMenuItems()}},n0={class:"fcom_customizer_container"},l0={key:0,class:"fcom_card_sections"};function a0(e,t,o,u,s,n){const m=g("menu-group-settings"),f=W;return i(),c("div",n0,[s.loading?_("",!0):(i(),c("div",l0,[a(m,{custom_svg:!0,use_icon_selector:!0,has_svg:!1,title:e.$t("Manage Links"),menuItems:s.menuItems,onSave:t[0]||(t[0]=h=>n.saveMenuItems())},null,8,["title","menuItems"])])),s.loading?(i(),v(f,{key:1,rows:5,animated:""})):_("",!0)])}const r0=P(i0,[["render",a0]]),c0={name:"FeedCustomizer",props:["customize_tab"],components:{WelcomeBannerConfig:Pv,ManageFeedLinks:r0},data(){return{saving:!1,savingCount:0,changesExist:!1,currentTab:this.customize_tab}},methods:{savedData(){this.saving=!1,this.changesExist=!0},saveChanges(){this.changesExist=!0,this.savingCount=this.savingCount+1},handleBack(){this.$emit("updated",this.changesExist)}}},d0={class:"fcom_full_editor"},u0={class:"fcom_full_editor_header"},_0={class:"fcom_editor_menu object_menu"},m0={class:"fcom_space_menu_ul"},h0={class:"full_editor_actions"};function f0(e,t,o,u,s,n){const m=g("ArrowLeft"),f=N,h=O,y=Ps,w=g("welcome-banner-config"),b=ge,C=Le,p=g("manage-feed-links"),k=xe;return i(),c("div",d0,[a(k,null,{default:r(()=>[a(y,{class:"fcom_full_editor_header_wrap"},{default:r(()=>[l("div",u0,[l("div",{onClick:t[0]||(t[0]=(...S)=>n.handleBack&&n.handleBack(...S)),class:"fcom_back_header"},[a(f,null,{default:r(()=>[a(m)]),_:1}),V(" "+d(e.$t("Feed")),1)]),l("div",_0,[l("ul",m0,[e.has_pro?(i(),c("li",{key:0,onClick:t[1]||(t[1]=S=>s.currentTab="welcome")},[l("a",{class:R({"router-link-exact-active":s.currentTab==="welcome"}),href:"#"},d(e.$t("Welcome Banner")),3)])):_("",!0),l("li",{onClick:t[2]||(t[2]=S=>s.currentTab="manage_links")},[l("a",{class:R({"router-link-exact-active":s.currentTab==="manage_links"}),href:"#"},d(e.$t("Feed Links")),3)])])]),l("div",h0,[a(h,{class:"fcom_primary_button",disabled:s.saving,loading:s.saving,onClick:n.saveChanges},{default:r(()=>[V(d(e.$t("Save Changes")),1)]),_:1},8,["disabled","loading","onClick"])])])]),_:1}),a(k,{class:"fcom_full_editor_container"},{default:r(()=>[s.currentTab=="welcome"?(i(),v(C,{key:0,class:"fcom_full_editor_main"},{default:r(()=>[a(b,null,{default:r(()=>[a(w,{savingCount:s.savingCount,onSaved:n.savedData},null,8,["savingCount","onSaved"])]),_:1})]),_:1})):s.currentTab=="manage_links"?(i(),v(C,{key:1,class:"fcom_full_editor_main"},{default:r(()=>[a(b,null,{default:r(()=>[a(p,{savingCount:s.savingCount,onSaved:n.savedData},null,8,["savingCount","onSaved"])]),_:1})]),_:1})):_("",!0)]),_:1})]),_:1})])}const p0=P(c0,[["render",f0]]),g0={name:"FeedMenu",components:{FeedCustomizer:p0},data(){return{customizeTab:"welcome",customizeSpace:!1,popoverVisible:!1}},methods:{openCustomizer(e){this.popoverVisible=!1,this.customizeTab=e,this.customizeSpace=!0},togglePopover(){this.popoverVisible=!this.popoverVisible},updatedFeedSettings(e){this.customizeSpace=!1,e&&location.reload()}}},y0={class:"actions_items"},v0={key:0};function b0(e,t,o,u,s,n){const m=g("MoreFilled"),f=N,h=O,y=fe,w=g("feed-customizer");return i(),c(L,null,[l("div",null,[a(y,{placement:"bottom",ref:"feed_actions",persistent:!1,visible:s.popoverVisible,onHide:t[2]||(t[2]=b=>s.popoverVisible=!1)},{reference:r(()=>[a(h,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:"",onClick:n.togglePopover},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:r(()=>[l("ul",y0,[e.has_pro?(i(),c("li",{key:0,onClick:t[0]||(t[0]=b=>n.openCustomizer("welcome"))},d(e.$t("Welcome Banner")),1)):_("",!0),l("li",{onClick:t[1]||(t[1]=b=>n.openCustomizer("manage_links"))},d(e.$t("Manage Links")),1)])]),_:1},8,["visible"])]),s.customizeSpace?(i(),c("div",v0,[(i(),v(ot,{to:"body"},[a(w,{customize_tab:s.customizeTab,onClose:t[3]||(t[3]=b=>s.customizeSpace=!1),onUpdated:n.updatedFeedSettings},null,8,["customize_tab","onUpdated"])]))])):_("",!0)],64)}const k0=P(g0,[["render",b0]]),w0={name:"RenderSpaceLinks",props:{links:{type:Array,required:!0}},computed:{enabledLinks(){return this.links.filter(e=>e.enabled!=="no")}}},C0={class:"object_menu"},$0={class:"fcom_space_menu_ul"},S0=["target","href"],V0=["src"],L0={key:1,class:"fcom_emoji"},M0={key:2,style:{"font-size":"120%"},class:"fcom_shape"};function F0(e,t,o,u,s,n){const m=N;return i(),c("div",C0,[l("ul",$0,[(i(!0),c(L,null,D(n.enabledLinks,f=>(i(),c("li",{key:f.slug},[l("a",{target:f.new_tab=="yes"?"_blank":"",rel:"noopener nofollow",href:f.permalink},[f.icon_image?(i(),c("img",{key:0,alt:"",src:f.icon_image},null,8,V0)):f.emoji?(i(),c("span",L0,d(f.emoji),1)):f.shape_svg?(i(),c("span",M0,[a(m,{innerHTML:f.shape_svg},null,8,["innerHTML"])])):_("",!0),l("span",null,d(f.title),1)],8,S0)]))),128))])])}const ls=P(w0,[["render",F0]]),T0={name:"FeedsRoute",components:{SpaceIcon:Oe,Layout:ke,AppLayout:Se,RecentActivities:At,FeedMenu:k0,RenderSpaceLinks:ls},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)}},P0={key:0,"aria-label":"Feed Links",class:"fcom_sub_header"},I0={key:0,class:"fcom_profile_complete_btn_wrap"},U0={key:1},B0={key:0,class:"fcom_feed_box"},E0={key:0,class:"fcom_main_side_wrap"},A0={class:"fcom_side_box"};function D0(e,t,o,u,s,n){const m=g("render-space-links"),f=O,h=g("feed-menu"),y=g("router-view"),w=Le,b=g("recent-activities"),C=We,p=xe,k=g("layout"),S=g("app-layout");return i(),v(S,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(k,{wrapper_class:"no_bg_layout",title:e.$t("Feed")},{title:r(()=>[l("h1",{onClick:t[0]||(t[0]=$=>{e.$eventBus.emit("toTop"),n.resetRoute()}),class:"fcom_page_title clickable"},d(e.$t("Feed")),1)]),sub_header:r(()=>{var $;return[(($=e.appVars.feed_links)==null?void 0:$.length)>0?(i(),c("nav",P0,[a(m,{links:e.appVars.feed_links},null,8,["links"])])):_("",!0)]}),actions:r(()=>[e.auth.compilation_score<100?(i(),c("div",I0,[a(f,{onClick:n.goToProfile,type:"danger"},{default:r(()=>[V(d(e.$t("Complete your profile"))+" ("+d(e.auth.compilation_score)+"%)",1)]),_:1},8,["onClick"])])):_("",!0),e.isAdmin()?(i(),c("div",U0,[a(h)])):_("",!0)]),default:r(()=>[a(p,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(w,{class:"fcom_main"},{default:r(()=>[s.transiting?_("",!0):(i(),c("div",B0,[a(y)]))]),_:1}),a(C,{class:"fcom_resp_side",width:"306px"},{default:r(()=>[e.isMobile?_("",!0):(i(),c("div",E0,[l("div",A0,[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 R0=P(T0,[["render",D0]]);const H0={name:"NewPostsBanner",components:{ArrowUp:ks},props:{context:{type:String,default:"global"},minScrollToShow:{type:Number,default:500}},setup(){return{feedStore:Ve()}},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}}},x0={class:"fcom_new_posts_text"};function j0(e,t,o,u,s,n){const m=g("ArrowUp"),f=N;return i(),v(ko,{name:"slide-down"},{default:r(()=>[s.show?(i(),c("div",{key:0,class:"fcom_new_posts_banner",onClick:t[0]||(t[0]=(...h)=>n.scrollToTop&&n.scrollToTop(...h))},[a(f,{class:"fcom_new_posts_icon"},{default:r(()=>[a(m)]),_:1}),l("span",x0,d(s.count===1?e.$t("1 new post available"):e.$t("{count} new posts available",{count:s.count})),1)])):_("",!0)]),_:1})}const O0=P(H0,[["render",j0],["__scopeId","data-v-e4ec71f4"]]),N0={name:"AllFeeds",components:{Feeds:mt,NewPostsBanner:O0},setup(){const e=Es(),t=qe();return{tickerStore:e,uiStore:t}},beforeRouteLeave(e,t,o){if(e.name==="single_feed"||e.name==="space_feed"){let s=0;window.fcomLayoutRef&&window.fcomLayoutRef.wrapRef&&(s=window.fcomLayoutRef.wrapRef.scrollTop),this.uiStore.saveScrollPosition(t.path,s)}else this.uiStore.clearScrollPosition();o()},mounted(){var e,t;if(this.changeTitle(this.$t("All Feeds")),(e=this.appVars.features)!=null&&e.enable_feed_ticker){const o=((t=this.appVars.features)==null?void 0:t.ticker_interval)||3e4;this.tickerStore.start(o)}},beforeUnmount(){var e;(e=this.appVars.features)!=null&&e.enable_feed_ticker&&this.tickerStore.stop()}},z0={key:0,class:"notices fcom_notice_wrap"},q0=["innerHTML"];function G0(e,t,o,u,s,n){var y;const m=g("WelcomeBanner"),f=g("NewPostsBanner"),h=g("feeds");return i(),c(L,null,[e.appVars.portal_notices&&e.appVars.portal_notices.length?(i(),c("div",z0,[(i(!0),c(L,null,D(e.appVars.portal_notices,w=>(i(),c("div",{innerHTML:w},null,8,q0))),256))])):_("",!0),e.appVars.welcome_banner?(i(),v(m,{key:1})):_("",!0),(y=e.appVars.features)!=null&&y.enable_feed_ticker?(i(),v(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 Y0=P(N0,[["render",G0]]),W0={name:"ViewFeed",components:{Feed:Xe},props:["feed_slug"],setup(){return{feedStore:Ve()}},data(){return{loading:!0,feed:null,notFound:!1}},watch:{feed_slug(){this.feed=null,this.$nextTick(()=>{this.getFeed()})}},methods:{getFeed(){this.feed=null,this.loading=!0,this.$get("feeds/"+this.feed_slug+"/by-slug").then(e=>{this.feed=e.feed,this.appVars.last_feed_id{this.checkCommentScroll()}),this.$eventBus.emit("feed_interaction",this.feed.id)}).catch(e=>{this.$handleError(e),typeof e=="object"&&e.xhr_status==404&&(this.notFound=!0)}).finally(()=>{this.loading=!1})},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);const o=(e=window.history.state)==null?void 0:e.back;o?this.$router.push(o):this.$router.push({name:"all_feeds"})}catch(t){this.$handleError(t)}},checkCommentScroll(){this.$route.query.comment_id?setTimeout(()=>{const e=document.getElementById("comment_"+this.$route.query.comment_id);e?(e.classList.add("fcom_highlight_comment"),e.style.scrollMarginTop="100px",e.scrollIntoView({behavior:"instant"})):this.$eventBus.emit("toTop",0)},100):this.$eventBus.emit("toTop",0)}},mounted(){window.__showing_feed&&window.__showing_feed.slug==this.feed_slug?(this.feed=window.__showing_feed,window.__showing_feed=null,this.$nextTick(()=>{this.changeFeedTitle(),this.checkCommentScroll()}),this.$eventBus.emit("feed_interaction",this.feed.id)):this.getFeed()}},Z0={key:0,class:"fcom_feed_report_wrap"},K0={class:"fcom_feed_report_content"},J0={key:1,class:"feed_outer"},Q0={key:3,class:"error-container"},X0={style:{padding:"20px",background:"var(--fcom-primary-bg)","border-radius":"8px"},class:"error-content"},e2={class:"error-title"},t2={class:"error-message"},s2={class:"error-explanation"},o2={style:{"list-style":"disc",margin:"20px"},class:"error-reasons"},i2={class:"error-actions"},n2=["href"];function l2(e,t,o,u,s,n){const m=g("Feed"),f=W;return i(),c("div",null,[s.feed&&s.feed.status=="unpublished"?(i(),c("div",Z0,[l("div",K0,[l("span",null,d(e.$t("This content has been unpublished by community moderation. Only the author and moderators can view it.")),1)])])):_("",!0),s.feed?(i(),c("div",J0,[a(m,{is_single:!0,is_route:!0,show_report:!0,feed:s.feed,onReload:n.getFeed,onRemoved:n.getFeed,onDeleted:n.handleDelete},null,8,["feed","onReload","onRemoved","onDeleted"])])):s.loading?(i(),v(f,{key:2,rows:5,animated:!0,class:"white_loaded"})):s.notFound?(i(),c("div",Q0,[l("div",X0,[l("h1",e2,d(e.$t("Post Not Found")),1),l("p",t2,d(e.$t("Sorry, the requested post could not be found.")),1),l("p",s2,d(e.$t("This may be due to one of the following reasons:")),1),l("ul",o2,[l("li",null,d(e.$t("You do not have permission to view this post")),1),l("li",null,d(e.$t("The post URL may be incorrect")),1),l("li",null,d(e.$t("The post has been deleted")),1)]),l("div",i2,[l("a",{href:e.$getRouteLink(""),class:"el-button fcom_primary_button"},d(e.$t("Back to home")),9,n2)])])])):_("",!0)])}const hs=P(W0,[["render",l2]]),a2={name:"SpaceHeader",emits:["refetch","doSearch"],components:{ImageUploader:je},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:{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})}},r2={key:0,class:"object_header space_header"},c2={key:0,style:{"text-align":"right"},class:"object_media_uploader"};function d2(e,t,o,u,s,n){const m=O,f=g("image-uploader"),h=Q("loading");return n.profile.cover_photo?G((i(),c("div",r2,[l("div",{style:re({backgroundImage:"url("+n.profile.cover_photo+")"}),class:"object_cover"},[n.isMod?(i(),c("div",c2,[a(f,{additionalData:{resize:!0,max_width:1500},onUploaded:n.handleCoverPhotoUpload},{default:r(()=>[a(m,{size:"small",plain:"",type:"primary"},{default:r(()=>[V(d(e.$t("Change Cover")),1)]),_:1})]),_:1},8,["onUploaded"]),a(m,{class:"fcom_mt_10",size:"small",plain:"",type:"danger",onClick:t[0]||(t[0]=Y(y=>n.updateSpace({cover_photo:""}),["prevent"]))},{default:r(()=>[V(d(e.$t("Remove")),1)]),_:1})])):_("",!0)],4)])),[[h,s.updating]]):_("",!0)}const u2=P(a2,[["render",d2]]),_2={name:"SpaceMenuItems",props:["space","profile"]},m2={"aria-label":"Space menu"},h2={class:"fcom_space_menu_ul"},f2=["innerHTML"],p2=["href","target","innerHTML"],g2={key:1};function y2(e,t,o,u,s,n){var f,h;const m=g("router-link");return i(),c("nav",m2,[l("ul",h2,[(h=(f=o.profile)==null?void 0:f.header_links)!=null&&h.length?(i(!0),c(L,{key:0},D(o.profile.header_links,y=>(i(),c("li",null,[y.route?(i(),v(m,{key:0,to:y.route},{default:r(()=>[l("span",{innerHTML:y.title},null,8,f2)]),_:2},1032,["to"])):(i(),c("a",{key:1,class:R(y.css_class??""),href:y.url,target:y.is_external?"_blank":"_self",innerHTML:y.title},null,10,p2))]))),256)):_("",!0),e.isMobile?(i(),c("li",g2,[a(m,{to:{name:"space_about"}},{default:r(()=>[V(d(e.$t("About")),1)]),_:1})])):_("",!0)])])}const v2=P(_2,[["render",y2]]),b2={name:"ImagePlaceholder"},k2={width:"240",height:"240",viewBox:"0 0 240 240",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function w2(e,t,o,u,s,n){return i(),c("svg",k2,[...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 Dt=P(b2,[["render",w2]]),C2={name:"LockscreenPaywallMeta",components:{ImagePlaceholder:Dt},props:{field:{type:Object,required:!0},space_id:{type:[String,Number],required:!0}},data(){return{loading:!1,editTab:"paywall",availablePaywalls:[]}},methods:{initAddPaywall(){this.field.paywalls=this.field.paywalls||[],this.field.paywalls.push("")},removePaywall(e){const t=this.field.paywalls||[];t.splice(t.indexOf(e),1),this.field.paywalls=t},isPaywallAdded(e){var t;return(t=this.field.paywalls)==null?void 0:t.includes(e.toString())},getAvailablePaywalls(){this.loading=!0,this.$get("cart/spaces/"+this.space_id+"/paywalls",{space_id:this.space_id}).then(e=>{this.availablePaywalls=e.paywalls}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.getAvailablePaywalls()}},$2={key:0,class:"fcom_paywalls"},S2={class:"fcom_paywall"},V2={class:"fcom_select_photo",style:{float:"left"}},L2=["src"],M2={key:0,class:"fcom_description"},F2={class:"fcom_paywall_actions"},T2={class:"fcom_color_input_wrap"},P2={class:"fcom_color_input_wrap"},I2={class:"fcom_color_input_wrap"},U2={class:"fcom_color_input_wrap"};function B2(e,t,o,u,s,n){const m=g("image-placeholder"),f=oe,h=vt,y=ie,w=g("Delete"),b=N,C=O,p=W,k=wt,S=X,$=de,I=_e,F=ue,B=kt,M=Ct;return i(),v(M,{modelValue:s.editTab,"onUpdate:modelValue":t[12]||(t[12]=E=>s.editTab=E)},{default:r(()=>[a(k,{label:e.$t("Paywalls"),name:"paywall"},{default:r(()=>[s.loading?(i(),v(p,{key:1,rows:2,animated:""})):(i(),c("div",$2,[(i(!0),c(L,null,D(o.field.paywalls,(E,A)=>(i(),c("div",S2,[a(y,{modelValue:o.field.paywalls[A],"onUpdate:modelValue":U=>o.field.paywalls[A]=U,placeholder:e.$t("Select Paywall")},{default:r(()=>[(i(!0),c(L,null,D(s.availablePaywalls,U=>(i(),v(h,{key:U.ID,label:U.post_title},{default:r(()=>[(i(!0),c(L,null,D(U.variants,T=>(i(),v(f,{key:T.id,value:T.id.toString(),label:T.variation_title,disabled:n.isPaywallAdded(T.id),class:"fcom_with_photo_option"},{default:r(()=>[l("span",V2,[T.photo?(i(),c("img",{key:0,src:T.photo},null,8,L2)):(i(),v(m,{key:1})),l("span",null,d(T.variation_title),1)])]),_:2},1032,["value","label","disabled"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"]),a(b,{onClick:U=>n.removePaywall(E)},{default:r(()=>[a(w)]),_:1},8,["onClick"])]))),256)),!o.field.paywalls||Object.keys(o.field.paywalls).length<1?(i(),c("div",M2,[l("p",null,d(e.$t("Please add paywall pricing options")),1)])):_("",!0),l("div",F2,[a(C,{style:{width:"100%"},class:"fcom_plain_button",onClick:n.initAddPaywall},{default:r(()=>[l("span",null,d("+ "+e.$t("Add Paywall")),1)]),_:1},8,["onClick"])])]))]),_:1},8,["label"]),a(k,{label:e.$t("Content"),name:"content"},{default:r(()=>[a(F,{onSubmit:t[2]||(t[2]=Y(E=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a($,{label:e.$t("Button Label")},{default:r(()=>[a(S,{modelValue:o.field.button_text,"onUpdate:modelValue":t[0]||(t[0]=E=>o.field.button_text=E),placeholder:e.$t("Button Label")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a($,null,{default:r(()=>[a(I,{modelValue:o.field.show_description,"onUpdate:modelValue":t[1]||(t[1]=E=>o.field.show_description=E),"true-value":"yes","false-value":"no"},{default:r(()=>[V(d(e.$t("Show Paywall Description")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["label"]),a(k,{label:e.$t("Design"),name:"design"},{default:r(()=>[a(F,{onSubmit:t[11]||(t[11]=Y(E=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a($,{label:e.$t("Background Color")},{default:r(()=>[l("div",T2,[a(B,{predefine:e.appVars.suggestedColors,modelValue:o.field.background_color,"onUpdate:modelValue":t[3]||(t[3]=E=>o.field.background_color=E)},null,8,["predefine","modelValue"]),a(S,{modelValue:o.field.background_color,"onUpdate:modelValue":t[4]||(t[4]=E=>o.field.background_color=E)},null,8,["modelValue"])])]),_:1},8,["label"]),a($,{label:e.$t("Text Color")},{default:r(()=>[l("div",P2,[a(B,{predefine:e.appVars.suggestedColors,modelValue:o.field.text_color,"onUpdate:modelValue":t[5]||(t[5]=E=>o.field.text_color=E)},null,8,["predefine","modelValue"]),a(S,{modelValue:o.field.text_color,"onUpdate:modelValue":t[6]||(t[6]=E=>o.field.text_color=E)},null,8,["modelValue"])])]),_:1},8,["label"]),a($,{label:e.$t("Button Label")},{default:r(()=>[l("div",I2,[a(B,{predefine:e.appVars.suggestedColors,modelValue:o.field.button_text_color,"onUpdate:modelValue":t[7]||(t[7]=E=>o.field.button_text_color=E)},null,8,["predefine","modelValue"]),a(S,{modelValue:o.field.button_text_color,"onUpdate:modelValue":t[8]||(t[8]=E=>o.field.button_text_color=E)},null,8,["modelValue"])])]),_:1},8,["label"]),a($,{label:e.$t("Button Background")},{default:r(()=>[l("div",U2,[a(B,{predefine:e.appVars.suggestedColors,modelValue:o.field.button_color,"onUpdate:modelValue":t[9]||(t[9]=E=>o.field.button_color=E),"show-alpha":""},null,8,["predefine","modelValue"]),a(S,{modelValue:o.field.button_color,"onUpdate:modelValue":t[10]||(t[10]=E=>o.field.button_color=E)},null,8,["modelValue"])])]),_:1},8,["label"])]),_:1})]),_:1},8,["label"])]),_:1},8,["modelValue"])}const E2=P(C2,[["render",B2]]),A2={name:"LockscreenMeta",components:{BgImageUpload:oo,LockscreenPaywallMeta:E2},props:["lockscreen","space_id"],emits:["editField","updatePaywalls"],data(){return{loading:!1,editing:!1,editTab:"content",editingField:null,availablePaywalls:[]}},computed:{lockscreenFields(){return this.lockscreen},getFieldIcon(){return e=>{const t={image:"Picture",block:"Tickets",lesson:"Memo",paywall:"Money"};return e.name=="action"?"Iphone":t[e.type]}}},methods:{toggleHidden(e){e.hidden=!e.hidden,e.type=="paywall"&&!e.hidden&&this.updateField(e)},updateField(e){this.editing=!0,this.editingField=e;const t=e.type=="block"?e:null;this.$emit("editField",t)},backToFields(){this.editing=!1,this.editingField=null,this.$emit("editField",null)},moveUp(e){if(e==0)return;const t=this.lockscreen[e],o=this.lockscreen[e-1];this.lockscreen.splice(e-1,2,t,o)},moveDown(e){if(e==this.lockscreen.length-1)return;const t=this.lockscreen[e],o=this.lockscreen[e+1];this.lockscreen.splice(e,2,o,t)}}},D2={key:0,class:"fcom_lockscreen_meta"},R2={class:"fcom_meta_section lockscreen_meta"},H2={class:"fcom_description"},x2={class:"fcom_meta_section lockscreen_meta"},j2={class:"fcom_meta_label"},O2={class:"fcom_meta_content"},N2={class:"fcom_meta_block"},z2={class:"fcom_block_label"},q2={class:"fcom_meta_sorting"},G2={class:"fcom_block_action"},Y2={key:1,class:"fcom_lockscreen_meta"},W2={class:"fcom_edit_title"},Z2={class:"fcom_edit_content"},K2={class:"fcom_color_input_wrap"},J2={class:"fcom_color_input_wrap"},Q2={class:"fcom_color_input_wrap"},X2={class:"fcom_color_input_wrap"},eb={class:"fcom_color_input_wrap"},tb={key:1,class:"fcom_description"},sb={key:2,class:"fcom_description"};function ob(e,t,o,u,s,n){const m=N,f=g("Top"),h=g("Bottom"),y=g("EditPen"),w=g("Hide"),b=g("View"),C=g("Back"),p=X,k=de,S=_e,$=ue,I=wt,F=g("BgImageUpload"),B=kt,M=Ct,E=g("lockscreen-paywall-meta");return s.editing?(i(),c("div",Y2,[l("div",W2,[a(m,{onClick:n.backToFields},{default:r(()=>[a(C)]),_:1},8,["onClick"]),l("p",null,d(e.$labelize(s.editingField.label)),1)]),l("div",Z2,[s.editingField.type=="image"?(i(),v(M,{key:0,modelValue:s.editTab,"onUpdate:modelValue":t[18]||(t[18]=A=>s.editTab=A)},{default:r(()=>[a(I,{label:e.$t("Content"),name:"content"},{default:r(()=>[a($,{onSubmit:t[5]||(t[5]=Y(A=>e.doNothing(),["prevent"])),model:s.editingField,"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a(k,{label:e.$t("Heading")},{default:r(()=>[a(p,{modelValue:s.editingField.heading,"onUpdate:modelValue":t[0]||(t[0]=A=>s.editingField.heading=A),placeholder:e.$t("Heading")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(k,{label:e.$t("Description")},{default:r(()=>[a(p,{modelValue:s.editingField.description,"onUpdate:modelValue":t[1]||(t[1]=A=>s.editingField.description=A),type:"textarea",placeholder:e.$t("Description")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(k,{label:e.$t("Button Label")},{default:r(()=>[a(p,{modelValue:s.editingField.button_text,"onUpdate:modelValue":t[2]||(t[2]=A=>s.editingField.button_text=A),placeholder:e.$t("Button Label")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(k,{label:e.$t("Button Link")},{default:r(()=>[a(p,{modelValue:s.editingField.button_link,"onUpdate:modelValue":t[3]||(t[3]=A=>s.editingField.button_link=A)},null,8,["modelValue"])]),_:1},8,["label"]),s.editingField.type=="image"?(i(),v(k,{key:0},{default:r(()=>[a(S,{modelValue:s.editingField.new_tab,"onUpdate:modelValue":t[4]||(t[4]=A=>s.editingField.new_tab=A),"true-value":"yes","false-value":"no"},{default:r(()=>[V(d(e.$t("Open in New Tab")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0)]),_:1},8,["model"])]),_:1},8,["label"]),a(I,{label:e.$t("Design"),name:"design"},{default:r(()=>[a($,{onSubmit:t[17]||(t[17]=Y(A=>e.doNothing(),["prevent"])),model:s.editingField,"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a(k,{label:e.$t("Background Image"),class:"fcom_bg_image"},{default:r(()=>[a(F,{modelValue:s.editingField.background_image,"onUpdate:modelValue":t[6]||(t[6]=A=>s.editingField.background_image=A),can_remove:!0},null,8,["modelValue"])]),_:1},8,["label"]),a(k,{label:e.$t("Overlay Color")},{default:r(()=>[l("div",K2,[a(B,{predefine:e.appVars.suggestedColors,modelValue:s.editingField.overlay_color,"onUpdate:modelValue":t[7]||(t[7]=A=>s.editingField.overlay_color=A)},null,8,["predefine","modelValue"]),a(p,{modelValue:s.editingField.overlay_color,"onUpdate:modelValue":t[8]||(t[8]=A=>s.editingField.overlay_color=A)},null,8,["modelValue"])])]),_:1},8,["label"]),a(k,{label:e.$t("Heading Color")},{default:r(()=>[l("div",J2,[a(B,{predefine:e.appVars.suggestedColors,modelValue:s.editingField.heading_color,"onUpdate:modelValue":t[9]||(t[9]=A=>s.editingField.heading_color=A)},null,8,["predefine","modelValue"]),a(p,{modelValue:s.editingField.heading_color,"onUpdate:modelValue":t[10]||(t[10]=A=>s.editingField.heading_color=A)},null,8,["modelValue"])])]),_:1},8,["label"]),a(k,{label:e.$t("Text Color")},{default:r(()=>[l("div",Q2,[a(B,{predefine:e.appVars.suggestedColors,modelValue:s.editingField.text_color,"onUpdate:modelValue":t[11]||(t[11]=A=>s.editingField.text_color=A)},null,8,["predefine","modelValue"]),a(p,{modelValue:s.editingField.text_color,"onUpdate:modelValue":t[12]||(t[12]=A=>s.editingField.text_color=A)},null,8,["modelValue"])])]),_:1},8,["label"]),a(k,{label:e.$t("Button Label")},{default:r(()=>[l("div",X2,[a(B,{predefine:e.appVars.suggestedColors,modelValue:s.editingField.button_text_color,"onUpdate:modelValue":t[13]||(t[13]=A=>s.editingField.button_text_color=A)},null,8,["predefine","modelValue"]),a(p,{modelValue:s.editingField.button_text_color,"onUpdate:modelValue":t[14]||(t[14]=A=>s.editingField.button_text_color=A)},null,8,["modelValue"])])]),_:1},8,["label"]),a(k,{label:e.$t("Button Background")},{default:r(()=>[l("div",eb,[a(B,{predefine:e.appVars.suggestedColors,modelValue:s.editingField.button_color,"onUpdate:modelValue":t[15]||(t[15]=A=>s.editingField.button_color=A),"show-alpha":""},null,8,["predefine","modelValue"]),a(p,{modelValue:s.editingField.button_color,"onUpdate:modelValue":t[16]||(t[16]=A=>s.editingField.button_color=A)},null,8,["modelValue"])])]),_:1},8,["label"])]),_:1},8,["model"])]),_:1},8,["label"])]),_:1},8,["modelValue"])):s.editingField.type=="block"?(i(),c("div",tb,d(e.$t("Edit the field from block editor ")),1)):s.editingField.type=="lesson"?(i(),c("div",sb,d(e.$t("Edit lessons from lesson editor ")),1)):s.editingField.type=="paywall"?(i(),v(E,{key:3,field:s.editingField,space_id:o.space_id},null,8,["field","space_id"])):_("",!0)])])):(i(),c("div",D2,[l("div",R2,[l("div",H2,[l("p",null,d(e.$t("This page is only visible to non-members viewing a private space.")),1)])]),l("div",x2,[l("div",j2,d(e.$t("Page Blocks")),1),l("div",O2,[l("ul",N2,[(i(!0),c(L,null,D(n.lockscreenFields,(A,U)=>(i(),c("li",{class:R(["fcom_block_list",{block_hidden:A.hidden}])},[l("div",z2,[a(m,{class:"fcom_el_icon"},{default:r(()=>[(i(),v(zt(n.getFieldIcon(A))))]),_:2},1024),l("p",null,d(e.$labelize(A.label)),1)]),l("div",q2,[a(m,{onClick:T=>n.moveUp(U)},{default:r(()=>[a(f)]),_:1},8,["onClick"]),a(m,{onClick:T=>n.moveDown(U)},{default:r(()=>[a(h)]),_:1},8,["onClick"])]),l("div",G2,[a(m,{onClick:T=>n.updateField(A)},{default:r(()=>[a(y)]),_:1},8,["onClick"]),A.hidden?(i(),v(m,{key:0,onClick:T=>n.toggleHidden(A)},{default:r(()=>[a(w)]),_:1},8,["onClick"])):(i(),v(m,{key:1,onClick:T=>n.toggleHidden(A)},{default:r(()=>[a(b)]),_:1},8,["onClick"]))])],2))),256))])])])]))}const ib=P(A2,[["render",ob]]),nb={name:"BlockEditor",emits:["update:modelValue"],props:{modelValue:{type:String,required:!1}},data(){return{loading:!0,has_error:!1,all_loaded:!1,html:this.modelValue}},methods:{attach(){const e=this.$refs.block_editor;this.loading=!1,this.all_loaded=!0,window.wp.attachEditor(e,{iso:{toolbar:{undo:!0,navigation:!0,documentInspector:null},blocks:{allowBlocks:["core/button","core/buttons","core/code","core/column","core/columns","core/embed","core/group","core/heading","core/image","core/list","core/list-item","core/missing","core/paragraph","core/preformatted","core/pullquote","core/quote","core/separator","core/spacer","core/table","core/verse","core/html"]},__experimentalOnChange:function(t){console.log(t)},sidebar:{inserter:!1,inspector:!0}},editor:{__experimentalOnChange:function(t){console.log(t)},__experimentalOnInput(t){console.log(t)},__experimentalOnSelection(t){console.log(t)},onSaveContent:function(t){console.log(t)}}}),e.addEventListener("change",t=>{this.html=t.target.value,this.$emit("update:modelValue",t.target.value)})},loadScript(e){return new Promise((t,o)=>{const u=document.createElement("script");u.src=e,u.onload=t,u.onerror=o,document.head.append(u)})},async loadScripts(){const e=this.appVars.block_editor_assets.scripts;for(const t in e)try{await this.loadScript(e[t]),console.log(`${t} JS loaded`)}catch(o){this.has_error=!0,console.error(`Failed to load js ${t}:`,o)}this.attach()},loadCSSFile(e){return new Promise((t,o)=>{const u=document.createElement("link");u.rel="stylesheet",u.href=e,u.onload=t,u.onerror=o,document.head.append(u)})},async loadCSSFiles(){const t=this.appVars.block_editor_assets.styles.map(this.loadCSSFile);try{await Promise.all(t),console.log("All CSS files loaded")}catch(o){console.error("Failed to load some CSS files:",o)}}},mounted(){window.fl_block_editor_loaded?this.attach():(this.loadCSSFiles(),this.loadScripts(),window.fl_block_editor_loaded=!0)},beforeUnmount(){window.wp.detachEditor(this.$refs.block_editor)}},lb={class:"fcom_block_editor"};function ab(e,t,o,u,s,n){const m=W;return i(),c("div",lb,[G(l("div",null,[l("textarea",{ref:"block_editor",id:"fcom_block_editor",name:"block_editor"}," "+d(s.html)+` `,513)],512),[[ys,s.all_loaded]]),s.all_loaded?_("",!0):(i(),v(m,{key:0,class:"white_loaded",rows:7,animated:!0}))])}const rb=P(nb,[["render",ab]]);const cb={name:"FullEditorFrame",emits:["update:modelValue","titleUpdated","featuredMediaUpdated","metaUpdated","manageDocuments","useAlternateEditor"],props:{editorPath:{type:String,default:"/editor"},modelValue:{type:String,default:""},editorParams:{type:Object,default:()=>({})},frameHeight:{type:String,default:"500px"},documentTitle:{type:String,default:""},featured_image_id:{type:[String,Number],default:""},metaSettings:{type:Object,default:()=>null}},data(){return{editorData:{content:""},editorFrame:null,editorOrigin:null,lastUpdate:"No updates yet",dataSent:!1,isFailing:!1}},computed:{notLoading(){return!this.dataSent&&this.isFailing}},mounted(){setTimeout(()=>{this.isFailing=!0},1e4),this.editorData.content=this.modelValue,this.editorData.title=this.documentTitle,this.editorData.featured_image_id=this.featured_image_id,this.metaSettings&&(this.editorData.metaSettings=this.metaSettings),this.createEditorIframe(),window.addEventListener("message",this.handleEditorMessage)},beforeUnmount(){window.removeEventListener("message",this.handleEditorMessage),this.editorFrame&&(this.editorFrame.onload=null,this.$refs.iframeContainer.removeChild(this.editorFrame),this.editorFrame=null)},methods:{createEditorIframe(){const e=new URL(this.editorPath,window.location.origin);this.editorOrigin=e.origin,this.editorFrame=document.createElement("iframe");let t=this.appVars.wp_lesson_editor_frame;if(this.editorParams){const o=new URLSearchParams(this.editorParams);t+="&"+o.toString()}this.editorFrame.src=t,this.editorFrame.style.width="100%",this.editorFrame.style.height=this.frameHeight,this.$refs.iframeContainer.appendChild(this.editorFrame)},editorFailed(){this.$emit("useAlternateEditor")},sendDataToEditor(){if(this.editorFrame&&this.editorFrame.contentWindow){const e=JSON.parse(JSON.stringify(this.editorData));this.editorFrame.contentWindow.postMessage({type:"UPDATE_EDITOR",data:e},"*"),this.dataSent=!0}else alert("Editor frame is not loaded or contentWindow is not accessible.")},syncMetaToEditor(e){this.editorFrame&&this.editorFrame.contentWindow&&this.editorFrame.contentWindow.postMessage({type:"SYNC_META",data:JSON.parse(JSON.stringify(e))},"*")},handleEditorMessage(e){const{action:t,content:o}=e.data;t==="EDITOR_UPDATED"?this.dataSent&&(this.editorData.content=o,this.$emit("update:modelValue",o)):t==="TITLE_UPDATED"?(this.editorData.title=o,this.$emit("titleUpdated",o)):t==="FEATURED_MEDIA_UPDATED"?this.$emit("featuredMediaUpdated",o):t==="META_UPDATED"?this.$emit("metaUpdated",o):t==="MANAGE_DOCUMENTS"?this.$emit("manageDocuments"):t==="EDITOR_READY"&&(console.log("EDITOR_READY"),this.sendDataToEditor())}}},db={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},ub=["element-loading-text"],_b={ref:"iframeContainer",class:"iframe-container"};function mb(e,t,o,u,s,n){const m=O,f=W,h=Q("loading");return i(),c(L,null,[n.notLoading?(i(),c("div",db,[t[2]||(t[2]=l("p",null,"Problem with loading the editor?",-1)),a(m,{onClick:t[0]||(t[0]=y=>n.editorFailed())},{default:r(()=>[...t[1]||(t[1]=[V("Use Alternative Editor",-1)])]),_:1})])):_("",!0),G((i(),c("div",{"element-loading-text":e.$t("Loading editor. Please wait...."),class:"editor-container"},[s.dataSent?_("",!0):(i(),v(f,{key:0,style:{margin:"50px"},animated:!0,rows:2})),l("div",_b,null,512)],8,ub)),[[h,!s.dataSent]])],64)}const hb=P(cb,[["render",mb],["__scopeId","data-v-03a63740"]]),fb={name:"CircleIcon",props:{fill:{type:String,default:"currentColor"}}},pb=["fill"];function gb(e,t,o,u,s,n){return i(),c("svg",{fill:o.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,pb)}const as=P(fb,[["render",gb]]),yb={name:"LessonIcon"},vb={width:"60",height:"48",viewBox:"0 0 60 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function bb(e,t,o,u,s,n){return i(),c("svg",vb,[...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 no=P(yb,[["render",bb]]),kb={name:"PlayIcon"},wb={width:"20",height:"19",viewBox:"0 0 20 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Cb(e,t,o,u,s,n){return i(),c("svg",wb,[...t[0]||(t[0]=[Te('',2)])])}const lo=P(kb,[["render",Cb]]),$b={name:"PlayPlaceholderIcon"},Sb={width:"60",height:"48",viewBox:"0 0 60 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Vb(e,t,o,u,s,n){return i(),c("svg",Sb,[...t[0]||(t[0]=[Te('',3)])])}const ao=P($b,[["render",Vb]]),Lb={name:"_LockscreenLessonEditor",components:{CircleIcon:as,LessonIcon:no,PlayIcon:lo,PlayPlaceholderIcon:ao},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((o,u)=>o+(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 o;const t=(o=e.meta)==null?void 0:o.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,o;return this.isEnabledMedia(e)&&((o=(t=e.meta)==null?void 0:t.media)==null?void 0:o.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),o=Math.floor(e%3600/60),u=e%60,s="";return t>0&&(s+=`${t}h `),o>0&&(s+=`${o}m `),u>0&&(s+=`${u}s`),s.trim()||null}}},Mb={class:"fcom_course_sections"},Fb={class:"fcom_course_intro"},Tb={class:"fcom_course_labels"},Pb={class:"fcom_course_info"},Ib={class:"fcom_card_sections"},Ub={class:"fcom_section_items"},Bb=["onClick"],Eb={class:"fcom_section_primary_item_title"},Ab={class:"title_line_container"},Db={class:"title_line"},Rb={class:"fcom_meta_text"},Hb={key:0,class:"fcom_meta_text"},xb={class:"fcom_section_primary_item_actions"},jb=["onClick"],Ob={class:"fcom_heading_item clickable"},Nb={class:"lesson_feature_media"},zb=["src","alt"],qb=["src","alt"],Gb={class:"lesson_title"},Yb=["innerHTML"],Wb={class:"lesson_duration"},Zb={key:0},Kb={key:1},Jb=["innerHTML"];function Qb(e,t,o,u,s,n){const m=g("ArrowRight"),f=g("ArrowDown"),h=N,y=g("CircleIcon"),w=g("Lock"),b=g("PlayPlaceholderIcon"),C=g("LessonIcon"),p=g("PlayIcon");return i(),c("div",Mb,[l("div",Fb,[l("div",Tb,[l("h3",null,d(e.$t("Course Content")),1),l("p",Pb,[V(d(e.$_n("%s Topic","%s Topics",n.sectionsCount))+" ",1),t[0]||(t[0]=l("span",null," โ€ข ",-1)),V(" "+d(e.$_n("%s Lesson","%s Lessons",n.lessonsCount)),1)])])]),l("div",Ib,[l("div",Ub,[(i(!0),c(L,null,D(o.sections,k=>(i(),c("div",{key:k.id,class:"fcom_section_primary"},[k.lessons.length?(i(),c("div",{key:0,onClick:S=>k.is_closed=!k.is_closed,class:R(["clickable fcom_section_primary_item",{is_closed:k.is_closed}])},[l("div",Eb,[l("div",Ab,[l("div",Db,[l("h4",null,d(k.title),1)]),l("span",Rb,d(e.$t("%d lessons",k.lessons.length)),1),n.lessonDuration(k)?(i(),c("span",Hb," โ€ข "+d(n.lessonDuration(k)),1)):_("",!0)])]),l("div",xb,[a(h,{class:"clickable"},{default:r(()=>[k.is_closed?(i(),v(m,{key:0,class:"fcom_arrow_icon"})):(i(),v(f,{key:1}))]),_:2},1024)])],10,Bb)):_("",!0),k.is_closed?_("",!0):(i(!0),c(L,{key:1},D(k.lessons,S=>(i(),c("div",{key:S.id,class:R(["fcom_section_item",{is_locked:!n.isFreePreview(S)}])},[l("div",{onClick:$=>n.maybeGotoLesson(S,k),class:"fcom_section_item_title"},[l("p",Ob,[a(h,null,{default:r(()=>[n.isFreePreview(S)?(i(),v(y,{key:0})):(i(),v(w,{key:1}))]),_:2},1024),n.isModernLayout?(i(),c(L,{key:0},[l("span",Nb,[S.featured_image?(i(),c("img",{key:0,src:S.featured_image,alt:S.title},null,8,zb)):n.hasMediaImage(S)?(i(),c("img",{key:1,src:S.meta.media.image,alt:S.title},null,8,qb)):n.hasMediaVideo(S)?(i(),v(b,{key:2})):(i(),v(C,{key:3})),n.showPlayIcon(S)?(i(),v(p,{key:4,class:"play_icon"})):_("",!0)]),l("span",Gb,[l("span",{innerHTML:S.title},null,8,Yb),l("span",Wb,[S.meta.video_length?(i(),c("span",Zb,d(n.formatSeconds(S.meta.video_length)),1)):(i(),c("span",Kb,d("---")))])])],64)):(i(),c("span",{key:1,innerHTML:S.title},null,8,Jb))])],8,jb)],2))),128))]))),128))])])])}const ro=P(Lb,[["render",Qb]]),Xb={name:"LockscreenPaywallView",components:{ImagePlaceholder:Dt},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 o=t.variants.find(u=>String(u.id)===String(e));if(o)return{...o,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()}},ek={class:"fcom_paywall_cards"},tk={class:"paywall_header"},sk={class:"paywall_body"},ok=["innerHTML"],ik={key:0,class:"subscription"},nk={class:"paywall_footer"},lk={key:0,class:"fcom_mb_10"},ak=["href"];function rk(e,t,o,u,s,n){const m=W,f=Yt,h=g("ImagePlaceholder");return i(),c("div",ek,[s.loading?(i(),v(m,{key:0,rows:3,animated:!0})):(i(!0),c(L,{key:1},D(n.filteredPaywalls,y=>(i(),c("div",{key:y.id,class:"fcom_paywall",style:re(n.cardStyles)},[l("div",tk,[y.photo?(i(),v(f,{key:0,src:y.photo},null,8,["src"])):(i(),v(f,{key:1},{default:r(()=>[a(h)]),_:1})),l("span",null,d(y.variation_title),1)]),l("div",sk,[l("span",{innerHTML:y.total_price},null,8,ok),n.isSubscriptionPaywall(y)?(i(),c("span",ik,"ย / "+d(n.getRepeatInterval(y)),1)):_("",!0)]),l("div",nk,[o.field.show_description=="yes"&&(y!=null&&y.description)?(i(),c("span",lk,d(y.description),1)):_("",!0),o.editable?G((i(),c("input",{key:1,class:"el-button fcom_primary_button link_button",style:re(n.buttonStyles),type:"text","onUpdate:modelValue":t[0]||(t[0]=w=>o.field.button_text=w)},null,4)),[[wo,o.field.button_text]]):(i(),c("a",{key:2,class:"el-button fcom_primary_button link_button",style:re(n.buttonStyles),href:y.checkout_url},d(o.field.button_text),13,ak))])],4))),128))])}const co=P(Xb,[["render",rk]]),ck={name:"LockScreenEditor",props:["title","lockscreen","sections","saving","loading","space_id","settings"],emits:["save","close"],components:{LockscreenLessonEditor:ro,MediaEmbeder:es,BlockEditor:rb,LockscreenMeta:ib,LockscreenPaywallView:co,FullEditorFrame:hb},data(){return{editingField:null,useClassic:!1}},computed:{lockscreenFields(){return this.lockscreen.filter(e=>!e.hidden)},imageStyles(){return e=>({backgroundImage:`url(${e.background_image})`,backgroundColor:e.overlay_color})},headingStyles(){return e=>({color:e.heading_color})},descriptionStyles(){return e=>({color:e.text_color})},buttonStyles(){return e=>({backgroundColor:e.button_color,color:e.button_text_color})}},methods:{updateHeading(e,t){t.heading=e.target.innerText},updateDescription(e,t){t.description=e.target.innerText},updateButtonLabel(e,t){t.button_text=e.target.innerText},visibleBlock(e){this.editingField=e},updateEditField(e){this.editingField=e,(e==null?void 0:e.type)==="block"&&setTimeout(()=>{const t=document.getElementById("fcomBlockContent");t&&t.scrollIntoView({behavior:"smooth"})},300)},saveChanges(){this.editingField=null,this.$emit("save")},switchToClassic(){this.useClassic=!0}}},dk={class:"fcom_editor_topbar"},uk={class:"fcom_editor_content"},_k={class:"fcom_item"},mk={class:"fcom_content"},hk=["onBlur"],fk=["onBlur"],pk=["onBlur"],gk={key:1,class:"fcom_content_wrap"},yk={id:"fcomBlockContent"},vk={key:2,class:"fcom_content_wrap"},bk={key:3,class:"fcom_paywall_wrap"};function kk(e,t,o,u,s,n){const m=g("lockscreen-meta"),f=We,h=g("Lock"),y=N,w=g("block-editor"),b=g("FullEditorFrame"),C=g("lockscreen-lesson-editor"),p=W,k=g("lockscreen-paywall-view"),S=ge,$=Le;return i(),c(L,null,[a(f,{class:"fcom_full_editor_side lockscreen_editor",width:"250px"},{default:r(()=>[q(e.$slots,"before_meta"),a(m,{lockscreen:o.lockscreen,space_id:o.space_id,onEditField:n.updateEditField},null,8,["lockscreen","space_id","onEditField"])]),_:3}),a($,{class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(S,null,{default:r(()=>[l("div",dk,[a(y,null,{default:r(()=>[a(h)]),_:1}),l("h3",null,d(o.title),1)]),l("div",uk,[(i(!0),c(L,null,D(n.lockscreenFields,I=>{var F;return i(),c("div",_k,[I.type=="image"?(i(),c("div",{key:0,class:"fcom_image_wrap",style:re(n.imageStyles(I))},[l("div",mk,[l("h2",{style:re(n.headingStyles(I)),contenteditable:"true",onBlur:B=>n.updateHeading(B,I)},d(I.heading),45,hk),I.description?(i(),c("p",{key:0,style:re(n.descriptionStyles(I)),contenteditable:"true",onBlur:B=>n.updateDescription(B,I)},d(I.description),45,fk)):_("",!0),I.button_text?(i(),c("button",{key:1,class:"fcom_btn",style:re(n.buttonStyles(I)),contenteditable:"true",onBlur:B=>n.updateButtonLabel(B,I)},d(I.button_text),45,pk)):_("",!0)])],4)):_("",!0),I.type=="block"?(i(),c("div",gk,[l("div",yk,[s.useClassic?(i(),v(w,{key:0,modelValue:I.content,"onUpdate:modelValue":B=>I.content=B},null,8,["modelValue","onUpdate:modelValue"])):(i(),v(b,{key:1,ref_for:!0,ref:"fullEditorFrame",onUseAlternateEditor:n.switchToClassic,editorParams:{context:"lockscreen",space_id:o.space_id},frameHeight:"calc(100vh - 160px)",documentTitle:"",modelValue:I.content,"onUpdate:modelValue":B=>I.content=B},null,8,["onUseAlternateEditor","editorParams","modelValue","onUpdate:modelValue"]))])])):_("",!0),I.type=="lesson"?(i(),c("div",vk,[o.loading?(i(),v(p,{key:1,rows:5,animated:!0})):(i(),v(C,{key:0,sections:o.sections,is_editor:!0,settings:o.settings},null,8,["sections","settings"]))])):_("",!0),I.type=="paywall"&&((F=I.paywalls)==null?void 0:F.length)>0?(i(),c("div",bk,[a(k,{space_id:o.space_id,field:I,editable:!0},null,8,["space_id","field"])])):_("",!0)])}),256))])]),_:1})]),_:1})],64)}const wk=P(ck,[["render",kk]]),Ck={name:"SpaceLockscreen",props:["spaceProfile","savingCount"],emits:["close"],components:{LockScreenEditor:wk},data(){return{saving:!1,loading:!1,lockscreen:null}},watch:{savingCount(){this.saveChanges()}},methods:{saveChanges(){this.lockscreen&&(this.saving=!0,this.$put("spaces/"+this.spaceProfile.slug+"/lockscreens",{lockscreen:this.lockscreen}).then(e=>{this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1}))},getLockscreen(){this.loading=!0,this.$get("spaces/"+this.spaceProfile.slug+"/lockscreens").then(e=>{this.lockscreen=e.lockscreen}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.getLockscreen()}},$k={key:0,class:"fcom_lockscreen_meta"},Sk={class:"fcom_description"},Vk={class:"white_loaded"};function Lk(e,t,o,u,s,n){const m=g("lock-screen-editor"),f=W,h=Le;return s.lockscreen?(i(),v(m,{key:0,title:o.spaceProfile.title,space_id:o.spaceProfile.id,settings:o.spaceProfile.settings,lockscreen:s.lockscreen,saving:s.saving,loading:s.loading,onSave:n.saveChanges,onClose:t[0]||(t[0]=y=>e.$emit("close"))},{before_meta:r(()=>[o.spaceProfile.settings.custom_lock_screen!="yes"?(i(),c("div",$k,[l("div",Sk,[l("p",null,d(e.$t("__LOCK_SCRREN_DESC")),1)])])):_("",!0)]),_:1},8,["title","space_id","settings","lockscreen","saving","loading","onSave"])):s.loading?(i(),v(h,{key:1,class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[l("div",Vk,[a(f,{animated:!0,rows:10})])]),_:1})):_("",!0)}const Mk=P(Ck,[["render",Lk]]),Fk={name:"ManageSpaceLinks",components:{MenuGroupSettings:io},props:["spaceProfile","savingCount"],emits:["close"],data(){return{saving:!1}},watch:{savingCount(){this.saveMenuItems(!0)}},methods:{saveMenuItems(e=!1){this.saving=!0;let t="spaces/"+this.spaceProfile.slug+"/links";this.spaceProfile.type=="course"&&(t="admin/courses/"+this.spaceProfile.id+"/links"),this.$post(t,{links:this.spaceProfile.settings.links,space_id:this.spaceProfile.id}).then(o=>{this.$notify.success(o.message),this.spaceProfile.settings.links=o.links,e&&this.$emit("close")}).catch(o=>{this.$handleError(o)}).finally(()=>{this.saving=!1})}}},Tk={style:{"max-width":"800px",padding:"20px",margin:"0 auto"}},Pk={class:"fcom_card_sections"};function Ik(e,t,o,u,s,n){const m=g("menu-group-settings"),f=ge,h=Le;return i(),v(h,{class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(f,null,{default:r(()=>[l("div",Tk,[l("div",Pk,[a(m,{custom_svg:!0,use_icon_selector:!0,has_svg:!1,onSave:t[0]||(t[0]=y=>n.saveMenuItems()),title:e.$t("Manage Links"),menuItems:o.spaceProfile.settings.links},null,8,["title","menuItems"])])])]),_:1})]),_:1})}const Uk=P(Fk,[["render",Ik]]),Bk={name:"AddPaywallModal",props:{modelValue:{type:Boolean,default:!1},spaceProfile:{type:Object,required:!0}},emits:["update:modelValue","added"],data(){return{products:[],productID:null,saving:!1,creatingProduct:!1,fetchingProducts:!1,newPaywall:{title:"",price:0}}},computed:{addPaywallModal:{get(){return this.modelValue},set(e){this.$emit("update:modelValue",e)}}},methods:{isProductAdded(e){var t,o;return(o=(t=this.spaceProfile.settings)==null?void 0:t.cart_product_ids)==null?void 0:o.includes(e)},initCreateProduct(){this.productID=null,this.newPaywall={title:"",price:0}},createProduct(){var e,t;this.creatingProduct=!0,this.$post("cart/products/create",{title:(e=this.newPaywall)==null?void 0:e.title,price:(t=this.newPaywall)==null?void 0:t.price}).then(o=>{var u;this.products.push(o.product),this.productID=(u=o.product)==null?void 0:u.id,this.productID&&this.addPaywall()}).catch(o=>{this.$handleError(o)}).finally(()=>{this.creatingProduct=!1})},searchProducts(e=""){e&&e.length<3||this.fetchProducts(e)},fetchProducts(e=""){this.fetchingProducts=!0,this.$get("cart/products/search",{search:e}).then(t=>{this.products=t.products}).catch(t=>{this.$handleError(t)}).finally(()=>{this.fetchingProducts=!1})},addPaywall(){this.saving=!0,this.$post("cart/spaces/"+this.spaceProfile.id+"/paywalls",{cart_product_id:this.productID,space_id:this.spaceProfile.id}).then(e=>{var t;this.$notify.success(e.message),this.$emit("added",(t=e.paywall)==null?void 0:t.ID),this.addPaywallModal=!1}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},mounted(){this.fetchProducts()}},Ek={class:"fcom_topic_selector"},Ak={class:"fcom_select_photo",style:{float:"left"}},Dk=["src","alt"],Rk=["innerHTML"];function Hk(e,t,o,u,s,n){const m=oe,f=ie,h=g("Plus"),y=N,w=O,b=X,C=de,p=ue,k=fe,S=bt,$=Q("loading");return i(),v(S,{"modal-class":"fcom_common_dialog",class:"fcom_high_drawer",size:e.drawerWidth,modelValue:n.addPaywallModal,"onUpdate:modelValue":t[6]||(t[6]=I=>n.addPaywallModal=I),"close-on-click-modal":!1,visible:n.addPaywallModal,direction:"rtl"},{header:r(()=>[l("h4",null,d(e.$t("Add Paywall")),1)]),default:r(()=>[a(p,{onSubmit:t[5]||(t[5]=Y(I=>e.doNothing(),["prevent"])),"label-position":"top"},{default:r(()=>[a(C,null,{default:r(()=>[l("div",Ek,[G((i(),v(f,{style:{width:"100%"},modelValue:s.productID,"onUpdate:modelValue":t[0]||(t[0]=I=>s.productID=I),filterable:"",clearable:"",remote:"",loading:s.fetchingProducts,"remote-method":n.searchProducts,placeholder:e.$t("Search Product")},{default:r(()=>[(i(!0),c(L,null,D(s.products,I=>(i(),v(m,{key:I.id,label:I.title,value:I.id,disabled:n.isProductAdded(I.id),class:"fcom_with_photo_option"},{default:r(()=>[l("span",Ak,[l("img",{src:I.image,alt:I.title},null,8,Dk),l("span",null,d(I.title),1)]),l("span",{style:{float:"right",color:"#8492a6","font-size":"13px"},innerHTML:I.price},null,8,Rk)]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","loading","remote-method","placeholder"])),[[$,s.fetchingProducts]]),a(k,{ref:"creating_product_ref",onShow:n.initCreateProduct,placement:"bottom",width:400,trigger:"click"},{reference:r(()=>[a(w,{class:"fcom_secondary_button"},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1}),l("span",null,d(e.$t("New")),1)]),_:1})]),default:r(()=>[a(p,{modelValue:s.newPaywall,"onUpdate:modelValue":t[4]||(t[4]=I=>s.newPaywall=I),"label-position":"top"},{default:r(()=>[a(C,{label:e.$t("Title")},{default:r(()=>[a(b,{modelValue:s.newPaywall.title,"onUpdate:modelValue":t[1]||(t[1]=I=>s.newPaywall.title=I),placeholder:e.$t("Title of the product")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(C,{label:e.$t("Price")},{default:r(()=>[a(b,{modelValue:s.newPaywall.price,"onUpdate:modelValue":t[2]||(t[2]=I=>s.newPaywall.price=I),type:"number",placeholder:e.$t("Price of the product"),min:0},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(C,null,{default:r(()=>[a(w,{class:"fcom_primary_button",onClick:t[3]||(t[3]=I=>n.createProduct()),loading:s.creatingProduct,disabled:s.creatingProduct},{default:r(()=>[V(d(e.$t("Create")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["onShow"])])]),_:1}),a(C,null,{default:r(()=>[a(w,{class:"fcom_primary_button",loading:s.saving,onClick:n.addPaywall},{default:r(()=>[V(d(e.$t("Add")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["size","modelValue","visible"])}const xk=P(Bk,[["render",Hk]]),jk={name:"ManagePaywalls",components:{ImagePlaceholder:Dt,AddPaywallModal:xk},props:["spaceProfile","savingCount"],emits:["close"],data(){return{paywalls:[],loading:!1,removing:!1,addPaywallModal:!1,removePaywallModal:!1,revokeAccess:!1,removePaywall:null,installing:!1,hasFluentCart:this.hasFeature("has_fluentcart")}},computed:{spaceType(){return this.spaceProfile.type=="course"?this.$t("courses"):this.$t("spaces")}},methods:{copyCheckoutUrl(e){this.$toClipboard(e,this.$t("Checkout URL copied to clipboard"))},initRemovePaywall(e){this.$nextTick(()=>{this.removePaywallModal=!0,this.removePaywall=e})},initAddPaywall(){this.$nextTick(()=>{this.addPaywallModal=!0})},resetPaywall(){var t;const e=((t=this.spaceProfile.settings)==null?void 0:t.cart_product_ids)||[];e.splice(e.indexOf(this.removePaywall.ID),1),this.spaceProfile.settings.cart_product_ids=e,this.removePaywall=null,this.revokeAccess=!1,this.getPaywalls()},paywallAdded(e){var o;const t=((o=this.spaceProfile.settings)==null?void 0:o.cart_product_ids)||[];t.includes(e)||t.push(e),this.spaceProfile.settings.cart_product_ids=t,this.getPaywalls()},getPaywalls(){this.loading=!0,this.$get("cart/spaces/"+this.spaceProfile.id+"/paywalls",{space_id:this.spaceProfile.id}).then(e=>{this.paywalls=e.paywalls}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},deletePaywall(){this.removing=!0,this.$del("cart/spaces/"+this.spaceProfile.id+"/paywalls",{cart_product_id:this.removePaywall.ID,revoke_access:this.revokeAccess}).then(e=>{this.$notify.success(e.message),this.removePaywallModal=!1,this.resetPaywall()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.removing=!1})},installPlugin(){this.installing=!0,this.$post("settings/install_plugin",{plugin:"fluent-cart"}).then(e=>{e.is_installed?this.$notify.success(e.message):this.$handleError(this.$t("Sorry, FluentCart could not be installed")),this.hasFluentCart=!0,this.getPaywalls()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.installing=!1})}},mounted(){var t;(((t=this.spaceProfile.settings)==null?void 0:t.cart_product_ids)||[])&&this.hasFluentCart&&this.getPaywalls()}},Ok={style:{"max-width":"800px",padding:"20px",margin:"0 auto"}},Nk={class:"fcom_card_sections"},zk={class:"fcom_card_section_heading"},qk={class:"fcom_section_primary_item_title"},Gk={class:"fcom_heading_item"},Yk={key:0,class:"fcom_section_item_actions"},Wk={class:"fcom_section_primary"},Zk={class:"fcom_section_primary_item"},Kk={class:"fcom_section_primary_item_title"},Jk={class:"fcom_heading_item"},Qk={class:"fcom_shape"},Xk={class:"fcom_section_item_actions"},ew=["href"],tw=["href"],sw={class:"fcom_section_items"},ow={class:"fcom_section_item_title"},iw={class:"fcom_heading_item"},nw={class:"fcom_shape"},lw={class:"fcom_section_item_actions"},aw=["innerHTML"],rw={key:2,style:{padding:"1rem"}},cw={key:1,class:"fcom_section_item"},dw={class:"fcom_section_primary"},uw={class:"fcom_section_primary_item"},_w=["disabled"],mw={class:"dialog_header"},hw={class:"dialog_left"},fw={class:"dialog_body"},pw={style:{"text-align":"center"}},gw={class:"fcom_heading_item",style:{"justify-content":"center"}},yw={class:"fcom_shape"},vw={style:{margin:"1rem 0px 0.8rem"}},bw={class:"dialog_footer"};function kw(e,t,o,u,s,n){const m=O,f=W,h=Yt,y=g("MoreFilled"),w=N,b=ct,C=dt,p=ut,k=g("ImagePlaceholder"),S=ge,$=Le,I=g("AddPaywallModal"),F=_e,B=Ce,M=Q("loading");return i(),c(L,null,[a($,{class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(S,null,{default:r(()=>[l("div",Ok,[l("div",Nk,[l("div",zk,[l("div",qk,[l("div",Gk,[q(e.$slots,"title",{},()=>[l("h4",null,d(e.$t("Manage Paywalls")),1)])])]),s.hasFluentCart?(i(),c("div",Yk,[a(m,{class:"fcom_primary_button",onClick:t[0]||(t[0]=E=>n.initAddPaywall())},{default:r(()=>[V(d(e.$t("Add Paywall")),1)]),_:1})])):_("",!0)]),s.hasFluentCart?(i(),c(L,{key:0},[s.loading||s.removing?(i(),v(f,{key:0,class:"white_loaded",rows:5,animated:!0})):s.paywalls.length?(i(!0),c(L,{key:1},D(s.paywalls,E=>(i(),c("div",{class:"fcom_section_item",key:E.ID},[l("div",Wk,[l("div",Zk,[l("div",Kk,[l("h4",Jk,[l("span",Qk,[a(h,{src:E==null?void 0:E.thumbnail},null,8,["src"])]),l("span",null,d((E==null?void 0:E.post_title)||""),1)])]),l("div",Xk,[a(p,{trigger:"click","popper-class":"fcom_pop_action"},{dropdown:r(()=>[a(C,null,{default:r(()=>[a(b,null,{default:r(()=>[l("a",{href:E==null?void 0:E.view_url,target:"_blank",rel:"noopener"},d(e.$t("View Product")),9,ew)]),_:2},1024),a(b,null,{default:r(()=>[l("a",{href:E==null?void 0:E.admin_url,target:"_blank",rel:"noopener"},d(e.$t("Edit Product")),9,tw)]),_:2},1024),a(b,{type:"danger",onClick:A=>n.initRemovePaywall(E)},{default:r(()=>[V(d(e.$t("Delete Paywall")),1)]),_:1},8,["onClick"])]),_:2},1024)]),default:r(()=>[a(m,{"aria-label":e.$t("View actions"),size:"small",class:"fcom_dot_menu",text:""},{default:r(()=>[a(w,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)])]),l("div",sw,[(i(!0),c(L,null,D(E.variants,A=>(i(),c("div",{class:"fcom_section_item",key:A.id},[l("div",ow,[l("div",iw,[l("span",nw,[A.photo?(i(),v(h,{key:0,src:A.photo},null,8,["src"])):(i(),v(h,{key:1},{default:r(()=>[a(k)]),_:1}))]),l("span",null,d(A.variation_title),1)])]),l("div",lw,[l("span",{class:"fcom_price",innerHTML:A.total_price},null,8,aw),a(p,{trigger:"click"},{dropdown:r(()=>[a(C,null,{default:r(()=>[a(b,{onClick:U=>n.copyCheckoutUrl(A.checkout_url)},{default:r(()=>[V(d(e.$t("Copy Checkout URL")),1)]),_:1},8,["onClick"])]),_:2},1024)]),default:r(()=>[a(m,{"aria-label":e.$t("View actions"),size:"small",class:"fcom_dot_menu",text:"",style:{padding:"0 6px"}},{default:r(()=>[a(w,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)])]))),128))])])]))),128)):(i(),c("div",rw,[l("p",null,d(e.$t("No paywall has been added yet")),1)]))],64)):(i(),c("div",cw,[l("div",dw,[l("div",uw,[l("span",null,[V(d(e.$t("To monetize your ")+n.spaceType+", ")+" ",1),G((i(),c("a",{disabled:s.installing,onClick:t[1]||(t[1]=(...E)=>n.installPlugin&&n.installPlugin(...E)),class:"fcom_link"},[V(d(e.$t("click here")),1)],8,_w)),[[M,s.installing]]),V(" "+d(e.$t("to install and activate FluentCart.")),1)])])])]))])])]),_:3})]),_:3}),s.addPaywallModal?(i(),v(I,{key:0,modelValue:s.addPaywallModal,"onUpdate:modelValue":t[2]||(t[2]=E=>s.addPaywallModal=E),spaceProfile:o.spaceProfile,onAdded:n.paywallAdded},null,8,["modelValue","spaceProfile","onAdded"])):_("",!0),a(B,{"modal-class":"fcom_common_dialog","close-on-click-modal":!1,"append-to-body":!0,width:e.drawerWidth,modelValue:s.removePaywallModal,"onUpdate:modelValue":t[5]||(t[5]=E=>s.removePaywallModal=E),direction:"rtl",onClose:t[6]||(t[6]=E=>s.removePaywallModal=!1)},{header:r(()=>[l("div",mw,[l("div",hw,[l("h4",null,d(e.$t("Delete Paywall")),1)])])]),footer:r(()=>[l("div",bw,[a(m,{class:"fcom_primary_button",disabled:s.removing,onClick:n.deletePaywall},{default:r(()=>[V(d(e.$t("Delete")),1)]),_:1},8,["disabled","onClick"]),a(m,{class:"fcom_secondary_button",onClick:t[4]||(t[4]=E=>s.removePaywallModal=!1)},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1})])]),default:r(()=>{var E,A;return[l("div",fw,[l("div",pw,[l("h4",gw,[l("span",yw,[a(h,{src:(E=s.removePaywall)==null?void 0:E.thumbnail},null,8,["src"])]),l("span",null,d((A=s.removePaywall)==null?void 0:A.post_title),1)]),l("p",vw,d(e.$t("Are you sure you want to delete this paywall? This action cannot be undone.")),1),a(F,{modelValue:s.revokeAccess,"onUpdate:modelValue":t[3]||(t[3]=U=>s.revokeAccess=U),"true-value":"yes","false-value":"no"},{default:r(()=>[V(d(e.$t("Also remove the this space from the product integration?")),1)]),_:1},8,["modelValue"])])])]}),_:1},8,["width","modelValue"])],64)}const ww=P(jk,[["render",kw]]),Cw={name:"SpaceCustomizer",props:["space_profile"],emits:["close","completed"],components:{SpaceLockscreen:Mk,CreateSpaceForm:Bt,ManageSpaceLinks:Uk,ManagePaywalls:ww},data(){return{saving:!1,currentTab:"general",savingCount:0,hasPro:window.fluentComAdmin.pro}},methods:{saveChanges(){if(!this.hasPro&&this.currentTab=="lock_screen"){this.$notify({title:this.$t("Pro Required"),message:this.$t("This feature is only available in the pro version."),type:"error"});return}this.savingCount=this.savingCount+1}},mounted(){this.$router.push({query:{...this.$route.query,customize_space:1}})},unmounted(){const e={...this.$route.query};delete e.customize_space,this.$router.push({query:e})}},$w={key:0,class:"fcom_full_editor"},Sw={class:"fcom_full_editor_header fcom_space_settings_nav"},Vw={class:"fcom_editor_menu object_menu"},Lw={class:"fcom_space_menu_ul"},Mw={class:"full_editor_actions"},Fw={style:{"max-width":"800px",margin:"0 auto"},class:"fcom_full_editor_content"};function Tw(e,t,o,u,s,n){const m=g("ArrowLeft"),f=N,h=O,y=Ps,w=g("create-space-form"),b=ge,C=Le,p=g("space-lockscreen"),k=g("manage-space-links"),S=g("manage-paywalls"),$=xe;return o.space_profile?(i(),c("div",$w,[a($,null,{default:r(()=>[a(y,{class:"fcom_full_editor_header_wrap"},{default:r(()=>{var I;return[l("div",Sw,[l("div",{onClick:t[0]||(t[0]=F=>e.$emit("completed")),class:"fcom_back_header"},[a(f,null,{default:r(()=>[a(m)]),_:1}),V(" "+d(o.space_profile.title),1)]),l("div",Vw,[l("ul",Lw,[l("li",{onClick:t[1]||(t[1]=F=>s.currentTab="general")},[l("a",{class:R({"router-link-exact-active":s.currentTab==="general"}),href:"#"},d(e.$t("General Settings")),3)]),l("li",{onClick:t[2]||(t[2]=F=>s.currentTab="paywalls")},[l("a",{class:R({"router-link-exact-active":s.currentTab==="paywalls"}),href:"#"},d(e.$t("Paywalls")),3)]),o.space_profile.privacy=="private"&&((I=o.space_profile.settings)==null?void 0:I.custom_lock_screen)=="yes"?(i(),c("li",{key:0,onClick:t[3]||(t[3]=F=>s.currentTab="lock_screen")},[l("a",{class:R({"router-link-exact-active":s.currentTab==="lock_screen"}),href:"#"},d(e.$t("Lock Screen")),3)])):_("",!0),l("li",{onClick:t[4]||(t[4]=F=>s.currentTab="manage_links")},[l("a",{class:R({"router-link-exact-active":s.currentTab==="manage_links"}),href:"#"},d(e.$t("Space Links")),3)])])]),l("div",Mw,[a(h,{class:"fcom_primary_button",disabled:s.saving,loading:s.saving,onClick:n.saveChanges},{default:r(()=>[V(d(!s.hasPro&&s.currentTab=="lock_screen"?e.$t("Save Changes (Pro Required)"):e.$t("Save Changes")),1)]),_:1},8,["disabled","loading","onClick"]),a(h,{onClick:t[5]||(t[5]=F=>e.$emit("completed")),text:""},{default:r(()=>[...t[9]||(t[9]=[V(" X ",-1)])]),_:1})])])]}),_:1}),a($,{class:"fcom_full_editor_container editor_customizer_container"},{default:r(()=>[s.currentTab=="general"?(i(),v(C,{key:0,class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(b,null,{default:r(()=>[l("div",Fw,[a(w,{savingCount:s.savingCount,community:o.space_profile},null,8,["savingCount","community"])])]),_:1})]),_:1})):s.currentTab=="lock_screen"?(i(),v(p,{key:1,savingCount:s.savingCount,onClose:t[6]||(t[6]=I=>e.$emit("close")),spaceProfile:o.space_profile},null,8,["savingCount","spaceProfile"])):s.currentTab=="manage_links"?(i(),v(k,{key:2,savingCount:s.savingCount,onClose:t[7]||(t[7]=I=>e.$emit("close")),spaceProfile:o.space_profile},null,8,["savingCount","spaceProfile"])):s.currentTab=="paywalls"?(i(),v(S,{key:3,savingCount:s.savingCount,onClose:t[8]||(t[8]=I=>e.$emit("close")),spaceProfile:o.space_profile},null,8,["savingCount","spaceProfile"])):_("",!0)]),_:1})]),_:1})])):_("",!0)}const Pw=P(Cw,[["render",Tw]]),Iw={name:"SpaceMenu",emits:["refetch","doSearch"],components:{ImageUploader:je,SpaceMenuItems:v2,SpaceCustomizer:Pw},setup(){return{spaceStore:Re()}},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:qt(Fe),customizeSpace:!1,drawerVisible:!1}},computed:{profile(){return this.space_profile?(this.search="",this.space_profile):{title:".......",slug:"..",cover_photo:this.appVars.assets_url+"images/placeholer.png",permissions:{}}},showActions(){return this.profile.id?this.profile.membership||this.isAdmin()?!0:this.isMobile:!1},isMod(){return this.profile.permissions.community_moderator}},methods:{async join(){this.joining=!0;try{const e=await this.spaceStore.joinSpace(this.space,this.space_profile);this.appVars.user_membership_slugs.push(this.space),this.$notify.success(this.$t("Successfully joined the space")),this.profile.membership=e.user_status,this.$emit("refetch"),this.$eventBus.emit("reloadMenu")}catch(e){this.$handleError(e)}finally{this.joining=!1}},async leave(){try{await this.$confirm(this.$t("Are you sure you want to leave this community?"),this.$t("Leave Space"),{confirmButtonText:this.$t("Leave Space"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}),this.joining=!0;try{await this.spaceStore.leaveSpace(this.space);const e=this.appVars.user_membership_slugs.indexOf(this.space);e!==-1&&this.appVars.user_membership_slugs.splice(e,1),this.$notify.success(this.$t("Successfully left the space")),this.profile.membership=null,this.$emit("refetch"),this.$eventBus.emit("leaveCommunity",this.space),this.$eventBus.emit("reloadMenu")}catch(e){this.$handleError(e)}finally{this.joining=!1}}catch{}},initDeleteSpace(){this.$refs.space_actions.hide(),this.$confirm(this.$t("Are you sure you want to delete this space?"),this.$t("Warning"),{confirmButtonText:this.$t("Yes, Delete the Space"),cancelButtonText:this.$t("No"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.$promt(this.$t("Please Type %s to confirm. Please note, all the posts, comments, activities of this Space will be delete.",'"DELETE"'),this.$t("Delete Space"),{confirmButtonText:this.$t("Confirm Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button"}).then(e=>{e.value==="DELETE"?this.deleteSpace():this.$notify.error(this.$t("The verification string does not match"))})})},deleteSpace(){this.$del("spaces/"+this.space_profile.slug).then(e=>{this.$notify.success(e.message),this.$router.push({name:"all_feeds"}),this.$eventBus.emit("reloadMenu")}).catch(e=>{this.$handleError(e)})},initEdit(){this.customizeSpace=!0},performSearch(){this.$eventBus.emit("doGlobalSearch",this.search_term)}},mounted(){this.$eventBus.on("doGlobalSearch",e=>{this.search_term=e}),this.$route.query.customize_space&&(this.customizeSpace=!0)}},Uw={class:"space_header"},Bw={class:"object_menu"},Ew={key:0,class:"menu_actions"},Aw=["href"],Dw={class:"actions_items"},Rw={key:0};function Hw(e,t,o,u,s,n){const m=g("space-menu-items"),f=O,h=g("MoreFilled"),y=N,w=fe,b=g("space-customizer"),C=Q("loading");return i(),c(L,null,[G((i(),c("div",Uw,[l("div",Bw,[a(m,{space:o.space,profile:n.profile,class:"fcom_desktop_only"},null,8,["space","profile"]),n.profile.id?(i(),c("div",Ew,[e.auth.user_id?n.profile.membership?_("",!0):(i(),v(f,{key:1,disabled:s.joining,loading:s.joining,onClick:t[0]||(t[0]=p=>n.join()),class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Join")),1)]),_:1},8,["disabled","loading"])):(i(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button fcom_join_space_auth"},d(e.$t("Join")),9,Aw)),n.showActions?(i(),v(w,{key:2,persistent:!1,ref:"space_actions",placement:"bottom",width:200,trigger:"click"},{reference:r(()=>[a(f,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[a(m,{space:o.space,profile:n.profile,class:"fcom_linked_menus fcom_sm_only"},null,8,["space","profile"]),l("ul",Dw,[e.hasSpaceAdminAccess(n.profile)?(i(),c(L,{key:0},[l("li",{onClick:t[1]||(t[1]=()=>{n.initEdit(),e.$refs.space_actions.hide()})},d(e.$t("Space Settings")),1),t[6]||(t[6]=l("li",{class:"fcom_li_separator"},null,-1))],64)):_("",!0),n.profile.membership?(i(),c("li",{key:1,onClick:t[2]||(t[2]=()=>{e.$refs.space_actions.hide(),n.leave()})},d(e.$t("Leave Space")),1)):_("",!0),e.isAdmin()?(i(),c("li",{key:2,onClick:t[3]||(t[3]=(...p)=>n.initDeleteSpace&&n.initDeleteSpace(...p))},d(e.$t("Delete")),1)):_("",!0)])]),_:1},512)):_("",!0)])):_("",!0)])])),[[C,s.updating]]),s.customizeSpace&&o.space_profile?(i(),c("div",Rw,[(i(),v(ot,{to:"body"},[a(b,{space_profile:o.space_profile,onClose:t[4]||(t[4]=p=>s.customizeSpace=null),onCompleted:t[5]||(t[5]=p=>{s.customizeSpace=!1,e.$emit("refetch")})},null,8,["space_profile"])]))])):_("",!0)],64)}const uo=P(Iw,[["render",Hw]]),xw={name:"AboutSpace",components:{RecentActivities:At},props:["space_profile","has_permission"],data(){return{privacies:qs}}},jw={class:"fcom_main_side_wrap"},Ow={role:"region","aria-label":"About Space",class:"app_side_widget widget_recent_activities"},Nw={class:"widget_header"},zw={key:0,class:"widget_body"},qw=["innerHTML"],Gw={class:"space_meta"},Yw={class:"space_meta_item"},Ww={class:"meta_label"},Zw={class:"meta_desc"};function Kw(e,t,o,u,s,n){var w,b,C;const m=g("Guide"),f=N,h=W,y=g("recent-activities");return i(),c("div",jw,[l("div",Ow,[l("div",Nw,[l("h3",null,d(e.$t("About")),1)]),o.space_profile?(i(),c("div",zw,[l("div",{class:"space_description",innerHTML:o.space_profile.description_rendered},null,8,qw),l("div",Gw,[l("div",Yw,[l("div",Ww,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("span",null,d((w=s.privacies[o.space_profile.privacy])==null?void 0:w.label),1)]),l("div",Zw,d((b=s.privacies[o.space_profile.privacy])==null?void 0:b.space_description),1)])])])):(i(),v(h,{key:1,animated:!0}))]),o.space_profile&&o.has_permission?(i(),v(y,{key:0,with_pins:!0,with_pending_count:!0,widget_title:e.$t("Recent Space Activities"),context:{type:"space",space_slug:(C=o.space_profile)==null?void 0:C.slug,space_id:o.space_profile.id}},null,8,["widget_title","context"])):_("",!0)])}const _o=P(xw,[["render",Kw]]),Jw={name:"CustomLockscreenView",props:["profile","sections"],components:{LockscreenLessonEditor:ro,LockscreenPaywallView:co},computed:{lockscreenFields(){var e,t;return(t=(e=this.profile)==null?void 0:e.lockscreen_config.lockScreen)==null?void 0:t.filter(o=>!o.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})}}},Qw={class:"fcom_custom_lockscreen"},Xw={class:"fcom_lockscreen_content"},e3={class:"fcom_item"},t3={class:"fcom_content"},s3=["href","target"],o3={key:1,class:"fcom_content_wrap"},i3=["innerHTML"],n3={key:2,class:"fcom_content_wrap"},l3={key:3,class:"fcom_paywall_wrap"};function a3(e,t,o,u,s,n){const m=g("lockscreen-lesson-editor"),f=g("lockscreen-paywall-view");return i(),c("div",Qw,[l("div",Xw,[(i(!0),c(L,null,D(n.lockscreenFields,h=>{var y;return i(),c("div",e3,[h.type=="image"?(i(),c("div",{key:0,class:"fcom_image_wrap",style:re(n.imageStyles(h))},[l("div",t3,[l("h2",{style:re(n.headingStyles(h))},d(h.heading),5),l("p",{style:re(n.descriptionStyles(h))},d(h.description),5),h.button_text?(i(),c("a",{key:0,class:"fcom_btn",href:n.buttonLink(h),style:re(n.buttonStyles(h)),target:h.new_tab=="yes"?"_blank":"_self"},d(h.button_text),13,s3)):_("",!0)])],4)):_("",!0),h.type=="block"&&h.content?(i(),c("div",o3,[l("div",{class:"fcom_custom_editor_html",innerHTML:h.content},null,8,i3)])):_("",!0),h.type=="lesson"?(i(),c("div",n3,[a(m,{sections:o.sections,settings:o.profile.settings},null,8,["sections","settings"])])):_("",!0),h.type=="paywall"&&((y=h.paywalls)==null?void 0:y.length)>0?(i(),c("div",l3,[a(f,{space_id:o.profile.id,field:h},null,8,["space_id","field"])])):_("",!0)])}),256))])])}const mo=P(Jw,[["render",a3]]),r3={name:"DefaultLockscreenPaywall",components:{ImagePlaceholder:Dt},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()}},c3={class:"space_default_lock_box fcom_paywall_cards"},d3={class:"paywall_header"},u3={class:"paywall_body"},_3=["innerHTML"],m3={key:0,class:"subscription"},h3={class:"paywall_footer"},f3={key:0,class:"fcom_mb_10"},p3=["href"];function g3(e,t,o,u,s,n){const m=W,f=Yt,h=g("ImagePlaceholder");return i(),c("div",c3,[s.loading?(i(),v(m,{key:0,rows:3,animated:!0})):(i(!0),c(L,{key:1},D(s.availablePaywalls,y=>(i(),c(L,{key:y.ID},[(i(!0),c(L,null,D(y.variants,w=>(i(),c("div",{key:w.id,class:"fcom_paywall"},[l("div",d3,[w.photo?(i(),v(f,{key:0,src:w.photo},null,8,["src"])):(i(),v(f,{key:1},{default:r(()=>[a(h)]),_:1})),l("span",null,d(w.variation_title),1)]),l("div",u3,[l("span",{innerHTML:w.total_price},null,8,_3),n.isSubscriptionPaywall(w)?(i(),c("span",m3,"ย / "+d(n.getRepeatInterval(w)),1)):_("",!0)]),l("div",h3,[w!=null&&w.description?(i(),c("span",f3,d(y.post_excerpt),1)):_("",!0),l("a",{class:"el-button fcom_primary_button link_button",href:w.checkout_url},d(e.$t("Join Now")),9,p3)])]))),128))],64))),128))])}const ho=P(r3,[["render",g3]]),y3={name:"LockscreenView",components:{CustomLockscreenView:mo,DefaultLockscreenPaywall:ho},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)}},v3={key:0,style:{margin:"30px","text-align":"center"}},b3={key:0,class:"space_lock_box space_default_lock_box"},k3={class:"space_lock_box space_default_lock_box"},w3={class:"lock_desc"},C3=["href"],$3={class:"lock_desc"},S3=["href"],V3={key:2},L3={key:2,class:"space_lock_box"},M3={class:"lock_desc"},F3=["href"];function T3(e,t,o,u,s,n){var b,C;const m=g("Lock"),f=N,h=O,y=g("default-lockscreen-paywall"),w=g("custom-lockscreen-view");return(b=this.space_profile.lockscreen_config)!=null&&b.redirect_url?(i(),c("h3",v3,d(e.$t("Please wait....")),1)):o.space_profile.lockscreen_config?(i(),c(L,{key:1},[o.space_profile.permissions&&o.space_profile.permissions.is_pending?(i(),c("div",b3,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("Membership Request Under Review")),1)])):o.space_profile.lockscreen_config.showCustom?(i(),c("div",V3,[a(w,{profile:o.space_profile},null,8,["profile"])])):(i(),c(L,{key:1},[l("div",k3,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("This is a private space")),1),o.space_profile.lockscreen_config.canSendRequest?(i(),c(L,{key:0},[l("p",w3,d(e.$t("Please send a join request and an admin will review your join request.")),1),e.auth.user_id?(i(),v(h,{key:0,disabled:o.joining,loading:o.joining,class:"fcom_primary_button",onClick:t[0]||(t[0]=p=>e.$emit("join"))},{default:r(()=>[V(d(e.$t("Request Access")),1)]),_:1},8,["disabled","loading"])):(i(),c("a",{key:1,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login or Signup")),9,C3))],64)):(i(),c(L,{key:1},[l("p",$3,d(e.$t("Members have to be invited to this space.")),1),e.auth.user_id?_("",!0):(i(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.$t("Login or Signup")),9,S3))],64))]),o.space_profile.lockscreen_config.showPaywalls?(i(),v(y,{key:0,space_id:(C=o.space_profile)==null?void 0:C.id},null,8,["space_id"])):_("",!0)],64))],64)):e.auth.user_id?_("",!0):(i(),c("div",L3,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("Please login/signup to join this community")),1),l("p",M3,d(e.$t("To join the discussion of this community, please login or signup")),1),l("a",{href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,F3)]))}const P3=P(y3,[["render",T3]]),I3={name:"SpaceView",components:{RenderSpaceLinks:ls,AboutSpace:_o,Layout:ke,AppLayout:Se,SpaceHeader:u2,RecentActivities:At,CreateSpaceForm:Bt,SpaceMenu:uo,LockscreenView:P3,SpaceIcon:Oe},setup(){return{spaceStore:Re()}},props:["space"],data(){return{search:"",joining:!1,pending_count:0}},computed:{space_profile(){return this.spaceStore.getCurrentSpace},loading(){return this.spaceStore.isLoading(this.space)},has_permission(){return this.space_profile?!!this.space_profile.permissions.can_view_posts:!1},isDefaultScreen(){var e,t;return((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.custom_lock_screen)=="no"},isCustomLockScreen(){var e;return!!((e=this.space_profile)!=null&&e.lockscreen_config)&&!this.hasSpaceModeratorAccess(this.space_profile)},isNonMember(){var e,t;return(t=(e=this.space_profile)==null?void 0:e.permissions)==null?void 0:t.is_non_member},showSpaceHeader(){var e;return!this.isCustomLockScreen&&this.$route.name=="space_feeds"&&((e=this.space_profile)==null?void 0:e.cover_photo)},showSideBar(){var e,t;return!this.isCustomLockScreen&&this.$route.meta.show_sidebar&&((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.show_sidebar)!="no"},showSpaceMenu(){return!this.isCustomLockScreen},showProfileLogo(){return!this.isCustomLockScreen},feedCssClasses(){var o,u;const e=[];e.push(this.showSideBar?"fcom_has_space_sidebar":"fcom_hide_space_sidebar");let t=((u=(o=this.space_profile)==null?void 0:o.settings)==null?void 0:u.layout_style)||"timeline";return e.push("fcom_layout_"+t),e.push("fcom_route_"+this.$route.name),e},wrapperLayoutClasses(){var e;return["fcom_single_layout","fcom_max_layout","fcom_space_"+((e=this.space_profile)==null?void 0:e.slug),"fcom_space_route_"+this.$route.name]}},watch:{space(){this.search="",this.getSpaceProfile()}},methods:{async getSpaceProfile(){try{const e=await this.spaceStore.fetchSpace(this.space);this.auth.spaces[e.slug]=e,e.pending_count!==void 0&&(this.pending_count=e.pending_count),this.changeTitle(e.title),this.$nextTick(()=>{window.fcomLayoutRef&&window.fcomLayoutRef.wrapRef&&(window.fcomLayoutRef.setScrollTop(0),console.log("[SpaceRoute] Scrolled to top"))})}catch(e){this.$handleError(e)}},async processJoin(){this.joining=!0;try{const e=await this.spaceStore.joinSpace(this.space);this.$notify.success(this.$t("Successfully joined the space")),await this.getSpaceProfile()}catch(e){this.$handleError(e)}finally{this.joining=!1}},resetRoute(){this.$nextTick(()=>{})}},async mounted(){const e=this.spaceStore.getSpaceBySlug(this.space);e?(this.spaceStore.setCurrentSpace(this.space),this.changeTitle(e.title),this.$nextTick(()=>{window.fcomLayoutRef&&window.fcomLayoutRef.wrapRef&&(window.fcomLayoutRef.setScrollTop(0),console.log("[SpaceRoute] Scrolled to top (cached)"))})):await this.getSpaceProfile()},beforeUnmount(){this.spaceStore.clearCurrentSpace()}},U3={key:0,"aria-label":"Space Links",class:"fcom_sub_header"},B3={class:"space_route"},E3={key:0},A3={key:1,class:"space_holder"},D3={key:2};function R3(e,t,o,u,s,n){const m=g("Lock"),f=N,h=g("space-icon"),y=g("router-link"),w=g("space-menu"),b=g("render-space-links"),C=g("space-header"),p=W,k=g("lockscreen-view"),S=g("router-view"),$=Le,I=g("AboutSpace"),F=We,B=xe,M=g("layout"),E=g("app-layout");return i(),v(E,{wrapper_class:n.wrapperLayoutClasses},{default:r(()=>[a(M,{wrapper_class:["no_bg_layout",{custom_lockscreen:n.isCustomLockScreen},"fcom_route_"+e.$route.name],title:"...."},{title:r(()=>[l("h1",{onClick:t[0]||(t[0]=A=>{e.$eventBus.emit("toTop"),n.resetRoute()}),class:"fcom_page_title"},[n.space_profile?(i(),v(y,{key:0,class:"fcom_space_title",to:{name:"space_feeds",params:{space:o.space}}},{default:r(()=>[n.isCustomLockScreen?(i(),v(f,{key:0},{default:r(()=>[a(m)]),_:1})):n.showProfileLogo?(i(),v(h,{key:1,space_profile:n.space_profile},null,8,["space_profile"])):_("",!0),l("span",null,d(n.space_profile.title),1)]),_:1},8,["to"])):_("",!0)])]),actions:r(()=>[n.showSpaceMenu?(i(),v(w,{key:0,space:o.space,space_profile:n.space_profile,onDoSearch:t[1]||(t[1]=A=>{s.search=A}),onRefetch:t[2]||(t[2]=A=>n.getSpaceProfile())},null,8,["space","space_profile"])):_("",!0)]),sub_header:r(()=>{var A,U;return[n.space_profile&&!n.isCustomLockScreen&&((U=(A=n.space_profile)==null?void 0:A.settings)!=null&&U.links.length)?(i(),c("nav",U3,[a(b,{links:n.space_profile.settings.links},null,8,["links"])])):_("",!0)]}),default:r(()=>[n.showSpaceHeader?(i(),v(C,{key:0,onRefetch:t[3]||(t[3]=A=>n.getSpaceProfile()),space:o.space,space_profile:n.space_profile},null,8,["space","space_profile"])):_("",!0),a(B,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a($,{class:"fcom_main"},{default:r(()=>[l("div",{class:R([n.feedCssClasses,"fcom_feed_box"])},[l("div",B3,[n.loading?(i(),c("div",E3,[a(p,{class:"white_loaded",rows:10,animated:!0})])):n.space_profile?(i(),c("div",A3,[n.isCustomLockScreen?(i(),v(k,{key:0,space_profile:n.space_profile,joining:s.joining,onJoin:t[4]||(t[4]=A=>n.processJoin())},null,8,["space_profile","joining"])):_("",!0),n.has_permission?(i(),v(S,{key:o.space,search:s.search,onRefetch:t[5]||(t[5]=A=>n.getSpaceProfile()),space_profile:n.space_profile,space_slug:o.space},null,8,["search","space_profile","space_slug"])):_("",!0)])):(i(),c("div",D3,[l("h4",null,d(e.$t("Sorry! this community could not be loaded")),1)]))])],2)]),_:1}),n.showSideBar?(i(),v(F,{key:0,class:"fcom_resp_side",width:"306px"},{default:r(()=>[a(I,{has_permission:n.has_permission,space_profile:n.space_profile},null,8,["has_permission","space_profile"])]),_:1})):_("",!0)]),_:1})]),_:1},8,["wrapper_class"])]),_:1},8,["wrapper_class"])}const H3=P(I3,[["render",R3]]),x3={name:"CreateFeed",props:["space_slug","space_profile","space","search"],emits:["refetch"],components:{CreateStatusForm:Ft,Feeds:mt},setup(){const e=Re(),t=qe();return{spaceStore:e,uiStore:t}},beforeRouteLeave(e,t,o){if(e.name==="single_feed"||e.name==="space_feed"){let s=0;window.fcomLayoutRef&&window.fcomLayoutRef.wrapRef&&(s=window.fcomLayoutRef.wrapRef.scrollTop),this.uiStore.saveScrollPosition(t.path,s)}else this.uiStore.clearScrollPosition();o()},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,o;const e=this.spaceStore.getSpaceTopics(this.space_slug);return e&&e.length>0?e:Jt((t=this.space_profile)==null?void 0:t.topics)?null:((o=this.space_profile)==null?void 0:o.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)}},j3={key:0,class:"fcom_space_topics"},O3={ref:"fcom_topics_filters",class:"fcom_topics_filters"};function N3(e,t,o,u,s,n){var y,w,b;const m=O,f=ge,h=g("feeds");return i(),c(L,null,[n.spaceTopics?(i(),c("div",j3,[a(f,null,{default:r(()=>[l("div",O3,[a(m,{onClick:t[0]||(t[0]=C=>n.setTopic("")),class:R({fcom_active_topic:!s.topic_slug})},{default:r(()=>[V(d(e.$t("All")),1)]),_:1},8,["class"]),(i(!0),c(L,null,D(n.spaceTopics,C=>(i(),v(m,{key:C.slug,onClick:p=>n.setTopic(C.slug),class:R({fcom_active_topic:C.slug==s.topic_slug})},{default:r(()=>[V(d(C.title),1)]),_:2},1032,["onClick","class"]))),128))],512)]),_:1})])):_("",!0),a(h,{feed_name:"space_feed_"+o.space_slug,space:o.space_slug,topic_slug:s.topic_slug,default_search:o.search,layout_style:n.layout_style,can_change_order:((y=o.space_profile.settings)==null?void 0:y.disable_post_sort_by)!=="yes",default_order_by:((w=o.space_profile.settings)==null?void 0:w.default_post_sort_by)||"",can_change_layout:((b=o.space_profile.settings)==null?void 0:b.disable_layout_style)!=="yes",hide_create_form:!o.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 z3=P(x3,[["render",N3]]),q3={name:"SpaceHomeRedirect",created(){this.$router.replace({name:"space_feeds",params:{space:this.$route.params.space}})}},G3={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)}},Y3={class:"fcom_invitation_form",ref:"inviteForm"};function W3(e,t,o,u,s,n){const m=X,f=de,h=at,y=rt,w=O,b=ue,C=Q("loading");return i(),c("div",Y3,[a(b,{onSubmit:t[2]||(t[2]=Y(p=>e.doNothing(),["prevent"])),modelValue:s.inviatation,"onUpdate:modelValue":t[3]||(t[3]=p=>s.inviatation=p),"label-position":"top"},{default:r(()=>[a(y,{gutter:30},{default:r(()=>[a(h,{sm:24,md:12},{default:r(()=>[a(f,{label:e.$t("Invitee email")},{default:r(()=>[a(m,{modelValue:s.inviatation.email,"onUpdate:modelValue":t[0]||(t[0]=p=>s.inviatation.email=p),placeholder:e.$t("Enter invitee email"),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),a(h,{sm:24,md:12},{default:r(()=>[a(f,{label:e.$t("Invitee Name (optional)")},{default:r(()=>[a(m,{modelValue:s.inviatation.invitee_name,"onUpdate:modelValue":t[1]||(t[1]=p=>s.inviatation.invitee_name=p),placeholder:e.$t("Enter invitee Name"),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1}),a(f,null,{default:r(()=>[G((i(),v(w,{disabled:s.saving,class:"fcom_primary_button",onClick:n.sendInvitation},{default:r(()=>[V(d(e.$t("Send Invitation")),1)]),_:1},8,["disabled","onClick"])),[[C,s.saving]])]),_:1})]),_:1},8,["modelValue"])],512)}const Z3=P(G3,[["render",W3]]),K3={name:"AddMemberForm",components:{InviationForm:Z3},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()}},J3={class:"fcom_select_photo",style:{float:"left"}},Q3=["src","alt"],X3={style:{float:"right",color:"#8492a6","font-size":"13px"}},e8={key:1},t8={class:"fcom_spaced_flex"},s8={key:0},o8={key:1},i8={key:1},n8={key:0},l8={key:1};function a8(e,t,o,u,s,n){const m=oe,f=O,h=ie,y=de,w=ue,b=g("InviationForm"),C=Q("loading");return s.showingForm=="addByUser"?(i(),v(w,{key:0,onSubmit:t[4]||(t[4]=Y(p=>e.doNothing(),["prevent"])),"label-position":"top",modelValue:s.form,"onUpdate:modelValue":t[5]||(t[5]=p=>s.form=p)},{default:r(()=>[s.form.editing_user?(i(),c("p",e8,d(e.$t("Editing manager role for"))+" "+d(s.form.editing_user.display_name),1)):(i(),v(y,{key:0,label:e.$t("Search for an existing user or Invite by Email")},{default:r(()=>[G((i(),v(h,{ref:"invite_member",class:"rich_select",filterable:"",remote:"","remote-method":n.fetchUsers,placeholder:e.$t("Select User"),modelValue:s.form.user_id,"onUpdate:modelValue":t[1]||(t[1]=p=>s.form.user_id=p)},{empty:r(()=>[l("p",null,d(e.$t("No existing users found based on your search.")),1),a(f,{disabled:s.adding,loading:s.adding,type:"success",onClick:t[0]||(t[0]=p=>n.invitePerson())},{default:r(()=>[V(d(e.$t("Send Email Invitation")),1)]),_:1},8,["disabled","loading"])]),default:r(()=>[(i(!0),c(L,null,D(s.users,p=>(i(),v(m,{class:"fcom_with_photo_option",key:p.ID,label:p.display_name+" ("+(p.user_email||p.ID)+")",value:p.ID},{default:r(()=>[l("span",J3,[l("img",{src:p.photo,alt:p.display_name},null,8,Q3),l("span",null,d(p.display_name),1)]),l("span",X3,d(p.user_email||p.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["remote-method","placeholder","modelValue"])),[[C,s.loading]])]),_:1},8,["label"])),a(y,{label:e.$t("Membership Role")},{default:r(()=>[a(h,{placeholder:e.$t("Select Role"),modelValue:s.form.role,"onUpdate:modelValue":t[2]||(t[2]=p=>s.form.role=p)},{default:r(()=>[a(m,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(m,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(m,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),q(e.$slots,"after_form",{},()=>[l("div",t8,[a(f,{class:"fcom_primary_button",loading:s.adding,disabled:s.adding,onClick:t[3]||(t[3]=p=>n.addMember())},{default:r(()=>[s.form.editing_user?(i(),c("span",s8,d(e.$t("Update Role")),1)):(i(),c("span",o8,d(e.$t("Add as %s",s.form.role)),1))]),_:1},8,["loading","disabled"])])])]),_:3},8,["modelValue"])):(i(),c("div",i8,[e.has_pro?(i(),c("div",n8,[a(b,{space_id:o.space_profile.id,default_value:s.invite_search,onCompleted:t[6]||(t[6]=p=>e.$emit("completed"))},null,8,["space_id","default_value"])])):(i(),c("div",l8,[...t[7]||(t[7]=[l("p",null,"Member Invitation feature is only available on the Pro version",-1)])]))]))}const r8=P(K3,[["render",a8]]),c8={name:"AddMembersForm",components:{SpaceCourseSelector:Et},props:{context:{type:String,required:!0},target:{type:Object,required:!0}},emits:["completed","membersAdded"],data(){return{sourceMode:"wp_users",wpUsers:[],wpLoading:!1,selectedUserIds:[],role:"member",saving:!1,selectedSourceId:"",selectedSourceType:"",selectedSourceSlug:"",csvRows:[],csvFileName:"",createMissingUsers:!1,wpUsersLoaded:!1,crmTags:[],crmTagsLoading:!1,crmTagsLoaded:!1,selectedTagId:null,createMissingCrmUsers:!1,batchRunning:!1,batchProgress:0,batchProcessed:0,batchTotal:0,importDone:null}},watch:{sourceMode(e){e==="wp_users"&&!this.wpUsersLoaded&&this.fetchWpUsers(),e==="crm_tag"&&this.appVars.pro&&!this.crmTagsLoaded&&this.fetchCrmTags()}},methods:{searchWpUsers(e=""){e&&e.length<2||this.fetchWpUsers(e)},fetchWpUsers(e=""){this.wpLoading=!0;const t=this.context==="course",o=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(o,u).then(s=>{this.wpUsers=s.users.data,this.wpUsersLoaded=!0}).catch(s=>{this.$handleError(s)}).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",s=e?{user_id:this.selectedUserIds[0]}:{user_id:this.selectedUserIds[0],role:this.role};this.$post(u,s).then(n=>{this.$notify.success(n.message),this.$emit("completed")}).catch(n=>{this.$handleError(n)}).finally(()=>{this.saving=!1});return}const t=e?"admin/courses/"+this.target.id+"/students/bulk-add":"spaces/"+this.target.slug+"/members/bulk-add",o=e?{}:{role:this.role};this.runChunkedImport(this.selectedUserIds,u=>({url:t,data:{user_ids:u,...o}}))},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 o=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(o,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 o=new FileReader;o.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."))},o.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 o=this.splitCsvLine(t[0]).map(b=>b.toLowerCase()),u=["name","email","username"],s=o.some(b=>u.includes(b));let n=0,m=1,f=2,h=0;s&&(h=1,n=o.indexOf("name"),m=o.indexOf("email"),f=o.indexOf("username"));const y=new Set,w=[];for(let b=h;b=0&&C[n]||"",k=m>=0?(C[m]||"").toLowerCase():"",S=f>=0&&C[f]||"";!k.includes("@")||y.has(k)||(y.add(k),w.push({name:p,email:k,username:S}))}return w},importCsv(){if(!this.csvRows.length)return;let e=`spaces/${this.target.slug}/members/bulk-import`;this.context==="course"&&(e=`admin/courses/${this.target.id}/students/bulk-import`);const t=100,o=this.csvRows.length,u={added:0,skipped:0,failed:0};this.batchRunning=!0,this.batchTotal=o,this.batchProcessed=0,this.batchProgress=0;const s=n=>{if(n>=o){this.batchRunning=!1,this.importDone={...u,total:o},this.$emit("membersAdded");return}const m=this.csvRows.slice(n,n+t);this.$post(e,{rows:m,create_missing:this.createMissingUsers}).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,y=n+h;this.batchProcessed=Math.min(o,y),this.batchProgress=Math.round(this.batchProcessed/o*100),s(y)}).catch(f=>{this.$handleError(f),this.batchRunning=!1,this.importDone={...u,total:o},this.$emit("membersAdded")})};s(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`,o=e?`admin/courses/${this.target.id}/students/bulk-add`:`spaces/${this.target.slug}/members/bulk-add`,u=[];let s=0;this.batchRunning=!0,this.batchTotal=0,this.batchProcessed=0,this.batchProgress=0;const n=()=>{this.batchRunning=!1;const f=u.length+s;this.importDone={added:0,skipped:0,failed:s,total:f},this.$emit("membersAdded")},m=f=>{this.$post(t,{tag_id:this.selectedTagId,create_missing:this.createMissingCrmUsers,offset:f,per_page:200}).then(h=>{if(h.user_ids&&h.user_ids.length&&u.push(...h.user_ids),s+=h.failed||0,h.has_more){m(h.next_offset);return}if(!u.length){n();return}this.runChunkedImport(u,y=>({url:o,data:{user_ids:y}}),s)}).catch(h=>{this.$handleError(h),this.batchRunning=!1;const y=u.length+s;this.importDone={added:0,skipped:0,failed:s,total:y},this.$emit("membersAdded")})};m(0)},runChunkedImport(e,t,o=0){const s=e.length,n={added:0,skipped:0,failed:o},m=s+o;this.batchRunning=!0,this.batchTotal=s,this.batchProcessed=0,this.batchProgress=0;const f=h=>{if(h>=s){this.batchRunning=!1,this.importDone={...n,total:m},this.$emit("membersAdded");return}const y=e.slice(h,h+500),{url:w,data:b}=t(y);this.$post(w,b).then(C=>{n.added+=C.added||0,n.skipped+=C.skipped||0,n.failed+=C.failed||0;const p=C.processed&&C.processed>0?C.processed:y.length,k=h+p;this.batchProcessed=Math.min(s,k),this.batchProgress=Math.round(this.batchProcessed/s*100),f(k)}).catch(C=>{this.$handleError(C),this.batchRunning=!1,this.importDone={...n,total:m},this.$emit("membersAdded")})};f(0)},runOffsetImport(e,t){const o={added:0,skipped:0,failed:0};this.batchRunning=!0,this.batchTotal=0,this.batchProcessed=0,this.batchProgress=0;const u=s=>{this.$post(e,{...t,offset:s,per_page:500}).then(n=>{o.added+=n.added||0,o.skipped+=n.skipped||0,o.failed+=n.failed||0,n.total&&!this.batchTotal&&(this.batchTotal=n.total),this.batchProcessed=n.next_offset||s+(n.processed||0),this.batchProgress=this.batchTotal?Math.min(99,Math.round(this.batchProcessed/this.batchTotal*100)):50,n.has_more?u(n.next_offset||this.batchProcessed):(this.batchProgress=100,this.batchRunning=!1,this.importDone={...o,total:this.batchTotal||o.added+o.skipped+o.failed},this.$emit("membersAdded"))}).catch(n=>{this.$handleError(n),this.batchRunning=!1,this.importDone={...o,total:this.batchTotal||o.added+o.skipped+o.failed},this.$emit("membersAdded")})};u(0)}},mounted(){this.sourceMode==="wp_users"&&!this.wpUsersLoaded&&this.fetchWpUsers()}},d8={class:"fcom_add_members_form"},u8={key:0,class:"fcom_source_selector_wrap fcom_mb_20"},_8={key:1,class:"fcom_import_done"},m8={class:"fcom_done_title"},h8={class:"fcom_done_subtitle"},f8={class:"fcom_import_summary"},p8={class:"fcom_import_summary_title"},g8={class:"fcom_import_summary_row"},y8={class:"fcom_import_summary_row"},v8={key:0,class:"fcom_import_summary_row"},b8={key:1,class:"fcom_import_summary_row"},k8={key:2,class:"fcom_import_progress_wrap"},w8={class:"fcom_help_text fcom_mb_15"},C8={key:0,class:"fcom_muted_text fcom_mt_10"},$8={class:"fcom_select_photo",style:{float:"left"}},S8=["src","alt"],V8={style:{float:"right",color:"#8492a6","font-size":"13px"}},L8={key:0,class:"fcom_help_text fcom_mb_10"},M8=["href"],F8={class:"fcom_help_text fcom_mb_15"},T8={key:0},P8={key:2},I8={class:"fcom_spaced_flex fcom_mb_10"},U8={class:"fcom_csv_drop_inner"},B8={class:"el-upload__text fcom_mt_10"},E8={key:0},A8={class:"el-upload__tip"},D8={class:"fcom_spaced_flex fcom_mb_10"},R8={class:"fcom_muted_text",style:{"margin-left":"8px"}},H8={key:0,class:"fcom_muted_text fcom_mb_10"},x8={class:"fcom_help_text fcom_mb_15"},j8={class:"fcom_help_text fcom_mb_15"},O8={key:0};function N8(e,t,o,u,s,n){const m=Ye,f=ve,h=Wt,y=oe,w=ie,b=de,C=O,p=ue,k=g("SpaceCourseSelector"),S=lt,$=Is,I=Us,F=_e,B=Q("loading");return i(),c("div",d8,[!s.batchRunning&&!s.importDone?(i(),c("div",u8,[a(f,{modelValue:s.sourceMode,"onUpdate:modelValue":t[0]||(t[0]=M=>s.sourceMode=M),size:"small"},{default:r(()=>[a(m,{value:"wp_users"},{default:r(()=>[V(d(e.$t("WP Users")),1)]),_:1}),a(m,{value:"from_source"},{default:r(()=>[V(d(e.$t("From Space/Course")),1)]),_:1}),a(m,{value:"csv"},{default:r(()=>[V(d(e.$t("CSV Import")),1)]),_:1}),e.appVars.has_fluentcrm?(i(),v(m,{key:0,value:"crm_tag"},{default:r(()=>[V(d(e.$t("CRM Tag")),1)]),_:1})):_("",!0)]),_:1},8,["modelValue"])])):_("",!0),s.importDone?(i(),c("div",_8,[t[16]||(t[16]=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",m8,d(e.$t("All Done!")),1),l("p",h8,d(e.$t("Import has been completed. You may close this now.")),1),l("div",f8,[l("strong",p8,d(e.$t("Import Summary")),1),l("p",g8,d(e.$t("Total Records:"))+" "+d(s.importDone.total),1),l("p",y8,d(o.context==="course"?e.$t("Enrolled:"):e.$t("Added:"))+" "+d(s.importDone.added),1),s.importDone.skipped?(i(),c("p",v8,d(e.$t("Skipped:"))+" "+d(s.importDone.skipped),1)):_("",!0),s.importDone.failed?(i(),c("p",b8,d(e.$t("Failed:"))+" "+d(s.importDone.failed),1)):_("",!0)])])):s.batchRunning?(i(),c("div",k8,[l("div",w8,[l("p",null,d(e.$t("Importingโ€ฆ Please do not close this window.")),1)]),a(h,{percentage:s.batchProgress,"stroke-width":12},null,8,["percentage"]),s.batchTotal?(i(),c("p",C8,d(s.batchProcessed)+" / "+d(s.batchTotal)+" "+d(e.$t("processed")),1)):_("",!0)])):(i(),c(L,{key:3},[s.sourceMode==="wp_users"?(i(),v(p,{key:0,onSubmit:t[4]||(t[4]=Y(()=>{},["prevent"])),"label-position":"top"},{default:r(()=>[a(b,{label:e.$t("Users")},{default:r(()=>[a(w,{class:"rich_select",multiple:"",filterable:"",remote:"",loading:s.wpLoading,"remote-method":n.searchWpUsers,placeholder:e.$t("Search and select users"),modelValue:s.selectedUserIds,"onUpdate:modelValue":t[1]||(t[1]=M=>s.selectedUserIds=M)},{default:r(()=>[(i(!0),c(L,null,D(s.wpUsers,M=>(i(),v(y,{class:"fcom_with_photo_option",key:M.ID,label:`${M.display_name} (${M.user_email||M.ID})`,value:M.ID},{default:r(()=>[l("span",$8,[l("img",{src:M.photo,alt:M.display_name},null,8,S8),l("span",null,d(M.display_name),1)]),l("span",V8,d(M.user_email||M.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["loading","remote-method","placeholder","modelValue"])]),_:1},8,["label"]),o.context==="space"?(i(),v(b,{key:0,label:e.$t("Membership Role")},{default:r(()=>[a(w,{modelValue:s.role,"onUpdate:modelValue":t[2]||(t[2]=M=>s.role=M),placeholder:e.$t("Select Role")},{default:r(()=>[a(y,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(y,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(y,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(b,null,{default:r(()=>[s.selectedUserIds.length>1&&!e.appVars.pro?(i(),c("div",L8,[l("p",null,[V(d(e.$t("Bulk adding requires FluentCommunity Pro."))+" ",1),e.appVars.upgrade_url?(i(),c("a",{key:0,href:e.appVars.upgrade_url,target:"_blank"},d(e.$t("Upgrade")),9,M8)):_("",!0)])])):_("",!0),G((i(),v(C,{class:"fcom_primary_button",onClick:t[3]||(t[3]=M=>n.addWpUsers())},{default:r(()=>[V(d(o.context==="course"?e.$t("Add Students"):e.$t("Add as %s",s.role)),1)]),_:1})),[[B,s.saving]])]),_:1})]),_:1})):s.sourceMode==="from_source"?(i(),v(p,{key:1,"label-position":"top"},{default:r(()=>[a(b,{label:e.$t("Select Source Space or Course")},{default:r(()=>[a(k,{modelValue:s.selectedSourceId,"onUpdate:modelValue":t[5]||(t[5]=M=>s.selectedSourceId=M),placeholder_text:e.$t("Select a space or course..."),memberships:[o.target.id.toString()],onSelectedType:t[6]||(t[6]=M=>s.selectedSourceType=M),onSelectedSlug:t[7]||(t[7]=M=>s.selectedSourceSlug=M)},null,8,["modelValue","placeholder_text","memberships"])]),_:1},8,["label"]),l("div",F8,[l("p",null,d(o.context==="course"?e.$t("All users will be enrolled as Student."):e.$t("All users will be added as Member.")),1)]),a(C,{class:"fcom_primary_button",onClick:t[8]||(t[8]=M=>n.importFromSource())},{default:r(()=>[V(d(o.context==="course"?e.$t("Import Students"):e.$t("Import Members"))+" ",1),e.appVars.pro?_("",!0):(i(),c("span",T8," ย ("+d(e.$t("Pro"))+")",1))]),_:1})]),_:1})):s.sourceMode==="csv"?(i(),c("div",P8,[s.csvRows.length?(i(),c(L,{key:1},[l("div",D8,[l("div",null,[l("strong",null,d(s.csvFileName),1),l("span",R8,d(s.csvRows.length)+" "+d(e.$t("contacts")),1)]),a(C,{link:"",size:"small",onClick:t[10]||(t[10]=M=>n.resetCsvImport())},{default:r(()=>[V(d(e.$t("Change")),1)]),_:1})]),a(I,{data:s.csvRows.slice(0,5),size:"small",class:"fcom_mb_10"},{default:r(()=>[a($,{prop:"name",label:e.$t("Name"),"min-width":"120"},null,8,["label"]),a($,{prop:"email",label:e.$t("Email"),"min-width":"160"},null,8,["label"]),a($,{prop:"username",label:e.$t("Username"),"min-width":"110"},null,8,["label"])]),_:1},8,["data"]),s.csvRows.length>5?(i(),c("p",H8," + "+d(s.csvRows.length-5)+" "+d(e.$t("more rows")),1)):_("",!0),a(p,{"label-position":"top"},{default:r(()=>[a(b,null,{default:r(()=>[a(F,{modelValue:s.createMissingUsers,"onUpdate:modelValue":t[11]||(t[11]=M=>s.createMissingUsers=M)},{default:r(()=>[V(d(e.$t("Create WordPress accounts for new email addresses")),1)]),_:1},8,["modelValue"])]),_:1}),l("div",x8,[l("p",null,d(o.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(b,null,{default:r(()=>[a(C,{class:"fcom_primary_button",onClick:t[12]||(t[12]=M=>n.importCsv())},{default:r(()=>[V(d(o.context==="course"?e.$t("Import Students"):e.$t("Import Members")),1)]),_:1})]),_:1})]),_:1})],64)):(i(),c(L,{key:0},[l("div",I8,[t[17]||(t[17]=l("span",null,null,-1)),e.appVars.pro?(i(),v(C,{key:0,link:"",size:"small",onClick:t[9]||(t[9]=M=>n.downloadSampleCsv())},{default:r(()=>[V("โ†“ "+d(e.$t("Sample CSV")),1)]),_:1})):_("",!0)]),a(S,{drag:"",accept:".csv,.txt","auto-upload":!1,"show-file-list":!1,"on-change":n.onCsvFileChange,disabled:!e.appVars.pro},{tip:r(()=>[l("div",A8,d(e.$t("Columns: Name, Email, Username")),1)]),default:r(()=>[l("div",U8,[t[19]||(t[19]=l("div",{class:"fcom_csv_drop_arrow"},"โ†‘",-1)),l("div",B8,[V(d(e.$t("Drop CSV here or"))+" ",1),l("em",null,d(e.$t("click to browse")),1),t[18]||(t[18]=V()),e.appVars.pro?_("",!0):(i(),c("span",E8," ย ("+d(e.$t("Pro"))+")",1))])])]),_:1},8,["on-change","disabled"])],64))])):s.sourceMode==="crm_tag"?(i(),v(p,{key:3,"label-position":"top"},{default:r(()=>[a(b,{label:e.$t("FluentCRM Tag")},{default:r(()=>[a(w,{modelValue:s.selectedTagId,"onUpdate:modelValue":t[13]||(t[13]=M=>s.selectedTagId=M),loading:s.crmTagsLoading,placeholder:e.$t("Select a tag"),style:{width:"100%"}},{default:r(()=>[(i(!0),c(L,null,D(s.crmTags,M=>(i(),v(y,{key:M.id,label:M.title,value:M.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"])]),_:1},8,["label"]),a(b,null,{default:r(()=>[a(F,{modelValue:s.createMissingCrmUsers,"onUpdate:modelValue":t[14]||(t[14]=M=>s.createMissingCrmUsers=M)},{default:r(()=>[V(d(e.$t("Create WordPress accounts for contacts without an existing account")),1)]),_:1},8,["modelValue"])]),_:1}),l("div",j8,[l("p",null,d(o.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(C,{class:"fcom_primary_button",onClick:t[15]||(t[15]=M=>n.addFromCrmTag())},{default:r(()=>[V(d(o.context==="course"?e.$t("Add Students"):e.$t("Add Members")),1),e.appVars.pro?_("",!0):(i(),c("span",O8," ย ("+d(e.$t("Pro"))+")",1))]),_:1})]),_:1})):_("",!0)],64))])}const z8=P(c8,[["render",N8]]),q8={name:"SpaceMembers",props:["space","space_profile"],components:{Search:Fe,Pagination:$e,FollowAction:Qe,AddMemberForm:r8,AddMembersForm:z8},inheritAttrs:!1,data(){return{members:[],loading:!1,pagination:{page:1,per_page:20,total:0},status:"active",pending_count:0,working:!1,addingNewMember:!1,addingMember:!1,editing_member:{user_id:"",role:"member"},search:"",permission_failed:!1,memberLayout:this.appVars.features.member_list_layout||"classic"}},methods:{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}).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.working=!0,this.$post("spaces/"+this.space+"/members/remove",{user_id:e.user_id}).then(o=>{this.$notify.success(o.message),this.members.splice(t,1),this.members.length||this.fetch()}).catch(o=>{this.$handleError(o)}).finally(()=>{this.working=!1})},approveMember(e,t=null){this.working=!0,this.$post("spaces/"+this.space+"/members",{user_id:e.user_id}).then(o=>{if(this.$notify.success(o.message),t===null){this.fetch();return}this.members.splice(t,1),this.members.length||this.fetch()}).catch(o=>{this.$handleError(o)}).finally(()=>{this.working=!1})},initAddMember(e,t=null){this.editing_member=e?{user_id:e.user_id,role:e.role,editing_user:e.xprofile}:{user_id:"",role:"member"},e&&this.$refs.edit_member_pop&&this.$refs.edit_member_pop.hide(),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.fetch()}},G8={ref:"space_members"},Y8={key:0,class:"card_header"},W8={class:"member_status"},Z8={class:"add_member"},K8={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},J8={class:"permission_failed"},Q8=["href"],X8={key:2},e4={class:"search_member fcom_mb_20"},t4={class:"card_list"},s4={class:"card_content"},o4={class:"card_avatar"},i4={class:"card_info"},n4={class:"card_name"},l4={class:"info_header"},a4={class:"meta_line"},r4={class:"feed_meta_info"},c4=["title"],d4=["title"],u4=["title"],_4={key:0,class:"card_description"},m4={class:"card_footer"},h4={class:"card_action"},f4={class:"actions_items"},p4=["onClick"],g4=["onClick"],y4={class:"pagination_wrap"},v4={key:0,class:"loading"},b4={key:1,class:"no_members"},k4={key:0},w4={key:1};function C4(e,t,o,u,s,n){const m=Ye,f=ve,h=O,y=g("Search"),w=N,b=X,C=g("UserAvatar"),p=g("UserRouteLink"),k=Be,S=g("FollowAction"),$=g("MoreFilled"),I=fe,F=g("Pagination"),B=W,M=g("add-members-form"),E=bt,A=g("add-member-form"),U=Q("loading");return i(),c(L,null,[l("div",G8,null,512),e.hasSpaceAdminAccess(o.space_profile)?(i(),c("div",Y8,[l("div",W8,[s.pending_count?(i(),v(f,{key:0,onChange:n.toSearch,modelValue:s.status,"onUpdate:modelValue":t[0]||(t[0]=T=>s.status=T),class:"status_group"},{default:r(()=>[a(m,{value:"active"},{default:r(()=>[V(d(e.$t("Active")),1)]),_:1}),a(m,{value:"pending"},{default:r(()=>[V(d(e.$t("Pending"))+" ("+d(s.pending_count)+")",1)]),_:1})]),_:1},8,["onChange","modelValue"])):_("",!0)]),l("div",Z8,[a(h,{class:"fcom_primary_button",onClick:t[1]||(t[1]=T=>s.addingNewMember=!0)},{default:r(()=>[V(d(e.$t("Add Member")),1)]),_:1}),a(h,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=T=>e.$router.push({name:"space_invitations"}))},{default:r(()=>[V(d(e.$t("Invitations")),1)]),_:1})])])):_("",!0),s.permission_failed?(i(),c("div",K8,[l("div",J8,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view all members")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:o.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,Q8)])])):(i(),c("div",X8,[l("div",e4,[a(b,{clearable:"",onClear:n.toSearch,onKeydown:ye(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[3]||(t[3]=T=>s.search=T),placeholder:e.$t("Search...")},{prefix:r(()=>[a(w,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",{class:R(["fcom_dir_layout_"+s.memberLayout,"space_members fcom_dir_layout"])},[G((i(),c("div",t4,[(i(!0),c(L,null,D(s.members,(T,j)=>{var z,ne,x;return G((i(),c("div",{key:T.id,class:"each_card"},[l("div",s4,[l("div",o4,[a(C,{xprofile:T.xprofile,is_online:e.isOnline(T.xprofile.last_activity)},null,8,["xprofile","is_online"])]),l("div",i4,[l("div",n4,[l("div",l4,[a(p,{xprofile:T.xprofile,show_badge:!0,show_follow:!0},null,8,["xprofile"]),l("div",a4,"@"+d((z=T.xprofile)==null?void 0:z.username),1)]),l("div",r4,[s.status!="pending"&&T.created_at?(i(),c("div",{key:0,title:T.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(T.created_at))),9,c4)):T.created_at?(i(),c("div",{key:1,title:T.created_at,class:"meta_line"},d(e.$t("Requested %s",e.humanDateDiff(T.created_at))),9,d4)):_("",!0),T.xprofile.last_activity?(i(),c("div",{key:2,title:T.xprofile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(T.xprofile.last_activity))),9,u4)):_("",!0)]),(ne=T.xprofile)!=null&&ne.short_description?(i(),c("div",_4,d(e.getExcerpt(((x=T.xprofile.meta)==null?void 0:x.short_description_rendered)||T.xprofile.short_description,120)),1)):_("",!0),T.role!="member"?(i(),v(k,{key:1,type:"success"},{default:r(()=>[V(d(e.$labelize(T.role)),1)]),_:2},1024)):_("",!0)]),s.status=="pending"?(i(),c(L,{key:0},[t[9]||(t[9]=l("div",{class:"card_break"},null,-1)),l("div",m4,[a(h,{class:"fcom_primary_button",onClick:ee=>n.approveMember(T,j)},{default:r(()=>[V(d(e.$t("Approve")),1)]),_:1},8,["onClick"]),a(h,{class:"fcom_secondary_button",onClick:ee=>n.removeMember(T,j)},{default:r(()=>[V(d(e.$t("Decline")),1)]),_:1},8,["onClick"])])],64)):_("",!0)])]),l("div",h4,[a(S,{profile:T.xprofile},null,8,["profile"]),s.status!="pending"&&o.space_profile&&e.hasInPermission("can_remove_member",o.space_profile.permissions)?(i(),v(I,{key:0,placement:"bottom",width:200,trigger:"click",persistent:!1,ref_for:!0,ref:"userPopoverRef_"+T.user_id},{reference:r(()=>[a(h,{"aria-label":e.$t("View actions"),size:"small",text:""},{default:r(()=>[a(w,{class:"fcom_more_icon"},{default:r(()=>[a($)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[l("ul",f4,[l("li",{onClick:ee=>n.removeMemberPrompt(T,j)},d(e.$t("Remove Member")),9,p4),l("li",{onClick:ee=>n.initAddMember(T,ee)},d(e.$t("Change Membership")),9,g4)])]),_:2},1536)):_("",!0)])])),[[U,s.working]])}),128))])),[[U,s.loading]]),l("div",y4,[a(F,{hide_on_single:!0,onFetch:t[4]||(t[4]=T=>n.fetch()),pagination:s.pagination},null,8,["pagination"])]),s.loading&&!s.pagination.total?(i(),c("div",v4,[a(B,{class:"white_loaded",rows:3,animated:!0}),a(B,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):!s.loading&&!s.members.length?(i(),c("div",b4,d(e.$t("No %s members found in this community.",s.status)),1)):_("",!0)],2)])),s.addingNewMember?(i(),v(E,{key:3,modelValue:s.addingNewMember,"onUpdate:modelValue":t[6]||(t[6]=T=>s.addingNewMember=T),"close-on-click-modal":!1,"append-to-body":!0,size:e.drawerWidth,direction:"rtl"},{header:r(()=>[l("h4",null,d(e.$t("Add Member")),1)]),default:r(()=>[s.addingNewMember?(i(),v(M,{key:0,context:"space",target:o.space_profile,onCompleted:n.handleBulkMemberAdded,onMembersAdded:t[5]||(t[5]=T=>n.fetch())},null,8,["target","onCompleted"])):_("",!0)]),_:1},8,["modelValue","size"])):_("",!0),s.addingMember?(i(),v(E,{key:4,modelValue:s.addingMember,"onUpdate:modelValue":t[8]||(t[8]=T=>s.addingMember=T),"close-on-click-modal":!1,"append-to-body":!0,size:e.drawerWidth,direction:"rtl"},{header:r(()=>[s.editing_member.editing_user?(i(),c("h4",k4,d(e.$t("Update Role")),1)):(i(),c("h4",w4,d(e.$t("Add Member")),1))]),default:r(()=>[s.addingMember?(i(),v(A,{key:0,space_profile:o.space_profile,modelValue:s.editing_member,"onUpdate:modelValue":t[7]||(t[7]=T=>s.editing_member=T),onCompleted:n.handleMemberUpdated},null,8,["space_profile","modelValue","onCompleted"])):_("",!0)]),_:1},8,["modelValue","size"])):_("",!0)],64)}const $4=P(q8,[["render",C4]]);const S4={name:"DocumentUploadForm",components:{CreateStatusForm:Ft},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")}}},V4={class:"fcom_document_upload_form"};function L4(e,t,o,u,s,n){const m=_e,f=g("CreateStatusForm");return i(),c("div",V4,[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:s.post,"default-state":"active",disableUpload:!0,space:o.space_profile.slug,onAdded:n.resetForm},{before_submit_btn:r(()=>[a(m,{onChange:t[0]||(t[0]=h=>{e.$refs.createStatusForm.feed.status=h}),"true-value":"published","false-value":"unlisted",modelValue:s.post_status,"onUpdate:modelValue":t[1]||(t[1]=h=>s.post_status=h)},{default:r(()=>[V(d(e.$t("Publish as a post")),1)]),_:1},8,["modelValue"])]),_:1},8,["default_placeholder","initial_placeholder","btn_text","editing_feed","space","onAdded"])])}const M4=P(S4,[["render",L4]]),F4={name:"DocumentFeedCard",components:{ChatIcon:Ze,HeartIcon:Ke,DocumentLists:Je,UserRouteLink:Me},props:["feed"]},T4={class:"fcom_document_feed_card feed"},P4={class:"feed_header"},I4={key:0,class:"feed_user"},U4={class:"feed_user_name"},B4={class:"feed_title"},E4={class:"feed_title_heading"},A4=["href"],D4={class:"feed_meta_info"},R4=["href"],H4=["title"],x4=["href"],j4={style:{"margin-left":"5px","margin-right":"7px"}},O4=["href"],N4={style:{"margin-left":"5px"}},z4={class:"feed_body"};function q4(e,t,o,u,s,n){var w,b,C,p,k;const m=g("ChatIcon"),f=N,h=g("HeartIcon"),y=g("DocumentLists");return i(),c("div",T4,[l("div",P4,[o.feed.xprofile?(i(),c("div",I4,[l("div",U4,[l("div",B4,[l("h2",E4,[l("a",{href:o.feed.permalink},d(o.feed.title||e.$t("Uploaded %s files",((b=(w=o.feed.meta)==null?void 0:w.document_lists)==null?void 0:b.length)||"--")),9,A4)])])]),l("div",D4,[l("a",{onClick:t[0]||(t[0]=(...S)=>e.gotoFeed&&e.gotoFeed(...S)),href:o.feed.permalink,class:"feed_timestamp"},[l("span",{title:o.feed.created_at,style:{padding:"0 7px 0 0"}},d(e.humanDateDiff(o.feed.created_at))+" "+d(e.$t("by %s",(C=o.feed.xprofile)==null?void 0:C.display_name)),9,H4)],8,R4),o.feed.comments_count?(i(),c("a",{key:0,onClick:t[1]||(t[1]=(...S)=>e.gotoFeed&&e.gotoFeed(...S)),href:o.feed.permalink,class:"feed_timestamp"},[a(f,{style:{"margin-left":"7px"}},{default:r(()=>[a(m)]),_:1}),l("span",j4,d(o.feed.comments_count),1)],8,x4)):_("",!0),o.feed.reactions_count?(i(),c("a",{key:1,onClick:t[2]||(t[2]=(...S)=>e.gotoFeed&&e.gotoFeed(...S)),href:o.feed.permalink,class:"feed_timestamp"},[a(f,{style:{"margin-left":"7px"}},{default:r(()=>[a(h,{filled:!0})]),_:1}),l("span",N4,d(o.feed.reactions_count),1)],8,O4)):_("",!0)])])):_("",!0)]),l("div",z4,[a(y,{document_lists:(k=(p=o.feed)==null?void 0:p.meta)==null?void 0:k.document_lists},null,8,["document_lists"])])])}const G4=P(F4,[["render",q4]]);const Y4={name:"SpaceDocuments",props:["space","space_profile"],components:{FeedListItem:Js,Feed:Xe,DocumentUploadForm:M4,UploadFilled:gt,Search:Fe,Pagination:$e,DocumentFeedCard:G4},emits:["refetch"],inheritAttrs:!1,data(){return{documents:[],loading:!1,pagination:{page:1,per_page:20,total:0},working:!1,search:"",SearchIcon:qt(Fe),permission_failed:!1,show_uploader:!1}},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 n;if(this.pagination.last_page==this.pagination.page)return;let t=document.querySelector(".all_documents_wrap .feed_outer:last-child");if(!t)return;let o=t.getBoundingClientRect(),u=(n=window.fcomLayoutRef)==null?void 0:n.wrapRef;!u||o.bottom-u.getBoundingClientRect().bottom-o.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))}},W4={ref:"space_docs"},Z4={class:"card_header"},K4={class:"member_status"},J4={key:0,class:"add_member"},Q4={key:0},X4={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},e5={class:"permission_failed"},t5=["href"],s5={key:2},o5={class:"search_member"},i5={class:""},n5={class:"card_list"},l5={class:"all_documents_wrap"},a5={key:0,style:{"margin-top":"20px","text-align":"center"}},r5={key:1,class:"loading"},c5={key:2,class:"no_members"};function d5(e,t,o,u,s,n){var k,S;const m=g("UploadFilled"),f=N,h=O,y=g("document-upload-form"),w=g("Search"),b=X,C=g("document-feed-card"),p=W;return i(),c(L,null,[l("div",W4,null,512),l("div",Z4,[l("div",K4,[l("h3",null,d(e.$t("Documents and Files")),1)]),(S=(k=o.space_profile)==null?void 0:k.permissions)!=null&&S.can_upload_documents?(i(),c("div",J4,[s.show_uploader?(i(),v(h,{key:1,plain:"",onClick:t[1]||(t[1]=$=>s.show_uploader=!1),size:"small"},{default:r(()=>[l("span",null,d(e.$t("Cancel")),1)]),_:1})):(i(),v(h,{key:0,onClick:t[0]||(t[0]=$=>s.show_uploader=!0),class:"fcom_primary_button"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1}),l("span",null,d(e.$t("New Documents")),1)]),_:1}))])):_("",!0)]),s.show_uploader?(i(),c("div",Q4,[a(y,{onRefetch:t[2]||(t[2]=()=>{n.toSearch(),s.show_uploader=!1}),space_profile:o.space_profile,reload:n.toSearch},null,8,["space_profile","reload"])])):_("",!0),s.permission_failed?(i(),c("div",X4,[l("div",e5,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view this page")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:o.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,t5)])])):(i(),c("div",s5,[l("div",o5,[a(b,{clearable:"",onClear:n.toSearch,onKeydown:ye(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[3]||(t[3]=$=>s.search=$),placeholder:e.$t("Search...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",i5,[l("div",n5,[l("div",l5,[(i(!0),c(L,null,D(s.documents,$=>(i(),c("div",{key:$.id,class:"feed_outer"},[a(C,{feed:$},null,8,["feed"])]))),128))])]),!s.loading&&s.pagination.last_page!=s.pagination.page?(i(),c("div",a5,[a(h,{class:"fcom_secondary_button",disabled:s.loading,onClick:t[4]||(t[4]=$=>{s.pagination.page++,n.fetch(!0)})},{default:r(()=>[V(d(e.$t("Load more")),1)]),_:1},8,["disabled"])])):_("",!0),s.loading?(i(),c("div",r5,[a(p,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5})])):!s.loading&&!s.documents.length?(i(),c("div",c5,d(e.$t("No documents found in this space based on your search criteria.")),1)):_("",!0)])]))],64)}const u5=P(Y4,[["render",d5]]);const _5={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()}},m5={class:"fcom_invitations"},h5={style:{margin:"20px 0"},class:"fcom_spaced_flex"},f5={key:0},p5={key:0,class:"fcom_person_name"},g5={key:1,class:"fcom_person_name"},y5={key:3,style:{margin:"0",padding:"0"}},v5={class:"fcom_person_name"};function b5(e,t,o,u,s,n){const m=oe,f=ie,h=g("CopyDocument"),y=N,w=O,b=Is,C=g("UserRouteLink"),p=Us,k=g("Pagination"),S=Q("loading");return i(),c("div",m5,[l("div",h5,[l("h4",null,d(e.$t("Invitations")),1),e.has_pro?(i(),c("div",f5,[a(f,{style:{"min-width":"150px"},onChange:t[0]||(t[0]=$=>{s.pagination.page=1,n.getInvitations()}),modelValue:s.status,"onUpdate:modelValue":t[1]||(t[1]=$=>s.status=$)},{default:r(()=>[(i(),c(L,null,D(["all","pending","accepted","active","expired"],$=>a(m,{key:$,label:e.ucFirst($),value:$},null,8,["label","value"])),64))]),_:1},8,["modelValue"])])):_("",!0)]),G((i(),v(p,{data:s.invitations,border:"","empty-text":n.getEmptyText,style:{width:"100%","border-radius":"8px"}},{default:r(()=>[a(b,{prop:"message",label:e.$t("Invitee"),"min-width":"180"},{default:r($=>[$.row.message?(i(),c("span",p5,d($.row.meta.invitee_name)+" <"+d($.row.message)+"> ",1)):(i(),c("span",g5,d($.row.meta.title)+" ("+d(e.$t("Invitation Link"))+") ",1)),$.row.access_url?(i(),v(w,{key:2,type:"info",size:"small",text:"",onClick:I=>e.$toClipboard($.row.access_url,e.$t("Invitation link has been copied to clipboard"))},{default:r(()=>[a(y,{title:e.$t("Copy Invitation URl")},{default:r(()=>[a(h)]),_:1},8,["title"]),l("span",null,d(e.$t("Copy Link")),1)]),_:1},8,["onClick"])):_("",!0),$.row.message?_("",!0):(i(),c("p",y5,d($.row.meta.limit?e.$t("Limit")+": "+$.row.meta.limit:"")+" "+d(parseInt($.row.reactions_count)>0?" | "+e.$t("Usage")+": "+$.row.reactions_count:"")+" "+d($.row.meta.expire_date?" | "+e.$t("Expire Date")+": "+e.smartDate($.row.meta.expire_date):""),1))]),_:1},8,["label"]),s.is_mod?(i(),v(b,{key:0,prop:"user_id",label:e.$t("Invited By"),width:"180"},{default:r($=>[l("span",v5,[a(C,{xprofile:$.row.xprofile},null,8,["xprofile"])])]),_:1},8,["label"])):_("",!0),a(b,{prop:"status",label:e.$t("Status"),width:"120"},{default:r($=>[l("span",null,d(e.$labelize($.row.status)),1)]),_:1},8,["label"]),a(b,{label:e.$t("Actions")},{default:r($=>[$.row.status=="pending"?G((i(),v(w,{key:0,class:"fcom_primary_button",text:"",onClick:I=>n.handleResend($.row)},{default:r(()=>[V(d(e.$t("Resend")),1)]),_:1},8,["onClick"])),[[S,s.loading]]):_("",!0),a(w,{onClick:I=>n.handleDelete($.row),text:"",type:"danger"},{default:r(()=>[V(d(e.$t("Delete")),1)]),_:1},8,["onClick"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[S,s.loading]]),a(k,{hide_on_single:!1,pagination:s.pagination,onFetch:n.getInvitations},null,8,["pagination","onFetch"])])}const k5=P(_5,[["render",b5]]);const w5={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}))}}},C5={class:"fcom_invitation_link_wrap"},$5={class:"fcom_invite_head"},S5={class:"fcom_invite_body"},V5={key:1},L5={key:1,style:{padding:"20px"}},M5={style:{"font-size":"20px",margin:"20px 0","text-align":"center"}};function F5(e,t,o,u,s,n){const m=X,f=de,h=Ge,y=O,w=ue,b=g("CopyDocument"),C=N;return i(),c("div",C5,[l("div",$5,[l("h4",null,d(e.$t("Create an invitation link")),1),l("p",null,d(e.$t("Create a simple link to share with potential members. Anyone with the link can join this space.")),1)]),l("div",S5,[s.createdItem?(i(),c("div",L5,[l("h4",M5,d(e.$t("Please share this url to your audience to join this space")),1),a(m,{modelValue:s.createdItem.access_url,"onUpdate:modelValue":t[6]||(t[6]=p=>s.createdItem.access_url=p),readonly:""},{suffix:r(()=>[a(y,{class:"fcomc_button_primary",onClick:t[5]||(t[5]=p=>e.$toClipboard(s.createdItem.access_url,e.$t("Invitation link has been copied to your clipboard")))},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1}),l("span",null,d(e.$t("Copy")),1)]),_:1})]),_:1},8,["modelValue"])])):(i(),v(w,{key:0,onSubmit:t[3]||(t[3]=Y(p=>e.doNothing(),["prevent"])),modelValue:s.form,"onUpdate:modelValue":t[4]||(t[4]=p=>s.form=p),"label-position":"top"},{default:r(()=>[a(f,{label:e.$t("Invitation Link Title")},{default:r(()=>[a(m,{modelValue:s.form.title,"onUpdate:modelValue":t[0]||(t[0]=p=>s.form.title=p),placeholder:e.$t("Enter a title for the invitation link")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Limit the number of uses")},{default:r(()=>[a(m,{type:"number",modelValue:s.form.limit,"onUpdate:modelValue":t[1]||(t[1]=p=>s.form.limit=p),placeholder:e.$t("Leave empty for unlimited uses")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Expire Date (Leave empty for no expiration)")},{default:r(()=>[a(h,{style:{"min-width":"300px"},modelValue:s.form.expire_date,"onUpdate:modelValue":t[2]||(t[2]=p=>s.form.expire_date=p),type:"date",placeholder:e.$t("Leave empty for no expiration"),"value-format":"YYYY-MM-DD",format:"YYYY-MM-DD"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,null,{default:r(()=>[e.has_pro?(i(),v(y,{key:0,onClick:n.createLink,loading:s.creating,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Create Invitation Link")),1)]),_:1},8,["onClick","loading"])):(i(),c("div",V5,[l("p",null,d(e.$t("This feature is only available in the Pro version of FluentCommunity. Please upgrade")),1)]))]),_:1})]),_:1},8,["modelValue"]))])])}const T5=P(w5,[["render",F5]]),P5={name:"SpaceInviations",components:{CreateInvitationLink:T5,PendingInvitations:k5},props:["space_profile"],data(){return{currentTab:"invitations"}}},I5={key:0,class:"card_header"},U5={class:"permission_failed"},B5=["href"],E5={key:1};function A5(e,t,o,u,s,n){const m=g("pending-invitations"),f=wt,h=g("CreateInvitationLink"),y=Ct;return e.hasSpaceAdminAccess(o.space_profile)?(i(),c("div",E5,[a(y,{modelValue:s.currentTab,"onUpdate:modelValue":t[0]||(t[0]=w=>s.currentTab=w),type:"border-card"},{default:r(()=>[a(f,{name:"invitations",label:e.$t("Invitations")},{default:r(()=>[s.currentTab=="invitations"?(i(),v(m,{key:0,space_id:o.space_profile.id},null,8,["space_id"])):_("",!0)]),_:1},8,["label"]),a(f,{name:"invitation_links",label:e.$t("New Invitation Link")},{default:r(()=>[s.currentTab=="invitation_links"?(i(),v(h,{key:0,space_profile:o.space_profile},null,8,["space_profile"])):_("",!0)]),_:1},8,["label"])]),_:1},8,["modelValue"])])):(i(),c("div",I5,[l("div",U5,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view invitations")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:o.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,B5)])]))}const D5=P(P5,[["render",A5]]),R5={name:"GlobIcon"},H5={width:"14",height:"14",viewBox:"0 0 14 14",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};function x5(e,t,o,u,s,n){return i(),c("svg",H5,[...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 fo=P(R5,[["render",x5]]),j5={name:"GroupIcon"},O5={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function N5(e,t,o,u,s,n){return i(),c("svg",O5,[...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 rs=P(j5,[["render",N5]]),z5={name:"AllCommunities",components:{User:Eo,GlobIcon:fo,Layout:ke,AppLayout:Se,CreateSpaceForm:Bt,GroupIcon:rs,Pagination:$e,Search:Fe},setup(){return{spaceStore:Re()}},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,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 o=e.replace(/(<([^>]+)>)/ig,"");return o.length>t&&(o=o.substring(0,t)+"..."),o},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)}},q5={class:"object_menu"},G5={class:"fcom_space_menu_ul"},Y5={key:0},W5={key:1},Z5={class:"actions_items"},K5={class:"search_member"},J5={class:"feed_filters"},Q5={id:"feed_short_by",class:"fcom_feed_filter_label"},X5={class:"fcom_communities"},e6={key:0,class:"fcom_no_items_wrap"},t6={key:1,class:"fcom_box_card_list"},s6={class:"fcom_box_card_avatar"},o6=["src"],i6=["src"],n6=["alt","src"],l6={class:"fcom_box_card_info"},a6={class:"fcom_box_card_name"},r6={key:0},c6={class:"fcom_box_card_details"},d6={class:"details_item"},u6={key:0,class:"details_item"},_6=["innerHTML"],m6={class:"fcom_box_card_action"},h6=["disabled","onClick"],f6=["onClick"];function p6(e,t,o,u,s,n){const m=O,f=g("MoreFilled"),h=N,y=fe,w=g("Search"),b=X,C=oe,p=ie,k=g("router-link"),S=Be,$=g("GlobIcon"),I=g("Lock"),F=g("GroupIcon"),B=g("pagination"),M=g("layout"),E=g("app-layout"),A=Q("loading");return i(),v(E,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(M,{content_class:"no_bg_layout",title:e.$t("Spaces")+" "+(s.pagination.total?" ("+e.$formatNumber(s.pagination.total)+")":"")},{actions:r(()=>[l("div",q5,[l("ul",G5,[l("li",null,[l("a",{onClick:t[0]||(t[0]=Y(U=>n.SwitchToSpaceView("all"),["prevent"])),class:R(s.type=="all"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("All Spaces")),3)]),e.auth.user_id?(i(),c("li",Y5,[l("a",{onClick:t[1]||(t[1]=Y(U=>n.SwitchToSpaceView("joined"),["prevent"])),class:R(s.type=="joined"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("My Spaces")),3)])):_("",!0),e.isAdmin()?(i(),c("li",W5,[a(m,{onClick:t[2]||(t[2]=U=>n.fireCreateSpace()),class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("New Space")),1)]),_:1})])):_("",!0)]),e.isAdmin()?(i(),v(y,{key:0,persistent:!1,ref:"space_actions",placement:"bottom",width:200,trigger:"click"},{reference:r(()=>[a(m,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(f)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[l("ul",Z5,[l("li",{onClick:t[3]||(t[3]=(...U)=>n.goToSpaceGroups&&n.goToSpaceGroups(...U))},d(e.$t("View Space Groups")),1)])]),_:1},512)):_("",!0)])]),default:r(()=>[l("div",K5,[a(b,{clearable:"",onClear:n.toSearch,onKeydown:ye(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[4]||(t[4]=U=>s.search=U),placeholder:e.$t("Search Space...")},{prefix:r(()=>[a(h,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",J5,[t[7]||(t[7]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",Q5,d(e.$t("Sort by:")),1),a(p,{"aria-label":e.$t("Sort Spaces by"),modelValue:s.sort_by,"onUpdate:modelValue":t[5]||(t[5]=U=>s.sort_by=U),class:"fcom_minimal_select space_sort_select","popper-class":"plain_select",onChange:t[6]||(t[6]=U=>n.changeSortBy())},{default:r(()=>[a(C,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"]),a(C,{value:"latest",label:e.$t("Latest Spaces")},null,8,["label"]),a(C,{value:"oldest",label:e.$t("Oldest Spaces")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),G((i(),c("div",X5,[!s.loading&&s.communities.length==0?(i(),c("div",e6,[s.search?(i(),c(L,{key:0},[l("h3",null,d(e.$t("No spaces found based on your search criteria")),1),l("p",null,d(e.$t("No spaces match your search criteria. Try adjusting your search terms or browse our space catalog.")),1)],64)):(i(),c(L,{key:1},[l("h3",null,d(e.$t("No spaces found")),1),l("p",null,d(e.$t("Please check back later. We are in a process to publish some spaces for you!")),1)],64))])):(i(),c("div",t6,[(i(!0),c(L,null,D(s.communities,U=>(i(),c("div",{role:"region","aria-label":"Space Lists",key:U.id,class:"fcom_each_box_card"},[l("div",s6,[a(k,{"aria-label":"Go to Space",to:n.getSpaceFeedsRoute(U.slug)},{default:r(()=>{var T;return[(T=U.settings)!=null&&T.og_image?(i(),c("img",{key:0,src:U.settings.og_image,alt:""},null,8,o6)):U.cover_photo?(i(),c("img",{key:1,src:U.cover_photo,alt:""},null,8,i6)):(i(),c("img",{key:2,alt:e.$t("Placeholder image"),src:e.appVars.assets_url+"images/space-placeholder.jpg"},null,8,n6))]}),_:2},1032,["to"])]),l("div",l6,[l("div",a6,[a(k,{to:n.getSpaceFeedsRoute(U.slug)},{default:r(()=>[V(d(n.getExcerpt(U.title,24))+" ",1),U.space_pivot?(i(),v(S,{key:0,type:"success"},{default:r(()=>[V(d(e.$labelize(U.space_pivot.role))+" ",1),U.space_pivot.status!="active"?(i(),c("span",r6," ("+d(e.$labelize(U.space_pivot.status))+") ",1)):_("",!0)]),_:2},1024)):_("",!0)]),_:2},1032,["to"])]),l("div",c6,[l("div",d6,[U.privacy==="public"?(i(),v(h,{key:0},{default:r(()=>[a($)]),_:1})):(i(),v(h,{key:1},{default:r(()=>[a(I)]),_:1})),l("span",null,d(e.$labelize(U.privacy)),1)]),U.members_count?(i(),c("div",u6,[a(h,null,{default:r(()=>[a(F)]),_:1}),l("span",null,d(e.$_n("%s Member","%s Members",e.$formatNumber(U.members_count))),1)])):_("",!0)]),U.description?(i(),c("div",{key:0,class:"fcom_box_card_description",innerHTML:n.getExcerpt(U.description_rendered,85)},null,8,_6)):_("",!0),l("div",m6,[U.space_pivot?(i(),c("button",{key:1,class:"fcom_card_button",onClick:T=>n.goToSpaceFeeds(U.slug)},d(e.$t("View Space")),9,f6)):G((i(),c("button",{key:0,class:"fcom_card_button",disabled:s.joining===U.slug,onClick:T=>n.join(U)},[V(d(e.$t("Join")),1)],8,h6)),[[A,s.joining===U.slug]])])])]))),128))])),a(B,{hide_on_single:!0,onFetch:n.getCommunities,pagination:s.pagination},null,8,["onFetch","pagination"])])),[[A,s.loading]])]),_:1},8,["title"])]),_:1})}const g6=P(z5,[["render",p6]]),y6={name:"UserBadge",props:["badge","is_preview","profile"],computed:{renderingBadges(){var e;if(!this.appVars.user_badges&&!this.is_preview)return null;if(this.profile){let t=this.profile.badge_slugs;if(t||(t=(e=this.profile.meta)==null?void 0:e.badge_slug,typeof t=="string"&&(t=[t])),!t||t.length==0)return null;let o=[];for(let u=0;u(i(),c("div",{class:R([{user_icon_only:h.show_label!="yes"},"user_badge"])},[a(f,{content:h.title,placement:"top"},{default:r(()=>[l("div",{style:re({backgroundColor:h.background_color,color:h.color,borderColor:h.color}),class:"user_badge_inner"},[h.config?(i(),c(L,{key:0},[h.config.logo?(i(),c("img",{key:0,alt:"",src:h.config.logo},null,8,v6)):h.config.emoji?(i(),c("span",b6,d(h.config.emoji),1)):h.config.shape_svg?(i(),c("span",k6,[a(m,{innerHTML:h.config.shape_svg},null,8,["innerHTML"])])):_("",!0)],64)):_("",!0),h.show_label=="yes"?(i(),c("span",w6,d(h.title),1)):_("",!0)],4)]),_:2},1032,["content"])],2))),256)):_("",!0)}const po=P(y6,[["render",C6]]),$6={name:"AddNotificationIcon"},S6={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 V6(e,t,o,u,s,n){return i(),c("svg",S6,[...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 L6=P($6,[["render",V6]]),M6={name:"NotificationAddedIcon"},F6={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 T6(e,t,o,u,s,n){return i(),c("svg",F6,[...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 P6=P(M6,[["render",T6]]),I6={name:"AddUserForm",components:{SpaceIcon:Oe,SpaceCourseSelector:Et},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 U6(e,t,o,u,s,n){const m=X,f=de,h=g("SpaceCourseSelector"),y=oe,w=ie,b=O,C=ue,p=Q("loading");return i(),v(C,{onSubmit:t[4]||(t[4]=Y(k=>e.doNothing(),["prevent"])),"label-position":"top"},{default:r(()=>[a(f,{label:e.$t("User")},{default:r(()=>[a(m,{modelValue:o.user_profile.display_name+" ("+o.user_profile.email+")",disabled:""},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("Select Space/Course")},{default:r(()=>[G(a(h,{modelValue:s.selectedId,"onUpdate:modelValue":t[0]||(t[0]=k=>s.selectedId=k),memberships:s.userMemberships,placeholder_text:e.$t("Select Space/Course"),onSelectedType:n.updateSelectedType,onSelectedSlug:n.updateSelectedSlug},null,8,["modelValue","memberships","placeholder_text","onSelectedType","onSelectedSlug"]),[[p,s.loading]])]),_:1},8,["label"]),s.selectedType==="space"?(i(),v(f,{key:0,label:e.$t("Membership Role")},{default:r(()=>[a(w,{placeholder:e.$t("Select Role"),modelValue:s.role,"onUpdate:modelValue":t[1]||(t[1]=k=>s.role=k)},{default:r(()=>[a(y,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(y,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(y,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"])):_("",!0),q(e.$slots,"after_form",{},()=>[a(f,null,{default:r(()=>[s.selectedType==="course"?G((i(),v(b,{key:0,class:"fcom_primary_button",disabled:s.saving||!s.selectedId,onClick:t[2]||(t[2]=k=>n.addToCourse())},{default:r(()=>[V(d(e.$t("Add to Course")),1)]),_:1},8,["disabled"])),[[p,s.saving]]):G((i(),v(b,{key:1,class:"fcom_primary_button",disabled:s.saving||!s.selectedId,onClick:t[3]||(t[3]=k=>n.addToSpace())},{default:r(()=>[V(d(e.$t("Add to Space")),1)]),_:1},8,["disabled"])),[[p,s.saving]])]),_:1})])]),_:3})}const B6=P(I6,[["render",U6]]),E6={name:"ProfileHeader",emits:["refetch"],setup(){return{userStore:Ue()}},components:{UserBadge:po,ImageUploader:je,BookmarkIcon:Zs,FollowAction:Qe,AddNotificationIcon:L6,NotificationAddedIcon:P6,AddUserForm:B6},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=Ie(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 o;const e=this.auth.user_id,t=(o=this.profile)==null?void 0:o.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,o;if(!((t=this.profile)!=null&&t.user_id)||this.userStore.isBlocked(this.profile.user_id))return!1;const e=(o=this.profile)==null?void 0:o.follow;return this.showFollowAction&&(!e||String(e)!=="0")},isFollowing(){var t,o;if(!((t=this.profile)!=null&&t.user_id))return!1;if(this.userStore.isFollowing(this.profile.user_id))return!0;const e=(o=this.profile)==null?void 0:o.follow;return e!==void 0&&["1","2"].includes(String(e))},isNotificationOn(){var t,o;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((o=this.profile)==null?void 0:o.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})},removeCoverPhoto(){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()}}},A6={ref:"fcom_user_profile",class:"object_header user_header"},D6={key:0,class:"object_media_uploader"},R6={class:"object_info"},H6={class:"object_avatar"},x6=["alt","src"],j6={key:0,class:"object_avatar_uploader"},O6={key:1,style:{position:"absolute",right:"calc(12.5% - 9px)",bottom:"calc(36.5% - 5px)","line-height":"0",background:"rgb(67, 87, 173)",width:"20px",height:"20px","font-size":"12px",display:"flex","align-items":"center","justify-content":"center","border-radius":"50%",color:"#fff",border:"1px solid white"},role:"region","aria-label":"User Level",class:"fcom_user_level_mark"},N6={class:"object_name"},z6={class:"object_meta"},q6={key:0,class:"object_meta follower"},G6={class:"object_menu"},Y6={key:0,class:"fcom_profile_nav"},W6=["href","target"],Z6={key:1,class:"fcom_profile_menu_actions"},K6=["target","href"];function J6(e,t,o,u,s,n){var U,T,j,z,ne,x,ee,H,te;const m=O,f=g("image-uploader"),h=g("UploadFilled"),y=N,w=g("verified-sign"),b=g("UserBadge"),C=g("router-link"),p=g("FollowAction"),k=g("NotificationAddedIcon"),S=g("AddNotificationIcon"),$=g("MoreFilled"),I=ct,F=dt,B=ut,M=g("add-user-form"),E=bt,A=Q("loading");return G((i(),c("div",A6,[l("div",{style:re({backgroundImage:`url('${n.user_profile.cover_photo||""}')`}),class:R(["object_cover",{no_cover:!n.user_profile.cover_photo}])},[n.isOwnProfile?(i(),c("div",D6,[a(f,{additionalData:{resize:!0,max_width:1500},onUploaded:n.handleCoverPhotoUpload},{default:r(()=>[a(m,{title:e.$t("Recommended Size: 1200 x 375px"),size:"small",plain:"",type:"primary"},{default:r(()=>[V(d(n.getCoverPhotoButtonText),1)]),_:1},8,["title"])]),_:1},8,["onUploaded"]),n.user_profile.cover_photo?(i(),v(m,{key:0,class:"fcom_mt_10",size:"small",plain:"",type:"danger",onClick:Y(n.removeCoverPhoto,["prevent"])},{default:r(()=>[V(d(e.$t("Remove")),1)]),_:1},8,["onClick"])):_("",!0)])):_("",!0)],6),l("div",R6,[l("div",H6,[l("img",{alt:e.$t("Placeholder Photo"),src:n.user_profile.avatar||e.appVars.assets_url+"/images/placeholder.png"},null,8,x6),n.isOwnProfile?(i(),c("div",j6,[a(f,{additionalData:{resize:!0,max_width:200},button_text:e.$t("Change"),onUploaded:n.handlePhotoUpload},{trigger:r(()=>[a(y,{class:"object_avatar_upload"},{default:r(()=>[a(h)]),_:1})]),_:1},8,["button_text","onUploaded"])])):_("",!0),n.level?(i(),c("div",O6,[l("span",null,d(n.level),1)])):_("",!0)]),l("div",N6,[l("h3",null,[V(d((U=n.user_profile)==null?void 0:U.display_name)+" ",1),(T=n.user_profile)!=null&&T.is_verified?(i(),v(w,{key:0})):_("",!0),a(b,{profile:n.user_profile},null,8,["profile"])]),l("p",z6,"@"+d((j=n.user_profile)==null?void 0:j.username),1),e.hasFeature("followers_module")?(i(),c("div",q6,[((z=n.user_profile)==null?void 0:z.followings_count)!=null?(i(),v(C,{key:0,to:{name:"user_followings",params:{username:n.user_profile.username}}},{default:r(()=>[l("span",null,d(n.user_profile.followings_count),1),V(" "+d(e.$t("Following")),1)]),_:1},8,["to"])):_("",!0),((ne=n.user_profile)==null?void 0:ne.followers_count)!=null?(i(),v(C,{key:1,to:{name:"user_followers",params:{username:n.user_profile.username}}},{default:r(()=>[l("span",null,d(n.user_profile.followers_count),1),V(" "+d(e.$t("Followers")),1)]),_:1},8,["to"])):_("",!0)])):_("",!0)])]),l("div",G6,[(ee=(x=o.profile)==null?void 0:x.profile_navs)!=null&&ee.length?(i(),c("ul",Y6,[(i(!0),c(L,null,D(o.profile.profile_navs,K=>(i(),c("li",{class:R(K.wrapper_class??"")},[K.route?(i(),v(C,{key:0,class:R(K.css_class??""),to:K.route},{default:r(()=>[K.svg_icon?(i(),v(y,{key:0,innerHTML:K.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(K.title),1)]),_:2},1032,["class","to"])):(i(),c("a",{key:1,href:K.url,class:R(K.css_class??""),target:K.is_external?"_blank":"_self"},[K.svg_icon?(i(),v(y,{key:0,innerHTML:K.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(K.title),1)],10,W6))],2))),256))])):_("",!0),n.showActions?(i(),c("div",Z6,[(te=(H=o.profile)==null?void 0:H.profile_nav_actions)!=null&&te.length?(i(!0),c(L,{key:0},D(o.profile.profile_nav_actions,K=>(i(),c("a",{class:R(K.css_class),target:K.is_external?"_blank":"_self",href:K.url},[K.svg_icon?(i(),v(y,{key:0,innerHTML:K.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(K.title),1)],10,K6))),256)):_("",!0),n.showFollowAction||n.showOtherActions?(i(),c(L,{key:1},[n.showFollowAction?(i(),c(L,{key:0},[o.profile?(i(),v(p,{key:0,profile:o.profile,onRefetch:t[0]||(t[0]=K=>e.$emit("refetch"))},null,8,["profile"])):_("",!0),n.isFollowing?(i(),v(m,{key:1,class:"fcom_secondary_button icon_button",title:n.getTitle,loading:s.updating,disabled:s.updating,onClick:n.toggleEmailNotification},{default:r(()=>[n.isNotificationOn?(i(),v(y,{key:0},{default:r(()=>[a(k)]),_:1})):(i(),v(y,{key:1},{default:r(()=>[a(S)]),_:1}))]),_:1},8,["title","loading","disabled","onClick"])):_("",!0)],64)):_("",!0),n.showBlock||n.showOtherActions?(i(),v(B,{key:1,"popper-class":"fcom_pop_buttons",trigger:"click"},{dropdown:r(()=>[a(F,null,{default:r(()=>[n.showBlock?(i(),v(I,{key:0,onClick:t[1]||(t[1]=K=>n.confirmAndBlock())},{default:r(()=>[a(m,{"aria-label":e.$t("Block User"),class:"fcom_dot_menu edit_action",size:"small",text:"",type:"danger"},{default:r(()=>[V(d(e.$t("Block User")),1)]),_:1},8,["aria-label"])]),_:1})):_("",!0),n.showOtherActions?(i(),v(I,{key:1,onClick:t[2]||(t[2]=K=>n.openAddToDrawer())},{default:r(()=>[a(m,{"aria-label":e.$t("Add User to Space/Course"),class:"fcom_dot_menu edit_action",size:"small",text:"",type:"primary"},{default:r(()=>[V(d(e.$t("Add To Space/Course")),1)]),_:1},8,["aria-label"])]),_:1})):_("",!0)]),_:1})]),default:r(()=>[a(m,{class:"fcom_dot_menu edit_action",size:"small",text:""},{default:r(()=>[a(y,null,{default:r(()=>[a($)]),_:1})]),_:1})]),_:1})):_("",!0)],64)):_("",!0)])):_("",!0)]),a(E,{modelValue:s.isAddUserOpen,"onUpdate:modelValue":t[3]||(t[3]=K=>s.isAddUserOpen=K),"close-on-click-modal":!0,"before-close":n.handleDrawerClose,"append-to-body":!0,size:e.modalWidth,direction:"rtl"},{header:r(()=>[l("h4",null,d(e.$t("Add User to Space/Course")),1)]),default:r(()=>[a(M,{ref:"addUserForm",onCompleted:n.userAdded,user_profile:n.user_profile},null,8,["onCompleted","user_profile"])]),_:1},8,["modelValue","before-close","size"])])),[[A,s.updating]])}const Q6=P(E6,[["render",J6]]),X6={name:"ProfileAbout",components:{SocialLinks:Mt},props:["profile","isOwn"]},eC={class:"app_side_widget"},tC={class:"widget_header"},sC={key:0,class:"widget_actions"},oC={key:0,class:"widget_body"},iC=["innerHTML"],nC={key:1,style:{"text-align":"center"}},lC=["title"],aC=["title"];function rC(e,t,o,u,s,n){const m=g("EditPen"),f=N,h=O,y=g("SocialLinks"),w=W;return i(),c("div",eC,[l("div",tC,[l("h3",null,d(e.$t("About")),1),o.isOwn?(i(),c("div",sC,[a(h,{"aria-label":"Edit Your Profile",onClick:t[0]||(t[0]=b=>e.$router.push({name:"update_profile",params:{username:o.profile.username}})),text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})])):_("",!0)]),o.profile?(i(),c("div",oC,[o.profile.short_description_rendered?(i(),c("div",{key:0,class:"space_description feed_md_content",innerHTML:o.profile.short_description_rendered},null,8,iC)):o.isOwn?(i(),c("div",nC,[t[2]||(t[2]=l("hr",null,null,-1)),a(h,{"aria-label":"Add your profile description",onClick:t[1]||(t[1]=b=>e.$router.push({name:"update_profile",params:{username:o.profile.username}})),type:"info"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1}),l("span",null,d(e.$t("Add your profile description")),1)]),_:1})])):_("",!0),t[3]||(t[3]=l("hr",null,null,-1)),l("div",{title:o.profile.created_at,class:"meta_line"},d(e.$t("Joined: %s",e.humanDateDiff(o.profile.created_at))),9,lC),o.profile.last_activity?(i(),c("div",{key:2,title:o.profile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(o.profile.last_activity))),9,aC)):_("",!0),a(y,{xprofile:o.profile,isOwn:o.isOwn},null,8,["xprofile","isOwn"])])):(i(),v(w,{key:1,animated:!0}))])}const go=P(X6,[["render",rC]]);const cC={name:"FeedProfile",props:["username"],components:{SpaceMenu:uo,Layout:ke,AppLayout:Se,UserHeader:Q6,ProfileAbout:go,RecentActivities:At},setup(){return{userStore:Ue()}},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 o;const{disable_sidebar:e}=this.$route.meta||{},t=((o=this.profile)==null?void 0:o.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 o=this.$route.params;o.username=this.auth.username,this.$router.push({name:this.$route.name,params:o,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 o=this.$route.params;o.username=this.auth.username,this.$router.push({name:this.$route.name,params:o,query:{signed:Date.now()}});return}this.getProfile();const t={about:"user_profile",posts:"user_profile_feeds",spaces:"user_spaces",comments:"user_comments"}[this.defaultRoute||""];t&&this.$route.name==="user_profile"&&t!==this.$route.name&&this.$router.replace({name:t,params:{username:this.username}})}},dC={key:0},uC={key:1},_C={class:"edit_profile"},mC={class:"fcom_profile_box"},hC={key:0,class:"fcom_404_container"},fC={class:"fcom_404_content"},pC={key:1,class:"profile_holder"},gC={key:2},yC={class:"fcom_main_side_wrap"},vC={class:"widget_recent_activities"};function bC(e,t,o,u,s,n){const m=g("router-link"),f=Zt,h=Kt,y=O,w=N,b=g("EditPen"),C=g("user-header"),p=Ii,k=g("router-view"),S=W,$=Le,I=g("ProfileAbout"),F=g("RecentActivities"),B=We,M=xe,E=g("layout"),A=g("app-layout");return i(),v(A,{wrapper_class:"fcom_single_layout fcom_member_profile fcom_max_layout"},{default:r(()=>[a(E,{wrapper_class:"no_bg_layout",title:"...."},{title:r(()=>[a(h,null,{default:r(()=>[a(f,null,{default:r(()=>[a(m,{to:{name:"all_members"}},{default:r(()=>[V(d(e.$t("Members")),1)]),_:1})]),_:1}),n.profile?(i(),v(f,{key:0},{default:r(()=>[n.isOwn?(i(),c("span",dC,d(e.$t("My Profile")),1)):(i(),c("span",uC,d(n.profile.display_name),1))]),_:1})):_("",!0)]),_:1})]),actions:r(()=>[n.profile&&e.hasPermission("super_admin")&&n.profile.status!="active"?(i(),c(L,{key:0},[n.profile.status?(i(),c(L,{key:0},[l("span",null,d(e.$labelize(n.profile.status)),1),a(y,{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(()=>{n.approveUser()}))},{default:r(()=>[V(d(e.$t("Approve Account")),1)]),_:1})],64)):(i(),v(y,{key:1,disabled:!0},{default:r(()=>[V(d(e.$t("Self Deactivated Account")),1)]),_:1}))],64)):_("",!0),n.profile&&(n.isOwn||e.hasPermission("super_admin"))?(i(),c(L,{key:1},[a(m,{to:{name:"user_notification_settings",params:{username:n.profile.username}},class:"el-button el-button--text fcom_secondary_button"},{default:r(()=>[a(w,null,{default:r(()=>[...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,d(e.$t("Notification Settings")),1)]),_:1},8,["to"]),e.$route.name!=="update_profile"?(i(),v(y,{key:0,onClick:t[1]||(t[1]=U=>e.$router.push({name:"update_profile",params:{username:n.profile.username}})),class:"fcom_primary_button edit_profile_button"},{default:r(()=>[a(w,null,{default:r(()=>[a(b)]),_:1}),l("span",_C,d(e.$t("Edit Profile")),1)]),_:1})):_("",!0)],64)):_("",!0)]),default:r(()=>[s.notFound?_("",!0):(i(),v(C,{key:0,username:o.username,isOwn:n.isOwn,profile:n.profile,onRefetch:n.getProfile},null,8,["username","isOwn","profile","onRefetch"])),a(M,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a($,{class:"fcom_main"},{default:r(()=>[l("div",mC,[s.notFound?(i(),c("div",hC,[l("div",fC,[a(p,{icon:"error",title:e.$t("Profile Not Found")},{"sub-title":r(()=>[l("p",null,d(e.$t("The user profile you are looking for does not exist or has been removed.")),1)]),extra:r(()=>[e.auth.user_id?(i(),v(y,{key:0,onClick:t[2]||(t[2]=U=>e.$router.push({name:"all_members"})),class:"el-button fcom_primary_button"},{default:r(()=>[V(d(e.$t("Browse Members")),1)]),_:1})):_("",!0),a(y,{onClick:t[3]||(t[3]=U=>e.$router.push({name:"all_feeds"})),class:"el-button fcom_secondary_button"},{default:r(()=>[V(d(e.$t("Go to Home")),1)]),_:1})]),_:1},8,["title"])])])):n.profile?(i(),c("div",pC,[a(k,{isOwn:n.isOwn,username:o.username,profile:n.profile,onRefetch:n.getProfile},null,8,["isOwn","username","profile","onRefetch"])])):n.loading?(i(),c("div",gC,[a(S,{rows:10,animated:!0})])):_("",!0)])]),_:1}),n.showWidget?(i(),v(B,{key:0,class:"fcom_resp_side",width:"306px"},{default:r(()=>[l("div",yC,[l("div",vC,[e.$route.name!=="user_profile"?(i(),v(I,{key:0,isOwn:n.isOwn,profile:n.profile},null,8,["isOwn","profile"])):n.profile?(i(),v(F,{key:1,widget_title:e.$t("Recent Activities"),context:{user_id:n.profile.user_id}},null,8,["widget_title","context"])):_("",!0)])])]),_:1})):_("",!0)]),_:1})]),_:1})]),_:1})}const kC=P(cC,[["render",bC],["__scopeId","data-v-056b8554"]]),wC={name:"LockedProfile"},CC={class:"space_lock_box"},$C={class:"lock_header"},SC={class:"lock_desc"},VC=["href"];function LC(e,t,o,u,s,n){const m=g("Lock"),f=N;return i(),c("div",CC,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h3",$C,d(e.$t("This profile is private")),1),l("p",SC,d(e.$t("You do not have permission to view this profile's content.")),1),!e.auth.user_id&&e.appVars.allow_signup?(i(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button"},d(e.$t("Login / Signup")),9,VC)):_("",!0)])}const Rt=P(wC,[["render",LC]]),MC={name:"ProfileFeeds",components:{AllFeeds:mt,ErrorIcon:Os,LockedProfile:Rt},props:["profile","isOwn","username"],emits:["refetch"],setup(){return{uiStore:qe()}},beforeRouteLeave(e,t,o){if(e.name==="single_feed"||e.name==="space_feed"){let s=0;window.fcomLayoutRef&&window.fcomLayoutRef.wrapRef&&(s=window.fcomLayoutRef.wrapRef.scrollTop),this.uiStore.saveScrollPosition(t.path,s)}else this.uiStore.clearScrollPosition();o()},methods:{openScheduledPosts(){this.$router.push({name:"user_scheduled_posts"})}}},FC={key:0,class:"fcom_feed_report_wrap"},TC={class:"fcom_feed_report_content"},PC={class:"fcom_feed_report_action"};function IC(e,t,o,u,s,n){const m=g("LockedProfile"),f=g("ErrorIcon"),h=O,y=g("all-feeds");return o.profile.is_restricted?(i(),v(m,{key:0})):(i(),c(L,{key:1},[o.profile.scheduled_posts_count?(i(),c("div",FC,[l("div",TC,[a(f),l("span",null,d(e.$t("You currently have %s scheduled posts to be published",o.profile.scheduled_posts_count)),1)]),l("div",PC,[a(h,{onClick:t[0]||(t[0]=w=>n.openScheduledPosts())},{default:r(()=>[V(d(e.$t("View Posts")),1)]),_:1})])])):_("",!0),a(y,{feed_name:"profile_feed",require_space_selection:e.appVars.features.disable_global_posts,user_id:o.profile.user_id,hide_create_form:o.profile.user_id!=e.auth.user_id},null,8,["require_space_selection","user_id","hide_create_form"])],64))}const UC=P(MC,[["render",IC]]),BC={name:"ScheduledPosts",components:{Feed:Xe,Pagination:$e,EditFeed:os,AlarmClock:Ao},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=>eo.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.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()}},EC={class:"scheduled_posts_header"},AC={class:"fcom_scheduled_posts_title"},DC={key:0},RC={key:1},HC={key:1,class:"fcom_feed_style_timeline fcom_scheduled_posts"},xC={class:"all_feeds_holder"},jC={class:"actions_items"},OC=["onClick"],NC=["onClick"],zC=["onClick"],qC={class:"feed_user"},GC={class:"feed_user_name"},YC={class:"feed_meta_info"},WC=["title","href"],ZC={key:0},KC={class:"post_actions"},JC={key:2,class:"feed_outer"},QC={class:"feed"},XC={style:{"text-align":"center"},class:"feed_body not_found"},e$={class:"dialog_header"},t$={class:"dialog_left schedule_header_left"},s$={class:"dialog_body"},o$={class:"dialog_footer"};function i$(e,t,o,u,s,n){const m=g("AlarmClock"),f=N,h=W,y=g("MoreFilled"),w=O,b=fe,C=g("UserAvatar"),p=g("UserRouteLink"),k=g("router-link"),S=g("feed"),$=g("edit-feed"),I=Ge,F=de,B=Ss,M=ue,E=Ce,A=g("pagination");return i(),c(L,null,[l("div",EC,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("div",AC,[l("h3",null,d(e.$t("Scheduled Posts")),1),n.isPostCount?(i(),c("p",DC,d(e.$t("You currently have %s scheduled posts to be published",o.profile.scheduled_posts_count)),1)):(i(),c("p",RC,d(e.$t("You have no scheduled posts to be published")),1))])]),s.loading?(i(),v(h,{key:0,rows:5,animated:!0})):s.feeds.length?(i(),c("div",HC,[l("div",xC,[(i(!0),c(L,null,D(s.feeds,U=>(i(),c("div",{key:U.id,class:"feed_outer"},[a(S,{feed:U,layout_style:"timeline",hide_create_form:!0,show_footer:!1,show_actions:!1},{after_feed_actions:r(()=>[a(b,{persistent:!1,ref_for:!0,ref:"actionsPopover",placement:"bottom",width:200,trigger:"click",visible:n.isPopoverVisible(U),onHide:T=>n.hidePopover(U)},{reference:r(()=>[a(w,{"aria-label":e.$t("View Post actions"),class:"fcom_dot_menu",size:"small",text:"",onClick:T=>n.togglePopover(U)},{default:r(()=>[a(f,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:r(()=>[l("ul",jC,[l("li",{onClick:T=>n.copyFeedLink(U)},d(e.$t("Copy Link")),9,OC),e.canEditFeed(U)?(i(),c("li",{key:0,onClick:T=>n.editItem(U)},d(e.$t("Edit")),9,NC)):_("",!0),e.canDeleteFeed(U)?(i(),c("li",{key:1,onClick:T=>n.deleteItem(U)},d(e.$t("Delete")),9,zC)):_("",!0)])]),_:2},1032,["visible","onHide"])]),after_feed_header:r(()=>[l("div",qC,[a(C,{with_level:!1,xprofile:o.profile},null,8,["xprofile"]),l("div",null,[l("div",GC,[a(p,{show_badge:!0,xprofile:o.profile},null,8,["xprofile"])]),l("div",YC,[l("a",{title:U.created_at,onClick:t[0]||(t[0]=(...T)=>e.gotoFeed&&e.gotoFeed(...T)),href:U.permalink,class:"feed_timestamp"},d(n.getScheduledTime(U.scheduled_at)),9,WC),U.space?(i(),c("span",ZC,[a(k,{to:n.getSpaceRoute(U.space.slug),class:"feed_timestamp"},{default:r(()=>[V(d(e.$t("Posted in %s",e.getExcerpt(U.space.title,30))),1)]),_:2},1032,["to"])])):_("",!0)])])])]),after_feed_footer:r(()=>[l("div",KC,[a(w,{class:"fcom_secondary_button",onClick:T=>n.initReschedule(U),disabled:s.saving},{default:r(()=>[V(d(e.$t("Reschedule Post")),1)]),_:1},8,["onClick","disabled"]),a(w,{class:"fcom_secondary_button",onClick:T=>n.publishNow(U),disabled:s.saving},{default:r(()=>[V(d(e.$t("Publish Now")),1)]),_:1},8,["onClick","disabled"])])]),_:2},1032,["feed"])]))),128)),s.isEdit&&s.editingFeed?(i(),v($,{key:0,feedSlug:s.editingFeed.slug,dialogVisible:s.isEdit,onUpdated:n.updateFeed,hide_create_form:!1,onClose:t[1]||(t[1]=U=>s.isEdit=!1)},null,8,["feedSlug","dialogVisible","onUpdated"])):_("",!0)])])):(i(),c("div",JC,[l("div",QC,[l("div",XC,[l("p",null,d(e.$t("No scheduled posts found!")),1)])])])),a(E,{modelValue:s.scheduleModalVisible,"onUpdate:modelValue":t[4]||(t[4]=U=>s.scheduleModalVisible=U),width:e.modalWidth,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1,onClose:n.cancelReschedule},{header:r(()=>[l("div",e$,[l("div",t$,[l("h4",null,d(e.$t("Reschedule Post")),1),l("p",null,d(e.$t("Choose a date and time in the future when you want your post to be published")),1)])])]),footer:r(()=>[l("div",o$,[a(w,{class:"fcom_secondary_button",disabled:s.saving,onClick:n.cancelReschedule},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1},8,["disabled","onClick"]),a(w,{class:"fcom_primary_button",disabled:s.saving,onClick:n.reschedulePost},{default:r(()=>[V(d(e.$t("Reschedule")),1)]),_:1},8,["disabled","onClick"])])]),default:r(()=>[l("div",s$,[a(M,{"label-position":"top",class:"fcom_schedule_form"},{default:r(()=>[a(F,{label:e.$t("Date")},{default:r(()=>[a(I,{modelValue:s.scheduleForm.date,"onUpdate:modelValue":t[2]||(t[2]=U=>s.scheduleForm.date=U),type:"date","value-format":"YYYY-MM-DD",format:"YYYY-MM-DD",placeholder:e.$t("Select Date"),"disabled-date":n.isDateDisabled},null,8,["modelValue","placeholder","disabled-date"])]),_:1},8,["label"]),a(F,{label:e.$t("Time")},{default:r(()=>[a(B,{modelValue:s.scheduleForm.time,"onUpdate:modelValue":t[3]||(t[3]=U=>s.scheduleForm.time=U),disabled:!s.scheduleForm.date,style:{width:"210px"},step:"00:10",start:n.getStartTime,end:"23:59",placeholder:e.$t("Select Time")},null,8,["modelValue","disabled","start","placeholder"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["modelValue","width","onClose"]),a(A,{pagination:s.pagination,onFetch:n.fetchFeeds},null,8,["pagination","onFetch"])],64)}const n$=P(BC,[["render",i$]]),l$={name:"UserSpaces",props:["profile"],components:{Calendar:Do,Baseball:Ro,GroupIcon:rs,GlobIcon:fo,LockedProfile:Rt},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()}},a$={key:1,class:"user_spaces"},r$={class:"fcom_box_card_list"},c$=["onClick"],d$=["src"],u$=["src"],_$={key:2,class:"fcom_no_image"},m$={class:"fcom_box_card_info"},h$={class:"fcom_box_card_name"},f$={class:"fcom_box_card_details"},p$={class:"details_item"},g$={key:0,class:"details_item"},y$={class:"fcom_box_card_action"},v$=["onClick"],b$={key:0,class:"loading"},k$={key:1},w$={class:"no_members"},C$={key:2,class:"no_members"};function $$(e,t,o,u,s,n){const m=g("LockedProfile"),f=g("router-link"),h=g("MoreFilled"),y=N,w=O,b=ct,C=dt,p=ut,k=g("GlobIcon"),S=g("Lock"),$=g("GroupIcon"),I=W;return o.profile.is_restricted?(i(),v(m,{key:0})):(i(),c("div",a$,[l("div",r$,[(i(!0),c(L,null,D(s.communities,F=>{var B;return i(),c("div",{key:F.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:M=>n.goToSpaceFeeds(F.slug)},[(B=F.settings)!=null&&B.og_image?(i(),c("img",{key:0,src:F.settings.og_image,alt:""},null,8,d$)):F.cover_photo?(i(),c("img",{key:1,src:F.cover_photo,alt:""},null,8,u$)):(i(),c("div",_$))],8,c$),l("div",m$,[l("div",h$,[a(f,{class:"user_route",to:{name:"space_feeds",params:{space:F.slug}}},{default:r(()=>[V(d(n.getExcerpt(F.title,30)),1)]),_:2},1032,["to"]),e.isAdmin()?(i(),v(p,{key:0,trigger:"click"},{dropdown:r(()=>[a(C,null,{default:r(()=>[a(b,{onClick:M=>n.removeMembership(F.slug)},{default:r(()=>[V(d(e.$t("Remove from space")),1)]),_:1},8,["onClick"])]),_:2},1024)]),default:r(()=>[a(w,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)):_("",!0)]),l("div",f$,[l("div",p$,[F.privacy==="public"?(i(),v(y,{key:0},{default:r(()=>[a(k)]),_:1})):(i(),v(y,{key:1},{default:r(()=>[a(S)]),_:1})),l("span",null,d(F.privacy==="public"?e.$t("Public"):e.$t("Private")),1)]),F.members_count?(i(),c("div",g$,[a(y,null,{default:r(()=>[a($)]),_:1}),l("span",null,d(e.$_n("%s Member","%s Members",e.$formatNumber(F.members_count))),1)])):_("",!0)]),l("div",y$,[l("button",{class:"fcom_card_button",onClick:M=>n.goToSpaceFeeds(F.slug)},d(n.getBtnLevel(F.type)),9,v$)])])])}),128))]),s.loading?(i(),c("div",b$,[a(I,{class:"white_loaded",rows:3,animated:!0}),a(I,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):o.profile.canViewUserSpaces?!s.loading&&!s.communities.length?(i(),c("div",C$,d(e.$t("No Spaces found.")),1)):_("",!0):(i(),c("div",k$,[l("div",w$,d(e.$t("Sorry, you do not have permission to view this page")),1)]))]))}const S$=P(l$,[["render",$$]]),V$={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})}}},L$={style:{"margin-top":"30px"},class:"fcom_account_deactivation about_wrap"},M$={class:"about_header"},F$={class:"about_body fcom_mt_10"},T$={class:"fcom_mt_20"};function P$(e,t,o,u,s,n){const m=O;return i(),c("div",L$,[l("div",M$,[l("h3",null,d(e.$t("Account Deactivation")),1)]),l("div",F$,[s.selection=="init"?(i(),c(L,{key:0},[l("p",null,d(e.$t("If you no longer wish to keep your community account, click button below to deactivate your account.")),1),a(m,{onClick:t[0]||(t[0]=f=>s.selection="deactivate"),class:"fcom_secondary_button fcom_mt_20"},{default:r(()=>[V(d(e.$t("Continue to Deactivate Account")),1)]),_:1})],64)):s.selection=="deactivate"?(i(),c(L,{key:1},[l("h4",null,d(e.$t("This will deactivate your account")),1),l("p",null,d(e.$t("Deactivating your account will make your content and profile invisible to others. You will also lose access to the community until you reactivate your account.")),1),l("div",T$,[a(m,{onClick:t[1]||(t[1]=f=>s.selection="init"),class:"fcom_secondary_button"},{default:r(()=>[V(d(e.$t("Go Back")),1)]),_:1}),a(m,{onClick:t[2]||(t[2]=f=>n.deactivateAccount()),type:"danger"},{default:r(()=>[V(d(e.$t("Confirm Account Deactivation")),1)]),_:1})])],64)):_("",!0)])])}const I$=P(V$,[["render",P$]]),U$={name:"UserProfileUpdate",props:["isOwn","profile","username"],emits:["refetch"],components:{SlugInput:Pt,MarkdownEditor:$t,AccountDeactivation:I$},setup(){const e=Ue(),t=le();return{userStore:e,cacheStore:t}},data(){return{updating:!1,loading:!1,notification_settings:{email_on_comment:!1},profileData:{},fcom_is_dirty:!1}},watch:{profile:{handler(e){e&&(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,short_description:e.short_description,user_id:e.user_id,is_verified:e.is_verified,social_links:e.social_links||{},badge_slugs:e.badge_slugs,status:e.status,custom_fields:this.getCustomFieldValues(e)})},immediate:!0}},computed:{customFieldGroups(){return this.profile.custom_field_groups||[]}},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}},isEmpty:Jt,getCustomFieldValues(e){const t={},o=e.custom_field_groups||[];for(const u of o)for(const s of u.fields||[])s.slug&&(t[s.slug]=s.value!==void 0?s.value:"");return t}},async mounted(){await this.userStore.fetchProfile(this.username,!0),this.$nextTick(()=>{const e=document.querySelector(".object_info");e&&window.scrollTo({top:e.offsetTop-100,behavior:"smooth"})})}},B$={key:0,class:"fcom_sub_group fcom_additional_info"},E$={class:"fcom_sub_group_header"},A$={key:0},D$={class:"fcom_sub_group_content"},R$={key:0,class:"fcom_sub_group"},H$={class:"fcom_sub_group_header"},x$={class:"fcom_sub_group_content"},j$={key:1,class:"fcom_mb_20"},O$={key:0,class:"fcom_sub_group"},N$={class:"fcom_sub_group_header"},z$={key:1},q$={style:{color:"var(--el-color-danger, red)"},class:"help_msg"},G$={key:2,class:"help_msg"},Y$={class:"fcom_sub_group"},W$={class:"fcom_fixed_bottom_overlay"};function Z$(e,t,o,u,s,n){const m=X,f=de,h=at,y=rt,w=g("markdown-editor"),b=Ge,C=oe,p=ie,k=Ee,S=ve,$=N,I=_e,F=g("UserBadge"),B=g("slug-input"),M=O,E=ue,A=g("account-deactivation"),U=Q("loading");return i(),c(L,null,[l("div",{class:R([{fcom_is_dirty:s.fcom_is_dirty},"fcom_update_profile"])},[a(E,{onSubmit:t[9]||(t[9]=Y(T=>e.doNothing(),["prevent"])),onInput:t[10]||(t[10]=T=>s.fcom_is_dirty=!0),"label-position":"top",modelValue:s.profileData,"onUpdate:modelValue":t[11]||(t[11]=T=>s.profileData=T)},{default:r(()=>[a(y,{gutter:30},{default:r(()=>[a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("First Name"),required:""},{default:r(()=>[a(m,{modelValue:s.profileData.first_name,"onUpdate:modelValue":t[0]||(t[0]=T=>s.profileData.first_name=T)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("Last Name")},{default:r(()=>[a(m,{modelValue:s.profileData.last_name,"onUpdate:modelValue":t[1]||(t[1]=T=>s.profileData.last_name=T)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),a(y,{gutter:30},{default:r(()=>[a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("Email")},{default:r(()=>[a(m,{disabled:!o.profile.can_change_email,modelValue:s.profileData.email,"onUpdate:modelValue":t[2]||(t[2]=T=>s.profileData.email=T)},null,8,["disabled","modelValue"])]),_:1},8,["label"])]),_:1}),a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("Website URL")},{default:r(()=>[a(m,{type:"url",modelValue:s.profileData.website,"onUpdate:modelValue":t[3]||(t[3]=T=>s.profileData.website=T)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),a(f,{class:"fcom_editor_input_wrap",label:e.$t("Short Bio")},{default:r(()=>[a(w,{disable_mention:!0,disable_media:!0,modelValue:s.profileData.short_description,"onUpdate:modelValue":t[4]||(t[4]=T=>s.profileData.short_description=T)},null,8,["modelValue"])]),_:1},8,["label"]),(i(!0),c(L,null,D(n.customFieldGroups,T=>(i(),c(L,{key:T.slug},[T.fields&&T.fields.length?(i(),c("div",B$,[l("div",E$,[l("h5",null,d(T.label),1),T.edit_description?(i(),c("p",A$,d(T.edit_description),1)):_("",!0)]),l("div",D$,[(i(!0),c(L,null,D(T.fields,j=>(i(),v(f,{key:j.slug,label:j.label,required:j.is_required},{default:r(()=>[j.type==="text"?(i(),v(m,{key:0,modelValue:s.profileData.custom_fields[j.slug],"onUpdate:modelValue":z=>s.profileData.custom_fields[j.slug]=z,placeholder:j.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):j.type==="textarea"?(i(),v(m,{key:1,type:"textarea",rows:3,modelValue:s.profileData.custom_fields[j.slug],"onUpdate:modelValue":z=>s.profileData.custom_fields[j.slug]=z,placeholder:j.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):j.type==="number"?(i(),v(m,{key:2,type:"number",modelValue:s.profileData.custom_fields[j.slug],"onUpdate:modelValue":z=>s.profileData.custom_fields[j.slug]=z,placeholder:j.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):j.type==="date"?(i(),v(b,{key:3,modelValue:s.profileData.custom_fields[j.slug],"onUpdate:modelValue":z=>s.profileData.custom_fields[j.slug]=z,type:"date","value-format":"YYYY-MM-DD",placeholder:j.placeholder,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"])):j.type==="select"?(i(),v(p,{key:4,modelValue:s.profileData.custom_fields[j.slug],"onUpdate:modelValue":z=>s.profileData.custom_fields[j.slug]=z,placeholder:j.placeholder,clearable:""},{default:r(()=>[(i(!0),c(L,null,D(j.options,z=>(i(),v(C,{key:z,label:z,value:z},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):j.type==="multiselect"?(i(),v(p,{key:5,modelValue:s.profileData.custom_fields[j.slug],"onUpdate:modelValue":z=>s.profileData.custom_fields[j.slug]=z,placeholder:j.placeholder,multiple:!0,clearable:""},{default:r(()=>[(i(!0),c(L,null,D(j.options,(z,ne)=>(i(),v(C,{key:ne,label:z,value:ne},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):j.type==="radio"?(i(),v(S,{key:6,modelValue:s.profileData.custom_fields[j.slug],"onUpdate:modelValue":z=>s.profileData.custom_fields[j.slug]=z},{default:r(()=>[(i(!0),c(L,null,D(j.options,z=>(i(),v(k,{key:z,value:z},{default:r(()=>[V(d(z),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):j.type==="url"?(i(),v(m,{key:7,type:"url",modelValue:s.profileData.custom_fields[j.slug],"onUpdate:modelValue":z=>s.profileData.custom_fields[j.slug]=z,placeholder:j.placeholder||"https://"},null,8,["modelValue","onUpdate:modelValue","placeholder"])):_("",!0)]),_:2},1032,["label","required"]))),128))])])):_("",!0)],64))),128)),n.isEmpty(e.appVars.socialLinkProviders)?_("",!0):(i(),c("div",R$,[l("div",H$,[l("h5",null,d(e.$t("Social Links")),1),l("p",null,d(e.$t("Add your social media profile link.")),1)]),l("div",x$,[(i(!0),c(L,null,D(e.appVars.socialLinkProviders,(T,j)=>(i(),v(f,{key:j,label:T.title},{default:r(()=>[a(m,{placeholder:T.placeholder,modelValue:s.profileData.social_links[j],"onUpdate:modelValue":z=>s.profileData.social_links[j]=z},{prepend:r(()=>[a($,{innerHTML:T.icon_svg},null,8,["innerHTML"]),l("span",null,d(T.domain),1)]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]))),128))])])),o.profile.can_change_username?(i(),c("div",j$,[e.hasPermission("super_admin")?(i(),c("div",O$,[l("div",N$,[l("h5",null,d(e.$t("Admin Actions")),1),l("p",null,d(e.$t("Admin tools for account verification and status management.")),1)]),a(f,{label:e.$t("Account Verification"),class:"checkbox_label"},{default:r(()=>[a(I,{"true-value":1,"false-value":0,modelValue:s.profileData.is_verified,"onUpdate:modelValue":t[5]||(t[5]=T=>s.profileData.is_verified=T),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Mark this account as verified")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"]),e.appVars.user_badges?(i(),v(f,{key:0,label:e.$t("Profile Badges")},{default:r(()=>[a(p,{clearable:"",multiple:!0,modelValue:s.profileData.badge_slugs,"onUpdate:modelValue":t[6]||(t[6]=T=>s.profileData.badge_slugs=T),placeholder:e.$t("User Profile Badge")},{default:r(()=>[(i(!0),c(L,null,D(e.appVars.user_badges,T=>(i(),v(C,{key:T.slug,label:T.title,value:T.slug},{default:r(()=>[a(F,{badge:T,is_preview:!0},null,8,["badge"])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(f,{label:e.$t("Access Status")},{default:r(()=>[a(S,{modelValue:s.profileData.status,"onUpdate:modelValue":t[7]||(t[7]=T=>s.profileData.status=T),class:"fcom_radio_group"},{default:r(()=>[a(k,{value:"active"},{default:r(()=>[V(d(e.$t("Active")),1)]),_:1}),a(k,{value:"pending"},{default:r(()=>[V(d(e.$t("Pending")),1)]),_:1}),a(k,{value:"blocked"},{default:r(()=>[V(d(e.$t("Blocked")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.profileData.status?s.profileData.status!="active"?(i(),c("div",G$,[l("p",null,d(e.$t("The user cannot access the portal.")),1)])):_("",!0):(i(),c("div",z$,[l("p",q$,d(e.$t("This user deactivated his/her account from the self managed profile section. if you want to reactivate the account, please select an updated status.")),1)]))])):_("",!0),l("div",Y$,[a(f,{label:e.$t("Community Account Username")},{default:r(()=>[a(B,{is_inital_inactive:!0,modelValue:s.profileData.username,"onUpdate:modelValue":t[8]||(t[8]=T=>s.profileData.username=T),prefix:"@","pop-message":e.$t("Are you sure you want to change username?"),edit_notice:e.$t("Please choose a username matching with your first/last name or full name"),placeholder:e.$t("Username")},null,8,["modelValue","pop-message","edit_notice","placeholder"])]),_:1},8,["label"])])])):_("",!0),a(f,null,{default:r(()=>[l("div",W$,[G((i(),v(M,{class:"fcom_primary_button",onClick:n.updateProfile,disabled:s.updating},{default:r(()=>[V(d(e.$t("Save Changes")),1)]),_:1},8,["onClick","disabled"])),[[U,s.updating]])])]),_:1})]),_:1},8,["modelValue"])],2),e.hasFeature("can_deactivate_account")&&o.profile.username==e.appVars.auth.username?(i(),v(A,{key:0,profile:o.profile},null,8,["profile"])):_("",!0)],64)}const K$=P(U$,[["render",Z$]]),J$={name:"UserAbout",props:["profile","isOwn"],components:{Timer:ws,CalendarIcon:Ys,LockedProfile:Rt},computed:{hasSocialLinks(){return this.socialLinks.length>0},visibleGroups(){return(this.profile.custom_field_groups||[]).filter(t=>t.fields&&t.fields.some(o=>this.hasFieldValue(o.value)))},socialLinks(){var u,s;let e=(u=this.profile)==null?void 0:u.social_links;e||(e=(s=this.profile.meta)==null?void 0:s.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 o=this.appVars.socialLinkProviders;return Object.entries(o).forEach(([n,m])=>{e[n]&&t.push({title:m.title,icon:m.icon_svg,text:e[n],url:m.domain+e[n]})}),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}}},Q$={key:1,class:"about_wrap"},X$={class:"about_header"},e7={key:0,class:"about_body"},t7=["innerHTML"],s7={key:1},o7={class:"about_items"},i7=["title"],n7=["title"],l7={class:"items_title"},a7={key:0,class:"about_item"},r7={class:"about_item_label"},c7=["href"],d7={key:1},u7={key:2,class:"about_items"},_7={key:0,class:"items_title"},m7=["href","title"];function h7(e,t,o,u,s,n){const m=g("LockedProfile"),f=g("EditPen"),h=N,y=O,w=g("CalendarIcon"),b=g("Timer"),C=W;return o.profile.is_restricted?(i(),v(m,{key:0})):(i(),c("div",Q$,[l("div",X$,[l("h3",null,d(e.$t("About")),1),o.isOwn?(i(),v(y,{key:0,"aria-label":"Edit your profile description",onClick:n.goToUpdateProfile,text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(f)]),_:1})]),_:1},8,["onClick"])):_("",!0)]),o.profile?(i(),c("div",e7,[o.profile.short_description_rendered?(i(),c("div",{key:0,class:"about_description feed_texts feed_md_content",innerHTML:o.profile.short_description_rendered},null,8,t7)):o.isOwn?(i(),c("div",s7,[a(y,{class:"fcom_plain_button",onClick:t[0]||(t[0]=p=>e.$router.push({name:"update_profile",params:{username:o.profile.username}}))},{default:r(()=>[l("span",null,d("+ "+e.$t("Add your profile description")),1)]),_:1})])):_("",!0),l("div",o7,[o.profile.created_at?(i(),c("div",{key:0,title:o.profile.created_at,class:"about_item"},[a(h,null,{default:r(()=>[a(w)]),_:1}),l("span",null,d(e.$t("Joined %s",e.humanDateDiff(o.profile.created_at))),1)],8,i7)):_("",!0),o.profile.last_activity?(i(),c("div",{key:1,title:o.profile.last_activity,class:"about_item"},[a(h,null,{default:r(()=>[a(b)]),_:1}),V(" "+d(e.$t("Last seen: %s",e.humanDateDiff(o.profile.last_activity))),1)],8,n7)):_("",!0)]),(i(!0),c(L,null,D(n.visibleGroups,p=>(i(),c("div",{key:p.slug,class:"about_items"},[l("div",l7,d(p.label),1),(i(!0),c(L,null,D(p.fields,k=>(i(),c(L,{key:k.slug},[n.hasFieldValue(k.value)?(i(),c("div",a7,[l("span",r7,d(k.label)+":",1),k.type==="url"&&k.value?(i(),c("a",{key:0,href:k.value,target:"_blank",rel:"noopener noreferrer"},d(k.value),9,c7)):(i(),c("span",d7,d(n.formatFieldValue(k)),1))])):_("",!0)],64))),128))]))),128)),n.hasSocialLinks||o.isOwn?(i(),c("div",u7,[n.hasSocialLinks?(i(),c("div",_7,d(e.$t("Social Links")),1)):_("",!0),(i(!0),c(L,null,D(n.socialLinks,p=>(i(),c("a",{target:"_blank",rel:"noopener noreferrer",href:p.url,key:p.title,title:p.title,class:"about_item"},[a(h,{innerHTML:p.icon},null,8,["innerHTML"]),V(" "+d(p.text),1)],8,m7))),128)),o.isOwn&&!n.hasSocialLinks?(i(),v(y,{key:1,class:"fcom_plain_button",onClick:n.goToUpdateProfile},{default:r(()=>[l("span",null,d("+ "+e.$t("Add social links")),1)]),_:1},8,["onClick"])):_("",!0)])):_("",!0)])):(i(),v(C,{key:1,animated:!0}))]))}const f7=P(J$,[["render",h7]]),p7={name:"UserComments",props:["profile","username","isOwn"],emits:["refetch"],components:{Pagination:$e,Check:Cs,ImageIcon:Xt,FeedMdContent:Lt,LockedProfile:Rt},data(){return{comments:[],loading:!0,pagination:{page:1,per_page:10,total:0},working:!1,replyingComemnt:null,isReplying:!1}},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,window.scrollTo(0,0)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},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(o=>{this.comments.splice(t,1),this.$notify.success(o.message)}).catch(o=>{this.$handleError(o)}).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 o;let t=(o=e.post)==null?void 0:o.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}}},getPostExcerpt(e){let t=e.type;t=="text"&&(t="");let o="";return e.title?o=e.title:o=this.getExcerpt(e.message,50),o+(t?" ("+t+")":"")}},mounted(){this.profile.is_restricted||this.fetchComments()}},g7={key:1,class:"white_loaded"},y7={class:"course_comments feed_comments user_comments"},v7={class:"comment_text_head"},b7=["title"],k7={class:"comment_action"},w7={class:"comment_text_head_post"},C7={class:"comment_text"},$7={key:1,class:"comment_text_body feed_md_content media_only_content"},S7={key:0};function V7(e,t,o,u,s,n){const m=g("LockedProfile"),f=W,h=g("Delete"),y=N,w=O,b=g("router-link"),C=g("FeedMdContent"),p=g("ImageIcon"),k=g("pagination");return o.profile.is_restricted?(i(),v(m,{key:0})):s.loading?(i(),c("div",g7,[a(f,{row:5})])):(i(),c(L,{key:2},[l("div",y7,[(i(!0),c(L,null,D(s.comments,(S,$)=>(i(),c("div",{key:S.id,class:"fcom_course_comment each_comment"},[t[0]||(t[0]=l("span",{class:"comment_icon"},null,-1)),l("div",v7,[l("div",{title:S.created_at,class:"comment_text_head_time"},d(e.humanDateDiff(S.created_at)),9,b7),l("div",k7,[o.isOwn?(i(),v(w,{key:0,class:"fcom_plain_button",onClick:I=>n.deleteComment(S,$)},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["onClick"])):_("",!0)])]),l("div",w7,[a(b,{class:"post_link",to:n.getPostRoute(S)},{default:r(()=>[V(d(n.getPostExcerpt(S.post)),1)]),_:2},1032,["to"])]),l("div",C7,[S.message_rendered?(i(),v(C,{key:0,class_name:"comment_text_body",content:S.message_rendered},null,8,["content"])):(i(),c("div",$7,[a(p,{class:"fcom_status_img_icon"})]))])]))),128)),s.pagination.total?_("",!0):(i(),c("div",S7,[l("h5",null,d(e.$t("%s did not add any comment to any posts yet",o.profile.display_name)),1)]))]),a(k,{pagination:s.pagination,onFetch:n.fetchComments},null,8,["pagination","onFetch"])],64))}const L7=P(p7,[["render",V7]]);const M7={name:"NotificationPref",components:{NotificationOnboard:so,Notification:Ho},props:["username"],data(){return{pref:{},spaceGroups:[],is_custom:!1,loading:!1,error:"",saving:!1,digestEmailDay:"",initialState:null,default_messaging_email_frequency:""}},computed:{fcom_is_dirty(){return this.initialState?JSON.stringify(this.pref)+JSON.stringify(this.spaceGroups)!=this.initialState:!1}},methods:{getPrefs(){this.loading=!0,this.$get(`profile/${this.username}/notification-preferences`).then(e=>{this.pref=e.user_globals,this.spaceGroups=e.spaceGroups,this.digestEmailDay=e.digestEmailDay,this.default_messaging_email_frequency=e.default_messaging_email_frequency,this.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})},saveSettings(){this.saving=!0;let e={};this.spaceGroups.forEach(t=>{t.spaces.forEach(o=>{e[o.id]=o.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.auth.user_id||this.hasPermission("super_admin"))&&this.getPrefs()}},F7={class:"fcom_notification_config"},T7={key:0},P7=["innerHTML"],I7={key:1,class:"white_loaded"},U7={class:"fcom_notification_card"},B7={class:"fcom_notification_card__header"},E7={class:"fcom_notification_card__title"},A7={class:"fcom_notification_card__body"},D7={class:"fcom_input_wrap"},R7={key:0},H7={key:1,class:"fcom_not_enabled"},x7={class:"fcom_input_wrap"},j7={key:0},O7={key:1,class:"fcom_not_enabled"},N7={class:"fcom_input_wrap"},z7={key:0},q7={key:1,class:"fcom_not_enabled"},G7={class:"fcom_input_wrap"},Y7={key:0},W7={key:1,class:"fcom_not_enabled"},Z7={key:0,class:"fcom_input_wrap"},K7={style:{"font-weight":"500","font-size":"16px",margin:"10px 0 5px 0"}},J7={key:0,class:"fcom_not_enabled"},Q7={key:1,class:"fcom_not_enabled"},X7={key:2,class:"fcom_not_enabled"},e9={class:"fcom_notification_card"},t9={class:"fcom_notification_card__header"},s9={class:"fcom_notification_card__title"},o9={class:"fcom_card_sections fcom_course_type_structured"},i9={class:"fcom_section_labels"},n9={class:"fcom_lebel fcom_label_lesson"},l9={style:{"text-align":"right"},class:"fcom_lebel fcom_label_actions"},a9={class:"fcom_section_primary"},r9={class:"fcom_section_primary_item"},c9={class:"fcom_section_primary_item_title"},d9={class:"fcom_section_items"},u9={class:"fcom_section_item"},_9={class:"fcom_section_item_title"},m9=["innerHTML"],h9=["innerHTML"],f9={key:2,class:"fcom_no_avatar"},p9={class:"fcom_section_item_actions"},g9={key:1,class:"fcom_section_labels"},y9={class:"fcom_notification_card fcom_fixed_bottom_overlay"},v9={key:3},b9={key:0},k9=["href"];function w9(e,t,o,u,s,n){const m=W,f=g("NotificationOnboard"),h=g("Notification"),y=N,w=_e,b=Ee,C=ve,p=oe,k=ie,S=O;return i(),c("div",F7,[s.error?(i(),c("div",T7,[l("p",{innerHTML:s.error},null,8,P7)])):s.loading?(i(),c("div",I7,[a(m,{rows:10,animated:!0})])):e.auth.user_id||e.hasPermission("super_admin")&&s.pref?(i(),c("div",{key:2,class:R([{fcom_is_dirty:n.fcom_is_dirty},"fcom_notification_config_body"])},[a(f),l("div",U7,[l("div",B7,[a(y,{style:{"font-size":"30px"}},{default:r(()=>[a(h)]),_:1}),l("div",E7,[l("h3",null,d(e.$t("Global Email Notifications")),1),l("p",null,d(e.$t("These settings will be applied across all spaces you're a member of.")),1)])]),l("div",A7,[l("div",D7,[a(w,{"true-value":"yes","false-value":"no",modelValue:s.pref.com_my_post_mail,"onUpdate:modelValue":t[0]||(t[0]=$=>s.pref.com_my_post_mail=$),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Email me when someone comments on my post")),1)]),_:1},8,["modelValue"]),s.pref.com_my_post_mail=="yes"?(i(),c("p",R7,d(e.$t("You will receive an email when someone leaves a comment on your post.")),1)):(i(),c("p",H7,d(e.$t("No email will be sent for comments on your post.")),1))]),l("div",x7,[a(w,{"true-value":"yes","false-value":"no",modelValue:s.pref.reply_my_com_mail,"onUpdate:modelValue":t[1]||(t[1]=$=>s.pref.reply_my_com_mail=$),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Email me when someone replies to my comments")),1)]),_:1},8,["modelValue"]),s.pref.reply_my_com_mail=="yes"?(i(),c("p",j7,d(e.$t("You will receive an email when someone replies to your comments.")),1)):(i(),c("p",O7,d(e.$t("No email will be sent when someone replies to your comments.")),1))]),l("div",N7,[a(w,{"true-value":"yes","false-value":"no",modelValue:s.pref.mention_mail,"onUpdate:modelValue":t[2]||(t[2]=$=>s.pref.mention_mail=$),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Email me when someone mentions me in a post or comment")),1)]),_:1},8,["modelValue"]),s.pref.mention_mail=="yes"?(i(),c("p",z7,d(e.$t("You will receive an email when someone mentions you in a comment or post.")),1)):(i(),c("p",q7,d(e.$t("No emails will be sent when someone mentions you.")),1))]),l("div",G7,[a(w,{"true-value":"yes","false-value":"no",modelValue:s.pref.digest_mail,"onUpdate:modelValue":t[3]||(t[3]=$=>s.pref.digest_mail=$),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Weekly digest on %s",s.digestEmailDay)),1)]),_:1},8,["modelValue"]),s.pref.digest_mail=="yes"?(i(),c("p",Y7,d(e.$t("You will get a digest email with curated activities in the community")),1)):(i(),c("p",W7,d(e.$t("No digest email will be sent.")),1))]),e.appVars.has_chat&&s.default_messaging_email_frequency!="no"?(i(),c("div",Z7,[l("p",K7,d(e.$t("Email sending frequency for one-to-one messages")),1),a(C,{modelValue:s.pref.message_email_frequency,"onUpdate:modelValue":t[4]||(t[4]=$=>s.pref.message_email_frequency=$),class:"fcom_radio_group"},{default:r(()=>[s.default_messaging_email_frequency!=="disabled"?(i(),v(b,{key:0,value:"default",label:e.$t("Community Default")},null,8,["label"])):_("",!0),a(b,{value:"hourly",label:e.$t("Hourly")},null,8,["label"]),a(b,{value:"daily",label:e.$t("Daily")},null,8,["label"]),a(b,{value:"weekly",label:e.$t("Weekly")},null,8,["label"]),a(b,{value:"disabled",label:e.$t("Disable")},null,8,["label"])]),_:1},8,["modelValue"]),s.pref.message_email_frequency=="disabled"?(i(),c("p",J7,d(e.$t("You will not get any email on new messages from any members")),1)):s.pref.message_email_frequency=="default"?(i(),c("p",Q7,[s.default_messaging_email_frequency=="disabled"?(i(),c(L,{key:0},[V(d(e.$t("Email notification is disabled for one-to-one messages as per global community settings.")),1)],64)):(i(),c(L,{key:1},[V(d(e.$t("You will get email notifications on new messages from your last notification. Frequency: %s",e.$labelize(s.default_messaging_email_frequency))),1)],64))])):(i(),c("p",X7,d(e.$t("You will get email notifications on new messages from your last notification. Frequency: %s",e.$labelize(s.pref.message_email_frequency))),1))])):_("",!0)])]),l("div",e9,[l("div",t9,[a(y,{style:{"font-size":"30px"}},{default:r(()=>[...t[5]||(t[5]=[l("svg",{version:"1.1",viewBox:"0 0 128 128","xml:space":"preserve"},[l("g",null,[l("path",{d:"M64,42c-13.2,0-24,10.8-24,24s10.8,24,24,24s24-10.8,24-24S77.2,42,64,42z M64,82c-8.8,0-16-7.2-16-16s7.2-16,16-16 s16,7.2,16,16S72.8,82,64,82z"}),l("path",{d:"M64,100.8c-14.9,0-29.2,6.2-39.4,17.1l-2.7,2.9l5.8,5.5l2.7-2.9c8.8-9.4,20.7-14.6,33.6-14.6s24.8,5.2,33.6,14.6l2.7,2.9 l5.8-5.5l-2.7-2.9C93.2,107.1,78.9,100.8,64,100.8z"}),l("path",{d:"M97,47.9v8c9.4,0,18.1,3.8,24.6,10.7l5.8-5.5C119.6,52.7,108.5,47.9,97,47.9z"}),l("path",{d:"M116.1,20c0-10.5-8.6-19.1-19.1-19.1S77.9,9.5,77.9,20S86.5,39.1,97,39.1S116.1,30.5,116.1,20z M85.9,20 c0-6.1,5-11.1,11.1-11.1s11.1,5,11.1,11.1s-5,11.1-11.1,11.1S85.9,26.1,85.9,20z"}),l("path",{d:"M31,47.9c-11.5,0-22.6,4.8-30.4,13.2l5.8,5.5c6.4-6.9,15.2-10.7,24.6-10.7V47.9z"}),l("path",{d:"M50.1,20C50.1,9.5,41.5,0.9,31,0.9S11.9,9.5,11.9,20S20.5,39.1,31,39.1S50.1,30.5,50.1,20z M31,31.1 c-6.1,0-11.1-5-11.1-11.1S24.9,8.9,31,8.9s11.1,5,11.1,11.1S37.1,31.1,31,31.1z"})])],-1)])]),_:1}),l("div",s9,[l("h3",null,d(e.$t("New Posts Notifications")),1),l("p",null,d(e.$t("Subscribe to new posts notifications by space")),1)])]),l("div",o9,[s.spaceGroups.length>0?(i(),c(L,{key:0},[l("div",i9,[l("div",n9,d(e.$t("Space")),1),l("div",l9,d(e.$t("Notification")),1)]),(i(!0),c(L,null,D(s.spaceGroups,$=>(i(),c("div",{key:$.id},[l("div",a9,[l("div",r9,[l("div",c9,[l("h4",null,d($.title),1)])])]),l("div",d9,[(i(!0),c(L,null,D($.spaces,I=>(i(),c("div",u9,[l("div",_9,[I.icon?(i(),v(y,{key:0},{default:r(()=>[l("span",{innerHTML:I.icon},null,8,m9)]),_:2},1024)):I.shape_svg?(i(),c("span",{key:1,innerHTML:I.shape_svg},null,8,h9)):(i(),c("span",f9)),l("span",null,d(I.title),1)]),l("div",p9,[a(k,{size:"small",placeholder:e.$t("Email Disabled"),style:{width:"100%","max-width":"200px"},modelValue:I.pref,"onUpdate:modelValue":F=>I.pref=F},{default:r(()=>[a(p,{label:e.$t("Email Disabled"),value:""},null,8,["label"]),a(p,{label:e.$t("Notify only for Admin Posts"),value:"admin_only_posts"},null,8,["label"]),a(p,{label:e.$t("Notify for all posts"),value:"all_member_posts"},null,8,["label"])]),_:1},8,["placeholder","modelValue","onUpdate:modelValue"])])]))),256))])]))),128))],64)):(i(),c("div",g9,[l("h4",null,d(e.$t("No spaces found")),1)]))])]),l("div",y9,[a(S,{onClick:n.saveSettings,disabled:s.saving,loading:s.saving,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Save Changes")),1)]),_:1},8,["onClick","disabled","loading"])])],2)):(i(),c("div",v9,[l("h3",null,d(e.$t("Sorry you do not have permission to access this.")),1),e.auth.user_id?_("",!0):(i(),c("div",b9,[l("p",null,d(e.$t("Please login to access this page.")),1),l("a",{href:e.appVars.auth_url,class:"el-button fcom_primary_button link_button"},d(e.$t("Login")),9,k9)]))]))])}const C9=P(M7,[["render",w9]]),$9={name:"UserNotificationSettings",props:["username"],components:{NotificationPrefForm:C9},mounted(){this.$nextTick(()=>{const e=document.querySelector(".object_info");e&&window.scrollTo({top:e.offsetTop-100,behavior:"smooth"})})}},S9={class:"fcom_routed_notification_settings"};function V9(e,t,o,u,s,n){const m=g("notification-pref-form");return i(),c("div",S9,[a(m,{username:o.username},null,8,["username"])])}const L9=P($9,[["render",V9]]),M9={name:"UserFollowers",components:{Pagination:$e,FollowAction:Qe},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"))}},F9={class:"fcom_dir_layout_classic space_members fcom_dir_layout"},T9={class:"search_member"},P9={class:"feed_filters"},I9={id:"feed_short_by",class:"fcom_feed_filter_label"},U9={key:0,class:"loading"},B9={key:1,class:"no_follow"},E9={key:2,class:"card_list"},A9={role:"region","aria-label":"User Info",class:"card_content"},D9={class:"card_avatar"},R9={class:"card_info"},H9={class:"info_header"},x9={class:"meta_line"},j9={class:"feed_meta_info"},O9=["title"],N9=["title"],z9={key:0,class:"card_description"},q9={class:"card_action"},G9={key:3,role:"region","aria-label":"Pagination",class:"pagination_wrap"};function Y9(e,t,o,u,s,n){const m=g("Search"),f=N,h=X,y=oe,w=ie,b=W,C=g("UserAvatar"),p=g("UserRouteLink"),k=g("FollowAction"),S=g("Pagination");return i(),c("div",F9,[l("div",T9,[a(h,{clearable:"",onClear:n.toSearch,onKeydown:ye(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=$=>s.search=$),placeholder:e.$t("Search Followers...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",P9,[t[5]||(t[5]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",I9,d(e.$t("Sort by:")),1),a(w,{"aria-label":e.$t("Sort followers by"),modelValue:s.sort_by,"onUpdate:modelValue":t[1]||(t[1]=$=>s.sort_by=$),class:"fcom_minimal_select","popper-class":"plain_select",onChange:t[2]||(t[2]=$=>n.toSearch())},{default:r(()=>[a(y,{value:"id",label:e.$t("Most Recent")},null,8,["label"]),a(y,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),s.loading&&!s.follows.length?(i(),c("div",U9,[a(b,{class:"white_loaded",rows:3,animated:!0})])):!s.loading&&!s.follows.length?(i(),c("div",B9,[s.search?(i(),c(L,{key:0},[V(d(e.$t("No results found")),1)],64)):(i(),c(L,{key:1},[V(d(e.$t("No one is following this account yet. Posting and interacting with others helps boost followers!")),1)],64))])):(i(),c("div",E9,[(i(!0),c(L,null,D(s.follows,$=>{var I,F,B,M,E,A,U,T;return i(),c("div",{key:$.followed_id,class:"each_card"},[l("div",A9,[l("div",D9,[a(C,{is_online:e.isOnline((I=$.follower)==null?void 0:I.last_activity),xprofile:$.follower},null,8,["is_online","xprofile"])]),l("div",R9,[l("div",H9,[a(p,{show_pop:!0,show_badge:!0,xprofile:$.follower,show_follow:!0},null,8,["xprofile"]),l("div",x9,"@"+d((F=$.follower)==null?void 0:F.username),1)]),l("div",j9,[(B=$.follower)!=null&&B.created_at?(i(),c("div",{key:0,title:(M=$.follower)==null?void 0:M.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff($.follower.created_at))),9,O9)):_("",!0),(E=$.follower)!=null&&E.last_activity?(i(),c("div",{key:1,title:(A=$.follower)==null?void 0:A.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff($.follower.last_activity))),9,N9)):_("",!0)]),(U=$.follower)!=null&&U.short_description?(i(),c("div",z9,d(e.getExcerpt(((T=$.follower.meta)==null?void 0:T.short_description_rendered)||$.follower.short_description,120)),1)):_("",!0)])]),l("div",q9,[a(k,{profile:$.follower,onRefetch:t[3]||(t[3]=j=>e.$emit("refetch"))},null,8,["profile"])])])}),128))])),n.showPagination?(i(),c("div",G9,[a(S,{hide_on_single:!0,onFetch:t[4]||(t[4]=$=>n.fetchFollowers()),pagination:s.pagination},null,8,["pagination"])])):_("",!0)])}const W9=P(M9,[["render",Y9]]),Z9={name:"UserFollowings",props:["isOwn","profile"],emits:["refetch"],components:{Pagination:$e,FollowAction:Qe},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"))}},K9={class:"fcom_dir_layout_classic space_members fcom_dir_layout"},J9={class:"search_member"},Q9={class:"feed_filters"},X9={id:"feed_short_by",class:"fcom_feed_filter_label"},eS={key:0,class:"loading"},tS={key:1,class:"no_follow"},sS={key:2,class:"card_list"},oS={role:"region","aria-label":"User Info",class:"card_content"},iS={class:"card_avatar"},nS={class:"card_info"},lS={class:"info_header"},aS={class:"meta_line"},rS={class:"feed_meta_info"},cS=["title"],dS=["title"],uS={key:0,class:"card_description"},_S={class:"card_action"},mS={key:3,role:"region","aria-label":"Pagination",class:"pagination_wrap"};function hS(e,t,o,u,s,n){const m=g("Search"),f=N,h=X,y=oe,w=ie,b=W,C=g("UserAvatar"),p=g("UserRouteLink"),k=g("FollowAction"),S=g("Pagination");return i(),c("div",K9,[l("div",J9,[a(h,{clearable:"",onClear:n.toSearch,onKeydown:ye(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=$=>s.search=$),placeholder:e.$t("Search Followings...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",Q9,[t[5]||(t[5]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",X9,d(e.$t("Sort by:")),1),a(w,{"aria-label":e.$t("Sort followings by"),modelValue:s.sort_by,"onUpdate:modelValue":t[1]||(t[1]=$=>s.sort_by=$),class:"fcom_minimal_select","popper-class":"plain_select",onChange:t[2]||(t[2]=$=>n.toSearch())},{default:r(()=>[a(y,{value:"id",label:e.$t("Most Recent")},null,8,["label"]),a(y,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),s.loading&&!s.follows.length?(i(),c("div",eS,[a(b,{class:"white_loaded",rows:3,animated:!0})])):!s.loading&&!s.follows.length?(i(),c("div",tS,[s.search?(i(),c(L,{key:0},[V(d(e.$t("No results found")),1)],64)):o.isOwn?(i(),c(L,{key:1},[V(d(e.$t("You aren't following anyone yet. Start following other members to connect and keep up with their activity!")),1)],64)):(i(),c(L,{key:2},[V(d(e.$t("This user isn't following anyone yet. Once they follow accounts, they'll show up here.")),1)],64))])):(i(),c("div",sS,[(i(!0),c(L,null,D(s.follows,$=>{var I,F,B,M,E,A,U,T;return i(),c("div",{key:$.followed_id,class:"each_card"},[l("div",oS,[l("div",iS,[a(C,{is_online:e.isOnline((I=$.followed)==null?void 0:I.last_activity),xprofile:$.followed},null,8,["is_online","xprofile"])]),l("div",nS,[l("div",lS,[a(p,{show_pop:!0,show_badge:!0,xprofile:$.followed,show_follow:!0},null,8,["xprofile"]),l("div",aS,"@"+d((F=$.followed)==null?void 0:F.username),1)]),l("div",rS,[(B=$.followed)!=null&&B.created_at?(i(),c("div",{key:0,title:(M=$.followed)==null?void 0:M.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff($.followed.created_at))),9,cS)):_("",!0),(E=$.followed)!=null&&E.last_activity?(i(),c("div",{key:1,title:(A=$.followed)==null?void 0:A.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff($.followed.last_activity))),9,dS)):_("",!0)]),(U=$.followed)!=null&&U.short_description?(i(),c("div",uS,d(e.getExcerpt(((T=$.followed.meta)==null?void 0:T.short_description_rendered)||$.followed.short_description,120)),1)):_("",!0)])]),l("div",_S,[a(k,{profile:$.followed,onRefetch:t[3]||(t[3]=j=>e.$emit("refetch"))},null,8,["profile"])])])}),128))])),n.showPagination?(i(),c("div",mS,[a(S,{hide_on_single:!0,onFetch:t[4]||(t[4]=$=>n.fetchFollowings()),pagination:s.pagination},null,8,["pagination"])])):_("",!0)])}const fS=P(Z9,[["render",hS]]),pS={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}})}}},gS={class:"follow_header"},yS={class:"fcom_filter_menu"},vS={class:"fcom_filter_menu_ul"},bS={key:0},kS={key:1},wS={class:"follow_body"};function CS(e,t,o,u,s,n){var f,h;const m=g("router-view");return i(),c(L,null,[l("div",gS,[l("div",yS,[l("ul",vS,[((f=o.profile)==null?void 0:f.followings_count)!=null?(i(),c("li",bS,[l("a",{href:"#",onClick:t[0]||(t[0]=Y(y=>n.switchRoute("user_followings"),["prevent"])),class:R({"router-link-exact-active":n.isActive("user_followings")})},d(e.$t("Following")),3)])):_("",!0),((h=o.profile)==null?void 0:h.followers_count)!=null?(i(),c("li",kS,[l("a",{href:"#",onClick:t[1]||(t[1]=Y(y=>n.switchRoute("user_followers"),["prevent"])),class:R({"router-link-exact-active":n.isActive("user_followers")})},d(e.$t("Followers")),3)])):_("",!0)])])]),l("div",wS,[a(m,{isOwn:o.isOwn,profile:o.profile,onRefetch:t[2]||(t[2]=y=>e.$emit("refetch"))},null,8,["isOwn","profile"])])],64)}const $S=P(pS,[["render",CS]]),SS={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 VS(e,t,o,u,s,n){const m=g("MoreFilled"),f=N,h=O,y=Ye,w=ve,b=de,C=ue,p=fe,k=Q("loading");return i(),v(p,{persistent:!1,placement:"bottom",width:270,visible:s.isOpened,onHide:t[2]||(t[2]=S=>s.isOpened=!1)},{reference:r(()=>[a(h,{"aria-label":e.$t("View actions"),onClick:n.togglePopover,size:"small",text:""},{default:r(()=>[a(f,{class:"fcom_more_icon"},{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:r(()=>[a(C,{onSubmit:t[1]||(t[1]=Y(S=>e.doNothing(),["prevent"])),"label-position":"top"},{default:r(()=>[a(b,{label:e.$t("Status")},{default:r(()=>[a(w,{modelValue:s.status,"onUpdate:modelValue":t[0]||(t[0]=S=>s.status=S)},{default:r(()=>[a(y,{label:e.$t("Active"),value:"active"},null,8,["label"]),a(y,{label:e.$t("Pending"),value:"pending"},null,8,["label"]),a(y,{label:e.$t("Blocked"),value:"blocked"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(b,null,{default:r(()=>[G((i(),v(h,{disabled:s.working,onClick:n.changeMemberStatus,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Update Status")),1)]),_:1},8,["disabled","onClick"])),[[k,s.working]])]),_:1})]),_:1})]),_:1},8,["visible"])}const LS=P(SS,[["render",VS]]),MS={name:"AllMembers",components:{SocialLinks:Mt,Layout:ke,AppLayout:Se,Pagination:$e,MemberAction:LS,FollowAction:Qe},data(){return{loading:!1,members:[],pagination:{page:1,per_page:24,total:0},permission_failed:!1,search:"",status:"active",sort_by:"last_activity",working:!1,openedMemberId:null,memberLayout:this.appVars.features.member_list_layout||"classic"}},methods:{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}).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.working=!0,this.$patch("members/"+e.user_id,{status:t}).then(o=>{this.$notify.success(o.message),e.status=t}).catch(o=>{this.$handleError(o)}).finally(()=>{this.working=!1})},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(){this.$route.query.inactives&&(this.status="in_active"),this.fetch(),this.changeTitle(this.$t("All Members"))}},FS={key:0,class:"card_header"},TS={role:"region","aria-label":"Member Navigation",class:"member_status"};const PS={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},IS={class:"permission_failed"},US=["href"],BS={class:"search_member"},ES={class:"feed_filters"},AS={id:"feed_short_by",class:"fcom_feed_filter_label"},DS={key:0,class:"loading"},RS={key:1,class:"no_members"},HS={key:2,class:"card_list"},xS={role:"region","aria-label":"User Info",class:"card_content"},jS={class:"card_avatar"},OS={class:"card_info"},NS={class:"info_header"},zS={class:"meta_line"},qS={class:"feed_meta_info"},GS=["title"],YS=["title"],WS={key:0,class:"card_description"},ZS={key:1,class:"card_footer"},KS={style:{color:"red",display:"flex",gap:"10px"},class:"meta_line"},JS={class:"card_action"},QS={key:3,role:"region","aria-label":"Pagination",class:"pagination_wrap"};function XS(e,t,o,u,s,n){const m=Ye,f=ve,h=O,y=g("Search"),w=N,b=X,C=oe,p=ie,k=W,S=g("UserAvatar"),$=g("UserRouteLink"),I=g("SocialLinks"),F=g("FollowAction"),B=g("MemberAction"),M=g("Pagination"),E=g("layout"),A=g("app-layout");return i(),v(A,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(E,{use_scroll:!0,class:"no_bg_layout",title:e.$t("All Members")+" "+(s.pagination.total?" ("+e.$formatNumber(s.pagination.total)+")":"")},{default:r(()=>[e.isAdmin()?(i(),c("div",FS,[l("div",TS,[a(f,{onChange:n.toSearch,modelValue:s.status,"onUpdate:modelValue":t[0]||(t[0]=U=>s.status=U),class:"status_group"},{default:r(()=>[a(m,{value:"active"},{default:r(()=>[V(d(e.$t("Active")),1)]),_:1}),a(m,{value:"in_active"},{default:r(()=>[V(d(e.$t("Blocked")),1)]),_:1}),e.hasFeature("can_deactivate_account")?(i(),v(m,{key:0,value:"deactivated"},{default:r(()=>[V(d(e.$t("Deactivated (self)")),1)]),_:1})):_("",!0)]),_:1},8,["onChange","modelValue"])]),_("",!0)])):_("",!0),s.permission_failed?(i(),c("div",PS,[l("div",IS,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view all members")),1),l("a",{href:e.$getRouteLink("/"),class:"el-button fcom_primary_button"},d(e.$t("Go To All Feeds")),9,US)])])):(i(),c(L,{key:2},[l("div",BS,[a(b,{clearable:"",onClear:n.toSearch,onKeydown:ye(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[2]||(t[2]=U=>s.search=U),placeholder:e.$t("Search Members...")},{prefix:r(()=>[a(w,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",ES,[t[6]||(t[6]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",AS,d(e.$t("Sort by:")),1),a(p,{"aria-label":e.$t("Sort members by"),modelValue:s.sort_by,"onUpdate:modelValue":t[3]||(t[3]=U=>s.sort_by=U),class:"fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Latest Posts"),onChange:t[4]||(t[4]=U=>n.fetch())},{default:r(()=>[a(C,{value:"last_activity",label:e.$t("Last Activity")},null,8,["label"]),a(C,{value:"display_name",label:e.$t("Display Name")},null,8,["label"]),a(C,{value:"created_at",label:e.$t("Joining Date")},null,8,["label"])]),_:1},8,["aria-label","modelValue","placeholder"])]),l("div",{class:R(["fcom_dir_layout_"+s.memberLayout,"space_members fcom_dir_layout"])},[s.loading?(i(),c("div",DS,[a(k,{class:"white_loaded",rows:3,animated:!0})])):!s.loading&&!s.members.length?(i(),c("div",RS,d(e.$t("No members found")),1)):(i(),c("div",HS,[(i(!0),c(L,null,D(s.members,(U,T)=>{var j;return i(),c("div",{key:U.user_id,class:"each_card"},[l("div",xS,[l("div",jS,[a(S,{is_online:e.isOnline(U.last_activity),xprofile:U},null,8,["is_online","xprofile"])]),l("div",OS,[l("div",NS,[a($,{show_pop:!0,show_badge:!0,xprofile:U,show_follow:!0},null,8,["xprofile"]),l("div",zS,"@"+d(U.username),1)]),l("div",qS,[U.created_at?(i(),c("div",{key:0,title:U.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(U.created_at))),9,GS)):_("",!0),U.last_activity?(i(),c("div",{key:1,title:U.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(U.last_activity))),9,YS)):_("",!0)]),U.short_description?(i(),c("div",WS,d(e.getExcerpt(((j=U.meta)==null?void 0:j.short_description_rendered)||U.short_description,120)),1)):_("",!0),a(I,{style:{"justify-content":"left"},xprofile:U,isOwn:!1},null,8,["xprofile"]),U.status!="active"?(i(),c("div",ZS,[l("div",KS,[U.status?(i(),c(L,{key:0},[l("span",null,d(e.$t("Status:"))+" "+d(e.$labelize(U.status)),1),a(h,{onClick:z=>n.changeMemberStatus(U,"active"),type:"danger"},{default:r(()=>[V(d(e.$t("Approve Access")),1)]),_:1},8,["onClick"])],64)):(i(),c(L,{key:1},[l("span",null,d(e.$t("Status:"))+" "+d(e.$t("Self Deactivated")),1),a(h,{onClick:z=>n.changeMemberStatus(U,"active"),type:"danger"},{default:r(()=>[V(d(e.$t("Reactivate")),1)]),_:1},8,["onClick"])],64))])])):_("",!0)])]),l("div",JS,[a(F,{profile:U},null,8,["profile"]),e.isAdmin()?(i(),v(B,{key:0,member:U,openedMemberId:s.openedMemberId,onTogglePopover:z=>n.handleTogglePopover(U.user_id)},null,8,["member","openedMemberId","onTogglePopover"])):_("",!0)])])}),128))])),s.pagination.total?(i(),c("div",QS,[a(M,{hide_on_single:!0,onFetch:t[5]||(t[5]=U=>n.fetch()),pagination:s.pagination},null,8,["pagination"])])):_("",!0)],2)],64))]),_:1},8,["title"])]),_:1})}const eV=P(MS,[["render",XS]]),tV={name:"Notifications",components:{AppLayout:Se,Layout:ke,NotificationsBlock:As,Pagination:$e},setup(){return{notificationStore:Qt()}},data(){return{status:"all",loading:!1,notifications:[],pagination:{page:1,per_page:20,total:0},working:!1,notification_type:"all"}},methods:{switchType(e){this.notification_type=e,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)}},sV={class:"fcom_filter_menu"},oV={class:"fcom_filter_menu_ul fcom_notification_types"},iV={style:{"border-top-left-radius":"0","border-top-right-radius":"0"},class:"space_members"},nV={key:0,class:"notifications notifications_wrap"},lV={class:"pagination_wrap"},aV={key:1,style:{"margin-top":"15px"}},rV={key:2};function cV(e,t,o,u,s,n){const m=O,f=Ts,h=g("notifications-block"),y=g("Pagination"),w=W,b=g("layout"),C=g("app-layout"),p=Q("loading");return i(),v(C,{wrapper_class:"fcom_single_layout"},{default:r(()=>[a(b,{content_class:"no_bg_layout notification_layout",title:e.$t("Notifications")},{actions:r(()=>[a(m,{class:"fcom_primary_button",disabled:s.working,onClick:t[0]||(t[0]=k=>n.markAllRead())},{default:r(()=>[V(d(e.$t("Mark all as read")),1)]),_:1},8,["disabled"])]),default:r(()=>[l("div",sV,[l("ul",oV,[l("li",null,[l("a",{onClick:t[1]||(t[1]=Y(k=>n.switchType("all"),["prevent"])),class:R({"router-link-exact-active":s.notification_type=="all"}),href:"#"},d(e.$t("All")),3)]),l("li",null,[l("a",{onClick:t[2]||(t[2]=Y(k=>n.switchType("mentioned"),["prevent"])),class:R({"router-link-exact-active":s.notification_type=="mentioned"}),href:"#"},d(e.$t("Mentions")),3)]),l("li",null,[l("a",{onClick:t[3]||(t[3]=Y(k=>n.switchType("following"),["prevent"])),class:R({"router-link-exact-active":s.notification_type=="following"}),href:"#"},d(e.$t("Following")),3)])]),a(f,{onChange:t[4]||(t[4]=k=>n.fetch()),style:{"--el-switch-on-color":"#2271b1"},"active-value":"unread","inactive-value":"all","active-text":e.$t("Unread only"),modelValue:s.status,"onUpdate:modelValue":t[5]||(t[5]=k=>s.status=k),class:"fcom_switch"},null,8,["active-text","modelValue"])]),l("div",iV,[s.notifications.length?G((i(),c("div",nV,[a(h,{notifications:s.notifications},null,8,["notifications"]),l("div",lV,[a(y,{hide_on_single:!0,onFetch:t[6]||(t[6]=k=>n.fetch()),pagination:s.pagination},null,8,["pagination"])])])),[[p,s.loading]]):s.loading?(i(),c("div",rV,[a(w,{animated:!0,rows:5})])):(i(),c("div",aV,[l("p",null,d(e.$t("No notifications found")),1)]))])]),_:1},8,["title"])]),_:1})}const dV=P(tV,[["render",cV]]),uV={name:"Bookmarks",components:{Feeds:mt,AppLayout:Se,Layout:ke},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"))}},_V={style:{"margin-bottom":"16px"}},mV={class:"search_member"},hV={key:1};function fV(e,t,o,u,s,n){const m=g("Search"),f=N,h=X,y=g("feeds"),w=g("layout"),b=g("app-layout");return i(),v(b,{wrapper_class:"fcom_single_layout fcom_compact_layout"},{default:r(()=>[a(w,{wrapper_class:"no_bg_layout",title:e.$t("Your Bookmarks")},{default:r(()=>[l("h4",_V,d(e.$t("Your saved posts")),1),l("div",mV,[a(h,{clearable:"",onClear:n.handleSearch,onKeydown:ye(n.handleSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=C=>s.search=C),placeholder:e.$t("Search Posts...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),e.appVars.auth.user_id?(i(),v(y,{key:0,feed_base_url:n.feed_base_url,hide_create_form:!0,space:"",feed_name:"all_feeds",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"])):(i(),c("div",hV,[l("p",null,d(e.$t("Please login to view your bookmarks")),1)]))]),_:1},8,["title"])]),_:1})}const pV=P(uV,[["render",fV]]);const gV={name:"AllCourses",components:{AppLayout:Se,Layout:ke,GroupIcon:rs,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)}},yV={class:"object_menu"},vV={class:"fcom_space_menu_ul"},bV={key:0},kV={key:1},wV={key:0,class:"fcom_space_topics"},CV={class:"fcom_topics_filters"},$V={class:"search_member"},SV={class:"feed_filters"},VV={id:"feed_short_by",class:"fcom_feed_filter_label"},LV={class:"fcom_courses"},MV={key:0,class:"fcom_no_items_wrap"},FV={key:2},TV=["href"],PV={class:"fcom_box_card_list"},IV=["onClick"],UV=["src"],BV={key:1,class:"fcom_no_image"},EV={class:"fcom_box_card_info"},AV={class:"fcom_box_card_name"},DV={class:"fcom_box_card_details"},RV={class:"inline_details"},HV={key:0,class:"inline_details"},xV={key:0,class:"fcom_box_card_description"},jV={class:"fcom_box_card_action"},OV=["onClick"],NV=["onClick"];function zV(e,t,o,u,s,n){const m=O,f=ge,h=g("Search"),y=N,w=X,b=oe,C=ie,p=Be,k=g("router-link"),S=g("GroupIcon"),$=g("pagination"),I=g("layout"),F=g("app-layout"),B=Q("loading");return i(),v(F,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(I,{wrapper_class:"no_bg_layout",title:e.$t("Courses")+" "+(s.pagination.total?" ("+e.$formatNumber(s.pagination.total)+")":"")},{actions:r(()=>[l("div",yV,[l("ul",vV,[l("li",null,[l("a",{onClick:t[0]||(t[0]=Y(M=>n.SwitchToCourseView("all"),["prevent"])),class:R(s.type=="all"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("All Courses")),3)]),e.auth.user_id?(i(),c("li",bV,[l("a",{onClick:t[1]||(t[1]=Y(M=>n.SwitchToCourseView("enrolled"),["prevent"])),class:R(s.type=="enrolled"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("My Courses")),3)])):_("",!0),e.hasCourseCreatorAccess()?(i(),c("li",kV,[a(m,{onClick:t[2]||(t[2]=M=>n.emitCreateCourse()),class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("New Course")),1)]),_:1})])):_("",!0)])])]),default:r(()=>[s.courseCategories&&s.courseCategories.length?(i(),c("div",wV,[a(f,null,{default:r(()=>[l("div",CV,[a(m,{onClick:t[3]||(t[3]=M=>n.setTopic("")),class:R({fcom_active_topic:!s.topic_slug})},{default:r(()=>[V(d(e.$t("All")),1)]),_:1},8,["class"]),(i(!0),c(L,null,D(s.courseCategories,M=>(i(),v(m,{key:M.slug,onClick:E=>n.setTopic(M.slug),class:R({fcom_active_topic:M.slug==s.topic_slug})},{default:r(()=>[V(d(M.title),1)]),_:2},1032,["onClick","class"]))),128))])]),_:1})])):_("",!0),l("div",$V,[a(w,{clearable:"",onClear:n.toSearch,onKeydown:ye(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[4]||(t[4]=M=>s.search=M),placeholder:e.$t("Search Courses...")},{prefix:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",SV,[t[9]||(t[9]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",VV,d(e.$t("Sort by:")),1),a(C,{"aria-label":e.$t("Sort Courses by"),modelValue:s.sort_by,"onUpdate:modelValue":t[5]||(t[5]=M=>s.sort_by=M),class:"fcom_minimal_select space_sort_select","popper-class":"plain_select",onChange:t[6]||(t[6]=M=>n.changeSortBy())},{default:r(()=>[a(b,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"]),a(b,{value:"latest",label:e.$t("Latest Courses")},null,8,["label"]),a(b,{value:"oldest",label:e.$t("Oldest Courses")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),G((i(),c("div",LV,[!s.loading&&!s.courses.length?(i(),c("div",MV,[s.topic_slug?(i(),c(L,{key:0},[l("h3",null,d(e.$t("No courses found in this topic")),1),l("p",null,d(e.$t("No courses found based on your search criteria")),1)],64)):s.type=="all"?(i(),c(L,{key:1},[s.search?(i(),c(L,{key:0},[l("h3",null,d(e.$t("No courses found based on your search criteria")),1),l("p",null,d(e.$t("No courses match your search criteria. Try adjusting your search terms or browse our course catalog.")),1)],64)):e.isAdmin()?(i(),c(L,{key:1},[l("h3",null,d(e.$t("Create your first course")),1),l("p",null,d(e.$t("Deliver engaging & high-performance learning experiences in your community.")),1),a(m,{onClick:t[7]||(t[7]=M=>n.emitCreateCourse()),class:"fcom_primary_button fcom_mt_10"},{default:r(()=>[V(d(e.$t("Create a Course")),1)]),_:1})],64)):(i(),c("div",FV,[l("h3",null,d(e.$t("No published courses found")),1),l("p",null,d(e.$t("Please check back later. We are in a process to publish some courses for you!")),1)]))],64)):(i(),c(L,{key:2},[s.search?(i(),c(L,{key:0},[l("h3",null,d(e.$t("No courses found based on your search criteria")),1),l("p",null,d(e.$t("No courses match your search criteria. Try adjusting your search terms or browse our course catalog.")),1)],64)):e.auth.user_id?(i(),c(L,{key:2},[l("h3",null,d(e.$t("Your enrolled courses will be shown here")),1),l("p",null,d(e.$t("Once you enroll some courses, those will be shown here")),1),l("a",{onClick:t[8]||(t[8]=Y(M=>n.SwitchToCourseView("all"),["prevent"])),class:"el-button fcom_primary_button fcom_mt_10",href:"#"},d(e.$t("View all courses")),1)],64)):(i(),c(L,{key:1},[l("h3",null,d(e.$t("Login to see your courses")),1),l("p",null,d(e.$t("Once you login, your enrolled courses will be shown here.")),1),l("a",{href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button"},d(e.$t("Login")),9,TV)],64))],64))])):_("",!0),l("div",PV,[(i(!0),c(L,null,D(s.courses,M=>(i(),c("div",{key:M.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:E=>e.$router.push({name:"view_course",params:{course_slug:M.slug}})},[M.cover_photo?(i(),c("img",{key:0,src:M.cover_photo,alt:""},null,8,UV)):(i(),c("div",BV))],8,IV),l("div",EV,[l("div",AV,[a(k,{class:"course_route",to:{name:"view_course",params:{course_slug:M.slug}}},{default:r(()=>[V(d(M.title)+" ",1),M.status=="draft"?(i(),v(p,{key:0,type:"info"},{default:r(()=>[V(d(M.status),1)]),_:2},1024)):_("",!0)]),_:2},1032,["to"])]),l("div",DV,[l("div",RV,[l("span",null,d(e.$_n("%d Section","%d Sections",M.sectionsCount)),1),t[10]||(t[10]=l("span",{class:"fcom_inline_separator"},null,-1)),l("span",null,d(e.$_n("%d Lesson","%d Lessons",M.lessonsCount)),1)]),M.studentsCount?(i(),c("div",HV,[a(y,null,{default:r(()=>[a(S)]),_:1}),V(" "+d(e.$_n("%s student","%s students",e.$formatNumber(M.studentsCount))),1)])):_("",!0)]),M.description?(i(),c("div",xV,d(n.getExcerpt(M.description)),1)):_("",!0),l("div",jV,[M.isEnrolled?(i(),c("button",{key:0,class:"fcom_card_button",onClick:E=>e.$router.push({name:"view_course",params:{course_slug:M.slug}})},d(e.$t("%s Completed",M.progress+"%")),9,OV)):(i(),c("button",{key:1,class:"fcom_card_button",onClick:E=>e.$router.push({name:"view_course",params:{course_slug:M.slug}})},d(e.$t("View Course")),9,NV))])])]))),128))]),a($,{hide_on_single:!0,onFetch:n.fetchCourses,pagination:s.pagination},null,8,["onFetch","pagination"])])),[[B,s.loading]])]),_:1},8,["title"])]),_:1})}const qV=P(gV,[["render",zV],["__scopeId","data-v-fd29bbd3"]]),GV={name:"ViewCoursesRoute",components:{Layout:ke,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 De(this.sections,t=>{De(t.lessons,o=>{e.push(o)})}),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(De(this.allLessons,(t,o)=>{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 De(this.allLessons,(t,o)=>{if(o>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 o=null,u=null;De(this.allLessons,(s,n)=>{if(s.slug==e)return o=s,u=n,!1}),o&&(this.loading=!0,this.currentLesson=null,this.currentLessonIndex=null,this.$nextTick(()=>{this.currentLessonIndex=u,this.currentLesson=o,this.currentLesson.lazy_load&&this.currentLesson.can_view&&(this.currentLesson.content_loading=!0,this.fetchLesson(o.slug,s=>{s.slug==this.currentLesson.slug&&(this.currentLesson.content=s.content,this.currentLesson.content_loading=!1)})),this.changeTitle(this.currentLesson.title),this.$router.push({name:"view_lesson",params:{lesson_slug:o.slug},query:t?this.$route.query:{}}),this.loading=!1}))},fetchLesson(e,t=null){this.$get("courses/"+this.course.slug+"/lessons/"+e+"/by-slug").then(o=>{t&&t(o.lesson)}).catch(o=>{this.$handleError(o),t&&t({slug:e,content:"

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

"})})}},created(){this.fetchCourse()}},YV={key:0},WV={style:{padding:"20px"},class:"fcom_course_sections fcom_white_loaded"},ZV={key:1},KV={key:2,style:{padding:"1rem 2rem"}};function JV(e,t,o,u,s,n){const m=Zt,f=Kt,h=W,y=g("layout"),w=g("app-layout"),b=g("router-view");return s.loading?(i(),c("div",YV,[a(w,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(y,{title:"...."},{title:r(()=>[a(f,{"separator-class":"el-icon-arrow-right"},{default:r(()=>[a(m,{to:{name:"courses"}},{default:r(()=>[V(d(e.$t("Courses")),1)]),_:1}),a(m,null,{default:r(()=>[...t[1]||(t[1]=[V("....",-1)])]),_:1})]),_:1})]),default:r(()=>[l("div",WV,[a(h,{rows:10,animated:!0})])]),_:1})]),_:1})])):s.course.id?(i(),c("div",ZV,[a(b,{track:s.track,course:s.course,sections:s.sections,lessonsCount:n.lessonsCount,currentLesson:s.currentLesson,currentLessonIndex:s.currentLessonIndex,onSetNextLesson:n.handleNextLesson,onSetPrevLesson:n.setPrevLesson,onGoToLesson:n.goToLesson,onReload:n.fetchCourse,onUpdateTrack:t[0]||(t[0]=C=>{s.track=C})},null,8,["track","course","sections","lessonsCount","currentLesson","currentLessonIndex","onSetNextLesson","onSetPrevLesson","onGoToLesson","onReload"])])):(i(),c("div",KV,[l("h3",null,d(e.$t("Sorry, the course could not be loaded.")),1)]))}const QV=P(GV,[["render",JV]]),XV={name:"LockIcon",props:{fill:{type:String,default:"currentColor"}}},eL={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function tL(e,t,o,u,s,n){return i(),c("svg",eL,[...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 sL=P(XV,[["render",tL]]),oL={name:"LockscreenView",components:{CustomLockscreenView:mo,DefaultLockscreenPaywall:ho},props:["space_profile","sections"],emits:["join"],data(){return{isRedirecting:!1}},created(){var e,t,o,u;((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.custom_lock_screen)=="redirect"&&((u=(o=this.space_profile)==null?void 0:o.settings)!=null&&u.onboard_redirect_url)&&(this.isRedirecting=!0,window.location.href=this.space_profile.settings.onboard_redirect_url)}},iL={key:0,style:{"text-align":"center",margin:"50px 0"}},nL={class:"space_lock_box space_default_lock_box"},lL={class:"lock_desc"},aL=["href"],rL={key:1,class:"space_lock_box"},cL={key:2,class:"space_lock_box"},dL=["href"];function uL(e,t,o,u,s,n){var w;const m=g("Lock"),f=N,h=g("default-lockscreen-paywall"),y=g("custom-lockscreen-view");return s.isRedirecting?(i(),c("h3",iL,d(e.$t("Please wait....")),1)):(i(),c(L,{key:1},[o.space_profile.lockscreen_config?(i(),c(L,{key:0},[o.space_profile.lockscreen_config.showCustom?(i(),v(y,{key:1,sections:o.sections,profile:o.space_profile},null,8,["sections","profile"])):(i(),c(L,{key:0},[l("div",nL,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("This is a private course")),1),l("p",lL,d(e.$t("Members have to be invited to this course.")),1),e.auth.user_id?_("",!0):(i(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.$t("Login or Signup")),9,aL))]),o.space_profile.lockscreen_config.showPaywalls?(i(),v(h,{key:0,space_id:(w=o.space_profile)==null?void 0:w.id},null,8,["space_id"])):_("",!0)],64))],64)):o.space_profile.permissions.is_pending?(i(),c("div",rL,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("Your request to join this course is pending")),1)])):e.auth.user_id?_("",!0):(i(),c("div",cL,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("Please login/signup to enroll this course")),1),l("a",{href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,dL)]))],64))}const _L=P(oL,[["render",uL]]),mL={name:"CollapseIcon"},hL={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function fL(e,t,o,u,s,n){return i(),c("svg",hL,[...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 pL=P(mL,[["render",fL]]),gL={name:"ViewCourse",components:{VideoPlay:xo,RenderSpaceLinks:ls,LockScreenView:_L,AppLayout:Se,Layout:ke,CircleIcon:as,LockIcon:sL,SocialLinks:Mt,PlayIcon:lo,LessonIcon:no,PlayPlaceholderIcon:ao,CollapseIcon:pL},props:["course","sections","track","lessonsCount"],$emit:["setNextLesson","goToLesson","reload"],data(){return{enrolling:!1}},computed:{sectionsCount(){return this.sections.reduce((e,t)=>e+(t.lessons.length?1:0),0)},isCustomLockScreen(){var e,t;return((t=(e=this.course)==null?void 0:e.settings)==null?void 0:t.custom_lock_screen)==="yes"},showCourseSections(){return this.track.isEnrolled||this.course.is_course_admin||!this.course.lockscreen_config},isModernLayout(){var e,t;return this.has_pro&&((t=(e=this.course)==null?void 0:e.settings)==null?void 0:t.course_layout)==="modern"},lessonDuration(){return e=>{const t=e.lessons.reduce((o,u)=>o+(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 o;const t=(o=e.meta)==null?void 0:o.media;return this.isEnabledMedia(e)&&(t==null?void 0:t.content_type)=="video"&&(t==null?void 0:t.html)},hasMediaImage(e){var t,o;return this.isEnabledMedia(e)&&((o=(t=e.meta)==null?void 0:t.media)==null?void 0:o.image)},isLockLesson(e,t){return(e.is_locked||!this.track.isEnrolled)&&!t.can_view},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")},maybeGotoLesson(e,t,o){if(e.can_view){this.$emit("goToLesson",e.slug);return}if(!t.isEnrolled||o.is_locked){o.unlock_date?this.$notify.info({message:this.$t("This lesson will be unlocked on %s",o.unlock_date),type:"info"}):t.isEnrolled||this.$notify.info({message:this.$t("You need to enroll in this course to access this lesson"),type:"info"});return}this.$emit("goToLesson",e.slug)},formatSeconds(e){if(e<1)return null;let t=Math.floor(e/3600),o=Math.floor(e%3600/60),u=e%60,s="";return t>0&&(s+=`${t}h `),o>0&&(s+=`${o}m `),u>0&&(s+=`${u}s`),s.trim()||null}},mounted(){this.appVars.course_sections_collapsed=="yes"&&this.toggleAllSections()}},yL=["href"],vL={class:"fcom_course_actions"},bL=["href"],kL={key:0,class:"fcom_sub_header"},wL={key:0,class:"fcom_notice"},CL={class:"fcom_feed_box course_box"},$L={class:"fcom_course_sections"},SL={class:"fcom_course_intro"},VL={class:"fcom_course_labels"},LL={class:"fcom_course_info"},ML=["innerHTML"],FL={class:"fcom_card_sections"},TL={class:"fcom_section_items"},PL=["onClick"],IL={class:"fcom_section_primary_item_title"},UL={class:"title_line_container"},BL={class:"title_line"},EL={key:0,class:"section_lock_badge"},AL={class:"fcom_meta_text"},DL={key:0,class:"fcom_meta_text"},RL={class:"fcom_section_primary_item_actions"},HL=["onClick"],xL={class:"fcom_heading_item clickable"},jL={class:"lesson_feature_media"},OL=["src","alt"],NL=["src","alt"],zL={class:"lesson_title"},qL=["innerHTML"],GL={class:"lesson_duration"},YL={key:0},WL={key:1},ZL=["innerHTML"],KL={key:0,class:"fcom_section_item_actions"},JL={class:"fcom_meta_text"},QL={class:"fcom_main_side_wrap"},XL={class:"fcom_side_box"},eM={key:0,class:"app_side_widget course_widget"},tM={class:"widget_header"},sM={class:"widget_body"},oM={class:"progress_label"},iM={key:0,style:{margin:"20px 0"}},nM={key:1,class:"app_side_widget course_widget"},lM={class:"widget_header"},aM={class:"widget_body"},rM={class:"creator_details"},cM={class:"creator_details_item"},dM={class:"creator_details_info"},uM={class:"info_text"},_M={class:"details_name"},mM={class:"details_meta"},hM={class:"fcom_meta_text"},fM={key:0,class:"fcom_meta_text"},pM=["innerHTML"],gM={key:2};function yM(e,t,o,u,s,n){const m=Zt,f=Kt,h=O,y=g("render-space-links"),w=g("CollapseIcon"),b=g("Lock"),C=N,p=g("ArrowRight"),k=g("ArrowDown"),S=g("SuccessFilled"),$=g("LockIcon"),I=g("CircleIcon"),F=g("PlayPlaceholderIcon"),B=g("LessonIcon"),M=g("PlayIcon"),E=g("VideoPlay"),A=Le,U=Wt,T=g("UserAvatar"),j=g("UserRouteLink"),z=g("SocialLinks"),ne=We,x=xe,ee=g("LockScreenView"),H=g("layout"),te=g("app-layout"),K=Q("loading");return i(),v(te,{wrapper_class:"fcom_single_layout fcom_max_layout fcom_course_view_layout"},{default:r(()=>[a(H,{wrapper_class:["no_bg_layout",{custom_lockscreen:!n.showCourseSections}],title:e.$t("Courses")},{title:r(()=>[a(f,{"separator-class":"el-icon-arrow-right"},{default:r(()=>[a(m,{to:{name:"courses"}},{default:r(()=>[V(d(e.$t("Courses")),1)]),_:1}),a(m,null,{default:r(()=>[V(d(o.course.title)+" ",1),o.course.is_course_admin?(i(),c("a",{key:0,class:"fcom_edit_course fcom_secondary_button",style:{cursor:"pointer"},href:n.editLessonLink()},d(e.$t("Edit Lessons")),9,yL)):_("",!0)]),_:1})]),_:1})]),actions:r(()=>[l("div",vL,[e.auth.user_id?!o.track.isEnrolled&&o.course.id?G((i(),v(h,{key:1,disabled:s.enrolling,onClick:n.enroll,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[K,s.enrolling]]):o.track.progress!=100?(i(),v(h,{key:2,class:"fcom_primary_button",onClick:n.continueCourse},{default:r(()=>[V(d(e.$t("Continue Course")),1)]),_:1},8,["onClick"])):_("",!0):(i(),c(L,{key:0},[n.isCustomLockScreen?_("",!0):(i(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login to enroll this course")),9,bL))],64))])]),sub_header:r(()=>{var ce,J;return[o.course&&n.showCourseSections&&((J=(ce=o.course)==null?void 0:ce.settings)!=null&&J.links.length)?(i(),c("div",kL,[a(y,{links:o.course.settings.links},null,8,["links"])])):_("",!0)]}),default:r(()=>[o.course.status==="draft"?(i(),c("div",wL,[l("p",null,d(e.$t("This course is in Draft status and only visible to Admin / Moderators")),1)])):_("",!0),n.showCourseSections?(i(),v(x,{key:1,class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(A,{class:"fcom_main"},{default:r(()=>{var ce;return[l("div",CL,[l("div",$L,[l("div",SL,[l("div",VL,[l("h3",null,d(o.course.title),1),l("p",LL,[V(d(e.$_n("%s Topic","%s Topics",n.sectionsCount))+" ",1),t[0]||(t[0]=l("span",null," โ€ข ",-1)),V(" "+d(e.$_n("%s Lesson","%s Lessons",o.lessonsCount)),1)])])]),(ce=o.course.settings)!=null&&ce.course_details_rendered?(i(),c("div",{key:0,class:"fcom_course_details feed_md_content",innerHTML:o.course.settings.course_details_rendered},null,8,ML)):_("",!0),l("div",{class:R(["course_contents_header",{is_collapsed:n.isCollapsed}])},[l("h4",null,d(e.$t("Course Contents")),1),n.sectionsCount>1?(i(),v(w,{key:0,class:"collapse_icon clickable",onClick:n.toggleAllSections},null,8,["onClick"])):_("",!0)],2),l("div",FL,[l("div",TL,[(i(!0),c(L,null,D(o.sections,J=>(i(),c("div",{key:J.id,class:"fcom_section_primary"},[l("div",{onClick:se=>J.is_closed=!J.is_closed,class:R(["clickable fcom_section_primary_item",{is_closed:J.is_closed}])},[l("div",IL,[l("div",UL,[l("div",BL,[l("h4",null,d(J.title),1),J.unlock_date?(i(),c("span",EL,[J.is_locked?(i(),v(C,{key:0},{default:r(()=>[a(b)]),_:1})):_("",!0),l("span",null," ("+d(e.$t("will unlock at %s",e.smartDate(J.unlock_date,!0,!0)))+") ",1)])):_("",!0)]),l("span",AL,d(e.$_n("%s lesson","%s lessons",J.lessons.length)),1),n.lessonDuration(J)?(i(),c("span",DL," โ€ข "+d(n.lessonDuration(J)),1)):_("",!0)])]),l("div",RL,[a(C,null,{default:r(()=>[J.is_closed?(i(),v(p,{key:0,class:"fcom_arrow_icon"})):(i(),v(k,{key:1}))]),_:2},1024)])],10,PL),J.is_closed?_("",!0):(i(!0),c(L,{key:0},D(J.lessons,se=>(i(),c("div",{key:se.id,class:R(["fcom_section_item",{is_locked:n.isLockLesson(J,se)}])},[l("div",{onClick:ht=>n.maybeGotoLesson(se,o.track,J),class:"fcom_section_item_title"},[l("p",xL,[o.track.completed_lessons.includes(se.id.toString())?(i(),v(C,{key:0,style:{color:"#008a2e"}},{default:r(()=>[a(S)]),_:1})):n.isLockLesson(J,se)?(i(),v(C,{key:1},{default:r(()=>[a($)]),_:1})):(i(),v(C,{key:2},{default:r(()=>[a(I)]),_:1})),n.isModernLayout?(i(),c(L,{key:3},[l("span",jL,[se.featured_image?(i(),c("img",{key:0,src:se.featured_image,alt:se.title},null,8,OL)):n.hasMediaImage(se)?(i(),c("img",{key:1,src:se.meta.media.image,alt:se.title},null,8,NL)):n.hasMediaVideo(se)?(i(),v(F,{key:2})):(i(),v(B,{key:3})),n.showPlayIcon(se)?(i(),v(M,{key:4,class:"play_icon"})):_("",!0)]),l("span",zL,[l("span",{innerHTML:se.title},null,8,qL),l("span",GL,[se.meta.video_length?(i(),c("span",YL,d(n.formatSeconds(se.meta.video_length)),1)):(i(),c("span",WL,d("---")))])])],64)):(i(),c("span",{key:4,innerHTML:se.title},null,8,ZL))])],8,HL),!n.isModernLayout&&se.meta.enable_media=="yes"&&se.meta.video_length?(i(),c("div",KL,[l("span",JL,[se.meta.video_length?(i(),v(h,{key:0,onClick:ht=>n.maybeGotoLesson(se,o.track,J),text:""},{default:r(()=>[a(C,{class:"fcom_play_btn_icon"},{default:r(()=>[a(E)]),_:1}),l("span",null,d(n.formatSeconds(se.meta.video_length)),1)]),_:2},1032,["onClick"])):_("",!0)])])):_("",!0)],2))),128))]))),128))])])])])]}),_:1}),n.showSidebar?(i(),v(ne,{key:0,class:"fcom_resp_side",width:"306px"},{default:r(()=>[l("div",QL,[l("div",XL,[o.track.isEnrolled?(i(),c("div",eM,[l("div",tM,[l("h3",null,d(e.$t("Course progress")),1)]),l("div",sM,[l("div",oM,[l("p",null,d(e.$t("Completed %1$s of %2$s",o.track.completed_lessons.length,o.lessonsCount)),1),l("span",null,d(parseInt(o.track.progress))+"%",1)]),a(U,{class:"fcom_progress","stroke-width":10,percentage:parseInt(o.track.progress),"show-text":!1},null,8,["percentage"]),o.track.progress==100?(i(),c("div",iM,[l("h5",null,d(e.$t("Congratulations! Course completed! ๐ŸŽ‰")),1)])):_("",!0)])])):_("",!0),o.course.creator?(i(),c("div",nM,[l("div",lM,[l("h3",null,d(e.$t("Course Instructor")),1)]),l("div",aM,[l("div",rM,[l("div",cM,[l("div",dM,[a(T,{with_level:!1,xprofile:o.course.creator},null,8,["xprofile"]),l("div",uM,[l("div",_M,[a(j,{show_badge:!0,xprofile:o.course.creator},null,8,["xprofile"])]),l("div",mM,[l("span",hM,d(e.$_n("%d Course","%d Courses",o.course.creator.total_courses)),1),o.course.creator.total_students?(i(),c("span",fM," โ€ข "+d(e.$_n("%d Student","%d Students",o.course.creator.total_students)),1)):_("",!0)])])]),o.course.creator.short_description_rendered?(i(),c("div",{key:0,class:"creator_details_description feed_md_content",innerHTML:o.course.creator.short_description_rendered},null,8,pM)):_("",!0)]),a(z,{xprofile:o.course.creator},null,8,["xprofile"])])])])):_("",!0)])])]),_:1})):_("",!0)]),_:1})):_("",!0),n.showCourseSections?_("",!0):(i(),c("div",gM,[a(ee,{space_profile:o.course,sections:o.sections},null,8,["space_profile","sections"])]))]),_:1},8,["wrapper_class","title"])]),_:1})}const vM=P(gL,[["render",yM]]),bM={name:"CommentBox",components:{FeedComments:Gs,FeedTextComposer:_t},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,o,u;const e=((t=this.comment.media_images)==null?void 0:t.length)>0||((u=(o=this.comment.meta)==null?void 0:o.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(s=>{this.feed.comments||(this.feed.comments=[]),this.feed.comments.unshift(s.comment),this.$emit("commented",s.comment),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.commenting=!1,this.comment=null,this.showCommentBox=!1,this.$nextTick(()=>{this.comment={message:"",media_image:""}}),this.showCommentBox=!0}).catch(s=>{this.$handleError(s)}).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)}},kM=["id"],wM={key:0,class:"feed_commenting"},CM={class:"person_avatar"},$M=["src"],SM={key:0,class:"feed_comment_input"},VM={key:1,class:""},LM={style:{padding:"0",margin:"0","text-align":"center"}},MM={key:0,class:"fcom_comment_sorting"};function FM(e,t,o,u,s,n){const m=O,f=g("feed-text-composer"),h=g("router-link"),y=oe,w=ie,b=g("feed-comments");return i(),c("div",{class:R(["fcom_comment_box","fcom_comment_box_"+o.feed.type])},[q(e.$slots,"before_comment_box"),(s.commenting||o.is_single)&&o.show_comment_form?(i(),c("div",{key:0,id:"feed_comment_form_"+o.feed.id,class:"feed_comment"},[!o.checkPermission||e.hasCommentPermission(o.feed)?(i(),c(L,{key:0},[s.comment?(i(),c("div",wM,[l("div",CM,[l("img",{alt:"",src:e.auth.avatar},null,8,$M)]),s.showCommentBox?(i(),c("div",SM,[a(f,{context:"comment",mentionQuery:{space_id:n.getSpaceId()},autofocus_changed:s.commenting,autofocus:s.commenting,disabled:s.saving,placeholder:e.$t("Write a comment"),content:s.comment},{default:r(()=>[a(m,{loading:s.saving,disabled:s.saving,class:"fcom_primary_button",size:"small",onClick:t[0]||(t[0]=C=>n.postComment())},{default:r(()=>[V(d(e.$t("Post Comment")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["mentionQuery","autofocus_changed","autofocus","disabled","placeholder","content"])])):_("",!0)])):_("",!0)],64)):(i(),c("div",VM,[l("p",LM,[V(d(e.$t("Please join the Space to post a comment."))+" ",1),o.feed.space?(i(),v(h,{key:0,to:{name:"space_feeds",params:{space:o.feed.space.slug}}},{default:r(()=>[V(d(e.$t("Go to community")),1)]),_:1},8,["to"])):_("",!0)])]))],8,kM)):_("",!0),a(b,{sortBy:s.sortBy,checkPermission:o.checkPermission,onForceShowAll:n.showAllComments,show_all:s.show_all_comments,feed:o.feed},{before_comments_start:r(()=>[o.feed.comments_count>=2?(i(),c("div",MM,[a(w,{"aria-label":e.$t("Sort comments by"),onChange:t[1]||(t[1]=C=>n.changeCommentsSortBy()),modelValue:s.sortBy,"onUpdate:modelValue":t[2]||(t[2]=C=>s.sortBy=C),class:"fcom_off_color fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Sort by")},{default:r(()=>[a(y,{value:"oldest",label:e.$t("Earliest")},null,8,["label"]),a(y,{value:"latest",label:e.$t("Latest")},null,8,["label"]),a(y,{value:"popular",label:e.$t("Popular")},null,8,["label"]),a(y,{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"]),q(e.$slots,"after_comment_box")],2)}const TM=P(bM,[["render",FM]]),PM={name:"ExitFullScreen"},IM={viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"};function UM(e,t,o,u,s,n){return i(),c("svg",IM,[...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 BM=P(PM,[["render",UM]]),EM={name:"QuizView",props:{lesson:{type:Object,required:!0},isEnrolled:{type:Boolean,required:!0},questions:{type:Array,required:!0}},components:{Check:Cs},data(){return{userResult:{},answers:this.initAnswers(),isNew:!1,submitting:!1,loading:!1}},computed:{alreadyAttempted(){var e;return(e=this.userResult)==null?void 0:e.id},isAllAnswersSelected(){return this.questions.every(e=>this.isSingleChoice(e)?this.answers[e.slug]!==null:this.answers[e.slug]&&this.answers[e.slug].length>0)},quizSettings(){return this.lesson.meta},showResult(){var e;return this.quizSettings.hide_result=="no"&&((e=this.userResult)==null?void 0:e.id)},isPassed(){var e;return((e=this.userResult)==null?void 0:e.status)==="passed"}},methods:{initAnswers(){return this.questions.reduce((e,t)=>(e[t.slug]=[],t.type=="single_choice"&&(e[t.slug]=null),e),{})},syncAnswers(){var t;const e=((t=this.userResult)==null?void 0:t.message)||[];this.answers=this.initAnswers(),e&&xi.each(e,(o,u)=>{this.answers[u]=o.user_answer})},retakeQuiz(){this.answers=this.initAnswers(),this.userResult={},this.submitting=!1,this.loading=!1,this.isNew=!0},showQuestion(e){var o;if(!this.alreadyAttempted)return!0;const t=((o=this.userResult)==null?void 0:o.message)||[];return!!(this.isNew||t[e.slug])},isSingleChoice(e){return e.type=="single_choice"},isMultipleChoice(e){return e.type=="multiple_choice"},showQuestionImage(e){return e.image_enabled&&e.image_url},isQuestionCorrect(e){var t,o,u;return(u=(o=(t=this.userResult)==null?void 0:t.message)==null?void 0:o[e.slug])==null?void 0:u.is_correct},isOptionSelected(e,t){return this.isSingleChoice(e)?this.answers[e.slug]===t.label:(this.answers[e.slug]||[]).includes(t.label)},handleOptionChange(e,t){if(this.isSingleChoice(e)&&(this.answers[e.slug]===t.label?this.answers[e.slug]=null:this.answers[e.slug]=t.label),this.isMultipleChoice(e)){const o=this.answers[e.slug]||[];o.indexOf(t.label)>-1?this.answers[e.slug]=o.filter(s=>s!==t.label):this.answers[e.slug]=[...o,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.syncAnswers()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.submitting=!1}))}},mounted(){this.isEnrolled&&this.has_pro&&this.fetchAnswers()}},AM={key:0,class:"fcom_questions_wrap"},DM={key:0,class:"fcom_quiz_result"},RM={class:"result_status"},HM={key:0,class:"result_status_text"},xM={key:0},jM={key:1},OM={class:"result_score"},NM={class:"score_part"},zM={class:"part_label"},qM={class:"part_value"},GM={class:"score_part"},YM={class:"part_label"},WM={class:"part_value"},ZM={key:0,class:"fcom_question"},KM={key:0,class:"fcom_question_image"},JM={class:"fcom_question_header"},QM=["innerHTML"],XM={class:"fcom_question_body"},eF={key:0,class:"correct_text"},tF={key:1,class:"correct_text"},sF={class:"fcom_question_options"},oF={key:1,class:"question_help_text"},iF={key:2,class:"fcom_quiz_footer"},nF={key:0};function lF(e,t,o,u,s,n){var p,k;const m=O,f=Pe,h=g("Check"),y=N,w=g("Close"),b=_e,C=W;return i(),c(L,null,[s.loading?(i(),v(C,{key:1,rows:5,animated:""})):(i(),c("div",AM,[n.alreadyAttempted?(i(),c("div",DM,[l("div",RM,[["passed","failed"].includes(s.userResult.status)?(i(),c("div",HM,[l("p",null,[n.isPassed?(i(),c("span",xM,"๐ŸŽ‰ ")):(i(),c("span",jM,"๐Ÿ˜ž ")),l("span",null,d(e.$t("You")),1),l("span",{style:re({color:n.isPassed?"green":"red"})},d(n.isPassed?" "+e.$t("passed")+" ":" "+e.$t("failed")+" "),5),l("span",null,d(e.$t("the quiz.")),1)]),l("p",null,d(n.isPassed?e.$t("Great job!"):e.$t("Try again!")),1)])):(i(),c(L,{key:1},[l("p",null,d(e.$t("We have saved your quiz results.")),1),l("p",null,d(e.$t("Please await the grading.")),1)],64)),a(m,{class:"fcom_secondary_button",onClick:n.retakeQuiz},{default:r(()=>[V(d(e.$t("Retake Quiz")),1)]),_:1},8,["onClick"])]),l("div",OM,[l("div",NM,[l("span",zM,d(e.$t("Score")),1),l("span",qM,d(s.userResult.score)+"%",1)]),l("div",GM,[l("span",YM,d(e.$t("Correct Answers")),1),l("span",WM,d(((p=s.userResult.meta)==null?void 0:p.correct_answers)+" / "+((k=s.userResult.meta)==null?void 0:k.total_questions)),1)])])])):_("",!0),(i(!0),c(L,null,D(o.questions,S=>(i(),c(L,{key:S.slug},[n.showQuestion(S)?(i(),c("div",ZM,[n.showQuestionImage(S)?(i(),c("div",KM,[a(f,{src:S.image_url},null,8,["src"])])):_("",!0),l("div",JM,[l("div",{innerHTML:S.label_rendered,class:"fcom_question_label"},null,8,QM)]),l("div",XM,[n.showResult?(i(),c("div",{key:0,class:R(["fcom_is_correct",n.isQuestionCorrect(S)?"correct":"incorrect"])},[n.isQuestionCorrect(S)?(i(),c("p",eF,[a(y,null,{default:r(()=>[a(h)]),_:1}),V(" "+d(e.$t("Correct")),1)])):(i(),c("p",tF,[a(y,null,{default:r(()=>[a(w)]),_:1}),V(" "+d(e.$t("Incorrect")),1)]))],2)):_("",!0),l("div",sF,[(i(!0),c(L,null,D(S.options,$=>(i(),c("div",{key:$.label,class:"fcom_question_option"},[a(b,{class:R({single_choice:n.isSingleChoice(S)}),"model-value":n.isOptionSelected(S,$),onChange:I=>n.handleOptionChange(S,$)},{default:r(()=>[V(d($.label),1)]),_:2},1032,["class","model-value","onChange"])]))),128))]),S.help_text?(i(),c("div",oF,d(S.help_text),1)):_("",!0)])])):_("",!0)],64))),128))])),!s.loading&&!n.alreadyAttempted?(i(),c("div",iF,[l("p",null,d(e.$t("Answer all questions to submit")),1),a(m,{class:"fcom_primary_button",onClick:n.submitQuiz,loading:s.submitting,disabled:s.submitting||!n.isAllAnswersSelected},{default:r(()=>[V(d(e.$t("Submit Quiz"))+" ",1),e.has_pro?_("",!0):(i(),c("span",nF,"ย ("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["onClick","loading","disabled"])])):_("",!0)],64)}const aF=P(EM,[["render",lF]]),rF={name:"ViewLesson",emits:["reload"],components:{PaperClipIcon:js,DocumentLists:Je,CircleIcon:as,AppLayout:Se,Layout:ke,MediaPreview:Ae,CommentBox:TM,ChatIcon:Ze,ExitFullScreen:BM,QuizView:aF},props:["course","sections","track","currentLesson","lessonsCount","lesson_slug","currentLessonIndex","lessonsCount"],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.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,o,u,s,n;return((o=(t=(e=this.currentLesson)==null?void 0:e.meta)==null?void 0:t.media)==null?void 0:o.url)||((n=(s=(u=this.currentLesson)==null?void 0:u.meta)==null?void 0:s.media)==null?void 0:n.html)}},methods:{markAsComplete(){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")}).catch(t=>{this.$handleError(t)}).finally(()=>{this.completing=!1})},toggleFullScreen(){this.isFullScreen=!this.isFullScreen,this.$storeLocalData("lesson_fs",this.isFullScreen?"yes":"no")},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 o=Array.from(t).map(u=>u.src).filter(Boolean);o.length&&(this._lightboxHandler&&e.removeEventListener("click",this._lightboxHandler),this._lightboxHandler=u=>{const s=u.target.closest("img");u.target.closest(".wp-lightbox-container")&&s&&(u.preventDefault(),u.stopPropagation(),this.lightboxImages=o,this.lightboxIndex=Math.max(0,o.indexOf(s.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 o=e.getBoundingClientRect(),u=t.getBoundingClientRect();o.top>=u.top&&o.bottom<=u.bottom&&o.left>=u.left&&o.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"),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"),this._lightboxHandler&&this.$refs.lessonContent&&this.$refs.lessonContent.removeEventListener("click",this._lightboxHandler)}},cF={key:0},dF={class:"fcom_back_space"},uF={class:"fcom_lesson_details",style:{padding:"2rem"}},_F={class:"fcom_back_space"},mF={class:"fcom_lesson_name"},hF={class:"fcom_lesson_nav"},fF={key:1},pF=["href"],gF={class:"fcom_lesson_details"},yF={class:"fcom_lesson_header"},vF={class:"fcom_lesson_title"},bF={class:"fcom_lesson_number"},kF=["href"],wF=["innerHTML"],CF={class:"fcom_lesson_nav"},$F=["innerHTML"],SF={class:"fcom_lesson_body feed_texts"},VF={key:0,class:"fcom_lesson_content"},LF=["innerHTML"],MF={key:0,class:"fcom_lesson_quiz"},FF={key:1,ref:"fcom_course_documents",class:"fcom_lesson_documents"},TF={class:"fcom_lesson_documents_header"},PF={key:0,class:"fcom_lesson_documents_list"},IF={key:0,ref:"fcom_course_comments",class:"fcom_lesson_comments"},UF={class:"fcom_lesson_comment_box"},BF={style:{"text-align":"center",padding:"20px","margin-top":"30px","border-radius":"8px","background-color":"var(--fcom-primary-bg, white)"}},EF={style:{padding:"0",margin:"0 0 20px"}},AF=["href"],DF={class:"fcom_section_sidebar_title"},RF={class:"fcom_section_items"},HF={class:"fcom_section_primary_item"},xF={class:"fcom_section_primary_item_title"},jF=["id","onClick"],OF={class:"fcom_heading_item clickable"},NF=["innerHTML"],zF={key:0,class:"fcom_section_footer course_progress_footer_wrap"},qF={class:"fcom_course_progress_footer"};function GF(e,t,o,u,s,n){const m=W,f=g("ArrowLeft"),h=N,y=g("FullScreen"),w=g("ExitFullScreen"),b=O,C=g("ChatIcon"),p=g("PaperClipIcon"),k=g("ArrowRight"),S=g("Operation"),$=g("media-preview"),I=g("QuizView"),F=g("DocumentLists"),B=g("CommentBox"),M=ge,E=Le,A=g("ArrowDown"),U=g("SuccessFilled"),T=g("Lock"),j=g("CircleIcon"),z=Wt,ne=We,x=$s,ee=xe,H=g("layout"),te=g("app-layout"),K=Q("loading");return i(),v(te,{class:R({fcom_full_screen:s.isFullScreen,fcom_show_right_aside:s.sm_side_show}),wrapper_class:"fcom_single_layout fcom_full_layout"},{default:r(()=>[o.course&&o.currentLesson?(i(),v(H,{key:0,wrapper_class:"no_bg_layout"},{default:r(()=>[a(ee,{class:"fcom_lesson_container fcom_resp_container"},{default:r(()=>[a(E,{style:re({height:n.containerHeight}),class:"fcom_lesson_wrap"},{default:r(()=>[s.isTransiting?(i(),c("div",cF,[G((i(),c("div",dF,[...t[5]||(t[5]=[V(" ...... ",-1)])])),[[K,!0]]),l("div",uF,[a(m,{rows:10,animated:!0})])])):(i(),v(M,{key:1,ref:"lesson_scroller"},{default:r(()=>{var ce;return[l("div",_F,[l("div",{class:"clickable fcom_go_back",onClick:t[0]||(t[0]=J=>e.$router.push({name:"view_course"}))},[a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(f)]),_:1}),l("span",mF,d(o.course.title),1)]),l("div",hF,[a(b,{title:s.isFullScreen?e.$t("Exit Full Screen"):e.$t("Go Full Screen"),onClick:n.toggleFullScreen,size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[s.isFullScreen?(i(),v(w,{key:1})):(i(),v(y,{key:0}))]),_:1})]),_:1},8,["title","onClick"]),o.currentLesson.can_view?(i(),c(L,{key:0},[n.commentsEnabled?(i(),v(b,{key:0,onClick:n.scrollToComments,bg:"",size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(C)]),_:1})]),_:1},8,["onClick"])):_("",!0),n.hasDocuments?(i(),v(b,{key:1,onClick:n.scrollToDocuments,bg:"",size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(p)]),_:1})]),_:1},8,["onClick"])):_("",!0),o.track.isEnrolled?(i(),v(b,{key:2,class:R(n.isCompleted?"":"fcom_primary_button"),style:{"margin-left":"15px"},type:"info",onClick:n.markAsComplete,size:"small"},{default:r(()=>[n.isCompleted?(i(),c("span",fF,d(e.$t("Completed")),1)):(i(),c(L,{key:0},[l("span",null,d(e.$t("Complete Lesson")),1),a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(k)]),_:1})],64))]),_:1},8,["class","onClick"])):e.auth.user_id?!o.track.isEnrolled&&o.course.id?G((i(),v(b,{key:4,disabled:s.enrolling,onClick:n.enroll,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[K,s.enrolling]]):_("",!0):(i(),c("a",{key:3,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login to enroll this course")),9,pF))],64)):_("",!0),a(b,{style:{"margin-left":"15px"},size:"small",text:"",class:"fcom_sm_only",onClick:t[1]||(t[1]=J=>s.sm_side_show=!s.sm_side_show)},{default:r(()=>[a(h,null,{default:r(()=>[a(S)]),_:1})]),_:1})])]),l("div",gF,[l("div",yF,[l("div",vF,[l("p",bF,[V(d(e.$t("Lesson %1$s of %2$s",o.currentLessonIndex+1,o.lessonsCount))+" ",1),e.isAdmin()?(i(),c("a",{key:0,target:"_blank",rel:"noopener",style:{"margin-left":"8px"},class:"el-button el-button--small",href:e.$getRouteLink("admin/manage-courses/edit/:course_id/lessons?lesson_id=:lesson_id",{course_id:o.course.id,lesson_id:o.currentLesson.id})},d(n.isQuizContent?e.$t("Edit Quiz"):e.$t("Edit Lesson")),9,kF)):_("",!0)]),l("h1",{innerHTML:o.currentLesson.title},null,8,wF)]),l("div",CF,[a(b,{onClick:t[2]||(t[2]=J=>e.$emit("setPrevLesson")),disabled:o.currentLessonIndex===0,size:"small"},{default:r(()=>[a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(f)]),_:1})]),_:1},8,["disabled"]),a(b,{onClick:t[3]||(t[3]=J=>e.$emit("setNextLesson")),disabled:o.currentLessonIndex+1===o.lessonsCount,size:"small"},{default:r(()=>[a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(k)]),_:1})]),_:1},8,["disabled"])])]),o.currentLesson.can_view?(i(),c(L,{key:1},[n.showMediaPreview?(i(),v($,{key:0,media_item:o.currentLesson.meta.media},null,8,["media_item"])):_("",!0),l("div",SF,[o.currentLesson.content_loading?(i(),c("div",VF,[a(m,{rows:5,animated:!0})])):(i(),c(L,{key:1},[l("div",{ref:"lessonContent",class:"fcom_lesson_content feed_md_content",innerHTML:o.currentLesson.content},null,8,LF),(ce=o.currentLesson.meta)!=null&&ce.quiz_questions?(i(),c("div",MF,[a(I,{lesson:o.currentLesson,isEnrolled:o.track.isEnrolled,questions:o.currentLesson.meta.quiz_questions},null,8,["lesson","isEnrolled","questions"])])):_("",!0)],64))]),n.hasDocuments&&!o.currentLesson.content_loading?(i(),c("div",FF,[l("div",TF,[l("h3",null,d(e.$t("Documents & Files")),1)]),e.has_pro?(i(),c("div",PF,[a(F,{class:"fcom_boxed_documents",document_lists:o.currentLesson.meta.document_lists},null,8,["document_lists"])])):_("",!0)],512)):_("",!0)],64)):(i(),c("div",{key:0,class:"fcom_locked_container",innerHTML:o.currentLesson.access_message},null,8,$F))]),n.commentsEnabled&&!o.currentLesson.content_loading?(i(),c("div",IF,[l("div",UF,[a(B,{show_comment_form:o.track.isEnrolled,feed:o.currentLesson,showAll:!0,checkPermission:!0},be({before_comment_box:r(()=>[l("h3",null,d(e.$t("Lesson Discussions")),1)]),_:2},[o.track.isEnrolled?void 0:{name:"after_comment_box",fn:r(()=>[l("div",BF,[l("p",EF,d(e.$t("Please enroll the course to join the conversation.")),1),e.auth.user_id?!o.track.isEnrolled&&o.course.id?G((i(),v(b,{key:1,disabled:s.enrolling,onClick:n.enroll,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[K,s.enrolling]]):_("",!0):(i(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login to enroll this course")),9,AF))])]),key:"0"}]),1032,["show_comment_form","feed"])])],512)):_("",!0)]}),_:1},512))]),_:1},8,["style"]),a(ne,{class:"fcom_lesson_sidebar fcom_resp_side",width:"320px"},{default:r(()=>[a(M,{ref:"lesson_index_sidebar",height:n.containerHeight},{default:r(()=>[l("div",DF,[l("h3",null,d(e.$t("Lessons")),1)]),l("div",RF,[(i(!0),c(L,null,D(o.sections,ce=>(i(),c("div",{key:ce.id,class:"fcom_section_primary"},[l("div",HF,[l("div",xF,[a(h,{class:"clickable",onClick:J=>ce.is_closed=!ce.is_closed},{default:r(()=>[ce.is_closed?(i(),v(k,{key:0,class:"fcom_arrow_icon"})):(i(),v(A,{key:1}))]),_:2},1032,["onClick"]),l("h4",null,d(ce.title),1)])]),ce.is_closed?_("",!0):(i(!0),c(L,{key:0},D(ce.lessons,J=>(i(),c("div",{class:R([{fcom_current_lesson:J.id==o.currentLesson.id},"fcom_section_item"]),key:J.id},[l("div",{id:"fcom_lesson_title_"+J.id,onClick:se=>n.gotoLesson(J),class:"fcom_section_item_title"},[l("p",OF,[o.track.completed_lessons.includes(J.id.toString())?(i(),v(h,{key:0,style:{color:"#008a2e"}},{default:r(()=>[a(U)]),_:1})):J.can_view?(i(),v(h,{key:2},{default:r(()=>[a(j)]),_:1})):(i(),v(h,{key:1},{default:r(()=>[a(T)]),_:1})),l("span",{innerHTML:J.title},null,8,NF)])],8,jF)],2))),128))]))),128))]),o.track.progress?(i(),c("div",zF,[l("div",qF,[l("p",null,d(e.$t("Course progress")),1),a(z,{class:"fcom_progress","stroke-width":8,percentage:parseInt(o.track.progress)},null,8,["percentage"])])])):_("",!0)]),_:1},8,["height"])]),_:1}),s.lightboxImages.length?(i(),v(x,{key:0,"url-list":s.lightboxImages,"initial-index":s.lightboxIndex,"hide-on-click-modal":!0,onClose:t[4]||(t[4]=ce=>s.lightboxImages=[])},null,8,["url-list","initial-index"])):_("",!0)]),_:1})]),_:1})):_("",!0)]),_:1},8,["class"])}const YF=P(rF,[["render",GF]]),WF={name:"LeaderLists",props:["leaders"],computed:{isAll(){return this.leaders.key==="all_time"}}},ZF={class:"fcom_box_list"},KF={class:"fcom_box_list_header"},JF={class:"fcom_box_list_body"},QF={class:"fcom_person_lists"},XF={class:"fcom_leader"},eT={key:0,class:"fcom_serial_suffix"},tT={key:0,class:"fcom_leader_stat"};function sT(e,t,o,u,s,n){const m=g("UserAvatar"),f=g("UserRouteLink");return i(),c("div",ZF,[l("div",KF,d(o.leaders.title),1),l("div",JF,[l("ul",QF,[(i(!0),c(L,null,D(o.leaders.items,(h,y)=>(i(),c("li",{key:h.user_id},[l("div",XF,[l("div",{class:R(["fcom_serial_"+(y+1),"fcom_serial"])},[l("span",null,d(y+1),1),y<3?(i(),c("div",eT,[...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)?(i(),c("div",tT,[G(l("span",null,"+",512),[[ys,!n.isAll]]),V(" "+d(h.total_points),1)])):_("",!0)]))),128))])])])}const oT=P(WF,[["render",sT]]),iT={name:"LeaderTooltip",components:{InfoFilled:Gt},props:{levelChunks:{type:Array,required:!0}}},nT={class:"fcoml_tooltip_content"},lT={class:"fcoml_tooltip_title"},aT={class:"fcoml_tooltip_subtitle"},rT=["innerHTML"],cT={class:"fcoml_tooltip_subtitle"},dT={class:"fcoml_tooltip_desc"},uT={class:"fcoml_tooltip_levels"},_T={class:"levels_list"},mT={class:"level_title"},hT={class:"level_points"};function fT(e,t,o,u,s,n){const m=g("InfoFilled"),f=N,h=O,y=fe;return i(),v(y,{persistent:!1,"popper-class":"fcoml_tooltip_popover",width:550,effect:"dark",trigger:"click"},{reference:r(()=>[a(h,{text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})]),default:r(()=>[l("div",nT,[l("h5",lT,d(e.$t("Leaderboard Points")),1),l("p",aT,d(e.$t("1 Like = 1 Point")),1),l("p",{class:"fcoml_tooltip_desc",innerHTML:e.$t("__LEADERBOARD_DESC_INS")},null,8,rT),l("p",cT,d(e.$t("Levels")),1),l("p",dT,d(e.$t("As you gain points, you level up. Your level is shown at the bottom right of your avatar.")),1),l("div",uT,[(i(!0),c(L,null,D(o.levelChunks,(w,b)=>(i(),c("div",{key:b},[l("ul",_T,[(i(!0),c(L,null,D(w,C=>(i(),c("li",{key:C.level,class:"level_item"},[l("div",mT,d(C.title),1),l("div",hT,d(e.$_n("%d point","%d points",C.min_points)),1)]))),128))])]))),128))])])]),_:1})}const pT=P(iT,[["render",fT]]),gT={name:"LeaderBoard",components:{InfoFilled:Gt,LeaderLists:oT,AppLayout:Se,Layout:ke,LeaderTooltip:pT},data(){return{leaderboard:[],loading:!1}},computed:{userLevel(){return this.appVars.auth.user_id?Ie(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((o,u,s)=>{const n=Math.floor(s/t);return o[n]||(o[n]=[]),o[n].push(u),o},[])}},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"))}},yT={key:0,class:"fcom_leaderboard_profile"},vT={class:"fcom_leaderboard_profile_inner"},bT={class:"fcom_profile_header"},kT={class:"fcom_profile_info"},wT={class:"info_avatar"},CT={class:"info_user"},$T={class:"fcom_level_name"},ST={class:"fcoml_level_sub"},VT={class:"fcoml_level_sub_icon"},LT={class:"fcoml_level_sub_text"},MT={class:"fcom_leaderboard_profile_avatar"},FT={class:"fcom_leaderboard_levels"},TT=["title"],PT={key:1},IT={class:"fcoml_level_detail"},UT={class:"fcoml_level_title"},BT={class:"fcoml_level_sub"},ET={class:"fcom_leaderboard_items"},AT={key:1,class:"white_loaded"};function DT(e,t,o,u,s,n){const m=g("UserAvatar"),f=g("UserRouteLink"),h=g("LeaderTooltip"),y=g("Lock"),w=N,b=at,C=rt,p=g("leader-lists"),k=W,S=g("layout"),$=g("app-layout");return i(),v($,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(S,{wrapper_class:"no_bg_layout",title:e.$t("Leaderboards")},{default:r(()=>[n.userLevel?(i(),c("div",yT,[l("div",vT,[l("div",bT,[l("div",kT,[l("div",wT,[a(m,{with_level:!0,with_completion:!0,xprofile:e.appVars.auth},null,8,["xprofile"])]),l("div",CT,[a(f,{show_badge:!0,show_pop:!1,xprofile:e.appVars.auth},null,8,["xprofile"]),l("div",$T,d(n.userLevel.title),1)])]),l("div",ST,[l("div",VT,[l("span",null,"๐Ÿ† "+d(e.auth.total_points),1),t[0]||(t[0]=V(" | ",-1)),l("span",null,d(e.$t("Level %d",n.userLevel.level)),1)]),l("div",LT,[V(d(e.$t("%d points to level up!",n.requiredPoints))+" ",1),a(h,{levelChunks:n.levelChunks},null,8,["levelChunks"])])])]),l("div",MT,[a(C,{gutter:20},{default:r(()=>[(i(!0),c(L,null,D(n.levelChunks,I=>(i(),v(b,{sm:24,md:8},{default:r(()=>[l("ul",FT,[(i(!0),c(L,null,D(I,F=>(i(),c("li",null,[l("div",{title:`${F.min_points} points`,class:R(["fcom_level_icon",{fcom_is_in_level:n.userLevel.max_points>=F.max_points}])},[n.userLevel.max_points[a(y)]),_:1})):(i(),c("span",PT,d(F.level),1))],10,TT),l("div",IT,[l("div",UT,d(F.title),1),l("div",BT,d(F.tagline),1)])]))),256))])]),_:2},1024))),256))]),_:1})])])])):_("",!0),l("div",ET,[a(C,{gutter:20},{default:r(()=>[(i(!0),c(L,null,D(s.leaderboard,I=>(i(),v(b,{key:I.key,md:8,sm:24},{default:r(()=>[a(p,{leaders:I},null,8,["leaders"])]),_:2},1024))),128))]),_:1})]),s.loading?(i(),c("div",AT,[a(k,{rows:16,animated:!0})])):_("",!0)]),_:1},8,["title"])]),_:1})}const RT=P(gT,[["render",DT]]),HT=[{name:"dashboard",path:"/dashboard",component:wy,meta:{active_menu:"dashboard",title:"Dashboard"}},{path:"/",component:R0,meta:{active_menu:"dashboard"},children:[{name:"all_feeds",path:"",component:Y0},{name:"single_feed",path:"post/:feed_slug",component:hs,props:!0}]},{path:"/space/:space/",component:H3,props:!0,meta:{in_space:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]},children:[{name:"space_home",path:"",component:q3,props:!0,meta:{show_sidebar:!0}},{name:"space_feeds",path:"home",component:z3,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_about",path:"about",component:_o,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_feed",path:"post/:feed_slug",component:hs,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_members",path:"members",component:$4,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_invitations",path:"invitations",component:D5,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_documents",path:"documents",component:u5,props:!0,meta:{in_space:!0,show_sidebar:!1}}]},{path:"/discover/spaces",name:"spaces",component:g6,meta:{active_menu:"spaces"}},{name:"all_members",path:"/members",component:eV,props:!0,meta:{active_menu:"all_members"}},{path:"/u/:username/",component:kC,props:!0,meta:{active_menu:"all_members"},children:[{name:"user_profile",path:"",component:f7,meta:{active_menu:"all_members"}},{name:"user_spaces",path:"spaces",component:S$,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"update_profile",path:"update",component:K$,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_profile_about",path:"about",component:go,meta:{active_menu:"all_members"}},{name:"user_profile_feeds",path:"posts",component:UC,meta:{active_menu:"all_members"}},{name:"user_scheduled_posts",path:"scheduled-posts",component:n$,meta:{active_menu:"all_members"}},{name:"user_comments",path:"comments",component:L7,meta:{active_menu:"all_members"}},{name:"user_notification_settings",path:"notification-settings",component:L9,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_follows",path:"follow",component:$S,meta:{active_menu:"all_members"},children:[{name:"user_followers",path:"followers",component:W9,props:!0,meta:{active_menu:"all_members"}},{name:"user_followings",path:"followings",props:!0,component:fS,meta:{active_menu:"all_members"}}]}]},{path:"/notifications",name:"notifications",component:dV,meta:{}},{name:"bookmarks",path:"/bookmarks",component:pV,meta:{active_menu:"bookmarks"}},{name:"courses",path:"/courses",component:qV,meta:{active_menu:"courses",lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}},{path:"/course/:course_slug",component:QV,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:vM,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:YF,name:"view_lesson",meta:{in_course:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}}]},{name:"leaderboards",path:"/leaderboards",component:RT,meta:{active_menu:"leaderboards"}}],xT={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="The requested page could not be found";return}e=e.replace(/^\/+/,"");let o=e.split("/")[0];if(o=="community"){e=e.replace(/^community\//,"/space/"),this.$router.push(e);return}else if(o=="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(o=="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(o)}};function jT(e,t,o,u,s,n){return i(),c("h1",null,d(s.message),1)}const OT=P(xT,[["render",jT]]),NT={name:"VerifiedSign"};function zT(e,t,o,u,s,n){const m=Bs;return i(),v(m,{content:e.$t("Verified"),placement:"top"},{default:r(()=>[...t[0]||(t[0]=[l("span",{class:"fcom_verified"},[l("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img","data-testid":"icon-verified"},[l("g",null,[l("path",{d:"M20.396 11c-.018-.646-.215-1.275-.57-1.816-.354-.54-.852-.972-1.438-1.246.223-.607.27-1.264.14-1.897-.131-.634-.437-1.218-.882-1.687-.47-.445-1.053-.75-1.687-.882-.633-.13-1.29-.083-1.897.14-.273-.587-.704-1.086-1.245-1.44S11.647 1.62 11 1.604c-.646.017-1.273.213-1.813.568s-.969.854-1.24 1.44c-.608-.223-1.267-.272-1.902-.14-.635.13-1.22.436-1.69.882-.445.47-.749 1.055-.878 1.688-.13.633-.08 1.29.144 1.896-.587.274-1.087.705-1.443 1.245-.356.54-.555 1.17-.574 1.817.02.647.218 1.276.574 1.817.356.54.856.972 1.443 1.245-.224.606-.274 1.263-.144 1.896.13.634.433 1.218.877 1.688.47.443 1.054.747 1.687.878.633.132 1.29.084 1.897-.136.274.586.705 1.084 1.246 1.439.54.354 1.17.551 1.816.569.647-.016 1.276-.213 1.817-.567s.972-.854 1.245-1.44c.604.239 1.266.296 1.903.164.636-.132 1.22-.447 1.68-.907.46-.46.776-1.044.908-1.681s.075-1.299-.165-1.903c.586-.274 1.084-.705 1.439-1.246.354-.54.551-1.17.569-1.816zM9.662 14.85l-3.429-3.428 1.293-1.302 2.072 2.072 4.4-4.794 1.347 1.246z"})])])],-1)])]),_:1},8,["content"])}const qT=P(NT,[["render",zT]]),GT={name:"WelcomeBanner",components:{MediaPreview:Ae},data(){return{config:this.appVars.welcome_banner}},computed:{showMedia(){return this.config&&this.config.mediaType=="video"&&this.config.bannerVideo},showCtaButtons(){var e;return this.config&&((e=this.config.ctaButtons)==null?void 0:e.length)&&this.config.ctaButtons.some(t=>t.link&&t.label)},isRemovable(){return this.config&&this.config.allowClose=="yes"},showBanner(){if(!this.isRemovable)return!0;let e=this.Storage.get(this.getCloseKey,!1);return e?new Date().getTime()>e:!0},getCloseKey(){return this.appVars.user_id?"fcom_welcome_banner_closed_auth":"fcom_welcome_banner_closed_guest"}},methods:{closeBanner(){this.config=null;let e=new Date().getTime()+7*24*60*60*1e3;this.Storage.set(this.getCloseKey,e)}}},YT={key:0,class:"fcom_welcome_box"},WT={key:2,class:"fcom_welcome_title"},ZT=["innerHTML"],KT={key:4,class:"fcom_welcome_cta_buttons"},JT=["href","target"];function QT(e,t,o,u,s,n){const m=g("media-preview"),f=Pe,h=g("MoreFilled"),y=N,w=O,b=ct,C=dt,p=ut;return s.config&&n.showBanner?(i(),c("div",YT,[n.showMedia?(i(),v(m,{key:0,media_item:s.config.bannerVideo},null,8,["media_item"])):s.config.bannerImage?(i(),v(f,{key:1,class:"feed_media",alt:e.$t("Image Preview"),src:s.config.bannerImage},null,8,["alt","src"])):_("",!0),s.config.title?(i(),c("h2",WT,d(s.config.title),1)):_("",!0),s.config.description_rendered?(i(),c("div",{key:3,class:"fcom_welcome_sub",innerHTML:s.config.description_rendered},null,8,ZT)):_("",!0),n.showCtaButtons?(i(),c("div",KT,[(i(!0),c(L,null,D(s.config.ctaButtons,k=>(i(),c(L,null,[k.link&&k.label?(i(),c("a",{key:0,href:k.link,target:k.newTab=="yes"?"_blank":"",class:R({"el-button fcom_primary_button":k.type=="primary","el-button fcom_secondary_button":k.type=="secondary","el-button is-text":k.type=="text","el-link fcom_link_button":k.type=="link"})},d(k.label),11,JT)):_("",!0)],64))),256))])):_("",!0),n.isRemovable?(i(),v(p,{key:5,trigger:"click",class:"fcom_welcome_close"},{dropdown:r(()=>[a(C,null,{default:r(()=>[a(b,{onClick:n.closeBanner},{default:r(()=>[V(d(e.$t("Hide Banner")),1)]),_:1},8,["onClick"])]),_:1})]),default:r(()=>[a(w,{"aria-label":e.$t("Hide Banner"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),_:1})):_("",!0)])):_("",!0)}const XT=P(GT,[["render",QT]]),eP=[Oo,bs,No,zo,qo,Go,Yo,Wo,Zo,Ko,Jo,Qo,Xo,ei,ti,si,oi,ii,ks,ni,li,ai,ri,ws,ci,di,ui,_i,gt,mi,hi,fi,pi,gi,yi,vi,bi,ki,wi,Ci,$i,Si,Vi,Gt,Fe,Li];function nt(e){const t=[];if(typeof e=="object"&&e.join===void 0)for(const o in e)t.push(nt(e[o]));else if(typeof e=="object"&&e.join!==void 0)for(const o in e)t.push(nt(e[o]));else typeof e=="function"||typeof e=="string"&&t.push(e);return t.join("
")}function tP(e){let t;try{t=new URL(e)}catch{t=new URL(e,"https://fluentcommunity.co")}let o=t.pathname;return o=o.replace(/^\//,""),o.split("/")[0]||""}const ae=Co(_y),cs=Lo();cs.use(Mo);cs.use(({store:e})=>{e.$api={get:(t,o)=>window.FluentCommunityUtil.Rest.get(t,o),post:(t,o)=>window.FluentCommunityUtil.Rest.post(t,o),put:(t,o)=>window.FluentCommunityUtil.Rest.put(t,o),patch:(t,o)=>window.FluentCommunityUtil.Rest.patch(t,o),delete:t=>window.FluentCommunityUtil.Rest.delete(t)}});ae.use(cs);ae.use(Ui);var ps,gs;ae.use(jo,{loading:(((ps=window.fluentComAdmin)==null?void 0:ps.assets_url)||"")+"images/image-loader.svg",error:(((gs=window.fluentComAdmin)==null?void 0:gs.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")}}});ae.config.globalProperties.appVars=window.fluentComAdmin;ae.config.globalProperties.auth=window.fluentComAdmin.auth;ae.config.globalProperties.has_pro=!!window.fluentComAdmin.pro;let Ot="40%",Nt="60%",yo="500px";window.innerWidth<600?(Nt="95%",Ot="90%",yo="90%"):window.innerWidth<800&&(Nt="80%",Ot="80%");eP.forEach(e=>{ae.component(e.name,e)});ae.component("VerifiedSign",qT);ae.component("UserAvatar",is);ae.component("UserRouteLink",Me);ae.component("WelcomeBanner",XT);ae.component("UserBadge",po);function fs(){var h,y,w,b,C;ae.use(window.FluentCommunityUtil.eventBus);const e=window.FluentCommunityUtil.Rest;ae.mixin({data(){return{Storage:window.FluentCommunityUtil.Storage,is_rtl:!1,drawerWidth:Ot,dialogWidth:Nt,modalWidth:yo,feedMonitorCache:{},mounted:!1,isMobile:window.innerWidth<=768,has_leaderboard:this.appVars.features.leaderboard}},methods:{$get:e.get,$post:e.post,$uploadFile:e.uploadFile,$put:e.put,$del:e.delete,$patch:e.patch,$ajax:e.ajax,changeTitle(p){document.title=p+" - "+this.appVars.site_title},$handleError(p){let k="";typeof p=="string"?k=p:p&&p.message?k=p.message:k=nt(p),k||(k="Something is wrong!"),typeof k!="string"&&(k=nt(k)),this.$notify({type:"error",title:this.$t("Error"),message:k,dangerouslyUseHTMLString:!0})},convertToText:nt,$t(p){p=window.fluentComAdmin.i18n[p]||p;const k=Array.prototype.slice.call(arguments,1);if(k.length===0)return p;const S=/%(\d*)\$?s|%d/g;let $=0;return p=p.replace(S,(I,F)=>{if(F){const B=parseInt(F,10)-1;return B1?this.$t(k,S):this.$t(p,S)},$labelize(p){return p?(p=p.charAt(0).toUpperCase()+p.slice(1),window.fluentComAdmin.i18n[p]?window.fluentComAdmin.i18n[p]:p.replace(/_/g," ").replace(/\b\w/g,k=>k.toUpperCase())):""},$toClipboard(p,k="Copied to clipboard"){navigator.clipboard.writeText(p).then(()=>{this.$notify.success(this.$t(k))}).catch(S=>{this.$notify.error(this.$t("Failed to copy"))})},dayjs,relativeTimeFromUtc(p){return dayjs.utc(p).local().fromNow()},$storeLocalData(p,k){this.Storage.set(p,k)},$getLocalData(p,k=""){return this.Storage.get(p,k)},ucFirst(p){return p?p.charAt(0).toUpperCase()+p.slice(1):""},ucWords(p){return p?p.replace(/\b[a-z]/g,function(k){return k.toUpperCase()}):""},smartDate(p,k=!1,S=!1){if(!p)return"";let $="D MMM, YYYY";dayjs(p).isSame(new Date,"year")?($="D MMM",k&&(Math.abs(dayjs(p).diff(new Date,"days"))<=5||S)&&($="D MMM, HH:mm")):k&&S&&($="D MMM, YYYY, HH:mm");const I=dayjs(p);return I.isValid()?I.format($):null},hasPermission(p){return this.appVars.permissions[p]},isAdmin(){return!!this.appVars.permissions.community_admin},hasCourseAdminAccess(){return!!this.appVars.permissions.course_admin},hasCourseCreatorAccess(){return!!this.appVars.permissions.course_creator},hasSpaceAdminAccess(p=null){return this.hasPermissionOrInCurrentSpace("community_admin")||p&&this.isSpaceAdmin(p)},hasSpaceModeratorAccess(p=null){return this.hasPermissionOrInCurrentSpace("community_moderator")||p&&this.isSpaceModerator(p)},canDeleteFeed(p){return this.auth.user_id&&(p.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("delete_any_feed"))},canEditFeed(p){return this.auth.user_id&&(p.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("edit_any_feed"))},canDeleteComment(p){return this.auth.user_id&&(p.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("delete_any_comment"))},canEditComment(p){return this.auth.user_id&&(p.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("edit_any_comment"))},hasSpaceAccess(p){return p?this.appVars.user_membership_slugs.indexOf(p)!==-1:!0},hasInPermission(p,k){return!k||typeof k!="object"?!1:k[p]},hasCurrentSpacePermission(p){return window.fcom_current_community?this.hasInPermission(p,window.fcom_current_community.permissions):!1},hasPermissionOrInCurrentSpace(p){return this.hasPermission(p)?!0:this.hasCurrentSpacePermission(p)},humanDateDiff(p){if(!p)return"";const k=dayjs.utc(p,"YYYY-MM-DD HH:mm:ss");if(!k.isValid())return"";const S=k.add(this.appVars.date_offset,"s");return dayjs(S.format("YYYY-MM-DD HH:mm:ss")).from(dayjs(dayjs.utc().format("YYYY-MM-DD HH:mm:ss")))},isToday(p){return dayjs(p).isSame(dayjs(),"day")},isPastDate(p){if(!p)return!0;const k=dayjs.utc(p,"YYYY-MM-DD HH:mm:ss");return k.isValid()?k.add(this.appVars.date_offset,"s").isBefore(dayjs(dayjs.utc().format("YYYY-MM-DD HH:mm:ss"))):!0},formattedDate(p){return dayjs(p).format(this.appVars.date_formatter)},formattedTime(p){return dayjs(p).format(this.appVars.time_formatter)},formattedDateTime(p){return dayjs(p).format(this.appVars.date_time_formatter)},hasCommentPermission(p){var k;return this.auth.user_id?!p.space_id&&!p.course_id?this.auth.user_id&&(p.user_id==this.auth.user_id||p.privacy=="public"):this.hasSpaceAccess((k=p.space)==null?void 0:k.slug):!1},getExcerpt(p,k=250){if(!p)return"";let S=p.replace(/(<([^>]+)>)/ig,"");return S=S.replace(/(\*\*|__)(.*?)\1/g,"$2"),S=S.replace(/(#+)(.*)/g,"$2"),S=S.replace(/\[(.*?)\]\((.*?)\)/g,"$1"),S.length>k&&(S=S.substring(0,k)+"..."),S},mdToHtml(p){return p?(p=p.replace(" ","",p),p=p.replace(/\*\*(.*?)\*\*/g,"$1"),p=p.replace(/\*(.*?)\*/g,"$1"),p=p.replace(/\~\~(.*?)\~\~/g,"$1"),p=p.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'$1'),p=p.replace(/<(https?:\/\/[^\s>]+)>/g,'$1'),p=p.replace(/^##\s+(.*?)$/gm,"

$1

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

$1

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

$1

"),p=p.replace(/^>\s+(.*?)$/gm,"
$1
"),p=p.replace(/`{3}([\s\S]*?)`{3}/g,"
$1
"),p=p.replace(/`([^`]+)`/g,"$1"),p=p.replace(/^([\*\-])\s+(.*)$/gm,"
  • $2
  • "),p=p.replace(/(
  • .*?<\/li>(?:\n
  • .*?<\/li>)*)/g,function(k){return"
      "+k.replace(/\n/g,"")+"
    "}),p=p.replace(/\n/g,"
    "),p):""},$convertToBoolean(p){return p==="true"||p===!0||p===1||p==="1"||p==="yes"||p==="on"},each:De,hasFeature(p){return this.appVars.features[p]},isCommunityModerator(){return window.fluentComAdmin.auth.community_roles.some(p=>p==="admin"||p==="moderator")},isSpaceModerator(p){var S,$;return["admin","moderator"].includes(($=(S=p==null?void 0:p.membership)==null?void 0:S.pivot)==null?void 0:$.role)},isSpaceAdmin(p){var k,S;return((S=(k=p==null?void 0:p.membership)==null?void 0:k.pivot)==null?void 0:S.role)=="admin"},isModerator(p){if(this.isCommunityModerator())return!0;if(!p)return!1;const k=this.auth.spaces[p];return this.isSpaceModerator(k)},getCurrentAuthUrl(){let p=window.location.href,k=this.appVars.auth_url;return k=k.replace(/(\?|&)redirect_to=[^&]+/,""),k.indexOf("?")===-1?k+="?":k+="&",k+"redirect_to="+encodeURIComponent(p)},$formatNumber(p){return p&&p.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},$getRouteLink(p,k={}){return De(k,(S,$)=>{p=p.replace(":"+$,S)}),this.appVars.portal_url+p},isOnline(p){if(!p)return!1;const S=dayjs.utc(p,"YYYY-MM-DD HH:mm:ss").add(this.appVars.date_offset,"seconds").diff(dayjs.utc(),"minutes");return S<=5&&S>=0},setFollowIds(p){Ue().setFollows(p)},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",k=>{if(k.metaKey||k.ctrlKey)return;const S=k.target.closest("a");if(S&&S.target==="_blank")return;let $=k.target.getAttribute("href");if($||S&&($=S.getAttribute("href")),!!$){if(window.fluentComAdmin.is_absolute_url){let I=tP($);if(I){if(window.fluentComAdmin.portal_paths.indexOf(I)===-1){document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:$}}));return}}else{let F=window.location.origin,B=new URL($).origin;if(F==B&&new URL($).search){document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:$}}));return}}}if($.startsWith(window.fluentComAdmin.urls.portal_base)){if($.indexOf("fcom_action")!==-1||$.startsWith(window.fluentComAdmin.urls.portal_base+"admin"))return;k.preventDefault(),$=$.replace(window.fluentComAdmin.urls.portal_base,"/"),this.$router.push($)}else document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:$}}))}});let p=window.fluentComAdmin.dateTime18n;dayjs.updateLocale("en",{weekdays:p.weekdays.split("_"),months:p.months.split("_"),weekdaysShort:p.weekdaysShort.split("_"),monthsShort:p.monthsShort.split("_"),weekdaysMin:p.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?p.relativeTimeMobile:p.relativeTime}),document.addEventListener("fcom_renew_rest_nonce",k=>{this.$ajax("GET","fluent_community_renew_nonce",{ajax_nonce:window.fluentComAdmin.ajax_nonce}).then(S=>{S.rest_nonce&&(window.fluentComAdmin.rest.nonce=S.rest_nonce,window.fluentComAdmin.ajax_nonce=S.ajax_nonce)}).catch(S=>{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:$=>{location.reload()}})})})}}),ae.config.globalProperties.$notify=Bi,ae.config.globalProperties.$confirm=Ht.confirm,ae.config.globalProperties.$promt=Ht.prompt,ae.config.globalProperties.$messageBox=Ht,ae.config.globalProperties.$gloablStorage={},ae.config.globalProperties.currentTimeZoneName=window.dayjs.tz.guess();const t=window.FluentCommunityUtil.hooks.applyFilters("fluent_com_portal_routes",HT);t.push({path:"/:catchAll(.*)",name:"not-found",component:OT});let o=null;const u=(p,k,S)=>{const $=qe();if(S)return S;if(k&&k.path&&p.path){const I=$.restoreScrollPosition(p.path);if(I>0)return{top:I,behavior:"auto"}}return{top:0}};window.fluentComAdmin.routing_system=="hash"?o=ds({routes:t,history:$o(),scrollBehavior:u}):o=ds({routes:t,history:So(window.fluentComAdmin.portal_slug),scrollBehavior:u});const s=window.FluentCommunityUtil.hooks.applyFilters("fluent_com_portal_app",ae);window.fluentFrameworkApp=s.use(o).mount("#fluent_com_portal");const n=qe();n.initialize();const m=Ue();m.initializeCurrentUser();const f=Qt();(y=(h=window.fluentComAdmin)==null?void 0:h.auth)!=null&&y.user_id&&((b=(w=window.fluentComAdmin)==null?void 0:w.features)!=null&&b.notifications_polling)&&f.startPolling(6e4),(C=window.fluentComAdmin)!=null&&C.debug_mode&&(window.fcomDevTools={stores:{feed:Ve(),space:Re(),cache:le(),ui:n,user:m,notification:f},memory:{getStats:()=>{const p=Ve(),k=le(),S=Re(),$={feeds:p.getMemoryStats,cache:k.getCacheStats,spaces:{total:Object.keys(S.spacesBySlug).length,mySpaces:S.mySpaces.length}};if("memory"in performance){const I=performance.memory;$.browser={usedMB:(I.usedJSHeapSize/1048576).toFixed(2),totalMB:(I.totalJSHeapSize/1048576).toFixed(2),limitMB:(I.jsHeapSizeLimit/1048576).toFixed(2),percentage:(I.usedJSHeapSize/I.jsHeapSizeLimit*100).toFixed(2)+"%"}}return console.table($),$},cleanup:()=>{const p=Ve(),k=le();console.log("๐Ÿงน Running memory cleanup..."),p.pruneOldFeeds(),k.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=o}window.FluentCommunityUtil?fs():document.addEventListener("fluentCommunityUtilReady",function(){fs()});