PageSourceSearch

https://www.infobae.com/pf/dist/components/combinations/legislativeSeats_module.chunk.js?d=4447&mxId=00000000

js infobae.com collected 2026-09-24 07:37:46 UTC 10,644 bytes, 1 lines download raw bytes

1"use strict";(this.webpackChunkFusion_components=this.webpackChunkFusion_components||[]).push([[639],{4173:function(e,t,s){s.r(t),s.d(t,{default:function(){return w}});var r=s(809),n=s(9894),o=s.n(n),i=s(8522),l=s(4766);const a=({automaticColumns:e=!0,columns:t={},data:s=[],showBodyTable:r=!0,showHeaderTable:n=!0,widthColumns:o={}})=>{if(!s.length||0===Object.keys(t).length||!n&&!r)return null;const{isMobile:a=!1,isTablet:c=!1}=(0,i.A)();const d=function(){const e=[];s.forEach(s=>{Object.keys(t).forEach(r=>{t[r].showRender?e.push(t[r].renderValue(s)):e.push(s[r])})});const r=[];return e.forEach((e,s)=>{s%Object.keys(t).length===0&&r.push([]),r[r.length-1].push(e)}),r}(),u=e=>`repeat(${Object.keys(t).length}, ${e})`,p=u(e&&a?"260px":"1fr"),h={gridTemplateColumns:e?p:(()=>{const{mobile:e="180px",tablet:t="1fr",desktop:s="1fr"}=o;return a?e:c?t:s})()};return(0,l.jsxs)("div",{className:"ctn-legislative-table",children:[n&&Object.keys(t).length?(0,l.jsx)("div",{className:"ctn-legislative-table-header",style:h,children:Object.values(t).map((e,t)=>(0,l.jsx)("span",{children:e.title||""},t))}):null,r&&d.length?(0,l.jsx)("div",{className:"ctn-legislative-table-body",children:d.map((e,t)=>(0,l.jsx)("div",{className:"ctn-legislative-table-body-row",style:h,children:e.map((e,t)=>(0,l.jsx)("span",{children:e||""},t))},t))}):null]})};a.propTypes={automaticColumns:o().bool,data:o().arrayOf(o().object),columns:o().objectOf(o().shape({title:o().string.isRequired,render:o().func})).isRequired,showHeaderTable:o().bool,showBodyTable:o().bool,widthColumns:o().object};var c=a,d=s(1700);const u=({options:e,placeholder:t,value:s,onChange:n})=>{const[o,i]=(0,r.useState)(s),[a,c]=(0,r.useState)(!1),d=(0,r.useRef)(null);(0,r.useEffect)(()=>{if("undefined"==typeof document||"undefined"==typeof window)return;i(s||null);const e=e=>{d.current&&!d.current.contains(e.target)&&c(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[s]);const u=()=>c(!a),p=e=>{i(e),n(e),c(!1)},h=o?"selected":"",f=a?"open":"",m=e=>o===e?"true":"false",v=e=>o===e?"selected":"";return(0,l.jsxs)("div",{className:"custom-dropdown",ref:d,children:[(0,l.jsxs)("button",{className:`dropdown-header ${h}`,onClick:u,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||u()},tabIndex:0,children:[(0,l.jsx)("span",{children:o||t}),(0,l.jsx)("span",{className:`arrow ${f}`})]}),a&&(0,l.jsx)("ul",{className:"dropdown-list",children:e.map((e,t)=>(0,l.jsx)("li",{className:v(e),onClick:()=>p(e),onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||p(e)},role:"option","aria-selected":m,tabIndex:0,children:e},t))})]})};u.propTypes={options:o().array.isRequired,placeholder:o().string,value:o().string,onChange:o().func.isRequired};var p=u;const h=({deputy:e=[],senator:t=[],setLegislativeData:s=()=>{},filterOne:n={},filterTwo:o={},filterThree:i={}})=>{const[a,c]=(0,r.useState)("deputy"),[d,u]=(0,r.useState)(""),[h,f]=(0,r.useState)(""),[m,v]=(0,r.useState)(""),[O,b]=(0,r.useState)(n[a]),[g,N]=(0,r.useState)(o[a]),[R,y]=(0,r.useState)(i[a]),j=(s,r)=>{const n="deputy"===a?e:t;let o;return"province"===s&&(o=n.filter(e=>e.PROVINCIA===r),y([...new Set(o.map(e=>e.BLOQUE))].sort())),"block"===s&&(o=n.filter(e=>e.BLOQUE===r),N([...new Set(o.map(e=>e.PROVINCIA))].sort())),R||g},w=(r,n)=>{const l="deputy"===a?e:t;let c=l;if(""!==h&&(c=c.filter(e=>e.PROVINCIA===h)),""!==m&&(c=c.filter(e=>e.BLOQUE===m)),"Ver todos"===r||"Ver todas"===r)return"fullName"===n?(u(""),N([...new Set(c.map(e=>e.PROVINCIA))].sort()),y([...new Set(c.map(e=>e.BLOQUE))].sort())):"province"===n?(u(""),f(""),y(i[a]),c=l.filter(e=>""===m||e.BLOQUE===m),b([...new Set(c.map(e=>e.APELLIDO_Y_NOMBRE))].sort())):"block"===n&&(u(""),v(""),N(o[a]),c=l.filter(e=>""===h||e.PROVINCIA===h),b([...new Set(c.map(e=>e.APELLIDO_Y_NOMBRE))].sort())),void s(c);"fullName"===n&&""!==r?(u(r),c=l.filter(e=>e.APELLIDO_Y_NOMBRE===r),y([...new Set(c.map(e=>e.BLOQUE))].sort()),N([...new Set(c.map(e=>e.PROVINCIA))].sort())):"province"===n&&""!==r?(u(""),f(r),c=l.filter(e=>e.PROVINCIA===r&&(""===m||e.BLOQUE===m)),j("province",r),b([...new Set(c.map(e=>e.APELLIDO_Y_NOMBRE))].sort())):"block"===n&&""!==r&&(u(""),v(r),c=l.f
1ilter(e=>e.BLOQUE===r&&(""===h||e.PROVINCIA===h)),j("block",r),b([...new Set(c.map(e=>e.APELLIDO_Y_NOMBRE))].sort())),s(c)},x=()=>{u(""),f(""),v(""),b(n[a]),N(o[a]),y(i[a]),s("deputy"===a?e:t)};return(0,r.useEffect)(()=>{b(n[a]),N(o[a]),y(i[a]),s("deputy"===a?e:t)},[a]),(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("div",{className:"legislative-filters",children:[(0,l.jsxs)("div",{className:"legislative-select-ctn",children:[(0,l.jsxs)("div",{className:"legislative-content-title-buttons",children:[(0,l.jsx)("button",{className:"legislative-content-title-button"+("deputy"===a?" active":""),onClick:()=>{c("deputy"),x()},children:"Diputados"}),(0,l.jsx)("button",{className:"legislative-content-title-button"+("senator"===a?" active":""),onClick:()=>{c("senator"),x()},children:"Senadores"})]}),(0,l.jsx)(p,{options:["Ver todos",...O],placeholder:"Nombre y Apellido",value:d,onChange:e=>w(e,"fullName")})]}),(0,l.jsx)("div",{className:"legislative-down-filters",children:(0,l.jsxs)("div",{className:"legislative-filters-ctn",children:[(0,l.jsx)(p,{options:["Ver todos",...g],placeholder:"Provincia",value:h,onChange:e=>w(e,"province")}),(0,l.jsx)(p,{options:["Ver todos",...R],placeholder:"Bloque",value:m,onChange:e=>w(e,"block")})]})})]})})},f=o().shape({ID:o().number.isRequired,TIPO:o().string.isRequired,APELLIDO_Y_NOMBRE:o().string.isRequired,PROVINCIA:o().string.isRequired,BLOQUE:o().string.isRequired,PERIODO:o().shape({INICIO:o().string.isRequired,FINAL:o().string.isRequired}).isRequired,MANDATO:o().string.isRequired,IMG_SLUG:o().string.isRequired,COLOR:o().string,HIDE:o().bool.isRequired}),m=o().shape({senator:o().arrayOf(o().string).isRequired,deputy:o().arrayOf(o().string).isRequired});h.propTypes={deputy:o().arrayOf(f).isRequired,senator:o().arrayOf(f).isRequired,filterOne:m.isRequired,filterTwo:m.isRequired,filterThree:m.isRequired,setLegislativeData:o().func};var v=h,O=s(7382),b=s(1445),g=s(6222);const N=({title:e,data:t})=>{const s=()=>{const e={},s={};t.forEach(t=>{const r=t.BLOQUE_ABREV,n=t.COLOR;e[r]?e[r]+=1:(e[r]=1,s[r]=n)});const r=[];for(const t in e)r.push({block:t,count:e[t],color:s[t]});return r.sort((e,t)=>t.count-e.count),(e=>e.sort((e,t)=>t.count-e.count).map((e,t)=>(0,l.jsxs)(O.qr,{className:"legislative-header-ctn-tags-item",style:{borderColor:e.color},children:[(0,l.jsx)("div",{className:"legislative-header-ctn-tags-icon",style:{backgroundColor:e.color}}),e.block,(0,l.jsxs)("span",{children:[" ",`(${e.count})`]})]},t)))(r)};return(0,l.jsxs)("div",{className:"legislative-header-ctn",children:[(0,l.jsx)("h2",{className:"legislative-header-ctn-title",children:e}),(0,l.jsxs)("div",{className:"legislative-header-ctn-tags",children:[(0,l.jsx)(g.Lm,{className:"next-arrow"}),(0,l.jsx)(O.RC,{modules:[b.Vx],spaceBetween:12,slidesPerView:"auto",navigation:{nextEl:".next-arrow",prevEl:".prev-arrow"},children:s()}),(0,l.jsx)(g._1,{className:"prev-arrow"})]})]})};N.propTypes={title:o().string.isRequired,data:o().arrayOf(o().object)};var R=N,y=s(5129);const j=e=>{const{overrides:{deputy:t={},senator:s={},showFilter:n=!1,showRepresentativesList:o=!1,showHeaderTable:i=!1,showBodyTable:a=!1,showTitle:u,title:p="Bancas en juego",positionColumnTwo:h="Provincia",positionColumnThree:f="Bloque",positionColumnFour:m="Mandato",positionColumnFive:O="Periodo",block:b={},fullName:g={},province:N={}}}=e||{};if(!n&&!o)return null;const[j,w]=(0,r.useState)(t),[x,E]=(0,r.useState)(6),[I,L]=(0,r.useState)(!0),[A,C]=(0,r.useState)(!1),k=(0,r.useRef)(null),B=(0,r.useRef)(null),P=Array.isArray(j)&&j.length<=6,T=P?"table-margin-bottom":"";return(0,r.useEffect)(()=>{if("undefined"==typeof window||!k.current)return;const e=k.current,t=()=>{if(!e)return;const{scrollLeft:t,scrollWidth:s,clientWidth:r}=e;C(t+r>=s-50)};return e&&e.addEventListener("scroll",t),()=>e?.removeEventListener("scroll",t)},[]),(0,l.jsxs)(l.Fragment,{children:[u&&p?(0,l.jsx)(R,{title:p,data:j}):null,(0,l.jsxs)("div",{className:"ctn-legislative-seats",children:[n?(0,l.jsx)("div",{className:"ctn-legislative-seats-filter",ref:B,children:(0,l.jsx)(v,{deputy:t,filterOne:g,filterThree:b,filterTwo:N,senator:s,setLegislativeData:w})}):null,(()=>{if(!o||!j?.length||!Array.isArray(j))return(0,l.jsx)(y.A,{className:"not-found"});const e="130px",t="1fr",s={APELLIDO_Y_NOMBRE:{title:"Nombre y Apellido",showRender:!0,renderValue:({APELLIDO_Y_NOMBRE:e="",COLOR:t=""})=>((e="",t="")=>{if(!e)return null;const s=j.find(({APELLIDO_Y_NOMBRE:t=""})=>t===e),{IMG_SLUG:r="",APELLIDO_Y_NOMBRE:n=""}=s||{},o=t.length?{border:`2px solid ${t}`}:{};return(0,l.jsxs)("div",{className:"ctn-person",children:[(0,l.jsx)("img",{alt:"vote-img",className:"law-profile-vote-image",style:o,onError:e=>{e.target.src=d},src:r,decoding:"async",loading:"lazy"}),(0,l.jsx)("h3",{children:n})]})})(e,t),fractionMobile:"200px",fractionTablet:"2fr",fractionDesktop:"280px"},PROVINCIA:{title:"Provincia",fractionMobile:e,fractionTablet:t,fractionDesktop:t},BLOQUE:{title:"Bloque",fractionMobile:e,fractionTablet:t,fractionDesktop:t},MANDATO:{title:"Mandato",showRender:!0,renderValue:({MANDATO:e="-"})=>`${e}`,fractionMobile:e,fractionTablet:t,fractionDesktop:t},PERIODO:{title:"Periodo",showRender:!0,renderValue:({PERIODO:{INICIO:e=0,FINAL:t=0}})=>`${e} - ${t}  `,fractionMobile:e,fractionTablet:t,fractionDesktop:t}},r=(()=>{let e="",t="",r="";
1return Object.values(s).forEach(({fractionMobile:s="",fractionTablet:n="",fractionDesktop:o=""})=>{e+=`${s} `,t+=`${n} `,r+=`${o} `}),{mobile:e,tablet:t,desktop:r}})(),n=function(e){const t={"Nombre y Apellido":"APELLIDO_Y_NOMBRE",Provincia:"PROVINCIA",Bloque:"BLOQUE",Mandato:"MANDATO",Periodo:"PERIODO"};return["Nombre y Apellido",h,f,m,O].filter(Boolean).map(e=>t[e]).filter(Boolean).reduce((t,s)=>(e[s]&&(t[s]=e[s]),t),{})}(s);return(0,l.jsxs)("div",{className:"ctn-legislative-seats-wrapper",children:[(0,l.jsx)("div",{className:`ctn-legislative-seats-table ${T}`,ref:k,children:(0,l.jsx)(c,{automaticColumns:!1,columns:n,data:j.slice(0,x),showBodyTable:a,showHeaderTable:i,widthColumns:r})}),!A&&(0,l.jsx)("div",{className:"linear-gradient"})]})})(),(()=>{if(P)return null;const e=I?"Ver más +":"Ver menos -",t=j.length>6&&!I?6:j.length;return(0,l.jsx)("div",{className:"ctn-view-more",children:(0,l.jsx)("button",{type:"button",className:"btn-view-more",onClick:()=>{L(!I),E(t),!I&&B.current&&B.current.scrollIntoView({behavior:"smooth",block:"center"})},children:e})})})()]})]})};j.propTypes={overrides:o().shape({})};var w=j}}]);

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.