@mxtommy/kip 4.7.0-beta.6 → 4.7.0-beta.7
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/package.json +1 -1
- package/public/{chunk-UUFKTTLZ.js → chunk-5LDDCAOJ.js} +1 -1
- package/public/{chunk-LKDHPCO3.js → chunk-BAG3QIDK.js} +1 -1
- package/public/{chunk-25JIOYN7.js → chunk-M7IEGA73.js} +1 -1
- package/public/{chunk-SNSSHCTO.js → chunk-VWLWXBLE.js} +1 -1
- package/public/{chunk-YG7HBKOK.js → chunk-XX365EOU.js} +1 -1
- package/public/{chunk-HC7WATIL.js → chunk-ZWTP4TAR.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-4ZTODT4Z.js → main-AVSEBMPR.js} +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as os,A as ns,B as Qa,C as Bi,D as Sl,E as as,F as Fo,G as wl,H as Go,I as Bo,J as Xa,K as Ka,L as _l,M as Ml,N as Ja,O as Uo,P as kl,Q as Su,R as wu,S as _u,T as zn,U as Hn,V as eo,W as vt,X as qn,Y as $n,Z as to,_ as Mu,a as qt,aa as rs,b as oi,ba as ku,c as Di,ca as Tu,d as gu,da as jn,e as vu,ea as ln,f as bu,g as es,h as Au,i as yu,j as xu,k as Cu,l as mt,m as fa,n as Fi,o as Bn,p as ga,q as bn,r as rn,s as sn,t as Gi,u as Un,v as hi,w as ts,x as is,y as Za,z as va}from"./chunk-YG7HBKOK.js";import{a as fu,b as Jr,c as ri}from"./chunk-YY4ZUJFI.js";import{a as Eu,b as Du,c as Pu,d as Iu,e as Nu}from"./chunk-CSIELI2Z.js";import{a as ai,b as on,c as at,e as io,f as no}from"./chunk-4YDVZHMH.js";import{a as lu,b as du,c as cu,d as Ya,e as uu,f as Vt,g as mu,h as hu,k as pu,m as Wo,o as Ae,p as Cl,r as Wt}from"./chunk-M37BLWHF.js";import{b as Qc,e as Xc,f as jr}from"./chunk-WJFXI5PQ.js";import{a as Fn,b as Gn}from"./chunk-HSKVTFFQ.js";import{a as Jc,b as eu,c as tu,d as tn,e as ti,g as iu,h as Mi,i as ki,j as Ti,k as Nn,l as Ht,n as Ct,o as Vn,p as ru,q as Wn,s as su,u as St,v as ii,w as wt,x as ni}from"./chunk-MXUEYEZU.js";import{A as On,B as $a,C as nn,D as ou,E as xl,F as an,G as Xr,H as Kr,I as Ei,J as pt,K as ja,L as Rn,M as Pt,O as Ln,P as It,Q as xt,a as Si,b as yc,d as Ft,e as wi,f as $c,i as $r,j as jc,k as Yc,l as Zc,m as Lt,n as en,o as Yr,p as yt,r as Et,t as dt,u as Dt,v as nu,w as Zr,x as Qr,y as au,z as ct}from"./chunk-2GOHQZH5.js";import{$ as wr,$a as ma,$b as be,$c as Dn,Aa as Ze,Ab as xe,Ac as J,Bb as Ce,Bc as pc,Bd as Ha,Be as Fc,Ca as ei,Cb as O,Cc as fc,Ce as Gc,D as Jd,Da as Be,Db as l,Dc as ut,De as Bc,E as ec,Eb as u,Ec as x,Fa as _,Fb as V,Fc as he,Ga as W,Gb as D,Gd as qa,Ge as Uc,H as ca,Ha as Zi,Hb as N,Hc as Fr,He as zc,I as xr,Ib as Q,J as gi,Jb as Xi,Jc as Ci,Jd as kc,Je as Hc,K as vi,Ka as Ke,Kb as Ki,Lb as Rr,Lc as bt,Mb as Te,Md as Tc,Nb as Li,Nd as pa,Ne as qc,O as tc,Ob as z,Od as Pn,Oe as $e,P as Tn,Pa as Dr,Pb as Ro,Pd as Ec,Pe as _i,Q as Jt,Qa as Pr,Qb as T,Qe as Kc,Ra as ua,Rb as Lr,Rd as yl,Re as Qe,S as ic,Sb as Vr,Sd as zr,Se as et,T as nc,Tb as Wr,Td as Dc,U as Cr,Ub as En,V as Sr,Va as g,Vb as yi,Vc as gc,Vd as Wi,Wb as xi,Wc as vc,Xa as cc,Xc as bc,Xd as Ji,Ya as uc,Yb as _e,Z as ac,Zb as Me,_ as oc,_a as Ir,_b as Nt,_c as Gr,a as oe,aa as _r,ac as st,ae as Pc,b as pe,ba as Ga,bc as Ba,bd as Ua,be as Ic,ca as Mr,cb as Nr,cc as it,ce as Tt,d as Gg,da as kr,dc as c,dd as Ac,de as Hr,e as jd,ea as Tr,ec as X,ee as In,f as Le,fa as rc,fb as q,fc as fe,fe as Nc,g as Fa,ga as sc,gb as Qi,gc as zt,ge as At,hb as Rt,ib as Or,ie as qr,j as vl,ja as Er,jb as mc,jc as mn,jd as xc,je as nt,k as Ut,ka as rt,kb as Oo,kc as hn,kd as Cc,la as Yi,lb as bi,lc as pn,ld as Sc,le as Oc,m as ji,mb as hc,mc as ha,n as Yd,na as un,nc as fn,oc as gn,pa as y,pc as Vi,pd as wc,pe as Rc,q as Zd,qc as Al,qe as Lc,r as Qd,rc as Lo,rd as Br,s as bl,sa as lc,sc as Vo,sd as _c,t as Xd,td as Mc,ua as ne,ub as K,uc as lt,va as ae,vc as kt,vd as za,w as yr,wa as te,wb as R,wc as vn,x as kn,xa as Ge,xb as L,xe as Vc,y as Kd,ya as No,yb as Ne,yd as Ur,z as Zt,za as dc,zb as Ai,zc as B,ze as Wc}from"./chunk-PZ6I6W3H.js";var gd=Gg((BL,Js)=>{(function(n){"use strict";function o(p){if(Array.isArray(p)){for(var h=0,v=Array(p.length);h<p.length;h++)v[h]=p[h];return v}return Array.from(p)}function e(p,h){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!h||typeof h!="object"&&typeof h!="function"?p:h}function t(p,h){if(typeof h!="function"&&h!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof h);p.prototype=Object.create(h&&h.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),h&&(Object.setPrototypeOf?Object.setPrototypeOf(p,h):p.__proto__=h)}function i(p,h){if(!(p instanceof h))throw new TypeError("Cannot call a class as a function")}function a(p,h){if(h||(h=typeof window>"u"?global:window),h[p]!==void 0)return h[p];if(Ar===null){var v=window.getComputedStyle(document.documentElement,"");Ar=(Array.prototype.slice.call(v).join("").match(/-(moz|webkit|ms)-/)||v.OLink===""&&["","o"]||["",""])[1]}if(Ar==="")return null;var S=p.charAt(0).toUpperCase()+p.substr(1),k=h[Ar+S];return k!==void 0?k:null}function r(p,h,v,S,k,P,U){if(typeof S!="function")throw new TypeError("Invalid animation rule:",S);var $=p-v,H=$/k,Y=0;H>1&&(H=1),H!==1&&(Y=S(H),isFinite(Y)&&!isNaN(Y)&&(H=Y)),h&&h(H),$<k?U.frame=Ud(function(ce){return r(ce,h,v,S,k,P,U)}):(P&&P(),U.inProgress=!1)}function s(){Array.prototype.constructor.apply(this,arguments)}function d(p){if(!(p instanceof DOMException&&p.result===2152923147))throw p}function m(p,h){return h.replace(Vg,function(v,S){var k=p[S];return k!==void 0?k:v})}function f(p){return p.majorTicks instanceof Array||(p.majorTicks=p.majorTicks?[p.majorTicks]:[]),p.majorTicks.length||(p.majorTicks.push(we.formatMajorTickNumber(p.minValue,p)),p.majorTicks.push(we.formatMajorTickNumber(p.maxValue,p))),[p.tickSide!=="right",p.tickSide!=="left"]}function b(p,h,v,S,k,P){p.beginPath(),p.moveTo(h+P,v),p.lineTo(h+S-P,v),p.quadraticCurveTo(h+S,v,h+S,v+P),p.lineTo(h+S,v+k-P),p.quadraticCurveTo(h+S,v+k,h+S-P,v+k),p.lineTo(h+P,v+k),p.quadraticCurveTo(h,v+k,h,v+k-P),p.lineTo(h,v+P),p.quadraticCurveTo(h,v,h+P,v),p.closePath()}function A(p,h){var v=h.valueDec,S=h.valueInt,k=0,P=void 0,U=void 0,$=void 0;if(p=parseFloat(p),$=p<0,p=Math.abs(p),v>0){for(U=p.toFixed(v).toString().split("."),P=S-U[0].length;k<P;++k)U[0]="0"+U[0];U=($?"-":"")+U[0]+"."+U[1]}else{for(U=Math.round(p).toString(),P=S-U.length;k<P;++k)U="0"+U;U=($?"-":"")+U}return U}function C(p,h){var v=void 0,S=!1;return v=h.majorTicksDec===0?Math.round(p).toString():p.toFixed(h.majorTicksDec),h.majorTicksInt>1?(S=~v.indexOf("."),~v.indexOf("-")?"-"+[h.majorTicksInt+h.majorTicksDec+2+(S?1:0)-v.length].join("0")+v.replace("-",""):[h.majorTicksInt+h.majorTicksDec+1+(S?1:0)-v.length].join("0")+v):v}function w(p){return p*Math.PI/180}function M(p,h){return{x:-p*Math.sin(h),y:p*Math.cos(h)}}function G(p,h,v,S){var k=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],P=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,U=p.createLinearGradient(k?0:P,k?P:0,k?0:S,k?S:0);return U.addColorStop(0,h),U.addColorStop(1,v),U}function E(p,h){h.needleShadow&&(p.shadowOffsetX=2,p.shadowOffsetY=2,p.shadowBlur=10,p.shadowColor=h.colorNeedleShadowDown)}function F(p,h,v){return p["font"+h+"Style"]+" "+p["font"+h+"Weight"]+" "+p["font"+h+"Size"]*v+"px "+p["font"+h]}function I(p){p.shadowOffsetX=null,p.shadowOffsetY=null,p.shadowBlur=null,p.shadowColor="",p.strokeStyle=null,p.lineWidth=0,p.save()}function Z(p,h,v,S){h.valueTextShadow&&(p.shadowOffsetX=v,p.shadowOffsetY=v,p.shadowBlur=S,p.shadowColor=h.colorValueTextShadow)}function j(p,h,v,S,k,P){if(h.valueBox){I(p);var U=h.valueDec?1+h.valueDec:0,$="9".repeat(Math.max.apply(null,[String(parseInt(v)).length+U].concat(h.majorTicks.map(function(qe){return String(parseInt(qe,10)).length+U})))),H=h.valueText||A(v,h),Y=P/200,ce=P/100,me=.4*ce,Ee=1.2*ce;p.font=F(h,"Value",Y),Z(p,h,me,Ee);var De=p.measureText(h.valueText?H:"-"+A(Number($),h)).width;I(p);var Oe=parseFloat(h.fontValueSize)*Y+me+Ee,Xe=ce*parseFloat(h.valueBoxStroke),Ie=2*P-2*Xe,je=De+10*ce,Ye=1.1*Oe+me+Ee,Je=ce*h.valueBoxBorderRadius,ze=(parseFloat(h.valueBoxWidth)||0)/100*Ie;ze>je&&(je=ze),je>Ie&&(je=Ie);var He=S-je/2,Fe=k-Ye/2,Pe=k-5.75*ce;if(p.beginPath(),Je?b(p,He,Fe,je,Ye,Je):p.rect(He,Fe,je,Ye),Xe){var Re=p.createRadialGradient(S,Pe,10*ce,S,Pe,20*ce);Re.addColorStop(0,h.colorValueBoxRect),Re.addColorStop(1,h.colorValueBoxRectEnd),p.strokeStyle=Re,p.lineWidth=Xe,p.stroke()}h.colorValueBoxShadow&&(p.shadowBlur=1.2*ce,p.shadowColor=h.colorValueBoxShadow),h.colorValueBoxBackground&&(p.fillStyle=h.colorValueBoxBackground,p.fill()),p.closePath(),p.restore(),Z(p,h,me,Ee),p.fillStyle=h.colorValueText,p.textAlign="center",p.textBaseline="alphabetic",p.fillText(H,He+je/2,k+Ye/2-Oe/3),p.restore()}}function ye(p){var h=p.value,v=p.minValue,S=p.maxValue,k=.01*(S-v);return{normal:h<v?v:h>S?S:h,indented:h<v?v-k:h>S?S+k:h}}function ue(p,h,v,S,k){v.beginPath(),v.arc(0,0,Ri(p),0,2*Po,!0),v.lineWidth=h,v.strokeStyle=k?we.linearGradient(v,S,k,p):S,v.stroke(),v.closePath()}function ie(p,h){var v=Oi.pixelRatio;return p.maxRadius||(p.maxRadius=p.max-h.borderShadowWidth-h.borderOuterWidth*v-h.borderMiddleWidth*v-h.borderInnerWidth*v+(h.borderOuterWidth?.5:0)+(h.borderMiddleWidth?.5:0)+(h.borderInnerWidth?.5:0)),p.maxRadius}function re(p,h){function v(me,Ee,De,Oe,Xe,Ie){return Ee&&(!Ie&&h.borderShadowWidth&&(De.save(),De.shadowBlur=h.borderShadowWidth,De.shadowColor=h.colorBorderShadow),ue(me,Ee*S,De,Oe,Xe),!Ie&&h.borderShadowWidth&&(Ie=!0,De.restore())),Ie}var S=Oi.pixelRatio,k=h.borderShadowWidth*S,P=p.max-k-h.borderOuterWidth*S/2,U=P-h.borderOuterWidth*S/2-h.borderMiddleWidth*S/2+.5,$=U-h.borderMiddleWidth*S/2-h.borderInnerWidth*S/2+.5,H=ie(p,h),Y=void 0,ce=!1;p.save(),ce=v(P,h.borderOuterWidth,p,h.colorBorderOuter,h.colorBorderOuterEnd,ce),ce=v(U,h.borderMiddleWidth,p,h.colorBorderMiddle,h.colorBorderMiddleEnd,ce),ce=v($,h.borderInnerWidth,p,h.colorBorderInner,h.colorBorderInnerEnd,ce),!ce&&h.borderShadowWidth&&(p.shadowBlur=h.borderShadowWidth,p.shadowColor=h.colorBorderShadow),p.beginPath(),p.arc(0,0,Ri(H),0,2*Po,!0),h.colorPlateEnd?(Y=p.createRadialGradient(0,0,H/2,0,0,H),Y.addColorStop(0,h.colorPlate),Y.addColorStop(1,h.colorPlateEnd)):Y=h.colorPlate,p.fillStyle=Y,p.fill(),p.closePath(),p.restore()}function de(p,h){if(h.highlights!=="false"&&h.highlights.length&&h.highlightsWidth!==0){var v=p.max*(parseFloat(h.highlightsWidth)||0)/100,S=Ri(ve(p,h)-v/2),k=h.highlights.length,P=(h.maxValue-h.minValue)/h.ticksAngle;p.save();for(var U=0;U<k;U++){var $=h.highlights[U];p.lineWidth=v,p.lineCap=h.highlightsLineCap,p.strokeStyle=$.color,p.beginPath(),p.rotate(gl),p.arc(0,0,S,we.radians(h.startAngle+($.from-h.minValue)/P),we.radians(h.startAngle+($.to-h.minValue)/P),!1),p.stroke(),p.closePath(),p.restore(),p.save()}p.restore()}}function ee(p,h){var v=ve(p,h),S=void 0,k=void 0,P=void 0,U=0,$=Math.abs(h.minorTicks)||0,H=h.ticksAngle/(h.maxValue-h.minValue);h.exactTicks?(k=h.maxValue-h.minValue,S=$?k/$:0,U=($i.mod(h.majorTicks[0],$)||0)*H):S=$*(h.majorTicks.length-1),p.lineWidth=Oi.pixelRatio,p.strokeStyle=h.colorMinorTicks||h.colorStrokeTicks,p.save();for(var Y=0;Y<S;++Y)(P=h.startAngle+U+Y*(h.ticksAngle/S))<=h.ticksAngle+h.startAngle&&(p.rotate(we.radians(P)),p.beginPath(),p.moveTo(0,v),p.lineTo(0,v-.075*p.max),Ue(p));p.restore()}function ve(p,h){var v=p.max/100;return ie(p,h)-5*v-(h.barWidth?2*(parseFloat(h.barStrokeWidth)||0)+((parseFloat(h.barWidth)||0)+5)*v:0)}function le(p,h){we.prepareTicks(h);var v=Ri(ve(p,h)),S=void 0,k=h.majorTicks.length,P=Oi.pixelRatio;p.lineWidth=2*P,S=h.colorMajorTicks instanceof Array?h.colorMajorTicks:new Array(k).fill(h.colorStrokeTicks||h.colorMajorTicks);for(var U=0;U<k;++U)p.save(),p.strokeStyle=S[U],p.rotate(we.radians(ge(h,h.exactTicks?h.majorTicks[U]:U,k))),p.beginPath(),p.moveTo(0,v),p.lineTo(0,v-.15*p.max),p.stroke(),p.closePath(),p.restore();h.strokeTicks&&(p.save(),p.strokeStyle=h.colorStrokeTicks||S[0],p.rotate(gl),p.beginPath(),p.arc(0,0,v,we.radians(h.startAngle),we.radians(h.startAngle+h.ticksAngle),!1),p.stroke(),p.closePath(),p.restore())}function ge(p,h,v){if(p.exactTicks){var S=p.ticksAngle/(p.maxValue-p.minValue);return p.startAngle+S*(h-p.minValue)}return p.startAngle+h*(p.ticksAngle/(v-1))}function Ue(p){p.stroke(),p.restore(),p.closePath(),p.save()}function ot(p,h){var v=ve(p,h)-.15*p.max,S={},k=0,P=h.majorTicks.length,U=h.animationTarget!=="needle",$=h.colorNumbers instanceof Array?h.colorNumbers:new Array(P).fill(h.colorNumbers),H=U?-(h.value-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle:0;for(U&&(p.save(),p.rotate(-we.radians(H))),p.font=we.font(h,"Numbers",p.max/200),p.lineWidth=0,p.textAlign="center",p.textBaseline="middle";k<P;++k){var Y=H+ge(h,h.exactTicks?h.majorTicks[k]:k,P),ce=p.measureText(h.majorTicks[k]).width,me=h.fontNumbersSize,Ee=Math.sqrt(ce*ce+me*me)/2,De=we.radialPoint(v-Ee-h.numbersMargin/100*p.max,we.radians(Y));Y===360&&(Y=0),S[Y]||(S[Y]=!0,p.fillStyle=$[k],p.fillText(h.majorTicks[k],De.x,De.y))}U&&p.restore()}function Mt(p,h){h.title&&(p.save(),p.font=we.font(h,"Title",p.max/200),p.fillStyle=h.colorTitle,p.textAlign="center",p.fillText(h.title,0,-p.max/4.25,.8*p.max),p.restore())}function Yt(p,h){h.units&&(p.save(),p.font=we.font(h,"Units",p.max/200),p.fillStyle=h.colorUnits,p.textAlign="center",p.fillText(we.formatContext(h,h.units),0,p.max/3.25,.8*p.max),p.restore())}function mi(p,h){if(h.needle){var v=h.animationTarget!=="needle",S=h.ticksAngle<360?we.normalizedValue(h).indented:h.value,k=v?h.startAngle:h.startAngle+(S-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle;h.barStartPosition==="right"&&(k=h.startAngle+h.ticksAngle-(S-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle);var P=ie(p,h),U=Ri(P/100*h.needleCircleSize),$=Ri(P/100*h.needleCircleSize*.75),H=Ri(P/100*h.needleEnd),Y=Ri(h.needleStart?P/100*h.needleStart:0),ce=P/100*h.needleWidth,me=P/100*h.needleWidth/2,Ee=Oi.pixelRatio;p.save(),we.drawNeedleShadow(p,h),p.rotate(we.radians(k)),p.fillStyle=we.linearGradient(p,h.colorNeedle,h.colorNeedleEnd,H-Y),h.needleType==="arrow"?(p.beginPath(),p.moveTo(-me,-Y),p.lineTo(-ce,0),p.lineTo(-1*Ee,H),p.lineTo(Ee,H),p.lineTo(ce,0),p.lineTo(me,-Y),p.closePath(),p.fill(),p.beginPath(),p.lineTo(-.5*Ee,H),p.lineTo(-1*Ee,H),p.lineTo(-ce,0),p.lineTo(-me,-Y),p.lineTo(me/2*Ee-2*Ee,-Y),p.closePath(),p.fillStyle=h.colorNeedleShadowUp,p.fill()):(p.beginPath(),p.moveTo(-me,H),p.lineTo(-me,Y),p.lineTo(me,Y),p.lineTo(me,H),p.closePath(),p.fill()),p.restore(),h.needleCircleSize&&(p.save(),we.drawNeedleShadow(p,h),h.needleCircleOuter&&(p.beginPath(),p.arc(0,0,U,0,2*Po,!0),p.fillStyle=we.linearGradient(p,h.colorNeedleCircleOuter,h.colorNeedleCircleOuterEnd,U),p.fill(),p.closePath()),h.needleCircleInner&&(p.beginPath(),p.arc(0,0,$,0,2*Po,!0),p.fillStyle=we.linearGradient(p,h.colorNeedleCircleInner,h.colorNeedleCircleInnerEnd,$),p.fill(),p.closePath()),p.restore())}}function ra(p,h,v){we.drawValueBox(p,h,v,0,p.max-.33*p.max,p.max)}function Ra(p){var h=p.startAngle,v=p.startAngle+p.ticksAngle,S=h,k=h+(we.normalizedValue(p).normal-p.minValue)/(p.maxValue-p.minValue)*p.ticksAngle;if(p.barStartPosition==="middle"){var P=.5*(p.minValue+p.maxValue);p.value<P?(S=180-(P-we.normalizedValue(p).normal)/(p.maxValue-p.minValue)*p.ticksAngle,k=180):(S=180,k=180+(we.normalizedValue(p).normal-P)/(p.maxValue-p.minValue)*p.ticksAngle)}else p.barStartPosition==="right"&&(S=v-k+h,k=v);return{startAngle:S,endAngle:k}}function sa(p,h){var v=p.max/100,S=ie(p,h)-5*v,k=parseFloat(h.barStrokeWidth+"")||0,P=(parseFloat(h.barWidth+"")||0)*v,U=S-2*k-P,$=(S-U)/2,H=U+$,Y=k/H,ce=h.startAngle,me=h.startAngle+h.ticksAngle;if(p.save(),p.rotate(gl),k&&(p.beginPath(),p.arc(0,0,H,we.radians(ce)-Y,we.radians(me)+Y,!1),p.strokeStyle=h.colorBarStroke,p.lineWidth=2*$,p.stroke(),p.closePath()),P&&(p.beginPath(),p.arc(0,0,H,we.radians(ce),we.radians(me),!1),p.strokeStyle=h.colorBar,p.lineWidth=P,p.stroke(),p.closePath(),h.barShadow&&(p.save(),p.beginPath(),p.arc(0,0,S,we.radians(ce),we.radians(me),!1),p.clip(),p.beginPath(),p.strokeStyle=h.colorBar,p.lineWidth=1,p.shadowBlur=h.barShadow,p.shadowColor=h.colorBarShadow,p.shadowOffsetX=0,p.shadowOffsetY=0,p.arc(0,0,S,we.radians(h.startAngle),we.radians(h.startAngle+h.ticksAngle),!1),p.stroke(),p.closePath(),p.restore()),h.barProgress)){var Ee=Ra(h),De=Ee.startAngle,Oe=Ee.endAngle;p.beginPath(),p.arc(0,0,H,we.radians(De),we.radians(Oe),!1),p.strokeStyle=h.colorBarProgress,p.lineWidth=P,p.stroke(),p.closePath()}p.restore()}function La(p){return p.options.animatedValue?p.options.value:p.value}function wo(p,h,v,S,k,P,U,$){p.beginPath(),p.fillStyle=$?we.linearGradient(p,U,$,k>P?k:P,P>k,k>P?v:S):U,h>0?we.roundRect(p,v,S,k,P,h):p.rect(v,S,k,P),p.fill(),p.closePath()}function Ni(p,h,v,S,k,P,U,$,H){p.beginPath(),p.lineWidth=h,p.strokeStyle=H?we.linearGradient(p,$,H,U,!0,k):$,v>0?we.roundRect(p,S,k,P,U,v):p.rect(S,k,P,U),p.stroke(),p.closePath()}function _o(p,h,v,S,k,P){function U(qe,tt,ht,Kt){return qe&&(!Kt&&h.borderShadowWidth&&(p.save(),p.shadowBlur=h.borderShadowWidth,p.shadowColor=h.colorBorderShadow),Ni(p,qe*$,H,v+qe*$/2-Pe,S+qe*$/2-Pe,Y,De,tt,ht),Pe+=.5*$,!Kt&&h.borderShadowWidth&&(Kt=!0,p.restore())),Kt}var $=Oi.pixelRatio,H=h.borderRadius*$,Y=k-h.borderShadowWidth-h.borderOuterWidth*$,ce=Y-h.borderOuterWidth*$-h.borderMiddleWidth*$,me=ce-h.borderMiddleWidth*$-h.borderInnerWidth*$,Ee=me-h.borderInnerWidth*$,De=P-h.borderShadowWidth-h.borderOuterWidth*$,Oe=De-h.borderOuterWidth*$-h.borderMiddleWidth*$,Xe=Oe-h.borderMiddleWidth*$-h.borderInnerWidth*$,Ie=Xe-h.borderInnerWidth*$,je=v-(ce-Y)/2,Ye=je-(me-ce)/2,Je=Ye-(Ee-me)/2,ze=S-(Oe-De)/2,He=ze-(Xe-Oe)/2,Fe=He-(Ie-Xe)/2,Pe=0,Re=!1;return p.save(),Re=U(h.borderOuterWidth,h.colorBorderOuter,h.colorBorderOuterEnd,Re),Re=U(h.borderMiddleWidth,h.colorBorderMiddle,h.colorBorderMiddleEnd,Re),Re=U(h.borderInnerWidth,h.colorBorderInner,h.colorBorderInnerEnd,Re),!Re&&h.borderShadowWidth&&(p.shadowBlur=h.borderShadowWidth,p.shadowColor=h.colorBorderShadow),wo(p,H,Je,Fe,Ee+2*Pe,Ie+2*Pe,h.colorPlate,h.colorPlateEnd),p.restore(),[Je,Fe,Ee,Ie]}function Mo(p,h,v,S,k,P){var U=Oi.pixelRatio,$=P>=k,H=$?.85*k:P,Y=$?P:k;v=$?We(v+(k-H)/2):v;var ce=!!h.title,me=!!h.units,Ee=!!h.valueBox,De=void 0,Oe=void 0,Xe=void 0;$?(Oe=We(.05*Y),De=We(.075*Y),Xe=We(.11*Y),ce&&(Y-=De,S+=De),me&&(Y-=Oe),Ee&&(Y-=Xe)):(Oe=De=We(.15*H),ce&&(H-=De,S+=De),me&&(H-=Oe));var Ie=2*h.barStrokeWidth,je=h.barBeginCircle?We(H*h.barBeginCircle/200-Ie/2):0,Ye=We(H*h.barWidth/100-Ie),Je=We(Y*h.barLength/100-Ie),ze=We((Y-Je)/2),He=We(v+($?H/2:ze+je)),Fe=We(S+($?Y-ze-je+Ie/2:H/2)),Pe=!$||h.hasLeft&&h.hasRight?0:(h.hasRight?-1:1)*h.ticksWidth/100*H,Re=$||h.hasLeft&&h.hasRight?0:(h.hasRight?-1:1)*h.ticksWidth/100*H;return p.barDimensions={isVertical:$,width:H,length:Y,barWidth:Ye,barLength:Je,strokeWidth:Ie,barMargin:ze,radius:je,pixelRatio:U,barOffset:null,titleMargin:ce?De:0,unitsMargin:me?Oe:0,get ticksLength(){return this.barLength-this.barOffset-this.strokeWidth},X:v+Pe,Y:S+Re,x0:He+Pe,y0:Fe+Re,baseX:v,baseY:S,ticksPadding:h.ticksPadding/100},p.barDimensions}function Va(p,h,v,S,k,P,U){var $=Mo(p,h,S,k,P,U),H=$.isVertical,Y=$.width,ce=$.barWidth,me=$.barLength,Ee=$.strokeWidth,De=$.barMargin,Oe=$.radius,Xe=$.x0,Ie=$.y0,je=$.X,Ye=$.Y,Je=me;p.save(),p.beginPath();var ze=null;if(h.barBeginCircle){var He=we.radians(H?270:0),Fe=Math.asin(ce/2/Oe),Pe=Math.cos(Fe),Re=Math.sin(Fe),qe=Xe+(H?Oe*Re:Oe*Pe-Ee/2),tt=H?Ie-Oe*Pe:Ie+Oe*Re,ht=Ri(H?tt-Ie:qe-Xe);ze=We(ht+Oe);var Kt=H?We(Xe-Oe*Re):qe,fi=H?tt:We(Ie-Oe*Re);v==="progress"&&(me=ze+(me-ze)*(we.normalizedValue(h).normal-h.minValue)/(h.maxValue-h.minValue));var Io=We(qe+me-ze+Ee/2),da=We(tt-me+ze-Ee/2);p.arc(Xe,Ie,Oe,He+Fe,He-Fe),H?(p.moveTo(qe,fi),p.lineTo(qe,da),p.lineTo(Kt,da),p.lineTo(Kt,fi)):(p.moveTo(qe,fi),p.lineTo(Io,fi),p.lineTo(Io,tt),p.lineTo(qe,tt))}else{var qd=We(H?je+(Y-ce)/2:je+De),$d=We(H?Ye+me+De:Ye+(Y-ce)/2);v==="progress"&&(me*=(h.value-h.minValue)/(h.maxValue-h.minValue)),H?p.rect(qd,$d,ce,-me):p.rect(qd,$d,me,ce)}v!=="progress"&&h.barStrokeWidth&&(p.lineWidth=Ee,p.strokeStyle=h.colorBarStroke,p.stroke()),v!=="progress"&&h.colorBar?(p.fillStyle=h.colorBarEnd?we.linearGradient(p,h.colorBar,h.colorBarEnd,me,H,H?Ye:je):h.colorBar,p.fill()):v==="progress"&&h.colorBarProgress&&(p.fillStyle=h.colorBarProgressEnd?we.linearGradient(p,h.colorBarProgress,h.colorBarProgressEnd,Je,H,H?Ye:je):h.colorBarProgress,p.fill()),p.closePath(),p.restore(),h.barBeginCircle&&(p.barDimensions.radius+=Ee),p.barDimensions.barOffset=ze,p.barDimensions.barWidth+=Ee,p.barDimensions.barLength+=Ee}function ko(p,h,v,S,k,P){Va(p,h,"",v,S,k,P)}function To(p,h){return h.needleSide!==p||h.tickSide!==p||h.numberSide!==p}function gr(p,h,v,S,k,P){h.barProgress&&Va(p,h,"progress",v,S,k,P)}function _g(p,h){var v=p.barDimensions,S=v.isVertical,k=v.width,P=v.length,U=v.barWidth,$=v.barOffset,H=v.barMargin,Y=v.X,ce=v.Y,me=v.ticksLength,Ee=v.ticksPadding,De=k*(parseFloat(h.highlightsWidth)||0)/100;if(h.highlights&&De){var Oe=h.tickSide!=="right",Xe=h.tickSide!=="left",Ie=0,je=h.highlights.length,Ye=(k-U)/2,Je=h.maxValue-h.minValue,ze=We(S?Y+Ye:Y+H+$),He=De,Fe=S?ce+P-H-$:ce+Ye,Pe=We((h.ticksWidth/100+Ee)*k)+(De-h.ticksWidth/100*k),Re=We(U+Ee*k);for(p.save();Ie<je;Ie++){var qe=h.highlights[Ie],tt=me*Ri(h.minValue-qe.from)/Je,ht=me*Ri((qe.to-qe.from)/Je);p.beginPath(),p.fillStyle=qe.color,S?(Oe&&p.rect(ze-Pe,Fe-tt,He,-ht),Xe&&p.rect(ze+Re,Fe-tt,He,-ht)):(Oe&&p.rect(ze+tt,Fe-Pe,ht,He),Xe&&p.rect(ze+tt,Fe+Re,ht,He)),p.fill(),p.closePath()}p.restore()}}function vr(p,h,v,S,k){p.beginPath(),p.moveTo(h,v),p.lineTo(S,k),p.stroke(),p.closePath()}function Fd(p,h,v,S,k,P,U,$,H){var Y=p.barDimensions,ce=Y.isVertical,me=Y.length,Ee=Y.barWidth,De=Y.barOffset,Oe=Y.barMargin,Xe=Y.pixelRatio,Ie=Y.width,je=Y.X,Ye=Y.Y,Je=Y.ticksLength,ze=Y.ticksPadding,He=(Ie-Ee)/2,Fe=void 0,Pe=void 0,Re=0,qe=v.length,tt=void 0,ht=H*Ie,Kt=He-ze*Ie,fi=He+Ee+ht+ze*Ie,Io=h instanceof Array?h:new Array(v.length).fill(h);p.save(),p.lineWidth=$*Xe;for(var da=Je/(k-S);Re<qe;Re++)tt=v[Re],p.strokeStyle=Io[Re],ce?(Pe=Ye+me-Oe-De+(S-tt)*da,P&&(Fe=je+Kt,vr(p,Fe,Pe,We(Fe-ht),Pe)),U&&(Fe=je+fi,vr(p,Fe,Pe,We(Fe-ht),Pe))):(Fe=je+Oe+De-(S-tt)*da,P&&(Pe=Ye+Kt,vr(p,Fe,Pe,Fe,We(Pe-ht))),U&&(Pe=Ye+fi,vr(p,Fe,We(Pe),Fe,Pe-ht)));p.restore()}function Mg(p,h){var v=we.prepareTicks(h),S=Bd(v,2),k=S[0],P=S[1],U=2,$=(h.maxValue-h.minValue)/(h.majorTicks.length-1),H=h.colorMajorTicks instanceof Array?h.colorMajorTicks:new Array(h.majorTicks.length).fill(h.colorStrokeTicks||h.colorMajorTicks);if(Fd(p,H,h.exactTicks?h.majorTicks:h.majorTicks.map(function(ht,Kt){return h.minValue+$*Kt}),h.minValue,h.maxValue,k,P,U,h.ticksWidth/100),h.strokeTicks){var Y=p.barDimensions,ce=Y.isVertical,me=Y.length,Ee=Y.width,De=Y.barWidth,Oe=Y.barMargin,Xe=Y.barOffset,Ie=Y.X,je=Y.Y,Ye=Y.ticksLength,Je=Y.pixelRatio,ze=Y.ticksPadding,He=(Ee-De)/2+De+ze*Ee,Fe=(Ee-De)/2-ze*Ee,Pe=void 0,Re=void 0,qe=void 0,tt=void 0;p.strokeStyle=h.colorStrokeTicks||H[0],U*=Je,ce?(Re=je+me-Oe-Xe+U/2,tt=Re-Ye-U,k&&(qe=Pe=We(Ie+Fe),br(p,Pe,Re,qe,tt)),P&&(qe=Pe=We(Ie+He),br(p,Pe,Re,qe,tt))):(Pe=Ie+Oe+Xe-U/2,qe=Pe+Ye+U,k&&(tt=Re=We(je+Fe),br(p,Pe,Re,qe,tt)),P&&(tt=Re=We(je+He),br(p,Pe,Re,qe,tt)))}}function br(p,h,v,S,k){p.beginPath(),p.moveTo(h,v),p.lineTo(S,k),p.stroke(),p.closePath()}function kg(p,h){var v=we.prepareTicks(h),S=Bd(v,2),k=S[0],P=S[1],U=[],$=h.minValue,H=Math.abs(h.minorTicks)||0,Y=H?(h.maxValue-h.minValue)/(H*(h.majorTicks.length-1)):0;if(H)if(h.exactTicks)for(var ce=$i.mod(h.majorTicks[0],H)||0;$<h.maxValue;$+=H)ce+$<h.maxValue&&U.push(ce+$);else for(;$<h.maxValue;$+=Y)U.push($);Fd(p,h.colorMinorTicks||h.colorStrokeTicks,U,h.minValue,h.maxValue,k,P,1,h.ticksWidthMinor/100)}function Tg(p,h){var v=p.barDimensions,S=v.isVertical,k=v.length,P=v.width,U=v.barWidth,$=v.barMargin,H=v.barOffset,Y=v.X,ce=v.Y,me=v.ticksLength,Ee=v.ticksPadding,De=h.maxValue-h.minValue,Oe=De/(h.majorTicks.length-1),Xe=h.exactTicks?h.majorTicks:h.majorTicks.map(function(Io,da){return h.minValue+Oe*da}),Ie=Xe.length,je=h.numberSide!=="right",Ye=h.numberSide!=="left",Je=h.fontNumbersSize*P/200,ze=0,He=(h.ticksWidth/100+2*Ee)*P,Fe=(P-U)/2-He,Pe=(P-U)/2+U+He,Re=void 0,qe=void 0,tt=void 0,ht=void 0,Kt=h.colorNumbers instanceof Array?h.colorNumbers:new Array(Ie).fill(h.colorNumbers),fi=h.numbersMargin/100*P;for(p.font=we.font(h,"Numbers",P/200),p.lineWidth=0,p.textAlign="center";ze<Ie;ze++)p.fillStyle=Kt[ze],ht=h.majorTicks[ze],tt=h.exactTicks?me*((Xe[ze]-h.minValue)/De):ze*me/(Ie-1),S?(qe=ce+k-$-H-tt+Je/3,je&&(p.textAlign="right",p.fillText(ht,Y+Fe-fi,qe)),Ye&&(p.textAlign="left",p.fillText(ht,Y+Pe+fi,qe))):(p.measureText(ht).width,Re=Y+$+H+tt,je&&p.fillText(ht,Re,ce+Fe-fi),Ye&&p.fillText(ht,Re,ce+Pe+Je+fi))}function Eg(p,h){if(h.title){var v=p.barDimensions,S=v.isVertical,k=v.width,P=v.length,U=v.baseX,$=v.baseY,H=v.titleMargin,Y=h.fontTitleSize*k/200,ce=We(U+(S?k:P)/2),me=We($+H/2-(S?Y:Y/2)-.025*(S?P:k));p.save(),p.textAlign="center",p.fillStyle=h.colorTitle,p.font=we.font(h,"Title",k/200),p.lineWidth=0,p.fillText(h.title,ce,me,S?k:P),p.restore()}}function Dg(p,h){if(h.units){var v=p.barDimensions,S=v.isVertical,k=v.width,P=v.length,U=v.baseX,$=v.baseY,H=v.unitsMargin,Y=h.fontUnitsSize*k/200,ce=We(U+(S?k:P)/2),me=We($+(S?P:k)+H/2-Y/2);p.save(),p.textAlign="center",p.fillStyle=h.colorUnits,p.font=we.font(h,"Units",k/200),p.lineWidth=0,p.fillText(we.formatContext(h,h.units),ce,me,S?k:P),p.restore()}}function Pg(p,h){if(h.needle){var v=p.barDimensions,S=v.isVertical,k=v.width,P=v.length,U=v.barWidth,$=v.barOffset,H=v.barMargin,Y=v.ticksLength,ce=v.X,me=v.Y,Ee=v.ticksPadding,De=h.needleSide!=="right",Oe=h.needleSide!=="left",Xe=Y*(we.normalizedValue(h).indented-h.minValue)/(h.maxValue-h.minValue),Ie=(h.ticksWidth/100+Ee)*k,je=U/2+Ie,Ye=je*(h.needleEnd/100),Je=void 0,ze=void 0,He=void 0,Fe=void 0,Pe=h.needleType.toLowerCase()==="arrow"?Ng:Ig,Re=(k-U)/2,qe=je*(h.needleStart/100),tt=Re-Ie-qe,ht=Re+U+Ie+qe;p.save(),we.drawNeedleShadow(p,h),S?(He=We(me+P-H-$-Xe),De&&(Je=We(ce+tt),ze=Je+Ye,Pe(p,h,Je,He,ze,He,Ye)),Oe&&(Je=We(ce+ht),ze=Je-Ye,Pe(p,h,Je,He,ze,He,Ye,!0))):(Je=We(ce+H+$+Xe),De&&(He=We(me+tt),Fe=He+Ye,Pe(p,h,Je,He,Je,Fe,Ye)),Oe&&(He=We(me+ht),Fe=He-Ye,Pe(p,h,Je,He,Je,Fe,Ye,!0))),p.restore()}}function Gd(p,h,v,S){return h.colorNeedleEnd?we.linearGradient(p,S?h.colorNeedleEnd:h.colorNeedle,S?h.colorNeedle:h.colorNeedleEnd,v,!p.barDimensions.isVertical):h.colorNeedle}function Ig(p,h,v,S,k,P,U,$){p.lineWidth=h.needleWidth,p.strokeStyle=Gd(p,h,U,$),p.beginPath(),p.moveTo(v,S),p.lineTo(k,P),p.stroke(),p.closePath()}function Ng(p,h,v,S,k,P,U,$){var H=We(.4*U),Y=U-H,ce=v===k,me=h.needleWidth/2;p.fillStyle=Gd(p,h,U,$),p.beginPath(),ce?(S>P&&(Y*=-1),p.moveTo(v-me,S),p.lineTo(v+me,S),p.lineTo(v+me,S+Y),p.lineTo(v,P),p.lineTo(v-me,S+Y),p.lineTo(v-me,S)):(v>k&&(Y*=-1),p.moveTo(v,S-me),p.lineTo(v,S+me),p.lineTo(v+Y,S+me),p.lineTo(k,S),p.lineTo(v+Y,S-me),p.lineTo(v,S-me)),p.fill(),p.closePath()}function Og(p,h,v,S,k,P,U){var $=(parseFloat(h.fontValueSize)||0)*P/200,H=(.11*U-$)/2;p.barDimensions.isVertical&&we.drawValueBox(p,h,v,S+P/2,k+U-$-H,P)}var Bd=(function(){function p(h,v){var S=[],k=!0,P=!1,U=void 0;try{for(var $,H=h[Symbol.iterator]();!(k=($=H.next()).done)&&(S.push($.value),!v||S.length!==v);k=!0);}catch(Y){P=!0,U=Y}finally{try{!k&&H.return&&H.return()}finally{if(P)throw U}}return S}return function(h,v){if(Array.isArray(h))return h;if(Symbol.iterator in Object(h))return p(h,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),ml=function p(h,v,S){h===null&&(h=Function.prototype);var k=Object.getOwnPropertyDescriptor(h,v);if(k===void 0){var P=Object.getPrototypeOf(h);return P===null?void 0:p(P,v,S)}if("value"in k)return k.value;var U=k.get;if(U!==void 0)return U.call(S)},Rg=function p(h,v,S,k){var P=Object.getOwnPropertyDescriptor(h,v);if(P===void 0){var U=Object.getPrototypeOf(h);U!==null&&p(U,v,S,k)}else if("value"in P&&P.writable)P.value=S;else{var $=P.set;$!==void 0&&$.call(k,S)}return S},la=(function(){function p(h,v){for(var S=0;S<v.length;S++){var k=v[S];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(h,k.key,k)}}return function(h,v,S){return v&&p(h.prototype,v),S&&p(h,S),h}})(),Ar=null,Lg=(function(){function p(){i(this,p),this._events={},this.addListener=this.on,this.removeListener=this.off}return la(p,[{key:"emit",value:function(h){if(this._events[h]){for(var v=0,S=this._events[h].length,k=arguments.length,P=Array(k>1?k-1:0),U=1;U<k;U++)P[U-1]=arguments[U];for(;v<S;v++)this._events[h][v]&&this._events[h][v].apply(this,P)}}},{key:"once",value:function(h){for(var v=arguments.length,S=Array(v>1?v-1:0),k=1;k<v;k++)S[k-1]=arguments[k];for(var P=0,U=S.length,$=this;P<U;P++)(function(){var H=S[P],Y=function ce(){$.off(h,ce),H.apply($,arguments)};S[P]=Y})();this.on.apply(this,[h].concat(S))}},{key:"on",value:function(h){this._events[h]||(this._events[h]=[]);for(var v=0,S=arguments.length<=1?0:arguments.length-1;v<S;v++)this._events[h].push(arguments.length<=v+1?void 0:arguments[v+1])}},{key:"off",value:function(h){if(this._events[h])for(var v=0,S=arguments.length<=1?0:arguments.length-1;v<S;v++)for(var k=arguments.length<=v+1?void 0:arguments[v+1],P=void 0;~(P=this._events[h].indexOf(k));)this._events[h].splice(P,1)}},{key:"removeAllListeners",value:function(h){delete this._events[h]}},{key:"listeners",get:function(){return this._events}}]),p})(),Ud=a("requestAnimationFrame")||function(p){return setTimeout(function(){return p(new Date().getTime())},1e3/60)},Eo={linear:function(p){return p},quad:function(p){return Math.pow(p,2)},dequad:function(p){return 1-Eo.quad(1-p)},quint:function(p){return Math.pow(p,5)},dequint:function(p){return 1-Math.pow(1-p,5)},cycle:function(p){return 1-Math.sin(Math.acos(p))},decycle:function(p){return Math.sin(Math.acos(1-p))},bounce:function(p){return 1-Eo.debounce(1-p)},debounce:function(p){for(var h=0,v=1;;h+=v,v/=2)if(p>=(7-4*h)/11)return-Math.pow((11-6*h-11*p)/4,2)+Math.pow(v,2)},elastic:function(p){return 1-Eo.delastic(1-p)},delastic:function(p){return Math.pow(2,10*(p-1))*Math.cos(20*Math.PI*1.5/3*p)}},hl=(function(){function p(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"linear",v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:250,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},k=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){};if(i(this,p),this.duration=v,this.rule=h,this.draw=S,this.end=k,typeof this.draw!="function")throw new TypeError("Invalid animation draw callback:",S);if(typeof this.end!="function")throw new TypeError("Invalid animation end callback:",k)}return la(p,[{key:"animate",value:function(h,v){var S=this;this.frame&&this.cancel();var k=window.performance&&window.performance.now?window.performance.now():a("animationStartTime")||Date.now();h=h||this.draw,v=v||this.end,this.draw=h,this.end=v,this.frame=Ud(function(P){return r(P,h,k,Eo[S.rule]||S.rule,S.duration,v,S)})}},{key:"cancel",value:function(){this.frame&&((a("cancelAnimationFrame")||function(h){})(this.frame),this.frame=null)}},{key:"destroy",value:function(){this.cancel(),this.draw=null,this.end=null}}]),p})();hl.rules=Eo;var Wa=(function(){function p(h,v,S){i(this,p),this.options=h,this.element=v.toLowerCase(),this.type=p.toDashed(S),this.Type=n[S],this.mutationsObserved=!1,this.isObservable=!!window.MutationObserver,window.GAUGES_NO_AUTO_INIT||p.domReady(this.traverse.bind(this))}return la(p,[{key:"isValidNode",value:function(h){return!(!h.tagName||h.tagName.toLowerCase()!==this.element||h.getAttribute("data-type")!==this.type)}},{key:"traverse",value:function(){for(var h=document.getElementsByTagName(this.element),v=0,S=h.length;v<S;v++)this.process(h[v]);this.isObservable&&!this.mutationsObserved&&(new MutationObserver(this.observe.bind(this)).observe(document.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0,attributeOldValue:!0,characterDataOldValue:!0}),this.mutationsObserved=!0)}},{key:"observe",value:function(h){for(var v=0,S=h.length;v<S;v++){var k=h[v];if(k.type==="attributes"&&k.attributeName==="data-type"&&this.isValidNode(k.target)&&k.oldValue!==this.type)setTimeout(this.process.bind(this,k.target));else if(k.addedNodes&&k.addedNodes.length)for(var P=0,U=k.addedNodes.length;P<U;P++)setTimeout(this.process.bind(this,k.addedNodes[P]))}}},{key:"process",value:function(h){var v=this;if(!this.isValidNode(h))return null;var S=void 0,k=JSON.parse(JSON.stringify(this.options)),P=null;for(S in k)if(k.hasOwnProperty(S)){var U=p.toAttributeName(S),$=p.parse(h.getAttribute(U));$!=null&&(k[S]=$)}return k.renderTo=h,P=new this.Type(k),P.draw&&P.draw(),this.isObservable&&(P.observer=new MutationObserver(function(H){H.forEach(function(Y){if(Y.type==="attributes"){var ce=Y.attributeName.toLowerCase(),me=h.getAttribute(ce).toLowerCase();if(ce==="data-type"&&me&&me!==v.type)P.observer.disconnect(),delete P.observer,P.destroy&&P.destroy();else if(ce.substr(0,5)==="data-"){var Ee=ce.substr(5).split("-").map(function(Oe,Xe){return Xe?Oe.charAt(0).toUpperCase()+Oe.substr(1):Oe}).join(""),De={};De[Ee]=p.parse(h.getAttribute(Y.attributeName)),Ee==="value"?P&&(P.value=De[Ee]):P.update&&P.update(De)}}})}),P.observer.observe(h,{attributes:!0})),P}}],[{key:"parse",value:function(h){if(h==="true")return!0;if(h==="false")return!1;if(h!=="undefined"){if(h==="null")return null;if(/^[-+#.\w\d\s]+(?:,[-+#.\w\d\s]*)+$/.test(h))return h.split(",");try{return JSON.parse(h)}catch(v){}return h}}},{key:"toDashed",value:function(h){for(var v=h.split(/(?=[A-Z])/),S=1,k=v.length,P=v[0].toLowerCase();S<k;S++)P+="-"+v[S].toLowerCase();return P}},{key:"toCamelCase",value:function(h){for(var v=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=h.split(/-/),k=0,P=S.length,U="";k<P;k++)U+=k||v?S[k][0].toUpperCase()+S[k].substr(1).toLowerCase():S[k].toLowerCase();return U}},{key:"toAttributeName",value:function(h){return"data-"+p.toDashed(h)}},{key:"domReady",value:function(h){if(/comp|inter|loaded/.test((window.document||{}).readyState+""))return h();window.addEventListener?window.addEventListener("DOMContentLoaded",h,!1):window.attachEvent&&window.attachEvent("onload",h)}}]),p})(),Oi=(function(){function p(h,v,S){i(this,p),p.collection.push(this),this.width=v||0,this.height=S||0,this.element=h,this.init()}return la(p,[{key:"init",value:function(){var h=p.pixelRatio;this.element.width=this.width*h,this.element.height=this.height*h,this.element.style.width=this.width+"px",this.element.style.height=this.height+"px",this.elementClone=this.element.cloneNode(!0),this.context=this.element.getContext("2d"),this.contextClone=this.elementClone.getContext("2d"),this.drawWidth=this.element.width,this.drawHeight=this.element.height,this.drawX=this.drawWidth/2,this.drawY=this.drawHeight/2,this.minSide=this.drawX<this.drawY?this.drawX:this.drawY,this.contextClone.translate(this.drawX,this.drawY),this.elementClone.initialized=!1,this.context.translate(this.drawX,this.drawY),this.context.max=this.contextClone.max=this.minSide,this.context.maxRadius=this.contextClone.maxRadius=null}},{key:"destroy",value:function(){var h=p.collection.indexOf(this);~h&&p.collection.splice(h,1),this.context.clearRect(-this.drawX,-this.drawY,this.drawWidth,this.drawHeight),this.context.max=null,delete this.context.max,this.context.maxRadius=null,delete this.context.maxRadius,this.context=null,this.contextClone=null,this.elementClone=null,this.element=null,this.onRedraw=null}},{key:"commit",value:function(){var h=p.pixelRatio;return h!==1&&this.contextClone.scale(h,h),this}},{key:"redraw",value:function(){return this.init(),this.onRedraw&&this.onRedraw(),this}}],[{key:"redraw",value:function(){for(var h=0,v=p.collection.length;h<v;h++)p.collection[h].redraw()}},{key:"pixelRatio",get:function(){return window.devicePixelRatio||1}}]),p})();Oi.collection=[],window.matchMedia&&window.matchMedia("screen and (min-resolution: 2dppx)").addListener(Oi.redraw);var pl={renderTo:null,width:0,height:0,minValue:0,maxValue:100,value:0,units:!1,exactTicks:!1,majorTicks:[0,20,40,60,80,100],minorTicks:10,strokeTicks:!0,animatedValue:!1,animateOnInit:!1,title:!1,borders:!0,numbersMargin:1,listeners:null,valueInt:3,valueDec:2,majorTicksInt:1,majorTicksDec:0,animation:!0,animationDuration:500,animationRule:"cycle",colorPlate:"#fff",colorPlateEnd:"",colorMajorTicks:"#444",colorMinorTicks:"#666",colorStrokeTicks:"",colorTitle:"#888",colorUnits:"#888",colorNumbers:"#444",colorNeedle:"rgba(240,128,128,1)",colorNeedleEnd:"rgba(255,160,122,.9)",colorValueText:"#444",colorValueTextShadow:"rgba(0,0,0,0.3)",colorBorderShadow:"rgba(0,0,0,0.5)",colorBorderOuter:"#ddd",colorBorderOuterEnd:"#aaa",colorBorderMiddle:"#eee",colorBorderMiddleEnd:"#f0f0f0",colorBorderInner:"#fafafa",colorBorderInnerEnd:"#ccc",colorValueBoxRect:"#888",colorValueBoxRectEnd:"#666",colorValueBoxBackground:"#babab2",colorValueBoxShadow:"rgba(0,0,0,1)",colorNeedleShadowUp:"rgba(2,255,255,0.2)",colorNeedleShadowDown:"rgba(188,143,143,0.45)",colorBarStroke:"#222",colorBar:"#ccc",colorBarProgress:"#888",colorBarShadow:"#000",fontNumbers:"Arial",fontTitle:"Arial",fontUnits:"Arial",fontValue:"Arial",fontNumbersSize:20,fontTitleSize:24,fontUnitsSize:22,fontValueSize:26,fontNumbersStyle:"normal",fontTitleStyle:"normal",fontUnitsStyle:"normal",fontValueStyle:"normal",fontNumbersWeight:"normal",fontTitleWeight:"normal",fontUnitsWeight:"normal",fontValueWeight:"normal",needle:!0,needleShadow:!0,needleType:"arrow",needleStart:5,needleEnd:85,needleWidth:4,borderOuterWidth:3,borderMiddleWidth:3,borderInnerWidth:3,borderShadowWidth:3,valueBox:!0,valueBoxStroke:5,valueBoxWidth:0,valueText:"",valueTextShadow:!0,valueBoxBorderRadius:2.5,highlights:[{from:20,to:60,color:"#eee"},{from:60,to:80,color:"#ccc"},{from:80,to:100,color:"#999"}],highlightsWidth:15,highlightsLineCap:"butt",barWidth:20,barStrokeWidth:0,barProgress:!0,barShadow:0};s.prototype=Object.create(Array.prototype),s.prototype.constructor=s,s.prototype.get=function(p){if(typeof p=="string")for(var h=0,v=this.length;h<v;h++){var S=this[h].options.renderTo.tagName?this[h].options.renderTo:document.getElementById(this[h].options.renderTo||"");if(S.getAttribute("id")===p)return this[h]}else if(typeof p=="number")return this[p];return null};var fl="2.2.1",We=Math.round,Ri=Math.abs,Do=new s;Do.version=fl;var $i=(function(p){function h(v){i(this,h);var S=e(this,(h.__proto__||Object.getPrototypeOf(h)).call(this)),k=S.constructor.name;if(k==="BaseGauge")throw new TypeError("Attempt to instantiate abstract class!");if(Do.push(S),v.listeners&&Object.keys(v.listeners).forEach(function(U){(v.listeners[U]instanceof Array?v.listeners[U]:[v.listeners[U]]).forEach(function($){S.on(U,$)})}),S.version=fl,S.type=n[k]||h,S.initialized=!1,v.minValue=parseFloat(v.minValue),v.maxValue=parseFloat(v.maxValue),v.value=parseFloat(v.value)||0,v.borders||(v.borderInnerWidth=v.borderMiddleWidth=v.borderOuterWidth=0),!v.renderTo)throw TypeError("Canvas element was not specified when creating the Gauge object!");var P=v.renderTo.tagName?v.renderTo:document.getElementById(v.renderTo);if(!(P instanceof HTMLCanvasElement))throw TypeError("Given gauge canvas element is invalid!");return v.width=parseFloat(v.width)||0,v.height=parseFloat(v.height)||0,v.width&&v.height||(v.width||(v.width=P.parentNode?P.parentNode.offsetWidth:P.offsetWidth),v.height||(v.height=P.parentNode?P.parentNode.offsetHeight:P.offsetHeight)),S.options=v||{},S.options.animateOnInit&&(S._value=S.options.value,S.options.value=S.options.minValue),S.canvas=new Oi(P,v.width,v.height),S.canvas.onRedraw=S.draw.bind(S),S.animation=new hl(v.animationRule,v.animationDuration),S}return t(h,p),la(h,[{key:"update",value:function(v){return Object.assign(this.options,this.type.configure(v||{})),this.canvas.width=this.options.width,this.canvas.height=this.options.height,this.animation.rule=this.options.animationRule,this.animation.duration=this.options.animationDuration,this.canvas.redraw(),this}},{key:"destroy",value:function(){var v=Do.indexOf(this);~v&&Do.splice(v,1),this.canvas.destroy(),this.canvas=null,this.animation.destroy(),this.animation=null,this.emit("destroy")}},{key:"draw",value:function(){return this.options.animateOnInit&&!this.initialized&&(this.value=this._value,this.initialized=!0,this.emit("init")),this.emit("render"),this}},{key:"value",set:function(v){var S=this;v=h.ensureValue(v,this.options.minValue);var k=this.options.value;if(v!==k)if(this.options.animation){if(this.animation.frame&&(this.options.value=this._value,this._value===v))return this.animation.cancel(),void delete this._value;this._value===void 0&&(this._value=v),this.emit("animationStart"),this.animation.animate(function(P){var U=k+(v-k)*P;S.options.animatedValue&&S.emit("value",U,S.value),S.options.value=U,S.draw(),S.emit("animate",P,S.options.value)},function(){S._value!==void 0&&(S.emit("value",S._value,S.value),S.options.value=S._value,delete S._value),S.draw(),S.emit("animationEnd"),S.animation.frame=null})}else this.emit("value",v,this.value),this.options.value=v,this.draw()},get:function(){return this._value===void 0?this.options.value:this._value}}],[{key:"configure",value:function(v){return v}},{key:"initialize",value:function(v,S){return new Wa(S,"canvas",v)}},{key:"fromElement",value:function(v){var S=Wa.toCamelCase(v.getAttribute("data-type")),k=v.attributes,P=0,U=k.length,$={};if(S){for(/Gauge$/.test(S)||(S+="Gauge");P<U;P++)$[Wa.toCamelCase(k[P].name.replace(/^data-/,""),!1)]=Wa.parse(k[P].value);new Wa($,v.tagName,S).process(v)}}},{key:"ensureValue",value:function(v){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return v=parseFloat(v),!isNaN(v)&&isFinite(v)||(v=parseFloat(S)||0),v}},{key:"mod",value:function(v,S){return(v%S+S)%S}},{key:"version",get:function(){return fl}}]),h})(Lg);n!==void 0&&(n.BaseGauge=$i,n.gauges=(window.document||{}).gauges=Do);var Vg=/{([_a-zA-Z]+[_a-zA-Z0-9]*)}/g,we={roundRect:b,padValue:A,formatMajorTickNumber:C,radians:w,radialPoint:M,linearGradient:G,drawNeedleShadow:E,drawValueBox:j,verifyError:d,prepareTicks:f,font:F,normalizedValue:ye,formatContext:m},Po=Math.PI,gl=Po/2,zd=Object.assign({},pl,{ticksAngle:270,startAngle:45,colorNeedleCircleOuter:"#f0f0f0",colorNeedleCircleOuterEnd:"#ccc",colorNeedleCircleInner:"#e8e8e8",colorNeedleCircleInnerEnd:"#f5f5f5",needleCircleSize:10,needleCircleInner:!0,needleCircleOuter:!0,needleStart:20,animationTarget:"needle",useMinPath:!1,barWidth:0,barStartPosition:"left"}),Wg=(function(p){function h(v){return i(this,h),v=Object.assign({},zd,v||{}),e(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,h.configure(v)))}return t(h,p),la(h,[{key:"draw",value:function(){try{var v=this.canvas,S=[-v.drawX,-v.drawY,v.drawWidth,v.drawHeight],k=S[0],P=S[1],U=S[2],$=S[3],H=this.options;if(H.animationTarget==="needle"){if(!v.elementClone.initialized){var Y=v.contextClone;Y.clearRect(k,P,U,$),this.emit("beforePlate"),re(Y,H),this.emit("beforeHighlights"),de(Y,H),this.emit("beforeMinorTicks"),ee(Y,H),this.emit("beforeMajorTicks"),le(Y,H),this.emit("beforeNumbers"),ot(Y,H),this.emit("beforeTitle"),Mt(Y,H),this.emit("beforeUnits"),Yt(Y,H),v.elementClone.initialized=!0}this.canvas.commit(),v.context.clearRect(k,P,U,$),v.context.drawImage(v.elementClone,k,P,U,$),this.emit("beforeProgressBar"),sa(v.context,H),this.emit("beforeValueBox"),ra(v.context,H,La(this)),this.emit("beforeNeedle"),mi(v.context,H)}else{var ce=-we.radians((H.value-H.minValue)/(H.maxValue-H.minValue)*H.ticksAngle);if(v.context.clearRect(k,P,U,$),this.emit("beforePlate"),re(v.context,H),v.context.rotate(ce),this.emit("beforeHighlights"),de(v.context,H),this.emit("beforeMinorTicks"),ee(v.context,H),this.emit("beforeMajorTicks"),le(v.context,H),this.emit("beforeNumbers"),ot(v.context,H),this.emit("beforeProgressBar"),sa(v.context,H),v.context.rotate(-ce),!v.elementClone.initialized){var me=v.contextClone;me.clearRect(k,P,U,$),this.emit("beforeTitle"),Mt(me,H),this.emit("beforeUnits"),Yt(me,H),this.emit("beforeNeedle"),mi(me,H),v.elementClone.initialized=!0}v.context.drawImage(v.elementClone,k,P,U,$)}this.emit("beforeValueBox"),ra(v.context,H,La(this)),ml(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"draw",this).call(this)}catch(Ee){we.verifyError(Ee)}return this}},{key:"value",set:function(v){v=$i.ensureValue(v,this.options.minValue),this.options.animation&&this.options.ticksAngle===360&&this.options.useMinPath&&(this._value=v,v=this.options.value+((v-this.options.value)%360+540)%360-180),Rg(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"value",v,this)},get:function(){return ml(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"value",this)}}],[{key:"configure",value:function(v){return v.barWidth>50&&(v.barWidth=50),isNaN(v.startAngle)&&(v.startAngle=45),isNaN(v.ticksAngle)&&(v.ticksAngle=270),v.ticksAngle>360&&(v.ticksAngle=360),v.ticksAngle<0&&(v.ticksAngle=0),v.startAngle<0&&(v.startAngle=0),v.startAngle>360&&(v.startAngle=360),v}}]),h})($i);n!==void 0&&(n.RadialGauge=Wg),$i.initialize("RadialGauge",zd);var Hd=Object.assign({},pl,{borderRadius:0,barBeginCircle:30,colorBarEnd:"",colorBarProgressEnd:"",needleWidth:6,tickSide:"both",needleSide:"both",numberSide:"both",ticksWidth:10,ticksWidthMinor:5,ticksPadding:5,barLength:85,fontTitleSize:26,highlightsWidth:10}),Fg=(function(p){function h(v){return i(this,h),v=Object.assign({},Hd,v||{}),e(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,h.configure(v)))}return t(h,p),la(h,[{key:"draw",value:function(){try{var v=this.canvas,S=[-v.drawX,-v.drawY,v.drawWidth,v.drawHeight],k=S[0],P=S[1],U=S[2],$=S[3],H=this.options;if(!v.elementClone.initialized){var Y=v.contextClone;Y.clearRect(k,P,U,$),this.emit("beforePlate"),this.drawBox=_o(Y,H,k,P,U,$),this.emit("beforeBar"),ko.apply(void 0,[Y,H].concat(o(this.drawBox))),v.contextClone.barDimensions=Y.barDimensions,this.emit("beforeHighlights"),_g(Y,H),this.emit("beforeMinorTicks"),kg(Y,H),this.emit("beforeMajorTicks"),Mg(Y,H),this.emit("beforeNumbers"),Tg(Y,H),this.emit("beforeTitle"),Eg(Y,H),this.emit("beforeUnits"),Dg(Y,H),v.elementClone.initialized=!0}this.canvas.commit(),v.context.clearRect(k,P,U,$),v.context.drawImage(v.elementClone,k,P,U,$),this.emit("beforeProgressBar"),gr.apply(void 0,[v.context,H].concat(o(this.drawBox))),this.emit("beforeNeedle"),Pg(v.context,H),this.emit("beforeValueBox"),Og.apply(void 0,[v.context,H,H.animatedValue?this.options.value:this.value].concat(o(this.drawBox))),ml(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"draw",this).call(this)}catch(ce){we.verifyError(ce)}return this}}],[{key:"configure",value:function(v){return v.barStrokeWidth>=v.barWidth&&(v.barStrokeWidth=We(v.barWidth/2)),v.hasLeft=To("right",v),v.hasRight=To("left",v),v.value>v.maxValue&&(v.value=v.maxValue),v.value<v.minValue&&(v.value=v.minValue),$i.configure(v)}}]),h})($i);n!==void 0&&(n.LinearGauge=Fg),$i.initialize("LinearGauge",Hd),typeof Js<"u"&&Object.assign(n,{Collection:s,GenericOptions:pl,Animation:hl,BaseGauge:$i,drawings:we,SmartCanvas:Oi,DomObserver:Wa,vendorize:a})})(typeof Js<"u"?Js.exports:window)});var Ou=[{id:null,name:"Dashboard 1",icon:"dashboard-dashboard",configuration:[{w:24,h:24,id:"d1d58e6f-f8b4-4a72-9597-7f92aa6776fc",selector:"widget-host2",input:{widgetProperties:{type:"widget-tutorial",uuid:"d1d58e6f-f8b4-4a72-9597-7f92aa6776fc"}},x:0,y:0}],collapseSplitShell:!1}];var ft=(()=>{class n{_settings=y(Lt);_router=y(Xc);_destroyRef=y(Ze);dashboards=_([],{equal:wi});activeDashboard=_(null);_widgetAction=new ji(null);widgetAction$=this._widgetAction.asObservable();isDashboardStatic=_(!0);widgetClipboard=_(null);layoutEditSaved=_(0);layoutEditCanceled=_(0);constructor(){let e=this._settings.getDashboardConfig();if(!e||e.length===0){console.warn("[Dashboard Service] No dashboards found in settings, creating blank dashboard");let i=Ou.map(a=>pe(oe({},a),{id:Si.create()}));this.dashboards.set([...i])}else this.dashboards.set(e);this.applyDashboardParam(this.getRouteParam("id"),!1);let t=this._router.events.pipe(vi(i=>i instanceof Qc),wr({bufferSize:1,refCount:!0}),$e(this._destroyRef));t.pipe(Jt(1),Zt(()=>this.getRouteParam("id"))).subscribe(i=>this.applyDashboardParam(i,!0)),t.pipe(_r(1),Zt(()=>this.getRouteParam("id")),Cr()).subscribe(i=>this.applyDashboardParam(i,!1)),W(()=>{let i=this.dashboards();B(()=>{this._settings.saveDashboards(i)})})}getRouteParam(e){let t=this._router.routerState.snapshot.root;for(;t;){if(t.paramMap.has(e))return t.paramMap.get(e);t=t.firstChild??null}return null}applyDashboardParam(e,t){if(e===null||e===""){t&&this.setActiveDashboardIndex(0);return}let i=Number(e);if(Number.isNaN(i)){t&&this.setActiveDashboardIndex(0);return}this.setActiveDashboardIndex(i)}setActiveDashboardIndex(e){e!==this.activeDashboard()&&(e>=0&&e<this.dashboards().length?this.activeDashboard.set(e):console.error(`[Dashboard Service] Invalid dashboard ID: ${e}`))}toggleStaticDashboard(){this.isDashboardStatic.set(!this.isDashboardStatic())}add(e,t,i,a){let r=0;return this.dashboards.update(s=>{let d=[...s,{id:Si.create(),name:e,icon:i??"dashboard-dashboard",configuration:t,collapseSplitShell:a??!1}];return r=d.length-1,d}),r}update(e,t,i,a){this.dashboards.update(r=>r.map((s,d)=>d===e?pe(oe({},s),{name:t,icon:i??"dashboard-dashboard",collapseSplitShell:a??!1}):s))}delete(e){this.dashboards.update(t=>t.filter((i,a)=>a!==e)),this.dashboards().length===0?(this.add("Dashboard "+(this.dashboards().length+1),[]),this.activeDashboard.set(0)):this.activeDashboard()>this.dashboards().length-1&&this.activeDashboard.set(this.dashboards().length-1)}duplicate(e,t,i,a){if(e<0||e>=this.dashboards().length)return console.error(`[Dashboard Service] Invalid itemIndex: ${e}`),-1;let r=this.dashboards()[e],s=Ft(r);s.id=Si.create(),s.name=t,s.icon=i||"dashboard-dashboard",s.collapseSplitShell=a??!1,Array.isArray(s.configuration)?s.configuration.forEach(m=>{m&&m.input?.widgetProperties?(m.id=Si.create(),m.input.widgetProperties.uuid=m.id):console.error("Dashboard Service] Widget configuration is missing required properties:",m)}):(console.error("Dashboard Service] Dashboard configuration is not an array:",s.configuration),s.configuration=[]);let d=-1;return this.dashboards.update(m=>{let f=[...m,s];return d=f.length-1,f}),d}updateConfiguration(e,t){let i=Ft(t??[]);this.dashboards.update(a=>a.map((r,s)=>s===e?wi(r.configuration,i)?r:pe(oe({},r),{configuration:i}):r))}previousDashboard(){this.activeDashboard()+1>this.dashboards().length-1?this.activeDashboard.set(0):this.activeDashboard.set(this.activeDashboard()+1)}nextDashboard(){this.activeDashboard()-1<0?this.activeDashboard.set(this.dashboards().length-1):this.activeDashboard.set(this.activeDashboard()-1)}navigateToActive(){this._router.navigate(["/dashboard",this.activeDashboard()])}navigateTo(e){e>=0&&e<this.dashboards().length?this._router.navigate(["/dashboard",e]):console.error(`[Dashboard Service] Invalid dashboard ID: ${e}`)}navigateToNextDashboard(){let e=null;this.activeDashboard()-1<0?e=this.dashboards().length-1:e=this.activeDashboard()-1,this._router.navigate(["/dashboard",e])}navigateToPreviousDashboard(){let e=null;this.activeDashboard()+1>=this.dashboards().length?e=0:e=this.activeDashboard()+1,this._router.navigate(["/dashboard",e])}deleteWidget(e){this._widgetAction.next({id:e,operation:"delete"})}duplicateWidget(e){this._widgetAction.next({id:e,operation:"duplicate"})}copyWidget(e){this._widgetAction.next({id:e,operation:"copy"})}cutWidget(e){this._widgetAction.next({id:e,operation:"cut"})}setWidgetClipboardFromNode(e){let t=e?.input?.widgetProperties,i=t?.type;i&&this.widgetClipboard.set({w:e.w,h:e.h,selector:e.selector,input:{widgetProperties:{type:i,uuid:"clipboard",config:Ft(t.config)}}})}clearWidgetClipboard(){this.widgetClipboard.set(null)}setStaticDashboard(e){this.isDashboardStatic.set(e)}notifyLayoutEditSaved(){this.layoutEditSaved.update(e=>e+1)}notifyLayoutEditCanceled(){this.layoutEditCanceled.update(e=>e+1)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ss=(()=>{class n{http=y(Ha);connection=y($r);destroyRef=y(Ze);historyServiceUrl=null;constructor(){this.connection.serverServiceEndpoint$.pipe($e(this.destroyRef)).subscribe(e=>{let t=e?.httpServiceUrl||null;this.historyServiceUrl=t?t.replace("/v1/","/v2/"):null,this.historyServiceUrl||console.warn("[HistoryApiClientService] History API endpoint not available; history service is disabled")})}getPaths(e){return Le(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let t=`${this.historyServiceUrl}history/paths`,i=new Ur;e?.from&&(i=i.set("from",e.from)),e?.to&&(i=i.set("to",e.to)),e?.duration&&(i=i.set("duration",e.duration.toString()));let a=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${a}`);let r=yield kn(this.http.get(t,{params:i}));return console.log(`[HistoryApiClientService] Retrieved ${r?.length??0} available paths`),r}catch(t){return console.error("[HistoryApiClientService] History API /paths request failed:",t),null}})}getContexts(e){return Le(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let t=`${this.historyServiceUrl}history/contexts`,i=new Ur;e?.from&&(i=i.set("from",e.from)),e?.to&&(i=i.set("to",e.to)),e?.duration&&(i=i.set("duration",e.duration.toString()));let a=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${a}`);let r=yield kn(this.http.get(t,{params:i}));return console.log(`[HistoryApiClientService] Retrieved ${r?.length??0} available contexts`),r}catch(t){return console.error("[HistoryApiClientService] History API /contexts request failed:",t),null}})}getValues(e){return Le(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let t=`${this.historyServiceUrl}history/values`,i=new Ur;i=i.set("paths",e.paths),e.context&&(i=i.set("context",e.context)),e.from&&(i=i.set("from",e.from)),e.to&&(i=i.set("to",e.to)),e.duration&&(i=i.set("duration",e.duration.toString())),e.resolution!==void 0&&e.resolution!==null&&(i=i.set("resolution",e.resolution.toString()));let a=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${a}`);let r=yield kn(this.http.get(t,{params:i}));return console.log(`[HistoryApiClientService] History fetch successful, received ${r.data?.length??0} data points`),r}catch(t){return console.error("[HistoryApiClientService] History API request failed:",t),null}})}getProviders(){return Le(this,null,function*(){let e=`${this.historyServiceUrl}history/_providers`;return yield kn(this.http.get(e)),["kip"]})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ls=(()=>{class n{mapValuesToChartDatapoints(e,t){let i=e?.data;if(!i||i.length===0)return[];let a=-1,r=-1;if(e.values&&Array.isArray(e.values)){for(let E=0;E<e.values.length;E++){let F=e.values[E]?.method,I=typeof F=="string"?F.toLowerCase():F;if(!I)continue;let Z=E+1;I==="sma"?a=Z:(I==="avg"||I==="average")&&(r=Z)}r<0&&e.values.length===1&&(r=1)}else i[0]?.length>1&&(r=1);let s=t.unit==="rad",d=s?t.domain==="signed"?this.normalizeToSigned.bind(this):this.normalizeToDirection.bind(this):null,m=[],f=0,b=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,C=0,w=0,M=0,G=[];for(let E of i){if(!Array.isArray(E)||E.length===0)continue;let F=Date.parse(E[0]),I=a>=0?E[a]:null,Z=r>=0?E[r]:null;if(s?(I=Number.isFinite(I)?d(I):null,Z=Number.isFinite(Z)?d(Z):null):(I=Number.isFinite(I)?I:null,Z=Number.isFinite(Z)?Z:null),Number.isFinite(Z)){let j=Z;s?(G.push(j),w+=Math.sin(j),M+=Math.cos(j)):(C++,f+=j,j<b&&(b=j),j>A&&(A=j))}m.push({timestamp:F,data:{value:Z,sma:I,ema:null,doubleEma:null,lastAverage:null,lastMinimum:null,lastMaximum:null}})}if(m.length>0){let E=null,F=null,I=null;if(s&&G.length>0){E=Math.atan2(w/G.length,M/G.length);let{min:Z,max:j}=this.circularMinMaxRad(G);t.domain==="signed"?(E=this.normalizeToSigned(E),F=this.normalizeToSigned(Z),I=this.normalizeToSigned(j)):(E=this.normalizeToDirection(E),F=this.normalizeToDirection(Z),I=this.normalizeToDirection(j))}else!s&&C>0&&(E=f/C,F=b,I=A);if(E!==null&&F!==null&&I!==null){let Z=m[m.length-1];Z.data.lastAverage=E,Z.data.lastMinimum=F,Z.data.lastMaximum=I}}return m}circularMinMaxRad(e){if(e.length===0)return{min:0,max:0};let t=e.map(r=>(r*180/Math.PI+360)%360).sort((r,s)=>r-s),i=0,a=0;for(let r=0;r<t.length;r++){let s=(r+1)%t.length,d=(t[s]-t[r]+360)%360;d>i&&(i=d,a=s)}return{min:t[a]*Math.PI/180,max:t[(a-1+t.length)%t.length]*Math.PI/180}}mod(e,t){return(e%t+t)%t}normalizeToDirection(e){let t=2*Math.PI;return this.mod(e,t)}normalizeToSigned(e){let t=2*Math.PI;return this.mod(e+Math.PI,t)-Math.PI}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var dn=(()=>{class n{appSettings=y(Lt);data=y(Wt);history=y(ss);historyChartAdapter=y(ls);historyMinSampleTimeMs=1e3;_svcDatasetConfigs=[];_svcDataSource=[];_svcSubjectObserverRegistry=[];_startAllPromise;signedAnglePaths=new Set(["self.navigation.attitude.roll","self.navigation.attitude.pitch","self.navigation.attitude.yaw","self.environment.wind.angleApparent","self.environment.wind.angleTrueGround","self.environment.wind.angleTrueWater","self.steering.rudderAngle"]);constructor(){this._svcDatasetConfigs=this.appSettings.getDataSets(),this.cleanupDatasets(),this._startAllPromise=this.startAll()}cleanupDatasets(){if(this.appSettings.configUpgrade()||this.appSettings.getAppConfig().configVersion<12)return;let t=this.appSettings.getDashboardConfig(),i=new Set;t.forEach(d=>{d.configuration?.length&&d.configuration?.forEach(m=>{m?.id&&i.add(m.id)})});function a(d){let m=d.match(/^(windtrends|speedtrends)-(.+)$/);return m?m[2]:null}let r=[],s=[];for(let d of this._svcDatasetConfigs){let m=d.label||"",f=!1;if(m.startsWith("windtrends-")||m.startsWith("speedtrends-")){let b=a(m);f=!!(b&&i.has(b))}else(m.startsWith("simple-chart-")||(m.match(/\|/g)||[]).length===4)&&(f=i.has(d.uuid));f?s.push(d):r.push(d)}r.length&&(r.forEach(d=>{console.warn(`[DatasetStreamService] Cleaned dataset: uuid=${d.uuid}, label="${d.label}"`)}),this._svcDatasetConfigs=s,this.appSettings.saveDataSets(this._svcDatasetConfigs))}setupServiceSubjectRegistry(e,t){let i=this._svcSubjectObserverRegistry.findIndex(a=>a.datasetUuid==e);i>=0&&(this._svcSubjectObserverRegistry[i].rxjsSubject.complete(),this._svcSubjectObserverRegistry.splice(i,1)),this._svcSubjectObserverRegistry.push({datasetUuid:e,rxjsSubject:new Yd(t)})}createDataSourceConfiguration(e){let r={uuid:e.uuid,pathObserverSubscription:null,sampleTime:null,maxDataPoints:null,smoothingPeriod:null,historicalData:[]},s=m(e.timeScaleFormat,e.period),d=s>0?Math.max(100,Math.round(s/120)):1e3;return r.sampleTime=d,r.maxDataPoints=Math.max(1,Math.ceil(s/d)),r.smoothingPeriod=Math.max(1,Math.floor(r.maxDataPoints*.25)),(!r.maxDataPoints||r.maxDataPoints<1)&&(r.maxDataPoints=1),(!r.sampleTime||r.sampleTime<1)&&(r.sampleTime=1),r;function m(f,b){switch(f){case"Last Minute":return 6e4;case"Last 5 Minutes":return 5*6e4;case"Last 30 Minutes":return 30*6e4;case"day":return Math.max(0,b)*24*60*6e4;case"hour":return Math.max(0,b)*60*6e4;case"minute":return Math.max(0,b)*6e4;case"second":return Math.max(0,b)*1e3;default:return 0}}}waitUntilReady(){return Le(this,null,function*(){return this._startAllPromise})}startAll(){return Le(this,null,function*(){console.log("[DatasetStreamService] Auto Starting "+this._svcDatasetConfigs.length.toString()+" Datasets");for(let e of this._svcDatasetConfigs)yield this.start(e.uuid)})}start(e){return Le(this,null,function*(){let t=this._svcDatasetConfigs.find(b=>b.uuid==e);if(!t){console.warn(`[DatasetStreamService] Dataset UUID:${e} not found`);return}let i=this.createDataSourceConfiguration(t);this.setupServiceSubjectRegistry(i.uuid,i.maxDataPoints);let a=this._svcDataSource[this._svcDataSource.push(i)-1];console.log(`[DatasetStreamService] Starting recording process: ${t.path}, Scale: ${t.timeScaleFormat}, Period: ${t.period}, Datapoints: ${i.maxDataPoints}`);let r=this.resolveAngleDomain(t.path,t.baseUnit),s=Math.max(1,Math.round(i.sampleTime/1e3));this.shouldSeedHistory(i.sampleTime)&&(yield this.seedHistoryData(a,t,s,r));let d=this.data.subscribePath(t.path,t.pathSource).pipe(vi(b=>b?.data?.value!==null),wr({bufferSize:1,refCount:!0})),m=d.pipe(Jt(1)),f=ca(i.sampleTime,i.sampleTime).pipe(sc(d,(b,A)=>A));a.pathObserverSubscription=gi(m,f).subscribe(b=>{a.maxDataPoints>0&&a.historicalData.length>=a.maxDataPoints&&a.historicalData.shift(),a.historicalData.push(b.data.value);let A=this.updateDataset(a,t.baseUnit,r);this._svcSubjectObserverRegistry.find(C=>C.datasetUuid===a.uuid).rxjsSubject.next(A)})})}seedHistoryData(e,t,i,a){return Le(this,null,function*(){try{let r=this.buildHistoryPathString(t.path,e.smoothingPeriod),s=(()=>{switch(t.timeScaleFormat){case"Last Minute":return 6e4;case"Last 5 Minutes":return 5*6e4;case"Last 30 Minutes":return 30*6e4;case"day":return Math.max(0,t.period)*24*60*6e4;case"hour":return Math.max(0,t.period)*60*6e4;case"minute":return Math.max(0,t.period)*6e4;case"second":return Math.max(0,t.period)*1e3;default:return 0}})(),d=new Date,m={paths:r,from:new Date(d.getTime()-s).toISOString(),resolution:i},f=yield this.history.getValues(m);if(!f||!f.data||f.data.length===0){console.log(`[DatasetStreamService] No history data available for ${t.path}`);return}let b=this.convertHistoryToDatapoints(f,t.baseUnit,a),A=this._svcSubjectObserverRegistry.find(C=>C.datasetUuid===e.uuid)?.rxjsSubject;if(A&&b.length>0){let C=[];e.historicalData=[],b.forEach(w=>{let M=w.data.value;if(!Number.isFinite(M))return;e.maxDataPoints>0&&e.historicalData.length>=e.maxDataPoints&&e.historicalData.shift(),e.historicalData.push(M);let G=this.updateDataset(e,t.baseUnit,a);G.timestamp=w.timestamp,C.push(G)}),C.forEach(w=>A.next(w)),console.log(`[DatasetStreamService] Seeded ${C.length} history datapoints for ${t.path}`)}}catch(r){console.warn(`[DatasetStreamService] Failed to seed history data for ${t.path}:`,r)}})}stop(e){let t=this._svcDataSource.findIndex(i=>i.uuid==e);console.log(`[DatasetStreamService] Stopping Dataset ${e} data capture`),this._svcDataSource[t].pathObserverSubscription.unsubscribe(),this._svcDataSource.splice(t,1)}list(){return Ft(this._svcDatasetConfigs)}getDatasetConfig(e){return this._svcDatasetConfigs.find(t=>t.uuid===e)}getDataSourceInfo(e){return this._svcDataSource.find(t=>t.uuid===e)}create(e,t,i,a,r,s=!0,d=!0,m){if(!e||!t||!i||!a||!r)return null;let f=m||Si.create(),b={uuid:f,path:e,pathSource:t,baseUnit:this.data.getPathUnitType(e),timeScaleFormat:i,period:a,label:r,editable:d};return console.log(`[DatasetStreamService] Creating ${s?"":"non-"}persistent ${d?"":"hidden "}dataset: ${b.uuid}, Path: ${b.path}, Source: ${b.pathSource} Scale: ${b.timeScaleFormat}, Period: ${b.period}`),this._svcDatasetConfigs.push(b),this.start(f),s===!0&&this.appSettings.saveDataSets(this._svcDatasetConfigs),f}edit(e,t=!0){let i=this._svcDatasetConfigs.find(a=>a.uuid===e.uuid);return i?JSON.stringify(i)===JSON.stringify(e)?(console.log(`[DatasetStreamService] No changes detected for Dataset ${e.uuid}.`),!1):(this.stop(e.uuid),console.log(`[DatasetStreamService] Updating Dataset: ${e.uuid}`),e.baseUnit=this.data.getPathUnitType(e.path),this._svcDatasetConfigs.splice(this._svcDatasetConfigs.findIndex(a=>a.uuid===e.uuid),1,e),this.start(e.uuid),t===!0&&this.appSettings.saveDataSets(this._svcDatasetConfigs),!0):!1}remove(e,t=!0){return!e||e===""||this._svcDatasetConfigs.findIndex(i=>i.uuid===e)===-1?!1:(this.stop(e),console.log(`[DatasetStreamService] Removing ${t?"":"non-"}persistent Dataset: ${e}`),this._svcDatasetConfigs.splice(this._svcDatasetConfigs.findIndex(i=>i.uuid===e),1),this._svcSubjectObserverRegistry.find(i=>i.datasetUuid===e).rxjsSubject.complete(),this._svcSubjectObserverRegistry.splice(this._svcSubjectObserverRegistry.findIndex(i=>i.datasetUuid===e),1),t===!0&&this.appSettings.saveDataSets(this._svcDatasetConfigs),!0)}getDatasetObservable(e){let t=this._svcSubjectObserverRegistry.find(i=>i.datasetUuid==e);return t?t.rxjsSubject.asObservable():null}getDatasetBatchThenLiveObservable(e){let t=this._svcSubjectObserverRegistry.find(d=>d.datasetUuid==e);if(!t)return null;let i=t.rxjsSubject,a=i._buffer?i._buffer.slice():[],r=Qd([a]),s=i.pipe(_r(a.length));return Jd(r,s)}updateDataset(e,t,i="scalar"){let a=null,r=null,s=null,d=null;if(t==="rad"){a=this.circularMeanRad(e.historicalData);let A=e.historicalData.slice(-e.smoothingPeriod);r=this.circularMeanRad(A);let{min:C,max:w}=this.circularMinMaxRad(e.historicalData);i==="direction"?(a=this.normalizeToDirection(a),r=this.normalizeToDirection(r),s=this.normalizeToDirection(C),d=this.normalizeToDirection(w)):i==="signed"?(a=this.normalizeToSigned(a),r=this.normalizeToSigned(r),s=this.normalizeToSigned(C),d=this.normalizeToSigned(w)):(s=C,d=w)}else a=f(e.historicalData),r=b(e.historicalData,e.smoothingPeriod),s=Math.min(...e.historicalData),d=Math.max(...e.historicalData);return{timestamp:Date.now(),data:{value:t==="rad"?i==="signed"?this.normalizeToSigned(e.historicalData[e.historicalData.length-1]):this.normalizeToDirection(e.historicalData[e.historicalData.length-1]):e.historicalData[e.historicalData.length-1],sma:r,ema:null,doubleEma:null,lastAverage:a,lastMinimum:s,lastMaximum:d}};function f(A){return A.length===0?null:A.reduce((w,M)=>w+M,0)/A.length}function b(A,C){A.length<C&&(C=A.length);let w=0;for(let M=A.length-C;M<A.length;M++)w+=A[M];return w/C}}circularMeanRad(e){if(e.length===0)return 0;let t=e.reduce((a,r)=>a+Math.sin(r),0),i=e.reduce((a,r)=>a+Math.cos(r),0);return Math.atan2(t/e.length,i/e.length)}circularMinMaxRad(e){if(e.length===0)return{min:0,max:0};let t=e.map(d=>(d*180/Math.PI+360)%360).sort((d,m)=>d-m),i=0,a=0;for(let d=0;d<t.length;d++){let m=(d+1)%t.length,f=(t[m]-t[d]+360)%360;f>i&&(i=f,a=m)}let r=t[a]*Math.PI/180,s=t[(a-1+t.length)%t.length]*Math.PI/180;return{min:r,max:s}}resolveAngleDomain(e,t){if(t!=="rad")return"scalar";let i=this.normalizePathKey(e);for(let a of this.signedAnglePaths)if(i===this.normalizePathKey(a))return"signed";return"direction"}normalizePathKey(e){return e.replace(/^vessels\.self\./,"").replace(/^self\./,"")}mod(e,t){return(e%t+t)%t}normalizeToDirection(e){let t=2*Math.PI;return this.mod(e,t)}normalizeToSigned(e){let t=2*Math.PI;return this.mod(e+Math.PI,t)-Math.PI}removeIfExists(e,t=!0){return!e||this._svcDatasetConfigs.findIndex(i=>i.uuid===e)===-1?!1:this.remove(e,t)}shouldSeedHistory(e){return e>=this.historyMinSampleTimeMs}buildHistoryPathString(e,t){let i=e.replace(/^(vessels\.)?self\./,"");return[`${i}:sma:${t}`,`${i}:avg`,`${i}:min`,`${i}:max`].join(",")}convertHistoryToDatapoints(e,t,i){return this.historyChartAdapter.mapValuesToChartDatapoints(e,{unit:t,domain:i})}ngOnDestroy(){[...this._svcDataSource].forEach(e=>{try{this.stop(e.uuid)}catch(t){}}),this._svcSubjectObserverRegistry.forEach(e=>e.rxjsSubject.complete()),this._svcSubjectObserverRegistry=[]}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Ru=(()=>{class n{kipTimers={};constructor(){}createTimer(e,t,i){return e in this.kipTimers?this.kipTimers[e].currentValue.asObservable():(this.kipTimers[e]={currentValue:new ji(t),timeoutID:null,intervalMS:i},this.kipTimers[e].currentValue.asObservable())}startTimer(e){Object.prototype.hasOwnProperty.call(this.kipTimers,e)&&this.kipTimers[e].timeoutID===null&&(this.kipTimers[e].timeoutID=setInterval(()=>{this.kipTimers[e].currentValue.next(this.kipTimers[e].currentValue.value+1)},this.kipTimers[e].intervalMS))}stopTimer(e){Object.prototype.hasOwnProperty.call(this.kipTimers,e)&&this.kipTimers[e].timeoutID!==null&&(clearInterval(this.kipTimers[e].timeoutID),this.kipTimers[e].timeoutID=null)}setTimer(e,t){Object.prototype.hasOwnProperty.call(this.kipTimers,e)&&this.kipTimers[e].currentValue.next(t)}deleteTimer(e){Object.prototype.hasOwnProperty.call(this.kipTimers,e)&&(this.stopTimer(e),this.kipTimers[e].currentValue.complete(),delete this.kipTimers[e])}isRunning(e){let t=!1;return e in this.kipTimers&&(t=this.kipTimers[e].timeoutID!==null),t}ngOnDestroy(){Object.keys(this.kipTimers).forEach(e=>{this.kipTimers[e].timeoutID&&(clearInterval(this.kipTimers[e].timeoutID),this.kipTimers[e].timeoutID=null),this.kipTimers[e].currentValue.complete()}),this.kipTimers={}}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Lu=(()=>{class n{sanitizer=y(qa);transform(e){return this.sanitizer.bypassSecurityTrustResourceUrl(e)}static \u0275fac=function(t){return new(t||n)};static \u0275pipe=Or({name:"safe",type:n,pure:!0})}return n})();var Bg={minDist:230,maxDur:550,minVelocity:1.5,axisDominance:1.8,deadzoneMs:160,purityRatio:.8,lockThreshold:28,directionLockAngle:25,reversalPrimaryThreshold:34};function ao(n){let o=oe(oe({},Bg),n);return`(() => {
|
|
1
|
+
import{$ as os,A as ns,B as Qa,C as Bi,D as Sl,E as as,F as Fo,G as wl,H as Go,I as Bo,J as Xa,K as Ka,L as _l,M as Ml,N as Ja,O as Uo,P as kl,Q as Su,R as wu,S as _u,T as zn,U as Hn,V as eo,W as vt,X as qn,Y as $n,Z as to,_ as Mu,a as qt,aa as rs,b as oi,ba as ku,c as Di,ca as Tu,d as gu,da as jn,e as vu,ea as ln,f as bu,g as es,h as Au,i as yu,j as xu,k as Cu,l as mt,m as fa,n as Fi,o as Bn,p as ga,q as bn,r as rn,s as sn,t as Gi,u as Un,v as hi,w as ts,x as is,y as Za,z as va}from"./chunk-XX365EOU.js";import{a as fu,b as Jr,c as ri}from"./chunk-YY4ZUJFI.js";import{a as Eu,b as Du,c as Pu,d as Iu,e as Nu}from"./chunk-CSIELI2Z.js";import{a as ai,b as on,c as at,e as io,f as no}from"./chunk-4YDVZHMH.js";import{a as lu,b as du,c as cu,d as Ya,e as uu,f as Vt,g as mu,h as hu,k as pu,m as Wo,o as Ae,p as Cl,r as Wt}from"./chunk-M37BLWHF.js";import{b as Qc,e as Xc,f as jr}from"./chunk-WJFXI5PQ.js";import{a as Fn,b as Gn}from"./chunk-HSKVTFFQ.js";import{a as Jc,b as eu,c as tu,d as tn,e as ti,g as iu,h as Mi,i as ki,j as Ti,k as Nn,l as Ht,n as Ct,o as Vn,p as ru,q as Wn,s as su,u as St,v as ii,w as wt,x as ni}from"./chunk-MXUEYEZU.js";import{A as On,B as $a,C as nn,D as ou,E as xl,F as an,G as Xr,H as Kr,I as Ei,J as pt,K as ja,L as Rn,M as Pt,O as Ln,P as It,Q as xt,a as Si,b as yc,d as Ft,e as wi,f as $c,i as $r,j as jc,k as Yc,l as Zc,m as Lt,n as en,o as Yr,p as yt,r as Et,t as dt,u as Dt,v as nu,w as Zr,x as Qr,y as au,z as ct}from"./chunk-2GOHQZH5.js";import{$ as wr,$a as ma,$b as be,$c as Dn,Aa as Ze,Ab as xe,Ac as J,Bb as Ce,Bc as pc,Bd as Ha,Be as Fc,Ca as ei,Cb as O,Cc as fc,Ce as Gc,D as Jd,Da as Be,Db as l,Dc as ut,De as Bc,E as ec,Eb as u,Ec as x,Fa as _,Fb as V,Fc as he,Ga as W,Gb as D,Gd as qa,Ge as Uc,H as ca,Ha as Zi,Hb as N,Hc as Fr,He as zc,I as xr,Ib as Q,J as gi,Jb as Xi,Jc as Ci,Jd as kc,Je as Hc,K as vi,Ka as Ke,Kb as Ki,Lb as Rr,Lc as bt,Mb as Te,Md as Tc,Nb as Li,Nd as pa,Ne as qc,O as tc,Ob as z,Od as Pn,Oe as $e,P as Tn,Pa as Dr,Pb as Ro,Pd as Ec,Pe as _i,Q as Jt,Qa as Pr,Qb as T,Qe as Kc,Ra as ua,Rb as Lr,Rd as yl,Re as Qe,S as ic,Sb as Vr,Sd as zr,Se as et,T as nc,Tb as Wr,Td as Dc,U as Cr,Ub as En,V as Sr,Va as g,Vb as yi,Vc as gc,Vd as Wi,Wb as xi,Wc as vc,Xa as cc,Xc as bc,Xd as Ji,Ya as uc,Yb as _e,Z as ac,Zb as Me,_ as oc,_a as Ir,_b as Nt,_c as Gr,a as oe,aa as _r,ac as st,ae as Pc,b as pe,ba as Ga,bc as Ba,bd as Ua,be as Ic,ca as Mr,cb as Nr,cc as it,ce as Tt,d as Gg,da as kr,dc as c,dd as Ac,de as Hr,e as jd,ea as Tr,ec as X,ee as In,f as Le,fa as rc,fb as q,fc as fe,fe as Nc,g as Fa,ga as sc,gb as Qi,gc as zt,ge as At,hb as Rt,ib as Or,ie as qr,j as vl,ja as Er,jb as mc,jc as mn,jd as xc,je as nt,k as Ut,ka as rt,kb as Oo,kc as hn,kd as Cc,la as Yi,lb as bi,lc as pn,ld as Sc,le as Oc,m as ji,mb as hc,mc as ha,n as Yd,na as un,nc as fn,oc as gn,pa as y,pc as Vi,pd as wc,pe as Rc,q as Zd,qc as Al,qe as Lc,r as Qd,rc as Lo,rd as Br,s as bl,sa as lc,sc as Vo,sd as _c,t as Xd,td as Mc,ua as ne,ub as K,uc as lt,va as ae,vc as kt,vd as za,w as yr,wa as te,wb as R,wc as vn,x as kn,xa as Ge,xb as L,xe as Vc,y as Kd,ya as No,yb as Ne,yd as Ur,z as Zt,za as dc,zb as Ai,zc as B,ze as Wc}from"./chunk-PZ6I6W3H.js";var gd=Gg((BL,Js)=>{(function(n){"use strict";function o(p){if(Array.isArray(p)){for(var h=0,v=Array(p.length);h<p.length;h++)v[h]=p[h];return v}return Array.from(p)}function e(p,h){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!h||typeof h!="object"&&typeof h!="function"?p:h}function t(p,h){if(typeof h!="function"&&h!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof h);p.prototype=Object.create(h&&h.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),h&&(Object.setPrototypeOf?Object.setPrototypeOf(p,h):p.__proto__=h)}function i(p,h){if(!(p instanceof h))throw new TypeError("Cannot call a class as a function")}function a(p,h){if(h||(h=typeof window>"u"?global:window),h[p]!==void 0)return h[p];if(Ar===null){var v=window.getComputedStyle(document.documentElement,"");Ar=(Array.prototype.slice.call(v).join("").match(/-(moz|webkit|ms)-/)||v.OLink===""&&["","o"]||["",""])[1]}if(Ar==="")return null;var S=p.charAt(0).toUpperCase()+p.substr(1),k=h[Ar+S];return k!==void 0?k:null}function r(p,h,v,S,k,P,U){if(typeof S!="function")throw new TypeError("Invalid animation rule:",S);var $=p-v,H=$/k,Y=0;H>1&&(H=1),H!==1&&(Y=S(H),isFinite(Y)&&!isNaN(Y)&&(H=Y)),h&&h(H),$<k?U.frame=Ud(function(ce){return r(ce,h,v,S,k,P,U)}):(P&&P(),U.inProgress=!1)}function s(){Array.prototype.constructor.apply(this,arguments)}function d(p){if(!(p instanceof DOMException&&p.result===2152923147))throw p}function m(p,h){return h.replace(Vg,function(v,S){var k=p[S];return k!==void 0?k:v})}function f(p){return p.majorTicks instanceof Array||(p.majorTicks=p.majorTicks?[p.majorTicks]:[]),p.majorTicks.length||(p.majorTicks.push(we.formatMajorTickNumber(p.minValue,p)),p.majorTicks.push(we.formatMajorTickNumber(p.maxValue,p))),[p.tickSide!=="right",p.tickSide!=="left"]}function b(p,h,v,S,k,P){p.beginPath(),p.moveTo(h+P,v),p.lineTo(h+S-P,v),p.quadraticCurveTo(h+S,v,h+S,v+P),p.lineTo(h+S,v+k-P),p.quadraticCurveTo(h+S,v+k,h+S-P,v+k),p.lineTo(h+P,v+k),p.quadraticCurveTo(h,v+k,h,v+k-P),p.lineTo(h,v+P),p.quadraticCurveTo(h,v,h+P,v),p.closePath()}function A(p,h){var v=h.valueDec,S=h.valueInt,k=0,P=void 0,U=void 0,$=void 0;if(p=parseFloat(p),$=p<0,p=Math.abs(p),v>0){for(U=p.toFixed(v).toString().split("."),P=S-U[0].length;k<P;++k)U[0]="0"+U[0];U=($?"-":"")+U[0]+"."+U[1]}else{for(U=Math.round(p).toString(),P=S-U.length;k<P;++k)U="0"+U;U=($?"-":"")+U}return U}function C(p,h){var v=void 0,S=!1;return v=h.majorTicksDec===0?Math.round(p).toString():p.toFixed(h.majorTicksDec),h.majorTicksInt>1?(S=~v.indexOf("."),~v.indexOf("-")?"-"+[h.majorTicksInt+h.majorTicksDec+2+(S?1:0)-v.length].join("0")+v.replace("-",""):[h.majorTicksInt+h.majorTicksDec+1+(S?1:0)-v.length].join("0")+v):v}function w(p){return p*Math.PI/180}function M(p,h){return{x:-p*Math.sin(h),y:p*Math.cos(h)}}function G(p,h,v,S){var k=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],P=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,U=p.createLinearGradient(k?0:P,k?P:0,k?0:S,k?S:0);return U.addColorStop(0,h),U.addColorStop(1,v),U}function E(p,h){h.needleShadow&&(p.shadowOffsetX=2,p.shadowOffsetY=2,p.shadowBlur=10,p.shadowColor=h.colorNeedleShadowDown)}function F(p,h,v){return p["font"+h+"Style"]+" "+p["font"+h+"Weight"]+" "+p["font"+h+"Size"]*v+"px "+p["font"+h]}function I(p){p.shadowOffsetX=null,p.shadowOffsetY=null,p.shadowBlur=null,p.shadowColor="",p.strokeStyle=null,p.lineWidth=0,p.save()}function Z(p,h,v,S){h.valueTextShadow&&(p.shadowOffsetX=v,p.shadowOffsetY=v,p.shadowBlur=S,p.shadowColor=h.colorValueTextShadow)}function j(p,h,v,S,k,P){if(h.valueBox){I(p);var U=h.valueDec?1+h.valueDec:0,$="9".repeat(Math.max.apply(null,[String(parseInt(v)).length+U].concat(h.majorTicks.map(function(qe){return String(parseInt(qe,10)).length+U})))),H=h.valueText||A(v,h),Y=P/200,ce=P/100,me=.4*ce,Ee=1.2*ce;p.font=F(h,"Value",Y),Z(p,h,me,Ee);var De=p.measureText(h.valueText?H:"-"+A(Number($),h)).width;I(p);var Oe=parseFloat(h.fontValueSize)*Y+me+Ee,Xe=ce*parseFloat(h.valueBoxStroke),Ie=2*P-2*Xe,je=De+10*ce,Ye=1.1*Oe+me+Ee,Je=ce*h.valueBoxBorderRadius,ze=(parseFloat(h.valueBoxWidth)||0)/100*Ie;ze>je&&(je=ze),je>Ie&&(je=Ie);var He=S-je/2,Fe=k-Ye/2,Pe=k-5.75*ce;if(p.beginPath(),Je?b(p,He,Fe,je,Ye,Je):p.rect(He,Fe,je,Ye),Xe){var Re=p.createRadialGradient(S,Pe,10*ce,S,Pe,20*ce);Re.addColorStop(0,h.colorValueBoxRect),Re.addColorStop(1,h.colorValueBoxRectEnd),p.strokeStyle=Re,p.lineWidth=Xe,p.stroke()}h.colorValueBoxShadow&&(p.shadowBlur=1.2*ce,p.shadowColor=h.colorValueBoxShadow),h.colorValueBoxBackground&&(p.fillStyle=h.colorValueBoxBackground,p.fill()),p.closePath(),p.restore(),Z(p,h,me,Ee),p.fillStyle=h.colorValueText,p.textAlign="center",p.textBaseline="alphabetic",p.fillText(H,He+je/2,k+Ye/2-Oe/3),p.restore()}}function ye(p){var h=p.value,v=p.minValue,S=p.maxValue,k=.01*(S-v);return{normal:h<v?v:h>S?S:h,indented:h<v?v-k:h>S?S+k:h}}function ue(p,h,v,S,k){v.beginPath(),v.arc(0,0,Ri(p),0,2*Po,!0),v.lineWidth=h,v.strokeStyle=k?we.linearGradient(v,S,k,p):S,v.stroke(),v.closePath()}function ie(p,h){var v=Oi.pixelRatio;return p.maxRadius||(p.maxRadius=p.max-h.borderShadowWidth-h.borderOuterWidth*v-h.borderMiddleWidth*v-h.borderInnerWidth*v+(h.borderOuterWidth?.5:0)+(h.borderMiddleWidth?.5:0)+(h.borderInnerWidth?.5:0)),p.maxRadius}function re(p,h){function v(me,Ee,De,Oe,Xe,Ie){return Ee&&(!Ie&&h.borderShadowWidth&&(De.save(),De.shadowBlur=h.borderShadowWidth,De.shadowColor=h.colorBorderShadow),ue(me,Ee*S,De,Oe,Xe),!Ie&&h.borderShadowWidth&&(Ie=!0,De.restore())),Ie}var S=Oi.pixelRatio,k=h.borderShadowWidth*S,P=p.max-k-h.borderOuterWidth*S/2,U=P-h.borderOuterWidth*S/2-h.borderMiddleWidth*S/2+.5,$=U-h.borderMiddleWidth*S/2-h.borderInnerWidth*S/2+.5,H=ie(p,h),Y=void 0,ce=!1;p.save(),ce=v(P,h.borderOuterWidth,p,h.colorBorderOuter,h.colorBorderOuterEnd,ce),ce=v(U,h.borderMiddleWidth,p,h.colorBorderMiddle,h.colorBorderMiddleEnd,ce),ce=v($,h.borderInnerWidth,p,h.colorBorderInner,h.colorBorderInnerEnd,ce),!ce&&h.borderShadowWidth&&(p.shadowBlur=h.borderShadowWidth,p.shadowColor=h.colorBorderShadow),p.beginPath(),p.arc(0,0,Ri(H),0,2*Po,!0),h.colorPlateEnd?(Y=p.createRadialGradient(0,0,H/2,0,0,H),Y.addColorStop(0,h.colorPlate),Y.addColorStop(1,h.colorPlateEnd)):Y=h.colorPlate,p.fillStyle=Y,p.fill(),p.closePath(),p.restore()}function de(p,h){if(h.highlights!=="false"&&h.highlights.length&&h.highlightsWidth!==0){var v=p.max*(parseFloat(h.highlightsWidth)||0)/100,S=Ri(ve(p,h)-v/2),k=h.highlights.length,P=(h.maxValue-h.minValue)/h.ticksAngle;p.save();for(var U=0;U<k;U++){var $=h.highlights[U];p.lineWidth=v,p.lineCap=h.highlightsLineCap,p.strokeStyle=$.color,p.beginPath(),p.rotate(gl),p.arc(0,0,S,we.radians(h.startAngle+($.from-h.minValue)/P),we.radians(h.startAngle+($.to-h.minValue)/P),!1),p.stroke(),p.closePath(),p.restore(),p.save()}p.restore()}}function ee(p,h){var v=ve(p,h),S=void 0,k=void 0,P=void 0,U=0,$=Math.abs(h.minorTicks)||0,H=h.ticksAngle/(h.maxValue-h.minValue);h.exactTicks?(k=h.maxValue-h.minValue,S=$?k/$:0,U=($i.mod(h.majorTicks[0],$)||0)*H):S=$*(h.majorTicks.length-1),p.lineWidth=Oi.pixelRatio,p.strokeStyle=h.colorMinorTicks||h.colorStrokeTicks,p.save();for(var Y=0;Y<S;++Y)(P=h.startAngle+U+Y*(h.ticksAngle/S))<=h.ticksAngle+h.startAngle&&(p.rotate(we.radians(P)),p.beginPath(),p.moveTo(0,v),p.lineTo(0,v-.075*p.max),Ue(p));p.restore()}function ve(p,h){var v=p.max/100;return ie(p,h)-5*v-(h.barWidth?2*(parseFloat(h.barStrokeWidth)||0)+((parseFloat(h.barWidth)||0)+5)*v:0)}function le(p,h){we.prepareTicks(h);var v=Ri(ve(p,h)),S=void 0,k=h.majorTicks.length,P=Oi.pixelRatio;p.lineWidth=2*P,S=h.colorMajorTicks instanceof Array?h.colorMajorTicks:new Array(k).fill(h.colorStrokeTicks||h.colorMajorTicks);for(var U=0;U<k;++U)p.save(),p.strokeStyle=S[U],p.rotate(we.radians(ge(h,h.exactTicks?h.majorTicks[U]:U,k))),p.beginPath(),p.moveTo(0,v),p.lineTo(0,v-.15*p.max),p.stroke(),p.closePath(),p.restore();h.strokeTicks&&(p.save(),p.strokeStyle=h.colorStrokeTicks||S[0],p.rotate(gl),p.beginPath(),p.arc(0,0,v,we.radians(h.startAngle),we.radians(h.startAngle+h.ticksAngle),!1),p.stroke(),p.closePath(),p.restore())}function ge(p,h,v){if(p.exactTicks){var S=p.ticksAngle/(p.maxValue-p.minValue);return p.startAngle+S*(h-p.minValue)}return p.startAngle+h*(p.ticksAngle/(v-1))}function Ue(p){p.stroke(),p.restore(),p.closePath(),p.save()}function ot(p,h){var v=ve(p,h)-.15*p.max,S={},k=0,P=h.majorTicks.length,U=h.animationTarget!=="needle",$=h.colorNumbers instanceof Array?h.colorNumbers:new Array(P).fill(h.colorNumbers),H=U?-(h.value-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle:0;for(U&&(p.save(),p.rotate(-we.radians(H))),p.font=we.font(h,"Numbers",p.max/200),p.lineWidth=0,p.textAlign="center",p.textBaseline="middle";k<P;++k){var Y=H+ge(h,h.exactTicks?h.majorTicks[k]:k,P),ce=p.measureText(h.majorTicks[k]).width,me=h.fontNumbersSize,Ee=Math.sqrt(ce*ce+me*me)/2,De=we.radialPoint(v-Ee-h.numbersMargin/100*p.max,we.radians(Y));Y===360&&(Y=0),S[Y]||(S[Y]=!0,p.fillStyle=$[k],p.fillText(h.majorTicks[k],De.x,De.y))}U&&p.restore()}function Mt(p,h){h.title&&(p.save(),p.font=we.font(h,"Title",p.max/200),p.fillStyle=h.colorTitle,p.textAlign="center",p.fillText(h.title,0,-p.max/4.25,.8*p.max),p.restore())}function Yt(p,h){h.units&&(p.save(),p.font=we.font(h,"Units",p.max/200),p.fillStyle=h.colorUnits,p.textAlign="center",p.fillText(we.formatContext(h,h.units),0,p.max/3.25,.8*p.max),p.restore())}function mi(p,h){if(h.needle){var v=h.animationTarget!=="needle",S=h.ticksAngle<360?we.normalizedValue(h).indented:h.value,k=v?h.startAngle:h.startAngle+(S-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle;h.barStartPosition==="right"&&(k=h.startAngle+h.ticksAngle-(S-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle);var P=ie(p,h),U=Ri(P/100*h.needleCircleSize),$=Ri(P/100*h.needleCircleSize*.75),H=Ri(P/100*h.needleEnd),Y=Ri(h.needleStart?P/100*h.needleStart:0),ce=P/100*h.needleWidth,me=P/100*h.needleWidth/2,Ee=Oi.pixelRatio;p.save(),we.drawNeedleShadow(p,h),p.rotate(we.radians(k)),p.fillStyle=we.linearGradient(p,h.colorNeedle,h.colorNeedleEnd,H-Y),h.needleType==="arrow"?(p.beginPath(),p.moveTo(-me,-Y),p.lineTo(-ce,0),p.lineTo(-1*Ee,H),p.lineTo(Ee,H),p.lineTo(ce,0),p.lineTo(me,-Y),p.closePath(),p.fill(),p.beginPath(),p.lineTo(-.5*Ee,H),p.lineTo(-1*Ee,H),p.lineTo(-ce,0),p.lineTo(-me,-Y),p.lineTo(me/2*Ee-2*Ee,-Y),p.closePath(),p.fillStyle=h.colorNeedleShadowUp,p.fill()):(p.beginPath(),p.moveTo(-me,H),p.lineTo(-me,Y),p.lineTo(me,Y),p.lineTo(me,H),p.closePath(),p.fill()),p.restore(),h.needleCircleSize&&(p.save(),we.drawNeedleShadow(p,h),h.needleCircleOuter&&(p.beginPath(),p.arc(0,0,U,0,2*Po,!0),p.fillStyle=we.linearGradient(p,h.colorNeedleCircleOuter,h.colorNeedleCircleOuterEnd,U),p.fill(),p.closePath()),h.needleCircleInner&&(p.beginPath(),p.arc(0,0,$,0,2*Po,!0),p.fillStyle=we.linearGradient(p,h.colorNeedleCircleInner,h.colorNeedleCircleInnerEnd,$),p.fill(),p.closePath()),p.restore())}}function ra(p,h,v){we.drawValueBox(p,h,v,0,p.max-.33*p.max,p.max)}function Ra(p){var h=p.startAngle,v=p.startAngle+p.ticksAngle,S=h,k=h+(we.normalizedValue(p).normal-p.minValue)/(p.maxValue-p.minValue)*p.ticksAngle;if(p.barStartPosition==="middle"){var P=.5*(p.minValue+p.maxValue);p.value<P?(S=180-(P-we.normalizedValue(p).normal)/(p.maxValue-p.minValue)*p.ticksAngle,k=180):(S=180,k=180+(we.normalizedValue(p).normal-P)/(p.maxValue-p.minValue)*p.ticksAngle)}else p.barStartPosition==="right"&&(S=v-k+h,k=v);return{startAngle:S,endAngle:k}}function sa(p,h){var v=p.max/100,S=ie(p,h)-5*v,k=parseFloat(h.barStrokeWidth+"")||0,P=(parseFloat(h.barWidth+"")||0)*v,U=S-2*k-P,$=(S-U)/2,H=U+$,Y=k/H,ce=h.startAngle,me=h.startAngle+h.ticksAngle;if(p.save(),p.rotate(gl),k&&(p.beginPath(),p.arc(0,0,H,we.radians(ce)-Y,we.radians(me)+Y,!1),p.strokeStyle=h.colorBarStroke,p.lineWidth=2*$,p.stroke(),p.closePath()),P&&(p.beginPath(),p.arc(0,0,H,we.radians(ce),we.radians(me),!1),p.strokeStyle=h.colorBar,p.lineWidth=P,p.stroke(),p.closePath(),h.barShadow&&(p.save(),p.beginPath(),p.arc(0,0,S,we.radians(ce),we.radians(me),!1),p.clip(),p.beginPath(),p.strokeStyle=h.colorBar,p.lineWidth=1,p.shadowBlur=h.barShadow,p.shadowColor=h.colorBarShadow,p.shadowOffsetX=0,p.shadowOffsetY=0,p.arc(0,0,S,we.radians(h.startAngle),we.radians(h.startAngle+h.ticksAngle),!1),p.stroke(),p.closePath(),p.restore()),h.barProgress)){var Ee=Ra(h),De=Ee.startAngle,Oe=Ee.endAngle;p.beginPath(),p.arc(0,0,H,we.radians(De),we.radians(Oe),!1),p.strokeStyle=h.colorBarProgress,p.lineWidth=P,p.stroke(),p.closePath()}p.restore()}function La(p){return p.options.animatedValue?p.options.value:p.value}function wo(p,h,v,S,k,P,U,$){p.beginPath(),p.fillStyle=$?we.linearGradient(p,U,$,k>P?k:P,P>k,k>P?v:S):U,h>0?we.roundRect(p,v,S,k,P,h):p.rect(v,S,k,P),p.fill(),p.closePath()}function Ni(p,h,v,S,k,P,U,$,H){p.beginPath(),p.lineWidth=h,p.strokeStyle=H?we.linearGradient(p,$,H,U,!0,k):$,v>0?we.roundRect(p,S,k,P,U,v):p.rect(S,k,P,U),p.stroke(),p.closePath()}function _o(p,h,v,S,k,P){function U(qe,tt,ht,Kt){return qe&&(!Kt&&h.borderShadowWidth&&(p.save(),p.shadowBlur=h.borderShadowWidth,p.shadowColor=h.colorBorderShadow),Ni(p,qe*$,H,v+qe*$/2-Pe,S+qe*$/2-Pe,Y,De,tt,ht),Pe+=.5*$,!Kt&&h.borderShadowWidth&&(Kt=!0,p.restore())),Kt}var $=Oi.pixelRatio,H=h.borderRadius*$,Y=k-h.borderShadowWidth-h.borderOuterWidth*$,ce=Y-h.borderOuterWidth*$-h.borderMiddleWidth*$,me=ce-h.borderMiddleWidth*$-h.borderInnerWidth*$,Ee=me-h.borderInnerWidth*$,De=P-h.borderShadowWidth-h.borderOuterWidth*$,Oe=De-h.borderOuterWidth*$-h.borderMiddleWidth*$,Xe=Oe-h.borderMiddleWidth*$-h.borderInnerWidth*$,Ie=Xe-h.borderInnerWidth*$,je=v-(ce-Y)/2,Ye=je-(me-ce)/2,Je=Ye-(Ee-me)/2,ze=S-(Oe-De)/2,He=ze-(Xe-Oe)/2,Fe=He-(Ie-Xe)/2,Pe=0,Re=!1;return p.save(),Re=U(h.borderOuterWidth,h.colorBorderOuter,h.colorBorderOuterEnd,Re),Re=U(h.borderMiddleWidth,h.colorBorderMiddle,h.colorBorderMiddleEnd,Re),Re=U(h.borderInnerWidth,h.colorBorderInner,h.colorBorderInnerEnd,Re),!Re&&h.borderShadowWidth&&(p.shadowBlur=h.borderShadowWidth,p.shadowColor=h.colorBorderShadow),wo(p,H,Je,Fe,Ee+2*Pe,Ie+2*Pe,h.colorPlate,h.colorPlateEnd),p.restore(),[Je,Fe,Ee,Ie]}function Mo(p,h,v,S,k,P){var U=Oi.pixelRatio,$=P>=k,H=$?.85*k:P,Y=$?P:k;v=$?We(v+(k-H)/2):v;var ce=!!h.title,me=!!h.units,Ee=!!h.valueBox,De=void 0,Oe=void 0,Xe=void 0;$?(Oe=We(.05*Y),De=We(.075*Y),Xe=We(.11*Y),ce&&(Y-=De,S+=De),me&&(Y-=Oe),Ee&&(Y-=Xe)):(Oe=De=We(.15*H),ce&&(H-=De,S+=De),me&&(H-=Oe));var Ie=2*h.barStrokeWidth,je=h.barBeginCircle?We(H*h.barBeginCircle/200-Ie/2):0,Ye=We(H*h.barWidth/100-Ie),Je=We(Y*h.barLength/100-Ie),ze=We((Y-Je)/2),He=We(v+($?H/2:ze+je)),Fe=We(S+($?Y-ze-je+Ie/2:H/2)),Pe=!$||h.hasLeft&&h.hasRight?0:(h.hasRight?-1:1)*h.ticksWidth/100*H,Re=$||h.hasLeft&&h.hasRight?0:(h.hasRight?-1:1)*h.ticksWidth/100*H;return p.barDimensions={isVertical:$,width:H,length:Y,barWidth:Ye,barLength:Je,strokeWidth:Ie,barMargin:ze,radius:je,pixelRatio:U,barOffset:null,titleMargin:ce?De:0,unitsMargin:me?Oe:0,get ticksLength(){return this.barLength-this.barOffset-this.strokeWidth},X:v+Pe,Y:S+Re,x0:He+Pe,y0:Fe+Re,baseX:v,baseY:S,ticksPadding:h.ticksPadding/100},p.barDimensions}function Va(p,h,v,S,k,P,U){var $=Mo(p,h,S,k,P,U),H=$.isVertical,Y=$.width,ce=$.barWidth,me=$.barLength,Ee=$.strokeWidth,De=$.barMargin,Oe=$.radius,Xe=$.x0,Ie=$.y0,je=$.X,Ye=$.Y,Je=me;p.save(),p.beginPath();var ze=null;if(h.barBeginCircle){var He=we.radians(H?270:0),Fe=Math.asin(ce/2/Oe),Pe=Math.cos(Fe),Re=Math.sin(Fe),qe=Xe+(H?Oe*Re:Oe*Pe-Ee/2),tt=H?Ie-Oe*Pe:Ie+Oe*Re,ht=Ri(H?tt-Ie:qe-Xe);ze=We(ht+Oe);var Kt=H?We(Xe-Oe*Re):qe,fi=H?tt:We(Ie-Oe*Re);v==="progress"&&(me=ze+(me-ze)*(we.normalizedValue(h).normal-h.minValue)/(h.maxValue-h.minValue));var Io=We(qe+me-ze+Ee/2),da=We(tt-me+ze-Ee/2);p.arc(Xe,Ie,Oe,He+Fe,He-Fe),H?(p.moveTo(qe,fi),p.lineTo(qe,da),p.lineTo(Kt,da),p.lineTo(Kt,fi)):(p.moveTo(qe,fi),p.lineTo(Io,fi),p.lineTo(Io,tt),p.lineTo(qe,tt))}else{var qd=We(H?je+(Y-ce)/2:je+De),$d=We(H?Ye+me+De:Ye+(Y-ce)/2);v==="progress"&&(me*=(h.value-h.minValue)/(h.maxValue-h.minValue)),H?p.rect(qd,$d,ce,-me):p.rect(qd,$d,me,ce)}v!=="progress"&&h.barStrokeWidth&&(p.lineWidth=Ee,p.strokeStyle=h.colorBarStroke,p.stroke()),v!=="progress"&&h.colorBar?(p.fillStyle=h.colorBarEnd?we.linearGradient(p,h.colorBar,h.colorBarEnd,me,H,H?Ye:je):h.colorBar,p.fill()):v==="progress"&&h.colorBarProgress&&(p.fillStyle=h.colorBarProgressEnd?we.linearGradient(p,h.colorBarProgress,h.colorBarProgressEnd,Je,H,H?Ye:je):h.colorBarProgress,p.fill()),p.closePath(),p.restore(),h.barBeginCircle&&(p.barDimensions.radius+=Ee),p.barDimensions.barOffset=ze,p.barDimensions.barWidth+=Ee,p.barDimensions.barLength+=Ee}function ko(p,h,v,S,k,P){Va(p,h,"",v,S,k,P)}function To(p,h){return h.needleSide!==p||h.tickSide!==p||h.numberSide!==p}function gr(p,h,v,S,k,P){h.barProgress&&Va(p,h,"progress",v,S,k,P)}function _g(p,h){var v=p.barDimensions,S=v.isVertical,k=v.width,P=v.length,U=v.barWidth,$=v.barOffset,H=v.barMargin,Y=v.X,ce=v.Y,me=v.ticksLength,Ee=v.ticksPadding,De=k*(parseFloat(h.highlightsWidth)||0)/100;if(h.highlights&&De){var Oe=h.tickSide!=="right",Xe=h.tickSide!=="left",Ie=0,je=h.highlights.length,Ye=(k-U)/2,Je=h.maxValue-h.minValue,ze=We(S?Y+Ye:Y+H+$),He=De,Fe=S?ce+P-H-$:ce+Ye,Pe=We((h.ticksWidth/100+Ee)*k)+(De-h.ticksWidth/100*k),Re=We(U+Ee*k);for(p.save();Ie<je;Ie++){var qe=h.highlights[Ie],tt=me*Ri(h.minValue-qe.from)/Je,ht=me*Ri((qe.to-qe.from)/Je);p.beginPath(),p.fillStyle=qe.color,S?(Oe&&p.rect(ze-Pe,Fe-tt,He,-ht),Xe&&p.rect(ze+Re,Fe-tt,He,-ht)):(Oe&&p.rect(ze+tt,Fe-Pe,ht,He),Xe&&p.rect(ze+tt,Fe+Re,ht,He)),p.fill(),p.closePath()}p.restore()}}function vr(p,h,v,S,k){p.beginPath(),p.moveTo(h,v),p.lineTo(S,k),p.stroke(),p.closePath()}function Fd(p,h,v,S,k,P,U,$,H){var Y=p.barDimensions,ce=Y.isVertical,me=Y.length,Ee=Y.barWidth,De=Y.barOffset,Oe=Y.barMargin,Xe=Y.pixelRatio,Ie=Y.width,je=Y.X,Ye=Y.Y,Je=Y.ticksLength,ze=Y.ticksPadding,He=(Ie-Ee)/2,Fe=void 0,Pe=void 0,Re=0,qe=v.length,tt=void 0,ht=H*Ie,Kt=He-ze*Ie,fi=He+Ee+ht+ze*Ie,Io=h instanceof Array?h:new Array(v.length).fill(h);p.save(),p.lineWidth=$*Xe;for(var da=Je/(k-S);Re<qe;Re++)tt=v[Re],p.strokeStyle=Io[Re],ce?(Pe=Ye+me-Oe-De+(S-tt)*da,P&&(Fe=je+Kt,vr(p,Fe,Pe,We(Fe-ht),Pe)),U&&(Fe=je+fi,vr(p,Fe,Pe,We(Fe-ht),Pe))):(Fe=je+Oe+De-(S-tt)*da,P&&(Pe=Ye+Kt,vr(p,Fe,Pe,Fe,We(Pe-ht))),U&&(Pe=Ye+fi,vr(p,Fe,We(Pe),Fe,Pe-ht)));p.restore()}function Mg(p,h){var v=we.prepareTicks(h),S=Bd(v,2),k=S[0],P=S[1],U=2,$=(h.maxValue-h.minValue)/(h.majorTicks.length-1),H=h.colorMajorTicks instanceof Array?h.colorMajorTicks:new Array(h.majorTicks.length).fill(h.colorStrokeTicks||h.colorMajorTicks);if(Fd(p,H,h.exactTicks?h.majorTicks:h.majorTicks.map(function(ht,Kt){return h.minValue+$*Kt}),h.minValue,h.maxValue,k,P,U,h.ticksWidth/100),h.strokeTicks){var Y=p.barDimensions,ce=Y.isVertical,me=Y.length,Ee=Y.width,De=Y.barWidth,Oe=Y.barMargin,Xe=Y.barOffset,Ie=Y.X,je=Y.Y,Ye=Y.ticksLength,Je=Y.pixelRatio,ze=Y.ticksPadding,He=(Ee-De)/2+De+ze*Ee,Fe=(Ee-De)/2-ze*Ee,Pe=void 0,Re=void 0,qe=void 0,tt=void 0;p.strokeStyle=h.colorStrokeTicks||H[0],U*=Je,ce?(Re=je+me-Oe-Xe+U/2,tt=Re-Ye-U,k&&(qe=Pe=We(Ie+Fe),br(p,Pe,Re,qe,tt)),P&&(qe=Pe=We(Ie+He),br(p,Pe,Re,qe,tt))):(Pe=Ie+Oe+Xe-U/2,qe=Pe+Ye+U,k&&(tt=Re=We(je+Fe),br(p,Pe,Re,qe,tt)),P&&(tt=Re=We(je+He),br(p,Pe,Re,qe,tt)))}}function br(p,h,v,S,k){p.beginPath(),p.moveTo(h,v),p.lineTo(S,k),p.stroke(),p.closePath()}function kg(p,h){var v=we.prepareTicks(h),S=Bd(v,2),k=S[0],P=S[1],U=[],$=h.minValue,H=Math.abs(h.minorTicks)||0,Y=H?(h.maxValue-h.minValue)/(H*(h.majorTicks.length-1)):0;if(H)if(h.exactTicks)for(var ce=$i.mod(h.majorTicks[0],H)||0;$<h.maxValue;$+=H)ce+$<h.maxValue&&U.push(ce+$);else for(;$<h.maxValue;$+=Y)U.push($);Fd(p,h.colorMinorTicks||h.colorStrokeTicks,U,h.minValue,h.maxValue,k,P,1,h.ticksWidthMinor/100)}function Tg(p,h){var v=p.barDimensions,S=v.isVertical,k=v.length,P=v.width,U=v.barWidth,$=v.barMargin,H=v.barOffset,Y=v.X,ce=v.Y,me=v.ticksLength,Ee=v.ticksPadding,De=h.maxValue-h.minValue,Oe=De/(h.majorTicks.length-1),Xe=h.exactTicks?h.majorTicks:h.majorTicks.map(function(Io,da){return h.minValue+Oe*da}),Ie=Xe.length,je=h.numberSide!=="right",Ye=h.numberSide!=="left",Je=h.fontNumbersSize*P/200,ze=0,He=(h.ticksWidth/100+2*Ee)*P,Fe=(P-U)/2-He,Pe=(P-U)/2+U+He,Re=void 0,qe=void 0,tt=void 0,ht=void 0,Kt=h.colorNumbers instanceof Array?h.colorNumbers:new Array(Ie).fill(h.colorNumbers),fi=h.numbersMargin/100*P;for(p.font=we.font(h,"Numbers",P/200),p.lineWidth=0,p.textAlign="center";ze<Ie;ze++)p.fillStyle=Kt[ze],ht=h.majorTicks[ze],tt=h.exactTicks?me*((Xe[ze]-h.minValue)/De):ze*me/(Ie-1),S?(qe=ce+k-$-H-tt+Je/3,je&&(p.textAlign="right",p.fillText(ht,Y+Fe-fi,qe)),Ye&&(p.textAlign="left",p.fillText(ht,Y+Pe+fi,qe))):(p.measureText(ht).width,Re=Y+$+H+tt,je&&p.fillText(ht,Re,ce+Fe-fi),Ye&&p.fillText(ht,Re,ce+Pe+Je+fi))}function Eg(p,h){if(h.title){var v=p.barDimensions,S=v.isVertical,k=v.width,P=v.length,U=v.baseX,$=v.baseY,H=v.titleMargin,Y=h.fontTitleSize*k/200,ce=We(U+(S?k:P)/2),me=We($+H/2-(S?Y:Y/2)-.025*(S?P:k));p.save(),p.textAlign="center",p.fillStyle=h.colorTitle,p.font=we.font(h,"Title",k/200),p.lineWidth=0,p.fillText(h.title,ce,me,S?k:P),p.restore()}}function Dg(p,h){if(h.units){var v=p.barDimensions,S=v.isVertical,k=v.width,P=v.length,U=v.baseX,$=v.baseY,H=v.unitsMargin,Y=h.fontUnitsSize*k/200,ce=We(U+(S?k:P)/2),me=We($+(S?P:k)+H/2-Y/2);p.save(),p.textAlign="center",p.fillStyle=h.colorUnits,p.font=we.font(h,"Units",k/200),p.lineWidth=0,p.fillText(we.formatContext(h,h.units),ce,me,S?k:P),p.restore()}}function Pg(p,h){if(h.needle){var v=p.barDimensions,S=v.isVertical,k=v.width,P=v.length,U=v.barWidth,$=v.barOffset,H=v.barMargin,Y=v.ticksLength,ce=v.X,me=v.Y,Ee=v.ticksPadding,De=h.needleSide!=="right",Oe=h.needleSide!=="left",Xe=Y*(we.normalizedValue(h).indented-h.minValue)/(h.maxValue-h.minValue),Ie=(h.ticksWidth/100+Ee)*k,je=U/2+Ie,Ye=je*(h.needleEnd/100),Je=void 0,ze=void 0,He=void 0,Fe=void 0,Pe=h.needleType.toLowerCase()==="arrow"?Ng:Ig,Re=(k-U)/2,qe=je*(h.needleStart/100),tt=Re-Ie-qe,ht=Re+U+Ie+qe;p.save(),we.drawNeedleShadow(p,h),S?(He=We(me+P-H-$-Xe),De&&(Je=We(ce+tt),ze=Je+Ye,Pe(p,h,Je,He,ze,He,Ye)),Oe&&(Je=We(ce+ht),ze=Je-Ye,Pe(p,h,Je,He,ze,He,Ye,!0))):(Je=We(ce+H+$+Xe),De&&(He=We(me+tt),Fe=He+Ye,Pe(p,h,Je,He,Je,Fe,Ye)),Oe&&(He=We(me+ht),Fe=He-Ye,Pe(p,h,Je,He,Je,Fe,Ye,!0))),p.restore()}}function Gd(p,h,v,S){return h.colorNeedleEnd?we.linearGradient(p,S?h.colorNeedleEnd:h.colorNeedle,S?h.colorNeedle:h.colorNeedleEnd,v,!p.barDimensions.isVertical):h.colorNeedle}function Ig(p,h,v,S,k,P,U,$){p.lineWidth=h.needleWidth,p.strokeStyle=Gd(p,h,U,$),p.beginPath(),p.moveTo(v,S),p.lineTo(k,P),p.stroke(),p.closePath()}function Ng(p,h,v,S,k,P,U,$){var H=We(.4*U),Y=U-H,ce=v===k,me=h.needleWidth/2;p.fillStyle=Gd(p,h,U,$),p.beginPath(),ce?(S>P&&(Y*=-1),p.moveTo(v-me,S),p.lineTo(v+me,S),p.lineTo(v+me,S+Y),p.lineTo(v,P),p.lineTo(v-me,S+Y),p.lineTo(v-me,S)):(v>k&&(Y*=-1),p.moveTo(v,S-me),p.lineTo(v,S+me),p.lineTo(v+Y,S+me),p.lineTo(k,S),p.lineTo(v+Y,S-me),p.lineTo(v,S-me)),p.fill(),p.closePath()}function Og(p,h,v,S,k,P,U){var $=(parseFloat(h.fontValueSize)||0)*P/200,H=(.11*U-$)/2;p.barDimensions.isVertical&&we.drawValueBox(p,h,v,S+P/2,k+U-$-H,P)}var Bd=(function(){function p(h,v){var S=[],k=!0,P=!1,U=void 0;try{for(var $,H=h[Symbol.iterator]();!(k=($=H.next()).done)&&(S.push($.value),!v||S.length!==v);k=!0);}catch(Y){P=!0,U=Y}finally{try{!k&&H.return&&H.return()}finally{if(P)throw U}}return S}return function(h,v){if(Array.isArray(h))return h;if(Symbol.iterator in Object(h))return p(h,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),ml=function p(h,v,S){h===null&&(h=Function.prototype);var k=Object.getOwnPropertyDescriptor(h,v);if(k===void 0){var P=Object.getPrototypeOf(h);return P===null?void 0:p(P,v,S)}if("value"in k)return k.value;var U=k.get;if(U!==void 0)return U.call(S)},Rg=function p(h,v,S,k){var P=Object.getOwnPropertyDescriptor(h,v);if(P===void 0){var U=Object.getPrototypeOf(h);U!==null&&p(U,v,S,k)}else if("value"in P&&P.writable)P.value=S;else{var $=P.set;$!==void 0&&$.call(k,S)}return S},la=(function(){function p(h,v){for(var S=0;S<v.length;S++){var k=v[S];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(h,k.key,k)}}return function(h,v,S){return v&&p(h.prototype,v),S&&p(h,S),h}})(),Ar=null,Lg=(function(){function p(){i(this,p),this._events={},this.addListener=this.on,this.removeListener=this.off}return la(p,[{key:"emit",value:function(h){if(this._events[h]){for(var v=0,S=this._events[h].length,k=arguments.length,P=Array(k>1?k-1:0),U=1;U<k;U++)P[U-1]=arguments[U];for(;v<S;v++)this._events[h][v]&&this._events[h][v].apply(this,P)}}},{key:"once",value:function(h){for(var v=arguments.length,S=Array(v>1?v-1:0),k=1;k<v;k++)S[k-1]=arguments[k];for(var P=0,U=S.length,$=this;P<U;P++)(function(){var H=S[P],Y=function ce(){$.off(h,ce),H.apply($,arguments)};S[P]=Y})();this.on.apply(this,[h].concat(S))}},{key:"on",value:function(h){this._events[h]||(this._events[h]=[]);for(var v=0,S=arguments.length<=1?0:arguments.length-1;v<S;v++)this._events[h].push(arguments.length<=v+1?void 0:arguments[v+1])}},{key:"off",value:function(h){if(this._events[h])for(var v=0,S=arguments.length<=1?0:arguments.length-1;v<S;v++)for(var k=arguments.length<=v+1?void 0:arguments[v+1],P=void 0;~(P=this._events[h].indexOf(k));)this._events[h].splice(P,1)}},{key:"removeAllListeners",value:function(h){delete this._events[h]}},{key:"listeners",get:function(){return this._events}}]),p})(),Ud=a("requestAnimationFrame")||function(p){return setTimeout(function(){return p(new Date().getTime())},1e3/60)},Eo={linear:function(p){return p},quad:function(p){return Math.pow(p,2)},dequad:function(p){return 1-Eo.quad(1-p)},quint:function(p){return Math.pow(p,5)},dequint:function(p){return 1-Math.pow(1-p,5)},cycle:function(p){return 1-Math.sin(Math.acos(p))},decycle:function(p){return Math.sin(Math.acos(1-p))},bounce:function(p){return 1-Eo.debounce(1-p)},debounce:function(p){for(var h=0,v=1;;h+=v,v/=2)if(p>=(7-4*h)/11)return-Math.pow((11-6*h-11*p)/4,2)+Math.pow(v,2)},elastic:function(p){return 1-Eo.delastic(1-p)},delastic:function(p){return Math.pow(2,10*(p-1))*Math.cos(20*Math.PI*1.5/3*p)}},hl=(function(){function p(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"linear",v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:250,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},k=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){};if(i(this,p),this.duration=v,this.rule=h,this.draw=S,this.end=k,typeof this.draw!="function")throw new TypeError("Invalid animation draw callback:",S);if(typeof this.end!="function")throw new TypeError("Invalid animation end callback:",k)}return la(p,[{key:"animate",value:function(h,v){var S=this;this.frame&&this.cancel();var k=window.performance&&window.performance.now?window.performance.now():a("animationStartTime")||Date.now();h=h||this.draw,v=v||this.end,this.draw=h,this.end=v,this.frame=Ud(function(P){return r(P,h,k,Eo[S.rule]||S.rule,S.duration,v,S)})}},{key:"cancel",value:function(){this.frame&&((a("cancelAnimationFrame")||function(h){})(this.frame),this.frame=null)}},{key:"destroy",value:function(){this.cancel(),this.draw=null,this.end=null}}]),p})();hl.rules=Eo;var Wa=(function(){function p(h,v,S){i(this,p),this.options=h,this.element=v.toLowerCase(),this.type=p.toDashed(S),this.Type=n[S],this.mutationsObserved=!1,this.isObservable=!!window.MutationObserver,window.GAUGES_NO_AUTO_INIT||p.domReady(this.traverse.bind(this))}return la(p,[{key:"isValidNode",value:function(h){return!(!h.tagName||h.tagName.toLowerCase()!==this.element||h.getAttribute("data-type")!==this.type)}},{key:"traverse",value:function(){for(var h=document.getElementsByTagName(this.element),v=0,S=h.length;v<S;v++)this.process(h[v]);this.isObservable&&!this.mutationsObserved&&(new MutationObserver(this.observe.bind(this)).observe(document.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0,attributeOldValue:!0,characterDataOldValue:!0}),this.mutationsObserved=!0)}},{key:"observe",value:function(h){for(var v=0,S=h.length;v<S;v++){var k=h[v];if(k.type==="attributes"&&k.attributeName==="data-type"&&this.isValidNode(k.target)&&k.oldValue!==this.type)setTimeout(this.process.bind(this,k.target));else if(k.addedNodes&&k.addedNodes.length)for(var P=0,U=k.addedNodes.length;P<U;P++)setTimeout(this.process.bind(this,k.addedNodes[P]))}}},{key:"process",value:function(h){var v=this;if(!this.isValidNode(h))return null;var S=void 0,k=JSON.parse(JSON.stringify(this.options)),P=null;for(S in k)if(k.hasOwnProperty(S)){var U=p.toAttributeName(S),$=p.parse(h.getAttribute(U));$!=null&&(k[S]=$)}return k.renderTo=h,P=new this.Type(k),P.draw&&P.draw(),this.isObservable&&(P.observer=new MutationObserver(function(H){H.forEach(function(Y){if(Y.type==="attributes"){var ce=Y.attributeName.toLowerCase(),me=h.getAttribute(ce).toLowerCase();if(ce==="data-type"&&me&&me!==v.type)P.observer.disconnect(),delete P.observer,P.destroy&&P.destroy();else if(ce.substr(0,5)==="data-"){var Ee=ce.substr(5).split("-").map(function(Oe,Xe){return Xe?Oe.charAt(0).toUpperCase()+Oe.substr(1):Oe}).join(""),De={};De[Ee]=p.parse(h.getAttribute(Y.attributeName)),Ee==="value"?P&&(P.value=De[Ee]):P.update&&P.update(De)}}})}),P.observer.observe(h,{attributes:!0})),P}}],[{key:"parse",value:function(h){if(h==="true")return!0;if(h==="false")return!1;if(h!=="undefined"){if(h==="null")return null;if(/^[-+#.\w\d\s]+(?:,[-+#.\w\d\s]*)+$/.test(h))return h.split(",");try{return JSON.parse(h)}catch(v){}return h}}},{key:"toDashed",value:function(h){for(var v=h.split(/(?=[A-Z])/),S=1,k=v.length,P=v[0].toLowerCase();S<k;S++)P+="-"+v[S].toLowerCase();return P}},{key:"toCamelCase",value:function(h){for(var v=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=h.split(/-/),k=0,P=S.length,U="";k<P;k++)U+=k||v?S[k][0].toUpperCase()+S[k].substr(1).toLowerCase():S[k].toLowerCase();return U}},{key:"toAttributeName",value:function(h){return"data-"+p.toDashed(h)}},{key:"domReady",value:function(h){if(/comp|inter|loaded/.test((window.document||{}).readyState+""))return h();window.addEventListener?window.addEventListener("DOMContentLoaded",h,!1):window.attachEvent&&window.attachEvent("onload",h)}}]),p})(),Oi=(function(){function p(h,v,S){i(this,p),p.collection.push(this),this.width=v||0,this.height=S||0,this.element=h,this.init()}return la(p,[{key:"init",value:function(){var h=p.pixelRatio;this.element.width=this.width*h,this.element.height=this.height*h,this.element.style.width=this.width+"px",this.element.style.height=this.height+"px",this.elementClone=this.element.cloneNode(!0),this.context=this.element.getContext("2d"),this.contextClone=this.elementClone.getContext("2d"),this.drawWidth=this.element.width,this.drawHeight=this.element.height,this.drawX=this.drawWidth/2,this.drawY=this.drawHeight/2,this.minSide=this.drawX<this.drawY?this.drawX:this.drawY,this.contextClone.translate(this.drawX,this.drawY),this.elementClone.initialized=!1,this.context.translate(this.drawX,this.drawY),this.context.max=this.contextClone.max=this.minSide,this.context.maxRadius=this.contextClone.maxRadius=null}},{key:"destroy",value:function(){var h=p.collection.indexOf(this);~h&&p.collection.splice(h,1),this.context.clearRect(-this.drawX,-this.drawY,this.drawWidth,this.drawHeight),this.context.max=null,delete this.context.max,this.context.maxRadius=null,delete this.context.maxRadius,this.context=null,this.contextClone=null,this.elementClone=null,this.element=null,this.onRedraw=null}},{key:"commit",value:function(){var h=p.pixelRatio;return h!==1&&this.contextClone.scale(h,h),this}},{key:"redraw",value:function(){return this.init(),this.onRedraw&&this.onRedraw(),this}}],[{key:"redraw",value:function(){for(var h=0,v=p.collection.length;h<v;h++)p.collection[h].redraw()}},{key:"pixelRatio",get:function(){return window.devicePixelRatio||1}}]),p})();Oi.collection=[],window.matchMedia&&window.matchMedia("screen and (min-resolution: 2dppx)").addListener(Oi.redraw);var pl={renderTo:null,width:0,height:0,minValue:0,maxValue:100,value:0,units:!1,exactTicks:!1,majorTicks:[0,20,40,60,80,100],minorTicks:10,strokeTicks:!0,animatedValue:!1,animateOnInit:!1,title:!1,borders:!0,numbersMargin:1,listeners:null,valueInt:3,valueDec:2,majorTicksInt:1,majorTicksDec:0,animation:!0,animationDuration:500,animationRule:"cycle",colorPlate:"#fff",colorPlateEnd:"",colorMajorTicks:"#444",colorMinorTicks:"#666",colorStrokeTicks:"",colorTitle:"#888",colorUnits:"#888",colorNumbers:"#444",colorNeedle:"rgba(240,128,128,1)",colorNeedleEnd:"rgba(255,160,122,.9)",colorValueText:"#444",colorValueTextShadow:"rgba(0,0,0,0.3)",colorBorderShadow:"rgba(0,0,0,0.5)",colorBorderOuter:"#ddd",colorBorderOuterEnd:"#aaa",colorBorderMiddle:"#eee",colorBorderMiddleEnd:"#f0f0f0",colorBorderInner:"#fafafa",colorBorderInnerEnd:"#ccc",colorValueBoxRect:"#888",colorValueBoxRectEnd:"#666",colorValueBoxBackground:"#babab2",colorValueBoxShadow:"rgba(0,0,0,1)",colorNeedleShadowUp:"rgba(2,255,255,0.2)",colorNeedleShadowDown:"rgba(188,143,143,0.45)",colorBarStroke:"#222",colorBar:"#ccc",colorBarProgress:"#888",colorBarShadow:"#000",fontNumbers:"Arial",fontTitle:"Arial",fontUnits:"Arial",fontValue:"Arial",fontNumbersSize:20,fontTitleSize:24,fontUnitsSize:22,fontValueSize:26,fontNumbersStyle:"normal",fontTitleStyle:"normal",fontUnitsStyle:"normal",fontValueStyle:"normal",fontNumbersWeight:"normal",fontTitleWeight:"normal",fontUnitsWeight:"normal",fontValueWeight:"normal",needle:!0,needleShadow:!0,needleType:"arrow",needleStart:5,needleEnd:85,needleWidth:4,borderOuterWidth:3,borderMiddleWidth:3,borderInnerWidth:3,borderShadowWidth:3,valueBox:!0,valueBoxStroke:5,valueBoxWidth:0,valueText:"",valueTextShadow:!0,valueBoxBorderRadius:2.5,highlights:[{from:20,to:60,color:"#eee"},{from:60,to:80,color:"#ccc"},{from:80,to:100,color:"#999"}],highlightsWidth:15,highlightsLineCap:"butt",barWidth:20,barStrokeWidth:0,barProgress:!0,barShadow:0};s.prototype=Object.create(Array.prototype),s.prototype.constructor=s,s.prototype.get=function(p){if(typeof p=="string")for(var h=0,v=this.length;h<v;h++){var S=this[h].options.renderTo.tagName?this[h].options.renderTo:document.getElementById(this[h].options.renderTo||"");if(S.getAttribute("id")===p)return this[h]}else if(typeof p=="number")return this[p];return null};var fl="2.2.1",We=Math.round,Ri=Math.abs,Do=new s;Do.version=fl;var $i=(function(p){function h(v){i(this,h);var S=e(this,(h.__proto__||Object.getPrototypeOf(h)).call(this)),k=S.constructor.name;if(k==="BaseGauge")throw new TypeError("Attempt to instantiate abstract class!");if(Do.push(S),v.listeners&&Object.keys(v.listeners).forEach(function(U){(v.listeners[U]instanceof Array?v.listeners[U]:[v.listeners[U]]).forEach(function($){S.on(U,$)})}),S.version=fl,S.type=n[k]||h,S.initialized=!1,v.minValue=parseFloat(v.minValue),v.maxValue=parseFloat(v.maxValue),v.value=parseFloat(v.value)||0,v.borders||(v.borderInnerWidth=v.borderMiddleWidth=v.borderOuterWidth=0),!v.renderTo)throw TypeError("Canvas element was not specified when creating the Gauge object!");var P=v.renderTo.tagName?v.renderTo:document.getElementById(v.renderTo);if(!(P instanceof HTMLCanvasElement))throw TypeError("Given gauge canvas element is invalid!");return v.width=parseFloat(v.width)||0,v.height=parseFloat(v.height)||0,v.width&&v.height||(v.width||(v.width=P.parentNode?P.parentNode.offsetWidth:P.offsetWidth),v.height||(v.height=P.parentNode?P.parentNode.offsetHeight:P.offsetHeight)),S.options=v||{},S.options.animateOnInit&&(S._value=S.options.value,S.options.value=S.options.minValue),S.canvas=new Oi(P,v.width,v.height),S.canvas.onRedraw=S.draw.bind(S),S.animation=new hl(v.animationRule,v.animationDuration),S}return t(h,p),la(h,[{key:"update",value:function(v){return Object.assign(this.options,this.type.configure(v||{})),this.canvas.width=this.options.width,this.canvas.height=this.options.height,this.animation.rule=this.options.animationRule,this.animation.duration=this.options.animationDuration,this.canvas.redraw(),this}},{key:"destroy",value:function(){var v=Do.indexOf(this);~v&&Do.splice(v,1),this.canvas.destroy(),this.canvas=null,this.animation.destroy(),this.animation=null,this.emit("destroy")}},{key:"draw",value:function(){return this.options.animateOnInit&&!this.initialized&&(this.value=this._value,this.initialized=!0,this.emit("init")),this.emit("render"),this}},{key:"value",set:function(v){var S=this;v=h.ensureValue(v,this.options.minValue);var k=this.options.value;if(v!==k)if(this.options.animation){if(this.animation.frame&&(this.options.value=this._value,this._value===v))return this.animation.cancel(),void delete this._value;this._value===void 0&&(this._value=v),this.emit("animationStart"),this.animation.animate(function(P){var U=k+(v-k)*P;S.options.animatedValue&&S.emit("value",U,S.value),S.options.value=U,S.draw(),S.emit("animate",P,S.options.value)},function(){S._value!==void 0&&(S.emit("value",S._value,S.value),S.options.value=S._value,delete S._value),S.draw(),S.emit("animationEnd"),S.animation.frame=null})}else this.emit("value",v,this.value),this.options.value=v,this.draw()},get:function(){return this._value===void 0?this.options.value:this._value}}],[{key:"configure",value:function(v){return v}},{key:"initialize",value:function(v,S){return new Wa(S,"canvas",v)}},{key:"fromElement",value:function(v){var S=Wa.toCamelCase(v.getAttribute("data-type")),k=v.attributes,P=0,U=k.length,$={};if(S){for(/Gauge$/.test(S)||(S+="Gauge");P<U;P++)$[Wa.toCamelCase(k[P].name.replace(/^data-/,""),!1)]=Wa.parse(k[P].value);new Wa($,v.tagName,S).process(v)}}},{key:"ensureValue",value:function(v){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return v=parseFloat(v),!isNaN(v)&&isFinite(v)||(v=parseFloat(S)||0),v}},{key:"mod",value:function(v,S){return(v%S+S)%S}},{key:"version",get:function(){return fl}}]),h})(Lg);n!==void 0&&(n.BaseGauge=$i,n.gauges=(window.document||{}).gauges=Do);var Vg=/{([_a-zA-Z]+[_a-zA-Z0-9]*)}/g,we={roundRect:b,padValue:A,formatMajorTickNumber:C,radians:w,radialPoint:M,linearGradient:G,drawNeedleShadow:E,drawValueBox:j,verifyError:d,prepareTicks:f,font:F,normalizedValue:ye,formatContext:m},Po=Math.PI,gl=Po/2,zd=Object.assign({},pl,{ticksAngle:270,startAngle:45,colorNeedleCircleOuter:"#f0f0f0",colorNeedleCircleOuterEnd:"#ccc",colorNeedleCircleInner:"#e8e8e8",colorNeedleCircleInnerEnd:"#f5f5f5",needleCircleSize:10,needleCircleInner:!0,needleCircleOuter:!0,needleStart:20,animationTarget:"needle",useMinPath:!1,barWidth:0,barStartPosition:"left"}),Wg=(function(p){function h(v){return i(this,h),v=Object.assign({},zd,v||{}),e(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,h.configure(v)))}return t(h,p),la(h,[{key:"draw",value:function(){try{var v=this.canvas,S=[-v.drawX,-v.drawY,v.drawWidth,v.drawHeight],k=S[0],P=S[1],U=S[2],$=S[3],H=this.options;if(H.animationTarget==="needle"){if(!v.elementClone.initialized){var Y=v.contextClone;Y.clearRect(k,P,U,$),this.emit("beforePlate"),re(Y,H),this.emit("beforeHighlights"),de(Y,H),this.emit("beforeMinorTicks"),ee(Y,H),this.emit("beforeMajorTicks"),le(Y,H),this.emit("beforeNumbers"),ot(Y,H),this.emit("beforeTitle"),Mt(Y,H),this.emit("beforeUnits"),Yt(Y,H),v.elementClone.initialized=!0}this.canvas.commit(),v.context.clearRect(k,P,U,$),v.context.drawImage(v.elementClone,k,P,U,$),this.emit("beforeProgressBar"),sa(v.context,H),this.emit("beforeValueBox"),ra(v.context,H,La(this)),this.emit("beforeNeedle"),mi(v.context,H)}else{var ce=-we.radians((H.value-H.minValue)/(H.maxValue-H.minValue)*H.ticksAngle);if(v.context.clearRect(k,P,U,$),this.emit("beforePlate"),re(v.context,H),v.context.rotate(ce),this.emit("beforeHighlights"),de(v.context,H),this.emit("beforeMinorTicks"),ee(v.context,H),this.emit("beforeMajorTicks"),le(v.context,H),this.emit("beforeNumbers"),ot(v.context,H),this.emit("beforeProgressBar"),sa(v.context,H),v.context.rotate(-ce),!v.elementClone.initialized){var me=v.contextClone;me.clearRect(k,P,U,$),this.emit("beforeTitle"),Mt(me,H),this.emit("beforeUnits"),Yt(me,H),this.emit("beforeNeedle"),mi(me,H),v.elementClone.initialized=!0}v.context.drawImage(v.elementClone,k,P,U,$)}this.emit("beforeValueBox"),ra(v.context,H,La(this)),ml(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"draw",this).call(this)}catch(Ee){we.verifyError(Ee)}return this}},{key:"value",set:function(v){v=$i.ensureValue(v,this.options.minValue),this.options.animation&&this.options.ticksAngle===360&&this.options.useMinPath&&(this._value=v,v=this.options.value+((v-this.options.value)%360+540)%360-180),Rg(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"value",v,this)},get:function(){return ml(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"value",this)}}],[{key:"configure",value:function(v){return v.barWidth>50&&(v.barWidth=50),isNaN(v.startAngle)&&(v.startAngle=45),isNaN(v.ticksAngle)&&(v.ticksAngle=270),v.ticksAngle>360&&(v.ticksAngle=360),v.ticksAngle<0&&(v.ticksAngle=0),v.startAngle<0&&(v.startAngle=0),v.startAngle>360&&(v.startAngle=360),v}}]),h})($i);n!==void 0&&(n.RadialGauge=Wg),$i.initialize("RadialGauge",zd);var Hd=Object.assign({},pl,{borderRadius:0,barBeginCircle:30,colorBarEnd:"",colorBarProgressEnd:"",needleWidth:6,tickSide:"both",needleSide:"both",numberSide:"both",ticksWidth:10,ticksWidthMinor:5,ticksPadding:5,barLength:85,fontTitleSize:26,highlightsWidth:10}),Fg=(function(p){function h(v){return i(this,h),v=Object.assign({},Hd,v||{}),e(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,h.configure(v)))}return t(h,p),la(h,[{key:"draw",value:function(){try{var v=this.canvas,S=[-v.drawX,-v.drawY,v.drawWidth,v.drawHeight],k=S[0],P=S[1],U=S[2],$=S[3],H=this.options;if(!v.elementClone.initialized){var Y=v.contextClone;Y.clearRect(k,P,U,$),this.emit("beforePlate"),this.drawBox=_o(Y,H,k,P,U,$),this.emit("beforeBar"),ko.apply(void 0,[Y,H].concat(o(this.drawBox))),v.contextClone.barDimensions=Y.barDimensions,this.emit("beforeHighlights"),_g(Y,H),this.emit("beforeMinorTicks"),kg(Y,H),this.emit("beforeMajorTicks"),Mg(Y,H),this.emit("beforeNumbers"),Tg(Y,H),this.emit("beforeTitle"),Eg(Y,H),this.emit("beforeUnits"),Dg(Y,H),v.elementClone.initialized=!0}this.canvas.commit(),v.context.clearRect(k,P,U,$),v.context.drawImage(v.elementClone,k,P,U,$),this.emit("beforeProgressBar"),gr.apply(void 0,[v.context,H].concat(o(this.drawBox))),this.emit("beforeNeedle"),Pg(v.context,H),this.emit("beforeValueBox"),Og.apply(void 0,[v.context,H,H.animatedValue?this.options.value:this.value].concat(o(this.drawBox))),ml(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"draw",this).call(this)}catch(ce){we.verifyError(ce)}return this}}],[{key:"configure",value:function(v){return v.barStrokeWidth>=v.barWidth&&(v.barStrokeWidth=We(v.barWidth/2)),v.hasLeft=To("right",v),v.hasRight=To("left",v),v.value>v.maxValue&&(v.value=v.maxValue),v.value<v.minValue&&(v.value=v.minValue),$i.configure(v)}}]),h})($i);n!==void 0&&(n.LinearGauge=Fg),$i.initialize("LinearGauge",Hd),typeof Js<"u"&&Object.assign(n,{Collection:s,GenericOptions:pl,Animation:hl,BaseGauge:$i,drawings:we,SmartCanvas:Oi,DomObserver:Wa,vendorize:a})})(typeof Js<"u"?Js.exports:window)});var Ou=[{id:null,name:"Dashboard 1",icon:"dashboard-dashboard",configuration:[{w:24,h:24,id:"d1d58e6f-f8b4-4a72-9597-7f92aa6776fc",selector:"widget-host2",input:{widgetProperties:{type:"widget-tutorial",uuid:"d1d58e6f-f8b4-4a72-9597-7f92aa6776fc"}},x:0,y:0}],collapseSplitShell:!1}];var ft=(()=>{class n{_settings=y(Lt);_router=y(Xc);_destroyRef=y(Ze);dashboards=_([],{equal:wi});activeDashboard=_(null);_widgetAction=new ji(null);widgetAction$=this._widgetAction.asObservable();isDashboardStatic=_(!0);widgetClipboard=_(null);layoutEditSaved=_(0);layoutEditCanceled=_(0);constructor(){let e=this._settings.getDashboardConfig();if(!e||e.length===0){console.warn("[Dashboard Service] No dashboards found in settings, creating blank dashboard");let i=Ou.map(a=>pe(oe({},a),{id:Si.create()}));this.dashboards.set([...i])}else this.dashboards.set(e);this.applyDashboardParam(this.getRouteParam("id"),!1);let t=this._router.events.pipe(vi(i=>i instanceof Qc),wr({bufferSize:1,refCount:!0}),$e(this._destroyRef));t.pipe(Jt(1),Zt(()=>this.getRouteParam("id"))).subscribe(i=>this.applyDashboardParam(i,!0)),t.pipe(_r(1),Zt(()=>this.getRouteParam("id")),Cr()).subscribe(i=>this.applyDashboardParam(i,!1)),W(()=>{let i=this.dashboards();B(()=>{this._settings.saveDashboards(i)})})}getRouteParam(e){let t=this._router.routerState.snapshot.root;for(;t;){if(t.paramMap.has(e))return t.paramMap.get(e);t=t.firstChild??null}return null}applyDashboardParam(e,t){if(e===null||e===""){t&&this.setActiveDashboardIndex(0);return}let i=Number(e);if(Number.isNaN(i)){t&&this.setActiveDashboardIndex(0);return}this.setActiveDashboardIndex(i)}setActiveDashboardIndex(e){e!==this.activeDashboard()&&(e>=0&&e<this.dashboards().length?this.activeDashboard.set(e):console.error(`[Dashboard Service] Invalid dashboard ID: ${e}`))}toggleStaticDashboard(){this.isDashboardStatic.set(!this.isDashboardStatic())}add(e,t,i,a){let r=0;return this.dashboards.update(s=>{let d=[...s,{id:Si.create(),name:e,icon:i??"dashboard-dashboard",configuration:t,collapseSplitShell:a??!1}];return r=d.length-1,d}),r}update(e,t,i,a){this.dashboards.update(r=>r.map((s,d)=>d===e?pe(oe({},s),{name:t,icon:i??"dashboard-dashboard",collapseSplitShell:a??!1}):s))}delete(e){this.dashboards.update(t=>t.filter((i,a)=>a!==e)),this.dashboards().length===0?(this.add("Dashboard "+(this.dashboards().length+1),[]),this.activeDashboard.set(0)):this.activeDashboard()>this.dashboards().length-1&&this.activeDashboard.set(this.dashboards().length-1)}duplicate(e,t,i,a){if(e<0||e>=this.dashboards().length)return console.error(`[Dashboard Service] Invalid itemIndex: ${e}`),-1;let r=this.dashboards()[e],s=Ft(r);s.id=Si.create(),s.name=t,s.icon=i||"dashboard-dashboard",s.collapseSplitShell=a??!1,Array.isArray(s.configuration)?s.configuration.forEach(m=>{m&&m.input?.widgetProperties?(m.id=Si.create(),m.input.widgetProperties.uuid=m.id):console.error("Dashboard Service] Widget configuration is missing required properties:",m)}):(console.error("Dashboard Service] Dashboard configuration is not an array:",s.configuration),s.configuration=[]);let d=-1;return this.dashboards.update(m=>{let f=[...m,s];return d=f.length-1,f}),d}updateConfiguration(e,t){let i=Ft(t??[]);this.dashboards.update(a=>a.map((r,s)=>s===e?wi(r.configuration,i)?r:pe(oe({},r),{configuration:i}):r))}previousDashboard(){this.activeDashboard()+1>this.dashboards().length-1?this.activeDashboard.set(0):this.activeDashboard.set(this.activeDashboard()+1)}nextDashboard(){this.activeDashboard()-1<0?this.activeDashboard.set(this.dashboards().length-1):this.activeDashboard.set(this.activeDashboard()-1)}navigateToActive(){this._router.navigate(["/dashboard",this.activeDashboard()])}navigateTo(e){e>=0&&e<this.dashboards().length?this._router.navigate(["/dashboard",e]):console.error(`[Dashboard Service] Invalid dashboard ID: ${e}`)}navigateToNextDashboard(){let e=null;this.activeDashboard()-1<0?e=this.dashboards().length-1:e=this.activeDashboard()-1,this._router.navigate(["/dashboard",e])}navigateToPreviousDashboard(){let e=null;this.activeDashboard()+1>=this.dashboards().length?e=0:e=this.activeDashboard()+1,this._router.navigate(["/dashboard",e])}deleteWidget(e){this._widgetAction.next({id:e,operation:"delete"})}duplicateWidget(e){this._widgetAction.next({id:e,operation:"duplicate"})}copyWidget(e){this._widgetAction.next({id:e,operation:"copy"})}cutWidget(e){this._widgetAction.next({id:e,operation:"cut"})}setWidgetClipboardFromNode(e){let t=e?.input?.widgetProperties,i=t?.type;i&&this.widgetClipboard.set({w:e.w,h:e.h,selector:e.selector,input:{widgetProperties:{type:i,uuid:"clipboard",config:Ft(t.config)}}})}clearWidgetClipboard(){this.widgetClipboard.set(null)}setStaticDashboard(e){this.isDashboardStatic.set(e)}notifyLayoutEditSaved(){this.layoutEditSaved.update(e=>e+1)}notifyLayoutEditCanceled(){this.layoutEditCanceled.update(e=>e+1)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ss=(()=>{class n{http=y(Ha);connection=y($r);destroyRef=y(Ze);historyServiceUrl=null;constructor(){this.connection.serverServiceEndpoint$.pipe($e(this.destroyRef)).subscribe(e=>{let t=e?.httpServiceUrl||null;this.historyServiceUrl=t?t.replace("/v1/","/v2/"):null,this.historyServiceUrl||console.warn("[HistoryApiClientService] History API endpoint not available; history service is disabled")})}getPaths(e){return Le(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let t=`${this.historyServiceUrl}history/paths`,i=new Ur;e?.from&&(i=i.set("from",e.from)),e?.to&&(i=i.set("to",e.to)),e?.duration&&(i=i.set("duration",e.duration.toString()));let a=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${a}`);let r=yield kn(this.http.get(t,{params:i}));return console.log(`[HistoryApiClientService] Retrieved ${r?.length??0} available paths`),r}catch(t){return console.error("[HistoryApiClientService] History API /paths request failed:",t),null}})}getContexts(e){return Le(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let t=`${this.historyServiceUrl}history/contexts`,i=new Ur;e?.from&&(i=i.set("from",e.from)),e?.to&&(i=i.set("to",e.to)),e?.duration&&(i=i.set("duration",e.duration.toString()));let a=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${a}`);let r=yield kn(this.http.get(t,{params:i}));return console.log(`[HistoryApiClientService] Retrieved ${r?.length??0} available contexts`),r}catch(t){return console.error("[HistoryApiClientService] History API /contexts request failed:",t),null}})}getValues(e){return Le(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let t=`${this.historyServiceUrl}history/values`,i=new Ur;i=i.set("paths",e.paths),e.context&&(i=i.set("context",e.context)),e.from&&(i=i.set("from",e.from)),e.to&&(i=i.set("to",e.to)),e.duration&&(i=i.set("duration",e.duration.toString())),e.resolution!==void 0&&e.resolution!==null&&(i=i.set("resolution",e.resolution.toString()));let a=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${a}`);let r=yield kn(this.http.get(t,{params:i}));return console.log(`[HistoryApiClientService] History fetch successful, received ${r.data?.length??0} data points`),r}catch(t){return console.error("[HistoryApiClientService] History API request failed:",t),null}})}getProviders(){return Le(this,null,function*(){let e=`${this.historyServiceUrl}history/_providers`;return yield kn(this.http.get(e)),["kip"]})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ls=(()=>{class n{mapValuesToChartDatapoints(e,t){let i=e?.data;if(!i||i.length===0)return[];let a=-1,r=-1;if(e.values&&Array.isArray(e.values)){for(let E=0;E<e.values.length;E++){let F=e.values[E]?.method,I=typeof F=="string"?F.toLowerCase():F;if(!I)continue;let Z=E+1;I==="sma"?a=Z:(I==="avg"||I==="average")&&(r=Z)}r<0&&e.values.length===1&&(r=1)}else i[0]?.length>1&&(r=1);let s=t.unit==="rad",d=s?t.domain==="signed"?this.normalizeToSigned.bind(this):this.normalizeToDirection.bind(this):null,m=[],f=0,b=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,C=0,w=0,M=0,G=[];for(let E of i){if(!Array.isArray(E)||E.length===0)continue;let F=Date.parse(E[0]),I=a>=0?E[a]:null,Z=r>=0?E[r]:null;if(s?(I=Number.isFinite(I)?d(I):null,Z=Number.isFinite(Z)?d(Z):null):(I=Number.isFinite(I)?I:null,Z=Number.isFinite(Z)?Z:null),Number.isFinite(Z)){let j=Z;s?(G.push(j),w+=Math.sin(j),M+=Math.cos(j)):(C++,f+=j,j<b&&(b=j),j>A&&(A=j))}m.push({timestamp:F,data:{value:Z,sma:I,ema:null,doubleEma:null,lastAverage:null,lastMinimum:null,lastMaximum:null}})}if(m.length>0){let E=null,F=null,I=null;if(s&&G.length>0){E=Math.atan2(w/G.length,M/G.length);let{min:Z,max:j}=this.circularMinMaxRad(G);t.domain==="signed"?(E=this.normalizeToSigned(E),F=this.normalizeToSigned(Z),I=this.normalizeToSigned(j)):(E=this.normalizeToDirection(E),F=this.normalizeToDirection(Z),I=this.normalizeToDirection(j))}else!s&&C>0&&(E=f/C,F=b,I=A);if(E!==null&&F!==null&&I!==null){let Z=m[m.length-1];Z.data.lastAverage=E,Z.data.lastMinimum=F,Z.data.lastMaximum=I}}return m}circularMinMaxRad(e){if(e.length===0)return{min:0,max:0};let t=e.map(r=>(r*180/Math.PI+360)%360).sort((r,s)=>r-s),i=0,a=0;for(let r=0;r<t.length;r++){let s=(r+1)%t.length,d=(t[s]-t[r]+360)%360;d>i&&(i=d,a=s)}return{min:t[a]*Math.PI/180,max:t[(a-1+t.length)%t.length]*Math.PI/180}}mod(e,t){return(e%t+t)%t}normalizeToDirection(e){let t=2*Math.PI;return this.mod(e,t)}normalizeToSigned(e){let t=2*Math.PI;return this.mod(e+Math.PI,t)-Math.PI}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var dn=(()=>{class n{appSettings=y(Lt);data=y(Wt);history=y(ss);historyChartAdapter=y(ls);historyMinSampleTimeMs=1e3;_svcDatasetConfigs=[];_svcDataSource=[];_svcSubjectObserverRegistry=[];_startAllPromise;signedAnglePaths=new Set(["self.navigation.attitude.roll","self.navigation.attitude.pitch","self.navigation.attitude.yaw","self.environment.wind.angleApparent","self.environment.wind.angleTrueGround","self.environment.wind.angleTrueWater","self.steering.rudderAngle"]);constructor(){this._svcDatasetConfigs=this.appSettings.getDataSets(),this.cleanupDatasets(),this._startAllPromise=this.startAll()}cleanupDatasets(){if(this.appSettings.configUpgrade()||this.appSettings.getAppConfig().configVersion<12)return;let t=this.appSettings.getDashboardConfig(),i=new Set;t.forEach(d=>{d.configuration?.length&&d.configuration?.forEach(m=>{m?.id&&i.add(m.id)})});function a(d){let m=d.match(/^(windtrends|speedtrends)-(.+)$/);return m?m[2]:null}let r=[],s=[];for(let d of this._svcDatasetConfigs){let m=d.label||"",f=!1;if(m.startsWith("windtrends-")||m.startsWith("speedtrends-")){let b=a(m);f=!!(b&&i.has(b))}else(m.startsWith("simple-chart-")||(m.match(/\|/g)||[]).length===4)&&(f=i.has(d.uuid));f?s.push(d):r.push(d)}r.length&&(r.forEach(d=>{console.warn(`[DatasetStreamService] Cleaned dataset: uuid=${d.uuid}, label="${d.label}"`)}),this._svcDatasetConfigs=s,this.appSettings.saveDataSets(this._svcDatasetConfigs))}setupServiceSubjectRegistry(e,t){let i=this._svcSubjectObserverRegistry.findIndex(a=>a.datasetUuid==e);i>=0&&(this._svcSubjectObserverRegistry[i].rxjsSubject.complete(),this._svcSubjectObserverRegistry.splice(i,1)),this._svcSubjectObserverRegistry.push({datasetUuid:e,rxjsSubject:new Yd(t)})}createDataSourceConfiguration(e){let r={uuid:e.uuid,pathObserverSubscription:null,sampleTime:null,maxDataPoints:null,smoothingPeriod:null,historicalData:[]},s=m(e.timeScaleFormat,e.period),d=s>0?Math.max(100,Math.round(s/120)):1e3;return r.sampleTime=d,r.maxDataPoints=Math.max(1,Math.ceil(s/d)),r.smoothingPeriod=Math.max(1,Math.floor(r.maxDataPoints*.25)),(!r.maxDataPoints||r.maxDataPoints<1)&&(r.maxDataPoints=1),(!r.sampleTime||r.sampleTime<1)&&(r.sampleTime=1),r;function m(f,b){switch(f){case"Last Minute":return 6e4;case"Last 5 Minutes":return 5*6e4;case"Last 30 Minutes":return 30*6e4;case"day":return Math.max(0,b)*24*60*6e4;case"hour":return Math.max(0,b)*60*6e4;case"minute":return Math.max(0,b)*6e4;case"second":return Math.max(0,b)*1e3;default:return 0}}}waitUntilReady(){return Le(this,null,function*(){return this._startAllPromise})}startAll(){return Le(this,null,function*(){console.log("[DatasetStreamService] Auto Starting "+this._svcDatasetConfigs.length.toString()+" Datasets");for(let e of this._svcDatasetConfigs)yield this.start(e.uuid)})}start(e){return Le(this,null,function*(){let t=this._svcDatasetConfigs.find(b=>b.uuid==e);if(!t){console.warn(`[DatasetStreamService] Dataset UUID:${e} not found`);return}let i=this.createDataSourceConfiguration(t);this.setupServiceSubjectRegistry(i.uuid,i.maxDataPoints);let a=this._svcDataSource[this._svcDataSource.push(i)-1];console.log(`[DatasetStreamService] Starting recording process: ${t.path}, Scale: ${t.timeScaleFormat}, Period: ${t.period}, Datapoints: ${i.maxDataPoints}`);let r=this.resolveAngleDomain(t.path,t.baseUnit),s=Math.max(1,Math.round(i.sampleTime/1e3));this.shouldSeedHistory(i.sampleTime)&&(yield this.seedHistoryData(a,t,s,r));let d=this.data.subscribePath(t.path,t.pathSource).pipe(vi(b=>b?.data?.value!==null),wr({bufferSize:1,refCount:!0})),m=d.pipe(Jt(1)),f=ca(i.sampleTime,i.sampleTime).pipe(sc(d,(b,A)=>A));a.pathObserverSubscription=gi(m,f).subscribe(b=>{a.maxDataPoints>0&&a.historicalData.length>=a.maxDataPoints&&a.historicalData.shift(),a.historicalData.push(b.data.value);let A=this.updateDataset(a,t.baseUnit,r);this._svcSubjectObserverRegistry.find(C=>C.datasetUuid===a.uuid).rxjsSubject.next(A)})})}seedHistoryData(e,t,i,a){return Le(this,null,function*(){try{let r=this.buildHistoryPathString(t.path,e.smoothingPeriod),s=(()=>{switch(t.timeScaleFormat){case"Last Minute":return 6e4;case"Last 5 Minutes":return 5*6e4;case"Last 30 Minutes":return 30*6e4;case"day":return Math.max(0,t.period)*24*60*6e4;case"hour":return Math.max(0,t.period)*60*6e4;case"minute":return Math.max(0,t.period)*6e4;case"second":return Math.max(0,t.period)*1e3;default:return 0}})(),d=new Date,m={paths:r,from:new Date(d.getTime()-s).toISOString(),resolution:i},f=yield this.history.getValues(m);if(!f||!f.data||f.data.length===0){console.log(`[DatasetStreamService] No history data available for ${t.path}`);return}let b=this.convertHistoryToDatapoints(f,t.baseUnit,a),A=this._svcSubjectObserverRegistry.find(C=>C.datasetUuid===e.uuid)?.rxjsSubject;if(A&&b.length>0){let C=[];e.historicalData=[],b.forEach(w=>{let M=w.data.value;if(!Number.isFinite(M))return;e.maxDataPoints>0&&e.historicalData.length>=e.maxDataPoints&&e.historicalData.shift(),e.historicalData.push(M);let G=this.updateDataset(e,t.baseUnit,a);G.timestamp=w.timestamp,C.push(G)}),C.forEach(w=>A.next(w)),console.log(`[DatasetStreamService] Seeded ${C.length} history datapoints for ${t.path}`)}}catch(r){console.warn(`[DatasetStreamService] Failed to seed history data for ${t.path}:`,r)}})}stop(e){let t=this._svcDataSource.findIndex(i=>i.uuid==e);console.log(`[DatasetStreamService] Stopping Dataset ${e} data capture`),this._svcDataSource[t].pathObserverSubscription.unsubscribe(),this._svcDataSource.splice(t,1)}list(){return Ft(this._svcDatasetConfigs)}getDatasetConfig(e){return this._svcDatasetConfigs.find(t=>t.uuid===e)}getDataSourceInfo(e){return this._svcDataSource.find(t=>t.uuid===e)}create(e,t,i,a,r,s=!0,d=!0,m){if(!e||!t||!i||!a||!r)return null;let f=m||Si.create(),b={uuid:f,path:e,pathSource:t,baseUnit:this.data.getPathUnitType(e),timeScaleFormat:i,period:a,label:r,editable:d};return console.log(`[DatasetStreamService] Creating ${s?"":"non-"}persistent ${d?"":"hidden "}dataset: ${b.uuid}, Path: ${b.path}, Source: ${b.pathSource} Scale: ${b.timeScaleFormat}, Period: ${b.period}`),this._svcDatasetConfigs.push(b),this.start(f),s===!0&&this.appSettings.saveDataSets(this._svcDatasetConfigs),f}edit(e,t=!0){let i=this._svcDatasetConfigs.find(a=>a.uuid===e.uuid);return i?JSON.stringify(i)===JSON.stringify(e)?(console.log(`[DatasetStreamService] No changes detected for Dataset ${e.uuid}.`),!1):(this.stop(e.uuid),console.log(`[DatasetStreamService] Updating Dataset: ${e.uuid}`),e.baseUnit=this.data.getPathUnitType(e.path),this._svcDatasetConfigs.splice(this._svcDatasetConfigs.findIndex(a=>a.uuid===e.uuid),1,e),this.start(e.uuid),t===!0&&this.appSettings.saveDataSets(this._svcDatasetConfigs),!0):!1}remove(e,t=!0){return!e||e===""||this._svcDatasetConfigs.findIndex(i=>i.uuid===e)===-1?!1:(this.stop(e),console.log(`[DatasetStreamService] Removing ${t?"":"non-"}persistent Dataset: ${e}`),this._svcDatasetConfigs.splice(this._svcDatasetConfigs.findIndex(i=>i.uuid===e),1),this._svcSubjectObserverRegistry.find(i=>i.datasetUuid===e).rxjsSubject.complete(),this._svcSubjectObserverRegistry.splice(this._svcSubjectObserverRegistry.findIndex(i=>i.datasetUuid===e),1),t===!0&&this.appSettings.saveDataSets(this._svcDatasetConfigs),!0)}getDatasetObservable(e){let t=this._svcSubjectObserverRegistry.find(i=>i.datasetUuid==e);return t?t.rxjsSubject.asObservable():null}getDatasetBatchThenLiveObservable(e){let t=this._svcSubjectObserverRegistry.find(d=>d.datasetUuid==e);if(!t)return null;let i=t.rxjsSubject,a=i._buffer?i._buffer.slice():[],r=Qd([a]),s=i.pipe(_r(a.length));return Jd(r,s)}updateDataset(e,t,i="scalar"){let a=null,r=null,s=null,d=null;if(t==="rad"){a=this.circularMeanRad(e.historicalData);let A=e.historicalData.slice(-e.smoothingPeriod);r=this.circularMeanRad(A);let{min:C,max:w}=this.circularMinMaxRad(e.historicalData);i==="direction"?(a=this.normalizeToDirection(a),r=this.normalizeToDirection(r),s=this.normalizeToDirection(C),d=this.normalizeToDirection(w)):i==="signed"?(a=this.normalizeToSigned(a),r=this.normalizeToSigned(r),s=this.normalizeToSigned(C),d=this.normalizeToSigned(w)):(s=C,d=w)}else a=f(e.historicalData),r=b(e.historicalData,e.smoothingPeriod),s=Math.min(...e.historicalData),d=Math.max(...e.historicalData);return{timestamp:Date.now(),data:{value:t==="rad"?i==="signed"?this.normalizeToSigned(e.historicalData[e.historicalData.length-1]):this.normalizeToDirection(e.historicalData[e.historicalData.length-1]):e.historicalData[e.historicalData.length-1],sma:r,ema:null,doubleEma:null,lastAverage:a,lastMinimum:s,lastMaximum:d}};function f(A){return A.length===0?null:A.reduce((w,M)=>w+M,0)/A.length}function b(A,C){A.length<C&&(C=A.length);let w=0;for(let M=A.length-C;M<A.length;M++)w+=A[M];return w/C}}circularMeanRad(e){if(e.length===0)return 0;let t=e.reduce((a,r)=>a+Math.sin(r),0),i=e.reduce((a,r)=>a+Math.cos(r),0);return Math.atan2(t/e.length,i/e.length)}circularMinMaxRad(e){if(e.length===0)return{min:0,max:0};let t=e.map(d=>(d*180/Math.PI+360)%360).sort((d,m)=>d-m),i=0,a=0;for(let d=0;d<t.length;d++){let m=(d+1)%t.length,f=(t[m]-t[d]+360)%360;f>i&&(i=f,a=m)}let r=t[a]*Math.PI/180,s=t[(a-1+t.length)%t.length]*Math.PI/180;return{min:r,max:s}}resolveAngleDomain(e,t){if(t!=="rad")return"scalar";let i=this.normalizePathKey(e);for(let a of this.signedAnglePaths)if(i===this.normalizePathKey(a))return"signed";return"direction"}normalizePathKey(e){return e.replace(/^vessels\.self\./,"").replace(/^self\./,"")}mod(e,t){return(e%t+t)%t}normalizeToDirection(e){let t=2*Math.PI;return this.mod(e,t)}normalizeToSigned(e){let t=2*Math.PI;return this.mod(e+Math.PI,t)-Math.PI}removeIfExists(e,t=!0){return!e||this._svcDatasetConfigs.findIndex(i=>i.uuid===e)===-1?!1:this.remove(e,t)}shouldSeedHistory(e){return e>=this.historyMinSampleTimeMs}buildHistoryPathString(e,t){let i=e.replace(/^(vessels\.)?self\./,"");return[`${i}:sma:${t}`,`${i}:avg`,`${i}:min`,`${i}:max`].join(",")}convertHistoryToDatapoints(e,t,i){return this.historyChartAdapter.mapValuesToChartDatapoints(e,{unit:t,domain:i})}ngOnDestroy(){[...this._svcDataSource].forEach(e=>{try{this.stop(e.uuid)}catch(t){}}),this._svcSubjectObserverRegistry.forEach(e=>e.rxjsSubject.complete()),this._svcSubjectObserverRegistry=[]}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Ru=(()=>{class n{kipTimers={};constructor(){}createTimer(e,t,i){return e in this.kipTimers?this.kipTimers[e].currentValue.asObservable():(this.kipTimers[e]={currentValue:new ji(t),timeoutID:null,intervalMS:i},this.kipTimers[e].currentValue.asObservable())}startTimer(e){Object.prototype.hasOwnProperty.call(this.kipTimers,e)&&this.kipTimers[e].timeoutID===null&&(this.kipTimers[e].timeoutID=setInterval(()=>{this.kipTimers[e].currentValue.next(this.kipTimers[e].currentValue.value+1)},this.kipTimers[e].intervalMS))}stopTimer(e){Object.prototype.hasOwnProperty.call(this.kipTimers,e)&&this.kipTimers[e].timeoutID!==null&&(clearInterval(this.kipTimers[e].timeoutID),this.kipTimers[e].timeoutID=null)}setTimer(e,t){Object.prototype.hasOwnProperty.call(this.kipTimers,e)&&this.kipTimers[e].currentValue.next(t)}deleteTimer(e){Object.prototype.hasOwnProperty.call(this.kipTimers,e)&&(this.stopTimer(e),this.kipTimers[e].currentValue.complete(),delete this.kipTimers[e])}isRunning(e){let t=!1;return e in this.kipTimers&&(t=this.kipTimers[e].timeoutID!==null),t}ngOnDestroy(){Object.keys(this.kipTimers).forEach(e=>{this.kipTimers[e].timeoutID&&(clearInterval(this.kipTimers[e].timeoutID),this.kipTimers[e].timeoutID=null),this.kipTimers[e].currentValue.complete()}),this.kipTimers={}}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Lu=(()=>{class n{sanitizer=y(qa);transform(e){return this.sanitizer.bypassSecurityTrustResourceUrl(e)}static \u0275fac=function(t){return new(t||n)};static \u0275pipe=Or({name:"safe",type:n,pure:!0})}return n})();var Bg={minDist:230,maxDur:550,minVelocity:1.5,axisDominance:1.8,deadzoneMs:160,purityRatio:.8,lockThreshold:28,directionLockAngle:25,reversalPrimaryThreshold:34};function ao(n){let o=oe(oe({},Bg),n);return`(() => {
|
|
2
2
|
if (window.__kipSwipeInit) return; window.__kipSwipeInit = true;
|
|
3
3
|
const instanceId='${o.instanceId}';
|
|
4
4
|
let pointerId=null; let startX=0; let startY=0; let startT=0; let peakPrimary=0; let peakCross=0; let cancelled=false;
|
package/public/index.html
CHANGED
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
</div>
|
|
63
63
|
</app-root>
|
|
64
64
|
</div>
|
|
65
|
-
<link rel="modulepreload" href="chunk-
|
|
65
|
+
<link rel="modulepreload" href="chunk-VWLWXBLE.js"><link rel="modulepreload" href="chunk-ZWTP4TAR.js"><link rel="modulepreload" href="chunk-AZC2WKQI.js"><link rel="modulepreload" href="chunk-XX365EOU.js"><link rel="modulepreload" href="chunk-BGGO4PGD.js"><link rel="modulepreload" href="chunk-IENESD5Q.js"><link rel="modulepreload" href="chunk-YY4ZUJFI.js"><link rel="modulepreload" href="chunk-POMIQBAL.js"><link rel="modulepreload" href="chunk-CSIELI2Z.js"><link rel="modulepreload" href="chunk-4YDVZHMH.js"><script src="polyfills-L4FJGPOC.js" type="module"></script><script src="scripts-M6PHZBML.js" defer></script><script src="main-AVSEBMPR.js" type="module"></script></body>
|
|
66
66
|
</html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as xe,b as vt}from"./chunk-SNSSHCTO.js";import{a as Ft,b as A,c as H,i as he,k as E,l as _e,m as lt,o as ve,p as be,s as Ce,u as dt}from"./chunk-HC7WATIL.js";import{a as Ie}from"./chunk-AZC2WKQI.js";import{c as le}from"./chunk-YG7HBKOK.js";import{a as Oe,b as Pe,c as Ne,d as De,e as Ae,f as Te}from"./chunk-BGGO4PGD.js";import{a as ke}from"./chunk-IENESD5Q.js";import{c as pe,d as Se,g as ye,h as we,j as Me}from"./chunk-YY4ZUJFI.js";import{b as Ee}from"./chunk-POMIQBAL.js";import{e as ge}from"./chunk-CSIELI2Z.js";import{c as de,d as me,e as fe,f as ue}from"./chunk-4YDVZHMH.js";import{o as st,p as ct,q as B,r as z}from"./chunk-M37BLWHF.js";import{a as Zt,b as rt,d as te,e as k,g as ee,h as ie,i as oe}from"./chunk-WJFXI5PQ.js";import{a as ce}from"./chunk-HSKVTFFQ.js";import{f as ae,g as re,t as se}from"./chunk-MXUEYEZU.js";import{c as Lt,e as Xt,g as ot,h as L,i as nt,k as D,l as at,m as x,n as ne}from"./chunk-2GOHQZH5.js";import{A as yt,Aa as Y,Ab as F,Ac as Et,Ad as Ht,Bb as K,Cb as M,Cd as $t,Db as a,Dd as qt,Eb as s,Ec as Rt,Ee as it,Fa as kt,Fb as I,Fc as tt,Ga as w,Hc as _t,Ia as It,Ic as Ut,K as U,Ke as Yt,Mb as S,Ne as Jt,Ob as f,Oe as R,Pe as h,Qb as u,Re as V,Se as T,U as wt,Va as p,Vd as jt,Yb as X,Zb as Z,_b as Pt,a as Ct,ac as Nt,ba as Mt,c as St,cd as Kt,ce as Wt,dc as l,ec as q,f as $,fb as P,fc as Dt,ge as et,he as Gt,jc as ut,je as N,ka as C,kc as ht,ke as Qt,lc as gt,m as mt,pa as n,qb as ft,ra as xt,ua as g,ub as Ot,uc as At,va as _,vd as Vt,wb as v,wc as Tt,wd as Bt,xb as b,xd as zt,ya as Q,yb as J,z as G,zc as j}from"./chunk-PZ6I6W3H.js";var pt=(i,c)=>{let t=n(x),e=n(k),o=t.getSplitShellEnabled(),r="/"+c.map(y=>y.path).join("/"),d=r.startsWith("/chartplotter"),m=r.startsWith("/dashboard");if(o&&m&&!d){let y=c.length>1?c[1].path:void 0;return e.createUrlTree(["chartplotter",y??""])}if(!o&&d){let y=c.length>1?c[1].path:void 0;return e.createUrlTree(["dashboard",y??""])}return!0};var Re=[{path:"dashboard/:id",component:vt,canMatch:[pt]},{path:"chartplotter/:id",loadComponent:()=>import("./chunk-25JIOYN7.js").then(i=>i.SplitShellComponent),canMatch:[pt]},{path:"settings",loadComponent:()=>import("./chunk-UUFKTTLZ.js").then(i=>i.SettingsComponent),title:"KIP - Settings"},{path:"options",loadComponent:()=>import("./chunk-LKDHPCO3.js").then(i=>i.TabsComponent),title:"KIP - Options"},{path:"remote",loadComponent:()=>import("./chunk-BQPPRM7O.js").then(i=>i.RemoteControlComponent),title:"KIP - Remote Control"},{path:"help/:page",loadComponent:()=>import("./chunk-SUWMN3AE.js").then(i=>i.AppHelpComponent),title:"KIP - Help"},{path:"help",loadComponent:()=>import("./chunk-SUWMN3AE.js").then(i=>i.AppHelpComponent),title:"KIP - Help"},{path:"data",loadComponent:()=>import("./chunk-AQROQY2F.js").then(i=>i.DataInspectorComponent),title:"KIP - Data Inspector"},{path:"login",loadComponent:()=>import("./chunk-PTLDR7X7.js").then(i=>i.WidgetLoginComponent),title:"Login"},{path:"**",component:vt,canMatch:[pt]}];var Ue={production:!0};var Ye=(i,c)=>c.path;function Je(i,c){i&1&&(a(0,"mat-icon"),l(1,"info"),s())}function Xe(i,c){i&1&&(a(0,"mat-icon"),l(1,"info"),s())}function Ze(i,c){i&1&&(a(0,"mat-icon",3),l(1,"report"),s())}function ti(i,c){i&1&&(a(0,"mat-icon",4),l(1,"warning"),s())}function ei(i,c){i&1&&(a(0,"mat-icon",5),l(1,"error"),s())}function ii(i,c){i&1&&(a(0,"mat-icon",6),l(1,"emergency_home"),s())}function oi(i,c){if(i&1){let t=S();a(0,"div",2),v(1,Je,2,0,"mat-icon")(2,Xe,2,0,"mat-icon")(3,Ze,2,0,"mat-icon",3)(4,ti,2,0,"mat-icon",4)(5,ei,2,0,"mat-icon",5)(6,ii,2,0,"mat-icon",6),a(7,"div",7),l(8),s(),a(9,"div",8),l(10),At(11,"slice"),s(),a(12,"div",9),l(13),s(),a(14,"button",10),f("click",function(){let o=g(t).$implicit,r=u();return _(r.silence(o.path))}),a(15,"mat-icon"),l(16,"music_off"),s()(),a(17,"button",11),f("click",function(){let o=g(t).$implicit,r=u();return _(r.clear(o.path))}),a(18,"mat-icon"),l(19,"published_with_changes"),s()()(),I(20,"mat-divider",12)}if(i&2){let t,e=c.$implicit;p(),b((t=e.value.state)==="nominal"?1:t==="normal"?2:t==="alert"?3:t==="warn"?4:t==="alarm"?5:t==="emergency"?6:-1),p(7),q(e.value.state),p(2),Dt(" ",Tt(11,5,e.path,14)," "),p(3),q(e.value.message),p(),M("disabled",!(e.value.method!=null&&e.value.method.includes("sound")))}}function ni(i,c){i&1&&(a(0,"mat-list-item",13)(1,"span",15),l(2,"Notifications Disabled"),s(),a(3,"span")(4,"i"),l(5,"*Enable notifications in Settings."),s()()())}function ai(i,c){i&1&&(a(0,"mat-list-item",14)(1,"i"),l(2,'"No Notification"'),s()())}function ri(i,c){if(i&1&&v(0,ni,6,0,"mat-list-item",13)(1,ai,3,0,"mat-list-item",14),i&2){let t=u();b(t.notificationConfig().disableNotifications?0:1)}}function si(i,c){if(i&1){let t=S();a(0,"button",17),f("click",function(){g(t);let o=u(2);return _(o.mutePlayer(!o.isMuted))}),a(1,"span",18),l(2,"volume_up"),s(),l(3," Unmute Audio "),s()}}function ci(i,c){if(i&1){let t=S();a(0,"button",17),f("click",function(){g(t);let o=u(2);return _(o.mutePlayer(!o.isMuted))}),a(1,"span",18),l(2,"volume_off"),s(),l(3," Mute Audio "),s()}}function li(i,c){if(i&1&&v(0,si,4,0,"button",16)(1,ci,4,0,"button",16),i&2){let t=u();b(t.isMuted?0:1)}}var Le=(()=>{class i{_notificationsService=n(E);_notifications$=this._notificationsService.observeNotifications();notificationConfig=h(this._notificationsService.observeNotificationConfiguration(),{requireSync:!0});menuNotifications=h(yt([this._notifications$,this._notificationsService.observeNotificationConfiguration()]).pipe(G(([t,e])=>{let o=[];return e.devices.showNormalState||o.push(st.Normal),e.devices.showNominalState||o.push(st.Nominal),t.filter(r=>r.value&&r.value.state&&!o.includes(r.value.state)).filter(r=>{let d=r.value?.method;return d?.length?d.includes(ct.Visual)||d.includes(ct.Sound):!1})})),{requireSync:!0,equal:Xt});isMuted=!1;mutePlayer(t){this.isMuted=t,this._notificationsService.mutePlayer(t)}silence(t){this._notificationsService.setSkMethod(t,[ct.Visual])}clear(t){this._notificationsService.setSkState(t,st.Normal)}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=P({type:i,selectors:[["menu-notifications"]],decls:6,vars:2,consts:[[1,"menu-item-container"],[1,"actions-container","actions-bottom-container"],[1,"notification-container"],[1,"icon-alert-color"],[1,"icon-warn-color"],[1,"icon-alarm-color"],[1,"icon-emergency-color"],[1,"notification-title"],[1,"notification-path","scrollable-text"],[1,"notification-text"],["mat-icon-button","",1,"notification-action-btn",3,"click","disabled"],["mat-icon-button","",1,"notification-action-btn",3,"click"],[1,"notification-divider"],["lines","3","disabled","true",2,"text-align","center"],["disabled","true",2,"text-align","center"],["matListItemTitle",""],["mat-flat-button","","matTooltip","Temporally toggle all notification audio. To permanently disable/enable notification audio, use the configuration settings option",1,"action-button"],["mat-flat-button","","matTooltip","Temporally toggle all notification audio. To permanently disable/enable notification audio, use the configuration settings option",1,"action-button",3,"click"],[1,"material-icons"]],template:function(e,o){e&1&&(a(0,"mat-list",0),F(1,oi,21,8,null,null,Ye,!1,ri,2,1),s(),a(4,"div",1),v(5,li,2,1),s()),e&2&&(p(),K(o.menuNotifications()),p(4),b(o.notificationConfig().disableNotifications?-1:5))},dependencies:[Me,ye,we,ce,Se,N,et,Wt,lt,ue,fe,T,V,Kt],styles:[".notification-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-evenly;padding:2px 10px 7px;scroll-behavior:smooth}mat-icon[_ngcontent-%COMP%]{margin-right:10px}.scrollable-text[_ngcontent-%COMP%]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.scrollable-text[_ngcontent-%COMP%]:hover{overflow:auto;white-space:normal;word-wrap:break-word}.notification-title[_ngcontent-%COMP%]{text-transform:capitalize;font-size:var(--mat-sys-headline-small-size);width:calc(100% - 34px)}.notification-path[_ngcontent-%COMP%]{font-size:var(--mat-sys-body-small-size);word-break:break-all;width:100%}.notification-text[_ngcontent-%COMP%]{font-size:var(--mat-sys-body-small-line-height);font-style:italic;width:100%;overflow:auto;white-space:normal;word-wrap:break-word}.notification-action-btn[_ngcontent-%COMP%]{background-color:var(--mat-sys-surface-container)}.notification-btn-container[_ngcontent-%COMP%]{display:inline-block;width:50%;height:48px;text-align:center}.menu-item-container[_ngcontent-%COMP%]{width:230px;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;height:calc(100% - 48px)}.notification-bottom-container[_ngcontent-%COMP%]{position:absolute;bottom:0;width:100%;background-color:var(--mat-sys-surface-container)}.actions-container[_ngcontent-%COMP%]{display:grid;grid-auto-flow:column}.actions-bottom-container[_ngcontent-%COMP%]{position:absolute;bottom:0;width:100%;height:48px}.action-button[_ngcontent-%COMP%]{border-radius:0;height:48px;border-bottom-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large))}.icon-alert-color[_ngcontent-%COMP%]{color:var(--kip-zone-alert-color)}.icon-warn-color[_ngcontent-%COMP%]{color:var(--kip-zone-warn-color)}.icon-alarm-color[_ngcontent-%COMP%]{color:var(--kip-zone-alarm-color)}.icon-emergency-color[_ngcontent-%COMP%]{color:var(--kip-zone-emergency-color)}.alarm-emergency-blink[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_blinking-emergency 1.5s infinite}@keyframes _ngcontent-%COMP%_blinking-emergency{0%{background-color:var(--kip-zone-alarm-color)}50%{background-color:transparent}to{background-color:var(--kip-zone-alarm-color)}}.warn[_ngcontent-%COMP%]{color:var(--kip-zone-warn-color)}.notification-divider[_ngcontent-%COMP%]{padding-top:10px}"],changeDetection:0})}return i})();var di=["badgeButton"],Ve=(()=>{class i{badgeButton=tt.required("badgeButton");_notifications=n(E);notificationsInfo=h(this._notifications.observerNotificationsInfo());openNotificationMenu(){let t=new Event("openRightSidenav",{bubbles:!0,cancelable:!0});window.document.dispatchEvent(t)}onKeyDown(t){let e=t.key?.toLowerCase();(e==="enter"||e===" "||e==="spacebar")&&(t.preventDefault(),this.openNotificationMenu())}focus(){try{let t=this.badgeButton&&this.badgeButton(),e=t&&t.nativeElement;e&&typeof e.focus=="function"&&e.focus()}catch(t){}}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=P({type:i,selectors:[["notification-badge"]],viewQuery:function(e,o){e&1&&X(o.badgeButton,di,5),e&2&&Z()},decls:5,vars:7,consts:[["badgeButton",""],["mat-fab","","role","button","aria-label","Open notifications",1,"layout-action-btn",3,"click","keydown"],["aria-hidden","false","matBadgeSize","large","matBadgePosition","after","matBadgeOverlap","true",1,"icon-alert-color",3,"matBadgeHidden","matBadge"]],template:function(e,o){e&1&&(a(0,"div")(1,"button",1,0),f("click",function(){return o.openNotificationMenu()})("keydown",function(d){return o.onKeyDown(d)}),a(3,"mat-icon",2),l(4,"notifications "),s()()()),e&2&&(p(),Nt("warn",o.notificationsInfo().isWarn)("alarm-emergency-blink",o.notificationsInfo().isAlarmEmergency),Ot("aria-haspopup",!0),p(2),M("matBadgeHidden",!o.notificationsInfo().alarmCount)("matBadge",o.notificationsInfo().alarmCount))},dependencies:[N,Gt,T,V,lt,_e],styles:["[_nghost-%COMP%]{display:block}.layout-action-btn[_ngcontent-%COMP%]{color:var(--mat-sys-on-primary);background-color:var(--mat-sys-primary)}.icon-alert-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-alert-color)}.icon-warn-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-warn-color)}.icon-alarm-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-alarm-color)}.icon-emergency-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-emergency-color)}.alarm-emergency-blink[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_blinking-emergency 1.5s infinite}@keyframes _ngcontent-%COMP%_blinking-emergency{0%{background-color:var(--kip-zone-alarm-color)}50%{background-color:var(--mat-sys-primary)}to{background-color:var(--kip-zone-alarm-color)}}.warn[_ngcontent-%COMP%]{color:var(--kip-zone-warn-color)}"]})}return i})();var Be=(()=>{class i{overlayRef=null;overlay=n(Yt);injector=n(Q);open(){if(this.overlayRef)return;this.overlayRef=this.overlay.create({hasBackdrop:!1,panelClass:"notification-overlay-panel",positionStrategy:this.overlay.position().global().bottom("20px").left("20px"),scrollStrategy:this.overlay.scrollStrategies.reposition()});let t=new Qt(Ve,null,this.injector),e=this.overlayRef.attach(t);try{let o=e&&e.instance;if(o&&typeof o.focus=="function")o.focus();else{let r=this.overlayRef.overlayElement,d=r&&r.querySelector("button[mat-fab], .layout-action-btn");d&&typeof d.focus=="function"&&d.focus()}}catch(o){}}close(){try{this.overlayRef&&this.overlayRef.dispose()}catch(t){console.warn("[NotificationOverlayService] dispose failed",t)}finally{this.overlayRef=null}}toggle(t){t?this.open():this.close()}isOpen(){return!!this.overlayRef}ngOnDestroy(){try{this.overlayRef&&this.overlayRef.dispose()}catch(t){}finally{this.overlayRef=null}}static \u0275fac=function(e){return new(e||i)};static \u0275prov=C({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();function pi(i,c){if(i&1){let t=S();a(0,"button",12),f("click",function(){g(t);let o=u(2);return _(o.onActionItem("toggleFullScreen"))}),a(1,"span",10),l(2,"fullscreen"),s()()}}function mi(i,c){if(i&1){let t=S();a(0,"button",12),f("click",function(){g(t);let o=u(2);return _(o.onActionItem("toggleFullScreen"))}),a(1,"span",10),l(2,"close_fullscreen"),s()()}}function fi(i,c){if(i&1&&v(0,pi,3,0,"button",11)(1,mi,3,0,"button",11),i&2){let t=u();b(t.uiEvent.fullscreenStatus()?1:0)}}function ui(i,c){if(i&1){let t=S();a(0,"button",14),f("click",function(){g(t);let o=u(2);return _(o.onActionItem("nightMode"))}),a(1,"span",10),l(2,"mode_night"),s()()}}function hi(i,c){if(i&1){let t=S();a(0,"button",14),f("click",function(){g(t);let o=u(2);return _(o.onActionItem("nightMode"))}),a(1,"span",10),l(2,"light_mode"),s()()}}function gi(i,c){if(i&1&&v(0,ui,3,0,"button",13)(1,hi,3,0,"button",13),i&2){let t=u();b(t.app.isNightMode()?1:0)}}function _i(i,c){if(i&1){let t=S();a(0,"tile-large-icon",15,1),f("click",function(){let o=g(t).$index,r=u();return _(r.navigateToDashboard(o))}),s()}if(i&2){let t=c.$implicit;M("active",t.active)("svgIcon",t.svgIcon)("iconSize",t.iconSize)("label",t.label)}}var ze=(()=>{class i{actionsSidenav=Rt.required();_router=n(k);uiEvent=n(dt);dashboard=n(A);app=n(le);_settings=n(x);isAutoNightMode=h(this._settings.getAutoNightModeAsO(),{requireSync:!0});_initialDashboardMatch=(()=>{let e=this._router.parseUrl(this._router.url).root.children.primary,o=e?e.segments.map(r=>r.path):[];return o.length===0||o[0]==="dashboard"||o[0]==="chartplotter"})();isDashboardContext=h(this._router.events.pipe(U(t=>t instanceof rt),Mt(null),G(()=>{let e=this._router.parseUrl(this._router.url).root.children.primary,o=e?e.segments.map(r=>r.path):[];return o.length===0||o[0]==="dashboard"||o[0]==="chartplotter"}),wt()),{initialValue:this._initialDashboardMatch});menuItems=Et(()=>{let t=this.dashboard.dashboards(),e=this.dashboard.activeDashboard();return t.map((o,r)=>({id:Number(o.id),active:r===e,pinned:!1,svgIcon:o.icon||"dashboard-dashboard",iconSize:60,label:o.name||`Dashboard ${r+1}`}))});ngAfterViewInit(){this.uiEvent.addHotkeyListener((t,e)=>this.handleKeyDown(t,e),{ctrlKey:!0,shiftKey:!0,keys:["e","f","n"]})}ngOnDestroy(){this.uiEvent.removeHotkeyListener(this.handleKeyDown.bind(this))}handleKeyDown(t,e){switch(t){case"e":this.onActionItem("layout");break;case"f":this.onActionItem("toggleFullScreen");break;case"n":this.onActionItem("nightMode");break;default:break}}onActionItem(t){switch(this.actionsSidenav().close(),t){case"toggleFullScreen":this.uiEvent.toggleFullScreen();break;case"settings":this._router.navigate(["/settings"]);break;case"layout":this.dashboard.setStaticDashboard(!1);break;case"nightMode":this.app.isNightMode.set(!this.app.isNightMode()),this.app.toggleDayNightMode();break;default:break}}navigateToDashboard(t){this.actionsSidenav().close(),this._router.navigate([`dashboard/${t}`])}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=P({type:i,selectors:[["menu-actions"]],inputs:{actionsSidenav:[1,"actionsSidenav"]},decls:14,vars:3,consts:[["tileContainer",""],["tile",""],[1,"actions-container"],[1,"actions-top-container"],["mat-flat-button","","tabindex","0",1,"action-button","home-btn",3,"click"],["height","24px","width","24px","svgIcon","kip","aria-hidden","false",1,"home-icon",2,"height","24px","width","24px"],[1,"menu-item-container"],[3,"active","svgIcon","iconSize","label"],[1,"actions-bottom-container"],["mat-flat-button","",1,"action-button",2,"width","135px",3,"click","disabled"],[1,"material-icons"],["mat-flat-button","","tabindex","0",1,"action-button"],["mat-flat-button","","tabindex","0",1,"action-button",3,"click"],["mat-flat-button","",1,"action-button"],["mat-flat-button","",1,"action-button",3,"click"],[3,"click","active","svgIcon","iconSize","label"]],template:function(e,o){e&1&&(a(0,"div",2)(1,"div",3),v(2,fi,2,1),v(3,gi,2,1),a(4,"button",4),f("click",function(){return o.onActionItem("settings")}),I(5,"mat-icon",5),s()(),a(6,"div",6,0),F(8,_i,2,4,"tile-large-icon",7,J),s(),a(10,"div",8)(11,"button",9),f("click",function(){return o.onActionItem("layout")}),a(12,"span",10),l(13,"lock_open"),s()()()()),e&2&&(p(2),b(o.uiEvent.fullscreenSupported()?2:-1),p(),b(o.isAutoNightMode()?-1:3),p(5),K(o.menuItems()),p(3),M("disabled",!o.isDashboardContext()))},dependencies:[T,V,N,et,ke],styles:[".actions-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;width:135px}.actions-top-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}.actions-bottom-container[_ngcontent-%COMP%]{height:48px;width:100%}.action-button[_ngcontent-%COMP%]{border-radius:0;height:48px;flex:1 1 48px;min-height:0;overflow:hidden;border:1px solid var(--mat-sidenav-container-background-color, var(--mat-sys-surface))}.home-btn[_ngcontent-%COMP%]{--mat-icon-button-icon-size: 24px;--mat-button-filled-icon-offset: 0px;--mat-button-filled-icon-spacing: 0px;--mat-button-filled-label-text-size: 0px}.home-icon[_ngcontent-%COMP%] .mat-mdc-unelevated-button[_ngcontent-%COMP%] > .mat-icon[_ngcontent-%COMP%]{font-size:0px}.full-size[_ngcontent-%COMP%]{width:135px}.menu-item-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:nowrap;padding:3px 1px;gap:5px;width:135px;overflow-y:auto;scrollbar-width:none;overflow-x:hidden;scroll-behavior:smooth;flex:1 1 auto;min-height:0}"]})}return i})();var He=(()=>{class i{COMMAND_SET_DISPLAY_PATH="self.kip.remote.setDisplay";COMMAND_SET_SCREEN_INDEX_PATH="self.kip.remote.setScreenIndex";COMMAND_REQUEST_ACTIVE_SCREEN_PATH="self.kip.remote.requestActiveScreen";settings=n(x);dashboard=n(A);data=n(z);requests=n(pe);KIP_UUID=this.settings.KipUUID;ACTIVE_SCREEN_PATH=`self.displays.${this.KIP_UUID}.screenIndex`;CHANGE_SCREEN_PATH=`self.displays.${this.KIP_UUID}.activeScreen`;displayName=h(this.settings.getInstanceNameAsO());isRemoteControl=h(this.settings.getIsRemoteControlAsO());remoteScreenPosition=h(this.data.subscribePath(this.ACTIVE_SCREEN_PATH,"default"));changeDashboardTo=h(this.data.subscribePath(this.CHANGE_SCREEN_PATH,"default"));previousIsRemoteControl=!1;constructor(){this.setActiveDashboardOnRemote(this.KIP_UUID,null),this.setScreensOnRemote(this.KIP_UUID,null),this.clearActiveScreenOnRemote(this.KIP_UUID,null),console.log("[Remote Dashboards] Cleaning paths on server"),w(()=>{let t=this.isRemoteControl(),e=this.displayName();j(()=>{if(!t&&!this.previousIsRemoteControl)return;this.previousIsRemoteControl=t;let o;t?(o=this.getScreensPayload(this.dashboard.dashboards()),this.dashboard.activeDashboard()!==null&&this.setActiveDashboardOnRemote(this.KIP_UUID,this.dashboard.activeDashboard())):(o=null,this.clearActiveDashboardOnServer()),this.shareScreens(o)})}),w(()=>{let t=this.dashboard.dashboards();j(()=>{if(!this.isRemoteControl())return;let e=this.getScreensPayload(t);this.shareScreens(e)})}),w(()=>{let t=this.dashboard.activeDashboard();j(()=>{this.isRemoteControl()&&t!==null&&(this.setActiveDashboardOnRemote(this.KIP_UUID,t),console.log(`[Remote Dashboards] Sent new dashboard highlight index ${t} to server.`))})}),w(()=>{let t=this.changeDashboardTo();j(()=>{if(!this.isRemoteControl()||t.data.value==null)return;let e=Number(t.data.value);!isNaN(e)&&e>=0&&e<this.dashboard.dashboards().length&&this.dashboard.activeDashboard()!==e&&(this.dashboard.navigateTo(e),console.log(`[Remote Dashboards] Executed remote request to change active dashboard to: ${e}`))})})}clearActiveDashboardOnServer(){this.setActiveDashboardOnRemote(this.KIP_UUID,null),console.log("[Remote Dashboards] Disabled: Cleared active dashboard on server")}getScreensPayload(t){let e=this.displayName(),o=t.map(m=>{var y=m,{configuration:r}=y,d=St(y,["configuration"]);return d});return{displayName:e,screens:o}}shareScreens(t){this.setScreensOnRemote(this.KIP_UUID,t),console.log("[Remote Dashboards] Sending dashboard configurations to server.")}setActiveDashboardOnRemote(t,e){let o={displayId:t,screenIdx:e};this.requests.putRequest(this.COMMAND_SET_SCREEN_INDEX_PATH,o,this.KIP_UUID)||console.error("[Remote Dashboards] Error sharing active dashboard: request was not accepted")}setScreensOnRemote(t,e){let o={displayId:t,display:e===null?null:Ct({},e)};this.requests.putRequest(this.COMMAND_SET_DISPLAY_PATH,o,this.KIP_UUID)||console.error("[Remote Dashboards] Error sharing screen configuration: request was not accepted")}clearActiveScreenOnRemote(t,e){let o={displayId:t,screenIdx:e};this.requests.putRequest(this.COMMAND_REQUEST_ACTIVE_SCREEN_PATH,o,this.KIP_UUID)||console.error("[Remote Dashboards] Error clearing active screen request path: request was not accepted")}static \u0275fac=function(e){return new(e||i)};static \u0275prov=C({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var $e=11,qe="connectionConfig",W=(()=>{class i{config;isLoggedIn=null;loggedInSubscription=null;connection=n(nt);auth=n(D);connectionStateMachine=n(L);router=n(k);delta=n(B);data=n(z);storage=n(at);internetReachability=n(Ie);injector=n(Q);datasetService=null;_bootstrapStatus$=new mt("starting");_bootstrapIssue$=new mt({reason:"none"});constructor(){this.loggedInSubscription=this.auth.isLoggedIn$.subscribe(t=>{this.isLoggedIn=t})}initNetworkServices(){return $(this,null,function*(){let t=!1;this.loadLocalStorageConfig(),this.preloadFonts(),this.internetReachability.start();try{if(this.config?.signalKUrl!==void 0&&this.config.signalKUrl!==null&&(yield this.connection.initializeConnection({url:this.config.signalKUrl,new:!1},this.config.proxyEnabled,this.config.signalKSubscribeAll)),!this.isLoggedIn&&this.config?.signalKUrl&&this.config?.useSharedConfig&&this.config?.loginName&&this.config?.loginPassword&&(yield this.login()),this.isLoggedIn&&this.config?.useSharedConfig)if(yield this.storage.waitUntilReady()){let o=yield this.storage.getConfig("user",this.config.sharedConfigName,$e),r={sharedConfigName:this.config.sharedConfigName,configFileVersion:$e,initConfig:o};this.storage.bootstrapRemoteContext(r)}else throw new Error("[AppInit Network Service] StorageService did not become ready in time. Cannot bootstrap remote configuration.");this._bootstrapIssue$.next({reason:"none"}),yield this.getDatasetService().waitUntilReady(),!this.isLoggedIn&&this.config?.signalKUrl&&this.config?.useSharedConfig&&this.router.navigate(["/login"])}catch(e){if(t=!0,e?.status===404&&this.config?.useSharedConfig){let o=yield this.probeLegacyUpgradeAvailability(this.config.sharedConfigName);this._bootstrapIssue$.next({reason:"missing-shared-config",statusCode:404,sharedConfigName:this.config.sharedConfigName,legacyUpgradeAvailable:o})}else e?.status===0?this._bootstrapIssue$.next({reason:"network-unreachable",statusCode:0}):e?.status===401?this._bootstrapIssue$.next({reason:"unauthorized",statusCode:401}):this._bootstrapIssue$.next({reason:"unknown",statusCode:e?.status});e.status===0?(yield this.waitForHttpRetryCompletion())===ot.HTTPConnected||this.connectionStateMachine.isHTTPConnected()?console.warn("[AppInit Network Service] Initial connection recovered during retry cycle. Skipping fallback route."):(console.warn("[AppInit Network Service] Initialization failed after HTTP retries. Redirecting to settings page."),yield this.router.navigate(["/options"])):e.status===401?(console.warn("[AppInit Network Service] Initialization failed. Unauthorized access. Redirecting to login page."),yield this.router.navigate(["/login"])):(console.warn("[AppInit Network Service] Initialization failed. Error: ",JSON.stringify(e)),yield this.router.navigate(["/options"])),console.warn("[AppInit Network Service] Startup continuing in degraded mode to allow UI feedback."),this._bootstrapStatus$.next("degraded");return}finally{t||this._bootstrapStatus$.next("ready"),console.log("[AppInit Network Service] Initialization completed"),this.connectionStateMachine.enableWebSocketMode(),this.connectionStateMachine.isHTTPConnected()&&(console.log("[AppInit Network Service] Starting WebSocket connection after initialization"),this.connectionStateMachine.startWebSocketConnection())}})}get bootstrapStatus$(){return this._bootstrapStatus$.asObservable()}get bootstrapIssue$(){return this._bootstrapIssue$.asObservable()}getDatasetService(){return this.datasetService||(this.datasetService=this.injector.get(H)),this.datasetService}waitForHttpRetryCompletion(t){return $(this,null,function*(){let e=t??this.connectionStateMachine.getHttpRetryWindowMs(2e3),o=new Set([ot.HTTPConnected,ot.PermanentFailure]),r=this.connectionStateMachine.currentState;return o.has(r)?r:new Promise(d=>{let m=window.setTimeout(()=>{y.unsubscribe(),d(null)},e),y=this.connectionStateMachine.state$.subscribe(bt=>{o.has(bt)&&(clearTimeout(m),y.unsubscribe(),d(bt))})})})}probeLegacyUpgradeAvailability(t){return $(this,null,function*(){if(!t)return!1;try{return(yield this.storage.getConfig("user",t,9))?.app?.configVersion===10}catch(e){return!1}})}login(){return $(this,null,function*(){if(!this.isLoggedIn&&this.config.useSharedConfig&&this.config.loginName&&this.config.loginPassword)try{yield this.auth.login({usr:this.config.loginName,pwd:this.config.loginPassword})}catch(t){throw t.status===0?this.router.navigate(["/settings"]):t.status===401&&this.router.navigate(["/login"]),t}})}setLocalStorageConfig(){localStorage.setItem(qe,JSON.stringify(this.config))}loadLocalStorageConfig(){this.config=JSON.parse(localStorage.getItem(qe)),this.config?this.config.signalKUrl||(this.config.signalKUrl=window.location.origin,this.setLocalStorageConfig(),console.log(`[AppInit Network Service] Config found with no server URL. Setting Auto-Discovery URL: ${this.config.signalKUrl}`)):(this.config=Lt,this.config.signalKUrl=window.location.origin,console.log(`[AppInit Network Service] Connection Configuration not found. Creating configuration using Auto-Discovery URL: ${this.config.signalKUrl}`),this.setLocalStorageConfig()),this.config.configVersion==9&&(this.config.configVersion=10,this.setLocalStorageConfig(),console.log("[AppInit Network Service] Upgrading Connection version from 9 to 10")),this.config.configVersion==10&&(this.config.configVersion=11,this.setLocalStorageConfig(),console.log("[AppInit Network Service] Upgrading Connection version from 10 to 11")),this.config.configVersion==11&&(this.config.configVersion=12,this.setLocalStorageConfig(),console.log("[AppInit Network Service] Upgrading Connection version from 11 to 12"))}preloadFonts(){let t=[{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmSU5fChc4AMP6lbBP.woff2)",options:{weight:"300",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmSU5fBBc4AMP6lQ.woff2)",options:{weight:"300",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOmCnqEu92Fr1Mu7GxKKTU1Kvnz.woff2)",options:{weight:"400",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2)",options:{weight:"400",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmEU9fChc4AMP6lbBP.woff2)",options:{weight:"500",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmEU9fBBc4AMP6lQ.woff2)",options:{weight:"500",style:"normal"}}];for(let{family:e,src:o,options:r}of t){let d=new FontFace(e,o,r);d.load().then(()=>document.fonts.add(d)).catch(m=>console.log(`[AppInit Network Service] Error loading fonts: ${m}`))}}ngOnDestroy(){this.loggedInSubscription?.unsubscribe()}static \u0275fac=function(e){return new(e||i)};static \u0275prov=C({token:i,factory:i.\u0275fac})}return i})();var vi=["upgradeMessages"];function bi(i,c){if(i&1&&(a(0,"li"),l(1),s()),i&2){let t=c.$implicit;p(),q(t)}}function Ci(i,c){if(i&1&&(a(0,"ul",11,1),F(2,bi,2,1,"li",null,J),s()),i&2){let t=u(2);p(2),K(t.upgrade.messages())}}function Si(i,c){if(i&1&&(a(0,"div",7)(1,"div",8),I(2,"mat-progress-spinner",9),a(3,"div",10)(4,"h3"),l(5,"Upgrading Configuration\u2026"),s(),a(6,"p"),l(7,"Please wait a moment while we migrate your dashboards and widgets."),s(),v(8,Ci,4,0,"ul",11),s()()()),i&2){let t=u();p(8),b(t.upgrade.messages().length?8:-1)}}var je=(()=>{class i{_deltaService=n(B);_connectionStateMachine=n(L);_appNetworkInit=n(W);_historySeriesReconcile=n(xe);authenticationService=n(D);_dataSet=n(H);_dashboard=n(A);_remoteControl=n(He);toast=n(ne);_notifications=n(E);_uiEvent=n(dt);_dialog=n(be);settings=n(x);_responsive=n(Vt);_destroyRef=n(Y);_notificationOverlay=n(Be);_router=n(k);upgrade=n(ve);upgradeMessagesRef=tt("upgradeMessages");_upgradeShown=!1;actionsSidenavOpened=_t(!1);notificationsSidenavOpened=_t(!1);notificationsInfo=h(this._notifications.observerNotificationsInfo());bootstrapStatus=h(this._appNetworkInit.bootstrapStatus$,{initialValue:"starting"});bootstrapIssue=h(this._appNetworkInit.bootstrapIssue$,{initialValue:{reason:"none"}});dashboardVisible=kt(!1);isPhonePortrait;scheduledOpen=null;OPEN_DELAY_MS=300;missingConfigPromptShown=!1;_swipeLeftHandler=()=>this.onSwipeLeft();_swipeRightHandler=()=>this.onSwipeRight();_hotkeyHandler=t=>this.handleKeyDown(t);constructor(){w(()=>{if(this.settings.configUpgrade()){let t=this.settings.getConfigVersion();t===11&&this.upgrade.runUpgrade(t),t||this._upgradeShown||(this._upgradeShown=!0,this._dialog.openFrameDialog({title:"Upgrade Instructions",component:"upgrade-config"},!0).pipe(R(this._destroyRef)).subscribe())}}),w(()=>{let t=this.upgrade.messages();if(this.upgrade.upgrading()&&t.length&&this.upgradeMessagesRef()){let e=this.upgradeMessagesRef().nativeElement;e.scrollTop=e.scrollHeight}});try{this.dashboardVisible.set(this.isUrlDashboard(this._router.url))}catch(t){}this._router.events.pipe(U(t=>t instanceof rt),R(this._destroyRef)).subscribe(t=>{try{this.dashboardVisible.set(this.isUrlDashboard(t.urlAfterRedirects||t.url))}catch(e){}}),w(()=>{let t=this.dashboardVisible()&&this._dashboard.isDashboardStatic()&&this.notificationsInfo().alarmCount>0;if(this.notificationsSidenavOpened()){this.scheduledOpen&&(clearTimeout(this.scheduledOpen),this.scheduledOpen=null);try{this._notificationOverlay.close()}catch(o){}return}if(t){if(this.scheduledOpen)return;this.scheduledOpen=window.setTimeout(()=>{this.scheduledOpen=null;try{this._notificationOverlay.open()}catch(o){}},this.OPEN_DELAY_MS)}else{this.scheduledOpen&&(clearTimeout(this.scheduledOpen),this.scheduledOpen=null);try{this._notificationOverlay.close()}catch(o){}}}),w(()=>{if(this.notificationsSidenavOpened())try{this._notificationOverlay.close()}catch(e){}}),this.isPhonePortrait=h(this._responsive.observe(jt.HandsetPortrait)),this._connectionStateMachine.status$.pipe(R(this._destroyRef)).subscribe(t=>this.displayConnectionsStatusNotification(t)),w(()=>{let t=this.bootstrapIssue();if(t.reason!=="missing-shared-config"||this.missingConfigPromptShown)return;this.missingConfigPromptShown=!0;let e=t.sharedConfigName||"default",o=t.legacyUpgradeAvailable===!0,r=o?"Upgrade":"Create",d=o?`Server is reachable, but no current version shared configuration '${e}' exists for this user. A legacy configuration was found and can be upgraded. Upgrade now?`:`Server is reachable, but no shared configuration '${e}' exists for this user. Create a default configuration now?`;this.toast.show(d,0,!0,"warn",r).onAction().pipe(R(this._destroyRef)).subscribe(()=>{o?this.upgrade.runUpgrade():this.settings.resetSettings()})})}isUrlDashboard(t){if(!t)return!1;let e=t.split("?")[0].replace(/\/+$/,"");return e==="/"||e==="/dashboard"||/^\/dashboard(\/\d+)?$/.test(e)||e==="/chartplotter"||/^\/chartplotter(\/\d+)?$/.test(e)}ngOnInit(){this._uiEvent.addGestureListeners(this._swipeLeftHandler,this._swipeRightHandler)}ngAfterViewInit(){this._uiEvent.addHotkeyListener(this._hotkeyHandler,{ctrlKey:!0,keys:["arrowright","arrowleft"]})}handleKeyDown(t){switch(t){case"arrowright":this.onSwipeRight();break;case"arrowleft":this.onSwipeLeft();break;case"escape":this.backdropClicked();break}}escapeKeyPressed(t){t=t.toLowerCase(),t==="escape"&&this.backdropClicked()}displayConnectionsStatusNotification(t){let e=t.message,o=this.bootstrapStatus()!=="ready";switch(t.operation){case 0:this.toast.show(e,5e3,!0);break;case 1:case 2:break;case 3:this.toast.show(e,3e3,o,"warn");break;case 4:this.toast.show(e,3e3,!0,"info");break;case 5:this.toast.show(e,0,o);break;default:console.error("[AppComponent] Unknown operation code:",t.operation),this.toast.show(`Unknown connection status: ${t.state}`,0,o,"error")}}onSwipeRight(){this._dashboard.isDashboardStatic()&&!this._uiEvent.isDragging()&&(this.isPhonePortrait().matches?(this.actionsSidenavOpened.set(!1),this.notificationsSidenavOpened.set(!0)):(this.actionsSidenavOpened.set(!1),this.notificationsSidenavOpened.update(t=>!t)))}backdropClicked(){this.notificationsSidenavOpened.update(t=>t?!t:!1),this.actionsSidenavOpened.update(t=>t?!t:!1)}onSwipeLeft(){this._dashboard.isDashboardStatic()&&!this._uiEvent.isDragging()&&(this.isPhonePortrait().matches?(this.notificationsSidenavOpened.set(!1),this.actionsSidenavOpened.set(!0)):(this.notificationsSidenavOpened.set(!1),this.actionsSidenavOpened.update(t=>!t)))}ngOnDestroy(){this._uiEvent.removeGestureListeners(this._swipeLeftHandler,this._swipeRightHandler),this._uiEvent.removeHotkeyListener(this._hotkeyHandler),this.scheduledOpen&&(clearTimeout(this.scheduledOpen),this.scheduledOpen=null)}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=P({type:i,selectors:[["app-root"]],viewQuery:function(e,o){e&1&&X(o.upgradeMessagesRef,vi,5),e&2&&Z()},inputs:{actionsSidenavOpened:[1,"actionsSidenavOpened"],notificationsSidenavOpened:[1,"notificationsSidenavOpened"]},outputs:{actionsSidenavOpened:"actionsSidenavOpenedChange",notificationsSidenavOpened:"notificationsSidenavOpenedChange"},decls:9,vars:6,consts:[["actionsSidenav",""],["upgradeMessages",""],["kipGestures","",1,"sidenav-container",3,"swipeleft","swiperight","backdropClick","mode","bridgeUiEvents"],["mode","over","position","start","autoFocus","true","disableClose","",1,"sidenav-notifications",3,"openedChange","keydown","opened"],["mode","over","position","end","autoFocus","true","disableClose","",1,"sidenav-actions",3,"openedChange","keydown","opened"],[3,"actionsSidenav"],[1,"router-outlet-container"],["role","alert","aria-live","polite",1,"config-upgrade-overlay"],[1,"config-upgrade-card"],["diameter","46","mode","indeterminate"],[1,"config-upgrade-text"],[1,"config-upgrade-messages"]],template:function(e,o){if(e&1){let r=S();a(0,"mat-sidenav-container",2),f("swipeleft",function(){return o.onSwipeLeft()})("swiperight",function(){return o.onSwipeRight()})("backdropClick",function(){return o.backdropClicked()}),a(1,"mat-sidenav",3),gt("openedChange",function(m){return g(r),ht(o.notificationsSidenavOpened,m)||(o.notificationsSidenavOpened=m),_(m)}),f("keydown",function(m){return o.escapeKeyPressed(m.key)}),I(2,"menu-notifications"),s(),a(3,"mat-sidenav",4,0),gt("openedChange",function(m){return g(r),ht(o.actionsSidenavOpened,m)||(o.actionsSidenavOpened=m),_(m)}),f("keydown",function(m){return o.escapeKeyPressed(m.key)}),I(5,"menu-actions",5),s(),a(6,"mat-sidenav-content"),I(7,"router-outlet",6),s()(),v(8,Si,9,1,"div",7)}if(e&2){let r=Pt(4);M("mode","horizontal")("bridgeUiEvents",!0),p(),ut("opened",o.notificationsSidenavOpened),p(2),ut("opened",o.actionsSidenavOpened),p(2),M("actionsSidenav",r),p(3),b(o.upgrade.upgrading()?8:-1)}},dependencies:[Le,ze,N,ge,T,oe,te,De,Pe,Ne,Oe,Ft,Jt,Te,Ae],styles:[".sidenav-container[_ngcontent-%COMP%]{height:100%;width:100%;--mat-sidenav-scrim-color: color-mix(in srgb, var(--mat-sys-neutral-variant20) 70%, transparent)}mat-sidenav-content[_ngcontent-%COMP%]{overflow-y:hidden;overflow-x:hidden}mat-sidenav[_ngcontent-%COMP%]{box-shadow:0 0 1px 0 var(--kip-contrast-color)}mat-sidenav.sidenav-notifications[_ngcontent-%COMP%]{width:230px;z-index:1200}mat-sidenav.sidenav-actions[_ngcontent-%COMP%]{width:135px;z-index:1200;overflow-x:hidden}.config-upgrade-overlay[_ngcontent-%COMP%]{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#00000073;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);z-index:2000;pointer-events:all}.config-upgrade-card[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:18px;padding:20px 24px;width:clamp(300px,60vw,640px);background:var(--kip-background, #1f1f1f);border:1px solid rgba(255,255,255,.18);border-radius:14px;color:var(--kip-contrast-color, #fff);box-shadow:0 6px 22px #0000008c}.config-upgrade-text[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 4px;font-size:1.05rem;font-weight:600;letter-spacing:.5px}.config-upgrade-text[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0 0 10px;font-size:.8rem;opacity:.85}.config-upgrade-messages[_ngcontent-%COMP%]{list-style:disc;margin:0;padding-left:18px;max-height:180px;font-size:.68rem;line-height:1.25;scrollbar-width:thin;overflow-y:auto}.config-upgrade-messages[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin-bottom:2px}"]})}return i})();var We=(()=>{class i{auth=n(D);authToken=null;authTokenSubscription=null;constructor(){this.authTokenSubscription=this.auth.authToken$.subscribe(t=>{this.authToken=t})}intercept(t,e){let o=t.clone();return this.authToken&&(o=t.clone({headers:t.headers.set("authorization","JWT "+this.authToken.token)})),e.handle(o)}ngOnDestroy(){this.authTokenSubscription?.unsubscribe()}static \u0275fac=function(e){return new(e||i)};static \u0275prov=C({token:i,factory:i.\u0275fac})}return i})();var Ge=(()=>{class i extends it{_createContainer(){let t=document.createElement("div");t.classList.add("cdk-overlay-container"),(document.getElementById("app-filter-wrapper")||document.querySelector("app-root")||document.body).appendChild(t),this._containerElement=t}static \u0275fac=(()=>{let t;return function(o){return(t||(t=It(i)))(o||i)}})();static \u0275prov=C({token:i,factory:i.\u0275fac})}return i})();var Qe=(()=>{class i{_router=n(k);_dialog=n(re);_bottomSheet=n(Ce);_destroyRef=n(Y);constructor(){this._router.events.pipe(U(t=>t instanceof Zt),R(this._destroyRef)).subscribe(()=>{this._dialog.openDialogs.length>0&&this._dialog.closeAll(),this._bottomSheet.dismiss()})}static \u0275fac=function(e){return new(e||i)};static \u0275prov=C({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();Ue.production&&void 0;Bt(je,{providers:[Ut(),xt(zt),{provide:Ht,useClass:We,multi:!0},{provide:ae,useValue:{hasBackdrop:!0,disableClose:!1,autoFocus:"first-tabbable",delayFocusTrap:!0,backdropClass:"dialogBackdrop"}},{provide:se,useValue:{appearance:"outline",floatLabel:"always",subscriptSizing:"dynamic"}},{provide:me,useValue:{showDelay:1500,hideDelay:0}},D,z,nt,B,L,H,A,de,W,x,E,he,at,Ee(),$t(qt()),ee(Re,ie()),{provide:it,useClass:Ge},ft(()=>n(W).initNetworkServices()),ft(()=>{n(Qe)})]});
|
|
1
|
+
import{a as xe,b as vt}from"./chunk-VWLWXBLE.js";import{a as Ft,b as A,c as H,i as he,k as E,l as _e,m as lt,o as ve,p as be,s as Ce,u as dt}from"./chunk-ZWTP4TAR.js";import{a as Ie}from"./chunk-AZC2WKQI.js";import{c as le}from"./chunk-XX365EOU.js";import{a as Oe,b as Pe,c as Ne,d as De,e as Ae,f as Te}from"./chunk-BGGO4PGD.js";import{a as ke}from"./chunk-IENESD5Q.js";import{c as pe,d as Se,g as ye,h as we,j as Me}from"./chunk-YY4ZUJFI.js";import{b as Ee}from"./chunk-POMIQBAL.js";import{e as ge}from"./chunk-CSIELI2Z.js";import{c as de,d as me,e as fe,f as ue}from"./chunk-4YDVZHMH.js";import{o as st,p as ct,q as B,r as z}from"./chunk-M37BLWHF.js";import{a as Zt,b as rt,d as te,e as k,g as ee,h as ie,i as oe}from"./chunk-WJFXI5PQ.js";import{a as ce}from"./chunk-HSKVTFFQ.js";import{f as ae,g as re,t as se}from"./chunk-MXUEYEZU.js";import{c as Lt,e as Xt,g as ot,h as L,i as nt,k as D,l as at,m as x,n as ne}from"./chunk-2GOHQZH5.js";import{A as yt,Aa as Y,Ab as F,Ac as Et,Ad as Ht,Bb as K,Cb as M,Cd as $t,Db as a,Dd as qt,Eb as s,Ec as Rt,Ee as it,Fa as kt,Fb as I,Fc as tt,Ga as w,Hc as _t,Ia as It,Ic as Ut,K as U,Ke as Yt,Mb as S,Ne as Jt,Ob as f,Oe as R,Pe as h,Qb as u,Re as V,Se as T,U as wt,Va as p,Vd as jt,Yb as X,Zb as Z,_b as Pt,a as Ct,ac as Nt,ba as Mt,c as St,cd as Kt,ce as Wt,dc as l,ec as q,f as $,fb as P,fc as Dt,ge as et,he as Gt,jc as ut,je as N,ka as C,kc as ht,ke as Qt,lc as gt,m as mt,pa as n,qb as ft,ra as xt,ua as g,ub as Ot,uc as At,va as _,vd as Vt,wb as v,wc as Tt,wd as Bt,xb as b,xd as zt,ya as Q,yb as J,z as G,zc as j}from"./chunk-PZ6I6W3H.js";var pt=(i,c)=>{let t=n(x),e=n(k),o=t.getSplitShellEnabled(),r="/"+c.map(y=>y.path).join("/"),d=r.startsWith("/chartplotter"),m=r.startsWith("/dashboard");if(o&&m&&!d){let y=c.length>1?c[1].path:void 0;return e.createUrlTree(["chartplotter",y??""])}if(!o&&d){let y=c.length>1?c[1].path:void 0;return e.createUrlTree(["dashboard",y??""])}return!0};var Re=[{path:"dashboard/:id",component:vt,canMatch:[pt]},{path:"chartplotter/:id",loadComponent:()=>import("./chunk-M7IEGA73.js").then(i=>i.SplitShellComponent),canMatch:[pt]},{path:"settings",loadComponent:()=>import("./chunk-5LDDCAOJ.js").then(i=>i.SettingsComponent),title:"KIP - Settings"},{path:"options",loadComponent:()=>import("./chunk-BAG3QIDK.js").then(i=>i.TabsComponent),title:"KIP - Options"},{path:"remote",loadComponent:()=>import("./chunk-BQPPRM7O.js").then(i=>i.RemoteControlComponent),title:"KIP - Remote Control"},{path:"help/:page",loadComponent:()=>import("./chunk-SUWMN3AE.js").then(i=>i.AppHelpComponent),title:"KIP - Help"},{path:"help",loadComponent:()=>import("./chunk-SUWMN3AE.js").then(i=>i.AppHelpComponent),title:"KIP - Help"},{path:"data",loadComponent:()=>import("./chunk-AQROQY2F.js").then(i=>i.DataInspectorComponent),title:"KIP - Data Inspector"},{path:"login",loadComponent:()=>import("./chunk-PTLDR7X7.js").then(i=>i.WidgetLoginComponent),title:"Login"},{path:"**",component:vt,canMatch:[pt]}];var Ue={production:!0};var Ye=(i,c)=>c.path;function Je(i,c){i&1&&(a(0,"mat-icon"),l(1,"info"),s())}function Xe(i,c){i&1&&(a(0,"mat-icon"),l(1,"info"),s())}function Ze(i,c){i&1&&(a(0,"mat-icon",3),l(1,"report"),s())}function ti(i,c){i&1&&(a(0,"mat-icon",4),l(1,"warning"),s())}function ei(i,c){i&1&&(a(0,"mat-icon",5),l(1,"error"),s())}function ii(i,c){i&1&&(a(0,"mat-icon",6),l(1,"emergency_home"),s())}function oi(i,c){if(i&1){let t=S();a(0,"div",2),v(1,Je,2,0,"mat-icon")(2,Xe,2,0,"mat-icon")(3,Ze,2,0,"mat-icon",3)(4,ti,2,0,"mat-icon",4)(5,ei,2,0,"mat-icon",5)(6,ii,2,0,"mat-icon",6),a(7,"div",7),l(8),s(),a(9,"div",8),l(10),At(11,"slice"),s(),a(12,"div",9),l(13),s(),a(14,"button",10),f("click",function(){let o=g(t).$implicit,r=u();return _(r.silence(o.path))}),a(15,"mat-icon"),l(16,"music_off"),s()(),a(17,"button",11),f("click",function(){let o=g(t).$implicit,r=u();return _(r.clear(o.path))}),a(18,"mat-icon"),l(19,"published_with_changes"),s()()(),I(20,"mat-divider",12)}if(i&2){let t,e=c.$implicit;p(),b((t=e.value.state)==="nominal"?1:t==="normal"?2:t==="alert"?3:t==="warn"?4:t==="alarm"?5:t==="emergency"?6:-1),p(7),q(e.value.state),p(2),Dt(" ",Tt(11,5,e.path,14)," "),p(3),q(e.value.message),p(),M("disabled",!(e.value.method!=null&&e.value.method.includes("sound")))}}function ni(i,c){i&1&&(a(0,"mat-list-item",13)(1,"span",15),l(2,"Notifications Disabled"),s(),a(3,"span")(4,"i"),l(5,"*Enable notifications in Settings."),s()()())}function ai(i,c){i&1&&(a(0,"mat-list-item",14)(1,"i"),l(2,'"No Notification"'),s()())}function ri(i,c){if(i&1&&v(0,ni,6,0,"mat-list-item",13)(1,ai,3,0,"mat-list-item",14),i&2){let t=u();b(t.notificationConfig().disableNotifications?0:1)}}function si(i,c){if(i&1){let t=S();a(0,"button",17),f("click",function(){g(t);let o=u(2);return _(o.mutePlayer(!o.isMuted))}),a(1,"span",18),l(2,"volume_up"),s(),l(3," Unmute Audio "),s()}}function ci(i,c){if(i&1){let t=S();a(0,"button",17),f("click",function(){g(t);let o=u(2);return _(o.mutePlayer(!o.isMuted))}),a(1,"span",18),l(2,"volume_off"),s(),l(3," Mute Audio "),s()}}function li(i,c){if(i&1&&v(0,si,4,0,"button",16)(1,ci,4,0,"button",16),i&2){let t=u();b(t.isMuted?0:1)}}var Le=(()=>{class i{_notificationsService=n(E);_notifications$=this._notificationsService.observeNotifications();notificationConfig=h(this._notificationsService.observeNotificationConfiguration(),{requireSync:!0});menuNotifications=h(yt([this._notifications$,this._notificationsService.observeNotificationConfiguration()]).pipe(G(([t,e])=>{let o=[];return e.devices.showNormalState||o.push(st.Normal),e.devices.showNominalState||o.push(st.Nominal),t.filter(r=>r.value&&r.value.state&&!o.includes(r.value.state)).filter(r=>{let d=r.value?.method;return d?.length?d.includes(ct.Visual)||d.includes(ct.Sound):!1})})),{requireSync:!0,equal:Xt});isMuted=!1;mutePlayer(t){this.isMuted=t,this._notificationsService.mutePlayer(t)}silence(t){this._notificationsService.setSkMethod(t,[ct.Visual])}clear(t){this._notificationsService.setSkState(t,st.Normal)}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=P({type:i,selectors:[["menu-notifications"]],decls:6,vars:2,consts:[[1,"menu-item-container"],[1,"actions-container","actions-bottom-container"],[1,"notification-container"],[1,"icon-alert-color"],[1,"icon-warn-color"],[1,"icon-alarm-color"],[1,"icon-emergency-color"],[1,"notification-title"],[1,"notification-path","scrollable-text"],[1,"notification-text"],["mat-icon-button","",1,"notification-action-btn",3,"click","disabled"],["mat-icon-button","",1,"notification-action-btn",3,"click"],[1,"notification-divider"],["lines","3","disabled","true",2,"text-align","center"],["disabled","true",2,"text-align","center"],["matListItemTitle",""],["mat-flat-button","","matTooltip","Temporally toggle all notification audio. To permanently disable/enable notification audio, use the configuration settings option",1,"action-button"],["mat-flat-button","","matTooltip","Temporally toggle all notification audio. To permanently disable/enable notification audio, use the configuration settings option",1,"action-button",3,"click"],[1,"material-icons"]],template:function(e,o){e&1&&(a(0,"mat-list",0),F(1,oi,21,8,null,null,Ye,!1,ri,2,1),s(),a(4,"div",1),v(5,li,2,1),s()),e&2&&(p(),K(o.menuNotifications()),p(4),b(o.notificationConfig().disableNotifications?-1:5))},dependencies:[Me,ye,we,ce,Se,N,et,Wt,lt,ue,fe,T,V,Kt],styles:[".notification-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-evenly;padding:2px 10px 7px;scroll-behavior:smooth}mat-icon[_ngcontent-%COMP%]{margin-right:10px}.scrollable-text[_ngcontent-%COMP%]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.scrollable-text[_ngcontent-%COMP%]:hover{overflow:auto;white-space:normal;word-wrap:break-word}.notification-title[_ngcontent-%COMP%]{text-transform:capitalize;font-size:var(--mat-sys-headline-small-size);width:calc(100% - 34px)}.notification-path[_ngcontent-%COMP%]{font-size:var(--mat-sys-body-small-size);word-break:break-all;width:100%}.notification-text[_ngcontent-%COMP%]{font-size:var(--mat-sys-body-small-line-height);font-style:italic;width:100%;overflow:auto;white-space:normal;word-wrap:break-word}.notification-action-btn[_ngcontent-%COMP%]{background-color:var(--mat-sys-surface-container)}.notification-btn-container[_ngcontent-%COMP%]{display:inline-block;width:50%;height:48px;text-align:center}.menu-item-container[_ngcontent-%COMP%]{width:230px;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;height:calc(100% - 48px)}.notification-bottom-container[_ngcontent-%COMP%]{position:absolute;bottom:0;width:100%;background-color:var(--mat-sys-surface-container)}.actions-container[_ngcontent-%COMP%]{display:grid;grid-auto-flow:column}.actions-bottom-container[_ngcontent-%COMP%]{position:absolute;bottom:0;width:100%;height:48px}.action-button[_ngcontent-%COMP%]{border-radius:0;height:48px;border-bottom-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large))}.icon-alert-color[_ngcontent-%COMP%]{color:var(--kip-zone-alert-color)}.icon-warn-color[_ngcontent-%COMP%]{color:var(--kip-zone-warn-color)}.icon-alarm-color[_ngcontent-%COMP%]{color:var(--kip-zone-alarm-color)}.icon-emergency-color[_ngcontent-%COMP%]{color:var(--kip-zone-emergency-color)}.alarm-emergency-blink[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_blinking-emergency 1.5s infinite}@keyframes _ngcontent-%COMP%_blinking-emergency{0%{background-color:var(--kip-zone-alarm-color)}50%{background-color:transparent}to{background-color:var(--kip-zone-alarm-color)}}.warn[_ngcontent-%COMP%]{color:var(--kip-zone-warn-color)}.notification-divider[_ngcontent-%COMP%]{padding-top:10px}"],changeDetection:0})}return i})();var di=["badgeButton"],Ve=(()=>{class i{badgeButton=tt.required("badgeButton");_notifications=n(E);notificationsInfo=h(this._notifications.observerNotificationsInfo());openNotificationMenu(){let t=new Event("openRightSidenav",{bubbles:!0,cancelable:!0});window.document.dispatchEvent(t)}onKeyDown(t){let e=t.key?.toLowerCase();(e==="enter"||e===" "||e==="spacebar")&&(t.preventDefault(),this.openNotificationMenu())}focus(){try{let t=this.badgeButton&&this.badgeButton(),e=t&&t.nativeElement;e&&typeof e.focus=="function"&&e.focus()}catch(t){}}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=P({type:i,selectors:[["notification-badge"]],viewQuery:function(e,o){e&1&&X(o.badgeButton,di,5),e&2&&Z()},decls:5,vars:7,consts:[["badgeButton",""],["mat-fab","","role","button","aria-label","Open notifications",1,"layout-action-btn",3,"click","keydown"],["aria-hidden","false","matBadgeSize","large","matBadgePosition","after","matBadgeOverlap","true",1,"icon-alert-color",3,"matBadgeHidden","matBadge"]],template:function(e,o){e&1&&(a(0,"div")(1,"button",1,0),f("click",function(){return o.openNotificationMenu()})("keydown",function(d){return o.onKeyDown(d)}),a(3,"mat-icon",2),l(4,"notifications "),s()()()),e&2&&(p(),Nt("warn",o.notificationsInfo().isWarn)("alarm-emergency-blink",o.notificationsInfo().isAlarmEmergency),Ot("aria-haspopup",!0),p(2),M("matBadgeHidden",!o.notificationsInfo().alarmCount)("matBadge",o.notificationsInfo().alarmCount))},dependencies:[N,Gt,T,V,lt,_e],styles:["[_nghost-%COMP%]{display:block}.layout-action-btn[_ngcontent-%COMP%]{color:var(--mat-sys-on-primary);background-color:var(--mat-sys-primary)}.icon-alert-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-alert-color)}.icon-warn-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-warn-color)}.icon-alarm-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-alarm-color)}.icon-emergency-color[_ngcontent-%COMP%]{--mat-list-list-item-leading-icon-color: var(--kip-zone-emergency-color)}.alarm-emergency-blink[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_blinking-emergency 1.5s infinite}@keyframes _ngcontent-%COMP%_blinking-emergency{0%{background-color:var(--kip-zone-alarm-color)}50%{background-color:var(--mat-sys-primary)}to{background-color:var(--kip-zone-alarm-color)}}.warn[_ngcontent-%COMP%]{color:var(--kip-zone-warn-color)}"]})}return i})();var Be=(()=>{class i{overlayRef=null;overlay=n(Yt);injector=n(Q);open(){if(this.overlayRef)return;this.overlayRef=this.overlay.create({hasBackdrop:!1,panelClass:"notification-overlay-panel",positionStrategy:this.overlay.position().global().bottom("20px").left("20px"),scrollStrategy:this.overlay.scrollStrategies.reposition()});let t=new Qt(Ve,null,this.injector),e=this.overlayRef.attach(t);try{let o=e&&e.instance;if(o&&typeof o.focus=="function")o.focus();else{let r=this.overlayRef.overlayElement,d=r&&r.querySelector("button[mat-fab], .layout-action-btn");d&&typeof d.focus=="function"&&d.focus()}}catch(o){}}close(){try{this.overlayRef&&this.overlayRef.dispose()}catch(t){console.warn("[NotificationOverlayService] dispose failed",t)}finally{this.overlayRef=null}}toggle(t){t?this.open():this.close()}isOpen(){return!!this.overlayRef}ngOnDestroy(){try{this.overlayRef&&this.overlayRef.dispose()}catch(t){}finally{this.overlayRef=null}}static \u0275fac=function(e){return new(e||i)};static \u0275prov=C({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();function pi(i,c){if(i&1){let t=S();a(0,"button",12),f("click",function(){g(t);let o=u(2);return _(o.onActionItem("toggleFullScreen"))}),a(1,"span",10),l(2,"fullscreen"),s()()}}function mi(i,c){if(i&1){let t=S();a(0,"button",12),f("click",function(){g(t);let o=u(2);return _(o.onActionItem("toggleFullScreen"))}),a(1,"span",10),l(2,"close_fullscreen"),s()()}}function fi(i,c){if(i&1&&v(0,pi,3,0,"button",11)(1,mi,3,0,"button",11),i&2){let t=u();b(t.uiEvent.fullscreenStatus()?1:0)}}function ui(i,c){if(i&1){let t=S();a(0,"button",14),f("click",function(){g(t);let o=u(2);return _(o.onActionItem("nightMode"))}),a(1,"span",10),l(2,"mode_night"),s()()}}function hi(i,c){if(i&1){let t=S();a(0,"button",14),f("click",function(){g(t);let o=u(2);return _(o.onActionItem("nightMode"))}),a(1,"span",10),l(2,"light_mode"),s()()}}function gi(i,c){if(i&1&&v(0,ui,3,0,"button",13)(1,hi,3,0,"button",13),i&2){let t=u();b(t.app.isNightMode()?1:0)}}function _i(i,c){if(i&1){let t=S();a(0,"tile-large-icon",15,1),f("click",function(){let o=g(t).$index,r=u();return _(r.navigateToDashboard(o))}),s()}if(i&2){let t=c.$implicit;M("active",t.active)("svgIcon",t.svgIcon)("iconSize",t.iconSize)("label",t.label)}}var ze=(()=>{class i{actionsSidenav=Rt.required();_router=n(k);uiEvent=n(dt);dashboard=n(A);app=n(le);_settings=n(x);isAutoNightMode=h(this._settings.getAutoNightModeAsO(),{requireSync:!0});_initialDashboardMatch=(()=>{let e=this._router.parseUrl(this._router.url).root.children.primary,o=e?e.segments.map(r=>r.path):[];return o.length===0||o[0]==="dashboard"||o[0]==="chartplotter"})();isDashboardContext=h(this._router.events.pipe(U(t=>t instanceof rt),Mt(null),G(()=>{let e=this._router.parseUrl(this._router.url).root.children.primary,o=e?e.segments.map(r=>r.path):[];return o.length===0||o[0]==="dashboard"||o[0]==="chartplotter"}),wt()),{initialValue:this._initialDashboardMatch});menuItems=Et(()=>{let t=this.dashboard.dashboards(),e=this.dashboard.activeDashboard();return t.map((o,r)=>({id:Number(o.id),active:r===e,pinned:!1,svgIcon:o.icon||"dashboard-dashboard",iconSize:60,label:o.name||`Dashboard ${r+1}`}))});ngAfterViewInit(){this.uiEvent.addHotkeyListener((t,e)=>this.handleKeyDown(t,e),{ctrlKey:!0,shiftKey:!0,keys:["e","f","n"]})}ngOnDestroy(){this.uiEvent.removeHotkeyListener(this.handleKeyDown.bind(this))}handleKeyDown(t,e){switch(t){case"e":this.onActionItem("layout");break;case"f":this.onActionItem("toggleFullScreen");break;case"n":this.onActionItem("nightMode");break;default:break}}onActionItem(t){switch(this.actionsSidenav().close(),t){case"toggleFullScreen":this.uiEvent.toggleFullScreen();break;case"settings":this._router.navigate(["/settings"]);break;case"layout":this.dashboard.setStaticDashboard(!1);break;case"nightMode":this.app.isNightMode.set(!this.app.isNightMode()),this.app.toggleDayNightMode();break;default:break}}navigateToDashboard(t){this.actionsSidenav().close(),this._router.navigate([`dashboard/${t}`])}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=P({type:i,selectors:[["menu-actions"]],inputs:{actionsSidenav:[1,"actionsSidenav"]},decls:14,vars:3,consts:[["tileContainer",""],["tile",""],[1,"actions-container"],[1,"actions-top-container"],["mat-flat-button","","tabindex","0",1,"action-button","home-btn",3,"click"],["height","24px","width","24px","svgIcon","kip","aria-hidden","false",1,"home-icon",2,"height","24px","width","24px"],[1,"menu-item-container"],[3,"active","svgIcon","iconSize","label"],[1,"actions-bottom-container"],["mat-flat-button","",1,"action-button",2,"width","135px",3,"click","disabled"],[1,"material-icons"],["mat-flat-button","","tabindex","0",1,"action-button"],["mat-flat-button","","tabindex","0",1,"action-button",3,"click"],["mat-flat-button","",1,"action-button"],["mat-flat-button","",1,"action-button",3,"click"],[3,"click","active","svgIcon","iconSize","label"]],template:function(e,o){e&1&&(a(0,"div",2)(1,"div",3),v(2,fi,2,1),v(3,gi,2,1),a(4,"button",4),f("click",function(){return o.onActionItem("settings")}),I(5,"mat-icon",5),s()(),a(6,"div",6,0),F(8,_i,2,4,"tile-large-icon",7,J),s(),a(10,"div",8)(11,"button",9),f("click",function(){return o.onActionItem("layout")}),a(12,"span",10),l(13,"lock_open"),s()()()()),e&2&&(p(2),b(o.uiEvent.fullscreenSupported()?2:-1),p(),b(o.isAutoNightMode()?-1:3),p(5),K(o.menuItems()),p(3),M("disabled",!o.isDashboardContext()))},dependencies:[T,V,N,et,ke],styles:[".actions-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;width:135px}.actions-top-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}.actions-bottom-container[_ngcontent-%COMP%]{height:48px;width:100%}.action-button[_ngcontent-%COMP%]{border-radius:0;height:48px;flex:1 1 48px;min-height:0;overflow:hidden;border:1px solid var(--mat-sidenav-container-background-color, var(--mat-sys-surface))}.home-btn[_ngcontent-%COMP%]{--mat-icon-button-icon-size: 24px;--mat-button-filled-icon-offset: 0px;--mat-button-filled-icon-spacing: 0px;--mat-button-filled-label-text-size: 0px}.home-icon[_ngcontent-%COMP%] .mat-mdc-unelevated-button[_ngcontent-%COMP%] > .mat-icon[_ngcontent-%COMP%]{font-size:0px}.full-size[_ngcontent-%COMP%]{width:135px}.menu-item-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:nowrap;padding:3px 1px;gap:5px;width:135px;overflow-y:auto;scrollbar-width:none;overflow-x:hidden;scroll-behavior:smooth;flex:1 1 auto;min-height:0}"]})}return i})();var He=(()=>{class i{COMMAND_SET_DISPLAY_PATH="self.kip.remote.setDisplay";COMMAND_SET_SCREEN_INDEX_PATH="self.kip.remote.setScreenIndex";COMMAND_REQUEST_ACTIVE_SCREEN_PATH="self.kip.remote.requestActiveScreen";settings=n(x);dashboard=n(A);data=n(z);requests=n(pe);KIP_UUID=this.settings.KipUUID;ACTIVE_SCREEN_PATH=`self.displays.${this.KIP_UUID}.screenIndex`;CHANGE_SCREEN_PATH=`self.displays.${this.KIP_UUID}.activeScreen`;displayName=h(this.settings.getInstanceNameAsO());isRemoteControl=h(this.settings.getIsRemoteControlAsO());remoteScreenPosition=h(this.data.subscribePath(this.ACTIVE_SCREEN_PATH,"default"));changeDashboardTo=h(this.data.subscribePath(this.CHANGE_SCREEN_PATH,"default"));previousIsRemoteControl=!1;constructor(){this.setActiveDashboardOnRemote(this.KIP_UUID,null),this.setScreensOnRemote(this.KIP_UUID,null),this.clearActiveScreenOnRemote(this.KIP_UUID,null),console.log("[Remote Dashboards] Cleaning paths on server"),w(()=>{let t=this.isRemoteControl(),e=this.displayName();j(()=>{if(!t&&!this.previousIsRemoteControl)return;this.previousIsRemoteControl=t;let o;t?(o=this.getScreensPayload(this.dashboard.dashboards()),this.dashboard.activeDashboard()!==null&&this.setActiveDashboardOnRemote(this.KIP_UUID,this.dashboard.activeDashboard())):(o=null,this.clearActiveDashboardOnServer()),this.shareScreens(o)})}),w(()=>{let t=this.dashboard.dashboards();j(()=>{if(!this.isRemoteControl())return;let e=this.getScreensPayload(t);this.shareScreens(e)})}),w(()=>{let t=this.dashboard.activeDashboard();j(()=>{this.isRemoteControl()&&t!==null&&(this.setActiveDashboardOnRemote(this.KIP_UUID,t),console.log(`[Remote Dashboards] Sent new dashboard highlight index ${t} to server.`))})}),w(()=>{let t=this.changeDashboardTo();j(()=>{if(!this.isRemoteControl()||t.data.value==null)return;let e=Number(t.data.value);!isNaN(e)&&e>=0&&e<this.dashboard.dashboards().length&&this.dashboard.activeDashboard()!==e&&(this.dashboard.navigateTo(e),console.log(`[Remote Dashboards] Executed remote request to change active dashboard to: ${e}`))})})}clearActiveDashboardOnServer(){this.setActiveDashboardOnRemote(this.KIP_UUID,null),console.log("[Remote Dashboards] Disabled: Cleared active dashboard on server")}getScreensPayload(t){let e=this.displayName(),o=t.map(m=>{var y=m,{configuration:r}=y,d=St(y,["configuration"]);return d});return{displayName:e,screens:o}}shareScreens(t){this.setScreensOnRemote(this.KIP_UUID,t),console.log("[Remote Dashboards] Sending dashboard configurations to server.")}setActiveDashboardOnRemote(t,e){let o={displayId:t,screenIdx:e};this.requests.putRequest(this.COMMAND_SET_SCREEN_INDEX_PATH,o,this.KIP_UUID)||console.error("[Remote Dashboards] Error sharing active dashboard: request was not accepted")}setScreensOnRemote(t,e){let o={displayId:t,display:e===null?null:Ct({},e)};this.requests.putRequest(this.COMMAND_SET_DISPLAY_PATH,o,this.KIP_UUID)||console.error("[Remote Dashboards] Error sharing screen configuration: request was not accepted")}clearActiveScreenOnRemote(t,e){let o={displayId:t,screenIdx:e};this.requests.putRequest(this.COMMAND_REQUEST_ACTIVE_SCREEN_PATH,o,this.KIP_UUID)||console.error("[Remote Dashboards] Error clearing active screen request path: request was not accepted")}static \u0275fac=function(e){return new(e||i)};static \u0275prov=C({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var $e=11,qe="connectionConfig",W=(()=>{class i{config;isLoggedIn=null;loggedInSubscription=null;connection=n(nt);auth=n(D);connectionStateMachine=n(L);router=n(k);delta=n(B);data=n(z);storage=n(at);internetReachability=n(Ie);injector=n(Q);datasetService=null;_bootstrapStatus$=new mt("starting");_bootstrapIssue$=new mt({reason:"none"});constructor(){this.loggedInSubscription=this.auth.isLoggedIn$.subscribe(t=>{this.isLoggedIn=t})}initNetworkServices(){return $(this,null,function*(){let t=!1;this.loadLocalStorageConfig(),this.preloadFonts(),this.internetReachability.start();try{if(this.config?.signalKUrl!==void 0&&this.config.signalKUrl!==null&&(yield this.connection.initializeConnection({url:this.config.signalKUrl,new:!1},this.config.proxyEnabled,this.config.signalKSubscribeAll)),!this.isLoggedIn&&this.config?.signalKUrl&&this.config?.useSharedConfig&&this.config?.loginName&&this.config?.loginPassword&&(yield this.login()),this.isLoggedIn&&this.config?.useSharedConfig)if(yield this.storage.waitUntilReady()){let o=yield this.storage.getConfig("user",this.config.sharedConfigName,$e),r={sharedConfigName:this.config.sharedConfigName,configFileVersion:$e,initConfig:o};this.storage.bootstrapRemoteContext(r)}else throw new Error("[AppInit Network Service] StorageService did not become ready in time. Cannot bootstrap remote configuration.");this._bootstrapIssue$.next({reason:"none"}),yield this.getDatasetService().waitUntilReady(),!this.isLoggedIn&&this.config?.signalKUrl&&this.config?.useSharedConfig&&this.router.navigate(["/login"])}catch(e){if(t=!0,e?.status===404&&this.config?.useSharedConfig){let o=yield this.probeLegacyUpgradeAvailability(this.config.sharedConfigName);this._bootstrapIssue$.next({reason:"missing-shared-config",statusCode:404,sharedConfigName:this.config.sharedConfigName,legacyUpgradeAvailable:o})}else e?.status===0?this._bootstrapIssue$.next({reason:"network-unreachable",statusCode:0}):e?.status===401?this._bootstrapIssue$.next({reason:"unauthorized",statusCode:401}):this._bootstrapIssue$.next({reason:"unknown",statusCode:e?.status});e.status===0?(yield this.waitForHttpRetryCompletion())===ot.HTTPConnected||this.connectionStateMachine.isHTTPConnected()?console.warn("[AppInit Network Service] Initial connection recovered during retry cycle. Skipping fallback route."):(console.warn("[AppInit Network Service] Initialization failed after HTTP retries. Redirecting to settings page."),yield this.router.navigate(["/options"])):e.status===401?(console.warn("[AppInit Network Service] Initialization failed. Unauthorized access. Redirecting to login page."),yield this.router.navigate(["/login"])):(console.warn("[AppInit Network Service] Initialization failed. Error: ",JSON.stringify(e)),yield this.router.navigate(["/options"])),console.warn("[AppInit Network Service] Startup continuing in degraded mode to allow UI feedback."),this._bootstrapStatus$.next("degraded");return}finally{t||this._bootstrapStatus$.next("ready"),console.log("[AppInit Network Service] Initialization completed"),this.connectionStateMachine.enableWebSocketMode(),this.connectionStateMachine.isHTTPConnected()&&(console.log("[AppInit Network Service] Starting WebSocket connection after initialization"),this.connectionStateMachine.startWebSocketConnection())}})}get bootstrapStatus$(){return this._bootstrapStatus$.asObservable()}get bootstrapIssue$(){return this._bootstrapIssue$.asObservable()}getDatasetService(){return this.datasetService||(this.datasetService=this.injector.get(H)),this.datasetService}waitForHttpRetryCompletion(t){return $(this,null,function*(){let e=t??this.connectionStateMachine.getHttpRetryWindowMs(2e3),o=new Set([ot.HTTPConnected,ot.PermanentFailure]),r=this.connectionStateMachine.currentState;return o.has(r)?r:new Promise(d=>{let m=window.setTimeout(()=>{y.unsubscribe(),d(null)},e),y=this.connectionStateMachine.state$.subscribe(bt=>{o.has(bt)&&(clearTimeout(m),y.unsubscribe(),d(bt))})})})}probeLegacyUpgradeAvailability(t){return $(this,null,function*(){if(!t)return!1;try{return(yield this.storage.getConfig("user",t,9))?.app?.configVersion===10}catch(e){return!1}})}login(){return $(this,null,function*(){if(!this.isLoggedIn&&this.config.useSharedConfig&&this.config.loginName&&this.config.loginPassword)try{yield this.auth.login({usr:this.config.loginName,pwd:this.config.loginPassword})}catch(t){throw t.status===0?this.router.navigate(["/settings"]):t.status===401&&this.router.navigate(["/login"]),t}})}setLocalStorageConfig(){localStorage.setItem(qe,JSON.stringify(this.config))}loadLocalStorageConfig(){this.config=JSON.parse(localStorage.getItem(qe)),this.config?this.config.signalKUrl||(this.config.signalKUrl=window.location.origin,this.setLocalStorageConfig(),console.log(`[AppInit Network Service] Config found with no server URL. Setting Auto-Discovery URL: ${this.config.signalKUrl}`)):(this.config=Lt,this.config.signalKUrl=window.location.origin,console.log(`[AppInit Network Service] Connection Configuration not found. Creating configuration using Auto-Discovery URL: ${this.config.signalKUrl}`),this.setLocalStorageConfig()),this.config.configVersion==9&&(this.config.configVersion=10,this.setLocalStorageConfig(),console.log("[AppInit Network Service] Upgrading Connection version from 9 to 10")),this.config.configVersion==10&&(this.config.configVersion=11,this.setLocalStorageConfig(),console.log("[AppInit Network Service] Upgrading Connection version from 10 to 11")),this.config.configVersion==11&&(this.config.configVersion=12,this.setLocalStorageConfig(),console.log("[AppInit Network Service] Upgrading Connection version from 11 to 12"))}preloadFonts(){let t=[{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmSU5fChc4AMP6lbBP.woff2)",options:{weight:"300",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmSU5fBBc4AMP6lQ.woff2)",options:{weight:"300",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOmCnqEu92Fr1Mu7GxKKTU1Kvnz.woff2)",options:{weight:"400",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2)",options:{weight:"400",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmEU9fChc4AMP6lbBP.woff2)",options:{weight:"500",style:"normal"}},{family:"Roboto",src:"url(./assets/google-fonts/KFOlCnqEu92Fr1MmEU9fBBc4AMP6lQ.woff2)",options:{weight:"500",style:"normal"}}];for(let{family:e,src:o,options:r}of t){let d=new FontFace(e,o,r);d.load().then(()=>document.fonts.add(d)).catch(m=>console.log(`[AppInit Network Service] Error loading fonts: ${m}`))}}ngOnDestroy(){this.loggedInSubscription?.unsubscribe()}static \u0275fac=function(e){return new(e||i)};static \u0275prov=C({token:i,factory:i.\u0275fac})}return i})();var vi=["upgradeMessages"];function bi(i,c){if(i&1&&(a(0,"li"),l(1),s()),i&2){let t=c.$implicit;p(),q(t)}}function Ci(i,c){if(i&1&&(a(0,"ul",11,1),F(2,bi,2,1,"li",null,J),s()),i&2){let t=u(2);p(2),K(t.upgrade.messages())}}function Si(i,c){if(i&1&&(a(0,"div",7)(1,"div",8),I(2,"mat-progress-spinner",9),a(3,"div",10)(4,"h3"),l(5,"Upgrading Configuration\u2026"),s(),a(6,"p"),l(7,"Please wait a moment while we migrate your dashboards and widgets."),s(),v(8,Ci,4,0,"ul",11),s()()()),i&2){let t=u();p(8),b(t.upgrade.messages().length?8:-1)}}var je=(()=>{class i{_deltaService=n(B);_connectionStateMachine=n(L);_appNetworkInit=n(W);_historySeriesReconcile=n(xe);authenticationService=n(D);_dataSet=n(H);_dashboard=n(A);_remoteControl=n(He);toast=n(ne);_notifications=n(E);_uiEvent=n(dt);_dialog=n(be);settings=n(x);_responsive=n(Vt);_destroyRef=n(Y);_notificationOverlay=n(Be);_router=n(k);upgrade=n(ve);upgradeMessagesRef=tt("upgradeMessages");_upgradeShown=!1;actionsSidenavOpened=_t(!1);notificationsSidenavOpened=_t(!1);notificationsInfo=h(this._notifications.observerNotificationsInfo());bootstrapStatus=h(this._appNetworkInit.bootstrapStatus$,{initialValue:"starting"});bootstrapIssue=h(this._appNetworkInit.bootstrapIssue$,{initialValue:{reason:"none"}});dashboardVisible=kt(!1);isPhonePortrait;scheduledOpen=null;OPEN_DELAY_MS=300;missingConfigPromptShown=!1;_swipeLeftHandler=()=>this.onSwipeLeft();_swipeRightHandler=()=>this.onSwipeRight();_hotkeyHandler=t=>this.handleKeyDown(t);constructor(){w(()=>{if(this.settings.configUpgrade()){let t=this.settings.getConfigVersion();t===11&&this.upgrade.runUpgrade(t),t||this._upgradeShown||(this._upgradeShown=!0,this._dialog.openFrameDialog({title:"Upgrade Instructions",component:"upgrade-config"},!0).pipe(R(this._destroyRef)).subscribe())}}),w(()=>{let t=this.upgrade.messages();if(this.upgrade.upgrading()&&t.length&&this.upgradeMessagesRef()){let e=this.upgradeMessagesRef().nativeElement;e.scrollTop=e.scrollHeight}});try{this.dashboardVisible.set(this.isUrlDashboard(this._router.url))}catch(t){}this._router.events.pipe(U(t=>t instanceof rt),R(this._destroyRef)).subscribe(t=>{try{this.dashboardVisible.set(this.isUrlDashboard(t.urlAfterRedirects||t.url))}catch(e){}}),w(()=>{let t=this.dashboardVisible()&&this._dashboard.isDashboardStatic()&&this.notificationsInfo().alarmCount>0;if(this.notificationsSidenavOpened()){this.scheduledOpen&&(clearTimeout(this.scheduledOpen),this.scheduledOpen=null);try{this._notificationOverlay.close()}catch(o){}return}if(t){if(this.scheduledOpen)return;this.scheduledOpen=window.setTimeout(()=>{this.scheduledOpen=null;try{this._notificationOverlay.open()}catch(o){}},this.OPEN_DELAY_MS)}else{this.scheduledOpen&&(clearTimeout(this.scheduledOpen),this.scheduledOpen=null);try{this._notificationOverlay.close()}catch(o){}}}),w(()=>{if(this.notificationsSidenavOpened())try{this._notificationOverlay.close()}catch(e){}}),this.isPhonePortrait=h(this._responsive.observe(jt.HandsetPortrait)),this._connectionStateMachine.status$.pipe(R(this._destroyRef)).subscribe(t=>this.displayConnectionsStatusNotification(t)),w(()=>{let t=this.bootstrapIssue();if(t.reason!=="missing-shared-config"||this.missingConfigPromptShown)return;this.missingConfigPromptShown=!0;let e=t.sharedConfigName||"default",o=t.legacyUpgradeAvailable===!0,r=o?"Upgrade":"Create",d=o?`Server is reachable, but no current version shared configuration '${e}' exists for this user. A legacy configuration was found and can be upgraded. Upgrade now?`:`Server is reachable, but no shared configuration '${e}' exists for this user. Create a default configuration now?`;this.toast.show(d,0,!0,"warn",r).onAction().pipe(R(this._destroyRef)).subscribe(()=>{o?this.upgrade.runUpgrade():this.settings.resetSettings()})})}isUrlDashboard(t){if(!t)return!1;let e=t.split("?")[0].replace(/\/+$/,"");return e==="/"||e==="/dashboard"||/^\/dashboard(\/\d+)?$/.test(e)||e==="/chartplotter"||/^\/chartplotter(\/\d+)?$/.test(e)}ngOnInit(){this._uiEvent.addGestureListeners(this._swipeLeftHandler,this._swipeRightHandler)}ngAfterViewInit(){this._uiEvent.addHotkeyListener(this._hotkeyHandler,{ctrlKey:!0,keys:["arrowright","arrowleft"]})}handleKeyDown(t){switch(t){case"arrowright":this.onSwipeRight();break;case"arrowleft":this.onSwipeLeft();break;case"escape":this.backdropClicked();break}}escapeKeyPressed(t){t=t.toLowerCase(),t==="escape"&&this.backdropClicked()}displayConnectionsStatusNotification(t){let e=t.message,o=this.bootstrapStatus()!=="ready";switch(t.operation){case 0:this.toast.show(e,5e3,!0);break;case 1:case 2:break;case 3:this.toast.show(e,3e3,o,"warn");break;case 4:this.toast.show(e,3e3,!0,"info");break;case 5:this.toast.show(e,0,o);break;default:console.error("[AppComponent] Unknown operation code:",t.operation),this.toast.show(`Unknown connection status: ${t.state}`,0,o,"error")}}onSwipeRight(){this._dashboard.isDashboardStatic()&&!this._uiEvent.isDragging()&&(this.isPhonePortrait().matches?(this.actionsSidenavOpened.set(!1),this.notificationsSidenavOpened.set(!0)):(this.actionsSidenavOpened.set(!1),this.notificationsSidenavOpened.update(t=>!t)))}backdropClicked(){this.notificationsSidenavOpened.update(t=>t?!t:!1),this.actionsSidenavOpened.update(t=>t?!t:!1)}onSwipeLeft(){this._dashboard.isDashboardStatic()&&!this._uiEvent.isDragging()&&(this.isPhonePortrait().matches?(this.notificationsSidenavOpened.set(!1),this.actionsSidenavOpened.set(!0)):(this.notificationsSidenavOpened.set(!1),this.actionsSidenavOpened.update(t=>!t)))}ngOnDestroy(){this._uiEvent.removeGestureListeners(this._swipeLeftHandler,this._swipeRightHandler),this._uiEvent.removeHotkeyListener(this._hotkeyHandler),this.scheduledOpen&&(clearTimeout(this.scheduledOpen),this.scheduledOpen=null)}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=P({type:i,selectors:[["app-root"]],viewQuery:function(e,o){e&1&&X(o.upgradeMessagesRef,vi,5),e&2&&Z()},inputs:{actionsSidenavOpened:[1,"actionsSidenavOpened"],notificationsSidenavOpened:[1,"notificationsSidenavOpened"]},outputs:{actionsSidenavOpened:"actionsSidenavOpenedChange",notificationsSidenavOpened:"notificationsSidenavOpenedChange"},decls:9,vars:6,consts:[["actionsSidenav",""],["upgradeMessages",""],["kipGestures","",1,"sidenav-container",3,"swipeleft","swiperight","backdropClick","mode","bridgeUiEvents"],["mode","over","position","start","autoFocus","true","disableClose","",1,"sidenav-notifications",3,"openedChange","keydown","opened"],["mode","over","position","end","autoFocus","true","disableClose","",1,"sidenav-actions",3,"openedChange","keydown","opened"],[3,"actionsSidenav"],[1,"router-outlet-container"],["role","alert","aria-live","polite",1,"config-upgrade-overlay"],[1,"config-upgrade-card"],["diameter","46","mode","indeterminate"],[1,"config-upgrade-text"],[1,"config-upgrade-messages"]],template:function(e,o){if(e&1){let r=S();a(0,"mat-sidenav-container",2),f("swipeleft",function(){return o.onSwipeLeft()})("swiperight",function(){return o.onSwipeRight()})("backdropClick",function(){return o.backdropClicked()}),a(1,"mat-sidenav",3),gt("openedChange",function(m){return g(r),ht(o.notificationsSidenavOpened,m)||(o.notificationsSidenavOpened=m),_(m)}),f("keydown",function(m){return o.escapeKeyPressed(m.key)}),I(2,"menu-notifications"),s(),a(3,"mat-sidenav",4,0),gt("openedChange",function(m){return g(r),ht(o.actionsSidenavOpened,m)||(o.actionsSidenavOpened=m),_(m)}),f("keydown",function(m){return o.escapeKeyPressed(m.key)}),I(5,"menu-actions",5),s(),a(6,"mat-sidenav-content"),I(7,"router-outlet",6),s()(),v(8,Si,9,1,"div",7)}if(e&2){let r=Pt(4);M("mode","horizontal")("bridgeUiEvents",!0),p(),ut("opened",o.notificationsSidenavOpened),p(2),ut("opened",o.actionsSidenavOpened),p(2),M("actionsSidenav",r),p(3),b(o.upgrade.upgrading()?8:-1)}},dependencies:[Le,ze,N,ge,T,oe,te,De,Pe,Ne,Oe,Ft,Jt,Te,Ae],styles:[".sidenav-container[_ngcontent-%COMP%]{height:100%;width:100%;--mat-sidenav-scrim-color: color-mix(in srgb, var(--mat-sys-neutral-variant20) 70%, transparent)}mat-sidenav-content[_ngcontent-%COMP%]{overflow-y:hidden;overflow-x:hidden}mat-sidenav[_ngcontent-%COMP%]{box-shadow:0 0 1px 0 var(--kip-contrast-color)}mat-sidenav.sidenav-notifications[_ngcontent-%COMP%]{width:230px;z-index:1200}mat-sidenav.sidenav-actions[_ngcontent-%COMP%]{width:135px;z-index:1200;overflow-x:hidden}.config-upgrade-overlay[_ngcontent-%COMP%]{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#00000073;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);z-index:2000;pointer-events:all}.config-upgrade-card[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:18px;padding:20px 24px;width:clamp(300px,60vw,640px);background:var(--kip-background, #1f1f1f);border:1px solid rgba(255,255,255,.18);border-radius:14px;color:var(--kip-contrast-color, #fff);box-shadow:0 6px 22px #0000008c}.config-upgrade-text[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 4px;font-size:1.05rem;font-weight:600;letter-spacing:.5px}.config-upgrade-text[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0 0 10px;font-size:.8rem;opacity:.85}.config-upgrade-messages[_ngcontent-%COMP%]{list-style:disc;margin:0;padding-left:18px;max-height:180px;font-size:.68rem;line-height:1.25;scrollbar-width:thin;overflow-y:auto}.config-upgrade-messages[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin-bottom:2px}"]})}return i})();var We=(()=>{class i{auth=n(D);authToken=null;authTokenSubscription=null;constructor(){this.authTokenSubscription=this.auth.authToken$.subscribe(t=>{this.authToken=t})}intercept(t,e){let o=t.clone();return this.authToken&&(o=t.clone({headers:t.headers.set("authorization","JWT "+this.authToken.token)})),e.handle(o)}ngOnDestroy(){this.authTokenSubscription?.unsubscribe()}static \u0275fac=function(e){return new(e||i)};static \u0275prov=C({token:i,factory:i.\u0275fac})}return i})();var Ge=(()=>{class i extends it{_createContainer(){let t=document.createElement("div");t.classList.add("cdk-overlay-container"),(document.getElementById("app-filter-wrapper")||document.querySelector("app-root")||document.body).appendChild(t),this._containerElement=t}static \u0275fac=(()=>{let t;return function(o){return(t||(t=It(i)))(o||i)}})();static \u0275prov=C({token:i,factory:i.\u0275fac})}return i})();var Qe=(()=>{class i{_router=n(k);_dialog=n(re);_bottomSheet=n(Ce);_destroyRef=n(Y);constructor(){this._router.events.pipe(U(t=>t instanceof Zt),R(this._destroyRef)).subscribe(()=>{this._dialog.openDialogs.length>0&&this._dialog.closeAll(),this._bottomSheet.dismiss()})}static \u0275fac=function(e){return new(e||i)};static \u0275prov=C({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();Ue.production&&void 0;Bt(je,{providers:[Ut(),xt(zt),{provide:Ht,useClass:We,multi:!0},{provide:ae,useValue:{hasBackdrop:!0,disableClose:!1,autoFocus:"first-tabbable",delayFocusTrap:!0,backdropClass:"dialogBackdrop"}},{provide:se,useValue:{appearance:"outline",floatLabel:"always",subscriptSizing:"dynamic"}},{provide:me,useValue:{showDelay:1500,hideDelay:0}},D,z,nt,B,L,H,A,de,W,x,E,he,at,Ee(),$t(qt()),ee(Re,ie()),{provide:it,useClass:Ge},ft(()=>n(W).initNetworkServices()),ft(()=>{n(Qe)})]});
|