@mxtommy/kip 4.7.0 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/LICENSE +3 -0
  3. package/README.md +37 -29
  4. package/package.json +23 -34
  5. package/plugin/history-series.service.js +108 -11
  6. package/plugin/index.js +170 -44
  7. package/plugin/kip-series-contract.js +18 -1
  8. package/plugin/openApi.json +75 -7
  9. package/public/3rdpartylicenses.txt +0 -26
  10. package/public/assets/help-docs/contributing-widgets.md +40 -0
  11. package/public/assets/help-docs/dashboards.md +8 -0
  12. package/public/assets/help-docs/menu.json +4 -2
  13. package/public/assets/svg/icons.svg +48 -1
  14. package/public/assets/svg/symbols.svg +68 -0
  15. package/public/{chunk-PKB75FW2.js → chunk-2TP7C66X.js} +1 -1
  16. package/public/chunk-3SJSLBCV.js +6 -0
  17. package/public/chunk-5SMHTIVS.js +50 -0
  18. package/public/{chunk-E3ROX3JL.js → chunk-6ISGIPNP.js} +1 -1
  19. package/public/chunk-6ZR3M3IQ.js +3 -0
  20. package/public/{chunk-6LPU67GV.js → chunk-ACY7HYMZ.js} +1 -1
  21. package/public/{chunk-E3VC75HO.js → chunk-C23GLDFH.js} +1 -1
  22. package/public/{chunk-W5RYIISE.js → chunk-CB4E7PPA.js} +1 -1
  23. package/public/{chunk-JL7DODKZ.js → chunk-DNM5XUIF.js} +1 -1
  24. package/public/{chunk-2BKBAKG4.js → chunk-GSM7FZE2.js} +2 -2
  25. package/public/{chunk-OBMTAHXF.js → chunk-HF7V6XFA.js} +1 -1
  26. package/public/{chunk-2BY2XRFX.js → chunk-HUCDJ6CS.js} +7 -7
  27. package/public/{chunk-CSJ2TU72.js → chunk-ILQQCGMJ.js} +1 -1
  28. package/public/chunk-IXUKD73N.js +5 -0
  29. package/public/{chunk-BMEO4VRV.js → chunk-JMZYPL54.js} +1 -1
  30. package/public/chunk-KG4C6HZC.js +1 -0
  31. package/public/{chunk-UBBLNNPA.js → chunk-LEY6MANN.js} +13 -13
  32. package/public/chunk-NS2OV2OW.js +9 -0
  33. package/public/{chunk-3JK476CX.js → chunk-O5BTKN5D.js} +1 -1
  34. package/public/{chunk-PDJFHMII.js → chunk-Q32FSCUX.js} +1 -1
  35. package/public/{chunk-3B5RVPSS.js → chunk-SHJMXSDM.js} +1 -1
  36. package/public/{chunk-GWAFO3MC.js → chunk-T4VTC6GW.js} +1 -1
  37. package/public/{chunk-GHPW4BPE.js → chunk-VFJD3XKT.js} +1 -1
  38. package/public/{chunk-KHZPPOSI.js → chunk-VFZSH4TC.js} +1 -1
  39. package/public/{chunk-S4UHQERA.js → chunk-W6MCE3GH.js} +1 -1
  40. package/public/index.html +1 -1
  41. package/public/main-UBENKC2D.js +1 -0
  42. package/public/polyfills-BWA36QKG.js +1 -0
  43. package/public/chunk-B2CYEVGO.js +0 -9
  44. package/public/chunk-HIXACNNV.js +0 -6
  45. package/public/chunk-QN4XMV3X.js +0 -50
  46. package/public/chunk-U5QHLGHD.js +0 -1
  47. package/public/chunk-WYC65OAX.js +0 -5
  48. package/public/chunk-XFHXLFTX.js +0 -3
  49. package/public/main-WGYSOKJC.js +0 -1
  50. package/public/polyfills-L4FJGPOC.js +0 -2
@@ -1,50 +0,0 @@
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 zo,P as kl,Q as wu,R as _u,S as Mu,T as Un,U as Hn,V as eo,W as vt,X as qn,Y as $n,Z as to,_ as ku,a as qt,aa as rs,b as oi,ba as Tu,c as Di,ca as Eu,d as vu,da as jn,e as bu,ea as ln,f as Au,g as es,h as yu,i as xu,j as Cu,k as Su,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 zn,v as hi,w as ts,x as is,y as Za,z as va}from"./chunk-B2CYEVGO.js";import{a as gu,b as Jr,c as ri}from"./chunk-S4UHQERA.js";import{a as Du,b as Pu,c as Iu,d as Nu,e as Ru}from"./chunk-BMEO4VRV.js";import{a as ai,b as on,c as at,e as io,f as no}from"./chunk-6LPU67GV.js";import{a as du,b as cu,c as uu,d as Ya,e as mu,f as Lt,g as hu,h as pu,k as fu,m as Wo,o as Ae,p as Cl,r as Wt}from"./chunk-WYC65OAX.js";import{b as Xc,e as Kc,f as jr}from"./chunk-GHPW4BPE.js";import{a as Fn,b as Gn}from"./chunk-OBMTAHXF.js";import{a as eu,b as tu,c as iu,d as tn,e as ti,g as nu,h as Mi,i as ki,j as Ti,k as Nn,l as Ht,n as Ct,o as Ln,p as su,q as Wn,s as lu,u as St,v as ii,w as wt,x as ni}from"./chunk-CSJ2TU72.js";import{A as Rn,B as $a,C as nn,D as ru,E as xl,F as an,G as Xr,H as Kr,I as Ei,J as pt,K as ja,L as On,M as Pt,O as Vn,P as It,Q as xt,a as Si,b as xc,d as Ft,e as wi,f as jc,i as $r,j as Yc,k as Zc,l as Qc,m as Vt,n as en,o as Yr,p as yt,r as Et,t as dt,u as Dt,v as au,w as Zr,x as Qr,y as ou,z as ct}from"./chunk-PKB75FW2.js";import{$ as wr,$a as Ir,$b as Nt,$c as Gr,Aa as cc,Ab as Ai,Ac as B,Ae as Fc,Ba as Ze,Bb as xe,Bc as K,Cb as Ce,Cc as fc,Cd as Ha,Ce as Gc,D as Jd,Da as ei,Db as O,Dc as gc,De as Bc,E as ec,Ea as Be,Eb as d,Ec as ut,Ee as zc,Fb as u,Fc as x,Ga as _,Gb as F,Gc as pe,H as ca,Ha as L,Hb as D,Hd as qa,He as Uc,I as xr,Ia as Zi,Ib as R,Ic as Fr,Ie as Hc,J as gi,Jb as Q,K as vi,Kb as Xi,Kc as Ci,Kd as Tc,Ke as qc,La as Ke,Lb as Ki,Mb as Or,Mc as bt,Nb as Se,Nd as Ec,O as tc,Ob as Vi,Od as pa,Oe as $c,P as Tn,Pb as U,Pd as Pn,Pe as $e,Q as Jt,Qa as Dr,Qb as Oo,Qd as Dc,Qe as _i,Ra as Pr,Rb as k,Re as Jc,S as ic,Sa as ua,Sb as Vr,Sd as yl,Se as Qe,T as nc,Tb as Lr,Td as Ur,Te as et,U as Cr,Ub as Wr,Ud as Pc,V as Sr,Vb as En,Wa as g,Wb as yi,Wc as vc,Wd as Wi,Xb as xi,Xc as bc,Ya as uc,Yc as Ac,Yd as Ji,Z as ac,Za as mc,Zb as Me,_ as oc,_b as ke,a as ae,aa as _r,ab as ma,ac as be,ad as Dn,b as fe,ba as rc,bc as st,be as Ic,ca as Ga,cc as Ba,cd as za,ce as Nc,d as Bg,da as Mr,db as Nr,dc as it,de as Tt,e as jd,ea as kr,ec as c,ed as yc,ee as Hr,f as Ve,fa as Tr,fc as X,fe as In,g as Fa,ga as sc,gb as q,gc as ge,ge as Rc,ha as lc,hb as Qi,hc as Ut,he as At,ib as Ot,j as vl,jb as Rr,je as qr,k as zt,ka as Er,kb as hc,kc as mn,kd as Cc,ke as nt,la as rt,lb as Ro,lc as hn,ld as Sc,m as ji,ma as Yi,mb as bi,mc as pn,md as wc,me as Oc,n as Yd,nb as pc,nc as ha,oa as un,oc as fn,pc as gn,q as Zd,qa as y,qc as Li,qd as _c,qe as Vc,r as Qd,rc as Al,re as Lc,s as bl,sc as Vo,sd as Br,t as Xd,ta as dc,tc as Lo,td as Mc,ud as kc,va as ee,vb as J,vc as lt,w as yr,wa as te,wc as kt,wd as Ua,x as kn,xa as ie,xb as I,xc as vn,y as Kd,ya as Ge,yb as N,ye as Wc,z as Zt,za as No,zb as Ne,zd as zr}from"./chunk-UBBLNNPA.js";var gd=Bg((qV,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),T=h[Ar+S];return T!==void 0?T:null}function r(p,h,v,S,T,P,z){if(typeof S!="function")throw new TypeError("Invalid animation rule:",S);var $=p-v,H=$/T,Z=0;H>1&&(H=1),H!==1&&(Z=S(H),isFinite(Z)&&!isNaN(Z)&&(H=Z)),h&&h(H),$<T?z.frame=zd(function(ue){return r(ue,h,v,S,T,P,z)}):(P&&P(),z.inProgress=!1)}function s(){Array.prototype.constructor.apply(this,arguments)}function l(p){if(!(p instanceof DOMException&&p.result===2152923147))throw p}function m(p,h){return h.replace(Wg,function(v,S){var T=p[S];return T!==void 0?T:v})}function f(p){return p.majorTicks instanceof Array||(p.majorTicks=p.majorTicks?[p.majorTicks]:[]),p.majorTicks.length||(p.majorTicks.push(_e.formatMajorTickNumber(p.minValue,p)),p.majorTicks.push(_e.formatMajorTickNumber(p.maxValue,p))),[p.tickSide!=="right",p.tickSide!=="left"]}function b(p,h,v,S,T,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+T-P),p.quadraticCurveTo(h+S,v+T,h+S-P,v+T),p.lineTo(h+P,v+T),p.quadraticCurveTo(h,v+T,h,v+T-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,T=0,P=void 0,z=void 0,$=void 0;if(p=parseFloat(p),$=p<0,p=Math.abs(p),v>0){for(z=p.toFixed(v).toString().split("."),P=S-z[0].length;T<P;++T)z[0]="0"+z[0];z=($?"-":"")+z[0]+"."+z[1]}else{for(z=Math.round(p).toString(),P=S-z.length;T<P;++T)z="0"+z;z=($?"-":"")+z}return z}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 T=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],P=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,z=p.createLinearGradient(T?0:P,T?P:0,T?0:S,T?S:0);return z.addColorStop(0,h),z.addColorStop(1,v),z}function E(p,h){h.needleShadow&&(p.shadowOffsetX=2,p.shadowOffsetY=2,p.shadowBlur=10,p.shadowColor=h.colorNeedleShadowDown)}function W(p,h,v){return p["font"+h+"Style"]+" "+p["font"+h+"Weight"]+" "+p["font"+h+"Size"]*v+"px "+p["font"+h]}function V(p){p.shadowOffsetX=null,p.shadowOffsetY=null,p.shadowBlur=null,p.shadowColor="",p.strokeStyle=null,p.lineWidth=0,p.save()}function Y(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,T,P){if(h.valueBox){V(p);var z=h.valueDec?1+h.valueDec:0,$="9".repeat(Math.max.apply(null,[String(parseInt(v)).length+z].concat(h.majorTicks.map(function(qe){return String(parseInt(qe,10)).length+z})))),H=h.valueText||A(v,h),Z=P/200,ue=P/100,he=.4*ue,Ee=1.2*ue;p.font=W(h,"Value",Z),Y(p,h,he,Ee);var De=p.measureText(h.valueText?H:"-"+A(Number($),h)).width;V(p);var Re=parseFloat(h.fontValueSize)*Z+he+Ee,Xe=ue*parseFloat(h.valueBoxStroke),Ie=2*P-2*Xe,je=De+10*ue,Ye=1.1*Re+he+Ee,Je=ue*h.valueBoxBorderRadius,Ue=(parseFloat(h.valueBoxWidth)||0)/100*Ie;Ue>je&&(je=Ue),je>Ie&&(je=Ie);var He=S-je/2,Fe=T-Ye/2,Pe=T-5.75*ue;if(p.beginPath(),Je?b(p,He,Fe,je,Ye,Je):p.rect(He,Fe,je,Ye),Xe){var Oe=p.createRadialGradient(S,Pe,10*ue,S,Pe,20*ue);Oe.addColorStop(0,h.colorValueBoxRect),Oe.addColorStop(1,h.colorValueBoxRectEnd),p.strokeStyle=Oe,p.lineWidth=Xe,p.stroke()}h.colorValueBoxShadow&&(p.shadowBlur=1.2*ue,p.shadowColor=h.colorValueBoxShadow),h.colorValueBoxBackground&&(p.fillStyle=h.colorValueBoxBackground,p.fill()),p.closePath(),p.restore(),Y(p,h,he,Ee),p.fillStyle=h.colorValueText,p.textAlign="center",p.textBaseline="alphabetic",p.fillText(H,He+je/2,T+Ye/2-Re/3),p.restore()}}function ye(p){var h=p.value,v=p.minValue,S=p.maxValue,T=.01*(S-v);return{normal:h<v?v:h>S?S:h,indented:h<v?v-T:h>S?S+T:h}}function me(p,h,v,S,T){v.beginPath(),v.arc(0,0,Oi(p),0,2*Po,!0),v.lineWidth=h,v.strokeStyle=T?_e.linearGradient(v,S,T,p):S,v.stroke(),v.closePath()}function ne(p,h){var v=Ri.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(he,Ee,De,Re,Xe,Ie){return Ee&&(!Ie&&h.borderShadowWidth&&(De.save(),De.shadowBlur=h.borderShadowWidth,De.shadowColor=h.colorBorderShadow),me(he,Ee*S,De,Re,Xe),!Ie&&h.borderShadowWidth&&(Ie=!0,De.restore())),Ie}var S=Ri.pixelRatio,T=h.borderShadowWidth*S,P=p.max-T-h.borderOuterWidth*S/2,z=P-h.borderOuterWidth*S/2-h.borderMiddleWidth*S/2+.5,$=z-h.borderMiddleWidth*S/2-h.borderInnerWidth*S/2+.5,H=ne(p,h),Z=void 0,ue=!1;p.save(),ue=v(P,h.borderOuterWidth,p,h.colorBorderOuter,h.colorBorderOuterEnd,ue),ue=v(z,h.borderMiddleWidth,p,h.colorBorderMiddle,h.colorBorderMiddleEnd,ue),ue=v($,h.borderInnerWidth,p,h.colorBorderInner,h.colorBorderInnerEnd,ue),!ue&&h.borderShadowWidth&&(p.shadowBlur=h.borderShadowWidth,p.shadowColor=h.colorBorderShadow),p.beginPath(),p.arc(0,0,Oi(H),0,2*Po,!0),h.colorPlateEnd?(Z=p.createRadialGradient(0,0,H/2,0,0,H),Z.addColorStop(0,h.colorPlate),Z.addColorStop(1,h.colorPlateEnd)):Z=h.colorPlate,p.fillStyle=Z,p.fill(),p.closePath(),p.restore()}function ce(p,h){if(h.highlights!=="false"&&h.highlights.length&&h.highlightsWidth!==0){var v=p.max*(parseFloat(h.highlightsWidth)||0)/100,S=Oi(de(p,h)-v/2),T=h.highlights.length,P=(h.maxValue-h.minValue)/h.ticksAngle;p.save();for(var z=0;z<T;z++){var $=h.highlights[z];p.lineWidth=v,p.lineCap=h.highlightsLineCap,p.strokeStyle=$.color,p.beginPath(),p.rotate(gl),p.arc(0,0,S,_e.radians(h.startAngle+($.from-h.minValue)/P),_e.radians(h.startAngle+($.to-h.minValue)/P),!1),p.stroke(),p.closePath(),p.restore(),p.save()}p.restore()}}function oe(p,h){var v=de(p,h),S=void 0,T=void 0,P=void 0,z=0,$=Math.abs(h.minorTicks)||0,H=h.ticksAngle/(h.maxValue-h.minValue);h.exactTicks?(T=h.maxValue-h.minValue,S=$?T/$:0,z=($i.mod(h.majorTicks[0],$)||0)*H):S=$*(h.majorTicks.length-1),p.lineWidth=Ri.pixelRatio,p.strokeStyle=h.colorMinorTicks||h.colorStrokeTicks,p.save();for(var Z=0;Z<S;++Z)(P=h.startAngle+z+Z*(h.ticksAngle/S))<=h.ticksAngle+h.startAngle&&(p.rotate(_e.radians(P)),p.beginPath(),p.moveTo(0,v),p.lineTo(0,v-.075*p.max),ze(p));p.restore()}function de(p,h){var v=p.max/100;return ne(p,h)-5*v-(h.barWidth?2*(parseFloat(h.barStrokeWidth)||0)+((parseFloat(h.barWidth)||0)+5)*v:0)}function le(p,h){_e.prepareTicks(h);var v=Oi(de(p,h)),S=void 0,T=h.majorTicks.length,P=Ri.pixelRatio;p.lineWidth=2*P,S=h.colorMajorTicks instanceof Array?h.colorMajorTicks:new Array(T).fill(h.colorStrokeTicks||h.colorMajorTicks);for(var z=0;z<T;++z)p.save(),p.strokeStyle=S[z],p.rotate(_e.radians(ve(h,h.exactTicks?h.majorTicks[z]:z,T))),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,_e.radians(h.startAngle),_e.radians(h.startAngle+h.ticksAngle),!1),p.stroke(),p.closePath(),p.restore())}function ve(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 ze(p){p.stroke(),p.restore(),p.closePath(),p.save()}function ot(p,h){var v=de(p,h)-.15*p.max,S={},T=0,P=h.majorTicks.length,z=h.animationTarget!=="needle",$=h.colorNumbers instanceof Array?h.colorNumbers:new Array(P).fill(h.colorNumbers),H=z?-(h.value-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle:0;for(z&&(p.save(),p.rotate(-_e.radians(H))),p.font=_e.font(h,"Numbers",p.max/200),p.lineWidth=0,p.textAlign="center",p.textBaseline="middle";T<P;++T){var Z=H+ve(h,h.exactTicks?h.majorTicks[T]:T,P),ue=p.measureText(h.majorTicks[T]).width,he=h.fontNumbersSize,Ee=Math.sqrt(ue*ue+he*he)/2,De=_e.radialPoint(v-Ee-h.numbersMargin/100*p.max,_e.radians(Z));Z===360&&(Z=0),S[Z]||(S[Z]=!0,p.fillStyle=$[T],p.fillText(h.majorTicks[T],De.x,De.y))}z&&p.restore()}function Mt(p,h){h.title&&(p.save(),p.font=_e.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=_e.font(h,"Units",p.max/200),p.fillStyle=h.colorUnits,p.textAlign="center",p.fillText(_e.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?_e.normalizedValue(h).indented:h.value,T=v?h.startAngle:h.startAngle+(S-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle;h.barStartPosition==="right"&&(T=h.startAngle+h.ticksAngle-(S-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle);var P=ne(p,h),z=Oi(P/100*h.needleCircleSize),$=Oi(P/100*h.needleCircleSize*.75),H=Oi(P/100*h.needleEnd),Z=Oi(h.needleStart?P/100*h.needleStart:0),ue=P/100*h.needleWidth,he=P/100*h.needleWidth/2,Ee=Ri.pixelRatio;p.save(),_e.drawNeedleShadow(p,h),p.rotate(_e.radians(T)),p.fillStyle=_e.linearGradient(p,h.colorNeedle,h.colorNeedleEnd,H-Z),h.needleType==="arrow"?(p.beginPath(),p.moveTo(-he,-Z),p.lineTo(-ue,0),p.lineTo(-1*Ee,H),p.lineTo(Ee,H),p.lineTo(ue,0),p.lineTo(he,-Z),p.closePath(),p.fill(),p.beginPath(),p.lineTo(-.5*Ee,H),p.lineTo(-1*Ee,H),p.lineTo(-ue,0),p.lineTo(-he,-Z),p.lineTo(he/2*Ee-2*Ee,-Z),p.closePath(),p.fillStyle=h.colorNeedleShadowUp,p.fill()):(p.beginPath(),p.moveTo(-he,H),p.lineTo(-he,Z),p.lineTo(he,Z),p.lineTo(he,H),p.closePath(),p.fill()),p.restore(),h.needleCircleSize&&(p.save(),_e.drawNeedleShadow(p,h),h.needleCircleOuter&&(p.beginPath(),p.arc(0,0,z,0,2*Po,!0),p.fillStyle=_e.linearGradient(p,h.colorNeedleCircleOuter,h.colorNeedleCircleOuterEnd,z),p.fill(),p.closePath()),h.needleCircleInner&&(p.beginPath(),p.arc(0,0,$,0,2*Po,!0),p.fillStyle=_e.linearGradient(p,h.colorNeedleCircleInner,h.colorNeedleCircleInnerEnd,$),p.fill(),p.closePath()),p.restore())}}function ra(p,h,v){_e.drawValueBox(p,h,v,0,p.max-.33*p.max,p.max)}function Oa(p){var h=p.startAngle,v=p.startAngle+p.ticksAngle,S=h,T=h+(_e.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-_e.normalizedValue(p).normal)/(p.maxValue-p.minValue)*p.ticksAngle,T=180):(S=180,T=180+(_e.normalizedValue(p).normal-P)/(p.maxValue-p.minValue)*p.ticksAngle)}else p.barStartPosition==="right"&&(S=v-T+h,T=v);return{startAngle:S,endAngle:T}}function sa(p,h){var v=p.max/100,S=ne(p,h)-5*v,T=parseFloat(h.barStrokeWidth+"")||0,P=(parseFloat(h.barWidth+"")||0)*v,z=S-2*T-P,$=(S-z)/2,H=z+$,Z=T/H,ue=h.startAngle,he=h.startAngle+h.ticksAngle;if(p.save(),p.rotate(gl),T&&(p.beginPath(),p.arc(0,0,H,_e.radians(ue)-Z,_e.radians(he)+Z,!1),p.strokeStyle=h.colorBarStroke,p.lineWidth=2*$,p.stroke(),p.closePath()),P&&(p.beginPath(),p.arc(0,0,H,_e.radians(ue),_e.radians(he),!1),p.strokeStyle=h.colorBar,p.lineWidth=P,p.stroke(),p.closePath(),h.barShadow&&(p.save(),p.beginPath(),p.arc(0,0,S,_e.radians(ue),_e.radians(he),!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,_e.radians(h.startAngle),_e.radians(h.startAngle+h.ticksAngle),!1),p.stroke(),p.closePath(),p.restore()),h.barProgress)){var Ee=Oa(h),De=Ee.startAngle,Re=Ee.endAngle;p.beginPath(),p.arc(0,0,H,_e.radians(De),_e.radians(Re),!1),p.strokeStyle=h.colorBarProgress,p.lineWidth=P,p.stroke(),p.closePath()}p.restore()}function Va(p){return p.options.animatedValue?p.options.value:p.value}function wo(p,h,v,S,T,P,z,$){p.beginPath(),p.fillStyle=$?_e.linearGradient(p,z,$,T>P?T:P,P>T,T>P?v:S):z,h>0?_e.roundRect(p,v,S,T,P,h):p.rect(v,S,T,P),p.fill(),p.closePath()}function Ni(p,h,v,S,T,P,z,$,H){p.beginPath(),p.lineWidth=h,p.strokeStyle=H?_e.linearGradient(p,$,H,z,!0,T):$,v>0?_e.roundRect(p,S,T,P,z,v):p.rect(S,T,P,z),p.stroke(),p.closePath()}function _o(p,h,v,S,T,P){function z(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,Z,De,tt,ht),Pe+=.5*$,!Kt&&h.borderShadowWidth&&(Kt=!0,p.restore())),Kt}var $=Ri.pixelRatio,H=h.borderRadius*$,Z=T-h.borderShadowWidth-h.borderOuterWidth*$,ue=Z-h.borderOuterWidth*$-h.borderMiddleWidth*$,he=ue-h.borderMiddleWidth*$-h.borderInnerWidth*$,Ee=he-h.borderInnerWidth*$,De=P-h.borderShadowWidth-h.borderOuterWidth*$,Re=De-h.borderOuterWidth*$-h.borderMiddleWidth*$,Xe=Re-h.borderMiddleWidth*$-h.borderInnerWidth*$,Ie=Xe-h.borderInnerWidth*$,je=v-(ue-Z)/2,Ye=je-(he-ue)/2,Je=Ye-(Ee-he)/2,Ue=S-(Re-De)/2,He=Ue-(Xe-Re)/2,Fe=He-(Ie-Xe)/2,Pe=0,Oe=!1;return p.save(),Oe=z(h.borderOuterWidth,h.colorBorderOuter,h.colorBorderOuterEnd,Oe),Oe=z(h.borderMiddleWidth,h.colorBorderMiddle,h.colorBorderMiddleEnd,Oe),Oe=z(h.borderInnerWidth,h.colorBorderInner,h.colorBorderInnerEnd,Oe),!Oe&&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,T,P){var z=Ri.pixelRatio,$=P>=T,H=$?.85*T:P,Z=$?P:T;v=$?We(v+(T-H)/2):v;var ue=!!h.title,he=!!h.units,Ee=!!h.valueBox,De=void 0,Re=void 0,Xe=void 0;$?(Re=We(.05*Z),De=We(.075*Z),Xe=We(.11*Z),ue&&(Z-=De,S+=De),he&&(Z-=Re),Ee&&(Z-=Xe)):(Re=De=We(.15*H),ue&&(H-=De,S+=De),he&&(H-=Re));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(Z*h.barLength/100-Ie),Ue=We((Z-Je)/2),He=We(v+($?H/2:Ue+je)),Fe=We(S+($?Z-Ue-je+Ie/2:H/2)),Pe=!$||h.hasLeft&&h.hasRight?0:(h.hasRight?-1:1)*h.ticksWidth/100*H,Oe=$||h.hasLeft&&h.hasRight?0:(h.hasRight?-1:1)*h.ticksWidth/100*H;return p.barDimensions={isVertical:$,width:H,length:Z,barWidth:Ye,barLength:Je,strokeWidth:Ie,barMargin:Ue,radius:je,pixelRatio:z,barOffset:null,titleMargin:ue?De:0,unitsMargin:he?Re:0,get ticksLength(){return this.barLength-this.barOffset-this.strokeWidth},X:v+Pe,Y:S+Oe,x0:He+Pe,y0:Fe+Oe,baseX:v,baseY:S,ticksPadding:h.ticksPadding/100},p.barDimensions}function La(p,h,v,S,T,P,z){var $=Mo(p,h,S,T,P,z),H=$.isVertical,Z=$.width,ue=$.barWidth,he=$.barLength,Ee=$.strokeWidth,De=$.barMargin,Re=$.radius,Xe=$.x0,Ie=$.y0,je=$.X,Ye=$.Y,Je=he;p.save(),p.beginPath();var Ue=null;if(h.barBeginCircle){var He=_e.radians(H?270:0),Fe=Math.asin(ue/2/Re),Pe=Math.cos(Fe),Oe=Math.sin(Fe),qe=Xe+(H?Re*Oe:Re*Pe-Ee/2),tt=H?Ie-Re*Pe:Ie+Re*Oe,ht=Oi(H?tt-Ie:qe-Xe);Ue=We(ht+Re);var Kt=H?We(Xe-Re*Oe):qe,fi=H?tt:We(Ie-Re*Oe);v==="progress"&&(he=Ue+(he-Ue)*(_e.normalizedValue(h).normal-h.minValue)/(h.maxValue-h.minValue));var Io=We(qe+he-Ue+Ee/2),da=We(tt-he+Ue-Ee/2);p.arc(Xe,Ie,Re,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+(Z-ue)/2:je+De),$d=We(H?Ye+he+De:Ye+(Z-ue)/2);v==="progress"&&(he*=(h.value-h.minValue)/(h.maxValue-h.minValue)),H?p.rect(qd,$d,ue,-he):p.rect(qd,$d,he,ue)}v!=="progress"&&h.barStrokeWidth&&(p.lineWidth=Ee,p.strokeStyle=h.colorBarStroke,p.stroke()),v!=="progress"&&h.colorBar?(p.fillStyle=h.colorBarEnd?_e.linearGradient(p,h.colorBar,h.colorBarEnd,he,H,H?Ye:je):h.colorBar,p.fill()):v==="progress"&&h.colorBarProgress&&(p.fillStyle=h.colorBarProgressEnd?_e.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=Ue,p.barDimensions.barWidth+=Ee,p.barDimensions.barLength+=Ee}function ko(p,h,v,S,T,P){La(p,h,"",v,S,T,P)}function To(p,h){return h.needleSide!==p||h.tickSide!==p||h.numberSide!==p}function gr(p,h,v,S,T,P){h.barProgress&&La(p,h,"progress",v,S,T,P)}function Mg(p,h){var v=p.barDimensions,S=v.isVertical,T=v.width,P=v.length,z=v.barWidth,$=v.barOffset,H=v.barMargin,Z=v.X,ue=v.Y,he=v.ticksLength,Ee=v.ticksPadding,De=T*(parseFloat(h.highlightsWidth)||0)/100;if(h.highlights&&De){var Re=h.tickSide!=="right",Xe=h.tickSide!=="left",Ie=0,je=h.highlights.length,Ye=(T-z)/2,Je=h.maxValue-h.minValue,Ue=We(S?Z+Ye:Z+H+$),He=De,Fe=S?ue+P-H-$:ue+Ye,Pe=We((h.ticksWidth/100+Ee)*T)+(De-h.ticksWidth/100*T),Oe=We(z+Ee*T);for(p.save();Ie<je;Ie++){var qe=h.highlights[Ie],tt=he*Oi(h.minValue-qe.from)/Je,ht=he*Oi((qe.to-qe.from)/Je);p.beginPath(),p.fillStyle=qe.color,S?(Re&&p.rect(Ue-Pe,Fe-tt,He,-ht),Xe&&p.rect(Ue+Oe,Fe-tt,He,-ht)):(Re&&p.rect(Ue+tt,Fe-Pe,ht,He),Xe&&p.rect(Ue+tt,Fe+Oe,ht,He)),p.fill(),p.closePath()}p.restore()}}function vr(p,h,v,S,T){p.beginPath(),p.moveTo(h,v),p.lineTo(S,T),p.stroke(),p.closePath()}function Fd(p,h,v,S,T,P,z,$,H){var Z=p.barDimensions,ue=Z.isVertical,he=Z.length,Ee=Z.barWidth,De=Z.barOffset,Re=Z.barMargin,Xe=Z.pixelRatio,Ie=Z.width,je=Z.X,Ye=Z.Y,Je=Z.ticksLength,Ue=Z.ticksPadding,He=(Ie-Ee)/2,Fe=void 0,Pe=void 0,Oe=0,qe=v.length,tt=void 0,ht=H*Ie,Kt=He-Ue*Ie,fi=He+Ee+ht+Ue*Ie,Io=h instanceof Array?h:new Array(v.length).fill(h);p.save(),p.lineWidth=$*Xe;for(var da=Je/(T-S);Oe<qe;Oe++)tt=v[Oe],p.strokeStyle=Io[Oe],ue?(Pe=Ye+he-Re-De+(S-tt)*da,P&&(Fe=je+Kt,vr(p,Fe,Pe,We(Fe-ht),Pe)),z&&(Fe=je+fi,vr(p,Fe,Pe,We(Fe-ht),Pe))):(Fe=je+Re+De-(S-tt)*da,P&&(Pe=Ye+Kt,vr(p,Fe,Pe,Fe,We(Pe-ht))),z&&(Pe=Ye+fi,vr(p,Fe,We(Pe),Fe,Pe-ht)));p.restore()}function kg(p,h){var v=_e.prepareTicks(h),S=Bd(v,2),T=S[0],P=S[1],z=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,T,P,z,h.ticksWidth/100),h.strokeTicks){var Z=p.barDimensions,ue=Z.isVertical,he=Z.length,Ee=Z.width,De=Z.barWidth,Re=Z.barMargin,Xe=Z.barOffset,Ie=Z.X,je=Z.Y,Ye=Z.ticksLength,Je=Z.pixelRatio,Ue=Z.ticksPadding,He=(Ee-De)/2+De+Ue*Ee,Fe=(Ee-De)/2-Ue*Ee,Pe=void 0,Oe=void 0,qe=void 0,tt=void 0;p.strokeStyle=h.colorStrokeTicks||H[0],z*=Je,ue?(Oe=je+he-Re-Xe+z/2,tt=Oe-Ye-z,T&&(qe=Pe=We(Ie+Fe),br(p,Pe,Oe,qe,tt)),P&&(qe=Pe=We(Ie+He),br(p,Pe,Oe,qe,tt))):(Pe=Ie+Re+Xe-z/2,qe=Pe+Ye+z,T&&(tt=Oe=We(je+Fe),br(p,Pe,Oe,qe,tt)),P&&(tt=Oe=We(je+He),br(p,Pe,Oe,qe,tt)))}}function br(p,h,v,S,T){p.beginPath(),p.moveTo(h,v),p.lineTo(S,T),p.stroke(),p.closePath()}function Tg(p,h){var v=_e.prepareTicks(h),S=Bd(v,2),T=S[0],P=S[1],z=[],$=h.minValue,H=Math.abs(h.minorTicks)||0,Z=H?(h.maxValue-h.minValue)/(H*(h.majorTicks.length-1)):0;if(H)if(h.exactTicks)for(var ue=$i.mod(h.majorTicks[0],H)||0;$<h.maxValue;$+=H)ue+$<h.maxValue&&z.push(ue+$);else for(;$<h.maxValue;$+=Z)z.push($);Fd(p,h.colorMinorTicks||h.colorStrokeTicks,z,h.minValue,h.maxValue,T,P,1,h.ticksWidthMinor/100)}function Eg(p,h){var v=p.barDimensions,S=v.isVertical,T=v.length,P=v.width,z=v.barWidth,$=v.barMargin,H=v.barOffset,Z=v.X,ue=v.Y,he=v.ticksLength,Ee=v.ticksPadding,De=h.maxValue-h.minValue,Re=De/(h.majorTicks.length-1),Xe=h.exactTicks?h.majorTicks:h.majorTicks.map(function(Io,da){return h.minValue+Re*da}),Ie=Xe.length,je=h.numberSide!=="right",Ye=h.numberSide!=="left",Je=h.fontNumbersSize*P/200,Ue=0,He=(h.ticksWidth/100+2*Ee)*P,Fe=(P-z)/2-He,Pe=(P-z)/2+z+He,Oe=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=_e.font(h,"Numbers",P/200),p.lineWidth=0,p.textAlign="center";Ue<Ie;Ue++)p.fillStyle=Kt[Ue],ht=h.majorTicks[Ue],tt=h.exactTicks?he*((Xe[Ue]-h.minValue)/De):Ue*he/(Ie-1),S?(qe=ue+T-$-H-tt+Je/3,je&&(p.textAlign="right",p.fillText(ht,Z+Fe-fi,qe)),Ye&&(p.textAlign="left",p.fillText(ht,Z+Pe+fi,qe))):(p.measureText(ht).width,Oe=Z+$+H+tt,je&&p.fillText(ht,Oe,ue+Fe-fi),Ye&&p.fillText(ht,Oe,ue+Pe+Je+fi))}function Dg(p,h){if(h.title){var v=p.barDimensions,S=v.isVertical,T=v.width,P=v.length,z=v.baseX,$=v.baseY,H=v.titleMargin,Z=h.fontTitleSize*T/200,ue=We(z+(S?T:P)/2),he=We($+H/2-(S?Z:Z/2)-.025*(S?P:T));p.save(),p.textAlign="center",p.fillStyle=h.colorTitle,p.font=_e.font(h,"Title",T/200),p.lineWidth=0,p.fillText(h.title,ue,he,S?T:P),p.restore()}}function Pg(p,h){if(h.units){var v=p.barDimensions,S=v.isVertical,T=v.width,P=v.length,z=v.baseX,$=v.baseY,H=v.unitsMargin,Z=h.fontUnitsSize*T/200,ue=We(z+(S?T:P)/2),he=We($+(S?P:T)+H/2-Z/2);p.save(),p.textAlign="center",p.fillStyle=h.colorUnits,p.font=_e.font(h,"Units",T/200),p.lineWidth=0,p.fillText(_e.formatContext(h,h.units),ue,he,S?T:P),p.restore()}}function Ig(p,h){if(h.needle){var v=p.barDimensions,S=v.isVertical,T=v.width,P=v.length,z=v.barWidth,$=v.barOffset,H=v.barMargin,Z=v.ticksLength,ue=v.X,he=v.Y,Ee=v.ticksPadding,De=h.needleSide!=="right",Re=h.needleSide!=="left",Xe=Z*(_e.normalizedValue(h).indented-h.minValue)/(h.maxValue-h.minValue),Ie=(h.ticksWidth/100+Ee)*T,je=z/2+Ie,Ye=je*(h.needleEnd/100),Je=void 0,Ue=void 0,He=void 0,Fe=void 0,Pe=h.needleType.toLowerCase()==="arrow"?Rg:Ng,Oe=(T-z)/2,qe=je*(h.needleStart/100),tt=Oe-Ie-qe,ht=Oe+z+Ie+qe;p.save(),_e.drawNeedleShadow(p,h),S?(He=We(he+P-H-$-Xe),De&&(Je=We(ue+tt),Ue=Je+Ye,Pe(p,h,Je,He,Ue,He,Ye)),Re&&(Je=We(ue+ht),Ue=Je-Ye,Pe(p,h,Je,He,Ue,He,Ye,!0))):(Je=We(ue+H+$+Xe),De&&(He=We(he+tt),Fe=He+Ye,Pe(p,h,Je,He,Je,Fe,Ye)),Re&&(He=We(he+ht),Fe=He-Ye,Pe(p,h,Je,He,Je,Fe,Ye,!0))),p.restore()}}function Gd(p,h,v,S){return h.colorNeedleEnd?_e.linearGradient(p,S?h.colorNeedleEnd:h.colorNeedle,S?h.colorNeedle:h.colorNeedleEnd,v,!p.barDimensions.isVertical):h.colorNeedle}function Ng(p,h,v,S,T,P,z,$){p.lineWidth=h.needleWidth,p.strokeStyle=Gd(p,h,z,$),p.beginPath(),p.moveTo(v,S),p.lineTo(T,P),p.stroke(),p.closePath()}function Rg(p,h,v,S,T,P,z,$){var H=We(.4*z),Z=z-H,ue=v===T,he=h.needleWidth/2;p.fillStyle=Gd(p,h,z,$),p.beginPath(),ue?(S>P&&(Z*=-1),p.moveTo(v-he,S),p.lineTo(v+he,S),p.lineTo(v+he,S+Z),p.lineTo(v,P),p.lineTo(v-he,S+Z),p.lineTo(v-he,S)):(v>T&&(Z*=-1),p.moveTo(v,S-he),p.lineTo(v,S+he),p.lineTo(v+Z,S+he),p.lineTo(T,S),p.lineTo(v+Z,S-he),p.lineTo(v,S-he)),p.fill(),p.closePath()}function Og(p,h,v,S,T,P,z){var $=(parseFloat(h.fontValueSize)||0)*P/200,H=(.11*z-$)/2;p.barDimensions.isVertical&&_e.drawValueBox(p,h,v,S+P/2,T+z-$-H,P)}var Bd=(function(){function p(h,v){var S=[],T=!0,P=!1,z=void 0;try{for(var $,H=h[Symbol.iterator]();!(T=($=H.next()).done)&&(S.push($.value),!v||S.length!==v);T=!0);}catch(Z){P=!0,z=Z}finally{try{!T&&H.return&&H.return()}finally{if(P)throw z}}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 T=Object.getOwnPropertyDescriptor(h,v);if(T===void 0){var P=Object.getPrototypeOf(h);return P===null?void 0:p(P,v,S)}if("value"in T)return T.value;var z=T.get;if(z!==void 0)return z.call(S)},Vg=function p(h,v,S,T){var P=Object.getOwnPropertyDescriptor(h,v);if(P===void 0){var z=Object.getPrototypeOf(h);z!==null&&p(z,v,S,T)}else if("value"in P&&P.writable)P.value=S;else{var $=P.set;$!==void 0&&$.call(T,S)}return S},la=(function(){function p(h,v){for(var S=0;S<v.length;S++){var T=v[S];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(h,T.key,T)}}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,T=arguments.length,P=Array(T>1?T-1:0),z=1;z<T;z++)P[z-1]=arguments[z];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),T=1;T<v;T++)S[T-1]=arguments[T];for(var P=0,z=S.length,$=this;P<z;P++)(function(){var H=S[P],Z=function ue(){$.off(h,ue),H.apply($,arguments)};S[P]=Z})();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 T=arguments.length<=v+1?void 0:arguments[v+1],P=void 0;~(P=this._events[h].indexOf(T));)this._events[h].splice(P,1)}},{key:"removeAllListeners",value:function(h){delete this._events[h]}},{key:"listeners",get:function(){return this._events}}]),p})(),zd=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(){},T=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=T,typeof this.draw!="function")throw new TypeError("Invalid animation draw callback:",S);if(typeof this.end!="function")throw new TypeError("Invalid animation end callback:",T)}return la(p,[{key:"animate",value:function(h,v){var S=this;this.frame&&this.cancel();var T=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=zd(function(P){return r(P,h,T,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 T=h[v];if(T.type==="attributes"&&T.attributeName==="data-type"&&this.isValidNode(T.target)&&T.oldValue!==this.type)setTimeout(this.process.bind(this,T.target));else if(T.addedNodes&&T.addedNodes.length)for(var P=0,z=T.addedNodes.length;P<z;P++)setTimeout(this.process.bind(this,T.addedNodes[P]))}}},{key:"process",value:function(h){var v=this;if(!this.isValidNode(h))return null;var S=void 0,T=JSON.parse(JSON.stringify(this.options)),P=null;for(S in T)if(T.hasOwnProperty(S)){var z=p.toAttributeName(S),$=p.parse(h.getAttribute(z));$!=null&&(T[S]=$)}return T.renderTo=h,P=new this.Type(T),P.draw&&P.draw(),this.isObservable&&(P.observer=new MutationObserver(function(H){H.forEach(function(Z){if(Z.type==="attributes"){var ue=Z.attributeName.toLowerCase(),he=h.getAttribute(ue).toLowerCase();if(ue==="data-type"&&he&&he!==v.type)P.observer.disconnect(),delete P.observer,P.destroy&&P.destroy();else if(ue.substr(0,5)==="data-"){var Ee=ue.substr(5).split("-").map(function(Re,Xe){return Xe?Re.charAt(0).toUpperCase()+Re.substr(1):Re}).join(""),De={};De[Ee]=p.parse(h.getAttribute(Z.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,T=v.length,P=v[0].toLowerCase();S<T;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(/-/),T=0,P=S.length,z="";T<P;T++)z+=T||v?S[T][0].toUpperCase()+S[T].substr(1).toLowerCase():S[T].toLowerCase();return z}},{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})(),Ri=(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})();Ri.collection=[],window.matchMedia&&window.matchMedia("screen and (min-resolution: 2dppx)").addListener(Ri.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,Oi=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)),T=S.constructor.name;if(T==="BaseGauge")throw new TypeError("Attempt to instantiate abstract class!");if(Do.push(S),v.listeners&&Object.keys(v.listeners).forEach(function(z){(v.listeners[z]instanceof Array?v.listeners[z]:[v.listeners[z]]).forEach(function($){S.on(z,$)})}),S.version=fl,S.type=n[T]||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 Ri(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 T=this.options.value;if(v!==T)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 z=T+(v-T)*P;S.options.animatedValue&&S.emit("value",z,S.value),S.options.value=z,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")),T=v.attributes,P=0,z=T.length,$={};if(S){for(/Gauge$/.test(S)||(S+="Gauge");P<z;P++)$[Wa.toCamelCase(T[P].name.replace(/^data-/,""),!1)]=Wa.parse(T[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 Wg=/{([_a-zA-Z]+[_a-zA-Z0-9]*)}/g,_e={roundRect:b,padValue:A,formatMajorTickNumber:C,radians:w,radialPoint:M,linearGradient:G,drawNeedleShadow:E,drawValueBox:j,verifyError:l,prepareTicks:f,font:W,normalizedValue:ye,formatContext:m},Po=Math.PI,gl=Po/2,Ud=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"}),Fg=(function(p){function h(v){return i(this,h),v=Object.assign({},Ud,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],T=S[0],P=S[1],z=S[2],$=S[3],H=this.options;if(H.animationTarget==="needle"){if(!v.elementClone.initialized){var Z=v.contextClone;Z.clearRect(T,P,z,$),this.emit("beforePlate"),re(Z,H),this.emit("beforeHighlights"),ce(Z,H),this.emit("beforeMinorTicks"),oe(Z,H),this.emit("beforeMajorTicks"),le(Z,H),this.emit("beforeNumbers"),ot(Z,H),this.emit("beforeTitle"),Mt(Z,H),this.emit("beforeUnits"),Yt(Z,H),v.elementClone.initialized=!0}this.canvas.commit(),v.context.clearRect(T,P,z,$),v.context.drawImage(v.elementClone,T,P,z,$),this.emit("beforeProgressBar"),sa(v.context,H),this.emit("beforeValueBox"),ra(v.context,H,Va(this)),this.emit("beforeNeedle"),mi(v.context,H)}else{var ue=-_e.radians((H.value-H.minValue)/(H.maxValue-H.minValue)*H.ticksAngle);if(v.context.clearRect(T,P,z,$),this.emit("beforePlate"),re(v.context,H),v.context.rotate(ue),this.emit("beforeHighlights"),ce(v.context,H),this.emit("beforeMinorTicks"),oe(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(-ue),!v.elementClone.initialized){var he=v.contextClone;he.clearRect(T,P,z,$),this.emit("beforeTitle"),Mt(he,H),this.emit("beforeUnits"),Yt(he,H),this.emit("beforeNeedle"),mi(he,H),v.elementClone.initialized=!0}v.context.drawImage(v.elementClone,T,P,z,$)}this.emit("beforeValueBox"),ra(v.context,H,Va(this)),ml(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"draw",this).call(this)}catch(Ee){_e.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),Vg(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=Fg),$i.initialize("RadialGauge",Ud);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}),Gg=(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],T=S[0],P=S[1],z=S[2],$=S[3],H=this.options;if(!v.elementClone.initialized){var Z=v.contextClone;Z.clearRect(T,P,z,$),this.emit("beforePlate"),this.drawBox=_o(Z,H,T,P,z,$),this.emit("beforeBar"),ko.apply(void 0,[Z,H].concat(o(this.drawBox))),v.contextClone.barDimensions=Z.barDimensions,this.emit("beforeHighlights"),Mg(Z,H),this.emit("beforeMinorTicks"),Tg(Z,H),this.emit("beforeMajorTicks"),kg(Z,H),this.emit("beforeNumbers"),Eg(Z,H),this.emit("beforeTitle"),Dg(Z,H),this.emit("beforeUnits"),Pg(Z,H),v.elementClone.initialized=!0}this.canvas.commit(),v.context.clearRect(T,P,z,$),v.context.drawImage(v.elementClone,T,P,z,$),this.emit("beforeProgressBar"),gr.apply(void 0,[v.context,H].concat(o(this.drawBox))),this.emit("beforeNeedle"),Ig(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(ue){_e.verifyError(ue)}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=Gg),$i.initialize("LinearGauge",Hd),typeof Js<"u"&&Object.assign(n,{Collection:s,GenericOptions:pl,Animation:hl,BaseGauge:$i,drawings:_e,SmartCanvas:Ri,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(Vt);_router=y(Kc);_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=>fe(ae({},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 Xc),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)),L(()=>{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 l=[...s,{id:Si.create(),name:e,icon:i??"dashboard-dashboard",configuration:t,collapseSplitShell:a??!1}];return r=l.length-1,l}),r}update(e,t,i,a){this.dashboards.update(r=>r.map((s,l)=>l===e?fe(ae({},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 l=-1;return this.dashboards.update(m=>{let f=[...m,s];return l=f.length-1,f}),l}updateConfiguration(e,t){let i=Ft(t??[]);this.dashboards.update(a=>a.map((r,s)=>s===e?wi(r.configuration,i)?r:fe(ae({},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 Ve(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 zr;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 Ve(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 zr;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 Ve(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 zr;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 Ve(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 W=e.values[E]?.method,V=typeof W=="string"?W.toLowerCase():W;if(!V)continue;let Y=E+1;V==="sma"?a=Y:(V==="avg"||V==="average")&&(r=Y)}r<0&&e.values.length===1&&(r=1)}else i[0]?.length>1&&(r=1);let s=t.unit==="rad",l=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 W=Date.parse(E[0]),V=a>=0?E[a]:null,Y=r>=0?E[r]:null;if(s?(V=Number.isFinite(V)?l(V):null,Y=Number.isFinite(Y)?l(Y):null):(V=Number.isFinite(V)?V:null,Y=Number.isFinite(Y)?Y:null),Number.isFinite(Y)){let j=Y;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:W,data:{value:Y,sma:V,ema:null,doubleEma:null,lastAverage:null,lastMinimum:null,lastMaximum:null}})}if(m.length>0){let E=null,W=null,V=null;if(s&&G.length>0){E=Math.atan2(w/G.length,M/G.length);let{min:Y,max:j}=this.circularMinMaxRad(G);t.domain==="signed"?(E=this.normalizeToSigned(E),W=this.normalizeToSigned(Y),V=this.normalizeToSigned(j)):(E=this.normalizeToDirection(E),W=this.normalizeToDirection(Y),V=this.normalizeToDirection(j))}else!s&&C>0&&(E=f/C,W=b,V=A);if(E!==null&&W!==null&&V!==null){let Y=m[m.length-1];Y.data.lastAverage=E,Y.data.lastMinimum=W,Y.data.lastMaximum=V}}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,l=(t[s]-t[r]+360)%360;l>i&&(i=l,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(Vt);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(l=>{l.configuration?.length&&l.configuration?.forEach(m=>{m?.id&&i.add(m.id)})});function a(l){let m=l.match(/^(windtrends|speedtrends)-(.+)$/);return m?m[2]:null}let r=[],s=[];for(let l of this._svcDatasetConfigs){let m=l.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(l.uuid));f?s.push(l):r.push(l)}r.length&&(r.forEach(l=>{console.warn(`[DatasetStreamService] Cleaned dataset: uuid=${l.uuid}, label="${l.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),l=s>0?Math.max(100,Math.round(s/120)):1e3;return r.sampleTime=l,r.maxDataPoints=Math.max(1,Math.ceil(s/l)),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 Ve(this,null,function*(){return this._startAllPromise})}startAll(){return Ve(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 Ve(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 l=this.data.subscribePath(t.path,t.pathSource).pipe(vi(b=>b?.data?.value!==null),wr({bufferSize:1,refCount:!0})),m=l.pipe(Jt(1)),f=ca(i.sampleTime,i.sampleTime).pipe(lc(l,(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 Ve(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}})(),l=new Date,m={paths:r,from:new Date(l.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,l=!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:l};return console.log(`[DatasetStreamService] Creating ${s?"":"non-"}persistent ${l?"":"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(l=>l.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,l=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),l=this.normalizeToDirection(w)):i==="signed"?(a=this.normalizeToSigned(a),r=this.normalizeToSigned(r),s=this.normalizeToSigned(C),l=this.normalizeToSigned(w)):(s=C,l=w)}else a=f(e.historicalData),r=b(e.historicalData,e.smoothingPeriod),s=Math.min(...e.historicalData),l=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:l}};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(l=>(l*180/Math.PI+360)%360).sort((l,m)=>l-m),i=0,a=0;for(let l=0;l<t.length;l++){let m=(l+1)%t.length,f=(t[m]-t[l]+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 Vu=(()=>{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=Rr({name:"safe",type:n,pure:!0})}return n})();var zg={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=ae(ae({},zg),n);return`(() => {
2
- if (window.__kipSwipeInit) return; window.__kipSwipeInit = true;
3
- const instanceId='${o.instanceId}';
4
- let pointerId=null; let startX=0; let startY=0; let startT=0; let peakPrimary=0; let peakCross=0; let cancelled=false;
5
- let lockedAxis=null; let lockedPrimarySign=0; let reversed=false;
6
- const minDist=${o.minDist};
7
- const maxDur=${o.maxDur};
8
- const minVelocity=${o.minVelocity};
9
- const axisDominance=${o.axisDominance};
10
- const deadzoneMs=${o.deadzoneMs};
11
- const purityRatio=${o.purityRatio};
12
- const lockThreshold=${o.lockThreshold};
13
- const directionLockAngle=${o.directionLockAngle};
14
- const reversalPrimaryThreshold=${o.reversalPrimaryThreshold};
15
- function reset(){pointerId=null; cancelled=false; lockedAxis=null; lockedPrimarySign=0; reversed=false;}
16
- function onDown(e){ if(pointerId!==null) return; pointerId=e.pointerId; startX=e.clientX; startY=e.clientY; startT=performance.now(); peakPrimary=0; peakCross=0; cancelled=false; lockedAxis=null; lockedPrimarySign=0; reversed=false; }
17
- function track(e){ if(e.pointerId!==pointerId||cancelled) return; const dx=e.clientX-startX; const dy=e.clientY-startY; const adx=Math.abs(dx); const ady=Math.abs(dy); const primary=adx>ady?adx:ady; const cross=adx>ady?ady:adx; peakPrimary=Math.max(peakPrimary,primary); peakCross=Math.max(peakCross,cross);
18
- if(!lockedAxis && primary>=lockThreshold){ lockedAxis = adx>ady?'x':'y'; lockedPrimarySign = lockedAxis==='x' ? (Math.sign(dx)||1) : (Math.sign(dy)||1); }
19
- if(lockedAxis){
20
- const angleRad = Math.atan2(lockedAxis==='x'?ady:adx, lockedAxis==='x'?adx:ady); // angle from primary axis
21
- const angleDeg = angleRad * 180 / Math.PI;
22
- if(angleDeg > directionLockAngle){ cancelled=true; return; }
23
- if(lockedAxis==='x' && Math.sign(dx) && Math.sign(dx)!==lockedPrimarySign && Math.abs(dx) > reversalPrimaryThreshold){ reversed=true; cancelled=true; return; }
24
- if(lockedAxis==='y' && Math.sign(dy) && Math.sign(dy)!==lockedPrimarySign && Math.abs(dy) > reversalPrimaryThreshold){ reversed=true; cancelled=true; return; }
25
- }
26
- if (!cancelled && peakCross>42 && peakCross*axisDominance>peakPrimary) { cancelled=true; }
27
- }
28
- function onUp(e){ if(e.pointerId!==pointerId) return; const endT=performance.now(); const dt=endT-startT; const dx=e.clientX-startX; const dy=e.clientY-startY; const adx=Math.abs(dx); const ady=Math.abs(dy); const dist=Math.hypot(dx,dy); const velocity=dist/dt; const primary=adx>ady?adx:ady; const cross=adx>ady?ady:adx; const purity= primary? (primary/dist):0; if(!cancelled && !reversed && dt>=deadzoneMs && dt<=maxDur && dist>=minDist && velocity>=minVelocity && purity>=purityRatio && primary/Math.max(cross,1)>=axisDominance){ if(adx>ady){ window.parent.postMessage({gesture: dx>0?'swiperight':'swipeleft', eventData:{dx,dy,duration:dt,velocity,instanceId}}, '*'); } else { window.parent.postMessage({gesture: dy>0?'swipedown':'swipeup', eventData:{dx,dy,duration:dt,velocity,instanceId}}, '*'); } } reset(); }
29
- function onCancel(e){ if(e.pointerId===pointerId) reset(); }
30
- document.addEventListener('pointerdown', onDown, {passive:true});
31
- document.addEventListener('pointermove', track, {passive:true});
32
- document.addEventListener('pointerup', onUp, {passive:true});
33
- document.addEventListener('pointercancel', onCancel, {passive:true});
34
- document.addEventListener('keydown', (event) => {
35
- if (event.ctrlKey && event.shiftKey && ['ArrowLeft','ArrowRight','ArrowUp','ArrowDown','E','F','N'].includes(event.key)) {
36
- window.parent.postMessage({ type:'keydown', keyEventData:{ key:event.key, ctrlKey:event.ctrlKey, shiftKey:event.shiftKey, instanceId }}, '*');
37
- }
38
- });
39
- })();`}var we=(()=>{class n{config=x();defaultConfig=_(void 0);runtimeConfig=ut();_runtimeConfig=_(void 0);lastBaseRef;lastUserRef;lastMergedRef;options=K(()=>{let e=this.defaultConfig(),t=this._runtimeConfig();if(this.lastMergedRef&&e===this.lastBaseRef&&t===this.lastUserRef)return this.lastMergedRef;let i;return e&&t?i=jc(Ft(e),Ft(t)):e&&!t?i=Ft(e):!e&&t?i=Ft(t):i=void 0,this.lastBaseRef=e,this.lastUserRef=t,this.lastMergedRef=i,this.runtimeConfig.emit(i),i});firstPathKey=K(()=>{let e=this.options();if(!e?.paths)return;let t=Object.keys(e.paths);return t.length?t[0]:void 0});constructor(){L(()=>{let e=this.config();B(()=>{e&&this.setRuntimeConfig(e)})})}getPathCfg(e){return this.options()?.paths?.[e]}setRuntimeConfig(e){this._runtimeConfig.set(e)}initialize(e,t){e&&this.defaultConfig.set(e),t&&this._runtimeConfig.set(t)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Ot({type:n,selectors:[["","widget-runtime",""]],inputs:{config:[1,"config"]},outputs:{runtimeConfig:"runtimeConfig"},exportAs:["widgetRuntime"]})}return n})();var Hg=["freeboardSkIframe"];function qg(n,o){if(n&1&&(Q(0,"iframe",1,0),lt(2,"safe")),n&2){let e=k();Vi("src",kt(2,1,e.widgetUrl),ua)}}function $g(n,o){n&1&&Q(0,"div",4)}function jg(n,o){if(n&1&&(D(0,"div",2),Q(1,"iframe",3,0),lt(3,"safe"),I(4,$g,1,0,"div",4),R()),n&2){let e=k();g(),Vi("src",kt(3,2,e.widgetUrl),ua),g(3),N(e.dashboard.isDashboardStatic()?-1:4)}}var Wu=(()=>{class n{id=x();type=x();theme=x();disableWidgetShell=x(!1);swipeDisabled=x(!1);runtime=y(we,{optional:!0});appSettings=y(Vt);app=y(Di);auth=y(Zc);dashboard=y(ft);iframe=pe.required("freeboardSkIframe");authToken=_i(this.auth.authToken$,{initialValue:null});viewReady=!1;iframeLoaded=!1;widgetUrl=null;static DEFAULT_CONFIG={};constructor(){window.addEventListener("message",this.handleIframeGesture),L(()=>{let e=this.authToken();B(()=>{let t=e?.token;this.widgetUrl=t?`${this.appSettings.signalkUrl.url}/@signalk/freeboard-sk/?token=${t}`:`${this.appSettings.signalkUrl.url}/@signalk/freeboard-sk/`})}),L(()=>{let e=this.app.isNightMode();B(()=>{!this.iframeLoaded||!this.viewReady||this.appSettings.getRedNightMode()&&this.sendMessage({commands:{nightModeEnable:e}})})})}ngAfterViewInit(){this.viewReady=!0;try{this.iframe().nativeElement.onload=()=>{this.iframeLoaded=!0,this.sendMessage({settings:{autoNightMode:!1}}),this.injectSwipeScript()}}catch(e){}}sendMessage(e,t="*"){let i=this.iframe()?.nativeElement?.contentWindow;i&&this.iframeLoaded&&i.postMessage(e,t)}injectSwipeScript(){if(this.swipeDisabled())return;let e=this.iframe().nativeElement.contentWindow,t=this.iframe().nativeElement.contentDocument;if(!t||!e){console.error("[FSK Widget] Iframe contentDocument or contentWindow is undefined.");return}try{let i=`kip-gesture-inject-${this.id()}`;if(t.getElementById(i))return;let a=ao({instanceId:this.id()}),r=t.createElement("script");r.id=i,r.textContent=a,t.body.appendChild(r)}catch(i){console.warn("[FSK Widget] Failed to inject swipe script into iframe:",i)}}handleIframeGesture=e=>{if(!e.data||!this.viewReady)return;let t=null;try{t=this.iframe()?.nativeElement?.contentWindow??null}catch(r){t=null}if(!t||e.source!==t)return;let i=this.getExpectedIframeOrigin();if(i&&e.origin!==i)return;let a=this.id();if(e.data.gesture&&e.data.eventData?.instanceId===a)switch(e.data.gesture){case"swipeup":this.dashboard.isDashboardStatic()&&this.dashboard.navigateToPreviousDashboard();break;case"swipedown":this.dashboard.isDashboardStatic()&&this.dashboard.navigateToNextDashboard();break;case"swipeleft":window.document.dispatchEvent(new Event("openLeftSidenav",{bubbles:!0,cancelable:!0}));break;case"swiperight":window.document.dispatchEvent(new Event("openRightSidenav",{bubbles:!0,cancelable:!0}));break}if(e.data.type==="keydown"&&e.data.keyEventData?.instanceId===a){let{key:r,ctrlKey:s,shiftKey:l}=e.data.keyEventData,m=new KeyboardEvent("keydown",{key:r,ctrlKey:s,shiftKey:l,bubbles:!0,cancelable:!0});document.dispatchEvent(m)}};getExpectedIframeOrigin(){let e=this.widgetUrl||this.appSettings.signalkUrl.url;if(!e)return null;try{return new URL(e).origin}catch(t){return null}}ngOnDestroy(){if(window.removeEventListener("message",this.handleIframeGesture),this.iframe){try{this.iframe().nativeElement.onload=null}catch(e){}try{let e=this.iframe()?.nativeElement.contentDocument;if(e){let t=`kip-gesture-inject-${this.id()}`,i=e.getElementById(t);i&&i.parentNode&&i.parentNode.removeChild(i)}}catch(e){}}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-freeboardsk"]],viewQuery:function(t,i){t&1&&Me(i.iframe,Hg,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"],disableWidgetShell:[1,"disableWidgetShell"],swipeDisabled:[1,"swipeDisabled"]},decls:2,vars:1,consts:[["freeboardSkIframe",""],["width","100%","height","100%","frameborder","0","sandbox","allow-same-origin allow-scripts allow-forms",1,"freeboardsk-iframe","no-shell",3,"src"],[1,"widget-shell",2,"overflow","clip","position","relative","width","100%","height","100%"],["width","100%","height","100%","frameborder","0","sandbox","allow-same-origin allow-scripts allow-forms",1,"freeboardsk-iframe",3,"src"],[1,"widgetOverlay"]],template:function(t,i){t&1&&I(0,qg,3,3,"iframe",1)(1,jg,5,4,"div",2),t&2&&N(i.disableWidgetShell()?0:1)},dependencies:[Lu],styles:[".widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent}"]})}return n})();var Yg={1e3:"notification",1001:"alert",1002:"warn",1003:"alarm",1004:"emergency"},Fu=(()=>{class n{settings=y(Vt);toastService=y(en);audioBlockedNotificationShown=!1;data=y(Wt);requests=y(ri);static ALARM_SEVERITIES={normal:{sound:0,visual:0},nominal:{sound:0,visual:0},alert:{sound:1,visual:0},warn:{sound:2,visual:1},alarm:{sound:3,visual:2},emergency:{sound:4,visual:2}};_notificationSettingsSubscription=null;_notificationDataStreamSubscription=null;_notificationMetaStreamSubscription=null;_resetServiceSubscription=null;_notificationConfig;_notificationConfig$=new ji(xc);_notifications=[];_notifications$=new ji([]);_alarmsInfo$=new ji({audioSev:0,visualSev:0,alarmCount:0,isMuted:!1});_players=new Map;_activeAlarmSoundtrack=null;_isMuted=!1;_lastEmittedValue=null;constructor(){this._notificationSettingsSubscription=this.settings.getNotificationServiceConfigAsO().subscribe(e=>{this._notificationConfig=e,this.reset(),this._notificationConfig$.next(e),this._notificationConfig.disableNotifications&&!this._notificationDataStreamSubscription?.closed&&this.stopNotificationStream(),!this._notificationConfig.disableNotifications&&(this._notificationDataStreamSubscription===null||this._notificationDataStreamSubscription?.closed)&&this.startNotificationStream(),this._notificationConfig.sound.disableSound?this.playAlarm(1e3):this.updateNotificationsState()}),this._resetServiceSubscription=this.data.isResetService().subscribe(e=>{e&&this.reset()}),this.getPlayer(1e3)}startNotificationStream(){this._notificationDataStreamSubscription=this.data.getNotificationMsgObservable().subscribe(e=>this.processNotificationDeltaMsg(e)),this._notificationMetaStreamSubscription=this.data.getNotificationMetaObservable().subscribe(e=>this.processNotificationDeltaMeta(e))}stopNotificationStream(){this._notificationDataStreamSubscription?.unsubscribe(),this._notificationMetaStreamSubscription?.unsubscribe(),this.reset()}reset(){this._notificationConfig.disableNotifications&&(this._notifications=[],this._notifications$.next([])),this.updateNotificationsState()}emitNotifications(){this._notifications$.next([...this._notifications])}observeNotifications(){return this._notifications$.asObservable()}addValue(e){this._notifications.push({path:e.path,value:e.value}),this.updateNotificationsState(),this.emitNotifications()}updateValue(e){let t=this._notifications.findIndex(i=>i.path==e.path);if(t>=0){let i=this._notifications[t];this._notifications[t]=fe(ae({},i),{value:ae({},e.value)}),this.updateNotificationsState(),this.emitNotifications()}else console.log("[Notification Service] Update path not found for: "+e.path)}deleteValue(e){let t=this._notifications.findIndex(i=>i.path==e);if(t>=0){let i=this._notifications[t];this._notifications[t]=fe(ae({},i),{value:void 0}),this.updateNotificationsState(),this.emitNotifications()}else console.log("[Notification Service] Notification to delete not found for: "+e)}updateNotificationsState(){let e=0,t=0,i=0;for(let r of this._notifications){if(!r.value||!("method"in r.value)||r.value.method.length===0||r.value.state===Ae.Normal&&!this._notificationConfig.devices.showNormalState||r.value.state===Ae.Nominal&&!this._notificationConfig.devices.showNominalState)continue;i++;let{aSev:s,vSev:l}=this.getNotificationSeverity(r);e=Math.max(e,s),t=Math.max(t,l)}this._notificationConfig.sound.disableSound||this.playAlarm(1e3+e);let a={audioSev:e,visualSev:t,alarmCount:i,isMuted:this._isMuted};wi(a,this._lastEmittedValue)||(this._alarmsInfo$.next(a),this._lastEmittedValue=a)}processNotificationDeltaMsg(e){if(!e.path.startsWith("notifications.security"))if(e.value===null)this.deleteValue(e.path);else{let t=this._notifications.find(i=>i.path==e.path);t?(!t.value||t.value.state!==e.value.state||t.value.message!==e.value.message||!wi(t.value.method,e.value.method))&&this.updateValue(e):this.addValue(e)}}processNotificationDeltaMeta(e){let t=this._notifications.findIndex(i=>i.path==e.path);if(t>=0){let i=this._notifications[t];this._notifications[t]=fe(ae({},i),{meta:e.meta})}else this._notifications.push({path:e.path,meta:e.meta});this.emitNotifications()}getNotificationSeverity(e){let t=e.value.state,i=n.ALARM_SEVERITIES[t];if(!i)return console.log(`[Notification Service] Unknown Notification State
40
- `+JSON.stringify(e)),{aSev:0,vSev:0};let a=i.sound,r=i.visual;return(!e.value.method.includes(Cl.Sound)||this._notificationConfig.sound[`mute${t.charAt(0).toUpperCase()+t.slice(1)}`]||this._isMuted)&&(a=0),e.value.method.includes(Cl.Visual)||(r=0),{aSev:a,vSev:r}}setSkMethod(e,t){this.requests.putRequest(`${e}.method`,t,Si.create())}setSkState(e,t){this.requests.putRequest(`${e}.state`,t,Si.create())}observerNotificationsInfo(){return this._alarmsInfo$.pipe(Zt(e=>{let t=!1,i=!1;switch(e.visualSev){case 1:t=!0;break;case 2:i=!0;break}return fe(ae({},e),{isWarn:t,isAlarmEmergency:i})}))}getPlayer(e){let t=this._players.get(e);if(t)return t;let i=Yg[e];if(!i)return console.warn("[Notification Service] Unknown track id",e),this.getPlayer(1e3);let a=new Audio(`assets/${i}.mp3`);return a.preload="auto",a.loop=!0,a.muted=this._isMuted,this._players.set(e,a),a}mutePlayer(e){if(this._activeAlarmSoundtrack!=null&&this._activeAlarmSoundtrack!==1e3){let t=this._players.get(this._activeAlarmSoundtrack);t&&(t.muted=e)}this._isMuted=e,this.updateNotificationsState()}playAlarm(e){if(this._activeAlarmSoundtrack===e)return;if(this._activeAlarmSoundtrack!=null){let i=this._players.get(this._activeAlarmSoundtrack);i&&(i.pause(),i.currentTime=0)}if(e===1e3){this._activeAlarmSoundtrack=1e3;return}let t=this.getPlayer(e);this._activeAlarmSoundtrack=e,t.muted=this._isMuted,t.currentTime=0,t.play().catch(i=>{console.debug("Alarm audio playback blocked:",i.message),this.audioBlockedNotificationShown||(this.audioBlockedNotificationShown=!0,this.toastService.show("Alarm sounds blocked by browser. Closing this message will enable audio.",0,!0,"warn").afterDismissed().subscribe(()=>{this.audioBlockedNotificationShown=!1}))})}observeNotificationConfiguration(){return this._notificationConfig$.asObservable()}ngOnDestroy(){this._notificationSettingsSubscription?.unsubscribe(),this._resetServiceSubscription?.unsubscribe(),this._notificationDataStreamSubscription?.unsubscribe(),this._notificationMetaStreamSubscription?.unsubscribe(),this._notificationConfig$.complete(),this._notifications$.complete(),this._alarmsInfo$.complete();for(let e of this._players.values())try{e.pause(),e.currentTime=0,e.src=""}catch(t){}this._players.clear()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ds=class n{static DEBUG=!1;isChromeOnMac;isFirefox;static _suppressAllGesturesUntil=0;static _instanceCounter=0;_instanceId;static _laneOwners=new Map;static _activePointers=new Set;static _multiPointerActive=!1;static _instanceToEl=new Map;swipeMinDistance=x(30);swipeMaxDuration=x(600);longPressMs=x(500);doubleTapInterval=x(300);tapSlop=x(20);pressMoveSlop=x(10);mode=x("all");disableGestures=x(!1);enablePress=x(!0);enableDoubleTap=x(!0);bridgeUiEvents=x(!1);_swipeMinDistance=30;_swipeMaxDuration=600;_longPressMs=500;_doubleTapInterval=300;_tapSlop=20;_pressMoveSlop=10;swipeleft=ut();swiperight=ut();swipeup=ut();swipedown=ut();press=ut();doubletap=ut();zone=y(Be);destroyRef=y(Ze);host=y(Ke);pointerId=null;startX=0;startY=0;startTime=0;tracking=!1;longPressTimer=null;pressFired=!1;ownedLanes={h:!1,v:!1,p:!1};cancelLongpressHandlers=[];lastTapTime=0;lastTapX=0;lastTapY=0;currentPointerType=null;lastTapUpTime=0;lastTapUpX=0;lastTapUpY=0;potentialDoubleTap=!1;onContextMenu=o=>{o.preventDefault()};lockedAxis=null;axisLockThreshold=6;captureEl=null;static MOVES_BUFFER_SIZE=120;moveSamples=[];constructor(){this.isChromeOnMac=(()=>{let o=navigator.userAgent,e=navigator.platform;return/Chrome\//.test(o)&&/Mac/.test(e)&&!/Edg\//.test(o)&&!/OPR\//.test(o)})(),this.isFirefox=/Firefox\//.test(navigator.userAgent),this._instanceId=++n._instanceCounter,this.debug("GestureDirective instance created",{instanceId:this._instanceId});try{n._instanceToEl.set(this._instanceId,this.host.nativeElement)}catch(o){}this.zone.runOutsideAngular(()=>{let o=this.host.nativeElement;o.style.touchAction||(o.style.touchAction="none","webkitTouchCallout"in o.style&&(o.style.webkitTouchCallout="none"),o.style.userSelect||(o.style.userSelect="none"),o.style.webkitUserSelect===""&&(o.style.webkitUserSelect="none"),o.style.webkitTapHighlightColor="transparent"),o.addEventListener("pointerdown",this.onPointerDown,{passive:!1,capture:!0}),o.addEventListener("pointermove",this.onPointerMove,{passive:!0,capture:!0}),o.addEventListener("pointerrawupdate",this.onPointerRawUpdate,{passive:!0,capture:!0}),o.addEventListener("pointerup",this.onPointerUp,{passive:!0}),o.addEventListener("pointercancel",this.onPointerCancel,{passive:!0,capture:!0}),o.addEventListener("lostpointercapture",this.onLostPointerCapture,{passive:!0,capture:!0}),o.addEventListener("dblclick",this.onNativeDblClick,{passive:!0});let e=i=>{let a=i;if(a.detail?.__gid===this._instanceId||this.disableGestures())return;let s=a.target,l=!!(s&&s!==this.host.nativeElement&&this.host.nativeElement.contains(s)),m=this.modeAllowsHorizontal(),f=this.modeAllowsVertical(),b=this.modeAllowsPress(),A=this.modeAllowsDoubleTap();if(l&&(a.type==="press"||a.type==="doubletap")&&(b=b||a.type==="press",A=A||a.type==="doubletap"),a.type==="press"||a.type==="doubletap"){let C=this.host.nativeElement,w=s&&typeof s.closest=="function"?s.closest(".widget-container"):null;w&&w!==C&&(b=!1,A=!1);let M=C.classList?.contains("grid-stack")||C.tagName?.toLowerCase()==="gridstack",G=s&&typeof s.closest=="function"?s.closest(".grid-stack-item"):null;M&&G&&(b=!1,A=!1,this.debug("suppress grid-root rebroadcast for press/doubletap inside grid-stack-item",{host:this.elDesc(C),target:this.elDesc(s??void 0),inGridItem:this.elDesc(G)}))}this.debug("rebroadcast gate",{type:a.type,allowH:m,allowV:f,allowP:b,allowDT:A,fromChild:l,target:this.elDesc(s??void 0),host:this.elDesc(this.host.nativeElement),mode:this.mode()}),this.zone.run(()=>{switch(a.type){case"press":b&&(this.debug("rebroadcast emit: press"),this.press.emit(a));break;case"doubletap":A&&(this.debug("rebroadcast emit: doubletap"),this.doubletap.emit(a));break;case"swipeleft":m&&(this.debug("rebroadcast emit: swipeleft"),this.swipeleft.emit(a));break;case"swiperight":m&&(this.debug("rebroadcast emit: swiperight"),this.swiperight.emit(a));break;case"swipeup":f&&(this.debug("rebroadcast emit: swipeup"),this.swipeup.emit(a));break;case"swipedown":f&&(this.debug("rebroadcast emit: swipedown"),this.swipedown.emit(a));break}})},t={passive:!0};o.addEventListener("press",e,t),o.addEventListener("doubletap",e,t),o.addEventListener("swipeleft",e,t),o.addEventListener("swiperight",e,t),o.addEventListener("swipeup",e,t),o.addEventListener("swipedown",e,t),o.addEventListener("contextmenu",this.onContextMenu,{passive:!1}),this.destroyRef.onDestroy(()=>{o.removeEventListener("pointerdown",this.onPointerDown,{capture:!0}),o.removeEventListener("pointermove",this.onPointerMove,{capture:!0}),o.removeEventListener("pointerrawupdate",this.onPointerRawUpdate,{capture:!0}),o.removeEventListener("pointerup",this.onPointerUp),o.removeEventListener("pointercancel",this.onPointerCancel,{capture:!0}),o.removeEventListener("lostpointercapture",this.onLostPointerCapture,{capture:!0}),o.removeEventListener("dblclick",this.onNativeDblClick),o.removeEventListener("press",e,t),o.removeEventListener("doubletap",e,t),o.removeEventListener("swipeleft",e,t),o.removeEventListener("swiperight",e,t),o.removeEventListener("swipeup",e,t),o.removeEventListener("swipedown",e,t),o.removeEventListener("contextmenu",this.onContextMenu),this.longPressTimer&&(window.clearTimeout(this.longPressTimer),this.longPressTimer=null),this.removeLongpressCancelListeners();try{if(this.pointerId!==null){let i=this.constructor._laneOwners,a=i.get(this.pointerId);a&&(this.debug("onDestroy: releasing lane ownership",{pointerId:this.pointerId,ownersBefore:a,ownedByThis:this.ownedLanes,instanceId:this._instanceId}),this.ownedLanes.h&&a.h===this._instanceId&&delete a.h,this.ownedLanes.v&&a.v===this._instanceId&&delete a.v,this.ownedLanes.p&&a.p===this._instanceId&&delete a.p,!a.h&&!a.v&&!a.p?i.delete(this.pointerId):i.set(this.pointerId,a),this.debug("onDestroy: lane owners after release",{pointerId:this.pointerId,owners:a}));let r=this.constructor._activePointers.delete(this.pointerId);this.debug("onDestroy: activePointers delete",{pointerId:this.pointerId,deleted:r})}}catch(i){}try{this.pointerId!==null&&this.captureEl&&"releasePointerCapture"in this.captureEl&&this.captureEl.releasePointerCapture(this.pointerId)}catch(i){}this.pointerId=null,this.captureEl=null,this.tracking=!1;try{n._instanceToEl.delete(this._instanceId)}catch(i){}})})}onNativeDblClick=o=>{if(this.disableGestures()||!this.modeAllowsDoubleTap())return;let e=new CustomEvent("doubletap",{detail:{x:o.clientX,y:o.clientY,dt:0}});this.zone.run(()=>this.doubletap.emit(e)),this.lastTapTime=0};onPointerDown=o=>{let e=this.constructor._activePointers,t=e.has(o.pointerId);t||e.add(o.pointerId);let i=this.constructor._multiPointerActive;if(i||e.size>1){!i&&e.size>1&&this.debug("multi-pointer detected; blocking gestures",{activeCount:e.size,pointerId:o.pointerId}),this.constructor._multiPointerActive=!0,this.tracking&&this.reset(!0);return}(this.tracking||this.pressFired||this.longPressTimer)&&(this.debug("pointerdown with stale state; force reset",{tracking:this.tracking,pressFired:this.pressFired,hasTimer:!!this.longPressTimer}),this.reset());let a=performance.now(),r=this.constructor._suppressAllGesturesUntil;if(a<r){this.debug("pointerdown suppressed by global window after longpress",{now:Math.round(a),suppressUntil:Math.round(r),remainingMs:Math.round(r-a)});return}if(this.disableGestures()||(this.debug("pointerdown",{x:o.clientX,y:o.clientY,pointerId:o.pointerId,pointerType:o.pointerType,sourceElement:o.target instanceof Element?o.target.outerHTML:String(o.target)}),this.pointerId!==null))return;let s=this.modeAllowsHorizontal(),l=this.modeAllowsVertical(),m=this.modeAllowsPress(),f=this.modeAllowsDoubleTap();{let E=o.target,W=this.host.nativeElement,V=E&&typeof E.closest=="function"?E.closest(".widget-container"):null;V&&V!==W&&(m=!1,f=!1);let Y=W.classList?.contains("grid-stack")||W.tagName?.toLowerCase()==="gridstack",j=E&&typeof E.closest=="function"?E.closest(".grid-stack-item"):null;Y&&j&&(m=!1,f=!1,this.debug("suppress grid-root press/doubletap for event inside grid-stack-item",{host:this.elDesc(W),target:this.elDesc(E??void 0),inGridItem:this.elDesc(j)}))}if(!s&&!l&&!m&&!f){this.debug("ignoring pointerdown: no gestures enabled for current mode");return}let b=m||f,A=this.constructor._laneOwners;!t&&A.has(o.pointerId)&&(this.debug("new pointer sequence; clearing stale lane owners",{pointerId:o.pointerId,prevOwners:A.get(o.pointerId)}),A.delete(o.pointerId));let C=A.get(o.pointerId)??{};if(C.p!==void 0){let E=C.p,W=this.constructor._instanceToEl.get(E),V=this.host.nativeElement,Y=o.target??null,j=this.ownerRelationshipSummary(W??null,V,Y);this.debug("pre-acquire owners (press lane already owned)",{owners:C,ownerId:E,ownerEl:this.elDesc(W),hostEl:this.elDesc(V),targetEl:this.elDesc(Y),rel:j})}else this.debug("pre-acquire owners",{owners:C});if(this.ownedLanes={h:!1,v:!1,p:!1},s&&C.h===void 0&&(C.h=this._instanceId,this.ownedLanes.h=!0,this.debug("lane acquired",{lane:"horizontal",pointerId:o.pointerId,instanceId:this._instanceId,owners:C})),l&&C.v===void 0&&(C.v=this._instanceId,this.ownedLanes.v=!0,this.debug("lane acquired",{lane:"vertical",pointerId:o.pointerId,instanceId:this._instanceId,owners:C})),b&&C.p===void 0&&(C.p=this._instanceId,this.ownedLanes.p=!0,this.debug("lane acquired",{lane:"press",pointerId:o.pointerId,instanceId:this._instanceId,owners:C})),this.debug("lane acquisition",{allowH:s,allowV:l,allowPress:m,allowDT:f,wantP:b,acquired:this.ownedLanes,existingOwners:C}),!this.ownedLanes.h&&!this.ownedLanes.v&&!this.ownedLanes.p){if(b&&C.p!==void 0){let E=C.p,W=this.constructor._instanceToEl.get(E),V=this.host.nativeElement,Y=o.target??null,j=this.ownerRelationshipSummary(W??null,V,Y);this.debug("ignoring pointerdown: press lane not owned",{owners:C,ownerId:E,ownerEl:this.elDesc(W),hostEl:this.elDesc(V),targetEl:this.elDesc(Y),rel:j})}else this.debug("ignoring pointerdown: other instance owns relevant lanes",{owners:C});return}switch(this.pointerId=o.pointerId,A.set(o.pointerId,C),this.tracking=!0,this.pressFired=!1,this.currentPointerType=o.pointerType||null,this.lockedAxis=null,this.captureEl=null,this.isDebugEnabled()&&(this.moveSamples=[{t:performance.now(),x:o.clientX,y:o.clientY,source:"move"}]),o.pointerType){case"touch":this._swipeMinDistance=this.isChromeOnMac?Math.min(25,this.swipeMinDistance()):this.swipeMinDistance(),this._swipeMaxDuration=this.isChromeOnMac?Math.max(850,this.swipeMaxDuration()):this.swipeMaxDuration(),this._longPressMs=this.longPressMs(),this._doubleTapInterval=this.doubleTapInterval(),this._tapSlop=this.tapSlop(),this._pressMoveSlop=Math.max(this.pressMoveSlop(),16);break;case"pen":this._swipeMinDistance=20,this._swipeMaxDuration=500,this._longPressMs=500,this._doubleTapInterval=250,this._tapSlop=10,this._pressMoveSlop=2;break;default:this._swipeMinDistance=15,this._swipeMaxDuration=400,this._longPressMs=500,this._doubleTapInterval=250,this._tapSlop=8,this._pressMoveSlop=2;break}this.debug("thresholds",{pointerType:o.pointerType,swipeMinDistance:this._swipeMinDistance,swipeMaxDuration:this._swipeMaxDuration,longPressMs:this._longPressMs,doubleTapInterval:this._doubleTapInterval,tapSlop:this._tapSlop,pressMoveSlop:this._pressMoveSlop,axisLockThreshold:this.axisLockThreshold});let M=performance.now()-this.lastTapUpTime,G=Math.hypot(o.clientX-this.lastTapUpX,o.clientY-this.lastTapUpY);if(this.potentialDoubleTap=f&&M<=this._doubleTapInterval&&G<=this._tapSlop,this.startX=o.clientX,this.startY=o.clientY,this.startTime=performance.now(),o.pointerType!=="mouse"){let W=o.target??null??this.host.nativeElement;try{"setPointerCapture"in W?(W.setPointerCapture(o.pointerId),this.captureEl=W,this.debug("setPointerCapture success",{pointerId:o.pointerId,pointerType:o.pointerType,captureElement:this.elDesc(W)})):(this.captureEl=null,this.debug("setPointerCapture unavailable on element"))}catch(V){this.captureEl=null,this.debug("setPointerCapture failed",{pointerId:o.pointerId,pointerType:o.pointerType})}}if(this.longPressTimer&&(this.debug("longpress timer cleared on pointerdown"),window.clearTimeout(this.longPressTimer)),!this.potentialDoubleTap&&m&&this.ownedLanes.p){if(this.currentPointerType!=="mouse")try{o.preventDefault()}catch(E){}this.addLongpressCancelListeners(),this.debug("longpress timer scheduled",{scheduleAt:Math.round(performance.now()),firesAt:Math.round(performance.now()+this._longPressMs),longPressMs:this._longPressMs,pressMoveSlop:this._pressMoveSlop,ownedLanes:this.ownedLanes,pointerType:this.currentPointerType}),this.longPressTimer=window.setTimeout(()=>{if(this.debug("longpress timer fired",{tracking:this.tracking,firedAt:Math.round(performance.now())}),this.constructor._multiPointerActive){this.debug("longpress cancelled: multi-pointer active"),this.reset(!0),this.longPressTimer=null,this.removeLongpressCancelListeners();return}if(!this.tracking){this.debug("longpress cancelled: not tracking");return}let E=o.clientX-this.startX,W=o.clientY-this.startY;if(Math.abs(E)<=this._pressMoveSlop&&Math.abs(W)<=this._pressMoveSlop){this.debug("longpress recognized",{x:this.startX,y:this.startY}),this.isFirefox&&this.currentPointerType!=="mouse"&&this.suppressNextClick(500),this.currentPointerType!=="mouse"&&(this.constructor._suppressAllGesturesUntil=performance.now()+600,this.debug("set global suppression window after longpress",{until:Math.round(this.constructor._suppressAllGesturesUntil)})),this.pressFired=!0;let V={x:this.startX,y:this.startY,center:{x:this.startX,y:this.startY}};this.zone.run(()=>this.emitPressEvent(V)),this.reset()}this.longPressTimer=null,this.removeLongpressCancelListeners()},this._longPressMs)}else this.debug("longpress not scheduled",{potentialDoubleTap:this.potentialDoubleTap,allowPress:m,ownedPressLane:this.ownedLanes.p,reason:this.potentialDoubleTap?"awaiting doubletap":m?this.ownedLanes.p?"unknown":"press lane not owned":"press disabled by mode/flag",ownersForPointer:C})};onLostPointerCapture=o=>{if(o.pointerId===this.pointerId){if(this.currentPointerType!=="mouse"&&this.longPressTimer){this.debug("ignore lostpointercapture during active touch/pen long-press");return}this.onPointerCancel(o)}};suppressNextClick(o=500){this.debug("suppressNextClick (Firefox)",{timeoutMs:o});let e={capture:!0,passive:!1},t=["click","pointerup","mouseup","mousedown","auxclick","touchend","touchstart","contextmenu"],i=s=>{this.debug("suppress ghost event",s.type),s.preventDefault(),s.stopPropagation();let l=s;typeof l.stopImmediatePropagation=="function"&&l.stopImmediatePropagation()},a=()=>{t.forEach(s=>document.removeEventListener(s,i,e)),window.clearTimeout(r)};t.forEach(s=>document.addEventListener(s,i,e));let r=window.setTimeout(a,o)}onPointerMove=o=>this.handlePointerMotion(o,"move");onPointerRawUpdate=o=>this.handlePointerMotion(o,"raw");handlePointerMotion(o,e){if(!(!this.tracking||o.pointerId!==this.pointerId)){if(this.constructor._multiPointerActive){this.debug("multi-pointer block active; cancelling motion",{pointerId:o.pointerId,source:e}),this.reset(!0);return}if(!this.pressFired){if(this.recordMove(o,e),this.longPressTimer){let t=Math.abs(o.clientX-this.startX),i=Math.abs(o.clientY-this.startY);(t>this._pressMoveSlop||i>this._pressMoveSlop)&&(this.debug(`longpress cancelled by pointer${e==="raw"?"rawupdate":"move"}: moved beyond slop`,{dx:t,dy:i,slop:this._pressMoveSlop}),window.clearTimeout(this.longPressTimer),this.longPressTimer=null,this.removeLongpressCancelListeners())}if(!this.lockedAxis){let t=o.clientX-this.startX,i=o.clientY-this.startY,a=Math.abs(t),r=Math.abs(i);(a>=this.axisLockThreshold||r>=this.axisLockThreshold)&&(this.lockedAxis=a>=r?"x":"y",this.debug(`axis locked${e==="raw"?" (raw)":""}`,{axis:this.lockedAxis,dx:t,dy:i}))}}}}onPointerUp=o=>{if(this.debug("pointerup",{x:o.clientX,y:o.clientY,pointerId:o.pointerId}),!this.tracking||o.pointerId!==this.pointerId){this.cleanupActivePointer(o.pointerId);return}this.finishGesture(o,!1)};onPointerCancel=o=>{let e=this.host.nativeElement;if(this.debug("pointercancel",{pointerId:o.pointerId,pointerType:o.pointerType,event:o,documentActiveElement:document.activeElement,elementIsConnected:e.isConnected,elementVisibility:e.offsetParent!==null,hasPointerCapture:typeof e.hasPointerCapture=="function"?e.hasPointerCapture(o.pointerId):void 0,documentHidden:document.hidden}),!this.tracking||o.pointerId!==this.pointerId){this.cleanupActivePointer(o.pointerId);return}this.finishGesture(o,!0)};finishGesture(o,e){if(this.debug("finishGesture begin",{cancelled:e,hasTimer:!!this.longPressTimer,pressFired:this.pressFired,ownedLanes:this.ownedLanes}),this.cleanupActivePointer(o.pointerId),this.constructor._multiPointerActive){this.debug("multi-pointer block active; ignoring finishGesture",{pointerId:o.pointerId}),this.reset(!0);return}let t=performance.now(),i=t-this.startTime,a=o.clientX-this.startX,r=o.clientY-this.startY,s=Math.abs(a),l=Math.abs(r);if(this.longPressTimer&&(this.debug(`longpress cancelled by ${e?"pointercancel":"pointerup"}`,{durationMs:Math.round(i),absDx:s,absDy:l,pressMoveSlop:this._pressMoveSlop}),window.clearTimeout(this.longPressTimer),this.longPressTimer=null,this.removeLongpressCancelListeners()),this.pressFired){this.debug(`${e?"pointercancel":"pointerup"} after longpress: resetting gesture state`),this.reset();return}if(i<=this._swipeMaxDuration){let f=this.modeAllowsHorizontal(),b=this.modeAllowsVertical(),A=f&&this.ownedLanes.h&&(this.lockedAxis==="x"&&s>=this._swipeMinDistance||!this.lockedAxis&&s>=this._swipeMinDistance&&s>=l),C=b&&this.ownedLanes.v&&(this.lockedAxis==="y"&&l>=this._swipeMinDistance||!this.lockedAxis&&l>=this._swipeMinDistance&&l>s);if(this.debug("swipe gating",{allowH:f,allowV:b,owned:this.ownedLanes,lockedAxis:this.lockedAxis,horizontalOk:A,verticalOk:C}),A){this.debugSwipeDecision({phase:"recognized",axis:"x",dx:a,dy:r,absDx:s,absDy:l,duration:i,reason:e?"horizontal swipe (on cancel)":"horizontal swipe"}),this.debug("swipe detected",{direction:a>0?"right":"left",dx:a,dy:r,duration:i}),this.zone.run(()=>{a>0?this.emitSwipeEvent("swiperight",{dx:a,dy:r,duration:i}):this.emitSwipeEvent("swipeleft",{dx:a,dy:r,duration:i})}),this.reset();return}else if(C){this.debugSwipeDecision({phase:"recognized",axis:"y",dx:a,dy:r,absDx:s,absDy:l,duration:i,reason:e?"vertical swipe (on cancel)":"vertical swipe"}),this.debug("swipe detected",{direction:r>0?"down":"up",dx:a,dy:r,duration:i}),this.zone.run(()=>{r>0?this.emitSwipeEvent("swipedown",{dx:a,dy:r,duration:i}):this.emitSwipeEvent("swipeup",{dx:a,dy:r,duration:i})}),this.reset();return}if(!e){let w=this.lockedAxis??(s>=l?"x":"y"),M=w==="x"?s:l,G=[];M<this._swipeMinDistance&&G.push(`distance ${Math.round(M)}px < min ${this._swipeMinDistance}px`),!this.lockedAxis&&(w==="x"&&l>s||w==="y"&&s>l)&&G.push("orthogonal movement dominated"),this.debugSwipeDecision({phase:"rejected",axis:w,dx:a,dy:r,absDx:s,absDy:l,duration:i,reason:G.join("; ")||"fell through conditions"})}}else e||this.debugSwipeDecision({phase:"rejected",axis:this.lockedAxis??(s>=l?"x":"y"),dx:a,dy:r,absDx:s,absDy:l,duration:i,reason:`duration ${Math.round(i)}ms exceeds max ${this._swipeMaxDuration}ms`});if(!e&&this.ownedLanes.p&&this.modeAllowsDoubleTap()&&this.currentPointerType!=="mouse"&&s<=this._tapSlop&&l<=this._tapSlop&&i<this._longPressMs){let f=t,b=f-this.lastTapTime,A=Math.hypot(o.clientX-this.lastTapX,o.clientY-this.lastTapY);b<=this._doubleTapInterval&&A<=this._tapSlop?(this.zone.run(()=>this.emitDoubleTapEvent({x:o.clientX,y:o.clientY,dt:b})),this.lastTapTime=0,this.potentialDoubleTap=!1):(this.lastTapTime=f,this.lastTapX=o.clientX,this.lastTapY=o.clientY)}!e&&!this.pressFired&&s<=this._tapSlop&&l<=this._tapSlop&&i<this._longPressMs?(this.lastTapUpTime=t,this.lastTapUpX=o.clientX,this.lastTapUpY=o.clientY):this.potentialDoubleTap=!1,this.reset()}addLongpressCancelListeners(){this.debug("addLongpressCancelListeners");let o=r=>{this.debug("longpress cancelled by event",r?.type),this.longPressTimer&&(window.clearTimeout(this.longPressTimer),this.longPressTimer=null),this.removeLongpressCancelListeners()},e=this.host.nativeElement,t=document,i={capture:!0},a=[{type:"pointercancel",handler:o,opts:i,targets:["el","doc"]}];this.currentPointerType!=="mouse"&&a.push({type:"blur",handler:o,opts:i,targets:["window"]}),this.cancelLongpressHandlers=a;for(let r of this.cancelLongpressHandlers){let{type:s,handler:l,opts:m,targets:f}=r;f&&f.includes("el")&&e.addEventListener(s,l,m),f&&f.includes("doc")&&t.addEventListener(s,l,m),f&&f.includes("window")&&window.addEventListener(s,l,m)}}removeLongpressCancelListeners(){this.debug("removeLongpressCancelListeners");let o=this.host.nativeElement,e=document;for(let t of this.cancelLongpressHandlers){let{type:i,handler:a,opts:r,targets:s}=t;s&&s.includes("el")&&o.removeEventListener(i,a,r),s&&s.includes("doc")&&e.removeEventListener(i,a,r),s&&s.includes("window")&&window.removeEventListener(i,a,r)}this.cancelLongpressHandlers=[]}reset(o=!1){this.debug("reset gesture state"),this.longPressTimer&&(window.clearTimeout(this.longPressTimer),this.longPressTimer=null);try{this.pointerId!==null&&this.captureEl&&"releasePointerCapture"in this.captureEl&&this.captureEl.releasePointerCapture(this.pointerId)}catch(e){}try{if(this.pointerId!==null){let e=this.constructor._laneOwners,t=e.get(this.pointerId);t&&(this.debug("releasing lane ownership",{pointerId:this.pointerId,ownersBefore:t,ownedByThis:this.ownedLanes,instanceId:this._instanceId}),this.ownedLanes.h&&t.h===this._instanceId&&delete t.h,this.ownedLanes.v&&t.v===this._instanceId&&delete t.v,this.ownedLanes.p&&t.p===this._instanceId&&delete t.p,!t.h&&!t.v&&!t.p?e.delete(this.pointerId):e.set(this.pointerId,t),this.debug("lane owners after release",{pointerId:this.pointerId,owners:t}))}}catch(e){}this.pointerId!==null&&!o&&this.cleanupActivePointer(this.pointerId),this.pointerId=null,this.captureEl=null,this.tracking=!1,this.pressFired=!1,this.currentPointerType=null,this.lockedAxis=null,this.ownedLanes={h:!1,v:!1,p:!1},this.removeLongpressCancelListeners()}isDebugEnabled(){try{return this.constructor.DEBUG}catch(o){return this.constructor.DEBUG}}recordMove(o,e){this.isDebugEnabled()&&(this.moveSamples.push({t:performance.now(),x:o.clientX,y:o.clientY,source:e}),this.moveSamples.length>this.constructor.MOVES_BUFFER_SIZE&&this.moveSamples.shift())}debugSwipeDecision(o){if(!this.isDebugEnabled())return;let e=this.moveSamples,t=e[e.length-1],i;if(e.length>=2){let a=t?.t??performance.now(),r=100,s=e.length-2;for(;s>=0&&a-e[s].t<r;)s--;s=Math.max(0,s);let l=e[s],m=Math.max(1,(t?.t??a)-l.t),f=(t?.x??0)-l.x,b=(t?.y??0)-l.y;i=(o.axis==="x"?Math.abs(f):Math.abs(b))/m}this.debug("swipe decision",{phase:o.phase,axis:o.axis,dx:o.dx,dy:o.dy,absDx:o.absDx,absDy:o.absDy,durationMs:Math.round(o.duration),velocityAvgPxPerMs:o.velocity??(o.axis==="x"?o.absDx:o.absDy)/Math.max(1,o.duration),recentVelocity100msPxPerMs:i,minDistance:this._swipeMinDistance,maxDuration:this._swipeMaxDuration,lockedAxis:this.lockedAxis,reason:o.reason,samplesCount:e.length,firstSample:e[0],lastSample:e[e.length-1]})}debug(...o){this.isDebugEnabled()&&console.debug(`[GestureDirective][#${this._instanceId}]`,...o)}cleanupActivePointer(o){try{let e=this.constructor._activePointers;e.delete(o)&&this.debug("activePointers delete",{pointerId:o,activeCount:e.size}),this.constructor._multiPointerActive&&e.size===0&&(this.constructor._multiPointerActive=!1,this.debug("multi-pointer block lifted",{activeCount:e.size}))}catch(e){}}emitSwipeEvent(o,e){e.__gid=this._instanceId;let t=new CustomEvent(o,{detail:e,bubbles:!0,composed:!0});try{this.host.nativeElement.dispatchEvent(t)}catch(i){}if(this.debug("emitSwipeEvent",{name:o,detail:e}),this.bridgeUiEvents()&&(o==="swipeleft"||o==="swiperight"))try{let i=o==="swipeleft"?"openLeftSidenav":"openRightSidenav";document.dispatchEvent(new CustomEvent(i,{detail:e}))}catch(i){}switch(o){case"swipeleft":this.swipeleft.emit(t);break;case"swiperight":this.swiperight.emit(t);break;case"swipeup":this.swipeup.emit(t);break;case"swipedown":this.swipedown.emit(t);break}}emitPressEvent(o){let e=performance.now();if(e-this._lastPressEmitTs<80){this.debug("press emit suppressed by cooldown");return}this._lastPressEmitTs=e,o.__gid=this._instanceId;let t=new CustomEvent("press",{detail:o,bubbles:!0,composed:!0});try{this.host.nativeElement.dispatchEvent(t)}catch(i){}this.debug("emitPressEvent",{detail:o}),this.press.emit(t)}emitDoubleTapEvent(o){o.__gid=this._instanceId;let e=new CustomEvent("doubletap",{detail:o,bubbles:!0,composed:!0});try{this.host.nativeElement.dispatchEvent(e)}catch(t){}this.doubletap.emit(e)}modeAllowsHorizontal(){let o=this.mode();return this.disableGestures()?!1:o==="all"||o==="horizontal"}modeAllowsVertical(){let o=this.mode();return this.disableGestures()?!1:o==="all"||o==="dashboard"}modeAllowsPress(){let o=this.mode();return this.disableGestures()?!1:(o==="all"||o==="dashboard"||o==="press"||o==="editor")&&this.enablePress()}modeAllowsDoubleTap(){let o=this.mode();return this.disableGestures()?!1:(o==="all"||o==="dashboard"||o==="press"||o==="editor")&&this.enableDoubleTap()}elDesc(o){if(!o)return null;try{let e=o,t=o.tagName?.toLowerCase?.()??"node",i=e.id?`#${e.id}`:"",a=e.className&&typeof e.className=="string"?e.className:"",r=a?"."+a.split(/\s+/).filter(Boolean).slice(0,4).join("."):"";return`${t}${i}${r}`}catch(e){return"node"}}ownerRelationshipSummary(o,e,t){try{return{owner:this.elDesc(o),host:this.elDesc(e),target:this.elDesc(t),ownerIsConnected:o?o.isConnected:null,hostIsConnected:e.isConnected,targetIsConnected:t?t.isConnected:null,targetInOwner:o&&t?o.contains(t):null,targetInHost:t?e.contains(t):null,ownerInHost:o?e.contains(o):null,hostInOwner:o?o.contains(e):null}}catch(i){return{}}}static \u0275fac=function(e){return new(e||n)};static \u0275dir=Ot({type:n,selectors:[["","kipGestures",""]],inputs:{swipeMinDistance:[1,"swipeMinDistance"],swipeMaxDuration:[1,"swipeMaxDuration"],longPressMs:[1,"longPressMs"],doubleTapInterval:[1,"doubleTapInterval"],tapSlop:[1,"tapSlop"],pressMoveSlop:[1,"pressMoveSlop"],mode:[1,"mode"],disableGestures:[1,"disableGestures"],enablePress:[1,"enablePress"],enableDoubleTap:[1,"enableDoubleTap"],bridgeUiEvents:[1,"bridgeUiEvents"]},outputs:{swipeleft:"swipeleft",swiperight:"swiperight",swipeup:"swipeup",swipedown:"swipedown",press:"press",doubletap:"doubletap"}})};(()=>{try{(typeof localStorage<"u"?localStorage.getItem("kip:gesturesDebug"):null)==="1"&&(ds.DEBUG=!0);let o=window;o.kipGesturesDebug=e=>{let t=ds;typeof e=="boolean"?t.DEBUG=e:t.DEBUG=!t.DEBUG;try{localStorage.setItem("kip:gesturesDebug",t.DEBUG?"1":"0")}catch(i){}return console.info("KIP gestures debug:",t.DEBUG),t.DEBUG}}catch(n){}})();var oo=(()=>{class n{dataset=y(dn);syncDataChartDataset(e,t,i){let a=typeof t?.datachartPath=="string"?t.datachartPath.trim():"";if(!a)return;let r=typeof t?.datachartSource=="string"&&t.datachartSource.trim().length>0?t.datachartSource.trim():"default",s=t?.timeScale,l=Number(t?.period??0),m=i??"";this.upsertDataset({uuid:e,path:a,source:r,timeScale:s,period:l,label:m,serialize:!0,editable:!1})}syncNumericMiniChartDataset(e,t,i){let a=typeof t=="string"?t.trim():"";if(!a)return;let r=typeof i=="string"&&i.trim().length>0?i.trim():"default";this.upsertDataset({uuid:e,path:a,source:r,timeScale:"minute",period:.2,label:`simple-chart-${e}`,serialize:!1,editable:!1})}syncWindTrendsDatasets(e,t){!t||String(t).trim().length===0||(this.upsertDataset({uuid:`${e}-twd`,path:"self.environment.wind.directionTrue",source:"default",timeScale:t,period:30,label:`windtrends-${e}`,serialize:!0,editable:!1}),this.upsertDataset({uuid:`${e}-tws`,path:"self.environment.wind.speedTrue",source:"default",timeScale:t,period:30,label:`speedtrends-${e}`,serialize:!0,editable:!1}))}removeDatasetIfExists(e,t=!1){this.dataset.removeIfExists(e,t)}removeOwnedDatasets(e,t=!0){let i=typeof e=="string"?e.trim():"";if(!i)return;this.dataset.list().filter(s=>s.uuid===i||s.uuid?.startsWith(`${i}-`)).forEach(s=>{this.dataset.removeIfExists(s.uuid,t)})}upsertDataset(e){let t=this.dataset.getDatasetConfig(e.uuid);if(!t){this.dataset.create(e.path,e.source,e.timeScale,e.period,e.label,e.serialize,e.editable,e.uuid);return}if(!(t.path!==e.path||t.pathSource!==e.source||t.timeScaleFormat!==e.timeScale||t.period!==e.period||t.label!==e.label))return;let a=fe(ae({},t),{path:e.path,pathSource:e.source,timeScaleFormat:e.timeScale,period:e.period,label:e.label,editable:e.editable});this.dataset.edit(a,e.serialize)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Gu=(()=>{class n{_storage=y(Qc);_settings=y(Vt);upgrading=_(!1);error=_(null);messages=_([]);legacyFileVersion=9;legacyConfigVersion=10;targetConfigVersion=12;static widgetTypeToSelectorMap={WidgetNumeric:"widget-numeric",WidgetTextGeneric:"widget-text",WidgetDateGeneric:"widget-datetime",WidgetBooleanSwitch:"widget-boolean-switch",WidgetBlank:"widget-blank",WidgetStateComponent:"widget-button",WidgetSimpleLinearComponent:"widget-simple-linear",WidgetGaugeNgLinearComponent:"widget-gauge-ng-linear",WidgetGaugeNgRadialComponent:"widget-gauge-ng-radial",WidgetGaugeNgCompassComponent:"widget-gauge-ng-compass",WidgetGaugeComponent:"widget-gauge-steel",WidgetWindComponent:"widget-wind-steer",WidgetFreeboardskComponent:"widget-freeboardsk",WidgetAutopilotComponent:"widget-autopilot",WidgetDataChart:"widget-data-chart",WidgetRaceTimerComponent:"widget-racetimer",WidgetIframeComponent:"widget-iframe",WidgetTutorial:"widget-tutorial"};runUpgrade(e){return Ve(this,null,function*(){if(this.error.set(null),this.upgrading.set(!0),this.messages.set([]),e===void 0)try{let t=yield this._storage.listConfigs(this.legacyFileVersion);for(let i of t){let a=yield this.transformConfig(i);if(a)try{yield this._storage.setConfig(a.scope,a.name,a.newConfiguration),yield this._storage.setConfig(a.scope,a.name,a.oldConfiguration,this.legacyFileVersion),this.pushMsg(`[Upgrade] Configuration ${a.scope}/${a.name} upgraded to version ${this.targetConfigVersion}. Old configuration patched to version 0.`)}catch(r){this.pushError(`[Upgrade] Error saving configuration for ${i.name}: ${r.message}`)}}setTimeout(()=>this._settings.reloadApp(),1500)}catch(t){this.pushError("Error fetching configuration data: "+t.message)}else if(e===11&&this._settings.useSharedConfig)try{let t=yield this._storage.listConfigs(11);for(let i of t)try{let a=yield this._storage.getConfig(i.scope,i.name,11),r=Ft(a);this.pushMsg(`[Upgrade] Saving configuration backup to file ${i.scope}/${i.name}...`),yield this._storage.setConfig(i.scope,i.name,r,11.99),this.pushMsg(`[Upgrade] ${i.scope}/${i.name} -> v${this.targetConfigVersion}.`);let s=this.upgradeConfig(a);if(!s)continue;this.pushMsg("[Upgrade] Saving upgraded configurations..."),yield this._storage.setConfig(i.scope,i.name,s)}catch(a){this.pushError(`[Upgrade] Error upgrading ${i.scope}/${i.name}: ${a.message}`)}this.pushMsg("[Upgrade] Reloading app to finalize upgrade..."),setTimeout(()=>this._settings.reloadApp(),1500)}catch(t){this.pushError("Error fetching configuration data. Aborting upgrade. Details: "+t.message)}else if(e===11&&!this._settings.useSharedConfig){let t={app:null,dashboards:null,theme:null};t.app=this._settings.getAppConfig(),t.dashboards=this._settings.getDashboardConfig(),t.theme=this._settings.getThemeConfig(),t.app.configVersion=this.targetConfigVersion,this.addSplitShellConfigKeys(t.app);let i=this.extractAppDatasets(t.app);this.upgradeDashboardWidgets(t.dashboards),this.migrateDatasetsToDataCharts(i,t.dashboards),this.migrateUseNeedleToEnableNeedle(t.dashboards),localStorage.setItem("appConfig",JSON.stringify(t.app)),localStorage.setItem("dashboardsConfig",JSON.stringify(t.dashboards)),localStorage.setItem("themeConfig",JSON.stringify(t.theme)),setTimeout(()=>this._settings.reloadApp(),1500),this.upgrading.set(!1)}else{let t={app:null,widget:null,layout:null,theme:null};t.app=this._settings.loadConfigFromLocalStorage("appConfig"),t.widget=this._settings.loadConfigFromLocalStorage("widgetConfig"),t.layout=this._settings.loadConfigFromLocalStorage("layoutConfig"),t.theme=this._settings.loadConfigFromLocalStorage("themeConfig");let i=this.transformApp(t.app),a=this.extractAppDatasets(i),r=this.transformTheme(t.theme),s=t.layout?.rootSplits||[],l=t.layout?.splitSets||[],m=t.widget?.widgets||[],f=s.map((b,A)=>{let C=this.extractWidgetsFromSplitSets(l,m,b);return{id:b,name:`Dashboard ${A+1}`,configuration:C}});this.migrateDatasetsToDataCharts(a,f),this.migrateUseNeedleToEnableNeedle(f),localStorage.setItem("appConfig",JSON.stringify(i)),localStorage.setItem("dashboardsConfig",JSON.stringify(f)),localStorage.setItem("themeConfig",JSON.stringify(r)),setTimeout(()=>this._settings.reloadApp(),1500),this.upgrading.set(!1)}})}startFresh(){if(this.error.set(null),this.upgrading.set(!0),this._storage.initConfig===null)this._storage.listConfigs(this.legacyFileVersion).then(e=>Ve(this,null,function*(){for(let t of e){let i=yield this._storage.getConfig(t.scope,t.name,this.legacyFileVersion);if(i.app.configVersion=0,t.scope==="global")try{setTimeout(()=>{this._storage.patchGlobal(t.name,t.scope,i,"replace",this.legacyFileVersion),this.pushMsg(`[Retired] Configuration ${t.scope}/${t.name} patched to version 0.`)},750)}catch(a){this.pushError(`[Upgrade] Error saving configuration for ${t.name}.`)}else try{yield this._storage.setConfig(t.scope,t.name,i,this.legacyFileVersion),this.pushMsg(`[Retired] Configuration ${t.scope}/${t.name} patched to version 0.`)}catch(a){this.pushError(`[Upgrade] Error saving configuration for ${t.name}.`)}}})).catch(e=>this.pushError("Error fetching configuration data: "+e.message)).finally(()=>{this.upgrading.set(!1),this._settings.resetSettings()});else{let e={app:null,dashboards:null,theme:null};e.app=this._settings.loadConfigFromLocalStorage("appConfig"),e.theme=this._settings.loadConfigFromLocalStorage("themeConfig"),e.app.configVersion=this.targetConfigVersion,e.app.nightModeBrightness=.27,e.theme.themeName="",localStorage.setItem("appConfig",JSON.stringify(e.app)),localStorage.setItem("themeConfig",JSON.stringify(e.theme)),localStorage.removeItem("widgetConfig"),localStorage.removeItem("layoutConfig"),this.upgrading.set(!1)}}transformConfig(e){return Ve(this,null,function*(){let t=yield this._storage.getConfig(e.scope,e.name,this.legacyFileVersion);if(t.app.configVersion!==this.legacyConfigVersion)return this.pushError(`[Upgrade Service] ${e.scope}/${e.name} is not an upgradable version ${this.legacyConfigVersion} config. Skipping.`),null;let i=this.transformApp(t.app),a=this.extractAppDatasets(i),r=this.transformTheme(t.theme),s=t.layout?.rootSplits||[],l=t.layout?.splitSets||[],m=t.widget?.widgets||[],f=s.map((A,C)=>{let w=this.extractWidgetsFromSplitSets(l,m,A);return{id:A,name:`Dashboard ${C+1}`,configuration:w}});this.migrateDatasetsToDataCharts(a,f),this.migrateUseNeedleToEnableNeedle(f);let b=Ft(t);return b.app.configVersion=0,{scope:e.scope,name:e.name,newConfiguration:{app:i,theme:r,dashboards:f},oldConfiguration:b}})}extractAppDatasets(e){if(!e||!Array.isArray(e.dataSets))return[];let t=0,i=[],a=[];e.dataSets.forEach((r,s)=>{(r.editable===!0||r.editable===void 0)&&(a.push({period:r.period,datachartPath:r.path,datachartSource:r.pathSource,timeScale:r.timeScaleFormat,datasetUUID:r.uuid}),i.push(s),t++)});for(let r=i.length-1;r>=0;r--)e.dataSets.splice(i[r],1);return t&&this.pushMsg(`[Upgrade] Retired ${t} Dataset(s).`),a}migrateDatasetsToDataCharts(e,t){!Array.isArray(e)||e.length===0||Array.isArray(t)&&t.forEach(i=>{let a=0;i&&Array.isArray(i.configuration)&&(i.configuration.forEach(r=>{if(r&&typeof r=="object"&&r.input?.widgetProperties?.config){let s=e.find(l=>l.datasetUUID===r.input?.widgetProperties?.config.datasetUUID);s&&(Object.entries(s).forEach(([l,m])=>{l!=="datasetUUID"&&(r.input.widgetProperties.config[l]=m)}),delete r.input.widgetProperties.config?.datasetUUID,delete r.input.widgetProperties.config?.timeScaleFormat,a++)}}),a&&this.pushMsg(`[Upgrade] Migrated ${a} Realtime Data Chart widget(s).`))})}transformWidget(e,t){if(e.color==="white"&&(e.color="contrast"),e.textColor){switch(e.textColor){case"text":e.color="contrast";break;case"primary":e.color="blue";break;case"accent":e.color="yellow";break;case"warn":e.color="purple";break;case"nobar":t==="WidgetGaugeNgLinearComponent"&&(e.color="blue",e.gauge=e.gauge||{},e.gauge.useNeedle=!1);break;default:e.color=e.textColor}delete e.textColor}return e}transformApp(e){if(!e)return null;let t=Ft(e);return t.configVersion=this.targetConfigVersion,t.nightModeBrightness=.27,t.splitShellEnabled=!1,t.splitShellSide="left",t.splitShellWidth=.2,t.splitShellSwipeDisabled=!1,t}transformTheme(e){return e?{themeName:""}:null}upgradeConfig(e){try{if(e.app.configVersion!==11)return this.pushError(`[Upgrade Service] Config version ${e.app.configVersion} upgrade is not supported. Skipping...`),null;this.addSplitShellConfigKeys(e.app);let t=this.extractAppDatasets(e.app);this.migrateDatasetsToDataCharts(t,e.dashboards),this.migrateUseNeedleToEnableNeedle(e.dashboards);let i=0,a=0;if(Array.isArray(e.dashboards)){for(let r of e.dashboards)if(r&&Array.isArray(r.configuration)){for(let s of r.configuration)if(s&&typeof s=="object"){s.selector!=="widget-host2"&&(s.selector="widget-host2",i++);let l=m=>{let f=s[m],b=typeof f=="string"?Number(f):f;Number.isFinite(b)&&b!==0&&(s[m]=b*2,a++)};if(l("w"),l("h"),l("x"),l("y"),s.w===void 0||s.w===null){let m=s.minW,f=m||2;s.w=f,a++}if(s.h===void 0||s.h===null){let m=s.minH,f=m||2;s.h=f,a++}}}}return i&&this.pushMsg(`[Upgrade] Updated ${i} widget selector(s) to 'widget-host2'.`),a&&this.pushMsg(`[Upgrade] Doubled widget grid metrics for ${a} non-zero (w/h/x/y) entries.`),e.app.configVersion=12,{app:e.app,theme:e.theme,dashboards:e.dashboards}}catch(t){return this.pushError(`[Upgrade Service] Error upgrading ${e.app.configVersion}: ${t.message}`),null}}migrateUseNeedleToEnableNeedle(e){if(!Array.isArray(e))return;let t=0;for(let i of e)if(!(!i||!Array.isArray(i.configuration)))for(let a of i.configuration){let l=a.input?.widgetProperties?.config?.gauge;!l||typeof l!="object"||Object.prototype.hasOwnProperty.call(l,"useNeedle")&&(l.enableNeedle===void 0?l.enableNeedle=!!l.useNeedle:l.enableNeedle=!!l.enableNeedle,delete l.useNeedle,t++)}t&&this.pushMsg(`[Upgrade] Renamed gauge.useNeedle -> gauge.enableNeedle on ${t} widget(s).`)}addSplitShellConfigKeys(e){e&&(e.splitShellEnabled===void 0&&(e.splitShellEnabled=!1),e.splitShellSide===void 0&&(e.splitShellSide="left"),e.splitShellWidth===void 0&&(e.splitShellWidth=.2),e.splitShellSwipeDisabled===void 0&&(e.splitShellSwipeDisabled=!1))}upgradeDashboardWidgets(e){let t=0,i=0;if(Array.isArray(e)){for(let a of e)if(!(!a||!Array.isArray(a.configuration)))for(let r of a.configuration){if(!r||typeof r!="object")continue;r.selector!=="widget-host2"&&(r.selector="widget-host2",t++);let s=l=>{let m=r[l],f=typeof m=="string"?Number(m):m;Number.isFinite(f)&&f!==0&&(r[l]=f*2,i++)};if(s("w"),s("h"),s("x"),s("y"),r.w===void 0||r.w===null){let l=r.minW,m=typeof l=="string"?Number(l):l,f=Number.isFinite(m)&&m>0?m:2;r.w=f*2,i++}if(r.h===void 0||r.h===null){let l=r.minH,m=typeof l=="string"?Number(l):l,f=Number.isFinite(m)&&m>0?m:2;r.h=f*2,i++}}}t&&this.pushMsg(`[Upgrade] Updated ${t} localStorage widget selector(s) to 'widget-host2'.`),i&&this.pushMsg(`[Upgrade] Doubled grid metrics for ${i} non-zero (w/h/x/y) entries.`)}extractWidgetsFromSplitSets(e,t,i){let a=new Map(t.map(M=>[M.uuid,M])),r=[],s=[],l=0,m=0,f=24,b=24,A=3,C=3,w=M=>{let G=e.find(E=>E.uuid===M);if(!G){s.push(`Missing splitSet with UUID: ${M}`);return}G.splitAreas.forEach(E=>{if(E.type==="widget"){let W=a.get(E.uuid);if(W){if(W.type==="WidgetBlank")return;if(m+C>b){s.push(`No space left for widget: ${W.uuid}`);return}let V=n.widgetTypeToSelectorMap[W.type]||"widget-unknown",Y=this.transformWidget(W.config,W.type);r.push({id:W.uuid,selector:"widget-host2",input:{widgetProperties:{type:V,uuid:W.uuid,config:Y}},x:l,y:m,w:A,h:C}),l+=A,l>=f&&(l=0,m+=C)}else s.push(`Missing widget with UUID: ${E.uuid}`)}else E.type==="splitSet"&&w(E.uuid)})};return w(i),s.length&&this.pushMsg("Transformation Issues: "+s.join("; ")),r}pushMsg(e){this.messages.update(t=>[...t,e])}pushError(e){this.error.set(e),this.pushMsg(e)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function Zg(n,o){if(n&1&&F(0,"img",3),n&2){let e=k();J("src",e.data.iconHref,Pr)}}function Qg(n,o){n&1&&Or(0)}var Tl=(()=>{class n{data=y(ti);static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["dialog-frame"]],decls:10,vars:4,consts:[[1,"dialogue-header"],[1,"dialog-title"],["mat-dialog-title",""],["alt","","aria-hidden","true",1,"dialog-title-icon"],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"dialog-content-padding"],[4,"ngComponentOutlet"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1)(2,"h5",2),I(3,Zg,1,1,"img",3),c(4),u()(),d(5,"button",4)(6,"mat-icon"),c(7,"close"),u()()(),d(8,"mat-dialog-content",5),bi(9,Qg,1,0,"ng-container",6),u()),t&2&&(g(3),N(i.data.iconHref?3:-1),g(),ge(" ",i.data.title),g(),O("mat-dialog-close",!1),g(4),O("ngComponentOutlet",i.data.componentType))},dependencies:[Qe,Ht,Mi,ki,Ti,nt,Tt,Ac],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.dialog-title[_ngcontent-%COMP%]{display:flex;align-items:center}.dialog-title-icon[_ngcontent-%COMP%]{position:relative;top:12px;width:42px;height:42px;object-fit:contain}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}"]})}return n})();function Xg(n,o){if(n&1&&(d(0,"button",4),c(1),u()),n&2){let e=k();O("mat-dialog-close",!0),g(),X(e.data.confirmBtnText)}}var Bu=(()=>{class n{data=y(ti);static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["dialog-confirmation"]],decls:12,vars:6,consts:[[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],["align","end"],["mat-flat-button","",3,"mat-dialog-close"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"h5",1),c(2),u(),d(3,"button",2)(4,"mat-icon"),c(5,"close"),u()()(),d(6,"mat-dialog-content"),c(7),u(),d(8,"mat-dialog-actions",3)(9,"button",4),c(10),u(),I(11,Xg,2,2,"button",4),u()),t&2&&(g(2),X(i.data.title),g(),O("mat-dialog-close",!1),g(4),ge(" ",i.data.message,`
41
- `),g(2),O("mat-dialog-close",!1),g(),X(i.data.cancelBtnText),g(),N(i.data.confirmBtnText?11:-1))},dependencies:[Qe,Ht,Mi,ki,Nn,Ti,nt,At,Tt],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}"]})}return n})();function Kg(n,o){if(n&1&&(d(0,"button",9),c(1),u()),n&2){let e=k(),t=Nt(1);O("disabled",!t.valid),g(),X(e.data.confirmBtnText)}}var zu=(()=>{class n{dialogRef=y(tn);data=y(ti);saveName(){this.dialogRef.close(this.data)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["dialog-name"]],decls:19,vars:6,consts:[["name","ngForm"],["name","name",3,"ngSubmit"],[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"field-margin"],["matInput","","type","text","id","name","placeholder","Name","name","name","required","","cdkFocusInitial","",3,"ngModelChange","ngModel"],["align","end"],["mat-flat-button","",3,"mat-dialog-close"],["mat-flat-button","","type","submit",3,"disabled"]],template:function(t,i){if(t&1){let a=Se();d(0,"form",1,0),U("ngSubmit",function(){return i.saveName()}),d(2,"div",2)(3,"h5",3),c(4),u(),d(5,"button",4)(6,"mat-icon"),c(7,"close"),u()()(),d(8,"mat-dialog-content")(9,"mat-form-field",5)(10,"mat-label"),c(11,"Name"),u(),d(12,"input",6),pn("ngModelChange",function(s){return ee(a),hn(i.data.name,s)||(i.data.name=s),te(s)}),u(),d(13,"mat-error"),c(14," A name is required "),u()()(),d(15,"mat-dialog-actions",7)(16,"button",8),c(17),u(),I(18,Kg,2,2,"button",9),u()()}t&2&&(g(4),X(i.data.title),g(),O("mat-dialog-close",!1),g(7),mn("ngModel",i.data.name),g(4),O("mat-dialog-close",!1),g(),X(i.data.cancelBtnText),g(),N(i.data.confirmBtnText?18:-1))},dependencies:[Ht,Mi,ki,Nn,Ti,et,Qe,ii,St,Ct,Ln,ni,wt,nt,At,Tt,It,$a,yt,dt,Dt,Pt,Rn,Qr],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}.field-margin[_ngcontent-%COMP%]{margin-left:15px;margin-bottom:15px}"]})}return n})();function Jg(n,o){n&1&&(d(0,"mat-option",19),c(1,"Toggle"),u(),d(2,"mat-option",20),c(3,"Push"),u(),d(4,"mat-option",21),c(5,"Indicator"),u())}function e0(n,o){n&1&&(d(0,"mat-option",8),c(1,"Zone State"),u())}function t0(n,o){if(n&1&&(d(0,"mat-option",10),c(1),u()),n&2){let e=o.$implicit;O("value",Li(e.value)),g(),X(e.label)}}function i0(n,o){n&1&&(d(0,"mat-checkbox",12),c(1," Use numeric path "),u())}function n0(n,o){if(n&1){let e=Se();d(0,"button",22),U("click",function(){ee(e);let i=k();return te(i.moveCtrlUp())}),d(1,"mat-icon"),c(2,"arrow_drop_up"),u()()}}function a0(n,o){if(n&1){let e=Se();d(0,"button",23),U("click",function(){ee(e);let i=k();return te(i.moveCtrlDown())}),d(1,"mat-icon"),c(2,"arrow_drop_down"),u()()}}var Uu=(()=>{class n{app=y(Di);ctrlFormGroup=x.required();controlIndex=x(void 0);arrayLength=x(void 0);deleteCtrl=ut();moveUp=ut();moveDown=ut();colors=[];ngOnInit(){this.colors=this.app.configurableThemeColors}deleteControl(){let e={ctrlIndex:this.controlIndex(),pathID:this.ctrlFormGroup().get("pathID").value};this.deleteCtrl.emit(e)}moveCtrlUp(){this.moveUp.emit(this.controlIndex())}moveCtrlDown(){this.moveDown.emit(this.controlIndex())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["boolean-control-config"]],inputs:{ctrlFormGroup:[1,"ctrlFormGroup"],controlIndex:[1,"controlIndex"],arrayLength:[1,"arrayLength"]},outputs:{deleteCtrl:"deleteCtrl",moveUp:"moveUp",moveDown:"moveDown"},decls:31,vars:5,consts:[[1,"ctrl-grid","rounded-card","rounded-card-color",3,"formGroup"],[1,"controls","flex-container"],[1,"flex-label"],[1,"full-width"],["matInput","","type","string","placeholder","Enter a display label...","formControlName","ctrlLabel"],[1,"flex-settings"],[1,"settings"],["placeholder","Select Type...","formControlName","type","name","type","required",""],["value","4"],["placeholder","Select Color...","formControlName","color","name","color","required",""],[3,"value"],[1,"flex-full-width"],["formControlName","isNumeric"],[1,"actions"],[1,"flex-actions"],[1,"btn-grid"],["mat-icon-button","","type","button","aria-label","Move control up in the list",1,"up"],["mat-icon-button","","type","button","aria-label","Move control down in the list",1,"down"],["mat-icon-button","","type","button","aria-label","Delete control",1,"delete",3,"click"],["value","1"],["value","2"],["value","3"],["mat-icon-button","","type","button","aria-label","Move control up in the list",1,"up",3,"click"],["mat-icon-button","","type","button","aria-label","Move control down in the list",1,"down",3,"click"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-form-field",3)(4,"mat-label"),c(5,"Label"),u(),F(6,"input",4),u()(),d(7,"div",5)(8,"mat-form-field",6)(9,"mat-label"),c(10,"Type"),u(),d(11,"mat-select",7),I(12,Jg,6,0)(13,e0,2,0,"mat-option",8),u()()(),d(14,"div",5)(15,"mat-form-field",6)(16,"mat-label"),c(17,"Color"),u(),d(18,"mat-select",9),xe(19,t0,2,3,"mat-option",10,Ne),u()()(),d(21,"div",11),I(22,i0,2,0,"mat-checkbox",12),u()(),d(23,"div",13)(24,"div",14)(25,"div",15),I(26,n0,3,0,"button",16),I(27,a0,3,0,"button",17),d(28,"button",18),U("click",function(){return i.deleteControl()}),d(29,"mat-icon"),c(30,"delete"),u()()()()()()),t&2&&(O("formGroup",i.ctrlFormGroup()),g(12),N(i.ctrlFormGroup().value.type!=="4"?12:13),g(7),Ce(i.colors),g(3),N(i.ctrlFormGroup().value.type!=="4"?22:-1),g(4),N(i.controlIndex()!==0?26:-1),g(),N(i.controlIndex()!==i.arrayLength()-1?27:-1))},dependencies:[It,yt,dt,Dt,Pt,xt,pt,Ei,St,Ct,wt,ai,Lt,Tt,oi,qt,et,Qe],styles:['.ctrl-grid[_ngcontent-%COMP%]{display:grid;width:auto;height:auto;margin:0 0 10px;grid-template-columns:[col-start] calc(100% - 90px) [col1-end] 80px [col2-end];grid-template-areas:"controls actions";row-gap:0px;column-gap:10px;justify-items:center;align-items:center;justify-content:center;align-content:center;padding-top:20px}.controls[_ngcontent-%COMP%]{grid-area:controls;width:100%}.actions[_ngcontent-%COMP%]{grid-area:actions}.btn-grid[_ngcontent-%COMP%]{display:grid;width:80px;height:80px;margin:0;grid-template-columns:[col-start] 50% [col1-end] 50% [col2-end];grid-template-rows:[row-start] 50% [row1-end] 50% [row2-end];grid-template-areas:"up delete" "down delete";row-gap:0px;column-gap:0px;justify-items:center;align-items:center;justify-content:center;align-content:center}.up[_ngcontent-%COMP%]{grid-area:up}.down[_ngcontent-%COMP%]{grid-area:down}.delete[_ngcontent-%COMP%]{grid-area:delete}.flex-label[_ngcontent-%COMP%]{flex-grow:2;flex-shrink:2}.flex-settings[_ngcontent-%COMP%]{flex-grow:1;flex-shrink:1}.settings[_ngcontent-%COMP%]{min-width:100px}.flex-actions[_ngcontent-%COMP%]{flex-grow:0;flex-shrink:0}.flex-full-width[_ngcontent-%COMP%]{width:100%}']})}return n})();function o0(n,o){if(n&1){let e=Se();d(0,"boolean-control-config",4),U("moveUp",function(i){ee(e);let a=k();return te(a.moveUp(i))})("moveDown",function(i){ee(e);let a=k();return te(a.moveDown(i))})("deleteCtrl",function(i){ee(e);let a=k();return te(a.deletePath(i))}),u()}if(n&2){let e=o.$implicit,t=o.$index,i=k();O("ctrlFormGroup",i.getFormGroup(e))("controlIndex",t)("arrayLength",i.arrayLength)}}var Hu=(()=>{class n{fb=y(Vn);multiCtrlArray=x.required();zonesOnlyPaths=x.required();addPath=ut();updatePath=ut();delPath=ut();multiFormGroup=null;arrayLength=0;multiCtrlArraySubscription=null;ngOnInit(){this.arrayLength=this.multiCtrlArray().length,this.multiFormGroup=new au({multiCtrlArray:this.multiCtrlArray()}),this.multiCtrlArraySubscription=this.multiCtrlArray().valueChanges.pipe(Tn(350)).subscribe(e=>{this.updatePath.emit(e)})}addCtrlGroup(){let e=Si.create();this.multiCtrlArray().push(this.fb.group({ctrlLabel:[null,Et.required],type:[this.zonesOnlyPaths()?"4":"1",Et.required],pathID:[e],color:["contrast"],isNumeric:[!!this.zonesOnlyPaths()],value:[null]})),this.arrayLength=this.multiCtrlArray().length;let t={path:{description:null,path:null,pathID:e,source:"default",pathType:this.zonesOnlyPaths()?"number":"boolean",zonesOnlyPaths:this.zonesOnlyPaths(),supportsPut:!this.zonesOnlyPaths(),isPathConfigurable:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:null,convertUnitTo:null,sampleTime:500},ctrlType:this.zonesOnlyPaths()?4:3};this.addPath.emit(t)}moveUp(e){let t=this.multiCtrlArray().at(e);this.multiCtrlArray().removeAt(e,{emitEvent:!1}),this.multiCtrlArray().insert(e-1,t,{emitEvent:!1})}moveDown(e){let t=this.multiCtrlArray().at(e);this.multiCtrlArray().removeAt(e,{emitEvent:!1}),this.multiCtrlArray().insert(e+1,t,{emitEvent:!1})}deletePath(e){this.delPath.emit(e),this.arrayLength=this.multiCtrlArray().length}getFormGroup(e){return e}ngOnDestroy(){this.multiCtrlArraySubscription?.unsubscribe()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["boolean-multicontrol-options"]],inputs:{multiCtrlArray:[1,"multiCtrlArray"],zonesOnlyPaths:[1,"zonesOnlyPaths"]},outputs:{addPath:"addPath",updatePath:"updatePath",delPath:"delPath"},decls:7,vars:1,consts:[[3,"formGroup"],["formArrayName","multiCtrlArray"],[1,"full-width",3,"ctrlFormGroup","controlIndex","arrayLength"],["type","button","mat-mini-fab","","color","primary","aria-label","Add control down in the list",1,"add-btn",3,"click"],[1,"full-width",3,"moveUp","moveDown","deleteCtrl","ctrlFormGroup","controlIndex","arrayLength"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1),xe(2,o0,1,3,"boolean-control-config",2,Ai),d(4,"button",3),U("click",function(){return i.addCtrlGroup()}),d(5,"mat-icon"),c(6,"add"),u()()()()),t&2&&(O("formGroup",i.multiFormGroup),g(2),Ce(i.multiCtrlArray().controls))},dependencies:[It,Dt,xt,pt,Kr,Uu,nt,qr,et,Qe],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;padding-top:15px;padding-bottom:15px}.add-btn[_ngcontent-%COMP%]{margin-left:calc(50% - 20px)}"]})}return n})();function r0(n,o){if(n&1&&(d(0,"mat-option",8),c(1),u()),n&2){let e=o.$implicit;O("value",Li(e.value)),g(),X(e.label)}}var qu=(()=>{class n{app=y(Di);displayName=x.required();showLabel=x.required();convertUnitTo=x.required();datasetUUID=x.required();datasetAverageArray=x.required();showAverageData=x.required();showDataPoints=x.required();trackAgainstAverage=x.required();showDatasetMinimumValueLine=x.required();showDatasetMaximumValueLine=x.required();showDatasetAverageValueLine=x.required();showDatasetAngleAverageValueLine=x.required();verticalChart=x.required();inverseYAxis=x.required();showTimeScale=x.required();showYScale=x.required();startScaleAtZero=x.required();yScaleSuggestedMin=x.required();yScaleSuggestedMax=x.required();enableMinMaxScaleLimit=x.required();yScaleMin=x.required();yScaleMax=x.required();numDecimal=x.required();color=x.required();colors=[];ngOnInit(){this.colors=this.app.configurableThemeColors,this.showAverageData()&&!this.showAverageData()?.value&&this.trackAgainstAverage().disable(),this.enableMinMaxScaleLimit()&&this.setValueScaleOptionsControls(this.enableMinMaxScaleLimit().value)}setValueScaleOptionsControls(e){e?(this.yScaleMin()?.enable(),this.yScaleMax()?.enable(),this.yScaleSuggestedMin()?.disable(),this.yScaleSuggestedMax()?.disable()):(this.yScaleMin()?.disable(),this.yScaleMax()?.disable(),this.yScaleSuggestedMin()?.enable(),this.yScaleSuggestedMax()?.enable())}setScaleControls(e){this.setValueScaleOptionsControls(e.value)}enableTrackAgainstMovingAverage(e){e.checked?this.trackAgainstAverage().enable():(this.trackAgainstAverage().setValue(e.checked),this.trackAgainstAverage().disable())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["config-display-chart-options"]],inputs:{displayName:[1,"displayName"],showLabel:[1,"showLabel"],convertUnitTo:[1,"convertUnitTo"],datasetUUID:[1,"datasetUUID"],datasetAverageArray:[1,"datasetAverageArray"],showAverageData:[1,"showAverageData"],showDataPoints:[1,"showDataPoints"],trackAgainstAverage:[1,"trackAgainstAverage"],showDatasetMinimumValueLine:[1,"showDatasetMinimumValueLine"],showDatasetMaximumValueLine:[1,"showDatasetMaximumValueLine"],showDatasetAverageValueLine:[1,"showDatasetAverageValueLine"],showDatasetAngleAverageValueLine:[1,"showDatasetAngleAverageValueLine"],verticalChart:[1,"verticalChart"],inverseYAxis:[1,"inverseYAxis"],showTimeScale:[1,"showTimeScale"],showYScale:[1,"showYScale"],startScaleAtZero:[1,"startScaleAtZero"],yScaleSuggestedMin:[1,"yScaleSuggestedMin"],yScaleSuggestedMax:[1,"yScaleSuggestedMax"],enableMinMaxScaleLimit:[1,"enableMinMaxScaleLimit"],yScaleMin:[1,"yScaleMin"],yScaleMax:[1,"yScaleMax"],numDecimal:[1,"numDecimal"],color:[1,"color"]},decls:85,vars:21,consts:[["minLine",""],[1,"tab-content"],[1,"chart-flex-container"],[1,"chart-panel-group"],[1,"full-width"],["matInput","","placeholder","Enter a label to display","name","displayName",3,"formControl"],["name","showLabel",1,"full-width",3,"formControl"],["placeholder","Select Color...","name","color","required","",3,"formControl"],[3,"value"],[1,"flex-item-rounded-card","rounded-card-color"],[2,"margin-left","10px"],["matInput","","type","number","min","0","max","5","placeholder","Enter or select number...","name","numDecimal","required","",3,"formControl"],["name","showDataPoints",1,"full-width",2,"margin-top","10px",3,"formControl"],["name","showAverageData",1,"full-width",3,"change","formControl"],["name","trackAgainstAverage",1,"full-width",2,"margin-left","25px",3,"formControl"],["name","verticalChart",3,"formControl"],[1,"no-margin"],[1,"mat-caption"],["aria-label","Select an option","name","enableMinMaxScaleLimit",1,"chart-option-radio-group",3,"formControl"],[1,"chart-option-radio-button",3,"change","value"],[1,"chart-option-radio-button-config"],[1,"chart-option-radio-button-config-form-field"],["matInput","","type","number","name","yScaleSuggestedMin",3,"formControl"],["matInput","","type","number","name","yScaleSuggestedMax",3,"formControl"],[1,"chart-option-radio-button-config-item"],["matInput","","type","number","name","yScaleMin","required","",3,"formControl"],["matInput","","type","number","name","yScaleMax","required","",3,"formControl"],["name","showYScale",1,"full-width",3,"formControl"],["name","inverseYAxis",3,"formControl"],["name","showTimeScale",1,"full-width",3,"formControl"],["name","showDatasetMaximumValueLine",1,"full-width",3,"formControl"],["name","showDatasetAverageValueLine",1,"full-width",3,"formControl"],["name","showDatasetMinimumValueLine",1,"full-width",3,"formControl"]],template:function(t,i){t&1&&(d(0,"div",1)(1,"div",2)(2,"div",3)(3,"mat-form-field",4)(4,"mat-label"),c(5,"Widget Label"),u(),F(6,"input",5),u()(),d(7,"div",3)(8,"mat-checkbox",6),c(9," Show Label "),u()()(),d(10,"div",2)(11,"mat-form-field",4)(12,"mat-label"),c(13,"Color"),u(),d(14,"mat-select",7),xe(15,r0,2,3,"mat-option",8,Ne),u()()(),d(17,"div",2)(18,"div",9)(19,"p"),c(20,"Series"),u(),d(21,"mat-form-field",10)(22,"mat-label"),c(23,"Value Decimal Places"),u(),F(24,"input",11),u(),d(25,"mat-checkbox",12),c(26," Display Data Points "),u(),d(27,"mat-checkbox",13),U("change",function(r){return i.enableTrackAgainstMovingAverage(r)}),c(28," Display Moving Average "),u(),d(29,"mat-checkbox",14),c(30," Track Against Moving Average "),u(),d(31,"mat-checkbox",15),c(32," Vertical Data Graph "),u()(),d(33,"div",9)(34,"div")(35,"p",16),c(36,"Data Scale"),u(),d(37,"span",17),c(38,"(Default node is automatic scale)"),u(),d(39,"mat-radio-group",18)(40,"mat-radio-button",19),U("change",function(r){return i.setScaleControls(r)}),c(41,"Auto Scale"),u(),d(42,"div",20)(43,"mat-form-field",21)(44,"mat-label"),c(45,"Suggested Min"),u(),F(46,"input",22),u(),d(47,"mat-form-field",21)(48,"mat-label"),c(49,"Suggested Max"),u(),F(50,"input",23),u()(),d(51,"mat-radio-button",19),U("change",function(r){return i.setScaleControls(r)}),c(52," Fixed Scale "),u(),d(53,"div",20)(54,"div",24)(55,"mat-form-field",21)(56,"mat-label"),c(57,"Min"),u(),F(58,"input",25),u()(),d(59,"div",24)(60,"mat-form-field",21)(61,"mat-label"),c(62,"Max"),u(),F(63,"input",26),u()()()(),d(64,"mat-checkbox",27),c(65," Show Scale Ticks "),u(),d(66,"mat-checkbox",28),c(67," Inverse Scale "),u()()(),d(68,"div",9)(69,"div")(70,"p",16),c(71,"Time Scale"),u(),d(72,"mat-checkbox",29),c(73," Show Scale Ticks "),u()()(),d(74,"div",9)(75,"div")(76,"p",16),c(77,"Dataset"),u(),d(78,"mat-checkbox",30),c(79," Show Maximum Line "),u(),d(80,"mat-checkbox",31),c(81," Show Average Line "),u(),d(82,"mat-checkbox",32,0),c(84," Show Minimum Line "),u()()()()()),t&2&&(g(6),O("formControl",i.displayName()),g(2),O("formControl",i.showLabel()),g(6),O("formControl",i.color()),g(),Ce(i.colors),g(9),O("formControl",i.numDecimal()),g(),O("formControl",i.showDataPoints()),g(2),O("formControl",i.showAverageData()),g(2),O("formControl",i.trackAgainstAverage()),g(2),O("formControl",i.verticalChart()),g(8),O("formControl",i.enableMinMaxScaleLimit()),g(),O("value",!1),g(6),O("formControl",i.yScaleSuggestedMin()),g(4),O("formControl",i.yScaleSuggestedMax()),g(),O("value",!0),g(7),O("formControl",i.yScaleMin()),g(5),O("formControl",i.yScaleMax()),g(),O("formControl",i.showYScale()),g(2),O("formControl",i.inverseYAxis()),g(6),O("formControl",i.showTimeScale()),g(6),O("formControl",i.showDatasetMaximumValueLine()),g(2),O("formControl",i.showDatasetAverageValueLine()),g(2),O("formControl",i.showDatasetMinimumValueLine()))},dependencies:[Jr,ii,St,Ct,oi,qt,on,ai,Lt,Wo,ni,wt,Au,vu,bu,xt,yt,nn,dt,Pt,On,ja,an],styles:[".chart-flex-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;margin:15px 0;gap:15px;align-items:stretch}.chart-panel-group[_ngcontent-%COMP%]{min-width:250px;flex-grow:1}.no-margin[_ngcontent-%COMP%]{margin:0}.chart-option-radio-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:0;align-items:flex-start}.chart-option-radio-button[_ngcontent-%COMP%]{margin:0}.chart-option-radio-button-config[_ngcontent-%COMP%]{margin-left:35px;display:flex;flex-direction:row;flex-wrap:wrap;gap:10px;align-items:flex-start}.chart-option-radio-button-config-item[_ngcontent-%COMP%]{flex-grow:0;flex-shrink:1;min-width:50px}.chart-option-radio-button-config-form-field[_ngcontent-%COMP%]{display:block;max-width:118px}"]})}return n})();var l0=["panel"],d0=["*"];function c0(n,o){if(n&1&&(D(0,"div",1,0),Lr(2),R()),n&2){let e=o.id,t=k();it(t._classList),st("mat-mdc-autocomplete-visible",t.showPanel)("mat-mdc-autocomplete-hidden",!t.showPanel)("mat-autocomplete-panel-animations-enabled",!t._animationsDisabled)("mat-primary",t._color==="primary")("mat-accent",t._color==="accent")("mat-warn",t._color==="warn"),Vi("id",t.id),J("aria-label",t.ariaLabel||null)("aria-labelledby",t._getPanelAriaLabelledby(e))}}var El=class{source;option;constructor(o,e){this.source=o,this.option=e}},$u=new un("mat-autocomplete-default-options",{providedIn:"root",factory:()=>({autoActiveFirstOption:!1,autoSelectActiveOption:!1,hideSingleSelectionIndicator:!1,requireSelection:!1,hasBackdrop:!1})}),lo=(()=>{class n{_changeDetectorRef=y(Ci);_elementRef=y(Ke);_defaults=y($u);_animationsDisabled=Ji();_activeOptionChanges=Fa.EMPTY;_keyManager;showPanel=!1;get isOpen(){return this._isOpen&&this.showPanel}_isOpen=!1;_latestOpeningTrigger;_setColor(e){this._color=e,this._changeDetectorRef.markForCheck()}_color;template;panel;options;optionGroups;ariaLabel;ariaLabelledby;displayWith=null;autoActiveFirstOption;autoSelectActiveOption;requireSelection;panelWidth;disableRipple=!1;optionSelected=new ei;opened=new ei;closed=new ei;optionActivated=new ei;set classList(e){this._classList=e,this._elementRef.nativeElement.className=""}_classList;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._syncParentProperties()}_hideSingleSelectionIndicator;_syncParentProperties(){if(this.options)for(let e of this.options)e._changeDetectorRef.markForCheck()}id=y(pa).getId("mat-autocomplete-");inertGroups;constructor(){let e=y(wc);this.inertGroups=e?.SAFARI||!1,this.autoActiveFirstOption=!!this._defaults.autoActiveFirstOption,this.autoSelectActiveOption=!!this._defaults.autoSelectActiveOption,this.requireSelection=!!this._defaults.requireSelection,this._hideSingleSelectionIndicator=this._defaults.hideSingleSelectionIndicator??!1}ngAfterContentInit(){this._keyManager=new Dc(this.options).withWrap().skipPredicate(this._skipPredicate),this._activeOptionChanges=this._keyManager.change.subscribe(e=>{this.isOpen&&this.optionActivated.emit({source:this,option:this.options.toArray()[e]||null})}),this._setVisibility()}ngOnDestroy(){this._keyManager?.destroy(),this._activeOptionChanges.unsubscribe()}_setScrollTop(e){this.panel&&(this.panel.nativeElement.scrollTop=e)}_getScrollTop(){return this.panel?this.panel.nativeElement.scrollTop:0}_setVisibility(){this.showPanel=!!this.options?.length,this._changeDetectorRef.markForCheck()}_emitSelectEvent(e){let t=new El(this,e);this.optionSelected.emit(t)}_getPanelAriaLabelledby(e){if(this.ariaLabel)return null;let t=e?e+" ":"";return this.ariaLabelledby?t+this.ariaLabelledby:e}_skipPredicate(){return!1}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["mat-autocomplete"]],contentQueries:function(t,i,a){if(t&1&&Wr(a,Lt,5)(a,uu,5),t&2){let r;yi(r=xi())&&(i.options=r),yi(r=xi())&&(i.optionGroups=r)}},viewQuery:function(t,i){if(t&1&&En(mc,7)(l0,5),t&2){let a;yi(a=xi())&&(i.template=a.first),yi(a=xi())&&(i.panel=a.first)}},hostAttrs:[1,"mat-mdc-autocomplete"],inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],displayWith:"displayWith",autoActiveFirstOption:[2,"autoActiveFirstOption","autoActiveFirstOption",bt],autoSelectActiveOption:[2,"autoSelectActiveOption","autoSelectActiveOption",bt],requireSelection:[2,"requireSelection","requireSelection",bt],panelWidth:"panelWidth",disableRipple:[2,"disableRipple","disableRipple",bt],classList:[0,"class","classList"],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",bt]},outputs:{optionSelected:"optionSelected",opened:"opened",closed:"closed",optionActivated:"optionActivated"},exportAs:["matAutocomplete"],features:[Vo([{provide:cu,useExisting:n}])],ngContentSelectors:d0,decls:1,vars:0,consts:[["panel",""],["role","listbox",1,"mat-mdc-autocomplete-panel","mdc-menu-surface","mdc-menu-surface--open",3,"id"]],template:function(t,i){t&1&&(Vr(),pc(0,c0,3,17,"ng-template"))},styles:[`div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:relative;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden,.cdk-overlay-pane:has(>.mat-mdc-autocomplete-hidden){visibility:hidden;pointer-events:none}@keyframes _mat-autocomplete-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}.mat-autocomplete-panel-animations-enabled{animation:_mat-autocomplete-enter 120ms cubic-bezier(0, 0, 0.2, 1)}mat-autocomplete{display:none}
42
- `],encapsulation:2,changeDetection:0})}return n})();var u0={provide:Yr,useExisting:Er(()=>ba),multi:!0};var m0=new un("mat-autocomplete-scroll-strategy",{providedIn:"root",factory:()=>{let n=y(No);return()=>Bc(n)}}),ba=(()=>{class n{_environmentInjector=y(dc);_element=y(Ke);_injector=y(No);_viewContainerRef=y(Nr);_zone=y(Be);_changeDetectorRef=y(Ci);_dir=y(Hr,{optional:!0});_formField=y(lu,{optional:!0,host:!0});_viewportRuler=y(Wc);_scrollStrategy=y(m0);_renderer=y(Ir);_animationsDisabled=Ji();_defaults=y($u,{optional:!0});_overlayRef=null;_portal;_componentDestroyed=!1;_initialized=new zt;_keydownSubscription;_outsideClickSubscription;_cleanupWindowBlur;_previousValue=null;_valueOnAttach=null;_valueOnLastKeydown=null;_positionStrategy;_manuallyFloatingLabel=!1;_closingActionsSubscription;_viewportSubscription=Fa.EMPTY;_breakpointObserver=y(Ua);_handsetLandscapeSubscription=Fa.EMPTY;_canOpenOnNextFocus=!0;_valueBeforeAutoSelection;_pendingAutoselectedOption=null;_closeKeyEventStream=new zt;_overlayPanelClass=kc(this._defaults?.overlayPanelClass||[]);_windowBlurHandler=()=>{this._canOpenOnNextFocus=this.panelOpen||!this._hasFocus()};_onChange=()=>{};_onTouched=()=>{};autocomplete;position="auto";connectedTo;autocompleteAttribute="off";autocompleteDisabled=!1;constructor(){}_aboveClass="mat-mdc-autocomplete-panel-above";ngAfterViewInit(){this._initialized.next(),this._initialized.complete(),this._cleanupWindowBlur=this._renderer.listen("window","blur",this._windowBlurHandler)}ngOnChanges(e){e.position&&this._positionStrategy&&(this._setStrategyPositions(this._positionStrategy),this.panelOpen&&this._overlayRef.updatePosition())}ngOnDestroy(){this._cleanupWindowBlur?.(),this._handsetLandscapeSubscription.unsubscribe(),this._viewportSubscription.unsubscribe(),this._componentDestroyed=!0,this._destroyPanel(),this._closeKeyEventStream.complete(),this._clearFromModal()}get panelOpen(){return this._overlayAttached&&this.autocomplete.showPanel}_overlayAttached=!1;openPanel(){this._openPanelInternal()}closePanel(){this._resetLabel(),this._overlayAttached&&(this.panelOpen&&this._zone.run(()=>{this.autocomplete.closed.emit()}),this.autocomplete._latestOpeningTrigger===this&&(this.autocomplete._isOpen=!1,this.autocomplete._latestOpeningTrigger=null),this._overlayAttached=!1,this._pendingAutoselectedOption=null,this._overlayRef&&this._overlayRef.hasAttached()&&(this._overlayRef.detach(),this._closingActionsSubscription.unsubscribe()),this._updatePanelState(),this._componentDestroyed||this._changeDetectorRef.detectChanges(),this._trackedModal&&Ur(this._trackedModal,"aria-owns",this.autocomplete.id))}updatePosition(){this._overlayAttached&&this._overlayRef.updatePosition()}get panelClosingActions(){return gi(this.optionSelections,this.autocomplete._keyManager.tabOut.pipe(vi(()=>this._overlayAttached)),this._closeKeyEventStream,this._getOutsideClickStream(),this._overlayRef?this._overlayRef.detachments().pipe(vi(()=>this._overlayAttached)):bl()).pipe(Zt(e=>e instanceof mu?e:null))}optionSelections=ec(()=>{let e=this.autocomplete?this.autocomplete.options:null;return e?e.changes.pipe(Ga(e),Mr(()=>gi(...e.map(t=>t.onSelectionChange)))):this._initialized.pipe(Mr(()=>this.optionSelections))});get activeOption(){return this.autocomplete&&this.autocomplete._keyManager?this.autocomplete._keyManager.activeItem:null}_getOutsideClickStream(){return new vl(e=>{let t=a=>{let r=Sc(a),s=this._formField?this._formField.getConnectedOverlayOrigin().nativeElement:null,l=this.connectedTo?this.connectedTo.elementRef.nativeElement:null;this._overlayAttached&&r!==this._element.nativeElement&&!this._hasFocus()&&(!s||!s.contains(r))&&(!l||!l.contains(r))&&this._overlayRef&&!this._overlayRef.overlayElement.contains(r)&&e.next(a)},i=[this._renderer.listen("document","click",t),this._renderer.listen("document","auxclick",t),this._renderer.listen("document","touchend",t)];return()=>{i.forEach(a=>a())}})}writeValue(e){Promise.resolve(null).then(()=>this._assignOptionValue(e))}registerOnChange(e){this._onChange=e}registerOnTouched(e){this._onTouched=e}setDisabledState(e){this._element.nativeElement.disabled=e}_handleKeydown(e){let t=e,i=t.keyCode,a=Pn(t);if(i===27&&!a&&t.preventDefault(),this._valueOnLastKeydown=this._element.nativeElement.value,this.activeOption&&i===13&&this.panelOpen&&!a)this.activeOption._selectViaInteraction(),this._resetActiveItem(),t.preventDefault();else if(this.autocomplete){let r=this.autocomplete._keyManager.activeItem,s=i===38||i===40;i===9||s&&!a&&this.panelOpen?this.autocomplete._keyManager.onKeydown(t):s&&this._canOpen()&&this._openPanelInternal(this._valueOnLastKeydown),(s||this.autocomplete._keyManager.activeItem!==r)&&(this._scrollToOption(this.autocomplete._keyManager.activeItemIndex||0),this.autocomplete.autoSelectActiveOption&&this.activeOption&&(this._pendingAutoselectedOption||(this._valueBeforeAutoSelection=this._valueOnLastKeydown),this._pendingAutoselectedOption=this.activeOption,this._assignOptionValue(this.activeOption.value)))}}_handleInput(e){let t=e.target,i=t.value;if(t.type==="number"&&(i=i==""?null:parseFloat(i)),this._previousValue!==i){if(this._previousValue=i,this._pendingAutoselectedOption=null,(!this.autocomplete||!this.autocomplete.requireSelection)&&this._onChange(i),!i)this._clearPreviousSelectedOption(null,!1);else if(this.panelOpen&&!this.autocomplete.requireSelection){let a=this.autocomplete.options?.find(r=>r.selected);if(a){let r=this._getDisplayValue(a.value);i!==r&&a.deselect(!1)}}if(this._canOpen()&&this._hasFocus()){let a=this._valueOnLastKeydown??this._element.nativeElement.value;this._valueOnLastKeydown=null,this._openPanelInternal(a)}}}_handleFocus(){this._canOpenOnNextFocus?this._canOpen()&&(this._previousValue=this._element.nativeElement.value,this._attachOverlay(this._previousValue),this._floatLabel(!0)):this._canOpenOnNextFocus=!0}_handleClick(){this._canOpen()&&!this.panelOpen&&this._openPanelInternal()}_hasFocus(){return Cc()===this._element.nativeElement}_floatLabel(e=!1){this._formField&&this._formField.floatLabel==="auto"&&(e?this._formField._animateAndLockLabel():this._formField.floatLabel="always",this._manuallyFloatingLabel=!0)}_resetLabel(){this._manuallyFloatingLabel&&(this._formField&&(this._formField.floatLabel="auto"),this._manuallyFloatingLabel=!1)}_subscribeToClosingActions(){let e=new vl(i=>{uc(()=>{i.next()},{injector:this._environmentInjector})}),t=this.autocomplete.options?.changes.pipe(Tr(()=>this._positionStrategy.reapplyLastPosition()),nc(0))??bl();return gi(e,t).pipe(Mr(()=>this._zone.run(()=>{let i=this.panelOpen;return this._resetActiveItem(),this._updatePanelState(),this._changeDetectorRef.detectChanges(),this.panelOpen&&this._overlayRef.updatePosition(),i!==this.panelOpen&&(this.panelOpen?this._emitOpened():this.autocomplete.closed.emit()),this.panelClosingActions})),Jt(1)).subscribe(i=>this._setValueAndClose(i))}_emitOpened(){this.autocomplete.opened.emit()}_destroyPanel(){this._overlayRef&&(this.closePanel(),this._overlayRef.dispose(),this._overlayRef=null)}_getDisplayValue(e){let t=this.autocomplete;return t&&t.displayWith?t.displayWith(e):e}_assignOptionValue(e){let t=this._getDisplayValue(e);e==null&&this._clearPreviousSelectedOption(null,!1),this._updateNativeInputValue(t??"")}_updateNativeInputValue(e){this._formField?this._formField._control.value=e:this._element.nativeElement.value=e,this._previousValue=e}_setValueAndClose(e){let t=this.autocomplete,i=e?e.source:this._pendingAutoselectedOption;i?(this._clearPreviousSelectedOption(i),this._assignOptionValue(i.value),this._onChange(i.value),t._emitSelectEvent(i),this._element.nativeElement.focus()):t.requireSelection&&this._element.nativeElement.value!==this._valueOnAttach&&(this._clearPreviousSelectedOption(null),this._assignOptionValue(null),this._onChange(null)),this.closePanel()}_clearPreviousSelectedOption(e,t){this.autocomplete?.options?.forEach(i=>{i!==e&&i.selected&&i.deselect(t)})}_openPanelInternal(e=this._element.nativeElement.value){if(this._attachOverlay(e),this._floatLabel(),this._trackedModal){let t=this.autocomplete.id;yl(this._trackedModal,"aria-owns",t)}}_attachOverlay(e){if(!this.autocomplete)return;let t=this._overlayRef;t?(this._positionStrategy.setOrigin(this._getConnectedElement()),t.updateSize({width:this._getPanelWidth()})):(this._portal=new Oc(this.autocomplete.template,this._viewContainerRef,{id:this._formField?.getLabelId()}),t=qc(this._injector,this._getOverlayConfig()),this._overlayRef=t,this._viewportSubscription=this._viewportRuler.change().subscribe(()=>{this.panelOpen&&t&&t.updateSize({width:this._getPanelWidth()})}),this._handsetLandscapeSubscription=this._breakpointObserver.observe(Wi.HandsetLandscape).subscribe(a=>{a.matches?this._positionStrategy.withFlexibleDimensions(!0).withGrowAfterOpen(!0).withViewportMargin(8):this._positionStrategy.withFlexibleDimensions(!1).withGrowAfterOpen(!1).withViewportMargin(0)})),t&&!t.hasAttached()&&(t.attach(this._portal),this._valueOnAttach=e,this._valueOnLastKeydown=null,this._closingActionsSubscription=this._subscribeToClosingActions());let i=this.panelOpen;this.autocomplete._isOpen=this._overlayAttached=!0,this.autocomplete._latestOpeningTrigger=this,this.autocomplete._setColor(this._formField?.color),this._updatePanelState(),this._applyModalPanelOwnership(),this.panelOpen&&i!==this.panelOpen&&this._emitOpened()}_handlePanelKeydown=e=>{(e.keyCode===27&&!Pn(e)||e.keyCode===38&&Pn(e,"altKey"))&&(this._pendingAutoselectedOption&&(this._updateNativeInputValue(this._valueBeforeAutoSelection??""),this._pendingAutoselectedOption=null),this._closeKeyEventStream.next(),this._resetActiveItem(),e.stopPropagation(),e.preventDefault())};_updatePanelState(){if(this.autocomplete._setVisibility(),this.panelOpen){let e=this._overlayRef;this._keydownSubscription||(this._keydownSubscription=e.keydownEvents().subscribe(this._handlePanelKeydown)),this._outsideClickSubscription||(this._outsideClickSubscription=e.outsidePointerEvents().subscribe())}else this._keydownSubscription?.unsubscribe(),this._outsideClickSubscription?.unsubscribe(),this._keydownSubscription=this._outsideClickSubscription=void 0}_getOverlayConfig(){return new zc({positionStrategy:this._getOverlayPosition(),scrollStrategy:this._scrollStrategy(),width:this._getPanelWidth(),direction:this._dir??void 0,hasBackdrop:this._defaults?.hasBackdrop,backdropClass:this._defaults?.backdropClass||"cdk-overlay-transparent-backdrop",panelClass:this._overlayPanelClass,disableAnimations:this._animationsDisabled})}_getOverlayPosition(){let e=Uc(this._injector,this._getConnectedElement()).withFlexibleDimensions(!1).withPush(!1).withPopoverLocation("inline");return this._setStrategyPositions(e),this._positionStrategy=e,e}_setStrategyPositions(e){let t=[{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top"},{originX:"end",originY:"bottom",overlayX:"end",overlayY:"top"}],i=this._aboveClass,a=[{originX:"start",originY:"top",overlayX:"start",overlayY:"bottom",panelClass:i},{originX:"end",originY:"top",overlayX:"end",overlayY:"bottom",panelClass:i}],r;this.position==="above"?r=a:this.position==="below"?r=t:r=[...t,...a],e.withPositions(r)}_getConnectedElement(){return this.connectedTo?this.connectedTo.elementRef:this._formField?this._formField.getConnectedOverlayOrigin():this._element}_getPanelWidth(){return this.autocomplete.panelWidth||this._getHostWidth()}_getHostWidth(){return this._getConnectedElement().nativeElement.getBoundingClientRect().width}_resetActiveItem(){let e=this.autocomplete;if(e.autoActiveFirstOption){let t=-1;for(let i=0;i<e.options.length;i++)if(!e.options.get(i).disabled){t=i;break}e._keyManager.setActiveItem(t)}else e._keyManager.setActiveItem(-1)}_canOpen(){let e=this._element.nativeElement;return!e.readOnly&&!e.disabled&&!this.autocompleteDisabled}_scrollToOption(e){let t=this.autocomplete,i=hu(e,t.options,t.optionGroups);if(e===0&&i===1)t._setScrollTop(0);else if(t.panel){let a=t.options.toArray()[e];if(a){let r=a._getHostElement(),s=pu(r.offsetTop,r.offsetHeight,t._getScrollTop(),t.panel.nativeElement.offsetHeight);t._setScrollTop(s)}}}_trackedModal=null;_applyModalPanelOwnership(){let e=this._element.nativeElement.closest('body > .cdk-overlay-container [aria-modal="true"]');if(!e)return;let t=this.autocomplete.id;this._trackedModal&&Ur(this._trackedModal,"aria-owns",t),yl(e,"aria-owns",t),this._trackedModal=e}_clearFromModal(){if(this._trackedModal){let e=this.autocomplete.id;Ur(this._trackedModal,"aria-owns",e),this._trackedModal=null}}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Ot({type:n,selectors:[["input","matAutocomplete",""],["textarea","matAutocomplete",""]],hostAttrs:[1,"mat-mdc-autocomplete-trigger"],hostVars:7,hostBindings:function(t,i){t&1&&U("focusin",function(){return i._handleFocus()})("blur",function(){return i._onTouched()})("input",function(r){return i._handleInput(r)})("keydown",function(r){return i._handleKeydown(r)})("click",function(){return i._handleClick()}),t&2&&J("autocomplete",i.autocompleteAttribute)("role",i.autocompleteDisabled?null:"combobox")("aria-autocomplete",i.autocompleteDisabled?null:"list")("aria-activedescendant",i.panelOpen&&i.activeOption?i.activeOption.id:null)("aria-expanded",i.autocompleteDisabled?null:i.panelOpen.toString())("aria-controls",i.autocompleteDisabled||!i.panelOpen||i.autocomplete==null?null:i.autocomplete.id)("aria-haspopup",i.autocompleteDisabled?null:"listbox")},inputs:{autocomplete:[0,"matAutocomplete","autocomplete"],position:[0,"matAutocompletePosition","position"],connectedTo:[0,"matAutocompleteConnectedTo","connectedTo"],autocompleteAttribute:[0,"autocomplete","autocompleteAttribute"],autocompleteDisabled:[2,"matAutocompleteDisabled","autocompleteDisabled",bt]},exportAs:["matAutocompleteTrigger"],features:[Vo([u0]),Zi]})}return n})(),ms=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Qi({type:n});static \u0275inj=Yi({imports:[$c,Wo,Fc,Wo,In]})}return n})();var h0=(n,o)=>o.path;function p0(n,o){if(n&1){let e=Se();d(0,"button",24),U("click",function(){ee(e);let i=k();return te(i.clearPathInputField())}),d(1,"mat-icon"),c(2,"close"),u()()}}function f0(n,o){n&1&&(d(0,"mat-error"),c(1," Path is required. Please enter a valid Signal K path. "),u())}function g0(n,o){n&1&&(d(0,"mat-error"),c(1," Path not recognized. Please enter a path from the server's published list. "),u())}function v0(n,o){if(n&1&&(d(0,"span"),c(1),u(),F(2,"br"),d(3,"small",25),c(4),u()),n&2){let e=k().$implicit;g(),X(e.path),g(3),X(e.meta.description)}}function b0(n,o){if(n&1&&c(0),n&2){let e=k().$implicit;ge(" ",e.path," ")}}function A0(n,o){if(n&1&&(d(0,"mat-option",8),I(1,v0,5,2)(2,b0,1,1),u()),n&2){let e=o.$implicit;O("value",e.path),g(),N(e.meta!==void 0?1:2)}}function y0(n,o){if(n&1&&(d(0,"mat-option",12),c(1),u()),n&2){let e=o.$implicit;O("value",e),g(),ge(" ",e," ")}}function x0(n,o){if(n&1&&(d(0,"mat-option",12),c(1),u()),n&2){let e=o.$implicit;O("value",e.measure),g(),ge(" ",e.description," ")}}function C0(n,o){if(n&1&&(d(0,"mat-optgroup",14),xe(1,x0,2,2,"mat-option",12,Ne),u()),n&2){let e=o.$implicit;O("label",e.group),g(),Ce(e.units)}}function S0(n){return o=>{let e=o.parent?.value?.pathRequired!==!1,t=o.value;return e?t===null||t===""?{requireMatch:!0}:n().some(r=>r.path===t)?null:{requireMatch:!0}:t===null||t===""||n().some(r=>r.path===t)?null:{requireMatch:!0}}}var Yu=(()=>{class n{convertUnitTo=x.required();filterSelfPaths=x.required();datachartPath=x.required();datachartSource=x.required();timeScale=x.required();period=x.required();data=y(Wt);units=y(at);_destroyRef=y(Ze);numericPaths=_([]);filteredNumericPaths=_([]);unitList=_({});pathSources=_([]);maxDuration=K(()=>this.timeScale().value==="day"?365:60);ngOnInit(){if(this.numericPaths.set(this.data.getPathsAndMetaByType("number",!1,!1,this.filterSelfPaths().value).sort()),this.filteredNumericPaths.set(this.numericPaths()),this.datachartPath().valueChanges.pipe(Tn(300),$e(this._destroyRef)).subscribe(e=>{let t=(e||"").toLowerCase().trim();t?this.filteredNumericPaths.set(this.numericPaths().filter(i=>i.path.toLowerCase().includes(t))):this.filteredNumericPaths.set(this.numericPaths())}),this.datachartPath().setValidators([S0(()=>this.getPaths())]),this.datachartPath()?.value){let e=this.data.getPathObject(this.datachartPath().value);this.setPathSources(e),this.unitList.set(this.units.getConversionsForPath(this.datachartPath().value))}this.setInitFormState()}setInitFormState(e=!1){this.datachartSource().value&&!e?this.datachartSource().enable():(this.datachartSource().reset(),this.datachartSource().disable()),this.convertUnitTo().value&&!e?this.convertUnitTo().enable():(this.convertUnitTo().reset(),this.convertUnitTo().disable()),this.timeScale().value?this.timeScale().enable():this.timeScale().disable(),this.period().value?this.period().enable():this.period().disable()}getPaths(){return this.data.getPathsAndMetaByType("number",!1,!1,this.filterSelfPaths().value).sort()}clearPathInputField(){this.datachartPath().setValue(""),this.setInitFormState(!0)}changePath(e){let t=this.data.getPathObject(e.option.value);if(t===null){this.pathSources.set([]),this.datachartSource().reset(),this.datachartSource().disable(),this.convertUnitTo().reset(),this.convertUnitTo().disable(),this.setPathUnits();return}this.setPathSources(t),this.setPathUnits(t.path)}setPathSources(e){Object.keys(e.sources).length==1?(this.pathSources.set(["default"]),this.datachartSource().setValue("default"),this.datachartSource().enable()):Object.keys(e.sources).length>1&&(this.pathSources.set(Object.keys(e.sources).sort()),this.datachartSource().value?this.datachartSource().setValue(this.datachartSource().value):this.datachartSource().reset(),this.datachartSource().enable())}setPathUnits(e){e?(this.unitList.set(this.units.getConversionsForPath(e)),this.convertUnitTo().reset(),this.convertUnitTo()?.enable()):(this.unitList.set(this.units.getConversionsForPath("")),this.convertUnitTo().reset(),this.convertUnitTo()?.disable())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["config-dataset-chart-options"]],inputs:{convertUnitTo:[1,"convertUnitTo"],filterSelfPaths:[1,"filterSelfPaths"],datachartPath:[1,"datachartPath"],datachartSource:[1,"datachartSource"],timeScale:[1,"timeScale"],period:[1,"period"]},decls:60,vars:10,consts:[["pathInput",""],["pathAutoComplete","matAutocomplete"],[1,"display-content","tab-content"],[1,"flex-container",2,"margin-top","10px"],[1,"full-width"],["type","text","matInput","","placeholder","Type to use autocomplete or select from list","required","",3,"formControl","matAutocomplete"],["mat-icon-button","","matIconSuffix","","aria-label","Clear"],[3,"optionSelected"],[2,"min-height","48px","line-height","1.15","height","auto","padding","8px 16px","white-space","normal",3,"value"],[3,"formControl"],[1,"flex-field-50"],["placeholder","Select data source","name","sourceControl","required","",3,"formControl"],[3,"value"],["placeholder","Select unit...","name","convertUnitTo","required","",3,"formControl"],[3,"label"],[2,"margin-top","10px"],["placeholder","Select dataset time scale","name","timeScaleFormat","required","",3,"formControl"],["value","day"],["value","hour"],["value","minute"],["value","second"],["matInput","","type","number","min","1","step","1","placeholder","Enter or select number...","required","",3,"max","formControl"],[2,"grid-column","1 / -1","font-size","0.9em","color","var(--mat-sys-outline)"],["routerLink","/help/history-data-charts",2,"color","var(--kip-blue-color)","cursor","pointer","text-decoration","underline"],["mat-icon-button","","matIconSuffix","","aria-label","Clear",3,"click"],[1,"pathMetaDescription"]],template:function(t,i){if(t&1&&(d(0,"div",2)(1,"div",3)(2,"mat-form-field",4)(3,"mat-label"),c(4," Signal K Path "),u(),F(5,"input",5,0),I(7,p0,3,0,"button",6),I(8,f0,2,0,"mat-error")(9,g0,2,0,"mat-error"),d(10,"mat-autocomplete",7,1),U("optionSelected",function(r){return i.changePath(r)}),xe(12,A0,3,2,"mat-option",8,h0),u()()(),d(14,"div",3)(15,"mat-checkbox",9),c(16," Restrict to own vessel "),u()(),d(17,"div",3)(18,"div",10)(19,"mat-form-field",4)(20,"mat-label"),c(21,"Source"),u(),d(22,"mat-select",11),xe(23,y0,2,2,"mat-option",12,Ai),u()()(),d(25,"div",10)(26,"mat-form-field",4)(27,"mat-label"),c(28,"Display Format"),u(),d(29,"mat-select",13),xe(30,C0,3,1,"mat-optgroup",14,Ne),u()()()(),F(32,"br"),d(33,"p",15),c(34," Time scale and duration set how much history the chart shows (the chart window). Data is sampled to keep roughly 120 points across the window; very short windows may show fewer points for performance. "),u(),d(35,"div",3)(36,"div",10)(37,"mat-form-field",4)(38,"mat-label"),c(39,"Time Scale"),u(),d(40,"mat-select",16)(41,"mat-option",17),c(42,"Days"),u(),d(43,"mat-option",18),c(44,"Hours"),u(),d(45,"mat-option",19),c(46,"Minutes"),u(),d(47,"mat-option",20),c(48,"Seconds"),u()()()(),d(49,"div",10)(50,"mat-form-field",4)(51,"mat-label"),c(52,"Duration"),u(),F(53,"input",21),u()(),d(54,"div",22)(55,"strong"),c(56,"History API:"),u(),c(57," When the time scale is minutes or longer, the Data Chart can be pre-filled with historical data. "),d(58,"a",23),c(59,"Learn more"),u()()()()),t&2){let a=Nt(6),r=Nt(11);g(5),O("formControl",i.datachartPath())("matAutocomplete",r),g(2),N(a.value?7:-1),g(),N(a.validity.valueMissing?8:i.datachartPath().errors?9:-1),g(4),Ce(i.filteredNumericPaths()),g(3),O("formControl",i.filterSelfPaths()),g(7),O("formControl",i.datachartSource()),g(),Ce(i.pathSources()),g(6),O("formControl",i.convertUnitTo()),g(),Ce(i.unitList().conversions),g(10),O("formControl",i.timeScale()),g(13),O("max",i.maxDuration())("formControl",i.period())}},dependencies:[et,Qe,ms,lo,Lt,Ya,ba,oi,qt,ii,St,Ct,Ln,Wn,on,ai,ni,wt,nt,Tt,xt,yt,nn,dt,Pt,On,ja,an,jr],styles:[".display-content[_ngcontent-%COMP%]{display:block;height:100%;width:100%;padding-top:15px;padding-bottom:10px}"]})}return n})();var Zu=(()=>{class n{transform(e){return Object.keys(e)}static \u0275fac=function(t){return new(t||n)};static \u0275pipe=Rr({name:"objectKeys",type:n,pure:!0})}return n})();var w0=(n,o)=>o.path;function _0(n,o){n&1&&F(0,"i",18)}function M0(n,o){n&1&&F(0,"i",19)}function k0(n,o){if(n&1&&(d(0,"mat-option",16),c(1),u()),n&2){let e=o.$implicit;O("value",e),g(),Ut("",e.properties.quantity,": ",e.properties.display)}}function T0(n,o){if(n&1){let e=Se();d(0,"div",5)(1,"mat-form-field",17)(2,"mat-label"),I(3,_0,1,0,"i",18)(4,M0,1,0,"i",19),c(5," Filter"),u(),d(6,"mat-select",20,2),U("selectionChange",function(){ee(e),k();let i=Nt(11),a=k();return te(a.pathFormGroup().controls.path.setValue(i.value))}),d(8,"mat-option"),c(9,"All"),u(),xe(10,k0,2,3,"mat-option",16,Ne),u()()()}if(n&2){let e=Nt(7),t=k(2);g(3),N(e.value?4:3),g(3),O("formControl",t.pathSkUnitsFilterControl),g(4),Ce(t.pathSkUnitsFiltersList)}}function E0(n,o){n&1&&(d(0,"span",8),c(1,"(optional)"),u())}function D0(n,o){n&1&&(d(0,"mat-hint"),c(1,"Leave blank to disable this path."),u())}function P0(n,o){if(n&1){let e=Se();d(0,"button",21),U("click",function(){ee(e);let i=k(2);return te(i.pathFormGroup().controls.path.setValue(""))}),d(1,"mat-icon"),c(2,"close"),u()()}}function I0(n,o){n&1&&(d(0,"mat-error"),c(1," Path is required. Please enter a valid Signal K path. "),u())}function N0(n,o){n&1&&(d(0,"mat-error"),c(1," Path not recognized. Please enter a path from the server's published list. "),u())}function R0(n,o){if(n&1&&(d(0,"span"),c(1),u(),F(2,"br"),d(3,"small",22),c(4),u()),n&2){let e=k().$implicit;g(),X(e.path),g(3),X(e.meta.description)}}function O0(n,o){if(n&1&&c(0),n&2){let e=k().$implicit;ge(" ",e.path," ")}}function V0(n,o){if(n&1&&(d(0,"mat-option",11),I(1,R0,5,2)(2,O0,1,1),u()),n&2){let e=o.$implicit;O("value",e.path),g(),N(e.meta!==void 0?1:2)}}function L0(n,o){if(n&1&&(d(0,"mat-option",16),c(1),u()),n&2){let e=o.$implicit;O("value",e),g(),ge(" ",e," ")}}function W0(n,o){if(n&1&&(d(0,"mat-option",16),c(1),u()),n&2){let e=o.$implicit;O("value",e.measure),g(),ge(" ",e.description," ")}}function F0(n,o){if(n&1&&(d(0,"mat-optgroup",28),xe(1,W0,2,2,"mat-option",16,Ne),u()),n&2){let e=o.$implicit;O("label",e.group),g(),Ce(e.units)}}function G0(n,o){if(n&1&&(d(0,"mat-form-field",26)(1,"mat-label"),c(2,"Display Format"),u(),d(3,"mat-select",27),xe(4,F0,3,1,"mat-optgroup",28,Ne),u()()),n&2){let e=k(3);g(4),Ce(e.unitList.conversions)}}function B0(n,o){if(n&1&&(d(0,"div",23)(1,"mat-form-field",14)(2,"mat-label"),c(3,"Sample Time"),u(),F(4,"input",24),u()(),d(5,"div",25),I(6,G0,6,0,"mat-form-field",26),u()),n&2){let e=k(2);g(6),N(e.pathFormGroup().value.pathType==="number"&&e.pathFormGroup().value.showConvertUnitTo===void 0||e.pathFormGroup().value.pathType==="number"&&e.pathFormGroup().value.showConvertUnitTo===!0?6:-1)}}function z0(n,o){if(n&1&&(d(0,"div",3)(1,"div",4)(2,"span"),c(3),u()(),I(4,T0,12,2,"div",5),d(5,"div",6)(6,"mat-form-field",7)(7,"mat-label"),c(8," Signal K Path "),I(9,E0,2,0,"span",8),u(),F(10,"input",9,0),I(12,D0,2,0,"mat-hint"),I(13,P0,3,0,"button",10),I(14,I0,2,0,"mat-error")(15,N0,2,0,"mat-error"),d(16,"mat-autocomplete",null,1),xe(18,V0,3,2,"mat-option",11,w0),lt(20,"async"),u()()(),d(21,"div",12)(22,"div",13)(23,"mat-form-field",14)(24,"mat-label"),c(25,"Data Source"),u(),d(26,"mat-select",15),xe(27,L0,2,2,"mat-option",16,Ne),u()()(),I(29,B0,7,1),u()()),n&2){let e,t=Nt(17),i=k();O("formGroup",i.pathFormGroup()),g(2),be("color",i.pathFormGroup().enabled?"":"rgba(255,255,255,0.5)"),g(),X(i.pathFormGroup().value.description),g(),N(i.pathFormGroup().value.pathType==="number"&&i.showPathSkUnitsFilter?4:-1),g(5),N(i.pathFormGroup().value.pathRequired===!1?9:-1),g(),O("matAutocomplete",t),g(2),N(i.pathFormGroup().value.pathRequired===!1?12:-1),g(),N(i.pathFormGroup().value.path?13:-1),g(),N((e=i.pathFormGroup().controls.path.errors)!=null&&e.required?14:(e=i.pathFormGroup().controls.path.errors)!=null&&e.requireMatch?15:-1),g(4),Ce(kt(20,11,i.filteredPaths)),g(9),Ce(i.availableSources),g(2),N(i.pathFormGroup().value.zonesOnlyPaths?-1:29)}}function U0(n){return o=>{let e=o.parent?.value?.pathRequired!==!1,t=o.value;return e?t===null||t===""?{requireMatch:!0}:n().some(r=>r.path===t)?null:{requireMatch:!0}:t===null||t===""||n().some(r=>r.path===t)?null:{requireMatch:!0}}}var Qu=(()=>{class n{_data=y(Wt);_units=y(at);_connection=y($r);_destroyRef=y(Ze);pathFormGroup=x.required();multiCTRLArray=x.required();filterSelfPaths=x.required();availablePaths;filteredPaths=new ji(null);availableSources;unitList={base:"",conversions:[]};showPathSkUnitsFilter=!1;pathSkUnitsFilterControl=new ou(null);pathSkUnitsFiltersList;unitlessUnit={unit:"unitless",properties:{display:"(null)",quantity:"Unitless",quantityDisplay:"(null)",description:""}};ngOnInit(){let e=this.pathFormGroup();e.controls.path.disabled||(this.pathSkUnitsFiltersList=this._units.skBaseUnits.sort((t,i)=>t.properties.quantity>i.properties.quantity?1:-1),this.pathSkUnitsFiltersList.unshift(this.unitlessUnit),e.value.pathSkUnitsFilter&&this.pathSkUnitsFilterControl.setValue(this.pathSkUnitsFiltersList.find(t=>t.unit===this.pathFormGroup().value.pathSkUnitsFilter),{onlySelf:!0}),e.value.showPathSkUnitsFilter&&(this.showPathSkUnitsFilter=e.value.showPathSkUnitsFilter),e.controls.path.setValidators([U0(()=>this.getPaths())]),e.controls.path.updateValueAndValidity({onlySelf:!0,emitEvent:!1}),e.controls.pathRequired&&e.controls.pathRequired.valueChanges.pipe($e(this._destroyRef)).subscribe(()=>{this.pathFormGroup().controls.path.updateValueAndValidity()}),e.controls.path.valid?this.enableFormFields(!1):this.disablePathFields(),e.controls.sampleTime||(e.addControl("sampleTime",new ct("500",Et.required)),e.controls.sampleTime.updateValueAndValidity({onlySelf:!0,emitEvent:!1})),e.controls.path.valueChanges.pipe(tc(t=>t===""?ca(0):ca(350)),Ga(""),Zt(t=>this.filterPaths(t||""))).pipe($e(this._destroyRef)).subscribe(()=>{let t=this.pathFormGroup();t.controls.path.pristine||(t.controls.path.valid?(this.enableFormFields(!0),this.updatePathMetaBoundDisplayName(t.controls.path.value),this.updatePathMetaBoundDisplayScale(t.controls.path.value)):this.disablePathFields())}),e.controls.pathType.valueChanges.pipe($e(this._destroyRef)).subscribe(()=>{let t=this.pathFormGroup();t.value.showPathSkUnitsFilter?this.pathSkUnitsFilterControl.setValue(this.unitlessUnit):this.pathSkUnitsFilterControl.setValue(null),t.controls.path.updateValueAndValidity()}))}ngOnChanges(e){e.filterSelfPaths&&!e.filterSelfPaths.firstChange&&this.pathFormGroup().controls.path.updateValueAndValidity()}getPaths(){let e=this.pathFormGroup().controls.pathType.value,t=this.filterSelfPaths(),i=!1,a=this.pathFormGroup();if(a.value.supportsPut){let s=!1;this.multiCTRLArray().length>0&&(s=this.multiCTRLArray().some(l=>l.pathID===this.pathFormGroup().value.pathID&&l.type==="3")),s?i=!1:i=Yc(this._connection.skServerVersion,"2.12.0",">=")?a.value.supportsPut:!1}let r=a.value.zonesOnlyPaths??!1;return this._data.getPathsAndMetaByType(e,i,r,t).sort()}filterPaths(e){let t=e.toLowerCase(),i=this.getPaths();if(this.pathSkUnitsFilterControl.value){let a=this.pathSkUnitsFilterControl.value.unit;i=i.filter(r=>{let s=!!r.meta&&!!r.meta.units,l=a==="unitless";return s&&r.meta.units===a||!s&&l})}i=i.filter(a=>a.path.toLowerCase().includes(t)),this.filteredPaths.next(i)}enableFormFields(e){let t=this._data.getPathObject(this.pathFormGroup().controls.path.value);if(t!=null){this.pathFormGroup().controls.sampleTime.enable({onlySelf:!1});let i=this.pathFormGroup();i.controls.pathType.value=="number"&&(this.unitList=this._units.getConversionsForPath(i.controls.path.value),e&&i.controls.convertUnitTo.setValue(this.unitList.base,{onlySelf:!0}),i.controls.convertUnitTo.enable({onlySelf:!1})),Object.keys(t.sources).length==1?(this.availableSources=["default"],e?i.controls.source.value!="default"&&i.controls.source.setValue("default",{onlySelf:!0}):i.controls.source.value!="default"&&i.controls.source.setValue("",{onlySelf:!0})):Object.keys(t.sources).length>1&&(this.availableSources=Object.keys(t.sources),i.controls.source.value=="default"&&i.controls.source.reset()),i.controls.source.enable({onlySelf:!1})}else this.disablePathFields()}disablePathFields(){this.pathFormGroup().controls.source.reset("",{onlySelf:!0}),this.pathFormGroup().controls.source.disable({onlySelf:!1}),this.pathFormGroup().controls.sampleTime.disable({onlySelf:!1});let e=this.pathFormGroup();e.controls.pathType.value=="number"&&(e.controls.convertUnitTo.reset("",{onlySelf:!0}),e.controls.convertUnitTo.disable({onlySelf:!1}))}updatePathMetaBoundDisplayName(e){let t=this.pathFormGroup();if(!Object.prototype.hasOwnProperty.call(t.parent.parent.value,"displayName"))return;let i=this._data.getPathMeta(e);i?.displayName&&t.parent.parent.controls.displayName.setValue(i.displayName)}updatePathMetaBoundDisplayScale(e){let t=this.pathFormGroup();if(!Object.prototype.hasOwnProperty.call(t.parent.parent.value,"displayScale"))return;let i=this._data.getPathMeta(e);if(i?.displayScale){let a=t.parent.parent.get("displayScale"),r=t.controls.convertUnitTo.value;i.displayScale.lower!==null&&i.displayScale.lower!==void 0&&a.controls.lower.setValue(this._units.convertToUnit(r,i.displayScale.lower)),i.displayScale.upper!==null&&i.displayScale.upper!==void 0&&a.controls.upper.setValue(this._units.convertToUnit(r,i.displayScale.upper)),i.displayScale.type!==null&&i.displayScale.type!==void 0&&a.controls.type.setValue(i.displayScale.type),i.displayScale.power!==null&&i.displayScale.power!==void 0&&a.controls.power.setValue(i.displayScale.power)}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["path-control-config"]],inputs:{pathFormGroup:[1,"pathFormGroup"],multiCTRLArray:[1,"multiCTRLArray"],filterSelfPaths:[1,"filterSelfPaths"]},features:[Zi],decls:1,vars:1,consts:[["pathInput",""],["pathAutoComplete","matAutocomplete"],["pathUnitsFilter",""],[1,"flex-container","rounded-card","rounded-card-color",3,"formGroup"],[1,"flex-field-100"],[1,"flex-field-fixed"],[1,"flex-field-to-100"],["floatLabel","auto","appearance","fill",1,"pathField"],[1,"optional-label"],["type","text","matInput","","placeholder","Type to use autocomplete or select from list","formControlName","path",3,"matAutocomplete"],["mat-icon-button","","matIconSuffix","","aria-label","Clear"],[2,"min-height","48px","line-height","1.15","height","auto","padding","8px 16px","white-space","normal",3,"value"],[1,"pathProperties"],[1,"sourceField"],["appearance","outline","floatLabel","always",1,"fields"],["placeholder","Select source","formControlName","source","required",""],[3,"value"],["floatLabel","auto","appearance","fill",1,"filter-path"],[1,"fa-solid","fa-filter"],[1,"fa-solid","fa-filter-circle-xmark"],["panelWidth","",3,"selectionChange","formControl"],["mat-icon-button","","matIconSuffix","","aria-label","Clear",3,"click"],[1,"pathMetaDescription"],[1,"sampleTimeField"],["matInput","","type","number","placeholder","Sample time in milliseconds","formControlName","sampleTime","required",""],[1,"unitField"],[1,"fields"],["placeholder","Select unit","formControlName","convertUnitTo","required",""],[3,"label"]],template:function(t,i){t&1&&I(0,z0,30,13,"div",3),t&2&&N(i.pathFormGroup().value.isPathConfigurable?0:-1)},dependencies:[It,yt,nn,dt,Dt,Pt,xt,an,pt,Ei,St,Ct,wt,ms,lo,Lt,Ya,ba,Tt,Wn,Ln,ai,et,Qe,su,Gr],styles:[".pathGroup[_ngcontent-%COMP%]{width:100%}.pathGroupFields[_ngcontent-%COMP%]{display:block;width:calc(100% - 5px)}.pathField[_ngcontent-%COMP%]{width:100%}.pathProperties[_ngcontent-%COMP%]{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:center;align-content:flex-start;gap:10px}.fields[_ngcontent-%COMP%]{width:100%}.sourceField[_ngcontent-%COMP%]{flex:3 1}.sampleTimeField[_ngcontent-%COMP%]{flex:1 3}.unitField[_ngcontent-%COMP%]{flex:3 1}"]})}return n})();function H0(n,o){if(n&1&&F(0,"path-control-config",6),n&2){let e=o.$implicit,t=k(2);O("pathFormGroup",e)("filterSelfPaths",t.filterSelfPaths().value)("multiCTRLArray",t.multiCTRLArray)}}function q0(n,o){if(n&1&&xe(0,H0,1,3,"path-control-config",6,Ne),n&2){let e=k();Ce(e.pathsFormGroup.controls)}}function $0(n,o){if(n&1&&F(0,"path-control-config",6),n&2){let e=o.$implicit,t=k(2);O("pathFormGroup",t.pathsFormGroup.get(e))("filterSelfPaths",t.filterSelfPaths().value)("multiCTRLArray",t.multiCTRLArray)}}function j0(n,o){if(n&1&&(xe(0,$0,1,3,"path-control-config",6,Ne),lt(2,"objectKeys")),n&2){let e=k();Ce(kt(2,0,e.pathsFormGroup.controls))}}var Xu=(()=>{class n{rootFormGroup=y(pt);fb=y(Vn);formGroupName=x.required();isArray=x.required();enableTimeout=x.required();dataTimeout=x.required();filterSelfPaths=x.required();addPathEvent=x(void 0);delPathEvent=x(void 0);updatePathEvent=x(void 0);pathsFormGroup;multiCTRLArray=[];ngOnInit(){this.isArray()?(this.pathsFormGroup=this.rootFormGroup.control.get(this.formGroupName()),this.multiCTRLArray=this.rootFormGroup.control.get("multiChildCtrls").value):this.pathsFormGroup=this.rootFormGroup.control.get(this.formGroupName())}addPath(e){this.pathsFormGroup.push(this.fb.group({description:[e.path.description],path:[e.path.path,Et.required],pathID:[e.path.pathID],source:[e.path.source,Et.required],pathType:[e.path.pathType],zonesOnlyPaths:[e.path.zonesOnlyPaths??!1],isPathConfigurable:[e.path.isPathConfigurable],showPathSkUnitsFilter:[e.path.showPathSkUnitsFilter],pathSkUnitsFilter:[e.path.pathSkUnitsFilter],convertUnitTo:[e.path.convertUnitTo],sampleTime:[e.path.sampleTime],supportsPut:[e.path.supportsPut]})),this.pathsFormGroup.updateValueAndValidity(),this.multiCTRLArray=this.rootFormGroup.control.get("multiChildCtrls").value}delPath(){this.multiCTRLArray=this.rootFormGroup.control.get("multiChildCtrls").value}updatePath(e){this.multiCTRLArray=e}ngOnChanges(e){e.addPathEvent&&!e.addPathEvent.firstChange&&this.addPath(e.addPathEvent.currentValue),e.delPathEvent&&!e.delPathEvent.firstChange&&this.delPath(),e.updatePathEvent&&!e.updatePathEvent.firstChange&&this.updatePath(e.updatePathEvent.currentValue)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["paths-options"]],inputs:{formGroupName:[1,"formGroupName"],isArray:[1,"isArray"],enableTimeout:[1,"enableTimeout"],dataTimeout:[1,"dataTimeout"],filterSelfPaths:[1,"filterSelfPaths"],addPathEvent:[1,"addPathEvent"],delPathEvent:[1,"delPathEvent"],updatePathEvent:[1,"updatePathEvent"]},features:[Zi],decls:14,vars:5,consts:[[1,"widget-options-grid"],["name","enableTimeout",3,"formControl"],["type","number","matNativeControl","","placeholder","Time in seconds...","name","dataTimeout","min","2","required","",3,"formControl"],["matTextSuffix",""],[3,"formGroup"],["name","filterSelfPaths",3,"formControl"],[2,"display","block",3,"pathFormGroup","filterSelfPaths","multiCTRLArray"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"mat-checkbox",1),c(2," Enable Widget Data TTL "),u(),d(3,"mat-form-field")(4,"mat-label"),c(5,"TTL Timeout For Paths"),u(),F(6,"input",2),d(7,"span",3),c(8,"Seconds"),u()()(),Xi(9,4),I(10,q0,2,0)(11,j0,3,2),Ki(),d(12,"mat-checkbox",5),c(13,` Restrict to own vessel
43
- `),u()),t&2&&(g(),O("formControl",i.enableTimeout()),g(5),O("formControl",i.dataTimeout()),g(3),O("formGroup",i.pathsFormGroup),g(),N(i.isArray()?10:11),g(2),O("formControl",i.filterSelfPaths()))},dependencies:[qt,It,yt,nn,dt,Dt,Pt,On,xt,an,pt,St,Ct,wt,Wn,Qu,Zu],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;padding-top:15px;padding-bottom:5px}"]})}return n})();function Y0(n,o){if(n&1){let e=Se();d(0,"button",7),U("click",function(){ee(e);let i=k();return te(i.dateTimezone().setValue(""))}),F(1,"span",8),u()}}function Z0(n,o){if(n&1&&(d(0,"mat-option",6),c(1),u()),n&2){let e=o.$implicit;O("value",e.label),g(),Ut(" ",e.offset," - ",e.label," ")}}function Q0(n){return o=>n.some(t=>t.label===o.value)?null:{requireMatch:!0}}var X0=()=>{let n=Intl.supportedValuesOf("timeZone"),o=new Date;return n.map(e=>({offset:new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"shortOffset"}).formatToParts(o).find(r=>r.type==="timeZoneName")?.value||"",label:e}))},Ku=(()=>{class n{_destroyRef=y(Ze);dateFormat=x(void 0);dateTimezone=x(void 0);tz=[];filteredTZ;filteredTZSubscription=null;constructor(){}ngOnInit(){typeof Intl.supportedValuesOf<"u"?this.tz=X0().sort((e,t)=>this.compareOffsets(e.offset,t.offset)):(console.log("[Widget Options] Feature not supported. Using static Time Zone list"),this.tz=[{offset:"GMT",label:"Africa/Abidjan"},{offset:"GMT",label:"Africa/Accra"},{offset:"GMT+3",label:"Africa/Addis_Ababa"},{offset:"GMT+1",label:"Africa/Algiers"},{offset:"GMT+3",label:"Africa/Asmera"},{offset:"GMT",label:"Africa/Bamako"},{offset:"GMT+1",label:"Africa/Bangui"},{offset:"GMT",label:"Africa/Banjul"},{offset:"GMT",label:"Africa/Bissau"},{offset:"GMT+2",label:"Africa/Blantyre"},{offset:"GMT+1",label:"Africa/Brazzaville"},{offset:"GMT+2",label:"Africa/Bujumbura"},{offset:"GMT+2",label:"Africa/Cairo"},{offset:"GMT",label:"Africa/Casablanca"},{offset:"GMT+2",label:"Africa/Ceuta"},{offset:"GMT",label:"Africa/Conakry"},{offset:"GMT",label:"Africa/Dakar"},{offset:"GMT+3",label:"Africa/Dar_es_Salaam"},{offset:"GMT+3",label:"Africa/Djibouti"},{offset:"GMT+1",label:"Africa/Douala"},{offset:"GMT",label:"Africa/El_Aaiun"},{offset:"GMT",label:"Africa/Freetown"},{offset:"GMT+2",label:"Africa/Gaborone"},{offset:"GMT+2",label:"Africa/Harare"},{offset:"GMT+2",label:"Africa/Johannesburg"},{offset:"GMT+2",label:"Africa/Juba"},{offset:"GMT+3",label:"Africa/Kampala"},{offset:"GMT+2",label:"Africa/Khartoum"},{offset:"GMT+2",label:"Africa/Kigali"},{offset:"GMT+1",label:"Africa/Kinshasa"},{offset:"GMT+1",label:"Africa/Lagos"},{offset:"GMT+1",label:"Africa/Libreville"},{offset:"GMT",label:"Africa/Lome"},{offset:"GMT+1",label:"Africa/Luanda"},{offset:"GMT+2",label:"Africa/Lubumbashi"},{offset:"GMT+2",label:"Africa/Lusaka"},{offset:"GMT+1",label:"Africa/Malabo"},{offset:"GMT+2",label:"Africa/Maputo"},{offset:"GMT+2",label:"Africa/Maseru"},{offset:"GMT+2",label:"Africa/Mbabane"},{offset:"GMT+3",label:"Africa/Mogadishu"},{offset:"GMT",label:"Africa/Monrovia"},{offset:"GMT+3",label:"Africa/Nairobi"},{offset:"GMT+1",label:"Africa/Ndjamena"},{offset:"GMT+1",label:"Africa/Niamey"},{offset:"GMT",label:"Africa/Nouakchott"},{offset:"GMT",label:"Africa/Ouagadougou"},{offset:"GMT+1",label:"Africa/Porto-Novo"},{offset:"GMT",label:"Africa/Sao_Tome"},{offset:"GMT+2",label:"Africa/Tripoli"},{offset:"GMT+1",label:"Africa/Tunis"},{offset:"GMT+2",label:"Africa/Windhoek"},{offset:"GMT-9",label:"America/Adak"},{offset:"GMT-8",label:"America/Anchorage"},{offset:"GMT-4",label:"America/Anguilla"},{offset:"GMT-4",label:"America/Antigua"},{offset:"GMT-3",label:"America/Araguaina"},{offset:"GMT-3",label:"America/Argentina/La_Rioja"},{offset:"GMT-3",label:"America/Argentina/Rio_Gallegos"},{offset:"GMT-3",label:"America/Argentina/Salta"},{offset:"GMT-3",label:"America/Argentina/San_Juan"},{offset:"GMT-3",label:"America/Argentina/San_Luis"},{offset:"GMT-3",label:"America/Argentina/Tucuman"},{offset:"GMT-3",label:"America/Argentina/Ushuaia"},{offset:"GMT-4",label:"America/Aruba"},{offset:"GMT-3",label:"America/Asuncion"},{offset:"GMT-3",label:"America/Bahia"},{offset:"GMT-6",label:"America/Bahia_Banderas"},{offset:"GMT-4",label:"America/Barbados"},{offset:"GMT-3",label:"America/Belem"},{offset:"GMT-6",label:"America/Belize"},{offset:"GMT-4",label:"America/Blanc-Sablon"},{offset:"GMT-4",label:"America/Boa_Vista"},{offset:"GMT-5",label:"America/Bogota"},{offset:"GMT-6",label:"America/Boise"},{offset:"GMT-3",label:"America/Buenos_Aires"},{offset:"GMT-6",label:"America/Cambridge_Bay"},{offset:"GMT-4",label:"America/Campo_Grande"},{offset:"GMT-5",label:"America/Cancun"},{offset:"GMT-4",label:"America/Caracas"},{offset:"GMT-3",label:"America/Catamarca"},{offset:"GMT-3",label:"America/Cayenne"},{offset:"GMT-5",label:"America/Cayman"},{offset:"GMT-5",label:"America/Chicago"},{offset:"GMT-6",label:"America/Chihuahua"},{offset:"GMT-6",label:"America/Ciudad_Juarez"},{offset:"GMT-5",label:"America/Coral_Harbour"},{offset:"GMT-3",label:"America/Cordoba"},{offset:"GMT-6",label:"America/Costa_Rica"},{offset:"GMT-7",label:"America/Creston"},{offset:"GMT-4",label:"America/Cuiaba"},{offset:"GMT-4",label:"America/Curacao"},{offset:"GMT",label:"America/Danmarkshavn"},{offset:"GMT-7",label:"America/Dawson"},{offset:"GMT-7",label:"America/Dawson_Creek"},{offset:"GMT-6",label:"America/Denver"},{offset:"GMT-4",label:"America/Detroit"},{offset:"GMT-4",label:"America/Dominica"},{offset:"GMT-6",label:"America/Edmonton"},{offset:"GMT-5",label:"America/Eirunepe"},{offset:"GMT-6",label:"America/El_Salvador"},{offset:"GMT-7",label:"America/Fort_Nelson"},{offset:"GMT-3",label:"America/Fortaleza"},{offset:"GMT-3",label:"America/Glace_Bay"},{offset:"GMT-1",label:"America/Godthab"},{offset:"GMT-3",label:"America/Goose_Bay"},{offset:"GMT-4",label:"America/Grand_Turk"},{offset:"GMT-4",label:"America/Grenada"},{offset:"GMT-4",label:"America/Guadeloupe"},{offset:"GMT-6",label:"America/Guatemala"},{offset:"GMT-5",label:"America/Guayaquil"},{offset:"GMT-4",label:"America/Guyana"},{offset:"GMT-3",label:"America/Halifax"},{offset:"GMT-4",label:"America/Havana"},{offset:"GMT-7",label:"America/Hermosillo"},{offset:"GMT-5",label:"America/Indiana/Knox"},{offset:"GMT-4",label:"America/Indiana/Marengo"},{offset:"GMT-4",label:"America/Indiana/Petersburg"},{offset:"GMT-5",label:"America/Indiana/Tell_City"},{offset:"GMT-4",label:"America/Indiana/Vevay"},{offset:"GMT-4",label:"America/Indiana/Vincennes"},{offset:"GMT-4",label:"America/Indiana/Winamac"},{offset:"GMT-4",label:"America/Indianapolis"},{offset:"GMT-6",label:"America/Inuvik"},{offset:"GMT-4",label:"America/Iqaluit"},{offset:"GMT-5",label:"America/Jamaica"},{offset:"GMT-3",label:"America/Jujuy"},{offset:"GMT-8",label:"America/Juneau"},{offset:"GMT-4",label:"America/Kentucky/Monticello"},{offset:"GMT-4",label:"America/Kralendijk"},{offset:"GMT-4",label:"America/La_Paz"},{offset:"GMT-5",label:"America/Lima"},{offset:"GMT-7",label:"America/Los_Angeles"},{offset:"GMT-4",label:"America/Louisville"},{offset:"GMT-4",label:"America/Lower_Princes"},{offset:"GMT-3",label:"America/Maceio"},{offset:"GMT-6",label:"America/Managua"},{offset:"GMT-4",label:"America/Manaus"},{offset:"GMT-4",label:"America/Marigot"},{offset:"GMT-4",label:"America/Martinique"},{offset:"GMT-5",label:"America/Matamoros"},{offset:"GMT-7",label:"America/Mazatlan"},{offset:"GMT-3",label:"America/Mendoza"},{offset:"GMT-5",label:"America/Menominee"},{offset:"GMT-6",label:"America/Merida"},{offset:"GMT-8",label:"America/Metlakatla"},{offset:"GMT-6",label:"America/Mexico_City"},{offset:"GMT-2",label:"America/Miquelon"},{offset:"GMT-3",label:"America/Moncton"},{offset:"GMT-6",label:"America/Monterrey"},{offset:"GMT-3",label:"America/Montevideo"},{offset:"GMT-4",label:"America/Montserrat"},{offset:"GMT-4",label:"America/Nassau"},{offset:"GMT-4",label:"America/New_York"},{offset:"GMT-8",label:"America/Nome"},{offset:"GMT-2",label:"America/Noronha"},{offset:"GMT-5",label:"America/North_Dakota/Beulah"},{offset:"GMT-5",label:"America/North_Dakota/Center"},{offset:"GMT-5",label:"America/North_Dakota/New_Salem"},{offset:"GMT-5",label:"America/Ojinaga"},{offset:"GMT-5",label:"America/Panama"},{offset:"GMT-3",label:"America/Paramaribo"},{offset:"GMT-7",label:"America/Phoenix"},{offset:"GMT-4",label:"America/Port-au-Prince"},{offset:"GMT-4",label:"America/Port_of_Spain"},{offset:"GMT-4",label:"America/Porto_Velho"},{offset:"GMT-4",label:"America/Puerto_Rico"},{offset:"GMT-3",label:"America/Punta_Arenas"},{offset:"GMT-5",label:"America/Rankin_Inlet"},{offset:"GMT-3",label:"America/Recife"},{offset:"GMT-6",label:"America/Regina"},{offset:"GMT-5",label:"America/Resolute"},{offset:"GMT-5",label:"America/Rio_Branco"},{offset:"GMT-3",label:"America/Santarem"},{offset:"GMT-3",label:"America/Santiago"},{offset:"GMT-4",label:"America/Santo_Domingo"},{offset:"GMT-3",label:"America/Sao_Paulo"},{offset:"GMT-1",label:"America/Scoresbysund"},{offset:"GMT-8",label:"America/Sitka"},{offset:"GMT-4",label:"America/St_Barthelemy"},{offset:"GMT-2:30",label:"America/St_Johns"},{offset:"GMT-4",label:"America/St_Kitts"},{offset:"GMT-4",label:"America/St_Lucia"},{offset:"GMT-4",label:"America/St_Thomas"},{offset:"GMT-4",label:"America/St_Vincent"},{offset:"GMT-6",label:"America/Swift_Current"},{offset:"GMT-6",label:"America/Tegucigalpa"},{offset:"GMT-3",label:"America/Thule"},{offset:"GMT-7",label:"America/Tijuana"},{offset:"GMT-4",label:"America/Toronto"},{offset:"GMT-4",label:"America/Tortola"},{offset:"GMT-7",label:"America/Vancouver"},{offset:"GMT-7",label:"America/Whitehorse"},{offset:"GMT-5",label:"America/Winnipeg"},{offset:"GMT-8",label:"America/Yakutat"},{offset:"GMT+8",label:"Antarctica/Casey"},{offset:"GMT+7",label:"Antarctica/Davis"},{offset:"GMT+10",label:"Antarctica/DumontDUrville"},{offset:"GMT+11",label:"Antarctica/Macquarie"},{offset:"GMT+5",label:"Antarctica/Mawson"},{offset:"GMT+13",label:"Antarctica/McMurdo"},{offset:"GMT-3",label:"Antarctica/Palmer"},{offset:"GMT-3",label:"Antarctica/Rothera"},{offset:"GMT+3",label:"Antarctica/Syowa"},{offset:"GMT+2",label:"Antarctica/Troll"},{offset:"GMT+5",label:"Antarctica/Vostok"},{offset:"GMT+2",label:"Arctic/Longyearbyen"},{offset:"GMT+3",label:"Asia/Aden"},{offset:"GMT+5",label:"Asia/Almaty"},{offset:"GMT+3",label:"Asia/Amman"},{offset:"GMT+12",label:"Asia/Anadyr"},{offset:"GMT+5",label:"Asia/Aqtau"},{offset:"GMT+5",label:"Asia/Aqtobe"},{offset:"GMT+5",label:"Asia/Ashgabat"},{offset:"GMT+5",label:"Asia/Atyrau"},{offset:"GMT+3",label:"Asia/Baghdad"},{offset:"GMT+3",label:"Asia/Bahrain"},{offset:"GMT+4",label:"Asia/Baku"},{offset:"GMT+7",label:"Asia/Bangkok"},{offset:"GMT+7",label:"Asia/Barnaul"},{offset:"GMT+3",label:"Asia/Beirut"},{offset:"GMT+6",label:"Asia/Bishkek"},{offset:"GMT+8",label:"Asia/Brunei"},{offset:"GMT+5:30",label:"Asia/Calcutta"},{offset:"GMT+9",label:"Asia/Chita"},{offset:"GMT+5:30",label:"Asia/Colombo"},{offset:"GMT+3",label:"Asia/Damascus"},{offset:"GMT+6",label:"Asia/Dhaka"},{offset:"GMT+9",label:"Asia/Dili"},{offset:"GMT+4",label:"Asia/Dubai"},{offset:"GMT+5",label:"Asia/Dushanbe"},{offset:"GMT+3",label:"Asia/Famagusta"},{offset:"GMT+2",label:"Asia/Gaza"},{offset:"GMT+2",label:"Asia/Hebron"},{offset:"GMT+8",label:"Asia/Hong_Kong"},{offset:"GMT+7",label:"Asia/Hovd"},{offset:"GMT+8",label:"Asia/Irkutsk"},{offset:"GMT+7",label:"Asia/Jakarta"},{offset:"GMT+9",label:"Asia/Jayapura"},{offset:"GMT+3",label:"Asia/Jerusalem"},{offset:"GMT+4:30",label:"Asia/Kabul"},{offset:"GMT+12",label:"Asia/Kamchatka"},{offset:"GMT+5",label:"Asia/Karachi"},{offset:"GMT+5:45",label:"Asia/Katmandu"},{offset:"GMT+9",label:"Asia/Khandyga"},{offset:"GMT+7",label:"Asia/Krasnoyarsk"},{offset:"GMT+8",label:"Asia/Kuala_Lumpur"},{offset:"GMT+8",label:"Asia/Kuching"},{offset:"GMT+3",label:"Asia/Kuwait"},{offset:"GMT+8",label:"Asia/Macau"},{offset:"GMT+11",label:"Asia/Magadan"},{offset:"GMT+8",label:"Asia/Makassar"},{offset:"GMT+8",label:"Asia/Manila"},{offset:"GMT+4",label:"Asia/Muscat"},{offset:"GMT+3",label:"Asia/Nicosia"},{offset:"GMT+7",label:"Asia/Novokuznetsk"},{offset:"GMT+7",label:"Asia/Novosibirsk"},{offset:"GMT+6",label:"Asia/Omsk"},{offset:"GMT+5",label:"Asia/Oral"},{offset:"GMT+7",label:"Asia/Phnom_Penh"},{offset:"GMT+7",label:"Asia/Pontianak"},{offset:"GMT+9",label:"Asia/Pyongyang"},{offset:"GMT+3",label:"Asia/Qatar"},{offset:"GMT+5",label:"Asia/Qostanay"},{offset:"GMT+5",label:"Asia/Qyzylorda"},{offset:"GMT+6:30",label:"Asia/Rangoon"},{offset:"GMT+3",label:"Asia/Riyadh"},{offset:"GMT+7",label:"Asia/Saigon"},{offset:"GMT+11",label:"Asia/Sakhalin"},{offset:"GMT+5",label:"Asia/Samarkand"},{offset:"GMT+9",label:"Asia/Seoul"},{offset:"GMT+8",label:"Asia/Shanghai"},{offset:"GMT+8",label:"Asia/Singapore"},{offset:"GMT+11",label:"Asia/Srednekolymsk"},{offset:"GMT+8",label:"Asia/Taipei"},{offset:"GMT+5",label:"Asia/Tashkent"},{offset:"GMT+4",label:"Asia/Tbilisi"},{offset:"GMT+3:30",label:"Asia/Tehran"},{offset:"GMT+6",label:"Asia/Thimphu"},{offset:"GMT+9",label:"Asia/Tokyo"},{offset:"GMT+7",label:"Asia/Tomsk"},{offset:"GMT+8",label:"Asia/Ulaanbaatar"},{offset:"GMT+6",label:"Asia/Urumqi"},{offset:"GMT+10",label:"Asia/Ust-Nera"},{offset:"GMT+7",label:"Asia/Vientiane"},{offset:"GMT+10",label:"Asia/Vladivostok"},{offset:"GMT+9",label:"Asia/Yakutsk"},{offset:"GMT+5",label:"Asia/Yekaterinburg"},{offset:"GMT+4",label:"Asia/Yerevan"},{offset:"GMT",label:"Atlantic/Azores"},{offset:"GMT-3",label:"Atlantic/Bermuda"},{offset:"GMT+1",label:"Atlantic/Canary"},{offset:"GMT-1",label:"Atlantic/Cape_Verde"},{offset:"GMT+1",label:"Atlantic/Faeroe"},{offset:"GMT+1",label:"Atlantic/Madeira"},{offset:"GMT",label:"Atlantic/Reykjavik"},{offset:"GMT-2",label:"Atlantic/South_Georgia"},{offset:"GMT",label:"Atlantic/St_Helena"},{offset:"GMT-3",label:"Atlantic/Stanley"},{offset:"GMT+10:30",label:"Australia/Adelaide"},{offset:"GMT+10",label:"Australia/Brisbane"},{offset:"GMT+10:30",label:"Australia/Broken_Hill"},{offset:"GMT+9:30",label:"Australia/Darwin"},{offset:"GMT+8:45",label:"Australia/Eucla"},{offset:"GMT+11",label:"Australia/Hobart"},{offset:"GMT+10",label:"Australia/Lindeman"},{offset:"GMT+11",label:"Australia/Lord_Howe"},{offset:"GMT+11",label:"Australia/Melbourne"},{offset:"GMT+8",label:"Australia/Perth"},{offset:"GMT+11",label:"Australia/Sydney"},{offset:"GMT+2",label:"Europe/Amsterdam"},{offset:"GMT+2",label:"Europe/Andorra"},{offset:"GMT+4",label:"Europe/Astrakhan"},{offset:"GMT+3",label:"Europe/Athens"},{offset:"GMT+2",label:"Europe/Belgrade"},{offset:"GMT+2",label:"Europe/Berlin"},{offset:"GMT+2",label:"Europe/Bratislava"},{offset:"GMT+2",label:"Europe/Brussels"},{offset:"GMT+3",label:"Europe/Bucharest"},{offset:"GMT+2",label:"Europe/Budapest"},{offset:"GMT+2",label:"Europe/Busingen"},{offset:"GMT+3",label:"Europe/Chisinau"},{offset:"GMT+2",label:"Europe/Copenhagen"},{offset:"GMT+1",label:"Europe/Dublin"},{offset:"GMT+2",label:"Europe/Gibraltar"},{offset:"GMT+1",label:"Europe/Guernsey"},{offset:"GMT+3",label:"Europe/Helsinki"},{offset:"GMT+1",label:"Europe/Isle_of_Man"},{offset:"GMT+3",label:"Europe/Istanbul"},{offset:"GMT+1",label:"Europe/Jersey"},{offset:"GMT+2",label:"Europe/Kaliningrad"},{offset:"GMT+3",label:"Europe/Kiev"},{offset:"GMT+3",label:"Europe/Kirov"},{offset:"GMT+1",label:"Europe/Lisbon"},{offset:"GMT+2",label:"Europe/Ljubljana"},{offset:"GMT+1",label:"Europe/London"},{offset:"GMT+2",label:"Europe/Luxembourg"},{offset:"GMT+2",label:"Europe/Madrid"},{offset:"GMT+2",label:"Europe/Malta"},{offset:"GMT+3",label:"Europe/Mariehamn"},{offset:"GMT+3",label:"Europe/Minsk"},{offset:"GMT+2",label:"Europe/Monaco"},{offset:"GMT+3",label:"Europe/Moscow"},{offset:"GMT+2",label:"Europe/Oslo"},{offset:"GMT+2",label:"Europe/Paris"},{offset:"GMT+2",label:"Europe/Podgorica"},{offset:"GMT+2",label:"Europe/Prague"},{offset:"GMT+3",label:"Europe/Riga"},{offset:"GMT+2",label:"Europe/Rome"},{offset:"GMT+4",label:"Europe/Samara"},{offset:"GMT+2",label:"Europe/San_Marino"},{offset:"GMT+2",label:"Europe/Sarajevo"},{offset:"GMT+4",label:"Europe/Saratov"},{offset:"GMT+3",label:"Europe/Simferopol"},{offset:"GMT+2",label:"Europe/Skopje"},{offset:"GMT+3",label:"Europe/Sofia"},{offset:"GMT+2",label:"Europe/Stockholm"},{offset:"GMT+3",label:"Europe/Tallinn"},{offset:"GMT+2",label:"Europe/Tirane"},{offset:"GMT+4",label:"Europe/Ulyanovsk"},{offset:"GMT+2",label:"Europe/Vaduz"},{offset:"GMT+2",label:"Europe/Vatican"},{offset:"GMT+2",label:"Europe/Vienna"},{offset:"GMT+3",label:"Europe/Vilnius"},{offset:"GMT+3",label:"Europe/Volgograd"},{offset:"GMT+2",label:"Europe/Warsaw"},{offset:"GMT+2",label:"Europe/Zagreb"},{offset:"GMT+2",label:"Europe/Zurich"},{offset:"GMT+3",label:"Indian/Antananarivo"},{offset:"GMT+6",label:"Indian/Chagos"},{offset:"GMT+7",label:"Indian/Christmas"},{offset:"GMT+6:30",label:"Indian/Cocos"},{offset:"GMT+3",label:"Indian/Comoro"},{offset:"GMT+5",label:"Indian/Kerguelen"},{offset:"GMT+4",label:"Indian/Mahe"},{offset:"GMT+5",label:"Indian/Maldives"},{offset:"GMT+4",label:"Indian/Mauritius"},{offset:"GMT+3",label:"Indian/Mayotte"},{offset:"GMT+4",label:"Indian/Reunion"},{offset:"GMT+13",label:"Pacific/Apia"},{offset:"GMT+13",label:"Pacific/Auckland"},{offset:"GMT+11",label:"Pacific/Bougainville"},{offset:"GMT+13:45",label:"Pacific/Chatham"},{offset:"GMT-5",label:"Pacific/Easter"},{offset:"GMT+11",label:"Pacific/Efate"},{offset:"GMT+13",label:"Pacific/Enderbury"},{offset:"GMT+13",label:"Pacific/Fakaofo"},{offset:"GMT+12",label:"Pacific/Fiji"},{offset:"GMT+12",label:"Pacific/Funafuti"},{offset:"GMT-6",label:"Pacific/Galapagos"},{offset:"GMT-9",label:"Pacific/Gambier"},{offset:"GMT+11",label:"Pacific/Guadalcanal"},{offset:"GMT+10",label:"Pacific/Guam"},{offset:"GMT-10",label:"Pacific/Honolulu"},{offset:"GMT+14",label:"Pacific/Kiritimati"},{offset:"GMT+11",label:"Pacific/Kosrae"},{offset:"GMT+12",label:"Pacific/Kwajalein"},{offset:"GMT+12",label:"Pacific/Majuro"},{offset:"GMT-9:30",label:"Pacific/Marquesas"},{offset:"GMT-11",label:"Pacific/Midway"},{offset:"GMT+12",label:"Pacific/Nauru"},{offset:"GMT-11",label:"Pacific/Niue"},{offset:"GMT+12",label:"Pacific/Norfolk"},{offset:"GMT+11",label:"Pacific/Noumea"},{offset:"GMT-11",label:"Pacific/Pago_Pago"},{offset:"GMT+9",label:"Pacific/Palau"},{offset:"GMT-8",label:"Pacific/Pitcairn"},{offset:"GMT+11",label:"Pacific/Ponape"},{offset:"GMT+10",label:"Pacific/Port_Moresby"},{offset:"GMT-10",label:"Pacific/Rarotonga"},{offset:"GMT+10",label:"Pacific/Saipan"},{offset:"GMT-10",label:"Pacific/Tahiti"},{offset:"GMT+12",label:"Pacific/Tarawa"},{offset:"GMT+13",label:"Pacific/Tongatapu"},{offset:"GMT+10",label:"Pacific/Truk"},{offset:"GMT+12",label:"Pacific/Wake"},{offset:"GMT+12",label:"Pacific/Wallis"}].sort((e,t)=>this.compareOffsets(e.offset,t.offset))),this.tz.unshift({offset:"",label:"System Timezone -"}),this.dateTimezone().setValidators([Et.required,Q0(this.tz)]),this.filteredTZ=this.dateTimezone().valueChanges.pipe(Tn(500),Ga(""),Zt(e=>this.filterTZ(e||""))),this.filteredTZSubscription=this.filteredTZ.pipe($e(this._destroyRef)).subscribe()}filterTZ(e){let t=e.toLowerCase();return this.tz.filter(i=>i.label.toLowerCase().includes(t))}compareOffsets(e,t){let i=a=>{let r=a.match(/([+-]?)(\d+)(?::(\d+))?/);if(!r)return 0;let s=r[1]==="-"?-1:1,l=parseInt(r[2],10),m=r[3]?parseInt(r[3],10):0;return s*(l*60+m)};return i(e)-i(t)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["display-datetime-options"]],inputs:{dateFormat:[1,"dateFormat"],dateTimezone:[1,"dateTimezone"]},decls:15,vars:6,consts:[["timeZoneAutoComplete","matAutocomplete"],[1,"widget-options-grid"],[1,"options-grid-span2"],["matInput","","placeholder","dd/MM/yyyy HH:mm:ss","name","dateFormat","required","",3,"formControl"],["type","text","matInput","","placeholder","Type to use autocomplete","name","dateTimezone","required","",3,"formControl","matAutocomplete"],["mat-icon-button","","matSuffix","","aria-label","Clear"],[3,"value"],["mat-icon-button","","matSuffix","","aria-label","Clear",3,"click"],[1,"fa-solid","fa-close"]],template:function(t,i){if(t&1&&(d(0,"div",1)(1,"mat-form-field",2)(2,"mat-label"),c(3,"Date & Time Format"),u(),F(4,"input",3),u(),d(5,"mat-form-field",2)(6,"mat-label"),c(7,"Adjust Value to Time Zone"),u(),F(8,"input",4),I(9,Y0,2,0,"button",5),d(10,"mat-autocomplete",null,0),xe(12,Z0,2,3,"mat-option",6,Ai),lt(14,"async"),u()()()),t&2){let a=Nt(11);g(4),O("formControl",i.dateFormat()),g(4),O("formControl",i.dateTimezone())("matAutocomplete",a),g(),N(i.dateTimezone().value?9:-1),g(3),Ce(kt(14,4,i.filteredTZ))}},dependencies:[St,Ct,wt,It,yt,dt,Pt,xt,an,ba,Tt,Wn,lo,Lt,Gr],encapsulation:2})}return n})();function K0(n,o){if(n&1&&(d(0,"mat-option",6),c(1),lt(2,"titlecase"),u()),n&2){let e=o.$implicit;O("value",Li(e)),g(),X(kt(2,3,e))}}var Il={V1_PLUGIN:"autopilot",V2_BASE:"/signalk/v2/api",V2_AUTOPILOTS:"/signalk/v2/api/vessels/self/autopilots",V2_DEFAULT_AUTOPILOT_ID:"/signalk/v2/api/vessels/self/autopilots/_providers/_default"},Ju={options:{modes:[],states:[]},state:null,mode:"off-line",target:null,engaged:!1},em=(()=>{class n{formGroupName=x.required();_pluginConfig=y(es);_destroyRef=y(Ze);http=y(Ha);rootFormGroup=y(pt);autopilotFormGroup;apiVersion=_(null);availableAutopilots=_({});autopilotPlugin=_(null);discoveryInProgress=_(!1);apiDetectionError=_(null);apInstances=K(()=>{let e=this.availableAutopilots();return e?Object.keys(e):[]});modes=_(null);pluginId=_(null);currentRequests=new Set;constructor(){L(()=>{this.autopilotFormGroup.get("apiVersion")?.setValue(this.apiVersion(),{emitEvent:!1})})}ngOnInit(){this.autopilotFormGroup=this.rootFormGroup.control.get(this.formGroupName()),this.modes.set(this.autopilotFormGroup.value.modes||null),this.detectAutopilotApi()}detectAutopilotApi(){return Ve(this,null,function*(){this.discoveryInProgress.set(!0),console.log("[Autopilot Options] Starting API detection...");try{if(yield this.checkV2Api())if(this.apiVersion.set("v2"),this.autopilotFormGroup.get("apiVersion")?.setValue("v2",{emitEvent:!1}),this.availableAutopilots()&&Object.keys(this.availableAutopilots()).length>0){this.pluginId.set(Object.values(this.availableAutopilots())[0]?.provider??null),this.autopilotFormGroup.get("pluginId")?.setValue(this.pluginId(),{emitEvent:!1}),this.discoveryInProgress.set(!1);return}else console.warn("[Autopilot Options] No V2 autopilot provider found")}catch(e){console.error("[Autopilot Options] Error checking V2 API, checking V1...",e)}try{let e=yield this._pluginConfig.getPlugin(Il.V1_PLUGIN);if(e.ok&&e.data.state.enabled){this.apiVersion.set("v1"),this.autopilotFormGroup.get("apiVersion")?.setValue("v1",{emitEvent:!1}),this.availableAutopilots.set({"Default Autopilot":{provider:"Signal K Autopilot",isDefault:!0}}),this.pluginId.set("Signal K Autopilot"),this.autopilotFormGroup.get("pluginId")?.setValue("Signal K Autopilot",{emitEvent:!1}),console.log("[Autopilot Options] V1 API Signal K Autopilot plugin detected"),this.discoveryInProgress.set(!1);return}console.log("[Autopilot Options] V1 API plugin (signalk-autopilot) not found")}catch(e){console.error("[Autopilot Options] V1 plugin detection failed:",e)}console.warn("[Autopilot Options] No Autopilot detected"),this.discoveryInProgress.set(!1)})}checkV2Api(){return Ve(this,null,function*(){try{let e=yield kn(this.makeHttpRequest(this.http.get(Il.V2_AUTOPILOTS,{observe:"response",responseType:"json"})));return e&&e.body&&Object.keys(e.body).length>0?(this.availableAutopilots.set(e.body),console.log("[Autopilot Options] Discovered V2 API autopilot providers:",JSON.stringify(e.body))):(this.availableAutopilots.set({}),console.warn("[Autopilot Options] No V2 autopilot provider plugin found.")),e?.status===200}catch(e){if(e&&typeof e=="object"&&"status"in e){let t=e;t.status===404?console.log("[Autopilot Options] V2 API endpoint not found (404)"):t.status>=500?console.warn("[Autopilot Options] V2 API server error:",t.status,t.statusText):console.log("[Autopilot Options] V2 API call to discover Autopilot Providers failed:",t.status,t.statusText)}else console.log("[Autopilot Options] V2 API network error:",e);return!1}})}discoverV2AutopilotOptions(e){return Ve(this,null,function*(){let t;try{try{this.discoveryInProgress.set(!0),t=yield kn(this.makeHttpRequest(this.http.get(`${Il.V2_AUTOPILOTS}/${e}`))),console.log("[Autopilot Options] V2 Autopilot Options response:",JSON.stringify(t))}catch(i){t=Ju,console.log(`[Autopilot Options] Default AP discovery endpoint error for instance '${e}'`)}return this.discoveryInProgress.set(!1),t}catch(i){return console.error("[Autopilot Options] Failed to discover V2 endpoints:",i),console.log(`[Autopilot Options] Using fallback V2 endpoints for instance '${e}'`),Ju}})}onAutopilotInstanceIdChange(e){let t=e.value;if(e.value===""){this.modes.set(""),this.autopilotFormGroup.get("modes")?.setValue("",{emitEvent:!1});return}console.log("[Autopilot Options] Selected Autopilot Instance ID:",t),this.apiVersion()==="v2"?this.discoverV2AutopilotOptions(t).then(i=>{let a=i.options.modes||[];this.modes.set(a.join(", ")),this.autopilotFormGroup.get("modes")?.setValue(a,{emitEvent:!1}),console.log("[Autopilot Options] Autopilot plugin supported modes :",a.join(", "))}).catch(i=>{console.error("[Autopilot Options] Error requesting autopilot modes:",i),this.autopilotFormGroup.get("modes")?.setValue([],{emitEvent:!1})}):this.apiVersion()==="v1"&&(this.modes.set("standby, auto, wind, route"),this.autopilotFormGroup.get("modes")?.setValue("standby, auto, wind, route",{emitEvent:!1}),console.log("[Autopilot Options] Autopilot mode set to Raymarine v1 API modes: standby, auto, wind, route"))}makeHttpRequest(e){let t=e.pipe($e(this._destroyRef));return this.currentRequests.add(t),t.pipe(Sr(()=>this.currentRequests.delete(t)))}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["select-autopilot"]],inputs:{formGroupName:[1,"formGroupName"]},decls:30,vars:4,consts:[[1,"display-content","tab-content"],[1,"autopilot-options",3,"formGroup"],[1,"flex-item-rounded-card","rounded-card-color",2,"margin-block","10px"],[2,"margin-block-start","0px"],["placeholder","Select autopilot...","formControlName","instanceId","name","instanceId","required","",3,"selectionChange"],["value",""],[3,"value"],[1,"flex-item-rounded-card","rounded-card-color",2,"margin-block","10px","margin-left","10px","margin-right","10px"],["name","headingDirectionTrue","formControlName","headingDirectionTrue"],["name","invertRudder","formControlName","invertRudder"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),c(4,"Signal K Service Discovery"),u(),d(5,"ul")(6,"li")(7,"b"),c(8,"API Version:"),u(),c(9),u(),d(10,"li")(11,"b"),c(12,"Plugin:"),u(),c(13),u()()(),d(14,"mat-form-field")(15,"mat-label"),c(16,"Target Autopilot"),u(),d(17,"mat-select",4),U("selectionChange",function(r){return i.onAutopilotInstanceIdChange(r)}),d(18,"mat-option",5),c(19,"No autopilot"),u(),xe(20,K0,3,5,"mat-option",6,Ne),u()(),d(22,"div",7)(23,"b"),c(24,"Supported modes:"),u(),c(25),u(),d(26,"mat-checkbox",8),c(27," Display True Heading "),u(),d(28,"mat-checkbox",9),c(29," Invert Rudder Angle Indicator "),u()()()),t&2&&(g(),O("formGroup",i.autopilotFormGroup),g(8),ge(" ",i.apiVersion()),g(4),ge(" ",i.pluginId()),g(7),Ce(i.apInstances()),g(5),ge(" ",i.modes()," "))},dependencies:[xt,dt,Dt,Pt,pt,Ei,ii,St,Ct,oi,qt,on,ai,Lt,ni,Dn],styles:[".autopilot-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px}"]})}return n})();var tm=(()=>{class n{data=y(Wt);destroyRef=y(Ze);allPaths=new Set;registrations=new Map;constructor(){this.seedFromDataCache(),this.data.observePathUpdates().pipe($e(this.destroyRef)).subscribe(e=>this.applyPathUpdate(e)),this.data.isResetService().pipe($e(this.destroyRef)).subscribe(()=>this.reset())}seedFromDataCache(){for(let e of this.data.getCachedPaths())this.addPath(e)}register(e){this.assertHasCriteria(e);let t=this.createToken(e.id),i=this.compileCriteria(e),a=new Set;for(let r of this.allPaths)this.matchesCriteria(r,i)&&a.add(r);return this.registrations.set(t,{criteria:i,matches:a,changes$:new zt}),t}unregister(e){let t=this.registrations.get(e);t&&(t.changes$.complete(),this.registrations.delete(e))}changes(e){return this.registrations.get(e)?.changes$.asObservable()??Zd}activePaths(e){return this.registrations.get(e)?.matches??new Set}match(e){this.assertHasCriteria(e);let t=this.compileCriteria(e);return Array.from(this.allPaths).filter(i=>this.matchesCriteria(i,t))}applyPathUpdate(e){let t=e?.fullPath;t&&(e.kind==="data"&&e.update?.value===null||this.addPath(t))}addPath(e){if(!this.allPaths.has(e)){this.allPaths.add(e);for(let t of this.registrations.values())this.matchesCriteria(e,t.criteria)&&(t.matches.add(e),t.changes$.next({type:"add",path:e}))}}removePath(e){if(this.allPaths.delete(e))for(let t of this.registrations.values())t.matches.delete(e)&&t.changes$.next({type:"remove",path:e})}reset(){for(let e of this.registrations.values()){for(let t of e.matches)e.changes$.next({type:"remove",path:t});e.matches.clear()}this.allPaths.clear()}compileCriteria(e){let t=e.patterns?.length?e.patterns:[];return fe(ae({},e),{patterns:t,compiled:{patterns:t.map(i=>this.globToRegex(i)),contextTypes:e.contextTypes??[],prefixGuards:e.pathPrefixes??[],suffixGuards:e.pathSuffixes??[]}})}matchesCriteria(e,t){let i=t.compiled,a=this.getContextType(e);if(i.contextTypes.length&&(!a||!i.contextTypes.includes(a)))return!1;let r=this.getPathPart(e,a);return i.prefixGuards.length&&!i.prefixGuards.some(s=>r.startsWith(s))||i.suffixGuards.length&&!this.matchesSuffix(r,i.suffixGuards)?!1:i.patterns.length?i.patterns.some(s=>s.test(e)):!0}getPathPart(e,t){if(t==="self"){let a=e.indexOf(".");return a===-1?e:e.slice(a+1)}if(t==="vessels"||t==="atons"){let a=`${t}.urn:mrn:imo:mmsi:`;if(!e.startsWith(a))return e;let r=e.indexOf(".",a.length);return r===-1?"":e.slice(r+1)}let i=e.indexOf(".");return i===-1?e:e.slice(i+1)}getContextType(e){return e.startsWith("self.")?"self":e.startsWith("vessels.urn:mrn:imo:mmsi:")?"vessels":e.startsWith("atons.urn:mrn:imo:mmsi:")?"atons":null}globToRegex(e){let i="^"+e.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".")+"$";return new RegExp(i)}matchesSuffix(e,t){if(!t.length)return!0;let i=e.lastIndexOf("."),a=i===-1?`.${e}`:e.slice(i);return t.some(r=>e.endsWith(r)||a===r)}createToken(e){let t=e??"token",i=`${t}-${Math.random().toString(36).slice(2,10)}`;for(;this.registrations.has(i);)i=`${t}-${Math.random().toString(36).slice(2,10)}`;return i}assertHasCriteria(e){let t=Array.isArray(e.patterns)&&e.patterns.length>0,i=Array.isArray(e.contextTypes)&&e.contextTypes.length>0,a=Array.isArray(e.pathPrefixes)&&e.pathPrefixes.length>0,r=Array.isArray(e.pathSuffixes)&&e.pathSuffixes.length>0;if(!t&&!i&&!a&&!r)throw new Error("PathDiscoveryService.register requires at least one criteria (pattern or guard).")}ngOnDestroy(){for(let e of this.registrations.values())e.changes$.complete();this.registrations.clear(),this.allPaths.clear()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function J0(n,o){if(n&1&&(d(0,"mat-option",4),c(1),u()),n&2){let e=o.$implicit;O("value",e),g(),X(e)}}function ev(n,o){n&1&&(d(0,"div",5),c(1,"No banks configured yet."),u())}function tv(n,o){if(n&1&&(d(0,"mat-option",4),c(1),u()),n&2){let e=o.$implicit;O("value",e),g(),X(e)}}function iv(n,o){if(n&1&&(d(0,"mat-option",4),c(1),lt(2,"titlecase"),u()),n&2){let e=o.$implicit;O("value",e),g(),X(kt(2,2,e))}}function nv(n,o){if(n&1){let e=Se();d(0,"div",9)(1,"div",10)(2,"mat-form-field",11)(3,"mat-label"),c(4,"Bank Name"),u(),F(5,"input",12),u(),d(6,"button",13),U("click",function(){let i=ee(e).$index,a=k();return te(a.removeBank(i))}),d(7,"mat-icon"),c(8,"delete"),u()()(),d(9,"mat-form-field",2)(10,"mat-label"),c(11,"Battery Members"),u(),d(12,"mat-select",14),xe(13,tv,2,2,"mat-option",4,Ne),u()(),d(15,"mat-form-field",2)(16,"mat-label"),c(17,"Connection Mode"),u(),d(18,"mat-select",15),xe(19,iv,3,4,"mat-option",4,Ai),u()()()}if(n&2){let e=o.$index,t=k();O("formGroupName",e),g(13),Ce(t.discoveredBatteryIds()),g(6),Ce(t.connectionModes)}}var im=(()=>{class n{connectionModes=["parallel","series"];formGroupName=x.required();rootFormGroup=y(pt);discovery=y(tm);destroyRef=y(Ze);bmsFormGroup;banksFormArray;trackedBatteryIdsControl;discoveredBatteryIds=_([]);hasBanks=K(()=>this.banksFormArray?.length>0);discoveryToken;ngOnInit(){this.bmsFormGroup=this.rootFormGroup.control.get(this.formGroupName()),this.bmsFormGroup&&(this.ensureTrackedControl(),this.ensureBanksArray(),this.initializeDiscovery())}addBank(){let e={id:`bank-${Date.now()}`,name:"New Bank",batteryIds:[],connectionMode:"parallel"};this.banksFormArray.push(this.createBankGroup(e)),this.banksFormArray.markAsDirty()}removeBank(e){this.banksFormArray.removeAt(e),this.banksFormArray.markAsDirty()}ngOnDestroy(){this.discoveryToken&&this.discovery.unregister(this.discoveryToken)}ensureTrackedControl(){let e=this.bmsFormGroup.get("trackedBatteryIds");if(e instanceof ct){this.trackedBatteryIdsControl=e;return}this.trackedBatteryIdsControl=new ct([]),this.bmsFormGroup.addControl("trackedBatteryIds",this.trackedBatteryIdsControl)}ensureBanksArray(){let e=this.bmsFormGroup.get("banks");if(e instanceof ru||e instanceof xl){this.banksFormArray=e;return}let t=Array.isArray(e?.value)?e.value:[];this.banksFormArray=new xl(t.map(i=>this.createBankGroup(i))),this.bmsFormGroup.setControl("banks",this.banksFormArray)}createBankGroup(e){return new Zr({id:new ct(e.id,Et.required),name:new ct(e.name,Et.required),batteryIds:new ct(e.batteryIds??[]),connectionMode:new ct(e.connectionMode??"parallel",Et.required)})}initializeDiscovery(){this.discoveryToken=this.discovery.register({id:"bms-batteries",patterns:["self.electrical.batteries.*"],contextTypes:["self"],pathPrefixes:["electrical.batteries."]}),this.updateDiscoveredBatteryIds(),this.discovery.changes(this.discoveryToken).pipe($e(this.destroyRef)).subscribe(()=>this.updateDiscoveredBatteryIds())}updateDiscoveredBatteryIds(){if(!this.discoveryToken)return;let e=Array.from(this.discovery.activePaths(this.discoveryToken)).map(t=>this.extractBatteryId(t)).filter(t=>!!t);this.discoveredBatteryIds.set([...new Set(e)].sort())}extractBatteryId(e){let t=e.match(/self\.electrical\.batteries\.([^.]+)\./);return t?t[1]:null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["bms-bank-setup"]],inputs:{formGroupName:[1,"formGroupName"]},decls:23,vars:2,consts:[[1,"bms-config",3,"formGroup"],[1,"bms-config-section"],["appearance","outline",1,"full-width"],["formControlName","trackedBatteryIds","multiple",""],[3,"value"],[1,"hint"],[1,"section-header"],["mat-raised-button","","color","primary","type","button",3,"click"],["formArrayName","banks",1,"bank-list"],[1,"bank-card",3,"formGroupName"],[1,"bank-row"],["appearance","outline",1,"bank-name"],["matInput","","formControlName","name"],["mat-icon-button","","type","button","aria-label","Remove bank",3,"click"],["formControlName","batteryIds","multiple",""],["formControlName","connectionMode"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1)(2,"h3"),c(3,"Tracked Batteries"),u(),d(4,"mat-form-field",2)(5,"mat-label"),c(6,"Battery Instances"),u(),d(7,"mat-select",3),xe(8,J0,2,2,"mat-option",4,Ne),u()(),d(10,"div",5),c(11," Leave empty to display all discovered batteries. "),u()(),F(12,"mat-divider"),d(13,"div",1)(14,"div",6)(15,"h3"),c(16,"Battery Banks"),u(),d(17,"button",7),U("click",function(){return i.addBank()}),c(18," Add Bank "),u()(),d(19,"div",8),I(20,ev,2,0,"div",5),xe(21,nv,21,1,"div",9,Ne),u()()()),t&2&&(O("formGroup",i.bmsFormGroup),g(8),Ce(i.discoveredBatteryIds()),g(12),N(i.hasBanks()?-1:20),g(),Ce(i.banksFormArray.controls))},dependencies:[xt,yt,dt,Dt,pt,Ei,Xr,Kr,ii,St,Ct,ni,wt,on,ai,Lt,nt,At,Tt,et,Qe,Gn,Fn,Dn],styles:["[_nghost-%COMP%]{display:block;width:100%}.bms-config[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;padding:12px 4px}.bms-config-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.section-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px}.full-width[_ngcontent-%COMP%]{width:100%}.bank-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.bank-card[_ngcontent-%COMP%]{border:1px solid var(--kip-widget-card-border-color);border-radius:12px;padding:12px;background:var(--kip-contrast-dimmer-color);display:flex;flex-direction:column;gap:10px}.bank-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px}.bank-name[_ngcontent-%COMP%]{flex:1}.hint[_ngcontent-%COMP%]{font-size:12px;opacity:.7}"]})}return n})();var nm={fill:"#b1b1b1",stroke:"#50505f"},av=24,ov=1.6,rv="#e6e6e6",sv=.15,lv=1,dv=1,Ol=15e3,ps=25e3,cv=.9,uv=1.25;function am(n){let o=n.baseSizePx??av,e=n.unconfirmedFill??rv,t=n.unconfirmedOpacity??sv,i=n.targetState==="confirmed",a=i?mv(n.collisionRiskRating):"none",r=o,s,l,m,f,b,A,C;return i||(s=e,m=t,f=t),i&&n.isStationary&&(m=0),n.targetKind==="moving"&&a!=="none"?(A=a==="high"?"red":"yellow",C=cv,{fill:s,stroke:l,auraColor:A,auraOpacity:C,fillOpacity:m,strokeOpacity:f,strokeWidth:b,sizePx:Math.round(o*uv)}):{fill:s,stroke:l,auraColor:A,auraOpacity:C,fillOpacity:m,strokeOpacity:f,strokeWidth:b,sizePx:r}}function om(n,o){let e=pv(n,o),t=hv(n,o.sizePx),i=o.auraColor?bv(t):t;return yv(i,vv(e))}function Vl(n){return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(n).replace(/%0A/g,"").replace(/%0D/g,"")}`}function mv(n){return typeof n!="number"||!Number.isFinite(n)?"none":n<Ol?"high":n<ps?"low":"none"}function hv(n,o){let e=`${o}px`;return/<svg[^>]*\bwidth=/.test(n)?n=n.replace(/\bwidth="[^"]*"/i,`width="${e}"`):n=n.replace(/<svg\b/i,`<svg width="${e}"`),/<svg[^>]*\bheight=/.test(n)?n=n.replace(/\bheight="[^"]*"/i,`height="${e}"`):n=n.replace(/<svg\b/i,`<svg height="${e}"`),n}function pv(n,o){let e=fv(n);return{fill:Yn(o.fill,e.fill,nm.fill),stroke:Yn(o.stroke,e.stroke,nm.stroke),strokeDasharray:Yn(o.strokeStyle,e.strokeStyle,"solid"),auraColor:Yn(o.auraColor,e.auraColor,"transparent"),auraOpacity:Yn(o.auraOpacity,e.auraOpacity,0),strokeWidth:Yn(o.strokeWidth,e.strokeWidth,ov),fillOpacity:Yn(o.fillOpacity,e.fillOpacity,lv),strokeOpacity:Yn(o.strokeOpacity,e.strokeOpacity,dv)}}function fv(n){return{fill:$o(n,"--icon-fill"),stroke:$o(n,"--icon-stroke"),strokeStyle:$o(n,"--icon-stroke-dasharray"),auraColor:$o(n,"--icon-aura-color"),auraOpacity:hs(n,"--icon-aura-opacity"),strokeWidth:hs(n,"--icon-stroke-width"),fillOpacity:hs(n,"--icon-fill-opacity"),strokeOpacity:hs(n,"--icon-stroke-opacity")}}function $o(n,o){let e=n.match(new RegExp(`${gv(o)}:\\s*([^;]+);`,"i"));return e?e[1].trim():void 0}function hs(n,o){let e=$o(n,o);if(!e)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function gv(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Yn(n,o,e){return n!==void 0?n:o!==void 0?o:e}function vv(n){return[":root {",`--icon-fill: ${n.fill};`,`--icon-fill-opacity: ${Rl(n.fillOpacity)};`,`--icon-stroke: ${n.stroke};`,`--icon-stroke-dasharray: ${n.strokeDasharray};`,`--icon-aura-color: ${n.auraColor};`,`--icon-aura-opacity: ${Rl(n.auraOpacity)};`,`--icon-stroke-width: ${n.strokeWidth};`,`--icon-stroke-opacity: ${Rl(n.strokeOpacity)};`,"}"].join("")}function bv(n){if(n.includes('id="icon-aura"')||n.includes("id='icon-aura'"))return n;let o=Av(n)??{minX:0,minY:0,width:24,height:24},e=o.minX+o.width/2,t=o.minY+o.height/2,i=Math.min(o.width,o.height)/2,a=["<defs>",'<radialGradient id="icon-aura" cx="50%" cy="50%" r="50%">','<stop offset="0%" stop-color="var(--icon-aura-color)" stop-opacity="var(--icon-aura-opacity)" />','<stop offset="100%" stop-color="var(--icon-aura-color)" stop-opacity="0" />',"</radialGradient>","</defs>"].join(""),r=`<circle class="icon-aura" cx="${e}" cy="${t}" r="${i}" fill="url(#icon-aura)" />`;return n.replace(/<svg[^>]*>/i,s=>`${s}${a}${r}`)}function Av(n){let o=n.match(/viewBox="([^"]+)"/i);if(!o)return null;let e=o[1].trim().split(/\s+/).map(t=>Number(t));return e.length!==4||e.some(t=>!Number.isFinite(t))?null:{minX:e[0],minY:e[1],width:e[2],height:e[3]}}function yv(n,o){let e=n.match(/(<style[^>]*>)([\s\S]*?)(<\/style>)/i);if(e){let[,t,,i]=e;return n.replace(e[0],`${t}${o}${i}`)}return n.replace(/<svg[^>]*>/i,t=>`${t}<style>${o}</style>`)}function Rl(n){return Number.isFinite(n)?Math.min(1,Math.max(0,n)):1}var rm=new Map,Ll=new Map,sm=new Map,lm=new Map,dm=new Map,cm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" fill="#12f802" stroke="#fb05eb" stroke-width="1.4"/></svg>',xv={"aton/other":"assets/svg/AtoN/other/aton.svg","aton/basestation":"assets/svg/AtoN/other/basestation.svg","aton/east-beacon":"assets/svg/AtoN/cardinal/east_beacon.svg","aton/east-mark":"assets/svg/AtoN/cardinal/east_mark.svg","aton/west-beacon":"assets/svg/AtoN/cardinal/west_beacon.svg","aton/west-mark":"assets/svg/AtoN/cardinal/west_mark.svg","aton/north-beacon":"assets/svg/AtoN/cardinal/north_beacon.svg","aton/north-mark":"assets/svg/AtoN/cardinal/north_mark.svg","aton/south-beacon":"assets/svg/AtoN/cardinal/south_beacon.svg","aton/south-mark":"assets/svg/AtoN/cardinal/south_mark.svg","aton/port-beacon":"assets/svg/AtoN/lateral/port_beacon.svg","aton/starboard-beacon":"assets/svg/AtoN/lateral/starboard_beacon.svg","aton/port-preferred-beacon":"assets/svg/AtoN/lateral/port_preferred_beacon.svg","aton/starboard-preferred-beacon":"assets/svg/AtoN/lateral/starboard_preferred_beacon.svg","aton/port-mark":"assets/svg/AtoN/lateral/port_mark.svg","aton/starboard-mark":"assets/svg/AtoN/lateral/starboard_mark.svg","aton/port-preferred-mark":"assets/svg/AtoN/lateral/port_preferred_mark.svg","aton/starboard-preferred-mark":"assets/svg/AtoN/lateral/starboard_preferred_mark.svg","aton/special-beacon":"assets/svg/AtoN/special/special_beacon.svg","aton/special-mark":"assets/svg/AtoN/special/special_mark.svg","aton/safewater-beacon":"assets/svg/AtoN/dangerSafe/safewater_beacon.svg","aton/safewater-mark":"assets/svg/AtoN/dangerSafe/safewater_mark.svg","aton/isolateddanger-beacon":"assets/svg/AtoN/dangerSafe/isolateddanger_beacon.svg","aton/isolateddanger-mark":"assets/svg/AtoN/dangerSafe/isolateddanger_mark.svg","aton/unknown":"assets/svg/AtoN/other/unknown.svg"},um={"vessel/fishing":"assets/svg/vessel/fishing.svg","vessel/diving":"assets/svg/vessel/diving-ops.svg","vessel/military":"assets/svg/vessel/military-ops.svg","vessel/sailing":"assets/svg/vessel/sailing.svg","vessel/pleasurecraft":"assets/svg/vessel/pleasurecraft.svg","vessel/highspeed":"assets/svg/vessel/highspeed.svg","vessel/pilot":"assets/svg/vessel/pilot.svg","vessel/sar":"assets/svg/vessel/sar.svg","vessel/tug":"assets/svg/vessel/tug.svg","vessel/law":"assets/svg/vessel/law-enforcement.svg","vessel/spare":"assets/svg/vessel/other.svg","vessel/passenger":"assets/svg/vessel/passenger.svg","vessel/cargo":"assets/svg/vessel/cargo.svg","vessel/tanker":"assets/svg/vessel/tanker.svg","vessel/other":"assets/svg/vessel/other.svg","vessel/unknown":"assets/svg/vessel/unknown.svg","vessel/self":"assets/svg/vessel/self.svg"},fs=Object.keys(um),Cv={"beacon/sart":"assets/svg/sar-distress-device/sart-eprib-mob.svg","beacon/mob":"assets/svg/sar-distress-device/sart-eprib-mob.svg","beacon/epirb":"assets/svg/sar-distress-device/sart-eprib-mob.svg"},Sv=ae(ae(ae({},xv),um),Cv),wv=[{code:0,key:"aton/other"},{code:1,key:"aton/other"},{code:2,key:"aton/other"},{code:3,key:"aton/other"},{code:4,key:"aton/other"},{code:5,key:"aton/other"},{code:6,key:"aton/other"},{code:7,key:"aton/other"},{code:8,key:"aton/other"},{code:9,key:"aton/north-beacon"},{code:10,key:"aton/east-beacon"},{code:11,key:"aton/south-beacon"},{code:12,key:"aton/west-beacon"},{code:13,key:"aton/port-beacon"},{code:14,key:"aton/starboard-beacon"},{code:15,key:"aton/port-preferred-beacon"},{code:16,key:"aton/starboard-preferred-beacon"},{code:17,key:"aton/isolateddanger-beacon"},{code:18,key:"aton/safewater-beacon"},{code:19,key:"aton/special-beacon"},{code:20,key:"aton/north-mark"},{code:21,key:"aton/east-mark"},{code:22,key:"aton/south-mark"},{code:23,key:"aton/west-mark"},{code:24,key:"aton/port-mark"},{code:25,key:"aton/starboard-mark"},{code:26,key:"aton/port-preferred-mark"},{code:27,key:"aton/starboard-preferred-mark"},{code:28,key:"aton/isolateddanger-mark"},{code:29,key:"aton/safewater-mark"},{code:30,key:"aton/special-mark"},{code:31,key:"aton/other"}],_v=[{min:0,max:9,key:"vessel/other"},{min:10,max:19,key:"vessel/other"},{min:20,max:29,key:"vessel/highspeed"},{min:30,max:30,key:"vessel/fishing"},{min:31,max:31,key:"vessel/tug"},{min:32,max:32,key:"vessel/tug"},{min:33,max:33,key:"vessel/tug"},{min:34,max:34,key:"vessel/diving"},{min:35,max:35,key:"vessel/military"},{min:36,max:36,key:"vessel/sailing"},{min:37,max:37,key:"vessel/pleasurecraft"},{min:38,max:39,key:"vessel/other"},{min:40,max:49,key:"vessel/highspeed"},{min:50,max:50,key:"vessel/pilot"},{min:51,max:51,key:"vessel/sar"},{min:52,max:52,key:"vessel/tug"},{min:53,max:53,key:"vessel/tug"},{min:54,max:54,key:"vessel/tug"},{min:55,max:55,key:"vessel/law"},{min:56,max:56,key:"vessel/other"},{min:57,max:57,key:"vessel/other"},{min:58,max:58,key:"vessel/tug"},{min:59,max:59,key:"vessel/tug"},{min:60,max:69,key:"vessel/passenger"},{min:70,max:79,key:"vessel/cargo"},{min:80,max:89,key:"vessel/tanker"},{min:90,max:99,key:"vessel/other"}];function mm(n){return Ve(this,null,function*(){let o=am(Rv(n));return Tv(Fl(n),o)})}function hm(){return Ve(this,null,function*(){return Mv("vessel/self")})}function pm(n){return Ve(this,null,function*(){let o=rm.get(n);if(o)return o;let e=Ll.get(n);if(e)return e;let t=Sv[n],i=fetch(t).then(a=>a.ok?a.text():cm).catch(a=>(console.warn("[ais-icon-registry] Icon fetch error, using fallback.",{key:n,url:t,error:a}),cm)).then(a=>(rm.set(n,a),Ll.delete(n),a));return Ll.set(n,i),i})}function Mv(n){return Ve(this,null,function*(){let o=sm.get(n);if(o)return o;let e=yield pm(n),t=Vl(e);return sm.set(n,t),t})}function kv(n,o){return Ve(this,null,function*(){let e=fm(n,o),t=lm.get(e);if(t)return t;let i=yield pm(n),a=om(i,o);return lm.set(e,a),a})}function Tv(n,o){return Ve(this,null,function*(){let e=fm(n,o),t=dm.get(e);if(t)return t;let i=yield kv(n,o),a=Vl(i);return dm.set(e,a),a})}function fm(n,o){return`${n}|${Ev(o)}`}function Ev(n){return[Wl(n.fill),Wl(n.stroke),Wl(n.auraColor),jo(n.fillOpacity),jo(n.strokeOpacity),jo(n.auraOpacity),jo(n.strokeWidth),jo(n.sizePx)].join("|")}function Wl(n){return n??""}function jo(n){return n===void 0||!Number.isFinite(n)?"":n.toFixed(4)}function Fl(n){let o=Pv(Dv(n.mmsi));if(o)return o;switch(n.type){case"aton":return Iv(n.atonTypeId??null);case"basestation":return"aton/basestation";case"sar":return"vessel/sar";case"vessel":return Nv(n.aisShipTypeId??null);default:return"vessel/unknown"}}function Dv(n){if(n==null)return null;let o=typeof n=="number"?String(n):n;return o.length?o:null}function Pv(n){return n?n.startsWith("970")?"beacon/sart":n.startsWith("972")?"beacon/mob":n.startsWith("974")?"beacon/epirb":null:null}function Iv(n){let o=typeof n=="number"&&Number.isFinite(n)?n:null,t=(o===null?void 0:wv.find(i=>i.code===o))?.key??"aton/unknown";return t}function Nv(n){if(n!==null){for(let o of _v)if(n>=o.min&&n<=o.max)return o.key}return"vessel/other"}function Rv(n){let o=Vv(n.navState),e=n.targetKind??(o?"fixed":Ov(n.type)),t=n.status==="unconfirmed"||n.status==="lost"?"unconfirmed":"confirmed";return ae({targetKind:e,targetState:t,isStationary:o,collisionRiskRating:n.collisionRiskRating},n.themeOverrides)}function Ov(n){switch(n){case"aton":case"basestation":return"fixed";default:return"moving"}}function Vv(n){let o=Lv(n);if(o!==void 0)return o===1||o===5;let e=Wv(n);return e?e.includes("moored")||e.includes("anchored")||e.includes("at anchor"):!1}function Lv(n){if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"){let o=n.trim();if(!o.length)return;let e=Number(o);return Number.isFinite(e)?e:void 0}}function Wv(n){if(typeof n!="string")return;let o=n.trim().toLowerCase();return o.length?o.replace(/\s+/g," "):void 0}function Fv(n,o){if(n&1){let e=Se();d(0,"mat-checkbox",8),U("change",function(){let i=ee(e).$implicit,a=k(2);return te(a.toggleVesselType(i))}),c(1),u()}if(n&2){let e=o.$implicit,t=k(2);O("checked",t.isVesselTypeSelected(e)),g(),ge(" ",t.formatVesselTypeLabel(e)," ")}}function Gv(n,o){if(n&1&&(d(0,"div",0)(1,"p",1),c(2,"Categories"),u(),d(3,"mat-checkbox",2),c(4,"Anchored/Moored"),u(),d(5,"mat-checkbox",3),c(6,"All AtoN"),u(),d(7,"mat-checkbox",4),c(8,"All but SAR"),u(),d(9,"mat-checkbox",5),c(10,"All Vessels"),u(),F(11,"mat-divider",6),d(12,"p",1),c(13,"Types of vessels"),u(),xe(14,Fv,2,2,"mat-checkbox",7,Ai),u()),n&2){let e=k();O("formGroup",e.filtersGroup),g(14),Ce(e.vesselTypeFilters)}}var gm=(()=>{class n{formGroupName=x.required();rootFormGroup=y(pt);fb=y(Vn);aisFormGroup=null;filtersGroup=null;vesselTypeFilters=fs.filter(e=>e!=="vessel/self"&&e!=="vessel/unknown"&&e!=="vessel/spare");ngOnInit(){if(this.aisFormGroup=this.rootFormGroup.control.get(this.formGroupName()),!this.aisFormGroup){console.warn(`AIS form group "${this.formGroupName()}" not found for target options.`);return}this.filtersGroup=this.ensureFiltersGroup(this.aisFormGroup)}isVesselTypeSelected(e){let t=this.vesselTypesControl();if(!t)return!1;let i=t.value;return Array.isArray(i)&&i.includes(e)}toggleVesselType(e){let t=this.vesselTypesControl();if(!t)return;let i=Array.isArray(t.value)?t.value:[],a=new Set(i);a.has(e)?a.delete(e):a.add(e),t.setValue(Array.from(a))}formatVesselTypeLabel(e){let t=e.replace("vessel/","");switch(t){case"pleasurecraft":return"Pleasure Craft";case"highspeed":return"High Speed";case"sar":return"SAR";case"law":return"Law Enforcement";default:return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}}ensureFiltersGroup(e){let t=e.get("filters");if(!t)return t=this.buildDefaultFiltersGroup(),e.addControl("filters",t),t;this.ensureControl(t,"anchoredMoored",!1),this.ensureControl(t,"noCollisionRisk",!1),this.ensureControl(t,"allAton",!1),this.ensureControl(t,"allButSar",!1),this.ensureControl(t,"allVessels",!1);let i=this.ensureControl(t,"vesselTypes",[]);return Array.isArray(i.value)||i.setValue([]),t}buildDefaultFiltersGroup(){return this.fb.group({anchoredMoored:new ct(!1),noCollisionRisk:new ct(!1),allAton:new ct(!1),allButSar:new ct(!1),allVessels:new ct(!1),vesselTypes:new ct([])})}ensureControl(e,t,i){let a=e.get(t);return a||(a=new ct(i),e.addControl(t,a)),a}vesselTypesControl(){return this.filtersGroup?.get("vesselTypes")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["ais-target-options"]],inputs:{formGroupName:[1,"formGroupName"]},decls:1,vars:1,consts:[[1,"vessel-type-grid",3,"formGroup"],[1,"span-all"],["formControlName","anchoredMoored"],["formControlName","allAton"],["formControlName","allButSar"],["formControlName","allVessels"],[1,"span-all","ais-target-divider"],[3,"checked"],[3,"change","checked"]],template:function(t,i){t&1&&I(0,Gv,16,1,"div",0),t&2&&N(i.filtersGroup?0:-1)},dependencies:[xt,dt,Dt,pt,Ei,oi,qt,Gn,Fn],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;overflow:hidden}.ais-target-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}.vessel-type-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:0px 12px}.span-all[_ngcontent-%COMP%]{grid-column:1/-1}.ais-target-divider[_ngcontent-%COMP%]{margin:4px 0}"],changeDetection:0})}return n})();var vm=()=>["measuring","capacity"],Bv=()=>["marineCompass","baseplateCompass"],zv=()=>["measuring"];function Uv(n,o){if(n&1&&F(0,"config-display-chart-options",5),n&2){let e=k();O("displayName",e.displayNameToControl)("datasetUUID",e.datasetUUIDToControl)("convertUnitTo",e.convertUnitToControl)("showDataPoints",e.showDataPointsToControl)("showAverageData",e.showAverageDataToControl)("trackAgainstAverage",e.trackAgainstAverageToControl)("datasetAverageArray",e.datasetAverageArrayToControl)("showDatasetMinimumValueLine",e.showDatasetMinimumValueLineToControl)("showDatasetMaximumValueLine",e.showDatasetMaximumValueLineToControl)("showDatasetAverageValueLine",e.showDatasetAverageValueLineToControl)("showDatasetAngleAverageValueLine",e.showDatasetAngleAverageValueLineToControl)("startScaleAtZero",e.startScaleAtZeroToControl)("showLabel",e.showLabelToControl)("showTimeScale",e.showTimeScaleToControl)("showYScale",e.showYScaleToControl)("yScaleSuggestedMin",e.yScaleSuggestedMinToControl)("yScaleSuggestedMax",e.yScaleSuggestedMaxToControl)("enableMinMaxScaleLimit",e.enableMinMaxScaleLimitToControl)("yScaleMin",e.yScaleMinToControl)("yScaleMax",e.yScaleMaxToControl)("numDecimal",e.numDecimalToControl)("verticalChart",e.verticalChartToControl)("inverseYAxis",e.inverseYAxisToControl)("color",e.colorToControl)}}function Hv(n,o){n&1&&F(0,"select-autopilot",6)}function qv(n,o){n&1&&(d(0,"mat-form-field",18)(1,"mat-label"),c(2,"URL"),u(),F(3,"input",43),u())}function $v(n,o){n&1&&(d(0,"mat-checkbox",19),c(1," Allow pointer events on embedded content. WARNING: this may prevent swipe gestures over the Embed widget or keyboard events, while the focus is in the embed, from triggering normal KIP interactions. "),u())}function jv(n,o){n&1&&(d(0,"div",44)(1,"div",45)(2,"mat-form-field",46)(3,"mat-label"),c(4,"Widget Label"),u(),F(5,"input",47),u()(),d(6,"div",45)(7,"mat-checkbox",48),c(8," Show Label "),u()()())}function Yv(n,o){n&1&&(d(0,"mat-form-field",18)(1,"mat-label"),c(2,"Widget Label"),u(),F(3,"input",47),u())}function Zv(n,o){if(n&1&&I(0,jv,9,0,"div",44)(1,Yv,4,0,"mat-form-field",18),n&2){let e=k(2);N((e.widgetConfig==null?null:e.widgetConfig.showLabel)!==void 0?0:1)}}function Qv(n,o){n&1&&(d(0,"mat-form-field",49)(1,"mat-label"),c(2,"Scale Start"),u(),F(3,"input",50),u(),d(4,"mat-form-field",49)(5,"mat-label"),c(6,"Scale End"),u(),F(7,"input",51),u())}function Xv(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Integer Places"),u(),F(3,"input",52),u())}function Kv(n,o){if(n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Decimal Places"),u(),F(3,"input",53),u()),n&2){let e=k(2);it(e.widgetConfig.showMiniChart!==void 0?"options-grid-span2":"")}}function Jv(n,o){n&1&&(d(0,"mat-checkbox",21),c(1," Show Min recorded value "),u())}function eb(n,o){n&1&&(d(0,"mat-checkbox",22),c(1," Show Max recorded value "),u())}function tb(n,o){if(n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Next Dashboard after start"),u(),F(3,"input",54),u()),n&2){let e=k(2);st("options-grid-span2",!e.widgetConfig.numInt)}}function ib(n,o){if(n&1&&(d(0,"mat-option",57),c(1),u()),n&2){let e=o.$implicit;O("value",e.measure),g(),ge(" ",e.description," ")}}function nb(n,o){if(n&1&&(d(0,"mat-optgroup",56),xe(1,ib,2,2,"mat-option",57,Ne),u()),n&2){let e=k().$implicit;O("label",e.group),g(),Ce(e.units)}}function ab(n,o){if(n&1&&I(0,nb,3,1,"mat-optgroup",56),n&2){let e=o.$implicit,t=k(3);N(!t.widgetConfig.convertUnitToGroup||t.widgetConfig.convertUnitToGroup===""||t.widgetConfig.convertUnitToGroup===e.group?0:-1)}}function ob(n,o){if(n&1&&(d(0,"mat-form-field",24)(1,"mat-label"),c(2,"Display Units"),u(),d(3,"mat-select",55),xe(4,ab,1,1,null,null,Ne),u()()),n&2){let e=k(2);g(4),Ce(e.unitList.conversions)}}function rb(n,o){n&1&&(d(0,"mat-checkbox",25),c(1," Enable beeps on count down "),u())}function sb(n,o){if(n&1&&F(0,"display-datetime-options",26),n&2){let e=k(2);O("dateFormat",e.dateFormatToControl)("dateTimezone",e.dateTimezoneToControl)}}function lb(n,o){n&1&&(d(0,"mat-checkbox",27),c(1," Enable Advanced Compass Mode "),u())}function db(n,o){n&1&&(d(0,"mat-checkbox",28),c(1," Close-hauled Lines "),u())}function cb(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Optimal Close-hauled Angle"),u(),F(3,"input",58),u())}function ub(n,o){n&1&&(d(0,"mat-checkbox",29),c(1," Wind Sectors "),u())}function mb(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Sector Duration (sec)"),u(),F(3,"input",59),u())}function hb(n,o){n&1&&(d(0,"mat-checkbox",30),c(1," Apparent Wind Speed Value "),u())}function pb(n,o){n&1&&(d(0,"mat-checkbox",31),c(1," True Wind Speed Value "),u())}function fb(n,o){n&1&&(d(0,"mat-checkbox",32),c(1," Course Over Ground "),u())}function gb(n,o){n&1&&(d(0,"mat-checkbox",33),c(1," True Wind Angle Indicator "),u())}function vb(n,o){n&1&&(d(0,"mat-checkbox",34),c(1," Next Waypoint "),u())}function bb(n,o){n&1&&(d(0,"mat-checkbox",35),c(1," Drift "),u())}function Ab(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Minimum Value"),u(),F(3,"input",60),u())}function yb(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Maximum Value"),u(),F(3,"input",61),u())}function xb(n,o){n&1&&(d(0,"mat-checkbox",36),c(1," Ignore Zones configuration "),u())}function Cb(n,o){n&1&&(d(0,"div",62)(1,"mat-checkbox",63),c(2," Show Heeling Side Label "),u()(),d(3,"div",62)(4,"mat-checkbox",64),c(5," Reverse Angle "),u()())}function Sb(n,o){n&1&&(d(0,"div",62)(1,"mat-checkbox",67),c(2," Show Progress Bar "),u()(),d(3,"div",37)(4,"mat-checkbox",68),c(5," Show Ticks "),u()())}function wb(n,o){n&1&&(d(0,"div",62)(1,"mat-checkbox",68),c(2," Show Ticks "),u()())}function _b(n,o){if(n&1&&(d(0,"mat-form-field",62)(1,"mat-label"),c(2,"Highlights Width"),u(),F(3,"input",65),u(),d(4,"div",62)(5,"mat-checkbox",66),c(6," Show Needle Indicator "),u()(),I(7,Sb,6,0)(8,wb,3,0,"div",62)),n&2){let e=k(2);g(7),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngRadial"?7:8)}}function Mb(n,o){n&1&&(d(0,"mat-form-field",37)(1,"mat-label"),c(2,"Rotation Element"),u(),d(3,"mat-select",69)(4,"mat-option",70),c(5,"Dial (Marine Compass)"),u(),d(6,"mat-option",71),c(7,"Needle (Base plate compass)"),u()()(),d(8,"div",62)(9,"mat-checkbox",72),c(10," Show value box "),u()(),d(11,"div",62)(12,"mat-checkbox",73),c(13," Show cardinal degrees "),u()())}function kb(n,o){n&1&&(d(0,"mat-form-field",62)(1,"mat-label"),c(2,"Progress Bar Start Position"),u(),d(3,"mat-select",76)(4,"mat-option",77),c(5,"Left"),u(),d(6,"mat-option",78),c(7,"Middle"),u(),d(8,"mat-option",79),c(9,"Right"),u()()())}function Tb(n,o){n&1&&(d(0,"mat-form-field",62)(1,"mat-label"),c(2,"Progress Bar Start Angle"),u(),F(3,"input",80),u())}function Eb(n,o){if(n&1&&(d(0,"mat-form-field",62)(1,"mat-label"),c(2,"Gauge Type"),u(),d(3,"mat-select",69)(4,"mat-option",74),c(5,"Measuring"),u(),d(6,"mat-option",75),c(7,"Capacity"),u()()(),I(8,kb,10,0,"mat-form-field",62),I(9,Tb,4,0,"mat-form-field",62)),n&2){let e=k(3);g(8),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngRadial"&&Lo(2,zv).includes(e.formMaster.value.gauge.subType)?8:-1),g(),N(e.formMaster.value.gauge.subType==="capacity"?9:-1)}}function Db(n,o){if(n&1&&I(0,Mb,14,0)(1,Eb,10,3),n&2){let e=k(2);N(Lo(1,Bv).indexOf(e.formMaster.value.gauge.subType)>-1?0:Lo(2,vm).indexOf(e.formMaster.value.gauge.subType)>-1?1:-1)}}function Pb(n,o){n&1&&(d(0,"mat-form-field",37)(1,"mat-label"),c(2,"Orientation"),u(),d(3,"mat-select",81)(4,"mat-option",82),c(5,"Vertical"),u(),d(6,"mat-option",83),c(7,"Horizontal"),u()()())}function Ib(n,o){n&1&&(d(0,"mat-form-field",37)(1,"mat-label"),c(2,"Unit Label"),u(),d(3,"mat-select",84)(4,"mat-option",85),c(5,"Full Label"),u(),d(6,"mat-option",86),c(7,"First Letter Only"),u()()())}function Nb(n,o){if(n&1&&(d(0,"mat-option",57),c(1),u()),n&2){let e=o.$implicit;O("value",Li(e.value)),g(),X(e.label)}}function Rb(n,o){if(n&1&&(d(0,"mat-form-field",18)(1,"mat-label"),c(2,"Color"),u(),d(3,"mat-select",87),xe(4,Nb,2,3,"mat-option",57,Ne),u()()),n&2){let e=k(2);g(4),Ce(e.colors)}}function Ob(n,o){n&1&&(d(0,"mat-form-field",18)(1,"mat-label"),c(2,"Scale Span"),u(),d(3,"mat-select",88)(4,"mat-option",89),c(5,"1 Minute"),u(),d(6,"mat-option",90),c(7,"5 Minutes"),u(),d(8,"mat-option",91),c(9,"30 Minutes"),u()()(),d(10,"div",92)(11,"strong"),c(12,"History API:"),u(),c(13," Wind Trends can be pre-filled with historical data from the Signal K History API. "),d(14,"a",93),c(15,"Learn more"),u()())}function Vb(n,o){n&1&&(d(0,"mat-checkbox",38),c(1," Show Background Graph "),d(2,"i"),c(3,"(Too many graphs may affect performance)"),u()())}function Lb(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Suggested Scale Start"),u(),F(3,"input",94),u())}function Wb(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Suggested Scale End"),u(),F(3,"input",95),u())}function Fb(n,o){n&1&&(d(0,"mat-checkbox",39),c(1," Inverse Scale Axis "),u())}function Gb(n,o){n&1&&(d(0,"mat-checkbox",40),c(1," Vertical Data Graph "),u())}function Bb(n,o){n&1&&(d(0,"mat-checkbox",41),c(1," Disable background color "),u())}function zb(n,o){if(n&1&&(d(0,"mat-option",57),c(1),u()),n&2){let e=o.$implicit;O("value",Li(e.value)),g(),X(e.label)}}function Ub(n,o){if(n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Background Color"),u(),d(3,"mat-select",96),xe(4,zb,2,3,"mat-option",57,Ne),u()()),n&2){let e=k(2);g(4),Ce(e.colors)}}function Hb(n,o){n&1&&(Xi(0,42),d(1,"mat-form-field")(2,"mat-label"),c(3,"View Mode"),u(),d(4,"mat-select",97)(5,"mat-option",98),c(6,"North Up"),u(),d(7,"mat-option",99),c(8,"Course Up"),u()()(),d(9,"mat-form-field")(10,"mat-label"),c(11,"Fully Visible Rings Range"),u(),d(12,"mat-select",100)(13,"mat-option",101),c(14,"1 miles"),u(),d(15,"mat-option",102),c(16,"3 miles"),u(),d(17,"mat-option",103),c(18,"6 miles"),u(),d(19,"mat-option",104),c(20,"12 miles"),u(),d(21,"mat-option",105),c(22,"24 miles"),u(),d(23,"mat-option",106),c(24,"48 miles"),u()()(),d(25,"mat-checkbox",107),c(26," Plot target COG vector "),u(),d(27,"mat-form-field")(28,"mat-label"),c(29,"COG plot length (minutes)"),u(),F(30,"input",108),u(),d(31,"mat-checkbox",109),c(32," Show unconfirmed targets "),u(),d(33,"mat-checkbox",110),c(34," Show lost targets "),u(),d(35,"mat-checkbox",111),c(36," Show own ship icon "),u(),Ki())}function qb(n,o){n&1&&(d(0,"mat-form-field",62)(1,"mat-label"),c(2,"Background Style"),u(),d(3,"mat-select",124)(4,"mat-option",125),c(5,"Dark Gray"),u(),d(6,"mat-option",126),c(7,"Satin Gray"),u(),d(8,"mat-option",127),c(9,"Light Gray"),u(),d(10,"mat-option",128),c(11,"White"),u(),d(12,"mat-option",129),c(13,"Black"),u(),d(14,"mat-option",130),c(15,"Beige"),u(),d(16,"mat-option",131),c(17,"Brown"),u(),d(18,"mat-option",132),c(19,"Red"),u(),d(20,"mat-option",133),c(21,"Green"),u(),d(22,"mat-option",134),c(23,"Blue"),u(),d(24,"mat-option",120),c(25,"Anthracite"),u(),d(26,"mat-option",135),c(27,"Mud"),u(),d(28,"mat-option",136),c(29,"Punched Sheet"),u(),d(30,"mat-option",137),c(31,"Carbon"),u(),d(32,"mat-option",138),c(33,"Stainless"),u(),d(34,"mat-option",139),c(35,"Brushed Metal"),u(),d(36,"mat-option",140),c(37,"Brushed Stainless"),u(),d(38,"mat-option",141),c(39,"Turned"),u()()())}function $b(n,o){n&1&&(d(0,"div",62)(1,"mat-checkbox",142),c(2," Reverse Pitch Axis "),u()(),d(3,"div",62)(4,"mat-checkbox",143),c(5," Reverse Roll Axis "),u()(),d(6,"div",62)(7,"mat-checkbox",144),c(8," Show Frame "),u()())}function jb(n,o){if(n&1&&(I(0,qb,40,0,"mat-form-field",62),I(1,$b,9,0),d(2,"mat-form-field",62)(3,"mat-label"),c(4,"Frame Style"),u(),d(5,"mat-select",112)(6,"mat-option",113),c(7,"Black Metal"),u(),d(8,"mat-option",114),c(9,"Metal"),u(),d(10,"mat-option",115),c(11,"Shiny Metal"),u(),d(12,"mat-option",116),c(13,"Brass"),u(),d(14,"mat-option",117),c(15,"Steel"),u(),d(16,"mat-option",118),c(17,"Chrome"),u(),d(18,"mat-option",119),c(19,"Gold"),u(),d(20,"mat-option",120),c(21,"Anthracite"),u(),d(22,"mat-option",121),c(23,"Tilted Gray"),u(),d(24,"mat-option",122),c(25,"Tilted Black"),u(),d(26,"mat-option",123),c(27,"Glossy Metal"),u()()()),n&2){let e=k(2);N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)!=="horizon"?0:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="horizon"?1:-1)}}function Yb(n,o){if(n&1&&(d(0,"div",7)(1,"div",17),I(2,qv,4,0,"mat-form-field",18),I(3,$v,2,0,"mat-checkbox",19),I(4,Zv,2,1),I(5,Qv,8,0),I(6,Xv,4,0,"mat-form-field"),I(7,Kv,4,2,"mat-form-field",20),I(8,Jv,2,0,"mat-checkbox",21),I(9,eb,2,0,"mat-checkbox",22),I(10,tb,4,2,"mat-form-field",23),I(11,ob,6,0,"mat-form-field",24),I(12,rb,2,0,"mat-checkbox",25),I(13,sb,1,2,"display-datetime-options",26),I(14,lb,2,0,"mat-checkbox",27),I(15,db,2,0,"mat-checkbox",28),I(16,cb,4,0,"mat-form-field"),I(17,ub,2,0,"mat-checkbox",29),I(18,mb,4,0,"mat-form-field"),I(19,hb,2,0,"mat-checkbox",30),I(20,pb,2,0,"mat-checkbox",31),I(21,fb,2,0,"mat-checkbox",32),I(22,gb,2,0,"mat-checkbox",33),I(23,vb,2,0,"mat-checkbox",34),I(24,bb,2,0,"mat-checkbox",35),I(25,Ab,4,0,"mat-form-field"),I(26,yb,4,0,"mat-form-field"),I(27,xb,2,0,"mat-checkbox",36),I(28,Cb,6,0),I(29,_b,9,1),I(30,Db,2,3),I(31,Pb,8,0,"mat-form-field",37),I(32,Ib,8,0,"mat-form-field",37),I(33,Rb,6,0,"mat-form-field",18),I(34,Ob,16,0),I(35,Vb,4,0,"mat-checkbox",38),I(36,Lb,4,0,"mat-form-field"),I(37,Wb,4,0,"mat-form-field"),I(38,Fb,2,0,"mat-checkbox",39),I(39,Gb,2,0,"mat-checkbox",40),I(40,Bb,2,0,"mat-checkbox",41),I(41,Ub,6,0,"mat-form-field"),I(42,Hb,37,0,"ng-container",42),I(43,jb,28,2),u()()),n&2){let e=k();g(2),N((e.widgetConfig==null?null:e.widgetConfig.widgetUrl)!==void 0?2:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.allowInput)!==void 0?3:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.displayName)!==void 0?4:-1),g(),N(e.formMaster.get("displayScale")?5:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.numInt)!==void 0?6:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.numDecimal)!==void 0?7:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.showMin)!==void 0?8:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.showMax)!==void 0?9:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.nextDashboard)!==void 0?10:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.convertUnitTo)!==void 0?11:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.playBeeps)!==void 0?12:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.dateFormat)!==void 0?13:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.compassModeEnabled)!==void 0?14:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.laylineEnable)!==void 0?15:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.laylineEnable)!==void 0?16:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.windSectorEnable)!==void 0?17:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.windSectorEnable)!==void 0?18:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.awsEnable)!==void 0?19:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.twsEnable)!==void 0?20:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.courseOverGroundEnable)!==void 0?21:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.twaEnable)!==void 0?22:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.waypointEnable)!==void 0?23:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.driftEnable)!==void 0?24:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.minValue)!==void 0&&!e.formMaster.get("displayScale")?25:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.maxValue)!==void 0&&!e.formMaster.get("displayScale")?26:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.ignoreZones)!==void 0?27:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="angle"?28:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngRadial"&&Lo(42,vm).includes(e.formMaster.value.gauge.subType)||(e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngLinear"?29:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngRadial"?30:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngLinear"?31:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="simpleLinear"?32:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.color)!==void 0?33:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.timeScale)!==void 0?34:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.showMiniChart)!==void 0?35:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.yScaleMin)!==void 0?36:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.yScaleMax)!==void 0?37:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.inverseYAxis)!==void 0?38:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.verticalChart)!==void 0?39:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.noBgColor)!==void 0?40:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.bgColor)!==void 0?41:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.ais)!==void 0?42:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="steel"||(e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="horizon"?43:-1)}}function Zb(n,o){n&1&&(d(0,"mat-tab",8),F(1,"ais-target-options",42),u())}function Qb(n,o){if(n&1&&(F(0,"span",148),c(1,"\xA0Controls ")),n&2){let e=k(2);Ba(e.formMaster.controls.multiChildCtrls.valid?"display: none":"display: block")}}function Xb(n,o){if(n&1){let e=Se();d(0,"mat-tab",9)(1,"div",145)(2,"div"),bi(3,Qb,2,2,"ng-template",146),u(),d(4,"boolean-multicontrol-options",147),U("addPath",function(i){ee(e);let a=k();return te(a.addPathGroup(i))})("updatePath",function(i){ee(e);let a=k();return te(a.updatePath(i))})("delPath",function(i){ee(e);let a=k();return te(a.deletePath(i))}),u()()()}if(n&2){let e=k();g(4),O("multiCtrlArray",e.multiChildCtrlsToControl)("zonesOnlyPaths",(e.widgetConfig==null?null:e.widgetConfig.zonesOnlyPaths)??!1)}}function Kb(n,o){if(n&1&&(d(0,"span",150),c(1," error "),u(),c(2," \xA0Paths ")),n&2){let e=k(2);Ba(e.formMaster.controls.paths.valid||e.formMaster.controls.paths.disabled?"display: none":"display: block")}}function Jb(n,o){if(n&1&&(d(0,"mat-tab",10)(1,"div",145)(2,"div"),bi(3,Kb,3,2,"ng-template",146),u(),F(4,"paths-options",149),u()()),n&2){let e=k();g(4),O("isArray",e.isPathArray)("enableTimeout",e.enableTimeoutToControl)("dataTimeout",e.dataTimeoutToControl)("filterSelfPaths",e.filterSelfPathsToControl)("addPathEvent",e.addPathEvent)("delPathEvent",e.delPathEvent)("updatePathEvent",e.updatePathEvent)}}function e1(n,o){n&1&&(d(0,"p")(1,"mat-checkbox",153),c(2," Digital display "),u()())}function t1(n,o){n&1&&(d(0,"mat-form-field",18)(1,"mat-label"),c(2,"Dial Size"),u(),d(3,"mat-select",154)(4,"mat-option",155),c(5,"1/4"),u(),d(6,"mat-option",156),c(7,"1/2"),u(),d(8,"mat-option",157),c(9,"3/4"),u(),d(10,"mat-option",85),c(11,"Full"),u()()())}function i1(n,o){if(n&1&&(d(0,"mat-tab",11)(1,"div",7)(2,"mat-form-field",18)(3,"mat-label"),c(4,"Gauge Type"),u(),d(5,"mat-select",81)(6,"mat-option",151),c(7,"Linear"),u(),d(8,"mat-option",152),c(9,"Radial"),u()()(),I(10,e1,3,0,"p"),I(11,t1,12,0,"mat-form-field",18),u()()),n&2){let e=k();g(10),N(e.formMaster.value.gauge.subType==="linear"?10:-1),g(),N(e.formMaster.value.gauge.subType==="radial"?11:-1)}}function n1(n,o){n&1&&(d(0,"p")(1,"mat-checkbox",160),c(2," Value to send on button push (checked = on, unchecked = off) "),u()())}function a1(n,o){if(n&1&&(d(0,"mat-tab",12)(1,"div",145)(2,"p")(3,"mat-checkbox",158),c(4," Enable Put Requests "),u()(),d(5,"p")(6,"mat-checkbox",159),c(7," Momentary mode (instead of switching between on/off) "),u()(),I(8,n1,3,0,"p"),u()()),n&2){let e=k();g(8),N(e.formMaster.controls.putMomentary.value?8:-1)}}function o1(n,o){n&1&&F(0,"span",148)}function r1(n,o){if(n&1&&(I(0,o1,1,0,"span",148),c(1," Dataset ")),n&2){let e=k(2);N(e.formMaster.controls.datachartPath.valid?-1:0)}}function s1(n,o){if(n&1&&(d(0,"mat-tab",13),bi(1,r1,2,1,"ng-template",146),F(2,"config-dataset-chart-options",161),u()),n&2){let e=k();g(2),O("filterSelfPaths",e.filterSelfPathsToControl)("datachartPath",e.datachartPathControl)("datachartSource",e.datachartSourceControl)("convertUnitTo",e.convertUnitToControl)("timeScale",e.timeScaleControl)("period",e.periodControl)}}function l1(n,o){n&1&&(d(0,"mat-tab",14),F(1,"bms-bank-setup",162),u())}var bm=(()=>{class n{static KEY_MULTI_CHILD_CTRLS="multiChildCtrls";static KEY_DISPLAY_SCALE="displayScale";static KEY_GAUGE="gauge";static KEY_AUTOPILOT="autopilot";static KEY_PATHS="paths";static KEY_AIS="ais";static KEY_CONVERT_UNIT_TO="convertUnitTo";dialogRef=y(tn);fb=y(Vn);DatasetStreamService=y(dn);units=y(at);app=y(Di);widgetConfig=y(ti);titleDialog="Widget Options";formMaster;availableDataSets;unitList={};isPathArray=!1;addPathEvent;delPathEvent;updatePathEvent;colors=[];ngOnInit(){if(!this.widgetConfig){console.error("Widget configuration data is missing. Closing dialog."),this.dialogRef.close();return}this.availableDataSets=this.DatasetStreamService.list().sort((e,t)=>{let i=e.label||"",a=t.label||"";return i.localeCompare(a,void 0,{sensitivity:"base"})}),this.unitList=this.units.getConversionsForPath(""),this.formMaster=this.generateFormGroups(this.widgetConfig),this.colors=this.app.configurableThemeColors}isPlainObject(e){return Object.prototype.toString.call(e)==="[object Object]"}generateFormGroups(e,t){let i=this.fb.group({});return Object.keys(e).forEach(a=>{let r=e[a];if(r!==null&&(Array.isArray(r)||this.isPlainObject(r))){if(a===n.KEY_MULTI_CHILD_CTRLS){i.addControl(a,this.fb.array([]));let s=i.get(a);r.forEach(l=>{s.push(this.generateCtrlArray(l))})}else if(a===n.KEY_DISPLAY_SCALE)i.addControl(a,this.generateFormGroups(r,a));else if(a===n.KEY_GAUGE)i.addControl(a,this.generateFormGroups(r,a));else if(a===n.KEY_AUTOPILOT)i.addControl(a,this.generateFormGroups(r,a));else if(a===n.KEY_AIS)i.addControl(a,this.generateFormGroups(r,a));else if(a===n.KEY_PATHS){let s=r;if(this.widgetConfig.multiChildCtrls!==void 0){this.isPathArray=!0,i.addControl(a,this.fb.array([]));let l=i.get(a);Object.keys(s).forEach(m=>{let f=s[m];if(f){let b=this.generatePathArray(m,f);f.isPathConfigurable===!1&&b.disable(),l.push(b)}})}else{let l=this.fb.group({});Object.keys(s).forEach(m=>{let f=s[m];if(f){let b=this.generateFormGroups(f,m);f.isPathConfigurable===!1&&b.disable(),l.addControl(m,b)}}),i.addControl(a,l)}}else Array.isArray(r)?i.addControl(a,new ct(r)):i.addControl(a,this.generateFormGroups(r,a));t===n.KEY_PATHS&&i.addControl(a,this.generateFormGroups(r,a))}else if(t===n.KEY_CONVERT_UNIT_TO){let s=e[a];(s&&s.pathType=="number"||"datasetUUID"in this.widgetConfig)&&i.addControl(a,new ct(r))}else switch(a){case"path":i.addControl(a,new ct(r));break;case"datasetUUID":i.addControl(a,new ct(r,Et.required));break;case"dataTimeout":i.addControl(a,new ct(r,Et.required));break;default:i.addControl(a,new ct(r));break}}),i}generatePathArray(e,t){let i=new Zr({});return Object.keys(t).forEach(a=>{i.addControl(a,this.generatePathFields(a,t[a]))}),i}generatePathFields(e,t){let i=null;switch(e){case"path":i=new ct(t);break;case"source":i=new ct(t,Et.required);break;case"sampleTime":i=new ct(t,Et.required);break;default:i=new ct(t);break}return i}generateCtrlArray(e){let t=this.fb.group(e);return t.get("ctrlLabel").addValidators(Et.required),t}addPathGroup(e){this.addPathEvent=e}updatePath(e){e.forEach(t=>{this.formMaster.get("paths").controls.forEach(a=>{a.get("pathID").value==t.pathID&&(a.controls.description.setValue(t.ctrlLabel),a.controls.pathType.setValue(t.isNumeric?"number":"boolean"),this.updatePathEvent=e)})})}deletePath(e){let t=this.formMaster.get("paths"),i=0;t.controls.forEach(r=>{r.get("pathID").value==e.pathID?t.removeAt(i):i++}),this.formMaster.get("multiChildCtrls").removeAt(e.ctrlIndex),this.delPathEvent=e.pathID,this.formMaster.updateValueAndValidity()}get datachartPathControl(){return this.formMaster.get("datachartPath")}get datachartSourceControl(){return this.formMaster.get("datachartSource")}get convertUnitToControl(){return this.formMaster.get("convertUnitTo")}get timeScaleControl(){return this.formMaster.get("timeScale")}get periodControl(){return this.formMaster.get("period")}get datasetUUIDToControl(){return this.formMaster.get("datasetUUID")}get filterSelfPathsToControl(){return this.formMaster.get("filterSelfPaths")}get dataTimeoutToControl(){return this.formMaster.get("dataTimeout")}get enableTimeoutToControl(){return this.formMaster.get("enableTimeout")}get dateTimezoneToControl(){return this.formMaster.get("dateTimezone")}get yScaleSuggestedMaxToControl(){return this.formMaster.get("yScaleSuggestedMax")}get enableMinMaxScaleLimitToControl(){return this.formMaster.get("enableMinMaxScaleLimit")}get showDatasetMinimumValueLineToControl(){return this.formMaster.get("showDatasetMinimumValueLine")}get showDatasetMaximumValueLineToControl(){return this.formMaster.get("showDatasetMaximumValueLine")}get showDatasetAverageValueLineToControl(){return this.formMaster.get("showDatasetAverageValueLine")}get showDatasetAngleAverageValueLineToControl(){return this.formMaster.get("showDatasetAngleAverageValueLine")}get startScaleAtZeroToControl(){return this.formMaster.get("startScaleAtZero")}get showLabelToControl(){return this.formMaster.get("showLabel")}get showTimeScaleToControl(){return this.formMaster.get("showTimeScale")}get showYScaleToControl(){return this.formMaster.get("showYScale")}get yScaleSuggestedMinToControl(){return this.formMaster.get("yScaleSuggestedMin")}get yScaleMinToControl(){return this.formMaster.get("yScaleMin")}get yScaleMaxToControl(){return this.formMaster.get("yScaleMax")}get datasetAverageArrayToControl(){return this.formMaster.get("datasetAverageArray")}get trackAgainstAverageToControl(){return this.formMaster.get("trackAgainstAverage")}get showDataPointsToControl(){return this.formMaster.get("showDataPoints")}get showAverageDataToControl(){return this.formMaster.get("showAverageData")}get displayNameToControl(){return this.formMaster.get("displayName")}get numDecimalToControl(){return this.formMaster.get("numDecimal")}get verticalChartToControl(){return this.formMaster.get("verticalChart")}get inverseYAxisToControl(){return this.formMaster.get("inverseYAxis")}get colorToControl(){return this.formMaster.get("color")}get dateFormatToControl(){return this.formMaster.get("dateFormat")}get multiChildCtrlsToControl(){return this.formMaster.get("multiChildCtrls")}submitConfig(){this.dialogRef.close(this.formMaster.getRawValue())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["modal-widget-config"]],decls:22,vars:11,consts:[[3,"ngSubmit","formGroup"],["mat-dialog-title",""],[1,"widget-config-dialog-content"],[1,"tab-group-content"],["label","Display"],[1,"tab-content",3,"displayName","datasetUUID","convertUnitTo","showDataPoints","showAverageData","trackAgainstAverage","datasetAverageArray","showDatasetMinimumValueLine","showDatasetMaximumValueLine","showDatasetAverageValueLine","showDatasetAngleAverageValueLine","startScaleAtZero","showLabel","showTimeScale","showYScale","yScaleSuggestedMin","yScaleSuggestedMax","enableMinMaxScaleLimit","yScaleMin","yScaleMax","numDecimal","verticalChart","inverseYAxis","color"],["formGroupName","autopilot",1,"tab-content"],[1,"display-content","tab-content"],["label","Filter"],["label","Controls"],["label","Paths"],["label","Settings","formGroupName","gauge"],["label","Put Request"],["label","Dataset"],["label","BMS"],["type","button","mat-dialog-close","","mat-flat-button",""],["mat-flat-button","","type","submit",3,"disabled"],[1,"widget-options-grid"],[1,"options-grid-span2"],["name","allowInput","formControlName","allowInput",1,"options-grid-span2"],[3,"class"],["name","showMin","formControlName","showMin"],["name","showMax","formControlName","showMax"],[3,"options-grid-span2"],[1,"fields"],["name","playBeeps","formControlName","playBeeps"],[1,"options-grid-span2",3,"dateFormat","dateTimezone"],["name","compassModeEnabled","formControlName","compassModeEnabled",1,"fields","options-grid-span2"],["name","laylineEnable","formControlName","laylineEnable",1,"fields"],["name","windSectorEnable","formControlName","windSectorEnable"],["name","awsEnable","formControlName","awsEnable"],["name","twsEnable","formControlName","twsEnable"],["name","courseOverGroundEnable","formControlName","courseOverGroundEnable"],["name","twaEnable","formControlName","twaEnable"],["name","waypointEnable","formControlName","waypointEnable"],["name","driftEnable","formControlName","driftEnable"],["name","ignoreZones","formControlName","ignoreZones"],["formGroupName","gauge",1,"options-grid-span2"],["name","showMiniChart","formControlName","showMiniChart",1,"options-grid-span2"],["name","inverseYAxis","formControlName","inverseYAxis"],["name","verticalChart","formControlName","verticalChart"],["name","noBgColor","formControlName","noBgColor"],["formGroupName","ais"],["type","url","matInput","","placeholder","Enter URL to page/resource","name","widgetUrl","formControlName","widgetUrl"],[1,"flex-container","options-grid-span2"],[1,"panel-group"],[1,"full-width"],["matInput","","placeholder","Enter a label to display","name","displayName","formControlName","displayName"],["name","showLabel","formControlName","showLabel",1,"full-width"],["formGroupName","displayScale","appearance","outline"],["matNativeControl","","type","number","name","lower","formControlName","lower","placeholder","Enter number..."],["matInput","","type","number","name","upper","formControlName","upper","placeholder","Enter number..."],["type","number","min","1","max","5","matInput","","placeholder","Enter or select number...","name","numInt","formControlName","numInt","required",""],["type","number","min","0","max","5","matInput","","placeholder","Enter or select number...","name","numDecimal","formControlName","numDecimal","required",""],["type","number","min","0","max","99","matInput","","placeholder","Enter or select number...","name","nextDashboard","formControlName","nextDashboard"],["placeholder","Select unit","formControlName","convertUnitTo","required",""],[3,"label"],[3,"value"],["type","number","min","10","max","90","matInput","","placeholder","Select angle...","name","laylineAngle","formControlName","laylineAngle"],["type","number","min","1","max","90","matInput","","placeholder","Select or enter duration...","name","windSectorWindowSeconds","formControlName","windSectorWindowSeconds"],["matInput","","type","number","name","minValue","formControlName","minValue","placeholder","Enter or select number..."],["matInput","","type","number","name","maxValue","formControlName","maxValue","placeholder","Enter or select number..."],["formGroupName","gauge"],["name","sideLabel","formControlName","sideLabel"],["name","invertAngle","formControlName","invertAngle"],["type","number","min","0","max","25","matInput","","placeholder","Enter or select number...","name","highlightsWidth","formControlName","highlightsWidth","required",""],["name","enableNeedle","formControlName","enableNeedle"],["name","enableProgressbar","formControlName","enableProgressbar"],["name","enableTicks","formControlName","enableTicks"],["placeholder","Select Gauge Type...","formControlName","subType","name","subType"],["value","marineCompass"],["value","baseplateCompass"],["name","showValueBox","formControlName","showValueBox"],["name","compassUseNumbers","formControlName","compassUseNumbers"],["value","measuring"],["value","capacity"],["placeholder","Select start position...","formControlName","barStartPosition","name","barStartPosition"],["value","left"],["value","middle"],["value","right"],["type","number","min","1","max","360","matInput","","placeholder","Enter or select number...","name","scaleStart","formControlName","scaleStart","required",""],["placeholder","Select type...","formControlName","subType","name","subType"],["value","vertical"],["value","horizontal"],["placeholder","Select label format","formControlName","unitLabelFormat","name","unitLabelFormat"],["value","full"],["value","abr"],["placeholder","Select Color...","formControlName","color","name","color","required",""],["placeholder","Select span duration...","formControlName","timeScale","name","timeScale","required",""],["value","Last Minute"],["value","Last 5 Minutes"],["value","Last 30 Minutes"],[2,"grid-column","1 / -1","font-size","0.9em","color","var(--mat-sys-outline)"],["routerLink","/help",2,"color","var(--kip-blue-color)","cursor","pointer","text-decoration","underline"],["type","number","matInput","","placeholder","Enter or select number...","name","yScaleMin","formControlName","yScaleMin","required",""],["type","number","matInput","","placeholder","Enter or select number...","name","yScaleMax","formControlName","yScaleMax","required",""],["placeholder","Select Color...","formControlName","bgColor","name","bgColor","required",""],["placeholder","Select view mode...","formControlName","viewMode","name","viewMode","required",""],["value","north-up"],["value","course-up"],["placeholder","Select AIS range...","formControlName","rangeIndex","name","rangeIndex","required",""],["value","0"],["value","1"],["value","2"],["value","3"],["value","4"],["value","5"],["name","showCogVectors","formControlName","showCogVectors"],["type","number","min","1","max","120","matInput","","placeholder","Enter or select duration...","name","cogVectorsMinutes","formControlName","cogVectorsMinutes"],["name","showUnconfirmedTargets","formControlName","showUnconfirmedTargets"],["name","showLostTargets","formControlName","showLostTargets"],["name","showSelf","formControlName","showSelf"],["placeholder","Select style...","formControlName","faceColor","name","faceColor"],["value","blackMetal"],["value","metal"],["value","shinyMetal"],["value","brass"],["value","steel"],["value","chrome"],["value","gold"],["value","anthracite"],["value","tiltedGray"],["value","tiltedBlack"],["value","glossyMetal"],["placeholder","Select style...","formControlName","backgroundColor","name","backgroundColor"],["value","darkGray"],["value","satinGray"],["value","lightGray"],["value","white"],["value","black"],["value","beige"],["value","brown"],["value","red"],["value","green"],["value","blue"],["value","mud"],["value","punchedSheet"],["value","carbon"],["value","stainless"],["value","brushedMetal"],["value","brushedStainless"],["value","turned"],["name","invertPitch","formControlName","invertPitch"],["name","invertRoll","formControlName","invertRoll"],["name","noFrameVisible","formControlName","noFrameVisible"],[1,"tab-content"],["mat-tab-label",""],[3,"addPath","updatePath","delPath","multiCtrlArray","zonesOnlyPaths"],[1,"warning","fa","fa-exclamation-circle"],["formGroupName","paths",3,"isArray","enableTimeout","dataTimeout","filterSelfPaths","addPathEvent","delPathEvent","updatePathEvent"],[1,"warning","material-icons"],["value","linear"],["value","radial"],["formControlName","digitalMeter","name","digitalMeter"],["placeholder","Select size...","formControlName","radialSize","name","radialSize"],["value","quarter"],["value","half"],["value","three-quarter"],["formControlName","putEnable","name","putEnable"],["formControlName","putMomentary","name","putMomentary"],["formControlName","putMomentaryValue","name","putMomentaryValue"],[3,"filterSelfPaths","datachartPath","datachartSource","convertUnitTo","timeScale","period"],["formGroupName","bms",1,"tab-content"]],template:function(t,i){t&1&&(d(0,"form",0),U("ngSubmit",function(){return i.submitConfig()}),d(1,"h6",1),c(2),u(),d(3,"mat-dialog-content",2)(4,"mat-tab-group",3)(5,"mat-tab",4),I(6,Uv,1,24,"config-display-chart-options",5)(7,Hv,1,0,"select-autopilot",6)(8,Yb,44,43,"div",7),u(),I(9,Zb,2,0,"mat-tab",8),I(10,Xb,5,2,"mat-tab",9),I(11,Jb,5,7,"mat-tab",10),I(12,i1,12,2,"mat-tab",11),I(13,a1,9,1,"mat-tab",12),I(14,s1,3,6,"mat-tab",13),I(15,l1,2,0,"mat-tab",14),u()(),F(16,"mat-divider"),d(17,"mat-dialog-actions")(18,"button",15),c(19,"Cancel"),u(),d(20,"button",16),c(21," Save "),u()()()),t&2&&(O("formGroup",i.formMaster),g(2),X(i.titleDialog),g(4),N((i.widgetConfig==null?null:i.widgetConfig.datachartPath)!==void 0?6:i.widgetConfig!=null&&i.widgetConfig.autopilot?7:8),g(3),N((i.widgetConfig==null?null:i.widgetConfig.ais)!==void 0?9:-1),g(),N((i.widgetConfig==null?null:i.widgetConfig.multiChildCtrls)!==void 0?10:-1),g(),N((i.widgetConfig==null?null:i.widgetConfig.paths)!==void 0?11:-1),g(),N((i.widgetConfig==null||i.widgetConfig.gauge==null?null:i.widgetConfig.gauge.type)==="steel"?12:-1),g(),N((i.widgetConfig==null?null:i.widgetConfig.putEnable)!==void 0&&(i.widgetConfig==null?null:i.widgetConfig.multiChildCtrls)===void 0?13:-1),g(),N((i.widgetConfig==null?null:i.widgetConfig.datachartPath)!==void 0?14:-1),g(),N(i.widgetConfig!=null&&i.widgetConfig.bms?15:-1),g(5),O("disabled",!i.formMaster.valid))},dependencies:[It,$a,yt,nn,dt,Dt,Pt,On,ja,xt,pt,Ei,Xr,Ht,Mi,ki,Nn,Ti,ii,St,Ct,ni,wt,Su,yu,xu,Cu,oi,qt,on,ai,Lt,Ya,Gn,Fn,nt,At,Ku,qu,Yu,Hu,Xu,em,gm,im],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%}.widget-config-dialog-content[_ngcontent-%COMP%]{height:100%}.display-content[_ngcontent-%COMP%]{display:block;height:100%;width:100%;padding-top:15px;padding-bottom:10px}.warning[_ngcontent-%COMP%]{color:var(--mat-sys-error-container)}.tab-group-content[_ngcontent-%COMP%]{overflow:hidden;width:100%}.flex-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;margin:15px 0;gap:15px;align-items:stretch}.panel-group[_ngcontent-%COMP%]{min-width:250px;flex-grow:1}"]})}return n})();var m1=["button"],h1=["*"];function p1(n,o){if(n&1&&(d(0,"div",2),F(1,"mat-pseudo-checkbox",6),u()),n&2){let e=k();g(),O("disabled",e.disabled)}}var Am=new un("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:!1,hideMultipleSelectionIndicator:!1,disabledInteractive:!1})}),ym=new un("MatButtonToggleGroup"),f1={provide:Yr,useExisting:Er(()=>Yo),multi:!0},gs=class{source;value;constructor(o,e){this.source=o,this.value=e}},Yo=(()=>{class n{_changeDetector=y(Ci);_dir=y(Hr,{optional:!0});_multiple=!1;_disabled=!1;_disabledInteractive=!1;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck()}_name=y(pa).getId("mat-button-toggle-group-");vertical=!1;get value(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e.map(t=>t.value):e[0]?e[0].value:void 0}set value(e){this._setSelectionByValue(e),this.valueChange.emit(this.value)}valueChange=new ei;get selected(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e:e[0]||null}get multiple(){return this._multiple}set multiple(e){this._multiple=e,this._markButtonsForCheck()}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._markButtonsForCheck()}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e,this._markButtonsForCheck()}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new ei;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._markButtonsForCheck()}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(e){this._hideMultipleSelectionIndicator=e,this._markButtonsForCheck()}_hideMultipleSelectionIndicator;constructor(){let e=y(Am,{optional:!0});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??!1,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??!1}ngOnInit(){this._selectionModel=new fu(this.multiple,void 0,!1)}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(e=>e.checked)),this.multiple||this._initializeTabIndex()}writeValue(e){this.value=e,this._changeDetector.markForCheck()}registerOnChange(e){this._controlValueAccessorChangeFn=e}registerOnTouched(e){this._onTouched=e}setDisabledState(e){this.disabled=e}_keydown(e){if(this.multiple||this.disabled||Pn(e))return;let i=e.target.id,a=this._buttonToggles.toArray().findIndex(s=>s.buttonId===i),r=null;switch(e.keyCode){case 32:case 13:r=this._buttonToggles.get(a)||null;break;case 38:r=this._getNextButton(a,-1);break;case 37:r=this._getNextButton(a,this.dir==="ltr"?-1:1);break;case 40:r=this._getNextButton(a,1);break;case 39:r=this._getNextButton(a,this.dir==="ltr"?1:-1);break;default:return}r&&(e.preventDefault(),r._onButtonClick(),r.focus())}_emitChangeEvent(e){let t=new gs(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t)}_syncButtonToggle(e,t,i=!1,a=!1){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=!1),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):a=!0,a?Promise.resolve().then(()=>this._updateModelValue(e,i)):this._updateModelValue(e,i)}_isSelected(e){return this._selectionModel&&this._selectionModel.isSelected(e)}_isPrechecked(e){return typeof this._rawValue>"u"?!1:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(t=>e.value!=null&&t===e.value):e.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(e=>{e.tabIndex=-1}),this.selected)this.selected.tabIndex=0;else for(let e=0;e<this._buttonToggles.length;e++){let t=this._buttonToggles.get(e);if(!t.disabled){t.tabIndex=0;break}}}_getNextButton(e,t){let i=this._buttonToggles;for(let a=1;a<=i.length;a++){let r=(e+t*a+i.length)%i.length,s=i.get(r);if(s&&!s.disabled)return s}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(Array.isArray(e),this._clearSelection(),e.forEach(i=>this._selectValue(i,t))):(this._clearSelection(),this._selectValue(e,t)),!this.multiple&&t.every(i=>i.tabIndex===-1)){for(let i of t)if(!i.disabled){i.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(e=>{e.checked=!1,this.multiple||(e.tabIndex=-1)})}_selectValue(e,t){for(let i of t)if(i.value===e){i.checked=!0,this._selectionModel.select(i),this.multiple||(i.tabIndex=0);break}}_updateModelValue(e,t){t&&this._emitChangeEvent(e),this.valueChange.emit(this.value)}_markButtonsForCheck(){this._buttonToggles?.forEach(e=>e._markForCheck())}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Ot({type:n,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,i,a){if(t&1&&Wr(a,co,5),t&2){let r;yi(r=xi())&&(i._buttonToggles=r)}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,i){t&1&&U("keydown",function(r){return i._keydown(r)}),t&2&&(J("role",i.multiple?"group":"radiogroup")("aria-disabled",i.disabled),st("mat-button-toggle-vertical",i.vertical)("mat-button-toggle-group-appearance-standard",i.appearance==="standard"))},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",bt],value:"value",multiple:[2,"multiple","multiple",bt],disabled:[2,"disabled","disabled",bt],disabledInteractive:[2,"disabledInteractive","disabledInteractive",bt],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",bt],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",bt]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[Vo([f1,{provide:ym,useExisting:n}])]})}return n})(),co=(()=>{class n{_changeDetectorRef=y(Ci);_elementRef=y(Ke);_focusMonitor=y(_c);_idGenerator=y(pa);_animationDisabled=Ji();_checked=!1;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return`${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex()}set tabIndex(e){this._tabIndex.set(e)}_tabIndex;disableRipple=!1;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(e){this._appearance=e}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(e){e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck())}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(e){this._disabled=e}_disabled=!1;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e}_disabledInteractive;change=new ei;constructor(){y(Br).load(Nc);let e=y(ym,{optional:!0}),t=y(new gc("tabindex"),{optional:!0})||"",i=y(Am,{optional:!0});this._tabIndex=_(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=i&&i.appearance?i.appearance:"standard",this._disabledInteractive=i?.disabledInteractive??!1}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=!0:e._isSelected(this)!==this._checked&&e._syncButtonToggle(this,this._checked))}ngAfterViewInit(){this._animationDisabled||this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,!0)}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,!1,!1,!0)}focus(e){this._buttonElement.nativeElement.focus(e)}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?!0:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,!0),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let t=this.buttonToggleGroup._buttonToggles.find(i=>i.tabIndex===0);t&&(t.tabIndex=-1),this.tabIndex=0}this.change.emit(new gs(this,this.value))}_markForCheck(){this._changeDetectorRef.markForCheck()}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["mat-button-toggle"]],viewQuery:function(t,i){if(t&1&&En(m1,5),t&2){let a;yi(a=xi())&&(i._buttonElement=a.first)}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,i){t&1&&U("focus",function(){return i.focus()}),t&2&&(J("aria-label",null)("aria-labelledby",null)("id",i.id)("name",null),st("mat-button-toggle-standalone",!i.buttonToggleGroup)("mat-button-toggle-checked",i.checked)("mat-button-toggle-disabled",i.disabled)("mat-button-toggle-disabled-interactive",i.disabledInteractive)("mat-button-toggle-appearance-standard",i.appearance==="standard"))},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",bt],appearance:"appearance",checked:[2,"checked","checked",bt],disabled:[2,"disabled","disabled",bt],disabledInteractive:[2,"disabledInteractive","disabledInteractive",bt]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:h1,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(t,i){if(t&1&&(Vr(),d(0,"button",1,0),U("click",function(){return i._onButtonClick()}),I(2,p1,2,1,"div",2),d(3,"span",3),Lr(4),u()(),F(5,"span",4)(6,"span",5)),t&2){let a=Nt(1);O("id",i.buttonId)("disabled",i.disabled&&!i.disabledInteractive||null),J("role",i.isSingleSelector()?"radio":"button")("tabindex",i.disabled&&!i.disabledInteractive?-1:i.tabIndex)("aria-pressed",i.isSingleSelector()?null:i.checked)("aria-checked",i.isSingleSelector()?i.checked:null)("name",i._getButtonName())("aria-label",i.ariaLabel)("aria-labelledby",i.ariaLabelledby)("aria-disabled",i.disabled&&i.disabledInteractive?"true":null),g(2),N(i.buttonToggleGroup&&(!i.buttonToggleGroup.multiple&&!i.buttonToggleGroup.hideSingleSelectionIndicator||i.buttonToggleGroup.multiple&&!i.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),g(4),O("matRippleTrigger",a)("matRippleDisabled",i.disableRipple||i.disabled)}},dependencies:[Ic,du],styles:[`.mat-button-toggle-standalone,.mat-button-toggle-group{position:relative;display:inline-flex;flex-direction:row;white-space:nowrap;overflow:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);border-radius:var(--mat-button-toggle-legacy-shape);transform:translateZ(0)}.mat-button-toggle-standalone:not([class*=mat-elevation-z]),.mat-button-toggle-group:not([class*=mat-elevation-z]){box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}@media(forced-colors: active){.mat-button-toggle-standalone,.mat-button-toggle-group{outline:solid 1px}}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{border-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard .mat-pseudo-checkbox,.mat-button-toggle-group-appearance-standard .mat-pseudo-checkbox{--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container))}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard:not([class*=mat-elevation-z]),.mat-button-toggle-group-appearance-standard:not([class*=mat-elevation-z]){box-shadow:none}@media(forced-colors: active){.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{outline:0}}.mat-button-toggle-vertical{flex-direction:column}.mat-button-toggle-vertical .mat-button-toggle-label-content{display:block}.mat-button-toggle{white-space:nowrap;position:relative;color:var(--mat-button-toggle-legacy-text-color);font-family:var(--mat-button-toggle-legacy-label-text-font);font-size:var(--mat-button-toggle-legacy-label-text-size);line-height:var(--mat-button-toggle-legacy-label-text-line-height);font-weight:var(--mat-button-toggle-legacy-label-text-weight);letter-spacing:var(--mat-button-toggle-legacy-label-text-tracking);--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-button-toggle-legacy-selected-state-text-color)}.mat-button-toggle.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:var(--mat-button-toggle-legacy-focus-state-layer-opacity)}.mat-button-toggle .mat-icon svg{vertical-align:top}.mat-button-toggle-checkbox-wrapper{display:inline-block;justify-content:flex-start;align-items:center;width:0;height:18px;line-height:18px;overflow:hidden;box-sizing:border-box;position:absolute;top:50%;left:16px;transform:translate3d(0, -50%, 0)}[dir=rtl] .mat-button-toggle-checkbox-wrapper{left:auto;right:16px}.mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper{left:12px}[dir=rtl] .mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper{left:auto;right:12px}.mat-button-toggle-checked .mat-button-toggle-checkbox-wrapper{width:18px}.mat-button-toggle-animations-enabled .mat-button-toggle-checkbox-wrapper{transition:width 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-button-toggle-vertical .mat-button-toggle-checkbox-wrapper{transition:none}.mat-button-toggle-checked{color:var(--mat-button-toggle-legacy-selected-state-text-color);background-color:var(--mat-button-toggle-legacy-selected-state-background-color)}.mat-button-toggle-disabled{pointer-events:none;color:var(--mat-button-toggle-legacy-disabled-state-text-color);background-color:var(--mat-button-toggle-legacy-disabled-state-background-color);--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color: var(--mat-button-toggle-legacy-disabled-state-text-color)}.mat-button-toggle-disabled.mat-button-toggle-checked{background-color:var(--mat-button-toggle-legacy-disabled-selected-state-background-color)}.mat-button-toggle-disabled-interactive{pointer-events:auto}.mat-button-toggle-appearance-standard{color:var(--mat-button-toggle-text-color, var(--mat-sys-on-surface));background-color:var(--mat-button-toggle-background-color, transparent);font-family:var(--mat-button-toggle-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-toggle-label-text-size, var(--mat-sys-label-large-size));line-height:var(--mat-button-toggle-label-text-line-height, var(--mat-sys-label-large-line-height));font-weight:var(--mat-button-toggle-label-text-weight, var(--mat-sys-label-large-weight));letter-spacing:var(--mat-button-toggle-label-text-tracking, var(--mat-sys-label-large-tracking))}.mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}[dir=rtl] .mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:none;border-right:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:none;border-right:none;border-top:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-appearance-standard.mat-button-toggle-checked{color:var(--mat-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container));background-color:var(--mat-button-toggle-selected-state-background-color, var(--mat-sys-secondary-container))}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled{color:var(--mat-button-toggle-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-toggle-disabled-state-background-color, transparent)}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled .mat-pseudo-checkbox{--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color: var(--mat-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled.mat-button-toggle-checked{color:var(--mat-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-toggle-disabled-selected-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{background-color:var(--mat-button-toggle-state-layer-color, var(--mat-sys-on-surface))}.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay{opacity:var(--mat-button-toggle-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-button-toggle-appearance-standard.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:var(--mat-button-toggle-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}@media(hover: none){.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay{display:none}}.mat-button-toggle-label-content{-webkit-user-select:none;user-select:none;display:inline-block;padding:0 16px;line-height:var(--mat-button-toggle-legacy-height);position:relative}.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{padding:0 12px;line-height:var(--mat-button-toggle-height, 40px)}.mat-button-toggle-label-content>*{vertical-align:middle}.mat-button-toggle-focus-overlay{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit;pointer-events:none;opacity:0;background-color:var(--mat-button-toggle-legacy-state-layer-color)}@media(forced-colors: active){.mat-button-toggle-checked .mat-button-toggle-focus-overlay{border-bottom:solid 500px;opacity:.5;height:0}.mat-button-toggle-checked:hover .mat-button-toggle-focus-overlay{opacity:.6}.mat-button-toggle-checked.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{border-bottom:solid 500px}}.mat-button-toggle .mat-button-toggle-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-button-toggle-button{border:0;background:none;color:inherit;padding:0;margin:0;font:inherit;outline:none;width:100%;cursor:pointer}.mat-button-toggle-animations-enabled .mat-button-toggle-button{transition:padding 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-button-toggle-vertical .mat-button-toggle-button{transition:none}.mat-button-toggle-disabled .mat-button-toggle-button{cursor:default}.mat-button-toggle-button::-moz-focus-inner{border:0}.mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper){padding-left:30px}[dir=rtl] .mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper){padding-left:0;padding-right:30px}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard{--mat-focus-indicator-border-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:last-of-type .mat-button-toggle-button::before{border-top-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-bottom-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:first-of-type .mat-button-toggle-button::before{border-top-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-bottom-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:last-of-type .mat-button-toggle-button::before{border-bottom-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-bottom-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:first-of-type .mat-button-toggle-button::before{border-top-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-top-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}
44
- `],encapsulation:2,changeDetection:0})}return n})(),vs=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Qi({type:n});static \u0275inj=Yi({imports:[Rc,co,In]})}return n})();var g1="3.5.1";function Gl(n,o,e){return Math.min(Math.max(n,o),e)}function gt(n,o){let e=n.options.realtime,t=n.chart.options.plugins?.streaming;return bn(e?.[o],t?.[o])}function Bl(n,{x:o,y:e},{xAxisID:t,yAxisID:i}){let a={};for(let r=0,s=o.length;r<s;++r)a[o[r]]={axisId:t};for(let r=0,s=e.length;r<s;++r)a[e[r]]={axisId:i};return a}var v1=typeof window>"u"?fa:window.cancelAnimationFrame;function Cm(n){let o=n.frameRequestID;o&&(v1.call(window,o),delete n.frameRequestID)}function Mm(n){let o=n.refreshTimerID;o&&(clearInterval(o),delete n.refreshTimerID,delete n.refreshInterval)}function km(n,o,e){n.refreshTimerID||(n.refreshTimerID=setInterval(()=>{if(typeof document<"u"&&document.hidden)return;let t=rn(o,[],n);n.refreshInterval===t||isNaN(t)||(Mm(n),km(n,o,t))},e||0),n.refreshInterval=e||0)}function zi(n,o,e){return o=typeof o=="number"?o:n.parse(o),ga(o)?{value:n.getPixelForValue(o),transitionable:!0}:{value:e,transitionable:!1}}function b1(){let n=eo.getElement("boxAnnotation"),o=eo.getElement("lineAnnotation"),e=eo.getElement("pointAnnotation");if(!n||!o||!e)return;let t=n.prototype.resolveElementProperties,i=o.prototype.resolveElementProperties,a=e.prototype.resolveElementProperties;n.prototype.resolveElementProperties=function(r,s){return(function(l,m,f){let{scales:b,chartArea:A}=m,{xScaleID:C,yScaleID:w,xMin:M,xMax:G,yMin:E,yMax:W}=f,V=b[C],Y=b[w],{top:j,left:ye,bottom:me,right:ne}=A,re=l.$streaming={};if(V){let ce=zi(V,M,ye),oe=zi(V,G,ne),de=ce.value>oe.value;ce.transitionable&&(re[de?"x2":"x"]={axisId:C}),oe.transitionable&&(re[de?"x":"x2"]={axisId:C}),ce.transitionable!==oe.transitionable&&(re.width={axisId:C,reverse:ce.transitionable})}if(Y){let ce=zi(Y,E,j),oe=zi(Y,W,me),de=ce.value>oe.value;ce.transitionable&&(re[de?"y2":"y"]={axisId:w}),oe.transitionable&&(re[de?"y":"y2"]={axisId:w}),ce.transitionable!==oe.transitionable&&(re.height={axisId:w,reverse:ce.transitionable})}})(this,r,s),t.call(this,r,s)},o.prototype.resolveElementProperties=function(r,s){let l=r.chartArea;r.chartArea=(function(f,b,A){let{scales:C,chartArea:w}=b,{scaleID:M,value:G}=A,E=C[M],{top:W,left:V,bottom:Y,right:j}=w,ye=f.$streaming={};if(E){let ot=E.isHorizontal();return zi(E,G,0).transitionable&&(ye[ot?"x":"y"]={axisId:M},ye[ot?"x2":"y2"]={axisId:M}),ot?{top:W,bottom:Y}:{left:V,right:j}}let{xScaleID:me,yScaleID:ne,xMin:re,xMax:ce,yMin:oe,yMax:de}=A,le=C[me],ve=C[ne],ze={};if(le){let ot=zi(le,re,V),Mt=zi(le,ce,j);ot.transitionable?ye.x={axisId:me}:ze.left=V,Mt.transitionable?ye.x2={axisId:me}:ze.right=j}if(ve){let ot=zi(ve,oe,W),Mt=zi(ve,de,Y);ot.transitionable?ye.y={axisId:ne}:ze.top=W,Mt.transitionable?ye.y2={axisId:ne}:ze.bottom=Y}return ze})(this,r,s);let m=i.call(this,r,s);return r.chartArea=l,m},e.prototype.resolveElementProperties=function(r,s){return(function(l,m,f){let b=m.scales,{xScaleID:A,yScaleID:C,xValue:w,yValue:M}=f,G=b[A],E=b[C],W=l.$streaming={};G&&zi(G,w,0).transitionable&&(W.x={axisId:A}),E&&zi(E,M,0).transitionable&&(W.y={axisId:C})})(this,r,s),a.call(this,r,s)}}var A1={x:["x","caretX"],y:["y","caretY"]};function y1(...n){let o=this,e=o.getActiveElements()[0];if(e){let t=o.chart.getDatasetMeta(e.datasetIndex);o.$streaming=Bl(0,A1,t)}else o.$streaming={};o.constructor.prototype.update.call(o,...n)}var zl=new WeakMap;function Ul(n){let{originalScaleOptions:o}=(function(t){let i=zl.get(t);return i||(i={originalScaleOptions:{}},zl.set(t,i)),i})(n),e=n.scales;return sn(e,t=>{let i=t.id;o[i]||(o[i]={duration:gt(t,"duration"),delay:gt(t,"delay")})}),sn(o,(t,i)=>{e&&e[i]||delete o[i]}),o}function x1(n,o,e,t){let{chart:i}=n,a=n.id,{minDuration:r=0,maxDuration:s=1/0,minDelay:l=-1/0,maxDelay:m=1/0}=t?.[a]||{},f=n.options.realtime,b=gt(n,"duration"),A=gt(n,"delay"),C=Gl(b*(2-o),r,s),w,M;return Ul(i),w=n.isHorizontal()?(n.right-e.x)/(n.right-n.left):(n.bottom-e.y)/(n.bottom-n.top),M=A+w*(b-C),f.duration=C,f.delay=Gl(M,l,m),C!==n.max-n.min}function C1(n,o,e){let{chart:t}=n,i=n.id,{minDelay:a=-1/0,maxDelay:r=1/0}=e?.[i]||{},s=gt(n,"delay")+((n.getValueForPixel(o)||0)-(n.getValueForPixel(0)||0));return Ul(t),n.options.realtime.delay=Gl(s,a,r),!0}function S1(n,o){let e=o.$streaming;if(e.zoomPlugin!==n){let t=e.resetZoom=o.resetZoom;(function(i){i.zoomFunctions.realtime=x1,i.panFunctions.realtime=C1})(n),o.resetZoom=i=>{(function(a){let r=Ul(a);sn(a.scales,s=>{let l=s.options.realtime;if(l){let m=r[s.id];m?(l.duration=m.duration,l.delay=m.delay):(delete l.duration,delete l.delay)}})})(o),t(i)},e.zoomPlugin=n}}function w1(n){let o=n.$streaming;o.zoomPlugin&&(n.resetZoom=o.resetZoom,(function(e){zl.delete(e)})(n),delete o.resetZoom,delete o.zoomPlugin)}var Zo={millisecond:{common:!0,size:1,steps:[1,2,5,10,20,50,100,250,500]},second:{common:!0,size:1e3,steps:[1,2,5,10,15,30]},minute:{common:!0,size:6e4,steps:[1,2,5,10,15,30]},hour:{common:!0,size:36e5,steps:[1,2,3,6,12]},day:{common:!0,size:864e5,steps:[1,2,5]},week:{common:!1,size:6048e5,steps:[1,2,3,4]},month:{common:!0,size:2628e6,steps:[1,2,3]},quarter:{common:!1,size:7884e6,steps:[1,2,3,4]},year:{common:!0,size:3154e7}},Aa=Object.keys(Zo);function Sm(n,o,e){if(e){if(e.length){let{lo:t,hi:i}=wl(e,o);n[e[t]>=o?e[t]:e[i]]=!0}}else n[o]=!0}var wm=["pointBackgroundColor","pointBorderColor","pointBorderWidth","pointRadius","pointRotation","pointStyle","pointHitRadius","pointHoverBackgroundColor","pointHoverBorderColor","pointHoverBorderWidth","pointHoverRadius","backgroundColor","borderColor","borderSkipped","borderWidth","hoverBackgroundColor","hoverBorderColor","hoverBorderWidth","hoverRadius","hitRadius","radius","rotation"];function bs(n,o,e){let t=n.$streaming;if(!t)return;let i=n.$animations||{},a=e;for(let r in t){let s=t[r];if(s.axisId===o){let l=s.reverse?-a:a,m=i[r];ga(n[r])&&(n[r]-=l),m&&(m._from-=l,m._to-=l)}}}var An=class extends ln{constructor(o){super(o),this.$realtime={}}init(o,e){let t=this;super.init.call(t,o),(function(i){if(typeof console<"u"&&console.warn){let a=gt(i,"duration"),r=gt(i,"delay"),s=gt(i,"frameRate"),l=gt(i,"refresh");(typeof a!="number"||a<=0)&&console.warn("Chart streaming: duration should be a positive number"),typeof r!="number"&&console.warn("Chart streaming: delay should be a number"),(typeof s!="number"||s<=0)&&console.warn("Chart streaming: frameRate should be a positive number"),(typeof l!="number"||l<=0)&&console.warn("Chart streaming: refresh should be a positive number")}})(t),km(t.$realtime,()=>{let i=t.chart;try{let a=gt(t,"onRefresh");return typeof a=="function"&&rn(a,[i],t),(function(r){let{chart:s,id:l,max:m}=r,f=gt(r,"duration"),b=gt(r,"delay"),A=gt(r,"ttl"),C=gt(r,"pause"),w=Date.now()-(isNaN(A)?f+b:A),M,G,E,W;sn(s.data.datasets,(V,Y)=>{let j=s.getDatasetMeta(Y),ye=l===j.xAxisID?"x":l===j.yAxisID&&"y";if(ye){let me=j.controller,ne=V.data,re=ne.length;if(C){for(M=0;M<re;++M){let ce=me.getParsed&&typeof me.getParsed=="function"?me.getParsed(M):Array.isArray(ne[M])?{x:ne[M][0],y:ne[M][1]}:ne[M];if(ce&&!(ce[ye]<m))break}G=M+2}else G=0;for(M=G;M<re;++M){let ce=me.getParsed&&typeof me.getParsed=="function"?me.getParsed(M):Array.isArray(ne[M])?{x:ne[M][0],y:ne[M][1]}:ne[M];if(!(ce&&ce[ye]<=w))break}if(E=M-G,isNaN(A)&&(E=Math.max(E-2,0)),E>0){ne.splice(G,E);for(let de=0,le=wm.length;de<le;++de){let ve=wm[de];Fi(V[ve])&&V[ve].splice(G,E)}let ce=V.datalabels;if(ce)for(let de in ce)Fi(ce[de])&&ce[de].splice(G,E);typeof ne[0]!="object"&&(W={start:G,count:E});let oe=s._active;if(oe&&oe.length>0)for(let de=oe.length-1;de>=0;de--){let le=oe[de];le.datasetIndex===Y&&(le.index>=G+E?le.index-=E:le.index>=G&&oe.splice(de,1))}}}}),W&&s.data.labels?.splice(W.start,W.count)})(t),i.update("quiet"),gt(t,"refresh")}catch(a){return typeof console<"u"&&console.error&&console.error("Error in streaming refresh:",a),1e3}})}update(o,e,t){let i=this,{$realtime:a,options:r}=i,{bounds:s,offset:l,ticks:m}=r,{autoSkip:f,source:b,major:A}=m,C=A.enabled;gt(i,"pause")?Cm(a):(a.frameRequestID||(a.head=Date.now()),(function(w,M){if(!w.frameRequestID){let G=()=>{if(typeof document<"u"&&document.hidden)return void(w.frameRequestID=Go.call(window,G));let E=w.nextRefresh||0,W=Date.now();if(E<=W){let V=rn(M,[],w),Y=1e3/(Math.max(V,0)||30),j=(w.nextRefresh||0)+Y||0;w.nextRefresh=j>W?j:W+Y}w.frameRequestID=Go.call(window,G)};w.frameRequestID=Go.call(window,G)}})(a,()=>{let w=i.chart,M=w.$streaming;return(function(G){let{chart:E,id:W,$realtime:V}=G,Y=gt(G,"duration"),j=gt(G,"delay"),ye=G.isHorizontal(),me=ye?G.width:G.height,ne=Date.now(),re=E.tooltip,ce=(function(ve){let ze=ve.$streaming?.annotationPlugin;return ze?ze.getAnnotations(ve):[]})(E),oe=me*(ne-V.head)/Y;ye===!!G.options.reverse&&(oe=-oe);let de=E.data.datasets.length;for(let ve=0;ve<de;++ve){let ze=E.getDatasetMeta(ve),{data:ot=[],dataset:Mt}=ze,Yt=ot.length;for(let mi=0;mi<Yt;++mi)bs(ot[mi],W,oe);Mt&&(bs(Mt,W,oe),delete Mt._path)}let le=ce.length;for(let ve=0;ve<le;++ve)bs(ce[ve],W,oe);re&&bs(re,W,oe),G.max=ne-j,G.min=G.max-Y,V.head=ne})(i),M&&rn(M.render,[w]),gt(i,"frameRate")})),r.bounds=void 0,r.offset=!1,m.autoSkip=!1,m.source=b==="auto"?"":b,A.enabled=!0,super.update.call(i,o,e,t),r.bounds=s,r.offset=l,m.autoSkip=f,m.source=b,A.enabled=C}buildTicks(){let o=this,e=gt(o,"duration"),t=gt(o,"delay"),i=o.$realtime.head-t,a=i-e,r=[1e15,i],s=[-1e15,a];Object.defineProperty(o,"min",{get:()=>s.shift(),set:fa,configurable:!0}),Object.defineProperty(o,"max",{get:()=>r.shift(),set:fa,configurable:!0});let l=super.buildTicks.call(o);return delete o.min,delete o.max,o.min=a,o.max=i,l}calculateLabelRotation(){let o=this.options.ticks,e=o.maxRotation;o.maxRotation=o.minRotation||0,super.calculateLabelRotation.call(this),o.maxRotation=e}fit(){let o=this,e=o.options;super.fit.call(o),e.ticks.display&&e.display&&o.isHorizontal()&&(o.paddingLeft=3,o.paddingRight=3,o._handleMargins())}draw(o){let e=this,{chart:t,ctx:i}=e,a=e.isHorizontal()?{left:o.left,top:0,right:o.right,bottom:t.height}:{left:0,top:o.top,right:t.width,bottom:o.bottom};e._gridLineItems=null,e._labelItems=null,Xa(i,a),super.draw.call(e,o),Ka(i)}destroy(){let o=this.$realtime;Cm(o),Mm(o)}_generate(){let o=this,e=o._adapter,t=gt(o,"duration"),i=gt(o,"delay"),a=gt(o,"refresh"),r=o.$realtime.head-i,s=r-t,l=o._getLabelCapacity(s),{time:m,ticks:f}=o.options,b=m.unit||(function(me,ne,re,ce){let oe=re-ne,de=Aa.length;for(let le=Aa.indexOf(me);le<de-1;++le){let ve=Aa[le],ze=Zo[ve];if(!ze)continue;let{common:ot,size:Mt,steps:Yt}=ze,mi=Yt?Yt[Yt.length-1]:Number.MAX_SAFE_INTEGER;if(ot&&Math.ceil(oe/(mi*Mt))<=ce)return ve}return Aa[de-1]})(m.minUnit,s,r,l),A=(function(me){for(let ne=Aa.indexOf(me)+1,re=Aa.length;ne<re;++ne){let ce=Aa[ne];if(Zo[ce]?.common)return ce}})(b),C=m.stepSize||(function(me,ne,re,ce){let oe=ne-me,de=Zo[re];if(!de)return 1;let{size:le,steps:ve}=de,ze=1;if(!ve)return Math.ceil(oe/(ce*le));for(let ot=0,Mt=ve.length;ot<Mt&&(ze=ve[ot],!(Math.ceil(oe/(le*ze))<=ce));++ot);return ze||1})(s,r,b,l),w=b==="week"&&m.isoWeekday,M=f.major.enabled,G=Qa(w)||w===!0,E=Zo[b],W={},V,Y,j=s;if(G&&(j=+e.startOf(j,"isoWeek",w)),j=+e.startOf(j,G?"day":b),e.diff(r,s,b)>1e5*C)throw new Error(s+" and "+r+" are too far apart with stepSize of "+C+" "+b);V=j,M&&A&&!G&&!m.round&&(V=+e.startOf(V,A),V=+e.add(V,~~((j-V)/(E.size*C))*C,b));let ye=f.source==="data"&&o.getDataTimestamps();for(Y=0;V<r+a;V=+e.add(V,C,b),Y++)Sm(W,V,ye);return V!==r+a&&Y!==1||Sm(W,V,ye),Object.keys(W).sort((me,ne)=>+me-+ne).map(me=>+me)}};An.id="realtime",An.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},realtime:{},ticks:{autoSkip:!1,source:"auto",major:{enabled:!0}}},Bo.describe("scale.realtime",{_scriptable:n=>n!=="onRefresh"});var _1=g1;Bo.set("transitions",{quiet:{animation:{duration:0}}});var _m={x:["x","cp1x","cp2x"],y:["y","cp1y","cp2y"]};function M1(n){let o=this;n==="quiet"&&sn(o.data.datasets,(e,t)=>{let i=o.getDatasetMeta(t).controller;i&&(i._setStyle=function(a,r,s,l){_u.prototype._setStyle.call(this,a,r,"quiet",l)})}),vt.prototype.update.call(o,n),n==="quiet"&&sn(o.data.datasets,(e,t)=>{let i=o.getDatasetMeta(t).controller;i&&delete i._setStyle})}function k1(n){let o=n.$streaming;n.render(),o.lastMouseEvent&&setTimeout(()=>{let e=o.lastMouseEvent;e&&n._eventHandler(e)},0)}var T1={id:"streaming",version:_1,beforeInit(n){let o=n.$streaming=n.$streaming||{render:k1},e=o.canvas=n.canvas,t=o.mouseEventListener=i=>{let a=kl(i,n);o.lastMouseEvent={type:"mousemove",chart:n,native:i,x:a.x,y:a.y}};if(e.addEventListener("mousedown",t),e.addEventListener("mouseup",t),typeof document<"u"&&document.addEventListener){let i=()=>{if(!document.hidden){let a=n.scales;a&&Object.keys(a).forEach(r=>{let s=a[r];s&&s instanceof An&&s.$realtime&&(s.$realtime.head=Date.now())})}};document.addEventListener("visibilitychange",i),o.visibilityChangeListener=i}},afterInit(n){n.update=M1},beforeUpdate(n){let{scales:o,elements:e}=n.options,t=n.tooltip;o&&sn(o,i=>{i?.type==="realtime"&&e&&(e.line.capBezierPoints=!1)}),t&&(t.update=y1);try{let i=eo.getPlugin("annotation");i&&(function(a,r){let s=r.$streaming;if(s.annotationPlugin!==a){let l=a.afterUpdate;b1(),s.annotationPlugin=a,a.afterUpdate=function(m,f,b){let A=f.mode,C=b.animation;A==="quiet"&&(b.animation=!1),l.call(this,m,f,b),A==="quiet"&&(b.animation=C)}}})(i,n)}catch(i){(function(a){delete a.$streaming.annotationPlugin})(n)}try{let i=eo.getPlugin("zoom");i&&S1(i,n)}catch(i){w1(n)}},beforeDatasetUpdate(n,o){let{meta:e,mode:t}=o;if(t==="quiet"){let{controller:i,$animations:a}=e;a&&a.visible&&a.visible._active&&(i.updateElement=fa,i.updateSharedOptions=fa)}},afterDatasetUpdate(n,o){let{meta:e,mode:t}=o,{data:i=[],dataset:a,controller:r}=e;for(let s=0,l=i.length;s<l;++s)i[s].$streaming=Bl(i[s],_m,e);a&&(a.$streaming=Bl(0,_m,e)),t==="quiet"&&(delete r.updateElement,delete r.updateSharedOptions)},beforeDatasetDraw(n,o){let{ctx:e,chartArea:t,width:i,height:a}=n,{xAxisID:r,yAxisID:s,controller:l}=o.meta,m={left:0,top:0,right:i,bottom:a};r&&l.getScaleForId(r)instanceof An&&(m.left=t.left,m.right=t.right),s&&l.getScaleForId(s)instanceof An&&(m.top=t.top,m.bottom=t.bottom),Xa(e,m)},afterDatasetDraw(n){Ka(n.ctx)},beforeEvent(n,o){let e=n.$streaming,t=o.event;t?.type==="mousemove"?e.lastMouseEvent=t:t?.type==="mouseout"&&delete e.lastMouseEvent},afterDestroy(n){let{scales:o,tooltip:e}=n,t=n.$streaming,{canvas:i,mouseEventListener:a,visibilityChangeListener:r}=t;delete n.update,e&&delete e.update,i.removeEventListener("mousedown",a),i.removeEventListener("mouseup",a),r&&typeof document<"u"&&document.removeEventListener&&document.removeEventListener("visibilitychange",r),sn(o,s=>{s instanceof An&&s.destroy()})},defaults:{duration:1e4,delay:0,frameRate:30,refresh:1e3,onRefresh:null,pause:!1,ttl:void 0},descriptors:{_scriptable:n=>n!=="onRefresh"}},ya=[T1,An];vt.register(ya);var E1=["widgetDataChart"];vt.register(ya,ln,jn,Un,$n,qn,to,Eu);var As=(()=>{class n{theme=x.required();color=null;dataPath=null;dataSource=null;convertUnitTo=null;numDecimal=null;yScaleMin=null;yScaleMax=null;inverseYAxis=!1;verticalChart=null;datasetUUID=null;unitsService=y(at);dsService=y(dn);ngZone=y(Be);canvasService=y(mt);widgetDataChart=pe("widgetDataChart",{read:Ke});lineChartData={datasets:[]};lineChartOptions={parsing:!1,datasets:{line:{pointRadius:0,pointHoverRadius:0,tension:.4}},animations:{tension:{easing:"easeInOutCubic"}}};lineChartType="line";chart;dsServiceSub=null;datasetConfig=null;dataSourceInfo=null;isDestroyed=!1;lastChartSignature=null;config={datasetAverageArray:"sma",showAverageData:!1,trackAgainstAverage:!1,startScaleAtZero:!1,yScaleSuggestedMin:null,yScaleSuggestedMax:null,enableMinMaxScaleLimit:!1};constructor(){L(()=>{this.theme()&&B(()=>{this.datasetConfig&&(this.setChartOptions(),this.setDatasetsColors())})})}startChart(){if(!(this.isDestroyed||!this.datasetUUID)&&(this.datasetConfig=this.dsService.getDatasetConfig(this.datasetUUID),this.dataSourceInfo=this.dsService.getDataSourceInfo(this.datasetUUID),this.datasetConfig)){let e=this.buildChartSignature();if(this.chart&&e===this.lastChartSignature)return;this.chart&&e!==this.lastChartSignature&&this.destroyChart(),this.setChartOptions(),this.createDatasets();let i=this.widgetDataChart()?.nativeElement?.getContext("2d");if(!i)return;this.chart=new vt(i,{type:this.lineChartType,data:this.lineChartData,options:this.lineChartOptions}),this.lastChartSignature=e,this.startStreaming()}}buildChartSignature(){return[this.datasetUUID,this.dataPath,this.dataSource,this.convertUnitTo,this.numDecimal,this.yScaleMin,this.yScaleMax,this.inverseYAxis?"1":"0",this.verticalChart?"1":"0",this.color].join("|")}setChartOptions(){this.lineChartOptions.maintainAspectRatio=!1,this.lineChartOptions.animation=!1,this.lineChartOptions.indexAxis=this.verticalChart?"y":"x",this.verticalChart?this.lineChartOptions.scales={x:{display:!1,position:"right",suggestedMin:this.config.enableMinMaxScaleLimit?null:this.yScaleMin,suggestedMax:this.config.enableMinMaxScaleLimit?null:this.yScaleMax,min:this.config.enableMinMaxScaleLimit?this.yScaleMin:null,max:this.config.enableMinMaxScaleLimit?this.yScaleMax:null,beginAtZero:this.config.startScaleAtZero,reverse:this.inverseYAxis,title:{display:!1,text:"Value Axis",align:"center"},ticks:{maxTicksLimit:8,precision:this.numDecimal,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!1,color:this.theme().contrastDimmer}},y:{type:"realtime",display:!1,title:{display:!1},time:{unit:this.datasetConfig.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:!1,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!1,color:this.theme().contrastDimmer}}}:this.lineChartOptions.scales={x:{type:"realtime",display:!1,title:{display:!1},time:{unit:this.datasetConfig.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:!1,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!1,color:this.theme().contrastDimmer}},y:{display:!1,position:"right",suggestedMin:this.config.enableMinMaxScaleLimit?null:this.yScaleMin,suggestedMax:this.config.enableMinMaxScaleLimit?null:this.yScaleMax,min:this.config.enableMinMaxScaleLimit?this.yScaleMin:null,max:this.config.enableMinMaxScaleLimit?this.yScaleMax:null,beginAtZero:this.config.startScaleAtZero,reverse:this.inverseYAxis,title:{display:!1,text:"Value Axis",align:"center"},ticks:{maxTicksLimit:8,precision:this.numDecimal,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!1,color:this.theme().contrastDimmer}}},this.lineChartOptions.plugins={legend:{display:!1},streaming:{duration:this.dataSourceInfo.maxDataPoints*this.dataSourceInfo.sampleTime,delay:this.dataSourceInfo.sampleTime,frameRate:this.datasetConfig.timeScaleFormat==="day"?5:this.datasetConfig.timeScaleFormat==="hour"?8:this.datasetConfig.timeScaleFormat==="minute"?15:30}}}createDatasets(){let e=this.lineChartOptions.scales?.y?.reverse?"start":!0;this.lineChartData.datasets=[],this.lineChartData.datasets.push({label:"Value",data:[],order:0,parsing:!1,tension:.4,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:3,fill:e}),this.lineChartData.datasets.push({label:"Average",data:[],order:1,parsing:!1,tension:.4,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:3,fill:e}),this.setDatasetsColors()}setDatasetsColors(){this.lineChartData.datasets.forEach(e=>{e.borderColor=this.getThemeColors().averageLine,e.backgroundColor=this.getThemeColors().averageFill})}getThemeColors(){let e=this.color,t={valueLine:null,valueFill:null,averageLine:null,averageFill:null,averageChartLine:null,chartLabel:null,chartValue:null};switch(e){case"contrast":this.config.trackAgainstAverage?(t.valueLine=this.theme().contrastDimmer,t.valueFill=this.theme().contrastDimmer,t.averageLine=this.theme().contrast,t.averageFill=this.theme().contrast,t.chartValue=t.averageLine):(t.valueLine=this.theme().contrast,t.valueFill=this.theme().contrast,t.averageLine=this.theme().contrastDimmer,t.averageFill=this.theme().contrastDimmer,t.chartValue=this.theme().contrast),t.averageChartLine=this.theme().contrastDim,t.chartLabel=this.theme().contrastDim;break;case"blue":this.config.trackAgainstAverage?(t.valueLine=this.theme().blueDimmer,t.valueFill=this.theme().blueDimmer,t.averageLine=this.theme().blue,t.averageFill=this.theme().blue,t.chartValue=t.averageLine):(t.valueLine=this.theme().blue,t.valueFill=this.theme().blue,t.averageLine=this.theme().blueDimmer,t.averageFill=this.theme().blueDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().blueDim,t.chartLabel=this.theme().contrastDim;break;case"green":this.config.trackAgainstAverage?(t.valueLine=this.theme().greenDimmer,t.valueFill=this.theme().greenDimmer,t.averageLine=this.theme().green,t.averageFill=this.theme().green,t.chartValue=t.averageLine):(t.valueLine=this.theme().green,t.valueFill=this.theme().green,t.averageLine=this.theme().greenDimmer,t.averageFill=this.theme().greenDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().greenDim,t.chartLabel=this.theme().contrastDim;break;case"pink":this.config.trackAgainstAverage?(t.valueLine=this.theme().pinkDimmer,t.valueFill=this.theme().pinkDimmer,t.averageLine=this.theme().pink,t.averageFill=this.theme().pink,t.chartValue=t.averageLine):(t.valueLine=this.theme().pink,t.valueFill=this.theme().pink,t.averageLine=this.theme().pinkDimmer,t.averageFill=this.theme().pinkDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().pinkDim,t.chartLabel=this.theme().contrastDim;break;case"orange":this.config.trackAgainstAverage?(t.valueLine=this.theme().orangeDimmer,t.valueFill=this.theme().orangeDimmer,t.averageLine=this.theme().orange,t.averageFill=this.theme().orange,t.chartValue=t.averageLine):(t.valueLine=this.theme().orange,t.valueFill=this.theme().orange,t.averageLine=this.theme().orangeDimmer,t.averageFill=this.theme().orangeDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().orangeDim,t.chartLabel=this.theme().contrastDim;break;case"purple":this.config.trackAgainstAverage?(t.valueLine=this.theme().purpleDimmer,t.valueFill=this.theme().purpleDimmer,t.averageLine=this.theme().purple,t.averageFill=this.theme().purple,t.chartValue=t.averageLine):(t.valueLine=this.theme().purple,t.valueFill=this.theme().purple,t.averageLine=this.theme().purpleDimmer,t.averageFill=this.theme().purpleDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().purpleDim,t.chartLabel=this.theme().contrastDim;break;case"grey":this.config.trackAgainstAverage?(t.valueLine=this.theme().greyDimmer,t.valueFill=this.theme().greyDimmer,t.averageLine=this.theme().grey,t.averageFill=this.theme().grey,t.chartValue=t.averageLine):(t.valueLine=this.theme().grey,t.valueFill=this.theme().grey,t.averageLine=this.theme().greyDimmer,t.averageFill=this.theme().greyDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().greyDim,t.chartLabel=this.theme().contrastDim;break;case"yellow":this.config.trackAgainstAverage?(t.valueLine=this.theme().yellowDimmer,t.valueFill=this.theme().yellowDimmer,t.averageLine=this.theme().yellow,t.averageFill=this.theme().yellow,t.chartValue=t.averageLine):(t.valueLine=this.theme().yellow,t.valueFill=this.theme().yellow,t.averageLine=this.theme().yellowDimmer,t.averageFill=this.theme().yellowDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().yellowDim,t.chartLabel=this.theme().contrastDim;break}return t}startStreaming(){this.dsServiceSub?.unsubscribe();let e=this.dsService.getDatasetBatchThenLiveObservable(this.datasetUUID);this.dsServiceSub=e?.subscribe(t=>{if(!(this.isDestroyed||!this.chart||!this.chart.ctx)){if(Array.isArray(t)){let a=this.transformDatasetRows(t,0);if(this.chart.data.datasets[0].data.push(...a),this.config.showAverageData){let r=this.transformDatasetRows(t,this.config.datasetAverageArray);this.chart.data.datasets[1].data.push(...r)}}else{let a=this.transformDatasetRows([t],0)[0];if(this.chart.data.datasets[0].data.push(a),this.config.showAverageData){let r=this.transformDatasetRows([t],this.config.datasetAverageArray)[0];this.chart.data.datasets[1].data.push(r)}}this.ngZone.runOutsideAngular(()=>{if(this.isDestroyed||!this.chart)return;let a=this.chart;a.ctx&&a.update("none")})}})}destroyChart(){this.dsServiceSub?.unsubscribe(),this.dsServiceSub=null,this.chart?.destroy(),this.chart=null,this.lastChartSignature=null}transformDatasetRows(e,t){let i=s=>this.unitsService.convertToUnit(this.convertUnitTo,s),a=this.verticalChart,r=this.config.datasetAverageArray;return e.map(s=>{if(a){if(t===0)return{x:i(s.data.value),y:s.timestamp};{let l={sma:s.data.sma,ema:s.data.ema,dema:s.data.doubleEma,avg:s.data.lastAverage};return{x:i(l[r]),y:s.timestamp}}}else{if(t===0)return{x:s.timestamp,y:i(s.data.value)};{let l={sma:s.data.sma,ema:s.data.ema,dema:s.data.doubleEma,avg:s.data.lastAverage};return{x:s.timestamp,y:i(l[r])}}}})}ngOnDestroy(){this.isDestroyed=!0,this.destroyChart();let e=this.widgetDataChart?.()?.nativeElement;this.canvasService.releaseCanvas(e,{clear:!0,removeFromDom:!0})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["minichart"]],viewQuery:function(t,i){t&1&&Me(i.widgetDataChart,E1,5,Ke),t&2&&ke()},inputs:{theme:[1,"theme"]},decls:2,vars:0,consts:[["widgetDataChart",""],[2,"z-index","inherit"]],template:function(t,i){t&1&&Q(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:calc(90% - 10px);position:absolute;bottom:0;border-radius:12px;overflow:hidden}"]})}return n})();var Le=(()=>{class n{_streamsConfig=_(void 0);dataService=y(Wt);unitsService=y(at);destroyRef=y(Ze);streams;registrations=[];subscriptions=new Map;baseSignatures=new Map;reset$=new zt;rootSignature;buildObserver(e,t){return{next:i=>t(i),error:i=>console.error("[Widget] Observer got an error: "+i),complete:()=>{}}}computePathSignature(e){let t=this.normalizePath(e.path)??"",i=e.source?.trim()||"default";return[t,e.pathType,e.sampleTime,e.convertUnitTo,i,e.suppressBootstrapNull?"1":"0"].join("|")}computeBaseKey(e,t){let i=this.normalizePath(e)??"",a=t?.trim()||"default";return`${i}|${a}`}normalizePath(e){if(typeof e!="string")return;let t=e.trim();return t.length?t:void 0}computeRootSignature(e){return e?`timeout:${e.enableTimeout?"1":"0"}:${e.dataTimeout??""}`:"none"}ensureStreamsMap(){this.streams||(this.streams=new Map)}buildAndSubscribe(e,t,i,a){let r=this.normalizePath(a.path);if(!r){let de=this.subscriptions.get(e);de&&de.sub.unsubscribe(),this.subscriptions.delete(e),this.streams?.delete(e),this.baseSignatures.delete(e);return}this.ensureStreamsMap();let s=this.computeBaseKey(r,a.source),l=this.baseSignatures.get(e);(!this.streams.has(e)||l!==s)&&(this.streams.set(e,this.dataService.subscribePath(r,a.source?.trim()||"default")),this.baseSignatures.set(e,s));let m=this.streams.get(e),f=!!i.enableTimeout,b=(i.dataTimeout??5)*1e3,A=5e3,C=`[Widget] ${i.displayName} - ${b/1e3} second data update timeout reached for `,w=`[Widget] ${i.displayName} - Retrying in ${A/1e3} seconds`,M=a.pathType,G=a.convertUnitTo,E=!!a.suppressBootstrapNull,W=Number(a.sampleTime);(!Number.isFinite(W)||W<=0)&&(W=1e3);let V=de=>G?this.unitsService.convertToUnit(G,de):de,Y=m;M==="number"&&(Y=Y.pipe(Zt(de=>({data:{value:de.data.value==null?null:V(de.data.value),timestamp:de.data.timestamp},state:de.state})))),E&&(Y=Y.pipe(rc(de=>de?.data?.value==null)));let j=Y.pipe(Jt(1)),ye=Y.pipe(oc(W));Y=gi(j,ye),f&&(Y=Y.pipe(Kd({each:b,with:()=>Xd(()=>{console.log(C+r),this.dataService.timeoutPathObservable(r,M)})}),ac(de=>de.pipe(Tr(()=>console.log(w)),ic(()=>ca(A))))));let me=this.buildObserver(e,t),ne=Y.pipe(kr(this.reset$),$e(this.destroyRef)).subscribe(me),re=fe(ae({},a),{path:r}),ce=this.computePathSignature(re),oe=this.subscriptions.get(e);oe&&oe.sub.unsubscribe(),this.subscriptions.set(e,{sub:ne,signature:ce})}setStreamsConfig(e){this._streamsConfig.set(e),this.rootSignature=this.computeRootSignature(e)}applyStreamsConfigDiff(e){let t=this._streamsConfig(),i=this.rootSignature,a=this.computeRootSignature(e);if(this._streamsConfig.set(e),this.rootSignature=a,!t||!t.paths||!Object.keys(t.paths).length)return;if(!e||!e.paths){this.subscriptions.forEach(f=>f.sub.unsubscribe()),this.subscriptions.clear(),this.streams=void 0,this.baseSignatures.clear(),this.registrations=[];return}let r=Object.keys(t.paths),s=Object.keys(e.paths),l=r.filter(f=>!s.includes(f));for(let f of l){let b=this.subscriptions.get(f);b&&b.sub.unsubscribe(),this.subscriptions.delete(f),this.streams?.delete(f),this.baseSignatures.delete(f),this.registrations=this.registrations.filter(A=>A.pathName!==f)}let m=i!==a;for(let f of s){let b=e.paths[f],A=this.normalizePath(b?.path);if(!A){let G=this.subscriptions.get(f);G&&G.sub.unsubscribe(),this.subscriptions.delete(f),this.streams?.delete(f),this.baseSignatures.delete(f);continue}let C=fe(ae({},b),{path:A}),w=this.computePathSignature(C),M=this.subscriptions.get(f);if(!M||M.signature!==w||m){M&&(M.sub.unsubscribe(),this.subscriptions.delete(f));let G=this.registrations.find(E=>E.pathName===f);G&&this.buildAndSubscribe(f,G.next,e,C)}}}observe(e,t){let i=this.registrations.find(b=>b.pathName===e)?.next;this.registrations=this.registrations.filter(b=>b.pathName!==e),this.registrations.push({pathName:e,next:t});let a=this._streamsConfig();if(!a||!a.paths?.[e]){let b=this.subscriptions.get(e);b&&(b.sub.unsubscribe(),this.subscriptions.delete(e),this.streams?.delete(e),this.baseSignatures.delete(e));return}let r=a.paths[e],s=this.normalizePath(r?.path);if(!s){let b=this.subscriptions.get(e);b&&(b.sub.unsubscribe(),this.subscriptions.delete(e),this.streams?.delete(e),this.baseSignatures.delete(e)),this.registrations=this.registrations.filter(A=>A.pathName!==e);return}let l=fe(ae({},r),{path:s}),m=this.computePathSignature(l),f=this.subscriptions.get(e);f&&f.signature===m&&i===t||this.buildAndSubscribe(e,t,a,l)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Ot({type:n,selectors:[["","widget-streams",""]],exportAs:["widgetStreams"]})}return n})();function Te(n,o){return{contrast:{color:o.contrast,dim:o.contrastDim,dimmer:o.contrastDimmer},blue:{color:o.blue,dim:o.blueDim,dimmer:o.blueDimmer},green:{color:o.green,dim:o.greenDim,dimmer:o.greenDimmer},pink:{color:o.pink,dim:o.pinkDim,dimmer:o.pinkDimmer},orange:{color:o.orange,dim:o.orangeDim,dimmer:o.orangeDimmer},purple:{color:o.purple,dim:o.purpleDim,dimmer:o.purpleDimmer},yellow:{color:o.yellow,dim:o.yellowDim,dimmer:o.yellowDimmer},grey:{color:o.grey,dim:o.greyDim,dimmer:o.greyDimmer}}[n]}var P1=["canvasMainRef"];function I1(n,o){if(n&1&&F(0,"minichart",1),n&2){let e=k();O("theme",e.theme())}}var Tm=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Gauge Label",filterSelfPaths:!0,paths:{numericPath:{description:"Numeric Data",path:null,source:null,pathType:"number",suppressBootstrapNull:!0,isPathConfigurable:!0,convertUnitTo:"unitless",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500}},showMax:!1,showMin:!1,numDecimal:1,showMiniChart:!1,yScaleMin:0,yScaleMax:10,inverseYAxis:!1,verticalChart:!1,color:"contrast",enableTimeout:!1,dataTimeout:5,ignoreZones:!1};runtime=y(we);stream=y(Le);canvas=y(mt);datasetLifecycle=y(oo);miniChart=pe(As);canvasMainRef=pe.required("canvasMainRef");showMiniChart=_(!1);labelColor=_(void 0);canvasElement;canvasCtx;cssWidth=0;cssHeight=0;backgroundBitmap=null;backgroundBitmapText=null;dataValue=null;maxValue=null;minValue=null;valueColor=void 0;valueStateColor=void 0;maxValueTextWidth=0;maxValueTextHeight=0;maxMinMaxTextWidth=0;maxMinMaxTextHeight=0;streamRegistered=!1;pathDataState=null;isDestroyed=!1;lastSubscriptionSignature=null;subscriptionSignature=K(()=>{let t=this.runtime?.options()?.paths?.numericPath;if(!t?.path)return null;let i=t.source?.trim()||"default";return[t.path,t.pathType,t.sampleTime,t.convertUnitTo,i,t.suppressBootstrapNull?"1":"0"].join("|")});onNumericValue=e=>{if(this.dataValue=e.data.value,this.minValue===null||this.dataValue<this.minValue?this.minValue=this.dataValue:(this.maxValue===null||this.dataValue>this.maxValue)&&(this.maxValue=this.dataValue),!this.runtime?.options().ignoreZones&&this.pathDataState!==e.state)switch(this.pathDataState=e.state,e.state){case Ae.Alarm:this.valueStateColor=this.theme().zoneAlarm;break;case Ae.Warn:this.valueStateColor=this.theme().zoneWarn;break;case Ae.Alert:this.valueStateColor=this.theme().zoneAlert;break;default:this.valueStateColor=this.valueColor;break}this.drawWidget()};constructor(){this.showMiniChart.set(this.runtime.options().showMiniChart),L(()=>{let e=this.theme(),t=this.runtime?.options()?.color;B(()=>{e&&t!==void 0&&(this.setColors(),this.drawWidget())})}),L(()=>{let e=this.subscriptionSignature();B(()=>{this.isDestroyed||!this.canvasCtx||e===this.lastSubscriptionSignature&&this.streamRegistered||(this.minValue=null,this.maxValue=null,this.dataValue=null,this.pathDataState=null,this.lastSubscriptionSignature=e,e&&(this.stream?.observe("numericPath",this.onNumericValue),this.streamRegistered=!0,this.manageDatasetAndChart()))})}),L(()=>{let e=this.showMiniChart(),t=this.miniChart(),i=this.runtime?.options(),a=i?.paths?.numericPath;[i?.showMiniChart?"1":"0",a?.path??"",a?.source??"default",a?.convertUnitTo??"",i?.numDecimal??"",i?.yScaleMin??"",i?.yScaleMax??"",i?.inverseYAxis?"1":"0",i?.verticalChart?"1":"0",i?.color??""].join("|")&&e&&t&&(this.setMiniChart(),this.miniChart().startChart())})}ngOnInit(){this.setColors(),this.canvasElement=this.canvasMainRef().nativeElement,this.canvasCtx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.calculateMaxMinTextDimensions(),this.drawWidget()}})}ngAfterViewInit(){this.isDestroyed||!this.streamRegistered&&this.subscriptionSignature()&&(this.stream?.observe("numericPath",this.onNumericValue),this.streamRegistered=!0,this.manageDatasetAndChart())}calculateMaxMinTextDimensions(){this.maxValueTextWidth=Math.floor(this.cssWidth*.85),this.maxValueTextHeight=Math.floor(this.cssHeight*.7),this.maxMinMaxTextWidth=Math.floor(this.cssWidth*.57),this.maxMinMaxTextHeight=Math.floor(this.cssHeight*.1)}manageDatasetAndChart(){let e=this.runtime.options(),t=e.paths.numericPath,i=!!e.showMiniChart;if(this.showMiniChart.set(i),!i){this.datasetLifecycle.removeDatasetIfExists(this.id(),!1);return}if(!t||!t.path)return;let a=t.source??"default";this.datasetLifecycle.syncNumericMiniChartDataset(this.id(),t.path,a)}setMiniChart(){let e=this.runtime.options(),t=e.paths.numericPath;this.miniChart().dataPath=t?.path??null,this.miniChart().dataSource=t?.source??"default",this.miniChart().color=e.color,this.miniChart().convertUnitTo=t?.convertUnitTo,this.miniChart().numDecimal=e.numDecimal,this.miniChart().yScaleMin=e.yScaleMin,this.miniChart().yScaleMax=e.yScaleMax,this.miniChart().inverseYAxis=e.inverseYAxis,this.miniChart().verticalChart=e.verticalChart,this.miniChart().datasetUUID=this.id()}setColors(){let e=this.runtime.options();e&&(this.labelColor.set(Te(e.color,this.theme()).dim),this.valueStateColor=this.valueColor=Te(e.color,this.theme()).color,this.backgroundBitmap=null,this.backgroundBitmapText=null)}drawWidget(){if(!this.canvasCtx)return;let e=this.runtime.options();if(!e)return;let t=e.paths.numericPath.convertUnitTo,i=10*this.canvas.scaleFactor,a=5*this.canvas.scaleFactor,r=e.displayName+"|"+t;(!this.backgroundBitmap||this.backgroundBitmap.width!==this.canvasElement.width||this.backgroundBitmap.height!==this.canvasElement.height||this.backgroundBitmapText!==r)&&(this.backgroundBitmap=this.canvas.renderStaticToBitmap(this.canvasCtx,this.cssWidth,this.cssHeight,s=>{this.canvas.drawTitleInternal(s,e.displayName,this.labelColor(),"normal",this.cssWidth,this.cssHeight,.1),["unitless","percent","ratio","latitudeSec","latitudeMin","longitudeSec","longitudeMin"].includes(t)||this.canvas.drawText(s,t,this.cssWidth-i,this.cssHeight-a,Math.floor(this.cssWidth*.25),Math.floor(this.cssHeight*.15),"bold",this.valueColor,"end","bottom")}),this.backgroundBitmapText=r),this.canvas.clearCanvas(this.canvasCtx,this.cssWidth,this.cssHeight),this.backgroundBitmap&&this.backgroundBitmap.width>0&&this.backgroundBitmap.height>0&&this.canvasCtx.drawImage(this.backgroundBitmap,0,0,this.cssWidth,this.cssHeight),this.drawValue(),(e.showMax||e.showMin)&&this.drawMinMax()}drawValue(){let e=this.getValueText();this.canvas.drawText(this.canvasCtx,e,Math.floor(this.cssWidth/2),Math.floor(this.cssHeight/2*1.15),this.maxValueTextWidth,this.maxValueTextHeight,"bold",this.valueStateColor)}getValueText(){if(this.dataValue===null)return"--";let e=this.runtime.options().paths.numericPath.convertUnitTo;return["latitudeSec","latitudeMin","longitudeSec","longitudeMin","D HH:MM:SS"].includes(e)?this.dataValue.toString():this.applyDecorations(this.dataValue.toFixed(this.runtime.options().numDecimal))}drawMinMax(){let e=this.runtime.options();if(!e.showMin&&!e.showMax)return;let t="";e.showMin&&(t=this.minValue!=null?` Min: ${this.applyDecorations(this.minValue.toFixed(e.numDecimal))}`:" Min: --"),e.showMax&&(t+=this.maxValue!=null?` Max: ${this.applyDecorations(this.maxValue.toFixed(e.numDecimal))}`:" Max: --"),t=t.trim();let i=10*this.canvas.scaleFactor,a=5*this.canvas.scaleFactor;this.canvas.drawText(this.canvasCtx,t,i,Math.floor(this.cssHeight-a),this.maxMinMaxTextWidth,this.maxMinMaxTextHeight,"normal",this.valueColor,"start","bottom")}applyDecorations(e){switch(this.runtime.options().paths.numericPath.convertUnitTo){case"percent":case"percentraw":e+="%";break}return e}ngOnDestroy(){this.isDestroyed=!0,this.datasetLifecycle.removeDatasetIfExists(this.id(),!1);try{this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-numeric"]],viewQuery:function(t,i){t&1&&Me(i.miniChart,As,5)(i.canvasMainRef,P1,5),t&2&&ke(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:3,vars:1,consts:[["canvasMainRef",""],[3,"theme"],[1,"numeric-canvas"]],template:function(t,i){t&1&&(I(0,I1,1,1,"minichart",1),F(1,"canvas",2,0)),t&2&&N(i.showMiniChart()?0:-1)},dependencies:[As],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.numeric-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.numeric-canvas[_ngcontent-%COMP%]{position:relative;width:100%!important;height:100%!important;display:block}"]})}return n})();var N1=["canvasMainRef"],Em=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={displayName:"Gauge Label",filterSelfPaths:!0,paths:{stringPath:{description:"String Data",path:null,source:null,pathType:"string",isPathConfigurable:!0,sampleTime:500}},color:"contrast",enableTimeout:!1,dataTimeout:5};runtime=y(we);stream=y(Le);canvas=y(mt);canvasMainRef=pe.required("canvasMainRef");canvasElement;canvasCtx;titleBitmap=null;titleBitmapText=null;cssWidth=0;cssHeight=0;dataValue=null;labelColor=_(void 0);valueColor=void 0;isDestroyed=!1;streamRegistered=!1;constructor(){L(()=>{let e=this.theme();B(()=>{this.runtime?.options()&&e&&(this.setColors(),this.drawWidget())})}),L(()=>{this.runtime?.options()&&(this.isDestroyed||!this.canvasCtx||B(()=>{this.setColors(),this.startWidget(),this.drawWidget()}))})}ngOnInit(){this.setColors()}ngAfterViewInit(){this.canvasElement=this.canvasMainRef().nativeElement,this.canvasCtx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.drawWidget()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),!this.isDestroyed&&this.startWidget()}startWidget(){this.dataValue=null,this.streamRegistered||(this.runtime?.options()?.paths?.stringPath?.path?(this.stream.observe("stringPath",t=>{this.dataValue=t.data.value,this.drawWidget()}),this.streamRegistered=!0):this.drawWidget())}setColors(){let e=this.runtime?.options();e&&(this.labelColor.set(Te(e.color,this.theme()).dim),this.valueColor=Te(e.color,this.theme()).color)}ngOnDestroy(){this.isDestroyed=!0;try{this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}drawWidget(){if(!this.canvasCtx)return;let e=Math.floor(this.cssHeight*.1),t=this.runtime.options(),i=t.displayName+"|"+this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==i)&&(this.titleBitmap=this.canvas.createTitleBitmap(t.displayName,this.labelColor(),"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=t.displayName+"|"+this.labelColor()),this.canvas.clearCanvas(this.canvasCtx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.titleBitmap.width>0&&this.titleBitmap.height>0&&this.canvasCtx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight);let a=this.dataValue===null?"--":this.dataValue,r=this.canvas.EDGE_BUFFER||10,s=Math.max(0,this.cssHeight-e-2*r),l=Math.max(0,Math.floor(this.cssWidth-2*r)),m=Math.max(0,Math.floor(s)),f=Math.floor(this.cssWidth/2),b=Math.floor(e+r+s/2);this.canvas.drawText(this.canvasCtx,a,f,b,l,m,"bold",this.valueColor,"center","middle")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-text"]],viewQuery:function(t,i){t&1&&Me(i.canvasMainRef,N1,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["canvasMainRef",""],[1,"text-canvas"]],template:function(t,i){t&1&&Q(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.text-canvas[_ngcontent-%COMP%]{display:block;width:100%!important;height:100%!important;min-height:1px}"]})}return n})();var R1=["widgetDataChart"];vt.register(ya,ln,jn,Un,$n,qn,to,os,rs);var Dm=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we,{optional:!0});static DEFAULT_CONFIG={filterSelfPaths:!0,color:"contrast",timeScale:"Last 30 Minutes"};ngZone=y(Be);_dataset=y(dn);datasetLifecycle=y(oo);canvasService=y(mt);unitsService=y(at);responsive=y(Ua);isPhonePortrait;widgetDataChart=pe("widgetDataChart",{read:Ke});lineChartData={datasets:[]};lineChartOptions={parsing:!1,datasets:{line:{pointRadius:0,pointHoverRadius:0,tension:.3}},animations:{tension:{easing:"easeInOutCubic"}}};lineChartType="line";chart;_dsDirectionSub=null;_dsSpeedSub=null;datasetConfig=null;dataSourceInfo=null;xCenter=null;xStep=null;xCenterSpeed=null;xStepSpeed=null;CENTER_LINE_WIDTH=4;GRID_LINE_WIDTH=1;EDGE_EXTEND_UP_PX=42;EDGE_SPEED_LABEL_OFFSET=5;EDGE_DIR_LABEL_OFFSET=5;TICK_LABEL_FONT_SIZE=20;TICK_LABEL_PHONE_PORTRAIT_FONT_SIZE=11;CENTER_LABEL_FONT_SIZE=22;CENTER_LABEL_PHONE_PORTRAIT_FONT_SIZE=13;SPEED_VALUE_FONT_SIZE=62;SPEED_VALUE_PHONE_PORTRAIT_FONT_SIZE=32;TOP_VALUE_Y_OFFSET=62;TOP_VALUE_PHONE_PORTRAIT_Y_OFFSET=44;TOP_UNIT_Y_OFFSET=51;TOP_UNIT_PHONE_PORTRAIT_Y_OFFSET=38;UNIT_FONT_SIZE=28;UNIT_PHONE_PORTRAIT_FONT_SIZE=14;UNIT_PADDING=8;UNIT_PHONE_PORTRAIT_PADDING=3;gridBackgroundPlugin={id:"xSpeedGridBackground",beforeDraw:e=>{let t=e.chartArea;if(!t)return;let i=e.ctx,a=this.theme();i.save(),i.globalCompositeOperation="destination-over",i.fillStyle=a.background,i.fillRect(t.left,t.top,t.width/2,t.height),i.restore()}};centerTickPlugin={id:"centerTickStyle",afterDraw:e=>{let t=e.ctx,i=e.chartArea,a=this.theme(),r=this.getThemeColors(),s=vt.defaults.font,l=e.scales,m=e.options?.scales,f=e.data?.datasets?.[0]?.data,b=e.data?.datasets?.[5]?.data,A=(f?.length??0)>=2&&(b?.length??0)>=2,C=(me,ne)=>{let re=l?.[me],ce=m;if(!re)return;let oe=re,de=ce?.[me]?.min??oe.min,le=ce?.[me]?.max??oe.max;if(typeof de!="number"||typeof le!="number"||!isFinite(de)||!isFinite(le))return;let ve=(de+le)/2,ze=re.getPixelForValue(ve);t.save(),t.strokeStyle=a.contrastDim,t.lineWidth=this.CENTER_LINE_WIDTH,t.beginPath(),t.moveTo(ze,i.top),t.lineTo(ze,i.bottom),t.stroke(),t.restore(),t.save(),t.fillStyle=a.contrastDim,t.font=this.isPhonePortrait().matches?`bold ${this.CENTER_LABEL_PHONE_PORTRAIT_FONT_SIZE}px ${s.family}`:`bold ${this.CENTER_LABEL_FONT_SIZE}px ${s.family}`,t.textAlign="center",t.textBaseline="top";let ot=this.axisTopLabelY(re);t.fillText(ne(ve),ze,ot),t.restore()};C("x",me=>`${((me%360+360)%360).toFixed(0)}\xB0`),C("xSpeed",me=>`${me.toFixed(1)}`);let w=l?.xSpeed;if(w){let me=m,ne=w,re=me?.xSpeed?.max??ne.max;if(typeof re=="number"&&isFinite(re)){let ce=w.getPixelForValue(re);t.save(),t.fillStyle=this.resolveTickColor(e,w,re),t.font=this.isPhonePortrait().matches?`normal ${this.TICK_LABEL_PHONE_PORTRAIT_FONT_SIZE}px ${s.family}`:`normal ${this.TICK_LABEL_FONT_SIZE}px ${s.family}`,t.textAlign="right",t.textBaseline="top";let oe=this.axisTopLabelY(w),de=this.xStepSpeed??1,le=Math.max(0,Math.min(3,Math.ceil(-Math.log10(de))));t.fillText(`${re.toFixed(le)}`,ce-this.EDGE_SPEED_LABEL_OFFSET,oe),t.restore(),t.save(),t.strokeStyle=a.contrastDim,t.lineWidth=this.GRID_LINE_WIDTH,t.beginPath();let ve=Math.round(ce)+.5;t.moveTo(ve,i.bottom),t.lineTo(ve,i.top-this.EDGE_EXTEND_UP_PX),t.stroke(),t.restore()}}let M=l?.x;if(M){let me=m,ne=M,re=me?.x?.min??ne.min;if(typeof re=="number"&&isFinite(re)){let ce=M.getPixelForValue(re);t.save(),t.fillStyle=this.resolveTickColor(e,M,re),t.font=this.isPhonePortrait().matches?`normal ${this.TICK_LABEL_PHONE_PORTRAIT_FONT_SIZE}px ${s.family}`:`normal ${this.TICK_LABEL_FONT_SIZE}px ${s.family}`,t.textAlign="left",t.textBaseline="top";let oe=this.axisTopLabelY(M),de=this.normalizeAngle(re);t.fillText(`${de.toFixed(0)}\xB0`,ce+this.EDGE_DIR_LABEL_OFFSET,oe),t.restore()}}let G=e.data?.datasets,E=G?.[5]?.data,W=E?.length?E.length-1:-1,V=W>=0?E[W]?.x:void 0;if(typeof V=="number"&&isFinite(V)){t.save(),t.fillStyle=r.chartValue,t.font=this.isPhonePortrait().matches?`bold ${this.SPEED_VALUE_PHONE_PORTRAIT_FONT_SIZE}px ${s.family}`:`bold ${this.SPEED_VALUE_FONT_SIZE}px ${s.family}`,t.textAlign="center",t.textBaseline="middle";let me=`${V.toFixed(1)}`,ne=i.left+i.width/4,re=i.top-(this.isPhonePortrait().matches?this.TOP_VALUE_PHONE_PORTRAIT_Y_OFFSET:this.TOP_VALUE_Y_OFFSET);t.fillText(me,ne,re);let ce=t.measureText(me),oe=ne+ce.width/2+(this.isPhonePortrait().matches?this.UNIT_PHONE_PORTRAIT_PADDING:this.UNIT_PADDING),de=i.top-(this.isPhonePortrait().matches?this.TOP_UNIT_PHONE_PORTRAIT_Y_OFFSET:this.TOP_UNIT_Y_OFFSET);t.font=this.isPhonePortrait().matches?`bold ${this.UNIT_PHONE_PORTRAIT_FONT_SIZE}px ${s.family}`:`bold ${this.UNIT_FONT_SIZE}px ${s.family}`,t.textAlign="left",t.fillText("kts",oe,de),t.restore()}let Y=G?.[0]?.data,j=Y?.length?Y.length-1:-1,ye=j>=0?Y[j]?.x:void 0;if(typeof ye=="number"&&isFinite(ye)){let me=this.normalizeAngle(ye);t.save(),t.fillStyle=r.chartValue,t.font=this.isPhonePortrait().matches?`bold ${this.SPEED_VALUE_PHONE_PORTRAIT_FONT_SIZE}px ${s.family}`:`bold ${this.SPEED_VALUE_FONT_SIZE}px ${s.family}`,t.textAlign="center",t.textBaseline="middle",t.fillText(`${me.toFixed(0)}\xB0`,i.left+3*i.width/4,i.top-(this.isPhonePortrait().matches?this.TOP_VALUE_PHONE_PORTRAIT_Y_OFFSET:this.TOP_VALUE_Y_OFFSET)),t.restore()}if(!A){let me=Math.min(i.width*.7,420),ne=90,re=i.left+(i.width-me)/2,ce=i.top+(i.height-ne)/2;t.save(),t.globalAlpha=.82,t.fillStyle=a.background,t.fillRect(re,ce,me,ne),t.restore(),t.save(),t.strokeStyle=a.contrastDim,t.lineWidth=2,t.strokeRect(re,ce,me,ne),t.restore(),t.save(),t.fillStyle=this.getThemeColors().chartLabel,t.textAlign="center",t.textBaseline="middle",t.font=`bold 18px ${s.family}`,t.fillText("Data acquisition...",re+me/2,ce+ne/2),t.restore()}}};constructor(){this.isPhonePortrait=_i(this.responsive.observe(Wi.HandsetPortrait)),L(()=>{let e=this.theme(),t=this.runtime?.options();!e||!t||B(()=>{this.datasetConfig&&this.chart&&(this.setChartOptions(),this.setDatasetsColors(),this.ngZone.runOutsideAngular(()=>this.chart?.update("none")))})}),L(()=>{let e=this.runtime?.options();if(!e)return;!this.datasetConfig||this.datasetConfig.timeScaleFormat!==e.timeScale?(this.syncServiceDatasets(),this.startWidget()):this.chart&&this.setChartOptions()})}startWidget(){this.widgetDataChart()&&(this.datasetConfig=this._dataset.getDatasetConfig(`${this.id()}-twd`),this.dataSourceInfo=this._dataset.getDataSourceInfo(`${this.id()}-twd`),this.datasetConfig&&(this.createDatasets(),this.setChartOptions(),this.chart?this.ngZone.runOutsideAngular(()=>this.chart?.update("none")):(this.chart=new vt(this.widgetDataChart().nativeElement.getContext("2d"),{type:this.lineChartType,data:this.lineChartData,options:this.lineChartOptions,plugins:[this.gridBackgroundPlugin,this.centerTickPlugin]}),this.ngZone.runOutsideAngular(()=>this.chart?.update("none"))),this.startStreaming()))}syncServiceDatasets(){let e=this.runtime?.options();!e||e.timeScale===""||this.datasetLifecycle.syncWindTrendsDatasets(this.id(),e.timeScale)}setChartOptions(){this.lineChartOptions.maintainAspectRatio=!1,this.lineChartOptions.animation=!1,this.lineChartOptions.indexAxis="y";let e=0,t=360,i=(t-e)/4,a=0,r=20,s=(r-a)/4;this.lineChartOptions.scales={y:{type:"linear",display:!0,position:"right",reverse:!0,title:{display:!0,text:`${this.datasetConfig.timeScaleFormat}`,align:"center"},ticks:{count:6,autoSkip:!1,includeBounds:!0,align:"inner",major:{enabled:!0},font:this.isPhonePortrait().matches?{size:12}:{size:16},callback:l=>{let m=Number(l),f=this.datasetConfig?.timeScaleFormat,b=this.getWindowMs(f);return f==="Last 5 Minutes"?`${Math.round(m/6e4)}'`:b>=10*6e4?`${Math.round(m/6e4)}'`:`${Math.round(m/1e3)}"`}},grid:{display:!0,color:this.theme().contrastDimmer}},x:{type:"linear",position:"top",stack:"trends",beginAtZero:!1,bounds:"ticks",min:e,max:t,title:{display:!1},ticks:{count:5,align:"inner",autoSkip:!1,includeBounds:!0,stepSize:i,minRotation:0,maxRotation:0,callback:l=>{let m=this.xCenter??Number.NaN;if(this.nearlyEqual(l,m))return"";let b=this.chart?.options?.scales?.x?.min;return typeof b=="number"&&this.nearlyEqual(l,b)?"":`${((l%360+360)%360).toFixed(0)}\xB0`},font:l=>{let m=l.tick?.value??Number.NaN,f=this.xCenter??Number.NaN,b=this.nearlyEqual(m,f);return this.isPhonePortrait().matches?{size:11,weight:b?"bold":"normal"}:{size:20,weight:b?"bold":"normal"}},color:l=>{let m=l.tick?.value??Number.NaN,f=this.xCenter??Number.NaN;return this.nearlyEqual(m,f)?this.theme().contrast:void 0}},grid:{display:!0,color:l=>{let m=l.tick?.value??Number.NaN,f=l.scale,b=this.chart?.options?.scales,A=f,C=b?.x?.min??A.min;return this.nearlyEqual(m,C)?"rgba(0,0,0,0)":this.theme().contrastDimmer},lineWidth:1}},xSpeed:{type:"linear",position:"top",stack:"trends",beginAtZero:!1,bounds:"ticks",min:a,max:r,title:{display:!1},ticks:{count:5,align:"inner",autoSkip:!1,includeBounds:!0,stepSize:s,minRotation:0,maxRotation:0,callback:l=>{let m=this.xCenterSpeed??Number.NaN;if(this.nearlyEqual(l,m))return"";let b=this.chart?.options?.scales?.xSpeed?.max;if(typeof b=="number"&&this.nearlyEqual(l,b))return"";let A=this.xStepSpeed??Number.NaN,C=Number.isFinite(A)?A:1,w=Math.max(0,Math.min(3,Math.ceil(-Math.log10(C))));return`${l.toFixed(w)}`},font:l=>{let m=l.tick?.value??Number.NaN,f=this.xCenterSpeed??Number.NaN,b=this.nearlyEqual(m,f);return this.isPhonePortrait().matches?{size:11,weight:b?"bold":"normal"}:{size:20,weight:b?"bold":"normal"}},color:l=>{let m=l.tick?.value??Number.NaN,f=this.xCenterSpeed??Number.NaN;return this.nearlyEqual(m,f)?this.theme().contrast:void 0}},grid:{display:!0,color:l=>{let m=l.tick?.value??Number.NaN,f=l.scale,b=this.chart?.options?.scales,A=f,C=b?.xSpeed?.max??A.max;return this.nearlyEqual(m,C)?"rgba(0,0,0,0)":this.theme().contrastDimmer},lineWidth:1}}},this.lineChartOptions.plugins={title:{display:!0,align:"end",text:"TWD ",color:this.getThemeColors().chartLabel,padding:this.isPhonePortrait().matches?{top:3,bottom:0}:{top:3,bottom:0},font:this.isPhonePortrait().matches?{size:16,weight:"normal"}:{size:35,weight:"normal"}},subtitle:{display:!0,align:"start",text:" TWS",color:this.getThemeColors().chartLabel,padding:this.isPhonePortrait().matches?{top:-18,bottom:12}:{top:-41,bottom:12},font:this.isPhonePortrait().matches?{size:16}:{size:35}},legend:{display:!1},streaming:{duration:this.dataSourceInfo.maxDataPoints*this.dataSourceInfo.sampleTime,delay:this.dataSourceInfo.sampleTime,frameRate:this.datasetConfig.timeScaleFormat==="day"?5:this.datasetConfig.timeScaleFormat==="hour"?8:this.datasetConfig.timeScaleFormat==="minute"?15:30}},this.xCenter=(e+t)/2,this.xStep=i,this.xCenterSpeed=(a+r)/2,this.xStepSpeed=s}createDatasets(){this.lineChartData.datasets=[],this.lineChartData.datasets.push({label:"Value",data:[],order:2,parsing:!1,normalized:!0,tension:0,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:1,fill:!1,xAxisID:"x"},{label:"SMA",data:[],order:0,parsing:!1,normalized:!0,tension:.3,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:10,fill:!1,borderColor:e=>{let t=e.chart,{ctx:i}=t;return this.lineGradientForAxis(i,t,"x")},backgroundColor:"red",xAxisID:"x"},{label:"lastAverage",data:[],order:1,parsing:!1,normalized:!0,tension:0,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:0,borderColor:"",fill:!1,hidden:!0,xAxisID:"x"},{label:"lastMinimum",data:[],order:3,parsing:!1,normalized:!0,hidden:!0,xAxisID:"x"},{label:"lastMaximum",data:[],order:4,parsing:!1,normalized:!0,hidden:!0,xAxisID:"x"},{label:"Value Speed",data:[],order:2,parsing:!1,normalized:!0,tension:0,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:1,fill:!1,xAxisID:"xSpeed"},{label:"SMA Speed",data:[],order:0,parsing:!1,normalized:!0,tension:.2,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:3,fill:!1,borderColor:e=>{let t=e.chart,{ctx:i}=t;return this.lineGradientForAxis(i,t,"xSpeed")},xAxisID:"xSpeed"},{label:"lastAverage Speed",data:[],order:1,parsing:!1,normalized:!0,tension:0,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:0,borderColor:"",fill:!1,hidden:!0,xAxisID:"xSpeed"},{label:"lastMinimum Speed",data:[],order:3,parsing:!1,normalized:!0,hidden:!0,xAxisID:"xSpeed"},{label:"lastMaximum Speed",data:[],order:4,parsing:!1,normalized:!0,hidden:!0,xAxisID:"xSpeed"}),this.setDatasetsColors()}startStreaming(){this._dsDirectionSub?.unsubscribe(),this._dsSpeedSub?.unsubscribe();let e=this._dataset.getDatasetBatchThenLiveObservable(`${this.id()}-twd`),t=this._dataset.getDatasetBatchThenLiveObservable(`${this.id()}-tws`);this._dsDirectionSub=e?.subscribe(i=>{if(Array.isArray(i))this.pushRowsToDatasets(i);else if(this.pushRowsToDatasets([i]),this.chart.data.datasets[0].data.length>this.dataSourceInfo.maxDataPoints)for(let a=0;a<=4;a++)this.chart.data.datasets[a].data.shift();this.updateChartAfterDataChange(),this.ngZone.runOutsideAngular(()=>{this.chart?.update("none")})}),this._dsSpeedSub=t?.subscribe(i=>{if(Array.isArray(i))this.pushRowsToSpeedDatasets(i);else if(this.pushRowsToSpeedDatasets([i]),this.chart.data.datasets[5].data.length>this.dataSourceInfo.maxDataPoints)for(let a=5;a<=9;a++)this.chart.data.datasets[a].data.shift();this.updateChartAfterDataChange(),this.ngZone.runOutsideAngular(()=>{this.chart?.update("none")})})}unwrapAngles(e){if(e.length===0)return[];let t=[],i=null;for(let a of e){if(a==null){t.push(null);continue}if(i==null){t.push(a),i=a;continue}let r=a-i;r>180&&(r-=360),r<-180&&(r+=360),t.push(t[t.length-1]+r),i=a}return t}pushRowsToDatasets(e){this.pushRowsGeneric(e,0,"deg",!0)}pushRowsToSpeedDatasets(e){this.pushRowsGeneric(e,5,"knots",!1)}getRowValue(e,t){switch(t){case"value":return e.data.value??null;case"sma":return e.data.sma??null;case"ema":return e.data.ema??null;case"dema":return e.data.doubleEma??null;case"avg":return e.data.lastAverage??null;case"min":return e.data.lastMinimum??null;case"max":return e.data.lastMaximum??null;default:return null}}transformRows(e,t,i,a){let r=e.map(l=>{let m=this.getRowValue(l,t);return m==null?null:this.unitsService.convertToUnit(i,m)}),s=a?this.unwrapAngles(r):r;return e.map((l,m)=>({x:s[m],y:l.timestamp,ts:l.timestamp}))}pushRowsGeneric(e,t,i,a){["value","sma","avg","min","max"].forEach((s,l)=>{this.chart.data.datasets[t+l].data.push(...this.transformRows(e,s,i,a))})}normalizeAngle(e){return(e%360+360)%360}angularDiff(e,t){let i=(e-t+540)%360-180;return Math.abs(i)}niceStepFromMantissas(e,t){if(!isFinite(e)||e<=0)return 1;let i=Math.floor(Math.log10(e)),a=e/Math.pow(10,i);return(t.find(s=>a<=s)??t[t.length-1])*Math.pow(10,i)}updateChartAfterDataChange(){let e=this.chart.data.datasets[2]?.data,t=this.chart.data.datasets[1]?.data,i=this.chart.data.datasets[0]?.data,a=!!e?.length,r=!!t?.length,s=!!i?.length,l=a?e[e.length-1].x:r?t[t.length-1].x:s?i[i.length-1].x:void 0;if(typeof l=="number"&&isFinite(l)){let A=this.chart.data.datasets[3]?.data,C=this.chart.data.datasets[4]?.data,w=A?.length?A[A.length-1].x:void 0,M=C?.length?C[C.length-1].x:void 0,G=typeof w=="number"&&isFinite(w)?this.angularDiff(l,w):Number.NaN,E=typeof M=="number"&&isFinite(M)?this.angularDiff(l,M):Number.NaN,W=Number.isFinite(G)||Number.isFinite(E)?Math.max(Number.isFinite(G)?G:0,Number.isFinite(E)?E:0):Number.NaN;if(!Number.isFinite(W)){let re=a?e:r?t:i,ce=Math.min(30,re?.length??0);if(ce>1){let de=re.slice(re.length-ce).map(le=>le.x).filter(le=>typeof le=="number"&&isFinite(le));de.length&&(W=de.reduce((le,ve)=>Math.max(le,this.angularDiff(l,ve)),0))}}W=Math.max(W||0,15);let Y=2*W/4,j=this.niceStepFromMantissas(Y,[1,1.5,2,2.5,5,7.5,10]),ye=l-2*j,me=l+2*j;this.chart.options.scales.x.min=ye,this.chart.options.scales.x.max=me;let ne=this.chart.options.scales;ne.x.ticks=fe(ae({},ne.x.ticks??{}),{stepSize:j}),this.xCenter=l,this.xStep=j}let m=this.chart.data.datasets[7]?.data;if(m&&m.length){let A=m.length-1,C=m[A]?.x??0,w=this.chart.data.datasets[8].data[A]?.x??C,M=this.chart.data.datasets[9].data[A]?.x??C,G=Math.abs(C-w),E=Math.abs(M-C),W=Math.max(G,E);W=Math.max(W,.5);let Y=2*W/4,j=this.niceStepFromMantissas(Y,[1,2,2.5,5,10]),ye=C-2*j,me=C+2*j,ne=this.chart.options.scales;ne.xSpeed.min=ye,ne.xSpeed.max=me,ne.xSpeed.ticks=fe(ae({},ne.xSpeed.ticks??{}),{stepSize:j}),this.xCenterSpeed=C,this.xStepSpeed=j}let f=this.getWindowMs(this.datasetConfig?.timeScaleFormat);if(this.chart.data.datasets[0].data.length>0){let A=Date.now();this.chart.data.datasets.forEach(E=>{E.data.forEach(W=>{let V=W.ts??W.y;W.y=Math.max(0,Math.min(f,A-V))})}),this.chart.options.scales.y.min=0,this.chart.options.scales.y.max=f;let C;switch(this.datasetConfig?.timeScaleFormat){case"Last Minute":C=15e3;break;case"Last 5 Minutes":C=6e4;break;case"Last 30 Minutes":C=5*6e4;break;default:C=f/5;break}let M=this.chart.options.scales,G=ae({},M.y.ticks??{});delete G.count,G.stepSize=C,M.y.ticks=G}}getWindowMs(e){switch(e){case"Last 30 Minutes":return 30*6e4;case"Last 5 Minutes":return 5*6e4;case"Last Minute":return 6e4;default:return 6e4}}lineGradientForAxis(e,t,i){let a=t.chartArea;if(!a)return null;let r=t.scales?.[i];if(!r)return null;let s=t.options?.scales,l=r,m=s?.[i]?.min??l.min,f=s?.[i]?.max??l.max;if(typeof m!="number"||typeof f!="number"||!isFinite(m)||!isFinite(f))return null;let b=(m+f)/2,A=r.getPixelForValue(b),C=Math.max(0,Math.min(1,(A-a.left)/a.width)),w=e.createLinearGradient(a.left,0,a.right,0);return w.addColorStop(0,this.theme().port),w.addColorStop(C,this.theme().port),w.addColorStop(C,this.theme().starboard),w.addColorStop(1,this.theme().starboard),w}setDatasetsColors(){this.lineChartData.datasets.forEach(e=>{e.label==="Value"&&(e.borderColor=this.getThemeColors().valueLine,e.backgroundColor=this.getThemeColors().valueFill),e.label==="Value Speed"&&(e.borderColor=this.getThemeColors().valueLine,e.backgroundColor=this.getThemeColors().valueFill)})}getThemeColors(){let e=this.runtime?.options()?.color,t={valueLine:null,valueFill:null,averageLine:null,averageFill:null,averageChartLine:null,chartLabel:null,chartValue:null};switch(e){case"contrast":t.valueLine=this.theme().contrastDim,t.valueFill=this.theme().contrastDimmer,t.averageLine=this.theme().contrast,t.averageFill=this.theme().contrast,t.chartValue=this.theme().contrast,t.averageChartLine=this.theme().contrast,t.chartLabel=this.theme().contrastDim;break;case"blue":t.valueLine=this.theme().blueDim,t.valueFill=this.theme().blueDimmer,t.averageLine=this.theme().blue,t.averageFill=this.theme().blue,t.chartValue=this.theme().blue,t.averageChartLine=this.theme().blueDim,t.chartLabel=this.theme().blueDim;break;case"green":t.valueLine=this.theme().greenDim,t.valueFill=this.theme().greenDimmer,t.averageLine=this.theme().green,t.averageFill=this.theme().green,t.chartValue=this.theme().green,t.averageChartLine=this.theme().greenDim,t.chartLabel=this.theme().greenDim;break;case"pink":t.valueLine=this.theme().pinkDim,t.valueFill=this.theme().pinkDimmer,t.averageLine=this.theme().pink,t.averageFill=this.theme().pink,t.chartValue=this.theme().pink,t.averageChartLine=this.theme().pinkDim,t.chartLabel=this.theme().pinkDim;break;case"orange":t.valueLine=this.theme().orangeDim,t.valueFill=this.theme().orangeDimmer,t.averageLine=this.theme().orange,t.averageFill=this.theme().orange,t.chartValue=this.theme().orange,t.averageChartLine=this.theme().orangeDim,t.chartLabel=this.theme().orangeDim;break;case"purple":t.valueLine=this.theme().purpleDim,t.valueFill=this.theme().purpleDimmer,t.averageLine=this.theme().purple,t.averageFill=this.theme().purple,t.chartValue=this.theme().purple,t.averageChartLine=this.theme().purpleDim,t.chartLabel=this.theme().purpleDim;break;case"grey":t.valueLine=this.theme().greyDim,t.valueFill=this.theme().greyDimmer,t.averageLine=this.theme().grey,t.averageFill=this.theme().grey,t.chartValue=this.theme().grey,t.averageChartLine=this.theme().greyDim,t.chartLabel=this.theme().greyDim;break;case"yellow":t.valueLine=this.theme().yellowDim,t.valueFill=this.theme().yellowDimmer,t.averageLine=this.theme().yellow,t.averageFill=this.theme().yellow,t.chartValue=this.theme().yellow,t.averageChartLine=this.theme().yellowDim,t.chartLabel=this.theme().yellowDim;break}return t}nearlyEqual(e,t,i=1e-6){if(!Number.isFinite(e)||!Number.isFinite(t))return!1;let a=Math.max(1,Math.max(Math.abs(e),Math.abs(t)));return Math.abs(e-t)<=i*a}resolveTickColor(e,t,i){let r=t.options.ticks?.color;return typeof r=="function"?r({chart:e,scale:t,tick:{value:i}})??vt.defaults.color:typeof r=="string"?r:vt.defaults.color}axisTopLabelY(e){return e.options?.position==="top"?e.top+4:e.bottom+2}ngOnDestroy(){this._dsDirectionSub?.unsubscribe(),this._dsSpeedSub?.unsubscribe(),this.chart?.destroy();let e=this.widgetDataChart?.()?.nativeElement;this.canvasService.releaseCanvas(e,{clear:!0,removeFromDom:!0})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-windtrends-chart"]],viewQuery:function(t,i){t&1&&Me(i.widgetDataChart,R1,5,Ke),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["widgetDataChart",""],[2,"z-index","inherit"]],template:function(t,i){t&1&&Q(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"]})}return n})();function $t(n,o,e,t=1e3,i,a,r=[500,500],s){if(a){let w=a.get(n);w&&cancelAnimationFrame(w)}o=(()=>{let w=n.getAttribute("transform");if(w){let M=/rotate\((-?\d+(\.\d+)?)/.exec(w);if(M)return parseFloat(M[1])}return o})();let m=w=>(w+360)%360;o=m(o),e=m(e);let f=e-o;f>180&&(f-=360),f<-180&&(f+=360);let b=w=>w<.5?4*w*w*w:1-Math.pow(-2*w+2,3)/2,A=w=>s?s.runOutsideAngular(w):w(),C=w=>s?s.run(w):w();A(()=>{let w=performance.now(),M=E=>{let W=E-w,V=Math.min(W/t,1),Y=b(V),j=o+f*Y;if(n.setAttribute("transform",`rotate(${j} ${r[0]} ${r[1]})`),V<1){let ye=requestAnimationFrame(M);a&&a.set(n,ye)}else n.setAttribute("transform",`rotate(${e} ${r[0]} ${r[1]})`),i&&C(i),a&&a.delete(n)},G=requestAnimationFrame(M);a&&a.set(n,G)})}function Qo(n,o,e,t=500,i,a,r){if(a){let m=a.get(n);m&&cancelAnimationFrame(m)}let s=m=>r?r.runOutsideAngular(m):m(),l=m=>r?r.run(m):m();s(()=>{let m=performance.now(),f=e-o,b=w=>w<.5?4*w*w*w:1-Math.pow(-2*w+2,3)/2,A=w=>{let M=w-m,G=Math.min(M/t,1),E=b(G),W=o+f*E;if(n.setAttribute("width",W.toString()),G<1){let V=requestAnimationFrame(A);a&&a.set(n,V)}else n.setAttribute("width",e.toString()),i&&l(i),a&&a.delete(n)},C=requestAnimationFrame(A);a&&a.set(n,C)})}var Pm=n=>n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,ys=n=>(n%360+360)%360,O1=(n,o)=>{let e=ys(o)-ys(n);return e>180&&(e-=360),e<=-180&&(e+=360),e};function xs(n,o,e,t,i,a){let r=m=>a?a.runOutsideAngular(m):m(),s=m=>a?a.run(m):m(),l=0;return r(()=>{let m=performance.now(),f=O1(n,o),b=ys(n),A=C=>{let w=Math.min((C-m)/e,1),M=Pm(w),G=b+f*M;t(ys(G)),w<1?l=requestAnimationFrame(A):i&&s(i)};l=requestAnimationFrame(A)}),l}var V1=(n,o,e)=>({min:n.min+(o.min-n.min)*e,mid:n.mid+(o.mid-n.mid)*e,max:n.max+(o.max-n.max)*e});function Cs(n,o,e,t,i,a){let r=m=>a?a.runOutsideAngular(m):m(),s=m=>a?a.run(m):m(),l=0;return r(()=>{let m=performance.now(),f=b=>{let A=Math.min((b-m)/e,1),C=Pm(A);t(V1(n,o,C)),A<1?l=requestAnimationFrame(f):i&&s(i)};l=requestAnimationFrame(f)}),l}var L1=["rotatingDial"],W1=["awaIndicator"],F1=["twaIndicator"],G1=["wptIndicator"],B1=["setIndicator"],z1=["cogIndicator"];function U1(n,o){n&1&&(ie(),D(0,"g",69)(1,"text",100)(2,"tspan",101),c(3,"330"),R()(),D(4,"text",102)(5,"tspan",103),c(6,"300"),R()(),D(7,"text",104)(8,"tspan",105),c(9,"W"),R()(),D(10,"text",106)(11,"tspan",107),c(12,"240"),R()(),D(13,"text",108)(14,"tspan",109),c(15,"210"),R()(),D(16,"text",110)(17,"tspan",111),c(18,"S"),R()(),D(19,"text",112)(20,"tspan",113),c(21,"150"),R()(),D(22,"text",114)(23,"tspan",115),c(24,"120"),R()(),D(25,"text",116)(26,"tspan",117),c(27,"E"),R()(),D(28,"text",118)(29,"tspan",119),c(30,"60"),R()(),D(31,"text",120)(32,"tspan",121),c(33,"30"),R()(),D(34,"text",122)(35,"tspan",123),c(36,"N"),R()()())}function H1(n,o){n&1&&(ie(),D(0,"g",70)(1,"text",100)(2,"tspan",101),c(3,"30"),R()(),D(4,"text",102)(5,"tspan",103),c(6,"60"),R()(),D(7,"text",104)(8,"tspan",105),c(9,"90"),R()(),D(10,"text",106)(11,"tspan",107),c(12,"120"),R()(),D(13,"text",108)(14,"tspan",109),c(15,"150"),R()(),D(16,"text",110)(17,"tspan",111),c(18,"180"),R()(),D(19,"text",112)(20,"tspan",113),c(21,"150"),R()(),D(22,"text",114)(23,"tspan",115),c(24,"120"),R()(),D(25,"text",116)(26,"tspan",117),c(27,"90"),R()(),D(28,"text",118)(29,"tspan",119),c(30,"60"),R()(),D(31,"text",120)(32,"tspan",121),c(33,"30"),R()(),D(34,"text",122)(35,"tspan",123),c(36,"0"),R()()())}var Im=([n,o],[e,t],[i,a])=>(Math.atan2(a-t,i-e)-Math.atan2(o-t,n-e)+3*Math.PI)%(2*Math.PI)-Math.PI,Nm=(()=>{class n{rotatingDial=pe.required("rotatingDial");awaIndicator=pe.required("awaIndicator");twaIndicator=pe.required("twaIndicator");wptIndicator=pe.required("wptIndicator");setIndicator=pe.required("setIndicator");cogIndicator=pe.required("cogIndicator");compassHeading=x.required();compassModeEnabled=x.required();courseOverGroundAngle=x(void 0);courseOverGroundEnabled=x.required();trueWindAngle=x.required();twsEnabled=x.required();twaEnabled=x.required();trueWindSpeed=x.required();trueWindSpeedUnit=x.required();appWindAngle=x.required();awsEnabled=x.required();appWindSpeed=x.required();appWindSpeedUnit=x.required();laylineAngle=x(void 0);closeHauledLineEnabled=x.required();sailSetupEnabled=x.required();windSectorEnabled=x.required();driftEnabled=x.required();driftSet=x(void 0);driftFlow=x(void 0);waypointAngle=x(void 0);waypointEnabled=x.required();trueWindMinHistoric=x(void 0);trueWindMidHistoric=x(void 0);trueWindMaxHistoric=x(void 0);compass={oldValue:0,newValue:0};twa={oldValue:0,newValue:0};awa={oldValue:0,newValue:0};wpt={oldValue:0,newValue:0};cog={oldValue:0,newValue:0};set={oldValue:0,newValue:0};compassInitialized=!1;twaInitialized=!1;awaInitialized=!1;wptInitialized=!1;cogInitialized=!1;setInitialized=!1;headingValue=_("--");trueWindHeading=0;waypointActive=_(!1);portLaylinePrev=0;stbdLaylinePrev=0;portLaylineAnimId=null;stbdLaylineAnimId=null;closeHauledLinePortPath=_("M 500,500 500,500");closeHauledLineStbdPath=_("M 500,500 500,500");portSectorPrev={min:0,mid:0,max:0};stbdSectorPrev={min:0,mid:0,max:0};portSectorAnimId=null;stbdSectorAnimId=null;portWindSectorPath=_("");stbdWindSectorPath=_("");animationFrameIds=new WeakMap;CENTER=500;RADIUS=350;ANIMATION_DURATION=900;EPS_ANGLE=1;ngZone=y(Be);setRotationImmediate(e,t){e.setAttribute("transform",`rotate(${t} 500 500)`)}constructor(){L(()=>{let e=this.waypointEnabled();B(()=>{this.waypointActive.set(e)})}),L(()=>{let e=this.compassModeEnabled(),t=this.compassHeading(),i=Number.isFinite(t)?Math.round(t):null;i!=null&&B(()=>{let a=e?i:0;this.compassInitialized?(this.compass.oldValue=this.compass.newValue,this.compass.newValue=a):(this.compass.oldValue=a,this.compass.newValue=a,this.compassInitialized=!0),this.headingValue.set(i.toString()),this.rotatingDial()?.nativeElement&&(!this.compassInitialized||this.compass.oldValue===this.compass.newValue?this.setRotationImmediate(this.rotatingDial().nativeElement,-this.compass.newValue):$t(this.rotatingDial().nativeElement,-this.compass.oldValue,-this.compass.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone),this.updateCloseHauledLines(!1),this.updateWindSectors(!1))})}),L(()=>{let e=this.courseOverGroundAngle(),t=Number.isFinite(e)?Math.round(e):null,i=this.compassModeEnabled();t!=null&&B(()=>{let a=i?this.compass.newValue:0,r=t-a;this.cogInitialized?(this.cog.oldValue=this.cog.newValue,this.cog.newValue=r):(this.cog.oldValue=r,this.cog.newValue=r,this.cogInitialized=!0),this.cogIndicator()?.nativeElement&&(!this.cogInitialized||this.cog.oldValue===this.cog.newValue?this.setRotationImmediate(this.cogIndicator().nativeElement,this.cog.newValue):$t(this.cogIndicator().nativeElement,this.cog.oldValue,this.cog.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone))})}),L(()=>{let e=this.waypointAngle();B(()=>{if(e==null||!Number.isFinite(e)){this.waypointActive.set(!1);return}this.waypointEnabled()?this.waypointActive.set(!0):this.waypointActive.set(!1),this.wptInitialized?(this.wpt.oldValue=this.wpt.newValue,this.wpt.newValue=e):(this.wpt.oldValue=e,this.wpt.newValue=e,this.wptInitialized=!0),this.wptIndicator()?.nativeElement&&(!this.wptInitialized||this.wpt.oldValue===this.wpt.newValue?this.setRotationImmediate(this.wptIndicator().nativeElement,this.wpt.newValue):$t(this.wptIndicator().nativeElement,this.wpt.oldValue,this.wpt.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone))})}),L(()=>{let e=this.appWindAngle(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&B(()=>{let i=!this.awaInitialized;i?(this.awa.oldValue=t,this.awa.newValue=t,this.awaInitialized=!0):(this.awa.oldValue=this.awa.newValue,this.awa.newValue=t),this.awaIndicator()?.nativeElement&&(i||this.awa.oldValue===this.awa.newValue?this.setRotationImmediate(this.awaIndicator().nativeElement,this.awa.newValue):$t(this.awaIndicator().nativeElement,this.awa.oldValue,this.awa.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone)),this.updateCloseHauledLines(!i)})}),L(()=>{let e=this.trueWindAngle(),t=Number.isFinite(e)?Math.round(e):null,i=this.compassModeEnabled();t!=null&&B(()=>{this.trueWindHeading=t;let a=i?this.compass.newValue*-1:0,r=this.addHeading(this.trueWindHeading,a);this.twaInitialized?(this.twa.oldValue=this.twa.newValue,this.twa.newValue=r):(this.twa.oldValue=r,this.twa.newValue=r,this.twaInitialized=!0),this.twaIndicator()?.nativeElement&&(!this.twaInitialized||this.twa.oldValue===this.twa.newValue?this.setRotationImmediate(this.twaIndicator().nativeElement,this.twa.newValue):$t(this.twaIndicator().nativeElement,this.twa.oldValue,this.twa.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone))})}),L(()=>{this.laylineAngle(),this.closeHauledLineEnabled()&&B(()=>this.updateCloseHauledLines())}),L(()=>{let e=this.driftSet(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&B(()=>{this.setInitialized?(this.set.oldValue=this.set.newValue,this.set.newValue=t):(this.set.oldValue=t,this.set.newValue=t,this.setInitialized=!0),this.setIndicator()?.nativeElement&&(!this.setInitialized||this.set.oldValue===this.set.newValue?this.setRotationImmediate(this.setIndicator().nativeElement,this.set.newValue):$t(this.setIndicator().nativeElement,this.set.oldValue,this.set.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone))})}),L(()=>{let e=this.windSectorEnabled();this.trueWindMinHistoric(),this.trueWindMidHistoric(),this.trueWindMaxHistoric(),this.laylineAngle(),B(()=>{if(!e){this.portSectorAnimId&&cancelAnimationFrame(this.portSectorAnimId),this.stbdSectorAnimId&&cancelAnimationFrame(this.stbdSectorAnimId),this.portSectorAnimId=null,this.stbdSectorAnimId=null,this.portWindSectorPath.set(""),this.stbdWindSectorPath.set("");return}this.updateWindSectors(!0)})})}updateCloseHauledLines(e=!0){if(!this.closeHauledLineEnabled())return;let t=this.compassModeEnabled(),i=t&&Number(this.compass.newValue)||0,a=t&&Number(this.awa.newValue)||0,r=Number(this.laylineAngle())||0,s=t?this.addHeading(i,this.addHeading(a,r*-1)):this.addHeading(a,r*-1);this.animateLayline(this.portLaylinePrev,s,!0,e),this.portLaylinePrev=s;let l=t?this.addHeading(i,this.addHeading(a,r)):this.addHeading(a,r);this.animateLayline(this.stbdLaylinePrev,l,!1,e),this.stbdLaylinePrev=l}animateLayline(e,t,i,a=!0){if(i&&this.portLaylineAnimId&&cancelAnimationFrame(this.portLaylineAnimId),!i&&this.stbdLaylineAnimId&&cancelAnimationFrame(this.stbdLaylineAnimId),this.angleDelta(e,t)<this.EPS_ANGLE){this.drawLayline(t,i),i?this.portLaylineAnimId=null:this.stbdLaylineAnimId=null;return}if(!a){this.drawLayline(t,i),i?this.portLaylineAnimId=null:this.stbdLaylineAnimId=null;return}let r=xs(e,t,this.ANIMATION_DURATION,s=>this.drawLayline(s,i),()=>{i?this.portLaylineAnimId=null:this.stbdLaylineAnimId=null},this.ngZone);i?this.portLaylineAnimId=r:this.stbdLaylineAnimId=r}drawLayline(e,t){let i=e*Math.PI/180,a=Math.floor(this.RADIUS*Math.sin(i)+this.CENTER),r=Math.floor(this.RADIUS*Math.cos(i)*-1+this.CENTER);t?this.closeHauledLinePortPath.set(`M ${this.CENTER},${this.CENTER} L ${a},${r}`):this.closeHauledLineStbdPath.set(`M ${this.CENTER},${this.CENTER} L ${a},${r}`)}windSectorsInitialized=!1;updateWindSectors(e=!0){if(!this.windSectorEnabled()||this.trueWindMinHistoric()==null||this.trueWindMidHistoric()==null||this.trueWindMaxHistoric()==null)return;let t={min:this.trueWindMinHistoric(),mid:this.trueWindMidHistoric(),max:this.trueWindMaxHistoric()},i={min:this.trueWindMinHistoric(),mid:this.trueWindMidHistoric(),max:this.trueWindMaxHistoric()};if(!this.windSectorsInitialized){this.windSectorsInitialized=!0,e?(this.animateWindSector(t,t,!0),this.animateWindSector(i,i,!1)):(this.portWindSectorPath.set(this.computeSectorPath(t,!0)),this.stbdWindSectorPath.set(this.computeSectorPath(i,!1))),this.portSectorPrev=t,this.stbdSectorPrev=i;return}e?this.angleDelta(this.portSectorPrev.min,t.min)<this.EPS_ANGLE&&this.angleDelta(this.portSectorPrev.mid,t.mid)<this.EPS_ANGLE&&this.angleDelta(this.portSectorPrev.max,t.max)<this.EPS_ANGLE?(this.portWindSectorPath.set(this.computeSectorPath(t,!0)),this.stbdWindSectorPath.set(this.computeSectorPath(i,!1))):(this.animateWindSector(this.portSectorPrev,t,!0),this.animateWindSector(this.stbdSectorPrev,i,!1)):(this.portWindSectorPath.set(this.computeSectorPath(t,!0)),this.stbdWindSectorPath.set(this.computeSectorPath(i,!1))),this.portSectorPrev=t,this.stbdSectorPrev=i}animateWindSector(e,t,i){if(i&&this.portSectorAnimId&&cancelAnimationFrame(this.portSectorAnimId),!i&&this.stbdSectorAnimId&&cancelAnimationFrame(this.stbdSectorAnimId),this.angleDelta(e.min,t.min)<this.EPS_ANGLE&&this.angleDelta(e.mid,t.mid)<this.EPS_ANGLE&&this.angleDelta(e.max,t.max)<this.EPS_ANGLE){let s=this.computeSectorPath(t,i);i?this.portWindSectorPath.set(s):this.stbdWindSectorPath.set(s),i?this.portSectorAnimId=null:this.stbdSectorAnimId=null;return}let r=Cs(e,t,this.ANIMATION_DURATION,s=>{let l=this.computeSectorPath(s,i);i?this.portWindSectorPath.set(l):this.stbdWindSectorPath.set(l)},()=>{i?this.portSectorAnimId=null:this.stbdSectorAnimId=null},this.ngZone);i?this.portSectorAnimId=r:this.stbdSectorAnimId=r}addHeading(e=0,t=0){let i=(e+t)%360;return i<0&&(i+=360),i}ngOnDestroy(){this.portLaylineAnimId&&cancelAnimationFrame(this.portLaylineAnimId),this.stbdLaylineAnimId&&cancelAnimationFrame(this.stbdLaylineAnimId),this.portLaylineAnimId=null,this.stbdLaylineAnimId=null,this.portSectorAnimId&&cancelAnimationFrame(this.portSectorAnimId),this.stbdSectorAnimId&&cancelAnimationFrame(this.stbdSectorAnimId),this.portSectorAnimId=null,this.stbdSectorAnimId=null;let e=[this.rotatingDial(),this.awaIndicator(),this.twaIndicator(),this.wptIndicator(),this.setIndicator(),this.cogIndicator()];for(let t of e){let i=t?.nativeElement;if(!i)continue;let a=this.animationFrameIds.get(i);a&&cancelAnimationFrame(a),this.animationFrameIds.delete(i)}}angleDelta(e,t){let i=(t-e+540)%360-180;return Math.abs(i)}computeSectorPath(e,t){let a=(Number(this.laylineAngle())||0)*(t?-1:1),r=this.compassModeEnabled(),s=r&&Number(this.compass.newValue)||0,l=Number(this.awa.newValue)||0,m=r?this.addHeading(s,this.addHeading(e.min,a)):this.addHeading(a,this.addHeading(e.min,l*-1)),f=r?this.addHeading(s,this.addHeading(e.mid,a)):this.addHeading(a,this.addHeading(e.mid,l*-1)),b=r?this.addHeading(s,this.addHeading(e.max,a)):this.addHeading(a,this.addHeading(e.max,l*-1)),A=this.RADIUS*Math.sin(m*Math.PI/180)+this.CENTER,C=this.RADIUS*Math.cos(m*Math.PI/180)*-1+this.CENTER,w=this.RADIUS*Math.sin(f*Math.PI/180)+this.CENTER,M=this.RADIUS*Math.cos(f*Math.PI/180)*-1+this.CENTER,G=this.RADIUS*Math.sin(b*Math.PI/180)+this.CENTER,E=this.RADIUS*Math.cos(b*Math.PI/180)*-1+this.CENTER,W=Math.abs(Im([A,C],[w,M],[G,E]))>Math.PI/2?0:1,V=Im([G,E],[A,C],[w,M])>0?0:1;return`M ${this.CENTER},${this.CENTER} L ${A},${C} A ${this.RADIUS},${this.RADIUS} 0 ${W} ${V} ${G},${E} z`}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["svg-windsteer"]],viewQuery:function(t,i){t&1&&Me(i.rotatingDial,L1,5)(i.awaIndicator,W1,5)(i.twaIndicator,F1,5)(i.wptIndicator,G1,5)(i.setIndicator,B1,5)(i.cogIndicator,z1,5),t&2&&ke(6)},inputs:{compassHeading:[1,"compassHeading"],compassModeEnabled:[1,"compassModeEnabled"],courseOverGroundAngle:[1,"courseOverGroundAngle"],courseOverGroundEnabled:[1,"courseOverGroundEnabled"],trueWindAngle:[1,"trueWindAngle"],twsEnabled:[1,"twsEnabled"],twaEnabled:[1,"twaEnabled"],trueWindSpeed:[1,"trueWindSpeed"],trueWindSpeedUnit:[1,"trueWindSpeedUnit"],appWindAngle:[1,"appWindAngle"],awsEnabled:[1,"awsEnabled"],appWindSpeed:[1,"appWindSpeed"],appWindSpeedUnit:[1,"appWindSpeedUnit"],laylineAngle:[1,"laylineAngle"],closeHauledLineEnabled:[1,"closeHauledLineEnabled"],sailSetupEnabled:[1,"sailSetupEnabled"],windSectorEnabled:[1,"windSectorEnabled"],driftEnabled:[1,"driftEnabled"],driftSet:[1,"driftSet"],driftFlow:[1,"driftFlow"],waypointAngle:[1,"waypointAngle"],waypointEnabled:[1,"waypointEnabled"],trueWindMinHistoric:[1,"trueWindMinHistoric"],trueWindMidHistoric:[1,"trueWindMidHistoric"],trueWindMaxHistoric:[1,"trueWindMaxHistoric"]},decls:124,vars:44,consts:[["rotatingDial",""],["wptIndicator",""],["setIndicator",""],["cogIndicator",""],["awaIndicator",""],["twaIndicator",""],["viewBox","0 0 1000 1000"],["id","defs1"],["id","linearGradient18"],["offset","0",1,"boat",2,"stop-opacity","0.71372495"],["offset","1",1,"boat",2,"stop-opacity","0"],["id","linearGradient16"],["id","linearGradient13"],["offset","0.41176471",1,"drift-arrow",2,"stop-opacity","1"],["offset","1",1,"drift-arrow",2,"stop-opacity","0"],["id","swatch4"],["offset","0","id","stop4",2,"stop-color","#000000","stop-opacity","1"],["clipPathUnits","userSpaceOnUse","id","clipPath16"],["id","ellipse16","cx","311.24539","cy","-1516.3778","rx","194.27342","ry","181.83022",2,"display","inline","fill","#9a9300","fill-opacity","1","stroke","none","stroke-width","55","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],[0,"xlink","href","#linearGradient13","id","linearGradient14","x1","453.48047","y1","583.62891","x2","638.11328","y2","583.62891","gradientUnits","userSpaceOnUse","gradientTransform","matrix(0.00723393,1.2388183,-1.0538241,0.00615367,1111.2051,-179.73465)"],[0,"xlink","href","#linearGradient16","id","linearGradient17","x1","-502.04896","y1","439.35551","x2","-316","y2","439.35551","gradientUnits","userSpaceOnUse","gradientTransform","translate(0,49.000266)"],[0,"xlink","href","#linearGradient18","id","linearGradient19","x1","495.83999","y1","439.35551","x2","681.88895","y2","439.35551","gradientUnits","userSpaceOnUse","gradientTransform","translate(0,49.000266)"],["id","layerBackground",2,"display","inline"],["id","boat",2,"display","inline"],["id","portSide","d","M 498.75049,208.89453 A 267.09439,554.67401 0 0 1 678.45974,767.81661",2,"fill","none","fill-opacity","1","stroke","url(#linearGradient19)","stroke-width","5.821","stroke-linecap","round","stroke-miterlimit","0","stroke-dasharray","none"],["id","starboardSide","d","m -499.13846,208.89453 a 267.09439,554.67401 0 0 1 179.70925,558.92208","transform","scale(-1,1)",2,"fill","none","fill-opacity","1","stroke","url(#linearGradient17)","stroke-width","5.821","stroke-linecap","round","stroke-miterlimit","0","stroke-dasharray","none"],["id","layerCompass"],["id","fixedDial"],["id","portStarboardBackground","d","M 499.99997,10.520805 A 489.47916,489.47916 0 0 0 10.520805,499.99997 489.47916,489.47916 0 0 0 499.99997,989.47913 489.47916,489.47916 0 0 0 989.47913,499.99997 489.47916,489.47916 0 0 0 499.99997,10.520805 Z m 0,132.291665 a 357.1875,357.1875 0 0 1 357.18749,357.1875 357.1875,357.1875 0 0 1 -357.18749,357.18749 357.1875,357.1875 0 0 1 -357.1875,-357.18749 357.1875,357.1875 0 0 1 357.1875,-357.1875 z",1,"fixed-dial-background",2,"display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","port","d","M 93.283801,265.18231 A 469.63541,469.63541 0 0 1 339.37522,58.687079",1,"port",2,"display","inline","fill","none","stroke-width","39.6875","stroke-linecap","butt","stroke-linejoin","round","stroke-miterlimit","0"],["id","starboard","d","M 660.62476,58.687069 A 469.63541,469.63541 0 0 1 906.71619,265.18228",1,"starboard",2,"display","inline","fill","none","stroke-width","39.6875","stroke-linecap","butt","stroke-linejoin","round","stroke-miterlimit","0"],["id","barsAndText",1,"contrast-stroke",2,"display","inline"],["d","m 416.35095,19.837399 2.78142,15.77426","id","path199",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 334.23173,41.658798 5.47834,15.051615","id","path200",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 260.27336,81.806174 12.55151,21.739856","id","path37",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 187.44581,126.00035 10.29591,12.2702","id","path197",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 127.23918,185.95785 12.27019,10.29591","id","path198",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 83.252815,257.66724 21.739865,12.55151","id","path166",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 42.289518,332.39273 15.05162,5.47835","id","path195",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 20.127799,414.42077 15.774251,2.78142","id","path196",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 17.879075,498.47765 H 42.982096","id","path167",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 19.776759,583.71187 15.77426,-2.78142","id","path193",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 41.598167,665.8311 15.051615,-5.47834","id","path194",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 81.668963,739.71246 103.40883,727.16095","id","path168",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 125.93981,812.61701 12.2702,-10.29591","id","path191",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 185.89732,872.82365 10.29591,-12.27019","id","path192",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 257.53004,916.73298 12.55151,-21.73985","id","path169",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 332.33219,957.7732 5.47835,-15.05162","id","path189",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 414.36024,979.93493 2.78142,-15.77425","id","path190",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 498.34046,982.10672 V 957.0037","id","path170",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 583.65133,980.28596 580.86991,964.5117","id","path187",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 665.77057,958.46456 -5.47834,-15.05161","id","path188",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 739.57526,918.31683 727.02375,896.57698","id","path171",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 812.55647,874.12301 802.26056,861.85282","id","path185",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 872.76312,814.16551 860.49293,803.8696","id","path186",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 916.59579,742.45577 894.85593,729.90426","id","path172",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 957.71266,667.73063 -15.05161,-5.47834","id","path183",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 979.8744,585.70259 -15.77425,-2.78142","id","path184",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 981.96954,501.64535 -25.10304,10e-6","id","path173",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 980.22542,416.41149 -15.77425,2.78143","id","path181",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 958.40403,334.29226 -15.05161,5.47834","id","path182",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 918.17964,260.41055 -21.73986,12.55151","id","path174",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 874.06247,187.50636 -12.27018,10.29591","id","path180",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 817.34594,130.05494 -10.40259,12.17987","id","path179",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 742.31857,83.390025 729.76706,105.12988","id","path175",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 667.6701,42.350172 -5.47834,15.051615","id","path178",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 585.64206,20.188432 -2.78142,15.77425","id","path176",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 501.50816,18.016286 V 43.119307","id","path177",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["cx","500","cy","500","r","404",1,"rotating-dial-Backplate"],["id","dialLabelsCompass"],["id","dialLabelsPortStbd"],["id","LayerLayline"],["id","PortLayline",1,"laylines",2,"fill","none","stroke-width","5","stroke-dasharray","40, 20","stroke-dashoffset","0","stroke-opacity","0.6"],["id","StbdLayline",1,"laylines",2,"fill","none","stroke-width","5","stroke-dasharray","40, 20","stroke-dashoffset","0","stroke-opacity","0.6"],["id","LayerWindShift"],["id","portSectorShift",1,"wind-sector-port",2,"fill-opacity","0.5","stroke","none"],["id","StbdSectorShift",1,"wind-sector-stbd",2,"fill-opacity","0.5","stroke","none"],["clip-path","url(#clipPath16)","d","m 416.36313,-1521.3937 c 371.15015,24.6522 731.95257,192.9774 983.98757,467.456 227.2972,244.24389 363.1732,572.3808 369.4045,906.42978 15.9331,499.10271 -269.2071,986.17861 -700.5178,1232.88522 -485.08308,290.4843 -1134.555606,269.7346 -1599.2788,-52.7169 -404.5062,-269.24461 -653.2224,-759.35388 -614.1746,-1245.84043 30.2148,-487.61814 344.18931,-937.89997 780.52695,-1152.15867 176.96718,-89.2092 371.8823084,-142.3103 569.54914,-156.0363","transform","matrix(0.28310615,0,0,0.32000828,411.88452,661.64815)",1,"next-waypoint-bar",2,"display","inline","fill","none","stroke-width","30","stroke-miterlimit","0"],["id","path6341","cx","500","cy","175.00002","rx","17.361122","ry","17.361118",1,"next-waypoint",2,"display","inline","fill","none","stroke-width","15.2778","stroke-dasharray","none"],["id","setArrow","d","m 563.93337,480.60403 -64.4901,-94.9673 -63.37665,95.71396 58.48691,-30.71299 0.77713,133.08346 c 0.0992,16.99331 2.52916,30.65913 5.44822,30.64209 2.91911,-0.0171 5.18926,-13.71032 5.09001,-30.70362 l -0.77782,-133.20444 z",2,"fill","url(#linearGradient14)","stroke","none","stroke-width","1.18648"],["id","layerCounter"],["id","twsCounter"],[0,"xml","space","preserve","x","904.27722","y","150.88913","id","text43",1,"true-wind-label",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","34.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","14.5521","stroke-miterlimit","0"],[0,"xml","space","preserve","x","903.84814","y","114.73512","id","text42",1,"true-wind",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","66.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","14.5521","stroke-miterlimit","0"],[0,"xml","space","preserve","x","905.25897","y","52.894646","id","text41",1,"true-wind-label",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","34.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","14.5521","stroke-miterlimit","0"],["id","awsCounter"],[0,"xml","space","preserve","x","94.554222","y","150.88913","id","text39",1,"app-wind-label",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","34.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","14.5521","stroke-miterlimit","0"],[0,"xml","space","preserve","x","94.580925","y","114.63747","id","text40",1,"app-wind",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","66.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","14.5521","stroke-miterlimit","0"],[0,"xml","space","preserve","x","95.967644","y","52.894646","id","text39-7",1,"app-wind-label",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","34.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","14.5521","stroke-miterlimit","0"],["id","layerCurrent"],["id","text11",0,"xml","space","preserve","x","499.78842","y","523.55145",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-stretch","normal","font-size","66.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],["id","layerIndicators",2,"display","inline"],["d","m 506.20767,172.99458 a 6.3888631,8.8250643 0 0 1 -6.38888,8.82508 6.3888631,8.8250643 0 0 1 -6.38888,-8.82508 6.3888631,8.8250643 0 0 1 6.38888,-8.82509 6.3888631,8.8250643 0 0 1 6.38888,8.82509 z M 476.25472,30.811298 493.47058,13.265068 c 3.6173,-3.6867571 9.44162,-3.6867571 13.05892,0 l 17.21586,17.546106 c 3.6173,3.686743 3.6173,9.622786 0,13.309544 l -17.21595,17.54623 c -3.61721,3.686757 -9.44153,3.686757 -13.05893,0 L 476.25472,44.120841 c -3.6174,-3.686743 -3.6174,-9.622924 0,-13.309543 z m 17.20533,-16.510116 h 12.77766 V 173.26408 h -12.77766 z",1,"course-over-ground",2,"stroke-width","14.7329","stroke-linecap","square"],["d","m 451.77021,55.078207 42.08541,-33.202814 a 12.555638,12.555638 0.26446337 0 1 15.64423,0.07221 l 42.20046,33.930296 a 15.557694,15.557694 71.53185 0 1 5.32954,15.957795 L 504.17034,279.76529 a 2.5373267,2.5373267 0.02614114 0 1 -4.91879,-0.002 L 446.37431,70.966036 a 15.416336,15.416336 108.75875 0 1 5.3959,-15.887829 z","transform","matrix(0.7935953,0,0,0.92686935,101.84848,11.000842)",1,"app-wind",2,"display","inline","stroke-width","5.8876","stroke-miterlimit","0"],[0,"xml","space","preserve","x","500","y","110",1,"card-color",2,"font-weight","bold","font-size","70px","font-family","Roboto","text-align","center","text-anchor","middle","display","inline","stroke","none"],["d","m 451.77021,55.078207 42.08541,-33.202814 a 12.555638,12.555638 0.26446337 0 1 15.64423,0.07221 l 42.20046,33.930296 a 15.557694,15.557694 71.53185 0 1 5.32954,15.957795 L 504.17034,279.76529 a 2.5373267,2.5373267 0.02614114 0 1 -4.91879,-0.002 L 446.37431,70.966036 a 15.416336,15.416336 108.75875 0 1 5.3959,-15.887829 z","transform","matrix(0.60410307,0,0,0.70555435,196.91787,21.152867)",1,"true-wind",2,"display","inline","stroke","none","stroke-width","5.8876","stroke-miterlimit","0"],[0,"xml","space","preserve","x","500","y","110","id","text10",1,"card-color",2,"font-weight","bold","font-size","60px","font-family","Roboto","text-align","center","text-anchor","middle","display","inline","stroke","none"],["id","layerHeading",2,"display","inline"],["id","rect1","width","256.47919","height","108.5428","x","371.76041","y","10.805443","rx","23.757372",1,"heading-background",2,"stroke-width","4.43107","stroke-linejoin","bevel","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","0.509946"],["x","511.29395","y","102.86786",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","106.667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","5","stroke-linejoin","bevel","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],[0,"xml","space","preserve","x","181.91386","y","284.25186","id","text3","transform","rotate(-30)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan3","x","181.91386","y","284.25186",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-183.53558","y","283.74811","id","text14","transform","rotate(-60)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan14","x","-183.53558","y","283.74811",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-499.70761","y","100.95312","id","text15","transform","rotate(-90)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan15","x","-499.70761","y","100.95312",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-681.66119","y","-216.36243","id","text16","transform","rotate(-120)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["x","-681.66119","y","-216.36243","id","tspan25",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-681.06616","y","-581.71271","id","text17","transform","rotate(-150)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan17","x","-681.06616","y","-581.71271",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-498.3313","y","-897.40875","id","text18","transform","scale(-1)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan18","x","-498.3313","y","-897.40875",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-184.41313","y","-1080.8452","id","text19","transform","rotate(150)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan19","x","-184.41313","y","-1080.8452",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","181.57225","y","-1080.8853","id","text20","transform","rotate(120)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan20","x","181.57225","y","-1080.8853",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","501.42661","y","-896.93701","id","text21","transform","rotate(90)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan21","x","501.42661","y","-896.93701",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","682.35815","y","-579.63336","id","text22","transform","rotate(60)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan22","x","682.35815","y","-579.63336",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","681.81525","y","-214.27321","id","text23","transform","rotate(30)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan23","x","681.81525","y","-214.27321",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","500.15503","y","101.96342","id","text24",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan24","x","500.15503","y","101.96342",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"]],template:function(t,i){t&1&&(ie(),D(0,"svg",6)(1,"defs",7)(2,"linearGradient",8),Q(3,"stop",9)(4,"stop",10),R(),D(5,"linearGradient",11),Q(6,"stop",9)(7,"stop",10),R(),D(8,"linearGradient",12),Q(9,"stop",13)(10,"stop",14),R(),D(11,"linearGradient",15),Q(12,"stop",16),R(),D(13,"clipPath",17),Q(14,"ellipse",18),R(),Q(15,"linearGradient",19)(16,"linearGradient",20)(17,"linearGradient",21),R(),D(18,"g",22)(19,"g",23),Q(20,"path",24)(21,"path",25),R()(),D(22,"g",26)(23,"g",27),Q(24,"path",28)(25,"path",29)(26,"path",30),R(),D(27,"g",null,0)(29,"g",31),Q(30,"path",32)(31,"path",33)(32,"path",34)(33,"path",35)(34,"path",36)(35,"path",37)(36,"path",38)(37,"path",39)(38,"path",40)(39,"path",41)(40,"path",42)(41,"path",43)(42,"path",44)(43,"path",45)(44,"path",46)(45,"path",47)(46,"path",48)(47,"path",49)(48,"path",50)(49,"path",51)(50,"path",52)(51,"path",53)(52,"path",54)(53,"path",55)(54,"path",56)(55,"path",57)(56,"path",58)(57,"path",59)(58,"path",60)(59,"path",61)(60,"path",62)(61,"path",63)(62,"path",64)(63,"path",65)(64,"path",66)(65,"path",67)(66,"circle",68),I(67,U1,37,0,":svg:g",69)(68,H1,37,0,":svg:g",70),R(),D(69,"g",71),Q(70,"path",72)(71,"path",73),R(),D(72,"g",74),Q(73,"path",75)(74,"path",76),R(),D(75,"g",null,1),Q(77,"path",77)(78,"ellipse",78),R(),D(79,"g",null,2),Q(81,"path",79),R()()(),D(82,"g",80)(83,"g",81)(84,"text",82),c(85),R(),D(86,"text",83),c(87),lt(88,"number"),R(),D(89,"text",84),c(90,"TWS"),R()(),D(91,"g",85)(92,"text",86),c(93),R(),D(94,"text",87),c(95),lt(96,"number"),R(),D(97,"text",88),c(98,"AWS"),R()()(),D(99,"g",89)(100,"text",90),c(101),lt(102,"number"),R()(),D(103,"g",91)(104,"g",null,3),Q(106,"path",92),R(),D(107,"g",null,4),Q(109,"path",93),D(110,"text",94),c(111,"A"),R()(),D(112,"g",null,5),Q(114,"path",95),D(115,"text",96),c(116,"T"),R()()(),D(117,"g",97),Q(118,"rect",98),D(119,"text",99)(120,"tspan"),c(121),D(122,"tspan"),c(123,"\xB0"),R()()()()()),t&2&&(g(67),N(i.compassModeEnabled()?67:68),g(2),be("display",i.closeHauledLineEnabled()?"inline":"none"),g(),be("display",i.appWindAngle()!=null?"inline":"none"),J("d",i.closeHauledLineStbdPath()),g(),be("display",i.appWindAngle()!=null?"inline":"none"),J("d",i.closeHauledLinePortPath()),g(),be("display",i.windSectorEnabled()?"inline":"none"),g(),be("display",i.portWindSectorPath()?"inline":"none"),J("d",i.portWindSectorPath()||null),g(),be("display",i.stbdWindSectorPath()?"inline":"none"),J("d",i.stbdWindSectorPath()||null),g(),J("display",i.waypointActive()?"inline":"none"),g(4),be("display",i.driftEnabled()?"inline":"none"),g(4),be("display",i.twsEnabled()?"inline":"none"),g(2),X(i.trueWindSpeedUnit()),g(2),X(vn(88,35,i.trueWindSpeed(),"1.1-1")??"--"),g(4),be("display",i.awsEnabled()?"inline":"none"),g(2),X(i.appWindSpeedUnit()),g(2),X(vn(96,38,i.appWindSpeed(),"1.1-1")??"--"),g(4),be("display",i.driftEnabled()?"inline":"none"),g(2),X(vn(102,41,i.driftFlow(),"1.1-1")??"--"),g(3),J("display",i.courseOverGroundEnabled()?"inline":"none"),g(8),be("display",i.twaEnabled()?"inline":"none"),g(9),X(i.headingValue()))},dependencies:[za],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}svg[_ngcontent-%COMP%]{position:absolute;height:100%;width:100%;left:0;top:0}.fixed-dial-background[_ngcontent-%COMP%]{fill:var(--kip-grey-color)}.rotating-dial-Backplate[_ngcontent-%COMP%]{stroke:var(--mat-sys-background);fill:none;stroke-width:95}.starboard[_ngcontent-%COMP%]{stroke:var(--kip-starboard-color)}.port[_ngcontent-%COMP%]{stroke:var(--kip-port-color)}.heading-background[_ngcontent-%COMP%]{stroke:var(--kip-grey-color);fill:var(--kip-widget-card-background-color)}.boat[_ngcontent-%COMP%]{stop-color:var(--kip-grey-color)!important}.contrast-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}.contrast-stroke[_ngcontent-%COMP%]{stroke:var(--kip-contrast-color)}.card-color[_ngcontent-%COMP%]{fill:var(--kip-widget-card-background-color)}.true-wind[_ngcontent-%COMP%]{fill:var(--kip-yellow-color)}.true-wind-label[_ngcontent-%COMP%]{fill:var(--kip-yellow-dim-color)}.app-wind[_ngcontent-%COMP%]{fill:var(--kip-orange-color)}.app-wind-label[_ngcontent-%COMP%]{fill:var(--kip-orange-dim-color)}.course-over-ground[_ngcontent-%COMP%]{fill:var(--kip-pink-color)}.next-waypoint[_ngcontent-%COMP%]{stroke:var(--kip-green-color)}.next-waypoint-bar[_ngcontent-%COMP%]{stroke:var(--kip-grey-color)}.laylines[_ngcontent-%COMP%]{stroke:var(--kip-contrast-color)}.wind-sector-port[_ngcontent-%COMP%]{fill:var(--kip-port-color)}.wind-sector-stbd[_ngcontent-%COMP%]{fill:var(--kip-starboard-color)}.drift-arrow[_ngcontent-%COMP%]{stop-color:var(--kip-blue-color)}"],changeDetection:0})}return n})();var Rm=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,filterSelfPaths:!0,paths:{headingPath:{description:"True Heading",path:"self.navigation.headingTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",showConvertUnitTo:!1,sampleTime:1e3},appWindAngle:{description:"Apparent Wind Angle",path:"self.environment.wind.angleApparent",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",showConvertUnitTo:!1,sampleTime:1e3},appWindSpeed:{description:"Apparent Wind Speed",path:"self.environment.wind.speedApparent",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:1e3},trueWindAngle:{description:"True Wind Angle",path:"self.environment.wind.angleTrueWater",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",showConvertUnitTo:!1,sampleTime:1e3},trueWindSpeed:{description:"True Wind Speed",path:"self.environment.wind.speedTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:1e3},courseOverGround:{description:"True Course Over Ground",path:"self.navigation.courseOverGroundTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",showConvertUnitTo:!1,convertUnitTo:"deg",sampleTime:1e3},nextWaypointBearing:{description:"Next Waypoint True Bearing",path:"self.navigation.course.calcValues.bearingTrue",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",showConvertUnitTo:!1,sampleTime:1e3},set:{description:"True Drift Set",path:"self.environment.current.setTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",showConvertUnitTo:!1,sampleTime:1e3},drift:{description:"Drift Speed Impact",path:"self.environment.current.drift",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:1e3}},compassModeEnabled:!0,windSectorEnable:!0,windSectorWindowSeconds:5,laylineEnable:!0,laylineAngle:40,waypointEnable:!0,courseOverGroundEnable:!0,driftEnable:!0,awsEnable:!0,twsEnable:!0,twaEnable:!0,sailSetupEnable:!1,enableTimeout:!1,dataTimeout:5};runtime=y(we);stream=y(Le);zones=y(Be);cdr=y(Ci);hasHeading=!1;hasCOG=!1;hasAWA=!1;hasAWS=!1;hasTWA=!1;hasTWS=!1;hasSet=!1;hasDrift=!1;hasWPT=!1;currentHeading=_(0);courseOverGroundAngle=_(0);appWindAngle=_(0);appWindSpeed=_(0);appWindSpeedUnit=_("");trueWindAngle=_(0);trueWindSpeed=_(0);trueWindSpeedUnit=_("");driftFlow=_(0);driftSet=_(0);waypointAngle=_(0);historicalWindDirection=[];trueWindMinHistoric=_(void 0);trueWindMidHistoric=_(void 0);trueWindMaxHistoric=_(void 0);windSectorObservableSub=null;windSamples=[];windMinDeque=[];windMaxDeque=[];windSampleIndex=0;lastUnwrapped=null;lastSector={};markScheduled=!1;scheduleRafId=null;DEG_EPSILON=1;SPEED_EPSILON=.1;constructor(){L(()=>{let e=this.runtime.options();e&&B(()=>{this.appWindSpeedUnit.set(e.paths.appWindSpeed.convertUnitTo),this.trueWindSpeedUnit.set(e.paths.trueWindSpeed.convertUnitTo),this.registerStreams(),this.stopWindSectors(),this.startWindSectors()})})}onHeadingUpdate=e=>{e.data.value==null&&(e.data.value=0);let t=this.normalizeAngle(e.data.value);(!this.hasHeading||this.angleDelta(this.currentHeading(),t)>=this.DEG_EPSILON)&&(this.currentHeading.set(t),this.hasHeading=!0,this.scheduleMarkForCheck())};onCOGUpdate=e=>{e.data.value==null&&(e.data.value=0);let t=this.normalizeAngle(e.data.value);(!this.hasCOG||this.angleDelta(this.courseOverGroundAngle(),t)>=this.DEG_EPSILON)&&(this.courseOverGroundAngle.set(t),this.hasCOG=!0,this.scheduleMarkForCheck())};onDriftUpdate=e=>{e.data.value==null&&(e.data.value=0);let t=e.data.value;(!this.hasDrift||Math.abs(this.driftFlow()-t)>=this.SPEED_EPSILON)&&(this.driftFlow.set(t),this.hasDrift=!0,this.scheduleMarkForCheck())};onSetUpdate=e=>{e.data.value==null&&(e.data.value=0);let t=this.normalizeAngle(e.data.value);(!this.hasSet||this.angleDelta(this.driftSet(),t)>=this.DEG_EPSILON)&&(this.driftSet.set(t),this.hasSet=!0,this.scheduleMarkForCheck())};onWaypointUpdate=e=>{let t=e.data.value,i=this.normalizeAngle(t);(!this.hasWPT||this.angleDelta(this.waypointAngle(),i)>=this.DEG_EPSILON)&&(this.waypointAngle.set(i),this.hasWPT=!0,this.scheduleMarkForCheck())};onAppWindAngle=e=>{e.data.value==null&&(e.data.value=0);let t=e.data.value,i=this.normalizeAngle(t);(!this.hasAWA||this.angleDelta(this.appWindAngle(),i)>=this.DEG_EPSILON)&&(this.appWindAngle.set(i),this.hasAWA=!0,this.runtime.options()?.windSectorEnable&&this.addHistoricalWindDirection(this.normalizeAngle(t)),this.scheduleMarkForCheck())};onAppWindSpeed=e=>{e.data.value==null&&(e.data.value=0);let t=e.data.value;(!this.hasAWS||Math.abs(this.appWindSpeed()-t)>=this.SPEED_EPSILON)&&(this.appWindSpeed.set(t),this.hasAWS=!0,this.scheduleMarkForCheck())};onTrueWindSpeed=e=>{e.data.value==null&&(e.data.value=0);let t=e.data.value;(!this.hasTWS||Math.abs(this.trueWindSpeed()-t)>=this.SPEED_EPSILON)&&(this.trueWindSpeed.set(t),this.hasTWS=!0,this.scheduleMarkForCheck())};onTrueWindAngle=e=>{e.data.value==null&&(e.data.value=0);let i=this.runtime.options()?.paths.trueWindAngle.path||"",a=i.includes("angleTrueWater")||i.includes("angleTrueGround")?this.addHeading(this.currentHeading(),e.data.value):e.data.value,r=this.normalizeAngle(a);(!this.hasTWA||this.angleDelta(this.trueWindAngle(),r)>=this.DEG_EPSILON)&&(this.trueWindAngle.set(r),this.hasTWA=!0,this.scheduleMarkForCheck())};registerStreams(){this.runtime.options()&&this.zones.runOutsideAngular(()=>{this.stream.observe("headingPath",this.onHeadingUpdate),this.stream.observe("courseOverGround",this.onCOGUpdate),this.stream.observe("drift",this.onDriftUpdate),this.stream.observe("set",this.onSetUpdate),this.stream.observe("nextWaypointBearing",this.onWaypointUpdate),this.stream.observe("appWindAngle",this.onAppWindAngle),this.stream.observe("appWindSpeed",this.onAppWindSpeed),this.stream.observe("trueWindSpeed",this.onTrueWindSpeed),this.stream.observe("trueWindAngle",this.onTrueWindAngle)})}ngOnDestroy(){this.stopWindSectors(),this.scheduleRafId!=null&&(cancelAnimationFrame(this.scheduleRafId),this.scheduleRafId=null)}startWindSectors(){if(this.windSamples=[],this.windMinDeque=[],this.windMaxDeque=[],this.windSampleIndex=0,this.lastUnwrapped=null,this.lastSector={},!this.runtime.options()?.windSectorEnable){this.trueWindMinHistoric.set(void 0),this.trueWindMidHistoric.set(void 0),this.trueWindMaxHistoric.set(void 0),this.lastSector={},this.scheduleMarkForCheck();return}this.zones.runOutsideAngular(()=>{this.windSectorObservableSub=xr(1e3).subscribe(()=>{this.historicalCleanup()})})}addHistoricalWindDirection(e){let t=Date.now(),i=this.unwrapAngle(e),a=this.windSampleIndex++;for(this.windSamples.push({t,u:i,i:a});this.windMinDeque.length&&this.windMinDeque[this.windMinDeque.length-1].u>=i;)this.windMinDeque.pop();for(this.windMinDeque.push({i:a,u:i});this.windMaxDeque.length&&this.windMaxDeque[this.windMaxDeque.length-1].u<=i;)this.windMaxDeque.pop();this.windMaxDeque.push({i:a,u:i})}historicalCleanup(){if(!this.runtime.options()?.windSectorEnable)return;let e=Date.now()-this.runtime.options().windSectorWindowSeconds*1e3;for(;this.windSamples.length&&this.windSamples[0].t<e;){let f=this.windSamples.shift();if(!f)break;this.windMinDeque.length&&this.windMinDeque[0].i===f.i&&this.windMinDeque.shift(),this.windMaxDeque.length&&this.windMaxDeque[0].i===f.i&&this.windMaxDeque.shift()}if(!this.windSamples.length||!this.windMinDeque.length||!this.windMaxDeque.length){(this.trueWindMinHistoric()!==void 0||this.trueWindMidHistoric()!==void 0||this.trueWindMaxHistoric()!==void 0)&&(this.trueWindMinHistoric.set(void 0),this.trueWindMidHistoric.set(void 0),this.trueWindMaxHistoric.set(void 0),this.lastSector={},this.scheduleMarkForCheck());return}let t=this.windMinDeque[0].u,i=this.windMaxDeque[0].u,a=(t+i)/2,r=this.normalizeAngle(t),s=this.normalizeAngle(a),l=this.normalizeAngle(i);(this.lastSector.min===void 0||this.angleDelta(this.lastSector.min,r)>=this.DEG_EPSILON||this.lastSector.mid===void 0||this.angleDelta(this.lastSector.mid,s)>=this.DEG_EPSILON||this.lastSector.max===void 0||this.angleDelta(this.lastSector.max,l)>=this.DEG_EPSILON)&&(this.trueWindMinHistoric.set(r),this.trueWindMidHistoric.set(s),this.trueWindMaxHistoric.set(l),this.lastSector={min:r,mid:s,max:l},this.scheduleMarkForCheck())}stopWindSectors(){this.windSectorObservableSub?.unsubscribe()}unwrapAngle(e){if(this.lastUnwrapped==null)return this.lastUnwrapped=e,e;let t=this.lastUnwrapped,i=(t%360+360)%360,a=(e-i+540)%360-180,r=t+a;return this.lastUnwrapped=r,r}normalizeAngle(e){return(e%360+360)%360}addHeading(e,t){let i=(e+t)%360;return i<0&&(i+=360),i}angleDelta(e,t){let i=(t-e+540)%360-180;return Math.abs(i)}scheduleMarkForCheck(){this.markScheduled||(this.markScheduled=!0,this.zones.runOutsideAngular(()=>{this.scheduleRafId=requestAnimationFrame(()=>{this.zones.run(()=>{this.cdr.markForCheck()}),this.markScheduled=!1,this.scheduleRafId=null})}))}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-wind-steer"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:1,vars:25,consts:[[3,"compassHeading","compassModeEnabled","courseOverGroundAngle","courseOverGroundEnabled","trueWindAngle","twsEnabled","twaEnabled","trueWindSpeed","trueWindSpeedUnit","appWindAngle","awsEnabled","appWindSpeed","appWindSpeedUnit","laylineAngle","closeHauledLineEnabled","windSectorEnabled","driftEnabled","driftFlow","driftSet","waypointAngle","waypointEnabled","trueWindMinHistoric","trueWindMidHistoric","trueWindMaxHistoric","sailSetupEnabled"]],template:function(t,i){if(t&1&&F(0,"svg-windsteer",0),t&2){let a,r,s,l,m,f,b,A,C,w,M;O("compassHeading",i.currentHeading())("compassModeEnabled",(a=i.runtime.options())==null?null:a.compassModeEnabled)("courseOverGroundAngle",i.courseOverGroundAngle())("courseOverGroundEnabled",(r=i.runtime.options())==null?null:r.courseOverGroundEnable)("trueWindAngle",i.trueWindAngle())("twsEnabled",(s=i.runtime.options())==null?null:s.twsEnable)("twaEnabled",(l=i.runtime.options())==null?null:l.twaEnable)("trueWindSpeed",i.trueWindSpeed())("trueWindSpeedUnit",i.trueWindSpeedUnit())("appWindAngle",i.appWindAngle())("awsEnabled",(m=i.runtime.options())==null?null:m.awsEnable)("appWindSpeed",i.appWindSpeed())("appWindSpeedUnit",i.appWindSpeedUnit())("laylineAngle",(f=i.runtime.options())==null?null:f.laylineAngle)("closeHauledLineEnabled",(b=i.runtime.options())==null?null:b.laylineEnable)("windSectorEnabled",(A=i.runtime.options())==null?null:A.windSectorEnable)("driftEnabled",(C=i.runtime.options())==null?null:C.driftEnable)("driftFlow",i.driftFlow())("driftSet",i.driftSet())("waypointAngle",i.waypointAngle())("waypointEnabled",(w=i.runtime.options())==null?null:w.waypointEnable)("trueWindMinHistoric",i.trueWindMinHistoric())("trueWindMidHistoric",i.trueWindMidHistoric())("trueWindMaxHistoric",i.trueWindMaxHistoric())("sailSetupEnabled",((M=i.runtime.options())==null?null:M.sailSetupEnable)??!1)}},dependencies:[Nm],encapsulation:2,changeDetection:0})}return n})();function q1(n,o){if(n&1){let e=Se();d(0,"h3"),c(1,"Getting Started"),u(),d(2,"p"),c(3,"Welcome to KIP! Here are some basic gestures to help you navigate the application. Access the "),d(4,"a",1),c(5,"KIP Help"),u(),c(6," documentation to learn more about KIP."),u(),d(7,"table",2)(8,"thead")(9,"tr")(10,"th"),c(11,"Actions"),u(),d(12,"th"),c(13,"Touch"),u(),d(14,"th"),c(15,"Mouse"),u(),d(16,"th"),c(17,"Keyboard Shortcuts"),u()()(),d(18,"tbody")(19,"tr")(20,"td"),c(21,"Open Actions menu"),u(),d(22,"td"),c(23,"Swipe left"),u(),d(24,"td"),c(25,"Click, drag left, and release"),u(),d(26,"td")(27,"kbd"),c(28,"Shift"),u(),c(29," + "),d(30,"kbd"),c(31,"Ctrl"),u(),c(32," + "),d(33,"kbd",3),c(34,"\u2190"),u(),c(35," (Left Arrow)"),u()(),d(36,"tr")(37,"td"),c(38,"Open Notification menu"),u(),d(39,"td"),c(40,"Swipe right"),u(),d(41,"td"),c(42,"Click, drag right, and release"),u(),d(43,"td")(44,"kbd"),c(45,"Shift"),u(),c(46," + "),d(47,"kbd"),c(48,"Ctrl"),u(),c(49," + "),d(50,"kbd",3),c(51,"\u2192"),u(),c(52," (Right Arrow)"),u()(),d(53,"tr")(54,"td"),c(55,"Cycle through dashboards"),u(),d(56,"td"),c(57,"Swipe up/down"),u(),d(58,"td"),c(59,"Click, drag up/down, and release"),u(),d(60,"td")(61,"kbd"),c(62,"Shift"),u(),c(63," + "),d(64,"kbd"),c(65,"Ctrl"),u(),c(66," + "),d(67,"kbd",3),c(68,"\u2191"),u(),c(69,"/"),d(70,"kbd",3),c(71,"\u2193"),u(),c(72," (Up/Down Arrow)"),u()(),d(73,"tr")(74,"td"),c(75,"Toggle Fullscreen"),u(),d(76,"td"),c(77,"N/A"),u(),d(78,"td"),c(79,"N/A"),u(),d(80,"td")(81,"kbd"),c(82,"Shift"),u(),c(83," + "),d(84,"kbd"),c(85,"Ctrl"),u(),c(86," + "),d(87,"kbd"),c(88,"F"),u()()(),d(89,"tr")(90,"td"),c(91,"Toggle Night mode"),u(),d(92,"td"),c(93,"N/A"),u(),d(94,"td"),c(95,"N/A"),u(),d(96,"td")(97,"kbd"),c(98,"Shift"),u(),c(99," + "),d(100,"kbd"),c(101,"Ctrl"),u(),c(102," + "),d(103,"kbd"),c(104,"N"),u()()(),d(105,"tr")(106,"td"),c(107,"Toggle dashboard edit mode"),u(),d(108,"td"),c(109,"N/A"),u(),d(110,"td"),c(111,"N/A"),u(),d(112,"td")(113,"kbd"),c(114,"Shift"),u(),c(115," + "),d(116,"kbd"),c(117,"Ctrl"),u(),c(118," + "),d(119,"kbd"),c(120,"E"),u()()()()(),d(121,"i"),c(122,"Note that the words Touch and Tap are synonymous with mouse Click."),u(),F(123,"br")(124,"br"),d(125,"h3"),c(126,"Login to Signal K"),u(),d(127,"p"),c(128," The first step is to configure Signal K server authentication ("),d(129,"i"),c(130,"a pre-existing Signal K server username and password is required"),u(),c(131,"). Go to KIP's Connectivity options, toggle "),d(132,"strong"),c(133,"Login to server"),u(),c(134,", enter your Signal K credentials and click "),d(135,"strong"),c(136,"Sign in"),u(),c(137,". Once completed, click the upper right X button to get back to this dashboard ("),d(138,"a",4),c(139,"Connectivity options"),u(),c(140,"). "),u(),d(141,"ul")(142,"li"),c(143," If you don\u2019t have a Signal K account, ask your captain or access the Signal K Admin Settings / Users page and create a user. "),u(),d(144,"li"),c(145," If you see an error, double-check your username and password, and make sure your device is on the same network as your Signal K server. "),u()(),d(146,"h3"),c(147,"Option 1: Load Demonstration Dashboards"),u(),d(148,"p"),c(149," Try the sample dashboards using data from your server: "),F(150,"br"),d(151,"button",5),U("click",function(){ee(e);let i=k();return te(i.loadDemoConfig())}),c(152,"Load Demo"),u()(),d(153,"h3"),c(154,"Option 2: Create Your Own Layout"),u(),d(155,"p"),c(156,' The text you are reading is actually a widget that fills half of the dashboard. The screen is split in halves at the middle. This mode is called Chartplotter mode. It can later be turned off in Settings / Options / Display. Dashboards are "Locked" by default to prevent accidental modifications. To edit a dashboard, swipe left and hit the bottom unlock menu button. Note that you can add and manage dashboards using the Settings button from the Actions menu. '),u(),d(157,"p")(158,"strong"),c(159,"Try editing the Dashboard now to receive further instructions!"),u()()}}function $1(n,o){n&1&&(d(0,"h2"),c(1,"Changing Layouts"),u(),c(2," Follow these simple steps to learn how to change your dashboard layout: "),d(3,"ol")(4,"li"),c(5,"Resize this Tutorial widget using the now visible dashed borders or corners arrows. Resize it so it does not take up all the screen. You need free space in your dashboard to add more widgets. You can delete this Tutorial widget later when you are done with the instructions."),u(),d(6,"li"),c(7,"Touch & Hold or Click & Hold in an empty area to open the Add Widget selection panel."),u(),d(8,"li"),c(9,"Choose a widget from the selection panel to add it to the dashboard."),u()(),d(10,"h3"),c(11,"Possible widget operations"),u(),d(12,"ul")(13,"li")(14,"strong"),c(15,"Touch and drag"),u(),c(16," to move widgets"),u(),d(17,"li")(18,"strong"),c(19,"Drag corners and sides"),u(),c(20," to resize widgets"),u(),d(21,"li")(22,"strong"),c(23,"Double Tap"),u(),c(24," on a widget to configure it"),u(),d(25,"li")(26,"strong"),c(27,"Press and Hold"),u(),c(28," on a widget to delete or duplicate widgets"),u()(),d(29,"h2"),c(30,"Exiting dashboard edit mode"),u(),d(31,"p"),c(32,"Use the Save or Cancel buttons in the lower right corner to either persist your changes or revert changes."),u(),d(33,"h2"),c(34,"Adding more dashboards"),u(),d(35,"p"),c(36,"Swipe left and hit the Dashboards button. From this page you can add, rename, order, delete, and duplicate entire dashboards."),u())}var Om=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={filterSelfPaths:!0};dashboard=y(ft);settings=y(Vt);loadDemoConfig(){this.settings.loadDemoConfig()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-tutorial"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:3,vars:1,consts:[[1,"tutorial-container"],["routerLink","/help"],[1,"nav-table"],[2,"font-size","x-large"],["routerLink","/options"],["mat-flat-button","",2,"margin-left","15px",3,"click"]],template:function(t,i){t&1&&(d(0,"div",0),I(1,q1,160,0)(2,$1,37,0),u()),t&2&&(g(),N(i.dashboard.isDashboardStatic()?1:2))},dependencies:[At,jr],styles:[".tutorial-container[_ngcontent-%COMP%]{position:absolute;top:0;left:0;display:block;height:100%;width:100%;overflow-y:auto}.tutorial-container[_ngcontent-%COMP%]{padding:0 15px}.nav-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;margin-bottom:2em}.nav-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .nav-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border:1px solid #bbb;padding:.5em 1em;text-align:center}.nav-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background:#ddd;color:#222;font-weight:700}.nav-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(2n){background:#242424}.warning[_ngcontent-%COMP%]{color:#b71c1c}.button-group[_ngcontent-%COMP%]{margin-top:2em;display:flex;gap:20px}a[_ngcontent-%COMP%]:visited, a[_ngcontent-%COMP%]:link{color:var(--kip-blue-color)}"],changeDetection:0})}return n})();var j1=["canvas"],Zn=(()=>{class n{text=x.required();color=x.required();canvasRef=pe.required("canvas");canvas=y(mt);canvasElement;canvasCtx;isReady=!1;cssWidth=0;cssHeight=0;constructor(){}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.canvasCtx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.drawTitle()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.isReady=!0,this.drawTitle()}ngOnChanges(e){(e.text||e.color)&&this.drawTitle()}drawTitle(){this.isReady&&this.canvas.drawTitle(this.canvasCtx,this.text(),this.color(),"normal",this.cssWidth,this.cssHeight)}ngOnDestroy(){try{this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}this.canvasCtx=null,this.canvasElement=null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-title"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,j1,5),t&2&&ke()},inputs:{text:[1,"text"],color:[1,"color"]},features:[Zi],decls:3,vars:0,consts:[["canvas",""],[1,"title-wrapper"],[1,"title-canvas"]],template:function(t,i){t&1&&(D(0,"div",1),Q(1,"canvas",2,0),R())},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;z-index:10}.title-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.title-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block}"]})}return n})();var jt=(()=>{class n{resizeChange=new ei;kipResize=new ei;el=y(Ke);zone=y(Be);ro=null;constructor(){this.zone.runOutsideAngular(()=>{this.ro=new ResizeObserver(e=>{let t=e[e.length-1],{width:i,height:a}=t.contentRect;this.zone.run(()=>{this.resizeChange.emit(t),this.kipResize.emit({width:i,height:a,entry:t})})}),this.ro.observe(this.el.nativeElement)})}ngOnDestroy(){this.ro?.disconnect(),this.ro=null}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Ot({type:n,selectors:[["","kipResizeObserver",""]],outputs:{resizeChange:"resizeChange",kipResize:"kipResize"}})}return n})();var Y1=["svgSlider"];function Z1(n,o){n&1&&F(0,"div",10)}var Vm=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,displayName:"Slider Label",filterSelfPaths:!0,paths:{gaugePath:{description:"PUT Supported Numeric Path. IMPORTANT: Format must be set to (base)",path:null,source:null,pathType:"number",isPathConfigurable:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:null,showConvertUnitTo:!1,convertUnitTo:null,supportsPut:!0,sampleTime:500}},displayScale:{lower:0,upper:1,type:"linear"},enableTimeout:!1,dataTimeout:5,color:"contrast"};runtime=y(we);streams=y(Le);svgElement=pe.required("svgSlider");dashboard=y(ft);signalkRequestsService=y(ri);toast=y(en);labelColor=_(void 0);barColor=_(void 0);lineStartPx;lineWidthPx;lineEndPx;resizeTimeout=null;handlePosition=20;pathValue=0;lineStart=this.handlePosition;isDragStarted=!1;lineWidth="0px";VIEWBOX_WIDTH=200;LINE_START=20;LINE_WIDTH=160;colorMap=null;valueChange$=new zt;constructor(){L(()=>{let e=this.theme(),t=this.runtime.options();!t||!e||B(()=>{this.ensureColorMap(),this.getColors(t.color)})}),L(()=>{let e=this.runtime.options(),t=e?.paths?.gaugePath?.path;!e||!t||B(()=>{this.calculateLineBounds(),this.streams.observe("gaugePath",i=>{if(!i||!i.data){this.handlePosition=this.mapValueToPosition(e.displayScale.lower);return}this.updateHandlePosition(this.mapValueToPosition(i.data.value))})})})}ngOnInit(){let e=this.runtime.options();e&&this.getColors(e.color),this.valueChange$.pipe(Zt(t=>{let i=this.runtime.options();return i?this.isWithinMargin(t,i.displayScale.lower,i)?i.displayScale.lower:this.isWithinMargin(t,i.displayScale.upper,i)?i.displayScale.upper:parseFloat(t.toFixed(2)):t}),Tn(200),Cr()).subscribe(t=>{this.sendValue(t)})}mapValueToPosition(e){let t=this.runtime.options();if(!t)return e;let i=t.displayScale.upper-t.displayScale.lower,a=this.LINE_WIDTH;return(e-t.displayScale.lower)/i*a+this.LINE_START}mapPositionToValue(e){let t=this.runtime.options();if(!t)return e;let i=t.displayScale.upper-t.displayScale.lower,a=this.LINE_WIDTH;return(e-this.LINE_START)/a*i+t.displayScale.lower}isWithinMargin(e,t,i){let a=(i.displayScale.upper-i.displayScale.lower)*.01;return Math.abs(e-t)<=a}sendValue(e){let t=this.runtime.options()?.paths?.gaugePath?.path;this.signalkRequestsService.putRequest(t,e,this.id())}onResized(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.calculateLineBounds()},200)}calculateLineBounds(){if(!this.svgElement()?.nativeElement){console.warn("[Slider Widget] SVG element is not initialized yet.");return}let e=this.svgElement().nativeElement.getBoundingClientRect(),t=this.LINE_START/this.VIEWBOX_WIDTH*e.width,i=this.LINE_WIDTH/this.VIEWBOX_WIDTH*e.width;this.lineStartPx=t,this.lineWidthPx=i,this.lineEndPx=this.lineStartPx+this.lineWidthPx}updateHandlePosition(e){this.handlePosition=e,this.lineWidth=`${e-this.lineStart}px`}getPointerX(e){return e.clientX-this.svgElement().nativeElement.getBoundingClientRect().left}onPointerDown(e){this.isDragStarted=!0,this.onPointerMove(e),e.stopPropagation(),e.preventDefault()}onPointerMove(e){if(this.isDragStarted){let t=this.getPointerX(e);if(t>=this.lineStartPx&&t<=this.lineEndPx){let i=(t-this.lineStartPx)/this.lineWidthPx*this.LINE_WIDTH+this.LINE_START;this.updateHandlePosition(i);let a=this.runtime.options();a&&this.handlePosition<=this.LINE_START?this.pathValue=a.displayScale.lower:a&&this.handlePosition>=this.LINE_START+this.LINE_WIDTH?this.pathValue=a.displayScale.upper:this.pathValue=this.mapPositionToValue(this.handlePosition),this.valueChange$.next(this.pathValue)}}}onPointerUp(){this.isDragStarted=!1,this.valueChange$.next(this.pathValue)}onPointerLeave(){this.isDragStarted&&(this.isDragStarted=!1,this.valueChange$.next(this.pathValue))}getColors(e){if(this.ensureColorMap(),!this.colorMap)return;let t=this.colorMap.get(e)||this.colorMap.get("contrast");this.labelColor.set(t.label),this.barColor.set(t.bar)}ensureColorMap(){let e=this.theme();e&&(this.colorMap=new Map([["contrast",{label:e.contrastDim,bar:e.contrast}],["blue",{label:e.blueDim,bar:e.blue}],["green",{label:e.greenDim,bar:e.green}],["pink",{label:e.pinkDim,bar:e.pink}],["orange",{label:e.orangeDim,bar:e.orange}],["purple",{label:e.purpleDim,bar:e.purple}],["grey",{label:e.greyDim,bar:e.grey}],["yellow",{label:e.yellowDim,bar:e.yellow}]]))}ngOnDestroy(){this.valueChange$.complete(),this.resizeTimeout&&clearTimeout(this.resizeTimeout)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-slider"]],viewQuery:function(t,i){t&1&&Me(i.svgElement,Y1,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:11,vars:7,consts:[["svgSlider",""],[3,"text","color"],["kipResizeObserver","",1,"widgets-container",3,"resizeChange"],["width","100%","height","100%","viewBox","0 40 200 40"],["width","160","height","8","rx","4.5","id","rect3","x","20","y","56",1,"slider-bg-bar",2,"display","inline","stroke-width","1.57144"],["height","8","rx","4.5","id","rect3","x","20","y","56",2,"display","inline","stroke-width","1.57144"],["id","g22"],["cy","60","fill","#ffffff","id","circle3","r","19.549999",2,"display","inline","fill","#4d4d4d","fill-opacity","1","stroke","#8c8c8c","stroke-width","0.9","stroke-dasharray","none","stroke-opacity","1"],["cy","60","fill","#ffffff","id","circle3-3","r","17.950001",2,"display","inline","fill","#ffffff","fill-opacity","1","stroke","#e6e6e6","stroke-width","1.8","stroke-dasharray","none","stroke-opacity","0.97"],["cursor","pointer","width","200","height","40","x","0","y","40",2,"display","inline","fill","rgba(0, 0, 0, 0)","stroke","none","stroke-width","0.3","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0",3,"pointerdown","pointerup","pointermove","pointerleave"],[1,"widgetOverlay"]],template:function(t,i){if(t&1&&(F(0,"widget-title",1),d(1,"div",2),U("resizeChange",function(){return i.onResized()}),ie(),d(2,"svg",3),F(3,"rect",4)(4,"rect",5),d(5,"g",6),F(6,"circle",7)(7,"circle",8),u(),d(8,"rect",9,0),U("pointerdown",function(r){return i.onPointerDown(r)})("pointerup",function(){return i.onPointerUp()})("pointermove",function(r){return i.onPointerMove(r)})("pointerleave",function(){return i.onPointerLeave()}),u()(),I(10,Z1,1,0,"div",10),u()),t&2){let a;O("text",i.runtime==null||(a=i.runtime.options())==null?null:a.displayName)("color",i.labelColor()),g(4),J("width",i.lineWidth)("fill",i.barColor()),g(2),J("cx",i.handlePosition),g(),J("cx",i.handlePosition),g(3),N(i.dashboard.isDashboardStatic()?-1:10)}},dependencies:[jt,Zn],styles:[".widgets-container[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;z-index:20;padding:0 20px}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}.slider-bg-bar[_ngcontent-%COMP%]{fill:var(--mat-sys-inverse-on-surface)}"]})}return n})();var Q1=["gaugeBarAnimate"];function X1(n,o){if(n&1&&(ie(),Q(0,"rect",14)),n&2){let e=o.$implicit,t=k();J("fill",e.color)("x",5+(e.from-t.gaugeMinValue())*t.scaleSliceValue())("width",(e.to-e.from)*t.scaleSliceValue())}}var Lm=(()=>{class n{gaugeBarAnimate=pe("gaugeBarAnimate");displayName=x.required();displayNameColor=x.required();dataValue=x.required();dataValueLabel=x.required();unitLabel=x.required();barColor=x.required();barColorGradient=x.required();barColorBackground=x.required();gaugeMinValue=x.required();gaugeMaxValue=x.required();highlights=x.required();scaleSliceValue=K(()=>{let e=this.gaugeMaxValue()-this.gaugeMinValue();return e!==0?195/e:0});newGaugeValue=_(null);oldGaugeValue=_(null);firstRenderApplied=!1;scheduleRafId=null;constructor(){L(()=>{let e=this.gaugeMinValue(),t=this.dataValue();t==null&&(t=e);let i=(t-e)*this.scaleSliceValue();B(()=>{let a=this.newGaugeValue();!this.firstRenderApplied||a===null?(this.oldGaugeValue.set(i),this.newGaugeValue.set(i),this.firstRenderApplied=!0):(this.oldGaugeValue.set(a),this.newGaugeValue.set(i)),this.gaugeBarAnimate()?.nativeElement&&(this.scheduleRafId!==null&&cancelAnimationFrame(this.scheduleRafId),this.scheduleRafId=requestAnimationFrame(()=>{let r=this.gaugeBarAnimate();r?.nativeElement&&r.nativeElement.beginElement(),this.scheduleRafId=null}))})})}ngOnDestroy(){this.scheduleRafId!==null&&(cancelAnimationFrame(this.scheduleRafId),this.scheduleRafId=null)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["svg-simple-linear-gauge"]],viewQuery:function(t,i){t&1&&Me(i.gaugeBarAnimate,Q1,5),t&2&&ke()},inputs:{displayName:[1,"displayName"],displayNameColor:[1,"displayNameColor"],dataValue:[1,"dataValue"],dataValueLabel:[1,"dataValueLabel"],unitLabel:[1,"unitLabel"],barColor:[1,"barColor"],barColorGradient:[1,"barColorGradient"],barColorBackground:[1,"barColorBackground"],gaugeMinValue:[1,"gaugeMinValue"],gaugeMaxValue:[1,"gaugeMaxValue"],highlights:[1,"highlights"]},decls:26,vars:11,consts:[["gaugeBarAnimate",""],["viewBox","0 0 205 50","preserveAspectRatio","xMidYMid","version","1.1","id","svg8",1,"svg-simple-linear"],["id","defs2"],["id","gaugeBarGradient"],["id","stop849","offset","0",2,"stop-opacity","1"],["id","stop851","offset","0.40",2,"stop-opacity","0"],["id","linearGradient855","gradientTransform","translate(5,-30)","gradientUnits","userSpaceOnUse","y2","34.5","x2","-5","y1","34.5","x1","-6","href","#gaugeBarGradient"],["id","layer1",2,"display","inline"],["id","GaugeBackground","width","195","height","9","x","5","y","30","ry","0",2,"opacity","1","fill-opacity","1","stroke","none","stroke-width","0.265899","stroke-miterlimit","4","stroke-dasharray","none","stroke-opacity","1"],["id","gaugeBar"],["id","gaugeValue","width","1","height","9","x","0","y","0","ry","0",2,"mix-blend-mode","normal","fill-opacity","1","stroke","none"],["id","gaugeValueGradient","transform","scale(-1,1)","width","1","height","9","x","-1","y","0","ry","0",2,"display","inline","opacity","1","mix-blend-mode","multiply","fill","url(#linearGradient855)","stroke","none"],[0,"xlink","href","#gaugeBar","transform","translate(5,30)"],["attributeName","transform","type","scale","begin","indefinite","dur","0.5s","additive","sum","fill","freeze"],["y","39.5","height","0.75","ry","0",2,"opacity","1","fill-opacity","1","stroke","none","stroke-width","0.265899","stroke-miterlimit","4","stroke-dasharray","none","stroke-opacity","1"],["id","layer2",2,"display","inline"],[0,"xml","space","preserve","x","4.1731763","y","25.413595","id","displayNameText",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","12.7px","line-height","1.25","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","letter-spacing","0px","word-spacing","0px"],["id","tspan1945","x","4.1731763","y","25.413595",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","12.7px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["text-anchor","end","id","gaugeTexts","y","25.293016","x","200.37138",0,"xml","space","preserve",1,"simpleLinear-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","22.5778px","line-height","1.25","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","letter-spacing","0px","word-spacing","0px"],["y","25.293016","x","200.37138","id","valueText",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","22.5778px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["dy","-9","id","unitText",2,"text-transform","capitalize","font-size","9.87778px"]],template:function(t,i){t&1&&(ie(),D(0,"svg",1)(1,"defs",2)(2,"linearGradient",3),Q(3,"stop",4)(4,"stop",5),R(),Q(5,"linearGradient",6),R(),D(6,"g",7),Q(7,"rect",8),D(8,"defs")(9,"g",9),Q(10,"rect",10)(11,"rect",11),R()(),D(12,"use",12),Q(13,"animateTransform",13,0),R(),xe(15,X1,1,3,":svg:rect",14,Ne),R(),D(17,"g",15)(18,"text",16)(19,"tspan",17),c(20),R()(),D(21,"text",18)(22,"tspan",19),c(23),R(),D(24,"tspan",20),c(25),R()()()()),t&2&&(g(3),J("stop-color",i.barColorGradient()),g(),J("stop-color",i.barColorGradient()),g(3),J("fill",i.barColorBackground()),g(5),be("fill",i.barColor()),g(),J("from",i.oldGaugeValue()+" 1")("to",i.newGaugeValue()+" 1"),g(2),Ce(i.highlights()),g(4),J("fill",i.displayNameColor()),g(),ge(" ",i.displayName()),g(3),X(i.dataValueLabel()),g(2),X(i.unitLabel()))},styles:["svg[_ngcontent-%COMP%]{position:absolute;height:100%;width:100%;left:0;top:0}.simpleLinear-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}"]})}return n})();var ci=(()=>{class n{metaWidget=x();dataService=y(Wt);destroyRef=y(Ze);_metaConfig=_(void 0);_meta=_(null);reset$=new zt;currentSub;pathSignature;zones=K(()=>this._meta()?.zones||[]);possibleValues=K(()=>this._meta()?.possibleValues||[]);supportsPut=K(()=>this._meta()?.supportsPut||!1);observe(e){let t=this._metaConfig();if(!t?.paths||Object.keys(t.paths).length===0)return;let i=e??Object.keys(t.paths)[0],a=t.paths[i]?.path;if(!a)return;let r=a;this.pathSignature!==r&&(this.pathSignature=r,this.subscribePathMeta(a))}subscribePathMeta(e){this.currentSub&&(this.currentSub.unsubscribe(),this.currentSub=void 0);let t=this.dataService.getPathMetaObservable(e).pipe(kr(this.reset$),$e(this.destroyRef)).subscribe(i=>{this._meta.set(i)});this.currentSub=t}setMetaConfig(e){this._metaConfig.set(e)}applyMetaConfigDiff(e){this._metaConfig.set(e),this.pathSignature&&this.observe()}reset(){this.reset$.next(),this.reset$.complete(),this.reset$=new zt,this.currentSub&&(this.currentSub.unsubscribe(),this.currentSub=void 0),this.pathSignature=void 0,this._meta.set(null)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Ot({type:n,selectors:[["","widget-metadata",""]],inputs:{metaWidget:[1,"metaWidget"]},exportAs:["widgetMetadata"]})}return n})();function uo(n,o,e,t,i,a,r=!1){let s=[],l=[...n].sort((m,f)=>(m.lower??-1/0)-(f.lower??-1/0));for(let m of l){let f=null,b=null,A;switch(m.state){case Ae.Emergency:A=o.zoneEmergency;break;case Ae.Alarm:A=o.zoneAlarm;break;case Ae.Warn:A=o.zoneWarn;break;case Ae.Alert:A=o.zoneAlert;break;case Ae.Nominal:A=o.zoneNominal;break;default:A="rgba(0,0,0,0)"}if(m.lower==null?f=i:f=t.convertToUnit(e,m.lower),m.upper==null?b=a:b=t.convertToUnit(e,m.upper),!(!Number.isFinite(f)||!Number.isFinite(b))&&!(b<i||f>a)){if(f=Math.max(f,i),b>a){b=a,s.push({from:f,to:b,color:A});break}s.push({from:f,to:b,color:A})}}return r&&(s=s.map(m=>({from:a-m.to,to:a-m.from,color:m.color}))),s}var Wm=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Gauge Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",isPathConfigurable:!0,showPathSkUnitsFilter:!0,pathSkUnitsFilter:"V",convertUnitTo:"V",sampleTime:500}},displayScale:{lower:0,upper:15,type:"linear"},gauge:{type:"simpleLinear",unitLabelFormat:"full"},numInt:1,numDecimal:2,ignoreZones:!1,color:"contrast",enableTimeout:!1,dataTimeout:5};runtime=y(we);streams=y(Le);metadata=y(ci,{optional:!0});unitsService=y(at);unitsLabel=_("");dataLabelValue=_("0");dataValue=_(null);barColor=_("");barColorGradient=_("");barColorBackground=_("");highlights=K(()=>{let e=this.runtime.options(),t=this.theme();if(!e||!t)return[];if(e.ignoreZones||!this.metadata)return[];let i=this.metadata.zones();if(!i?.length)return[];let a=e.paths.gaugePath.convertUnitTo,r=e.displayScale.lower,s=e.displayScale.upper;return uo(i,t,a,this.unitsService,r,s)});lastState=null;constructor(){L(()=>{let e=this.runtime.options(),t=e?.paths?.gaugePath?.path;!e||!t||B(()=>{this.streams.observe("gaugePath",a=>{let r=this.theme();if(!e||!r)return;let s=a?.data?.value;if(s==null)this.dataValue.set(e.displayScale.lower),this.dataLabelValue.set("--");else{let l=Math.min(Math.max(s,e.displayScale.lower),e.displayScale.upper);this.dataValue.set(l),this.dataLabelValue.set(l.toFixed(e.numDecimal))}if(!e.ignoreZones){let l=a?.state;if(l&&l!==this.lastState)switch(this.lastState=l,l){case Ae.Alarm:this.barColor.set(r.zoneAlarm);break;case Ae.Warn:this.barColor.set(r.zoneWarn);break;case Ae.Alert:this.barColor.set(r.zoneAlert);break;case Ae.Nominal:this.barColor.set(r.zoneNominal);break;default:this.barColor.set(Te(e.color,r).color);break}}});let i=e.paths.gaugePath.convertUnitTo;this.unitsLabel.set(e.gauge.unitLabelFormat==="abr"?i?.substring(0,1):i)})}),L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||B(()=>{this.barColorBackground.set(t.background);let i=Te(e.color,t);if(e.ignoreZones)this.barColor.set(i.color);else if(this.lastState)switch(this.lastState){case Ae.Alarm:this.barColor.set(t.zoneAlarm);break;case Ae.Warn:this.barColor.set(t.zoneWarn);break;case Ae.Alert:this.barColor.set(t.zoneAlert);break;case Ae.Nominal:this.barColor.set(t.zoneNominal);break;default:this.barColor.set(i.color);break}else this.barColor.set(i.color);this.barColorGradient.set(i.dimmer||i.dim||i.color)})}),L(()=>{let e=this.runtime.options();!e||e.ignoreZones||!this.metadata||B(()=>this.metadata.observe("gaugePath"))})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-simple-linear"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:1,vars:11,consts:[[1,"simpleLinearGaugeContainer",3,"displayName","displayNameColor","unitLabel","dataValue","dataValueLabel","barColor","barColorGradient","barColorBackground","gaugeMaxValue","gaugeMinValue","highlights"]],template:function(t,i){if(t&1&&F(0,"svg-simple-linear-gauge",0),t&2){let a,r=i.runtime.options();O("displayName",r.displayName)("displayNameColor",(a=i.theme())==null?null:a.contrastDim)("unitLabel",i.unitsLabel())("dataValue",i.dataValue())("dataValueLabel",i.dataLabelValue())("barColor",i.barColor())("barColorGradient",i.barColorGradient())("barColorBackground",i.barColorBackground())("gaugeMaxValue",r.displayScale.upper)("gaugeMinValue",r.displayScale.lower)("highlights",i.highlights())}},dependencies:[Lm],styles:[".simpleLinearGaugeContainer[_ngcontent-%COMP%]{display:block;position:relative;height:100%;width:100%;padding:0}"]})}return n})();var J1=["rotatingDial"],eA=["twaIndicator"],tA=["wptIndicator"],iA=["setIndicator"],nA=["tackIndicator"],Fm=([n,o],[e,t],[i,a])=>(Math.atan2(a-t,i-e)-Math.atan2(o-t,n-e)+3*Math.PI)%(2*Math.PI)-Math.PI,Gm=(()=>{class n{rotatingDial=pe.required("rotatingDial");twaIndicator=pe.required("twaIndicator");wptIndicator=pe.required("wptIndicator");setIndicator=pe.required("setIndicator");tackIndicator=pe.required("tackIndicator");compassHeading=x.required();tackTrue=x.required();polarSpeedRatio=x.required();trueWindAngle=x.required();trueWindSpeed=x.required();targetAngle=x.required();optimalWindAngle=x.required();targetVMG=x.required();VMG=x.required();sailSetupEnabled=x.required();driftEnabled=x.required();driftSet=x(void 0);driftFlow=x(void 0);waypointEnabled=x.required();waypointAngle=x(void 0);vmgToWaypoint=x(void 0);trueWindMinHistoric=x(void 0);trueWindMidHistoric=x(void 0);trueWindMaxHistoric=x(void 0);gradianColor=x.required();compass={oldValue:0,newValue:0};twa={oldValue:0,newValue:0};wpt={oldValue:0,newValue:0};tack={oldValue:0,newValue:0};set={oldValue:0,newValue:0};compassInitialized=!1;twaInitialized=!1;wptInitialized=!1;tackInitialized=!1;setInitialized=!1;laylinesInitialized=!1;headingValue=_("--");windSectorsInitialized=!1;trueWindHeading=0;nextTargetDirection=K(()=>{let e=this.compassHeading(),t=this.tackTrue();return e==null||t==null?0:this.unsignedAngleDelta(e,t)});trueWindSpeedDisplay=K(()=>{let e=this.trueWindSpeed();return e==null?"--":e.toFixed(1)});windAnglePerformanceRatioColor=K(()=>{let e=this.optimalWindAngle(),t=this.targetAngle(),i=this.gradianColor().start,a=this.gradianColor().stop;if(e==null||t==null)return i;let r=1-Math.abs(e-t)/180;return this.interpolateColor(i,a,r)});targetVMGOffset=K(()=>{let e=this.VMG(),t=this.targetVMG();return e==null||t==null?"--":(e-t).toFixed(1)});targetVMGOffsetRatioColor=K(()=>{let e=this.VMG(),t=this.targetVMG(),i=this.gradianColor().start,a=this.gradianColor().stop;if(e==null||t==null)return i;let r=e/t;return this.interpolateColor(i,a,r)});waypointActive=_(!1);flow=K(()=>{let e=this.driftFlow();return e==null?"--":e.toFixed(1)});portLaylinePrev=0;stbdLaylinePrev=0;portLaylineAnimId=null;stbdLaylineAnimId=null;CENTER_X=600;CENTER_Y=620;RADIUS=540;ANIMATION_DURATION=1e3;laylinePortPath=_(`M ${this.CENTER_X},${this.CENTER_Y} ${this.CENTER_X},${this.CENTER_Y}`);laylineStbdPath=_(`M ${this.CENTER_X},${this.CENTER_Y} ${this.CENTER_X},${this.CENTER_Y}`);portSectorPrev={min:0,mid:0,max:0};stbdSectorPrev={min:0,mid:0,max:0};portSectorAnimId=null;stbdSectorAnimId=null;portWindSectorPath=_("");stbdWindSectorPath=_("");speedLineTipY=_(620);speedTipPoints=_("600,570 580,600 620,600");speedRatioColor=_("");speedLinePrevRatio=0;speedLinePrevTipY=600;speedLineAnimId=null;speedLineInitialized=!1;animationFrameIds=new WeakMap;ngZone=y(Be);setRotationImmediate(e,t){e.setAttribute("transform",`rotate(${t} 600 620)`)}constructor(){L(()=>{let e=this.waypointEnabled();B(()=>{this.waypointActive.set(e)})}),L(()=>{let e=this.compassHeading(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&B(()=>{this.compassInitialized?(this.compass.oldValue=this.compass.newValue,this.compass.newValue=t):(this.compass.oldValue=t,this.compass.newValue=t,this.compassInitialized=!0),this.headingValue.set(t.toString()),this.rotatingDial()?.nativeElement&&(this.compass.oldValue===this.compass.newValue?this.setRotationImmediate(this.rotatingDial().nativeElement,-this.compass.newValue):$t(this.rotatingDial().nativeElement,-this.compass.oldValue,-this.compass.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone),this.updateWindSectors())})}),L(()=>{let e=this.targetAngle(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&B(()=>{this.tackInitialized?(this.tack.oldValue=this.tack.newValue,this.tack.newValue=t):(this.tack.oldValue=t,this.tack.newValue=t,this.tackInitialized=!0),this.tackIndicator()?.nativeElement&&(this.tack.oldValue===this.tack.newValue?this.setRotationImmediate(this.tackIndicator().nativeElement,this.tack.newValue):$t(this.tackIndicator().nativeElement,this.tack.oldValue,this.tack.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620])),this.updateLaylines()})}),L(()=>{let e=this.waypointAngle();B(()=>{if(!e){this.waypointActive.set(!1);return}this.waypointEnabled()?this.waypointActive.set(!0):this.waypointActive.set(!1),this.wptInitialized?(this.wpt.oldValue=this.wpt.newValue,this.wpt.newValue=e):(this.wpt.oldValue=e,this.wpt.newValue=e,this.wptInitialized=!0),this.wptIndicator()?.nativeElement&&(this.wpt.oldValue===this.wpt.newValue?this.setRotationImmediate(this.wptIndicator().nativeElement,this.wpt.newValue):$t(this.wptIndicator().nativeElement,this.wpt.oldValue,this.wpt.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620]))})}),L(()=>{let e=this.trueWindAngle(),t=Number.isFinite(e)?Math.round(e):null,i=this.compassHeading(),a=Number.isFinite(i)?Math.round(i):null;t==null||a==null||B(()=>{this.trueWindHeading=t;let r=this.addHeading(this.trueWindHeading,a*-1);this.twaInitialized?(this.twa.oldValue=this.twa.newValue,this.twa.newValue=r):(this.twa.oldValue=r,this.twa.newValue=r,this.twaInitialized=!0),this.twaIndicator()?.nativeElement&&(this.twa.oldValue===this.twa.newValue?this.setRotationImmediate(this.twaIndicator().nativeElement,this.twa.newValue):$t(this.twaIndicator().nativeElement,this.twa.oldValue,this.twa.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone),this.updateLaylines())})}),L(()=>{let e=this.polarSpeedRatio(),t=Math.max(0,Math.min(1,e)),i=620,r=i-166,s=i-r*t;if(!this.speedLineInitialized){this.speedLineInitialized=!0,this.speedLineTipY.set(s);let l=30,m=20,f=s-l;this.speedTipPoints.set(`600,${f} ${600-m},${s} ${600+m},${s}`),this.speedRatioColor.set(this.interpolateColor(this.gradianColor().start,this.gradianColor().stop,t)),this.speedLinePrevTipY=s,this.speedLinePrevRatio=t;return}this.animateSpeedLine(this.speedLinePrevTipY,s),this.speedLinePrevTipY=s,this.speedLinePrevRatio=t}),L(()=>{let e=this.driftSet(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&B(()=>{this.setInitialized?(this.set.oldValue=this.set.newValue,this.set.newValue=t):(this.set.oldValue=t,this.set.newValue=t,this.setInitialized=!0),this.setIndicator()?.nativeElement&&(this.set.oldValue===this.set.newValue?this.setRotationImmediate(this.setIndicator().nativeElement,this.set.newValue):$t(this.setIndicator().nativeElement,this.set.oldValue,this.set.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone))})})}updateLaylines(){if(!this.twaInitialized)return;let e=this.targetAngle(),t=Number.isFinite(e)?Math.round(e):null;if(t==null)return;t=t/2;let i=Number(this.twa.newValue),a=i-t,r=i+t;if(!this.laylinesInitialized){this.laylinesInitialized=!0,this.setLaylinePath(a,!0),this.setLaylinePath(r,!1),this.portLaylinePrev=a,this.stbdLaylinePrev=r;return}this.animateLayline(this.portLaylinePrev,a,!0),this.portLaylinePrev=a,this.animateLayline(this.stbdLaylinePrev,r,!1),this.stbdLaylinePrev=r}animateLayline(e,t,i){i&&this.portLaylineAnimId&&cancelAnimationFrame(this.portLaylineAnimId),!i&&this.stbdLaylineAnimId&&cancelAnimationFrame(this.stbdLaylineAnimId);let a=()=>{i?this.portLaylineAnimId=null:this.stbdLaylineAnimId=null},r=xs(e,t,this.ANIMATION_DURATION,s=>this.setLaylinePath(s,i),a,this.ngZone);i?this.portLaylineAnimId=r:this.stbdLaylineAnimId=r}updateWindSectors(){if(this.trueWindMinHistoric()==null||this.trueWindMidHistoric()==null||this.trueWindMaxHistoric()==null)return;let e={min:this.trueWindMinHistoric(),mid:this.trueWindMidHistoric(),max:this.trueWindMaxHistoric()},t={min:this.trueWindMinHistoric(),mid:this.trueWindMidHistoric(),max:this.trueWindMaxHistoric()};if(!this.windSectorsInitialized){this.portSectorPrev=e,this.stbdSectorPrev=t,this.windSectorsInitialized=!0,this.animateWindSector(e,e,!0),this.animateWindSector(t,t,!1);return}this.animateWindSector(this.portSectorPrev,e,!0),this.animateWindSector(this.stbdSectorPrev,t,!1),this.portSectorPrev=e,this.stbdSectorPrev=t}animateWindSector(e,t,i){i&&this.portSectorAnimId&&cancelAnimationFrame(this.portSectorAnimId),!i&&this.stbdSectorAnimId&&cancelAnimationFrame(this.stbdSectorAnimId);let a=()=>{i?this.portSectorAnimId=null:this.stbdSectorAnimId=null},r=Cs(e,t,this.ANIMATION_DURATION,s=>this.setWindSectorPath(s,i),a,this.ngZone);i?this.portSectorAnimId=r:this.stbdSectorAnimId=r}animateSpeedLine(e,t){this.speedLineAnimId&&(cancelAnimationFrame(this.speedLineAnimId),this.speedLineAnimId=null);let i=1e3,a=performance.now(),r=this.speedLinePrevRatio,s=(600-t)/454,l=f=>f<.5?4*f*f*f:1-Math.pow(-2*f+2,3)/2,m=f=>{let b=f-a,A=Math.min(b/i,1),C=l(A),w=(Y,j)=>Y+(j-Y)*C,M=w(e,t),G=w(r,s);this.speedLineTipY.set(M);let E=30,W=20,V=M-E;this.speedTipPoints.set(`600,${V} ${600-W},${M} ${600+W},${M}`),this.speedRatioColor.set(this.interpolateColor(this.gradianColor().start,this.gradianColor().stop,G)),A<1?this.speedLineAnimId=requestAnimationFrame(m):this.speedLineAnimId=null};requestAnimationFrame(m)}interpolateColor(e,t,i){i=Math.max(0,Math.min(1,i));function a(M){M=M.replace("#",""),M.length===3&&(M=M.split("").map(E=>E+E).join(""));let G=parseInt(M,16);return[G>>16&255,G>>8&255,G&255]}let[r,s,l]=a(e),[m,f,b]=a(t),A=Math.round(r+(m-r)*i),C=Math.round(s+(f-s)*i),w=Math.round(l+(b-l)*i);return`rgb(${A},${C},${w})`}addHeading(e=0,t=0){return((e+t)%360+360)%360}unsignedAngleDelta(e,t){let i=(e-t+540)%360-180;return Math.abs(i)}normalizeAngle(e){return(e%360+360)%360}setLaylinePath(e,t){let i=this.normalizeAngle(e)*Math.PI/180,a=Math.floor(this.RADIUS*Math.sin(i)+this.CENTER_X),r=Math.floor(this.RADIUS*Math.cos(i)*-1+this.CENTER_Y);t?this.laylinePortPath.set(`M ${this.CENTER_X},${this.CENTER_Y} L ${a},${r}`):this.laylineStbdPath.set(`M ${this.CENTER_X},${this.CENTER_Y} L ${a},${r}`)}setWindSectorPath(e,t){let i=this.addHeading(this.addHeading(e.min,Number(this.compass.newValue)*-1),this.targetAngle()/2*(t?-1:1)),a=this.addHeading(this.addHeading(e.mid,Number(this.compass.newValue)*-1),this.targetAngle()/2*(t?-1:1)),r=this.addHeading(this.addHeading(e.max,Number(this.compass.newValue)*-1),this.targetAngle()/2*(t?-1:1)),s=this.RADIUS*Math.sin(i*Math.PI/180)+this.CENTER_X,l=this.RADIUS*Math.cos(i*Math.PI/180)*-1+this.CENTER_Y,m=this.RADIUS*Math.sin(a*Math.PI/180)+this.CENTER_X,f=this.RADIUS*Math.cos(a*Math.PI/180)*-1+this.CENTER_Y,b=this.RADIUS*Math.sin(r*Math.PI/180)+this.CENTER_X,A=this.RADIUS*Math.cos(r*Math.PI/180)*-1+this.CENTER_Y,C=Math.abs(Fm([s,l],[m,f],[b,A]))>Math.PI/2?0:1,w=Fm([b,A],[s,l],[m,f])>0?0:1,M=`M ${this.CENTER_X},${this.CENTER_Y} L ${s},${l} A ${this.RADIUS},${this.RADIUS} 0 ${C} ${w} ${b},${A} z`;t?this.portWindSectorPath.set(M):this.stbdWindSectorPath.set(M)}ngOnDestroy(){this.portLaylineAnimId&&cancelAnimationFrame(this.portLaylineAnimId),this.stbdLaylineAnimId&&cancelAnimationFrame(this.stbdLaylineAnimId),this.portLaylineAnimId=null,this.stbdLaylineAnimId=null,this.portSectorAnimId&&cancelAnimationFrame(this.portSectorAnimId),this.stbdSectorAnimId&&cancelAnimationFrame(this.stbdSectorAnimId),this.portSectorAnimId=null,this.stbdSectorAnimId=null;let e=[this.rotatingDial(),this.twaIndicator(),this.wptIndicator(),this.setIndicator()];for(let t of e){let i=t?.nativeElement;if(!i)continue;let a=this.animationFrameIds.get(i);a&&cancelAnimationFrame(a),this.animationFrameIds.delete(i)}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["svg-racesteer"]],viewQuery:function(t,i){t&1&&Me(i.rotatingDial,J1,5)(i.twaIndicator,eA,5)(i.wptIndicator,tA,5)(i.setIndicator,iA,5)(i.tackIndicator,nA,5),t&2&&ke(5)},inputs:{compassHeading:[1,"compassHeading"],tackTrue:[1,"tackTrue"],polarSpeedRatio:[1,"polarSpeedRatio"],trueWindAngle:[1,"trueWindAngle"],trueWindSpeed:[1,"trueWindSpeed"],targetAngle:[1,"targetAngle"],optimalWindAngle:[1,"optimalWindAngle"],targetVMG:[1,"targetVMG"],VMG:[1,"VMG"],sailSetupEnabled:[1,"sailSetupEnabled"],driftEnabled:[1,"driftEnabled"],driftSet:[1,"driftSet"],driftFlow:[1,"driftFlow"],waypointEnabled:[1,"waypointEnabled"],waypointAngle:[1,"waypointAngle"],vmgToWaypoint:[1,"vmgToWaypoint"],trueWindMinHistoric:[1,"trueWindMinHistoric"],trueWindMidHistoric:[1,"trueWindMidHistoric"],trueWindMaxHistoric:[1,"trueWindMaxHistoric"],gradianColor:[1,"gradianColor"]},decls:174,vars:39,consts:[["rotatingDial",""],["tackIndicator",""],["twaIndicator",""],["wptIndicator",""],["setIndicator",""],["viewBox","0 0 1200 1200"],["id","defs1"],["id","linearGradient18"],["offset","0",1,"boat",2,"stop-opacity","0.71372495"],["offset","1",1,"boat",2,"stop-opacity","0"],["id","linearGradient16"],["id","linearGradient13"],["offset","0.41176471",1,"drift-arrow",2,"stop-opacity","1"],["offset","1",1,"drift-arrow",2,"stop-opacity","0"],["id","swatch4"],["offset","0","id","stop4",2,"stop-color","#000000","stop-opacity","1"],["clipPathUnits","userSpaceOnUse","id","clipPath16"],["id","ellipse16","cx","311.24539","cy","-1516.3778","rx","194.27342","ry","181.83022",2,"display","inline","fill","#9a9300","fill-opacity","1","stroke","none","stroke-width","55","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],["id","linearGradient14",0,"xlink","href","#linearGradient13","x1","453.48047","y1","583.62891","x2","638.11328","y2","583.62891","gradientUnits","userSpaceOnUse","gradientTransform","matrix(0.00723393,1.2388183,-1.0538241,0.00615367,1211.2051,-79.73465)"],["id","linearGradient17",0,"xlink","href","#linearGradient16","x1","-502.04896","y1","439.35551","x2","-316","y2","439.35551","gradientUnits","userSpaceOnUse","gradientTransform","translate(0,49.000266)"],["id","linearGradient19",0,"xlink","href","#linearGradient18","x1","495.83999","y1","439.35551","x2","681.88895","y2","439.35551","gradientUnits","userSpaceOnUse","gradientTransform","translate(0,49.000266)"],["id","layerBackground","transform","translate(100,100)",2,"display","inline"],["id","boat",2,"display","inline"],["id","portSide","d","M 498.75049,208.89453 A 267.09439,554.67401 0 0 1 678.45974,767.81661",2,"fill","none","fill-opacity","1","stroke","url(#linearGradient19)","stroke-width","5.821","stroke-linecap","round","stroke-miterlimit","0","stroke-dasharray","none"],["id","starboardSide","d","m -499.13846,208.89453 a 267.09439,554.67401 0 0 1 179.70925,558.92208","transform","scale(-1,1)",2,"fill","none","fill-opacity","1","stroke","url(#linearGradient17)","stroke-width","5.821","stroke-linecap","round","stroke-miterlimit","0","stroke-dasharray","none"],["id","layerCompass"],["id","fixedDial"],["id","dialBackground","cx","600","cy","620","r","516",1,"fixed-dial-background",2,"display","inline","stroke-width","46"],["id","barsAndText","transform","scale(1.1) translate(45,64)",1,"contrast-stroke",2,"display","inline"],["d","m 416.35095,19.837399 2.78142,15.77426","id","path199",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 334.23173,41.658798 5.47834,15.051615","id","path200",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 260.27336,81.806174 12.55151,21.739856","id","path37",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 187.44581,126.00035 10.29591,12.2702","id","path197",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 127.23918,185.95785 12.27019,10.29591","id","path198",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 83.252815,257.66724 21.739865,12.55151","id","path166",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 42.289518,332.39273 15.05162,5.47835","id","path195",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 20.127799,414.42077 15.774251,2.78142","id","path196",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 17.879075,498.47765 H 42.982096","id","path167",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 19.776759,583.71187 15.77426,-2.78142","id","path193",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 41.598167,665.8311 15.051615,-5.47834","id","path194",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 81.668963,739.71246 103.40883,727.16095","id","path168",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 125.93981,812.61701 12.2702,-10.29591","id","path191",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 185.89732,872.82365 10.29591,-12.27019","id","path192",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 257.53004,916.73298 12.55151,-21.73985","id","path169",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 332.33219,957.7732 5.47835,-15.05162","id","path189",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 414.36024,979.93493 2.78142,-15.77425","id","path190",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 498.34046,982.10672 V 957.0037","id","path170",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 583.65133,980.28596 580.86991,964.5117","id","path187",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 665.77057,958.46456 -5.47834,-15.05161","id","path188",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 739.57526,918.31683 727.02375,896.57698","id","path171",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 812.55647,874.12301 802.26056,861.85282","id","path185",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 872.76312,814.16551 860.49293,803.8696","id","path186",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 916.59579,742.45577 894.85593,729.90426","id","path172",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 957.71266,667.73063 -15.05161,-5.47834","id","path183",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 979.8744,585.70259 -15.77425,-2.78142","id","path184",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 981.96954,501.64535 -25.10304,10e-6","id","path173",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 980.22542,416.41149 -15.77425,2.78143","id","path181",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 958.40403,334.29226 -15.05161,5.47834","id","path182",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 918.17964,260.41055 -21.73986,12.55151","id","path174",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 874.06247,187.50636 -12.27018,10.29591","id","path180",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 817.34594,130.05494 -10.40259,12.17987","id","path179",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 742.31857,83.390025 729.76706,105.12988","id","path175",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 667.6701,42.350172 -5.47834,15.051615","id","path178",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 585.64206,20.188432 -2.78142,15.77425","id","path176",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 501.50816,18.016286 V 43.119307","id","path177",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],[0,"xml","space","preserve","x","181.91386","y","284.25186","id","text3","transform","rotate(-30)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan3","x","181.91386","y","284.25186",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-183.53558","y","283.74811","id","text14","transform","rotate(-60)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan14","x","-183.53558","y","283.74811",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-499.70761","y","100.95312","id","text15","transform","rotate(-90)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan15","x","-499.70761","y","100.95312",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-681.66119","y","-216.36243","id","text16","transform","rotate(-120)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["x","-681.66119","y","-216.36243","id","tspan25",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-681.06616","y","-581.71271","id","text17","transform","rotate(-150)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan17","x","-681.06616","y","-581.71271",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-498.3313","y","-897.40875","id","text18","transform","scale(-1)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan18","x","-498.3313","y","-897.40875",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-184.41313","y","-1080.8452","id","text19","transform","rotate(150)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan19","x","-184.41313","y","-1080.8452",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","181.57225","y","-1080.8853","id","text20","transform","rotate(120)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan20","x","181.57225","y","-1080.8853",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","501.42661","y","-896.93701","id","text21","transform","rotate(90)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan21","x","501.42661","y","-896.93701",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","682.35815","y","-579.63336","id","text22","transform","rotate(60)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan22","x","682.35815","y","-579.63336",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","681.81525","y","-214.27321","id","text23","transform","rotate(30)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan23","x","681.81525","y","-214.27321",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","500.15503","y","101.96342","id","text24",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan24","x","500.15503","y","101.96342",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],["id","LayerWindShift"],["id","portSectorShift",1,"wind-sector-port",2,"fill-opacity","0.4","stroke","none"],["id","StbdSectorShift",1,"wind-sector-stbd",2,"fill-opacity","0.4","stroke","none"],["id","LayerLayline"],["id","PortLayline",1,"portLayline"],["id","StbdLayline",1,"stbdLayline"],["id","layerCounter"],["id","tackCounter"],[0,"xml","space","preserve","x","1062","y","80",1,"tack-label"],["x","936","y","95","width","252","height","100","rx","20",1,"tack-box"],[0,"xml","space","preserve","x","1072","y","175","id","text42",1,"tack-value"],[2,"font-weight","normal"],["id","windVmgCounter"],[0,"xml","space","preserve","x","600","y","780",1,"tack-label"],[0,"xml","space","preserve","x","610","y","850",1,"wind-vmg-value"],[2,"font-weight","normal","font-size","30px"],[0,"xml","space","preserve","x","610","y","890",1,"wind-vmg-offset"],["id","waypointCounter"],[0,"xml","space","preserve","x","1062","y","1030",1,"tack-label"],["x","936","y","1045","width","252","height","140","rx","20",1,"waypoint-box"],[0,"xml","space","preserve","x","1060","y","1100",1,"waypoint-value"],[1,"tack-label"],[0,"xml","space","preserve","x","1060","y","1165",1,"waypoint-value"],["id","layerIndicators",2,"display","inline"],["d","m 606.20767,217.99458 a 6.3888631,8.8250643 0 0 1 -6.38888,8.82508 6.3888631,8.8250643 0 0 1 -6.38888,-8.82508 6.3888631,8.8250643 0 0 1 6.38888,-8.82509 6.3888631,8.8250643 0 0 1 6.38888,8.82509 z M 576.25472,75.811298 593.47058,58.265068 c 3.6173,-3.6867571 9.44162,-3.6867571 13.05892,0 l 17.21586,17.546106 c 3.6173,3.686743 3.6173,9.622786 0,13.309544 l -17.21595,17.54623 c -3.61721,3.686757 -9.44153,3.686757 -13.05893,0 L 576.25472,89.120841 c -3.6174,-3.686743 -3.6174,-9.622924 0,-13.309543 z m 17.20533,-16.510116 h 12.77766 V 218.26408 h -12.77766 z",1,"tack-angle"],["d","m 451.77021,5.469207 42.08541,-33.202814 a 12.555638,12.555638 0.26446337 0 1 15.64423,0.07221 l 42.20046,33.930296 a 15.557694,15.557694 71.53185 0 1 5.32954,15.957795 L 504.17034,230.15629 a 2.5373267,2.5373267 0.02614114 0 1 -4.91879,-0.002 L 446.37431,21.357036 a 15.416336,15.416336 108.75875 0 1 5.3959,-15.887829 z","transform","matrix(0.60410307,0,0,0.70555435,296.91787,121.152867)",1,"true-wind",2,"display","inline","stroke","none","stroke-width","5.8876","stroke-miterlimit","0"],[0,"xml","space","preserve","x","600","y","210","id","text10",1,"card-color",2,"font-weight","bold","font-size","60px","font-family","Roboto","text-align","center","text-anchor","middle","display","inline","stroke","none"],["cx","600","cy","225","rx","23","ry","23",1,"next-waypoint"],["id","layerDirectionSpeed"],["id","directionLine","x1","600","y1","620","x2","600","y2","110",1,"direction-line"],["id","speedLine","x1","600","y1","620","x2","600",1,"speed-line"],["id","speedTip",1,"speed-line"],["id","layerDrift","transform","translate(0, 20)"],["id","setArrow","d","m 663.93337,580.60403 -64.4901,-94.9673 -63.37665,95.71396 58.48691,-30.71299 0.77713,133.08346 c 0.0992,16.99331 2.52916,30.65913 5.44822,30.64209 2.91911,-0.0171 5.18926,-13.71032 5.09001,-30.70362 l -0.77782,-133.20444 z",1,"drift-arrow",2,"fill","url(#linearGradient14)"],["id","text11",0,"xml","space","preserve","x","599.78842","y","623.55145",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-stretch","normal","font-size","66.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],["id","layerHeading"],["id","rect1","width","310","height","117","x","445","y","10","rx","20",1,"heading-box",2,"stroke-width","5","stroke-opacity","0.5"],["x","600","y","110",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","120px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","5","stroke-linejoin","bevel","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],[2,"font-weight","normal","font-size","60px"]],template:function(t,i){t&1&&(ie(),D(0,"svg",5)(1,"defs",6)(2,"linearGradient",7),Q(3,"stop",8)(4,"stop",9),R(),D(5,"linearGradient",10),Q(6,"stop",8)(7,"stop",9),R(),D(8,"linearGradient",11),Q(9,"stop",12)(10,"stop",13),R(),D(11,"linearGradient",14),Q(12,"stop",15),R(),D(13,"clipPath",16),Q(14,"ellipse",17),R(),Q(15,"linearGradient",18)(16,"linearGradient",19)(17,"linearGradient",20),R(),D(18,"g",21)(19,"g",22),Q(20,"path",23)(21,"path",24),R()(),D(22,"g",25)(23,"g",26),Q(24,"circle",27),R(),D(25,"g",null,0)(27,"g",28),Q(28,"path",29)(29,"path",30)(30,"path",31)(31,"path",32)(32,"path",33)(33,"path",34)(34,"path",35)(35,"path",36)(36,"path",37)(37,"path",38)(38,"path",39)(39,"path",40)(40,"path",41)(41,"path",42)(42,"path",43)(43,"path",44)(44,"path",45)(45,"path",46)(46,"path",47)(47,"path",48)(48,"path",49)(49,"path",50)(50,"path",51)(51,"path",52)(52,"path",53)(53,"path",54)(54,"path",55)(55,"path",56)(56,"path",57)(57,"path",58)(58,"path",59)(59,"path",60)(60,"path",61)(61,"path",62)(62,"path",63)(63,"path",64),D(64,"text",65)(65,"tspan",66),c(66,"330"),R()(),D(67,"text",67)(68,"tspan",68),c(69,"300"),R()(),D(70,"text",69)(71,"tspan",70),c(72,"W"),R()(),D(73,"text",71)(74,"tspan",72),c(75,"240"),R()(),D(76,"text",73)(77,"tspan",74),c(78,"210"),R()(),D(79,"text",75)(80,"tspan",76),c(81,"S"),R()(),D(82,"text",77)(83,"tspan",78),c(84,"150"),R()(),D(85,"text",79)(86,"tspan",80),c(87,"120"),R()(),D(88,"text",81)(89,"tspan",82),c(90,"E"),R()(),D(91,"text",83)(92,"tspan",84),c(93,"60"),R()(),D(94,"text",85)(95,"tspan",86),c(96,"30"),R()(),D(97,"text",87)(98,"tspan",88),c(99,"N"),R()()()()(),D(100,"g",89),Q(101,"path",90)(102,"path",91),R(),D(103,"g",92),Q(104,"path",93)(105,"path",94),R(),D(106,"g",95)(107,"g",96)(108,"text",97),c(109,"Tack/Gybe"),R(),Q(110,"rect",98),D(111,"text",99),c(112),lt(113,"number"),D(114,"tspan",100),c(115,"\xB0"),R()()(),D(116,"g",101)(117,"text",102),c(118,"Wind VMG"),R(),D(119,"text",103),c(120),D(121,"tspan",104),c(122," kts"),R()(),D(123,"text",105),c(124),D(125,"tspan",104),c(126," kts"),R()()(),D(127,"g",106)(128,"text",107),c(129,"Waypoint"),R(),Q(130,"rect",108),D(131,"text",109)(132,"tspan",110),c(133,"VMG: "),R(),c(134),D(135,"tspan",104),c(136," kts"),R()(),D(137,"text",111)(138,"tspan",110),c(139,"HDG: "),R(),c(140),D(141,"tspan",100),c(142,"\xB0"),D(143,"tspan",104),c(144,"T"),R()()()()(),D(145,"g",112)(146,"g",null,1),Q(148,"path",113),R(),D(149,"g",null,2),Q(151,"path",114),D(152,"text",115),c(153,"T"),R()(),D(154,"g",null,3),Q(156,"ellipse",116),R()(),D(157,"g",117),Q(158,"line",118)(159,"line",119)(160,"polygon",120),R(),D(161,"g",121),Q(162,"path",122,4),D(164,"text",123),c(165),R()(),D(166,"g",124),Q(167,"rect",125),D(168,"text",126),c(169),D(170,"tspan",100),c(171,"\xB0"),D(172,"tspan",127),c(173,"T"),R()()()()()),t&2&&(g(101),be("display",i.portWindSectorPath()!="none"?"inline":"none"),J("d",i.portWindSectorPath()),g(),be("display",i.stbdWindSectorPath()!="none"?"inline":"none"),J("d",i.stbdWindSectorPath()),g(2),be("display",i.trueWindAngle()!=null?"inline":"none"),J("d",i.laylinePortPath()),g(),be("display",i.trueWindAngle()!=null?"inline":"none"),J("d",i.laylineStbdPath()),g(7),ge("",vn(113,36,i.nextTargetDirection(),"1.0-0")," "),g(7),be("fill",i.targetVMGOffsetRatioColor()),g(),X(i.targetVMG()),g(3),be("fill",i.targetVMGOffsetRatioColor()),g(),X(i.targetVMGOffset()),g(10),X(i.vmgToWaypoint()),g(6),X(i.waypointAngle()),g(11),be("fill",i.windAnglePerformanceRatioColor()),g(3),J("display",i.waypointActive()?"inline":"none"),g(5),be("stroke",i.speedRatioColor()),J("y2",i.speedLineTipY()),g(),be("fill",i.speedRatioColor())("stroke",i.speedRatioColor()),J("points",i.speedTipPoints()),g(),be("display",i.driftEnabled()?"inline":"none"),g(4),X(i.flow()),g(4),ge(" ",i.headingValue()))},dependencies:[za],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}svg[_ngcontent-%COMP%]{position:absolute;height:100%;width:100%;left:0;top:0}.fixed-dial-background[_ngcontent-%COMP%]{fill:none;stroke:var(--kip-grey-color)}.rotating-dial-Backplate[_ngcontent-%COMP%]{fill:var(--mat-sys-background)}.starboard[_ngcontent-%COMP%]{stroke:var(--kip-starboard-color)}.port[_ngcontent-%COMP%]{stroke:var(--kip-port-color)}.heading-box[_ngcontent-%COMP%]{stroke:var(--kip-grey-color);fill:var(--kip-widget-card-background-color)}.boat[_ngcontent-%COMP%]{stop-color:var(--kip-grey-color)!important}.contrast-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}.contrast-stroke[_ngcontent-%COMP%]{stroke:var(--kip-contrast-color)}.card-color[_ngcontent-%COMP%]{fill:var(--kip-widget-card-background-color)}.tack-box[_ngcontent-%COMP%]{stroke:var(--kip-yellow-dim-color);fill:var(--kip-widget-card-background-color);stroke-width:5}.tack-value[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);font-family:Roboto;font-size:80px;font-style:normal;font-weight:700;text-align:center;text-anchor:middle;stroke:none}.tack-label[_ngcontent-%COMP%]{fill:var(--kip-contrast-dim-color);font-family:Roboto;font-size:35px;font-style:normal;font-weight:700;text-align:center;text-anchor:middle;stroke:none}.waypoint-box[_ngcontent-%COMP%]{stroke:var(--kip-orange-dim-color);fill:var(--kip-widget-card-background-color);stroke-width:5}.waypoint-value[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);font-family:Roboto;font-size:50px;font-style:normal;font-weight:700;text-align:center;text-anchor:middle;stroke:none}.wind-vmg-value[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);font-family:Roboto;font-size:80px;font-style:normal;font-weight:700;text-align:center;text-anchor:middle;stroke:none}.wind-vmg-offset[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);font-family:Roboto;font-size:35px;font-style:normal;font-weight:700;text-align:center;text-anchor:middle;stroke:none}.true-wind[_ngcontent-%COMP%]{fill:var(--kip-blue-color)}.app-wind-label[_ngcontent-%COMP%]{fill:var(--kip-orange-dim-color)}.tack-angle[_ngcontent-%COMP%]{fill:var(--kip-yellow-color);stroke-width:15;stroke-linecap:square}.next-waypoint[_ngcontent-%COMP%]{stroke:var(--kip-orange-color);stroke-width:20;fill:none}.next-waypoint-bar[_ngcontent-%COMP%]{stroke:var(--kip-grey-color)}.portLayline[_ngcontent-%COMP%]{stroke:var(--kip-port-color);stroke-width:5}.stbdLayline[_ngcontent-%COMP%]{stroke:var(--kip-starboard-color);stroke-width:5}.direction-line[_ngcontent-%COMP%]{stroke:var(--kip-contrast-color);stroke-width:5}.speed-line[_ngcontent-%COMP%]{stroke:var(--kip-blue-color);stroke-width:10;fill:var(--kip-blue-color)}.wind-sector-port[_ngcontent-%COMP%]{fill:var(--kip-port-color)}.wind-sector-stbd[_ngcontent-%COMP%]{fill:var(--kip-starboard-color)}.drift-arrow[_ngcontent-%COMP%]{stop-color:var(--kip-blue-color);stroke:var(--kip-widget-card-background-color);stroke-width:3}"],changeDetection:0})}return n})();var Bm=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,filterSelfPaths:!0,paths:{headingPath:{description:"True Heading",path:"self.navigation.headingTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},tackTrue:{description:"True Tack",path:"self.performance.tackTrue",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!0,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},polarSpeedRatio:{description:"Polar Speed Ratio",path:"self.performance.polarSpeedRatio",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,convertUnitTo:"ratio",sampleTime:500},targetAngle:{description:"Target Angle",path:"self.performance.targetAngle",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,convertUnitTo:"deg",sampleTime:500},optimalWindAngle:{description:"Optimal Wind Angle",path:"self.performance.optimumWindAngle",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,convertUnitTo:"deg",sampleTime:500},targetVMG:{description:"Target Velocity Made Good",path:"self.performance.targetVelocityMadeGood",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,convertUnitTo:"knots",sampleTime:500},VMG:{description:"Velocity Made Good",path:"self.performance.velocityMadeGood",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,convertUnitTo:"knots",sampleTime:500},appWindAngle:{description:"Apparent Wind Angle",path:"self.environment.wind.angleApparent",source:"default",pathType:"number",isPathConfigurable:!0,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},appWindSpeed:{description:"Apparent Wind Speed",path:"self.environment.wind.speedApparent",source:"default",pathType:"number",isPathConfigurable:!0,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:500},trueWindAngle:{description:"True Wind Angle",path:"self.environment.wind.angleTrueWater",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},trueWindSpeed:{description:"True Wind Speed",path:"self.environment.wind.speedTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:500},courseOverGround:{description:"True Course Over Ground",path:"self.navigation.courseOverGroundTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},nextWaypointBearing:{description:"Next Waypoint True Bearing",path:"self.navigation.course.calcValues.bearingTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},vmgToWaypoint:{description:"Velocity Made Good to Waypoint",path:"self.performance.velocityMadeGoodToWaypoint",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,convertUnitTo:"knots",sampleTime:500},set:{description:"True Drift Set",path:"self.environment.current.setTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},drift:{description:"Drift Speed Impact",path:"self.environment.current.drift",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:500}},windSectorEnable:!0,windSectorWindowSeconds:5,laylineEnable:!0,laylineAngle:40,waypointEnable:!0,courseOverGroundEnable:!0,driftEnable:!0,awsEnable:!0,twsEnable:!0,sailSetupEnable:!1,enableTimeout:!1,dataTimeout:5};runtime=y(we);streams=y(Le);currentHeading=_(0);courseOverGroundAngle=_(0);appWindAngle=_(0);appWindSpeed=_(0);appWindSpeedUnit=_("knots");trueWindAngle=_(0);trueWindSpeed=_(0);trueWindSpeedUnit=_("knots");driftFlow=_(0);driftSet=_(0);waypointAngle=_(0);vmgToWaypoint=_(null);tackTrue=_(0);polarSpeedRatio=_(0);targetAngle=_(0);optimalWindAngle=_(0);targetVMG=_(0);VMG=_(0);gradianColor=_({start:"#3298ff",stop:"#15af00"});trueWindMinHistoric=_(0);trueWindMidHistoric=_(0);trueWindMaxHistoric=_(0);windSectorSub=null;historicalWindDirection=[];constructor(){L(()=>{let e=this.runtime.options();!e||!e.paths?.headingPath?.path||B(()=>this.streams.observe("headingPath",a=>{let r=a?.data?.value;this.currentHeading.set(r??0)}))}),L(()=>{let e=this.runtime.options();!e||!e.courseOverGroundEnable||!e.paths?.courseOverGround?.path||B(()=>this.streams.observe("courseOverGround",a=>{let r=a?.data?.value;this.courseOverGroundAngle.set(r??0)}))}),L(()=>{let e=this.runtime.options();!e||!e.driftEnable||!e.paths?.drift?.path||B(()=>this.streams.observe("drift",a=>{let r=a?.data?.value;this.driftFlow.set(r??0)}))}),L(()=>{let e=this.runtime.options();!e||!e.driftEnable||!e.paths?.set?.path||B(()=>this.streams.observe("set",a=>{let r=a?.data?.value,s=r??0;this.driftSet.set(this.addHeading(-this.currentHeading(),s))}))}),L(()=>{let e=this.runtime.options();!e||!e.waypointEnable||!e.paths?.nextWaypointBearing?.path||B(()=>this.streams.observe("nextWaypointBearing",a=>{let r=a?.data?.value;if(r==null){this.waypointAngle.set(0);return}let s=r<0?360+r:r,l=this.addHeading(-this.currentHeading(),s);this.waypointAngle.set(Math.round(l))}))}),L(()=>{let e=this.runtime.options();!e||!e.awsEnable||!e.paths?.appWindAngle?.path||B(()=>this.streams.observe("appWindAngle",a=>{let r=a?.data?.value,s=r??0;if(s=s<0?360+s:s,this.appWindAngle.set(s),e.windSectorEnable){let l=this.currentHeading(),m=this.addHeading(l,r??0);this.addHistoricalWindDirection(m,e.windSectorWindowSeconds)}}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.tackTrue?.path||B(()=>this.streams.observe("tackTrue",a=>{let r=a?.data?.value;this.tackTrue.set(r==null?0:Math.round(r))}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.polarSpeedRatio?.path||B(()=>this.streams.observe("polarSpeedRatio",a=>{let r=a?.data?.value;this.polarSpeedRatio.set(r??0)}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.targetAngle?.path||B(()=>this.streams.observe("targetAngle",a=>{let r=a?.data?.value;this.targetAngle.set(r)}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.optimalWindAngle?.path||B(()=>this.streams.observe("optimalWindAngle",a=>{let r=a?.data?.value;this.optimalWindAngle.set(r??0)}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.targetVMG?.path||B(()=>this.streams.observe("targetVMG",a=>{let r=a?.data?.value,s=r==null?0:Math.round(r*10)/10;this.targetVMG.set(s)}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.VMG?.path||B(()=>this.streams.observe("VMG",a=>{let r=a?.data?.value,s=r==null?0:Math.round(r*10)/10;this.VMG.set(s)}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.vmgToWaypoint?.path||B(()=>this.streams.observe("vmgToWaypoint",a=>{let r=a?.data?.value,s=r==null?null:Math.round(r*10)/10;this.vmgToWaypoint.set(s)}))}),L(()=>{let e=this.theme();if(!e)return;let t=e?.blue??"#3298ff",i=e?.green??"#15af00";B(()=>this.gradianColor.set({start:t,stop:i}))}),L(()=>{let e=this.runtime.options();!e||!e.awsEnable||!e.paths?.appWindSpeed?.path||B(()=>this.streams.observe("appWindSpeed",a=>{let r=a?.data?.value;this.appWindSpeed.set(r??0)}))}),L(()=>{let e=this.runtime.options();!e||!e.twsEnable||!e.paths?.trueWindSpeed?.path||B(()=>this.streams.observe("trueWindSpeed",a=>{let r=a?.data?.value;this.trueWindSpeed.set(r??0)}))}),L(()=>{let e=this.runtime.options();if(!e||!e.twsEnable)return;let i=e.paths?.trueWindAngle?.path;i&&B(()=>this.streams.observe("trueWindAngle",a=>{let r=a?.data?.value,s=r??0;if(i.includes("angleTrueWater")||i.includes("angleTrueGround")){let l=this.currentHeading();s=this.addHeading(l,s)}else s=s<0?360+s:s;this.trueWindAngle.set(s)}))}),L(()=>{let e=this.runtime.options();e&&(e.windSectorEnable?this.windSectorSub||B(()=>this.windSectorSub=xr(500).subscribe(()=>this.historicalCleanup(e.windSectorWindowSeconds))):(this.windSectorSub?.unsubscribe(),this.windSectorSub=null))})}sectorArc=K(()=>{let e=this.trueWindMinHistoric(),t=this.trueWindMidHistoric(),i=this.trueWindMaxHistoric();return{min:e,mid:t,max:i}});addHistoricalWindDirection(e,t){this.historicalWindDirection.push({timestamp:Date.now(),windDirection:e});let i=this.arcForAngles(this.historicalWindDirection.map(a=>a.windDirection));this.trueWindMinHistoric.set(i.min),this.trueWindMaxHistoric.set(i.max),this.trueWindMidHistoric.set(i.mid),this.historicalCleanup(t)}arcForAngles(e){return!e||e.length===0?{min:0,max:0,mid:0}:e.slice(1).reduce((i,a)=>{let r=a;for(;r<i.min-180;)r+=360;for(;r>i.max+180;)r-=360;return i.min=Math.min(i.min,r),i.max=Math.max(i.max,r),i.mid=(i.max-i.min)/2+i.min,i},{min:e[0],max:e[0],mid:e[0]})}historicalCleanup(e){let t=Date.now()-e*1e3;this.historicalWindDirection=this.historicalWindDirection.filter(i=>i.timestamp>=t)}addHeading(e,t){let i=(e+t)%360;return i<0&&(i+=360),i}ngOnDestroy(){this.windSectorSub?.unsubscribe(),this.windSectorSub=null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-racesteer"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:1,vars:20,consts:[[3,"compassHeading","tackTrue","polarSpeedRatio","trueWindAngle","trueWindSpeed","targetAngle","optimalWindAngle","targetVMG","VMG","sailSetupEnabled","driftEnabled","driftFlow","driftSet","waypointEnabled","waypointAngle","vmgToWaypoint","trueWindMinHistoric","trueWindMidHistoric","trueWindMaxHistoric","gradianColor"]],template:function(t,i){if(t&1&&F(0,"svg-racesteer",0),t&2){let a,r,s;O("compassHeading",i.currentHeading())("tackTrue",i.tackTrue())("polarSpeedRatio",i.polarSpeedRatio())("trueWindAngle",i.trueWindAngle())("trueWindSpeed",i.trueWindSpeed())("targetAngle",i.targetAngle())("optimalWindAngle",i.optimalWindAngle())("targetVMG",i.targetVMG())("VMG",i.VMG())("sailSetupEnabled",(a=i.runtime.options())==null?null:a.sailSetupEnable)("driftEnabled",(r=i.runtime.options())==null?null:r.driftEnable)("driftFlow",i.driftFlow())("driftSet",i.driftSet())("waypointEnabled",(s=i.runtime.options())==null?null:s.waypointEnable)("waypointAngle",i.waypointAngle())("vmgToWaypoint",i.vmgToWaypoint()??0)("trueWindMinHistoric",i.trueWindMinHistoric())("trueWindMidHistoric",i.trueWindMidHistoric())("trueWindMaxHistoric",i.trueWindMaxHistoric())("gradianColor",i.gradianColor())}},dependencies:[Gm],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}svg-racesteer[_ngcontent-%COMP%]{width:100%;height:100%}"]})}return n})();var aA=["canvasMainRef"];function oA(n,o){if(n&1&&(d(0,"div",8),ie(),d(1,"svg",11)(2,"text",12),c(3),u()()()),n&2){let e=k();g(3),ge("@ ",e.startAtTime())}}function rA(n,o){if(n&1){let e=Se();d(0,"button",13),U("click",function(){ee(e);let i=k();return te(i.sendStartTimerCommand("start"))}),d(1,"mat-icon",5),ie(),d(2,"svg",6)(3,"text",14),c(4,"Start"),u()()()(),Ge(),d(5,"button",15),U("click",function(){ee(e);let i=k();return te(i.adjustStartTime(-60))}),d(6,"mat-icon",5),ie(),d(7,"svg",6)(8,"text",14),c(9,"-1m"),u()()()(),Ge(),d(10,"button",16),U("click",function(){ee(e);let i=k();return te(i.adjustStartTime(60))}),d(11,"mat-icon",5),ie(),d(12,"svg",6)(13,"text",14),c(14,"+1m"),u()()()()}}function sA(n,o){if(n&1){let e=Se();d(0,"button",17),U("click",function(){ee(e);let i=k();return te(i.sendStartTimerCommand("sync"))}),d(1,"mat-icon",5),ie(),d(2,"svg",18)(3,"text",19),c(4,"Sync"),u()()()(),Ge(),d(5,"button",20),U("click",function(){ee(e);let i=k();return te(i.sendStartTimerCommand("reset"))}),d(6,"mat-icon",5),ie(),d(7,"svg",18)(8,"text",19),c(9,"Reset"),u()()()()}}function lA(n,o){if(n&1){let e=Se();d(0,"button",21),U("click",function(){ee(e);let i=k();return te(i.adjustStartTime(-60))}),d(1,"mat-icon",5),ie(),d(2,"svg",22)(3,"text",23),c(4,"-1m"),u()()()(),Ge(),d(5,"button",24),U("click",function(){ee(e);let i=k();return te(i.adjustStartTime(-1))}),d(6,"mat-icon",5),ie(),d(7,"svg",22)(8,"text",23),c(9,"-1s"),u()()()(),Ge(),d(10,"button",25),U("click",function(){ee(e);let i=k();return te(i.adjustStartTime(1))}),d(11,"mat-icon",5),ie(),d(12,"svg",22)(13,"text",23),c(14,"+1s"),u()()()(),Ge(),d(15,"button",26),U("click",function(){ee(e);let i=k();return te(i.adjustStartTime(60))}),d(16,"mat-icon",5),ie(),d(17,"svg",22)(18,"text",23),c(19,"+1m"),u()()()()}}function dA(n,o){if(n&1){let e=Se();d(0,"input",27),pn("ngModelChange",function(i){ee(e);let a=k();return hn(a.startAtTimeEdit,i)||(a.startAtTimeEdit=i),te(i)}),U("change",function(){ee(e);let i=k();return te(i.setStartTime())}),u()}if(n&2){let e=k();mn("ngModel",e.startAtTimeEdit)}}function cA(n,o){n&1&&F(0,"div",10)}var Um=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,displayName:"TTS",nextDashboard:0,playBeeps:!0,filterSelfPaths:!0,paths:{ttsPath:{description:"Time to the Start in seconds",path:"self.navigation.racing.timeToStart",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"s",showConvertUnitTo:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"s",sampleTime:500},startTimePath:{description:"Time of the start",path:"self.navigation.racing.startTime",source:"default",pathType:"Date",pathRequired:!1,isPathConfigurable:!1,sampleTime:500},dtsPath:{description:"Distance to Start Line path, used to determine OCS",path:"self.navigation.racing.distanceStartline",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"m",showPathSkUnitsFilter:!1,pathSkUnitsFilter:"m",sampleTime:500}},color:"contrast",enableTimeout:!1,dataTimeout:5,ignoreZones:!0};runtime=y(we);streams=y(Le);signalk=y(ri);dashboard=y(ft);canvas=y(mt);destroyRef=y(Ze);canvasRef=pe.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;labelColor=_("");mode=_(1);ttsValue=null;dtsValue=null;valueColor="";valueStateColor="";startAtTime=_("00:00:00");startAtTimeEdit=Fr("");constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||B(()=>{let i=Te(e.color,t);this.labelColor.set(i.dim),this.valueColor=i.color,this.valueStateColor=i.color,this.draw()})}),L(()=>{let e=this.runtime.options();!e||!e.paths?.ttsPath?.path||B(()=>this.streams.observe("ttsPath",a=>{let r=this.ttsValue;this.ttsValue=a?.data?.value??null,this.updateValueColor(),this.draw(),this.shouldBeep(r,this.ttsValue)&&this.beepForValue(this.ttsValue),e.nextDashboard>=0&&r===1&&this.ttsValue===0&&(!this.dtsValue||this.dtsValue>=0)}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.startTimePath?.path||B(()=>this.streams.observe("startTimePath",a=>{let r=a?.data?.value;if(!r)this.startAtTime.set("HH:MM:SS"),this.startAtTimeEdit.set("HH:MM:SS"),this.mode()===2&&this.mode.set(1);else{let s=new Date(r);this.startAtTimeEdit.set(s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})),this.startAtTime.set(this.startAtTimeEdit())}this.draw()}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.dtsPath?.path||B(()=>this.streams.observe("dtsPath",a=>{this.dtsValue=a?.data?.value??null}))}),this.signalk.subscribeRequest().pipe($e(this.destroyRef)).subscribe(e=>{e.widgetUUID===this.id()&&e.statusCode===200&&this.beep(600,20)})}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.draw()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.draw()}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}toggleMode(){this.mode.update(t=>(t+1)%5);let e=this.ttsValue;this.mode()===1&&this.isStartTimerRunning()&&this.mode.set(2),this.mode()===2&&e!==0&&!this.isStartTimerRunning()&&this.mode.set(3),this.draw()}sendStartTimerCommand(e){this.signalk.putRequest("navigation.racing.setStartTime",{command:e},this.id()),e==="start"&&this.mode.set(0),e==="reset"&&(this.startAtTime.set("HH:MM:SS"),this.mode.set(1))}adjustStartTime(e){this.signalk.putRequest("navigation.racing.setStartTime",{command:"adjust",delta:e},this.id())}setStartTime(){let e=new Date,t=this.startAtTimeEdit().split(":").map(Number),i=t[0],a=t[1],r=t.length>=3?t[2]:0,s=new Date(e);s.setHours(i,a,r,0),s<=e&&s.setDate(s.getDate()+1),this.mode.set(0),this.signalk.putRequest("navigation.racing.setStartTime",{command:"set",startTime:s.toISOString()},this.id())}isStartTimerRunning(){return(this.ttsValue??0)>0&&this.startAtTime()!==null&&this.startAtTime()!=="HH:MM:SS"}shouldBeep(e,t){return t==null||this.startAtTime()==="HH:MM:SS"||!this.runtime.options()?.playBeeps?!1:t===0&&e!==0||t<10&&t>=0||t<60&&t%10===0?!0:t%60===0}beepForValue(e){e===0?this.beep(500,1e3):e<10?this.beep(450,100):e<60&&e%10===0?this.beep(400,150):e%60===0&&this.beep(350,200)}updateValueColor(){let e=this.theme(),t=this.runtime.options();!e||!t||(t.ignoreZones?this.ttsValue?this.ttsValue===0?this.valueStateColor=this.valueColor:this.ttsValue<10?this.valueStateColor=(this.dtsValue??0)<0?e.zoneAlarm:e.zoneWarn:this.ttsValue<60?this.valueStateColor=e.zoneAlert:this.valueStateColor=this.valueColor:this.valueStateColor=this.valueColor:this.valueStateColor=this.valueColor,this.ttsValue===0?(this.mode.set(2),(this.dtsValue??0)<0&&(this.valueStateColor=e.zoneAlarm)):this.mode()===1&&this.isStartTimerRunning()&&this.mode.set(2))}toHHMMSS(e){if(e==null||isNaN(e))return"-:--";let t=e<0;t&&(e=-e);let i=Math.floor(e/3600),a=Math.floor(e%3600/60),r=Math.floor(e%60),s=t?"-":"";return i===0?`${s}${a.toString().padStart(1,"0")}:${r.toString().padStart(2,"0")}`:`${s}${i.toString().padStart(1,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}getValueText(){return this.toHHMMSS(this.ttsValue)}draw(){if(!this.ctx||!this.canvasElement)return;let t=this.runtime.options()?.displayName||"TTS",i=this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==t||this.titleBitmapColor!==i)&&(this.titleBitmap=this.canvas.createTitleBitmap(t,i,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=t,this.titleBitmapColor=i),this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.ctx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight),this.canvas.drawText(this.ctx,this.getValueText(),Math.floor(this.cssWidth*.5),Math.floor(this.cssHeight*.55),Math.floor(this.cssWidth*.95),Math.floor(this.cssHeight*.9),"bold",this.valueStateColor,"center","middle")}beep(e=440,t=100){if(!this.runtime.options()?.playBeeps)return;let i=window.AudioContext||window.webkitAudioContext,a=new i,r=a.createOscillator(),s=a.createGain();r.connect(s),s.connect(a.destination),r.type="sine",r.frequency.value=e,s.gain.value=.1,r.start(),r.stop(a.currentTime+t/1e3)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-racer-timer"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,aA,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"],startAtTimeEdit:[1,"startAtTimeEdit"]},outputs:{startAtTimeEdit:"startAtTimeEditChange"},decls:15,vars:2,consts:[["canvasMainRef",""],[1,"filler"],[1,"timer-canvas"],[1,"buttons-container"],["mat-flat-button","","matTooltip","Select the control mode",1,"button","select-button",3,"click"],[1,"buttons-svg-icon"],["width","100%","height","100%","viewBox","0 0 80 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","40","y","9"],[1,"start-at"],["matInput","","type","time","step","1","matTooltip","Set an absolute start time",1,"set-start-at",3,"ngModel"],[1,"widgetOverlay"],["width","100%","height","100%","viewBox","0 0 80 12","preserveAspectRatio","xMidYMid meet",1,"svg-content","svg-start-at"],["x","40","y","10"],["mat-flat-button","","matTooltip","Start the race timer",1,"button","main-button",3,"click"],["x","40","y","11"],["mat-flat-button","","matTooltip","Remove 1 minute from the timer",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Add 1 minute to the timer",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Sync the timer to nearest minute",1,"button","main-button",3,"click"],["width","100%","height","100%","viewBox","0 0 100 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","50","y","11"],["mat-flat-button","","matTooltip","Stop and reset the timer",1,"button","other-button",3,"click"],["mat-flat-button","","matTooltip","Reduce the timer by 1 minute",1,"button","main-small-button",3,"click"],["width","100%","height","100%","viewBox","0 0 50 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","25","y","11"],["mat-flat-button","","matTooltip","Reduce the timer by 1 second",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Increase the timer by 1 second",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Increase the timer by 1 minute",1,"button","main-small-button",3,"click"],["matInput","","type","time","step","1","matTooltip","Set an absolute start time",1,"set-start-at",3,"ngModelChange","change","ngModel"]],template:function(t,i){if(t&1&&(d(0,"div",1),F(1,"canvas",2,0),u(),d(3,"div",3)(4,"button",4),U("click",function(){return i.toggleMode()}),d(5,"mat-icon",5),ie(),d(6,"svg",6)(7,"text",7),c(8,"\u22EE"),u()()()(),I(9,oA,4,1,"div",8)(10,rA,15,0)(11,sA,10,0)(12,lA,20,0)(13,dA,1,1,"input",9),u(),I(14,cA,1,0,"div",10)),t&2){let a;g(9),N((a=i.mode())===0?9:a===1?10:a===2?11:a===3?12:a===4?13:-1),g(5),N(i.dashboard.isDashboardStatic()?-1:14)}},dependencies:[It,yt,dt,Rn,nt,At,et,Qe,no,io,wt],styles:["[_nghost-%COMP%]{overflow:clip;display:block;height:100%;width:100%}.timer-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.timer-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block}.filler[_ngcontent-%COMP%]{width:100%;height:76%}.buttons-container[_ngcontent-%COMP%]{display:flex;flex-wrap:nowrap;justify-content:space-between;column-gap:2%;position:relative;height:24%;width:100%;padding:0 10px 14px;z-index:20;pointer-events:auto;align-items:center}.button[_ngcontent-%COMP%]{min-width:0px;width:100%;border-radius:12px;align-items:center;justify-content:center;cursor:pointer;--mat-button-filled-container-height: 100%;--mat-button-filled-horizontal-padding: 0px;--mat-button-filled-icon-spacing: 0px}.select-button[_ngcontent-%COMP%]{flex:none;width:18%;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.main-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.other-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.main-small-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.other-small-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.set-start-at[_ngcontent-%COMP%]{flex:1 1 auto;background-color:var(--kip-contrast-color)}.start-at[_ngcontent-%COMP%]{height:100%;width:100%;flex:1 1 auto}.start-at[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}.start-at[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:9px;font-weight:400;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}.buttons-svg-icon[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;padding:0}.svg-content[_ngcontent-%COMP%]{width:100%;height:100%;padding:0;margin:0}.svg-content[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:15px;font-weight:700;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}.svg-start-at[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{fill:var(--kip-contrast-dim-color)}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}"]})}return n})();var uA=["canvasMainRef"];function mA(n,o){if(n&1&&(d(0,"div",10),ie(),d(1,"svg",11)(2,"text",12),c(3),u()()(),Ge(),d(4,"div",13),ie(),d(5,"svg",14)(6,"text",15)(7,"tspan",16),c(8,"\u2691"),u(),c(9),d(10,"tspan",17),c(11,"\u2691"),u()()()(),Ge(),d(12,"div",18),ie(),d(13,"svg",19)(14,"text",12),c(15),u()()()),n&2){let e=k();g(3),X(e.portBiasValue()),g(6),ge(" ",e.lineLengthValue()," "),g(6),X(e.stbBiasValue())}}function hA(n,o){if(n&1){let e=Se();d(0,"button",20),U("click",function(){ee(e);let i=k();return te(i.setLineEnd("port"))}),d(1,"mat-icon",6),ie(),d(2,"svg",21)(3,"text",22),c(4,"Port End"),u()()()(),Ge(),d(5,"button",23),U("click",function(){ee(e);let i=k();return te(i.setLineEnd("stb"))}),d(6,"mat-icon",6),ie(),d(7,"svg",21)(8,"text",22),c(9,"Stbd End"),u()()()()}}function pA(n,o){if(n&1){let e=Se();d(0,"button",24),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("port",5,0))}),d(1,"mat-icon",6),ie(),d(2,"svg",25)(3,"text",26),c(4,"+5m"),u()()()(),Ge(),d(5,"button",27),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("port",-5,0))}),d(6,"mat-icon",6),ie(),d(7,"svg",25)(8,"text",26),c(9,"-5m"),u()()()(),Ge(),d(10,"button",28),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("stb",-5,0))}),d(11,"mat-icon",6),ie(),d(12,"svg",25)(13,"text",26),c(14,"-5m"),u()()()(),Ge(),d(15,"button",29),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("stb",5,0))}),d(16,"mat-icon",6),ie(),d(17,"svg",25)(18,"text",26),c(19,"+5m"),u()()()()}}function fA(n,o){if(n&1){let e=Se();d(0,"button",30),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("port",0,i.toRadians(1)))}),d(1,"mat-icon",6),ie(),d(2,"svg",25)(3,"text",26),c(4,"\u21911\xB0"),u()()()(),Ge(),d(5,"button",31),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("port",0,i.toRadians(-1)))}),d(6,"mat-icon",6),ie(),d(7,"svg",25)(8,"text",26),c(9,"\u21931\xB0"),u()()()(),Ge(),d(10,"button",32),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("stb",0,i.toRadians(1)))}),d(11,"mat-icon",6),ie(),d(12,"svg",25)(13,"text",26),c(14,"\u21931\xB0"),u()()()(),Ge(),d(15,"button",33),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("stb",0,i.toRadians(-1)))}),d(16,"mat-icon",6),ie(),d(17,"svg",25)(18,"text",26),c(19,"\u21911\xB0"),u()()()()}}function gA(n,o){if(n&1){let e=Se();d(0,"button",34),U("click",function(){ee(e);let i=k();return te(i.nextDisplayLineName())}),d(1,"mat-icon",6),ie(),d(2,"svg",25)(3,"text",26),c(4,"Line"),u()()()(),Ge(),d(5,"button",35),U("click",function(){ee(e);let i=k();return te(i.setStartLine(i.getDisplayLineName()))}),d(6,"mat-icon",6),ie(),d(7,"svg",36)(8,"text",37),c(9),u()()()()}if(n&2){let e=k();g(5),it(Al("button ",e.isDisplayLineCurrent()?"line-button-current":"line-button")),O("matTooltip",Al("Set the ",e.getDisplayLineName()," line as the current line")),g(4),X(e.getDisplayLineName())}}function vA(n,o){n&1&&F(0,"div",9)}var Hm=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);streams=y(Le);canvas=y(mt);dashboard=y(ft);signalk=y(ri);destroyRef=y(Ze);static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,displayName:"DTS",filterSelfPaths:!0,playBeeps:!0,convertUnitTo:"m",convertUnitToGroup:"Length",numDecimal:0,ignoreZones:!0,color:"contrast",enableTimeout:!1,dataTimeout:5,paths:{dtsPath:{description:"Distance to Start Line",path:"self.navigation.racing.distanceStartline",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"m",showPathSkUnitsFilter:!0,pathSkUnitsFilter:"m",sampleTime:500},lineLengthPath:{description:"Length of the start line",path:"self.navigation.racing.startLineLength",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"m",showPathSkUnitsFilter:!0,pathSkUnitsFilter:"m",sampleTime:1e3},lineBiasPath:{description:"Bias of the start line to starboard end",path:"self.navigation.racing.stbLineBias",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"m",showPathSkUnitsFilter:!0,pathSkUnitsFilter:"m",sampleTime:1e3},startLineNamePath:{description:"The current named start line",path:"self.navigation.racing.lines.startLineName",source:"default",pathType:"string",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:null,showPathSkUnitsFilter:!1,pathSkUnitsFilter:null,sampleTime:1e3},linesPath:{description:"The known named lines",path:"self.navigation.racing.lines.lines",source:"default",pathType:null,pathRequired:!1,isPathConfigurable:!1,convertUnitTo:null,showPathSkUnitsFilter:!1,pathSkUnitsFilter:null,sampleTime:1e3},ttlPath:{description:"Time to sail to the start line in seconds",path:"self.navigation.racing.timeToLine",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"s",showConvertUnitTo:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"s",sampleTime:500},ttbPath:{description:"Time to delay before sailing to the start line in seconds",path:"self.navigation.racing.timeToBurn",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"s",showConvertUnitTo:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"s",sampleTime:500}}};canvasRef=pe.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;dtsValue=null;lengthValue=null;biasValue=null;ttlValue=null;ttbValue=null;labelColor=_("");valueColor="";dtsColor="";maxValueTextWidth=0;maxValueTextHeight=0;displayLineIndex=0;lines=[];startLineName=null;portBiasValue=_("");lineLengthValue=_("");stbBiasValue=_("");mode=_(0);constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||B(()=>{let i=Te(e.color,t);this.labelColor.set(i.dim),this.valueColor=i.color,this.draw()})}),L(()=>{let e=this.runtime.options();!e||!e.paths?.dtsPath?.path||B(()=>this.streams.observe("dtsPath",i=>{this.dtsValue=i?.data?.value??null,this.updateDtsColor(),this.draw()}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.lineLengthPath?.path||B(()=>this.streams.observe("lineLengthPath",i=>{this.lengthValue=i?.data?.value??null,this.setLenBias(),this.draw()}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.lineBiasPath?.path||B(()=>this.streams.observe("lineBiasPath",i=>{this.biasValue=i?.data?.value??null,this.setLenBias()}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.startLineNamePath?.path||B(()=>this.streams.observe("startLineNamePath",i=>{console.log("startLineName: "+JSON.stringify(i??"no data")),this.startLineName=i?.data?.value??null,this.displayLineIndex=0;for(let a=0;a<this.lines.length;a++)if(this.lines[a]===this.startLineName){this.displayLineIndex=a;break}this.draw()}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.linesPath?.path||B(()=>this.streams.observe("linesPath",i=>{if(console.log("lines: "+JSON.stringify(i??"no data")),this.lines=["Default"],this.displayLineIndex=0,i?.data?.value&&Array.isArray(i.data.value))for(let a of i.data.value)a.startLineName&&(a.startLineName===this.startLineName&&(this.displayLineIndex=this.lines.length),this.lines.push(a.startLineName))}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.ttlPath?.path||B(()=>this.streams.observe("ttlPath",a=>{this.ttlValue=a?.data?.value??null,this.draw()}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.ttbPath?.path||B(()=>this.streams.observe("ttbPath",a=>{this.ttbValue=a?.data?.value??null,this.draw()}))}),this.signalk.subscribeRequest().pipe($e(this.destroyRef)).subscribe(e=>{e.widgetUUID===this.id()&&e.statusCode===200&&this.beep(600,20)})}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.maxValueTextWidth=Math.floor(this.cssWidth*.95),this.maxValueTextHeight=Math.floor(this.cssHeight*.95),this.draw()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.maxValueTextWidth=Math.floor(this.cssWidth*.95),this.maxValueTextHeight=Math.floor(this.cssHeight*.95),this.draw()}toggleMode(){this.mode.update(e=>(e+1)%5),this.draw()}setLineEnd(e){return this.signalk.putRequest("navigation.racing.setStartLine",{end:e,position:"bow"},this.id())}adjustLineEnd(e,t,i){return this.signalk.putRequest("navigation.racing.setStartLine",{end:e,delta:t,rotate:i||null},this.id())}nextDisplayLineName(){++this.displayLineIndex>=this.lines.length&&(this.displayLineIndex=0)}getDisplayLineName(){return this.lines[this.displayLineIndex]||"Default"}isDisplayLineCurrent(){return this.getDisplayLineName()===(this.startLineName||"Default")}setStartLine(e){let t=e==="Default"||!e?null:e;this.signalk.putRequest("navigation.racing.setStartLineName",{startLineName:t},this.id()),this.mode.set(0),this.draw()}toRadians(e){return e?e*(Math.PI/180):null}draw(){if(!this.ctx||!this.canvasElement)return;let e=this.runtime.options(),t=e?.displayName||"DTS",i=this.labelColor();(!this.titleBitmap||!e||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==t||this.titleBitmapColor!==i)&&(this.titleBitmap=this.canvas.createTitleBitmap(t,i,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=t,this.titleBitmapColor=i),this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.ctx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight),this.canvas.drawText(this.ctx,this.getValueText(),Math.floor(this.cssWidth*.5),Math.floor(this.cssHeight*.325),Math.floor(this.cssWidth*.95),Math.floor(this.cssHeight*.55),"bold",this.dtsColor,"center","middle"),this.canvas.drawText(this.ctx,this.runtime.options()?.paths?.dtsPath?.convertUnitTo||"m",Math.floor(this.cssWidth*.975),Math.floor(this.cssHeight*.6),Math.floor(this.cssWidth*.95),Math.floor(this.cssHeight*.15),"normal",this.dtsColor,"right","bottom"),this.canvas.drawText(this.ctx,"TTL",Math.floor(this.cssWidth*.025),Math.floor(this.cssHeight*.7),Math.floor(this.cssWidth*.1),Math.floor(this.cssHeight*.15),"normal",this.dtsColor,"left","middle"),this.canvas.drawText(this.ctx,this.getTimeToLineText(),Math.floor(this.cssWidth*.15),Math.floor(this.cssHeight-.8),Math.floor(this.cssWidth*.35),Math.floor(this.cssHeight*.35),"bold",this.dtsColor,"left","bottom"),this.canvas.drawText(this.ctx,"TTB",Math.floor(this.cssWidth*.525),Math.floor(this.cssHeight*.7),Math.floor(this.cssWidth*.1),Math.floor(this.cssHeight*.15),"normal",this.dtsColor,"left","middle"),this.canvas.drawText(this.ctx,this.getTimeToBurnText(),Math.floor(this.cssWidth*.65),Math.floor(this.cssHeight-.8),Math.floor(this.cssWidth*.35),Math.floor(this.cssHeight*.35),"bold",this.dtsColor,"left","bottom"),this.setLenBias()}getValueText(){if(this.dtsValue===null)return"--";let e=this.runtime.options();return this.dtsValue.toFixed(e?.numDecimal??0)}toHHMMSS(e){if(e==null||isNaN(e))return"-:--";let t=e<0;t&&(e=-e);let i=Math.floor(e/3600),a=Math.floor(e%3600/60),r=Math.floor(e%60),s=t?"-":"";return i===0?`${s}${a.toString().padStart(1,"0")}:${r.toString().padStart(2,"0")}`:`${s}${i.toString().padStart(1,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}getTimeToLineText(){return this.toHHMMSS(this.ttlValue)}getTimeToBurnText(){return this.toHHMMSS(this.ttbValue)}setLenBias(){let e=this.runtime.options();if(e){if(e.paths.lineLengthPath.path&&this.lengthValue!=null){let t=e.paths.lineLengthPath.convertUnitTo;t==="feet"&&(t="\u2032"),this.lineLengthValue.set(`\u2015${this.applyDecorations(this.lengthValue.toFixed(e.numDecimal))}${t}\u2015`)}if(e.paths.lineBiasPath.path&&this.biasValue!=null){let t=e.paths.lineBiasPath.convertUnitTo;t==="feet"&&(t="\u2032"),this.biasValue<0?(this.portBiasValue.set("+"+(-this.biasValue).toFixed(e.numDecimal)+t),this.stbBiasValue.set(this.biasValue.toFixed(e.numDecimal)+t)):(this.portBiasValue.set(" "+(-this.biasValue).toFixed(e.numDecimal)+t),this.stbBiasValue.set(" +"+this.biasValue.toFixed(e.numDecimal)+t))}}}applyDecorations(e){switch(this.runtime.options()?.paths?.dtsPath?.convertUnitTo){case"percent":case"percentraw":return e+"%";default:return e}}updateDtsColor(){let e=this.theme(),t=this.runtime.options();!e||!t||(t.ignoreZones?this.dtsValue?this.dtsValue<0?this.dtsColor=e.zoneAlarm:this.dtsValue<10?this.dtsColor=e.zoneWarn:this.dtsValue<20?this.dtsColor=e.zoneAlert:this.dtsColor=this.valueColor:this.dtsColor=this.valueColor:this.dtsColor=this.valueColor)}beep(e=440,t=100){if(!this.runtime.options()?.playBeeps)return;let i=window.AudioContext||window.webkitAudioContext,a=new i,r=a.createOscillator(),s=a.createGain();r.connect(s),s.connect(a.destination),r.type="sine",r.frequency.value=e,s.gain.value=.1,r.start(),r.stop(a.currentTime+t/1e3)}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-racer-line"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,uA,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:16,vars:2,consts:[["canvasMainRef",""],[1,"line-wrapper"],[1,"filler"],[1,"line-canvas"],[1,"buttons-container"],["mat-flat-button","","matTooltip","Select the control mode",1,"button","select-button",3,"click"],[1,"buttons-svg-icon"],["width","100%","height","100%","viewBox","0 0 80 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","40","y","9"],[1,"widgetOverlay"],[1,"pin-container"],["width","100%","height","100%","viewBox","0 0 70 18","preserveAspectRatio","xMidYMid meet",1,"svg-content","pin"],["x","33","y","14"],[1,"len-bias-container"],["width","100%","height","100%","viewBox","0 0 90 12","preserveAspectRatio","xMidYMid meet",1,"svg-content","len-bias"],["x","45","y","9"],[1,"pin"],[1,"boat"],[1,"boat-container"],["width","100%","height","100%","viewBox","0 0 70 18","preserveAspectRatio","xMidYMid meet",1,"svg-content","boat"],["mat-flat-button","","matTooltip","Set the port(pin) end of the line to the current position",1,"button","port-button",3,"click"],["width","100%","height","100%","viewBox","0 0 100 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","50","y","11"],["mat-flat-button","","matTooltip","Set the starboard(boat) end of the line to the current position",1,"button","starboard-button",3,"click"],["mat-flat-button","","matTooltip","Increase the line length by 5m at the port(pin) end",1,"button","port-small-button",3,"click"],["width","100%","height","100%","viewBox","0 0 50 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","25","y","11"],["mat-flat-button","","matTooltip","Decrease the line length by 5m at the port(pin) end",1,"button","port-small-button",3,"click"],["mat-flat-button","","matTooltip","Decrease the line length by 5m at the starboard(boat) end",1,"button","starboard-small-button",3,"click"],["mat-flat-button","","matTooltip","Increase the line length by 5m at the starboard(boat) end",1,"button","starboard-small-button",3,"click"],["mat-flat-button","","matTooltip","Rotate the line by moving the port(pin) end 1\xB0 clockwise",1,"button","port-small-button",3,"click"],["mat-flat-button","","matTooltip","Rotate the line by moving the port(pin) end 1\xB0 counter-clockwise",1,"button","port-small-button",3,"click"],["mat-flat-button","","matTooltip","Rotate the line by moving the starboard(boat) end 1\xB0 counter-clockwise",1,"button","starboard-small-button",3,"click"],["mat-flat-button","","matTooltip","Rotate the line by moving the starboard(boat) end 1\xB0 clockwise",1,"button","starboard-small-button",3,"click"],["mat-flat-button","","matTooltip","Display the next named line",1,"button","select-button",3,"click"],["mat-flat-button","",3,"click","matTooltip"],["width","100%","height","100%","viewBox","0 0 150 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","75","y","11"]],template:function(t,i){if(t&1&&(d(0,"div",1)(1,"div",2),F(2,"canvas",3,0),u(),d(4,"div",4)(5,"button",5),U("click",function(){return i.toggleMode()}),d(6,"mat-icon",6),ie(),d(7,"svg",7)(8,"text",8),c(9,"\u22EE"),u()()()(),I(10,mA,16,3)(11,hA,10,0)(12,pA,20,0)(13,fA,20,0)(14,gA,10,6),u(),I(15,vA,1,0,"div",9),u()),t&2){let a;g(10),N((a=i.mode())===0?10:a===1?11:a===2?12:a===3?13:a===4?14:-1),g(5),N(i.dashboard.isDashboardStatic()?-1:15)}},dependencies:[nt,At,et,Qe,no,io],styles:["[_nghost-%COMP%]{overflow:clip;display:block;height:100%;width:100%}.line-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.line-canvas[_ngcontent-%COMP%]{position:absolute;width:100%!important;height:76%!important;display:block;top:0;left:0}.filler[_ngcontent-%COMP%]{width:100%;height:76%}.buttons-container[_ngcontent-%COMP%]{display:flex;flex-wrap:nowrap;justify-content:space-between;column-gap:2%;position:relative;height:24%;width:100%;padding:0 10px 14px;z-index:20;pointer-events:auto;align-items:center}.button[_ngcontent-%COMP%]{min-width:0px;width:100%;border-radius:12px;align-items:center;justify-content:center;cursor:pointer;--mat-button-filled-container-height: 100%;--mat-button-filled-horizontal-padding: 0px;--mat-button-filled-icon-spacing: 0px}.select-button[_ngcontent-%COMP%]{flex:none;width:18%;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.line-button[_ngcontent-%COMP%]{flex:none;width:58%;--mat-button-filled-container-color: var(--kip-grey-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.line-button-current[_ngcontent-%COMP%]{flex:none;width:58%;--mat-button-filled-container-color: var(--kip-orange-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.port-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.starboard-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-starboard-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.port-small-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.starboard-small-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-starboard-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.buttons-svg-icon[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;padding:0}.svg-content[_ngcontent-%COMP%]{width:100%;height:100%;padding:0;margin:0}.svg-content[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:15px;font-weight:700;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}.pin-container[_ngcontent-%COMP%]{flex-basis:18%}.pin[_ngcontent-%COMP%]{fill:var(--kip-port-color)}.pin[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-size:19px}.len-bias-container[_ngcontent-%COMP%]{flex-basis:35%}.len-bias[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}.len-bias[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-size:12px}.boat-container[_ngcontent-%COMP%]{flex-basis:18%}.boat[_ngcontent-%COMP%]{fill:var(--kip-starboard-color)}.boat[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-size:19px}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}"]})}return n})();var bA=["canvasMainRef"];function AA(n,o){if(n&1){let e=Se();d(0,"button",14),U("click",function(){ee(e);let i=k();return te(i.startTimer())}),c(1," Start "),u()}}function yA(n,o){if(n&1){let e=Se();d(0,"button",15),U("click",function(){ee(e);let i=k();return te(i.pauseTimer())}),c(1," Pause "),u()}}var qm=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);timers=y(Vu);canvas=y(mt);static DEFAULT_CONFIG={timerLength:-300,color:"contrast",playBeeps:!0,displayName:"Race",filterSelfPaths:!0,paths:{},enableTimeout:!1,dataTimeout:5,ignoreZones:!0};canvasRef=pe.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;maxTextWidth=0;maxTextHeight=0;dataValue=null;zoneState=null;currentValueLength=0;valueFontSize=1;flashOn=!1;flashInterval=null;timerRunning=_(!1);timeName="race";warnColor="";textColor="";constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||B(()=>{this.applyColors(e.color,t),this.draw()})}),L(()=>{let e=this.runtime.options();e&&this.ensureTimer(e.timerLength??-300)})}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.maxTextWidth=Math.floor(this.cssWidth*.95),this.maxTextHeight=Math.floor(this.cssHeight),this.draw()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.maxTextWidth=Math.floor(this.cssWidth*.95),this.maxTextHeight=Math.floor(this.cssHeight),this.draw()}ensureTimer(e){this.timers.createTimer(this.timeName,e,1e3).subscribe(i=>{this.dataValue=i,this.timerRunning.set(this.timers.isRunning(this.timeName)),i>0?this.zoneState=Ae.Normal:i===0?(this.zoneState=Ae.Normal,this.beep(500,2e3)):i>-10?(this.zoneState=Ae.Alarm,this.beep(450,100)):i>=-29?this.zoneState=Ae.Warn:i===-30?(this.zoneState=Ae.Warn,this.beep(400,200)):this.zoneState=Ae.Normal,this.zoneState===Ae.Alarm&&!this.flashInterval?this.flashInterval=setInterval(()=>{this.flashOn=!this.flashOn,this.draw()},500):this.zoneState!==Ae.Alarm&&this.flashInterval&&(clearInterval(this.flashInterval),this.flashInterval=null,this.flashOn=!1),this.draw()})}startTimer(){this.timers.startTimer(this.timeName),this.timerRunning.set(!0)}resetTimer(){this.timers.deleteTimer(this.timeName),this.timerRunning.set(!1);let e=this.runtime.options();this.ensureTimer(e?.timerLength??-300),this.draw()}pauseTimer(){this.timers.stopTimer(this.timeName),this.timerRunning.set(!1)}roundToMin(){if(this.dataValue==null)return;let t=(this.dataValue<0?-this.dataValue:this.dataValue)%60;this.dataValue>0?this.timers.setTimer(this.timeName,this.dataValue+(t>30?60-t:-t)):this.timers.setTimer(this.timeName,this.dataValue+(t>30?-(60-t):t))}addTime(e){this.dataValue!=null&&this.timers.setTimer(this.timeName,this.dataValue+e)}removeTime(e){this.dataValue!=null&&this.timers.setTimer(this.timeName,this.dataValue-e)}applyColors(e,t){switch(e){case"contrast":this.textColor=t.contrast,this.warnColor=t.zoneAlarm;break;case"blue":this.textColor=t.blue,this.warnColor=t.zoneAlarm;break;case"green":this.textColor=t.green,this.warnColor=t.zoneAlarm;break;case"pink":this.textColor=t.pink,this.warnColor=t.zoneAlarm;break;case"orange":this.textColor=t.orange,this.warnColor=t.zoneAlarm;break;case"purple":this.textColor=t.purple,this.warnColor=t.zoneAlarm;break;case"grey":this.textColor=t.grey,this.warnColor=t.zoneAlarm;break;case"yellow":this.textColor=t.yellow,this.warnColor=t.zoneAlarm;break;default:this.textColor=t.contrast,this.warnColor=t.zoneAlarm;break}}beep(e=440,t=100){if(this.runtime.options()?.playBeeps){let i=new(window.AudioContext||window.webkitAudioContext),a=i.createOscillator(),r=i.createGain();a.connect(r),r.connect(i.destination),a.type="sine",a.frequency.value=e,r.gain.value=.1,a.start(),a.stop(i.currentTime+t/1e3)}}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}this.flashInterval&&(clearInterval(this.flashInterval),this.flashInterval=null)}draw(){if(!this.ctx)return;this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight);let e;if(this.dataValue!=null){let t=Math.abs(this.dataValue),i=Math.floor(t/60),a=Math.floor(t%60);e=`${i}:${("0"+a).slice(-2)}`,this.dataValue<0&&(e=`-${e}`)}else e="--";switch(this.currentValueLength!==e.length&&(this.currentValueLength=e.length,this.valueFontSize=this.canvas.calculateOptimalFontSize(this.ctx,e,this.maxTextWidth,this.maxTextHeight,"bold")),this.zoneState){case Ae.Alarm:this.flashOn?this.ctx.fillStyle=this.textColor:(this.canvas.drawRectangle(this.ctx,0,0,this.cssWidth,this.cssHeight,this.warnColor),this.ctx.fillStyle=this.textColor);break;case Ae.Warn:this.ctx.fillStyle=this.warnColor;break;default:this.ctx.fillStyle=this.textColor}this.canvas.drawText(this.ctx,e,this.cssWidth/2,this.cssHeight/2,this.maxTextWidth,this.maxTextHeight,"bold",this.ctx.fillStyle,"center","middle")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-racetimer"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,bA,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:35,vars:2,consts:[["canvasMainRef",""],[1,"racetimer-wrapper"],[1,"racetimer-canvas"],[1,"timerBarContainer"],[1,"timer-button-groups","timer-adjusters-group"],["mat-flat-button","",1,"button","other-small-button",3,"click"],[1,"buttons-svg-icon"],["width","100%","height","100%","viewBox","0 0 100 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],[0,"xml","space","preserve","x","50","y","11"],["mat-flat-button","",1,"button","main-button",3,"click"],[1,"timer-button-groups","timer-countdown-group"],["mat-flat-button","",1,"timer-start-button","button-color-red"],["mat-flat-button","",1,"timer-start-button"],["mat-flat-button","",1,"timer-synch-button","button-color-red",3,"click"],["mat-flat-button","",1,"timer-start-button","button-color-red",3,"click"],["mat-flat-button","",1,"timer-start-button",3,"click"]],template:function(t,i){t&1&&(d(0,"div",1),F(1,"canvas",2,0),d(3,"div",3)(4,"div",4)(5,"button",5),U("click",function(){return i.removeTime(5)}),d(6,"mat-icon",6),ie(),d(7,"svg",7)(8,"text",8),c(9,"-5s"),u()()()(),Ge(),d(10,"button",5),U("click",function(){return i.removeTime(60)}),d(11,"mat-icon",6),ie(),d(12,"svg",7)(13,"text",8),c(14,"-60s"),u()()()(),Ge(),d(15,"button",9),U("click",function(){return i.resetTimer()}),d(16,"mat-icon",6),ie(),d(17,"svg",7)(18,"text",8),c(19,"Reset"),u()()()(),Ge(),d(20,"button",5),U("click",function(){return i.addTime(60)}),d(21,"mat-icon",6),ie(),d(22,"svg",7)(23,"text",8),c(24,"+60s"),u()()()(),Ge(),d(25,"button",5),U("click",function(){return i.addTime(5)}),d(26,"mat-icon",6),ie(),d(27,"svg",7)(28,"text",8),c(29,"+5s"),u()()()()(),Ge(),d(30,"div",10),I(31,AA,2,0,"button",11),I(32,yA,2,0,"button",12),d(33,"button",13),U("click",function(){return i.roundToMin()}),c(34," Synch "),u()()()()),t&2&&(g(31),N(i.timerRunning()?-1:31),g(),N(i.timerRunning()?32:-1))},dependencies:[nt,At,et,Qe],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.racetimer-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.racetimer-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block}.button-color-red[_ngcontent-%COMP%]{--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.timerBarContainer[_ngcontent-%COMP%]{position:absolute;left:0;bottom:0;height:23%;width:100%;padding:0 10px 10px;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-end;align-items:stretch;gap:10px}.timer-button-groups[_ngcontent-%COMP%]{min-width:247px;max-width:100%;--mat-button-filled-container-shape: 5px}.timer-adjusters-group[_ngcontent-%COMP%]{flex:1 1 auto;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;gap:10px;height:100%}.timer-countdown-group[_ngcontent-%COMP%]{flex-grow:1;flex-shrink:1}.timer-synch-button[_ngcontent-%COMP%]{width:calc(50% - 5px);margin-left:5px}.timer-start-button[_ngcontent-%COMP%]{width:calc(50% - 5px);margin-right:5px}.buttons-svg-icon[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;padding:0}.button[_ngcontent-%COMP%]{min-width:0px;height:100%;width:100%;border-radius:12px;align-items:center;justify-content:center;cursor:pointer;--mat-button-filled-container-height: 100%;--mat-button-filled-horizontal-padding: 0px;--mat-button-filled-icon-spacing: 0px}.main-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.svg-content[_ngcontent-%COMP%]{width:100%;height:100%;padding:0;margin:0}.svg-content[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:15px;font-weight:700;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}"]})}return n})();var xA=["canvasMainRef"],$m=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);streams=y(Le);canvas=y(mt);canvasRef=pe.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;maxTextWidth=0;maxTextHeight=0;middle=0;center=0;fontSizeOffset=0;latPos="";longPos="";labelColor=_("");valueColor="";static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,displayName:"Position",filterSelfPaths:!0,paths:{longPath:{description:"Longitude",path:"self.navigation.position.longitude",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"longitudeMin",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500},latPath:{description:"Latitude",path:"self.navigation.position.latitude",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"latitudeMin",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500}},color:"contrast",enableTimeout:!1,dataTimeout:5};constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||B(()=>{let i=Te(e.color,t);this.labelColor.set(i.dim),this.valueColor=i.color,this.draw()})}),L(()=>{let e=this.runtime.options();if(!e)return;let t=e.paths?.longPath;t?.path&&B(()=>this.streams.observe("longPath",i=>{let a=i?.data?.value;a==null?this.longPos="":t.convertUnitTo==="pdeg"?this.longPos=a.toFixed(6)+"\xB0":this.longPos=String(a),this.calculateFontSizeAndPositions(),this.draw()}))}),L(()=>{let e=this.runtime.options();if(!e)return;let t=e.paths?.latPath;t?.path&&B(()=>this.streams.observe("latPath",i=>{let a=i?.data?.value;a==null?this.latPos="":t.convertUnitTo==="pdeg"?this.latPos=a.toFixed(7)+"\xB0":this.latPos=String(a),this.calculateFontSizeAndPositions(),this.draw()}))})}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.calculateFontSizeAndPositions(),this.draw()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.calculateFontSizeAndPositions(),this.draw()}calculateFontSizeAndPositions(){if(!this.cssWidth||!this.cssHeight)return;this.maxTextHeight=Math.floor(this.cssHeight*.6/2),this.maxTextWidth=Math.floor(this.cssWidth*.85),this.center=this.cssWidth/2,this.middle=this.cssHeight*.57;let e=this.latPos.length>this.longPos.length?this.latPos:this.longPos;if(this.ctx){let t=this.canvas.calculateOptimalFontSize(this.ctx,e,this.maxTextWidth,this.maxTextHeight,"bold");this.fontSizeOffset=Math.floor(t*5e-4)}}draw(){if(!this.ctx||!this.canvasElement)return;let e=this.runtime.options();if(!e)return;let t=e.displayName||"Position",i=this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==t||this.titleBitmapColor!==i)&&(this.titleBitmap=this.canvas.createTitleBitmap(t,i,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=t,this.titleBitmapColor=i),this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.titleBitmap.width>0&&this.titleBitmap.height>0&&this.ctx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight),this.canvas.drawText(this.ctx,this.latPos,this.center,this.middle-this.fontSizeOffset,this.maxTextWidth,this.maxTextHeight,"bold",this.valueColor,"center","bottom"),this.canvas.drawText(this.ctx,this.longPos,this.center,this.middle+this.fontSizeOffset,this.maxTextWidth,this.maxTextHeight,"bold",this.valueColor,"center","top")}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-position"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,xA,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["canvasMainRef",""],[1,"position-canvas"]],template:function(t,i){t&1&&Q(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.position-canvas[_ngcontent-%COMP%]{display:block;width:100%!important;height:100%!important;min-height:1px}"]})}return n})();var CA={value:()=>{}};function Ym(){for(var n=0,o=arguments.length,e={},t;n<o;++n){if(!(t=arguments[n]+"")||t in e||/[\s.]/.test(t))throw new Error("illegal type: "+t);e[t]=[]}return new Ss(e)}function Ss(n){this._=n}function SA(n,o){return n.trim().split(/^|\s+/).map(function(e){var t="",i=e.indexOf(".");if(i>=0&&(t=e.slice(i+1),e=e.slice(0,i)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})}Ss.prototype=Ym.prototype={constructor:Ss,on:function(n,o){var e=this._,t=SA(n+"",e),i,a=-1,r=t.length;if(arguments.length<2){for(;++a<r;)if((i=(n=t[a]).type)&&(i=wA(e[i],n.name)))return i;return}if(o!=null&&typeof o!="function")throw new Error("invalid callback: "+o);for(;++a<r;)if(i=(n=t[a]).type)e[i]=jm(e[i],n.name,o);else if(o==null)for(i in e)e[i]=jm(e[i],n.name,null);return this},copy:function(){var n={},o=this._;for(var e in o)n[e]=o[e].slice();return new Ss(n)},call:function(n,o){if((i=arguments.length-2)>0)for(var e=new Array(i),t=0,i,a;t<i;++t)e[t]=arguments[t+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(a=this._[n],t=0,i=a.length;t<i;++t)a[t].value.apply(o,e)},apply:function(n,o,e){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var t=this._[n],i=0,a=t.length;i<a;++i)t[i].value.apply(o,e)}};function wA(n,o){for(var e=0,t=n.length,i;e<t;++e)if((i=n[e]).name===o)return i.value}function jm(n,o,e){for(var t=0,i=n.length;t<i;++t)if(n[t].name===o){n[t]=CA,n=n.slice(0,t).concat(n.slice(t+1));break}return e!=null&&n.push({name:o,value:e}),n}var Hl=Ym;var ws="http://www.w3.org/1999/xhtml",ql={svg:"http://www.w3.org/2000/svg",xhtml:ws,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function yn(n){var o=n+="",e=o.indexOf(":");return e>=0&&(o=n.slice(0,e))!=="xmlns"&&(n=n.slice(e+1)),ql.hasOwnProperty(o)?{space:ql[o],local:n}:n}function _A(n){return function(){var o=this.ownerDocument,e=this.namespaceURI;return e===ws&&o.documentElement.namespaceURI===ws?o.createElement(n):o.createElementNS(e,n)}}function MA(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function _s(n){var o=yn(n);return(o.local?MA:_A)(o)}function kA(){}function xa(n){return n==null?kA:function(){return this.querySelector(n)}}function Zm(n){typeof n!="function"&&(n=xa(n));for(var o=this._groups,e=o.length,t=new Array(e),i=0;i<e;++i)for(var a=o[i],r=a.length,s=t[i]=new Array(r),l,m,f=0;f<r;++f)(l=a[f])&&(m=n.call(l,l.__data__,f,a))&&("__data__"in l&&(m.__data__=l.__data__),s[f]=m);return new _t(t,this._parents)}function $l(n){return n==null?[]:Array.isArray(n)?n:Array.from(n)}function TA(){return[]}function Xo(n){return n==null?TA:function(){return this.querySelectorAll(n)}}function EA(n){return function(){return $l(n.apply(this,arguments))}}function Qm(n){typeof n=="function"?n=EA(n):n=Xo(n);for(var o=this._groups,e=o.length,t=[],i=[],a=0;a<e;++a)for(var r=o[a],s=r.length,l,m=0;m<s;++m)(l=r[m])&&(t.push(n.call(l,l.__data__,m,r)),i.push(l));return new _t(t,i)}function Ko(n){return function(){return this.matches(n)}}function Ms(n){return function(o){return o.matches(n)}}var DA=Array.prototype.find;function PA(n){return function(){return DA.call(this.children,n)}}function IA(){return this.firstElementChild}function Xm(n){return this.select(n==null?IA:PA(typeof n=="function"?n:Ms(n)))}var NA=Array.prototype.filter;function RA(){return Array.from(this.children)}function OA(n){return function(){return NA.call(this.children,n)}}function Km(n){return this.selectAll(n==null?RA:OA(typeof n=="function"?n:Ms(n)))}function Jm(n){typeof n!="function"&&(n=Ko(n));for(var o=this._groups,e=o.length,t=new Array(e),i=0;i<e;++i)for(var a=o[i],r=a.length,s=t[i]=[],l,m=0;m<r;++m)(l=a[m])&&n.call(l,l.__data__,m,a)&&s.push(l);return new _t(t,this._parents)}function ks(n){return new Array(n.length)}function eh(){return new _t(this._enter||this._groups.map(ks),this._parents)}function Jo(n,o){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=o}Jo.prototype={constructor:Jo,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,o){return this._parent.insertBefore(n,o)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function th(n){return function(){return n}}function VA(n,o,e,t,i,a){for(var r=0,s,l=o.length,m=a.length;r<m;++r)(s=o[r])?(s.__data__=a[r],t[r]=s):e[r]=new Jo(n,a[r]);for(;r<l;++r)(s=o[r])&&(i[r]=s)}function LA(n,o,e,t,i,a,r){var s,l,m=new Map,f=o.length,b=a.length,A=new Array(f),C;for(s=0;s<f;++s)(l=o[s])&&(A[s]=C=r.call(l,l.__data__,s,o)+"",m.has(C)?i[s]=l:m.set(C,l));for(s=0;s<b;++s)C=r.call(n,a[s],s,a)+"",(l=m.get(C))?(t[s]=l,l.__data__=a[s],m.delete(C)):e[s]=new Jo(n,a[s]);for(s=0;s<f;++s)(l=o[s])&&m.get(A[s])===l&&(i[s]=l)}function WA(n){return n.__data__}function ih(n,o){if(!arguments.length)return Array.from(this,WA);var e=o?LA:VA,t=this._parents,i=this._groups;typeof n!="function"&&(n=th(n));for(var a=i.length,r=new Array(a),s=new Array(a),l=new Array(a),m=0;m<a;++m){var f=t[m],b=i[m],A=b.length,C=FA(n.call(f,f&&f.__data__,m,t)),w=C.length,M=s[m]=new Array(w),G=r[m]=new Array(w),E=l[m]=new Array(A);e(f,b,M,G,E,C,o);for(var W=0,V=0,Y,j;W<w;++W)if(Y=M[W]){for(W>=V&&(V=W+1);!(j=G[V])&&++V<w;);Y._next=j||null}}return r=new _t(r,t),r._enter=s,r._exit=l,r}function FA(n){return typeof n=="object"&&"length"in n?n:Array.from(n)}function nh(){return new _t(this._exit||this._groups.map(ks),this._parents)}function ah(n,o,e){var t=this.enter(),i=this,a=this.exit();return typeof n=="function"?(t=n(t),t&&(t=t.selection())):t=t.append(n+""),o!=null&&(i=o(i),i&&(i=i.selection())),e==null?a.remove():e(a),t&&i?t.merge(i).order():i}function oh(n){for(var o=n.selection?n.selection():n,e=this._groups,t=o._groups,i=e.length,a=t.length,r=Math.min(i,a),s=new Array(i),l=0;l<r;++l)for(var m=e[l],f=t[l],b=m.length,A=s[l]=new Array(b),C,w=0;w<b;++w)(C=m[w]||f[w])&&(A[w]=C);for(;l<i;++l)s[l]=e[l];return new _t(s,this._parents)}function rh(){for(var n=this._groups,o=-1,e=n.length;++o<e;)for(var t=n[o],i=t.length-1,a=t[i],r;--i>=0;)(r=t[i])&&(a&&r.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(r,a),a=r);return this}function sh(n){n||(n=GA);function o(b,A){return b&&A?n(b.__data__,A.__data__):!b-!A}for(var e=this._groups,t=e.length,i=new Array(t),a=0;a<t;++a){for(var r=e[a],s=r.length,l=i[a]=new Array(s),m,f=0;f<s;++f)(m=r[f])&&(l[f]=m);l.sort(o)}return new _t(i,this._parents).order()}function GA(n,o){return n<o?-1:n>o?1:n>=o?0:NaN}function lh(){var n=arguments[0];return arguments[0]=this,n.apply(null,arguments),this}function dh(){return Array.from(this)}function ch(){for(var n=this._groups,o=0,e=n.length;o<e;++o)for(var t=n[o],i=0,a=t.length;i<a;++i){var r=t[i];if(r)return r}return null}function uh(){let n=0;for(let o of this)++n;return n}function mh(){return!this.node()}function hh(n){for(var o=this._groups,e=0,t=o.length;e<t;++e)for(var i=o[e],a=0,r=i.length,s;a<r;++a)(s=i[a])&&n.call(s,s.__data__,a,i);return this}function BA(n){return function(){this.removeAttribute(n)}}function zA(n){return function(){this.removeAttributeNS(n.space,n.local)}}function UA(n,o){return function(){this.setAttribute(n,o)}}function HA(n,o){return function(){this.setAttributeNS(n.space,n.local,o)}}function qA(n,o){return function(){var e=o.apply(this,arguments);e==null?this.removeAttribute(n):this.setAttribute(n,e)}}function $A(n,o){return function(){var e=o.apply(this,arguments);e==null?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}}function ph(n,o){var e=yn(n);if(arguments.length<2){var t=this.node();return e.local?t.getAttributeNS(e.space,e.local):t.getAttribute(e)}return this.each((o==null?e.local?zA:BA:typeof o=="function"?e.local?$A:qA:e.local?HA:UA)(e,o))}function Ts(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function jA(n){return function(){this.style.removeProperty(n)}}function YA(n,o,e){return function(){this.style.setProperty(n,o,e)}}function ZA(n,o,e){return function(){var t=o.apply(this,arguments);t==null?this.style.removeProperty(n):this.style.setProperty(n,t,e)}}function fh(n,o,e){return arguments.length>1?this.each((o==null?jA:typeof o=="function"?ZA:YA)(n,o,e??"")):Qn(this.node(),n)}function Qn(n,o){return n.style.getPropertyValue(o)||Ts(n).getComputedStyle(n,null).getPropertyValue(o)}function QA(n){return function(){delete this[n]}}function XA(n,o){return function(){this[n]=o}}function KA(n,o){return function(){var e=o.apply(this,arguments);e==null?delete this[n]:this[n]=e}}function gh(n,o){return arguments.length>1?this.each((o==null?QA:typeof o=="function"?KA:XA)(n,o)):this.node()[n]}function vh(n){return n.trim().split(/^|\s+/)}function jl(n){return n.classList||new bh(n)}function bh(n){this._node=n,this._names=vh(n.getAttribute("class")||"")}bh.prototype={add:function(n){var o=this._names.indexOf(n);o<0&&(this._names.push(n),this._node.setAttribute("class",this._names.join(" ")))},remove:function(n){var o=this._names.indexOf(n);o>=0&&(this._names.splice(o,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};function Ah(n,o){for(var e=jl(n),t=-1,i=o.length;++t<i;)e.add(o[t])}function yh(n,o){for(var e=jl(n),t=-1,i=o.length;++t<i;)e.remove(o[t])}function JA(n){return function(){Ah(this,n)}}function ey(n){return function(){yh(this,n)}}function ty(n,o){return function(){(o.apply(this,arguments)?Ah:yh)(this,n)}}function xh(n,o){var e=vh(n+"");if(arguments.length<2){for(var t=jl(this.node()),i=-1,a=e.length;++i<a;)if(!t.contains(e[i]))return!1;return!0}return this.each((typeof o=="function"?ty:o?JA:ey)(e,o))}function iy(){this.textContent=""}function ny(n){return function(){this.textContent=n}}function ay(n){return function(){var o=n.apply(this,arguments);this.textContent=o??""}}function Ch(n){return arguments.length?this.each(n==null?iy:(typeof n=="function"?ay:ny)(n)):this.node().textContent}function oy(){this.innerHTML=""}function ry(n){return function(){this.innerHTML=n}}function sy(n){return function(){var o=n.apply(this,arguments);this.innerHTML=o??""}}function Sh(n){return arguments.length?this.each(n==null?oy:(typeof n=="function"?sy:ry)(n)):this.node().innerHTML}function ly(){this.nextSibling&&this.parentNode.appendChild(this)}function wh(){return this.each(ly)}function dy(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _h(){return this.each(dy)}function Mh(n){var o=typeof n=="function"?n:_s(n);return this.select(function(){return this.appendChild(o.apply(this,arguments))})}function cy(){return null}function kh(n,o){var e=typeof n=="function"?n:_s(n),t=o==null?cy:typeof o=="function"?o:xa(o);return this.select(function(){return this.insertBefore(e.apply(this,arguments),t.apply(this,arguments)||null)})}function uy(){var n=this.parentNode;n&&n.removeChild(this)}function Th(){return this.each(uy)}function my(){var n=this.cloneNode(!1),o=this.parentNode;return o?o.insertBefore(n,this.nextSibling):n}function hy(){var n=this.cloneNode(!0),o=this.parentNode;return o?o.insertBefore(n,this.nextSibling):n}function Eh(n){return this.select(n?hy:my)}function Dh(n){return arguments.length?this.property("__data__",n):this.node().__data__}function py(n){return function(o){n.call(this,o,this.__data__)}}function fy(n){return n.trim().split(/^|\s+/).map(function(o){var e="",t=o.indexOf(".");return t>=0&&(e=o.slice(t+1),o=o.slice(0,t)),{type:o,name:e}})}function gy(n){return function(){var o=this.__on;if(o){for(var e=0,t=-1,i=o.length,a;e<i;++e)a=o[e],(!n.type||a.type===n.type)&&a.name===n.name?this.removeEventListener(a.type,a.listener,a.options):o[++t]=a;++t?o.length=t:delete this.__on}}}function vy(n,o,e){return function(){var t=this.__on,i,a=py(o);if(t){for(var r=0,s=t.length;r<s;++r)if((i=t[r]).type===n.type&&i.name===n.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=e),i.value=o;return}}this.addEventListener(n.type,a,e),i={type:n.type,name:n.name,value:o,listener:a,options:e},t?t.push(i):this.__on=[i]}}function Ph(n,o,e){var t=fy(n+""),i,a=t.length,r;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,m=s.length,f;l<m;++l)for(i=0,f=s[l];i<a;++i)if((r=t[i]).type===f.type&&r.name===f.name)return f.value}return}for(s=o?vy:gy,i=0;i<a;++i)this.each(s(t[i],o,e));return this}function Ih(n,o,e){var t=Ts(n),i=t.CustomEvent;typeof i=="function"?i=new i(o,e):(i=t.document.createEvent("Event"),e?(i.initEvent(o,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(o,!1,!1)),n.dispatchEvent(i)}function by(n,o){return function(){return Ih(this,n,o)}}function Ay(n,o){return function(){return Ih(this,n,o.apply(this,arguments))}}function Nh(n,o){return this.each((typeof o=="function"?Ay:by)(n,o))}function*Rh(){for(var n=this._groups,o=0,e=n.length;o<e;++o)for(var t=n[o],i=0,a=t.length,r;i<a;++i)(r=t[i])&&(yield r)}var Yl=[null];function _t(n,o){this._groups=n,this._parents=o}function Oh(){return new _t([[document.documentElement]],Yl)}function yy(){return this}_t.prototype=Oh.prototype={constructor:_t,select:Zm,selectAll:Qm,selectChild:Xm,selectChildren:Km,filter:Jm,data:ih,enter:eh,exit:nh,join:ah,merge:oh,selection:yy,order:rh,sort:sh,call:lh,nodes:dh,node:ch,size:uh,empty:mh,each:hh,attr:ph,style:fh,property:gh,classed:xh,text:Ch,html:Sh,raise:wh,lower:_h,append:Mh,insert:kh,remove:Th,clone:Eh,datum:Dh,on:Ph,dispatch:Nh,[Symbol.iterator]:Rh};var xn=Oh;function Ca(n){return typeof n=="string"?new _t([[document.querySelector(n)]],[document.documentElement]):new _t([[n]],Yl)}function Es(n,o,e){n.prototype=o.prototype=e,e.constructor=n}function Zl(n,o){var e=Object.create(n.prototype);for(var t in o)e[t]=o[t];return e}function ir(){}var er=.7,Is=1/er,mo="\\s*([+-]?\\d+)\\s*",tr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",cn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xy=/^#([0-9a-f]{3,8})$/,Cy=new RegExp(`^rgb\\(${mo},${mo},${mo}\\)$`),Sy=new RegExp(`^rgb\\(${cn},${cn},${cn}\\)$`),wy=new RegExp(`^rgba\\(${mo},${mo},${mo},${tr}\\)$`),_y=new RegExp(`^rgba\\(${cn},${cn},${cn},${tr}\\)$`),My=new RegExp(`^hsl\\(${tr},${cn},${cn}\\)$`),ky=new RegExp(`^hsla\\(${tr},${cn},${cn},${tr}\\)$`),Vh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Es(ir,Xn,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:Lh,formatHex:Lh,formatHex8:Ty,formatHsl:Ey,formatRgb:Wh,toString:Wh});function Lh(){return this.rgb().formatHex()}function Ty(){return this.rgb().formatHex8()}function Ey(){return Hh(this).formatHsl()}function Wh(){return this.rgb().formatRgb()}function Xn(n){var o,e;return n=(n+"").trim().toLowerCase(),(o=xy.exec(n))?(e=o[1].length,o=parseInt(o[1],16),e===6?Fh(o):e===3?new ui(o>>8&15|o>>4&240,o>>4&15|o&240,(o&15)<<4|o&15,1):e===8?Ds(o>>24&255,o>>16&255,o>>8&255,(o&255)/255):e===4?Ds(o>>12&15|o>>8&240,o>>8&15|o>>4&240,o>>4&15|o&240,((o&15)<<4|o&15)/255):null):(o=Cy.exec(n))?new ui(o[1],o[2],o[3],1):(o=Sy.exec(n))?new ui(o[1]*255/100,o[2]*255/100,o[3]*255/100,1):(o=wy.exec(n))?Ds(o[1],o[2],o[3],o[4]):(o=_y.exec(n))?Ds(o[1]*255/100,o[2]*255/100,o[3]*255/100,o[4]):(o=My.exec(n))?zh(o[1],o[2]/100,o[3]/100,1):(o=ky.exec(n))?zh(o[1],o[2]/100,o[3]/100,o[4]):Vh.hasOwnProperty(n)?Fh(Vh[n]):n==="transparent"?new ui(NaN,NaN,NaN,0):null}function Fh(n){return new ui(n>>16&255,n>>8&255,n&255,1)}function Ds(n,o,e,t){return t<=0&&(n=o=e=NaN),new ui(n,o,e,t)}function Dy(n){return n instanceof ir||(n=Xn(n)),n?(n=n.rgb(),new ui(n.r,n.g,n.b,n.opacity)):new ui}function ho(n,o,e,t){return arguments.length===1?Dy(n):new ui(n,o,e,t??1)}function ui(n,o,e,t){this.r=+n,this.g=+o,this.b=+e,this.opacity=+t}Es(ui,ho,Zl(ir,{brighter(n){return n=n==null?Is:Math.pow(Is,n),new ui(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?er:Math.pow(er,n),new ui(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new ui(wa(this.r),wa(this.g),wa(this.b),Ns(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Gh,formatHex:Gh,formatHex8:Py,formatRgb:Bh,toString:Bh}));function Gh(){return`#${Sa(this.r)}${Sa(this.g)}${Sa(this.b)}`}function Py(){return`#${Sa(this.r)}${Sa(this.g)}${Sa(this.b)}${Sa((isNaN(this.opacity)?1:this.opacity)*255)}`}function Bh(){let n=Ns(this.opacity);return`${n===1?"rgb(":"rgba("}${wa(this.r)}, ${wa(this.g)}, ${wa(this.b)}${n===1?")":`, ${n})`}`}function Ns(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function wa(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function Sa(n){return n=wa(n),(n<16?"0":"")+n.toString(16)}function zh(n,o,e,t){return t<=0?n=o=e=NaN:e<=0||e>=1?n=o=NaN:o<=0&&(n=NaN),new Ui(n,o,e,t)}function Hh(n){if(n instanceof Ui)return new Ui(n.h,n.s,n.l,n.opacity);if(n instanceof ir||(n=Xn(n)),!n)return new Ui;if(n instanceof Ui)return n;n=n.rgb();var o=n.r/255,e=n.g/255,t=n.b/255,i=Math.min(o,e,t),a=Math.max(o,e,t),r=NaN,s=a-i,l=(a+i)/2;return s?(o===a?r=(e-t)/s+(e<t)*6:e===a?r=(t-o)/s+2:r=(o-e)/s+4,s/=l<.5?a+i:2-a-i,r*=60):s=l>0&&l<1?0:r,new Ui(r,s,l,n.opacity)}function qh(n,o,e,t){return arguments.length===1?Hh(n):new Ui(n,o,e,t??1)}function Ui(n,o,e,t){this.h=+n,this.s=+o,this.l=+e,this.opacity=+t}Es(Ui,qh,Zl(ir,{brighter(n){return n=n==null?Is:Math.pow(Is,n),new Ui(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?er:Math.pow(er,n),new Ui(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,o=isNaN(n)||isNaN(this.s)?0:this.s,e=this.l,t=e+(e<.5?e:1-e)*o,i=2*e-t;return new ui(Ql(n>=240?n-240:n+120,i,t),Ql(n,i,t),Ql(n<120?n+240:n-120,i,t),this.opacity)},clamp(){return new Ui(Uh(this.h),Ps(this.s),Ps(this.l),Ns(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let n=Ns(this.opacity);return`${n===1?"hsl(":"hsla("}${Uh(this.h)}, ${Ps(this.s)*100}%, ${Ps(this.l)*100}%${n===1?")":`, ${n})`}`}}));function Uh(n){return n=(n||0)%360,n<0?n+360:n}function Ps(n){return Math.max(0,Math.min(1,n||0))}function Ql(n,o,e){return(n<60?o+(e-o)*n/60:n<180?e:n<240?o+(e-o)*(240-n)/60:o)*255}function Xl(n,o,e,t,i){var a=n*n,r=a*n;return((1-3*n+3*a-r)*o+(4-6*a+3*r)*e+(1+3*n+3*a-3*r)*t+r*i)/6}function $h(n){var o=n.length-1;return function(e){var t=e<=0?e=0:e>=1?(e=1,o-1):Math.floor(e*o),i=n[t],a=n[t+1],r=t>0?n[t-1]:2*i-a,s=t<o-1?n[t+2]:2*a-i;return Xl((e-t/o)*o,r,i,a,s)}}function jh(n){var o=n.length;return function(e){var t=Math.floor(((e%=1)<0?++e:e)*o),i=n[(t+o-1)%o],a=n[t%o],r=n[(t+1)%o],s=n[(t+2)%o];return Xl((e-t/o)*o,i,a,r,s)}}var Kl=n=>()=>n;function Iy(n,o){return function(e){return n+e*o}}function Ny(n,o,e){return n=Math.pow(n,e),o=Math.pow(o,e)-n,e=1/e,function(t){return Math.pow(n+t*o,e)}}function Yh(n){return(n=+n)==1?Rs:function(o,e){return e-o?Ny(o,e,n):Kl(isNaN(o)?e:o)}}function Rs(n,o){var e=o-n;return e?Iy(n,e):Kl(isNaN(n)?o:n)}var Os=(function n(o){var e=Yh(o);function t(i,a){var r=e((i=ho(i)).r,(a=ho(a)).r),s=e(i.g,a.g),l=e(i.b,a.b),m=Rs(i.opacity,a.opacity);return function(f){return i.r=r(f),i.g=s(f),i.b=l(f),i.opacity=m(f),i+""}}return t.gamma=n,t})(1);function Zh(n){return function(o){var e=o.length,t=new Array(e),i=new Array(e),a=new Array(e),r,s;for(r=0;r<e;++r)s=ho(o[r]),t[r]=s.r||0,i[r]=s.g||0,a[r]=s.b||0;return t=n(t),i=n(i),a=n(a),s.opacity=1,function(l){return s.r=t(l),s.g=i(l),s.b=a(l),s+""}}}var Ry=Zh($h),Oy=Zh(jh);function Pi(n,o){return n=+n,o=+o,function(e){return n*(1-e)+o*e}}var ed=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Jl=new RegExp(ed.source,"g");function Vy(n){return function(){return n}}function Ly(n){return function(o){return n(o)+""}}function td(n,o){var e=ed.lastIndex=Jl.lastIndex=0,t,i,a,r=-1,s=[],l=[];for(n=n+"",o=o+"";(t=ed.exec(n))&&(i=Jl.exec(o));)(a=i.index)>e&&(a=o.slice(e,a),s[r]?s[r]+=a:s[++r]=a),(t=t[0])===(i=i[0])?s[r]?s[r]+=i:s[++r]=i:(s[++r]=null,l.push({i:r,x:Pi(t,i)})),e=Jl.lastIndex;return e<o.length&&(a=o.slice(e),s[r]?s[r]+=a:s[++r]=a),s.length<2?l[0]?Ly(l[0].x):Vy(o):(o=l.length,function(m){for(var f=0,b;f<o;++f)s[(b=l[f]).i]=b.x(m);return s.join("")})}var Qh=180/Math.PI,Vs={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function id(n,o,e,t,i,a){var r,s,l;return(r=Math.sqrt(n*n+o*o))&&(n/=r,o/=r),(l=n*e+o*t)&&(e-=n*l,t-=o*l),(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s,l/=s),n*t<o*e&&(n=-n,o=-o,l=-l,r=-r),{translateX:i,translateY:a,rotate:Math.atan2(o,n)*Qh,skewX:Math.atan(l)*Qh,scaleX:r,scaleY:s}}var Ls;function Xh(n){let o=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(n+"");return o.isIdentity?Vs:id(o.a,o.b,o.c,o.d,o.e,o.f)}function Kh(n){return n==null?Vs:(Ls||(Ls=document.createElementNS("http://www.w3.org/2000/svg","g")),Ls.setAttribute("transform",n),(n=Ls.transform.baseVal.consolidate())?(n=n.matrix,id(n.a,n.b,n.c,n.d,n.e,n.f)):Vs)}function Jh(n,o,e,t){function i(m){return m.length?m.pop()+" ":""}function a(m,f,b,A,C,w){if(m!==b||f!==A){var M=C.push("translate(",null,o,null,e);w.push({i:M-4,x:Pi(m,b)},{i:M-2,x:Pi(f,A)})}else(b||A)&&C.push("translate("+b+o+A+e)}function r(m,f,b,A){m!==f?(m-f>180?f+=360:f-m>180&&(m+=360),A.push({i:b.push(i(b)+"rotate(",null,t)-2,x:Pi(m,f)})):f&&b.push(i(b)+"rotate("+f+t)}function s(m,f,b,A){m!==f?A.push({i:b.push(i(b)+"skewX(",null,t)-2,x:Pi(m,f)}):f&&b.push(i(b)+"skewX("+f+t)}function l(m,f,b,A,C,w){if(m!==b||f!==A){var M=C.push(i(C)+"scale(",null,",",null,")");w.push({i:M-4,x:Pi(m,b)},{i:M-2,x:Pi(f,A)})}else(b!==1||A!==1)&&C.push(i(C)+"scale("+b+","+A+")")}return function(m,f){var b=[],A=[];return m=n(m),f=n(f),a(m.translateX,m.translateY,f.translateX,f.translateY,b,A),r(m.rotate,f.rotate,b,A),s(m.skewX,f.skewX,b,A),l(m.scaleX,m.scaleY,f.scaleX,f.scaleY,b,A),m=f=null,function(C){for(var w=-1,M=A.length,G;++w<M;)b[(G=A[w]).i]=G.x(C);return b.join("")}}}var nd=Jh(Xh,"px, ","px)","deg)"),ad=Jh(Kh,", ",")",")");var po=0,ar=0,nr=0,tp=1e3,Ws,or,Fs=0,_a=0,Gs=0,rr=typeof performance=="object"&&performance.now?performance:Date,ip=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function lr(){return _a||(ip(Wy),_a=rr.now()+Gs)}function Wy(){_a=0}function sr(){this._call=this._time=this._next=null}sr.prototype=Bs.prototype={constructor:sr,restart:function(n,o,e){if(typeof n!="function")throw new TypeError("callback is not a function");e=(e==null?lr():+e)+(o==null?0:+o),!this._next&&or!==this&&(or?or._next=this:Ws=this,or=this),this._call=n,this._time=e,od()},stop:function(){this._call&&(this._call=null,this._time=1/0,od())}};function Bs(n,o,e){var t=new sr;return t.restart(n,o,e),t}function np(){lr(),++po;for(var n=Ws,o;n;)(o=_a-n._time)>=0&&n._call.call(void 0,o),n=n._next;--po}function ep(){_a=(Fs=rr.now())+Gs,po=ar=0;try{np()}finally{po=0,Gy(),_a=0}}function Fy(){var n=rr.now(),o=n-Fs;o>tp&&(Gs-=o,Fs=n)}function Gy(){for(var n,o=Ws,e,t=1/0;o;)o._call?(t>o._time&&(t=o._time),n=o,o=o._next):(e=o._next,o._next=null,o=n?n._next=e:Ws=e);or=n,od(t)}function od(n){if(!po){ar&&(ar=clearTimeout(ar));var o=n-_a;o>24?(n<1/0&&(ar=setTimeout(ep,n-rr.now()-Gs)),nr&&(nr=clearInterval(nr))):(nr||(Fs=rr.now(),nr=setInterval(Fy,tp)),po=1,ip(ep))}}function zs(n,o,e){var t=new sr;return o=o==null?0:+o,t.restart(i=>{t.stop(),n(i+o)},o,e),t}var By=Hl("start","end","cancel","interrupt"),zy=[],rp=0,ap=1,Hs=2,Us=3,op=4,qs=5,dr=6;function Kn(n,o,e,t,i,a){var r=n.__transition;if(!r)n.__transition={};else if(e in r)return;Uy(n,e,{name:o,index:t,group:i,on:By,tween:zy,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:rp})}function cr(n,o){var e=Rt(n,o);if(e.state>rp)throw new Error("too late; already scheduled");return e}function Gt(n,o){var e=Rt(n,o);if(e.state>Us)throw new Error("too late; already running");return e}function Rt(n,o){var e=n.__transition;if(!e||!(e=e[o]))throw new Error("transition not found");return e}function Uy(n,o,e){var t=n.__transition,i;t[o]=e,e.timer=Bs(a,0,e.time);function a(m){e.state=ap,e.timer.restart(r,e.delay,e.time),e.delay<=m&&r(m-e.delay)}function r(m){var f,b,A,C;if(e.state!==ap)return l();for(f in t)if(C=t[f],C.name===e.name){if(C.state===Us)return zs(r);C.state===op?(C.state=dr,C.timer.stop(),C.on.call("interrupt",n,n.__data__,C.index,C.group),delete t[f]):+f<o&&(C.state=dr,C.timer.stop(),C.on.call("cancel",n,n.__data__,C.index,C.group),delete t[f])}if(zs(function(){e.state===Us&&(e.state=op,e.timer.restart(s,e.delay,e.time),s(m))}),e.state=Hs,e.on.call("start",n,n.__data__,e.index,e.group),e.state===Hs){for(e.state=Us,i=new Array(A=e.tween.length),f=0,b=-1;f<A;++f)(C=e.tween[f].value.call(n,n.__data__,e.index,e.group))&&(i[++b]=C);i.length=b+1}}function s(m){for(var f=m<e.duration?e.ease.call(null,m/e.duration):(e.timer.restart(l),e.state=qs,1),b=-1,A=i.length;++b<A;)i[b].call(n,f);e.state===qs&&(e.on.call("end",n,n.__data__,e.index,e.group),l())}function l(){e.state=dr,e.timer.stop(),delete t[o];for(var m in t)return;delete n.__transition}}function $s(n,o){var e=n.__transition,t,i,a=!0,r;if(e){o=o==null?null:o+"";for(r in e){if((t=e[r]).name!==o){a=!1;continue}i=t.state>Hs&&t.state<qs,t.state=dr,t.timer.stop(),t.on.call(i?"interrupt":"cancel",n,n.__data__,t.index,t.group),delete e[r]}a&&delete n.__transition}}function sp(n){return this.each(function(){$s(this,n)})}function Hy(n,o){var e,t;return function(){var i=Gt(this,n),a=i.tween;if(a!==e){t=e=a;for(var r=0,s=t.length;r<s;++r)if(t[r].name===o){t=t.slice(),t.splice(r,1);break}}i.tween=t}}function qy(n,o,e){var t,i;if(typeof e!="function")throw new Error;return function(){var a=Gt(this,n),r=a.tween;if(r!==t){i=(t=r).slice();for(var s={name:o,value:e},l=0,m=i.length;l<m;++l)if(i[l].name===o){i[l]=s;break}l===m&&i.push(s)}a.tween=i}}function lp(n,o){var e=this._id;if(n+="",arguments.length<2){for(var t=Rt(this.node(),e).tween,i=0,a=t.length,r;i<a;++i)if((r=t[i]).name===n)return r.value;return null}return this.each((o==null?Hy:qy)(e,n,o))}function fo(n,o,e){var t=n._id;return n.each(function(){var i=Gt(this,t);(i.value||(i.value={}))[o]=e.apply(this,arguments)}),function(i){return Rt(i,t).value[o]}}function js(n,o){var e;return(typeof o=="number"?Pi:o instanceof Xn?Os:(e=Xn(o))?(o=e,Os):td)(n,o)}function $y(n){return function(){this.removeAttribute(n)}}function jy(n){return function(){this.removeAttributeNS(n.space,n.local)}}function Yy(n,o,e){var t,i=e+"",a;return function(){var r=this.getAttribute(n);return r===i?null:r===t?a:a=o(t=r,e)}}function Zy(n,o,e){var t,i=e+"",a;return function(){var r=this.getAttributeNS(n.space,n.local);return r===i?null:r===t?a:a=o(t=r,e)}}function Qy(n,o,e){var t,i,a;return function(){var r,s=e(this),l;return s==null?void this.removeAttribute(n):(r=this.getAttribute(n),l=s+"",r===l?null:r===t&&l===i?a:(i=l,a=o(t=r,s)))}}function Xy(n,o,e){var t,i,a;return function(){var r,s=e(this),l;return s==null?void this.removeAttributeNS(n.space,n.local):(r=this.getAttributeNS(n.space,n.local),l=s+"",r===l?null:r===t&&l===i?a:(i=l,a=o(t=r,s)))}}function dp(n,o){var e=yn(n),t=e==="transform"?ad:js;return this.attrTween(n,typeof o=="function"?(e.local?Xy:Qy)(e,t,fo(this,"attr."+n,o)):o==null?(e.local?jy:$y)(e):(e.local?Zy:Yy)(e,t,o))}function Ky(n,o){return function(e){this.setAttribute(n,o.call(this,e))}}function Jy(n,o){return function(e){this.setAttributeNS(n.space,n.local,o.call(this,e))}}function ex(n,o){var e,t;function i(){var a=o.apply(this,arguments);return a!==t&&(e=(t=a)&&Jy(n,a)),e}return i._value=o,i}function tx(n,o){var e,t;function i(){var a=o.apply(this,arguments);return a!==t&&(e=(t=a)&&Ky(n,a)),e}return i._value=o,i}function cp(n,o){var e="attr."+n;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(o==null)return this.tween(e,null);if(typeof o!="function")throw new Error;var t=yn(n);return this.tween(e,(t.local?ex:tx)(t,o))}function ix(n,o){return function(){cr(this,n).delay=+o.apply(this,arguments)}}function nx(n,o){return o=+o,function(){cr(this,n).delay=o}}function up(n){var o=this._id;return arguments.length?this.each((typeof n=="function"?ix:nx)(o,n)):Rt(this.node(),o).delay}function ax(n,o){return function(){Gt(this,n).duration=+o.apply(this,arguments)}}function ox(n,o){return o=+o,function(){Gt(this,n).duration=o}}function mp(n){var o=this._id;return arguments.length?this.each((typeof n=="function"?ax:ox)(o,n)):Rt(this.node(),o).duration}function rx(n,o){if(typeof o!="function")throw new Error;return function(){Gt(this,n).ease=o}}function hp(n){var o=this._id;return arguments.length?this.each(rx(o,n)):Rt(this.node(),o).ease}function sx(n,o){return function(){var e=o.apply(this,arguments);if(typeof e!="function")throw new Error;Gt(this,n).ease=e}}function pp(n){if(typeof n!="function")throw new Error;return this.each(sx(this._id,n))}function fp(n){typeof n!="function"&&(n=Ko(n));for(var o=this._groups,e=o.length,t=new Array(e),i=0;i<e;++i)for(var a=o[i],r=a.length,s=t[i]=[],l,m=0;m<r;++m)(l=a[m])&&n.call(l,l.__data__,m,a)&&s.push(l);return new Qt(t,this._parents,this._name,this._id)}function gp(n){if(n._id!==this._id)throw new Error;for(var o=this._groups,e=n._groups,t=o.length,i=e.length,a=Math.min(t,i),r=new Array(t),s=0;s<a;++s)for(var l=o[s],m=e[s],f=l.length,b=r[s]=new Array(f),A,C=0;C<f;++C)(A=l[C]||m[C])&&(b[C]=A);for(;s<t;++s)r[s]=o[s];return new Qt(r,this._parents,this._name,this._id)}function lx(n){return(n+"").trim().split(/^|\s+/).every(function(o){var e=o.indexOf(".");return e>=0&&(o=o.slice(0,e)),!o||o==="start"})}function dx(n,o,e){var t,i,a=lx(o)?cr:Gt;return function(){var r=a(this,n),s=r.on;s!==t&&(i=(t=s).copy()).on(o,e),r.on=i}}function vp(n,o){var e=this._id;return arguments.length<2?Rt(this.node(),e).on.on(n):this.each(dx(e,n,o))}function cx(n){return function(){var o=this.parentNode;for(var e in this.__transition)if(+e!==n)return;o&&o.removeChild(this)}}function bp(){return this.on("end.remove",cx(this._id))}function Ap(n){var o=this._name,e=this._id;typeof n!="function"&&(n=xa(n));for(var t=this._groups,i=t.length,a=new Array(i),r=0;r<i;++r)for(var s=t[r],l=s.length,m=a[r]=new Array(l),f,b,A=0;A<l;++A)(f=s[A])&&(b=n.call(f,f.__data__,A,s))&&("__data__"in f&&(b.__data__=f.__data__),m[A]=b,Kn(m[A],o,e,A,m,Rt(f,e)));return new Qt(a,this._parents,o,e)}function yp(n){var o=this._name,e=this._id;typeof n!="function"&&(n=Xo(n));for(var t=this._groups,i=t.length,a=[],r=[],s=0;s<i;++s)for(var l=t[s],m=l.length,f,b=0;b<m;++b)if(f=l[b]){for(var A=n.call(f,f.__data__,b,l),C,w=Rt(f,e),M=0,G=A.length;M<G;++M)(C=A[M])&&Kn(C,o,e,M,A,w);a.push(A),r.push(f)}return new Qt(a,r,o,e)}var ux=xn.prototype.constructor;function xp(){return new ux(this._groups,this._parents)}function mx(n,o){var e,t,i;return function(){var a=Qn(this,n),r=(this.style.removeProperty(n),Qn(this,n));return a===r?null:a===e&&r===t?i:i=o(e=a,t=r)}}function Cp(n){return function(){this.style.removeProperty(n)}}function hx(n,o,e){var t,i=e+"",a;return function(){var r=Qn(this,n);return r===i?null:r===t?a:a=o(t=r,e)}}function px(n,o,e){var t,i,a;return function(){var r=Qn(this,n),s=e(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(n),Qn(this,n))),r===l?null:r===t&&l===i?a:(i=l,a=o(t=r,s))}}function fx(n,o){var e,t,i,a="style."+o,r="end."+a,s;return function(){var l=Gt(this,n),m=l.on,f=l.value[a]==null?s||(s=Cp(o)):void 0;(m!==e||i!==f)&&(t=(e=m).copy()).on(r,i=f),l.on=t}}function Sp(n,o,e){var t=(n+="")=="transform"?nd:js;return o==null?this.styleTween(n,mx(n,t)).on("end.style."+n,Cp(n)):typeof o=="function"?this.styleTween(n,px(n,t,fo(this,"style."+n,o))).each(fx(this._id,n)):this.styleTween(n,hx(n,t,o),e).on("end.style."+n,null)}function gx(n,o,e){return function(t){this.style.setProperty(n,o.call(this,t),e)}}function vx(n,o,e){var t,i;function a(){var r=o.apply(this,arguments);return r!==i&&(t=(i=r)&&gx(n,r,e)),t}return a._value=o,a}function wp(n,o,e){var t="style."+(n+="");if(arguments.length<2)return(t=this.tween(t))&&t._value;if(o==null)return this.tween(t,null);if(typeof o!="function")throw new Error;return this.tween(t,vx(n,o,e??""))}function bx(n){return function(){this.textContent=n}}function Ax(n){return function(){var o=n(this);this.textContent=o??""}}function _p(n){return this.tween("text",typeof n=="function"?Ax(fo(this,"text",n)):bx(n==null?"":n+""))}function yx(n){return function(o){this.textContent=n.call(this,o)}}function xx(n){var o,e;function t(){var i=n.apply(this,arguments);return i!==e&&(o=(e=i)&&yx(i)),o}return t._value=n,t}function Mp(n){var o="text";if(arguments.length<1)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;return this.tween(o,xx(n))}function kp(){for(var n=this._name,o=this._id,e=Ys(),t=this._groups,i=t.length,a=0;a<i;++a)for(var r=t[a],s=r.length,l,m=0;m<s;++m)if(l=r[m]){var f=Rt(l,o);Kn(l,n,e,m,r,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Qt(t,this._parents,n,e)}function Tp(){var n,o,e=this,t=e._id,i=e.size();return new Promise(function(a,r){var s={value:r},l={value:function(){--i===0&&a()}};e.each(function(){var m=Gt(this,t),f=m.on;f!==n&&(o=(n=f).copy(),o._.cancel.push(s),o._.interrupt.push(s),o._.end.push(l)),m.on=o}),i===0&&a()})}var Cx=0;function Qt(n,o,e,t){this._groups=n,this._parents=o,this._name=e,this._id=t}function Ep(n){return xn().transition(n)}function Ys(){return++Cx}var Cn=xn.prototype;Qt.prototype=Ep.prototype={constructor:Qt,select:Ap,selectAll:yp,selectChild:Cn.selectChild,selectChildren:Cn.selectChildren,filter:fp,merge:gp,selection:xp,transition:kp,call:Cn.call,nodes:Cn.nodes,node:Cn.node,size:Cn.size,empty:Cn.empty,each:Cn.each,on:vp,attr:dp,attrTween:cp,style:Sp,styleTween:wp,text:_p,textTween:Mp,remove:bp,tween:lp,delay:up,duration:mp,ease:hp,easeVarying:pp,end:Tp,[Symbol.iterator]:Cn[Symbol.iterator]};function Zs(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}var Sx={time:null,delay:0,duration:250,ease:Zs};function wx(n,o){for(var e;!(e=n.__transition)||!(e=e[o]);)if(!(n=n.parentNode))throw new Error(`transition ${o} not found`);return e}function Dp(n){var o,e;n instanceof Qt?(o=n._id,n=n._name):(o=Ys(),(e=Sx).time=lr(),n=n==null?null:n+"");for(var t=this._groups,i=t.length,a=0;a<i;++a)for(var r=t[a],s=r.length,l,m=0;m<s;++m)(l=r[m])&&Kn(l,n,o,m,r,e||wx(l,o));return new Qt(t,this._parents,n,o)}xn.prototype.interrupt=sp;xn.prototype.transition=Dp;var{abs:n8,max:a8,min:o8}=Math;function Pp(n){return[+n[0],+n[1]]}function _x(n){return[Pp(n[0]),Pp(n[1])]}var r8={name:"x",handles:["w","e"].map(rd),input:function(n,o){return n==null?null:[[+n[0],o[0][1]],[+n[1],o[1][1]]]},output:function(n){return n&&[n[0][0],n[1][0]]}},s8={name:"y",handles:["n","s"].map(rd),input:function(n,o){return n==null?null:[[o[0][0],+n[0]],[o[1][0],+n[1]]]},output:function(n){return n&&[n[0][1],n[1][1]]}},l8={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(rd),input:function(n){return n==null?null:_x(n)},output:function(n){return n}};function rd(n){return{type:n}}var sd=Math.PI,ld=2*sd,Ma=1e-6,Mx=ld-Ma;function Ip(n){this._+=n[0];for(let o=1,e=n.length;o<e;++o)this._+=arguments[o]+n[o]}function kx(n){let o=Math.floor(n);if(!(o>=0))throw new Error(`invalid digits: ${n}`);if(o>15)return Ip;let e=10**o;return function(t){this._+=t[0];for(let i=1,a=t.length;i<a;++i)this._+=Math.round(arguments[i]*e)/e+t[i]}}var ka=class{constructor(o){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=o==null?Ip:kx(o)}moveTo(o,e){this._append`M${this._x0=this._x1=+o},${this._y0=this._y1=+e}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(o,e){this._append`L${this._x1=+o},${this._y1=+e}`}quadraticCurveTo(o,e,t,i){this._append`Q${+o},${+e},${this._x1=+t},${this._y1=+i}`}bezierCurveTo(o,e,t,i,a,r){this._append`C${+o},${+e},${+t},${+i},${this._x1=+a},${this._y1=+r}`}arcTo(o,e,t,i,a){if(o=+o,e=+e,t=+t,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let r=this._x1,s=this._y1,l=t-o,m=i-e,f=r-o,b=s-e,A=f*f+b*b;if(this._x1===null)this._append`M${this._x1=o},${this._y1=e}`;else if(A>Ma)if(!(Math.abs(b*l-m*f)>Ma)||!a)this._append`L${this._x1=o},${this._y1=e}`;else{let C=t-r,w=i-s,M=l*l+m*m,G=C*C+w*w,E=Math.sqrt(M),W=Math.sqrt(A),V=a*Math.tan((sd-Math.acos((M+A-G)/(2*E*W)))/2),Y=V/W,j=V/E;Math.abs(Y-1)>Ma&&this._append`L${o+Y*f},${e+Y*b}`,this._append`A${a},${a},0,0,${+(b*C>f*w)},${this._x1=o+j*l},${this._y1=e+j*m}`}}arc(o,e,t,i,a,r){if(o=+o,e=+e,t=+t,r=!!r,t<0)throw new Error(`negative radius: ${t}`);let s=t*Math.cos(i),l=t*Math.sin(i),m=o+s,f=e+l,b=1^r,A=r?i-a:a-i;this._x1===null?this._append`M${m},${f}`:(Math.abs(this._x1-m)>Ma||Math.abs(this._y1-f)>Ma)&&this._append`L${m},${f}`,t&&(A<0&&(A=A%ld+ld),A>Mx?this._append`A${t},${t},0,1,${b},${o-s},${e-l}A${t},${t},0,1,${b},${this._x1=m},${this._y1=f}`:A>Ma&&this._append`A${t},${t},0,${+(A>=sd)},${b},${this._x1=o+t*Math.cos(a)},${this._y1=e+t*Math.sin(a)}`)}rect(o,e,t,i){this._append`M${this._x0=this._x1=+o},${this._y0=this._y1=+e}h${t=+t}v${+i}h${-t}Z`}toString(){return this._}};function Np(){return new ka}Np.prototype=ka.prototype;function Sn(n){return function(){return n}}var dd=Math.abs,Bt=Math.atan2,Jn=Math.cos,Rp=Math.max,Qs=Math.min,Hi=Math.sin,Ta=Math.sqrt,Xt=1e-12,go=Math.PI,ur=go/2,Op=2*go;function Vp(n){return n>1?0:n<-1?go:Math.acos(n)}function cd(n){return n>=1?ur:n<=-1?-ur:Math.asin(n)}function Lp(n){let o=3;return n.digits=function(e){if(!arguments.length)return o;if(e==null)o=null;else{let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);o=t}return n},()=>new ka(o)}function Tx(n){return n.innerRadius}function Ex(n){return n.outerRadius}function Dx(n){return n.startAngle}function Px(n){return n.endAngle}function Ix(n){return n&&n.padAngle}function Nx(n,o,e,t,i,a,r,s){var l=e-n,m=t-o,f=r-i,b=s-a,A=b*l-f*m;if(!(A*A<Xt))return A=(f*(o-a)-b*(n-i))/A,[n+A*l,o+A*m]}function Xs(n,o,e,t,i,a,r){var s=n-e,l=o-t,m=(r?a:-a)/Ta(s*s+l*l),f=m*l,b=-m*s,A=n+f,C=o+b,w=e+f,M=t+b,G=(A+w)/2,E=(C+M)/2,W=w-A,V=M-C,Y=W*W+V*V,j=i-a,ye=A*M-w*C,me=(V<0?-1:1)*Ta(Rp(0,j*j*Y-ye*ye)),ne=(ye*V-W*me)/Y,re=(-ye*W-V*me)/Y,ce=(ye*V+W*me)/Y,oe=(-ye*W+V*me)/Y,de=ne-G,le=re-E,ve=ce-G,ze=oe-E;return de*de+le*le>ve*ve+ze*ze&&(ne=ce,re=oe),{cx:ne,cy:re,x01:-f,y01:-b,x11:ne*(i/j-1),y11:re*(i/j-1)}}function ud(){var n=Tx,o=Ex,e=Sn(0),t=null,i=Dx,a=Px,r=Ix,s=null,l=Lp(m);function m(){var f,b,A=+n.apply(this,arguments),C=+o.apply(this,arguments),w=i.apply(this,arguments)-ur,M=a.apply(this,arguments)-ur,G=dd(M-w),E=M>w;if(s||(s=f=l()),C<A&&(b=C,C=A,A=b),!(C>Xt))s.moveTo(0,0);else if(G>Op-Xt)s.moveTo(C*Jn(w),C*Hi(w)),s.arc(0,0,C,w,M,!E),A>Xt&&(s.moveTo(A*Jn(M),A*Hi(M)),s.arc(0,0,A,M,w,E));else{var W=w,V=M,Y=w,j=M,ye=G,me=G,ne=r.apply(this,arguments)/2,re=ne>Xt&&(t?+t.apply(this,arguments):Ta(A*A+C*C)),ce=Qs(dd(C-A)/2,+e.apply(this,arguments)),oe=ce,de=ce,le,ve;if(re>Xt){var ze=cd(re/A*Hi(ne)),ot=cd(re/C*Hi(ne));(ye-=ze*2)>Xt?(ze*=E?1:-1,Y+=ze,j-=ze):(ye=0,Y=j=(w+M)/2),(me-=ot*2)>Xt?(ot*=E?1:-1,W+=ot,V-=ot):(me=0,W=V=(w+M)/2)}var Mt=C*Jn(W),Yt=C*Hi(W),mi=A*Jn(j),ra=A*Hi(j);if(ce>Xt){var Oa=C*Jn(V),sa=C*Hi(V),Va=A*Jn(Y),wo=A*Hi(Y),Ni;if(G<go)if(Ni=Nx(Mt,Yt,Va,wo,Oa,sa,mi,ra)){var _o=Mt-Ni[0],Mo=Yt-Ni[1],La=Oa-Ni[0],ko=sa-Ni[1],To=1/Hi(Vp((_o*La+Mo*ko)/(Ta(_o*_o+Mo*Mo)*Ta(La*La+ko*ko)))/2),gr=Ta(Ni[0]*Ni[0]+Ni[1]*Ni[1]);oe=Qs(ce,(A-gr)/(To-1)),de=Qs(ce,(C-gr)/(To+1))}else oe=de=0}me>Xt?de>Xt?(le=Xs(Va,wo,Mt,Yt,C,de,E),ve=Xs(Oa,sa,mi,ra,C,de,E),s.moveTo(le.cx+le.x01,le.cy+le.y01),de<ce?s.arc(le.cx,le.cy,de,Bt(le.y01,le.x01),Bt(ve.y01,ve.x01),!E):(s.arc(le.cx,le.cy,de,Bt(le.y01,le.x01),Bt(le.y11,le.x11),!E),s.arc(0,0,C,Bt(le.cy+le.y11,le.cx+le.x11),Bt(ve.cy+ve.y11,ve.cx+ve.x11),!E),s.arc(ve.cx,ve.cy,de,Bt(ve.y11,ve.x11),Bt(ve.y01,ve.x01),!E))):(s.moveTo(Mt,Yt),s.arc(0,0,C,W,V,!E)):s.moveTo(Mt,Yt),!(A>Xt)||!(ye>Xt)?s.lineTo(mi,ra):oe>Xt?(le=Xs(mi,ra,Oa,sa,A,-oe,E),ve=Xs(Mt,Yt,Va,wo,A,-oe,E),s.lineTo(le.cx+le.x01,le.cy+le.y01),oe<ce?s.arc(le.cx,le.cy,oe,Bt(le.y01,le.x01),Bt(ve.y01,ve.x01),!E):(s.arc(le.cx,le.cy,oe,Bt(le.y01,le.x01),Bt(le.y11,le.x11),!E),s.arc(0,0,A,Bt(le.cy+le.y11,le.cx+le.x11),Bt(ve.cy+ve.y11,ve.cx+ve.x11),E),s.arc(ve.cx,ve.cy,oe,Bt(ve.y11,ve.x11),Bt(ve.y01,ve.x01),!E))):s.arc(0,0,A,j,Y,E)}if(s.closePath(),f)return s=null,f+""||null}return m.centroid=function(){var f=(+n.apply(this,arguments)+ +o.apply(this,arguments))/2,b=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-go/2;return[Jn(b)*f,Hi(b)*f]},m.innerRadius=function(f){return arguments.length?(n=typeof f=="function"?f:Sn(+f),m):n},m.outerRadius=function(f){return arguments.length?(o=typeof f=="function"?f:Sn(+f),m):o},m.cornerRadius=function(f){return arguments.length?(e=typeof f=="function"?f:Sn(+f),m):e},m.padRadius=function(f){return arguments.length?(t=f==null?null:typeof f=="function"?f:Sn(+f),m):t},m.startAngle=function(f){return arguments.length?(i=typeof f=="function"?f:Sn(+f),m):i},m.endAngle=function(f){return arguments.length?(a=typeof f=="function"?f:Sn(+f),m):a},m.padAngle=function(f){return arguments.length?(r=typeof f=="function"?f:Sn(+f),m):r},m.context=function(f){return arguments.length?(s=f??null,m):s},m}function ea(n,o,e){this.k=n,this.x=o,this.y=e}ea.prototype={constructor:ea,scale:function(n){return n===1?this:new ea(this.k*n,this.x,this.y)},translate:function(n,o){return n===0&o===0?this:new ea(this.k,this.x+this.k*n,this.y+this.k*o)},apply:function(n){return[n[0]*this.k+this.x,n[1]*this.k+this.y]},applyX:function(n){return n*this.k+this.x},applyY:function(n){return n*this.k+this.y},invert:function(n){return[(n[0]-this.x)/this.k,(n[1]-this.y)/this.k]},invertX:function(n){return(n-this.x)/this.k},invertY:function(n){return(n-this.y)/this.k},rescaleX:function(n){return n.copy().domain(n.range().map(this.invertX,this).map(n.invert,n))},rescaleY:function(n){return n.copy().domain(n.range().map(this.invertY,this).map(n.invert,n))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var md=new ea(1,0,0);hd.prototype=ea.prototype;function hd(n){for(;!n.__zoom;)if(!(n=n.parentNode))return md;return n.__zoom}var mr=!1,Rx=250,Ox=["atons.urn:mrn:imo:mmsi:*","shore.basestations.urn:mrn:imo:mmsi:*","vessels.urn:mrn:imo:mmsi:*","sar.urn:mrn:imo:mmsi:*"],Vx=[{prefix:"atons.urn:mrn:imo:mmsi:",type:"aton"},{prefix:"shore.basestations.urn:mrn:imo:mmsi:",type:"basestation"},{prefix:"vessels.urn:mrn:imo:mmsi:",type:"vessel"},{prefix:"sar.urn:mrn:imo:mmsi:",type:"sar"}],Lx="self.navigation.*",Fp=(()=>{class n{data=y(Wt);destroyRef=y(Ze);tracks=new Map;contextIndex=new Map;mmsiIndex=new Map;targetsDirty$=new zt;_targets=_([]);_ownShip=_({});_hasCollisionRiskData=_(!1);targets=this._targets.asReadonly();ownShip=this._ownShip.asReadonly();hasCollisionRiskData=this._hasCollisionRiskData.asReadonly();getBearingTrue(e,t){if(typeof e.latitude!="number"||typeof e.longitude!="number"||typeof t.latitude!="number"||typeof t.longitude!="number")return null;let i=e.latitude*Math.PI/180,a=t.latitude*Math.PI/180,r=(t.longitude-e.longitude)*Math.PI/180,s=Math.sin(r)*Math.cos(a),l=Math.cos(i)*Math.sin(a)-Math.sin(i)*Math.cos(a)*Math.cos(r),m=Math.atan2(s,l)*180/Math.PI;return this.wrapDegrees(m)}constructor(){gi(...Ox.map(t=>this.data.subscribePathTree(t))).pipe($e(this.destroyRef)).subscribe(t=>this.handleAisTreeUpdate(t)),this.data.subscribePathTree(Lx).pipe($e(this.destroyRef)).subscribe(t=>this.handleOwnShipTreeUpdate(t)),this.targetsDirty$.pipe(sc(Rx,void 0,{leading:!0,trailing:!0}),$e(this.destroyRef)).subscribe(()=>this.flushTargetsSignal())}handleAisTreeUpdate(e){let t=this.matchAisContext(e.path);t&&(mr&&console.debug("[AIS] update",{context:t.context,path:t.path,type:t.type,value:e.update.data.value}),this.applyAisUpdate({context:t.context,type:t.type,path:t.path,value:e.update.data.value,timestampMs:this.toTimestampMs(e.update.data.timestamp)}))}handleOwnShipTreeUpdate(e){if(!e.path.startsWith("self."))return;let t=e.path.slice(5);this.applyOwnShipUpdate(t,e.update.data.value)}matchAisContext(e){for(let t of Vx){if(!e.startsWith(t.prefix))continue;let i=e.indexOf(".",t.prefix.length);return i===-1?null:{context:e.slice(0,i),path:e.slice(i+1),type:t.type}}return null}applyOwnShipUpdate(e,t){let i=ae({},this._ownShip()),a=this.readPositionValue(t);switch(e){case"navigation.position":a&&(i.position=a);break;case"navigation.position.latitude":{let r=this.toNumberOrUndefined(t);if(r===void 0)return;i.position=fe(ae({},i.position??{}),{latitude:r})}break;case"navigation.position.longitude":{let r=this.toNumberOrUndefined(t);if(r===void 0)return;i.position=fe(ae({},i.position??{}),{longitude:r})}break;case"navigation.headingTrue":i.headingTrue=this.toNumberOrUndefined(t);break;case"navigation.courseOverGroundTrue":i.courseOverGroundTrue=this.toNumberOrUndefined(t);break;case"navigation.speedOverGround":i.speedOverGround=this.toNumberOrUndefined(t);break;default:return}this._ownShip.set(i)}applyAisUpdate(e){let t=this.resolveTrack(e);if(!t)return;t.lastUpdateAt=e.timestampMs,e.path.startsWith("navigation.closestApproach.")&&this.isVesselLike(t)&&!t.closestApproach&&(t.closestApproach={});let i=!1;({mmsi:()=>this.applyMmsi(t,e.value),name:()=>{t.name=this.toStringOrUndefined(e.value)},"communication.callsignVhf":()=>{this.isVesselLike(t)&&(t.callsign=this.toStringOrUndefined(e.value))},"navigation.destination":()=>{this.isVesselLike(t)&&(t.destination=this.toStringOrUndefined(e.value))},"navigation.destination.commonName":()=>{this.isVesselLike(t)&&(t.destination=this.toStringOrUndefined(e.value))},"navigation.destination.eta":()=>{this.isVesselLike(t)&&(t.eta=this.toStringOrUndefined(e.value))},"design.beam":()=>{this.isVesselLike(t)&&(t.design=fe(ae({},t.design??{}),{beam:this.toNumberOrUndefined(e.value)}))},"design.length.overall":()=>{this.isVesselLike(t)&&(t.design=fe(ae({},t.design??{}),{length:fe(ae({},t.design?.length??{}),{overall:this.toNumberOrUndefined(e.value)})}))},"design.length.hull":()=>{this.isVesselLike(t)&&(t.design=fe(ae({},t.design??{}),{length:fe(ae({},t.design?.length??{}),{hull:this.toNumberOrUndefined(e.value)})}))},"design.length.waterline":()=>{this.isVesselLike(t)&&(t.design=fe(ae({},t.design??{}),{length:fe(ae({},t.design?.length??{}),{waterline:this.toNumberOrUndefined(e.value)})}))},"design.draft.maximum":()=>{this.isVesselLike(t)&&(t.design=fe(ae({},t.design??{}),{draft:fe(ae({},t.design?.draft??{}),{maximum:this.toNumberOrUndefined(e.value)})}))},"design.draft.minimum":()=>{this.isVesselLike(t)&&(t.design=fe(ae({},t.design??{}),{draft:fe(ae({},t.design?.draft??{}),{minimum:this.toNumberOrUndefined(e.value)})}))},"design.draft.current":()=>{this.isVesselLike(t)&&(t.design=fe(ae({},t.design??{}),{draft:fe(ae({},t.design?.draft??{}),{current:this.toNumberOrUndefined(e.value)})}))},"design.draft.canoe":()=>{this.isVesselLike(t)&&(t.design=fe(ae({},t.design??{}),{draft:fe(ae({},t.design?.draft??{}),{canoe:this.toNumberOrUndefined(e.value)})}))},"registrations.imo":()=>{this.isVesselLike(t)&&(t.imo=this.toStringOrUndefined(e.value))},"navigation.courseOverGroundTrue":()=>{this.isVesselLike(t)&&(t.courseOverGroundTrue=this.toNumberOrUndefined(e.value))},"navigation.headingTrue":()=>{this.isVesselLike(t)&&(t.headingTrue=this.toNumberOrUndefined(e.value))},"navigation.rateOfTurn":()=>{this.isVesselLike(t)&&(t.rateOfTurn=this.toNumberOrUndefined(e.value))},"navigation.specialManeuver":()=>{this.isVesselLike(t)&&(t.specialManeuver=this.toStringOrUndefined(e.value))},"navigation.speedOverGround":()=>{this.isVesselLike(t)&&(t.speedOverGround=this.toNumberOrUndefined(e.value))},"navigation.state":()=>{this.isVesselLike(t)&&(t.navState=this.toStringOrUndefined(e.value))},"sensors.ais.class":()=>{t.ais.class=this.normalizeAisClass(e.value)},"sensors.ais.status":()=>{let r=this.normalizeAisStatus(e.value);if(r){if(r==="remove"){this.removeTrack(t),i=!0;return}t.ais.status=r}},"sensors.ais.fromBow":()=>{this.isVesselLike(t)&&(t.fromBow=this.toNumberOrUndefined(e.value))},"sensors.ais.fromCenter":()=>{this.isVesselLike(t)&&(t.fromCenter=this.toNumberOrUndefined(e.value))},"navigation.position.latitude":()=>{let r=this.toNumberOrUndefined(e.value);r!==void 0&&(t.position=fe(ae({},t.position??{}),{latitude:r}),t.lastPositionAt=e.timestampMs)},"navigation.position.longitude":()=>{let r=this.toNumberOrUndefined(e.value);r!==void 0&&(t.position=fe(ae({},t.position??{}),{longitude:r}),t.lastPositionAt=e.timestampMs)},"navigation.position.altitude":()=>{let r=this.toNumberOrUndefined(e.value);t.position&&(t.position=fe(ae({},t.position),{altitude:r}))},"navigation.position":()=>{let r=this.readPositionValue(e.value);r&&(t.position=r,t.lastPositionAt=e.timestampMs)},"atonType.id":()=>{this.isAton(t)&&(t.typeId=this.toNumberOrUndefined(e.value))},"atonType.name":()=>{this.isAton(t)&&(t.typeName=this.toStringOrUndefined(e.value))},virtual:()=>{this.isAton(t)&&(t.virtual=!!e.value)},offPosition:()=>{this.isAton(t)&&(t.offPosition=!!e.value)},"design.aisShipType.id":()=>{this.isVesselLike(t)&&(t.design=fe(ae({},t.design??{}),{aisShipType:fe(ae({},t.design?.aisShipType??{}),{id:this.toNumberOrUndefined(e.value)})}))},"design.aisShipType.name":()=>{this.isVesselLike(t)&&(t.design=fe(ae({},t.design??{}),{aisShipType:fe(ae({},t.design?.aisShipType??{}),{name:this.toStringOrUndefined(e.value)})}))},"navigation.closestApproach.distance":()=>{this.isVesselLike(t)&&t.closestApproach&&(t.closestApproach.distance=this.toNumberOrUndefined(e.value))},"navigation.closestApproach.timeTo":()=>{this.isVesselLike(t)&&t.closestApproach&&(t.closestApproach.timeTo=this.toNumberOrUndefined(e.value))},"navigation.closestApproach.range":()=>{this.isVesselLike(t)&&t.closestApproach&&(t.closestApproach.range=this.toNumberOrUndefined(e.value))},"navigation.closestApproach.bearing":()=>{this.isVesselLike(t)&&t.closestApproach&&(t.closestApproach.bearing=this.toNumberOrUndefined(e.value))},"navigation.closestApproach.collisionRiskRating":()=>{this.isVesselLike(t)&&t.closestApproach&&(t.closestApproach.collisionRiskRating=this.toNumberOrUndefined(e.value))}})[e.path]?.(),!i&&this.updateTargetsSignal()}resolveTrack(e){let t=this.contextIndex.get(e.context),i=e.timestampMs,a=t?this.tracks.get(t):null;if(a)return a;let r=this.createTrack(e.context,e.type,i,void 0);return this.contextIndex.set(e.context,r.id),r}createTrack(e,t,i,a){let r=this.buildTrackId(a??e),s=this.buildBaseTarget(e,t,i,a,r),l;switch(t){case"vessel":l=fe(ae({},s),{type:"vessel",closestApproach:{}});break;case"sar":l=fe(ae({},s),{type:"sar",closestApproach:{}});break;case"aton":l=fe(ae({},s),{type:"aton"});break;default:l=fe(ae({},s),{type:"basestation"});break}return this.tracks.set(l.id,l),a&&this.addMmsiIndex(a,l.id),this.updateTargetsSignal(),l}buildTrackId(e){if(!this.tracks.has(e))return e;let t=1;for(;this.tracks.has(`${e}-${t}`);)t+=1;return`${e}-${t}`}applyMmsi(e,t){let i=this.toStringOrUndefined(t);if(!i)return;let a=this.getTracksByMmsi(i).filter(r=>r.id!==e.id);a.length&&(this.markConflict(i),mr&&console.error("[AIS] MMSI conflict",{mmsi:i,contexts:[e.context,...a.map(r=>r.context)]})),e.mmsi&&e.mmsi!==i&&this.removeMmsiIndex(e.mmsi,e.id),e.mmsi=i,this.addMmsiIndex(i,e.id)}removeTrack(e){this.tracks.delete(e.id),e.mmsi&&this.removeMmsiIndex(e.mmsi,e.id);for(let[t,i]of this.contextIndex.entries())i===e.id&&this.contextIndex.delete(t);mr&&console.debug("[AIS] removed",{id:e.id,mmsi:e.mmsi,status:e.ais.status}),this.updateTargetsSignal()}updateTargetsSignal(){this.targetsDirty$.next()}flushTargetsSignal(){let e=Array.from(this.tracks.values()).filter(i=>!!i.mmsi||!!i.position),t=e.some(i=>{if(!this.isVesselLike(i))return!1;let a=i.closestApproach??{};return Object.prototype.hasOwnProperty.call(a,"collisionRiskRating")});this._targets.set(e),this._hasCollisionRiskData.set(t),mr&&console.debug("[AIS] flush",{count:this.tracks.size})}getTracksByMmsi(e){let t=this.mmsiIndex.get(e);return t?Array.from(t).map(i=>this.tracks.get(i)).filter(i=>!!i):[]}addMmsiIndex(e,t){this.mmsiIndex.has(e)||this.mmsiIndex.set(e,new Set),this.mmsiIndex.get(e).add(t)}removeMmsiIndex(e,t){let i=this.mmsiIndex.get(e);i&&(i.delete(t),i.size||this.mmsiIndex.delete(e))}markConflict(e){let t=this.getTracksByMmsi(e);for(let i of t)i.conflicted=!0}normalizeAisClass(e){let t=typeof e=="string"?e.toUpperCase():"";if(t==="A")return"A";if(t==="B")return"B"}normalizeAisStatus(e){if(e==null)return;let t=String(e).toLowerCase();if(t==="unconfirmed"||t==="confirmed"||t==="lost"||t==="remove")return t}toTimestampMs(e){if(!e)return Date.now();let t=e instanceof Date?e.getTime():Date.parse(e);return Number.isFinite(t)?t:Date.now()}toNumberOrUndefined(e){let t=Number(e);return Number.isFinite(t)?t:void 0}toStringOrUndefined(e){if(e==null)return;let t=String(e).trim();return t.length?t:void 0}wrapDegrees(e){let t=e%360;return t<0?t+360:t}buildBaseTarget(e,t,i,a,r){return{id:r,context:e,type:t,ais:{class:void 0,status:"unconfirmed"},conflicted:!1,mmsi:a,position:void 0,lastUpdateAt:i,lastPositionAt:void 0}}isVesselLike(e){return e.type==="vessel"||e.type==="sar"}isAton(e){return e.type==="aton"}readPositionValue(e){if(!e||typeof e!="object")return;let t=this.toNumberOrUndefined(e.latitude),i=this.toNumberOrUndefined(e.longitude);if(t===void 0||i===void 0)return;let a=this.toNumberOrUndefined(e.altitude);return{latitude:t,longitude:i,altitude:a}}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function Wx(n,o){if(n&1&&(d(0,"div",3)(1,"span",13),c(2),u()()),n&2){k();let e=gn(0),t=gn(1);g(2),Ut("",t," ",e)}}function Fx(n,o){if(n&1&&(d(0,"div",4)(1,"span",7),c(2,"State"),u(),d(3,"span",10),c(4),lt(5,"titlecase"),u()()),n&2){let e=k(4);g(4),Ut("",kt(5,2,e.target.navState?`${e.target.navState}`:""),"",e.target.specialManeuver==="not available"?"":`, ${e.target.specialManeuver}`)}}function Gx(n,o){n&1&&(d(0,"div",5),F(1,"mat-divider"),u())}function Bx(n,o){if(n&1&&(d(0,"div",6)(1,"span",7),c(2,"Bearing"),u(),d(3,"span",8),c(4),u()(),d(5,"div",6)(6,"span",7),c(7,"Range"),u(),d(8,"span",8),c(9),u()(),d(10,"div",6)(11,"span",7),c(12,"CPA"),u(),d(13,"span",8),c(14),u()(),d(15,"div",6)(16,"span",7),c(17,"TCPA"),u(),d(18,"span",8),c(19),u()(),d(20,"div",3),F(21,"mat-divider"),u()),n&2){let e=k(4);g(4),X(e.formatAngleWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.bearing)),g(5),X(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.range)),g(5),X(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.distance)),g(5),X(e.formatRemainingTime(e.target.closestApproach==null?null:e.target.closestApproach.timeTo))}}function zx(n,o){if(n&1&&(d(0,"div",3)(1,"span",7),c(2,"ETA"),u(),d(3,"span",8),c(4),u()()),n&2){let e=k(4);g(4),X(e.formatText(e.target.eta))}}function Ux(n,o){if(n&1&&(ha(0)(1),I(2,Wx,3,2,"div",3),I(3,Fx,6,4,"div",4),I(4,Gx,2,0,"div",5),I(5,Bx,22,4),d(6,"div",6)(7,"span",7),c(8,"COG"),u(),d(9,"span",8),c(10),d(11,"span",9),c(12,"T"),u()()(),d(13,"div",6)(14,"span",7),c(15,"SOG"),u(),d(16,"span",8),c(17),lt(18,"number"),u()(),d(19,"div",6)(20,"span",7),c(21,"HDG"),u(),d(22,"span",8),c(23),d(24,"span",9),c(25,"T"),u()()(),d(26,"div",6)(27,"span",7),c(28,"ROT"),u(),d(29,"span",8),c(30),u()(),d(31,"div",3),F(32,"mat-divider"),u(),d(33,"div",6)(34,"span",7),c(35,"IMO"),u(),d(36,"span",8),c(37),u()(),d(38,"div",6)(39,"span",7),c(40,"MMSI"),u(),d(41,"span",8),c(42),u()(),d(43,"div",6)(44,"span",7),c(45,"VHF Callsign"),u(),d(46,"span",8),c(47),u()(),d(48,"div",6)(49,"span",7),c(50,"AIS Class"),u(),d(51,"span",8),c(52),u()(),d(53,"div",4)(54,"span",7),c(55,"Destination"),u(),d(56,"span",10),c(57),u()(),I(58,zx,5,1,"div",3),d(59,"div",3),F(60,"mat-divider"),u(),d(61,"div",6)(62,"span",7),c(63,"Latitude"),u(),d(64,"span",8),c(65),u()(),d(66,"div",6)(67,"span",7),c(68,"Longitude"),u(),d(69,"span",8),c(70),u()(),d(71,"div",11)(72,"span",12),c(73),u()()),n&2){let e=k(3),t=fn(!(e.target.design==null||e.target.design.aisShipType==null)&&e.target.design.aisShipType.name?`${e.target.design.aisShipType.name}`:""),i=!(e.target.design==null||e.target.design.length==null)&&e.target.design.length.overall?`${e.target.design.length.overall}m`:"?m",a=e.target.design!=null&&e.target.design.beam?`${e.target.design.beam}m`:"?m";g(),fn(i&&a?`${i} x ${a}`:""),g(),N(!(e.target.design==null||e.target.design.length==null)&&e.target.design.length.overall||e.target.design!=null&&e.target.design.beam||t?2:-1),g(),N(e.target.navState||e.target.specialManeuver?3:-1),g(),N(!(e.target.design==null||e.target.design.length==null)&&e.target.design.length.overall||e.target.design!=null&&e.target.design.beam||t||e.target.navState||e.target.specialManeuver?4:-1),g(),N(e.hasClosestApproach(e.target.closestApproach)?5:-1),g(5),ge("",e.formatDirection(e.target.courseOverGroundTrue),"\xB0 "),g(7),ge("",vn(18,19,e.target.speedOverGround,"1.1-1")," kn"),g(6),ge("",e.formatDirection(e.target.headingTrue),"\xB0 "),g(7),X(e.formatRateOfTurn(e.target.rateOfTurn)),g(7),X(e.formatText(e.target.imo)),g(5),X(e.formatText(e.target.mmsi)),g(5),X(e.formatText(e.target.callsign)),g(5),X(e.formatText(e.target.ais.class)),g(5),X(e.formatText(e.target.destination)),g(),N(e.target.eta?58:-1),g(7),X(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),g(5),X(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),g(3),ge("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago")}}function Hx(n,o){if(n&1&&I(0,Ux,74,22),n&2){let e=k(2);N(e.isVesselLike(e.target)?0:-1)}}function qx(n,o){if(n&1&&(d(0,"div",3)(1,"span",13),c(2),u()()),n&2){k();let e=gn(0),t=gn(1);g(2),Ut("",t," ",e)}}function $x(n,o){if(n&1&&(d(0,"div",4)(1,"span",7),c(2,"State"),u(),d(3,"span",10),c(4),lt(5,"titlecase"),u()()),n&2){let e=k(4);g(4),Ut("",kt(5,2,e.target.navState?`${e.target.navState}`:""),"",e.target.specialManeuver==="not available"?"":`, ${e.target.specialManeuver}`)}}function jx(n,o){n&1&&(d(0,"div",5),F(1,"mat-divider"),u())}function Yx(n,o){if(n&1&&(d(0,"div",6)(1,"span",7),c(2,"Bearing"),u(),d(3,"span",8),c(4),u()(),d(5,"div",6)(6,"span",7),c(7,"Range"),u(),d(8,"span",8),c(9),u()(),d(10,"div",6)(11,"span",7),c(12,"CPA"),u(),d(13,"span",8),c(14),u()(),d(15,"div",6)(16,"span",7),c(17,"TCPA"),u(),d(18,"span",8),c(19),u()(),d(20,"div",3),F(21,"mat-divider"),u()),n&2){let e=k(4);g(4),X(e.formatAngleWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.bearing)),g(5),X(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.range)),g(5),X(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.distance)),g(5),X(e.formatRemainingTime(e.target.closestApproach==null?null:e.target.closestApproach.timeTo))}}function Zx(n,o){if(n&1&&(d(0,"div",3)(1,"span",7),c(2,"ETA"),u(),d(3,"span",8),c(4),u()()),n&2){let e=k(4);g(4),X(e.formatText(e.target.eta))}}function Qx(n,o){if(n&1&&(ha(0)(1),I(2,qx,3,2,"div",3),I(3,$x,6,4,"div",4),I(4,jx,2,0,"div",5),I(5,Yx,22,4),d(6,"div",6)(7,"span",7),c(8,"COG"),u(),d(9,"span",8),c(10),d(11,"span",9),c(12,"T"),u()()(),d(13,"div",6)(14,"span",7),c(15,"SOG"),u(),d(16,"span",8),c(17),lt(18,"number"),u()(),d(19,"div",6)(20,"span",7),c(21,"HDG"),u(),d(22,"span",8),c(23),d(24,"span",9),c(25,"T"),u()()(),d(26,"div",6)(27,"span",7),c(28,"ROT"),u(),d(29,"span",8),c(30),u()(),d(31,"div",3),F(32,"mat-divider"),u(),d(33,"div",6)(34,"span",7),c(35,"IMO"),u(),d(36,"span",8),c(37),u()(),d(38,"div",6)(39,"span",7),c(40,"MMSI"),u(),d(41,"span",8),c(42),u()(),d(43,"div",6)(44,"span",7),c(45,"VHF Callsign"),u(),d(46,"span",8),c(47),u()(),d(48,"div",6)(49,"span",7),c(50,"AIS Class"),u(),d(51,"span",8),c(52),u()(),d(53,"div",4)(54,"span",7),c(55,"Destination"),u(),d(56,"span",10),c(57),u()(),I(58,Zx,5,1,"div",3),d(59,"div",3),F(60,"mat-divider"),u(),d(61,"div",6)(62,"span",7),c(63,"Latitude"),u(),d(64,"span",8),c(65),u()(),d(66,"div",6)(67,"span",7),c(68,"Longitude"),u(),d(69,"span",8),c(70),u()(),d(71,"div",11)(72,"span",12),c(73),u()()),n&2){let e=k(3),t=fn(!(e.target.design==null||e.target.design.aisShipType==null)&&e.target.design.aisShipType.name?`${e.target.design.aisShipType.name}`:""),i=!(e.target.design==null||e.target.design.length==null)&&e.target.design.length.overall?`${e.target.design.length.overall}m`:"?m",a=e.target.design!=null&&e.target.design.beam?`${e.target.design.beam}m`:"?m";g(),fn(i&&a?`${i} x ${a}`:""),g(),N(!(e.target.design==null||e.target.design.length==null)&&e.target.design.length.overall||e.target.design!=null&&e.target.design.beam||t?2:-1),g(),N(e.target.navState||e.target.specialManeuver?3:-1),g(),N(!(e.target.design==null||e.target.design.length==null)&&e.target.design.length.overall||e.target.design!=null&&e.target.design.beam||t||e.target.navState||e.target.specialManeuver?4:-1),g(),N(e.hasClosestApproach(e.target.closestApproach)?5:-1),g(5),ge("",e.formatDirection(e.target.courseOverGroundTrue),"\xB0 "),g(7),ge("",vn(18,19,e.target.speedOverGround,"1.1-1")," kn"),g(6),ge("",e.formatDirection(e.target.headingTrue),"\xB0 "),g(7),X(e.formatRateOfTurn(e.target.rateOfTurn)),g(7),X(e.formatText(e.target.imo)),g(5),X(e.formatText(e.target.mmsi)),g(5),X(e.formatText(e.target.callsign)),g(5),X(e.formatText(e.target.ais.class)),g(5),X(e.formatText(e.target.destination)),g(),N(e.target.eta?58:-1),g(7),X(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),g(5),X(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),g(3),ge("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago")}}function Xx(n,o){if(n&1&&I(0,Qx,74,22),n&2){let e=k(2);N(e.isVesselLike(e.target)?0:-1)}}function Kx(n,o){if(n&1&&(d(0,"div",3)(1,"span",13),c(2),u()(),d(3,"div",4)(4,"span",7),c(5,"Off Position"),u(),d(6,"span",8),c(7),u()(),d(8,"div",6)(9,"span",7),c(10,"Type"),u(),d(11,"span",8),c(12,"Aid to Navigation"),u()(),d(13,"div",6)(14,"span",7),c(15,"Type ID"),u(),d(16,"span",8),c(17),u()(),d(18,"div",3),F(19,"mat-divider"),u(),d(20,"div",6)(21,"span",7),c(22,"MMSI"),u(),d(23,"span",8),c(24),u()(),d(25,"div",6)(26,"span",7),c(27,"Status"),u(),d(28,"span",8),c(29),lt(30,"titlecase"),u()(),d(31,"div",3),F(32,"mat-divider"),u(),d(33,"div",6)(34,"span",7),c(35,"Latitude"),u(),d(36,"span",8),c(37),u()(),d(38,"div",6)(39,"span",7),c(40,"Longitude"),u(),d(41,"span",8),c(42),u()(),d(43,"div",11)(44,"span",12),c(45),u()()),n&2){let e=k(3);g(2),X(e.formatText(e.target.name)),g(5),X(e.target.offPosition?"Yes":"No"),g(10),X(e.formatText(e.target.typeId==null?null:e.target.typeId.toString())),g(7),X(e.formatText(e.target.mmsi)),g(5),X(kt(30,8,e.target.ais.status)),g(8),X(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),g(5),X(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),g(3),ge("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago")}}function Jx(n,o){if(n&1&&I(0,Kx,46,10),n&2){let e=k(2);N(e.isAton(e.target)?0:-1)}}function eC(n,o){if(n&1&&(d(0,"div",6)(1,"span",7),c(2,"Name"),u(),d(3,"span",8),c(4),u()(),d(5,"div",6)(6,"span",7),c(7,"MMSI"),u(),d(8,"span",8),c(9),u()(),d(10,"div",6)(11,"span",7),c(12,"Status"),u(),d(13,"span",8),c(14),lt(15,"titlecase"),u()(),d(16,"div",6)(17,"span",7),c(18,"AIS Class"),u(),d(19,"span",8),c(20),u()(),d(21,"div",3),F(22,"mat-divider"),u(),d(23,"div",6)(24,"span",7),c(25,"Latitude"),u(),d(26,"span",8),c(27),u()(),d(28,"div",6)(29,"span",7),c(30,"Longitude"),u(),d(31,"span",8),c(32),u()(),d(33,"div",11)(34,"span",12),c(35),u()()),n&2){let e=k(3);g(4),X(e.formatText(e.target.name)),g(5),X(e.formatText(e.target.mmsi)),g(5),X(kt(15,7,e.target.ais.status)),g(6),X(e.formatText(e.target.ais.class)),g(7),X(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),g(5),X(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),g(3),ge("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago")}}function tC(n,o){if(n&1&&I(0,eC,36,9),n&2){let e=k(2);N(e.isBasestation(e.target)?0:-1)}}function iC(n,o){if(n&1&&(d(0,"div",0)(1,"div",2),I(2,Hx,1,1)(3,Xx,1,1)(4,Jx,1,1)(5,tC,1,1),u()()),n&2){let e,t=k();g(2),N((e=t.target.type)==="vessel"?2:e==="sar"?3:e==="aton"?4:e==="basestation"?5:-1)}}function nC(n,o){n&1&&(d(0,"div",1),c(1,"No AIS target selected."),u())}var Ks=(()=>{class n{static CLOCK_INTERVAL_MS=1e3;data=y(ti);units=y(at);ngZone=y(Be);now=_(Date.now());nowTimer=null;constructor(){this.startClock()}get payload(){return this.data?.payload??null}get target(){return this.payload?.target??null}formatDirection(e){return e==null||!Number.isFinite(e)?"--":this.units.convertToUnit("deg",e).toFixed(0)}formatNauticalMilesWithUnit(e){return e==null||!Number.isFinite(e)?"--":`${this.units.convertToUnit("nm",e).toFixed(1)} nm`}formatAngleWithUnit(e){return e==null||!Number.isFinite(e)?"--":`${e.toFixed(0)}\xB0`}formatRemainingTime(e){if(e==null||!Number.isFinite(e))return"--";let t=Math.max(0,Math.round(e)),i=Math.floor(t/3600),a=Math.floor(t%3600/60),r=t%60;return i>0?`${i}:${String(a).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${a}:${String(r).padStart(2,"0")}`}formatSinceTimestamp(e){if(e==null||!Number.isFinite(e))return"--";let t=Math.max(0,Math.floor((this.now()-e)/1e3)),i=Math.floor(t/3600),a=Math.floor(t%3600/60),r=t%60;return i>0?`${i}:${String(a).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${a}:${String(r).padStart(2,"0")}`}formatRateOfTurn(e){if(e==null||!Number.isFinite(e))return"--";let t=e>=0?"Stb":"Port",i=Math.abs(e)*(180/Math.PI)*60;return`${t} ${i.toFixed(0)}\xB0/min`}formatLatLon(e,t){return e==null||!Number.isFinite(e)?"--":this.units.convertToUnit(t,e).toString()}formatText(e){return e&&e.length?e:"--"}hasClosestApproach(e){return e?typeof e.bearing=="number"||typeof e.range=="number"||typeof e.distance=="number"||typeof e.timeTo=="number":!1}isVesselLike(e){return e.type==="vessel"||e.type==="sar"}isAton(e){return e.type==="aton"}isBasestation(e){return e.type==="basestation"}startClock(){this.ngZone.runOutsideAngular(()=>{this.nowTimer=window.setInterval(()=>{this.ngZone.run(()=>{this.now.set(Date.now())})},n.CLOCK_INTERVAL_MS)})}ngOnDestroy(){this.nowTimer!==null&&(clearInterval(this.nowTimer),this.nowTimer=null)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["dialog-ais-target"]],decls:2,vars:1,consts:[[1,"ais-dialog","mat-typography"],[1,"ais-dialog-empty"],[1,"ais-dialog-grid"],[1,"ais-dialog-item","ais-dialog-item-span"],[1,"ais-dialog-long-item","ais-dialog-item-span"],[1,"ais-dialog-item","ais-dialog-item-span","ais-divider"],[1,"ais-dialog-item"],[1,"ais-dialog-key","mat-subtitle-2"],[1,"ais-dialog-value","mat-body-2"],[2,"font-size","10px"],[1,"ais-dialog-long-value","mat-body-2"],[1,"ais-dialog-item",2,"grid-column","span 2"],[1,"ais-dialog-value","mat-body-4",2,"grid-column","span 2","text-align","center"],[1,"ais-vessel-description"]],template:function(t,i){t&1&&I(0,iC,6,1,"div",0)(1,nC,2,0,"div",1),t&2&&N(i.target?0:1)},dependencies:[Ht,Gn,Fn,Dn,za],styles:[".ais-dialog-panel .mat-mdc-dialog-container{--mat-dialog-content-padding: 0px 24px 20px 24px}.ais-dialog[_ngcontent-%COMP%]{display:grid;gap:8px;color:var(--kip-contrast-color)}.ais-dialog-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 14px}.ais-vessel-description[_ngcontent-%COMP%]{grid-column:span 2;font-size:var(--mat-sys-body-large-size)}.ais-dialog-long-item[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr 1fr 1fr;align-items:baseline;gap:6px}.ais-dialog-long-value[_ngcontent-%COMP%]{grid-column:span 3;color:var(--kip-contrast-color)}.ais-dialog-item[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;align-items:baseline;gap:6px}.ais-divider[_ngcontent-%COMP%]{margin-top:6px}.ais-dialog-item[_ngcontent-%COMP%] mat-divider[_ngcontent-%COMP%]{grid-column:1/-1}.ais-dialog-item-span[_ngcontent-%COMP%]{grid-column:span 2}.ais-dialog-key[_ngcontent-%COMP%]{color:var(--kip-contrast-dim-color);letter-spacing:.04em}.ais-dialog-value[_ngcontent-%COMP%], .ais-dialog-empty[_ngcontent-%COMP%]{color:var(--kip-contrast-color)}"],changeDetection:0})}return n})();var aC=["radarSvg"],oC=["menuAnchor"],rC=["menuTrigger"],sC=(n,o)=>o.id;function lC(n,o){n&1&&(ie(),d(0,"svg",7),F(1,"path",17),d(2,"text",18),c(3,"N"),u()())}function dC(n,o){n&1&&(ie(),d(0,"svg",7),F(1,"path",19),u())}function cC(n,o){if(n&1){let e=Se();d(0,"button",20),U("click",function(){ee(e);let i=k();return te(i.toggleFilter("noCollisionRisk"))}),d(1,"mat-icon"),c(2,"security"),u()()}if(n&2){let e=k();st("is-active",e.isFilterEnabled("noCollisionRisk"))}}function uC(n,o){if(n&1){let e=Se();d(0,"button",22),U("click",function(){let i=ee(e).$implicit,a=k(2);return te(a.onMenuItemSelect(i))}),F(1,"img",23),d(2,"span",24),c(3),u()()}if(n&2){let e=o.$implicit;g(),be("visibility",e.iconHref?"visible":"hidden"),J("src",e.iconHref??null,Pr),g(2),X(e.label)}}function mC(n,o){if(n&1&&xe(0,uC,4,4,"button",21,sC),n&2){let e=k();Ce(e.menuItems())}}function hC(n,o){if(n&1){let e=Se();d(0,"button",25),c(1,"Filter Targets"),u(),d(2,"button",26),U("click",function(){ee(e);let i=k();return te(i.toggleFilter("anchoredMoored"))}),d(3,"mat-icon",27),c(4),u(),d(5,"span"),c(6,"Anchored/Moored"),u()(),d(7,"button",26),U("click",function(){ee(e);let i=k();return te(i.toggleFilter("allAton"))}),d(8,"mat-icon",27),c(9),u(),d(10,"span"),c(11,"All AtoN"),u()(),d(12,"button",26),U("click",function(){ee(e);let i=k();return te(i.toggleFilter("allButSar"))}),d(13,"mat-icon",27),c(14),u(),d(15,"span"),c(16,"All but SAR"),u()(),d(17,"button",26),U("click",function(){ee(e);let i=k();return te(i.toggleFilter("allVessels"))}),d(18,"mat-icon",27),c(19),u(),d(20,"span"),c(21,"All Vessels"),u()(),d(22,"button",28)(23,"span"),c(24,"Vessel Type"),u(),d(25,"mat-icon"),c(26,"chevron_right"),u()()}if(n&2){let e=k(),t=Nt(26);g(4),ge(" ",e.isFilterEnabled("anchoredMoored")?"check_box":"check_box_outline_blank"," "),g(5),ge(" ",e.isFilterEnabled("allAton")?"check_box":"check_box_outline_blank"," "),g(5),ge(" ",e.isFilterEnabled("allButSar")?"check_box":"check_box_outline_blank"," "),g(5),ge(" ",e.isFilterEnabled("allVessels")?"check_box":"check_box_outline_blank"," "),g(3),O("matMenuTriggerFor",t)}}function pC(n,o){if(n&1){let e=Se();d(0,"button",26),U("click",function(){let i=ee(e).$implicit,a=k(2);return te(a.toggleVesselTypeFilter(i))}),d(1,"mat-icon",27),c(2),u(),d(3,"span"),c(4),u()()}if(n&2){let e=o.$implicit,t=k(2);g(2),ge(" ",t.isVesselTypeFilterEnabled(e)?"check_box":"check_box_outline_blank"," "),g(2),X(t.formatVesselTypeLabel(e))}}function fC(n,o){if(n&1&&xe(0,pC,5,2,"button",29,Ai),n&2){let e=k();Ce(e.vesselTypeFilters)}}function gC(n,o){n&1&&F(0,"div",16)}var Gp=(()=>{class n{static TARGET_ICON_SIZE_PX=16;static OWN_SHIP_ICON_SIZE_PX=84;static HIT_RADIUS_PX=28;static ICON_RENDER_DEBOUNCE_MS=50;id=x.required();type=x.required();theme=x.required();runtime=y(we);ais=y(Fp);dialog=y(Bp);ngZone=y(Be);units=y(at);settings=y(Vt);toast=y(en);dashboard=y(ft);static DEFAULT_CONFIG={filterSelfPaths:!1,enableTimeout:!1,dataTimeout:5,ais:{filters:{anchoredMoored:!1,noCollisionRisk:!1,allAton:!1,allButSar:!1,allVessels:!1,vesselTypes:[]},viewMode:"course-up",rangeRings:[1,3,6,12,24,48],rangeIndex:"3",showCogVectors:!0,cogVectorsMinutes:10,showLostTargets:!0,showUnconfirmedTargets:!0,showSelf:!0},color:"grey"};svgRef=pe.required("radarSvg");menuAnchorRef=pe.required("menuAnchor");menuTrigger=pe.required("menuTrigger");hostSize=_(null);renderState=null;selectedId=_(null);localViewMode=_(null);localRangeIndex=_(null);effectiveViewMode=K(()=>this.localViewMode()??this.runtime.options()?.ais?.viewMode??"course-up");effectiveRangeIndex=K(()=>{let e=this.resolveRangeIndex(this.runtime.options()?.ais),t=this.runtime.options()?.ais?.rangeRings??[3,6,12,24,48],i=Math.max(0,t.length-1),a=this.localRangeIndex()??e;return Math.min(Math.max(a,0),i)});svg;root;ringsLayer;vectorsLayer;targetsLayer;selectedLayer;ownShipLayer;viewRotationSmoothed=null;lastRotationAt=null;renderFrame=null;iconRenderTimer=null;iconCache=new Map;targetCache=new Map;lastOriginKey=null;ringCache=null;ownShipIconHref=null;menuItems=_([]);menuPoint=null;lastRenderTargets=[];lastRenderScale=1;lastRenderSize=null;hitRadiusPx=n.HIT_RADIUS_PX;lastFiltersSignature=null;lastRenderSignature=null;filterState=_({anchoredMoored:!1,noCollisionRisk:!1,allAton:!1,allButSar:!1,allVessels:!1,vesselTypes:new Set});vesselTypeFilters=fs.filter(e=>e!=="vessel/self"&&e!=="vessel/unknown"&&e!=="vessel/spare");hasActiveFilters=K(()=>{let e=this.filterState();return e.anchoredMoored||e.allAton||e.allButSar||e.allVessels||e.vesselTypes.size>0});hasCollisionRiskData=this.ais.hasCollisionRiskData;constructor(){this.warnIfRemoteDataDisabled(),this.loadOwnShipIcon(),L(()=>{let e=this.hostSize(),t=this.runtime.options(),i=this.theme(),a=this.ais.targets(),r=this.ais.ownShip();!e||!t||!i||(B(()=>{this.renderState={size:e,cfg:t,theme:i,targets:a,ownShip:r},this.syncFiltersFromConfig(t)}),this.scheduleRender())}),L(()=>{this.localViewMode(),this.localRangeIndex(),this.selectedId(),this.filterState(),B(()=>{this.scheduleRender()})})}warnIfRemoteDataDisabled(){this.settings.signalKSubscribeAll||this.toast.show('AIS data is disabled in your connection. To see radar targets, go to Settings -> Options -> Connectivity, enable "Subscribe to remote sources messages", then reconnect.',0,!1,"warn")}loadOwnShipIcon(){this.ngZone.runOutsideAngular(()=>{hm().then(e=>{this.ownShipIconHref=e,this.scheduleRenderDebounced()})})}ngAfterViewInit(){this.initSvg(),this.scheduleRender()}onResized(e){this.hostSize.set({width:e.width,height:e.height})}initSvg(){this.svg=Ca(this.svgRef().nativeElement),this.svg.attr("class","ais-radar"),this.root=this.svg.append("g").attr("class","radar-root"),this.ringsLayer=this.root.append("g").attr("class","radar-rings"),this.vectorsLayer=this.root.append("g").attr("class","radar-vectors"),this.targetsLayer=this.root.append("g").attr("class","radar-targets"),this.selectedLayer=this.root.append("g").attr("class","radar-selected"),this.ownShipLayer=this.root.append("g").attr("class","radar-ownship-layer"),this.svg.on("click",()=>{this.selectedId.set(null),this.closeTargetMenu()})}scheduleRender(){this.renderFrame===null&&this.ngZone.runOutsideAngular(()=>{this.renderFrame=requestAnimationFrame(()=>{this.renderFrame=null,this.render()})})}scheduleRenderDebounced(){this.iconRenderTimer===null&&this.ngZone.runOutsideAngular(()=>{this.iconRenderTimer=window.setTimeout(()=>{this.iconRenderTimer=null,this.scheduleRender()},n.ICON_RENDER_DEBOUNCE_MS)})}render(){if(!this.renderState||!this.svg||!this.root)return;let{size:e,cfg:t,theme:i,targets:a,ownShip:r}=this.renderState,s=Math.max(1,e.width),l=Math.max(1,e.height),m=Math.min(s,l)/2,f=(Math.min(s,l)-35)/Math.min(s,l),b=Math.hypot(s,l)/2/f,A=t.ais??{},C=A.rangeRings?.length?A.rangeRings:[3,6,12,24,48],w=this.effectiveRangeIndex(),M=C[w]??C[0],G=this.resolveRingCountForRange(M),E=this.localViewMode()??A.viewMode??"course-up",W=this.toDegreesIfRadians(r.courseOverGroundTrue),V=this.toDegreesIfRadians(r.headingTrue),Y=W!==null||V!==null,j=E==="course-up"?W??V??0:0,ye=this.viewRotationSmoothed!==null&&Math.abs(this.shortestAngleDelta(this.viewRotationSmoothed,j))>.5,me=this.buildFilterStateSignature(this.filterState()),ne={sizeKey:`${s}x${l}`,viewMode:E,rangeIndex:w,rangesKey:C.join(","),showSelf:A.showSelf??!0,showCogVectors:A.showCogVectors??!0,showLostTargets:A.showLostTargets??!0,showUnconfirmedTargets:A.showUnconfirmedTargets??!0,filtersKey:me,selectedId:this.selectedId(),targetsRef:a,ownShipRef:r,themeRef:i,color:t.color},re=this.lastRenderSignature;if(!ye&&re&&re.sizeKey===ne.sizeKey&&re.viewMode===ne.viewMode&&re.rangeIndex===ne.rangeIndex&&re.rangesKey===ne.rangesKey&&re.showSelf===ne.showSelf&&re.showCogVectors===ne.showCogVectors&&re.showLostTargets===ne.showLostTargets&&re.showUnconfirmedTargets===ne.showUnconfirmedTargets&&re.filtersKey===ne.filtersKey&&re.selectedId===ne.selectedId&&re.targetsRef===ne.targetsRef&&re.ownShipRef===ne.ownShipRef&&re.themeRef===ne.themeRef&&re.color===ne.color)return;this.lastRenderSignature=ne;let ce=E==="course-up"&&Y?this.smoothRotation(j):0,oe=E==="course-up"?Math.abs(this.shortestAngleDelta(ce,j)):0;this.svg.attr("viewBox",`${-s/2} ${-l/2} ${s} ${l}`),this.root.attr("transform",`scale(${f})`);let de=this.wrapDegrees((W??V??0)-ce),le=Te(t.color,i).dim;if(this.renderRings(G,M,m,b,ce,f,A.showSelf??!0,de,le),!r.position||!this.hasValidPosition(r.position))return;let ve=b/m*M,ze=this.buildTargets(a,r.position,M,ve,m,ce,A);this.lastRenderTargets=ze,this.lastRenderScale=f,this.lastRenderSize=e,this.renderVectors(ze,M,m,ce,A,r),this.renderTargets(ze,f),this.renderSelected(ze,f),this.raiseOwnshipAndVector(),oe>.5&&this.scheduleRender()}renderRings(e,t,i,a,r,s,l,m,f){if(!this.ringsLayer)return;let b=`${t.toFixed(3)}|${i.toFixed(3)}|${a.toFixed(3)}|${e}`;if(!this.ringCache||this.ringCache.key!==b){let j=t/Math.max(1,e),ye=a/i*t,me=[];for(let oe=j;oe<=ye+1e-6;oe+=j)me.push(oe);let ne=me.map(oe=>({value:oe,radius:oe/t*i})).filter(oe=>oe.radius<=a+1e-6),re=20,ce=ne.flatMap(oe=>[{key:`${oe.value}-top`,value:oe.value,x:0,y:-oe.radius+re},{key:`${oe.value}-bottom`,value:oe.value,x:0,y:oe.radius-re}]);this.ringCache={key:b,rings:ne,labels:ce}}let A=this.ringCache;if(!A)return;let C=A.rings,w=this.ringsLayer.selectAll("circle.ring").data(C,j=>j.value.toString());w.enter().append("circle").attr("class","ring").merge(w).attr("r",j=>j.radius).attr("stroke",f),w.exit().remove();let M=A.labels,G=this.ringsLayer.selectAll("text.ring-label").data(M,j=>j.key);G.enter().append("text").attr("class","ring-label").merge(G).attr("x",j=>j.x).attr("y",j=>j.y).attr("text-anchor","middle").attr("dominant-baseline","middle").text(j=>`${j.value}`),G.exit().remove();let E=this.ringsLayer.selectAll("circle.radar-center").data(l?[]:[{r:Math.max(3,i*.01)}]);E.enter().append("circle").attr("class","radar-center").merge(E).attr("cx",0).attr("cy",0).attr("r",j=>j.r).attr("fill",f),E.exit().remove();let W=this.ownShipLayer.selectAll("g.radar-ownship").data(l?[{size:this.resolveOwnShipBaseSize(s)}]:[]),V=W.enter().append("g").attr("class","radar-ownship");V.append("image").attr("class","ownship-icon").attr("href",this.ownShipIconHref??null).attr("xlink:href",this.ownShipIconHref??null);let Y=V.merge(W);Y.attr("transform",`rotate(${m})`),Y.select("image.ownship-icon").attr("href",this.ownShipIconHref??null).attr("xlink:href",this.ownShipIconHref??null).attr("display",this.ownShipIconHref?null:"none").attr("width",j=>j.size).attr("height",j=>j.size).attr("x",j=>-j.size/2).attr("y",j=>-j.size/2),W.exit().remove()}toggleViewMode(){let e=this.localViewMode()??this.runtime.options()?.ais?.viewMode??"course-up";this.localViewMode.set(e==="course-up"?"north-up":"course-up")}incrementRange(){this.localRangeIndex.set(Math.max(this.effectiveRangeIndex()-1,0))}decrementRange(){let e=this.runtime.options()?.ais?.rangeRings??[3,6,12,24,48],t=Math.max(0,e.length-1);this.localRangeIndex.set(Math.min(this.effectiveRangeIndex()+1,t))}toggleFilter(e){this.filterState.update(t=>fe(ae({},t),{[e]:!t[e]}))}toggleVesselTypeFilter(e){this.filterState.update(t=>{let i=new Set(t.vesselTypes);return i.has(e)?i.delete(e):i.add(e),fe(ae({},t),{vesselTypes:i})})}isFilterEnabled(e){return this.filterState()[e]}isVesselTypeFilterEnabled(e){return this.filterState().vesselTypes.has(e)}formatVesselTypeLabel(e){let t=e.replace("vessel/","");switch(t){case"pleasurecraft":return"Pleasure Craft";case"highspeed":return"High Speed";case"sar":return"SAR";case"law":return"Law Enforcement";default:return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}}syncFiltersFromConfig(e){let t=e.ais?.filters;if(!t)return;let i=this.buildFilterSignature(t);i!==this.lastFiltersSignature&&(this.lastFiltersSignature=i,this.filterState.set({anchoredMoored:t.anchoredMoored??!1,noCollisionRisk:t.noCollisionRisk??!1,allAton:t.allAton??!1,allButSar:t.allButSar??!1,allVessels:t.allVessels??!1,vesselTypes:new Set(t.vesselTypes??[])}))}buildFilterSignature(e){let t=[...e?.vesselTypes??[]].sort();return JSON.stringify({anchoredMoored:e?.anchoredMoored??!1,noCollisionRisk:e?.noCollisionRisk??!1,allAton:e?.allAton??!1,allButSar:e?.allButSar??!1,allVessels:e?.allVessels??!1,vesselTypes:t})}buildFilterStateSignature(e){let t=[...e.vesselTypes].sort();return JSON.stringify({anchoredMoored:e.anchoredMoored,noCollisionRisk:e.noCollisionRisk,allAton:e.allAton,allButSar:e.allButSar,allVessels:e.allVessels,vesselTypes:t})}resolveRingCountForRange(e){return[3].find(i=>this.isNiceStep(e/i))??4}isNiceStep(e){return[.5,1,2,2.5,3,4,5,6,8,10,12,15,20,25].some(i=>Math.abs(e-i)<1e-6)}resolveRangeIndex(e){return e?Number(e.rangeIndex):0}buildTargets(e,t,i,a,r,s,l){let m=l.showLostTargets??!0,f=l.showUnconfirmedTargets??!0,b=`${t.latitude?.toFixed(6)}|${t.longitude?.toFixed(6)}`;this.lastOriginKey!==b&&(this.targetCache.clear(),this.lastOriginKey=b);let A=new Set;for(let M of e)A.add(M.id);for(let M of this.targetCache.keys())A.has(M)||this.targetCache.delete(M);for(let M of this.iconCache.keys())A.has(M)||this.iconCache.delete(M);let C=[];for(let M of e)M.ais.status==="remove"&&(this.targetCache.delete(M.id),this.iconCache.delete(M.id),this.selectedId()===M.id&&this.selectedId.set(null));let w=e.filter(M=>M.ais.status==="remove"||M.ais.status==="lost"&&!m||M.ais.status==="unconfirmed"&&!f||!M.position||!this.hasValidPosition(M.position)?!1:!this.shouldFilterTarget(M));for(let M of w){let G=this.buildTrackSignature(M),E=this.targetCache.get(M.id);if(!E||E.signature!==G){let re=this.distanceNm(t,M.position),ce=this.ais.getBearingTrue(t,M.position)??0,oe=this.toDegreesIfRadians(this.isVesselLike(M)?M.headingTrue:null),de=this.toDegreesIfRadians(this.isVesselLike(M)?M.courseOverGroundTrue:null);E={signature:G,distanceNm:re,bearing:ce,trackHeading:oe,trackCog:de},this.targetCache.set(M.id,E)}if(E.distanceNm>a)continue;let{href:W,scale:V}=this.resolveIconCached(M),Y=this.wrapDegrees(E.bearing-s),{x:j,y:ye}=this.polarToCartesian(Y,E.distanceNm,i,r),me=M.type==="aton"||M.type==="basestation"?0:this.wrapDegrees((E.trackHeading??E.trackCog??0)-s),ne=this.buildClassName({id:M.id,status:M.ais.status,aisClass:M.ais.class,type:M.type,navState:this.isVesselLike(M)?M.navState:void 0});C.push({id:M.id,raw:M,x:j,y:ye,heading:me,status:M.ais.status,aisClass:M.ais.class,type:M.type,iconHref:W,iconScale:V,navState:this.isVesselLike(M)?M.navState:void 0,sog:this.isVesselLike(M)?M.speedOverGround:void 0,cog:E.trackCog??null,className:ne})}return C}renderVectors(e,t,i,a,r,s){if(!this.vectorsLayer||!this.ownShipLayer)return;let l=r.showCogVectors??!0,m=Math.max(6,i*.04),f=(r.cogVectorsMinutes??5)*60,b=m*.8,A=[],C=[];for(let w of e)if(this.isVesselLike(w.raw)&&!this.isStationaryNavState(w.raw.navState)&&l&&typeof w.sog=="number"&&typeof w.cog=="number"){let M=this.wrapDegrees(w.cog-a),G=this.offsetPoint(w.x,w.y,M,b),E=w.sog*f/1852,W=Math.max(0,E/t*i-b);if(W<=0)continue;let V=this.offsetPoint(G.x,G.y,M,W),Y=this.resolveTargetVectorStroke(w.raw);A.push({id:w.id,x1:G.x,y1:G.y,x2:V.x,y2:V.y,className:w.className,stroke:Y})}if(r.showSelf??!0){let w=this.toDegreesIfRadians(s.courseOverGroundTrue),M=s.speedOverGround;if(w!==null&&typeof M=="number"){let G=this.wrapDegrees(w-a),E=this.offsetPoint(0,0,G,b),W=M*f/1852,V=Math.max(0,W/t*i-b);if(V<=0)return;let Y=this.offsetPoint(E.x,E.y,G,V);C.push({id:"ownship",x1:E.x,y1:E.y,x2:Y.x,y2:Y.y,className:"ownship-vector",stroke:"var(--kip-orange-color)"})}}this.renderVectorLines(this.vectorsLayer,"motion-vector",A),this.renderVectorLines(this.ownShipLayer,"ownship-vector",C)}renderVectorLines(e,t,i){let a=e.selectAll(`line.${t}`).data(i,s=>s.id);a.enter().append("line").attr("class",s=>`${t} ${s.className}`).merge(a).attr("x1",s=>s.x1).attr("y1",s=>s.y1).attr("x2",s=>s.x2).attr("y2",s=>s.y2).style("stroke",s=>s.stroke??"#50505f").style("stroke-width",2).style("opacity",1).style("stroke-dasharray","15, 7"),a.exit().remove();let r=e.selectAll(`circle.${t}-tip`).data(i,s=>s.id);r.enter().append("circle").attr("class",s=>`${t}-tip ${s.className}`).merge(r).attr("cx",s=>s.x2).attr("cy",s=>s.y2).attr("r",2.5).style("fill",s=>s.stroke??"#50505f").style("stroke",s=>s.stroke??"#50505f").style("stroke-width",2).style("opacity",1).style("stroke-dasharray","15, 7"),r.exit().remove()}renderTargets(e,t){if(!this.targetsLayer)return;let i=this.resolveTargetBaseSize(t),a=this.targetsLayer.selectAll("g.target").data(e,l=>l.id),r=a.enter().append("g").on("click",(l,m)=>{l.stopPropagation(),this.handleTargetClick(l,m)});r.append("image").attr("class","target-icon"),r.append("title");let s=r.merge(a);s.attr("transform",l=>`translate(${l.x}, ${l.y}) rotate(${l.heading})`).attr("class",l=>`target ${l.className}`),s.select("image.target-icon").attr("href",l=>l.iconHref??null).attr("xlink:href",l=>l.iconHref??null).attr("display",l=>l.iconHref?null:"none").attr("width",l=>i*l.iconScale).attr("height",l=>i*l.iconScale).attr("x",l=>-(i*l.iconScale)/2).attr("y",l=>-(i*l.iconScale)/2),s.select("title").text(l=>`${l.raw.name??l.raw.mmsi??"AIS Target"}`),a.exit().remove()}renderSelected(e,t){if(!this.selectedLayer)return;let i=e.filter(f=>f.id===this.selectedId()),a=this.resolveTargetBaseSize(t),r=a*1.4,s=Math.min(r,Math.max(4,a*.6)),l=this.buildCornerBoxPath(r,s),m=this.selectedLayer.selectAll("path.selected-ring").data(i,f=>f.id);m.enter().append("path").attr("class","selected-ring").merge(m).attr("transform",f=>`translate(${f.x}, ${f.y})`).attr("d",l),m.exit().remove()}resolveTargetBaseSize(e){let t=Math.max(.2,e);return n.TARGET_ICON_SIZE_PX/t}resolveOwnShipBaseSize(e){let t=Math.max(.2,e);return n.OWN_SHIP_ICON_SIZE_PX/t}raiseOwnshipAndVector(){this.ownShipLayer?.raise()}onMenuItemSelect(e){this.openTargetDialog(e.target,e.iconHref),this.selectedId.set(null),this.closeTargetMenu()}handleTargetClick(e,t){let i=this.resolveMenuItems(e,t);if(i.length<=1){this.openTargetDialog(t.raw,t.iconHref);return}this.menuItems.set(i),this.menuPoint=this.resolveMenuPoint(e),this.positionMenuAnchor(),this.menuTrigger().openMenu()}openTargetDialog(e,t){this.selectedId.set(e.id),this.dialog.openAisDetailDialog({title:this.buildTargetTitle(e),iconHref:t??void 0,component:"ais-target",componentType:Ks,payload:{target:e}}).subscribe()}resolveMenuItems(e,t){return this.findTargetsNearEvent(e,t).map(a=>({id:a.id,label:this.buildTargetMenuLabel(a.raw),iconHref:a.iconHref,target:a.raw}))}findTargetsNearEvent(e,t){let i=this.lastRenderTargets.length?this.lastRenderTargets:[t],a=this.eventToRadarPoint(e);if(!a)return[t];let r=this.hitRadiusPx/this.lastRenderScale,s=i.map((l,m)=>{let f=l.x-a.x,b=l.y-a.y,A=Math.hypot(f,b);return{candidate:l,distance:A,index:m}}).filter(l=>l.distance<=r).sort((l,m)=>l.distance-m.distance||l.index-m.index).map(l=>l.candidate);return s.length?s:[t]}eventToRadarPoint(e){if(!this.lastRenderSize)return null;let a=this.svgRef().nativeElement.getBoundingClientRect(),r=e.clientX-a.left,s=e.clientY-a.top,l=(r-a.width/2)/this.lastRenderScale,m=(s-a.height/2)/this.lastRenderScale;return{x:l,y:m}}resolveMenuPoint(e){let t=this.svgRef().nativeElement.closest(".ais-radar-container");if(!t)return null;let i=t.getBoundingClientRect();return{x:e.clientX-i.left,y:e.clientY-i.top}}positionMenuAnchor(){let e=this.menuAnchorRef().nativeElement;this.menuPoint&&(e.style.left=`${this.menuPoint.x}px`,e.style.top=`${this.menuPoint.y}px`)}closeTargetMenu(){this.resetTargetMenuState(),this.menuTrigger().menuOpen&&this.menuTrigger().closeMenu()}resetTargetMenuState(){this.menuItems.set([]),this.menuPoint=null}buildTargetMenuLabel(e){return this.isAton(e)&&e.typeName?e.typeName:e.name??e.mmsi??"AIS Target"}buildTargetTitle(e){let t=this.isAton(e)&&e.typeName?e.typeName:e.name??e.type??"AIS Target",i=e.ais.status;return i==="unconfirmed"||i==="lost"||i==="remove"?`${t} - ${i}`:t}resolveIconCached(e){let t=this.buildIconSignature(e),i=this.iconCache.get(e.id);if(i&&i.signature===t)return i.icon;let a=this.resolveIconScale(e.type),r={href:i?.icon.href??null,scale:a};this.iconCache.set(e.id,{signature:t,icon:r});let s=e.ais.status==="remove"?void 0:e.ais.status;return this.ngZone.runOutsideAngular(()=>{mm({mmsi:e.mmsi??"",type:e.type,navState:this.isVesselLike(e)?e.navState:void 0,aisShipTypeId:this.isVesselLike(e)?e.design?.aisShipType?.id:void 0,atonVirtual:this.isAton(e)?e.virtual:void 0,atonTypeId:this.isAton(e)?e.typeId:void 0,status:s,collisionRiskRating:this.isVesselLike(e)?e.closestApproach?.collisionRiskRating:void 0}).then(l=>{let m=this.iconCache.get(e.id);!m||m.signature!==t||(m.icon={href:l,scale:a},this.scheduleRenderDebounced())})}),r}resolveIconScale(e){switch(e){case"aton":return 3.5;case"basestation":return 3;case"sar":return 2.4;case"vessel":return 3;default:return 2.4}}buildIconSignature(e){let t=e.ais.status==="lost"?"unconfirmed":e.ais.status;return[e.mmsi,e.type,this.isVesselLike(e)?e.navState:void 0,this.isVesselLike(e)?e.design?.aisShipType?.id:void 0,this.isAton(e)?e.virtual:void 0,this.isAton(e)?e.typeId:void 0,t,this.isVesselLike(e)?e.closestApproach?.collisionRiskRating:void 0].join("|")}buildClassName(e){let t=[`status-${e.status}`,`type-${e.type}`,e.aisClass?`class-${e.aisClass.toLowerCase()}`:"class-unknown"];if(e.navState){let i=e.navState.toLowerCase();i.includes("moored")&&t.push("state-moored"),i.includes("anchored")&&t.push("state-anchored")}return e.id===this.selectedId()&&t.push("is-selected"),t.join(" ")}resolveTargetVectorStroke(e){if(e.ais.status!=="confirmed")return"#50505f";let t=e.closestApproach?.collisionRiskRating,i=typeof t=="number"?t:Number(t);return Number.isFinite(i)?i<Ol?"red":i<ps?"yellow":"#50505f":"#50505f"}shouldFilterTarget(e){let t=this.filterState();if(!t.anchoredMoored&&!t.noCollisionRisk&&!t.allAton&&!t.allButSar&&!t.allVessels&&t.vesselTypes.size===0)return!1;if(t.anchoredMoored&&this.isVesselLike(e)&&this.isStationaryNavState(e.navState)||t.noCollisionRisk&&this.isVesselLike(e)&&(e.ais.status!=="confirmed"||this.isStationaryNavState(e.navState)||this.isNoCollisionRisk(e))||t.allAton&&e.type==="aton"||t.allButSar&&e.type!=="sar"||t.allVessels&&this.isVesselLike(e))return!0;if(t.vesselTypes.size>0&&this.isVesselLike(e)){let i=this.resolveVesselIconKey(e);if(i&&t.vesselTypes.has(i))return!0}return!1}isNoCollisionRisk(e){let t=e.closestApproach?.collisionRiskRating;if(!Object.prototype.hasOwnProperty.call(e.closestApproach??{},"collisionRiskRating"))return!1;if(t==null)return!0;let i=typeof t=="number"?t:Number(t);return Number.isFinite(i)?i>=ps:!0}resolveVesselIconKey(e){if(!this.isVesselLike(e))return null;let t=Fl({mmsi:e.mmsi??e.id??"",type:e.type,aisShipTypeId:e.design?.aisShipType?.id});return t.startsWith("vessel/")?t:null}polarToCartesian(e,t,i,a){let r=e*Math.PI/180,s=t/i*a;return{x:s*Math.sin(r),y:-s*Math.cos(r)}}hasValidPosition(e){return typeof e?.latitude=="number"&&Number.isFinite(e.latitude)&&typeof e?.longitude=="number"&&Number.isFinite(e.longitude)}offsetPoint(e,t,i,a){let r=i*Math.PI/180;return{x:e+a*Math.sin(r),y:t-a*Math.cos(r)}}wrapDegrees(e){let t=e%360;return t<0?t+360:t}isStationaryNavState(e){if(typeof e=="number"&&Number.isFinite(e))return e===1||e===5;if(typeof e!="string")return!1;let t=e.trim().toLowerCase().replace(/\s+/g," ");if(!t.length)return!1;let i=Number(t);return Number.isFinite(i)?i===1||i===5:t.includes("moored")||t.includes("anchored")||t.includes("at anchor")}shortestAngleDelta(e,t){return(t-e+540)%360-180}buildTrackSignature(e){let t=e.position??{};return[t.latitude,t.longitude,this.isVesselLike(e)?e.headingTrue:void 0,this.isVesselLike(e)?e.courseOverGroundTrue:void 0].join("|")}isVesselLike(e){return e.type==="vessel"||e.type==="sar"}isAton(e){return e.type==="aton"}buildCornerBoxPath(e,t){let i=e,a=Math.min(Math.max(t,0),i);return[`M ${-i} ${-i} h ${a}`,`M ${-i} ${-i} v ${a}`,`M ${i} ${-i} h ${-a}`,`M ${i} ${-i} v ${a}`,`M ${-i} ${i} h ${a}`,`M ${-i} ${i} v ${-a}`,`M ${i} ${i} h ${-a}`,`M ${i} ${i} v ${-a}`].join(" ")}smoothRotation(e){let t=performance.now();if(this.viewRotationSmoothed===null||this.lastRotationAt===null)return this.viewRotationSmoothed=this.wrapDegrees(e),this.lastRotationAt=t,this.viewRotationSmoothed;let i=Math.min(250,Math.max(0,t-this.lastRotationAt)),a=Math.min(1,i/200),r=this.shortestAngleDelta(this.viewRotationSmoothed,e);return this.viewRotationSmoothed=this.wrapDegrees(this.viewRotationSmoothed+r*a),this.lastRotationAt=t,this.viewRotationSmoothed}toDegreesIfRadians(e){return typeof e!="number"||!Number.isFinite(e)?null:this.units.convertToUnit("deg",e)}distanceNm(e,t){let a=e.latitude*Math.PI/180,r=t.latitude*Math.PI/180,s=(t.latitude-e.latitude)*Math.PI/180,l=(t.longitude-e.longitude)*Math.PI/180,m=Math.sin(s/2),f=Math.sin(l/2),b=m*m+Math.cos(a)*Math.cos(r)*f*f;return 6371e3*(2*Math.atan2(Math.sqrt(b),Math.sqrt(1-b)))/1852}ngOnDestroy(){this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.iconRenderTimer!==null&&(window.clearTimeout(this.iconRenderTimer),this.iconRenderTimer=null)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-ais-radar"]],viewQuery:function(t,i){t&1&&Me(i.svgRef,aC,5)(i.menuAnchorRef,oC,5)(i.menuTrigger,rC,5),t&2&&ke(3)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:29,vars:9,consts:[["radarSvg",""],["menuAnchor","","menuTrigger","matMenuTrigger"],["targetMenu","matMenu"],["filterMenu","matMenu"],["vesselTypeMenu","matMenu"],["kipResizeObserver","",1,"ais-radar-container",3,"kipResize"],["type","button","matMiniFab","",1,"ais-radar-mode-toggle-button",3,"click","matTooltip"],["viewBox","0 0 40 40","aria-hidden","true",1,"ais-mode-icon"],["type","button","matMiniFab","","matTooltip","Increase range","aria-label","Increase range",1,"ais-radar-range-button","ais-radar-range-plus",3,"click"],["type","button","matMiniFab","","matTooltip","Decrease range","aria-label","Decrease range",1,"ais-radar-range-button","ais-radar-range-minus",3,"click"],["type","button","matMiniFab","","matTooltip","Filter targets","aria-label","Filter targets",1,"ais-radar-range-button","ais-radar-filter-button",3,"matMenuTriggerFor"],["type","button","matMiniFab","","matTooltip","Show only collision risk targets","aria-label","No collision risk filter",1,"ais-radar-range-button","ais-radar-collision-button",3,"is-active"],["role","img","aria-label","AIS radar display",1,"ais-radar"],["type","button","aria-hidden","true","tabindex","-1",1,"ais-radar-menu-anchor",3,"matMenuTriggerFor"],[3,"closed"],["matMenuContent",""],[1,"widgetOverlay"],["stroke","currentColor","d","M10 8 L20 2 L30 8",1,"ais-mode-icon-chev"],["fill","currentColor","x","20","y","31",1,"ais-mode-icon-letter"],["fill","currentColor","d","M20 4 L34 36 L20 28 L6 36 Z",1,"ais-mode-icon-vessel"],["type","button","matMiniFab","","matTooltip","Show only collision risk targets","aria-label","No collision risk filter",1,"ais-radar-range-button","ais-radar-collision-button",3,"click"],["mat-menu-item","","type","button",1,"ais-radar-menu-item"],["mat-menu-item","","type","button",1,"ais-radar-menu-item",3,"click"],["alt","","aria-hidden","true",1,"target-menu-icon"],[1,"target-menu-label"],["mat-menu-item","","disabled","",1,"ais-filter-menu-header"],["mat-menu-item","","type","button",3,"click"],["aria-hidden","true",1,"ais-filter-check"],["mat-menu-item","",3,"matMenuTriggerFor"],["mat-menu-item","","type","button"]],template:function(t,i){if(t&1&&(d(0,"div",5),U("kipResize",function(r){return i.onResized(r)}),d(1,"button",6),U("click",function(){return i.toggleViewMode()}),I(2,lC,4,0,":svg:svg",7)(3,dC,2,0,":svg:svg",7),u(),d(4,"button",8),U("click",function(){return i.incrementRange()}),d(5,"mat-icon"),c(6,"add"),u()(),d(7,"button",9),U("click",function(){return i.decrementRange()}),d(8,"mat-icon"),c(9,"remove"),u()(),d(10,"button",10)(11,"mat-icon"),c(12,"filter_list"),u()(),I(13,cC,3,2,"button",11),ie(),F(14,"svg",12,0),Ge(),F(16,"button",13,1),u(),d(19,"mat-menu",14,2),U("closed",function(){return i.resetTargetMenuState()}),bi(21,mC,2,0,"ng-template",15),u(),d(22,"mat-menu",null,3),bi(24,hC,27,5,"ng-template",15),u(),d(25,"mat-menu",null,4),bi(27,fC,2,0,"ng-template",15),u(),I(28,gC,1,0,"div",16)),t&2){let a=Nt(20),r=Nt(23);g(),O("matTooltip",i.effectiveViewMode()==="north-up"?"Change to North-Up mode":"Change to Course-Up mode"),J("aria-label",i.effectiveViewMode()==="north-up"?"North up mode":"Course up mode"),g(),N(i.effectiveViewMode()==="north-up"?2:3),g(8),st("is-active",i.hasActiveFilters()),O("matMenuTriggerFor",r),g(3),N(i.hasCollisionRiskData()?13:-1),g(3),O("matMenuTriggerFor",a),g(12),N(i.dashboard.isDashboardStatic()?-1:28)}},dependencies:[jt,nt,qr,et,Qe,Ru,Iu,Du,Pu,Nu,no,io],encapsulation:2,changeDetection:0})}return n})();var vC=["canvasMainRef"],zp=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);canvas=y(mt);static DEFAULT_CONFIG={displayName:"Static Label",color:"green",bgColor:"grey",noColor:!1,noBgColor:!0};canvasRef=pe.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;maxTextWidth=0;maxTextHeight=0;disposed=!1;fgColor=_("");bgColor=_("");constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||B(()=>{this.fgColor.set(this.mapColor(e.color,t)),this.bgColor.set(this.mapColor(e.bgColor??"grey",t)),this.draw()})}),L(()=>{let e=this.runtime.options()?.displayName;B(()=>{e!==void 0&&this.draw()})})}mapColor(e,t){switch(e){case"contrast":return t.contrast;case"blue":return t.blue;case"green":return t.green;case"pink":return t.pink;case"orange":return t.orange;case"purple":return t.purple;case"grey":return t.grey;case"yellow":return t.yellow;default:return t.contrast}}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.draw()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.draw()}draw(){if(!this.ctx||!this.canvasElement)return;let e=this.runtime.options();if(!e)return;this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight),e.noBgColor||this.canvas.drawRectangle(this.ctx,0,0,this.canvasElement.width,this.canvasElement.height,this.bgColor());let t=e.displayName||"";this.canvas.drawText(this.ctx,t,Math.floor(this.cssWidth/2),Math.floor(this.cssHeight/2+10),this.cssWidth-40,this.cssHeight-40,"bold",this.fgColor())}ngOnDestroy(){this.disposed=!0;try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-label"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,vC,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["canvasMainRef",""],[1,"label-canvas"]],template:function(t,i){t&1&&Q(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.label-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block;border-radius:var(--mat-card-elevated-container-shape, var(--mat-sys-corner-medium))}"]})}return n})();var bC=["plainIframe"];function AC(n,o){if(n&1&&Q(0,"iframe",1,0),n&2){let e=k();Vi("src",e.widgetUrl(),ua)}}function yC(n,o){n&1&&(D(0,"div",2)(1,"h2"),c(2,"Empty or bad URL"),R(),D(3,"p"),c(4," IMPORTANT: cross-domain security rules (CORS) apply to this widget. "),R(),D(5,"p"),c(6,"Typically, you can load Grafana graphs, Signal K apps or other related tools. "),R()())}var Up=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);_dashboard=y(ft);_sanitizer=y(qa);static DEFAULT_CONFIG={widgetUrl:null,allowInput:!1};iframe=pe.required("plainIframe");widgetUrl=_(null);displayTransparentOverlay=_("block");constructor(){L(()=>{let e=this.runtime.options(),t=this._dashboard.isDashboardStatic();e&&B(()=>{t?this.displayTransparentOverlay.set(e.allowInput?"none":"block"):this.displayTransparentOverlay.set("block")})}),L(()=>{let e=this.runtime.options()?.widgetUrl;this.widgetUrl.set(this.resolveUrl(e))}),window.addEventListener("message",this.handleIframeGesture)}ngAfterViewInit(){if(this.iframe()){this.iframe().nativeElement.onload=()=>this.injectSwipeScript();try{let e=this.iframe().nativeElement.contentDocument;e&&(e.readyState==="complete"||e.readyState==="interactive")&&this.injectSwipeScript()}catch(e){}}}ngOnDestroy(){window.removeEventListener("message",this.handleIframeGesture),this.iframe()&&(this.iframe().nativeElement.onload=null);try{let e=this.iframe()?.nativeElement.contentDocument;if(e){let t=`kip-gesture-inject-${this.id()}`,i=e.getElementById(t);i&&i.parentNode&&i.parentNode.removeChild(i)}}catch(e){}}handleIframeGesture=e=>{if(!e.data)return;let t=e.data?.eventData?.instanceId||e.data?.keyEventData?.instanceId;if(!(!t||t!==this.id())){if(e.data.gesture)switch(e.data.gesture){case"swipeup":this._dashboard.navigateToPreviousDashboard();break;case"swipedown":this._dashboard.navigateToNextDashboard();break;case"swipeleft":{let i=new Event("openLeftSidenav",{bubbles:!0,cancelable:!0});window.document.dispatchEvent(i);break}case"swiperight":{let i=new Event("openRightSidenav",{bubbles:!0,cancelable:!0});window.document.dispatchEvent(i);break}default:break}if(e.data.type==="keydown"&&e.data.keyEventData){let{key:i,ctrlKey:a,shiftKey:r}=e.data.keyEventData,s=new KeyboardEvent("keydown",{key:i,ctrlKey:a,shiftKey:r,bubbles:!0,cancelable:!0});document.dispatchEvent(s)}}};injectSwipeScript(){let e=this.iframe().nativeElement.contentWindow,t=this.iframe().nativeElement.contentDocument;if(!t||!e){console.error("[WidgetIframe] Iframe contentDocument or contentWindow is undefined. Possible cross-origin issue or iframe not fully loaded.");return}try{let i=`kip-gesture-inject-${this.id()}`;if(t.getElementById(i))return;let a=ao({instanceId:this.id()}),r=t.createElement("script");r.id=i,r.textContent=a,t.body.appendChild(r)}catch(i){console.warn("[WidgetIframe] Failed to inject swipe script into iframe:",i)}}isValidProtocol(e){try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch(t){return console.warn(`[Embed Widget] Invalid Url: ${e}, Error: ${t}`),!1}}resolveUrl(e){if(!e)return null;try{let t=new URL(e,window.location.origin);return this.isValidProtocol(t.href)?this._sanitizer.bypassSecurityTrustResourceUrl(t.href):null}catch(t){return console.warn(`[Embed Widget] Can't resolve Url: ${e}, Error: ${t}`),null}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-iframe"]],viewQuery:function(t,i){t&1&&Me(i.iframe,bC,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:3,vars:3,consts:[["plainIframe",""],["width","100%","height","100%","frameborder","0",1,"widgetIframe",3,"src"],[2,"padding","15px"],[1,"widgetOverlay"]],template:function(t,i){t&1&&(I(0,AC,2,1,"iframe",1)(1,yC,7,0,"div",2),Q(2,"div",3)),t&2&&(N(i.widgetUrl()?0:1),g(2),be("display",i.displayTransparentOverlay()))},styles:["[_nghost-%COMP%]{overflow:hidden}.widgetIframe[_ngcontent-%COMP%]{background-color:#fff;border-radius:var(--mat-card-elevated-container-shape, var(--mat-sys-corner-medium))}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent}"]})}return n})();var xC=["hWrapper"];function CC(n){return{Red:n.ColorDef.RED,Green:n.ColorDef.GREEN,Blue:n.ColorDef.BLUE,Orange:n.ColorDef.ORANGE,Yellow:n.ColorDef.YELLOW,Cyan:n.ColorDef.CYAN,Magenta:n.ColorDef.MAGENTA,White:n.ColorDef.WHITE,Gray:n.ColorDef.GRAY,Black:n.ColorDef.BLACK,Raith:n.ColorDef.RAITH,"Green LCD":n.ColorDef.GREEN_LCD,"JUG Green":n.ColorDef.JUG_GREEN}}function SC(n){return{blackMetal:n.FrameDesign.BLACK_METAL,metal:n.FrameDesign.METAL,shinyMetal:n.FrameDesign.SHINY_METAL,brass:n.FrameDesign.BRASS,steel:n.FrameDesign.STEEL,chrome:n.FrameDesign.CHROME,gold:n.FrameDesign.GOLD,anthracite:n.FrameDesign.ANTHRACITE,tiltedGray:n.FrameDesign.TILTED_GRAY,tiltedBlack:n.FrameDesign.TILTED_BLACK,glossyMetal:n.FrameDesign.GLOSSY_METAL}}var Hp=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);streams=y(Le);static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Horizon",filterSelfPaths:!0,paths:{gaugePitchPath:{description:"Attitude Pitch Data",path:"self.navigation.attitude.pitch",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:1e3},gaugeRollPath:{description:"Attitude Roll Data",path:"self.navigation.attitude.roll",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:1e3}},gauge:{type:"horizon",noFrameVisible:!1,faceColor:"anthracite",invertPitch:!1,invertRoll:!1},enableTimeout:!1,dataTimeout:5};wrapperRef=pe("hWrapper");resizeObserver=null;currentSize=0;structuralKey="";pendingSize=null;sizeCommitTimer=null;SIZE_STABLE_MS=180;ngZone=y(Be);gaugeOptions={};gauge=null;latestPitch=0;latestRoll=0;constructor(){L(()=>{let e=this.runtime.options();!e||!e.paths?.gaugePitchPath?.path||B(()=>this.streams.observe("gaugePitchPath",i=>{let a=i?.data?.value??0;if(this.latestPitch=a,this.gauge){let r=e.gauge?.invertPitch?-a:a;try{this.gauge.setPitchAnimated(r)}catch(s){}}}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.gaugeRollPath?.path||B(()=>this.streams.observe("gaugeRollPath",i=>{let a=i?.data?.value??0;if(this.latestRoll=a,this.gauge){let r=e.gauge?.invertRoll?-a:a;try{this.gauge.setRollAnimated(r)}catch(s){}}}))}),L(()=>{let e=this.runtime.options();if(!e)return;let t=`${e.gauge?.noFrameVisible??!1}|${e.gauge?.faceColor??"anthracite"}`;if(t===this.structuralKey){this.applyInversions(e);return}this.structuralKey=t,this.currentSize>=50&&(this.buildOptions(e,this.currentSize),this.rebuildGauge())})}ngAfterViewInit(){let e=this.wrapperRef()?.nativeElement;if(!e)return;let t=()=>{if(this.pendingSize==null||this.pendingSize===this.currentSize||this.pendingSize<50)return;let r=this.pendingSize,s=this.runtime.options();if(!s)return;this.currentSize=r;let l=document.getElementById(this.id()+"-canvas");l&&((l.width!==r||l.height!==r)&&(l.width=r,l.height=r),l.style.width=r+"px",l.style.height=r+"px"),this.buildOptions(s,r),this.rebuildGauge(),this.pendingSize=null},i=()=>{this.sizeCommitTimer&&clearTimeout(this.sizeCommitTimer),this.sizeCommitTimer=window.setTimeout(()=>{t(),this.sizeCommitTimer=null},this.SIZE_STABLE_MS)},a=()=>{let r=e.getBoundingClientRect(),s=Math.round(Math.min(r.width,r.height)),l=this.pendingSize??this.currentSize;if(!s||s<50||l&&Math.abs(l-s)<4)return;if(this.currentSize===0&&this.pendingSize===null){this.pendingSize=s,t();return}this.pendingSize=s;let m=document.getElementById(this.id()+"-canvas");m&&(m.style.width=s+"px",m.style.height=s+"px"),i()};this.ngZone.runOutsideAngular(()=>{this.resizeObserver=new ResizeObserver(()=>a()),this.resizeObserver.observe(e),a()})}buildOptions(e,t){if(typeof steelseries>"u")return;let i=SC(steelseries),a=CC(steelseries);this.gaugeOptions={pointerColor:a.Red,frameVisible:!(e.gauge?.noFrameVisible??!1),frameDesign:i[e.gauge?.faceColor??"anthracite"],foregroundVisible:!1,size:t}}rebuildGauge(){let e=this.id()+"-canvas";if(this.gauge)try{this.gauge=null}catch(i){}let t=document.getElementById(e);if(t){this.currentSize&&(t.width!==this.currentSize||t.height!==this.currentSize)&&(t.width=this.currentSize,t.height=this.currentSize);let i=t.getContext("2d");i&&i.clearRect(0,0,t.width,t.height)}try{this.gauge=new steelseries.Horizon(e,this.gaugeOptions);let i=this.runtime.options();i&&this.gauge&&this.applyInversions(i)}catch(i){}}applyInversions(e){if(this.gauge){try{this.gauge.setPitchAnimated(e.gauge?.invertPitch?-this.latestPitch:this.latestPitch)}catch(t){}try{this.gauge.setRollAnimated(e.gauge?.invertRoll?-this.latestRoll:this.latestRoll)}catch(t){}}}ngOnDestroy(){if(this.resizeObserver){try{this.resizeObserver.disconnect()}catch(t){}this.resizeObserver=null}this.sizeCommitTimer&&(clearTimeout(this.sizeCommitTimer),this.sizeCommitTimer=null);let e=document.getElementById(this.id()+"-canvas");if(e)try{let t=e.getContext("2d");t&&t.clearRect(0,0,e.width,e.height),e.width=0,e.height=0}catch(t){}this.gauge=null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-horizon"]],viewQuery:function(t,i){t&1&&Me(i.wrapperRef,xC,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:4,vars:3,consts:[["hWrapper",""],[1,"canvas-wrap"],[2,"z-index","inherit",3,"id"]],template:function(t,i){t&1&&(D(0,"div",1,0)(2,"canvas",2),c(3," Browser does not support canvas element. "),R()()),t&2&&(be("padding",i.gaugeOptions.frameVisible?"10px":"0px"),g(2),Vi("id",i.id()+"-canvas"))},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.canvas-wrap[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:0}.canvas-wrap[_ngcontent-%COMP%] > canvas[_ngcontent-%COMP%]{display:block;position:static;transform:none}"]})}return n})();var wC=["finePath"],_C=["coarsePath"];function MC(n,o){if(n&1&&(ie(),Q(0,"line")),n&2){let e=o.$implicit;J("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)("stroke-width",e.major?1.5:1)}}function kC(n,o){if(n&1&&(ie(),Q(0,"line",20)),n&2){let e=o.$implicit;J("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)("stroke-width",e.major?1.2:.8)}}function TC(n,o){if(n&1&&(ie(),D(0,"text"),c(1),R()),n&2){let e=o.$implicit;J("x",e.x)("y",e.y),g(),ge("",e.text,"\xB0")}}function EC(n,o){if(n&1&&(ie(),Q(0,"line")),n&2){let e=o.$implicit;J("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)("stroke-width",e.major?1.5:1)}}function DC(n,o){if(n&1&&(ie(),Q(0,"line",20)),n&2){let e=o.$implicit;J("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)("stroke-width",e.major?1.2:.8)}}function PC(n,o){if(n&1&&(ie(),D(0,"text"),c(1),R()),n&2){let e=o.$implicit;J("x",e.x)("y",e.y),g(),ge("",e.text,"\xB0")}}var qp=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);streams=y(Le);ngZone=y(Be);finePathRef=pe("finePath");coarsePathRef=pe("coarsePath");angleDeg=_(0);absAngle=K(()=>{let e=this.angleDeg();return e==null?null:Math.abs(e)});angleSide=K(()=>{let e=this.angleDeg();if(e==null)return"";let t=e>0?"Stbd":e<0?"Port":"Level";return this.runtime.options()?.gauge?.sideLabel?t:""});displayValue=K(()=>{let e=this.absAngle();if(e==null)return"--";let t=this.runtime.options()?.numDecimal??1;return e.toFixed(t)});themeColorValue=_("contrast");ready=_(!1);pointerTransition=K(()=>{let e=this.runtime.options()?.paths?.angle?.sampleTime??1e3;return`transform ${Math.max(100,e*.95)}ms ease-in-out`});fineTicks=_([]);fineInnerTicks=_([]);fineLabels=_([]);coarseTicks=_([]);coarseInnerTicks=_([]);coarseLabels=_([]);finePointerTransform=this.makePointerTransform("fine");coarsePointerTransform=this.makePointerTransform("coarse");displayName=K(()=>this.runtime.options()?.displayName||"Heel");static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Heel",filterSelfPaths:!0,paths:{angle:{description:"Heel / Roll / Other Angle",path:"self.navigation.attitude.roll",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"deg",sampleTime:1e3,pathRequired:!0}},gauge:{type:"angle",invertAngle:!1,sideLabel:!0},numInt:2,numDecimal:0,color:"contrast",enableTimeout:!1,dataTimeout:5};constructor(){L(()=>{let e=this.runtime.options();!e||!e.paths?.angle?.path||B(()=>this.streams.observe("angle",i=>{let a=i?.data?.value;if(a==null){this.angleDeg.set(null);return}let r=e.gauge?.invertAngle?-a:a;this.angleDeg.set(r)}))}),L(()=>{let e=this.theme(),t=this.runtime.options();!e||!t||this.themeColorValue.set(Te(t.color||"contrast",e).color)})}ngAfterViewInit(){this.ngZone.runOutsideAngular(()=>{requestAnimationFrame(()=>{let e=this.finePathRef()?.nativeElement,t=this.coarsePathRef()?.nativeElement;if(e){let i=this.buildScale(e,-5,5,1,.5);this.fineTicks.set(i.ticks),this.fineInnerTicks.set(i.innerTicks),this.fineLabels.set(i.labels)}if(t){let i=this.buildScale(t,-40,40,10,5);this.coarseTicks.set(i.ticks),this.coarseInnerTicks.set(i.innerTicks),this.coarseLabels.set(i.labels)}this.angleDeg()==null&&this.angleDeg.set(0),this.ready.set(!0)})})}makePointerTransform(e){return K(()=>this.computePointerTransform(this.angleDeg(),e))}setColors(e){let t=this.runtime.options();!e||!t||this.themeColorValue.set(Te(t.color||"contrast",e).color)}computePointerTransform(e,t){let i=e??0,a=t==="fine"?this.finePathRef()?.nativeElement:this.coarsePathRef()?.nativeElement;if(!a)return t==="fine"?"translate(200px, 20px) rotate(0deg)":"translate(200px, 10px) rotate(0deg)";let r=t==="fine"?{min:-5,max:5}:{min:-40,max:40},s=Math.max(r.min,Math.min(r.max,i)),l=a.getTotalLength(),f=(s-r.min)/(r.max-r.min)*l,b=a.getPointAtLength(f),A=f<10||f>l-10?5:1,C=a.getPointAtLength(Math.max(0,f-A)),w=a.getPointAtLength(Math.min(l,f+A)),M=w.x-C.x,G=w.y-C.y,E=Math.atan2(G,M)*180/Math.PI,W=Math.hypot(M,G)||1,V=-G/W,Y=M/W,j=-10,ye=b.x+V*j,me=b.y+Y*j;return`translate(${ye}px, ${me}px) rotate(${E}deg)`}buildScale(e,t,i,a,r){let s=e.getTotalLength(),l=[],m=[],f=[],b=i-t,A=Math.round(b/r),C=Math.round(a/r);for(let w=0;w<=A;w++){let M=t+w*r,G=w/A,E=w===A?s:G*s,W=e.getPointAtLength(E),V=e.getPointAtLength(Math.max(0,E-1)),Y=e.getPointAtLength(Math.min(s,E+1)),j=Math.atan2(Y.y-V.y,Y.x-V.x)*180/Math.PI,ye=w%C===0||Math.abs(M)<1e-9,me=ye?8:4,ne=ye?6:3,re=this.pointFromAngle(W,j+90,0),ce=this.pointFromAngle(W,j+90,me);l.push({x1:re.x,y1:re.y,x2:ce.x,y2:ce.y,major:ye});let oe=this.pointFromAngle(W,j-90,0),de=this.pointFromAngle(W,j-90,ne);if(m.push({x1:oe.x,y1:oe.y,x2:de.x,y2:de.y,major:ye}),ye){let le=this.pointFromAngle(W,j+90,me+8);f.push({x:le.x,y:le.y,text:`${Math.abs(M)}`,value:M})}}return{ticks:l,innerTicks:m,labels:f}}pointFromAngle(e,t,i){let a=t*Math.PI/180;return{x:e.x+Math.cos(a)*i,y:e.y+Math.sin(a)*i}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-heel-gauge"]],viewQuery:function(t,i){t&1&&Me(i.finePathRef,wC,5)(i.coarsePathRef,_C,5),t&2&&ke(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:54,vars:18,consts:[["finePath",""],["coarsePath",""],[1,"container"],["viewBox","0 0 400 105","preserveAspectRatio","xMidYMid meet",1,"flex-element","scale","fine"],["id","fineTubeGradient","x1","0%","y1","0%","x2","0%","y2","100%"],["offset","0%",1,"tube-highlight-color","opacity1"],["offset","45%",1,"tube-highlight-color","opacity2"],["offset","100%",1,"tube-highlight-color","opacity3"],["id","tubeEffect"],["in","SourceAlpha","stdDeviation","1.5","result","blur"],["in","blur","surfaceScale","4","specularConstant",".6","specularExponent","30","lighting-color","currentColor","result","specular"],["x","200","y","-50","z","150"],["x","200","y","150","z","80"],["in","specular","in2","SourceAlpha","operator","in","result","specular"],["in","SourceGraphic","in2","specular","operator","arithmetic","k1","0","k2","1","k3","0.7","k4","0"],["d","M 60,10 A 2400,2400 0 0,0 340,10 A 10,10 0 0,1 340,30 A 2400,2400 0 0,1 60,30 A 10,10 0 0,1 60,10 Z",1,"tube-background"],["d","M 60,11 A 2400,2400 0 0,0 340,11 A 8,8 0 0,1 340,17 A 2400,2400 0 0,1 60,17 A 8,8 0 0,1 60,11 Z",1,"tube-highlight"],["d","M 60,23 A 2400,2400 0 0,0 340,23 A 8,8 0 0,1 340,26 A 2400,2400 0 0,1 60,26 A 8,8 0 0,1 60,23 Z",1,"tube-highlight-secondary"],["d","M 60,30 A 2400,2400 0 0,0 340,30",1,"scale-line"],[1,"tick-marks"],["opacity","0.6"],[1,"scale-values"],["transform","translate(200 20) rotate(0)",1,"pointer"],["rx","6","ry","9"],["x","200","y","93","text-anchor","middle",1,"brand"],["viewBox","0 0 400 115","preserveAspectRatio","xMidYMid meet",1,"flex-element","scale"],["transform","translate(0,15)"],["x","200","y","22","text-anchor","middle",1,"angle"],["dx","-16",1,"side"],["d","M 40,0 A 400,400 0 0,0 360,0 A 10,10 0 0,1 360,20 A 400,400 0 0,1 40,20 A 10,10 0 0,1 40,0 Z",1,"tube-background"],["d","M 40,1 A 400,400 0 0,0 360,1 A 8,8 0 0,1 360,7 A 400,400 0 0,1 40,7 A 8,8 0 0,1 40,1 Z",1,"tube-highlight"],["d","M 40,13 A 400,400 0 0,0 360,13 A 8,8 0 0,1 360,16 A 400,400 0 0,1 40,16 A 8,8 0 0,1 40,13 Z",1,"tube-highlight-secondary"],["d","M 40,20 A 400,400 0 0,0 360,20",1,"scale-line"],["transform","translate(200 10) rotate(0)",1,"pointer"]],template:function(t,i){t&1&&(D(0,"div",2),ie(),D(1,"svg",3)(2,"defs")(3,"linearGradient",4),Q(4,"stop",5)(5,"stop",6)(6,"stop",7),R(),D(7,"filter",8),Q(8,"feGaussianBlur",9),D(9,"feSpecularLighting",10),Q(10,"fePointLight",11)(11,"fePointLight",12),R(),Q(12,"feComposite",13)(13,"feComposite",14),R()(),Q(14,"path",15)(15,"path",16)(16,"path",17)(17,"path",18,0),D(19,"g",19),xe(20,MC,1,5,":svg:line",null,Ne),R(),D(22,"g",19),xe(23,kC,1,5,":svg:line",20,Ne),R(),D(25,"g",21),xe(26,TC,2,3,":svg:text",null,Ne),R(),D(28,"g",22),Q(29,"ellipse",23),R(),D(30,"text",24),c(31),R()(),D(32,"svg",25)(33,"g",26)(34,"text",27),c(35),D(36,"tspan",28),c(37),R()(),Q(38,"path",29)(39,"path",30)(40,"path",31)(41,"path",32,1),D(43,"g",19),xe(44,EC,1,5,":svg:line",null,Ne),R(),D(46,"g",19),xe(47,DC,1,5,":svg:line",20,Ne),R(),D(49,"g",21),xe(50,PC,2,3,":svg:text",null,Ne),R(),D(52,"g",33),Q(53,"ellipse",23),R()()()()),t&2&&(g(20),Ce(i.fineTicks()),g(3),Ce(i.fineInnerTicks()),g(3),Ce(i.fineLabels()),g(2),be("transition",i.ready()?i.pointerTransition():"none")("transform",i.finePointerTransform()),st("ready",i.ready()),g(),J("fill",i.themeColorValue()),g(2),X(i.displayName()),g(3),J("fill",i.themeColorValue()),g(),ge(" ",i.displayValue(),"\xB0 "),g(2),X(i.angleSide()),g(7),Ce(i.coarseTicks()),g(3),Ce(i.coarseInnerTicks()),g(3),Ce(i.coarseLabels()),g(2),be("transition",i.ready()?i.pointerTransition():"none")("transform",i.coarsePointerTransform()),st("ready",i.ready()),g(),J("fill",i.themeColorValue()))},styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;font-family:Roboto}.container[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;justify-content:center;height:100%;width:100%;box-sizing:border-box;gap:0px}.brand[_ngcontent-%COMP%]{font-size:25px;font-weight:700;fill:var(--kip-contrast-dim-color)}.angle[_ngcontent-%COMP%]{font-size:50px;font-weight:700}.side[_ngcontent-%COMP%]{font-size:16px}svg.scale[_ngcontent-%COMP%]{width:100%;height:auto}svg.scale[_ngcontent-%COMP%] .tube-background[_ngcontent-%COMP%]{fill:var(--mat-sys-surface-container);filter:url(#tubeEffect)}svg.scale[_ngcontent-%COMP%] .tube-highlight[_ngcontent-%COMP%]{fill:url(#fineTubeGradient);opacity:.15;mix-blend-mode:soft-light;transition:fill .3s ease,opacity .3s ease}svg.scale[_ngcontent-%COMP%] .tube-highlight-secondary[_ngcontent-%COMP%]{fill:url(#fineTubeGradient);opacity:.2;mix-blend-mode:overlay;transition:fill .3s ease,opacity .3s ease}.tube-highlight-color[_ngcontent-%COMP%]{stop-color:var(--kip-contrast-color)}.opacity1[_ngcontent-%COMP%]{stop-opacity:.12}.opacity2[_ngcontent-%COMP%]{stop-opacity:.05}.opacity3[_ngcontent-%COMP%]{stop-opacity:0}svg.scale[_ngcontent-%COMP%] .scale-line[_ngcontent-%COMP%]{stroke:none;fill:none}.tick-marks[_ngcontent-%COMP%]{stroke:var(--kip-contrast-dim-color)}.scale-values[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);text-anchor:middle;dominant-baseline:hanging;font-size:12;font-weight:700}.pointer[_ngcontent-%COMP%] ellipse[_ngcontent-%COMP%]{stroke:#ffffff59;stroke-width:.7;paint-order:stroke fill;filter:drop-shadow(0 0 1px rgba(0,0,0,.55)) drop-shadow(0 1px 1.5px rgba(0,0,0,.55)) drop-shadow(0 -1px 1px rgba(255,255,255,.25));transition:filter .25s,stroke .25s}"]})}return n})();var IC=["gaugeCanvas"];typeof steelseries>"u"&&(globalThis.steelseries={BackgroundColor:{DARK_GRAY:"darkGray",SATIN_GRAY:"satinGray",LIGHT_GRAY:"lightGray",WHITE:"white",BLACK:"black",BEIGE:"beige",BROWN:"brown",RED:"red",GREEN:"green",BLUE:"blue",ANTHRACITE:"anthracite",MUD:"mud",PUNCHED_SHEET:"punchedSheet",CARBON:"carbon",STAINLESS:"stainless",BRUSHED_METAL:"brushedMetal",BRUSHED_STAINLESS:"brushedStainless",TURNED:"turned"},FrameDesign:{BLACK_METAL:"blackMetal",METAL:"metal",SHINY_METAL:"shinyMetal",BRASS:"brass",STEEL:"steel",CHROME:"chrome",GOLD:"gold",ANTHRACITE:"anthracite",TILTED_GRAY:"tiltedGray",TILTED_BLACK:"tiltedBlack",GLOSSY_METAL:"glossyMetal"}});var pd={darkGray:steelseries.BackgroundColor.DARK_GRAY,satinGray:steelseries.BackgroundColor.SATIN_GRAY,lightGray:steelseries.BackgroundColor.LIGHT_GRAY,white:steelseries.BackgroundColor.WHITE,black:steelseries.BackgroundColor.BLACK,beige:steelseries.BackgroundColor.BEIGE,brown:steelseries.BackgroundColor.BROWN,red:steelseries.BackgroundColor.RED,green:steelseries.BackgroundColor.GREEN,blue:steelseries.BackgroundColor.BLUE,anthracite:steelseries.BackgroundColor.ANTHRACITE,mud:steelseries.BackgroundColor.MUD,punchedSheet:steelseries.BackgroundColor.PUNCHED_SHEET,carbon:steelseries.BackgroundColor.CARBON,stainless:steelseries.BackgroundColor.STAINLESS,brushedMetal:steelseries.BackgroundColor.BRUSHED_METAL,brushedStainless:steelseries.BackgroundColor.BRUSHED_STAINLESS,turned:steelseries.BackgroundColor.TURNED},fd={blackMetal:steelseries.FrameDesign.BLACK_METAL,metal:steelseries.FrameDesign.METAL,shinyMetal:steelseries.FrameDesign.SHINY_METAL,brass:steelseries.FrameDesign.BRASS,steel:steelseries.FrameDesign.STEEL,chrome:steelseries.FrameDesign.CHROME,gold:steelseries.FrameDesign.GOLD,anthracite:steelseries.FrameDesign.ANTHRACITE,tiltedGray:steelseries.FrameDesign.TILTED_GRAY,tiltedBlack:steelseries.FrameDesign.TILTED_BLACK,glossyMetal:steelseries.FrameDesign.GLOSSY_METAL},$p=(()=>{class n{unitsService=y(at);canvasService=y(mt);canvasRef=pe("gaugeCanvas");widgetUUID=x(void 0);subType=x(void 0);barGauge=x(void 0);radialSize=x(void 0);backgroundColor=x(void 0);frameColor=x(void 0);minValue=x(void 0);maxValue=x(void 0);decimals=x(void 0);zones=x(void 0);title=x(void 0);units=x(void 0);value=x(void 0);theme=x(void 0,{alias:"themeColors"});gaugeStarted=!1;gauge;gaugeOptions={};paddingTop=0;lastSizeSignature="";resizeTimer=null;pendingStructuralRebuild=!1;ngOnInit(){this.buildOptions()}buildOptions(){this.gaugeOptions.minValue=this.minValue(),this.gaugeOptions.maxValue=this.maxValue();let e=this.decimals();this.gaugeOptions.lcdDecimals=e??2,this.gaugeOptions.titleString=this.title(),this.gaugeOptions.unitString=this.units(),this.subType()=="radial"&&(this.gaugeOptions.gaugeType=this.setGaugeType(this.radialSize()));let t=this.zones();if(t){let i=[],a=[],r=[...t].sort((s,l)=>s.lower-l.lower);for(let s of r){let l=null,m=null,f;switch(s.state){case Ae.Emergency:f=this.theme().zoneEmergency;break;case Ae.Alarm:f=this.theme().zoneAlarm;break;case Ae.Warn:f=this.theme().zoneWarn;break;case Ae.Alert:f=this.theme().zoneAlert;break;case Ae.Nominal:f=this.theme().zoneNominal;break;default:f="rgba(0,0,0,0)"}let b=this.units();if(b=="ratio"?(l=s.lower,m=s.upper):(l=this.unitsService.convertToUnit(b,s.lower),m=this.unitsService.convertToUnit(b,s.upper)),!(m<this.minValue()||l>this.maxValue())){if(l=l!==null?l:this.minValue(),m=m!==null?m:this.maxValue(),l=Math.max(l,this.minValue()),m>this.maxValue()){m=this.maxValue(),i.push(steelseries.Section(l,m,f));break}i.push(steelseries.Section(l,m,f))}}this.gaugeOptions.section=i,this.gaugeOptions.area=a,this.gaugeOptions.useSectionColors=!0}pd[this.backgroundColor()]&&(this.gaugeOptions.backgroundColor=pd[this.backgroundColor()]),fd[this.frameColor()]&&(this.gaugeOptions.frameDesign=fd[this.frameColor()]),this.barGauge()&&(this.gaugeOptions.valueColor=steelseries.ColorDef.GREEN),this.gaugeOptions.lcdVisible=!0,this.gaugeOptions.thresholdVisible=!1,this.gaugeOptions.threshold=this.maxValue(),this.gaugeOptions.ledVisible=!1}setGaugeType(e){switch(e){case"quarter":return steelseries.GaugeType.TYPE1;case"half":return steelseries.GaugeType.TYPE2;case"three-quarter":return steelseries.GaugeType.TYPE3;default:return steelseries.GaugeType.TYPE4}}startGauge(e=!1){this.buildOptions();let t=this.widgetUUID();if(!t)return;let i=e||this.pendingStructuralRebuild;if(this.gauge&&!i){this.gauge.setValueAnimated&&this.value()!=null,this.gaugeStarted=!0;return}this.pendingStructuralRebuild=!1,this.gaugeStarted=!0;let a=this.subType();a==="radial"?this.gauge=new steelseries.Radial(t,this.gaugeOptions):a==="linear"&&(this.barGauge()?this.gauge=new steelseries.LinearBargraph(t,this.gaugeOptions):this.gauge=new steelseries.Linear(t,this.gaugeOptions))}onResized(e){if(e.contentRect.height<50||e.contentRect.width<50)return;let t;if(this.subType()==="radial"){let i=Math.floor(Math.min(e.contentRect.height,e.contentRect.width));this.gaugeOptions.size=i,t="radial:"+i}else{let i=Math.floor(e.contentRect.width),a=Math.floor(e.contentRect.height);this.gaugeOptions.width=i,this.gaugeOptions.height=a,t=`linear:${i}x${a}`}t!==this.lastSizeSignature&&(this.lastSizeSignature=t,this.resizeTimer&&window.clearTimeout(this.resizeTimer),this.resizeTimer=window.setTimeout(()=>{this.startGauge(!0),this.resizeTimer=null},120))}ngOnChanges(e){this.gaugeStarted&&(e.value&&!e.value.firstChange&&this.gauge.setValueAnimated(e.value.currentValue),e.zones&&(this.pendingStructuralRebuild=!0,this.startGauge(!0)),e.title&&this.gauge.setTitleString(e.title.currentValue),e.backgroundColor&&this.gauge.setBackgroundColor(pd[e.backgroundColor.currentValue]),e.frameColor&&this.gauge.setFrameDesign(fd[e.frameColor.currentValue]),e.radialSize&&(this.pendingStructuralRebuild=!0,this.startGauge(!0)),e.minValue&&this.gauge.setMinValue(e.minValue.currentValue),e.maxValue&&this.gauge.setMaxValue(e.maxValue.currentValue))}ngOnDestroy(){if(this.gauge&&this.gauge.setValue){let t=this.gauge.getValue?this.gauge.getValue():this.value();this.gauge.setValue(t)}let e=this.widgetUUID();if(e){let t=document.getElementById(e);this.canvasService.releaseCanvas(t,{clear:!0,removeFromDom:!0})}this.gauge=null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["gauge-steel"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,IC,5),t&2&&ke()},inputs:{widgetUUID:[1,"widgetUUID"],subType:[1,"subType"],barGauge:[1,"barGauge"],radialSize:[1,"radialSize"],backgroundColor:[1,"backgroundColor"],frameColor:[1,"frameColor"],minValue:[1,"minValue"],maxValue:[1,"maxValue"],decimals:[1,"decimals"],zones:[1,"zones"],title:[1,"title"],units:[1,"units"],value:[1,"value"],theme:[1,"themeColors","theme"]},features:[Zi],decls:4,vars:2,consts:[["gaugeCanvas",""],["kipResizeObserver","",1,"wrapper",3,"resizeChange"],[2,"z-index","inherit",3,"id"]],template:function(t,i){t&1&&(d(0,"div",1),U("resizeChange",function(r){return i.onResized(r)}),d(1,"canvas",2,0),c(3," Browser does not support canvas element. "),u()()),t&2&&(g(),O("id",Li(i.widgetUUID())))},dependencies:[jt],styles:[".sgWrapper[_ngcontent-%COMP%]{height:100%;width:100%;text-align:center}"]})}return n})();var jp=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);streams=y(Le);metadata=y(ci);static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Gauge Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",isPathConfigurable:!0,showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,convertUnitTo:"unitless",sampleTime:500}},displayScale:{type:"linear",lower:0,upper:100},gauge:{type:"steel",subType:"radial",backgroundColor:"carbon",faceColor:"anthracite",radialSize:"full",rotateFace:!1,digitalMeter:!1},numDecimal:2,enableTimeout:!1,dataTimeout:5,ignoreZones:!1};dataValue=_(0);zones=_([]);displayName=K(()=>this.runtime.options()?.displayName||"Gauge Label");constructor(){L(()=>{let e=this.runtime.options();!e||!e.paths?.gaugePath?.path||B(()=>this.streams.observe("gaugePath",i=>{let a=i?.data?.value,r=e.displayScale?.lower??0,s=e.displayScale?.upper??r+100;if(a==null)this.dataValue.set(r);else{let l=Math.min(Math.max(a,r),s);this.dataValue.set(l)}}))}),L(()=>{let e=this.runtime.options();if(!e)return;if(e.ignoreZones){this.zones.set([]);return}if(!e.paths?.gaugePath?.path){this.zones.set([]);return}B(()=>this.metadata.observe("gaugePath")),this.zones.set(this.metadata.zones())})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-gauge-steel"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:14,consts:[[1,"wrapper"],[3,"widgetUUID","subType","barGauge","radialSize","backgroundColor","frameColor","minValue","maxValue","decimals","zones","title","units","value","themeColors"]],template:function(t,i){if(t&1&&(d(0,"div",0),F(1,"gauge-steel",1),u()),t&2){let a,r,s,l,m,f,b,A,C;g(),O("widgetUUID",i.id())("subType",(a=i.runtime.options())==null||a.gauge==null?null:a.gauge.subType)("barGauge",(r=i.runtime.options())==null||r.gauge==null?null:r.gauge.digitalMeter)("radialSize",(s=i.runtime.options())==null||s.gauge==null?null:s.gauge.radialSize)("backgroundColor",(l=i.runtime.options())==null||l.gauge==null?null:l.gauge.backgroundColor)("frameColor",(m=i.runtime.options())==null||m.gauge==null?null:m.gauge.faceColor)("minValue",(f=i.runtime.options())==null||f.displayScale==null?null:f.displayScale.lower)("maxValue",(b=i.runtime.options())==null||b.displayScale==null?null:b.displayScale.upper)("decimals",(A=i.runtime.options())==null?null:A.numDecimal)("zones",i.zones())("title",i.displayName())("units",(C=i.runtime.options())==null||C.paths==null||C.paths.gaugePath==null?null:C.paths.gaugePath.convertUnitTo)("value",i.dataValue())("themeColors",i.theme())}},dependencies:[$p],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}gauge-steel[_ngcontent-%COMP%]{display:block;position:relative;width:100%;height:100%} .wrapper{display:block;position:relative;width:100%;height:100%;padding:10px} .wrapper>canvas{display:block;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}"]})}return n})();var ta=jd(gd(),1),Xp=jd(gd(),1);var NC=["gauge"],RC=n=>n.replace(/(\-\w)/g,o=>o[1].toUpperCase()),OC=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Yp=n=>RC(n),Zp=(()=>{class n{el;zone;canvas;gauge;isInited=!1;preInitValue;preInitOptions;domListener;constructor(e,t){this.el=e,this.zone=t}get options(){let e={};e.renderTo=this.canvas.nativeElement;for(let t of this.el.nativeElement.attributes){let i=Yp(t.name);e[i]=ta.DomObserver.parse(t.value)}for(let t in this.preInitOptions)e[t]=this.preInitOptions[t];return this.isInited&&(this.preInitOptions=null),e}set options(e){if(!this.isInited){this.preInitOptions=e;return}this.update(e)}set value(e){if(!this.isInited){this.preInitValue=e;return}this.zone.runOutsideAngular(()=>{this.gauge.value=e})}update(e){if(e)for(let t in e){let i=e[t].toString();if(t==="value")this.value=ta.DomObserver.parse(i);else{let a=OC(t);this.el.nativeElement.setAttribute(a,i)}}}ngOnDestroy(){this.destroy(),this.cleanup()}cleanup(){}destroy(){this.stopListeningForDOMEvents(),this.gauge.destroy()}ngAfterViewInit(){this.initGauge(),this.listenForDOMEvents(),this.isInited=!0,this.preInitValue&&(this.value=this.preInitValue)}listenForDOMEvents(){this.domListener=new MutationObserver(e=>{let t={};e.forEach(i=>{i.type==="attributes"&&(t[Yp(i.attributeName)]=ta.DomObserver.parse(this.el.nativeElement.getAttribute(i.attributeName)))}),this.basicUpdate(t)}),this.domListener.observe(this.el.nativeElement,{attributes:!0})}stopListeningForDOMEvents(){this.domListener&&(this.domListener.disconnect(),this.domListener=null)}initGauge(){let e=this.options;(!e.hasOwnProperty("renderTo")||!e.renderTo)&&(e.renderTo=this.canvas.nativeElement),this.basicUpdate(e)}basicUpdate(e){typeof e.value=="number"&&(this.value=e.value,delete e.value),Object.keys(e).length&&this.gauge.update(e)}static \u0275fac=function(t){return new(t||n)(ma(Ke),ma(Be))};static \u0275dir=Ot({type:n,viewQuery:function(t,i){if(t&1&&En(NC,7),t&2){let a;yi(a=xi())&&(i.canvas=a.first)}},inputs:{options:"options",value:"value"}})}return n})();var Qp=(()=>{class n extends Zp{constructor(e,t){super(e,t)}ngOnInit(){this.gauge=new ta.LinearGauge(this.options).draw()}static \u0275fac=function(t){return new(t||n)(ma(Ke),ma(Be))};static \u0275cmp=q({type:n,selectors:[["linear-gauge"]],features:[Ro],decls:2,vars:0,consts:[["gauge",""]],template:function(t,i){t&1&&F(0,"canvas",null,0)},encapsulation:2})}return n})();var el=(()=>{class n extends Zp{constructor(e,t){super(e,t)}ngOnInit(){this.gauge=new ta.RadialGauge(this.options).draw()}static \u0275fac=function(t){return new(t||n)(ma(Ke),ma(Be))};static \u0275cmp=q({type:n,selectors:[["radial-gauge"]],features:[Ro],decls:2,vars:0,consts:[["gauge",""]],template:function(t,i){t&1&&F(0,"canvas",null,0)},encapsulation:2})}return n})(),vo=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Qi({type:n});static \u0275inj=Yi({})}return n})();function tl(n,o,e=!1){let t=[],i=o-n,a=0,r=10;i=Kp(o-n,!1),a=Kp(i/(r-1),!0);let s=Math.floor(n/a)*a,l=Math.ceil(o/a)*a;t.push(s);let m=i/a;for(let f=0;f<m;f++)if(t[f]<l){let b=(Number(t[f].toFixed(2))*100+Number(a.toFixed(2))*100)/100;t.push(b)}if(t[t.length-1]!==l&&t.push(l),e){let f=[...t].reverse();return{min:s,max:l,majorTicks:f}}return{min:s,max:l,majorTicks:t}}function Kp(n,o){let e=Math.floor(Math.log10(n)),t=n/Math.pow(10,e),i=null;return o?1.5>t?i=1:3>t?i=2:7>t?i=5:i=10:1>=t?i=1:2>=t?i=2:5>=t?i=5:i=10,i*Math.pow(10,e)}var Jp=["radialGauge"];function VC(n,o){if(n&1){let e=Se();d(0,"radial-gauge",2,0),U("resizeChange",function(i){ee(e);let a=k();return te(a.onResized(i))}),u()}if(n&2){let e=k();O("options",e.gaugeOptions)("value",e.value()),J("value-text",e.textValue())}}var ef=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);streams=y(Le);metadata=y(ci);unitsService=y(at);static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Gauge Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",suppressBootstrapNull:!0,isPathConfigurable:!0,showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,convertUnitTo:"unitless",sampleTime:500}},displayScale:{lower:0,upper:100,type:"linear"},gauge:{type:"ngRadial",subType:"measuring",highlightsWidth:5,scaleStart:180,barStartPosition:"left",enableTicks:!0,enableProgressbar:!0,enableNeedle:!0},numInt:1,numDecimal:0,enableTimeout:!1,color:"contrast",dataTimeout:5,ignoreZones:!1};LINE="line";ANIMATION_TARGET_NEEDLE="needle";ngGauge=pe("radialGauge");gauge=pe("radialGauge",{read:Ke});value=_(void 0);shouldRenderGauge=K(()=>this.value()!==void 0);textValue=_("--");colorStrokeTicks=_("");gaugeBootstrapped=_(!1);animationEnabled=K(()=>this.gaugeBootstrapped());adjustedScale=K(()=>{let e=this.runtime.options();return e?e.gauge?.subType==="capacity"?{min:e.displayScale?.lower??0,max:e.displayScale?.upper??100,majorTicks:[]}:tl(e.displayScale?.lower??0,e.displayScale?.upper??100,e.gauge?.barStartPosition==="right"):{min:0,max:100,majorTicks:[]}});highlights=K(()=>{let e=this.metadata.zones(),t=this.runtime.options(),i=this.theme();if(!e?.length)return[];if(!t||!i)return[];if(t.ignoreZones)return[];if(t.gauge?.subType!=="measuring")return[];let a=t.paths?.gaugePath,r=this.adjustedScale(),s=t.gauge?.barStartPosition==="right";return uo(e,i,a.convertUnitTo,this.unitsService,r.min,r.max,s)});displayName=K(()=>this.runtime.options()?.displayName);pathDataState=_(null);viewReady=_(!1);gaugeOptions={};constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||e.paths?.gaugePath.path&&B(()=>this.streams.observe("gaugePath",i=>{i.state!==this.pathDataState()&&this.pathDataState.set(i.state||null);let a=i?.data?.value??null;if(a==null)this.value.set(e.displayScale?.lower??0),this.textValue.set("--");else{let r=e.displayScale?.lower??0,s=e.displayScale?.upper??100,l=Math.min(Math.max(a,r),s);this.value.set(l),this.textValue()==="--"&&this.textValue.set("")}}))}),L(()=>{let e=this.runtime.options();!e||e.ignoreZones||B(()=>this.metadata.observe("gaugePath"))}),L(()=>{let e=this.highlights();this.viewReady()&&B(()=>{try{if(!e.length)this.ngGauge()?.update({highlights:[]});else{let t=JSON.stringify(e);this.ngGauge()?.update({highlights:t,highlightsWidth:this.runtime.options().gauge?.highlightsWidth})}}catch(t){}})}),L(()=>{let e=this.theme(),t=this.adjustedScale();B(()=>{if(this.buildGaugeOptions(this.runtime.options(),e,t),this.viewReady())try{this.ngGauge()?.update(this.gaugeOptions)}catch(i){}})}),L(()=>{let e=this.ngGauge();!e||this.gaugeBootstrapped()||B(()=>{try{requestAnimationFrame(()=>{this.gaugeBootstrapped.set(!0);try{e.update({animation:!0,animatedValue:!0})}catch(t){}})}catch(t){}})}),L(()=>{let e=this.pathDataState();this.viewReady()&&B(()=>{let t=this.runtime.options(),i=this.theme();if(t.ignoreZones)return;let a={};switch(e){case Ae.Alarm:a.colorBorderMiddle=i.cardColor,a.colorBarProgress=i.zoneAlarm,a.colorValueText=i.zoneAlarm;break;case Ae.Warn:a.colorBorderMiddle=i.cardColor,a.colorBarProgress=i.zoneWarn,a.colorValueText=i.zoneWarn;break;case Ae.Alert:a.colorBorderMiddle=i.cardColor,a.colorBarProgress=i.zoneAlert,a.colorValueText=i.zoneAlert;break;default:a.colorBorderMiddle=i.cardColor,a.colorBarProgress=t.gauge?.subType==="measuring"?Te(t.color,i).color:Te(t.color,i).dim,a.colorValueText=Te(t.color,i).color}try{this.ngGauge()?.update(a)}catch(r){}})})}ngAfterViewInit(){this.viewReady.set(!0),this.setCanvasSize();try{this.ngGauge()?.update(this.gaugeOptions)}catch(e){}}onResized(e){let t={height:e.contentRect.height,width:e.contentRect.width};try{this.ngGauge()?.update(t)}catch(i){}}setCanvasSize(){let e=this.gauge()?.nativeElement;if(!e)return;let t=e.getBoundingClientRect(),i={height:t.height,width:t.width};try{this.ngGauge()?.update(i)}catch(a){}}buildGaugeOptions(e,t,i){let a={};a.title=this.displayName(),a.minValue=i.min,a.maxValue=i.max,a.units=e.paths?.gaugePath?.convertUnitTo,a.highlights=[];let r=this.highlights();r.length&&(a.highlights=JSON.stringify(r),a.highlightsWidth=e.gauge?.highlightsWidth),a.fontTitle="Roboto",a.fontTitleWeight="bold",a.fontUnits="Roboto",a.fontUnitsSize=25,a.fontUnitsWeight="normal",a.barStrokeWidth=0,a.barShadow=0,a.colorBarStroke="",a.fontValue="Roboto",a.fontValueWeight="bold",a.valueTextShadow=!1,a.colorValueBoxShadow="",a.fontNumbers="Roboto",a.fontNumbersWeight="bold",a.valueInt=e.numInt??1,a.valueDec=e.numDecimal??2,a.majorTicksInt=a.valueInt,a.majorTicksDec=a.valueDec,a.highlightsWidth=e.gauge?.highlightsWidth,a.animation=this.animationEnabled(),a.animateOnInit=!1,a.animatedValue=this.animationEnabled(),a.animationRule="linear";let s=e.paths?.gaugePath?.sampleTime??500;a.animationDuration=s-25,a.colorBorderShadow=!1,a.colorBorderOuter=t.cardColor,a.colorBorderOuterEnd="",a.colorBorderMiddle=t.cardColor,a.colorBorderMiddleEnd="",a.colorPlate=a.colorPlateEnd=t.cardColor,a.colorBar=t.background,a.barProgress=e.gauge?.enableProgressbar,a.colorBarProgress=Te(e.color,t).color,a.colorNeedle=Te(e.color,t).color,a.colorNeedleEnd=Te(e.color,t).color,a.needleShadow=!0,a.colorNeedleShadowUp="black",a.colorNeedleShadowDown="black",a.colorNeedleCircleInner=a.colorPlate,a.colorNeedleCircleInnerEnd=a.colorPlate,a.colorNeedleCircleOuter=a.colorPlate,a.colorNeedleCircleOuterEnd=a.colorPlate,a.colorTitle=t.contrastDim,a.colorUnits=t.contrastDim,a.colorValueText=Te(e.color,t).color,this.colorStrokeTicks.set(t.contrastDim),a.colorMinorTicks=t.contrastDim,a.animationTarget=this.ANIMATION_TARGET_NEEDLE,a.useMinPath=!1,e.gauge?.subType==="capacity"?(a.fontTitleSize=40,a.valueBox=!0,a.fontValueSize=60,a.valueBoxWidth=10,a.valueBoxBorderRadius=5,a.valueBoxStroke=0,a.colorValueBoxBackground="",a.colorMajorTicks=a.colorPlate,a.colorNumbers=a.colorMinorTicks="",a.barWidth=20,a.colorBarProgress=Te(e.color,t).dim,a.needle=e.gauge.enableNeedle,a.needleType=this.LINE,a.needleWidth=2,a.needleStart=75,a.needleEnd=95,a.needleCircleSize=1,a.needleCircleInner=!1,a.needleCircleOuter=!1,a.ticksAngle=360,a.startAngle=e.gauge?.scaleStart||180,a.majorTicks=0,a.exactTicks=!0,a.strokeTicks=!1,a.minorTicks=0,a.numbersMargin=0,a.fontNumbersSize=0,a.borders=!0,a.borderOuterWidth=2,a.borderMiddleWidth=1,a.borderInnerWidth=0,a.borderShadowWidth=0):(a.fontTitleSize=24,a.barWidth=15,a.valueBox=!0,a.fontValueSize=60,a.valueBoxWidth=100,a.valueBoxBorderRadius=0,a.valueBoxStroke=0,a.colorValueBoxBackground="",a.needle=e.gauge.enableNeedle,a.needleType=this.LINE,a.needleWidth=2,a.needleStart=0,a.needleEnd=95,a.needleCircleSize=10,a.needleCircleInner=!1,a.needleCircleOuter=!1,a.ticksAngle=270,a.startAngle=45,a.barStartPosition=e.gauge?.barStartPosition||"left",e.gauge.enableTicks?(a.strokeTicks=!0,a.majorTicks=i.majorTicks,a.minorTicks=2,a.exactTicks=!1,a.numbersMargin=3,a.fontNumbersSize=15,a.colorMajorTicks=t.contrastDim,a.colorNumbers=t.contrastDim):(a.strokeTicks=!1,a.majorTicks=0,a.minorTicks=0,a.exactTicks=!0,a.numbersMargin=0,a.fontNumbersSize=0,a.colorMajorTicks=a.colorPlate,a.colorNumbers=a.colorMinorTicks=""),a.borders=!0,a.borderOuterWidth=2,a.borderMiddleWidth=1,a.borderInnerWidth=0,a.borderShadowWidth=0,a.animationTarget=this.ANIMATION_TARGET_NEEDLE,a.useMinPath=!1),this.gaugeOptions=a}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-gauge-ng-radial"]],viewQuery:function(t,i){t&1&&Me(i.ngGauge,Jp,5)(i.gauge,Jp,5,Ke),t&2&&ke(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:1,vars:1,consts:[["radialGauge",""],["kipResizeObserver","",3,"options","value"],["kipResizeObserver","",3,"resizeChange","options","value"]],template:function(t,i){t&1&&I(0,VC,2,3,"radial-gauge",1),t&2&&N(i.shouldRenderGauge()?0:-1)},dependencies:[jt,vo,el],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%} radial-gauge{display:block;position:relative;width:100%;min-width:8px;height:100%;overflow:clip} radial-gauge>canvas{display:block;position:absolute;height:100%;width:100%;left:50%;top:50%;transform:translate(-50%,-50%);padding:0}"]})}return n})();var tf=["linearGauge"];function LC(n,o){if(n&1){let e=Se();d(0,"linear-gauge",2,0),U("resizeChange",function(i){ee(e);let a=k();return te(a.onResized(i))}),u()}if(n&2){let e=k();O("options",e.gaugeOptions)("value",e.value()),J("value-text",e.textValue())}}var nf=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);streams=y(Le);metadata=y(ci);unitsService=y(at);static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Gauge Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",suppressBootstrapNull:!0,isPathConfigurable:!0,showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,convertUnitTo:"unitless",sampleTime:500}},displayScale:{lower:0,upper:100,type:"linear"},gauge:{type:"ngLinear",subType:"vertical",highlightsWidth:5,enableTicks:!0,enableNeedle:!1},numInt:1,numDecimal:0,color:"contrast",enableTimeout:!1,dataTimeout:5,ignoreZones:!1};ngGauge=pe("linearGauge");gauge=pe("linearGauge",{read:Ke});textValue=_("--");value=_(void 0);shouldRenderGauge=K(()=>this.value()!==void 0);gaugeOptions={};viewReady=_(!1);gaugeBootstrapped=_(!1);animationEnabled=K(()=>this.gaugeBootstrapped());currentState=_(Ae.Normal);adjustedScale=K(()=>{let e=this.runtime.options();return e?e.gauge?.enableTicks?tl(e.displayScale.lower,e.displayScale.upper):{min:e.displayScale.lower,max:e.displayScale.upper,majorTicks:[]}:{min:0,max:100,majorTicks:[]}});highlights=K(()=>{let e=this.metadata.zones(),t=this.runtime.options(),i=this.theme();return e?.length?!t||!i?[]:t.ignoreZones?[]:t.paths?.gaugePath?uo(e,i,t.paths.gaugePath.convertUnitTo,this.unitsService,this.adjustedScale().min,this.adjustedScale().max):[]:[]});displayName=K(()=>this.runtime.options()?.displayName||"Gauge Label");constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||e.paths?.gaugePath.path&&B(()=>this.streams.observe("gaugePath",i=>{let a=i?.data?.value??null;if(a==null)this.value.set(e.displayScale.lower),this.textValue.set("--");else{let r=Math.min(Math.max(a,e.displayScale.lower),e.displayScale.upper);this.value.set(r),this.textValue()==="--"&&this.textValue.set("")}i.state!==this.currentState()&&this.currentState.set(i.state)}))}),L(()=>{let e=this.runtime.options();!e||e.ignoreZones||B(()=>this.metadata.observe("gaugePath"))}),L(()=>{let e=this.highlights();this.viewReady()&&B(()=>{try{if(!e.length)this.ngGauge()?.update({highlights:[]});else{let t=JSON.stringify(e);this.ngGauge()?.update({highlights:t,highlightsWidth:this.runtime.options().gauge?.highlightsWidth})}}catch(t){}})}),L(()=>{let e=this.theme(),t=this.adjustedScale();B(()=>{if(this.buildGaugeOptions(this.runtime.options(),e,t),this.viewReady())try{this.ngGauge()?.update(this.gaugeOptions),this.applyInitialSize()}catch(i){}})}),L(()=>{let e=this.ngGauge();!e||this.gaugeBootstrapped()||B(()=>{try{requestAnimationFrame(()=>{this.gaugeBootstrapped.set(!0);try{e.update({animation:!0,animatedValue:!0})}catch(t){}})}catch(t){}})}),L(()=>{let e=this.currentState();this.viewReady()&&B(()=>{let t=this.runtime.options(),i=this.theme();if(t.ignoreZones)return;let a={},r=t.gauge?.enableNeedle,s=Te(t.color,i);switch(e){case Ae.Alarm:r?(a.colorNeedle=i.zoneAlarm,a.colorValueText=i.zoneAlarm):(a.colorBarProgress=i.zoneAlarm,a.colorValueText=i.zoneAlarm);break;case Ae.Warn:r?(a.colorNeedle=i.zoneWarn,a.colorValueText=i.zoneWarn):(a.colorBarProgress=i.zoneWarn,a.colorValueText=i.zoneWarn);break;case Ae.Alert:r?(a.colorNeedle=i.zoneAlert,a.colorValueText=i.zoneAlert):(a.colorBarProgress=i.zoneAlert,a.colorValueText=i.zoneAlert);break;default:r?(a.colorNeedle=s.color,a.colorValueText=s.color):(a.colorBarProgress=s.color,a.colorValueText=s.color)}try{this.ngGauge()?.update(a)}catch(l){}})})}buildGaugeOptions(e,t,i){let a=this.gaugeOptions={},r=e.gauge?.subType==="vertical",s=e.gauge?.enableNeedle,l=e.gauge?.enableTicks;a.minValue=i.min,a.maxValue=i.max,a.valueInt=e.numInt??1,a.valueDec=e.numDecimal??2,a.title=this.displayName(),a.fontTitleSize=40,a.fontTitle="Roboto",a.fontTitleWeight="bold",a.barLength=r?80:90,a.barWidth=l?s?0:30:60,a.barProgress=!0,a.barBeginCircle=0,a.barStrokeWidth=0,a.barShadow=0,a.needle=!!s,a.needleType=s?"arrow":"line",a.needleStart=s?r?200:155:-45,a.needleEnd=s?r?175:180:55,a.needleShadow=!0,a.needleSide="both",a.units=e.paths?.gaugePath?.convertUnitTo,a.fontUnits="Roboto",a.fontUnitsWeight="normal",a.borders=!1,a.borderOuterWidth=0,a.borderMiddleWidth=0,a.borderInnerWidth=0,a.borderShadowWidth=0,a.borderRadius=0,a.valueBox=!0,a.valueBoxWidth=35,a.valueBoxStroke=0,a.valueBoxBorderRadius=10,a.colorValueBoxRect="",a.colorValueBoxRectEnd="",a.colorValueBoxShadow="",a.fontValueSize=50,a.fontValue="Roboto",a.fontValueWeight="bold",a.valueTextShadow=!1,a.fontNumbers="Roboto",a.fontNumbersWeight="normal",a.fontUnitsSize=r?40:35,a.colorTitle=Te("contrast",t).dim,a.colorUnits=Te("contrast",t).dim,a.colorValueBoxBackground=t.background;let m=Te(e.color,t);a.colorValueText=m.color,s?(a.colorNeedle=m.color,a.colorNeedleEnd=m.color,a.needleWidth=45,a.colorNeedleShadowUp=m.color,a.colorNeedleShadowDown=m.color):(a.colorBarProgress=m.color,a.colorBarProgressEnd="",a.needleWidth=0),a.colorPlate=t.cardColor,a.colorBar=t.background,a.colorBarEnd="",a.colorBarStroke="0",a.colorMajorTicks=Te("contrast",t).dim,a.colorMinorTicks=Te("contrast",t).dim,a.colorNumbers=Te("contrast",t).dim,a.majorTicks=l?i.majorTicks:[],a.majorTicksInt=e.numInt??1,a.majorTicksDec=e.numDecimal??2,a.strokeTicks=!!l,a.minorTicks=l?2:0,a.ticksWidthMinor=l?6:0,a.numberSide=s?"right":"left",a.fontNumbersSize=l?r?22:30:0,a.numbersMargin=r?s?-7:-3:s?-33:-5,a.ticksWidth=l?s&&r?15:10:0,a.ticksPadding=l?r?s?0:5:s?9:8:0,a.tickSide="left",a.animation=this.animationEnabled(),a.animationRule="linear",a.animatedValue=this.animationEnabled(),a.animateOnInit=!1,a.animationDuration=(e.paths?.gaugePath?.sampleTime??500)-25,a.highlights=[],a.highlightsWidth=e.gauge?.highlightsWidth;let f=this.highlights();f.length&&(a.highlights=JSON.stringify(f))}ngAfterViewInit(){this.viewReady.set(!0),this.applyInitialSize();try{this.ngGauge()?.update(this.gaugeOptions)}catch(e){}}applyInitialSize(){let e=this.gauge()?.nativeElement;if(!e)return;let t=e.getBoundingClientRect(),i=.3,a,r;this.runtime.options()?.gauge?.subType==="vertical"?(a=t.height,r=t.height*i):(r=t.width,a=t.width*i);let m={height:a,width:r};try{this.ngGauge()?.update(m)}catch(f){}}onResized(e){let t=this.runtime.options();if(!t)return;let i=.3,a=t.gauge?.subType==="vertical",r={};a?(r.height=e.contentRect.height,r.width=r.height*i,r.width>e.contentRect.width&&(r.width=e.contentRect.width,r.height=r.width/i)):(r.width=e.contentRect.width,r.height=r.width*i,r.height>e.contentRect.height&&(r.height=e.contentRect.height,r.width=r.height/i)),r.height=(r.height??0)-10;try{this.ngGauge()?.update(r)}catch(s){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-gauge-ng-linear"]],viewQuery:function(t,i){t&1&&Me(i.ngGauge,tf,5)(i.gauge,tf,5,Ke),t&2&&ke(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:1,vars:1,consts:[["linearGauge",""],["kipResizeObserver","",1,"linearGauge",3,"options","value"],["kipResizeObserver","",1,"linearGauge",3,"resizeChange","options","value"]],template:function(t,i){t&1&&I(0,LC,2,3,"linear-gauge",1),t&2&&N(i.shouldRenderGauge()?0:-1)},dependencies:[jt,vo,Qp],styles:["[_nghost-%COMP%]{width:100%;height:100%;display:block} linear-gauge{display:block;position:relative;width:100%;min-width:8px;height:100%;overflow:clip} linear-gauge>canvas{display:block;position:absolute;height:100%;width:100%;left:50%;top:50%;transform:translate(-50%,-50%);margin-top:5px}"]})}return n})();var af=["compassGauge"];function WC(n,o){if(n&1){let e=Se();d(0,"radial-gauge",2,0),U("resizeChange",function(i){ee(e);let a=k();return te(a.onResized(i))}),u()}if(n&2){let e=k();O("options",e.gaugeOptions)("value",e.value()),J("value-text",e.textValue())("color-stroke-ticks",e.colorStrokeTicks)}}function of(n){let o=n.match(/(\d+(\.\d+)?|\.\d+)/g);if(!o||o.length<3)throw new Error("Invalid RGBA format");let[e,t,i,a=1]=o.map(Number),r=a===1?"":Math.round(a*255).toString(16).padStart(2,"0").toUpperCase();return"#"+((1<<24)+(e<<16)+(t<<8)+i).toString(16).slice(1).toUpperCase()+r}function FC(n){return n<0&&(n=360+n),n}var rf=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);streams=y(Le);static DEFAULT_CONFIG={displayName:"Gauge Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",suppressBootstrapNull:!0,isPathConfigurable:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",showConvertUnitTo:!1,convertUnitTo:"deg",sampleTime:500}},supportAutomaticHistoricalSeries:!0,gauge:{type:"ngRadial",subType:"baseplateCompass",enableTicks:!0,compassUseNumbers:!1,showValueBox:!1},enableTimeout:!1,color:"contrast",dataTimeout:5};LINE="line";NEEDLE_START=40;NEEDLE_END=100;NEEDLE_CIRCLE_SIZE=15;BORDER_MIDDLE_WIDTH=2;BORDER_INNER_WIDTH=2;ANIMATION_TARGET_PLATE="plate";ANIMATION_TARGET_NEEDLE="needle";textValue=_("--");value=_(void 0);shouldRenderGauge=K(()=>this.value()!==void 0);gaugeBootstrapped=_(!1);animationEnabled=K(()=>this.gaugeBootstrapped());ngGauge=pe("compassGauge");gauge=pe("compassGauge",{read:Ke});viewReady=_(!1);gaugeOptions={};colorStrokeTicks="";currentState=_(Ae.Normal);lastAppliedState=null;negToPortPaths=["self.environment.wind.angleApparent","self.environment.wind.angleTrueGround","self.environment.wind.angleTrueWater","self.environment.wind.angleTrueWaterDamped","self.performance.beatAngle","self.performance.gybeAngle","self.performance.targetAngle","self.performance.optimumWindAngle"];displayName=K(()=>this.runtime.options()?.displayName);constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();if(!e||!t)return;let i=e.paths?.gaugePath;i?.path&&B(()=>this.streams.observe("gaugePath",a=>{let r=a?.data?.value??null;if(r==null)this.value.set(0),this.textValue.set("--");else{this.negToPortPaths.includes(i.path)&&(r=FC(r));let l=Math.min(Math.max(r,0),360);this.value.set(l),this.textValue.set(l.toFixed(0))}let s=a?.state??Ae.Normal;s!==this.currentState()&&this.currentState.set(s)}))}),L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||B(()=>{if(this.buildGaugeOptions(e,t),this.viewReady())try{this.ngGauge()?.update(this.gaugeOptions)}catch(i){}})}),L(()=>{let e=this.ngGauge();!e||this.gaugeBootstrapped()||B(()=>{try{requestAnimationFrame(()=>{this.gaugeBootstrapped.set(!0);try{e.update({animation:!0,animatedValue:!0})}catch(t){}})}catch(t){}})}),L(()=>{let e=this.runtime.options(),t=this.theme(),i=this.currentState();!e||!t||this.viewReady()&&i!==this.lastAppliedState&&B(()=>{let a={};switch(i){case Ae.Emergency:a.colorValueText=t.zoneEmergency;break;case Ae.Alarm:a.colorValueText=t.zoneAlarm;break;case Ae.Warn:a.colorValueText=t.zoneWarn;break;case Ae.Alert:a.colorValueText=t.zoneAlert;break;default:a.colorValueText=t.contrast;break}try{this.ngGauge()?.update(a)}catch(r){}this.lastAppliedState=i})})}buildGaugeOptions(e,t){let i=this.gaugeOptions={};i.title=this.displayName(),i.minValue=0,i.maxValue=360,i.units=e.paths?.gaugePath?.convertUnitTo||"",i.valueDec=e.numDecimal??0,i.valueInt=e.numInt??1,i.barProgress=!1,i.barWidth=0,i.valueBox=!!e.gauge?.showValueBox,i.fontValueSize=60,i.valueBoxWidth=30,i.valueBoxBorderRadius=10,i.valueBoxStroke=0,i.ticksAngle=360,i.startAngle=180,i.exactTicks=!1,i.strokeTicks="",i.majorTicks=e.gauge?.compassUseNumbers?["N","30","60","E","120","150","S","210","240","W","300","330","N"]:["N","NE","E","SE","S","SW","W","NW","N"],i.majorTicksDec=0,i.majorTicksInt=1,i.numbersMargin=5,i.fontNumbersSize=25,i.minorTicks=e.gauge?.compassUseNumbers?3:2,i.needle=!0,i.needleType=this.LINE,i.needleStart=this.NEEDLE_START,i.needleEnd=this.NEEDLE_END,i.needleCircleSize=this.NEEDLE_CIRCLE_SIZE,i.needleWidth=4,i.needleShadow=!1,i.needleCircleInner=!1,i.needleCircleOuter=!1,i.borders=!0,i.borderOuterWidth=0,i.borderMiddleWidth=this.BORDER_MIDDLE_WIDTH,i.borderInnerWidth=this.BORDER_INNER_WIDTH,i.borderShadowWidth=0,i.highlights=[],i.highlightsWidth=0,i.fontTitle="Roboto",i.fontTitleWeight="normal",i.fontTitleSize=25,i.fontUnits="Roboto",i.fontUnitsSize=25,i.fontUnitsWeight="normal",i.barStrokeWidth=0,i.barShadow=0,i.fontValue="Roboto",i.fontValueWeight="bold",i.valueTextShadow=!1,i.colorValueBoxShadow="",i.fontNumbers="Roboto",i.fontNumbersWeight="bold",e.gauge?.subType==="marineCompass"?(i.animationTarget=this.ANIMATION_TARGET_PLATE,i.useMinPath=!0):(i.animationTarget=this.ANIMATION_TARGET_NEEDLE,i.useMinPath=!0),i.animateOnInit=!1,i.animation=this.animationEnabled(),i.animatedValue=this.animationEnabled(),i.animationRule="linear",i.animationDuration=(e.paths?.gaugePath?.sampleTime??500)-50;let a=Te(e.color,t),r=of(a.dim),s=of(Te("contrast",t).dim);i.colorBarProgress=a.color,i.colorBorderMiddle=r,i.colorBorderMiddleEnd=r,i.colorNeedle=a.color,i.colorNeedleEnd=a.color,i.colorTitle=s,i.colorUnits=s,i.colorValueText=a.color,i.colorMinorTicks=s,i.colorNumbers=e.gauge?.compassUseNumbers?[t.port,s,s,r,s,s,r,s,s,r,s,s,t.port]:[t.port,r,r,r,r,r,r,r,t.port],i.colorMajorTicks=e.gauge?.compassUseNumbers?[t.port,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.port]:[t.port,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.port],i.colorPlate=i.colorPlateEnd=i.colorBorderInner=i.colorBorderInnerEnd=t.cardColor,i.colorBar=t.background,i.colorBarStroke="",i.colorValueBoxBackground=t.background,i.colorNeedleShadowUp="",i.colorNeedleShadowDown="",i.colorNeedleCircleInner=i.colorPlate,i.colorNeedleCircleInnerEnd=i.colorPlate,i.colorNeedleCircleOuter=i.colorPlate,i.colorNeedleCircleOuterEnd=i.colorPlate}setCanvasSize(){let e=this.gauge()?.nativeElement;if(!e)return;let t=e.getBoundingClientRect(),i={height:t.height,width:t.width};try{this.ngGauge()?.update(i)}catch(a){}}ngAfterViewInit(){this.viewReady.set(!0),this.setCanvasSize();try{this.ngGauge()?.update(this.gaugeOptions)}catch(e){}}onResized(e){let t={height:e.contentRect.height,width:e.contentRect.width};try{this.ngGauge()?.update(t)}catch(i){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-gauge-ng-compass"]],viewQuery:function(t,i){t&1&&Me(i.ngGauge,af,5)(i.gauge,af,5,Ke),t&2&&ke(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:1,vars:1,consts:[["compassGauge",""],["kipResizeObserver","",3,"options","value"],["kipResizeObserver","",3,"resizeChange","options","value"]],template:function(t,i){t&1&&I(0,WC,2,4,"radial-gauge",1),t&2&&N(i.shouldRenderGauge()?0:-1)},dependencies:[jt,vo,el],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%} radial-gauge{display:block;position:relative;width:100%;min-width:8px;height:100%;overflow:clip} radial-gauge>canvas{display:block;position:absolute;height:100%;width:100%;left:50%;top:50%;transform:translate(-50%,-50%);padding:10px}"]})}return n})();var GC=["plainIframe"],sf=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);_dashboard=y(ft);_sanitizer=y(qa);settings=y(Vt);static DEFAULT_CONFIG={};iframe=pe.required("plainIframe");widgetUrl=null;displayTransparentOverlay=_("block");constructor(){let e=new URL("/signalk-anchoralarm-plugin/",window.location.origin);this.widgetUrl=this.toSafeResourceUrl(e),L(()=>{let t=this.runtime.options(),i=this._dashboard.isDashboardStatic();t&&B(()=>{i?this.displayTransparentOverlay.set("none"):this.displayTransparentOverlay.set("block")})}),window.addEventListener("message",this.handleIframeGesture)}toSafeResourceUrl(e){return e.origin!==window.location.origin||!e.pathname.startsWith("/signalk-anchoralarm-plugin/")?null:this._sanitizer.bypassSecurityTrustResourceUrl(e.toString())}ngAfterViewInit(){if(this.iframe()){this.iframe().nativeElement.onload=()=>this.injectSwipeScript();try{let e=this.iframe().nativeElement.contentDocument;e&&(e.readyState==="complete"||e.readyState==="interactive")&&this.injectSwipeScript()}catch(e){}}}handleIframeGesture=e=>{if(!e.data)return;let t=e.data?.eventData?.instanceId||e.data?.keyEventData?.instanceId;if(!(!t||t!==this.id())){if(e.data.gesture)switch(e.data.gesture){case"swipeup":this._dashboard.navigateToPreviousDashboard();break;case"swipedown":this._dashboard.navigateToNextDashboard();break;case"swipeleft":{let i=new Event("openLeftSidenav",{bubbles:!0,cancelable:!0});window.document.dispatchEvent(i);break}case"swiperight":{let i=new Event("openRightSidenav",{bubbles:!0,cancelable:!0});window.document.dispatchEvent(i);break}default:break}if(e.data.type==="keydown"&&e.data.keyEventData){let{key:i,ctrlKey:a,shiftKey:r}=e.data.keyEventData,s=new KeyboardEvent("keydown",{key:i,ctrlKey:a,shiftKey:r,bubbles:!0,cancelable:!0});document.dispatchEvent(s)}}};injectSwipeScript(){let e=this.iframe().nativeElement.contentWindow,t=this.iframe().nativeElement.contentDocument;if(!t||!e){console.error("[WidgetIframe] Iframe contentDocument or contentWindow is undefined. Possible cross-origin issue or iframe not fully loaded.");return}try{let i=`kip-gesture-inject-${this.id()}`;if(t.getElementById(i))return;let a=ao({instanceId:this.id()}),r=t.createElement("script");r.id=i,r.textContent=a,t.body.appendChild(r)}catch(i){console.warn("[WidgetIframe] Failed to inject swipe script into iframe:",i)}}ngOnDestroy(){window.removeEventListener("message",this.handleIframeGesture),this.iframe()&&(this.iframe().nativeElement.onload=null);try{let e=this.iframe()?.nativeElement.contentDocument;if(e){let t=`kip-gesture-inject-${this.id()}`,i=e.getElementById(t);i&&i.parentNode&&i.parentNode.removeChild(i)}}catch(e){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-anchor-alarm"]],viewQuery:function(t,i){t&1&&Me(i.iframe,GC,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:3,vars:3,consts:[["plainIframe",""],["width","100%","height","100%","frameborder","0",1,"widgetIframe",3,"src"],[1,"widgetOverlay"]],template:function(t,i){t&1&&Q(0,"iframe",1,0)(2,"div",2),t&2&&(Vi("src",i.widgetUrl,ua),g(2),be("display",i.displayTransparentOverlay()))},styles:["[_nghost-%COMP%]{overflow:hidden}.widgetIframe[_ngcontent-%COMP%]{background-color:#fff;border-radius:var(--mat-card-elevated-container-shape, var(--mat-sys-corner-medium))}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent}"]})}return n})();var BC=["canvasMainRef"],lf=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);streams=y(Le);static DEFAULT_CONFIG={displayName:"Time Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Date / Time",path:null,source:null,pathType:"Date",isPathConfigurable:!0,sampleTime:1e3}},dateFormat:"dd/MM/yyyy HH:mm:ss",dateTimezone:"Atlantic/Azores",color:"contrast",enableTimeout:!1,dataTimeout:5};canvasMainRef=pe.required("canvasMainRef");canvasElement;canvasCtx;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;canvas=y(mt);cssWidth=0;cssHeight=0;dataValue=_(null);_timeZoneGTM="";isDestroyed=!1;labelColor=_(void 0);valueColor=void 0;maxTextWidth=0;maxTextHeight=0;displayName=K(()=>this.runtime.options()?.displayName);dateFormat=K(()=>this.runtime.options()?.dateFormat);dateTimezone=K(()=>this.runtime.options()?.dateTimezone);constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||B(()=>{this.applyColors(),e.paths?.gaugePath?.path&&(this._timeZoneGTM=this.getGMTOffset(this.dateTimezone()),this.streams.observe("gaugePath",a=>{this.dataValue.set(a?.data?.value??null),this.drawWidget()}))})}),L(()=>{let e=this.theme(),t=this.runtime.options();!e||!t||B(()=>{this.applyColors(),this.drawWidget()})})}ngAfterViewInit(){this.canvasElement=this.canvasMainRef().nativeElement,this.canvasCtx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.maxTextWidth=Math.floor(this.cssWidth*.85),this.maxTextHeight=Math.floor(this.cssHeight*.7),this.drawWidget()}}),!this.isDestroyed&&(this.cssHeight=Math.floor(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.floor(this.canvasElement.getBoundingClientRect().width),this.maxTextWidth=Math.floor(this.canvasElement.width*.85),this.maxTextHeight=Math.floor(this.canvasElement.height*.7),this.applyColors(),this.drawWidget())}getGMTOffset(e){try{if(e==="System Timezone -")return"";let a=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"short"}).formatToParts(new Date).find(r=>r.type==="timeZoneName");return a?a.value:"GMT"}catch(t){return console.error(`Error getting GMT offset for timezone "${e}":`,t),"GMT"}}applyColors(){let e=this.runtime.options(),t=this.theme();!e||!t||(this.labelColor.set(Te(e.color,t).dim),this.valueColor=Te(e.color,t).color)}ngOnDestroy(){this.isDestroyed=!0;try{this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}drawWidget(){if(!this.canvasCtx)return;let e=this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==`${this.displayName()}-${this.runtime.options().color}`||this.titleBitmapColor!==e)&&(this.titleBitmap=this.canvas.createTitleBitmap(this.displayName(),e,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=`${this.displayName()}-${this.runtime.options().color}`,this.titleBitmapColor=e),this.canvas.clearCanvas(this.canvasCtx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.titleBitmap.width>0&&this.titleBitmap.height>0&&this.canvasCtx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight);let t,i=this.dataValue();if(!i||isNaN(Date.parse(i)))t="--";else try{t=vc(i,this.dateFormat(),"en-US",this._timeZoneGTM)}catch(a){t=a,console.log("[Date Time Widget]: "+a)}this.canvas.drawText(this.canvasCtx,t,Math.floor(this.cssWidth/2),Math.floor(this.cssHeight/2*1.15),this.maxTextWidth,this.maxTextHeight,"bold",this.valueColor)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-datetime"]],viewQuery:function(t,i){t&1&&Me(i.canvasMainRef,BC,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["canvasMainRef",""],[1,"date-canvas"]],template:function(t,i){t&1&&Q(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.date-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;min-height:1px;display:block}"]})}return n})();var df={modes:{point(n,o){return il(n,o,{intersect:!0})},nearest(n,o,e){return HC(n,o,e)},x(n,o,e){return il(n,o,{intersect:e.intersect,axis:"x"})},y(n,o,e){return il(n,o,{intersect:e.intersect,axis:"y"})}}};function Md(n,o,e){return(df.modes[e.mode]||df.modes.nearest)(n,o,e)}function zC(n,o,e){return e!=="x"&&e!=="y"?n.inRange(o.x,o.y,"x",!0)||n.inRange(o.x,o.y,"y",!0):n.inRange(o.x,o.y,e,!0)}function UC(n,o,e){return e==="x"?{x:n.x,y:o.y}:e==="y"?{x:o.x,y:n.y}:o}function il(n,o,e){return n.filter(t=>e.intersect?t.inRange(o.x,o.y):zC(t,o,e.axis))}function HC(n,o,e){let t=Number.POSITIVE_INFINITY;return il(n,o,e).reduce((i,a)=>{let r=a.getCenterPoint(),s=UC(o,r,e.axis),l=Fo(o,s);return l<t?(i=[a],t=l):l===t&&i.push(a),i},[]).sort((i,a)=>i._index-a._index).slice(0,1)}function Na(n,o,e){let t=Math.cos(e),i=Math.sin(e),a=o.x,r=o.y;return{x:a+t*(n.x-a)-i*(n.y-r),y:r+i*(n.x-a)+t*(n.y-r)}}var qC=(n,o)=>o>n||n.length>o.length&&n.slice(0,o.length)===o,Ea=.001,al=(n,o,e)=>Math.min(e,Math.max(o,n)),Ef=(n,o)=>n.value>=n.start-o&&n.value<=n.end+o;function $C(n,o,e){for(let t of Object.keys(n))n[t]=al(n[t],o,e);return n}function jC(n,o,e,t){return!n||!o||e<=0?!1:Math.pow(n.x-o.x,2)+Math.pow(n.y-o.y,2)<=Math.pow(e+t,2)}function Df(n,{x:o,y:e,x2:t,y2:i},a,{borderWidth:r,hitTolerance:s}){let l=(r+s)/2,m=n.x>=o-l-Ea&&n.x<=t+l+Ea,f=n.y>=e-l-Ea&&n.y<=i+l+Ea;return a==="x"?m:(a==="y"||m)&&f}function Pf(n,{rect:o,center:e},t,{rotation:i,borderWidth:a,hitTolerance:r}){let s=Na(n,e,Bi(-i));return Df(s,o,t,{borderWidth:a,hitTolerance:r})}function Ra(n,o){let{centerX:e,centerY:t}=n.getProps(["centerX","centerY"],o);return{x:e,y:t}}function YC(n,o,e,t=!0){let i=e.split("."),a=0;for(let r of o.split(".")){let s=i[a++];if(parseInt(r,10)<parseInt(s,10))break;if(qC(s,r)){if(t)throw new Error(`${n} v${e} is not supported. v${o} or newer is required.`);return!1}}return!0}var If=n=>typeof n=="string"&&n.endsWith("%"),Nf=n=>parseFloat(n)/100,Rf=n=>al(Nf(n),0,1),hr=(n,o)=>({x:n,y:o,x2:n,y2:o,width:0,height:0}),ZC={box:n=>hr(n.centerX,n.centerY),doughnutLabel:n=>hr(n.centerX,n.centerY),ellipse:n=>({centerX:n.centerX,centerY:n.centerX,radius:0,width:0,height:0}),label:n=>hr(n.centerX,n.centerY),line:n=>hr(n.x,n.y),point:n=>({centerX:n.centerX,centerY:n.centerY,radius:0,width:0,height:0}),polygon:n=>hr(n.centerX,n.centerY)};function kd(n,o){return o==="start"?0:o==="end"?n:If(o)?Rf(o)*n:n/2}function aa(n,o,e=!0){return typeof o=="number"?o:If(o)?(e?Rf(o):Nf(o))*n:n}function QC(n,o){let{x:e,width:t}=n,i=o.textAlign;return i==="center"?e+t/2:i==="end"||i==="right"?e+t:e}function Of(n,o,{borderWidth:e,position:t,xAdjust:i,yAdjust:a},r){let s=Bn(r),l=o.width+(s?r.width:0)+e,m=o.height+(s?r.height:0)+e,f=Td(t),b=cf(n.x,l,i,f.x),A=cf(n.y,m,a,f.y);return{x:b,y:A,x2:b+l,y2:A+m,width:l,height:m,centerX:b+l/2,centerY:A+m/2}}function Td(n,o="center"){return Bn(n)?{x:bn(n.x,o),y:bn(n.y,o)}:(n=bn(n,o),{x:n,y:n})}var Vf=(n,o)=>n&&n.autoFit&&o<1;function Lf(n,o){let e=n.font,t=Fi(e)?e:[e];return Vf(n,o)?t.map(function(i){let a=zo(i);return a.size=Math.floor(i.size*o),a.lineHeight=i.lineHeight,zo(a)}):t.map(i=>zo(i))}function Wf(n){return n&&(Gi(n.xValue)||Gi(n.yValue))}function cf(n,o,e=0,t){return n-kd(o,t)+e}function Co(n,o,e){let t=e.init;if(t){if(t===!0)return Gf(o,e)}else return;return XC(n,o,e)}function Ff(n,o,e){let t=!1;return o.forEach(i=>{zn(n[i])?(t=!0,e[i]=n[i]):Gi(e[i])&&delete e[i]}),t}function Gf(n,o){let e=o.type||"line";return ZC[e](n)}function XC(n,o,e){let t=rn(e.init,[{chart:n,properties:o,options:e}]);if(t===!0)return Gf(o,e);if(Bn(t))return t}var bd=new Map,KC=n=>isNaN(n)||n<=0,JC=n=>n.reduce(function(o,e){return o+=e.string,o},"");function ol(n){if(n&&typeof n=="object"){let o=n.toString();return o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]"}}function rl(n,{x:o,y:e},t){t&&(n.translate(o,e),n.rotate(Bi(t)),n.translate(-o,-e))}function wn(n,o){if(o&&o.borderWidth)return n.lineCap=o.borderCapStyle||"butt",n.setLineDash(o.borderDash),n.lineDashOffset=o.borderDashOffset,n.lineJoin=o.borderJoinStyle||"miter",n.lineWidth=o.borderWidth,n.strokeStyle=o.borderColor,!0}function So(n,o){n.shadowColor=o.backgroundShadowColor,n.shadowBlur=o.shadowBlur,n.shadowOffsetX=o.shadowOffsetX,n.shadowOffsetY=o.shadowOffsetY}function sl(n,o){let e=o.content;if(ol(e))return{width:aa(e.width,o.width),height:aa(e.height,o.height)};let t=Lf(o),i=o.textStrokeWidth,a=Fi(e)?e:[e],r=a.join()+JC(t)+i+(n._measureText?"-spriting":"");return bd.has(r)||bd.set(r,nS(n,a,t,i)),bd.get(r)}function Bf(n,o,e){let{x:t,y:i,width:a,height:r}=o;n.save(),So(n,e);let s=wn(n,e);n.fillStyle=e.backgroundColor,n.beginPath(),_l(n,{x:t,y:i,w:a,h:r,radius:$C(Ml(e.borderRadius),0,Math.min(a,r)/2)}),n.closePath(),n.fill(),s&&(n.shadowColor=e.borderShadowColor,n.stroke()),n.restore()}function zf(n,o,e,t){let i=e.content;if(ol(i)){n.save(),n.globalAlpha=rS(e.opacity,i.style.opacity),n.drawImage(i,o.x,o.y,o.width,o.height),n.restore();return}let a=Fi(i)?i:[i],r=Lf(e,t),s=e.color,l=Fi(s)?s:[s],m=QC(o,e),f=o.y+e.textStrokeWidth/2;n.save(),n.textBaseline="middle",n.textAlign=e.textAlign,eS(n,e)&&aS(n,{x:m,y:f},a,r),oS(n,{x:m,y:f},a,{fonts:r,colors:l}),n.restore()}function eS(n,o){if(o.textStrokeWidth>0)return n.lineJoin="round",n.miterLimit=2,n.lineWidth=o.textStrokeWidth,n.strokeStyle=o.textStrokeColor,!0}function tS(n,o,e,t){let{radius:i,options:a}=o,r=a.pointStyle,s=a.rotation,l=(s||0)*is;if(ol(r)){n.save(),n.translate(e,t),n.rotate(l),n.drawImage(r,-r.width/2,-r.height/2,r.width,r.height),n.restore();return}KC(i)||iS(n,{x:e,y:t,radius:i,rotation:s,style:r,rad:l})}function iS(n,{x:o,y:e,radius:t,rotation:i,style:a,rad:r}){let s,l,m,f;switch(n.beginPath(),a){default:n.arc(o,e,t,0,ts),n.closePath();break;case"triangle":n.moveTo(o+Math.sin(r)*t,e-Math.cos(r)*t),r+=ns,n.lineTo(o+Math.sin(r)*t,e-Math.cos(r)*t),r+=ns,n.lineTo(o+Math.sin(r)*t,e-Math.cos(r)*t),n.closePath();break;case"rectRounded":f=t*.516,m=t-f,s=Math.cos(r+va)*m,l=Math.sin(r+va)*m,n.arc(o-s,e-l,f,r-hi,r-Za),n.arc(o+l,e-s,f,r-Za,r),n.arc(o+s,e+l,f,r,r+Za),n.arc(o-l,e+s,f,r+Za,r+hi),n.closePath();break;case"rect":if(!i){m=Math.SQRT1_2*t,n.rect(o-m,e-m,2*m,2*m);break}r+=va;case"rectRot":s=Math.cos(r)*t,l=Math.sin(r)*t,n.moveTo(o-s,e-l),n.lineTo(o+l,e-s),n.lineTo(o+s,e+l),n.lineTo(o-l,e+s),n.closePath();break;case"crossRot":r+=va;case"cross":s=Math.cos(r)*t,l=Math.sin(r)*t,n.moveTo(o-s,e-l),n.lineTo(o+s,e+l),n.moveTo(o+l,e-s),n.lineTo(o-l,e+s);break;case"star":s=Math.cos(r)*t,l=Math.sin(r)*t,n.moveTo(o-s,e-l),n.lineTo(o+s,e+l),n.moveTo(o+l,e-s),n.lineTo(o-l,e+s),r+=va,s=Math.cos(r)*t,l=Math.sin(r)*t,n.moveTo(o-s,e-l),n.lineTo(o+s,e+l),n.moveTo(o+l,e-s),n.lineTo(o-l,e+s);break;case"line":s=Math.cos(r)*t,l=Math.sin(r)*t,n.moveTo(o-s,e-l),n.lineTo(o+s,e+l);break;case"dash":n.moveTo(o,e),n.lineTo(o+Math.cos(r)*t,e+Math.sin(r)*t);break}n.fill()}function nS(n,o,e,t){n.save();let i=o.length,a=0,r=t;for(let s=0;s<i;s++){let l=e[Math.min(s,e.length-1)];n.font=l.string;let m=o[s];a=Math.max(a,n.measureText(m).width+t),r+=l.lineHeight}return n.restore(),{width:a,height:r}}function aS(n,{x:o,y:e},t,i){n.beginPath();let a=0;t.forEach(function(r,s){let l=i[Math.min(s,i.length-1)],m=l.lineHeight;n.font=l.string,n.strokeText(r,o,e+m/2+a),a+=m}),n.stroke()}function oS(n,{x:o,y:e},t,{fonts:i,colors:a}){let r=0;t.forEach(function(s,l){let m=a[Math.min(l,a.length-1)],f=i[Math.min(l,i.length-1)],b=f.lineHeight;n.beginPath(),n.font=f.string,n.fillStyle=m,n.fillText(s,o,e+b/2+r),r+=b,n.fill()})}function rS(n,o){let e=Qa(n)?n:o;return Qa(e)?al(e,0,1):1}var Uf=["left","bottom","top","right"];function sS(n,o){let{pointX:e,pointY:t,options:i}=o,a=i.callout,r=a&&a.display&&mS(o,a);if(!r||pS(o,a,r))return;if(n.save(),n.beginPath(),!wn(n,a))return n.restore();let{separatorStart:l,separatorEnd:m}=lS(o,r),{sideStart:f,sideEnd:b}=cS(o,r,l);(a.margin>0||i.borderWidth===0)&&(n.moveTo(l.x,l.y),n.lineTo(m.x,m.y)),n.moveTo(f.x,f.y),n.lineTo(b.x,b.y);let A=Na({x:e,y:t},o.getCenterPoint(),Bi(-o.rotation));n.lineTo(A.x,A.y),n.stroke(),n.restore()}function lS(n,o){let{x:e,y:t,x2:i,y2:a}=n,r=dS(n,o),s,l;return o==="left"||o==="right"?(s={x:e+r,y:t},l={x:s.x,y:a}):(s={x:e,y:t+r},l={x:i,y:s.y}),{separatorStart:s,separatorEnd:l}}function dS(n,o){let{width:e,height:t,options:i}=n,a=i.callout.margin+i.borderWidth/2;return o==="right"?e+a:o==="bottom"?t+a:-a}function cS(n,o,e){let{y:t,width:i,height:a,options:r}=n,s=r.callout.start,l=uS(o,r.callout),m,f;return o==="left"||o==="right"?(m={x:e.x,y:t+aa(a,s)},f={x:m.x+l,y:m.y}):(m={x:e.x+aa(i,s),y:e.y},f={x:m.x,y:m.y+l}),{sideStart:m,sideEnd:f}}function uS(n,o){let e=o.side;return n==="left"||n==="top"?-e:e}function mS(n,o){let e=o.position;return Uf.includes(e)?e:hS(n,o)}function hS(n,o){let{x:e,y:t,x2:i,y2:a,width:r,height:s,pointX:l,pointY:m,centerX:f,centerY:b,rotation:A}=n,C={x:f,y:b},w=o.start,M=aa(r,w),G=aa(s,w),E=[e,e+M,e+M,i],W=[t+G,a,t,a],V=[];for(let Y=0;Y<4;Y++){let j=Na({x:E[Y],y:W[Y]},C,Bi(A));V.push({position:Uf[Y],distance:Fo(j,{x:l,y:m})})}return V.sort((Y,j)=>Y.distance-j.distance)[0].position}function pS(n,o,e){let{pointX:t,pointY:i}=n,a=o.margin,r=t,s=i;return e==="left"?r+=a:e==="right"?r-=a:e==="top"?s+=a:e==="bottom"&&(s-=a),n.inRange(r,s)}var uf={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function bo(n,o,e){return o=typeof o=="number"?o:n.parse(o),ga(o)?n.getPixelForValue(o):e}function Da(n,o,e){let t=o[e];if(t||e==="scaleID")return t;let i=e.charAt(0),a=Object.values(n).filter(r=>r.axis&&r.axis===i);return a.length?a[0].id:i}function Hf(n,o){if(n){let e=n.options.reverse,t=bo(n,o.min,e?o.end:o.start),i=bo(n,o.max,e?o.start:o.end);return{start:t,end:i}}}function qf(n,o){let{chartArea:e,scales:t}=n,i=t[Da(t,o,"xScaleID")],a=t[Da(t,o,"yScaleID")],r=e.width/2,s=e.height/2;return i&&(r=bo(i,o.xValue,i.left+i.width/2)),a&&(s=bo(a,o.yValue,a.top+a.height/2)),{x:r,y:s}}function Ed(n,o){let e=n.scales,t=e[Da(e,o,"xScaleID")],i=e[Da(e,o,"yScaleID")];if(!t&&!i)return{};let{left:a,right:r}=t||n.chartArea,{top:s,bottom:l}=i||n.chartArea,m=mf(t,{min:o.xMin,max:o.xMax,start:a,end:r});a=m.start,r=m.end;let f=mf(i,{min:o.yMin,max:o.yMax,start:l,end:s});return s=f.start,l=f.end,{x:a,y:s,x2:r,y2:l,width:r-a,height:l-s,centerX:a+(r-a)/2,centerY:s+(l-s)/2}}function $f(n,o){if(!Wf(o)){let e=Ed(n,o),t=o.radius;(!t||isNaN(t))&&(t=Math.min(e.width,e.height)/2,o.radius=t);let i=t*2,a=e.centerX+o.xAdjust,r=e.centerY+o.yAdjust;return{x:a-t,y:r-t,x2:a+t,y2:r+t,centerX:a,centerY:r,width:i,height:i,radius:t}}return gS(n,o)}function fS(n,o){let{scales:e,chartArea:t}=n,i=e[o.scaleID],a={x:t.left,y:t.top,x2:t.right,y2:t.bottom};return i?vS(i,a,o):bS(e,a,o),a}function jf(n,o){let e=Ed(n,o);return e.initProperties=Co(n,e,o),e.elements=[{type:"label",optionScope:"label",properties:xS(n,e,o),initProperties:e.initProperties}],e}function gS(n,o){let e=qf(n,o),t=o.radius*2;return{x:e.x-o.radius+o.xAdjust,y:e.y-o.radius+o.yAdjust,x2:e.x+o.radius+o.xAdjust,y2:e.y+o.radius+o.yAdjust,centerX:e.x+o.xAdjust,centerY:e.y+o.yAdjust,radius:o.radius,width:t,height:t}}function mf(n,o){let e=Hf(n,o)||o;return{start:Math.min(e.start,e.end),end:Math.max(e.start,e.end)}}function vS(n,o,e){let t=bo(n,e.value,NaN),i=bo(n,e.endValue,t);n.isHorizontal()?(o.x=t,o.x2=i):(o.y=t,o.y2=i)}function bS(n,o,e){for(let t of Object.keys(uf)){let i=n[Da(n,e,t)];if(i){let{min:a,max:r,start:s,end:l,startProp:m,endProp:f}=uf[t],b=Hf(i,{min:e[a],max:e[r],start:i[s],end:i[l]});o[m]=b.start,o[f]=b.end}}}function AS({properties:n,options:o},e,t,i){let{x:a,x2:r,width:s}=n;return Yf({start:a,end:r,size:s,borderWidth:o.borderWidth},{position:t.x,padding:{start:i.left,end:i.right},adjust:o.label.xAdjust,size:e.width})}function yS({properties:n,options:o},e,t,i){let{y:a,y2:r,height:s}=n;return Yf({start:a,end:r,size:s,borderWidth:o.borderWidth},{position:t.y,padding:{start:i.top,end:i.bottom},adjust:o.label.yAdjust,size:e.height})}function Yf(n,o){let{start:e,end:t,borderWidth:i}=n,{position:a,padding:{start:r,end:s},adjust:l}=o,m=t-i-e-r-s-o.size;return e+i/2+l+kd(m,a)}function xS(n,o,e){let t=e.label;t.backgroundColor="transparent",t.callout.display=!1;let i=Td(t.position),a=Ja(t.padding),r=sl(n.ctx,t),s=AS({properties:o,options:e},r,i,a),l=yS({properties:o,options:e},r,i,a),m=r.width+a.width,f=r.height+a.height;return{x:s,y:l,x2:s+m,y2:l+f,width:m,height:f,centerX:s+m/2,centerY:l+f/2,rotation:t.rotation}}var Ad=["enter","leave"],Dd=Ad.concat("click");function CS(n,o,e){o.listened=Ff(e,Dd,o.listeners),o.moveListened=!1,Ad.forEach(t=>{zn(e[t])&&(o.moveListened=!0)}),(!o.listened||!o.moveListened)&&o.annotations.forEach(t=>{!o.listened&&zn(t.click)&&(o.listened=!0),o.moveListened||Ad.forEach(i=>{zn(t[i])&&(o.listened=!0,o.moveListened=!0)})})}function SS(n,o,e){if(n.listened)switch(o.type){case"mousemove":case"mouseout":return wS(n,o,e);case"click":return _S(n,o,e)}}function wS(n,o,e){if(!n.moveListened)return;let t;o.type==="mousemove"?t=Md(n.visibleElements,o,e.interaction):t=[];let i=n.hovered;n.hovered=t;let a={state:n,event:o},r=hf(a,"leave",i,t);return hf(a,"enter",t,i)||r}function hf({state:n,event:o},e,t,i){let a;for(let r of t)i.indexOf(r)<0&&(a=Zf(r.options[e]||n.listeners[e],r,o)||a);return a}function _S(n,o,e){let t=n.listeners,i=Md(n.visibleElements,o,e.interaction),a;for(let r of i)a=Zf(r.options.click||t.click,r,o)||a;return a}function Zf(n,o,e){return rn(n,[o.$context,e])===!0}var nl=["afterDraw","beforeDraw"];function MS(n,o,e){let t=o.visibleElements;o.hooked=Ff(e,nl,o.hooks),o.hooked||t.forEach(i=>{o.hooked||nl.forEach(a=>{zn(i.options[a])&&(o.hooked=!0)})})}function pf(n,o,e){if(n.hooked){let t=o.options[e]||n.hooks[e];return rn(t,[o.$context])}}function kS(n,o,e){let t=IS(n.scales,o,e),i=ff(o,t,"min","suggestedMin");i=ff(o,t,"max","suggestedMax")||i,i&&zn(o.handleTickRangeOptions)&&o.handleTickRangeOptions()}function TS(n,o){for(let e of n)DS(e,o)}function ff(n,o,e,t){if(ga(o[e])&&!ES(n.options,e,t)){let i=n[e]!==o[e];return n[e]=o[e],i}}function ES(n,o,e){return Gi(n[o])||Gi(n[e])}function DS(n,o){for(let e of["scaleID","xScaleID","yScaleID"]){let t=Da(o,n,e);t&&!o[t]&&PS(n,e)&&console.warn(`No scale found with id '${t}' for annotation '${n.id}'`)}}function PS(n,o){if(o==="scaleID")return!0;let e=o.charAt(0);for(let t of["Min","Max","Value"])if(Gi(n[e+t]))return!0;return!1}function IS(n,o,e){let t=o.axis,i=o.id,a=t+"ScaleID",r={min:bn(o.min,Number.NEGATIVE_INFINITY),max:bn(o.max,Number.POSITIVE_INFINITY)};for(let s of e)s.scaleID===i?gf(s,o,["value","endValue"],r):Da(n,s,a)===i&&gf(s,o,[t+"Min",t+"Max",t+"Value"],r);return r}function gf(n,o,e,t){for(let i of e){let a=n[i];if(Gi(a)){let r=o.parse(a);t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}}}var oa=class extends Hn{inRange(o,e,t,i){let{x:a,y:r}=Na({x:o,y:e},this.getCenterPoint(i),Bi(-this.options.rotation));return Df({x:a,y:r},this.getProps(["x","y","x2","y2"],i),t,this.options)}getCenterPoint(o){return Ra(this,o)}draw(o){o.save(),rl(o,this.getCenterPoint(),this.options.rotation),Bf(o,this,this.options),o.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(o,e){return jf(o,e)}};oa.id="boxAnnotation";oa.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,hitTolerance:0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};oa.defaultRoutes={borderColor:"color",backgroundColor:"color"};oa.descriptors={label:{_fallback:!0}};var Ao=class extends Hn{inRange(o,e,t,i){return Pf({x:o,y:e},{rect:this.getProps(["x","y","x2","y2"],i),center:this.getCenterPoint(i)},t,{rotation:this.rotation,borderWidth:0,hitTolerance:this.options.hitTolerance})}getCenterPoint(o){return Ra(this,o)}draw(o){let e=this.options;!e.display||!e.content||(WS(o,this),o.save(),rl(o,this.getCenterPoint(),this.rotation),zf(o,this,e,this._fitRatio),o.restore())}resolveElementProperties(o,e){let t=NS(o,e);if(!t)return{};let{controllerMeta:i,point:a,radius:r}=OS(o,e,t),s=sl(o.ctx,e),l=VS(s,r);Vf(e,l)&&(s={width:s.width*l,height:s.height*l});let{position:m,xAdjust:f,yAdjust:b}=e,A=Of(a,s,{borderWidth:0,position:m,xAdjust:f,yAdjust:b});return fe(ae(ae({initProperties:Co(o,A,e)},A),i),{rotation:e.rotation,_fitRatio:l})}};Ao.id="doughnutLabelAnnotation";Ao.defaults={autoFit:!0,autoHide:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderColor:"transparent",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:0,color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,spacing:1,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0};Ao.defaultRoutes={};function NS(n,o){return n.getSortedVisibleDatasetMetas().reduce(function(e,t){let i=t.controller;return i instanceof Mu&&RS(n,o,t.data)&&(!e||i.innerRadius<e.controller.innerRadius)&&i.options.circumference>=90?t:e},void 0)}function RS(n,o,e){if(!o.autoHide)return!0;for(let t=0;t<e.length;t++)if(!e[t].hidden&&n.getDataVisibility(t))return!0}function OS({chartArea:n},o,e){let{left:t,top:i,right:a,bottom:r}=n,{innerRadius:s,offsetX:l,offsetY:m}=e.controller,f=(t+a)/2+l,b=(i+r)/2+m,A={left:Math.max(f-s,t),right:Math.min(f+s,a),top:Math.max(b-s,i),bottom:Math.min(b+s,r)},C={x:(A.left+A.right)/2,y:(A.top+A.bottom)/2},w=o.spacing+o.borderWidth/2,M=s-w,G=C.y>b,E=G?i+w:r-w,W=LS(E,f,b,M);return{controllerMeta:ae({_centerX:f,_centerY:b,_radius:M,_counterclockwise:G},W),point:C,radius:Math.min(s,Math.min(A.right-A.left,A.bottom-A.top)/2)}}function VS({width:n,height:o},e){let t=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));return e*2/t}function LS(n,o,e,t){let i=Math.pow(e-n,2),a=Math.pow(t,2),r=o*-2,s=Math.pow(o,2)+i-a,l=Math.pow(r,2)-4*s;if(l<=0)return{_startAngle:0,_endAngle:ts};let m=(-r-Math.sqrt(l))/2,f=(-r+Math.sqrt(l))/2;return{_startAngle:as({x:o,y:e},{x:m,y:n}).angle,_endAngle:as({x:o,y:e},{x:f,y:n}).angle}}function WS(n,o){let{_centerX:e,_centerY:t,_radius:i,_startAngle:a,_endAngle:r,_counterclockwise:s,options:l}=o;n.save();let m=wn(n,l);n.fillStyle=l.backgroundColor,n.beginPath(),n.arc(e,t,i,a,r,s),n.closePath(),n.fill(),m&&n.stroke(),n.restore()}var Pa=class extends Hn{inRange(o,e,t,i){return Pf({x:o,y:e},{rect:this.getProps(["x","y","x2","y2"],i),center:this.getCenterPoint(i)},t,{rotation:this.rotation,borderWidth:this.options.borderWidth,hitTolerance:this.options.hitTolerance})}getCenterPoint(o){return Ra(this,o)}draw(o){let e=this.options,t=!Gi(this._visible)||this._visible;!e.display||!e.content||!t||(o.save(),rl(o,this.getCenterPoint(),this.rotation),sS(o,this),Bf(o,this,e),zf(o,FS(this),e),o.restore())}resolveElementProperties(o,e){let t;if(Wf(e))t=qf(o,e);else{let{centerX:s,centerY:l}=Ed(o,e);t={x:s,y:l}}let i=Ja(e.padding),a=sl(o.ctx,e),r=Of(t,a,e,i);return fe(ae({initProperties:Co(o,r,e),pointX:t.x,pointY:t.y},r),{rotation:e.rotation})}};Pa.id="labelAnnotation";Pa.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};Pa.defaultRoutes={borderColor:"color"};function FS({x:n,y:o,width:e,height:t,options:i}){let a=i.borderWidth/2,r=Ja(i.padding);return{x:n+r.left+a,y:o+r.top+a,width:e-r.left-r.right-i.borderWidth,height:t-r.top-r.bottom-i.borderWidth}}var Pd=(n,o,e)=>({x:n.x+e*(o.x-n.x),y:n.y+e*(o.y-n.y)}),yd=(n,o,e)=>Pd(o,e,Math.abs((n-o.y)/(e.y-o.y))).x,vf=(n,o,e)=>Pd(o,e,Math.abs((n-o.x)/(e.x-o.x))).y,fr=n=>n*n,GS=(n,o,{x:e,y:t,x2:i,y2:a},r)=>r==="y"?{start:Math.min(t,a),end:Math.max(t,a),value:o}:{start:Math.min(e,i),end:Math.max(e,i),value:n},bf=(n,o,e,t)=>(1-t)*(1-t)*n+2*(1-t)*t*o+t*t*e,xd=(n,o,e,t)=>({x:bf(n.x,o.x,e.x,t),y:bf(n.y,o.y,e.y,t)}),Af=(n,o,e,t)=>2*(1-t)*(o-n)+2*t*(e-o),yf=(n,o,e,t)=>-Math.atan2(Af(n.x,o.x,e.x,t),Af(n.y,o.y,e.y,t))+.5*hi,ll=(()=>{class n extends Hn{inRange(e,t,i,a){let r=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y"){let s={mouseX:e,mouseY:t},{path:l,ctx:m}=this;if(l){wn(m,this.options),m.lineWidth+=this.options.hitTolerance;let{chart:b}=this.$context,A=e*b.currentDevicePixelRatio,C=t*b.currentDevicePixelRatio,w=m.isPointInStroke(l,A,C)||Cd(this,s,a);return m.restore(),w}let f=fr(r);return HS(this,s,f,a)||Cd(this,s,a)}return BS(this,{mouseX:e,mouseY:t},i,{hitSize:r,useFinalPosition:a})}getCenterPoint(e){return Ra(this,e)}draw(e){let{x:t,y:i,x2:a,y2:r,cp:s,options:l}=this;if(e.save(),!wn(e,l))return e.restore();So(e,l);let m=Math.sqrt(Math.pow(a-t,2)+Math.pow(r-i,2));if(l.curve&&s)return KS(e,this,s,m),e.restore();let{startOpts:f,endOpts:b,startAdjust:A,endAdjust:C}=Qf(this),w=Math.atan2(r-i,a-t);e.translate(t,i),e.rotate(w),e.beginPath(),e.moveTo(0+A,0),e.lineTo(m-C,0),e.shadowColor=l.borderShadowColor,e.stroke(),Sd(e,0,A,f),Sd(e,m,-C,b),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,t){let i=fS(e,t),{x:a,y:r,x2:s,y2:l}=i,m=zS(i,e.chartArea),f=m?US({x:a,y:r},{x:s,y:l},e.chartArea):{x:a,y:r,x2:s,y2:l,width:Math.abs(s-a),height:Math.abs(l-r)};if(f.centerX=(s+a)/2,f.centerY=(l+r)/2,f.initProperties=Co(e,f,t),t.curve){let A={x:f.x,y:f.y},C={x:f.x2,y:f.y2};f.cp=XS(f,t,Fo(A,C))}let b=qS(e,f,t.label);return b._visible=m,f.elements=[{type:"label",optionScope:"label",properties:b,initProperties:f.initProperties}],f}}return n.id="lineAnnotation",n})(),xf={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};ll.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},xf),fill:!1,length:12,start:Object.assign({},xf),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,hitTolerance:0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},Pa.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};ll.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}};ll.defaultRoutes={borderColor:"color"};function BS(n,{mouseX:o,mouseY:e},t,{hitSize:i,useFinalPosition:a}){let r=GS(o,e,n.getProps(["x","y","x2","y2"],a),t);return Ef(r,i)||Cd(n,{mouseX:o,mouseY:e},a,t)}function zS({x:n,y:o,x2:e,y2:t},{top:i,right:a,bottom:r,left:s}){return!(n<s&&e<s||n>a&&e>a||o<i&&t<i||o>r&&t>r)}function Cf({x:n,y:o},e,{top:t,right:i,bottom:a,left:r}){return n<r&&(o=vf(r,{x:n,y:o},e),n=r),n>i&&(o=vf(i,{x:n,y:o},e),n=i),o<t&&(n=yd(t,{x:n,y:o},e),o=t),o>a&&(n=yd(a,{x:n,y:o},e),o=a),{x:n,y:o}}function US(n,o,e){let{x:t,y:i}=Cf(n,o,e),{x:a,y:r}=Cf(o,n,e);return{x:t,y:i,x2:a,y2:r,width:Math.abs(a-t),height:Math.abs(r-i)}}function HS(n,{mouseX:o,mouseY:e},t=Ea,i){let{x:a,y:r,x2:s,y2:l}=n.getProps(["x","y","x2","y2"],i),m=s-a,f=l-r,b=fr(m)+fr(f),A=b===0?-1:((o-a)*m+(e-r)*f)/b,C,w;return A<0?(C=a,w=r):A>1?(C=s,w=l):(C=a+A*m,w=r+A*f),fr(o-C)+fr(e-w)<=t}function Cd(n,{mouseX:o,mouseY:e},t,i){let a=n.label;return a.options.display&&a.inRange(o,e,i,t)}function qS(n,o,e){let t=e.borderWidth,i=Ja(e.padding),a=sl(n.ctx,e),r=a.width+i.width+t,s=a.height+i.height+t;return jS(o,e,{width:r,height:s,padding:i},n.chartArea)}function $S(n){let{x:o,y:e,x2:t,y2:i}=n,a=Math.atan2(i-e,t-o);return a>hi/2?a-hi:a<hi/-2?a+hi:a}function jS(n,o,e,t){let{width:i,height:a,padding:r}=e,{xAdjust:s,yAdjust:l}=o,m={x:n.x,y:n.y},f={x:n.x2,y:n.y2},b=o.rotation==="auto"?$S(n):Bi(o.rotation),A=YS(i,a,b),C=ZS(n,o,{labelSize:A,padding:r},t),w=n.cp?xd(m,n.cp,f,C):Pd(m,f,C),M={size:A.w,min:t.left,max:t.right,padding:r.left},G={size:A.h,min:t.top,max:t.bottom,padding:r.top},E=wf(w.x,M)+s,W=wf(w.y,G)+l;return{x:E-i/2,y:W-a/2,x2:E+i/2,y2:W+a/2,centerX:E,centerY:W,pointX:w.x,pointY:w.y,width:i,height:a,rotation:Sl(b)}}function YS(n,o,e){let t=Math.cos(e),i=Math.sin(e);return{w:Math.abs(n*t)+Math.abs(o*i),h:Math.abs(n*i)+Math.abs(o*t)}}function ZS(n,o,e,t){let i,a=QS(n,t);return o.position==="start"?i=Sf({w:n.x2-n.x,h:n.y2-n.y},e,o,a):o.position==="end"?i=1-Sf({w:n.x-n.x2,h:n.y-n.y2},e,o,a):i=kd(1,o.position),i}function Sf(n,o,e,t){let{labelSize:i,padding:a}=o,r=n.w*t.dx,s=n.h*t.dy,l=r>0&&(i.w/2+a.left-t.x)/r,m=s>0&&(i.h/2+a.top-t.y)/s;return al(Math.max(l,m),0,.25)}function QS(n,o){let{x:e,x2:t,y:i,y2:a}=n,r=Math.min(i,a)-o.top,s=Math.min(e,t)-o.left,l=o.bottom-Math.max(i,a),m=o.right-Math.max(e,t);return{x:Math.min(s,m),y:Math.min(r,l),dx:s<=m?1:-1,dy:r<=l?1:-1}}function wf(n,o){let{size:e,min:t,max:i,padding:a}=o,r=e/2;return e>i-t?(i+t)/2:(t>=n-a-r&&(n=t+a+r),i<=n+a+r&&(n=i-a-r),n)}function Qf(n){let o=n.options,e=o.arrowHeads&&o.arrowHeads.start,t=o.arrowHeads&&o.arrowHeads.end;return{startOpts:e,endOpts:t,startAdjust:_f(n,e),endAdjust:_f(n,t)}}function _f(n,o){if(!o||!o.display)return 0;let{length:e,width:t}=o,i=n.options.borderWidth/2,a={x:e,y:t+i};return Math.abs(yd(0,a,{x:0,y:i}))}function Sd(n,o,e,t){if(!t||!t.display)return;let{length:i,width:a,fill:r,backgroundColor:s,borderColor:l}=t,m=Math.abs(o-i)+e;n.beginPath(),So(n,t),wn(n,t),n.moveTo(m,-a),n.lineTo(o+e,0),n.lineTo(m,a),r===!0?(n.fillStyle=s||l,n.closePath(),n.fill(),n.shadowColor="transparent"):n.shadowColor=t.borderShadowColor,n.stroke()}function XS(n,o,e){let{x:t,y:i,x2:a,y2:r,centerX:s,centerY:l}=n,m=Math.atan2(r-i,a-t),f=Td(o.controlPoint,0),b={x:s+aa(e,f.x,!1),y:l+aa(e,f.y,!1)};return Na(b,{x:s,y:l},m)}function Mf(n,{x:o,y:e},{angle:t,adjust:i},a){!a||!a.display||(n.save(),n.translate(o,e),n.rotate(t),Sd(n,0,-i,a),n.restore())}function KS(n,o,e,t){let{x:i,y:a,x2:r,y2:s,options:l}=o,{startOpts:m,endOpts:f,startAdjust:b,endAdjust:A}=Qf(o),C={x:i,y:a},w={x:r,y:s},M=yf(C,e,w,0),G=yf(C,e,w,1)-hi,E=xd(C,e,w,b/t),W=xd(C,e,w,1-A/t),V=new Path2D;n.beginPath(),V.moveTo(E.x,E.y),V.quadraticCurveTo(e.x,e.y,W.x,W.y),n.shadowColor=l.borderShadowColor,n.stroke(V),o.path=V,o.ctx=n,Mf(n,E,{angle:M,adjust:b},m),Mf(n,W,{angle:G,adjust:A},f)}var Ia=class extends Hn{inRange(o,e,t,i){let a=this.options.rotation,r=(this.options.borderWidth+this.options.hitTolerance)/2;if(t!=="x"&&t!=="y")return JS({x:o,y:e},this.getProps(["width","height","centerX","centerY"],i),a,r);let{x:s,y:l,x2:m,y2:f}=this.getProps(["x","y","x2","y2"],i),b=t==="y"?{start:l,end:f}:{start:s,end:m},A=Na({x:o,y:e},this.getCenterPoint(i),Bi(-a));return A[t]>=b.start-r-Ea&&A[t]<=b.end+r+Ea}getCenterPoint(o){return Ra(this,o)}draw(o){let{width:e,height:t,centerX:i,centerY:a,options:r}=this;o.save(),rl(o,this.getCenterPoint(),r.rotation),So(o,this.options),o.beginPath(),o.fillStyle=r.backgroundColor;let s=wn(o,r);o.ellipse(i,a,t/2,e/2,hi/2,0,2*hi),o.fill(),s&&(o.shadowColor=r.borderShadowColor,o.stroke()),o.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(o,e){return jf(o,e)}};Ia.id="ellipseAnnotation";Ia.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,label:Object.assign({},oa.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};Ia.defaultRoutes={borderColor:"color",backgroundColor:"color"};Ia.descriptors={label:{_fallback:!0}};function JS(n,o,e,t){let{width:i,height:a,centerX:r,centerY:s}=o,l=i/2,m=a/2;if(l<=0||m<=0)return!1;let f=Bi(e||0),b=Math.cos(f),A=Math.sin(f),C=Math.pow(b*(n.x-r)+A*(n.y-s),2),w=Math.pow(A*(n.x-r)-b*(n.y-s),2);return C/Math.pow(l+t,2)+w/Math.pow(m+t,2)<=1.0001}var yo=class extends Hn{inRange(o,e,t,i){let{x:a,y:r,x2:s,y2:l,width:m}=this.getProps(["x","y","x2","y2","width"],i),f=(this.options.borderWidth+this.options.hitTolerance)/2;return t!=="x"&&t!=="y"?jC({x:o,y:e},this.getCenterPoint(i),m/2,f):Ef(t==="y"?{start:r,end:l,value:e}:{start:a,end:s,value:o},f)}getCenterPoint(o){return Ra(this,o)}draw(o){let e=this.options,t=e.borderWidth;if(e.radius<.1)return;o.save(),o.fillStyle=e.backgroundColor,So(o,e);let i=wn(o,e);tS(o,this,this.centerX,this.centerY),i&&!ol(e.pointStyle)&&(o.shadowColor=e.borderShadowColor,o.stroke()),o.restore(),e.borderWidth=t}resolveElementProperties(o,e){let t=$f(o,e);return t.initProperties=Co(o,t,e),t}};yo.id="pointAnnotation";yo.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};yo.defaultRoutes={borderColor:"color",backgroundColor:"color"};var xo=class extends Hn{inRange(o,e,t,i){if(t!=="x"&&t!=="y")return this.options.radius>=.1&&this.elements.length>1&&tw(this.elements,o,e,i);let a=Na({x:o,y:e},this.getCenterPoint(i),Bi(-this.options.rotation)),r=this.elements.map(m=>t==="y"?m.bY:m.bX),s=Math.min(...r),l=Math.max(...r);return a[t]>=s&&a[t]<=l}getCenterPoint(o){return Ra(this,o)}draw(o){let{elements:e,options:t}=this;o.save(),o.beginPath(),o.fillStyle=t.backgroundColor,So(o,t);let i=wn(o,t),a=!0;for(let r of e)a?(o.moveTo(r.x,r.y),a=!1):o.lineTo(r.x,r.y);o.closePath(),o.fill(),i&&(o.shadowColor=t.borderShadowColor,o.stroke()),o.restore()}resolveElementProperties(o,e){let t=$f(o,e),{sides:i,rotation:a}=e,r=[],s=2*hi/i,l=a*is;for(let m=0;m<i;m++,l+=s){let f=ew(t,e,l);f.initProperties=Co(o,t,e),r.push(f)}return t.elements=r,t}};xo.id="polygonAnnotation";xo.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};xo.defaultRoutes={borderColor:"color",backgroundColor:"color"};function ew({centerX:n,centerY:o},{radius:e,borderWidth:t,hitTolerance:i},a){let r=(t+i)/2,s=Math.sin(a),l=Math.cos(a),m={x:n+s*e,y:o-l*e};return{type:"point",optionScope:"point",properties:{x:m.x,y:m.y,centerX:m.x,centerY:m.y,bX:n+s*(e+r),bY:o-l*(e+r)}}}function tw(n,o,e,t){let i=!1,a=n[n.length-1].getProps(["bX","bY"],t);for(let r of n){let s=r.getProps(["bX","bY"],t);s.bY>e!=a.bY>e&&o<(a.bX-s.bX)*(e-s.bY)/(a.bY-s.bY)+s.bX&&(i=!i),a=s}return i}var na={box:oa,doughnutLabel:Ao,ellipse:Ia,label:Pa,line:ll,point:yo,polygon:xo};Object.keys(na).forEach(n=>{Bo.describe(`elements.${na[n].id}`,{_fallback:"plugins.annotation.common"})});var iw={update:Object.assign},nw=Dd.concat(nl),kf=(n,o)=>Bn(o)?_d(n,o):n,wd=n=>n==="color"||n==="font";function Id(n="line"){return na[n]?n:(console.warn(`Unknown annotation type: '${n}', defaulting to 'line'`),"line")}function aw(n,o,e,t){let i=rw(n,e.animations,t),a=o.annotations,r=dw(o.elements,a);for(let s=0;s<a.length;s++){let l=a[s],m=Xf(r,s,l.type),f=l.setContext(lw(n,m,r,l)),b=m.resolveElementProperties(n,f);b.skip=ow(b),"elements"in b&&(sw(m,b.elements,f,i),delete b.elements),Gi(m.x)||Object.assign(m,b),Object.assign(m,b.initProperties),b.options=Kf(f),i.update(m,b)}}function ow(n){return isNaN(n.x)||isNaN(n.y)}function rw(n,o,e){return e==="reset"||e==="none"||e==="resize"?iw:new wu(n,o)}function sw(n,o,e,t){let i=n.elements||(n.elements=[]);i.length=o.length;for(let a=0;a<o.length;a++){let r=o[a],s=r.properties,l=Xf(i,a,r.type,r.initProperties),m=e[r.optionScope].override(r);s.options=Kf(m),t.update(l,s)}}function Xf(n,o,e,t){let i=na[Id(e)],a=n[o];return(!a||!(a instanceof i))&&(a=n[o]=new i,Object.assign(a,t)),a}function Kf(n){let o=na[Id(n.type)],e={};e.id=n.id,e.type=n.type,e.drawTime=n.drawTime,Object.assign(e,_d(n,o.defaults),_d(n,o.defaultRoutes));for(let t of nw)e[t]=n[t];return e}function _d(n,o){let e={};for(let t of Object.keys(o)){let i=o[t],a=n[t];wd(t)&&Fi(a)?e[t]=a.map(r=>kf(r,i)):e[t]=kf(a,i)}return e}function lw(n,o,e,t){return o.$context||(o.$context=Object.assign(Object.create(n.getContext()),{element:o,get elements(){return e.filter(i=>i&&i.options)},id:t.id,type:"annotation"}))}function dw(n,o){let e=o.length,t=n.length;if(t<e){let i=e-t;n.splice(t,0,...new Array(i))}else t>e&&n.splice(e,t-e);return n}var cw="3.1.0",ia=new Map,Tf=n=>n.type!=="doughnutLabel",uw=Dd.concat(nl),Jf={id:"annotation",version:cw,beforeRegister(){YC("chart.js","4.0",vt.version)},afterRegister(){vt.register(na)},afterUnregister(){vt.unregister(na)},beforeInit(n){ia.set(n,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(n,o,e){let t=ia.get(n),i=t.annotations=[],a=e.annotations;Bn(a)?Object.keys(a).forEach(r=>{let s=a[r];Bn(s)&&(s.id=r,i.push(s))}):Fi(a)&&i.push(...a),TS(i.filter(Tf),n.scales)},afterDataLimits(n,o){let e=ia.get(n);kS(n,o.scale,e.annotations.filter(Tf).filter(t=>t.display&&t.adjustScaleRange))},afterUpdate(n,o,e){let t=ia.get(n);CS(n,t,e),aw(n,t,e,o.mode),t.visibleElements=t.elements.filter(i=>!i.skip&&i.options.display),MS(n,t,e)},beforeDatasetsDraw(n,o,e){pr(n,"beforeDatasetsDraw",e.clip)},afterDatasetsDraw(n,o,e){pr(n,"afterDatasetsDraw",e.clip)},beforeDatasetDraw(n,o,e){pr(n,o.index,e.clip)},beforeDraw(n,o,e){pr(n,"beforeDraw",e.clip)},afterDraw(n,o,e){pr(n,"afterDraw",e.clip)},beforeEvent(n,o,e){let t=ia.get(n);SS(t,o.event,e)&&(o.changed=!0)},afterDestroy(n){ia.delete(n)},getAnnotations(n){let o=ia.get(n);return o?o.elements:[]},_getAnnotationElementsAtEventForMode(n,o,e){return Md(n,o,e)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"},colors:{properties:["backgroundColor","borderColor"],type:"color"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:n=>!uw.includes(n)&&n!=="init",annotations:{_allKeys:!1,_fallback:(n,o)=>`elements.${na[Id(o.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:wd,_fallback:!0},_indexable:wd}},additionalOptionScopes:[""]};function pr(n,o,e){let{ctx:t,chartArea:i}=n,a=ia.get(n);e&&Xa(t,i);let r=mw(a.visibleElements,o).sort((s,l)=>s.element.options.z-l.element.options.z);for(let s of r)hw(t,i,a,s);e&&Ka(t)}function mw(n,o){let e=[];for(let t of n)if(t.options.drawTime===o&&e.push({element:t,main:!0}),t.elements&&t.elements.length)for(let i of t.elements)i.options.display&&i.options.drawTime===o&&e.push({element:i});return e}function hw(n,o,e,t){let i=t.element;t.main?(pf(e,i,"beforeDraw"),i.draw(n,o),pf(e,i,"afterDraw")):i.draw(n,o)}var pw=["widgetDataChart"];function fw(n,o){n&1&&Q(0,"canvas",1,0)}function gw(n,o){n&1&&(D(0,"div",2)(1,"p"),c(2,"Ready to configure"),R(),D(3,"p",3),c(4,"Double-tap to begin"),R()())}vt.register(Jf,ya,to,os,rs,ln,jn,Un,$n,qn);var eg=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(we);dsService=y(dn);ngZone=y(Be);canvasService=y(mt);unitsService=y(at);datasetLifecycle=y(oo);widgetDataChart=pe("widgetDataChart",{read:Ke});static DEFAULT_CONFIG={displayName:"Chart Label",color:"contrast",filterSelfPaths:!0,datachartPath:null,datachartSource:null,convertUnitTo:null,timeScale:"minute",period:10,numDecimal:1,inverseYAxis:!1,datasetAverageArray:"sma",showDataPoints:!1,showAverageData:!0,trackAgainstAverage:!1,showDatasetMinimumValueLine:!1,showDatasetMaximumValueLine:!1,showDatasetAverageValueLine:!0,showDatasetAngleAverageValueLine:!1,showLabel:!0,showTimeScale:!1,startScaleAtZero:!1,verticalChart:!1,showYScale:!1,yScaleSuggestedMin:null,yScaleSuggestedMax:null,enableMinMaxScaleLimit:!1,yScaleMin:null,yScaleMax:null};lineChartData={datasets:[]};lineChartOptions={parsing:!1,datasets:{line:{pointRadius:0,pointHoverRadius:0,tension:.4}},animations:{tension:{easing:"easeInOutCubic"}}};lineChartType="line";chart;dsServiceSub=null;datasetConfig=null;dataSourceInfo=null;lastVerticalChart=null;hasPath=K(()=>!!this.runtime.options()?.datachartPath);pathSignature=K(()=>{let e=this.runtime.options();if(e.datachartPath)return[e.datachartPath,e.convertUnitTo,e.datachartSource,e.timeScale,e.period].join("|")});previousPathSignature=void 0;constructor(){L(()=>{let e=this.pathSignature();B(()=>{e!==this.previousPathSignature&&B(()=>{this.previousPathSignature=e,this.rebuildForDataset(this.runtime.options())})})}),L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||B(()=>{this.lastVerticalChart!==null&&this.lastVerticalChart!==e.verticalChart?(this.lastVerticalChart=e.verticalChart,this.rebuildForDataset(e)):this.chart&&(this.ensureAverageDatasetPresence(),this.updateAnnotationVisibility(),this.applyDynamicTrackAverageStyling(),this.setChartOptions(e),this.setDatasetsColors(),this.ngZone.runOutsideAngular(()=>this.chart?.update("none")))})}),L(()=>{let e=this.runtime.options(),t=this.widgetDataChart(),i=this.hasPath();!e||!i||!t||this.chart||B(()=>this.rebuildForDataset(e))})}rebuildForDataset(e){e.datachartPath&&this.widgetDataChart()&&(this.dsServiceSub?.unsubscribe(),this.lineChartData.datasets=[],this.datasetLifecycle.syncDataChartDataset(this.id(),e,this.pathSignature()),this.datasetConfig=this.dsService.getDatasetConfig(this.id()),this.dataSourceInfo=this.dsService.getDataSourceInfo(this.id()),this.datasetConfig&&(this.createDatasets(e),this.setChartOptions(e),this.chart?.destroy(),this.chart=new vt(this.widgetDataChart().nativeElement.getContext("2d"),{type:this.lineChartType,data:this.lineChartData,options:this.lineChartOptions}),this.startStreaming(),this.ngZone.runOutsideAngular(()=>this.chart?.update())))}setChartOptions(e){this.lineChartOptions.maintainAspectRatio=!1,this.lineChartOptions.animation=!1,this.lineChartOptions.indexAxis=e.verticalChart?"y":"x",e.verticalChart?this.lineChartOptions.scales={y:{type:"realtime",display:e.showTimeScale,position:e.verticalChart?"right":"left",suggestedMin:"",suggestedMax:"",title:{display:!0,text:`Last ${this.datasetConfig.period} ${this.datasetConfig.timeScaleFormat}`,align:"center",color:this.getThemeColors().averageChartLine},time:{unit:this.datasetConfig.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:!0,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!0,color:this.theme().contrastDimmer}},x:{type:"linear",display:e.showYScale,position:e.verticalChart?"top":"bottom",suggestedMin:e.enableMinMaxScaleLimit?null:e.yScaleSuggestedMin,suggestedMax:e.enableMinMaxScaleLimit?null:e.yScaleSuggestedMax,min:e.enableMinMaxScaleLimit?e.yScaleMin:null,max:e.enableMinMaxScaleLimit?e.yScaleMax:null,beginAtZero:e.startScaleAtZero,reverse:e.inverseYAxis,title:{display:!1,text:"Value Axis",align:"center",color:this.getThemeColors().averageChartLine},ticks:{maxTicksLimit:8,precision:e.numDecimal,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!0,color:this.theme().contrastDimmer}}}:this.lineChartOptions.scales={x:{type:"realtime",display:e.showTimeScale,title:{display:!0,text:`Last ${this.datasetConfig.period} ${this.datasetConfig.timeScaleFormat}`,align:"center",color:this.getThemeColors().averageChartLine},time:{unit:this.datasetConfig.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:!0,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!0,color:this.theme().contrastDimmer}},y:{display:e.showYScale,position:"right",suggestedMin:e.enableMinMaxScaleLimit?null:e.yScaleSuggestedMin,suggestedMax:e.enableMinMaxScaleLimit?null:e.yScaleSuggestedMax,min:e.enableMinMaxScaleLimit?e.yScaleMin:null,max:e.enableMinMaxScaleLimit?e.yScaleMax:null,beginAtZero:e.startScaleAtZero,reverse:e.inverseYAxis,title:{display:!1,text:"Value Axis",align:"center",color:this.getThemeColors().averageChartLine},ticks:{maxTicksLimit:8,precision:e.numDecimal,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!0,color:this.theme().contrastDimmer}}},this.lineChartOptions.plugins={title:{display:!0,align:"end",padding:{top:3,bottom:0},text:"",font:{size:32},color:this.getThemeColors().chartValue},subtitle:{display:e.showLabel,align:"start",padding:{top:-35,bottom:20},text:` ${e.displayName}`,font:{size:22},color:this.getThemeColors().chartLabel},annotation:{annotations:{minimumLine:{type:"line",scaleID:e.verticalChart?"x":"y",display:e.showDatasetMinimumValueLine,value:null,drawTime:"afterDatasetsDraw",label:{display:!0,position:"start",yAdjust:12,padding:4,color:this.getThemeColors().averageChartLine,backgroundColor:"rgba(63,63,63,0.0)"}},maximumLine:{type:"line",scaleID:e.verticalChart?"x":"y",display:e.showDatasetMaximumValueLine,value:null,drawTime:"afterDatasetsDraw",label:{display:!0,position:"start",yAdjust:-12,padding:4,color:this.getThemeColors().averageChartLine,backgroundColor:"rgba(63,63,63,0.0)"}},averageLine:{type:"line",scaleID:e.verticalChart?"x":"y",display:e.showDatasetAverageValueLine,value:null,borderDash:[6,6],borderColor:this.getThemeColors().averageChartLine,drawTime:"afterDatasetsDraw",label:{display:!0,position:"start",padding:4,color:this.getThemeColors().chartValue,backgroundColor:"rgba(63,63,63,0.7)"}}}},legend:{display:!1},streaming:{duration:this.dataSourceInfo.maxDataPoints*this.dataSourceInfo.sampleTime,delay:this.dataSourceInfo.sampleTime,frameRate:this.datasetConfig.timeScaleFormat==="day"?5:this.datasetConfig.timeScaleFormat==="hour"?8:this.datasetConfig.timeScaleFormat==="minute"?15:30}}}createDatasets(e){let t,i;e.inverseYAxis&&e.trackAgainstAverage?(t="start",i=!1):e.inverseYAxis&&!e.trackAgainstAverage?(t=!1,i="start"):!e.inverseYAxis&&e.trackAgainstAverage?(t=!0,i=!1):(t=!1,i=!0),this.lineChartData.datasets=[],this.lineChartData.datasets.push({label:"Value",data:[],order:e.trackAgainstAverage?1:0,parsing:!1,tension:0,pointRadius:e.showDataPoints?e.trackAgainstAverage?0:1.5:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:e.trackAgainstAverage||e.showDataPoints?0:3,fill:t}),e.showAverageData&&this.lineChartData.datasets.push({label:"Average",data:[],order:e.trackAgainstAverage?0:1,parsing:!1,tension:.4,pointRadius:e.showDataPoints&&e.trackAgainstAverage?1.5:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:e.trackAgainstAverage?e.showDataPoints?0:3:0,fill:i}),this.setDatasetsColors()}setDatasetsColors(){this.lineChartData.datasets.forEach(e=>{e.label==="Value"?(e.borderColor=this.getThemeColors().valueLine,e.backgroundColor=this.getThemeColors().valueFill):e.label==="Average"&&(e.borderColor=this.getThemeColors().averageLine,e.backgroundColor=this.getThemeColors().averageFill)})}ensureAverageDatasetPresence(){let e=this.runtime.options();if(!e||!this.chart)return;let t=this.lineChartData.datasets.some(i=>i.label==="Average");if(e.showAverageData&&!t){if(this.lineChartData.datasets.findIndex(a=>a.label==="Value")>=0){let a=e.inverseYAxis?e.trackAgainstAverage?!1:"start":!e.trackAgainstAverage;this.lineChartData.datasets.push({label:"Average",data:[],order:e.trackAgainstAverage?0:1,parsing:!1,tension:.4,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:e.trackAgainstAverage?3:0,fill:a})}}else!e.showAverageData&&t&&(this.lineChartData.datasets=this.lineChartData.datasets.filter(i=>i.label!=="Average"))}applyDynamicTrackAverageStyling(){let e=this.runtime.options();if(!e)return;let t=this.lineChartData.datasets.find(s=>s.label==="Value"),i=this.lineChartData.datasets.find(s=>s.label==="Average"),a,r;e.inverseYAxis&&e.trackAgainstAverage?(a="start",r=!1):e.inverseYAxis&&!e.trackAgainstAverage?(a=!1,r="start"):!e.inverseYAxis&&e.trackAgainstAverage?(a=!0,r=!1):(a=!1,r=!0),t&&(t.order=e.trackAgainstAverage?1:0,t.borderWidth=e.trackAgainstAverage?0:3,t.fill=a),i&&(i.order=e.trackAgainstAverage?0:1,i.borderWidth=e.trackAgainstAverage?3:0,i.fill=r)}updateAnnotationVisibility(){let e=this.runtime.options();if(!e||!this.chart)return;let t=this.chart.options.plugins.annotation?.annotations;t&&(t.minimumLine&&(t.minimumLine.display=e.showDatasetMinimumValueLine),t.maximumLine&&(t.maximumLine.display=e.showDatasetMaximumValueLine),t.averageLine&&(t.averageLine.display=e.showDatasetAverageValueLine))}getThemeColors(){let e=this.runtime.options()?.color,t={valueLine:null,valueFill:null,averageLine:null,averageFill:null,averageChartLine:null,chartLabel:null,chartValue:null};switch(e){case"contrast":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().contrastDimmer,t.valueFill=this.theme().contrastDimmer,t.averageLine=this.theme().contrast,t.averageFill=this.theme().contrast,t.chartValue=t.averageLine):(t.valueLine=this.theme().contrast,t.valueFill=this.theme().contrast,t.averageLine=this.theme().contrastDimmer,t.averageFill=this.theme().contrastDimmer,t.chartValue=this.theme().contrast),t.averageChartLine=this.theme().contrastDim,t.chartLabel=this.theme().contrastDim;break;case"blue":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().blueDimmer,t.valueFill=this.theme().blueDimmer,t.averageLine=this.theme().blue,t.averageFill=this.theme().blue,t.chartValue=t.averageLine):(t.valueLine=this.theme().blue,t.valueFill=this.theme().blue,t.averageLine=this.theme().blueDimmer,t.averageFill=this.theme().blueDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().blueDim,t.chartLabel=this.theme().contrastDim;break;case"green":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().greenDimmer,t.valueFill=this.theme().greenDimmer,t.averageLine=this.theme().green,t.averageFill=this.theme().green,t.chartValue=t.averageLine):(t.valueLine=this.theme().green,t.valueFill=this.theme().green,t.averageLine=this.theme().greenDimmer,t.averageFill=this.theme().greenDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().greenDim,t.chartLabel=this.theme().contrastDim;break;case"pink":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().pinkDimmer,t.valueFill=this.theme().pinkDimmer,t.averageLine=this.theme().pink,t.averageFill=this.theme().pink,t.chartValue=t.averageLine):(t.valueLine=this.theme().pink,t.valueFill=this.theme().pink,t.averageLine=this.theme().pinkDimmer,t.averageFill=this.theme().pinkDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().pinkDim,t.chartLabel=this.theme().contrastDim;break;case"orange":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().orangeDimmer,t.valueFill=this.theme().orangeDimmer,t.averageLine=this.theme().orange,t.averageFill=this.theme().orange,t.chartValue=t.averageLine):(t.valueLine=this.theme().orange,t.valueFill=this.theme().orange,t.averageLine=this.theme().orangeDimmer,t.averageFill=this.theme().orangeDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().orangeDim,t.chartLabel=this.theme().contrastDim;break;case"purple":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().purpleDimmer,t.valueFill=this.theme().purpleDimmer,t.averageLine=this.theme().purple,t.averageFill=this.theme().purple,t.chartValue=t.averageLine):(t.valueLine=this.theme().purple,t.valueFill=this.theme().purple,t.averageLine=this.theme().purpleDimmer,t.averageFill=this.theme().purpleDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().purpleDim,t.chartLabel=this.theme().contrastDim;break;case"grey":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().greyDimmer,t.valueFill=this.theme().greyDimmer,t.averageLine=this.theme().grey,t.averageFill=this.theme().grey,t.chartValue=t.averageLine):(t.valueLine=this.theme().grey,t.valueFill=this.theme().grey,t.averageLine=this.theme().greyDimmer,t.averageFill=this.theme().greyDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().greyDim,t.chartLabel=this.theme().contrastDim;break;case"yellow":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().yellowDimmer,t.valueFill=this.theme().yellowDimmer,t.averageLine=this.theme().yellow,t.averageFill=this.theme().yellow,t.chartValue=t.averageLine):(t.valueLine=this.theme().yellow,t.valueFill=this.theme().yellow,t.averageLine=this.theme().yellowDimmer,t.averageFill=this.theme().yellowDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().yellowDim,t.chartLabel=this.theme().contrastDim;break}return t}getUnitsLabel(){let e=null,t=this.runtime.options()?.convertUnitTo;switch(t){case"percent":case"percentraw":e="%";break;case"latitudeMin":e="latitude in minutes";break;case"latitudeSec":e="latitude in secondes";break;case"longitudeMin":e="longitude in minutes";break;case"longitudeSec":e="longitude in secondes";break;default:e=t;break}return e}startStreaming(){let e=this.runtime.options();if(!e?.datachartPath)return;this.dsServiceSub?.unsubscribe();let t=this.dsService.getDatasetBatchThenLiveObservable(this.id());this.dsServiceSub=t?.subscribe(i=>{if(this.chart){if(Array.isArray(i)){let a=this.transformDatasetRows(i,0);if(this.chart.data.datasets[0].data.push(...a),e.showAverageData&&this.lineChartData.datasets[1]){let s=this.transformDatasetRows(i,e.datasetAverageArray);this.chart.data.datasets[1].data.push(...s)}let r=i[i.length-1];r&&this.applyTitleAndAnnotationValues(r,e)}else{let a=this.transformDatasetRows([i],0)[0];if(this.chart.data.datasets[0].data.push(a),e.showAverageData&&this.lineChartData.datasets[1]){let r=this.transformDatasetRows([i],e.datasetAverageArray)[0];this.chart.data.datasets[1].data.push(r)}this.applyTitleAndAnnotationValues(i,e)}this.ngZone.runOutsideAngular(()=>this.chart?.update("none"))}})}applyTitleAndAnnotationValues(e,t){let i=t.trackAgainstAverage?e.data.sma??e.data.value:e.data.value,a=this.unitsService.convertToUnit(t.convertUnitTo,i);Number.isFinite(a)&&(this.chart.options.plugins.title.text=`${a.toFixed(t.numDecimal)} ${this.getUnitsLabel()} `);let r=this.unitsService.convertToUnit(t.convertUnitTo,e.data.lastAverage),s=this.unitsService.convertToUnit(t.convertUnitTo,e.data.lastMinimum),l=this.unitsService.convertToUnit(t.convertUnitTo,e.data.lastMaximum),f=this.chart.options.plugins.annotation?.annotations;f&&(Number.isFinite(r)&&f.averageLine?.value!==r&&(f.averageLine.value=r,f.averageLine.label.content=`${r.toFixed(t.numDecimal)}`),Number.isFinite(s)&&f.minimumLine?.value!==s&&(f.minimumLine.value=s,f.minimumLine.label.content=`${s.toFixed(t.numDecimal)}`),Number.isFinite(l)&&f.maximumLine?.value!==l&&(f.maximumLine.value=l,f.maximumLine.label.content=`${l.toFixed(t.numDecimal)}`))}transformDatasetRows(e,t){let i=this.runtime.options(),a=l=>this.unitsService.convertToUnit(i.convertUnitTo,l),r=i.verticalChart,s=i.datasetAverageArray;return e.map(l=>{if(r){if(t===0)return{x:a(l.data.value),y:l.timestamp};{let m={sma:l.data.sma,ema:l.data.ema,dema:l.data.doubleEma,avg:l.data.lastAverage};return{x:a(m[s]),y:l.timestamp}}}else{if(t===0)return{x:l.timestamp,y:a(l.data.value)};{let m={sma:l.data.sma,ema:l.data.ema,dema:l.data.doubleEma,avg:l.data.lastAverage};return{x:l.timestamp,y:a(m[s])}}}})}ngOnDestroy(){this.dsServiceSub?.unsubscribe(),this.chart?.destroy();let e=this.widgetDataChart?.()?.nativeElement;this.canvasService.releaseCanvas(e,{clear:!0,removeFromDom:!0})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-data-chart"]],viewQuery:function(t,i){t&1&&Me(i.widgetDataChart,pw,5,Ke),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:1,consts:[["widgetDataChart",""],[2,"z-index","inherit"],[1,"empty-state"],[1,"hint"]],template:function(t,i){t&1&&I(0,fw,2,0,"canvas",1)(1,gw,5,0,"div",2),t&2&&N(i.hasPath()?0:1)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.empty-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;width:100%;text-align:center;color:var(--mat-sys-on-surface-variant)}.empty-state[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:4px 0;padding:0 16px}.empty-state[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{font-size:.85em;opacity:.7}"]})}return n})();var tg=(()=>{class n{data=x(null,{alias:"controlData"});theme=x(null);dimensions=x.required();toggleClick=ut();toggleOff="0 35 180 35";toggleOn="0 0 180 35";ctrlState=null;ctrlColor="";oldTheme=null;viewBox=this.toggleOff;labelColor=null;valueColor=null;constructor(){}ngDoCheck(){let e=this.data();e.value!=this.ctrlState&&(this.ctrlState=e.value,this.viewBox=e.value?this.toggleOn:this.toggleOff),e.color!=this.ctrlColor&&(this.ctrlColor=e.color,this.getColors(e.color));let t=this.theme();this.oldTheme!=t&&(this.oldTheme=t,this.getColors(e.color))}toggle(e){let t=this.data();t.value=e,this.toggleClick.emit(t)}getColors(e){switch(e){case"contrast":this.labelColor=this.theme().contrastDim,this.valueColor=this.theme().contrast;break;case"blue":this.labelColor=this.theme().blueDim,this.valueColor=this.theme().blue;break;case"green":this.labelColor=this.theme().greenDim,this.valueColor=this.theme().green;break;case"pink":this.labelColor=this.theme().pinkDim,this.valueColor=this.theme().pink;break;case"orange":this.labelColor=this.theme().orangeDim,this.valueColor=this.theme().orange;break;case"purple":this.labelColor=this.theme().purpleDim,this.valueColor=this.theme().purple;break;case"grey":this.labelColor=this.theme().greyDim,this.valueColor=this.theme().grey;break;case"yellow":this.labelColor=this.theme().yellowDim,this.valueColor=this.theme().yellow;break;default:this.labelColor=this.theme().contrastDim,this.valueColor=this.theme().contrast;break}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["app-svg-boolean-light"]],inputs:{data:[1,"controlData","data"],theme:[1,"theme"],dimensions:[1,"dimensions"]},outputs:{toggleClick:"toggleClick"},decls:26,vars:9,consts:[["version","1.1","id","svg9","xmlns","http://www.w3.org/2000/svg",0,"xmlns","svg","http://www.w3.org/2000/svg"],["id","defs1"],["id","linearGradient32"],["offset","0","id","stop32",2,"stop-color","#000000","stop-opacity","0.88486844"],["offset","1","id","stop33",2,"stop-color","#f7f7f7","stop-opacity","0.17763157"],[0,"xlink","href","#linearGradient32","id","linearGradient33","x1","7.0431595","y1","17.869596","x2","39.043159","y2","17.869596","gradientUnits","userSpaceOnUse"],["id","disabled","transform","translate(0,35)"],["width","180","height","35","id","rect1-5","x","0","y","0",2,"display","inline","opacity","1","fill","black","fill-opacity","0","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","1"],["x","0","y","0","width","175","height","35","viewBox","0 0 175 35"],["id","text1-5","x","47.083984","y","22.636719",2,"text-align","center","font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","14px","font-family","arial","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["transform","translate(6,2)","id","disabledToogleControl"],["cx","18","cy","16","id","circle3-7","r","13.5",2,"stroke-width","5","stroke","url(#linearGradient33)","stroke-opacity","0.2","stroke-dasharray","none"],["id","enabled"],["width","180","height","35","id","rect1","x","0","y","0",2,"display","inline","opacity","1","fill","black","fill-opacity","0","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","1"],["id","glow","x","-50%","y","-50%","width","200%","height","200%"],["stdDeviation","2.5","result","coloredBlur"],["in","coloredBlur"],["in","SourceGraphic"],["filter","url(#glow)","id","text1","x","47.083984","y","22.636719",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","14px","font-family","arial","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["transform","translate(6,2)","id","enabledToogleControl"],["filter","url(#glow)","cx","18","cy","16","id","circle3","r","13.5",2,"stroke","url(#linearGradient33)","stroke-width","5","stroke-opacity","0.2","stroke-dasharray","none"]],template:function(t,i){t&1&&(ie(),D(0,"svg",0)(1,"defs",1)(2,"linearGradient",2),Q(3,"stop",3)(4,"stop",4),R(),Q(5,"linearGradient",5),R(),D(6,"g",6),Q(7,"rect",7),D(8,"svg",8)(9,"text",9),c(10),R()(),D(11,"g",10),Q(12,"circle",11),R()(),D(13,"g",12),Q(14,"rect",13),D(15,"svg",8)(16,"defs")(17,"filter",14),Q(18,"feGaussianBlur",15),D(19,"feMerge"),Q(20,"feMergeNode",16)(21,"feMergeNode",17),R()()(),D(22,"text",18),c(23),R()(),D(24,"g",19),Q(25,"circle",20),R()()()),t&2&&(J("height",i.dimensions().height)("width",i.dimensions().width)("viewBox",i.viewBox),g(9),J("fill",i.labelColor),g(),ge(" ",i.data().ctrlLabel," "),g(2),J("fill",i.labelColor),g(10),J("fill",i.valueColor),g(),ge("",i.data().ctrlLabel," "),g(2),J("fill",i.valueColor))},encapsulation:2})}return n})();var ig=(()=>{class n{data=x(null,{alias:"controlData"});theme=x(null);dimensions=x.required();toggleClick=ut();toggleOff="0 35 180 35";toggleOn="0 0 180 35";oldTheme=null;holdTimeoutId=null;emitIntervalId=null;pressed=!1;isSwiping=!1;pointerStartX=0;pointerStartY=0;viewBox=this.toggleOff;labelColorEnabled=null;labelColorDisabled=null;valueColor=null;ctrlColor="";ngDoCheck(){this.viewBox=this.pressed?this.toggleOn:this.toggleOff;let e=this.data();e.color!=this.ctrlColor&&(this.ctrlColor=e.color,this.getColors(e.color));let t=this.theme();this.oldTheme!=t&&(this.oldTheme=t,this.getColors(this.data().color))}handleClickDown(e){this.isSwiping=!1,this.pointerStartX=e.clientX,this.pointerStartY=e.clientY,this.clearTimers(),this.holdTimeoutId=setTimeout(()=>{if(!this.isSwiping){this.pressed=!0;let t=Ft(this.data());t.value=this.pressed,this.toggleClick.emit(t),this.emitIntervalId=setInterval(()=>{this.toggleClick.emit(t)},100)}},200)}handlePointerMove(e){let t=Math.abs(e.clientX-this.pointerStartX),i=Math.abs(e.clientY-this.pointerStartY);(t>30||i>30)&&(this.isSwiping=!0,this.holdTimeoutId&&(clearTimeout(this.holdTimeoutId),this.holdTimeoutId=null))}handleClickUp(){if(this.isSwiping){this.isSwiping=!1;return}this.pressed=!1,this.emitIntervalId&&(clearInterval(this.emitIntervalId),this.emitIntervalId=null),this.holdTimeoutId&&(clearTimeout(this.holdTimeoutId),this.holdTimeoutId=null)}getColors(e){switch(e){case"contrast":this.labelColorEnabled="black",this.labelColorDisabled=this.theme().contrastDim,this.valueColor=this.theme().contrast;break;case"blue":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().blueDim,this.valueColor=this.theme().blue;break;case"green":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().greenDim,this.valueColor=this.theme().green;break;case"pink":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().pinkDim,this.valueColor=this.theme().pink;break;case"orange":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().orangeDim,this.valueColor=this.theme().orange;break;case"purple":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().purpleDim,this.valueColor=this.theme().purple;break;case"grey":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().greyDim,this.valueColor=this.theme().grey;break;case"yellow":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().yellowDim,this.valueColor=this.theme().yellow;break;default:this.labelColorEnabled="black",this.labelColorDisabled=this.theme().contrastDim,this.valueColor=this.theme().contrast;break}}clearTimers(){this.holdTimeoutId&&(clearTimeout(this.holdTimeoutId),this.holdTimeoutId=null),this.emitIntervalId&&(clearInterval(this.emitIntervalId),this.emitIntervalId=null)}ngOnDestroy(){this.clearTimers()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["app-svg-boolean-button"]],inputs:{data:[1,"controlData","data"],theme:[1,"theme"],dimensions:[1,"dimensions"]},outputs:{toggleClick:"toggleClick"},decls:15,vars:9,consts:[["version","1.1","id","svg9","xmlns","http://www.w3.org/2000/svg",0,"xmlns","svg","http://www.w3.org/2000/svg"],["id","defs9"],[3,"pointerup","pointerleave","pointerdown","pointermove"],["id","disabled","transform","translate(0,35)"],["id","clickRecDisabled","width","180","height","35","x","0","y","0","pointer-events","all",2,"display","inline","opacity","1","fill","transparent","fill-opacity","1","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","0"],["id","buttonDisabled","width","165.02518","height","25.025183","rx","3.6672263","x","7.4874101","y","4.9874086",2,"display","inline","mix-blend-mode","normal","fill-opacity","1","stroke","#ffffff","stroke-width","1.5","stroke-dasharray","none","stroke-opacity","0.2"],["x","12","y","0","width","156","height","35","viewBox","0 0 156 35"],["id","textDisabled","x","77.968102","y","22",2,"text-anchor","middle","text-align","center","font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","14px","font-family","arial","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["id","enabled"],["width","180","height","35","id","rect1","x","0","y","0","pointer-events","all",2,"display","inline","opacity","1","fill","transparent","fill-opacity","1","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","0"],["id","buttonEnabled","width","165.02518","height","25.025183","rx","3.6672263","x","5.9874086","y","4.9874086","transform","translate(1.5)",2,"display","inline","opacity","1","mix-blend-mode","normal","stroke","#000000","stroke-width","1.5","stroke-dasharray","none","stroke-opacity","0.2"],["id","textEnabled","x","77.968102","y","22",2,"text-anchor","middle","text-align","center","font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","14px","font-family","arial","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"]],template:function(t,i){t&1&&(ie(),D(0,"svg",0),Q(1,"defs",1),D(2,"g",2),Oo("pointerup",function(){return i.handleClickUp()})("pointerleave",function(){return i.handleClickUp()})("pointerdown",function(r){return i.handleClickDown(r)})("pointermove",function(r){return i.handlePointerMove(r)}),D(3,"g",3),Q(4,"rect",4)(5,"rect",5),D(6,"svg",6)(7,"text",7),c(8),R()()(),D(9,"g",8),Q(10,"rect",9)(11,"rect",10),D(12,"svg",6)(13,"text",11),c(14),R()()()()()),t&2&&(J("height",i.dimensions().height)("width",i.dimensions().width)("viewBox",i.viewBox),g(5),J("fill",i.labelColorDisabled),g(2),J("fill",i.labelColorDisabled),g(),ge(" ",i.data().ctrlLabel," "),g(3),J("fill",i.valueColor),g(2),J("fill",i.labelColorEnabled),g(),ge(" ",i.data().ctrlLabel," "))},encapsulation:2})}return n})();function dl(n={}){let o=n.threshold??30,e=!1,t=0,i=0,a=null,r=null,s=()=>{e=!1,t=0,i=0,a=null,r=null};return{onPointerDown(l){e=!1,t=l.clientX,i=l.clientY;let m=l.currentTarget;if(m&&typeof m.setPointerCapture=="function")try{m.setPointerCapture(l.pointerId),a=m,r=l.pointerId}catch(f){}},onPointerMove(l){let m=Math.abs(l.clientX-t),f=Math.abs(l.clientY-i);(m>o||f>o)&&(e=!0)},onPointerUp(l){if(a&&r!==null){let f=a;if(typeof f.releasePointerCapture=="function")try{(!l||f.hasPointerCapture?.(r))&&f.releasePointerCapture(r)}catch(b){}}let m=!e;return s(),m},onPointerCancel(l){if(a&&r!==null){let m=a;if(typeof m.releasePointerCapture=="function")try{(!l||m.hasPointerCapture?.(r))&&m.releasePointerCapture(r)}catch(f){}}s()},reset:s}}var ng=(()=>{class n{data=x(null,{alias:"controlData"});theme=x(null);dimensions=x.required();toggleClick=ut();toggleOff="0 35 180 35";toggleOn="0 0 180 35";ctrlState=null;oldTheme=null;swipeGuard=dl();viewBox=this.toggleOff;labelColor=null;valueColor=null;ctrlColor="";constructor(){}ngDoCheck(){let e=this.data();e.value!=this.ctrlState&&(this.ctrlState=e.value,this.viewBox=e.value?this.toggleOn:this.toggleOff),e.color!=this.ctrlColor&&(this.ctrlColor=e.color,this.getColors(e.color));let t=this.theme();this.oldTheme!=t&&(this.oldTheme=t,this.getColors(e.color))}onPointerDown(e){this.swipeGuard.onPointerDown(e)}onPointerMove(e){this.swipeGuard.onPointerMove(e)}onPointerUp(e,t){this.swipeGuard.onPointerUp(e)&&this.toggle(t)}onPointerCancel(e){this.swipeGuard.onPointerCancel(e)}toggle(e){let t=this.data();t.value=e,this.toggleClick.emit(t)}getColors(e){switch(e){case"contrast":this.labelColor=this.theme().contrastDim,this.valueColor=this.theme().contrast;break;case"blue":this.labelColor=this.theme().blueDim,this.valueColor=this.theme().blue;break;case"green":this.labelColor=this.theme().greenDim,this.valueColor=this.theme().green;break;case"pink":this.labelColor=this.theme().pinkDim,this.valueColor=this.theme().pink;break;case"orange":this.labelColor=this.theme().orangeDim,this.valueColor=this.theme().orange;break;case"purple":this.labelColor=this.theme().purpleDim,this.valueColor=this.theme().purple;break;case"grey":this.labelColor=this.theme().greyDim,this.valueColor=this.theme().grey;break;case"yellow":this.labelColor=this.theme().yellowDim,this.valueColor=this.theme().yellow;break;default:this.labelColor=this.theme().contrastDim,this.valueColor=this.theme().contrast;break}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["app-svg-boolean-switch"]],inputs:{data:[1,"controlData","data"],theme:[1,"theme"],dimensions:[1,"dimensions"]},outputs:{toggleClick:"toggleClick"},decls:24,vars:10,consts:[["version","1.1","id","svg9","xmlns","http://www.w3.org/2000/svg",0,"xmlns","svg","http://www.w3.org/2000/svg"],["id","defs9"],["id","disabled","transform","translate(0,35)",3,"pointerdown","pointermove","pointerup","pointercancel"],["width","180","height","35","id","rect1-5","x","0","y","0","pointer-events","all",2,"display","inline","opacity","0.001","fill","black","fill-opacity","0.001","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","0"],["x","0","y","0","width","175","height","35","viewBox","0 0 175 35"],["id","text1-5","x","47.083984","y","22.636719",2,"text-align","center","font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","14px","font-family","arial","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["transform","translate(6,2)","id","disabledToogleControl"],["width","37.714306","height","22","rx","10.999999","id","rect3-4","x","0","y","5",2,"stroke-width","1.57144","fill","var(--mat-sys-outline)","fill-opacity","1"],["cx","11.5","cy","16","id","circle3-7","r","10",2,"stroke-width","1.5","stroke","black","stroke-opacity","0.2","stroke-dasharray","none"],["id","enabled",3,"pointerdown","pointermove","pointerup","pointercancel"],["width","180","height","35","id","rect1","x","0","y","0","pointer-events","all",2,"display","inline","opacity","0.001","fill","black","fill-opacity","0.001","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","0"],["id","glow","x","-50%","y","-50%","width","200%","height","200%"],["stdDeviation","2.5","result","coloredBlur"],["in","coloredBlur"],["in","SourceGraphic"],["filter","url(#glow)","id","text1","x","47.083984","y","22.636719",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","14px","font-family","arial","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["transform","translate(6,2)","id","enabledToogleControl"],["filter","url(#glow)","width","37.714306","height","22","rx","10.999999","id","rect3","x","0","y","5",2,"stroke-width","1.57144"],["cx","26.5","cy","16","id","circle3","r","10",2,"stroke-width","1.5","stroke","black","stroke-opacity","0.2","stroke-dasharray","none"]],template:function(t,i){t&1&&(ie(),D(0,"svg",0),Q(1,"defs",1),D(2,"g",2),Oo("pointerdown",function(r){return i.onPointerDown(r)})("pointermove",function(r){return i.onPointerMove(r)})("pointerup",function(r){return i.onPointerUp(r,!0)})("pointercancel",function(r){return i.onPointerCancel(r)}),Q(3,"rect",3),D(4,"svg",4)(5,"text",5),c(6),R()(),D(7,"g",6),Q(8,"rect",7)(9,"circle",8),R()(),D(10,"g",9),Oo("pointerdown",function(r){return i.onPointerDown(r)})("pointermove",function(r){return i.onPointerMove(r)})("pointerup",function(r){return i.onPointerUp(r,!1)})("pointercancel",function(r){return i.onPointerCancel(r)}),Q(11,"rect",10),D(12,"svg",4)(13,"defs")(14,"filter",11),Q(15,"feGaussianBlur",12),D(16,"feMerge"),Q(17,"feMergeNode",13)(18,"feMergeNode",14),R()()(),D(19,"text",15),c(20),R()(),D(21,"g",16),Q(22,"rect",17)(23,"circle",18),R()()()),t&2&&(J("height",i.dimensions().height)("width",i.dimensions().width)("viewBox",i.viewBox),g(5),J("fill",i.labelColor),g(),ge(" ",i.data().ctrlLabel," "),g(3),J("fill",i.labelColor),g(10),J("fill",i.valueColor),g(),ge("",i.data().ctrlLabel," "),g(2),J("fill",i.labelColor),g(),J("fill",i.valueColor))},encapsulation:2})}return n})();function vw(n,o){if(n&1&&F(0,"widget-title",1),n&2){let e=k(),t=gn(0);O("text",t==null?null:t.displayName)("color",e.labelColor())}}function bw(n,o){if(n&1){let e=Se();d(0,"app-svg-boolean-switch",5),U("toggleClick",function(i){ee(e);let a=k(2);return te(a.toggle(i))}),u()}if(n&2){let e=k().$implicit,t=k();O("controlData",e)("theme",t.theme())("dimensions",t.ctrlDimensions)}}function Aw(n,o){if(n&1){let e=Se();d(0,"app-svg-boolean-button",5),U("toggleClick",function(i){ee(e);let a=k(2);return te(a.toggle(i))}),u()}if(n&2){let e=k().$implicit,t=k();O("controlData",e)("theme",t.theme())("dimensions",t.ctrlDimensions)}}function yw(n,o){if(n&1){let e=Se();d(0,"app-svg-boolean-light",5),U("toggleClick",function(i){ee(e);let a=k(2);return te(a.toggle(i))}),u()}if(n&2){let e=k().$implicit,t=k();O("controlData",e)("theme",t.theme())("dimensions",t.ctrlDimensions)}}function xw(n,o){if(n&1&&(Xi(0),I(1,bw,1,3,"app-svg-boolean-switch",4)(2,Aw,1,3,"app-svg-boolean-button",4)(3,yw,1,3,"app-svg-boolean-light",4),Ki()),n&2){let e,t=o.$implicit;g(),N((e=t.type)==="1"?1:e==="2"?2:e==="3"?3:-1)}}function Cw(n,o){n&1&&F(0,"div",3)}var ag=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={displayName:"Switch Panel Label",showLabel:!0,filterSelfPaths:!0,paths:[],enableTimeout:!1,dataTimeout:5,color:"contrast",zonesOnlyPaths:!1,putEnable:!0,putMomentary:!1,multiChildCtrls:[]};cdr=y(Ci);ngZone=y(Be);runtime=y(we,{optional:!0});streams=y(Le,{optional:!0});dashboard=y(ft);signalkRequestsService=y(ri);toast=y(en);switchControls=_([]);labelColor=_(void 0);noTitleClass=K(()=>this.runtime?.options()?.showLabel===!1?"widgets-container-no-title":"widgets-container");nbCtrl=null;ctrlDimensions={width:0,height:0};skRequestSub=new Fa;constructor(){L(()=>{let e=this.theme(),t=this.runtime?.options();!e||!t||B(()=>{this.labelColor.set(Te(t.color,e).dim)})}),L(()=>{let e=this.runtime?.options();if(!e)return;let t=(e.multiChildCtrls||[]).map(i=>fe(ae({},i),{isNumeric:i.isNumeric??!1}));this.nbCtrl=t.length,B(()=>{this.switchControls.set(t),this.streams&&t.forEach(i=>{let a=e.paths;if(!a?.length)return;let r=a.findIndex(l=>l.pathID===i.pathID);r<0||!a[r]?.path||this.streams.observe(String(r),l=>{let m=l?.data?.value,f=i.isNumeric?[0,1,null].includes(m)?!!m:i.value:m;this.ngZone.run(()=>{this.switchControls.update(b=>{let A=b.findIndex(w=>w.pathID===i.pathID);if(A===-1)return b;let C=fe(ae({},b[A]),{value:f});return[...b.slice(0,A),C,...b.slice(A+1)]}),this.cdr.markForCheck()})})})})})}onResized(e){let t=this.nbCtrl||1,i=e.contentRect.height/t,a=35*e.contentRect.width/180,r=a<i?a:i;this.ctrlDimensions={width:e.contentRect.width,height:r}}toggle(e){let t=this.runtime?.options();if(!t?.putEnable)return;let i=t.paths;if(!i)return;let a=i.findIndex(s=>s.pathID===e.pathID);if(a<0)return;let r=i[a].path;r&&(e.isNumeric?this.signalkRequestsService.putRequest(r,e.value?1:0,this.id()):this.signalkRequestsService.putRequest(r,e.value,this.id()))}ngOnDestroy(){this.skRequestSub?.unsubscribe()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-boolean-switch"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:7,vars:5,consts:[["widgetContainer",""],[3,"text","color"],["kipResizeObserver","",3,"resizeChange"],[1,"widgetOverlay"],[1,"svg-widget",3,"controlData","theme","dimensions"],[1,"svg-widget",3,"toggleClick","controlData","theme","dimensions"]],template:function(t,i){if(t&1&&(ha(0),I(1,vw,1,2,"widget-title",1),d(2,"div",2,0),U("resizeChange",function(r){return i.onResized(r)}),xe(4,xw,4,1,"ng-container",null,Ne),u(),I(6,Cw,1,0,"div",3)),t&2){let a=fn(i.runtime==null?null:i.runtime.options());g(),N(a!=null&&a.showLabel?1:-1),g(),it(i.noTitleClass()),g(2),Ce(i.switchControls()),g(2),N(i.dashboard.isDashboardStatic()?-1:6)}},dependencies:[jt,ng,ig,tg,Zn],styles:[".widgets-container[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;z-index:20}.widgets-container-no-title[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;padding:3px 0 0;height:100%;width:100%;overflow:hidden;z-index:20}.svg-widget[_ngcontent-%COMP%]{display:flex}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}"]})}return n})();var og=(n,o)=>o.raw.value;function Sw(n,o){if(n&1&&F(0,"widget-title",0),n&2){let e=k();O("text",e.displayName())("color",e.accentColor())}}function ww(n,o){if(n&1&&(ie(),F(0,"path")),n&2){let e=k().$implicit,t=k();it(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("d",t.fullRoundedItemPathD())("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function _w(n,o){if(n&1&&(ie(),F(0,"path")),n&2){let e=k().$implicit,t=k();it(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("d",t.topRoundedItemPathD())("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Mw(n,o){if(n&1&&(ie(),F(0,"path")),n&2){let e=k().$implicit,t=k();it(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("d",t.bottomRoundedItemPathD())("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function kw(n,o){if(n&1&&(ie(),F(0,"rect",18)),n&2){let e=k().$implicit,t=k();it(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("width",t.menuWidth)("height",t.itemHeight)("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Tw(n,o){if(n&1){let e=Se();ie(),d(0,"g",15),U("pointerdown",function(i){ee(e);let a=k();return te(a.onPointerDown(i))})("pointermove",function(i){ee(e);let a=k();return te(a.onPointerMove(i))})("pointerup",function(i){let a=ee(e).$implicit,r=k();return te(r.onPointerUp(i,a))})("pointercancel",function(i){ee(e);let a=k();return te(a.onPointerCancel(i))})("keyup.enter",function(){let i=ee(e).$implicit,a=k();return te(a.canPut()&&a.selectUi(i))})("keyup.space",function(){let i=ee(e).$implicit,a=k();return te(a.canPut()&&a.selectUi(i))}),I(1,ww,1,4,":svg:path",16)(2,_w,1,4,":svg:path",16)(3,Mw,1,4,":svg:path",16)(4,kw,1,5,":svg:rect",17),d(5,"text"),c(6),u()()}if(n&2){let e=o.$implicit,t=k();be("cursor",t.canPut()?"pointer":"not-allowed"),st("is-selected",t.isSelected(e.raw))("is-off",e.raw.isOn===!1),J("transform","translate(0 "+e.index*(t.itemHeight+t.itemGap)+")")("tabindex",t.canPut()?0:-1)("aria-label",e.label)("aria-pressed",t.isSelected(e.raw))("aria-disabled",!t.canPut()),g(),N(e.index===0&&e.index===t.optionsCount()-1?1:e.index===0?2:e.index===t.optionsCount()-1?3:4),g(4),it(t.isSelected(e.raw)?"svg-menu-item-current-text":e.raw.isOn===!1?"svg-menu-item-off-text":"svg-menu-item-text"),J("x",t.menuWidth/2)("y",t.itemHeight/2)("filter",t.isSelected(e.raw)?"url(#glow)":null)("fill",(t.isSelected(e.raw)||e.raw.isOn===!1,t.textColor())),g(),Ut(" ",t.isSelected(e.raw)?"\u2713 ":"","",e.label," ")}}function Ew(n,o){if(n&1&&(ie(),F(0,"path")),n&2){let e=k().$implicit,t=k();it(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("d",t.fullRoundedItemPathD())("filter",t.isSelected(e.raw)?"url(#glow)":null)("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Dw(n,o){if(n&1&&(ie(),F(0,"path")),n&2){let e=k().$implicit,t=k();it(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("d",t.topRoundedItemPathD())("filter",t.isSelected(e.raw)?"url(#glow)":null)("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Pw(n,o){if(n&1&&(ie(),F(0,"path")),n&2){let e=k().$implicit,t=k();it(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("d",t.bottomRoundedItemPathD())("filter",t.isSelected(e.raw)?"url(#glow)":null)("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Iw(n,o){if(n&1&&(ie(),F(0,"rect",18)),n&2){let e=k().$implicit,t=k();it(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("width",t.menuWidth)("height",t.itemHeight)("filter",t.isSelected(e.raw)?"url(#glow)":null)("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Nw(n,o){if(n&1){let e=Se();ie(),d(0,"g",15),U("pointerdown",function(i){ee(e);let a=k();return te(a.onPointerDown(i))})("pointermove",function(i){ee(e);let a=k();return te(a.onPointerMove(i))})("pointerup",function(i){let a=ee(e).$implicit,r=k();return te(r.onPointerUp(i,a))})("pointercancel",function(i){ee(e);let a=k();return te(a.onPointerCancel(i))})("keyup.enter",function(){let i=ee(e).$implicit,a=k();return te(a.canPut()&&a.selectUi(i))})("keyup.space",function(){let i=ee(e).$implicit,a=k();return te(a.canPut()&&a.selectUi(i))}),I(1,Ew,1,5,":svg:path",16)(2,Dw,1,5,":svg:path",16)(3,Pw,1,5,":svg:path",16)(4,Iw,1,6,":svg:rect",17),d(5,"text"),c(6),u()()}if(n&2){let e=o.$implicit,t=k();be("cursor",t.canPut()?"pointer":"not-allowed"),st("is-selected",t.isSelected(e.raw))("is-off",e.raw.isOn===!1),J("transform","translate(0 "+e.index*(t.itemHeight+t.itemGap)+")")("tabindex",t.canPut()?0:-1)("aria-label",e.label)("aria-pressed",t.isSelected(e.raw))("aria-disabled",!t.canPut()),g(),N(e.index===0&&e.index===t.optionsCount()-1?1:e.index===0?2:e.index===t.optionsCount()-1?3:4),g(4),it(t.isSelected(e.raw)?"svg-menu-item-current-text":e.raw.isOn===!1?"svg-menu-item-off-text":"svg-menu-item-text"),J("x",t.menuWidth/2)("y",t.itemHeight/2)("filter",t.isSelected(e.raw)?"url(#glow)":null)("fill",(t.isSelected(e.raw)||e.raw.isOn===!1,t.textColor())),g(),Ut(" ",t.isSelected(e.raw)?"\u2713 ":"","",e.label," ")}}function Rw(n,o){n&1&&F(0,"div",14)}var rg=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={displayName:"Switch Label",showLabel:!0,filterSelfPaths:!0,paths:{controlPath:{description:"Multi-state control path",path:null,source:null,pathType:"multiple",supportsPut:!0,isPathConfigurable:!0,pathRequired:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:null,showConvertUnitTo:!1,convertUnitTo:null,sampleTime:500}},enableTimeout:!1,dataTimeout:5,color:"contrast"};runtime=y(we);streams=y(Le);meta=y(ci);signalkRequestsService=y(ri);dashboard=y(ft);toast=y(en);skRequest=_i(this.signalkRequestsService.subscribeRequest(),{initialValue:null});cfg=K(()=>this.runtime.options());displayName=K(()=>this.cfg()?.displayName);showLabel=K(()=>this.cfg()?.showLabel);controlPath=K(()=>this.getControlPath(this.cfg()));accentColor=_(void 0);accentDim=_(void 0);accentDimmer=_(void 0);textColor=_(void 0);textDim=_(void 0);textDimmer=_(void 0);currentValue=_(null);sortedOptions=K(()=>{let e=this.meta.possibleValues();if(!e.length)return[];let t=e.map(i=>({raw:i,label:i.title||i.abbrev||String(i.value),comparable:this.toComparable(i.value)}));return t.sort((i,a)=>{let r=i.comparable,s=a.comparable;return r.kind==="num"&&s.kind==="num"?r.value-s.value:r.kind==="str"&&s.kind==="str"?r.value.localeCompare(s.value):r.kind==="num"?-1:1}),t.map((i,a)=>fe(ae({},i),{index:a}))});menuWidth=220;itemHeight=50;itemGap=1;svgPadding=Math.max(1,Math.round(this.itemHeight*.2));optionsCount=K(()=>this.sortedOptions().length);menuHeight=K(()=>{let e=this.sortedOptions().length;return e<=0?0:e*this.itemHeight+(e-1)*this.itemGap});hasOptions=K(()=>this.meta.possibleValues().length>0);selectedValue=K(()=>this.currentValue());canPut=K(()=>this.meta.supportsPut());swipeGuard=dl();unselectedOptions=K(()=>this.sortedOptions().filter(e=>!this.isSelected(e.raw)));selectedOptions=K(()=>this.sortedOptions().filter(e=>this.isSelected(e.raw)));fullRoundedItemPathD=K(()=>this.buildRoundedRectPath(this.menuWidth,this.itemHeight,this.cornerRadius,!0,!0));topRoundedItemPathD=K(()=>this.buildRoundedRectPath(this.menuWidth,this.itemHeight,this.cornerRadius,!0,!1));bottomRoundedItemPathD=K(()=>this.buildRoundedRectPath(this.menuWidth,this.itemHeight,this.cornerRadius,!1,!0));cornerRadius=7;constructor(){L(()=>{let e=this.theme(),t=this.cfg().color;!e||!t||B(()=>{this.accentColor.set(Te(t,e).color),this.accentDim.set(Te(t,e).dim),this.accentDimmer.set(Te(t,e).dimmer),t==="contrast"?(this.textColor.set(e.background),this.textDim.set(e.contrastDim),this.textDimmer.set(e.contrastDimmer)):(this.textColor.set(e.contrast),this.textDim.set(Te(t,e).dim),this.textDimmer.set(Te(t,e).dimmer))})}),L(()=>{if(!this.controlPath()){this.currentValue.set(null);return}B(()=>{this.streams.observe("controlPath",t=>{this.currentValue.set(t?.data?.value??null)}),this.meta.observe("controlPath")})})}select(e){let t=this.getControlPath(this.cfg());t&&this.signalkRequestsService.putRequest(t,e.value,this.id())}selectUi(e){this.select(e.raw)}onPointerDown(e){this.canPut()&&this.swipeGuard.onPointerDown(e)}onPointerMove(e){this.canPut()&&this.swipeGuard.onPointerMove(e)}onPointerUp(e,t){this.canPut()&&this.swipeGuard.onPointerUp(e)&&this.selectUi(t)}onPointerCancel(e){this.swipeGuard.onPointerCancel(e)}getControlPath(e){let t=e?.paths;return!t||Array.isArray(t)?null:t.controlPath?.path??null}isSelected(e){let t=this.selectedValue();return typeof e.value=="number"&&typeof t=="string"?e.value===Number(t):typeof e.value=="string"&&typeof t=="number"?Number(e.value)===t||e.value===String(t):Object.is(e.value,t)}toComparable(e){if(typeof e=="number"&&Number.isFinite(e))return{kind:"num",value:e};if(typeof e=="boolean")return{kind:"num",value:e?1:0};if(typeof e=="string"){let t=e.trim();if(/^-?\d+(\.\d+)?$/.test(t)){let i=Number(t);if(Number.isFinite(i))return{kind:"num",value:i}}return{kind:"str",value:t}}return{kind:"str",value:String(e)}}buildRoundedRectPath(e,t,i,a,r){let s=Math.max(0,e),l=Math.max(0,t),m=Math.max(0,Math.min(i,s/2,l/2));return s===0||l===0?"":m===0?`M0 0H${s}V${l}H0Z`:a&&r?[`M${m} 0`,`H${s-m}`,`A${m} ${m} 0 0 1 ${s} ${m}`,`V${l-m}`,`A${m} ${m} 0 0 1 ${s-m} ${l}`,`H${m}`,`A${m} ${m} 0 0 1 0 ${l-m}`,`V${m}`,`A${m} ${m} 0 0 1 ${m} 0`,"Z"].join(""):a?[`M0 ${m}`,`A${m} ${m} 0 0 1 ${m} 0`,`H${s-m}`,`A${m} ${m} 0 0 1 ${s} ${m}`,`V${l}`,"H0","Z"].join(""):r?["M0 0",`H${s}`,`V${l-m}`,`A${m} ${m} 0 0 1 ${s-m} ${l}`,`H${m}`,`A${m} ${m} 0 0 1 0 ${l-m}`,"V0","Z"].join(""):`M0 0H${s}V${l}H0Z`}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-multi-state-switch"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:23,vars:6,consts:[[3,"text","color"],["role","group",1,"widgets-container"],["preserveAspectRatio","xMidYMid meet","role","presentation",1,"svg-menu"],["id","glow","x","-50%","y","-50%","width","200%","height","200%"],["stdDeviation","5","result","coloredBlur"],["in","coloredBlur"],["in","SourceGraphic"],["id","focus-inner-ring","x","0","y","0","width","100%","height","100%","color-interpolation-filters","sRGB"],["in","SourceAlpha","operator","erode","radius","2","result","eroded"],["in","SourceAlpha","in2","eroded","operator","out","result","border"],["flood-color","#ffffff","flood-opacity","0.9","result","ringColor"],["in","ringColor","in2","border","operator","in","result","ring"],["in","ring"],["role","button",1,"svg-menu-item-group",3,"is-selected","is-off","cursor"],[1,"widgetOverlay"],["role","button",1,"svg-menu-item-group",3,"pointerdown","pointermove","pointerup","pointercancel","keyup.enter","keyup.space"],[3,"class"],["x","0","y","0",3,"class"],["x","0","y","0"]],template:function(t,i){t&1&&(I(0,Sw,1,2,"widget-title",0),d(1,"div",1),ie(),d(2,"svg",2)(3,"defs")(4,"filter",3),F(5,"feGaussianBlur",4),d(6,"feMerge"),F(7,"feMergeNode",5)(8,"feMergeNode",6),u()(),d(9,"filter",7),F(10,"feMorphology",8)(11,"feComposite",9)(12,"feFlood",10)(13,"feComposite",11),d(14,"feMerge"),F(15,"feMergeNode",6)(16,"feMergeNode",12),u()()(),d(17,"g"),xe(18,Tw,7,20,":svg:g",13,og),xe(20,Nw,7,20,":svg:g",13,og),u()()(),I(22,Rw,1,0,"div",14)),t&2&&(N(i.showLabel()?0:-1),g(),J("aria-label",i.displayName()),g(),J("viewBox","0 0 "+(i.menuWidth+i.svgPadding*2)+" "+((i.menuHeight()||i.itemHeight)+i.svgPadding*2))("aria-label",i.displayName()),g(15),J("transform","translate("+i.svgPadding+" "+i.svgPadding+")"),g(),Ce(i.unselectedOptions()),g(2),Ce(i.selectedOptions()),g(2),N(i.dashboard.isDashboardStatic()?-1:22))},dependencies:[Zn],styles:["[_nghost-%COMP%]{display:block;height:100%}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}.widgets-container[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;padding:2px}.svg-menu[_ngcontent-%COMP%]{width:100%;height:100%;display:block;background:transparent;border-radius:12px;z-index:20;font-family:Roboto;font-size:1.3rem;font-weight:700;text-anchor:middle;text-align:center;alignment-baseline:middle}.svg-menu-item-current[_ngcontent-%COMP%]{stroke:var(--mat-sys-on-background);stroke-width:3px;stroke-dasharray:none;stroke-opacity:1}.svg-menu-item[_ngcontent-%COMP%]{fill:var(--mat-sys-outline);stroke:#000;stroke-width:2px;stroke-dasharray:none;stroke-opacity:.2}.svg-menu-item-off[_ngcontent-%COMP%]{stroke:#000;stroke-width:2;stroke-dasharray:none;stroke-opacity:.2}.svg-menu-item-current-text[_ngcontent-%COMP%]{font-size:1.5rem;font-weight:700;text-anchor:middle;dominant-baseline:middle;alignment-baseline:middle}.svg-menu-item-text[_ngcontent-%COMP%], .svg-menu-item-off-text[_ngcontent-%COMP%]{font-weight:600;text-anchor:middle;dominant-baseline:middle;alignment-baseline:middle}.svg-menu-item-group[_ngcontent-%COMP%]:focus{outline:none}.svg-menu-item-group[_ngcontent-%COMP%]:focus-visible :is(rect[_ngcontent-%COMP%], path[_ngcontent-%COMP%]){filter:url(#focus-inner-ring)}"],changeDetection:0})}return n})();var sg=(()=>{class n{data=x(null,{alias:"controlData"});theme=x(null);dimensions=x.required();toggleClick=ut();ctrlLabelColor=_(null);ctrlStateColor=_(null);messageTxtColor=_(null);shouldEmergencyBlink=K(()=>(this.data()?.notificationState??"").toLowerCase()==="emergency");shouldAlarmBlink=K(()=>(this.data()?.notificationState??"").toLowerCase()==="alarm");constructor(){L(()=>{let e=this.data(),t=this.theme();B(()=>{switch(e.notificationState){case Ae.Emergency:this.ctrlStateColor.set(t.zoneEmergency),this.messageTxtColor.set(t.background);break;case Ae.Alarm:this.ctrlStateColor.set(t.zoneAlarm),this.messageTxtColor.set(t.background);break;case Ae.Warn:this.ctrlStateColor.set(t.zoneWarn),this.messageTxtColor.set(t.background);break;case Ae.Alert:this.ctrlStateColor.set(t.zoneAlert),this.messageTxtColor.set(t.background);break;default:this.ctrlStateColor.set(t.background),this.messageTxtColor.set(Te(e.color,t).dim);break}this.ctrlLabelColor.set(Te(e.color,t).color)})})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["app-svg-zone-states"]],inputs:{data:[1,"controlData","data"],theme:[1,"theme"],dimensions:[1,"dimensions"]},outputs:{toggleClick:"toggleClick"},decls:12,vars:14,consts:[["viewBox","0 0 180 75","version","1.1","id","svg9","xmlns","http://www.w3.org/2000/svg",0,"xmlns","svg","http://www.w3.org/2000/svg"],["id","defs9"],["id","zoneStateCtrl"],["id","touchRect","width","180","height","75","x","0","y","0","pointer-events","all",2,"display","inline","opacity","1","fill","transparent","fill-opacity","1","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","0"],["x","0","y","0","width","180","height","20"],["xmlns","http://www.w3.org/1999/xhtml",2,"width","180px","height","20px","display","flex","align-items","center","justify-content","center","font-weight","bold","font-size","14px","line-height","1.1","text-align","center","overflow","hidden","word-break","break-word","white-space","normal"],["id","outlineRect","x","6","y","22","width","168","height","43","rx","3.5","fill","none",2,"display","inline","opacity","1","mix-blend-mode","normals","stroke-width","1","stroke-dasharray","none","stroke-opacity","0.65"],["id","innerRect","x","7","y","23","width","166","height","41","rx","3.5",2,"display","inline","opacity","1","mix-blend-mode","normal","stroke","none","stroke-width","0"],["x","7","y","23","width","166","height","41"],["xmlns","http://www.w3.org/1999/xhtml",2,"width","166px","height","41px","display","flex","align-items","center","justify-content","center","font-weight","regular","font-size","12px","line-height","1.1","text-align","center","overflow","hidden","word-break","break-word","white-space","normal","padding","2px"]],template:function(t,i){t&1&&(ie(),D(0,"svg",0),Q(1,"defs",1),D(2,"g",2),Q(3,"rect",3),D(4,"foreignObject",4),Ge(),D(5,"div",5),c(6),R()(),ie(),Q(7,"rect",6)(8,"rect",7),D(9,"foreignObject",8),Ge(),D(10,"div",9),c(11),R()()()()),t&2&&(J("height",i.dimensions().height)("width",i.dimensions().width),g(5),be("color",i.ctrlLabelColor()),g(),ge(" ",i.data().ctrlLabel," "),g(),J("stroke",i.ctrlLabelColor()),g(),st("emergency-blink-fill",i.shouldEmergencyBlink())("alarm-blink-fill",i.shouldAlarmBlink()),J("fill",i.ctrlStateColor()),g(2),be("color",i.messageTxtColor()),g(),ge(" ",i.data().notificationMessage," "))},styles:["@keyframes _ngcontent-%COMP%_AlarmBlinkFill{0%,49%{opacity:1}50%,to{opacity:.6}}.alarm-blink-fill[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_AlarmBlinkFill 1s step-end infinite}@keyframes _ngcontent-%COMP%_EmergencyBlinkFill{0%,49%{opacity:1}50%,to{opacity:.1}}.emergency-blink-fill[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_EmergencyBlinkFill .3s step-end infinite}"]})}return n})();function Ow(n,o){if(n&1&&F(0,"widget-title",1),n&2){let e=k(),t=gn(0);O("text",t==null?null:t.displayName)("color",e.labelColor())}}function Vw(n,o){if(n&1&&F(0,"app-svg-zone-states",4),n&2){let e=k().$implicit,t=k();O("controlData",e)("theme",t.theme())("dimensions",t.ctrlDimensions())}}function Lw(n,o){if(n&1&&(Xi(0),I(1,Vw,1,3,"app-svg-zone-states",4),Ki()),n&2){let e,t=o.$implicit;g(),N((e=t.type)==="4"?1:-1)}}function Ww(n,o){n&1&&F(0,"div",3)}var lg=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={displayName:"Zones State Panel Label",showLabel:!0,filterSelfPaths:!0,paths:[],enableTimeout:!1,dataTimeout:5,color:"contrast",putEnable:!1,zonesOnlyPaths:!0,putMomentary:!1,multiChildCtrls:[]};cdr=y(Ci);ngZone=y(Be);runtime=y(we,{optional:!0});notificationsService=y(Fu);dashboard=y(ft);notifications=_i(this.notificationsService.observeNotifications());zonesControls=_([]);labelColor=_(void 0);noTitleClass=K(()=>this.runtime?.options()?.showLabel===!1?"widgets-container-no-title":"widgets-container");pathIdToNotificationPath=new Map;hostSize=_(null);ctrlDimensions=K(()=>{let e=this.hostSize();if(!e)return{width:0,height:0};let t=Math.max(1,this.zonesControls().length),i=e.height/t,a=75*e.width/180,r=Math.min(a,i);return{width:e.width,height:r}});constructor(){L(()=>{let e=this.theme(),t=this.runtime?.options();!e||!t||(B(()=>{this.labelColor.set(Te(t.color,e).dim)}),this.cdr.markForCheck())}),L(()=>{let e=this.runtime?.options();e&&(B(()=>{let t=(e.multiChildCtrls||[]).map(a=>fe(ae({},a),{isNumeric:a.isNumeric??!1}));this.zonesControls.set(t);let i=e.paths;if(i?.length){this.pathIdToNotificationPath.clear();for(let a of i){if(!a?.pathID||!a?.path)continue;let r=a.path.replace(/^self(\.|$)/,"notifications$1");this.pathIdToNotificationPath.set(a.pathID,r)}this.applyNotificationsSnapshot(this.notifications())}}),this.cdr.markForCheck())}),L(()=>{let e=this.notifications();B(()=>this.applyNotificationsSnapshot(e))})}applyNotificationsSnapshot(e){if(!this.pathIdToNotificationPath.size||!e?.length)return;let t=new Map;for(let i of e)i?.path&&t.set(i.path,i);this.ngZone.run(()=>{let i=!1;this.zonesControls.update(a=>{let r=null;for(let s=0;s<a.length;s++){let l=a[s],m=this.pathIdToNotificationPath.get(l.pathID),f=m?t.get(m):void 0;if(!f)continue;let b=f.value?.state,A=f.value?.message;l.notificationState===b&&l.notificationMessage===A||(r||(r=[...a]),r[s]=fe(ae({},l),{notificationState:b,notificationMessage:A}),i=!0)}return r??a}),i&&this.cdr.markForCheck()})}onResized(e){this.hostSize.set({width:e.contentRect.width,height:e.contentRect.height}),this.cdr.markForCheck()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-zones-state-panel"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:7,vars:5,consts:[["widgetContainer",""],[3,"text","color"],["kipResizeObserver","",3,"resizeChange"],[1,"widgetOverlay"],[1,"svg-widget",3,"controlData","theme","dimensions"]],template:function(t,i){if(t&1&&(ha(0),I(1,Ow,1,2,"widget-title",1),d(2,"div",2,0),U("resizeChange",function(r){return i.onResized(r)}),xe(4,Lw,2,1,"ng-container",null,Ne),u(),I(6,Ww,1,0,"div",3)),t&2){let a=fn(i.runtime==null?null:i.runtime.options());g(),N(a!=null&&a.showLabel?1:-1),g(),it(i.noTitleClass()),g(2),Ce(i.zonesControls()),g(2),N(i.dashboard.isDashboardStatic()?-1:6)}},dependencies:[jt,sg,Zn],styles:[".widgets-container[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;z-index:20}.widgets-container-no-title[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;padding:6px 0 0;height:100%;width:100%;overflow:hidden;z-index:20}.svg-widget[_ngcontent-%COMP%]{display:flex}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}"]})}return n})();var dg="mat-badge-content",Fw=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["ng-component"]],decls:0,vars:0,template:function(t,i){},styles:[`.mat-badge{position:relative}.mat-badge.mat-badge{overflow:visible}.mat-badge-content{position:absolute;text-align:center;display:inline-block;transition:transform 200ms ease-in-out;transform:scale(0.6);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;box-sizing:border-box;pointer-events:none;background-color:var(--mat-badge-background-color, var(--mat-sys-error));color:var(--mat-badge-text-color, var(--mat-sys-on-error));font-family:var(--mat-badge-text-font, var(--mat-sys-label-small-font));font-weight:var(--mat-badge-text-weight, var(--mat-sys-label-small-weight));border-radius:var(--mat-badge-container-shape, var(--mat-sys-corner-full))}.mat-badge-above .mat-badge-content{bottom:100%}.mat-badge-below .mat-badge-content{top:100%}.mat-badge-before .mat-badge-content{right:100%}[dir=rtl] .mat-badge-before .mat-badge-content{right:auto;left:100%}.mat-badge-after .mat-badge-content{left:100%}[dir=rtl] .mat-badge-after .mat-badge-content{left:auto;right:100%}@media(forced-colors: active){.mat-badge-content{outline:solid 1px;border-radius:0}}.mat-badge-disabled .mat-badge-content{background-color:var(--mat-badge-disabled-state-background-color, color-mix(in srgb, var(--mat-sys-error) 38%, transparent));color:var(--mat-badge-disabled-state-text-color, var(--mat-sys-on-error))}.mat-badge-hidden .mat-badge-content{display:none}.ng-animate-disabled .mat-badge-content,.mat-badge-content._mat-animation-noopable{transition:none}.mat-badge-content.mat-badge-active{transform:none}.mat-badge-small .mat-badge-content{width:var(--mat-badge-legacy-small-size-container-size, unset);height:var(--mat-badge-legacy-small-size-container-size, unset);min-width:var(--mat-badge-small-size-container-size, 6px);min-height:var(--mat-badge-small-size-container-size, 6px);line-height:var(--mat-badge-small-size-line-height, 6px);padding:var(--mat-badge-small-size-container-padding, 0);font-size:var(--mat-badge-small-size-text-size, 0);margin:var(--mat-badge-small-size-container-offset, -6px 0)}.mat-badge-small.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-small-size-container-overlap-offset, -6px)}.mat-badge-medium .mat-badge-content{width:var(--mat-badge-legacy-container-size, unset);height:var(--mat-badge-legacy-container-size, unset);min-width:var(--mat-badge-container-size, 16px);min-height:var(--mat-badge-container-size, 16px);line-height:var(--mat-badge-line-height, 16px);padding:var(--mat-badge-container-padding, 0 4px);font-size:var(--mat-badge-text-size, var(--mat-sys-label-small-size));margin:var(--mat-badge-container-offset, -12px 0)}.mat-badge-medium.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-container-overlap-offset, -12px)}.mat-badge-large .mat-badge-content{width:var(--mat-badge-legacy-large-size-container-size, unset);height:var(--mat-badge-legacy-large-size-container-size, unset);min-width:var(--mat-badge-large-size-container-size, 16px);min-height:var(--mat-badge-large-size-container-size, 16px);line-height:var(--mat-badge-large-size-line-height, 16px);padding:var(--mat-badge-large-size-container-padding, 0 4px);font-size:var(--mat-badge-large-size-text-size, var(--mat-sys-label-small-size));margin:var(--mat-badge-large-size-container-offset, -12px 0)}.mat-badge-large.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-large-size-container-overlap-offset, -12px)}
45
- `],encapsulation:2,changeDetection:0})}return n})(),w9=(()=>{class n{_ngZone=y(Be);_elementRef=y(Ke);_ariaDescriber=y(Pc);_renderer=y(Ir);_animationsDisabled=Ji();_idGenerator=y(pa);get color(){return this._color}set color(e){this._setColor(e),this._color=e}_color="primary";overlap=!0;disabled=!1;position="above after";get content(){return this._content}set content(e){this._updateRenderedContent(e)}_content;get description(){return this._description}set description(e){this._updateDescription(e)}_description;size="medium";hidden=!1;_badgeElement;_inlineBadgeDescription;_isInitialized=!1;_interactivityChecker=y(Tc);_document=y(cc);constructor(){let e=y(Br);e.load(Fw),e.load(Mc)}isAbove(){return this.position.indexOf("below")===-1}isAfter(){return this.position.indexOf("before")===-1}getBadgeElement(){return this._badgeElement}ngOnInit(){this._clearExistingBadges(),this.content&&!this._badgeElement&&(this._badgeElement=this._createBadgeElement(),this._updateRenderedContent(this.content)),this._isInitialized=!0}ngAfterViewInit(){}ngOnDestroy(){this._renderer.destroyNode&&(this._renderer.destroyNode(this._badgeElement),this._inlineBadgeDescription?.remove()),this._ariaDescriber.removeDescription(this._elementRef.nativeElement,this.description)}_isHostInteractive(){return this._interactivityChecker.isFocusable(this._elementRef.nativeElement,{ignoreVisibility:!0})}_createBadgeElement(){let e=this._renderer.createElement("span"),t="mat-badge-active";return e.setAttribute("id",this._idGenerator.getId("mat-badge-content-")),e.setAttribute("aria-hidden","true"),e.classList.add(dg),this._animationsDisabled&&e.classList.add("_mat-animation-noopable"),this._elementRef.nativeElement.appendChild(e),typeof requestAnimationFrame=="function"&&!this._animationsDisabled?this._ngZone.runOutsideAngular(()=>{requestAnimationFrame(()=>{e.classList.add(t)})}):e.classList.add(t),e}_updateRenderedContent(e){let t=`${e??""}`.trim();this._isInitialized&&t&&!this._badgeElement&&(this._badgeElement=this._createBadgeElement()),this._badgeElement&&(this._badgeElement.textContent=t),this._content=t}_updateDescription(e){this._ariaDescriber.removeDescription(this._elementRef.nativeElement,this.description),(!e||this._isHostInteractive())&&this._removeInlineDescription(),this._description=e,this._isHostInteractive()?this._ariaDescriber.describe(this._elementRef.nativeElement,e):this._updateInlineDescription()}_updateInlineDescription(){this._inlineBadgeDescription||(this._inlineBadgeDescription=this._document.createElement("span"),this._inlineBadgeDescription.classList.add("cdk-visually-hidden")),this._inlineBadgeDescription.textContent=this.description,this._badgeElement?.appendChild(this._inlineBadgeDescription)}_removeInlineDescription(){this._inlineBadgeDescription?.remove(),this._inlineBadgeDescription=void 0}_setColor(e){let t=this._elementRef.nativeElement.classList;t.remove(`mat-badge-${this._color}`),e&&t.add(`mat-badge-${e}`)}_clearExistingBadges(){let e=this._elementRef.nativeElement.querySelectorAll(`:scope > .${dg}`);for(let t of Array.from(e))t!==this._badgeElement&&t.remove()}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Ot({type:n,selectors:[["","matBadge",""]],hostAttrs:[1,"mat-badge"],hostVars:20,hostBindings:function(t,i){t&2&&st("mat-badge-overlap",i.overlap)("mat-badge-above",i.isAbove())("mat-badge-below",!i.isAbove())("mat-badge-before",!i.isAfter())("mat-badge-after",i.isAfter())("mat-badge-small",i.size==="small")("mat-badge-medium",i.size==="medium")("mat-badge-large",i.size==="large")("mat-badge-hidden",i.hidden||!i.content)("mat-badge-disabled",i.disabled)},inputs:{color:[0,"matBadgeColor","color"],overlap:[2,"matBadgeOverlap","overlap",bt],disabled:[2,"matBadgeDisabled","disabled",bt],position:[0,"matBadgePosition","position"],content:[0,"matBadge","content"],description:[0,"matBadgeDescription","description"],size:[0,"matBadgeSize","size"],hidden:[2,"matBadgeHidden","hidden",bt]}})}return n})(),cg=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Qi({type:n});static \u0275inj=Yi({imports:[Ec,In]})}return n})();var Gw=["rotatingDial"],Bw=["awaIndicator"],zw=["rudderStarboardRect"],Uw=["rudderPortRect"],ug=(()=>{class n{rotatingDial=pe.required("rotatingDial");awaIndicator=pe.required("awaIndicator");rudderStarboardRect=pe.required("rudderStarboardRect");rudderPortRect=pe.required("rudderPortRect");apMode=x("off-line");targetPilotHeadingTrue=x.required();autopilotTarget=x.required();courseXte=x.required();compassHeading=x.required();headingDirectionTrue=x.required();appWindAngle=x.required();rudderAngle=x.required();compassAngle=_(0);awaAngle=_(0);prevCompassAngle=0;prevAwaAngle=0;compassInitialized=!1;awaInitialized=!1;rudderInitialized=!1;lastRudderSigned=Number.NaN;oldRudderPrtAngle=0;newRudderPrtAngle=0;oldRudderStbAngle=0;newRudderStbAngle=0;apModeValue=_("");apModeValueAnnotation=_("");apModeValueDirection=_("");lockedMode=K(()=>{let e=this.apMode();return e==="auto"||e==="compass"?"Heading Hold":e==="gps"?"GPS Hold":e==="route"||e==="nav"?"Track":e==="wind"?"Wind Hold":e==="true wind"?"Wind True Hold":e==="standby"?"Standby":"Off-line"});lockedHdg=K(()=>{let e=this.autopilotTarget();return Number.isFinite(e)?this.roundDeg(e):null});lockedHdgAnnotation=K(()=>{let e=this.apMode();if(["route","auto","gps","nav"].includes(e))return this.targetPilotHeadingTrue()?"True":"Mag";if(["wind","true wind"].includes(e)){let t=this.lockedHdg()??null;return t===null?"":t>0?"Stbd":"Port"}return""});hdgDirectionTrue=K(()=>this.headingDirectionTrue()?"T":"M");animationFrames=new WeakMap;ANIMATION_DURATION=1e3;DEG_TO_PX=16.66666667;ROT_CENTER=[500,560.061];ngZone=y(Be);roundDeg(e){return Math.round(e)}setRotationImmediate(e,t){e.setAttribute("transform",`rotate(${t} ${this.ROT_CENTER[0]} ${this.ROT_CENTER[1]})`)}setRudderWidthImmediate(e,t){e.setAttribute("width",`${Math.max(0,t)}`)}constructor(){L(()=>{let e=this.compassHeading();if(!Number.isFinite(e))return;let t=this.roundDeg(e);B(()=>{let i=this.prevCompassAngle,a=!this.compassInitialized;if(!this.compassInitialized)this.prevCompassAngle=t,this.compassInitialized=!0;else{if(i===t)return;this.prevCompassAngle=t}this.compassAngle.set(t);let r=this.rotatingDial()?.nativeElement;r&&(a||i===t?this.setRotationImmediate(r,-t):$t(r,-i,-t,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ROT_CENTER,this.ngZone))})}),L(()=>{let e=this.appWindAngle();if(!Number.isFinite(e))return;let i=(this.roundDeg(e)+360)%360;B(()=>{let a=this.prevAwaAngle,r=!this.awaInitialized;if(!this.awaInitialized)this.prevAwaAngle=i,this.awaInitialized=!0;else{if(a===i)return;this.prevAwaAngle=i}this.awaAngle.set(i);let s=this.awaIndicator()?.nativeElement;s&&(r||a===i?this.setRotationImmediate(s,i):$t(s,a,i,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ROT_CENTER,this.ngZone))})}),L(()=>{let e=this.rudderAngle();Number.isFinite(e)&&B(()=>{this.updateRudderAngle(-e)})}),L(()=>{let e=this.apMode(),t=this.appWindAngle(),i=Number.isFinite(t)?this.roundDeg(t):0,a=this.courseXte();B(()=>{switch(e){case"auto":case"route":{let r,s,l;a<0?l=" Port":a>0?l=" Stbd":l="",a=Math.abs(a),a>185?(r=(a/1852).toFixed(1),s=" nm"):(r=a.toFixed(0),s=" m"),this.apModeValueAnnotation.set(s),this.apModeValue.set(r),this.apModeValueDirection.set(l);break}case"standby":this.apModeValueAnnotation.set(""),this.apModeValue.set(""),this.apModeValueDirection.set("");break;case"wind":this.apModeValueAnnotation.set(i?i>0?"S":"P":""),this.apModeValue.set(Math.abs(i)+"\xB0"),this.apModeValueDirection.set("");break;default:this.apModeValueAnnotation.set(""),this.apModeValue.set(""),this.apModeValueDirection.set("");break}})})}updateRudderAngle(e){if(!Number.isFinite(e))return;let t=this.roundDeg(e);if(this.lastRudderSigned===t)return;this.lastRudderSigned=t;let a=Math.min(Math.abs(t),30)*this.DEG_TO_PX,r=this.rudderStarboardRect().nativeElement,s=this.rudderPortRect().nativeElement;if(!this.rudderInitialized){this.rudderInitialized=!0,t<=0?(this.setRudderWidthImmediate(r,a),this.setRudderWidthImmediate(s,0),this.oldRudderStbAngle=a,this.oldRudderPrtAngle=0):(this.setRudderWidthImmediate(s,a),this.setRudderWidthImmediate(r,0),this.oldRudderPrtAngle=a,this.oldRudderStbAngle=0);return}t<=0?(Qo(r,this.oldRudderStbAngle,a,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ngZone),Qo(s,this.oldRudderPrtAngle,0,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ngZone),this.oldRudderStbAngle=a,this.oldRudderPrtAngle=0):(Qo(s,this.oldRudderPrtAngle,a,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ngZone),Qo(r,this.oldRudderStbAngle,0,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ngZone),this.oldRudderPrtAngle=a,this.oldRudderStbAngle=0)}ngOnDestroy(){let e=[this.rotatingDial(),this.awaIndicator(),this.rudderPortRect(),this.rudderStarboardRect()];for(let t of e){let i=t?.nativeElement;if(!i)continue;let a=this.animationFrames.get(i);a&&cancelAnimationFrame(a),this.animationFrames.delete(i)}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["app-svg-autopilot"]],viewQuery:function(t,i){t&1&&Me(i.rotatingDial,Gw,5)(i.awaIndicator,Bw,5)(i.rudderStarboardRect,zw,5)(i.rudderPortRect,Uw,5),t&2&&ke(4)},inputs:{apMode:[1,"apMode"],targetPilotHeadingTrue:[1,"targetPilotHeadingTrue"],autopilotTarget:[1,"autopilotTarget"],courseXte:[1,"courseXte"],compassHeading:[1,"compassHeading"],headingDirectionTrue:[1,"headingDirectionTrue"],appWindAngle:[1,"appWindAngle"],rudderAngle:[1,"rudderAngle"]},decls:123,vars:17,consts:[["rotatingDial",""],["awaIndicator",""],["rudderStarboardRect",""],["rudderPortRect",""],["viewBox","0 0 1000 500","preserveAspectRatio","xMidYMid meet"],["id","compassDial"],["id","fixedDial"],["d","M 499.99997,70.521 A 489.47916,489.47916 0 0 0 10.520805,560.00017 489.47916,489.47916 0 0 0 499.99997,1049.4793 489.47916,489.47916 0 0 0 989.47913,560.00017 489.47916,489.47916 0 0 0 499.99997,70.521 Z m 0,132.29166 a 357.1875,357.1875 0 0 1 357.18749,357.1875 357.1875,357.1875 0 0 1 -357.18749,357.18749 357.1875,357.1875 0 0 1 -357.1875,-357.18749 357.1875,357.1875 0 0 1 357.1875,-357.1875 z",1,"fixed-dial-background",2,"display","inline","stroke","none"],["d","M 93.283801,325.18249 A 469.63541,469.63541 0 0 1 339.37522,118.68726",1,"port",2,"display","inline","fill","none","stroke-width","39.6875","stroke-linecap","butt","stroke-linejoin","round","stroke-miterlimit","0"],["d","M 660.62476,118.68725 A 469.63541,469.63541 0 0 1 906.71619,325.18247",1,"starboard",2,"display","inline","fill","none","stroke-width","39.6875","stroke-linecap","butt","stroke-linejoin","round","stroke-miterlimit","0"],[2,"display","inline"],["transform","translate(0,59.999714)"],["d","m 416.35095,19.837399 2.78142,15.77426","id","path199",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 334.23173,41.658798 5.47834,15.051615","id","path200",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 260.27336,81.806174 12.55151,21.739856","id","path37",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 187.44581,126.00035 10.29591,12.2702","id","path197",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 127.23918,185.95785 12.27019,10.29591","id","path198",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 83.252815,257.66724 21.739865,12.55151","id","path166",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 42.289518,332.39273 15.05162,5.47835","id","path195",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 20.127799,414.42077 15.774251,2.78142","id","path196",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 17.879075,498.47765 H 42.982096","id","path167",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 19.776759,583.71187 15.77426,-2.78142","id","path193",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 41.598167,665.8311 15.051615,-5.47834","id","path194",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 81.668963,739.71246 103.40883,727.16095","id","path168",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 125.93981,812.61701 12.2702,-10.29591","id","path191",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 185.89732,872.82365 10.29591,-12.27019","id","path192",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 257.53004,916.73298 12.55151,-21.73985","id","path169",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 332.33219,957.7732 5.47835,-15.05162","id","path189",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 414.36024,979.93493 2.78142,-15.77425","id","path190",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 498.34046,982.10672 V 957.0037","id","path170",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 583.65133,980.28596 580.86991,964.5117","id","path187",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 665.77057,958.46456 -5.47834,-15.05161","id","path188",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 739.57526,918.31683 727.02375,896.57698","id","path171",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 812.55647,874.12301 802.26056,861.85282","id","path185",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 872.76312,814.16551 860.49293,803.8696","id","path186",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 916.59579,742.45577 894.85593,729.90426","id","path172",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 957.71266,667.73063 -15.05161,-5.47834","id","path183",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 979.8744,585.70259 -15.77425,-2.78142","id","path184",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 981.96954,501.64535 -25.10304,10e-6","id","path173",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 980.22542,416.41149 -15.77425,2.78143","id","path181",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 958.40403,334.29226 -15.05161,5.47834","id","path182",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 918.17964,260.41055 -21.73986,12.55151","id","path174",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 874.06247,187.50636 -12.27018,10.29591","id","path180",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 817.34594,130.05494 -10.40259,12.17987","id","path179",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 742.31857,83.390025 729.76706,105.12988","id","path175",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 667.6701,42.350172 -5.47834,15.051615","id","path178",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 585.64206,20.188432 -2.78142,15.77425","id","path176",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 501.50816,18.016286 V 43.119307","id","path177",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["id","lightGray","d","M 499.99997,50.208304 A 449.79166,449.79166 0 0 0 50.208304,499.99997 449.79166,449.79166 0 0 0 499.99997,949.79163 449.79166,449.79166 0 0 0 949.79163,499.99997 449.79166,449.79166 0 0 0 499.99997,50.208304 Z m 0,92.604166 a 357.1875,357.1875 0 0 1 357.18749,357.1875 357.1875,357.1875 0 0 1 -357.18749,357.18749 357.1875,357.1875 0 0 1 -357.1875,-357.18749 357.1875,357.1875 0 0 1 357.1875,-357.1875 z",1,"rotating-dial-Backplate",2,"display","inline","fill-opacity","1","stroke","none"],[0,"xml","space","preserve","x","181.91386","y","284.25186","id","text3","transform","rotate(-30)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan3","x","181.91386","y","284.25186",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-183.53558","y","283.74811","id","text14","transform","rotate(-60)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan14","x","-183.53558","y","283.74811",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-499.70761","y","100.95312","id","text15","transform","rotate(-90)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan15","x","-499.70761","y","100.95312",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-681.66119","y","-216.36243","id","text16","transform","rotate(-120)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["x","-681.66119","y","-216.36243","id","tspan25",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-681.06616","y","-581.71271","id","text17","transform","rotate(-150)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan17","x","-681.06616","y","-581.71271",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-498.3313","y","-897.40875","id","text18","transform","scale(-1)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan18","x","-498.3313","y","-897.40875",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-184.41313","y","-1080.8452","id","text19","transform","rotate(150)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan19","x","-184.41313","y","-1080.8452",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","181.57225","y","-1080.8853","id","text20","transform","rotate(120)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan20","x","181.57225","y","-1080.8853",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","501.42661","y","-896.93701","id","text21","transform","rotate(90)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan21","x","501.42661","y","-896.93701",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","682.35815","y","-579.63336","id","text22","transform","rotate(60)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan22","x","682.35815","y","-579.63336",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","681.81525","y","-214.27321","id","text23","transform","rotate(30)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan23","x","681.81525","y","-214.27321",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","500.15503","y","101.96342","id","text24",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan24","x","500.15503","y","101.96342",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],["id","triangle","d","M 499.5601,155 450,197 h 100 z",1,"fixed-dial-background",2,"display","inline","stroke","none"],["id","counterAWA",2,"display","inline"],[0,"xml","space","preserve","x","910.14893","y","90.67927",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","34.6667px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],[0,"xml","space","preserve","x","907.84814","y","160.33212",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","73.3333px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],[2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","33.3333px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],[0,"xml","space","preserve","x","910.14893","y","200",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","34.6667px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],[0,"xml","space","preserve","x","97","y","90.47614",1,"contrast-text-dim",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","33.3333px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],[0,"xml","space","preserve","x","109.25","y","160.33212",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","73.3333px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],["id","displayArea",2,"display","inline"],[0,"xml","space","preserve","x","523.93127","y","480",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","240px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],["dy","-38",2,"font-weight","normal","font-size","180px"],[0,"xml","space","preserve","x","730","y","484",1,"contrast-text-dim",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","33.3333px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","fill-opacity","1","stroke","none"],[0,"xml","space","preserve","x","500","y","280",1,"contrast-text-dim",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","45px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none"],["id","IndicatorsLayer",2,"display","inline"],["transform","matrix(0.78967872,0,0,0.78967872,95.846484,6.0520865)"],["d","m 451.77021,55.078207 42.08541,-33.202814 a 12.555638,12.555638 0.26446337 0 1 15.64423,0.07221 l 42.20046,33.930296 a 15.557694,15.557694 71.53185 0 1 5.32954,15.957795 L 504.17034,279.76529 a 2.5373267,2.5373267 0.02614114 0 1 -4.91879,-0.002 L 446.37431,70.966036 a 15.416336,15.416336 108.75875 0 1 5.3959,-15.887829 z","transform","matrix(0.7935953,0,0,0.92686935,113.64335,37.878309)",1,"awa-text",2,"stroke-width","5.8876","stroke-miterlimit","0"],[0,"xml","space","preserve","x","486.45618","y","136.29939",1,"card-color",2,"font-weight","bold","font-size","52.9167px","stroke","none"],["id","tspan8","x","486.45618","y","136.29939",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","70.5556px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","fill","#001000","fill-opacity","1","stroke","none","stroke-width","14.5521"],["id","rudder",2,"display","inline"],["width","0","height","35","x","500","y","0",1,"rudderStarboard",2,"display","inline","opacity","1","fill-opacity","1","stroke","none"],["width","0","height","35","x","-500","y","0","transform","scale(-1,1)",1,"rudderPort",2,"display","inline","opacity","1","fill-opacity","1","stroke","none"],["width","331.54941","height","33.216152","x","167.55841","y","0.89179999",1,"boxes",2,"display","inline","opacity","1","fill","none","stroke-width","2","stroke-miterlimit","4","stroke-dasharray","none","stroke-opacity","1"],["width","331.54941","height","33.216152","x","500.89182","y","0.89179999",1,"boxes",2,"display","inline","opacity","1","fill","none","stroke-width","2","stroke-miterlimit","4","stroke-dasharray","none","stroke-opacity","1"],["width","331.54941","height","33.216152","x","334.22531","y","0.89179999",1,"boxes",2,"display","inline","opacity","1","fill","none","stroke-width","2","stroke-miterlimit","4","stroke-dasharray","none","stroke-opacity","1"],["id","rect12","width","998.26178","height","33.261108","x","0.86909997","y","0.86909997",1,"boxes",2,"display","inline","opacity","1","fill","none","stroke-width","2","stroke-miterlimit","4","stroke-dasharray","none","stroke-opacity","1"]],template:function(t,i){t&1&&(ie(),D(0,"svg",4)(1,"g",5)(2,"g",6),Q(3,"path",7)(4,"path",8)(5,"path",9),R(),D(6,"g",10,0)(8,"g",11),Q(9,"path",12)(10,"path",13)(11,"path",14)(12,"path",15)(13,"path",16)(14,"path",17)(15,"path",18)(16,"path",19)(17,"path",20)(18,"path",21)(19,"path",22)(20,"path",23)(21,"path",24)(22,"path",25)(23,"path",26)(24,"path",27)(25,"path",28)(26,"path",29)(27,"path",30)(28,"path",31)(29,"path",32)(30,"path",33)(31,"path",34)(32,"path",35)(33,"path",36)(34,"path",37)(35,"path",38)(36,"path",39)(37,"path",40)(38,"path",41)(39,"path",42)(40,"path",43)(41,"path",44)(42,"path",45)(43,"path",46)(44,"path",47)(45,"path",48),D(46,"text",49)(47,"tspan",50),c(48,"330"),R()(),D(49,"text",51)(50,"tspan",52),c(51,"300"),R()(),D(52,"text",53)(53,"tspan",54),c(54,"W"),R()(),D(55,"text",55)(56,"tspan",56),c(57,"240"),R()(),D(58,"text",57)(59,"tspan",58),c(60,"210"),R()(),D(61,"text",59)(62,"tspan",60),c(63,"S"),R()(),D(64,"text",61)(65,"tspan",62),c(66,"150"),R()(),D(67,"text",63)(68,"tspan",64),c(69,"120"),R()(),D(70,"text",65)(71,"tspan",66),c(72,"E"),R()(),D(73,"text",67)(74,"tspan",68),c(75,"60"),R()(),D(76,"text",69)(77,"tspan",70),c(78,"30"),R()(),D(79,"text",71)(80,"tspan",72),c(81,"N"),R()()()(),Q(82,"path",73),R(),D(83,"g",74)(84,"text",75),c(85),R(),D(86,"text",76),c(87),D(88,"tspan",77),c(89),R()(),D(90,"text",78),c(91),R(),D(92,"text",79),c(93,"HDG"),R(),D(94,"text",80),c(95),D(96,"tspan",77),c(97),R()()(),D(98,"g",81)(99,"text",82),c(100),D(101,"tspan",83),c(102,"\xB0"),R()(),D(103,"text",84),c(104),R(),D(105,"text",85),c(106),R()(),D(107,"g",86)(108,"g",87,1),Q(110,"path",88),D(111,"text",89)(112,"tspan",90),c(113,"A"),R()()()(),D(114,"g",91),Q(115,"rect",92,2)(117,"rect",93,3)(119,"rect",94)(120,"rect",95)(121,"rect",96)(122,"rect",97),R()()),t&2&&(g(84),it(i.apMode()=="wind"?"awa-text-dim":"contrast-text-dim"),J("display",i.apMode()=="wind"||i.apMode()=="route"?"inline":"none"),g(),ge(" ",i.apMode()==="route"?"XTE":"AWA"),g(),it(i.apMode()=="wind"?"awa-text":"contrast-text"),J("display",i.apMode()=="wind"||i.apMode()=="route"?"inline":"none"),g(),X(i.apModeValue()??"--"),g(2),X(i.apModeValueAnnotation()),g(),J("display",i.apMode()=="route"?"inline":"none"),g(),X(i.apModeValueDirection()),g(4),ge("",i.compassAngle()??"--","\xB0"),g(2),X(i.hdgDirectionTrue()),g(3),X(i.lockedHdg()??"--"),g(4),X(i.lockedHdgAnnotation()),g(2),X(i.lockedMode()),g(2),J("display",i.apMode()=="wind"?"inline":"none"))},styles:["[_nghost-%COMP%]{display:block;width:100%;font-family:Roboto;overflow:hidden;aspect-ratio:2/1;max-width:100%;max-height:100%}svg[_ngcontent-%COMP%]{width:100%;height:100%;display:block;overflow:hidden}.starboard[_ngcontent-%COMP%]{stroke:var(--kip-starboard-color)}.port[_ngcontent-%COMP%]{stroke:var(--kip-port-color)}.contrast-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);stroke:var(--kip-contrast-color)}.contrast-text-dim[_ngcontent-%COMP%]{fill:var(--kip-contrast-dim-color);stroke:var(--kip-contrast-dim-color)}.awa-text[_ngcontent-%COMP%]{fill:var(--kip-orange-color);stroke:var(--kip-orange-color)}.awa-text-dim[_ngcontent-%COMP%]{fill:var(--kip-orange-dim-color);stroke:var(--kip-orange-dim-color)}.card-color[_ngcontent-%COMP%]{fill:var(--kip-widget-card-background-color)}.fixed-dial-background[_ngcontent-%COMP%]{fill:var(--kip-grey-color)}.rotating-dial-Backplate[_ngcontent-%COMP%]{fill:var(--mat-sys-background)}.rudderPort[_ngcontent-%COMP%]{fill:var(--kip-port-color)}.rudderStarboard[_ngcontent-%COMP%]{fill:var(--kip-starboard-color)}.boxes[_ngcontent-%COMP%]{stroke:var(--kip-grey-color);fill:var(--kip-grey-color)}"],changeDetection:0})}return n})();var Hw=["childOutlet"],mg=(()=>{class n{widgetProperties;outlet;_streams=y(Le,{optional:!0});_meta=y(ci,{optional:!0});_runtime=y(we,{optional:!0});_widgetService=y(cl);_app=y(Di);theme=_i(this._app.cssThemeColorRoles$,{requireSync:!0});childRef;compType;constructor(){L(()=>{let e=this.theme();this.childRef&&this.childRef.setInput("theme",e)})}ngOnInit(){let e=this.widgetProperties.type;if(!e)return;this.compType=this._widgetService.getComponentType(e),this._runtime?.initialize?.(void 0,this.widgetProperties.config);let t=this._runtime?.options();t&&(this.widgetProperties.config=t),this._streams?.applyStreamsConfigDiff?.(t),this._meta?.applyMetaConfigDiff?.(t),this.outlet&&this.compType&&(this.childRef=this.outlet.createComponent(this.compType),this.childRef.setInput("id",this.widgetProperties.uuid),this.childRef.setInput("type",this.widgetProperties.type),this.childRef.setInput("theme",this.theme()))}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-embedded"]],viewQuery:function(t,i){if(t&1&&En(Hw,7,Nr),t&2){let a;yi(a=xi())&&(i.outlet=a.first)}},inputs:{widgetProperties:"widgetProperties"},features:[hc([Le,ci,we])],decls:3,vars:0,consts:[["childOutlet",""],["appearance","raised",1,"widget-container","kip-widget-card-colors",2,"border","1px dashed transparent"]],template:function(t,i){t&1&&(d(0,"mat-card",1),Or(1,null,0),u())},dependencies:[Jr,gu],styles:["[_nghost-%COMP%]{width:100%;height:100%;display:block}.widget-container[_ngcontent-%COMP%]{display:block;width:100%;height:100%;margin:0;padding:0}.kip-widget-card-colors[_ngcontent-%COMP%]{background-color:var(--kip-widget-card-background-color)}"]})}return n})();function qw(n,o){if(n&1){let e=Se();d(0,"button",17),U("click",function(){ee(e);let i=k();return te(i.toggleDodge())}),d(1,"mat-icon",18),ie(),d(2,"svg",34)(3,"text",40),c(4,"Dodge"),u(),F(5,"path",41)(6,"path",42),d(7,"text",43),c(8,"!"),u()()()()}if(n&2){let e=k();st("ap-btn-active",e.dodgeModeActive()),O("disabled",e.apBtnDisabled()),g(5),be("fill",e.dodgeModeActive()?"currentColor":"none")("stroke","currentColor"),g(),be("fill",e.dodgeModeActive()?"currentColor":"none")("stroke","currentColor")}}function $w(n,o){if(n&1){let e=Se();ie(),d(0,"g",48),U("click",function(){let i=ee(e).$implicit,a=k(2);return te(!i.disabled&&a.onMenuItemClick(i.action))})("keyup.enter",function(){let i=ee(e).$implicit,a=k(2);return te(!i.disabled&&a.onMenuItemClick(i.action))})("keyup.space",function(){let i=ee(e).$implicit,a=k(2);return te(!i.disabled&&a.onMenuItemClick(i.action))}),F(1,"rect",49),d(2,"text",50),c(3),u()()}if(n&2){let e=o.$implicit,t=o.$index,i=k(2);J("aria-label",e.label),g(),it(e.isCancel?"svg-menu-item-cancel":e.current?"svg-menu-item-current":e.disabled?"svg-menu-item-disabled":"svg-menu-item"),J("y",t*i.itemHeight)("height",i.itemHeight),g(),it(e.isCancel?"svg-menu-item-cancel-text":e.current?"svg-menu-item-current-text":e.disabled?"svg-menu-item-disabled-text":"svg-menu-item-text"),J("y",(t+.65)*i.itemHeight),g(),Ut(" ",e.current?"\u2713 ":"","",e.label," ")}}function jw(n,o){if(n&1){let e=Se();d(0,"div",44),U("click",function(){ee(e);let i=k();return te(i.toggleMenu())})("keyup.enter",function(){ee(e);let i=k();return te(i.toggleMenu())})("keyup.space",function(){ee(e);let i=k();return te(i.toggleMenu())}),ie(),d(1,"svg",45),U("click",function(i){return i.stopPropagation()})("keyup.enter",function(i){return i.stopPropagation()})("keyup.space",function(i){return i.stopPropagation()}),F(2,"rect",46),Xi(3),xe(4,$w,4,10,":svg:g",47,Ne),Ki(),u()()}if(n&2){let e=k();g(),J("viewBox","0 0 240 "+e.menuItems().length*e.itemHeight),g(),J("height",e.menuItems().length*e.itemHeight),g(2),Ce(e.menuItems())}}function Yw(n,o){n&1&&F(0,"div",39)}var Ii={V1_MODE_PATH:"self.steering.autopilot.state",V2_BASE:"/signalk/v2/api",V2_AUTOPILOTS:"/signalk/v2/api/vessels/self/autopilots",V2_COURSE:"/signalk/v2/api/vessels/self/navigation/course"},_n={BASE:n=>`${Ii.V2_AUTOPILOTS}/${n}`,ENGAGE:n=>`${Ii.V2_AUTOPILOTS}/${n}/engage`,DISENGAGE:n=>`${Ii.V2_AUTOPILOTS}/${n}/disengage`,STATE:n=>`${Ii.V2_AUTOPILOTS}/${n}/state`,MODE:n=>`${Ii.V2_AUTOPILOTS}/${n}/mode`,TARGET_HEADING:n=>`${Ii.V2_AUTOPILOTS}/${n}/target`,TACK:n=>`${Ii.V2_AUTOPILOTS}/${n}/tack`,GYBE:n=>`${Ii.V2_AUTOPILOTS}/${n}/gybe`,DODGE:n=>`${Ii.V2_AUTOPILOTS}/${n}/dodge`,ADJUST_HEADING:n=>`${Ii.V2_AUTOPILOTS}/${n}/target/adjust`},Nd={auto:{path:"self.steering.autopilot.state",value:"auto"},wind:{path:"self.steering.autopilot.state",value:"wind"},route:{path:"self.steering.autopilot.state",value:"route"},standby:{path:"self.steering.autopilot.state",value:"standby"},"+1":{path:"self.steering.autopilot.actions.adjustHeading",value:1},"+10":{path:"self.steering.autopilot.actions.adjustHeading",value:10},"-1":{path:"self.steering.autopilot.actions.adjustHeading",value:-1},"-10":{path:"self.steering.autopilot.actions.adjustHeading",value:-10},tackToPort:{path:"self.steering.autopilot.actions.tack",value:"port"},tackToStarboard:{path:"self.steering.autopilot.actions.tack",value:"starboard"},advanceWaypoint:{path:"self.steering.autopilot.actions.advanceWaypoint",value:"1"},compass:{path:"v2 only command",value:"v2 only command"},gps:{path:"v2 only command",value:"v2 only command"},"true wind":{path:"v2 only command",value:"v2 only command"},nav:{path:"v2 only command",value:"v2 only command"}},Rd={COUNTDOWN_SECONDS:5,ERROR_DISPLAY_DURATION:6e3,MESSAGE_DISPLAY_DURATION:5e3},hg=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,filterSelfPaths:!0,paths:{autopilotState:{description:"Autopilot State",path:"self.steering.autopilot.state",source:"default",pathType:"string",isPathConfigurable:!1,showPathSkUnitsFilter:!1,convertUnitTo:"",sampleTime:500},autopilotMode:{description:"Autopilot Mode",path:"self.steering.autopilot.mode",source:"default",pathType:"string",isPathConfigurable:!1,showPathSkUnitsFilter:!1,convertUnitTo:"",sampleTime:500},autopilotEngaged:{description:"Autopilot Engaged",path:"self.steering.autopilot.engaged",source:"default",pathType:"boolean",isPathConfigurable:!1,showPathSkUnitsFilter:!1,convertUnitTo:"",sampleTime:500},autopilotV2Target:{description:"Autopilot API v2 Target",path:"self.steering.autopilot.target",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",sampleTime:500},autopilotTargetHeading:{description:"Autopilot Target Magnetic Heading",path:"self.steering.autopilot.target.headingMagnetic",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",sampleTime:500},autopilotTargetWindHeading:{description:"Autopilot Target Apparent Wind Angle",path:"self.steering.autopilot.target.windAngleApparent",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",sampleTime:500},rudderAngle:{description:"Rudder Angle",path:"self.steering.rudderAngle",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",sampleTime:500},courseXte:{description:"Cross Track Error",path:"self.navigation.course.calcValues.crossTrackError",source:"default",pathType:"number",isPathConfigurable:!1,convertUnitTo:"m",showPathSkUnitsFilter:!0,pathRequired:!1,pathSkUnitsFilter:"m",sampleTime:500},headingMag:{description:"Magnetic Heading",path:"self.navigation.headingMagnetic",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",showConvertUnitTo:!1,sampleTime:500},headingTrue:{description:"True Heading",path:"self.navigation.headingTrue",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",showConvertUnitTo:!1,sampleTime:500},windAngleApparent:{description:"Apparent Wind Angle",path:"self.environment.wind.angleApparent",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",showConvertUnitTo:!1,sampleTime:500},windAngleTrueWater:{description:"Wind Angle True Water",path:"self.environment.wind.angleTrueWater",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",showConvertUnitTo:!1,sampleTime:500}},autopilot:{invertRudder:!0,headingDirectionTrue:!1,courseDirectionTrue:!1,apiVersion:null,instanceId:null,pluginId:null,modes:null},enableTimeout:!1,dataTimeout:5};runtime=y(we);streams=y(Le,{optional:!0});_requests=y(ri);http=y(Ha);dashboard=y(ft);_destroyRef=y(Ze);apiEndpoints;apState=_(null);apEngaged=_(null);apMode=_(null);dodgeModeActive=_(!1);autopilotTargetHeading=_(null);autopilotTargetWindHeading=_(null);heading=_(null);crossTrackError=_(null);windAngleApparent=_(null);rudder=_(null);autopilotTarget=fc(()=>{let e=this.autopilotTargetHeading(),t=this.autopilotTargetWindHeading();return this.apMode()==="wind"?t??null:e??null});currentRequests=new Set;apGrid=K(()=>this.apMode()?"grid":"none");apEngageBtnDisabled=K(()=>{let e=this.apState(),t=this.apEngaged(),i=this.runtime.options().autopilot.apiVersion;return i?i==="v1"?!!["standby","off-line"].includes(e):i!=="v2":!0});apBtnDisabled=K(()=>{let e=this.apEngaged();return this.runtime.options().autopilot.apiVersion==="v1"?this.apMode()==="standby":!e});adjustHdgBtnVisibility=K(()=>{let e=this.apMode();return!!["auto","compass","gps","wind","true wind","standby"].includes(e)});tackBtnVisibility=K(()=>{let e=this.apMode();return!!["auto","compass","gps","wind","true wind","standby"].includes(e)});routeBtnVisibility=K(()=>{let e=this.apMode();return e==="route"||e==="nav"});countdownOverlayVisibility=_("hidden");countdownOverlayText=_("");msgOverlayVisibility=_("hidden");msgOverlayText=_("");errorOverlayVisibility=_("hidden");errorOverlayText=_("");handleCountDownCounterTimeout=null;handleConfirmActionTimeout=null;handleDisplayErrorTimeout=null;handleMessageTimeout=null;isPersistentError=!1;countDownValue=-1;actionToBeConfirmed="";menuItems=K(()=>{let e=this.apMode(),t=this.runtime.options().autopilot.apiVersion,i=this.runtime.options().autopilot.pluginId,a=[];return B(()=>{if(t==="v2"){if(i=="pypilot-autopilot-provider"){let r=[{label:"Compass",action:"compass"},{label:"GPS",action:"gps"},{label:"Wind",action:"wind"},{label:"True Wind",action:"true wind"},{label:"Navigation",action:"nav"},{label:"Close",action:"cancel",isCancel:!0}];a=this.parseMenuItems(r,e)}}else if(t==="v1"){let r=[{label:"Auto",action:"auto"},{label:"Wind",action:"wind"},{label:"Route",action:"route"},{label:"Close",action:"cancel",isCancel:!0}];a=this.parseMenuItems(r,e)}}),a});menuOpen=_(!1);itemHeight=60;padding=20;embedWidgetColor="contrast";nextWptProperties=_({type:"widget-position",uuid:"db473695-42b1-4435-9d3d-ac2f27bf9665",config:{displayName:"Next WPT",filterSelfPaths:!0,paths:{longPath:{description:"Longitude",path:"self.navigation.courseGreatCircle.nextPoint.position.longitude",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"longitudeMin",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500},latPath:{description:"Latitude",path:"self.navigation.courseGreatCircle.nextPoint.position.latitude",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"latitudeMin",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500}},color:this.embedWidgetColor,enableTimeout:!1,dataTimeout:5}},{equal:wi});ttwProperties=_({type:"widget-numeric",uuid:"ee022f2f-ee23-41a7-b0b1-0928dc28864d",config:{displayName:"TTWpt",filterSelfPaths:!0,paths:{numericPath:{description:"Time To Waypoint",path:"self.navigation.course.calcValues.timeToGo",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"D HH:MM:SS",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500}},showMax:!1,showMin:!1,numDecimal:1,numInt:1,showMiniChart:!1,color:this.embedWidgetColor,enableTimeout:!1,dataTimeout:5,ignoreZones:!1}},{equal:wi});etaProperties=_({type:"widget-datetime",uuid:"544ca35d-18bf-4a90-9aa8-b12312e3fc60",config:{displayName:"ETA",filterSelfPaths:!0,paths:{gaugePath:{description:"Estimated Time Of Arrival Date",path:"self.navigation.course.calcValues.estimatedTimeOfArrival",source:"default",pathType:"Date",isPathConfigurable:!0,sampleTime:500}},dateFormat:"EEE HH:mm",dateTimezone:"System Timezone -",color:this.embedWidgetColor,enableTimeout:!1,dataTimeout:5}},{equal:wi});dtwProperties=_({type:"widget-numeric",uuid:"ee02ef2f-ee23-41a7-b0b1-0928dc28864d",config:{displayName:"DTWpt",filterSelfPaths:!0,paths:{numericPath:{description:"Distance To Waypoint",path:"self.navigation.course.calcValues.distance",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"nm",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500}},showMax:!1,showMin:!1,numDecimal:1,numInt:1,showMiniChart:!1,color:this.embedWidgetColor,enableTimeout:!1,dataTimeout:5,ignoreZones:!1}},{equal:wi});xteProperties=_({type:"widget-numeric",uuid:"9234856b-7573-4154-a44f-3baf7c6f119c",config:{displayName:"XTE",filterSelfPaths:!0,paths:{numericPath:{description:"Cross Track Error",path:"self.navigation.course.calcValues.crossTrackError",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"m",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500}},showMax:!1,showMin:!1,numDecimal:1,numInt:1,showMiniChart:!1,color:this.embedWidgetColor,enableTimeout:!1,dataTimeout:5,ignoreZones:!1}},{equal:wi});constructor(){L(()=>{this.runtime?.options()&&B(()=>{this.cancelAllHttpRequests(),this.isPersistentError=!1,this.errorOverlayVisibility.set("hidden"),this.errorOverlayText.set(""),this.apEngaged.set(null),this.startWidget()})})}ngOnInit(){this.startWidget()}startWidget(){let e={statusCode:500,statusCodeDescription:"Autopilot widget not configured",requestId:"",state:""},t=this.runtime.options().autopilot.apiVersion,i=this.runtime.options().autopilot.instanceId,a=this.runtime.options().autopilot.pluginId,r=s=>{console.error(`[Autopilot Widget] ${s}`),this.displayApError(e),this.isPersistentError=!0,this.apMode.set("off-line"),this.apState.set("off-line"),this.apEngaged.set(!1)};if(!t){r("Not configured with autopilot API version, skipping initialization");return}if(t==="v2"){if(!i){r("No autopilot instance ID configured for V2 API, skipping initialization");return}if(!a){r("No autopilot plugin ID configured for V2 API, skipping initialization");return}this.apiEndpoints=this.setV2Endpoint(i),this.startV2Subscriptions();return}if(t==="v1"){this.startV1Subscriptions();return}r(`Unknown autopilot API version: ${t}`)}setV2Endpoint(e){return{engage:_n.ENGAGE(e),disengage:_n.DISENGAGE(e),mode:_n.MODE(e),state:_n.STATE(e),target:_n.TARGET_HEADING(e),tack:_n.TACK(e),gybe:_n.GYBE(e),dodge:_n.DODGE(e),adjustHeading:_n.ADJUST_HEADING(e)}}isV2CommandSupported(e){return this.runtime.options().autopilot.modes.includes(e)}startV2Subscriptions(){this.streams.observe("autopilotState",e=>{e.data?.value?this.apState.set(e.data.value):(this.apState.set("off-line"),console.warn("[Autopilot Widget] Autopilot state is null or not available"))}),this.streams.observe("autopilotMode",e=>{e.data?.value?this.apMode.set(e.data.value):(this.apMode.set("off-line"),console.warn("[Autopilot Widget] Autopilot mode is null or not available"))}),this.streams.observe("autopilotEngaged",e=>{e.data?.value!=null?this.apEngaged.set(e.data.value):(this.apEngaged.set(!1),console.warn("[Autopilot Widget] Autopilot engaged is null or not available"))}),this.streams.observe("autopilotV2Target",e=>{e.data?.value?this.autopilotTarget.set(e.data.value):(this.autopilotTarget.set(null),console.warn("[Autopilot Widget] Autopilot V2 target is null or not available"))}),this.startDataSubscription()}startV1Subscriptions(){this.runtime.options().paths.autopilotMode.path=Ii.V1_MODE_PATH,this.streams.observe("autopilotMode",e=>{e.data?.value?this.apMode.set(e.data.value):(this.apMode.set("off-line"),console.warn("[Autopilot Widget] Autopilot V1 mode state is null or not available"))}),this.streams.observe("autopilotTargetHeading",e=>this.autopilotTargetHeading.set(e.data.value!=null?e.data.value:0)),this.streams.observe("autopilotTargetWindHeading",e=>this.autopilotTargetWindHeading.set(e.data.value!=null?e.data.value:0)),this.startDataSubscription(),this.subscribePutResponse(),this.apState.set(null)}startDataSubscription(){this.streams.observe("courseXte",e=>this.crossTrackError.set(e.data.value!=null?e.data.value:0)),this.streams.observe("rudderAngle",e=>{e.data.value===null?this.rudder.set(null):this.rudder.set(this.runtime.options().autopilot.invertRudder?-e.data.value:e.data.value)}),this.runtime.options().autopilot.headingDirectionTrue?this.streams.observe("headingTrue",e=>this.heading.set(e.data.value!=null?e.data.value:0)):this.streams.observe("headingMag",e=>this.heading.set(e.data.value!=null?e.data.value:0)),this.streams.observe("windAngleApparent",e=>this.windAngleApparent.set(e.data.value!=null?e.data.value:0))}subscribePutResponse(){this._requests.subscribeRequest().pipe($e(this._destroyRef)).subscribe(e=>{e.widgetUUID==this.id()&&this.commandReceived(e)})}makeHttpRequest(e){let t=e.pipe($e(this._destroyRef));return this.currentRequests.add(t),t.pipe(Sr(()=>this.currentRequests.delete(t)))}cancelAllHttpRequests(){this.currentRequests.clear()}buildAndSendCommand(e){let t=Nd[e];if(typeof t>"u"){alert("Unknown Autopilot command: "+e);return}if(this.actionToBeConfirmed!==""&&this.actionToBeConfirmed!==e&&this.clearConfirmCmd(),(e==="tackToPort"||e==="tackToStarboard")&&this.actionToBeConfirmed===""){this.confirmTack(e);return}if((e==="route"&&this.apMode()==="route"||e==="route"&&this.apMode()==="nav")&&this.actionToBeConfirmed===""){this.confirmAdvanceWaypoint(e);return}if(this.actionToBeConfirmed===e){if(this.clearConfirmCmd(),e==="tackToPort"||e==="tackToStarboard"){let i=e==="tackToPort"?"port":"starboard";this.performTackOrGybe("tack",i)}(e==="route"&&this.apMode()==="route"||e==="route"&&this.apMode()==="nav")&&this.routeCommand(e,Nd.advanceWaypoint);return}this.routeCommand(e,t)}routeCommand(e,t){let i=this.runtime.options().autopilot.apiVersion;i==="v2"?(e==="route"&&this.apMode()==="nav"&&(e="advanceWaypoint"),this.sendV2Command(e)):i==="v1"&&!t.path.startsWith("v2:")?this.sendV1Command(t):(console.error("[Autopilot Widget] Unsupported basic command:",t.path),this.displayApError({statusCode:400,statusCodeDescription:"Unsupported Command",message:`Command path '${t.path}' is not supported in the current API version`,widgetUUID:this.id()}))}sendV1Command(e){this._requests.putRequest(e.path,e.value,this.id()),console.log(`AP Action:
46
- `+JSON.stringify(e))}sendV2Command(e,t){return Ve(this,null,function*(){let i=this.apiEndpoints;if(!i){console.error("V2 endpoints not available");return}let a=this.dodgeModeActive(),r;switch(e){case"+1":r={path:a?i.dodge:i.adjustHeading,value:{value:1,units:"deg"}},this.executeRestRequest("PUT",r);break;case"+10":r={path:a?i.dodge:i.adjustHeading,value:{value:10,units:"deg"}},this.executeRestRequest("PUT",r);break;case"-1":r={path:a?i.dodge:i.adjustHeading,value:{value:-1,units:"deg"}},this.executeRestRequest("PUT",r);break;case"-10":r={path:a?i.dodge:i.adjustHeading,value:{value:-10,units:"deg"}},this.executeRestRequest("PUT",r);break;case"advanceWaypoint":r={path:`${Ii.V2_COURSE}/activeRoute/nextPoint`},this.executeRestRequest("PUT",r);break;case"tack":r={path:`${i.tack}/${t.value}`},this.executeRestRequest("POST",r);break;case"gybe":r={path:`${i.gybe}/${t}`},this.executeRestRequest("POST",r);break;case"dodge":r={path:i.dodge},this.dodgeModeActive()?this.executeRestRequest("DELETE",r).then(s=>{s.statusCode!==200&&this.dodgeModeActive.set(!1)}):this.executeRestRequest("POST",r).then(s=>{s.statusCode!==200&&this.dodgeModeActive.set(!0)});break;case"target_heading":r={path:i.target,value:t},this.executeRestRequest("PUT",r);break;case"standby":{let s={path:`${this.apEngaged()?i.disengage:i.engage}`};this.executeRestRequest("POST",s)}break;case"auto":case"compass":case"gps":case"wind":case"true wind":case"route":case"nav":yield this.setModeAndEnable(e,i);break;default:console.error("Unknown V2 command:",e),this.displayApError({statusCode:400,statusCodeDescription:"Unknown Command",message:`V2 command '${e}' is not supported`,widgetUUID:this.id()})}})}executeRestRequest(e,t){return Ve(this,null,function*(){try{let i;switch(e){case"POST":i=yield yr(this.makeHttpRequest(this.http.post(t.path,void 0)));break;case"PUT":i=yield yr(this.makeHttpRequest(this.http.put(t.path,t.value==null?void 0:t.value)));break;case"DELETE":i=yield yr(this.makeHttpRequest(this.http.delete(t.path)));break;default:console.error("[Autopilot Widget] Unsupported REST method:",e)}return i&&i.statusCode===200?i:(console.warn("[Autopilot Widget] V2 Command completed with non-success status:",JSON.stringify(i)),i||{statusCode:0,message:"Unavailable",state:"not provided"})}catch(i){return console.error("[Autopilot Widget] REST operation failed:",i),this.displayApError({statusCode:500,statusCodeDescription:"V2 Command Failed",message:`Failed to execute ${e} ${t.path}`,widgetUUID:this.id()}),{statusCode:0,message:i instanceof Error?i.message:"REST operation failed",state:null}}})}setModeAndEnable(e,t){return Ve(this,null,function*(){try{let i=yield this.executeRestRequest("PUT",{path:t.mode,value:{value:e}});if(i.statusCode!==200){console.error(`[Autopilot Widget] Failed to set mode '${e}':`,i);return}let a=yield this.executeRestRequest("PUT",{path:t.state,value:{value:"enabled"}});a.statusCode!==200&&console.error(`[Autopilot Widget] Failed to engage after mode '${e}':`,a)}catch(i){console.error("[Autopilot Widget] setModeAndEngage unexpected error:",i)}})}performTackOrGybe(e,t){if(this.runtime.options().autopilot.apiVersion==="v2")this.sendV2Command(e,{value:t});else{if(e!=="tack")return;let i=Nd[t==="port"?"tackToPort":"tackToStarboard"];this._requests.putRequest(i.path,i.value,this.id())}}setAbsoluteTarget(e){this.runtime.options().autopilot.apiVersion==="v2"?this.sendV2Command("target_heading",{value:e,units:"deg"}):console.error("[Autopilot Widget] Absolute target only available in V2 API")}toggleDodge(){this.runtime.options().autopilot.apiVersion==="v2"?this.sendV2Command("dodge"):(console.warn("[Autopilot Widget] Dodge mode only available in V2 API"),this.displayApError({statusCode:400,statusCodeDescription:"V2 API Required",message:"Dodge mode only available in V2 API",widgetUUID:this.id()}))}commandReceived(e){e.statusCode!=200&&this.displayApError(e)}confirmAdvanceWaypoint(e){this.startConfirmCmd(e,"Repeat key [Adv Wpt] to confirm")}confirmTack(e){let t="";if(e==="tackToPort")t="Port",this.actionToBeConfirmed=e;else if(e==="tackToStarboard")t="Starboard",this.actionToBeConfirmed=e;else{this.actionToBeConfirmed="";return}let i=`Repeat [Tack ${t}] key to confirm`;this.startConfirmCmd(e,i)}startConfirmCmd(e,t){this.countDownValue=Rd.COUNTDOWN_SECONDS,this.actionToBeConfirmed=e,this.countdownOverlayText.set(t),this.countdownOverlayVisibility.set("visible"),this.updateCountDownCounter(t),clearTimeout(this.handleConfirmActionTimeout),this.handleConfirmActionTimeout=setTimeout(()=>{this.countdownOverlayVisibility.set("hidden"),this.countdownOverlayText.set(""),this.actionToBeConfirmed=""},Rd.MESSAGE_DISPLAY_DURATION)}clearConfirmCmd(){clearTimeout(this.handleConfirmActionTimeout),clearTimeout(this.handleCountDownCounterTimeout),this.countDownValue=-1,this.countdownOverlayVisibility.set("hidden"),this.countdownOverlayText.set(""),this.actionToBeConfirmed=""}updateCountDownCounter(e){this.countDownValue>0?(clearTimeout(this.handleCountDownCounterTimeout),this.countdownOverlayText.set(e),this.countDownValue-=1,this.handleCountDownCounterTimeout=setTimeout(()=>{this.updateCountDownCounter(e)},1e3)):(this.countDownValue=-1,clearTimeout(this.handleCountDownCounterTimeout))}displayApError(e){if(this.isPersistentError){console.warn("[Autopilot Widget] Skipping temporary error display - persistent error active:",e.statusCodeDescription);return}let t=e.statusCode+" - "+e.statusCodeDescription+".";e.message&&(t=t+"Server Message: "+e.message+"."),this.errorOverlayText.set(t),this.errorOverlayVisibility.set("visible"),clearTimeout(this.handleDisplayErrorTimeout),this.handleDisplayErrorTimeout=setTimeout(()=>{this.isPersistentError||(this.errorOverlayVisibility.set("hidden"),this.errorOverlayText.set(""))},Rd.ERROR_DISPLAY_DURATION)}toggleMenu(){this.menuOpen.set(!this.menuOpen())}onMenuItemClick(e){if(e==="cancel"){this.toggleMenu();return}this.buildAndSendCommand(e),this.menuOpen.set(!1)}parseMenuItems(e,t){let i=this.runtime.options().autopilot.apiVersion;return e.map(r=>{if(r.isCancel)return fe(ae({},r),{current:!1,disabled:!1});let s=!1;if(i==="v1")switch(t){case"standby":s=r.action==="auto"||r.action==="wind";break;case"auto":s=r.action==="wind"||r.action==="route";break;case"wind":s=r.action==="auto";break;case"route":s=r.action==="auto";break;default:s=!1}else i==="v2"&&(s=this.runtime.options().autopilot.modes.includes(r.action));return fe(ae({},r),{current:r.action===t,disabled:!s})})}ngOnDestroy(){this.cancelAllHttpRequests(),clearTimeout(this.handleCountDownCounterTimeout),clearTimeout(this.handleConfirmActionTimeout),clearTimeout(this.handleDisplayErrorTimeout),clearTimeout(this.handleMessageTimeout)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-autopilot"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:93,vars:64,consts:[[1,"autopilot-grid-container"],[1,"ap-modes"],["mat-flat-button","",1,"ap-btn","ap-btn-ctrlbar",3,"click","disabled"],[1,"svg-icon-ctrlbar"],["width","100%","height","100%","viewBox","0 0 100 14","preserveAspectRatio","xMidYMid meet",1,"svg-element","svg-modes"],[0,"xml","space","preserve","x","50","y","10.7"],["mat-flat-button","",3,"click","disabled"],[0,"xml","space","preserve","x","50.090435","y","10.743966"],[1,"ap-screen"],[3,"apMode","targetPilotHeadingTrue","autopilotTarget","courseXte","compassHeading","headingDirectionTrue","appWindAngle","rudderAngle"],[1,"ap-screen-overlay"],["viewBox","0 0 100 100","width","100%","height","100%","preserveAspectRatio","xMidYMid meet"],["x","50%","y","25",1,"svg-element-msg",3,"innerHTML"],["x","50%","dy","75",1,"svg-element-msg",2,"font-size","3em",3,"innerHTML"],[1,"ap-screen-overlay","ap-error-text"],[1,"material-icons","ap-error-icon"],["x","50%","y","25",1,"svg-element-msg","svg-element-error-txt",3,"innerHTML"],["mat-flat-button","",1,"ap-btn",3,"click","disabled"],[1,"svg-icon"],["width","100%","height","100%","viewBox","0 0 100 100","preserveAspectRatio","xMidYMid meet",1,"svg-element"],["fill","currentColor","stroke","currentColor",0,"xml","space","preserve","x","49.894032","y","98.734871"],["fill","currentColor","stroke","currentColor","d","M 31.033486,35.785143 68.966514,66.630677 M 31.033486,35.640825 68.966514,4.79529"],["fill","currentColor","stroke","currentColor",0,"xml","space","preserve","x","50.052986","y","98.734871"],["fill","currentColor","stroke","currentColor","d","M 68.966514,35.785143 31.033486,66.630677 M 68.966514,35.640825 31.033486,4.79529"],["fill","currentColor","stroke","currentColor","d","M 15.778367,35.785143 53.711395,66.630677 M 15.778367,35.640825 53.711395,4.79529"],["fill","currentColor","stroke","currentColor","d","M 46.288608,35.785143 84.221633,66.630677 M 46.288608,35.640825 84.221633,4.79529"],["fill","currentColor","stroke","currentColor","d","M 84.221633,35.785143 46.288605,66.630677 M 84.221633,35.640825 46.288605,4.79529"],["fill","currentColor","stroke","currentColor","d","M 53.711392,35.785143 15.778367,66.630677 M 53.711392,35.640825 15.778367,4.79529"],["transform","scale(-1,1) translate(-100,0)"],["fill","currentColor","d","M 90.5,22.5 67.5,45 96,53 Z",2,"stroke-width","8","stroke-linecap","round","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["fill","none","stroke","currentColor","d",`M 76,31
47
- A 36 38 0 0 0 24,33`,2,"stroke-width","8.45947","stroke-linecap","square","stroke-linejoin","miter","stroke-miterlimit","0"],["fill","currentColor","cx","14.5","cy","45.25","r","12"],[1,"embed-widget",3,"widgetProperties"],["mat-flat-button","",1,"ap-btn",3,"disabled","ap-btn-active"],["viewBox","0 0 100 100","preserveAspectRatio","xMidYMid meet",1,"svg-element","svg-route"],["fill","currentColor","stroke","currentColor",0,"xml","space","preserve","x","49.961578","y","86.799866"],["fill","currentColor","d","M 12.090795,4 V 63.58544 L 71.676235,33.792718 Z",2,"stroke","none"],["fill","currentColor","stroke","currentColor","d","M 75.95674,4 V 63.58544",2,"fill","none","stroke-width","9.90493","stroke-linecap","butt","stroke-linejoin","miter","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],["tabindex","0","role","button","aria-label","Close menu",1,"svg-menu-overlay"],[1,"widgetOverlay"],[0,"xml","space","preserve","x","49.961578","y","86.799866"],["d","M 4.6584699,36.552789 29.229283,58.159051 M 4.6584699,36.451699 29.229283,14.845436",2,"stroke-linecap","round","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],["d","M 95.34153,36.552789 70.770717,58.159051 M 95.34153,36.451699 70.770717,14.845436",2,"stroke-linecap","round","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],[0,"xml","space","preserve","x","50.167503","y","61.058273",2,"font-size","68.6095px"],["tabindex","0","role","button","aria-label","Close menu",1,"svg-menu-overlay",3,"click","keyup.enter","keyup.space"],["tabindex","0","role","presentation","aria-label","Menu",1,"svg-menu",3,"click","keyup.enter","keyup.space"],["x","0","y","0","width","240",1,"svg-menu-box"],["tabindex","0","role","button",2,"cursor","pointer"],["tabindex","0","role","button",2,"cursor","pointer",3,"click","keyup.enter","keyup.space"],["x","0","width","240"],["x","120"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1)(2,"button",2),U("click",function(){return i.toggleMenu()}),d(3,"mat-icon",3),ie(),d(4,"svg",4)(5,"text",5),c(6),lt(7,"titlecase"),u()()()(),Ge(),d(8,"button",6),U("click",function(){return i.buildAndSendCommand("standby")}),d(9,"mat-icon",3),ie(),d(10,"svg",4)(11,"text",7),c(12,"Disengage"),u()()()()(),Ge(),d(13,"div",8),F(14,"app-svg-autopilot",9),d(15,"div",10),ie(),d(16,"svg",11),F(17,"text",12)(18,"text",13),u()(),Ge(),d(19,"div",14)(20,"span",15),c(21,"warning"),u(),ie(),d(22,"svg",11),F(23,"text",16),u()()(),Ge(),d(24,"div")(25,"button",17),U("click",function(){return i.buildAndSendCommand("-1")}),d(26,"mat-icon",18),ie(),d(27,"svg",19)(28,"text",20),c(29,"-1\xB0"),u(),F(30,"path",21),u()()()(),Ge(),d(31,"div")(32,"button",17),U("click",function(){return i.buildAndSendCommand("+1")}),d(33,"mat-icon",18),ie(),d(34,"svg",19)(35,"text",22),c(36,"+1\xB0"),u(),F(37,"path",23),u()()()(),Ge(),d(38,"div")(39,"button",17),U("click",function(){return i.buildAndSendCommand("-10")}),d(40,"mat-icon",18),ie(),d(41,"svg",19)(42,"text",20),c(43,"-10\xB0"),u(),F(44,"path",24)(45,"path",25),u()()()(),Ge(),d(46,"div")(47,"button",17),U("click",function(){return i.buildAndSendCommand("+10")}),d(48,"mat-icon",18),ie(),d(49,"svg",19)(50,"text",22),c(51,"+10\xB0"),u(),F(52,"path",26)(53,"path",27),u()()()(),Ge(),d(54,"div")(55,"button",17),U("click",function(){return i.buildAndSendCommand("tackToPort")}),d(56,"mat-icon",18),ie(),d(57,"svg",19)(58,"text",20),c(59,"Tack"),u(),d(60,"g",28),F(61,"path",29)(62,"path",30)(63,"circle",31),u()()()()(),Ge(),d(64,"div")(65,"button",17),U("click",function(){return i.buildAndSendCommand("tackToStarboard")}),d(66,"mat-icon",18),ie(),d(67,"svg",19)(68,"text",20),c(69,"Tack"),u(),F(70,"path",29)(71,"path",30)(72,"circle",31),u()()()(),Ge(),d(73,"div"),F(74,"widget-embedded",32),u(),d(75,"div"),F(76,"widget-embedded",32),u(),d(77,"div"),F(78,"widget-embedded",32),u(),d(79,"div"),F(80,"widget-embedded",32),u(),d(81,"div"),I(82,qw,9,11,"button",33),u(),d(83,"div")(84,"button",17),U("click",function(){return i.buildAndSendCommand("route")}),d(85,"mat-icon",18),ie(),d(86,"svg",34)(87,"text",35),c(88,"Adv Wpt"),u(),F(89,"path",36)(90,"path",37),u()()()()(),I(91,jw,6,2,"div",38),I(92,Yw,1,0,"div",39)),t&2&&(be("display",i.apGrid()),g(2),O("disabled",i.apState()==="off-line"||i.apMode()==="off-line"),g(4),ge("Mode ",kt(7,62,i.apMode())," \xA0\u22EE"),g(2),it(i.apEngaged()?"ap-btn ap-btn-ctrlbar ap-btn-engage":"ap-btn ap-btn-ctrlbar ap-btn-disengage"),O("disabled",i.apEngageBtnDisabled()),g(6),O("apMode",i.apMode())("targetPilotHeadingTrue",i.runtime.options().autopilot.courseDirectionTrue)("autopilotTarget",i.autopilotTarget())("courseXte",i.crossTrackError())("compassHeading",i.heading())("headingDirectionTrue",i.runtime.options().autopilot.headingDirectionTrue)("appWindAngle",i.windAngleApparent())("rudderAngle",i.rudder()),g(),be("visibility",i.countdownOverlayVisibility()),g(2),O("innerHTML",i.countdownOverlayText(),Dr),g(),be("visibility",i.countDownValue>=0?"visible":"hidden"),O("innerHTML",i.countDownValue+1,Dr),g(),be("visibility",i.errorOverlayVisibility()),g(4),O("innerHTML",i.errorOverlayText(),Dr),g(),be("display",i.adjustHdgBtnVisibility()||i.apMode()==="nav"&&i.dodgeModeActive()?"block":"none"),g(),O("disabled",i.apBtnDisabled()),g(6),be("display",i.adjustHdgBtnVisibility()||i.apMode()==="nav"&&i.dodgeModeActive()?"block":"none"),g(),O("disabled",i.apBtnDisabled()),g(6),be("display",i.adjustHdgBtnVisibility()||i.apMode()==="nav"&&i.dodgeModeActive()?"block":"none"),g(),O("disabled",i.apBtnDisabled()),g(7),be("display",i.adjustHdgBtnVisibility()||i.apMode()==="nav"&&i.dodgeModeActive()?"block":"none"),g(),O("disabled",i.apBtnDisabled()),g(7),be("display",i.tackBtnVisibility()?"block":"none"),g(),O("disabled",i.apBtnDisabled()),g(9),be("display",i.tackBtnVisibility()?"block":"none"),g(),O("disabled",i.apBtnDisabled()),g(8),be("display",i.routeBtnVisibility()&&!i.dodgeModeActive()?"block":"none"),g(),O("widgetProperties",i.nextWptProperties()),g(),be("display",i.routeBtnVisibility()&&!i.dodgeModeActive()?"block":"none"),g(),O("widgetProperties",i.etaProperties()),g(),be("display",i.routeBtnVisibility()&&!i.dodgeModeActive()?"block":"none"),g(),O("widgetProperties",i.dtwProperties()),g(),be("display",i.routeBtnVisibility()&&!i.dodgeModeActive()?"block":"none"),g(),O("widgetProperties",i.xteProperties()),g(),be("display",i.routeBtnVisibility()?"block":"none"),g(),N(i.runtime.options().autopilot.apiVersion==="v2"?82:-1),g(),be("display",i.routeBtnVisibility()?"block":"none"),g(),O("disabled",i.apBtnDisabled()||i.dodgeModeActive()),g(7),N(i.menuOpen()?91:-1),g(),N(i.dashboard.isDashboardStatic()?-1:92))},dependencies:[ug,nt,At,et,Qe,cg,mg,Dn],styles:['[_nghost-%COMP%]{display:block;height:100%;width:100%}.widget-host[_ngcontent-%COMP%]{display:block;height:100%;width:100%}.autopilot-grid-container[_ngcontent-%COMP%]{box-sizing:border-box;width:100%;height:100%;display:grid;gap:.5rem .5rem;padding:10px;grid-template:"modes modes" minmax(50px,1fr) "screen screen" minmax(50px,auto)/1fr 1fr;grid-template-rows:.15fr 1fr;grid-auto-rows:minmax(50px,2fr)}.ap-modes[_ngcontent-%COMP%]{grid-area:modes;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:minmax(50px,1fr);gap:.5rem .5rem}.ap-screen[_ngcontent-%COMP%]{position:relative;grid-area:screen;width:100%;height:100%;max-height:200px;align-content:center}.ap-screen-overlay[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:100%;z-index:50;vertical-align:middle;text-align:center;background-color:var(--mat-sys-background)}.ap-error-icon[_ngcontent-%COMP%]{padding-top:15px}.ap-error-text[_ngcontent-%COMP%]{color:var(--mat-sys-error-container)}.ap-btn[_ngcontent-%COMP%]{width:100%;border-radius:12px;align-items:center;justify-content:center;cursor:pointer;--mat-button-filled-container-color: var(--kip-blue-dim-color);--mat-button-filled-label-text-color: var(--kip-contrast-color);--mat-button-filled-container-height: 100%}.ap-btn-ctrlbar[_ngcontent-%COMP%]{padding:4px}.ap-btn-modes[_ngcontent-%COMP%]{--mat-button-filled-horizontal-padding: 0rem}.ap-btn-notifications[_ngcontent-%COMP%]{--mat-button-filled-container-color: var(--kip-yellow-dim-color)}.ap-btn-engage[_ngcontent-%COMP%]{--mat-button-filled-horizontal-padding: 0rem;--mat-button-filled-container-color: var(--kip-port-color)}.ap-btn-disengage[_ngcontent-%COMP%]{--mat-button-filled-horizontal-padding: 0rem;--mat-button-filled-container-color: var(--kip-starboard-color)}.svg-icon-ctrlbar[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;padding:0}.svg-icon[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;padding:.5rem}.svg-element[_ngcontent-%COMP%]{width:100%;height:100%;padding:0}.svg-element[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:25px;font-weight:700;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}.svg-element[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{stroke-width:7.59058;stroke-linecap:round;stroke-miterlimit:0;stroke-dasharray:none}.svg-element-msg[_ngcontent-%COMP%]{font-family:Roboto;font-size:12px;font-weight:700;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:var(--kip-contrast-color);fill-opacity:1;stroke:none}.svg-element-note[_ngcontent-%COMP%]{font-family:Roboto;font-size:.5em;font-weight:400;text-align:center;text-anchor:middle;font-style:italic;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:var(--kip-contrast-dim-color);fill-opacity:1;stroke:none}.svg-element-error-txt[_ngcontent-%COMP%]{fill:var(--mat-sys-error-container)}.svg-element-notifications[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}.svg-element-clear-notifications[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);fill-opacity:1;stroke:none}.svg-modes[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-size:12px}.svg-route[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-size:25px}.embed-widget[_ngcontent-%COMP%]{border:1px solid var(--mat-sys-surface-container-highest);border-radius:12px}@media(max-width:600px){.autopilot-grid-container[_ngcontent-%COMP%]{padding:.5rem;gap:.25rem}.autopilot-btn[_ngcontent-%COMP%]{font-size:.95rem;padding:.4em .5em}}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}.svg-menu-overlay[_ngcontent-%COMP%]{position:absolute;inset:0;background:#000c;z-index:19;display:flex;align-items:center;justify-content:center}.svg-menu-box[_ngcontent-%COMP%]{fill:var(--mat-sys-surface);stroke:none;border-radius:12px}.svg-menu[_ngcontent-%COMP%]{max-width:80%;background:transparent;border-radius:12px;box-shadow:0 4px 24px #00000026;z-index:20;display:block;font-family:Roboto;font-size:1.1rem;font-weight:700;text-anchor:middle;text-align:center;alignment-baseline:middle}g[_ngcontent-%COMP%]:hover rect[_ngcontent-%COMP%]{fill-opacity:.7}g[_ngcontent-%COMP%]:hover text[_ngcontent-%COMP%]{fill-opacity:.7}g[_ngcontent-%COMP%]:active rect[_ngcontent-%COMP%]{fill-opacity:.4}g[_ngcontent-%COMP%]:active text[_ngcontent-%COMP%]{fill-opacity:.4}.svg-menu-item[_ngcontent-%COMP%]{fill:var(--kip-blue-color);stroke:var(--mat-sys-outline-variant)}.svg-menu-item-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);stroke:none}.svg-menu-item-current[_ngcontent-%COMP%]{fill:var(--kip-blue-color);pointer-events:none;stroke:var(--mat-sys-outline-variant)}.svg-menu-item-current-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);stroke:none;pointer-events:none}.svg-menu-item-disabled[_ngcontent-%COMP%]{fill:var(--kip-blue-color);pointer-events:none;stroke:var(--mat-sys-outline-variant)}.svg-menu-item-disabled-text[_ngcontent-%COMP%]{fill:var(--mat-sys-surface-tint);stroke:none;pointer-events:none}.svg-menu-item-cancel[_ngcontent-%COMP%]{fill:var(--mat-sys-outline);stroke:var(--mat-sys-outline-variant)}.svg-menu-item-cancel-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);stroke:none}.counterText[_ngcontent-%COMP%]{font-weight:700;font-size:7em;margin-top:0;margin-bottom:0}']})}return n})();var Zw=["bmsSvg"];function Qw(n,o){n&1&&(D(0,"div",2)(1,"div",3),c(2,"No batteries detected"),R(),D(3,"div",4),c(4,"Check Signal K battery paths or select batteries in widget settings."),R()())}var pg=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={color:"contrast",ignoreZones:!1,bms:{trackedBatteryIds:[],banks:[]}};static VIEWBOX_WIDTH=200;static MIN_VIEWBOX_HEIGHT=1;static BANK_CARD_WIDTH=200;static BATTERY_CARD_HEIGHT=50;static BATTERY_CARD_WIDTH=195;static CARD_GAP=8;static BANK_HEADER_HEIGHT=60;static BANK_MIN_HEIGHT=75;static IN_BANK_COLUMNS=2;static IN_BANK_COLUMN_GAP=5;static IN_BANK_PADDING_X=5;static BANK_GAUGE_RADIUS=38;static BANK_GAUGE_BG_STROKE=8;static BANK_GAUGE_VALUE_STROKE=8;static PATH_BATCH_WINDOW_MS=500;runtime=y(we);data=y(Wt);units=y(at);iconRegistry=y(Jc);destroyRef=y(Ze);ngZone=y(Be);svgRef=pe.required("bmsSvg");svg;root;bankLayer;batteryLayer;bankGaugeBackgroundPath=this.buildSemiGaugeArcPath(n.BANK_GAUGE_RADIUS,1);renderFrameId=null;pendingRenderSnapshot=null;pathBatchTimerId=null;initialPathPaintDone=!1;pendingPathUpdates=new Map;powerAvailableIconTemplate=null;powerRenewalIconTemplate=null;discoveredBatteryIds=_([]);trackedBatteryIds=_([]);banks=_([]);batteries=_({});visibleBatteryIds=K(()=>{let e=this.trackedBatteryIds();return e.length?e:this.discoveredBatteryIds()});visibleBatteries=K(()=>{let e=this.visibleBatteryIds(),t=this.batteries();return e.map(i=>t[i]).filter(i=>!!i)});bankSummaries=K(()=>{let e=this.banks(),t=this.batteries();return e.map(i=>this.buildBankSummary(i,t))});colorRole=K(()=>this.runtime.options()?.color??n.DEFAULT_CONFIG.color);ignoreZones=K(()=>this.runtime.options()?.ignoreZones??!1);widgetColors=K(()=>{let e=this.theme();return e?Te(this.colorRole(),e):null});batteryDisplayModels=K(()=>{let e=this.visibleBatteries(),t=this.theme(),i=this.widgetColors(),a=this.ignoreZones(),r={};for(let s of e){let l=n.resolveZoneAwareColor(s.stateOfChargeState,i?.dimmer??"var(--kip-contrast-dimmer-color)",t,a),m=n.resolveZoneAwareColor(s.stateOfChargeState,i?.dim??"var(--kip-contrast-dim-color)",t,a),f=n.resolveZoneAwareColor(s.currentState,"var(--kip-contrast-dim-color)",t,a),b=n.resolveZoneAwareColor(s.currentState,"var(--kip-contrast-color)",t,a);r[s.id]={id:s.id,titleText:s.name||`Battery ${s.id}`,chargeWidth:(n.BATTERY_CARD_WIDTH-3)*(s.stateOfCharge??0),chargeBarColorCompact:l,chargeBarColorRegular:m,currentTextColorCompact:f,currentTextColorRegular:b,currentStrokeWidth:s.currentState!==Ae.Normal?.5:0,currentText:`${this.formatCurrent(s.current)}`.trim(),detailLineCompact:`${this.formatVoltage(s.voltage)}\xA0\xA0\xA0\xA0${this.formatTemperature(s.temperature)}`,detailLineRegular:`${this.formatVoltage(s.voltage)}\xA0\xA0\xA0\xA0${this.formatPower(s.power)}\xA0\xA0\xA0\xA0${this.formatTemperature(s.temperature)}`.trim(),socText:this.formatSoc(s.stateOfCharge),actualCapacityText:s.capacityActual?`${s.capacityActual} kWh`:"",remainingText:`${this.formatDuration(s.timeRemaining)}`.trim(),iconKey:s.current!=null&&s.current>0?"power_renewal":"power_available"}}return r});bankDisplayModels=K(()=>{let e=this.bankSummaries(),t=this.widgetColors(),i={};for(let a of e)i[a.id]={id:a.id,titleText:a.name||"Bank",currentText:this.formatCurrent(a.totalCurrent),powerText:this.formatPower(a.totalPower),socText:this.formatSoc(a.avgSoc),remainingText:`${this.formatDuration(a.timeRemaining)}`.trim(),remainingCapacityText:a.remainingCapacity?`${a.remainingCapacity} kWh`:"",gaugeValuePath:this.buildSemiGaugeArcPath(n.BANK_GAUGE_RADIUS,a.avgSoc),gaugeValueColor:t?.color??"var(--kip-contrast-color)",zoneState:null,zoneColor:null};return i});hasBatteries=K(()=>this.visibleBatteries().length>0);constructor(){L(()=>{let t=this.runtime.options();t&&B(()=>this.applyConfig(t))}),L(()=>{let t=this.bankSummaries(),i=this.visibleBatteries(),a=this.widgetColors(),r=this.batteryDisplayModels(),s=this.bankDisplayModels();!this.svg||!a||this.requestRender({banks:t,batteries:i,batteryDisplayModels:r,bankDisplayModels:s,widgetColors:a})});let e=this.data.subscribePathTreeWithInitial("self.electrical.batteries.*");if(e.initial.length){for(let t of e.initial)this.enqueuePathUpdate(t,!0);this.flushPendingPathUpdates(),this.initialPathPaintDone=!0}e.live$.pipe($e(this.destroyRef)).subscribe(t=>{this.enqueuePathUpdate(t)})}ngAfterViewInit(){this.initializeSvg(),this.loadPowerIcons(),this.requestRender()}ngOnDestroy(){this.pathBatchTimerId!==null&&(clearTimeout(this.pathBatchTimerId),this.pathBatchTimerId=null),this.renderFrameId!==null&&(cancelAnimationFrame(this.renderFrameId),this.renderFrameId=null),this.pendingRenderSnapshot=null}initializeSvg(){this.svg=Ca(this.svgRef().nativeElement),this.svg.attr("viewBox",`0 0 ${n.VIEWBOX_WIDTH} ${n.MIN_VIEWBOX_HEIGHT}`).attr("preserveAspectRatio","xMidYMid meet").attr("role","img").attr("aria-label","Battery Management System View"),this.root=this.svg.append("g").attr("class","bms-root"),this.bankLayer=this.root.append("g").attr("class","bms-banks"),this.batteryLayer=this.root.append("g").attr("class","bms-batteries")}loadPowerIcons(){this.loadNamedIcon("power_available",e=>{this.powerAvailableIconTemplate=e}),this.loadNamedIcon("power_renewal",e=>{this.powerRenewalIconTemplate=e})}loadNamedIcon(e,t){this.iconRegistry.getNamedSvgIcon(e).pipe(Jt(1)).subscribe({next:i=>{t(i),this.requestRender()},error:()=>{}})}applyConfig(e){let t=this.resolveBmsConfig(e);this.trackedBatteryIds.set(t.trackedBatteryIds),this.banks.set(t.banks)}resolveBmsConfig(e){let t=e.bms;return{trackedBatteryIds:Array.isArray(t?.trackedBatteryIds)?t.trackedBatteryIds:[],banks:(Array.isArray(t?.banks)?t.banks:[]).map(i=>fe(ae({},i),{connectionMode:this.normalizeConnectionMode(i.connectionMode)}))}}normalizeConnectionMode(e){return e==="series"?"series":"parallel"}enqueuePathUpdate(e,t=!1){let i=this.parseBatteryPath(e.path);if(!i)return;let{id:a,key:r}=i,s=e.update?.data?.value??null,l=e.update?.state??null,m=`${a}::${r}`;if(this.pendingPathUpdates.set(m,{id:a,key:r,value:s,state:l}),!t){if(!this.initialPathPaintDone){this.initialPathPaintDone=!0,this.flushPendingPathUpdates();return}this.pathBatchTimerId===null&&(this.pathBatchTimerId=window.setTimeout(()=>{this.pathBatchTimerId=null,this.flushPendingPathUpdates()},n.PATH_BATCH_WINDOW_MS))}}flushPendingPathUpdates(){if(!this.pendingPathUpdates.size)return;let e=Array.from(this.pendingPathUpdates.values());this.pendingPathUpdates.clear(),new Set(e.map(i=>i.id)).forEach(i=>this.trackDiscoveredBattery(i)),this.batteries.update(i=>{let a=i,r=!1;for(let s of e){let l=a[s.id]??{id:s.id},m=ae({},l),f=this.applyBatteryValue(m,s.key,s.value,s.state),b=!1;if(m.voltage!=null&&m.current!=null){let A=Number.isFinite(m.voltage)&&Number.isFinite(m.current)?m.voltage*m.current:null;Object.is(m.power,A)||(m.power=A,b=!0)}!f&&!b||(r||(a=ae({},a),r=!0),a[s.id]=m)}return r?a:i})}parseBatteryPath(e){let t=e.match(/self\.electrical\.batteries\.([^.]+)\.(.+)$/);return t?{id:t[1],key:t[2]}:null}trackDiscoveredBattery(e){let t=this.discoveredBatteryIds();if(t.includes(e))return;let i=[...t,e].sort();this.discoveredBatteryIds.set(i)}applyBatteryValue(e,t,i,a){switch(t){case"name":{let r=i;return e.name===r?!1:(e.name=r,!0)}case"location":{let r=i;return e.location===r?!1:(e.location=r,!0)}case"chemistry":{let r=i;return e.chemistry===r?!1:(e.chemistry=r,!0)}case"voltage":{let r=this.toNumber(i,"V");return Object.is(e.voltage,r)?!1:(e.voltage=r,!0)}case"current":{let r=this.toNumber(i,"A"),s=!Object.is(e.currentState??null,a??null);return Object.is(e.current,r)&&!s?!1:(e.current=r,e.currentState=a,!0)}case"temperature":{let r=this.toNumber(i,this.units.getDefaults().Temperature);return Object.is(e.temperature,r)?!1:(e.temperature=r,!0)}case"capacity.nominal":{let r=this.toNumber(i,"kWh");return Object.is(e.capacityNominal,r)?!1:(e.capacityNominal=r,!0)}case"capacity.actual":{let r=this.toNumber(i,"kWh");return Object.is(e.capacityActual,r)?!1:(e.capacityActual=r,!0)}case"capacity.remaining":{let r=this.toNumber(i,"kWh");return Object.is(e.capacityRemaining,r)?!1:(e.capacityRemaining=r,!0)}case"capacity.stateOfCharge":{let r=this.toNumber(i,"ratio"),s=!Object.is(e.stateOfChargeState??null,a??null);return Object.is(e.stateOfCharge,r)&&!s?!1:(e.stateOfCharge=r,e.stateOfChargeState=a,!0)}case"capacity.timeRemaining":{let r=this.toNumber(i,"s");return Object.is(e.timeRemaining,r)?!1:(e.timeRemaining=r,!0)}default:return!1}}buildBankSummary(e,t){let i=e.batteryIds.map(b=>t[b]).filter(b=>!!b),a=this.normalizeConnectionMode(e.connectionMode),r=this.calculateBankCurrent(i,a),s=this.sumNumbers(i.map(b=>b.power)),l=this.sumNumbers(i.map(b=>b.capacityRemaining)),m=this.calculateBankSoc(i),f=this.calculateBankTimeRemaining(i,a);return{id:e.id,name:e.name,batteryIds:e.batteryIds,totalCurrent:r,totalPower:s,remainingCapacity:l,avgSoc:m,timeRemaining:f}}calculateBankSoc(e){let t=this.sumNumbers(e.map(r=>r.capacityRemaining)),i=this.sumNumbers(e.map(r=>r.capacityActual));if(t!=null&&i!=null&&i>0)return Math.max(0,Math.min(1,t/i));let a=this.sumNumbers(e.map(r=>r.capacityNominal));return t!=null&&a!=null&&a>0?Math.max(0,Math.min(1,t/a)):this.averageNumbers(e.map(r=>r.stateOfCharge))}calculateBankCurrent(e,t){let i=e.map(a=>a.current);return t==="series"?this.averageNumbers(i):this.sumNumbers(i)}calculateBankTimeRemaining(e,t){let i=e.map(a=>a.timeRemaining);return t==="series"?this.minNumber(i):this.averageNumbers(i)}requestRender(e){this.svg&&(this.pendingRenderSnapshot=e??this.buildRenderSnapshot(),this.pendingRenderSnapshot&&this.renderFrameId===null&&(this.renderFrameId=requestAnimationFrame(()=>{this.renderFrameId=null;let t=this.pendingRenderSnapshot;this.pendingRenderSnapshot=null,t&&this.ngZone.runOutsideAngular(()=>this.render(t))})))}buildRenderSnapshot(){let e=this.widgetColors();return e?{banks:this.bankSummaries(),batteries:this.visibleBatteries(),batteryDisplayModels:this.batteryDisplayModels(),bankDisplayModels:this.bankDisplayModels(),widgetColors:e}:null}render(e){if(!this.bankLayer||!this.batteryLayer)return;let{banks:t,batteries:i,bankDisplayModels:a,batteryDisplayModels:r,widgetColors:s}=e,l=this.buildRenderLayout(t,i,a,r),m=Math.max(n.MIN_VIEWBOX_HEIGHT,l.contentHeight);this.svg?.attr("viewBox",`0 0 ${n.VIEWBOX_WIDTH} ${m}`),this.root?.attr("transform",null);let f=this.bankLayer.selectAll("g.bank-card").data(l.banks,E=>E.id),b=f.enter().append("g").attr("class","bank-card");b.append("rect").attr("class","bank-card").attr("rx",4).attr("ry",4),b.append("text").attr("class","bank-card-power"),b.append("text").attr("class","bank-card-current");let A=b.append("g").attr("class","bank-gauge");A.append("path").attr("class","bank-gauge-bg"),A.append("path").attr("class","bank-gauge-value"),A.append("text").attr("class","bank-gauge-soc"),b.append("text").attr("class","bank-actualCapacity"),b.append("text").attr("class","bank-remaining"),b.append("g").attr("class","bank-bms-batteries"),b.append("text").attr("class","bank-title");let C=b.merge(f);C.attr("transform",E=>`translate(${E.x},${E.y})`),C.select("rect").attr("width",E=>E.width).attr("height",E=>E.height).attr("stroke","var(--mat-sys-outline-variant)").attr("stroke-width",.5),C.select("text.bank-title").attr("x",5).attr("y",16).attr("fill","var(--kip-contrast-dim-color)").attr("font-size",15.5).attr("opacity",.8).text(E=>E.displayModel.titleText),C.select("text.bank-card-current").attr("x",10).attr("y",37).attr("fill","var(--kip-contrast-color)").attr("font-size",16).text(E=>E.displayModel.currentText),C.select("text.bank-card-power").attr("x",10).attr("y",49).attr("fill","var(--kip-contrast-color)").attr("font-size",10).attr("opacity",.8).text(E=>E.displayModel.powerText),C.select("g.bank-gauge").attr("transform","translate(150, 46)"),C.select("path.bank-gauge-bg").attr("d",this.bankGaugeBackgroundPath).attr("fill","none").attr("stroke","var(--kip-contrast-dimmer-color)").attr("stroke-width",n.BANK_GAUGE_BG_STROKE).attr("stroke-linecap","round"),C.select("path.bank-gauge-value").attr("d",E=>E.displayModel.gaugeValuePath).attr("fill","none").attr("stroke",E=>E.displayModel.gaugeValueColor).attr("stroke-width",n.BANK_GAUGE_VALUE_STROKE).attr("stroke-linecap","round"),C.select("text.bank-gauge-soc").attr("x",0).attr("y",-2).attr("text-anchor","middle").attr("fill","var(--kip-contrast-color)").attr("font-size",25).attr("font-weight",700).text(E=>E.displayModel.socText),C.select("text.bank-remaining").attr("x",150).attr("y",22).attr("fill","var(--kip-contrast-dim-color)").attr("text-anchor","middle").attr("font-size",6).text(E=>E.displayModel.remainingText),C.select("text.bank-actualCapacity").attr("x",150).attr("y",53).attr("fill","var(--kip-contrast-dim-color)").attr("text-anchor","middle").attr("font-size",8).text(E=>E.displayModel.remainingCapacityText),C.select("g.bank-bms-batteries").each((E,W,V)=>{let j=Ca(V[W]).selectAll("g.battery-card").data(E.batteries,ne=>ne.key),ye=j.enter().append("g").attr("class","battery-card battery-card--in-bank");this.appendBatteryCardSkeleton(ye);let me=ye.merge(j);this.renderBatteryCards(me,s),j.exit().remove()}),f.exit().remove();let w=this.batteryLayer.selectAll("g.battery-card").data(l.unassignedBatteries,E=>E.key),M=w.enter().append("g").attr("class","battery-card battery-card--unassigned");this.appendBatteryCardSkeleton(M);let G=M.merge(w);this.renderBatteryCards(G,s),w.exit().remove(),this.root?.attr("data-theme","ready")}buildRenderLayout(e,t,i,a){let r=new Map(t.map(V=>[V.id,V])),s=new Set,l=this.computeInBankBatteryScale(),m=n.BATTERY_CARD_HEIGHT*l,f=this.computeInBankBatterySlotWidth(),b=0,A=e.map(V=>{let Y=new Set,j=V.batteryIds.map(oe=>r.get(oe)).filter(oe=>!oe||Y.has(oe.id)?!1:(Y.add(oe.id),!0));j.forEach(oe=>s.add(oe.id));let ye=Math.ceil(j.length/n.IN_BANK_COLUMNS),me=ye>0?ye*m+(ye-1)*n.CARD_GAP:0,ne=Math.max(n.BANK_MIN_HEIGHT,n.BANK_HEADER_HEIGHT+me+n.CARD_GAP),re=j.map((oe,de)=>{let le=de%n.IN_BANK_COLUMNS,ve=Math.floor(de/n.IN_BANK_COLUMNS),ze=n.IN_BANK_PADDING_X+le*(f+n.IN_BANK_COLUMN_GAP),ot=n.BANK_HEADER_HEIGHT+ve*(m+n.CARD_GAP);return{id:oe.id,displayModel:a[oe.id],key:`${V.id}::${oe.id}`,x:ze,y:ot,scale:l,compact:!0}}),ce={id:V.id,name:V.name,batteryIds:V.batteryIds,totalCurrent:V.totalCurrent,totalPower:V.totalPower,avgSoc:V.avgSoc,remainingCapacity:V.remainingCapacity,timeRemaining:V.timeRemaining,displayModel:i[V.id],x:0,y:b,width:n.BANK_CARD_WIDTH,height:ne,batteries:re};return b+=ne+n.CARD_GAP,ce}),C=A.length>0?b:0,w=t.filter(V=>!s.has(V.id)).sort((V,Y)=>V.id.localeCompare(Y.id)).map((V,Y)=>({id:V.id,displayModel:a[V.id],key:V.id,x:0,y:C+Y*(n.BATTERY_CARD_HEIGHT+n.CARD_GAP),scale:1,compact:!1})),M=A[A.length-1],G=M?M.y+M.height:0,E=w[w.length-1],W=E?E.y+n.BATTERY_CARD_HEIGHT:0;return{banks:A,unassignedBatteries:w,contentHeight:Math.max(G,W)}}computeInBankBatterySlotWidth(){return(n.BANK_CARD_WIDTH-n.IN_BANK_PADDING_X*2-n.IN_BANK_COLUMN_GAP)/n.IN_BANK_COLUMNS}computeInBankBatteryScale(){let e=this.computeInBankBatterySlotWidth();return Math.max(.35,Math.min(1,e/n.BATTERY_CARD_WIDTH))}appendBatteryCardSkeleton(e){e.append("rect").attr("class","bms-battery").attr("rx",4).attr("ry",4),e.append("rect").attr("class","bms-battery-tip").attr("rx",1).attr("ry",1),e.append("rect").attr("class","bms-charge-fill").attr("rx",3).attr("ry",3),e.append("g").attr("class","bms-state-icon"),e.append("text").attr("class","bms-ampere"),e.append("text").attr("class","bms-volt-power"),e.append("text").attr("class","bms-soc"),e.append("text").attr("class","bms-actualCapacity"),e.append("text").attr("class","bms-remaining"),e.append("text").attr("class","bms-title")}renderBatteryCards(e,t){e.attr("transform",i=>`translate(${i.x},${i.y}) scale(${i.scale})`),e.select("rect.bms-battery").attr("width",n.BATTERY_CARD_WIDTH).attr("height",n.BATTERY_CARD_HEIGHT).attr("fill","var(--mat-sys-background)").attr("stroke","var(--kip-contrast-dimmer-color)").attr("stroke-width",0),e.select("rect.bms-battery-tip").attr("x",n.BATTERY_CARD_WIDTH+1).attr("y",n.BATTERY_CARD_HEIGHT/2-10).attr("width",4).attr("height",20).attr("fill","var(--mat-sys-background)").attr("stroke",t.color).attr("stroke-width",0),e.select("rect.bms-charge-fill").attr("x",1.5).attr("y",1.5).attr("width",i=>i.displayModel.chargeWidth).attr("height",n.BATTERY_CARD_HEIGHT-3).attr("fill",i=>i.compact?i.displayModel.chargeBarColorCompact:i.displayModel.chargeBarColorRegular),e.select("text.bms-title").attr("x",5).attr("y",i=>i.compact?11:14).attr("fill","var(--kip-contrast-dim-color)").attr("font-size",i=>i.compact?8:12).text(i=>i.displayModel.titleText),e.select("text.bms-ampere").attr("x",10).attr("y",33).attr("fill",i=>i.compact?i.displayModel.currentTextColorCompact:i.displayModel.currentTextColorRegular).attr("stroke","var(--kip-widget-card-background-color)").attr("stroke-width",i=>i.displayModel.currentStrokeWidth).attr("font-size",16).text(i=>i.displayModel.currentText),e.select("text.bms-volt-power").attr("x",10).attr("y",45).attr("fill","var(--kip-contrast-dim-color)").attr("font-size",8).attr("opacity",.8).text(i=>i.compact?i.displayModel.detailLineCompact:i.displayModel.detailLineRegular),e.select("text.bms-soc").attr("x",n.BATTERY_CARD_WIDTH-33).attr("y",34).attr("fill",i=>i.compact?"var(--kip-contrast-dim-color)":"var(--kip-contrast-color)").attr("text-anchor","middle").attr("font-size",25).attr("font-weight",700).text(i=>i.displayModel.socText),e.select("text.bms-actualCapacity").attr("x",n.BATTERY_CARD_WIDTH-33).attr("y",45).attr("fill","var(--kip-contrast-dim-color)").attr("text-anchor","middle").attr("font-size",8).text(i=>i.compact?"":i.displayModel.actualCapacityText),e.select("text.bms-remaining").attr("x",n.BATTERY_CARD_WIDTH-33).attr("y",12).attr("fill","var(--kip-contrast-dim-color)").attr("text-anchor","middle").attr("font-size",6).text(i=>i.compact?"":i.displayModel.remainingText),e.select("g.bms-state-icon").attr("transform",`translate(${n.BATTERY_CARD_WIDTH/2-18}, ${n.BATTERY_CARD_HEIGHT/2-18})`).attr("display",i=>i.compact&&i.scale<.45?"none":null).attr("color",i=>i.compact?t.dim:t.color).each((i,a,r)=>{let s=Ca(r[a]),l=i.displayModel.iconKey,m=l==="power_renewal"?this.powerRenewalIconTemplate:this.powerAvailableIconTemplate;if(!m){s.selectAll("*").remove(),s.attr("data-icon-key",null);return}let f=s.node();if(!f||s.attr("data-icon-key")===l&&f.firstElementChild)return;s.selectAll("*").remove();let A=m.cloneNode(!0);A.removeAttribute("id"),A.setAttribute("width","36"),A.setAttribute("height","36"),A.getAttribute("viewBox")||A.setAttribute("viewBox","0 0 24 24"),f.appendChild(A),s.attr("data-icon-key",l)})}formatVoltage(e){return e==null?"-- V":`${e.toFixed(1)}V`}formatCurrent(e){return e==null?"-- A":`${e.toFixed(1)}A`}formatPower(e){return e==null?"":`${e.toFixed(0)}W`}formatSoc(e){return e==null?"--%":`${Math.round(e*100)}%`}formatDuration(e){return e==null?"":this.units.convertToUnit("D HH:MM:SS",e).toString()}sumNumbers(e){let t=e.filter(i=>typeof i=="number");return t.length?t.reduce((i,a)=>i+a,0):null}averageNumbers(e){let t=e.filter(i=>typeof i=="number");return t.length?t.reduce((i,a)=>i+a,0)/t.length:null}minNumber(e){let t=e.filter(i=>typeof i=="number");return t.length?Math.min(...t):null}toNumber(e,t){return e==null||typeof e!="number"?null:this.units.convertToUnit(t,e)??e}formatTemperature(e){return e==null||typeof e!="number"?"":`${e.toFixed(1)} ${this.units.getDefaults().Temperature==="celsius"?"\xB0C":"\xB0F"}`}static resolveZoneAwareColor(e,t,i,a){if(a||!e||!i)return t;switch(e){case Ae.Nominal:return i.zoneNominal;case Ae.Alarm:return i.zoneAlarm;case Ae.Warn:return i.zoneWarn;case Ae.Alert:return i.zoneAlert;default:return t}}buildSemiGaugeArcPath(e,t){let i=Math.max(0,Math.min(1,t??0)),a=-Math.PI*.55,r=Math.PI*1.1,s=a+r*i;if(i<=0){let l=e*Math.cos(a),m=e*Math.sin(a);return`M ${l} ${m}`}return ud()({innerRadius:e,outerRadius:e,startAngle:a,endAngle:s})??""}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-bms"]],viewQuery:function(t,i){t&1&&Me(i.svgRef,Zw,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:3,vars:1,consts:[["bmsSvg",""],["aria-hidden","false",1,"bms-svg"],[1,"bms-empty"],[1,"bms-empty-title"],[1,"bms-empty-sub"]],template:function(t,i){t&1&&(ie(),Q(0,"svg",1,0),I(2,Qw,5,0,"div",2)),t&2&&(g(2),N(i.hasBatteries()?-1:2))},dependencies:[et],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;position:relative;overflow:hidden}.bms-svg[_ngcontent-%COMP%]{height:100%;width:100%;padding:12px}.bms-card-metric[_ngcontent-%COMP%]{fill:var(--mat-sys-on-surface);font-size:30px;font-weight:700}.bms-card-sub[_ngcontent-%COMP%]{fill:var(--mat-sys-on-surface);font-size:18px;opacity:.9}.bms-card-meta[_ngcontent-%COMP%]{fill:var(--mat-sys-on-surface);font-size:15px;opacity:.75}.bms-card-footer[_ngcontent-%COMP%]{fill:var(--mat-sys-on-surface);font-size:16px;opacity:.8}.bms-flow-line[_ngcontent-%COMP%]{stroke:var(--kip-zone-nominal-color);stroke-width:3px;stroke-dasharray:6 6;animation:_ngcontent-%COMP%_flow-dash 2s linear infinite}.bms-flow-line--out[_ngcontent-%COMP%]{stroke:var(--kip-zone-warn-color)}.bms-flow-line--in[_ngcontent-%COMP%]{stroke:var(--kip-zone-nominal-color)}.bms-flow-line--neutral[_ngcontent-%COMP%]{stroke:var(--kip-widget-card-border-color);animation:none}.bms-empty[_ngcontent-%COMP%]{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;color:var(--mat-sys-on-surface);background:color-mix(in srgb,var(--kip-widget-card-background-color) 92%,transparent)}.bms-empty-title[_ngcontent-%COMP%]{font-size:18px;font-weight:600}.bms-empty-sub[_ngcontent-%COMP%]{font-size:14px;opacity:.8}@keyframes _ngcontent-%COMP%_flow-dash{to{stroke-dashoffset:-12}}"],changeDetection:0})}return n})();var Xw=["Core","Gauge","Component","Racing"];var cl=(()=>{class n{_pluginConfig=y(es);_widgetCategories=[...Xw];_componentTypeCache=new Map;_componentTypeMap={WidgetNumericComponent:Tm,WidgetTextComponent:Em,WidgetWindTrendsChartComponent:Dm,WidgetWindComponent:Rm,WidgetTutorialComponent:Om,WidgetSliderComponent:Vm,WidgetSimpleLinearComponent:Wm,WidgetRacesteerComponent:Bm,WidgetRacerTimerComponent:Um,WidgetRacerLineComponent:Hm,WidgetRaceTimerComponent:qm,WidgetPositionComponent:$m,WidgetAisRadarComponent:Gp,WidgetLabelComponent:zp,WidgetIframeComponent:Up,WidgetHorizonComponent:Hp,WidgetHeelGaugeComponent:qp,WidgetSteelGaugeComponent:jp,WidgetGaugeNgRadialComponent:ef,WidgetGaugeNgLinearComponent:nf,WidgetGaugeNgCompassComponent:rf,WidgetFreeboardskComponent:Wu,WidgetAnchorAlarmComponent:sf,WidgetDatetimeComponent:lf,WidgetDataChartComponent:eg,WidgetBooleanSwitchComponent:ag,WidgetMultiStateSwitchComponent:rg,WidgetZonesStatePanelComponent:lg,WidgetAutopilotComponent:hg,WidgetBmsComponent:pg};_widgetDefinition=[{name:"Numeric",description:"Displays numeric data in a clear and concise format, with options to show minimum and/or maximum recorded values. Includes an optional background minichart for quick visual trend insights.",icon:"numericWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-numeric",componentClassName:"WidgetNumericComponent"},{name:"Text",description:"Displays text data with a customizable color formatting option.",icon:"textWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-text",componentClassName:"WidgetTextComponent"},{name:"Date & Time",description:"Displays date and time data with fully custom formatting options and timezone correction.",icon:"datetimeWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-datetime",componentClassName:"WidgetDatetimeComponent"},{name:"Position",description:"Displays latitude and longitude for location tracking and navigation.",icon:"positionWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-position",componentClassName:"WidgetPositionComponent"},{name:"Static Label",description:"A static text widget that allows you to add customizable labels to your dashboard, helping to organize and clarify your layout effectively.",icon:"labelWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-label",componentClassName:"WidgetLabelComponent"},{name:"Switch Panel",description:"A Digital Switching panel group with multiple controls including toggle switches, indicator lights, and press buttons to send Signal K paths values and other operations.",icon:"switchpanelWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-boolean-switch",componentClassName:"WidgetBooleanSwitchComponent"},{name:"Multi-State Switch",description:"Lists all available device/path operating modes/states (e.g., On, Off, Charge Only, Invert Only), highlights the current state, and lets you select a new state to send to the device and see the result.",icon:"multiStateSwitchWidget",minWidth:2,minHeight:2,defaultWidth:4,defaultHeight:4,category:"Core",requiredPlugins:[],selector:"widget-multi-state-switch",componentClassName:"WidgetMultiStateSwitchComponent"},{name:"Zones State Panel",description:"Displays the data state (severity and message) of the path's Zones (based on Signal K path metadata configuration).",icon:"zonesStatePanel",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-zones-state-panel",componentClassName:"WidgetZonesStatePanelComponent"},{name:"Slider",description:"A Digital Switching range slider that allows users to adjust values, such as controlling lighting intensity or audio volume from 0% to 100%.",icon:"sliderWidget",minWidth:2,minHeight:2,defaultWidth:4,defaultHeight:4,category:"Core",requiredPlugins:[],selector:"widget-slider",componentClassName:"WidgetSliderComponent"},{name:"Compact Linear",description:"A simple horizontal linear gauge with a large value label offering a clean, compact modern look.",icon:"simpleLinearGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-simple-linear",componentClassName:"WidgetSimpleLinearComponent"},{name:"Linear",description:"A horizontal or vertical linear gauge that supports zone highlighting.",icon:"linearGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-ng-linear",componentClassName:"WidgetGaugeNgLinearComponent"},{name:"Radial",description:"A radial gauge with configurable capacity and measurement dials plus zone highlighting.",icon:"radialGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-ng-radial",componentClassName:"WidgetGaugeNgRadialComponent"},{name:"Compass",description:"A faceplate or card-style rotating compass gauge with multiple cardinal point indicator options.",icon:"compassGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-ng-compass",componentClassName:"WidgetGaugeNgCompassComponent"},{name:"Level Gauge",description:"Dual-scale heel angle indicator combining a high\u2011precision \xB15\xB0 fine level with a wide \xB140\xB0 coarse arc for fast trim tuning and broader heel / sea\u2011state monitoring.",icon:"level",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-heel-gauge",componentClassName:"WidgetHeelGaugeComponent"},{name:"Pitch & Roll",description:"Horizon-style attitude indicator showing live pitch and roll degrees with smooth animation\u2014ideal for monitoring trim, heel, and sea-state response.",icon:"pitchRollGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-horizon",componentClassName:"WidgetHorizonComponent"},{name:"Battery Monitor",description:"Monitors battery banks and individual batteries with aggregated bank totals plus per-battery detail cards. Displays key BMS values such as state of charge, current, voltage, power, temperature, capacity, and time remaining for a clearer view of overall bank health and individual battery status.",icon:"battery_charging",minWidth:2,minHeight:2,defaultWidth:8,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-bms",componentClassName:"WidgetBmsComponent"},{name:"Classic Steel",description:"A traditional steel looking linear & radial gauges replica that supports range sizes and zones highlights.",icon:"steelGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-steel",componentClassName:"WidgetSteelGaugeComponent"},{name:"Windsteer",description:"A wind steering display that combines wind, wind sectors, heading, course over ground and next waypoint information.",icon:"windsteeringWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-wind-steer",componentClassName:"WidgetWindComponent"},{name:"Freeboard-SK",description:"Adds the Freeboard-SK chart plotter as a widget with automatic sign-in to your dashboard.",icon:"freeboardWidget",minWidth:6,minHeight:8,defaultWidth:6,defaultHeight:14,category:"Component",requiredPlugins:["freeboard-sk","tracks","resources-provider","course-provider"],selector:"widget-freeboardsk",componentClassName:"WidgetFreeboardskComponent"},{name:"Autopilot Head",description:"Provides typical autopilot controls for Signal K v1 & v2 Autopilot API devices. Requires a compatible hardware-specific Autopilot plugin for full functionality.",icon:"autopilotWidget",minWidth:3,minHeight:9,defaultWidth:4,defaultHeight:10,category:"Component",requiredPlugins:[],anyOfPlugins:["autopilot","pypilot-autopilot-provider"],selector:"widget-autopilot",componentClassName:"WidgetAutopilotComponent"},{name:"Realtime Data Chart",description:"Visualizes data on a real-time chart with multiple preconfigured series including actuals, SMA and period overall averages and Min/Max. Requires the KIP Dataset to be configured.",icon:"datachartWidget",minWidth:2,minHeight:3,defaultWidth:6,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-data-chart",componentClassName:"WidgetDataChartComponent"},{name:"Anchor Watch",description:"Monitors your anchor position and triggers an alarm if you drift outside a configured radius (anchor drag). Set the anchor point, watch radius, and alarm behavior (sound/notification) in the widget config. Requires internet connectivity to view map.",icon:"anchorWatch",minWidth:6,minHeight:8,defaultWidth:6,defaultHeight:14,category:"Component",requiredPlugins:["anchoralarm"],selector:"widget-anchor-alarm",componentClassName:"WidgetAnchorAlarmComponent"},{name:"AIS Radar",description:"Displays AIS targets with range rings, interactive target details, and quick zoom and filtering controls.",icon:"aisradar",minWidth:4,minHeight:4,defaultWidth:5,defaultHeight:8,category:"Component",requiredPlugins:[],selector:"widget-ais-radar",componentClassName:"WidgetAisRadarComponent"},{name:"Embed Webpage Viewer",description:"Embeds external web-based applications\u2014such as Grafana graphs or other Signal K apps\u2014into your dashboard for seamless integration. Interaction is disabled by default but can be enabled.",icon:"embedWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-iframe",componentClassName:"WidgetIframeComponent"},{name:"Tutorial",description:"An instructional widget that guides new users through basic navigation, gestures, and dashboard editing steps.",icon:"helpWidget",minWidth:4,minHeight:4,defaultWidth:4,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-tutorial",componentClassName:"WidgetTutorialComponent"},{name:"Racesteer (BETA)",description:"A dynamic race steering display that fuses polar performance data with live conditions to guide optimal steering, tacking, and gybing angles for maximum speed. Instantly compare performance against competition polars for smarter tactical decisions.",icon:"racesteeringWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Racing",requiredPlugins:["signalk-polar-performance-plugin"],selector:"widget-racesteer",componentClassName:"WidgetRacesteerComponent"},{name:"Racer - Start Line Insight",description:"Gain a tactical advantage for racing starts: set and adjust the port and starboard ends of the start line, see your distance to the line, the favored end, and how much the line is favored or unfavored. Includes visual integration with Freeboard SK for interactive line adjustment and display.",icon:"racerlineWidget",minWidth:4,minHeight:4,defaultWidth:4,defaultHeight:4,requiredPlugins:["signalk-racer"],category:"Racing",selector:"widget-racer-line",componentClassName:"WidgetRacerLineComponent"},{name:"Racer - Start Timer",description:"An advanced racing countdown timer that indicates OCS (On Course Side) status. Set the start line, choose or adjust the duration, or specify the exact start time. Automatically switches to the target dashboard at the start unless over early.",icon:"racertimerWidget",minWidth:4,minHeight:4,defaultWidth:4,defaultHeight:4,requiredPlugins:["signalk-racer"],category:"Racing",selector:"widget-racer-timer",componentClassName:"WidgetRacerTimerComponent"},{name:"Wind Trends",description:"A real-time wind trends graph with dual axes for direction and speed. Displays live values and simple moving averages over the current period\u2019s average.",icon:"windtrendsWidget",minWidth:8,minHeight:6,defaultWidth:10,defaultHeight:8,category:"Racing",requiredPlugins:[],selector:"widget-windtrends-chart",componentClassName:"WidgetWindTrendsChartComponent"}];get kipWidgets(){return this._widgetDefinition}get categories(){return this._widgetCategories}getComponentType(e){let t=this._componentTypeCache.get(e);if(t)return t;let i=this._widgetDefinition.find(r=>r.selector===e);if(!i)return;let a=this._componentTypeMap[i.componentClassName];if(a)return this._componentTypeCache.set(e,a),a}getKipWidgetsWithStatus(){return Ve(this,null,function*(){let e={},t=Array.from(new Set(this._widgetDefinition.flatMap(i=>[...i.requiredPlugins||[],...i.anyOfPlugins||[]])));return yield Promise.all(t.map(i=>Ve(this,null,function*(){let a=yield this._pluginConfig.getPlugin(i);e[i]=a.ok}))),this._widgetDefinition.map(i=>{let a=i.requiredPlugins||[],r=i.anyOfPlugins||[],s=a.map(b=>({name:b,enabled:e[b],required:!0})),l=r.map(b=>({name:b,enabled:e[b],required:!1})),m=[...s,...l],f=s.every(b=>b.enabled);return f&&r.length>0&&(f=l.some(b=>b.enabled)),fe(ae({},i),{isDependencyValid:f,pluginsStatus:m})})})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function Kw(n,o){n&1&&(d(0,"span"),c(1,", "),u())}function Jw(n,o){if(n&1&&(d(0,"span",8),c(1),d(2,"span",9),c(3),u()(),I(4,Kw,2,0,"span")),n&2){let e=o.$implicit,t=o.$index,i=o.$count,a=k(2);O("ngClass",a.pluginDependencyValid()?e.required?"dependency-required-ok":e.enabled?"dependency-optional-ok":"dependency-optional-missing-met":e.enabled?e.required?"dependency-required-ok":"dependency-optional-ok":e.required?"dependency-required-error":"dependency-optional-error"),J("title",e.required?"Required":"Optional"),g(),Ut(" ",e.enabled?"\u2714":"\u2716"," ",e.name," "),g(2),X(e.required?"":"(optional)"),g(),N(t!==i-1?4:-1)}}function e_(n,o){if(n&1&&(d(0,"div",7)(1,"span"),c(2,"Plugins:"),u(),xe(3,Jw,5,6,null,null,Ne),u()),n&2){let e=k();Ba(e.pluginsStatus().length>0?"margin-bottom: 8px;margin-top: 4px;":""),g(),it(e.pluginDependencyValid()?"":"dependency-error"),g(2),Ce(e.pluginsStatus())}}var fg=(()=>{class n{svgIcon=x.required();iconSize=x.required();name=x.required();description=x.required();pluginsStatus=x.required();pluginDependencyValid=x.required();onKeydown(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.target.click())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-list-card"]],hostBindings:function(t,i){t&1&&U("keydown",function(r){return i.onKeydown(r)})},inputs:{svgIcon:[1,"svgIcon"],iconSize:[1,"iconSize"],name:[1,"name"],description:[1,"description"],pluginsStatus:[1,"pluginsStatus"],pluginDependencyValid:[1,"pluginDependencyValid"]},decls:9,vars:11,consts:[["role","button","tabindex","0",1,"item-container"],[1,"item-icon"],["aria-hidden","false",3,"svgIcon"],[1,"item-label"],[1,"title","no-text-select"],[1,"dependency","no-text-select",3,"style"],[1,"description","no-text-select"],[1,"dependency","no-text-select"],[3,"ngClass"],[1,"plugin-type-label"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1),F(2,"mat-icon",2),u(),d(3,"div",3)(4,"p",4),c(5),u(),I(6,e_,5,4,"div",5),d(7,"span",6),c(8),u()()()),t&2&&(J("aria-disabled",i.pluginDependencyValid()?null:"true"),g(2),be("width",i.iconSize(),"px")("height",i.iconSize(),"px"),O("svgIcon",i.svgIcon()),g(2),Ba(i.pluginsStatus().length>0?"margin-bottom:0px; margin-top: 4px":""),g(),X(i.name()),g(),N(i.pluginsStatus().length>0?6:-1),g(2),X(i.description()))},dependencies:[yc,bc,et,Qe],styles:["[_nghost-%COMP%]{display:block;text-align:center;-webkit-tap-highlight-color:rgba(0,0,0,0);cursor:pointer;padding:0}.item-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch;width:100%;height:100%;margin:0;padding:15px;border:solid 1px var(--mat-sys-outline);cursor:pointer}.item-container[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-inverse-on-surface)}.item-container[_ngcontent-%COMP%]:focus-visible{background-color:var(--mat-sys-surface-bright);outline:-webkit-focus-ring-color auto 0px}.item-icon[_ngcontent-%COMP%]{width:48px}.item-label[_ngcontent-%COMP%]{width:calc(100% - 48px);text-align:left;padding-left:15px}.title[_ngcontent-%COMP%]{font-size:var(--mat-sys-label-medium-line-height)}.description[_ngcontent-%COMP%]{color:var(--mat-sys-outline)}.dependency[_ngcontent-%COMP%]{color:var(--mat-sys-outline);text-align:start;font-style:italic;font-size:var(--mat-sys-label-large-size)}.dependency-error[_ngcontent-%COMP%]{color:var(--kip-port-color);font-weight:700}.dependency-required-ok[_ngcontent-%COMP%]{color:var(--kip-starboard-color);font-weight:700}.dependency-required-error[_ngcontent-%COMP%]{color:var(--kip-port-color);font-weight:700;text-decoration:underline}.dependency-optional-ok[_ngcontent-%COMP%]{color:var(--kip-starboard-color)}.dependency-optional-error[_ngcontent-%COMP%]{color:var(--kip-port-color)}.dependency-optional-missing-met[_ngcontent-%COMP%]{color:var(--mat-sys-outline);text-decoration:line-through}.dependency-optional-present-met[_ngcontent-%COMP%]{color:var(--mat-sys-outline)}.plugin-type-label[_ngcontent-%COMP%]{font-size:.8em;margin-left:2px;opacity:.7}.dependency-ok[_ngcontent-%COMP%]{color:var(--kip-starboard-color)}.no-text-select[_ngcontent-%COMP%]{-webkit-user-select:none;user-select:none}"]})}return n})();var t_=(n,o)=>o.selector;function i_(n,o){if(n&1&&(d(0,"mat-button-toggle",1),c(1),u()),n&2){let e=o.$implicit;O("value",e),g(),ge(" ",e," ")}}function n_(n,o){if(n&1){let e=Se();d(0,"widget-list-card",3),U("click",function(){let i=ee(e).$implicit,a=k();return te(a.onSelectWidget(i))}),u()}if(n&2){let e=o.$implicit;st("dependency-missing",!e.isDependencyValid),O("svgIcon",e.icon)("iconSize",48)("name",e.name)("description",e.description)("pluginDependencyValid",e.isDependencyValid)("pluginsStatus",e.pluginsStatus)}}var gg=(()=>{class n{_dialogRef=y(tn);_widgets=y(cl);_widgetsList=[];filteredWidgetsList=_([]);_widgetCategory=_("Core");isDependencyValid=_(!0);ngOnInit(){this.loadWidgets()}loadWidgets(){return Ve(this,null,function*(){this._widgetsList=yield this._widgets.getKipWidgetsWithStatus(),this.filteredWidgetsList.set(this._widgetsList.filter(e=>e.category===this._widgetCategory()))})}onCategoryChange(e){this.filteredWidgetsList.set(this._widgetsList.filter(t=>t.category===e.value)),this._widgetCategory.set(e.value)}onSelectWidget(e){if(!e.isDependencyValid)return;let{name:t,description:i,icon:a,minWidth:r,minHeight:s,defaultWidth:l,defaultHeight:m,category:f,requiredPlugins:b,anyOfPlugins:A,selector:C,componentClassName:w}=e,M=fe(ae({name:t,description:i,icon:a,minWidth:r,minHeight:s,defaultWidth:l,defaultHeight:m,category:f,requiredPlugins:b},A?{anyOfPlugins:A}:{}),{selector:C,componentClassName:w});this._dialogRef.close(M)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widgets-list"]],decls:7,vars:1,consts:[["name","widgetCategories","aria-label","Widget categories",1,"list-filter",3,"change","value"],[3,"value"],[3,"dependency-missing","svgIcon","iconSize","name","description","pluginDependencyValid","pluginsStatus"],[3,"click","svgIcon","iconSize","name","description","pluginDependencyValid","pluginsStatus"]],template:function(t,i){t&1&&(d(0,"div")(1,"mat-button-toggle-group",0),U("change",function(r){return i.onCategoryChange(r)}),xe(2,i_,2,2,"mat-button-toggle",1,Ne),u(),d(4,"div"),xe(5,n_,1,8,"widget-list-card",2,t_),u()()),t&2&&(g(),O("value",i._widgetCategory()),g(),Ce(i._widgets.categories),g(3),Ce(i.filteredWidgetsList()))},dependencies:[vs,Yo,co,fg],styles:[".list-filter[_ngcontent-%COMP%]{margin-bottom:20px}.dependency-missing[_ngcontent-%COMP%]{pointer-events:none;opacity:.8;background-color:var(--mat-sys-neutral10)}"]})}return n})();var vg=(()=>{class n{dialogRef=y(tn);upgradeSvc=y(Gu);upgrade(){this.upgradeSvc.runUpgrade(void 0)}startFresh(){this.upgradeSvc.startFresh(),this.dialogRef.close()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["upgrade-config"]],decls:193,vars:0,consts:[[1,"warning"],[1,"nav-table"],[2,"font-size","x-large"],["href","https://discord.gg/AMDYT2DQga","target","_blank"],[1,"button-group"],["mat-flat-button","",3,"click"],["mat-flat-button","",2,"margin-left","20px",3,"click"]],template:function(t,i){t&1&&(d(0,"h2"),c(1,"All New Touch, Mouse, and Keyboard Navigation"),u(),d(2,"p",0)(3,"strong"),c(4,"Heads up:"),u(),c(5," The new version introduces a completely redesigned fullscreen interface with no navigation bar. Please review the input modes table below to get an understanding of the new ways to operate KIP before upgrading. After the upgrade, give yourself time to get comfortable with the changes."),u(),d(6,"table",1)(7,"thead")(8,"tr")(9,"th"),c(10,"Actions"),u(),d(11,"th"),c(12,"Touch"),u(),d(13,"th"),c(14,"Mouse"),u(),d(15,"th"),c(16,"Keyboard Shortcuts"),u()()(),d(17,"tbody")(18,"tr")(19,"td"),c(20,"Open Actions menu"),u(),d(21,"td"),c(22,"Swipe left"),u(),d(23,"td"),c(24,"Click, drag left, and release"),u(),d(25,"td")(26,"kbd"),c(27,"Shift"),u(),c(28," + "),d(29,"kbd"),c(30,"Ctrl"),u(),c(31," + "),d(32,"kbd",2),c(33,"\u2190"),u(),c(34," (Left Arrow)"),u()(),d(35,"tr")(36,"td"),c(37,"Open Notification menu"),u(),d(38,"td"),c(39,"Swipe right"),u(),d(40,"td"),c(41,"Click, drag right, and release"),u(),d(42,"td")(43,"kbd"),c(44,"Shift"),u(),c(45," + "),d(46,"kbd"),c(47,"Ctrl"),u(),c(48," + "),d(49,"kbd",2),c(50,"\u2192"),u(),c(51," (Right Arrow)"),u()(),d(52,"tr")(53,"td"),c(54,"Cycle through dashboards"),u(),d(55,"td"),c(56,"Swipe up/down"),u(),d(57,"td"),c(58,"Click, drag up/down, and release"),u(),d(59,"td")(60,"kbd"),c(61,"Shift"),u(),c(62," + "),d(63,"kbd"),c(64,"Ctrl"),u(),c(65," + "),d(66,"kbd",2),c(67,"\u2191"),u(),c(68,"/"),d(69,"kbd",2),c(70,"\u2193"),u(),c(71," (Up/Down Arrow)"),u()(),d(72,"tr")(73,"td"),c(74,"Toggle Fullscreen"),u(),d(75,"td"),c(76,"N/A"),u(),d(77,"td"),c(78,"N/A"),u(),d(79,"td")(80,"kbd"),c(81,"Shift"),u(),c(82," + "),d(83,"kbd"),c(84,"Ctrl"),u(),c(85," + "),d(86,"kbd"),c(87,"F"),u()()(),d(88,"tr")(89,"td"),c(90,"Toggle Night mode"),u(),d(91,"td"),c(92,"N/A"),u(),d(93,"td"),c(94,"N/A"),u(),d(95,"td")(96,"kbd"),c(97,"Shift"),u(),c(98," + "),d(99,"kbd"),c(100,"Ctrl"),u(),c(101," + "),d(102,"kbd"),c(103,"N"),u()()(),d(104,"tr")(105,"td"),c(106,"Toggle dashboard edit mode"),u(),d(107,"td"),c(108,"N/A"),u(),d(109,"td"),c(110,"N/A"),u(),d(111,"td")(112,"kbd"),c(113,"Shift"),u(),c(114," + "),d(115,"kbd"),c(116,"Ctrl"),u(),c(117," + "),d(118,"kbd"),c(119,"E"),u()()()()(),d(120,"i"),c(121,"Note that the words Touch and Tap are synonymous with mouse click."),u(),F(122,"br")(123,"br"),d(124,"h2"),c(125,"Migration Limitations"),u(),d(126,"p")(127,"span",0),c(128,"Important:"),u(),c(129," The new widget layout engine is "),d(130,"strong"),c(131,"completely different"),u(),c(132," from the previous version. When you upgrade, your configuration will be migrated, but "),d(133,"strong"),c(134,"the way dashboards and widgets are arranged will change significantly"),u(),c(135,`.
48
- `),u(),d(136,"ul")(137,"li"),c(138,"All KIP configuration settings will be migrated."),u(),d(139,"li"),c(140,"Each v2 Page layout will become a v3 Dashboard."),u(),d(141,"li"),c(142,"All widgets and their settings will appear in their new dashboards."),u(),d(143,"li")(144,"span",0)(145,"strong"),c(146,"Note:"),u(),c(147," Widget positions, order, and sizes "),d(148,"strong"),c(149,"WILL BE LOST"),u(),c(150,". After upgrading, dashboards will contain small widgets that you must reposition and resize manually."),u()()(),d(151,"p"),c(152,"To upgrade your configuration, follow these steps:"),u(),d(153,"ol")(154,"li"),c(155," As a safety measure, if you are using Signal K authentication, manually back up your configuration. Make a copy of the "),d(156,"code"),c(157,"9.0.0.json"),u(),c(158," files found on the Signal K server in the following folders: "),d(159,"ul")(160,"li")(161,"code"),c(162,"~/.signalk/applicationData/users/(username)/kip/"),u()(),d(163,"li")(164,"code"),c(165,"~/.signalk/applicationData/global/kip/"),u()()()(),d(166,"li"),c(167,"Click the "),d(168,"strong"),c(169,"Upgrade"),u(),c(170," button below."),u(),d(171,"li"),c(172,"Once the upgrade is complete, KIP will restart and display the migrated dashboards."),u(),d(173,"li"),c(174,"Reposition and resize your widgets as needed."),u(),d(175,"li"),c(176,"Once satisfied, delete the "),d(177,"code"),c(178,"9.0.0.json"),u(),c(179," configuration files located in the previously mentioned folders. They are not needed any more."),u()(),d(180,"p"),c(181," For tips and guidance, consult KIP\u2019s in-app "),d(182,"strong"),c(183,"Help"),u(),c(184," section. Most common questions are answered there. If you need support, join the "),d(185,"a",3),c(186,"Signal K #kip Discord channel"),u(),c(187,`.
49
- `),u(),d(188,"div",4)(189,"button",5),U("click",function(){return i.upgrade()}),c(190,"Upgrade"),u(),d(191,"button",6),U("click",function(){return i.startFresh()}),c(192,"Start Fresh"),u()())},dependencies:[Ht,nt,At],styles:[".button-group[_ngcontent-%COMP%]{display:flex;justify-content:center}.nav-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;margin-bottom:2em}.nav-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .nav-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border:1px solid #bbb;padding:.5em 1em;text-align:center}.nav-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background:#ddd;color:#222;font-weight:700}.nav-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(2n){background:#242424}.warning[_ngcontent-%COMP%]{color:#b71c1c}.button-group[_ngcontent-%COMP%]{margin-top:2em;display:flex;gap:20px}"]})}return n})();var a_=(n,o)=>o.id;function o_(n,o){if(n&1){let e=Se();d(0,"div",2),U("click",function(){let i=ee(e).$implicit,a=k();return te(a.selectIcon(i.id))})("keydown.enter",function(){let i=ee(e).$implicit,a=k();return te(a.selectIcon(i.id))})("keydown.space",function(i){let a=ee(e).$implicit;return k().selectIcon(a.id),te(i.preventDefault())}),d(1,"div",3),F(2,"mat-icon",4),u()()}if(n&2){let e=o.$implicit,t=k();st("selected",t.selected()===e.id),J("aria-label","Select "+e.id+" icon"),g(2),be("width",64,"px")("height",64,"px"),O("svgIcon",e.id)}}var bg=(()=>{class n{iconFile=x("assets/svg/icons.svg");currentIcon=x(void 0);selectedIcon=ut();icons=_([]);selected=_("");constructor(){this.loadIcons(),L(()=>{let e=this.currentIcon();B(()=>{e&&this.selected()!==e&&this.selected.set(e)})})}loadIcons(){return Ve(this,null,function*(){try{let t=yield(yield fetch(this.iconFile())).text(),r=new DOMParser().parseFromString(t,"image/svg+xml").querySelector("defs");if(!r)return;let s=r.querySelectorAll("svg"),l=[];s.forEach(f=>{let b=f.getAttribute("id");b&&b.startsWith("dashboard-")&&l.push({id:b})}),this.icons.set(l);let m=this.currentIcon();m&&this.selected.set(m)}catch(e){console.error("Error loading icons:",e)}})}selectIcon(e){this.selected.set(e),this.selectedIcon.emit(e)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["select-icon"]],inputs:{iconFile:[1,"iconFile"],currentIcon:[1,"currentIcon"]},outputs:{selectedIcon:"selectedIcon"},decls:3,vars:0,consts:[[1,"icon-grid"],["tabindex","0",1,"icon-item",3,"selected"],["tabindex","0",1,"icon-item",3,"click","keydown.enter","keydown.space"],[1,"icon-container"],["aria-hidden","false",3,"svgIcon"]],template:function(t,i){t&1&&(d(0,"div",0),xe(1,o_,3,8,"div",1,a_),u()),t&2&&(g(),Ce(i.icons()))},dependencies:[et,Qe],styles:[".icon-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(80px,1fr));gap:16px;padding:16px;max-height:400px;overflow-y:auto}.icon-item[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;padding:8px;border:2px solid transparent;border-radius:8px;cursor:pointer;transition:border-color .2s ease;background-color:var(--mat-sys-surface-container-low)}.icon-item[_ngcontent-%COMP%]:hover{outline:2px solid var(--mat-sys-on-primary-container);outline-offset:2px}.icon-item.selected[_ngcontent-%COMP%]{outline:2px solid var(--mat-sys-on-primary-container);outline-offset:2px;background-color:var(--mat-sys-primary-container)}.icon-item[_ngcontent-%COMP%]:focus{outline:2px solid var(--mat-sys-on-primary-container);outline-offset:2px}.icon-container[_ngcontent-%COMP%]{width:64px;height:64px;display:flex;align-items:center;justify-content:center;overflow:hidden}.icon-container[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:100%;height:100%;fill:currentColor}"]})}return n})();function r_(n,o){if(n&1&&(d(0,"button",15),c(1),u()),n&2){let e=k(),t=Nt(1);O("disabled",!t.valid),g(),X(e.data.confirmBtnText)}}var Ag=(()=>{class n{dialogRef=y(tn);data=y(ti);_settings=y(Vt);isSplitShellEnabled=_(!0);constructor(){this.data.icon||(this.data.icon="dashboard-dashboard"),this.isSplitShellEnabled.set(this._settings.getSplitShellEnabled())}save(){this.dialogRef.close(this.data)}onIconSelected(e){this.data.icon=e}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["dialog-dashboard-page-editor"]],decls:27,vars:10,consts:[["name","ngForm"],["name","name",3,"ngSubmit"],[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"field-wrapper","field-margin"],[1,"field-flex"],["matInput","","type","text","id","name","placeholder","Name","name","name","required","","cdkFocusInitial","",3,"ngModelChange","ngModel"],["placeholder","collapseSplitShell","name","collapseSplitShell",1,"field-flex",3,"ngModelChange","ngModel","disabled"],[1,"field-margin","icon-section"],[2,"font-size","1.2em"],[1,"icon-selector"],[3,"selectedIcon","iconFile","currentIcon"],["align","end"],["mat-flat-button","",3,"mat-dialog-close"],["mat-flat-button","","type","submit",3,"disabled"]],template:function(t,i){if(t&1){let a=Se();d(0,"form",1,0),U("ngSubmit",function(){return i.save()}),d(2,"div",2)(3,"h5",3),c(4),u(),d(5,"button",4)(6,"mat-icon"),c(7,"close"),u()()(),d(8,"mat-dialog-content")(9,"div",5)(10,"mat-form-field",6)(11,"mat-label"),c(12,"Display Name"),u(),d(13,"input",7),pn("ngModelChange",function(s){return ee(a),hn(i.data.name,s)||(i.data.name=s),te(s)}),u(),d(14,"mat-error"),c(15," A name is required "),u()(),d(16,"mat-checkbox",8),pn("ngModelChange",function(s){return ee(a),hn(i.data.collapseSplitShell,s)||(i.data.collapseSplitShell=s),te(s)}),c(17," Auto-collapse Freeboard-SK panel when displaying this dashboard. "),u()(),d(18,"div",9)(19,"span",10),c(20,"Icon Gallery"),u(),d(21,"div",11)(22,"select-icon",12),U("selectedIcon",function(s){return i.onIconSelected(s)}),u()()()(),d(23,"mat-dialog-actions",13)(24,"button",14),c(25),u(),I(26,r_,2,2,"button",15),u()()}t&2&&(g(4),X(i.data.title),g(),O("mat-dialog-close",!1),g(8),mn("ngModel",i.data.name),g(3),mn("ngModel",i.data.collapseSplitShell),O("disabled",!i.isSplitShellEnabled()),g(6),O("iconFile","assets/svg/icons.svg")("currentIcon",i.data.icon),g(2),O("mat-dialog-close",!1),g(),X(i.data.cancelBtnText),g(),N(i.data.confirmBtnText?26:-1))},dependencies:[Ht,Mi,ki,Nn,Ti,et,Qe,ii,St,Ct,Ln,ni,wt,nt,At,Tt,It,$a,yt,dt,Dt,Pt,Rn,Qr,bg,oi,qt],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}.field-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;align-content:center}.field-margin[_ngcontent-%COMP%]{margin-left:15px;margin-bottom:15px}.field-flex[_ngcontent-%COMP%]{flex:auto}.icon-selector[_ngcontent-%COMP%]{border:1px solid var(--mat-sys-outline);border-radius:4px}.icon-section[_ngcontent-%COMP%] .mat-label[_ngcontent-%COMP%]{display:block;margin-bottom:8px;color:var(--mat-sys-on-surface);font-size:14px;font-weight:400}"]})}return n})();var s_=["historyCanvas"];function l_(n,o){n&1&&(d(0,"p",12),c(1,"Loading historical data\u2026"),u())}function d_(n,o){if(n&1&&(d(0,"p",13),c(1),u()),n&2){let e=k();g(),ge("503: ",e.error())}}function c_(n,o){n&1&&(d(0,"p",12),c(1,"No historical data is available for this widget. If you are not using the built-in KIP History API provider, validate your plugin configuration supports the widget's path and try again."),u())}function u_(n,o){n&1&&(d(0,"div",14),F(1,"canvas",null,0),u())}vt.register(Un,qn,jn,$n,ln,Tu,ku);var yg=(()=>{class n{historyApiClient=y(ss);historyMapper=y(ls);app=y(Di);destroyRef=y(Ze);units=y(at);data=y(ti);chartCanvas=pe("historyCanvas");theme=_i(this.app.cssThemeColorRoles$,{requireSync:!0});loading=_(!0);error=_(null);datasetCount=_(0);selectedPeriod=Fr("PT1H");hasNoData=K(()=>!this.loading()&&!this.error()&&this.datasetCount()===0);chart=null;viewReady=!1;pendingDatasets=[];constructor(){L(()=>{let e=this.chartCanvas(),t=this.loading(),i=this.datasetCount();!e||t||i<=0||B(()=>{this.tryRenderChart()})})}loadHistoryDatasets(){return Ve(this,null,function*(){this.loading.set(!0),this.error.set(null);try{let e=yield Promise.all(this.data.seriesDefinitions.map((t,i)=>this.buildDatasetForSeries(t,i)));this.pendingDatasets=e.filter(t=>!!t),this.datasetCount.set(this.pendingDatasets.length),this.tryRenderChart()}catch(e){console.error("[WidgetHistoryChartDialogComponent] Failed to load widget history datasets:",e),this.error.set("Unable to load historical data for this widget."),this.pendingDatasets=[],this.datasetCount.set(0)}finally{this.loading.set(!1),queueMicrotask(()=>{this.tryRenderChart()})}})}ngOnInit(){this.loadHistoryDatasets(),this.destroyRef.onDestroy(()=>{this.chart?.destroy(),this.chart=null})}ngAfterViewInit(){this.onCanvasReady()}ngOnDestroy(){this.chart?.destroy(),this.chart=null}onCanvasReady(){this.viewReady=!0,this.tryRenderChart()}buildDatasetForSeries(e,t){return Ve(this,null,function*(){let i=e.path;if(!i)return null;let a=this.resolveDuration(e),r=this.resolveResolutionSeconds(a),s=this.buildHistoryRequestCandidates(i,e.context),l=this.describeBmsSeries(i),m=[],f=this.normalizeHistoryPath(i),b=this.data.widget?.config,A=null;if(b){if(b.paths&&typeof b.paths=="object")for(let M of Object.keys(b.paths)){let G=b.paths[M];if(G?.path===i&&G.convertUnitTo){A=G.convertUnitTo;break}}!A&&b.convertUnitTo&&(A=b.convertUnitTo)}for(let M of s){let G=yield this.historyApiClient.getValues({paths:M.paths,context:M.context,duration:a,resolution:r});if(!G?.data?.length)continue;if(m=this.historyMapper.mapValuesToChartDatapoints(G,{unit:"number",domain:"scalar"}).map(W=>{let V=W.data.value;return l?.metric==="soc"&&typeof V=="number"&&Number.isFinite(V)?V*=100:A&&typeof V=="number"&&Number.isFinite(V)&&(V=this.units.convertToUnit(A,V)),{x:W.timestamp,y:V}}),m.length){f=M.labelPath;break}}if(!m.length)return null;let C=this.resolveSeriesColor(t,l),w=e.source?` (${e.source})`:"";return{label:`${f}${w}`,data:m,borderColor:C,backgroundColor:C,pointRadius:0,borderWidth:2,tension:.25,yAxisID:l?this.getBmsAxisId(l.metric):"y",borderDash:l?.metric==="soc"?[6,4]:void 0,fill:!1}})}describeBmsSeries(e){let t=this.normalizeHistoryPath(e??""),i=/^electrical\.batteries\.([^.]+)\.(?:capacity\.)?stateOfCharge$/i.exec(t);if(i)return{batteryId:i[1],metric:"soc"};let a=/^electrical\.batteries\.([^.]+)\.current$/i.exec(t);return a?{batteryId:a[1],metric:"current"}:null}resolveSeriesColor(e,t){let i=this.getSeriesPalette();if(!t)return i[e%i.length];let a=this.getBmsBatteryOrderIndex(t.batteryId);return i[a%i.length]}getSeriesPalette(){let e=this.data.widget?.config?.color||"blue",t=this.resolveThemeColor(e),i=[this.theme().green,this.theme().orange,this.theme().pink,this.theme().purple,this.theme().yellow,this.theme().grey,this.theme().blue,this.theme().contrast],a=i.findIndex(r=>r?.toLowerCase()===t.toLowerCase());return a!==-1?i=[i[a],...i.slice(0,a),...i.slice(a+1)]:i=[t,...i],i}resolveThemeColor(e){let t=this.theme()[e];return typeof t=="string"&&t.length>0?t:e}getBmsBatteryOrderIndex(e){let t=[];this.data.seriesDefinitions.forEach(a=>{let r=this.describeBmsSeries(a.path);!r||t.includes(r.batteryId)||t.push(r.batteryId)});let i=t.indexOf(e);return i>=0?i:0}getBmsAxisId(e){return e==="soc"?"ySoc":"yCurrent"}buildHistoryRequestCandidates(e,t){let i=this.normalizeHistoryPath(e),a=this.resolveHistoryContext(e,t),r=[...new Set([i].filter(l=>l.length>0))],s=[];return r.forEach(l=>{s.push({paths:`${l}:avg`,context:a,labelPath:this.normalizeHistoryPath(l)})}),s}normalizeHistoryPath(e){let t=e.trim();return t.length?t.replace(/^(vessels\.)?self\./,""):""}resolveHistoryContext(e,t){let i=this.normalizeContext(t);if(i)return i;if(/^(vessels\.)?self\./.test(e))return"vessels.self"}tryRenderChart(){if(!this.viewReady)return;if(!this.pendingDatasets.length){this.chart?.destroy(),this.chart=null;return}let e=this.chartCanvas();if(!e)return;this.chart?.destroy();let t=this.getPrimaryAxisUnitLabel(),i={type:"line",data:{datasets:this.pendingDatasets},options:{responsive:!0,maintainAspectRatio:!1,parsing:!1,interaction:{mode:"nearest",intersect:!1,axis:"x"},scales:ae({x:{type:"time",time:{tooltipFormat:"PPpp",displayFormats:{second:"HH:mm:ss",minute:"HH:mm",hour:"HH:mm",day:"MMM d",week:"MMM d",month:"MMM yyyy"},unit:"minute",minUnit:"second"},ticks:{color:this.theme().contrastDim},grid:{color:this.theme().contrastDimmer}}},this.buildYScales(t)),plugins:{legend:{labels:{color:this.theme().contrastDim,generateLabels:a=>this.buildLegendLabels(a)}},tooltip:{callbacks:{labelColor:a=>{let r=this.getLegendColorsForDataset(a.chart,a.datasetIndex),s=a.dataset,l=Array.isArray(s.borderDash)&&s.borderDash.length>=2?[s.borderDash[0],s.borderDash[1]]:void 0;return{borderColor:this.darkenColor(r.stroke,.25),backgroundColor:r.fill,borderDash:l}}}}}}};this.chart=new vt(e.nativeElement.getContext("2d"),i)}getPrimaryAxisUnitLabel(){let e=this.data.widget?.config,t=null;if(e){if(e.paths&&typeof e.paths=="object"){let i=Object.keys(e.paths)[0];i&&e.paths[i]?.convertUnitTo&&(t=e.paths[i].convertUnitTo)}!t&&e.convertUnitTo&&(t=e.convertUnitTo)}return this.getUnitsLabel(t)}buildYScales(e){return this.isBmsChart()?{ySoc:{type:"linear",position:"left",min:0,max:100,ticks:{color:this.theme().contrastDim,callback:t=>`${t}%`},grid:{color:this.theme().contrastDimmer},title:{display:!0,text:"SoC (%)",color:this.theme().contrastDim}},yCurrent:{type:"linear",position:"right",ticks:{color:this.theme().contrastDim,callback:t=>`${t} A`},grid:{drawOnChartArea:!1,color:this.theme().contrastDimmer},title:{display:!0,text:"Current (A)",color:this.theme().contrastDim}}}:{y:{ticks:{color:this.theme().contrastDim},grid:{color:this.theme().contrastDimmer},title:{display:!!e,text:e?`${e}`:"",color:this.theme().contrastDim}}}}buildLegendLabels(e){return vt.defaults.plugins.legend.labels.generateLabels(e).map(t=>fe(ae({},t),{fillStyle:this.darkenColor(t.fillStyle,.25),strokeStyle:t.strokeStyle}))}darkenColor(e,t){if(typeof e!="string")return e;let i=e.trim(),a=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(i);if(a){let s=a[1].length===3?a[1].split("").map(A=>`${A}${A}`).join(""):a[1],l=Number.parseInt(s.slice(0,2),16),m=Number.parseInt(s.slice(2,4),16),f=Number.parseInt(s.slice(4,6),16),b=A=>Math.max(0,Math.round(A*(1-t)));return`rgb(${b(l)}, ${b(m)}, ${b(f)})`}let r=/^rgba?\(([^)]+)\)$/i.exec(i);if(r){let[s="0",l="0",m="0"]=r[1].split(",").map(w=>w.trim()),f=Number.parseFloat(s),b=Number.parseFloat(l),A=Number.parseFloat(m),C=w=>Math.max(0,Math.round(w*(1-t)));return`rgb(${C(f)}, ${C(b)}, ${C(A)})`}return e}getLegendColorsForDataset(e,t){let a=this.buildLegendLabels(e).find(r=>r.datasetIndex===t);return a?{fill:a.fillStyle,stroke:a.strokeStyle}:{fill:this.darkenColor(this.theme().contrast,.25),stroke:this.theme().contrast}}isBmsChart(){return this.data.widget?.type==="widget-bms"&&this.pendingDatasets.some(e=>e.yAxisID==="ySoc"||e.yAxisID==="yCurrent")}setPeriod(e){this.selectedPeriod.set(e),this.loadHistoryDatasets()}resolveDuration(e){return e.timeScale&&e.period&&Number.isFinite(e.period)?this.durationFromScaleAndPeriod(e.timeScale,e.period):this.selectedPeriod()}durationFromScaleAndPeriod(e,t){let i=Math.max(1,Math.round(t)),a=e.trim().toLowerCase(),r=a.match(/^last\s+(\d+)\s+([a-z]+)/i);if(r){let s=Number(r[1]),l=r[2];if(Number.isFinite(s)&&s>0)return this.durationFromToken(l,s)}return this.durationFromToken(a,i)}durationFromToken(e,t){let i=e.toLowerCase();return i.startsWith("second")?`PT${t}S`:i.startsWith("minute")?`PT${t}M`:i.startsWith("hour")?`PT${t}H`:i.startsWith("day")?`P${t}D`:i.startsWith("week")?`P${t*7}D`:i.startsWith("month")?`P${t}M`:"PT24H"}resolveResolutionSeconds(e){let t=this.parseDurationToSeconds(e);return!Number.isFinite(t)||t<=0?1:Math.max(1,Math.round(t/120))}parseDurationToSeconds(e){let i=/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/i.exec(e.trim());if(!i)return NaN;let a=Number(i[1]??0),r=Number(i[2]??0),s=Number(i[3]??0),l=Number(i[4]??0);return a*86400+r*3600+s*60+l}normalizeContext(e){let t=typeof e=="string"?e.trim():"";return t.length?t:void 0}getUnitsLabel(e){if(!e)return"";switch(e){case"percent":case"percentraw":return"%";case"latitudeMin":return"latitude in minutes";case"latitudeSec":return"latitude in secondes";case"longitudeMin":return"longitude in minutes";case"longitudeSec":return"longitude in secondes";default:return e}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-history-chart-dialog"]],viewQuery:function(t,i){t&1&&Me(i.chartCanvas,s_,5),t&2&&ke()},inputs:{selectedPeriod:[1,"selectedPeriod"]},outputs:{selectedPeriod:"selectedPeriodChange"},decls:22,vars:4,consts:[["historyCanvas",""],[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"history-dialog-content"],[1,"time-select"],["hideSingleSelectionIndicator","true","aria-label","Chart Time Span Selection",3,"ngModelChange","ngModel"],["value","PT15M",3,"click"],["value","PT1H",3,"click"],["value","PT8H",3,"click"],["value","PT24H",3,"click"],[1,"chart-area"],[1,"history-message"],[1,"history-message","error"],[1,"chart-wrapper"]],template:function(t,i){t&1&&(d(0,"div",1)(1,"h5",2),c(2),u(),d(3,"button",3)(4,"mat-icon"),c(5,"close"),u()()(),d(6,"mat-dialog-content",4)(7,"div",5)(8,"mat-button-toggle-group",6),pn("ngModelChange",function(r){return hn(i.selectedPeriod,r)||(i.selectedPeriod=r),r}),d(9,"mat-button-toggle",7),U("click",function(){return i.setPeriod("PT15M")}),c(10,"15 Minutes"),u(),d(11,"mat-button-toggle",8),U("click",function(){return i.setPeriod("PT1H")}),c(12,"1 Hour"),u(),d(13,"mat-button-toggle",9),U("click",function(){return i.setPeriod("PT8H")}),c(14,"8 Hours"),u(),d(15,"mat-button-toggle",10),U("click",function(){return i.setPeriod("PT24H")}),c(16,"24 Hours"),u()()(),d(17,"div",11),I(18,l_,2,0,"p",12)(19,d_,2,1,"p",13)(20,c_,2,0,"p",12)(21,u_,3,0,"div",14),u()()),t&2&&(g(2),X(i.data.title),g(),O("mat-dialog-close",!1),g(5),mn("ngModel",i.selectedPeriod),g(10),N(i.loading()?18:i.error()?19:i.hasNoData()?20:21))},dependencies:[Ht,Mi,ki,Ti,vs,Yo,co,nt,Tt,et,Qe,It,dt,Rn],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%}.dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}mat-dialog-content.history-dialog-content[_ngcontent-%COMP%]{padding:0 24px 20px;display:flex;flex-direction:column;width:100%;height:100%;min-width:70vw;min-height:55vh;justify-content:flex-start;align-items:stretch}.time-select[_ngcontent-%COMP%]{flex-grow:0;text-align:center;width:100%}.chart-area[_ngcontent-%COMP%], .chart-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1 1 0;min-height:0;width:100%}.chart-wrapper[_ngcontent-%COMP%] canvas[_ngcontent-%COMP%]{flex:1 1 0;min-height:0}.history-message[_ngcontent-%COMP%]{margin:0;padding:1rem 0}.error[_ngcontent-%COMP%]{color:var(--mat-sys-error)}"],changeDetection:0})}return n})();var Bp=(()=>{class n{dialog=y(nu);openFrameDialog(e,t){switch(e.component){case"select-widget":e.componentType=gg;break;case"upgrade-config":e.componentType=vg;break;case"ais-target":e.componentType=Ks;break}return this.dialog.open(Tl,{data:e,height:t?"calc(100% - 30px)":"",width:t?"calc(100% - 30px)":"",maxWidth:t?"100%":"",maxHeight:t?"100%":""}).afterClosed()}openAisDetailDialog(e){return this.dialog.open(Tl,{panelClass:"ais-dialog-panel",data:e,height:"",width:"",maxWidth:"",maxHeight:""}).afterClosed()}openConfirmationDialog(e){return this.dialog.open(Bu,{data:e,minWidth:"35vw",minHeight:"25vh"}).afterClosed()}openNameDialog(e){return this.dialog.open(zu,{data:e,minWidth:"20vw",minHeight:"20vh",disableClose:!1})}openDashboardPageEditorDialog(e){return this.dialog.open(Ag,{data:e,minWidth:"60vw",maxWidth:"90vw",maxHeight:"95vh",disableClose:!1})}openWidgetOptions(e){return this.dialog.open(bm,{data:e.config,minWidth:"50vw",maxWidth:"90vw",closeOnNavigation:!0})}openWidgetHistoryDialog(e){return this.dialog.open(yg,{data:e,minWidth:"70vw",maxWidth:"95vw",maxHeight:"95vh",disableClose:!1})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function m_(n,o){}var xg="_mat-bottom-sheet-enter",Cg="_mat-bottom-sheet-exit",h_=(()=>{class n extends eu{_breakpointSubscription;_animationsDisabled=Ji();_animationState="void";_animationStateChanged=new ei;_destroyed=!1;constructor(){super();let e=y(Ua);this._breakpointSubscription=e.observe([Wi.Medium,Wi.Large,Wi.XLarge]).subscribe(()=>{let t=this._elementRef.nativeElement.classList;t.toggle("mat-bottom-sheet-container-medium",e.isMatched(Wi.Medium)),t.toggle("mat-bottom-sheet-container-large",e.isMatched(Wi.Large)),t.toggle("mat-bottom-sheet-container-xlarge",e.isMatched(Wi.XLarge))})}enter(){this._destroyed||(this._animationState="visible",this._changeDetectorRef.markForCheck(),this._changeDetectorRef.detectChanges(),this._animationsDisabled&&this._simulateAnimation(xg))}exit(){this._destroyed||(this._elementRef.nativeElement.setAttribute("mat-exit",""),this._animationState="hidden",this._changeDetectorRef.markForCheck(),this._animationsDisabled&&this._simulateAnimation(Cg))}ngOnDestroy(){super.ngOnDestroy(),this._breakpointSubscription.unsubscribe(),this._destroyed=!0}_simulateAnimation(e){this._ngZone.run(()=>{this._handleAnimationEvent(!0,e),setTimeout(()=>this._handleAnimationEvent(!1,e))})}_trapFocus(){super._trapFocus({preventScroll:!0})}_handleAnimationEvent(e,t){let i=t===xg;(i||t===Cg)&&this._animationStateChanged.emit({toState:i?"visible":"hidden",phase:e?"start":"done"})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["mat-bottom-sheet-container"]],hostAttrs:["tabindex","-1",1,"mat-bottom-sheet-container"],hostVars:9,hostBindings:function(t,i){t&1&&U("animationstart",function(r){return i._handleAnimationEvent(!0,r.animationName)})("animationend",function(r){return i._handleAnimationEvent(!1,r.animationName)})("animationcancel",function(r){return i._handleAnimationEvent(!1,r.animationName)}),t&2&&(J("role",i._config.role)("aria-modal",i._config.ariaModal)("aria-label",i._config.ariaLabel),st("mat-bottom-sheet-container-animations-enabled",!i._animationsDisabled)("mat-bottom-sheet-container-enter",i._animationState==="visible")("mat-bottom-sheet-container-exit",i._animationState==="hidden"))},features:[Ro],decls:1,vars:0,consts:[["cdkPortalOutlet",""]],template:function(t,i){t&1&&bi(0,m_,0,0,"ng-template",0)},dependencies:[Vc],styles:[`@keyframes _mat-bottom-sheet-enter{from{transform:translateY(100%)}to{transform:none}}@keyframes _mat-bottom-sheet-exit{from{transform:none}to{transform:translateY(100%)}}.mat-bottom-sheet-container{box-shadow:0px 8px 10px -5px rgba(0, 0, 0, 0.2), 0px 16px 24px 2px rgba(0, 0, 0, 0.14), 0px 6px 30px 5px rgba(0, 0, 0, 0.12);padding:8px 16px;min-width:100vw;box-sizing:border-box;display:block;outline:0;max-height:80vh;overflow:auto;position:relative;background:var(--mat-bottom-sheet-container-background-color, var(--mat-sys-surface-container-low));color:var(--mat-bottom-sheet-container-text-color, var(--mat-sys-on-surface));font-family:var(--mat-bottom-sheet-container-text-font, var(--mat-sys-body-large-font));font-size:var(--mat-bottom-sheet-container-text-size, var(--mat-sys-body-large-size));line-height:var(--mat-bottom-sheet-container-text-line-height, var(--mat-sys-body-large-line-height));font-weight:var(--mat-bottom-sheet-container-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-bottom-sheet-container-text-tracking, var(--mat-sys-body-large-tracking))}@media(forced-colors: active){.mat-bottom-sheet-container{outline:1px solid}}.mat-bottom-sheet-container-animations-enabled{transform:translateY(100%)}.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-enter{animation:_mat-bottom-sheet-enter 195ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-exit{animation:_mat-bottom-sheet-exit 375ms cubic-bezier(0.4, 0, 1, 1) backwards}.mat-bottom-sheet-container-xlarge,.mat-bottom-sheet-container-large,.mat-bottom-sheet-container-medium{border-top-left-radius:var(--mat-bottom-sheet-container-shape, 28px);border-top-right-radius:var(--mat-bottom-sheet-container-shape, 28px)}.mat-bottom-sheet-container-medium{min-width:384px;max-width:calc(100vw - 128px)}.mat-bottom-sheet-container-large{min-width:512px;max-width:calc(100vw - 256px)}.mat-bottom-sheet-container-xlarge{min-width:576px;max-width:calc(100vw - 384px)}
50
- `],encapsulation:2})}return n})(),p_=new un("MatBottomSheetData"),Od=class{viewContainerRef;injector;panelClass;direction;data=null;hasBackdrop=!0;backdropClass;disableClose=!1;ariaLabel=null;ariaModal=!1;closeOnNavigation=!0;autoFocus="first-tabbable";restoreFocus=!0;scrollStrategy;height="";minHeight;maxHeight},ul=class{_ref;get instance(){return this._ref.componentInstance}get componentRef(){return this._ref.componentRef}containerInstance;disableClose;_afterOpened=new zt;_result;_closeFallbackTimeout;constructor(o,e,t){this._ref=o,this.containerInstance=t,this.disableClose=e.disableClose,t._animationStateChanged.pipe(vi(i=>i.phase==="done"&&i.toState==="visible"),Jt(1)).subscribe(()=>{this._afterOpened.next(),this._afterOpened.complete()}),t._animationStateChanged.pipe(vi(i=>i.phase==="done"&&i.toState==="hidden"),Jt(1)).subscribe(()=>{clearTimeout(this._closeFallbackTimeout),this._ref.close(this._result)}),o.overlayRef.detachments().subscribe(()=>{this._ref.close(this._result)}),gi(this.backdropClick(),this.keydownEvents().pipe(vi(i=>i.keyCode===27))).subscribe(i=>{!this.disableClose&&(i.type!=="keydown"||!Pn(i))&&(i.preventDefault(),this.dismiss())})}dismiss(o){this.containerInstance&&(this.containerInstance._animationStateChanged.pipe(vi(e=>e.phase==="start"),Jt(1)).subscribe(()=>{this._closeFallbackTimeout=setTimeout(()=>this._ref.close(this._result),500),this._ref.overlayRef.detachBackdrop()}),this._result=o,this.containerInstance.exit(),this.containerInstance=null)}afterDismissed(){return this._ref.closed}afterOpened(){return this._afterOpened}backdropClick(){return this._ref.backdropClick}keydownEvents(){return this._ref.keydownEvents}},f_=new un("mat-bottom-sheet-default-options"),g_=(()=>{class n{_injector=y(No);_parentBottomSheet=y(n,{optional:!0,skipSelf:!0});_animationsDisabled=Ji();_defaultOptions=y(f_,{optional:!0});_bottomSheetRefAtThisLevel=null;_dialog=y(tu);get _openedBottomSheetRef(){let e=this._parentBottomSheet;return e?e._openedBottomSheetRef:this._bottomSheetRefAtThisLevel}set _openedBottomSheetRef(e){this._parentBottomSheet?this._parentBottomSheet._openedBottomSheetRef=e:this._bottomSheetRefAtThisLevel=e}constructor(){}open(e,t){let i=ae(ae({},this._defaultOptions||new Od),t),a;return this._dialog.open(e,fe(ae({},i),{disableClose:!0,closeOnOverlayDetachments:!1,maxWidth:"100%",container:h_,scrollStrategy:i.scrollStrategy||Gc(this._injector),positionStrategy:Hc(this._injector).centerHorizontally().bottom("0"),disableAnimations:this._animationsDisabled,templateContext:()=>({bottomSheetRef:a}),providers:(r,s,l)=>(a=new ul(r,i,l),[{provide:ul,useValue:a},{provide:p_,useValue:i.data}])})),a.afterDismissed().subscribe(()=>{this._openedBottomSheetRef===a&&(this._openedBottomSheetRef=null)}),this._openedBottomSheetRef?(this._openedBottomSheetRef.afterDismissed().subscribe(()=>a.containerInstance?.enter()),this._openedBottomSheetRef.dismiss()):a.containerInstance.enter(),this._openedBottomSheetRef=a,a}dismiss(e){this._openedBottomSheetRef&&this._openedBottomSheetRef.dismiss(e)}ngOnDestroy(){this._bottomSheetRefAtThisLevel&&this._bottomSheetRefAtThisLevel.dismiss()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),DB=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Qi({type:n});static \u0275inj=Yi({providers:[g_],imports:[iu,Lc,In]})}return n})();var Sg=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],Mn=(()=>{if(typeof document>"u")return!1;let n=Sg[0],o={};for(let e of Sg)if(e?.[1]in document){for(let[i,a]of e.entries())o[n[i]]=a;return o}return!1})(),wg={change:Mn.fullscreenchange,error:Mn.fullscreenerror},pi={request(n=document.documentElement,o){return new Promise((e,t)=>{let i=()=>{pi.off("change",i),e()};pi.on("change",i);let a=n[Mn.requestFullscreen](o);a instanceof Promise&&a.then(i).catch(t)})},exit(){return new Promise((n,o)=>{if(!pi.isFullscreen){n();return}let e=()=>{pi.off("change",e),n()};pi.on("change",e);let t=document[Mn.exitFullscreen]();t instanceof Promise&&t.then(e).catch(o)})},toggle(n,o){return pi.isFullscreen?pi.exit():pi.request(n,o)},onchange(n){pi.on("change",n)},onerror(n){pi.on("error",n)},on(n,o){let e=wg[n];e&&document.addEventListener(e,o,!1)},off(n,o){let e=wg[n];e&&document.removeEventListener(e,o,!1)},raw:Mn};Object.defineProperties(pi,{isFullscreen:{get:()=>!!document[Mn.fullscreenElement]},element:{enumerable:!0,get:()=>document[Mn.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>!!document[Mn.fullscreenEnabled]}});Mn||(pi={isEnabled:!1});var qi=pi;var v_="data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK",b_="data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw",Vd=class{constructor(){this.enabled=!1}enable(){throw new Error("NoSleep using SSR/no-op mode; do not call enable.")}disable(){throw new Error("NoSleep using SSR/no-op mode; do not call disable.")}},Ld=class{constructor(){this.enabled=!1;let o=()=>this.wakeLock&&document.visibilityState==="visible"&&this.enable();document.addEventListener("visibilitychange",o),document.addEventListener("fullscreenchange",o)}enable(){return Ve(this,null,function*(){try{this.wakeLock=yield navigator.wakeLock.request("screen"),this.enabled=!0,console.debug("Wake Lock active."),this.wakeLock.addEventListener("release",()=>{console.debug("Wake Lock released.")})}catch(o){this.enabled=!1,o instanceof Error&&console.error(`${o.name}, ${o.message}`)}})}disable(){this.wakeLock?.release(),this.wakeLock=void 0,this.enabled=!1}},Wd=class{constructor(){this.enabled=!1,this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",v_),this._addSourceToVideo(this.noSleepVideo,"mp4",b_),Object.assign(this.noSleepVideo.style,{position:"absolute",left:"-100%",top:"-100%"}),document.querySelector("body")?.append(this.noSleepVideo),this.noSleepVideo.addEventListener("loadedmetadata",()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())})})}_addSourceToVideo(o,e,t){let i=document.createElement("source");i.src=t,i.type=`video/${e}`,o.appendChild(i)}enable(){return Ve(this,null,function*(){let o=this.noSleepVideo.play();try{let e=yield o;return this.enabled=!0,e}catch(e){this.enabled=!1,e instanceof Error&&console.error(`${e.name}, ${e.message}`)}})}disable(){this.noSleepVideo.pause(),this.enabled=!1}};function A_(){if(!/iPod|iPhone|iPad/.test(navigator.userAgent))return null;let n=navigator.userAgent.match(/OS (\d+)_(\d+)/);return n&&[Number(n[1]),Number(n[2])]}function y_(n,o){return n[0]>o[0]||n[0]===o[0]&&n[1]>=o[1]}function x_(){if(!("wakeLock"in navigator))return!1;let n=A_();return n?!navigator.standalone||y_(n,[18,4]):!0}var _g=typeof navigator>"u"?Vd:x_()?Ld:Wd;var GB=(()=>{class n{isDragging=_(!1);fullscreenStatus=_(!1);fullscreenSupported=_(!0);noSleepStatus=_(!1);noSleepSupported=_(!0);noSleep=null;initialTouchX=null;initialTouchY=null;hotkeyListeners=new Map;boundPreventGestures=null;fullscreenChangeHandler=()=>{if(this.fullscreenStatus.set(qi.isFullscreen),!qi.isFullscreen&&this.noSleep&&this.noSleepStatus()){try{this.noSleep.disable()}catch(e){}this.noSleepStatus.set(!1)}};constructor(){window.__KIP_TEST__?(this.fullscreenSupported.set(!1),this.noSleepSupported.set(!1)):(qi.isEnabled?qi.on("change",this.fullscreenChangeHandler):(this.fullscreenSupported.set(!1),console.log("[UI Event Service] Fullscreen mode is not supported by device/browser.")),this.checkNoSleepSupport(),this.checkPwaMode()&&this.noSleepSupported()&&!this.noSleepStatus()&&this.toggleNoSleep())}checkNoSleepSupport(){try{if(this.noSleep||(this.noSleep=new _g),!this.noSleep||typeof this.noSleep.enable!="function"||typeof this.noSleep.disable!="function")throw new Error("[UI Event Service] NoSleep methods not available")}catch(e){this.noSleepSupported.set(!1),console.warn(`[UI Event Service] NoSleep is not supported by this device/browser. Error: ${e}`),this.noSleep=null}}checkPwaMode(){let e=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone!==void 0;return console.log("[UI Event Service] PWA mode:",e),e}toggleNoSleep(){if(this.noSleepSupported()){if(this.noSleepStatus())try{this.noSleep?.disable()}catch(e){}else{this.noSleep||this.checkNoSleepSupport();try{this.noSleep?.enable()}catch(e){console.warn("[UI Event Service] Failed to enable NoSleep:",e)}}this.noSleepStatus.set(!this.noSleepStatus()),console.log("[UI Event Service] NoSleep active:",this.noSleepStatus())}}toggleFullScreen(){if(qi.isEnabled){if(this.fullscreenStatus()){if(qi.isFullscreen&&qi.exit(),this.noSleepStatus()){try{this.noSleep?.disable()}catch(e){}this.noSleepStatus.set(!1)}}else if(qi.request(),!this.noSleepStatus()){this.noSleep||this.checkNoSleepSupport();try{this.noSleep?.enable(),this.noSleepStatus.set(!0)}catch(e){}}this.fullscreenStatus.set(!this.fullscreenStatus())}else this.fullscreenSupported.set(!1),console.log("[UI Event Service] Fullscreen mode is not supported by this browser.")}addGestureListeners(e,t){this.boundPreventGestures||(this.boundPreventGestures=this.preventBrowserHistorySwipeGestures.bind(this)),document.addEventListener("openLeftSidenav",e),document.addEventListener("openRightSidenav",t),document.addEventListener("touchstart",this.boundPreventGestures,{passive:!1}),document.addEventListener("touchmove",this.boundPreventGestures,{passive:!1}),document.addEventListener("touchend",this.boundPreventGestures),document.addEventListener("touchcancel",this.boundPreventGestures)}removeGestureListeners(e,t){document.removeEventListener("openLeftSidenav",e),document.removeEventListener("openRightSidenav",t),this.boundPreventGestures&&(document.removeEventListener("touchstart",this.boundPreventGestures),document.removeEventListener("touchmove",this.boundPreventGestures),document.removeEventListener("touchend",this.boundPreventGestures),document.removeEventListener("touchcancel",this.boundPreventGestures))}preventBrowserHistorySwipeGestures(e){if(e instanceof TouchEvent&&e.touches.length===1){let t=e.touches[0],i=30;if(e.type==="touchstart")this.initialTouchX=t.clientX,this.initialTouchY=t.clientY;else if(e.type==="touchmove"&&this.initialTouchX!==null&&this.initialTouchY!==null){let a=Math.abs(t.clientX-this.initialTouchX),r=Math.abs(t.clientY-this.initialTouchY);a>10&&a>r&&(this.initialTouchX<i||this.initialTouchX>window.innerWidth-i)&&e.preventDefault(),r>10&&this.initialTouchY<50&&e.preventDefault()}else(e.type==="touchend"||e.type==="touchcancel")&&(this.initialTouchX=null,this.initialTouchY=null)}}addHotkeyListener(e,t){let i=a=>{if(a instanceof KeyboardEvent){let r=a.key.toLowerCase();if(t&&(t.keys&&!t.keys.includes(r)||t.ctrlKey!==void 0&&a.ctrlKey!==t.ctrlKey||t.shiftKey!==void 0&&a.shiftKey!==t.shiftKey))return;e(r,a)}else console.warn("[uiEvent Service] Non-keyboard event detected in addHotkeyListener:",a)};this.hotkeyListeners.set(e,i),document.addEventListener("keydown",i)}removeHotkeyListener(e){let t=this.hotkeyListeners.get(e);t&&(document.removeEventListener("keydown",t),this.hotkeyListeners.delete(e))}ngOnDestroy(){if(qi.isEnabled)try{qi.off("change",this.fullscreenChangeHandler)}catch(e){}if(this.noSleep&&this.noSleepStatus())try{this.noSleep.disable()}catch(e){}this.noSleep=null,this.boundPreventGestures&&(document.removeEventListener("touchstart",this.boundPreventGestures),document.removeEventListener("touchmove",this.boundPreventGestures),document.removeEventListener("touchend",this.boundPreventGestures),document.removeEventListener("touchcancel",this.boundPreventGestures),this.boundPreventGestures=null);for(let[,e]of this.hotkeyListeners.entries())document.removeEventListener("keydown",e);this.hotkeyListeners.clear()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=rt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();export{ds as a,ft as b,dn as c,we as d,Le as e,oo as f,Zn as g,ci as h,Vu as i,Wu as j,Fu as k,w9 as l,cg as m,cl as n,Gu as o,Bp as p,p_ as q,ul as r,g_ as s,DB as t,GB as u};