@mxtommy/kip 4.8.0-beta.1 → 4.8.1

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 (113) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE +3 -0
  3. package/README.md +56 -49
  4. package/package.json +24 -21
  5. package/plugin/history-series.service.js +108 -30
  6. package/plugin/index.js +157 -115
  7. package/plugin/kip-series-contract.js +12 -3
  8. package/plugin/openApi.json +64 -13
  9. package/plugin/sqlite-history-storage.service.js +4 -2
  10. package/plugin/src/history-series.service.js +634 -0
  11. package/plugin/src/index.js +1322 -0
  12. package/plugin/src/kip-series-contract.js +31 -0
  13. package/plugin/src/openApi.json +855 -0
  14. package/plugin/src/sqlite-history-storage.service.js +1122 -0
  15. package/public/3rdpartylicenses.txt +569 -727
  16. package/public/assets/help-docs/chartplotter.md +1 -1
  17. package/public/assets/help-docs/contributing-widgets.md +40 -0
  18. package/public/assets/help-docs/dashboards.md +6 -0
  19. package/public/assets/help-docs/history-api.md +69 -71
  20. package/public/assets/help-docs/menu.json +27 -7
  21. package/public/assets/help-docs/time-series.md +81 -0
  22. package/public/assets/help-docs/welcome.md +1 -1
  23. package/public/assets/svg/icons.svg +36 -1
  24. package/public/chunk-00hwknVI.js +1 -0
  25. package/public/chunk-5U8d2Ygo.js +14 -0
  26. package/public/chunk-AANk-NXH.js +1015 -0
  27. package/public/chunk-B6bEhzNR.js +1 -0
  28. package/public/chunk-B82ADJSs.js +1 -0
  29. package/public/chunk-BJz7Ij9E.js +1 -0
  30. package/public/chunk-BKj60jdq.js +1 -0
  31. package/public/chunk-BOAD0N2a.js +2 -0
  32. package/public/chunk-BQr-tSkv.js +1 -0
  33. package/public/chunk-BX6skw5k.js +1 -0
  34. package/public/chunk-BdokyhBM.js +1 -0
  35. package/public/chunk-Blokg6Ds.js +1 -0
  36. package/public/chunk-BoNDCNGE.js +1 -0
  37. package/public/chunk-Bp0MQwPM.js +1 -0
  38. package/public/chunk-BwOIef42.js +1 -0
  39. package/public/chunk-By8ZVvDx.js +2 -0
  40. package/public/chunk-C2VQxCXa.js +1 -0
  41. package/public/chunk-C6UXF7BI.js +1 -0
  42. package/public/chunk-CA6RRaxd.js +1 -0
  43. package/public/chunk-CIlfzV9R.js +1 -0
  44. package/public/chunk-CL2xiH57.js +1 -0
  45. package/public/chunk-CNMFlw_H.js +1 -0
  46. package/public/chunk-CNNTuNlM.js +1 -0
  47. package/public/chunk-CQNVyz8q.js +1 -0
  48. package/public/chunk-CXvG8mMq.js +1 -0
  49. package/public/chunk-CaD3zVfK.js +1 -0
  50. package/public/chunk-CkXTl3su.js +1 -0
  51. package/public/chunk-CpMCBDvH.js +1 -0
  52. package/public/chunk-CpuB_ZZz.js +2 -0
  53. package/public/chunk-CrBxxZCe.js +1 -0
  54. package/public/chunk-CwSa_BNV.js +1 -0
  55. package/public/chunk-D4xZ2tGB.js +39 -0
  56. package/public/chunk-DDqeRiB0.js +1 -0
  57. package/public/chunk-DE4ylhpq.js +1 -0
  58. package/public/chunk-DNS-qsFC.js +1 -0
  59. package/public/chunk-DQnoPLyC.js +1 -0
  60. package/public/chunk-DWLISAZi.js +1 -0
  61. package/public/chunk-DXkKj21H.js +1 -0
  62. package/public/chunk-DchvLV_Y.js +1 -0
  63. package/public/chunk-DjZgzSiH.js +1 -0
  64. package/public/chunk-DumLX5k_.js +1 -0
  65. package/public/chunk-Dxlia2NE.js +1 -0
  66. package/public/chunk-DzTTqoF_.js +1 -0
  67. package/public/chunk-H9_eqTYx.js +1 -0
  68. package/public/chunk-Ii9n-oiL.js +1 -0
  69. package/public/chunk-JbEkcxJm.js +2 -0
  70. package/public/chunk-MjWuPUhu.js +1 -0
  71. package/public/chunk-PheXEqie.js +1 -0
  72. package/public/chunk-TakPRI3t.js +2 -0
  73. package/public/chunk-VgxMqRPk.js +3 -0
  74. package/public/chunk-dgaOX1wC.js +382 -0
  75. package/public/chunk-hd2_AKwt.js +1 -0
  76. package/public/chunk-nu4vZg-z.js +1 -0
  77. package/public/chunk-sNakMDHi.js +1 -0
  78. package/public/chunk-tAiV3ARh.js +1 -0
  79. package/public/chunk-y1imvaA-.js +1 -0
  80. package/public/index.html +4 -4
  81. package/public/main-BAV5VDOD.js +7109 -0
  82. package/public/polyfills-5MJXXCNC.js +1 -0
  83. package/public/styles-JZSMCSRO.css +1 -0
  84. package/public/assets/help-docs/widget-historical-series.md +0 -110
  85. package/public/chunk-2TP7C66X.js +0 -5
  86. package/public/chunk-4KHUCTYN.js +0 -3
  87. package/public/chunk-6ISGIPNP.js +0 -1
  88. package/public/chunk-7JGTAL26.js +0 -10
  89. package/public/chunk-C23GLDFH.js +0 -62
  90. package/public/chunk-CB4E7PPA.js +0 -4
  91. package/public/chunk-DNM5XUIF.js +0 -1
  92. package/public/chunk-HF7V6XFA.js +0 -2
  93. package/public/chunk-HXR2BKDL.js +0 -4
  94. package/public/chunk-ILQQCGMJ.js +0 -5
  95. package/public/chunk-IXUKD73N.js +0 -5
  96. package/public/chunk-JMZYPL54.js +0 -2
  97. package/public/chunk-KJCBQE6W.js +0 -6
  98. package/public/chunk-LEY6MANN.js +0 -16
  99. package/public/chunk-O5BTKN5D.js +0 -1
  100. package/public/chunk-OH5KNIQ7.js +0 -50
  101. package/public/chunk-Q32FSCUX.js +0 -1
  102. package/public/chunk-RIX4VQJ2.js +0 -1
  103. package/public/chunk-SHJMXSDM.js +0 -1
  104. package/public/chunk-T4VTC6GW.js +0 -1
  105. package/public/chunk-VFJD3XKT.js +0 -1
  106. package/public/chunk-VFZSH4TC.js +0 -1
  107. package/public/chunk-W6MCE3GH.js +0 -6
  108. package/public/chunk-WAOG456B.js +0 -2
  109. package/public/chunk-XBOM6DMF.js +0 -9
  110. package/public/main-BECMST5R.js +0 -1
  111. package/public/polyfills-BWA36QKG.js +0 -1
  112. package/public/scripts-M6PHZBML.js +0 -14
  113. package/public/styles-DYEO23GZ.css +0 -1
