!function(){"use strict";try{if("undefined"!=typeof document){var _=document.createElement("style");_.appendChild(document.createTextNode("._blog_1xp12_1{grid-gap:var(--gap-size)var(--half-gap-size);grid-template-columns:repeat(auto-fill,minmax(265px,1fr));display:grid}._paginate_1xp12_7{align-items:center;margin-top:2rem;display:flex}@media screen and (max-width:1023px){._paginate_1xp12_7 ._pageItem_1xp12_13:not(:-webkit-any(._previous_1xp12_13,._next_1xp12_13)){display:none}._paginate_1xp12_7 ._pageItem_1xp12_13:not(:-moz-any(._previous_1xp12_13,._next_1xp12_13)){display:none}._paginate_1xp12_7 ._pageItem_1xp12_13:not(:is(._previous_1xp12_13,._next_1xp12_13)){display:none}}._paginate_1xp12_7 ._pageItem_1xp12_13{cursor:pointer}._paginate_1xp12_7 ._pageItem_1xp12_13 ._pageItemLink_1xp12_20,._paginate_1xp12_7 ._pageItem_1xp12_13._previous_1xp12_13 a,._paginate_1xp12_7 ._pageItem_1xp12_13._next_1xp12_13 a{border:1px solid var(--primary-color);border-radius:min(var(--button-border-radius),var(--border-radius));color:var(--primary-color);padding:10px;font-weight:700;transition:all .25s}._paginate_1xp12_7 ._pageItem_1xp12_13._disabledItemPage_1xp12_28{cursor:default;filter:grayscale();opacity:.5}._paginate_1xp12_7 ._pageItem_1xp12_13:not(._paginate_1xp12_7 ._pageItem_1xp12_13:-webkit-any(._previous_1xp12_13,._next_1xp12_13)) ._pageItemLink_1xp12_20{aspect-ratio:1;place-items:center;width:40px;margin-inline-start:.5rem;margin-inline-end:.5rem;display:grid}._paginate_1xp12_7 ._pageItem_1xp12_13:not(._paginate_1xp12_7 ._pageItem_1xp12_13:-moz-any(._previous_1xp12_13,._next_1xp12_13)) ._pageItemLink_1xp12_20{aspect-ratio:1;place-items:center;width:40px;margin-inline-start:.5rem;margin-inline-end:.5rem;display:grid}._paginate_1xp12_7 ._pageItem_1xp12_13:not(._paginate_1xp12_7 ._pageItem_1xp12_13:is(._previous_1xp12_13,._next_1xp12_13)) ._pageItemLink_1xp12_20{aspect-ratio:1;place-items:center;width:40px;margin-inline-start:.5rem;margin-inline-end:.5rem;display:grid}._paginate_1xp12_7 ._pageItem_1xp12_13:not(._active_1xp12_40) ._pageItemLink_1xp12_20:hover{background-color:var(--primary-background);opacity:.75;color:#fff}._paginate_1xp12_7 ._pageItem_1xp12_13:-webkit-any(._previous_1xp12_13,._next_1xp12_13):not(._disabledItemPage_1xp12_28) a:hover{background-color:var(--primary-background);opacity:.75;color:#fff}._paginate_1xp12_7 ._pageItem_1xp12_13:-moz-any(._previous_1xp12_13,._next_1xp12_13):not(._disabledItemPage_1xp12_28) a:hover{background-color:var(--primary-background);opacity:.75;color:#fff}._paginate_1xp12_7 ._pageItem_1xp12_13:is(._previous_1xp12_13,._next_1xp12_13):not(._disabledItemPage_1xp12_28) a:hover{background-color:var(--primary-background);opacity:.75;color:#fff}._paginate_1xp12_7 ._pageItem_1xp12_13._active_1xp12_40 ._pageItemLink_1xp12_20{background-color:var(--primary-color);color:#fff}._paginate_1xp12_7 ._pageItem_1xp12_13._previous_1xp12_13{margin-right:auto}._paginate_1xp12_7 ._pageItem_1xp12_13._next_1xp12_13{margin-left:auto}._currentPageInfo_1xp12_56{text-align:center;color:var(--paragraph-color);margin-top:calc(-10px - .5rem);display:block}@media screen and (min-width:1024px){._currentPageInfo_1xp12_56{display:none}}._form_xc3kt_1{gap:1rem;padding-bottom:1rem;display:flex}@media screen and (max-width:559px){._form_xc3kt_1{flex-direction:column}}._form_xc3kt_1 ._input_xc3kt_11{border:1px solid var(--separator-color);border-radius:var(--button-border-radius);color:var(--paragraph-color);width:100%;padding:.75rem}._form_xc3kt_1 ._button_xc3kt_18{padding-inline-start:4rem;padding-inline-end:4rem}")),document.head.appendChild(_)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}}();
import{p as e,j as a,n as s,y as t,z as r,r as l,v as n,A as o,F as i}from"./modal-DHjdkE9t.js";import{R as c}from"./react-paginate-DDi4CSkI.js";import{B as p}from"./BlogPostCard-Bqb-OWEC.js";const g="_blog_1xp12_1",m="_paginate_1xp12_7",_="_pageItem_1xp12_13",u="_previous_1xp12_13",d="_next_1xp12_13",x="_pageItemLink_1xp12_20",h="_disabledItemPage_1xp12_28",v="_active_1xp12_40",P="_currentPageInfo_1xp12_56",b=({itemsPerPage:t,posts:r=Array(t).fill(null),totalPosts:l=t,currentPage:n=1,currentPageSetter:o})=>{const i=Math.ceil(l/t),{realEstateData:b}=e();return a.jsxs("div",{children:[a.jsx("div",{className:g,children:r.map(((e,s)=>a.jsx(p,{post:e??void 0,target:b.styling.verticalCards.openCardLinkInNewTab?"_blank":void 0},s)))}),a.jsx(c,{onPageChange:e=>o(e.selected),pageCount:i,pageRangeDisplayed:8,marginPagesDisplayed:1,breakLabel:"...",previousLabel:"Anterior",nextLabel:"Próximo",className:m,pageClassName:_,pageLinkClassName:x,breakClassName:_,breakLinkClassName:x,previousClassName:s(_,u),nextClassName:s(_,d),activeClassName:v,disabledClassName:h}),a.jsxs("span",{className:P,children:[n+1," de ",i]})]})},j="_form_xc3kt_1",f="_input_xc3kt_11",N="_button_xc3kt_18",C=({setSearch:e})=>{const[s]=t(),o=r(),[i,c]=l.useState("");return l.useEffect((()=>{c(s.get("search")??"")}),[s]),a.jsx("div",{children:a.jsxs("form",{onSubmit:a=>{a.preventDefault(),e(i),o({pathname:"/blog",search:`?search=${i}`})},className:j,children:[a.jsx("input",{className:f,type:"text",placeholder:"Buscar no blog",name:"search",value:i,onChange:e=>c(e.currentTarget.value)}),a.jsx(n,{type:"submit",className:N,children:"Buscar"})]})})},k=()=>{const[e]=t(),[s,r]=l.useState(0),[n,c]=l.useState(),[p,g]=l.useState(e.get("search")??""),{jetimobData:m}=o("/real-estate-data/blog",{page:s.toString(),itemsPerPage:36..toString(),search:p},{suspense:!1,focusThrottleInterval:6e5});return l.useEffect((()=>{(null==m?void 0:m.posts)&&c(m.totalPosts)}),[m,p]),l.useEffect((()=>{g(e.get("search")??"")}),[e]),a.jsxs("div",{className:"container",children:[a.jsx(i,{title:"Blog",HTMLTag:"h1"}),a.jsx(C,{setSearch:g}),a.jsx(b,{totalPosts:n,posts:null==m?void 0:m.posts,itemsPerPage:36,currentPage:s,currentPageSetter:r})]})};export{k as default};