1import{j as e,c as b,f as k,v as D,g as y,i as N,m as v,n as L,s as w,b as P,A as B}from"./index-BzhlEb2N.js";import{k as C,r as o,L as p}from"./vendor-react-CpRvMXaC.js";import{S as $}from"./SubpageHero-BiCXn71M.js";import"./vendor-pdf-De61ZhIs.js";import"./vendor-ui-5rZvml82.js";import"./vendor-editor-DoAMYjM7.js";function U(){const[A]=C(),l=A.get("q")||"",[r,d]=o.useState({noticias:[],paginas:[]}),[c,m]=o.useState(!0),[I,S]=o.useState(null),[x,h]=o.useState([]);o.useEffect(()=>{(async()=>{try{const[t,a]=await Promise.all([N.listarPublicoPorPagina("servicos/pessoa-fisica"),N.listarPublicoPorPagina("servicos/pessoa-juridica")]),n=v(t,"Serviços > Pessoa FÃsica"),i=v(a,"Serviços > Pessoa JurÃdica");h([...n,...i])}catch{h([])}})()},[]),o.useEffect(()=>{(async()=>{var t;if(!l.trim()){d({noticias:[],paginas:[]}),m(!1);return}m(!0);try{const[a,n]=await Promise.all([L.listarPublicadasComFiltros({search:l.trim(),per_page:12,page:1,sort_by:"data_publicacao",sort_order:"desc"}),Promise.resolve(w([...P,...x],l.trim(),20))]);console.log("ð Resultado da busca na página:",{dadosNoticias:a,tipo:typeof a,temData:!!(a!=null&&a.data),dataIsArray:Array.isArray(a==null?void 0:a.data),isArray:Array.isArray(a),keys:a?Object.keys(a):[],dataLength:(t=a==null?void 0:a.data)==null?void 0:t.length});let i=[];a&&(a.data!==void 0&&Array.isArray(a.data)?(i=a.data,a.current_page!==void 0&&S({current_page:a.current_page,last_page:a.last_page,per_page:a.per_page,total:a.total,from:a.from,to:a.to}),console.log("â
NotÃcias encontradas (paginada):",i.length,"de",a.total||"N/A")):Array.isArray(a)?(i=a,console.log("â
NotÃcias encontradas (array direto):",i.length)):a.data!==void 0&&!Array.isArray(a.data)?(i=[],console.log("â ï¸ dadosNoticias.data existe mas não é array:",typeof a.data)):(console.log("â ï¸ Formato de resposta não reconhecido:",{temData:"data"in a,isArray:Array.isArray(a),keys:Object.keys(a)}),i=[])),console.log("ð Resultados finais na página:",{noticias:i.length,paginas:n.length}),d({noticias:i,paginas:n})}catch(a){console.error("â Erro ao buscar resultados:",a);const n=w([...P,...x],l.trim(),20);d({noticias:[],paginas:n})}finally{m(!1)}})()},[l,x]);const R=s=>s?new Date(s).toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"}):"",_=s=>s?s.startsWith("http")?s:`${B.STORAGE_URL}/${s}`:"https://placehold.co/600x400/E2E8F0/4A5568?text=Sem+Imagem",u=s=>s?s.replace(/<[^>]*>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/\s+/g," ").trim():"",j=s=>{if(!s)return"";try{const t=JSON.parse(s);if(Array.isArray(t))return t.filter(a=>{var n;return a.type==="text"&&((n=a.settings)==null?void 0:n.content)}).map(a=>u(a.settings.content)).join(" ").trim()}catch{}return u(s)},f=(s,t=250)=>s.length>t?s.substring(0,t)+"...":s,F=s=>{if(s.resumo&&s.resumo.trim()){const t=j(s.resumo).trim();if(t)return f(t)}if(s.conteudo){const t=j(s.conteudo).trim();if(t)return f(t)}return null},E=s=>{var t;return D(s==null?void 0:s.autor)||((t=s==null?void 0:s.autor)==null?void 0:t.nome)||"CRP-PR"},g=r.noticias.length+r.paginas.length;return e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-gray-50 to-white",children:[e.jsxs($,{paddingClass:"py-16 md:py-20",children:[e.jsx("nav",{className:"mb-6","aria-label":"Breadcrumb",children:e.jsxs("ol",{className:"flex items-center gap-2 text-sm text-white/80",children:[e.jsx("li",{children:e.jsx(p,{to:"/",className:"hover:text-white transition-colors",children:"Home"})}),e.jsx("li",{children:"/"}),e.jsx("li",{className:"text-white font-semibold",children:"Resultados da Busca"})]})}),e.jsx("div",{className:"flex items-center gap-4 mb-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-3 leading-tight text-white",children:"Resultados da Busca"}),l&&e.jsxs("p",{className:"text-xl text-white/90",children:["Buscando por: ",e.jsxs("span",{className:"font-semibold",children:['"',l,'"']})]})]})})]}),e.jsx("section",{className:"py-12",children:e.jsx("div",{className:"container mx-auto px-6",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[c&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"inline-block animate-spin rounded-full h-12 w-12 border-b-2 border-primary"}),e.jsx("p",{className:"mt-4 text-texto",children:"Buscando..."})]}),!c&&!l.trim()&&e.jsxs("div",{className:"text-center py-12 bg-white rounded-lg shadow-sm border border-gray-200",children:[e.jsx(b,{className:"h-16 w-16 text-gray-300 mx-auto mb-4"}),e.jsx("p",{className:"text-texto text-lg",children:"Digite um termo de busca para começar"})]}),!c&&l.trim()&&g===0&&e.jsxs("div",{className:"text-center py-12 bg-white rounded-lg shadow-sm border border-gray-200",children:[e.jsx(b,{className:"h-16 w-16 text-gray-300 mx-auto mb-4"}),e.jsxs("p",{className:"text-texto text-lg mb-2",children:['Nenhum resultado encontrado para "',l,'"']}),e.jsx("p",{className:"text-gray-500",children:"Tente usar termos diferentes ou verifique a ortografia"})]}),!c&&l.trim()&&g>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-8 pb-4 border-b border-gray-200",children:e.jsxs("p",{className:"text-texto",children:["Encontrados ",e.jsx("span",{className:"font-semibold text-primary",children:g})," resultado(s)",r.noticias.length>0&&e.jsxs("span",{children:[" - ",e.jsx("span",{className:"font-semibold",children:r.noticias.length})," notÃcia(s)"]}),r.paginas.length>0&&e.jsxs("span",{children:[" e ",e.jsx("span",{className:"font-semibold",children:r.paginas.length})," página(s)"]})]})}),r.noticias.length>0&&e.jsxs("div",{className:"mb-12",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(k,{className:"h-6 w-6 text-primary"}),e.jsxs("h2",{className:"text-2xl font-bold text-titulos",children:["NotÃcias (",r.noticias.length,")"]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:r.noticias.map(s=>{const t=F(s);return e.jsxs(p,{to:`/noticias/${s.slug||s.id}`,className:"bg-white rounded-lg shadow-md overflow-hidden group hover:shadow-lg transition-all",children:[e.jsx("img",{src:_(s.imagem_url||s.imagem),alt:s.titulo,className:"w-full h-48 object-cover group-hover:opacity-80 transition-opacity"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm text-texto-400 mb-2",children:[e.jsx("span",{children:R(s.data_publicacao||s.created_at)}),e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"â¢"}),e.jsxs("span",{children:["Por ",E(s)]})]})]}),e.jsx("h3",{className:"text-xl font-bold my-2 text-titulos group-hover:text-primary transition-colors line-clamp-2",children:s.titulo}),t&&e.jsx("p",{className:"text-sm text-texto mb-3 line-clamp-3",children:t}),e.jsxs("div",{className:"flex flex-wrap gap-2 mt-3",children:[s.categorias&&s.categorias.length>0&&e.jsx(e.Fragment,{children:s.categorias.map(a=>e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:a.nome},a.id))}),s.tags&&s.tags.length>0&&e.jsx(e.Fragment,{children:s.tags.map(a=>e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-700",children:a.nome},a.id))})]})]})]},s.id)})})]}),r.paginas.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(y,{className:"h-6 w-6 text-primary"}),e.jsxs("h2",{className:"text-2xl font-bold text-titulos",children:["Páginas (",r.paginas.length,")"]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:r.paginas.map((s,t)=>e.jsx(p,{to:s.path,className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-all border border-transparent hover:border-primary/20",children:e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("div",{className:"w-16 h-16 bg-primary/10 rounded-lg flex items-center justify-center",children:e.jsx(y,{className:"h-8 w-8 text-primary"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-titulos mb-0",children:s.title}),e.jsx("p",{className:"text-sm text-texto line-clamp-2 mb-1",children:s.description}),e.jsxs("p",{className:"text-xs text-gray-400 mb-2",children:[s.category," > ",s.title]})]})]})},`pagina-${t}`))})]})]})]})})})]})}export{U 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.