import './polyfills.server.mjs';
import{a as B,b as P,c as A,d as D}from"./chunk-LJLOR3MX.mjs";import{a as I}from"./chunk-MGWD4USB.mjs";import{a as N}from"./chunk-25AU5SIR.mjs";import"./chunk-JNG7LRGD.mjs";import{a as S}from"./chunk-AK2QP2SK.mjs";import"./chunk-Q4ZNTDLA.mjs";import"./chunk-PEXQ6CP4.mjs";import{E as c,H as u,Ha as p,Ja as _,Pa as d,Qa as g,Ra as m,Sb as L,T as o,Wb as M,Y as v,aa as h,ka as f,la as y,ma as b,na as l,oa as a,pa as s,qa as E,s as r,xa as x,xb as F,za as C}from"./chunk-I24PFG4Z.mjs";import"./chunk-N7QBYMCK.mjs";var j=()=>["/"],W=t=>({name:"P\xE1gina Inicial",route:t}),R=()=>({name:"Eventos"}),T=(t,e)=>[t,e],w=()=>[],O=(t,e)=>({visible:t,label:"Carregar mais eventos",route:e}),q=t=>({"!border-(color:--primary) !text-(color:--primary)":t}),U=t=>[t];function G(t,e){if(t&1&&(a(0,"div",12)(1,"a",13),p(2),s()()),t&2){let i=e.$implicit,n=C();o(),l("ngClass",g(3,q,n.selectedCategory()&&n.selectedCategory()==i.slug))("routerLink",g(5,U,"/events/category/"+i.slug)),o(),_(" ",i.name," ")}}var k=class t extends N{eventFacade=r(P);categoryFacade=r(D);locationFacade=r(A);activatedRoute=r(L);categories=c([]);locations=c([]);events=c([]);selectedCategory=c(void 0);ngOnInit(){this.getCategories(),this.getLocations(),this.activatedRoute.paramMap.subscribe(e=>{let i=e.get("category");this.isLoadingEvents.set(!0),this.events.set([]),i?(this.selectedCategory.set(i),this.getEventsByCategory(i)):(this.selectedCategory.set(void 0),this.getEvents())})}loadMoreEvents(){this.hasLoadMoreButtonAppear()&&(this.currentPage.update(e=>e+1),this.selectedCategory()?this.getEventsByCategory(this.selectedCategory(),this.currentPage()):this.getEvents(this.currentPage()))}getCategories(){this.categoryFacade.all().subscribe(e=>this.categories.set(e))}getLocations(){this.locationFacade.all().subscribe(e=>this.locations.set(e))}getEvents(e=this.currentPage()){this.isLoadingEvents.set(!0),this.eventFacade.latest(e,this.limit()).subscribe({next:i=>{i.next_page_url!==null?this.hasLoadMoreButtonAppear.set(!0):this.hasLoadMoreButtonAppear.set(!1),this.events.set([...this.events(),...i.data]),this.isLoadingEvents.set(!1)}})}getEventsByCategory(e,i=this.currentPage()){this.isLoadingEvents.set(!0),this.eventFacade.byCategory(e,i,this.limit()).subscribe({next:n=>{n.next_page_url!==null?this.hasLoadMoreButtonAppear.set(!0):this.hasLoadMoreButtonAppear.set(!1),this.events.set([...this.events(),...n.data]),this.isLoadingEvents.set(!1)}})}static \u0275fac=(()=>{let e;return function(n){return(e||(e=u(t)))(n||t)}})();static \u0275cmp=v({type:t,selectors:[["app-events"]],features:[h],decls:17,vars:19,consts:[[1,"section-container"],[3,"breadcrumbs"],[1,"!font-['Unigeo']","font-semibold","text-3xl","leading-[120%]","tracking-[0%]"],[3,"categories","locations"],[3,"loadMoreEventsEmmiter","isLoading","limit","paginated","button","events"],["ngProjectAs","section-header",5,["section-header"],1,"section-header","flex","flex-col","gap-[50px]"],[1,"content","flex","flex-col","gap-12"],[1,"title","text-center","flex","flex-col","items-center","gap-2"],[1,"text-base","xl:text-xl","!font-['Montserrat']"],[1,"font-semibold","text-2xl","xl:max-w-[550px]","xl:text-4xl","!font-['Unigeo']"],[1,"events-categories"],[1,"categories","flex","flex-wrap","gap-2","justify-center","items-center"],[1,"category"],[1,"text-sm","!font-['Montserrat']","block","w-fit","px-7","py-3","border-[0.5px]","rounded-full","duration-[.6s]","border-[#020B26]","text-[#020B26]","hover:border-(color:--primary)","hover:text-(color:--primary)",3,"ngClass","routerLink"]],template:function(i,n){i&1&&(a(0,"div",0)(1,"app-page-head",1)(2,"h1",2),p(3," Acompanhe todos os eventos que temos para si "),s()(),E(4,"app-search",3),a(5,"app-events-displayer",4),x("loadMoreEventsEmmiter",function(){return n.loadMoreEvents()}),a(6,"div",5)(7,"div",6)(8,"div",7)(9,"h6",8),p(10," Eventos "),s(),a(11,"h1",9),p(12," Garanta j\xE1 o seu lugar no evento que mais combina com voc\xEA! "),s()()(),a(13,"div",10)(14,"div",11),y(15,G,3,7,"div",12,f),s()()()()()),i&2&&(o(),l("breadcrumbs",m(12,T,g(9,W,d(8,j)),d(11,R))),o(3),l("categories",n.categories())("locations",n.locations()),o(),l("isLoading",n.isLoadingEvents())("limit",n.limit())("paginated",!0)("button",m(16,O,n.hasLoadMoreButtonAppear(),d(15,w)))("events",n.events()),o(10),b(n.categories()))},dependencies:[M,I,B,S,F],encapsulation:2})};export{k as EventsComponent};
