import{r as e,j as n}from"./vendor-uppOmrO1-1769616088145.js";import{u as a}from"./useBlog-DdjE5a_D-1769616088145.js";import{N as t,B as s}from"./index-CqTWyXvI-1769616088145.js";import"./icons-q_FNXakb-1769616088145.js";const i=({src:a,alt:t,className:s=""})=>{const[i,l]=e.useState("loading"),[r,d]=e.useState("");e.useEffect(()=>{d(a)},[a,t]);return n.jsxs("div",{className:"w-full h-48 bg-gray-200 relative",children:["loading"===i&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:n.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})}),"error"===i&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-red-50",children:n.jsxs("div",{className:"text-center text-red-600",children:[n.jsx("div",{className:"text-4xl mb-2",children:"❌"}),n.jsx("div",{className:"text-sm font-bold",children:"Erro ao carregar"})]})}),n.jsx("img",{src:r,alt:t,className:"w-full h-48 object-cover ".concat(s),style:{display:"block",maxWidth:"100%",opacity:"success"===i?1:0,transition:"opacity 0.3s"},onLoad:()=>{l("success")},onError:()=>{l("error")}})]})},l=({title:t,description:s,showSearch:l=!1,showPagination:r=!1,limit:d=10,categoryId:o,featured:c})=>{const[x,m]=e.useState(""),[h,b]=e.useState([]),[u,g]=e.useState(1),[p]=e.useState(d),{posts:j,loading:f,error:v,fetchPosts:y}=a();e.useEffect(()=>{y({limit:100,categoryId:o,featured:c})},[o,c]),e.useEffect(()=>{if(x.trim()){const e=j.filter(e=>e.title.toLowerCase().includes(x.toLowerCase())||e.excerpt&&e.excerpt.toLowerCase().includes(x.toLowerCase())||e.tags&&e.tags.some(e=>e.toLowerCase().includes(x.toLowerCase())));b(e)}else b(j);g(1),j.forEach(e=>{})},[j,x]);const N=u*p,w=N-p,k=h.slice(w,N),L=Math.ceil(h.length/p),C=e=>{g(e),window.scrollTo({top:0,behavior:"smooth"})},S=e=>{const n=document.createElement("DIV");return n.innerHTML=e,n.textContent||n.innerText||""};return f?n.jsx("div",{className:"flex items-center justify-center py-16",children:n.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})}):v?n.jsx("div",{className:"text-center py-16",children:n.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 max-w-md mx-auto",children:[n.jsx("div",{className:"text-red-600 font-medium mb-2",children:"Erro ao carregar posts"}),n.jsx("div",{className:"text-red-500 text-sm",children:v})]})}):0===h.length?n.jsx("div",{className:"text-center py-16",children:n.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-8 max-w-md mx-auto",children:[n.jsx("div",{className:"text-gray-600 font-medium mb-2",children:0===j.length?"Nenhum post encontrado":"Nenhum resultado"}),n.jsx("div",{className:"text-gray-500 text-sm",children:0===j.length?"Em breve adicionaremos novos artigos especializados para engenheiros.":'Sua busca por "'.concat(x,'" não retornou resultados.')}),x&&n.jsx("button",{onClick:()=>m(""),className:"mt-4 text-blue-600 hover:text-blue-700 text-sm font-medium",children:"Limpar busca"})]})}):n.jsxs("div",{className:"space-y-12",children:[(t||s)&&n.jsxs("div",{className:"text-center",children:[t&&n.jsx("h2",{className:"text-3xl font-bold text-gray-900 mb-4",children:t}),s&&n.jsx("p",{className:"text-gray-600 max-w-2xl mx-auto",children:s})]}),l&&n.jsx("div",{className:"max-w-md mx-auto",children:n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:"text",placeholder:"Buscar artigos...",value:x,onChange:e=>m(e.target.value),className:"w-full px-4 py-3 pl-12 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),n.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-4",children:n.jsx("svg",{className:"h-5 w-5 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]})}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:k.map(e=>{return n.jsxs("article",{className:"bg-white rounded-lg shadow-lg overflow-hidden hover:shadow-xl transition-shadow duration-300 border border-gray-100",children:[e.featured_image?n.jsx(i,{src:e.featured_image,alt:e.title}):n.jsx("div",{className:"w-full h-48 bg-gradient-to-br from-gray-100 to-gray-200 flex items-center justify-center",children:n.jsx("svg",{className:"w-16 h-16 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),n.jsxs("div",{className:"p-6",children:[e.featured&&n.jsx("div",{className:"mb-3",children:n.jsx("span",{className:"inline-block bg-amber-100 text-amber-800 text-xs font-medium px-2.5 py-0.5 rounded-full",children:"Destaque"})}),n.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3 line-clamp-2",children:n.jsx("a",{href:"/blog/".concat(e.slug),className:"hover:text-blue-600 transition-colors",children:e.title})}),e.excerpt&&n.jsx("p",{className:"text-gray-600 mb-4 line-clamp-3",children:S(e.excerpt)}),n.jsx("div",{className:"flex items-center justify-between text-sm text-gray-500",children:n.jsxs("div",{className:"flex items-center space-x-4",children:[e.published_at&&n.jsx("time",{dateTime:e.published_at,children:(a=e.published_at,new Date(a).toLocaleDateString("pt-BR",{year:"numeric",month:"long",day:"numeric"}))}),e.reading_time&&n.jsxs("span",{children:[e.reading_time," min de leitura"]})]})}),e.tags&&e.tags.length>0&&n.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100",children:n.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.tags.slice(0,3).map((e,a)=>n.jsx("span",{className:"inline-block bg-gray-100 text-gray-600 text-xs px-2 py-1 rounded",children:e},a)),e.tags.length>3&&n.jsxs("span",{className:"text-xs text-gray-500",children:["+",e.tags.length-3," mais"]})]})})]})]},e.id);var a})}),r&&L>1&&n.jsxs("div",{className:"flex flex-col items-center pt-12 space-y-4",children:[n.jsxs("div",{className:"text-sm text-gray-600",children:["Mostrando ",w+1," - ",Math.min(N,h.length)," de ",h.length," artigo(s)"]}),n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx("button",{onClick:()=>C(u-1),disabled:1===u,className:"px-4 py-2 rounded-lg font-medium transition-all ".concat(1===u?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-white text-gray-700 border border-gray-300 hover:bg-gray-50 hover:border-blue-500"),children:"← Anterior"}),n.jsx("div",{className:"flex space-x-2",children:Array.from({length:L},(e,n)=>n+1).map(e=>{const a=1===e||e===L||e>=u-1&&e<=u+1;return 2===e&&u>3||e===L-1&&u<L-2?n.jsx("span",{className:"px-3 py-2 text-gray-400",children:"..."},e):a?n.jsx("button",{onClick:()=>C(e),className:"px-4 py-2 rounded-lg font-medium transition-all ".concat(u===e?"bg-blue-600 text-white shadow-md":"bg-white text-gray-700 border border-gray-300 hover:bg-gray-50 hover:border-blue-500"),children:e},e):null})}),n.jsx("button",{onClick:()=>C(u+1),disabled:u===L,className:"px-4 py-2 rounded-lg font-medium transition-all ".concat(u===L?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-white text-gray-700 border border-gray-300 hover:bg-gray-50 hover:border-blue-500"),children:"Próximo →"})]})]})]})},r=()=>n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-50 relative overflow-hidden",children:[n.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[n.jsx("style",{children:"\n @keyframes float-up {\n 0% {\n transform: translateY(100vh) scale(0);\n opacity: 0;\n }\n 10% {\n opacity: 0.6;\n }\n 90% {\n opacity: 0.6;\n }\n 100% {\n transform: translateY(-100vh) scale(1);\n opacity: 0;\n }\n }\n \n .bubble {\n position: absolute;\n border-radius: 50%;\n background: radial-gradient(circle at 30% 30%, rgba(147, 197, 253, 0.8), rgba(59, 130, 246, 0.4));\n box-shadow: 0 8px 16px rgba(59, 130, 246, 0.2);\n animation: float-up linear infinite;\n }\n \n .bubble:nth-child(1) {\n width: 45px;\n height: 45px;\n left: 10%;\n animation-duration: 15s;\n animation-delay: 0s;\n }\n \n .bubble:nth-child(2) {\n width: 60px;\n height: 60px;\n left: 25%;\n animation-duration: 18s;\n animation-delay: 2s;\n }\n \n .bubble:nth-child(3) {\n width: 55px;\n height: 55px;\n left: 45%;\n animation-duration: 20s;\n animation-delay: 4s;\n }\n \n .bubble:nth-child(4) {\n width: 50px;\n height: 50px;\n left: 65%;\n animation-duration: 17s;\n animation-delay: 1s;\n }\n \n .bubble:nth-child(5) {\n width: 65px;\n height: 65px;\n left: 80%;\n animation-duration: 19s;\n animation-delay: 3s;\n }\n \n .bubble:nth-child(6) {\n width: 40px;\n height: 40px;\n left: 15%;\n animation-duration: 16s;\n animation-delay: 5s;\n }\n \n .bubble:nth-child(7) {\n width: 55px;\n height: 55px;\n left: 35%;\n animation-duration: 21s;\n animation-delay: 2.5s;\n }\n \n .bubble:nth-child(8) {\n width: 60px;\n height: 60px;\n left: 55%;\n animation-duration: 18s;\n animation-delay: 4.5s;\n }\n \n .bubble:nth-child(9) {\n width: 50px;\n height: 50px;\n left: 75%;\n animation-duration: 22s;\n animation-delay: 1.5s;\n }\n \n .bubble:nth-child(10) {\n width: 65px;\n height: 65px;\n left: 90%;\n animation-duration: 19s;\n animation-delay: 3.5s;\n }\n \n .bubble:nth-child(11) {\n width: 45px;\n height: 45px;\n left: 5%;\n animation-duration: 17s;\n animation-delay: 6s;\n }\n \n .bubble:nth-child(12) {\n width: 55px;\n height: 55px;\n left: 20%;\n animation-duration: 20s;\n animation-delay: 1s;\n }\n \n .bubble:nth-child(13) {\n width: 60px;\n height: 60px;\n left: 30%;\n animation-duration: 16s;\n animation-delay: 4s;\n }\n \n .bubble:nth-child(14) {\n width: 50px;\n height: 50px;\n left: 50%;\n animation-duration: 19s;\n animation-delay: 2s;\n }\n \n .bubble:nth-child(15) {\n width: 45px;\n height: 45px;\n left: 60%;\n animation-duration: 21s;\n animation-delay: 5s;\n }\n \n .bubble:nth-child(16) {\n width: 65px;\n height: 65px;\n left: 70%;\n animation-duration: 18s;\n animation-delay: 3s;\n }\n \n .bubble:nth-child(17) {\n width: 55px;\n height: 55px;\n left: 85%;\n animation-duration: 22s;\n animation-delay: 1.5s;\n }\n \n .bubble:nth-child(18) {\n width: 50px;\n height: 50px;\n left: 95%;\n animation-duration: 17s;\n animation-delay: 4.5s;\n }\n \n .bubble:nth-child(19) {\n width: 40px;\n height: 40px;\n left: 12%;\n animation-duration: 20s;\n animation-delay: 2.5s;\n }\n \n .bubble:nth-child(20) {\n width: 60px;\n height: 60px;\n left: 40%;\n animation-duration: 19s;\n animation-delay: 5.5s;\n }\n "}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"}),n.jsx("div",{className:"bubble"})]}),n.jsx(t,{}),n.jsx("div",{className:"bg-white border-b border-gray-200 mt-28",children:n.jsx("div",{className:"container mx-auto px-4 py-4",children:n.jsx(s,{items:[{label:"Blog",href:"/blog"}]})})}),n.jsx("section",{className:"pt-16 pb-12 bg-white",children:n.jsx("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8",children:n.jsx("div",{className:"text-center",children:n.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-gray-900",children:["Blog ",n.jsx("span",{className:"text-blue-600",children:"WebPlan"})]})})})}),n.jsx("section",{className:"pb-20 bg-white",children:n.jsxs("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8",children:[n.jsxs("div",{className:"text-center mb-16",children:[n.jsxs("h2",{className:"text-3xl font-light text-gray-900 mb-4",children:["Artigos ",n.jsx("span",{className:"text-blue-600",children:"Recentes"})]}),n.jsx("div",{className:"w-16 h-1 bg-gradient-to-r from-blue-600 to-indigo-500 mx-auto rounded-full mb-6"}),n.jsx("p",{className:"text-gray-600 max-w-2xl mx-auto font-light",children:"Conteúdo especializado para auxiliar nas suas decisões sobre planos de saúde e benefícios corporativos."})]}),n.jsx(l,{title:"",description:"",showSearch:!0,showPagination:!0,limit:12})]})})]});export{r as default};