@@ -0,0 +1,39 @@
1
+ import {cv as G}from'./main-BAV5VDOD.js';var r={minDist:230,maxDur:550,minVelocity:1.5,axisDominance:1.8,deadzoneMs:160,purityRatio:.8,lockThreshold:28,directionLockAngle:25,reversalPrimaryThreshold:34};function a$1(n){let e=G(G({},r),n);return `(() => {
2
+ if (window.__kipSwipeInit) return; window.__kipSwipeInit = true;
3
+ const instanceId='${e.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=${e.minDist};
7
+ const maxDur=${e.maxDur};
8
+ const minVelocity=${e.minVelocity};
9
+ const axisDominance=${e.axisDominance};
10
+ const deadzoneMs=${e.deadzoneMs};
11
+ const purityRatio=${e.purityRatio};
12
+ const lockThreshold=${e.lockThreshold};
13
+ const directionLockAngle=${e.directionLockAngle};
14
+ const reversalPrimaryThreshold=${e.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
+ })();`}export{a$1 as a};
@@ -0,0 +1 @@
1
+ import {u}from'./chunk-hd2_AKwt.js';import {d1 as Hj,w,du as p,dv as rt,$ as $j,a as G,cu as T,aR as lt,v as vt,D as Dt,cw as z,cv as G$1,ab as te,F as Fa,dn as ge,as as ke,cN as Wl,dB as Gl,J as JD,dC as x,c as $h,P as Pi,k as Qh,cn as wd,u as ul,_ as _w,B as Bh,e as EE,an as Hh,M as Mw,f as eg,K as Kw}from'./main-BAV5VDOD.js';var H=["svgSlider"];function q(o,e){o&1&&$h(0,"div",10);}var O=class o{id=Hj.required();type=Hj.required();theme=Hj.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:false,displayName:"Slider Label",filterSelfPaths:true,paths:{gaugePath:{description:"PUT Supported Numeric Path. IMPORTANT: Format must be set to (base)",path:null,source:null,pathType:"number",isPathConfigurable:true,showPathSkUnitsFilter:false,pathSkUnitsFilter:null,showConvertUnitTo:false,convertUnitTo:void 0,supportsPut:true,sampleTime:500}},displayScale:{lower:0,upper:1,type:"linear"},enableTimeout:false,dataTimeout:5,color:"contrast"};runtime=w(p);streams=w(rt);svgElement=$j.required("svgSlider");dashboard=w(G);signalkRequestsService=w(T);toast=w(lt);labelColor=vt("");barColor=vt("");lineStartPx=0;lineWidthPx=0;lineEndPx=0;resizeTimeout=null;handlePositionView=vt(20);lineWidthView=Dt(()=>`${Math.max(0,this.handlePositionView()-this.LINE_START)}px`);pathValue=0;lineStart=20;isDragStarted=false;VIEWBOX_WIDTH=200;LINE_START=20;LINE_WIDTH=160;colorMap=null;cfg=Dt(()=>this.runtime.options()??o.DEFAULT_CONFIG);gaugePathConfig=Dt(()=>this.cfg().paths?.gaugePath);displayNameSafe=Dt(()=>this.cfg().displayName??"Slider Label");displayScale=Dt(()=>{let e=this.cfg().displayScale??o.DEFAULT_CONFIG.displayScale;return z(G$1({},e),{lower:e.lower??0,upper:e.upper??1})});valueChange$=new te;constructor(){Fa(()=>{let e=this.theme(),t=this.cfg();!t||!e||ge(()=>{this.ensureColorMap(),this.getColors(t.color??"contrast");});}),Fa(()=>{this.cfg();this.gaugePathConfig()?.path&&ge(()=>{this.calculateLineBounds(),this.streams.observe("gaugePath",i=>{if(!i||!i.data){queueMicrotask(()=>this.updateHandlePosition(this.mapValueToPosition(this.displayScale().lower)));return}queueMicrotask(()=>this.updateHandlePosition(this.mapValueToPosition(i.data.value)));});});});}ngOnInit(){this.getColors(this.cfg().color??"contrast"),this.valueChange$.pipe(ke(e=>{let t=this.displayScale();return this.isWithinMargin(e,t.lower)?t.lower:this.isWithinMargin(e,t.upper)?t.upper:parseFloat(e.toFixed(2))}),Wl(200),Gl()).subscribe(e=>{this.sendValue(e);});}mapValueToPosition(e){let t=this.displayScale(),i=t.upper-t.lower,n=this.LINE_WIDTH;return (e-t.lower)/i*n+this.LINE_START}mapPositionToValue(e){let t=this.displayScale(),i=t.upper-t.lower,n=this.LINE_WIDTH;return (e-this.LINE_START)/n*i+t.lower}isWithinMargin(e,t){let i=this.displayScale(),n=(i.upper-i.lower)*.01;return Math.abs(e-t)<=n}sendValue(e){let t=this.gaugePathConfig()?.path;t&&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){let t=Math.max(this.LINE_START,Math.min(this.LINE_START+this.LINE_WIDTH,e));this.handlePositionView.set(t);}getPointerX(e){return e.clientX-this.svgElement().nativeElement.getBoundingClientRect().left}onPointerDown(e){this.isDragStarted=true,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 n=this.handlePositionView(),r=this.displayScale();n<=this.LINE_START?this.pathValue=r.lower:n>=this.LINE_START+this.LINE_WIDTH?this.pathValue=r.upper:this.pathValue=this.mapPositionToValue(n),this.valueChange$.next(this.pathValue);}}}onPointerUp(){this.isDragStarted=false,this.valueChange$.next(this.pathValue);}onPointerLeave(){this.isDragStarted&&(this.isDragStarted=false,this.valueChange$.next(this.pathValue));}getColors(e){if(this.ensureColorMap(),!this.colorMap)return;let t=this.colorMap.get(e)||this.colorMap.get("contrast");t&&(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||o)};static \u0275cmp=JD({type:o,selectors:[["widget-slider"]],viewQuery:function(t,i){t&1&&eg(i.svgElement,H,5),t&2&&Kw();},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){t&1&&($h(0,"widget-title",1),Pi(1,"div",2),Qh("resizeChange",function(){return i.onResized()}),wd(),Pi(2,"svg",3),$h(3,"rect",4)(4,"rect",5),Pi(5,"g",6),$h(6,"circle",7)(7,"circle",8),ul(),Pi(8,"rect",9,0),Qh("pointerdown",function(r){return i.onPointerDown(r)})("pointerup",function(){return i.onPointerUp()})("pointermove",function(r){return i.onPointerMove(r)})("pointerleave",function(){return i.onPointerLeave()}),ul()(),_w(10,q,1,0,"div",10),ul()),t&2&&(Bh("text",i.displayNameSafe())("color",i.labelColor()),EE(4),Hh("width",i.lineWidthView())("fill",i.barColor()),EE(2),Hh("cx",i.handlePositionView()),EE(),Hh("cx",i.handlePositionView()),EE(3),Mw(i.dashboard.isDashboardStatic()?-1:10));},dependencies:[u,x],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)}"]})};export{O as WidgetSliderComponent};
@@ -0,0 +1 @@
1
+ import {d1 as Hj,w,du as p,dv as rt,D as Dt,$ as $j,ao as ue,F as Fa,dn as ge,J as JD,ci as dl,T as TT,cj as fl,d as ig,e as EE,b_ as Gh,f as eg,K as Kw}from'./main-BAV5VDOD.js';var T=["hWrapper"];function P(i){return {Red:i.ColorDef.RED,Green:i.ColorDef.GREEN,Blue:i.ColorDef.BLUE,Orange:i.ColorDef.ORANGE,Yellow:i.ColorDef.YELLOW,Cyan:i.ColorDef.CYAN,Magenta:i.ColorDef.MAGENTA,White:i.ColorDef.WHITE,Gray:i.ColorDef.GRAY,Black:i.ColorDef.BLACK,Raith:i.ColorDef.RAITH,"Green LCD":i.ColorDef.GREEN_LCD,"JUG Green":i.ColorDef.JUG_GREEN}}function A(i){return {blackMetal:i.FrameDesign.BLACK_METAL,metal:i.FrameDesign.METAL,shinyMetal:i.FrameDesign.SHINY_METAL,brass:i.FrameDesign.BRASS,steel:i.FrameDesign.STEEL,chrome:i.FrameDesign.CHROME,gold:i.FrameDesign.GOLD,anthracite:i.FrameDesign.ANTHRACITE,tiltedGray:i.FrameDesign.TILTED_GRAY,tiltedBlack:i.FrameDesign.TILTED_BLACK,glossyMetal:i.FrameDesign.GLOSSY_METAL}}var I=(()=>{class i{id=Hj.required();type=Hj.required();theme=Hj.required();runtime=w(p);streams=w(rt);normalizedConfig=Dt(()=>this.runtime.options()??i.DEFAULT_CONFIG);horizonPaths=Dt(()=>this.normalizedConfig().paths??{});static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:true,displayName:"Horizon",filterSelfPaths:true,paths:{gaugePitchPath:{description:"Attitude Pitch Data",path:"self.navigation.attitude.pitch",source:"default",pathType:"number",pathRequired:false,isPathConfigurable:true,showPathSkUnitsFilter:false,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:1e3},gaugeRollPath:{description:"Attitude Roll Data",path:"self.navigation.attitude.roll",source:"default",pathType:"number",pathRequired:false,isPathConfigurable:true,showPathSkUnitsFilter:false,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:1e3}},gauge:{type:"horizon",noFrameVisible:false,faceColor:"anthracite",invertPitch:false,invertRoll:false},enableTimeout:false,dataTimeout:5};wrapperRef=$j("hWrapper");resizeObserver=null;currentSize=0;structuralKey="";pendingSize=null;sizeCommitTimer=null;SIZE_STABLE_MS=180;ngZone=w(ue);gaugeOptions={};frameVisibleView=Dt(()=>!(this.runtime.options()?.gauge?.noFrameVisible??false));gauge=null;latestPitch=0;latestRoll=0;constructor(){Fa(()=>{let t=this.normalizedConfig();this.horizonPaths().gaugePitchPath?.path&&ge(()=>this.streams.observe("gaugePitchPath",n=>{let a=n?.data?.value??0;if(this.latestPitch=a,this.gauge){let r=t.gauge?.invertPitch?-a:a;try{this.gauge.setPitchAnimated(r);}catch(s){}}}));}),Fa(()=>{let t=this.normalizedConfig();this.horizonPaths().gaugeRollPath?.path&&ge(()=>this.streams.observe("gaugeRollPath",n=>{let a=n?.data?.value??0;if(this.latestRoll=a,this.gauge){let r=t.gauge?.invertRoll?-a:a;try{this.gauge.setRollAnimated(r);}catch(s){}}}));}),Fa(()=>{let t=this.runtime.options();if(!t)return;let e=`${t.gauge?.noFrameVisible??false}|${t.gauge?.faceColor??"anthracite"}`;if(e===this.structuralKey){this.applyInversions(t);return}this.structuralKey=e,this.currentSize>=50&&(this.buildOptions(t,this.currentSize),this.rebuildGauge());});}ngAfterViewInit(){let t=this.wrapperRef()?.nativeElement;if(!t)return;let e=()=>{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 o=document.getElementById(this.id()+"-canvas");o&&((o.width!==r||o.height!==r)&&(o.width=r,o.height=r),o.style.width=r+"px",o.style.height=r+"px"),this.buildOptions(s,r),this.rebuildGauge(),this.pendingSize=null;},n=()=>{this.sizeCommitTimer&&clearTimeout(this.sizeCommitTimer),this.sizeCommitTimer=window.setTimeout(()=>{e(),this.sizeCommitTimer=null;},this.SIZE_STABLE_MS);},a=()=>{let r=t.getBoundingClientRect(),s=Math.round(Math.min(r.width,r.height)),o=this.pendingSize??this.currentSize;if(!s||s<50||o&&Math.abs(o-s)<4)return;if(this.currentSize===0&&this.pendingSize===null){this.pendingSize=s,e();return}this.pendingSize=s;let u=document.getElementById(this.id()+"-canvas");u&&(u.style.width=s+"px",u.style.height=s+"px"),n();};this.ngZone.runOutsideAngular(()=>{this.resizeObserver=new ResizeObserver(()=>a()),this.resizeObserver.observe(t),a();});}buildOptions(t,e){if(typeof steelseries>"u")return;let n=A(steelseries),a=P(steelseries),r=t.gauge?.faceColor??"anthracite";this.gaugeOptions={pointerColor:a.Red,frameVisible:!(t.gauge?.noFrameVisible??false),frameDesign:n[r],foregroundVisible:false,size:e};}rebuildGauge(){let t=this.id()+"-canvas";if(this.gauge)try{this.gauge=null;}catch(n){}let e=document.getElementById(t);if(e){this.currentSize&&(e.width!==this.currentSize||e.height!==this.currentSize)&&(e.width=this.currentSize,e.height=this.currentSize);let n=e.getContext("2d");n&&n.clearRect(0,0,e.width,e.height);}try{this.gauge=new steelseries.Horizon(t,this.gaugeOptions);let n=this.runtime.options();n&&this.gauge&&this.applyInversions(n);}catch(n){}}applyInversions(t){if(this.gauge){try{this.gauge.setPitchAnimated(t.gauge?.invertPitch?-this.latestPitch:this.latestPitch);}catch(e){}try{this.gauge.setRollAnimated(t.gauge?.invertRoll?-this.latestRoll:this.latestRoll);}catch(e){}}}ngOnDestroy(){if(this.resizeObserver){try{this.resizeObserver.disconnect();}catch(e){}this.resizeObserver=null;}this.sizeCommitTimer&&(clearTimeout(this.sizeCommitTimer),this.sizeCommitTimer=null);let t=document.getElementById(this.id()+"-canvas");if(t)try{let e=t.getContext("2d");e&&e.clearRect(0,0,t.width,t.height),t.width=0,t.height=0;}catch(e){}this.gauge=null;}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=JD({type:i,selectors:[["widget-horizon"]],viewQuery:function(e,n){e&1&&eg(n.wrapperRef,T,5),e&2&&Kw();},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(e,n){e&1&&(dl(0,"div",1,0)(2,"canvas",2),TT(3," Browser does not support canvas element. "),fl()()),e&2&&(ig("padding",n.frameVisibleView()?"10px":"0px"),EE(2),Gh("id",n.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 i})();export{I as WidgetHorizonComponent};
@@ -0,0 +1 @@
1
+ import'./chunk-By8ZVvDx.js';import {d1 as Hj,w,du as p,dv as rt,aZ as F,dw as S,$ as $j,v as vt,D as Dt,dx as n$1,F as Fa,dn as ge,J as JD,_ as _w,c as $h,M as Mw,f as eg,K as Kw,bu as ut,dy as K,ao as ue,a6 as Lr,b0 as Wl,cp as Uh,g as qw,B as Bh}from'./main-BAV5VDOD.js';import {c}from'./chunk-Dxlia2NE.js';var H=["widgetDataChart"],C=(()=>{class n{theme=Hj.required();color=null;dataPath=null;dataSource=null;convertUnitTo=null;numDecimal=null;yScaleMin=null;yScaleMax=null;inverseYAxis=false;verticalChart=null;datasetUUID=null;unitsService=w(ut);dsService=w(K);ngZone=w(ue);canvasService=w(F);widgetDataChart=$j("widgetDataChart",{read:Lr});lineChartData={datasets:[]};lineChartOptions={parsing:false,datasets:{line:{pointRadius:0,pointHoverRadius:0,tension:.4}},animations:{tension:{easing:"easeInOutCubic"}}};lineChartType="line";chart=null;dsServiceSub=null;datasetConfig=null;dataSourceInfo=null;isDestroyed=false;lastChartSignature=null;config={datasetAverageArray:"sma",showAverageData:false,trackAgainstAverage:false,startScaleAtZero:false,yScaleSuggestedMin:null,yScaleSuggestedMax:null,enableMinMaxScaleLimit:false};constructor(){Fa(()=>{this.theme()&&ge(()=>{this.datasetConfig&&(this.setChartOptions(),this.setDatasetsColors());});});}startChart(){if(!(this.isDestroyed||!this.datasetUUID)&&(this.datasetConfig=this.dsService.getDatasetConfig(this.datasetUUID)??null,this.dataSourceInfo=this.dsService.getDataSourceInfo(this.datasetUUID)??null,this.datasetConfig&&this.dataSourceInfo)){let t=this.buildChartSignature();if(this.chart&&t===this.lastChartSignature)return;this.chart&&t!==this.lastChartSignature&&this.destroyChart(),this.setChartOptions(),this.createDatasets();let i=this.widgetDataChart()?.nativeElement?.getContext("2d");if(!i)return;this.chart=new Wl(i,{type:this.lineChartType,data:this.lineChartData,options:this.lineChartOptions}),this.lastChartSignature=t,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(){let t=this.datasetConfig,e=this.dataSourceInfo;!t||!e||(this.lineChartOptions.maintainAspectRatio=false,this.lineChartOptions.animation=false,this.lineChartOptions.indexAxis=this.verticalChart?"y":"x",this.verticalChart?this.lineChartOptions.scales={x:{display:false,position:"right",suggestedMin:this.config.enableMinMaxScaleLimit?void 0:this.numberOrUndefined(this.yScaleMin),suggestedMax:this.config.enableMinMaxScaleLimit?void 0:this.numberOrUndefined(this.yScaleMax),min:this.config.enableMinMaxScaleLimit?this.numberOrUndefined(this.yScaleMin):void 0,max:this.config.enableMinMaxScaleLimit?this.numberOrUndefined(this.yScaleMax):void 0,beginAtZero:this.config.startScaleAtZero,reverse:this.inverseYAxis,title:{display:false,text:"Value Axis",align:"center"},ticks:{maxTicksLimit:8,precision:this.numberOrUndefined(this.numDecimal),color:this.getThemeColors().averageChartLine,major:{enabled:true}},grid:{display:false,color:this.theme().contrastDimmer}},y:{type:"realtime",display:false,title:{display:false},time:{unit:t.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:false,color:this.getThemeColors().averageChartLine,major:{enabled:true}},grid:{display:false,color:this.theme().contrastDimmer}}}:this.lineChartOptions.scales={x:{type:"realtime",display:false,title:{display:false},time:{unit:t.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:false,color:this.getThemeColors().averageChartLine,major:{enabled:true}},grid:{display:false,color:this.theme().contrastDimmer}},y:{display:false,position:"right",suggestedMin:this.config.enableMinMaxScaleLimit?void 0:this.numberOrUndefined(this.yScaleMin),suggestedMax:this.config.enableMinMaxScaleLimit?void 0:this.numberOrUndefined(this.yScaleMax),min:this.config.enableMinMaxScaleLimit?this.numberOrUndefined(this.yScaleMin):void 0,max:this.config.enableMinMaxScaleLimit?this.numberOrUndefined(this.yScaleMax):void 0,beginAtZero:this.config.startScaleAtZero,reverse:this.inverseYAxis,title:{display:false,text:"Value Axis",align:"center"},ticks:{maxTicksLimit:8,precision:this.numberOrUndefined(this.numDecimal),color:this.getThemeColors().averageChartLine,major:{enabled:true}},grid:{display:false,color:this.theme().contrastDimmer}}},this.lineChartOptions.plugins={legend:{display:false},annotation:{annotations:{}},streaming:{duration:e.maxDataPoints*e.sampleTime,delay:e.sampleTime,frameRate:t.timeScaleFormat==="day"?5:t.timeScaleFormat==="hour"?8:t.timeScaleFormat==="minute"?15:30}});}numberOrUndefined(t){return t??void 0}createDatasets(){let t=this.lineChartOptions.scales?.y?.reverse?"start":true;this.lineChartData.datasets=[],this.lineChartData.datasets.push({label:"Value",data:[],order:0,parsing:false,tension:.4,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:3,fill:t}),this.lineChartData.datasets.push({label:"Average",data:[],order:1,parsing:false,tension:.4,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:3,fill:t}),this.setDatasetsColors();}setDatasetsColors(){this.lineChartData.datasets.forEach(t=>{t.borderColor=this.getThemeColors().averageLine,t.backgroundColor=this.getThemeColors().averageFill;});}getThemeColors(){let t=this.color,e={valueLine:"",valueFill:"",averageLine:"",averageFill:"",averageChartLine:"",chartLabel:"",chartValue:""};switch(t){case "contrast":this.config.trackAgainstAverage?(e.valueLine=this.theme().contrastDimmer,e.valueFill=this.theme().contrastDimmer,e.averageLine=this.theme().contrast,e.averageFill=this.theme().contrast,e.chartValue=e.averageLine):(e.valueLine=this.theme().contrast,e.valueFill=this.theme().contrast,e.averageLine=this.theme().contrastDimmer,e.averageFill=this.theme().contrastDimmer,e.chartValue=this.theme().contrast),e.averageChartLine=this.theme().contrastDim,e.chartLabel=this.theme().contrastDim;break;case "blue":this.config.trackAgainstAverage?(e.valueLine=this.theme().blueDimmer,e.valueFill=this.theme().blueDimmer,e.averageLine=this.theme().blue,e.averageFill=this.theme().blue,e.chartValue=e.averageLine):(e.valueLine=this.theme().blue,e.valueFill=this.theme().blue,e.averageLine=this.theme().blueDimmer,e.averageFill=this.theme().blueDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().blueDim,e.chartLabel=this.theme().contrastDim;break;case "green":this.config.trackAgainstAverage?(e.valueLine=this.theme().greenDimmer,e.valueFill=this.theme().greenDimmer,e.averageLine=this.theme().green,e.averageFill=this.theme().green,e.chartValue=e.averageLine):(e.valueLine=this.theme().green,e.valueFill=this.theme().green,e.averageLine=this.theme().greenDimmer,e.averageFill=this.theme().greenDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().greenDim,e.chartLabel=this.theme().contrastDim;break;case "pink":this.config.trackAgainstAverage?(e.valueLine=this.theme().pinkDimmer,e.valueFill=this.theme().pinkDimmer,e.averageLine=this.theme().pink,e.averageFill=this.theme().pink,e.chartValue=e.averageLine):(e.valueLine=this.theme().pink,e.valueFill=this.theme().pink,e.averageLine=this.theme().pinkDimmer,e.averageFill=this.theme().pinkDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().pinkDim,e.chartLabel=this.theme().contrastDim;break;case "orange":this.config.trackAgainstAverage?(e.valueLine=this.theme().orangeDimmer,e.valueFill=this.theme().orangeDimmer,e.averageLine=this.theme().orange,e.averageFill=this.theme().orange,e.chartValue=e.averageLine):(e.valueLine=this.theme().orange,e.valueFill=this.theme().orange,e.averageLine=this.theme().orangeDimmer,e.averageFill=this.theme().orangeDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().orangeDim,e.chartLabel=this.theme().contrastDim;break;case "purple":this.config.trackAgainstAverage?(e.valueLine=this.theme().purpleDimmer,e.valueFill=this.theme().purpleDimmer,e.averageLine=this.theme().purple,e.averageFill=this.theme().purple,e.chartValue=e.averageLine):(e.valueLine=this.theme().purple,e.valueFill=this.theme().purple,e.averageLine=this.theme().purpleDimmer,e.averageFill=this.theme().purpleDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().purpleDim,e.chartLabel=this.theme().contrastDim;break;case "grey":this.config.trackAgainstAverage?(e.valueLine=this.theme().greyDimmer,e.valueFill=this.theme().greyDimmer,e.averageLine=this.theme().grey,e.averageFill=this.theme().grey,e.chartValue=e.averageLine):(e.valueLine=this.theme().grey,e.valueFill=this.theme().grey,e.averageLine=this.theme().greyDimmer,e.averageFill=this.theme().greyDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().greyDim,e.chartLabel=this.theme().contrastDim;break;case "yellow":this.config.trackAgainstAverage?(e.valueLine=this.theme().yellowDimmer,e.valueFill=this.theme().yellowDimmer,e.averageLine=this.theme().yellow,e.averageFill=this.theme().yellow,e.chartValue=e.averageLine):(e.valueLine=this.theme().yellow,e.valueFill=this.theme().yellow,e.averageLine=this.theme().yellowDimmer,e.averageFill=this.theme().yellowDimmer,e.chartValue=e.valueFill),e.averageChartLine=this.theme().yellowDim,e.chartLabel=this.theme().contrastDim;break}return e}startStreaming(){if(this.dsServiceSub?.unsubscribe(),!this.datasetUUID||!this.chart)return;let t=this.dsService.getDatasetBatchThenLiveObservable(this.datasetUUID);t&&(this.dsServiceSub=t.subscribe(e=>{if(!(this.isDestroyed||!this.chart||!this.chart.ctx)){if(Array.isArray(e)){let s=this.transformDatasetRows(e,0);if(this.chart.data.datasets[0].data.push(...s),this.config.showAverageData){let r=this.transformDatasetRows(e,this.config.datasetAverageArray);this.chart.data.datasets[1].data.push(...r);}}else {let s=this.transformDatasetRows([e],0)[0];if(this.chart.data.datasets[0].data.push(s),this.config.showAverageData){let r=this.transformDatasetRows([e],this.config.datasetAverageArray)[0];this.chart.data.datasets[1].data.push(r);}}this.ngZone.runOutsideAngular(()=>{if(this.isDestroyed||!this.chart)return;let s=this.chart;s.ctx&&s.update("none");});}}));}destroyChart(){this.dsServiceSub?.unsubscribe(),this.dsServiceSub=null,this.chart?.destroy(),this.chart=null,this.lastChartSignature=null;}transformDatasetRows(t,e){let i=a=>this.unitsService.convertToUnit(this.convertUnitTo??"",a)??a,s=this.verticalChart===true,r=this.config.datasetAverageArray;return t.map(a=>{if(s){if(e===0)return {x:i(a.data.value),y:a.timestamp};{let D={sma:a.data.sma,ema:a.data.ema,dema:a.data.doubleEma,avg:a.data.lastAverage};return {x:i(D[r]??a.data.value),y:a.timestamp}}}else {if(e===0)return {x:a.timestamp,y:i(a.data.value)};{let D={sma:a.data.sma,ema:a.data.ema,dema:a.data.doubleEma,avg:a.data.lastAverage};return {x:a.timestamp,y:i(D[r]??a.data.value)}}}})}ngOnDestroy(){this.isDestroyed=true,this.destroyChart();let t=this.widgetDataChart?.()?.nativeElement;this.canvasService.releaseCanvas(t,{clear:true,removeFromDom:true});}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=JD({type:n,selectors:[["minichart"]],viewQuery:function(e,i){e&1&&eg(i.widgetDataChart,H,5,Lr),e&2&&Kw();},inputs:{theme:[1,"theme"]},decls:2,vars:0,consts:[["widgetDataChart",""],[2,"z-index","inherit"]],template:function(e,i){e&1&&Uh(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 I=["canvasMainRef"];function E(n,P){if(n&1&&$h(0,"minichart",1),n&2){let t=qw();Bh("theme",t.theme());}}var se=(()=>{class n{id=Hj.required();type=Hj.required();theme=Hj.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:true,displayName:"Gauge Label",filterSelfPaths:true,paths:{numericPath:{description:"Numeric Data",path:null,source:null,pathType:"number",suppressBootstrapNull:true,isPathConfigurable:true,convertUnitTo:"unitless",showPathSkUnitsFilter:true,pathSkUnitsFilter:null,sampleTime:500}},showMax:false,showMin:false,numDecimal:1,showMiniChart:false,yScaleMin:0,yScaleMax:10,inverseYAxis:false,verticalChart:false,color:"contrast",enableTimeout:false,dataTimeout:5,ignoreZones:false};runtime=w(p);stream=w(rt);canvas=w(F);datasetLifecycle=w(S);miniChart=$j(C);canvasMainRef=$j.required("canvasMainRef");showMiniChart=vt(false);labelColor=vt("");canvasElement;canvasCtx=null;cssWidth=0;cssHeight=0;backgroundBitmap=null;backgroundBitmapText=null;dataValue=null;maxValue=null;minValue=null;valueColor="";valueStateColor="";maxValueTextWidth=0;maxValueTextHeight=0;maxMinMaxTextWidth=0;maxMinMaxTextHeight=0;streamRegistered=false;pathDataState=null;isDestroyed=false;lastSubscriptionSignature=null;normalizedConfig=Dt(()=>this.runtime.options()??n.DEFAULT_CONFIG);numericPathConfig=Dt(()=>this.normalizedConfig().paths?.numericPath);subscriptionSignature=Dt(()=>{this.normalizedConfig();let e=this.numericPathConfig();if(!e?.path)return null;let i=e.source?.trim()||"default";return [e.path,e.pathType,e.sampleTime,e.convertUnitTo,i,e.suppressBootstrapNull?"1":"0"].join("|")});onNumericValue=t=>{if(this.dataValue=t.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.normalizedConfig().ignoreZones&&this.pathDataState!==t.state)switch(this.pathDataState=t.state,t.state){case n$1.Alarm:this.valueStateColor=this.theme().zoneAlarm;break;case n$1.Warn:this.valueStateColor=this.theme().zoneWarn;break;case n$1.Alert:this.valueStateColor=this.theme().zoneAlert;break;default:this.valueStateColor=this.valueColor;break}this.drawWidget();};constructor(){this.showMiniChart.set(this.normalizedConfig().showMiniChart??false),Fa(()=>{let t=this.theme(),e=this.normalizedConfig().color;ge(()=>{t&&e!==void 0&&(this.setColors(),this.drawWidget());});}),Fa(()=>{let t=this.subscriptionSignature();ge(()=>{this.isDestroyed||!this.canvasCtx||t===this.lastSubscriptionSignature&&this.streamRegistered||(this.minValue=null,this.maxValue=null,this.dataValue=null,this.pathDataState=null,this.lastSubscriptionSignature=t,t&&(this.stream?.observe("numericPath",this.onNumericValue),this.streamRegistered=true,this.manageDatasetAndChart()));});}),Fa(()=>{let t=this.showMiniChart(),e=this.miniChart(),i=this.normalizedConfig(),s=this.numericPathConfig();[i?.showMiniChart?"1":"0",s?.path??"",s?.source??"default",s?.convertUnitTo??"",i?.numDecimal??"",i?.yScaleMin??"",i?.yScaleMax??"",i?.inverseYAxis?"1":"0",i?.verticalChart?"1":"0",i?.color??""].join("|")&&t&&e&&(this.setMiniChart(),e.startChart());});}ngOnInit(){this.setColors(),this.canvasElement=this.canvasMainRef().nativeElement,this.canvasCtx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:true,onResize:(t,e)=>{this.cssWidth=t,this.cssHeight=e,this.calculateMaxMinTextDimensions(),this.drawWidget();}});}ngAfterViewInit(){this.isDestroyed||!this.streamRegistered&&this.subscriptionSignature()&&(this.stream?.observe("numericPath",this.onNumericValue),this.streamRegistered=true,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 t=this.normalizedConfig(),e=this.numericPathConfig(),i=!!t.showMiniChart;if(this.showMiniChart.set(i),!i){this.datasetLifecycle.removeDatasetIfExists(this.id(),false);return}if(!e||!e.path)return;let s=e.source??"default";this.datasetLifecycle.syncNumericMiniChartDataset(this.id(),e.path,s);}setMiniChart(){let t=this.miniChart(),e=this.normalizedConfig(),i=this.numericPathConfig();t&&(t.dataPath=i?.path??null,t.dataSource=i?.source??"default",t.color=e.color??"contrast",t.convertUnitTo=i?.convertUnitTo??null,t.numDecimal=e.numDecimal??null,t.yScaleMin=e.yScaleMin??null,t.yScaleMax=e.yScaleMax??null,t.inverseYAxis=e.inverseYAxis??false,t.verticalChart=e.verticalChart??null,t.datasetUUID=this.id());}setColors(){let t=this.normalizedConfig(),e=this.theme(),i=t.color??"contrast";this.labelColor.set(c(i,e).dim),this.valueStateColor=this.valueColor=c(i,e).color,this.backgroundBitmap=null,this.backgroundBitmapText=null;}drawWidget(){if(!this.canvasCtx)return;let t=this.normalizedConfig(),e=this.numericPathConfig()?.convertUnitTo??"",i=10*this.canvas.scaleFactor,s=5*this.canvas.scaleFactor,r=(t.displayName??"")+"|"+e;(!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,a=>{this.canvas.drawTitleInternal(a,t.displayName??"",this.labelColor(),"normal",this.cssWidth,this.cssHeight,.1),["unitless","percent","ratio","latitudeSec","latitudeMin","longitudeSec","longitudeMin"].includes(e)||this.canvas.drawText(a,e,this.cssWidth-i,this.cssHeight-s,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(),(t.showMax||t.showMin)&&this.drawMinMax();}drawValue(){let t=this.getValueText(),e=this.canvasCtx;e&&this.canvas.drawText(e,t,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 t=this.normalizedConfig(),e=this.numericPathConfig()?.convertUnitTo??"";return ["latitudeSec","latitudeMin","longitudeSec","longitudeMin","D HH:MM:SS"].includes(e)?this.dataValue.toString():this.applyDecorations(this.dataValue.toFixed(t.numDecimal??1))}drawMinMax(){let t=this.normalizedConfig();if(!t.showMin&&!t.showMax)return;let e=t.numDecimal??1,i="";t.showMin&&(i=this.minValue!=null?` Min: ${this.applyDecorations(this.minValue.toFixed(e))}`:" Min: --"),t.showMax&&(i+=this.maxValue!=null?` Max: ${this.applyDecorations(this.maxValue.toFixed(e))}`:" Max: --"),i=i.trim();let s=10*this.canvas.scaleFactor,r=5*this.canvas.scaleFactor,a=this.canvasCtx;a&&this.canvas.drawText(a,i,s,Math.floor(this.cssHeight-r),this.maxMinMaxTextWidth,this.maxMinMaxTextHeight,"normal",this.valueColor,"start","bottom");}applyDecorations(t){switch(this.numericPathConfig()?.convertUnitTo??""){case "percent":case "percentraw":t+="%";break}return t}ngOnDestroy(){this.isDestroyed=true,this.datasetLifecycle.removeDatasetIfExists(this.id(),false);try{this.canvas.unregisterCanvas(this.canvasElement);}catch(t){}}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=JD({type:n,selectors:[["widget-numeric"]],viewQuery:function(e,i){e&1&&eg(i.miniChart,C,5)(i.canvasMainRef,I,5),e&2&&Kw(2);},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:3,vars:1,consts:[["canvasMainRef",""],[3,"theme"],[1,"numeric-canvas"]],template:function(e,i){e&1&&(_w(0,E,1,1,"minichart",1),$h(1,"canvas",2,0)),e&2&&Mw(i.showMiniChart()?0:-1);},dependencies:[C],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})();export{se as WidgetNumericComponent};
@@ -0,0 +1 @@
1
+ import {a as a$1}from'./chunk-D4xZ2tGB.js';import {d1 as Hj,w,du as p,a as G,H as Dr,$ as $j,v as vt,F as Fa,dn as ge,J as JD,_ as _w,cp as Uh,M as Mw,e as EE,d as ig,f as eg,K as Kw,g as qw,b_ as Gh,ci as dl,T as TT,cj as fl,dP as pp}from'./main-BAV5VDOD.js';var W=["plainIframe"];function M(n,e){if(n&1&&Uh(0,"iframe",1,0),n&2){let t=qw();Gh("src",t.widgetUrl(),pp);}}function N(n,e){n&1&&(dl(0,"div",2)(1,"h2"),TT(2,"Empty or bad URL"),fl(),dl(3,"p"),TT(4," IMPORTANT: cross-domain security rules (CORS) apply to this widget. "),fl(),dl(5,"p"),TT(6,"Typically, you can load Grafana graphs, Signal K apps or other related tools. "),fl()());}var O=class n{id=Hj.required();type=Hj.required();theme=Hj.required();runtime=w(p);_dashboard=w(G);_sanitizer=w(Dr);static DEFAULT_CONFIG={widgetUrl:void 0,allowInput:false};iframe=$j.required("plainIframe");widgetUrl=vt(null);displayTransparentOverlay=vt("block");constructor(){Fa(()=>{let e=this.runtime.options(),t=this._dashboard.isDashboardStatic();e&&ge(()=>{t?this.displayTransparentOverlay.set(e.allowInput?"none":"block"):this.displayTransparentOverlay.set("block");});}),Fa(()=>{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:true,cancelable:true});window.document.dispatchEvent(i);break}case "swiperight":{let i=new Event("openRightSidenav",{bubbles:true,cancelable:true});window.document.dispatchEvent(i);break}}if(e.data.type==="keydown"&&e.data.keyEventData){let{key:i,ctrlKey:l,shiftKey:r}=e.data.keyEventData,x=new KeyboardEvent("keydown",{key:i,ctrlKey:l,shiftKey:r,bubbles:true,cancelable:true});document.dispatchEvent(x);}}};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 l=a$1({instanceId:this.id()}),r=t.createElement("script");r.id=i,r.textContent=l,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}`),false}}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=JD({type:n,selectors:[["widget-iframe"]],viewQuery:function(t,i){t&1&&eg(i.iframe,W,5),t&2&&Kw();},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&&(_w(0,M,2,1,"iframe",1)(1,N,7,0,"div",2),Uh(2,"div",3)),t&2&&(Mw(i.widgetUrl()?0:1),EE(2),ig("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}"]})};export{O as WidgetIframeComponent};
@@ -0,0 +1 @@
1
+ import {d1 as Hj,w,du as p,dF as l,aZ as F,aY as xe,$ as $j,v as vt,F as Fa,dn as ge,a_ as Gp,dx as n$1,J as JD,O as Op,bh as xp,y as yt,b as wt,P as Pi,c as $h,k as Qh,cn as wd,T as TT,u as ul,cV as Td,_ as _w,e as EE,M as Mw,f as eg,K as Kw,h as Fw,l as ud,g as qw,m as dd}from'./main-BAV5VDOD.js';var D=["canvasMainRef"];function B(c,L){if(c&1){let e=Fw();Pi(0,"button",14),Qh("click",function(){ud(e);let i=qw();return dd(i.startTimer())}),TT(1," Start "),ul();}}function G(c,L){if(c&1){let e=Fw();Pi(0,"button",15),Qh("click",function(){ud(e);let i=qw();return dd(i.pauseTimer())}),TT(1," Pause "),ul();}}var et=(()=>{class c{id=Hj.required();type=Hj.required();theme=Hj.required();runtime=w(p);timers=w(l);canvas=w(F);destroyRef=w(xe);timerSub;static DEFAULT_CONFIG={timerLength:-300,color:"contrast",playBeeps:true};canvasRef=$j.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;maxTextWidth=0;maxTextHeight=0;dataValue=null;zoneState=null;currentValueLength=0;valueFontSize=1;flashOn=false;flashInterval=null;timerRunning=vt(false);timeName="race";warnColor="";textColor="";constructor(){Fa(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||ge(()=>{this.applyColors(e.color??"contrast",t),this.draw();});}),Fa(()=>{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:true,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.timerSub?.unsubscribe();let t=this.timers.createTimer(this.timeName,e,1e3);this.timerSub=t.pipe(Gp(this.destroyRef)).subscribe(i=>{this.dataValue=i,this.timerRunning.set(this.timers.isRunning(this.timeName)),i>0?this.zoneState=n$1.Normal:i===0?(this.zoneState=n$1.Normal,this.beep(500,2e3)):i>-10?(this.zoneState=n$1.Alarm,this.beep(450,100)):i>=-29?this.zoneState=n$1.Warn:i===-30?(this.zoneState=n$1.Warn,this.beep(400,200)):this.zoneState=n$1.Normal,this.zoneState===n$1.Alarm&&!this.flashInterval?this.flashInterval=setInterval(()=>{this.flashOn=!this.flashOn,this.draw();},500):this.zoneState!==n$1.Alarm&&this.flashInterval&&(clearInterval(this.flashInterval),this.flashInterval=null,this.flashOn=false),this.draw();});}startTimer(){this.timers.startTimer(this.timeName),this.timerRunning.set(true);}resetTimer(){this.timers.deleteTimer(this.timeName),this.timerRunning.set(false);let e=this.runtime.options();this.ensureTimer(e?.timerLength??-300),this.draw();}pauseTimer(){this.timers.stopTimer(this.timeName),this.timerRunning.set(false);}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(),p=i.createGain();a.connect(p),p.connect(i.destination),a.type="sine",a.frequency.value=e,p.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 n$1.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 n$1.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||c)};static \u0275cmp=JD({type:c,selectors:[["widget-racetimer"]],viewQuery:function(t,i){t&1&&eg(i.canvasRef,D,5),t&2&&Kw();},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&&(Pi(0,"div",1),$h(1,"canvas",2,0),Pi(3,"div",3)(4,"div",4)(5,"button",5),Qh("click",function(){return i.removeTime(5)}),Pi(6,"mat-icon",6),wd(),Pi(7,"svg",7)(8,"text",8),TT(9,"-5s"),ul()()()(),Td(),Pi(10,"button",5),Qh("click",function(){return i.removeTime(60)}),Pi(11,"mat-icon",6),wd(),Pi(12,"svg",7)(13,"text",8),TT(14,"-60s"),ul()()()(),Td(),Pi(15,"button",9),Qh("click",function(){return i.resetTimer()}),Pi(16,"mat-icon",6),wd(),Pi(17,"svg",7)(18,"text",8),TT(19,"Reset"),ul()()()(),Td(),Pi(20,"button",5),Qh("click",function(){return i.addTime(60)}),Pi(21,"mat-icon",6),wd(),Pi(22,"svg",7)(23,"text",8),TT(24,"+60s"),ul()()()(),Td(),Pi(25,"button",5),Qh("click",function(){return i.addTime(5)}),Pi(26,"mat-icon",6),wd(),Pi(27,"svg",7)(28,"text",8),TT(29,"+5s"),ul()()()()(),Td(),Pi(30,"div",10),_w(31,B,2,0,"button",11),_w(32,G,2,0,"button",12),Pi(33,"button",13),Qh("click",function(){return i.roundToMin()}),TT(34," Synch "),ul()()()()),t&2&&(EE(31),Mw(i.timerRunning()?-1:31),EE(),Mw(i.timerRunning()?32:-1));},dependencies:[Op,xp,yt,wt],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 c})();export{et as WidgetRaceTimerComponent};
@@ -0,0 +1 @@
1
+ import {d1 as Hj,w,a as G,G as Gi,J as JD,bh as xp,bP as si,P as Pi,_ as _w,u as ul,e as EE,M as Mw,T as TT,h as Fw,c as $h,k as Qh,l as ud,g as qw,m as dd}from'./main-BAV5VDOD.js';function y(n,k){if(n&1){let r=Fw();Pi(0,"h3"),TT(1,"Getting Started"),ul(),Pi(2,"p"),TT(3,"Welcome to KIP! Here are some basic gestures to help you navigate the application. Access the "),Pi(4,"a",1),TT(5,"KIP Help"),ul(),TT(6," documentation to learn more about KIP."),ul(),Pi(7,"table",2)(8,"thead")(9,"tr")(10,"th"),TT(11,"Actions"),ul(),Pi(12,"th"),TT(13,"Touch"),ul(),Pi(14,"th"),TT(15,"Mouse"),ul(),Pi(16,"th"),TT(17,"Keyboard Shortcuts"),ul()()(),Pi(18,"tbody")(19,"tr")(20,"td"),TT(21,"Open Actions menu"),ul(),Pi(22,"td"),TT(23,"Swipe left"),ul(),Pi(24,"td"),TT(25,"Click, drag left, and release"),ul(),Pi(26,"td")(27,"kbd"),TT(28,"Shift"),ul(),TT(29," + "),Pi(30,"kbd"),TT(31,"Ctrl"),ul(),TT(32," + "),Pi(33,"kbd",3),TT(34,"\u2190"),ul(),TT(35," (Left Arrow)"),ul()(),Pi(36,"tr")(37,"td"),TT(38,"Open Notification menu"),ul(),Pi(39,"td"),TT(40,"Swipe right"),ul(),Pi(41,"td"),TT(42,"Click, drag right, and release"),ul(),Pi(43,"td")(44,"kbd"),TT(45,"Shift"),ul(),TT(46," + "),Pi(47,"kbd"),TT(48,"Ctrl"),ul(),TT(49," + "),Pi(50,"kbd",3),TT(51,"\u2192"),ul(),TT(52," (Right Arrow)"),ul()(),Pi(53,"tr")(54,"td"),TT(55,"Cycle through dashboards"),ul(),Pi(56,"td"),TT(57,"Swipe up/down"),ul(),Pi(58,"td"),TT(59,"Click, drag up/down, and release"),ul(),Pi(60,"td")(61,"kbd"),TT(62,"Shift"),ul(),TT(63," + "),Pi(64,"kbd"),TT(65,"Ctrl"),ul(),TT(66," + "),Pi(67,"kbd",3),TT(68,"\u2191"),ul(),TT(69,"/"),Pi(70,"kbd",3),TT(71,"\u2193"),ul(),TT(72," (Up/Down Arrow)"),ul()(),Pi(73,"tr")(74,"td"),TT(75,"Toggle Fullscreen"),ul(),Pi(76,"td"),TT(77,"N/A"),ul(),Pi(78,"td"),TT(79,"N/A"),ul(),Pi(80,"td")(81,"kbd"),TT(82,"Shift"),ul(),TT(83," + "),Pi(84,"kbd"),TT(85,"Ctrl"),ul(),TT(86," + "),Pi(87,"kbd"),TT(88,"F"),ul()()(),Pi(89,"tr")(90,"td"),TT(91,"Toggle Night mode"),ul(),Pi(92,"td"),TT(93,"N/A"),ul(),Pi(94,"td"),TT(95,"N/A"),ul(),Pi(96,"td")(97,"kbd"),TT(98,"Shift"),ul(),TT(99," + "),Pi(100,"kbd"),TT(101,"Ctrl"),ul(),TT(102," + "),Pi(103,"kbd"),TT(104,"N"),ul()()(),Pi(105,"tr")(106,"td"),TT(107,"Toggle dashboard edit mode"),ul(),Pi(108,"td"),TT(109,"N/A"),ul(),Pi(110,"td"),TT(111,"N/A"),ul(),Pi(112,"td")(113,"kbd"),TT(114,"Shift"),ul(),TT(115," + "),Pi(116,"kbd"),TT(117,"Ctrl"),ul(),TT(118," + "),Pi(119,"kbd"),TT(120,"E"),ul()()()()(),Pi(121,"i"),TT(122,"Note that the words Touch and Tap are synonymous with mouse Click."),ul(),$h(123,"br")(124,"br"),Pi(125,"h3"),TT(126,"Login to Signal K"),ul(),Pi(127,"p"),TT(128," The first step is to configure Signal K server authentication ("),Pi(129,"i"),TT(130,"a pre-existing Signal K server username and password is required"),ul(),TT(131,"). Go to KIP's Connectivity options, toggle "),Pi(132,"strong"),TT(133,"Login to server"),ul(),TT(134,", enter your Signal K credentials and click "),Pi(135,"strong"),TT(136,"Sign in"),ul(),TT(137,". Once completed, click the upper right X button to get back to this dashboard ("),Pi(138,"a",4),TT(139,"Connectivity options"),ul(),TT(140,"). "),ul(),Pi(141,"ul")(142,"li"),TT(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. "),ul(),Pi(144,"li"),TT(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. "),ul()(),Pi(146,"h3"),TT(147,"Option 1: Load Demonstration Dashboards"),ul(),Pi(148,"p"),TT(149," Try the sample dashboards using data from your server: "),$h(150,"br"),Pi(151,"button",5),Qh("click",function(){ud(r);let l=qw();return dd(l.loadDemoConfig())}),TT(152,"Load Demo"),ul()(),Pi(153,"h3"),TT(154,"Option 2: Create Your Own Layout"),ul(),Pi(155,"p"),TT(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. '),ul(),Pi(157,"p")(158,"strong"),TT(159,"Try editing the Dashboard now to receive further instructions!"),ul()();}}function v(n,k){n&1&&(Pi(0,"h2"),TT(1,"Changing Layouts"),ul(),TT(2," Follow these simple steps to learn how to change your dashboard layout: "),Pi(3,"ol")(4,"li"),TT(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."),ul(),Pi(6,"li"),TT(7,"Touch & Hold or Click & Hold in an empty area to open the Add Widget selection panel."),ul(),Pi(8,"li"),TT(9,"Choose a widget from the selection panel to add it to the dashboard."),ul()(),Pi(10,"h3"),TT(11,"Possible widget operations"),ul(),Pi(12,"ul")(13,"li")(14,"strong"),TT(15,"Touch and drag"),ul(),TT(16," to move widgets"),ul(),Pi(17,"li")(18,"strong"),TT(19,"Drag corners and sides"),ul(),TT(20," to resize widgets"),ul(),Pi(21,"li")(22,"strong"),TT(23,"Double Tap"),ul(),TT(24," on a widget to configure it"),ul(),Pi(25,"li")(26,"strong"),TT(27,"Press and Hold"),ul(),TT(28," on a widget to delete or duplicate widgets"),ul()(),Pi(29,"h2"),TT(30,"Exiting dashboard edit mode"),ul(),Pi(31,"p"),TT(32,"Use the Save or Cancel buttons in the lower right corner to either persist your changes or revert changes."),ul(),Pi(33,"h2"),TT(34,"Adding more dashboards"),ul(),Pi(35,"p"),TT(36,"Swipe left and hit the Dashboards button. From this page you can add, rename, order, delete, and duplicate entire dashboards."),ul());}var N=(()=>{class n{id=Hj.required();type=Hj.required();theme=Hj.required();static DEFAULT_CONFIG={filterSelfPaths:true};dashboard=w(G);settings=w(Gi);loadDemoConfig(){this.settings.loadDemoConfig();}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=JD({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(o,l){o&1&&(Pi(0,"div",0),_w(1,y,160,0)(2,v,37,0),ul()),o&2&&(EE(),Mw(l.dashboard.isDashboardStatic()?1:2));},dependencies:[xp,si],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)}"]})}return n})();export{N as WidgetTutorialComponent};
@@ -0,0 +1 @@
1
+ import {p as p$1}from'./chunk-CaD3zVfK.js';import {G as Gt,L as Lt}from'./chunk-BQr-tSkv.js';import {u}from'./chunk-hd2_AKwt.js';import {k}from'./chunk-BwOIef42.js';import {d1 as Hj,w,du as p,dv as rt,dD as _,bu as ut,$ as $j,a6 as Lr,v as vt,D as Dt,F as Fa,dn as ge,J as JD,_ as _w,M as Mw,f as eg,K as Kw,h as Fw,P as Pi,k as Qh,u as ul,g as qw,B as Bh,an as Hh,l as ud,m as dd,dx as n$1}from'./main-BAV5VDOD.js';import {c}from'./chunk-Dxlia2NE.js';var L=["radialGauge"];function F(n,q){if(n&1){let t=Fw();Pi(0,"radial-gauge",2,0),Qh("resizeChange",function(a){ud(t);let e=qw();return dd(e.onResized(a))}),ul();}if(n&2){let t=qw();Bh("options",t.gaugeOptions)("value",t.displayValue()),Hh("value-text",t.textValue());}}var ne=(()=>{class n{id=Hj.required();type=Hj.required();theme=Hj.required();runtime=w(p);streams=w(rt);metadata=w(_);unitsService=w(ut);static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:true,displayName:"Gauge Label",filterSelfPaths:true,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",suppressBootstrapNull:true,isPathConfigurable:true,showPathSkUnitsFilter:true,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:true,enableProgressbar:true,enableNeedle:true},numInt:1,numDecimal:0,enableTimeout:false,color:"contrast",dataTimeout:5,ignoreZones:false};LINE="line";ANIMATION_TARGET_NEEDLE="needle";ngGauge=$j("radialGauge");gauge=$j("radialGauge",{read:Lr});value=vt(void 0);displayValue=Dt(()=>this.value()??0);shouldRenderGauge=Dt(()=>this.value()!==void 0);textValue=vt("--");colorStrokeTicks=vt("");gaugeBootstrapped=vt(false);animationEnabled=Dt(()=>this.gaugeBootstrapped());normalizedConfig=Dt(()=>this.runtime.options()??n.DEFAULT_CONFIG);gaugePathConfig=Dt(()=>this.normalizedConfig().paths?.gaugePath);adjustedScale=Dt(()=>{let t=this.normalizedConfig();return t.gauge?.subType==="capacity"?{min:t.displayScale?.lower??0,max:t.displayScale?.upper??100,majorTicks:[]}:p$1(t.displayScale?.lower??0,t.displayScale?.upper??100,t.gauge?.barStartPosition==="right")});highlights=Dt(()=>{let t=this.metadata.zones(),i=this.normalizedConfig(),a=this.theme(),e=this.gaugePathConfig();if(!t?.length)return [];if(!a)return [];if(i.ignoreZones)return [];if(i.gauge?.subType!=="measuring")return [];if(!e)return [];let o=this.adjustedScale(),r=i.gauge?.barStartPosition==="right";return k(t,a,e.convertUnitTo??"",this.unitsService,o.min,o.max,r)});displayName=Dt(()=>this.normalizedConfig().displayName??"Gauge Label");pathDataState=vt(null);viewReady=vt(false);gaugeOptions={};constructor(){Fa(()=>{let t=this.normalizedConfig(),i=this.theme(),a=this.gaugePathConfig();!i||!a?.path||ge(()=>this.streams.observe("gaugePath",e=>{e.state!==this.pathDataState()&&this.pathDataState.set(e.state||null);let o=e?.data?.value??null;if(o==null)this.value.set(t.displayScale?.lower??0),this.textValue.set("--");else {let r=t.displayScale?.lower??0,h=t.displayScale?.upper??100,f=Math.min(Math.max(o,r),h);this.value.set(f),this.textValue()==="--"&&this.textValue.set("");}}));}),Fa(()=>{this.normalizedConfig().ignoreZones||ge(()=>this.metadata.observe("gaugePath"));}),Fa(()=>{let t=this.highlights();this.viewReady()&&ge(()=>{try{if(!t.length)this.ngGauge()?.update({highlights:[]});else {let i=JSON.stringify(t);this.ngGauge()?.update({highlights:i,highlightsWidth:this.normalizedConfig().gauge?.highlightsWidth});}}catch(i){}});}),Fa(()=>{let t=this.normalizedConfig(),i=this.theme(),a=this.adjustedScale();i&&ge(()=>{if(this.buildGaugeOptions(t,i,a),this.viewReady())try{this.ngGauge()?.update(this.gaugeOptions);}catch(e){}});}),Fa(()=>{let t=this.ngGauge();!t||this.gaugeBootstrapped()||ge(()=>{try{requestAnimationFrame(()=>{this.gaugeBootstrapped.set(!0);try{t.update({animation:!0,animatedValue:!0});}catch(i){}});}catch(i){}});}),Fa(()=>{let t=this.pathDataState();this.viewReady()&&ge(()=>{let i=this.normalizedConfig(),a=this.theme();if(!a||i.ignoreZones)return;let e={},o=c(i.color??"contrast",a);switch(t){case n$1.Alarm:e.colorBorderMiddle=a.cardColor,e.colorBarProgress=a.zoneAlarm,e.colorValueText=a.zoneAlarm;break;case n$1.Warn:e.colorBorderMiddle=a.cardColor,e.colorBarProgress=a.zoneWarn,e.colorValueText=a.zoneWarn;break;case n$1.Alert:e.colorBorderMiddle=a.cardColor,e.colorBarProgress=a.zoneAlert,e.colorValueText=a.zoneAlert;break;default:e.colorBorderMiddle=a.cardColor,e.colorBarProgress=i.gauge?.subType==="measuring"?o.color:o.dim,e.colorValueText=o.color;}try{this.ngGauge()?.update(e);}catch(r){}});});}ngAfterViewInit(){this.viewReady.set(true),this.setCanvasSize();try{this.ngGauge()?.update(this.gaugeOptions);}catch(t){}}onResized(t){let i={height:t.contentRect.height,width:t.contentRect.width};try{this.ngGauge()?.update(i);}catch(a){}}setCanvasSize(){let t=this.gauge()?.nativeElement;if(!t)return;let i=t.getBoundingClientRect(),a={height:i.height,width:i.width};try{this.ngGauge()?.update(a);}catch(e){}}buildGaugeOptions(t,i,a){let e={},o=this.gaugePathConfig(),r=t.gauge??n.DEFAULT_CONFIG.gauge;e.title=this.displayName(),e.minValue=a.min,e.maxValue=a.max,e.units=o?.convertUnitTo??"",e.highlights=[];let h=this.highlights();h.length&&(e.highlights=JSON.stringify(h),e.highlightsWidth=t.gauge?.highlightsWidth),e.fontTitle="Roboto",e.fontTitleWeight="bold",e.fontUnits="Roboto",e.fontUnitsSize=25,e.fontUnitsWeight="normal",e.barStrokeWidth=0,e.barShadow=0,e.colorBarStroke="",e.fontValue="Roboto",e.fontValueWeight="bold",e.valueTextShadow=false,e.colorValueBoxShadow="",e.fontNumbers="Roboto",e.fontNumbersWeight="bold",e.valueInt=t.numInt??1,e.valueDec=t.numDecimal??2,e.majorTicksInt=e.valueInt,e.majorTicksDec=e.valueDec,e.highlightsWidth=t.gauge?.highlightsWidth,e.animation=this.animationEnabled(),e.animateOnInit=false,e.animatedValue=this.animationEnabled(),e.animationRule="linear";let f=o?.sampleTime??500;e.animationDuration=f-25,e.colorBorderShadow=false,e.colorBorderOuter=i.cardColor,e.colorBorderOuterEnd="",e.colorBorderMiddle=i.cardColor,e.colorBorderMiddleEnd="",e.colorPlate=e.colorPlateEnd=i.cardColor,e.colorBar=i.background;let g=c(t.color??"contrast",i);e.barProgress=t.gauge?.enableProgressbar,e.colorBarProgress=g.color,e.colorNeedle=g.color,e.colorNeedleEnd=g.color,e.needleShadow=true,e.colorNeedleShadowUp="black",e.colorNeedleShadowDown="black",e.colorNeedleCircleInner=e.colorPlate,e.colorNeedleCircleInnerEnd=e.colorPlate,e.colorNeedleCircleOuter=e.colorPlate,e.colorNeedleCircleOuterEnd=e.colorPlate,e.colorTitle=i.contrastDim,e.colorUnits=i.contrastDim,e.colorValueText=g.color,this.colorStrokeTicks.set(i.contrastDim),e.colorMinorTicks=i.contrastDim,e.animationTarget=this.ANIMATION_TARGET_NEEDLE,e.useMinPath=false,r.subType==="capacity"?(e.fontTitleSize=40,e.valueBox=true,e.fontValueSize=60,e.valueBoxWidth=10,e.valueBoxBorderRadius=5,e.valueBoxStroke=0,e.colorValueBoxBackground="",e.colorMajorTicks=e.colorPlate,e.colorNumbers=e.colorMinorTicks="",e.barWidth=20,e.colorBarProgress=g.dim,e.needle=r.enableNeedle,e.needleType=this.LINE,e.needleWidth=2,e.needleStart=75,e.needleEnd=95,e.needleCircleSize=1,e.needleCircleInner=false,e.needleCircleOuter=false,e.ticksAngle=360,e.startAngle=r.scaleStart||180,e.majorTicks=0,e.exactTicks=true,e.strokeTicks=false,e.minorTicks=0,e.numbersMargin=0,e.fontNumbersSize=0,e.borders=true,e.borderOuterWidth=2,e.borderMiddleWidth=1,e.borderInnerWidth=0,e.borderShadowWidth=0):(e.fontTitleSize=24,e.barWidth=15,e.valueBox=true,e.fontValueSize=60,e.valueBoxWidth=100,e.valueBoxBorderRadius=0,e.valueBoxStroke=0,e.colorValueBoxBackground="",e.needle=r.enableNeedle,e.needleType=this.LINE,e.needleWidth=2,e.needleStart=0,e.needleEnd=95,e.needleCircleSize=10,e.needleCircleInner=false,e.needleCircleOuter=false,e.ticksAngle=270,e.startAngle=45,e.barStartPosition=r.barStartPosition||"left",r.enableTicks?(e.strokeTicks=true,e.majorTicks=a.majorTicks,e.minorTicks=2,e.exactTicks=false,e.numbersMargin=3,e.fontNumbersSize=15,e.colorMajorTicks=i.contrastDim,e.colorNumbers=i.contrastDim):(e.strokeTicks=false,e.majorTicks=0,e.minorTicks=0,e.exactTicks=true,e.numbersMargin=0,e.fontNumbersSize=0,e.colorMajorTicks=e.colorPlate,e.colorNumbers=e.colorMinorTicks=""),e.borders=true,e.borderOuterWidth=2,e.borderMiddleWidth=1,e.borderInnerWidth=0,e.borderShadowWidth=0,e.animationTarget=this.ANIMATION_TARGET_NEEDLE,e.useMinPath=false),this.gaugeOptions=e;}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=JD({type:n,selectors:[["widget-gauge-ng-radial"]],viewQuery:function(i,a){i&1&&eg(a.ngGauge,L,5)(a.gauge,L,5,Lr),i&2&&Kw(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(i,a){i&1&&_w(0,F,2,3,"radial-gauge",1),i&2&&Mw(a.shouldRenderGauge()?0:-1);},dependencies:[u,Gt,Lt],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})();export{ne as WidgetGaugeNgRadialComponent};
@@ -0,0 +1 @@
1
+ import {e as e$1}from'./chunk-B6bEhzNR.js';import {g as ge$1}from'./chunk-TakPRI3t.js';import {e9 as a,d1 as Hj,w,du as p,aS as De,bu as ut,ea as K,aY as xe,$ as $j,v as vt,D as Dt,dx as n$1,F as Fa,dn as ge,a_ as Gp,av as _t,cv as G,J as JD,y as yt,dC as x,_ as _w,cn as wd,c as $h,M as Mw,e as EE,s as sg,f as eg,K as Kw,g as qw,B as Bh,P as Pi,T as TT,u as ul}from'./main-BAV5VDOD.js';import {c,e}from'./chunk-Dxlia2NE.js';function H(i){return function(){return i}}var Mt=Math.abs,_=Math.atan2,z=Math.cos,qt=Math.max,rt=Math.min,$=Math.sin,W=Math.sqrt,S=1e-12,Z=Math.PI,tt=Z/2,Xt=2*Z;function jt(i){return i>1?0:i<-1?Z:Math.acos(i)}function Tt(i){return i>=1?tt:i<=-1?-tt:Math.asin(i)}var Ct=Math.PI,At=2*Ct,L=1e-6,ae=At-L;function Zt(i){this._+=i[0];for(let t=1,a=i.length;t<a;++t)this._+=arguments[t]+i[t];}function re(i){let t=Math.floor(i);if(!(t>=0))throw new Error(`invalid digits: ${i}`);if(t>15)return Zt;let a=10**t;return function(r){this._+=r[0];for(let e=1,n=r.length;e<n;++e)this._+=Math.round(arguments[e]*a)/a+r[e];}}var F=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Zt:re(t);}moveTo(t,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+a}`;}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`);}lineTo(t,a){this._append`L${this._x1=+t},${this._y1=+a}`;}quadraticCurveTo(t,a,r,e){this._append`Q${+t},${+a},${this._x1=+r},${this._y1=+e}`;}bezierCurveTo(t,a,r,e,n,o){this._append`C${+t},${+a},${+r},${+e},${this._x1=+n},${this._y1=+o}`;}arcTo(t,a,r,e,n){if(t=+t,a=+a,r=+r,e=+e,n=+n,n<0)throw new Error(`negative radius: ${n}`);let o=this._x1,l=this._y1,m=r-t,d=e-a,s=o-t,g=l-a,c=s*s+g*g;if(this._x1===null)this._append`M${this._x1=t},${this._y1=a}`;else if(c>L)if(!(Math.abs(g*m-d*s)>L)||!n)this._append`L${this._x1=t},${this._y1=a}`;else {let y=r-o,v=e-l,k=m*m+d*d,R=y*y+v*v,x=Math.sqrt(k),h=Math.sqrt(c),M=n*Math.tan((Ct-Math.acos((k+c-R)/(2*x*h)))/2),T=M/h,f=M/x;Math.abs(T-1)>L&&this._append`L${t+T*s},${a+T*g}`,this._append`A${n},${n},0,0,${+(g*y>s*v)},${this._x1=t+f*m},${this._y1=a+f*d}`;}}arc(t,a,r,e,n,o){if(t=+t,a=+a,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(e),m=r*Math.sin(e),d=t+l,s=a+m,g=1^o,c=o?e-n:n-e;this._x1===null?this._append`M${d},${s}`:(Math.abs(this._x1-d)>L||Math.abs(this._y1-s)>L)&&this._append`L${d},${s}`,r&&(c<0&&(c=c%At+At),c>ae?this._append`A${r},${r},0,1,${g},${t-l},${a-m}A${r},${r},0,1,${g},${this._x1=d},${this._y1=s}`:c>L&&this._append`A${r},${r},0,${+(c>=Ct)},${g},${this._x1=t+r*Math.cos(n)},${this._y1=a+r*Math.sin(n)}`);}rect(t,a,r,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+a}h${r=+r}v${+e}h${-r}Z`;}toString(){return this._}};function Jt(i){let t=3;return i.digits=function(a){if(!arguments.length)return t;if(a==null)t=null;else {let r=Math.floor(a);if(!(r>=0))throw new RangeError(`invalid digits: ${a}`);t=r;}return i},()=>new F(t)}function ne(i){return i.innerRadius}function ie(i){return i.outerRadius}function se(i){return i.startAngle}function oe(i){return i.endAngle}function le(i){return i&&i.padAngle}function ce(i,t,a,r,e,n,o,l){var m=a-i,d=r-t,s=o-e,g=l-n,c=g*m-s*d;if(!(c*c<S))return c=(s*(t-n)-g*(i-e))/c,[i+c*m,t+c*d]}function nt(i,t,a,r,e,n,o){var l=i-a,m=t-r,d=(o?n:-n)/W(l*l+m*m),s=d*m,g=-d*l,c=i+s,y=t+g,v=a+s,k=r+g,R=(c+v)/2,x=(y+k)/2,h=v-c,M=k-y,T=h*h+M*M,f=e-n,u=c*k-v*y,N=(M<0?-1:1)*W(qt(0,f*f*T-u*u)),w=(u*M-h*N)/T,E=(-u*h-M*N)/T,B=(u*M+h*N)/T,C=(-u*h+M*N)/T,I=w-R,p=E-x,b=B-R,O=C-x;return I*I+p*p>b*b+O*O&&(w=B,E=C),{cx:w,cy:E,x01:-s,y01:-g,x11:w*(e/f-1),y11:E*(e/f-1)}}function Bt(){var i=ne,t=ie,a=H(0),r=null,e=se,n=oe,o=le,l=null,m=Jt(d);function d(){var s,g,c=+i.apply(this,arguments),y=+t.apply(this,arguments),v=e.apply(this,arguments)-tt,k=n.apply(this,arguments)-tt,R=Mt(k-v),x=k>v;if(l||(l=s=m()),y<c&&(g=y,y=c,c=g),!(y>S))l.moveTo(0,0);else if(R>Xt-S)l.moveTo(y*z(v),y*$(v)),l.arc(0,0,y,v,k,!x),c>S&&(l.moveTo(c*z(k),c*$(k)),l.arc(0,0,c,k,v,x));else {var h=v,M=k,T=v,f=k,u=R,N=R,w=o.apply(this,arguments)/2,E=w>S&&(r?+r.apply(this,arguments):W(c*c+y*y)),B=rt(Mt(y-c)/2,+a.apply(this,arguments)),C=B,I=B,p,b;if(E>S){var O=Tt(E/c*$(w)),U=Tt(E/y*$(w));(u-=O*2)>S?(O*=x?1:-1,T+=O,f-=O):(u=0,T=f=(v+k)/2),(N-=U*2)>S?(U*=x?1:-1,h+=U,M-=U):(N=0,h=M=(v+k)/2);}var A=y*z(h),P=y*$(h),K=c*z(f),V=c*$(f);if(B>S){var Y=y*z(M),q=y*$(M),it=c*z(T),st=c*$(T),G;if(R<Z)if(G=ce(A,P,it,st,Y,q,K,V)){var ot=A-G[0],lt=P-G[1],ct=Y-G[0],dt=q-G[1],_t=1/$(jt((ot*ct+lt*dt)/(W(ot*ot+lt*lt)*W(ct*ct+dt*dt)))/2),Rt=W(G[0]*G[0]+G[1]*G[1]);C=rt(B,(c-Rt)/(_t-1)),I=rt(B,(y-Rt)/(_t+1));}else C=I=0;}N>S?I>S?(p=nt(it,st,A,P,y,I,x),b=nt(Y,q,K,V,y,I,x),l.moveTo(p.cx+p.x01,p.cy+p.y01),I<B?l.arc(p.cx,p.cy,I,_(p.y01,p.x01),_(b.y01,b.x01),!x):(l.arc(p.cx,p.cy,I,_(p.y01,p.x01),_(p.y11,p.x11),!x),l.arc(0,0,y,_(p.cy+p.y11,p.cx+p.x11),_(b.cy+b.y11,b.cx+b.x11),!x),l.arc(b.cx,b.cy,I,_(b.y11,b.x11),_(b.y01,b.x01),!x))):(l.moveTo(A,P),l.arc(0,0,y,h,M,!x)):l.moveTo(A,P),!(c>S)||!(u>S)?l.lineTo(K,V):C>S?(p=nt(K,V,Y,q,c,-C,x),b=nt(A,P,it,st,c,-C,x),l.lineTo(p.cx+p.x01,p.cy+p.y01),C<B?l.arc(p.cx,p.cy,C,_(p.y01,p.x01),_(b.y01,b.x01),!x):(l.arc(p.cx,p.cy,C,_(p.y01,p.x01),_(p.y11,p.x11),!x),l.arc(0,0,c,_(p.cy+p.y11,p.cx+p.x11),_(b.cy+b.y11,b.cx+b.x11),x),l.arc(b.cx,b.cy,C,_(b.y11,b.x11),_(b.y01,b.x01),!x))):l.arc(0,0,c,f,T,x);}if(l.closePath(),s)return l=null,s+""||null}return d.centroid=function(){var s=(+i.apply(this,arguments)+ +t.apply(this,arguments))/2,g=(+e.apply(this,arguments)+ +n.apply(this,arguments))/2-Z/2;return [z(g)*s,$(g)*s]},d.innerRadius=function(s){return arguments.length?(i=typeof s=="function"?s:H(+s),d):i},d.outerRadius=function(s){return arguments.length?(t=typeof s=="function"?s:H(+s),d):t},d.cornerRadius=function(s){return arguments.length?(a=typeof s=="function"?s:H(+s),d):a},d.padRadius=function(s){return arguments.length?(r=s==null?null:typeof s=="function"?s:H(+s),d):r},d.startAngle=function(s){return arguments.length?(e=typeof s=="function"?s:H(+s),d):e},d.endAngle=function(s){return arguments.length?(n=typeof s=="function"?s:H(+s),d):n},d.padAngle=function(s){return arguments.length?(o=typeof s=="function"?s:H(+s),d):o},d.context=function(s){return arguments.length?(l=s??null,d):l},d}var ue=["bmsSvg"];function pe(i,t){if(i&1&&$h(0,"widget-title",1),i&2){let a=qw();Bh("text",a.displayLabel())("color",a.labelColor());}}function me(i,t){i&1&&(Pi(0,"div",3)(1,"div",4),TT(2,"No batteries detected"),ul(),Pi(3,"div",5),TT(4,"Check Signal K battery paths or select batteries in widget settings."),ul()());}var ee=class i{static BMS_DESCRIPTOR=a("widget-bms");static ROOT_PATTERN=`${i.BMS_DESCRIPTOR?.selfRootPath??"self.electrical.batteries"}.*`;id=Hj.required();type=Hj.required();theme=Hj.required();renderMode=Hj(null);static DEFAULT_CONFIG={color:"contrast",ignoreZones:false,bms:{trackedDevices:[],groups:[],banks:[]}};static VIEWBOX_WIDTH=200;static MIN_VIEWBOX_HEIGHT=1;static BANK_CARD_WIDTH=200;static BATTERY_CARD_HEIGHT=50;static BATTERY_CARD_WIDTH=200;static CARD_GAP=8;static BANK_HEADER_HEIGHT=80;static BANK_MIN_HEIGHT=75;static SINGLE_ROW_BANK_HEIGHT=100;static IN_BANK_COLUMNS=2;static IN_BANK_COLUMN_GAP=5;static IN_BANK_PADDING_X=0;static BANK_GAUGE_RADIUS=50;static BANK_GAUGE_BG_STROKE=10;static BANK_GAUGE_VALUE_STROKE=10;static COMPACT_UNASSIGNED_BATTERY_SCALE=.82;static PATH_BATCH_WINDOW_MS=500;runtime=w(p);data=w(De);units=w(ut);iconRegistry=w(K);destroyRef=w(xe);svgRef=$j.required("bmsSvg");svg;root;bankLayer;batteryLayer;bankGaugeBackgroundPath=this.buildSemiGaugeArcPath(i.BANK_GAUGE_RADIUS,1);glowFilterId="";renderFrameId=null;pendingRenderSnapshot=null;pathBatchTimerId=null;initialPathPaintDone=false;pendingPathUpdates=new Map;powerAvailableIconTemplate=null;powerRenewalIconTemplate=null;discoveredBatteryIds=vt([]);trackedBatteryDeviceIds=vt([]);banks=vt([]);cardMode=vt({displayMode:"full",metrics:[]});batteries=vt({});visibleBatteryIds=Dt(()=>{let t=this.trackedBatteryDeviceIds();return t.length?t:this.discoveredBatteryIds()});visibleBatteries=Dt(()=>{let t=this.visibleBatteryIds(),a=this.batteries();return t.map(r=>a[r]).filter(r=>!!r)});bankSummaries=Dt(()=>{let t=this.banks(),a=this.batteries();return t.map(r=>this.buildBankSummary(r,a))});activeDisplayMode=Dt(()=>this.renderMode()??this.cardMode().displayMode??"full");isCompactCardMode=Dt(()=>this.activeDisplayMode()==="compact");colorRole=Dt(()=>this.runtime.options()?.color??"contrast");ignoreZones=Dt(()=>this.runtime.options()?.ignoreZones??false);displayLabel=Dt(()=>{let t=this.bankSummaries();if(t.length===1)return t[0].name||"Bank";if(t.length>1)return "Batteries";let a=this.visibleBatteries();return a.length!==1?"Batteries":this.resolveBatteryTitleText(a[0])});labelColor=Dt(()=>{let t=this.theme();return t?c(this.colorRole(),t).dim:"var(--kip-contrast-dim-color)"});widgetColors=Dt(()=>{let t=this.theme();return t?c(this.colorRole(),t):null});batteryDisplayModels=Dt(()=>{let t=this.visibleBatteries(),a=this.theme(),r=this.widgetColors(),e$1=this.ignoreZones(),n={};for(let o of t){let l=e(o.stateOfChargeState,r?.dimmer??"var(--kip-contrast-dimmer-color)",a,e$1),m=e(o.stateOfChargeState,r?.dim??"var(--kip-contrast-dim-color)",a,e$1),d=e(o.currentState,"var(--kip-contrast-dim-color)",a,e$1),s=e(o.currentState,"var(--kip-contrast-color)",a,e$1);n[o.id]={id:o.id,titleText:this.resolveBatteryTitleText(o),chargeWidth:(i.BATTERY_CARD_WIDTH-3)*(o.stateOfCharge??0),chargeBarColorCompact:l,chargeBarColorRegular:m,currentTextColorCompact:d,currentTextColorRegular:s,currentText:`${this.formatCurrent(o.current)}`.trim(),detailLineCompact:`${this.formatVoltage(o.voltage)}\xA0\xA0\xA0\xA0${this.formatTemperature(o.temperature)}`,detailLineRegular:`${this.formatVoltage(o.voltage)}\xA0\xA0\xA0\xA0${this.formatPower(o.power)}\xA0\xA0\xA0\xA0${this.formatTemperature(o.temperature)}`.trim(),socText:this.formatSoc(o.stateOfCharge),socGlowEnabled:!e$1&&(o.stateOfChargeState===n$1.Warn||o.stateOfChargeState===n$1.Alarm||o.stateOfChargeState===n$1.Alert),remainingCapacityText:o.capacityActual?`${this.formatEnergy(o.capacityRemaining)}`:"",remainingTimeText:`${this.formatDuration(o.timeRemaining)}`.trim(),iconKey:o.current!=null&&o.current>0?"power_renewal":"power_available"};}return n});bankDisplayModels=Dt(()=>{let t=this.bankSummaries(),a=this.widgetColors(),r={};for(let e of t)r[e.id]={id:e.id,titleText:e.name||"Bank",currentText:this.formatCurrent(e.totalCurrent),powerText:this.formatPower(e.totalPower),socText:this.formatSoc(e.avgSoc),remainingTimeText:`${this.formatDuration(e.timeRemaining)}`.trim(),remainingCapacityText:e.remainingCapacity?`${this.formatEnergy(e.remainingCapacity)}`:"",gaugeValuePath:this.buildSemiGaugeArcPath(i.BANK_GAUGE_RADIUS,e.avgSoc),gaugeValueColor:a?.color??"var(--kip-contrast-color)",zoneState:null,zoneColor:null};return r});hasBatteries=Dt(()=>this.visibleBatteries().length>0);hasBanks=Dt(()=>this.bankSummaries().length>0);constructor(){Fa(()=>{let a=this.runtime.options();a&&ge(()=>this.applyConfig(a));}),Fa(()=>{let a=this.bankSummaries(),r=this.visibleBatteries(),e=this.widgetColors(),n=this.batteryDisplayModels(),o=this.bankDisplayModels();!this.svg||!e||this.requestRender({banks:a,batteries:r,batteryDisplayModels:n,bankDisplayModels:o,widgetColors:e});});let t=this.data.subscribePathTreeWithInitial(i.ROOT_PATTERN);if(t.initial.length){for(let a of t.initial)this.enqueuePathUpdate(a,true);this.flushPendingPathUpdates(),this.initialPathPaintDone=true;}t.live$.pipe(Gp(this.destroyRef)).subscribe(a=>{this.enqueuePathUpdate(a);});}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=ge$1(this.svgRef().nativeElement),this.svg.attr("viewBox",`0 0 ${i.VIEWBOX_WIDTH} ${i.MIN_VIEWBOX_HEIGHT}`).attr("preserveAspectRatio","xMidYMid meet").attr("role","img").attr("aria-label","Battery Management System View"),this.glowFilterId=`bms-soc-glow-${this.id()}`;let a=this.svg.append("defs").append("filter").attr("id",this.glowFilterId).attr("x","-30%").attr("y","-30%").attr("width","160%").attr("height","160%");a.append("feFlood").attr("class","bms-soc-glow-flood").attr("flood-color","var(--kip-widget-card-background-color)").attr("flood-opacity",.9).attr("result","color"),a.append("feComposite").attr("in","color").attr("in2","SourceGraphic").attr("operator","in").attr("result","coloredGlow"),a.append("feGaussianBlur").attr("in","coloredGlow").attr("stdDeviation",2).attr("result","blur");let r=a.append("feMerge");r.append("feMergeNode").attr("in","blur"),r.append("feMergeNode").attr("in","blur"),r.append("feMergeNode").attr("in","SourceGraphic"),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",t=>{this.powerAvailableIconTemplate=t;}),this.loadNamedIcon("power_renewal",t=>{this.powerRenewalIconTemplate=t;});}loadNamedIcon(t,a){this.iconRegistry.getNamedSvgIcon(t).pipe(_t(1)).subscribe({next:r=>{a(r),this.requestRender();},error:()=>{}});}applyConfig(t){let a=this.resolveBmsConfig(t);this.trackedBatteryDeviceIds.set([...new Set((a.trackedDevices??[]).map(r=>r.id))]),this.banks.set(a.banks),this.cardMode.set(this.normalizeCardMode(a.cardMode));}resolveBmsConfig(t){let a=t.bms,r=this.normalizeTrackedDevices(a?.trackedDevices),e=this.normalizeBanksFromGroups(a?.groups),n=this.normalizeBanksFromLegacy(a?.banks);return {trackedDevices:r,groups:e,banks:e.length>0?e:n,cardMode:this.normalizeCardMode(a?.cardMode)}}normalizeTrackedDevices(t){if(!Array.isArray(t))return [];let a=new Map;return t.forEach(r=>{if(!r||typeof r!="object")return;let e=r,n=typeof e.id=="string"?e.id.trim():"",o=typeof e.source=="string"?e.source.trim():"default";if(!n||!o)return;let l=typeof e.key=="string"&&e.key.trim().length>0?e.key.trim():`${n}||${o}`;a.set(l,{id:n,source:o,key:l});}),[...a.values()].sort((r,e)=>r.key.localeCompare(e.key))}normalizeCardMode(t){let a=t&&typeof t=="object"?t:null,r=this.normalizeStringList(a?.metrics);return {displayMode:a?.displayMode==="compact"?"compact":"full",metrics:r}}normalizeStringList(t){if(!Array.isArray(t))return [];let a=new Set;return t.forEach(r=>{if(typeof r!="string")return;let e=r.trim();e.length>0&&a.add(e);}),[...a].sort((r,e)=>r.localeCompare(e))}normalizeBanksFromGroups(t){return Array.isArray(t)?t.map(a=>{let r=this.normalizeOptionalString(a?.id)??`bank-${Date.now()}`,e=this.normalizeOptionalString(a?.name)??r,n=this.normalizeStringList(a?.memberIds);return {id:r,name:e,batteryIds:n,connectionMode:this.normalizeConnectionMode(a?.connectionMode)}}).filter(a=>a.id.length>0):[]}normalizeBanksFromLegacy(t){return Array.isArray(t)?t.map(a=>{let r=this.normalizeOptionalString(a?.id)??`bank-${Date.now()}`,e=this.normalizeOptionalString(a?.name)??r,n=this.normalizeStringList(a?.batteryIds);return {id:r,name:e,batteryIds:n,connectionMode:this.normalizeConnectionMode(a?.connectionMode)}}).filter(a=>a.id.length>0):[]}normalizeOptionalString(t){if(typeof t!="string")return null;let a=t.trim();return a.length>0?a:null}normalizeConnectionMode(t){return t==="series"?"series":"parallel"}enqueuePathUpdate(t,a=false){let r=this.parseBatteryPath(t.path);if(!r)return;let{id:e,key:n}=r,o=t.update?.data?.value??null,l=t.update?.state??null,m=`${e}::${n}`;if(this.pendingPathUpdates.set(m,{id:e,key:n,value:o,state:l}),!a){if(!this.initialPathPaintDone){this.initialPathPaintDone=true,this.flushPendingPathUpdates();return}this.pathBatchTimerId===null&&(this.pathBatchTimerId=window.setTimeout(()=>{this.pathBatchTimerId=null,this.flushPendingPathUpdates();},i.PATH_BATCH_WINDOW_MS));}}flushPendingPathUpdates(){if(!this.pendingPathUpdates.size)return;let t=Array.from(this.pendingPathUpdates.values());this.pendingPathUpdates.clear(),new Set(t.map(r=>r.id)).forEach(r=>this.trackDiscoveredBattery(r)),this.batteries.update(r=>{let e=r,n=false;for(let o of t){let l=e[o.id]??{id:o.id},m=G({},l),d=this.applyBatteryValue(m,o.key,o.value,o.state),s=false;if(m.voltage!=null&&m.current!=null){let g=Number.isFinite(m.voltage)&&Number.isFinite(m.current)?m.voltage*m.current:null;Object.is(m.power,g)||(m.power=g,s=true);}!d&&!s||(n||(e=G({},e),n=true),e[o.id]=m);}return n?e:r});}parseBatteryPath(t){let a=t.match(/self\.electrical\.batteries\.([^.]+)\.(.+)$/);return a?{id:a[1],key:a[2]}:null}trackDiscoveredBattery(t){let a=this.discoveredBatteryIds();if(a.includes(t))return;let r=[...a,t].sort();this.discoveredBatteryIds.set(r);}applyBatteryValue(t,a,r,e){switch(a){case "name":{let n=r;return t.name===n?false:(t.name=n,true)}case "location":{let n=r;return t.location===n?false:(t.location=n,true)}case "associatedBus":{let n=r;return t.associatedBus===n?false:(t.associatedBus=n,true)}case "chemistry":{let n=r;return t.chemistry===n?false:(t.chemistry=n,true)}case "voltage":{let n=this.toNumber(r);return Object.is(t.voltage,n)?false:(t.voltage=n,true)}case "current":{let n=this.toNumber(r),o=!Object.is(t.currentState??null,e??null);return Object.is(t.current,n)&&!o?false:(t.current=n,t.currentState=e,true)}case "temperature":{let n=this.toNumber(r);return Object.is(t.temperature,n)?false:(t.temperature=n,true)}case "capacity.nominal":{let n=this.toNumber(r);return Object.is(t.capacityNominal,n)?false:(t.capacityNominal=n,true)}case "capacity.actual":{let n=this.toNumber(r);return Object.is(t.capacityActual,n)?false:(t.capacityActual=n,true)}case "capacity.remaining":{let n=this.toNumber(r);return Object.is(t.capacityRemaining,n)?false:(t.capacityRemaining=n,true)}case "capacity.stateOfCharge":{let n=this.toNumber(r),o=!Object.is(t.stateOfChargeState??null,e??null);return Object.is(t.stateOfCharge,n)&&!o?false:(t.stateOfCharge=n,t.stateOfChargeState=e,true)}case "capacity.timeRemaining":{let n=this.toNumber(r);return Object.is(t.timeRemaining,n)?false:(t.timeRemaining=n,true)}default:return false}}buildBankSummary(t,a){let r=t.batteryIds.map(s=>a[s]).filter(s=>!!s),e=this.normalizeConnectionMode(t.connectionMode),n=this.calculateBankCurrent(r,e),o=this.sumNumbers(r.map(s=>s.power)),l=this.sumNumbers(r.map(s=>s.capacityRemaining)),m=this.calculateBankSoc(r),d=this.calculateBankTimeRemaining(r,e);return {id:t.id,name:t.name,batteryIds:t.batteryIds,totalCurrent:n,totalPower:o,remainingCapacity:l,avgSoc:m,timeRemaining:d}}calculateBankSoc(t){let a=this.sumNumbers(t.map(n=>n.capacityRemaining)),r=this.sumNumbers(t.map(n=>n.capacityActual));if(a!=null&&r!=null&&r>0)return Math.max(0,Math.min(1,a/r));let e=this.sumNumbers(t.map(n=>n.capacityNominal));return a!=null&&e!=null&&e>0?Math.max(0,Math.min(1,a/e)):this.averageNumbers(t.map(n=>n.stateOfCharge))}calculateBankCurrent(t,a){let r=t.map(e=>e.current);return a==="series"?this.averageNumbers(r):this.sumNumbers(r)}calculateBankTimeRemaining(t,a){let r=t.map(e=>e.timeRemaining);return a==="series"?this.minNumber(r):this.averageNumbers(r)}requestRender(t){this.svg&&(this.pendingRenderSnapshot=t??this.buildRenderSnapshot(),this.pendingRenderSnapshot&&this.renderFrameId===null&&(this.renderFrameId=requestAnimationFrame(()=>{this.renderFrameId=null;let a=this.pendingRenderSnapshot;this.pendingRenderSnapshot=null,a&&this.render(a);})));}buildRenderSnapshot(){let t=this.widgetColors();return t?{banks:this.bankSummaries(),batteries:this.visibleBatteries(),batteryDisplayModels:this.batteryDisplayModels(),bankDisplayModels:this.bankDisplayModels(),widgetColors:t}:null}render(t){if(!this.bankLayer||!this.batteryLayer)return;let{banks:a,batteries:r,bankDisplayModels:e,batteryDisplayModels:n,widgetColors:o}=t,l=this.buildRenderLayout(a,r,e,n,this.isCompactCardMode()),d=this.isCompactCardMode()?e$1:e$1,s=Math.max(i.MIN_VIEWBOX_HEIGHT,l.contentHeight);this.svg?.attr("viewBox",`0 0 ${i.VIEWBOX_WIDTH} ${s}`),this.root?.attr("transform",null);let g=this.bankLayer.selectAll("g.bank-card").data(l.banks,u=>u.id),c=g.enter().append("g").attr("class","bank-card"),y=c.append("text").attr("class","bank-card-power");y.append("tspan").attr("class","bank-card-power-value"),y.append("tspan").attr("class","bank-card-power-unit");let v=c.append("text").attr("class","bank-card-current");v.append("tspan").attr("class","bank-card-current-value"),v.append("tspan").attr("class","bank-card-current-unit");let k=c.append("g").attr("class","bank-gauge");k.append("path").attr("class","bank-gauge-bg"),k.append("path").attr("class","bank-gauge-value");let R=k.append("text").attr("class","bank-gauge-soc");R.append("tspan").attr("class","bank-gauge-soc-value"),R.append("tspan").attr("class","bank-gauge-soc-unit");let x=c.append("text").attr("class","bank-actualCapacity");x.append("tspan").attr("class","bank-actualCapacity-value"),x.append("tspan").attr("class","bank-actualCapacity-unit"),c.append("text").attr("class","bank-remaining"),c.append("g").attr("class","bank-bms-batteries"),c.append("text").attr("class","bank-title");let h=c.merge(g);h.attr("transform",u=>`translate(${u.x},${u.y})`),l.banks.length>1?h.select("text.bank-title").attr("x",d.titleX).attr("y",d.titleY).attr("fill","var(--kip-contrast-dim-color)").attr("font-size",d.titleFontSize).text(u=>u.displayModel.titleText):h.select("text.bank-title").text(""),h.select("text.bank-card-current").attr("x",d.lineOneX).attr("y",d.lineOneY).attr("fill","var(--kip-contrast-color)").attr("font-size",d.lineOneFontSize),h.select("tspan.bank-card-current-value").text(u=>this.splitMetricText(u.displayModel.currentText,"A").valueText),h.select("tspan.bank-card-current-unit").attr("dx",1).attr("font-size",12).attr("fill","var(--kip-contrast-color)").text(u=>this.splitMetricText(u.displayModel.currentText,"A").unitText),h.select("text.bank-card-power").attr("x",5).attr("y",42).attr("fill","var(--kip-contrast-color)").attr("font-size",10).attr("opacity",.8),h.select("tspan.bank-card-power-value").text(u=>this.splitMetricText(u.displayModel.powerText,"W").valueText),h.select("tspan.bank-card-power-unit").attr("dx",1).attr("font-size",6).attr("fill","var(--kip-contrast-color)").text(u=>this.splitMetricText(u.displayModel.powerText,"W").unitText),h.select("g.bank-gauge").attr("transform","translate(143, 60)"),h.select("path.bank-gauge-bg").attr("d",this.bankGaugeBackgroundPath).attr("fill","none").attr("stroke","var(--kip-contrast-dimmer-color)").attr("stroke-width",i.BANK_GAUGE_BG_STROKE).attr("stroke-linecap","round"),h.select("path.bank-gauge-value").attr("d",u=>u.displayModel.gaugeValuePath).attr("fill","none").attr("stroke",u=>u.displayModel.gaugeValueColor).attr("stroke-width",i.BANK_GAUGE_VALUE_STROKE).attr("stroke-linecap","round"),h.select("text.bank-gauge-soc").attr("x",0).attr("y",-5).attr("text-anchor","middle").attr("fill","var(--kip-contrast-color)").attr("font-size",d.primaryFontSize).attr("font-weight",d.primaryFontWeight),h.select("tspan.bank-gauge-soc-value").text(u=>this.splitMetricText(u.displayModel.socText,"%").valueText),h.select("tspan.bank-gauge-soc-unit").attr("dx",1).attr("font-size",22).attr("font-weight",500).attr("fill","var(--kip-contrast-color)").text(u=>this.splitMetricText(u.displayModel.socText,"%").unitText),h.select("text.bank-remaining").attr("x",143).attr("y",26).attr("fill","var(--kip-contrast-dim-color)").attr("text-anchor","middle").attr("font-size",8).text(u=>u.displayModel.remainingTimeText),h.select("text.bank-actualCapacity").attr("x",143).attr("y",66).attr("fill","var(--kip-contrast-dim-color)").attr("text-anchor","middle").attr("font-size",8),h.select("tspan.bank-actualCapacity-value").text(u=>this.splitMetricText(u.displayModel.remainingCapacityText,"kWh").valueText),h.select("tspan.bank-actualCapacity-unit").attr("dx",1).attr("font-size",6).attr("fill","var(--kip-contrast-dim-color)").text(u=>this.splitMetricText(u.displayModel.remainingCapacityText,"kWh").unitText),h.select("g.bank-bms-batteries").each((u,N,w)=>{let B=ge$1(w[N]).selectAll("g.battery-card").data(u.batteries,p=>p.key),C=B.enter().append("g").attr("class","battery-card battery-card--in-bank");this.appendBatteryCardSkeleton(C);let I=C.merge(B);this.renderBatteryCards(I,o,t.batteries.length>1),B.exit().remove();}),g.exit().remove();let M=this.batteryLayer.selectAll("g.battery-card").data(l.unassignedBatteries,u=>u.key),T=M.enter().append("g").attr("class","battery-card battery-card--unassigned");this.appendBatteryCardSkeleton(T);let f=T.merge(M);this.renderBatteryCards(f,o,true),M.exit().remove(),this.root?.attr("data-theme","ready");}buildRenderLayout(t,a,r,e,n){let o=new Map(a.map(f=>[f.id,f])),l=new Set,m=this.computeInBankBatterySlotWidth(),d=Math.max(.35,Math.min(1,m/i.BATTERY_CARD_WIDTH)),s=i.BATTERY_CARD_HEIGHT*d,g=0,c=t.map(f=>{let u=new Set,N=f.batteryIds.map(A=>o.get(A)).filter(A=>!A||u.has(A.id)?false:(u.add(A.id),true));N.forEach(A=>l.add(A.id));let w=Math.ceil(N.length/i.IN_BANK_COLUMNS),E=i.SINGLE_ROW_BANK_HEIGHT,B=!n&&w===1,C=B?Math.max(0,E-s-i.CARD_GAP):i.BANK_HEADER_HEIGHT,I=w>0?w*s+(w-1)*i.CARD_GAP:0,p=Math.max(i.BANK_MIN_HEIGHT,C+I+i.CARD_GAP),b=B?E:p,O=N.map((A,P)=>{let K=P%i.IN_BANK_COLUMNS,V=Math.floor(P/i.IN_BANK_COLUMNS),Y=i.IN_BANK_PADDING_X+K*(m+i.IN_BANK_COLUMN_GAP),q=C+7+V*(s+i.CARD_GAP);return {id:A.id,displayModel:e[A.id],key:`${f.id}::${A.id}`,x:Y,y:q,scale:d,inBank:true,compact:true}}),U={id:f.id,name:f.name,batteryIds:f.batteryIds,totalCurrent:f.totalCurrent,totalPower:f.totalPower,avgSoc:f.avgSoc,remainingCapacity:f.remainingCapacity,timeRemaining:f.timeRemaining,displayModel:r[f.id],x:0,y:g,width:i.BANK_CARD_WIDTH,height:b,batteries:O};return g+=b+i.CARD_GAP,U}),y=c.length>0?g:0,v=n?i.COMPACT_UNASSIGNED_BATTERY_SCALE:1,k=i.BATTERY_CARD_HEIGHT*v,R=a.filter(f=>!l.has(f.id)).sort((f,u)=>f.id.localeCompare(u.id)).map((f,u)=>({id:f.id,displayModel:e[f.id],key:f.id,x:0,y:y+u*(k+i.CARD_GAP),scale:v,inBank:false,compact:n})),x=c[c.length-1],h=x?x.y+x.height:0,M=R[R.length-1],T=M?M.y+k:0;return {banks:c,unassignedBatteries:R,contentHeight:Math.max(h,T)}}computeInBankBatterySlotWidth(){return (i.BANK_CARD_WIDTH-i.IN_BANK_PADDING_X*2-i.IN_BANK_COLUMN_GAP)/i.IN_BANK_COLUMNS}appendBatteryCardSkeleton(t){t.append("rect").attr("class","bms-battery").attr("rx",4).attr("ry",4),t.append("rect").attr("class","bms-battery-tip").attr("rx",1).attr("ry",1),t.append("rect").attr("class","bms-charge-fill").attr("rx",3).attr("ry",3),t.append("g").attr("class","bms-state-icon"),t.append("text").attr("class","bms-ampere"),t.append("text").attr("class","bms-volt-power");let a=t.append("text").attr("class","bms-soc");a.append("tspan").attr("class","bms-soc-value"),a.append("tspan").attr("class","bms-soc-unit"),t.append("text").attr("class","bms-actualCapacity"),t.append("text").attr("class","bms-remaining"),t.append("text").attr("class","bms-title");}renderBatteryCards(t,a,r){t.attr("transform",e=>`translate(${e.x},${e.y}) scale(${e.scale})`),t.select("rect.bms-battery").attr("width",e=>e.inBank?i.BATTERY_CARD_WIDTH:e.compact?i.BATTERY_CARD_WIDTH-i.CARD_GAP:i.BATTERY_CARD_WIDTH).attr("height",i.BATTERY_CARD_HEIGHT).attr("fill",e=>e.compact?"var(--mat-sys-background)":"var(--kip-contrast-dimmer-color)").attr("stroke","var(--kip-contrast-dimmer-color)").attr("stroke-width",0),t.select("rect.bms-battery-tip").attr("x",i.BATTERY_CARD_WIDTH).attr("y",i.BATTERY_CARD_HEIGHT/2-10).attr("width",4).attr("height",20).attr("fill",e=>e.compact?"var(--mat-sys-background)":"var(--kip-contrast-dimmer-color)").attr("stroke",a.color).attr("stroke-width",0),t.select("rect.bms-charge-fill").attr("x",1.5).attr("y",1.5).attr("width",e=>e.displayModel.chargeWidth).attr("height",i.BATTERY_CARD_HEIGHT-3).attr("fill",e=>e.compact?e.displayModel.chargeBarColorCompact:e.displayModel.chargeBarColorRegular),r?t.select("text.bms-title").attr("x",5).attr("y",e=>e.compact?11:14).attr("fill","var(--kip-contrast-dim-color)").attr("font-size",e=>e.compact?8:12).attr("filter",e=>e.displayModel.socGlowEnabled?`url(#${this.glowFilterId})`:null).text(e=>e.displayModel.titleText):t.select("text.bms-title").text(""),t.select("text.bms-ampere").attr("x",10).attr("y",33).attr("fill",e=>e.compact?e.displayModel.currentTextColorCompact:e.displayModel.currentTextColorRegular).attr("font-size",16).attr("filter",e=>e.displayModel.socGlowEnabled?`url(#${this.glowFilterId})`:null).text(e=>e.displayModel.currentText),t.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).attr("filter",e=>e.displayModel.socGlowEnabled?`url(#${this.glowFilterId})`:null).text(e=>e.compact?e.displayModel.detailLineCompact:e.displayModel.detailLineRegular),t.select("text.bms-soc").attr("x",i.BATTERY_CARD_WIDTH-33).attr("y",34).attr("fill",e=>e.compact?"var(--kip-contrast-dim-color)":"var(--kip-contrast-color)").attr("text-anchor","middle").attr("font-size",25).attr("font-weight",700).attr("filter",e=>e.displayModel.socGlowEnabled?`url(#${this.glowFilterId})`:null),t.select("tspan.bms-soc-value").text(e=>this.splitMetricText(e.displayModel.socText,"%").valueText),t.select("tspan.bms-soc-unit").attr("dx",1).attr("font-size",16).attr("font-weight",500).text(e=>this.splitMetricText(e.displayModel.socText,"%").unitText),t.select("text.bms-actualCapacity").attr("x",i.BATTERY_CARD_WIDTH-33).attr("y",45).attr("fill","var(--kip-contrast-dim-color)").attr("text-anchor","middle").attr("font-size",8).attr("filter",e=>e.displayModel.socGlowEnabled?`url(#${this.glowFilterId})`:null).text(e=>e.compact?"":e.displayModel.remainingCapacityText),t.select("text.bms-remaining").attr("x",i.BATTERY_CARD_WIDTH-33).attr("y",12).attr("fill","var(--kip-contrast-dim-color)").attr("text-anchor","middle").attr("font-size",6).attr("filter",e=>e.displayModel.socGlowEnabled?`url(#${this.glowFilterId})`:null).text(e=>e.compact?"":e.displayModel.remainingTimeText),t.select("g.bms-state-icon").attr("transform",`translate(${i.BATTERY_CARD_WIDTH/2-18}, ${i.BATTERY_CARD_HEIGHT/2-18})`).attr("display",e=>e.compact&&e.scale<.45?"none":null).attr("color",e=>e.compact?a.dim:a.color).attr("filter",e=>e.displayModel.socGlowEnabled?`url(#${this.glowFilterId})`:null).each((e,n,o)=>{let l=ge$1(o[n]),m=e.displayModel.iconKey,d=m==="power_renewal"?this.powerRenewalIconTemplate:this.powerAvailableIconTemplate;if(!d){l.selectAll("*").remove(),l.attr("data-icon-key",null);return}let s=l.node();if(!s||l.attr("data-icon-key")===m&&s.firstElementChild)return;l.selectAll("*").remove();let c=d.cloneNode(true);c.removeAttribute("id"),c.setAttribute("width","36"),c.setAttribute("height","36"),c.getAttribute("viewBox")||c.setAttribute("viewBox","0 0 24 24"),s.appendChild(c),l.attr("data-icon-key",m);});}formatVoltage(t){return t==null?"-- V":`${t.toFixed(1)}V`}formatCurrent(t){return t==null?"-- A":`${t.toFixed(1)}A`}formatPower(t){return t==null?"":`${t.toFixed(0)}W`}formatEnergy(t){return t==null?"":(t=this.units.convertToUnit("kWh",t),`${t}kWh`)}formatSoc(t){return t==null?"--%":`${Math.round(t*100)}%`}resolveBatteryTitleText(t){return t.name||`Battery ${t.id}`}formatDuration(t){if(t==null)return "";let a=this.units.convertToUnit("D HH:MM:SS",t);return a==null?"":typeof a=="string"?a:`${a}`}formatTemperature(t){if(t==null||typeof t!="number")return "";let a=this.units.getDefaults().Temperature,r=this.units.convertToUnit(a,t);return r===null?"":`${r.toFixed(1)} ${a==="celsius"?"\xB0C":"\xB0F"}`}splitMetricText(t,a){if(!t)return {valueText:"",unitText:""};let r=t.trim();return r?r.endsWith(a)?{valueText:r.slice(0,Math.max(0,r.length-a.length)).trim(),unitText:a}:{valueText:r,unitText:""}:{valueText:"",unitText:""}}sumNumbers(t){let a=t.filter(r=>typeof r=="number");return a.length?a.reduce((r,e)=>r+e,0):null}averageNumbers(t){let a=t.filter(r=>typeof r=="number");return a.length?a.reduce((r,e)=>r+e,0)/a.length:null}minNumber(t){let a=t.filter(r=>typeof r=="number");return a.length?Math.min(...a):null}toNumber(t){return t==null||typeof t!="number"?null:t}buildSemiGaugeArcPath(t,a){let r=Math.max(0,Math.min(1,a??0)),e=-Math.PI*.55,n=Math.PI*1.1,o=e+n*r;if(r<=0){let l=t*Math.cos(e),m=t*Math.sin(e);return `M ${l} ${m}`}return Bt()({innerRadius:t,outerRadius:t,startAngle:e,endAngle:o})??""}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=JD({type:i,selectors:[["widget-bms"]],viewQuery:function(a,r){a&1&&eg(r.svgRef,ue,5),a&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"],renderMode:[1,"renderMode"]},decls:4,vars:4,consts:[["bmsSvg",""],[3,"text","color"],["aria-hidden","false",1,"bms-svg"],[1,"bms-empty"],[1,"bms-empty-title"],[1,"bms-empty-sub"]],template:function(a,r){a&1&&(_w(0,pe,1,2,"widget-title",1),wd(),$h(1,"svg",2,0),_w(3,me,5,0,"div",3)),a&2&&(Mw(r.hasBanks()?0:-1),EE(),sg("bms-svg--full",!r.hasBanks()),EE(2),Mw(r.hasBatteries()?-1:3));},dependencies:[yt,x],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;position:relative;overflow:hidden}.bms-svg[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;padding:0 10px 10px}.bms-svg.bms-svg--full[_ngcontent-%COMP%]{top:0;height:100%;padding-top:10px}.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;margin:10px;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}}"]})};export{ee as WidgetBmsComponent};
@@ -0,0 +1 @@
1
+ import {p as p$1}from'./chunk-CaD3zVfK.js';import {G as Gt,D as Dt$1}from'./chunk-BQr-tSkv.js';import {u}from'./chunk-hd2_AKwt.js';import {k}from'./chunk-BwOIef42.js';import {d1 as Hj,w,du as p,dv as rt,dD as _,bu as ut,$ as $j,a6 as Lr,v as vt,D as Dt,dx as n$1,cw as z,cv as G,F as Fa,dn as ge$1,J as JD,_ as _w,M as Mw,f as eg,K as Kw,h as Fw,P as Pi,k as Qh,u as ul,g as qw,B as Bh,an as Hh,l as ud,m as dd}from'./main-BAV5VDOD.js';import {c}from'./chunk-Dxlia2NE.js';var Z=["linearGauge"];function Q(s,H){if(s&1){let t=Fw();Pi(0,"linear-gauge",2,0),Qh("resizeChange",function(a){ud(t);let e=qw();return dd(e.onResized(a))}),ul();}if(s&2){let t=qw();Bh("options",t.gaugeOptions)("value",t.displayValue()),Hh("value-text",t.textValue());}}var ge=(()=>{class s{id=Hj.required();type=Hj.required();theme=Hj.required();runtime=w(p);streams=w(rt);metadata=w(_);unitsService=w(ut);static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:true,displayName:"Gauge Label",filterSelfPaths:true,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",suppressBootstrapNull:true,isPathConfigurable:true,showPathSkUnitsFilter:true,pathSkUnitsFilter:null,convertUnitTo:"unitless",sampleTime:500}},displayScale:{lower:0,upper:100,type:"linear"},gauge:{type:"ngLinear",subType:"vertical",highlightsWidth:5,enableTicks:true,enableNeedle:false},numInt:1,numDecimal:0,color:"contrast",enableTimeout:false,dataTimeout:5,ignoreZones:false};ngGauge=$j("linearGauge");gauge=$j("linearGauge",{read:Lr});textValue=vt("--");value=vt(void 0);displayValue=Dt(()=>this.value()??0);shouldRenderGauge=Dt(()=>this.value()!==void 0);gaugeOptions={};viewReady=vt(false);gaugeBootstrapped=vt(false);animationEnabled=Dt(()=>this.gaugeBootstrapped());currentState=vt(n$1.Normal);normalizedConfig=Dt(()=>this.runtime.options()??s.DEFAULT_CONFIG);gaugePathConfig=Dt(()=>this.normalizedConfig().paths?.gaugePath);normalizedScale=Dt(()=>{let t=this.normalizedConfig().displayScale??s.DEFAULT_CONFIG.displayScale;return z(G({},t),{lower:t.lower??0,upper:t.upper??100})});adjustedScale=Dt(()=>{let t=this.normalizedConfig(),i=this.normalizedScale();return t.gauge?.enableTicks?p$1(i.lower,i.upper):{min:i.lower,max:i.upper,majorTicks:[]}});highlights=Dt(()=>{let t=this.metadata.zones(),i=this.normalizedConfig(),a=this.theme(),e=this.gaugePathConfig();return t?.length?a?i.ignoreZones?[]:e?k(t,a,e.convertUnitTo??"",this.unitsService,this.adjustedScale().min,this.adjustedScale().max):[]:[]:[]});displayName=Dt(()=>this.normalizedConfig().displayName||"Gauge Label");constructor(){Fa(()=>{this.normalizedConfig();let i=this.theme(),a=this.gaugePathConfig(),e=this.normalizedScale();!i||!a?.path||ge$1(()=>this.streams.observe("gaugePath",o=>{let n=o?.data?.value??null;if(n==null)this.value.set(e.lower),this.textValue.set("--");else {let r=Math.min(Math.max(n,e.lower),e.upper);this.value.set(r),this.textValue()==="--"&&this.textValue.set("");}o.state!==this.currentState()&&this.currentState.set(o.state);}));}),Fa(()=>{this.normalizedConfig().ignoreZones||ge$1(()=>this.metadata.observe("gaugePath"));}),Fa(()=>{let t=this.highlights();this.viewReady()&&ge$1(()=>{try{if(!t.length)this.ngGauge()?.update({highlights:[]});else {let i=JSON.stringify(t);this.ngGauge()?.update({highlights:i,highlightsWidth:this.normalizedConfig().gauge?.highlightsWidth});}}catch(i){}});}),Fa(()=>{let t=this.normalizedConfig(),i=this.theme(),a=this.adjustedScale();i&&ge$1(()=>{if(this.buildGaugeOptions(t,i,a),this.viewReady())try{this.ngGauge()?.update(this.gaugeOptions),this.applyInitialSize();}catch(e){}});}),Fa(()=>{let t=this.ngGauge();!t||this.gaugeBootstrapped()||ge$1(()=>{try{requestAnimationFrame(()=>{this.gaugeBootstrapped.set(!0);try{t.update({animation:!0,animatedValue:!0});}catch(i){}});}catch(i){}});}),Fa(()=>{let t=this.currentState();this.viewReady()&&ge$1(()=>{let i=this.normalizedConfig(),a=this.theme();if(!a||i.ignoreZones)return;let e={},o=i.gauge?.enableNeedle,n=c(i.color??"contrast",a);switch(t){case n$1.Alarm:o?(e.colorNeedle=a.zoneAlarm,e.colorValueText=a.zoneAlarm):(e.colorBarProgress=a.zoneAlarm,e.colorValueText=a.zoneAlarm);break;case n$1.Warn:o?(e.colorNeedle=a.zoneWarn,e.colorValueText=a.zoneWarn):(e.colorBarProgress=a.zoneWarn,e.colorValueText=a.zoneWarn);break;case n$1.Alert:o?(e.colorNeedle=a.zoneAlert,e.colorValueText=a.zoneAlert):(e.colorBarProgress=a.zoneAlert,e.colorValueText=a.zoneAlert);break;default:o?(e.colorNeedle=n.color,e.colorValueText=n.color):(e.colorBarProgress=n.color,e.colorValueText=n.color);}try{this.ngGauge()?.update(e);}catch(r){}});});}buildGaugeOptions(t,i,a){let e=this.gaugeOptions={},o=t.gauge?.subType==="vertical",n=t.gauge?.enableNeedle,r=t.gauge?.enableTicks,m=this.gaugePathConfig();e.minValue=a.min,e.maxValue=a.max,e.valueInt=t.numInt??1,e.valueDec=t.numDecimal??2,e.title=this.displayName(),e.fontTitleSize=40,e.fontTitle="Roboto",e.fontTitleWeight="bold",e.barLength=o?80:90,e.barWidth=r?n?0:30:60,e.barProgress=true,e.barBeginCircle=0,e.barStrokeWidth=0,e.barShadow=0,e.needle=!!n,e.needleType=n?"arrow":"line",e.needleStart=n?o?200:155:-45,e.needleEnd=n?o?175:180:55,e.needleShadow=true,e.needleSide="both",e.units=m?.convertUnitTo??"",e.fontUnits="Roboto",e.fontUnitsWeight="normal",e.borders=false,e.borderOuterWidth=0,e.borderMiddleWidth=0,e.borderInnerWidth=0,e.borderShadowWidth=0,e.borderRadius=0,e.valueBox=true,e.valueBoxWidth=35,e.valueBoxStroke=0,e.valueBoxBorderRadius=10,e.colorValueBoxRect="",e.colorValueBoxRectEnd="",e.colorValueBoxShadow="",e.fontValueSize=50,e.fontValue="Roboto",e.fontValueWeight="bold",e.valueTextShadow=false,e.fontNumbers="Roboto",e.fontNumbersWeight="normal",e.fontUnitsSize=o?40:35,e.colorTitle=c("contrast",i).dim,e.colorUnits=c("contrast",i).dim,e.colorValueBoxBackground=i.background;let u=c(t.color??"contrast",i);e.colorValueText=u.color,n?(e.colorNeedle=u.color,e.colorNeedleEnd=u.color,e.needleWidth=45,e.colorNeedleShadowUp=u.color,e.colorNeedleShadowDown=u.color):(e.colorBarProgress=u.color,e.colorBarProgressEnd="",e.needleWidth=0),e.colorPlate=i.cardColor,e.colorBar=i.background,e.colorBarEnd="",e.colorBarStroke="0",e.colorMajorTicks=c("contrast",i).dim,e.colorMinorTicks=c("contrast",i).dim,e.colorNumbers=c("contrast",i).dim,e.majorTicks=r?a.majorTicks:[],e.majorTicksInt=t.numInt??1,e.majorTicksDec=t.numDecimal??2,e.strokeTicks=!!r,e.minorTicks=r?2:0,e.ticksWidthMinor=r?6:0,e.numberSide=n?"right":"left",e.fontNumbersSize=r?o?22:30:0,e.numbersMargin=o?n?-7:-3:n?-33:-5,e.ticksWidth=r?n&&o?15:10:0,e.ticksPadding=r?o?n?0:5:n?9:8:0,e.tickSide="left",e.animation=this.animationEnabled(),e.animationRule="linear",e.animatedValue=this.animationEnabled(),e.animateOnInit=false,e.animationDuration=(m?.sampleTime??500)-25,e.highlights=[],e.highlightsWidth=t.gauge?.highlightsWidth;let N=this.highlights();N.length&&(e.highlights=JSON.stringify(N));}ngAfterViewInit(){this.viewReady.set(true),this.applyInitialSize();try{this.ngGauge()?.update(this.gaugeOptions);}catch(t){}}applyInitialSize(){let t=this.gauge()?.nativeElement;if(!t)return;let i=t.getBoundingClientRect(),a=.3,e,o;this.normalizedConfig().gauge?.subType==="vertical"?(e=i.height,o=i.height*a):(o=i.width,e=i.width*a);let m={height:e,width:o};try{this.ngGauge()?.update(m);}catch(u){}}onResized(t){let i=this.normalizedConfig(),a=.3,e=i.gauge?.subType==="vertical",o=0,n=0;e?(n=t.contentRect.height,o=n*a,o>t.contentRect.width&&(o=t.contentRect.width,n=o/a)):(o=t.contentRect.width,n=o*a,n>t.contentRect.height&&(n=t.contentRect.height,o=n/a));let r={width:o,height:n-10};try{this.ngGauge()?.update(r);}catch(m){}}static \u0275fac=function(i){return new(i||s)};static \u0275cmp=JD({type:s,selectors:[["widget-gauge-ng-linear"]],viewQuery:function(i,a){i&1&&eg(a.ngGauge,Z,5)(a.gauge,Z,5,Lr),i&2&&Kw(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(i,a){i&1&&_w(0,Q,2,3,"linear-gauge",1),i&2&&Mw(a.shouldRenderGauge()?0:-1);},dependencies:[u,Gt,Dt$1],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 s})();export{ge as WidgetGaugeNgLinearComponent};
@@ -0,0 +1 @@
1
+ import {dx as n$1}from'./main-BAV5VDOD.js';function c(n,r){let i={contrast:{color:r.contrast,dim:r.contrastDim,dimmer:r.contrastDimmer},blue:{color:r.blue,dim:r.blueDim,dimmer:r.blueDimmer},green:{color:r.green,dim:r.greenDim,dimmer:r.greenDimmer},pink:{color:r.pink,dim:r.pinkDim,dimmer:r.pinkDimmer},orange:{color:r.orange,dim:r.orangeDim,dimmer:r.orangeDimmer},purple:{color:r.purple,dim:r.purpleDim,dimmer:r.purpleDimmer},yellow:{color:r.yellow,dim:r.yellowDim,dimmer:r.yellowDimmer},grey:{color:r.grey,dim:r.greyDim,dimmer:r.greyDimmer}},l=n in i?n:"contrast";return i[l]}function e(n,r,i,l){if(l||!n||!i)return r;switch(n){case n$1.Nominal:return i.zoneNominal;case n$1.Alarm:return i.zoneAlarm;case n$1.Warn:return i.zoneWarn;case n$1.Alert:return i.zoneAlert;default:return r}}export{c,e};
@@ -0,0 +1 @@
1
+ import {d1 as Hj,w,du as p,dv as rt$1,cu as T,a as G,aZ as F,aY as xe,$ as $j,v as vt,bG as Bj,D as Dt,F as Fa,dn as ge,a_ as Gp,J as JD,b2 as Ln,b4 as Xe,b5 as Pn,b9 as rn,O as Op,bh as xp,y as yt,b as wt,cR as zt,bg as mt$1,bd as an,P as Pi,c as $h,u as ul,k as Qh,cn as wd,T as TT,_ as _w,e as EE,M as Mw,f as eg,K as Kw,g as qw,bp as gl,h as Fw,cV as Td,bi as Eg,bk as cD,bm as Ig,bo as lD,l as ud,m as dd,bj as ST}from'./main-BAV5VDOD.js';import {c}from'./chunk-Dxlia2NE.js';var at=["canvasMainRef"];function ot(o,v){if(o&1&&(Pi(0,"div",8),wd(),Pi(1,"svg",11)(2,"text",12),TT(3),ul()()()),o&2){let t=qw();EE(3),gl("@ ",t.startAtTime());}}function st(o,v){if(o&1){let t=Fw();Pi(0,"button",13),Qh("click",function(){ud(t);let i=qw();return dd(i.sendStartTimerCommand("start"))}),Pi(1,"mat-icon",5),wd(),Pi(2,"svg",6)(3,"text",14),TT(4,"Start"),ul()()()(),Td(),Pi(5,"button",15),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(-60))}),Pi(6,"mat-icon",5),wd(),Pi(7,"svg",6)(8,"text",14),TT(9,"-1m"),ul()()()(),Td(),Pi(10,"button",16),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(60))}),Pi(11,"mat-icon",5),wd(),Pi(12,"svg",6)(13,"text",14),TT(14,"+1m"),ul()()()();}}function rt(o,v){if(o&1){let t=Fw();Pi(0,"button",17),Qh("click",function(){ud(t);let i=qw();return dd(i.sendStartTimerCommand("sync"))}),Pi(1,"mat-icon",5),wd(),Pi(2,"svg",18)(3,"text",19),TT(4,"Sync"),ul()()()(),Td(),Pi(5,"button",20),Qh("click",function(){ud(t);let i=qw();return dd(i.sendStartTimerCommand("reset"))}),Pi(6,"mat-icon",5),wd(),Pi(7,"svg",18)(8,"text",19),TT(9,"Reset"),ul()()()();}}function lt(o,v){if(o&1){let t=Fw();Pi(0,"button",21),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(-60))}),Pi(1,"mat-icon",5),wd(),Pi(2,"svg",22)(3,"text",23),TT(4,"-1m"),ul()()()(),Td(),Pi(5,"button",24),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(-1))}),Pi(6,"mat-icon",5),wd(),Pi(7,"svg",22)(8,"text",23),TT(9,"-1s"),ul()()()(),Td(),Pi(10,"button",25),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(1))}),Pi(11,"mat-icon",5),wd(),Pi(12,"svg",22)(13,"text",23),TT(14,"+1s"),ul()()()(),Td(),Pi(15,"button",26),Qh("click",function(){ud(t);let i=qw();return dd(i.adjustStartTime(60))}),Pi(16,"mat-icon",5),wd(),Pi(17,"svg",22)(18,"text",23),TT(19,"+1m"),ul()()()();}}function mt(o,v){if(o&1){let t=Fw();Pi(0,"input",27),Eg("ngModelChange",function(i){ud(t);let a=qw();return ST(a.startAtTimeEdit,i)||(a.startAtTimeEdit=i),dd(i)}),Qh("change",function(){ud(t);let i=qw();return dd(i.setStartTime())}),ul(),cD();}if(o&2){let t=qw();Ig("ngModel",t.startAtTimeEdit),lD();}}function ct(o,v){o&1&&$h(0,"div",10);}var Et=(()=>{class o{id=Hj.required();type=Hj.required();theme=Hj.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:false,displayName:"TTS",nextDashboard:0,playBeeps:true,filterSelfPaths:true,paths:{ttsPath:{description:"Time to the Start in seconds",path:"self.navigation.racing.timeToStart",source:"default",pathType:"number",pathRequired:false,isPathConfigurable:false,convertUnitTo:"s",showConvertUnitTo:false,showPathSkUnitsFilter:false,pathSkUnitsFilter:"s",sampleTime:500},startTimePath:{description:"Time of the start",path:"self.navigation.racing.startTime",source:"default",pathType:"Date",pathRequired:false,isPathConfigurable:false,sampleTime:500},dtsPath:{description:"Distance to Start Line path, used to determine OCS",path:"self.navigation.racing.distanceStartline",source:"default",pathType:"number",pathRequired:false,isPathConfigurable:false,convertUnitTo:"m",showPathSkUnitsFilter:false,pathSkUnitsFilter:"m",sampleTime:500}},color:"contrast",enableTimeout:false,dataTimeout:5,ignoreZones:true};runtime=w(p);streams=w(rt$1);signalk=w(T);dashboard=w(G);canvas=w(F);destroyRef=w(xe);canvasRef=$j.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;labelColor=vt("");mode=vt(1);ttsValue=null;dtsValue=null;valueColor="";valueStateColor="";startAtTime=vt("00:00:00");startAtTimeEdit=Bj("");normalizedConfig=Dt(()=>this.runtime.options()??o.DEFAULT_CONFIG);constructor(){Fa(()=>{let t=this.normalizedConfig(),e=this.theme();e&&ge(()=>{let i=c(t.color??"contrast",e);this.labelColor.set(i.dim),this.valueColor=i.color,this.valueStateColor=i.color,this.draw();});}),Fa(()=>{let t=this.normalizedConfig();t.paths?.ttsPath?.path&&ge(()=>this.streams.observe("ttsPath",a=>{let s=this.ttsValue;this.ttsValue=a?.data?.value??null,this.updateValueColor(),this.draw(),this.shouldBeep(s,this.ttsValue)&&this.beepForValue(this.ttsValue),(t.nextDashboard??-1)>=0&&s===1&&this.ttsValue===0&&(!this.dtsValue||this.dtsValue>=0);}));}),Fa(()=>{this.normalizedConfig().paths?.startTimePath?.path&&ge(()=>this.streams.observe("startTimePath",a=>{let s=a?.data?.value;if(!s)this.startAtTime.set("HH:MM:SS"),this.startAtTimeEdit.set("HH:MM:SS"),this.mode()===2&&this.mode.set(1);else {let l=new Date(s);this.startAtTimeEdit.set(l.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})),this.startAtTime.set(this.startAtTimeEdit());}this.draw();}));}),Fa(()=>{this.normalizedConfig().paths?.dtsPath?.path&&ge(()=>this.streams.observe("dtsPath",a=>{this.dtsValue=a?.data?.value??null;}));}),this.signalk.subscribeRequest().pipe(Gp(this.destroyRef)).subscribe(t=>{t.widgetUUID===this.id()&&t.statusCode===200&&this.beep(600,20);});}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:true,onResize:(t,e)=>{this.cssWidth=t,this.cssHeight=e,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(t){}}toggleMode(){this.mode.update(e=>(e+1)%5);let t=this.ttsValue;this.mode()===1&&this.isStartTimerRunning()&&this.mode.set(2),this.mode()===2&&t!==0&&!this.isStartTimerRunning()&&this.mode.set(3),this.draw();}sendStartTimerCommand(t){this.signalk.putRequest("navigation.racing.setStartTime",{command:t},this.id()),t==="start"&&this.mode.set(0),t==="reset"&&(this.startAtTime.set("HH:MM:SS"),this.mode.set(1));}adjustStartTime(t){this.signalk.putRequest("navigation.racing.setStartTime",{command:"adjust",delta:t},this.id());}setStartTime(){let t=new Date,e=this.startAtTimeEdit().split(":").map(Number),i=e[0],a=e[1],s=e.length>=3?e[2]:0,l=new Date(t);l.setHours(i,a,s,0),l<=t&&l.setDate(l.getDate()+1),this.mode.set(0),this.signalk.putRequest("navigation.racing.setStartTime",{command:"set",startTime:l.toISOString()},this.id());}isStartTimerRunning(){return (this.ttsValue??0)>0&&this.startAtTime()!==null&&this.startAtTime()!=="HH:MM:SS"}shouldBeep(t,e){return e==null||this.startAtTime()==="HH:MM:SS"||!this.runtime.options()?.playBeeps?false:e===0&&t!==0||e<10&&e>=0||e<60&&e%10===0?true:e%60===0}beepForValue(t){t===0?this.beep(500,1e3):t<10?this.beep(450,100):t<60&&t%10===0?this.beep(400,150):t%60===0&&this.beep(350,200);}updateValueColor(){let t=this.theme(),e=this.normalizedConfig();t&&(e.ignoreZones?this.ttsValue?this.ttsValue===0?this.valueStateColor=this.valueColor:this.ttsValue<10?this.valueStateColor=(this.dtsValue??0)<0?t.zoneAlarm:t.zoneWarn:this.ttsValue<60?this.valueStateColor=t.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=t.zoneAlarm)):this.mode()===1&&this.isStartTimerRunning()&&this.mode.set(2));}toHHMMSS(t){if(t==null||isNaN(t))return "-:--";let e=t<0;e&&(t=-t);let i=Math.floor(t/3600),a=Math.floor(t%3600/60),s=Math.floor(t%60),l=e?"-":"";return i===0?`${l}${a.toString().padStart(1,"0")}:${s.toString().padStart(2,"0")}`:`${l}${i.toString().padStart(1,"0")}:${a.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`}getValueText(){return this.toHHMMSS(this.ttsValue??0)}draw(){if(!this.ctx||!this.canvasElement)return;let e=this.runtime.options()?.displayName||"TTS",i=this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==e||this.titleBitmapColor!==i)&&(this.titleBitmap=this.canvas.createTitleBitmap(e,i,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=e,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(t=440,e=100){if(!this.runtime.options()?.playBeeps)return;let i=window.AudioContext||window.webkitAudioContext,a=new i,s=a.createOscillator(),l=a.createGain();s.connect(l),l.connect(a.destination),s.type="sine",s.frequency.value=t,l.gain.value=.1,s.start(),s.stop(a.currentTime+e/1e3);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=JD({type:o,selectors:[["widget-racer-timer"]],viewQuery:function(e,i){e&1&&eg(i.canvasRef,at,5),e&2&&Kw();},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(e,i){if(e&1&&(Pi(0,"div",1),$h(1,"canvas",2,0),ul(),Pi(3,"div",3)(4,"button",4),Qh("click",function(){return i.toggleMode()}),Pi(5,"mat-icon",5),wd(),Pi(6,"svg",6)(7,"text",7),TT(8,"\u22EE"),ul()()()(),_w(9,ot,4,1,"div",8)(10,st,15,0)(11,rt,10,0)(12,lt,20,0)(13,mt,1,1,"input",9),ul(),_w(14,ct,1,0,"div",10)),e&2){let a;EE(9),Mw((a=i.mode())===0?9:a===1?10:a===2?11:a===3?12:a===4?13:-1),EE(5),Mw(i.dashboard.isDashboardStatic()?-1:14);}},dependencies:[Ln,Xe,Pn,rn,Op,xp,yt,wt,zt,mt$1,an],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 o})();export{Et as WidgetRacerTimerComponent};
@@ -0,0 +1 @@
1
+ function f(u={}){let c=u.threshold??30,a=false,i=0,l=0,o=null,r=null,s=()=>{a=false,i=0,l=0,o=null,r=null;};return {onPointerDown(t){a=false,i=t.clientX,l=t.clientY;let e=t.currentTarget;if(e&&typeof e.setPointerCapture=="function")try{e.setPointerCapture(t.pointerId),o=e,r=t.pointerId;}catch(n){}},onPointerMove(t){let e=Math.abs(t.clientX-i),n=Math.abs(t.clientY-l);(e>c||n>c)&&(a=true);},onPointerUp(t){if(o&&r!==null){let n=o;if(typeof n.releasePointerCapture=="function")try{(!t||n.hasPointerCapture?.(r))&&n.releasePointerCapture(r);}catch(p){}}let e=!a;return s(),e},onPointerCancel(t){if(o&&r!==null){let e=o;if(typeof e.releasePointerCapture=="function")try{(!t||e.hasPointerCapture?.(r))&&e.releasePointerCapture(r);}catch(n){}}s();},reset:s}}export{f};
@@ -0,0 +1 @@
1
+ import {d1 as Hj,w,du as p,dv as rt,aZ as F,D as Dt,$ as $j,v as vt,F as Fa,dn as ge,J as JD,cp as Uh,f as eg,K as Kw}from'./main-BAV5VDOD.js';import {c}from'./chunk-Dxlia2NE.js';var E=["canvasMainRef"],O=(()=>{class s{id=Hj.required();type=Hj.required();theme=Hj.required();static DEFAULT_CONFIG={displayName:"Gauge Label",filterSelfPaths:true,paths:{stringPath:{description:"String Data",path:null,source:null,pathType:"string",isPathConfigurable:true,sampleTime:500}},color:"contrast",enableTimeout:false,dataTimeout:5};runtime=w(p);stream=w(rt);canvas=w(F);normalizedConfig=Dt(()=>this.runtime.options()??s.DEFAULT_CONFIG);stringPathConfig=Dt(()=>this.normalizedConfig().paths?.stringPath);canvasMainRef=$j.required("canvasMainRef");canvasElement;canvasCtx=null;titleBitmap=null;titleBitmapText=null;cssWidth=0;cssHeight=0;dataValue=null;labelColor=vt("");valueColor="";isDestroyed=false;streamRegistered=false;constructor(){Fa(()=>{let t=this.theme();ge(()=>{t&&(this.setColors(),this.drawWidget());});}),Fa(()=>{this.normalizedConfig();this.isDestroyed||!this.canvasCtx||ge(()=>{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:true,onResize:(t,e)=>{this.cssWidth=t,this.cssHeight=e,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.stringPathConfig()?.path?(this.stream.observe("stringPath",e=>{this.dataValue=e.data.value,this.drawWidget();}),this.streamRegistered=true):this.drawWidget());}setColors(){let e=this.normalizedConfig().color??"contrast";this.labelColor.set(c(e,this.theme()).dim),this.valueColor=c(e,this.theme()).color;}ngOnDestroy(){this.isDestroyed=true;try{this.canvas.unregisterCanvas(this.canvasElement);}catch(t){}}drawWidget(){if(!this.canvasCtx)return;let t=Math.floor(this.cssHeight*.1),i=this.normalizedConfig().displayName??"Gauge Label",y=i+"|"+this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==y)&&(this.titleBitmap=this.canvas.createTitleBitmap(i,this.labelColor(),"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=i+"|"+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 b=this.dataValue===null?"--":this.dataValue,h=this.canvas.EDGE_BUFFER||10,d=Math.max(0,this.cssHeight-t-2*h),W=Math.max(0,Math.floor(this.cssWidth-2*h)),w=Math.max(0,Math.floor(d)),D=Math.floor(this.cssWidth/2),B=Math.floor(t+h+d/2);this.canvas.drawText(this.canvasCtx,b,D,B,W,w,"bold",this.valueColor,"center","middle");}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=JD({type:s,selectors:[["widget-text"]],viewQuery:function(e,i){e&1&&eg(i.canvasMainRef,E,5),e&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["canvasMainRef",""],[1,"text-canvas"]],template:function(e,i){e&1&&Uh(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 s})();export{O as WidgetTextComponent};
@@ -0,0 +1,2 @@
1
+ import {w,n as G,cD as V,aY as xe,v as vt,W as Wp,as as ke,cE as Xl,D as Dt,F as Fa,J as JD,cF as Un,O as Op,bh as xp,o as eu,cG as Ht,cH as R,cI as ee,cJ as Nt,cK as Lt,r as f,bt as u,y as yt,b as wt,P as Pi,c as $h,T as TT,u as ul,_ as _w,cf as xh,k as Qh,bl as Jw,e as EE,d as ig,aA as gg,B as Bh,M as Mw,g as qw,X as xw,Y as Aw,h as Fw,l as ud,m as dd,bp as gl,cL as vb,cM as yb}from'./main-BAV5VDOD.js';var Ue=yb((ft,ce)=>{var Ye=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var p=(function(r){var f=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,i=0,o={},e={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function t(n){return n instanceof a?new a(n.type,t(n.content),n.alias):Array.isArray(n)?n.map(t):n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(t){return Object.prototype.toString.call(t).slice(8,-1)},objId:function(t){return t.__id||Object.defineProperty(t,"__id",{value:++i}),t.__id},clone:function t(n,s){s=s||{};var l,u;switch(e.util.type(n)){case "Object":if(u=e.util.objId(n),s[u])return s[u];l={},s[u]=l;for(var m in n)n.hasOwnProperty(m)&&(l[m]=t(n[m],s));return l;case "Array":return u=e.util.objId(n),s[u]?s[u]:(l=[],s[u]=l,n.forEach(function(E,g){l[g]=t(E,s);}),l);default:return n}},getLanguage:function(t){for(;t;){var n=f.exec(t.className);if(n)return n[1].toLowerCase();t=t.parentElement;}return "none"},setLanguage:function(t,n){t.className=t.className.replace(RegExp(f,"gi"),""),t.classList.add("language-"+n);},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(l){var t=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(l.stack)||[])[1];if(t){var n=document.getElementsByTagName("script");for(var s in n)if(n[s].src==t)return n[s]}return null}},isActive:function(t,n,s){for(var l="no-"+n;t;){var u=t.classList;if(u.contains(n))return !0;if(u.contains(l))return !1;t=t.parentElement;}return !!s}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(t,n){var s=e.util.clone(e.languages[t]);for(var l in n)s[l]=n[l];return s},insertBefore:function(t,n,s,l){l=l||e.languages;var u=l[t],m={};for(var E in u)if(u.hasOwnProperty(E)){if(E==n)for(var g in s)s.hasOwnProperty(g)&&(m[g]=s[g]);s.hasOwnProperty(E)||(m[E]=u[E]);}var T=l[t];return l[t]=m,e.languages.DFS(e.languages,function(O,z){z===T&&O!=t&&(this[O]=m);}),m},DFS:function t(n,s,l,u){u=u||{};var m=e.util.objId;for(var E in n)if(n.hasOwnProperty(E)){s.call(n,E,n[E],l||E);var g=n[E],T=e.util.type(g);T==="Object"&&!u[m(g)]?(u[m(g)]=!0,t(g,s,null,u)):T==="Array"&&!u[m(g)]&&(u[m(g)]=!0,t(g,s,E,u));}}},plugins:{},highlightAll:function(t,n){e.highlightAllUnder(document,t,n);},highlightAllUnder:function(t,n,s){var l={callback:s,container:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};e.hooks.run("before-highlightall",l),l.elements=Array.prototype.slice.apply(l.container.querySelectorAll(l.selector)),e.hooks.run("before-all-elements-highlight",l);for(var u=0,m;m=l.elements[u++];)e.highlightElement(m,n===!0,l.callback);},highlightElement:function(t,n,s){var l=e.util.getLanguage(t),u=e.languages[l];e.util.setLanguage(t,l);var m=t.parentElement;m&&m.nodeName.toLowerCase()==="pre"&&e.util.setLanguage(m,l);var E=t.textContent,g={element:t,language:l,grammar:u,code:E};function T(z){g.highlightedCode=z,e.hooks.run("before-insert",g),g.element.innerHTML=g.highlightedCode,e.hooks.run("after-highlight",g),e.hooks.run("complete",g),s&&s.call(g.element);}if(e.hooks.run("before-sanity-check",g),m=g.element.parentElement,m&&m.nodeName.toLowerCase()==="pre"&&!m.hasAttribute("tabindex")&&m.setAttribute("tabindex","0"),!g.code){e.hooks.run("complete",g),s&&s.call(g.element);return}if(e.hooks.run("before-highlight",g),!g.grammar){T(e.util.encode(g.code));return}if(n&&r.Worker){var O=new Worker(e.filename);O.onmessage=function(z){T(z.data);},O.postMessage(JSON.stringify({language:g.language,code:g.code,immediateClose:!0}));}else T(e.highlight(g.code,g.grammar,g.language));},highlight:function(t,n,s){var l={code:t,grammar:n,language:s};if(e.hooks.run("before-tokenize",l),!l.grammar)throw new Error('The language "'+l.language+'" has no grammar.');return l.tokens=e.tokenize(l.code,l.grammar),e.hooks.run("after-tokenize",l),a.stringify(e.util.encode(l.tokens),l.language)},tokenize:function(t,n){var s=n.rest;if(s){for(var l in s)n[l]=s[l];delete n.rest;}var u=new F;return C(u,u.head,t),S(t,u,n,u.head,0),L(u)},hooks:{all:{},add:function(t,n){var s=e.hooks.all;s[t]=s[t]||[],s[t].push(n);},run:function(t,n){var s=e.hooks.all[t];if(!(!s||!s.length))for(var l=0,u;u=s[l++];)u(n);}},Token:a};r.Prism=e;function a(t,n,s,l){this.type=t,this.content=n,this.alias=s,this.length=(l||"").length|0;}a.stringify=function t(n,s){if(typeof n=="string")return n;if(Array.isArray(n)){var l="";return n.forEach(function(T){l+=t(T,s);}),l}var u={type:n.type,content:t(n.content,s),tag:"span",classes:["token",n.type],attributes:{},language:s},m=n.alias;m&&(Array.isArray(m)?Array.prototype.push.apply(u.classes,m):u.classes.push(m)),e.hooks.run("wrap",u);var E="";for(var g in u.attributes)E+=" "+g+'="'+(u.attributes[g]||"").replace(/"/g,"&quot;")+'"';return "<"+u.tag+' class="'+u.classes.join(" ")+'"'+E+">"+u.content+"</"+u.tag+">"};function h(t,n,s,l){t.lastIndex=n;var u=t.exec(s);if(u&&l&&u[1]){var m=u[1].length;u.index+=m,u[0]=u[0].slice(m);}return u}function S(t,n,s,l,u,m){for(var E in s)if(!(!s.hasOwnProperty(E)||!s[E])){var g=s[E];g=Array.isArray(g)?g:[g];for(var T=0;T<g.length;++T){if(m&&m.cause==E+","+T)return;var O=g[T],z=O.inside,ae=!!O.lookbehind,X=!!O.greedy,de=O.alias;if(X&&!O.pattern.global){var pe=O.pattern.toString().match(/[imsuy]*$/)[0];O.pattern=RegExp(O.pattern.source,pe+"g");}for(var oe=O.pattern||O,$=l.next,N=u;$!==n.tail&&!(m&&N>=m.reach);N+=$.value.length,$=$.next){var U=$.value;if(n.length>t.length)return;if(!(U instanceof a)){var q=1,G;if(X){if(G=h(oe,N,t,ae),!G||G.index>=t.length)break;var _=G.index,A=G.index+G[0].length,c=N;for(c+=$.value.length;_>=c;)$=$.next,c+=$.value.length;if(c-=$.value.length,N=c,$.value instanceof a)continue;for(var d=$;d!==n.tail&&(c<A||typeof d.value=="string");d=d.next)q++,c+=d.value.length;q--,U=t.slice(N,c),G.index-=N;}else if(G=h(oe,0,U,ae),!G)continue;var _=G.index,x=G[0],w=U.slice(0,_),H=U.slice(_+x.length),B=N+U.length;m&&B>m.reach&&(m.reach=B);var K=$.prev;w&&(K=C(n,K,w),N+=w.length),k(n,K,q);var qe=new a(E,z?e.tokenize(x,z):x,de,x);if($=C(n,K,qe),H&&C(n,$,H),q>1){var fe={cause:E+","+T,reach:B};S(t,n,s,$.prev,N,fe),m&&fe.reach>m.reach&&(m.reach=fe.reach);}}}}}}function F(){var t={value:null,prev:null,next:null},n={value:null,prev:t,next:null};t.next=n,this.head=t,this.tail=n,this.length=0;}function C(t,n,s){var l=n.next,u={value:s,prev:n,next:l};return n.next=u,l.prev=u,t.length++,u}function k(t,n,s){for(var l=n.next,u=0;u<s&&l!==t.tail;u++)l=l.next;n.next=l,l.prev=n,t.length-=u;}function L(t){for(var n=[],s=t.head.next;s!==t.tail;)n.push(s.value),s=s.next;return n}if(!r.document)return r.addEventListener&&(e.disableWorkerMessageHandler||r.addEventListener("message",function(t){var n=JSON.parse(t.data),s=n.language,l=n.code,u=n.immediateClose;r.postMessage(e.highlight(l,e.languages[s],s)),u&&r.close();},!1)),e;var y=e.util.currentScript();y&&(e.filename=y.src,y.hasAttribute("data-manual")&&(e.manual=!0));function v(){e.manual||e.highlightAll();}if(!e.manual){var b=document.readyState;b==="loading"||b==="interactive"&&y&&y.defer?document.addEventListener("DOMContentLoaded",v):window.requestAnimationFrame?window.requestAnimationFrame(v):window.setTimeout(v,16);}return e})(Ye);typeof ce<"u"&&ce.exports&&(ce.exports=p);typeof global<"u"&&(global.Prism=p);p.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};p.languages.markup.tag.inside["attr-value"].inside.entity=p.languages.markup.entity;p.languages.markup.doctype.inside["internal-subset"].inside=p.languages.markup;p.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&amp;/,"&"));});Object.defineProperty(p.languages.markup.tag,"addInlined",{value:function(f,i){var o={};o["language-"+i]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:p.languages[i]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var e={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};e["language-"+i]={pattern:/[\s\S]+/,inside:p.languages[i]};var a={};a[f]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return f}),"i"),lookbehind:!0,greedy:!0,inside:e},p.languages.insertBefore("markup","cdata",a);}});Object.defineProperty(p.languages.markup.tag,"addAttribute",{value:function(r,f){p.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[f,"language-"+f],inside:p.languages[f]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}});}});p.languages.html=p.languages.markup;p.languages.mathml=p.languages.markup;p.languages.svg=p.languages.markup;p.languages.xml=p.languages.extend("markup",{});p.languages.ssml=p.languages.xml;p.languages.atom=p.languages.xml;p.languages.rss=p.languages.xml;(function(r){var f=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+f.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+f.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+f.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+f.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:f,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var i=r.languages.markup;i&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"));})(p);p.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};p.languages.javascript=p.languages.extend("clike",{"class-name":[p.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});p.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;p.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:p.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:p.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:p.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:p.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:p.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});p.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:p.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});p.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});p.languages.markup&&(p.languages.markup.tag.addInlined("script","javascript"),p.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));p.languages.js=p.languages.javascript;(function(){if(typeof p>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading\u2026",f=function(y,v){return "\u2716 Error "+y+" while fetching file: "+v},i="\u2716 Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},e="data-src-status",a="loading",h="loaded",S="failed",F="pre[data-src]:not(["+e+'="'+h+'"]):not(['+e+'="'+a+'"])';function C(y,v,b){var t=new XMLHttpRequest;t.open("GET",y,!0),t.onreadystatechange=function(){t.readyState==4&&(t.status<400&&t.responseText?v(t.responseText):t.status>=400?b(f(t.status,t.statusText)):b(i));},t.send(null);}function k(y){var v=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(y||"");if(v){var b=Number(v[1]),t=v[2],n=v[3];return t?n?[b,Number(n)]:[b,void 0]:[b,b]}}p.hooks.add("before-highlightall",function(y){y.selector+=", "+F;}),p.hooks.add("before-sanity-check",function(y){var v=y.element;if(v.matches(F)){y.code="",v.setAttribute(e,a);var b=v.appendChild(document.createElement("CODE"));b.textContent=r;var t=v.getAttribute("data-src"),n=y.language;if(n==="none"){var s=(/\.(\w+)$/.exec(t)||[,"none"])[1];n=o[s]||s;}p.util.setLanguage(b,n),p.util.setLanguage(v,n);var l=p.plugins.autoloader;l&&l.loadLanguages(n),C(t,function(u){v.setAttribute(e,h);var m=k(v.getAttribute("data-range"));if(m){var E=u.split(/\r\n?|\n/g),g=m[0],T=m[1]==null?E.length:m[1];g<0&&(g+=E.length),g=Math.max(0,Math.min(g-1,E.length)),T<0&&(T+=E.length),T=Math.max(0,Math.min(T,E.length)),u=E.slice(g,T).join(`
2
+ `),v.hasAttribute("data-start")||v.setAttribute("data-start",String(g+1));}b.textContent=u,p.highlightElement(b);},function(u){v.setAttribute(e,S),b.textContent=u;});}}),p.plugins.fileHighlight={highlight:function(v){for(var b=(v||document).querySelectorAll(F),t=0,n;n=b[t++];)p.highlightElement(n);}};var L=!1;p.fileHighlight=function(){L||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),L=!0),p.plugins.fileHighlight.highlight.apply(this,arguments);};})();});var je=yb((re,he)=>{(function(f,i){typeof re=="object"&&typeof he=="object"?he.exports=i():typeof define=="function"&&define.amd?define([],i):typeof re=="object"?re.ClipboardJS=i():f.ClipboardJS=i();})(re,function(){return (function(){var r={686:(function(o,e,a){"use strict";a.d(e,{default:function(){return G}});var h=a(279),S=a.n(h),F=a(370),C=a.n(F),k=a(817),L=a.n(k);function y(A){try{return document.execCommand(A)}catch(c){return !1}}var v=function(c){var d=L()(c);return y("cut"),d},b=v;function t(A){var c=document.documentElement.getAttribute("dir")==="rtl",d=document.createElement("textarea");d.style.fontSize="12pt",d.style.border="0",d.style.padding="0",d.style.margin="0",d.style.position="absolute",d.style[c?"right":"left"]="-9999px";var _=window.pageYOffset||document.documentElement.scrollTop;return d.style.top="".concat(_,"px"),d.setAttribute("readonly",""),d.value=A,d}var n=function(c,d){var _=t(c);d.container.appendChild(_);var x=L()(_);return y("copy"),_.remove(),x},s=function(c){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},_="";return typeof c=="string"?_=n(c,d):c instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(c?.type)?_=n(c.value,d):(_=L()(c),y("copy")),_},l=s;function u(A){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?u=function(d){return typeof d}:u=function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},u(A)}var m=function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=c.action,_=d===void 0?"copy":d,x=c.container,w=c.target,H=c.text;if(_!=="copy"&&_!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(w!==void 0)if(w&&u(w)==="object"&&w.nodeType===1){if(_==="copy"&&w.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(_==="cut"&&(w.hasAttribute("readonly")||w.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(H)return l(H,{container:x});if(w)return _==="cut"?b(w):l(w,{container:x})},E=m;function g(A){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?g=function(d){return typeof d}:g=function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},g(A)}function T(A,c){if(!(A instanceof c))throw new TypeError("Cannot call a class as a function")}function O(A,c){for(var d=0;d<c.length;d++){var _=c[d];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(A,_.key,_);}}function z(A,c,d){return c&&O(A.prototype,c),d&&O(A,d),A}function ae(A,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(c&&c.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),c&&X(A,c);}function X(A,c){return X=Object.setPrototypeOf||function(_,x){return _.__proto__=x,_},X(A,c)}function de(A){var c=$();return function(){var _=N(A),x;if(c){var w=N(this).constructor;x=Reflect.construct(_,arguments,w);}else x=_.apply(this,arguments);return pe(this,x)}}function pe(A,c){return c&&(g(c)==="object"||typeof c=="function")?c:oe(A)}function oe(A){if(A===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function $(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return !1;if(typeof Proxy=="function")return !0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(A){return !1}}function N(A){return N=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},N(A)}function U(A,c){var d="data-clipboard-".concat(A);if(c.hasAttribute(d))return c.getAttribute(d)}var q=(function(A){ae(d,A);var c=de(d);function d(_,x){var w;return T(this,d),w=c.call(this),w.resolveOptions(x),w.listenClick(_),w}return z(d,[{key:"resolveOptions",value:function(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof x.action=="function"?x.action:this.defaultAction,this.target=typeof x.target=="function"?x.target:this.defaultTarget,this.text=typeof x.text=="function"?x.text:this.defaultText,this.container=g(x.container)==="object"?x.container:document.body;}},{key:"listenClick",value:function(x){var w=this;this.listener=C()(x,"click",function(H){return w.onClick(H)});}},{key:"onClick",value:function(x){var w=x.delegateTarget||x.currentTarget,H=this.action(w)||"copy",B=E({action:H,container:this.container,target:this.target(w),text:this.text(w)});this.emit(B?"success":"error",{action:H,text:B,trigger:w,clearSelection:function(){w&&w.focus(),window.getSelection().removeAllRanges();}});}},{key:"defaultAction",value:function(x){return U("action",x)}},{key:"defaultTarget",value:function(x){var w=U("target",x);if(w)return document.querySelector(w)}},{key:"defaultText",value:function(x){return U("text",x)}},{key:"destroy",value:function(){this.listener.destroy();}}],[{key:"copy",value:function(x){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return l(x,w)}},{key:"cut",value:function(x){return b(x)}},{key:"isSupported",value:function(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],w=typeof x=="string"?[x]:x,H=!!document.queryCommandSupported;return w.forEach(function(B){H=H&&!!document.queryCommandSupported(B);}),H}}]),d})(S()),G=q;}),828:(function(o){var e=9;if(typeof Element<"u"&&!Element.prototype.matches){var a=Element.prototype;a.matches=a.matchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector;}function h(S,F){for(;S&&S.nodeType!==e;){if(typeof S.matches=="function"&&S.matches(F))return S;S=S.parentNode;}}o.exports=h;}),438:(function(o,e,a){var h=a(828);function S(k,L,y,v,b){var t=C.apply(this,arguments);return k.addEventListener(y,t,b),{destroy:function(){k.removeEventListener(y,t,b);}}}function F(k,L,y,v,b){return typeof k.addEventListener=="function"?S.apply(null,arguments):typeof y=="function"?S.bind(null,document).apply(null,arguments):(typeof k=="string"&&(k=document.querySelectorAll(k)),Array.prototype.map.call(k,function(t){return S(t,L,y,v,b)}))}function C(k,L,y,v){return function(b){b.delegateTarget=h(b.target,L),b.delegateTarget&&v.call(k,b);}}o.exports=F;}),879:(function(o,e){e.node=function(a){return a!==void 0&&a instanceof HTMLElement&&a.nodeType===1},e.nodeList=function(a){var h=Object.prototype.toString.call(a);return a!==void 0&&(h==="[object NodeList]"||h==="[object HTMLCollection]")&&"length"in a&&(a.length===0||e.node(a[0]))},e.string=function(a){return typeof a=="string"||a instanceof String},e.fn=function(a){var h=Object.prototype.toString.call(a);return h==="[object Function]"};}),370:(function(o,e,a){var h=a(879),S=a(438);function F(y,v,b){if(!y&&!v&&!b)throw new Error("Missing required arguments");if(!h.string(v))throw new TypeError("Second argument must be a String");if(!h.fn(b))throw new TypeError("Third argument must be a Function");if(h.node(y))return C(y,v,b);if(h.nodeList(y))return k(y,v,b);if(h.string(y))return L(y,v,b);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function C(y,v,b){return y.addEventListener(v,b),{destroy:function(){y.removeEventListener(v,b);}}}function k(y,v,b){return Array.prototype.forEach.call(y,function(t){t.addEventListener(v,b);}),{destroy:function(){Array.prototype.forEach.call(y,function(t){t.removeEventListener(v,b);});}}}function L(y,v,b){return S(document.body,y,v,b)}o.exports=F;}),817:(function(o){function e(a){var h;if(a.nodeName==="SELECT")a.focus(),h=a.value;else if(a.nodeName==="INPUT"||a.nodeName==="TEXTAREA"){var S=a.hasAttribute("readonly");S||a.setAttribute("readonly",""),a.select(),a.setSelectionRange(0,a.value.length),S||a.removeAttribute("readonly"),h=a.value;}else {a.hasAttribute("contenteditable")&&a.focus();var F=window.getSelection(),C=document.createRange();C.selectNodeContents(a),F.removeAllRanges(),F.addRange(C),h=F.toString();}return h}o.exports=e;}),279:(function(o){function e(){}e.prototype={on:function(a,h,S){var F=this.e||(this.e={});return (F[a]||(F[a]=[])).push({fn:h,ctx:S}),this},once:function(a,h,S){var F=this;function C(){F.off(a,C),h.apply(S,arguments);}return C._=h,this.on(a,C,S)},emit:function(a){var h=[].slice.call(arguments,1),S=((this.e||(this.e={}))[a]||[]).slice(),F=0,C=S.length;for(F;F<C;F++)S[F].fn.apply(S[F].ctx,h);return this},off:function(a,h){var S=this.e||(this.e={}),F=S[a],C=[];if(F&&h)for(var k=0,L=F.length;k<L;k++)F[k].fn!==h&&F[k].fn._!==h&&C.push(F[k]);return C.length?S[a]=C:delete S[a],this}},o.exports=e,o.exports.TinyEmitter=e;})},f={};function i(o){if(f[o])return f[o].exports;var e=f[o]={exports:{}};return r[o](e,e.exports,i),e.exports}return (function(){i.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(e,{a:e}),e};})(),(function(){i.d=function(o,e){for(var a in e)i.o(e,a)&&!i.o(o,a)&&Object.defineProperty(o,a,{enumerable:!0,get:e[a]});};})(),(function(){i.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)};})(),i(686)})().default});});vb(Ue());(function(r){var f="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",i={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:true,alias:"punctuation",inside:null},o={bash:i,environment:{pattern:RegExp("\\$"+f),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:true,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:true},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:true,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:true,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+f),lookbehind:true,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};r.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:true},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:true,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:true},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+f),lookbehind:true,alias:"constant"}},alias:"variable",lookbehind:true},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:true},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:true,greedy:true,inside:o},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:true,greedy:true,inside:{bash:i}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:true,greedy:true,inside:o},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:true,greedy:true},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:true,inside:{entity:o.entity}}],environment:{pattern:RegExp("\\$?"+f),alias:"constant"},variable:o.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:true},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:true},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:true,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:true},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:true}},i.inside=r.languages.bash;for(var e=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=o.variable[1].inside,h=0;h<e.length;h++)a[e[h]]=r.languages.bash[e[h]];r.languages.sh=r.languages.bash,r.languages.shell=r.languages.bash;})(Prism);(function(r){r.languages.typescript=r.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:true,greedy:true,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),r.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete r.languages.typescript.parameter,delete r.languages.typescript["literal-property"];var f=r.languages.extend("typescript",{});delete f["class-name"],r.languages.typescript["class-name"].inside=f,r.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:true,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:f}}}}),r.languages.ts=r.languages.typescript;})(Prism);var Be=vb(je());var Ve=(r,f)=>f.title,Xe=(r,f)=>f.file;function We(r,f){r&1&&TT(0," Loading... ");}function Ze(r,f){r&1&&TT(0," Table of Content ");}function Ke(r,f){r&1&&(Pi(0,"button",12),TT(1,"Error loading menu"),ul());}function Je(r,f){r&1&&(Pi(0,"button",12),TT(1,"No help entries"),ul());}function Qe(r,f){if(r&1){let i=Fw();Pi(0,"button",15),Qh("click",function(){let e=ud(i).$implicit,a=qw(5);return dd(a.selectFile(e.file))}),TT(1),ul();}if(r&2){let i=f.$implicit,o=qw(5);Bh("disabled",o.selectedFile()===i.file),EE(),gl(" ",i.title," ");}}function et(r,f){if(r&1&&(Pi(0,"button",14),TT(1),ul(),xw(2,Qe,2,2,"button",13,Xe)),r&2){let i=qw().$implicit;EE(),gg(i.title),EE(),Aw(i.items);}}function tt(r,f){if(r&1){let i=Fw();Pi(0,"button",15),Qh("click",function(){ud(i);let e=qw().$implicit,a=qw(3);return dd(a.selectFile(e.file))}),TT(1),ul();}if(r&2){let i=qw().$implicit,o=qw(3);Bh("disabled",o.selectedFile()===i.file),EE(),gl(" ",i.title," ");}}function nt(r,f){if(r&1&&_w(0,et,4,1)(1,tt,2,2,"button",13),r&2){let i=f.$implicit,o=qw(3);Mw(o.isGroup(i)?0:1);}}function it(r,f){if(r&1&&xw(0,nt,2,1,null,null,Ve),r&2){let i=qw(2);Aw(i.helpMenuItems());}}function rt(r,f){if(r&1){let i=Fw();Pi(0,"button",15),Qh("click",function(){let e=ud(i).$implicit,a=qw(5);return dd(a.selectFile(e.file))}),TT(1),ul();}if(r&2){let i=f.$implicit,o=qw(5);Bh("disabled",o.selectedFile()===i.file),EE(),gl(" ",i.title," ");}}function at(r,f){if(r&1&&(Pi(0,"button",16),TT(1),ul(),Pi(2,"mat-menu",17,1),xw(4,rt,2,2,"button",13,Xe),ul()),r&2){let i=Jw(3),o=qw().$implicit;Bh("matMenuTriggerFor",i),EE(),gg(o.title),EE(),Bh("overlapTrigger",false),EE(2),Aw(o.items);}}function ot(r,f){if(r&1){let i=Fw();Pi(0,"button",15),Qh("click",function(){ud(i);let e=qw().$implicit,a=qw(3);return dd(a.selectFile(e.file))}),TT(1),ul();}if(r&2){let i=qw().$implicit,o=qw(3);Bh("disabled",o.selectedFile()===i.file),EE(),gl(" ",i.title," ");}}function st(r,f){if(r&1&&_w(0,at,6,3)(1,ot,2,2,"button",13),r&2){let i=f.$implicit,o=qw(3);Mw(o.isGroup(i)?0:1);}}function lt(r,f){if(r&1&&xw(0,st,2,1,null,null,Ve),r&2){let i=qw(2);Aw(i.helpMenuItems());}}function ut(r,f){if(r&1&&_w(0,Ke,2,0,"button",12)(1,Je,2,0,"button",12)(2,it,2,0)(3,lt,2,0),r&2){let i=qw();Mw(i.hasError()?0:!i.isLoading()&&i.helpFiles().length===0?1:i.isMobileMenuMode()?2:3);}}function ct(r,f){r&1&&(Pi(0,"div",11),TT(1,"Unable to load help content."),ul());}function dt(r,f){r&1&&(Pi(0,"div",11),TT(1,"Loading help..."),ul());}function pt(r,f){if(r&1&&(Pi(0,"div",11),$h(1,"markdown",18),ul()),r&2){let i=qw();EE(),Bh("src",`assets/help-docs/${i.selectedFile()}`);}}window.ClipboardJS=Be.default;var $t=(()=>{class r{pageTitle="Help";_router=w(G);_route=w(V);_destroyRef=w(xe);_isMobileMenuMode=vt(this.detectMobileMenuMode());_selectedPageFromRoute=Wp(this._route.paramMap.pipe(ke(i=>i.get("page"))),{initialValue:null});constructor(){let i=this.getMobileMenuMediaQuery();if(i===null)return;this._isMobileMenuMode.set(i.matches);let o=e=>{this._isMobileMenuMode.set(e.matches);};i.addEventListener("change",o),this._destroyRef.onDestroy(()=>{i.removeEventListener("change",o);});}_helpMenuRes=Xl(()=>"assets/help-docs/menu.json");helpMenuItems=Dt(()=>this._helpMenuRes.hasValue()?this.normalizeMenu(this._helpMenuRes.value()??[]):[]);helpFiles=Dt(()=>{let i=this.helpMenuItems();return i.length===0?[]:i.flatMap(o=>this.isGroup(o)?o.items:[o])});selectedFile=vt("");_syncEffect=Fa(()=>{let i=this.helpFiles(),o=this._selectedPageFromRoute();if(i.length===0)return;let e=this.resolveSelectedFile(o,i);this.selectedFile()!==e&&this.selectedFile.set(e);});hasError=Dt(()=>this._helpMenuRes.error()!=null);isLoading=Dt(()=>this._helpMenuRes.isLoading());isMobileMenuMode=Dt(()=>this._isMobileMenuMode());isGroup(i){return "items"in i}selectFile(i){this.selectedFile.set(i),this._router.navigate(["/help",this.toPageSegment(i)]);}backPage(){this._router.navigate(["/settings"]);}closePage(){this._router.navigate(["/dashboard"]);}resolveSelectedFile(i,o){if(i){let e=i.endsWith(".md")?i:`${i}.md`,a=o.find(h=>h.file===e);if(a)return a.file}return o[0].file}toPageSegment(i){return i.endsWith(".md")?i.slice(0,-3):i}normalizeMenu(i){let o=[];return i.forEach(e=>{let a=(e.title??"").trim();if(Array.isArray(e.items)){let h=e.items.filter(this.isValidLeaf).filter(S=>S.file.endsWith(".md")).map(S=>({title:S.title.trim(),file:S.file.trim()}));if(!a||h.length===0)return;o.push({title:a,items:h});return}this.isValidLeaf(e)&&e.file.endsWith(".md")&&o.push({title:e.title.trim(),file:e.file.trim()});}),o}isValidLeaf(i){return typeof i.title=="string"&&i.title.trim().length>0&&typeof i.file=="string"&&i.file.trim().length>0}detectMobileMenuMode(){return this.getMobileMenuMediaQuery()?.matches??false}getMobileMenuMediaQuery(){return typeof window>"u"||typeof window.matchMedia!="function"?null:window.matchMedia("(max-width: 900px), (hover: none) and (pointer: coarse)")}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=JD({type:r,selectors:[["app-help"]],decls:22,vars:9,consts:[["helpMenu","matMenu"],["childMenu","matMenu"],[1,"fullpage-header"],[1,"page-icon"],["svgIcon","help-center","aria-hidden","false"],[1,"page-title"],["mat-flat-button","",3,"matMenuTriggerFor","disabled"],[1,"help-menu-panel"],["matMenuContent",""],[1,"dialog-close-icon"],["mat-icon-button","",3,"click"],[1,"markdown-content"],["mat-menu-item","","disabled",""],["mat-menu-item","",3,"disabled"],["mat-menu-item","","disabled","",1,"help-menu-group-title"],["mat-menu-item","",3,"click","disabled"],["mat-menu-item","",3,"matMenuTriggerFor"],[1,"help-menu-panel",3,"overlapTrigger"],["clipboard","",3,"src"]],template:function(o,e){if(o&1&&(Pi(0,"div",2)(1,"div",3),$h(2,"mat-icon",4),Pi(3,"h6",5),TT(4),ul()(),Pi(5,"button",6),_w(6,We,1,0)(7,Ze,1,0),ul(),Pi(8,"mat-menu",7,0),xh(10,ut,4,1,"ng-template",8),ul(),Pi(11,"div",9)(12,"button",10),Qh("click",function(){return e.backPage()}),Pi(13,"mat-icon"),TT(14,"arrow_back_ios"),ul()(),Pi(15,"button",10),Qh("click",function(){return e.closePage()}),Pi(16,"mat-icon"),TT(17,"close"),ul()()()(),$h(18,"mat-divider"),_w(19,ct,2,0,"div",11)(20,dt,2,0,"div",11)(21,pt,2,1,"div",11)),o&2){let a=Jw(9);EE(2),ig("width",24,"px")("height",24,"px"),EE(2),gg(e.pageTitle),EE(),Bh("matMenuTriggerFor",a)("disabled",e.isLoading()||e.hasError()||e.helpFiles().length===0),EE(),Mw(e.isLoading()?6:7),EE(13),Mw(e.hasError()?19:e.isLoading()&&e.helpFiles().length===0?20:e.selectedFile()?21:-1);}},dependencies:[Un,Op,xp,eu,Ht,R,ee,Nt,Lt,f,u,yt,wt],styles:[".fullpage-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.page-icon[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center;margin-left:15px}.page-title[_ngcontent-%COMP%]{margin-block-start:0px;margin-block-end:0px;padding:18px 0 13px 5px;color:var(--mat-dialog-subhead-color, var(--mat-sys-on-surface, rgba(0, 0, 0, .87)));font-family:var(--mat-dialog-subhead-font, var(--mat-sys-headline-small-font, inherit));line-height:var(--mat-dialog-subhead-line-height, var(--mat-sys-headline-small-line-height, 1.5rem));font-size:var(--mat-dialog-subhead-size, var(--mat-sys-headline-small-size, 1rem));font-weight:var(--mat-dialog-subhead-weight, var(--mat-sys-headline-small-weight, 400));letter-spacing:var(--mat-dialog-subhead-tracking, var(--mat-sys-headline-small-tracking, .03125em))}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}.dialog-close-icon[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:nowrap;gap:5px;padding-right:15px}.help-menu-group-title[_ngcontent-%COMP%]{font-weight:600;opacity:.9} .mat-mdc-menu-panel.help-menu-panel{border:1px solid var(--mat-sys-outline);background:var(--mat-sys-surface-container-high)} .markdown-content{display:block;height:calc(100% - 75px);width:100%;overflow-x:scroll;padding:25px;font-size:1.1rem;line-height:1.7;background:var(--mat-sys-surface-container, #fff);color:var(--mat-sys-on-surface, #222);border-radius:12px;box-shadow:0 2px 8px #00000012;max-width:900px;margin:0 auto} .markdown-content h1, .markdown-content h2, .markdown-content h3, .markdown-content h4{color:var(--mat-sys-primary, #1976d2);margin-top:1.5em;margin-bottom:.5em;font-weight:600} .markdown-content pre{padding:1em;overflow-x:auto} .markdown-content table{border:1px solid var(--mat-sys-on-background);border-collapse:collapse;width:100%;margin:1em 0} .markdown-content table td{border:1px solid var(--mat-sys-on-background);padding:8px;text-align:left} .markdown-content th{color:var(--mat-sys-primary, #1976d2);font-weight:600;padding:.5em 1em;border:2px solid var(--mat-sys-primary, #1976d2);text-align:left} .markdown-content table tr:nth-child(2n){background-color:var(--mat-sys-surface-container-high)} .markdown-content a{color:var(--mat-sys-primary, #1976d2);text-decoration:underline} .markdown-content a:hover{text-decoration:none;color:var(--mat-sys-secondary, #005fa3)} .markdown-content ul, .markdown-content ol{margin-left:2em;margin-bottom:1em} .markdown-content blockquote{border-left:4px solid var(--mat-sys-tertiary);background:var(--mat-sys-on-tertiary-fixed-variant);padding:.5em 1em;color:var(--mat-sys-on-surface-variant, #555);margin:1em 0}"]})}return r})();export{$t as AppHelpComponent};