@vlci/cdmciutat 34.0.0 → 35.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/energia.js +1 -1
- package/dist/js/mediAmbient.js +1 -1
- package/package.json +1 -1
package/dist/js/energia.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.energia=e():t.energia=e()}(self,(()=>(()=>{var t={2725:t=>{var e;self,e=()=>(()=>{"use strict";var t={d:(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{MONTHS_YEAR:()=>r,MONTHS_YEAR_SHORT:()=>a,TEXTS_COMMON:()=>i,THRESHOLDS:()=>St,addPointInteger:()=>y,buildCamarasTrafico:()=>Dt,buildTableCalidadAire:()=>xt,calculateMaxYAxis:()=>W,calculatePentahoPath:()=>Mt,calculateXAxisStart:()=>$,checkAllGroupsCollapsed:()=>gt,checkAndTransformMaxValue:()=>v,configureDataBar:()=>P,configureDataGaugeCommon:()=>z,configureDataGaugeMonthCommon:()=>k,configureDataLine:()=>_,configureDataValidate:()=>Rt,configureLinesChartValidates:()=>Vt,convertToLanguageSelectorDateRange:()=>st,convertToTableTreeView:()=>pt,downloadCSVTable:()=>yt,downloadPDFTable:()=>bt,formatCellMultiplesLines:()=>ft,formatDayMonthYear:()=>u,formatDecimalNumberfromDotToComma:()=>x,formatMilMillionEuros:()=>L,formatMonthAnyo:()=>c,formatName:()=>A,formatNameHeaderColumn:()=>dt,formatRoundTooltip:()=>T,formatShortMonthShortYear:()=>f,formatShortMonthYear:()=>d,formatToMillions:()=>b,formatToTons:()=>S,formatTooltip:()=>E,formatTooltipPie:()=>N,formatTrimestre:()=>m,formatWithPrefix:()=>M,getEnvironment:()=>vt,getMaxFieldNumberFromData:()=>V,getMonth:()=>n,getMonthList:()=>h,getSelectCommonOptions:()=>ot,getSelectTwoColumnsOptions:()=>nt,initBarChart:()=>Nt,initBarChartComparationMonth:()=>It,initChart:()=>D,initElement:()=>C,initStackedBarChart:()=>Et,initStackedBarChartMonthSeries:()=>Wt,initTable:()=>ut,initValueDefaultDate:()=>it,initialCalls:()=>Ct,loadIframeOnClickEvent:()=>_t,printDataChart:()=>w,printDataInHTMLElements:()=>R,printNoDataChart:()=>F,resetFilter:()=>et,resetFilterDate:()=>at,resetFilterDates:()=>rt,resetFilterToDefault:()=>ct,resultsetWithFields:()=>B,selectConfigDatasource:()=>Q,selectConfigDatasourceAllValue:()=>tt,selectFilterAll:()=>Z,selectValueDefaultInFilter:()=>lt,separateDayMonthYearToSlash:()=>l,splitDataset:()=>H,subtractOneDay:()=>p,subtractOneMonth:()=>g,traverseRows:()=>ht,updateDomElement:()=>G,updateObject:()=>J,updateStackedBarOptions:()=>$t});const o={"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 n(t){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(t.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"]])},a={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"]])},i={es_ES:new Map([["last_update","Última actualización"]]),ca_ES:new Map([["last_update","Última actualització"]])};function l(t){return t.substring(6,8)+"/"+t.substring(4,6)+"/"+t.substring(0,4)}function s(t){return[t.substring(0,4),o[t.substring(4,6)]]}function c(t){const[e,o]=s(t);return`${o} ${e}`}function u(t){const[e,n,r]=function(t){return[t.substring(0,4),o[t.substring(4,6)],t.substring(6,8)]}(t);return`${r} ${n} ${e}`}function d(t){const[e,o]=s(t);return`${o.substring(0,3)} ${e}`}function f(t){const[e,o]=s(t);return`${o.substring(0,3)} '${e.substring(2,4)}`}function m(t){const[e,o]=t.split("-");return`${parseFloat(o)/3}T ${e}`}function h(t,e){const o=t[e];return Array.from(o.values()).map((t=>t.slice(0,3)))}function p(t){const e=Math.floor(t/1e4);let o=new Date(e,t%1e4/100-1,t%100);return o.setDate(o.getDate()-1),`${o.getFullYear()}${(o.getMonth()+1).toString().padStart(2,"0")}${o.getDate().toString().padStart(2,"0")}`}function g(t){let e;const o=new Date(Math.floor(t/100),t%100-1,0);return e=`${o.getFullYear()}${(o.getMonth()+1).toString().padStart(2,"0")}`,e}function y(t,e=2){let o=navigator.language||navigator.userLanguage;o=o.length<=2?`${o}-${o.toUpperCase()}`:o;const n={minimumFractionDigits:0,maximumFractionDigits:e};return"es-ES"===o?t.toLocaleString("de-DE",n):t.toLocaleString(o,n)}function b(t){const e=1e6;return t>=e?t/e+"M":t.toString()}function S(t){return t>=1e3?t/1e3+" Tn":t.toString()}function x(t){return("string"==typeof t?parseFloat(t):t).toLocaleString("de-DE",{minimumFractionDigits:2,maximumFractionDigits:2})}function M(t){return t>=1e6?{value:(t/1e6).toFixed(2),unit:"G"}:t>=1e3?{value:(t/1e3).toFixed(2),unit:"M"}:{value:t.toFixed(2),unit:"k"}}function v(t,e){return"GWh"===e?{value:parseFloat((t/1e6).toFixed(2)),unit:"GWh"}:"MWh"===e?{value:parseFloat(t/1e3).toFixed(2),unit:"MWh"}:{value:parseFloat(t).toFixed(2),unit:"kWh"}}function A(t,e=29){if(t.length>=e){const o=t.split(" ");let n="",r="";return o.forEach((t=>{`${n} ${t}`.length<=e?n+=(n?" ":"")+t:(r+=`${n}\n`,n=t)})),r+=n,r}return t}function C(t,e,o="MainContentLoadedCustom"){let n=document.getElementById(t);return n?Promise.resolve(e(n)):new Promise((r=>{document.body.addEventListener(o,(()=>{n=document.getElementById(t),n?r(e(n)):(console.error(`El elemento con ID ${t} aún no está disponible después del evento.`),r(null))}))}))}function D(t,e){return C(t,(t=>{const o=echarts.init(t);o.setOption(e,!0),window.addEventListener("resize",(()=>{null!=o&&void 0!==o&&o.resize()}));const n=document.getElementById("main-content");return n&&(n.addEventListener("shown.bs.collapse",(()=>{o.resize()})),n.addEventListener("hidden.bs.collapse",(()=>{o.resize()}))),o}))}function F(t,e){const o=t?document.querySelector(t):null,n=e?document.querySelector(e):null;o&&(o.hidden=!0),n&&(n.style.background="url('./build/images/nodata1.png') no-repeat top center",n.hidden=!1)}function w(t,e){const o=t?document.querySelector(t):null,n=e?document.querySelector(e):null;o&&(o.hidden=!0),n&&(n.style.background="#ffffff",n.hidden=!1)}function E(t,e=!1,o=!0,n=""){let r=`<p style="font-weight: 500;color: #565656;">${t[0].name}</p>`;return t.forEach((t=>{const a=e?Math.round(t.data):t.data,i=o?`<div style="font-weight: 400;color: #666;">${l=t.color,`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;font-weight: 500;background-color:${l}"></span>`} ${t.seriesName}: \n <span style="float: right; margin-left:20px;font-weight: 600;color: #565656;">\n ${t.data?`${y(a)} ${n}`:"-"}\n </span>\n </div>`:`<div>\n <span style="font-weight: 600;color: #565656;">${t.data?`${y(a)} ${n}`:"-"}\n </span>\n </div>`;var l;r+=i})),r}function $(t){return 100*(t-120)/t}function W(t,e){const o=Math.max(...t);return o+(e-o%e)}function N(t,e=!1){const o=`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:${t.color}"></span>`,n=e?`${t.percent}%`:y(t.value);return`<div> ${o} ${t.name} <span style="float: right; margin-left:20px;font-weight: 600;color: #333;"> ${n} </span></div>`}function T(t,e){let o=`${t.name} : `;return o+=`<span style="font-weight:500">${y(Math.round(t.value))}</span>`,e&&(o+=`<span> (${t.percent}%)</span>`),t.marker+o}function L(t){const e=1e6,o=Number(t);return o>=0&&o<e?`${y(o)} €`:o>=e?`${y(o/e)} M €`:"-"}function O(t,e,o=1){const n=Math.max(...t.map((t=>t[e])))*o;return 5e3*Math.ceil(n/5e3)}function z(t,e,o,n=30,r=15,a=30,i=-70,l=70,s=3){const c=O(t,e.data,1.1),u=l,d=o.slice(),f=[];let m=r,h=a,p=i;for(let o=0;o<t.length;o+=1)f.push({value:t[o][e.data],name:A(String(t[o][e.type]).replace(/\[.*?\]/g,"")),color:d.shift(),title:{offsetCenter:[`${String(p)}%`,`${String(m)}%`],fontFamily:"Montserrat",fontSize:n},detail:{offsetCenter:[`${String(p)}%`,`${String(h)}%`],fontFamily:"Montserrat",width:"33%",formatter:t=>y(Math.round(t))}}),p+=u,(o+1)%s==0&&(h+=a,m+=2*r,p=i);return[c,f]}function k(t,e,o,r=0){return[O(e,o.data,1),t=>function(t,e,o){const r=y(Math.round(e)),a=n(t[o][0]),i=t[o][1],l=`\n${a} ${i} : ${r}`,s=`${r}\n${a} ${i}`;return window.innerWidth<=1710?l:s}(e,t,r),[{value:e[r][o.data]}]]}function I(t,e){const{resultset:o}={resultset:t},n=new Set,r=new Set,a=o.map((([t,o,a])=>{const i=e?Math.round(a):a;return n.add(t),r.add(o),{day:o,type:t,value:i}})),i=Array.from(r.values()),l=Array.from(n.values());return l.sort(((t,e)=>t.toLowerCase().localeCompare(e.toLowerCase(),"es",{ignorePunctuation:!0}))),[l.map((t=>{const e=a.filter((e=>e.type===t)).map((({day:e,value:o})=>[e,t,o])),o=i.map((t=>{const o=e.find((([e])=>e===t));return o?o[2]:null}));return{name:t,data:o}})),l,r]}function _(t,e=[],o=!1){const[n,r,a]=I(t,o);return n.forEach((t=>{t.type="line",t.symbol="circle",t.symbolSize=6,t.smooth=.1,e.length>0&&(t.color=e.shift())})),[n,a,r]}function P(t,e,o=!1){const[n,r,a]=I(t,o);return n.forEach((t=>{t.type="bar",t.color=e.shift(),t.smooth=!1})),[n,a,r]}function B(t){const{resultset:e,metadata:o}=t,n=[];return e.forEach((t=>{const e={};t.forEach(((t,n)=>{e[o[n].colName]=t})),n.push(e)})),n}function J(t,e){const o={...t};return Object.keys(e).forEach((n=>{Object.prototype.hasOwnProperty.call(e,n)&&("series"===n&&Array.isArray(e[n])?o[n]=e[n].map(((e,o)=>({...Array.isArray(t[n])&&t[n][o]||{},...e}))):"object"!=typeof e[n]||null===e[n]||Array.isArray(e[n])?t[n]!==e[n]&&(o[n]=e[n]):o[n]=J(t[n]||{},e[n]))})),o}function R(t,e){console.log("INICIO HTML");const o=()=>{t.forEach((t=>{t.id in e&&Object.entries(e[t.id]).forEach((o=>{const n=o[0],r=o[1];"object"==typeof r?r.className?document.querySelector(r.className).className=t[n]:r.element&&r.format&&(document.querySelector(r.element).textContent=e[t.id][n].format(t[n])):document.querySelector(r).textContent=t[n]}))}))};try{o()}catch(t){document.body.addEventListener("MainContentLoadedCustom",(()=>{o()}))}}function V(t,e){const o=B(t),n=[];let r=null;return o.forEach((t=>{const o=t[e];"number"!=typeof o||Number.isNaN(o)||n.push(o)})),n.length>0&&(r=Math.max(...n)),r}function G(t,e){const o=document.querySelector(t);o?o.textContent=e:console.warn(`Elemento ${t} no encontrado en el DOM`)}function H(t,e=!0){const o={Cont:[],Mob:[]};return t.forEach((t=>{"is-res-001-kgs-contenidors"===t[0]&&"total"===t[1]&&(e?o.Cont.push([t[3],t[4],t[2]]):o.Cont.push([t[3],t[2]])),"Mobles"===t[1]&&(e?o.Mob.push([t[3],t[4],t[2]]):o.Mob.push([t[3],t[2]]))})),o}const j=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],q=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],U=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],Y=["Dom","Lun","Mar","Mié","Juv","Vie","Sáb"],X=["Do","Lu","Ma","Mi","Ju","Vi","Sá"];function Z(t){const e=t.resultset.map((t=>t[0]));return this.dashboard.fireChange(this.parameter,e),t}function K(t){for(const e of t)if(Array.isArray(e)){if(!K(e))return!1}else if("All"!==e)return!1;return!0}function Q(t,e,o,n){return K(e)?(t.queryDefinition.dataAccessId=o,t.dashboard.setParameter(t.parameter,["All"])):t.queryDefinition.dataAccessId=n,!0}function tt(t){return t.dashboard.setParameter(t.parameter,["All"]),!0}function et(t){t.forEach((t=>{Dashboards.fireChange(t,["All"])}))}function ot(t="Todos"){return{input:{root:{id:"All"},indexes:{id:0,label:0}},component:{Root:{strings:{isDisabled:"No disponible",allItems:t,noItems:"Ninguno",btnApply:"Aceptar",btnCancel:"Cancelar"}},Group:{Strings:{allItems:"Todos",noItems:"Ninguno",btnApply:"Aceptar",btnCancel:"Cancelar"}}}}}function nt(t="Todos"){const e=ot(t);return e.input.indexes.id=1,e.input.indexes.label=0,e}function rt(t,e,o,n){const r=Dashboards.getParameterValue(o),a=Dashboards.getParameterValue(n);return Dashboards.fireChange(t,[r]),Dashboards.fireChange(e,[a]),!0}function at(t,e){const o=Dashboards.getParameterValue(e);return Dashboards.fireChange(t,[o]),!0}function it(t,e){Dashboards.fireChange(e,t.resultset[0][0])}function lt(t,e){const o=Dashboards.getParameterValue(e),n=t.parameter;t.dashboard.setParameter(n,[o])}function st(t){t.regional.es={monthNames:j,abbreviatedMonthNames:q,dayNames:U,abbreviatedDayNames:Y,dayNamesMin:X,weekHeader:"Sm",firstDay:1,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},t.setDefaults(t.regional.es)}function ct(t,e){const o=Dashboards.getParameterValue(e);return Dashboards.fireChange(t,Array.isArray(o)?o:[o]),!0}function ut(t,e){return C(t,(t=>new Tabulator(t,e)))}function dt(t,e){let o=t.getValue();return o.length>e&&(o=`${o.substr(0,e)}<br>${o.substr(e)}`),o}function ft(t,e){const o=t.getValue().split(" ");let n="",r="";return o.forEach((t=>{(r+t).length<=e?r+=`${t} `:(n+=`${r}<br>`,r=`${t} `)})),n+=`${r}<br>`,n}function mt(t,e){"expand"===e?t.treeExpand():t.treeCollapse();const o=t.getTreeChildren();o.length>0&&o.forEach((t=>{t.getTreeChildren().length>0&&mt(t,e)}))}function ht(t,e){t.getRows().forEach((t=>{t.getTreeChildren().length>0&&mt(t,e)}))}function pt(t,e,o,n){const r=[];for(const a in t)if(t.hasOwnProperty(a)){const i=t[a],l={[e]:i[0],_children:[]};i.shift(),i.forEach(((t,r)=>{const a={[e]:o[r],[n]:t};l._children.push(a)})),r.push(l)}return r}function gt(t){let e=!0;return t.getGroups().forEach((t=>{t._group.visible&&(e=!1)})),e}function yt(t,e,o){const n=document.getElementById(o),r=n.cloneNode(!0);n.parentNode.replaceChild(r,n),r.addEventListener("click",(()=>{t.download("csv",`${e}.csv`,{delimiter:";"})}))}function bt(t,e,o){const n=document.getElementById(o),r=n.cloneNode(!0);n.parentNode.replaceChild(r,n),r.addEventListener("click",(()=>{t.download("pdf",`${e}.pdf`,{title:e,rowCalcStyles:{fontSize:8,fontStyle:"bold"},autoTable:{styles:{fontSize:8}}})}))}const St={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 xt(t){const e=[],o={0:"b",1:"a",2:"d",3:"m",4:"mm",5:"em",6:"",7:"nd"};function n(t,e,n){const r=document.createElement("td");if(r.setAttribute("id",t),null!=e){r.innerHTML=e;const t=function(t,e){let n;return void 0===e?n=6:"ND"===e?n=7:(n=5,t.forEach(((t,o)=>{e<=t&&5===n&&(n=o)}))),o[n]}(n,e);r.classList.add(t)}return r}return t.forEach((t=>{const o=t;"noData"===o.operationalstatus&&(o.so2value="ND",o.no2value="ND",o.o3value="ND",o.pm10value="ND",o.pm25value="ND"),"A09_CABANYAL_60m"===o.entityid&&(o.pm10value=void 0,o.pm25value=void 0);const r=document.createElement("tr"),a=document.createElement("td");a.innerHTML=o.address,r.appendChild(a),r.appendChild(n(`${o.entityid}_so2`,o.so2value,St.SO2)),r.appendChild(n(`${o.entityid}_no2`,o.no2value,St.NO2)),r.appendChild(n(`${o.entityid}_o3`,o.o3value,St.O3)),r.appendChild(n(`${o.entityid}_pm10`,o.pm10value,St.PM10)),r.appendChild(n(`${o.entityid}_pm25`,o.pm25value,St.PM25)),e.push(r)})),e}function Mt(t){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${t}`}function vt(){const t=window.location.href;let e="";return e=t.includes("localhost")?"local":t.includes("sc_valencia_pre")?"PRE":"PRO",e}function At(t,e){document.querySelectorAll(`[${t}]`).forEach((o=>{!function(t,e,o){const n=e;if(t){const e=new XMLHttpRequest;e.onreadystatechange=function(){4===this.readyState&&(200===this.status&&(n.innerHTML=this.responseText,o&&o()),404===this.status&&(n.innerHTML="No se ha podido cargar correctamente."))},e.open("GET",t,!0),e.send()}}(o.getAttribute(t),o,e)}))}function Ct(t){At("include-html-cabecera",(function(){!function(){const t=vt();"PRO"!==t&&(document.title+=` (${t})`)}(),function(){const t=vt();"PRO"!==t&&(document.querySelector("nav").querySelectorAll("span")[1].textContent+=` (${t})`)}()})),At("include-html-menu"),At("include-html-main-container",(function(){document.body.dispatchEvent(new Event("MainContentLoadedCustom")),function(){const t=document.querySelector("body");t.classList.remove("inicio"),t.classList.add(document.documentURI.split("%3A")[4].match(/(.*?).wcdf/)[1])}(),t&&t()})),At("include-html-copyright")}function Dt(t,e,o,n,r,a){let i=!1,l=!1;const s=document.querySelector(t),c=document.querySelector(e),u=()=>{"undefined"!=typeof Liferay&&"ca-ES"===Liferay.ThemeDisplay.getBCP47LanguageId()?(s&&s.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")):(s&&s.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 d(t=!0){const e=document.querySelector(o);t?(s&&(s.src="about:blank"),c&&(c.src="about:blank"),e.classList.add("blur"),l=!0):(e.classList.remove("blur"),u(),l=!1)}const f=t=>{new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting&&(l||u(),i||(i=!0,window.setTimeout(d,a)))}))})).observe(t)};!function(){const{userAgent:t}=navigator;return/iPad|iPhone|iPod|Macintosh/.test(t)&&!window.MSStream}()?(s&&(s.setAttribute("sandbox","allow-scripts"),f(s)),c&&(c.setAttribute("sandbox","allow-scripts"),f(c)),document.querySelector(r).addEventListener("click",(()=>{d(!1),window.setTimeout(d,a)}))):document.querySelectorAll(n)[0].style.display="none"}const Ft={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:t=>`${t}%`}},{type:"value",position:"left",axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400},formatter:t=>`${b(t)}€`}}]},wt=(t,e)=>{e.sort(((t,e)=>parseInt(t.anyo)-parseInt(e.anyo)));const o={};e.forEach((e=>{const n=e[1],r=e[0];r!==t.seriesName||o[n]||(o[n]=0),r===t.seriesName&&(o[n]+=e[2])}));let n=`<p>${t.seriesName}</p>`;for(const[e,r]of Object.entries(o))n+=`<div>${t.marker} ${e}: <span style="float: right; margin-left:20px;font-weight: 600;">${y(r)}</span></div>`;return n};function Et(t,e,o=void 0,n=void 0){const r=null===n?void 0:n,a=new Set(e.map((t=>t[1])));let i;const l={title:{text:"SIN TITULO",left:"center",top:"top",textStyle:{fontSize:20,fontFamily:"Montserrat",fontWeight:600,color:"#666"}},tooltip:{axisPointer:{type:"shadow"},trigger:"item",formatter:t=>wt(t,e),textStyle:{fontFamily:"Montserrat"},position(t,e,o,n,r){const a={},i=r.contentSize[1]/2,l=r.viewSize[1],s=t[1];return s<i?a.top=10:s+i>l?a.bottom=10:a.top=s-i,t[0]<r.viewSize[0]/2?a.left=t[0]+20:a.right=r.viewSize[0]-t[0]+20,a}},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:t=>y(t)},splitLine:{lineStyle:{color:"#DDD"}}},yAxis:{type:"category",data:Array.from(a),axisLabel:{textStyle:{fontFamily:"Montserrat"}}},series:(()=>{const t={name:"SIN NOMBRE",type:"bar",stack:"total",label:{show:!0,fontFamily:"Montserrat",fontSize:10,formatter:t=>y(Math.round(t.value))},itemStyle:void 0,emphasis:{focus:"series"},data:void 0};r&&r.itemStyle&&Array.isArray(r.itemStyle.borderColor)&&(i=[...r.itemStyle.borderColor],delete r.itemStyle.borderColor);const o=function(t){return t.reduce(((t,e)=>{const o=e[0];return t[o]||(t[o]=[]),t[o].push(e),t}),{})}(e),n=Object.keys(o);a.forEach((t=>{n.forEach((e=>{void 0===o[e].find((e=>e[1]===t))&&(o[e].push([o[e][0][0],t,void 0]),o[e].sort())}))}));const l=[];return Object.keys(o).forEach((e=>{i&&(t.itemStyle={borderColor:i.shift()}),t.name=e,t.data=o[e].map((t=>t[2]));let n={};n=void 0!==r?J(t,r):t,l.push({...n})})),l})(),toolbox:{show:!0,feature:{restore:{title:"Restablir"},saveAsImage:{title:"Desar"}},right:50}};let s={};s=void 0!==o?J(l,o):l,D(t,s)}function $t(t){let e={};return e=J(Ft,t),e}function Wt(t,e,o={},r={}){let a={};a=J(o,{color:["#81B1CC","#ABD9EA","#C2EEF9","#F9E2AF","#F9C780","#FDAE61","#F46D43","#FDAE61","#F9E2AF","#C2EEF9","#ABD9EA","#81B1CC"],yAxis:{data:function(){const t=new Set;return e.forEach((e=>{t.add(e[1])})),Array.from(t).sort(((t,e)=>t-e))}()}});const i={itemStyle:{borderWidth:2,borderColor:["#448DAD","#89CADB","#A0DEE8","#F4D28C","#F4B569","#F79646","#F25930","#F79646","#F4D28C","#A0DEE8","#89CADB","#448DAD"]}},l=null===r?i:J(r,i),s=e;s.forEach(((t,e)=>{s[e][0]=n(t[0])})),Et(t,s,a,l)}function Nt(t,e=void 0){const o={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:t=>T(t,!1)},series:[{type:"bar",showBackground:!0}]};let n={};n=void 0!==e?J(o,e):o,D(t,n)}const Tt="es_ES",Lt={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"]])};function Ot(t){return Math.max(...t.map((t=>Number(t[0]))))}function zt(t){const e=t.filter((e=>Number(e[0])===Ot(t))),o=Array.from({length:12},(()=>0));return e.forEach((([t,e,n])=>{const r=parseInt(e,10)-1;o[r]=n})),o}function kt(t){const e=t.filter((e=>Number(e[0])===Ot(t)-1)),o=Array.from({length:12},(()=>0));return e.forEach((([t,e,n])=>{const r=parseInt(e,10)-1;o[r]=n})),o}function It(t,e,o=void 0){const n=Ot(e).toString(),r=(Ot(e)-1).toString();Nt(t,J({title:{left:"center",top:"-12%",textStyle:{fontSize:15,fontFamily:"Montserrat"}},legend:{top:"10%",show:!0,data:[r,n],textStyle:{fontFamily:"Montserrat"}},grid:{bottom:"8%",top:"20%",right:"2%"},xAxis:[{type:"category",data:h(Lt,Tt),interval:0,margin:10,axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400}}}],yAxis:[{type:"value",axisLabel:{formatter:t=>t.toLocaleString("es-ES"),textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400}}}],series:[{name:r,type:"bar",data:kt(e)},{name:n,type:"bar",barGap:0,data:zt(e)}]},o))}function _t(t,e,o){const n=document.querySelector(e),r=document.querySelector(t);let a=!1;r.addEventListener("click",(()=>{!1===a&&(a=!0,n.setAttribute("src","about:blank"),n.setAttribute("src",o),n.onload=()=>{a=!1})})),r.disabled=!1}const Pt="id",Bt="fecha",Jt="value";function Rt(t,e,o,n,r="es_ES"){const[a,i]=function(t,e,o){const n=[],r=[];return t.forEach((t=>{e.includes(`${t[Pt]}`)?n.push(`${t[Bt]}`):o.includes(`${t[Pt]}`)&&r.push(`${t[Bt]}`)})),[n.map((t=>[t,0])),r.map((t=>[t,0]))]}(t,o,n);let l="es_ES"==r?"Datos sin validar":"Dades sense validar";0===i.length&&(l="");const s={name:"Datos validados",type:"line",data:[...a,i[0]],lineStyle:{color:"#00A9A0",width:4},showSymbol:!1,tooltip:{show:!1}};let c="",u="";if(0===i.length){const e=t[t.length-1].fecha;c=e,u=e}else c=i[0][0],u=i[i.length-1][0];return[...e,s,{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:l,xAxis:c,yAxis:0},{name:"end",xAxis:u,yAxis:Math.max(...t.filter((t=>null!==t[Jt])).map((t=>parseInt(`${t[Jt]}`,10))))}]]}}]}function Vt(t,e,o=void 0){D(t,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:t=>E(t),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:e},o))}return e})(),t.exports=e()}},e={};function o(n){var r=e[n];if(void 0!==r)return r.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,o),a.exports}o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";o.r(n),o.d(n,{echartBarEvolucioMensualAnualDesagregado:()=>h,echartConsumoVertidoMedioMesAnyo:()=>s,echartDistribucionEdificios:()=>y,echartLineEvolucioMensualAnual:()=>p,echartTop10:()=>g,getSelectCommonOptions:()=>t.getSelectCommonOptions,getSelectTwoColumnsOptions:()=>t.getSelectTwoColumnsOptions,initValueDesfaultDates:()=>b,resetFilter:()=>t.resetFilter,resetFilterDate:()=>t.resetFilterDate,resetFilterToDefault:()=>t.resetFilterToDefault,selectConfigDatasourceAllValue:()=>t.selectConfigDatasourceAllValue,selectValueDefaultInFilter:()=>S,widgetConsumoVertidoTotalMesAnyo:()=>c});var t=o(2725);const e={grid:{left:"0",right:"0",bottom:"0",top:"60",containLabel:!0},title:{text:"",subtext:"",top:"0",left:"50%",textAlign:"center",itemGap:5,textStyle:{fontSize:15,lineHeight:15,fontFamily:"Montserrat",fontWeight:500,color:"#666"},subtextStyle:{fontFamily:"Montserrat",fontSize:12,lineHeight:12,fontWeight:500,color:"#666",width:"100%"}},toolbox:{show:!0,right:"0",top:"0",feature:{saveAsImage:{title:"Descargar",textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}}},emphasis:{iconStyle:{borderColor:"#ffcd00",textFill:"#666"}}},legend:{show:!0},tooltip:{trigger:"axis",confine:!0,axisPointer:{type:"line"},textStyle:{fontFamily:"Montserrat",fontSize:12,fontWeight:500}},xAxis:{type:"category",data:[],axisLabel:{show:!0,margin:6,textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:500}}},yAxis:{type:"value",alignTicks:!0,scale:!0,axisLabel:{formatter:"",textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:400}}},series:[]},r={grid:{left:"0",right:"0",bottom:"0",top:"60",containLabel:!0},title:{text:"",subtext:"",top:"0",left:"50%",textAlign:"center",itemGap:5,textStyle:{fontSize:15,lineHeight:15,fontFamily:"Montserrat",fontWeight:500,color:"#666"},subtextStyle:{fontFamily:"Montserrat",fontSize:12,lineHeight:12,fontWeight:500,color:"#666",width:"100%"}},toolbox:{show:!0,right:"0",top:"0",feature:{saveAsImage:{title:"Descargar",textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}}},emphasis:{iconStyle:{borderColor:"#ffcd00",textFill:"#666"}}},legend:{show:!1},tooltip:{trigger:"axis",confine:!0,axisPointer:{type:"none"},textStyle:{fontFamily:"Montserrat",fontSize:12,fontWeight:500}},xAxis:{data:[],axisLabel:{show:!0,margin:6,textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:500}}},yAxis:{type:"value",alignTicks:!0,scale:!0,axisLabel:{formatter:"",textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:400}}},series:[{data:[],type:"bar"}]},a={grid:{top:"15%",bottom:"3%",left:"3%",right:"3%"},title:{text:"",margin:"0",padding:0,top:"0",left:"50%",textAlign:"center",itemGap:5,textStyle:{fontFamily:"Montserrat",fontSize:18,fontWeight:600,color:"#666"},subtext:"",subtextStyle:{fontFamily:"Montserrat",fontSize:17,fontWeight:500,color:"#666"}},tooltip:{textStyle:{fontFamily:"Montserrat"},renderMode:"html",formatter:"<b>{b}</b><br/>{c} {a}"},yAxis:{data:[],axisLabel:{show:!1}},series:[{data:[],type:"bar",barWidth:"75%",barCategoryGap:"20%",label:{show:!0,position:"insideLeft",formatter:"{b}",width:400,overflow:"truncate",textStyle:{fontSize:13,fontWeight:600,fontFamily:"Montserrat",color:"#284B63"}},itemStyle:{color:"#82bed4"}}]},i="ca_ES",l={es_ES:new Map([["mayor_energia","MAJOR ENERGIA"],["watioHora","Wh"],["idCahrtTop10","chartTop"],["energia","ENERGIA"],["idChartBar","chartDesagregatMensual"],["idChartLine","chartLineDesagregatMensual"],["consum_mitja","CONSUMO MEDIO"]]),ca_ES:new Map([["mayor_energia","MAJOR ENERGIA"],["watioHora","Wh"],["idCahrtTop10","chartTop"],["energia","ENERGIA"],["idChartBar","chartDesagregatMensual"],["idChartLine","chartLineDesagregatMensual"],["consum_mitja","CONSUM MITJÀ"]])};function s(e){const o=e.resultset[0][1],n=e.resultset[0][2],r=e.resultset[0][3],a=parseFloat((n/o).toFixed(3)),s=(0,t.formatWithPrefix)(a),c=(0,t.checkAndTransformMaxValue)(r,s.unit+="Wh"),u=`${l[i].get("consum_mitja")}`,d=e.resultset[0][0],f=function(t,e,o,n,r=t,a=""){return{grid:{left:"0",right:"0",bottom:"0",top:"50",containLabel:!0},title:{text:o,margin:"0",padding:0,top:"0",left:"60%",textAlign:"center",itemGap:5,textStyle:{fontSize:15,lineHeight:15,fontFamily:"Montserrat",fontWeight:"500",color:"#666"},subtext:a,subtextStyle:{fontFamily:"Montserrat",fontSize:12,lineHeight:12,fontWeight:500,color:"#666",width:"100%"}},legend:{show:!1,top:"bottom",textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:"400",color:"#666"}},toolbox:{show:!0,right:"0",top:"0",feature:{saveAsImage:{title:"Descargar",textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}}},emphasis:{iconStyle:{borderColor:"#ffcd00",textFill:"#666"}}},series:[{type:"gauge",center:["50%","65%"],startAngle:200,endAngle:-20,min:0,max:100*Math.ceil(n/100),splitNumber:10,progress:{show:!0,width:40,itemStyle:{color:"#4BA3C3"}},pointer:{show:!1},axisLine:{lineStyle:{width:40}},axisTick:{distance:-50,splitNumber:5,lineStyle:{width:2,color:"#ccc"}},splitLine:{distance:-55,length:9,lineStyle:{width:2,color:"#ccc"}},axisLabel:{distance:0,formatter:t=>t.toFixed(0),textStyle:{color:"#999",fontStyle:"normal",fontWeight:"400",fontFamily:"Montserrat",fontSize:12}},anchor:{show:!1,showAbove:!0,size:35,itemStyle:{borderWidth:40,color:"#284B63"}},detail:{formatter:r+e,width:"60%",borderRadius:8,offsetCenter:[0,0],valueAnimation:!0,textStyle:{color:"#284B63",fontStyle:"normal",fontWeight:"600",fontFamily:"Montserrat",fontSize:30}},data:[{value:t}]}]}}(s.value,s.unit,u,c.value,(0,t.formatDecimalNumberfromDotToComma)(s.value),d);(0,t.initChart)("chartConsumoMedio",f)}function c(e){const o=e&&e.resultset&&e.resultset[0]&&e.resultset[0][0],n=(0,t.formatWithPrefix)(o),r=`${(0,t.formatDecimalNumberfromDotToComma)(n.value)} ${n.unit+="Wh"}`;if(void 0!==r){const e=t=>{t.innerHTML=r};(0,t.initElement)("consumoTotal",e)}else console.error("No se pudo extraer el valor")}const u="ca_ES";function d(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?"DIARI":"MENSUAL"}function f(t){return/^\d{4}\/\d{2}$/.test(t)?"MENSUAL":"ANUAL"}function m(t,e){return t===l[u].get("idChartBar")?d(e[0]):f(e[0])}function h(e,o){const n=(0,t.resultsetWithFields)(e);let a={periodos:n.map((t=>t.periodo)).reverse(),valorEnergia:[],energiaTotalFormateada:[],valorUnidadGrafico:{},fechaFiltro:n[0].fecha_filtro,texto:`${l[u].get("energia")} ${String(n[0].energia).toUpperCase()}`,subtexto:m(o,n.map((t=>t.periodo)).reverse())};const i=n.map((t=>t.energia_total)).reverse(),s=[...i].sort(((t,e)=>e-t)),c={...(0,t.formatWithPrefix)(s[0]),unit:(0,t.formatWithPrefix)(s[0]).unit+l[u].get("watioHora")},d=(f=i,h=c.unit,f.map((e=>(0,t.checkAndTransformMaxValue)(e,h))));var f,h;const p=d.map((e=>(0,t.formatDecimalNumberfromDotToComma)(e.value))),g=d.map((t=>t.value));a={...a,valorEnergia:g,energiaTotalFormateada:p,valorUnidadGrafico:c};const y=function({periodos:e,valorEnergia:o,energiaTotalFormateada:n,valorUnidadGrafico:a,fechaFiltro:i,texto:l,subtexto:s}){const c=JSON.parse(JSON.stringify(r));return c.title.text=l,c.title.subtext=s,c.xAxis.data=e,c.yAxis.axisLabel.formatter=e=>`${(0,t.formatDecimalNumberfromDotToComma)(e)} ${a.unit}`,c.tooltip.formatter=t=>function(t,e,o,n){const r=t[0].dataIndex,{color:a}=t[0];return`<span style="display:inline-block;margin-right:5px;width:10px;height:10px;background-color:${a};border-radius:50%;"></span>\n ${e[r]}: <b>${o[r]} </b> ${n}`}(t,e,n,a.unit),c.series[0].data=o.map(((t,o)=>{return{value:t,itemStyle:{color:(n=e[o],n.replace("/","-")===i?"#4BA3C3":"#CCCCCC")}};var n})),c}(a);(0,t.initChart)(o,y)}function p(o,n){const r=(0,t.resultsetWithFields)(o),a=JSON.parse(JSON.stringify(e));if((0,t.initChart)(n,a),function(t){const e=new Set(t.map((t=>t.sliceanddicevalue1)));return e.size>10||1===e.size||0===e.size}(r))return;const{periodos:i,grupos:s}=function(t){const e=new Set,o={};return t.forEach((t=>{e.add(t.periodo);const n=t.address;o[n]||(o[n]={}),o[n][t.periodo]=t.energia_total})),{periodos:Array.from(e).sort(),grupos:o}}(r),c=function({periodos:t,grupos:e}){const o=["#1F77B4","#FF7F0E","#2CA02C","#D62728","#9467BD","#8C564B","#E377C2","#7F7F7F","#BCBD22","#17BECF"];return Object.keys(e).map(((n,r)=>{const a=t.map((t=>void 0!==e[n][t]?e[n][t]:null));return{name:n,type:"line",data:a,smooth:!0,lineStyle:{width:2,color:o[r%o.length]},itemStyle:{color:o[r%o.length]},symbol:"circle",symbolSize:6}}))}({periodos:i,grupos:s}),m=function(e){const o=[...e].sort(((t,e)=>e.energia_total-t.energia_total)),n=(0,t.formatWithPrefix)(o[0].energia_total);return n.unit+="Wh",n}(r),h=function(e,o){return e.map((e=>({...e,data:e.data.map((e=>(0,t.checkAndTransformMaxValue)(e,o.unit).value))})))}(c,m);a.title.text=`${l[u].get("energia")} ${r[0].energia.toUpperCase()}`,a.title.subtext=function(t,e){return t===l[u].get("idChartLine")?d(e[0]):f(e[0])}(n,i),a.tooltip.formatter=e=>function(e,o,n){let r=`${o[e[0].dataIndex]}:<br/>`;return e.forEach((e=>{r+=`<span style="display:inline-block;margin-right:5px;width:10px;height:10px;background-color:${e.color};border-radius:50%;"></span>`,r+=`${e.seriesName}: <b>${(0,t.formatDecimalNumberfromDotToComma)(e.data)}</b> ${n}<br/>`})),r}(e,i,m.unit),a.xAxis.data=i,a.yAxis.axisLabel.formatter=e=>`${(0,t.formatDecimalNumberfromDotToComma)(e)} ${m.unit}`,a.series=h,(0,t.initChart)(n,a)}function g(e){const{firstDate:o,suministros:n,transformedDataArray:r,maxValueWithUnit:i}=function(e){const o=e.resultset[0][2],n=e.resultset[0][3],r=JSON.parse(JSON.stringify(e.resultset)).reverse().map((t=>[t[0],t[1]])),a=r.reduce(((t,e)=>e[1]>t[1]?e:t),r[0]),i=(0,t.formatWithPrefix)(a[1]);i.unit+=l[u].get("watioHora");const s=function(e,o){return e.map((e=>{const n=(0,t.checkAndTransformMaxValue)(e[1],o.unit);return[e[0],parseFloat(n.value),n.unit]}))}(r,i);return{firstDate:o,suministros:n,transformedDataArray:s,maxValueWithUnit:i}}(e);!function(e,o,n,r){const i=`${l[u].get("mayor_energia")} ${String(o).toUpperCase()}`,s=l[u].get("idCahrtTop10"),c=JSON.parse(JSON.stringify(a));c.title.text=i,c.title.subtext=e,c.yAxis.data=n.map((t=>t[0])),c.series[0].data=n.map((t=>t[1])),c.tooltip.formatter=e=>function(e,o){return`${e.name}: ${(0,t.addPointInteger)(e.value)} ${o}`}(e,r.unit),(0,t.initBarChart)(s,c)}(o,n,r,i)}function y(e){const o=(0,t.resultsetWithFields)(e),n=4===o[0].period_formatted.length,r="Consumida"===(a=o[0].energia)||"Neta"===a;var a;let i,l;r&&!n&&(i=function(t){const e={"0 - 1.000 kWh":0,"1.000 - 2.000 kWh":0,"2.000 - 10.000 kWh":0,"Más de 10.000 kWh":0};return t.forEach((({energia_redondeada:t,numero_suministros:o})=>{t>=0&&t<1e3?e["0 - 1.000 kWh"]+=o:t>=1e3&&t<2e3?e["1.000 - 2.000 kWh"]+=o:t>=2e3&&t<=1e4?e["2.000 - 10.000 kWh"]+=o:e["Más de 10.000 kWh"]+=o})),e}(o),l="kWh"),r&&n&&(i=function(e){const o={"0 - 10 MWh":0,"10 - 20 MWh":0,"20 - 100 MWh":0,"Más de 100 MWh":0};return e.map((e=>({...e,energia_redondeada:(0,t.checkAndTransformMaxValue)(e.energia_redondeada,"MWh").value}))).forEach((({energia_redondeada:t,numero_suministros:e})=>{t>=0&&t<10?o["0 - 10 MWh"]+=e:t>=10&&t<20?o["10 - 20 MWh"]+=e:t>=20&&t<=100?o["20 - 100 MWh"]+=e:o["Más de 100 MWh"]+=e})),o}(o),l="MWh"),r||(i=function(t){const e={"Menos de 100 kWh":0,"Entre 100 kWh y 1.000 kWh":0,"Más de 1.000 kWh":0};return t.forEach((({energia_redondeada:t,numero_suministros:o})=>{t<100?e["Menos de 100 kWh"]+=o:t>=100&&t<=1e3?e["Entre 100 kWh y 1.000 kWh"]+=o:t>1e3&&(e["Más de 1.000 kWh"]+=o)})),e}(o),l="kWh");const s=function(t,e){const o=Object.keys(t).sort(((t,e)=>{const o=t=>t.includes("Más de")?1/0:parseFloat(t.split("-")[0].replace(/[^0-9.]/g,""));return o(t)-o(e)}));return{grid:{left:"0",right:"0",bottom:"0",top:"60",containLabel:!0},title:{text:"Distribución de energía por grupos",subtext:`Número de edificios por rango de energía (${e})`,top:"0",left:"55%",textAlign:"center",itemGap:10,textStyle:{fontSize:15,lineHeight:15,fontFamily:"Montserrat",fontWeight:"500",color:"#666"},subtextStyle:{fontFamily:"Montserrat",fontSize:12,lineHeight:14,fontWeight:500,color:"#666",width:"100%"}},toolbox:{show:!0,right:"0",top:"0",feature:{saveAsImage:{title:"Descargar",textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}}},emphasis:{iconStyle:{borderColor:"#ffcd00",textFill:"#666"}}},legend:{show:!0,left:"left",top:"center",orient:"vertical",textStyle:{fontSize:12,fontFamily:"Montserrat",fontWeight:"400",color:"#666"},data:o},tooltip:{trigger:"item",formatter:t=>`<b>${t.name}</b>: <br/> ${t.value} edificios`,textStyle:{fontFamily:"Montserrat",fontSize:12,fontWeight:500}},series:[{name:`Distribución de energía (${e})`,type:"pie",radius:"70%",center:["60%","70%"],data:o.map((e=>({value:t[e],name:e,itemStyle:{color:"#4BA3C3"}}))),label:{show:!0,position:"outside",formatter:"{b}: {c} edificios",textStyle:{fontSize:12,fontFamily:"Montserrat",fontWeight:"500",color:"#666"}},labelLine:{show:!0,length:15,length2:15,lineStyle:{width:1,color:"#666"}},itemStyle:{borderColor:"#fff",borderWidth:2},emphasis:{itemStyle:{borderColor:"#ffcd00",borderWidth:2}}}]}}(i,l);(0,t.initChart)("chartDistribucion",s)}function b(t,e){Dashboards.fireChange(e,t.resultset[0][0])}function S(t,e){const o=Dashboards.getParameterValue(e),n=t.parameter;t.dashboard.setParameter(n,[o])}})(),n})()));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.energia=e():t.energia=e()}(self,(()=>(()=>{var t={2725:t=>{var e;self,e=()=>(()=>{"use strict";var t={d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{MONTHS_YEAR:()=>n,MONTHS_YEAR_SHORT:()=>a,TEXTS_COMMON:()=>i,THRESHOLDS:()=>St,addPointInteger:()=>y,buildCamarasTrafico:()=>Dt,buildTableCalidadAire:()=>xt,calculateMaxYAxis:()=>W,calculatePentahoPath:()=>Mt,calculateXAxisStart:()=>$,checkAllGroupsCollapsed:()=>pt,checkAndTransformMaxValue:()=>v,configureDataBar:()=>P,configureDataGaugeCommon:()=>k,configureDataGaugeMonthCommon:()=>z,configureDataLine:()=>I,configureDataValidate:()=>Jt,configureLinesChartValidates:()=>Rt,convertToLanguageSelectorDateRange:()=>lt,convertToTableTreeView:()=>gt,downloadCSVTable:()=>yt,downloadPDFTable:()=>bt,formatCellMultiplesLines:()=>ft,formatDayMonthYear:()=>u,formatDecimalNumberfromDotToComma:()=>x,formatMilMillionEuros:()=>L,formatMonthAnyo:()=>c,formatName:()=>A,formatNameHeaderColumn:()=>dt,formatRoundTooltip:()=>T,formatShortMonthShortYear:()=>f,formatShortMonthYear:()=>d,formatToMillions:()=>b,formatToTons:()=>S,formatTooltip:()=>w,formatTooltipPie:()=>N,formatTrimestre:()=>m,formatWithPrefix:()=>M,getEnvironment:()=>vt,getMaxFieldNumberFromData:()=>R,getMonth:()=>r,getMonthList:()=>h,getSelectCommonOptions:()=>ot,getSelectTwoColumnsOptions:()=>rt,initBarChart:()=>Nt,initBarChartComparationMonth:()=>_t,initChart:()=>D,initElement:()=>C,initStackedBarChart:()=>wt,initStackedBarChartMonthSeries:()=>Wt,initTable:()=>ut,initValueDefaultDate:()=>it,initialCalls:()=>Ct,loadIframeOnClickEvent:()=>It,printDataChart:()=>E,printDataInHTMLElements:()=>J,printNoDataChart:()=>F,resetFilter:()=>et,resetFilterDate:()=>at,resetFilterDates:()=>nt,resetFilterToDefault:()=>ct,resultsetWithFields:()=>B,selectConfigDatasource:()=>Q,selectConfigDatasourceAllValue:()=>tt,selectFilterAll:()=>Z,selectValueDefaultInFilter:()=>st,separateDayMonthYearToSlash:()=>s,splitDataset:()=>H,subtractOneDay:()=>g,subtractOneMonth:()=>p,traverseRows:()=>ht,updateDomElement:()=>V,updateObject:()=>G,updateStackedBarOptions:()=>$t});const o={"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 r(t){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(t.toString(),10)]}const n={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"]])},a={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"]])},i={es_ES:new Map([["last_update","Última actualización"]]),ca_ES:new Map([["last_update","Última actualització"]])};function s(t){return t.substring(6,8)+"/"+t.substring(4,6)+"/"+t.substring(0,4)}function l(t){return[t.substring(0,4),o[t.substring(4,6)]]}function c(t){const[e,o]=l(t);return`${o} ${e}`}function u(t){const[e,r,n]=function(t){return[t.substring(0,4),o[t.substring(4,6)],t.substring(6,8)]}(t);return`${n} ${r} ${e}`}function d(t){const[e,o]=l(t);return`${o.substring(0,3)} ${e}`}function f(t){const[e,o]=l(t);return`${o.substring(0,3)} '${e.substring(2,4)}`}function m(t){const[e,o]=t.split("-");return`${parseFloat(o)/3}T ${e}`}function h(t,e){const o=t[e];return Array.from(o.values()).map((t=>t.slice(0,3)))}function g(t){const e=Math.floor(t/1e4);let o=new Date(e,t%1e4/100-1,t%100);return o.setDate(o.getDate()-1),`${o.getFullYear()}${(o.getMonth()+1).toString().padStart(2,"0")}${o.getDate().toString().padStart(2,"0")}`}function p(t){let e;const o=new Date(Math.floor(t/100),t%100-1,0);return e=`${o.getFullYear()}${(o.getMonth()+1).toString().padStart(2,"0")}`,e}function y(t,e=2){let o=navigator.language||navigator.userLanguage;o=o.length<=2?`${o}-${o.toUpperCase()}`:o;const r={minimumFractionDigits:0,maximumFractionDigits:e};return"es-ES"===o?t.toLocaleString("de-DE",r):t.toLocaleString(o,r)}function b(t){const e=1e6;return t>=e?t/e+"M":t.toString()}function S(t){return t>=1e3?t/1e3+" Tn":t.toString()}function x(t){return("string"==typeof t?parseFloat(t):t).toLocaleString("de-DE",{minimumFractionDigits:2,maximumFractionDigits:2})}function M(t){return t>=1e6?{value:(t/1e6).toFixed(2),unit:"G"}:t>=1e3?{value:(t/1e3).toFixed(2),unit:"M"}:{value:t.toFixed(2),unit:"k"}}function v(t,e){return"GWh"===e?{value:parseFloat((t/1e6).toFixed(2)),unit:"GWh"}:"MWh"===e?{value:parseFloat(t/1e3).toFixed(2),unit:"MWh"}:{value:parseFloat(t).toFixed(2),unit:"kWh"}}function A(t,e=29){if(t.length>=e){const o=t.split(" ");let r="",n="";return o.forEach((t=>{`${r} ${t}`.length<=e?r+=(r?" ":"")+t:(n+=`${r}\n`,r=t)})),n+=r,n}return t}function C(t,e,o="MainContentLoadedCustom"){let r=document.getElementById(t);return r?Promise.resolve(e(r)):new Promise((n=>{document.body.addEventListener(o,(()=>{r=document.getElementById(t),r?n(e(r)):(console.error(`El elemento con ID ${t} aún no está disponible después del evento.`),n(null))}))}))}function D(t,e){return C(t,(t=>{const o=echarts.init(t);o.setOption(e,!0),window.addEventListener("resize",(()=>{null!=o&&void 0!==o&&o.resize()}));const r=document.getElementById("main-content");return r&&(r.addEventListener("shown.bs.collapse",(()=>{o.resize()})),r.addEventListener("hidden.bs.collapse",(()=>{o.resize()}))),o}))}function F(t,e){const o=t?document.querySelector(t):null,r=e?document.querySelector(e):null;o&&(o.hidden=!0),r&&(r.style.background="url('./build/images/nodata1.png') no-repeat top center",r.hidden=!1)}function E(t,e){const o=t?document.querySelector(t):null,r=e?document.querySelector(e):null;o&&(o.hidden=!0),r&&(r.style.background="#ffffff",r.hidden=!1)}function w(t,e=!1,o=!0,r=""){let n=`<p style="font-weight: 500;color: #565656;">${t[0].name}</p>`;return t.forEach((t=>{const a=e?Math.round(t.data):t.data,i=o?`<div style="font-weight: 400;color: #666;">${s=t.color,`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;font-weight: 500;background-color:${s}"></span>`} ${t.seriesName}: \n <span style="float: right; margin-left:20px;font-weight: 600;color: #565656;">\n ${t.data?`${y(a)} ${r}`:"-"}\n </span>\n </div>`:`<div>\n <span style="font-weight: 600;color: #565656;">${t.data?`${y(a)} ${r}`:"-"}\n </span>\n </div>`;var s;n+=i})),n}function $(t){return 100*(t-120)/t}function W(t,e){const o=Math.max(...t);return o+(e-o%e)}function N(t,e=!1){const o=`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:${t.color}"></span>`,r=e?`${t.percent}%`:y(t.value);return`<div> ${o} ${t.name} <span style="float: right; margin-left:20px;font-weight: 600;color: #333;"> ${r} </span></div>`}function T(t,e){let o=`${t.name} : `;return o+=`<span style="font-weight:500">${y(Math.round(t.value))}</span>`,e&&(o+=`<span> (${t.percent}%)</span>`),t.marker+o}function L(t){const e=1e6,o=Number(t);return o>=0&&o<e?`${y(o)} €`:o>=e?`${y(o/e)} M €`:"-"}function O(t,e,o=1){const r=Math.max(...t.map((t=>t[e])))*o;return 5e3*Math.ceil(r/5e3)}function k(t,e,o,r=30,n=15,a=30,i=-70,s=70,l=3){const c=O(t,e.data,1.1),u=s,d=o.slice(),f=[];let m=n,h=a,g=i;for(let o=0;o<t.length;o+=1)f.push({value:t[o][e.data],name:A(String(t[o][e.type]).replace(/\[.*?\]/g,"")),color:d.shift(),title:{offsetCenter:[`${String(g)}%`,`${String(m)}%`],fontFamily:"Montserrat",fontSize:r},detail:{offsetCenter:[`${String(g)}%`,`${String(h)}%`],fontFamily:"Montserrat",width:"33%",formatter:t=>y(Math.round(t))}}),g+=u,(o+1)%l==0&&(h+=a,m+=2*n,g=i);return[c,f]}function z(t,e,o,n=0){return[O(e,o.data,1),t=>function(t,e,o){const n=y(Math.round(e)),a=r(t[o][0]),i=t[o][1],s=`\n${a} ${i} : ${n}`,l=`${n}\n${a} ${i}`;return window.innerWidth<=1710?s:l}(e,t,n),[{value:e[n][o.data]}]]}function _(t,e){const{resultset:o}={resultset:t},r=new Set,n=new Set,a=o.map((([t,o,a])=>{const i=e?Math.round(a):a;return r.add(t),n.add(o),{day:o,type:t,value:i}})),i=Array.from(n.values()),s=Array.from(r.values());return s.sort(((t,e)=>t.toLowerCase().localeCompare(e.toLowerCase(),"es",{ignorePunctuation:!0}))),[s.map((t=>{const e=a.filter((e=>e.type===t)).map((({day:e,value:o})=>[e,t,o])),o=i.map((t=>{const o=e.find((([e])=>e===t));return o?o[2]:null}));return{name:t,data:o}})),s,n]}function I(t,e=[],o=!1){const[r,n,a]=_(t,o);return r.forEach((t=>{t.type="line",t.symbol="circle",t.symbolSize=6,t.smooth=.1,e.length>0&&(t.color=e.shift())})),[r,a,n]}function P(t,e,o=!1){const[r,n,a]=_(t,o);return r.forEach((t=>{t.type="bar",t.color=e.shift(),t.smooth=!1})),[r,a,n]}function B(t){const{resultset:e,metadata:o}=t,r=[];return e.forEach((t=>{const e={};t.forEach(((t,r)=>{e[o[r].colName]=t})),r.push(e)})),r}function G(t,e){const o={...t};return Object.keys(e).forEach((r=>{Object.prototype.hasOwnProperty.call(e,r)&&("series"===r&&Array.isArray(e[r])?o[r]=e[r].map(((e,o)=>({...Array.isArray(t[r])&&t[r][o]||{},...e}))):"object"!=typeof e[r]||null===e[r]||Array.isArray(e[r])?t[r]!==e[r]&&(o[r]=e[r]):o[r]=G(t[r]||{},e[r]))})),o}function J(t,e){console.log("INICIO HTML");const o=()=>{t.forEach((t=>{t.id in e&&Object.entries(e[t.id]).forEach((o=>{const r=o[0],n=o[1];"object"==typeof n?n.className?document.querySelector(n.className).className=t[r]:n.element&&n.format&&(document.querySelector(n.element).textContent=e[t.id][r].format(t[r])):document.querySelector(n).textContent=t[r]}))}))};try{o()}catch(t){document.body.addEventListener("MainContentLoadedCustom",(()=>{o()}))}}function R(t,e){const o=B(t),r=[];let n=null;return o.forEach((t=>{const o=t[e];"number"!=typeof o||Number.isNaN(o)||r.push(o)})),r.length>0&&(n=Math.max(...r)),n}function V(t,e){const o=document.querySelector(t);o?o.textContent=e:console.warn(`Elemento ${t} no encontrado en el DOM`)}function H(t,e=!0){const o={Cont:[],Mob:[]};return t.forEach((t=>{"is-res-001-kgs-contenidors"===t[0]&&"total"===t[1]&&(e?o.Cont.push([t[3],t[4],t[2]]):o.Cont.push([t[3],t[2]])),"Mobles"===t[1]&&(e?o.Mob.push([t[3],t[4],t[2]]):o.Mob.push([t[3],t[2]]))})),o}const j=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],q=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],U=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],Y=["Dom","Lun","Mar","Mié","Juv","Vie","Sáb"],X=["Do","Lu","Ma","Mi","Ju","Vi","Sá"];function Z(t){const e=t.resultset.map((t=>t[0]));return this.dashboard.fireChange(this.parameter,e),t}function K(t){for(const e of t)if(Array.isArray(e)){if(!K(e))return!1}else if("All"!==e)return!1;return!0}function Q(t,e,o,r){return K(e)?(t.queryDefinition.dataAccessId=o,t.dashboard.setParameter(t.parameter,["All"])):t.queryDefinition.dataAccessId=r,!0}function tt(t){return t.dashboard.setParameter(t.parameter,["All"]),!0}function et(t){t.forEach((t=>{Dashboards.fireChange(t,["All"])}))}function ot(t="Todos"){return{input:{root:{id:"All"},indexes:{id:0,label:0}},component:{Root:{strings:{isDisabled:"No disponible",allItems:t,noItems:"Ninguno",btnApply:"Aceptar",btnCancel:"Cancelar"}},Group:{Strings:{allItems:"Todos",noItems:"Ninguno",btnApply:"Aceptar",btnCancel:"Cancelar"}}}}}function rt(t="Todos"){const e=ot(t);return e.input.indexes.id=1,e.input.indexes.label=0,e}function nt(t,e,o,r){const n=Dashboards.getParameterValue(o),a=Dashboards.getParameterValue(r);return Dashboards.fireChange(t,[n]),Dashboards.fireChange(e,[a]),!0}function at(t,e){const o=Dashboards.getParameterValue(e);return Dashboards.fireChange(t,[o]),!0}function it(t,e){Dashboards.fireChange(e,t.resultset[0][0])}function st(t,e){const o=Dashboards.getParameterValue(e),r=t.parameter;t.dashboard.setParameter(r,[o])}function lt(t){t.regional.es={monthNames:j,abbreviatedMonthNames:q,dayNames:U,abbreviatedDayNames:Y,dayNamesMin:X,weekHeader:"Sm",firstDay:1,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},t.setDefaults(t.regional.es)}function ct(t,e){const o=Dashboards.getParameterValue(e);return Dashboards.fireChange(t,Array.isArray(o)?o:[o]),!0}function ut(t,e){return C(t,(t=>new Tabulator(t,e)))}function dt(t,e){let o=t.getValue();return o.length>e&&(o=`${o.substr(0,e)}<br>${o.substr(e)}`),o}function ft(t,e){const o=t.getValue().split(" ");let r="",n="";return o.forEach((t=>{(n+t).length<=e?n+=`${t} `:(r+=`${n}<br>`,n=`${t} `)})),r+=`${n}<br>`,r}function mt(t,e){"expand"===e?t.treeExpand():t.treeCollapse();const o=t.getTreeChildren();o.length>0&&o.forEach((t=>{t.getTreeChildren().length>0&&mt(t,e)}))}function ht(t,e){t.getRows().forEach((t=>{t.getTreeChildren().length>0&&mt(t,e)}))}function gt(t,e,o,r){const n=[];for(const a in t)if(t.hasOwnProperty(a)){const i=t[a],s={[e]:i[0],_children:[]};i.shift(),i.forEach(((t,n)=>{const a={[e]:o[n],[r]:t};s._children.push(a)})),n.push(s)}return n}function pt(t){let e=!0;return t.getGroups().forEach((t=>{t._group.visible&&(e=!1)})),e}function yt(t,e,o){const r=document.getElementById(o),n=r.cloneNode(!0);r.parentNode.replaceChild(n,r),n.addEventListener("click",(()=>{t.download("csv",`${e}.csv`,{delimiter:";"})}))}function bt(t,e,o){const r=document.getElementById(o),n=r.cloneNode(!0);r.parentNode.replaceChild(n,r),n.addEventListener("click",(()=>{t.download("pdf",`${e}.pdf`,{title:e,rowCalcStyles:{fontSize:8,fontStyle:"bold"},autoTable:{styles:{fontSize:8}}})}))}const St={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 xt(t){const e=[],o={0:"b",1:"a",2:"d",3:"m",4:"mm",5:"em",6:"",7:"nd"};function r(t,e,r){const n=document.createElement("td");if(n.setAttribute("id",t),null!=e){n.innerHTML=e;const t=function(t,e){let r;return void 0===e?r=6:"ND"===e?r=7:(r=5,t.forEach(((t,o)=>{e<=t&&5===r&&(r=o)}))),o[r]}(r,e);n.classList.add(t)}return n}return t.forEach((t=>{const o=t;"noData"===o.operationalstatus&&(o.so2value="ND",o.no2value="ND",o.o3value="ND",o.pm10value="ND",o.pm25value="ND"),"A09_CABANYAL_60m"===o.entityid&&(o.pm10value=void 0,o.pm25value=void 0);const n=document.createElement("tr"),a=document.createElement("td");a.innerHTML=o.address,n.appendChild(a),n.appendChild(r(`${o.entityid}_so2`,o.so2value,St.SO2)),n.appendChild(r(`${o.entityid}_no2`,o.no2value,St.NO2)),n.appendChild(r(`${o.entityid}_o3`,o.o3value,St.O3)),n.appendChild(r(`${o.entityid}_pm10`,o.pm10value,St.PM10)),n.appendChild(r(`${o.entityid}_pm25`,o.pm25value,St.PM25)),e.push(n)})),e}function Mt(t){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${t}`}function vt(){const t=window.location.href;let e="";return e=t.includes("localhost")?"local":t.includes("sc_valencia_pre")?"PRE":"PRO",e}function At(t,e){document.querySelectorAll(`[${t}]`).forEach((o=>{!function(t,e,o){const r=e;if(t){const e=new XMLHttpRequest;e.onreadystatechange=function(){4===this.readyState&&(200===this.status&&(r.innerHTML=this.responseText,o&&o()),404===this.status&&(r.innerHTML="No se ha podido cargar correctamente."))},e.open("GET",t,!0),e.send()}}(o.getAttribute(t),o,e)}))}function Ct(t){At("include-html-cabecera",(function(){!function(){const t=vt();"PRO"!==t&&(document.title+=` (${t})`)}(),function(){const t=vt();"PRO"!==t&&(document.querySelector("nav").querySelectorAll("span")[1].textContent+=` (${t})`)}()})),At("include-html-menu"),At("include-html-main-container",(function(){document.body.dispatchEvent(new Event("MainContentLoadedCustom")),function(){const t=document.querySelector("body");t.classList.remove("inicio"),t.classList.add(document.documentURI.split("%3A")[4].match(/(.*?).wcdf/)[1])}(),t&&t()})),At("include-html-copyright")}function Dt(t,e,o,r,n,a){let i=!1,s=!1;const l=document.querySelector(t),c=document.querySelector(e),u=()=>{"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 d(t=!0){const e=document.querySelector(o);t?(l&&(l.src="about:blank"),c&&(c.src="about:blank"),e.classList.add("blur"),s=!0):(e.classList.remove("blur"),u(),s=!1)}const f=t=>{new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting&&(s||u(),i||(i=!0,window.setTimeout(d,a)))}))})).observe(t)};!function(){const{userAgent:t}=navigator;return/iPad|iPhone|iPod|Macintosh/.test(t)&&!window.MSStream}()?(l&&(l.setAttribute("sandbox","allow-scripts"),f(l)),c&&(c.setAttribute("sandbox","allow-scripts"),f(c)),document.querySelector(n).addEventListener("click",(()=>{d(!1),window.setTimeout(d,a)}))):document.querySelectorAll(r)[0].style.display="none"}const Ft={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:t=>`${t}%`}},{type:"value",position:"left",axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400},formatter:t=>`${b(t)}€`}}]},Et=(t,e)=>{e.sort(((t,e)=>parseInt(t.anyo)-parseInt(e.anyo)));const o={};e.forEach((e=>{const r=e[1],n=e[0];n!==t.seriesName||o[r]||(o[r]=0),n===t.seriesName&&(o[r]+=e[2])}));let r=`<p>${t.seriesName}</p>`;for(const[e,n]of Object.entries(o))r+=`<div>${t.marker} ${e}: <span style="float: right; margin-left:20px;font-weight: 600;">${y(n)}</span></div>`;return r};function wt(t,e,o=void 0,r=void 0){const n=null===r?void 0:r,a=new Set(e.map((t=>t[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:t=>Et(t,e),textStyle:{fontFamily:"Montserrat"},position(t,e,o,r,n){const a={},i=n.contentSize[1]/2,s=n.viewSize[1],l=t[1];return l<i?a.top=10:l+i>s?a.bottom=10:a.top=l-i,t[0]<n.viewSize[0]/2?a.left=t[0]+20:a.right=n.viewSize[0]-t[0]+20,a}},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:t=>y(t)},splitLine:{lineStyle:{color:"#DDD"}}},yAxis:{type:"category",data:Array.from(a),axisLabel:{textStyle:{fontFamily:"Montserrat"}}},series:(()=>{const t={name:"SIN NOMBRE",type:"bar",stack:"total",label:{show:!0,fontFamily:"Montserrat",fontSize:10,formatter:t=>y(Math.round(t.value))},itemStyle:void 0,emphasis:{focus:"series"},data:void 0};n&&n.itemStyle&&Array.isArray(n.itemStyle.borderColor)&&(i=[...n.itemStyle.borderColor],delete n.itemStyle.borderColor);const o=function(t){return t.reduce(((t,e)=>{const o=e[0];return t[o]||(t[o]=[]),t[o].push(e),t}),{})}(e),r=Object.keys(o);a.forEach((t=>{r.forEach((e=>{void 0===o[e].find((e=>e[1]===t))&&(o[e].push([o[e][0][0],t,void 0]),o[e].sort())}))}));const s=[];return Object.keys(o).forEach((e=>{i&&(t.itemStyle={borderColor:i.shift()}),t.name=e,t.data=o[e].map((t=>t[2]));let r={};r=void 0!==n?G(t,n):t,s.push({...r})})),s})(),toolbox:{show:!0,feature:{restore:{title:"Restablir"},saveAsImage:{title:"Desar"}},right:50}};let l={};l=void 0!==o?G(s,o):s,D(t,l)}function $t(t){let e={};return e=G(Ft,t),e}function Wt(t,e,o={},n={}){let a={};a=G(o,{color:["#81B1CC","#ABD9EA","#C2EEF9","#F9E2AF","#F9C780","#FDAE61","#F46D43","#FDAE61","#F9E2AF","#C2EEF9","#ABD9EA","#81B1CC"],yAxis:{data:function(){const t=new Set;return e.forEach((e=>{t.add(e[1])})),Array.from(t).sort(((t,e)=>t-e))}()}});const i={itemStyle:{borderWidth:2,borderColor:["#448DAD","#89CADB","#A0DEE8","#F4D28C","#F4B569","#F79646","#F25930","#F79646","#F4D28C","#A0DEE8","#89CADB","#448DAD"]}},s=null===n?i:G(n,i),l=e;l.forEach(((t,e)=>{l[e][0]=r(t[0])})),wt(t,l,a,s)}function Nt(t,e=void 0){const o={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:t=>T(t,!1)},series:[{type:"bar",showBackground:!0}]};let r={};r=void 0!==e?G(o,e):o,D(t,r)}const Tt="es_ES",Lt={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"]])};function Ot(t){return Math.max(...t.map((t=>Number(t[0]))))}function kt(t){const e=t.filter((e=>Number(e[0])===Ot(t))),o=Array.from({length:12},(()=>0));return e.forEach((([t,e,r])=>{const n=parseInt(e,10)-1;o[n]=r})),o}function zt(t){const e=t.filter((e=>Number(e[0])===Ot(t)-1)),o=Array.from({length:12},(()=>0));return e.forEach((([t,e,r])=>{const n=parseInt(e,10)-1;o[n]=r})),o}function _t(t,e,o=void 0){const r=Ot(e).toString(),n=(Ot(e)-1).toString();Nt(t,G({title:{left:"center",top:"-12%",textStyle:{fontSize:15,fontFamily:"Montserrat"}},legend:{top:"10%",show:!0,data:[n,r],textStyle:{fontFamily:"Montserrat"}},grid:{bottom:"8%",top:"20%",right:"2%"},xAxis:[{type:"category",data:h(Lt,Tt),interval:0,margin:10,axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400}}}],yAxis:[{type:"value",axisLabel:{formatter:t=>t.toLocaleString("es-ES"),textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400}}}],series:[{name:n,type:"bar",data:zt(e)},{name:r,type:"bar",barGap:0,data:kt(e)}]},o))}function It(t,e,o){const r=document.querySelector(e),n=document.querySelector(t);let a=!1;n.addEventListener("click",(()=>{!1===a&&(a=!0,r.setAttribute("src","about:blank"),r.setAttribute("src",o),r.onload=()=>{a=!1})})),n.disabled=!1}const Pt="id",Bt="fecha",Gt="value";function Jt(t,e,o,r,n="es_ES"){const[a,i]=function(t,e,o){const r=[],n=[];return t.forEach((t=>{e.includes(`${t[Pt]}`)?r.push(`${t[Bt]}`):o.includes(`${t[Pt]}`)&&n.push(`${t[Bt]}`)})),[r.map((t=>[t,0])),n.map((t=>[t,0]))]}(t,o,r);let s="es_ES"==n?"Datos sin validar":"Dades sense validar";0===i.length&&(s="");const l={name:"Datos validados",type:"line",data:[...a,i[0]],lineStyle:{color:"#00A9A0",width:4},showSymbol:!1,tooltip:{show:!1}};let c="",u="";if(0===i.length){const e=t[t.length-1].fecha;c=e,u=e}else c=i[0][0],u=i[i.length-1][0];return[...e,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:u,yAxis:Math.max(...t.filter((t=>null!==t[Gt])).map((t=>parseInt(`${t[Gt]}`,10))))}]]}}]}function Rt(t,e,o=void 0){D(t,G({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:t=>w(t),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:e},o))}return e})(),t.exports=e()}},e={};function o(r){var n=e[r];if(void 0!==n)return n.exports;var a=e[r]={exports:{}};return t[r](a,a.exports,o),a.exports}o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{"use strict";o.r(r),o.d(r,{echartBarEvolucioMensualAnualDesagregado:()=>p,echartConsumoVertidoMedioMesAnyo:()=>u,echartDistribucionEdificios:()=>S,echartLineEvolucioMensualAnual:()=>y,echartTop10:()=>b,getSelectCommonOptions:()=>t.getSelectCommonOptions,getSelectTwoColumnsOptions:()=>t.getSelectTwoColumnsOptions,initElement:()=>t.initElement,initValueDesfaultDates:()=>x,resetFilter:()=>t.resetFilter,resetFilterDate:()=>t.resetFilterDate,resetFilterToDefault:()=>t.resetFilterToDefault,selectConfigDatasourceAllValue:()=>t.selectConfigDatasourceAllValue,selectValueDefaultInFilter:()=>M,widgetConsumoVertidoTotalMesAnyo:()=>d});var t=o(2725);const e={grid:{left:"0",right:"0",bottom:"0",top:"60",containLabel:!0},title:{text:"",subtext:"",top:"0",left:"50%",textAlign:"center",itemGap:5,textStyle:{fontSize:15,lineHeight:15,fontFamily:"Montserrat",fontWeight:500,color:"#666"},subtextStyle:{fontFamily:"Montserrat",fontSize:12,lineHeight:12,fontWeight:500,color:"#666",width:"100%"}},toolbox:{show:!0,right:"0",top:"0",feature:{saveAsImage:{title:"Descargar",textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}}},emphasis:{iconStyle:{borderColor:"#ffcd00",textFill:"#666"}}},legend:{show:!0},tooltip:{trigger:"axis",confine:!0,axisPointer:{type:"line"},textStyle:{fontFamily:"Montserrat",fontSize:12,fontWeight:500}},xAxis:{type:"category",data:[],axisLabel:{show:!0,margin:6,textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:500}}},yAxis:{type:"value",alignTicks:!0,scale:!0,axisLabel:{formatter:"",textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:400}}},series:[]},n={grid:{left:"0",right:"0",bottom:"0",top:"60",containLabel:!0},title:{text:"",subtext:"",top:"0",left:"50%",textAlign:"center",itemGap:5,textStyle:{fontSize:15,lineHeight:15,fontFamily:"Montserrat",fontWeight:500,color:"#666"},subtextStyle:{fontFamily:"Montserrat",fontSize:12,lineHeight:12,fontWeight:500,color:"#666",width:"100%"}},toolbox:{show:!0,right:"0",top:"0",feature:{saveAsImage:{title:"Descargar",textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}}},emphasis:{iconStyle:{borderColor:"#ffcd00",textFill:"#666"}}},legend:{show:!1},tooltip:{trigger:"axis",confine:!0,axisPointer:{type:"none"},textStyle:{fontFamily:"Montserrat",fontSize:12,fontWeight:500}},xAxis:{data:[],axisLabel:{show:!0,margin:6,textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:500}}},yAxis:{type:"value",alignTicks:!0,scale:!0,axisLabel:{formatter:"",textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:400}}},series:[{data:[],type:"bar"}]},a={grid:{left:"0",right:"0",bottom:"0",top:"50",containLabel:!0},title:{text:"",subtext:"",top:"0",left:"60%",textAlign:"center",itemGap:5,textStyle:{fontSize:15,lineHeight:15,fontFamily:"Montserrat",fontWeight:"500",color:"#666"},subtextStyle:{fontFamily:"Montserrat",fontSize:12,lineHeight:12,fontWeight:500,color:"#666",width:"100%"}},legend:{show:!1,top:"bottom",textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:"400",color:"#666"}},toolbox:{show:!0,right:"0",top:"0",feature:{saveAsImage:{title:"Descargar",textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}}},emphasis:{iconStyle:{borderColor:"#ffcd00",textFill:"#666"}}},series:[{type:"gauge",center:["50%","65%"],startAngle:200,endAngle:-20,min:0,splitNumber:10,progress:{show:!0,width:40,itemStyle:{color:"#4BA3C3"}},pointer:{show:!1},axisLine:{lineStyle:{width:40}},axisTick:{distance:-50,splitNumber:5,lineStyle:{width:2,color:"#ccc"}},splitLine:{distance:-55,length:9,lineStyle:{width:2,color:"#ccc"}},axisLabel:{distance:0,formatter:t=>t.toFixed(0),textStyle:{color:"#999",fontStyle:"normal",fontWeight:"400",fontFamily:"Montserrat",fontSize:12}},anchor:{show:!1},detail:{formatter:"",width:"60%",borderRadius:8,offsetCenter:[0,0],valueAnimation:!0,textStyle:{color:"#284B63",fontStyle:"normal",fontWeight:"600",fontFamily:"Montserrat",fontSize:30}},data:[]}]},i={grid:{top:"15%",bottom:"3%",left:"3%",right:"3%"},title:{text:"",margin:"0",padding:0,top:"0",left:"50%",textAlign:"center",itemGap:5,textStyle:{fontFamily:"Montserrat",fontSize:18,fontWeight:600,color:"#666"},subtext:"",subtextStyle:{fontFamily:"Montserrat",fontSize:17,fontWeight:500,color:"#666"}},tooltip:{textStyle:{fontFamily:"Montserrat"},renderMode:"html",formatter:"<b>{b}</b><br/>{c} {a}"},yAxis:{data:[],axisLabel:{show:!1}},series:[{data:[],type:"bar",barWidth:"75%",barCategoryGap:"20%",label:{show:!0,position:"insideLeft",formatter:"{b}",width:400,overflow:"truncate",textStyle:{fontSize:13,fontWeight:600,fontFamily:"Montserrat",color:"#284B63"}},itemStyle:{color:"#82bed4"}}]},s={grid:{left:"0",right:"0",bottom:"0",top:"60",containLabel:!0},title:{text:"",subtext:"",top:"0",left:"55%",textAlign:"center",itemGap:10,textStyle:{fontSize:15,lineHeight:15,fontFamily:"Montserrat",fontWeight:"500",color:"#666"},subtextStyle:{fontFamily:"Montserrat",fontSize:12,lineHeight:14,fontWeight:500,color:"#666",width:"100%"}},toolbox:{show:!0,right:"0",top:"0",feature:{saveAsImage:{title:"Descargar",textStyle:{fontSize:6,fontFamily:"Montserrat",fontWeight:300}}},emphasis:{iconStyle:{borderColor:"#ffcd00",textFill:"#666"}}},legend:{show:!0,left:"left",top:"center",orient:"vertical",textStyle:{fontSize:12,fontFamily:"Montserrat",fontWeight:"400",color:"#666"},data:[]},tooltip:{trigger:"item",textStyle:{fontFamily:"Montserrat",fontSize:12,fontWeight:500}},series:[{name:"",type:"pie",radius:"70%",center:["60%","70%"],data:[],label:{show:!0,position:"outside",textStyle:{fontSize:12,fontFamily:"Montserrat",fontWeight:"500",color:"#666"}},labelLine:{show:!0,length:15,length2:15,lineStyle:{width:1,color:"#666"}},itemStyle:{borderColor:"#fff",borderWidth:2},emphasis:{itemStyle:{borderColor:"#ffcd00",borderWidth:2}}}]},l="ca_ES",c={es_ES:new Map([["mayor_energia","MAJOR ENERGIA"],["watioHora","Wh"],["idCahrtTop10","chartTop"],["energia","ENERGIA"],["idChartBar","chartDesagregatMensual"],["idChartLine","chartLineDesagregatMensual"],["consum_mitja","CONSUMO MEDIO"],["idChartConsumoMedio","chartConsumoMedio"],["idCchartDistribucion","chartDistribucion"],["textoGraficaTarta","Distribución de energía por grupos"],["subtextoGraficaTarta","Número de edificios por rango de energía "],["distribucionGraficaTarta","Distribución de energía "],["kiloWatio","kWh"],["megaWatio","MWh"],["Consumida","Consumida"],["Neta","Neta"]]),ca_ES:new Map([["mayor_energia","MAJOR ENERGIA"],["watioHora","Wh"],["idCahrtTop10","chartTop"],["energia","ENERGIA"],["idChartBar","chartDesagregatMensual"],["idChartLine","chartLineDesagregatMensual"],["consum_mitja","CONSUM MITJÀ"],["idChartConsumoMedio","chartConsumoMedio"],["idCchartDistribucion","chartDistribucion"],["textoGraficaTarta","Distribución de energía por grupos"],["subtextoGraficaTarta","Número de edificios por rango de energía "],["distribucionGraficaTarta","Distribución de energía "],["kiloWatio","kWh"],["megaWatio","MWh"],["Consumida","Consumida"],["Neta","Neta"]])};function u(e){const o=(0,t.resultsetWithFields)(e),{numerador:r,denominador:n,max_value:i,periodo:s}=o[0],u=parseFloat((r/n).toFixed(3)),d=(0,t.formatWithPrefix)(u);d.unit+=c[l].get("watioHora");const f=(0,t.checkAndTransformMaxValue)(i,d.unit),m=c[l].get("consum_mitja"),h=c[l].get("idChartConsumoMedio"),g=JSON.parse(JSON.stringify(a));g.title.text=m,g.title.subtext=s;const p=100*Math.ceil(f.value/100);g.series[0].max=p,g.series[0].data=[{value:d.value}],g.series[0].detail.formatter=`${(0,t.formatDecimalNumberfromDotToComma)(d.value)}${d.unit}`,(0,t.initChart)(h,g)}function d(e){const o=e&&e.resultset&&e.resultset[0]&&e.resultset[0][0],r=(0,t.formatWithPrefix)(o),n=`${(0,t.formatDecimalNumberfromDotToComma)(r.value)} ${r.unit+="Wh"}`;if(void 0!==n){const e=t=>{t.innerHTML=n};(0,t.initElement)("consumoTotal",e)}else console.error("No se pudo extraer el valor")}const f="ca_ES";function m(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?"DIARI":"MENSUAL"}function h(t){return/^\d{4}\/\d{2}$/.test(t)?"MENSUAL":"ANUAL"}function g(t,e){return t===c[f].get("idChartBar")?m(e[0]):h(e[0])}function p(e,o){const r=(0,t.resultsetWithFields)(e);let a={periodos:r.map((t=>t.periodo)).reverse(),valorEnergia:[],energiaTotalFormateada:[],valorUnidadGrafico:{},fechaFiltro:r[0].fecha_filtro,texto:`${c[f].get("energia")} ${String(r[0].energia).toUpperCase()}`,subtexto:g(o,r.map((t=>t.periodo)).reverse())};const i=r.map((t=>t.energia_total)).reverse(),s=[...i].sort(((t,e)=>e-t)),l={...(0,t.formatWithPrefix)(s[0]),unit:(0,t.formatWithPrefix)(s[0]).unit+c[f].get("watioHora")},u=(d=i,m=l.unit,d.map((e=>(0,t.checkAndTransformMaxValue)(e,m))));var d,m;const h=u.map((e=>(0,t.formatDecimalNumberfromDotToComma)(e.value))),p=u.map((t=>t.value));a={...a,valorEnergia:p,energiaTotalFormateada:h,valorUnidadGrafico:l};const y=function({periodos:e,valorEnergia:o,energiaTotalFormateada:r,valorUnidadGrafico:a,fechaFiltro:i,texto:s,subtexto:l}){const c=JSON.parse(JSON.stringify(n));return c.title.text=s,c.title.subtext=l,c.xAxis.data=e,c.yAxis.axisLabel.formatter=e=>`${(0,t.formatDecimalNumberfromDotToComma)(e)} ${a.unit}`,c.tooltip.formatter=t=>function(t,e,o,r){const n=t[0].dataIndex,{color:a}=t[0];return`<span style="display:inline-block;margin-right:5px;width:10px;height:10px;background-color:${a};border-radius:50%;"></span>\n ${e[n]}: <b>${o[n]} </b> ${r}`}(t,e,r,a.unit),c.series[0].data=o.map(((t,o)=>{return{value:t,itemStyle:{color:(r=e[o],r.replace("/","-")===i?"#4BA3C3":"#CCCCCC")}};var r})),c}(a);(0,t.initChart)(o,y)}function y(o,r){const n=(0,t.resultsetWithFields)(o),a=JSON.parse(JSON.stringify(e));if((0,t.initChart)(r,a),function(t){const e=new Set(t.map((t=>t.sliceanddicevalue1)));return e.size>10||1===e.size||0===e.size}(n))return;const{periodos:i,grupos:s}=function(t){const e=new Set,o={};return t.forEach((t=>{e.add(t.periodo);const r=t.address;o[r]||(o[r]={}),o[r][t.periodo]=t.energia_total})),{periodos:Array.from(e).sort(),grupos:o}}(n),l=function({periodos:t,grupos:e}){const o=["#1F77B4","#FF7F0E","#2CA02C","#D62728","#9467BD","#8C564B","#E377C2","#7F7F7F","#BCBD22","#17BECF"];return Object.keys(e).map(((r,n)=>{const a=t.map((t=>void 0!==e[r][t]?e[r][t]:null));return{name:r,type:"line",data:a,smooth:!0,lineStyle:{width:2,color:o[n%o.length]},itemStyle:{color:o[n%o.length]},symbol:"circle",symbolSize:6}}))}({periodos:i,grupos:s}),u=function(e){const o=[...e].sort(((t,e)=>e.energia_total-t.energia_total)),r=(0,t.formatWithPrefix)(o[0].energia_total);return r.unit+="Wh",r}(n),d=function(e,o){return e.map((e=>({...e,data:e.data.map((e=>(0,t.checkAndTransformMaxValue)(e,o.unit).value))})))}(l,u);a.title.text=`${c[f].get("energia")} ${n[0].energia.toUpperCase()}`,a.title.subtext=function(t,e){return t===c[f].get("idChartLine")?m(e[0]):h(e[0])}(r,i),a.tooltip.formatter=e=>function(e,o,r){let n=`${o[e[0].dataIndex]}:<br/>`;return e.forEach((e=>{n+=`<span style="display:inline-block;margin-right:5px;width:10px;height:10px;background-color:${e.color};border-radius:50%;"></span>`,n+=`${e.seriesName}: <b>${(0,t.formatDecimalNumberfromDotToComma)(e.data)}</b> ${r}<br/>`})),n}(e,i,u.unit),a.xAxis.data=i,a.yAxis.axisLabel.formatter=e=>`${(0,t.formatDecimalNumberfromDotToComma)(e)} ${u.unit}`,a.series=d,(0,t.initChart)(r,a)}function b(e){const{firstDate:o,suministros:r,transformedDataArray:n,maxValueWithUnit:a}=function(e){const o=e.resultset[0][2],r=e.resultset[0][3],n=JSON.parse(JSON.stringify(e.resultset)).reverse().map((t=>[t[0],t[1]])),a=n.reduce(((t,e)=>e[1]>t[1]?e:t),n[0]),i=(0,t.formatWithPrefix)(a[1]);i.unit+=c[f].get("watioHora");const s=function(e,o){return e.map((e=>{const r=(0,t.checkAndTransformMaxValue)(e[1],o.unit);return[e[0],parseFloat(r.value),r.unit]}))}(n,i);return{firstDate:o,suministros:r,transformedDataArray:s,maxValueWithUnit:i}}(e);!function(e,o,r,n){const a=`${c[f].get("mayor_energia")} ${String(o).toUpperCase()}`,s=c[f].get("idCahrtTop10"),l=JSON.parse(JSON.stringify(i));l.title.text=a,l.title.subtext=e,l.yAxis.data=r.map((t=>t[0])),l.series[0].data=r.map((t=>t[1])),l.tooltip.formatter=e=>function(e,o){return`${e.name}: ${(0,t.addPointInteger)(e.value)} ${o}`}(e,n.unit),(0,t.initBarChart)(s,l)}(o,r,n,a)}function S(e){const o=c[l].get("idCchartDistribucion"),r=(0,t.resultsetWithFields)(e),n=4===r[0].period_formatted.length,a=r[0].energia===c[l].get("Consumida")||c[l].get("Neta");let i,u;a&&!n&&(i=function(t){const e={"0 - 1.000 kWh":0,"1.000 - 2.000 kWh":0,"2.000 - 10.000 kWh":0,"Más de 10.000 kWh":0};return t.forEach((({energia_redondeada:t,numero_suministros:o})=>{t>=0&&t<1e3?e["0 - 1.000 kWh"]+=o:t>=1e3&&t<2e3?e["1.000 - 2.000 kWh"]+=o:t>=2e3&&t<=1e4?e["2.000 - 10.000 kWh"]+=o:e["Más de 10.000 kWh"]+=o})),e}(r),u=c[l].get("kiloWatio")),a&&n&&(i=function(e){const o={"0 - 10 MWh":0,"10 - 20 MWh":0,"20 - 100 MWh":0,"Más de 100 MWh":0};return e.map((e=>({...e,energia_redondeada:(0,t.checkAndTransformMaxValue)(e.energia_redondeada,"MWh").value}))).forEach((({energia_redondeada:t,numero_suministros:e})=>{t>=0&&t<10?o["0 - 10 MWh"]+=e:t>=10&&t<20?o["10 - 20 MWh"]+=e:t>=20&&t<=100?o["20 - 100 MWh"]+=e:o["Más de 100 MWh"]+=e})),o}(r),u=c[l].get("megaWatio")),a||(i=function(t){const e={"Menos de 100 kWh":0,"Entre 100 kWh y 1.000 kWh":0,"Más de 1.000 kWh":0};return t.forEach((({energia_redondeada:t,numero_suministros:o})=>{t<100?e["Menos de 100 kWh"]+=o:t>=100&&t<=1e3?e["Entre 100 kWh y 1.000 kWh"]+=o:t>1e3&&(e["Más de 1.000 kWh"]+=o)})),e}(r),u=c[l].get("kiloWatio"));const d=Object.keys(i).sort(((t,e)=>{const o=t=>t.includes("Más de")?1/0:parseFloat(t.split("-")[0].replace(/[^0-9.]/g,""));return o(t)-o(e)})),f=JSON.parse(JSON.stringify(s));f.title.text=c[l].get("textoGraficaTarta"),f.title.subtext=`${c[l].get("subtextoGraficaTarta")} (${u})`,f.legend.data=d,f.series[0].name=`${c[l].get("distribucionGraficaTarta")} (${u})`,f.series[0].data=d.map((t=>({value:i[t],name:t,itemStyle:{color:"#4BA3C3"}}))),f.tooltip.formatter=t=>`<b>${t.name}</b>: <br/> ${t.value} edificios`,f.series[0].label.formatter="{b}: {c} edificios",(0,t.initChart)(o,f)}function x(t,e){Dashboards.fireChange(e,t.resultset[0][0])}function M(t,e){const o=Dashboards.getParameterValue(e),r=t.parameter;t.dashboard.setParameter(r,[o])}})(),r})()));
|
package/dist/js/mediAmbient.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.mediAmbient=e():t.mediAmbient=e()}(self,(()=>(()=>{var t={2725:t=>{var e;self,e=()=>(()=>{"use strict";var t={d:(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{MONTHS_YEAR:()=>r,MONTHS_YEAR_SHORT:()=>a,TEXTS_COMMON:()=>i,THRESHOLDS:()=>St,addPointInteger:()=>g,buildCamarasTrafico:()=>Et,buildTableCalidadAire:()=>vt,calculateMaxYAxis:()=>N,calculatePentahoPath:()=>Mt,calculateXAxisStart:()=>F,checkAllGroupsCollapsed:()=>yt,checkAndTransformMaxValue:()=>x,configureDataBar:()=>B,configureDataGaugeCommon:()=>z,configureDataGaugeMonthCommon:()=>P,configureDataLine:()=>_,configureDataValidate:()=>Jt,configureLinesChartValidates:()=>jt,convertToLanguageSelectorDateRange:()=>st,convertToTableTreeView:()=>ht,downloadCSVTable:()=>gt,downloadPDFTable:()=>bt,formatCellMultiplesLines:()=>ft,formatDayMonthYear:()=>u,formatDecimalNumberfromDotToComma:()=>v,formatMilMillionEuros:()=>O,formatMonthAnyo:()=>c,formatName:()=>A,formatNameHeaderColumn:()=>dt,formatRoundTooltip:()=>T,formatShortMonthShortYear:()=>f,formatShortMonthYear:()=>d,formatToMillions:()=>b,formatToTons:()=>S,formatTooltip:()=>$,formatTooltipPie:()=>L,formatTrimestre:()=>m,formatWithPrefix:()=>M,getEnvironment:()=>xt,getMaxFieldNumberFromData:()=>j,getMonth:()=>n,getMonthList:()=>p,getSelectCommonOptions:()=>ot,getSelectTwoColumnsOptions:()=>nt,initBarChart:()=>Lt,initBarChartComparationMonth:()=>kt,initChart:()=>E,initElement:()=>D,initStackedBarChart:()=>$t,initStackedBarChartMonthSeries:()=>Nt,initTable:()=>ut,initValueDefaultDate:()=>it,initialCalls:()=>Dt,loadIframeOnClickEvent:()=>_t,printDataChart:()=>C,printDataInHTMLElements:()=>J,printNoDataChart:()=>w,resetFilter:()=>et,resetFilterDate:()=>at,resetFilterDates:()=>rt,resetFilterToDefault:()=>ct,resultsetWithFields:()=>W,selectConfigDatasource:()=>Q,selectConfigDatasourceAllValue:()=>tt,selectFilterAll:()=>Z,selectValueDefaultInFilter:()=>lt,separateDayMonthYearToSlash:()=>l,splitDataset:()=>V,subtractOneDay:()=>h,subtractOneMonth:()=>y,traverseRows:()=>pt,updateDomElement:()=>R,updateObject:()=>q,updateStackedBarOptions:()=>Ft});const o={"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 n(t){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(t.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"]])},a={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"]])},i={es_ES:new Map([["last_update","Última actualización"]]),ca_ES:new Map([["last_update","Última actualització"]])};function l(t){return t.substring(6,8)+"/"+t.substring(4,6)+"/"+t.substring(0,4)}function s(t){return[t.substring(0,4),o[t.substring(4,6)]]}function c(t){const[e,o]=s(t);return`${o} ${e}`}function u(t){const[e,n,r]=function(t){return[t.substring(0,4),o[t.substring(4,6)],t.substring(6,8)]}(t);return`${r} ${n} ${e}`}function d(t){const[e,o]=s(t);return`${o.substring(0,3)} ${e}`}function f(t){const[e,o]=s(t);return`${o.substring(0,3)} '${e.substring(2,4)}`}function m(t){const[e,o]=t.split("-");return`${parseFloat(o)/3}T ${e}`}function p(t,e){const o=t[e];return Array.from(o.values()).map((t=>t.slice(0,3)))}function h(t){const e=Math.floor(t/1e4);let o=new Date(e,t%1e4/100-1,t%100);return o.setDate(o.getDate()-1),`${o.getFullYear()}${(o.getMonth()+1).toString().padStart(2,"0")}${o.getDate().toString().padStart(2,"0")}`}function y(t){let e;const o=new Date(Math.floor(t/100),t%100-1,0);return e=`${o.getFullYear()}${(o.getMonth()+1).toString().padStart(2,"0")}`,e}function g(t,e=2){let o=navigator.language||navigator.userLanguage;o=o.length<=2?`${o}-${o.toUpperCase()}`:o;const n={minimumFractionDigits:0,maximumFractionDigits:e};return"es-ES"===o?t.toLocaleString("de-DE",n):t.toLocaleString(o,n)}function b(t){const e=1e6;return t>=e?t/e+"M":t.toString()}function S(t){return t>=1e3?t/1e3+" Tn":t.toString()}function v(t){return("string"==typeof t?parseFloat(t):t).toLocaleString("de-DE",{minimumFractionDigits:2,maximumFractionDigits:2})}function M(t){return t>=1e6?{value:(t/1e6).toFixed(2),unit:"G"}:t>=1e3?{value:(t/1e3).toFixed(2),unit:"M"}:{value:t.toFixed(2),unit:"k"}}function x(t,e){return"GWh"===e?{value:parseFloat((t/1e6).toFixed(2)),unit:"GWh"}:"MWh"===e?{value:parseFloat(t/1e3).toFixed(2),unit:"MWh"}:{value:parseFloat(t).toFixed(2),unit:"kWh"}}function A(t,e=29){if(t.length>=e){const o=t.split(" ");let n="",r="";return o.forEach((t=>{`${n} ${t}`.length<=e?n+=(n?" ":"")+t:(r+=`${n}\n`,n=t)})),r+=n,r}return t}function D(t,e,o="MainContentLoadedCustom"){let n=document.getElementById(t);return n?Promise.resolve(e(n)):new Promise((r=>{document.body.addEventListener(o,(()=>{n=document.getElementById(t),n?r(e(n)):(console.error(`El elemento con ID ${t} aún no está disponible después del evento.`),r(null))}))}))}function E(t,e){return D(t,(t=>{const o=echarts.init(t);o.setOption(e,!0),window.addEventListener("resize",(()=>{null!=o&&void 0!==o&&o.resize()}));const n=document.getElementById("main-content");return n&&(n.addEventListener("shown.bs.collapse",(()=>{o.resize()})),n.addEventListener("hidden.bs.collapse",(()=>{o.resize()}))),o}))}function w(t,e){const o=t?document.querySelector(t):null,n=e?document.querySelector(e):null;o&&(o.hidden=!0),n&&(n.style.background="url('./build/images/nodata1.png') no-repeat top center",n.hidden=!1)}function C(t,e){const o=t?document.querySelector(t):null,n=e?document.querySelector(e):null;o&&(o.hidden=!0),n&&(n.style.background="#ffffff",n.hidden=!1)}function $(t,e=!1,o=!0,n=""){let r=`<p style="font-weight: 500;color: #565656;">${t[0].name}</p>`;return t.forEach((t=>{const a=e?Math.round(t.data):t.data,i=o?`<div style="font-weight: 400;color: #666;">${l=t.color,`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;font-weight: 500;background-color:${l}"></span>`} ${t.seriesName}: \n <span style="float: right; margin-left:20px;font-weight: 600;color: #565656;">\n ${t.data?`${g(a)} ${n}`:"-"}\n </span>\n </div>`:`<div>\n <span style="font-weight: 600;color: #565656;">${t.data?`${g(a)} ${n}`:"-"}\n </span>\n </div>`;var l;r+=i})),r}function F(t){return 100*(t-120)/t}function N(t,e){const o=Math.max(...t);return o+(e-o%e)}function L(t,e=!1){const o=`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:${t.color}"></span>`,n=e?`${t.percent}%`:g(t.value);return`<div> ${o} ${t.name} <span style="float: right; margin-left:20px;font-weight: 600;color: #333;"> ${n} </span></div>`}function T(t,e){let o=`${t.name} : `;return o+=`<span style="font-weight:500">${g(Math.round(t.value))}</span>`,e&&(o+=`<span> (${t.percent}%)</span>`),t.marker+o}function O(t){const e=1e6,o=Number(t);return o>=0&&o<e?`${g(o)} €`:o>=e?`${g(o/e)} M €`:"-"}function I(t,e,o=1){const n=Math.max(...t.map((t=>t[e])))*o;return 5e3*Math.ceil(n/5e3)}function z(t,e,o,n=30,r=15,a=30,i=-70,l=70,s=3){const c=I(t,e.data,1.1),u=l,d=o.slice(),f=[];let m=r,p=a,h=i;for(let o=0;o<t.length;o+=1)f.push({value:t[o][e.data],name:A(String(t[o][e.type]).replace(/\[.*?\]/g,"")),color:d.shift(),title:{offsetCenter:[`${String(h)}%`,`${String(m)}%`],fontFamily:"Montserrat",fontSize:n},detail:{offsetCenter:[`${String(h)}%`,`${String(p)}%`],fontFamily:"Montserrat",width:"33%",formatter:t=>g(Math.round(t))}}),h+=u,(o+1)%s==0&&(p+=a,m+=2*r,h=i);return[c,f]}function P(t,e,o,r=0){return[I(e,o.data,1),t=>function(t,e,o){const r=g(Math.round(e)),a=n(t[o][0]),i=t[o][1],l=`\n${a} ${i} : ${r}`,s=`${r}\n${a} ${i}`;return window.innerWidth<=1710?l:s}(e,t,r),[{value:e[r][o.data]}]]}function k(t,e){const{resultset:o}={resultset:t},n=new Set,r=new Set,a=o.map((([t,o,a])=>{const i=e?Math.round(a):a;return n.add(t),r.add(o),{day:o,type:t,value:i}})),i=Array.from(r.values()),l=Array.from(n.values());return l.sort(((t,e)=>t.toLowerCase().localeCompare(e.toLowerCase(),"es",{ignorePunctuation:!0}))),[l.map((t=>{const e=a.filter((e=>e.type===t)).map((({day:e,value:o})=>[e,t,o])),o=i.map((t=>{const o=e.find((([e])=>e===t));return o?o[2]:null}));return{name:t,data:o}})),l,r]}function _(t,e=[],o=!1){const[n,r,a]=k(t,o);return n.forEach((t=>{t.type="line",t.symbol="circle",t.symbolSize=6,t.smooth=.1,e.length>0&&(t.color=e.shift())})),[n,a,r]}function B(t,e,o=!1){const[n,r,a]=k(t,o);return n.forEach((t=>{t.type="bar",t.color=e.shift(),t.smooth=!1})),[n,a,r]}function W(t){const{resultset:e,metadata:o}=t,n=[];return e.forEach((t=>{const e={};t.forEach(((t,n)=>{e[o[n].colName]=t})),n.push(e)})),n}function q(t,e){const o={...t};return Object.keys(e).forEach((n=>{Object.prototype.hasOwnProperty.call(e,n)&&("series"===n&&Array.isArray(e[n])?o[n]=e[n].map(((e,o)=>({...Array.isArray(t[n])&&t[n][o]||{},...e}))):"object"!=typeof e[n]||null===e[n]||Array.isArray(e[n])?t[n]!==e[n]&&(o[n]=e[n]):o[n]=q(t[n]||{},e[n]))})),o}function J(t,e){console.log("INICIO HTML");const o=()=>{t.forEach((t=>{t.id in e&&Object.entries(e[t.id]).forEach((o=>{const n=o[0],r=o[1];"object"==typeof r?r.className?document.querySelector(r.className).className=t[n]:r.element&&r.format&&(document.querySelector(r.element).textContent=e[t.id][n].format(t[n])):document.querySelector(r).textContent=t[n]}))}))};try{o()}catch(t){document.body.addEventListener("MainContentLoadedCustom",(()=>{o()}))}}function j(t,e){const o=W(t),n=[];let r=null;return o.forEach((t=>{const o=t[e];"number"!=typeof o||Number.isNaN(o)||n.push(o)})),n.length>0&&(r=Math.max(...n)),r}function R(t,e){const o=document.querySelector(t);o?o.textContent=e:console.warn(`Elemento ${t} no encontrado en el DOM`)}function V(t,e=!0){const o={Cont:[],Mob:[]};return t.forEach((t=>{"is-res-001-kgs-contenidors"===t[0]&&"total"===t[1]&&(e?o.Cont.push([t[3],t[4],t[2]]):o.Cont.push([t[3],t[2]])),"Mobles"===t[1]&&(e?o.Mob.push([t[3],t[4],t[2]]):o.Mob.push([t[3],t[2]]))})),o}const G=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],H=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],Y=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],U=["Dom","Lun","Mar","Mié","Juv","Vie","Sáb"],X=["Do","Lu","Ma","Mi","Ju","Vi","Sá"];function Z(t){const e=t.resultset.map((t=>t[0]));return this.dashboard.fireChange(this.parameter,e),t}function K(t){for(const e of t)if(Array.isArray(e)){if(!K(e))return!1}else if("All"!==e)return!1;return!0}function Q(t,e,o,n){return K(e)?(t.queryDefinition.dataAccessId=o,t.dashboard.setParameter(t.parameter,["All"])):t.queryDefinition.dataAccessId=n,!0}function tt(t){return t.dashboard.setParameter(t.parameter,["All"]),!0}function et(t){t.forEach((t=>{Dashboards.fireChange(t,["All"])}))}function ot(t="Todos"){return{input:{root:{id:"All"},indexes:{id:0,label:0}},component:{Root:{strings:{isDisabled:"No disponible",allItems:t,noItems:"Ninguno",btnApply:"Aceptar",btnCancel:"Cancelar"}},Group:{Strings:{allItems:"Todos",noItems:"Ninguno",btnApply:"Aceptar",btnCancel:"Cancelar"}}}}}function nt(t="Todos"){const e=ot(t);return e.input.indexes.id=1,e.input.indexes.label=0,e}function rt(t,e,o,n){const r=Dashboards.getParameterValue(o),a=Dashboards.getParameterValue(n);return Dashboards.fireChange(t,[r]),Dashboards.fireChange(e,[a]),!0}function at(t,e){const o=Dashboards.getParameterValue(e);return Dashboards.fireChange(t,[o]),!0}function it(t,e){Dashboards.fireChange(e,t.resultset[0][0])}function lt(t,e){const o=Dashboards.getParameterValue(e),n=t.parameter;t.dashboard.setParameter(n,[o])}function st(t){t.regional.es={monthNames:G,abbreviatedMonthNames:H,dayNames:Y,abbreviatedDayNames:U,dayNamesMin:X,weekHeader:"Sm",firstDay:1,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},t.setDefaults(t.regional.es)}function ct(t,e){const o=Dashboards.getParameterValue(e);return Dashboards.fireChange(t,Array.isArray(o)?o:[o]),!0}function ut(t,e){return D(t,(t=>new Tabulator(t,e)))}function dt(t,e){let o=t.getValue();return o.length>e&&(o=`${o.substr(0,e)}<br>${o.substr(e)}`),o}function ft(t,e){const o=t.getValue().split(" ");let n="",r="";return o.forEach((t=>{(r+t).length<=e?r+=`${t} `:(n+=`${r}<br>`,r=`${t} `)})),n+=`${r}<br>`,n}function mt(t,e){"expand"===e?t.treeExpand():t.treeCollapse();const o=t.getTreeChildren();o.length>0&&o.forEach((t=>{t.getTreeChildren().length>0&&mt(t,e)}))}function pt(t,e){t.getRows().forEach((t=>{t.getTreeChildren().length>0&&mt(t,e)}))}function ht(t,e,o,n){const r=[];for(const a in t)if(t.hasOwnProperty(a)){const i=t[a],l={[e]:i[0],_children:[]};i.shift(),i.forEach(((t,r)=>{const a={[e]:o[r],[n]:t};l._children.push(a)})),r.push(l)}return r}function yt(t){let e=!0;return t.getGroups().forEach((t=>{t._group.visible&&(e=!1)})),e}function gt(t,e,o){const n=document.getElementById(o),r=n.cloneNode(!0);n.parentNode.replaceChild(r,n),r.addEventListener("click",(()=>{t.download("csv",`${e}.csv`,{delimiter:";"})}))}function bt(t,e,o){const n=document.getElementById(o),r=n.cloneNode(!0);n.parentNode.replaceChild(r,n),r.addEventListener("click",(()=>{t.download("pdf",`${e}.pdf`,{title:e,rowCalcStyles:{fontSize:8,fontStyle:"bold"},autoTable:{styles:{fontSize:8}}})}))}const St={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 vt(t){const e=[],o={0:"b",1:"a",2:"d",3:"m",4:"mm",5:"em",6:"",7:"nd"};function n(t,e,n){const r=document.createElement("td");if(r.setAttribute("id",t),null!=e){r.innerHTML=e;const t=function(t,e){let n;return void 0===e?n=6:"ND"===e?n=7:(n=5,t.forEach(((t,o)=>{e<=t&&5===n&&(n=o)}))),o[n]}(n,e);r.classList.add(t)}return r}return t.forEach((t=>{const o=t;"noData"===o.operationalstatus&&(o.so2value="ND",o.no2value="ND",o.o3value="ND",o.pm10value="ND",o.pm25value="ND"),"A09_CABANYAL_60m"===o.entityid&&(o.pm10value=void 0,o.pm25value=void 0);const r=document.createElement("tr"),a=document.createElement("td");a.innerHTML=o.address,r.appendChild(a),r.appendChild(n(`${o.entityid}_so2`,o.so2value,St.SO2)),r.appendChild(n(`${o.entityid}_no2`,o.no2value,St.NO2)),r.appendChild(n(`${o.entityid}_o3`,o.o3value,St.O3)),r.appendChild(n(`${o.entityid}_pm10`,o.pm10value,St.PM10)),r.appendChild(n(`${o.entityid}_pm25`,o.pm25value,St.PM25)),e.push(r)})),e}function Mt(t){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${t}`}function xt(){const t=window.location.href;let e="";return e=t.includes("localhost")?"local":t.includes("sc_valencia_pre")?"PRE":"PRO",e}function At(t,e){document.querySelectorAll(`[${t}]`).forEach((o=>{!function(t,e,o){const n=e;if(t){const e=new XMLHttpRequest;e.onreadystatechange=function(){4===this.readyState&&(200===this.status&&(n.innerHTML=this.responseText,o&&o()),404===this.status&&(n.innerHTML="No se ha podido cargar correctamente."))},e.open("GET",t,!0),e.send()}}(o.getAttribute(t),o,e)}))}function Dt(t){At("include-html-cabecera",(function(){!function(){const t=xt();"PRO"!==t&&(document.title+=` (${t})`)}(),function(){const t=xt();"PRO"!==t&&(document.querySelector("nav").querySelectorAll("span")[1].textContent+=` (${t})`)}()})),At("include-html-menu"),At("include-html-main-container",(function(){document.body.dispatchEvent(new Event("MainContentLoadedCustom")),function(){const t=document.querySelector("body");t.classList.remove("inicio"),t.classList.add(document.documentURI.split("%3A")[4].match(/(.*?).wcdf/)[1])}(),t&&t()})),At("include-html-copyright")}function Et(t,e,o,n,r,a){let i=!1,l=!1;const s=document.querySelector(t),c=document.querySelector(e),u=()=>{"undefined"!=typeof Liferay&&"ca-ES"===Liferay.ThemeDisplay.getBCP47LanguageId()?(s&&s.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")):(s&&s.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 d(t=!0){const e=document.querySelector(o);t?(s&&(s.src="about:blank"),c&&(c.src="about:blank"),e.classList.add("blur"),l=!0):(e.classList.remove("blur"),u(),l=!1)}const f=t=>{new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting&&(l||u(),i||(i=!0,window.setTimeout(d,a)))}))})).observe(t)};!function(){const{userAgent:t}=navigator;return/iPad|iPhone|iPod|Macintosh/.test(t)&&!window.MSStream}()?(s&&(s.setAttribute("sandbox","allow-scripts"),f(s)),c&&(c.setAttribute("sandbox","allow-scripts"),f(c)),document.querySelector(r).addEventListener("click",(()=>{d(!1),window.setTimeout(d,a)}))):document.querySelectorAll(n)[0].style.display="none"}const wt={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:t=>`${t}%`}},{type:"value",position:"left",axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400},formatter:t=>`${b(t)}€`}}]},Ct=(t,e)=>{e.sort(((t,e)=>parseInt(t.anyo)-parseInt(e.anyo)));const o={};e.forEach((e=>{const n=e[1],r=e[0];r!==t.seriesName||o[n]||(o[n]=0),r===t.seriesName&&(o[n]+=e[2])}));let n=`<p>${t.seriesName}</p>`;for(const[e,r]of Object.entries(o))n+=`<div>${t.marker} ${e}: <span style="float: right; margin-left:20px;font-weight: 600;">${g(r)}</span></div>`;return n};function $t(t,e,o=void 0,n=void 0){const r=null===n?void 0:n,a=new Set(e.map((t=>t[1])));let i;const l={title:{text:"SIN TITULO",left:"center",top:"top",textStyle:{fontSize:20,fontFamily:"Montserrat",fontWeight:600,color:"#666"}},tooltip:{axisPointer:{type:"shadow"},trigger:"item",formatter:t=>Ct(t,e),textStyle:{fontFamily:"Montserrat"},position(t,e,o,n,r){const a={},i=r.contentSize[1]/2,l=r.viewSize[1],s=t[1];return s<i?a.top=10:s+i>l?a.bottom=10:a.top=s-i,t[0]<r.viewSize[0]/2?a.left=t[0]+20:a.right=r.viewSize[0]-t[0]+20,a}},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:t=>g(t)},splitLine:{lineStyle:{color:"#DDD"}}},yAxis:{type:"category",data:Array.from(a),axisLabel:{textStyle:{fontFamily:"Montserrat"}}},series:(()=>{const t={name:"SIN NOMBRE",type:"bar",stack:"total",label:{show:!0,fontFamily:"Montserrat",fontSize:10,formatter:t=>g(Math.round(t.value))},itemStyle:void 0,emphasis:{focus:"series"},data:void 0};r&&r.itemStyle&&Array.isArray(r.itemStyle.borderColor)&&(i=[...r.itemStyle.borderColor],delete r.itemStyle.borderColor);const o=function(t){return t.reduce(((t,e)=>{const o=e[0];return t[o]||(t[o]=[]),t[o].push(e),t}),{})}(e),n=Object.keys(o);a.forEach((t=>{n.forEach((e=>{void 0===o[e].find((e=>e[1]===t))&&(o[e].push([o[e][0][0],t,void 0]),o[e].sort())}))}));const l=[];return Object.keys(o).forEach((e=>{i&&(t.itemStyle={borderColor:i.shift()}),t.name=e,t.data=o[e].map((t=>t[2]));let n={};n=void 0!==r?q(t,r):t,l.push({...n})})),l})(),toolbox:{show:!0,feature:{restore:{title:"Restablir"},saveAsImage:{title:"Desar"}},right:50}};let s={};s=void 0!==o?q(l,o):l,E(t,s)}function Ft(t){let e={};return e=q(wt,t),e}function Nt(t,e,o={},r={}){let a={};a=q(o,{color:["#81B1CC","#ABD9EA","#C2EEF9","#F9E2AF","#F9C780","#FDAE61","#F46D43","#FDAE61","#F9E2AF","#C2EEF9","#ABD9EA","#81B1CC"],yAxis:{data:function(){const t=new Set;return e.forEach((e=>{t.add(e[1])})),Array.from(t).sort(((t,e)=>t-e))}()}});const i={itemStyle:{borderWidth:2,borderColor:["#448DAD","#89CADB","#A0DEE8","#F4D28C","#F4B569","#F79646","#F25930","#F79646","#F4D28C","#A0DEE8","#89CADB","#448DAD"]}},l=null===r?i:q(r,i),s=e;s.forEach(((t,e)=>{s[e][0]=n(t[0])})),$t(t,s,a,l)}function Lt(t,e=void 0){const o={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:t=>T(t,!1)},series:[{type:"bar",showBackground:!0}]};let n={};n=void 0!==e?q(o,e):o,E(t,n)}const Tt="es_ES",Ot={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"]])};function It(t){return Math.max(...t.map((t=>Number(t[0]))))}function zt(t){const e=t.filter((e=>Number(e[0])===It(t))),o=Array.from({length:12},(()=>0));return e.forEach((([t,e,n])=>{const r=parseInt(e,10)-1;o[r]=n})),o}function Pt(t){const e=t.filter((e=>Number(e[0])===It(t)-1)),o=Array.from({length:12},(()=>0));return e.forEach((([t,e,n])=>{const r=parseInt(e,10)-1;o[r]=n})),o}function kt(t,e,o=void 0){const n=It(e).toString(),r=(It(e)-1).toString();Lt(t,q({title:{left:"center",top:"-12%",textStyle:{fontSize:15,fontFamily:"Montserrat"}},legend:{top:"10%",show:!0,data:[r,n],textStyle:{fontFamily:"Montserrat"}},grid:{bottom:"8%",top:"20%",right:"2%"},xAxis:[{type:"category",data:p(Ot,Tt),interval:0,margin:10,axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400}}}],yAxis:[{type:"value",axisLabel:{formatter:t=>t.toLocaleString("es-ES"),textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400}}}],series:[{name:r,type:"bar",data:Pt(e)},{name:n,type:"bar",barGap:0,data:zt(e)}]},o))}function _t(t,e,o){const n=document.querySelector(e),r=document.querySelector(t);let a=!1;r.addEventListener("click",(()=>{!1===a&&(a=!0,n.setAttribute("src","about:blank"),n.setAttribute("src",o),n.onload=()=>{a=!1})})),r.disabled=!1}const Bt="id",Wt="fecha",qt="value";function Jt(t,e,o,n,r="es_ES"){const[a,i]=function(t,e,o){const n=[],r=[];return t.forEach((t=>{e.includes(`${t[Bt]}`)?n.push(`${t[Wt]}`):o.includes(`${t[Bt]}`)&&r.push(`${t[Wt]}`)})),[n.map((t=>[t,0])),r.map((t=>[t,0]))]}(t,o,n);let l="es_ES"==r?"Datos sin validar":"Dades sense validar";0===i.length&&(l="");const s={name:"Datos validados",type:"line",data:[...a,i[0]],lineStyle:{color:"#00A9A0",width:4},showSymbol:!1,tooltip:{show:!1}};let c="",u="";if(0===i.length){const e=t[t.length-1].fecha;c=e,u=e}else c=i[0][0],u=i[i.length-1][0];return[...e,s,{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:l,xAxis:c,yAxis:0},{name:"end",xAxis:u,yAxis:Math.max(...t.filter((t=>null!==t[qt])).map((t=>parseInt(`${t[qt]}`,10))))}]]}}]}function jt(t,e,o=void 0){E(t,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:t=>$(t),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:e},o))}return e})(),t.exports=e()}},e={};function o(n){var r=e[n];if(void 0!==r)return r.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,o),a.exports}o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";o.r(n),o.d(n,{echartTemperatureMitjanaDiaria:()=>i});var t=o(2725);const e={title:{text:""},tooltip:{trigger:"axis"},legend:{data:[]},grid:{left:"0",right:"0",bottom:"10",top:"50",containLabel:!0},toolbox:{feature:{saveAsImage:{}}},xAxis:[{type:"category",data:[],axisTick:{show:!1},boundaryGap:["20%","20%"],gridIndex:0,offset:0,axisLine:{lineStyle:{color:"#ccc"}},axisLabel:{show:!0,interval:"auto",textStyle:{fontFamily:"Montserrat",fontSize:10,color:"#333"}}}],yAxis:{type:"value"},series:[]},r=["#9c89b8","#4ea8de","#05668d","#ffbf69","#e56b6f","#83c5be","#02c39a","#ee9b00","#cdb4db","#ffadad","#ce4257","#b7b7a4"],a="#ffbf69";function i(o,n){const i="chartTemperatureMitjanaDiaria";!function(t,e,o){!function(t){return t.length>0}(t)?function(t,e){const o=t?document.querySelector(t):null,n=e?document.querySelector(e):null;o&&(o.hidden=!0),n&&(n.style.background="url('./build/images/nodata1.png') no-repeat top center",n.hidden=!1)}(`#${e}`,`#${o}`):function(t,e){const o=t?document.querySelector(t):null,n=e?document.querySelector(e):null;o&&(o.hidden=!0),n&&(n.style.background="#ffffff",n.hidden=!1)}(`#${o}`,`#${e}`)}(n.resultset,i,"no_dataTemperatureMitjanaDiaria");const l=(0,t.resultsetWithFields)(n),s=JSON.parse(JSON.stringify(e)),c=function(t){const e={},o={},n=[],a=function(){const t=[],e=new Date(2024,0,1),o=new Date(2024,11,31);for(let n=e;n<=o;n.setDate(n.getDate()+1)){const e=String(n.getDate()).padStart(2,"0"),o=String(n.getMonth()+1).padStart(2,"0");t.push(`${e}-${o}`)}return t}(),i=r.slice();return t.forEach((t=>{const{dias:r,name:a,value:l}=t;o[r]||(o[r]={}),o[r][a]=l,n.includes(a)||(n.push(a),e[a]={name:a,smooth:!0,type:"line",data:[],color:i.shift()})})),n.sort(),{seriesMap:e,groupedSerieData:o,legendData:n,xAxisCategories:a}}(l);let{seriesMap:u}=c;const{groupedSerieData:d,legendData:f,xAxisCategories:m}=c,p=f.find((t=>t.includes("pdte."))),h=(y=p)?y.substring(0,4):"";var y;s.legend.data=f,s.xAxis[0].data=m,function(t,e,o,n){t.forEach((t=>{e.forEach((e=>{n[e].data.push(o[t][e]||null)}))}))}(m,f,d,u),u=function(t,e,o){const n={dotted:{color:a,type:"dotted"},solid:{color:a}},r={...t},i=(t,e)=>{t&&r[t]&&(r[t].lineStyle=e,r[t].itemStyle=e)};return i(e,n.dotted),i(o,n.solid),r}(u,p,h),s.series=Object.values(u),function(t,e){const o=document.getElementById(t);if(!o)return console.error(`No se pudo encontrar el elemento con ID ${t}.`),null;const n=echarts.init(o);n.setOption(e,!0),$(window).on("resize",(()=>{null!=n&&void 0!==n&&n.resize()}))}(i,s)}})(),n})()));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.mediAmbient=e():t.mediAmbient=e()}(self,(()=>(()=>{var t={2725:t=>{var e;self,e=()=>(()=>{"use strict";var t={d:(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{MONTHS_YEAR:()=>r,MONTHS_YEAR_SHORT:()=>a,TEXTS_COMMON:()=>i,THRESHOLDS:()=>St,addPointInteger:()=>g,buildCamarasTrafico:()=>Et,buildTableCalidadAire:()=>vt,calculateMaxYAxis:()=>N,calculatePentahoPath:()=>Mt,calculateXAxisStart:()=>$,checkAllGroupsCollapsed:()=>yt,checkAndTransformMaxValue:()=>x,configureDataBar:()=>_,configureDataGaugeCommon:()=>I,configureDataGaugeMonthCommon:()=>k,configureDataLine:()=>B,configureDataValidate:()=>Jt,configureLinesChartValidates:()=>jt,convertToLanguageSelectorDateRange:()=>st,convertToTableTreeView:()=>ht,downloadCSVTable:()=>gt,downloadPDFTable:()=>bt,formatCellMultiplesLines:()=>ft,formatDayMonthYear:()=>u,formatDecimalNumberfromDotToComma:()=>v,formatMilMillionEuros:()=>O,formatMonthAnyo:()=>c,formatName:()=>A,formatNameHeaderColumn:()=>dt,formatRoundTooltip:()=>T,formatShortMonthShortYear:()=>f,formatShortMonthYear:()=>d,formatToMillions:()=>b,formatToTons:()=>S,formatTooltip:()=>F,formatTooltipPie:()=>L,formatTrimestre:()=>m,formatWithPrefix:()=>M,getEnvironment:()=>xt,getMaxFieldNumberFromData:()=>j,getMonth:()=>n,getMonthList:()=>p,getSelectCommonOptions:()=>ot,getSelectTwoColumnsOptions:()=>nt,initBarChart:()=>Lt,initBarChartComparationMonth:()=>Pt,initChart:()=>E,initElement:()=>D,initStackedBarChart:()=>Ft,initStackedBarChartMonthSeries:()=>Nt,initTable:()=>ut,initValueDefaultDate:()=>it,initialCalls:()=>Dt,loadIframeOnClickEvent:()=>Bt,printDataChart:()=>w,printDataInHTMLElements:()=>J,printNoDataChart:()=>C,resetFilter:()=>et,resetFilterDate:()=>at,resetFilterDates:()=>rt,resetFilterToDefault:()=>ct,resultsetWithFields:()=>W,selectConfigDatasource:()=>Q,selectConfigDatasourceAllValue:()=>tt,selectFilterAll:()=>X,selectValueDefaultInFilter:()=>lt,separateDayMonthYearToSlash:()=>l,splitDataset:()=>H,subtractOneDay:()=>h,subtractOneMonth:()=>y,traverseRows:()=>pt,updateDomElement:()=>R,updateObject:()=>q,updateStackedBarOptions:()=>$t});const o={"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 n(t){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(t.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"]])},a={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"]])},i={es_ES:new Map([["last_update","Última actualización"]]),ca_ES:new Map([["last_update","Última actualització"]])};function l(t){return t.substring(6,8)+"/"+t.substring(4,6)+"/"+t.substring(0,4)}function s(t){return[t.substring(0,4),o[t.substring(4,6)]]}function c(t){const[e,o]=s(t);return`${o} ${e}`}function u(t){const[e,n,r]=function(t){return[t.substring(0,4),o[t.substring(4,6)],t.substring(6,8)]}(t);return`${r} ${n} ${e}`}function d(t){const[e,o]=s(t);return`${o.substring(0,3)} ${e}`}function f(t){const[e,o]=s(t);return`${o.substring(0,3)} '${e.substring(2,4)}`}function m(t){const[e,o]=t.split("-");return`${parseFloat(o)/3}T ${e}`}function p(t,e){const o=t[e];return Array.from(o.values()).map((t=>t.slice(0,3)))}function h(t){const e=Math.floor(t/1e4);let o=new Date(e,t%1e4/100-1,t%100);return o.setDate(o.getDate()-1),`${o.getFullYear()}${(o.getMonth()+1).toString().padStart(2,"0")}${o.getDate().toString().padStart(2,"0")}`}function y(t){let e;const o=new Date(Math.floor(t/100),t%100-1,0);return e=`${o.getFullYear()}${(o.getMonth()+1).toString().padStart(2,"0")}`,e}function g(t,e=2){let o=navigator.language||navigator.userLanguage;o=o.length<=2?`${o}-${o.toUpperCase()}`:o;const n={minimumFractionDigits:0,maximumFractionDigits:e};return"es-ES"===o?t.toLocaleString("de-DE",n):t.toLocaleString(o,n)}function b(t){const e=1e6;return t>=e?t/e+"M":t.toString()}function S(t){return t>=1e3?t/1e3+" Tn":t.toString()}function v(t){return("string"==typeof t?parseFloat(t):t).toLocaleString("de-DE",{minimumFractionDigits:2,maximumFractionDigits:2})}function M(t){return t>=1e6?{value:(t/1e6).toFixed(2),unit:"G"}:t>=1e3?{value:(t/1e3).toFixed(2),unit:"M"}:{value:t.toFixed(2),unit:"k"}}function x(t,e){return"GWh"===e?{value:parseFloat((t/1e6).toFixed(2)),unit:"GWh"}:"MWh"===e?{value:parseFloat(t/1e3).toFixed(2),unit:"MWh"}:{value:parseFloat(t).toFixed(2),unit:"kWh"}}function A(t,e=29){if(t.length>=e){const o=t.split(" ");let n="",r="";return o.forEach((t=>{`${n} ${t}`.length<=e?n+=(n?" ":"")+t:(r+=`${n}\n`,n=t)})),r+=n,r}return t}function D(t,e,o="MainContentLoadedCustom"){let n=document.getElementById(t);return n?Promise.resolve(e(n)):new Promise((r=>{document.body.addEventListener(o,(()=>{n=document.getElementById(t),n?r(e(n)):(console.error(`El elemento con ID ${t} aún no está disponible después del evento.`),r(null))}))}))}function E(t,e){return D(t,(t=>{const o=echarts.init(t);o.setOption(e,!0),window.addEventListener("resize",(()=>{null!=o&&void 0!==o&&o.resize()}));const n=document.getElementById("main-content");return n&&(n.addEventListener("shown.bs.collapse",(()=>{o.resize()})),n.addEventListener("hidden.bs.collapse",(()=>{o.resize()}))),o}))}function C(t,e){const o=t?document.querySelector(t):null,n=e?document.querySelector(e):null;o&&(o.hidden=!0),n&&(n.style.background="url('./build/images/nodata1.png') no-repeat top center",n.hidden=!1)}function w(t,e){const o=t?document.querySelector(t):null,n=e?document.querySelector(e):null;o&&(o.hidden=!0),n&&(n.style.background="#ffffff",n.hidden=!1)}function F(t,e=!1,o=!0,n=""){let r=`<p style="font-weight: 500;color: #565656;">${t[0].name}</p>`;return t.forEach((t=>{const a=e?Math.round(t.data):t.data,i=o?`<div style="font-weight: 400;color: #666;">${l=t.color,`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;font-weight: 500;background-color:${l}"></span>`} ${t.seriesName}: \n <span style="float: right; margin-left:20px;font-weight: 600;color: #565656;">\n ${t.data?`${g(a)} ${n}`:"-"}\n </span>\n </div>`:`<div>\n <span style="font-weight: 600;color: #565656;">${t.data?`${g(a)} ${n}`:"-"}\n </span>\n </div>`;var l;r+=i})),r}function $(t){return 100*(t-120)/t}function N(t,e){const o=Math.max(...t);return o+(e-o%e)}function L(t,e=!1){const o=`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:${t.color}"></span>`,n=e?`${t.percent}%`:g(t.value);return`<div> ${o} ${t.name} <span style="float: right; margin-left:20px;font-weight: 600;color: #333;"> ${n} </span></div>`}function T(t,e){let o=`${t.name} : `;return o+=`<span style="font-weight:500">${g(Math.round(t.value))}</span>`,e&&(o+=`<span> (${t.percent}%)</span>`),t.marker+o}function O(t){const e=1e6,o=Number(t);return o>=0&&o<e?`${g(o)} €`:o>=e?`${g(o/e)} M €`:"-"}function z(t,e,o=1){const n=Math.max(...t.map((t=>t[e])))*o;return 5e3*Math.ceil(n/5e3)}function I(t,e,o,n=30,r=15,a=30,i=-70,l=70,s=3){const c=z(t,e.data,1.1),u=l,d=o.slice(),f=[];let m=r,p=a,h=i;for(let o=0;o<t.length;o+=1)f.push({value:t[o][e.data],name:A(String(t[o][e.type]).replace(/\[.*?\]/g,"")),color:d.shift(),title:{offsetCenter:[`${String(h)}%`,`${String(m)}%`],fontFamily:"Montserrat",fontSize:n},detail:{offsetCenter:[`${String(h)}%`,`${String(p)}%`],fontFamily:"Montserrat",width:"33%",formatter:t=>g(Math.round(t))}}),h+=u,(o+1)%s==0&&(p+=a,m+=2*r,h=i);return[c,f]}function k(t,e,o,r=0){return[z(e,o.data,1),t=>function(t,e,o){const r=g(Math.round(e)),a=n(t[o][0]),i=t[o][1],l=`\n${a} ${i} : ${r}`,s=`${r}\n${a} ${i}`;return window.innerWidth<=1710?l:s}(e,t,r),[{value:e[r][o.data]}]]}function P(t,e){const{resultset:o}={resultset:t},n=new Set,r=new Set,a=o.map((([t,o,a])=>{const i=e?Math.round(a):a;return n.add(t),r.add(o),{day:o,type:t,value:i}})),i=Array.from(r.values()),l=Array.from(n.values());return l.sort(((t,e)=>t.toLowerCase().localeCompare(e.toLowerCase(),"es",{ignorePunctuation:!0}))),[l.map((t=>{const e=a.filter((e=>e.type===t)).map((({day:e,value:o})=>[e,t,o])),o=i.map((t=>{const o=e.find((([e])=>e===t));return o?o[2]:null}));return{name:t,data:o}})),l,r]}function B(t,e=[],o=!1){const[n,r,a]=P(t,o);return n.forEach((t=>{t.type="line",t.symbol="circle",t.symbolSize=6,t.smooth=.1,e.length>0&&(t.color=e.shift())})),[n,a,r]}function _(t,e,o=!1){const[n,r,a]=P(t,o);return n.forEach((t=>{t.type="bar",t.color=e.shift(),t.smooth=!1})),[n,a,r]}function W(t){const{resultset:e,metadata:o}=t,n=[];return e.forEach((t=>{const e={};t.forEach(((t,n)=>{e[o[n].colName]=t})),n.push(e)})),n}function q(t,e){const o={...t};return Object.keys(e).forEach((n=>{Object.prototype.hasOwnProperty.call(e,n)&&("series"===n&&Array.isArray(e[n])?o[n]=e[n].map(((e,o)=>({...Array.isArray(t[n])&&t[n][o]||{},...e}))):"object"!=typeof e[n]||null===e[n]||Array.isArray(e[n])?t[n]!==e[n]&&(o[n]=e[n]):o[n]=q(t[n]||{},e[n]))})),o}function J(t,e){console.log("INICIO HTML");const o=()=>{t.forEach((t=>{t.id in e&&Object.entries(e[t.id]).forEach((o=>{const n=o[0],r=o[1];"object"==typeof r?r.className?document.querySelector(r.className).className=t[n]:r.element&&r.format&&(document.querySelector(r.element).textContent=e[t.id][n].format(t[n])):document.querySelector(r).textContent=t[n]}))}))};try{o()}catch(t){document.body.addEventListener("MainContentLoadedCustom",(()=>{o()}))}}function j(t,e){const o=W(t),n=[];let r=null;return o.forEach((t=>{const o=t[e];"number"!=typeof o||Number.isNaN(o)||n.push(o)})),n.length>0&&(r=Math.max(...n)),r}function R(t,e){const o=document.querySelector(t);o?o.textContent=e:console.warn(`Elemento ${t} no encontrado en el DOM`)}function H(t,e=!0){const o={Cont:[],Mob:[]};return t.forEach((t=>{"is-res-001-kgs-contenidors"===t[0]&&"total"===t[1]&&(e?o.Cont.push([t[3],t[4],t[2]]):o.Cont.push([t[3],t[2]])),"Mobles"===t[1]&&(e?o.Mob.push([t[3],t[4],t[2]]):o.Mob.push([t[3],t[2]]))})),o}const V=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],G=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],Y=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],U=["Dom","Lun","Mar","Mié","Juv","Vie","Sáb"],Z=["Do","Lu","Ma","Mi","Ju","Vi","Sá"];function X(t){const e=t.resultset.map((t=>t[0]));return this.dashboard.fireChange(this.parameter,e),t}function K(t){for(const e of t)if(Array.isArray(e)){if(!K(e))return!1}else if("All"!==e)return!1;return!0}function Q(t,e,o,n){return K(e)?(t.queryDefinition.dataAccessId=o,t.dashboard.setParameter(t.parameter,["All"])):t.queryDefinition.dataAccessId=n,!0}function tt(t){return t.dashboard.setParameter(t.parameter,["All"]),!0}function et(t){t.forEach((t=>{Dashboards.fireChange(t,["All"])}))}function ot(t="Todos"){return{input:{root:{id:"All"},indexes:{id:0,label:0}},component:{Root:{strings:{isDisabled:"No disponible",allItems:t,noItems:"Ninguno",btnApply:"Aceptar",btnCancel:"Cancelar"}},Group:{Strings:{allItems:"Todos",noItems:"Ninguno",btnApply:"Aceptar",btnCancel:"Cancelar"}}}}}function nt(t="Todos"){const e=ot(t);return e.input.indexes.id=1,e.input.indexes.label=0,e}function rt(t,e,o,n){const r=Dashboards.getParameterValue(o),a=Dashboards.getParameterValue(n);return Dashboards.fireChange(t,[r]),Dashboards.fireChange(e,[a]),!0}function at(t,e){const o=Dashboards.getParameterValue(e);return Dashboards.fireChange(t,[o]),!0}function it(t,e){Dashboards.fireChange(e,t.resultset[0][0])}function lt(t,e){const o=Dashboards.getParameterValue(e),n=t.parameter;t.dashboard.setParameter(n,[o])}function st(t){t.regional.es={monthNames:V,abbreviatedMonthNames:G,dayNames:Y,abbreviatedDayNames:U,dayNamesMin:Z,weekHeader:"Sm",firstDay:1,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},t.setDefaults(t.regional.es)}function ct(t,e){const o=Dashboards.getParameterValue(e);return Dashboards.fireChange(t,Array.isArray(o)?o:[o]),!0}function ut(t,e){return D(t,(t=>new Tabulator(t,e)))}function dt(t,e){let o=t.getValue();return o.length>e&&(o=`${o.substr(0,e)}<br>${o.substr(e)}`),o}function ft(t,e){const o=t.getValue().split(" ");let n="",r="";return o.forEach((t=>{(r+t).length<=e?r+=`${t} `:(n+=`${r}<br>`,r=`${t} `)})),n+=`${r}<br>`,n}function mt(t,e){"expand"===e?t.treeExpand():t.treeCollapse();const o=t.getTreeChildren();o.length>0&&o.forEach((t=>{t.getTreeChildren().length>0&&mt(t,e)}))}function pt(t,e){t.getRows().forEach((t=>{t.getTreeChildren().length>0&&mt(t,e)}))}function ht(t,e,o,n){const r=[];for(const a in t)if(t.hasOwnProperty(a)){const i=t[a],l={[e]:i[0],_children:[]};i.shift(),i.forEach(((t,r)=>{const a={[e]:o[r],[n]:t};l._children.push(a)})),r.push(l)}return r}function yt(t){let e=!0;return t.getGroups().forEach((t=>{t._group.visible&&(e=!1)})),e}function gt(t,e,o){const n=document.getElementById(o),r=n.cloneNode(!0);n.parentNode.replaceChild(r,n),r.addEventListener("click",(()=>{t.download("csv",`${e}.csv`,{delimiter:";"})}))}function bt(t,e,o){const n=document.getElementById(o),r=n.cloneNode(!0);n.parentNode.replaceChild(r,n),r.addEventListener("click",(()=>{t.download("pdf",`${e}.pdf`,{title:e,rowCalcStyles:{fontSize:8,fontStyle:"bold"},autoTable:{styles:{fontSize:8}}})}))}const St={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 vt(t){const e=[],o={0:"b",1:"a",2:"d",3:"m",4:"mm",5:"em",6:"",7:"nd"};function n(t,e,n){const r=document.createElement("td");if(r.setAttribute("id",t),null!=e){r.innerHTML=e;const t=function(t,e){let n;return void 0===e?n=6:"ND"===e?n=7:(n=5,t.forEach(((t,o)=>{e<=t&&5===n&&(n=o)}))),o[n]}(n,e);r.classList.add(t)}return r}return t.forEach((t=>{const o=t;"noData"===o.operationalstatus&&(o.so2value="ND",o.no2value="ND",o.o3value="ND",o.pm10value="ND",o.pm25value="ND"),"A09_CABANYAL_60m"===o.entityid&&(o.pm10value=void 0,o.pm25value=void 0);const r=document.createElement("tr"),a=document.createElement("td");a.innerHTML=o.address,r.appendChild(a),r.appendChild(n(`${o.entityid}_so2`,o.so2value,St.SO2)),r.appendChild(n(`${o.entityid}_no2`,o.no2value,St.NO2)),r.appendChild(n(`${o.entityid}_o3`,o.o3value,St.O3)),r.appendChild(n(`${o.entityid}_pm10`,o.pm10value,St.PM10)),r.appendChild(n(`${o.entityid}_pm25`,o.pm25value,St.PM25)),e.push(r)})),e}function Mt(t){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${t}`}function xt(){const t=window.location.href;let e="";return e=t.includes("localhost")?"local":t.includes("sc_valencia_pre")?"PRE":"PRO",e}function At(t,e){document.querySelectorAll(`[${t}]`).forEach((o=>{!function(t,e,o){const n=e;if(t){const e=new XMLHttpRequest;e.onreadystatechange=function(){4===this.readyState&&(200===this.status&&(n.innerHTML=this.responseText,o&&o()),404===this.status&&(n.innerHTML="No se ha podido cargar correctamente."))},e.open("GET",t,!0),e.send()}}(o.getAttribute(t),o,e)}))}function Dt(t){At("include-html-cabecera",(function(){!function(){const t=xt();"PRO"!==t&&(document.title+=` (${t})`)}(),function(){const t=xt();"PRO"!==t&&(document.querySelector("nav").querySelectorAll("span")[1].textContent+=` (${t})`)}()})),At("include-html-menu"),At("include-html-main-container",(function(){document.body.dispatchEvent(new Event("MainContentLoadedCustom")),function(){const t=document.querySelector("body");t.classList.remove("inicio"),t.classList.add(document.documentURI.split("%3A")[4].match(/(.*?).wcdf/)[1])}(),t&&t()})),At("include-html-copyright")}function Et(t,e,o,n,r,a){let i=!1,l=!1;const s=document.querySelector(t),c=document.querySelector(e),u=()=>{"undefined"!=typeof Liferay&&"ca-ES"===Liferay.ThemeDisplay.getBCP47LanguageId()?(s&&s.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")):(s&&s.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 d(t=!0){const e=document.querySelector(o);t?(s&&(s.src="about:blank"),c&&(c.src="about:blank"),e.classList.add("blur"),l=!0):(e.classList.remove("blur"),u(),l=!1)}const f=t=>{new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting&&(l||u(),i||(i=!0,window.setTimeout(d,a)))}))})).observe(t)};!function(){const{userAgent:t}=navigator;return/iPad|iPhone|iPod|Macintosh/.test(t)&&!window.MSStream}()?(s&&(s.setAttribute("sandbox","allow-scripts"),f(s)),c&&(c.setAttribute("sandbox","allow-scripts"),f(c)),document.querySelector(r).addEventListener("click",(()=>{d(!1),window.setTimeout(d,a)}))):document.querySelectorAll(n)[0].style.display="none"}const Ct={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:t=>`${t}%`}},{type:"value",position:"left",axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400},formatter:t=>`${b(t)}€`}}]},wt=(t,e)=>{e.sort(((t,e)=>parseInt(t.anyo)-parseInt(e.anyo)));const o={};e.forEach((e=>{const n=e[1],r=e[0];r!==t.seriesName||o[n]||(o[n]=0),r===t.seriesName&&(o[n]+=e[2])}));let n=`<p>${t.seriesName}</p>`;for(const[e,r]of Object.entries(o))n+=`<div>${t.marker} ${e}: <span style="float: right; margin-left:20px;font-weight: 600;">${g(r)}</span></div>`;return n};function Ft(t,e,o=void 0,n=void 0){const r=null===n?void 0:n,a=new Set(e.map((t=>t[1])));let i;const l={title:{text:"SIN TITULO",left:"center",top:"top",textStyle:{fontSize:20,fontFamily:"Montserrat",fontWeight:600,color:"#666"}},tooltip:{axisPointer:{type:"shadow"},trigger:"item",formatter:t=>wt(t,e),textStyle:{fontFamily:"Montserrat"},position(t,e,o,n,r){const a={},i=r.contentSize[1]/2,l=r.viewSize[1],s=t[1];return s<i?a.top=10:s+i>l?a.bottom=10:a.top=s-i,t[0]<r.viewSize[0]/2?a.left=t[0]+20:a.right=r.viewSize[0]-t[0]+20,a}},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:t=>g(t)},splitLine:{lineStyle:{color:"#DDD"}}},yAxis:{type:"category",data:Array.from(a),axisLabel:{textStyle:{fontFamily:"Montserrat"}}},series:(()=>{const t={name:"SIN NOMBRE",type:"bar",stack:"total",label:{show:!0,fontFamily:"Montserrat",fontSize:10,formatter:t=>g(Math.round(t.value))},itemStyle:void 0,emphasis:{focus:"series"},data:void 0};r&&r.itemStyle&&Array.isArray(r.itemStyle.borderColor)&&(i=[...r.itemStyle.borderColor],delete r.itemStyle.borderColor);const o=function(t){return t.reduce(((t,e)=>{const o=e[0];return t[o]||(t[o]=[]),t[o].push(e),t}),{})}(e),n=Object.keys(o);a.forEach((t=>{n.forEach((e=>{void 0===o[e].find((e=>e[1]===t))&&(o[e].push([o[e][0][0],t,void 0]),o[e].sort())}))}));const l=[];return Object.keys(o).forEach((e=>{i&&(t.itemStyle={borderColor:i.shift()}),t.name=e,t.data=o[e].map((t=>t[2]));let n={};n=void 0!==r?q(t,r):t,l.push({...n})})),l})(),toolbox:{show:!0,feature:{restore:{title:"Restablir"},saveAsImage:{title:"Desar"}},right:50}};let s={};s=void 0!==o?q(l,o):l,E(t,s)}function $t(t){let e={};return e=q(Ct,t),e}function Nt(t,e,o={},r={}){let a={};a=q(o,{color:["#81B1CC","#ABD9EA","#C2EEF9","#F9E2AF","#F9C780","#FDAE61","#F46D43","#FDAE61","#F9E2AF","#C2EEF9","#ABD9EA","#81B1CC"],yAxis:{data:function(){const t=new Set;return e.forEach((e=>{t.add(e[1])})),Array.from(t).sort(((t,e)=>t-e))}()}});const i={itemStyle:{borderWidth:2,borderColor:["#448DAD","#89CADB","#A0DEE8","#F4D28C","#F4B569","#F79646","#F25930","#F79646","#F4D28C","#A0DEE8","#89CADB","#448DAD"]}},l=null===r?i:q(r,i),s=e;s.forEach(((t,e)=>{s[e][0]=n(t[0])})),Ft(t,s,a,l)}function Lt(t,e=void 0){const o={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:t=>T(t,!1)},series:[{type:"bar",showBackground:!0}]};let n={};n=void 0!==e?q(o,e):o,E(t,n)}const Tt="es_ES",Ot={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"]])};function zt(t){return Math.max(...t.map((t=>Number(t[0]))))}function It(t){const e=t.filter((e=>Number(e[0])===zt(t))),o=Array.from({length:12},(()=>0));return e.forEach((([t,e,n])=>{const r=parseInt(e,10)-1;o[r]=n})),o}function kt(t){const e=t.filter((e=>Number(e[0])===zt(t)-1)),o=Array.from({length:12},(()=>0));return e.forEach((([t,e,n])=>{const r=parseInt(e,10)-1;o[r]=n})),o}function Pt(t,e,o=void 0){const n=zt(e).toString(),r=(zt(e)-1).toString();Lt(t,q({title:{left:"center",top:"-12%",textStyle:{fontSize:15,fontFamily:"Montserrat"}},legend:{top:"10%",show:!0,data:[r,n],textStyle:{fontFamily:"Montserrat"}},grid:{bottom:"8%",top:"20%",right:"2%"},xAxis:[{type:"category",data:p(Ot,Tt),interval:0,margin:10,axisLabel:{textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400}}}],yAxis:[{type:"value",axisLabel:{formatter:t=>t.toLocaleString("es-ES"),textStyle:{fontSize:10,fontFamily:"Montserrat",fontWeight:400}}}],series:[{name:r,type:"bar",data:kt(e)},{name:n,type:"bar",barGap:0,data:It(e)}]},o))}function Bt(t,e,o){const n=document.querySelector(e),r=document.querySelector(t);let a=!1;r.addEventListener("click",(()=>{!1===a&&(a=!0,n.setAttribute("src","about:blank"),n.setAttribute("src",o),n.onload=()=>{a=!1})})),r.disabled=!1}const _t="id",Wt="fecha",qt="value";function Jt(t,e,o,n,r="es_ES"){const[a,i]=function(t,e,o){const n=[],r=[];return t.forEach((t=>{e.includes(`${t[_t]}`)?n.push(`${t[Wt]}`):o.includes(`${t[_t]}`)&&r.push(`${t[Wt]}`)})),[n.map((t=>[t,0])),r.map((t=>[t,0]))]}(t,o,n);let l="es_ES"==r?"Datos sin validar":"Dades sense validar";0===i.length&&(l="");const s={name:"Datos validados",type:"line",data:[...a,i[0]],lineStyle:{color:"#00A9A0",width:4},showSymbol:!1,tooltip:{show:!1}};let c="",u="";if(0===i.length){const e=t[t.length-1].fecha;c=e,u=e}else c=i[0][0],u=i[i.length-1][0];return[...e,s,{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:l,xAxis:c,yAxis:0},{name:"end",xAxis:u,yAxis:Math.max(...t.filter((t=>null!==t[qt])).map((t=>parseInt(`${t[qt]}`,10))))}]]}}]}function jt(t,e,o=void 0){E(t,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:t=>F(t),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:e},o))}return e})(),t.exports=e()}},e={};function o(n){var r=e[n];if(void 0!==r)return r.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,o),a.exports}o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";o.r(n),o.d(n,{echartTemperatureMitjanaDiaria:()=>i});var t=o(2725);const e={title:{text:""},tooltip:{trigger:"axis",textStyle:{fontFamily:"Montserrat",fontSize:12},formatter:e=>(0,t.formatTooltip)(e,!1,!0," ºC")},legend:{data:[],textStyle:{fontFamily:"Montserrat",fontSize:12}},grid:{left:"0",right:"20",bottom:"60",top:"100",containLabel:!0},toolbox:{feature:{saveAsImage:{title:"Desar"}}},xAxis:[{type:"category",data:[],axisTick:{show:!1},boundaryGap:["20%","20%"],gridIndex:0,offset:0,axisLine:{lineStyle:{color:"#ccc"}},axisLabel:{show:!0,interval:"auto",textStyle:{fontFamily:"Montserrat",fontSize:10,color:"#333"}}}],yAxis:{type:"value",margin:"10",show:!0,axisLabel:{formatter:"{value} ºC",textStyle:{fontSize:11,fontFamily:"Montserrat",fontWeight:"500"}}},series:[],dataZoom:[{show:!0,start:0,end:25,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)"}}}],media:[{query:{minWidth:635},option:{legend:{top:"50"},dataZoom:{end:35}}},{query:{minWidth:890},option:{legend:{top:"5"},dataZoom:{end:50}}},{query:{minWidth:1100},option:{grid:{bottom:"0",top:"50"},dataZoom:{show:!1,end:100}}}]},r=["#FDBCB4","#999999","#FAD6A5"],a="#05668d";function i(o,n){const i="chartTemperatureMitjanaDiaria";!function(t,e,o){!function(t){return t.length>0}(t)?function(t,e){const o=t?document.querySelector(t):null,n=e?document.querySelector(e):null;o&&(o.hidden=!0),n&&(n.style.background="url('./build/images/nodata1.png') no-repeat top center",n.hidden=!1)}(`#${e}`,`#${o}`):function(t,e){const o=t?document.querySelector(t):null,n=e?document.querySelector(e):null;o&&(o.hidden=!0),n&&(n.style.background="#ffffff",n.hidden=!1)}(`#${o}`,`#${e}`)}(n.resultset,i,"no_dataTemperatureMitjanaDiaria");const l=(0,t.resultsetWithFields)(n),s=JSON.parse(JSON.stringify(e));s.tooltip.formatter=e.tooltip.formatter;const c=function(t){const e={},o={},n=[],a=function(){const t=[],e=new Date(2024,0,1),o=new Date(2024,11,31);for(let n=e;n<=o;n.setDate(n.getDate()+1)){const e=String(n.getDate()).padStart(2,"0"),o=String(n.getMonth()+1).padStart(2,"0");t.push(`${e}-${o}`)}return t}(),i=r.slice();return t.forEach((t=>{const{dias:r,name:a,value:l}=t;o[r]||(o[r]={}),o[r][a]=l,n.includes(a)||(n.push(a),e[a]={name:a,smooth:!0,symbol:"circle",symbolSize:1,type:"line",data:[],color:i.shift()})})),n.sort(),{seriesMap:e,groupedSerieData:o,legendData:n,xAxisCategories:a}}(l);let{seriesMap:u}=c;const{groupedSerieData:d,legendData:f,xAxisCategories:m}=c,p=f.find((t=>t.includes("pdte."))),h=(y=p)?y.substring(0,4):"";var y;s.legend.data=f,s.xAxis[0].data=m,function(t,e,o,n){t.forEach((t=>{e.forEach((e=>{n[e].data.push(o[t][e]||null)}))}))}(m,f,d,u),u=function(t,e,o){const n={dotted:{color:a,type:"dotted",width:3,zlevel:4},solid:{color:a,width:3,zlevel:4}},r={...t},i=(t,e)=>{t&&r[t]&&(r[t].lineStyle=e,r[t].itemStyle=e)};return i(e,n.dotted),i(o,n.solid),r}(u,p,h),s.series=Object.values(u),function(t,e){const o=document.getElementById(t);if(!o)return console.error(`No se pudo encontrar el elemento con ID ${t}.`),null;const n=echarts.init(o);n.setOption(e,!0),$(window).on("resize",(()=>{null!=n&&void 0!==n&&n.resize()}))}(i,s)}})(),n})()));
|