1import{a as K}from"./chunk-E4ZHG4M5.js";import{a as Q}from"./chunk-2QBSHO45.js";import{a as Y,e as P}from"./chunk-SI32BKWR.js";import"./chunk-6YBNYDLH.js";import"./chunk-5TVMO5YE.js";import{a as q}from"./chunk-4ZAGGYN3.js";import{a as z}from"./chunk-WNQ7QYIW.js";import"./chunk-2U7HU72D.js";import{p as J}from"./chunk-FZI3DITU.js";import{h as N}from"./chunk-GOWIHEOM.js";import{Ab as L,Ia as n,Mb as B,Nb as j,Pa as x,Ta as E,Xb as S,Yb as A,db as $,eb as w,ga as M,gb as F,hb as I,ib as T,jb as u,kb as g,l as v,lb as _,mb as p,nb as c,ob as D,yb as O}from"./chunk-RF224HOC.js";import"./chunk-2TE4IGWO.js";import{g as y}from"./chunk-Z3S5WG22.js";var G=t=>({hide:t}),R=()=>[],H=t=>[t];function U(t,r){t&1&&D(0,"ui-placeholder",5)}function W(t,r){t&1&&(p(0,"div",4),u(1,U,1,0,"ui-placeholder",5,I),c()),t&2&&(n(),g(S(0,R).constructor(3)))}function X(t,r){t&1&&u(0,W,3,1,"div",4,I),t&2&&g(S(0,R).constructor(3))}function Z(t,r){if(t&1&&(p(0,"a",7),D(1,"app-feed-item",8),c()),t&2){let e=r.$implicit,i=r.$index,o=L().$index;_("routerLink",A(5,H,e.url)),$("dg-auto-id","articleLink_"+o+"_"+i),n(),_("article",e)("showImage",e.contentType!=="news_post")("titleTag","h5")}}function ee(t,r){if(t&1&&(p(0,"h3",6),B(1),c(),p(2,"div",4),u(3,Z,2,7,"a",7,T),c()),t&2){let e=r.$implicit;n(),j(e.title),n(2),g(e.items)}}function te(t,r){t&1&&D(0,"ui-spinner",3)}var ue=(()=>{class t{constructor(e){this.api=e,this.articles=[],this.grouped=[],this.hasMore=!1,this.loading=M(!1),this.loadingMore=M(!1),this.loadVersion=0,this.loadMoreVersion=0,this.intersect=i=>{i[0].isIntersecting&&this.loadMore()}}ngOnInit(){this.load()}ngAfterViewInit(){let e=document.getElementById("js-load-more");e&&(this.observer=new IntersectionObserver(this.intersect,{threshold:1}),this.observer.observe(e))}ngOnDestroy(){this.dashboard.updatesCount=0,this.observer?.disconnect()}groupArticles(){let e=[],i=new Date,o=i.getFullYear(),s=new Date(o,i.getMonth(),i.getDate()),m=new Date(s);m.setDate(m.getDate()-1);let b=new Date(s);b.setDate(b.getDate()-7);let C=new Date(s);C.setDate(C.getDate()-30);let a={today:[],yesterday:[],last7Days:[],last30Days:[]},V={0:"January",1:"February",2:"March",3:"April",4:"May",5:"June",6:"July",7:"August",8:"September",9:"October",10:"November",11:"December"},f={};return this.articles.forEach(l=>{let d=l.publishedOn;if(d>=s)a.today.push(l);else if(d>=m)a.yesterday.push(l);else if(d>=b)a.last7Days.push(l);else if(d>=C)a.last30Days.push(l);else{let h=`${d.getFullYear()}-${d.getMonth()}`;f[h]||(f[h]=[]),f[h].push(l)}}),a.today.length&&e.push({title:"Today",items:a.today}),a.yesterday.length&&e.push({title:"Yesterday",items:a.yesterday}),a.last7Days.length&&e.push({title:"Last 7 Days",items:a.last7Days}),a.last30Days.length&&e.push({title:"Last 30 Days",items:a.last30Days}),Object.entries(f).forEach(([l,d])=>{let[h,k]=l.split("-");e.push({title:parseInt(h,10)===o?V[k]:`${h} ${V[k]}`,items:d})}),e}load(){return y(this,null,function*(){++this.loadVersion;let e=this.loadVersion;this.loading.set(!0);try{yield this.loadArticles(e)}finally{e===this.loadVersion&&this.loading.set(!1)}})}loadMore(){return y(this,null,function*(){++this.loadMoreVersion;let e=this.loadMoreVersion;this.loadingMore.set(!0);try{yield this.loadArticles(e)}finally{e===this.loadMoreVersion&&this.loadingMore.set(!1)}})}loadArticles(e){return y(this,null,function*(){let i={limit:25,order:"DESC_publishedOn"};this.articles.length&&(i.start_after=this.articles[this.articles.length-1]?.publishedOn?.toISOString()),Object.assign(i,this.dashboard.getQueryParams());let o=yield v(this.api.get("/content/articles",i));if(!(e!==this.loadVersion&&e!==this.loadMoreVersion)&&o){let s=o.data.map(m=>new Y(P(m)));this.articles.push(...s),this.grouped=this.groupArticles(),this.hasMore=!!s.length,v(this.api.get(`/dashboards/${this.dashboard.id}`))}})}static{this.\u0275fac=function(i){return new(i||t)(x(q))}}static{this.\u0275cmp=E({type:t,selectors:[["app-board"]],decls:8,vars:5,consts:[[1,"mar-t-30"],[1,"dis-flex","just-center"],["id","js-load-more","aria-label","load more","dg-auto-id","loadMoreButton",1,"btn","line","grey","mar-t-30",3,"click","ngClass"],[1,"w-40","mar-t-30"],[1,"grid","grid-3"],[1,"grid_item"],[1,"mar-b-30"],[1,"grid_item","noformat",3,"routerLink"],[3,"article","showImage","t
1itleTag"]],template:function(i,o){i&1&&(p(0,"div",0),w(1,X,2,1),u(2,ee,5,1,null,null,T),c(),p(4,"div",1)(5,"button",2),O("click",function(){return o.loadMore()}),B(6," Load More "),c(),w(7,te,1,0,"ui-spinner",3),c()),i&2&&(n(),F(o.loading()?1:-1),n(),g(o.grouped),n(3),_("ngClass",A(3,G,!o.hasMore||o.loadingMore())),n(2),F(o.loadingMore()?7:-1))},dependencies:[K,J,Q,N,z],encapsulation:2})}}return t})();export{ue as DashboardBoardComponent};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.