signalk-onaplotter 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (482) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +52 -2
  3. package/index.js +310 -0
  4. package/package.json +28 -4
  5. package/public/OnaPlotter.styles.css +365 -0
  6. package/public/OnaPlotter.styles.css.br +0 -0
  7. package/public/OnaPlotter.styles.css.gz +0 -0
  8. package/public/_framework/Microsoft.AspNetCore.Components.Web.lzlha3sebn.wasm +0 -0
  9. package/public/_framework/Microsoft.AspNetCore.Components.Web.lzlha3sebn.wasm.br +0 -0
  10. package/public/_framework/Microsoft.AspNetCore.Components.Web.lzlha3sebn.wasm.gz +0 -0
  11. package/public/_framework/Microsoft.AspNetCore.Components.WebAssembly.hgb9kb1ko8.wasm +0 -0
  12. package/public/_framework/Microsoft.AspNetCore.Components.WebAssembly.hgb9kb1ko8.wasm.br +0 -0
  13. package/public/_framework/Microsoft.AspNetCore.Components.WebAssembly.hgb9kb1ko8.wasm.gz +0 -0
  14. package/public/_framework/Microsoft.AspNetCore.Components.ctlimky0ld.wasm +0 -0
  15. package/public/_framework/Microsoft.AspNetCore.Components.ctlimky0ld.wasm.br +0 -0
  16. package/public/_framework/Microsoft.AspNetCore.Components.ctlimky0ld.wasm.gz +0 -0
  17. package/public/_framework/Microsoft.Extensions.Configuration.Abstractions.ex1njydbd4.wasm +0 -0
  18. package/public/_framework/Microsoft.Extensions.Configuration.Abstractions.ex1njydbd4.wasm.br +0 -0
  19. package/public/_framework/Microsoft.Extensions.Configuration.Abstractions.ex1njydbd4.wasm.gz +0 -0
  20. package/public/_framework/Microsoft.Extensions.Configuration.EnvironmentVariables.dufoils7aa.wasm +0 -0
  21. package/public/_framework/Microsoft.Extensions.Configuration.EnvironmentVariables.dufoils7aa.wasm.br +0 -0
  22. package/public/_framework/Microsoft.Extensions.Configuration.EnvironmentVariables.dufoils7aa.wasm.gz +0 -0
  23. package/public/_framework/Microsoft.Extensions.Configuration.Json.2cwa6dgvjw.wasm +0 -0
  24. package/public/_framework/Microsoft.Extensions.Configuration.Json.2cwa6dgvjw.wasm.br +0 -0
  25. package/public/_framework/Microsoft.Extensions.Configuration.Json.2cwa6dgvjw.wasm.gz +0 -0
  26. package/public/_framework/Microsoft.Extensions.Configuration.tf0s85350j.wasm +0 -0
  27. package/public/_framework/Microsoft.Extensions.Configuration.tf0s85350j.wasm.br +0 -0
  28. package/public/_framework/Microsoft.Extensions.Configuration.tf0s85350j.wasm.gz +0 -0
  29. package/public/_framework/Microsoft.Extensions.DependencyInjection.Abstractions.ykrsa5qwvj.wasm +0 -0
  30. package/public/_framework/Microsoft.Extensions.DependencyInjection.Abstractions.ykrsa5qwvj.wasm.br +0 -0
  31. package/public/_framework/Microsoft.Extensions.DependencyInjection.Abstractions.ykrsa5qwvj.wasm.gz +0 -0
  32. package/public/_framework/Microsoft.Extensions.DependencyInjection.q4ogihpz4g.wasm +0 -0
  33. package/public/_framework/Microsoft.Extensions.DependencyInjection.q4ogihpz4g.wasm.br +0 -0
  34. package/public/_framework/Microsoft.Extensions.DependencyInjection.q4ogihpz4g.wasm.gz +0 -0
  35. package/public/_framework/Microsoft.Extensions.Diagnostics.Abstractions.w51v02shrt.wasm +0 -0
  36. package/public/_framework/Microsoft.Extensions.Diagnostics.Abstractions.w51v02shrt.wasm.br +0 -0
  37. package/public/_framework/Microsoft.Extensions.Diagnostics.Abstractions.w51v02shrt.wasm.gz +0 -0
  38. package/public/_framework/Microsoft.Extensions.Diagnostics.jdah25iecf.wasm +0 -0
  39. package/public/_framework/Microsoft.Extensions.Diagnostics.jdah25iecf.wasm.br +0 -0
  40. package/public/_framework/Microsoft.Extensions.Diagnostics.jdah25iecf.wasm.gz +0 -0
  41. package/public/_framework/Microsoft.Extensions.Hosting.Abstractions.2esolmyrj5.wasm +0 -0
  42. package/public/_framework/Microsoft.Extensions.Hosting.Abstractions.2esolmyrj5.wasm.br +0 -0
  43. package/public/_framework/Microsoft.Extensions.Hosting.Abstractions.2esolmyrj5.wasm.gz +0 -0
  44. package/public/_framework/Microsoft.Extensions.Logging.Abstractions.zwtdylwuov.wasm +0 -0
  45. package/public/_framework/Microsoft.Extensions.Logging.Abstractions.zwtdylwuov.wasm.br +0 -0
  46. package/public/_framework/Microsoft.Extensions.Logging.Abstractions.zwtdylwuov.wasm.gz +0 -0
  47. package/public/_framework/Microsoft.Extensions.Logging.xmx5eyc5ch.wasm +0 -0
  48. package/public/_framework/Microsoft.Extensions.Logging.xmx5eyc5ch.wasm.br +0 -0
  49. package/public/_framework/Microsoft.Extensions.Logging.xmx5eyc5ch.wasm.gz +0 -0
  50. package/public/_framework/Microsoft.Extensions.Options.bxcwufxpzd.wasm +0 -0
  51. package/public/_framework/Microsoft.Extensions.Options.bxcwufxpzd.wasm.br +0 -0
  52. package/public/_framework/Microsoft.Extensions.Options.bxcwufxpzd.wasm.gz +0 -0
  53. package/public/_framework/Microsoft.Extensions.Primitives.r28g7oh1t8.wasm +0 -0
  54. package/public/_framework/Microsoft.Extensions.Primitives.r28g7oh1t8.wasm.br +0 -0
  55. package/public/_framework/Microsoft.Extensions.Primitives.r28g7oh1t8.wasm.gz +0 -0
  56. package/public/_framework/Microsoft.JSInterop.WebAssembly.kthmj8ue8z.wasm +0 -0
  57. package/public/_framework/Microsoft.JSInterop.WebAssembly.kthmj8ue8z.wasm.br +0 -0
  58. package/public/_framework/Microsoft.JSInterop.WebAssembly.kthmj8ue8z.wasm.gz +0 -0
  59. package/public/_framework/Microsoft.JSInterop.z69euz7ekt.wasm +0 -0
  60. package/public/_framework/Microsoft.JSInterop.z69euz7ekt.wasm.br +0 -0
  61. package/public/_framework/Microsoft.JSInterop.z69euz7ekt.wasm.gz +0 -0
  62. package/public/_framework/OnaPlotter.g1oyk97tth.wasm +0 -0
  63. package/public/_framework/OnaPlotter.g1oyk97tth.wasm.br +0 -0
  64. package/public/_framework/OnaPlotter.g1oyk97tth.wasm.gz +0 -0
  65. package/public/_framework/System.Collections.0y3lxq9yiz.wasm +0 -0
  66. package/public/_framework/System.Collections.0y3lxq9yiz.wasm.br +0 -0
  67. package/public/_framework/System.Collections.0y3lxq9yiz.wasm.gz +0 -0
  68. package/public/_framework/System.Collections.Concurrent.y1gijyulzg.wasm +0 -0
  69. package/public/_framework/System.Collections.Concurrent.y1gijyulzg.wasm.br +0 -0
  70. package/public/_framework/System.Collections.Concurrent.y1gijyulzg.wasm.gz +0 -0
  71. package/public/_framework/System.Collections.Immutable.bv8sm0hn96.wasm +0 -0
  72. package/public/_framework/System.Collections.Immutable.bv8sm0hn96.wasm.br +0 -0
  73. package/public/_framework/System.Collections.Immutable.bv8sm0hn96.wasm.gz +0 -0
  74. package/public/_framework/System.Collections.NonGeneric.demk1o8khk.wasm +0 -0
  75. package/public/_framework/System.Collections.NonGeneric.demk1o8khk.wasm.br +0 -0
  76. package/public/_framework/System.Collections.NonGeneric.demk1o8khk.wasm.gz +0 -0
  77. package/public/_framework/System.Collections.Specialized.ybmtdn8n9q.wasm +0 -0
  78. package/public/_framework/System.Collections.Specialized.ybmtdn8n9q.wasm.br +0 -0
  79. package/public/_framework/System.Collections.Specialized.ybmtdn8n9q.wasm.gz +0 -0
  80. package/public/_framework/System.ComponentModel.Primitives.hdixdh1geb.wasm +0 -0
  81. package/public/_framework/System.ComponentModel.Primitives.hdixdh1geb.wasm.br +0 -0
  82. package/public/_framework/System.ComponentModel.Primitives.hdixdh1geb.wasm.gz +0 -0
  83. package/public/_framework/System.ComponentModel.TypeConverter.80a5fdjdf1.wasm +0 -0
  84. package/public/_framework/System.ComponentModel.TypeConverter.80a5fdjdf1.wasm.br +0 -0
  85. package/public/_framework/System.ComponentModel.TypeConverter.80a5fdjdf1.wasm.gz +0 -0
  86. package/public/_framework/System.ComponentModel.er3kikotc9.wasm +0 -0
  87. package/public/_framework/System.ComponentModel.er3kikotc9.wasm.br +0 -0
  88. package/public/_framework/System.ComponentModel.er3kikotc9.wasm.gz +0 -0
  89. package/public/_framework/System.Console.ztyrgmguq9.wasm +0 -0
  90. package/public/_framework/System.Console.ztyrgmguq9.wasm.br +0 -0
  91. package/public/_framework/System.Console.ztyrgmguq9.wasm.gz +0 -0
  92. package/public/_framework/System.Diagnostics.DiagnosticSource.8ovi6htwue.wasm +0 -0
  93. package/public/_framework/System.Diagnostics.DiagnosticSource.8ovi6htwue.wasm.br +0 -0
  94. package/public/_framework/System.Diagnostics.DiagnosticSource.8ovi6htwue.wasm.gz +0 -0
  95. package/public/_framework/System.IO.Pipelines.ehyowalz06.wasm +0 -0
  96. package/public/_framework/System.IO.Pipelines.ehyowalz06.wasm.br +0 -0
  97. package/public/_framework/System.IO.Pipelines.ehyowalz06.wasm.gz +0 -0
  98. package/public/_framework/System.Linq.77nzpgno3g.wasm +0 -0
  99. package/public/_framework/System.Linq.77nzpgno3g.wasm.br +0 -0
  100. package/public/_framework/System.Linq.77nzpgno3g.wasm.gz +0 -0
  101. package/public/_framework/System.Memory.96u3edrscq.wasm +0 -0
  102. package/public/_framework/System.Memory.96u3edrscq.wasm.br +0 -0
  103. package/public/_framework/System.Memory.96u3edrscq.wasm.gz +0 -0
  104. package/public/_framework/System.Net.Http.04zi0q3bww.wasm +0 -0
  105. package/public/_framework/System.Net.Http.04zi0q3bww.wasm.br +0 -0
  106. package/public/_framework/System.Net.Http.04zi0q3bww.wasm.gz +0 -0
  107. package/public/_framework/System.Net.Http.Json.dfsls33yd0.wasm +0 -0
  108. package/public/_framework/System.Net.Http.Json.dfsls33yd0.wasm.br +0 -0
  109. package/public/_framework/System.Net.Http.Json.dfsls33yd0.wasm.gz +0 -0
  110. package/public/_framework/System.Net.Primitives.3bql0h4h9x.wasm +0 -0
  111. package/public/_framework/System.Net.Primitives.3bql0h4h9x.wasm.br +0 -0
  112. package/public/_framework/System.Net.Primitives.3bql0h4h9x.wasm.gz +0 -0
  113. package/public/_framework/System.Net.WebSockets.Client.yabl5yso4d.wasm +0 -0
  114. package/public/_framework/System.Net.WebSockets.Client.yabl5yso4d.wasm.br +0 -0
  115. package/public/_framework/System.Net.WebSockets.Client.yabl5yso4d.wasm.gz +0 -0
  116. package/public/_framework/System.Net.WebSockets.btb8u9bs63.wasm +0 -0
  117. package/public/_framework/System.Net.WebSockets.btb8u9bs63.wasm.br +0 -0
  118. package/public/_framework/System.Net.WebSockets.btb8u9bs63.wasm.gz +0 -0
  119. package/public/_framework/System.ObjectModel.y2vjd96rm0.wasm +0 -0
  120. package/public/_framework/System.ObjectModel.y2vjd96rm0.wasm.br +0 -0
  121. package/public/_framework/System.ObjectModel.y2vjd96rm0.wasm.gz +0 -0
  122. package/public/_framework/System.Private.CoreLib.18u2ssdtkz.wasm +0 -0
  123. package/public/_framework/System.Private.CoreLib.18u2ssdtkz.wasm.br +0 -0
  124. package/public/_framework/System.Private.CoreLib.18u2ssdtkz.wasm.gz +0 -0
  125. package/public/_framework/System.Private.Uri.lipib74a1x.wasm +0 -0
  126. package/public/_framework/System.Private.Uri.lipib74a1x.wasm.br +0 -0
  127. package/public/_framework/System.Private.Uri.lipib74a1x.wasm.gz +0 -0
  128. package/public/_framework/System.Private.Xml.Linq.01wrv6yr49.wasm +0 -0
  129. package/public/_framework/System.Private.Xml.Linq.01wrv6yr49.wasm.br +0 -0
  130. package/public/_framework/System.Private.Xml.Linq.01wrv6yr49.wasm.gz +0 -0
  131. package/public/_framework/System.Private.Xml.h7x38gg1kw.wasm +0 -0
  132. package/public/_framework/System.Private.Xml.h7x38gg1kw.wasm.br +0 -0
  133. package/public/_framework/System.Private.Xml.h7x38gg1kw.wasm.gz +0 -0
  134. package/public/_framework/System.Runtime.InteropServices.JavaScript.fymien2tnc.wasm +0 -0
  135. package/public/_framework/System.Runtime.InteropServices.JavaScript.fymien2tnc.wasm.br +0 -0
  136. package/public/_framework/System.Runtime.InteropServices.JavaScript.fymien2tnc.wasm.gz +0 -0
  137. package/public/_framework/System.Runtime.InteropServices.h45u78t9gg.wasm +0 -0
  138. package/public/_framework/System.Runtime.InteropServices.h45u78t9gg.wasm.br +0 -0
  139. package/public/_framework/System.Runtime.InteropServices.h45u78t9gg.wasm.gz +0 -0
  140. package/public/_framework/System.Runtime.nqxxfenwc0.wasm +0 -0
  141. package/public/_framework/System.Runtime.nqxxfenwc0.wasm.br +0 -0
  142. package/public/_framework/System.Runtime.nqxxfenwc0.wasm.gz +0 -0
  143. package/public/_framework/System.Security.Cryptography.r8xdxuwcik.wasm +0 -0
  144. package/public/_framework/System.Security.Cryptography.r8xdxuwcik.wasm.br +0 -0
  145. package/public/_framework/System.Security.Cryptography.r8xdxuwcik.wasm.gz +0 -0
  146. package/public/_framework/System.Text.Encodings.Web.8tv8c2qml7.wasm +0 -0
  147. package/public/_framework/System.Text.Encodings.Web.8tv8c2qml7.wasm.br +0 -0
  148. package/public/_framework/System.Text.Encodings.Web.8tv8c2qml7.wasm.gz +0 -0
  149. package/public/_framework/System.Text.Json.vlj0ri24nf.wasm +0 -0
  150. package/public/_framework/System.Text.Json.vlj0ri24nf.wasm.br +0 -0
  151. package/public/_framework/System.Text.Json.vlj0ri24nf.wasm.gz +0 -0
  152. package/public/_framework/System.Text.RegularExpressions.syst47d0hk.wasm +0 -0
  153. package/public/_framework/System.Text.RegularExpressions.syst47d0hk.wasm.br +0 -0
  154. package/public/_framework/System.Text.RegularExpressions.syst47d0hk.wasm.gz +0 -0
  155. package/public/_framework/System.Threading.3w9td3odjb.wasm +0 -0
  156. package/public/_framework/System.Threading.3w9td3odjb.wasm.br +0 -0
  157. package/public/_framework/System.Threading.3w9td3odjb.wasm.gz +0 -0
  158. package/public/_framework/System.Web.HttpUtility.s6p043ak0k.wasm +0 -0
  159. package/public/_framework/System.Web.HttpUtility.s6p043ak0k.wasm.br +0 -0
  160. package/public/_framework/System.Web.HttpUtility.s6p043ak0k.wasm.gz +0 -0
  161. package/public/_framework/System.Xml.Linq.6jrwceho2h.wasm +0 -0
  162. package/public/_framework/System.Xml.Linq.6jrwceho2h.wasm.br +0 -0
  163. package/public/_framework/System.Xml.Linq.6jrwceho2h.wasm.gz +0 -0
  164. package/public/_framework/System.Xml.ReaderWriter.au2hkgm2hw.wasm +0 -0
  165. package/public/_framework/System.Xml.ReaderWriter.au2hkgm2hw.wasm.br +0 -0
  166. package/public/_framework/System.Xml.ReaderWriter.au2hkgm2hw.wasm.gz +0 -0
  167. package/public/_framework/System.Xml.XDocument.pllf66tpew.wasm +0 -0
  168. package/public/_framework/System.Xml.XDocument.pllf66tpew.wasm.br +0 -0
  169. package/public/_framework/System.Xml.XDocument.pllf66tpew.wasm.gz +0 -0
  170. package/public/_framework/System.n1lgwvdeih.wasm +0 -0
  171. package/public/_framework/System.n1lgwvdeih.wasm.br +0 -0
  172. package/public/_framework/System.n1lgwvdeih.wasm.gz +0 -0
  173. package/public/_framework/blazor.webassembly.js +2 -0
  174. package/public/_framework/blazor.webassembly.js.br +0 -0
  175. package/public/_framework/blazor.webassembly.js.gz +0 -0
  176. package/public/_framework/blazor.webassembly.js.map +1 -0
  177. package/public/_framework/blazor.webassembly.js.map.br +0 -0
  178. package/public/_framework/blazor.webassembly.js.map.gz +0 -0
  179. package/public/_framework/dotnet.js +462 -0
  180. package/public/_framework/dotnet.js.br +0 -0
  181. package/public/_framework/dotnet.js.gz +0 -0
  182. package/public/_framework/dotnet.native.0yslzj0e9x.wasm +0 -0
  183. package/public/_framework/dotnet.native.0yslzj0e9x.wasm.br +0 -0
  184. package/public/_framework/dotnet.native.0yslzj0e9x.wasm.gz +0 -0
  185. package/public/_framework/dotnet.native.ijy01f6viz.js +5502 -0
  186. package/public/_framework/dotnet.native.ijy01f6viz.js.br +0 -0
  187. package/public/_framework/dotnet.native.ijy01f6viz.js.gz +0 -0
  188. package/public/_framework/dotnet.runtime.uyfhwbfd13.js +4 -0
  189. package/public/_framework/dotnet.runtime.uyfhwbfd13.js.br +0 -0
  190. package/public/_framework/dotnet.runtime.uyfhwbfd13.js.gz +0 -0
  191. package/public/apple-touch-icon-180.png +0 -0
  192. package/public/appsettings.json +1 -0
  193. package/public/css/app.css +1 -0
  194. package/public/css/app.css.br +0 -0
  195. package/public/css/app.css.gz +0 -0
  196. package/public/css/bootstrap/bootstrap.min.css +5 -0
  197. package/public/css/bootstrap/bootstrap.min.css.br +0 -0
  198. package/public/css/bootstrap/bootstrap.min.css.gz +0 -0
  199. package/public/favicon.svg +19 -0
  200. package/public/favicon.svg.br +0 -0
  201. package/public/favicon.svg.gz +0 -0
  202. package/public/fonts/InterVariable.woff2 +0 -0
  203. package/public/icon-192.png +0 -0
  204. package/public/icon-512.png +0 -0
  205. package/public/index.html +208 -0
  206. package/public/js/activeRouteLayer.js +10 -0
  207. package/public/js/activeRouteLayer.js.br +0 -0
  208. package/public/js/activeRouteLayer.js.gz +0 -0
  209. package/public/js/aisLayer.js +12 -0
  210. package/public/js/aisLayer.js.br +0 -0
  211. package/public/js/aisLayer.js.gz +0 -0
  212. package/public/js/anchorLayer.js +1 -0
  213. package/public/js/anchorLayer.js.br +0 -0
  214. package/public/js/anchorLayer.js.gz +0 -0
  215. package/public/js/atonLayer.js +24 -0
  216. package/public/js/atonLayer.js.br +0 -0
  217. package/public/js/atonLayer.js.gz +0 -0
  218. package/public/js/boatIcons.js +1 -0
  219. package/public/js/boatIcons.js.br +0 -0
  220. package/public/js/boatIcons.js.gz +0 -0
  221. package/public/js/chartDownshift.js +1 -0
  222. package/public/js/chartDownshift.js.br +0 -0
  223. package/public/js/chartDownshift.js.gz +0 -0
  224. package/public/js/courseLineLayer.js +1 -0
  225. package/public/js/courseLineLayer.js.br +0 -0
  226. package/public/js/courseLineLayer.js.gz +0 -0
  227. package/public/js/deadman.js +1 -0
  228. package/public/js/deadman.js.br +0 -0
  229. package/public/js/deadman.js.gz +0 -0
  230. package/public/js/dragGhost.js +1 -0
  231. package/public/js/dragGhost.js.br +0 -0
  232. package/public/js/dragGhost.js.gz +0 -0
  233. package/public/js/errorRelayBoot.js +2 -0
  234. package/public/js/errorRelayBoot.js.br +0 -0
  235. package/public/js/errorRelayBoot.js.gz +0 -0
  236. package/public/js/format.js +1 -0
  237. package/public/js/format.js.br +0 -0
  238. package/public/js/format.js.gz +0 -0
  239. package/public/js/geoMath.js +1 -0
  240. package/public/js/geoMath.js.br +0 -0
  241. package/public/js/geoMath.js.gz +0 -0
  242. package/public/js/geomPixels.js +1 -0
  243. package/public/js/geomPixels.js.br +0 -0
  244. package/public/js/geomPixels.js.gz +0 -0
  245. package/public/js/historyMapLayer.js +1 -0
  246. package/public/js/historyMapLayer.js.br +0 -0
  247. package/public/js/historyMapLayer.js.gz +0 -0
  248. package/public/js/keyboardShortcuts.js +1 -0
  249. package/public/js/keyboardShortcuts.js.br +0 -0
  250. package/public/js/keyboardShortcuts.js.gz +0 -0
  251. package/public/js/laylineLayer.js +1 -0
  252. package/public/js/laylineLayer.js.br +0 -0
  253. package/public/js/laylineLayer.js.gz +0 -0
  254. package/public/js/leafletInterop.XG3NAVS4.js +170 -0
  255. package/public/js/leafletInterop.XG3NAVS4.js.br +0 -0
  256. package/public/js/leafletInterop.XG3NAVS4.js.gz +0 -0
  257. package/public/js/leafletInterop.js +1 -0
  258. package/public/js/mapRotation.js +1 -0
  259. package/public/js/mapRotation.js.br +0 -0
  260. package/public/js/mapRotation.js.gz +0 -0
  261. package/public/js/marinePoiLayer.js +35 -0
  262. package/public/js/marinePoiLayer.js.br +0 -0
  263. package/public/js/marinePoiLayer.js.gz +0 -0
  264. package/public/js/markerLayer.js +1 -0
  265. package/public/js/markerLayer.js.br +0 -0
  266. package/public/js/markerLayer.js.gz +0 -0
  267. package/public/js/measureLayer.js +1 -0
  268. package/public/js/measureLayer.js.br +0 -0
  269. package/public/js/measureLayer.js.gz +0 -0
  270. package/public/js/noteLayer.js +32 -0
  271. package/public/js/noteLayer.js.br +0 -0
  272. package/public/js/noteLayer.js.gz +0 -0
  273. package/public/js/overzoomLayer.js +1 -0
  274. package/public/js/overzoomLayer.js.br +0 -0
  275. package/public/js/overzoomLayer.js.gz +0 -0
  276. package/public/js/ownBoatPopup.js +1 -0
  277. package/public/js/ownBoatPopup.js.br +1 -0
  278. package/public/js/ownBoatPopup.js.gz +0 -0
  279. package/public/js/platform/audioAlert.js +1 -0
  280. package/public/js/platform/audioAlert.js.br +0 -0
  281. package/public/js/platform/audioAlert.js.gz +0 -0
  282. package/public/js/platform/fileTransfer.js +1 -0
  283. package/public/js/platform/fileTransfer.js.br +0 -0
  284. package/public/js/platform/fileTransfer.js.gz +0 -0
  285. package/public/js/platform/fullscreen.js +1 -0
  286. package/public/js/platform/fullscreen.js.br +0 -0
  287. package/public/js/platform/fullscreen.js.gz +0 -0
  288. package/public/js/platform/themeApply.js +1 -0
  289. package/public/js/platform/themeApply.js.br +0 -0
  290. package/public/js/platform/themeApply.js.gz +0 -0
  291. package/public/js/platform/viewport.js +1 -0
  292. package/public/js/platform/viewport.js.br +0 -0
  293. package/public/js/platform/viewport.js.gz +0 -0
  294. package/public/js/platform/wakeLock.js +1 -0
  295. package/public/js/platform/wakeLock.js.br +0 -0
  296. package/public/js/platform/wakeLock.js.gz +0 -0
  297. package/public/js/polygonEditLayer.js +1 -0
  298. package/public/js/polygonEditLayer.js.br +0 -0
  299. package/public/js/polygonEditLayer.js.gz +0 -0
  300. package/public/js/popupHelpers.js +1 -0
  301. package/public/js/popupHelpers.js.br +0 -0
  302. package/public/js/popupHelpers.js.gz +0 -0
  303. package/public/js/radarLayer.js +1 -0
  304. package/public/js/radarLayer.js.br +0 -0
  305. package/public/js/radarLayer.js.gz +0 -0
  306. package/public/js/radarProtobuf.js +1 -0
  307. package/public/js/radarProtobuf.js.br +0 -0
  308. package/public/js/radarProtobuf.js.gz +0 -0
  309. package/public/js/rangeScale.js +1 -0
  310. package/public/js/rangeScale.js.br +0 -0
  311. package/public/js/rangeScale.js.gz +0 -0
  312. package/public/js/regionLayer.js +10 -0
  313. package/public/js/regionLayer.js.br +0 -0
  314. package/public/js/regionLayer.js.gz +0 -0
  315. package/public/js/routeEditLayer.js +1 -0
  316. package/public/js/routeEditLayer.js.br +0 -0
  317. package/public/js/routeEditLayer.js.gz +0 -0
  318. package/public/js/routeLayer.js +10 -0
  319. package/public/js/routeLayer.js.br +0 -0
  320. package/public/js/routeLayer.js.gz +0 -0
  321. package/public/js/searchBoxJs.js +1 -0
  322. package/public/js/searchBoxJs.js.br +0 -0
  323. package/public/js/trackRuns.js +1 -0
  324. package/public/js/trackRuns.js.br +0 -0
  325. package/public/js/trackRuns.js.gz +0 -0
  326. package/public/js/version.g.js +1 -0
  327. package/public/js/visibility.js +1 -0
  328. package/public/js/visibility.js.br +0 -0
  329. package/public/js/visibility.js.gz +0 -0
  330. package/public/js/waypointLayer.js +44 -0
  331. package/public/js/waypointLayer.js.br +0 -0
  332. package/public/js/waypointLayer.js.gz +0 -0
  333. package/public/js/weatherLayer.js +1 -0
  334. package/public/js/weatherLayer.js.br +0 -0
  335. package/public/js/weatherLayer.js.gz +0 -0
  336. package/public/lib/bootstrap/dist/css/bootstrap-grid.css +4085 -0
  337. package/public/lib/bootstrap/dist/css/bootstrap-grid.css.br +0 -0
  338. package/public/lib/bootstrap/dist/css/bootstrap-grid.css.gz +0 -0
  339. package/public/lib/bootstrap/dist/css/bootstrap-grid.css.map +1 -0
  340. package/public/lib/bootstrap/dist/css/bootstrap-grid.css.map.br +0 -0
  341. package/public/lib/bootstrap/dist/css/bootstrap-grid.css.map.gz +0 -0
  342. package/public/lib/bootstrap/dist/css/bootstrap-grid.min.css +6 -0
  343. package/public/lib/bootstrap/dist/css/bootstrap-grid.min.css.br +0 -0
  344. package/public/lib/bootstrap/dist/css/bootstrap-grid.min.css.gz +0 -0
  345. package/public/lib/bootstrap/dist/css/bootstrap-grid.min.css.map +1 -0
  346. package/public/lib/bootstrap/dist/css/bootstrap-grid.min.css.map.br +0 -0
  347. package/public/lib/bootstrap/dist/css/bootstrap-grid.min.css.map.gz +0 -0
  348. package/public/lib/bootstrap/dist/css/bootstrap-grid.rtl.css +4084 -0
  349. package/public/lib/bootstrap/dist/css/bootstrap-grid.rtl.css.br +0 -0
  350. package/public/lib/bootstrap/dist/css/bootstrap-grid.rtl.css.gz +0 -0
  351. package/public/lib/bootstrap/dist/css/bootstrap-grid.rtl.css.map +1 -0
  352. package/public/lib/bootstrap/dist/css/bootstrap-grid.rtl.css.map.br +0 -0
  353. package/public/lib/bootstrap/dist/css/bootstrap-grid.rtl.css.map.gz +0 -0
  354. package/public/lib/bootstrap/dist/css/bootstrap-grid.rtl.min.css +6 -0
  355. package/public/lib/bootstrap/dist/css/bootstrap-grid.rtl.min.css.br +0 -0
  356. package/public/lib/bootstrap/dist/css/bootstrap-grid.rtl.min.css.gz +0 -0
  357. package/public/lib/bootstrap/dist/css/bootstrap-grid.rtl.min.css.map +1 -0
  358. package/public/lib/bootstrap/dist/css/bootstrap-grid.rtl.min.css.map.br +0 -0
  359. package/public/lib/bootstrap/dist/css/bootstrap-grid.rtl.min.css.map.gz +0 -0
  360. package/public/lib/bootstrap/dist/css/bootstrap-reboot.css +597 -0
  361. package/public/lib/bootstrap/dist/css/bootstrap-reboot.css.br +0 -0
  362. package/public/lib/bootstrap/dist/css/bootstrap-reboot.css.gz +0 -0
  363. package/public/lib/bootstrap/dist/css/bootstrap-reboot.css.map +1 -0
  364. package/public/lib/bootstrap/dist/css/bootstrap-reboot.css.map.br +0 -0
  365. package/public/lib/bootstrap/dist/css/bootstrap-reboot.css.map.gz +0 -0
  366. package/public/lib/bootstrap/dist/css/bootstrap-reboot.min.css +6 -0
  367. package/public/lib/bootstrap/dist/css/bootstrap-reboot.min.css.br +0 -0
  368. package/public/lib/bootstrap/dist/css/bootstrap-reboot.min.css.gz +0 -0
  369. package/public/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map +1 -0
  370. package/public/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map.br +0 -0
  371. package/public/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map.gz +0 -0
  372. package/public/lib/bootstrap/dist/css/bootstrap-reboot.rtl.css +594 -0
  373. package/public/lib/bootstrap/dist/css/bootstrap-reboot.rtl.css.br +0 -0
  374. package/public/lib/bootstrap/dist/css/bootstrap-reboot.rtl.css.gz +0 -0
  375. package/public/lib/bootstrap/dist/css/bootstrap-reboot.rtl.css.map +1 -0
  376. package/public/lib/bootstrap/dist/css/bootstrap-reboot.rtl.css.map.br +0 -0
  377. package/public/lib/bootstrap/dist/css/bootstrap-reboot.rtl.css.map.gz +0 -0
  378. package/public/lib/bootstrap/dist/css/bootstrap-reboot.rtl.min.css +6 -0
  379. package/public/lib/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.br +0 -0
  380. package/public/lib/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.gz +0 -0
  381. package/public/lib/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.map +1 -0
  382. package/public/lib/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.map.br +0 -0
  383. package/public/lib/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.map.gz +0 -0
  384. package/public/lib/bootstrap/dist/css/bootstrap-utilities.css +5402 -0
  385. package/public/lib/bootstrap/dist/css/bootstrap-utilities.css.br +0 -0
  386. package/public/lib/bootstrap/dist/css/bootstrap-utilities.css.gz +0 -0
  387. package/public/lib/bootstrap/dist/css/bootstrap-utilities.css.map +1 -0
  388. package/public/lib/bootstrap/dist/css/bootstrap-utilities.css.map.br +0 -0
  389. package/public/lib/bootstrap/dist/css/bootstrap-utilities.css.map.gz +0 -0
  390. package/public/lib/bootstrap/dist/css/bootstrap-utilities.min.css +6 -0
  391. package/public/lib/bootstrap/dist/css/bootstrap-utilities.min.css.br +0 -0
  392. package/public/lib/bootstrap/dist/css/bootstrap-utilities.min.css.gz +0 -0
  393. package/public/lib/bootstrap/dist/css/bootstrap-utilities.min.css.map +1 -0
  394. package/public/lib/bootstrap/dist/css/bootstrap-utilities.min.css.map.br +0 -0
  395. package/public/lib/bootstrap/dist/css/bootstrap-utilities.min.css.map.gz +0 -0
  396. package/public/lib/bootstrap/dist/css/bootstrap-utilities.rtl.css +5393 -0
  397. package/public/lib/bootstrap/dist/css/bootstrap-utilities.rtl.css.br +0 -0
  398. package/public/lib/bootstrap/dist/css/bootstrap-utilities.rtl.css.gz +0 -0
  399. package/public/lib/bootstrap/dist/css/bootstrap-utilities.rtl.css.map +1 -0
  400. package/public/lib/bootstrap/dist/css/bootstrap-utilities.rtl.css.map.br +0 -0
  401. package/public/lib/bootstrap/dist/css/bootstrap-utilities.rtl.css.map.gz +0 -0
  402. package/public/lib/bootstrap/dist/css/bootstrap-utilities.rtl.min.css +6 -0
  403. package/public/lib/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.br +0 -0
  404. package/public/lib/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.gz +0 -0
  405. package/public/lib/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.map +1 -0
  406. package/public/lib/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.map.br +0 -0
  407. package/public/lib/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.map.gz +0 -0
  408. package/public/lib/bootstrap/dist/css/bootstrap.css +12057 -0
  409. package/public/lib/bootstrap/dist/css/bootstrap.css.br +0 -0
  410. package/public/lib/bootstrap/dist/css/bootstrap.css.gz +0 -0
  411. package/public/lib/bootstrap/dist/css/bootstrap.css.map +1 -0
  412. package/public/lib/bootstrap/dist/css/bootstrap.css.map.br +0 -0
  413. package/public/lib/bootstrap/dist/css/bootstrap.css.map.gz +0 -0
  414. package/public/lib/bootstrap/dist/css/bootstrap.min.css +6 -0
  415. package/public/lib/bootstrap/dist/css/bootstrap.min.css.br +0 -0
  416. package/public/lib/bootstrap/dist/css/bootstrap.min.css.gz +0 -0
  417. package/public/lib/bootstrap/dist/css/bootstrap.min.css.map +1 -0
  418. package/public/lib/bootstrap/dist/css/bootstrap.min.css.map.br +0 -0
  419. package/public/lib/bootstrap/dist/css/bootstrap.min.css.map.gz +0 -0
  420. package/public/lib/bootstrap/dist/css/bootstrap.rtl.css +12030 -0
  421. package/public/lib/bootstrap/dist/css/bootstrap.rtl.css.br +0 -0
  422. package/public/lib/bootstrap/dist/css/bootstrap.rtl.css.gz +0 -0
  423. package/public/lib/bootstrap/dist/css/bootstrap.rtl.css.map +1 -0
  424. package/public/lib/bootstrap/dist/css/bootstrap.rtl.css.map.br +0 -0
  425. package/public/lib/bootstrap/dist/css/bootstrap.rtl.css.map.gz +0 -0
  426. package/public/lib/bootstrap/dist/css/bootstrap.rtl.min.css +6 -0
  427. package/public/lib/bootstrap/dist/css/bootstrap.rtl.min.css.br +0 -0
  428. package/public/lib/bootstrap/dist/css/bootstrap.rtl.min.css.gz +0 -0
  429. package/public/lib/bootstrap/dist/css/bootstrap.rtl.min.css.map +1 -0
  430. package/public/lib/bootstrap/dist/css/bootstrap.rtl.min.css.map.br +0 -0
  431. package/public/lib/bootstrap/dist/css/bootstrap.rtl.min.css.map.gz +0 -0
  432. package/public/lib/bootstrap/dist/js/bootstrap.bundle.js +6314 -0
  433. package/public/lib/bootstrap/dist/js/bootstrap.bundle.js.br +0 -0
  434. package/public/lib/bootstrap/dist/js/bootstrap.bundle.js.gz +0 -0
  435. package/public/lib/bootstrap/dist/js/bootstrap.bundle.js.map +1 -0
  436. package/public/lib/bootstrap/dist/js/bootstrap.bundle.js.map.br +0 -0
  437. package/public/lib/bootstrap/dist/js/bootstrap.bundle.js.map.gz +0 -0
  438. package/public/lib/bootstrap/dist/js/bootstrap.bundle.min.js +7 -0
  439. package/public/lib/bootstrap/dist/js/bootstrap.bundle.min.js.br +0 -0
  440. package/public/lib/bootstrap/dist/js/bootstrap.bundle.min.js.gz +0 -0
  441. package/public/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -0
  442. package/public/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map.br +0 -0
  443. package/public/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map.gz +0 -0
  444. package/public/lib/bootstrap/dist/js/bootstrap.esm.js +4447 -0
  445. package/public/lib/bootstrap/dist/js/bootstrap.esm.js.br +0 -0
  446. package/public/lib/bootstrap/dist/js/bootstrap.esm.js.gz +0 -0
  447. package/public/lib/bootstrap/dist/js/bootstrap.esm.js.map +1 -0
  448. package/public/lib/bootstrap/dist/js/bootstrap.esm.js.map.br +0 -0
  449. package/public/lib/bootstrap/dist/js/bootstrap.esm.js.map.gz +0 -0
  450. package/public/lib/bootstrap/dist/js/bootstrap.esm.min.js +7 -0
  451. package/public/lib/bootstrap/dist/js/bootstrap.esm.min.js.br +0 -0
  452. package/public/lib/bootstrap/dist/js/bootstrap.esm.min.js.gz +0 -0
  453. package/public/lib/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -0
  454. package/public/lib/bootstrap/dist/js/bootstrap.esm.min.js.map.br +0 -0
  455. package/public/lib/bootstrap/dist/js/bootstrap.esm.min.js.map.gz +0 -0
  456. package/public/lib/bootstrap/dist/js/bootstrap.js +4494 -0
  457. package/public/lib/bootstrap/dist/js/bootstrap.js.br +0 -0
  458. package/public/lib/bootstrap/dist/js/bootstrap.js.gz +0 -0
  459. package/public/lib/bootstrap/dist/js/bootstrap.js.map +1 -0
  460. package/public/lib/bootstrap/dist/js/bootstrap.js.map.br +0 -0
  461. package/public/lib/bootstrap/dist/js/bootstrap.js.map.gz +0 -0
  462. package/public/lib/bootstrap/dist/js/bootstrap.min.js +7 -0
  463. package/public/lib/bootstrap/dist/js/bootstrap.min.js.br +0 -0
  464. package/public/lib/bootstrap/dist/js/bootstrap.min.js.gz +0 -0
  465. package/public/lib/bootstrap/dist/js/bootstrap.min.js.map +1 -0
  466. package/public/lib/bootstrap/dist/js/bootstrap.min.js.map.br +0 -0
  467. package/public/lib/bootstrap/dist/js/bootstrap.min.js.map.gz +0 -0
  468. package/public/lib/leaflet/dist/images/layers-2x.png +0 -0
  469. package/public/lib/leaflet/dist/images/layers.png +0 -0
  470. package/public/lib/leaflet/dist/images/marker-icon-2x.png +0 -0
  471. package/public/lib/leaflet/dist/images/marker-icon.png +0 -0
  472. package/public/lib/leaflet/dist/images/marker-shadow.png +0 -0
  473. package/public/lib/leaflet/dist/leaflet.css +661 -0
  474. package/public/lib/leaflet/dist/leaflet.css.br +0 -0
  475. package/public/lib/leaflet/dist/leaflet.css.gz +0 -0
  476. package/public/lib/leaflet/dist/leaflet.js +6 -0
  477. package/public/lib/leaflet/dist/leaflet.js.br +0 -0
  478. package/public/lib/leaflet/dist/leaflet.js.gz +0 -0
  479. package/public/manifest.json +30 -0
  480. package/public/manifest.json.br +0 -0
  481. package/public/manifest.json.gz +0 -0
  482. package/public/service-worker.js +1741 -0
