@signalk/freeboard-sk 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/plugin/weather.js +29 -6
- package/public/598.a0a90f61d13c66a3.js +1 -0
- package/public/index.html +1 -1
- package/public/main.94ec7a510fb63b81.js +1 -0
- package/public/{runtime.a90421401f731c93.js → runtime.08383444e0508713.js} +1 -1
- package/public/598.8a09c61a19d53eb1.js +0 -1
- package/public/main.3ccffb5b54c839e3.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalk/freeboard-sk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Openlayers chart plotter implementation for Signal K",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"signalk-webapp",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"proj4": "2.6.2",
|
|
88
88
|
"protractor": "~7.0.0",
|
|
89
89
|
"rxjs": "~6.6.3",
|
|
90
|
-
"signalk-client-angular": "^2.0.
|
|
90
|
+
"signalk-client-angular": "^2.0.2",
|
|
91
91
|
"signalk-worker-angular": "^1.1.4",
|
|
92
92
|
"simplify-ts": "^1.0.2",
|
|
93
93
|
"ts-node": "~7.0.0",
|
package/plugin/weather.js
CHANGED
|
@@ -7,14 +7,17 @@ const openweather_1 = require("./lib/openweather");
|
|
|
7
7
|
const noaa_1 = require("./lib/noaa");
|
|
8
8
|
let server;
|
|
9
9
|
let pluginId;
|
|
10
|
+
const wakeInterval = 60000;
|
|
10
11
|
let lastFetch; // last successful fetch
|
|
11
12
|
const fetchInterval = 3600000; // 1hr
|
|
12
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
14
|
let timer;
|
|
14
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
16
|
let retryTimer;
|
|
16
|
-
const
|
|
17
|
+
const retryInterval = 10000; // time to wait after a failed api request
|
|
18
|
+
const retryCountMax = 3; // max number of retries on failed api connection
|
|
17
19
|
let retryCount = 0; // number of retries on failed api connection
|
|
20
|
+
let noPosRetryCount = 0; // number of retries on no position detected
|
|
18
21
|
let weatherData;
|
|
19
22
|
let weatherService;
|
|
20
23
|
exports.WEATHER_SERVICES = ['openweather', 'noaa'];
|
|
@@ -76,13 +79,28 @@ const fetchWeatherData = () => {
|
|
|
76
79
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
80
|
const pos = server.getSelfPath('navigation.position');
|
|
78
81
|
if (!pos) {
|
|
82
|
+
// try <noPosRetryCount> of times to detect vessel position
|
|
79
83
|
server.debug(`*** Weather: No vessel position detected!`);
|
|
80
|
-
|
|
84
|
+
if (noPosRetryCount >= 3) {
|
|
85
|
+
server.debug(`*** Weather: Maximum number of retries to detect vessel position!... sleeping.`);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
noPosRetryCount++;
|
|
89
|
+
retryTimer = setTimeout(() => {
|
|
90
|
+
server.debug(`*** Weather: RETRY = ${noPosRetryCount} after no vessel position detected!`);
|
|
91
|
+
fetchWeatherData();
|
|
92
|
+
}, 5000);
|
|
81
93
|
return;
|
|
82
94
|
}
|
|
95
|
+
server.debug(`*** Vessel position: ${JSON.stringify(pos.value)}.`);
|
|
96
|
+
noPosRetryCount = 0;
|
|
97
|
+
if (retryTimer) {
|
|
98
|
+
clearTimeout(retryTimer);
|
|
99
|
+
}
|
|
83
100
|
if (lastFetch) {
|
|
84
|
-
|
|
85
|
-
|
|
101
|
+
const e = Date.now() - lastFetch;
|
|
102
|
+
if (e < fetchInterval) {
|
|
103
|
+
server.debug(`*** Weather: Next poll due in ${Math.round((fetchInterval - e) / 60000)} min(s)... sleep for ${wakeInterval / 1000} secs...`);
|
|
86
104
|
return;
|
|
87
105
|
}
|
|
88
106
|
}
|
|
@@ -90,6 +108,7 @@ const fetchWeatherData = () => {
|
|
|
90
108
|
retryCount++;
|
|
91
109
|
server.debug(`*** Weather: Calling service API.....(attempt: ${retryCount})`);
|
|
92
110
|
server.debug(`Position: ${JSON.stringify(pos.value)}`);
|
|
111
|
+
server.debug(`*** Weather: polling weather provider.`);
|
|
93
112
|
weatherService
|
|
94
113
|
.fetchData(pos.value)
|
|
95
114
|
.then((data) => {
|
|
@@ -98,13 +117,17 @@ const fetchWeatherData = () => {
|
|
|
98
117
|
retryCount = 0;
|
|
99
118
|
lastFetch = Date.now();
|
|
100
119
|
weatherData = data;
|
|
101
|
-
timer = setInterval(() =>
|
|
120
|
+
timer = setInterval(() => {
|
|
121
|
+
server.debug(`*** Weather: wake from sleep....poll provider.`);
|
|
122
|
+
fetchWeatherData();
|
|
123
|
+
}, wakeInterval);
|
|
102
124
|
checkForWarnings();
|
|
103
125
|
})
|
|
104
126
|
.catch((err) => {
|
|
127
|
+
server.debug(`*** Weather: ERROR polling weather provider! (retry in ${retryInterval / 1000} sec)`);
|
|
105
128
|
server.debug(err.message);
|
|
106
129
|
// sleep and retry
|
|
107
|
-
retryTimer = setTimeout(() => fetchWeatherData(),
|
|
130
|
+
retryTimer = setTimeout(() => fetchWeatherData(), retryInterval);
|
|
108
131
|
});
|
|
109
132
|
}
|
|
110
133
|
else {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var Cp={7887:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=M(v(6984)),S=M(v(5010)),w=M(v(9601)),N=M(v(8302)),D=v(964);function M(h){return h&&h.__esModule?h:{default:h}}f.default=function(y,_,I){var T=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6371e3,A=(0,C.default)(y),L=(0,S.default)(y),J=_/T,le=(0,w.default)(I),ye=(0,w.default)(A),se=(0,w.default)(L),Oe=Math.asin(Math.sin(ye)*Math.cos(J)+Math.cos(ye)*Math.sin(J)*Math.cos(le)),Ne=se+Math.atan2(Math.sin(le)*Math.sin(J)*Math.cos(ye),Math.cos(J)-Math.sin(ye)*Math.sin(Oe)),me=(0,N.default)(Ne);return(me<D.MINLON||me>D.MAXLON)&&(Ne=(Ne+3*Math.PI)%(2*Math.PI)-Math.PI,me=(0,N.default)(Ne)),{latitude:(0,N.default)(Oe),longitude:me}}},964:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.areaConversion=f.timeConversion=f.distanceConversion=f.altitudeKeys=f.latitudeKeys=f.longitudeKeys=f.MAXLON=f.MINLON=f.MAXLAT=f.MINLAT=f.earthRadius=f.sexagesimalPattern=void 0,f.sexagesimalPattern=/^([0-9]{1,3})\xb0\s*([0-9]{1,3}(?:\.(?:[0-9]{1,}))?)['\u2032]\s*(([0-9]{1,3}(\.([0-9]{1,}))?)["\u2033]\s*)?([NEOSW]?)$/,f.earthRadius=6378137,f.MINLAT=-90,f.MAXLAT=90,f.MINLON=-180,f.MAXLON=180,f.longitudeKeys=["lng","lon","longitude",0],f.latitudeKeys=["lat","latitude",1],f.altitudeKeys=["alt","altitude","elevation","elev",2],f.distanceConversion={m:1,km:.001,cm:100,mm:1e3,mi:1/1609.344,sm:1/1852.216,ft:100/30.48,in:100/2.54,yd:1/.9144},f.timeConversion={m:60,h:3600,d:86400};var _={m2:1,km2:1e-6,ha:1e-4,a:.01,ft2:10.763911,yd2:1.19599,in2:1550.0031};f.areaConversion=_,_.sqm=_.m2,_.sqkm=_.km2,_.sqft=_.ft2,_.sqyd=_.yd2,_.sqin=_.in2},8315:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(964);f.default=function(D){var M=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m",p=C.areaConversion[M];if(p)return D*p;throw new Error("Invalid unit used for area conversion.")}},713:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(964);f.default=function(D){var M=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m",p=C.distanceConversion[M];if(p)return D*p;throw new Error("Invalid unit used for distance conversion.")}},9173:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(964);f.default=function(D){var M=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kmh";switch(M){case"kmh":return D*C.timeConversion.h*C.distanceConversion.km;case"mph":return D*C.timeConversion.h*C.distanceConversion.mi;default:return D}}},4974:(F,f)=>{function v(h,y){return function D(h){if(Array.isArray(h))return h}(h)||function N(h,y){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(h)){var _=[],I=!0,T=!1,A=void 0;try{for(var J,L=h[Symbol.iterator]();!(I=(J=L.next()).done)&&(_.push(J.value),!y||_.length!==y);I=!0);}catch(le){T=!0,A=le}finally{try{!I&&null!=L.return&&L.return()}finally{if(T)throw A}}return _}}(h,y)||function S(h,y){if(h){if("string"==typeof h)return w(h,y);var _=Object.prototype.toString.call(h).slice(8,-1);if("Object"===_&&h.constructor&&(_=h.constructor.name),"Map"===_||"Set"===_)return Array.from(h);if("Arguments"===_||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_))return w(h,y)}}(h,y)||function C(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(h,y){(null==y||y>h.length)&&(y=h.length);for(var _=0,I=new Array(y);_<y;_++)I[_]=h[_];return I}Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(y){var I=v(y.toString().split("."),2),A=I[1],L=Math.abs(Number(I[0])),J=60*Number("0."+(A||0)),le=J.toString().split("."),ye=Math.floor(J),se=function(y){var I=Math.pow(10,arguments.length>1&&void 0!==arguments[1]?arguments[1]:4);return Math.round(y*I)/I}(60*Number("0."+(le[1]||0))).toString(),Ne=v(se.split("."),2),me=Ne[0],fe=Ne[1],Ie=void 0===fe?"0":fe;return L+"\xb0 "+ye.toString().padStart(2,"0")+"' "+me.padStart(2,"0")+"."+Ie.padEnd(1,"0")+'"'}},1675:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function S(D){return D&&D.__esModule?D:{default:D}}(v(8252));f.default=function(M,p){return(0,C.default)(M,p)[0]}},4434:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(9601)),S=D(v(6984)),w=D(v(5010)),N=v(964);function D(m){return m&&m.__esModule?m:{default:m}}f.default=function(h){var y=0;if(h.length>2){for(var _,I,T,A=0;A<h.length;A++){A===h.length-2?(_=h.length-2,I=h.length-1,T=0):A===h.length-1?(_=h.length-1,I=0,T=1):(_=A,I=A+1,T=A+2);var L=(0,w.default)(h[_]),J=(0,S.default)(h[I]),le=(0,w.default)(h[T]);y+=((0,C.default)(le)-(0,C.default)(L))*Math.sin((0,C.default)(J))}y=y*N.earthRadius*N.earthRadius/2}return Math.abs(y)}},5744:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=w(v(6984)),S=w(v(5010));function w(M){return M&&M.__esModule?M:{default:M}}f.default=function(p){if(!1===Array.isArray(p)||0===p.length)throw new Error("No points were given.");return p.reduce(function(m,h){var y=(0,C.default)(h),_=(0,S.default)(h);return{maxLat:Math.max(y,m.maxLat),minLat:Math.min(y,m.minLat),maxLng:Math.max(_,m.maxLng),minLng:Math.min(_,m.minLng)}},{maxLat:-1/0,minLat:1/0,maxLng:-1/0,minLng:1/0})}},2908:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=M(v(6984)),S=M(v(5010)),w=M(v(9601)),N=M(v(8302)),D=v(964);function M(h){return h&&h.__esModule?h:{default:h}}f.default=function(y,_){var fe,Ie,I=(0,C.default)(y),T=(0,S.default)(y),A=(0,w.default)(I),L=(0,w.default)(T),J=_/D.earthRadius,le=A-J,ye=A+J,se=(0,w.default)(D.MAXLAT),Oe=(0,w.default)(D.MINLAT),Ne=(0,w.default)(D.MAXLON),me=(0,w.default)(D.MINLON);if(le>Oe&&ye<se){var Me=Math.asin(Math.sin(J)/Math.cos(A));(fe=L-Me)<me&&(fe+=2*Math.PI),(Ie=L+Me)>Ne&&(Ie-=2*Math.PI)}else le=Math.max(le,Oe),ye=Math.min(ye,se),fe=me,Ie=Ne;return[{latitude:(0,N.default)(le),longitude:(0,N.default)(fe)},{latitude:(0,N.default)(ye),longitude:(0,N.default)(Ie)}]}},5582:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(6984)),S=D(v(5010)),w=D(v(9601)),N=D(v(8302));function D(m){return m&&m.__esModule?m:{default:m}}f.default=function(h){if(!1===Array.isArray(h)||0===h.length)return!1;var y=h.length,_=h.reduce(function(L,J){var le=(0,w.default)((0,C.default)(J)),ye=(0,w.default)((0,S.default)(J));return{X:L.X+Math.cos(le)*Math.cos(ye),Y:L.Y+Math.cos(le)*Math.sin(ye),Z:L.Z+Math.sin(le)}},{X:0,Y:0,Z:0}),I=_.X/y,T=_.Y/y,A=_.Z/y;return{longitude:(0,N.default)(Math.atan2(T,I)),latitude:(0,N.default)(Math.atan2(A,Math.sqrt(I*I+T*T)))}}},6963:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function S(D){return D&&D.__esModule?D:{default:D}}(v(5744));f.default=function(M){var p=(0,C.default)(M),h=p.minLng+(p.maxLng-p.minLng)/2;return{latitude:parseFloat((p.minLat+(p.maxLat-p.minLat)/2).toFixed(6)),longitude:parseFloat(h.toFixed(6))}}},4629:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function S(D){return D&&D.__esModule?D:{default:D}}(v(2571));f.default=function(M,p){var m=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C.default,h="function"==typeof m?m(M,p):(0,C.default)(M,p);if(isNaN(h))throw new Error("Could not calculate bearing for given points. Check your bearing function");switch(Math.round(h/22.5)){case 1:return"NNE";case 2:return"NE";case 3:return"ENE";case 4:return"E";case 5:return"ESE";case 6:return"SE";case 7:return"SSE";case 8:return"S";case 9:return"SSW";case 10:return"SW";case 11:return"WSW";case 12:return"W";case 13:return"WNW";case 14:return"NW";case 15:return"NNW";default:return"N"}}},8839:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w,N){return N.reduce(function(D,M){if(null==w)throw new Error("'".concat(w,"' is no valid coordinate."));return Object.prototype.hasOwnProperty.call(w,M)&&void 0!==M&&void 0===D?(D=M,M):D},void 0)}},804:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(964),S=function w(h){return h&&h.__esModule?h:{default:h}}(v(8839));function N(h,y){var _=Object.keys(h);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(h);y&&(I=I.filter(function(T){return Object.getOwnPropertyDescriptor(h,T).enumerable})),_.push.apply(_,I)}return _}function D(h){for(var y=1;y<arguments.length;y++){var _=null!=arguments[y]?arguments[y]:{};y%2?N(Object(_),!0).forEach(function(I){M(h,I,_[I])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(_)):N(Object(_)).forEach(function(I){Object.defineProperty(h,I,Object.getOwnPropertyDescriptor(_,I))})}return h}function M(h,y,_){return y in h?Object.defineProperty(h,y,{value:_,enumerable:!0,configurable:!0,writable:!0}):h[y]=_,h}f.default=function(y){var _=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{longitude:C.longitudeKeys,latitude:C.latitudeKeys,altitude:C.altitudeKeys},I=(0,S.default)(y,_.longitude),T=(0,S.default)(y,_.latitude),A=(0,S.default)(y,_.altitude);return D({latitude:T,longitude:I},A?{altitude:A}:{})}},9068:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=M(v(6984)),S=M(v(5010)),w=M(v(9601)),N=M(v(7148)),D=v(964);function M(h){return h&&h.__esModule?h:{default:h}}f.default=function(y,_){var I=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;I=void 0===I||isNaN(I)?1:I;var T=(0,C.default)(y),A=(0,S.default)(y),L=(0,C.default)(_),J=(0,S.default)(_),le=Math.acos((0,N.default)(Math.sin((0,w.default)(L))*Math.sin((0,w.default)(T))+Math.cos((0,w.default)(L))*Math.cos((0,w.default)(T))*Math.cos((0,w.default)(A)-(0,w.default)(J))))*D.earthRadius;return Math.round(le/I)*I}},1599:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=w(v(9068)),S=w(v(7148));function w(M){return M&&M.__esModule?M:{default:M}}f.default=function(p,m,h){var y=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,_=(0,C.default)(m,p,y),I=(0,C.default)(p,h,y),T=(0,C.default)(m,h,y),A=Math.acos((0,S.default)((_*_+T*T-I*I)/(2*_*T))),L=Math.acos((0,S.default)((I*I+T*T-_*_)/(2*I*T)));return A>Math.PI/2?_:L>Math.PI/2?I:Math.sin(A)*_}},8172:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(6984)),S=D(v(5010)),w=D(v(9601)),N=D(v(8302));function D(m){return m&&m.__esModule?m:{default:m}}f.default=function(h,y){var _=(0,C.default)(y),I=(0,S.default)(y),T=(0,C.default)(h),A=(0,S.default)(h);return((0,N.default)(Math.atan2(Math.sin((0,w.default)(I)-(0,w.default)(A))*Math.cos((0,w.default)(_)),Math.cos((0,w.default)(T))*Math.sin((0,w.default)(_))-Math.sin((0,w.default)(T))*Math.cos((0,w.default)(_))*Math.cos((0,w.default)(I)-(0,w.default)(A))))+360)%360}},6984:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(964),S=N(v(8839)),w=N(v(1450));function N(p){return p&&p.__esModule?p:{default:p}}f.default=function(m,h){var y=(0,S.default)(m,C.latitudeKeys);if(null!=y){var _=m[y];return!0===h?_:(0,w.default)(_)}}},5010:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(964),S=N(v(8839)),w=N(v(1450));function N(p){return p&&p.__esModule?p:{default:p}}f.default=function(m,h){var y=(0,S.default)(m,C.longitudeKeys);if(null!=y){var _=m[y];return!0===h?_:(0,w.default)(_)}}},5482:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function S(M){return M&&M.__esModule?M:{default:M}}(v(9068));function w(M){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(m){return typeof m}:function(m){return m&&"function"==typeof Symbol&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m})(M)}f.default=function(p){var m=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C.default;return p.reduce(function(h,y){return"object"===w(h)&&null!==h.last&&(h.distance+=m(y,h.last)),h.last=y,h},{last:null,distance:0}).distance}},6952:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(6984)),S=D(v(5010)),w=D(v(9601)),N=v(964);function D(m){return m&&m.__esModule?m:{default:m}}f.default=function(h,y){var _=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;_=void 0===_||isNaN(_)?1:_;var se,Oe,Ne,me,fe,Ie,vn,I=(0,C.default)(h),T=(0,S.default)(h),A=(0,C.default)(y),L=(0,S.default)(y),J=6356752.314245,le=1/298.257223563,ye=(0,w.default)(L-T),Me=Math.atan((1-le)*Math.tan((0,w.default)(parseFloat(I)))),Xt=Math.atan((1-le)*Math.tan((0,w.default)(parseFloat(A)))),Ht=Math.sin(Me),Bt=Math.cos(Me),Ut=Math.sin(Xt),vt=Math.cos(Xt),yt=ye,yn=100;do{var _t=Math.sin(yt),_n=Math.cos(yt);if(0===(Ie=Math.sqrt(vt*_t*(vt*_t)+(Bt*Ut-Ht*vt*_n)*(Bt*Ut-Ht*vt*_n))))return 0;se=Ht*Ut+Bt*vt*_n,Oe=Math.atan2(Ie,se),fe=se-2*Ht*Ut/(me=1-(Ne=Bt*vt*_t/Ie)*Ne),isNaN(fe)&&(fe=0);var en=le/16*me*(4+le*(4-3*me));vn=yt,yt=ye+(1-en)*le*Ne*(Oe+en*Ie*(fe+en*se*(2*fe*fe-1)))}while(Math.abs(yt-vn)>1e-12&&--yn>0);if(0===yn)return NaN;var nt=me*(N.earthRadius*N.earthRadius-J*J)/(J*J),bn=1+nt/16384*(4096+nt*(nt*(320-175*nt)-768)),Wt=nt/1024*(256+nt*(nt*(74-47*nt)-128)),In=Wt*Ie*(fe+Wt/4*(se*(2*fe*fe-1)-Wt/6*fe*(4*Ie*Ie-3)*(4*fe*fe-3))),Dn=J*bn*(Oe-In);return Math.round(Dn/_)*_}},2571:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(6984)),S=D(v(5010)),w=D(v(9601)),N=D(v(8302));function D(m){return m&&m.__esModule?m:{default:m}}f.default=function(h,y){var _=(0,w.default)((0,S.default)(y))-(0,w.default)((0,S.default)(h)),I=Math.log(Math.tan((0,w.default)((0,C.default)(y))/2+Math.PI/4)/Math.tan((0,w.default)((0,C.default)(h))/2+Math.PI/4));return Math.abs(_)>Math.PI&&(_=_>0?-1*(2*Math.PI-_):2*Math.PI+_),((0,N.default)(Math.atan2(_,I))+360)%360}},9558:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){return/^NNE|NE|NNW|N$/.test(w)?"N":/^ENE|E|ESE|SE$/.test(w)?"E":/^SSE|S|SSW|SW$/.test(w)?"S":/^WSW|W|WNW|NW$/.test(w)?"W":void 0}},3430:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function S(D){return D&&D.__esModule?D:{default:D}}(v(9068));f.default=function(M,p){var m=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C.default,h=m(M,p),y=Number(p.time)-Number(M.time),_=h/y*1e3;return _}},5026:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0});var C={computeDestinationPoint:!0,convertArea:!0,convertDistance:!0,convertSpeed:!0,decimalToSexagesimal:!0,findNearest:!0,getAreaOfPolygon:!0,getBounds:!0,getBoundsOfDistance:!0,getCenter:!0,getCenterOfBounds:!0,getCompassDirection:!0,getCoordinateKey:!0,getCoordinateKeys:!0,getDistance:!0,getDistanceFromLine:!0,getGreatCircleBearing:!0,getLatitude:!0,getLongitude:!0,getPathLength:!0,getPreciseDistance:!0,getRhumbLineBearing:!0,getRoughCompassDirection:!0,getSpeed:!0,isDecimal:!0,isPointInLine:!0,isPointInPolygon:!0,isPointNearLine:!0,isPointWithinRadius:!0,isSexagesimal:!0,isValidCoordinate:!0,isValidLatitude:!0,isValidLongitude:!0,orderByDistance:!0,sexagesimalToDecimal:!0,toDecimal:!0,toRad:!0,toDeg:!0,wktToPolygon:!0};Object.defineProperty(f,"computeDestinationPoint",{enumerable:!0,get:function(){return S.default}}),Object.defineProperty(f,"convertArea",{enumerable:!0,get:function(){return w.default}}),Object.defineProperty(f,"convertDistance",{enumerable:!0,get:function(){return N.default}}),Object.defineProperty(f,"convertSpeed",{enumerable:!0,get:function(){return D.default}}),Object.defineProperty(f,"decimalToSexagesimal",{enumerable:!0,get:function(){return M.default}}),Object.defineProperty(f,"findNearest",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(f,"getAreaOfPolygon",{enumerable:!0,get:function(){return m.default}}),Object.defineProperty(f,"getBounds",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(f,"getBoundsOfDistance",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(f,"getCenter",{enumerable:!0,get:function(){return _.default}}),Object.defineProperty(f,"getCenterOfBounds",{enumerable:!0,get:function(){return I.default}}),Object.defineProperty(f,"getCompassDirection",{enumerable:!0,get:function(){return T.default}}),Object.defineProperty(f,"getCoordinateKey",{enumerable:!0,get:function(){return A.default}}),Object.defineProperty(f,"getCoordinateKeys",{enumerable:!0,get:function(){return L.default}}),Object.defineProperty(f,"getDistance",{enumerable:!0,get:function(){return J.default}}),Object.defineProperty(f,"getDistanceFromLine",{enumerable:!0,get:function(){return le.default}}),Object.defineProperty(f,"getGreatCircleBearing",{enumerable:!0,get:function(){return ye.default}}),Object.defineProperty(f,"getLatitude",{enumerable:!0,get:function(){return se.default}}),Object.defineProperty(f,"getLongitude",{enumerable:!0,get:function(){return Oe.default}}),Object.defineProperty(f,"getPathLength",{enumerable:!0,get:function(){return Ne.default}}),Object.defineProperty(f,"getPreciseDistance",{enumerable:!0,get:function(){return me.default}}),Object.defineProperty(f,"getRhumbLineBearing",{enumerable:!0,get:function(){return fe.default}}),Object.defineProperty(f,"getRoughCompassDirection",{enumerable:!0,get:function(){return Ie.default}}),Object.defineProperty(f,"getSpeed",{enumerable:!0,get:function(){return Me.default}}),Object.defineProperty(f,"isDecimal",{enumerable:!0,get:function(){return Xt.default}}),Object.defineProperty(f,"isPointInLine",{enumerable:!0,get:function(){return Ht.default}}),Object.defineProperty(f,"isPointInPolygon",{enumerable:!0,get:function(){return Bt.default}}),Object.defineProperty(f,"isPointNearLine",{enumerable:!0,get:function(){return Ut.default}}),Object.defineProperty(f,"isPointWithinRadius",{enumerable:!0,get:function(){return vt.default}}),Object.defineProperty(f,"isSexagesimal",{enumerable:!0,get:function(){return yt.default}}),Object.defineProperty(f,"isValidCoordinate",{enumerable:!0,get:function(){return vn.default}}),Object.defineProperty(f,"isValidLatitude",{enumerable:!0,get:function(){return yn.default}}),Object.defineProperty(f,"isValidLongitude",{enumerable:!0,get:function(){return _t.default}}),Object.defineProperty(f,"orderByDistance",{enumerable:!0,get:function(){return _n.default}}),Object.defineProperty(f,"sexagesimalToDecimal",{enumerable:!0,get:function(){return en.default}}),Object.defineProperty(f,"toDecimal",{enumerable:!0,get:function(){return nt.default}}),Object.defineProperty(f,"toRad",{enumerable:!0,get:function(){return bn.default}}),Object.defineProperty(f,"toDeg",{enumerable:!0,get:function(){return Wt.default}}),Object.defineProperty(f,"wktToPolygon",{enumerable:!0,get:function(){return In.default}});var S=Z(v(7887)),w=Z(v(8315)),N=Z(v(713)),D=Z(v(9173)),M=Z(v(4974)),p=Z(v(1675)),m=Z(v(4434)),h=Z(v(5744)),y=Z(v(2908)),_=Z(v(5582)),I=Z(v(6963)),T=Z(v(4629)),A=Z(v(8839)),L=Z(v(804)),J=Z(v(9068)),le=Z(v(1599)),ye=Z(v(8172)),se=Z(v(6984)),Oe=Z(v(5010)),Ne=Z(v(5482)),me=Z(v(6952)),fe=Z(v(2571)),Ie=Z(v(9558)),Me=Z(v(3430)),Xt=Z(v(2926)),Ht=Z(v(9721)),Bt=Z(v(2694)),Ut=Z(v(9538)),vt=Z(v(6958)),yt=Z(v(9674)),vn=Z(v(9139)),yn=Z(v(3861)),_t=Z(v(2494)),_n=Z(v(8252)),en=Z(v(869)),nt=Z(v(1450)),bn=Z(v(9601)),Wt=Z(v(8302)),In=Z(v(7103)),Dn=v(964);function Z($){return $&&$.__esModule?$:{default:$}}Object.keys(Dn).forEach(function($){"default"===$||"__esModule"===$||Object.prototype.hasOwnProperty.call(C,$)||Object.defineProperty(f,$,{enumerable:!0,get:function(){return Dn[$]}})})},2926:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){var N=w.toString().trim();return!isNaN(parseFloat(N))&&parseFloat(N)===Number(N)}},9721:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function S(D){return D&&D.__esModule?D:{default:D}}(v(9068));f.default=function(M,p,m){return(0,C.default)(p,M)+(0,C.default)(M,m)===(0,C.default)(p,m)}},2694:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=w(v(6984)),S=w(v(5010));function w(M){return M&&M.__esModule?M:{default:M}}f.default=function(p,m){for(var h=!1,y=m.length,_=-1,I=y-1;++_<y;I=_)((0,S.default)(m[_])<=(0,S.default)(p)&&(0,S.default)(p)<(0,S.default)(m[I])||(0,S.default)(m[I])<=(0,S.default)(p)&&(0,S.default)(p)<(0,S.default)(m[_]))&&(0,C.default)(p)<((0,C.default)(m[I])-(0,C.default)(m[_]))*((0,S.default)(p)-(0,S.default)(m[_]))/((0,S.default)(m[I])-(0,S.default)(m[_]))+(0,C.default)(m[_])&&(h=!h);return h}},9538:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function S(D){return D&&D.__esModule?D:{default:D}}(v(1599));f.default=function(M,p,m,h){return(0,C.default)(M,p,m)<h}},6958:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function S(D){return D&&D.__esModule?D:{default:D}}(v(9068));f.default=function(M,p,m){return(0,C.default)(M,p)<m}},9674:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(964);f.default=function(D){return C.sexagesimalPattern.test(D.toString().trim())}},9139:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=N(v(804)),S=N(v(3861)),w=N(v(2494));function N(p){return p&&p.__esModule?p:{default:p}}f.default=function(m){var h=(0,C.default)(m),y=h.latitude,_=h.longitude;if(Array.isArray(m)&&m.length>=2)return(0,w.default)(m[0])&&(0,S.default)(m[1]);if(void 0===y||void 0===_)return!1;var I=m[_],T=m[y];return!(void 0===T||void 0===I||!1===(0,S.default)(T)||!1===(0,w.default)(I))}},3861:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(2926)),S=D(v(9674)),w=D(v(869)),N=v(964);function D(m){return m&&m.__esModule?m:{default:m}}f.default=function m(h){return(0,C.default)(h)?!(parseFloat(h)>N.MAXLAT||h<N.MINLAT):!!(0,S.default)(h)&&m((0,w.default)(h))}},2494:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(2926)),S=D(v(9674)),w=D(v(869)),N=v(964);function D(m){return m&&m.__esModule?m:{default:m}}f.default=function m(h){return(0,C.default)(h)?!(parseFloat(h)>N.MAXLON||h<N.MINLON):!!(0,S.default)(h)&&m((0,w.default)(h))}},8252:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function S(D){return D&&D.__esModule?D:{default:D}}(v(9068));f.default=function(M,p){var m=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C.default;return m="function"==typeof m?m:C.default,p.slice().sort(function(h,y){return m(M,h)-m(M,y)})}},7148:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){return w>1?1:w<-1?-1:w}},869:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(964);f.default=function(D){var M=new RegExp(C.sexagesimalPattern).exec(D.toString().trim());if(null==M)throw new Error("Given value is not in sexagesimal format");var p=Number(M[2])/60||0,m=Number(M[4])/3600||0,h=parseFloat(M[1])+p+m;return["S","W"].includes(M[7])?-h:h}},1450:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=M(v(2926)),S=M(v(9674)),w=M(v(869)),N=M(v(9139)),D=M(v(804));function M(I){return I&&I.__esModule?I:{default:I}}function p(I,T){var A=Object.keys(I);if(Object.getOwnPropertySymbols){var L=Object.getOwnPropertySymbols(I);T&&(L=L.filter(function(J){return Object.getOwnPropertyDescriptor(I,J).enumerable})),A.push.apply(A,L)}return A}function m(I){for(var T=1;T<arguments.length;T++){var A=null!=arguments[T]?arguments[T]:{};T%2?p(Object(A),!0).forEach(function(L){h(I,L,A[L])}):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(A)):p(Object(A)).forEach(function(L){Object.defineProperty(I,L,Object.getOwnPropertyDescriptor(A,L))})}return I}function h(I,T,A){return T in I?Object.defineProperty(I,T,{value:A,enumerable:!0,configurable:!0,writable:!0}):I[T]=A,I}f.default=function I(T){if((0,C.default)(T))return Number(T);if((0,S.default)(T))return(0,w.default)(T);if((0,N.default)(T)){var A=(0,D.default)(T);return Array.isArray(T)?T.map(function(L,J){return[0,1].includes(J)?I(L):L}):m(m(m({},T),A.latitude&&h({},A.latitude,I(T[A.latitude]))),A.longitude&&h({},A.longitude,I(T[A.longitude])))}return Array.isArray(T)?T.map(function(L){return(0,N.default)(L)?I(L):L}):T}},8302:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){return 180*w/Math.PI}},9601:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){return w*Math.PI/180}},7103:(F,f)=>{function w(m,h){(null==h||h>m.length)&&(h=m.length);for(var y=0,_=new Array(h);y<h;y++)_[y]=m[y];return _}Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(h){if(!h.startsWith("POLYGON"))throw new Error("Invalid wkt.");return h.slice(h.indexOf("(")+2,h.indexOf(")")).split(", ").map(function(I){var A=function v(m,h){return function D(m){if(Array.isArray(m))return m}(m)||function N(m,h){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(m)){var y=[],_=!0,I=!1,T=void 0;try{for(var L,A=m[Symbol.iterator]();!(_=(L=A.next()).done)&&(y.push(L.value),!h||y.length!==h);_=!0);}catch(J){I=!0,T=J}finally{try{!_&&null!=A.return&&A.return()}finally{if(I)throw T}}return y}}(m,h)||function S(m,h){if(m){if("string"==typeof m)return w(m,h);var y=Object.prototype.toString.call(m).slice(8,-1);if("Object"===y&&m.constructor&&(y=m.constructor.name),"Map"===y||"Set"===y)return Array.from(m);if("Arguments"===y||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(y))return w(m,h)}}(m,h)||function C(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(I.split(" "),2),J=A[1];return{longitude:parseFloat(A[0]),latitude:parseFloat(J)}})}},9974:(F,f)=>{function v(p,m){return p*p+m*m}function C(p,m){return v(p[0]-m[0],p[1]-m[1])}function S(p,m,h){var y=m[0],_=m[1],I=h[0]-y,T=h[1]-_;if(0!==I||0!==T){var A=((p[0]-y)*I+(p[1]-_)*T)/v(I,T);A>1?(y=h[0],_=h[1]):A>0&&(y+=I*A,_+=T*A)}return v(p[0]-y,p[1]-_)}function N(p,m,h,y,_){for(var T,I=y,A=m+1;A<h;A++){var L=S(p[A],p[m],p[h]);L>I&&(T=A,I=L)}I>y&&(T-m>1&&N(p,m,T,y,_),_.push(p[T]),h-T>1&&N(p,T,h,y,_))}function D(p,m){var h=p.length-1,y=[p[0]];return N(p,0,h,m,y),y.push(p[h]),y}f.__esModule=!0,f.SimplifyAP=function M(p,m,h){if(void 0===m&&(m=1),void 0===h&&(h=!1),p.length<=2)return p;var y=m*m;return p=h?p:function w(p,m){for(var y,h=p[0],_=[h],I=1,T=p.length;I<T;I++)C(y=p[I],h)>m&&(_.push(y),h=y);return h!==y&&_.push(y),_}(p,y),D(p,y)}},44:(F,f,v)=>{var S=v(9974);f.EK=S.SimplifyAP,v(6586),v(5073)},6586:(F,f)=>{function v(p,m){return p*p+m*m}function C(p,m){return v(p.longitude-m.longitude,p.latitude-m.latitude)}function S(p,m,h){var y=m.longitude,_=m.latitude,I=h.longitude-y,T=h.latitude-_;if(0!==I||0!==T){var A=((p.longitude-y)*I+(p.latitude-_)*T)/v(I,T);A>1?(y=h.longitude,_=h.latitude):A>0&&(y+=I*A,_+=T*A)}return v(p.longitude-y,p.latitude-_)}function N(p,m,h,y,_){for(var T,I=y,A=m+1;A<h;A++){var L=S(p[A],p[m],p[h]);L>I&&(T=A,I=L)}I>y&&(T-m>1&&N(p,m,T,y,_),_.push(p[T]),h-T>1&&N(p,T,h,y,_))}function D(p,m){var h=p.length-1,y=[p[0]];return N(p,0,h,m,y),y.push(p[h]),y}f.__esModule=!0,f.SimplifyLL=function M(p,m,h){if(void 0===m&&(m=1),void 0===h&&(h=!1),p.length<=2)return p;var y=m*m;return p=h?p:function w(p,m){for(var y,h=p[0],_=[h],I=1,T=p.length;I<T;I++)C(y=p[I],h)>m&&(_.push(y),h=y);return h!==y&&_.push(y),_}(p,y),D(p,y)}},5073:(F,f)=>{function v(p,m){return p*p+m*m}function C(p,m){return v(p.x-m.x,p.y-m.y)}function S(p,m,h){var y=m.x,_=m.y,I=h.x-y,T=h.y-_;if(0!==I||0!==T){var A=((p.x-y)*I+(p.y-_)*T)/v(I,T);A>1?(y=h.x,_=h.y):A>0&&(y+=I*A,_+=T*A)}return v(p.x-y,p.y-_)}function N(p,m,h,y,_){for(var T,I=y,A=m+1;A<h;A++){var L=S(p[A],p[m],p[h]);L>I&&(T=A,I=L)}I>y&&(T-m>1&&N(p,m,T,y,_),_.push(p[T]),h-T>1&&N(p,T,h,y,_))}function D(p,m){var h=p.length-1,y=[p[0]];return N(p,0,h,m,y),y.push(p[h]),y}f.__esModule=!0,f.Simplify=function M(p,m,h){if(void 0===m&&(m=1),void 0===h&&(h=!1),p.length<=2)return p;var y=m*m;return p=h?p:function w(p,m){for(var y,h=p[0],_=[h],I=1,T=p.length;I<T;I++)C(y=p[I],h)>m&&(_.push(y),h=y);return h!==y&&_.push(y),_}(p,y),D(p,y)}}},fl={};function yo(F){var f=fl[F];if(void 0!==f)return f.exports;var v=fl[F]={exports:{}};return Cp[F](v,v.exports,yo),v.exports}(()=>{function F(t){return"function"==typeof t}let f=!1;const v={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){const e=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+e.stack)}else f&&console.log("RxJS: Back to a better error behavior. Thank you. <3");f=t},get useDeprecatedSynchronousErrorHandling(){return f}};function C(t){setTimeout(()=>{throw t},0)}const S={closed:!0,next(t){},error(t){if(v.useDeprecatedSynchronousErrorHandling)throw t;C(t)},complete(){}},w=Array.isArray||(t=>t&&"number"==typeof t.length);function N(t){return null!==t&&"object"==typeof t}const M=(()=>{function t(e){return Error.call(this),this.message=e?`${e.length} errors occurred during unsubscription:\n${e.map((n,r)=>`${r+1}) ${n.toString()}`).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=e,this}return t.prototype=Object.create(Error.prototype),t})();class p{constructor(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}unsubscribe(){let e;if(this.closed)return;let{_parentOrParents:n,_ctorUnsubscribe:r,_unsubscribe:i,_subscriptions:o}=this;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof p)n.remove(this);else if(null!==n)for(let s=0;s<n.length;++s)n[s].remove(this);if(F(i)){r&&(this._unsubscribe=void 0);try{i.call(this)}catch(s){e=s instanceof M?m(s.errors):[s]}}if(w(o)){let s=-1,a=o.length;for(;++s<a;){const l=o[s];if(N(l))try{l.unsubscribe()}catch(u){e=e||[],u instanceof M?e=e.concat(m(u.errors)):e.push(u)}}}if(e)throw new M(e)}add(e){let n=e;if(!e)return p.EMPTY;switch(typeof e){case"function":n=new p(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof p)){const o=n;n=new p,n._subscriptions=[o]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}let{_parentOrParents:r}=n;if(null===r)n._parentOrParents=this;else if(r instanceof p){if(r===this)return n;n._parentOrParents=[r,this]}else{if(-1!==r.indexOf(this))return n;r.push(this)}const i=this._subscriptions;return null===i?this._subscriptions=[n]:i.push(n),n}remove(e){const n=this._subscriptions;if(n){const r=n.indexOf(e);-1!==r&&n.splice(r,1)}}}var t;function m(t){return t.reduce((e,n)=>e.concat(n instanceof M?n.errors:n),[])}p.EMPTY=((t=new p).closed=!0,t);const h="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random();class _ extends p{constructor(e,n,r){switch(super(),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=S;break;case 1:if(!e){this.destination=S;break}if("object"==typeof e){e instanceof _?(this.syncErrorThrowable=e.syncErrorThrowable,this.destination=e,e.add(this)):(this.syncErrorThrowable=!0,this.destination=new I(this,e));break}default:this.syncErrorThrowable=!0,this.destination=new I(this,e,n,r)}}[h](){return this}static create(e,n,r){const i=new _(e,n,r);return i.syncErrorThrowable=!1,i}next(e){this.isStopped||this._next(e)}error(e){this.isStopped||(this.isStopped=!0,this._error(e))}complete(){this.isStopped||(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}_next(e){this.destination.next(e)}_error(e){this.destination.error(e),this.unsubscribe()}_complete(){this.destination.complete(),this.unsubscribe()}_unsubscribeAndRecycle(){const{_parentOrParents:e}=this;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=e,this}}class I extends _{constructor(e,n,r,i){super(),this._parentSubscriber=e;let o,s=this;F(n)?o=n:n&&(o=n.next,r=n.error,i=n.complete,n!==S&&(s=Object.create(n),F(s.unsubscribe)&&this.add(s.unsubscribe.bind(s)),s.unsubscribe=this.unsubscribe.bind(this))),this._context=s,this._next=o,this._error=r,this._complete=i}next(e){if(!this.isStopped&&this._next){const{_parentSubscriber:n}=this;v.useDeprecatedSynchronousErrorHandling&&n.syncErrorThrowable?this.__tryOrSetError(n,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}}error(e){if(!this.isStopped){const{_parentSubscriber:n}=this,{useDeprecatedSynchronousErrorHandling:r}=v;if(this._error)r&&n.syncErrorThrowable?(this.__tryOrSetError(n,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(n.syncErrorThrowable)r?(n.syncErrorValue=e,n.syncErrorThrown=!0):C(e),this.unsubscribe();else{if(this.unsubscribe(),r)throw e;C(e)}}}complete(){if(!this.isStopped){const{_parentSubscriber:e}=this;if(this._complete){const n=()=>this._complete.call(this._context);v.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}}__tryOrUnsub(e,n){try{e.call(this._context,n)}catch(r){if(this.unsubscribe(),v.useDeprecatedSynchronousErrorHandling)throw r;C(r)}}__tryOrSetError(e,n,r){if(!v.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{n.call(this._context,r)}catch(i){return v.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=i,e.syncErrorThrown=!0,!0):(C(i),!0)}return!1}_unsubscribe(){const{_parentSubscriber:e}=this;this._context=null,this._parentSubscriber=null,e.unsubscribe()}}const L="function"==typeof Symbol&&Symbol.observable||"@@observable";function J(t){return t}let se=(()=>{class t{constructor(n){this._isScalar=!1,n&&(this._subscribe=n)}lift(n){const r=new t;return r.source=this,r.operator=n,r}subscribe(n,r,i){const{operator:o}=this,s=function A(t,e,n){if(t){if(t instanceof _)return t;if(t[h])return t[h]()}return t||e||n?new _(t,e,n):new _(S)}(n,r,i);if(s.add(o?o.call(s,this.source):this.source||v.useDeprecatedSynchronousErrorHandling&&!s.syncErrorThrowable?this._subscribe(s):this._trySubscribe(s)),v.useDeprecatedSynchronousErrorHandling&&s.syncErrorThrowable&&(s.syncErrorThrowable=!1,s.syncErrorThrown))throw s.syncErrorValue;return s}_trySubscribe(n){try{return this._subscribe(n)}catch(r){v.useDeprecatedSynchronousErrorHandling&&(n.syncErrorThrown=!0,n.syncErrorValue=r),function T(t){for(;t;){const{closed:e,destination:n,isStopped:r}=t;if(e||r)return!1;t=n&&n instanceof _?n:null}return!0}(n)?n.error(r):console.warn(r)}}forEach(n,r){return new(r=Oe(r))((i,o)=>{let s;s=this.subscribe(a=>{try{n(a)}catch(l){o(l),s&&s.unsubscribe()}},o,i)})}_subscribe(n){const{source:r}=this;return r&&r.subscribe(n)}[L](){return this}pipe(...n){return 0===n.length?this:function ye(t){return 0===t.length?J:1===t.length?t[0]:function(n){return t.reduce((r,i)=>i(r),n)}}(n)(this)}toPromise(n){return new(n=Oe(n))((r,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>r(o))})}}return t.create=e=>new t(e),t})();function Oe(t){if(t||(t=v.Promise||Promise),!t)throw new Error("no Promise impl found");return t}const me=(()=>{function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t})();class fe extends p{constructor(e,n){super(),this.subject=e,this.subscriber=n,this.closed=!1}unsubscribe(){if(this.closed)return;this.closed=!0;const e=this.subject,n=e.observers;if(this.subject=null,!n||0===n.length||e.isStopped||e.closed)return;const r=n.indexOf(this.subscriber);-1!==r&&n.splice(r,1)}}class Ie extends _{constructor(e){super(e),this.destination=e}}let Me=(()=>{class t extends se{constructor(){super(),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}[h](){return new Ie(this)}lift(n){const r=new Xt(this,this);return r.operator=n,r}next(n){if(this.closed)throw new me;if(!this.isStopped){const{observers:r}=this,i=r.length,o=r.slice();for(let s=0;s<i;s++)o[s].next(n)}}error(n){if(this.closed)throw new me;this.hasError=!0,this.thrownError=n,this.isStopped=!0;const{observers:r}=this,i=r.length,o=r.slice();for(let s=0;s<i;s++)o[s].error(n);this.observers.length=0}complete(){if(this.closed)throw new me;this.isStopped=!0;const{observers:n}=this,r=n.length,i=n.slice();for(let o=0;o<r;o++)i[o].complete();this.observers.length=0}unsubscribe(){this.isStopped=!0,this.closed=!0,this.observers=null}_trySubscribe(n){if(this.closed)throw new me;return super._trySubscribe(n)}_subscribe(n){if(this.closed)throw new me;return this.hasError?(n.error(this.thrownError),p.EMPTY):this.isStopped?(n.complete(),p.EMPTY):(this.observers.push(n),new fe(this,n))}asObservable(){const n=new se;return n.source=this,n}}return t.create=(e,n)=>new Xt(e,n),t})();class Xt extends Me{constructor(e,n){super(),this.destination=e,this.source=n}next(e){const{destination:n}=this;n&&n.next&&n.next(e)}error(e){const{destination:n}=this;n&&n.error&&this.destination.error(e)}complete(){const{destination:e}=this;e&&e.complete&&this.destination.complete()}_subscribe(e){const{source:n}=this;return n?this.source.subscribe(e):p.EMPTY}}!function yn(){"function"==typeof Symbol&&Symbol.iterator&&Symbol}();function Re(t){return{token:t.token,providedIn:t.providedIn||null,factory:t.factory,value:void 0}}Error;class Bw{constructor(){this.limitUI04=this.maxFromBits(4),this.limitUI06=this.maxFromBits(6),this.limitUI08=this.maxFromBits(8),this.limitUI12=this.maxFromBits(12),this.limitUI14=this.maxFromBits(14),this.limitUI16=this.maxFromBits(16),this.limitUI32=this.maxFromBits(32),this.limitUI40=this.maxFromBits(40),this.limitUI48=this.maxFromBits(48),this.create()}toString(){return this.hex}toURN(){return"urn:uuid:"+this.hex}toSignalK(){return`urn:mrn:signalk:uuid:${this.hex}`}toBytes(){let e=this.hex.split("-"),n=[],r=0;for(let i=0;i<e.length;i++)for(let o=0;o<e[i].length;o+=2)n[r++]=parseInt(e[i].substr(o,2),16);return n}maxFromBits(e){return Math.pow(2,e)}getRandomInt(e,n){return Math.floor(Math.random()*(n-e+1))+e}randomUI04(){return this.getRandomInt(0,this.limitUI04-1)}randomUI06(){return this.getRandomInt(0,this.limitUI06-1)}randomUI08(){return this.getRandomInt(0,this.limitUI08-1)}randomUI12(){return this.getRandomInt(0,this.limitUI12-1)}randomUI14(){return this.getRandomInt(0,this.limitUI14-1)}randomUI16(){return this.getRandomInt(0,this.limitUI16-1)}randomUI32(){return this.getRandomInt(0,this.limitUI32-1)}randomUI40(){return(0|Math.random()*(1<<30))+(0|1024*Math.random())*(1<<30)}randomUI48(){return(0|Math.random()*(1<<30))+(0|Math.random()*(1<<18))*(1<<30)}create(){this.fromParts(this.randomUI32(),this.randomUI16(),16384|this.randomUI12(),128|this.randomUI06(),this.randomUI08(),this.randomUI48())}paddedString(e,n,r=null){r=r||"0";let i=n-(e=String(e)).length;for(;i>0;i>>>=1,r+=r)1&i&&(e=r+e);return e}fromParts(e,n,r,i,o,s){return this.version=r>>12&15,this.hex=this.paddedString(e.toString(16),8)+"-"+this.paddedString(n.toString(16),4)+"-"+this.paddedString(r.toString(16),4)+"-"+this.paddedString(i.toString(16),2)+this.paddedString(o.toString(16),2)+"-"+this.paddedString(s.toString(16),12),this}}class fo{static updates(){return{context:null,updates:[]}}static subscribe(){return{context:null,subscribe:[]}}static unsubscribe(){return{context:null,unsubscribe:[]}}static request(){return{requestId:(new Bw).toString()}}}let Ww=(()=>{class t{constructor(){this._filter="",this._wsTimeout=2e4,this._token="",this._playbackMode=!1,this.version=1,this.endpoint="",this.selfId="",this._source=null,this._connect=new Me,this.onConnect=this._connect.asObservable(),this._close=new Me,this.onClose=this._close.asObservable(),this._error=new Me,this.onError=this._error.asObservable(),this._message=new Me,this.onMessage=this._message.asObservable()}set source(n){this._source||(this._source={}),this._source.label=n}set authToken(n){this._token=n}get connectionTimeout(){return this._wsTimeout}set connectionTimeout(n){this._wsTimeout=n<3e3?3e3:n>6e4?6e4:n}get isOpen(){return!(!this.ws||1==this.ws.readyState||3==this.ws.readyState)}get filter(){return this._filter}set filter(n){this._filter=n&&-1!=n.indexOf("self")?this.selfId?this.selfId:"":n}get playbackMode(){return this._playbackMode}close(){this.ws&&(this.ws.close(),this.ws=null)}open(n,r,i){if(!(n=n||this.endpoint))return;let o=-1==n.indexOf("?")?"?":"&";r&&(n+=`${o}subscribe=${r}`),(this._token||i)&&(n+=`${r?"&":"?"}token=${this._token||i}`),this.close(),this.ws=new WebSocket(n),setTimeout(()=>{this.ws&&1!=this.ws.readyState&&3!=this.ws.readyState&&(console.warn(`Connection watchdog expired (${this._wsTimeout/1e3} sec): ${this.ws.readyState}... aborting connection...`),this.close())},this._wsTimeout),this.ws.onopen=s=>{this._connect.next(s)},this.ws.onclose=s=>{this._close.next(s)},this.ws.onerror=s=>{this._error.next(s)},this.ws.onmessage=s=>{this.parseOnMessage(s)}}parseOnMessage(n){let r;if("string"==typeof n.data)try{r=JSON.parse(n.data)}catch(i){return}this.isHello(r)?(this.selfId=r.self,this._playbackMode=void 0!==r.startTime,this._message.next(r)):this.isResponse(r)?(void 0!==r.login&&void 0!==r.login.token&&(this._token=r.login.token),this._message.next(r)):this._filter&&this.isDelta(r)?r.context==this._filter&&this._message.next(r):this._message.next(r)}sendRequest(n){if("object"!=typeof n)return"";let r=fo.request();return void 0===n.login&&this._token&&(r.token=this._token),Object.keys(n).forEach(o=>{r[o]=n[o]}),this.send(r),r.requestId}put(n,r,i){return this.sendRequest({context:"self"==n?"vessels.self":n,put:{path:r,value:i}})}login(n,r){return this.sendRequest({login:{username:n,password:r}})}send(n){this.ws&&("object"==typeof n&&(n=JSON.stringify(n)),this.ws.send(n))}sendUpdate(n="self",r,i){let o=fo.updates();this._token&&(o.token=this._token),o.context="self"==n?"vessels.self":n,this._token&&(o.token=this._token);let s=[];"string"==typeof r&&s.push({path:r,value:i}),"object"==typeof r&&Array.isArray(r)&&(s=r);let a={timestamp:(new Date).toISOString(),values:s};this._source&&(a.source=this._source),o.updates.push(a),this.send(o)}subscribe(n="*",r="*",i){let o=fo.subscribe();if(this._token&&(o.token=this._token),o.context="self"==n?"vessels.self":n,this._token&&(o.token=this._token),"object"==typeof r&&Array.isArray(r)&&(o.subscribe=r),"string"==typeof r){let s={};s.path=r,i&&"object"==typeof i&&(i.period&&(s.period=i.period),i.minPeriod&&(s.minPeriod=i.period),i.format&&("delta"==i.format||"full"==i.format)&&(s.format=i.format),i.policy&&("instant"==i.policy||"ideal"==i.policy||"fixed"==i.policy)&&(s.policy=i.policy)),o.subscribe.push(s)}this.send(o)}unsubscribe(n="*",r="*"){let i=fo.unsubscribe();this._token&&(i.token=this._token),i.context="self"==n?"vessels.self":n,this._token&&(i.token=this._token),"object"==typeof r&&Array.isArray(r)&&(i.unsubscribe=r),"string"==typeof r&&i.unsubscribe.push({path:r}),this.send(i)}raiseAlarm(n="*",r,i){let o;o="string"==typeof r&&-1==r.indexOf("notifications.")?`notifications.${r}`:r,this.put(n,o,i.value)}clearAlarm(n="*",r){let i=-1==r.indexOf("notifications.")?`notifications.${r}`:r;this.put(n,i,null)}isSelf(n){return n.context==this.selfId}isDelta(n){return void 0!==n.context}isHello(n){return void 0!==n.version&&void 0!==n.self}isResponse(n){return void 0!==n.requestId}}return t.\u0275fac=function(n){return new(n||t)},t.\u0275prov=Re({token:t,factory:t.\u0275fac,providedIn:"root"}),t})();class Gw{constructor(e,n,r,i){this._method=[],this._message="",this._message=void 0!==e?e:"",this._state=void 0!==n?n:ho.alarm,r&&this._method.push(Qr.visual),i&&this._method.push(Qr.sound)}get value(){return{message:this._message,state:this._state,method:this._method}}}var ho=(()=>(function(t){t.normal="normal",t.alert="alert",t.warn="warn",t.alarm="alarm",t.emergency="emergency"}(ho||(ho={})),ho))(),Qr=(()=>(function(t){t.visual="visual",t.sound="sound"}(Qr||(Qr={})),Qr))();class Kw{constructor(){this.obsList=[],this.stream=new Ww,this._connect=new Me,this.onConnect=this._connect.asObservable(),this._close=new Me,this.onClose=this._close.asObservable(),this._error=new Me,this.onError=this._error.asObservable(),this._message=new Me,this.onMessage=this._message.asObservable()}get endpoint(){return this.stream.endpoint}set endpoint(e){this.stream.endpoint=e}get selfId(){return this.stream.selfId}set selfId(e){this.stream.selfId=e}get _source(){return this.stream._source}set _source(e){this.stream._source=e}set source(e){this.stream.source=e}set authToken(e){this.stream.authToken=e}get connectionTimeout(){return this.stream.connectionTimeout}set connectionTimeout(e){this.stream.connectionTimeout=e}get isOpen(){return this.stream.isOpen}get filter(){return this.stream.filter}set filter(e){this.stream.filter=e}get playbackMode(){return this.stream.playbackMode}open(e,n="none",r){this.obsList.push(this.stream.onConnect.subscribe(i=>this._connect.next(i))),this.obsList.push(this.stream.onClose.subscribe(i=>this._close.next(i))),this.obsList.push(this.stream.onError.subscribe(i=>this._error.next(i))),this.obsList.push(this.stream.onMessage.subscribe(i=>this._message.next(i))),this.stream.open(e,n,r)}close(){this.stream.close(),this.obsList.forEach(e=>e.unsubscribe()),this.obsList=[]}sendRequest(e){return this.stream.sendRequest(e)}put(e,n,r){return this.stream.put(e,n,r)}login(e,n){return this.stream.login(e,n)}send(e){this.stream.send(e)}sendUpdate(e="self",n,r){this.stream.sendUpdate(e,n,r)}subscribe(e="*",n="*",r){this.stream.subscribe(e,n,r)}unsubscribe(e="*",n="*"){this.stream.unsubscribe(e,n)}raiseAlarm(e="*",n,r){this.stream.raiseAlarm(e,n,r)}clearAlarm(e="*",n){this.stream.clearAlarm(e,n)}isSelf(e){return this.stream.isSelf(e)}isDelta(e){return this.stream.isDelta(e)}isHello(e){return this.stream.isHello(e)}isResponse(e){return this.stream.isResponse(e)}}class dp{constructor(){this.position=[0,0],this.headingTrue=null,this.headingMagnetic=null,this.cogTrue=null,this.cogMagnetic=null,this.wind={direction:null,mwd:null,twd:null,tws:null,speedTrue:null,sog:null,awa:null,aws:null},this.lastUpdated=new Date,this.orientation=0,this.buddy=!1,this.closestApproach=null,this.mode="day",this.anchor={maxRadius:null,radius:null,position:null},this.resourceUpdates=[],this.autopilot={},this.track=[],this.courseApi={arrivalCircle:0,activeRoute:{},nextPoint:{},previousPoint:{}},this.properties={}}}class fp{constructor(){this.lastUpdated=new Date,this.position=[0,0],this.properties={}}}class hp extends fp{constructor(){super(),this.type={id:-1,name:""}}}class qw extends hp{constructor(){super()}}class Qw extends fp{constructor(){super(),this.orientation=0,this.sog=0,this.track=[]}}class Xa{static celciusToKelvin(e=0){return e+273.15}static kelvinToCelcius(e=0){return e-273.15}static kelvinToFarenheit(e=0){return 1.8*e-459.67}static degreesToRadians(e=0){return e*Math.PI/180}static radiansToDegrees(e=0){return 180*e/Math.PI}static angleToDirection(e,n){const r=2*Math.PI;if(n||(n=0),e||(e=0),isNaN(n)||isNaN(e))return null;const i=n+e;return i>r?i-r:i<0?r+i:i}static directionToAngle(e,n){const r=2*Math.PI;if(n||(n=0),e||(e=0),isNaN(n)||isNaN(e))return null;const i=n-e;let o;if(i>0)o=i>Math.PI?r-i:0-i;else if(i<0){const s=Math.abs(i);o=s>Math.PI?s-r:s}else o=i;return o}static knotsToKm(e){return 1.852*e}static nauticalMilesToKm(e){return 1.852*e}static knotsToMSec(e){return.51444325460445*e}static kmToKnots(e){return.539957*e}static kmToNauticalMiles(e){return.539957*e}static kmToMiles(e){return.621371*e}static msecToKnots(e){return 1.94384*e}static msecToKmh(e){return 3.6*e}static msecToMph(e){return 2.23694*e}static nauticalMilesToMiles(e){return 1.15078*e}static milesToKm(e){return 1.60934*e}static milesToNauticalMiles(e){return.868976*e}static rpmToHertz(e){return e/60}}var zr=yo(5026);class Zr{static destCoordinate(e,n,r){const i=(0,zr.computeDestinationPoint)(e,r,Xa.radiansToDegrees(n));return[i.longitude,i.latitude]}static distanceTo(e,n){return(0,zr.getDistance)(e,n)}static routeLength(e){return(0,zr.getPathLength)(e)}static centreOfPolygon(e){const n=(0,zr.getCenter)(e);return[n.longitude,n.latitude]}static inDLCrossingZone(e,n=170){return Math.abs(e[0])>=n}static inBounds(e,n){return(0,zr.isPointInPolygon)(e,[[n[0],n[1]],[n[0],n[3]],[n[2],n[3]],[n[2],n[1]],[n[0],n[1]]])}static calcMapifiedExtent(e,n){const i=111111*Math.cos(Xa.degreesToRadians(e[1])),o=[0,0,0,0];return o[1]=e[1]+(0-Math.abs(n))/111111,o[3]=e[1]+Math.abs(n)/111111,o[0]=e[0]+(0-Math.abs(n))/i,o[2]=e[0]+Math.abs(n)/i,o}static normaliseCoords(e){if(!Array.isArray(e))return[0,0];if("number"==typeof e[0]){if(e[0]>180)for(;e[0]>180;)e[0]=e[0]-360;else if(e[0]<-180)for(;e[0]<-180;)e[0]=360+e[0];return e}return Array.isArray(e[0])?(e.forEach(n=>this.normaliseCoords(n)),e):void 0}}class zw{constructor(e){this.playback=!1,this.result=null,this.self=null,this.action="notification",this.type=e}}class pp{constructor(){this.playback=!1,this.result=null,this.self=null,this.action="update"}}class Zw extends pp{constructor(){super(),this.action="trail"}}var Yw=yo(44);const Jw=["environment.wind.speedTrue","environment.wind.speedOverGround","environment.wind.angleTrueGround","environment.wind.angleTrueWater","environment.wind.directionTrue","environment.wind.directionMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.headingTrue","navigation.headingMagnetic"];let ee,Pe;const Yr=[];let tl,po=[],el=!1,go=!1;const X={signalk:{},aisState:[]};let Ge,vp,gp=[0,0,0,0],mp=60,Jr=0,pn={},gn=500,Ft=!1;const $t={maxAge:54e4,staleAge:36e4,lastTick:(new Date).valueOf(),maxTrack:20},Xr={trailDuration:24,trailResolution:{lastHour:"5s",next23:"10s",beyond24:"1m"}};function yp(){Ge={updated:{},stale:{},expired:{}}}function mo({action:t,msg:e}){switch(t){case"onConnect":postMessage({action:"open",playback:Ft,result:e.target.readyState});break;case"onClose":console.warn("streamEvent: ",e),bp(!1);break;case"onError":console.warn("streamEvent: ",e),postMessage({action:"error",playback:Ft,result:"Connection error!"});break;case"onMessage":!function iM(t){Pe.isHello(t)?(postMessage({action:"hello",result:t,self:t.self,playback:Ft}),gn&&wp()):Pe.isDelta(t)?(el=!0,t.updates.forEach(e=>{!e.values||e.values.forEach(n=>{if(vp=e.timestamp,t.context)switch(t.context.split(".")[0]){case"shore":case"atons":null!=X&&X.signalk.atons&&function lM(t,e){let n=!1;if(-1!=t.indexOf("shore.basestations")&&(n=!0),!ee.atons.has(t)){const i=new hp;i.id=t,i.position=null,n&&(i.type.id=-1,i.type.name="Basestation"),ee.atons.set(t,i)}const r=ee.atons.get(t);""===e.path?(void 0!==e.value.name&&(r.name=e.value.name),void 0!==e.value.mmsi&&(r.mmsi=e.value.mmsi),void 0!==e.value.atonType&&(r.type=e.value.atonType)):"atonType"===e.path?r.type=e.value:"navigation.position"===e.path?(r.position=[e.value.longitude,e.value.latitude],r.positionReceived=!0):r.properties[e.path]=e.value}(t.context,n),vo(t.context,ee.atons,null==X?void 0:X.signalk.atons);break;case"sar":null!=X&&X.signalk.sar&&function uM(t,e){if(!ee.sar.has(t)){const r=new qw;r.id=t,r.position=null,r.type.id=-1,r.type.name="SaR Beacon",ee.sar.set(t,r)}const n=ee.sar.get(t);""===e.path?(void 0!==e.value.name&&(n.name=e.value.name),void 0!==e.value.mmsi&&(n.mmsi=e.value.mmsi)):"communication.callsignVhf"===e.path?n.callsign=e.value:"navigation.position"===e.path&&e.value?(n.position=Zr.normaliseCoords([e.value.longitude,e.value.latitude]),n.positionReceived=!0):n.properties[e.path]=e.value}(t.context,n),vo(t.context,ee.sar,null==X?void 0:X.signalk.sar);break;case"aircraft":null!=X&&X.signalk.aircraft&&function cM(t,e){if(!ee.aircraft.has(t)){const r=new Qw;r.id=t,r.position=null,ee.aircraft.set(t,r)}const n=ee.aircraft.get(t);""===e.path?(void 0!==e.value.name&&(n.name=e.value.name),void 0!==e.value.mmsi&&(n.mmsi=e.value.mmsi)):"communication.callsignVhf"===e.path?n.callsign=e.value:"navigation.position"===e.path&&e.value?(n.position=Zr.normaliseCoords([e.value.longitude,e.value.latitude]),n.positionReceived=!0,nl(n)):"navigation.courseOverGroundTrue"===e.path?n.orientation=e.value:"navigation.speedOverGround"===e.path?n.sog=e.value:n.properties[e.path]=e.value}(t.context,n),vo(t.context,ee.aircraft,null==X?void 0:X.signalk.aircraft);break;case"vessels":if(Pe.isSelf(t))Ep(ee.self,n,!0),function sM(t,e){const n={path:t.path,value:t.value,context:e||null};let r;const i=t.path.split(".");if(("notifications.environment.depth.belowTransducer"===t.path||"notifications.environment.depth.belowSurface"===t.path||"notifications.environment.depth.belowKeel"===t.path)&&(r=i[2]),"notifications.navigation.anchor"===t.path&&(r=i[2]),-1!=["mob","sinking","fire","piracy","flooding","collision","grounding","listing","adrift","abandon"].indexOf(i[i.length-1])&&(r=i[i.length-1]),-1!=t.path.indexOf("notifications.navigation.closestApproach")&&(r=i[2],n.context=i[3]),-1!=t.path.indexOf("notifications.buddy")&&(r=i[1],n.context=i[2]),-1!=t.path.indexOf("notifications.navigation.course.arrivalCircleEntered")&&(r=i[3]),-1!=t.path.indexOf("notifications.navigation.course.perpendicularPassed")&&(r=i[3]),-1!=t.path.indexOf("notifications.environment.weather.warning")&&(r=i[2]),r){const o=new zw(r);o.playback=Ft,o.result=n,postMessage(o)}}(n);else{if(null!=X&&X.signalk.vessels){const r=function oM(t){if(!ee.aisTargets.has(t)){const e=new dp;e.position=null,ee.aisTargets.set(t,e)}return ee.aisTargets.get(t)}(t.context);Ep(r,n)}vo(t.context,ee.aisTargets,null==X?void 0:X.signalk.vessels,null==X?void 0:X.aisState)}}})}),Dp()):Pe.isResponse(t)&&postMessage({action:"response",result:t})}(e)}}function _p(t={}){t.interval&&"number"==typeof t.interval&&(gn=t.interval,Mp(),wp(),mp=1/(gn/1e3)*60),Ft=!!t.playback,t.selections&&(void 0!==t.selections.preferredPaths&&(pn=t.selections.preferredPaths),t.selections.aisMaxAge&&"number"==typeof t.selections.aisMaxAge&&($t.maxAge=t.selections.aisMaxAge),t.selections.aisStaleAge&&"number"==typeof t.selections.aisStaleAge&&($t.staleAge=t.selections.aisStaleAge),"number"==typeof t.selections.signalk.maxRadius&&(X.signalk=t.selections.signalk),void 0!==t.selections.aisState&&Array.isArray(t.selections.aisState)&&(X.aisState=t.selections.aisState),console.log("Worker: AIS Filter...",X))}function bp(t=!1){Mp(),Yr.forEach(e=>e.unsubscribe()),Pe&&t&&Pe.close(),Pe=null,postMessage({action:"close",result:t,playback:Ft})}function ei(t){return new Promise((e,n)=>{fetch(`${t}`).then(r=>{r.json().then(i=>e(i)).catch(i=>n(i))}).catch(r=>{n(r)})})}function Ip(){ei(tl+"/tracks"+(X&&X.signalk&&X.signalk.maxRadius?`?radius=${X.signalk.maxRadius}`:"?radius=10000")).then(e=>{go=!0,Object.entries(e).forEach(n=>{if(ee.aisTargets.has(n[0])){const r=ee.aisTargets.get(n[0]);r.track=n[1].coordinates,nl(r)}})}).catch(()=>{go=!1,console.warn("Unable to fetch AIS tracks!")})}function vo(t,e,n=!0,r=[]){if(n){let i=e.get(t);i&&r.includes(null==i?void 0:i.state)&&(console.log(`state match => ${r}, ${t}`),Ge.expired[t]=!0,i=null),i&&X.signalk.maxRadius?i.positionReceived&&Zr.inBounds(i.position,gp)?Ge.updated[t]=!0:(e.delete(t),Ge.expired[t]=!0):Ge.updated[t]=!0}else 0!=e.size&&(e.forEach((i,o)=>{Ge.expired[o]=!0}),e.clear())}function Dp(t=!1){if(!gn||t){const e=new pp;e.playback=Ft,ee.aisStatus.updated=Object.keys(Ge.updated),ee.aisStatus.stale=Object.keys(Ge.stale),ee.aisStatus.expired=Object.keys(Ge.expired),e.result=ee,e.timestamp=Ft?vp:ee.self.lastUpdated.toISOString(),postMessage(e),yp(),ee.self.resourceUpdates=[],0===Jr&&(function aM(){const t=(new Date).valueOf();ee.aisTargets.forEach((e,n)=>{e.lastUpdated.valueOf()<t-$t.maxAge?(Ge.expired[n]=!0,ee.aisTargets.delete(n)):e.lastUpdated.valueOf()<t-$t.staleAge&&(Ge.stale[n]=!0)}),ee.aircraft.forEach((e,n)=>{e.lastUpdated.valueOf()<t-$t.maxAge?(Ge.expired[n]=!0,ee.aircraft.delete(n)):e.lastUpdated.valueOf()<t-$t.staleAge&&(Ge.stale[n]=!0)}),ee.sar.forEach((e,n)=>{e.lastUpdated.valueOf()<t-$t.maxAge?(Ge.expired[n]=!0,ee.sar.delete(n)):e.lastUpdated.valueOf()<t-$t.staleAge&&(Ge.stale[n]=!0)})}(),ee.self.positionReceived&&(null==X?void 0:X.signalk.maxRadius)&&(gp=Zr.calcMapifiedExtent(ee.self.position,X.signalk.maxRadius),Jr++)),Jr=Jr>=mp?0:Jr+1}}function wp(){gn&&"number"==typeof gn&&po.push(setInterval(()=>{el&&(Dp(!0),el=!1)},gn)),po.push(setInterval(()=>{console.warn("hasTrackPlugin",go),go&&Ip()},6e4))}function Mp(){po.forEach(t=>clearInterval(t)),po=[]}function Ep(t,e,n=!1){if(t.lastUpdated=new Date,n){const r=-1!==e.path.indexOf("course")?e.path.split(".").slice(0,2).join("."):e.path;-1!=Jw.indexOf(r)&&(ee.paths[r]=null)}if(""===e.path)void 0!==e.value.name&&(t.name=e.value.name),void 0!==e.value.mmsi&&(t.mmsi=e.value.mmsi),void 0!==e.value.buddy&&(t.buddy=e.value.buddy);else if("communication.callsignVhf"===e.path)t.callsign=e.value;else if("navigation.position"===e.path&&e.value){if(void 0===e.value.longitude)return;t.position=Zr.normaliseCoords([e.value.longitude,e.value.latitude]),t.positionReceived=!0,n||nl(t)}else"navigation.state"===e.path?t.state=e.value:"navigation.speedOverGround"===e.path?t.sog=e.value:"navigation.courseOverGroundTrue"===e.path?t.cogTrue=e.value:"navigation.courseOverGroundMagnetic"===e.path?t.cogMagnetic=e.value:"navigation.headingTrue"===e.path?t.headingTrue=e.value:"navigation.headingMagnetic"===e.path?t.headingMagnetic=e.value:"environment.wind.angleApparent"===e.path?t.wind.awa=e.value:"environment.wind.speedApparent"===e.path?t.wind.aws=e.value:"environment.wind.speedTrue"===e.path?t.wind.speedTrue=e.value:"environment.wind.speedOverGround"===e.path?t.wind.sog=e.value:"environment.wind.directionTrue"===e.path?t.wind.twd=e.value:"environment.wind.directionMagnetic"===e.path?t.wind.mwd=e.value:"environment.mode"===e.path?t.mode=e.value:-1!==e.path.indexOf("navigation.course.")?-1!==e.path.indexOf("navigation.course.calcValues")?-1===e.path.indexOf("navigation.course.calcValues.previousPoint")&&(t[`course.${e.path.split(".").slice(-1)[0]}`]=e.value):-1!==e.path.indexOf("navigation.course.activeRoute")?t.courseApi.activeRoute=e.value:-1!==e.path.indexOf("navigation.course.nextPoint")?t.courseApi.nextPoint=e.value:-1!==e.path.indexOf("navigation.course.previousPoint")?t.courseApi.previousPoint=e.value:"navigation.course.arrivalCircle"===e.path&&(t.courseApi.arrivalCircle=e.value):-1!=e.path.indexOf("navigation.closestApproach")?t.closestApproach=e.value:"navigation.anchor.position"===e.path?t.anchor.position=e.value:"navigation.anchor.maxRadius"===e.path?t.anchor.maxRadius=e.value:"navigation.anchor.currentRadius"===e.path?t.anchor.radius=e.value:-1!=e.path.indexOf("resources.")?t.resourceUpdates.push(e):"steering.autopilot.state"===e.path?t.autopilot.state=e.value:"steering.autopilot.mode"===e.path?t.autopilot.mode=e.value:"steering.autopilot.enabled"===e.path?t.autopilot.enabled=e.value:t.properties[e.path]=e.value;t.heading=null===t.heading&&null!=t.cog?t.cog:t.heading,void 0!==pn.heading&&e.path===pn.heading&&(t.orientation=e.value),void 0!==pn.tws&&e.path===pn.tws&&(t.wind.tws=e.value),void 0!==pn.twd&&e.path===pn.twd&&(t.wind.direction="environment.wind.angleTrueGround"===e.path||"environment.wind.angleTrueWater"===e.path?Xa.angleToDirection(e.value,t.heading):e.value)}function nl(t){if(t.track&&0===t.track.length)t.track.push([t.position]);else{const n=t.track[t.track.length-1][t.track[t.track.length-1].length-1];n[0]!=t.position[0]&&n[1]!=t.position[1]&&t.track[t.track.length-1].push(t.position)}t.track[t.track.length-1]=t.track[t.track.length-1].slice(0-$t.maxTrack)}addEventListener("message",({data:t})=>{!function eM(t){var e,n,r,i;if(t.cmd)switch(t.cmd){case"open":console.log("Worker control: opening stream..."),_p(t.options),function nM(t){if(Pe)return;if(!t.url)return void postMessage({action:"error",result:"Valid options not provided!"});const e=t.url.split("/");if(e.pop(),e.push("api"),e[0]="wss:"===e[0]?"https:":"http:",tl=e.join("/"),function Xw(){ee={self:new dp,aisTargets:new Map,aisStatus:{updated:[],stale:[],expired:[]},paths:{},atons:new Map,aircraft:new Map,sar:new Map},ee.self.positionReceived=!1,yp()}(),Pe=new Kw,Yr.push(Pe.onConnect.subscribe(n=>mo({action:"onConnect",msg:n}))),Yr.push(Pe.onClose.subscribe(n=>mo({action:"onClose",msg:n}))),Yr.push(Pe.onError.subscribe(n=>mo({action:"onError",msg:n}))),Yr.push(Pe.onMessage.subscribe(n=>mo({action:"onMessage",msg:n}))),t.playback){const n=t.playbackOptions.startTime?`?startTime=${t.playbackOptions.startTime}`:null;let r=t.playbackOptions.playbackRate?`playbackRate=${t.playbackOptions.playbackRate}`:null;r=r?n?"&"+r:"?"+r:null,Pe.open(`${t.url}${n||""}${r||""}`,t.playbackOptions.subscribe,t.token)}else Pe.open(t.url,t.subscribe,t.token),Ip()}(t.options);break;case"close":console.log("Worker control: closing stream..."),bp(!0);break;case"subscribe":console.log("Worker control: subscribing to paths..."),Pe.subscribe(t.options.context,t.options.path);break;case"settings":console.log("Worker control: settings..."),_p(t.options);break;case"alarm":console.log("Worker control: alarm action..."),function rM(t){const e=-1===t.type.indexOf("notifications.")?`notifications.${t.type}`:t.type;t.raise?Pe.raiseAlarm("self",e,new Gw(t.message,t.state,!0,!0)):Pe.clearAlarm("self",e)}(t.options);break;case"vessel":if(console.log("Worker control: vessel setting..."),t.options){let o;o="self"===t.options.context?ee.self:ee.aisTargets.get(t.options.context),o&&t.options.name&&(o.name=t.options.name)}break;case"auth":console.log("Worker control: auth token..."),t.options&&(Pe.authToken=t.options.token);break;case"trail":console.log("Worker control: Fetch vessel trail from server..."),t.options&&(Xr.trailDuration=null!==(e=t.options.trailDuration)&&void 0!==e?e:24,t.options.trailResolution&&(Xr.trailResolution.lastHour=null!==(n=t.options.trailResolution.lastHour)&&void 0!==n?n:"5s",Xr.trailResolution.next23=null!==(r=t.options.trailResolution.next23)&&void 0!==r?r:"1m",Xr.trailResolution.beyond24=null!==(i=t.options.trailResolution.beyond24)&&void 0!==i?i:"5m")),function tM(t){console.info("Worker: Fetching vessel trail from server",t);const e=tl+"/self/track?",n=[];t.trailDuration>24&&(n.push(ei(`${e}timespan=${t.trailDuration-24}h&resolution=${t.trailResolution.beyond24}×panOffset=24`)),n.push(ei(`${e}timespan=23h&resolution=${t.trailResolution.next23}×panOffset=1`))),t.trailDuration>1&&t.trailDuration<25&&n.push(ei(`${e}timespan=${t.trailDuration-1}h&resolution=${t.trailResolution.next23}×panOffset=1`)),n.push(ei(`${e}timespan=1h&resolution=${t.trailResolution.lastHour}`));let o=[];const s=new Zw;s.playback=Ft,Promise.all(n).then(a=>{let l=0;const u=n.length-1;a.forEach(d=>{if(d.type&&"MultiLineString"===d.type&&d.coordinates&&Array.isArray(d.coordinates))if(l!=u){let g=[];for(d.coordinates.forEach(b=>{g=g.concat(b)}),g=(0,Yw.EK)(g,5e-4,true);g.length>60;){const b=g.slice(0,60);o.push(b),g=g.slice(59),g[0]=[g[0][0]+5e-9,g[0][1]+5e-9]}0!==g.length&&o.push(g)}else o=o.concat(d.coordinates);l++}),s.result=o,postMessage(s)}).catch(()=>{s.result=null,postMessage(s)})}(Xr)}}(t)})})()})();
|
package/public/index.html
CHANGED
|
@@ -72,6 +72,6 @@
|
|
|
72
72
|
</div>
|
|
73
73
|
</div>
|
|
74
74
|
</app-root>
|
|
75
|
-
<script src="runtime.
|
|
75
|
+
<script src="runtime.08383444e0508713.js" type="module"></script><script src="polyfills.12ddee7e4cb46a02.js" type="module"></script><script src="main.94ec7a510fb63b81.js" type="module"></script>
|
|
76
76
|
|
|
77
77
|
</body></html>
|