PageSourceSearch

https://anpg.co.ao/assets/NewsDetailPage-Cf-De37p.js

js anpg.co.ao collected 2026-09-25 04:07:27 UTC 14,128 bytes, 3 lines download raw bytes

1/* ANPG DEVTEAM - 23/09/2026, 12:53:51 */
2import{e as V,u as U,d as M,j as e}from"./data-vendor-BRYI0K8G.js";import{r as S,h as O,i as Q,L as K}from"./react-vendor-Bj9LQV-u.js";import{P as q}from"./PageLayout-B43uM63E.js";import{v as H,b as d,l as L,n as X,w as $,bj as P,bk as J,ba as Y,be as D,g as y,bd as T,S as m,bc as W,a8 as k,R as B,D as Z,bl as ee,bm as se,bn as ae,m as F,X as te,bo as re}from"./index-cwV7SCbt.js";import{B as E}from"./badge-DH3OcwR0.js";import{W as oe}from"./WPContent-BN-GmMo4.js";import{S as le,a as ne}from"./StaggerContainer-Ca5vuASL.js";import{I as R}from"./input-DXoiBR8B.js";import{T as ie}from"./textarea-DXuDKDDL.js";import{M as ce}from"./message-circle-gmfHcZDA.js";import{S as de}from"./send-Do57BhJt.js";import{l as me}from"./resolveData-DpHO9OE-.js";import{C as xe,a as ue,b as he,c as ge,d as pe}from"./carousel-CY-8zT8-.js";import{N as z}from"./newspaper-CHlewEV4.js";import{A}from"./arrow-left-BeqZSyXi.js";import{U as fe}from"./user-GGMDWiDQ.js";import{T as je}from"./tag-C9YMMS4O.js";import{S as be}from"./share-2-Rrg5_ZsC.js";import"./PageBreadcrumb-Dy1zu2ro.js";import"./i18n-vendor-BSIZ7LIS.js";import"./motion-vendor-DMc3mo8t.js";import"./house-CbYFZtt0.js";import"./star-DIWblV4s.js";import"./circle-check-DFc5yF46.js";import"./charts-vendor-Cs07Jtv5.js";function Ne(o){const l=new Date(o.replace(" ","T"));return isNaN(l.getTime())?o:l.toLocaleDateString("pt-PT",{day:"2-digit",month:"long",year:"numeric"})}function ve({articleKey:o}){const{toast:l}=H(),g=V(),C=["news-engagement",o],{data:i,isLoading:I}=U({queryKey:C,queryFn:()=>P.get(o),enabled:!!o}),[b,a]=S.useState(""),[N,v]=S.useState(""),[w,p]=S.useState(""),f=M({mutationFn:()=>P.toggleLike(o),onSuccess:t=>{g.setQueryData(C,j=>j&&{...j,likeCount:t.likeCount,likedByMe:t.liked})},onError:()=>{l({title:"Não foi possível registar o gosto.",variant:"destructive"})}}),n=M({mutationFn:()=>P.submitComment(o,{author_name:b.trim(),content:w.trim(),author_email:N.trim()||void 0}),onSuccess:t=>{l({title:t.message||"Comentário submetido para moderação."}),p(""),v("")},onError:t=>{l({title:(t==null?void 0:t.message)||"Não foi possível submeter o comentário.",variant:"destructive"})}}),c=t=>{if(t.preventDefault(),!b.trim()){l({title:"Indique o seu nome.",variant:"destructive"});return}if(w.trim().length<2){l({title:"Escreva um comentário.",variant:"destructive"});return}n.mutate()},x=(i==null?void 0:i.likeCount)??0,h=(i==null?void 0:i.likedByMe)??!1,u=(i==null?void 0:i.comments)??[];return e.jsxs("div",{className:"mt-8 pt-8 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[e.jsxs(d,{variant:h?"default":"outline",size:"lg",onClick:()=>f.mutate(),disabled:f.isPending,className:L("rounded-full gap-2 transition-all",h&&"bg-primary text-primary-foreground"),"aria-pressed":h,children:[e.jsx(X,{className:L("w-5 h-5",h&&"fill-current")}),e.jsx("span",{children:x}),e.jsx("span",{className:"hidden sm:inline",children:x===1?"Gosto":"Gostos"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(ce,{className:"w-5 h-5"}),e.jsxs("span",{children:[u.length," ",u.length===1?"comentário":"comentários"]})]})]}),e.jsxs("form",{onSubmit:c,className:"bg-secondary/40 border border-border rounded-xl p-5 mb-8",children:[e.jsx("h3",{className:"font-semibold text-foreground mb-4",children:"Deixe um comentário"}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 mb-4",children:[e.jsx(R,{placeholder:"O seu nome *",value:b,onChange:t=>a(t.target.value),maxLength:120,required:!0}),e.jsx(R,{type:"email",placeholder:"Email (opcional, não publicado)",value:N,onChange:t=>v(t.target.value),maxLength:191})]}),e.jsx(ie,{placeholder:"Escreva o seu comentário…",value:w,onChange:t=>p(t.target.value),maxLength:2e3,rows:4,className:"mb-4",required:!0}),e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Os comentários são publicados após moderação."}),e.jsxs(d,{type:"submit",disabled:n.isPending,className:"gap-2",children:[n.isPending?e.jsx($,{className:"w-4 h-4 animate-spin"}):e.jsx(de,{className:"w-4 h-4"}),"Comentar"]})]})]}),I?e.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:e.jsx($,{className:"w-5 h-5 animate-spin"})}):u.length>0?e.jsx("div",{className:"space-y-4",children:u.map(t=>e.jsxs("div",{className:"bg-background border border-border rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-2",children:[e.jsx("span",{className:"font-semibold text-foreground",children:t.author_name}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Ne(t.created_at)})]}),e.jsx("p",{className:"text-muted-foreground whitespace-pre-line",children:t.content})]},t.id))}):e.jsx("p",{className:"text-center text-muted-foreground py-6",children:"Seja o primeiro a comentar esta notícia."})]})}function Qe(){var t,j,_;const{newsId:o}=O(),l=Q(),{data:g,isLoading:C}=J(o),{data:i,isLoading:I}=Y({limit:20}),b=D.find(s=>s.id===o),a=g||b,N=me(i,D,I),v=N.filter(s=>(s.slug||s.id)!==o&&s.category===(a==null?void 0:a.category)).slice(0,3),w=v.length>0?v:N.filter(s=>(s.slug||s.id)!==o).slice(0,3),p=g==null?void 0:g.id,{data:f}=U({queryKey:["news-gallery",p],queryFn:()=>re.list({article_id:p,sort:"sort_order",limit:50}),enabled:!!p}),n=(f==null?void 0:f.data)||[],[c,x]=S.useState(null);if(C)return e.jsx(q,{title:"A carregar...",subtitle:"Media",icon:e.jsx(z,{className:"w-8 h-8 text-primary"}),breadcrumbs:[{labelKey:"nav.media",href:"/media"},{label:"..."}
2],children:e.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[e.jsx(y,{className:"h-8 w-3/4"}),e.jsx(y,{className:"h-64 w-full rounded-2xl"}),e.jsx(y,{className:"h-4 w-full"}),e.jsx(y,{className:"h-4 w-5/6"}),e.jsx(y,{className:"h-4 w-4/6"})]})});if(!a)return e.jsx(q,{title:"Notícia não encontrada",subtitle:"Media",icon:e.jsx(z,{className:"w-8 h-8 text-primary"}),breadcrumbs:[{labelKey:"nav.media",href:"/media"},{label:"Notícia não encontrada"}],children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-4",children:"A notícia que procura não foi encontrada"}),e.jsx("p",{className:"text-muted-foreground mb-8",children:"Verifique o endereço ou navegue pelas nossas notícias recentes."}),e.jsxs(d,{onClick:()=>l("/media"),children:[e.jsx(A,{className:"w-4 h-4 mr-2"}),"Voltar às Notícias"]})]})});const h=typeof window<"u"?window.location.href:"",u=s=>{const r={facebook:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(h)}`,instagram:"https://www.instagram.com/anpg_angola_oficial",linkedin:`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(h)}`};window.open(r[s],"_blank","width=600,height=400")};return e.jsxs(e.Fragment,{children:[e.jsxs(q,{title:a.title,subtitle:T(a.category),backgroundImage:a.image,icon:e.jsx(z,{className:"w-8 h-8 text-primary"}),breadcrumbs:[{labelKey:"nav.media",href:"/media"},{label:a.title}],children:[e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsx(m,{children:e.jsxs(d,{variant:"ghost",onClick:()=>l("/media"),className:"mb-8 -ml-4",children:[e.jsx(A,{className:"w-4 h-4 mr-2"}),"Voltar às Notícias"]})}),e.jsx(m,{delay:.1,children:e.jsxs("div",{className:"mb-8",children:[e.jsx(E,{className:L("mb-4",W(a.category)),children:e.jsx(k,{text:T(a.category)})}),e.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-foreground mb-6 leading-tight",children:e.jsx(k,{text:a.title})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(B,{className:"w-4 h-4"}),a.date]}),a.author&&e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(fe,{className:"w-4 h-4"}),a.author]})]})]})}),e.jsx(m,{delay:.2,children:e.jsx("div",{className:"rounded-2xl overflow-hidden mb-8 shadow-lg",children:e.jsx("img",{src:a.image,alt:a.title,className:"w-full h-auto object-cover",onError:s=>{s.currentTarget.src="/placeholder.svg"}})})}),e.jsx(m,{delay:.3,children:e.jsxs("article",{className:"prose prose-lg max-w-none dark:prose-invert prose-headings:text-foreground prose-p:text-muted-foreground prose-strong:text-foreground prose-blockquote:border-primary prose-blockquote:text-muted-foreground prose-li:text-muted-foreground prose-img:rounded-lg",children:[e.jsx("div",{className:"text-lg text-foreground font-medium mb-6 leading-relaxed",children:e.jsx(Z,{text:a.excerpt,as:"p"})}),e.jsx("div",{className:"article-content news-content",children:e.jsx(oe,{html:a.content.includes("<")?a.content:a.content.split(`
3`).map(s=>{const r=s.trim();return r?r.startsWith("## ")?`<h2>${r.replace("## ","")}</h2>`:r.startsWith("### ")?`<h3>${r.replace("### ","")}</h3>`:r.startsWith("> ")?`<blockquote>${r.replace("> ","")}</blockquote>`:r.startsWith("- ")?`<li>${r.replace("- ","")}</li>`:/^\d+\.\s/.test(r)?`<li>${r.replace(/^\d+\.\s/,"")}</li>`:r.startsWith("|")?"":`<p>${r}</p>`:""}).join(""),maxWidth:"none"})})]})}),n.length>0&&e.jsx(m,{delay:.35,children:e.jsxs("div",{className:"mt-10 mb-8",children:[e.jsx("h3",{className:"text-xl font-bold text-foreground mb-4",children:"Galeria de Imagens"}),e.jsxs(xe,{className:"w-full",opts:{loop:!0},children:[e.jsx(ue,{children:n.map((s,r)=>e.jsx(he,{className:"md:basis-1/2 lg:basis-1/3",children:e.jsxs("div",{className:"relative aspect-[4/3] rounded-xl overflow-hidden cursor-pointer group",onClick:()=>x(r),children:[e.jsx("img",{src:s.image_url,alt:s.caption||"",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",loading:"lazy",onError:G=>{G.currentTarget.src="/placeholder.svg"}}),s.caption&&e.jsx("div",{className:"absolute bottom-0 inset-x-0 bg-gradient-to-t from-black/70 to-transparent p-3",children:e.jsx("p",{className:"text-white text-sm line-clamp-2",children:s.caption})})]})},s.id))}),e.jsx(ge,{className:"-left-4"}),e.jsx(pe,{className:"-right-4"})]})]})}),"tags"in a&&a.tags&&a.tags.length>0&&e.jsx(m,{delay:.4,children:e.jsx("div",{className:"mt-8 pt-8 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(je,{className:"w-4 h-4 text-muted-foreground"}),a.tags.map(s=>e.jsx(E,{variant:"secondary",className:"rounded-full",children:e.jsx(k,{text:s})},s))]})})}),e.jsx(m,{delay:.5,children:e.jsx("div",{className:"mt-8 pt-8 border-t border-border",children:e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Partilhar:"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{variant:"outline",size:"icon",onClick:()=>u("facebook"),className:"rounded-full hover:bg-primary/10 hover:text-primary hover:border-primary/30",children:e.jsx(ee,{className:"w-4 h-4"})}),e.jsx(d,{variant:"outline",size:"icon",onClick:()=>u("instagram"),className:"rounded-full hover:bg-primary/10 hover:text-primary hover:border-primary/30",children:e.jsx(se,{className:"w-4 h-4"})}),e.jsx(d,{variant:"outline",size:"icon",onClick:()=>u("linkedin"),className:"rounded-full hover:bg-primary/10 hover:text-primary hover:border-primary/30",children:e.jsx(ae,{className:"w-4 h-4"})})]})]})})}
3),e.jsx(m,{delay:.55,children:e.jsx(ve,{articleKey:o||a.slug||a.id})})]}),e.jsx(m,{delay:.6,children:e.jsxs("div",{className:"mt-16 pt-16 border-t border-border",children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-8",children:"Notícias Relacionadas"}),e.jsx(le,{className:"grid md:grid-cols-3 gap-6",children:w.map(s=>e.jsx(ne,{children:e.jsx(K,{to:`/noticias/${s.slug||s.id}`,className:"group block h-full",children:e.jsxs("div",{className:"bg-secondary/50 border border-border rounded-xl overflow-hidden hover:border-primary/30 transition-all duration-300 hover:shadow-lg h-full flex flex-col",children:[e.jsx("div",{className:"aspect-video overflow-hidden",children:e.jsx("img",{src:s.image,alt:s.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"})}),e.jsxs("div",{className:"p-5 flex flex-col flex-1",children:[e.jsx(E,{className:L("w-fit mb-3",W(s.category)),children:e.jsx(k,{text:T(s.category)})}),e.jsx("h3",{className:"font-bold text-foreground mb-2 group-hover:text-primary transition-colors line-clamp-2 flex-1",children:e.jsx(k,{text:s.title})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mt-auto pt-3 border-t border-border",children:[e.jsx(B,{className:"w-4 h-4"}),s.date]})]})]})})},s.id))}),e.jsx("div",{className:"mt-8 text-center",children:e.jsxs(d,{variant:"outline",size:"lg",onClick:()=>l("/media"),children:["Ver Todas as Notícias",e.jsx(F,{className:"w-4 h-4 ml-2"})]})})]})})]}),c!==null&&n.length>0&&e.jsxs("div",{className:"fixed inset-0 z-[9999] bg-black/90 flex items-center justify-center p-4",onClick:()=>x(null),children:[e.jsx(d,{variant:"ghost",size:"icon",className:"absolute top-4 right-4 text-white hover:bg-white/20 z-[10000]",onClick:()=>x(null),children:e.jsx(te,{className:"h-6 w-6"})}),e.jsx("img",{src:(t=n[c])==null?void 0:t.image_url,alt:((j=n[c])==null?void 0:j.caption)||"",className:"max-w-full max-h-[85vh] object-contain rounded-lg",onClick:s=>s.stopPropagation()}),((_=n[c])==null?void 0:_.caption)&&e.jsx("p",{className:"absolute bottom-8 text-white text-center max-w-lg bg-black/50 px-4 py-2 rounded-lg",children:n[c].caption}),c>0&&e.jsx(d,{variant:"ghost",size:"icon",className:"absolute left-4 top-1/2 -translate-y-1/2 text-white hover:bg-white/20",onClick:s=>{s.stopPropagation(),x(c-1)},children:e.jsx(A,{className:"h-6 w-6"})}),c<n.length-1&&e.jsx(d,{variant:"ghost",size:"icon",className:"absolute right-4 top-1/2 -translate-y-1/2 text-white hover:bg-white/20",onClick:s=>{s.stopPropagation(),x(c+1)},children:e.jsx(F,{className:"h-6 w-6"})})]})]})}export{Qe 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.