@@ -0,0 +1,1741 @@
1
+ // Service worker for OnaPlotter PWA.
2
+ // Caches the app shell for faster loads; network-first for API calls.
3
+
4
+ // v2 -> v3: chartOverzoom module extraction (shape change).
5
+ // v3 -> v4: chart-tile cache-as-you-view (new rule below).
6
+ // v4 -> v5: errorRelayBoot.js + themeApply.js + index.html shell update;
7
+ // bundle precaches the new boot script so an iPad that
8
+ // loaded an older version doesn't keep serving it offline.
9
+ // Bump CACHE_NAME on EVERY shell-asset change going forward
10
+ // (favicon, css, html, any APP_SHELL entry).
11
+ // v5 -> v6: harden tileCacheFirst against Cache API rejections so
12
+ // Firefox no longer surfaces tile fetches as
13
+ // "ServiceWorker intercepted ... unexpected error".
14
+ // v6 -> v7: PWA standalone scrollbar fix (sidebar 100dvh + body
15
+ // overflow lock) + sidebar-collapse user toggle. CSS
16
+ // changes only, but APP_SHELL precaches need a refresh.
17
+ // v7 -> v8: anchor-on-route-activate JS marker clear (race fix)
18
+ // + in-place route edit forces active-route refetch.
19
+ // Bundled C# changes won't affect SW behaviour but the
20
+ // helm should see the fixed flow on the next reload, so
21
+ // bump triggers an app shell refresh.
22
+ // v8 -> v9: sidebar-collapse moved into NavMenu foot; iOS fullbleed
23
+ // map-container fills full viewport (no -3rem topbar gap)
24
+ // so Safari's bottom toolbar no longer overlaps the HUD.
25
+ // v9 -> v10: anchor-raise visual feedback (dim marker until SK delta
26
+ // confirms) replaces the optimistic clear that masked
27
+ // errors and raced the next sync tick.
28
+ // v10 -> v11: wheel zoom + arrow-step + reverse + save-as-copy in
29
+ // route edit; Stop Navigation now uses the same dim-and-
30
+ // wait pattern as anchor raise instead of optimistically
31
+ // clearing local state.
32
+ // v11 -> v12: route activation no longer auto-raises the anchor (only
33
+ // the reverse direction stays); editing the active route
34
+ // temporarily hides the active overlay to avoid double-
35
+ // drawing, restores after Cancel/Save.
36
+ // v12 -> v13: tile cache cap 1000 -> 5000 + LRU promotion on hit
37
+ // (delete+re-put moves entries to end of insertion order
38
+ // so trim evicts least-recently-used). keepBuffer 4 -> 6
39
+ // on tile layers for snappier route-planning pans.
40
+ // v13 -> v14: post-sail-readiness follow-ups - sidebar-collapse
41
+ // driven by user setting only (no longer forced by
42
+ // :fullscreen / .ios-fullbleed CSS so the chevron toggle
43
+ // works in fullscreen); active-route hides the regular
44
+ // polyline so the dashed-leg overlay isn't double-drawn;
45
+ // route HUD shows passed/total nm; iPad follow centres
46
+ // the boat above the geometric centre; CPA dismiss
47
+ // cooldown 30s -> 15min; PNG PWA icons + apple-touch-icon
48
+ // so iPad install shows the OnaPlotter logo; prev/next
49
+ // waypoint buttons in route HUD; AIS popup autoPan off.
50
+ // v14 -> v15: real-browser :fullscreen now hides the topbar (matches
51
+ // .ios-fullbleed) so the 100dvh map-container fits the
52
+ // viewport without 3rem of bottom overflow on Firefox /
53
+ // Chrome / Edge; Settings + other overflowing pages get
54
+ // a main-as-scroll-container fallback under :fullscreen
55
+ // so the helm can scroll Settings while in real
56
+ // fullscreen.
57
+ // v15 -> v16: branded boot loading screen (favicon-derived SVG +
58
+ // spinner + build stamp from js/version.g.js); phone
59
+ // first-run default collapses the sidebar to the icon
60
+ // rail; nav menu picks up a tighter @media trim under
61
+ // 600px so labels + icons fit without crowding.
62
+ // v16 -> v17: drop the body { overflow: hidden } chain we added under
63
+ // :fullscreen for non-map pages. On Firefox the chain
64
+ // ate Settings / History / Resources scroll instead of
65
+ // routing it to <main>; reverting to the natural document
66
+ // scroll restores it. Map page is still locked via the
67
+ // body:has(.map-container) rule.
68
+ // v17 -> v18: stop hiding the topbar in :fullscreen / .ios-fullbleed
69
+ // so zoom / night / liveness / exit-fullscreen affordances
70
+ // stay visible while fullscreen. Map-container falls back
71
+ // to its non-fullscreen calc(100dvh - 3rem) height. Also
72
+ // explicit pointer-events: auto on the route prev/next
73
+ // and autopilot buttons inside the non-corner HUDs (the
74
+ // parent .hud / .hud-panel pointer-events: none was
75
+ // swallowing taps on those new buttons).
76
+ // v18 -> v19: scoped main-as-scroll-container fix for Settings /
77
+ // Dashboard / History / Resources in fullscreen. Just
78
+ // constrain <main> itself (height 100dvh, overflow-y
79
+ // auto); leaves html / body alone so the chain that
80
+ // tripped Firefox in v17 isn't reintroduced.
81
+ // v19 -> v20: outer-try guard on tileCacheFirst: any unhandled
82
+ // throw / sync-rejection from the cache-API path now
83
+ // falls through to a 504 placeholder rather than
84
+ // rejecting respondWith(). Helm reported recurring
85
+ // "ServiceWorker intercepted ... unexpected error" on
86
+ // Firefox; v6 hardened the documented failure modes,
87
+ // v20 catches the residue (clone-throw on quirky
88
+ // Response bodies, sync-throws from cache.put on low-
89
+ // memory Firefox, ...). Also drops the LRU clone+put
90
+ // promotion on cache hits - helm reported "no single
91
+ // tile loads" which points at body-stream contention
92
+ // between the served response and the background put.
93
+ // We accept FIFO eviction and ship reliable tile
94
+ // rendering; LRU was nice-to-have, tile delivery is
95
+ // not negotiable.
96
+ // v20 -> v21: tile-cache audit follow-ups.
97
+ // - /signalk/* + WS pass-through and app-shell cache
98
+ // handlers now wrapped (passThroughOrPlaceholder,
99
+ // appShellCacheFirst) so a fetch / Cache-API rejection
100
+ // doesn't bubble into respondWith and trigger the
101
+ // same Firefox SW-intercept error we squashed for
102
+ // tiles in v20.
103
+ // - tile-cache reference module-scoped (getTileCache);
104
+ // eliminates per-request caches.open() spin-up.
105
+ // - trimTileCache throttled (every 50 puts) + single-
106
+ // flight + parallel-delete; was running a full
107
+ // cache.keys() walk on every successful put.
108
+ // - keepBuffer 6 -> 10 on the OSM / OpenSeaMap base
109
+ // and per-chart layers (leafletInterop.js); larger
110
+ // in-DOM tile retention so small route-planning pans
111
+ // don't re-fetch.
112
+ // v21 -> v22: network-first for /js/*, /css/*, and the document root.
113
+ // Stale-while-revalidate (the previous strategy) caches
114
+ // a working JS module on first visit AND keeps serving
115
+ // that exact byte-for-byte cached copy on every
116
+ // subsequent visit until the cache is bumped manually.
117
+ // Every deploy that adds a new C#-callable export to a
118
+ // JS module (e.g. setGuardZoneWarningRingVisible in PR
119
+ // #143) crashes the helm's NEXT page load with a
120
+ // Blazor "value is not a function" because the new C#
121
+ // code calls a function the cached old JS doesn't
122
+ // have. The cache eventually refreshes in the
123
+ // background and the helm's NEXT-NEXT load works - but
124
+ // one crashed reload per deploy is one too many; e2e
125
+ // CI surfaces it as a hard failure.
126
+ // Network-first fetches fresh on every online load and
127
+ // only falls back to cache when the network is gone.
128
+ // The 304-revalidation path keeps the bytes-on-the-wire
129
+ // cost low (Kestrel sends ETag, browser sends
130
+ // If-None-Match, server replies 304 with no body when
131
+ // unchanged). Offline launch still works because the
132
+ // network failure surfaces the cached copy.
133
+ // v22 -> v23: radar range-ring labels + emphasised active-ring stroke.
134
+ // css/app.css is in APP_SHELL so a stale precache would
135
+ // ship the old (label-less) styles to a freshly-loaded
136
+ // page even with the network-first JS rule overriding the
137
+ // code path. Bump invalidates the shell precache so the
138
+ // helm picks up the new label styling on next launch.
139
+ // v23 -> v24: route-total dashed divider scoped to big-screen mode,
140
+ // closing border under the chart-filter Display section.
141
+ // Same APP_SHELL invalidation reasoning as v23.
142
+ // v24 -> v25: chart-filter Reset button always visible (with
143
+ // :disabled state styled when at defaults). CSS gained
144
+ // a new :disabled rule, so the precache must refresh.
145
+ // v25 -> v26: topbar place-search SearchBox + search-pin overlay
146
+ // (Phase 2 of the geocoder feature). New CSS rules
147
+ // under .topbar-search* / .search-pin* land in the
148
+ // APP_SHELL precache; bump invalidates the stale shell.
149
+ // v26 -> v27: Place-search Phase 3 - own-data separator + source
150
+ // badge. Adds .topbar-search-separator + -badge CSS
151
+ // under APP_SHELL.
152
+ // v27 -> v28: Place-search Phase 4 - Nominatim fallback + offline
153
+ // empty-state hint. Adds .topbar-search-empty-title
154
+ // / -hint CSS under APP_SHELL.
155
+ // v28 -> v29: Place-search dropdown switched to HUD-card tokens
156
+ // (--hud-card-bg / -stroke-in / -stroke-out / -halo /
157
+ // --hud-ink) so the dropdown matches HUD opacity in
158
+ // night / dark themes instead of looking transparent.
159
+ // v29 -> v30: SearchBox.razor rewritten to use @bind + request-id
160
+ // counter (was: value="@_query" + manual @oninput +
161
+ // CTS chain). The previous controlled-input pattern
162
+ // raced keystrokes against in-handler StateHasChanged
163
+ // calls, dropping characters and (often) preventing
164
+ // a search request from firing at all.
165
+ // v30 -> v31: SearchBox.razor rewritten AGAIN - fully uncontrolled
166
+ // input (no value=, no @bind). The renderer never
167
+ // writes the value attribute, so the helm's typing
168
+ // can't be clobbered. Added searchBoxJs.js for the
169
+ // programmatic clear / fill-on-pick paths.
170
+ // v31 -> v32: AnchorEditPanel + HudAnchorCard component shapes
171
+ // changed (manual JS-only fallback removed; plugin
172
+ // v2.0.0+ is the only supported source). The cached
173
+ // v31 WASM still references the dropped CanRaise /
174
+ // OnAutoSetRadius / Manual / ManualRadiusMeters
175
+ // parameters, so a freshly-deployed shell loaded into
176
+ // a stale-WASM browser throws InvalidOperationException
177
+ // at render time. Bump invalidates the precache so the
178
+ // helm pulls the new framework on next launch.
179
+ // v32 -> v33: SearchBox state-cleanup pass - explicit
180
+ // StateHasChanged so the spinner shows during the
181
+ // in-flight call; catch-all around SearchAsync so
182
+ // any decorator regression degrades to empty list
183
+ // instead of leaving the dropdown in a half-rendered
184
+ // "stopped working" state.
185
+ // v33 -> v34: AnchorEditPanel SetRadius mode reverted to pick-then-
186
+ // Set with on-map preview (was: live-commit, which
187
+ // couldn't show "Auto-grows-as-boat-drifts" without
188
+ // spamming PUTs). Panel gained OnPreviewRadius parameter
189
+ // and an .anchor-edit-set button; lost the SetRadius
190
+ // Close button. Cached v33 WASM passing the old shape
191
+ // would render a panel without preview wiring.
192
+ // v34 -> v35: .top-row z-index 1 -> 1000 so the SearchBox typeahead
193
+ // dropdown (which visually overflows from the topbar
194
+ // into the map area) renders ABOVE the leaflet map
195
+ // panes + HUD cards. The dropdown WAS rendering - the
196
+ // helm could see the rows in the HTML inspector - but
197
+ // the parent's stacking context capped its effective
198
+ // z-index at 1, so the chart painted over it.
199
+ // v35 -> v36: History page no longer sends a viewport bbox to the
200
+ // track API. Helm-visible: loading "yesterday" while
201
+ // zoomed at home harbour now returns the full passage
202
+ // instead of just the marina pixels. Framework files
203
+ // go through cache-first, so without this bump a
204
+ // helm with the v35 cache would keep loading the
205
+ // old (bbox-sending) WASM after redeploy.
206
+ // v36 -> v37: Mobile layout pass.
207
+ // - More menu trims Centre / Fit Track / Legend / Tips
208
+ // on phone + scrolls if it still overflows.
209
+ // - Depth HUD now expands on phone (rows were always
210
+ // hidden by mobile CSS; now hidden only when collapsed).
211
+ // - Topbar tightened (smaller icon buttons, narrower
212
+ // SearchBox, smaller padding).
213
+ // - Search input gets text-overflow: ellipsis on phone.
214
+ // - Alarm-history button replaces text with a clipboard
215
+ // icon + count badge (markup change: alarm-log-icon
216
+ // span replaces alarm-log-label-short).
217
+ // - Active-route HUD hides per-leg TTG / ETA + the
218
+ // prev/next chevron buttons on phone (route-total row
219
+ // carries the macro time).
220
+ // CSS-only + small markup tweak; WASM is unchanged
221
+ // except for the new History icon helper. Bump
222
+ // invalidates the precache so helms pull the new CSS +
223
+ // markup together.
224
+ // v37 -> v38: Route HUD spacing + ResourceHttp timeout handling.
225
+ // - Bumped --panel-gap 9 -> 16 px so the bc-stack
226
+ // (anchor + active route) has visible breathing room
227
+ // above the bottom bar.
228
+ // - On phone, lifted .hud-stack-bc by an extra 64 px so
229
+ // it floats ABOVE the depth / heading corner cards
230
+ // instead of sharing the bottom band (route card was
231
+ // 340 px wide on a 390-wide viewport, leaving no room
232
+ // for the corners next to it).
233
+ // - ResourceHttp.{Get,Post,Put,Delete,PostCreate} now
234
+ // also catch OperationCanceledException when the
235
+ // caller didn't cancel - that's the HttpClient
236
+ // timeout path, which previously bubbled past the
237
+ // helpers as TaskCanceledException and reached
238
+ // Blazor's renderer error UI ("An unhandled error has
239
+ // occurred"). Failures still surface as toasts; the
240
+ // banner only fires for genuine bugs now.
241
+ // v38 -> v39: ResourceStore added: live route / waypoint / note /
242
+ // region sync via SignalkClient.OnResourceDelta + REST
243
+ // reconcile on reconnect. Adds new JS export
244
+ // leafletInterop.updateRoute (in-place setLatLngs +
245
+ // popup refresh + dot rebuild). Stale leafletInterop.js
246
+ // without updateRoute throws "value is not a function"
247
+ // on first remote-route delta; bump invalidates the
248
+ // precache. Closes the multi-plotter route-edit
249
+ // sync gap (plotter A edits, plotter B's polyline now
250
+ // updates without reload).
251
+ // v39 -> v40: Mobile layout iteration 2.
252
+ // - --panel-gap 16 -> 4 px and dropped the 64 px phone
253
+ // lift on .hud-stack-bc. Helm: "too much padding".
254
+ // - Expanded HUDs paint OVER the bottom menu + the
255
+ // route/anchor cards via :has(.hud-panel-expanded)
256
+ // -> z-index pop on the parent stack. Tap a corner
257
+ // to expand; details overlay everything; tap again
258
+ // to collapse. Same behaviour on every breakpoint;
259
+ // desktop wasn't seeing the issue today but the
260
+ // policy is consistent.
261
+ // - Chart-quick-bar is no longer hidden on phone -
262
+ // smaller chips (font 0.62rem, padding 2px 8px) so
263
+ // the helm can flip charts without diving into the
264
+ // full Layers panel.
265
+ // - Topbar on phone: overflow-x:auto + scroll-bar-
266
+ // hidden so a still-wide row (auth chip + update
267
+ // chip + search + zoom + night) scrolls horizontally
268
+ // instead of clipping off the right edge on FF
269
+ // Android. Also shrunk topbar-icon-btn 1.75 -> 1.5
270
+ // rem and the SearchBox cap 180 -> 160 px.
271
+ // v40 -> v41: .hud-value gets `white-space: nowrap` so the unit
272
+ // suffix span never wraps onto its own line. Helm
273
+ // reported a depth of "38.2 m" rendering as "38.2"
274
+ // on one line, "m" on the next on a narrow BL card;
275
+ // the inline-box boundary between the digit text
276
+ // node and the .hud-unit <span> was a wrap
277
+ // opportunity. The TR wind card already had its own
278
+ // nowrap rule; lifting it onto the base class covers
279
+ // depth, route metrics, and any other corner value
280
+ // with the same shape.
281
+ // v41 -> v42: New Layers > Marine services section +
282
+ // marinePoiLayer.js module (OSM Overpass overlay for
283
+ // fuel docks, marinas, harbours, moorings, slipways,
284
+ // piers, chandleries, drinking water, pump-outs).
285
+ // LayersPanel gained ~9 toggle parameters + a new
286
+ // child component; cached v41 WASM passing the old
287
+ // shape into the v42 panel component would render
288
+ // without the new section AND error on unknown
289
+ // parameters during diff. Bump invalidates the
290
+ // precache so the helm pulls the new framework on
291
+ // next launch.
292
+ // v42 -> v43: Multi-plotter sync extended to waypoints / notes /
293
+ // regions. Map.razor subscribes to ResourceStore's
294
+ // per-type Changed/Removed events and pushes redraws
295
+ // via MapResourceController.Redraw{Waypoint,Note,
296
+ // Region}Async. ResourceStore.HandleRegionDelta now
297
+ // populates OuterRings on delta-fed regions (mirrors
298
+ // RegionApi.GetAllAsync) so the Leaflet polygon
299
+ // actually renders. Resources page gains a manual
300
+ // Refresh button that calls RefreshAllAsync.
301
+ // v43 -> v44: HTML-escape route name + note title before they reach
302
+ // Leaflet's bindTooltip (leafletInterop.js addRoute /
303
+ // updateRoute, noteLayer.js addNoteMarker). Without
304
+ // this, a remote-edited resource name like
305
+ // '<img src=x onerror=...>' executed on hover because
306
+ // bindTooltip writes its string argument straight to
307
+ // innerHTML. waypointLayer was already safe via
308
+ // formatWaypointTooltip's existing esc() calls.
309
+ // v44 -> v45: Drop Map.razor's 60 s resourcePollTimer +
310
+ // RefreshServerResourcesAsync. ResourceStore now keeps
311
+ // waypoints / routes / notes / regions live via the
312
+ // resources.* SK delta subscriptions (PR #238) and
313
+ // reconciles via REST on every reconnect, so the
314
+ // page-level poll was redundant work. The
315
+ // ToggleLayersPanel-open path narrows to a radar-only
316
+ // refresh (radar fields aren't published over the SK
317
+ // delta stream). Per-delta handlers now flush the
318
+ // filter cache + topbar-search index when an add /
319
+ // remove changes the cached counts so the panel and
320
+ // search pick up the change without waiting for a pan.
321
+ // v45 -> v46: ResourceStore snapshot caching + event-fire cleanup.
322
+ // The Routes / Waypoints / Notes / Regions read
323
+ // properties cache the IReadOnlyList and only rebuild
324
+ // when the underlying dictionary mutates, so a HUD that
325
+ // reads Count + then iterates no longer allocates a
326
+ // fresh list per access. Event invocations route through
327
+ // a shared SafeInvoke helper instead of ~30 inline
328
+ // try/catch sites; Replace{Type} reuses one instance
329
+ // HashSet for the upsert-membership lookup and only
330
+ // allocates the stale-id list when there's actually one
331
+ // to remove.
332
+ // v46 -> v47: Resource reconcile observability. RefreshAllAsync
333
+ // gains a `cause` parameter ("startup", "page-mount",
334
+ // "manual", "reconnect") that surfaces in the
335
+ // reconcile-started + reconcile-complete structured
336
+ // logs, so a helm reading the journal can tell why a
337
+ // reconcile fired without correlating timestamps. The
338
+ // reconcile-complete line now reports per-type added /
339
+ // updated / removed counts (not just totals), so it's
340
+ // obvious when "everything stayed the same" vs "5
341
+ // routes deleted server-side". Connection-edge
342
+ // transitions log explicitly so the journal shows when
343
+ // deltas paused / resumed.
344
+ // v47 -> v48: ResourceStore extracted to a typed cache primitive
345
+ // (ResourceTypeCache<T>). Per-type duplication -
346
+ // dictionary, snapshot list, Changed/Removed events,
347
+ // subscriber-throw guard, Replace logic - all collapse
348
+ // onto one generic class; ResourceStore composes four
349
+ // instances (one per resource type). The public API
350
+ // (Routes / Waypoints / OnRouteChanged / ...) is
351
+ // unchanged via custom event accessors that forward to
352
+ // the inner cache; existing subscribers keep working
353
+ // without any code change on their side.
354
+ // v48 -> v49: Mobile layout helm round.
355
+ // - chart-quick chips: 10-char + ellipsis truncation in
356
+ // C#; combined (pointer:coarse) AND (max-width:600)
357
+ // override drops the touch-floor 44px chip height to
358
+ // 28px on phones so the strip doesn't crowd the
359
+ // chart underneath.
360
+ // - prev/next waypoint chevrons re-shown on phones
361
+ // (previously display:none in the phone @media).
362
+ // Per-leg TTG/ETA stays hidden so DTW/BRG/VMG fit
363
+ // on one line.
364
+ // - Route-total row drops the TTG span (variable-width,
365
+ // sometimes wrapped onto a second line on phone);
366
+ // keeps the fixed-width "ETA HH:MM". flex-wrap:
367
+ // nowrap + white-space: nowrap enforce single line.
368
+ // - --ctrl-bar-height bumped per config to match
369
+ // actual rendered bar heights (mobile 48->58,
370
+ // pointer:coarse new override 70). Earlier guesses
371
+ // left the route HUD overlapping the bar; new values
372
+ // place it exactly --panel-gap above the bar's top
373
+ // edge across desktop / iPad / mobile / big-type.
374
+ // - Free/Follow promoted from the More menu's phone-
375
+ // overflow block to the always-visible bar so the
376
+ // phone bar reads [More, Free/Follow, Layers]. The
377
+ // More-menu row carries .ctrl-more-mobile-hide so
378
+ // it's suppressed on phones to avoid duplicating
379
+ // the bar version.
380
+ // v49 -> v50: Region popup + map upgrade + Resources active-route pin
381
+ // + global prose dash style.
382
+ // - leafletInterop.addRegion gained five params
383
+ // (isHazard, areaSqM, centerLat, centerLon,
384
+ // radiusMeters, createdAtIso). Cached v49 WASM
385
+ // calls the old 4-arg shape and the new JS would
386
+ // render the popup without metadata; bump invalidates
387
+ // the precache so the helm picks up matched bundles.
388
+ // - Hazard regions render in red with an always-on
389
+ // warning glyph at the centroid; popup includes
390
+ // area, coords, created, hazard chip, plus an Edit
391
+ // button next to Delete.
392
+ // - Resources page pins the active route at the top
393
+ // with View-on-map / Stop actions.
394
+ // - Codebase-wide prose dash style: " -- " (em-dash)
395
+ // replaced with " - " (hyphen) in comments, README,
396
+ // UI strings - helm-readability pass, no behavioural
397
+ // impact.
398
+ // v50 -> v51: Range-scale chip now carries the zoom level inline
399
+ // (e.g. "0.5 nm | z14") so the helm reads distance and
400
+ // zoom from the same chip; the standalone Leaflet
401
+ // zoom-level badge (already display:none for a few
402
+ // revisions) stays hidden. CSS + JS only; bump
403
+ // invalidates the precache so the helm picks up the new
404
+ // .ona-range-scale-zoom rule on next launch.
405
+ // v51 -> v52: Anchor Auto formula now factors swing + tide drop.
406
+ // AutoRadiusPreview was "current distance + 5 m" (or
407
+ // "armed-max + 5 m"). New shape is
408
+ // swing + tide-drop + 5 m margin, where:
409
+ // - swing = AnchorPeakRadius (worst-case observed
410
+ // since drop) -> AnchorCurrentRadius -> haversine,
411
+ // in priority order.
412
+ // - tide-drop = max(0, TideHeightNow - TideHeightLow)
413
+ // from environment.tide.* deltas; reflects the
414
+ // extra effective scope the boat will swing on
415
+ // between now and the next predicted low water.
416
+ // - 5 m margin: blanket safety pad.
417
+ // AnchorEditPanel gains an AutoBreakdown parameter so
418
+ // the chip's tooltip and the panel's eyebrow both read
419
+ // the same helm-readable summary
420
+ // ("swing 38 m + tide drop 4 m + 5 m margin"); the
421
+ // eyebrow is now computed live (was a static string set
422
+ // at panel-open) so it follows the boat as the swing
423
+ // peak grows and tide ticks.
424
+ // v52 -> v53: Marine services master "Show" toggle + Layers panel
425
+ // reorder + Resources Import/Refresh grouping.
426
+ // - MarineServicesSection grows a header "Show" chip
427
+ // that flips MarinePoiOverlayVisible (new persisted
428
+ // setting, defaults true). When off, the controller
429
+ // drops every marker AND skips Overpass fetches; per-
430
+ // category picks survive a hide/show round-trip.
431
+ // IMarinePoiSettings + AppSettingsService extended;
432
+ // existing fakes updated.
433
+ // - Misc section moved to the bottom of the Layers
434
+ // panel (was above Marine services). Helm: chart-
435
+ // related sections cluster at the top, the grab-bag
436
+ // sits last.
437
+ // - Resources page Import + Refresh wrapped in a single
438
+ // flex group so they sit adjacent on the right;
439
+ // previously space-between pushed Import to the
440
+ // middle and Refresh to the far right.
441
+ // v53 -> v54: Hazard region warning glyph centring fix.
442
+ // - .region-hazard-glyph picks up box-sizing: border-box
443
+ // so the rendered disk is exactly 24x24 (was 28x28
444
+ // under default content-box, putting the disk's
445
+ // visual centre 2px below-right of the iconAnchor
446
+ // coordinate).
447
+ // - Inner glyph swapped from Unicode U+26A0 to an
448
+ // inline SVG triangle + exclamation. The codepoint's
449
+ // font-dependent baseline metrics rendered off-centre
450
+ // on Safari / Firefox / Chrome each in their own way;
451
+ // the SVG is pixel-deterministic.
452
+ // v54 -> v55: Quick-chip + circle-preview helm round.
453
+ // - regionLayer.setCirclePreview switches from
454
+ // colors.region (amber) to colors.current (violet)
455
+ // so the in-progress circle reads as the same
456
+ // "shape I'm drawing" family as route-edit and
457
+ // polygon-edit. Finalised regions still amber.
458
+ // - chart.Name no longer truncated in C# to 10 chars.
459
+ // Truncation moves to a CSS clip (max-width:8em +
460
+ // text-overflow:ellipsis) gated to the phone @media
461
+ // so desktop / iPad get the full name and only a
462
+ // 390-wide phone reads "Bahamas No...".
463
+ // - main:has(.big-type) .chart-quick-chip rule added:
464
+ // font 0.92rem, padding 6/14, radius 16 -- ~2pt
465
+ // taller than the default and noticeably bigger than
466
+ // the touch (pointer:coarse) override on the helm
467
+ // console where big-type lives.
468
+ // v55 -> v56: Alarms helm round.
469
+ // - Per-rule disable: Settings -> Alarms now lists
470
+ // every registered rule with a switch + a master
471
+ // on/off; AlarmManager.Evaluate skips disabled rules
472
+ // and drops their already-active banners.
473
+ // - Default thresholds retuned for fewer false
474
+ // positives: SHALLOW 3->2 m, ANCHOR TIDE 1->0.5 m,
475
+ // WIND SHIFT 15->30 deg, lookback 5->10 min, min TWS
476
+ // 3->5 kn. Existing helms keep their stored values.
477
+ // - APPROACH self-clears on auto-advance: the system's
478
+ // auto-advance now dismisses the latched banner the
479
+ // same way the manual Next-WP tap on the alarm does,
480
+ // so the helm doesn't see a stale APPROACH for a
481
+ // waypoint they just sailed past.
482
+ // v56 -> v57: Mobile alarm overlay round.
483
+ // - Phone (<=600px): the floating alarm-banner stack
484
+ // is hidden. Active alarms surface in the alarm-log
485
+ // overlay (see next bullet) and the topbar history
486
+ // button blinks a danger-tinted pulse so the helm's
487
+ // eye still catches a fire.
488
+ // - Alarm-log overlay grows an "Active" section above
489
+ // the existing "Recent" history list - on every
490
+ // layout, not just mobile. Each row carries the same
491
+ // Snooze / Next-WP / Hold-to-dismiss affordances the
492
+ // banner offered, so the overlay is now a complete
493
+ // actionable view instead of read-only history.
494
+ // - Phone overlay goes full-screen (top:0 + 100dvh)
495
+ // instead of the previous 75vh bottom-sheet so the
496
+ // Active rows + the Recent list both fit without a
497
+ // separate scroll container.
498
+ // - Topbar button visibility broadens to include
499
+ // "active alarms exist" -- previously gated on
500
+ // history / snoozed only, which left phones with no
501
+ // affordance for live alarms.
502
+ // v57 -> v58: Coalesce ResourceStore.OnRouteChanged storms during
503
+ // reconnect-edge reconcile. The cache fires Changed
504
+ // for every upserted entry on the reconnect-edge
505
+ // reconcile pass; on a 93-route boat that's 93
506
+ // fire-and-forget tasks racing through the same JS-
507
+ // interop path simultaneously, which on the Pi WASM
508
+ // host blew the 5 MB stack ("RuntimeError: memory
509
+ // access out of bounds" in the renderer trace) every
510
+ // time the WS dropped + reconnected. Map.razor's
511
+ // HandleRouteChangedFromStore now queues the id and
512
+ // schedules a single drain via Task.Yield; subsequent
513
+ // events fold into the pending set, the drain
514
+ // serialises the per-id work. Routes were the
515
+ // demonstrated culprit (~93); waypoints / notes /
516
+ // regions stay on the per-id path until they show
517
+ // the same symptom.
518
+ // v58 -> v59: Settings -> Alarms hides the empty-title row.
519
+ // ServerNotificationsAlarmRule's Title is "" by
520
+ // design (it's a multi-output bridge that emits
521
+ // per-notification titles), which previously rendered
522
+ // a label-less toggle in the per-rule list. The UI
523
+ // loop now skips empty-title rules so the visible
524
+ // list matches the description above it (server-side
525
+ // notifications stay independently armed). All-off
526
+ // master already short-circuited via the setter's
527
+ // empty-key guard, so its behaviour is unchanged.
528
+ // v59 -> v60: Settings page restructured.
529
+ // - Mode -> "HUD & input" header break so the chart
530
+ // upscale / autopilot HUD / radar HUD / keep-screen
531
+ // toggles read as a group instead of squatting
532
+ // under the boat-class header.
533
+ // - Alarms section: per-alarm cards each carry their
534
+ // own Enabled toggle (new AlarmRuleEnableToggle
535
+ // component); standalone "Enable client-side
536
+ // alarms" card removed; master "All on/off" stays
537
+ // at the top.
538
+ // - Map elements (Own/AIS COG vector, radar range
539
+ // rings) and Course (server-side approach,
540
+ // waypoint arrival radius, auto-advance) split
541
+ // out from Alarms into their own headers.
542
+ // - Anchor section: ANCHOR DRAG + ANCHOR TIDE per-
543
+ // rule cards plus the existing tide-alarm setup
544
+ // checklist plus a NEW "Auto anchor radius" card
545
+ // showing the swing+tide+margin formula and a
546
+ // tunable safety-margin field (replaces the 5 m
547
+ // const in Map.razor; new
548
+ // AnchorAutoRadiusSafetyMargin setting persisted
549
+ // under "anchorAutoRadiusSafetyMargin.v1").
550
+ // - Advanced section collapsed by default
551
+ // (advancedOpen field, in-memory only).
552
+ // v60 -> v61: Topbar + alarm overlay polish.
553
+ // - .topbar-icon-btn + .alarm-log-btn drop their
554
+ // fixed heights and pick up align-self: stretch so
555
+ // every topbar button fills the full 3 rem row;
556
+ // helm flagged the previous 2 rem-ish buttons as
557
+ // under-using the band + awkward to tap.
558
+ // - Alarm-log button icon switches by state: warning
559
+ // triangle (Icons.Small.Warning, new) when active
560
+ // alarms are firing, clipboard / note-block (the
561
+ // existing History) when only the dismissed-history
562
+ // is non-empty.
563
+ // - Mobile overlay starts at top:3rem (below the
564
+ // topbar) instead of top:0; topbar stays visible so
565
+ // the connection chip + the now-blinking alarm
566
+ // button are still glanceable while reviewing the
567
+ // list. The grab-handle pill is gone -- the X on
568
+ // the right is the single close affordance.
569
+ // v61 -> v62: Settings page tighter layout.
570
+ // - Section reorder: Display first, Mode second, HUD
571
+ // third (was Mode -> HUD & input -> ... -> Display
572
+ // at the bottom). Helm asked the look-and-feel
573
+ // picker to be the first thing the page shows.
574
+ // - "HUD & input" renamed to "HUD". The input bits
575
+ // (keep-screen-awake, show keyboard hints) moved
576
+ // into Display alongside Theme + Night Mode + Big
577
+ // screen mode; they're all global look-and-feel
578
+ // knobs.
579
+ // - The big Night Mode card split: Night Mode +
580
+ // presets + Auto-flip in one card; Big screen
581
+ // mode in its own card.
582
+ // - Show tide + Expand all HUD panels moved out of
583
+ // the night-mode card into the HUD section as
584
+ // separate cards.
585
+ // - Most col-12 content cards converted to col-sm-6
586
+ // so two cards fit per row on >= sm breakpoints.
587
+ // Auto anchor radius and Boat polars stay col-12
588
+ // (the formula + the polar plot really need the
589
+ // full width).
590
+ // v62 -> v63: Topbar button + dialog rename.
591
+ // - "Alarm History" / "Active N" topbar label unified
592
+ // as "Notifications N" (matches SK v2 vocabulary +
593
+ // how helms talk about the banner stack). Icon +
594
+ // badge already convey active vs history; the label
595
+ // doesn't need to flick between two strings.
596
+ // - Dialog title "Alarms" -> "Notifications". Empty-
597
+ // state strings + the +N-more banner overflow
598
+ // tooltip retitled to match.
599
+ // v63 -> v64: Two-layer hardening for the route-storm crash family.
600
+ // (1) Source-side dedup in ResourceTypeCache.Replace:
601
+ // a content-equality function per resource type
602
+ // suppresses Changed for entries that didn't
603
+ // actually mutate during the disconnect window
604
+ // (steady cruise = zero diffs = zero events).
605
+ // (2) Per-handler coalesce-and-drain extended to
606
+ // waypoints / notes / regions, mirroring the v58
607
+ // route fix; the region drain hoists the
608
+ // RegionStore.SetRegions call out of the per-id
609
+ // loop so HazardousRegionAlarmRule re-evaluates
610
+ // once against the final state, not N times.
611
+ // Plus operator-fitness fixes:
612
+ // - NotificationsApi catches per-call OperationCancel-
613
+ // edException so MOB raise / alarm publish / ack /
614
+ // clear surface stalls as ApiResult.Fail instead of
615
+ // faulting the fire-and-forget Task. Was the silent-
616
+ // death cause for the MOB retry loop.
617
+ // - MobService.RunRaiseLoopAsync gets a top-level
618
+ // try/catch + per-attempt retry catch so any
619
+ // unexpected throw logs and continues rather than
620
+ // killing the most life-critical retry path.
621
+ // - AlarmPublisher republishes stable alarms after WS
622
+ // reconnect; previously a SHALLOW that survived a
623
+ // disconnect was invisible to other plotters until
624
+ // something local mutated.
625
+ // - SignalKNotificationAcknowledger logs ack failures
626
+ // via Console.Error (relay -> SK server log) so
627
+ // cross-plotter ack stalls are debuggable.
628
+ // v64 -> v65: Wire navigation.course.arrivalCircle (SK v2 Course
629
+ // API) so the chart's arrival ring + the client APPROACH
630
+ // alarm threshold + the route HUD all use the SAME
631
+ // radius the server uses to fire arrivalCircleEntered.
632
+ // Previously each leg's "you've arrived" boundary
633
+ // differed between client (Settings.WaypointArrivalRadiusMeters,
634
+ // default 50m) and server (per-route author's value), so
635
+ // the helm could see APPROACH banner + chart ring in one
636
+ // place while the SK course-provider considered them
637
+ // outside the circle. Local setting becomes a fallback
638
+ // for minimal SK installs that don't publish the path.
639
+ // v65 -> v66: Drop the local Settings.WaypointArrivalRadiusMeters
640
+ // fallback. navigation.course.arrivalCircle is now the
641
+ // ONLY source for the chart arrival ring + the client
642
+ // APPROACH alarm threshold. Server silent = ring hidden,
643
+ // client rule dormant. Eliminates the drift class where
644
+ // the helm-set fallback could disagree with what the
645
+ // course-provider plugin used to fire arrivalCircleEntered.
646
+ // AppSettingsService loses the property + storage key
647
+ // ("waypointArrivalRadiusMeters.v1" is intentionally not
648
+ // migrated); IAlarmThresholds + Settings page input gone.
649
+ // v66 -> v67: Fix CPA banner trailing "- ," when COLREGS classifier
650
+ // returns Indeterminate / None. Colregs.ShortLabel and
651
+ // RoleLabel now return string? (null) for those cases
652
+ // instead of empty string; CpaAlarmRule's existing
653
+ // `is not null` check now correctly suppresses the
654
+ // comma-separated suffix when there's no useful label.
655
+ // v67 -> v68: Three small adjustments.
656
+ // - AisLabelsVisible setting (default ON): toggle vessel
657
+ // name labels independent of harbor mode. Layers panel
658
+ // gets a checkbox under Misc; the JS gate ANDs the
659
+ // flag with !harborMode so harbor mode still hides
660
+ // labels while it's on.
661
+ // - Stop fanning out cache invalidation on every settings
662
+ // change. SignalkClient, MarinePoiController, and
663
+ // Map.HandleSettingsChanged now snapshot the inputs
664
+ // they actually consume and skip the JS interop /
665
+ // OnDataChanged broadcast / fetch reschedule when
666
+ // nothing relevant changed. Previously a font-size
667
+ // toggle re-pushed every JS state and re-scheduled
668
+ // the marine-POI Overpass fetch.
669
+ // - Night mode collapsed to a single binary toggle.
670
+ // Dropped NightModePreset (dusk / soft / amber / red)
671
+ // + the four-step cycle button + the .night-mode-amber
672
+ // and .night-mode-red CSS variants. Helms wanting a
673
+ // non-red dark intermediate use Theme = "dark"
674
+ // instead.
675
+ // v68 -> v69: Settings > Anchor: "Auto anchor radius" card narrows
676
+ // from col-12 to col-sm-6 so it pairs with the Tide
677
+ // Alarm setup card on the same row. <pre> formula
678
+ // gets pre-wrap + word-break so half-width on tablet
679
+ // doesn't horizontal-scroll.
680
+ // v71 -> v72: Fix "Cannot read properties of undefined (reading
681
+ // 'appendChild')" Leaflet crash that emptied the chart
682
+ // after enabling Radar HUD. Three-layer fix:
683
+ // (1) leafletInterop.initMap calls a new
684
+ // tearDownAllRadarOverlays before map.remove() so
685
+ // stale radar records can't survive a navigate-away-
686
+ // and-back pointing at a destroyed map's wiped panes.
687
+ // (2) radarLayer.setRangeRingsConfig defensively checks
688
+ // each record's map.getPanes().overlayPane and skips
689
+ // (with a one-shot destroy+log) any record whose map
690
+ // is dead. Belt-and-braces if a future code path
691
+ // leaks a record without going through initMap.
692
+ // (3) MapControlsJs.InvokeSafe now also catches
693
+ // JSException, logs to Console.Error (relay -> SK
694
+ // server log), and returns. A future JS regression
695
+ // can no longer take Blazor's renderer down for the
696
+ // rest of the session.
697
+ // v72 -> v73: Radar spokes hot-loop perf:
698
+ // (1) Uint32Array view over imageData.data + byteToRgba
699
+ // buffers; the paint loop now writes one 32-bit word
700
+ // per filled pixel instead of four bytes (~1.5x
701
+ // faster on busy chart conditions). Open-water early-
702
+ // out is unchanged.
703
+ // (2) Spoke object pool in radarProtobuf - decodeSpoke
704
+ // resets fields in place on a pooled object instead
705
+ // of returning a fresh literal per spoke. Cuts
706
+ // ~1k allocs/sec on a typical recreational radar +
707
+ // keeps V8's hidden class monomorphic across frames.
708
+ // (3) Hoisted lut/xLut/yLut + spoke.data refs to locals
709
+ // inside _paintSpoke so the JIT doesn't re-read
710
+ // them per iteration.
711
+ // v75 -> v76: General performance sweep. Three packages:
712
+ // A) AIS push pipeline. AisPushService.BuildSnapshot
713
+ // pools AisVesselPayload instances and writes fields
714
+ // in place; the per-tick allocation drops from 200
715
+ // anonymous-type objects to one array. JS aisLayer
716
+ // reuses a [lat,lon] scratch tuple, skips setLatLng
717
+ // when the position is unchanged, hoists getElement()
718
+ // once per vessel, and rotateMarker caches the inner
719
+ // <svg> + last-applied degree.
720
+ // B) Boot path. Vendored Leaflet 1.9.4 (no longer
721
+ // blocks first paint on cross-origin unpkg fetch;
722
+ // works PWA-offline). atonLayer + marinePoiLayer
723
+ // cache divIcons by category and skip setIcon when
724
+ // the cached ref hasn't changed.
725
+ // C) Per-vessel CPU. AisPalette.ShipTypeColor +
726
+ // ShipTypeCategory + Colregs.FromAisShipType use
727
+ // StringComparison.OrdinalIgnoreCase instead of
728
+ // allocating a lowercased copy. AisSart.CategoryFromAny
729
+ // fast-paths on "no mmsi:9 in context" before the
730
+ // substring extract.
731
+ // v76 -> v77: Doubled the auth-status poll cadence: 2s -> 4s while
732
+ // the not-logged-in chip is up, 1min -> 2min when it's
733
+ // not. Halves the auth-probe HTTP traffic at no UX cost.
734
+ // v77 -> v78: MOB-as-waypoint refactor. The MOB button now drops a
735
+ // waypoint with isMob=true / isActive=true / mobAlarmId=
736
+ // <notification-id> instead of a dedicated mob-layer
737
+ // marker. Cleared MOBs flip to isActive=false rather
738
+ // than getting deleted, so the chart keeps a persistent
739
+ // MOB history. mobLayer.js is gone; waypointLayer.js
740
+ // carries the pulsing-red icon variant. APP_SHELL
741
+ // precache invalidates so the freshly-loaded page picks
742
+ // up the new wiring.
743
+ // v78 -> v79: Prefer environment.depth.belowKeel for HUD + Dashboard
744
+ // + ANCHOR-TIDE math. When the bus publishes belowKeel
745
+ // the LW-clearance math collapses to belowKeel - drop
746
+ // (no draft / transducer-offset bookkeeping); installs
747
+ // that only publish belowTransducer keep the previous
748
+ // conservative formula. Display value + threshold tint
749
+ // on the depth HUD card now show "metres under keel"
750
+ // when available.
751
+ // v79 -> v80: Fix MOB icon not rendering after the as-waypoint
752
+ // refactor: leafletInterop.js's addWaypointMarker mux
753
+ // only forwarded 5 args, silently dropping the new
754
+ // isMob / isActive flags before they reached
755
+ // waypointLayer.js. The C# side wired them through
756
+ // correctly all the way to the JS module entry, so the
757
+ // POST + metadata round-tripped fine, but the chart
758
+ // rendered the casualty as a regular grey dot instead
759
+ // of the pulsing red MOB icon. One-line fix to forward
760
+ // all seven args.
761
+ // v80 -> v81: Restore the active-MOB visual style + close three
762
+ // safety gaps. (1) Active MOB waypoints now render the
763
+ // alarm-radius circle, dashed boat <-> casualty line,
764
+ // live midpoint bearing/distance label, pinned at-pin
765
+ // "MOB HH:MM:SS / T+12m / lat/lon" label, and a rich
766
+ // popup with GO (pan + zoom in) / Share / own-MMSI -
767
+ // matching the legacy mobLayer style the helm trained
768
+ // on. (2) Edit + Delete refused on MOB waypoints from
769
+ // the popup UI AND the C# JSInvokable trust boundary
770
+ // (popup buttons hidden; C# returns a helm-facing toast
771
+ // on JSInvoke). (3) The race-window-zombie ClearAsync
772
+ // bug: when the helm clears while the notification POST
773
+ // is in flight, the loop now records a ClearRequested
774
+ // flag, lets the POST complete, and fires DELETE on the
775
+ // auto-assigned serverId so the server's WS echo can't
776
+ // re-arm the alarm.
777
+ // v81 -> v82: MOB waypoint Edit + Delete affordances refined per
778
+ // helm-feedback. Edit hidden everywhere (popup,
779
+ // LayersPanel, Resources page) - editing strips MOB
780
+ // metadata via the simpler UpdateAsync overload and
781
+ // breaks cross-plotter correlation; Resources still
782
+ // has the C# refusal as defense. Delete still hidden
783
+ // from popup + LayersPanel (don't lose history during
784
+ // a rescue) but allowed from the Resources page (the
785
+ // manage-history surface; explicit pruning of test /
786
+ // obsolete MOB entries belongs there).
787
+ // v82 -> v83: History page TripDetailPanel gains a Position section.
788
+ // Trip (moving) segments show start + end lat/lon as
789
+ // DMS-with-hemisphere; stationary segments show one
790
+ // arithmetic-mean position over the segment's points.
791
+ // v83 -> v84: Helm-configured arrivalCircle reintroduced (partial
792
+ // revert of the "server is sole source" refactor). The
793
+ // SK v2 Course API spec accepts an arrivalCircle field
794
+ // on Set-Destination / Set-Active-Route bodies; the
795
+ // server adopts it as the effective
796
+ // navigation.course.arrivalCircle. Settings page gains
797
+ // a numeric input (5-1000 m, default 50). Read sites
798
+ // (HUD ring, APPROACH alarm, auto-advance) keep using
799
+ // the SK delta so a peer plotter changing the value
800
+ // mid-passage still propagates.
801
+ // v84 -> v85: Anchor radius UI polish. The legacy permanent
802
+ // "RADIUS NOT SET" tooltip on the dropped-but-unarmed
803
+ // marker is gone (helm-flagged as visual noise once
804
+ // the AnchorEditPanel SetRadius dialog took over the
805
+ // instruction surface; amber pulse + dashed ring keep
806
+ // carrying the visual cue). The SetRadius dialog now
807
+ // gains a Close button when opened standalone from the
808
+ // anchor-watch HUD card so the helm has a way out of
809
+ // an accidental "Adjust" tap; the Drop -> SetRadius
810
+ // continuation still has no Close button (helm has
811
+ // already committed to setting one).
812
+ // v85 -> v86: COG source split + smoothed/realtime axis. The
813
+ // "Course Over Ground source" setting becomes a four-
814
+ // option dropdown (True / Magnetic crossed with
815
+ // smoothed / realtime); a new "Own COG vector source"
816
+ // dropdown drives the on-map COG vector independently
817
+ // so the helm can pick realtime for immediate steering
818
+ // feedback while keeping the HUD readout smoothed. The
819
+ // legacy preferMagneticCourse.v1 boolean is migrated to
820
+ // the new cogReadoutSource.v1 string on first load.
821
+ // v86 -> v87: Server-notification banner cleanup. CPA collision
822
+ // alarms surfaced their target as the sanitised SK
823
+ // context fragment ("urn_mrn_imo_mmsi_338546948") in the
824
+ // banner body. The bridge rule now rewrites that
825
+ // fragment (in either underscore or colon form) to the
826
+ // helm-readable "MMSI 338546948" before rendering. Non-
827
+ // vessel notifications (depth, anchor, MOB) pass
828
+ // through untouched.
829
+ // v87 -> v88: Offline-resilient MOB waypoint create. The previous
830
+ // fire-and-forget POST left the chart pin permanently
831
+ // lost when the helm hit MOB while offline (alarm fired
832
+ // via the local synthetic but no resource ever reached
833
+ // the server). MobService now generates a client-side
834
+ // Guid for the waypoint id and PUTs to /resources/
835
+ // waypoints/{id} - SK v2 resources-api accepts PUT-on-
836
+ // not-yet-existing as create, so a retry that lands
837
+ // after the server already received the first attempt
838
+ // just overwrites in place rather than minting a
839
+ // duplicate pin. The create runs as a self-retrying
840
+ // loop (1s/2s/5s/10s/30s/60s, same shape as the
841
+ // notification retry); state is persisted on the
842
+ // pending-raise record so a reload mid-retry resumes
843
+ // the loop on the next session.
844
+ // v95 -> v96: XTE perpendicular tick visual indicator dropped. Helm
845
+ // feedback (re-confirmed via openplotter.local live data
846
+ // trace): the fat red bar drawn from own-boat to the
847
+ // side of the active leg used the same red as CPA + MOB
848
+ // overlays and read as a collision warning despite being
849
+ // a navigation-aid. Helm asked to remove it. Other XTE
850
+ // machinery (Xte.Classify thresholds + tests, XTE alarm
851
+ // rule, HUD readout pill) all stay intact - only the
852
+ // chart-overlay bar is gone. courseLineLayer.js reduced
853
+ // to bearing-line + arrival-ring + destination pulse;
854
+ // setCourseLine signature shrinks from 9 args to 5;
855
+ // FrameCourseLine drops PrevLat/PrevLon/Xte/XteSeverity.
856
+ // Reverts the legend entry from one rev ago.
857
+ // v94 -> v95: Legend now describes the XTE off-course tick. The
858
+ // fat red line drawn from own-boat perpendicular to the
859
+ // active route leg (cap 200 m visual length) was a real
860
+ // helm-feedback gap - "what is this fat red line, I
861
+ // dont see it in the legend". Same fix shape as the
862
+ // CPA-overlay legend update one rev ago: the rendering
863
+ // was always there, the legend just didn't list it.
864
+ // Single swatch in the offCourse red since that's the
865
+ // worst case; the green/amber/red severity bands are
866
+ // described inline in the legend text.
867
+ // v93 -> v94: Legend now describes the CPA crossing-line + X overlay
868
+ // explicitly. The previous "CPA danger" entry only
869
+ // mentioned the marker color and didn't explain the line
870
+ // from target -> projected CPA position; helms reading
871
+ // the legend asked "what's the fat red line?" because it
872
+ // wasn't called out. Added a new "CPA warning" entry
873
+ // (amber, outer-ring band) so the two-band classifier is
874
+ // discoverable from the legend alone.
875
+ // v92 -> v93: AP HUD Rudder row: degree sign now matches the
876
+ // DRIFT / HDG err style (same colour and size as the
877
+ // digit, no inline left-margin gap). Was rendering as
878
+ // "+4.0 °" with a small gray degree while the rest of
879
+ // the column showed "0°" tight.
880
+ // v91 -> v92: CPA call-graph follow-ups (round 2). Closes the
881
+ // remaining Minor + Nit findings from the post-PR-264
882
+ // review:
883
+ // * EffectiveRadiusNm corruption-recovery (NaN /
884
+ // Infinity / non-positive underwayNm) is now pinned.
885
+ // * MooredVesselTracker.Cleanup catches a torn enumerator
886
+ // instead of over-cleaning (a partial active set used
887
+ // to drop still-moored vessels).
888
+ // * AisPushService.BuildSnapshot threat-band integration
889
+ // tests pin "danger"/"warning"/"none" wire strings end-
890
+ // to-end, including the lazy-COLREGS contract for
891
+ // non-threats.
892
+ // * Per-vessel finite-check skip now logs lat/lon/cog/
893
+ // sog (rate-limited to one log/min) so a recurring
894
+ // offender is reconstructable from the SK server log.
895
+ // Per-vessel try/catch path adds the same context.
896
+ // * SignalkClient.OnSettingsChangedSync gains an explicit
897
+ // re-entrancy guard - a downstream OnDataChanged
898
+ // listener that flips a heading-pref setting no longer
899
+ // causes a double-cascade through every HUD + alarm.
900
+ // * SanitisePerTargetPath uses string.Create for one
901
+ // allocation instead of StringBuilder.
902
+ // * Cpa.cs XML doc structure cleaned up (nested summary
903
+ // that confused IntelliSense routing).
904
+ // * MooredVesselTracker.IsMoored uses
905
+ // CollectionsMarshal.GetValueRefOrAddDefault for one
906
+ // dict lookup on the slow path instead of TryGetValue
907
+ // + indexer-set roundtrip.
908
+ // * aisLayer.js stale "warning factor" comment updated
909
+ // to reference the C#-pushed OuterRingMultiplier.
910
+ // * AisVessel.Apply("buddy", ...) now logs once per
911
+ // context the first time the wire-side spoof attempt
912
+ // is dropped, leaving a forensic trail without
913
+ // flooding the log.
914
+ // Note: m3 (narrow IAisPushSettings) deferred -
915
+ // ISP-style sub-interfaces already exist; a per-consumer
916
+ // slice would add a new abstraction without shrinking
917
+ // the shared FakeSettings test fixture.
918
+ // v90 -> v91: CPA call-graph architecture follow-ups from the
919
+ // post-PR-264 review. Closes the highest-impact non-
920
+ // blocker findings:
921
+ // * Cpa.Result now carries CurrentDistanceNm as a free
922
+ // byproduct of the equirectangular projection. The
923
+ // chip pipeline + alarm rule used to each run their
924
+ // own GeoMath.HaversineMeters call - ~1200 redundant
925
+ // trig/sec on a 200-vessel harbour at 3 Hz dropped to
926
+ // zero.
927
+ // * AisPushService.BuildSnapshot extracted into four
928
+ // helpers (TryGuardFiniteInputs / TryBuildOwnContext /
929
+ // ComputeVesselThreat / FillPayload) so each phase can
930
+ // be unit-tested directly.
931
+ // * COLREGS classification is now lazy - only computed
932
+ // when the threat band is Warning or Danger. ~600
933
+ // wasted Colregs.Classify calls/sec saved on a busy
934
+ // harbour, matching the eager-vs-lazy fix already in
935
+ // CpaAlarmRule.Check. A vessel currently outside the
936
+ // outer ring has no helm-actionable COLREGS rule
937
+ // anyway.
938
+ // * aisLayer.dispose() now calls safeRemoveLayer before
939
+ // clearing each per-context dict. The old shape only
940
+ // dropped the JS reference, leaving Leaflet's internal
941
+ // _layers map holding every marker / vector / CPA line
942
+ // / X-marker / label / trail polyline that was alive
943
+ // at dispose time. Route-edit -> re-init cycles
944
+ // leaked.
945
+ // * OuterRingMultiplier is now pushed from C# via
946
+ // setGuardZone(radius, lookahead, multiplier) instead
947
+ // of being hard-coded on both sides. Single source of
948
+ // truth in Cpa.OuterRingMultiplier.
949
+ // * Cpa.Compute(in OwnSnapshot, ...) defends against a
950
+ // hand-built OwnSnapshot with non-finite Vx/Vy/Lat/Lon.
951
+ // Only setGuardZone's wire shape changed (2 args -> 3);
952
+ // the JS coerces a missing third arg to the textbook
953
+ // 2.0 default to keep upgrade ordering safe.
954
+ // v89 -> v90: CPA blocker fixes from the post-PR-263 code review.
955
+ // Closes six gaps surfaced by the focused review:
956
+ // (1) CpaAlarmRule + chart-overlay now share a single
957
+ // classifier (Cpa.ClassifyThreat with current-distance
958
+ // gate) so the audible klaxon and the chart marker can
959
+ // no longer disagree (the "X gone but alarm rings"
960
+ // pattern); (2) MooredVesselTracker adds a SOG sanity
961
+ // gate so a vessel claiming navigation.state="moored"
962
+ // at 4 kn no longer self-exempts from CPA - the
963
+ // ramming-spoof vector; (3) AisVessel drops the wire-
964
+ // side `buddy` delta path so an AIS context can't
965
+ // flag itself as a friend; (4) AisPushService.BuildSnapshot
966
+ // gains per-vessel IsFinite checks + try/catch so one
967
+ // corrupt record can't poison the whole tick; (5)
968
+ // PushAsync defers cache commit until after a successful
969
+ // push and broadens its catch from JSException to
970
+ // Exception so a stale Leaflet handle no longer empties
971
+ // the chart for the rest of the session; (6) C# pins
972
+ // the "danger"/"warning"/"none" wire string contract
973
+ // so any rename fails at compile time before reaching
974
+ // the JS overlay.
975
+ // v96 -> v97: History page gains depth aggregates + per-point
976
+ // hover. TrackSegment now carries DepthAvg/Min/Max so
977
+ // the trip-detail panel shows them alongside SOG, and
978
+ // the on-map polyline tooltip shows the same line plus
979
+ // a live "Depth here: X m" appended on mousemove from
980
+ // the closest underlying TrackPoint.
981
+ // v97 -> v98: TrackApi.RichPaths was missing
982
+ // environment.depth.belowTransducer, so the History
983
+ // GET never asked for depth and every TrackPoint came
984
+ // back with Depth=null. The v97 panel + hover code was
985
+ // already wired to render the values; the bug was a
986
+ // column away from the path-set declaration. Fixed
987
+ // RichPaths + the column-index switch + the parser to
988
+ // carry depth through, pinned with a unit test.
989
+ // v98 -> v99: Not-logged-in chip now uses the SK admin's new
990
+ // `redirect` hash-query param (signalk-server PR #2647)
991
+ // so the helm lands back on the OnaPlotter page they
992
+ // tapped the chip from. Drops target=_blank: same-tab
993
+ // navigation is the only way the redirect actually
994
+ // returns the user; new-tab would leave a duplicate
995
+ // OnaPlotter tab open. Cross-origin standalone
996
+ // configurations fall back to the bare login URL +
997
+ // the existing visibilitychange handler.
998
+ // v99 -> v100: Map reload hang fix. Trace under 4x CPU throttle
999
+ // showed a single 2.5 s main-thread block on reload:
1000
+ // 96 microtasks (insertMarkup x276 in blazor.webassembly.js)
1001
+ // stacked behind one timer-fire because the Map's
1002
+ // OnAfterRenderAsync ran the whole bootstrap in one
1003
+ // async chain. Two fixes: (a) the route / waypoint /
1004
+ // note / region REST fetches are dropped from the
1005
+ // Map - those resources are already loaded into
1006
+ // ResourceStore at app startup (Program.cs) and kept
1007
+ // fresh by SK deltas, so the Map just snapshots from
1008
+ // the store on mount; (b) Task.Yield breaks split
1009
+ // the remaining bootstrap (marker push, charts /
1010
+ // radars / buddies fetch, settings restore, AIS
1011
+ // timer, marine POI, deep-link) into 4 separate
1012
+ // timer-fires so the browser paints the chart shell
1013
+ // before each heavy batch instead of hanging until
1014
+ // the whole bootstrap completes.
1015
+ // v100 -> v101: MOB cross-reload recovery decoupled from Map.razor.
1016
+ // Previously routed through Map's HandleConnectionChanged
1017
+ // so the GET /notifications recovery ran only when the
1018
+ // helm landed on the chart page after reload (a safety
1019
+ // regression - reloading on Wind / Settings / History
1020
+ // meant another plotter's MOB never reached this banner
1021
+ // until the helm opened the chart). MobService now takes
1022
+ // SignalkClient and owns its own OnConnectionChanged
1023
+ // subscription, kicked once at Program.cs startup; the
1024
+ // reconcile re-fires on every WS reconnect edge
1025
+ // regardless of page mount. InitializeAsync is split
1026
+ // into idempotent session-init (load persisted pending)
1027
+ // + repeatable reconcile (REST GET active list) so
1028
+ // double-init no longer duplicates retry loops.
1029
+ // Drops the duplicate GET on Map mount that the helm
1030
+ // saw inside the reload hang.
1031
+ // v101 -> v102: Map server-track history fetch now uses the slim
1032
+ // MapTrack path set (position + SOG only). The renderer
1033
+ // colours by speed bucket and ignores COG / heading /
1034
+ // wind / depth, so the rich-fetch shape was paying for
1035
+ // ~5 extra columns per row on every map reload (server-
1036
+ // side join, JSON serialise, C# parse, then discard).
1037
+ // History + Stats pages keep the Rich set since their
1038
+ // segmenter + trip-detail panel consume those fields.
1039
+ // v102 -> v103: ServerTrackController no longer flips the Ship-track
1040
+ // toggle OFF when the history fetch comes back empty
1041
+ // or null. The auto-disable read as "the app decided
1042
+ // I didn't want this layer" - helm field-reported.
1043
+ // Empty / failed result now just clears the JS
1044
+ // polyline and surfaces the "no history" info; the
1045
+ // toggle stays where the helm put it. Subsequent
1046
+ // duration / resolution changes re-fetch as before.
1047
+ // v103 -> v104: Performance Hawk review follow-ups.
1048
+ // (PERF-001) BuildVesselList in Map.razor now caches
1049
+ // the result keyed on AisStore.Version + own-ship
1050
+ // state + threshold settings, so a render with
1051
+ // unchanged inputs returns the same list reference.
1052
+ // COLREGS classification gated behind the same Cpa
1053
+ // threat-band check AisPushService uses - on a
1054
+ // 200-vessel harbour the per-render Colregs.Classify
1055
+ // count drops from N to ~5% of N.
1056
+ // (PERF-002) Per-id drain handlers (route / waypoint /
1057
+ // note / region Changed) build an id->index hint
1058
+ // dictionary once per batch so each Apply is O(1)
1059
+ // instead of O(M) via List.FindIndex. 90-route
1060
+ // reconnect storm drops from O(N*M) to O(N+M).
1061
+ // (PERF-003) Removed handlers gain the same coalesce-
1062
+ // and-drain pattern that the Changed side already
1063
+ // had. Batched RemoveAll (HashSet membership) + one
1064
+ // RebuildFilteredLayers + (for regions) one
1065
+ // RegionStore.SetRegions per batch, instead of per id.
1066
+ // (PERF-004) ServerNotificationStore.TryGet / Contains
1067
+ // replace _store.Active.FirstOrDefault / Any in
1068
+ // MobService - no more per-mutation allocation of an
1069
+ // Active snapshot during a live MOB window.
1070
+ // (PERF-005) SubscribedPaths is documented as cold-
1071
+ // path / debug-only so a future caller doesn't wire
1072
+ // it into the hot path.
1073
+ // v104 -> v105: Unify "Show local trail" + "Ship track" into one
1074
+ // toggle. Helm-feedback: the two were always shown
1075
+ // together (the local trail's only purpose is to fill
1076
+ // the window between server-track refetches, a perf
1077
+ // trick to avoid hammering /history/values every
1078
+ // second), so having separate toggles was confusing.
1079
+ // Now one "Ship track" checkbox gates both layers in
1080
+ // lock-step. ToggleServerTrack seeds the local
1081
+ // polyline from TrackBuffer + delegates the server
1082
+ // fetch to ServerTrackController; per-tick segments
1083
+ // keep filling the cursor between fetches. The
1084
+ // periodic 60 s server-track refresh runs whenever
1085
+ // the layer is visible (previously gated on active-
1086
+ // route too). The route-suppress latch is gone;
1087
+ // local + server can overlap by design - that's the
1088
+ // unified "live + catch-up" model. Settings key
1089
+ // localTrackVisible.v1 is retired (left orphan in
1090
+ // localStorage).
1091
+ // v105 -> v106: Slow down the server-track refresh + trim the local
1092
+ // trail seed window. Refresh interval 60 s -> 300 s
1093
+ // (5 min) cuts the per-hour load on the SK history
1094
+ // plugin from 60 fetches/hr to 12 - plenty of catch-
1095
+ // up freshness for cruising motion, the local in-
1096
+ // memory trail covers the gap visually. Local trail
1097
+ // seed now trims to the most recent ~390 s
1098
+ // (LocalTrailRenderWindowSeconds = refresh x 1.3)
1099
+ // instead of the full TrackBuffer so the visible
1100
+ // polyline doesn't redundantly overlap the server
1101
+ // window at cold start. Resilience: after 3
1102
+ // consecutive server-track refreshes come back empty
1103
+ // / failed the local trail re-seeds with the full
1104
+ // buffer so a sustained history-endpoint outage
1105
+ // doesn't leave the helm with only 6 min of trail.
1106
+ // First success after expansion contracts back. The
1107
+ // bool result threads through
1108
+ // ServerTrackController.{Toggle,Refresh,Set*}Async
1109
+ // (Task<bool> now) so the failure counter sees every
1110
+ // fetch outcome, not just the periodic one. 9 new
1111
+ // tests pin the bool contract.
1112
+ // v106 -> v107: GPX trip export gains optional per-trkpt extensions
1113
+ // (speed / course / depth) under the Garmin
1114
+ // TrackPointExtension v2 namespace - the de-facto
1115
+ // standard read by OpenCPN, SeaPilot, Navionics, B&G
1116
+ // and Garmin devices. After the helm picks GPX on the
1117
+ // History trip Export button, a checkbox multi-select
1118
+ // opens with all three pre-checked; un-check any to
1119
+ // omit. The bare position+time shape stays
1120
+ // byte-identical for a None-options call so a previous
1121
+ // consumer reads new exports unchanged. New
1122
+ // IConfirmationService.MultiChooseAsync surfaces the
1123
+ // checkbox modal generically so future multi-pick
1124
+ // flows reuse the same dialog. 18 new tests pin the
1125
+ // GPX shape + the multi-choose state machine.
1126
+ // v107 -> v108: Notification ack: HTTP 400 with "Alarm already
1127
+ // acknowledged!" / "Alarm cannot be acknowledged!"
1128
+ // is now logged at Info level (Console.WriteLine,
1129
+ // not Console.Error) so errorRelayBoot doesn't pipe
1130
+ // a benign multi-plotter ack race to the SK server
1131
+ // error log. Helm-reported regression: "I get an
1132
+ // error when I ack the anchor alarm". The local
1133
+ // dismiss already took effect; the server insists
1134
+ // the alarm was already acked (by this plotter on a
1135
+ // double-tap or by another plotter on the same boat).
1136
+ // Also: ResourceHttp.ReadErrorAsync now extracts the
1137
+ // SK v2 standard error envelope's `message` field, so
1138
+ // non-benign 400s surface the server's actual reason
1139
+ // instead of a bare "HTTP 400".
1140
+ // v108 -> v109: Maintainability review round - nits batch. Doc-only
1141
+ // + one-line code grooming. AlarmManager gains a class
1142
+ // summary; AlarmInfo / AppSettingsService / SkAdminLoginUrl
1143
+ // doc blocks lose PR-numbered changelog narrative;
1144
+ // eight Services/Api/*Api.cs classes gain a one-line
1145
+ // <summary> per the codebase convention; AisPushService
1146
+ // LogSkippedFiniteCheck rationale rewritten so the
1147
+ // "shared across vessels" phrasing matches the per-
1148
+ // instance field shape; Map.razor.cs WPT / Note /
1149
+ // Region default-name stamps now route through the
1150
+ // injected TimeProvider so the helm's local clock + a
1151
+ // test-time fake clock are honoured.
1152
+ // v109 -> v110: Route-edit waypoint list now collapsible. The list
1153
+ // anchored top-right used to crowd the HUD-tr stack
1154
+ // when it grew big - helm-reported as "route points
1155
+ // behind the HUDs". Tap the header chip to collapse
1156
+ // to a small count chip (HUDs underneath fully
1157
+ // visible); tap again to re-expand. The expanded
1158
+ // panel z-index also bumps above the expanded-HUD
1159
+ // tier so a helm tapping a HUD card mid-edit doesn't
1160
+ // see the route list disappear behind it. New
1161
+ // window.scrollElementToBottom global helper auto-
1162
+ // scrolls the list to the latest waypoint each time
1163
+ // the parent appends one, so a long route is not
1164
+ // stuck displaying the first few entries while the
1165
+ // helm adds at the bottom.
1166
+ // v110 -> v111: Maintainability review round - minors batch. C#
1167
+ // source-side history-flavoured comments groomed
1168
+ // across aisLayer.js + CpaAlarmRule + SignalkClient
1169
+ // (the "Was X / now Y" / "PR #134" pattern); replaced
1170
+ // with present-tense justification. Tests across
1171
+ // AlarmManager + AlarmManagerStress + AnchorTideAlarmRule
1172
+ // + AlarmManagerSnoozes now use a fixed deterministic
1173
+ // clock seed (new TestClock.FixedUtcNow) instead of
1174
+ // DateTime.UtcNow so the suite stays Repeatable across
1175
+ // DST / leap-second flips. service-worker.js is the
1176
+ // intentional changelog of the SW itself and was left
1177
+ // untouched.
1178
+ // v111 -> v112: Measurement-tool segment tooltips now follow the
1179
+ // dark / light / high-contrast theme. Helm-reported
1180
+ // that the previous amber-bordered + amber-text pill
1181
+ // ignored the active theme and read as an out-of-
1182
+ // place sandy blob. Dropped the amber accent (the
1183
+ // ruler polyline itself is slate-200, not amber, so
1184
+ // the tooltip border never matched it); switched to
1185
+ // the same neutral surface + var(--sk-text) pattern
1186
+ // the rest of the in-app dialogs use, with
1187
+ // :root.theme-effective-light and high-contrast
1188
+ // overrides for the lighter themes.
1189
+ // v112 -> v113: Layers panel adjustments.
1190
+ // - Charts section grows a "Show all" checkbox that
1191
+ // bypasses the viewport bbox filter so the helm can
1192
+ // find a distant chart without panning first.
1193
+ // Ephemeral (not persisted) - the viewport is the
1194
+ // natural relevance cue.
1195
+ // - Marine services loses its master "Show" header
1196
+ // toggle. The overlay is now implicitly visible
1197
+ // whenever at least one category is ticked; untick
1198
+ // everything to hide. IMarinePoiSettings drops
1199
+ // MarinePoiOverlayVisible + setter; the persisted
1200
+ // "marinePoi.overlayVisible.v1" key is no longer
1201
+ // read (stale entries linger in storage but have
1202
+ // no effect).
1203
+ // v113 -> v114: Night-mode + HUD rework.
1204
+ // - Night mode red-shifts the active-WP pulse halo +
1205
+ // tooltip via a new --map-bearing-rgb override,
1206
+ // red-shifts speed-coloured track polylines via a
1207
+ // .speed-track-line filter, nightifies the radar
1208
+ // Transmit border + status chips, the unloaded-tile
1209
+ // backdrop, the Resources tabs, and the route-edit
1210
+ // bar / hint / list.
1211
+ // - MainLayout's settings handler calls a new
1212
+ // refreshPalette() JS export so the active route's
1213
+ // polyline + course-line bearing dash pick up the
1214
+ // fresh --map-* tokens on a theme / night-mode
1215
+ // flip rather than waiting for the next SK course
1216
+ // delta.
1217
+ // - Follow-mode flips Leaflet's scrollWheelZoom /
1218
+ // touchZoom / doubleClickZoom to 'center' so the
1219
+ // wheel + pinch zoom around the boat instead of the
1220
+ // cursor (no more post-zoom jump-back from the next
1221
+ // position fix).
1222
+ // - Cross-track error swatch removed from the legend
1223
+ // (chart tick was already dropped).
1224
+ // - SOG HUD details: STW row added; VMG / Drift /
1225
+ // XTE removed (VMG -> Route detail; Drift duplicates
1226
+ // HDG card; XTE moved to HDG details where the
1227
+ // heading reference lives).
1228
+ // - HDG HUD details: shows the alternate heading
1229
+ // reference (true when primary is magnetic and
1230
+ // vice versa), the moved XTE row, and the AP
1231
+ // target row gains a magnetic variant (sourced
1232
+ // from steering.autopilot.target.headingMagnetic).
1233
+ // Row order reads top-down: alternate HDG -> Drift
1234
+ // -> XTE -> AP block (state, targets T+M, error,
1235
+ // rudder).
1236
+ // - NavigationData adds SpeedThroughWater (from
1237
+ // navigation.speedThroughWater) and
1238
+ // AutopilotTargetHeadingMagnetic; SignalkClient's
1239
+ // fast tier subscribes both.
1240
+ // v114 -> v115: networkFirstWithCacheFallback gains a 2.5 s timeout
1241
+ // so a slow upstream (Pi-class SK Node host serving a
1242
+ // flurry of /js/* + /css/* fetches after a CACHE_NAME
1243
+ // bump) falls back to the cached copy instead of
1244
+ // blocking the WASM bootstrap. Pairs with the publish-
1245
+ // time stamp-cache-name.mjs becoming content-based:
1246
+ // together they ensure (a) CACHE_NAME only bumps when
1247
+ // app-shell contents actually change, and (b) even
1248
+ // when it does bump, a slow refill never freezes the
1249
+ // page. Helm-visible bug fixed: after deploys, reload
1250
+ // would freeze for tens of seconds until enough
1251
+ // modules trickled in.
1252
+ // v115 -> v116: routing resolves against the registration scope, so
1253
+ // /js/ + /css/ stay network-first under the
1254
+ // /signalk-onaplotter/ subpath; fingerprinted _framework
1255
+ // files are served from cache without a background
1256
+ // re-fetch; History page map moves to historyMapLayer.js.
1257
+ // v116 -> v117: AlarmRuleEnableToggle; versioned delta AIS push, MapHud
1258
+ // RefreshAsync, MapControls ShouldRender, shortcut table,
1259
+ // initMap options (rangeScale.js + trackRuns.js added).
1260
+ // v117 -> v118: CSS pass (purged bootstrap, Inter subset, keyframes) with
1261
+ // both precached for an offline first boot; navigations
1262
+ // network-first with index fallback; /signalk/* no longer
1263
+ // intercepted; course-up rotation (mapRotation.js), in-icon
1264
+ // AIS labels, boatIcons / keyboardShortcuts / ownBoatPopup
1265
+ // modules; MapHud depth glyph; night track palette.
1266
+ // v118 -> v119: Map .map-viewport wrapper (oversized course-up container,
1267
+ // upright controls); HudRouteCard / Dashboard TimeProvider;
1268
+ // SearchBox expanded-state parameter; seamark overlay pane.
1269
+ // v119 -> v120: app startup runs as hosted services (WASM assembly shape
1270
+ // change); UpdateChecker starts its timer from StartAsync.
1271
+ // v120 -> v121: stale-data check, login-status poll and snooze rehydration
1272
+ // move from MainLayout into hosted services.
1273
+ // v121 -> v122: dead-code removal (unused components, zoom badge, tile-error
1274
+ // counter, route-edit undo, duplicate download helper).
1275
+ // v122 -> v123: JS module reshuffle (dragGhost.js, wireClick, routeLayer.js;
1276
+ // leafletInterop.js re-exports the layer entry points).
1277
+ const CACHE_NAME = 'ona-plotter-69d40ba487ef';
1278
+ const TILE_CACHE_NAME = 'ona-plotter-tiles-v1';
1279
+ // Cap on the tile cache. Approx 5000 tiles * ~40 kB = 200 MB which
1280
+ // is comfortable on iPad / desktop and fits one or two full route-
1281
+ // planning sessions. Eviction is FIFO by insertion order
1282
+ // (trimTileCache below deletes from the front of cache.keys()); no LRU
1283
+ // promotion on hits, because re-putting a hit causes body-stream
1284
+ // contention between the served response and the background re-put
1285
+ // ("no single tile loads"). With a 5000 entry
1286
+ // cap, FIFO is plenty for typical coastal / rivers use - the home
1287
+ // anchorage tiles fall out only after several sessions of heavy
1288
+ // route-planning elsewhere. Bump this number rather than switching
1289
+ // to a separate offline-tiles feature.
1290
+ const TILE_CACHE_MAX_ENTRIES = 5000;
1291
+ // Use relative URLs so the worker works both at root and under a subpath
1292
+ // (SignalK webapp serves at /signalk-onaplotter/).
1293
+ const SCOPE = self.registration ? self.registration.scope : self.location.href;
1294
+ // Path the app is served under: "/" standalone, "/signalk-onaplotter/"
1295
+ // as a SignalK webapp. Route checks below are relative to it.
1296
+ const SCOPE_PATH = new URL(SCOPE).pathname;
1297
+ const APP_SHELL = [
1298
+ SCOPE,
1299
+ new URL('css/app.css', SCOPE).toString(),
1300
+ // Render-blocking stylesheet and the HUD font: without them an
1301
+ // offline first boot after install lays out unstyled.
1302
+ new URL('css/bootstrap/bootstrap.min.css', SCOPE).toString(),
1303
+ new URL('fonts/InterVariable.woff2', SCOPE).toString(),
1304
+ new URL('favicon.svg', SCOPE).toString(),
1305
+ new URL('manifest.json', SCOPE).toString(),
1306
+ // errorRelayBoot.js is loaded synchronously from index.html before
1307
+ // the Blazor runtime so the relay listeners are armed in time to
1308
+ // catch boot-time exceptions. Precaching it here means a stale
1309
+ // copy is invalidated cleanly when CACHE_NAME bumps; without it
1310
+ // the catch-all opportunistic cache could pin an old broken copy.
1311
+ new URL('js/errorRelayBoot.js', SCOPE).toString(),
1312
+ // PNG icons for the iPad / iOS home-screen install path. The SVG
1313
+ // is still listed as a manifest icon (Android handles SVG fine)
1314
+ // but Safari needs the rasterised versions for apple-touch-icon
1315
+ // and PWA splash; precache so the install flow works offline.
1316
+ new URL('apple-touch-icon-180.png', SCOPE).toString(),
1317
+ new URL('icon-192.png', SCOPE).toString(),
1318
+ new URL('icon-512.png', SCOPE).toString(),
1319
+ // Vendored Leaflet 1.9.4 (a synchronous unpkg.com load in
1320
+ // index.html would block WASM start on slow links AND break
1321
+ // PWA offline mode). Precaching the JS + CSS + per-CSS image
1322
+ // refs means cold-start fetches one fewer cross-origin asset and
1323
+ // the helm can boot the chartplotter offline once the bundle's
1324
+ // installed. Bump CACHE_NAME to invalidate stale copies on
1325
+ // future Leaflet upgrades.
1326
+ new URL('lib/leaflet/dist/leaflet.js', SCOPE).toString(),
1327
+ new URL('lib/leaflet/dist/leaflet.css', SCOPE).toString(),
1328
+ new URL('lib/leaflet/dist/images/layers.png', SCOPE).toString(),
1329
+ new URL('lib/leaflet/dist/images/layers-2x.png', SCOPE).toString(),
1330
+ new URL('lib/leaflet/dist/images/marker-icon.png', SCOPE).toString(),
1331
+ new URL('lib/leaflet/dist/images/marker-icon-2x.png', SCOPE).toString(),
1332
+ new URL('lib/leaflet/dist/images/marker-shadow.png', SCOPE).toString()
1333
+ ];
1334
+
1335
+ self.addEventListener('install', (event) => {
1336
+ event.waitUntil(
1337
+ caches.open(CACHE_NAME).then((cache) => cache.addAll(APP_SHELL))
1338
+ );
1339
+ self.skipWaiting();
1340
+ });
1341
+
1342
+ self.addEventListener('activate', (event) => {
1343
+ event.waitUntil(
1344
+ caches.keys().then((keys) =>
1345
+ Promise.all(keys
1346
+ .filter((k) => k !== CACHE_NAME && k !== TILE_CACHE_NAME)
1347
+ .map((k) => caches.delete(k)))
1348
+ )
1349
+ );
1350
+ self.clients.claim();
1351
+ });
1352
+
1353
+ // Cache-first for tile URLs. Wraps the inner cache-then-fetch logic
1354
+ // in a top-level try/catch that always returns *some* Response, so
1355
+ // the respondWith() promise never rejects. A bare rejection is what
1356
+ // Firefox surfaces as "ServiceWorker intercepted the request and
1357
+ // encountered an unexpected error" and renders as a broken tile in
1358
+ // Leaflet - the cause is hard to pin (Cache-API quota, transient
1359
+ // IndexedDB corruption, body-clone on a partial 206, ...) but the
1360
+ // effect is uniform and so is the mitigation: any exception path,
1361
+ // however unlikely, falls back to a 504 placeholder.
1362
+ async function tileCacheFirst(request) {
1363
+ try {
1364
+ return await tileCacheFirstInner(request);
1365
+ } catch (_) {
1366
+ // Last-resort fallback: a 504 placeholder so Leaflet can
1367
+ // render its errorTileUrl rather than the helm seeing the
1368
+ // generic Firefox SW-intercept error in the console plus a
1369
+ // missing tile. This branch should be unreachable - the
1370
+ // inner function has its own per-step guards - but the
1371
+ // outer net is what guarantees respondWith() never rejects.
1372
+ return new Response('', { status: 504, statusText: 'Tile error' });
1373
+ }
1374
+ }
1375
+
1376
+ // Module-scoped cache reference. caches.open() is fast on a hot disk
1377
+ // but each call still spins up a transaction; on a Pi-class device
1378
+ // the per-request open shows up in flame-graphs for tile-heavy
1379
+ // workloads. Cache the resolved Cache object after first open and
1380
+ // reuse for subsequent requests. The Cache object stays valid across
1381
+ // the SW's lifetime; if it's ever invalidated (extremely unusual),
1382
+ // the caller's try/catch falls through to the network path.
1383
+ let tileCacheRef = null;
1384
+ async function getTileCache() {
1385
+ if (tileCacheRef) return tileCacheRef;
1386
+ tileCacheRef = await caches.open(TILE_CACHE_NAME);
1387
+ return tileCacheRef;
1388
+ }
1389
+
1390
+ // Entry count of the tile cache, tracked in memory so a put doesn't
1391
+ // need a cache.keys() walk (up to 5000 Request objects) to know whether
1392
+ // the cap is reached. null until the first put seeds it with one walk;
1393
+ // after that the cache is only enumerated when the count passes the
1394
+ // cap. A trim evicts down to TILE_CACHE_MAX_ENTRIES - TILE_TRIM_BATCH so
1395
+ // the next few hundred puts don't each trigger another walk. Puts that
1396
+ // replace an existing entry over-count slightly; the next walk resets
1397
+ // the count to the real size.
1398
+ const TILE_TRIM_BATCH = 250;
1399
+ let tileCount = null;
1400
+ let trimInFlight = false;
1401
+
1402
+ async function tileCacheFirstInner(request) {
1403
+ let cache = null;
1404
+ try {
1405
+ cache = await getTileCache();
1406
+ const cached = await cache.match(request);
1407
+ if (cached) {
1408
+ // Just serve the cached response. No LRU promotion via
1409
+ // cache.put(request, cached.clone()): in some browser
1410
+ // builds (Firefox in particular) the clone's body stream
1411
+ // and the served response share underlying state in a way
1412
+ // that the background put can lock, breaking every
1413
+ // subsequent tile read ("no single tile loads"). Pure-FIFO
1414
+ // eviction without promotion is good enough - with a
1415
+ // 5000-tile cap a home anchorage stays in the cache for
1416
+ // several sessions of normal use, and the alternative
1417
+ // (every-tile failure) is not a trade we'd accept.
1418
+ return cached;
1419
+ }
1420
+ } catch (_) {
1421
+ // Cache layer unavailable; degrade to a pure-network path
1422
+ // below. cache stays null, the put attempt is skipped.
1423
+ }
1424
+
1425
+ let response;
1426
+ try {
1427
+ response = await fetch(request);
1428
+ } catch (_) {
1429
+ // Offline + no cache entry. Return a harmless 504 so Leaflet
1430
+ // shows its errorTileUrl placeholder rather than hanging.
1431
+ return new Response('', { status: 504, statusText: 'Offline' });
1432
+ }
1433
+
1434
+ // Best-effort cache write. cache.put rejects on partial-content
1435
+ // (206), no-store headers, quota exceeded, and a few other Response
1436
+ // shapes that the spec disallows. None of those should affect the
1437
+ // caller - swallow the rejection and just return the response.
1438
+ if (cache && response.ok) {
1439
+ try {
1440
+ const clone = response.clone();
1441
+ // Defensive: cache.put can throw synchronously on some
1442
+ // browser versions (Firefox under low-memory, Safari with
1443
+ // partial-storage quotas). The .catch chains the async
1444
+ // rejection; the try/catch traps the sync throw so the
1445
+ // outer respondWith path stays clean.
1446
+ try {
1447
+ cache.put(request, clone)
1448
+ .then(() => maybeTrimTileCache(cache))
1449
+ .catch(() => { /* put rejected; tile not cached, fine */ });
1450
+ } catch (_) { /* sync throw from cache.put */ }
1451
+ } catch (_) { /* clone() threw on a weird response body */ }
1452
+ }
1453
+ return response;
1454
+ }
1455
+
1456
+ // Single-flight trim after a put (see tileCount).
1457
+ async function maybeTrimTileCache(cache) {
1458
+ if (tileCount !== null) {
1459
+ tileCount++;
1460
+ if (tileCount <= TILE_CACHE_MAX_ENTRIES) return;
1461
+ }
1462
+ if (trimInFlight) return;
1463
+ trimInFlight = true;
1464
+ try {
1465
+ const keys = await cache.keys();
1466
+ let count = keys.length;
1467
+ if (count > TILE_CACHE_MAX_ENTRIES) {
1468
+ // Delete oldest in parallel (FIFO: Cache.keys() returns
1469
+ // insertion order per the spec). Promise.all rather than
1470
+ // sequential awaits: ~10x faster on a Pi-class device.
1471
+ const excess = count - (TILE_CACHE_MAX_ENTRIES - TILE_TRIM_BATCH);
1472
+ await Promise.all(keys.slice(0, excess).map((k) => cache.delete(k)));
1473
+ count -= excess;
1474
+ }
1475
+ tileCount = count;
1476
+ } catch (_) {
1477
+ // Trim is best-effort; the cap may be exceeded until the next
1478
+ // put triggers another attempt.
1479
+ } finally {
1480
+ trimInFlight = false;
1481
+ }
1482
+ }
1483
+
1484
+ // Fingerprinted Blazor asset name: "<name>.<10-char base36 hash>.<ext>",
1485
+ // e.g. "dotnet.native.l9w6gmu0b1.wasm" or "System.Runtime.x7k2p0q9ab.wasm".
1486
+ // Unfingerprinted loaders ("blazor.webassembly.js") do not match.
1487
+ const FINGERPRINTED_ASSET = /\.[a-z0-9]{10}\.[a-z]+$/;
1488
+ // Release interop bundle (scripts/bundle-interop.mjs), named by its
1489
+ // content hash: "js/leafletInterop.5QWJ3KXR.js". Debug never has one.
1490
+ const JS_BUNDLE = /^js\/[\w-]+\.[A-Z0-9]{8}\.js$/;
1491
+
1492
+ /**
1493
+ * Which strategy serves a same-origin GET for pathname.
1494
+ * 'tiles' chart tiles, cache-first in the tile cache
1495
+ * 'signalk' SignalK API, not intercepted
1496
+ * 'navigate' a page load anywhere under the scope (client routes
1497
+ * such as /map included): network-first, offline
1498
+ * falls back to the cached index document
1499
+ * 'network-first' js/, css/, the document root, *.html
1500
+ * 'immutable' fingerprinted _framework files and the hashed js/
1501
+ * interop bundle, cache-only once cached
1502
+ * 'app-shell' everything else, cache-first with background refresh
1503
+ * scopePath is the registration scope's path ("/" or "/signalk-onaplotter/");
1504
+ * mode is the request mode ('navigate' for a document load).
1505
+ * The SignalK paths are absolute because the SignalK server owns them
1506
+ * regardless of where the webapp is mounted.
1507
+ */
1508
+ function routeFor(pathname, scopePath, mode) {
1509
+ if (pathname.startsWith('/signalk/chart-tiles/')) return 'tiles';
1510
+ if (pathname === '/signalk' || pathname.startsWith('/signalk/')) return 'signalk';
1511
+ const inScope = pathname.startsWith(scopePath);
1512
+ const rel = inScope ? pathname.slice(scopePath.length) : null;
1513
+ if (mode === 'navigate' && inScope) return 'navigate';
1514
+ if (rel !== null && JS_BUNDLE.test(rel)) return 'immutable';
1515
+ if (rel === ''
1516
+ || pathname === '/'
1517
+ || (rel !== null && (rel.startsWith('js/') || rel.startsWith('css/')))
1518
+ || pathname.endsWith('.html')) {
1519
+ return 'network-first';
1520
+ }
1521
+ if (rel !== null && rel.startsWith('_framework/') && FINGERPRINTED_ASSET.test(rel)) {
1522
+ return 'immutable';
1523
+ }
1524
+ return 'app-shell';
1525
+ }
1526
+
1527
+ self.addEventListener('fetch', (event) => {
1528
+ const url = new URL(event.request.url);
1529
+
1530
+ // Only handle GET requests for same-origin resources.
1531
+ // Cross-origin (OSM tiles, OpenSeaMap, unpkg.com, MarineTraffic links) must pass
1532
+ // through untouched: the browser sends proper Referer headers that some servers
1533
+ // (like OSM) require per their usage policy. Intercepting them breaks those requests.
1534
+ if (event.request.method !== 'GET' || url.origin !== self.location.origin) {
1535
+ return;
1536
+ }
1537
+
1538
+ switch (routeFor(url.pathname, SCOPE_PATH, event.request.mode)) {
1539
+ // Chart tiles served by signalk-charts-plugin. Cache-on-view so a
1540
+ // re-visit to a cove the user sailed through earlier works offline.
1541
+ // Separate cache from the app shell so it can be evicted
1542
+ // independently and capped by entry count. Cache-first: tiles
1543
+ // never invalidate on their own (charts don't change), so a
1544
+ // single freshness pass at install / cache-bump is enough. The
1545
+ // FIFO cap rolls in newer tiles to displace stale ones over time.
1546
+ case 'tiles':
1547
+ event.respondWith(tileCacheFirst(event.request));
1548
+ return;
1549
+ // Other SignalK API calls go straight to the network: nothing is
1550
+ // cached, and an intercept would only add a hop per request (the
1551
+ // HUD polls several endpoints) and turn a network error into a
1552
+ // synthetic 504.
1553
+ case 'signalk':
1554
+ return;
1555
+ // Document loads, including deep links to client routes. The
1556
+ // server answers every route under the scope with index.html;
1557
+ // that answer is cached under the scope root, which is also the
1558
+ // offline fallback for any route.
1559
+ case 'navigate':
1560
+ event.respondWith(navigationNetworkFirst(event.request));
1561
+ return;
1562
+ // Network-first for "evolves with C# bundle" assets (JS modules,
1563
+ // CSS, the SPA document root). C# code that calls a JS export
1564
+ // ships in a content-hashed wasm filename, so the new wasm is
1565
+ // always fetched fresh - but the JS module URLs are stable
1566
+ // (`./js/leafletInterop.js`, no hash), so a cache-first SW would
1567
+ // happily serve yesterday's leafletInterop.js (no new export) to
1568
+ // today's wasm (which calls it) and crash on the
1569
+ // not-a-function lookup. Network-first fixes that without losing
1570
+ // offline launch (cache is the fallback when fetch rejects).
1571
+ case 'network-first':
1572
+ event.respondWith(networkFirstWithCacheFallback(event.request));
1573
+ return;
1574
+ // A fingerprinted file's bytes never change under its name, so a
1575
+ // cached copy is final: no background re-fetch of the multi-MB
1576
+ // runtime on every launch.
1577
+ case 'immutable':
1578
+ event.respondWith(immutableCacheFirst(event.request));
1579
+ return;
1580
+ // Cache-first for app shell (icons, fonts, version stamps), network
1581
+ // fallback otherwise. Wrapped for the same reason as above:
1582
+ // caches.match / caches.open / put can all reject; the outer try
1583
+ // guarantees respondWith resolves to a Response.
1584
+ default:
1585
+ event.respondWith(appShellCacheFirst(event.request));
1586
+ }
1587
+ });
1588
+
1589
+ /** Network-first with cache fallback. Always tries network first so
1590
+ * a fresh deploy lands in the helm's browser on the next page load
1591
+ * rather than the load-after-that. The browser-level HTTP cache +
1592
+ * Kestrel's ETag/no-cache headers keep the wire cost down (304 with
1593
+ * no body when unchanged). On network failure (offline / refused /
1594
+ * slow), serves the previously-cached copy so the app still
1595
+ * launches. Caches every successful 2xx response so the offline
1596
+ * fallback has something to fall back to.
1597
+ *
1598
+ * Ceiling on the network race: NETWORK_FIRST_TIMEOUT_MS. An
1599
+ * unbounded `await fetch(request)` could block the WASM bootstrap
1600
+ * waiting on a slow upstream - the SignalK Node server on a Pi-class device can stall serving a flurry of /js/*
1601
+ * + /css/* modules immediately after a CACHE_NAME bump emptied the
1602
+ * app-shell cache and forced every module through this handler.
1603
+ * Helm-visible as "the page reloads and then freezes for tens of
1604
+ * seconds" until enough fetches complete for Blazor to mount.
1605
+ * With the timeout, a slow upstream lands the helm on the
1606
+ * previously-cached copy in 2.5 s, the page boots, and a fresh
1607
+ * fetch backfills the cache on the next reload. The window is
1608
+ * long enough that a healthy local LAN/loopback always wins the
1609
+ * race (a same-LAN Kestrel responds in milliseconds; the timeout
1610
+ * only ever triggers when something is genuinely slow). */
1611
+ const NETWORK_FIRST_TIMEOUT_MS = 2500;
1612
+
1613
+ async function networkFirstWithCacheFallback(request) {
1614
+ const controller = new AbortController();
1615
+ const timeoutId = setTimeout(() => controller.abort(), NETWORK_FIRST_TIMEOUT_MS);
1616
+ try {
1617
+ const response = await fetch(request, { signal: controller.signal });
1618
+ clearTimeout(timeoutId);
1619
+ if (response.ok) {
1620
+ try {
1621
+ const clone = response.clone();
1622
+ const cache = await caches.open(CACHE_NAME);
1623
+ cache.put(request, clone).catch(() => { /* best-effort */ });
1624
+ } catch (_) { /* clone / open / put threw */ }
1625
+ }
1626
+ return response;
1627
+ } catch (_) {
1628
+ clearTimeout(timeoutId);
1629
+ // Offline / refused / aborted (incl. our own timeout above).
1630
+ // Fall back to whatever the cache has from a previous online
1631
+ // visit. No background-refresh kicker here: a slow upstream
1632
+ // would likely also time out the kicker; the NEXT page load
1633
+ // races fresh against another 2.5 s window and naturally
1634
+ // catches up when the host is responsive again.
1635
+ try {
1636
+ const cached = await caches.match(request);
1637
+ if (cached) return cached;
1638
+ } catch (_) { /* cache layer unavailable */ }
1639
+ return new Response('', { status: 504, statusText: 'Offline' });
1640
+ }
1641
+ }
1642
+
1643
+ /** Network-first for a document load under the scope, with the same
1644
+ * timeout as networkFirstWithCacheFallback. A deep link such as
1645
+ * /signalk-onaplotter/map has no cache entry of its own; the fresh
1646
+ * index document is stored under the scope root (the precached app
1647
+ * shell entry) and served for any route when the network fails, so
1648
+ * an offline reload on a client route still boots and a deploy
1649
+ * replaces the cached index on the next online load. */
1650
+ async function navigationNetworkFirst(request) {
1651
+ const controller = new AbortController();
1652
+ const timeoutId = setTimeout(() => controller.abort(), NETWORK_FIRST_TIMEOUT_MS);
1653
+ try {
1654
+ const response = await fetch(request, { signal: controller.signal });
1655
+ clearTimeout(timeoutId);
1656
+ // Only the index document stands in for the scope root, not a
1657
+ // file opened directly in a tab (manifest.json, an icon).
1658
+ const isHtml = (response.headers.get('content-type') || '').includes('text/html');
1659
+ if (response.ok && isHtml) {
1660
+ try {
1661
+ const clone = response.clone();
1662
+ const cache = await caches.open(CACHE_NAME);
1663
+ cache.put(SCOPE, clone).catch(() => { /* best-effort */ });
1664
+ } catch (_) { /* clone / open / put threw */ }
1665
+ }
1666
+ return response;
1667
+ } catch (_) {
1668
+ clearTimeout(timeoutId);
1669
+ try {
1670
+ const cached = await caches.match(SCOPE);
1671
+ if (cached) return cached;
1672
+ } catch (_) { /* cache layer unavailable */ }
1673
+ return new Response('', { status: 504, statusText: 'Offline' });
1674
+ }
1675
+ }
1676
+
1677
+ /** Cache-only once cached, for fingerprinted files whose content is
1678
+ * fixed by their name. A miss fetches, stores and returns the network
1679
+ * response; failures resolve to a 504 so respondWith never rejects. */
1680
+ async function immutableCacheFirst(request) {
1681
+ try {
1682
+ const cached = await caches.match(request);
1683
+ if (cached) return cached;
1684
+ } catch (_) { /* cache layer unavailable */ }
1685
+ try {
1686
+ const response = await fetch(request);
1687
+ if (response.ok) {
1688
+ try {
1689
+ const clone = response.clone();
1690
+ const cache = await caches.open(CACHE_NAME);
1691
+ cache.put(request, clone).catch(() => { /* best-effort */ });
1692
+ } catch (_) { /* clone / open / put threw */ }
1693
+ }
1694
+ return response;
1695
+ } catch (_) {
1696
+ return new Response('', { status: 504, statusText: 'Offline' });
1697
+ }
1698
+ }
1699
+
1700
+ /** Cache-first with stale-while-revalidate for the app shell.
1701
+ * Returns the cached Response if present, then refreshes the cache
1702
+ * in the background; on cache miss, awaits the network. Any
1703
+ * exception in the cache layer falls through to a pure-network
1704
+ * attempt; any exception in the network falls through to whatever
1705
+ * cached entry we had (or a 504 placeholder). respondWith never
1706
+ * rejects. */
1707
+ async function appShellCacheFirst(request) {
1708
+ let cached;
1709
+ try {
1710
+ cached = await caches.match(request);
1711
+ } catch (_) { /* cache layer unavailable */ }
1712
+
1713
+ // Background refresh on hit, awaited fetch on miss.
1714
+ const fetchPromise = (async () => {
1715
+ try {
1716
+ const response = await fetch(request);
1717
+ if (response.ok) {
1718
+ try {
1719
+ const clone = response.clone();
1720
+ const cache = await caches.open(CACHE_NAME);
1721
+ cache.put(request, clone).catch(() => { /* best-effort */ });
1722
+ } catch (_) { /* clone / open / put threw */ }
1723
+ }
1724
+ return response;
1725
+ } catch (_) {
1726
+ // Network failed; return cached if we have it, else 504.
1727
+ return cached ?? new Response('', { status: 504, statusText: 'Offline' });
1728
+ }
1729
+ })();
1730
+
1731
+ // Cache hit: serve cached + let the refresh run in the background.
1732
+ if (cached) {
1733
+ // Don't await fetchPromise - let it update the cache silently.
1734
+ // .catch keeps an unhandled rejection out of the SW's error
1735
+ // bus.
1736
+ fetchPromise.catch(() => { /* best-effort */ });
1737
+ return cached;
1738
+ }
1739
+ // Cache miss: await network (or its 504 fallback above).
1740
+ return fetchPromise;
1741
+ }