@vlci/cdmvalencia_ahir 4.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/js/inicio.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.inicio=t():e.inicio=t()}(self,()=>(()=>{var e={725(e){var t;self,t=()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MONTHS_YEAR:()=>r,MONTHS_YEAR_SHORT:()=>i,TEXTS_COMMON:()=>s,THRESHOLDS:()=>De,addPointInteger:()=>v,buildCamarasTrafico:()=>Te,buildTableCalidadAire:()=>Ne,calculateMaxYAxis:()=>T,calculatePentahoPath:()=>$e,calculateXAxisStart:()=>_,capitalizarTexto:()=>x,checkAllGroupsCollapsed:()=>Ee,configureDataBar:()=>k,configureDataGaugeCommon:()=>B,configureDataGaugeMonthCommon:()=>z,configureDataLine:()=>W,configureDataValidate:()=>Ge,configureLinesChartValidates:()=>Ye,convertDateToInteger:()=>y,convertISODateToEUDate:()=>S,convertToLanguageSelectorDateRange:()=>ue,convertToTableTreeView:()=>ve,downloadCSVTable:()=>Ae,downloadPDFTable:()=>Ce,formatCellMultiplesLines:()=>ge,formatDayMonthYear:()=>u,formatMilMillionEuros:()=>I,formatMonthAnyo:()=>d,formatName:()=>M,formatNameHeaderColumn:()=>be,formatRoundTooltip:()=>F,formatShortMonthShortYear:()=>f,formatShortMonthYear:()=>m,formatToMillions:()=>E,formatToTons:()=>A,formatTooltip:()=>L,formatTooltipPie:()=>O,formatTrimestre:()=>p,formatWithPrefix:()=>C,getEnvironment:()=>we,getMaxFieldNumberFromData:()=>J,getMonth:()=>a,getMonthList:()=>h,getSelectCommonOptions:()=>re,getSelectTwoColumnsOptions:()=>ie,initBarChart:()=>Be,initBarChartComparationMonth:()=>ke,initChart:()=>N,initContractAllGroups:()=>Me,initElement:()=>D,initExpandAllGroups:()=>xe,initStackedBarChart:()=>Ie,initStackedBarChartMonthSeries:()=>je,initTable:()=>he,initValueDefaultDate:()=>ce,initialCalls:()=>_e,loadIframeOnClickEvent:()=>Ve,printDataChart:()=>w,printDataInHTMLElements:()=>H,printEchart:()=>P,printNoDataChart:()=>$,resetFilter:()=>ae,resetFilterAndUpdate:()=>pe,resetFilterDate:()=>le,resetFilterDates:()=>se,resetFilterToDefault:()=>me,resultsetWithFields:()=>V,selectConfigDatasource:()=>ne,selectConfigDatasourceAllValue:()=>oe,selectFilterAll:()=>ee,selectFilterNumItemsDefault:()=>fe,selectValueDefaultInFilter:()=>de,separateDayMonthYearToSlash:()=>l,splitDataset:()=>Y,subtractOneDay:()=>b,subtractOneMonth:()=>g,traverseRows:()=>Se,updateDomElement:()=>G,updateObject:()=>q,updateStackedBarOptions:()=>Pe});const n="es_ES",o=(new Map([["1","Enero"],["2","Febrero"],["3","Marzo"],["4","Abril"],["5","Mayo"],["6","Junio"],["7","Julio"],["8","Agosto"],["9","Septiembre"],["10","Octubre"],["11","Noviembre"],["12","Diciembre"]]),new Map([["1","Gener"],["2","Febrer"],["3","Març"],["4","Abril"],["5","Maig"],["6","Juny"],["7","Juliol"],["8","Agost"],["9","Setembre"],["10","Octubre"],["11","Novembre"],["12","Desembre"]]),{"01":"Enero","02":"Febrero","03":"Marzo","04":"Abril","05":"Mayo","06":"Junio","07":"Julio","08":"Agosto","09":"Septiembre",10:"Octubre",11:"Noviembre",12:"Diciembre"});function a(e){return{1:"Gen",2:"Feb",3:"Mar",4:"Abr",5:"Mai",6:"Jun",7:"Jul",8:"Ago",9:"Sep",10:"Oct",11:"Nov",12:"Des"}[parseInt(e.toString(),10)]}const r={es_ES:new Map([["1","Enero"],["2","Febrero"],["3","Marzo"],["4","Abril"],["5","Mayo"],["6","Junio"],["7","Julio"],["8","Agosto"],["9","Septiembre"],["10","Octubre"],["11","Noviembre"],["12","Diciembre"]]),ca_ES:new Map([["1","Gener"],["2","Febrer"],["3","Març"],["4","Abril"],["5","Maig"],["6","Juny"],["7","Juliol"],["8","Agost"],["9","Setembre"],["10","Octubre"],["11","Novembre"],["12","Desembre"]])},i={es_ES:new Map([["1","Ene"],["2","Feb"],["3","Mar"],["4","Abr"],["5","May"],["6","Jun"],["7","Jul"],["8","Ago"],["9","Sep"],["10","Oct"],["11","Nov"],["12","Dic"]]),ca_ES:new Map([["1","Gen"],["2","Feb"],["3","Mar"],["4","Abr"],["5","Mai"],["6","Jun"],["7","Jul"],["8","Ago"],["9","Set"],["10","Oct"],["11","Nov"],["12","Des"]])},s={es_ES:new Map([["last_update","Última actualización"]]),ca_ES:new Map([["last_update","Última actualització"]])};function l(e){return`${e.substring(6,8)}/${e.substring(4,6)}/${e.substring(0,4)}`}function c(e){return[e.substring(0,4),o[e.substring(4,6)]]}function d(e){const[t,n]=c(e);return`${n} ${t}`}function u(e){const[t,n,a]=function(e){return[e.substring(0,4),o[e.substring(4,6)],e.substring(6,8)]}(e);return`${a} ${n} ${t}`}function m(e){const[t,n]=c(e);return`${n.substring(0,3)} ${t}`}function f(e){const[t,n]=c(e);return`${n.substring(0,3)} '${t.substring(2,4)}`}function p(e){const[t,n]=e.split("-");return`${parseFloat(n)/3}T ${t}`}function h(){const e=r[n];return Array.from(e.values()).map(e=>e.slice(0,3))}function b(e){const t=Math.floor(e/1e4),n=new Date(t,e%1e4/100-1,e%100);return n.setDate(n.getDate()-1),`${n.getFullYear()}${(n.getMonth()+1).toString().padStart(2,"0")}${n.getDate().toString().padStart(2,"0")}`}function g(e){const t=new Date(Math.floor(e/100),e%100-1,0);return`${t.getFullYear()}${(t.getMonth()+1).toString().padStart(2,"0")}`}function y(e){return"string"==typeof e?parseInt(e.replace("-",""),10):e}function S(e){if(!e||"string"!=typeof e)return"";const[t,n,o]=e.split("-");return`${o}/${n}/${t}`}function v(e,t=2){let n=navigator.language||navigator.userLanguage;n=n.length<=2?`${n}-${n.toUpperCase()}`:n;const o={minimumFractionDigits:0,maximumFractionDigits:t};return"es-ES"===n?e.toLocaleString("de-DE",o):e.toLocaleString(n,o)}function E(e){const t=1e6;return e>=t?e/t+"M":e.toString()}function A(e){return e>=1e3?e/1e3+" Tn":e.toString()}function C(e){let t,n;return e>=1e6?(t=e/1e6,n="G"):e>=1e3?(t=e/1e3,n="M"):(t=e,n="k"),{value:Math.round(100*t)/100,prefix:n}}function M(e,t=29){if(e.length>=t){const n=e.split(" ");let o="",a="";return n.forEach(e=>{`${o} ${e}`.length<=t?o+=(o?" ":"")+e:(a+=`${o}\n`,o=e)}),a+=o,a}return e}function x(e){return e.includes("N/D")?e:e.toLowerCase().replace(/(^|\s|[.,;:!?¡¿(){}[\]])([^\s])/gu,(e,t,n)=>t+n[0].toUpperCase())}function D(e,t,n="MainContentLoadedCustom"){let o=document.getElementById(e);return o?Promise.resolve(t(o)):new Promise(a=>{document.body.addEventListener(n,()=>{o=document.getElementById(e),o?a(t(o)):(console.error(`El elemento con ID ${e} aún no está disponible después del evento.`),a(null))})})}function N(e,t){return D(e,e=>{const n=echarts.init(e);n.setOption(t,!0),window.addEventListener("resize",()=>{null!=n&&void 0!==n&&n.resize()});const o=document.getElementById("main-content");return o&&(o.addEventListener("shown.bs.collapse",()=>{n.resize()}),o.addEventListener("hidden.bs.collapse",()=>{n.resize()})),n})}function $(e,t){const n=e?document.querySelector(e):null,o=t?document.querySelector(t):null;n&&(n.hidden=!0),o&&(o.style.background="url('./build/images/nodata1.png') no-repeat top center",o.hidden=!1)}function w(e,t){const n=e?document.querySelector(e):null,o=t?document.querySelector(t):null;n&&(n.hidden=!0),o&&(o.style.background="#ffffff",o.hidden=!1)}function L(e,t=!1,n=!0,o=""){let a=`<p style="font-weight: 500;color: #565656;">${e[0].name}</p>`;return e.forEach(e=>{const r=t?Math.round(e.data):e.data,i=n?`<div style="font-weight: 400;color: #666;">${s=e.color,`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;font-weight: 500;background-color:${s}"></span>`} ${e.seriesName}: \n <span style="float: right; margin-left:20px;font-weight: 600;color: #565656;">\n ${e.data?`${v(r)} ${o}`:"-"}\n </span>\n </div>`:`<div>\n <span style="font-weight: 600;color: #565656;">${e.data?`${v(r)} ${o}`:"-"}\n </span>\n </div>`;var s;a+=i}),a}function _(e){return 100*(e-120)/e}function T(e,t){const n=Math.max(...e);return n+(t-n%t)}function O(e,t=!1){const n=`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:${e.color}"></span>`,o=t?`${e.percent}%`:v(e.value);return`<div> ${n} ${e.name} <span style="float: right; margin-left:20px;font-weight: 600;color: #333;"> ${o} </span></div>`}function F(e,t){let n=`${e.name} : `;return n+=`<span style="font-weight:500">${v(Math.round(e.value))}</span>`,t&&(n+=`<span> (${e.percent}%)</span>`),e.marker+n}function I(e){const t=1e6,n=Number(e);return n>=0&&n<t?`${v(n)} €`:n>=t?`${v(n/t)} M €`:"-"}function P(e,t,n){return 0===e.length?($(`#${t}`,`#${n}`),!1):(w(`#${n}`,`#${t}`),!0)}function j(e,t,n=1){const o=Math.max(...e.map(e=>e[t]))*n;return 5e3*Math.ceil(o/5e3)}function B(e,t,n,o=30,a=15,r=30,i=-70,s=70,l=3){const c=j(e,t.data,1.1),d=s,u=n.slice(),m=[];let f=a,p=r,h=i;for(let n=0;n<e.length;n+=1)m.push({value:e[n][t.data],name:M(String(e[n][t.type]).replace(/\[.*?\]/g,"")),color:u.shift(),title:{offsetCenter:[`${String(h)}%`,`${String(f)}%`],fontFamily:"Montserrat",fontSize:o},detail:{offsetCenter:[`${String(h)}%`,`${String(p)}%`],fontFamily:"Montserrat",width:"33%",formatter:e=>v(Math.round(e))}}),h+=d,(n+1)%l===0&&(p+=r,f+=2*a,h=i);return[c,m]}function z(e,t,n,o=0){return[j(t,n.data,1),e=>function(e,t,n){const o=v(Math.round(t)),r=a(e[n][0]),i=e[n][1],s=`\n${r} ${i} : ${o}`,l=`${o}\n${r} ${i}`;return window.innerWidth<=1710?s:l}(t,e,o),[{value:t[o][n.data]}]]}function R(e,t){const{resultset:n}={resultset:e},o=new Set,a=new Set,r=n.map(([e,n,r])=>{const i=t?Math.round(r):r;return o.add(e),a.add(n),{day:n,type:e,value:i}}),i=Array.from(a.values()),s=Array.from(o.values());return s.sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase(),"es",{ignorePunctuation:!0})),[s.map(e=>{const t=r.filter(t=>t.type===e).map(({day:t,value:n})=>[t,e,n]),n=i.map(e=>{const n=t.find(([t])=>t===e);return n?n[2]:null});return{name:e,data:n}}),s,a]}function W(e,t=[],n=!1){const[o,a,r]=R(e,n);return o.forEach(e=>{e.type="line",e.symbol="circle",e.symbolSize=6,e.smooth=.1,t.length>0&&(e.color=t.shift())}),[o,r,a]}function k(e,t,n=!1){const[o,a,r]=R(e,n);return o.forEach(e=>{e.type="bar",e.color=t.shift(),e.smooth=!1}),[o,r,a]}function V(e){const{resultset:t,metadata:n}=e,o=[];return t.forEach(e=>{const t={};e.forEach((e,o)=>{t[n[o].colName]=e}),o.push(t)}),o}function q(e,t){const n={...e};return Object.keys(t).forEach(o=>{Object.prototype.hasOwnProperty.call(t,o)&&("series"===o&&Array.isArray(t[o])?n[o]=t[o].map((t,n)=>({...Array.isArray(e[o])&&e[o][n]||{},...t})):"object"!=typeof t[o]||null===t[o]||Array.isArray(t[o])?e[o]!==t[o]&&(n[o]=t[o]):n[o]=q(e[o]||{},t[o]))}),n}function H(e,t){const n=()=>{e.forEach(e=>{e.id in t&&Object.entries(t[e.id]).forEach(n=>{const o=n[0],a=n[1];"object"==typeof a?a.className?document.querySelector(a.className).className=e[o]:a.element&&a.format&&(document.querySelector(a.element).textContent=t[e.id][o].format(e[o])):document.querySelector(a).textContent=e[o]})})};try{n()}catch(e){document.body.addEventListener("MainContentLoadedCustom",()=>{n()})}}function J(e,t){const n=V(e),o=[];let a=null;return n.forEach(e=>{const n=e[t];"number"!=typeof n||Number.isNaN(n)||o.push(n)}),o.length>0&&(a=Math.max(...o)),a}function G(e,t){const n=document.querySelector(e);n?n.textContent=t:console.warn(`Elemento ${e} no encontrado en el DOM`)}function Y(e,t=!0){const n={Cont:[],Mob:[]};return e.forEach(e=>{"is-res-001-kgs-contenidors"===e[0]&&"total"===e[1]&&(t?n.Cont.push([e[3],e[4],e[2]]):n.Cont.push([e[3],e[2]])),"Mobles"===e[1]&&(t?n.Mob.push([e[3],e[4],e[2]]):n.Mob.push([e[3],e[2]]))}),n}const U=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],X=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],Z=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],K=["Dom","Lun","Mar","Mié","Juv","Vie","Sáb"],Q=["Do","Lu","Ma","Mi","Ju","Vi","Sá"];function ee(e){const t=e.resultset.map(e=>e[0]);return this.dashboard.fireChange(this.parameter,t),e}function te(e){for(const t of e)if(Array.isArray(t)){if(!te(t))return!1}else if("All"!==t)return!1;return!0}function ne(e,t,n,o){return te(t)?(e.queryDefinition.dataAccessId=n,e.dashboard.setParameter(e.parameter,["All"])):e.queryDefinition.dataAccessId=o,!0}function oe(e){return e.dashboard.setParameter(e.parameter,["All"]),!0}function ae(e){e.forEach(e=>{Dashboards.fireChange(e,["All"])})}function re(e="Todos"){return{input:{root:{id:"All"},indexes:{id:0,label:0}},component:{Root:{strings:{isDisabled:"No disponible",allItems:e,noItems:"Ninguno",btnApply:"Aceptar",btnCancel:"Cancelar"}},Group:{Strings:{allItems:"Todos",noItems:"Ninguno",btnApply:"Aceptar",btnCancel:"Cancelar"}}}}}function ie(e="Todos"){const t=re(e);return t.input.indexes.id=1,t.input.indexes.label=0,t}function se(e,t,n,o){const a=Dashboards.getParameterValue(n),r=Dashboards.getParameterValue(o);return Dashboards.fireChange(e,[a]),Dashboards.fireChange(t,[r]),!0}function le(e,t){const n=Dashboards.getParameterValue(t);return Dashboards.fireChange(e,[n]),!0}function ce(e,t){Dashboards.fireChange(t,e.resultset[0][0])}function de(e,t){const n=Dashboards.getParameterValue(t),o=e.parameter;""!==n&&e.dashboard.setParameter(o,[n])}function ue(e){e.regional.es={monthNames:U,abbreviatedMonthNames:X,dayNames:Z,abbreviatedDayNames:K,dayNamesMin:Q,weekHeader:"Sm",firstDay:1,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},e.setDefaults(e.regional.es)}function me(e,t){const n=Dashboards.getParameterValue(t);return Dashboards.fireChange(e,Array.isArray(n)?n:[n]),!0}function fe(e,t,n,o=0){const a=e.resultset.slice(0,n).map(e=>e[o]);return Dashboards.setParameter(t,a),e}function pe(e,t,n){const o=Array.isArray(t)?t:[t];Dashboards.fireChange(e,o);const a=Dashboards.getComponent(n);a&&a.update()}function he(e,t){return D(e,e=>new Tabulator(e,t))}function be(e,t){let n=e.getValue();return n.length>t&&(n=`${n.substr(0,t)}<br>${n.substr(t)}`),n}function ge(e,t){const n=e.getValue().split(" ");let o="",a="";return n.forEach(e=>{(a+e).length<=t?a+=`${e} `:(o+=`${a}<br>`,a=`${e} `)}),o+=`${a}<br>`,o}function ye(e,t){"expand"===t?e.treeExpand():e.treeCollapse();const n=e.getTreeChildren();n.length>0&&n.forEach(e=>{e.getTreeChildren().length>0&&ye(e,t)})}function Se(e,t){e.getRows().forEach(e=>{e.getTreeChildren().length>0&&ye(e,t)})}function ve(e,t,n,o){const a=[];return Object.keys(e).forEach(r=>{if(Object.prototype.hasOwnProperty.call(e,r)){const i=e[r],s={[t]:i[0],_children:[]};i.shift(),i.forEach((e,a)=>{const r={[t]:n[a],[o]:e};s._children.push(r)}),a.push(s)}}),a}function Ee(e){let t=!0;return e.getGroups().forEach(e=>{e._group.visible&&(t=!1)}),t}function Ae(e,t,n){const o=document.getElementById(n),a=o.cloneNode(!0);o.parentNode.replaceChild(a,o),a.addEventListener("click",()=>{e.download("csv",`${t}.csv`,{delimiter:";",bom:!0})})}function Ce(e,t,n){const o=document.getElementById(n),a=o.cloneNode(!0);o.parentNode.replaceChild(a,o),a.addEventListener("click",()=>{const n=e.getRows().map(e=>e.getData()),o=e.getColumns(),a={};o.forEach((e,t)=>{const o=e.getField();o&&n.every(e=>{const t=e[o];return null==t||/^-?\d+([.,]\d+)?$/.test(t.toString().trim())})&&(a[t]={halign:"right"})}),e.download("pdf",`${t}.pdf`,{title:t,rowCalcStyles:{fontSize:8,fontStyle:"bold"},autoTable:{styles:{fontSize:8,lineWidth:.1,lineColor:[200,200,200]},headStyles:{halign:"center"},columnStyles:a}})})}function Me(e,t,n){const o=document.getElementById(n);o&&o.addEventListener("click",()=>{e.setGroupStartOpen(!1),e.setData(t)})}function xe(e,t,n){const o=document.getElementById(n);o&&o.addEventListener("click",()=>{e.setGroupStartOpen(!0),e.setData(t)})}const De={SO2:[100,200,350,500,750,751],NO2:[40,90,120,230,340,341],O3:[50,100,130,240,380,381],PM10:[20,40,50,100,150,151],PM25:[10,20,25,50,75,76]};function Ne(e){const t=[],n={0:"b",1:"a",2:"d",3:"m",4:"mm",5:"em",6:"",7:"nd"};function o(e,t,o){const a=document.createElement("td");if(a.setAttribute("id",e),null!=t){a.innerHTML=t;const e=function(e,t){let o;return void 0===t?o=6:"ND"===t?o=7:(o=5,e.forEach((e,n)=>{t<=e&&5===o&&(o=n)})),n[o]}(o,t);a.classList.add(e)}return a}return e.forEach(e=>{const n=e;"noData"===n.operationalstatus&&(n.so2value="ND",n.no2value="ND",n.o3value="ND",n.pm10value="ND",n.pm25value="ND");const a=document.createElement("tr"),r=document.createElement("td");r.innerHTML=n.address,a.appendChild(r),a.appendChild(o(`${n.entityid}_so2`,n.so2value,De.SO2)),a.appendChild(o(`${n.entityid}_no2`,n.no2value,De.NO2)),a.appendChild(o(`${n.entityid}_o3`,n.o3value,De.O3)),a.appendChild(o(`${n.entityid}_pm10`,n.pm10value,De.PM10)),a.appendChild(o(`${n.entityid}_pm25`,n.pm25value,De.PM25)),t.push(a)}),t}function $e(e){document.location=`${document.documentURI.split("%3A")[0]}%3A${document.documentURI.split("%3A")[1]}%3A${document.documentURI.split("%3A")[2]}%3A${document.documentURI.split("%3A")[3]}%3A${e}`}function we(){const e=window.location.href;let t="";return t=e.includes("localhost")?"local":e.includes("sc_valencia_pre")?"PRE":"PRO",t}function Le(e,t){document.querySelectorAll(`[${e}]`).forEach(n=>{!function(e,t,n){const o=t;if(e){const t=new XMLHttpRequest;t.onreadystatechange=function(){4===this.readyState&&(200===this.status&&(o.innerHTML=this.responseText,n&&n()),404===this.status&&(o.innerHTML="No se ha podido cargar correctamente."))},t.open("GET",e,!0),t.send()}}(n.getAttribute(e),n,t)})}function _e(e){window.realDashboardsInit=Dashboards.init,Dashboards.init=function(){console.warn("Dashboards.init bloqueado temporalmente")},Le("include-html-cabecera",function(){!function(){const e=we();"PRO"!==e&&(document.title+=` (${e})`)}(),function(){const e=we();"PRO"!==e&&(document.querySelector("nav").querySelectorAll("span")[1].textContent+=` (${e})`)}()}),Le("include-html-menu"),Le("include-html-main-container",function(){document.body.dispatchEvent(new Event("MainContentLoadedCustom")),function(){const e=document.querySelector("body");e.classList.remove("inicio"),e.classList.add(document.documentURI.split("%3A")[4].match(/(.*?).wcdf/)[1])}(),e&&e()}),Le("include-html-copyright"),function(e="MainContentLoadedCustom"){document.body.addEventListener(e,()=>{try{Dashboards.init=window.realDashboardsInit,Dashboards.init()}catch(e){console.warn("No se pudo restaurar Dashboards.init; la función original no está disponible.")}},{once:!0})}()}function Te(e,t,n,o,a,r){let i=!1,s=!1;const l=document.querySelector(e),c=document.querySelector(t),d=()=>{"undefined"!=typeof Liferay&&"ca-ES"===Liferay.ThemeDisplay.getBCP47LanguageId()?(l&&l.setAttribute("src","https://camaras.valencia.es/camaras/ocimovil.html?camara=1&lang=cas"),c&&c.setAttribute("src","https://camaras.valencia.es/camaras/ocimovil.html?lang=cas")):(l&&l.setAttribute("src","https://camaras.valencia.es/camaras/ocimovil.html?camara=1&lang=val"),c&&c.setAttribute("src","https://camaras.valencia.es/camaras/ocimovil.html?lang=val"))};function u(e=!0){const t=document.querySelector(n);e?(l&&(l.src="about:blank"),c&&(c.src="about:blank"),t.classList.add("blur"),s=!0):(t.classList.remove("blur"),d(),s=!1)}const m=e=>{new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&(s||d(),i||(i=!0,window.setTimeout(u,r)))})}).observe(e)};!function(){const{userAgent:e}=navigator;return/iPad|iPhone|iPod|Macintosh/.test(e)&&!window.MSStream}()?(l&&(l.setAttribute("sandbox","allow-scripts"),m(l)),c&&(c.setAttribute("sandbox","allow-scripts"),m(c)),document.querySelector(a).addEventListener("click",()=>{u(!1),window.setTimeout(u,r)})):document.querySelectorAll(o)[0].style.display="none"}const Oe={grid:{containLabel:!0},title:{left:"center",top:"0",textStyle:{fontSize:15,fontFamily:"Montserrat",fontWeight:500,color:"#666"}},legend:{orient:"horizontal",bottom:"0",left:"center",width:"100%",textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:400,color:"#666"}},toolbox:{show:!0,right:"0",top:"0",feature:{restore:{textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}},saveAsImage:{textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}}},emphasis:{iconStyle:{borderColor:"#ffcd00",textFill:"#666"}}},tooltip:{textStyle:{fontFamily:"Montserrat",fontSize:12}},xAxis:[{type:"category",axisLabel:{show:!0,interval:0,textStyle:{fontFamily:"Montserrat",fontSize:11}},data:[]}],yAxis:[{type:"value",alignTicks:!0,position:"right",axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400},formatter:e=>`${e}%`}},{type:"value",position:"left",axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400},formatter:e=>`${E(e)}€`}}]},Fe=(e,t)=>{t.sort((e,t)=>parseInt(e.anyo)-parseInt(t.anyo));const n={};t.forEach(t=>{const o=t[1],a=t[0];a!==e.seriesName||n[o]||(n[o]=0),a===e.seriesName&&(n[o]+=t[2])});let o=`<p>${e.seriesName}</p>`;for(const[t,a]of Object.entries(n))o+=`<div>${e.marker} ${t}: <span style="float: right; margin-left:20px;font-weight: 600;">${v(a)}</span></div>`;return o};function Ie(e,t,n=void 0,o=void 0){const a=null===o?void 0:o,r=new Set(t.map(e=>e[1]));let i;const s={title:{text:"SIN TITULO",left:"center",top:"top",textStyle:{fontSize:20,fontFamily:"Montserrat",fontWeight:600,color:"#666"}},tooltip:{axisPointer:{type:"shadow"},trigger:"item",formatter:e=>Fe(e,t),textStyle:{fontFamily:"Montserrat"},position(e,t,n,o,a){const r={},i=a.contentSize[1]/2,s=a.viewSize[1],l=e[1];return l<i?r.top=10:l+i>s?r.bottom=10:r.top=l-i,e[0]<a.viewSize[0]/2?r.left=e[0]+20:r.right=a.viewSize[0]-e[0]+20,r}},legend:{padding:40,textStyle:{fontFamily:"Montserrat"}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"value",splitNumber:10,name:"SIN NOMBRE",nameLocation:"start",nameTextStyle:{fontWeight:"bold",fontFamily:"Montserrat",color:"#666",padding:-40},axisLabel:{margin:5,textStyle:{fontFamily:"Montserrat"},formatter:e=>v(e)},splitLine:{lineStyle:{color:"#DDD"}}},yAxis:{type:"category",data:Array.from(r),axisLabel:{textStyle:{fontFamily:"Montserrat"}}},series:(()=>{const e={name:"SIN NOMBRE",type:"bar",stack:"total",label:{show:!0,fontFamily:"Montserrat",fontSize:10,formatter:e=>v(Math.round(e.value))},itemStyle:void 0,emphasis:{focus:"series"},data:void 0};a&&a.itemStyle&&Array.isArray(a.itemStyle.borderColor)&&(i=[...a.itemStyle.borderColor],delete a.itemStyle.borderColor);const n=function(e){return e.reduce((e,t)=>{const n=t[0];return e[n]||(e[n]=[]),e[n].push(t),e},{})}(t),o=Object.keys(n);r.forEach(e=>{o.forEach(t=>{void 0===n[t].find(t=>t[1]===e)&&(n[t].push([n[t][0][0],e,void 0]),n[t].sort())})});const s=[];return Object.keys(n).forEach(t=>{i&&(e.itemStyle={borderColor:i.shift()}),e.name=t,e.data=n[t].map(e=>e[2]);let o={};o=void 0!==a?q(e,a):e,s.push({...o})}),s})(),toolbox:{show:!0,feature:{restore:{title:"Restablir"},saveAsImage:{title:"Desar"}},right:50}};let l={};l=void 0!==n?q(s,n):s,N(e,l)}function Pe(e){let t={};return t=q(Oe,e),t}function je(e,t,n={},o={}){let r={};r=q(n,{color:["#81B1CC","#ABD9EA","#C2EEF9","#F9E2AF","#F9C780","#FDAE61","#F46D43","#FDAE61","#F9E2AF","#C2EEF9","#ABD9EA","#81B1CC"],yAxis:{data:function(){const e=new Set;return t.forEach(t=>{e.add(t[1])}),Array.from(e).sort((e,t)=>e-t)}()}});const i={itemStyle:{borderWidth:2,borderColor:["#448DAD","#89CADB","#A0DEE8","#F4D28C","#F4B569","#F79646","#F25930","#F79646","#F4D28C","#A0DEE8","#89CADB","#448DAD"]}},s=null===o?i:q(o,i),l=t;l.forEach((e,t)=>{l[t][0]=a(e[0])}),Ie(e,l,r,s)}function Be(e,t=void 0){const n={title:{text:"SIN TITULO",left:"center",top:"top",padding:50,textStyle:{fontSize:14,fontFamily:"Montserrat",fontWeight:400,color:"#333"}},legend:{show:!1},grid:{top:"30%",bottom:"5%",left:"8%",right:"8%"},xAxis:{type:"value",show:!1},yAxis:{show:!1,type:"category"},tooltip:{show:!0,textStyle:{fontFamily:"Montserrat",fontWeight:"600"},appendToBody:!0,formatter:e=>F(e,!1)},series:[{type:"bar",showBackground:!0}]};let o={};o=void 0!==t?q(n,t):n,N(e,o)}function ze(e){return Math.max(...e.map(e=>Number(e[0])))}function Re(e){const t=e.filter(t=>Number(t[0])===ze(e)),n=Array.from({length:12},()=>0);return t.forEach(([e,t,o])=>{const a=parseInt(t,10)-1;n[a]=o}),n}function We(e){const t=e.filter(t=>Number(t[0])===ze(e)-1),n=Array.from({length:12},()=>0);return t.forEach(([e,t,o])=>{const a=parseInt(t,10)-1;n[a]=o}),n}function ke(e,t,n=void 0){const o=ze(t).toString(),a=(ze(t)-1).toString();Be(e,q({title:{left:"center",top:"-12%",textStyle:{fontSize:15,fontFamily:"Montserrat"}},legend:{top:"10%",show:!0,data:[a,o],textStyle:{fontFamily:"Montserrat"}},grid:{bottom:"8%",top:"20%",right:"2%"},xAxis:[{type:"category",data:h(),interval:0,margin:10,axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400}}}],yAxis:[{type:"value",axisLabel:{formatter:e=>e.toLocaleString("es-ES"),textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400}}}],series:[{name:a,type:"bar",data:We(t)},{name:o,type:"bar",barGap:0,data:Re(t)}]},n))}function Ve(e,t,n){const o=document.querySelector(t),a=document.querySelector(e);let r=!1;a.addEventListener("click",()=>{!1===r&&(r=!0,o.setAttribute("src","about:blank"),o.setAttribute("src",n),o.onload=()=>{r=!1})}),a.disabled=!1}const qe="id",He="fecha",Je="value";function Ge(e,t,n,o,a="es_ES"){const[r,i]=function(e,t,n){const o=[],a=[];return e.forEach(e=>{t.includes(`${e[qe]}`)?o.push(`${e[He]}`):n.includes(`${e[qe]}`)&&a.push(`${e[He]}`)}),[o.map(e=>[e,0]),a.map(e=>[e,0])]}(e,n,o);let s="es_ES"==a?"Datos sin validar":"Dades sense validar";0===i.length&&(s="");const l={name:"Datos validados",type:"line",data:[...r,i[0]],lineStyle:{color:"#00A9A0",width:4},showSymbol:!1,tooltip:{show:!1}};let c="",d="";if(0===i.length){const t=e[e.length-1].fecha;c=t,d=t}else c=i[0][0],d=i[i.length-1][0];return[...t,l,{name:"Datos NO validados",type:"line",data:i,lineStyle:{color:"#80D4CF",width:4},showSymbol:!1,tooltip:{show:!1},markArea:{silent:!0,itemStyle:{opacity:.6,color:"#eee"},tooltip:{show:!1},label:{color:"#333",fontStyle:"normal",fontWeight:"400",fontFamily:"Montserrat",fontSize:11},data:[[{name:s,xAxis:c,yAxis:0},{name:"end",xAxis:d,yAxis:Math.max(...e.filter(e=>null!==e[Je]).map(e=>parseInt(`${e[Je]}`,10)))}]]}}]}function Ye(e,t,n=void 0){N(e,q({grid:{left:"2.5%",right:"5%",bottom:"70",top:"150",containLabel:!0},title:{left:"center",top:"top",textStyle:{fontSize:20,fontFamily:"Montserrat",fontWeight:600,color:"#666"}},legend:{type:"plain",top:"50",width:"98%",textStyle:{fontFamily:"Montserrat"}},tooltip:{trigger:"axis",show:!0,formatter:e=>L(e),textStyle:{fontFamily:"Montserrat"}},xAxis:{type:"category",boundaryGap:!1,splitLine:{show:!1},axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",color:"#666"}}},yAxis:{type:"value",nameLocation:"end",nameGap:"0",nameTextStyle:{fontFamily:"Montserrat",fontWeight:"500",padding:[-25,0,0,-48],margin:0,align:"left",verticalAlign:"top",width:"auto"},scale:!0,splitNumber:"6",axisLabel:{margin:10,textStyle:{fontSize:10,fontFamily:"Montserrat",color:"#666"}}},dataZoom:{end:100,borderColor:"#eee",fillerColor:"rgba(0,0,0,.05)",textStyle:{fontSize:10,fontFamily:"Montserrat",color:"#333",textBorderColor:"#fff",textBorderWidth:3,fontWeight:"600"},selectedDataBackground:{lineStyle:{color:"#333"},areaStyle:{color:"#ffcd00"}},dataBackground:{backgroundColor:"rgba(0,0,0,1)",lineStyle:{color:"#333"},areaStyle:{color:"rgba(0,0,0,0.5)"}},handleStyle:{color:"rgba(0,0,0,0.2)"},moveHandleStyle:{color:"rgba(0,0,0,0.3)"},emphasis:{handleStyle:{color:"rgba(255,205,0,1)"},moveHandleStyle:{color:"rgba(255,205,0,1)"}}},toolbox:{feature:{restore:{title:"Restablir"},saveAsImage:{title:"Desar"}},right:"1%",top:"0%"},series:t},n))}return t})(),e.exports=t()}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";n.r(o),n.d(o,{callesCongestionadas:()=>s,callesCortadas:()=>i,echartIncidenciasPorEstadoPie:()=>b,echartIntervencionesTotalesPie:()=>h,intervencionesPoliciales:()=>p,medioambienteAlertasDiarias:()=>D,medioambienteAlertasHorarias:()=>x,medioambienteClima:()=>E,medioambienteEstadoCalidadAire:()=>C,sensoresRuido:()=>N,setFechaDatos:()=>$,setToken:()=>w,top3IncidenciasPorTipologia:()=>g,traficoAccesosCiudad:()=>y,traficoAccesosCiudadDetalle:()=>S,traficoPuntosMedida:()=>v});var e=n(725);const t=e=>!Number.isNaN(Number(e)),a=(e,n=!0)=>{const o=e;if(!t(o.textContent))return;if(o.classList.add((e=>{const t=Number(e.trim());return 0===t?null:t>0?"pos":"neg"})(e.textContent)),o.textContent=(e=>{return t=e.textContent,Number(t.trim())>0?e.textContent:e.textContent.replace("-","");var t})(e),!n)return;const a=document.createElement("span");a.textContent="%",e.append(a)},r=(e,t,n,o=!1)=>{if(!Array.isArray(e)||0===e.length)return;const{idPrefijo:r,camposLeft:i,camposVariacion:s}=n;t.innerHTML="";const l=i[1]?e[0][i[1].campo]:0;e.forEach((e,c)=>{const d=c+1,u=document.createElement("li");u.id=`${r}-${d}`,u.className="list-item";const m=document.createElement("div");m.className="datos";const f=((e,t,n,o)=>{const a=document.createElement("div");return a.className="left",t.forEach(t=>{const r=document.createElement("div");let i;if(r.className=t.clase,r.id=`${n}-${o}-${t.idSufijo}`,"campo"in t?(i=e[t.campo],t.format&&(i=t.format(i))):"texto"in t&&(i=t.texto),r.textContent=i,t.span){const e=document.createElement("span");e.textContent=t.span,r.append(e)}a.append(r)}),a})(e,i,r,d),p=((e,t,n,o)=>{const r=document.createElement("div");return r.className="changes",t.forEach(t=>{let i=!0;"aplicarEstilosVariacion"in t&&(i=t.aplicarEstilosVariacion);let s=!0;"mostrarPorcentaje"in t&&(s=t.mostrarPorcentaje),r.append(((e,t,n,o="value",r=!0,i=!0)=>{const s=document.createElement("div");if(s.className="mini",e){const t=document.createElement("div");t.className="label",t.textContent=e,s.append(t)}const l=document.createElement("div");return l.id=n,l.classList.add(o),l.textContent=t,r&&a(l,i),s.append(l),s})(t.label,e[t.campo],`${n}-${o}-${t.idSufijo}`,t.clase,i,s))}),r})(e,s,r,d);if(m.append(f,p),n.extra){const t=n.extra(e,d);t&&u.append(t)}if(u.append(m),o){const t=((e,t)=>{const n=document.createElement("div");return n.className="progress",n.style.width=100*e/t+"%",n})(e[i[1].campo],l);u.append(t)}t.append(u)})};function i(t){const n={"TOTAL CALLES CORTADAS":{num_ayer:{element:"#calles-cortadas-num",format:e=>Number(e).toLocaleString("de-DE")},diferencia_dia_anterior:"#calles-cortadas-num-ayer",diferencia_semana_anterior:"#calles-cortadas-num-semana-prev"}},o=(0,e.resultsetWithFields)(t);(0,e.printDataInHTMLElements)(o,n);const r=document.getElementById("calles-cortadas-num-ayer");a(r,!1);const i=document.getElementById("calles-cortadas-num-semana-prev");a(i,!1)}function s(t){const n=(0,e.resultsetWithFields)(t).sort((e,t)=>t.minutos_ayer-e.minutos_ayer),o=document.getElementById("calles-congestionadas-trafico"),a=o.querySelector("ul");if(!n||0===n.length){o.querySelector("p").classList.add("hidden");const e=document.createElement("p");return e.textContent="Ayer no hubo calles congestionadas.",void o.appendChild(e)}r(n,a,{idPrefijo:"calle-cong",camposLeft:[{texto:"AYER",clase:"label",idSufijo:"label"},{campo:"minutos_ayer",clase:"number",idSufijo:"minutos",format:e=>e.toLocaleString("de-DE"),span:"min."}],camposVariacion:[{label:"COMPARACIÓN vs ANTEAYER",campo:"variacion_dia_anterior",idSufijo:"var-dia"},{label:"vs SEMANA PASADA",campo:"variacion_semana_anterior",idSufijo:"var-semana"}],extra:(e,t)=>{const n=document.createElement("div");return n.className="name",n.id=`calle-cong-${t}-nombre`,n.textContent=e.id,n}})}const l={es_ES:new Map([["download","Descargar"],["intervenciones_totales","INTERVENCIONES TOTALES"],["intervenciones","intervenciones"],["tipologia_nivel","TIPOLOGÍA NIVEL"],["incidencias","incidencias"],["incidencias_totales","INCIDENCIAS TOTALES"]]),ca_ES:new Map([["download","Desar"],["intervenciones_totales","INTERVENCIONS TOTALS"],["intervenciones","intervencions"],["tipologia_nivel","TIPOLOGIA NIVELL"],["incidencias","incidències"],["incidencias_totales","INCIDÈNCIES TOTALS"]])},c={es_ES:new Map([["alerta","Alerta"],["aviso","Aviso"],["preaviso","Preaviso"],["avisos_diarios","Promedio diario del día anterior > {umbral} µg/m³ en 2 o más estaciones."],["avisos_horarios","Promedio horario > {umbral} µg/m³ durante 2 horas consecutivas en 2 o más estaciones"]]),ca_ES:new Map([["alerta","Alerta"],["aviso","Avís"],["preaviso","Preavís"],["avisos_diarios","Mitjana diària del dia anterior > {umbral} µg/m³ en 2 o més estacions."],["avisos_horarios","Mitjana horària > {umbral} µg/m³ durant 2 hores consecutives en 2 o més estacions"]])},d="es_ES",u={naranjaPalido:"#F1AB86",tealPalido:"#48A9A6",amarilloPalido:"#ffbf69",azulPalido:"#4BA3C3",cranberryPalido:"#e56b6f",marinoPalido:"#284B63",naranja:"#F96E46",teal:"#307473",amarillo:"#F6AE2D",azulCeruleo:"#05668d",cranberry:"#A23E48",marino:"#0B3948",verdeClaro:"#6a9c81",tealApagado:"#7AA8A7"},m={color:Object.values(u),grid:{left:"1%",right:"1%",bottom:"2%",top:"20%",containLabel:!0},title:{show:!1,text:l[d].get("intervenciones_totales"),subtext:`${l[d].get("tipologia_nivel")} 1`,left:"center",top:"0",itemGap:5,textStyle:{fontSize:15,fontFamily:"Montserrat",fontWeight:500,color:"#666"},subtextStyle:{fontFamily:"Montserrat",fontSize:12,fontWeight:400,color:"#666",width:"100%"}},legend:{orient:"vertical",top:"middle",left:"right",selectedMode:!1,textStyle:{fontSize:"11",fontFamily:"Montserrat",fontWeight:"400",color:"#333"}},toolbox:{show:!1,right:"0",top:"0",emphasis:{iconStyle:{borderColor:"#ffcd00",textFill:"#666"}},feature:{saveAsImage:{title:l[d].get("download"),textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}}}},tooltip:{trigger:"item",confine:!0,textStyle:{fontFamily:"Montserrat",fontSize:12,fontWeight:"500"},formatter:t=>`<b style="color: #666;">${(0,e.capitalizarTexto)(t.name)}</b><br />${(0,e.addPointInteger)(t.value)} ${l[d].get("intervenciones")}`},series:[{type:"pie",radius:["0","80%"],center:["23%","50%"],startAngle:0,data:[],label:{show:!0,position:"inside",formatter:"{c0}",distanceToLabelLine:0,textStyle:{fontFamily:"Varela Round",fontSize:15,lineHeight:18}},labelLine:{show:!1,length:10},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]},f={color:[u.cranberryPalido,u.tealApagado],grid:{left:"0",right:"0",bottom:"0",top:"0",containLabel:!0},title:{show:!1},legend:{show:!1},toolbox:{show:!1},tooltip:{trigger:"item",confine:!0,textStyle:{fontFamily:"Montserrat",fontSize:12,fontWeight:"500"},formatter:t=>`<b style="color: #666;">${(0,e.capitalizarTexto)(t.name)}</b><br />${(0,e.addPointInteger)(t.value)} ${l[d].get("incidencias")}`},series:[{type:"pie",radius:["0","80%"],center:["40%","50%"],startAngle:0,data:[],itemStyle:{borderWidth:1,borderColor:u.cranberryPalido},label:{show:!0,position:"inside",formatter:"{c0}",distanceToLabelLine:0,textStyle:{fontFamily:"Varela Round",fontSize:15,lineHeight:18}},labelLine:{show:!1},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};function p(t){const n={"TOTAL INTERVENCIONES":{num_ayer:{element:"#interv-pol-total",format:e=>Number(e).toLocaleString("de-DE")},variacion_dia_anterior:"#interv-pol-var-dia",variacion_semana_anterior:"#interv-pol-var-semana"}},o=(0,e.resultsetWithFields)(t);(0,e.printDataInHTMLElements)(o,n);const r=document.getElementById("interv-pol-var-dia");a(r);const i=document.getElementById("interv-pol-var-semana");a(i)}function h(t,n){const o=JSON.parse(JSON.stringify(m));o.series[0].label.formatter=m.series[0].label.formatter,o.tooltip.formatter=m.tooltip.formatter;const a="chart-intervenciones-ayer",r="no-data-intervenciones-ayer",i=(0,e.resultsetWithFields)(n);0===i.length?(0,e.printNoDataChart)(`#${a}`,`#${r}`):(0,e.printDataChart)(`#${r}`,`#${a}`);const s=i.filter(e=>"TOTAL INTERVENCIONES"!==e.id).map(e=>({name:e.id,value:Number(e.num_ayer)}));o.series[0].data=s,(0,e.initChart)(a,o)}function b(t){const n=JSON.parse(JSON.stringify(f));n.series[0].label.formatter=f.series[0].label.formatter,n.tooltip.formatter=f.tooltip.formatter;const o="chart-incid-ciudadanas-estado-ayer",a="no-data-incid-ciudadanas-estado-ayer",i=(0,e.resultsetWithFields)(t);0===i.length?(0,e.printNoDataChart)(`#${o}`,`#${a}`):(0,e.printDataChart)(`#${a}`,`#${o}`);const s=i.map(e=>({name:e.id,value:Number(e.num_incidencias_ayer)}));n.series[0].data=s,(0,e.initChart)(o,n);const l=document.getElementById("list-incidencias-ciudadanas-estado"),c=l.querySelector("ul");if(!i||0===i.length){const e=document.createElement("p");return e.textContent="Ayer no hubo incidencias.",void l.appendChild(e)}r(i,c,{idPrefijo:"estado-incidencia",camposLeft:[{campo:"id",clase:"value",idSufijo:"estado"}],camposVariacion:[{label:"COMPARACIÓN vs ANTEAYER",campo:"diferencia_dia_anterior",idSufijo:"var-dia",mostrarPorcentaje:!1},{label:"vs SEMANA PASADA",campo:"diferencia_semana_anterior",idSufijo:"var-semana",mostrarPorcentaje:!1}]})}function g(t){const n=(0,e.resultsetWithFields)(t),o=document.getElementById("incid-ciudadanas-tipologia-top-3"),a=o.querySelector("ul");if(!n||0===n.length){const e=document.createElement("p");return e.textContent="No hay datos disponibles.",void o.appendChild(e)}r(n,a,{idPrefijo:"tipo-incidencia",camposLeft:[{campo:"id",clase:"name",idSufijo:"tipologia"}],camposVariacion:[{campo:"num_incidencias_ayer",idSufijo:"num",clase:"number",aplicarEstilosVariacion:!1},{campo:"diferencia_dia_anterior",idSufijo:"var-dia",mostrarPorcentaje:!1},{campo:"diferencia_semana_anterior",idSufijo:"var-semana",mostrarPorcentaje:!1}]})}function y(t){const n={"TOTAL VEHICULOS/HORA EN EL DIA":{veh_ayer:{element:"#accesos-traf-vehiculos",format:e=>Number(e).toLocaleString("de-DE")},variacion_dia_anterior:"#accesos-traf-var-dia",variacion_semana_anterior:"#accesos-traf-var-semana"}},o=(0,e.resultsetWithFields)(t);(0,e.printDataInHTMLElements)(o,n);const r=document.getElementById("accesos-traf-var-dia");a(r);const i=document.getElementById("accesos-traf-var-semana");a(i)}function S(t){const n=(0,e.resultsetWithFields)(t),o=document.getElementById("accesos-trafico-detalle"),a=o.querySelector("ul");if(!n||0===n.length){const e=document.createElement("p");return e.textContent="No hay datos disponibles.",void o.appendChild(e)}const i=n.filter(e=>"TOTAL VEHICULOS/HORA EN EL DIA"!==e.id).sort((e,t)=>t.veh_ayer-e.veh_ayer);r(i,a,{idPrefijo:"acceso",camposLeft:[{campo:"id",clase:"name",idSufijo:"nombre"},{campo:"veh_ayer",clase:"number",idSufijo:"vehiculos",format:e=>e.toLocaleString("de-DE")}],camposVariacion:[{label:"COMPARACIÓN vs ANTEAYER",campo:"variacion_dia_anterior",idSufijo:"var-dia"},{label:"vs SEMANA PASADA",campo:"variacion_semana_anterior",idSufijo:"var-semana"}]},!0)}function v(t){const n=(0,e.resultsetWithFields)(t),o=document.getElementById("pm-trafico"),a=o.querySelector("ul");if(!n||0===n.length){const e=document.createElement("p");return e.textContent="No hay datos disponibles.",void o.appendChild(e)}r(n,a,{idPrefijo:"pm",camposLeft:[{campo:"id",clase:"name",idSufijo:"nombre"},{campo:"veh_ayer",clase:"number",idSufijo:"vehiculos",format:e=>e.toLocaleString("de-DE")}],camposVariacion:[{label:"COMPARACIÓN vs ANTEAYER",campo:"variacion_dia_anterior",idSufijo:"var-dia"},{label:"vs SEMANA PASADA",campo:"variacion_semana_anterior",idSufijo:"var-semana"}]},!0)}function E(n){const o=(0,e.resultsetWithFields)(n),a=document.getElementById("sensores-clima").querySelector("ul");if(a.innerHTML="",!o||0===o.length){const e=document.createElement("p");return e.textContent="No hay datos disponibles.",void a.appendChild(e)}const r=o[0];[{id:"clima-temp-media",campoBbdd:"temperatura_media",label:"Temperatura",unidad:"°C"},{id:"clima-humedad-media",campoBbdd:"humedad_media",label:"Humedad",unidad:"%"},{id:"clima-precip-media",campoBbdd:"precipitacion_media",label:"Precipitación acumulada",unidad:"mm"},{id:"clima-vel-viento-media",campoBbdd:"velocidad_viento_media",label:"Velocidad del viento",unidad:"km/h"}].forEach(({id:e,campoBbdd:n,label:o,unidad:i})=>{const s=document.createElement("li");s.id=e;const l=document.createElement("div");l.className="label",l.textContent=o;const c=document.createElement("div");var d;c.className="value",c.textContent=(d=r[n],t(d)?Number(d).toLocaleString("es-ES"):d);const u=document.createElement("div");u.className="medida",u.textContent=i,s.append(l,c,u),a.appendChild(s)})}const A=new Map([["NO2alerta",400],["NO2aviso",200],["NO2preaviso",180],["PM10aviso",80],["PM10preaviso",50]]);function C(t){const n=["Extremadamente Desfavorable","Muy Desfavorable","Desfavorable","Regular","Razonablemente Buena","Buena"],o=(0,e.resultsetWithFields)(t).map(e=>{const t=n.indexOf(e.calidad_ambiental_ciudad),o=-1!==t?"aire-"+(6-t):"";return{...e,calidad_ambiental_ciudad_clase:o}});(0,e.printDataInHTMLElements)(o,{"ESTADO CALIDAD AIRE":{calidad_ambiental_ciudad:{element:"#estado-calidad-aire",format:e=>e},calidad_ambiental_ciudad_clase:{className:"#estado-calidad-aire"}}})}const M=(e,t,n,o)=>{const a=document.createElement("p");a.className=e;const r=document.createElement("strong");return r.textContent=`${c[d].get(e)} ${t}:`,a.appendChild(r),a.append(`${c[d].get(n).replace("{umbral}",A.get(o))}`),a};function x(t){const n=(0,e.resultsetWithFields)(t),o=document.getElementById("alertas-contaminantes-est-aire");if(!n||0===n.length)return;o.classList.remove("hidden");const a=n[0],r="avisos_horarios",i="NO2";a.cant_alertas>1&&o.appendChild(M("alerta",i,r,"NO2alerta")),a.cant_avisos>1&&o.appendChild(M("aviso",i,r,"NO2aviso")),a.cant_preavisos>1&&o.appendChild(M("preaviso",i,r,"NO2preaviso"))}function D(t){const n=(0,e.resultsetWithFields)(t),o=document.getElementById("alertas-contaminantes-est-aire");if(!n||0===n.length)return;o.classList.remove("hidden");const a=n[0],r="avisos_diarios",i="PM10";a.cant_avisos>1&&o.appendChild(M("aviso",i,r,"PM10aviso")),a.cant_preavisos>1&&o.appendChild(M("preaviso",i,r,"PM10preaviso"))}function N(t,n){const o=(0,e.resultsetWithFields)(t);o&&0!==o.length&&(function(e,t){function n(e){const t=document.createElement("td");return t.id=e,t.textContent=0,t}[...new Set(t.map(e=>e.areaserved))].forEach(t=>{const o=`estacion-${t.toLowerCase()}`;if(document.getElementById(o))return;const a=document.createElement("tr");a.id=o;const r=n(`${o}-nombre`);r.textContent=t,a.appendChild(r),a.appendChild(n(`${o}-cant-manana`)),a.appendChild(n(`${o}-cant-tarde`)),a.appendChild(n(`${o}-cant-noche`)),e.appendChild(a)})}(document.querySelector("#tabla-sensores-ruido > tbody"),o),function(e,t){const n=e.reduce((e,t)=>(e[t.areaserved]=(e[t.areaserved]||0)+1,e),{});Object.entries(n).forEach(([e,n])=>{const o=`estacion-${e.toLowerCase()}-cant-${t}`,a=document.getElementById(o);a&&(a.textContent=n)})}(o,n))}function $(t){const n=(0,e.resultsetWithFields)(t).find(e=>"TOTAL INTERVENCIONES"===e.id).fecha;(0,e.initElement)("fecha-datos",t=>{t.textContent=(0,e.separateDayMonthYearToSlash)(n)})}function w(t){const n=(0,e.resultsetWithFields)(t)[0].token;if(!n)throw new Error("No se pudo obtener el token desde base de datos");!function(e){try{document.querySelector("#if-estados-trafico").setAttribute("src",`https://geoportal.valencia.es/portal/apps/webappviewer/index.html?id=fdcb9a8cbde94431a72f6b45f4c96185&mobileBreakPoint=300&token=${e}`)}catch(e){console.error("No se pudo cargar el token, y por tanto, no se han podido mostrar el mapa. Error:",e)}}(n)}})(),o})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.inicio=t():e.inicio=t()}(self,()=>(()=>{var e={725(e){var t;self,t=()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MONTHS_YEAR:()=>r,MONTHS_YEAR_SHORT:()=>i,TEXTS_COMMON:()=>s,THRESHOLDS:()=>$e,addPointInteger:()=>S,buildCamarasTrafico:()=>Fe,buildTableCalidadAire:()=>we,calculateMaxYAxis:()=>F,calculatePentahoPath:()=>Le,calculateXAxisStart:()=>O,capitalizarTexto:()=>x,checkAllGroupsCollapsed:()=>Ce,configureDataBar:()=>q,configureDataGaugeCommon:()=>R,configureDataGaugeMonthCommon:()=>k,configureDataLine:()=>V,configureDataValidate:()=>Ue,configureLinesChartValidates:()=>Xe,convertDateToInteger:()=>b,convertISODateToEUDate:()=>v,convertToLanguageSelectorDateRange:()=>fe,convertToTableTreeView:()=>Ae,downloadCSVTable:()=>Me,downloadPDFTable:()=>xe,formatCellMultiplesLines:()=>ve,formatDayMonthYear:()=>u,formatMilMillionEuros:()=>B,formatMonthAnyo:()=>d,formatName:()=>M,formatNameHeaderColumn:()=>be,formatRoundTooltip:()=>P,formatShortMonthShortYear:()=>f,formatShortMonthYear:()=>m,formatToMillions:()=>E,formatToTons:()=>A,formatTooltip:()=>T,formatTooltipPie:()=>I,formatTrimestre:()=>p,formatWithPrefix:()=>C,getEnvironment:()=>_e,getMaxFieldNumberFromData:()=>Y,getMonth:()=>a,getMonthList:()=>h,getSelectCommonOptions:()=>se,getSelectTwoColumnsOptions:()=>le,initBarChart:()=>Re,initBarChartComparationMonth:()=>qe,initChart:()=>w,initContractAllGroups:()=>De,initElement:()=>N,initElementsByClass:()=>$,initExpandAllGroups:()=>Ne,initStackedBarChart:()=>Be,initStackedBarChartMonthSeries:()=>ze,initTable:()=>ye,initValueDefaultDate:()=>ue,initialCalls:()=>Oe,loadIframeOnClickEvent:()=>He,printDataChart:()=>_,printDataInHTMLElements:()=>G,printEchart:()=>j,printNoDataChart:()=>L,resetFilter:()=>ie,resetFilterAndUpdate:()=>ge,resetFilterDate:()=>de,resetFilterDates:()=>ce,resetFilterToDefault:()=>pe,resultsetWithFields:()=>H,selectConfigDatasource:()=>ae,selectConfigDatasourceAllValue:()=>re,selectFilterAll:()=>ne,selectFilterNumItemsDefault:()=>he,selectValueDefaultInFilter:()=>me,separateDayMonthYearToSlash:()=>l,splitDataset:()=>X,subtractOneDay:()=>g,subtractOneMonth:()=>y,traverseRows:()=>Ee,updateDomElement:()=>U,updateObject:()=>J,updateStackedBarOptions:()=>je});const n="es_ES",o=(new Map([["1","Enero"],["2","Febrero"],["3","Marzo"],["4","Abril"],["5","Mayo"],["6","Junio"],["7","Julio"],["8","Agosto"],["9","Septiembre"],["10","Octubre"],["11","Noviembre"],["12","Diciembre"]]),new Map([["1","Gener"],["2","Febrer"],["3","Març"],["4","Abril"],["5","Maig"],["6","Juny"],["7","Juliol"],["8","Agost"],["9","Setembre"],["10","Octubre"],["11","Novembre"],["12","Desembre"]]),{"01":"Enero","02":"Febrero","03":"Marzo","04":"Abril","05":"Mayo","06":"Junio","07":"Julio","08":"Agosto","09":"Septiembre",10:"Octubre",11:"Noviembre",12:"Diciembre"});function a(e){return{1:"Gen",2:"Feb",3:"Mar",4:"Abr",5:"Mai",6:"Jun",7:"Jul",8:"Ago",9:"Sep",10:"Oct",11:"Nov",12:"Des"}[parseInt(e.toString(),10)]}const r={es_ES:new Map([["1","Enero"],["2","Febrero"],["3","Marzo"],["4","Abril"],["5","Mayo"],["6","Junio"],["7","Julio"],["8","Agosto"],["9","Septiembre"],["10","Octubre"],["11","Noviembre"],["12","Diciembre"]]),ca_ES:new Map([["1","Gener"],["2","Febrer"],["3","Març"],["4","Abril"],["5","Maig"],["6","Juny"],["7","Juliol"],["8","Agost"],["9","Setembre"],["10","Octubre"],["11","Novembre"],["12","Desembre"]])},i={es_ES:new Map([["1","Ene"],["2","Feb"],["3","Mar"],["4","Abr"],["5","May"],["6","Jun"],["7","Jul"],["8","Ago"],["9","Sep"],["10","Oct"],["11","Nov"],["12","Dic"]]),ca_ES:new Map([["1","Gen"],["2","Feb"],["3","Mar"],["4","Abr"],["5","Mai"],["6","Jun"],["7","Jul"],["8","Ago"],["9","Set"],["10","Oct"],["11","Nov"],["12","Des"]])},s={es_ES:new Map([["last_update","Última actualización"]]),ca_ES:new Map([["last_update","Última actualització"]])};function l(e){return`${e.substring(6,8)}/${e.substring(4,6)}/${e.substring(0,4)}`}function c(e){return[e.substring(0,4),o[e.substring(4,6)]]}function d(e){const[t,n]=c(e);return`${n} ${t}`}function u(e){const[t,n,a]=function(e){return[e.substring(0,4),o[e.substring(4,6)],e.substring(6,8)]}(e);return`${a} ${n} ${t}`}function m(e){const[t,n]=c(e);return`${n.substring(0,3)} ${t}`}function f(e){const[t,n]=c(e);return`${n.substring(0,3)} '${t.substring(2,4)}`}function p(e){const[t,n]=e.split("-");return`${parseFloat(n)/3}T ${t}`}function h(){const e=r[n];return Array.from(e.values()).map(e=>e.slice(0,3))}function g(e){const t=Math.floor(e/1e4),n=new Date(t,e%1e4/100-1,e%100);return n.setDate(n.getDate()-1),`${n.getFullYear()}${(n.getMonth()+1).toString().padStart(2,"0")}${n.getDate().toString().padStart(2,"0")}`}function y(e){const t=new Date(Math.floor(e/100),e%100-1,0);return`${t.getFullYear()}${(t.getMonth()+1).toString().padStart(2,"0")}`}function b(e){return"string"==typeof e?parseInt(e.replace("-",""),10):e}function v(e){if(!e||"string"!=typeof e)return"";const[t,n,o]=e.split("-");return`${o}/${n}/${t}`}function S(e,t=2){let n=navigator.language||navigator.userLanguage;n=n.length<=2?`${n}-${n.toUpperCase()}`:n;const o={minimumFractionDigits:0,maximumFractionDigits:t};return"es-ES"===n?e.toLocaleString("de-DE",o):e.toLocaleString(n,o)}function E(e){const t=1e6;return e>=t?e/t+"M":e.toString()}function A(e){return e>=1e3?e/1e3+" Tn":e.toString()}function C(e){let t,n;return e>=1e6?(t=e/1e6,n="G"):e>=1e3?(t=e/1e3,n="M"):(t=e,n="k"),{value:Math.round(100*t)/100,prefix:n}}function M(e,t=29){if(e.length>=t){const n=e.split(" ");let o="",a="";return n.forEach(e=>{`${o} ${e}`.length<=t?o+=(o?" ":"")+e:(a+=`${o}\n`,o=e)}),a+=o,a}return e}function x(e){return e.includes("N/D")?e:e.toLowerCase().replace(/(^|\s|[.,;:!?¡¿(){}[\]])([^\s])/gu,(e,t,n)=>t+n[0].toUpperCase())}function D(e,t,n,o){return new Promise(a=>{document.body.addEventListener(e,()=>{const e=t();e?a(n(e)):(console.error(o),a(null))},{once:!0})})}function N(e,t,n="MainContentLoadedCustom"){const o=document.getElementById(e);return o?Promise.resolve(t(o)):D(n,()=>document.getElementById(e),e=>t(e),`El elemento con ID ${e} aún no está disponible después del evento.`)}function $(e,t,n="MainContentLoadedCustom"){const o=document.getElementsByClassName(e);return o&&0!==o.length?Promise.resolve(Array.from(o).map(e=>t(e))):D(n,()=>{const t=document.getElementsByClassName(e);return t.length>0?Array.from(t):null},e=>e.map(e=>t(e)),`No se encontraron elementos con la clase ${e} después del evento.`)}function w(e,t){return N(e,e=>{const n=echarts.init(e);n.setOption(t,!0),window.addEventListener("resize",()=>{null!=n&&void 0!==n&&n.resize()});const o=document.getElementById("main-content");return o&&(o.addEventListener("shown.bs.collapse",()=>{n.resize()}),o.addEventListener("hidden.bs.collapse",()=>{n.resize()})),n})}function L(e,t){const n=e?document.querySelector(e):null,o=t?document.querySelector(t):null;n&&(n.hidden=!0),o&&(o.style.background="url('./build/images/nodata1.png') no-repeat top center",o.hidden=!1)}function _(e,t){const n=e?document.querySelector(e):null,o=t?document.querySelector(t):null;n&&(n.hidden=!0),o&&(o.style.background="#ffffff",o.hidden=!1)}function T(e,t=!1,n=!0,o=""){let a=`<p style="font-weight: 500;color: #565656;">${e[0].name}</p>`;return e.forEach(e=>{const r=t?Math.round(e.data):e.data,i=n?`<div style="font-weight: 400;color: #666;">${s=e.color,`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;font-weight: 500;background-color:${s}"></span>`} ${e.seriesName}: \n <span style="float: right; margin-left:20px;font-weight: 600;color: #565656;">\n ${e.data?`${S(r)} ${o}`:"-"}\n </span>\n </div>`:`<div>\n <span style="font-weight: 600;color: #565656;">${e.data?`${S(r)} ${o}`:"-"}\n </span>\n </div>`;var s;a+=i}),a}function O(e){return 100*(e-120)/e}function F(e,t){const n=Math.max(...e);return n+(t-n%t)}function I(e,t=!1){const n=`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:${e.color}"></span>`,o=t?`${e.percent}%`:S(e.value);return`<div> ${n} ${e.name} <span style="float: right; margin-left:20px;font-weight: 600;color: #333;"> ${o} </span></div>`}function P(e,t){let n=`${e.name} : `;return n+=`<span style="font-weight:500">${S(Math.round(e.value))}</span>`,t&&(n+=`<span> (${e.percent}%)</span>`),e.marker+n}function B(e){const t=1e6,n=Number(e);return n>=0&&n<t?`${S(n)} €`:n>=t?`${S(n/t)} M €`:"-"}function j(e,t,n){return 0===e.length?(L(`#${t}`,`#${n}`),!1):(_(`#${n}`,`#${t}`),!0)}function z(e,t,n=1){const o=Math.max(...e.map(e=>e[t]))*n;return 5e3*Math.ceil(o/5e3)}function R(e,t,n,o=30,a=15,r=30,i=-70,s=70,l=3){const c=z(e,t.data,1.1),d=s,u=n.slice(),m=[];let f=a,p=r,h=i;for(let n=0;n<e.length;n+=1)m.push({value:e[n][t.data],name:M(String(e[n][t.type]).replace(/\[.*?\]/g,"")),color:u.shift(),title:{offsetCenter:[`${String(h)}%`,`${String(f)}%`],fontFamily:"Montserrat",fontSize:o},detail:{offsetCenter:[`${String(h)}%`,`${String(p)}%`],fontFamily:"Montserrat",width:"33%",formatter:e=>S(Math.round(e))}}),h+=d,(n+1)%l===0&&(p+=r,f+=2*a,h=i);return[c,m]}function k(e,t,n,o=0){return[z(t,n.data,1),e=>function(e,t,n){const o=S(Math.round(t)),r=a(e[n][0]),i=e[n][1],s=`\n${r} ${i} : ${o}`,l=`${o}\n${r} ${i}`;return window.innerWidth<=1710?s:l}(t,e,o),[{value:t[o][n.data]}]]}function W(e,t){const{resultset:n}={resultset:e},o=new Set,a=new Set,r=n.map(([e,n,r])=>{const i=t?Math.round(r):r;return o.add(e),a.add(n),{day:n,type:e,value:i}}),i=Array.from(a.values()),s=Array.from(o.values());return s.sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase(),"es",{ignorePunctuation:!0})),[s.map(e=>{const t=r.filter(t=>t.type===e).map(({day:t,value:n})=>[t,e,n]),n=i.map(e=>{const n=t.find(([t])=>t===e);return n?n[2]:null});return{name:e,data:n}}),s,a]}function V(e,t=[],n=!1){const[o,a,r]=W(e,n);return o.forEach(e=>{e.type="line",e.symbol="circle",e.symbolSize=6,e.smooth=.1,t.length>0&&(e.color=t.shift())}),[o,r,a]}function q(e,t,n=!1){const[o,a,r]=W(e,n);return o.forEach(e=>{e.type="bar",e.color=t.shift(),e.smooth=!1}),[o,r,a]}function H(e){const{resultset:t,metadata:n}=e,o=[];return t.forEach(e=>{const t={};e.forEach((e,o)=>{t[n[o].colName]=e}),o.push(t)}),o}function J(e,t){const n={...e};return Object.keys(t).forEach(o=>{Object.prototype.hasOwnProperty.call(t,o)&&("series"===o&&Array.isArray(t[o])?n[o]=t[o].map((t,n)=>({...Array.isArray(e[o])&&e[o][n]||{},...t})):"object"!=typeof t[o]||null===t[o]||Array.isArray(t[o])?e[o]!==t[o]&&(n[o]=t[o]):n[o]=J(e[o]||{},t[o]))}),n}function G(e,t){const n=()=>{e.forEach(e=>{e.id in t&&Object.entries(t[e.id]).forEach(n=>{const o=n[0],a=n[1];"object"==typeof a?a.className?document.querySelector(a.className).className=e[o]:a.element&&a.format&&(document.querySelector(a.element).textContent=t[e.id][o].format(e[o])):document.querySelector(a).textContent=e[o]})})};try{n()}catch(e){document.body.addEventListener("MainContentLoadedCustom",()=>{n()})}}function Y(e,t){const n=H(e),o=[];let a=null;return n.forEach(e=>{const n=e[t];"number"!=typeof n||Number.isNaN(n)||o.push(n)}),o.length>0&&(a=Math.max(...o)),a}function U(e,t){const n=document.querySelector(e);n?n.textContent=t:console.warn(`Elemento ${e} no encontrado en el DOM`)}function X(e,t=!0){const n={Cont:[],Mob:[]};return e.forEach(e=>{"is-res-001-kgs-contenidors"===e[0]&&"total"===e[1]&&(t?n.Cont.push([e[3],e[4],e[2]]):n.Cont.push([e[3],e[2]])),"Mobles"===e[1]&&(t?n.Mob.push([e[3],e[4],e[2]]):n.Mob.push([e[3],e[2]]))}),n}const Z=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],K=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],Q=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],ee=["Dom","Lun","Mar","Mié","Juv","Vie","Sáb"],te=["Do","Lu","Ma","Mi","Ju","Vi","Sá"];function ne(e){const t=e.resultset.map(e=>e[0]);return this.dashboard.fireChange(this.parameter,t),e}function oe(e){for(const t of e)if(Array.isArray(t)){if(!oe(t))return!1}else if("All"!==t)return!1;return!0}function ae(e,t,n,o){return oe(t)?(e.queryDefinition.dataAccessId=n,e.dashboard.setParameter(e.parameter,["All"])):e.queryDefinition.dataAccessId=o,!0}function re(e){return e.dashboard.setParameter(e.parameter,["All"]),!0}function ie(e){e.forEach(e=>{Dashboards.fireChange(e,["All"])})}function se(e="Todos"){return{input:{root:{id:"All"},indexes:{id:0,label:0}},component:{Root:{strings:{isDisabled:"No disponible",allItems:e,noItems:"Ninguno",btnApply:"Aceptar",btnCancel:"Cancelar"}},Group:{Strings:{allItems:"Todos",noItems:"Ninguno",btnApply:"Aceptar",btnCancel:"Cancelar"}}}}}function le(e="Todos"){const t=se(e);return t.input.indexes.id=1,t.input.indexes.label=0,t}function ce(e,t,n,o){const a=Dashboards.getParameterValue(n),r=Dashboards.getParameterValue(o);return Dashboards.fireChange(e,[a]),Dashboards.fireChange(t,[r]),!0}function de(e,t){const n=Dashboards.getParameterValue(t);return Dashboards.fireChange(e,[n]),!0}function ue(e,t){Dashboards.fireChange(t,e.resultset[0][0])}function me(e,t){const n=Dashboards.getParameterValue(t),o=e.parameter;""!==n&&e.dashboard.setParameter(o,[n])}function fe(e){e.regional.es={monthNames:Z,abbreviatedMonthNames:K,dayNames:Q,abbreviatedDayNames:ee,dayNamesMin:te,weekHeader:"Sm",firstDay:1,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},e.setDefaults(e.regional.es)}function pe(e,t){const n=Dashboards.getParameterValue(t);return Dashboards.fireChange(e,Array.isArray(n)?n:[n]),!0}function he(e,t,n,o=0){const a=e.resultset.slice(0,n).map(e=>e[o]);return Dashboards.setParameter(t,a),e}function ge(e,t,n){const o=Array.isArray(t)?t:[t];Dashboards.fireChange(e,o);const a=Dashboards.getComponent(n);a&&a.update()}function ye(e,t){return N(e,e=>new Tabulator(e,t))}function be(e,t){let n=e.getValue();return n.length>t&&(n=`${n.substr(0,t)}<br>${n.substr(t)}`),n}function ve(e,t){const n=e.getValue().split(" ");let o="",a="";return n.forEach(e=>{(a+e).length<=t?a+=`${e} `:(o+=`${a}<br>`,a=`${e} `)}),o+=`${a}<br>`,o}function Se(e,t){"expand"===t?e.treeExpand():e.treeCollapse();const n=e.getTreeChildren();n.length>0&&n.forEach(e=>{e.getTreeChildren().length>0&&Se(e,t)})}function Ee(e,t){e.getRows().forEach(e=>{e.getTreeChildren().length>0&&Se(e,t)})}function Ae(e,t,n,o){const a=[];return Object.keys(e).forEach(r=>{if(Object.prototype.hasOwnProperty.call(e,r)){const i=e[r],s={[t]:i[0],_children:[]};i.shift(),i.forEach((e,a)=>{const r={[t]:n[a],[o]:e};s._children.push(r)}),a.push(s)}}),a}function Ce(e){let t=!0;return e.getGroups().forEach(e=>{e._group.visible&&(t=!1)}),t}function Me(e,t,n){const o=document.getElementById(n),a=o.cloneNode(!0);o.parentNode.replaceChild(a,o),a.addEventListener("click",()=>{e.download("csv",`${t}.csv`,{delimiter:";",bom:!0})})}function xe(e,t,n){const o=document.getElementById(n),a=o.cloneNode(!0);o.parentNode.replaceChild(a,o),a.addEventListener("click",()=>{const n=e.getRows().map(e=>e.getData()),o=e.getColumns(),a={};o.forEach((e,t)=>{const o=e.getField();o&&n.every(e=>{const t=e[o];return null==t||/^-?\d+([.,]\d+)?$/.test(t.toString().trim())})&&(a[t]={halign:"right"})}),e.download("pdf",`${t}.pdf`,{title:t,rowCalcStyles:{fontSize:8,fontStyle:"bold"},autoTable:{styles:{fontSize:8,lineWidth:.1,lineColor:[200,200,200]},headStyles:{halign:"center"},columnStyles:a}})})}function De(e,t,n){const o=document.getElementById(n);o&&o.addEventListener("click",()=>{e.setGroupStartOpen(!1),e.setData(t)})}function Ne(e,t,n){const o=document.getElementById(n);o&&o.addEventListener("click",()=>{e.setGroupStartOpen(!0),e.setData(t)})}const $e={SO2:[100,200,350,500,750,751],NO2:[40,90,120,230,340,341],O3:[50,100,130,240,380,381],PM10:[20,40,50,100,150,151],PM25:[10,20,25,50,75,76]};function we(e){const t=[],n={0:"b",1:"a",2:"d",3:"m",4:"mm",5:"em",6:"",7:"nd"};function o(e,t,o){const a=document.createElement("td");if(a.setAttribute("id",e),null!=t){a.innerHTML=t;const e=function(e,t){let o;return void 0===t?o=6:"ND"===t?o=7:(o=5,e.forEach((e,n)=>{t<=e&&5===o&&(o=n)})),n[o]}(o,t);a.classList.add(e)}return a}return e.forEach(e=>{const n=e;"noData"===n.operationalstatus&&(n.so2value="ND",n.no2value="ND",n.o3value="ND",n.pm10value="ND",n.pm25value="ND");const a=document.createElement("tr"),r=document.createElement("td");r.innerHTML=n.address,a.appendChild(r),a.appendChild(o(`${n.entityid}_so2`,n.so2value,$e.SO2)),a.appendChild(o(`${n.entityid}_no2`,n.no2value,$e.NO2)),a.appendChild(o(`${n.entityid}_o3`,n.o3value,$e.O3)),a.appendChild(o(`${n.entityid}_pm10`,n.pm10value,$e.PM10)),a.appendChild(o(`${n.entityid}_pm25`,n.pm25value,$e.PM25)),t.push(a)}),t}function Le(e){document.location=`${document.documentURI.split("%3A")[0]}%3A${document.documentURI.split("%3A")[1]}%3A${document.documentURI.split("%3A")[2]}%3A${document.documentURI.split("%3A")[3]}%3A${e}`}function _e(){const e=window.location.href;let t="";return t=e.includes("localhost")?"local":e.includes("sc_valencia_pre")?"PRE":"PRO",t}function Te(e,t){document.querySelectorAll(`[${e}]`).forEach(n=>{!function(e,t,n){const o=t;if(e){const t=new XMLHttpRequest;t.onreadystatechange=function(){4===this.readyState&&(200===this.status&&(o.innerHTML=this.responseText,n&&n()),404===this.status&&(o.innerHTML="No se ha podido cargar correctamente."))},t.open("GET",e,!0),t.send()}}(n.getAttribute(e),n,t)})}function Oe(e){window.realDashboardsInit=Dashboards.init,Dashboards.init=function(){console.warn("Dashboards.init bloqueado temporalmente")},Te("include-html-cabecera",function(){!function(){const e=_e();"PRO"!==e&&(document.title+=` (${e})`)}(),function(){const e=_e();"PRO"!==e&&(document.querySelector("nav").querySelectorAll("span")[1].textContent+=` (${e})`)}()}),Te("include-html-menu"),Te("include-html-main-container",function(){document.body.dispatchEvent(new Event("MainContentLoadedCustom")),function(){const e=document.querySelector("body");e.classList.remove("inicio"),e.classList.add(document.documentURI.split("%3A")[4].match(/(.*?).wcdf/)[1])}(),e&&e()}),Te("include-html-copyright"),function(e="MainContentLoadedCustom"){document.body.addEventListener(e,()=>{try{Dashboards.init=window.realDashboardsInit,Dashboards.init()}catch(e){console.warn("No se pudo restaurar Dashboards.init; la función original no está disponible.")}},{once:!0})}()}function Fe(e,t,n,o,a,r){let i=!1,s=!1;const l=document.querySelector(e),c=document.querySelector(t),d=()=>{"undefined"!=typeof Liferay&&"ca-ES"===Liferay.ThemeDisplay.getBCP47LanguageId()?(l&&l.setAttribute("src","https://camaras.valencia.es/camaras/ocimovil.html?camara=1&lang=cas"),c&&c.setAttribute("src","https://camaras.valencia.es/camaras/ocimovil.html?lang=cas")):(l&&l.setAttribute("src","https://camaras.valencia.es/camaras/ocimovil.html?camara=1&lang=val"),c&&c.setAttribute("src","https://camaras.valencia.es/camaras/ocimovil.html?lang=val"))};function u(e=!0){const t=document.querySelector(n);e?(l&&(l.src="about:blank"),c&&(c.src="about:blank"),t.classList.add("blur"),s=!0):(t.classList.remove("blur"),d(),s=!1)}const m=e=>{new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&(s||d(),i||(i=!0,window.setTimeout(u,r)))})}).observe(e)};!function(){const{userAgent:e}=navigator;return/iPad|iPhone|iPod|Macintosh/.test(e)&&!window.MSStream}()?(l&&(l.setAttribute("sandbox","allow-scripts"),m(l)),c&&(c.setAttribute("sandbox","allow-scripts"),m(c)),document.querySelector(a).addEventListener("click",()=>{u(!1),window.setTimeout(u,r)})):document.querySelectorAll(o)[0].style.display="none"}const Ie={grid:{containLabel:!0},title:{left:"center",top:"0",textStyle:{fontSize:15,fontFamily:"Montserrat",fontWeight:500,color:"#666"}},legend:{orient:"horizontal",bottom:"0",left:"center",width:"100%",textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:400,color:"#666"}},toolbox:{show:!0,right:"0",top:"0",feature:{restore:{textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}},saveAsImage:{textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}}},emphasis:{iconStyle:{borderColor:"#ffcd00",textFill:"#666"}}},tooltip:{textStyle:{fontFamily:"Montserrat",fontSize:12}},xAxis:[{type:"category",axisLabel:{show:!0,interval:0,textStyle:{fontFamily:"Montserrat",fontSize:11}},data:[]}],yAxis:[{type:"value",alignTicks:!0,position:"right",axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400},formatter:e=>`${e}%`}},{type:"value",position:"left",axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400},formatter:e=>`${E(e)}€`}}]},Pe=(e,t)=>{t.sort((e,t)=>parseInt(e.anyo)-parseInt(t.anyo));const n={};t.forEach(t=>{const o=t[1],a=t[0];a!==e.seriesName||n[o]||(n[o]=0),a===e.seriesName&&(n[o]+=t[2])});let o=`<p>${e.seriesName}</p>`;for(const[t,a]of Object.entries(n))o+=`<div>${e.marker} ${t}: <span style="float: right; margin-left:20px;font-weight: 600;">${S(a)}</span></div>`;return o};function Be(e,t,n=void 0,o=void 0){const a=null===o?void 0:o,r=new Set(t.map(e=>e[1]));let i;const s={title:{text:"SIN TITULO",left:"center",top:"top",textStyle:{fontSize:20,fontFamily:"Montserrat",fontWeight:600,color:"#666"}},tooltip:{axisPointer:{type:"shadow"},trigger:"item",formatter:e=>Pe(e,t),textStyle:{fontFamily:"Montserrat"},position(e,t,n,o,a){const r={},i=a.contentSize[1]/2,s=a.viewSize[1],l=e[1];return l<i?r.top=10:l+i>s?r.bottom=10:r.top=l-i,e[0]<a.viewSize[0]/2?r.left=e[0]+20:r.right=a.viewSize[0]-e[0]+20,r}},legend:{padding:40,textStyle:{fontFamily:"Montserrat"}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"value",splitNumber:10,name:"SIN NOMBRE",nameLocation:"start",nameTextStyle:{fontWeight:"bold",fontFamily:"Montserrat",color:"#666",padding:-40},axisLabel:{margin:5,textStyle:{fontFamily:"Montserrat"},formatter:e=>S(e)},splitLine:{lineStyle:{color:"#DDD"}}},yAxis:{type:"category",data:Array.from(r),axisLabel:{textStyle:{fontFamily:"Montserrat"}}},series:(()=>{const e={name:"SIN NOMBRE",type:"bar",stack:"total",label:{show:!0,fontFamily:"Montserrat",fontSize:10,formatter:e=>S(Math.round(e.value))},itemStyle:void 0,emphasis:{focus:"series"},data:void 0};a&&a.itemStyle&&Array.isArray(a.itemStyle.borderColor)&&(i=[...a.itemStyle.borderColor],delete a.itemStyle.borderColor);const n=function(e){return e.reduce((e,t)=>{const n=t[0];return e[n]||(e[n]=[]),e[n].push(t),e},{})}(t),o=Object.keys(n);r.forEach(e=>{o.forEach(t=>{void 0===n[t].find(t=>t[1]===e)&&(n[t].push([n[t][0][0],e,void 0]),n[t].sort())})});const s=[];return Object.keys(n).forEach(t=>{i&&(e.itemStyle={borderColor:i.shift()}),e.name=t,e.data=n[t].map(e=>e[2]);let o={};o=void 0!==a?J(e,a):e,s.push({...o})}),s})(),toolbox:{show:!0,feature:{restore:{title:"Restablir"},saveAsImage:{title:"Desar"}},right:50}};let l={};l=void 0!==n?J(s,n):s,w(e,l)}function je(e){let t={};return t=J(Ie,e),t}function ze(e,t,n={},o={}){let r={};r=J(n,{color:["#81B1CC","#ABD9EA","#C2EEF9","#F9E2AF","#F9C780","#FDAE61","#F46D43","#FDAE61","#F9E2AF","#C2EEF9","#ABD9EA","#81B1CC"],yAxis:{data:function(){const e=new Set;return t.forEach(t=>{e.add(t[1])}),Array.from(e).sort((e,t)=>e-t)}()}});const i={itemStyle:{borderWidth:2,borderColor:["#448DAD","#89CADB","#A0DEE8","#F4D28C","#F4B569","#F79646","#F25930","#F79646","#F4D28C","#A0DEE8","#89CADB","#448DAD"]}},s=null===o?i:J(o,i),l=t;l.forEach((e,t)=>{l[t][0]=a(e[0])}),Be(e,l,r,s)}function Re(e,t=void 0){const n={title:{text:"SIN TITULO",left:"center",top:"top",padding:50,textStyle:{fontSize:14,fontFamily:"Montserrat",fontWeight:400,color:"#333"}},legend:{show:!1},grid:{top:"30%",bottom:"5%",left:"8%",right:"8%"},xAxis:{type:"value",show:!1},yAxis:{show:!1,type:"category"},tooltip:{show:!0,textStyle:{fontFamily:"Montserrat",fontWeight:"600"},appendToBody:!0,formatter:e=>P(e,!1)},series:[{type:"bar",showBackground:!0}]};let o={};o=void 0!==t?J(n,t):n,w(e,o)}function ke(e){return Math.max(...e.map(e=>Number(e[0])))}function We(e){const t=e.filter(t=>Number(t[0])===ke(e)),n=Array.from({length:12},()=>0);return t.forEach(([e,t,o])=>{const a=parseInt(t,10)-1;n[a]=o}),n}function Ve(e){const t=e.filter(t=>Number(t[0])===ke(e)-1),n=Array.from({length:12},()=>0);return t.forEach(([e,t,o])=>{const a=parseInt(t,10)-1;n[a]=o}),n}function qe(e,t,n=void 0){const o=ke(t).toString(),a=(ke(t)-1).toString();Re(e,J({title:{left:"center",top:"-12%",textStyle:{fontSize:15,fontFamily:"Montserrat"}},legend:{top:"10%",show:!0,data:[a,o],textStyle:{fontFamily:"Montserrat"}},grid:{bottom:"8%",top:"20%",right:"2%"},xAxis:[{type:"category",data:h(),interval:0,margin:10,axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400}}}],yAxis:[{type:"value",axisLabel:{formatter:e=>e.toLocaleString("es-ES"),textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400}}}],series:[{name:a,type:"bar",data:Ve(t)},{name:o,type:"bar",barGap:0,data:We(t)}]},n))}function He(e,t,n){const o=document.querySelector(t),a=document.querySelector(e);let r=!1;a.addEventListener("click",()=>{!1===r&&(r=!0,o.setAttribute("src","about:blank"),o.setAttribute("src",n),o.onload=()=>{r=!1})}),a.disabled=!1}const Je="id",Ge="fecha",Ye="value";function Ue(e,t,n,o,a="es_ES"){const[r,i]=function(e,t,n){const o=[],a=[];return e.forEach(e=>{t.includes(`${e[Je]}`)?o.push(`${e[Ge]}`):n.includes(`${e[Je]}`)&&a.push(`${e[Ge]}`)}),[o.map(e=>[e,0]),a.map(e=>[e,0])]}(e,n,o);let s="es_ES"==a?"Datos sin validar":"Dades sense validar";0===i.length&&(s="");const l={name:"Datos validados",type:"line",data:[...r,i[0]],lineStyle:{color:"#00A9A0",width:4},showSymbol:!1,tooltip:{show:!1}};let c="",d="";if(0===i.length){const t=e[e.length-1].fecha;c=t,d=t}else c=i[0][0],d=i[i.length-1][0];return[...t,l,{name:"Datos NO validados",type:"line",data:i,lineStyle:{color:"#80D4CF",width:4},showSymbol:!1,tooltip:{show:!1},markArea:{silent:!0,itemStyle:{opacity:.6,color:"#eee"},tooltip:{show:!1},label:{color:"#333",fontStyle:"normal",fontWeight:"400",fontFamily:"Montserrat",fontSize:11},data:[[{name:s,xAxis:c,yAxis:0},{name:"end",xAxis:d,yAxis:Math.max(...e.filter(e=>null!==e[Ye]).map(e=>parseInt(`${e[Ye]}`,10)))}]]}}]}function Xe(e,t,n=void 0){w(e,J({grid:{left:"2.5%",right:"5%",bottom:"70",top:"150",containLabel:!0},title:{left:"center",top:"top",textStyle:{fontSize:20,fontFamily:"Montserrat",fontWeight:600,color:"#666"}},legend:{type:"plain",top:"50",width:"98%",textStyle:{fontFamily:"Montserrat"}},tooltip:{trigger:"axis",show:!0,formatter:e=>T(e),textStyle:{fontFamily:"Montserrat"}},xAxis:{type:"category",boundaryGap:!1,splitLine:{show:!1},axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",color:"#666"}}},yAxis:{type:"value",nameLocation:"end",nameGap:"0",nameTextStyle:{fontFamily:"Montserrat",fontWeight:"500",padding:[-25,0,0,-48],margin:0,align:"left",verticalAlign:"top",width:"auto"},scale:!0,splitNumber:"6",axisLabel:{margin:10,textStyle:{fontSize:10,fontFamily:"Montserrat",color:"#666"}}},dataZoom:{end:100,borderColor:"#eee",fillerColor:"rgba(0,0,0,.05)",textStyle:{fontSize:10,fontFamily:"Montserrat",color:"#333",textBorderColor:"#fff",textBorderWidth:3,fontWeight:"600"},selectedDataBackground:{lineStyle:{color:"#333"},areaStyle:{color:"#ffcd00"}},dataBackground:{backgroundColor:"rgba(0,0,0,1)",lineStyle:{color:"#333"},areaStyle:{color:"rgba(0,0,0,0.5)"}},handleStyle:{color:"rgba(0,0,0,0.2)"},moveHandleStyle:{color:"rgba(0,0,0,0.3)"},emphasis:{handleStyle:{color:"rgba(255,205,0,1)"},moveHandleStyle:{color:"rgba(255,205,0,1)"}}},toolbox:{feature:{restore:{title:"Restablir"},saveAsImage:{title:"Desar"}},right:"1%",top:"0%"},series:t},n))}return t})(),e.exports=t()}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";n.r(o),n.d(o,{callesCongestionadas:()=>s,callesCortadas:()=>i,echartIncidenciasPorEstadoPie:()=>g,echartIntervencionesTotalesPie:()=>h,initializeUI:()=>_,intervencionesPoliciales:()=>p,medioambienteAlertasDiarias:()=>D,medioambienteAlertasHorarias:()=>x,medioambienteClima:()=>E,medioambienteEstadoCalidadAire:()=>C,sensoresRuido:()=>N,setFechaDatos:()=>$,setToken:()=>w,top3IncidenciasPorTipologia:()=>y,traficoAccesosCiudad:()=>b,traficoAccesosCiudadDetalle:()=>v,traficoPuntosMedida:()=>S});var e=n(725);const t=e=>!Number.isNaN(Number(e)),a=(e,n=!0)=>{const o=e;if(!t(o.textContent))return;if(o.classList.add((e=>{const t=Number(e.trim());return 0===t?null:t>0?"pos":"neg"})(e.textContent)),o.textContent=(e=>{return t=e.textContent,Number(t.trim())>0?e.textContent:e.textContent.replace("-","");var t})(e),!n)return;const a=document.createElement("span");a.textContent="%",e.append(a)},r=(e,t,n,o=!1)=>{if(!Array.isArray(e)||0===e.length)return;const{idPrefijo:r,camposLeft:i,camposVariacion:s}=n;t.innerHTML="";const l=i[1]?e[0][i[1].campo]:0;e.forEach((e,c)=>{const d=c+1,u=document.createElement("li");u.id=`${r}-${d}`,u.className="list-item";const m=document.createElement("div");m.className="datos";const f=((e,t,n,o)=>{const a=document.createElement("div");return a.className="left",t.forEach(t=>{const r=document.createElement("div");let i;if(r.className=t.clase,r.id=`${n}-${o}-${t.idSufijo}`,"campo"in t?(i=e[t.campo],t.format&&(i=t.format(i))):"texto"in t&&(i=t.texto),r.textContent=i,t.span){const e=document.createElement("span");e.textContent=t.span,r.append(e)}a.append(r)}),a})(e,i,r,d),p=((e,t,n,o)=>{const r=document.createElement("div");return r.className="changes",t.forEach(t=>{let i=!0;"aplicarEstilosVariacion"in t&&(i=t.aplicarEstilosVariacion);let s=!0;"mostrarPorcentaje"in t&&(s=t.mostrarPorcentaje),r.append(((e,t,n,o="value",r=!0,i=!0)=>{const s=document.createElement("div");if(s.className="mini",e){const t=document.createElement("div");t.className="label",t.textContent=e,s.append(t)}const l=document.createElement("div");return l.id=n,l.classList.add(o),l.textContent=t,r&&a(l,i),s.append(l),s})(t.label,e[t.campo],`${n}-${o}-${t.idSufijo}`,t.clase,i,s))}),r})(e,s,r,d);if(m.append(f,p),n.extra){const t=n.extra(e,d);t&&u.append(t)}if(u.append(m),o){const t=((e,t)=>{const n=document.createElement("div");return n.className="progress",n.style.width=100*e/t+"%",n})(e[i[1].campo],l);u.append(t)}t.append(u)})};function i(t){const n={"TOTAL CALLES CORTADAS":{num_ayer:{element:"#calles-cortadas-num",format:e=>Number(e).toLocaleString("de-DE")},diferencia_dia_anterior:"#calles-cortadas-num-ayer",diferencia_semana_anterior:"#calles-cortadas-num-semana-prev"}},o=(0,e.resultsetWithFields)(t);(0,e.printDataInHTMLElements)(o,n);const r=document.getElementById("calles-cortadas-num-ayer");a(r,!1);const i=document.getElementById("calles-cortadas-num-semana-prev");a(i,!1)}function s(t){const n=(0,e.resultsetWithFields)(t).sort((e,t)=>t.minutos_ayer-e.minutos_ayer),o=document.getElementById("calles-congestionadas-trafico"),a=o.querySelector("ul");if(!n||0===n.length){o.querySelector("p").classList.add("hidden");const e=document.createElement("p");return e.textContent="Ayer no hubo calles congestionadas.",void o.appendChild(e)}r(n,a,{idPrefijo:"calle-cong",camposLeft:[{texto:"AYER",clase:"label",idSufijo:"label"},{campo:"minutos_ayer",clase:"number",idSufijo:"minutos",format:e=>e.toLocaleString("de-DE"),span:"min."}],camposVariacion:[{label:"COMPARACIÓN vs ANTEAYER",campo:"variacion_dia_anterior",idSufijo:"var-dia"},{label:"vs SEMANA PASADA",campo:"variacion_semana_anterior",idSufijo:"var-semana"}],extra:(e,t)=>{const n=document.createElement("div");return n.className="name",n.id=`calle-cong-${t}-nombre`,n.textContent=e.id,n}}),a.querySelectorAll('[id$="var-dia"], [id$="var-semana"]').forEach(e=>{"Sin congestión"===e.textContent.trim()&&e.classList.add("no-congestion")})}const l={es_ES:new Map([["download","Descargar"],["intervenciones_totales","INTERVENCIONES TOTALES"],["intervenciones","intervenciones"],["tipologia_nivel","TIPOLOGÍA NIVEL"],["incidencias","incidencias"],["incidencias_totales","INCIDENCIAS TOTALES"]]),ca_ES:new Map([["download","Desar"],["intervenciones_totales","INTERVENCIONS TOTALS"],["intervenciones","intervencions"],["tipologia_nivel","TIPOLOGIA NIVELL"],["incidencias","incidències"],["incidencias_totales","INCIDÈNCIES TOTALS"]])},c={es_ES:new Map([["alerta","Alerta"],["aviso","Aviso"],["preaviso","Preaviso"],["avisos_diarios","Promedio diario del día anterior > {umbral} µg/m³ en 2 o más estaciones."],["avisos_horarios","Promedio horario > {umbral} µg/m³ durante 2 horas consecutivas en 2 o más estaciones"]]),ca_ES:new Map([["alerta","Alerta"],["aviso","Avís"],["preaviso","Preavís"],["avisos_diarios","Mitjana diària del dia anterior > {umbral} µg/m³ en 2 o més estacions."],["avisos_horarios","Mitjana horària > {umbral} µg/m³ durant 2 hores consecutives en 2 o més estacions"]])},d="es_ES",u={naranjaPalido:"#F1AB86",tealPalido:"#48A9A6",amarilloPalido:"#ffbf69",azulPalido:"#4BA3C3",cranberryPalido:"#e56b6f",marinoPalido:"#284B63",naranja:"#F96E46",teal:"#307473",amarillo:"#F6AE2D",azulCeruleo:"#05668d",cranberry:"#A23E48",marino:"#0B3948",verdeClaro:"#6a9c81",tealApagado:"#7AA8A7"},m={color:Object.values(u),grid:{left:"1%",right:"1%",bottom:"2%",top:"20%",containLabel:!0},title:{show:!1,text:l[d].get("intervenciones_totales"),subtext:`${l[d].get("tipologia_nivel")} 1`,left:"center",top:"0",itemGap:5,textStyle:{fontSize:15,fontFamily:"Montserrat",fontWeight:500,color:"#666"},subtextStyle:{fontFamily:"Montserrat",fontSize:12,fontWeight:400,color:"#666",width:"100%"}},legend:{orient:"vertical",top:"middle",left:"right",selectedMode:!1,textStyle:{fontSize:"11",fontFamily:"Montserrat",fontWeight:"400",color:"#333"}},toolbox:{show:!1,right:"0",top:"0",emphasis:{iconStyle:{borderColor:"#ffcd00",textFill:"#666"}},feature:{saveAsImage:{title:l[d].get("download"),textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}}}},tooltip:{trigger:"item",confine:!0,textStyle:{fontFamily:"Montserrat",fontSize:12,fontWeight:"500"},formatter:t=>`<b style="color: #666;">${(0,e.capitalizarTexto)(t.name)}</b><br />${(0,e.addPointInteger)(t.value)} ${l[d].get("intervenciones")}`},series:[{type:"pie",radius:["0","80%"],center:["23%","50%"],startAngle:0,data:[],label:{show:!0,position:"inside",formatter:"{c0}",distanceToLabelLine:0,textStyle:{fontFamily:"Varela Round",fontSize:15,lineHeight:18}},labelLine:{show:!1,length:10},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]},f={color:[u.cranberryPalido,u.tealApagado],grid:{left:"0",right:"0",bottom:"0",top:"0",containLabel:!0},title:{show:!1},legend:{show:!1},toolbox:{show:!1},tooltip:{trigger:"item",confine:!0,textStyle:{fontFamily:"Montserrat",fontSize:12,fontWeight:"500"},formatter:t=>`<b style="color: #666;">${(0,e.capitalizarTexto)(t.name)}</b><br />${(0,e.addPointInteger)(t.value)} ${l[d].get("incidencias")}`},series:[{type:"pie",radius:["0","80%"],center:["40%","50%"],startAngle:0,data:[],itemStyle:{borderWidth:1,borderColor:u.cranberryPalido},label:{show:!0,position:"inside",formatter:"{c0}",distanceToLabelLine:0,textStyle:{fontFamily:"Varela Round",fontSize:15,lineHeight:18}},labelLine:{show:!1},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};function p(t){const n={"TOTAL INTERVENCIONES":{num_ayer:{element:"#interv-pol-total",format:e=>Number(e).toLocaleString("de-DE")},variacion_dia_anterior:"#interv-pol-var-dia",variacion_semana_anterior:"#interv-pol-var-semana"}},o=(0,e.resultsetWithFields)(t);(0,e.printDataInHTMLElements)(o,n);const r=document.getElementById("interv-pol-var-dia");a(r);const i=document.getElementById("interv-pol-var-semana");a(i)}function h(t,n){const o=JSON.parse(JSON.stringify(m));o.series[0].label.formatter=m.series[0].label.formatter,o.tooltip.formatter=m.tooltip.formatter;const a="chart-intervenciones-ayer",r="no-data-intervenciones-ayer",i=(0,e.resultsetWithFields)(n);0===i.length?(0,e.printNoDataChart)(`#${a}`,`#${r}`):(0,e.printDataChart)(`#${r}`,`#${a}`);const s=i.filter(e=>"TOTAL INTERVENCIONES"!==e.id).map(e=>({name:e.id,value:Number(e.num_ayer)}));o.series[0].data=s,(0,e.initChart)(a,o)}function g(t){const n=JSON.parse(JSON.stringify(f));n.series[0].label.formatter=f.series[0].label.formatter,n.tooltip.formatter=f.tooltip.formatter;const o="chart-incid-ciudadanas-estado-ayer",a="no-data-incid-ciudadanas-estado-ayer",i=(0,e.resultsetWithFields)(t);0===i.length?(0,e.printNoDataChart)(`#${o}`,`#${a}`):(0,e.printDataChart)(`#${a}`,`#${o}`);const s=i.map(e=>({name:e.id,value:Number(e.num_incidencias_ayer)}));n.series[0].data=s,(0,e.initChart)(o,n);const l=document.getElementById("list-incidencias-ciudadanas-estado"),c=l.querySelector("ul");if(!i||0===i.length){const e=document.createElement("p");return e.textContent="Ayer no hubo incidencias.",void l.appendChild(e)}r(i,c,{idPrefijo:"estado-incidencia",camposLeft:[{campo:"id",clase:"value",idSufijo:"estado"}],camposVariacion:[{label:"COMPARACIÓN vs ANTEAYER",campo:"diferencia_dia_anterior",idSufijo:"var-dia",mostrarPorcentaje:!1},{label:"vs SEMANA PASADA",campo:"diferencia_semana_anterior",idSufijo:"var-semana",mostrarPorcentaje:!1}]})}function y(t){const n=(0,e.resultsetWithFields)(t),o=document.getElementById("incid-ciudadanas-tipologia-top-3"),a=o.querySelector("ul");if(!n||0===n.length){const e=document.createElement("p");return e.textContent="No hay datos disponibles.",void o.appendChild(e)}r(n,a,{idPrefijo:"tipo-incidencia",camposLeft:[{campo:"id",clase:"name",idSufijo:"tipologia"}],camposVariacion:[{campo:"num_incidencias_ayer",idSufijo:"num",clase:"number",aplicarEstilosVariacion:!1},{campo:"diferencia_dia_anterior",idSufijo:"var-dia",mostrarPorcentaje:!1},{campo:"diferencia_semana_anterior",idSufijo:"var-semana",mostrarPorcentaje:!1}]})}function b(t){const n={"TOTAL VEHICULOS/HORA EN EL DIA":{veh_ayer:{element:"#accesos-traf-vehiculos",format:e=>Number(e).toLocaleString("de-DE")},variacion_dia_anterior:"#accesos-traf-var-dia",variacion_semana_anterior:"#accesos-traf-var-semana"}},o=(0,e.resultsetWithFields)(t);(0,e.printDataInHTMLElements)(o,n);const r=document.getElementById("accesos-traf-var-dia");a(r);const i=document.getElementById("accesos-traf-var-semana");a(i)}function v(t){const n=(0,e.resultsetWithFields)(t),o=document.getElementById("accesos-trafico-detalle"),a=document.getElementById("accesos-trafico-detalle-lista");if(!n||0===n.length){const e=document.createElement("p");return e.textContent="No hay datos disponibles.",void o.appendChild(e)}const i=n.filter(e=>"TOTAL VEHICULOS/HORA EN EL DIA"!==e.id).sort((e,t)=>t.veh_ayer-e.veh_ayer);r(i,a,{idPrefijo:"acceso",camposLeft:[{campo:"id",clase:"name",idSufijo:"nombre"},{campo:"veh_ayer",clase:"number",idSufijo:"vehiculos",format:e=>e.toLocaleString("de-DE")}],camposVariacion:[{label:"COMPARACIÓN vs ANTEAYER",campo:"variacion_dia_anterior",idSufijo:"var-dia"},{label:"vs SEMANA PASADA",campo:"variacion_semana_anterior",idSufijo:"var-semana"}]},!0)}function S(t){const n=(0,e.resultsetWithFields)(t),o=document.getElementById("pm-trafico"),a=o.querySelector("ul");if(!n||0===n.length){const e=document.createElement("p");return e.textContent="No hay datos disponibles.",void o.appendChild(e)}r(n,a,{idPrefijo:"pm",camposLeft:[{campo:"id",clase:"name",idSufijo:"nombre"},{campo:"veh_ayer",clase:"number",idSufijo:"vehiculos",format:e=>e.toLocaleString("de-DE")}],camposVariacion:[{label:"COMPARACIÓN vs ANTEAYER",campo:"variacion_dia_anterior",idSufijo:"var-dia"},{label:"vs SEMANA PASADA",campo:"variacion_semana_anterior",idSufijo:"var-semana"}]},!0)}function E(n){const o=(0,e.resultsetWithFields)(n),a=document.getElementById("sensores-clima").querySelector("ul");if(a.innerHTML="",!o||0===o.length){const e=document.createElement("p");return e.textContent="No hay datos disponibles.",void a.appendChild(e)}const r=o[0];[{id:"clima-temp-media",campoBbdd:"temperatura_media",label:"Temperatura",unidad:"°C"},{id:"clima-humedad-media",campoBbdd:"humedad_media",label:"Humedad",unidad:"%"},{id:"clima-precip-acumulada",campoBbdd:"precipitacion_acumulada",label:"Precipitación acumulada",unidad:"mm"},{id:"clima-vel-viento-media",campoBbdd:"velocidad_viento_media",label:"Velocidad del viento",unidad:"km/h"}].forEach(({id:e,campoBbdd:n,label:o,unidad:i})=>{const s=document.createElement("li");s.id=e;const l=document.createElement("div");l.className="label",l.textContent=o;const c=document.createElement("div");var d;c.className="value",c.textContent=(d=r[n],t(d)?Number(d).toLocaleString("es-ES"):d);const u=document.createElement("div");u.className="medida",u.textContent=i,s.append(l,c,u),a.appendChild(s)})}const A=new Map([["NO2alerta",400],["NO2aviso",200],["NO2preaviso",180],["PM10aviso",80],["PM10preaviso",50]]);function C(t){const n=["Extremadamente Desfavorable","Muy Desfavorable","Desfavorable","Regular","Razonablemente Buena","Buena"],o=(0,e.resultsetWithFields)(t).map(e=>{const t=n.indexOf(e.calidad_ambiental_ciudad),o=-1!==t?"aire-"+(6-t):"";return{...e,calidad_ambiental_ciudad_clase:o}});(0,e.printDataInHTMLElements)(o,{"ESTADO CALIDAD AIRE":{calidad_ambiental_ciudad:{element:"#estado-calidad-aire",format:e=>e},calidad_ambiental_ciudad_clase:{className:"#estado-calidad-aire"}}})}const M=(e,t,n,o)=>{const a=document.createElement("p");a.className=e;const r=document.createElement("strong");return r.textContent=`${c[d].get(e)} ${t}:`,a.appendChild(r),a.append(`${c[d].get(n).replace("{umbral}",A.get(o))}`),a};function x(t){const n=(0,e.resultsetWithFields)(t),o=document.getElementById("alertas-contaminantes-est-aire");if(!n||0===n.length)return;o.classList.remove("hidden");const a=n[0],r="avisos_horarios",i="NO2";a.cant_alertas>1&&o.appendChild(M("alerta",i,r,"NO2alerta")),a.cant_avisos>1&&o.appendChild(M("aviso",i,r,"NO2aviso")),a.cant_preavisos>1&&o.appendChild(M("preaviso",i,r,"NO2preaviso"))}function D(t){const n=(0,e.resultsetWithFields)(t),o=document.getElementById("alertas-contaminantes-est-aire");if(!n||0===n.length)return;o.classList.remove("hidden");const a=n[0],r="avisos_diarios",i="PM10";a.cant_avisos>1&&o.appendChild(M("aviso",i,r,"PM10aviso")),a.cant_preavisos>1&&o.appendChild(M("preaviso",i,r,"PM10preaviso"))}function N(t,n){const o=(0,e.resultsetWithFields)(t);o&&0!==o.length&&(function(e,t){function n(e){const t=document.createElement("td");return t.id=e,t.textContent=0,t}[...new Set(t.map(e=>e.areaserved))].forEach(t=>{const o=`estacion-${t.toLowerCase()}`;if(document.getElementById(o))return;const a=document.createElement("tr");a.id=o;const r=n(`${o}-nombre`);r.textContent=t,a.appendChild(r),a.appendChild(n(`${o}-cant-manana`)),a.appendChild(n(`${o}-cant-tarde`)),a.appendChild(n(`${o}-cant-noche`)),e.appendChild(a)})}(document.querySelector("#tabla-sensores-ruido > tbody"),o),function(e,t){const n=e.reduce((e,t)=>(e[t.areaserved]=(e[t.areaserved]||0)+1,e),{});Object.entries(n).forEach(([e,n])=>{const o=`estacion-${e.toLowerCase()}-cant-${t}`,a=document.getElementById(o);a&&(a.textContent=n)})}(o,n))}function $(t){const n=(0,e.resultsetWithFields)(t).find(e=>"TOTAL INTERVENCIONES"===e.id).fecha;(0,e.initElement)("fecha-datos",t=>{t.textContent=(0,e.separateDayMonthYearToSlash)(n)})}function w(t){const n=(0,e.resultsetWithFields)(t)[0].token;if(!n)throw new Error("No se pudo obtener el token desde base de datos");!function(e){try{document.querySelector("#if-estados-trafico").setAttribute("src",`https://geoportal.valencia.es/portal/apps/webappviewer/index.html?id=fdcb9a8cbde94431a72f6b45f4c96185&mobileBreakPoint=300&token=${e}`)}catch(e){console.error("No se pudo cargar el token, y por tanto, no se han podido mostrar el mapa. Error:",e)}}(n)}function L(e){return e instanceof HTMLButtonElement}function _(){(0,e.initElementsByClass)("guia",e=>{L(e)&&e.addEventListener("click",()=>{document.body.classList.add("historia")})}),(0,e.initElementsByClass)("info",e=>{L(e)&&e.addEventListener("click",()=>{document.body.classList.remove("historia")})})}})(),o})());
2
2
  //# sourceMappingURL=inicio.js.map