1import{X as e,c as t,q as n}from"./useStore-IFFnP4Vt.js";import{t as r}from"./button-CsjwRYD_.js";import{t as i}from"./Header-DvzokYg9.js";import{t as a}from"./Footer-BlPVqZzA.js";import{K as o}from"./index-q7dLgUo4.js";import{i as s,n as c,r as l,t as u}from"./tabs-BZxGERMQ.js";import{c as d,i as f}from"./useWpPosts-qV_FfihS.js";import{t as p}from"./MarketTicker-DqztGemv.js";import{t as m}from"./AdSlot-B7HOfOcf.js";import{t as h}from"./SeoHead-GD3GpSJZ.js";import{n as g,t as _}from"./Sidebar-CDkVKUgz.js";import{t as v}from"./NewsletterSignup-CXO8kIdF.js";import{t as y}from"./ContentCard-C1JDr0bC.js";var b=e(n(),1),x=t(),S={value:`todas`,label:`Todas`,slug:``},C=[S,{value:`musica`,label:`Música`,slug:`musica`},{value:`cinema`,label:`Cinema`,slug:`cinema`},{value:`cultura`,label:`Cultura`,slug:`cultura`},{value:`cultura-sp`,label:`Cultura SP`,slug:`cultura-sp`},{value:`eventos`,label:`Eventos`,slug:`eventos`},{value:`esportes`,label:`Esportes`,slug:`esportes`},{value:`kids`,label:`Alpha Kids`,slug:`kids`},{value:`noticias`,label:`Geral`,slug:`noticias`}],w=10,T=5,E=(e,t)=>{let n=Math.min(T,t),r=e-Math.floor(n/2);return r<1&&(r=1),r+n-1>t&&(r=t-n+1),Array.from({length:n},(e,t)=>r+t)},D=()=>{let[e,t]=o(),n=e.get(`categoria`),T=parseInt(e.get(`page`)||`1`,10),D=Number.isFinite(T)&&T>0?T:1,O=C.find(e=>e.slug===n)?.value||S.value,k=C.find(e=>e.value===O)?.slug||``,{data:A,isLoading:j,isFetching:M}=f({categorySlug:k||void 0},D-1,w),{data:N}=d({categorySlug:k||void 0}),P=Math.max(1,Math.ceil((N||0)/w)),F=E(D,P);(0,b.useEffect)(()=>{if(N!==void 0&&D>P){let n=new URLSearchParams(e);n.set(`page`,String(P)),t(n,{replace:!0})}},[N,P,D,e,t]);let I=A?.map(e=>({title:e.title,description:e.excerpt||``,image:e.image_url||`https://images.unsplash.com/photo-1493225457124-a3eb161ffa5f?w=800&h=450&fit=crop`,date:e.published_at?new Date(e.published_at).toLocaleDateString(`pt-BR`):``,category:e.category_name||`Geral`,link:g(e)||void 0}))??[],L=n=>{let r=C.find(e=>e.value===n)?.slug||``,i=new URLSearchParams(e);r?i.set(`categoria`,r):i.delete(`categoria`),i.delete(`page`),t(i,{replace:!0})},R=n=>{let r=new URLSearchParams(e);n<=1?r.delete(`page`):r.set(`page`,String(n)),t(r,{replace:!1}),window.scrollTo({top:0,behavior:`smooth`})},z=j||M&&!A;return(0,x.jsxs)(`div`,{className:`min-h-screen bg-background`,children:[(0,x.jsx)(h,{title:`NotÃcias | Alpha FM 101.7`,description:`As últimas notÃcias de música, cultura, podcasts e entretenimento publicadas pela Alpha FM.`,path:`/noticias`}),(0,x.jsx)(i,{}),(0,x.jsx)(p,{}),(0,x.jsx)(`main`,{className:`container mx-auto px-4 py-8 pt-24`,children:(0,x.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-8`,children:[(0,x.jsxs)(`div`,{className:`lg:col-span-9`,children:[(0,x.jsx)(`h1`,{className:`text-4xl font-bold text-foreground mb-2`,children:`NotÃcias`}),(0,x.jsx)(`p`,{className:`text-muted-foreground mb-6`,children:`Fique por dentro das últimas novidades do mundo da música, cultura e entretenimento.`}),(0,x.jsx)(m,{format:`billboard`,className:`mb-8`}),(0,x.jsxs)(u,{value:O,onValueChange:L,className:`w-full`,children:[(0,x.jsx)(l,{className:`flex flex-wrap h-auto gap-1 mb-8`,children:C.map(e=>(0,x.jsx)(s,{value:e.value,className:`text-xs sm:text-sm`,children:e.label},e.value))}),C.map(e=>(0,x.jsxs)(c,{value:e.value,children:[z?(0,x.jsx)(`div`,{className:`text-center text-muted-foreground py-12`,children:`Carregando matériasâ¦`}):I.length===0?(0,x.jsx)(`div`,{className:`text-center text-muted-foreground py-12 border border-dashed rounded-lg`,children:`Nenhuma matéria publicada nesta categoria ainda.`}):(0,x.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:I.map((e,t)=>(0,x.jsx)(y,{...e},t))}),P>1&&(0,x.jsxs)(`div`,{className:`flex justify-center items-center gap-2 mt-8 flex-wrap`,children:[(0,x.jsx)(r,{variant:`outline`,size:`sm`,onClick:()=>R(Math.max(1,D-1)),disabled:D===1,children:`Anterior`}),F[0]>1&&(0,x.jsx)(`span`,{className:`px-1 text-muted-foreground`,children:`â¦`}),F.map(e=>(0,x.jsx)(r,{variant:e===D?`default`:`outline`,size:`sm`,onClick:()=>R(e),children:e},e)),F[F.length-1]<P&&(0,x.jsx)(`span`,{className:`px-1 text-muted-foreground`,children:`â¦`}),(0,x.jsx)(r,{variant:`outline`,size:`sm`,onClick:()=>R(Math.min(P,D+1)),disabled:D===P,children:`Próxima`}),(0,x.jsxs)(`span`,{className:`text-sm text-muted-foreground ml-1`,children:[`de `,P]})]})]},e.value))]}),(0,x.jsx)(`div`,{className:`mt-5`,children:(0,x.jsx)(v,{})})]}),(0,x.jsx)(`div`,{className:`lg:col-span-3`,children:(0,x.jsx)(_,{})})]})}),(0,x.jsx)(a,{})]})};export{D as component};
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.