signalk-binnacle 0.6.2 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,132 @@ All notable changes to Binnacle are documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project aims to follow
5
5
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ <a id="unreleased"></a>
8
+
9
+ ## [Unreleased]
10
+
11
+ <a id="v071"></a>
12
+
13
+ ## [0.7.1] - 2026-06-17
14
+
15
+ ### Fixed
16
+
17
+ - The App Store listing no longer shows broken image placeholders in its README view. The README
18
+ carried a screenshots section whose image paths were not part of the published package, so they
19
+ could not load there. The screenshots shown in the App Store carousel were always present and are
20
+ unaffected.
21
+
22
+ <a id="v070"></a>
23
+
24
+ ## [0.7.0] - 2026-06-17
25
+
26
+ ### Added
27
+
28
+ - AI route drafting. Describe a passage in plain language, for example "from here to Avalon, stay 3 nm
29
+ off the coast", and signalk-crows-nest drafts a route you review and save. The draft opens as an
30
+ editable working route with a not-chart-verified banner, the read-as destination, the model's note,
31
+ a fuel estimate in your units, any land, shallow, hazard, or fuel flags above the leg table, and a
32
+ note when the model marks the draft low confidence.
33
+ Charted point hazards are grouped per leg, so a hazard-dense river or harbor passage reads as one
34
+ count plus a short breakdown rather than dozens of lines. Each leg is checked against charted and
35
+ modeled marine data that varies by region, and every flag states its source and datum; the absence
36
+ of a flag is not proof of clear water. It cannot be minimized while a draft is up, and it saves only
37
+ behind an armed "I checked every leg" confirm. The control appears only when signalk-crows-nest is
38
+ installed at a version that ships the route-draft endpoint; on a stock server it stays hidden, with
39
+ no error.
40
+ - Optimize a drawn route. While editing a route, tap Optimize and signalk-crows-nest returns an
41
+ improved route, with safer and more detailed turning points and a more efficient track, opened in
42
+ the same review-before-save draft panel with its per-leg flags. It is one tap, with an optional
43
+ one-line constraint such as "stay 3 nm off", and it is non-destructive: Cancel restores your
44
+ drawing, an unchanged result says so, and hand-editing the result accepts it as a normal route you
45
+ can save or optimize again. Like drafting, it appears only when signalk-crows-nest is installed at a
46
+ version that ships the route-draft endpoint.
47
+ - AIS course vectors. Each moving AIS target draws a short predictor line projecting its position
48
+ about ten minutes ahead along its course at its speed, red for a danger contact and amber for a
49
+ warning, so a crowded screen shows at a glance which targets are moving and which way. A
50
+ stationary target shows no vector. (#3)
51
+ - Start a route from the chart. The right-click and long-press menu adds "Start a route here" under
52
+ "Go to here": it opens the routes panel, begins a new editable route, and drops the first waypoint
53
+ at the spot you picked, so you start a route from the chart in one step and then tap the rest.
54
+ - Route editing shows the route's waypoints as dots, the way a saved route looks, the moment you
55
+ draft, optimize, or edit one, rather than only after you tap the line. Tap a leg in the panel's leg
56
+ list and its segment and both end dots light up on the chart, with the chart easing to the leg when
57
+ it is off-screen; tap a dot on the chart and the legs it joins light up in the list. Drag a dot to
58
+ move it, tap a midpoint to insert one, or delete a waypoint, with the dots visible throughout.
59
+
60
+ ### Changed
61
+
62
+ - The main menu now opens as a dropdown anchored under the menu button in the top corner and grows
63
+ from that corner, instead of appearing as a panel centered on the screen. It is a compact
64
+ three-column grid of labeled tiles grouped by section, dismisses on an outside tap or Escape, and on
65
+ a phone-width screen docks to the bottom edge as a sheet. The main menu and the weather layer menu
66
+ now share one anchored-dropdown primitive, so they open, position, and close the same way.
67
+ - Adding a chart by URL now reads its header and metadata through the same cached, retrying source
68
+ the map tiles use, so re-adding the same chart, and its first render once added, hit the
69
+ IndexedDB block cache instead of refetching over the network.
70
+ - Internal consolidation with no behavior change: the map overlay lifecycle, the rhumb-line
71
+ geometry, the weather and tides display helpers, the GPX coordinate guards, the bounding-box and
72
+ number-format helpers, the symbol registry, the map layer ordering, and the panel, icon-button, and
73
+ numeric-readout styles now route through the existing shared primitives, design tokens, and utility
74
+ classes.
75
+ - Hardening across the data and caching layers: the coordinate and Signal K delta guards reject
76
+ non-finite and malformed values, the tide client drops bad readings and a no-data error response,
77
+ the recorded-track in-memory fallback is bounded, the PMTiles and IndexedDB stores survive a
78
+ concurrent write and another tab's upgrade, and the Escape-dismiss stack and arrow-key focus are
79
+ made robust. The course readout uses a server-supplied ETA for a single-mark destination, and a
80
+ route saved from a draft with no name falls back to a dated name. The layer manager now owns
81
+ invalidating each overlay's change-detection cache on a base-style swap, so a cached overlay does
82
+ not stay blank after a style reload, rather than each overlay carrying that duty itself. The AIS
83
+ list keeps a non-finite range or CPA from scrambling its sort order.
84
+ - Further internal consolidation and small efficiency wins, no behavior change: more overlays and
85
+ panels route through the shared feature-collection, layer-visibility, coordinate, and numeric
86
+ guards and through the shared confirm-actions style and a new warning-tint token, so a caution
87
+ control tints amber rather than red; the all-vessels context and the notification-path prefix have
88
+ one home; and the weather-overlay registration, the route name reconcile, the collision severity
89
+ map, and the AIS duration parse drop per-event allocations. The tidal current set is stored in SI
90
+ radians like every other angle, converted to degrees only in the readout.
91
+ - Further internal consolidation, no behavior change: the resource and notification clients share one
92
+ JSON-request helper; the map layer-ordering rank, the chart overlay's layer-id list, and the
93
+ base-map theme pass are each computed once and reused; the AIS trails client reuses the shared
94
+ bounding-box type; the working-route overlay builds each source its own empty collection; the notes
95
+ overlay registers its marker icons concurrently; and the entity stores publish the remaining
96
+ cross-feature types (collision source, measure leg, track stats, tides status, and anchor default
97
+ radius) through their public index.
98
+
99
+ ### Fixed
100
+
101
+ - The weather mini-map's tap readout no longer writes to a torn-down component if a provider answer
102
+ arrives after the panel is closed.
103
+ - Offline and runtime caching works again in a secure context. The service worker's chart-tile,
104
+ overlay, weather, and radar cache rules referenced module constants that did not survive into the
105
+ generated worker, so the first matched fetch threw "CHART_TILE_PATH is not defined" and broke
106
+ caching wherever the worker is active (HTTPS). The cache matchers are now self-contained.
107
+ - The route panel's Waypoints and Time readouts line up in their columns again. Their rows lacked the
108
+ empty unit cell the three-column stat grid needs, so every value below shifted out of its column.
109
+ The Time readout also splits its value and unit, so a minutes reading lines its "min" up in the
110
+ unit column under the distance's "nm".
111
+ - Charted notes sit on their charted point again, and a console error on every map hover is gone. A
112
+ provided symbol's pixel offset was read from an array feature property, which MapLibre coerces to a
113
+ string; the offset now rides on the layer as a per-icon match.
114
+ - Drawing a route on the chart no longer disappears on the second tap, and the waypoint count
115
+ reflects the points you place rather than the cursor. The chart editor mistook the draw library's
116
+ cursor point, which carries the same tag as the route line, for the route itself, so the second tap
117
+ read zero waypoints and cleared the route; it now selects the route by geometry, drops the trailing
118
+ cursor point from the count and a save, and defers its working-line cleanup so the draw completes. (#1)
119
+ - "Go to here" now draws the course line from the vessel to the destination, and a destination
120
+ marker, on the chart, not just the destination readout in the nav strip. The same line shows the
121
+ current leg of a route under way. (#2)
122
+ - AIS collision alerts no longer cry wolf in a busy marina or at anchor. A moored or swinging boat
123
+ (under one knot) is no longer flagged as a danger to a vessel that is itself anchored or near
124
+ stationary, and the audible alarm is silenced while anchored, with the danger strip still visible
125
+ and a genuinely close, imminent contact still sounding. (#4)
126
+ - A Signal K data worker that fails to load (a bundling or chunk error) now surfaces a connection
127
+ error instead of leaving the app stuck on "connecting" with no signal.
128
+ - Weather precipitation, wave-height, and tide-station overlays redraw after the base map style
129
+ reloads (the offline fallback) instead of staying blank until their underlying data next changes.
130
+ - A route or track that crosses the antimeridian (180 degrees) fits the chart the short way across
131
+ the dateline instead of framing nearly the whole globe.
132
+
7
133
  <a id="v062"></a>
8
134
 
9
135
  ## [0.6.2] - 2026-06-13
package/README.md CHANGED
@@ -15,22 +15,27 @@ A WebGL chart plotter for [Signal K](https://signalk.org).
15
15
  > is also not certified for safety-of-life navigation. Always carry redundant means of navigation,
16
16
  > cross-check against your primary instruments, and treat every display as advisory.
17
17
 
18
- ## What's new in 0.6.2
19
-
20
- A weather layers menu and a deep reliability pass:
21
-
22
- - **A weather layers menu.** The weather panel's layer toggles move from the header, which ran out
23
- of room, into a single menu opened from a floating button at the upper left of the mini-map. The
24
- button lights and shows a count when layers are on, the menu groups the area fill and the
25
- overlays, it stays open while you toggle several layers, and it docks as a bottom sheet on a
26
- narrow screen. There is now room to add more options without crowding.
27
- - **Reliability and correctness.** A full pass across the weather overlays, the caching and history
28
- layers, and the course and anchor logic: pressure isobars no longer blank after a map style swap,
29
- caches stop evicting just-refreshed entries, an active course keeps its route geometry across a
30
- cross-station handoff, and a set of failures that used to fail silently (a dead data link, a
31
- failed track or chart save, a refused anchor drop) now tell you.
32
-
33
- See the [changelog](CHANGELOG.md#v062) for the full list.
18
+ ## What's new in 0.7.0
19
+
20
+ AI route drafting and a routing workflow overhaul:
21
+
22
+ - **AI route drafting and optimize (beta).** Describe a passage in plain language and review a drafted
23
+ route, or tap Optimize on a route you drew, when signalk-crows-nest provides the route-draft
24
+ endpoint. Each draft opens as an editable working route with a not-chart-verified banner, per-leg
25
+ land, shallow, hazard, and fuel flags that state their source and datum, and an armed "I checked
26
+ every leg" save. It is a beta assistant and cannot guarantee accuracy: review every leg against the
27
+ official charts and your instruments before you navigate it. The control stays hidden on a server
28
+ without the endpoint.
29
+ - **Route editing on the chart.** A route shows its waypoints as dots the moment you draft, optimize,
30
+ or edit it. Tap a leg in the panel to light its segment and end dots on the chart, tap a dot to
31
+ light the legs it joins, drag a dot to move it, or tap a midpoint to insert one. The chart menu adds
32
+ "Start a route here" so you begin a route from the spot you picked.
33
+ - **AIS course vectors and reliability.** Moving AIS targets draw a short course predictor, red for a
34
+ danger contact and amber for a warning. Plus a reliability pass: offline and runtime caching works
35
+ again in a secure context, antimeridian-crossing routes frame the short way, and collision alerts no
36
+ longer cry wolf at anchor.
37
+
38
+ See the [changelog](CHANGELOG.md#v070) for the full list.
34
39
 
35
40
  ## What it does
36
41
 
@@ -100,16 +105,6 @@ Binnacle ships its full feature set as a Signal K webapp:
100
105
 
101
106
  See the [changelog](CHANGELOG.md) for the full list.
102
107
 
103
- ## Screenshots
104
-
105
- | The chart with live AIS and the Layers panel | Route planning with a passage plan | An anchorage point-of-interest detail |
106
- | --- | --- | --- |
107
- | [![The chart with AIS targets and seamarks, with the Layers panel open](static/screenshots/01-chart.png)](static/screenshots/01-chart.png) | [![The Routes panel with a drawn route, plan speed, and leg times](static/screenshots/02-routes.png)](static/screenshots/02-routes.png) | [![An anchorage note open in the structured detail panel](static/screenshots/03-anchorage.png)](static/screenshots/03-anchorage.png) |
108
-
109
- | Profiles | The weather mini-map |
110
- | --- | --- |
111
- | [![The Profiles panel with saved setting bundles](static/screenshots/04-profiles.png)](static/screenshots/04-profiles.png) | [![The weather mini-map with precipitation, the time slider, and the conditions panel](static/screenshots/05-weather.png)](static/screenshots/05-weather.png) |
112
-
113
108
  ## Architecture
114
109
 
115
110
  Binnacle is built on a current web stack and engineered to run on modest helm hardware:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-binnacle",
3
- "version": "0.6.2",
3
+ "version": "0.7.1",
4
4
  "description": "WebGL chart plotter for Signal K",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -56,7 +56,7 @@
56
56
  "dependencies": {
57
57
  "@fontsource-variable/inter": "^5.2.8",
58
58
  "@fontsource-variable/jetbrains-mono": "^5.2.8",
59
- "@lucide/svelte": "^1.18.0",
59
+ "@lucide/svelte": "^1.20.0",
60
60
  "comlink": "^4.4.2",
61
61
  "maplibre-gl": "^5.24.0",
62
62
  "pmtiles": "^4.4.1",
@@ -81,17 +81,17 @@
81
81
  "hooks": "git config core.hooksPath .githooks"
82
82
  },
83
83
  "devDependencies": {
84
- "@playwright/test": "^1.60.0",
84
+ "@playwright/test": "^1.61.0",
85
85
  "@sveltejs/vite-plugin-svelte": "^7.1.2",
86
86
  "@tsconfig/svelte": "^5.0.8",
87
- "@vitest/web-worker": "^4.1.8",
87
+ "@vitest/web-worker": "^4.1.9",
88
88
  "dependency-cruiser": "^17.4.3",
89
89
  "svelte": "^5.56.3",
90
90
  "svelte-check": "^4.6.0",
91
91
  "typescript": "^6.0.3",
92
92
  "vite": "^8.0.16",
93
93
  "vite-plugin-pwa": "^1.3.0",
94
- "vitest": "^4.1.8",
94
+ "vitest": "^4.1.9",
95
95
  "workbox-window": "^7.4.1"
96
96
  }
97
97
  }
@@ -1,4 +1,4 @@
1
- import{C as e,D as t,E as n,O as r,S as i,T as a,_ as o,a as s,b as c,c as l,f as u,g as d,h as f,i as p,k as m,m as h,o as g,p as _,r as v,s as y,t as b,v as x,w as S,x as C,y as w}from"./index-DtddKTWH.js";var T=!0,E=`uplot`,ee=`u-hz`,te=`u-vt`,ne=`u-title`,re=`u-wrap`,ie=`u-under`,ae=`u-over`,oe=`u-axis`,se=`u-off`,ce=`u-select`,le=`u-cursor-x`,ue=`u-cursor-y`,de=`u-cursor-pt`,fe=`u-legend`,pe=`u-live`,me=`u-inline`,he=`u-series`,ge=`u-marker`,_e=`u-label`,ve=`u-value`,ye=`width`,be=`height`,xe=`top`,Se=`bottom`,Ce=`left`,we=`right`,Te=`#000`,Ee=`#0000`,De=`mousemove`,Oe=`mousedown`,ke=`mouseup`,Ae=`mouseenter`,je=`mouseleave`,Me=`dblclick`,D=`resize`,Ne=`scroll`,Pe=`change`,Fe=`dppxchange`,Ie=`--`,Le=typeof window<`u`,Re=Le?document:null,ze=Le?window:null,O=Le?navigator:null,k,Be;function Ve(){let e=devicePixelRatio;k!=e&&(k=e,Be&&et(Pe,Be,Ve),Be=matchMedia(`(min-resolution: ${k-.001}dppx) and (max-resolution: ${k+.001}dppx)`),$e(Pe,Be,Ve),ze.dispatchEvent(new CustomEvent(Fe)))}function He(e,t){if(t!=null){let n=e.classList;!n.contains(t)&&n.add(t)}}function Ue(e,t){let n=e.classList;n.contains(t)&&n.remove(t)}function A(e,t,n){e.style[t]=n+`px`}function We(e,t,n,r){let i=Re.createElement(e);return t!=null&&He(i,t),n?.insertBefore(i,r),i}function Ge(e,t){return We(`div`,e,t)}var Ke=new WeakMap;function qe(e,t,n,r,i){let a=`translate(`+t+`px,`+n+`px)`;a!=Ke.get(e)&&(e.style.transform=a,Ke.set(e,a),t<0||n<0||t>r||n>i?He(e,se):Ue(e,se))}var Je=new WeakMap;function Ye(e,t,n){let r=t+n;r!=Je.get(e)&&(Je.set(e,r),e.style.background=t,e.style.borderColor=n)}var Xe=new WeakMap;function Ze(e,t,n,r){let i=t+``+n;i!=Xe.get(e)&&(Xe.set(e,i),e.style.height=n+`px`,e.style.width=t+`px`,e.style.marginLeft=r?-t/2+`px`:0,e.style.marginTop=r?-n/2+`px`:0)}var Qe={passive:!0},j={...Qe,capture:!0};function $e(e,t,n,r){t.addEventListener(e,n,r?j:Qe)}function et(e,t,n,r){t.removeEventListener(e,n,Qe)}Le&&Ve();function tt(e,t,n,r){let i;n||=0,r||=t.length-1;let a=r<=2147483647;for(;r-n>1;)i=a?n+r>>1:vt((n+r)/2),t[i]<e?n=i:r=i;return e-t[n]<=t[r]-e?n:r}function M(e){return(t,n,r)=>{let i=-1,a=-1;for(let a=n;a<=r;a++)if(e(t[a])){i=a;break}for(let i=r;i>=n;i--)if(e(t[i])){a=i;break}return[i,a]}}var nt=e=>e!=null,rt=e=>e!=null&&e>0,N=M(nt),it=M(rt);function at(e,t,n,r=0,i=!1){let a=i?it:N,o=i?rt:nt;[t,n]=a(e,t,n);let s=e[t],c=e[t];if(t>-1)if(r==1)s=e[t],c=e[n];else if(r==-1)s=e[n],c=e[t];else for(let r=t;r<=n;r++){let t=e[r];o(t)&&(t<s?s=t:t>c&&(c=t))}return[s??R,c??-R]}function ot(e,t,n,r){let i=Ct(e),a=Ct(t);e==t&&(i==-1?(e*=n,t/=n):(e/=n,t*=n));let o=n==10?wt:Tt,s=i==1?vt:yt,c=a==1?yt:vt,l=s(o(I(e))),u=c(o(I(t))),d=St(n,l),f=St(n,u);return n==10&&(l<0&&(d=B(d,-l)),u<0&&(f=B(f,-u))),r||n==2?(e=d*i,t=f*a):(e=Vt(e,d),t=Bt(t,f)),[e,t]}function st(e,t,n,r){let i=ot(e,t,n,r);return e==0&&(i[0]=0),t==0&&(i[1]=0),i}var ct=.1,lt={mode:3,pad:ct},ut={pad:0,soft:null,mode:0},dt={min:ut,max:ut};function ft(e,t,n,r){return Xt(n)?mt(e,t,n):(ut.pad=n,ut.soft=r?0:null,ut.mode=r?3:0,mt(e,t,dt))}function P(e,t){return e??t}function pt(e,t,n){for(t=P(t,0),n=P(n,e.length-1);t<=n;){if(e[t]!=null)return!0;t++}return!1}function mt(e,t,n){let r=n.min,i=n.max,a=P(r.pad,0),o=P(i.pad,0),s=P(r.hard,-R),c=P(i.hard,R),l=P(r.soft,R),u=P(i.soft,-R),d=P(r.mode,0),f=P(i.mode,0),p=t-e,m=wt(p),h=xt(I(e),I(t)),g=I(wt(h)-m);(p<1e-24||g>10)&&(p=0,(e==0||t==0)&&(p=1e-24,d==2&&l!=R&&(a=0),f==2&&u!=-R&&(o=0)));let _=p||h||1e3,v=St(10,vt(wt(_))),y=B(Vt(e-_*(p==0?e==0?.1:1:a),v/10),24),b=e>=l&&(d==1||d==3&&y<=l||d==2&&y>=l)?l:R,x=xt(s,y<b&&e>=b?b:bt(b,y)),S=B(Bt(t+_*(p==0?t==0?.1:1:o),v/10),24),C=t<=u&&(f==1||f==3&&S>=u||f==2&&S<=u)?u:-R,w=bt(c,S>C&&t<=C?C:xt(C,S));return x==w&&x==0&&(w=100),[x,w]}var ht=new Intl.NumberFormat(Le?O.language:`en-US`),gt=e=>ht.format(e),F=Math,_t=F.PI,I=F.abs,vt=F.floor,L=F.round,yt=F.ceil,bt=F.min,xt=F.max,St=F.pow,Ct=F.sign,wt=F.log10,Tt=F.log2,Et=(e,t=1)=>F.sinh(e)*t,Dt=(e,t=1)=>F.asinh(e/t),R=1/0;function Ot(e){return(wt((e^e>>31)-(e>>31))|0)+1}function kt(e,t,n){return bt(xt(e,t),n)}function At(e){return typeof e==`function`}function z(e){return At(e)?e:()=>e}var jt=()=>{},Mt=e=>e,Nt=(e,t)=>t,Pt=e=>null,Ft=e=>!0,It=(e,t)=>e==t,Lt=/\.\d*?(?=9{6,}|0{6,})/gm,Rt=e=>{if(H(e)||Ht.has(e))return e;let t=`${e}`,n=t.match(Lt);if(n==null)return e;let r=n[0].length-1;if(t.indexOf(`e-`)!=-1){let[e,n]=t.split(`e`);return+`${Rt(e)}e${n}`}return B(e,r)};function zt(e,t){return Rt(B(Rt(e/t))*t)}function Bt(e,t){return Rt(yt(Rt(e/t))*t)}function Vt(e,t){return Rt(vt(Rt(e/t))*t)}function B(e,t=0){if(H(e))return e;let n=10**t;return L(e*n*(1+2**-52))/n}var Ht=new Map;function Ut(e){return((``+e).split(`.`)[1]||``).length}function V(e,t,n,r){let i=[],a=r.map(Ut);for(let o=t;o<n;o++){let t=I(o),n=B(St(e,o),t);for(let s=0;s<r.length;s++){let c=e==10?+`${r[s]}e${o}`:r[s]*n,l=(o>=0?0:t)+(o>=a[s]?0:a[s]),u=e==10?c:B(c,l);i.push(u),Ht.set(u,l)}}return i}var Wt={},Gt=[],Kt=[null,null],qt=Array.isArray,H=Number.isInteger,Jt=e=>e===void 0;function Yt(e){return typeof e==`string`}function Xt(e){let t=!1;if(e!=null){let n=e.constructor;t=n==null||n==Object}return t}function Zt(e){return typeof e==`object`&&!!e}var Qt=Object.getPrototypeOf(Uint8Array),$t=`__proto__`;function en(e,t=Xt){let n;if(qt(e)){let r=e.find(e=>e!=null);if(qt(r)||t(r)){n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=en(e[r],t)}else n=e.slice()}else if(e instanceof Qt)n=e.slice();else if(t(e)){n={};for(let r in e)r!=$t&&(n[r]=en(e[r],t))}else n=e;return n}function U(e){let t=arguments;for(let n=1;n<t.length;n++){let r=t[n];for(let t in r)t!=$t&&(Xt(e[t])?U(e[t],en(r[t])):e[t]=en(r[t]))}return e}var tn=0,nn=1,rn=2;function an(e,t,n){for(let r=0,i,a=-1;r<t.length;r++){let o=t[r];if(o>a){for(i=o-1;i>=0&&e[i]==null;)e[i--]=null;for(i=o+1;i<n&&e[i]==null;)e[a=i++]=null}}}function on(e,t){if(ln(e)){let t=e[0].slice();for(let n=1;n<e.length;n++)t.push(...e[n].slice(1));return un(t[0])||(t=cn(t)),t}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t][0],i=r.length;for(let e=0;e<i;e++)n.add(r[e])}let r=[Array.from(n).sort((e,t)=>e-t)],i=r[0].length,a=new Map;for(let e=0;e<i;e++)a.set(r[0][e],e);for(let n=0;n<e.length;n++){let o=e[n],s=o[0];for(let e=1;e<o.length;e++){let c=o[e],l=Array(i).fill(void 0),u=t?t[n][e]:nn,d=[];for(let e=0;e<c.length;e++){let t=c[e],n=a.get(s[e]);t===null?u!=tn&&(l[n]=t,u==rn&&d.push(n)):l[n]=t}an(l,d,i),r.push(l)}}return r}var sn=typeof queueMicrotask>`u`?e=>Promise.resolve().then(e):queueMicrotask;function cn(e){let t=e[0],n=t.length,r=Array(n);for(let e=0;e<r.length;e++)r[e]=e;r.sort((e,n)=>t[e]-t[n]);let i=[];for(let t=0;t<e.length;t++){let a=e[t],o=Array(n);for(let e=0;e<n;e++)o[e]=a[r[e]];i.push(o)}return i}function ln(e){let t=e[0][0],n=t.length;for(let r=1;r<e.length;r++){let i=e[r][0];if(i.length!=n)return!1;if(i!=t){for(let e=0;e<n;e++)if(i[e]!=t[e])return!1}}return!0}function un(e,t=100){let n=e.length;if(n<=1)return!0;let r=0,i=n-1;for(;r<=i&&e[r]==null;)r++;for(;i>=r&&e[i]==null;)i--;if(i<=r)return!0;let a=xt(1,vt((i-r+1)/t));for(let t=e[r],n=r+a;n<=i;n+=a){let r=e[n];if(r!=null){if(r<=t)return!1;t=r}}return!0}var dn=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],fn=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function pn(e){return e.slice(0,3)}var mn=fn.map(pn),hn={MMMM:dn,MMM:dn.map(pn),WWWW:fn,WWW:mn};function gn(e){return(e<10?`0`:``)+e}function _n(e){return(e<10?`00`:e<100?`0`:``)+e}var vn={YYYY:e=>e.getFullYear(),YY:e=>(e.getFullYear()+``).slice(2),MMMM:(e,t)=>t.MMMM[e.getMonth()],MMM:(e,t)=>t.MMM[e.getMonth()],MM:e=>gn(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>gn(e.getDate()),D:e=>e.getDate(),WWWW:(e,t)=>t.WWWW[e.getDay()],WWW:(e,t)=>t.WWW[e.getDay()],HH:e=>gn(e.getHours()),H:e=>e.getHours(),h:e=>{let t=e.getHours();return t==0?12:t>12?t-12:t},AA:e=>e.getHours()>=12?`PM`:`AM`,aa:e=>e.getHours()>=12?`pm`:`am`,a:e=>e.getHours()>=12?`p`:`a`,mm:e=>gn(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>gn(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>_n(e.getMilliseconds())};function yn(e,t){t||=hn;let n=[],r=/\{([a-z]+)\}|[^{]+/gi,i;for(;i=r.exec(e);)n.push(i[0][0]==`{`?vn[i[1]]:i[0]);return e=>{let r=``;for(let i=0;i<n.length;i++)r+=typeof n[i]==`string`?n[i]:n[i](e,t);return r}}var bn=new Intl.DateTimeFormat().resolvedOptions().timeZone;function xn(e,t){let n;return t==`UTC`||t==`Etc/UTC`?n=new Date(+e+e.getTimezoneOffset()*6e4):t==bn?n=e:(n=new Date(e.toLocaleString(`en-US`,{timeZone:t})),n.setMilliseconds(e.getMilliseconds())),n}var Sn=e=>e%1==0,Cn=[1,2,2.5,5],wn=V(10,-32,0,Cn),W=V(10,0,32,Cn),Tn=W.filter(Sn),En=wn.concat(W),Dn=`{YYYY}`,On=`
1
+ import{A as e,C as t,D as n,E as r,O as i,S as a,T as o,_ as s,a as c,b as l,c as u,g as d,h as f,i as p,k as m,m as h,o as g,p as _,r as v,s as y,t as b,v as x,w as S,x as C,y as w}from"./index-Ce3Y5UZC.js";var T=!0,E=`uplot`,ee=`u-hz`,te=`u-vt`,ne=`u-title`,re=`u-wrap`,ie=`u-under`,ae=`u-over`,oe=`u-axis`,se=`u-off`,ce=`u-select`,le=`u-cursor-x`,ue=`u-cursor-y`,de=`u-cursor-pt`,fe=`u-legend`,pe=`u-live`,me=`u-inline`,he=`u-series`,ge=`u-marker`,_e=`u-label`,ve=`u-value`,ye=`width`,be=`height`,xe=`top`,Se=`bottom`,Ce=`left`,we=`right`,Te=`#000`,Ee=`#0000`,De=`mousemove`,Oe=`mousedown`,ke=`mouseup`,Ae=`mouseenter`,je=`mouseleave`,Me=`dblclick`,D=`resize`,Ne=`scroll`,Pe=`change`,Fe=`dppxchange`,Ie=`--`,Le=typeof window<`u`,Re=Le?document:null,ze=Le?window:null,O=Le?navigator:null,k,Be;function Ve(){let e=devicePixelRatio;k!=e&&(k=e,Be&&et(Pe,Be,Ve),Be=matchMedia(`(min-resolution: ${k-.001}dppx) and (max-resolution: ${k+.001}dppx)`),$e(Pe,Be,Ve),ze.dispatchEvent(new CustomEvent(Fe)))}function He(e,t){if(t!=null){let n=e.classList;!n.contains(t)&&n.add(t)}}function Ue(e,t){let n=e.classList;n.contains(t)&&n.remove(t)}function A(e,t,n){e.style[t]=n+`px`}function We(e,t,n,r){let i=Re.createElement(e);return t!=null&&He(i,t),n?.insertBefore(i,r),i}function Ge(e,t){return We(`div`,e,t)}var Ke=new WeakMap;function qe(e,t,n,r,i){let a=`translate(`+t+`px,`+n+`px)`;a!=Ke.get(e)&&(e.style.transform=a,Ke.set(e,a),t<0||n<0||t>r||n>i?He(e,se):Ue(e,se))}var Je=new WeakMap;function Ye(e,t,n){let r=t+n;r!=Je.get(e)&&(Je.set(e,r),e.style.background=t,e.style.borderColor=n)}var Xe=new WeakMap;function Ze(e,t,n,r){let i=t+``+n;i!=Xe.get(e)&&(Xe.set(e,i),e.style.height=n+`px`,e.style.width=t+`px`,e.style.marginLeft=r?-t/2+`px`:0,e.style.marginTop=r?-n/2+`px`:0)}var Qe={passive:!0},j={...Qe,capture:!0};function $e(e,t,n,r){t.addEventListener(e,n,r?j:Qe)}function et(e,t,n,r){t.removeEventListener(e,n,Qe)}Le&&Ve();function tt(e,t,n,r){let i;n||=0,r||=t.length-1;let a=r<=2147483647;for(;r-n>1;)i=a?n+r>>1:vt((n+r)/2),t[i]<e?n=i:r=i;return e-t[n]<=t[r]-e?n:r}function M(e){return(t,n,r)=>{let i=-1,a=-1;for(let a=n;a<=r;a++)if(e(t[a])){i=a;break}for(let i=r;i>=n;i--)if(e(t[i])){a=i;break}return[i,a]}}var nt=e=>e!=null,rt=e=>e!=null&&e>0,N=M(nt),it=M(rt);function at(e,t,n,r=0,i=!1){let a=i?it:N,o=i?rt:nt;[t,n]=a(e,t,n);let s=e[t],c=e[t];if(t>-1)if(r==1)s=e[t],c=e[n];else if(r==-1)s=e[n],c=e[t];else for(let r=t;r<=n;r++){let t=e[r];o(t)&&(t<s?s=t:t>c&&(c=t))}return[s??R,c??-R]}function ot(e,t,n,r){let i=Ct(e),a=Ct(t);e==t&&(i==-1?(e*=n,t/=n):(e/=n,t*=n));let o=n==10?wt:Tt,s=i==1?vt:yt,c=a==1?yt:vt,l=s(o(I(e))),u=c(o(I(t))),d=St(n,l),f=St(n,u);return n==10&&(l<0&&(d=B(d,-l)),u<0&&(f=B(f,-u))),r||n==2?(e=d*i,t=f*a):(e=Vt(e,d),t=Bt(t,f)),[e,t]}function st(e,t,n,r){let i=ot(e,t,n,r);return e==0&&(i[0]=0),t==0&&(i[1]=0),i}var ct=.1,lt={mode:3,pad:ct},ut={pad:0,soft:null,mode:0},dt={min:ut,max:ut};function ft(e,t,n,r){return Xt(n)?mt(e,t,n):(ut.pad=n,ut.soft=r?0:null,ut.mode=r?3:0,mt(e,t,dt))}function P(e,t){return e??t}function pt(e,t,n){for(t=P(t,0),n=P(n,e.length-1);t<=n;){if(e[t]!=null)return!0;t++}return!1}function mt(e,t,n){let r=n.min,i=n.max,a=P(r.pad,0),o=P(i.pad,0),s=P(r.hard,-R),c=P(i.hard,R),l=P(r.soft,R),u=P(i.soft,-R),d=P(r.mode,0),f=P(i.mode,0),p=t-e,m=wt(p),h=xt(I(e),I(t)),g=I(wt(h)-m);(p<1e-24||g>10)&&(p=0,(e==0||t==0)&&(p=1e-24,d==2&&l!=R&&(a=0),f==2&&u!=-R&&(o=0)));let _=p||h||1e3,v=St(10,vt(wt(_))),y=B(Vt(e-_*(p==0?e==0?.1:1:a),v/10),24),b=e>=l&&(d==1||d==3&&y<=l||d==2&&y>=l)?l:R,x=xt(s,y<b&&e>=b?b:bt(b,y)),S=B(Bt(t+_*(p==0?t==0?.1:1:o),v/10),24),C=t<=u&&(f==1||f==3&&S>=u||f==2&&S<=u)?u:-R,w=bt(c,S>C&&t<=C?C:xt(C,S));return x==w&&x==0&&(w=100),[x,w]}var ht=new Intl.NumberFormat(Le?O.language:`en-US`),gt=e=>ht.format(e),F=Math,_t=F.PI,I=F.abs,vt=F.floor,L=F.round,yt=F.ceil,bt=F.min,xt=F.max,St=F.pow,Ct=F.sign,wt=F.log10,Tt=F.log2,Et=(e,t=1)=>F.sinh(e)*t,Dt=(e,t=1)=>F.asinh(e/t),R=1/0;function Ot(e){return(wt((e^e>>31)-(e>>31))|0)+1}function kt(e,t,n){return bt(xt(e,t),n)}function At(e){return typeof e==`function`}function z(e){return At(e)?e:()=>e}var jt=()=>{},Mt=e=>e,Nt=(e,t)=>t,Pt=e=>null,Ft=e=>!0,It=(e,t)=>e==t,Lt=/\.\d*?(?=9{6,}|0{6,})/gm,Rt=e=>{if(H(e)||Ht.has(e))return e;let t=`${e}`,n=t.match(Lt);if(n==null)return e;let r=n[0].length-1;if(t.indexOf(`e-`)!=-1){let[e,n]=t.split(`e`);return+`${Rt(e)}e${n}`}return B(e,r)};function zt(e,t){return Rt(B(Rt(e/t))*t)}function Bt(e,t){return Rt(yt(Rt(e/t))*t)}function Vt(e,t){return Rt(vt(Rt(e/t))*t)}function B(e,t=0){if(H(e))return e;let n=10**t;return L(e*n*(1+2**-52))/n}var Ht=new Map;function Ut(e){return((``+e).split(`.`)[1]||``).length}function V(e,t,n,r){let i=[],a=r.map(Ut);for(let o=t;o<n;o++){let t=I(o),n=B(St(e,o),t);for(let s=0;s<r.length;s++){let c=e==10?+`${r[s]}e${o}`:r[s]*n,l=(o>=0?0:t)+(o>=a[s]?0:a[s]),u=e==10?c:B(c,l);i.push(u),Ht.set(u,l)}}return i}var Wt={},Gt=[],Kt=[null,null],qt=Array.isArray,H=Number.isInteger,Jt=e=>e===void 0;function Yt(e){return typeof e==`string`}function Xt(e){let t=!1;if(e!=null){let n=e.constructor;t=n==null||n==Object}return t}function Zt(e){return typeof e==`object`&&!!e}var Qt=Object.getPrototypeOf(Uint8Array),$t=`__proto__`;function en(e,t=Xt){let n;if(qt(e)){let r=e.find(e=>e!=null);if(qt(r)||t(r)){n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=en(e[r],t)}else n=e.slice()}else if(e instanceof Qt)n=e.slice();else if(t(e)){n={};for(let r in e)r!=$t&&(n[r]=en(e[r],t))}else n=e;return n}function U(e){let t=arguments;for(let n=1;n<t.length;n++){let r=t[n];for(let t in r)t!=$t&&(Xt(e[t])?U(e[t],en(r[t])):e[t]=en(r[t]))}return e}var tn=0,nn=1,rn=2;function an(e,t,n){for(let r=0,i,a=-1;r<t.length;r++){let o=t[r];if(o>a){for(i=o-1;i>=0&&e[i]==null;)e[i--]=null;for(i=o+1;i<n&&e[i]==null;)e[a=i++]=null}}}function on(e,t){if(ln(e)){let t=e[0].slice();for(let n=1;n<e.length;n++)t.push(...e[n].slice(1));return un(t[0])||(t=cn(t)),t}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t][0],i=r.length;for(let e=0;e<i;e++)n.add(r[e])}let r=[Array.from(n).sort((e,t)=>e-t)],i=r[0].length,a=new Map;for(let e=0;e<i;e++)a.set(r[0][e],e);for(let n=0;n<e.length;n++){let o=e[n],s=o[0];for(let e=1;e<o.length;e++){let c=o[e],l=Array(i).fill(void 0),u=t?t[n][e]:nn,d=[];for(let e=0;e<c.length;e++){let t=c[e],n=a.get(s[e]);t===null?u!=tn&&(l[n]=t,u==rn&&d.push(n)):l[n]=t}an(l,d,i),r.push(l)}}return r}var sn=typeof queueMicrotask>`u`?e=>Promise.resolve().then(e):queueMicrotask;function cn(e){let t=e[0],n=t.length,r=Array(n);for(let e=0;e<r.length;e++)r[e]=e;r.sort((e,n)=>t[e]-t[n]);let i=[];for(let t=0;t<e.length;t++){let a=e[t],o=Array(n);for(let e=0;e<n;e++)o[e]=a[r[e]];i.push(o)}return i}function ln(e){let t=e[0][0],n=t.length;for(let r=1;r<e.length;r++){let i=e[r][0];if(i.length!=n)return!1;if(i!=t){for(let e=0;e<n;e++)if(i[e]!=t[e])return!1}}return!0}function un(e,t=100){let n=e.length;if(n<=1)return!0;let r=0,i=n-1;for(;r<=i&&e[r]==null;)r++;for(;i>=r&&e[i]==null;)i--;if(i<=r)return!0;let a=xt(1,vt((i-r+1)/t));for(let t=e[r],n=r+a;n<=i;n+=a){let r=e[n];if(r!=null){if(r<=t)return!1;t=r}}return!0}var dn=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],fn=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function pn(e){return e.slice(0,3)}var mn=fn.map(pn),hn={MMMM:dn,MMM:dn.map(pn),WWWW:fn,WWW:mn};function gn(e){return(e<10?`0`:``)+e}function _n(e){return(e<10?`00`:e<100?`0`:``)+e}var vn={YYYY:e=>e.getFullYear(),YY:e=>(e.getFullYear()+``).slice(2),MMMM:(e,t)=>t.MMMM[e.getMonth()],MMM:(e,t)=>t.MMM[e.getMonth()],MM:e=>gn(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>gn(e.getDate()),D:e=>e.getDate(),WWWW:(e,t)=>t.WWWW[e.getDay()],WWW:(e,t)=>t.WWW[e.getDay()],HH:e=>gn(e.getHours()),H:e=>e.getHours(),h:e=>{let t=e.getHours();return t==0?12:t>12?t-12:t},AA:e=>e.getHours()>=12?`PM`:`AM`,aa:e=>e.getHours()>=12?`pm`:`am`,a:e=>e.getHours()>=12?`p`:`a`,mm:e=>gn(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>gn(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>_n(e.getMilliseconds())};function yn(e,t){t||=hn;let n=[],r=/\{([a-z]+)\}|[^{]+/gi,i;for(;i=r.exec(e);)n.push(i[0][0]==`{`?vn[i[1]]:i[0]);return e=>{let r=``;for(let i=0;i<n.length;i++)r+=typeof n[i]==`string`?n[i]:n[i](e,t);return r}}var bn=new Intl.DateTimeFormat().resolvedOptions().timeZone;function xn(e,t){let n;return t==`UTC`||t==`Etc/UTC`?n=new Date(+e+e.getTimezoneOffset()*6e4):t==bn?n=e:(n=new Date(e.toLocaleString(`en-US`,{timeZone:t})),n.setMilliseconds(e.getMilliseconds())),n}var Sn=e=>e%1==0,Cn=[1,2,2.5,5],wn=V(10,-32,0,Cn),W=V(10,0,32,Cn),Tn=W.filter(Sn),En=wn.concat(W),Dn=`{YYYY}`,On=`
2
2
  {YYYY}`,kn=`{M}/{D}`,An=`
3
3
  {M}/{D}`,jn=`
4
4
  {M}/{D}/{YY}`,Mn=`{h}:{mm}{aa}`,Nn=`
@@ -7,4 +7,4 @@ import{C as e,D as t,E as n,O as r,S as i,T as a,_ as o,a as s,b as c,c as l,f a
7
7
  {M}/{D} {h}:{mm}{aa}`,G,Nn,G,1],[e,`:{ss}.{fff}`,`
8
8
  {M}/{D}/{YY} {h}:{mm}{aa}`,G,`
9
9
  {M}/{D} {h}:{mm}{aa}`,G,Nn,G,1]];function l(t){return(s,c,l,u,d,f)=>{let p=[],m=d>=o,h=d>=a&&d<o,g=t(l),_=B(g*e,3),v=Gn(g.getFullYear(),m?0:g.getMonth(),h||m?1:g.getDate()),y=B(v*e,3);if(h||m){let n=h?d/a:0,r=m?d/o:0,i=_==y?_:B(Gn(v.getFullYear()+r,v.getMonth()+n,1)*e,3),s=new Date(L(i/e)),c=s.getFullYear(),l=s.getMonth();for(let a=0;i<=u;a++){let o=Gn(c+r*a,l+n*a,1),s=o-t(B(o*e,3));i=B((+o+s)*e,3),i<=u&&p.push(i)}}else{let a=d>=i?i:d,o=y+(vt(l)-vt(_))+Bt(_-y,a);p.push(o);let m=t(o),h=m.getHours()+m.getMinutes()/n+m.getSeconds()/r,g=d/r,v=f/s.axes[c]._space;for(;o=B(o+d,e==1?0:3),!(o>u);)if(g>1){let e=vt(B(h+g,6))%24,n=t(o).getHours()-e;n>1&&(n=-1),o-=n*r,h=(h+g)%24;let i=p[p.length-1];B((o-i)/d,3)*v>=.7&&p.push(o)}else p.push(o)}return p}}return[s,c,l]}var[In,Ln,Rn]=Fn(1),[zn,Bn,Vn]=Fn(.001);V(2,-53,53,[1]);function Hn(e,t){return e.map(e=>e.map((n,r)=>r==0||r==8||n==null?n:t(r==1||e[8]==0?n:e[1]+n)))}function Un(e,t){return(n,r,i,a,o)=>{let s=t.find(e=>o>=e[0])||t[t.length-1],c,l,u,d,f,p;return r.map(t=>{let n=e(t),r=n.getFullYear(),i=n.getMonth(),a=n.getDate(),o=n.getHours(),m=n.getMinutes(),h=n.getSeconds(),g=r!=c&&s[2]||i!=l&&s[3]||a!=u&&s[4]||o!=d&&s[5]||m!=f&&s[6]||h!=p&&s[7]||s[1];return c=r,l=i,u=a,d=o,f=m,p=h,g(n)})}}function Wn(e,t){let n=yn(t);return(t,r,i,a,o)=>r.map(t=>n(e(t)))}function Gn(e,t,n){return new Date(e,t,n)}function Kn(e,t){return t(e)}var qn=`{YYYY}-{MM}-{DD} {h}:{mm}{aa}`;function Jn(e,t){return(n,r,i,a)=>a==null?Ie:t(e(r))}function Yn(e,t){let n=e.series[t];return n.width?n.stroke(e,t):n.points.width?n.points.stroke(e,t):null}function Xn(e,t){return e.series[t].fill(e,t)}var Zn={show:!0,live:!0,isolate:!1,mount:jt,markers:{show:!0,width:2,stroke:Yn,fill:Xn,dash:`solid`},idx:null,idxs:null,values:[]};function Qn(e,t){let n=e.cursor.points,r=Ge(),i=n.size(e,t);A(r,ye,i),A(r,be,i);let a=i/-2;A(r,`marginLeft`,a),A(r,`marginTop`,a);let o=n.width(e,t,i);return o&&A(r,`borderWidth`,o),r}function $n(e,t){let n=e.series[t].points;return n._fill||n._stroke}function K(e,t){let n=e.series[t].points;return n._stroke||n._fill}function q(e,t){return e.series[t].points.size}var J=[0,0];function er(e,t,n){return J[0]=t,J[1]=n,J}function tr(e,t,n,r=!0){return e=>{e.button==0&&(!r||e.target==t)&&n(e)}}function nr(e,t,n,r=!0){return e=>{(!r||e.target==t)&&n(e)}}var rr={show:!0,x:!0,y:!0,lock:!1,move:er,points:{one:!1,show:Qn,size:q,width:0,stroke:K,fill:$n},bind:{mousedown:tr,mouseup:tr,click:tr,dblclick:tr,mousemove:nr,mouseleave:nr,mouseenter:nr},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(e,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(e,t,n,r,i)=>r-i,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},ir={show:!0,stroke:`rgba(0,0,0,0.07)`,width:2},ar=U({},ir,{filter:Nt}),or=U({},ar,{size:10}),sr=U({},ir,{show:!1}),cr=`12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`,lr=`bold 12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`,ur=1.5,dr={show:!0,scale:`x`,stroke:Te,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:lr,side:2,grid:ar,ticks:or,border:sr,font:cr,lineGap:ur,rotate:0},fr=`Value`,pr=`Time`,mr={show:!0,scale:`x`,auto:!1,sorted:1,min:R,max:-1/0,idxs:[]};function hr(e,t,n,r,i){return t.map(e=>e==null?``:gt(e))}function gr(e,t,n,r,i,a,o){let s=[],c=Ht.get(i)||0;n=o?n:B(Bt(n,i),c);for(let e=n;e<=r;e=B(e+i,c))s.push(Object.is(e,-0)?0:e);return s}function _r(e,t,n,r,i,a,o){let s=[],c=e.scales[e.axes[t].scale].log;i=St(c,vt((c==10?wt:Tt)(n))),c==10&&(i=En[tt(i,En)]);let l=n,u=i*c;c==10&&(u=En[tt(u,En)]);do s.push(l),l+=i,c==10&&!Ht.has(l)&&(l=B(l,Ht.get(i))),l>=u&&(i=l,u=i*c,c==10&&(u=En[tt(u,En)]));while(l<=r);return s}function vr(e,t,n,r,i,a,o){let s=e.scales[e.axes[t].scale].asinh,c=r>s?_r(e,t,xt(s,n),r,i):[s],l=r>=0&&n<=0?[0]:[];return(n<-s?_r(e,t,xt(s,-r),-n,i):[s]).reverse().map(e=>-e).concat(l,c)}var yr=/./,br=/[12357]/,xr=/[125]/,Sr=/1/,Cr=(e,t,n,r)=>e.map((e,i)=>t==4&&e==0||i%r==0&&n.test(e.toExponential()[+(e<0)])?e:null);function wr(e,t,n,r,i){let a=e.axes[n],o=a.scale,s=e.scales[o],c=e.valToPos,l=a._space,u=c(10,o),d=c(9,o)-u>=l?yr:c(7,o)-u>=l?br:c(5,o)-u>=l?xr:Sr;if(d==Sr){let e=I(c(1,o)-u);if(e<l)return Cr(t.slice().reverse(),s.distr,d,yt(l/e)).reverse()}return Cr(t,s.distr,d,1)}function Tr(e,t,n,r,i){let a=e.axes[n],o=a.scale,s=a._space,c=e.valToPos,l=I(c(1,o)-c(2,o));return l<s?Cr(t.slice().reverse(),3,yr,yt(s/l)).reverse():t}function Er(e,t,n,r){return r==null?Ie:t==null?``:gt(t)}var Dr={show:!0,scale:`y`,stroke:Te,space:30,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:lr,side:3,grid:ar,ticks:or,border:sr,font:cr,lineGap:ur,rotate:0};function Or(e,t){return B((3+(e||1)*2)*t,3)}function kr(e,t){let{scale:n,idxs:r}=e.series[0],i=e._data[0],a=e.valToPos(i[r[0]],n,!0),o=I(e.valToPos(i[r[1]],n,!0)-a)/(e.series[t].points.space*k);return r[1]-r[0]<=o}var Ar={scale:null,auto:!0,sorted:0,min:R,max:-1/0},jr=(e,t,n,r,i)=>i,Mr={show:!0,auto:!0,sorted:0,gaps:jr,alpha:1,facets:[U({},Ar,{scale:`x`}),U({},Ar,{scale:`y`})]},Nr={scale:`y`,auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:jr,alpha:1,points:{show:kr,filter:null},values:null,min:R,max:-1/0,idxs:[],path:null,clip:null};function Pr(e,t,n,r,i){return n/10}var Fr={time:T,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},Ir=U({},Fr,{time:!1,ori:1}),Lr={};function Rr(e,t){let n=Lr[e];return n||(n={key:e,plots:[],sub(e){n.plots.push(e)},unsub(e){n.plots=n.plots.filter(t=>t!=e)},pub(e,t,r,i,a,o,s){for(let c=0;c<n.plots.length;c++)n.plots[c]!=t&&n.plots[c].pub(e,t,r,i,a,o,s)}},e!=null&&(Lr[e]=n)),n}var zr=1,Br=2;function Vr(e,t,n){let r=e.mode,i=e.series[t],a=r==2?e._data[t]:e._data,o=e.scales,s=e.bbox,c=a[0],l=r==2?a[1]:a[t],u=r==2?o[i.facets[0].scale]:o[e.series[0].scale],d=r==2?o[i.facets[1].scale]:o[i.scale],f=s.left,p=s.top,m=s.width,h=s.height,g=e.valToPosH,_=e.valToPosV;return u.ori==0?n(i,c,l,u,d,g,_,f,p,m,h,Xr,Qr,ei,ni,ii):n(i,c,l,u,d,_,g,p,f,h,m,Zr,$r,ti,ri,ai)}function Hr(e,t){let n=0,r=0,i=P(e.bands,Gt);for(let e=0;e<i.length;e++){let a=i[e];a.series[0]==t?n=a.dir:a.series[1]==t&&(a.dir==1?r|=1:r|=2)}return[n,r==1?-1:r==2?1:r==3?2:0]}function Ur(e,t,n,r,i){let a=e.mode,o=e.series[t],s=a==2?o.facets[1].scale:o.scale,c=e.scales[s];return i==-1?c.min:i==1?c.max:c.distr==3?c.dir==1?c.min:c.max:0}function Wr(e,t,n,r,i,a){return Vr(e,t,(e,t,o,s,c,l,u,d,f,p,m)=>{let h=e.pxRound,g=s.dir*(s.ori==0?1:-1),_=s.ori==0?Qr:$r,v,y;g==1?(v=n,y=r):(v=r,y=n);let b=h(l(t[v],s,p,d)),x=h(u(o[v],c,m,f)),S=h(l(t[y],s,p,d)),C=h(u(a==1?c.max:c.min,c,m,f)),w=new Path2D(i);return _(w,S,C),_(w,b,C),_(w,b,x),w})}function Gr(e,t,n,r,i,a){let o=null;if(e.length>0){o=new Path2D;let s=t==0?ei:ti,c=n;for(let t=0;t<e.length;t++){let n=e[t];if(n[1]>n[0]){let e=n[0]-c;e>0&&s(o,c,r,e,r+a),c=n[1]}}let l=n+i-c;l>0&&s(o,c,r-10/2,l,r+a+10)}return o}function Kr(e,t,n){let r=e[e.length-1];r&&r[0]==t?r[1]=n:e.push([t,n])}function qr(e,t,n,r,i,a,o){let s=[],c=e.length;for(let l=i==1?n:r;l>=n&&l<=r;l+=i)if(t[l]===null){let u=l,d=l;if(i==1)for(;++l<=r&&t[l]===null;)d=l;else for(;--l>=n&&t[l]===null;)d=l;let f=a(e[u]),p=d==u?f:a(e[d]),m=u-i;f=o<=0&&m>=0&&m<c?a(e[m]):f;let h=d+i;p=o>=0&&h>=0&&h<c?a(e[h]):p,p>=f&&s.push([f,p])}return s}function Jr(e){return e==0?Mt:e==1?L:t=>zt(t,e)}function Yr(e){let t=e==0?Xr:Zr,n=e==0?(e,t,n,r,i,a)=>{e.arcTo(t,n,r,i,a)}:(e,t,n,r,i,a)=>{e.arcTo(n,t,i,r,a)},r=e==0?(e,t,n,r,i)=>{e.rect(t,n,r,i)}:(e,t,n,r,i)=>{e.rect(n,t,i,r)};return(e,i,a,o,s,c=0,l=0)=>{c==0&&l==0?r(e,i,a,o,s):(c=bt(c,o/2,s/2),l=bt(l,o/2,s/2),t(e,i+c,a),n(e,i+o,a,i+o,a+s,c),n(e,i+o,a+s,i,a+s,l),n(e,i,a+s,i,a,l),n(e,i,a,i+o,a,c),e.closePath())}}var Xr=(e,t,n)=>{e.moveTo(t,n)},Zr=(e,t,n)=>{e.moveTo(n,t)},Qr=(e,t,n)=>{e.lineTo(t,n)},$r=(e,t,n)=>{e.lineTo(n,t)},ei=Yr(0),ti=Yr(1),ni=(e,t,n,r,i,a)=>{e.arc(t,n,r,i,a)},ri=(e,t,n,r,i,a)=>{e.arc(n,t,r,i,a)},ii=(e,t,n,r,i,a,o)=>{e.bezierCurveTo(t,n,r,i,a,o)},ai=(e,t,n,r,i,a,o)=>{e.bezierCurveTo(n,t,i,r,o,a)};function oi(e){return(e,t,n,r,i)=>Vr(e,t,(t,a,o,s,c,l,u,d,f,p,m)=>{let{pxRound:h,points:g}=t,_,v;s.ori==0?(_=Xr,v=ni):(_=Zr,v=ri);let y=B(g.width*k,3),b=(g.size-g.width)/2*k,x=B(b*2,3),S=new Path2D,C=new Path2D,{left:w,top:T,width:E,height:ee}=e.bbox;ei(C,w-x,T-x,E+x*2,ee+x*2);let te=e=>{if(o[e]!=null){let t=h(l(a[e],s,p,d)),n=h(u(o[e],c,m,f));_(S,t+b,n),v(S,t,n,b,0,_t*2)}};if(i)i.forEach(te);else for(let e=n;e<=r;e++)te(e);return{stroke:y>0?S:null,fill:S,clip:C,flags:3}})}function si(e){return(t,n,r,i,a,o)=>{r!=i&&(a!=r&&o!=r&&e(t,n,r),a!=i&&o!=i&&e(t,n,i),e(t,n,o))}}var ci=si(Qr),li=si($r);function ui(e){let t=P(e?.alignGaps,0);return(e,n,r,i)=>Vr(e,n,(a,o,s,c,l,u,d,f,p,m,h)=>{[r,i]=N(s,r,i);let g=a.pxRound,_=e=>g(u(e,c,m,f)),v=e=>g(d(e,l,h,p)),y,b;c.ori==0?(y=Qr,b=ci):(y=$r,b=li);let x=c.dir*(c.ori==0?1:-1),S={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:zr},C=S.stroke,w=!1;if(i-r>=m*4){let t=t=>e.posToVal(t,c.key,!0),n=null,a=null,l,u,d=_(o[x==1?r:i]),f=_(o[r]),p=_(o[i]),m=t(x==1?f+1:p-1);for(let e=x==1?r:i;e>=r&&e<=i;e+=x){let r=o[e],i=(x==1?r<m:r>m)?d:_(r),c=s[e];i==d?c==null?c===null&&(w=!0):(u=c,n==null?(y(C,i,v(u)),l=n=a=u):u<n?n=u:u>a&&(a=u)):(n!=null&&b(C,d,v(n),v(a),v(l),v(u)),c==null?(n=a=null,c===null&&(w=!0)):(u=c,y(C,i,v(u)),n=a=l=u),d=i,m=t(d+x))}n!=null&&n!=a&&d!=null&&b(C,d,v(n),v(a),v(l),v(u))}else for(let e=x==1?r:i;e>=r&&e<=i;e+=x){let t=s[e];t===null?w=!0:t!=null&&y(C,_(o[e]),v(t))}let[T,E]=Hr(e,n);if(a.fill!=null||T!=0){let t=S.fill=new Path2D(C),s=v(a.fillTo(e,n,a.min,a.max,T)),c=_(o[r]),l=_(o[i]);x==-1&&([l,c]=[c,l]),y(t,l,s),y(t,c,s)}if(!a.spanGaps){let l=[];w&&l.push(...qr(o,s,r,i,x,_,t)),S.gaps=l=a.gaps(e,n,r,i,l),S.clip=Gr(l,c.ori,f,p,m,h)}return E!=0&&(S.band=E==2?[Wr(e,n,r,i,C,-1),Wr(e,n,r,i,C,1)]:Wr(e,n,r,i,C,E)),S})}function di(e){let t=P(e.align,1),n=P(e.ascDesc,!1),r=P(e.alignGaps,0),i=P(e.extend,!1);return(e,a,o,s)=>Vr(e,a,(c,l,u,d,f,p,m,h,g,_,v)=>{[o,s]=N(u,o,s);let y=c.pxRound,{left:b,width:x}=e.bbox,S=e=>y(p(e,d,_,h)),C=e=>y(m(e,f,v,g)),w=d.ori==0?Qr:$r,T={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:zr},E=T.stroke,ee=d.dir*(d.ori==0?1:-1),te=C(u[ee==1?o:s]),ne=S(l[ee==1?o:s]),re=ne,ie=ne;i&&t==-1&&(ie=b,w(E,ie,te)),w(E,ne,te);for(let e=ee==1?o:s;e>=o&&e<=s;e+=ee){let n=u[e];if(n==null)continue;let r=S(l[e]),i=C(n);t==1?w(E,r,te):w(E,re,i),w(E,r,i),te=i,re=r}let ae=re;i&&t==1&&(ae=b+x,w(E,ae,te));let[oe,se]=Hr(e,a);if(c.fill!=null||oe!=0){let t=T.fill=new Path2D(E),n=C(c.fillTo(e,a,c.min,c.max,oe));w(t,ae,n),w(t,ie,n)}if(!c.spanGaps){let i=[];i.push(...qr(l,u,o,s,ee,S,r));let f=c.width*k/2,p=n||t==1?f:-f,m=n||t==-1?-f:f;i.forEach(e=>{e[0]+=p,e[1]+=m}),T.gaps=i=c.gaps(e,a,o,s,i),T.clip=Gr(i,d.ori,h,g,_,v)}return se!=0&&(T.band=se==2?[Wr(e,a,o,s,E,-1),Wr(e,a,o,s,E,1)]:Wr(e,a,o,s,E,se)),T})}function fi(e,t,n,r,i,a,o=R){if(e.length>1){let s=null;for(let c=0,l=1/0;c<e.length;c++)if(t[c]!==void 0){if(s!=null){let t=I(e[c]-e[s]);t<l&&(l=t,o=I(n(e[c],r,i,a)-n(e[s],r,i,a)))}s=c}}return o}function pi(e){e||=Wt;let t=P(e.size,[.6,R,1]),n=e.align||0,r=e.gap||0,i=e.radius;i=i==null?[0,0]:typeof i==`number`?[i,0]:i;let a=z(i),o=1-t[0],s=P(t[1],R),c=P(t[2],1),l=P(e.disp,Wt),u=P(e.each,e=>{}),{fill:d,stroke:f}=l;return(e,t,i,p)=>Vr(e,t,(m,h,g,_,v,y,b,x,S,C,w)=>{let T=m.pxRound,E=n,ee=r*k,te=s*k,ne=c*k,re,ie;_.ori==0?[re,ie]=a(e,t):[ie,re]=a(e,t);let ae=_.dir*(_.ori==0?1:-1),oe=_.ori==0?ei:ti,se=_.ori==0?u:(e,t,n,r,i,a,o)=>{u(e,t,n,i,r,o,a)},ce=P(e.bands,Gt).find(e=>e.series[0]==t),le=ce==null?0:ce.dir,ue=m.fillTo(e,t,m.min,m.max,le),de=T(b(ue,v,w,S)),fe,pe,me,he=C,ge=T(m.width*k),_e=!1,ve=null,ye=null,be=null,xe=null;d!=null&&(ge==0||f!=null)&&(_e=!0,ve=d.values(e,t,i,p),ye=new Map,new Set(ve).forEach(e=>{e!=null&&ye.set(e,new Path2D)}),ge>0&&(be=f.values(e,t,i,p),xe=new Map,new Set(be).forEach(e=>{e!=null&&xe.set(e,new Path2D)})));let{x0:Se,size:Ce}=l;if(Se!=null&&Ce!=null){E=1,h=Se.values(e,t,i,p),Se.unit==2&&(h=h.map(t=>e.posToVal(x+t*C,_.key,!0)));let n=Ce.values(e,t,i,p);pe=Ce.unit==2?n[0]*C:y(n[0],_,C,x)-y(0,_,C,x),he=fi(h,g,y,_,C,x,he),me=he-pe+ee}else he=fi(h,g,y,_,C,x,he),me=he*o+ee,pe=he-me;me<1&&(me=0),ge>=pe/2&&(ge=0),me<5&&(T=Mt);let we=me>0,Te=he-me-(we?ge:0);pe=T(kt(Te,ne,te)),fe=(E==0?pe/2:E==ae?0:pe)-E*ae*((E==0?ee/2:0)+(we?ge/2:0));let Ee={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},De=_e?null:new Path2D,Oe=null;if(ce!=null)Oe=e.data[ce.series[1]];else{let{y0:n,y1:r}=l;n!=null&&r!=null&&(g=r.values(e,t,i,p),Oe=n.values(e,t,i,p))}let ke=re*pe,Ae=ie*pe;for(let n=ae==1?i:p;n>=i&&n<=p;n+=ae){let r=g[n];if(r==null)continue;if(Oe!=null){let e=Oe[n]??0;if(r-e==0)continue;de=b(e,v,w,S)}let i=y(_.distr!=2||l!=null?h[n]:n,_,C,x),a=b(P(r,ue),v,w,S),o=T(i-fe),s=T(xt(a,de)),c=T(bt(a,de)),u=s-c;if(r!=null){let i=r<0?Ae:ke,a=r<0?ke:Ae;_e?(ge>0&&be[n]!=null&&oe(xe.get(be[n]),o,c+vt(ge/2),pe,xt(0,u-ge),i,a),ve[n]!=null&&oe(ye.get(ve[n]),o,c+vt(ge/2),pe,xt(0,u-ge),i,a)):oe(De,o,c+vt(ge/2),pe,xt(0,u-ge),i,a),se(e,t,n,o-ge/2,c,pe+ge,u)}}return ge>0?Ee.stroke=_e?xe:De:_e||(Ee._fill=m.width==0?m._fill:m._stroke??m._fill,Ee.width=0),Ee.fill=_e?ye:De,Ee})}function mi(e,t){let n=P(t?.alignGaps,0);return(t,r,i,a)=>Vr(t,r,(o,s,c,l,u,d,f,p,m,h,g)=>{[i,a]=N(c,i,a);let _=o.pxRound,v=e=>_(d(e,l,h,p)),y=e=>_(f(e,u,g,m)),b,x,S;l.ori==0?(b=Xr,S=Qr,x=ii):(b=Zr,S=$r,x=ai);let C=l.dir*(l.ori==0?1:-1),w=v(s[C==1?i:a]),T=w,E=[],ee=[];for(let e=C==1?i:a;e>=i&&e<=a;e+=C)if(c[e]!=null){let t=s[e],n=v(t);E.push(T=n),ee.push(y(c[e]))}let te={stroke:e(E,ee,b,S,x,_),fill:null,clip:null,band:null,gaps:null,flags:zr},ne=te.stroke,[re,ie]=Hr(t,r);if(o.fill!=null||re!=0){let e=te.fill=new Path2D(ne),n=y(o.fillTo(t,r,o.min,o.max,re));S(e,T,n),S(e,w,n)}if(!o.spanGaps){let e=[];e.push(...qr(s,c,i,a,C,v,n)),te.gaps=e=o.gaps(t,r,i,a,e),te.clip=Gr(e,l.ori,p,m,h,g)}return ie!=0&&(te.band=ie==2?[Wr(t,r,i,a,ne,-1),Wr(t,r,i,a,ne,1)]:Wr(t,r,i,a,ne,ie)),te})}function hi(e){return mi(gi,e)}function gi(e,t,n,r,i,a){let o=e.length;if(o<2)return null;let s=new Path2D;if(n(s,e[0],t[0]),o==2)r(s,e[1],t[1]);else{let n=Array(o),r=Array(o-1),a=Array(o-1),c=Array(o-1);for(let n=0;n<o-1;n++)a[n]=t[n+1]-t[n],c[n]=e[n+1]-e[n],r[n]=a[n]/c[n];n[0]=r[0];for(let e=1;e<o-1;e++)r[e]===0||r[e-1]===0||r[e-1]>0!=r[e]>0?n[e]=0:(n[e]=3*(c[e-1]+c[e])/((2*c[e]+c[e-1])/r[e-1]+(c[e]+2*c[e-1])/r[e]),isFinite(n[e])||(n[e]=0));n[o-1]=r[o-2];for(let r=0;r<o-1;r++)i(s,e[r]+c[r]/3,t[r]+n[r]*c[r]/3,e[r+1]-c[r]/3,t[r+1]-n[r+1]*c[r]/3,e[r+1],t[r+1])}return s}var _i=new Set;function vi(){for(let e of _i)e.syncRect(!0)}Le&&($e(D,ze,vi),$e(Ne,ze,vi,!0),$e(Fe,ze,()=>{Y.pxRatio=k}));var yi=ui(),bi=oi();function xi(e,t,n,r){return(r?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map((e,r)=>Ci(e,r,t,n))}function Si(e,t){return e.map((e,n)=>n==0?{}:U({},t,e))}function Ci(e,t,n,r){return U({},t==0?n:r,e)}function wi(e,t,n){return t==null?Kt:[t,n]}var Ti=wi;function Ei(e,t,n){return t==null?Kt:ft(t,n,ct,!0)}function Di(e,t,n,r){return t==null?Kt:ot(t,n,e.scales[r].log,!1)}var Oi=Di;function ki(e,t,n,r){return t==null?Kt:st(t,n,e.scales[r].log,!1)}var Ai=ki;function ji(e,t,n,r,i){let a=xt(Ot(e),Ot(t)),o=t-e,s=tt(i/r*o,n);do{let e=n[s],t=r*e/o;if(t>=i&&a+(e<5?Ht.get(e):0)<=17)return[e,t]}while(++s<n.length);return[0,0]}function Mi(e){let t,n;return e=e.replace(/(\d+)px/,(e,r)=>(t=L((n=+r)*k))+`px`),[e,t,n]}function Ni(e){e.show&&[e.font,e.labelFont].forEach(e=>{let t=B(e[2]*k,1);e[0]=e[0].replace(/[0-9.]+px/,t+`px`),e[1]=t})}function Y(e,t,n){let r={mode:P(e.mode,1)},i=r.mode;function a(e,t,n,r){let i=t.valToPct(e);return r+n*(t.dir==-1?1-i:i)}function o(e,t,n,r){let i=t.valToPct(e);return r+n*(t.dir==-1?i:1-i)}function s(e,t,n,r){return t.ori==0?a(e,t,n,r):o(e,t,n,r)}r.valToPosH=a,r.valToPosV=o;let c=!1;r.status=0;let l=r.root=Ge(E);if(e.id!=null&&(l.id=e.id),He(l,e.class),e.title){let t=Ge(ne,l);t.textContent=e.title}let u=We(`canvas`),d=r.ctx=u.getContext(`2d`),f=Ge(re,l);$e(`click`,f,e=>{e.target===m&&(X!=Y||Z!=Pi)&&Ri.click(r,e)},!0);let p=r.under=Ge(ie,f);f.appendChild(u);let m=r.over=Ge(ae,f);e=en(e);let h=+P(e.pxAlign,1),g=Jr(h);(e.plugins||[]).forEach(t=>{t.opts&&(e=t.opts(r,e)||e)});let _=e.ms||.001,v=r.series=i==1?xi(e.series||[],mr,Nr,!1):Si(e.series||[null],Mr),y=r.axes=xi(e.axes||[],dr,Dr,!0),b=r.scales={},x=r.bands=e.bands||[];x.forEach(e=>{e.fill=z(e.fill||null),e.dir=P(e.dir,-1)});let S=i==2?v[1].facets[0].scale:v[0].scale,C={axes:ni,series:Wr},w=(e.drawOrder||[`axes`,`series`]).map(e=>C[e]);function T(e){let t=e.distr==3?t=>wt(t>0?t:e.clamp(r,t,e.min,e.max,e.key)):e.distr==4?t=>Dt(t,e.asinh):e.distr==100?t=>e.fwd(t):e=>e;return n=>{let r=t(n),{_min:i,_max:a}=e,o=a-i;return(r-i)/o}}function Te(t){let n=b[t];if(n==null){let r=(e.scales||Wt)[t]||Wt;if(r.from!=null){Te(r.from);let e=U({},b[r.from],r,{key:t});e.valToPct=T(e),b[t]=e}else{n=b[t]=U({},t==S?Fr:Ir,r),n.key=t;let e=n.time,a=n.range,o=qt(a);if((t!=S||i==2&&!e)&&(o&&(a[0]==null||a[1]==null)&&(a={min:a[0]==null?lt:{mode:1,hard:a[0],soft:a[0]},max:a[1]==null?lt:{mode:1,hard:a[1],soft:a[1]}},o=!1),!o&&Xt(a))){let e=a;a=(t,n,r)=>n==null?Kt:ft(n,r,e)}n.range=z(a||(e?Ti:t==S?n.distr==3?Oi:n.distr==4?Ai:wi:n.distr==3?Di:n.distr==4?ki:Ei)),n.auto=z(o?!1:n.auto),n.clamp=z(n.clamp||Pr),n._min=n._max=null,n.valToPct=T(n)}}}Te(`x`),Te(`y`),i==1&&v.forEach(e=>{Te(e.scale)}),y.forEach(e=>{Te(e.scale)});for(let t in e.scales)Te(t);let D=b[S],Ne=D.distr,Pe,Le;D.ori==0?(He(l,ee),Pe=a,Le=o):(He(l,te),Pe=o,Le=a);let O={};for(let e in b){let t=b[e];(t.min!=null||t.max!=null)&&(O[e]={min:t.min,max:t.max},t.min=t.max=null)}let Be=e.tzDate||(e=>new Date(L(e/_))),Ve=e.fmtDate||yn,Ke=_==1?Rn(Be):Vn(Be),Je=Un(Be,Hn(_==1?Ln:Bn,Ve)),Xe=Jn(Be,Kn(qn,Ve)),Qe=[],j=r.legend=U({},Zn,e.legend),M=r.cursor=U({},rr,{drag:{y:i==2}},e.cursor),nt=j.show,rt=M.show,N=j.markers;j.idxs=Qe,N.width=z(N.width),N.dash=z(N.dash),N.stroke=z(N.stroke),N.fill=z(N.fill);let it,ut,dt,mt=[],ht=[],gt,F=!1,vt={};if(j.live){let e=v[1]?v[1].values:null;F=e!=null,gt=F?e(r,1,0):{_:0};for(let e in gt)vt[e]=Ie}if(nt)if(it=We(`table`,fe,l),dt=We(`tbody`,null,it),j.mount(r,it),F){ut=We(`thead`,null,it,dt);let e=We(`tr`,null,ut);for(var Ct in We(`th`,null,e),gt)We(`th`,_e,e).textContent=Ct}else He(it,me),j.live&&He(it,pe);let Tt={show:!0},Ot={show:!1};function jt(e,t){if(t==0&&(F||!j.live||i==2))return Kt;let n=[],a=We(`tr`,he,dt,dt.childNodes[t]);He(a,e.class),e.show||He(a,se);let o=We(`th`,null,a);if(N.show){let e=Ge(ge,o);if(t>0){let n=N.width(r,t);n&&(e.style.border=n+`px `+N.dash(r,t)+` `+N.stroke(r,t)),e.style.background=N.fill(r,t)}}let s=Ge(_e,o);for(var c in e.label instanceof HTMLElement?s.appendChild(e.label):s.textContent=e.label,t>0&&(N.show||(s.style.color=e.width>0?N.stroke(r,t):N.fill(r,t)),Lt(`click`,o,t=>{if(M._lock)return;wn(t);let n=v.indexOf(e);if((t.ctrlKey||t.metaKey)!=j.isolate){let e=v.some((e,t)=>t>0&&t!=n&&e.show);v.forEach((t,r)=>{r>0&&Gi(r,e?r==n?Tt:Ot:Tt,!0,$.setSeries)})}else Gi(n,{show:!e.show},!0,$.setSeries)},!1),On&&Lt(Ae,o,t=>{M._lock||(wn(t),Gi(v.indexOf(e),$i,!0,$.setSeries))},!1)),gt){let e=We(`td`,ve,a);e.textContent=`--`,n.push(e)}return[a,n]}let Mt=new Map;function Lt(e,t,n,i=!0){let a=Mt.get(t)||{},o=M.bind[e](r,t,n,i);o&&($e(e,t,a[e]=o),Mt.set(t,a))}function Rt(e,t,n){let r=Mt.get(t)||{};for(let n in r)(e==null||n==e)&&(et(n,t,r[n]),delete r[n]);e??Mt.delete(t)}let Bt=0,Vt=0,V=0,H=0,Qt=0,$t=0,tn=Qt,nn=$t,rn=V,an=H,on=0,cn=0,ln=0,un=0;r.bbox={};let dn=!1,fn=!1,pn=!1,mn=!1,hn=!1,gn=!1;function _n(e,t,n){(n||e!=r.width||t!=r.height)&&vn(e,t),ri(!1),pn=!0,fn=!0,ci()}function vn(e,t){r.width=Bt=V=e,r.height=Vt=H=t,Qt=$t=0,Sn(),Cn();let n=r.bbox;on=n.left=zt(Qt*k,.5),cn=n.top=zt($t*k,.5),ln=n.width=zt(V*k,.5),un=n.height=zt(H*k,.5)}function bn(){let e=!1,t=0;for(;!e;){t++;let n=ei(t),i=ti(t);e=t==3||n&&i,e||(vn(r.width,r.height),fn=!0)}}function xn({width:e,height:t}){_n(e,t)}r.setSize=xn;function Sn(){let e=!1,t=!1,n=!1,r=!1;y.forEach((i,a)=>{if(i.show&&i._show){let{side:a,_size:o}=i,s=a%2,c=o+(i.label==null?0:i.labelSize);c>0&&(s?(V-=c,a==3?(Qt+=c,r=!0):n=!0):(H-=c,a==0?($t+=c,e=!0):t=!0))}}),Gn[0]=e,Gn[1]=n,Gn[2]=t,Gn[3]=r,V-=$n[1]+$n[3],Qt+=$n[3],H-=$n[2]+$n[0],$t+=$n[0]}function Cn(){let e=Qt+V,t=$t+H,n=Qt,r=$t;function i(i,a){switch(i){case 1:return e+=a,e-a;case 2:return t+=a,t-a;case 3:return n-=a,n+a;case 0:return r-=a,r+a}}y.forEach((e,t)=>{if(e.show&&e._show){let t=e.side;e._pos=i(t,e._size),e.label!=null&&(e._lpos=i(t,e.labelSize))}})}if(M.dataIdx==null){let e=M.hover,n=e.skip=new Set(e.skip??[]);n.add(void 0);let r=e.prox=z(e.prox),i=e.bias??=0;M.dataIdx=(e,a,o,s)=>{if(a==0)return o;let c=o,l=r(e,a,o,s)??R,u=l>=0&&l<R,d=D.ori==0?V:H,f=M.left,p=t[0],m=t[a];if(n.has(m[o])){c=null;let e=null,t=null,r;if(i==0||i==-1)for(r=o;e==null&&r-- >0;)n.has(m[r])||(e=r);if(i==0||i==1)for(r=o;t==null&&r++<m.length;)n.has(m[r])||(t=r);if(e!=null||t!=null)if(u){let n=e==null?-1/0:Pe(p[e],D,d,0),r=t==null?1/0:Pe(p[t],D,d,0),i=f-n,a=r-f;i<=a?i<=l&&(c=e):a<=l&&(c=t)}else c=t==null?e:e==null?t:o-e<=t-o?e:t}else u&&I(f-Pe(p[o],D,d,0))>l&&(c=null);return c}}let wn=e=>{M.event=e};M.idxs=Qe,M._lock=!1;let W=M.points;W.show=z(W.show),W.size=z(W.size),W.stroke=z(W.stroke),W.width=z(W.width),W.fill=z(W.fill);let Dn=r.focus=U({},e.focus||{alpha:.3},M.focus),On=Dn.prox>=0,kn=On&&W.one,An=[],jn=[],Mn=[];function Nn(e,t){let n=W.show(r,t);if(n instanceof HTMLElement)return He(n,de),He(n,e.class),qe(n,-10,-10,V,H),m.insertBefore(n,An[t]),n}function Pn(e,t){if(i==1||t>0){let t=i==1&&b[e.scale].time,n=e.value;e.value=t?Yt(n)?Jn(Be,Kn(n,Ve)):n||Xe:n||Er,e.label=e.label||(t?pr:fr)}if(kn||t>0){e.width=e.width==null?1:e.width,e.paths=e.paths||yi||Pt,e.fillTo=z(e.fillTo||Ur),e.pxAlign=+P(e.pxAlign,h),e.pxRound=Jr(e.pxAlign),e.stroke=z(e.stroke||null),e.fill=z(e.fill||null),e._stroke=e._fill=e._paths=e._focus=null;let t=Or(xt(1,e.width),1),n=e.points=U({},{size:t,width:xt(1,t*.2),stroke:e.stroke,space:t*2,paths:bi,_stroke:null,_fill:null},e.points);n.show=z(n.show),n.filter=z(n.filter),n.fill=z(n.fill),n.stroke=z(n.stroke),n.paths=z(n.paths),n.pxAlign=e.pxAlign}if(nt){let n=jt(e,t);mt.splice(t,0,n[0]),ht.splice(t,0,n[1]),j.values.push(null)}if(rt){Qe.splice(t,0,null);let n=null;kn?t==0&&(n=Nn(e,t)):t>0&&(n=Nn(e,t)),An.splice(t,0,n),jn.splice(t,0,0),Mn.splice(t,0,0)}Oa(`addSeries`,t)}function G(e,t){t??=v.length,e=i==1?Ci(e,t,mr,Nr):Ci(e,t,{},Mr),v.splice(t,0,e),Pn(v[t],t)}r.addSeries=G;function Fn(e){if(v.splice(e,1),nt){j.values.splice(e,1),ht.splice(e,1);let t=mt.splice(e,1)[0];Rt(null,t.firstChild),t.remove()}rt&&(Qe.splice(e,1),An.splice(e,1)[0].remove(),jn.splice(e,1),Mn.splice(e,1)),Oa(`delSeries`,e)}r.delSeries=Fn;let Gn=[!1,!1,!1,!1];function Yn(e,t){if(e._show=e.show,e.show){let n=e.side%2,i=b[e.scale];i??=(e.scale=n?v[1].scale:S,b[e.scale]);let a=i.time;e.size=z(e.size),e.space=z(e.space),e.rotate=z(e.rotate),qt(e.incrs)&&e.incrs.forEach(e=>{!Ht.has(e)&&Ht.set(e,Ut(e))}),e.incrs=z(e.incrs||(i.distr==2?Tn:a?_==1?In:zn:En)),e.splits=z(e.splits||(a&&i.distr==1?Ke:i.distr==3?_r:i.distr==4?vr:gr)),e.stroke=z(e.stroke),e.grid.stroke=z(e.grid.stroke),e.ticks.stroke=z(e.ticks.stroke),e.border.stroke=z(e.border.stroke);let o=e.values;e.values=qt(o)&&!qt(o[0])?z(o):a?qt(o)?Un(Be,Hn(o,Ve)):Yt(o)?Wn(Be,o):o||Je:o||hr,e.filter=z(e.filter||(i.distr>=3&&i.log==10?wr:i.distr==3&&i.log==2?Tr:Nt)),e.font=Mi(e.font),e.labelFont=Mi(e.labelFont),e._size=e.size(r,null,t,0),e._space=e._rotate=e._incrs=e._found=e._splits=e._values=null,e._size>0&&(Gn[t]=!0,e._el=Ge(oe,f))}}function Xn(e,t,n,r){let[i,a,o,s]=n,c=t%2,l=0;return c==0&&(s||a)&&(l=t==0&&!i||t==2&&!o?L(dr.size/3):0),c==1&&(i||o)&&(l=t==1&&!a||t==3&&!s?L(Dr.size/2):0),l}let Qn=r.padding=(e.padding||[Xn,Xn,Xn,Xn]).map(e=>z(P(e,Xn))),$n=r._padding=Qn.map((e,t)=>e(r,t,Gn,0)),K,q=null,J=null,er=i==1?v[0].idxs:null,tr=null,nr=!1;function ir(e,n){if(t=e??[],r.data=r._data=t,i==2){K=0;for(let e=1;e<v.length;e++)K+=t[e][0].length}else{t.length==0&&(r.data=r._data=t=[[]]),tr=t[0],K=tr.length;let e=t;if(Ne==2){e=t.slice();let n=e[0]=Array(K);for(let e=0;e<K;e++)n[e]=e}r._data=t=e}if(ri(!0),Oa(`setData`),Ne==2&&(pn=!0),n!==!1){let e=D;e.auto(r,nr)?ar():Wi(S,e.min,e.max),mn||=M.left>=0,gn=!0,ci()}}r.setData=ir;function ar(){nr=!0;let e,n;i==1&&(K>0?(q=er[0]=0,J=er[1]=K-1,e=t[0][q],n=t[0][J],Ne==2?(e=q,n=J):e==n&&(Ne==3?[e,n]=ot(e,e,D.log,!1):Ne==4?[e,n]=st(e,e,D.log,!1):D.time?n=e+L(86400/_):[e,n]=ft(e,n,ct,!0))):(q=er[0]=e=null,J=er[1]=n=null)),Wi(S,e,n)}let or,sr,cr,lr,ur,yr,br,xr,Sr,Cr;function kr(e,t,n,r,i,a){e??=Ee,n??=Gt,r??=`butt`,i??=Ee,a??=`round`,e!=or&&(d.strokeStyle=or=e),i!=sr&&(d.fillStyle=sr=i),t!=cr&&(d.lineWidth=cr=t),a!=ur&&(d.lineJoin=ur=a),r!=yr&&(d.lineCap=yr=r),n!=lr&&d.setLineDash(lr=n)}function Ar(e,t,n,r){t!=sr&&(d.fillStyle=sr=t),e!=br&&(d.font=br=e),n!=xr&&(d.textAlign=xr=n),r!=Sr&&(d.textBaseline=Sr=r)}function jr(e,t,n,i,a=0){if(i.length>0&&e.auto(r,nr)&&(t==null||t.min==null)){let t=P(q,0),r=P(J,i.length-1),o=n.min==null?at(i,t,r,a,e.distr==3):[n.min,n.max];e.min=bt(e.min,n.min=o[0]),e.max=xt(e.max,n.max=o[1])}}let Lr={min:null,max:null};function Vr(){for(let e in b){let t=b[e];O[e]==null&&(t.min==null||O[S]!=null&&t.auto(r,nr))&&(O[e]=Lr)}for(let e in b){let t=b[e];O[e]==null&&t.from!=null&&O[t.from]!=null&&(O[e]=Lr)}O[S]!=null&&ri(!0);let e={};for(let t in O){let n=O[t];if(n!=null){let a=e[t]=en(b[t],Zt);if(n.min!=null)U(a,n);else if(t!=S||i==2)if(K==0&&a.from==null){let e=a.range(r,null,null,t);a.min=e[0],a.max=e[1]}else a.min=R,a.max=-1/0}}if(K>0){v.forEach((n,a)=>{if(i==1){let i=n.scale,o=O[i];if(o==null)return;let s=e[i];if(a==0){let e=s.range(r,s.min,s.max,i);s.min=e[0],s.max=e[1],q=tt(s.min,t[0]),J=tt(s.max,t[0]),J-q>1&&(t[0][q]<s.min&&q++,t[0][J]>s.max&&J--),n.min=tr[q],n.max=tr[J]}else n.show&&n.auto&&jr(s,o,n,t[a],n.sorted);n.idxs[0]=q,n.idxs[1]=J}else if(a>0&&n.show&&n.auto){let[r,i]=n.facets,o=r.scale,s=i.scale,[c,l]=t[a],u=e[o],d=e[s];u!=null&&jr(u,O[o],r,c,r.sorted),d!=null&&jr(d,O[s],i,l,i.sorted),n.min=i.min,n.max=i.max}});for(let t in e){let n=e[t],i=O[t];if(n.from==null&&(i==null||i.min==null)){let e=n.range(r,n.min==R?null:n.min,n.max==-1/0?null:n.max,t);n.min=e[0],n.max=e[1]}}}for(let t in e){let n=e[t];if(n.from!=null){let i=e[n.from];if(i.min==null)n.min=n.max=null;else{let e=n.range(r,i.min,i.max,t);n.min=e[0],n.max=e[1]}}}let n={},a=!1;for(let t in e){let r=e[t],i=b[t];if(i.min!=r.min||i.max!=r.max){i.min=r.min,i.max=r.max;let e=i.distr;i._min=e==3?wt(i.min):e==4?Dt(i.min,i.asinh):e==100?i.fwd(i.min):i.min,i._max=e==3?wt(i.max):e==4?Dt(i.max,i.asinh):e==100?i.fwd(i.max):i.max,n[t]=a=!0}}if(a){v.forEach((e,t)=>{i==2?t>0&&n.y&&(e._paths=null):n[e.scale]&&(e._paths=null)});for(let e in n)pn=!0,Oa(`setScale`,e);rt&&M.left>=0&&(mn=gn=!0)}for(let e in O)O[e]=null}function Hr(e){let t=kt(q-1,0,K-1),n=kt(J+1,0,K-1);for(;e[t]==null&&t>0;)t--;for(;e[n]==null&&n<K-1;)n++;return[t,n]}function Wr(){if(K>0){let e=v.some(e=>e._focus)&&Cr!=Dn.alpha;e&&(d.globalAlpha=Cr=Dn.alpha),v.forEach((e,n)=>{if(n>0&&e.show&&(Gr(n,!1),Gr(n,!0),e._paths==null)){let a=Cr;Cr!=e.alpha&&(d.globalAlpha=Cr=e.alpha);let o=i==2?[0,t[n][0].length-1]:Hr(t[n]);e._paths=e.paths(r,n,o[0],o[1]),Cr!=a&&(d.globalAlpha=Cr=a)}}),v.forEach((e,t)=>{if(t>0&&e.show){let n=Cr;Cr!=e.alpha&&(d.globalAlpha=Cr=e.alpha),e._paths!=null&&Kr(t,!1);{let n=e._paths==null?null:e._paths.gaps,i=e.points.show(r,t,q,J,n),a=e.points.filter(r,t,i,n);(i||a)&&(e.points._paths=e.points.paths(r,t,q,J,a),Kr(t,!0))}Cr!=n&&(d.globalAlpha=Cr=n),Oa(`drawSeries`,t)}}),e&&(d.globalAlpha=Cr=1)}}function Gr(e,t){let n=t?v[e].points:v[e];n._stroke=n.stroke(r,e),n._fill=n.fill(r,e)}function Kr(e,t){let n=t?v[e].points:v[e],{stroke:r,fill:i,clip:a,flags:o,_stroke:s=n._stroke,_fill:c=n._fill,_width:l=n.width}=n._paths;l=B(l*k,3);let u=null,f=l%2/2;t&&c==null&&(c=l>0?`#fff`:s);let p=n.pxAlign==1&&f>0;if(p&&d.translate(f,f),!t){let e=on-l/2,t=cn-l/2,n=ln+l,r=un+l;u=new Path2D,u.rect(e,t,n,r)}t?Yr(s,l,n.dash,n.cap,c,r,i,o,a):qr(e,s,l,n.dash,n.cap,c,r,i,o,u,a),p&&d.translate(-f,-f)}function qr(e,n,i,a,o,s,c,l,u,d,f){let p=!1;u!=0&&x.forEach((m,h)=>{if(m.series[0]==e){let e=v[m.series[1]],g=t[m.series[1]],_=(e._paths||Wt).band;qt(_)&&(_=m.dir==1?_[0]:_[1]);let y,b=null;e.show&&_&&pt(g,q,J)?(b=m.fill(r,h)||s,y=e._paths.clip):_=null,Yr(n,i,a,o,b,c,l,u,d,f,y,_),p=!0}}),p||Yr(n,i,a,o,s,c,l,u,d,f)}function Yr(e,t,n,r,i,a,o,s,c,l,u,f){kr(e,t,n,r,i),(c||l||f)&&(d.save(),c&&d.clip(c),l&&d.clip(l)),f?(s&3)==3?(d.clip(f),u&&d.clip(u),Zr(i,o),Xr(e,a,t)):s&Br?(Zr(i,o),d.clip(f),Xr(e,a,t)):s&zr&&(d.save(),d.clip(f),u&&d.clip(u),Zr(i,o),d.restore(),Xr(e,a,t)):(Zr(i,o),Xr(e,a,t)),(c||l||f)&&d.restore()}function Xr(e,t,n){n>0&&(t instanceof Map?t.forEach((e,t)=>{d.strokeStyle=or=t,d.stroke(e)}):t!=null&&e&&d.stroke(t))}function Zr(e,t){t instanceof Map?t.forEach((e,t)=>{d.fillStyle=sr=t,d.fill(e)}):t!=null&&e&&d.fill(t)}function Qr(e,t,n,i){let a=y[e],o;if(i<=0)o=[0,0];else{let s=a._space=a.space(r,e,t,n,i);o=ji(t,n,a._incrs=a.incrs(r,e,t,n,i,s),i,s)}return a._found=o}function $r(e,t,n,r,i,a,o,s,c,l){let u=o%2/2;h==1&&d.translate(u,u),kr(s,o,c,l,s),d.beginPath();let f,p,m,g,_=i+(r==0||r==3?-a:a);n==0?(p=i,g=_):(f=i,m=_);for(let r=0;r<e.length;r++)t[r]!=null&&(n==0?f=m=e[r]:p=g=e[r],d.moveTo(f,p),d.lineTo(m,g));d.stroke(),h==1&&d.translate(-u,-u)}function ei(e){let t=!0;return y.forEach((n,i)=>{if(!n.show)return;let a=b[n.scale];if(a.min==null){n._show&&(t=!1,n._show=!1,ri(!1));return}else n._show||(t=!1,n._show=!0,ri(!1));let o=n.side,s=o%2,{min:c,max:l}=a,[u,d]=Qr(i,c,l,s==0?V:H);if(d==0)return;let f=a.distr==2,p=n._splits=n.splits(r,i,c,l,u,d,f),m=a.distr==2?p.map(e=>tr[e]):p,h=a.distr==2?tr[p[1]]-tr[p[0]]:u,g=n._values=n.values(r,n.filter(r,m,i,d,h),i,d,h);n._rotate=o==2?n.rotate(r,g,i,d):0;let _=n._size;n._size=yt(n.size(r,g,i,e)),_!=null&&n._size!=_&&(t=!1)}),t}function ti(e){let t=!0;return Qn.forEach((n,i)=>{let a=n(r,i,Gn,e);a!=$n[i]&&(t=!1),$n[i]=a}),t}function ni(){for(let e=0;e<y.length;e++){let t=y[e];if(!t.show||!t._show)continue;let n=t.side,i=n%2,a,o,c=t.stroke(r,e),l=n==0||n==3?-1:1,[u,f]=t._found;if(t.label!=null){let s=t.labelGap*l,p=L((t._lpos+s)*k);Ar(t.labelFont[0],c,`center`,n==2?xe:Se),d.save(),i==1?(a=o=0,d.translate(p,L(cn+un/2)),d.rotate((n==3?-_t:_t)/2)):(a=L(on+ln/2),o=p);let m=At(t.label)?t.label(r,e,u,f):t.label;d.fillText(m,a,o),d.restore()}if(f==0)continue;let p=b[t.scale],m=i==0?ln:un,h=i==0?on:cn,_=t._splits,v=p.distr==2?_.map(e=>tr[e]):_,x=p.distr==2?tr[_[1]]-tr[_[0]]:u,S=t.ticks,C=t.border,w=S.show?S.size:0,T=L(w*k),E=L((t.alignTo==2?t._size-w-t.gap:t.gap)*k),ee=t._rotate*-_t/180,te=g(t._pos*k),ne=te+(T+E)*l;o=i==0?ne:0,a=i==1?ne:0;let re=t.font[0];Ar(re,c,t.align==1?Ce:t.align==2?we:ee>0?Ce:ee<0?we:i==0?`center`:n==3?we:Ce,ee||i==1?`middle`:n==2?xe:Se);let ie=t.font[1]*t.lineGap,ae=_.map(e=>g(s(e,p,m,h))),oe=t._values;for(let e=0;e<oe.length;e++){let t=oe[e];if(t!=null){i==0?a=ae[e]:o=ae[e],t=``+t;let n=t.indexOf(`
10
- `)==-1?[t]:t.split(/\n/gm);for(let e=0;e<n.length;e++){let t=n[e];ee?(d.save(),d.translate(a,o+e*ie),d.rotate(ee),d.fillText(t,0,0),d.restore()):d.fillText(t,a,o+e*ie)}}}S.show&&$r(ae,S.filter(r,v,e,f,x),i,n,te,T,B(S.width*k,3),S.stroke(r,e),S.dash,S.cap);let se=t.grid;se.show&&$r(ae,se.filter(r,v,e,f,x),i,i==0?2:1,i==0?cn:on,i==0?un:ln,B(se.width*k,3),se.stroke(r,e),se.dash,se.cap),C.show&&$r([te],[1],+(i==0),i==0?1:2,i==1?cn:on,i==1?un:ln,B(C.width*k,3),C.stroke(r,e),C.dash,C.cap)}Oa(`drawAxes`)}function ri(e){v.forEach((t,n)=>{n>0&&(t._paths=null,e&&(i==1?(t.min=null,t.max=null):t.facets.forEach(e=>{e.min=null,e.max=null})))})}let ii=!1,ai=!1,oi=[];function si(){ai=!1;for(let e=0;e<oi.length;e++)Oa(...oi[e]);oi.length=0}function ci(){ii||=(sn(ui),!0)}function li(e,t=!1){ii=!0,ai=t,e(r),ui(),t&&oi.length>0&&queueMicrotask(si)}r.batch=li;function ui(){if(dn&&=(Vr(),!1),pn&&=(bn(),!1),fn){if(A(p,Ce,Qt),A(p,xe,$t),A(p,ye,V),A(p,be,H),A(m,Ce,Qt),A(m,xe,$t),A(m,ye,V),A(m,be,H),A(f,ye,Bt),A(f,be,Vt),u.width=L(Bt*k),u.height=L(Vt*k),y.forEach(({_el:e,_show:t,_size:n,_pos:r,side:i})=>{if(e!=null)if(t){let t=i===3||i===0?n:0,a=i%2==1;A(e,a?`left`:`top`,r-t),A(e,a?`width`:`height`,n),A(e,a?`top`:`left`,a?$t:Qt),A(e,a?`height`:`width`,a?H:V),Ue(e,se)}else He(e,se)}),or=sr=cr=ur=yr=br=xr=Sr=lr=null,Cr=1,fa(!0),Qt!=tn||$t!=nn||V!=rn||H!=an){ri(!1);let e=V/rn,t=H/an;if(rt&&!mn&&M.left>=0){M.left*=e,M.top*=t,mi&&qe(mi,L(M.left),0,V,H),hi&&qe(hi,0,L(M.top),V,H);for(let n=0;n<An.length;n++){let r=An[n];r!=null&&(jn[n]*=e,Mn[n]*=t,qe(r,yt(jn[n]),yt(Mn[n]),V,H))}}if(Q.show&&!hn&&Q.left>=0&&Q.width>0){Q.left*=e,Q.width*=e,Q.top*=t,Q.height*=t;for(let e in ha)A(Vi,e,Q[e])}tn=Qt,nn=$t,rn=V,an=H}Oa(`setSize`),fn=!1}Bt>0&&Vt>0&&(d.clearRect(0,0,u.width,u.height),Oa(`drawClear`),w.forEach(e=>e()),Oa(`draw`)),Q.show&&hn&&(Hi(Q),hn=!1),rt&&mn&&(ua(null,!0,!1),mn=!1),j.show&&j.live&&gn&&(ca(),gn=!1),c||(c=!0,r.status=1,Oa(`ready`)),nr=!1,ii=!1}r.redraw=(e,t)=>{pn=t||!1,e===!1?ci():Wi(S,D.min,D.max)};function di(e,n){let i=b[e];if(i.from==null){if(K==0){let t=i.range(r,n.min,n.max,e);n.min=t[0],n.max=t[1]}if(n.min>n.max){let e=n.min;n.min=n.max,n.max=e}if(K>1&&n.min!=null&&n.max!=null&&n.max-n.min<1e-16)return;e==S&&i.distr==2&&K>0&&(n.min=tt(n.min,t[0]),n.max=tt(n.max,t[0]),n.min==n.max&&n.max++),O[e]=n,dn=!0,ci()}}r.setScale=di;let fi,pi,mi,hi,gi,vi,Y,Pi,Fi,Ii,X,Z,Li=!1,Ri=M.drag,zi=Ri.x,Bi=Ri.y;rt&&(M.x&&(fi=Ge(le,m)),M.y&&(pi=Ge(ue,m)),D.ori==0?(mi=fi,hi=pi):(mi=pi,hi=fi),X=M.left,Z=M.top);let Q=r.select=U({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),Vi=Q.show?Ge(ce,Q.over?m:p):null;function Hi(e,t){if(Q.show){for(let t in e)Q[t]=e[t],t in ha&&A(Vi,t,e[t]);t!==!1&&Oa(`setSelect`)}}r.setSelect=Hi;function Ui(e){if(v[e].show)nt&&Ue(mt[e],se);else if(nt&&He(mt[e],se),rt){let t=kn?An[0]:An[e];t!=null&&qe(t,-10,-10,V,H)}}function Wi(e,t,n){di(e,{min:t,max:n})}function Gi(e,t,n,a){t.focus!=null&&ea(e),t.show!=null&&v.forEach((n,r)=>{r>0&&(e==r||e==null)&&(n.show=t.show,Ui(r),i==2?(Wi(n.facets[0].scale,null,null),Wi(n.facets[1].scale,null,null)):Wi(n.scale,null,null),ci())}),n!==!1&&Oa(`setSeries`,e,t),a&&Ma(`setSeries`,r,e,t)}r.setSeries=Gi;function Ki(e,t){U(x[e],t)}function qi(e,t){e.fill=z(e.fill||null),e.dir=P(e.dir,-1),t??=x.length,x.splice(t,0,e)}function Ji(e){e==null?x.length=0:x.splice(e,1)}r.addBand=qi,r.setBand=Ki,r.delBand=Ji;function Yi(e,t){v[e].alpha=t,rt&&An[e]!=null&&(An[e].style.opacity=t),nt&&mt[e]&&(mt[e].style.opacity=t)}let Xi,Zi,Qi,$i={focus:!0};function ea(e){if(e!=Qi){let t=e==null,n=Dn.alpha!=1;v.forEach((r,a)=>{if(i==1||a>0){let i=t||a==0||a==e;r._focus=t?null:i,n&&Yi(a,i?1:Dn.alpha)}}),Qi=e,n&&ci()}}nt&&On&&Lt(je,it,e=>{M._lock||(wn(e),Qi!=null&&Gi(null,$i,!0,$.setSeries))});function ta(e,t,n){let r=b[t];n&&(e=e/k-(r.ori==1?$t:Qt));let i=V;r.ori==1&&(i=H,e=i-e),r.dir==-1&&(e=i-e);let a=r._min,o=r._max,s=e/i,c=a+(o-a)*s,l=r.distr;return l==3?St(10,c):l==4?Et(c,r.asinh):l==100?r.bwd(c):c}function na(e,n){return tt(ta(e,S,n),t[0],q,J)}r.valToIdx=e=>tt(e,t[0]),r.posToIdx=na,r.posToVal=ta,r.valToPos=(e,t,n)=>b[t].ori==0?a(e,b[t],n?ln:V,n?on:0):o(e,b[t],n?un:H,n?cn:0),r.setCursor=(e,t,n)=>{X=e.left,Z=e.top,ua(null,t,n)};function ra(e,t){A(Vi,Ce,Q.left=e),A(Vi,ye,Q.width=t)}function ia(e,t){A(Vi,xe,Q.top=e),A(Vi,be,Q.height=t)}let aa=D.ori==0?ra:ia,oa=D.ori==1?ra:ia;function sa(){if(nt&&j.live)for(let e=+(i==2);e<v.length;e++){if(e==0&&F)continue;let t=j.values[e],n=0;for(let r in t)ht[e][n++].firstChild.nodeValue=t[r]}}function ca(e,t){if(e!=null&&(e.idxs?e.idxs.forEach((e,t)=>{Qe[t]=e}):Jt(e.idx)||Qe.fill(e.idx),j.idx=Qe[0]),nt&&j.live){for(let e=0;e<v.length;e++)(e>0||i==1&&!F)&&la(e,Qe[e]);sa()}gn=!1,t!==!1&&Oa(`setLegend`)}r.setLegend=ca;function la(e,n){let i=v[e],a=e==0&&Ne==2?tr:t[e],o;F?o=i.values(r,e,n)??vt:(o=i.value(r,n==null?null:a[n],e,n),o=o==null?vt:{_:o}),j.values[e]=o}function ua(e,n,a){Fi=X,Ii=Z,[X,Z]=M.move(r,X,Z),M.left=X,M.top=Z,rt&&(mi&&qe(mi,L(X),0,V,H),hi&&qe(hi,0,L(Z),V,H));let o,s=q>J;Xi=R,Zi=null;let c=D.ori==0?V:H,l=D.ori==1?V:H;if(X<0||K==0||s){o=M.idx=null;for(let e=0;e<v.length;e++){let t=An[e];t!=null&&qe(t,-10,-10,V,H)}On&&Gi(null,$i,!0,e==null&&$.setSeries),j.live&&(Qe.fill(o),gn=!0)}else{let e,n,a;i==1&&(e=D.ori==0?X:Z,n=ta(e,S),o=M.idx=tt(n,t[0],q,J),a=Pe(t[0][o],D,c,0));let s=-10,u=-10,d=0,f=0,p=!0,m=``,h=``;for(let e=+(i==2);e<v.length;e++){let g=v[e],_=Qe[e],y=_==null?null:i==1?t[e][_]:t[e][1][_],x=M.dataIdx(r,e,o,n),S=x==null?null:i==1?t[e][x]:t[e][1][x];if(gn=gn||S!=y||x!=_,Qe[e]=x,e>0&&g.show){let n=x==null?-10:x==o?a:Pe(i==1?t[0][x]:t[e][0][x],D,c,0),_=S==null?-10:Le(S,i==1?b[g.scale]:b[g.facets[1].scale],l,0);if(On&&S!=null){let t=D.ori==1?X:Z,n=I(Dn.dist(r,e,x,_,t));if(n<Xi){let r=Dn.bias;if(r!=0){let i=ta(t,g.scale),a=S>=0?1:-1,o=i>=0?1:-1;o==a&&(o==1?r==1?S>=i:S<=i:r==1?S<=i:S>=i)&&(Xi=n,Zi=e)}else Xi=n,Zi=e}}if(gn||kn){let t,i;D.ori==0?(t=n,i=_):(t=_,i=n);let a,o,c,l,g,v,y=!0,b=W.bbox;if(b!=null){y=!1;let t=b(r,e);c=t.left,l=t.top,a=t.width,o=t.height}else c=t,l=i,a=o=W.size(r,e);if(v=W.fill(r,e),g=W.stroke(r,e),kn)e==Zi&&Xi<=Dn.prox&&(s=c,u=l,d=a,f=o,p=y,m=v,h=g);else{let t=An[e];t!=null&&(jn[e]=c,Mn[e]=l,Ze(t,a,o,y),Ye(t,v,g),qe(t,yt(c),yt(l),V,H))}}}}if(kn){let e=Dn.prox;if(gn||(Qi==null?Xi<=e:Xi>e||Zi!=Qi)){let e=An[0];e!=null&&(jn[0]=s,Mn[0]=u,Ze(e,d,f,p),Ye(e,m,h),qe(e,yt(s),yt(u),V,H))}}}if(Q.show&&Li)if(e!=null){let[t,n]=$.scales,[r,i]=$.match,[a,o]=e.cursor.sync.scales,s=e.cursor.drag;if(zi=s._x,Bi=s._y,zi||Bi){let{left:s,top:u,width:d,height:f}=e.select,p=e.scales[a].ori,m=e.posToVal,h,g,_,v,y,x=t!=null&&r(t,a),S=n!=null&&i(n,o);x&&zi?(p==0?(h=s,g=d):(h=u,g=f),_=b[t],v=Pe(m(h,a),_,c,0),y=Pe(m(h+g,a),_,c,0),aa(bt(v,y),I(y-v))):aa(0,c),S&&Bi?(p==1?(h=s,g=d):(h=u,g=f),_=b[n],v=Le(m(h,o),_,l,0),y=Le(m(h+g,o),_,l,0),oa(bt(v,y),I(y-v))):oa(0,l)}else ga()}else{let e=I(Fi-gi),t=I(Ii-vi);if(D.ori==1){let n=e;e=t,t=n}zi=Ri.x&&e>=Ri.dist,Bi=Ri.y&&t>=Ri.dist;let n=Ri.uni;n==null?Ri.x&&Ri.y&&(zi||Bi)&&(zi=Bi=!0):zi&&Bi&&(zi=e>=n,Bi=t>=n,!zi&&!Bi&&(t>e?Bi=!0:zi=!0));let r,i;zi&&(D.ori==0?(r=Y,i=X):(r=Pi,i=Z),aa(bt(r,i),I(i-r)),Bi||oa(0,l)),Bi&&(D.ori==1?(r=Y,i=X):(r=Pi,i=Z),oa(bt(r,i),I(i-r)),zi||aa(0,c)),!zi&&!Bi&&(aa(0,0),oa(0,0))}if(Ri._x=zi,Ri._y=Bi,e==null){if(a){if(Aa!=null){let[e,t]=$.scales;$.values[0]=e==null?null:ta(D.ori==0?X:Z,e),$.values[1]=t==null?null:ta(D.ori==1?X:Z,t)}Ma(De,r,X,Z,V,H,o)}if(On){let e=a&&$.setSeries,t=Dn.prox;Qi==null?Xi<=t&&Gi(Zi,$i,!0,e):Xi>t?Gi(null,$i,!0,e):Zi!=Qi&&Gi(Zi,$i,!0,e)}}gn&&(j.idx=o,ca()),n!==!1&&Oa(`setCursor`)}let da=null;Object.defineProperty(r,"rect",{get(){return da??fa(!1),da}});function fa(e=!1){e?da=null:(da=m.getBoundingClientRect(),Oa(`syncRect`,da))}function pa(e,t,n,r,i,a,o){M._lock||Li&&e!=null&&e.movementX==0&&e.movementY==0||(ma(e,t,n,r,i,a,o,!1,e!=null),e==null?ua(t,!0,!1):ua(null,!0,!0))}function ma(e,t,n,i,a,o,c,l,u){if(da??fa(!1),wn(e),e!=null)n=e.clientX-da.left,i=e.clientY-da.top;else{if(n<0||i<0){X=-10,Z=-10;return}let[e,r]=$.scales,c=t.cursor.sync,[l,u]=c.values,[d,f]=c.scales,[p,m]=$.match,h=t.axes[0].side%2==1,g=D.ori==0?V:H,_=D.ori==1?V:H,v=h?o:a,y=h?a:o,x=h?i:n,S=h?n:i;if(n=d==null?x/v*g:p(e,d)?s(l,b[e],g,0):-10,i=f==null?S/y*_:m(r,f)?s(u,b[r],_,0):-10,D.ori==1){let e=n;n=i,i=e}}u&&(t==null||t.cursor.event.type==De)&&((n<=1||n>=V-1)&&(n=zt(n,V)),(i<=1||i>=H-1)&&(i=zt(i,H))),l?(gi=n,vi=i,[Y,Pi]=M.move(r,n,i)):(X=n,Z=i)}let ha={width:0,height:0,left:0,top:0};function ga(){Hi(ha,!1)}let _a,va,ya,ba;function xa(e,t,n,i,a,o,s){Li=!0,zi=Bi=Ri._x=Ri._y=!1,ma(e,t,n,i,a,o,s,!0,!1),e!=null&&(Lt(ke,Re,Sa,!1),Ma(Oe,r,Y,Pi,V,H,null));let{left:c,top:l,width:u,height:d}=Q;_a=c,va=l,ya=u,ba=d}function Sa(e,t,n,i,a,o,s){Li=Ri._x=Ri._y=!1,ma(e,t,n,i,a,o,s,!1,!0);let{left:c,top:l,width:u,height:d}=Q,f=u>0||d>0,p=_a!=c||va!=l||ya!=u||ba!=d;if(f&&p&&Hi(Q),Ri.setScale&&f&&p){let e=c,t=u,n=l,r=d;if(D.ori==1&&(e=l,t=d,n=c,r=u),zi&&Wi(S,ta(e,S),ta(e+t,S)),Bi)for(let e in b){let t=b[e];e!=S&&t.from==null&&t.min!=R&&Wi(e,ta(n+r,e),ta(n,e))}ga()}else M.lock&&(M._lock=!M._lock,ua(t,!0,e!=null));e!=null&&(Rt(ke,Re),Ma(ke,r,X,Z,V,H,null))}function Ca(e,t,n,r,i,a,o){if(M._lock)return;wn(e);let s=Li;if(Li){let e=!0,t=!0,n,r;D.ori==0?(n=zi,r=Bi):(n=Bi,r=zi),n&&r&&(e=X<=10||X>=V-10,t=Z<=10||Z>=H-10),n&&e&&(X=X<Y?0:V),r&&t&&(Z=Z<Pi?0:H),ua(null,!0,!0),Li=!1}X=-10,Z=-10,Qe.fill(null),ua(null,!0,!0),s&&(Li=s)}function wa(e,t,n,i,a,o,s){M._lock||(wn(e),ar(),ga(),e!=null&&Ma(Me,r,X,Z,V,H,null))}function Ta(){y.forEach(Ni),_n(r.width,r.height,!0)}$e(Fe,ze,Ta);let Ea={};Ea.mousedown=xa,Ea.mousemove=pa,Ea.mouseup=Sa,Ea.dblclick=wa,Ea.setSeries=(e,t,n,i)=>{let a=$.match[2];n=a(r,t,n),n!=-1&&Gi(n,i,!0,!1)},rt&&(Lt(Oe,m,xa),Lt(De,m,pa),Lt(Ae,m,e=>{wn(e),fa(!1)}),Lt(je,m,Ca),Lt(Me,m,wa),_i.add(r),r.syncRect=fa);let Da=r.hooks=e.hooks||{};function Oa(e,t,n){ai?oi.push([e,t,n]):e in Da&&Da[e].forEach(e=>{e.call(null,r,t,n)})}(e.plugins||[]).forEach(e=>{for(let t in e.hooks)Da[t]=(Da[t]||[]).concat(e.hooks[t])});let ka=(e,t,n)=>n,$=U({key:null,setSeries:!1,filters:{pub:Ft,sub:Ft},scales:[S,v[1]?v[1].scale:null],match:[It,It,ka],values:[null,null]},M.sync);$.match.length==2&&$.match.push(ka),M.sync=$;let Aa=$.key,ja=Rr(Aa);function Ma(e,t,n,r,i,a,o){$.filters.pub(e,t,n,r,i,a,o)&&ja.pub(e,t,n,r,i,a,o)}ja.sub(r);function Na(e,t,n,r,i,a,o){$.filters.sub(e,t,n,r,i,a,o)&&Ea[e](null,t,n,r,i,a,o)}r.pub=Na;function Pa(){ja.unsub(r),_i.delete(r),Mt.clear(),et(Fe,ze,Ta),l.remove(),it?.remove(),Oa(`destroy`)}r.destroy=Pa;function Fa(){Oa(`init`,e,t),ir(t||e.data,!1),O[S]?di(S,O[S]):ar(),hn=Q.show&&(Q.width>0||Q.height>0),mn=gn=!0,_n(e.width,e.height)}return v.forEach(Pn),y.forEach(Yn),n?n instanceof HTMLElement?(n.appendChild(l),Fa()):n(r,Fa):Fa(),r}Y.assign=U,Y.fmtNum=gt,Y.rangeNum=ft,Y.rangeLog=ot,Y.rangeAsinh=st,Y.orient=Vr,Y.pxRatio=k,Y.join=on,Y.fmtDate=yn,Y.tzDate=xn,Y.sync=Rr;{Y.addGap=Kr,Y.clipGaps=Gr;let e=Y.paths={points:oi};e.linear=ui,e.stepped=di,e.bars=pi,e.spline=hi}var Pi=x(`<div class="trend-chart svelte-1tp75kj"></div>`);function Fi(e,n){r(n,!0);let i=a(void 0),s=a(void 0);function c(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||`#888`}function l(e,t){let r={stroke:()=>c(`--text-muted`),grid:{stroke:()=>c(`--border`),width:1},ticks:{stroke:()=>c(`--border`),width:1}};return new Y({width:t,height:120,scales:{x:{time:!0}},series:[{},{stroke:()=>c(`--accent`),width:2,spanGaps:!1,points:{show:!1}}],axes:[r,{...r,size:52}],legend:{show:!1},cursor:{show:!1}},[n.times,n.values],e)}C(()=>{let e=w(i);if(!e)return;S(s,l(e,e.clientWidth||280));let t=new ResizeObserver(()=>{w(s)&&e.clientWidth>0&&w(s).setSize({width:e.clientWidth,height:120})});return t.observe(e),()=>{t.disconnect(),w(s)?.destroy(),S(s,void 0)}}),C(()=>{w(s)?.setData([n.times,n.values])}),C(()=>{n.theme,w(s)?.redraw(!1,!0)});var d=Pi();u(d,e=>S(i,e),()=>w(i)),o(e,d),t()}var Ii=x(`<p class="muted-note">No samples for this instrument yet.</p>`),X=x(`<section class="svelte-9vkdzs"><div class="head svelte-9vkdzs"><span class="caps-label"> </span> <span class="latest svelte-9vkdzs"><b class="svelte-9vkdzs"> </b> </span></div> <!></section>`),Z=x(`<div class="trend-charts svelte-9vkdzs"></div>`);function Li(a,u){r(u,!0);let x=n(()=>({depth:{convert:e=>u.mode===`imperial`?g(e):e,unit:p(u.mode),digits:1},wind:{convert:e=>s(e),unit:`kn`,digits:1},pressure:{convert:e=>l(e,u.mode),unit:y(u.mode),digits:u.mode===`imperial`?2:0},sog:{convert:e=>s(e),unit:`kn`,digits:1}}));function S(e,t){return e.values.map(e=>e==null?null:t.convert(e)??null)}let C=n(()=>b.map(e=>{let t=w(x)[e.key],n=u.history?.get(e.key)??u.sessionSeries(e.key),r=S(n,t),i=null;for(let e=r.length-1;e>=0;e--){let t=r[e];if(t!=null){i=t;break}}return{key:e.key,label:e.label,unit:t.unit,times:n.times,values:r,latest:i==null?`--`:v(i,t.digits)}})),T=e=>e.values.some(e=>e!=null);var E=Z();h(E,21,()=>w(C),e=>e.key,(t,r)=>{var a=X(),s=i(a),l=i(s),p=i(l,!0);m(l);var h=e(l,2),g=i(h),v=i(g,!0);m(g);var y=e(g);m(h),m(s);var b=e(s,2),x=e=>{Fi(e,{get times(){return w(r).times},get values(){return w(r).values},get theme(){return u.theme}})},S=n(()=>T(w(r))),C=e=>{o(e,Ii())};f(b,e=>{w(S)?e(x):e(C,-1)}),m(a),c(()=>{_(a,`aria-label`,`${w(r).label??``} trend`),d(p,w(r).label),d(v,w(r).latest),d(y,` ${w(r).unit??``}`)}),o(t,a)}),m(E),o(a,E),t()}export{Li as default};
10
+ `)==-1?[t]:t.split(/\n/gm);for(let e=0;e<n.length;e++){let t=n[e];ee?(d.save(),d.translate(a,o+e*ie),d.rotate(ee),d.fillText(t,0,0),d.restore()):d.fillText(t,a,o+e*ie)}}}S.show&&$r(ae,S.filter(r,v,e,f,x),i,n,te,T,B(S.width*k,3),S.stroke(r,e),S.dash,S.cap);let se=t.grid;se.show&&$r(ae,se.filter(r,v,e,f,x),i,i==0?2:1,i==0?cn:on,i==0?un:ln,B(se.width*k,3),se.stroke(r,e),se.dash,se.cap),C.show&&$r([te],[1],+(i==0),i==0?1:2,i==1?cn:on,i==1?un:ln,B(C.width*k,3),C.stroke(r,e),C.dash,C.cap)}Oa(`drawAxes`)}function ri(e){v.forEach((t,n)=>{n>0&&(t._paths=null,e&&(i==1?(t.min=null,t.max=null):t.facets.forEach(e=>{e.min=null,e.max=null})))})}let ii=!1,ai=!1,oi=[];function si(){ai=!1;for(let e=0;e<oi.length;e++)Oa(...oi[e]);oi.length=0}function ci(){ii||=(sn(ui),!0)}function li(e,t=!1){ii=!0,ai=t,e(r),ui(),t&&oi.length>0&&queueMicrotask(si)}r.batch=li;function ui(){if(dn&&=(Vr(),!1),pn&&=(bn(),!1),fn){if(A(p,Ce,Qt),A(p,xe,$t),A(p,ye,V),A(p,be,H),A(m,Ce,Qt),A(m,xe,$t),A(m,ye,V),A(m,be,H),A(f,ye,Bt),A(f,be,Vt),u.width=L(Bt*k),u.height=L(Vt*k),y.forEach(({_el:e,_show:t,_size:n,_pos:r,side:i})=>{if(e!=null)if(t){let t=i===3||i===0?n:0,a=i%2==1;A(e,a?`left`:`top`,r-t),A(e,a?`width`:`height`,n),A(e,a?`top`:`left`,a?$t:Qt),A(e,a?`height`:`width`,a?H:V),Ue(e,se)}else He(e,se)}),or=sr=cr=ur=yr=br=xr=Sr=lr=null,Cr=1,fa(!0),Qt!=tn||$t!=nn||V!=rn||H!=an){ri(!1);let e=V/rn,t=H/an;if(rt&&!mn&&M.left>=0){M.left*=e,M.top*=t,mi&&qe(mi,L(M.left),0,V,H),hi&&qe(hi,0,L(M.top),V,H);for(let n=0;n<An.length;n++){let r=An[n];r!=null&&(jn[n]*=e,Mn[n]*=t,qe(r,yt(jn[n]),yt(Mn[n]),V,H))}}if(Q.show&&!hn&&Q.left>=0&&Q.width>0){Q.left*=e,Q.width*=e,Q.top*=t,Q.height*=t;for(let e in ha)A(Vi,e,Q[e])}tn=Qt,nn=$t,rn=V,an=H}Oa(`setSize`),fn=!1}Bt>0&&Vt>0&&(d.clearRect(0,0,u.width,u.height),Oa(`drawClear`),w.forEach(e=>e()),Oa(`draw`)),Q.show&&hn&&(Hi(Q),hn=!1),rt&&mn&&(ua(null,!0,!1),mn=!1),j.show&&j.live&&gn&&(ca(),gn=!1),c||(c=!0,r.status=1,Oa(`ready`)),nr=!1,ii=!1}r.redraw=(e,t)=>{pn=t||!1,e===!1?ci():Wi(S,D.min,D.max)};function di(e,n){let i=b[e];if(i.from==null){if(K==0){let t=i.range(r,n.min,n.max,e);n.min=t[0],n.max=t[1]}if(n.min>n.max){let e=n.min;n.min=n.max,n.max=e}if(K>1&&n.min!=null&&n.max!=null&&n.max-n.min<1e-16)return;e==S&&i.distr==2&&K>0&&(n.min=tt(n.min,t[0]),n.max=tt(n.max,t[0]),n.min==n.max&&n.max++),O[e]=n,dn=!0,ci()}}r.setScale=di;let fi,pi,mi,hi,gi,vi,Y,Pi,Fi,Ii,X,Z,Li=!1,Ri=M.drag,zi=Ri.x,Bi=Ri.y;rt&&(M.x&&(fi=Ge(le,m)),M.y&&(pi=Ge(ue,m)),D.ori==0?(mi=fi,hi=pi):(mi=pi,hi=fi),X=M.left,Z=M.top);let Q=r.select=U({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),Vi=Q.show?Ge(ce,Q.over?m:p):null;function Hi(e,t){if(Q.show){for(let t in e)Q[t]=e[t],t in ha&&A(Vi,t,e[t]);t!==!1&&Oa(`setSelect`)}}r.setSelect=Hi;function Ui(e){if(v[e].show)nt&&Ue(mt[e],se);else if(nt&&He(mt[e],se),rt){let t=kn?An[0]:An[e];t!=null&&qe(t,-10,-10,V,H)}}function Wi(e,t,n){di(e,{min:t,max:n})}function Gi(e,t,n,a){t.focus!=null&&ea(e),t.show!=null&&v.forEach((n,r)=>{r>0&&(e==r||e==null)&&(n.show=t.show,Ui(r),i==2?(Wi(n.facets[0].scale,null,null),Wi(n.facets[1].scale,null,null)):Wi(n.scale,null,null),ci())}),n!==!1&&Oa(`setSeries`,e,t),a&&Ma(`setSeries`,r,e,t)}r.setSeries=Gi;function Ki(e,t){U(x[e],t)}function qi(e,t){e.fill=z(e.fill||null),e.dir=P(e.dir,-1),t??=x.length,x.splice(t,0,e)}function Ji(e){e==null?x.length=0:x.splice(e,1)}r.addBand=qi,r.setBand=Ki,r.delBand=Ji;function Yi(e,t){v[e].alpha=t,rt&&An[e]!=null&&(An[e].style.opacity=t),nt&&mt[e]&&(mt[e].style.opacity=t)}let Xi,Zi,Qi,$i={focus:!0};function ea(e){if(e!=Qi){let t=e==null,n=Dn.alpha!=1;v.forEach((r,a)=>{if(i==1||a>0){let i=t||a==0||a==e;r._focus=t?null:i,n&&Yi(a,i?1:Dn.alpha)}}),Qi=e,n&&ci()}}nt&&On&&Lt(je,it,e=>{M._lock||(wn(e),Qi!=null&&Gi(null,$i,!0,$.setSeries))});function ta(e,t,n){let r=b[t];n&&(e=e/k-(r.ori==1?$t:Qt));let i=V;r.ori==1&&(i=H,e=i-e),r.dir==-1&&(e=i-e);let a=r._min,o=r._max,s=e/i,c=a+(o-a)*s,l=r.distr;return l==3?St(10,c):l==4?Et(c,r.asinh):l==100?r.bwd(c):c}function na(e,n){return tt(ta(e,S,n),t[0],q,J)}r.valToIdx=e=>tt(e,t[0]),r.posToIdx=na,r.posToVal=ta,r.valToPos=(e,t,n)=>b[t].ori==0?a(e,b[t],n?ln:V,n?on:0):o(e,b[t],n?un:H,n?cn:0),r.setCursor=(e,t,n)=>{X=e.left,Z=e.top,ua(null,t,n)};function ra(e,t){A(Vi,Ce,Q.left=e),A(Vi,ye,Q.width=t)}function ia(e,t){A(Vi,xe,Q.top=e),A(Vi,be,Q.height=t)}let aa=D.ori==0?ra:ia,oa=D.ori==1?ra:ia;function sa(){if(nt&&j.live)for(let e=+(i==2);e<v.length;e++){if(e==0&&F)continue;let t=j.values[e],n=0;for(let r in t)ht[e][n++].firstChild.nodeValue=t[r]}}function ca(e,t){if(e!=null&&(e.idxs?e.idxs.forEach((e,t)=>{Qe[t]=e}):Jt(e.idx)||Qe.fill(e.idx),j.idx=Qe[0]),nt&&j.live){for(let e=0;e<v.length;e++)(e>0||i==1&&!F)&&la(e,Qe[e]);sa()}gn=!1,t!==!1&&Oa(`setLegend`)}r.setLegend=ca;function la(e,n){let i=v[e],a=e==0&&Ne==2?tr:t[e],o;F?o=i.values(r,e,n)??vt:(o=i.value(r,n==null?null:a[n],e,n),o=o==null?vt:{_:o}),j.values[e]=o}function ua(e,n,a){Fi=X,Ii=Z,[X,Z]=M.move(r,X,Z),M.left=X,M.top=Z,rt&&(mi&&qe(mi,L(X),0,V,H),hi&&qe(hi,0,L(Z),V,H));let o,s=q>J;Xi=R,Zi=null;let c=D.ori==0?V:H,l=D.ori==1?V:H;if(X<0||K==0||s){o=M.idx=null;for(let e=0;e<v.length;e++){let t=An[e];t!=null&&qe(t,-10,-10,V,H)}On&&Gi(null,$i,!0,e==null&&$.setSeries),j.live&&(Qe.fill(o),gn=!0)}else{let e,n,a;i==1&&(e=D.ori==0?X:Z,n=ta(e,S),o=M.idx=tt(n,t[0],q,J),a=Pe(t[0][o],D,c,0));let s=-10,u=-10,d=0,f=0,p=!0,m=``,h=``;for(let e=+(i==2);e<v.length;e++){let g=v[e],_=Qe[e],y=_==null?null:i==1?t[e][_]:t[e][1][_],x=M.dataIdx(r,e,o,n),S=x==null?null:i==1?t[e][x]:t[e][1][x];if(gn=gn||S!=y||x!=_,Qe[e]=x,e>0&&g.show){let n=x==null?-10:x==o?a:Pe(i==1?t[0][x]:t[e][0][x],D,c,0),_=S==null?-10:Le(S,i==1?b[g.scale]:b[g.facets[1].scale],l,0);if(On&&S!=null){let t=D.ori==1?X:Z,n=I(Dn.dist(r,e,x,_,t));if(n<Xi){let r=Dn.bias;if(r!=0){let i=ta(t,g.scale),a=S>=0?1:-1,o=i>=0?1:-1;o==a&&(o==1?r==1?S>=i:S<=i:r==1?S<=i:S>=i)&&(Xi=n,Zi=e)}else Xi=n,Zi=e}}if(gn||kn){let t,i;D.ori==0?(t=n,i=_):(t=_,i=n);let a,o,c,l,g,v,y=!0,b=W.bbox;if(b!=null){y=!1;let t=b(r,e);c=t.left,l=t.top,a=t.width,o=t.height}else c=t,l=i,a=o=W.size(r,e);if(v=W.fill(r,e),g=W.stroke(r,e),kn)e==Zi&&Xi<=Dn.prox&&(s=c,u=l,d=a,f=o,p=y,m=v,h=g);else{let t=An[e];t!=null&&(jn[e]=c,Mn[e]=l,Ze(t,a,o,y),Ye(t,v,g),qe(t,yt(c),yt(l),V,H))}}}}if(kn){let e=Dn.prox;if(gn||(Qi==null?Xi<=e:Xi>e||Zi!=Qi)){let e=An[0];e!=null&&(jn[0]=s,Mn[0]=u,Ze(e,d,f,p),Ye(e,m,h),qe(e,yt(s),yt(u),V,H))}}}if(Q.show&&Li)if(e!=null){let[t,n]=$.scales,[r,i]=$.match,[a,o]=e.cursor.sync.scales,s=e.cursor.drag;if(zi=s._x,Bi=s._y,zi||Bi){let{left:s,top:u,width:d,height:f}=e.select,p=e.scales[a].ori,m=e.posToVal,h,g,_,v,y,x=t!=null&&r(t,a),S=n!=null&&i(n,o);x&&zi?(p==0?(h=s,g=d):(h=u,g=f),_=b[t],v=Pe(m(h,a),_,c,0),y=Pe(m(h+g,a),_,c,0),aa(bt(v,y),I(y-v))):aa(0,c),S&&Bi?(p==1?(h=s,g=d):(h=u,g=f),_=b[n],v=Le(m(h,o),_,l,0),y=Le(m(h+g,o),_,l,0),oa(bt(v,y),I(y-v))):oa(0,l)}else ga()}else{let e=I(Fi-gi),t=I(Ii-vi);if(D.ori==1){let n=e;e=t,t=n}zi=Ri.x&&e>=Ri.dist,Bi=Ri.y&&t>=Ri.dist;let n=Ri.uni;n==null?Ri.x&&Ri.y&&(zi||Bi)&&(zi=Bi=!0):zi&&Bi&&(zi=e>=n,Bi=t>=n,!zi&&!Bi&&(t>e?Bi=!0:zi=!0));let r,i;zi&&(D.ori==0?(r=Y,i=X):(r=Pi,i=Z),aa(bt(r,i),I(i-r)),Bi||oa(0,l)),Bi&&(D.ori==1?(r=Y,i=X):(r=Pi,i=Z),oa(bt(r,i),I(i-r)),zi||aa(0,c)),!zi&&!Bi&&(aa(0,0),oa(0,0))}if(Ri._x=zi,Ri._y=Bi,e==null){if(a){if(Aa!=null){let[e,t]=$.scales;$.values[0]=e==null?null:ta(D.ori==0?X:Z,e),$.values[1]=t==null?null:ta(D.ori==1?X:Z,t)}Ma(De,r,X,Z,V,H,o)}if(On){let e=a&&$.setSeries,t=Dn.prox;Qi==null?Xi<=t&&Gi(Zi,$i,!0,e):Xi>t?Gi(null,$i,!0,e):Zi!=Qi&&Gi(Zi,$i,!0,e)}}gn&&(j.idx=o,ca()),n!==!1&&Oa(`setCursor`)}let da=null;Object.defineProperty(r,"rect",{get(){return da??fa(!1),da}});function fa(e=!1){e?da=null:(da=m.getBoundingClientRect(),Oa(`syncRect`,da))}function pa(e,t,n,r,i,a,o){M._lock||Li&&e!=null&&e.movementX==0&&e.movementY==0||(ma(e,t,n,r,i,a,o,!1,e!=null),e==null?ua(t,!0,!1):ua(null,!0,!0))}function ma(e,t,n,i,a,o,c,l,u){if(da??fa(!1),wn(e),e!=null)n=e.clientX-da.left,i=e.clientY-da.top;else{if(n<0||i<0){X=-10,Z=-10;return}let[e,r]=$.scales,c=t.cursor.sync,[l,u]=c.values,[d,f]=c.scales,[p,m]=$.match,h=t.axes[0].side%2==1,g=D.ori==0?V:H,_=D.ori==1?V:H,v=h?o:a,y=h?a:o,x=h?i:n,S=h?n:i;if(n=d==null?x/v*g:p(e,d)?s(l,b[e],g,0):-10,i=f==null?S/y*_:m(r,f)?s(u,b[r],_,0):-10,D.ori==1){let e=n;n=i,i=e}}u&&(t==null||t.cursor.event.type==De)&&((n<=1||n>=V-1)&&(n=zt(n,V)),(i<=1||i>=H-1)&&(i=zt(i,H))),l?(gi=n,vi=i,[Y,Pi]=M.move(r,n,i)):(X=n,Z=i)}let ha={width:0,height:0,left:0,top:0};function ga(){Hi(ha,!1)}let _a,va,ya,ba;function xa(e,t,n,i,a,o,s){Li=!0,zi=Bi=Ri._x=Ri._y=!1,ma(e,t,n,i,a,o,s,!0,!1),e!=null&&(Lt(ke,Re,Sa,!1),Ma(Oe,r,Y,Pi,V,H,null));let{left:c,top:l,width:u,height:d}=Q;_a=c,va=l,ya=u,ba=d}function Sa(e,t,n,i,a,o,s){Li=Ri._x=Ri._y=!1,ma(e,t,n,i,a,o,s,!1,!0);let{left:c,top:l,width:u,height:d}=Q,f=u>0||d>0,p=_a!=c||va!=l||ya!=u||ba!=d;if(f&&p&&Hi(Q),Ri.setScale&&f&&p){let e=c,t=u,n=l,r=d;if(D.ori==1&&(e=l,t=d,n=c,r=u),zi&&Wi(S,ta(e,S),ta(e+t,S)),Bi)for(let e in b){let t=b[e];e!=S&&t.from==null&&t.min!=R&&Wi(e,ta(n+r,e),ta(n,e))}ga()}else M.lock&&(M._lock=!M._lock,ua(t,!0,e!=null));e!=null&&(Rt(ke,Re),Ma(ke,r,X,Z,V,H,null))}function Ca(e,t,n,r,i,a,o){if(M._lock)return;wn(e);let s=Li;if(Li){let e=!0,t=!0,n,r;D.ori==0?(n=zi,r=Bi):(n=Bi,r=zi),n&&r&&(e=X<=10||X>=V-10,t=Z<=10||Z>=H-10),n&&e&&(X=X<Y?0:V),r&&t&&(Z=Z<Pi?0:H),ua(null,!0,!0),Li=!1}X=-10,Z=-10,Qe.fill(null),ua(null,!0,!0),s&&(Li=s)}function wa(e,t,n,i,a,o,s){M._lock||(wn(e),ar(),ga(),e!=null&&Ma(Me,r,X,Z,V,H,null))}function Ta(){y.forEach(Ni),_n(r.width,r.height,!0)}$e(Fe,ze,Ta);let Ea={};Ea.mousedown=xa,Ea.mousemove=pa,Ea.mouseup=Sa,Ea.dblclick=wa,Ea.setSeries=(e,t,n,i)=>{let a=$.match[2];n=a(r,t,n),n!=-1&&Gi(n,i,!0,!1)},rt&&(Lt(Oe,m,xa),Lt(De,m,pa),Lt(Ae,m,e=>{wn(e),fa(!1)}),Lt(je,m,Ca),Lt(Me,m,wa),_i.add(r),r.syncRect=fa);let Da=r.hooks=e.hooks||{};function Oa(e,t,n){ai?oi.push([e,t,n]):e in Da&&Da[e].forEach(e=>{e.call(null,r,t,n)})}(e.plugins||[]).forEach(e=>{for(let t in e.hooks)Da[t]=(Da[t]||[]).concat(e.hooks[t])});let ka=(e,t,n)=>n,$=U({key:null,setSeries:!1,filters:{pub:Ft,sub:Ft},scales:[S,v[1]?v[1].scale:null],match:[It,It,ka],values:[null,null]},M.sync);$.match.length==2&&$.match.push(ka),M.sync=$;let Aa=$.key,ja=Rr(Aa);function Ma(e,t,n,r,i,a,o){$.filters.pub(e,t,n,r,i,a,o)&&ja.pub(e,t,n,r,i,a,o)}ja.sub(r);function Na(e,t,n,r,i,a,o){$.filters.sub(e,t,n,r,i,a,o)&&Ea[e](null,t,n,r,i,a,o)}r.pub=Na;function Pa(){ja.unsub(r),_i.delete(r),Mt.clear(),et(Fe,ze,Ta),l.remove(),it?.remove(),Oa(`destroy`)}r.destroy=Pa;function Fa(){Oa(`init`,e,t),ir(t||e.data,!1),O[S]?di(S,O[S]):ar(),hn=Q.show&&(Q.width>0||Q.height>0),mn=gn=!0,_n(e.width,e.height)}return v.forEach(Pn),y.forEach(Yn),n?n instanceof HTMLElement?(n.appendChild(l),Fa()):n(r,Fa):Fa(),r}Y.assign=U,Y.fmtNum=gt,Y.rangeNum=ft,Y.rangeLog=ot,Y.rangeAsinh=st,Y.orient=Vr,Y.pxRatio=k,Y.join=on,Y.fmtDate=yn,Y.tzDate=xn,Y.sync=Rr;{Y.addGap=Kr,Y.clipGaps=Gr;let e=Y.paths={points:oi};e.linear=ui,e.stepped=di,e.bars=pi,e.spline=hi}var Pi=w(`<div class="trend-chart svelte-1tp75kj"></div>`);function Fi(e,t){m(t,!0);let n=r(void 0),s=r(void 0);function c(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||`#888`}function u(e,n){let r={stroke:()=>c(`--text-muted`),grid:{stroke:()=>c(`--border`),width:1},ticks:{stroke:()=>c(`--border`),width:1}};return new Y({width:n,height:120,scales:{x:{time:!0}},series:[{},{stroke:()=>c(`--accent`),width:2,spanGaps:!1,points:{show:!1}}],axes:[r,{...r,size:52}],legend:{show:!1},cursor:{show:!1}},[t.times,t.values],e)}a(()=>{let e=l(n);if(!e)return;o(s,u(e,e.clientWidth||280));let t=new ResizeObserver(()=>{l(s)&&e.clientWidth>0&&l(s).setSize({width:e.clientWidth,height:120})});return t.observe(e),()=>{t.disconnect(),l(s)?.destroy(),o(s,void 0)}}),a(()=>{l(s)?.setData([t.times,t.values])}),a(()=>{t.theme,l(s)?.redraw(!1,!0)});var d=Pi();_(d,e=>o(n,e),()=>l(n)),x(e,d),i()}var Ii=w(`<p class="muted-note">No samples for this instrument yet.</p>`),X=w(`<section class="svelte-9vkdzs"><div class="head svelte-9vkdzs"><span class="caps-label"> </span> <span class="latest svelte-9vkdzs"><b class="svelte-9vkdzs"> </b> </span></div> <!></section>`),Z=w(`<div class="trend-charts svelte-9vkdzs"></div>`);function Li(r,a){m(a,!0);let o=n(()=>({depth:{convert:e=>a.mode===`imperial`?g(e):e,unit:p(a.mode),digits:1},wind:{convert:e=>c(e),unit:`kn`,digits:1},pressure:{convert:e=>u(e,a.mode),unit:y(a.mode),digits:a.mode===`imperial`?2:0},sog:{convert:e=>c(e),unit:`kn`,digits:1}}));function _(e,t){return e.values.map(e=>e==null?null:t.convert(e)??null)}let w=n(()=>b.map(e=>{let t=l(o)[e.key],n=a.history?.get(e.key)??a.sessionSeries(e.key),r=_(n,t),i=null;for(let e=r.length-1;e>=0;e--){let t=r[e];if(t!=null){i=t;break}}return{key:e.key,label:e.label,unit:t.unit,times:n.times,values:r,latest:i==null?`--`:v(i,t.digits)}})),T=e=>e.values.some(e=>e!=null);var E=Z();f(E,21,()=>l(w),e=>e.key,(r,i)=>{var o=X(),c=t(o),u=t(c),f=t(u,!0);e(u);var p=S(u,2),m=t(p),g=t(m,!0);e(m);var _=S(m);e(p),e(c);var v=S(c,2),y=e=>{Fi(e,{get times(){return l(i).times},get values(){return l(i).values},get theme(){return a.theme}})},b=n(()=>T(l(i))),w=e=>{x(e,Ii())};d(v,e=>{l(b)?e(y):e(w,-1)}),e(o),C(()=>{h(o,`aria-label`,`${l(i).label??``} trend`),s(f,l(i).label),s(g,l(i).latest),s(_,` ${l(i).unit??``}`)}),x(r,o)}),e(E),x(r,E),i()}export{Li as default};