PageSourceSearch

https://mymilitarylifestyle.com/assets/NewsScreen-gbZn_Zun.js

js mymilitarylifestyle.com collected 2026-10-10 01:00:52 UTC 32,720 bytes, 1 lines download raw bytes

1import{j as e,r as d,f as Q,Y as ee,u as O,s as q,l as J,n as V,a9 as se,aa as te,ab as ie,ac as le,D as ae,T as X,a5 as H,h as ne,z as re,E as oe,B as ce,S as K,F as de}from"./index-B9ovCa2o.js";import me from"./PersonaliseModal-4Vpq0BvH.js";import{d as xe}from"./sanitize-html-si29paC7.js";import{M as he}from"./MoreForYouSection-CKmWqIAS.js";import"./MoreForYouSkeleton-B6BnX1k0.js";const pe="https://mymilitarylifestyle.com",ue=`${pe}/api/news`,ge=async({category:x="general",pageSize:_=20}={})=>{try{const S=new URLSearchParams({country:"us",...x&&{category:x},pageSize:_.toString()}),u=`${ue}/top-headlines?${S.toString()}`,m=await fetch(u);if(!m.ok){const j=await m.json().catch(()=>({}));throw new Error(j.message||`NewsAPI error: ${m.status} ${m.statusText}`)}const y=await m.json();if(y.status==="error")throw new Error(y.message||"NewsAPI returned an error");return y}catch(S){throw S}};function fe(){return e.jsxs("div",{className:"col-xl-8 col-lg-12 col-md-12 col-sm-12 col-12",children:[e.jsxs("div",{className:"top-stories-card",children:[e.jsx("h3",{className:"top-stories-main-title mb-20",children:"Top Stories"}),e.jsx("div",{className:"top-stories-carousel",children:e.jsxs("div",{className:"carousel slide",children:[e.jsx("div",{className:"carousel-inner",children:e.jsx("div",{className:"carousel-item active",children:e.jsxs("div",{className:"row g-3",children:[e.jsx("div",{className:"col-md-6",children:e.jsxs("div",{className:"top-story-card position-relative",children:[e.jsxs("div",{className:"story-image-wrapper",children:[e.jsx("div",{className:"skeleton skeleton-rectangular",style:{width:"100%",height:"300px"}}),e.jsx("div",{className:"story-gradient-overlay"})]}),e.jsxs("div",{className:"story-content-overlay",children:[e.jsxs("div",{className:"story-source-info d-flex align-items-center mb-10",children:[e.jsx("div",{className:"newsmax-logo mr-10",children:e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"40px",height:"40px"}})}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"100px",height:"16px",marginRight:"10px"}}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"30px",height:"16px"}}),e.jsx("div",{className:"story-menu-icon ml-auto",children:e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"20px",height:"20px"}})})]}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"90%",height:"20px",marginBottom:"8px"}}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"70%",height:"20px",marginBottom:"15px"}}),e.jsxs("div",{className:"d-flex align-items-center text-muted small gap-3",children:[e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"16px",height:"16px"}}),e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"16px",height:"16px"}}),e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"16px",height:"16px"}}),e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"16px",height:"16px"}})]})]})]})}),e.jsx("div",{className:"col-md-6",children:e.jsxs("div",{className:"top-story-card position-relative",children:[e.jsxs("div",{className:"story-image-wrapper",children:[e.jsx("div",{className:"skeleton skeleton-rectangular",style:{width:"100%",height:"300px"}}),e.jsx("div",{className:"story-gradient-overlay"})]}),e.jsxs("div",{className:"story-content-overlay",children:[e.jsxs("div",{className:"story-source-info d-flex align-items-center mb-10",children:[e.jsx("div",{className:"newsmax-logo mr-10",children:e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"40px",height:"40px"}})}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"100px",height:"16px",marginRight:"10px"}}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"30px",height:"16px"}}),e.jsx("div",{className:"story-menu-icon ml-auto",children:e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"20px",height:"20px"}})})]}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"90%",height:"20px",marginBottom:"8px"}}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"70%",height:"20px",marginBottom:"15px"}}),e.jsxs("div",{className:"d-flex align-items-center text-muted small gap-3",children:[e.jsx("div",{className:"skeleton 
1skeleton-circular",style:{width:"16px",height:"16px"}}),e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"16px",height:"16px"}}),e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"16px",height:"16px"}}),e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"16px",height:"16px"}})]})]})]})})]})})}),e.jsxs("div",{className:"carousel-indicators",children:[e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"10px",height:"10px",borderRadius:"50%"}}),e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"10px",height:"10px",borderRadius:"50%"}})]})]})})]}),e.jsx("div",{className:"featured-news-section mt-40",children:[1,2,3,4,5].map(x=>e.jsx("div",{className:"featured-news-item mb-30",children:e.jsxs("div",{className:"d-flex align-items-start",children:[e.jsxs("div",{className:"featured-news-left-content flex-grow-1",children:[e.jsxs("div",{className:"d-flex align-items-center mb-15",children:[e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{className:"sitelogo_img mr-10",children:e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"40px",height:"40px"}})}),e.jsx("div",{children:e.jsx("div",{className:"skeleton skeleton-text",style:{width:"80px",height:"14px"}})})]}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"40px",height:"14px",marginLeft:"10px",marginRight:"10px"}}),e.jsx("div",{className:"featured-ai",children:e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"20px",height:"20px"}})})]}),e.jsxs("div",{className:"mb-20",children:[e.jsx("div",{className:"skeleton skeleton-text",style:{width:"95%",height:"18px",marginBottom:"8px"}}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"85%",height:"18px",marginBottom:"8px"}}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"60%",height:"18px"}})]}),e.jsxs("div",{className:"d-flex align-items-center justify-content-between",children:[e.jsxs("div",{className:"d-flex align-items-center text-muted small gap-3",children:[e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"16px",height:"16px"}}),e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"16px",height:"16px"}}),e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"16px",height:"16px"}}),e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"16px",height:"16px"}})]}),e.jsx("div",{className:"featured-read-time-wrapper",children:e.jsx("div",{className:"skeleton skeleton-text",style:{width:"70px",height:"14px"}})})]})]}),e.jsx("div",{className:"featured-news-right-image ml-30",children:e.jsx("div",{className:"skeleton skeleton-rectangular",style:{width:"120px",height:"100px",borderRadius:"8px"}})})]})},x))})]})}const je=x=>x&&{CNN:"/newsimages/cnn.png","NBC News":"/newsimages/nbc.png",Newsmax:"/assets/img/site_logos/newsmax.png","The Wall Street Journal":"/assets/img/site_logos/WSJ_logo.png","ABC News":"/newsimages/abc.png","Fox News":"/newsimages/fox.png"}[x]||null,Y=({sourceName:x,className:_=""})=>{const[S,u]=d.useState(!1),m=je(x),y=!m||S,j=p=>p?p.substring(0,1).toUpperCase():"N",b=p=>{if(!p)return"#DB7A51";const N=["#DB7A51","#C4AF36","#8AD28A","#5B9BD5","#9B59B6","#E74C3C","#3498DB","#F39C12"];let v=0;for(let k=0;k<p.length;k++)v=p.charCodeAt(k)+((v<<5)-v);return N[Math.abs(v)%N.length]};return y?e.jsx("div",{className:_,style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:b(x),borderRadius:"4px",color:"white",fontWeight:"bold",minWidth:"40px",minHeight:"40px"},children:j(x)}):e.jsx("img",{src:m,alt:x||"Source",className:_,onError:()=>u(!0)})};function we(){const[x,_]=d.useState([]),[S,u]=d.useState([]),[m,y]=d.useState(!0),[j,b]=d.useState(null);d.useRef(null),d.useEffect(()=>{p()},[]);const p=async()=>{try{y(!0),b(null);const r=await ge({category:"general",pageSize:30});r.articles&&r.articles.length>0&&(_(r.articles.slice(0,4)),r.articles.length>4?u(r.articles.slice(4)):u([]))}catch(r){b(r.message||"Failed to load news")}finally{y(!1)}},N=r=>{if(!r)return"2 min read";const g=r.split(/\s+/).length;return`${Math.ceil(g/200)} min read`},v=r=>r.urlToImage?r.urlToImage:"/assets/img/home/nm1.png",k=d.useRef(null),E=d.useRef(null),T=d.useRef(!1);d.useEffect(()=>{if(x.length===0||m)return;const g=setTimeout(()=>{if(typeof window<"u"&&window.jQuery&&window.jQuery.fn.slick){const h=window.jQuery,c=k.current;c&&(h(c).hasClass("slick-initialized")&&h(c).slick("unslick"),h(c).slick({slidesToShow:2,slidesToScroll:1,arrows:!0,dots:!1,speed:300,infinite:!0,autoplaySpeed:5e3,autoplay:!0,centerMode:!0,centerPadding:"0px",responsive:[{breakpoint:1200,settings:{slidesToShow:2}},{breakpoint:992,settings:{slidesToShow:2}},{breakpoint:767,settings:{slidesToShow:1}}]}),T.current=!0)}},100);return()=>clearTimeout(g)},[x,m]);const I=r=>{if(E.current){const g=E.current,h=g.children[0];if(!h)return;const c=window.getComputedStyle(h),f=parseFloat(c.marginRight)||0,B=h.offsetWidth+f;g.scrollBy({left:r*B,behavior:"smooth"})}};return m?e.jsx(fe,{}):j?e.jsx("div",{className:"col-xl-8 col-lg-12 col-md-12 col-sm-12 col-12",children:e.jsxs("div",{className:"top-stories-card",children:[e.jsx("h3",{className:"top-stories-main-title mb-20",children:"Top Stories"}),e.jsxs("div",{className:"text-center p-4",children:[e.jsxs("p",{className:"text-danger",children:["Error: ",j]}),e.jsx("button",{className:"btn btn-primary",onClick:p,children:"Retry"})]})]})}):e.jsxs("div",{className:"col-xl-8 col-lg-12 col-md-12 col-sm-12 col-12 newscontent_rgt",children:[e.jsxs("div",{className:"top-stories-card",children:[e.jsx("h3",{className:"top-stories-main-title mb-20",children:"Top Stories"}),e.jsx("div",{className:"topstories_slider",ref:k,children:x.map((r,g)=>{var h,c;return e.jsx("div",{children:e.jsxs("div",{className:"card border-0 shadow-none top-story-card position-relative",children:[e.jsxs("div",{className:"story-image-wrapper",children:[e.jsx("img",{src:v(r),alt:r.title||"News",className:"story-bg-image",onError:f=>{f.target.src="/assets/img/home/nm1.png"}}),e.jsx("div",{className:"story-gradient-overlay"})]}),e.jsxs("div",{className:"story-content-overlay",children:[e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{className:"sitelogo_img mr-10",children:e.jsx(Y,{sourceName:(h=r.source)==null?void 0:h.name,className:""})}),e.jsx("div",{children:e.jsx("h6",{className:"mb-0 f_sz12 f_pmedium f_white",children:((c=r.source)==null?void 0:c.name)||"Unknown"})}),e.jsx("div",{className:"f_white ml-15 f_sz12",children:Q(r.publishedAt)}),e.jsx("div",{className:"aiicon ml-10",children:e.jsx("img",{alt:"AI",src:"/assets/img/home/ai_icon_white.png"})})]}),e.jsx("h5",{className:"allposts_title_lg f_white mt-10",children:e.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"none"},children:r.title||"No title available"})}),e.jsxs("div",{className:"d-flex align-items-center text-muted small gap-3",children:[e.jsx("a",{href:"/#",children:e.jsxs("span",{className:"d-inline-flex align-items-center",children:[e.jsx("i",{className:"fa-regular fa-thumbs-up f_sz18 f_darkgrey3"}),e.jsx("span",{className:"f_sz15 f_pmedium f_black ml-5",children:"5"})]})}),e.jsx("a",{href:"/#",children:e.jsxs("span",{className:"d-inline-flex align-items-center",children:[e.jsx("i",{className:"fa-regular fa-thumbs-down f_sz18 f_darkgrey3"}),e.jsx("span",{className:"f_sz15 f_pmedium f_black ml-5",children:"3"})]})}),e.jsx("a",{href:"/#",children:e.jsxs("span",{className:"d-inline-flex align-items-center",children:[e.jsx("i",{className:"fa-regular fa-message f_sz18 f_darkgrey3"}),e.jsx("span",{className:"f_sz15 f_pmedium f_black ml-5",children:"10"})]})}),e.jsx("a",{href:"/#",children:e.jsx("span",{className:"d-inline-flex align-items-center",children:e.jsx("i",{className:"fa-regular fa-share-from-square f_sz18 f_darkgrey3"})})})]})]})]})},g)})})]}),e.jsx("div",{className:"cards-wrapper featured-news-section mt-40 newssection_hgt scrollbar_style",ref:E,children:S.map((r,g)=>{var h,c;return e.jsxs("div",{className:"card featured-news-item mb-30",children:[e.jsxs("div",{className:"d-flex align-items-start",children:[e.jsxs("div",{className:"featured-news-left-content flex-grow-1",children:[e.jsxs("div",{className:"d-flex align-items-center mb-15",children:[e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{className:"sitelogo_img mr-10",children:e.jsx(Y,{sourceName:(h=r.source)==null?void 0:h.name,className:""})}),e.jsx("div",{children:e.jsx("h6",{className:"mb-0 f_sz12 f_pmedium",children:((c=r.source)==null?void 0:c.name)||"Unknown"})})]}),e.jsx("span",{className:"featured-timestamp f_sz12 f_darkgrey2 mr-10",children:Q(r.publishedAt)}),e.jsx("div",{className:"aiicon",children:e.jsx("img",{src:"/assets/img/home/ai_icon.png",alt:"AI"})})]}),e.jsx("h3",{className:"allposts_title f_plusjakartasanssemibold f_sz14 mb-20",children:e.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"none"},children:r.title||"No title available"})})]}),e.jsx("div",{className:"featured-news-right-image ml-30",children:e.jsx("img",{src:v(r),alt:r.title||"News",className:"featured-news-thumbnail",onError:f=>{f.target.src="/newsimages/news1.png"}})})]}),e.jsxs("div",{className:"d-flex align-items-center justify-content-between mt-15",children:[e.jsxs("div",{className:"d-flex align-items-center text-muted small gap-3",children:[e.jsx("a",{href:"/#",children:e.jsxs("span",{className:"d-inline-flex align-items-center",children:[e.jsx("i",{className:"fa-regular fa-thumbs-up f_sz18 f_darkgrey3"}),e.jsx("span",{className:"f_sz15 f_pmedium f_black ml-5",children:"5"})]})}),e.jsx("a",{href:"/#",children:e.jsxs("span",{className:"d-inline-flex align-items-center",children:[e.jsx("i",{className:"fa-regular fa-thumbs-down f_sz18 f_darkgrey3"}),e.jsx("span",{className:"f_sz15 f_pmedium f_black ml-5",children:"3"})]})}),e.jsx("a",{href:"/#",children:e.jsxs("span",{className:"d-inline-flex align-items-center",children:[e.jsx("i",{className:"fa-regular fa-message f_sz18 f_darkgrey3"}),e.jsx("span",{className:"f_sz15 f_pmedium f_black ml-5",children:"10"})]})}),e.jsx("a",{href:"/#",children:e.jsx("span",{className:"d-inline-flex align-items-center",children:e.jsx("i",{className:"fa-regular fa-share-from-square f_sz18 f_darkgrey3"})})})]}),e.jsxs("div",{className:"d-inline-flex align-items-center",children:[e.jsx("i",{className:"fa-regular fa-clock f_sz18 f_blue"}),e.jsx("span",{className:"f_sz14 f_black f_plusjakartasansmedium ml-5",children:N(r.content)})]})]})]},g)})}),e.jsxs("div",{className:"card-arrows gap-3",children:[e.jsx("button",{className:"arrow left",onClick:()=>I(-1),children:e.jsx("i",{className:"fa-solid fa-arrow-left"})}),e.jsx("button",{className:"arrow right",onClick:()=>I(1),children:e.jsx("i",{className:"fa-solid fa-arrow-right"})})]})]})}function Ne(){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"top-stories-header-card mb-20",children:e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{className:"skeleton 
1skeleton-circular",style:{width:"20px",height:"20px",marginRight:"10px"}}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"120px",height:"20px"}})]})}),e.jsxs("div",{className:"publishers-categories-card",children:[e.jsxs("div",{className:"publishers-section-content",children:[e.jsx("div",{className:"skeleton skeleton-text",style:{width:"150px",height:"16px",marginBottom:"15px"}}),[1,2,3,4,5].map(x=>e.jsxs("div",{className:"publisher-item d-flex align-items-center justify-content-between mb-15",children:[e.jsxs("div",{className:"d-flex align-items-center gap-3",children:[e.jsx("div",{className:"person_publogo",children:e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"40px",height:"40px"}})}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"120px",height:"14px"}})]}),e.jsx("div",{className:"publisher-follow-buttons d-flex align-items-center",children:e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"24px",height:"24px"}})})]},x)),e.jsx("div",{className:"publisher-separator",style:{marginTop:"10px",marginBottom:"15px"}}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"150px",height:"16px",marginBottom:"15px"}}),[1,2,3].map(x=>e.jsxs("div",{className:"publisher-item d-flex align-items-center justify-content-between mb-15",children:[e.jsxs("div",{className:"d-flex align-items-center gap-3",children:[e.jsx("div",{className:"person_publogo",children:e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"40px",height:"40px"}})}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"120px",height:"14px"}})]}),e.jsx("div",{className:"publisher-follow-buttons d-flex align-items-center",children:e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"24px",height:"24px"}})})]},x)),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"160px",height:"14px",marginTop:"10px"}})]}),e.jsxs("div",{className:"categories-section-content",children:[e.jsx("div",{className:"skeleton skeleton-text",style:{width:"150px",height:"16px",marginBottom:"15px"}}),[1,2,3].map(x=>e.jsxs("div",{className:"category-item d-flex align-items-center justify-content-between mb-15",children:[e.jsxs("div",{className:"d-flex align-items-center gap-3",children:[e.jsx("div",{className:"person_publogo",children:e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"40px",height:"40px"}})}),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"120px",height:"14px"}})]}),e.jsx("div",{className:"category-follow-buttons d-flex align-items-center",children:e.jsx("div",{className:"skeleton skeleton-circular",style:{width:"24px",height:"24px"}})})]},x)),e.jsx("div",{className:"skeleton skeleton-text",style:{width:"160px",height:"14px",marginTop:"10px"}})]})]})]})}function ve({onBrowseAllPublishers:x}){const _=ee(),S=O(q),u=O(J),m=V(S),[y,j]=d.useState(new Set),[b,p]=d.useState(new Set),[N,v]=d.useState(new Set),[k,E]=d.useState(null),[T]=se(),[I]=te(),r=(s,l="success",n=3e3)=>{E({message:s,type:l,duration:n})},{data:g,isLoading:h}=ie({userId:m||void 0,populate:"*",pagination:{pageSize:100}},{skip:!1}),{data:c,isLoading:f,refetch:B}=le({userId:m},{skip:!m||!u}),{data:z,isLoading:$}=ae({userId:m||void 0,pagination:{pageSize:100}},{skip:!1}),P=d.useCallback(s=>{var a,o,i,R,F,M,U,G;if(!s)return null;const l=((o=(a=s.attributes)==null?void 0:a.logo)==null?void 0:o.data)||s.logo,n=s.id||((i=s.attributes)==null?void 0:i.id)||((R=s.data)==null?void 0:R.id);return n?{id:n,name:((F=s.attributes)==null?void 0:F.name)||s.name,description:((M=s.attributes)==null?void 0:M.description)||s.description,logo:l,categories:((G=(U=s.attributes)==null?void 0:U.categories)==null?void 0:G.data)||s.categories,isFollowing:s.isFollowing||!1}:null},[]),L=d.useCallback(s=>{var l;return s?{id:s.id,name:((l=s.attributes)==null?void 0:l.name)||s.name,isFollowing:s.isFollowing||!1}:null},[]);d.useEffect(()=>{if(!u||!m){j(new Set),p(new Set);return}if(c!=null&&c.data){if(c.data.channels&&Array.isArray(c.data.channels)){const s=new Set;c.data.channels.forEach(l=>{var a;const n=l.id||((a=l.attributes)==null?void 0:a.id);n&&s.add(n)}),j(s)}else j(new Set);if(c.data.categories&&Array.isArray(c.data.categories)){const s=new Set;
1c.data.categories.forEach(l=>{var a;const n=l.id||((a=l.attributes)==null?void 0:a.id);n&&s.add(n)}),p(s)}else p(new Set)}else f||(j(new Set),p(new Set))},[c,u,m,f]);const t=d.useMemo(()=>{var s;return!((s=c==null?void 0:c.data)!=null&&s.channels)||!Array.isArray(c.data.channels)?[]:c.data.channels.map(l=>{var n,a,o,i,R,F,M,U;return{id:l.id||((n=l.attributes)==null?void 0:n.id),name:l.name||((a=l.attributes)==null?void 0:a.name),description:l.description||((o=l.attributes)==null?void 0:o.description),logo:l.logo||((R=(i=l.attributes)==null?void 0:i.logo)==null?void 0:R.data)||((F=l.attributes)==null?void 0:F.logo),categories:l.categories||((U=(M=l.attributes)==null?void 0:M.categories)==null?void 0:U.data),isFollowing:!0}}).filter(l=>l&&l.id)},[c]),w=d.useMemo(()=>{if(!(g!=null&&g.data))return[];const s=g.data.map(P).filter(Boolean),l=new Set(t.map(n=>n.id));return s.filter(n=>!l.has(n.id)).slice(0,5)},[g,t,P]),D=d.useMemo(()=>z!=null&&z.data?z.data.map(L).filter(Boolean).filter(l=>!b.has(l.id)).slice(0,3):[],[z,b,L]),C=async(s,l)=>{if(l.preventDefault(),l.stopPropagation(),!u||!m){r("Please log in to follow publishers.","error");return}if(N.has(s))return;const n=y.has(s);v(a=>new Set(a).add(s));try{const a=typeof s=="string"?parseInt(s,10):s;if(isNaN(a))throw new Error(`Invalid channel ID: ${s}`);n?await I({userId:m,type:"channel",itemId:a}).unwrap():await T({userId:m,type:"channel",itemId:a}).unwrap(),n?j(o=>{const i=new Set(o);return i.delete(s),i}):(j(o=>new Set(o).add(s)),await B()),_(H.util.invalidateTags(["Article","Recommended","Trending","Channel","Category","Personalisation"]))}catch{j(n?o=>new Set(o).add(s):o=>{const i=new Set(o);return i.delete(s),i})}finally{v(a=>{const o=new Set(a);return o.delete(s),o})}},A=async(s,l)=>{if(l.preventDefault(),l.stopPropagation(),!u||!m){r("Please log in to follow categories.","error");return}if(N.has(s))return;const n=b.has(s);v(a=>new Set(a).add(s));try{n?await I({userId:m,type:"category",itemId:s}).unwrap():await T({userId:m,type:"category",itemId:s}).unwrap(),n?p(a=>{const o=new Set(a);return o.delete(s),o}):(p(a=>new Set(a).add(s)),await B()),_(H.util.invalidateTags(["Article","Recommended","Trending","Channel","Category","Personalisation"]))}catch{p(n?o=>new Set(o).add(s):o=>{const i=new Set(o);return i.delete(s),i})}finally{v(a=>{const o=new Set(a);return o.delete(s),o})}},W=s=>s?xe(s):null,Z=s=>{if(!s)return"#DB7A51";const l=["#DB7A51","#C4AF36","#8AD28A","#5B9BD5","#9B59B6","#E74C3C","#3498DB","#F39C12"];let n=0;for(let a=0;a<s.length;a++)n=s.charCodeAt(a)+((n<<5)-n);return l[Math.abs(n)%l.length]};return h||$?e.jsx(Ne,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"top-stories-header-card mb-20",children:e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("i",{className:"fa-regular fa-newspaper f_sz20 mr-10 text-orange"}),e.jsx("h3",{className:"top-stories-title mb-0",children:"Top Stories"})]})}),e.jsxs("div",{className:"publishers-categories-card publisherscategories_hgt scrollbar_style",children:[e.jsxs("div",{className:"publishers-section-content",children:[u&&m&&t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h6",{className:"section-subtitle mb-15",children:"Followed Publishers"}),e.jsx("div",{className:"publisher-list",children:t.map(s=>{var o;const l=W(s.logo),n=y.has(s.id),a=N.has(s.id);return e.jsxs("div",{className:"publisher-item d-flex align-items-center mb-15",children:[e.jsx("div",{className:"col-xl-9 col-lg-9 col-md-9 col-sm-9 col-9",children:e.jsxs("div",{className:"d-flex align-items-center gap-3",children:[e.jsx("div",{className:"person_publogo",children:l?e.jsx("img",{src:l,alt:s.name}):e.jsx("span",{className:"f_black",children:((o=s.name)==null?void 0:o.substring(0,1).toUpperCase())||"P"})}),e.jsx("span",{className:"f_plusjakartasansmedium f_sz14",children:s.name})]})}),e.jsx("div",{className:"col-xl-3 col-lg-3 col-md-3 col-sm-3 col-3",children:e.jsxs("div",{className:"d-flex justify-content-end",children:[e.jsx("div",{className:`add-publisher-btn personalise_addtickbtn personalise_addbtn ${a?"processing":""}`,onClick:i=>C(s.id,i),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),C(s.id,i))},role:"button",tabIndex:0,style:{display:n?"none":"flex"},children:e.jsx("i",{className:"fa-solid fa-plus"})}),e.jsx("div",{className:`follow-check-icon personalise_addtickbtn personalise_tickbtn ${a?"processing":""}`,onClick:i=>C(s.id,i),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),C(s.id,i))},role:"button",tabIndex:0,style:{display:n?"flex":"none"},children:e.jsx("i",{className:"fa-solid fa-check"})})]})})]},s.id)})}),e.jsx("div",{className:"publisher-separator"})]}),e.jsx("h6",{className:"section-subtitle mb-15",children:"Suggested Publishers"}),e.jsx("div",{className:"publisher-list",children:w.map(s=>{var o;const l=W(s.logo),n=y.has(s.id),a=N.has(s.id);return e.jsxs("div",{className:"publisher-item d-flex align-items-center mb-15",children:[e.jsx("div",{className:"col-xl-9 col-lg-9 col-md-9 col-sm-9 col-9",children:e.jsxs("div",{className:"d-flex align-items-center gap-3",children:[e.jsx("div",{className:"person_publogo",children:l?e.jsx("img",{src:l,alt:s.name}):e.jsx("span",{className:"f_white",children:((o=s.name)==null?void 0:o.substring(0,1).toUpperCase())||"P"})}),e.jsx("span",{className:"f_plusjakartasansmedium f_sz14 w-150 publisher_desc",children:s.name})]})}
1),e.jsx("div",{className:"col-xl-3 col-lg-3 col-md-3 col-sm-3 col-3",children:e.jsxs("div",{className:"d-flex justify-content-end",children:[e.jsx("div",{className:`add-publisher-btn personalise_addtickbtn personalise_addbtn ${a?"processing":""}`,onClick:i=>C(s.id,i),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),C(s.id,i))},role:"button",tabIndex:0,style:{display:n?"none":"flex"},children:e.jsx("i",{className:"fa-solid fa-plus"})}),e.jsx("div",{className:`follow-check-icon personalise_addtickbtn personalise_tickbtn ${a?"processing":""}`,onClick:i=>C(s.id,i),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),C(s.id,i))},role:"button",tabIndex:0,style:{display:n?"flex":"none"},children:e.jsx("i",{className:"fa-solid fa-check"})})]})})]},s.id)})})]}),e.jsxs("div",{className:"categories-section-content",children:[e.jsx("h6",{className:"section-subtitle mb-15",children:"Suggested Categories"}),e.jsx("div",{className:"category-list",children:D.map(s=>{var o;const l=b.has(s.id),n=N.has(s.id),a=Z(s.name);return e.jsxs("div",{className:"category-item d-flex align-items-center justify-content-between mb-15",children:[e.jsxs("div",{className:"d-flex align-items-center gap-3",children:[e.jsx("div",{className:"person_publogo",style:{backgroundColor:a},children:e.jsx("span",{className:"f_white",children:((o=s.name)==null?void 0:o.substring(0,1).toUpperCase())||"C"})}),e.jsx("span",{className:"f_plusjakartasansmedium f_sz14",children:s.name})]}),e.jsxs("div",{className:"category-follow-buttons d-flex align-items-center",children:[e.jsx("div",{className:`add-category-btn personalise_addtickbtn personalise_addbtn ${n?"processing":""}`,onClick:i=>A(s.id,i),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),A(s.id,i))},role:"button",tabIndex:0,style:{display:l?"none":"flex"},children:e.jsx("i",{className:"fa-solid fa-plus"})}),e.jsx("div",{className:`follow-check-icon personalise_addtickbtn personalise_tickbtn ${n?"processing":""}`,onClick:i=>A(s.id,i),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),A(s.id,i))},role:"button",tabIndex:0,style:{display:l?"flex":"none"},children:e.jsx("i",{className:"fa-solid fa-check"})})]})]},s.id)})}),e.jsx("a",{href:"/#",className:"browse-all-link",onClick:s=>{s.preventDefault(),s.stopPropagation(),x&&x(s)},children:"Browse All Categories"})]})]}),k&&e.jsx(X,{message:k.message,type:k.type,duration:k.duration,onClose:()=>E(null),style:{position:"fixed",bottom:"20px",right:"20px",zIndex:9999}})]})}function Ce(){var z,$,P,L;const x=O(q),_=O(J),S=V(x),[u,m]=d.useState(!1),[y,j]=d.useState(!1),b=d.useRef(null),p=d.useRef(null),[N,v]=d.useState(null),k=ne(1),E=(t,w="success",D=3e3)=>{v({message:t,type:w,duration:D})},{data:T,isLoading:I,isError:r}=re({populate:"*",filters:{publishedAt:{$notNull:!0}},pagination:{pageSize:10},sort:"publishedAt:desc",userId:S,now:k}),g=d.useCallback(()=>{m(!0),document.body.style.overflow="hidden"},[]),h=d.useCallback(()=>{m(!1),document.body.style.overflow="auto"},[]);d.useEffect(()=>{const t=w=>{u&&b.current&&!b.current.contains(w.target)&&p.current&&!p.current.contains(w.target)&&h()};return document.addEventListener("click",t),()=>{document.removeEventListener("click",t)}},[u,h]),d.useEffect(()=>{const t=()=>{window.innerWidth>=992&&h()};return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[h]);const c=t=>{t.preventDefault(),t.stopPropagation(),_?(u&&h(),j(!0)):E("Please login first to browse all publishers.","error")},{data:f}=oe({populate:"*"}),B=d.useMemo(()=>{var D,C;const t=(D=f==null?void 0:f.allItems)==null?void 0:D.find(A=>A.label&&A.label.toLowerCase()==="news"||A.path&&A.path.includes("/news")),w={title:"News - My Military Lifestyle",description:"Stay updated with the latest news, stories, and lifestyle articles for the military community.",canonicalUrl:window.location.href,keywords:"military news, lifestyle, articles, community, veterans, families",siteName:"My Military Lifestyle",imageUrl:window.location.origin+"/assets/img/default-article.jpg"};
1return t?{title:t.seoTitle||t.metaTitle||t.title||w.title,description:t.seoDescription||t.metaDescription||t.description||w.description,canonicalUrl:t.canonicalUrl||w.canonicalUrl,keywords:t.keywords||t.metaKeywords||w.keywords,siteName:w.siteName,imageUrl:(C=t.metaImage)!=null&&C.url?t.metaImage.url.startsWith("http")?t.metaImage.url:window.location.origin+t.metaImage.url:w.imageUrl,structuredData:{"@context":"https://schema.org","@type":"CollectionPage",name:t.seoTitle||t.title||w.title,description:t.seoDescription||t.description||w.description,url:window.location.href}}:{...w,structuredData:{"@context":"https://schema.org","@type":"CollectionPage",name:w.title,description:w.description,url:window.location.href}}},[f]);return e.jsxs(e.Fragment,{children:[e.jsx(ce,{...B}),e.jsxs("main",{children:[e.jsx(K,{location:"GLOBAL_TOP_MOBILE",showSection:!0,sectionClassName:"pt-25 d-lg-none"}),e.jsx("section",{className:"tp-posts-area pt-20 pb-20",children:e.jsx("div",{className:"container",children:e.jsxs("div",{className:"row",children:[e.jsxs("div",{className:"col-xl-9 col-lg-8 col-md-12 col-sm-12 col-12 mb-30 allpagesdtl_left news-screen-wrapper",children:[e.jsx("div",{className:"row",children:e.jsxs("div",{className:"col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12",children:[e.jsx("div",{className:"d-flex mb-10",children:e.jsx("h3",{className:"f_plusjakartasanssemibold postdtl_title f_primary",children:(($=(z=f==null?void 0:f.allItems)==null?void 0:z.find(t=>t.label&&t.label.toLowerCase()==="news"||t.path&&t.path.includes("/news")))==null?void 0:$.label)||"News"})}),e.jsx("div",{className:"d-flex mb-25",children:((L=(P=f==null?void 0:f.allItems)==null?void 0:P.find(t=>t.label&&t.label.toLowerCase()==="news"||t.path&&t.path.includes("/news")))==null?void 0:L.description)||"Military-related news that matters to your life. Stay informed with context, clarity, and community impact in mind."})]})}),e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"floating-action-buttons d-xl-none",children:e.jsx("div",{className:"floating-btn floating-menu-btn",onClick:g,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),g())},role:"button",tabIndex:0,ref:p,children:e.jsx("i",{className:"fa-solid fa-ellipsis"})})}),e.jsx("div",{className:`mobile-sidebar-overlay ${u?"active":""}`,onClick:h,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),h())},role:"button",tabIndex:0,"aria-label":"Close sidebar"}),e.jsxs("div",{className:`col-xl-4 col-lg-3 col-md-6 col-sm-12 col-12 mobile-sidebar d-xl-block ${u?"active":""}`,id:"mobileSidebar",ref:b,children:[e.jsx("div",{className:"mobile-sidebar-close d-lg-none",onClick:h,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),h())},role:"button",tabIndex:0,"aria-label":"Close sidebar",children:e.jsx("i",{className:"fa-solid fa-times"})}),e.jsx("div",{className:"postdtl_adwrapper postdtl_adwrapper_sticky text-center mb-15",children:e.jsx(ve,{onBrowseAllPublishers:c})})]}),e.jsx(we,{})]})]}),e.jsx("div",{className:"col-xl-3 col-lg-4 col-md-12 col-sm-12 col-12 allpagesdtl_right d-none d-lg-block",children:e.jsx("div",{className:"postdtl_adwrapper postdtl_adwrapper_sticky text-center mb-15",children:e.jsx(K,{location:"GLOBAL_SIDEBAR_STICKY"})})})]})})}),e.jsx(K,{location:"GLOBAL_BOTTOM_WIDE",showSection:!0,sectionClassName:"pb-20"}),e.jsx(he,{data:T,isLoading:I,isError:r})]}),e.jsx(de,{}),e.jsx(me,{id:"personaliseModalNews",show:y,onClose:()=>j(!1)}),N&&e.jsx(X,{message:N.message,type:N.type,duration:N.duration,onClose:()=>v(null)})]})}export{Ce as default};

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.