expressive-charts 0.9.0 → 0.11.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.
- package/CHANGELOG.md +28 -0
- package/README.md +9 -9
- package/dist/drawing-OmQV-0BB.d.ts +1 -2
- package/dist/effect-HCWnmB72.d.ts +1 -2
- package/dist/expressive-charts.global.js +6 -6
- package/dist/expressive-charts.global.js.map +1 -1
- package/dist/icons/sport.d.cts +2 -3
- package/dist/icons/sport.d.ts +1 -2
- package/dist/index-CmnxlWkB.d.cts +752 -0
- package/dist/index.cjs +449 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -295
- package/dist/index.d.ts +85 -13
- package/dist/index.js +449 -106
- package/dist/index.js.map +1 -1
- package/dist/runner-C87v9F_y.d.cts +1 -0
- package/dist/testing.d.cts +3 -4
- package/dist/testing.d.ts +1 -2
- package/package.json +10 -8
- package/dist/drawing-OmQV-0BB.d.cts +0 -220
- package/dist/effect-DYCLY_6e.d.cts +0 -256
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ExpressiveCharts=(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=globalThis.reportError;typeof t==`function`?t(e):console.error(e)}function n(e=i()){let n=new Set,r,a=()=>{!r&&n.size>0&&(r=e.request(o))},o=e=>{r=void 0;for(let r of[...n])if(n.has(r))try{r(e)}catch(e){t(e)}a()};return{now:()=>e.now(),onFrame(e){let t=t=>e(t);return n.add(t),a(),()=>{n.delete(t)&&n.size===0&&r&&(r(),r=void 0)}}}}function r(e=0){let t=e,r,i=n({now:()=>t,request(e){return r=e,()=>{r===e&&(r=void 0)}}});return{now:i.now,onFrame:i.onFrame,get idle(){return r===void 0},advance(e){if(!(e>=0))throw RangeError(`manualClock.advance needs a non-negative number of ms, got ${e}`);t+=e;let n=r;r=void 0,n?.(t)}}}function i(){let e=()=>typeof performance<`u`?performance.now():Date.now();return{now:e,request(t){if(typeof requestAnimationFrame==`function`){let e=requestAnimationFrame(t);return()=>cancelAnimationFrame(e)}let n=setTimeout(()=>t(e()),16);return()=>clearTimeout(n)}}}let a=n(),o=e=>e,s=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,c=e=>1-(1-e)**3;function l(e){return e<.5?Math.cbrt(e/4):1-Math.cbrt(2*(1-e))/2}let u={presentation:{feedback:{factor:1},transition:{factor:1},effect:{factor:1},playback:{factor:1},stagger:{factor:1}},analysis:{feedback:{factor:1},transition:{factor:.35,max:200},effect:{factor:.35,min:140,max:300},playback:{factor:.3},stagger:{factor:0}}},d=[`presentation`,`analysis`,`off`],f=[`feedback`,`transition`,`effect`,`playback`,`stagger`];function p(e={}){let n=g(e.mode??`presentation`),r,i=_(e.scaling),a=e.reducedMotion??h(),o=new Set,s,c=()=>r??(a.matches?`off`:n),l=()=>{for(let e of[...o])if(o.has(e))try{e()}catch(e){t(e)}};return{get mode(){return c()},get staged(){return c()===`presentation`},get requested(){return n},get viewerChoice(){return r},get prefersReduced(){return a.matches},duration(e,t=`transition`){let n=c();return n===`off`?0:m(e,i[n][t])},setMode(e){g(e),e!==n&&(n=e,l())},chooseMode(e){g(e),e!==r&&(r=e,l())},clearChoice(){r!==void 0&&(r=void 0,l())},subscribe(e){let t=()=>e();return o.add(t),s??(s=a.subscribe(l)),()=>{!o.delete(t)||o.size>0||(s?.(),s=void 0)}}}}function m(e,t){if(!(e>0))return 0;let n=Math.min(e,t.min??0),r=t.max??1/0;return Math.min(Math.max(e*t.factor,n),r)}function h(e=`(prefers-reduced-motion: reduce)`){let t,n=()=>{if(t===void 0)try{t=typeof matchMedia==`function`?matchMedia(e):null}catch{t=null}return t};return{get matches(){return n()?.matches??!1},subscribe(e){let t=n();if(!t)return()=>{};let r=()=>e();return typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))}}}function g(e){if(!d.includes(e))throw TypeError(`Unknown motion mode "${String(e)}". Use one of: ${d.join(`, `)}.`);return e}function _(e={}){let t=t=>{let n={...u[t]};for(let r of f){let i=e[t]?.[r];i&&(n[r]=i)}return n};return{presentation:t(`presentation`),analysis:t(`analysis`)}}let v=p();function y(e,t={}){let n=t.clock??a,r=t.motion??v,i=e.timing??`transition`,o=e.ease??s,c=r.duration(e.duration,i),l=e.delay?r.duration(e.delay,i):0,{update:u,signal:d}=e,f=n.now(),p=`running`,m,h,g=new Promise(e=>{h=e}),_=e=>{p=e,m?.(),m=void 0,d?.removeEventListener(`abort`,y),h(e)};function y(){p===`running`&&_(`cancelled`)}let b=!1;function x(){p!==`running`||b||(b=!0,S(1),p===`running`&&_(`done`))}function S(e){try{u(o(e))}catch(e){throw y(),e}}let C=e=>{if(r.mode===`off`){x();return}let t=e-f-l;t>=c?x():t>0&&S(t/c)},w={finished:g,get state(){return p},cancel:y,finish:x};return d?.aborted?(_(`cancelled`),w):(d?.addEventListener(`abort`,y,{once:!0}),c<=0&&l<=0?(x(),w):(S(0),p===`running`&&(m=n.onFrame(C)),w))}let b=(e,t)=>n=>e*(1-n)+t*n,x=(e,t)=>n=>({x:e.x*(1-n)+t.x*n,y:e.y*(1-n)+t.y*n});function S(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])];return r=>{if(r===1)return{...t};let i={};for(let a of n)i[a]=(e[a]??0)*(1-r)+(t[a]??0)*r;return i}}function C(e,t,n={}){let{onChange:r,...i}=n,a=e,o=e,l,u=!1,d=e=>{a=e,r?.(e)},f=()=>{let e=l;l=void 0,u=!1,e?.cancel()};return{get value(){return a},get target(){return l?.state===`cancelled`?a:o},get animating(){return l?.state===`running`},to(e,n){let r=l?.state===`running`&&u&&!(n.delay&&n.delay>0);f(),o=e;let p=t(a,e),m=!1,h=y({duration:n.duration,timing:n.timing,ease:n.ease??(r?c:s),delay:n.delay,signal:n.signal,update:e=>{m&&(u=!0),m=!0,d(p(e))}},i);return l=h,h.finished},set(e){f(),o=e,d(e)},stop(){f(),o=a}}}function w(e){T(e);let{from:n,to:r,duration:i,onFrame:l}=e,u=e.ease??o,d=e.timing??`playback`,f=e.clock??a,p=e.motion??v,m=Math.min(n,r),h=Math.max(n,r),g=r,_=!1,y=!1,b,x=0,S=new Set,C=e=>{for(let n of[...S])if(S.has(n))try{n(e)}catch(e){t(e)}},w=()=>{let e=b;return b=void 0,e?.stop(),e?.moved??!1},D=()=>{_&&(_=!1,C(`pause`))},O=e=>{throw x++,w(),D(),e},k=e=>{if(e!==g){g=e;try{l(e)}catch(e){O(e)}}},A=(e,t,n,r)=>{let i=x;if(!(t>0)){k(e),x===i&&r();return}let a=g,o=f.now(),s={moved:!1,stop:f.onFrame(c=>{let l=p.mode===`off`?1:(c-o)/t;if(l<1){s.moved=!0;let t;try{t=n(l)}catch(e){return O(e)}k(a+(e-a)*t)}else w(),k(e),x===i&&r()})};b=s},j=()=>{_=!1,C(`end`)};return{get position(){return g},get playing(){return _},play(){if(y||_)return;let e=++x;if(w(),_=!0,C(`play`),x!==e)return;let t=p.duration(i,d);t>0&&g===r&&(k(n),x!==e)||A(r,t*Math.abs(r-g)/Math.abs(r-n),u,j)},pause(){!y&&_&&(x++,w(),D())},seek(e,t={}){if(E(e,t),y)return;let n=++x,r=w();if(D(),x!==n||(C(`seek`),x!==n))return;let i=t.animate===!1?0:p.duration(350,`transition`);A(Math.min(Math.max(e,m),h),i,r?c:s,()=>{})},subscribe(e){if(typeof e!=`function`)throw TypeError(`playback.subscribe needs a function, got ${typeof e}.`);if(y)return()=>{};let t=t=>e(t);return S.add(t),()=>{S.delete(t)}},destroy(){y||(y=!0,x++,w(),D(),S.clear())}}}function T(e){if(typeof e!=`object`||!e)throw TypeError(`playback needs options: { from, to, duration, onFrame }.`);let{from:t,to:n,duration:r,ease:i,timing:a,onFrame:o,clock:s,motion:c}=e;for(let[e,r]of[[`from`,t],[`to`,n]])if(!D(r))throw RangeError(`playback: ${e} must be a finite number, got ${String(r)}.`);if(t===n)throw RangeError(`playback: from and to must differ, got ${t} for both.`);if(!D(r)||r<0)throw RangeError(`playback: duration must be a non-negative number of ms, got ${String(r)}.`);if(typeof o!=`function`)throw TypeError(`playback: onFrame must be a function, got ${typeof o}.`);if(i!==void 0&&typeof i!=`function`)throw TypeError(`playback: ease must be a function, got ${typeof i}.`);if(a!==void 0&&!f.includes(a))throw RangeError(`playback: timing must be one of ${f.join(`, `)}, got ${JSON.stringify(a)??String(a)}.`);if(s!==void 0&&(typeof s?.now!=`function`||typeof s.onFrame!=`function`))throw TypeError(`playback: clock must be a Clock, such as one from createClock() or manualClock().`);if(c!==void 0&&typeof c?.duration!=`function`)throw TypeError("playback: motion must be a Motion, such as the page-wide `motion` or one from createMotion().")}function E(e,t){if(!D(e))throw RangeError(`playback.seek needs a finite number, got ${String(e)}.`);if(typeof t!=`object`||!t)throw TypeError(`playback.seek's options must be an object, such as { animate: false }.`);if(t.animate!==void 0&&typeof t.animate!=`boolean`)throw TypeError(`playback.seek: animate must be true or false, got ${String(t.animate)}.`)}function D(e){return typeof e==`number`&&Number.isFinite(e)}let O=2*Math.PI;function k(e,t,n=0){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i);return{kind:`line`,from:e,to:t,length:a,angle:a>0?Math.atan2(i,r):P(n)}}function A(e,t,n,r){return{kind:`arc`,center:e,radius:t,start:n,sweep:r,length:t*Math.abs(r)}}function j(e,t){if(e.kind===`line`){let{from:n,to:r}=e;return{x:n.x*(1-t)+r.x*t,y:n.y*(1-t)+r.y*t}}return N(e.center,e.radius,e.start+e.sweep*t)}function M(e,t){if(e.kind===`line`)return e.angle;let n=e.sweep<0?-Math.PI/2:Math.PI/2;return P(e.start+e.sweep*t+n)}function N(e,t,n){return{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}}function P(e){return e-O*Math.ceil((e-Math.PI)/O)}function F(e){if(e.kind===`line`)return[e.from,e.to];let t=[j(e,0),j(e,1)];for(let n=0;n<4;n++){let r=n*Math.PI/2;ee(e,r)&&t.push(N(e.center,e.radius,r))}return t}function I(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let{x:a,y:o}of e)a<t&&(t=a),a>r&&(r=a),o<n&&(n=o),o>i&&(i=o);return{x:t,y:n,width:r-t,height:i-n}}function ee(e,t){let n=Math.abs(e.sweep);return n>=O||((e.sweep>=0?t-e.start:e.start-t)%O+O)%O<=n}function L(e){let t=Math.round(e*1e3)/1e3;return t===0?`0`:String(t)}function R(e){return`M${L(e.x)},${L(e.y)}`}function z(e,t=0,n=1){if(e.kind===`line`){let t=n===1?e.to:j(e,n);return`L${L(t.x)},${L(t.y)}`}let r=e.start+e.sweep*t,i=e.sweep*(n-t),a=Math.max(1,Math.ceil(Math.abs(i)/Math.PI-1e-9)),o=L(e.radius),s=+(i>=0),c=``;for(let t=1;t<=a;t++){let n=N(e.center,e.radius,r+i*t/a);c+=`A${o},${o} 0 0 ${s} ${L(n.x)},${L(n.y)}`}return c}function B(e,t=!1){let n=e[0];if(!n)return``;let r=e.length;if(t){for(;r>0&&e[r-1].length<=0;)r--;r>0&&e[r-1].kind===`line`&&r--}let i=R(j(n,0));for(let t=0;t<r;t++){let n=e[t];n.length>0&&(i+=z(n))}return t?`${i}Z`:i}let V=e=>e>0?e<1?e:1:0,te=Object.freeze([]);function H(e,t=te){let n=e[0],r=e[e.length-1];if(!n||!r)throw RangeError(`A walk needs at least one segment.`);let i=[0];for(let t of e)i.push(i[i.length-1]+t.length);let a=i[e.length],o=j(n,0),s=j(r,1),c=t=>{if(!(a>0))return{index:0,u:0};if(t>=a){let t=e.length-1;for(;t>0&&!(e[t].length>0);)t--;return{index:t,u:1}}let n=0,r=e.length-1;for(;n<r;){let e=n+r>>1;i[e+1]>t?r=e:n=e+1}return{index:n,u:Math.min(1,(t-i[n])/e[n].length)}},l=t=>{let n=V(t);if(n===0)return o;if(n===1)return s;let{index:r,u:i}=c(n*a);return j(e[r],i)},u=(t,n)=>{let r=R(l(t)),o=t*a,s=n*a;if(!(s>o))return r;let u=c(o);for(let t=u.index;t<e.length&&i[t]<s;t++){let n=e[t];if(!(n.length>0))continue;let a=t===u.index?u.u:0,o=i[t+1]>s?Math.min(1,(s-i[t])/n.length):1;o>a&&(r+=z(n,a,o))}return r},d=(e,n)=>{let r=V(Math.min(e,n)),i=V(Math.max(e,n));if(t.length===0)return u(r,i);let a=``,o=r;for(let[e,n]of t){if(e>=i)break;e>o&&(a+=u(o,e)),n>o&&(o=n)}return i>o&&(a+=u(o,i)),a===``?R(l(r)):a};return{segments:e,length:a,start:o,end:s,gaps:t,point:l,angle(t){let{index:n,u:r}=c(V(t)*a);return M(e[n],r)},slice:d,d:t.length===0?B(e):d(0,1)}}function ne(e){let t=e.map(e=>H(e));return{d:B(e.flat(),!0),closed:!0,sample(e){le(e,4);let n=e/4,r=[];for(let e of t)for(let t=0;t<n;t++)r.push(e.point(t/n));return r}}}function U(e){let t=e.map(e=>e.reduce((e,t)=>e+t.length,0)),n=0;t.forEach((e,r)=>{e>t[n]&&(n=r)});let r=re(e[n])<0,i=e.map(e=>r?ie(e):e),a=ae(i[n]),o=H(a);return{d:[a,...i.filter((e,t)=>t!==n)].map(e=>B(e,!0)).join(``),closed:!0,sample(e){le(e,4);let t=e/4,n=[];for(let e=0;e<4;e++)for(let r=0;r<t;r++)n.push(o.point(e/4+r/t/4));return n}}}function re(e){let t=0;for(let n of e){if(n.kind===`line`){t+=n.from.x*n.to.y-n.to.x*n.from.y;continue}let{center:e,radius:r,start:i,sweep:a}=n,o=i+a;t+=r*(e.x*(Math.sin(o)-Math.sin(i))-e.y*(Math.cos(o)-Math.cos(i)))+r*r*a}return t/2}function ie(e){return e.map(e=>e.kind===`line`?k(e.to,e.from):A(e.center,e.radius,e.start+e.sweep,-e.sweep)).reverse()}function ae(e){let t=0,n=0,r=1/0,i=1/0,a=(e,a,o)=>{let s=e.x+e.y;(s<r-1e-9||s<=r+1e-9&&e.y<i)&&([t,n,r,i]=[a,o,s,e.y])};e.forEach((e,t)=>{if(a(j(e,0),t,0),e.kind===`arc`){let n=((e.sweep>=0?se-e.start:e.start-se)%O+O)%O/Math.abs(e.sweep);n<1&&a(j(e,n),t,n)}});let[o,s]=oe(e[t],n);return[s,...e.slice(t+1),...e.slice(0,t),o].filter(e=>e.length>0)}function oe(e,t){if(e.kind===`line`){let n=j(e,t);return[k(e.from,n),k(n,e.to)]}let{center:n,radius:r,start:i,sweep:a}=e;return[A(n,r,i,a*t),A(n,r,i+a*t,a*(1-t))]}let se=-3*Math.PI/4;function ce(e){return{d:e.d,closed:!1,sample(t){if(le(t,1),t===1)return[e.start];let n=[];for(let r=0;r<t;r++)n.push(e.point(r/(t-1)));return n}}}function le(e,t){if(!Number.isInteger(e)||e<0||e%t!==0){let n=t===1?`a whole number ≥ 0`:`a whole multiple of ${t}`;throw RangeError(`outline.sample(n): n must be ${n}, got ${e}.`)}}function W({key:e,series:t,walk:n,thickness:r,outline:i,bounds:a,center:o,pivot:s,labelBounds:c,nearbyLabels:l,segments:u}){return{key:e,...t===void 0?{}:{series:t},start:n.start,end:n.end,length:n.length,path:e=>n.point(e),angle:e=>n.angle(e),slice:(e,t)=>n.slice(e,t),...n.gaps.length===0?{}:{gaps:n.gaps},thickness:r,outline:i,bounds:a,center:o,pivot:s,...c===void 0?{}:{labelBounds:c},...l===void 0?{}:{nearbyLabels:l},...u===void 0?{}:{segments:u}}}function ue(e,t,n){if(!Number.isFinite(n))throw RangeError(`describe.${e}: ${t} must be a finite number, got ${n}.`);return n}function de(e,t,n=`labelBounds`){if(!t)return t;for(let r=0;r<t.length;r++){let{x:i,y:a,width:o,height:s}=t[r];Number.isFinite(i)&&Number.isFinite(a)&&Number.isFinite(o)&&o>=0&&Number.isFinite(s)&&s>=0||(ue(e,`${n}[${r}].x`,i),ue(e,`${n}[${r}].y`,a),fe(e,`${n}[${r}].width`,o),fe(e,`${n}[${r}].height`,s))}return t}function fe(e,t,n){if(!(Number.isFinite(n)&&n>=0))throw RangeError(`describe.${e}: ${t} must be a finite number ≥ 0, got ${n}.`);return n}function pe(e){let{key:t,series:n}=e,r={x:ue(`arc`,`cx`,e.cx),y:ue(`arc`,`cy`,e.cy)},i=Math.min(fe(`arc`,`inner`,e.inner),fe(`arc`,`outer`,e.outer)),a=Math.max(e.inner,e.outer);ue(`arc`,`start`,e.start),ue(`arc`,`end`,e.end);let o=Math.max(-O,Math.min(O,e.end-e.start)),s=e.start-Math.PI/2,c=s+o,[l,u]=o>=0?[a,i]:[i,a],d=[[A(r,l,s,o)],[k(N(r,l,c),N(r,u,c),c+(l>u?Math.PI:0))],[A(r,u,c,-o)],[k(N(r,u,s),N(r,l,s),s+(l>u?0:Math.PI))]],f=H([A(r,(i+a)/2,s,o)]);return W({key:t,series:n,walk:f,thickness:a-i,outline:ne(d),bounds:I(d.flat().flatMap(F)),center:f.point(.5),pivot:r,labelBounds:de(`arc`,e.labelBounds),nearbyLabels:de(`arc`,e.nearbyLabels,`nearbyLabels`)})}let me={left:0,right:Math.PI,top:Math.PI/2,bottom:-Math.PI/2};function he(e){let{key:t,series:n,baseline:r,x:i,y:a,width:o,height:s}=e;if(!Object.prototype.hasOwnProperty.call(me,r))throw RangeError(`describe.bar: baseline must be left, right, top or bottom, got ${String(r)}.`);ue(`bar`,`x`,i),ue(`bar`,`y`,a),fe(`bar`,`width`,o),fe(`bar`,`height`,s);let c=fe(`bar`,`radius`,e.radius??0),l=fe(`bar`,`gap`,e.gap??0),u=de(`bar`,e.labelBounds),d=de(`bar`,e.nearbyLabels,`nearbyLabels`),f=r===`left`||r===`right`,p=f?o:s,m=f?s:o,h=m,g=me[r],_=ge(e),v=(e,t,n,r)=>{let i=Math.max(0,Math.min(n,t-e,h/2)),a=ne([[k(_(e,0),_(t-i,0),g)],i>0?[A(_(t-i,i),i,g-Math.PI/2,Math.PI/2),k(_(t,i),_(t,h-i),g+Math.PI/2),A(_(t-i,h-i),i,g,Math.PI/2)]:[k(_(t,0),_(t,h),g+Math.PI/2)],[k(_(t-i,h),_(e,h),g+Math.PI)],[k(_(e,h),_(e,0),g-Math.PI/2)]]),o=H([k(_(e,h/2),_(t,h/2),g)]);return W({...r,walk:o,thickness:m,outline:a,bounds:r.bounds??I([_(e,0),_(t,h)]),center:_((e+t)/2,h/2),pivot:o.start})},y=e.segments??[{series:n,size:p}],b=new Set,x=0,S=y.map((e,n)=>{if(fe(`bar`,`segments[${n}].size`,e.size),e.series!==void 0){if(b.has(e.series))throw Error(`describe.bar: series "${e.series}" appears twice in the segments of "${t}".`);b.add(e.series)}let r=Math.min(x,p);x+=e.size;let i=Math.min(x,p);return{segment:e,index:n,p0:Math.min(r+Math.min(l,r),i),p1:i}}).map(({segment:e,index:n,p0:r,p1:i})=>v(r,i,c-(p-i),{key:e.series===void 0?`${t}/${n}`:`${t}/${e.series}`,series:e.series}));return v(0,p,c,{key:t,series:n,bounds:{x:i,y:a,width:o,height:s},labelBounds:u,nearbyLabels:d,segments:S})}function ge({x:e,y:t,width:n,height:r,baseline:i}){switch(i){case`left`:return(n,r)=>({x:e+n,y:t+r});case`right`:return(i,a)=>({x:e+n-i,y:t+r-a});case`top`:return(r,i)=>({x:e+n-i,y:t+r});case`bottom`:return(n,i)=>({x:e+i,y:t+r-n})}}function _e(e){let{key:t,series:n,points:r}=e,i=fe(`line`,`width`,e.width??1),a=r[0];if(!a)throw RangeError(`describe.line: "${t}" needs at least one point.`);r.forEach((e,t)=>{ue(`line`,`points[${t}].x`,e.x),ue(`line`,`points[${t}].y`,e.y)});let o=ye(e.breaks,r.length),s=[];for(let e=1;e<r.length;e++)s.push(k(r[e-1],r[e],s[s.length-1]?.angle??0));s.length===0&&s.push(k(a,a));let c=H(s,ve(o,s)),l=I(r),u=i/2;return W({key:t,series:n,walk:c,thickness:i,outline:ce(c),bounds:{x:l.x-u,y:l.y-u,width:l.width+i,height:l.height+i},center:c.point(.5),pivot:a,labelBounds:de(`line`,e.labelBounds),nearbyLabels:de(`line`,e.nearbyLabels,`nearbyLabels`)})}function ve(e,t){let n=[0];for(let e of t)n.push(n[n.length-1]+e.length);let r=n[n.length-1];return e.filter(e=>n[e]>n[e-1]).map(e=>[n[e-1]/r,n[e]/r])}function ye(e,t){if(e===void 0)return[];if(!Array.isArray(e))throw RangeError(`describe.line: breaks must be an array of point indices, got ${be(e)}.`);let n=0;return e.forEach((e,r)=>{if(!(Number.isInteger(e)&&e>n&&e<t))throw RangeError(`describe.line: breaks[${r}] must be a whole number more than ${n} and less than ${t}, the number of points, got ${be(e)}.`);n=e}),e}let be=e=>typeof e==`string`?JSON.stringify(e):String(e);function xe(e){let{key:t,series:n}=e,r={x:ue(`point`,`x`,e.x),y:ue(`point`,`y`,e.y)},i=fe(`point`,`r`,e.r),a=Math.PI/2;return W({key:t,series:n,walk:H([k(r,r)]),thickness:2*i,outline:ne([[A(r,i,-3*a/2,a)],[A(r,i,-a/2,a)],[A(r,i,a/2,a)],[A(r,i,3*a/2,a)]]),bounds:{x:r.x-i,y:r.y-i,width:2*i,height:2*i},center:r,pivot:r,labelBounds:de(`point`,e.labelBounds),nearbyLabels:de(`point`,e.nearbyLabels,`nearbyLabels`)})}let Se=.1,Ce=1e4;function G(e){let t=[],n,r={x:0,y:0},i=[],a=!1,o=e=>{a&&t.push({start:n,end:r,segments:i,closed:e}),i=[],a=!1},s=e=>{a||(n=r,a=!0),r=e},c=e=>{e.length!==0&&i.push(e)},l=(e,t)=>c(k(e,t)),u=e=>{for(let t=1;t<e.length;t++)l(e[t-1],e[t])};for(let t=0;t<e.length;t++){let i=e[t],d=r;switch(i.op){case`M`:o(!1),r=i.to,e[t+1]&&e[t+1].op!==`M`&&(n=r,a=!0);break;case`Z`:s(n??r),l(d,r),o(!0);break;case`L`:s(i.to),l(d,r);break;case`C`:s(i.to),u(we(d,i.c1,i.c2,i.to));break;case`Q`:s(i.to),u(we(d,i.c,i.to));break;case`A`:s(i.to);for(let e of De(d,i))c(e)}}return o(!1),t}function we(...e){let t=e.length===4,n=t?Te(e[0],e[1],e[2],e[3]):K(1,2*Ee(e[0],e[1],e[2])),r=[e[0]];for(let i=1;i<n;i++){let a=i/n,o=1-a,[s,c,l,u]=t?[o*o*o,3*o*o*a,3*o*a*a,a*a*a]:[o*o,2*o*a,a*a,0];r.push({x:s*e[0].x+c*e[1].x+l*e[2].x+(t?u*e[3].x:0),y:s*e[0].y+c*e[1].y+l*e[2].y+(t?u*e[3].y:0)})}return r.push(e[e.length-1]),r}function Te(e,t,n,r){return K(1,6*Math.max(Ee(e,t,n),Ee(t,n,r)))}function Ee(e,t,n){return Math.hypot(e.x-2*t.x+n.x,e.y-2*t.y+n.y)}function K(e,t){let n=Math.ceil(e*Math.sqrt(t/(8*Se)));return Number.isFinite(n)?Math.min(Ce,Math.max(1,n)):Ce}function De(e,t){let{to:n,large:r,sweep:i}=t;if(e.x===n.x&&e.y===n.y)return[];let{rx:a,ry:o}=t;if(!(a>0&&o>0))return[k(e,n)];let s=Math.abs(a-o)<=1e-9*Math.max(a,o),c=s?0:t.rotation*Math.PI/180,l=Math.cos(c),u=Math.sin(c),d=(e.x-n.x)/2,f=(e.y-n.y)/2,p=l*d+u*f,m=-u*d+l*f,h=p*p/(a*a)+m*m/(o*o);h>1&&(a*=Math.sqrt(h),o*=Math.sqrt(h));let g=a*a,_=o*o,v=g*m*m+_*p*p,y=(r===i?-1:1)*Math.sqrt(Math.max(0,(g*_-v)/v)),b=y*a*m/o,x=-y*o*p/a,S={x:l*b-u*x+(e.x+n.x)/2,y:u*b+l*x+(e.y+n.y)/2},C=Math.atan2((m-x)/o,(p-b)/a),w=Math.atan2((-m-x)/o,(-p-b)/a)-C;if(i&&w<0?w+=O:!i&&w>0&&(w-=O),s)return[A(S,a,C,w)];let T=K(Math.abs(w),Math.max(a,o)),E=e=>{let t=a*Math.cos(e),n=o*Math.sin(e);return{x:S.x+l*t-u*n,y:S.y+u*t+l*n}},D=[],j=e;for(let e=1;e<=T;e++){let t=e===T?n:E(C+w*e/T);D.push(k(j,t)),j=t}return D}let Oe={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},ke=/[\s,]*([A-Za-z]|[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)/y,Ae=/^[A-Za-z]$/;function je(e){let t=[];ke.lastIndex=0;for(let n=ke.exec(e);n;n=ke.exec(e))t.push(n[1]);let n=[],r={x:0,y:0},i=r,a,o=``,s=0;for(;s<t.length;){if(Ae.test(t[s]))o=t[s++];else if(o===``||o===`Z`||o===`z`)break;let e=o.toUpperCase();if(e===`Z`){n.push({op:`Z`,to:i}),r=i,a=void 0;continue}let c=Oe[e];if(c===void 0)break;let l=[],u=!1;for(;l.length<c&&s<t.length&&!Ae.test(t[s]);){let n=t[s];if(e===`A`&&(l.length===3||l.length===4)){let e=n[0];if(e!==`0`&&e!==`1`){u=!0;break}l.push(Number(e)),n.length>1?t[s]=n.slice(1):s++}else l.push(Number(n)),s++}if(u||l.length<c||!l.every(Number.isFinite))break;let d=o!==e,f=(e,t)=>d?{x:r.x+e,y:r.y+t}:{x:e,y:t},[p=0,m=0,h=0,g=0,_=0,v=0,y=0]=l,b;switch(e){case`M`:r=i=f(p,m),n.push({op:`M`,to:r}),o=d?`l`:`L`;break;case`L`:n.push({op:`L`,to:r=f(p,m)});break;case`H`:n.push({op:`L`,to:r={x:d?r.x+p:p,y:r.y}});break;case`V`:n.push({op:`L`,to:r={x:r.x,y:d?r.y+p:p}});break;case`C`:case`S`:{let t=e===`S`,i=t?a&&Me(n,`C`)?Ne(a,r):r:f(p,m);b=t?f(p,m):f(h,g),n.push({op:`C`,c1:i,c2:b,to:r=t?f(h,g):f(_,v)});break}case`Q`:case`T`:{let t=e===`T`;b=t?a&&Me(n,`Q`)?Ne(a,r):r:f(p,m),n.push({op:`Q`,c:b,to:r=t?f(p,m):f(h,g)});break}case`A`:n.push({op:`A`,rx:Math.abs(p),ry:Math.abs(m),rotation:h,large:g!==0,sweep:_!==0,to:r=f(v,y)})}a=b}return n}let Me=(e,t)=>e[e.length-1]?.op===t,Ne=(e,t)=>({x:2*t.x-e.x,y:2*t.y-e.y});function Pe(e,t){let n=e=>{let n=Number.parseFloat(t(e)??``);return Number.isFinite(n)?n:0};switch(e){case`path`:return je(t(`d`)??``);case`circle`:return Fe(n(`cx`),n(`cy`),n(`r`),n(`r`));case`ellipse`:return Fe(n(`cx`),n(`cy`),n(`rx`),n(`ry`));case`line`:return[{op:`M`,to:{x:n(`x1`),y:n(`y1`)}},{op:`L`,to:{x:n(`x2`),y:n(`y2`)}}];case`polyline`:case`polygon`:{let n=(t(`points`)??``).trim().split(/[\s,]+/).filter(Boolean).map(Number),r=[];for(let e=0;e+1<n.length&&Number.isFinite(n[e])&&Number.isFinite(n[e+1]);e+=2)r.push({x:n[e],y:n[e+1]});if(r.length<2)return[];let i=r.map((e,t)=>({op:t===0?`M`:`L`,to:e}));return e===`polygon`?[...i,{op:`Z`,to:r[0]}]:i}case`rect`:return Ie(n(`x`),n(`y`),n(`width`),n(`height`),t);default:return[]}}function Fe(e,t,n,r){if(!(n>0&&r>0))return[];let i=e=>({op:`A`,rx:n,ry:r,rotation:0,large:!1,sweep:!0,to:{x:e,y:t}});return[{op:`M`,to:{x:e+n,y:t}},i(e-n),i(e+n),{op:`Z`,to:{x:e+n,y:t}}]}function Ie(e,t,n,r,i){if(!(n>0&&r>0))return[];let a=e=>{let t=Number.parseFloat(i(e)??``);return t>=0?t:void 0},o=Math.min(a(`rx`)??a(`ry`)??0,n/2),s=Math.min(a(`ry`)??a(`rx`)??0,r/2),c=(e,t)=>({op:`L`,to:{x:e,y:t}});if(!(o>0&&s>0))return[{op:`M`,to:{x:e,y:t}},c(e+n,t),c(e+n,t+r),c(e,t+r),{op:`Z`,to:{x:e,y:t}}];let l=(e,t)=>({op:`A`,rx:o,ry:s,rotation:0,large:!1,sweep:!0,to:{x:e,y:t}});return[{op:`M`,to:{x:e+o,y:t}},c(e+n-o,t),l(e+n,t+s),c(e+n,t+r-s),l(e+n-o,t+r),c(e+o,t+r),l(e,t+r-s),c(e,t+s),l(e+o,t),{op:`Z`,to:{x:e+o,y:t}}]}function Le(e,t){let n=e=>({x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}),r=t[0]*t[3]-t[1]*t[2]<0;return e.map(e=>{switch(e.op){case`M`:case`L`:case`Z`:return{op:e.op,to:n(e.to)};case`C`:return{op:`C`,c1:n(e.c1),c2:n(e.c2),to:n(e.to)};case`Q`:return{op:`Q`,c:n(e.c),to:n(e.to)};case`A`:return{...e,...Re(e,t),sweep:r!==e.sweep,to:n(e.to)}}})}function Re({rx:e,ry:t,rotation:n},r){let i=n*Math.PI/180,a=Math.cos(i),o=Math.sin(i),s=(r[0]*a+r[2]*o)*e,c=(r[2]*a-r[0]*o)*t,l=(r[1]*a+r[3]*o)*e,u=(r[3]*a-r[1]*o)*t,d=s*s+c*c,f=s*l+c*u,p=l*l+u*u,m=(d+p)/2,h=Math.hypot((d-p)/2,f),g=m+h,_=Math.abs(f)<1e-12?d>=p?0:Math.PI/2:Math.atan2(g-d,f);return{rx:Math.sqrt(g),ry:Math.sqrt(Math.max(0,m-h)),rotation:_*180/Math.PI}}function ze(e){let t=L,n=e=>`${t(e.x)},${t(e.y)}`;return e.map(e=>{switch(e.op){case`M`:case`L`:return`${e.op}${n(e.to)}`;case`C`:return`C${n(e.c1)} ${n(e.c2)} ${n(e.to)}`;case`Q`:return`Q${n(e.c)} ${n(e.to)}`;case`A`:return`A${t(e.rx)},${t(e.ry)} ${t(e.rotation)} ${+!!e.large} ${+!!e.sweep} ${n(e.to)}`;case`Z`:return`Z`}}).join(``)}function Be(e){let{key:t,series:n,d:r}=e,i=e.width??1;if(!(Number.isFinite(i)&&i>0))throw RangeError(`describe.shape: width must be a finite number more than 0, got ${i}.`);let a=Ue(e.matrix);if(typeof r!=`string`)throw RangeError(`describe.shape: d must be path data, a string, got ${We(r)}.`);let o=je(r),s=o[0]?.op===`M`?G(a?Le(o,a):o):[];if(s.length===0)throw RangeError(`describe.shape: d must start with a move and draw something after it, got ${We(r)}.`);let c=[],l=0;for(let e of s){c.push(e.start);for(let t of e.segments){for(let e of F(t))c.push(e);l+=t.length}}let u=I(c);if(![u.x,u.y,u.width,u.height,l].every(Number.isFinite))throw RangeError(`describe.shape: d must stay finite${a?` once moved by matrix`:``}, got ${We(r)}.`);let d=de(`shape`,e.labelBounds),f=de(`shape`,e.nearbyLabels,`nearbyLabels`);if(s.every(Ve)&&l>0){let e={x:u.x+u.width/2,y:u.y+u.height/2};return W({key:t,series:n,walk:H([k(e,e)]),thickness:Math.min(u.width,u.height),outline:U(s.map(e=>e.segments).filter(e=>e.length>0)),bounds:u,center:e,pivot:e,labelBounds:d,nearbyLabels:f})}let{segments:p,gaps:m}=He(s),h=H(p,m),g=i/2;return W({key:t,series:n,walk:h,thickness:i,outline:ce(h),bounds:{x:u.x-g,y:u.y-g,width:u.width+i,height:u.height+i},center:h.point(.5),pivot:h.start,labelBounds:d,nearbyLabels:f})}let Ve=({closed:e,start:t,end:n})=>e||t.x===n.x&&t.y===n.y;function He(e){let t=[],n=[],r;for(let i of e){r&&(r.x!==i.start.x||r.y!==i.start.y)&&(n.push(t.length),t.push(k(r,i.start)));for(let e of i.segments)t.push(e);r=i.end}t.length===0&&t.push(k(e[0].start,e[0].start));let i=[0];for(let e of t)i.push(i[i.length-1]+e.length);let a=i[i.length-1];return{segments:t,gaps:n.map(e=>[i[e]/a,i[e+1]/a])}}function Ue(e){if(e===void 0)return e;if(!(Array.isArray(e)&&e.length===6&&e.every(Number.isFinite)))throw RangeError(`describe.shape: matrix must be six finite numbers [a, b, c, d, e, f], got ${We(e)}.`);return e}function We(e){return Array.isArray(e)?`[${e.map(We).join(`, `)}]`:typeof e==`string`?JSON.stringify(e.length>40?`${e.slice(0,40)}…`:e):String(e)}let Ge={bar:he,arc:pe,line:_e,point:xe,shape:Be};function Ke(e,t){return[1,0,0,1,e,t]}function qe(e,t){let n=Math.cos(e),r=Math.sin(e);return Qe([n,r,-r,n,0,0],t)}function Je(e,t=e,n){return Qe([e,0,0,t,0,0],n)}function Ye(...e){let t=[1,0,0,1,0,0];for(let n of e)t=Ze(t,n);return t}function Xe(e,t){let[n,r,i,a,o,s]=e;return{x:n*t.x+i*t.y+o,y:r*t.x+a*t.y+s}}function Ze(e,t){let[n,r,i,a,o,s]=e,[c,l,u,d,f,p]=t;return[n*c+i*l,r*c+a*l,n*u+i*d,r*u+a*d,n*f+i*p+o,r*f+a*p+s]}function Qe(e,t){if(!t)return e;let[n,r,i,a]=e;return[n,r,i,a,t.x-n*t.x-i*t.y,t.y-r*t.x-a*t.y]}let q={translate:Ke,rotate:qe,scale:Je,multiply:Ye,apply:Xe};function $e(e){let[t,n,r,i,a,o]=e,s=t*i-n*r;if(!Number.isFinite(s)||Math.abs(s)<1e-12)throw RangeError(`This transform can't be inverted: it has no area.`);return[i/s,-n/s,-r/s,t/s,(r*o-i*a)/s,(n*a-t*o)/s]}function et(e){let t=[];for(let[,n,r=``]of e.matchAll(/(matrix|translate|scale|rotate|skewX|skewY)\s*\(([^)]*)\)/g)){let e=r.trim().split(/[\s,]+/).filter(Boolean).map(Number);if(!e.every(Number.isFinite))continue;let[i=0,a,o,s=0,c=0,l=0]=e,u=e=>e*Math.PI/180;switch(n){case`matrix`:e.length===6&&t.push([i,a,o,s,c,l]);break;case`translate`:t.push(Ke(i,a??0));break;case`scale`:t.push(Je(i,a??i));break;case`rotate`:t.push(qe(u(i),a!==void 0&&o!==void 0?{x:a,y:o}:void 0));break;case`skewX`:t.push([1,0,Math.tan(u(i)),1,0,0]);break;case`skewY`:t.push([1,Math.tan(u(i)),0,1,0,0])}}return Ye(...t)}function tt(e,t,n){return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}let nt=(Math.sqrt(5)-1)/2;function rt(e,t){if(typeof e!=`object`||!e||typeof e.path!=`function`||!Number.isFinite(e.length))throw TypeError(`samplesAlong needs a MarkGeometry, as describe builds it.`);if(!Array.isArray(t))throw TypeError(`samplesAlong needs an array of points { x, y, value, at? }.`);t.forEach((e,t)=>{for(let n of[`x`,`y`,`value`]){let r=e?.[n];if(typeof r!=`number`||!Number.isFinite(r))throw RangeError(`samplesAlong: points[${t}].${n} must be a finite number, got ${String(r)}.`)}});let n=e.length>0?Math.min(4096,Math.ceil(e.length)+1):1,r=Array.from({length:n},(t,r)=>e.path(n===1?0:r/(n-1))),i=t.map((t,n)=>({index:n,sample:{t:at(e,r,t),value:t.value,...t.at===void 0?{}:{at:t.at}}})).sort((e,t)=>e.sample.t-t.sample.t||e.index-t.index).map(({sample:e})=>e);return e.gaps&&e.gaps.length>0?it(i,e.gaps):i}function it(e,t){let n=t.map(([e,t])=>(e+t)/2).sort((e,t)=>e-t),r=0;return e.map((t,i)=>{if(i===0)return t;let a=e[i-1].t;for(;r<n.length&&n[r]<=a;)r++;return r<n.length&&n[r]<=t.t?{...t,gapBefore:!0}:t})}function at(e,t,n){let r=t.length;if(r===1)return 0;let i=0,a=1/0;t.forEach((e,t)=>{let r=ot(e,n);r<a&&(i=t,a=r)});let o=t=>ot(e.path(t),n),s=Math.max(0,i-1)/(r-1),c=Math.min(r-1,i+1)/(r-1),l=c-nt*(c-s),u=s+nt*(c-s),d=o(l),f=o(u);for(let e=0;e<48;e++)d<=f?(c=u,u=l,f=d,l=c-nt*(c-s),d=o(l)):(s=l,l=u,d=f,u=s+nt*(c-s),f=o(u));let p=(s+c)/2,m=o(p)<a?p:i/(r-1);return m>0?m<1?m:1:0}function ot(e,t){return(e.x-t.x)**2+(e.y-t.y)**2}function st(e){let{kind:t,hint:n}=e,r=new Map,i={get:e=>r.get(e),resolve(e){let i=r.get(e);if(i!==void 0)return i;let a=r.size>0?[...r.keys()].join(`, `):`none`;throw RangeError(`Unknown ${t} "${String(e)}". Registered ${t}s: ${a}.${n?` ${n}`:``}`)},register(e,n){if(typeof e!=`string`||e===``)throw TypeError(`A ${t} needs a non-empty string name, got ${JSON.stringify(e)}.`);if(n===void 0)throw TypeError(`Registering ${t} "${e}" needs a value.`);r.set(e,n)},names:()=>[...r.keys()]};for(let[t,n]of Object.entries(e.entries??{}))i.register(t,n);return i}let ct=[`hover`,`enter`,`update`,`exit`,`decorate`];function lt(e,t){let n={};for(let t of Object.keys(e??{}))if(!ct.includes(t))throw TypeError(`on.${t} isn't an effect slot. Use one of: ${ct.join(`, `)}.`);for(let r of ct){let i=e?.[r];if(i!==void 0){if(typeof i==`string`){let e=t.resolve(i)();if(!ut(e))throw TypeError(`Preset "${i}" for on.${r} didn't return a mark effect; it returned ${dt(e)}.`);n[r]=e}else{if(!ut(i))throw TypeError(`on.${r} needs a mark effect (kind "geometry" or "data") or a preset name, got ${dt(i)}.`);n[r]=i}}}return n}function ut(e){if(typeof e!=`object`||!e)return!1;let t=e;return(t.kind===`geometry`||t.kind===`data`)&&typeof t.run==`function`&&typeof t.end==`function`&&typeof t.clear==`function`}function dt(e){if(typeof e!=`object`||!e)return e===null?`null`:typeof e;let t=e.kind;return t===`transition`?`a transition effect, which runs between two charts rather than on one mark`:t===`geometry`||t===`data`?`a ${t} effect without run(), end() and clear()`:t===void 0?`an object with no kind`:`an effect of kind ${JSON.stringify(t)}`}function ft(e,t){let n={...e};for(let[e,r]of Object.entries(t??{}))r===void 0?delete n[e]:n[e]=r;return n}let pt=12.5,mt=.6,ht=.16;function gt(e,t,n,r){return{x:(t===`end`?e.x-n:t===`middle`?e.x-n/2:e.x)-ht*r,y:e.y-1.05*r,width:n+2*ht*r,height:1.3*r}}function _t(e,t){return gt(t.at,t.anchor,e.length*pt*mt,pt)}function vt(e){let{clock:t,motion:n,layer:r,mark:i}=e,a=new AbortController,o=[];return{context:{signal:a.signal,motion:n,mark:i,layer:r,icons:e.icons,batch:e.batch,...e.previous?{previous:e.previous}:{},...e.texts?{texts:e.texts}:{},tween(e){let r=e.signal,i=y({...e,signal:r??a.signal},{clock:t,motion:n});return r&&r!==a.signal&&(a.signal.aborted?i.cancel():a.signal.addEventListener(`abort`,()=>i.cancel(),{once:!0})),i},onChange(e){o.push(e)}},abort(){a.abort()},change(e,t){for(let n of[...o])n(e,t)},clear(){a.abort(),r.clear(),i.reset(),o=[]}}}let yt=[`decorate`,`enter`,`update`,`exit`,`hover`],bt=(e,t)=>e.order-t.order,xt=(e,t)=>e===t||e!==void 0&&t!==void 0&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,J={get:()=>void 0},St={place(){},update(){},remove(){}};function Ct(e){let{surface:n}=e,r=e.effects,i=e.motion??v,o=e.clock??a,s=e.icons??J,c=new Map,l=new Set,u=!1,d=!1,f=0,p=(e,t)=>n.box?n.box(e,t):_t(e,t),m=new Map,h=0,g=!1,_=i.subscribe(()=>{i.mode===`off`&&P()});function y(e){let t=e.mark.key,n=c.get(t);if(n)return n.mark=e.mark,n.data=e.data,n;let r={key:t,mark:e.mark,data:e.data,resting:e.data,runs:new Map,applied:{},handle:void 0,exiting:void 0};return c.set(t,r),r}function b(e,t,n,a,c={}){let{previous:l,done:u}=c,d=r[t];if(!d){u?.();return}let h=e.runs.get(t);h&&w(h);let g={entry:e,slot:t,order:c.order??++f,effect:d,data:n,batch:a,previous:l,style:{},state:`running`,done:u,scope:vt({clock:o,motion:i,icons:s,batch:a,previous:l,layer:O(e.key,t,()=>g.order,()=>g.state!==`cleared`),mark:k(()=>g),texts:{box:p,held:()=>[...m].flatMap(([e,t])=>t.box&&e.order<g.order?[t.box]:[]),hold(e){g.state!==`cleared`&&E(g,e)}}})};e.runs.set(t,g);let _=c.mark??e.mark,v=g.scope.context;try{if(c.end||i.mode===`off`)d.kind===`data`?d.end(_,n,v):d.end(_,v),x(g);else{let e=d.kind===`data`?d.run(_,n,v):d.run(_,v);Promise.resolve(e).then(()=>x(g),e=>S(g,e))}}catch(e){S(g,e)}}function x(e){e.state===`running`&&(e.state=`ended`,C(e))}function S(e,n){let{signal:r}=e.scope.context;(!r.aborted||n!==r.reason&&n?.name!==`AbortError`)&&(t(n),w(e))}function C(e){let t=e.done;e.done=void 0,t?.()}function w(e){if(e.state===`cleared`)return;e.state=`cleared`;let{entry:n}=e;n.runs.get(e.slot)===e&&n.runs.delete(e.slot),e.scope.abort();try{e.effect.clear(e.scope.context)}catch(e){t(e)}e.scope.clear(),E(e,void 0),C(e)}function T(e,n){try{e.scope.change(n,I(e.entry,e))}catch(n){t(n),w(e)}}function E(e,t){let n=m.get(e);if(!n){if(!t)return;m.set(e,n={box:void 0,placed:0,moved:0})}n.placed=++h,xt(n.box,t)||(n.box=t,n.moved=h,g||(g=!0,queueMicrotask(D)))}function D(){let e=0;for(let[t,n]of[...m].sort(([e],[t])=>bt(e,t)))n.box&&n.placed<e&&T(t,t.entry.mark),n.box||m.delete(t),e=Math.max(e,n.moved);g=!1}function O(e,t,r,i){let a,o=()=>i()?a??(a=n.group(e,t,r())):void 0;return{icon:(e,t)=>o()?.icon(e,t)??St,path:(e,t)=>o()?.path(e,t)??St,text:(e,t)=>o()?.text(e,t)??St,clear(){let e=a;a=void 0,e?.clear()}}}function k(e){return{set(t){let n=e();n.state!==`cleared`&&(n.style=ft(n.style,t),A(n.entry))},reset(){let t=e();Object.keys(t.style).length!==0&&(t.style={},A(t.entry))}}}function A(e){let t=[...e.runs.values()].sort((e,t)=>e.order-t.order),n=Object.assign({},...t.map(e=>e.style)),r=e.applied;if(e.applied=n,Object.keys(n).length===0){Object.keys(r).length>0&&j(e).reset();return}let i={},a=!1;for(let e of new Set([...Object.keys(r),...Object.keys(n)]))r[e]!==n[e]&&(i[e]=n[e],a=!0);a&&j(e).set(i)}function j(e){return e.handle??(e.handle=n.mark(e.key))}function M(e){c.get(e.key)===e&&c.delete(e.key),l.delete(e.key);let t=e.exiting;e.exiting=void 0;for(let t of[...e.runs.values()])w(t);e.handle=void 0,t?.()}function N(e){let t=e.exiting;if(!t)return;e.exiting=void 0;let n=e.runs.get(`exit`);n&&w(n),t()}function P(){for(let e of[...c.values()])for(let t of[...e.runs.values()]){if(t.state!==`running`||e.runs.get(t.slot)!==t)continue;let n=t.done;t.done=void 0,b(e,t.slot,I(e,t),t.batch,{previous:t.previous,done:n,order:t.order})}}function F(e){let t=new Map;for(let n of[...c.values()]){let r=n.runs.get(e);r&&(t.set(n,r.order),w(r))}return t}function I(e,t){let n=t.data.previous;return n&&!e.data.previous?wt(e.data,n):e.data}return{enter(e){d||e.forEach((t,n)=>{let r=y(t);r.resting=t.data,N(r);let i={index:n,count:e.length};b(r,`decorate`,t.data,i),b(r,`enter`,t.data,i)})},update(e){if(d)return;let t=new Set(e.map(e=>e.mark.key));for(let e of[...c.values()]){let n=e.runs.get(`update`);n&&!t.has(e.key)&&w(n)}e.forEach((t,n)=>{let r=c.get(t.mark.key),i=t.from??r?.mark,a=r&&!t.data.previous?wt(t.data,r.resting):t.data,o=y(t);o.resting=t.data,b(o,`update`,a,{index:n,count:e.length},{previous:i})})},exit(e){if(d)return Promise.resolve();let t=e.map((t,n)=>{let i=y(t);N(i),l.delete(i.key);for(let e of[...i.runs.values()])w(e);return new Promise(a=>{i.exiting=a,r.exit?b(i,`exit`,t.data,{index:n,count:e.length},{done:()=>{i.exiting&&c.get(i.key)===i&&M(i)}}):M(i)})});return Promise.all(t).then(()=>void 0)},hover(e){d||e.forEach((t,n)=>{let r=y(t);r.exiting||(l.add(r.key),u||b(r,`hover`,t.data,{index:n,count:e.length}))})},leave(e=[...l]){for(let t of e){l.delete(t);let e=c.get(t)?.runs.get(`hover`);e&&w(e)}},change(e,t){let n=c.get(e.key);if(n){n.mark=e,t&&(n.data=t,u||(n.resting=t));for(let t of[...n.runs.values()].sort(bt))t.state!==`cleared`&&T(t,e)}},interrupt(){if(!d){u=!0;for(let e of[...c.values()]){let t=e.runs.get(`hover`);t&&w(t)}}},settle(){if(!u)return;u=!1;for(let e of c.values())e.exiting||(e.resting=e.data);let e=[...l];e.forEach((t,n)=>{let r=c.get(t);r&&b(r,`hover`,r.data,{index:n,count:e.length})})},swap(e,t){if(d)return;let n=yt.filter(t=>e[t]!==r[t]);r=e;for(let e of n)if(e===`decorate`){let n=F(e);t.forEach((r,i)=>{let a=c.get(r.mark.key)??y(r);a.exiting||b(a,e,r.data,{index:i,count:t.length},{mark:r.mark,order:n.get(a)})})}else if(e===`hover`){if(F(e),u)continue;let t=[...l];t.forEach((n,r)=>{let i=c.get(n);i&&b(i,e,i.data,{index:r,count:t.length})})}else for(let t of[...c.values()]){let n=t.runs.get(e);if(!n)continue;let r=n.done;n.done=void 0;let i=I(t,n);w(n),b(t,e,i,n.batch,{previous:n.previous,done:r,order:n.order,end:!0})}},destroy(){if(!d){d=!0,u=!1,_();for(let e of[...c.values()])M(e);l.clear()}}}}function wt(e,t){return{datum:e.datum,samples:e.samples,related:t=>e.related(t),previous:t}}let Tt={value:`Sorted highest first`,key:`Sorted A to Z`,none:`In data order`,custom:`Sorted`};function Et(e){let t=[],{series:n}=e;e.label===void 0?n&&(n.length!==1||n[0]!==`value`)&&t.push(`Showing ${Dt(n)}`):t.push(e.label),e.sort&&t.push(Tt[e.sort]);let{changed:r,added:i,removed:a}=e;return!n&&r.length>0&&t.push(r.length<=3?`${Dt(r)} changed`:`${r.length} of ${e.count} changed`),i.length>0&&t.push(`Added ${i.length<=3?Dt(i):i.length}`),a.length>0&&t.push(`Removed ${a.length<=3?Dt(a):a.length}`),t.join(`. `)}function Dt(e){return e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function Ot(e){let t=e.ownerDocument.createElement(`div`);t.className=`ec-announcer ec-visually-hidden`,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-atomic`,`true`),e.after(t);let n=!1;return{say(e){e!==``&&(n=!n,t.textContent=n?e:`${e} `)},destroy(){t.remove()}}}let kt=`http://www.w3.org/2000/svg`;function Y(e,t={},n){let r=(n?.ownerDocument??document).createElementNS(kt,e);return X(r,t),n?.appendChild(r),r}function X(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.removeAttribute(n):e.setAttribute(n,typeof r==`number`?L(r):r)}function At(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.style.removeProperty(n):e.style.setProperty(n,r)}function jt({width:e,height:t}){return{width:e,height:t,viewBox:`0 0 ${L(e)} ${L(t)}`}}function Mt(e){let[t,n,r,i,a,o]=e;return`matrix(${[t,n,r,i].map(Nt).join(` `)} ${L(a)} ${L(o)})`}function Nt(e){let t=Math.round(e*1e6)/1e6;return t===0?`0`:String(t)}function Pt(e,t,n,r){return gt(e,e.anchor,t(e.text.replace(/\d/g,`0`),n,r),r)}function Ft(e,t){X(e,{x:t.x,y:t.y,"text-anchor":t.anchor}),e.textContent!==t.text&&(e.textContent=t.text)}function It(e){let t=new Map;return Object.assign((n,r,i)=>{if(n===``)return 0;let a=`${r}\n${i}\n${n}`,o=t.get(a);if(o!==void 0)return o;let s=0,c=Y(`text`,{class:r,visibility:`hidden`,"aria-hidden":`true`},e);return typeof c.getComputedTextLength==`function`&&e.isConnected&&(c.textContent=n,s=c.getComputedTextLength()),c.remove(),s>0?(t.set(a,s),s):n.length*i*mt},{clear:()=>t.clear()})}let Lt=12.5,Rt=12.5,zt={label:!0,value:!0},Bt=.36;function Vt(e){let{x:t,y:n,stack:r,data:i}=e,a=e.orientation;if(a!==void 0&&a!==`horizontal`&&a!==`vertical`)throw TypeError(`barChart: orientation must be "horizontal" or "vertical", got ${String(a)}.`);if(r!==void 0){if(!Array.isArray(r)||r.length===0)throw TypeError(`barChart: stack needs at least one numeric field.`);let e=new Set;for(let t of r){if(e.has(t))throw TypeError(`barChart: "${t}" appears twice in stack.`);e.add(t)}}if(a===void 0){if(t!==void 0&&n!==void 0){let e=cn(i,sn(t));if(e!==cn(i,sn(n)))a=e?`horizontal`:`vertical`;else if(i.length===0)a=`horizontal`;else throw RangeError(`barChart: ${e?`x and y both hold numbers`:`neither x nor y holds numbers`}, so it can't tell which is the category. Set orientation: "horizontal" (categories along y) or "vertical" (categories along x).`)}else if(r!==void 0&&(t!==void 0||n!==void 0))a=n===void 0?`vertical`:`horizontal`;else throw TypeError(`barChart needs x and y (the axis whose values aren't numbers is the category), or one of them plus stack.`)}let o=a===`horizontal`,s=o?n:t,c=o?t:n;if(s===void 0)throw TypeError(`barChart: a ${a} chart takes its categories from ${o?`y`:`x`}.`);let l=sn(s),u;if(r!==void 0)u=r.map(e=>({series:e,value:sn(e)}));else if(c!==void 0)u=[{series:typeof c==`string`?c:`value`,value:sn(c)}];else throw TypeError(`barChart needs values: ${o?`x`:`y`} set to a numeric field, or stack.`);return{orientation:a,category:l,key:e.key===void 0?l:sn(e.key),series:u}}function Ht(e){let t=Qt(Zt(e),e.sort),n=$t(t.map(e=>e.total)),r=t.map(t=>e.format(t.total)),i=n.ticks.map(e.format),a=r=>(e.encoding.orientation===`horizontal`?tn:nn)(e,t,n,r,i),o=a(r),s=Ut(o,t,r,e.measure);return s.values||(s=Ut(o=a(),t,r,e.measure,!1)),{width:o.bands.width,height:o.bands.height,orientation:o.orientation,frame:o,rows:t.map((t,n)=>Jt(o,{...t,slot:n,text:r[n],drawn:{label:n%s.every===0,value:s.values}},e.measure)),ticks:n.ticks.map((e,t)=>Yt(o,e,i[t])),labels:s}}function Ut(e,t,n,r,i=!0){let a=t.map((t,r)=>qt(e,r,t.total,t.category,n[r])),o=e.orientation===`horizontal`;i&&(i=!Kt(Gt(a.map(({value:e})=>e),r,`ec-value`,Rt),o));let s=e=>Gt(a.filter((t,n)=>n%e===0).map(({label:e})=>e),r,`ec-label`,Lt),c=0;for(;Wt(c)<t.length&&Kt(s(Wt(c)),o);)c++;return{every:Wt(c),values:i}}let Wt=e=>[1,2,5][e%3]*10**Math.floor(e/3);function Gt(e,t,n,r){return e.filter(e=>e.text!==``).map(e=>Pt(e,t,n,r))}function Kt(e,t){let n=t?e.map(({x:e,y:t,width:n,height:r})=>({x:t,y:e,width:r,height:n})):[...e];n.sort((e,t)=>e.x-t.x);let r=[];for(let e of n){for(let t=r.length-1;t>=0;t--)r[t].x+r[t].width<=e.x&&r.splice(t,1);if(r.some(t=>t.y<e.y+e.height&&e.y<t.y+t.height))return!0;r.push(e)}return!1}function qt(e,t,n,r,i){let{scale:a,bands:o}=e,s=n<0,c=Xt(a)(n),l=o.start+t*o.band;if(e.orientation===`horizontal`){let e=l+o.band/2+Lt*Bt;return{label:{x:a.label,y:e,anchor:`end`,text:r},value:{x:s?c-6:c+6,y:e,anchor:s?`end`:`start`,text:i}}}let u=l+o.band/2;return{label:{x:u,y:a.label,anchor:`middle`,text:r},value:{x:u,y:s?c+6+Rt*.8:c-6,anchor:`middle`,text:i}}}function Jt(e,t,n){let{scale:r,bands:i}=e,a=Xt(r),o=Math.abs(r.extent/(r.hi-r.lo)),s=t.values.reduce((e,t)=>e+t.value,0),c=s<0,l=a(0),u=a(s),d=i.start+t.slot*i.band,f={key:t.key,...t.values.length===1?{series:t.values[0].series}:{},radius:4,gap:2,segments:t.values.map(e=>({series:e.series,size:Math.max(0,c?-e.value:e.value)*o}))},p=t.drawn??zt,m={key:t.key,datum:t.datum,index:t.index,slot:t.slot,values:t.values,total:s,category:t.category,drawn:p},{label:h,value:g}=qt(e,t.slot,s,p.label?t.category:``,p.value?t.text:``),_=()=>[...Gt([h],n,`ec-label`,Lt),...Gt([g],n,`ec-value`,Rt)];if(e.orientation===`horizontal`){let e=he({...f,x:Math.min(l,u),y:d+(i.band-i.thickness)/2,width:Math.abs(u-l),height:i.thickness,baseline:c?`right`:`left`,labelBounds:_()});return{...m,geometry:e,data:an(t.datum,s,e),label:h,value:g,hit:{x:0,y:d,width:i.width,height:i.band}}}let v=d+i.band/2,y=he({...f,x:v-i.thickness/2,y:Math.min(l,u),width:i.thickness,height:Math.abs(u-l),baseline:c?`top`:`bottom`,labelBounds:_()});return{...m,geometry:y,data:an(t.datum,s,y),label:h,value:g,hit:{x:d,y:0,width:i.band,height:i.height}}}function Yt(e,t,n){let{bands:r}=e,i=Xt(e.scale)(t);if(e.orientation===`horizontal`){let e=r.start+r.span;return{value:t,line:{x1:i,y1:r.start,x2:i,y2:e},label:{x:i,y:e+16,anchor:`middle`,text:n}}}return{value:t,line:{x1:r.start,y1:i,x2:r.start+r.span,y2:i},label:{x:r.start-8,y:i+11*Bt,anchor:`end`,text:n}}}function Xt(e){let t=e.extent/(e.hi-e.lo);return n=>e.from+(n-e.lo)*t}function Zt({data:e,encoding:t}){let n=new Set;return e.map((e,r)=>{let i=String(t.key(e,r));if(n.has(i))throw Error(`barChart: two rows have the key "${i}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(i);let a=t.series.map(({series:t,value:n})=>({series:t,value:ln(n(e,r),t,i)}));if(a.some(e=>e.value>0)&&a.some(e=>e.value<0))throw RangeError(`barChart: the stack for "${i}" mixes positive and negative values, which isn't supported yet.`);let o=a.reduce((e,t)=>e+t.value,0);return{key:i,category:String(t.category(e,r)??``),datum:e,index:r,values:a,total:o}})}function Qt(e,t){if(t===void 0||t===`none`)return e;if(t===`value`)return[...e].sort((e,t)=>t.total-e.total);if(t===`key`)return[...e].sort((e,t)=>e.key.localeCompare(t.key,void 0,{numeric:!0}));if(typeof t==`function`)return[...e].sort((e,n)=>t(e.datum,n.datum));throw TypeError(`barChart: sort must be "value", "key", "none" or a comparator, got ${String(t)}.`)}function $t(e){let t=e.reduce((e,t)=>Math.min(e,t),0),n=e.reduce((e,t)=>Math.max(e,t),0);t===n&&(n=1);let r=en((n-t)/4);t=un(Math.floor(t/r)*r),n=un(Math.ceil(n/r)*r);let i=Math.round((n-t)/r),a=Array.from({length:i+1},(e,n)=>un(t+n*r));return{lo:t,hi:n,ticks:a}}function en(e){let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function tn(e,t,n,r,i){let{width:a,measure:o}=e,s=t.length,c=on(t.map(e=>e.category),`ec-label`,Lt,o),l=r?on(r,`ec-value`,Rt,o)+6:0,u=on(i,`ec-tick`,11,o),{positive:d,negative:f}=rn(e,t),p=n.lo<0?l:0,m=Math.max(c+10+p+f,u/2+2),h=Math.max(l+4+d,u/2+2),g=e.height===void 0||s===0?34:Math.max(0,e.height-4-26)/s;return{orientation:`horizontal`,scale:{lo:n.lo,hi:n.hi,from:m,extent:Math.max(0,a-m-h),label:m-10-p},bands:{start:4,band:g,thickness:g*20/34,span:s*g,width:a,height:e.height??4+s*g+26}}}function nn(e,t,n,r,i){let{width:a,measure:o}=e,s=t.length,c=e.height??300,l=on(i,`ec-tick`,11,o),{positive:u,negative:d}=rn(e,t),f=(r&&n.hi>0?20.5:4)+u,p=r&&n.lo<0?18.5:0,m=26+p+d,h=l+8+2,g={x:h,y:f,width:Math.max(0,a-h-8),height:Math.max(0,c-f-m)},_=s>0?g.width/s:0,v=g.y+g.height;return{orientation:`vertical`,scale:{lo:n.lo,hi:n.hi,from:v,extent:-g.height,label:v+p+18},bands:{start:g.x,band:_,thickness:Math.min(_*20/34,72),span:g.width,width:a,height:c}}}function rn(e,t){let n=e.room??0;return{positive:t.some(e=>e.total>0)?n:0,negative:t.some(e=>e.total<0)?n:0}}function an(e,t,n){let r=e=>n.length>0?t*e/n.length:0,i={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related(t){let a=n.segments?.find(e=>e.series===t);if(!a)return;let o=Math.hypot(a.start.x-n.start.x,a.start.y-n.start.y);return{datum:e,samples:[{t:0,value:r(o)},{t:1,value:r(o+a.length)}],related:i.related}}};return i}function on(e,t,n,r){return e.reduce((e,i)=>Math.max(e,r(i,t,n)),0)}function sn(e){return typeof e==`function`?e:t=>t[e]}function cn(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=t(e[r],r);if(i!=null){if(typeof i!=`number`)return!1;n=!0}}return n}function ln(e,t,n){if(e==null)return 0;if(typeof e==`number`&&Number.isFinite(e))return e;throw RangeError(`barChart: "${t}" for "${n}" must be a finite number, got ${typeof e==`string`?JSON.stringify(e):String(e)}.`)}function un(e){let t=Number(e.toPrecision(12));return t===0?0:t}let dn={light:{surface:`#fcfcfb`,text:`#0b0b0b`,"text-muted":`#75736d`,grid:`#e1e0d9`,axis:`#c3c2b7`,focus:`#2a78d6`,negative:`#d03b3b`,ring:`rgba(11, 11, 11, 0.1)`,"dim-opacity":`0.3`,series:[[`#2a78d6`,`#1c5cab`],[`#eb6834`,`#c24d1d`],[`#02a471`,`#07835a`],[`#c28409`,`#9d6a07`],[`#8966da`,`#6e49ba`],[`#0096b0`,`#05778c`],[`#7a8a05`,`#606d03`],[`#c34e97`,`#a32f7a`]]},dark:{surface:`#1a1a19`,text:`#f0efec`,"text-muted":`#8f8d86`,grid:`#2c2c2a`,axis:`#45453f`,focus:`#3987e5`,negative:`#e66767`,ring:`rgba(255, 255, 255, 0.1)`,"dim-opacity":`0.3`,series:[[`#3987e5`,`#6da7ec`],[`#d95926`,`#fb7747`],[`#199e70`,`#45bc8c`],[`#c98500`,`#eda100`],[`#936fe4`,`#af8ffe`],[`#0b99b3`,`#40b7d2`],[`#829401`,`#9eb237`],[`#c8529c`,`#e970ba`]]}},fn=[`surface`,`text`,`text-muted`,`grid`,`axis`,`focus`,`negative`],Z=Object.fromEntries(fn.map(e=>[e,dn.light[e]]));function pn(e){let t=(Math.max(1,Math.floor(e))-1)%8+1,[n,r]=dn.light.series[t-1];return{color:`var(--ec-series-${t}, ${n})`,strong:`var(--ec-series-${t}-strong, ${r})`}}function mn(e){if(e===`mark`)return`var(--ec-mark, ${pn(1).color})`;if(e===`mark-strong`)return`var(--ec-mark-strong, ${pn(1).strong})`;let t=Z[e];if(t!==void 0)return`var(--ec-${e}, ${t})`;let n=/^series-(\d+)(-strong)?$/.exec(e);if(n){let e=pn(Number(n[1]));return n[2]?e.strong:e.color}return e}function hn(e){return{"--ec-mark":e?.color,"--ec-mark-strong":e?.strong}}function gn(e,t){let n=[...fn,`ring`,`dim-opacity`].map(t=>`--ec-${t}: ${e[t]};`);return e.series.forEach(([e,t],r)=>n.push(`--ec-series-${r+1}: ${e};`,`--ec-series-${r+1}-strong: ${t};`)),n.map(e=>t+e).join(`
|
|
1
|
+
"use strict";var ExpressiveCharts=(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=globalThis.reportError;typeof t==`function`?t(e):console.error(e)}function n(e=i()){let n=new Set,r,a=()=>{!r&&n.size>0&&(r=e.request(o))},o=e=>{r=void 0;for(let r of[...n])if(n.has(r))try{r(e)}catch(e){t(e)}a()};return{now:()=>e.now(),onFrame(e){let t=t=>e(t);return n.add(t),a(),()=>{n.delete(t)&&n.size===0&&r&&(r(),r=void 0)}}}}function r(e=0){let t=e,r,i=n({now:()=>t,request(e){return r=e,()=>{r===e&&(r=void 0)}}});return{now:i.now,onFrame:i.onFrame,get idle(){return r===void 0},advance(e){if(!(e>=0))throw RangeError(`manualClock.advance needs a non-negative number of ms, got ${e}`);t+=e;let n=r;r=void 0,n?.(t)}}}function i(){let e=()=>typeof performance<`u`?performance.now():Date.now();return{now:e,request(t){if(typeof requestAnimationFrame==`function`){let e=requestAnimationFrame(t);return()=>cancelAnimationFrame(e)}let n=setTimeout(()=>t(e()),16);return()=>clearTimeout(n)}}}let a=n(),o=e=>e,s=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,c=e=>1-(1-e)**3;function l(e){return e<.5?Math.cbrt(e/4):1-Math.cbrt(2*(1-e))/2}let u={presentation:{feedback:{factor:1},transition:{factor:1},effect:{factor:1},playback:{factor:1},stagger:{factor:1}},analysis:{feedback:{factor:1},transition:{factor:.35,max:200},effect:{factor:.35,min:140,max:300},playback:{factor:.3},stagger:{factor:0}}},d=[`presentation`,`analysis`,`off`],f=[`feedback`,`transition`,`effect`,`playback`,`stagger`];function p(e={}){let n=g(e.mode??`presentation`),r,i=_(e.scaling),a=e.reducedMotion??h(),o=new Set,s,c=()=>r??(a.matches?`off`:n),l=()=>{for(let e of[...o])if(o.has(e))try{e()}catch(e){t(e)}};return{get mode(){return c()},get staged(){return c()===`presentation`},get requested(){return n},get viewerChoice(){return r},get prefersReduced(){return a.matches},duration(e,t=`transition`){let n=c();return n===`off`?0:m(e,i[n][t])},setMode(e){g(e),e!==n&&(n=e,l())},chooseMode(e){g(e),e!==r&&(r=e,l())},clearChoice(){r!==void 0&&(r=void 0,l())},subscribe(e){let t=()=>e();return o.add(t),s??(s=a.subscribe(l)),()=>{!o.delete(t)||o.size>0||(s?.(),s=void 0)}}}}function m(e,t){if(!(e>0))return 0;let n=Math.min(e,t.min??0),r=t.max??1/0;return Math.min(Math.max(e*t.factor,n),r)}function h(e=`(prefers-reduced-motion: reduce)`){let t,n=()=>{if(t===void 0)try{t=typeof matchMedia==`function`?matchMedia(e):null}catch{t=null}return t};return{get matches(){return n()?.matches??!1},subscribe(e){let t=n();if(!t)return()=>{};let r=()=>e();return typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))}}}function g(e){if(!d.includes(e))throw TypeError(`Unknown motion mode "${String(e)}". Use one of: ${d.join(`, `)}.`);return e}function _(e={}){let t=t=>{let n={...u[t]};for(let r of f){let i=e[t]?.[r];i&&(n[r]=i)}return n};return{presentation:t(`presentation`),analysis:t(`analysis`)}}let v=p();function y(e,t={}){let n=t.clock??a,r=t.motion??v,i=e.timing??`transition`,o=e.ease??s,c=r.duration(e.duration,i),l=e.delay?r.duration(e.delay,i):0,{update:u,signal:d}=e,f=n.now(),p=`running`,m,h,g=new Promise(e=>{h=e}),_=e=>{p=e,m?.(),m=void 0,d?.removeEventListener(`abort`,y),h(e)};function y(){p===`running`&&_(`cancelled`)}let b=!1;function x(){p!==`running`||b||(b=!0,S(1),p===`running`&&_(`done`))}function S(e){try{u(o(e))}catch(e){throw y(),e}}let C=e=>{if(r.mode===`off`){x();return}let t=e-f-l;t>=c?x():t>0&&S(t/c)},w={finished:g,get state(){return p},cancel:y,finish:x};return d?.aborted?(_(`cancelled`),w):(d?.addEventListener(`abort`,y,{once:!0}),c<=0&&l<=0?(x(),w):(S(0),p===`running`&&(m=n.onFrame(C)),w))}let b=(e,t)=>n=>e*(1-n)+t*n,x=(e,t)=>n=>({x:e.x*(1-n)+t.x*n,y:e.y*(1-n)+t.y*n});function S(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])];return r=>{if(r===1)return{...t};let i={};for(let a of n)i[a]=(e[a]??0)*(1-r)+(t[a]??0)*r;return i}}function C(e,t,n={}){let{onChange:r,...i}=n,a=e,o=e,l,u=!1,d=e=>{a=e,r?.(e)},f=()=>{let e=l;l=void 0,u=!1,e?.cancel()};return{get value(){return a},get target(){return l?.state===`cancelled`?a:o},get animating(){return l?.state===`running`},to(e,n){let r=l?.state===`running`&&u&&!(n.delay&&n.delay>0);f(),o=e;let p=t(a,e),m=!1,h=y({duration:n.duration,timing:n.timing,ease:n.ease??(r?c:s),delay:n.delay,signal:n.signal,update:e=>{m&&(u=!0),m=!0,d(p(e))}},i);return l=h,h.finished},set(e){f(),o=e,d(e)},stop(){f(),o=a}}}function w(e){T(e);let{from:n,to:r,duration:i,onFrame:l}=e,u=e.ease??o,d=e.timing??`playback`,f=e.clock??a,p=e.motion??v,m=Math.min(n,r),h=Math.max(n,r),g=r,_=!1,y=!1,b,x=0,S=new Set,C=e=>{for(let n of[...S])if(S.has(n))try{n(e)}catch(e){t(e)}},w=()=>{let e=b;return b=void 0,e?.stop(),e?.moved??!1},D=()=>{_&&(_=!1,C(`pause`))},O=e=>{throw x++,w(),D(),e},k=e=>{if(e!==g){g=e;try{l(e)}catch(e){O(e)}}},A=(e,t,n,r)=>{let i=x;if(!(t>0)){k(e),x===i&&r();return}let a=g,o=f.now(),s={moved:!1,stop:f.onFrame(c=>{let l=p.mode===`off`?1:(c-o)/t;if(l<1){s.moved=!0;let t;try{t=n(l)}catch(e){return O(e)}k(a+(e-a)*t)}else w(),k(e),x===i&&r()})};b=s},j=()=>{_=!1,C(`end`)};return{get position(){return g},get playing(){return _},play(){if(y||_)return;let e=++x;if(w(),_=!0,C(`play`),x!==e)return;let t=p.duration(i,d);t>0&&g===r&&(k(n),x!==e)||A(r,t*Math.abs(r-g)/Math.abs(r-n),u,j)},pause(){!y&&_&&(x++,w(),D())},seek(e,t={}){if(E(e,t),y)return;let n=++x,r=w();if(D(),x!==n||(C(`seek`),x!==n))return;let i=t.animate===!1?0:p.duration(350,`transition`);A(Math.min(Math.max(e,m),h),i,r?c:s,()=>{})},subscribe(e){if(typeof e!=`function`)throw TypeError(`playback.subscribe needs a function, got ${typeof e}.`);if(y)return()=>{};let t=t=>e(t);return S.add(t),()=>{S.delete(t)}},destroy(){y||(y=!0,x++,w(),D(),S.clear())}}}function T(e){if(typeof e!=`object`||!e)throw TypeError(`playback needs options: { from, to, duration, onFrame }.`);let{from:t,to:n,duration:r,ease:i,timing:a,onFrame:o,clock:s,motion:c}=e;for(let[e,r]of[[`from`,t],[`to`,n]])if(!D(r))throw RangeError(`playback: ${e} must be a finite number, got ${String(r)}.`);if(t===n)throw RangeError(`playback: from and to must differ, got ${t} for both.`);if(!D(r)||r<0)throw RangeError(`playback: duration must be a non-negative number of ms, got ${String(r)}.`);if(typeof o!=`function`)throw TypeError(`playback: onFrame must be a function, got ${typeof o}.`);if(i!==void 0&&typeof i!=`function`)throw TypeError(`playback: ease must be a function, got ${typeof i}.`);if(a!==void 0&&!f.includes(a))throw RangeError(`playback: timing must be one of ${f.join(`, `)}, got ${JSON.stringify(a)??String(a)}.`);if(s!==void 0&&(typeof s?.now!=`function`||typeof s.onFrame!=`function`))throw TypeError(`playback: clock must be a Clock, such as one from createClock() or manualClock().`);if(c!==void 0&&typeof c?.duration!=`function`)throw TypeError("playback: motion must be a Motion, such as the page-wide `motion` or one from createMotion().")}function E(e,t){if(!D(e))throw RangeError(`playback.seek needs a finite number, got ${String(e)}.`);if(typeof t!=`object`||!t)throw TypeError(`playback.seek's options must be an object, such as { animate: false }.`);if(t.animate!==void 0&&typeof t.animate!=`boolean`)throw TypeError(`playback.seek: animate must be true or false, got ${String(t.animate)}.`)}function D(e){return typeof e==`number`&&Number.isFinite(e)}let O=2*Math.PI;function k(e,t,n=0){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i);return{kind:`line`,from:e,to:t,length:a,angle:a>0?Math.atan2(i,r):P(n)}}function A(e,t,n,r){return{kind:`arc`,center:e,radius:t,start:n,sweep:r,length:t*Math.abs(r)}}function j(e,t){if(e.kind===`line`){let{from:n,to:r}=e;return{x:n.x*(1-t)+r.x*t,y:n.y*(1-t)+r.y*t}}return N(e.center,e.radius,e.start+e.sweep*t)}function M(e,t){if(e.kind===`line`)return e.angle;let n=e.sweep<0?-Math.PI/2:Math.PI/2;return P(e.start+e.sweep*t+n)}function N(e,t,n){return{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}}function P(e){return e-O*Math.ceil((e-Math.PI)/O)}function F(e){if(e.kind===`line`)return[e.from,e.to];let t=[j(e,0),j(e,1)];for(let n=0;n<4;n++){let r=n*Math.PI/2;ee(e,r)&&t.push(N(e.center,e.radius,r))}return t}function I(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let{x:a,y:o}of e)a<t&&(t=a),a>r&&(r=a),o<n&&(n=o),o>i&&(i=o);return{x:t,y:n,width:r-t,height:i-n}}function ee(e,t){let n=Math.abs(e.sweep);return n>=O||((e.sweep>=0?t-e.start:e.start-t)%O+O)%O<=n}function L(e){let t=Math.round(e*1e3)/1e3;return t===0?`0`:String(t)}function R(e){return`M${L(e.x)},${L(e.y)}`}function z(e,t=0,n=1){if(e.kind===`line`){let t=n===1?e.to:j(e,n);return`L${L(t.x)},${L(t.y)}`}let r=e.start+e.sweep*t,i=e.sweep*(n-t),a=Math.max(1,Math.ceil(Math.abs(i)/Math.PI-1e-9)),o=L(e.radius),s=+(i>=0),c=``;for(let t=1;t<=a;t++){let n=N(e.center,e.radius,r+i*t/a);c+=`A${o},${o} 0 0 ${s} ${L(n.x)},${L(n.y)}`}return c}function B(e,t=!1){let n=e[0];if(!n)return``;let r=e.length;if(t){for(;r>0&&e[r-1].length<=0;)r--;r>0&&e[r-1].kind===`line`&&r--}let i=R(j(n,0));for(let t=0;t<r;t++){let n=e[t];n.length>0&&(i+=z(n))}return t?`${i}Z`:i}let V=e=>e>0?e<1?e:1:0,H=Object.freeze([]);function U(e,t=H){let n=e[0],r=e[e.length-1];if(!n||!r)throw RangeError(`A walk needs at least one segment.`);let i=[0];for(let t of e)i.push(i[i.length-1]+t.length);let a=i[e.length],o=j(n,0),s=j(r,1),c=t=>{if(!(a>0))return{index:0,u:0};if(t>=a){let t=e.length-1;for(;t>0&&!(e[t].length>0);)t--;return{index:t,u:1}}let n=0,r=e.length-1;for(;n<r;){let e=n+r>>1;i[e+1]>t?r=e:n=e+1}return{index:n,u:Math.min(1,(t-i[n])/e[n].length)}},l=t=>{let n=V(t);if(n===0)return o;if(n===1)return s;let{index:r,u:i}=c(n*a);return j(e[r],i)},u=(t,n)=>{let r=R(l(t)),o=t*a,s=n*a;if(!(s>o))return r;let u=c(o);for(let t=u.index;t<e.length&&i[t]<s;t++){let n=e[t];if(!(n.length>0))continue;let a=t===u.index?u.u:0,o=i[t+1]>s?Math.min(1,(s-i[t])/n.length):1;o>a&&(r+=z(n,a,o))}return r},d=(e,n)=>{let r=V(Math.min(e,n)),i=V(Math.max(e,n));if(t.length===0)return u(r,i);let a=``,o=r;for(let[e,n]of t){if(e>=i)break;e>o&&(a+=u(o,e)),n>o&&(o=n)}return i>o&&(a+=u(o,i)),a===``?R(l(r)):a};return{segments:e,length:a,start:o,end:s,gaps:t,point:l,angle(t){let{index:n,u:r}=c(V(t)*a);return M(e[n],r)},slice:d,d:t.length===0?B(e):d(0,1)}}function W(e){let t=e.map(e=>U(e));return{d:B(e.flat(),!0),closed:!0,sample(e){se(e,4);let n=e/4,r=[];for(let e of t)for(let t=0;t<n;t++)r.push(e.point(t/n));return r}}}function G(e){let t=e.map(e=>e.reduce((e,t)=>e+t.length,0)),n=0;t.forEach((e,r)=>{e>t[n]&&(n=r)});let r=te(e[n])<0,i=e.map(e=>r?ne(e):e),a=re(i[n]),o=U(a);return{d:[a,...i.filter((e,t)=>t!==n)].map(e=>B(e,!0)).join(``),closed:!0,sample(e){se(e,4);let t=e/4,n=[];for(let e=0;e<4;e++)for(let r=0;r<t;r++)n.push(o.point(e/4+r/t/4));return n}}}function te(e){let t=0;for(let n of e){if(n.kind===`line`){t+=n.from.x*n.to.y-n.to.x*n.from.y;continue}let{center:e,radius:r,start:i,sweep:a}=n,o=i+a;t+=r*(e.x*(Math.sin(o)-Math.sin(i))-e.y*(Math.cos(o)-Math.cos(i)))+r*r*a}return t/2}function ne(e){return e.map(e=>e.kind===`line`?k(e.to,e.from):A(e.center,e.radius,e.start+e.sweep,-e.sweep)).reverse()}function re(e){let t=0,n=0,r=1/0,i=1/0,a=(e,a,o)=>{let s=e.x+e.y;(s<r-1e-9||s<=r+1e-9&&e.y<i)&&([t,n,r,i]=[a,o,s,e.y])};e.forEach((e,t)=>{if(a(j(e,0),t,0),e.kind===`arc`){let n=((e.sweep>=0?ae-e.start:e.start-ae)%O+O)%O/Math.abs(e.sweep);n<1&&a(j(e,n),t,n)}});let[o,s]=ie(e[t],n);return[s,...e.slice(t+1),...e.slice(0,t),o].filter(e=>e.length>0)}function ie(e,t){if(e.kind===`line`){let n=j(e,t);return[k(e.from,n),k(n,e.to)]}let{center:n,radius:r,start:i,sweep:a}=e;return[A(n,r,i,a*t),A(n,r,i+a*t,a*(1-t))]}let ae=-3*Math.PI/4;function oe(e){return{d:e.d,closed:!1,sample(t){if(se(t,1),t===1)return[e.start];let n=[];for(let r=0;r<t;r++)n.push(e.point(r/(t-1)));return n}}}function se(e,t){if(!Number.isInteger(e)||e<0||e%t!==0){let n=t===1?`a whole number ≥ 0`:`a whole multiple of ${t}`;throw RangeError(`outline.sample(n): n must be ${n}, got ${e}.`)}}function ce({key:e,series:t,walk:n,thickness:r,outline:i,bounds:a,center:o,pivot:s,labelBounds:c,nearbyLabels:l,segments:u}){return{key:e,...t===void 0?{}:{series:t},start:n.start,end:n.end,length:n.length,path:e=>n.point(e),angle:e=>n.angle(e),slice:(e,t)=>n.slice(e,t),...n.gaps.length===0?{}:{gaps:n.gaps},thickness:r,outline:i,bounds:a,center:o,pivot:s,...c===void 0?{}:{labelBounds:c},...l===void 0?{}:{nearbyLabels:l},...u===void 0?{}:{segments:u}}}function le(e,t,n){if(!Number.isFinite(n))throw RangeError(`describe.${e}: ${t} must be a finite number, got ${n}.`);return n}function ue(e,t,n=`labelBounds`){if(!t)return t;for(let r=0;r<t.length;r++){let{x:i,y:a,width:o,height:s}=t[r];Number.isFinite(i)&&Number.isFinite(a)&&Number.isFinite(o)&&o>=0&&Number.isFinite(s)&&s>=0||(le(e,`${n}[${r}].x`,i),le(e,`${n}[${r}].y`,a),de(e,`${n}[${r}].width`,o),de(e,`${n}[${r}].height`,s))}return t}function de(e,t,n){if(!(Number.isFinite(n)&&n>=0))throw RangeError(`describe.${e}: ${t} must be a finite number ≥ 0, got ${n}.`);return n}function fe(e){let{key:t,series:n}=e,r={x:le(`arc`,`cx`,e.cx),y:le(`arc`,`cy`,e.cy)},i=Math.min(de(`arc`,`inner`,e.inner),de(`arc`,`outer`,e.outer)),a=Math.max(e.inner,e.outer);le(`arc`,`start`,e.start),le(`arc`,`end`,e.end);let o=Math.max(-O,Math.min(O,e.end-e.start)),s=e.start-Math.PI/2,c=s+o,[l,u]=o>=0?[a,i]:[i,a],d=[[A(r,l,s,o)],[k(N(r,l,c),N(r,u,c),c+(l>u?Math.PI:0))],[A(r,u,c,-o)],[k(N(r,u,s),N(r,l,s),s+(l>u?0:Math.PI))]],f=U([A(r,(i+a)/2,s,o)]);return ce({key:t,series:n,walk:f,thickness:a-i,outline:W(d),bounds:I(d.flat().flatMap(F)),center:f.point(.5),pivot:r,labelBounds:ue(`arc`,e.labelBounds),nearbyLabels:ue(`arc`,e.nearbyLabels,`nearbyLabels`)})}let pe={left:0,right:Math.PI,top:Math.PI/2,bottom:-Math.PI/2};function me(e){let{key:t,series:n,baseline:r,x:i,y:a,width:o,height:s}=e;if(!Object.prototype.hasOwnProperty.call(pe,r))throw RangeError(`describe.bar: baseline must be left, right, top or bottom, got ${String(r)}.`);le(`bar`,`x`,i),le(`bar`,`y`,a),de(`bar`,`width`,o),de(`bar`,`height`,s);let c=de(`bar`,`radius`,e.radius??0),l=de(`bar`,`gap`,e.gap??0),u=ue(`bar`,e.labelBounds),d=ue(`bar`,e.nearbyLabels,`nearbyLabels`),f=r===`left`||r===`right`,p=f?o:s,m=f?s:o,h=m,g=pe[r],_=he(e),v=(e,t,n,r)=>{let i=Math.max(0,Math.min(n,t-e,h/2)),a=W([[k(_(e,0),_(t-i,0),g)],i>0?[A(_(t-i,i),i,g-Math.PI/2,Math.PI/2),k(_(t,i),_(t,h-i),g+Math.PI/2),A(_(t-i,h-i),i,g,Math.PI/2)]:[k(_(t,0),_(t,h),g+Math.PI/2)],[k(_(t-i,h),_(e,h),g+Math.PI)],[k(_(e,h),_(e,0),g-Math.PI/2)]]),o=U([k(_(e,h/2),_(t,h/2),g)]);return ce({...r,walk:o,thickness:m,outline:a,bounds:r.bounds??I([_(e,0),_(t,h)]),center:_((e+t)/2,h/2),pivot:o.start})},y=e.segments??[{series:n,size:p}],b=new Set,x=0,S=y.map((e,n)=>{if(de(`bar`,`segments[${n}].size`,e.size),e.series!==void 0){if(b.has(e.series))throw Error(`describe.bar: series "${e.series}" appears twice in the segments of "${t}".`);b.add(e.series)}let r=Math.min(x,p);x+=e.size;let i=Math.min(x,p);return{segment:e,index:n,p0:Math.min(r+Math.min(l,r),i),p1:i}}).map(({segment:e,index:n,p0:r,p1:i})=>v(r,i,c-(p-i),{key:e.series===void 0?`${t}/${n}`:`${t}/${e.series}`,series:e.series}));return v(0,p,c,{key:t,series:n,bounds:{x:i,y:a,width:o,height:s},labelBounds:u,nearbyLabels:d,segments:S})}function he({x:e,y:t,width:n,height:r,baseline:i}){switch(i){case`left`:return(n,r)=>({x:e+n,y:t+r});case`right`:return(i,a)=>({x:e+n-i,y:t+r-a});case`top`:return(r,i)=>({x:e+n-i,y:t+r});case`bottom`:return(n,i)=>({x:e+i,y:t+r-n})}}function ge(e){let{key:t,series:n,points:r}=e,i=de(`line`,`width`,e.width??1),a=r[0];if(!a)throw RangeError(`describe.line: "${t}" needs at least one point.`);r.forEach((e,t)=>{le(`line`,`points[${t}].x`,e.x),le(`line`,`points[${t}].y`,e.y)});let o=ve(e.breaks,r.length),s=[];for(let e=1;e<r.length;e++)s.push(k(r[e-1],r[e],s[s.length-1]?.angle??0));s.length===0&&s.push(k(a,a));let c=U(s,_e(o,s)),l=I(r),u=i/2;return ce({key:t,series:n,walk:c,thickness:i,outline:oe(c),bounds:{x:l.x-u,y:l.y-u,width:l.width+i,height:l.height+i},center:c.point(.5),pivot:a,labelBounds:ue(`line`,e.labelBounds),nearbyLabels:ue(`line`,e.nearbyLabels,`nearbyLabels`)})}function _e(e,t){let n=[0];for(let e of t)n.push(n[n.length-1]+e.length);let r=n[n.length-1];return e.filter(e=>n[e]>n[e-1]).map(e=>[n[e-1]/r,n[e]/r])}function ve(e,t){if(e===void 0)return[];if(!Array.isArray(e))throw RangeError(`describe.line: breaks must be an array of point indices, got ${ye(e)}.`);let n=0;return e.forEach((e,r)=>{if(!(Number.isInteger(e)&&e>n&&e<t))throw RangeError(`describe.line: breaks[${r}] must be a whole number more than ${n} and less than ${t}, the number of points, got ${ye(e)}.`);n=e}),e}let ye=e=>typeof e==`string`?JSON.stringify(e):String(e);function be(e){let{key:t,series:n}=e,r={x:le(`point`,`x`,e.x),y:le(`point`,`y`,e.y)},i=de(`point`,`r`,e.r),a=Math.PI/2;return ce({key:t,series:n,walk:U([k(r,r)]),thickness:2*i,outline:W([[A(r,i,-3*a/2,a)],[A(r,i,-a/2,a)],[A(r,i,a/2,a)],[A(r,i,3*a/2,a)]]),bounds:{x:r.x-i,y:r.y-i,width:2*i,height:2*i},center:r,pivot:r,labelBounds:ue(`point`,e.labelBounds),nearbyLabels:ue(`point`,e.nearbyLabels,`nearbyLabels`)})}let xe=.1,Se=1e4;function K(e){let t=[],n,r={x:0,y:0},i=[],a=!1,o=e=>{a&&t.push({start:n,end:r,segments:i,closed:e}),i=[],a=!1},s=e=>{a||(n=r,a=!0),r=e},c=e=>{e.length!==0&&i.push(e)},l=(e,t)=>c(k(e,t)),u=e=>{for(let t=1;t<e.length;t++)l(e[t-1],e[t])};for(let t=0;t<e.length;t++){let i=e[t],d=r;switch(i.op){case`M`:o(!1),r=i.to,e[t+1]&&e[t+1].op!==`M`&&(n=r,a=!0);break;case`Z`:s(n??r),l(d,r),o(!0);break;case`L`:s(i.to),l(d,r);break;case`C`:s(i.to),u(Ce(d,i.c1,i.c2,i.to));break;case`Q`:s(i.to),u(Ce(d,i.c,i.to));break;case`A`:s(i.to);for(let e of Ee(d,i))c(e)}}return o(!1),t}function Ce(...e){let t=e.length===4,n=t?we(e[0],e[1],e[2],e[3]):q(1,2*Te(e[0],e[1],e[2])),r=[e[0]];for(let i=1;i<n;i++){let a=i/n,o=1-a,[s,c,l,u]=t?[o*o*o,3*o*o*a,3*o*a*a,a*a*a]:[o*o,2*o*a,a*a,0];r.push({x:s*e[0].x+c*e[1].x+l*e[2].x+(t?u*e[3].x:0),y:s*e[0].y+c*e[1].y+l*e[2].y+(t?u*e[3].y:0)})}return r.push(e[e.length-1]),r}function we(e,t,n,r){return q(1,6*Math.max(Te(e,t,n),Te(t,n,r)))}function Te(e,t,n){return Math.hypot(e.x-2*t.x+n.x,e.y-2*t.y+n.y)}function q(e,t){let n=Math.ceil(e*Math.sqrt(t/(8*xe)));return Number.isFinite(n)?Math.min(Se,Math.max(1,n)):Se}function Ee(e,t){let{to:n,large:r,sweep:i}=t;if(e.x===n.x&&e.y===n.y)return[];let{rx:a,ry:o}=t;if(!(a>0&&o>0))return[k(e,n)];let s=Math.abs(a-o)<=1e-9*Math.max(a,o),c=s?0:t.rotation*Math.PI/180,l=Math.cos(c),u=Math.sin(c),d=(e.x-n.x)/2,f=(e.y-n.y)/2,p=l*d+u*f,m=-u*d+l*f,h=p*p/(a*a)+m*m/(o*o);h>1&&(a*=Math.sqrt(h),o*=Math.sqrt(h));let g=a*a,_=o*o,v=g*m*m+_*p*p,y=(r===i?-1:1)*Math.sqrt(Math.max(0,(g*_-v)/v)),b=y*a*m/o,x=-y*o*p/a,S={x:l*b-u*x+(e.x+n.x)/2,y:u*b+l*x+(e.y+n.y)/2},C=Math.atan2((m-x)/o,(p-b)/a),w=Math.atan2((-m-x)/o,(-p-b)/a)-C;if(i&&w<0?w+=O:!i&&w>0&&(w-=O),s)return[A(S,a,C,w)];let T=q(Math.abs(w),Math.max(a,o)),E=e=>{let t=a*Math.cos(e),n=o*Math.sin(e);return{x:S.x+l*t-u*n,y:S.y+u*t+l*n}},D=[],j=e;for(let e=1;e<=T;e++){let t=e===T?n:E(C+w*e/T);D.push(k(j,t)),j=t}return D}let De={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},Oe=/[\s,]*([A-Za-z]|[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)/y,ke=/^[A-Za-z]$/;function Ae(e){let t=[];Oe.lastIndex=0;for(let n=Oe.exec(e);n;n=Oe.exec(e))t.push(n[1]);let n=[],r={x:0,y:0},i=r,a,o=``,s=0;for(;s<t.length;){if(ke.test(t[s]))o=t[s++];else if(o===``||o===`Z`||o===`z`)break;let e=o.toUpperCase();if(e===`Z`){n.push({op:`Z`,to:i}),r=i,a=void 0;continue}let c=De[e];if(c===void 0)break;let l=[],u=!1;for(;l.length<c&&s<t.length&&!ke.test(t[s]);){let n=t[s];if(e===`A`&&(l.length===3||l.length===4)){let e=n[0];if(e!==`0`&&e!==`1`){u=!0;break}l.push(Number(e)),n.length>1?t[s]=n.slice(1):s++}else l.push(Number(n)),s++}if(u||l.length<c||!l.every(Number.isFinite))break;let d=o!==e,f=(e,t)=>d?{x:r.x+e,y:r.y+t}:{x:e,y:t},[p=0,m=0,h=0,g=0,_=0,v=0,y=0]=l,b;switch(e){case`M`:r=i=f(p,m),n.push({op:`M`,to:r}),o=d?`l`:`L`;break;case`L`:n.push({op:`L`,to:r=f(p,m)});break;case`H`:n.push({op:`L`,to:r={x:d?r.x+p:p,y:r.y}});break;case`V`:n.push({op:`L`,to:r={x:r.x,y:d?r.y+p:p}});break;case`C`:case`S`:{let t=e===`S`,i=t?a&&je(n,`C`)?Me(a,r):r:f(p,m);b=t?f(p,m):f(h,g),n.push({op:`C`,c1:i,c2:b,to:r=t?f(h,g):f(_,v)});break}case`Q`:case`T`:{let t=e===`T`;b=t?a&&je(n,`Q`)?Me(a,r):r:f(p,m),n.push({op:`Q`,c:b,to:r=t?f(p,m):f(h,g)});break}case`A`:n.push({op:`A`,rx:Math.abs(p),ry:Math.abs(m),rotation:h,large:g!==0,sweep:_!==0,to:r=f(v,y)})}a=b}return n}let je=(e,t)=>e[e.length-1]?.op===t,Me=(e,t)=>({x:2*t.x-e.x,y:2*t.y-e.y});function Ne(e,t){let n=e=>{let n=Number.parseFloat(t(e)??``);return Number.isFinite(n)?n:0};switch(e){case`path`:return Ae(t(`d`)??``);case`circle`:return Pe(n(`cx`),n(`cy`),n(`r`),n(`r`));case`ellipse`:return Pe(n(`cx`),n(`cy`),n(`rx`),n(`ry`));case`line`:return[{op:`M`,to:{x:n(`x1`),y:n(`y1`)}},{op:`L`,to:{x:n(`x2`),y:n(`y2`)}}];case`polyline`:case`polygon`:{let n=(t(`points`)??``).trim().split(/[\s,]+/).filter(Boolean).map(Number),r=[];for(let e=0;e+1<n.length&&Number.isFinite(n[e])&&Number.isFinite(n[e+1]);e+=2)r.push({x:n[e],y:n[e+1]});if(r.length<2)return[];let i=r.map((e,t)=>({op:t===0?`M`:`L`,to:e}));return e===`polygon`?[...i,{op:`Z`,to:r[0]}]:i}case`rect`:return Fe(n(`x`),n(`y`),n(`width`),n(`height`),t);default:return[]}}function Pe(e,t,n,r){if(!(n>0&&r>0))return[];let i=e=>({op:`A`,rx:n,ry:r,rotation:0,large:!1,sweep:!0,to:{x:e,y:t}});return[{op:`M`,to:{x:e+n,y:t}},i(e-n),i(e+n),{op:`Z`,to:{x:e+n,y:t}}]}function Fe(e,t,n,r,i){if(!(n>0&&r>0))return[];let a=e=>{let t=Number.parseFloat(i(e)??``);return t>=0?t:void 0},o=Math.min(a(`rx`)??a(`ry`)??0,n/2),s=Math.min(a(`ry`)??a(`rx`)??0,r/2),c=(e,t)=>({op:`L`,to:{x:e,y:t}});if(!(o>0&&s>0))return[{op:`M`,to:{x:e,y:t}},c(e+n,t),c(e+n,t+r),c(e,t+r),{op:`Z`,to:{x:e,y:t}}];let l=(e,t)=>({op:`A`,rx:o,ry:s,rotation:0,large:!1,sweep:!0,to:{x:e,y:t}});return[{op:`M`,to:{x:e+o,y:t}},c(e+n-o,t),l(e+n,t+s),c(e+n,t+r-s),l(e+n-o,t+r),c(e+o,t+r),l(e,t+r-s),c(e,t+s),l(e+o,t),{op:`Z`,to:{x:e+o,y:t}}]}function Ie(e,t){let n=e=>({x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}),r=t[0]*t[3]-t[1]*t[2]<0;return e.map(e=>{switch(e.op){case`M`:case`L`:case`Z`:return{op:e.op,to:n(e.to)};case`C`:return{op:`C`,c1:n(e.c1),c2:n(e.c2),to:n(e.to)};case`Q`:return{op:`Q`,c:n(e.c),to:n(e.to)};case`A`:return{...e,...Le(e,t),sweep:r!==e.sweep,to:n(e.to)}}})}function Le({rx:e,ry:t,rotation:n},r){let i=n*Math.PI/180,a=Math.cos(i),o=Math.sin(i),s=(r[0]*a+r[2]*o)*e,c=(r[2]*a-r[0]*o)*t,l=(r[1]*a+r[3]*o)*e,u=(r[3]*a-r[1]*o)*t,d=s*s+c*c,f=s*l+c*u,p=l*l+u*u,m=(d+p)/2,h=Math.hypot((d-p)/2,f),g=m+h,_=Math.abs(f)<1e-12?d>=p?0:Math.PI/2:Math.atan2(g-d,f);return{rx:Math.sqrt(g),ry:Math.sqrt(Math.max(0,m-h)),rotation:_*180/Math.PI}}function Re(e){let t=L,n=e=>`${t(e.x)},${t(e.y)}`;return e.map(e=>{switch(e.op){case`M`:case`L`:return`${e.op}${n(e.to)}`;case`C`:return`C${n(e.c1)} ${n(e.c2)} ${n(e.to)}`;case`Q`:return`Q${n(e.c)} ${n(e.to)}`;case`A`:return`A${t(e.rx)},${t(e.ry)} ${t(e.rotation)} ${+!!e.large} ${+!!e.sweep} ${n(e.to)}`;case`Z`:return`Z`}}).join(``)}function ze(e){let{key:t,series:n,d:r}=e,i=e.width??1;if(!(Number.isFinite(i)&&i>0))throw RangeError(`describe.shape: width must be a finite number more than 0, got ${i}.`);let a=He(e.matrix);if(typeof r!=`string`)throw RangeError(`describe.shape: d must be path data, a string, got ${Ue(r)}.`);let o=Ae(r),s=o[0]?.op===`M`?K(a?Ie(o,a):o):[];if(s.length===0)throw RangeError(`describe.shape: d must start with a move and draw something after it, got ${Ue(r)}.`);let c=[],l=0;for(let e of s){c.push(e.start);for(let t of e.segments){for(let e of F(t))c.push(e);l+=t.length}}let u=I(c);if(![u.x,u.y,u.width,u.height,l].every(Number.isFinite))throw RangeError(`describe.shape: d must stay finite${a?` once moved by matrix`:``}, got ${Ue(r)}.`);let d=ue(`shape`,e.labelBounds),f=ue(`shape`,e.nearbyLabels,`nearbyLabels`);if(s.every(Be)&&l>0){let e={x:u.x+u.width/2,y:u.y+u.height/2};return ce({key:t,series:n,walk:U([k(e,e)]),thickness:Math.min(u.width,u.height),outline:G(s.map(e=>e.segments).filter(e=>e.length>0)),bounds:u,center:e,pivot:e,labelBounds:d,nearbyLabels:f})}let{segments:p,gaps:m}=Ve(s),h=U(p,m),g=i/2;return ce({key:t,series:n,walk:h,thickness:i,outline:oe(h),bounds:{x:u.x-g,y:u.y-g,width:u.width+i,height:u.height+i},center:h.point(.5),pivot:h.start,labelBounds:d,nearbyLabels:f})}let Be=({closed:e,start:t,end:n})=>e||t.x===n.x&&t.y===n.y;function Ve(e){let t=[],n=[],r;for(let i of e){r&&(r.x!==i.start.x||r.y!==i.start.y)&&(n.push(t.length),t.push(k(r,i.start)));for(let e of i.segments)t.push(e);r=i.end}t.length===0&&t.push(k(e[0].start,e[0].start));let i=[0];for(let e of t)i.push(i[i.length-1]+e.length);let a=i[i.length-1];return{segments:t,gaps:n.map(e=>[i[e]/a,i[e+1]/a])}}function He(e){if(e===void 0)return e;if(!(Array.isArray(e)&&e.length===6&&e.every(Number.isFinite)))throw RangeError(`describe.shape: matrix must be six finite numbers [a, b, c, d, e, f], got ${Ue(e)}.`);return e}function Ue(e){return Array.isArray(e)?`[${e.map(Ue).join(`, `)}]`:typeof e==`string`?JSON.stringify(e.length>40?`${e.slice(0,40)}…`:e):String(e)}let We={bar:me,arc:fe,line:ge,point:be,shape:ze};function Ge(e,t){return[1,0,0,1,e,t]}function Ke(e,t){let n=Math.cos(e),r=Math.sin(e);return Ze([n,r,-r,n,0,0],t)}function qe(e,t=e,n){return Ze([e,0,0,t,0,0],n)}function Je(...e){let t=[1,0,0,1,0,0];for(let n of e)t=Xe(t,n);return t}function Ye(e,t){let[n,r,i,a,o,s]=e;return{x:n*t.x+i*t.y+o,y:r*t.x+a*t.y+s}}function Xe(e,t){let[n,r,i,a,o,s]=e,[c,l,u,d,f,p]=t;return[n*c+i*l,r*c+a*l,n*u+i*d,r*u+a*d,n*f+i*p+o,r*f+a*p+s]}function Ze(e,t){if(!t)return e;let[n,r,i,a]=e;return[n,r,i,a,t.x-n*t.x-i*t.y,t.y-r*t.x-a*t.y]}let J={translate:Ge,rotate:Ke,scale:qe,multiply:Je,apply:Ye};function Qe(e){let[t,n,r,i,a,o]=e,s=t*i-n*r;if(!Number.isFinite(s)||Math.abs(s)<1e-12)throw RangeError(`This transform can't be inverted: it has no area.`);return[i/s,-n/s,-r/s,t/s,(r*o-i*a)/s,(n*a-t*o)/s]}function $e(e){let t=[];for(let[,n,r=``]of e.matchAll(/(matrix|translate|scale|rotate|skewX|skewY)\s*\(([^)]*)\)/g)){let e=r.trim().split(/[\s,]+/).filter(Boolean).map(Number);if(!e.every(Number.isFinite))continue;let[i=0,a,o,s=0,c=0,l=0]=e,u=e=>e*Math.PI/180;switch(n){case`matrix`:e.length===6&&t.push([i,a,o,s,c,l]);break;case`translate`:t.push(Ge(i,a??0));break;case`scale`:t.push(qe(i,a??i));break;case`rotate`:t.push(Ke(u(i),a!==void 0&&o!==void 0?{x:a,y:o}:void 0));break;case`skewX`:t.push([1,0,Math.tan(u(i)),1,0,0]);break;case`skewY`:t.push([1,Math.tan(u(i)),0,1,0,0])}}return Je(...t)}function et(e,t,n){return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}let tt=(Math.sqrt(5)-1)/2;function nt(e,t){if(typeof e!=`object`||!e||typeof e.path!=`function`||!Number.isFinite(e.length))throw TypeError(`samplesAlong needs a MarkGeometry, as describe builds it.`);if(!Array.isArray(t))throw TypeError(`samplesAlong needs an array of points { x, y, value, at? }.`);t.forEach((e,t)=>{for(let n of[`x`,`y`,`value`]){let r=e?.[n];if(typeof r!=`number`||!Number.isFinite(r))throw RangeError(`samplesAlong: points[${t}].${n} must be a finite number, got ${String(r)}.`)}});let n=e.length>0?Math.min(4096,Math.ceil(e.length)+1):1,r=Array.from({length:n},(t,r)=>e.path(n===1?0:r/(n-1))),i=t.map((t,n)=>({index:n,sample:{t:it(e,r,t),value:t.value,...t.at===void 0?{}:{at:t.at}}})).sort((e,t)=>e.sample.t-t.sample.t||e.index-t.index).map(({sample:e})=>e);return e.gaps&&e.gaps.length>0?rt(i,e.gaps):i}function rt(e,t){let n=t.map(([e,t])=>(e+t)/2).sort((e,t)=>e-t),r=0;return e.map((t,i)=>{if(i===0)return t;let a=e[i-1].t;for(;r<n.length&&n[r]<=a;)r++;return r<n.length&&n[r]<=t.t?{...t,gapBefore:!0}:t})}function it(e,t,n){let r=t.length;if(r===1)return 0;let i=0,a=1/0;t.forEach((e,t)=>{let r=at(e,n);r<a&&(i=t,a=r)});let o=t=>at(e.path(t),n),s=Math.max(0,i-1)/(r-1),c=Math.min(r-1,i+1)/(r-1),l=c-tt*(c-s),u=s+tt*(c-s),d=o(l),f=o(u);for(let e=0;e<48;e++)d<=f?(c=u,u=l,f=d,l=c-tt*(c-s),d=o(l)):(s=l,l=u,d=f,u=s+tt*(c-s),f=o(u));let p=(s+c)/2,m=o(p)<a?p:i/(r-1);return m>0?m<1?m:1:0}function at(e,t){return(e.x-t.x)**2+(e.y-t.y)**2}function ot(e){let{kind:t,hint:n}=e,r=new Map,i={get:e=>r.get(e),resolve(e){let i=r.get(e);if(i!==void 0)return i;let a=r.size>0?[...r.keys()].join(`, `):`none`;throw RangeError(`Unknown ${t} "${String(e)}". Registered ${t}s: ${a}.${n?` ${n}`:``}`)},register(e,n){if(typeof e!=`string`||e===``)throw TypeError(`A ${t} needs a non-empty string name, got ${JSON.stringify(e)}.`);if(n===void 0)throw TypeError(`Registering ${t} "${e}" needs a value.`);r.set(e,n)},names:()=>[...r.keys()]};for(let[t,n]of Object.entries(e.entries??{}))i.register(t,n);return i}let st=[`hover`,`enter`,`update`,`exit`,`decorate`];function ct(e,t){let n={};for(let t of Object.keys(e??{}))if(!st.includes(t))throw TypeError(`on.${t} isn't an effect slot. Use one of: ${st.join(`, `)}.`);for(let r of st){let i=e?.[r];if(i!==void 0){if(typeof i==`string`){let e=t.resolve(i)();if(!lt(e))throw TypeError(`Preset "${i}" for on.${r} didn't return a mark effect; it returned ${ut(e)}.`);n[r]=e}else{if(!lt(i))throw TypeError(`on.${r} needs a mark effect (kind "geometry" or "data") or a preset name, got ${ut(i)}.`);n[r]=i}}}return n}function lt(e){if(typeof e!=`object`||!e)return!1;let t=e;return(t.kind===`geometry`||t.kind===`data`)&&typeof t.run==`function`&&typeof t.end==`function`&&typeof t.clear==`function`}function ut(e){if(typeof e!=`object`||!e)return e===null?`null`:typeof e;let t=e.kind;return t===`transition`?`a transition effect, which runs between two charts rather than on one mark`:t===`geometry`||t===`data`?`a ${t} effect without run(), end() and clear()`:t===void 0?`an object with no kind`:`an effect of kind ${JSON.stringify(t)}`}function dt(e,t){let n={...e};for(let[e,r]of Object.entries(t??{}))r===void 0?delete n[e]:n[e]=r;return n}let ft=12.5,pt=.6,mt=.16;function ht(e,t,n,r){return{x:(t===`end`?e.x-n:t===`middle`?e.x-n/2:e.x)-mt*r,y:e.y-1.05*r,width:n+2*mt*r,height:1.3*r}}function gt(e,t){return ht(t.at,t.anchor,e.length*ft*pt,ft)}function _t(e){let{clock:t,motion:n,layer:r,mark:i}=e,a=new AbortController,o=[];return{context:{signal:a.signal,motion:n,mark:i,layer:r,icons:e.icons,batch:e.batch,...e.previous?{previous:e.previous}:{},...e.texts?{texts:e.texts}:{},tween(e){let r=e.signal,i=y({...e,signal:r??a.signal},{clock:t,motion:n});return r&&r!==a.signal&&(a.signal.aborted?i.cancel():a.signal.addEventListener(`abort`,()=>i.cancel(),{once:!0})),i},onChange(e){o.push(e)}},abort(){a.abort()},change(e,t){for(let n of[...o])n(e,t)},clear(){a.abort(),r.clear(),i.reset(),o=[]}}}let vt=[`decorate`,`enter`,`update`,`exit`,`hover`],yt=(e,t)=>e.order-t.order,bt=(e,t)=>e===t||e!==void 0&&t!==void 0&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,xt={get:()=>void 0},St={place(){},update(){},remove(){}};function Ct(e){let{surface:n}=e,r=e.effects,i=e.motion??v,o=e.clock??a,s=e.icons??xt,c=new Map,l=new Set,u=!1,d=!1,f=0,p=(e,t)=>n.box?n.box(e,t):gt(e,t),m=new Map,h=0,g=!1,_=i.subscribe(()=>{i.mode===`off`&&P()});function y(e){let t=e.mark.key,n=c.get(t);if(n)return n.mark=e.mark,n.data=e.data,n;let r={key:t,mark:e.mark,data:e.data,resting:e.data,runs:new Map,applied:{},handle:void 0,exiting:void 0};return c.set(t,r),r}function b(e,t,n,a,c={}){let{previous:l,done:u}=c,d=r[t];if(!d){u?.();return}let h=e.runs.get(t);h&&w(h);let g={entry:e,slot:t,order:c.order??++f,effect:d,data:n,batch:a,previous:l,style:{},state:`running`,done:u,scope:_t({clock:o,motion:i,icons:s,batch:a,previous:l,layer:O(e.key,t,()=>g.order,()=>g.state!==`cleared`),mark:k(()=>g),texts:{box:p,held:()=>[...m].flatMap(([e,t])=>t.box&&e.order<g.order?[t.box]:[]),hold(e){g.state!==`cleared`&&E(g,e)}}})};e.runs.set(t,g);let _=c.mark??e.mark,v=g.scope.context;try{if(c.end||i.mode===`off`)d.kind===`data`?d.end(_,n,v):d.end(_,v),x(g);else{let e=d.kind===`data`?d.run(_,n,v):d.run(_,v);Promise.resolve(e).then(()=>x(g),e=>S(g,e))}}catch(e){S(g,e)}}function x(e){e.state===`running`&&(e.state=`ended`,C(e))}function S(e,n){let{signal:r}=e.scope.context;(!r.aborted||n!==r.reason&&n?.name!==`AbortError`)&&(t(n),w(e))}function C(e){let t=e.done;e.done=void 0,t?.()}function w(e){if(e.state===`cleared`)return;e.state=`cleared`;let{entry:n}=e;n.runs.get(e.slot)===e&&n.runs.delete(e.slot),e.scope.abort();try{e.effect.clear(e.scope.context)}catch(e){t(e)}e.scope.clear(),E(e,void 0),C(e)}function T(e,n){try{e.scope.change(n,I(e.entry,e))}catch(n){t(n),w(e)}}function E(e,t){let n=m.get(e);if(!n){if(!t)return;m.set(e,n={box:void 0,placed:0,moved:0})}n.placed=++h,bt(n.box,t)||(n.box=t,n.moved=h,g||(g=!0,queueMicrotask(D)))}function D(){let e=0;for(let[t,n]of[...m].sort(([e],[t])=>yt(e,t)))n.box&&n.placed<e&&T(t,t.entry.mark),n.box||m.delete(t),e=Math.max(e,n.moved);g=!1}function O(e,t,r,i){let a,o=()=>i()?a??(a=n.group(e,t,r())):void 0;return{icon:(e,t)=>o()?.icon(e,t)??St,path:(e,t)=>o()?.path(e,t)??St,text:(e,t)=>o()?.text(e,t)??St,clear(){let e=a;a=void 0,e?.clear()}}}function k(e){return{set(t){let n=e();n.state!==`cleared`&&(n.style=dt(n.style,t),A(n.entry))},reset(){let t=e();Object.keys(t.style).length!==0&&(t.style={},A(t.entry))}}}function A(e){let t=[...e.runs.values()].sort((e,t)=>e.order-t.order),n=Object.assign({},...t.map(e=>e.style)),r=e.applied;if(e.applied=n,Object.keys(n).length===0){Object.keys(r).length>0&&j(e).reset();return}let i={},a=!1;for(let e of new Set([...Object.keys(r),...Object.keys(n)]))r[e]!==n[e]&&(i[e]=n[e],a=!0);a&&j(e).set(i)}function j(e){return e.handle??(e.handle=n.mark(e.key))}function M(e){c.get(e.key)===e&&c.delete(e.key),l.delete(e.key);let t=e.exiting;e.exiting=void 0;for(let t of[...e.runs.values()])w(t);e.handle=void 0,t?.()}function N(e){let t=e.exiting;if(!t)return;e.exiting=void 0;let n=e.runs.get(`exit`);n&&w(n),t()}function P(){for(let e of[...c.values()])for(let t of[...e.runs.values()]){if(t.state!==`running`||e.runs.get(t.slot)!==t)continue;let n=t.done;t.done=void 0,b(e,t.slot,I(e,t),t.batch,{previous:t.previous,done:n,order:t.order})}}function F(e){let t=new Map;for(let n of[...c.values()]){let r=n.runs.get(e);r&&(t.set(n,r.order),w(r))}return t}function I(e,t){let n=t.data.previous;return n&&!e.data.previous?wt(e.data,n):e.data}return{enter(e){d||e.forEach((t,n)=>{let r=y(t);r.resting=t.data,N(r);let i={index:n,count:e.length};b(r,`decorate`,t.data,i),b(r,`enter`,t.data,i)})},update(e){if(d)return;let t=new Set(e.map(e=>e.mark.key));for(let e of[...c.values()]){let n=e.runs.get(`update`);n&&!t.has(e.key)&&w(n)}e.forEach((t,n)=>{let r=c.get(t.mark.key),i=t.from??r?.mark,a=r&&!t.data.previous?wt(t.data,r.resting):t.data,o=y(t);o.resting=t.data,b(o,`update`,a,{index:n,count:e.length},{previous:i})})},exit(e){if(d)return Promise.resolve();let t=e.map((t,n)=>{let i=y(t);N(i),l.delete(i.key);for(let e of[...i.runs.values()])w(e);return new Promise(a=>{i.exiting=a,r.exit?b(i,`exit`,t.data,{index:n,count:e.length},{done:()=>{i.exiting&&c.get(i.key)===i&&M(i)}}):M(i)})});return Promise.all(t).then(()=>void 0)},hover(e){d||e.forEach((t,n)=>{let r=y(t);r.exiting||(l.add(r.key),u||b(r,`hover`,t.data,{index:n,count:e.length}))})},leave(e=[...l]){for(let t of e){l.delete(t);let e=c.get(t)?.runs.get(`hover`);e&&w(e)}},change(e,t){let n=c.get(e.key);if(n){n.mark=e,t&&(n.data=t,u||(n.resting=t));for(let t of[...n.runs.values()].sort(yt))t.state!==`cleared`&&T(t,e)}},interrupt(){if(!d){u=!0;for(let e of[...c.values()]){let t=e.runs.get(`hover`);t&&w(t)}}},settle(){if(!u)return;u=!1;for(let e of c.values())e.exiting||(e.resting=e.data);let e=[...l];e.forEach((t,n)=>{let r=c.get(t);r&&b(r,`hover`,r.data,{index:n,count:e.length})})},swap(e,t){if(d)return;let n=vt.filter(t=>e[t]!==r[t]);r=e;for(let e of n)if(e===`decorate`){let n=F(e);t.forEach((r,i)=>{let a=c.get(r.mark.key)??y(r);a.exiting||b(a,e,r.data,{index:i,count:t.length},{mark:r.mark,order:n.get(a)})})}else if(e===`hover`){if(F(e),u)continue;let t=[...l];t.forEach((n,r)=>{let i=c.get(n);i&&b(i,e,i.data,{index:r,count:t.length})})}else for(let t of[...c.values()]){let n=t.runs.get(e);if(!n)continue;let r=n.done;n.done=void 0;let i=I(t,n);w(n),b(t,e,i,n.batch,{previous:n.previous,done:r,order:n.order,end:!0})}},destroy(){if(!d){d=!0,u=!1,_();for(let e of[...c.values()])M(e);l.clear()}}}}function wt(e,t){return{datum:e.datum,samples:e.samples,related:t=>e.related(t),previous:t}}let Tt={value:`Sorted highest first`,key:`Sorted A to Z`,none:`In data order`,custom:`Sorted`};function Et(e){let t=[],{series:n}=e;e.label===void 0?n&&(n.length!==1||n[0]!==`value`)&&t.push(`Showing ${Dt(n)}`):t.push(e.label),e.sort&&t.push(Tt[e.sort]);let{changed:r,added:i,removed:a}=e;return!n&&r.length>0&&t.push(r.length<=3?`${Dt(r)} changed`:`${r.length} of ${e.count} changed`),i.length>0&&t.push(`Added ${i.length<=3?Dt(i):i.length}`),a.length>0&&t.push(`Removed ${a.length<=3?Dt(a):a.length}`),t.join(`. `)}function Dt(e){return e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function Ot(e){let t=e.ownerDocument.createElement(`div`);t.className=`ec-announcer ec-visually-hidden`,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-atomic`,`true`),e.after(t);let n=!1;return{say(e){e!==``&&(n=!n,t.textContent=n?e:`${e} `)},destroy(){t.remove()}}}let kt=`http://www.w3.org/2000/svg`;function Y(e,t={},n){let r=(n?.ownerDocument??document).createElementNS(kt,e);return X(r,t),n?.appendChild(r),r}function X(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.removeAttribute(n):e.setAttribute(n,typeof r==`number`?L(r):r)}function At(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.style.removeProperty(n):e.style.setProperty(n,r)}function jt({width:e,height:t}){return{width:e,height:t,viewBox:`0 0 ${L(e)} ${L(t)}`}}function Mt(e){let[t,n,r,i,a,o]=e;return`matrix(${[t,n,r,i].map(Nt).join(` `)} ${L(a)} ${L(o)})`}function Nt(e){let t=Math.round(e*1e6)/1e6;return t===0?`0`:String(t)}function Pt(e,t,n,r){return ht(e,e.anchor,t(e.text.replace(/\d/g,`0`),n,r),r)}function Ft(e,t){X(e,{x:t.x,y:t.y,"text-anchor":t.anchor}),e.textContent!==t.text&&(e.textContent=t.text)}function It(e){let t=new Map;return Object.assign((n,r,i)=>{if(n===``)return 0;let a=`${r}\n${i}\n${n}`,o=t.get(a);if(o!==void 0)return o;let s=0,c=Y(`text`,{class:r,visibility:`hidden`,"aria-hidden":`true`},e);return typeof c.getComputedTextLength==`function`&&e.isConnected&&(c.textContent=n,s=c.getComputedTextLength()),c.remove(),s>0?(t.set(a,s),s):n.length*i*pt},{clear:()=>t.clear()})}let Lt=12.5,Rt=12.5,zt={label:!0,value:!0},Bt=.36;function Vt(e){let{x:t,y:n,stack:r,data:i}=e,a=e.orientation;if(a!==void 0&&a!==`horizontal`&&a!==`vertical`)throw TypeError(`barChart: orientation must be "horizontal" or "vertical", got ${String(a)}.`);if(r!==void 0){if(!Array.isArray(r)||r.length===0)throw TypeError(`barChart: stack needs at least one numeric field.`);let e=new Set;for(let t of r){if(e.has(t))throw TypeError(`barChart: "${t}" appears twice in stack.`);e.add(t)}}if(a===void 0){if(t!==void 0&&n!==void 0){let e=cn(i,sn(t));if(e!==cn(i,sn(n)))a=e?`horizontal`:`vertical`;else if(i.length===0)a=`horizontal`;else throw RangeError(`barChart: ${e?`x and y both hold numbers`:`neither x nor y holds numbers`}, so it can't tell which is the category. Set orientation: "horizontal" (categories along y) or "vertical" (categories along x).`)}else if(r!==void 0&&(t!==void 0||n!==void 0))a=n===void 0?`vertical`:`horizontal`;else throw TypeError(`barChart needs x and y (the axis whose values aren't numbers is the category), or one of them plus stack.`)}let o=a===`horizontal`,s=o?n:t,c=o?t:n;if(s===void 0)throw TypeError(`barChart: a ${a} chart takes its categories from ${o?`y`:`x`}.`);let l=sn(s),u;if(r!==void 0)u=r.map(e=>({series:e,value:sn(e)}));else if(c!==void 0)u=[{series:typeof c==`string`?c:`value`,value:sn(c)}];else throw TypeError(`barChart needs values: ${o?`x`:`y`} set to a numeric field, or stack.`);return{orientation:a,category:l,key:e.key===void 0?l:sn(e.key),series:u}}function Ht(e){let t=Qt(Zt(e),e.sort),n=$t(t.map(e=>e.total)),r=t.map(t=>e.format(t.total)),i=n.ticks.map(e.format),a=r=>(e.encoding.orientation===`horizontal`?tn:nn)(e,t,n,r,i),o=a(r),s=Ut(o,t,r,e.measure);return s.values||(s=Ut(o=a(),t,r,e.measure,!1)),{width:o.bands.width,height:o.bands.height,orientation:o.orientation,frame:o,rows:t.map((t,n)=>Jt(o,{...t,slot:n,text:r[n],drawn:{label:n%s.every===0,value:s.values}},e.measure)),ticks:n.ticks.map((e,t)=>Yt(o,e,i[t])),labels:s}}function Ut(e,t,n,r,i=!0){let a=t.map((t,r)=>qt(e,r,t.total,t.category,n[r])),o=e.orientation===`horizontal`;i&&(i=!Kt(Gt(a.map(({value:e})=>e),r,`ec-value`,Rt),o));let s=e=>Gt(a.filter((t,n)=>n%e===0).map(({label:e})=>e),r,`ec-label`,Lt),c=0;for(;Wt(c)<t.length&&Kt(s(Wt(c)),o);)c++;return{every:Wt(c),values:i}}let Wt=e=>[1,2,5][e%3]*10**Math.floor(e/3);function Gt(e,t,n,r){return e.filter(e=>e.text!==``).map(e=>Pt(e,t,n,r))}function Kt(e,t){let n=t?e.map(({x:e,y:t,width:n,height:r})=>({x:t,y:e,width:r,height:n})):[...e];n.sort((e,t)=>e.x-t.x);let r=[];for(let e of n){for(let t=r.length-1;t>=0;t--)r[t].x+r[t].width<=e.x&&r.splice(t,1);if(r.some(t=>t.y<e.y+e.height&&e.y<t.y+t.height))return!0;r.push(e)}return!1}function qt(e,t,n,r,i){let{scale:a,bands:o}=e,s=n<0,c=Xt(a)(n),l=o.start+t*o.band;if(e.orientation===`horizontal`){let e=l+o.band/2+Lt*Bt;return{label:{x:a.label,y:e,anchor:`end`,text:r},value:{x:s?c-6:c+6,y:e,anchor:s?`end`:`start`,text:i}}}let u=l+o.band/2;return{label:{x:u,y:a.label,anchor:`middle`,text:r},value:{x:u,y:s?c+6+Rt*.8:c-6,anchor:`middle`,text:i}}}function Jt(e,t,n){let{scale:r,bands:i}=e,a=Xt(r),o=Math.abs(r.extent/(r.hi-r.lo)),s=t.values.reduce((e,t)=>e+t.value,0),c=s<0,l=a(0),u=a(s),d=i.start+t.slot*i.band,f={key:t.key,...t.values.length===1?{series:t.values[0].series}:{},radius:4,gap:2,segments:t.values.map(e=>({series:e.series,size:Math.max(0,c?-e.value:e.value)*o}))},p=t.drawn??zt,m={key:t.key,datum:t.datum,index:t.index,slot:t.slot,values:t.values,total:s,category:t.category,drawn:p},{label:h,value:g}=qt(e,t.slot,s,p.label?t.category:``,p.value?t.text:``),_=()=>[...Gt([h],n,`ec-label`,Lt),...Gt([g],n,`ec-value`,Rt)];if(e.orientation===`horizontal`){let e=me({...f,x:Math.min(l,u),y:d+(i.band-i.thickness)/2,width:Math.abs(u-l),height:i.thickness,baseline:c?`right`:`left`,labelBounds:_()});return{...m,geometry:e,data:an(t.datum,s,e),label:h,value:g,hit:{x:0,y:d,width:i.width,height:i.band}}}let v=d+i.band/2,y=me({...f,x:v-i.thickness/2,y:Math.min(l,u),width:i.thickness,height:Math.abs(u-l),baseline:c?`top`:`bottom`,labelBounds:_()});return{...m,geometry:y,data:an(t.datum,s,y),label:h,value:g,hit:{x:d,y:0,width:i.band,height:i.height}}}function Yt(e,t,n){let{bands:r}=e,i=Xt(e.scale)(t);if(e.orientation===`horizontal`){let e=r.start+r.span;return{value:t,line:{x1:i,y1:r.start,x2:i,y2:e},label:{x:i,y:e+16,anchor:`middle`,text:n}}}return{value:t,line:{x1:r.start,y1:i,x2:r.start+r.span,y2:i},label:{x:r.start-8,y:i+11*Bt,anchor:`end`,text:n}}}function Xt(e){let t=e.extent/(e.hi-e.lo);return n=>e.from+(n-e.lo)*t}function Zt({data:e,encoding:t}){let n=new Set;return e.map((e,r)=>{let i=String(t.key(e,r));if(n.has(i))throw Error(`barChart: two rows have the key "${i}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(i);let a=t.series.map(({series:t,value:n})=>({series:t,value:ln(n(e,r),t,i)}));if(a.some(e=>e.value>0)&&a.some(e=>e.value<0))throw RangeError(`barChart: the stack for "${i}" mixes positive and negative values, which isn't supported yet.`);let o=a.reduce((e,t)=>e+t.value,0);return{key:i,category:String(t.category(e,r)??``),datum:e,index:r,values:a,total:o}})}function Qt(e,t){if(t===void 0||t===`none`)return e;if(t===`value`)return[...e].sort((e,t)=>t.total-e.total);if(t===`key`)return[...e].sort((e,t)=>e.key.localeCompare(t.key,void 0,{numeric:!0}));if(typeof t==`function`)return[...e].sort((e,n)=>t(e.datum,n.datum));throw TypeError(`barChart: sort must be "value", "key", "none" or a comparator, got ${String(t)}.`)}function $t(e){let t=e.reduce((e,t)=>Math.min(e,t),0),n=e.reduce((e,t)=>Math.max(e,t),0);t===n&&(n=1);let r=en((n-t)/4);t=un(Math.floor(t/r)*r),n=un(Math.ceil(n/r)*r);let i=Math.round((n-t)/r),a=Array.from({length:i+1},(e,n)=>un(t+n*r));return{lo:t,hi:n,ticks:a}}function en(e){let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function tn(e,t,n,r,i){let{width:a,measure:o}=e,s=t.length,c=on(t.map(e=>e.category),`ec-label`,Lt,o),l=r?on(r,`ec-value`,Rt,o)+6:0,u=on(i,`ec-tick`,11,o),{positive:d,negative:f}=rn(e,t),p=n.lo<0?l:0,m=Math.max(c+10+p+f,u/2+2),h=Math.max(l+4+d,u/2+2),g=e.height===void 0||s===0?34:Math.max(0,e.height-4-26)/s;return{orientation:`horizontal`,scale:{lo:n.lo,hi:n.hi,from:m,extent:Math.max(0,a-m-h),label:m-10-p},bands:{start:4,band:g,thickness:g*20/34,span:s*g,width:a,height:e.height??4+s*g+26}}}function nn(e,t,n,r,i){let{width:a,measure:o}=e,s=t.length,c=e.height??300,l=on(i,`ec-tick`,11,o),{positive:u,negative:d}=rn(e,t),f=(r&&n.hi>0?20.5:4)+u,p=r&&n.lo<0?18.5:0,m=26+p+d,h=l+8+2,g={x:h,y:f,width:Math.max(0,a-h-8),height:Math.max(0,c-f-m)},_=s>0?g.width/s:0,v=g.y+g.height;return{orientation:`vertical`,scale:{lo:n.lo,hi:n.hi,from:v,extent:-g.height,label:v+p+18},bands:{start:g.x,band:_,thickness:Math.min(_*20/34,72),span:g.width,width:a,height:c}}}function rn(e,t){let n=e.room??0;return{positive:t.some(e=>e.total>0)?n:0,negative:t.some(e=>e.total<0)?n:0}}function an(e,t,n){let r=e=>n.length>0?t*e/n.length:0,i={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related(t){let a=n.segments?.find(e=>e.series===t);if(!a)return;let o=Math.hypot(a.start.x-n.start.x,a.start.y-n.start.y);return{datum:e,samples:[{t:0,value:r(o)},{t:1,value:r(o+a.length)}],related:i.related}}};return i}function on(e,t,n,r){return e.reduce((e,i)=>Math.max(e,r(i,t,n)),0)}function sn(e){return typeof e==`function`?e:t=>t[e]}function cn(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=t(e[r],r);if(i!=null){if(typeof i!=`number`)return!1;n=!0}}return n}function ln(e,t,n){if(e==null)return 0;if(typeof e==`number`&&Number.isFinite(e))return e;throw RangeError(`barChart: "${t}" for "${n}" must be a finite number, got ${typeof e==`string`?JSON.stringify(e):String(e)}.`)}function un(e){let t=Number(e.toPrecision(12));return t===0?0:t}let dn={light:{surface:`#fcfcfb`,text:`#0b0b0b`,"text-muted":`#75736d`,grid:`#e1e0d9`,axis:`#c3c2b7`,focus:`#2a78d6`,negative:`#d03b3b`,ring:`rgba(11, 11, 11, 0.1)`,"dim-opacity":`0.3`,series:[[`#2a78d6`,`#1c5cab`],[`#eb6834`,`#c24d1d`],[`#02a471`,`#07835a`],[`#c28409`,`#9d6a07`],[`#8966da`,`#6e49ba`],[`#0096b0`,`#05778c`],[`#7a8a05`,`#606d03`],[`#c34e97`,`#a32f7a`]]},dark:{surface:`#1a1a19`,text:`#f0efec`,"text-muted":`#8f8d86`,grid:`#2c2c2a`,axis:`#45453f`,focus:`#3987e5`,negative:`#e66767`,ring:`rgba(255, 255, 255, 0.1)`,"dim-opacity":`0.3`,series:[[`#3987e5`,`#6da7ec`],[`#d95926`,`#fb7747`],[`#199e70`,`#45bc8c`],[`#c98500`,`#eda100`],[`#936fe4`,`#af8ffe`],[`#0b99b3`,`#40b7d2`],[`#829401`,`#9eb237`],[`#c8529c`,`#e970ba`]]}},fn=[`surface`,`text`,`text-muted`,`grid`,`axis`,`focus`,`negative`],Z=Object.fromEntries(fn.map(e=>[e,dn.light[e]]));function pn(e){let t=(Math.max(1,Math.floor(e))-1)%8+1,[n,r]=dn.light.series[t-1];return{color:`var(--ec-series-${t}, ${n})`,strong:`var(--ec-series-${t}-strong, ${r})`}}function mn(e){if(e===`mark`)return`var(--ec-mark, ${pn(1).color})`;if(e===`mark-strong`)return`var(--ec-mark-strong, ${pn(1).strong})`;let t=Z[e];if(t!==void 0)return`var(--ec-${e}, ${t})`;let n=/^series-(\d+)(-strong)?$/.exec(e);if(n){let e=pn(Number(n[1]));return n[2]?e.strong:e.color}return e}function hn(e){return{"--ec-mark":e?.color,"--ec-mark-strong":e?.strong}}function gn(e,t){let n=[...fn,`ring`,`dim-opacity`].map(t=>`--ec-${t}: ${e[t]};`);return e.series.forEach(([e,t],r)=>n.push(`--ec-series-${r+1}: ${e};`,`--ec-series-${r+1}-strong: ${t};`)),n.map(e=>t+e).join(`
|
|
2
2
|
`)}let _n=`/* expressive-charts: theme tokens and default styles. Every rule has zero specificity, so your CSS wins. */
|
|
3
3
|
${`:where(:root, [data-theme="light"]) {
|
|
4
4
|
${gn(dn.light,` `)}
|
|
@@ -87,11 +87,11 @@ ${gn(dn.dark,` `)}
|
|
|
87
87
|
:where(.ec-table thead th) { color: var(--ec-text-muted, ${Z[`text-muted`]}); font-size: 12px; font-weight: 600; }
|
|
88
88
|
:where(.ec-table .ec-num) { text-align: right; }
|
|
89
89
|
:where(.ec-table-caption, .ec-visually-hidden) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
|
|
90
|
-
`,vn=`data-expressive-charts`,yn={};function bn(e){if(yn.injectStyles===!1||e.querySelector(`style[${vn}]`))return;let t=e.createElement(`style`);t.setAttribute(vn,``),yn.nonce&&t.setAttribute(`nonce`,yn.nonce),t.textContent=_n,(e.head??e.documentElement).appendChild(t)}function xn(e={}){let t=new Map;for(let[n,r]of Object.entries(e)){if(!Number.isInteger(r)||r<1||r>8)throw RangeError(`colorAssignment: the slot for "${n}" must be a whole number from 1 to 8, got ${String(r)}.`);t.set(n,r)}return{slot(e){let n=t.get(e);if(n===void 0){let r=new Set(t.values());for(n=1;r.has(n)&&n<=8;)n++;n>8&&(n=t.size%8+1),t.set(e,n)}return n}}}function Sn(e){return e&&typeof e.slot==`function`?e:xn(e)}function Cn(e,t){if(e===void 0||typeof e==`boolean`)return;let n=e=>{throw TypeError(`${t}: ${e}`)};(typeof e!=`object`||!e||Array.isArray(e))&&n(`legend must be true or false, or an object with the entries the page adds.`);let{entries:r}=e;r!==void 0&&(Array.isArray(r)||n(`legend.entries must be an array of { label, color }.`),r.forEach((e,t)=>{let{label:r,color:i}=typeof e==`object`&&e?e:n(`legend.entries[${t}] must be an object with a label and a color.`);(typeof r!=`string`||r.trim()===``)&&n(`legend.entries[${t}].label must be a non-empty string: the entry's name.`),(typeof i!=`string`||i.trim()===``)&&n(`legend.entries[${t}].color must be a theme token or a CSS colour.`),(i===`mark`||i===`mark-strong`)&&n(`legend.entries[${t}].color can't be "${i}": an entry has no mark. Use a theme token or a CSS colour.`)}))}let wn=e=>typeof e==`object`?e.entries??[]:[];function Tn(e){let t,n=``,r=()=>{t?.remove(),t=void 0,n=``},i=(r,i,a,o)=>{let s=[...r.map(({key:e,label:t})=>({key:e,label:t,styles:hn(pn(i.slot(e)))})),...o.map(({label:e,color:t})=>({key:void 0,label:e,styles:{"--ec-mark":mn(t)}}))],c=e.ownerDocument;t??(t=Object.assign(c.createElement(`div`),{className:`ec-legend`})),t.nextSibling!==e&&e.before(t);let l=JSON.stringify([a,s]);l!==n&&(n=l,t.replaceChildren(...s.map(({key:e,label:t,styles:n})=>{let r=c.createElement(`span`);r.className=`ec-legend-item`,e!==void 0&&r.setAttribute(a,e);for(let[e,t]of Object.entries(n))t!==void 0&&r.style.setProperty(e,t);let i=c.createElement(`span`);i.className=`ec-legend-swatch`;let o=c.createElement(`span`);return o.className=`ec-legend-label`,o.textContent=t,r.append(i,o),r})))};return{update(e,t,n){let a=wn(n);n===!1||e.length+a.length<2?r():i(e.map(({series:e,label:t})=>({key:e,label:t})),t,`data-series`,a)},categories(e,t,n){n===!1||e.length===0?r():i(e,t,`data-key`,wn(n))},destroy:r}}let En=e=>e!==void 0&&e.source!==`linked`,Dn=new WeakMap,On=new WeakSet,kn=e=>e.parts?[e,...e.parts]:[e];function An(e,t){return Dn.set(t,e),t}let jn=e=>Dn.get(e);function Mn(e,n={}){if(!Array.isArray(e))throw TypeError(`link needs an array of charts, chart switches and attachments: link([columns, line]).`);if(typeof n!=`object`||!n)throw TypeError(`link: options must be an object, such as { by: (event) => event.data.datum.week }.`);let{by:r,effects:i=!0}=n;if(r!==void 0&&typeof r!=`function`)throw TypeError(`link: by must be a function, such as (event) => event.data.datum.week.`);if(typeof i!=`boolean`)throw TypeError(`link: effects must be true or false, got ${String(i)}.`);let a=[],o=new Set;for(let t of e){let e=typeof t==`object`&&t?Dn.get(t):void 0;if(!e)throw TypeError(`link: each source must be a chart (barChart, donutChart or lineChart), a chartSwitch or an attachment (expressive or fromVegaView).`);let n=kn(e);if(n.some(e=>On.has(e)||o.has(e)))throw TypeError(`link: a chart, chart switch or attachment can be in one link at a time, and a chart switch's views' charts go with it. Destroy the link it's in first.`);for(let e of n)o.add(e);a.push(e)}let s=new Set,c,l=new Set;function u(e){let n;if(r)try{n=r(e)}catch(e){t(e);return}else{let{samples:t}=e.data;n=t[t.length-1]?.at??e.mark.key}return n instanceof Date?Number.isNaN(n.getTime())?void 0:n.toISOString():n==null?void 0:String(n)}function d(e,t){if(t.size===0)return[];let n=e=>e.some(e=>{let n=u(e);return n!==void 0&&t.has(n)});return e.targets().flatMap(e=>n(e.marks)?[e.key]:[])}function f(e,t){c=e;let n=new Set(t.map(u));n.delete(void 0),l=n;for(let t of s)if(t!==e&&(t.hover(d(t,n),i),c!==e))return}function p(e){if(c===e){c=void 0,l=new Set;for(let e of s)e.unlink()}}for(let e of a)if(e.listen({hover:t=>f(e,t),leave:()=>p(e),dismiss(){let e=c;e?.leave(),e&&p(e)},shown(){c!==void 0&&c!==e&&s.has(e)&&e.hover(d(e,l),i)},gone(){s.delete(e);for(let t of kn(e))On.delete(t);p(e)}})){s.add(e);for(let t of kn(e))On.add(t)}return{destroy(){for(let e of s){e.listen(void 0),e.unlink();for(let t of kn(e))On.delete(t)}s.clear(),c=void 0,l=new Set}}}let Nn=[`presentation`,`analysis`,`off`];function Pn(e,t){if(e===void 0)return t;if(typeof e!=`string`)return e;if(!Nn.includes(e))throw TypeError(`Unknown motion mode "${String(e)}". Use one of: ${Nn.join(`, `)}.`);let n=()=>t.viewerChoice??(t.prefersReduced?`off`:e);return{get mode(){return n()},get staged(){return n()===`presentation`},duration(e,t=`transition`){let r=n();return r===`off`?0:m(e,u[r][t])},subscribe:e=>t.subscribe(e)}}let Fn=new WeakMap,In=0;function Ln(e){let t=e.ownerDocument,n=(Fn.get(t)??0)+1;Fn.set(t,n);let r=Y(`mask`,{id:`ec-focus-mask-${n}`,maskUnits:`userSpaceOnUse`,x:-1e5,y:-1e5,width:2e5,height:2e5},e);Y(`rect`,{x:-1e5,y:-1e5,width:2e5,height:2e5,fill:`white`},r);let i=Y(`path`,{stroke:`black`,"stroke-linejoin":`round`},r),a=Y(`path`,{class:`ec-focus-ring`,visibility:`hidden`,"stroke-linejoin":`round`,mask:`url(#${r.id})`},e);return At(a,{fill:`none`,stroke:mn(`focus`)}),{draw(e){if(!e){X(a,{visibility:`hidden`});return}let{outline:t,thickness:n,transform:r}=e,o=t.closed?0:n;X(i,{d:t.d,fill:t.closed?`black`:`none`,"stroke-width":o+4}),X(a,{d:t.d,"stroke-width":o+8,transform:r&&Mt(r),visibility:void 0})}}}function Rn(){let e,t=()=>{e?.remove(),e=void 0};return{paint(n,r,i,a){if(!i||!n||r.length===0){t();return}e&&e.parentNode===n||(e?.remove(),e=Y(`g`,{class:`ec-halo`},n)),e.textContent=``;let o=`ec-halo-mask-${++In}`,s=Y(`mask`,{id:o,maskUnits:`userSpaceOnUse`,x:-1e5,y:-1e5,width:2e5,height:2e5},e);Y(`rect`,{x:-1e5,y:-1e5,width:2e5,height:2e5,fill:`white`},s);for(let e of r){let t=e.stroke===void 0?{fill:`black`}:{fill:`none`,stroke:`black`,"stroke-width":e.stroke,"stroke-linejoin":`round`};Y(`path`,{d:e.d,...t},s)}X(e,{transform:a&&Mt(a)});for(let t of r){let n=t.stroke!==void 0;At(Y(`path`,{d:t.d,"stroke-width":i.width+(t.stroke??0),"stroke-opacity":i.opacity,"stroke-linejoin":`round`,"stroke-linecap":n?`round`:void 0,mask:`url(#${o})`},e),{fill:`none`,stroke:i.color===void 0?t.color??mn(`mark`):mn(i.color)})}},remove:t}}function zn(e,t={}){let n={},r,i=t.halos&&Rn(),a=()=>{let t=e();if(!t)return;let{body:r,parts:i}=t;X(r,{transform:n.transform&&Mt(n.transform),opacity:n.opacity});let a=n.emphasis;for(let e of i)At(e.element,{[e.open?`stroke`:`fill`]:a===void 0?void 0:Bn(e.colors,a),transition:a===void 0?void 0:`none`});o(r,i)},o=(e,a)=>{let o=n.halo;if(i){let e=a.flatMap(e=>e.visible?[{d:e.d,color:e.colors.color,...e.open?{stroke:e.open.width}:{}}]:[]);i.paint(t.halos?.(),e,o,n.transform);return}if(!o){r?.remove(),r=void 0;return}r&&r.parentNode===e||(r?.remove(),r=Y(`g`,{class:`ec-halo`},e),e.insertBefore(r,e.firstChild));let s=a.filter(e=>e.visible);for(;r.childElementCount>s.length;)r.lastElementChild?.remove();s.forEach((e,t)=>{let n=r.children[t]??Y(`path`,{"stroke-linejoin":`round`},r);X(n,{d:e.d,"stroke-width":o.width+(e.open?.width??0),"stroke-opacity":o.opacity,"stroke-linecap":e.open?`round`:void 0}),At(n,{fill:`none`,stroke:o.color===void 0?e.colors.color:mn(o.color)})})};return{get style(){return n},set(e){n=ft(n,e),a()},reset(){n={},a()},repaint:a}}function Bn(e,t){let n=Math.min(1,Math.max(0,t));return n===0?e.color:n===1?e.strong:`color-mix(in srgb, ${e.strong} ${Math.round(n*1e3)/10}%, ${e.color})`}let Vn=0;function Hn(e,t,n){let r=()=>{if(!t)return e;let n=e.lastElementChild;if(n?.getAttribute(`class`)===`ec-follow`)return n;let r=t();return Y(`g`,{class:`ec-follow`,transform:r&&Mt(r)},e)};return{icon(e,t){let n=t?.size;if(n!==void 0&&!(n>=0))throw RangeError(`layer.icon: size must be a non-negative number, got ${String(n)}.`);let i=Y(`g`,{class:`ec-icon`,"data-icon":e.name,visibility:`hidden`},r()),a=n===void 0||!(e.size>0)?1:n/e.size,o=a===1?i:Y(`g`,{transform:Mt(q.scale(a,a,e.anchor))},i);for(let t of e.shapes)Un(t,o);return{place(e){X(i,{transform:Mt(e),visibility:void 0})},remove:()=>i.remove()}},path(e,t){let i=Y(`path`,{class:`ec-path`,d:e},r()),a={...t};return Wn(i,a,n),{update(e,t){i.setAttribute(`d`,e),t&&(a=ft(a,t),Wn(i,a,n))},remove:()=>i.remove()}},text(t,n){let r=Y(`text`,{class:`ec-text`},e);r.textContent=t;let i={...n};return Gn(r,i),{update(e,t){i=ft(i,e),Gn(r,i),t!==void 0&&(r.textContent=t)},remove:()=>r.remove()}}}}function Un(e,t){let n;if(e.clip!==void 0){n=`ec-clip-${++Vn}`;let r=Y(`clipPath`,{id:n},t);Y(`path`,{d:e.clip},r)}At(Y(`path`,{d:e.d,"clip-path":n&&`url(#${n})`,"stroke-width":e.stroke===void 0?void 0:e.width??1,"stroke-linecap":e.linecap,"stroke-linejoin":e.linejoin,"fill-rule":e.fillRule,opacity:e.opacity,"fill-opacity":e.fillOpacity,"stroke-opacity":e.strokeOpacity},t),{fill:e.fill===void 0?`none`:mn(e.fill),stroke:e.stroke===void 0?void 0:mn(e.stroke)})}function Wn(e,t,n){let{part:r}=t;X(e,{"stroke-width":t.stroke===void 0?void 0:t.width??1,opacity:t.opacity,"stroke-linecap":t.linecap,"stroke-linejoin":`round`,"data-part":r}),At(e,{...hn(r===void 0?void 0:n?.(r)),fill:t.fill===void 0?`none`:mn(t.fill),stroke:t.stroke===void 0?void 0:mn(t.stroke)})}function Gn(e,t){X(e,{x:t.at.x,y:t.at.y,"text-anchor":t.anchor??`start`,opacity:t.opacity}),At(e,{fill:mn(t.color??`text`)})}function Kn(e){let{overlay:t}=e,n=e.measure??It(t),r=new WeakMap,i=new Map,a=new Set,o=new Set,s=new Map,c=(e,t)=>{if(t)s.set(e,t);else if(!s.delete(e))return;for(let n of i.get(e)??[])for(let e of Array.from(n.children))e.getAttribute(`class`)===`ec-follow`&&X(e,{transform:t&&Mt(t)})};return{group(n,c,l){let u=Y(`g`,{class:o.has(n)?`ec-run ec-hot`:`ec-run`,"data-key":n,"data-slot":c,visibility:a.has(n)?`hidden`:void 0},t);At(u,hn(e.colors(n))),r.set(u,l);let d=Array.from(t.children).find(e=>(r.get(e)??-1/0)>l);t.insertBefore(u,d??null);let f=i.get(n);f||i.set(n,f=new Set),f.add(u);let p=f;return{...Hn(u,()=>s.get(n),t=>e.colors(n,t)),clear(){u.remove(),p.delete(u),p.size===0&&i.get(n)===p&&i.delete(n)}}},box:(e,{at:t,anchor:r=`start`})=>Pt({x:t.x,y:t.y,anchor:r,text:e},n,`ec-text`,pt),mark(t){let n=e.mark(t);return{set(e){n.set(e),`transform`in e&&c(t,e.transform)},reset(){n.reset(),c(t,void 0)}}},recolor(t){let n=i.get(t);if(!n)return;let r=hn(e.colors(t));for(let i of n){At(i,r);for(let n of i.querySelectorAll(`[data-part]`))At(n,hn(e.colors(t,n.getAttribute(`data-part`))))}},hide(e,t){t?a.add(e):a.delete(e);for(let n of i.get(e)??[])X(n,{visibility:t?`hidden`:void 0})},hot(e,t){t?o.add(e):o.delete(e);for(let n of i.get(e)??[])n.classList.toggle(`ec-hot`,t)}}}function qn(e,t){return e!==void 0&&Object.prototype.hasOwnProperty.call(e,t)?e[t]??t:t}function Jn(e,t){if(e!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`${t}: seriesLabels must be an object of names by series, as { goals: "Goals" }.`);for(let[n,r]of Object.entries(e))if(typeof r!=`string`||r.trim()===``)throw TypeError(`${t}: seriesLabels.${n} must be a name, not ${typeof r==`string`?`blank`:String(r)}.`)}}function Yn(e){let n={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set};function r(e,r){for(let i of[...n[e]])try{i(r)}catch(e){t(e)}}return{emit:r,emitEach(e,t,n){t.forEach((i,a)=>r(e,{...n(i),batch:{index:a,count:t.length}}))},on(t,r){let i=n[t];if(!i)throw TypeError(`${e}: unknown event "${String(t)}". Use one of: ${Object.keys(n).join(`, `)}.`);return i.add(r),()=>{i.delete(r)}},clear(){for(let e of Object.values(n))e.clear()}}}function Xn(e){return e.format??Qn}let Zn;function Qn(e){return Zn??(Zn=new Intl.NumberFormat(void 0,{maximumFractionDigits:2})),Zn.format(e)}function $n(e){let t=String(Number(e.toPrecision(12)));if(/e/i.test(t))return 6;let n=t.indexOf(`.`);return n<0?0:Math.min(6,t.length-n-1)}function er(e,t){let n=10**t,r=Math.round(e*n)/n;return r===0?0:r}function tr(e){return`${er(e*100,0)}%`}function nr(e,t){let n=e.ownerDocument,r,i=`mouse`,a,o,s,c,l=(e,n)=>{c=e?.key,e?.key!==r&&(u(),e&&(r=e.key,t.hover(e,n)))},u=()=>{_(),r!==void 0&&(r=void 0,t.leave())},d=e=>{let n=t.tooltip?.();return n?.element&&e&&n.element.contains(e)?n:void 0},f=(t,n)=>{let r=e.getRootNode();return typeof r.elementFromPoint==`function`?r.elementFromPoint(t,n):void 0},p=e=>e.relatedTarget??f(e.clientX,e.clientY)??null,m=(n,r,i)=>{let a=d(n);a?g(a,r,i):l(n&&e.contains(n)?t.find(n,{x:r,y:i}):void 0,`pointer`)},h=e=>t.find(e.target,{x:e.clientX,y:e.clientY}),g=(e,t,n)=>{l({key:e.key},`pointer`);let r=e.element;a?.element===r?(a.x=t,a.y=n):(_(),a={element:r,x:t,y:n},r.addEventListener(`pointermove`,v),r.addEventListener(`pointerleave`,y),o=new MutationObserver(b),o.observe(r,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))},_=()=>{a&&(a.element.removeEventListener(`pointermove`,v),a.element.removeEventListener(`pointerleave`,y),o?.disconnect(),o=void 0,a=void 0)},v=e=>{a&&e.pointerType!==`touch`&&(a.x=e.clientX,a.y=e.clientY)},y=e=>{e.pointerType!==`touch`&&(_(),m(p(e),e.clientX,e.clientY))},b=()=>{if(!a)return;let{x:e,y:n}=a,i=f(e,n);if(i===void 0)return;let o=t.tooltip?.(),c=o?.element!==void 0&&i!==null&&o.element.contains(i);c&&o.key===r||(_(),!c&&o?.key!==r?(s={x:e,y:n},u()):m(i,e,n))},x=e=>s&&Math.abs(e.clientX-s.x)<1&&Math.abs(e.clientY-s.y)<1?!0:(s=void 0,!1),S=e=>{if(e.pointerType===`touch`||x(e))return;_();let n=h(e);t.moves?.()&&n?.key===c||l(n,`pointer`)},C=e=>{e.pointerType!==`touch`&&(s=void 0,m(p(e),e.clientX,e.clientY))},w=e=>{if(e.pointerType===`touch`||x(e)||!t.moves?.())return;let n=h(e);n?.key!==c&&(_(),l(n,`pointer`))},T=e=>{i=e.pointerType},E=e=>{i===`touch`&&l(h(e),`touch`)},D=t=>{if(r===void 0||t.pointerType!==`touch`)return;let n=t.composedPath()[0]??t.target;!e.contains(n)&&!d(n)&&u()};return e.addEventListener(`pointerover`,S),e.addEventListener(`pointerleave`,C),e.addEventListener(`pointermove`,w),e.addEventListener(`pointerdown`,T),e.addEventListener(`click`,E),n.addEventListener(`pointerdown`,D,!0),{get current(){return r},clear(){a&&(s={x:a.x,y:a.y}),u()},destroy(){_(),r=void 0,e.removeEventListener(`pointerover`,S),e.removeEventListener(`pointerleave`,C),e.removeEventListener(`pointermove`,w),e.removeEventListener(`pointerdown`,T),e.removeEventListener(`click`,E),n.removeEventListener(`pointerdown`,D,!0)}}}function rr(e,t){let n,r,i,a,o,s=[],c=!0,l=t.tabIndex??((e,n)=>{let r=t.element(e);n===void 0?r?.removeAttribute(`tabindex`):r?.setAttribute(`tabindex`,n)}),u=e=>{for(let t of e)l(t,t===o?`0`:`-1`)},d=e=>{o=e,u(t.order()),t.element(e)?.focus()},f=()=>{let e=r;r=void 0,e!==void 0&&t.blur(e)},p=e=>{e.metaKey||e.altKey||e.ctrlKey||(c=!0)},m=()=>{c=!1,a=void 0},h=e=>{a=void 0;let s=t.find(e.target);if(s===void 0){f();return}let l=t.element(s);l&&l!==e.target&&e.target.getAttribute(`aria-hidden`)===`true`&&(l.focus(),n?.scope.activeElement===l)||(i={key:s,element:e.target},s!==r&&(r=s,o=s,u(t.order()),t.focus(s,c)))},g=e=>{let n=i?.element;r!==void 0&&n&&e.target===n&&t.find(e.relatedTarget)===void 0&&(f(),e.relatedTarget===null&&(a=n,queueMicrotask(()=>{a===n&&n.isConnected&&(a=void 0)})))},_=e=>{let n=t.find(e.target);if(n===void 0||e.altKey||e.ctrlKey||e.metaKey)return;let r=t.order(),i=r.indexOf(n),a=(e,i)=>{let a=t.move?.(n,e);return a!==void 0&&r.includes(a)?a:i},o;switch(e.key){case`ArrowDown`:case`ArrowRight`:o=a(e.key,r[Math.min(r.length-1,i+1)]);break;case`ArrowUp`:case`ArrowLeft`:o=a(e.key,r[Math.max(0,i-1)]);break;case`PageDown`:case`PageUp`:{let a=e.key===`PageDown`?1:-1,s=t.page?.(n,a);o=s!==void 0&&r.includes(s)?s:r[Math.min(r.length-1,Math.max(0,i+a*Math.ceil(r.length/10)))];break}case`Home`:o=a(e.key,r[0]);break;case`End`:o=a(e.key,r[r.length-1]);break;case`Escape`:t.escape(n)&&e.preventDefault();return;default:return}e.preventDefault(),o!==void 0&&o!==n&&d(o)},v=()=>{n&&(n.doc.removeEventListener(`keydown`,p,!0),n.doc.removeEventListener(`pointerdown`,m,!0),n.scope.removeEventListener(`focusin`,h,!0),n.scope.removeEventListener(`focusout`,g,!0),n.svg.removeEventListener(`keydown`,_),n=void 0)},y=()=>{let t=e(),r=t?.getRootNode(),i=r&&`host`in r?r:t?.ownerDocument;(t!==n?.svg||i!==n?.scope)&&(v(),t&&i&&(n={svg:t,doc:t.ownerDocument,scope:i},n.doc.addEventListener(`keydown`,p,!0),n.doc.addEventListener(`pointerdown`,m,!0),n.scope.addEventListener(`focusin`,h,!0),n.scope.addEventListener(`focusout`,g,!0),n.svg.addEventListener(`keydown`,_)))};return y(),{active:()=>n?.scope.activeElement??null,focus(e){c=!0,e===r&&i?.element===n?.scope.activeElement?t.focus(e,!0):d(e)},sync(){y();let e=t.order(),c=new Set(e),p=s.filter(e=>!c.has(e));o!==void 0&&c.has(o)||(o=ir(s,o,c)??e[0]);let m=!n?.doc.activeElement||n.doc.activeElement===n.doc.body,h=i!==void 0&&!i.element.isConnected&&(r!==void 0||i.element===a&&m),g=i&&(i.element===n?.scope.activeElement||h)?i:void 0;a=void 0,g&&!c.has(g.key)?o===void 0?g.element.isConnected?g.element.blur():f():d(o):g&&t.find(g.element)!==g.key&&d(g.key),u(e);for(let e of p)l(e,void 0);s=e},retarget(e){y();let a=t.order(),c=new Set(a),d=n?.scope.activeElement??null,f=i?.element===d?i.key:s.find(e=>t.element(e)===d),p=f??o,m=p===void 0?void 0:e(p);o=m!==void 0&&c.has(m)?m:a[0],u(a),f!==void 0&&(r=o,o===void 0?(d.blur(),i=void 0):t.element(o)?.focus());for(let e of s)c.has(e)||l(e,void 0);return s=a,f===void 0?void 0:r},moveTabStop(e){y();let r=t.order();return!r.includes(e)||t.find(n?.scope.activeElement??null)!==void 0?!1:(o=e,u(r),!0)},destroy(){r=void 0,i=void 0,a=void 0,v()}}}function ir(e,t,n){let r=t===void 0?-1:e.indexOf(t);if(!(r<0))for(let t=1;t<e.length;t++)for(let i of[r+t,r-t]){let t=e[i];if(t!==void 0&&n.has(t))return t}}function ar(e){let{svg:t,runner:n,events:r}=e,i=t=>e.marks?.(t)??[t],a=t=>(e.markElement??e.element)(t),o=(t,n)=>{a(t)?.classList.toggle(`ec-hot`,n),e.hot?.(t,n)},s,c,l,u=!1,d=t=>t.flatMap(t=>{let n=e.onScreen(t);return n?[{key:t,input:n}]:[]}),f=e=>e.length===1?i(e[0]):[...new Set(e.flatMap(i))],p=t=>t.flatMap(t=>{let n=e.standIn?.(t);return n?[n]:[]}),m=(t,n,r)=>n===`linked`&&r.length===0?t.find(t=>e.standIn?.(t)!==void 0):void 0;function h(e,t,i,a){if(e.length===0)return;i&&n.hover(e.map(({input:e})=>e));let o=e.length;e.forEach(({input:e},n)=>r.emit(`hover`,{...e,batch:{index:n,count:o},source:t,...a===void 0?{}:{segment:a}}))}function g(e){for(let t of e)o(t,!1);let t=d(e);if(t.length===0)return;n.leave(t.map(({key:e})=>e));let i=t.length;t.forEach(({input:e},t)=>r.emit(`leave`,{...e,batch:{index:t,count:i}}))}function _(n,r,i,a=!0){let c=d(f(n)),u=m(n,r,c),g={keys:n,source:r,marks:c.map(e=>e.key),effects:a,standing:u};s=g;for(let{key:e}of c)o(e,!0);e.dim()&&t.classList.add(`ec-hovering`),r!==`linked`&&(e.tooltip.show(n[0]),x(!0)),u!==void 0&&e.stand?.(u),h(c,r,a,i),r!==`linked`&&s===g&&l?.hover(c.length>0?c.map(({input:e})=>e):p(n))}function v(){let n=s;s=void 0,x(!1),t.classList.remove(`ec-hovering`),e.tooltip.hide(),n?.standing!==void 0&&e.stand?.(void 0),g(n?.marks??[]),En(n)&&l?.leave()}let y,b=e=>{e.key===`Escape`&&!e.defaultPrevented&&s!==void 0&&S()};function x(e){y?.removeEventListener(`keydown`,b),y=e?t.ownerDocument:void 0,y?.addEventListener(`keydown`,b)}function S(){w.clear(),s!==void 0&&v()}let C=(t,n)=>n===t||e.live(t)&&i(t).includes(n),w=nr(t,{find:e.find,moves:()=>e.moves?.()??!1,hover(t,n){!e.live(t.key)||En(s)&&s.keys[0]===t.key||(v(),_([t.key],n,t.segment))},leave(){(s?.source===`pointer`||s?.source===`touch`)&&v()},tooltip:()=>En(s)?{key:s.keys[0],element:e.tooltip.element?.()}:void 0}),T=rr(()=>t,{find:t=>e.find(t)?.key,order:e.order,page:(t,n)=>e.page?.(t,n),move:(t,n)=>e.move?.(t,n),element:e.element,focus(t,n){c=n?t:void 0,e.ring(c),e.live(t)&&(n?En(s)&&s.keys[0]===t?s={...s,source:`keyboard`}:(v(),_([t],`keyboard`)):s?.source===`keyboard`&&s.keys[0]!==t&&v())},blur(){c=void 0,e.ring(c),s?.source===`keyboard`&&(w.current===s.keys[0]?s={...s,source:`pointer`}:v())},escape(){return s?(s.source===`linked`&&l?l.dismiss():v(),!0):!1}});return{get key(){return En(s)?s.keys[0]:void 0},get standing(){return s?.standing},get ringKey(){return c},link:{targets:()=>e.order().map(e=>{let t=d(i(e)).map(({input:e})=>e);return{key:e,marks:t.length>0?t:p([e])}}),hover(t,n){s!==void 0&&v();let r=t.filter(e.live);r.length>0&&_(r,`linked`,void 0,n)},unlink(){s?.source===`linked`&&v()},leave:S,listen(e){return!u&&(l=e,!0)}},active:()=>T.active(),restyled(t){c!==void 0&&C(c,t)&&e.ring(c);let n=En(s)?s.keys[0]:void 0;n!==void 0&&(s?.marks.includes(t)||t===n)&&e.live(n)&&e.tooltip.show(n)},syncDim(){e.dim()?s!==void 0&&t.classList.add(`ec-hovering`):t.classList.remove(`ec-hovering`)},dropGone(){if(s===void 0)return;let t=s.keys.filter(e.live);if(t.length===0){w.clear(),v();return}let{source:i,marks:a,effects:c}=s,l=d(f(t)),u=m(t,i,l);if(u!==s.standing&&e.stand?.(u),s={...s,keys:t,standing:u},l.length===a.length&&l.every((e,t)=>e.key===a[t]))return;let p=new Set(a),h=new Set(l.map(e=>e.key)),g=d(a.filter(e=>!h.has(e)));s={...s,marks:l.map(e=>e.key)};for(let e of a)h.has(e)||o(e,!1);for(let{key:e}of l)p.has(e)||o(e,!0);n.leave(a),c&&n.hover(l.map(({input:e})=>e)),g.forEach(({input:e},t)=>r.emit(`leave`,{...e,batch:{index:t,count:g.length}}));let _=l.length;l.forEach(({key:e,input:t},n)=>{p.has(e)||r.emit(`hover`,{...t,batch:{index:n,count:_},source:i})})},sync:()=>T.sync(),retarget(t){let n=T.retarget(t);c!==void 0&&(c=n,e.ring(c)),l?.shown()},focus(t){e.live(t)&&T.focus(t)},moveTabStop:t=>e.live(t)&&T.moveTabStop(t),leave:S,destroy(){u=!0,l?.gone(),l=void 0,x(!1),w.destroy(),T.destroy()}}}function or(e,t,n,r){return!n||n.text===``?[]:[{key:e,role:t,text:n.text,x:n.x,y:n.y,anchor:n.anchor,element:r}]}function sr(e){let t=new Map;return{get:e=>t.get(e),values:()=>t.values(),start(e){t.set(e.key,e),e.group.classList.add(`ec-leaving`),e.group.setAttribute(`aria-hidden`,`true`),e.leave=cr()},recall(e){let n=t.get(e);if(n)return t.delete(e),n.group.classList.remove(`ec-leaving`),n.group.removeAttribute(`aria-hidden`),n.leave?.resolve(),n.leave=void 0,n},sweep(){for(let n of[...t.values()]){let{leave:r}=n;r?.exited&&!e(n)&&(t.delete(n.key),n.leave=void 0,n.group.remove(),r.resolve())}},clear:()=>t.clear()}}function cr(){let e;return{exited:!1,gone:new Promise(t=>{e=t}),resolve:e}}function lr(e,t,n,r){if(!n.some((e,n)=>t[n]!==e))return;let i=r(),a=n.findIndex(e=>e===i),o=n[a]??null;n.forEach((t,n)=>{n<a?e.insertBefore(t,o):n>a&&e.appendChild(t)})}function ur(e,t){if(e===void 0||typeof e==`boolean`||e===`hidden`)return;let n=e=>{throw TypeError(`${t}: ${e}`)};typeof e==`object`&&e||n(`table must be true, false, "hidden" or an object of table options.`);let{hidden:r,columns:i,category:a,total:o,share:s,summary:c,series:l}=e;r!==void 0&&typeof r!=`boolean`&&n(`table.hidden must be true or false.`);for(let[e,t]of Object.entries({category:a,total:o,share:s,summary:c}))t!==void 0&&typeof t!=`string`&&n(`table.${e} must be a string.`);if(l!==void 0){(typeof l!=`object`||!l||Array.isArray(l))&&n(`table.series must be an object of headers by series, as { shots: "Shots" }.`);for(let[e,t]of Object.entries(l))typeof t!=`string`&&n(`table.series.${e} must be a string: the column's header.`)}i!==void 0&&(Array.isArray(i)||n(`table.columns must be an array of { label, field }.`),i.forEach((e,t)=>{let r=typeof e==`object`&&e?e:n(`table.columns[${t}] must be an object with a label and a field.`);typeof r.label!=`string`&&n(`table.columns[${t}].label must be a string: the column's header.`),typeof r.field!=`string`&&typeof r.field!=`function`&&n(`table.columns[${t}].field must be a field name or a function of the row.`),r.format!==void 0&&typeof r.format!=`function`&&n(`table.columns[${t}].format must be a function.`),r.after!==void 0&&r.after!==`category`&&r.after!==`values`&&n(`table.columns[${t}].after must be "category" or "values".`)}))}function dr(e){let{option:t,format:n}=e;if(t===!1)return;let r=typeof t==`object`?t:{},i=r.columns??[],a=i.filter(e=>e.after!==`values`),o=i.filter(e=>e.after===`values`),s=e.total??e.series.length>1,c=e=>({text:n(e),numeric:!0}),l=e.rows.reduce((e,t)=>e+t.total,0),u=t=>e.shares?[{text:tr(l>0?t/l:0),numeric:!0}]:[],d=e=>({text:e.label,numeric:!1}),f=e=>r.series&&Object.prototype.hasOwnProperty.call(r.series,e)?r.series[e]:void 0,p=()=>({text:``,numeric:!1}),m={text:e.missing??`missing`,numeric:!0},h=[{text:r.category??e.category??`Category`,numeric:!1},...a.map(d),...e.series.map(t=>({text:f(t)??e.label?.(t)??t,numeric:!0})),...s?[{text:r.total??`Total`,numeric:!0}]:[],...e.shares?[{text:r.share??`Share`,numeric:!0}]:[],...o.map(d)],g=e.rows.map(t=>{let r=new Map(t.values.map(e=>[e.series,e.value]));return{key:t.key,cells:[{text:t.category,numeric:!1},...a.map(e=>fr(e,t,n)),...e.series.map(e=>t.missing?.has(e)?m:c(r.get(e)??0)),...s?[c(t.total)]:[],...u(t.total),...o.map(e=>fr(e,t,n))]}}),_=t=>e.rows.reduce((e,n)=>e+(n.values.find(e=>e.series===t)?.value??0),0),v=e.shares?[{text:r.total??`Total`,numeric:!1},...a.map(p),...e.series.map(e=>c(_(e))),...s?[c(l)]:[],...u(l),...o.map(p)]:void 0,y=h.length-o.length,b=[...a.map((e,t)=>1+t),...o.map((e,t)=>y+t)];for(let e of b){let t=g.map(t=>t.cells[e]).filter(e=>e.text!==``);t.length>0&&t.every(e=>e.numeric)&&(h[e]={...h[e],numeric:!0})}return{hidden:t===`hidden`||r.hidden===!0,summary:r.summary??`Data table`,caption:e.caption,headers:h,rows:g,...v?{footer:v}:{}}}function fr(e,t,n){let r=typeof e.field==`function`?e.field(t.datum,t.index):t.datum?.[e.field];return e.format?{text:String(e.format(r)),numeric:typeof r==`number`}:r==null?{text:``,numeric:!1}:typeof r==`number`?{text:n(r),numeric:!0}:{text:String(r),numeric:!1}}function pr(e){let t=e.ownerDocument,n,r,i,a,o,s,c,l=new Map,u=``,d=(e,n)=>{let r=t.createElement(e);return n&&(r.className=n),r};function f(){i=d(`table`),a=d(`caption`,`ec-table-caption`);let e=d(`thead`);return o=d(`tr`),e.appendChild(o),s=d(`tbody`),i.append(a,e,s),i}function p(t,a){let o=t?`DIV`:`DETAILS`;if(n?.tagName!==o){let e=t?d(`div`,`ec-table ec-visually-hidden`):d(`details`,`ec-table`),a=i??f();if(t)r=void 0,e.appendChild(a);else{r=d(`summary`);let t=d(`div`,`ec-table-scroll`);t.appendChild(a),e.append(r,t)}n?.isConnected&&n.replaceWith(e),n=e}n.isConnected||e.after(n),r&&r.textContent!==a&&(r.textContent=a)}function m(e,{text:t,numeric:n}){e.textContent!==t&&(e.textContent=t),e.classList.toggle(`ec-num`,n)}function h(){n?.remove(),n=r=i=a=o=s=c=void 0,l.clear(),u=``}return{render(e){if(!e){h();return}p(e.hidden,e.summary),a.textContent!==e.caption&&(a.textContent=e.caption);let t=JSON.stringify(e.headers);t!==u&&(u=t,o.replaceChildren(...e.headers.map(e=>{let t=d(`th`);return t.scope=`col`,m(t,e),t})),l.clear(),s.replaceChildren());let n=new Set(e.rows.map(e=>e.key));for(let[e,t]of l)n.has(e)||(t.remove(),l.delete(e));if(e.rows.forEach((e,t)=>{let n=l.get(e.key);n||(n=d(`tr`),n.setAttribute(`data-key`,e.key),e.cells.forEach((e,t)=>{let r=d(t===0?`th`:`td`);t===0&&(r.scope=`row`),n.appendChild(r)}),l.set(e.key,n)),e.cells.forEach((e,t)=>m(n.cells[t],e)),s.children[t]!==n&&s.insertBefore(n,s.children[t]??null)}),!e.footer){c?.remove(),c=void 0;return}let r=e.footer,f=c?.rows[0];c&&f&&f.cells.length===r.length||(c?.remove(),c=d(`tfoot`),f=d(`tr`),r.forEach((e,t)=>{let n=d(t===0?`th`:`td`);t===0&&(n.scope=`row`),f.appendChild(n)}),c.appendChild(f),i.appendChild(c)),r.forEach((e,t)=>m(f.cells[t],e))},destroy:h}}function mr(e,t){if(typeof e==`string`){let n=typeof document>`u`?null:document.querySelector(e);if(!n)throw TypeError(`${t}: no element matches "${e}".`);return n}if(!e||typeof e.appendChild!=`function`)throw TypeError(`${t} needs a container element or a selector.`);return e}function hr(e){let t=e.ownerDocument.defaultView?.getComputedStyle(e),n=(parseFloat(t?.paddingLeft??``)||0)+(parseFloat(t?.paddingRight??``)||0),r=e.clientWidth-n;return r>0?r:640}function gr(e,t){e.setAttribute(`aria-label`,t.label);let n=e.querySelector(`:scope > desc`);t.description?(n??(n=e.insertBefore(Y(`desc`,{},e),e.firstChild)),n.textContent=t.description):n?.remove()}function _r(e,t,n){for(let r of ct){let i=e[r];if(i?.kind===`data`){for(let e of i.needs?.related??[])if(!t.includes(e))throw RangeError(`${n}: on.${r} needs the series "${e}", but the chart's series are ${t.map(e=>`"${e}"`).join(`, `)}.`)}}}function vr(e,t,n,r){let i=e=>ct.includes(e)&&n?.[e]!==void 0&&n[e]===t?.[e],a=lt(Object.fromEntries(Object.entries(n??{}).filter(([e])=>!i(e))),r),o={};for(let t of ct){let n=i(t)?e[t]:a[t];n&&(o[t]=n)}return o}function yr(e,t){if(typeof e!=`object`||!e)throw TypeError(`${t} needs options.`);if(typeof e.label!=`string`||e.label.trim()===``)throw TypeError(`${t} needs a label: the chart's accessible name.`);if(!Array.isArray(e.data))throw TypeError(`${t}: data must be an array of rows.`);for(let n of[`width`,`height`]){let r=e[n];if(r!==void 0&&!(typeof r==`number`&&Number.isFinite(r)&&r>0))throw RangeError(`${t}: ${n} must be a positive number of px, got ${String(r)}.`)}let{format:n,tooltip:r,markLabel:i,markDescription:a,legend:o,announce:s}=e;if(n!==void 0&&typeof n!=`function`)throw TypeError(`${t}: format must be a function that turns a value into text.`);if(r!==void 0&&typeof r!=`boolean`&&typeof r!=`function`)throw TypeError(`${t}: tooltip must be true, false or a function that returns a row's text.`);if(i!==void 0&&typeof i!=`function`)throw TypeError(`${t}: markLabel must be a function that returns a mark's accessible name.`);if(a!==void 0&&a!==!1&&typeof a!=`function`)throw TypeError(`${t}: markDescription must be false or a function that returns a mark's accessible description.`);if(Cn(o,t),Jn(e.seriesLabels,t),ur(e.table,t),s!==void 0&&typeof s!=`boolean`&&typeof s!=`function`)throw TypeError(`${t}: announce must be true, false or a function that returns the text to announce.`)}function br(e){let{clock:t}=e,n,r=0,i,a,o=!1;function s(t){if(o||n?.id!==t)return;let{waiters:r}=n;n=void 0,i?.(),i=void 0,e.land(),e.runner.settle(),e.leaving.sweep();for(let e of r)e()}return{run(a){e.draw();let o=++r;return new Promise(r=>{n={id:o,waiters:[...n?.waiters??[],r]},a.length===0?s(o):(i?.(),i=t.onFrame(()=>e.draw()),Promise.all(a).then(()=>s(o)))})},supersede:()=>a?.(),wait(e,t){return new Promise(n=>{a=n,e.then(()=>Promise.all(t.map(e=>e.gone))).then(()=>n())})},destroy(){o=!0,n=void 0,i?.(),a?.()}}}function xr(e,t,n){let{runner:r,events:i,input:a,onScreen:o}=e;r.interrupt();let s=t();e.swap?.(s),e.hover.dropGone();let c=s.exiting.map(e=>e.leave);return r.exit(s.exiting.map(o)).then(()=>{for(let e of c)e.exited=!0;e.leaving.sweep()}),i.emitEach(`exit`,s.exiting,o),(e.data||s.changed.length>0||s.entering.length>0||s.exiting.length>0)&&r.update(s.changed.map(({record:e,from:t})=>({...a(e),from:t}))),i.emitEach(`update`,s.changed,({record:e,from:t})=>({...a(e),from:t})),r.enter(s.entering.map(a)),i.emitEach(`enter`,s.entering,a),n(s),e.hover.sync(),c}function Q(e,t,n){return e.animating||!n(e.value,t)}let $=(e,t)=>e===t;function Sr(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])}function Cr(e,t){if(e.outline.d!==t.outline.d||wr(e,t))return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((e,t)=>e.key!==r[t].key||e.outline.d!==r[t].outline.d)}function wr(e,t){return Tr(e.labelBounds,t.labelBounds)||Tr(e.nearbyLabels,t.nearbyLabels)}function Tr(e,t){return e===t?!1:!e||!t||e.length!==t.length||e.some((e,n)=>e.x!==t[n].x||e.y!==t[n].y||e.width!==t[n].width||e.height!==t[n].height)}function Er(e,t,n,r){if(typeof ResizeObserver!=`function`)return()=>{};let i=n,a=n,o,s=new ResizeObserver(e=>{let n=e[e.length-1]?.contentRect.width??0;!(n>0)||Math.abs(n-a)<.5||(a=n,o??(o=t.onFrame(()=>{o?.(),o=void 0,Math.abs(a-i)<.5||(i=a,r(i))})))});return s.observe(e),()=>{s.disconnect(),o?.()}}function Dr(e,t){let n=e.fonts;return n?.addEventListener?.(`loadingdone`,t),()=>n?.removeEventListener?.(`loadingdone`,t)}function Or(e,t,n){if(typeof ResizeObserver!=`function`)return()=>{};let r=Y(`text`,{"font-size":11,visibility:`hidden`,"pointer-events":`none`,"aria-hidden":`true`},e);r.textContent=`Hamburgefonstiv 0123456789`;let i=0,a=0,o,s=new ResizeObserver(e=>{let s=e.find(e=>e.target===r)?.contentRect.width??0;!(s>0)||Math.abs(s-a)<.5||(a=s,i?o??(o=t.onFrame(()=>{o?.(),o=void 0,Math.abs(a-i)<.5||(i=a,n())})):i=s)});return s.observe(r),()=>{s.disconnect(),o?.(),r.remove()}}function kr(e,t){let n=()=>e.style.setProperty(`--ec-hover-duration`,`${t.duration(100,`feedback`)}ms`);return n(),t.subscribe(n)}let Ar=0;function jr(e,t,n,r){let i=e.top-12,a=n.height-e.bottom-12;return r??(r=t.height<=i||i>=a?`above`:`below`),{x:Math.max(0,Math.min(n.width-t.width,e.x-t.width/2)),y:r===`above`?i-t.height:e.bottom+12,side:r}}function Mr(e,t,n,r={}){let i=t.length===1&&t[0].series===`value`&&(t[0].label??`value`)===`value`,a=[t.map(e=>i?n(e.value):`${n(e.value)} ${e.label??e.series}`).join(` · `)];return t.length>1&&r.total!==!1&&a.push(`${n(t.reduce((e,t)=>e+t.value,0))} total`),{title:e,lines:a}}function Nr(e,n){let r,i,a,o=new WeakMap,s,c,l=!1,u,d=e=>e.style.setProperty(`--ec-hover-duration`,`${n.motion.duration(100,`feedback`)}ms`),f=()=>i?.classList.contains(`ec-tooltip-shown`)??!1,p=()=>{if(!c||!i||!r)return!1;let{x:e,y:t}=c,{left:n,right:a,top:o,bottom:s}=i.getBoundingClientRect();if(e>n&&e<a&&t>o&&t<s)return!0;if(!u)return!1;let l=r.getBoundingClientRect();return Pr(u,e-l.left,t-l.top)},m=e=>{l=e,r?.classList.toggle(`ec-tooltip-through`,e)},h=e=>{c=e.pointerType===`touch`?void 0:{x:e.clientX,y:e.clientY},l&&!p()&&m(!1)};e.ownerDocument.addEventListener(`pointerover`,h,!0),e.ownerDocument.addEventListener(`pointermove`,h,!0);function g(){if(!r||!i||!a){let t=e.ownerDocument;r=t.createElement(`div`),r.className=`ec-tooltip-layer`,i=t.createElement(`div`),i.className=`ec-tooltip`,i.setAttribute(`aria-hidden`,`true`),a=t.createElement(`div`),a.className=`ec-tooltip-bridge`,a.setAttribute(`aria-hidden`,`true`),r.append(i,a)}return r.previousSibling!==e&&e.after(r),i}function _(e,t){let r=n.option(),i=o.get(e);if(i&&i.option===r)return i.content;let a=Ir(r,e.datum,t,e.series);return o.set(e,{option:r,content:a}),a}function v(){i&&(d(i),i.classList.remove(`ec-tooltip-shown`),m(!1))}function y(t,n,i,o){let c=_(t,n);if(c===void 0){v();return}let h=g(),y=f()&&!l&&p(),b=typeof c==`string`?`text:${c}`:JSON.stringify(c);b!==s&&(Lr(h,c),s=b);let x=Rr(e),S=e.getBoundingClientRect(),C=S.width>0&&x.width>0?S.width/x.width:1,w={x:e=>(e-x.x)*C,y:e=>(e-x.y)*C},T=S.width>0?{width:S.width,height:S.height}:{width:x.width,height:x.height},E={width:h.offsetWidth,height:h.offsetHeight},D=i(w,o),O=jr(D,E,T,o?jr(i(w,!1),E,T).side:void 0),k=r.getBoundingClientRect(),A=S.left-k.left,j=S.top-k.top,M=Math.round(A+O.x),N=Math.round(j+O.y);h.style.left=`${M}px`,h.style.top=`${N}px`,h.setAttribute(`data-side`,O.side);let P=D.left===void 0||D.right===void 0?void 0:{left:A+D.left,right:A+D.right,top:j+D.top,bottom:j+D.bottom};u=Fr(a,{left:M,top:N,...E},P,O.side),d(h),h.classList.add(`ec-tooltip-shown`),m(!y&&p())}return{show(e,t,n,r){y(t,n,(t,n)=>{let i=n?r:void 0,{x:a,y:o,width:s,height:c}=e.bounds,l=[{x:a,y:o},{x:a+s,y:o},{x:a,y:o+c},{x:a+s,y:o+c}].map(e=>i?q.apply(i,e):e),u=l.map(e=>e.x),d=l.map(e=>e.y),f=i?q.apply(i,e.center):e.center;return{x:t.x(f.x),top:t.y(Math.min(...d)),bottom:t.y(Math.max(...d)),left:t.x(Math.min(...u)),right:t.x(Math.max(...u))}},r!==void 0)},showAt(e,t,n){y(t,n,t=>({x:t.x(e.x),top:t.y(e.top),bottom:t.y(e.bottom)}),!1)},describe(e,r){let i=n.description?.(),a;if(i===!1)a=void 0;else if(typeof i==`function`)try{let e=i(r.datum);a=typeof e==`string`&&e!==``?e:void 0}catch(e){t(e),a=void 0}else a=typeof n.option()==`function`?_(r,()=>``):void 0;let o=e.querySelector(`:scope > desc.ec-description`);if(typeof a!=`string`){if(!o)return;e.getAttribute(`aria-describedby`)===o.id&&e.removeAttribute(`aria-describedby`),o.remove()}else o??(o=Y(`desc`,{class:`ec-description`,id:`ec-description-${++Ar}`},e)),o.textContent!==a&&(o.textContent=a),e.setAttribute(`aria-describedby`,o.id)},element:()=>f()?r:void 0,hide:v,destroy(){e.ownerDocument.removeEventListener(`pointerover`,h,!0),e.ownerDocument.removeEventListener(`pointermove`,h,!0),r?.remove(),r=void 0,i=void 0,a=void 0,u=void 0,l=!1,o=new WeakMap,s=void 0}}}function Pr({top:e,bottom:t,upper:n,lower:r},i,a){if(a<=e||a>=t)return!1;let o=(a-e)/(t-e);return i>n.left+(r.left-n.left)*o&&i<n.right+(r.right-n.right)*o}function Fr(e,t,n,r){if(e.hidden=n===void 0,!n)return;let i={left:t.left,right:t.left+t.width},[a,o,s,c]=r===`above`?[i,n,t.top+t.height-1,Math.round(n.top+1)]:[n,i,Math.round(n.bottom-1),t.top+1],l=Math.round(Math.min(a.left,o.left)),u=Math.round(Math.max(a.right,o.right))-l,d=Math.max(0,c-s),f=e=>`${Math.round(e)-l}px`;e.style.left=`${l}px`,e.style.top=`${s}px`,e.style.width=`${u}px`,e.style.height=`${d}px`,e.style.setProperty(`clip-path`,`polygon(${f(a.left)} 0px, ${f(a.right)} 0px, ${f(o.right)} ${d}px, ${f(o.left)} ${d}px)`);let p=e=>({left:Math.round(e.left),right:Math.round(e.right)});return{top:s,bottom:s+d,upper:p(a),lower:p(o)}}function Ir(e,n,r,i){if(e!==!1){if(typeof e!=`function`)return r();try{let t=i===void 0?e(n):e(n,{series:i});return t==null||t===``?void 0:String(t)}catch(e){t(e);return}}}function Lr(e,t){if(typeof t==`string`){e.textContent=t;return}let n=e.ownerDocument,r=(e,t)=>{let r=n.createElement(`div`);return t&&(r.className=t),r.textContent=e,r};e.replaceChildren(r(t.title,`ec-tooltip-title`),...t.lines.map(e=>r(e)))}function Rr(e){let t=(e.getAttribute(`viewBox`)??``).split(/[\s,]+/).map(Number);return t.length===4&&t.every(Number.isFinite)?{x:t[0],y:t[1],width:t[2],height:t[3]}:{x:0,y:0,width:Number(e.getAttribute(`width`))||0,height:Number(e.getAttribute(`height`))||0}}function zr(e,n,r){let i=mr(e,`barChart`);Br(n);let o=n,s=Pn(n.motion,r.motion),c=lt(n.on,r.presets),l=Sn(n.colors),u=r.clock??a,d=i.ownerDocument;bn(d);let f=Y(`svg`,{class:`ec-chart ec-bar-chart`,role:`group`},i),p=Y(`g`,{class:`ec-grid`,"aria-hidden":`true`},f),m=Y(`g`,{class:`ec-axis`,"aria-hidden":`true`},f),h=Y(`g`,{class:`ec-focus`,"aria-hidden":`true`,visibility:`hidden`},f),g=[Y(`path`,{class:`ec-focus-ring`,"stroke-width":8,"stroke-linejoin":`round`},h),Y(`path`,{class:`ec-focus-gap`,"stroke-width":4,"stroke-linejoin":`round`},h)],_=Y(`g`,{class:`ec-marks`},f),v=Y(`g`,{class:`ec-overlay`,"aria-hidden":`true`},f),y=It(f),x=[],w=new Map,T=sr(e=>e.values.animating||e.presence.animating),E=new WeakMap,D=Yn(`barChart`),O=hr(i),k=!1,A,j;try{A=re(o),j=W(o,A)}catch(e){throw f.remove(),e}let M=e=>w.get(e)??T.get(e),N=Kn({overlay:v,measure:y,mark:e=>({set:t=>{M(e)?.handle.set(t),G.restyled(e)},reset:()=>{M(e)?.handle.reset(),G.restyled(e)}}),colors:(e,t)=>M(e)?.parts[t===void 0?0:(M(e)?.shown.geometry.segments??[]).findIndex(e=>e.key===t)]?.colors}),P=Ct({effects:c,motion:s,icons:r.icons,clock:u,surface:N}),F=Nr(f,{motion:s,option:()=>o.tooltip,description:()=>o.markDescription}),I=Tn(f),ee=pr(f),L=o.announce?Ot(f):void 0,R=A.orientation,z=new Map,B=new Set,V=!1,te=!1,H=C(A.frame.scale,S,{clock:u,motion:s,onChange:()=>V=!0}),ne=C(A.frame.bands,S,{clock:u,motion:s,onChange:()=>V=!0}),U=br({clock:u,runner:P,leaving:T,draw:he,land:ge});function re(e,t=c){let n=Vt(e);return _r(t,n.series.map(e=>e.series),`barChart`),Ht({data:e.data,encoding:n,sort:e.sort,width:e.width??O,height:e.height,format:Xn(e),measure:y,room:e.room??0})}function ie(e,t){let n=Y(`g`,{class:`ec-mark`,"data-key":e.key,role:`img`},_),r={clock:u,motion:s,onChange:()=>B.add(a)},i=Gr(e),a={key:e.key,row:e,shown:e,group:n,hit:Y(`rect`,{class:`ec-hit`},n),label:Y(`text`,{class:`ec-label`,"aria-hidden":`true`},n),body:Y(`g`,{class:`ec-body`},n),value:Y(`text`,{class:`ec-value`,"aria-hidden":`true`},n),paths:new Map,parts:[],handle:zn(()=>a),values:C(t?Kr(i):i,S,r),series:e.values.map(e=>e.series),slot:C(e.slot,b,r),presence:C(+!t,b,r),drawn:{label:C(Number(e.drawn.label),b,r),value:C(Number(e.drawn.value),b,r)},count:void 0,leave:void 0};return E.set(n,a),ae(a,t?fe(a,de()):e),a}function ae(e,t){let n=e.parts;e.shown=t,X(e.hit,{...t.hit}),Ft(e.label,t.label),Ft(e.value,t.value);let r=(t,n)=>{let r=e.presence.value*(t?n.value:1);return r<1?r:void 0};X(e.label,{opacity:r(t.drawn.label,e.drawn.label)}),X(e.value,{opacity:r(t.drawn.value,e.drawn.value)});let i=t.geometry.segments??[],a=new Set,s=Vr(o)?pn(l.slot(e.key)):void 0;e.parts=i.map(t=>{let n=t.series??t.key;a.add(n);let r=e.paths.get(n);r||(r=Y(`path`,{class:`ec-segment`,"data-series":n},e.body),e.paths.set(n,r));let i=s??pn(l.slot(n));return r.setAttribute(`d`,t.outline.d),At(r,hn(i)),{element:r,d:t.outline.d,colors:i,visible:t.length>=.5}});for(let[t,n]of e.paths)a.has(t)||(n.remove(),e.paths.delete(t));let c=Array.from(e.body.children).filter(e=>e.classList.contains(`ec-segment`));if(e.parts.some((e,t)=>c[t]!==e.element))for(let t of e.parts)e.body.appendChild(t.element);e.handle.repaint(),(e.parts.length!==n.length||e.parts.some((e,t)=>e.colors.color!==n[t].colors.color))&&N.recolor(e.key),e.key===G.ringKey&&oe(e.key)}function oe(e){let t=e===void 0?void 0:w.get(e);if(!t){h.setAttribute(`visibility`,`hidden`);return}for(let e of g)e.setAttribute(`d`,t.shown.geometry.outline.d);let{transform:n}=t.handle.style;X(h,{transform:n&&Mt(n),visibility:void 0})}function se(e,t){let n=Cr(e.shown.geometry,t.geometry)||e.shown.datum!==t.datum;ae(e,t),n&&P.change(t.geometry,t.data),e.key===G.key&&ce(e)}function ce(e){let{row:t}=e;F.show(e.shown.geometry,t,()=>Mr(t.category,Ur(t.values,o),Xn(o)),e.handle.style.transform)}function le(e){Vr(o)?I.categories(e.rows.map(e=>({key:e.key,label:e.category})),l,o.legend):I.update(Vt(o).series.map(e=>({series:e.series,label:qn(o.seriesLabels,e.series)})),l,o.legend)}function W(e,t){let n=Vt(e),r=n.orientation===`horizontal`?e.y:e.x;return dr({option:e.table,caption:e.label,category:typeof r==`string`?r:void 0,series:n.series.map(e=>e.series),label:t=>qn(e.seriesLabels,t),rows:t.rows.map(e=>({key:e.key,category:e.category,datum:e.datum,index:e.index,values:e.values,total:e.total})),format:Xn(e)})}function ue(e,n){let r=o.announce;if(!L||!r)return;let i=Vt(o).series.map(e=>e.series),a=Vt(e).series.map(e=>e.series),s=Jr(o.sort),c=e=>e.row.category,l=n.changed.map(({record:e})=>e),u=Et({...o.label===e.label?{}:{label:o.label},...i.join(`
|
|
90
|
+
`,vn=`data-expressive-charts`,yn={};function bn(e){if(yn.injectStyles===!1||e.querySelector(`style[${vn}]`))return;let t=e.createElement(`style`);t.setAttribute(vn,``),yn.nonce&&t.setAttribute(`nonce`,yn.nonce),t.textContent=_n,(e.head??e.documentElement).appendChild(t)}function xn(e={}){let t=new Map;for(let[n,r]of Object.entries(e)){if(!Number.isInteger(r)||r<1||r>8)throw RangeError(`colorAssignment: the slot for "${n}" must be a whole number from 1 to 8, got ${String(r)}.`);t.set(n,r)}return{slot(e){let n=t.get(e);if(n===void 0){let r=new Set(t.values());for(n=1;r.has(n)&&n<=8;)n++;n>8&&(n=t.size%8+1),t.set(e,n)}return n}}}function Sn(e){return e&&typeof e.slot==`function`?e:xn(e)}function Cn(e,t){if(e===void 0||typeof e==`boolean`)return;let n=e=>{throw TypeError(`${t}: ${e}`)};(typeof e!=`object`||!e||Array.isArray(e))&&n(`legend must be true or false, or an object with the entries the page adds.`);let{entries:r}=e;r!==void 0&&(Array.isArray(r)||n(`legend.entries must be an array of { label, color }.`),r.forEach((e,t)=>{let{label:r,color:i}=typeof e==`object`&&e?e:n(`legend.entries[${t}] must be an object with a label and a color.`);(typeof r!=`string`||r.trim()===``)&&n(`legend.entries[${t}].label must be a non-empty string: the entry's name.`),(typeof i!=`string`||i.trim()===``)&&n(`legend.entries[${t}].color must be a theme token or a CSS colour.`),(i===`mark`||i===`mark-strong`)&&n(`legend.entries[${t}].color can't be "${i}": an entry has no mark. Use a theme token or a CSS colour.`)}))}let wn=e=>typeof e==`object`?e.entries??[]:[];function Tn(e){let t,n=``,r=()=>{t?.remove(),t=void 0,n=``},i=(r,i,a,o)=>{let s=[...r.map(({key:e,label:t})=>({key:e,label:t,styles:hn(pn(i.slot(e)))})),...o.map(({label:e,color:t})=>({key:void 0,label:e,styles:{"--ec-mark":mn(t)}}))],c=e.ownerDocument;t??(t=Object.assign(c.createElement(`div`),{className:`ec-legend`})),t.nextSibling!==e&&e.before(t);let l=JSON.stringify([a,s]);l!==n&&(n=l,t.replaceChildren(...s.map(({key:e,label:t,styles:n})=>{let r=c.createElement(`span`);r.className=`ec-legend-item`,e!==void 0&&r.setAttribute(a,e);for(let[e,t]of Object.entries(n))t!==void 0&&r.style.setProperty(e,t);let i=c.createElement(`span`);i.className=`ec-legend-swatch`;let o=c.createElement(`span`);return o.className=`ec-legend-label`,o.textContent=t,r.append(i,o),r})))};return{update(e,t,n){let a=wn(n);n===!1||e.length+a.length<2?r():i(e.map(({series:e,label:t})=>({key:e,label:t})),t,`data-series`,a)},categories(e,t,n){n===!1||e.length===0?r():i(e,t,`data-key`,wn(n))},destroy:r}}let En=e=>e!==void 0&&e.source!==`linked`,Dn=new WeakMap,On=new WeakSet,kn=e=>e.parts?[e,...e.parts]:[e];function An(e,t){return Dn.set(t,e),t}let jn=e=>Dn.get(e);function Mn(e,n={}){if(!Array.isArray(e))throw TypeError(`link needs an array of charts, chart switches and attachments: link([columns, line]).`);if(typeof n!=`object`||!n)throw TypeError(`link: options must be an object, such as { by: (event) => event.data.datum.week }.`);let{by:r,effects:i=!0}=n;if(r!==void 0&&typeof r!=`function`)throw TypeError(`link: by must be a function, such as (event) => event.data.datum.week.`);if(typeof i!=`boolean`)throw TypeError(`link: effects must be true or false, got ${String(i)}.`);let a=[],o=new Set;for(let t of e){let e=typeof t==`object`&&t?Dn.get(t):void 0;if(!e)throw TypeError(`link: each source must be a chart (barChart, donutChart or lineChart), a chartSwitch or an attachment (expressive or fromVegaView).`);let n=kn(e);if(n.some(e=>On.has(e)||o.has(e)))throw TypeError(`link: a chart, chart switch or attachment can be in one link at a time, and a chart switch's views' charts go with it. Destroy the link it's in first.`);for(let e of n)o.add(e);a.push(e)}let s=new Set,c,l=new Set;function u(e){let n;if(r)try{n=r(e)}catch(e){t(e);return}else{let{samples:t}=e.data;n=t[t.length-1]?.at??e.mark.key}return n instanceof Date?Number.isNaN(n.getTime())?void 0:n.toISOString():n==null?void 0:String(n)}function d(e,t){if(t.size===0)return[];let n=e=>e.some(e=>{let n=u(e);return n!==void 0&&t.has(n)});return e.targets().flatMap(e=>n(e.marks)?[e.key]:[])}function f(e,t){c=e;let n=new Set(t.map(u));n.delete(void 0),l=n;for(let t of s)if(t!==e&&(t.hover(d(t,n),i),c!==e))return}function p(e){if(c===e){c=void 0,l=new Set;for(let e of s)e.unlink()}}for(let e of a)if(e.listen({hover:t=>f(e,t),leave:()=>p(e),dismiss(){let e=c;e?.leave(),e&&p(e)},shown(){c!==void 0&&c!==e&&s.has(e)&&e.hover(d(e,l),i)},gone(){s.delete(e);for(let t of kn(e))On.delete(t);p(e)}})){s.add(e);for(let t of kn(e))On.add(t)}return{destroy(){for(let e of s){e.listen(void 0),e.unlink();for(let t of kn(e))On.delete(t)}s.clear(),c=void 0,l=new Set}}}let Nn=[`presentation`,`analysis`,`off`];function Pn(e,t){if(e===void 0)return t;if(typeof e!=`string`)return e;if(!Nn.includes(e))throw TypeError(`Unknown motion mode "${String(e)}". Use one of: ${Nn.join(`, `)}.`);let n=()=>t.viewerChoice??(t.prefersReduced?`off`:e);return{get mode(){return n()},get staged(){return n()===`presentation`},duration(e,t=`transition`){let r=n();return r===`off`?0:m(e,u[r][t])},subscribe:e=>t.subscribe(e)}}let Fn=new WeakMap,In=0;function Ln(e){let t=e.ownerDocument,n=(Fn.get(t)??0)+1;Fn.set(t,n);let r=Y(`mask`,{id:`ec-focus-mask-${n}`,maskUnits:`userSpaceOnUse`,x:-1e5,y:-1e5,width:2e5,height:2e5},e);Y(`rect`,{x:-1e5,y:-1e5,width:2e5,height:2e5,fill:`white`},r);let i=Y(`path`,{stroke:`black`,"stroke-linejoin":`round`},r),a=Y(`path`,{class:`ec-focus-ring`,visibility:`hidden`,"stroke-linejoin":`round`,mask:`url(#${r.id})`},e);return At(a,{fill:`none`,stroke:mn(`focus`)}),{draw(e){if(!e){X(a,{visibility:`hidden`});return}let{outline:t,thickness:n,transform:r}=e,o=t.closed?0:n;X(i,{d:t.d,fill:t.closed?`black`:`none`,"stroke-width":o+4}),X(a,{d:t.d,"stroke-width":o+8,transform:r&&Mt(r),visibility:void 0})}}}function Rn(){let e,t=()=>{e?.remove(),e=void 0};return{paint(n,r,i,a){if(!i||!n||r.length===0){t();return}e&&e.parentNode===n||(e?.remove(),e=Y(`g`,{class:`ec-halo`},n)),e.textContent=``;let o=`ec-halo-mask-${++In}`,s=Y(`mask`,{id:o,maskUnits:`userSpaceOnUse`,x:-1e5,y:-1e5,width:2e5,height:2e5},e);Y(`rect`,{x:-1e5,y:-1e5,width:2e5,height:2e5,fill:`white`},s);for(let e of r){let t=e.stroke===void 0?{fill:`black`}:{fill:`none`,stroke:`black`,"stroke-width":e.stroke,"stroke-linejoin":`round`};Y(`path`,{d:e.d,...t},s)}X(e,{transform:a&&Mt(a)});for(let t of r){let n=t.stroke!==void 0;At(Y(`path`,{d:t.d,"stroke-width":i.width+(t.stroke??0),"stroke-opacity":i.opacity,"stroke-linejoin":`round`,"stroke-linecap":n?`round`:void 0,mask:`url(#${o})`},e),{fill:`none`,stroke:i.color===void 0?t.color??mn(`mark`):mn(i.color)})}},remove:t}}function zn(e,t={}){let n={},r,i=t.halos&&Rn(),a=()=>{let t=e();if(!t)return;let{body:r,parts:i}=t;X(r,{transform:n.transform&&Mt(n.transform),opacity:n.opacity});let a=n.emphasis;for(let e of i)At(e.element,{[e.open?`stroke`:`fill`]:a===void 0?void 0:Bn(e.colors,a),transition:a===void 0?void 0:`none`});o(r,i)},o=(e,a)=>{let o=n.halo;if(i){let e=a.flatMap(e=>e.visible?[{d:e.d,color:e.colors.color,...e.open?{stroke:e.open.width}:{}}]:[]);i.paint(t.halos?.(),e,o,n.transform);return}if(!o){r?.remove(),r=void 0;return}r&&r.parentNode===e||(r?.remove(),r=Y(`g`,{class:`ec-halo`},e),e.insertBefore(r,e.firstChild));let s=a.filter(e=>e.visible);for(;r.childElementCount>s.length;)r.lastElementChild?.remove();s.forEach((e,t)=>{let n=r.children[t]??Y(`path`,{"stroke-linejoin":`round`},r);X(n,{d:e.d,"stroke-width":o.width+(e.open?.width??0),"stroke-opacity":o.opacity,"stroke-linecap":e.open?`round`:void 0}),At(n,{fill:`none`,stroke:o.color===void 0?e.colors.color:mn(o.color)})})};return{get style(){return n},set(e){n=dt(n,e),a()},reset(){n={},a()},repaint:a}}function Bn(e,t){let n=Math.min(1,Math.max(0,t));return n===0?e.color:n===1?e.strong:`color-mix(in srgb, ${e.strong} ${Math.round(n*1e3)/10}%, ${e.color})`}let Vn=0;function Hn(e,t,n){let r=()=>{if(!t)return e;let n=e.lastElementChild;if(n?.getAttribute(`class`)===`ec-follow`)return n;let r=t();return Y(`g`,{class:`ec-follow`,transform:r&&Mt(r)},e)};return{icon(e,t){let n=t?.size;if(n!==void 0&&!(n>=0))throw RangeError(`layer.icon: size must be a non-negative number, got ${String(n)}.`);let i=Y(`g`,{class:`ec-icon`,"data-icon":e.name,visibility:`hidden`},r()),a=n===void 0||!(e.size>0)?1:n/e.size,o=a===1?i:Y(`g`,{transform:Mt(J.scale(a,a,e.anchor))},i);for(let t of e.shapes)Un(t,o);return{place(e){X(i,{transform:Mt(e),visibility:void 0})},remove:()=>i.remove()}},path(e,t){let i=Y(`path`,{class:`ec-path`,d:e},r()),a={...t};return Wn(i,a,n),{update(e,t){i.setAttribute(`d`,e),t&&(a=dt(a,t),Wn(i,a,n))},remove:()=>i.remove()}},text(t,n){let r=Y(`text`,{class:`ec-text`},e);r.textContent=t;let i={...n};return Gn(r,i),{update(e,t){i=dt(i,e),Gn(r,i),t!==void 0&&(r.textContent=t)},remove:()=>r.remove()}}}}function Un(e,t){let n;if(e.clip!==void 0){n=`ec-clip-${++Vn}`;let r=Y(`clipPath`,{id:n},t);Y(`path`,{d:e.clip},r)}At(Y(`path`,{d:e.d,"clip-path":n&&`url(#${n})`,"stroke-width":e.stroke===void 0?void 0:e.width??1,"stroke-linecap":e.linecap,"stroke-linejoin":e.linejoin,"fill-rule":e.fillRule,opacity:e.opacity,"fill-opacity":e.fillOpacity,"stroke-opacity":e.strokeOpacity},t),{fill:e.fill===void 0?`none`:mn(e.fill),stroke:e.stroke===void 0?void 0:mn(e.stroke)})}function Wn(e,t,n){let{part:r}=t;X(e,{"stroke-width":t.stroke===void 0?void 0:t.width??1,opacity:t.opacity,"stroke-linecap":t.linecap,"stroke-linejoin":`round`,"data-part":r}),At(e,{...hn(r===void 0?void 0:n?.(r)),fill:t.fill===void 0?`none`:mn(t.fill),stroke:t.stroke===void 0?void 0:mn(t.stroke)})}function Gn(e,t){X(e,{x:t.at.x,y:t.at.y,"text-anchor":t.anchor??`start`,opacity:t.opacity}),At(e,{fill:mn(t.color??`text`)})}function Kn(e){let{overlay:t}=e,n=e.measure??It(t),r=new WeakMap,i=new Map,a=new Set,o=new Set,s=new Map,c=(e,t)=>{if(t)s.set(e,t);else if(!s.delete(e))return;for(let n of i.get(e)??[])for(let e of Array.from(n.children))e.getAttribute(`class`)===`ec-follow`&&X(e,{transform:t&&Mt(t)})};return{group(n,c,l){let u=Y(`g`,{class:o.has(n)?`ec-run ec-hot`:`ec-run`,"data-key":n,"data-slot":c,visibility:a.has(n)?`hidden`:void 0},t);At(u,hn(e.colors(n))),r.set(u,l);let d=Array.from(t.children).find(e=>(r.get(e)??-1/0)>l);t.insertBefore(u,d??null);let f=i.get(n);f||i.set(n,f=new Set),f.add(u);let p=f;return{...Hn(u,()=>s.get(n),t=>e.colors(n,t)),clear(){u.remove(),p.delete(u),p.size===0&&i.get(n)===p&&i.delete(n)}}},box:(e,{at:t,anchor:r=`start`})=>Pt({x:t.x,y:t.y,anchor:r,text:e},n,`ec-text`,ft),mark(t){let n=e.mark(t);return{set(e){n.set(e),`transform`in e&&c(t,e.transform)},reset(){n.reset(),c(t,void 0)}}},recolor(t){let n=i.get(t);if(!n)return;let r=hn(e.colors(t));for(let i of n){At(i,r);for(let n of i.querySelectorAll(`[data-part]`))At(n,hn(e.colors(t,n.getAttribute(`data-part`))))}},hide(e,t){t?a.add(e):a.delete(e);for(let n of i.get(e)??[])X(n,{visibility:t?`hidden`:void 0})},hot(e,t){t?o.add(e):o.delete(e);for(let n of i.get(e)??[])n.classList.toggle(`ec-hot`,t)}}}function qn(e,t){return e!==void 0&&Object.prototype.hasOwnProperty.call(e,t)?e[t]??t:t}function Jn(e,t){if(e!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`${t}: seriesLabels must be an object of names by series, as { goals: "Goals" }.`);for(let[n,r]of Object.entries(e))if(typeof r!=`string`||r.trim()===``)throw TypeError(`${t}: seriesLabels.${n} must be a name, not ${typeof r==`string`?`blank`:String(r)}.`)}}function Yn(e){let n={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set};function r(e,r){for(let i of[...n[e]])try{i(r)}catch(e){t(e)}}return{emit:r,emitEach(e,t,n){t.forEach((i,a)=>r(e,{...n(i),batch:{index:a,count:t.length}}))},on(t,r){let i=n[t];if(!i)throw TypeError(`${e}: unknown event "${String(t)}". Use one of: ${Object.keys(n).join(`, `)}.`);return i.add(r),()=>{i.delete(r)}},clear(){for(let e of Object.values(n))e.clear()}}}function Xn(e){return e.format??Qn}let Zn;function Qn(e){return Zn??(Zn=new Intl.NumberFormat(void 0,{maximumFractionDigits:2})),Zn.format(e)}function $n(e){let t=String(Number(e.toPrecision(12)));if(/e/i.test(t))return 6;let n=t.indexOf(`.`);return n<0?0:Math.min(6,t.length-n-1)}function er(e,t){let n=10**t,r=Math.round(e*n)/n;return r===0?0:r}function tr(e){return`${er(e*100,0)}%`}function nr(e,t){let n=e.ownerDocument,r,i=`mouse`,a,o,s,c,l=(e,n)=>{c=e?.key,e?.key!==r&&(u(),e&&(r=e.key,t.hover(e,n)))},u=()=>{_(),r!==void 0&&(r=void 0,t.leave())},d=e=>{let n=t.tooltip?.();return n?.element&&e&&n.element.contains(e)?n:void 0},f=(t,n)=>{let r=e.getRootNode();return typeof r.elementFromPoint==`function`?r.elementFromPoint(t,n):void 0},p=e=>e.relatedTarget??f(e.clientX,e.clientY)??null,m=(n,r,i)=>{let a=d(n);a?g(a,r,i):l(n&&e.contains(n)?t.find(n,{x:r,y:i}):void 0,`pointer`)},h=e=>t.find(e.target,{x:e.clientX,y:e.clientY}),g=(e,t,n)=>{l({key:e.key},`pointer`);let r=e.element;a?.element===r?(a.x=t,a.y=n):(_(),a={element:r,x:t,y:n},r.addEventListener(`pointermove`,v),r.addEventListener(`pointerleave`,y),o=new MutationObserver(b),o.observe(r,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))},_=()=>{a&&(a.element.removeEventListener(`pointermove`,v),a.element.removeEventListener(`pointerleave`,y),o?.disconnect(),o=void 0,a=void 0)},v=e=>{a&&e.pointerType!==`touch`&&(a.x=e.clientX,a.y=e.clientY)},y=e=>{e.pointerType!==`touch`&&(_(),m(p(e),e.clientX,e.clientY))},b=()=>{if(!a)return;let{x:e,y:n}=a,i=f(e,n);if(i===void 0)return;let o=t.tooltip?.(),c=o?.element!==void 0&&i!==null&&o.element.contains(i);c&&o.key===r||(_(),!c&&o?.key!==r?(s={x:e,y:n},u()):m(i,e,n))},x=e=>s&&Math.abs(e.clientX-s.x)<1&&Math.abs(e.clientY-s.y)<1?!0:(s=void 0,!1),S=e=>{if(e.pointerType===`touch`||x(e))return;_();let n=h(e);t.moves?.()&&n?.key===c||l(n,`pointer`)},C=e=>{e.pointerType!==`touch`&&(s=void 0,m(p(e),e.clientX,e.clientY))},w=e=>{if(e.pointerType===`touch`||x(e)||!t.moves?.())return;let n=h(e);n?.key!==c&&(_(),l(n,`pointer`))},T=e=>{i=e.pointerType},E=e=>{i===`touch`&&l(h(e),`touch`)},D=t=>{if(r===void 0||t.pointerType!==`touch`)return;let n=t.composedPath()[0]??t.target;!e.contains(n)&&!d(n)&&u()};return e.addEventListener(`pointerover`,S),e.addEventListener(`pointerleave`,C),e.addEventListener(`pointermove`,w),e.addEventListener(`pointerdown`,T),e.addEventListener(`click`,E),n.addEventListener(`pointerdown`,D,!0),{get current(){return r},clear(){a&&(s={x:a.x,y:a.y}),u()},destroy(){_(),r=void 0,e.removeEventListener(`pointerover`,S),e.removeEventListener(`pointerleave`,C),e.removeEventListener(`pointermove`,w),e.removeEventListener(`pointerdown`,T),e.removeEventListener(`click`,E),n.removeEventListener(`pointerdown`,D,!0)}}}function rr(e,t){let n,r,i,a,o,s=[],c=!0,l=t.tabIndex??((e,n)=>{let r=t.element(e);n===void 0?r?.removeAttribute(`tabindex`):r?.setAttribute(`tabindex`,n)}),u=e=>{for(let t of e)l(t,t===o?`0`:`-1`)},d=e=>{o=e,u(t.order()),t.element(e)?.focus()},f=()=>{let e=r;r=void 0,e!==void 0&&t.blur(e)},p=e=>{e.metaKey||e.altKey||e.ctrlKey||(c=!0)},m=()=>{c=!1,a=void 0},h=e=>{a=void 0;let s=t.find(e.target);if(s===void 0){f();return}let l=t.element(s);l&&l!==e.target&&e.target.getAttribute(`aria-hidden`)===`true`&&(l.focus(),n?.scope.activeElement===l)||(i={key:s,element:e.target},s!==r&&(r=s,o=s,u(t.order()),t.focus(s,c)))},g=e=>{let n=i?.element;r!==void 0&&n&&e.target===n&&t.find(e.relatedTarget)===void 0&&(f(),e.relatedTarget===null&&(a=n,queueMicrotask(()=>{a===n&&n.isConnected&&(a=void 0)})))},_=e=>{let n=t.find(e.target);if(n===void 0||e.altKey||e.ctrlKey||e.metaKey)return;let r=t.order(),i=r.indexOf(n),a=(e,i)=>{let a=t.move?.(n,e);return a!==void 0&&r.includes(a)?a:i},o;switch(e.key){case`ArrowDown`:case`ArrowRight`:o=a(e.key,r[Math.min(r.length-1,i+1)]);break;case`ArrowUp`:case`ArrowLeft`:o=a(e.key,r[Math.max(0,i-1)]);break;case`PageDown`:case`PageUp`:{let a=e.key===`PageDown`?1:-1,s=t.page?.(n,a);o=s!==void 0&&r.includes(s)?s:r[Math.min(r.length-1,Math.max(0,i+a*Math.ceil(r.length/10)))];break}case`Home`:o=a(e.key,r[0]);break;case`End`:o=a(e.key,r[r.length-1]);break;case`Escape`:t.escape(n)&&e.preventDefault();return;default:return}e.preventDefault(),o!==void 0&&o!==n&&d(o)},v=()=>{n&&(n.doc.removeEventListener(`keydown`,p,!0),n.doc.removeEventListener(`pointerdown`,m,!0),n.scope.removeEventListener(`focusin`,h,!0),n.scope.removeEventListener(`focusout`,g,!0),n.svg.removeEventListener(`keydown`,_),n=void 0)},y=()=>{let t=e(),r=t?.getRootNode(),i=r&&`host`in r?r:t?.ownerDocument;(t!==n?.svg||i!==n?.scope)&&(v(),t&&i&&(n={svg:t,doc:t.ownerDocument,scope:i},n.doc.addEventListener(`keydown`,p,!0),n.doc.addEventListener(`pointerdown`,m,!0),n.scope.addEventListener(`focusin`,h,!0),n.scope.addEventListener(`focusout`,g,!0),n.svg.addEventListener(`keydown`,_)))};return y(),{active:()=>n?.scope.activeElement??null,focus(e){c=!0,e===r&&i?.element===n?.scope.activeElement?t.focus(e,!0):d(e)},sync(){y();let e=t.order(),c=new Set(e),p=s.filter(e=>!c.has(e));o!==void 0&&c.has(o)||(o=ir(s,o,c)??e[0]);let m=!n?.doc.activeElement||n.doc.activeElement===n.doc.body,h=i!==void 0&&!i.element.isConnected&&(r!==void 0||i.element===a&&m),g=i&&(i.element===n?.scope.activeElement||h)?i:void 0;a=void 0,g&&!c.has(g.key)?o===void 0?g.element.isConnected?g.element.blur():f():d(o):g&&t.find(g.element)!==g.key&&d(g.key),u(e);for(let e of p)l(e,void 0);s=e},retarget(e){y();let a=t.order(),c=new Set(a),d=n?.scope.activeElement??null,f=i?.element===d?i.key:s.find(e=>t.element(e)===d),p=f??o,m=p===void 0?void 0:e(p);o=m!==void 0&&c.has(m)?m:a[0],u(a),f!==void 0&&(r=o,o===void 0?(d.blur(),i=void 0):t.element(o)?.focus());for(let e of s)c.has(e)||l(e,void 0);return s=a,f===void 0?void 0:r},moveTabStop(e){y();let r=t.order();return!r.includes(e)||t.find(n?.scope.activeElement??null)!==void 0?!1:(o=e,u(r),!0)},destroy(){r=void 0,i=void 0,a=void 0,v()}}}function ir(e,t,n){let r=t===void 0?-1:e.indexOf(t);if(!(r<0))for(let t=1;t<e.length;t++)for(let i of[r+t,r-t]){let t=e[i];if(t!==void 0&&n.has(t))return t}}function ar(e){let{svg:t,runner:n,events:r}=e,i=t=>e.marks?.(t)??[t],a=t=>(e.markElement??e.element)(t),o=(t,n)=>{a(t)?.classList.toggle(`ec-hot`,n),e.hot?.(t,n)},s,c,l,u=!1,d=t=>t.flatMap(t=>{let n=e.onScreen(t);return n?[{key:t,input:n}]:[]}),f=e=>e.length===1?i(e[0]):[...new Set(e.flatMap(i))],p=t=>t.flatMap(t=>{let n=e.standIn?.(t);return n?[n]:[]}),m=(t,n,r)=>n===`linked`&&r.length===0?t.find(t=>e.standIn?.(t)!==void 0):void 0;function h(e,t,i,a){if(e.length===0)return;i&&n.hover(e.map(({input:e})=>e));let o=e.length;e.forEach(({input:e},n)=>r.emit(`hover`,{...e,batch:{index:n,count:o},source:t,...a===void 0?{}:{segment:a}}))}function g(e){for(let t of e)o(t,!1);let t=d(e);if(t.length===0)return;n.leave(t.map(({key:e})=>e));let i=t.length;t.forEach(({input:e},t)=>r.emit(`leave`,{...e,batch:{index:t,count:i}}))}function _(n,r,i,a=!0){let c=d(f(n)),u=m(n,r,c),g={keys:n,source:r,marks:c.map(e=>e.key),effects:a,standing:u};s=g;for(let{key:e}of c)o(e,!0);e.dim()&&t.classList.add(`ec-hovering`),r!==`linked`&&(e.tooltip.show(n[0]),x(!0)),u!==void 0&&e.stand?.(u),h(c,r,a,i),r!==`linked`&&s===g&&l?.hover(c.length>0?c.map(({input:e})=>e):p(n))}function v(){let n=s;s=void 0,x(!1),t.classList.remove(`ec-hovering`),e.tooltip.hide(),n?.standing!==void 0&&e.stand?.(void 0),g(n?.marks??[]),En(n)&&l?.leave()}let y,b=e=>{e.key===`Escape`&&!e.defaultPrevented&&s!==void 0&&S()};function x(e){y?.removeEventListener(`keydown`,b),y=e?t.ownerDocument:void 0,y?.addEventListener(`keydown`,b)}function S(){w.clear(),s!==void 0&&v()}let C=(t,n)=>n===t||e.live(t)&&i(t).includes(n),w=nr(t,{find:e.find,moves:()=>e.moves?.()??!1,hover(t,n){!e.live(t.key)||En(s)&&s.keys[0]===t.key||(v(),_([t.key],n,t.segment))},leave(){(s?.source===`pointer`||s?.source===`touch`)&&v()},tooltip:()=>En(s)?{key:s.keys[0],element:e.tooltip.element?.()}:void 0}),T=rr(()=>t,{find:t=>e.find(t)?.key,order:e.order,page:(t,n)=>e.page?.(t,n),move:(t,n)=>e.move?.(t,n),element:e.element,focus(t,n){c=n?t:void 0,e.ring(c),e.live(t)&&(n?En(s)&&s.keys[0]===t?s={...s,source:`keyboard`}:(v(),_([t],`keyboard`)):s?.source===`keyboard`&&s.keys[0]!==t&&v())},blur(){c=void 0,e.ring(c),s?.source===`keyboard`&&(w.current===s.keys[0]?s={...s,source:`pointer`}:v())},escape(){return s?(s.source===`linked`&&l?l.dismiss():v(),!0):!1}});return{get key(){return En(s)?s.keys[0]:void 0},get standing(){return s?.standing},get ringKey(){return c},link:{targets:()=>e.order().map(e=>{let t=d(i(e)).map(({input:e})=>e);return{key:e,marks:t.length>0?t:p([e])}}),hover(t,n){s!==void 0&&v();let r=t.filter(e.live);r.length>0&&_(r,`linked`,void 0,n)},unlink(){s?.source===`linked`&&v()},leave:S,listen(e){return!u&&(l=e,!0)}},active:()=>T.active(),restyled(t){c!==void 0&&C(c,t)&&e.ring(c);let n=En(s)?s.keys[0]:void 0;n!==void 0&&(s?.marks.includes(t)||t===n)&&e.live(n)&&e.tooltip.show(n)},syncDim(){e.dim()?s!==void 0&&t.classList.add(`ec-hovering`):t.classList.remove(`ec-hovering`)},dropGone(){if(s===void 0)return;let t=s.keys.filter(e.live);if(t.length===0){w.clear(),v();return}let{source:i,marks:a,effects:c}=s,l=d(f(t)),u=m(t,i,l);if(u!==s.standing&&e.stand?.(u),s={...s,keys:t,standing:u},l.length===a.length&&l.every((e,t)=>e.key===a[t]))return;let p=new Set(a),h=new Set(l.map(e=>e.key)),g=d(a.filter(e=>!h.has(e)));s={...s,marks:l.map(e=>e.key)};for(let e of a)h.has(e)||o(e,!1);for(let{key:e}of l)p.has(e)||o(e,!0);n.leave(a),c&&n.hover(l.map(({input:e})=>e)),g.forEach(({input:e},t)=>r.emit(`leave`,{...e,batch:{index:t,count:g.length}}));let _=l.length;l.forEach(({key:e,input:t},n)=>{p.has(e)||r.emit(`hover`,{...t,batch:{index:n,count:_},source:i})})},sync:()=>T.sync(),retarget(t){let n=T.retarget(t);c!==void 0&&(c=n,e.ring(c)),l?.shown()},focus(t){e.live(t)&&T.focus(t)},moveTabStop:t=>e.live(t)&&T.moveTabStop(t),leave:S,destroy(){u=!0,l?.gone(),l=void 0,x(!1),w.destroy(),T.destroy()}}}function or(e,t,n,r){return!n||n.text===``?[]:[{key:e,role:t,text:n.text,x:n.x,y:n.y,anchor:n.anchor,element:r}]}function sr(e){let t=new Map;return{get:e=>t.get(e),values:()=>t.values(),start(e){t.set(e.key,e),e.group.classList.add(`ec-leaving`),e.group.setAttribute(`aria-hidden`,`true`),e.leave=cr()},recall(e){let n=t.get(e);if(n)return t.delete(e),n.group.classList.remove(`ec-leaving`),n.group.removeAttribute(`aria-hidden`),n.leave?.resolve(),n.leave=void 0,n},sweep(){for(let n of[...t.values()]){let{leave:r}=n;r?.exited&&!e(n)&&(t.delete(n.key),n.leave=void 0,n.group.remove(),r.resolve())}},clear:()=>t.clear()}}function cr(){let e;return{exited:!1,gone:new Promise(t=>{e=t}),resolve:e}}function lr(e,t,n,r){if(!n.some((e,n)=>t[n]!==e))return;let i=r(),a=n.findIndex(e=>e===i),o=n[a]??null;n.forEach((t,n)=>{n<a?e.insertBefore(t,o):n>a&&e.appendChild(t)})}function ur(e,t){if(e===void 0||typeof e==`boolean`||e===`hidden`)return;let n=e=>{throw TypeError(`${t}: ${e}`)};typeof e==`object`&&e||n(`table must be true, false, "hidden" or an object of table options.`);let{hidden:r,columns:i,category:a,total:o,share:s,summary:c,series:l}=e;r!==void 0&&typeof r!=`boolean`&&n(`table.hidden must be true or false.`);for(let[e,t]of Object.entries({category:a,total:o,share:s,summary:c}))t!==void 0&&typeof t!=`string`&&n(`table.${e} must be a string.`);if(l!==void 0){(typeof l!=`object`||!l||Array.isArray(l))&&n(`table.series must be an object of headers by series, as { shots: "Shots" }.`);for(let[e,t]of Object.entries(l))typeof t!=`string`&&n(`table.series.${e} must be a string: the column's header.`)}i!==void 0&&(Array.isArray(i)||n(`table.columns must be an array of { label, field }.`),i.forEach((e,t)=>{let r=typeof e==`object`&&e?e:n(`table.columns[${t}] must be an object with a label and a field.`);typeof r.label!=`string`&&n(`table.columns[${t}].label must be a string: the column's header.`),typeof r.field!=`string`&&typeof r.field!=`function`&&n(`table.columns[${t}].field must be a field name or a function of the row.`),r.format!==void 0&&typeof r.format!=`function`&&n(`table.columns[${t}].format must be a function.`),r.after!==void 0&&r.after!==`category`&&r.after!==`values`&&n(`table.columns[${t}].after must be "category" or "values".`)}))}function dr(e){let{option:t,format:n}=e;if(t===!1)return;let r=typeof t==`object`?t:{},i=r.columns??[],a=i.filter(e=>e.after!==`values`),o=i.filter(e=>e.after===`values`),s=e.total??e.series.length>1,c=e=>({text:n(e),numeric:!0}),l=e.rows.reduce((e,t)=>e+t.total,0),u=t=>e.shares?[{text:tr(l>0?t/l:0),numeric:!0}]:[],d=e=>({text:e.label,numeric:!1}),f=e=>r.series&&Object.prototype.hasOwnProperty.call(r.series,e)?r.series[e]:void 0,p=()=>({text:``,numeric:!1}),m={text:e.missing??`missing`,numeric:!0},h=[{text:r.category??e.category??`Category`,numeric:!1},...a.map(d),...e.series.map(t=>({text:f(t)??e.label?.(t)??t,numeric:!0})),...s?[{text:r.total??`Total`,numeric:!0}]:[],...e.shares?[{text:r.share??`Share`,numeric:!0}]:[],...o.map(d)],g=e.rows.map(t=>{let r=new Map(t.values.map(e=>[e.series,e.value]));return{key:t.key,cells:[{text:t.category,numeric:!1},...a.map(e=>fr(e,t,n)),...e.series.map(e=>t.missing?.has(e)?m:c(r.get(e)??0)),...s?[c(t.total)]:[],...u(t.total),...o.map(e=>fr(e,t,n))]}}),_=t=>e.rows.reduce((e,n)=>e+(n.values.find(e=>e.series===t)?.value??0),0),v=e.shares?[{text:r.total??`Total`,numeric:!1},...a.map(p),...e.series.map(e=>c(_(e))),...s?[c(l)]:[],...u(l),...o.map(p)]:void 0,y=h.length-o.length,b=[...a.map((e,t)=>1+t),...o.map((e,t)=>y+t)];for(let e of b){let t=g.map(t=>t.cells[e]).filter(e=>e.text!==``);t.length>0&&t.every(e=>e.numeric)&&(h[e]={...h[e],numeric:!0})}return{hidden:t===`hidden`||r.hidden===!0,summary:r.summary??`Data table`,caption:e.caption,headers:h,rows:g,...v?{footer:v}:{}}}function fr(e,t,n){let r=typeof e.field==`function`?e.field(t.datum,t.index):t.datum?.[e.field];return e.format?{text:String(e.format(r)),numeric:typeof r==`number`}:r==null?{text:``,numeric:!1}:typeof r==`number`?{text:n(r),numeric:!0}:{text:String(r),numeric:!1}}function pr(e){let t=e.ownerDocument,n,r,i,a,o,s,c,l=new Map,u=``,d=(e,n)=>{let r=t.createElement(e);return n&&(r.className=n),r};function f(){i=d(`table`),a=d(`caption`,`ec-table-caption`);let e=d(`thead`);return o=d(`tr`),e.appendChild(o),s=d(`tbody`),i.append(a,e,s),i}function p(t,a){let o=t?`DIV`:`DETAILS`;if(n?.tagName!==o){let e=t?d(`div`,`ec-table ec-visually-hidden`):d(`details`,`ec-table`),a=i??f();if(t)r=void 0,e.appendChild(a);else{r=d(`summary`);let t=d(`div`,`ec-table-scroll`);t.appendChild(a),e.append(r,t)}n?.isConnected&&n.replaceWith(e),n=e}n.isConnected||e.after(n),r&&r.textContent!==a&&(r.textContent=a)}function m(e,{text:t,numeric:n}){e.textContent!==t&&(e.textContent=t),e.classList.toggle(`ec-num`,n)}function h(){n?.remove(),n=r=i=a=o=s=c=void 0,l.clear(),u=``}return{render(e){if(!e){h();return}p(e.hidden,e.summary),a.textContent!==e.caption&&(a.textContent=e.caption);let t=JSON.stringify(e.headers);t!==u&&(u=t,o.replaceChildren(...e.headers.map(e=>{let t=d(`th`);return t.scope=`col`,m(t,e),t})),l.clear(),s.replaceChildren());let n=new Set(e.rows.map(e=>e.key));for(let[e,t]of l)n.has(e)||(t.remove(),l.delete(e));if(e.rows.forEach((e,t)=>{let n=l.get(e.key);n||(n=d(`tr`),n.setAttribute(`data-key`,e.key),e.cells.forEach((e,t)=>{let r=d(t===0?`th`:`td`);t===0&&(r.scope=`row`),n.appendChild(r)}),l.set(e.key,n)),e.cells.forEach((e,t)=>m(n.cells[t],e)),s.children[t]!==n&&s.insertBefore(n,s.children[t]??null)}),!e.footer){c?.remove(),c=void 0;return}let r=e.footer,f=c?.rows[0];c&&f&&f.cells.length===r.length||(c?.remove(),c=d(`tfoot`),f=d(`tr`),r.forEach((e,t)=>{let n=d(t===0?`th`:`td`);t===0&&(n.scope=`row`),f.appendChild(n)}),c.appendChild(f),i.appendChild(c)),r.forEach((e,t)=>m(f.cells[t],e))},destroy:h}}function mr(e,t){if(typeof e==`string`){let n=typeof document>`u`?null:document.querySelector(e);if(!n)throw TypeError(`${t}: no element matches "${e}".`);return n}if(!e||typeof e.appendChild!=`function`)throw TypeError(`${t} needs a container element or a selector.`);return e}function hr(e){let t=e.ownerDocument.defaultView?.getComputedStyle(e),n=(parseFloat(t?.paddingLeft??``)||0)+(parseFloat(t?.paddingRight??``)||0),r=e.clientWidth-n;return r>0?r:640}function gr(e,t){e.setAttribute(`aria-label`,t.label);let n=e.querySelector(`:scope > desc`);t.description?(n??(n=e.insertBefore(Y(`desc`,{},e),e.firstChild)),n.textContent=t.description):n?.remove()}function _r(e,t,n){for(let r of st){let i=e[r];if(i?.kind===`data`){for(let e of i.needs?.related??[])if(!t.includes(e))throw RangeError(`${n}: on.${r} needs the series "${e}", but the chart's series are ${t.map(e=>`"${e}"`).join(`, `)}.`)}}}function vr(e,t,n,r){let i=e=>st.includes(e)&&n?.[e]!==void 0&&n[e]===t?.[e],a=ct(Object.fromEntries(Object.entries(n??{}).filter(([e])=>!i(e))),r),o={};for(let t of st){let n=i(t)?e[t]:a[t];n&&(o[t]=n)}return o}function yr(e,t){if(typeof e!=`object`||!e)throw TypeError(`${t} needs options.`);if(typeof e.label!=`string`||e.label.trim()===``)throw TypeError(`${t} needs a label: the chart's accessible name.`);if(!Array.isArray(e.data))throw TypeError(`${t}: data must be an array of rows.`);for(let n of[`width`,`height`]){let r=e[n];if(r!==void 0&&!(typeof r==`number`&&Number.isFinite(r)&&r>0))throw RangeError(`${t}: ${n} must be a positive number of px, got ${String(r)}.`)}let{format:n,tooltip:r,markLabel:i,markDescription:a,legend:o,announce:s}=e;if(n!==void 0&&typeof n!=`function`)throw TypeError(`${t}: format must be a function that turns a value into text.`);if(r!==void 0&&typeof r!=`boolean`&&typeof r!=`function`)throw TypeError(`${t}: tooltip must be true, false or a function that returns a row's text.`);if(i!==void 0&&typeof i!=`function`)throw TypeError(`${t}: markLabel must be a function that returns a mark's accessible name.`);if(a!==void 0&&a!==!1&&typeof a!=`function`)throw TypeError(`${t}: markDescription must be false or a function that returns a mark's accessible description.`);if(Cn(o,t),Jn(e.seriesLabels,t),ur(e.table,t),s!==void 0&&typeof s!=`boolean`&&typeof s!=`function`)throw TypeError(`${t}: announce must be true, false or a function that returns the text to announce.`)}function br(e){let{clock:t}=e,n,r=0,i,a,o=!1;function s(t){if(o||n?.id!==t)return;let{waiters:r}=n;n=void 0,i?.(),i=void 0,e.land(),e.runner.settle(),e.leaving.sweep();for(let e of r)e()}return{run(a){e.draw();let o=++r;return new Promise(r=>{n={id:o,waiters:[...n?.waiters??[],r]},a.length===0?s(o):(i?.(),i=t.onFrame(()=>e.draw()),Promise.all(a).then(()=>s(o)))})},supersede:()=>a?.(),wait(e,t){return new Promise(n=>{a=n,e.then(()=>Promise.all(t.map(e=>e.gone))).then(()=>n())})},destroy(){o=!0,n=void 0,i?.(),a?.()}}}function xr(e,t,n){let{runner:r,events:i,input:a,onScreen:o}=e;r.interrupt();let s=t();e.swap?.(s),e.hover.dropGone();let c=s.exiting.map(e=>e.leave);return r.exit(s.exiting.map(o)).then(()=>{for(let e of c)e.exited=!0;e.leaving.sweep()}),i.emitEach(`exit`,s.exiting,o),(e.data||s.changed.length>0||s.entering.length>0||s.exiting.length>0)&&r.update(s.changed.map(({record:e,from:t})=>({...a(e),from:t}))),i.emitEach(`update`,s.changed,({record:e,from:t})=>({...a(e),from:t})),r.enter(s.entering.map(a)),i.emitEach(`enter`,s.entering,a),n(s),e.hover.sync(),c}function Q(e,t,n){return e.animating||!n(e.value,t)}let $=(e,t)=>e===t;function Sr(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])}function Cr(e,t){if(e.outline.d!==t.outline.d||wr(e,t))return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((e,t)=>e.key!==r[t].key||e.outline.d!==r[t].outline.d)}function wr(e,t){return Tr(e.labelBounds,t.labelBounds)||Tr(e.nearbyLabels,t.nearbyLabels)}function Tr(e,t){return e===t?!1:!e||!t||e.length!==t.length||e.some((e,n)=>e.x!==t[n].x||e.y!==t[n].y||e.width!==t[n].width||e.height!==t[n].height)}function Er(e,t,n,r){if(typeof ResizeObserver!=`function`)return()=>{};let i=n,a=n,o,s=new ResizeObserver(e=>{let n=e[e.length-1]?.contentRect.width??0;!(n>0)||Math.abs(n-a)<.5||(a=n,o??(o=t.onFrame(()=>{o?.(),o=void 0,Math.abs(a-i)<.5||(i=a,r(i))})))});return s.observe(e),()=>{s.disconnect(),o?.()}}function Dr(e,t){let n=e.fonts;return n?.addEventListener?.(`loadingdone`,t),()=>n?.removeEventListener?.(`loadingdone`,t)}function Or(e,t,n){if(typeof ResizeObserver!=`function`)return()=>{};let r=Y(`text`,{"font-size":11,visibility:`hidden`,"pointer-events":`none`,"aria-hidden":`true`},e);r.textContent=`Hamburgefonstiv 0123456789`;let i=0,a=0,o,s=new ResizeObserver(e=>{let s=e.find(e=>e.target===r)?.contentRect.width??0;!(s>0)||Math.abs(s-a)<.5||(a=s,i?o??(o=t.onFrame(()=>{o?.(),o=void 0,Math.abs(a-i)<.5||(i=a,n())})):i=s)});return s.observe(r),()=>{s.disconnect(),o?.(),r.remove()}}function kr(e,t){let n=()=>e.style.setProperty(`--ec-hover-duration`,`${t.duration(100,`feedback`)}ms`);return n(),t.subscribe(n)}let Ar=0;function jr(e,t,n,r){let i=e.top-12,a=n.height-e.bottom-12;return r??(r=t.height<=i||i>=a?`above`:`below`),{x:Math.max(0,Math.min(n.width-t.width,e.x-t.width/2)),y:r===`above`?i-t.height:e.bottom+12,side:r}}function Mr(e,t,n,r={}){let i=t.length===1&&t[0].series===`value`&&(t[0].label??`value`)===`value`,a=[t.map(e=>i?n(e.value):`${n(e.value)} ${e.label??e.series}`).join(` · `)];return t.length>1&&r.total!==!1&&a.push(`${n(t.reduce((e,t)=>e+t.value,0))} total`),{title:e,lines:a}}function Nr(e,n){let r,i,a,o=new WeakMap,s,c,l=!1,u,d=e=>e.style.setProperty(`--ec-hover-duration`,`${n.motion.duration(100,`feedback`)}ms`),f=()=>i?.classList.contains(`ec-tooltip-shown`)??!1,p=()=>{if(!c||!i||!r)return!1;let{x:e,y:t}=c,{left:n,right:a,top:o,bottom:s}=i.getBoundingClientRect();if(e>n&&e<a&&t>o&&t<s)return!0;if(!u)return!1;let l=r.getBoundingClientRect();return Pr(u,e-l.left,t-l.top)},m=e=>{l=e,r?.classList.toggle(`ec-tooltip-through`,e)},h=e=>{c=e.pointerType===`touch`?void 0:{x:e.clientX,y:e.clientY},l&&!p()&&m(!1)};e.ownerDocument.addEventListener(`pointerover`,h,!0),e.ownerDocument.addEventListener(`pointermove`,h,!0);function g(){if(!r||!i||!a){let t=e.ownerDocument;r=t.createElement(`div`),r.className=`ec-tooltip-layer`,i=t.createElement(`div`),i.className=`ec-tooltip`,i.setAttribute(`aria-hidden`,`true`),a=t.createElement(`div`),a.className=`ec-tooltip-bridge`,a.setAttribute(`aria-hidden`,`true`),r.append(i,a)}return r.previousSibling!==e&&e.after(r),i}function _(e,t){let r=n.option(),i=o.get(e);if(i&&i.option===r)return i.content;let a=Ir(r,e.datum,t,e.series);return o.set(e,{option:r,content:a}),a}function v(){i&&(d(i),i.classList.remove(`ec-tooltip-shown`),m(!1))}function y(t,n,i,o){let c=_(t,n);if(c===void 0){v();return}let h=g(),y=f()&&!l&&p(),b=typeof c==`string`?`text:${c}`:JSON.stringify(c);b!==s&&(Lr(h,c),s=b);let x=Rr(e),S=e.getBoundingClientRect(),C=S.width>0&&x.width>0?S.width/x.width:1,w={x:e=>(e-x.x)*C,y:e=>(e-x.y)*C},T=S.width>0?{width:S.width,height:S.height}:{width:x.width,height:x.height},E={width:h.offsetWidth,height:h.offsetHeight},D=i(w,o),O=jr(D,E,T,o?jr(i(w,!1),E,T).side:void 0),k=r.getBoundingClientRect(),A=S.left-k.left,j=S.top-k.top,M=Math.round(A+O.x),N=Math.round(j+O.y);h.style.left=`${M}px`,h.style.top=`${N}px`,h.setAttribute(`data-side`,O.side);let P=D.left===void 0||D.right===void 0?void 0:{left:A+D.left,right:A+D.right,top:j+D.top,bottom:j+D.bottom};u=Fr(a,{left:M,top:N,...E},P,O.side),d(h),h.classList.add(`ec-tooltip-shown`),m(!y&&p())}return{show(e,t,n,r){y(t,n,(t,n)=>{let i=n?r:void 0,{x:a,y:o,width:s,height:c}=e.bounds,l=[{x:a,y:o},{x:a+s,y:o},{x:a,y:o+c},{x:a+s,y:o+c}].map(e=>i?J.apply(i,e):e),u=l.map(e=>e.x),d=l.map(e=>e.y),f=i?J.apply(i,e.center):e.center;return{x:t.x(f.x),top:t.y(Math.min(...d)),bottom:t.y(Math.max(...d)),left:t.x(Math.min(...u)),right:t.x(Math.max(...u))}},r!==void 0)},showAt(e,t,n){y(t,n,t=>({x:t.x(e.x),top:t.y(e.top),bottom:t.y(e.bottom)}),!1)},describe(e,r){let i=n.description?.(),a;if(i===!1)a=void 0;else if(typeof i==`function`)try{let e=i(r.datum);a=typeof e==`string`&&e!==``?e:void 0}catch(e){t(e),a=void 0}else a=typeof n.option()==`function`?_(r,()=>``):void 0;let o=e.querySelector(`:scope > desc.ec-description`);if(typeof a!=`string`){if(!o)return;e.getAttribute(`aria-describedby`)===o.id&&e.removeAttribute(`aria-describedby`),o.remove()}else o??(o=Y(`desc`,{class:`ec-description`,id:`ec-description-${++Ar}`},e)),o.textContent!==a&&(o.textContent=a),e.setAttribute(`aria-describedby`,o.id)},element:()=>f()?r:void 0,hide:v,destroy(){e.ownerDocument.removeEventListener(`pointerover`,h,!0),e.ownerDocument.removeEventListener(`pointermove`,h,!0),r?.remove(),r=void 0,i=void 0,a=void 0,u=void 0,l=!1,o=new WeakMap,s=void 0}}}function Pr({top:e,bottom:t,upper:n,lower:r},i,a){if(a<=e||a>=t)return!1;let o=(a-e)/(t-e);return i>n.left+(r.left-n.left)*o&&i<n.right+(r.right-n.right)*o}function Fr(e,t,n,r){if(e.hidden=n===void 0,!n)return;let i={left:t.left,right:t.left+t.width},[a,o,s,c]=r===`above`?[i,n,t.top+t.height-1,Math.round(n.top+1)]:[n,i,Math.round(n.bottom-1),t.top+1],l=Math.round(Math.min(a.left,o.left)),u=Math.round(Math.max(a.right,o.right))-l,d=Math.max(0,c-s),f=e=>`${Math.round(e)-l}px`;e.style.left=`${l}px`,e.style.top=`${s}px`,e.style.width=`${u}px`,e.style.height=`${d}px`,e.style.setProperty(`clip-path`,`polygon(${f(a.left)} 0px, ${f(a.right)} 0px, ${f(o.right)} ${d}px, ${f(o.left)} ${d}px)`);let p=e=>({left:Math.round(e.left),right:Math.round(e.right)});return{top:s,bottom:s+d,upper:p(a),lower:p(o)}}function Ir(e,n,r,i){if(e!==!1){if(typeof e!=`function`)return r();try{let t=i===void 0?e(n):e(n,{series:i});return t==null||t===``?void 0:String(t)}catch(e){t(e);return}}}function Lr(e,t){if(typeof t==`string`){e.textContent=t;return}let n=e.ownerDocument,r=(e,t)=>{let r=n.createElement(`div`);return t&&(r.className=t),r.textContent=e,r};e.replaceChildren(r(t.title,`ec-tooltip-title`),...t.lines.map(e=>r(e)))}function Rr(e){let t=(e.getAttribute(`viewBox`)??``).split(/[\s,]+/).map(Number);return t.length===4&&t.every(Number.isFinite)?{x:t[0],y:t[1],width:t[2],height:t[3]}:{x:0,y:0,width:Number(e.getAttribute(`width`))||0,height:Number(e.getAttribute(`height`))||0}}function zr(e,n,r){let i=mr(e,`barChart`);Br(n);let o=n,s=Pn(n.motion,r.motion),c=ct(n.on,r.presets),l=Sn(n.colors),u=r.clock??a,d=i.ownerDocument;bn(d);let f=Y(`svg`,{class:`ec-chart ec-bar-chart`,role:`group`},i),p=Y(`g`,{class:`ec-grid`,"aria-hidden":`true`},f),m=Y(`g`,{class:`ec-axis`,"aria-hidden":`true`},f),h=Y(`g`,{class:`ec-focus`,"aria-hidden":`true`,visibility:`hidden`},f),g=[Y(`path`,{class:`ec-focus-ring`,"stroke-width":8,"stroke-linejoin":`round`},h),Y(`path`,{class:`ec-focus-gap`,"stroke-width":4,"stroke-linejoin":`round`},h)],_=Y(`g`,{class:`ec-marks`},f),v=Y(`g`,{class:`ec-overlay`,"aria-hidden":`true`},f),y=It(f),x=[],w=new Map,T=sr(e=>e.values.animating||e.presence.animating),E=new WeakMap,D=Yn(`barChart`),O=hr(i),k=!1,A,j;try{A=te(o),j=ce(o,A)}catch(e){throw f.remove(),e}let M=e=>w.get(e)??T.get(e),N=Kn({overlay:v,measure:y,mark:e=>({set:t=>{M(e)?.handle.set(t),K.restyled(e)},reset:()=>{M(e)?.handle.reset(),K.restyled(e)}}),colors:(e,t)=>M(e)?.parts[t===void 0?0:(M(e)?.shown.geometry.segments??[]).findIndex(e=>e.key===t)]?.colors}),P=Ct({effects:c,motion:s,icons:r.icons,clock:u,surface:N}),F=Nr(f,{motion:s,option:()=>o.tooltip,description:()=>o.markDescription}),I=Tn(f),ee=pr(f),L=o.announce?Ot(f):void 0,R=A.orientation,z=new Map,B=new Set,V=!1,H=!1,U=C(A.frame.scale,S,{clock:u,motion:s,onChange:()=>V=!0}),W=C(A.frame.bands,S,{clock:u,motion:s,onChange:()=>V=!0}),G=br({clock:u,runner:P,leaving:T,draw:me,land:he});function te(e,t=c){let n=Vt(e);return _r(t,n.series.map(e=>e.series),`barChart`),Ht({data:e.data,encoding:n,sort:e.sort,width:e.width??O,height:e.height,format:Xn(e),measure:y,room:e.room??0})}function ne(e,t){let n=Y(`g`,{class:`ec-mark`,"data-key":e.key,role:`img`},_),r={clock:u,motion:s,onChange:()=>B.add(a)},i=Gr(e),a={key:e.key,row:e,shown:e,group:n,hit:Y(`rect`,{class:`ec-hit`},n),label:Y(`text`,{class:`ec-label`,"aria-hidden":`true`},n),body:Y(`g`,{class:`ec-body`},n),value:Y(`text`,{class:`ec-value`,"aria-hidden":`true`},n),paths:new Map,parts:[],handle:zn(()=>a),values:C(t?Kr(i):i,S,r),series:e.values.map(e=>e.series),slot:C(e.slot,b,r),presence:C(+!t,b,r),drawn:{label:C(Number(e.drawn.label),b,r),value:C(Number(e.drawn.value),b,r)},count:void 0,leave:void 0};return E.set(n,a),re(a,t?de(a,ue()):e),a}function re(e,t){let n=e.parts;e.shown=t,X(e.hit,{...t.hit}),Ft(e.label,t.label),Ft(e.value,t.value);let r=(t,n)=>{let r=e.presence.value*(t?n.value:1);return r<1?r:void 0};X(e.label,{opacity:r(t.drawn.label,e.drawn.label)}),X(e.value,{opacity:r(t.drawn.value,e.drawn.value)});let i=t.geometry.segments??[],a=new Set,s=Vr(o)?pn(l.slot(e.key)):void 0;e.parts=i.map(t=>{let n=t.series??t.key;a.add(n);let r=e.paths.get(n);r||(r=Y(`path`,{class:`ec-segment`,"data-series":n},e.body),e.paths.set(n,r));let i=s??pn(l.slot(n));return r.setAttribute(`d`,t.outline.d),At(r,hn(i)),{element:r,d:t.outline.d,colors:i,visible:t.length>=.5}});for(let[t,n]of e.paths)a.has(t)||(n.remove(),e.paths.delete(t));let c=Array.from(e.body.children).filter(e=>e.classList.contains(`ec-segment`));if(e.parts.some((e,t)=>c[t]!==e.element))for(let t of e.parts)e.body.appendChild(t.element);e.handle.repaint(),(e.parts.length!==n.length||e.parts.some((e,t)=>e.colors.color!==n[t].colors.color))&&N.recolor(e.key),e.key===K.ringKey&&ie(e.key)}function ie(e){let t=e===void 0?void 0:w.get(e);if(!t){h.setAttribute(`visibility`,`hidden`);return}for(let e of g)e.setAttribute(`d`,t.shown.geometry.outline.d);let{transform:n}=t.handle.style;X(h,{transform:n&&Mt(n),visibility:void 0})}function ae(e,t){let n=Cr(e.shown.geometry,t.geometry)||e.shown.datum!==t.datum;re(e,t),n&&P.change(t.geometry,t.data),e.key===K.key&&oe(e)}function oe(e){let{row:t}=e;F.show(e.shown.geometry,t,()=>Mr(t.category,Ur(t.values,o),Xn(o)),e.handle.style.transform)}function se(e){Vr(o)?I.categories(e.rows.map(e=>({key:e.key,label:e.category})),l,o.legend):I.update(Vt(o).series.map(e=>({series:e.series,label:qn(o.seriesLabels,e.series)})),l,o.legend)}function ce(e,t){let n=Vt(e),r=n.orientation===`horizontal`?e.y:e.x;return dr({option:e.table,caption:e.label,category:typeof r==`string`?r:void 0,series:n.series.map(e=>e.series),label:t=>qn(e.seriesLabels,t),rows:t.rows.map(e=>({key:e.key,category:e.category,datum:e.datum,index:e.index,values:e.values,total:e.total})),format:Xn(e)})}function le(e,n){let r=o.announce;if(!L||!r)return;let i=Vt(o).series.map(e=>e.series),a=Vt(e).series.map(e=>e.series),s=Jr(o.sort),c=e=>e.row.category,l=n.changed.map(({record:e})=>e),u=Et({...o.label===e.label?{}:{label:o.label},...i.join(`
|
|
91
91
|
`)===a.join(`
|
|
92
|
-
`)?{}:{series:i.map(e=>qn(o.seriesLabels,e))},...s!==Jr(e.sort)||s===`custom`&&o.sort!==e.sort?{sort:s}:{},changed:l.map(c),added:n.entering.map(c),removed:n.exiting.map(c),count:x.length});if(typeof r!=`function`){L.say(u);return}let d=e=>e.key;try{let e=r({text:u,changed:l.map(d),added:n.entering.map(d),removed:n.exiting.map(d)});e!=null&&L.say(String(e))}catch(e){t(e)}}let
|
|
93
|
-
`),i=2*e.inner*.85,a=n(r[0],`ec-center-value`,26),o=a>i&&a>0?Math.max(14,26*i/a):26,s=r.map((e,t)=>t===0?0:20+(t-1)*16),c=s[s.length-1],l=e.cy+(.72*o-c)/2;return r.map((t,n)=>({x:e.cx,y:l+s[n],anchor:`middle`,text:t,size:n===0?o:Zr}))}function oi({data:e,encoding:t}){let n=new Set;return e.map((e,r)=>{let i=String(t.key(e,r));if(n.has(i))throw Error(`donutChart: two rows have the key "${i}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(i);let a=mi(t.value(e,r),t.series,i);return{key:i,category:String(t.category(e,r)??``),datum:e,index:r,value:a}})}function si(e,t){if(t===void 0||t===`none`)return e;if(t===`value`)return[...e].sort((e,t)=>t.value-e.value);throw TypeError(`donutChart: sort must be "value" or "none", got ${String(t)}.`)}function ci(e,t){let{width:n,measure:r}=e,i=e.height??300,a=n/2,o=i/2,s=r(`100%`,`ec-value`,Qr),c=t.reduce((e,t)=>Math.max(e,r(t.category,`ec-label`,Zr)),s),l=Math.min(a-4-10-c,o-4-10-28),u=Math.max(0,Math.min(a,o)-4),d=Math.max(0,l,u/2);return{width:n,height:i,cx:a,cy:o,inner:d*.6,outer:d}}function li(e,t,n){let r=(t.start+t.end)/2,i=Math.sin(r),a=Math.cos(r),o=e.outer+10,s=e.cx+o*i,c=e.cy-o*a,l=tr(t.share),u=[n(t.category,`ec-label`,Zr),n(l,`ec-value`,Qr)],d=Math.max(...u),f=c-28*(a+1)/2,p=e=>s+i*e/2;return{category:{x:p(u[0]),y:f+10,anchor:`middle`,text:t.category},share:{x:p(u[1]),y:f+10+15,anchor:`middle`,text:l},box:{x:p(d)-d/2,y:f,width:d,height:28}}}function ui(e,t){let n=[];return e.category.text!==``&&n.push(Pt(e.category,t,`ec-label`,Zr)),e.share.text!==``&&n.push(Pt(e.share,t,`ec-value`,Qr)),n}function di(e,t){return e.x<t.x+t.width+2&&t.x<e.x+e.width+2&&e.y<t.y+t.height+2&&t.y<e.y+e.height+2}function fi(e,t,n){let r={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related:e=>e===n?r:void 0};return r}function pi(e){return typeof e==`function`?e:t=>t[e]}function mi(e,t,n){if(e==null)return 0;if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return e;throw RangeError(`donutChart: "${t}" for "${n}" must be a finite number of 0 or more, got ${typeof e==`string`?JSON.stringify(e):String(e)}.`)}let hi=2*Math.PI;function gi(e,n,r){let i=mr(e,`donutChart`);_i(n);let o=n,s=Pn(n.motion,r.motion),c=lt(n.on,r.presets),l=Sn(n.colors),u=r.clock??a,d=i.ownerDocument;bn(d);let f=Y(`svg`,{class:`ec-chart ec-donut-chart`,role:`group`},i),p=Y(`g`,{class:`ec-center`,"aria-hidden":`true`},f),m=Y(`g`,{class:`ec-marks`},f),h=Y(`g`,{class:`ec-overlay`,"aria-hidden":`true`},f),g=Y(`g`,{class:`ec-halos`},h),_=Ln(h),v=Y(`g`,{class:`ec-runs`},h),y=It(f),x=[],w=new Map,T=sr(e=>e.value.animating||e.presence.animating),E=new WeakMap,D=Yn(`donutChart`),O=hr(i),k=!1,A,j,M;try{A=re(o),j=ue(o,A),M=yi(o,A)}catch(e){throw f.remove(),e}let N=e=>w.get(e)??T.get(e),P=Kn({overlay:v,measure:y,mark:e=>({set:t=>{N(e)?.handle.set(t),K.restyled(e)},reset:()=>{N(e)?.handle.reset(),K.restyled(e)}}),colors:e=>N(e)?.parts[0]?.colors}),F=Ct({effects:c,motion:s,icons:r.icons,clock:u,surface:P}),I=Nr(f,{motion:s,option:()=>o.tooltip,description:()=>o.markDescription}),ee=Tn(f),L=pr(f),R=o.announce?Ot(f):void 0,z=[],B=[],V=!1,te=C(A.frame,S,{clock:u,motion:s,onChange:()=>V=!0}),H,ne,U=br({clock:u,runner:F,leaving:T,draw:ve,land:be});function re(e,t=c){let n=$r(e);return _r(t,[n.series],`donutChart`),ei({data:e.data,encoding:n,sort:e.sort,width:e.width??O,height:e.height,center:t=>xi(e,n.series,t),measure:y})}function ie(e,t){let n=Y(`g`,{class:`ec-mark`,"data-key":e.key,role:`img`},m),r={clock:u,motion:s,onChange:()=>V=!0},i=Y(`g`,{class:`ec-body`},n),a={key:e.key,row:e,shown:e,group:n,hit:Y(`path`,{class:`ec-hit`},n),body:i,path:Y(`path`,{class:`ec-slice`,"data-series":e.series},i),label:Y(`text`,{class:`ec-label`,"aria-hidden":`true`},n),share:Y(`text`,{class:`ec-value`,"aria-hidden":`true`},n),drawnLabel:void 0,parts:[],handle:zn(()=>a,{halos:()=>g}),value:C(t?0:e.value,b,r),turn:C(1,b,r),offset:0,planned:0,presence:C(+!t,b,r),leave:void 0};return n.insertBefore(a.hit,i),E.set(n,a),a}function ae(e,t,n){let r=e.parts[0]?.colors.color;e.shown=t;let{outline:i}=t.geometry,a=t.geometry.length>=.5,o=a?void 0:`hidden`;X(e.path,{d:i.d,visibility:o}),X(e.hit,{d:i.d,visibility:o});let s=pn(l.slot(e.key));At(e.path,hn(s)),e.parts=[{element:e.path,d:i.d,colors:s,visible:a}];let c=e.presence.value,u=c<1?c:void 0;e.drawnLabel=n;for(let[t,r]of[[e.label,n?.category],[e.share,n?.share]])r&&Ft(t,r),X(t,{visibility:r?void 0:`hidden`,opacity:u});e.handle.repaint(),s.color!==r&&P.recolor(e.key),e.key===K.ringKey&&oe(e.key)}function oe(e){let t=e===void 0?void 0:w.get(e);_.draw(t&&{outline:t.shown.geometry.outline,thickness:t.shown.geometry.thickness,transform:t.handle.style.transform})}function se(e,t,n){let r=Cr(e.shown.geometry,t.geometry)||e.shown.datum!==t.datum;ae(e,t,n),r&&F.change(t.geometry,t.data),e.key===K.key&&ce(e)}function ce(e){let{row:t}=e;I.show(e.shown.geometry,t,()=>({title:t.category,lines:[`${vi(t,o)} · ${tr(t.share)}`]}),e.handle.style.transform)}function le(e){for(;p.childElementCount>e.length;)p.lastElementChild.remove();e.forEach((e,t)=>{let n=p.children[t]??Y(`text`,{},p);X(n,{class:t===0?`ec-center-value`:`ec-center-label`}),Ft(n,e),At(n,{"font-size":t===0&&e.size!==26?`${e.size}px`:void 0})})}let W=()=>ee.categories(A.slices.map(e=>({key:e.key,label:e.category})),l,o.legend);function ue(e,t){let{series:n}=$r(e);return dr({option:e.table,caption:e.label,category:typeof e.category==`string`?e.category:void 0,series:[n],label:t=>qn(e.seriesLabels,t),rows:t.slices.map(e=>({key:e.key,category:e.category,datum:e.datum,index:e.index,values:[{series:n,value:e.value}],total:e.value})),format:Xn(e),shares:!0})}function de(){gr(f,{label:o.label,description:Si(o.description,A.centerText)})}function fe(e,n){let r=o.announce;if(!R||!r)return;let i=$r(o).series,a=$r(e).series,s=o.sort??`none`,c=e=>e.row.category,l=n.changed.map(({record:e})=>e),u=Et({...o.label===e.label?{}:{label:o.label},...i===a?{}:{series:[qn(o.seriesLabels,i)]},...s===(e.sort??`none`)?{}:{sort:s},changed:l.map(c),added:n.entering.map(c),removed:n.exiting.map(c),count:x.length});if(typeof r!=`function`){R.say(u);return}let d=e=>e.key;try{let e=r({text:u,changed:l.map(d),added:n.entering.map(d),removed:n.exiting.map(d)});e!=null&&R.say(String(e))}catch(e){t(e)}}let pe=e=>w.get(e.key)===e||T.get(e.key)===e,me=e=>Math.max(0,e.value.value);function he(e,t,n=me){let r=new Map,i=0;for(let a of e)r.set(a,t>0?i/t:0),i+=n(a);return r}function ge(){z=z.filter(pe),B=B.filter(pe);let e=z.reduce((e,t)=>e+me(t),0),t=he(z,e),n=he(B,e),r=new Map;for(let i of z){let a=t.get(i),o=i.turn.value,s=n.get(i),c=a;if(s!==void 0&&o<1){let e=s+i.offset-a;c=a+(1-o)*(e-Math.round(e-i.planned))}r.set(i,{start:c,span:e>0?me(i)/e:0})}return r}function _e(e){let t=[...ge()].map(([e,{start:t,span:n}])=>{let{row:r}=e;return{record:e,state:{key:r.key,datum:r.datum,index:r.index,category:r.category,series:r.series,value:me(e),share:n,start:t*hi,end:(t+n)*hi}}}),n=ii(e,t.map(({state:e})=>e),y),r=ni(e,t.map(({state:e})=>e),n,y);return t.map(({record:e},t)=>({record:e,slice:r[t],label:n[t]}))}function ve(){if(!V)return;V=!1;let e=te.value;X(f,jt(e));let t=_e(e);for(let{record:e,slice:n,label:r}of t)se(e,n,r);let n=t.reduce((e,{slice:t})=>e+t.value,0);le(ai(e,H===void 0?A.centerText:ye(er(n,H)),y))}function ye(e){return ne?.total!==e&&(ne={total:e,text:xi(o,$r(o).series,e)}),ne.text}function be(){z=z.filter(pe),B=z;for(let e of z)e.turn.set(1),e.offset=0,e.planned=0;H=void 0,ne=void 0,X(f,jt(A.frame)),A.slices.forEach((e,t)=>se(w.get(e.key),e,A.labels[t])),le(A.center),V=!1}function xe(e){let t=new Set(e.slices.map(e=>e.key)),n={entering:[],exiting:[],changed:[]};for(let e of x)t.has(e.key)||(w.delete(e.key),T.start(e),n.exiting.push(e));let r=x;return x=e.slices.map(e=>{let t=w.get(e.key);return t?(t.row.value!==e.value||t.row.series!==e.series)&&n.changed.push({record:t,from:t.shown.geometry}):(t=T.recall(e.key)??ie(e,!0),w.set(e.key,t),n.entering.push(t)),t.row=e,t.path.setAttribute(`data-series`,e.series),Se(t),t}),lr(m,r.map(e=>e.group),x.map(e=>e.group),K.active),n}function Se(e){e.group.setAttribute(`aria-label`,M.get(e.key)),I.describe(e.group,e.row)}function Ce(e,t){V=!0;let n=ge(),r=new Set(x.filter(e=>e.presence.value===0)),i=x.filter(e=>!r.has(e)),a=[...T.values()],o=B.length>0&&B.every(e=>e.turn.value===0),c=z;if(z=Ci(c,x),!o){B=c;let e=he(c,c.reduce((e,t)=>e+me(t),0));for(let t of c)t.offset=n.get(t).start-e.get(t)}B=B.filter(e=>!r.has(e));let l=e=>w.get(e.key)===e?e.row.value:0,u=z.reduce((e,t)=>e+l(t),0),d=he(z,u,l),f=he(B,u,l),p=!1;for(let e of B){let t=f.get(e)+e.offset-d.get(e);e.planned=t-Math.round(t),Math.abs(e.planned)>1e-9&&(p=!0)}let m=i.some(e=>Q(e.value,e.row.value,$)||Q(e.presence,1,$))||a.some(e=>Q(e.value,0,$)||Q(e.presence,0,$)),h=p||r.size>0||Q(te,e.frame,Sr),g,_,v;if(!t&&s.staged){let e=m?500:0;g={duration:500},_={duration:500,delay:e},v={duration:250,delay:e+250}}else t||(g=_=v={duration:(m&&h?2:1)*500});let y=[],b=(e,t,n,r)=>{Q(e,t,n)&&(r?y.push(e.to(t,r)):e.set(t))};b(te,e.frame,Sr,_);for(let e of i)b(e.value,e.row.value,$,g),b(e.presence,1,$,g);for(let e of r)b(e.value,e.row.value,$,v),b(e.presence,1,$,v);for(let e of a)b(e.value,0,$,g),b(e.presence,0,$,g);if(t){B=z;for(let e of z)e.turn.set(1),e.offset=0,e.planned=0;return y}let S=new Set(B);for(let e of z)e.turn.set(+!S.has(e));if(p)for(let e of B)b(e.turn,1,$,_);return y}function G(e,t){return A=e,U.run(Ce(e,t))}let we=e=>({mark:e.row.geometry,data:e.row.data}),Te=e=>({mark:e.shown.geometry,data:e.shown.data});function Ee(e){let t=e,n=typeof t?.closest==`function`?t.closest(`.ec-mark`):null,r=n?E.get(n):void 0;return r&&w.get(r.key)===r?r:void 0}let K=ar({svg:f,runner:F,events:D,dim:()=>o.dim!==!1,find(e){let t=Ee(e);return t&&{key:t.key}},live:e=>w.has(e),order:()=>x.map(e=>e.key),element:e=>N(e)?.group,hot:P.hot,onScreen(e){let t=N(e);return t&&Te(t)},ring:oe,tooltip:{show(e){let t=w.get(e);t&&ce(t)},hide:()=>I.hide(),element:()=>I.element()}}),De=kr(f,s);function Oe(){if(k)return;let e=re(o),t=new Map(e.slices.map(e=>[e.key,e]));for(let e of x)e.row=t.get(e.key)??e.row;G(e,!0)}let ke=()=>{y.clear(),Oe()},Ae=Or(f,u,ke),je=Er(i,u,O,e=>{O=e,o.width===void 0&&Oe()}),Me=Dr(d,ke);return de(),W(),L.render(j),X(f,jt(A.frame)),x=A.slices.map(e=>{let t=ie(e,!1);return w.set(e.key,t),Se(t),t}),z=B=x,A.slices.forEach((e,t)=>ae(x[t],e,A.labels[t])),le(A.center),K.sync(),F.enter(x.map(we)),An(K.link,{element:f,async update(e){if(k)return;if(e.motion!==void 0&&e.motion!==o.motion)throw TypeError("donutChart: `motion` can't be changed by update() yet.");let t={...o,...e};_i(t);let n=`on`in e?vr(c,o.on,t.on,r.presets):c,i=re(t,n),a=ue(t,i),u=yi(t,i);`colors`in e&&(l=Sn(t.colors));let d=o,p=A.total;o=t,A=i,M=u,de(),W(),L.render(a);let m=R!==void 0;o.announce&&!R?R=Ot(f):!o.announce&&R&&(R.destroy(),R=void 0),K.syncDim(),U.supersede();let h=n!==c;c=n;let g=xr({runner:F,events:D,hover:K,leaving:T,input:we,onScreen:Te,data:`data`in e,...h?{swap:e=>{let t=new Set(e.entering);F.swap(n,x.filter(e=>!t.has(e)).map(we))}}:{}},()=>xe(i),e=>{m&&fe(d,e)});H=i.total===p?void 0:Math.max($n(p),$n(i.total));let _=G(i,s.mode===`off`);await U.wait(_,g)},on:D.on,marks:()=>x.map(e=>e.shown.geometry),focus(e){k||K.focus(e)},leave(){k||K.leave()},labels:()=>x.flatMap(e=>[...or(e.key,`category`,e.drawnLabel?.category,e.label),...or(e.key,`value`,e.drawnLabel?.share,e.share)]),paintOf:e=>w.has(e)?{color:e,drawn:!0}:void 0,moveTabStop:e=>!k&&K.moveTabStop(e),destroy(){if(!k){k=!0,U.destroy(),K.destroy(),F.destroy(),I.destroy(),ee.destroy(),L.destroy(),R?.destroy(),De(),Ae(),je(),Me();for(let e of[...x,...T.values()]){for(let t of[e.value,e.turn,e.presence])t.stop();e.leave?.resolve()}te.stop(),D.clear(),w.clear(),T.clear(),x=z=B=[],f.remove()}}})}function _i(e){yr(e,`donutChart`);let{center:t,sort:n}=e;if(t!==void 0&&t!==!1&&typeof t!=`function`)throw TypeError(`donutChart: center must be false or a function that returns the text for the total.`);if(n!==void 0&&n!==`none`&&n!==`value`)throw TypeError(`donutChart: sort must be "value" or "none", got ${String(n)}.`)}function vi(e,t){let n=Xn(t)(e.value),r=qn(t.seriesLabels,e.series);return e.series===`value`&&r===`value`?n:`${n} ${r}`}function yi(e,t){return new Map(t.slices.map(t=>[t.key,bi(t,e)]))}function bi(e,n){let r=`${e.category}: ${vi(e,n)}, ${tr(e.share)}`;if(!n.markLabel)return r;try{let t={series:e.series,label:qn(n.seriesLabels,e.series),value:e.value},i=n.markLabel(e.datum,{key:e.key,category:e.category,values:[t],total:e.value,share:e.share,format:Xn(n),text:r});if(i!=null&&String(i).trim()!==``)return String(i)}catch(e){t(e)}return r}function xi(e,n,r){let{center:i}=e,a=Xn(e);if(i===!1)return``;if(i===void 0){let t=qn(e.seriesLabels,n);return n===`value`&&t===`value`?a(r):`${a(r)}\n${t}`}try{let e=i(r,a);return e==null?``:String(e)}catch(e){return t(e),``}}function Si(e,t){let n=t.split(`
|
|
94
|
-
`).join(` `).trim(),r=e?.trim();return n===``?e:r?/[.!?:;]$/.test(r)?`${r} ${n}`:`${r}. ${n}`:n}function Ci(e,t){let n=[...t];return e.forEach((t,r)=>{if(n.includes(t))return;let i=0;for(let t=r-1;t>=0;t--){let r=n.indexOf(e[t]);if(r>=0){i=r+1;break}}n.splice(i,0,t)}),n}let wi=[`linear`,`monotone`];function Ti(e){return+(e===`monotone`)}function Ei(e,t,n,r,i){let a=new Int32Array(e.length).fill(-1),o=[],s=[],c=[],l=[],u=0,d=!1;for(let n=0;n<e.length;n++){let r=t[n];if(r===void 0){d=!1;continue}let f=o.length-1;d&&e[n]===o[f]&&r===s[f]?(a[n]=f,l[f]=Math.max(l[f],i?.[n]??1)):(d&&e[n]!==o[f]||u++,o.push(e[n]),s.push(r),c.push(u),l.push(i?.[n]??1),a[n]=f+1,d=!0)}let f=n>0?new Float64Array(o.length):void 0;if(f)for(let e=0;e<o.length;){let t=e+1;for(;t<o.length&&c[t]===c[e];)t++;Di(o,s,e,t,f),i&&Oi(o,s,l,e,t,f),e=t}let p=(e,t)=>{let r=a[e];if(r<0||a[t]!==r+1||c[r+1]!==c[r])return;let i=o[r+1]-o[r],l=s[r],u=s[r+1],d=(u-l)/i,[p,m]=d<0?[3*d,0]:[0,3*d],h=e=>Math.min(m,Math.max(p,n===1?e:d+n*(e-d))),g=f?h(f[r]):d,_=f?h(f[r+1]):d;return[l,l+i*g/3,u-i*_/3,u,r]};return{between(e,t,n=1/0){let i=p(e,t);if(!i||!f)return[];let[a,s,c,l,u]=i,d=o[u],m=o[u+1]-d,h=r.x(d),g=r.x(o[u+1]),_=Math.min(Te({x:h,y:r.y(a)},{x:h+(g-h)/3,y:r.y(s)},{x:g-(g-h)/3,y:r.y(c)},{x:g,y:r.y(l)}),Math.max(1,Math.ceil(Math.abs(g-h)/Se))),v=[];for(let e=1;e<_;e++){let t=d+e/_*m;if(!(t<n))break;v.push({x:t,value:Ai(a,s,c,l,e/_)})}return v},valueAt(e,n,r){let i=p(e,n);if(!i)return t[e]??0;let[a,s,c,l,u]=i;return Ai(a,s,c,l,(r-o[u])/(o[u+1]-o[u]))}}}function Di(e,t,n,r,i){let a=r-n;if(a<2){a===1&&(i[n]=0);return}let o=n=>(t[n+1]-t[n])/(e[n+1]-e[n]);if(a===2)i[n]=i[n+1]=o(n);else{for(let t=n+1;t<r-1;t++){let n=e[t]-e[t-1],r=e[t+1]-e[t],a=o(t-1),s=o(t),c=(a*r+s*n)/(n+r);i[t]=(ki(a)+ki(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(c))||0}i[n]=(3*o(n)-i[n+1])/2,i[r-1]=(3*o(r-2)-i[r-2])/2}}function Oi(e,t,n,r,i,a){let o=[];for(let e=r;e<i;e++)n[e]>=1&&o.push(e);if(o.length===i-r||o.length<2)return;let s=o.map(t=>e[t]),c=o.map(e=>t[e]),l=new Float64Array(o.length);Di(s,c,0,o.length,l);let u=new Float64Array(i-r),d=0,f=0;for(let t=r;t<i;t++){for(;d<s.length-2&&s[d+1]<=e[t];)d++;let p=o[f]===t?f++:-1,m=1;for(let e=Math.max(r,t-2);e<Math.min(i,t+3);e++)m=Math.min(m,n[e]);if(m>=1){u[t-r]=a[t];continue}let h;if(p>=0)h=l[p];else{let n=s[d+1]-s[d],r=Math.min(1,Math.max(0,(e[t]-s[d])/n));h=(6*r*r-6*r)*(c[d]-c[d+1])/n+(3*r*r-4*r+1)*l[d]+(3*r*r-2*r)*l[d+1]}u[t-r]=m*a[t]+(1-m)*h}a.set(u,r)}let ki=e=>e<0?-1:1;function Ai(e,t,n,r,i){let a=1-i;return a*a*a*e+3*a*a*i*t+3*a*i*i*n+i*i*i*r}let ji=1e3,Mi=60*ji,Ni=60*Mi,Pi=24*Ni,Fi={second:ji,minute:Mi,hour:Ni,day:9e7,week:6084e5,month:31*Pi,year:366*Pi},Ii=[...[1,5,15,30].map(e=>({unit:`second`,count:e})),...[1,5,15,30].map(e=>({unit:`minute`,count:e})),...[1,3,6,12].map(e=>({unit:`hour`,count:e})),{unit:`day`,count:1},{unit:`day`,count:2},{unit:`week`,count:1},{unit:`month`,count:1},{unit:`month`,count:3}],Li=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],Ri={second:`second`,minute:`minute`,hour:`hour`,day:`day`,week:`day`,month:`month`,year:`year`},zi={year:{year:`numeric`},month:{month:`short`},day:{month:`short`,day:`numeric`},hour:{hour:`numeric`,minute:`2-digit`},minute:{hour:`numeric`,minute:`2-digit`},second:{hour:`numeric`,minute:`2-digit`,second:`2-digit`},millisecond:{hour:`numeric`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3}};function Bi(e){if(e===`UTC`||e===`local`)return!0;if(typeof e!=`string`)return!1;try{return ia(e),!0}catch{return!1}}function Vi(e){for(let t of Ii)if(Fi[t.unit]*t.count>=e)return t;return{unit:`year`,count:Math.max(1,en(e/Fi.year))}}function Hi(e,t,n){let r=Ji(n);if(!(t>e))return[{value:e,text:r(e,`year`)}];let i=Vi((t-e)/4),a=Li[Math.min(Li.indexOf(Ri[i.unit]),Li.indexOf(Ui(e,t,n)))],o=Wi(e,t,i,n).map(e=>({value:e,text:r(e,`millisecond`)}));return[{value:e,text:r(e,a)},...o,{value:t,text:r(t,a)}]}function Ui(e,t,n){let[r,i]=[Xi(e,n),Xi(t,n)];return r.year===i.year?r.month===i.month?r.date===i.date?r.hours===i.hours?r.minutes===i.minutes?`second`:`minute`:`hour`:`day`:`month`:`year`}function Wi(e,t,n,r){let{unit:i,count:a}=n,o=[],s=Xi(e,r);if(i===`second`||i===`minute`||i===`hour`){let n=i===`hour`?15*Mi:Fi[i],c=e-s.ms-(i===`second`?0:s.seconds*ji)-(i===`hour`?s.minutes%15*Mi:0);for(;c<t;c+=n){let t=Xi(c,r),n=i!==`hour`||t.minutes===0,s=i===`second`?t.seconds:i===`minute`?t.minutes:t.hours;c>e&&n&&s%a===0&&o.push(c)}return o}let c=i===`day`?e=>Zi(r,s.year,s.month,s.date+e):i===`week`?e=>Zi(r,s.year,s.month,s.date-(s.weekday+6)%7+7*e):i===`month`?e=>Zi(r,s.year,Math.floor(s.month/a)*a+a*e,1):e=>Zi(r,Math.floor(s.year/a)*a+a*e,0,1),l=-1/0;for(let n=0;;n++){let s=c(n);if(s>=t||s<=l)break;l=s,s>e&&(i!==`day`||(Xi(s,r).date-1)%a==0)&&o.push(s)}return o}function Gi(e,t,n){let{year:r,month:i,date:a,hours:o,minutes:s,seconds:c,ms:l}=Xi(e,n),u=new Date(0);u.setUTCFullYear(r,i+t+1,0);let d=Math.min(a,u.getUTCDate());return Qi(n,r,i+t,d,o,s,c,l)}function Ki(e,t){let{ms:n,seconds:r,minutes:i,hours:a,date:o,month:s}=Xi(e,t);return n===0?r===0?i===0?a===0?o===1?s===0?`year`:`month`:`day`:`hour`:`minute`:`second`:`millisecond`}function qi(e,t){let n=ta(t),r=e.reduce((e,t)=>Math.max(e,Li.indexOf(Ki(n(t),`UTC`))),0),i=Yi(t),a=r>=Li.indexOf(`second`)?`medium`:r>=Li.indexOf(`hour`)?`short`:void 0,o=r===Li.indexOf(`millisecond`)?{year:`numeric`,...zi.day,...zi.millisecond,timeZone:i}:{dateStyle:`medium`,...a?{timeStyle:a}:{},timeZone:i},s=new Intl.DateTimeFormat(void 0,o);if(t===`UTC`||!a)return e=>s.format(e);let c=new Intl.DateTimeFormat(void 0,{timeZone:i,timeZoneName:`short`});return e=>{let t=s.format(e);if(na(e,n)===void 0)return t;let r=c.formatToParts(e).find(e=>e.type===`timeZoneName`)?.value;return r?`${t} ${r}`:t}}function Ji(e){let t=new Map;return(n,r)=>{let i=Li.indexOf(Ki(n,e)),a={};for(let e=Math.min(i,Li.indexOf(r));e<=i;e++)Object.assign(a,zi[Li[e]]);let o=JSON.stringify(a),s=t.get(o);return s||t.set(o,s=new Intl.DateTimeFormat(void 0,{...a,timeZone:Yi(e)})),s.format(n)}}let Yi=e=>e===`local`?void 0:e;function Xi(e,t){let n=new Date(t===`UTC`||t===`local`?e:ea(e,t));return t===`local`?{year:n.getFullYear(),month:n.getMonth(),date:n.getDate(),weekday:n.getDay(),hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds(),ms:n.getMilliseconds()}:{year:n.getUTCFullYear(),month:n.getUTCMonth(),date:n.getUTCDate(),weekday:n.getUTCDay(),hours:n.getUTCHours(),minutes:n.getUTCMinutes(),seconds:n.getUTCSeconds(),ms:n.getUTCMilliseconds()}}function Zi(e,t,n,r){return Qi(e,t,n,r)}function Qi(e,t,n,r,i=0,a=0,o=0,s=0){if(e===`local`){let e=new Date(0);return e.setFullYear(t,n,r),e.setHours(i,a,o,s),e.getTime()}let c=$i(t,n,r,i,a,o,s);if(e===`UTC`)return c;let l=c-(ea(c-Pi,e)-(c-Pi)),u=c-(ea(c+Pi,e)-(c+Pi));if(l===u)return l;let d=[l,u].filter(t=>ea(t,e)===c);return d.length>0?Math.min(...d):l}function $i(e,t,n,r=0,i=0,a=0,o=0){let s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(r,i,a,o),s.getTime()}function ea(e,t){if(t===`UTC`)return e;if(t===`local`){let t=new Date(e);return $i(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}let n=(e%ji+ji)%ji,r={};for(let i of ia(t).formatToParts(e-n))r[i.type]=i.value;let i=Number(r.year);return $i(r.era===`BC`?1-i:i,Number(r.month)-1,Number(r.day),Number(r.hour)%24,Number(r.minute),Number(r.second),n)}function ta(e){if(e===`UTC`||e===`local`)return t=>ea(t,e);let t=new Map;return n=>{let r=t.get(n);return r===void 0&&t.set(n,r=ea(n,e)),r}}function na(e,t){let n=t(e);for(let r of[e-Pi,e+Pi]){let i=n-(t(r)-r);if(i!==e&&t(i)===n)return i}}let ra=new Map;function ia(e){let t=ra.get(e);return t||(t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hourCycle:`h23`,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}),ra.set(e,t)),t}let aa=2.25,oa=4.5,sa=12.5,ca=.36;function la(e){let{x:t,series:n,key:r}=e;if(typeof t!=`string`&&typeof t!=`function`)throw TypeError(`lineChart needs x: a field of numbers or Dates, or a function that returns each row's x.`);if(!Array.isArray(n)||n.length===0)throw TypeError(`lineChart needs series: the numeric fields to draw as lines.`);let i=new Set;for(let e of n){if(typeof e!=`string`||e===``)throw TypeError(`lineChart: each series must be a field name, got ${Fa(e)}.`);if(i.has(e))throw TypeError(`lineChart: "${e}" appears twice in series.`);i.add(e)}if(r!==void 0&&typeof r!=`string`&&typeof r!=`function`)throw TypeError(`lineChart: key must be a field name or a function.`);let a=e.labels;if(a!==void 0&&a!==!1&&typeof a!=`function`)throw TypeError(`lineChart: labels must be false or a function that returns a line's end label.`);let o=e.timeZone??`UTC`;if(!Bi(o))throw TypeError(`lineChart: timeZone must be "UTC", "local" or the name of a zone Intl knows, such as "Europe/London", got ${Fa(o)}.`);let s=e.xFormat;if(s!==void 0&&typeof s!=`function`)throw TypeError(`lineChart: xFormat must be a function that turns an x into text.`);let c=e.curve??`linear`;if(!wi.includes(c))throw TypeError(`lineChart: curve must be "linear" or "monotone", got ${Fa(c)}.`);return{x:Pa(t),key:r===void 0?void 0:Pa(r),series:n.map(e=>({series:e,value:Pa(e)})),timeZone:o,xFormat:e.xFormat,curve:c}}function ua(e){let t=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0;if(typeof e!=`object`||!e||Array.isArray(e)){if(e!==void 0&&!t(e))throw RangeError(`lineChart: room must be a number of px, 0 or more, got ${typeof e==`object`?JSON.stringify(e):String(e)}.`)}else for(let n of[`right`,`top`]){let r=e[n];if(r!==void 0&&!t(r))throw RangeError(`lineChart: room.${n} must be a number of px, 0 or more, got ${String(r)}.`)}}function da(e){let{width:t,measure:n}=e,r=e.height??300,{rows:i,time:a}=Ea(e),o=e.encoding.series.map(e=>e.series),s=$t(i.flatMap(e=>e.values.flatMap(e=>e.value===void 0?[]:[e.value]))),c=s.ticks.map(e.format),l=i[0]?.x??0,u=i[i.length-1]?.x??0,d=i.length===0?[]:a?Hi(l,u,e.encoding.timeZone):Ca(l,u).map(e=>({value:e,text:wa(e)})),f=d.map(e=>e.value),p=d.map(e=>e.text),m=p.map(e=>n(e,`ec-tick`,11)),h=typeof e.room==`number`?{right:e.room}:e.room,g=e.label?Na(Ma(i,e.label),`ec-value`,sa,n):0,_=Math.max(Na(c,`ec-tick`,11,n)+10,(m[0]??0)/2+2),v=Math.max(10,(m[m.length-1]??0)/2+2,(g>0?10+g+4:0)+(h?.right??0)),y=12+(h?.top??0),b={scale:{lo:s.lo,hi:s.hi},box:{xLo:l,xHi:u,left:_,right:Math.max(_,t-v),top:y,bottom:Math.max(y,r-32),width:t,height:r}},x={};for(let e of o)x[e]=0;for(let e of i)for(let t of e.values)t.value!==void 0&&(x[t.series]=Math.max(x[t.series],$n(t.value)));let S=f.map((e,t)=>Sa(b,e,p[t]));return{width:t,height:r,frame:b,rows:i,time:a,series:o,yTicks:s.ticks.map((e,t)=>xa(b,e,c[t])),xTicks:Ta(S,m),decimals:x,curve:e.encoding.curve}}function fa(e){let{scale:t,box:n}=e,r=n.xHi-n.xLo,i=t.hi-t.lo;return{x:e=>r>0?n.left+(e-n.xLo)/r*(n.right-n.left):(n.left+n.right)/2,y:e=>i>0?n.bottom-(e-t.lo)/i*(n.bottom-n.top):n.bottom}}function pa(e,t,n,r,i=!1,a,o=0){let s=t[0];if(!s)return[];let c=fa(e),l=0;for(;l+1<t.length&&t[l+1].x<=r;)l++;let u=t[l],d=t[l+1],f=d&&d.x>u.x&&r>u.x?(r-u.x)/(d.x-u.x):void 0,p=t.slice(0,l+1),m=o>0?t.map(e=>e.x):[],h=o>0&&t.some(e=>e.presence!==void 0&&e.presence<1)?t.map(e=>e.presence??1):void 0,g=new Map,_=e=>t=>t===e?void 0:g.get(t),v=n.map(e=>{let n=t=>!t.missing?.has(e),i=o>0?Ei(m,t.map(t=>n(t)?t.values[e]??0:void 0),o,c,h):void 0,a=[],g=!1,_=-1;if(p.forEach((r,o)=>{if(!n(r))g=a.length>0;else{if(i&&_>=0)for(let e of i.between(_,o))a.push({at:e.x,value:e.value,datum:t[_].datum,gapBefore:!1});a.push({at:r.x,value:r.values[e]??0,datum:r.datum,gapBefore:g}),g=!1,_=o}}),f!==void 0&&n(u)&&n(d)){if(i)for(let e of i.between(l,l+1,r))a.push({at:e.x,value:e.value,datum:u.datum,gapBefore:!1});let t=u.values[e]??0,n=i?i.valueAt(l,l+1,r):t+f*((d.values[e]??0)-t);a.push({at:r,value:n,datum:u.datum,gapBefore:!1})}return{name:e,vertices:a,points:a.length>0?a.map(e=>({x:c.x(e.at),y:c.y(e.value)})):[{x:c.x(s.x),y:c.y(s.values[e]??0)}]}}),y=v.filter(({vertices:e})=>e.length>0),b=a?ya(e,y.map(({name:e,vertices:t,points:n})=>({...n[n.length-1],text:a.text(e,t[t.length-1].value)}))):[],x=a?b.map(e=>e.text===``?void 0:Pt(e,a.measure,`ec-value`,sa)):[];return v.map(({name:e,vertices:t,points:n})=>{let r=n[n.length-1],o=y.findIndex(t=>t.name===e),c=a?b[o]??{x:r.x+10,y:r.y+sa*ca,anchor:`start`,text:``}:void 0,l=x[o],d=a?l?[l]:[]:void 0,f=a?x.filter((e,t)=>e!==void 0&&t!==o):void 0,p=t.flatMap((e,t)=>e.gapBefore?[t]:[]),m=_e({key:e,series:e,points:n,width:aa,...p.length>0?{breaks:p}:{},...d?{labelBounds:d}:{},...f?{nearbyLabels:f}:{}}),h=0,v=t.map((e,r)=>(r>0&&(h+=Math.hypot(n[r].x-n[r-1].x,n[r].y-n[r-1].y)),{t:m.length>0?r===t.length-1?1:Math.min(1,h/m.length):0,value:e.value,at:Aa(e.at,i),...e.gapBefore?{gapBefore:!0}:{}})),S=t[t.length-1],C={datum:S?S.datum:u.datum,samples:v,related:_(e)};return g.set(e,C),{series:e,geometry:m,data:C,end:{...r,value:S?S.value:s.values[e]??0},label:c}})}function ma(e,t){let n=new Set;if(!e.some(e=>e.missing!==void 0&&e.missing.size>0))return n;let r=(e,t)=>e!==void 0&&!e.missing?.has(t);return e.forEach((i,a)=>{for(let o of t){let t=e[a-1],s=e[a+1];!r(i,o)||r(t,o)||r(s,o)||t===void 0&&s===void 0||n.add(ha(o,i.key))}}),n}function ha(e,t){return`${e}@${t}`}function ga(e,t,n,r=!1){let i=fa(e),a=i.x(t.x),o=new Map;return n.filter(e=>!t.missing?.has(e)).map(e=>{let n=t.values[e]??0,s=ha(e,t.key),c={datum:t.datum,samples:[{t:0,value:n,at:Aa(t.x,r)}],related:t=>t===e?void 0:o.get(t)};return o.set(e,c),{key:s,series:e,geometry:xe({key:s,series:e,x:a,y:i.y(n),r:oa}),data:c}})}function _a(e,t){let{width:n,height:r}=e.box;return t.map((e,i)=>{let a=i===0?0:(t[i-1]+e)/2,o=i===t.length-1?n:(e+t[i+1])/2;return{x:a,y:0,width:Math.max(0,o-a),height:r}})}function va(e,t){return{x1:t,y1:e.box.top,x2:t,y2:e.box.bottom}}function ya(e,t){let n=sa/2,r=ba(t.map(e=>e.y),16,n,e.box.height-n);return t.map((e,t)=>({x:e.x+10,y:r[t]+sa*ca,anchor:`start`,text:e.text}))}function ba(e,t,n,r){let i=e.map((e,t)=>({value:e,index:t})).sort((e,t)=>e.value-t.value||e.index-t.index),a=[],o=e=>{let i=e.reduce((e,t)=>e+t.value,0)/e.length,a=(e.length-1)*t;return Math.max(n,Math.min(r-a,i-a/2))};for(let e of i)for(a.push({members:[e],start:o([e])});a.length>1;){let e=a[a.length-1],n=a[a.length-2];if(e.start-(n.start+(n.members.length-1)*t)>=t)break;a.pop(),n.members.push(...e.members),n.start=o(n.members)}let s=Array(e.length);for(let e of a)e.members.forEach((n,r)=>s[n.index]=e.start+r*t);return s}function xa(e,t,n){let{box:r}=e,i=fa(e).y(t);return{value:t,line:{x1:r.left,y1:i,x2:r.right+8,y2:i},label:{x:r.left-8,y:i+11*ca,anchor:`end`,text:n}}}function Sa(e,t,n){return{value:t,label:{x:fa(e).x(t),y:e.box.bottom+18,anchor:`middle`,text:n}}}function Ca(e,t){if(!(t>e))return[e];let n=en((t-e)/4),r=[e];for(let i=Math.floor(e/n)+1;un(i*n)<t;i++){let t=un(i*n);t>e&&r.push(t)}return r.push(t),r}function wa(e){return String(e)}function Ta(e,t){if(e.length<=1)return[...e];let n=e.map((e,n)=>({tick:e,from:e.label.x-t[n]/2,to:e.label.x+t[n]/2})),r=n[n.length-1],i=[n[0]];for(let e of n.slice(1,-1))e.from-i[i.length-1].to>=8&&r.from-e.to>=8&&i.push(e);return r.from-i[i.length-1].to>=8&&i.push(r),i.map(e=>e.tick)}function Ea({data:e,encoding:t}){let n=new Set,r=!1,i=e.map((e,i)=>{let a=t.x(e,i);i===0&&(r=a instanceof Date);let o=Oa(a,i,r),s=String(t.key?t.key(e,i):r?new Date(o).toISOString():o);if(n.has(s))throw Error(`lineChart: two rows have the key "${s}". Keys must be unique.`);return n.add(s),{key:s,datum:e,index:i,x:o,values:t.series.map(({series:t,value:n})=>({series:t,value:ja(n(e,i),t,s)}))}});i.sort((e,t)=>e.x-t.x);for(let e=1;e<i.length;e++){let[t,n]=[i[e-1],i[e]];if(t.x===n.x){let e=r?new Date(t.x).toISOString():wa(t.x);throw Error(`lineChart: the rows "${t.key}" and "${n.key}" have the same x, ${e}. Each x is one point on every line, so x values must be unique.`)}}let a=ka(t,r,i.map(e=>e.x)),o=Da(i,t.series.length);return{rows:i.map((e,t)=>({...e,label:a(e.x),missing:new Set(e.values.flatMap(e=>e.value===void 0?[e.series]:[])),levels:o[t]})),time:r}}function Da(e,t){let n=e.map(()=>({}));for(let r=0;r<t;r++){let t=-1,i=-1;e.forEach((a,o)=>{let{series:s,value:c}=a.values[r];if(c!==void 0){n[o][s]=c,t=o;return}if(i<=o)for(i=o+1;i<e.length&&e[i].values[r].value===void 0;)i++;let l=e[t]?.values[r].value,u=e[i]?.values[r].value;n[o][s]=l!==void 0&&u!==void 0?l+(a.x-e[t].x)/(e[i].x-e[t].x)*(u-l):l??u??0})}return n}function Oa(e,t,n){if(e instanceof Date){if(!n)throw TypeError(`lineChart: x must be all numbers or all Dates, but row 0's is a number and row ${t}'s a Date.`);let r=e.getTime();if(Number.isNaN(r))throw TypeError(`lineChart: x must be a valid Date, got an invalid Date in row ${t}.`);return r}if(n)throw TypeError(typeof e==`number`?`lineChart: x must be all numbers or all Dates, but row 0's is a Date and row ${t}'s a number.`:`lineChart: x must be a valid Date, got ${Fa(e)} in row ${t}.`);if(typeof e!=`number`||!Number.isFinite(e))throw RangeError(`lineChart: x must be a finite number, got ${Fa(e)} in row ${t}.`);return e}function ka(e,t,n){let{xFormat:r}=e;return r?e=>r(t?new Date(e):e):t?qi(n,e.timeZone):wa}function Aa(e,t){return t?new Date(e):e}function ja(e,t,n){if(typeof e==`number`&&Number.isFinite(e))return e;if(e!=null)throw RangeError(`lineChart: "${t}" for "${n}" must be a finite number, or null or undefined where it has no value, got ${Fa(e)}.`)}function Ma(e,t){let n=new Map;for(let r of e)for(let{series:e,value:i}of r.values){if(i===void 0)continue;let r=t(e,i),a=r.replace(/\d/g,`0`);n.has(a)||n.set(a,r)}return[...n.values()]}function Na(e,t,n,r){return e.reduce((e,i)=>Math.max(e,r(i,t,n)),0)}function Pa(e){return typeof e==`function`?e:t=>t[e]}let Fa=e=>typeof e==`string`?JSON.stringify(e):String(e);function Ia(e,n,r){let i=mr(e,`lineChart`);yr(n,`lineChart`);let o=to(n);no(n);let s=n,c=Pn(n.motion,r.motion),l=lt(n.on,r.presets),u=Sn(n.colors),d=r.clock??a,f=i.ownerDocument;bn(f);let p=Y(`svg`,{class:`ec-chart ec-line-chart`,role:`group`},i),m=Y(`g`,{class:`ec-grid`,"aria-hidden":`true`},p),h=Y(`g`,{class:`ec-axis`,"aria-hidden":`true`},p),g=Y(`line`,{class:`ec-crosshair`,"aria-hidden":`true`,visibility:`hidden`},p),_=Y(`g`,{class:`ec-focus`,"aria-hidden":`true`,visibility:`hidden`},p),v=Y(`g`,{class:`ec-lines`},Y(`g`,{class:`ec-marks`,"aria-hidden":`true`},p)),y=Y(`g`,{class:`ec-overlay`,"aria-hidden":`true`},p),x=Y(`g`,{class:`ec-points`},Y(`g`,{class:`ec-marks`,"aria-hidden":`true`},p)),w=Y(`g`,{class:`ec-columns`},p),T=It(p),E=[],D=new Map,O=new Map,k=new WeakMap,A=[],j=new Map,M=new Map,N=sr(e=>e.kind===`line`?e.presence.animating:e.row.presence.animating||e.row.values.animating||e.row.x.animating),P=Yn(`lineChart`),F=hr(i),I=!1,ee=1/0,L=new WeakSet,R,z,B,V;try{R=ge(s),z=wt(s,R),B=o===`x`?$a(s,R):void 0,V=o===`point`?eo(s,R):void 0}catch(e){throw p.remove(),e}let te=e=>M.get(e)??j.get(e)??N.get(e),H=Kn({overlay:y,measure:T,mark:e=>({set:t=>{te(e)?.handle.set(t),J.restyled(e)},reset:()=>{te(e)?.handle.reset(),J.restyled(e)}}),colors:e=>te(e)?.parts[0]?.colors}),ne=Ct({effects:l,motion:c,icons:r.icons,clock:d,surface:H}),U=Nr(p,{motion:c,option:()=>s.tooltip,description:()=>s.markDescription}),re=Tn(p),ie=pr(p),ae=s.announce?Ot(p):void 0,oe=!1,se=()=>{oe=!0},ce=C(R.frame.scale,S,{clock:d,motion:c,onChange:se}),le=C(R.frame.box,S,{clock:d,motion:c,onChange:se}),W=C(Ti(R.curve),b,{clock:d,motion:c,onChange:se}),ue=new Map,de=new Map,fe=R.decimals,pe={changed:[],added:[],removed:[]},me=R.frame,he=br({clock:d,runner:ne,leaving:N,draw:Ae,land:Me});function ge(e,t=l){let n=la(e);_r(t,n.series.map(e=>e.series),`lineChart`);let{room:r}=e;ua(r);let i=da({data:e.data,encoding:n,width:e.width??F,height:e.height,format:Xn(e),measure:T,label:_e(e,!0),room:r}),a=new Set(i.series);for(let e of i.rows)for(let t of i.series){let n=ha(t,e.key);if(a.has(n))throw RangeError(`lineChart: two marks would have the key "${n}". Series and keys joined with "@" must be unique.`);a.add(n)}for(let e of i.rows)if(a.has(e.key))throw RangeError(`lineChart: the key "${e.key}" would name both an x and a line or point. A row's key can't be a series, or a series and a key joined with "@".`);return i}function _e(e,n=!1){let{labels:r}=e;if(r===!1)return;let i=Xn(e);return(a,o)=>{let s=`${i(o)} ${qn(e.seriesLabels,a)}`;if(typeof r!=`function`)return s;try{let e=r(o,a,i);return e==null?``:String(e)}catch(e){return!n&&!L.has(r)&&(L.add(r),t(e)),s}}}function ve(e){let t=_e(s);if(t)return{text:(n,r)=>t(n,er(r,e[n]??$n(r))),measure:T}}function ye(e){let t=e.rows.map(La);return{lines:new Map(pa(e.frame,t,e.series,Se(e),e.time,ve(e.decimals),Ti(e.curve)).map(e=>[e.series,e])),points:new Map(t.flatMap(t=>ga(e.frame,t,e.series,e.time)).map(e=>[e.key,e]))}}function be(e){let t=e.rows[0],n=e.rows[e.rows.length-1];return t&&n?Math.min(Math.max(ee,t.x),n.x):ee}function Se(e){let t=e.rows[e.rows.length-1];return t&&ee<t.x?be(e):1/0}let Ce=e=>!e.leaving&&e.row.x<=be(R);function G(e,t){let n=Y(`g`,{class:`ec-column`,"data-key":e.key,role:`img`},w),r={clock:d,motion:c,onChange:se},i={key:e.key,row:e,column:n,hit:Y(`rect`,{class:`ec-hit`},n),x:C(e.x,b,r),values:C(e.levels,S,r),presence:C(+!t,b,r),anchor:void 0,points:[],leaving:!1,shown:!0,px:0};return k.set(n,i),i}function we(e,t,n){let r=Y(`g`,{class:`ec-line`,"data-key":e,"data-series":e},v),i=Y(`g`,{class:`ec-body`},r),a={kind:`line`,key:e,series:e,group:r,body:i,path:Y(`path`,{class:`ec-stroke`,"stroke-width":aa},i),end:Y(`circle`,{class:`ec-end`,r:oa},i),label:Y(`text`,{class:`ec-value ec-end-label`},r),drawnLabel:void 0,parts:[],handle:zn(()=>a),target:t,shown:t,presence:C(+!n,b,{clock:d,motion:c,onChange:se}),leave:void 0};return a}function Te(e,t){let n=Y(`g`,{class:`ec-point`,"data-key":t.key,"data-series":t.series},x),r=Y(`g`,{class:`ec-body`},n),i={kind:`point`,key:t.key,series:t.series,row:e,group:n,body:r,path:Y(`path`,{class:`ec-dot`},r),parts:[],handle:zn(()=>i),target:t,shown:t,hidden:void 0,leave:void 0};return i}let Ee=e=>te(e.key)===e,K=e=>e.points.filter(e=>M.get(e.key)===e),De=()=>[...N.values()].filter(e=>e.kind===`line`),Oe=()=>({scale:ce.value,box:le.value});function ke(){let e=e=>({x:e.x.value,values:e.values.value}),t=new Map,n=new Set,r=i=>{let a=t.get(i);if(a)return a;let o=i.presence.value,s=e(i);if(i.anchor&&o<1&&!n.has(i)){n.add(i);let e=r(i.anchor);n.delete(i),s={x:e.x+o*(s.x-e.x),values:S(e.values,s.values)(o)}}return t.set(i,s),s};return[...E,...[...O.values()].filter(e=>e.presence.value>0&&e.anchor)].map(e=>{let{x:t,values:n}=r(e),i=e.anchor&&e.presence.value<1?{presence:e.presence.value}:{};return{record:e,state:{key:e.key,datum:e.row.datum,x:t,values:n,missing:e.row.missing,...i}}}).sort((e,t)=>e.state.x-t.state.x)}function Ae(){if(!oe)return;oe=!1;let e=Oe(),t=ke();Ne(e),Pe(e,t.map(e=>e.state));for(let{record:n,state:r}of t){let t=new Map(ga(e,r,n.points.map(e=>e.series),R.time).map(e=>[e.key,e]));Ie(n.points.filter(Ee).flatMap(e=>t.has(e.key)?[{record:e,placed:t.get(e.key)}]:[]))}Ve(t.map(e=>e.state)),He(e,t),Je()}function je(){let e=Oe(),t=ke();Pe(e,t.map(e=>e.state)),He(e,t),Je()}function Me(){for(let e of O.values()){for(let t of[e.x,e.values,e.presence])t.stop();e.column.remove()}O.clear();for(let e of E)e.anchor=void 0,e.points=e.points.filter(Ee);for(let[e,t]of[[ue,R.yTicks],[de,R.xTicks]]){for(let t of[...e.values()])t.wanted||(t.line?.remove(),t.label.remove(),e.delete(t.value));for(let n of t){let t=e.get(n.value);t&&(t.line&&`line`in n&&X(t.line,{...n.line,opacity:void 0}),Ft(t.label,n.label),t.label.removeAttribute(`opacity`))}}fe=R.decimals;let{frame:e}=R;X(p,jt(e.box)),me=e;let t=ye(R),n=(e,t)=>{let n=e.flatMap(e=>{let n=t(e);return n?[{record:e,to:n}]:[]});if(!n.every(({record:e,to:t})=>Ha(e.target.geometry,t.geometry)&&Ua(e.target.data,t.data)))for(let{record:e,to:t}of n)e.target=t;Ie(n.map(({record:e})=>({record:e,placed:e.target})))};n(A,e=>t.lines.get(e.series)),Fe(new Map(A.flatMap(e=>t.lines.has(e.series)?[[e,t.lines.get(e.series)]]:[])));let r=E.map(e=>({record:e,state:La(e.row)}));for(let{record:e}of r)n(K(e),e=>t.points.get(e.key));Ve(r.map(e=>e.state)),He(e,r),Je(),oe=!1}function Ne(e){me=e,X(p,jt(e.box));let t=Xn(s);for(let n of ue.values()){let r=xa(e,n.value,t(n.value)),i=n.opacity.value<1?n.opacity.value:void 0;X(n.line,{...r.line,opacity:i}),Ft(n.label,r.label),X(n.label,{opacity:i})}for(let t of de.values())Ft(t.label,Sa(e,t.value,t.text).label),X(t.label,{opacity:t.opacity.value<1?t.opacity.value:void 0})}function Pe(e,t){let n=[...A,...De()];if(t.length===0||n.length===0)return;let r=pa(e,t,n.map(e=>e.series),Se(R),R.time,ve(fe),W.value);Ie(n.map((e,t)=>({record:e,placed:r[t]}))),Fe(new Map(n.map((e,t)=>[e,r[t]])))}function Fe(e){for(let[t,{label:n}]of e)n&&Ft(t.label,n),t.drawnLabel=n&&n.text!==``?n:void 0,X(t.label,{visibility:t.drawnLabel?void 0:`hidden`})}function Ie(e){let t=e.some(({record:e,placed:t})=>!Ua(e.shown.data,t.data));for(let{record:n,placed:r}of e)n.kind===`line`?Le(n,r,t):Re(n,r,t)}function Le(e,t,n){let r=n||Cr(e.shown.geometry,t.geometry);e.shown=t;let{geometry:i}=t;ze(e,pn(u.slot(e.series)),{visible:i.length>=.5,open:{width:i.thickness}}),X(e.end,{cx:i.end.x,cy:i.end.y,visibility:t.data.samples.length===0?`hidden`:void 0});let a=e.presence.value;X(e.group,{opacity:a<1?a:void 0}),r&&ne.change(i,t.data)}function Re(e,t,n){let r=n||Cr(e.shown.geometry,t.geometry);e.shown=t,ze(e,pn(u.slot(e.series)),{visible:!0}),r&&ne.change(t.geometry,t.data)}function ze(e,t,n){let r=e.parts[0],{d:i}=e.shown.geometry.outline,a=r?.colors.color!==t.color;(a||r?.d!==i||r.visible!==n.visible||r.open?.width!==n.open?.width)&&(e.path.getAttribute(`d`)!==i&&e.path.setAttribute(`d`,i),a&&At(e.group,hn(t)),e.parts=[{element:e.path,d:i,colors:t,...n}],e.handle.repaint(),r&&a&&H.recolor(e.key))}let Be=!1;function Ve(e){let t=ma(e,R.series);if(t.size!==0||Be){for(let e of M.values())e.group.classList.toggle(`ec-alone`,t.has(e.key));Be=t.size>0}}function He(e,t){let{x:n}=fa(e),r=t.filter(({record:e})=>Ce(e)),i=_a(e,r.map(({state:e})=>n(e.x)));r.forEach(({record:e,state:t},r)=>{X(e.hit,{...i[r]}),e.px=n(t.x)});let a=new Set(r.map(({record:e})=>e));for(let e of[...E,...O.values()]){let t=a.has(e);e.shown!==t&&(e.shown=t,X(e.column,{visibility:t?void 0:`hidden`,"aria-hidden":e.leaving?`true`:void 0}));let n=!Ce(e);for(let t of e.points)t.hidden!==n&&(t.hidden=n,X(t.group,{visibility:n?`hidden`:void 0}),H.hide(t.key,n))}et&>(e)}function Ue(e){let t=M.get(e);if(t){if(!Ce(t.row))return;let{row:e}=t.row;U.show(t.shown.geometry,mt(e,t.series),()=>Za(e,t.series,s),t.handle.style.transform);return}let n=D.get(e);if(!n||!Ce(n))return;let r=K(n),i=r[0]?.shown.geometry.center.x??n.px;X(g,{...va(me,i),visibility:void 0});let a=r.map(e=>{let{transform:t}=e.handle.style,{center:n}=e.shown.geometry;return(t?q.apply(t,n):n).y}),{row:o}=n,c=a.length>0?{top:Math.min(...a)-oa,bottom:Math.max(...a)+oa}:{top:me.box.top,bottom:me.box.top};U.showAt({x:i,...c},o,()=>Xa(o,s))}function We(){g.setAttribute(`visibility`,`hidden`),U.hide()}function Ge(e){let t=e===void 0?void 0:D.get(e);!t||!Ce(t)?g.setAttribute(`visibility`,`hidden`):X(g,{...va(me,t.px),visibility:void 0})}let Ke;function qe(e){let t=e===void 0?void 0:M.get(e),n=e===void 0?void 0:t?.row??D.get(e),r=n!==void 0&&Ce(n),i=r?t?[t]:K(n):[];if(r&&i.length===0)Ke??(Ke=Y(`line`,{class:`ec-focus-ring`,"stroke-width":2},_)),(_.childElementCount>1||_.firstElementChild!==Ke)&&_.replaceChildren(Ke),X(Ke,va(me,n.px)),_.removeAttribute(`visibility`);else{for(Ke?.remove();_.childElementCount>i.length;)_.lastElementChild.remove();i.forEach((e,t)=>{let n=_.children[t];n||(n=Y(`g`,{},_),Y(`path`,{class:`ec-focus-ring`,"stroke-width":8},n),Y(`path`,{class:`ec-focus-gap`,"stroke-width":4},n));for(let t of Array.from(n.children))t.setAttribute(`d`,e.shown.geometry.outline.d);let{transform:r}=e.handle.style;X(n,{transform:r&&Mt(r)})}),X(_,{visibility:i.length>0?void 0:`hidden`})}}function Je(){J.key!==void 0&&Ue(J.key),J.standing!==void 0&&Ge(J.standing),J.ringKey!==void 0&&qe(J.ringKey)}let Ye=e=>({mark:e.target.geometry,data:e.target.data}),Xe=e=>({mark:e.shown.geometry,data:e.shown.data});function Ze(e){let t=D.get(e);if(!t||!Ce(t))return;let{row:n}=t;return{mark:xe({key:e,x:t.px,y:me.box.top,r:oa}),data:{datum:n.datum,samples:[{t:0,value:NaN,at:R.time?new Date(n.x):n.x}],related:()=>void 0}}}function Qe(e){let t=e,n=typeof t?.closest==`function`?t.closest(`.ec-column`):null,r=n?k.get(n):void 0;return r&&D.get(r.key)===r&&Ce(r)?r:void 0}let et,tt,nt=new Map,rt=[],it=new WeakMap;function at(){let e=new Map(R.series.map(e=>[e,[]]));for(let t of E)for(let n of K(t))e.get(n.series)?.push(n);return[...e.values()].flat()}let ot=e=>E.filter(Ce).flatMap(t=>K(t).filter(t=>t.series===e));function st(e){let t=E.filter(Ce).flatMap(K),n,r=1/0,i=1/0;for(let a of t){let t=Ga(a.shown.geometry.center,e),o=R.series.indexOf(a.series);(t<r||t===r&&o<i)&&([n,r,i]=[a,t,o])}if(!n)return;let a=n.shown.geometry.center,o=new Map;for(let n of t){let{center:t}=n.shown.geometry,r=o.get(n.series);Ga(t,a)<=1&&(!r||Ga(t,e)<Ga(r.shown.geometry.center,e))&&o.set(n.series,n)}if(o.size<2)return n;let s=n,c=1/0;for(let t of R.series){let n=o.get(t);if(!n)continue;let r=ct(n,e);r<c&&([s,c]=[n,r])}return s}function ct(e,t){let{geometry:n,data:r}=e.shown,i=j.get(e.series);return(i&&Ka(i.shown,r.samples[0].at,n.center,t,9))??Math.max(0,Math.hypot(t.x-n.center.x,t.y-n.center.y)-4.5)}function ut(e){let t=J.key===void 0||!U.element()?void 0:M.get(J.key);if(!t||!Ce(t.row))return;let{transform:n}=t.handle.style,r=e;if(n)try{r=q.apply($e(n),e)}catch{return}let{center:i}=t.shown.geometry;return(r.x-i.x)**2+(r.y-i.y)**2<=4.5**2?t:void 0}function dt(e,t){let n=ft(e,t);return ut(n)??st(n)}function ft(e,t){let n=p.getBoundingClientRect(),r=n.width>0&&me.box.width>0?n.width/me.box.width:1;return{x:(e-n.left)/r,y:(t-n.top)/r}}let pt=new WeakMap;function mt(e,t){let n=pt.get(e);n||pt.set(e,n=new Map);let r=n.get(t);return r||n.set(t,r={datum:e.datum,series:t}),r}function ht(){if(o!==`point`)return;et||(et=Y(`g`,{class:`ec-stops`},p),p.insertBefore(et,w.nextSibling),tt=Y(`rect`,{class:`ec-hit`},et),et.addEventListener(`click`,e=>{let t=dt(e.clientX,e.clientY);t&&nt.get(t.key)?.element.focus()}));let e=at(),t=new Set(e.map(e=>e.key));for(let[e,n]of nt)t.has(e)||(n.element.remove(),nt.delete(e));let n=e.map(e=>{let t=nt.get(e.key);if(!t){let n=Y(`g`,{class:`ec-stop`,"data-key":e.key,role:`img`},et);t={element:n,bounds:Y(`circle`,{r:8.5,fill:`none`},n),x:NaN,y:NaN,hidden:void 0},nt.set(e.key,t),it.set(n,e.key)}let n=V?.get(e.key)??e.key;return t.element.getAttribute(`aria-label`)!==n&&t.element.setAttribute(`aria-label`,n),U.describe(t.element,mt(e.row.row,e.series)),t.element});lr(et,rt,n,J.active),rt=n}function gt(e){let{left:t,right:n,top:r,bottom:i}=e.box;X(tt,{x:t-oa,y:r-oa,width:n-t+2*oa,height:i-r+2*oa});for(let[e,t]of nt){let n=M.get(e);if(!n)continue;let r=!Ce(n.row);t.hidden!==r&&(t.hidden=r,X(t.element,{visibility:r?`hidden`:void 0}));let{x:i,y:a}=n.shown.geometry.center;(t.x!==i||t.y!==a)&&(t.x=i,t.y=a,X(t.bounds,{cx:i,cy:a}))}}function _t(e){let t=M.get(e);if(t)return t.row.key;let n=E.filter(Ce),r=n.findIndex(t=>t.key===e);for(let e=0;r>=0&&e<n.length;e++)for(let t of[r+e,r-e]){let e=n[t]&&K(n[t])[0];if(e)return e.key}}function vt(e){e!==o&&(J.leave(),o=e,e===`point`?(ht(),gt(me)):w.removeAttribute(`display`),J.retarget(_t),e===`point`?w.setAttribute(`display`,`none`):(et?.remove(),et=tt=void 0,nt.clear(),rt=[]))}let yt=new Map;function bt(e,t){let n=t?o===`point`?te(e)?.series:void 0:yt.get(e);n!==void 0&&(t?yt.set(e,n):yt.delete(e),H.hot(e,t),(t||![...yt.values()].includes(n))&&(te(n)?.group.classList.toggle(`ec-hot-line`,t),H.hot(n,t)))}function xt(e){let t=o===`point`?M.get(e):void 0,n=o===`point`?t?.row:D.get(e);return n!==void 0&&Ce(n)}let J=ar({svg:p,runner:ne,events:P,dim:()=>o===`point`&&s.dim!==!1&&J.key!==void 0,hot:bt,find(e,t){if(o===`x`){let t=Qe(e);return t&&{key:t.key}}let n=e;if(!et||typeof n?.closest!=`function`||!et.contains(n))return;if(t){let e=dt(t.x,t.y);return e&&{key:e.key}}let r=n.closest(`.ec-stop`),i=r?it.get(r):void 0;return i!==void 0&&xt(i)?{key:i}:void 0},moves:()=>o===`point`,live:xt,order:()=>(o===`point`?at().filter(e=>Ce(e.row)):E.filter(Ce)).map(e=>e.key),page(e,t){let n=o===`point`?M.get(e):void 0,r=n?ot(n.series).map(e=>({key:e.key,x:e.row.row.x})):E.filter(Ce).map(e=>({key:e.key,x:e.row.x})),i=r.findIndex(t=>t.key===e);if(i<0)return;if(!R.time)return n?r[Math.min(r.length-1,Math.max(0,i+t*Math.ceil(r.length/10)))].key:void 0;let a=Gi(r[i].x,t,la(s).timeZone);if(t>0)return(r.find(e=>e.x>=a)??r[r.length-1])?.key;for(let e=r.length-1;e>=0;e--)if(r[e].x<=a)return r[e].key;return r[0]?.key},move(e,t){let n=o===`point`?M.get(e):void 0;if(!n)return;let r=t===`ArrowUp`||t===`ArrowDown`?K(n.row).sort((e,t)=>e.shown.geometry.center.y-t.shown.geometry.center.y):ot(n.series),i=r.indexOf(n),a=t===`Home`?0:t===`End`?r.length-1:i+(t===`ArrowDown`||t===`ArrowRight`?1:-1);return r[Math.max(0,Math.min(r.length-1,a))]?.key},marks:e=>{let t=D.get(e);return t?K(t).map(e=>e.key):M.has(e)?[e]:[]},element:e=>(D.get(e)??O.get(e))?.column??nt.get(e)?.element,markElement:e=>te(e)?.group,onScreen(e){let t=te(e);return t&&Xe(t)},standIn:Ze,stand:Ge,ring:qe,tooltip:{show:Ue,hide:We,element:()=>U.element()}}),St=()=>re.update(R.series.map(e=>({series:e,label:qn(s.seriesLabels,e)})),u,s.legend);function wt(e,t){return dr({option:e.table,caption:e.label,category:typeof e.x==`string`?e.x:void 0,series:t.series,label:t=>qn(e.seriesLabels,t),rows:t.rows.map(e=>({key:e.key,category:e.label,datum:e.datum,index:e.index,values:Ra(e.values),missing:e.missing,total:Ba(e.values)})),format:Xn(e),total:!1,missing:no(e)})}function Tt(e){o===`x`&&(e.column.setAttribute(`aria-label`,B.get(e.key)),U.describe(e.column,e.row))}function Dt(e,n){let r=s.announce;if(!ae||!r)return;let i=R.series,a=e=>e.row.label,{changed:o,added:c,removed:l}=pe,u=Et({...s.label===e.label?{}:{label:s.label},...i.join(`
|
|
92
|
+
`)?{}:{series:i.map(e=>qn(o.seriesLabels,e))},...s!==Jr(e.sort)||s===`custom`&&o.sort!==e.sort?{sort:s}:{},changed:l.map(c),added:n.entering.map(c),removed:n.exiting.map(c),count:x.length});if(typeof r!=`function`){L.say(u);return}let d=e=>e.key;try{let e=r({text:u,changed:l.map(d),added:n.entering.map(d),removed:n.exiting.map(d)});e!=null&&L.say(String(e))}catch(e){t(e)}}let ue=()=>({orientation:R,scale:U.value,bands:W.value});function de(e,t){let{row:n}=e,r=e.values.value,i=e.series.map(e=>({series:e,value:r[e]??0})),a=i.reduce((e,t)=>e+t.value,0),s=e.count===void 0?n.value.text:Xn(o)(er(a,e.count)),c={label:e.drawn.label.value>0,value:e.drawn.value.value>0};return Jt(t,{key:n.key,datum:n.datum,index:n.index,category:n.category,values:i,slot:e.slot.value,text:s,drawn:c},y)}function fe(e,t){let n={value:e,line:Y(`line`,{class:e===0?`ec-baseline`:`ec-gridline`},p),label:Y(`text`,{class:`ec-tick`},m),opacity:C(t,b,{clock:u,motion:s,onChange:()=>H=!0}),wanted:!0};z.set(e,n);for(let e of[...z.values()].sort((e,t)=>e.value-t.value))p.appendChild(e.line),m.appendChild(e.label)}function pe(e,t){let n=Yt(t,e.value,Xn(o)(e.value)),r=e.opacity.value<1?e.opacity.value:void 0;X(e.line,{...n.line,opacity:r}),Ft(e.label,n.label),X(e.label,{opacity:r})}function me(){let e=ue();if(V&&X(f,jt(e.bands)),V||H)for(let t of z.values())pe(t,e);for(let t of[...x,...T.values()])(V||B.has(t))&&ae(t,de(t,e));V=!1,H=!1,B.clear()}function he(){X(f,jt(A.frame.bands));for(let e of[...z.values()])e.wanted||(e.line.remove(),e.label.remove(),z.delete(e.value));for(let e of A.ticks){let t=z.get(e.value);t&&(X(t.line,{...e.line,opacity:void 0}),Ft(t.label,e.label),t.label.removeAttribute(`opacity`))}for(let e of x)e.series=e.row.values.map(e=>e.series),e.count=void 0,ae(e,e.row);V=!1,H=!1,B.clear()}function ge(e){let t=new Set(e.rows.map(e=>e.key)),n={entering:[],exiting:[],changed:[]};for(let e of x)t.has(e.key)||(w.delete(e.key),T.start(e),e.count=void 0,n.exiting.push(e));let r=x;return x=e.rows.map(e=>{let t=w.get(e.key);return t?(Wr(t.row,e)&&n.changed.push({record:t,from:t.shown.geometry}),t.count=Math.max($n(t.row.total),$n(e.total))):(t=T.recall(e.key)??ne(e,!0),t.count=void 0,w.set(e.key,t),n.entering.push(t)),t.row=e,t.series=qr(t.series,e.values.map(e=>e.series)),_e(t),t}),lr(_,r.map(e=>e.group),x.map(e=>e.group),K.active),n}function _e(e){e.group.setAttribute(`aria-label`,Hr(e.row,o)),F.describe(e.group,e.row)}function ve(e,t){let{frame:n}=e;t&&(R=e.orientation);let r=new Set(e.ticks.map(e=>e.value));for(let e of r)z.has(e)||fe(e,0);for(let e of z.values())e.wanted=r.has(e.value);let i=new Set(x.filter(e=>e.presence.value===0)),a=x.filter(e=>!i.has(e)),o=[...T.values()],c=Q(U,n.scale,Sr)||[...z.values()].some(e=>Q(e.opacity,+!!e.wanted,$))||a.some(e=>Q(e.values,Gr(e.row),Sr)||Q(e.presence,1,$))||o.some(e=>Q(e.values,Kr(e.values.value),Sr)||Q(e.presence,0,$)),l=i.size>0||Q(W,n.bands,Sr)||a.some(e=>Q(e.slot,e.row.slot,$)),u,d,f,p,m;if(!t&&s.staged){let e=c?500:0,t=c&&l?500:250;u={duration:500},d={duration:500,delay:e},f={duration:250,delay:e+250},p={duration:t},m={duration:t,delay:t}}else t||(u=d=f={duration:(c&&l?2:1)*500});let h=[],g=(e,t,n,r)=>{Q(e,t,n)&&(r?h.push(e.to(t,r)):e.set(t))};g(U,n.scale,Sr,u),g(W,n.bands,Sr,d);for(let e of z.values())g(e.opacity,+!!e.wanted,$,u);for(let e of x){let t=!i.has(e);for(let n of[`label`,`value`]){let r=Number(e.row.drawn[n]);g(e.drawn[n],r,$,t?r?m:p:void 0)}}for(let e of a)g(e.values,Gr(e.row),Sr,u),g(e.presence,1,$,u),g(e.slot,e.row.slot,$,d);for(let e of i)e.slot.set(e.row.slot),g(e.values,Gr(e.row),Sr,f),g(e.presence,1,$,f);for(let e of o)g(e.values,Kr(e.values.value),Sr,u),g(e.presence,0,$,u);return h}function ye(e,t){return A=e,G.run(ve(e,t))}let be=e=>({mark:e.row.geometry,data:e.row.data}),xe=e=>({mark:e.shown.geometry,data:e.shown.data});function Se(e){let t=e,n=typeof t?.closest==`function`?t.closest(`.ec-mark`):null,r=n?E.get(n):void 0;return r&&w.get(r.key)===r?r:void 0}let K=ar({svg:f,runner:P,events:D,dim:()=>o.dim!==!1,find(e){let t=Se(e);if(!t)return;let n=e.closest(`.ec-segment`)?.getAttribute(`data-series`)??void 0;return n===void 0?{key:t.key}:{key:t.key,segment:n}},live:e=>w.has(e),order:()=>x.map(e=>e.key),element:e=>M(e)?.group,hot:N.hot,onScreen(e){let t=M(e);return t&&xe(t)},ring:ie,tooltip:{show(e){let t=w.get(e);t&&oe(t)},hide:()=>F.hide(),element:()=>F.element()}}),Ce=kr(f,s);function we(){if(k)return;let e=te(o),t=new Map(e.rows.map(e=>[e.key,e]));for(let e of x)e.row=t.get(e.key)??e.row;ye(e,!0)}let Te=()=>{y.clear(),we()},q=Or(f,u,Te),Ee=Er(i,u,O,e=>{O=e,o.width===void 0&&we()}),De=Dr(d,Te);gr(f,o),se(A),ee.render(j),X(f,jt(A.frame.bands));for(let e of A.ticks)fe(e.value,1);for(let e of z.values())pe(e,A.frame);return x=A.rows.map(e=>{let t=ne(e,!1);return w.set(e.key,t),_e(t),t}),K.sync(),P.enter(x.map(be)),An(K.link,{element:f,async update(e){if(k)return;if(e.motion!==void 0&&e.motion!==o.motion)throw TypeError("barChart: `motion` can't be changed by update() yet.");let t={...o,...e};Br(t);let n=`on`in e?vr(c,o.on,t.on,r.presets):c,i=te(t,n),a=ce(t,i);`colors`in e&&(l=Sn(t.colors));let u=o;o=t,gr(f,o),se(i),ee.render(a);let d=L!==void 0;o.announce&&!L?L=Ot(f):!o.announce&&L&&(L.destroy(),L=void 0),K.syncDim(),G.supersede();let p=n!==c;c=n;let m=xr({runner:P,events:D,hover:K,leaving:T,input:be,onScreen:xe,data:`data`in e,...p?{swap:e=>{let t=new Set(e.entering);P.swap(n,x.filter(e=>!t.has(e)).map(be))}}:{}},()=>ge(i),e=>{d&&le(u,e)});if(`colors`in e||Vr(o)!==Vr(u))for(let e of[...x,...T.values()])B.add(e);let h=ye(i,s.mode===`off`||i.orientation!==R);await G.wait(h,m)},on:D.on,marks:()=>x.map(e=>e.shown.geometry),focus(e){k||K.focus(e)},leave(){k||K.leave()},labels:()=>x.flatMap(e=>[...or(e.key,`category`,e.shown.label,e.label),...or(e.key,`value`,e.shown.value,e.value)]),paintOf(e){let t=w.get(e),n=t?.shown.geometry.segments?.[0];return t&&{color:Vr(o)?e:n?.series??n?.key??e,drawn:!0}},moveTabStop:e=>!k&&K.moveTabStop(e),destroy(){if(!k){k=!0,G.destroy(),K.destroy(),P.destroy(),F.destroy(),I.destroy(),ee.destroy(),L?.destroy(),Ce(),q(),Ee(),De();for(let e of[...x,...T.values()]){for(let t of[e.values,e.slot,e.presence,e.drawn.label,e.drawn.value])t.stop();e.leave?.resolve()}U.stop(),W.stop();for(let e of z.values())e.opacity.stop();D.clear(),w.clear(),T.clear(),x=[],f.remove()}}})}function Br(e){yr(e,`barChart`);let{colorBy:t,room:n}=e;if(n!==void 0&&!(typeof n==`number`&&Number.isFinite(n)&&n>=0))throw RangeError(`barChart: room must be a number of px, 0 or more, got ${String(n)}.`);if(t!==void 0&&t!==`series`&&t!==`category`)throw TypeError(`barChart: colorBy must be "series" or "category", got ${String(t)}.`);if(t===`category`&&e.stack!==void 0)throw TypeError(`barChart: colorBy: "category" gives each bar one colour, so it needs one series, not a stack. A stack colours its segments by series.`)}function Vr(e){return e.colorBy===`category`}function Hr(e,n){let r=Xn(n),i=Ur(e.values,n),a=i.length===1&&i[0].series===`value`&&i[0].label===`value`,o=`${e.category}: ${i.map(e=>a?r(e.value):`${r(e.value)} ${e.label}`).join(`, `)}`;if(!n.markLabel)return o;try{let t=n.markLabel(e.datum,{key:e.key,category:e.category,values:i,total:e.total,format:r,text:o});if(t!=null&&String(t).trim()!==``)return String(t)}catch(e){t(e)}return o}function Ur(e,t){return e.map(e=>({series:e.series,label:qn(t.seriesLabels,e.series),value:e.value}))}function Wr(e,t){return e.values.length!==t.values.length||e.values.some((e,n)=>e.series!==t.values[n].series||e.value!==t.values[n].value)}function Gr(e){return Object.fromEntries(e.values.map(e=>[e.series,e.value]))}function Kr(e){return Object.fromEntries(Object.keys(e).map(e=>[e,0]))}function qr(e,t){let n=[...t];return e.forEach((t,r)=>{if(n.includes(t))return;let i=0;for(let t=r-1;t>=0;t--){let r=n.indexOf(e[t]);if(r>=0){i=r+1;break}}n.splice(i,0,t)}),n}function Jr(e){return typeof e==`function`?`custom`:e??`none`}let Yr=2*Math.PI,Xr=Math.PI/12,Zr=12.5,Qr=12.5;function $r(e){let{category:t,value:n,key:r}=e;if(typeof t!=`string`&&typeof t!=`function`)throw TypeError(`donutChart needs a category: the field, or a function, that names each slice.`);if(typeof n!=`string`&&typeof n!=`function`)throw TypeError(`donutChart needs a value: the numeric field, or a function, that sizes each slice.`);if(r!==void 0&&typeof r!=`string`&&typeof r!=`function`)throw TypeError(`donutChart: key must be a field name or a function.`);let i=pi(t);return{category:i,key:r===void 0?i:pi(r),series:typeof n==`string`?n:`value`,value:pi(n)}}function ei(e){let t=si(oi(e),e.sort),n=ci(e,t),r=t.reduce((e,t)=>e+t.value,0),i=ti(t.map(e=>e.value)),a=t.map((n,a)=>{let o=r>0?n.value/r:0,s=a+1<t.length&&r>0?i[a+1]:+(r>0);return{...n,series:e.encoding.series,share:o,start:i[a]*Yr,end:s*Yr}}),o=ii(n,a,e.measure),s=e.center(r);return{frame:n,total:r,slices:ni(n,a,o,e.measure),labels:o,centerText:s,center:ai(n,s,e.measure)}}function ti(e){let t=e.reduce((e,t)=>e+t,0),n=0;return e.map(e=>{let r=t>0?n/t:0;return n+=e,r})}function ni(e,t,n,r){let i=n.map(e=>e?ui(e,r):[]);return t.map((t,a)=>ri(e,t,n[a],r,i.flatMap((e,t)=>t===a?[]:e)))}function ri(e,t,n,r,i){let a=fe({key:t.key,series:t.series,cx:e.cx,cy:e.cy,inner:e.inner,outer:e.outer,start:t.start,end:t.end,labelBounds:n&&r?ui(n,r):[],...i?{nearbyLabels:i}:{}});return{...t,geometry:a,data:fi(t.datum,t.share,t.series)}}function ii(e,t,n){let r,i,a=t.map((t,a)=>{if(t.end-t.start<Xr-1e-9)return;let o=li(e,t,n),{box:s}=o;if(!(s.x<0||s.y<0||s.x+s.width>e.width||s.y+s.height>e.height)&&!(r&&di(r,s)))return r=s,i??(i=a),o});for(let e=a.length-1;i!==void 0&&e>i;e--){let t=a[e];if(t){if(!di(a[i].box,t.box))break;a[e]=void 0}}return a}function ai(e,t,n){if(t===``)return[];let r=t.split(`
|
|
93
|
+
`),i=2*e.inner*.85,a=n(r[0],`ec-center-value`,26),o=a>i&&a>0?Math.max(14,26*i/a):26,s=r.map((e,t)=>t===0?0:20+(t-1)*16),c=s[s.length-1],l=e.cy+(.72*o-c)/2;return r.map((t,n)=>({x:e.cx,y:l+s[n],anchor:`middle`,text:t,size:n===0?o:Zr}))}function oi({data:e,encoding:t}){let n=new Set;return e.map((e,r)=>{let i=String(t.key(e,r));if(n.has(i))throw Error(`donutChart: two rows have the key "${i}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(i);let a=mi(t.value(e,r),t.series,i);return{key:i,category:String(t.category(e,r)??``),datum:e,index:r,value:a}})}function si(e,t){if(t===void 0||t===`none`)return e;if(t===`value`)return[...e].sort((e,t)=>t.value-e.value);throw TypeError(`donutChart: sort must be "value" or "none", got ${String(t)}.`)}function ci(e,t){let{width:n,measure:r}=e,i=e.height??300,a=n/2,o=i/2,s=r(`100%`,`ec-value`,Qr),c=t.reduce((e,t)=>Math.max(e,r(t.category,`ec-label`,Zr)),s),l=Math.min(a-4-10-c,o-4-10-28),u=Math.max(0,Math.min(a,o)-4),d=Math.max(0,l,u/2);return{width:n,height:i,cx:a,cy:o,inner:d*.6,outer:d}}function li(e,t,n){let r=(t.start+t.end)/2,i=Math.sin(r),a=Math.cos(r),o=e.outer+10,s=e.cx+o*i,c=e.cy-o*a,l=tr(t.share),u=[n(t.category,`ec-label`,Zr),n(l,`ec-value`,Qr)],d=Math.max(...u),f=c-28*(a+1)/2,p=e=>s+i*e/2;return{category:{x:p(u[0]),y:f+10,anchor:`middle`,text:t.category},share:{x:p(u[1]),y:f+10+15,anchor:`middle`,text:l},box:{x:p(d)-d/2,y:f,width:d,height:28}}}function ui(e,t){let n=[];return e.category.text!==``&&n.push(Pt(e.category,t,`ec-label`,Zr)),e.share.text!==``&&n.push(Pt(e.share,t,`ec-value`,Qr)),n}function di(e,t){return e.x<t.x+t.width+2&&t.x<e.x+e.width+2&&e.y<t.y+t.height+2&&t.y<e.y+e.height+2}function fi(e,t,n){let r={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related:e=>e===n?r:void 0};return r}function pi(e){return typeof e==`function`?e:t=>t[e]}function mi(e,t,n){if(e==null)return 0;if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return e;throw RangeError(`donutChart: "${t}" for "${n}" must be a finite number of 0 or more, got ${typeof e==`string`?JSON.stringify(e):String(e)}.`)}let hi=2*Math.PI;function gi(e,n,r){let i=mr(e,`donutChart`);_i(n);let o=n,s=Pn(n.motion,r.motion),c=ct(n.on,r.presets),l=Sn(n.colors),u=r.clock??a,d=i.ownerDocument;bn(d);let f=Y(`svg`,{class:`ec-chart ec-donut-chart`,role:`group`},i),p=Y(`g`,{class:`ec-center`,"aria-hidden":`true`},f),m=Y(`g`,{class:`ec-marks`},f),h=Y(`g`,{class:`ec-overlay`,"aria-hidden":`true`},f),g=Y(`g`,{class:`ec-halos`},h),_=Ln(h),v=Y(`g`,{class:`ec-runs`},h),y=It(f),x=[],w=new Map,T=sr(e=>e.value.animating||e.presence.animating),E=new WeakMap,D=Yn(`donutChart`),O=hr(i),k=!1,A,j,M;try{A=te(o),j=le(o,A),M=yi(o,A)}catch(e){throw f.remove(),e}let N=e=>w.get(e)??T.get(e),P=Kn({overlay:v,measure:y,mark:e=>({set:t=>{N(e)?.handle.set(t),q.restyled(e)},reset:()=>{N(e)?.handle.reset(),q.restyled(e)}}),colors:e=>N(e)?.parts[0]?.colors}),F=Ct({effects:c,motion:s,icons:r.icons,clock:u,surface:P}),I=Nr(f,{motion:s,option:()=>o.tooltip,description:()=>o.markDescription}),ee=Tn(f),L=pr(f),R=o.announce?Ot(f):void 0,z=[],B=[],V=!1,H=C(A.frame,S,{clock:u,motion:s,onChange:()=>V=!0}),U,W,G=br({clock:u,runner:F,leaving:T,draw:_e,land:ye});function te(e,t=c){let n=$r(e);return _r(t,[n.series],`donutChart`),ei({data:e.data,encoding:n,sort:e.sort,width:e.width??O,height:e.height,center:t=>xi(e,n.series,t),measure:y})}function ne(e,t){let n=Y(`g`,{class:`ec-mark`,"data-key":e.key,role:`img`},m),r={clock:u,motion:s,onChange:()=>V=!0},i=Y(`g`,{class:`ec-body`},n),a={key:e.key,row:e,shown:e,group:n,hit:Y(`path`,{class:`ec-hit`},n),body:i,path:Y(`path`,{class:`ec-slice`,"data-series":e.series},i),label:Y(`text`,{class:`ec-label`,"aria-hidden":`true`},n),share:Y(`text`,{class:`ec-value`,"aria-hidden":`true`},n),drawnLabel:void 0,parts:[],handle:zn(()=>a,{halos:()=>g}),value:C(t?0:e.value,b,r),turn:C(1,b,r),offset:0,planned:0,presence:C(+!t,b,r),leave:void 0};return n.insertBefore(a.hit,i),E.set(n,a),a}function re(e,t,n){let r=e.parts[0]?.colors.color;e.shown=t;let{outline:i}=t.geometry,a=t.geometry.length>=.5,o=a?void 0:`hidden`;X(e.path,{d:i.d,visibility:o}),X(e.hit,{d:i.d,visibility:o});let s=pn(l.slot(e.key));At(e.path,hn(s)),e.parts=[{element:e.path,d:i.d,colors:s,visible:a}];let c=e.presence.value,u=c<1?c:void 0;e.drawnLabel=n;for(let[t,r]of[[e.label,n?.category],[e.share,n?.share]])r&&Ft(t,r),X(t,{visibility:r?void 0:`hidden`,opacity:u});e.handle.repaint(),s.color!==r&&P.recolor(e.key),e.key===q.ringKey&&ie(e.key)}function ie(e){let t=e===void 0?void 0:w.get(e);_.draw(t&&{outline:t.shown.geometry.outline,thickness:t.shown.geometry.thickness,transform:t.handle.style.transform})}function ae(e,t,n){let r=Cr(e.shown.geometry,t.geometry)||e.shown.datum!==t.datum;re(e,t,n),r&&F.change(t.geometry,t.data),e.key===q.key&&oe(e)}function oe(e){let{row:t}=e;I.show(e.shown.geometry,t,()=>({title:t.category,lines:[`${vi(t,o)} · ${tr(t.share)}`]}),e.handle.style.transform)}function se(e){for(;p.childElementCount>e.length;)p.lastElementChild.remove();e.forEach((e,t)=>{let n=p.children[t]??Y(`text`,{},p);X(n,{class:t===0?`ec-center-value`:`ec-center-label`}),Ft(n,e),At(n,{"font-size":t===0&&e.size!==26?`${e.size}px`:void 0})})}let ce=()=>ee.categories(A.slices.map(e=>({key:e.key,label:e.category})),l,o.legend);function le(e,t){let{series:n}=$r(e);return dr({option:e.table,caption:e.label,category:typeof e.category==`string`?e.category:void 0,series:[n],label:t=>qn(e.seriesLabels,t),rows:t.slices.map(e=>({key:e.key,category:e.category,datum:e.datum,index:e.index,values:[{series:n,value:e.value}],total:e.value})),format:Xn(e),shares:!0})}function ue(){gr(f,{label:o.label,description:Si(o.description,A.centerText)})}function de(e,n){let r=o.announce;if(!R||!r)return;let i=$r(o).series,a=$r(e).series,s=o.sort??`none`,c=e=>e.row.category,l=n.changed.map(({record:e})=>e),u=Et({...o.label===e.label?{}:{label:o.label},...i===a?{}:{series:[qn(o.seriesLabels,i)]},...s===(e.sort??`none`)?{}:{sort:s},changed:l.map(c),added:n.entering.map(c),removed:n.exiting.map(c),count:x.length});if(typeof r!=`function`){R.say(u);return}let d=e=>e.key;try{let e=r({text:u,changed:l.map(d),added:n.entering.map(d),removed:n.exiting.map(d)});e!=null&&R.say(String(e))}catch(e){t(e)}}let fe=e=>w.get(e.key)===e||T.get(e.key)===e,pe=e=>Math.max(0,e.value.value);function me(e,t,n=pe){let r=new Map,i=0;for(let a of e)r.set(a,t>0?i/t:0),i+=n(a);return r}function he(){z=z.filter(fe),B=B.filter(fe);let e=z.reduce((e,t)=>e+pe(t),0),t=me(z,e),n=me(B,e),r=new Map;for(let i of z){let a=t.get(i),o=i.turn.value,s=n.get(i),c=a;if(s!==void 0&&o<1){let e=s+i.offset-a;c=a+(1-o)*(e-Math.round(e-i.planned))}r.set(i,{start:c,span:e>0?pe(i)/e:0})}return r}function ge(e){let t=[...he()].map(([e,{start:t,span:n}])=>{let{row:r}=e;return{record:e,state:{key:r.key,datum:r.datum,index:r.index,category:r.category,series:r.series,value:pe(e),share:n,start:t*hi,end:(t+n)*hi}}}),n=ii(e,t.map(({state:e})=>e),y),r=ni(e,t.map(({state:e})=>e),n,y);return t.map(({record:e},t)=>({record:e,slice:r[t],label:n[t]}))}function _e(){if(!V)return;V=!1;let e=H.value;X(f,jt(e));let t=ge(e);for(let{record:e,slice:n,label:r}of t)ae(e,n,r);let n=t.reduce((e,{slice:t})=>e+t.value,0);se(ai(e,U===void 0?A.centerText:ve(er(n,U)),y))}function ve(e){return W?.total!==e&&(W={total:e,text:xi(o,$r(o).series,e)}),W.text}function ye(){z=z.filter(fe),B=z;for(let e of z)e.turn.set(1),e.offset=0,e.planned=0;U=void 0,W=void 0,X(f,jt(A.frame)),A.slices.forEach((e,t)=>ae(w.get(e.key),e,A.labels[t])),se(A.center),V=!1}function be(e){let t=new Set(e.slices.map(e=>e.key)),n={entering:[],exiting:[],changed:[]};for(let e of x)t.has(e.key)||(w.delete(e.key),T.start(e),n.exiting.push(e));let r=x;return x=e.slices.map(e=>{let t=w.get(e.key);return t?(t.row.value!==e.value||t.row.series!==e.series)&&n.changed.push({record:t,from:t.shown.geometry}):(t=T.recall(e.key)??ne(e,!0),w.set(e.key,t),n.entering.push(t)),t.row=e,t.path.setAttribute(`data-series`,e.series),xe(t),t}),lr(m,r.map(e=>e.group),x.map(e=>e.group),q.active),n}function xe(e){e.group.setAttribute(`aria-label`,M.get(e.key)),I.describe(e.group,e.row)}function Se(e,t){V=!0;let n=he(),r=new Set(x.filter(e=>e.presence.value===0)),i=x.filter(e=>!r.has(e)),a=[...T.values()],o=B.length>0&&B.every(e=>e.turn.value===0),c=z;if(z=Ci(c,x),!o){B=c;let e=me(c,c.reduce((e,t)=>e+pe(t),0));for(let t of c)t.offset=n.get(t).start-e.get(t)}B=B.filter(e=>!r.has(e));let l=e=>w.get(e.key)===e?e.row.value:0,u=z.reduce((e,t)=>e+l(t),0),d=me(z,u,l),f=me(B,u,l),p=!1;for(let e of B){let t=f.get(e)+e.offset-d.get(e);e.planned=t-Math.round(t),Math.abs(e.planned)>1e-9&&(p=!0)}let m=i.some(e=>Q(e.value,e.row.value,$)||Q(e.presence,1,$))||a.some(e=>Q(e.value,0,$)||Q(e.presence,0,$)),h=p||r.size>0||Q(H,e.frame,Sr),g,_,v;if(!t&&s.staged){let e=m?500:0;g={duration:500},_={duration:500,delay:e},v={duration:250,delay:e+250}}else t||(g=_=v={duration:(m&&h?2:1)*500});let y=[],b=(e,t,n,r)=>{Q(e,t,n)&&(r?y.push(e.to(t,r)):e.set(t))};b(H,e.frame,Sr,_);for(let e of i)b(e.value,e.row.value,$,g),b(e.presence,1,$,g);for(let e of r)b(e.value,e.row.value,$,v),b(e.presence,1,$,v);for(let e of a)b(e.value,0,$,g),b(e.presence,0,$,g);if(t){B=z;for(let e of z)e.turn.set(1),e.offset=0,e.planned=0;return y}let S=new Set(B);for(let e of z)e.turn.set(+!S.has(e));if(p)for(let e of B)b(e.turn,1,$,_);return y}function K(e,t){return A=e,G.run(Se(e,t))}let Ce=e=>({mark:e.row.geometry,data:e.row.data}),we=e=>({mark:e.shown.geometry,data:e.shown.data});function Te(e){let t=e,n=typeof t?.closest==`function`?t.closest(`.ec-mark`):null,r=n?E.get(n):void 0;return r&&w.get(r.key)===r?r:void 0}let q=ar({svg:f,runner:F,events:D,dim:()=>o.dim!==!1,find(e){let t=Te(e);return t&&{key:t.key}},live:e=>w.has(e),order:()=>x.map(e=>e.key),element:e=>N(e)?.group,hot:P.hot,onScreen(e){let t=N(e);return t&&we(t)},ring:ie,tooltip:{show(e){let t=w.get(e);t&&oe(t)},hide:()=>I.hide(),element:()=>I.element()}}),Ee=kr(f,s);function De(){if(k)return;let e=te(o),t=new Map(e.slices.map(e=>[e.key,e]));for(let e of x)e.row=t.get(e.key)??e.row;K(e,!0)}let Oe=()=>{y.clear(),De()},ke=Or(f,u,Oe),Ae=Er(i,u,O,e=>{O=e,o.width===void 0&&De()}),je=Dr(d,Oe);return ue(),ce(),L.render(j),X(f,jt(A.frame)),x=A.slices.map(e=>{let t=ne(e,!1);return w.set(e.key,t),xe(t),t}),z=B=x,A.slices.forEach((e,t)=>re(x[t],e,A.labels[t])),se(A.center),q.sync(),F.enter(x.map(Ce)),An(q.link,{element:f,async update(e){if(k)return;if(e.motion!==void 0&&e.motion!==o.motion)throw TypeError("donutChart: `motion` can't be changed by update() yet.");let t={...o,...e};_i(t);let n=`on`in e?vr(c,o.on,t.on,r.presets):c,i=te(t,n),a=le(t,i),u=yi(t,i);`colors`in e&&(l=Sn(t.colors));let d=o,p=A.total;o=t,A=i,M=u,ue(),ce(),L.render(a);let m=R!==void 0;o.announce&&!R?R=Ot(f):!o.announce&&R&&(R.destroy(),R=void 0),q.syncDim(),G.supersede();let h=n!==c;c=n;let g=xr({runner:F,events:D,hover:q,leaving:T,input:Ce,onScreen:we,data:`data`in e,...h?{swap:e=>{let t=new Set(e.entering);F.swap(n,x.filter(e=>!t.has(e)).map(Ce))}}:{}},()=>be(i),e=>{m&&de(d,e)});U=i.total===p?void 0:Math.max($n(p),$n(i.total));let _=K(i,s.mode===`off`);await G.wait(_,g)},on:D.on,marks:()=>x.map(e=>e.shown.geometry),focus(e){k||q.focus(e)},leave(){k||q.leave()},labels:()=>x.flatMap(e=>[...or(e.key,`category`,e.drawnLabel?.category,e.label),...or(e.key,`value`,e.drawnLabel?.share,e.share)]),paintOf:e=>w.has(e)?{color:e,drawn:!0}:void 0,moveTabStop:e=>!k&&q.moveTabStop(e),destroy(){if(!k){k=!0,G.destroy(),q.destroy(),F.destroy(),I.destroy(),ee.destroy(),L.destroy(),R?.destroy(),Ee(),ke(),Ae(),je();for(let e of[...x,...T.values()]){for(let t of[e.value,e.turn,e.presence])t.stop();e.leave?.resolve()}H.stop(),D.clear(),w.clear(),T.clear(),x=z=B=[],f.remove()}}})}function _i(e){yr(e,`donutChart`);let{center:t,sort:n}=e;if(t!==void 0&&t!==!1&&typeof t!=`function`)throw TypeError(`donutChart: center must be false or a function that returns the text for the total.`);if(n!==void 0&&n!==`none`&&n!==`value`)throw TypeError(`donutChart: sort must be "value" or "none", got ${String(n)}.`)}function vi(e,t){let n=Xn(t)(e.value),r=qn(t.seriesLabels,e.series);return e.series===`value`&&r===`value`?n:`${n} ${r}`}function yi(e,t){return new Map(t.slices.map(t=>[t.key,bi(t,e)]))}function bi(e,n){let r=`${e.category}: ${vi(e,n)}, ${tr(e.share)}`;if(!n.markLabel)return r;try{let t={series:e.series,label:qn(n.seriesLabels,e.series),value:e.value},i=n.markLabel(e.datum,{key:e.key,category:e.category,values:[t],total:e.value,share:e.share,format:Xn(n),text:r});if(i!=null&&String(i).trim()!==``)return String(i)}catch(e){t(e)}return r}function xi(e,n,r){let{center:i}=e,a=Xn(e);if(i===!1)return``;if(i===void 0){let t=qn(e.seriesLabels,n);return n===`value`&&t===`value`?a(r):`${a(r)}\n${t}`}try{let e=i(r,a);return e==null?``:String(e)}catch(e){return t(e),``}}function Si(e,t){let n=t.split(`
|
|
94
|
+
`).join(` `).trim(),r=e?.trim();return n===``?e:r?/[.!?:;]$/.test(r)?`${r} ${n}`:`${r}. ${n}`:n}function Ci(e,t){let n=[...t];return e.forEach((t,r)=>{if(n.includes(t))return;let i=0;for(let t=r-1;t>=0;t--){let r=n.indexOf(e[t]);if(r>=0){i=r+1;break}}n.splice(i,0,t)}),n}let wi=[`linear`,`monotone`];function Ti(e){return+(e===`monotone`)}function Ei(e,t,n,r,i){let a=new Int32Array(e.length).fill(-1),o=[],s=[],c=[],l=[],u=0,d=!1;for(let n=0;n<e.length;n++){let r=t[n];if(r===void 0){d=!1;continue}let f=o.length-1;d&&e[n]===o[f]&&r===s[f]?(a[n]=f,l[f]=Math.max(l[f],i?.[n]??1)):(d&&e[n]!==o[f]||u++,o.push(e[n]),s.push(r),c.push(u),l.push(i?.[n]??1),a[n]=f+1,d=!0)}let f=n>0?new Float64Array(o.length):void 0;if(f)for(let e=0;e<o.length;){let t=e+1;for(;t<o.length&&c[t]===c[e];)t++;Di(o,s,e,t,f),i&&Oi(o,s,l,e,t,f),e=t}let p=(e,t)=>{let r=a[e];if(r<0||a[t]!==r+1||c[r+1]!==c[r])return;let i=o[r+1]-o[r],l=s[r],u=s[r+1],d=(u-l)/i,[p,m]=d<0?[3*d,0]:[0,3*d],h=e=>Math.min(m,Math.max(p,n===1?e:d+n*(e-d))),g=f?h(f[r]):d,_=f?h(f[r+1]):d;return[l,l+i*g/3,u-i*_/3,u,r]};return{between(e,t,n=1/0){let i=p(e,t);if(!i||!f)return[];let[a,s,c,l,u]=i,d=o[u],m=o[u+1]-d,h=r.x(d),g=r.x(o[u+1]),_=Math.min(we({x:h,y:r.y(a)},{x:h+(g-h)/3,y:r.y(s)},{x:g-(g-h)/3,y:r.y(c)},{x:g,y:r.y(l)}),Math.max(1,Math.ceil(Math.abs(g-h)/xe))),v=[];for(let e=1;e<_;e++){let t=d+e/_*m;if(!(t<n))break;v.push({x:t,value:Ai(a,s,c,l,e/_)})}return v},valueAt(e,n,r){let i=p(e,n);if(!i)return t[e]??0;let[a,s,c,l,u]=i;return Ai(a,s,c,l,(r-o[u])/(o[u+1]-o[u]))}}}function Di(e,t,n,r,i){let a=r-n;if(a<2){a===1&&(i[n]=0);return}let o=n=>(t[n+1]-t[n])/(e[n+1]-e[n]);if(a===2)i[n]=i[n+1]=o(n);else{for(let t=n+1;t<r-1;t++){let n=e[t]-e[t-1],r=e[t+1]-e[t],a=o(t-1),s=o(t),c=(a*r+s*n)/(n+r);i[t]=(ki(a)+ki(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(c))||0}i[n]=(3*o(n)-i[n+1])/2,i[r-1]=(3*o(r-2)-i[r-2])/2}}function Oi(e,t,n,r,i,a){let o=[];for(let e=r;e<i;e++)n[e]>=1&&o.push(e);if(o.length===i-r||o.length<2)return;let s=o.map(t=>e[t]),c=o.map(e=>t[e]),l=new Float64Array(o.length);Di(s,c,0,o.length,l);let u=new Float64Array(i-r),d=0,f=0;for(let t=r;t<i;t++){for(;d<s.length-2&&s[d+1]<=e[t];)d++;let p=o[f]===t?f++:-1,m=1;for(let e=Math.max(r,t-2);e<Math.min(i,t+3);e++)m=Math.min(m,n[e]);if(m>=1){u[t-r]=a[t];continue}let h;if(p>=0)h=l[p];else{let n=s[d+1]-s[d],r=Math.min(1,Math.max(0,(e[t]-s[d])/n));h=(6*r*r-6*r)*(c[d]-c[d+1])/n+(3*r*r-4*r+1)*l[d]+(3*r*r-2*r)*l[d+1]}u[t-r]=m*a[t]+(1-m)*h}a.set(u,r)}let ki=e=>e<0?-1:1;function Ai(e,t,n,r,i){let a=1-i;return a*a*a*e+3*a*a*i*t+3*a*i*i*n+i*i*i*r}let ji=1e3,Mi=60*ji,Ni=60*Mi,Pi=24*Ni,Fi={second:ji,minute:Mi,hour:Ni,day:9e7,week:6084e5,month:31*Pi,year:366*Pi},Ii=[...[1,5,15,30].map(e=>({unit:`second`,count:e})),...[1,5,15,30].map(e=>({unit:`minute`,count:e})),...[1,3,6,12].map(e=>({unit:`hour`,count:e})),{unit:`day`,count:1},{unit:`day`,count:2},{unit:`week`,count:1},{unit:`month`,count:1},{unit:`month`,count:3}],Li=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],Ri={second:`second`,minute:`minute`,hour:`hour`,day:`day`,week:`day`,month:`month`,year:`year`},zi={year:{year:`numeric`},month:{month:`short`},day:{month:`short`,day:`numeric`},hour:{hour:`numeric`,minute:`2-digit`},minute:{hour:`numeric`,minute:`2-digit`},second:{hour:`numeric`,minute:`2-digit`,second:`2-digit`},millisecond:{hour:`numeric`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3}};function Bi(e){if(e===`UTC`||e===`local`)return!0;if(typeof e!=`string`)return!1;try{return ia(e),!0}catch{return!1}}function Vi(e){for(let t of Ii)if(Fi[t.unit]*t.count>=e)return t;return{unit:`year`,count:Math.max(1,en(e/Fi.year))}}function Hi(e,t,n){let r=Ji(n);if(!(t>e))return[{value:e,text:r(e,`year`)}];let i=Vi((t-e)/4),a=Li[Math.min(Li.indexOf(Ri[i.unit]),Li.indexOf(Ui(e,t,n)))],o=Wi(e,t,i,n).map(e=>({value:e,text:r(e,`millisecond`)}));return[{value:e,text:r(e,a)},...o,{value:t,text:r(t,a)}]}function Ui(e,t,n){let[r,i]=[Xi(e,n),Xi(t,n)];return r.year===i.year?r.month===i.month?r.date===i.date?r.hours===i.hours?r.minutes===i.minutes?`second`:`minute`:`hour`:`day`:`month`:`year`}function Wi(e,t,n,r){let{unit:i,count:a}=n,o=[],s=Xi(e,r);if(i===`second`||i===`minute`||i===`hour`){let n=i===`hour`?15*Mi:Fi[i],c=e-s.ms-(i===`second`?0:s.seconds*ji)-(i===`hour`?s.minutes%15*Mi:0);for(;c<t;c+=n){let t=Xi(c,r),n=i!==`hour`||t.minutes===0,s=i===`second`?t.seconds:i===`minute`?t.minutes:t.hours;c>e&&n&&s%a===0&&o.push(c)}return o}let c=i===`day`?e=>Zi(r,s.year,s.month,s.date+e):i===`week`?e=>Zi(r,s.year,s.month,s.date-(s.weekday+6)%7+7*e):i===`month`?e=>Zi(r,s.year,Math.floor(s.month/a)*a+a*e,1):e=>Zi(r,Math.floor(s.year/a)*a+a*e,0,1),l=-1/0;for(let n=0;;n++){let s=c(n);if(s>=t||s<=l)break;l=s,s>e&&(i!==`day`||(Xi(s,r).date-1)%a==0)&&o.push(s)}return o}function Gi(e,t,n){let{year:r,month:i,date:a,hours:o,minutes:s,seconds:c,ms:l}=Xi(e,n),u=new Date(0);u.setUTCFullYear(r,i+t+1,0);let d=Math.min(a,u.getUTCDate());return Qi(n,r,i+t,d,o,s,c,l)}function Ki(e,t){let{ms:n,seconds:r,minutes:i,hours:a,date:o,month:s}=Xi(e,t);return n===0?r===0?i===0?a===0?o===1?s===0?`year`:`month`:`day`:`hour`:`minute`:`second`:`millisecond`}function qi(e,t){let n=ta(t),r=e.reduce((e,t)=>Math.max(e,Li.indexOf(Ki(n(t),`UTC`))),0),i=Yi(t),a=r>=Li.indexOf(`second`)?`medium`:r>=Li.indexOf(`hour`)?`short`:void 0,o=r===Li.indexOf(`millisecond`)?{year:`numeric`,...zi.day,...zi.millisecond,timeZone:i}:{dateStyle:`medium`,...a?{timeStyle:a}:{},timeZone:i},s=new Intl.DateTimeFormat(void 0,o);if(t===`UTC`||!a)return e=>s.format(e);let c=new Intl.DateTimeFormat(void 0,{timeZone:i,timeZoneName:`short`});return e=>{let t=s.format(e);if(na(e,n)===void 0)return t;let r=c.formatToParts(e).find(e=>e.type===`timeZoneName`)?.value;return r?`${t} ${r}`:t}}function Ji(e){let t=new Map;return(n,r)=>{let i=Li.indexOf(Ki(n,e)),a={};for(let e=Math.min(i,Li.indexOf(r));e<=i;e++)Object.assign(a,zi[Li[e]]);let o=JSON.stringify(a),s=t.get(o);return s||t.set(o,s=new Intl.DateTimeFormat(void 0,{...a,timeZone:Yi(e)})),s.format(n)}}let Yi=e=>e===`local`?void 0:e;function Xi(e,t){let n=new Date(t===`UTC`||t===`local`?e:ea(e,t));return t===`local`?{year:n.getFullYear(),month:n.getMonth(),date:n.getDate(),weekday:n.getDay(),hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds(),ms:n.getMilliseconds()}:{year:n.getUTCFullYear(),month:n.getUTCMonth(),date:n.getUTCDate(),weekday:n.getUTCDay(),hours:n.getUTCHours(),minutes:n.getUTCMinutes(),seconds:n.getUTCSeconds(),ms:n.getUTCMilliseconds()}}function Zi(e,t,n,r){return Qi(e,t,n,r)}function Qi(e,t,n,r,i=0,a=0,o=0,s=0){if(e===`local`){let e=new Date(0);return e.setFullYear(t,n,r),e.setHours(i,a,o,s),e.getTime()}let c=$i(t,n,r,i,a,o,s);if(e===`UTC`)return c;let l=c-(ea(c-Pi,e)-(c-Pi)),u=c-(ea(c+Pi,e)-(c+Pi));if(l===u)return l;let d=[l,u].filter(t=>ea(t,e)===c);return d.length>0?Math.min(...d):l}function $i(e,t,n,r=0,i=0,a=0,o=0){let s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(r,i,a,o),s.getTime()}function ea(e,t){if(t===`UTC`)return e;if(t===`local`){let t=new Date(e);return $i(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}let n=(e%ji+ji)%ji,r={};for(let i of ia(t).formatToParts(e-n))r[i.type]=i.value;let i=Number(r.year);return $i(r.era===`BC`?1-i:i,Number(r.month)-1,Number(r.day),Number(r.hour)%24,Number(r.minute),Number(r.second),n)}function ta(e){if(e===`UTC`||e===`local`)return t=>ea(t,e);let t=new Map;return n=>{let r=t.get(n);return r===void 0&&t.set(n,r=ea(n,e)),r}}function na(e,t){let n=t(e);for(let r of[e-Pi,e+Pi]){let i=n-(t(r)-r);if(i!==e&&t(i)===n)return i}}let ra=new Map;function ia(e){let t=ra.get(e);return t||(t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hourCycle:`h23`,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}),ra.set(e,t)),t}let aa=2.25,oa=4.5,sa=12.5,ca=.36;function la(e){let{x:t,series:n,key:r}=e;if(typeof t!=`string`&&typeof t!=`function`)throw TypeError(`lineChart needs x: a field of numbers or Dates, or a function that returns each row's x.`);if(!Array.isArray(n)||n.length===0)throw TypeError(`lineChart needs series: the numeric fields to draw as lines.`);let i=new Set;for(let e of n){if(typeof e!=`string`||e===``)throw TypeError(`lineChart: each series must be a field name, got ${Fa(e)}.`);if(i.has(e))throw TypeError(`lineChart: "${e}" appears twice in series.`);i.add(e)}if(r!==void 0&&typeof r!=`string`&&typeof r!=`function`)throw TypeError(`lineChart: key must be a field name or a function.`);let a=e.labels;if(a!==void 0&&a!==!1&&typeof a!=`function`)throw TypeError(`lineChart: labels must be false or a function that returns a line's end label.`);let o=e.timeZone??`UTC`;if(!Bi(o))throw TypeError(`lineChart: timeZone must be "UTC", "local" or the name of a zone Intl knows, such as "Europe/London", got ${Fa(o)}.`);let s=e.xFormat;if(s!==void 0&&typeof s!=`function`)throw TypeError(`lineChart: xFormat must be a function that turns an x into text.`);let c=e.curve??`linear`;if(!wi.includes(c))throw TypeError(`lineChart: curve must be "linear" or "monotone", got ${Fa(c)}.`);return{x:Pa(t),key:r===void 0?void 0:Pa(r),series:n.map(e=>({series:e,value:Pa(e)})),timeZone:o,xFormat:e.xFormat,curve:c}}function ua(e){let t=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0;if(typeof e!=`object`||!e||Array.isArray(e)){if(e!==void 0&&!t(e))throw RangeError(`lineChart: room must be a number of px, 0 or more, got ${typeof e==`object`?JSON.stringify(e):String(e)}.`)}else for(let n of[`right`,`top`]){let r=e[n];if(r!==void 0&&!t(r))throw RangeError(`lineChart: room.${n} must be a number of px, 0 or more, got ${String(r)}.`)}}function da(e){let{width:t,measure:n}=e,r=e.height??300,{rows:i,time:a}=Ea(e),o=e.encoding.series.map(e=>e.series),s=$t(i.flatMap(e=>e.values.flatMap(e=>e.value===void 0?[]:[e.value]))),c=s.ticks.map(e.format),l=i[0]?.x??0,u=i[i.length-1]?.x??0,d=i.length===0?[]:a?Hi(l,u,e.encoding.timeZone):Ca(l,u).map(e=>({value:e,text:wa(e)})),f=d.map(e=>e.value),p=d.map(e=>e.text),m=p.map(e=>n(e,`ec-tick`,11)),h=typeof e.room==`number`?{right:e.room}:e.room,g=e.label?Na(Ma(i,e.label),`ec-value`,sa,n):0,_=Math.max(Na(c,`ec-tick`,11,n)+10,(m[0]??0)/2+2),v=Math.max(10,(m[m.length-1]??0)/2+2,(g>0?10+g+4:0)+(h?.right??0)),y=12+(h?.top??0),b={scale:{lo:s.lo,hi:s.hi},box:{xLo:l,xHi:u,left:_,right:Math.max(_,t-v),top:y,bottom:Math.max(y,r-32),width:t,height:r}},x={};for(let e of o)x[e]=0;for(let e of i)for(let t of e.values)t.value!==void 0&&(x[t.series]=Math.max(x[t.series],$n(t.value)));let S=f.map((e,t)=>Sa(b,e,p[t]));return{width:t,height:r,frame:b,rows:i,time:a,series:o,yTicks:s.ticks.map((e,t)=>xa(b,e,c[t])),xTicks:Ta(S,m),decimals:x,curve:e.encoding.curve}}function fa(e){let{scale:t,box:n}=e,r=n.xHi-n.xLo,i=t.hi-t.lo;return{x:e=>r>0?n.left+(e-n.xLo)/r*(n.right-n.left):(n.left+n.right)/2,y:e=>i>0?n.bottom-(e-t.lo)/i*(n.bottom-n.top):n.bottom}}function pa(e,t,n,r,i=!1,a,o=0){let s=t[0];if(!s)return[];let c=fa(e),l=0;for(;l+1<t.length&&t[l+1].x<=r;)l++;let u=t[l],d=t[l+1],f=d&&d.x>u.x&&r>u.x?(r-u.x)/(d.x-u.x):void 0,p=t.slice(0,l+1),m=o>0?t.map(e=>e.x):[],h=o>0&&t.some(e=>e.presence!==void 0&&e.presence<1)?t.map(e=>e.presence??1):void 0,g=new Map,_=e=>t=>t===e?void 0:g.get(t),v=n.map(e=>{let n=t=>!t.missing?.has(e),i=o>0?Ei(m,t.map(t=>n(t)?t.values[e]??0:void 0),o,c,h):void 0,a=[],g=!1,_=-1;if(p.forEach((r,o)=>{if(!n(r))g=a.length>0;else{if(i&&_>=0)for(let e of i.between(_,o))a.push({at:e.x,value:e.value,datum:t[_].datum,gapBefore:!1});a.push({at:r.x,value:r.values[e]??0,datum:r.datum,gapBefore:g}),g=!1,_=o}}),f!==void 0&&n(u)&&n(d)){if(i)for(let e of i.between(l,l+1,r))a.push({at:e.x,value:e.value,datum:u.datum,gapBefore:!1});let t=u.values[e]??0,n=i?i.valueAt(l,l+1,r):t+f*((d.values[e]??0)-t);a.push({at:r,value:n,datum:u.datum,gapBefore:!1})}return{name:e,vertices:a,points:a.length>0?a.map(e=>({x:c.x(e.at),y:c.y(e.value)})):[{x:c.x(s.x),y:c.y(s.values[e]??0)}]}}),y=v.filter(({vertices:e})=>e.length>0),b=a?ya(e,y.map(({name:e,vertices:t,points:n})=>({...n[n.length-1],text:a.text(e,t[t.length-1].value)}))):[],x=a?b.map(e=>e.text===``?void 0:Pt(e,a.measure,`ec-value`,sa)):[];return v.map(({name:e,vertices:t,points:n})=>{let r=n[n.length-1],o=y.findIndex(t=>t.name===e),c=a?b[o]??{x:r.x+10,y:r.y+sa*ca,anchor:`start`,text:``}:void 0,l=x[o],d=a?l?[l]:[]:void 0,f=a?x.filter((e,t)=>e!==void 0&&t!==o):void 0,p=t.flatMap((e,t)=>e.gapBefore?[t]:[]),m=ge({key:e,series:e,points:n,width:aa,...p.length>0?{breaks:p}:{},...d?{labelBounds:d}:{},...f?{nearbyLabels:f}:{}}),h=0,v=t.map((e,r)=>(r>0&&(h+=Math.hypot(n[r].x-n[r-1].x,n[r].y-n[r-1].y)),{t:m.length>0?r===t.length-1?1:Math.min(1,h/m.length):0,value:e.value,at:Aa(e.at,i),...e.gapBefore?{gapBefore:!0}:{}})),S=t[t.length-1],C={datum:S?S.datum:u.datum,samples:v,related:_(e)};return g.set(e,C),{series:e,geometry:m,data:C,end:{...r,value:S?S.value:s.values[e]??0},label:c}})}function ma(e,t){let n=new Set;if(!e.some(e=>e.missing!==void 0&&e.missing.size>0))return n;let r=(e,t)=>e!==void 0&&!e.missing?.has(t);return e.forEach((i,a)=>{for(let o of t){let t=e[a-1],s=e[a+1];!r(i,o)||r(t,o)||r(s,o)||t===void 0&&s===void 0||n.add(ha(o,i.key))}}),n}function ha(e,t){return`${e}@${t}`}function ga(e,t,n,r=!1){let i=fa(e),a=i.x(t.x),o=new Map;return n.filter(e=>!t.missing?.has(e)).map(e=>{let n=t.values[e]??0,s=ha(e,t.key),c={datum:t.datum,samples:[{t:0,value:n,at:Aa(t.x,r)}],related:t=>t===e?void 0:o.get(t)};return o.set(e,c),{key:s,series:e,geometry:be({key:s,series:e,x:a,y:i.y(n),r:oa}),data:c}})}function _a(e,t){let{width:n,height:r}=e.box;return t.map((e,i)=>{let a=i===0?0:(t[i-1]+e)/2,o=i===t.length-1?n:(e+t[i+1])/2;return{x:a,y:0,width:Math.max(0,o-a),height:r}})}function va(e,t){return{x1:t,y1:e.box.top,x2:t,y2:e.box.bottom}}function ya(e,t){let n=sa/2,r=ba(t.map(e=>e.y),16,n,e.box.height-n);return t.map((e,t)=>({x:e.x+10,y:r[t]+sa*ca,anchor:`start`,text:e.text}))}function ba(e,t,n,r){let i=e.map((e,t)=>({value:e,index:t})).sort((e,t)=>e.value-t.value||e.index-t.index),a=[],o=e=>{let i=e.reduce((e,t)=>e+t.value,0)/e.length,a=(e.length-1)*t;return Math.max(n,Math.min(r-a,i-a/2))};for(let e of i)for(a.push({members:[e],start:o([e])});a.length>1;){let e=a[a.length-1],n=a[a.length-2];if(e.start-(n.start+(n.members.length-1)*t)>=t)break;a.pop(),n.members.push(...e.members),n.start=o(n.members)}let s=Array(e.length);for(let e of a)e.members.forEach((n,r)=>s[n.index]=e.start+r*t);return s}function xa(e,t,n){let{box:r}=e,i=fa(e).y(t);return{value:t,line:{x1:r.left,y1:i,x2:r.right+8,y2:i},label:{x:r.left-8,y:i+11*ca,anchor:`end`,text:n}}}function Sa(e,t,n){return{value:t,label:{x:fa(e).x(t),y:e.box.bottom+18,anchor:`middle`,text:n}}}function Ca(e,t){if(!(t>e))return[e];let n=en((t-e)/4),r=[e];for(let i=Math.floor(e/n)+1;un(i*n)<t;i++){let t=un(i*n);t>e&&r.push(t)}return r.push(t),r}function wa(e){return String(e)}function Ta(e,t){if(e.length<=1)return[...e];let n=e.map((e,n)=>({tick:e,from:e.label.x-t[n]/2,to:e.label.x+t[n]/2})),r=n[n.length-1],i=[n[0]];for(let e of n.slice(1,-1))e.from-i[i.length-1].to>=8&&r.from-e.to>=8&&i.push(e);return r.from-i[i.length-1].to>=8&&i.push(r),i.map(e=>e.tick)}function Ea({data:e,encoding:t}){let n=new Set,r=!1,i=e.map((e,i)=>{let a=t.x(e,i);i===0&&(r=a instanceof Date);let o=Oa(a,i,r),s=String(t.key?t.key(e,i):r?new Date(o).toISOString():o);if(n.has(s))throw Error(`lineChart: two rows have the key "${s}". Keys must be unique.`);return n.add(s),{key:s,datum:e,index:i,x:o,values:t.series.map(({series:t,value:n})=>({series:t,value:ja(n(e,i),t,s)}))}});i.sort((e,t)=>e.x-t.x);for(let e=1;e<i.length;e++){let[t,n]=[i[e-1],i[e]];if(t.x===n.x){let e=r?new Date(t.x).toISOString():wa(t.x);throw Error(`lineChart: the rows "${t.key}" and "${n.key}" have the same x, ${e}. Each x is one point on every line, so x values must be unique.`)}}let a=ka(t,r,i.map(e=>e.x)),o=Da(i,t.series.length);return{rows:i.map((e,t)=>({...e,label:a(e.x),missing:new Set(e.values.flatMap(e=>e.value===void 0?[e.series]:[])),levels:o[t]})),time:r}}function Da(e,t){let n=e.map(()=>({}));for(let r=0;r<t;r++){let t=-1,i=-1;e.forEach((a,o)=>{let{series:s,value:c}=a.values[r];if(c!==void 0){n[o][s]=c,t=o;return}if(i<=o)for(i=o+1;i<e.length&&e[i].values[r].value===void 0;)i++;let l=e[t]?.values[r].value,u=e[i]?.values[r].value;n[o][s]=l!==void 0&&u!==void 0?l+(a.x-e[t].x)/(e[i].x-e[t].x)*(u-l):l??u??0})}return n}function Oa(e,t,n){if(e instanceof Date){if(!n)throw TypeError(`lineChart: x must be all numbers or all Dates, but row 0's is a number and row ${t}'s a Date.`);let r=e.getTime();if(Number.isNaN(r))throw TypeError(`lineChart: x must be a valid Date, got an invalid Date in row ${t}.`);return r}if(n)throw TypeError(typeof e==`number`?`lineChart: x must be all numbers or all Dates, but row 0's is a Date and row ${t}'s a number.`:`lineChart: x must be a valid Date, got ${Fa(e)} in row ${t}.`);if(typeof e!=`number`||!Number.isFinite(e))throw RangeError(`lineChart: x must be a finite number, got ${Fa(e)} in row ${t}.`);return e}function ka(e,t,n){let{xFormat:r}=e;return r?e=>r(t?new Date(e):e):t?qi(n,e.timeZone):wa}function Aa(e,t){return t?new Date(e):e}function ja(e,t,n){if(typeof e==`number`&&Number.isFinite(e))return e;if(e!=null)throw RangeError(`lineChart: "${t}" for "${n}" must be a finite number, or null or undefined where it has no value, got ${Fa(e)}.`)}function Ma(e,t){let n=new Map;for(let r of e)for(let{series:e,value:i}of r.values){if(i===void 0)continue;let r=t(e,i),a=r.replace(/\d/g,`0`);n.has(a)||n.set(a,r)}return[...n.values()]}function Na(e,t,n,r){return e.reduce((e,i)=>Math.max(e,r(i,t,n)),0)}function Pa(e){return typeof e==`function`?e:t=>t[e]}let Fa=e=>typeof e==`string`?JSON.stringify(e):String(e);function Ia(e,n,r){let i=mr(e,`lineChart`);yr(n,`lineChart`);let o=to(n);no(n);let s=n,c=Pn(n.motion,r.motion),l=ct(n.on,r.presets),u=Sn(n.colors),d=r.clock??a,f=i.ownerDocument;bn(f);let p=Y(`svg`,{class:`ec-chart ec-line-chart`,role:`group`},i),m=Y(`g`,{class:`ec-grid`,"aria-hidden":`true`},p),h=Y(`g`,{class:`ec-axis`,"aria-hidden":`true`},p),g=Y(`line`,{class:`ec-crosshair`,"aria-hidden":`true`,visibility:`hidden`},p),_=Y(`g`,{class:`ec-focus`,"aria-hidden":`true`,visibility:`hidden`},p),v=Y(`g`,{class:`ec-lines`},Y(`g`,{class:`ec-marks`,"aria-hidden":`true`},p)),y=Y(`g`,{class:`ec-overlay`,"aria-hidden":`true`},p),x=Y(`g`,{class:`ec-points`},Y(`g`,{class:`ec-marks`,"aria-hidden":`true`},p)),w=Y(`g`,{class:`ec-columns`},p),T=It(p),E=[],D=new Map,O=new Map,k=new WeakMap,A=[],j=new Map,M=new Map,N=sr(e=>e.kind===`line`?e.presence.animating:e.row.presence.animating||e.row.values.animating||e.row.x.animating),P=Yn(`lineChart`),F=hr(i),I=!1,ee=1/0,L=new WeakSet,R,z,B,V;try{R=he(s),z=wt(s,R),B=o===`x`?$a(s,R):void 0,V=o===`point`?eo(s,R):void 0}catch(e){throw p.remove(),e}let H=e=>M.get(e)??j.get(e)??N.get(e),U=Kn({overlay:y,measure:T,mark:e=>({set:t=>{H(e)?.handle.set(t),xt.restyled(e)},reset:()=>{H(e)?.handle.reset(),xt.restyled(e)}}),colors:e=>H(e)?.parts[0]?.colors}),W=Ct({effects:l,motion:c,icons:r.icons,clock:d,surface:U}),G=Nr(p,{motion:c,option:()=>s.tooltip,description:()=>s.markDescription}),te=Tn(p),ne=pr(p),re=s.announce?Ot(p):void 0,ie=!1,ae=()=>{ie=!0},oe=C(R.frame.scale,S,{clock:d,motion:c,onChange:ae}),se=C(R.frame.box,S,{clock:d,motion:c,onChange:ae}),ce=C(Ti(R.curve),b,{clock:d,motion:c,onChange:ae}),le=new Map,ue=new Map,de=R.decimals,fe={changed:[],added:[],removed:[]},pe=R.frame,me=br({clock:d,runner:W,leaving:N,draw:ke,land:je});function he(e,t=l){let n=la(e);_r(t,n.series.map(e=>e.series),`lineChart`);let{room:r}=e;ua(r);let i=da({data:e.data,encoding:n,width:e.width??F,height:e.height,format:Xn(e),measure:T,label:ge(e,!0),room:r}),a=new Set(i.series);for(let e of i.rows)for(let t of i.series){let n=ha(t,e.key);if(a.has(n))throw RangeError(`lineChart: two marks would have the key "${n}". Series and keys joined with "@" must be unique.`);a.add(n)}for(let e of i.rows)if(a.has(e.key))throw RangeError(`lineChart: the key "${e.key}" would name both an x and a line or point. A row's key can't be a series, or a series and a key joined with "@".`);return i}function ge(e,n=!1){let{labels:r}=e;if(r===!1)return;let i=Xn(e);return(a,o)=>{let s=`${i(o)} ${qn(e.seriesLabels,a)}`;if(typeof r!=`function`)return s;try{let e=r(o,a,i);return e==null?``:String(e)}catch(e){return!n&&!L.has(r)&&(L.add(r),t(e)),s}}}function _e(e){let t=ge(s);if(t)return{text:(n,r)=>t(n,er(r,e[n]??$n(r))),measure:T}}function ve(e){let t=e.rows.map(La);return{lines:new Map(pa(e.frame,t,e.series,xe(e),e.time,_e(e.decimals),Ti(e.curve)).map(e=>[e.series,e])),points:new Map(t.flatMap(t=>ga(e.frame,t,e.series,e.time)).map(e=>[e.key,e]))}}function ye(e){let t=e.rows[0],n=e.rows[e.rows.length-1];return t&&n?Math.min(Math.max(ee,t.x),n.x):ee}function xe(e){let t=e.rows[e.rows.length-1];return t&&ee<t.x?ye(e):1/0}let Se=e=>!e.leaving&&e.row.x<=ye(R);function K(e,t){let n=Y(`g`,{class:`ec-column`,"data-key":e.key,role:`img`},w),r={clock:d,motion:c,onChange:ae},i={key:e.key,row:e,column:n,hit:Y(`rect`,{class:`ec-hit`},n),x:C(e.x,b,r),values:C(e.levels,S,r),presence:C(+!t,b,r),anchor:void 0,points:[],leaving:!1,shown:!0,px:0};return k.set(n,i),i}function Ce(e,t,n){let r=Y(`g`,{class:`ec-line`,"data-key":e,"data-series":e},v),i=Y(`g`,{class:`ec-body`},r),a={kind:`line`,key:e,series:e,group:r,body:i,path:Y(`path`,{class:`ec-stroke`,"stroke-width":aa},i),end:Y(`circle`,{class:`ec-end`,r:oa},i),label:Y(`text`,{class:`ec-value ec-end-label`},r),drawnLabel:void 0,parts:[],handle:zn(()=>a),target:t,shown:t,presence:C(+!n,b,{clock:d,motion:c,onChange:ae}),leave:void 0};return a}function we(e,t){let n=Y(`g`,{class:`ec-point`,"data-key":t.key,"data-series":t.series},x),r=Y(`g`,{class:`ec-body`},n),i={kind:`point`,key:t.key,series:t.series,row:e,group:n,body:r,path:Y(`path`,{class:`ec-dot`},r),parts:[],handle:zn(()=>i),target:t,shown:t,hidden:void 0,leave:void 0};return i}let Te=e=>H(e.key)===e,q=e=>e.points.filter(e=>M.get(e.key)===e),Ee=()=>[...N.values()].filter(e=>e.kind===`line`),De=()=>({scale:oe.value,box:se.value});function Oe(){let e=e=>({x:e.x.value,values:e.values.value}),t=new Map,n=new Set,r=i=>{let a=t.get(i);if(a)return a;let o=i.presence.value,s=e(i);if(i.anchor&&o<1&&!n.has(i)){n.add(i);let e=r(i.anchor);n.delete(i),s={x:e.x+o*(s.x-e.x),values:S(e.values,s.values)(o)}}return t.set(i,s),s};return[...E,...[...O.values()].filter(e=>e.presence.value>0&&e.anchor)].map(e=>{let{x:t,values:n}=r(e),i=e.anchor&&e.presence.value<1?{presence:e.presence.value}:{};return{record:e,state:{key:e.key,datum:e.row.datum,x:t,values:n,missing:e.row.missing,...i}}}).sort((e,t)=>e.state.x-t.state.x)}function ke(){if(!ie)return;ie=!1;let e=De(),t=Oe();Me(e),Ne(e,t.map(e=>e.state));for(let{record:n,state:r}of t){let t=new Map(ga(e,r,n.points.map(e=>e.series),R.time).map(e=>[e.key,e]));Fe(n.points.filter(Te).flatMap(e=>t.has(e.key)?[{record:e,placed:t.get(e.key)}]:[]))}Be(t.map(e=>e.state)),Ve(e,t),qe()}function Ae(){let e=De(),t=Oe();Ne(e,t.map(e=>e.state)),Ve(e,t),qe()}function je(){for(let e of O.values()){for(let t of[e.x,e.values,e.presence])t.stop();e.column.remove()}O.clear();for(let e of E)e.anchor=void 0,e.points=e.points.filter(Te);for(let[e,t]of[[le,R.yTicks],[ue,R.xTicks]]){for(let t of[...e.values()])t.wanted||(t.line?.remove(),t.label.remove(),e.delete(t.value));for(let n of t){let t=e.get(n.value);t&&(t.line&&`line`in n&&X(t.line,{...n.line,opacity:void 0}),Ft(t.label,n.label),t.label.removeAttribute(`opacity`))}}de=R.decimals;let{frame:e}=R;X(p,jt(e.box)),pe=e;let t=ve(R),n=(e,t)=>{let n=e.flatMap(e=>{let n=t(e);return n?[{record:e,to:n}]:[]});if(!n.every(({record:e,to:t})=>Ha(e.target.geometry,t.geometry)&&Ua(e.target.data,t.data)))for(let{record:e,to:t}of n)e.target=t;Fe(n.map(({record:e})=>({record:e,placed:e.target})))};n(A,e=>t.lines.get(e.series)),Pe(new Map(A.flatMap(e=>t.lines.has(e.series)?[[e,t.lines.get(e.series)]]:[])));let r=E.map(e=>({record:e,state:La(e.row)}));for(let{record:e}of r)n(q(e),e=>t.points.get(e.key));Be(r.map(e=>e.state)),Ve(e,r),qe(),ie=!1}function Me(e){pe=e,X(p,jt(e.box));let t=Xn(s);for(let n of le.values()){let r=xa(e,n.value,t(n.value)),i=n.opacity.value<1?n.opacity.value:void 0;X(n.line,{...r.line,opacity:i}),Ft(n.label,r.label),X(n.label,{opacity:i})}for(let t of ue.values())Ft(t.label,Sa(e,t.value,t.text).label),X(t.label,{opacity:t.opacity.value<1?t.opacity.value:void 0})}function Ne(e,t){let n=[...A,...Ee()];if(t.length===0||n.length===0)return;let r=pa(e,t,n.map(e=>e.series),xe(R),R.time,_e(de),ce.value);Fe(n.map((e,t)=>({record:e,placed:r[t]}))),Pe(new Map(n.map((e,t)=>[e,r[t]])))}function Pe(e){for(let[t,{label:n}]of e)n&&Ft(t.label,n),t.drawnLabel=n&&n.text!==``?n:void 0,X(t.label,{visibility:t.drawnLabel?void 0:`hidden`})}function Fe(e){let t=e.some(({record:e,placed:t})=>!Ua(e.shown.data,t.data));for(let{record:n,placed:r}of e)n.kind===`line`?Ie(n,r,t):Le(n,r,t)}function Ie(e,t,n){let r=n||Cr(e.shown.geometry,t.geometry);e.shown=t;let{geometry:i}=t;Re(e,pn(u.slot(e.series)),{visible:i.length>=.5,open:{width:i.thickness}}),X(e.end,{cx:i.end.x,cy:i.end.y,visibility:t.data.samples.length===0?`hidden`:void 0});let a=e.presence.value;X(e.group,{opacity:a<1?a:void 0}),r&&W.change(i,t.data)}function Le(e,t,n){let r=n||Cr(e.shown.geometry,t.geometry);e.shown=t,Re(e,pn(u.slot(e.series)),{visible:!0}),r&&W.change(t.geometry,t.data)}function Re(e,t,n){let r=e.parts[0],{d:i}=e.shown.geometry.outline,a=r?.colors.color!==t.color;(a||r?.d!==i||r.visible!==n.visible||r.open?.width!==n.open?.width)&&(e.path.getAttribute(`d`)!==i&&e.path.setAttribute(`d`,i),a&&At(e.group,hn(t)),e.parts=[{element:e.path,d:i,colors:t,...n}],e.handle.repaint(),r&&a&&U.recolor(e.key))}let ze=!1;function Be(e){let t=ma(e,R.series);if(t.size!==0||ze){for(let e of M.values())e.group.classList.toggle(`ec-alone`,t.has(e.key));ze=t.size>0}}function Ve(e,t){let{x:n}=fa(e),r=t.filter(({record:e})=>Se(e)),i=_a(e,r.map(({state:e})=>n(e.x)));r.forEach(({record:e,state:t},r)=>{X(e.hit,{...i[r]}),e.px=n(t.x)});let a=new Set(r.map(({record:e})=>e));for(let e of[...E,...O.values()]){let t=a.has(e);e.shown!==t&&(e.shown=t,X(e.column,{visibility:t?void 0:`hidden`,"aria-hidden":e.leaving?`true`:void 0}));let n=!Se(e);for(let t of e.points)t.hidden!==n&&(t.hidden=n,X(t.group,{visibility:n?`hidden`:void 0}),U.hide(t.key,n))}$e&&ht(e)}function He(e){let t=M.get(e);if(t){if(!Se(t.row))return;let{row:e}=t.row;G.show(t.shown.geometry,pt(e,t.series),()=>Za(e,t.series,s),t.handle.style.transform);return}let n=D.get(e);if(!n||!Se(n))return;let r=q(n),i=r[0]?.shown.geometry.center.x??n.px;X(g,{...va(pe,i),visibility:void 0});let a=r.map(e=>{let{transform:t}=e.handle.style,{center:n}=e.shown.geometry;return(t?J.apply(t,n):n).y}),{row:o}=n,c=a.length>0?{top:Math.min(...a)-oa,bottom:Math.max(...a)+oa}:{top:pe.box.top,bottom:pe.box.top};G.showAt({x:i,...c},o,()=>Xa(o,s))}function Ue(){g.setAttribute(`visibility`,`hidden`),G.hide()}function We(e){let t=e===void 0?void 0:D.get(e);!t||!Se(t)?g.setAttribute(`visibility`,`hidden`):X(g,{...va(pe,t.px),visibility:void 0})}let Ge;function Ke(e){let t=e===void 0?void 0:M.get(e),n=e===void 0?void 0:t?.row??D.get(e),r=n!==void 0&&Se(n),i=r?t?[t]:q(n):[];if(r&&i.length===0)Ge??(Ge=Y(`line`,{class:`ec-focus-ring`,"stroke-width":2},_)),(_.childElementCount>1||_.firstElementChild!==Ge)&&_.replaceChildren(Ge),X(Ge,va(pe,n.px)),_.removeAttribute(`visibility`);else{for(Ge?.remove();_.childElementCount>i.length;)_.lastElementChild.remove();i.forEach((e,t)=>{let n=_.children[t];n||(n=Y(`g`,{},_),Y(`path`,{class:`ec-focus-ring`,"stroke-width":8},n),Y(`path`,{class:`ec-focus-gap`,"stroke-width":4},n));for(let t of Array.from(n.children))t.setAttribute(`d`,e.shown.geometry.outline.d);let{transform:r}=e.handle.style;X(n,{transform:r&&Mt(r)})}),X(_,{visibility:i.length>0?void 0:`hidden`})}}function qe(){xt.key!==void 0&&He(xt.key),xt.standing!==void 0&&We(xt.standing),xt.ringKey!==void 0&&Ke(xt.ringKey)}let Je=e=>({mark:e.target.geometry,data:e.target.data}),Ye=e=>({mark:e.shown.geometry,data:e.shown.data});function Xe(e){let t=D.get(e);if(!t||!Se(t))return;let{row:n}=t;return{mark:be({key:e,x:t.px,y:pe.box.top,r:oa}),data:{datum:n.datum,samples:[{t:0,value:NaN,at:R.time?new Date(n.x):n.x}],related:()=>void 0}}}function Ze(e){let t=e,n=typeof t?.closest==`function`?t.closest(`.ec-column`):null,r=n?k.get(n):void 0;return r&&D.get(r.key)===r&&Se(r)?r:void 0}let $e,et,tt=new Map,nt=[],rt=new WeakMap;function it(){let e=new Map(R.series.map(e=>[e,[]]));for(let t of E)for(let n of q(t))e.get(n.series)?.push(n);return[...e.values()].flat()}let at=e=>E.filter(Se).flatMap(t=>q(t).filter(t=>t.series===e));function ot(e){let t=E.filter(Se).flatMap(q),n,r=1/0,i=1/0;for(let a of t){let t=Ga(a.shown.geometry.center,e),o=R.series.indexOf(a.series);(t<r||t===r&&o<i)&&([n,r,i]=[a,t,o])}if(!n)return;let a=n.shown.geometry.center,o=new Map;for(let n of t){let{center:t}=n.shown.geometry,r=o.get(n.series);Ga(t,a)<=1&&(!r||Ga(t,e)<Ga(r.shown.geometry.center,e))&&o.set(n.series,n)}if(o.size<2)return n;let s=n,c=1/0;for(let t of R.series){let n=o.get(t);if(!n)continue;let r=st(n,e);r<c&&([s,c]=[n,r])}return s}function st(e,t){let{geometry:n,data:r}=e.shown,i=j.get(e.series);return(i&&Ka(i.shown,r.samples[0].at,n.center,t,9))??Math.max(0,Math.hypot(t.x-n.center.x,t.y-n.center.y)-4.5)}function lt(e){let t=xt.key===void 0||!G.element()?void 0:M.get(xt.key);if(!t||!Se(t.row))return;let{transform:n}=t.handle.style,r=e;if(n)try{r=J.apply(Qe(n),e)}catch{return}let{center:i}=t.shown.geometry;return(r.x-i.x)**2+(r.y-i.y)**2<=4.5**2?t:void 0}function ut(e,t){let n=dt(e,t);return lt(n)??ot(n)}function dt(e,t){let n=p.getBoundingClientRect(),r=n.width>0&&pe.box.width>0?n.width/pe.box.width:1;return{x:(e-n.left)/r,y:(t-n.top)/r}}let ft=new WeakMap;function pt(e,t){let n=ft.get(e);n||ft.set(e,n=new Map);let r=n.get(t);return r||n.set(t,r={datum:e.datum,series:t}),r}function mt(){if(o!==`point`)return;$e||($e=Y(`g`,{class:`ec-stops`},p),p.insertBefore($e,w.nextSibling),et=Y(`rect`,{class:`ec-hit`},$e),$e.addEventListener(`click`,e=>{let t=ut(e.clientX,e.clientY);t&&tt.get(t.key)?.element.focus()}));let e=it(),t=new Set(e.map(e=>e.key));for(let[e,n]of tt)t.has(e)||(n.element.remove(),tt.delete(e));let n=e.map(e=>{let t=tt.get(e.key);if(!t){let n=Y(`g`,{class:`ec-stop`,"data-key":e.key,role:`img`},$e);t={element:n,bounds:Y(`circle`,{r:8.5,fill:`none`},n),x:NaN,y:NaN,hidden:void 0},tt.set(e.key,t),rt.set(n,e.key)}let n=V?.get(e.key)??e.key;return t.element.getAttribute(`aria-label`)!==n&&t.element.setAttribute(`aria-label`,n),G.describe(t.element,pt(e.row.row,e.series)),t.element});lr($e,nt,n,xt.active),nt=n}function ht(e){let{left:t,right:n,top:r,bottom:i}=e.box;X(et,{x:t-oa,y:r-oa,width:n-t+2*oa,height:i-r+2*oa});for(let[e,t]of tt){let n=M.get(e);if(!n)continue;let r=!Se(n.row);t.hidden!==r&&(t.hidden=r,X(t.element,{visibility:r?`hidden`:void 0}));let{x:i,y:a}=n.shown.geometry.center;(t.x!==i||t.y!==a)&&(t.x=i,t.y=a,X(t.bounds,{cx:i,cy:a}))}}function gt(e){let t=M.get(e);if(t)return t.row.key;let n=E.filter(Se),r=n.findIndex(t=>t.key===e);for(let e=0;r>=0&&e<n.length;e++)for(let t of[r+e,r-e]){let e=n[t]&&q(n[t])[0];if(e)return e.key}}function _t(e){e!==o&&(xt.leave(),o=e,e===`point`?(mt(),ht(pe)):w.removeAttribute(`display`),xt.retarget(gt),e===`point`?w.setAttribute(`display`,`none`):($e?.remove(),$e=et=void 0,tt.clear(),nt=[]))}let vt=new Map;function yt(e,t){let n=t?o===`point`?H(e)?.series:void 0:vt.get(e);n!==void 0&&(t?vt.set(e,n):vt.delete(e),U.hot(e,t),(t||![...vt.values()].includes(n))&&(H(n)?.group.classList.toggle(`ec-hot-line`,t),U.hot(n,t)))}function bt(e){let t=o===`point`?M.get(e):void 0,n=o===`point`?t?.row:D.get(e);return n!==void 0&&Se(n)}let xt=ar({svg:p,runner:W,events:P,dim:()=>o===`point`&&s.dim!==!1&&xt.key!==void 0,hot:yt,find(e,t){if(o===`x`){let t=Ze(e);return t&&{key:t.key}}let n=e;if(!$e||typeof n?.closest!=`function`||!$e.contains(n))return;if(t){let e=ut(t.x,t.y);return e&&{key:e.key}}let r=n.closest(`.ec-stop`),i=r?rt.get(r):void 0;return i!==void 0&&bt(i)?{key:i}:void 0},moves:()=>o===`point`,live:bt,order:()=>(o===`point`?it().filter(e=>Se(e.row)):E.filter(Se)).map(e=>e.key),page(e,t){let n=o===`point`?M.get(e):void 0,r=n?at(n.series).map(e=>({key:e.key,x:e.row.row.x})):E.filter(Se).map(e=>({key:e.key,x:e.row.x})),i=r.findIndex(t=>t.key===e);if(i<0)return;if(!R.time)return n?r[Math.min(r.length-1,Math.max(0,i+t*Math.ceil(r.length/10)))].key:void 0;let a=Gi(r[i].x,t,la(s).timeZone);if(t>0)return(r.find(e=>e.x>=a)??r[r.length-1])?.key;for(let e=r.length-1;e>=0;e--)if(r[e].x<=a)return r[e].key;return r[0]?.key},move(e,t){let n=o===`point`?M.get(e):void 0;if(!n)return;let r=t===`ArrowUp`||t===`ArrowDown`?q(n.row).sort((e,t)=>e.shown.geometry.center.y-t.shown.geometry.center.y):at(n.series),i=r.indexOf(n),a=t===`Home`?0:t===`End`?r.length-1:i+(t===`ArrowDown`||t===`ArrowRight`?1:-1);return r[Math.max(0,Math.min(r.length-1,a))]?.key},marks:e=>{let t=D.get(e);return t?q(t).map(e=>e.key):M.has(e)?[e]:[]},element:e=>(D.get(e)??O.get(e))?.column??tt.get(e)?.element,markElement:e=>H(e)?.group,onScreen(e){let t=H(e);return t&&Ye(t)},standIn:Xe,stand:We,ring:Ke,tooltip:{show:He,hide:Ue,element:()=>G.element()}}),St=()=>te.update(R.series.map(e=>({series:e,label:qn(s.seriesLabels,e)})),u,s.legend);function wt(e,t){return dr({option:e.table,caption:e.label,category:typeof e.x==`string`?e.x:void 0,series:t.series,label:t=>qn(e.seriesLabels,t),rows:t.rows.map(e=>({key:e.key,category:e.label,datum:e.datum,index:e.index,values:Ra(e.values),missing:e.missing,total:Ba(e.values)})),format:Xn(e),total:!1,missing:no(e)})}function Tt(e){o===`x`&&(e.column.setAttribute(`aria-label`,B.get(e.key)),G.describe(e.column,e.row))}function Dt(e,n){let r=s.announce;if(!re||!r)return;let i=R.series,a=e=>e.row.label,{changed:o,added:c,removed:l}=fe,u=Et({...s.label===e.label?{}:{label:s.label},...i.join(`
|
|
95
95
|
`)===n.join(`
|
|
96
|
-
`)?{}:{series:i.map(e=>qn(s.seriesLabels,e))},changed:o.map(a),added:c.map(a),removed:l.map(a),count:E.length});if(typeof r!=`function`){ae.say(u);return}let d=e=>e.key;try{let e=r({text:u,changed:o.map(d),added:c.map(d),removed:l.map(d)});e!=null&&ae.say(String(e))}catch(e){t(e)}}function kt(e){R=e;let t=ye(e),n={entering:[],exiting:[],changed:[]},r=new Set(e.rows.map(e=>e.key)),i=e.rows.length>0?e.series:[],a={changed:[],added:[],removed:[]},o=E,s=new Map(o.map(e=>[e,e.row])),c=new Map(e.rows.map(e=>[e.key,e])),l=A.filter(e=>!i.includes(e.series)),u=[];for(let e of o){let t=!r.has(e.key),n=c.get(e.key)?.missing;t&&(D.delete(e.key),e.leaving=!0,O.set(e.key,e),a.removed.push(e));for(let r of K(e))(t||!i.includes(r.series)||n?.has(r.series))&&u.push(r)}for(let e of l)j.delete(e.series);for(let e of u)M.delete(e.key);for(let e of[...l,...u])N.start(e);n.exiting.push(...l,...u);let d=new Set,f=a.removed.length>0;E=e.rows.map(e=>{let t=D.get(e.key);return t?(d.add(t),t.row.x!==e.x&&(f=!0),e.values.some((e,n)=>t.row.values[n]?.series!==e.series||t.row.values[n]?.value!==e.value)&&a.changed.push(t)):(t=O.get(e.key)??G(e,!0),O.delete(e.key),t.leaving=!1,t.x.set(e.x),t.values.set(e.levels),D.set(e.key,t),a.added.push(t),f=!0),t.row=e,t}),E.forEach((e,t)=>{d.has(e)?e.presence.value===1&&(e.anchor=void 0):e.anchor=Va(E,t,d)});for(let e of a.removed)e.anchor??(e.anchor=Va(o,o.indexOf(e),d));let p=A;A=i.map(e=>{let r=j.get(e),i=t.lines.get(e);if(r){let t=[...d].some(t=>za(s.get(t),e)!==za(t.row,e));(f||t)&&n.changed.push({record:r,from:r.shown.geometry})}else r=Nt(e,`line`)??we(e,i,!0),j.set(e,r),n.entering.push(r);return r.target=i,r});for(let e of E){let r=d.has(e)?s.get(e):void 0,a=i.filter(t=>!e.row.missing.has(t)).map(i=>{let a=ha(i,e.key),o=t.points.get(a),s=M.get(a);return s?r&&za(r,i)!==za(e.row,i)&&n.changed.push({record:s,from:s.shown.geometry}):(s=Nt(a,`point`)??Te(e,o),s.row=e,M.set(a,s),n.entering.push(s)),s.target=o,s}),o=new Set(a);e.points=[...a,...e.points.filter(e=>!o.has(e)&&Ee(e))]}for(let e of E)Tt(e);return ht(),lr(w,o.filter(e=>!e.leaving).map(e=>e.column),E.map(e=>e.column),J.active),lr(v,p.map(e=>e.group),A.map(e=>e.group),()=>null),pe=a,oe=!0,Ae(),n}function Nt(e,t){return N.get(e)?.kind===t?N.recall(e):void 0}function Pt(e,t){oe=!0;let{frame:n}=e;for(let[t,n,r]of[[ue,e.yTicks,!0],[de,e.xTicks,!1]]){let e=new Set(n.map(e=>e.value));for(let n of e)t.has(n)||Lt(t,n,0,r);for(let n of t.values())n.wanted=e.has(n.value)}for(let t of e.xTicks)de.get(t.value).text=t.label.text;let r=De(),i=[...O.values()],a=Q(ce,n.scale,Sr)||[...ue.values()].some(e=>Q(e.opacity,+!!e.wanted,$))||E.some(e=>Q(e.values,e.row.levels,Sr))||A.some(e=>Q(e.presence,1,$))||r.some(e=>Q(e.presence,0,$))||Q(W,Ti(e.curve),$),o=Q(le,n.box,Sr)||[...de.values()].some(e=>Q(e.opacity,+!!e.wanted,$))||E.some(e=>Q(e.x,e.row.x,$)||e.anchor!==void 0&&Q(e.presence,1,$))||i.some(e=>e.anchor!==void 0&&Q(e.presence,0,$)),s,l;!t&&c.staged?(s={duration:500},l={duration:500,delay:a?500:0}):t||(s=l={duration:(a&&o?2:1)*500});let u=[],d=(e,t,n,r)=>{Q(e,t,n)&&(r?u.push(e.to(t,r)):e.set(t))};d(ce,n.scale,Sr,s),d(W,Ti(e.curve),$,s),d(le,n.box,Sr,l);for(let e of ue.values())d(e.opacity,+!!e.wanted,$,s);for(let e of de.values())d(e.opacity,+!!e.wanted,$,l);for(let e of E)d(e.values,e.row.levels,Sr,s),d(e.x,e.row.x,$,l),d(e.presence,1,$,e.anchor?l:void 0);for(let e of i)d(e.presence,0,$,e.anchor?l:void 0);for(let e of A)d(e.presence,1,$,s);for(let e of r)d(e.presence,0,$,s);return u}function Lt(e,t,n,r,i=``){let a={value:t,line:r?Y(`line`,{class:t===0?`ec-baseline`:`ec-gridline`},m):void 0,label:Y(`text`,{class:`ec-tick`},h),text:i,opacity:C(n,b,{clock:d,motion:c,onChange:se}),wanted:!0};e.set(t,a);for(let t of[...e.values()].sort((e,t)=>e.value-t.value))t.line&&m.appendChild(t.line),h.appendChild(t.label)}function Rt(e,t){return R=e,fe=Object.fromEntries(e.series.map(t=>[t,Math.max(fe[t]??0,e.decimals[t]??0)])),he.run(Pt(e,t))}let zt=kr(p,c);function Bt(){if(I)return;let e=ge(s),t=new Map(e.rows.map(e=>[e.key,e]));for(let e of E)e.row=t.get(e.key)??e.row;let n=ye(e);for(let e of A)e.target=n.lines.get(e.series)??e.target;for(let e of M.values())e.target=n.points.get(e.key)??e.target;Rt(e,!0)}let Vt=()=>{T.clear(),Bt()},Ht=Or(p,d,Vt),Ut=Er(i,d,F,e=>{F=e,s.width===void 0&&Bt()}),Wt=Dr(f,Vt);gr(p,s),St(),ie.render(z);{let e=ye(R);for(let e of R.yTicks)Lt(ue,e.value,1,!0);for(let e of R.xTicks)Lt(de,e.value,1,!1,e.label.text);E=R.rows.map(t=>{let n=G(t,!1);return D.set(t.key,n),n.points=R.series.filter(e=>!t.missing.has(e)).map(r=>{let i=Te(n,e.points.get(ha(r,t.key)));return M.set(i.key,i),i}),Tt(n),n}),A=R.rows.length>0?R.series.map(t=>we(t,e.lines.get(t),!1)):[];for(let e of A)j.set(e.series,e);ht(),o===`point`&&w.setAttribute(`display`,`none`),Me()}let Gt=()=>[...A,...E.flatMap(K)];J.sync(),ne.enter(Gt().map(Ye));function Kt(e){let t=D.get(e);return o===`x`?(t??M.get(e)?.row)?.key:(M.get(e)??(t&&K(t)[0]))?.key}return An(J.link,{element:p,async update(e){if(I)return;if(e.motion!==void 0&&e.motion!==s.motion)throw TypeError("lineChart: `motion` can't be changed by update() yet.");let t={...s,...e};yr(t,`lineChart`);let n=to(t);no(t);let i=`on`in e?vr(l,s.on,t.on,r.presets):l,a=ge(t,i),o=wt(t,a),d=n===`x`?$a(t,a):void 0,f=n===`point`?eo(t,a):void 0;`colors`in e&&(u=Sn(t.colors));let m=s,h=R.series;s=t,B=d,V=f,gr(p,s),ie.render(o);let g=ae!==void 0;s.announce&&!ae?ae=Ot(p):!s.announce&&ae&&(ae.destroy(),ae=void 0),vt(n),J.syncDim(),he.supersede();let _=i!==l;l=i;let v=xr({runner:ne,events:P,hover:J,leaving:N,input:Ye,onScreen:Xe,data:`data`in e,..._?{swap:e=>{let t=new Set(e.entering);ne.swap(i,Gt().filter(e=>!t.has(e)).map(Ye))}}:{}},()=>kt(a),()=>{g&&Dt(m,h)});St();let y=Rt(a,c.mode===`off`);await he.wait(y,v)},reveal(e){if(I)return;if(e instanceof Date&&Number.isNaN(e.getTime()))throw RangeError(`lineChart: reveal(x) needs a valid Date, got an invalid Date.`);let t=e instanceof Date?e.getTime():e;if(typeof t!=`number`||Number.isNaN(t))throw RangeError(`lineChart: reveal(x) needs a number, got ${typeof t==`string`?JSON.stringify(t):String(t)}.`);let n=be(R);ee=t,be(R)!==n&&(je(),J.dropGone(),J.sync())},on:P.on,marks:()=>[...A.map(e=>e.shown.geometry),...E.filter(Ce).flatMap(e=>K(e).map(e=>e.shown.geometry))],focus(e){let t=I?void 0:Kt(e);t!==void 0&&J.focus(t)},leave(){I||J.leave()},labels:()=>A.flatMap(e=>or(e.key,`value`,e.drawnLabel,e.label)),paintOf(e){let t=j.get(e);if(t)return{color:t.series,drawn:!0,...t.end.getAttribute(`visibility`)===`hidden`?{}:{end:oa,ring:2}};let n=M.get(e);return n&&(n.group.classList.contains(`ec-alone`)?{color:n.series,drawn:!0,ring:2}:{color:n.series,drawn:!1})},standsFor(e){return D.has(e)?[...R.series.map(t=>ha(t,e)),e]:[e]},moveTabStop(e){let t=I?void 0:Kt(e);return t!==void 0&&J.moveTabStop(t)},destroy(){if(!I){I=!0,he.destroy(),J.destroy(),ne.destroy(),U.destroy(),re.destroy(),ie.destroy(),ae?.destroy(),zt(),Ht(),Ut(),Wt();for(let e of[...E,...O.values()])for(let t of[e.x,e.values,e.presence])t.stop();for(let e of[...A,...De()])e.presence.stop();for(let e of N.values())e.leave?.resolve();ce.stop(),le.stop(),W.stop();for(let e of[...ue.values(),...de.values()])e.opacity.stop();P.clear(),D.clear(),O.clear(),j.clear(),M.clear(),N.clear(),E=[],A=[],p.remove()}}})}function La(e){return{key:e.key,datum:e.datum,x:e.x,values:e.levels,missing:e.missing}}function Ra(e){return e.flatMap(e=>e.value===void 0?[]:[{series:e.series,value:e.value}])}function za(e,t){return e.values.find(e=>e.series===t)?.value}function Ba(e){return e.reduce((e,t)=>e+(t.value??0),0)}function Va(e,t,n){for(let r=t-1;r>=0;r--)if(n.has(e[r]))return e[r];for(let r=t+1;r<e.length;r++)if(n.has(e[r]))return e[r]}function Ha(e,t){return e.key===t.key&&!Cr(e,t)&&e.start.x===t.start.x&&e.start.y===t.start.y&&e.end.x===t.end.x&&e.end.y===t.end.y}function Ua(e,t){return e.datum!==t.datum||e.samples.length!==t.samples.length?!1:e.samples.every((e,n)=>{let r=t.samples[n];return e.t===r.t&&e.value===r.value&&Wa(e.at,r.at)&&e.gapBefore===r.gapBefore})}function Wa(e,t){return e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function Ga(e,t){return(e.x-t.x)**2+(e.y-t.y)**2}function Ka({geometry:e,data:{samples:t}},n,r,i,a){let o=t.findIndex(e=>Wa(e.at,n));if(o<0||!(e.length>0))return;let s=t[o].t,c=a/e.length,l;for(let n of[-1,1]){let a=r;for(let r=o;;r+=n){let o=t[r+n];if(!o||(n>0?o:t[r]).gapBefore)break;let u=n>0?Math.min(o.t,s+c):Math.max(o.t,s-c),d=e.path(u);if(l=Math.min(l??1/0,qa(i,a,d)),u!==o.t)break;a=d}}return l}function qa(e,t,n){let r=n.x-t.x,i=n.y-t.y,a=r*r+i*i,o=a>0?Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*i)/a)):0;return Math.hypot(e.x-t.x-o*r,e.y-t.y-o*i)}function Ja(e,t){return Ra(e).map(e=>({series:e.series,label:qn(t.seriesLabels,e.series),value:e.value}))}function Ya(e,t){let n=Xn(t),r=no(t);return e.map(e=>{let i=qn(t.seriesLabels,e.series);return e.value===void 0?`${i} ${r}`:`${n(e.value)} ${i}`})}function Xa(e,t){return e.missing.size===0?Mr(e.label,Ja(e.values,t),Xn(t),{total:!1}):{title:e.label,lines:[Ya(e.values,t).join(` · `)]}}function Za(e,t,n){return Mr(e.label,Ja(e.values,n).filter(e=>e.series===t),Xn(n),{total:!1})}function Qa(e,n,r){if(!e.markLabel)return r.text;try{let t=e.markLabel(n,r);if(t!=null&&String(t).trim()!==``)return String(t)}catch(e){t(e)}return r.text}function $a(e,t){let n=Xn(e);return new Map(t.rows.map(t=>{let r=`${t.label}: ${Ya(t.values,e).join(`, `)}`;return[t.key,Qa(e,t.datum,{key:t.key,category:t.label,values:Ja(t.values,e),total:Ba(t.values),format:n,text:r})]}))}function eo(e,t){let n=Xn(e);return new Map(t.rows.flatMap(t=>Ja(t.values,e).map(r=>{let i=ha(r.series,t.key),a=`${t.label}: ${n(r.value)} ${r.label}`;return[i,Qa(e,t.datum,{key:i,category:t.label,values:[r],total:r.value,format:n,text:a})]})))}function to(e){let{hover:t=`x`}=e;if(t!==`x`&&t!==`point`)throw TypeError(`lineChart: hover must be "x" or "point", got ${typeof t==`string`?JSON.stringify(t):String(t)}.`);return t}function no(e){let{missing:t=`missing`}=e;if(typeof t!=`string`||t.trim()===``)throw TypeError(`lineChart: missing must be a word for a missing value, such as "no data", got ${typeof t==`string`?JSON.stringify(t):String(t)}.`);return t}let ro=.5;function io(e){let t=ao(e.start,e.pivot);return t>ro&&Math.abs(ao(e.center,e.pivot)-t)<=ro&&Math.abs(ao(e.end,e.pivot)-t)<=ro}let ao=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y),oo=.5,so=[`left`,`right`,`top`,`bottom`];function co(e){return typeof e==`string`&&so.includes(e)}function lo(e,t){if(t!==`auto`)return e.map(()=>t);if(e.length===0)return[];let n=mo(e,e=>e.x,e=>e.x+e.width,`left`,`right`),r=mo(e,e=>e.y+e.height,e=>e.y,`bottom`,`top`);if(n&&r)return ho(e)?n:r;let i=n??r;if(!i)throw RangeError(`expressive: baseline "auto" found no edge that every mark grows from. Pass baseline: "left", "right", "top" or "bottom".`);return i}function uo(e,t,n){let r=po(t.map(e=>e.box)),i=go(r,n),a=t.map((e,t)=>({index:t,...i(e.box)})).sort((e,t)=>e.near-t.near||e.far-t.far||e.index-t.index),o=0,s=1/0,c=a.map(({index:e,near:n,far:r})=>{o>0&&r>n&&(s=Math.min(s,n-o));let i=Math.max(0,r-o);return o=Math.max(o,r),{series:t[e].series,size:i}}),l=t[a[a.length-1].index],u=t.length===1?t[0].series:void 0;return{geometry:he({key:e,...u===void 0?{}:{series:u},...r,baseline:n,radius:l.radius,gap:Number.isFinite(s)?Math.max(0,_o(s)):0,...c.every(e=>e.series!==void 0)?{segments:c.map(e=>({series:e.series,size:_o(e.size)}))}:{}}),order:a.map(e=>e.index)}}function fo(e,t){let n=t[0]===`left`||t[0]===`right`,r=e=>n?e.y:e.x,i=e=>n?e.x:e.y;return e.map((e,t)=>t).sort((t,n)=>r(e[t])-r(e[n])||i(e[t])-i(e[n])||t-n)}function po(e){let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,width:_o(Math.max(...e.map(e=>e.x+e.width))-t),height:_o(Math.max(...e.map(e=>e.y+e.height))-n)}}function mo(e,t,n,r,i){let a=e[0];if(!a)return[];for(let o of[t(a),n(a)]){let a=[];for(let s of e)if(Math.abs(t(s)-o)<oo)a.push(r);else if(Math.abs(n(s)-o)<oo)a.push(i);else break;if(a.length===e.length)return a}}function ho(e){let t=e=>Math.max(...e)-Math.min(...e),n=t(e.map(e=>e.y+e.height/2)),r=t(e.map(e=>e.x+e.width/2));return n===r?e[0].width>=e[0].height:n>r}function go(e,t){switch(t){case`left`:return t=>({near:t.x-e.x,far:t.x+t.width-e.x});case`right`:return t=>({near:e.x+e.width-(t.x+t.width),far:e.x+e.width-t.x});case`top`:return t=>({near:t.y-e.y,far:t.y+t.height-e.y});case`bottom`:return t=>({near:e.y+e.height-(t.y+t.height),far:e.y+e.height-t.y})}}function _o(e){return Math.round(e*1e3)/1e3}function vo(){let e=new Map,t=t=>{let n=e.get(t);return n||(n={attributes:new Map,styles:new Map,classes:new Set,before:{}},e.set(t,n)),n},n=e=>e.style,r=(e,t,n)=>{n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)},i=(e,t)=>{let i=t.before.style;t.styles.size>0||!i||(t.before.style=void 0,n(e)?.cssText===i.css&&r(e,`style`,i.text))},a=(e,t)=>{let n=t.before.class;if(t.classes.size>0||n===void 0)return;t.before.class=void 0;let i=e=>[...new Set((e??``).split(/\s+/).filter(Boolean))].sort().join(` `);i(e.getAttribute(`class`))===i(n)&&r(e,`class`,n)};function o(e,n,i){let a=e.getAttribute(n),o=t(e).attributes,s=o.get(n);s?(a!==s.written&&(s.original=a),s.written=i):o.set(n,{original:a,written:i}),r(e,n,i)}function s(t,n,i){if(i!==null){o(t,n,i);return}let a=e.get(t)?.attributes,s=a?.get(n);a&&s&&(t.getAttribute(n)===s.written&&r(t,n,s.original),a.delete(n))}function c(e,r,a){let o=n(e);if(!o)return;let s=t(e),c=s.styles.get(r);if(a===void 0){if(!c)return;c.value===``?o.removeProperty(r):o.setProperty(r,c.value,c.priority),s.styles.delete(r),i(e,s)}else c||(s.styles.size===0&&(s.before.style={text:e.getAttribute(`style`),css:o.cssText}),s.styles.set(r,{value:o.getPropertyValue(r),priority:o.getPropertyPriority(r)})),o.getPropertyValue(r)!==a&&o.setProperty(r,a)}function l(n,r,i){let o=n.classList;if(i){if(o.contains(r))return;let e=t(n);e.classes.size===0&&(e.before.class=n.getAttribute(`class`)),e.classes.add(r),o.add(r);return}let s=e.get(n);s?.classes.delete(r)&&(o.remove(r),a(n,s))}function u(t){let n=e.get(t);if(n){for(let e of[...n.styles.keys()])c(t,e,void 0);for(let e of[...n.classes])l(t,e,!1);for(let e of[...n.attributes.keys()])s(t,e,null);e.delete(t)}}return{attribute:s,remove:(e,t)=>o(e,t,null),style:c,styled:(t,n)=>e.get(t)?.styles.has(n)??!1,toggleClass:l,restore:u,restoreAll(){for(let t of[...e.keys()])u(t)},elements:()=>[...e.keys()]}}function yo(){let e=new Map;return t=>(e.has(t)||e.set(t,Oo(t)),e.get(t))}function bo(e,t,n,r=Oo){let i=r(e),a=i&&r(t);return i&&a?q.multiply($e(i),a):q.multiply($e(ko(e,n)),ko(t,n))}function xo(e){return et(e.getAttribute(`transform`)??``)}function So(e){let[t,n,r,i]=e,a=1e-9*Math.max(Math.abs(t),Math.abs(n),Math.abs(r),Math.abs(i));return Math.abs(n)<=a&&Math.abs(r)<=a||Math.abs(t)<=a&&Math.abs(i)<=a}function Co(e){let[t,n,r,i]=e,a=t*t+n*n,o=r*r+i*i,s=1e-4*Math.max(a,o);return Math.abs(a-o)<=s&&Math.abs(t*r+n*i)<=s}function wo(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))}function To(e,t){let n=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x,y:t.y+t.height},{x:t.x+t.width,y:t.y+t.height}].map(t=>q.apply(e,t)),r=n.map(e=>e.x),i=n.map(e=>e.y),a=Ao(Math.min(...r)),o=Ao(Math.min(...i));return{x:a,y:o,width:Ao(Ao(Math.max(...r))-a),height:Ao(Ao(Math.max(...i))-o)}}function Eo(e){let t=Do(e),n=e=>{let n=Number.parseFloat(t(e)??``);return Number.isFinite(n)?n:0};return{x:n(`x`),y:n(`y`),width:Math.max(0,n(`width`)),height:Math.max(0,n(`height`))}}function Do(e){return t=>{if(!e.hasAttribute(t))return null;let n=e[t];return typeof n?.baseVal?.value==`number`?String(n.baseVal.value):e.getAttribute(t)}}function Oo(e){let t=typeof e.getScreenCTM==`function`?e.getScreenCTM():null;return t?[t.a,t.b,t.c,t.d,t.e,t.f]:void 0}function ko(e,t){let n=[1,0,0,1,0,0];for(let r=e;r&&r!==t;r=r.parentElement)n=q.multiply(xo(r),n);return n}function Ao(e){return Math.round(e*1e3)/1e3}function jo(e,t,n){let r={},i=!1,a=Rn(),o=()=>{let{transform:n,opacity:a,emphasis:o}=r;for(let r of e()){let{element:e,colors:s}=r,c=n&&r.parentInverse?q.multiply(r.parentInverse,n,r.parent,xo(e)):void 0;t.style(e,`transform`,c&&Wo(c)),t.style(e,`transform-origin`,c&&`0 0`),t.style(e,`transform-box`,c&&`view-box`),t.style(e,`opacity`,a===void 0?void 0:String(a));let l=s?o===void 0?i?s.strong:void 0:Uo(s,o):void 0;t.style(e,`fill`,s?.paint===`fill`?l:void 0),t.style(e,`stroke`,s?.paint===`stroke`?l:void 0),t.style(e,`transition`,o===void 0||!s?void 0:`none`)}s()},s=()=>{let t=e().flatMap(e=>e.outline===void 0?[]:[{...e.outline,color:e.colors?.color}]);a.paint(n(),t,r.halo,r.transform)};return{get style(){return r},set(e){r=ft(r,e),o()},reset(){r={},o()},repaint:o,hot(e){e!==i&&(i=e,o())}}}function Mo(e,t){let n=zo(e,t,`fill`),r=n===Io?`stroke`:`fill`,i=r===`fill`?n:zo(e,t,`stroke`);if(i!==void 0&&i!==Io)return{...No(i),paint:r}}function No(e){return{color:e,strong:`color-mix(in oklab, ${e}, ${mn(`text`)} ${Fo})`}}function Po(e,t,n){let r=e.ownerDocument.defaultView?.getComputedStyle?.(e).getPropertyValue(n).trim()??``;if(Ro(t))return r;for(let r=e;r;r=r===t?null:r.parentElement){let e=r.style?.getPropertyValue(n)||r.getAttribute(n);if(e)return e.trim()}return r}let Fo=`25%`,Io=`none`,Lo=new WeakMap;function Ro(e){let t=Lo.get(e);if(t!==void 0)return t;let n=e.ownerDocument.defaultView;if(!e.isConnected||typeof n?.getComputedStyle!=`function`)return!1;let r=e.ownerDocument.createElementNS(`http://www.w3.org/2000/svg`,`g`);r.setAttribute(`stroke-miterlimit`,`7`),e.appendChild(r);let i=n.getComputedStyle(r).getPropertyValue(`stroke-miterlimit`).trim()===`7`;return r.remove(),Lo.set(e,i),i}function zo(e,t,n){let r=e.ownerDocument.defaultView?.getComputedStyle?.(e).getPropertyValue(n),i=Ho(r);if(r&&Ro(t))return i;let a;for(let r=e;r&&a===void 0;r=r===t?null:r.parentElement){let e=r.style?.getPropertyValue(n)||r.getAttribute(n);e&&(a=e)}let o=n===`fill`?i?.replace(/\s/g,``)===`rgb(0,0,0)`:i===Io;return i!==void 0&&!(o&&a!==void 0)?i:Ho(a)}function Bo(e,t){let n=e.ownerDocument.defaultView?.getComputedStyle?.(e),r=n?.getPropertyValue(`stroke-width`),i=Vo(r),a=n?.getPropertyValue(`vector-effect`).trim().toLowerCase(),o=e.style?.getPropertyValue(`vector-effect`)?a:e.getAttribute(`vector-effect`)?.trim().toLowerCase(),s=(a&&(a!==`none`||Ro(t))?a:o)===`non-scaling-stroke`;if(r&&Ro(t)||i!==void 0&&i!==1)return{width:i,screen:s};for(let n=e;n&&!n.style?.getPropertyValue(`stroke-width`);n=n===t?null:n.parentElement){let e=Vo(n.getAttribute(`stroke-width`));if(e!==void 0)return{width:e,screen:s}}return{width:i,screen:s}}function Vo(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)\s*(?:px\s*)?$/i.exec(e??``),n=t?Number(t[1]):NaN;return n>=0&&Number.isFinite(n)?n:void 0}function Ho(e){let t=e?.trim().toLowerCase();if(t&&t!==`inherit`&&!t.startsWith(`url(`))return t===Io||t===`transparent`||/^rgba\((?:[^,]+,){3}\s*0(?:\.0*)?\s*\)$/.test(t)?Io:e.trim()}function Uo(e,t){let n=Math.min(1,Math.max(0,t));return n===0?e.color:n===1?e.strong:`color-mix(in srgb, ${e.strong} ${Math.round(n*1e3)/10}%, ${e.color})`}function Wo(e){return`matrix(${e.map((e,t)=>t<4?Math.round(e*1e6)/1e6:Math.round(e*1e3)/1e3).join(`, `)})`}function Go(e,t){let n=wo(t);if(!Co(t)||!(n>0)||e.length>32||e.some(e=>e.op===`C`||e.op===`Q`))return;let r=.5/n,i=G(e);if(i.length===0||i.length>2||!i.every(es))return;let a=i.map(e=>$o(e.segments,r)),o=i.length===2?Ko(a[0],a[1],r):qo(a[0],r);return o&&Qo(o,t)}function Ko(e,t,n){let[r,i]=[e[0],t[0]];if(e.length!==1||t.length!==1||r?.kind!==`arc`||i?.kind!==`arc`)return;let[a,o]=r.radius>=i.radius?[r,i]:[i,r],s=(e,t)=>Math.abs(Math.abs(e)-O)*t<=n;for(let e of[Xo(a),a.arcs[0].center]){if(!e)continue;let[t,r]=[ns(a.from,e),ns(o.from,e)],[i,c]=[Yo(a,e),Yo(o,e)];if(t>n&&t-r>n&&Math.sign(i)!==Math.sign(c)&&s(i,t)&&s(c,r)&&Zo(a,e,t,n)&&Zo(o,e,r,n))return{center:e,inner:r,outer:t,start:ts(a.from,e),sweep:Math.sign(i)*O}}}function qo(e,t){let n=-1;if(e.forEach((t,r)=>{t.kind===`arc`&&(n<0||t.radius>e[n].radius)&&(n=r)}),n<0)return;let r=[...e.slice(n),...e.slice(0,n)],i=r[0],[,a,o,s]=r,c=r.length===3&&a?.kind===`line`&&o?.kind===`line`,l=r.length===4&&a?.kind===`line`&&o?.kind===`arc`&&s?.kind===`line`?o:void 0;if(!c&&!l)return;let[u,d]=l?[l.from,l.to]:[a.to,a.to],f=(e,n)=>{let r=ns(e,n);return r>t?{x:e.x+(n.x-e.x)*i.radius/r,y:e.y+(n.y-e.y)*i.radius/r}:void 0},p=f(i.from,d),m=f(i.to,u);if(!p||!m)return;let h={x:(p.x+m.x)/2,y:(p.y+m.y)/2};c&&ns(u,h)<=t&&(h=u);let g=h===u?0:(ns(u,h)+ns(d,h))/2,_=Yo(i,h);if(_===0)return;let v={center:h,inner:g,outer:(ns(i.from,h)+ns(i.to,h))/2,start:ts(i.from,h),sweep:_};return Jo(v,i,l,[u,d],t)?v:void 0}function Jo(e,t,n,[r,i],a){let{center:o,start:s,sweep:c}=e,l=(e,t)=>({x:o.x+e*Math.cos(t),y:o.y+e*Math.sin(t)});return e.outer>a&&e.outer-e.inner>a&&ns(t.from,l(e.outer,s))<=a&&ns(t.to,l(e.outer,s+c))<=a&&Zo(t,o,e.outer,a)&&ns(r,l(e.inner,s+c))<=a&&ns(i,l(e.inner,s))<=a&&(!n||Math.abs(Yo(n,o)+c)*e.inner<=a&&Zo(n,o,e.inner,a))}function Yo(e,t){let n=0;for(let r of e.arcs){let e=P(ts(j(r,1),t)-ts(j(r,0),t));n+=e+O*Math.round((r.sweep-e)/O)}return n}function Xo(e){let t=[e.from,...e.arcs.slice(0,-1).map(e=>j(e,1))];if(t.length<2)return;if(t.length===2)return{x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2};let[n,r,i]=[t[0],t[Math.floor(t.length/3)],t[Math.floor(2*t.length/3)]],a=2*(n.x*(r.y-i.y)+r.x*(i.y-n.y)+i.x*(n.y-r.y));if(!(Math.abs(a)>0))return;let[o,s,c]=[n,r,i].map(({x:e,y:t})=>e*e+t*t);return{x:(o*(r.y-i.y)+s*(i.y-n.y)+c*(n.y-r.y))/a,y:(o*(i.x-r.x)+s*(n.x-i.x)+c*(r.x-n.x))/a}}let Zo=(e,t,n,r)=>Math.abs(e.radius-n)<=r&&e.arcs.every(e=>[0,.5,1].every(i=>Math.abs(ns(j(e,i),t)-n)<=r));function Qo(e,t){let n=wo(t),r=q.apply(t,e.center),i=q.apply(t,{x:e.center.x+e.outer*Math.cos(e.start),y:e.center.y+e.outer*Math.sin(e.start)}),a=t[0]*t[3]-t[1]*t[2]<0?-e.sweep:e.sweep,o=((ts(i,r)+Math.PI/2)%O+O)%O;return o>O-1e-9&&(o=0),{cx:rs(r.x),cy:rs(r.y),inner:rs(e.inner*n),outer:rs(e.outer*n),start:o,end:o+a}}function $o(e,t){let n=[],r=(e,n)=>e!==void 0&&Math.sign(e.sweep)===Math.sign(n.sweep)&&Math.abs(e.radius-n.radius)<=t;for(let t of e){let e=n[n.length-1];t.kind===`line`?n.push({kind:`line`,from:t.from,to:t.to}):e?.kind===`arc`&&r(e,t)?n[n.length-1]={...e,arcs:[...e.arcs,t],to:j(t,1),sweep:e.sweep+t.sweep}:n.push({kind:`arc`,arcs:[t],from:j(t,0),to:j(t,1),radius:t.radius,sweep:t.sweep})}let[i]=n,a=n[n.length-1];return n.length>1&&i?.kind===`arc`&&a?.kind===`arc`&&a.arcs.every(e=>r(i,e))&&(n[0]={...i,arcs:[...a.arcs,...i.arcs],from:a.from,sweep:a.sweep+i.sweep},n.pop()),n}let es=({closed:e,start:t,end:n})=>e||t.x===n.x&&t.y===n.y,ts=(e,t)=>Math.atan2(e.y-t.y,e.x-t.x),ns=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),rs=e=>Math.round(e*1e3)/1e3+0;function is(e){if(typeof e==`string`){if(typeof document>`u`)throw TypeError(`expressive: a selector needs a document.`);return{elements:Array.from(document.querySelectorAll(e)),data:void 0}}if(cs(e))return{elements:[e],data:void 0};if(ls(e)){let t=Array.from(e.nodes()),n=Array.from(e.data());return{elements:t,data:n.length===t.length?n:void 0}}if(typeof e==`object`&&e&&typeof e.length==`number`)return{elements:Array.from(e),data:void 0};throw TypeError(`expressive needs marks: a selector, an element, a list of elements or a D3 selection.`)}function as(e){if(!ls(e))return;let{elements:t,data:n}=is(e);return n&&new Map(t.map((e,t)=>[e,n[t]]))}function os(e){let t;for(let n of e){if(!cs(n))throw TypeError(`expressive: marks must be elements, got ${String(n)}.`);let e=n.ownerSVGElement??null;if(!e){let e=n.localName;throw TypeError(e===`svg`?`expressive: got an <svg>, not its marks. Pass the marks, for example svg.querySelectorAll("rect").`:`expressive: marks must be SVG elements inside an <svg>, got <${e}>.`)}for(;e.ownerSVGElement;)e=e.ownerSVGElement;if(t&&e!==t)throw TypeError(`expressive: all marks must be in the same <svg>.`);t=e}if(!t)throw TypeError(`expressive: no marks.`);return t}function ss(e,t){let n=e[0].parentElement??t;for(;n!==t&&!e.every(e=>e!==n&&n.contains(e));)n=n.parentElement??t;return n}function cs(e){return typeof e==`object`&&!!e&&e.nodeType===1}function ls(e){return typeof e==`object`&&!!e&&typeof e.nodes==`function`&&typeof e.data==`function`}let us=[`d`,`x`,`y`,`width`,`height`,`cx`,`cy`,`r`,`rx`,`ry`,`x1`,`y1`,`x2`,`y2`,`points`,`transform`],ds=[`transform`,`style`];function fs(e,t,n){let r=e.defaultView?.MutationObserver??(typeof MutationObserver>`u`?void 0:MutationObserver);if(!r)throw TypeError(`expressive: watch needs MutationObserver, which this DOM doesn't have.`);let i=new Set,a=new Set,o=new Set,s=new Set,c,l=e=>{for(let{target:t,attributeName:n}of e){let e=t;o.has(e)&&i.add(e),s.has(e)&&(n===`transform`||n===`style`)&&a.add(e)}},u=new r(e=>{l(e),(i.size>0||a.size>0)&&!c&&(c=t.onFrame(d))});function d(){if(l(u.takeRecords()),i.size===0&&a.size===0){c?.(),c=void 0;return}let e={marks:i,ancestors:a};i=new Set,a=new Set,n(e)}function f(){u.takeRecords(),c?.(),c=void 0,i=new Set,a=new Set}return{observe(e,t){f(),u.disconnect(),o=new Set(e),s=new Set;for(let n of e)for(let e=n.parentElement;e&&!s.has(e);e=e===t?null:e.parentElement)s.add(e);for(let e of s)o.has(e)||u.observe(e,{attributes:!0,attributeFilter:ds});for(let e of o)u.observe(e,{attributes:!0,attributeFilter:us})},destroy(){f(),u.disconnect(),o=new Set,s=new Set}}}let ps=new Set([`circle`,`ellipse`,`line`,`path`,`polygon`,`polyline`]),ms=new Set([`img`,`image`,`graphics-symbol`,`graphics-object`]),hs=new WeakMap,gs=e=>e?hs.get(e):void 0;function _s(e,n,r){vs(n);let i=Pn(n.motion,r.motion),o=lt(n.on,r.presets),s=n.on,c=r.clock??a,l=n.dim===!0,u=vo(),d=new WeakMap,f=e,p=!1,m=!1;function h(e){let{elements:t,data:r}=is(e);if(t.length===0)return{root:void 0,ancestor:void 0,marks:[]};let i=os(t),a=ss(t,i),s=new Map;t.forEach((e,t)=>{let i=E(e,t,r),a=n.key(i,e);if(a==null||a===``)throw TypeError(`expressive: key returned ${JSON.stringify(a)??String(a)} for a <${e.localName}>. Every mark needs a key.`);let o=String(a),c=e.localName;if(!n.geometry&&c!==`rect`&&!ps.has(c))throw TypeError(`expressive: can't read the geometry of a <${c}> (mark "${o}"). <rect>, <circle>, <ellipse>, <line>, <path>, <polygon> and <polyline> are read; describe others with the geometry option.`);let l=D(i,e,o),u=s.get(o);if(!u)s.set(o,u=[]);else if(!n.geometry&&(ps.has(c)||ps.has(u[0].element.localName))){let e=ps.has(c)?c:u[0].element.localName;throw TypeError(`expressive: two elements have the key "${o}", and one is a <${e}>. A circle or a shape is a mark of its own: give each its own key.`)}else if(l===void 0)throw RangeError(`expressive: two elements have the key "${o}". Keys must be unique, or name each part with segment.`);else if(u.some(e=>e.series===l))throw RangeError(`expressive: the mark "${o}" has two "${l}" segments.`);u.push({element:e,datum:i,series:l,value:n.value?.(i,e)})});let c={svg:i,common:a,screen:yo(),colors:e=>k(e,i),stroke:e=>Bo(e,i)},l=e=>({...e,label:O(e.key,e.parts)}),u=[...s.keys()];if(n.geometry)return{root:i,ancestor:a,marks:T(w(Ts(u.map((e,t)=>l(g(e,s.get(e),t,c))),e=>e.geometry)),o)};let d=[],f=[];u.forEach((e,t)=>{let n=s.get(e);if(n[0].element.localName===`rect`&&!_(n,c))d.push(t);else{let r=b(e,n[0],t,c);r&&f.push(r)}});let p=d.map(e=>s.get(u[e]).map(t=>v(u[e],t,c))),m=p.map(e=>po(e.map(e=>e.rect.box))),h=lo(m,n.baseline??`auto`),x=e=>y(u[d[e]],p[e],h[e],d[e],c);return{root:i,ancestor:a,marks:T(w(f.length===0?fo(m,h).map(e=>l(x(e))):Ts([...d.map((e,t)=>x(t)),...f].sort((e,t)=>e.index-t.index),e=>e.geometry).map(e=>l(e))),o)}}function g(e,t,r,i){let a=t[0],o=n.geometry(a.element,a.datum,e);if(typeof o!=`object`||!o||o.key!==e)throw TypeError(`expressive: geometry for "${e}" must be a MarkGeometry with the key "${e}". Build it with describe and the key passed in.`);return{key:e,geometry:o,parts:t.map(e=>C(e,Ds(o,e.series,t.length),i)),index:r}}function _(e,t){return e.length===1&&!So(S(e[0].element,t))}function v(e,t,n){let r=S(t.element,n);if(!So(r))throw TypeError(`expressive: the <rect> of "${e}" is rotated or skewed, so it isn't an upright bar's segment. A rect turned on its own is a shape, a mark of its own: give each its own key, or describe the bar with the geometry option.`);return{...t,rect:{box:To(r,Eo(t.element)),series:t.series,radius:Os(t.element)}}}function y(e,t,n,r,i){let{geometry:a,order:o}=uo(e,t.map(e=>e.rect),n),s=a.segments??[];return{key:e,geometry:a,parts:o.map((e,n)=>{let r=s[n];return C(t[e],r&&r.length>=.5?{d:r.outline.d}:void 0,i)}),index:r,rect:{edge:n,box:po(t.map(e=>e.rect.box))}}}function b(e,t,n,r){let{element:i,series:a}=t,o=i.localName,s=S(i,r),c=Do(i),l=e=>{let t=Number.parseFloat(c(e)??``);return Number.isFinite(t)?t:0},u=o===`circle`?l(`r`):0,d,f;if(o===`circle`&&(Co(s)||!(u>0))){let t=q.apply(s,{x:l(`cx`),y:l(`cy`)});d=xe({key:e,series:a,x:ks(t.x),y:ks(t.y),r:ks(Math.max(0,u)*wo(s))})}else{let t=Pe(o,c);if(t[0]?.op!==`M`||t.every(e=>e.op===`M`))return;f=o===`circle`?void 0:r.stroke(i);let n=o===`path`?Go(t,s):void 0;if(n)d=pe({key:e,series:a,...n});else{let n=ks(x(f,s,r));d=Be({key:e,series:a,d:o===`path`?c(`d`)??``:ze(t),matrix:s,width:n>0?n:1})}}let p=[{...C(t,Ds(d,a,1),r),stroke:f}];return{key:e,geometry:d,parts:p,index:n,...o===`circle`?{circle:!0}:{}}}function x(e,t,n){let r=e?.width??1;if(!e?.screen)return r*wo(t);let i=n.screen(n.common),a=i?wo(i):0;return a>0?r/a:r}function S(e,t){return q.multiply(bo(t.common,e.parentElement??t.svg,t.svg,t.screen),xo(e))}function C(e,t,n){let r=bo(n.common,e.element.parentElement??n.svg,n.svg,n.screen);return{element:e.element,datum:e.datum,series:e.series,value:e.value,parent:r,parentInverse:As(r),colors:n.colors(e.element),outline:t}}function w(e){return e.map(e=>{let{key:t,geometry:r,parts:i}=e,a=e.rect?xs(i):void 0,o=i[0].value,s=e.circle&&typeof o==`number`&&Number.isFinite(o)?o:void 0,c=(e,i,o)=>n.samples?Cs(n.samples(e,i),o===void 0?`"${t}"`:`"${t}" (${o})`):a===void 0?s===void 0?[]:[{t:0,value:s}]:Ss(r,i,a),l=new Map,u=e=>l.get(e)??Ve(e,t);for(let t of bs(e)){let e=(i.find(e=>e.series===t)??i[0]).datum;l.set(t,{datum:e,samples:c(e,r.segments?.find(e=>e.series===t)??r,t),related:u})}return{...e,data:{datum:i[0].datum,samples:c(i[0].datum,r),related:u}}})}function T(e,t){if(e.length===0)return e;let n=new Set(e.flatMap(e=>[...e.geometry.series===void 0?[]:[e.geometry.series],...bs(e)]));for(let e of ct){let r=t[e];if(r?.kind===`data`)for(let t of r.needs?.related??[]){if(n.has(t))continue;let r=n.size>0?`the marks' series are ${[...n].map(e=>`"${e}"`).join(`, `)}`:`the marks have no series`;throw RangeError(`expressive: on.${e} needs the series "${t}", but ${r}. Name each mark's series in its geometry (describe.line({ key, series, … })), or a stack's parts with segment.`)}}return e}function E(e,t,r){if(n.datum)return n.datum(e);if(r)return r[t];let i=e.__data__;return typeof i==`number`&&!p&&(p=!0,console.warn(`expressive: element.__data__ is a number, which looks like Observable Plot's row index. Pass datum: (el) => rows[el.__data__].`)),i}function D(e,t,r){if(!n.segment)return;let i=n.segment(e,t);if(i==null||i===``)throw TypeError(`expressive: segment returned ${String(i)} for a part of "${r}".`);return String(i)}function O(e,r){if(n.markLabel)try{let t=String(n.markLabel(r[0].datum,{key:e,parts:r.map(({series:e,datum:t})=>({series:e,datum:t}))})??``);return t.trim()===``?void 0:t}catch(e){t(e);return}}function k(e,t){if((u.styled(e,`fill`)||u.styled(e,`stroke`))&&d.has(e))return d.get(e);let n=Mo(e,t);return d.set(e,n),n}let A=h(f),j=A.root?.ownerDocument??(typeof document>`u`?void 0:document);if(!j)throw TypeError(`expressive needs a DOM.`);bn(j);let M,N,P=new Map,F=[],I=new Map,ee=new Map,L=new Set,R={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set},z,B,V,te,H=!1,ne=(e,t,n)=>{let r=j.createElementNS(`http://www.w3.org/2000/svg`,e);return X(r,t),n?.appendChild(r),r},U=ne(`g`,{class:`ec-overlay`,"aria-hidden":`true`});At(U,{"pointer-events":`none`});let re=ne(`g`,{class:`ec-halos`},U),ie=ne(`g`,{class:`ec-runs`},U),ae=Ln(U),oe=e=>P.get(e)??I.get(e),se=It(ie),ce=Kn({overlay:ie,measure:se,mark:e=>({set:t=>oe(e)?.handle.set(t),reset:()=>oe(e)?.handle.reset()}),colors:(e,t)=>ys(oe(e)?.mark,t)?.colors}),le=Ct({effects:o,motion:i,icons:r.icons,clock:c,surface:ce}),W=e=>({mark:e.mark.geometry,data:e.mark.data});function ue(){se.clear();for(let e of F)le.change(e.mark.geometry,e.mark.data)}let de=()=>{},fe=Dr(j,ue);function me(e){let t={key:e.key,mark:e,handle:jo(()=>t.mark.parts.filter(e=>(ee.get(e.element)?.record??t)===t),u,()=>re)};return t}function he(e){e.root&&e.root!==M&&ye(e.root),N=e.ancestor??N;let t=new Set(e.marks.map(e=>e.key)),r={entering:[],exiting:[],changed:[],moved:[],newRow:!1},i=[];for(let e of F)t.has(e.key)||(P.delete(e.key),I.set(e.key,e),r.exiting.push(e));let a=ee;ee=new Map,F=e.marks.map(e=>{let t=P.get(e.key);if(t){let a=t.mark,o=n.value?Ms(a.parts,e.parts):Ns(a.geometry,e.geometry),s=a.data.datum!==e.data.datum;s&&(r.newRow=!0),o?r.changed.push({record:t,from:a.geometry}):(s||Fs(a.geometry,e.geometry)||Ps(a.data.samples,e.data.samples))&&r.moved.push(t),(a.parts.length!==e.parts.length||e.parts.some((e,t)=>e.colors?.color!==a.parts[t].colors?.color))&&i.push(e.key),t.mark=e}else t=I.get(e.key),t?(I.delete(e.key),t.mark=e):t=me(e),P.set(e.key,t),r.entering.push(t);for(let n of e.parts)ee.set(n.element,{record:t,part:n});return t});for(let[e,t]of a)ee.get(e)?.record!==t.record&&u.restore(e);for(let e of F)ge(e);_e(),ve(),Ee();for(let e of F)e.handle.repaint();for(let e of i)ce.recolor(e);return ke(),r}function ge(e){if(!n.markLabel)return;let{label:t,parts:r}=e.mark;r.forEach((e,n)=>{let r=t!==void 0&&n===0;u.attribute(e.element,`role`,r?`img`:null),u.attribute(e.element,`aria-label`,r?t:null),r?u.remove(e.element,`aria-hidden`):u.attribute(e.element,`aria-hidden`,t===void 0?null:`true`)})}function _e(){let e=M,t=new Set;for(let r of n.markLabel&&e?F:[])if(r.mark.label!==void 0)for(let n of r.mark.parts)for(let r=n.element.parentElement;r&&r!==e&&e?.contains(r);r=r.parentElement){if(t.has(r)||r.hasAttribute(`aria-label`)||r.hasAttribute(`aria-labelledby`))continue;let e=r.getAttribute(`role`)?.trim().split(/\s+/)[0];(e!==void 0&&ms.has(e)||e===void 0&&L.has(r))&&t.add(r)}for(let e of L)t.has(e)||(u.attribute(e,`role`,null),u.attribute(e,`aria-roledescription`,null));for(let e of t)u.remove(e,`role`),u.remove(e,`aria-roledescription`);L=t}function ve(){if(!M||!N)return;M.lastElementChild!==U&&M.appendChild(U),U.removeAttribute(`transform`);let e=bo(U,N,M);js(e)||U.setAttribute(`transform`,Mt(e))}function ye(e){be(),M=e,de=Or(M,c,ue),M.appendChild(U),(n.keyboard===!0||n.markLabel)&&M.getAttribute(`role`)===`img`&&!m&&(m=!0,console.warn(`expressive: the <svg> is role="img", so screen readers read it as one picture and skip the marks inside, with their names and keyboard focus. Make it role="group"; its aria-label can stay.`)),V=nr(M,{find(e){let t=Se(e);if(!t)return;let{key:n}=t.record;return t.part.series===void 0?{key:n}:{key:n,segment:t.part.series}},hover(e,t){let n=P.get(e.key);!n||En(z)&&z.keys[0]===e.key||(G(),Ce([n],t,e.segment))},leave(){(z?.source===`pointer`||z?.source===`touch`)&&G()}})}function be(){M&&(G(),V?.destroy(),V=void 0,de())}function Se(e){for(let t=e;t&&t!==M;t=t.parentElement){let e=ee.get(t);if(e)return e}}function Ce(e,t,n,r=!0){let i={keys:e.map(e=>e.key),source:t,effects:r};z=i,Ee(),r&&le.hover(e.map(W)),e.forEach((r,i)=>He(`hover`,{...W(r),batch:{index:i,count:e.length},source:t,...n===void 0?{}:{segment:n}})),t!==`linked`&&z===i&&te?.hover(e.map(W))}function G(){let e=z;e&&(z=void 0,Ee(),we(e.keys),En(e)&&te?.leave())}function we(e){let t=e.flatMap(e=>oe(e)??[]);le.leave(e),t.forEach((e,n)=>He(`leave`,{...W(e),batch:{index:n,count:t.length}}))}function Te(){if(z===void 0)return;let e=z.keys.filter(e=>P.has(e));if(e.length===z.keys.length)return;if(e.length===0){V?.clear(),G();return}let t=z.keys.filter(e=>!P.has(e));z={...z,keys:e},we(t)}function Ee(){if(!l)return;let e=`${i.duration(100,`feedback`)}ms`;U.classList.toggle(`ec-hovering`,z!==void 0),At(U,{"--ec-hover-duration":e});for(let t of F){let n=z?.keys.includes(t.key)===!0;for(let r of t.mark.parts)u.toggleClass(r.element,`ec-attached`,!0),u.toggleClass(r.element,`ec-dimmed`,z!==void 0&&!n),u.style(r.element,`--ec-hover-duration`,e);t.handle.hot(n),ce.hot(t.key,n)}for(let e of I.values())e.handle.hot(!1),ce.hot(e.key,!1)}let K=l?i.subscribe(Ee):void 0,De=e=>new Set(ct.flatMap(t=>{let n=e[t];return n?.kind===`data`?n.needs?.related??[]:[]})),Oe=De(o);function ke(){let e=B===void 0?void 0:P.get(B);ae.draw(e?.mark.geometry)}let Ae=n.keyboard===!0?rr(()=>M,{find:e=>Se(e)?.record.key,order:()=>F.map(e=>e.key),element:e=>P.get(e)?.mark.parts[0]?.element,tabIndex(e,t){let n=P.get(e);n&&t!==void 0&&n.mark.parts.forEach((e,n)=>{u.attribute(e.element,`tabindex`,n===0?t:`-1`),u.style(e.element,`outline`,`none`)})},focus(e,t){B=t?e:void 0,ke();let n=P.get(e);n&&(t?En(z)&&z.keys[0]===e?z={...z,source:`keyboard`}:(G(),Ce([n],`keyboard`)):z?.source===`keyboard`&&z.keys[0]!==e&&G())},blur(){B=void 0,ke(),z?.source===`keyboard`&&(V?.current===z.keys[0]?z={...z,source:`pointer`}:G())},escape(){return z?(z.source===`linked`&&te?te.dismiss():G(),!0):!1}}):void 0,je=n.watch===!0?fs(j,c,Ne):void 0;function Me(){je?.observe(F.flatMap(e=>e.mark.parts.map(e=>e.element)),M)}function Ne(e){if(H||!N)return;let t=new Set;for(let n of e.marks){let e=ee.get(n)?.record;e&&t.add(e)}let n=!1;for(let r of e.ancestors)if(r.contains(N))n=!0;else for(let e of F)e.mark.parts.some(e=>r.contains(e.element))&&t.add(e);let r=new Set;if(n){ve();for(let e of F)!t.has(e)&&e.mark.parts.some(e=>e.stroke?.screen)&&r.add(e)}if(t.size===0&&r.size===0)return;let i=Fe([...t,...r]),a=i.records.flatMap((e,t)=>r.has(e)&&!Fs(e.mark.geometry,i.marks[t].geometry)?[]:[t]);if(a.length===0)return;let o=a.map(e=>i.records[e]),s=a.map(e=>i.marks[e]);o.forEach((e,t)=>{let n=s[t];e.mark=n;for(let t of n.parts)ee.set(t.element,{record:e,part:t});e.handle.repaint()}),F=Re(F),o.some(e=>e.key===B)&&ke();let c=new Set(o);if(o.some(e=>Oe.has(e.mark.geometry.series??``)))for(let e of F)c.add(e);for(let e of c)le.change(e.mark.geometry,e.mark.data)}function Fe(e){let t={svg:M,common:N,screen:yo(),colors:e=>ee.get(e)?.part.colors,stroke:e=>ee.get(e)?.part.stroke},r=Le(),i=({parts:e})=>e.map(e=>({element:e.element,datum:r(e.element),series:e.series,value:e.value}));if(n.geometry){let n=e.map(({mark:e})=>({...g(e.key,i(e),e.index,t),label:e.label}));return{records:[...e],marks:w(n)}}let a=new Set(e.filter(e=>!e.mark.rect||_(e.mark.parts,t))),o=new Map(e.flatMap(e=>a.has(e)?[]:[[e,i(e.mark).map(n=>v(e.key,n,t))]])),s=Ie(o,a);for(let e of F)e.mark.rect&&!o.has(e)&&!a.has(e)&&s.get(e)!==e.mark.rect.edge&&o.set(e,i(e.mark).map(n=>v(e.key,n,t)));let c=[...o.keys()],l=c.map(e=>({...y(e.key,o.get(e),s.get(e),e.mark.index,t),label:e.mark.label}));for(let n of e){if(!a.has(n))continue;let e=b(n.key,i(n.mark)[0],n.mark.index,t);e&&(c.push(n),l.push({...e,label:n.mark.label}))}return{records:c,marks:w(l)}}function Ie(e,t){let r=F.filter(e=>e.mark.rect&&!t.has(e)),i=new Map(r.map(e=>[e,e.mark.rect.edge]));if(n.baseline!==void 0&&n.baseline!==`auto`)return i;let a=r.map(t=>{let n=e.get(t);return n?po(n.map(e=>e.rect.box)):t.mark.rect.box});try{let e=lo(a,`auto`);return new Map(r.map((t,n)=>[t,e[n]]))}catch{return i}}function Le(){if(n.datum)return n.datum;let e=as(f);return t=>e?.has(t)?e.get(t):E(t,0,void 0)}function Re(e){let t=[...e].sort((e,t)=>e.mark.index-t.mark.index);return n.geometry||!t.every(e=>e.mark.rect)?[...Ts(t,e=>e.mark.geometry)]:fo(t.map(e=>e.mark.rect.box),t.map(e=>e.mark.rect.edge)).map(e=>t[e])}function Ve(e,t){return F.find(n=>n.key!==t&&n.mark.geometry.series===e)?.mark.data}function He(e,n){for(let r of[...R[e]])try{r(n)}catch(e){t(e)}}function Ue(e,t){t.forEach((n,r)=>He(e,{...W(n),batch:{index:r,count:t.length}}))}le.enter(he(A).entering.map(W)),Ae?.sync(),Me();let We={targets:()=>F.map(e=>({key:e.key,marks:[W(e)]})),hover(e,t){G();let n=e.flatMap(e=>P.get(e)??[]);n.length>0&&Ce(n,`linked`,void 0,t)},unlink(){z?.source===`linked`&&G()},leave(){V?.clear(),G()},listen(e){return!H&&(te=e,!0)}};return hs.set(We,{root:()=>M,ancestor:()=>N,elements:()=>F.flatMap(e=>e.mark.parts.map(e=>e.element)),keyOf:e=>Se(e)?.record.key,colorOf:e=>P.get(e)?.mark.parts[0]?.colors?.color,moveTabStop:e=>Ae?.moveTabStop(e)??!1,edits:u}),An(We,{refresh(e){if(H)return;let t=h(e??f);e!==void 0&&(f=e),le.interrupt();let n=he(t);Me(),Te();let r=le.exit(n.exiting.map(W));Ue(`exit`,n.exiting),(n.newRow||n.changed.length>0||n.entering.length>0||n.exiting.length>0)&&le.update(n.changed.map(({record:e,from:t})=>({...W(e),from:t}))),n.changed.forEach(({record:e,from:t},r)=>He(`update`,{...W(e),from:t,batch:{index:r,count:n.changed.length}})),le.enter(n.entering.map(W)),Ue(`enter`,n.entering);let i=new Set([...n.changed.map(e=>e.record),...n.moved]);if([...i,...n.entering,...n.exiting].some(e=>Oe.has(e.mark.geometry.series??``))){let e=new Set(n.entering);for(let t of F)e.has(t)||i.add(t)}for(let e of i)le.change(e.mark.geometry,e.mark.data);le.settle(),Ae?.sync(),r.then(()=>{for(let e of n.exiting)I.get(e.key)===e&&I.delete(e.key)})},async update(e){if(H)return;if(typeof e!=`object`||!e)throw TypeError(`expressive: update() needs options, such as { on: { hover: "lift" } }.`);let t=Object.keys(e).find(e=>e!==`on`);if(t!==void 0)throw TypeError(`expressive: \`${t}\` can't be changed by update() yet. Only \`on\` can.`);if(!(`on`in e))return;let n=vr(o,s,e.on,r.presets);T(F.map(e=>e.mark),n),s=e.on,o=n,Oe=De(n),le.swap(n,F.map(W))},on(e,t){let n=R[e];if(!n)throw TypeError(`expressive: unknown event "${String(e)}". Use one of: ${Object.keys(R).join(`, `)}.`);return n.add(t),()=>{n.delete(t)}},marks:()=>F.map(e=>e.mark.geometry),focus(e){P.has(e)&&!H&&Ae?.focus(e)},leave(){H||We.leave()},destroy(){if(!H){H=!0,z=void 0,te?.gone(),te=void 0,je?.destroy(),le.destroy(),K?.(),fe(),Ae?.destroy(),be(),U.remove(),u.restoreAll();for(let e of Object.values(R))e.clear();P.clear(),I.clear(),F=[],ee=new Map}}})}function vs(e){if(typeof e!=`object`||!e)throw TypeError(`expressive needs options, with at least a key: { key: (d) => d.name }.`);if(typeof e.key!=`function`)throw TypeError(`expressive needs a key function, for example key: (d) => d.name. Marks are matched by key.`);for(let t of[`datum`,`segment`,`value`,`geometry`,`markLabel`])if(e[t]!==void 0&&typeof e[t]!=`function`)throw TypeError(`expressive: ${t} must be a function.`);if(e.baseline!==void 0&&e.baseline!==`auto`&&!co(e.baseline))throw RangeError(`expressive: baseline must be "left", "right", "top", "bottom" or "auto", got ${String(e.baseline)}.`)}function ys(e,t){if(t===void 0)return e?.parts[0];let n=e?.geometry.segments?.find(e=>e.key===t);return n&&e.parts.find(e=>e.series===n.series)}function bs(e){let t=[...(e.geometry.segments??[]).map(e=>e.series),...e.parts.map(e=>e.series)];return[...new Set(t.filter(e=>e!==void 0))]}function xs(e){let t=0;for(let{value:n}of e){if(typeof n!=`number`||!Number.isFinite(n))return;t+=n}return t}function Ss(e,t,n){let r=t=>e.length>0?n*t/e.length:0;if(t===e)return[{t:0,value:0},{t:1,value:n}];let i=Es(e.start,t.start);return[{t:0,value:r(i)},{t:1,value:r(i+t.length)}]}function Cs(e,t){if(!Array.isArray(e))throw TypeError(`expressive: samples for ${t} must return an array of { t, value }, got ${ws(e)}.`);let n=0;return e.map((e,r)=>{let{t:i,value:a,at:o,gapBefore:s}=typeof e==`object`&&e?e:{};if(typeof i!=`number`||!(i>=0&&i<=1))throw RangeError(`expressive: samples for ${t}: samples[${r}].t must be in [0, 1], got ${ws(i)}.`);if(i<n)throw RangeError(`expressive: samples for ${t} must be in t order: samples[${r}].t is ${i}, after ${n}.`);if(typeof a!=`number`||!Number.isFinite(a))throw RangeError(`expressive: samples for ${t}: samples[${r}].value must be a finite number, got ${ws(a)}.`);if(s!==void 0&&typeof s!=`boolean`)throw RangeError(`expressive: samples for ${t}: samples[${r}].gapBefore must be true or false, got ${ws(s)}.`);return n=i,{t:i,value:a,...o===void 0?{}:{at:o},...s?{gapBefore:s}:{}}})}function ws(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Ts(e,t){let n=e[0]&&t(e[0]).pivot;if(!n||!e.every(e=>Es(t(e).pivot,n)<=.5&&io(t(e))))return e;let r=2*Math.PI,i=e=>{let{center:i}=t(e),a=Math.atan2(i.x-n.x,n.y-i.y),o=a<0?a+r:a;return o>=r?0:o};return e.map(e=>({mark:e,angle:i(e)})).sort((e,t)=>e.angle-t.angle).map(({mark:e})=>e)}function Es(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Ds(e,t,n){let r=t===void 0?void 0:e.segments?.find(e=>e.series===t),i=r??(n===1?e:void 0);if(!(!i||r&&r.length<.5))return i.outline.closed?{d:i.outline.d}:{d:i.outline.d,stroke:i.thickness}}function Os(e){let t=Number.parseFloat(e.getAttribute(`rx`)??``),n=Number.parseFloat(e.getAttribute(`ry`)??``),r=Number.isFinite(t)?t:n;return Number.isFinite(r)&&r>0?r:0}function ks(e){return Math.round(e*1e3)/1e3}function As(e){try{return $e(e)}catch{return}}function js(e){return Math.abs(e[0]-1)<1e-9&&Math.abs(e[1])<1e-9&&Math.abs(e[2])<1e-9&&Math.abs(e[3]-1)<1e-9&&Math.abs(e[4])<1e-6&&Math.abs(e[5])<1e-6}function Ms(e,t){if(e.length!==t.length)return!0;let n=new Map(e.map(e=>[e.series,e.value]));return t.some(e=>{let t=n.get(e.series);return!n.has(e.series)||!(t===e.value||Object.is(t,e.value))})}function Ns(e,t){let n=e.segments??[],r=t.segments??[];return Math.abs(e.length-t.length)>.01||n.length!==r.length||n.some((e,t)=>e.key!==r[t].key||Math.abs(e.length-r[t].length)>.01)}function Ps(e,t){let n=(e,t)=>e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime();return e.length!==t.length||e.some((e,r)=>e.t!==t[r].t||e.value!==t[r].value||!n(e.at,t[r].at))}function Fs(e,t){if(e.outline.d!==t.outline.d||e.thickness!==t.thickness||wr(e,t))return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((e,t)=>e.key!==r[t].key||e.outline.d!==r[t].outline.d)}let Is=[`font-family`,`font-size`,`font-style`,`font-weight`,`font-variant-numeric`,`letter-spacing`,`word-spacing`,`dominant-baseline`,`fill`],Ls=new Set([`font-size`,`letter-spacing`,`word-spacing`]);function Rs(e,t){let n=e[t]?.baseVal;return n&&n.numberOfItems>0?n.getItem(0).value:Number.parseFloat(e.getAttribute(t)??``)||0}function zs(e,t){return t===1?e:e.replace(/(-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(px)?(?![\w.%])/gi,(e,n,r)=>`${Math.round(Number(n)*t*1e3)/1e3}${r??``}`)}function Bs(e,n={}){let r=typeof e==`object`&&e?jn(e):void 0,i=gs(r);if(!r||!i?.root())throw TypeError(`hostView needs an attachment that expressive() or fromVegaView() returned, with marks in an <svg>.`);if(typeof n!=`object`||!n||n.labels!==void 0&&typeof n.labels!=`function`)throw TypeError(`hostView: labels must be a function that returns the host's labels, such as () => names.map((element) => ({ element, key: element.textContent, role: "category" })).`);let{edits:a}=i,o=()=>i.root(),s,c=[];function l(){if(!n.labels)return[];let r=new Set(e.marks().map(e=>e.key));try{return Array.from(n.labels()).filter(e=>e?.element?.localName===`text`&&o().contains(e.element)&&r.has(e.key)&&(e.role===`category`||e.role===`value`))}catch(e){return t(e),[]}}function u({element:e,key:t,role:n}){let r=o(),i=bo(d.space,e,r),a=q.apply(i,{x:Rs(e,`x`),y:Rs(e,`y`)}),s=wo(i),c=e.ownerDocument.createElementNS(kt,`text`);c.textContent=e.textContent;for(let t of[`dx`,`dy`]){let n=e.getAttribute(t);n!==null&&c.setAttribute(t,zs(n,s))}At(c,Object.fromEntries(Is.map(t=>{let n=Po(e,r,t);return[t,(Ls.has(t)?zs(n,s):n)||void 0]})));let l=Po(e,r,`text-anchor`);return{key:t,role:n,text:e.textContent??``,x:a.x,y:a.y,anchor:l===`middle`||l===`end`?l:`start`,element:c}}let d={get element(){return o()},get space(){return i.ancestor()??o()},refresh:t=>e.refresh(t),update:t=>e.update(t),on:(t,n)=>e.on(t,n),marks:()=>e.marks(),focus:t=>e.focus(t),leave:()=>e.leave(),destroy(){s=void 0,c=[],e.destroy()},labels:()=>(s??l()).map(u),paintOf(e){let t=i.colorOf(e);return t===void 0?void 0:{color:e,drawn:!0,cssColor:t}},keyOf:e=>i.keyOf(e),moveTabStop:e=>i.moveTabStop(e),morphing(e){for(let e of c)a.style(e,`visibility`,void 0);s=e?l():void 0,c=s?[...i.elements(),...s.map(e=>e.element)]:[];for(let e of c)a.style(e,`visibility`,`hidden`);a.toggleClass(o(),`ec-morphing`,e)}};return An(r,d)}let Vs=[`line`,`rect`,`arc`,`symbol`],Hs=[`d`,`transform`,`x`,`y`,`width`,`height`,`stroke-width`];function Us(e,n,r){if(Ws(e),typeof n!=`object`||!n||typeof n.key!=`function`)throw TypeError(`fromVegaView needs options with a key: { key: (d) => d.series }. Marks are matched by key.`);let i=n.mark??`marks`;if(typeof i!=`string`||i===``)throw TypeError(`fromVegaView: mark must be a mark's name, got ${String(i)}.`);if(n.sample!==void 0&&typeof n.sample!=`function`)throw TypeError(`fromVegaView: sample must be a function.`);let o=_(),{mark:s,sample:c,...l}=n,u=_s(o.elements,{...l,datum:e=>g(e).datum,geometry:(e,t,n)=>{let r=o.geometry.get(n);if(!r)throw TypeError(`fromVegaView: no geometry for "${n}". Its key must be the same for every item of a mark.`);return r},...n.samples||!n.sample?{}:{samples:(e,t)=>o.samples.get(t)??[]},...n.value||!n.sample?{}:{value:(e,t)=>o.values.get(t)}},r),d=r.clock??a,f,p,m=!1,h=typeof MutationObserver==`function`?new MutationObserver(e=>e.some(S)&&C()):void 0;w(o.root);function g(e){let t=o.items.get(e);if(!t)throw TypeError(`fromVegaView: an element that isn't one of the View's items.`);return t}function _(){let t=Ks(Gs(e),i),r=qs(t,i,e),a=e.container(),o=a?.localName===`svg`?a:a?.querySelector(`svg`),s={root:o??void 0,elements:[],items:new Map,geometry:new Map,samples:new Map,values:new Map};if(!r||!o)return s;let c=new Set(r===`line`?t.flatMap(e=>e.items?.[0]&&Xs(e.items[0])?[e.items[0]]:[]):t.flatMap(e=>e.items??[])),l=new Map;for(let e of Array.from(o.querySelectorAll(`*`))){let t=e.__data__;c.has(t)&&l.set(e,t)}let u=[...l.keys()];if(u.length===0)return s;let d=os(u),f=ss(u,d),p=yo(),m=e=>bo(f,e.parentElement??d,d,p),h=e=>String(n.key(l.get(e).datum,e)),g=e=>n.segment?String(n.segment(l.get(e).datum,e)):void 0,_={root:d,items:l,elements:u,geometry:new Map,samples:new Map,values:new Map};if(n.sample)for(let[e,t]of l){let n=r===`line`?Ys(t):[t];_.values.set(e,n.map(e=>e.defined===!1?``:y(e).value).join(`,`))}if(r===`rect`)return v(_,m,h,g);for(let e of u){let t=l.get(e),i=h(e);if(_.geometry.has(i))continue;let a=m(e),o=r===`line`?$s(i,e,t,a):r===`arc`?ec(i,t,a):tc(i,t,a);_.geometry.set(i,o),n.sample&&_.samples.set(o,r===`line`?b(o,t,a):x(o,t,r))}return _}function v(e,t,r,i){let a=new Map;for(let n of e.elements){let o=e.items.get(n),s=r(n),c={box:To(t(n),nc(o)),series:i(n),radius:Math.max(0,o.cornerRadius??0)},l=a.get(s);l?l.push({element:n,part:c}):a.set(s,[{element:n,part:c}])}let o=[...a.keys()],s=o.map(e=>po(a.get(e).map(e=>e.part.box))),c=lo(s,n.baseline??`auto`),l=[];for(let t of fo(s,c)){let r=o[t],i=a.get(r),{geometry:s,order:u}=uo(r,i.map(e=>e.part),c[t]);if(e.geometry.set(r,s),l.push(...u.map(e=>i[e].element)),n.sample){let t=u.map(t=>y(e.items.get(i[t].element)).value),n=t.reduce((e,t)=>e+t,0);e.samples.set(s,[{t:0,value:0},{t:1,value:n}]);let r=0;(s.segments??[]).forEach((n,i)=>{let a=r;r+=t[i]??0,e.samples.set(n,[{t:0,value:a},{t:1,value:r}])})}}return{...e,elements:l}}function y(e){let t=n.sample(e.datum),r=typeof t==`number`?{value:t}:t;if(typeof r!=`object`||!r||!Number.isFinite(r.value))throw RangeError(`fromVegaView: sample must give a finite number, or { value, at }, got ${JSON.stringify(t)}.`);return r.at===void 0?{value:r.value}:{value:r.value,at:r.at}}function b(e,t,n){return rt(e,Qs(t).map(({item:e,point:t})=>({...q.apply(n,t),...y(e)})))}function x(e,t,n){let{value:r,at:i}=y(t),a=i===void 0?{t:1,value:r}:{t:1,value:r,at:i};return n===`symbol`?[{...a,t:0}]:e.length>0?[{t:0,value:0},a]:[{...a,t:0}]}function S(e){let t=f?.querySelector(`:scope > .ec-overlay`),n=e=>e===t||(t?.contains(e)??!1);return n(e.target)?!1:e.type!==`childList`||[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].some(e=>!n(e))}function C(){if(p||m)return;let e=d.onFrame(()=>{e(),p=void 0;try{T()}catch(e){t(e)}});p=e}function w(e){h&&e!==f&&(h.disconnect(),f=e,e&&h.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:Hs}))}function T(){if(m)return;let e=_(),t=o;o=e;try{u.refresh(e.elements)}catch(e){throw o=t,e}w(e.root)}return An(jn(u),{refresh:T,update:u.update,on:u.on,marks:u.marks,focus:u.focus,leave:u.leave,destroy(){m||(m=!0,h?.disconnect(),p?.(),p=void 0,u.destroy())}})}function Ws(e){if(typeof e!=`object`||!e||typeof e.renderer!=`function`||typeof e.scenegraph!=`function`||typeof e.container!=`function`)throw TypeError(`fromVegaView needs a Vega View: new vega.View(runtime, { renderer: "svg", container }), or vega-embed's result.view.`);let t=e.renderer();if(t!==`svg`)throw TypeError(`fromVegaView: the View renders with "${t}", which draws no SVG elements to attach to. Use renderer: "svg" (vega-embed's default; a bare vega.View uses canvas).`)}function Gs(e){let t=e.scenegraph();return t.root??t}function Ks(e,t){let n=[],r=e=>{if(e.name===t&&e.marktype!==`group`&&n.push(e),e.marktype===`group`)for(let t of e.items??[])for(let e of t.items??[])r(e)};return r(e),n}function qs(e,t,n){if(e.length===0){let e=Js(Gs(n));if(e.length===0)return;throw RangeError(`fromVegaView: the View has no mark named "${t}". Its named marks: ${e.map(e=>`"${e}"`).join(`, `)}.`)}let r=e[0].marktype;if(!e.every(e=>e.marktype===r)||!Vs.includes(r))throw TypeError(`fromVegaView: "${t}" is a ${String(r)} mark. Rects, arcs, symbols and lines can be read; describe others with expressive()'s geometry option.`);return r}function Js(e){let t=new Set,n=e=>{e.name&&e.marktype!==`group`&&t.add(e.name);for(let t of e.items??[])for(let e of t.items??[])n(e)};return n(e),[...t]}let Ys=e=>e.mark?.items??[e],Xs=e=>Ys(e).some(e=>e.defined!==!1),Zs=e=>{let t=Ys(e)[0]?.interpolate;return t===void 0||t===`linear`};function Qs(e){let t=Ys(e),n=[],r=!1;for(let e of t)e.defined===!1?r=n.length>0:(n.push({item:e,point:{x:ic(e.x),y:ic(e.y)},gapBefore:r}),r=!1);return n}function $s(e,t,n,r){let i=n.strokeWidth??Number.parseFloat(t.getAttribute(`stroke-width`)??`1`);if(!Zs(n)){let n=i*rc(r);return Be({key:e,series:e,d:t.getAttribute(`d`)??``,matrix:r,width:n>0&&Number.isFinite(n)?n:1})}let a=Qs(n),o=a.flatMap((e,t)=>e.gapBefore?[t]:[]);return _e({key:e,series:e,points:a.map(({point:e})=>q.apply(r,e)),...o.length>0?{breaks:o}:{},width:(Number.isFinite(i)?i:1)*rc(r)})}function ec(e,t,n){let r=q.apply(n,{x:ic(t.x),y:ic(t.y)}),i=rc(n),[a,o]=[ic(t.startAngle),ic(t.endAngle)].sort((e,t)=>e-t);return pe({key:e,cx:r.x,cy:r.y,inner:ic(t.innerRadius)*i,outer:ic(t.outerRadius)*i,start:a,end:o})}function tc(e,t,n){let r=q.apply(n,{x:ic(t.x),y:ic(t.y)});return xe({key:e,x:r.x,y:r.y,r:Math.sqrt(Math.max(0,t.size??64)/Math.PI)*rc(n)})}function nc(e){let t=ic(e.x),n=ic(e.y),r=ic(e.width),i=ic(e.height);return{x:Math.min(t,t+r),y:Math.min(n,n+i),width:Math.abs(r),height:Math.abs(i)}}function rc(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))}function ic(e){return typeof e==`number`&&Number.isFinite(e)?e:0}let ac={get:()=>void 0},oc={set(){},reset(){}},sc={place(){},update(){},remove(){}};function cc(e,n){let{effect:r,surface:i}=n;if(!lc(r))throw TypeError(`playTransition needs a transition effect (kind "transition" with run, end and clear), got ${uc(r)}.`);let o=n.start??0;if(!(typeof o==`number`&&o>=0&&o<=1))throw RangeError(`playTransition: start must be a number from 0 to 1, got ${String(o)}.`);let s=n.motion??v,c=n.clock??a,l=n.icons??ac,u=e.length,d=[],f=!1,p=u,m,h=new Promise(e=>{m=e}),g=u>0?s.subscribe(()=>{s.mode===`off`&&w()}):void 0,_=()=>{--p>0||(g?.(),g=void 0,m())};function y(e,t,n){let i=vt({clock:c,motion:s,icons:l,batch:{index:t,count:u},layer:T(e.to.key,t,()=>a.state!==`cleared`),mark:oc}),a={pair:e,index:t,scope:i,context:{...i.context,start:o},state:`running`,done:n};d[t]=a;let{from:f,to:p}=e;try{s.mode===`off`?(r.end(f,p,a.context),b(a)):Promise.resolve(r.run(f,p,a.context)).then(()=>b(a),e=>x(a,e))}catch(e){x(a,e)}}function b(e){e.state===`running`&&(e.state=`ended`,S(e))}function x(e,n){let{signal:r}=e.context;(!r.aborted||n!==r.reason&&n?.name!==`AbortError`)&&(t(n),C(e))}function S(e){let t=e.done;e.done=void 0,t?.()}function C(e){if(e.state!==`cleared`){e.state=`cleared`,e.scope.abort();try{r.clear(e.context)}catch(e){t(e)}e.scope.clear(),S(e)}}function w(){for(let e of[...d]){if(e.state!==`running`)continue;let t=e.done;e.done=void 0,C(e),y(e.pair,e.index,t)}}function T(e,t,n){let r,a=()=>n()?r??(r=i.group(e,t)):void 0;return{icon:(e,t)=>a()?.icon(e,t)??sc,path:(e,t)=>a()?.path(e,t)??sc,text:(e,t)=>a()?.text(e,t)??sc,clear(){let e=r;r=void 0,e?.clear()}}}return e.forEach((e,t)=>y(e,t,_)),u===0&&m(),{finished:h,clear(){if(!f){f=!0;for(let e of[...d])C(e)}}}}function lc(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.kind===`transition`&&typeof t.run==`function`&&typeof t.end==`function`&&typeof t.clear==`function`}function uc(e){if(typeof e!=`object`||!e)return e===null?`null`:typeof e;let t=e.kind;return t===`geometry`||t===`data`?`a ${t} effect, which plays on one mark: put it in a chart's \`on\` option`:t===`transition`?`a transition effect without run(), end() and clear()`:t===void 0?`an object with no kind`:`an effect of kind ${JSON.stringify(t)}`}let dc=.5;function fc(e,t,n){let r=mr(e,`chartSwitch`),i=Pc(t),o=t.transition,s=Sn(t.colors),c=n.motion,l=n.clock??a,u=r.ownerDocument;bn(u);let d=u.createElement(`div`);d.className=`ec-switch`,r.appendChild(d);let f=new Map;try{for(let e of i){let n=u.createElement(`div`);n.className=`ec-switch-view`,n.setAttribute(`data-view`,e),d.appendChild(n),hc(n,e===t.initial);let r=t.views[e](n,s);if(!Nc(r,n))throw r?.destroy?.(),TypeError(`chartSwitch: views.${e} must return the chart it draws in the container it's given (with element, marks(), labels(), focus(), leave() and destroy()), such as donutChart(container, { ... }).`);f.set(e,{name:e,container:n,chart:r,port:jn(r)})}}catch(e){for(let e of f.values())e.chart.destroy();throw d.remove(),e}let p=Y(`svg`,{class:`ec-chart ec-switch-overlay`,"aria-hidden":`true`},d),m=Y(`g`,{class:`ec-switch-fades`},p),h=Y(`g`,{class:`ec-switch-runs`},p),g=Y(`g`,{class:`ec-switch-labels`},p),_=t.announce?Ot(p):void 0,v=e=>hn(e.cssColor===void 0?pn(s.slot(e.color)):No(e.cssColor)),y=new WeakMap,b=(e,t)=>({group(n,r){let i=Y(`g`,{class:`ec-run`,"data-key":n},h);At(i,v(e[r]??{color:n})),y.set(i,r);let a=Array.from(h.children).find(e=>(y.get(e)??-1/0)>r);h.insertBefore(i,a??null);let o=Hn(i);return{...t[r]?.wrap(o,i)??o,clear:()=>i.remove()}}});function x(e,t,n){let[r,i]=e,[a,o]=t;if(r===0&&i===0&&!a&&!o)return;let s=[];if(a&&o){let e=ne();s.push({element:e,draw:t=>Oc(e,{at:{x:Cc(a.at.x,o.at.x,t),y:Cc(a.at.y,o.at.y,t)},r:Cc(a.r,o.r,t),ring:Cc(a.ring,o.ring,t)})})}else[[a,bc,n[0]],[o,xc,n[1]]].forEach(([e,t,n])=>{if(!e)return;let r=ne();At(r,v(n)),Oc(r,e),s.push({element:r,draw:e=>X(r,{opacity:t(e)})})});let c=r>0||i>0,l=r,u=new Map;return{wrap(e,t){u.clear();let n=()=>{for(let e of s)t.appendChild(e.element)};return n(),{...e,path(t,r){let i=c&&r.fill!==void 0&&r.stroke===void 0,a=e.path(t,i?{...r,stroke:`surface`,width:l}:r);return n(),i?(u.set(a,t),{update(e,t){u.set(a,e),a.update(e,t)},remove(){u.delete(a),a.remove()}}):a}}},draw(e){l=Cc(r,i,e);for(let[e,t]of u)e.update(t,{width:l});for(let t of s)t.draw(e)}}}let S=t.initial,C,w=!1,T,E,D=!1,O,k=c.subscribe(()=>{c.mode===`off`&&C&&V(C,!0)}),A,j=typeof ResizeObserver==`function`?new ResizeObserver(e=>{let t=e[e.length-1]?.contentRect.width??0;if(A!==void 0&&Math.abs(t-A)<.5)return;let n=A===void 0;A=t,!n&&C&&V(C,!0)}):void 0;j?.observe(d);let M=e=>f.get(e);function N(){return d.getRootNode().activeElement??null}function P(e){let t=N(),n=t!==null&&e.container.contains(t),r=n?t:e.chart.element.querySelector(`[tabindex="0"]`),i=r?.closest(`[data-key]`),a=(r&&e.chart.keyOf?.(r))??(i&&e.chart.element.contains(i)?i.getAttribute(`data-key`):null);if(n||a!==null)return{keys:a===null?[]:e.chart.standsFor?.(a)??[a],focused:n}}function F(e,t){if(!t)return;let n=N(),r=n!==null&&n!==u.body&&n!==u.documentElement&&!d.contains(n);if(!t.focused||r){for(let n of t.keys)if(e.chart.moveTabStop?.(n))return;return}let i=()=>e.chart.element.contains(N());for(let n of[...t.keys,...e.chart.marks().map(e=>e.key)])if(e.chart.focus(n),i())return}function I(e){_?.say(e.chart.element.getAttribute(`aria-label`)??``)}function ee(){D&&T?.shown()}function L(e,t,n){let r=n?n.focus:P(e),i=[];O=i;try{e.chart.leave()}finally{O=void 0}let a=w?Promise.resolve():R(e,t,r);for(let e of i)e();return a}function R(e,t,n){if(S=t.name,c.mode===`off`){for(let e of f.values())hc(e.container,e===t);return F(t,n),I(t),ee(),Promise.resolve()}for(let n of[e,t])n.container.classList.remove(`ec-switch-inactive`),n.container.classList.add(`ec-switching`),n.container.setAttribute(`inert`,``),n.chart.morphing?.(!0),n.chart.element.classList.add(`ec-morphing`);let{pairs:r,surface:i,scene:a}=te(e,t),{done:o,settle:s}=Mc(),l={a:e,b:t,forward:!0,pairs:r,reversed:r.map(({from:e,to:t})=>({from:t,to:e})),surface:i,scene:a,focus:n,progress:0,transition:void 0,driver:void 0,run:0,done:o,settle:s};return C=l,z(l,0),l.done}function z(e,t){let r=++e.run;if(t>=1){V(e,!0);return}let i=t=>{e.progress=t,e.scene.draw(e.forward?t:1-t)},a=mc(l);e.transition=cc(e.forward?e.pairs:e.reversed,{effect:o,surface:e.surface,start:t,motion:c,clock:a.clock,icons:n.icons}),e.driver=pc(t,i,{clock:a.clock,motion:c}),a.release(),Promise.all([e.driver.finished,e.transition.finished]).then(([t])=>{C===e&&e.run===r&&t===`done`&&V(e,!0)})}function B(e){return e.driver?.cancel(),e.transition?.clear(),e.forward=!e.forward,S=(e.forward?e.b:e.a).name,e.settle(),{done:e.done,settle:e.settle}=Mc(),z(e,1-e.progress),e.done}function V(e,t){if(C!==e)return;C=void 0,e.run++,e.driver?.cancel(),e.transition?.clear(),e.scene.clear();let n=e.forward?e.b:e.a;for(let t of[e.a,e.b])t.chart.element.classList.remove(`ec-morphing`),t.chart.morphing?.(!1),t.container.classList.remove(`ec-switching`),t.container.style.removeProperty(`opacity`);for(let e of f.values())hc(e.container,e===n);t&&(F(n,e.focus),I(n),ee()),e.settle()}function te(e,t){let n=bo(p,e.chart.space??e.chart.element,d),r=bo(p,t.chart.space??t.chart.element,d),i=Ac(n),a=Ac(r),o=e.chart.marks().map(e=>jc(e,n)),s=t.chart.marks().map(e=>jc(e,r)),c=new Map(o.map(e=>[e.key,e])),l=new Set(s.map(e=>e.key)),u=[],f=[],_=[];for(let n of s){let r=c.get(n.key);if(!r)continue;let o=wc(e,r),s=wc(t,n);(o.drawn||s.drawn)&&(u.push({from:o.drawn?r:Tc(r),to:s.drawn?n:Tc(n)}),f.push(s),_.push(x([Ec(o,i),Ec(s,a)],[Dc(o,r,i),Dc(s,n,a)],[o,s])))}let v=[];_.some(e=>e!==void 0)&&v.push(e=>{for(let t of _)t?.draw(e)});let y=(e,t,n,r)=>{let i=wc(e,t);i.drawn&&v.push(H(t,i,n,r))};for(let t of o)l.has(t.key)||y(e,t,i,bc);for(let e of s)c.has(e.key)||y(t,e,a,xc);let S=e=>`${e.role}\n${e.key}`,C=e.chart.labels(),w=t.chart.labels(),T=e.chart.space?i:1,E=t.chart.space?a:1,D=new Map(C.map(e=>[S(e),e])),O=new Set;for(let e of w){let t=D.get(S(e));t&&(O.add(S(e)),v.push(_c(U(t,n,T),U(e,r,E))))}for(let e of C)O.has(S(e))||v.push(yc(U(e,n,T),bc));for(let e of w)D.has(S(e))||v.push(yc(U(e,r,E),xc));return v.push(n=>{gc(e.container,1-Sc(n/.4)),gc(t.container,Sc((n-dc)/.5))}),{pairs:u,surface:b(f,_),scene:{draw:e=>{for(let t of v)t(e)},clear:()=>{m.replaceChildren(),h.replaceChildren(),g.replaceChildren()}}}}function H(e,t,n,r){let i=Y(`g`,{class:`ec-switch-fade`,"data-key":e.key},m);At(i,v(t));let a=Ec(t,n);Hn(i).path(e.outline.d,e.outline.closed?{fill:`mark`,...a>0?{stroke:`surface`,width:a}:{}}:{stroke:`mark`,width:e.thickness});let o=Dc(t,e,n);return o&&Oc(i.appendChild(ne()),o),e=>X(i,{opacity:r(e)})}function ne(){let e=u.createElementNS(kt,`circle`);return e.setAttribute(`class`,`ec-switch-end`),At(e,{fill:mn(`mark`),stroke:mn(`surface`)}),e}function U(e,t,n){let r=e.element.cloneNode(!0);for(let e of[`id`,`opacity`,`visibility`,`aria-hidden`])r.removeAttribute(e);r.textContent=e.text;let i={text:r,at:q.apply(t,e),scale:n};return X(r,{x:i.at.x,y:i.at.y,"text-anchor":e.anchor,...vc(i,i.at.x,i.at.y)}),g.appendChild(r),i}let re={get current(){return S},show(e){if(!f.has(e))return Promise.reject(TypeError(`chartSwitch: there's no view ${JSON.stringify(e)}. The views are ${i.map(e=>JSON.stringify(e)).join(`, `)}.`));if(w)return Promise.resolve();let t=O;if(t)return new Promise(n=>t.push(()=>n(re.show(e))));let n=C;if(!n)return e===S?Promise.resolve():L(M(S),M(e));let r=n.forward?n.b:n.a,a=n.forward?n.a:n.b;return e===r.name?n.done:e===a.name?B(n):(V(n,!1),L(r,M(e),{focus:n.focus}))},chart(e){let t=f.get(e);if(!t)throw TypeError(`chartSwitch: there's no view ${JSON.stringify(e)}. The views are ${i.map(e=>JSON.stringify(e)).join(`, `)}.`);return t.chart},on(e,t){let n=Array.from(f.values(),n=>{let r=n.chart.on;if(typeof r==`function`)return r.call(n.chart,e,e=>{n.name===S&&t(e)})});return()=>{for(let e of n)e?.()}},marks:()=>M(S).chart.marks(),leave(){D=!1,w||M(S).chart.leave()},destroy(){if(w)return;w=!0;let e=C;if(e){C=void 0,e.run++,e.driver?.cancel(),e.transition?.clear(),e.scene.clear();for(let t of[e.a,e.b])t.chart.morphing?.(!1);e.settle()}k(),j?.disconnect(),_?.destroy();let t=T;T=void 0,t?.gone();for(let e of f.values())e.chart.destroy();d.remove()}},ie=e=>C===void 0&&e.name===S;function ae(e){let t=()=>{E===e&&(E=void 0,T?.leave())};return{hover(t){ie(e)&&(E=e,T?.hover(t))},leave:t,dismiss(){ie(e)&&T?.dismiss()},shown(){},gone:t}}return An({targets:()=>C===void 0?M(S).port?.targets()??[]:[],hover(e,t){D=!0,C===void 0&&M(S).port?.hover(e,t)},unlink(){D=!1;for(let e of f.values())e.port?.unlink()},leave:()=>re.leave(),listen(e){if(w)return!1;T=e,E=void 0,D=!1;for(let t of f.values())t.port?.listen(e&&ae(t));return!0},parts:Array.from(f.values()).flatMap(e=>e.port?[e.port]:[])},re)}function pc(e,t,n){let r=l(e),i;return i=y({duration:950,timing:`transition`,ease:o,update:n=>{let a=Math.min(1,r+n);t(n===0?e:s(a)),a>=1&&n<1&&i?.finish()}},n),i}function mc(e){let t=e.now();return{clock:{now:()=>t??e.now(),onFrame:t=>e.onFrame(t)},release(){t=void 0}}}function hc(e,t){e.classList.toggle(`ec-switch-inactive`,!t),e.toggleAttribute(`inert`,!t),t?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,`true`)}function gc(e,t){e.style.setProperty(`opacity`,String(Math.round(t*1e3)/1e3))}function _c(e,t){return n=>{let r=Cc(e.at.x,t.at.x,n),i=Cc(e.at.y,t.at.y,n),a=n>=dc;X(e.text,{x:r,y:i,visibility:a?`hidden`:void 0,...vc(e,r,i)}),X(t.text,{x:r,y:i,visibility:a?void 0:`hidden`,...vc(t,r,i)})}}let vc=(e,t,n)=>e.scale===1?{}:{transform:Mt([e.scale,0,0,e.scale,t*(1-e.scale),n*(1-e.scale)])};function yc(e,t){return n=>X(e.text,{opacity:t(n)})}let bc=e=>1-Sc(e/dc),xc=e=>Sc((e-dc)/.5),Sc=e=>Math.min(1,Math.max(0,e)),Cc=(e,t,n)=>e*(1-n)+t*n;function wc(e,t){return e.chart.paintOf?.(t.key)??{color:t.key,drawn:!0}}function Tc(e){return xe({key:e.key,...e.series===void 0?{}:{series:e.series},x:e.center.x,y:e.center.y,r:0})}let Ec=(e,t)=>e.drawn&&e.end===void 0?(e.ring??0)*t:0;function Dc(e,t,n){return e.drawn&&e.end!==void 0?{at:t.end,r:e.end*n,ring:(e.ring??0)*n}:void 0}function Oc(e,t){X(e,{cx:t.at.x,cy:t.at.y,r:t.r,"stroke-width":t.ring})}let kc=e=>e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1&&e[4]===0&&e[5]===0,Ac=e=>Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]));function jc(e,t){if(kc(t))return e;let n=e=>q.apply(t,e),r=e=>ze(Le(je(e),t)),i=Ac(t),{outline:a}=e;return{key:e.key,...e.series===void 0?{}:{series:e.series},start:n(e.start),end:n(e.end),length:e.length*i,path:t=>n(e.path(t)),angle:n=>{let r=e.angle(n),i=Math.cos(r),a=Math.sin(r);return Math.atan2(t[1]*i+t[3]*a,t[0]*i+t[2]*a)},slice:(t,n)=>r(e.slice(t,n)),...e.gaps===void 0?{}:{gaps:e.gaps},thickness:e.thickness*i,outline:{d:r(a.d),closed:a.closed,sample:e=>a.sample(e).map(n)},bounds:To(t,e.bounds),center:n(e.center),pivot:n(e.pivot),...e.segments===void 0?{}:{segments:e.segments.map(e=>jc(e,t))}}}function Mc(){let e;return{done:new Promise(t=>{e=t}),settle:e}}function Nc(e,t){if(typeof e!=`object`||!e)return!1;let n=e,r=n.element;return[`marks`,`labels`,`focus`,`leave`,`destroy`].every(e=>typeof n[e]==`function`)&&r?.nodeType===1&&t.contains(r)}function Pc(e){if(typeof e!=`object`||!e)throw TypeError(`chartSwitch needs options.`);let{views:t,initial:n,transition:r,announce:i}=e;if(typeof t!=`object`||!t)throw TypeError(`chartSwitch needs views: by name, a function that draws each view's chart in the container it's given.`);let a=Object.keys(t);if(a.length===0)throw TypeError(`chartSwitch needs at least one view.`);for(let e of a)if(typeof t[e]!=`function`)throw TypeError(`chartSwitch: views.${e} must be a function that draws the view's chart in the container it's given.`);if(typeof n!=`string`||!a.includes(n))throw TypeError(`chartSwitch: initial must be one of the views (${a.map(e=>JSON.stringify(e)).join(`, `)}), got ${typeof n==`string`?JSON.stringify(n):String(n)}.`);if(!lc(r))throw TypeError(`chartSwitch: transition must be a transition effect, such as morph().`);if(i!==void 0&&typeof i!=`boolean`)throw TypeError(`chartSwitch: announce must be true or false.`);return a}let Fc=[`presentation`,`analysis`,`off`],Ic={presentation:`Presentation`,analysis:`Analysis`,off:`Off`},Lc={presentation:`Staged, unhurried motion. Best for walking someone through a change.`,analysis:`Quick, unstaged motion. Best for exploring.`,off:`No motion: charts jump straight to their end state.`,reduced:`Your device asks for reduced motion, so motion is off. Picking a mode here overrides it.`},Rc=0;function zc(e,t,n={}){let r=Vc(e);Hc(t),Uc(n);let i={...Ic,...n.labels},a={...Lc,...n.hints},{persist:o}=n,s=r.ownerDocument;bn(s);let c=`ec-motion-${++Rc}`,l=s.createElement(`div`);l.className=`ec-motion-switch`,l.setAttribute(`role`,`group`),l.setAttribute(`aria-labelledby`,`${c}-label`),l.setAttribute(`aria-describedby`,`${c}-hint`);let u=l.appendChild(s.createElement(`span`));u.className=`ec-motion-label`,u.id=`${c}-label`,u.textContent=n.label??`Motion`;let d=l.appendChild(s.createElement(`span`));d.className=`ec-motion-modes`;let f=Fc.map(e=>{let n=d.appendChild(s.createElement(`button`));return n.type=`button`,n.dataset.mode=e,n.textContent=i[e],n.addEventListener(`click`,()=>t.chooseMode(e)),n}),p=l.appendChild(s.createElement(`span`));p.className=`ec-motion-hint`,p.id=`${c}-hint`,p.setAttribute(`aria-live`,`polite`);let m=()=>{let e=t.mode;for(let t of f)t.setAttribute(`aria-pressed`,String(t.dataset.mode===e));p.textContent=t.prefersReduced&&t.viewerChoice===void 0?a.reduced:a[e]};if(o!==void 0){let e=Bc(s,e=>e.getItem(o));Fc.includes(e)&&t.chooseMode(e)}m(),r.appendChild(l);let h=t.subscribe(()=>{if(m(),o===void 0)return;let e=t.viewerChoice;Bc(s,t=>e===void 0?t.removeItem(o):t.setItem(o,e))}),g=!1;return{element:l,destroy(){g||(g=!0,h(),l.remove())}}}function Bc(e,t){try{let n=e.defaultView?.localStorage;return n?t(n):void 0}catch{return}}function Vc(e){if(typeof e==`string`){let t=typeof document>`u`?null:document.querySelector(e);if(!t)throw TypeError(`motionSwitch: no element matches "${e}".`);return t}if(typeof e!=`object`||!e||typeof e.appendChild!=`function`)throw TypeError(`motionSwitch needs an element or a selector to build the switch in.`);return e}function Hc(e){if(typeof e!=`object`||!e||typeof e.chooseMode!=`function`||typeof e.subscribe!=`function`)throw TypeError("motionSwitch needs a Motion, such as the page-wide `motion` or one from createMotion().")}function Uc(e){let{label:t,labels:n,hints:r,persist:i}=e;if(t!==void 0&&typeof t!=`string`)throw TypeError(`motionSwitch: label must be a string, got ${typeof t}.`);for(let[e,t]of[[`labels`,n],[`hints`,r]])if(t!==void 0){for(let[n,r]of Object.entries(t))if(typeof r!=`string`)throw TypeError(`motionSwitch: ${e}.${n} must be a string, got ${typeof r}.`)}if(i!==void 0&&(typeof i!=`string`||i===``))throw TypeError(`motionSwitch: persist must be a localStorage key, got ${JSON.stringify(i)??String(i)}.`)}let Wc={play:`Play`,pause:`Pause`};function Gc(e,t,n={}){let r=Kc(e);qc(t),Jc(n);let i={...Wc,...n.labels},a=r.ownerDocument;bn(a);let o=a.createElement(`button`);o.type=`button`,o.className=`ec-play`,o.addEventListener(`click`,()=>t.playing?t.pause():t.play());let s=()=>{let e=t.playing?i.pause:i.play;o.textContent!==e&&(o.textContent=e)};s(),r.appendChild(o);let c=t.subscribe(s),l=!1;return{element:o,destroy(){l||(l=!0,c(),o.remove())}}}function Kc(e){if(typeof e==`string`){let t=typeof document>`u`?null:document.querySelector(e);if(!t)throw TypeError(`playButton: no element matches "${e}".`);return t}if(typeof e!=`object`||!e||typeof e.appendChild!=`function`)throw TypeError(`playButton needs an element or a selector to build the button in.`);return e}function qc(e){if(typeof e!=`object`||!e||typeof e.play!=`function`||typeof e.pause!=`function`||typeof e.subscribe!=`function`)throw TypeError(`playButton needs a Playback, from playback().`)}function Jc(e){let{labels:t}=e;if(t!==void 0){for(let[e,n]of Object.entries(t))if(typeof n!=`string`||n.trim()===``)throw TypeError(`playButton: labels.${e} must be a string with some text, got ${JSON.stringify(n)??String(n)}.`)}}let Yc=Object.freeze({lift:0,spin:0,tilt:0});function Xc(){return e=>({lift:0,spin:e.distance/e.radius,tilt:0})}function Zc(e={}){let t=e.stride??42,n=e.lift??3.2,r=e.tilt??9;if(!(t>0)||!Number.isFinite(t))throw RangeError(`gaits.step: stride must be more than 0, got ${t}.`);if(!(n>=0)||!Number.isFinite(n))throw RangeError(`gaits.step: lift can't be negative, got ${n}.`);if(!Number.isFinite(r))throw RangeError(`gaits.step: tilt must be a finite number of degrees, got ${r}.`);let i=r*Math.PI/180;return Object.assign(e=>{let r=Math.max(1,Math.round(e.length/t)),a=Math.abs(Math.sin(Math.PI*(e.progress*r%1)));return{lift:a*n,spin:0,tilt:a*i*(1-.3*e.progress)}},{ease:s,pace:1.15})}function Qc(){return()=>Yc}let $c={roll:Xc,step:Zc,slide:Qc},el=[1,0,0,1,0,0],tl=[`auto`,`follow`,`level`],nl=[`center`,`on`];function rl(e,t={}){ul(e,t);function n(n,r){let i=typeof e==`string`?r.icons.get(e):e;if(!i)throw RangeError(`travel: unknown icon "${String(e)}". Register it with registerIcon(icon), or pass the icon itself.`);let a=al(n,t.along);if(!a||!(sl(a)>=.5))return;let o=t.size===void 0?1:t.size===`fit`?.85*a.thickness/i.box.height:t.size/i.size;if(o>0)return il(a,i,o,t)}function r(e,t){let r=n(e,t),i,a,o=0,s=()=>{r?(i&&a?.icon===r.icon&&a.size===r.size||(i?.remove(),i=t.layer.icon(r.icon,{size:r.size}),a={icon:r.icon,size:r.size}),i.place(r.transform(o))):(i?.remove(),i=a=void 0)};return t.onChange(e=>{r=n(e,t),s()}),{get trip(){return r},show(e){o=e,s()}}}return{kind:`geometry`,async run(e,t){if(t.signal.aborted)return;let n=r(e,t),i=n.trip;!i||i.span<=0?n.show(1):await t.tween({duration:i.duration,timing:`effect`,ease:i.gait.ease??c,update:e=>n.show(e)}).finished},end(e,t){r(e,t).show(1)},clear(){}}}function il(e,t,n,r){let i=typeof r.gait==`function`?r.gait:$c[r.gait??t.gait??`slide`](),a=e.length,o=t.footprint[0]*n,s=t.footprint[1]*n,c=0,l=ol(e).map(([e,t])=>{let n={from:e,to:t,span:Math.max(0,t-e-o-s),before:c};return c+=n.span,n}),u=Math.max(2,(o+s)/2),d=t.radius??t.box.height/2,{anchor:f}=t,p={x:f.x+n*(t.pivot.x-f.x),y:f.y+n*(t.pivot.y-f.y)},m=r.ride===`on`?e.thickness/2+(t.box.y+t.box.height-f.y)*n:0,h=r.orient??`auto`;return{icon:t,size:t.size*n,span:c,duration:Math.min(4e3,Math.max(260,c/360*1e3)*(i.pace??1)),gait:i,transform(r){let s=r*c,g=l.length-1;for(;g>0&&l[g].before>s;)g--;let _=l[g],v=_.from+o+Math.min(_.span,s-_.before),y=i({distance:s/n,length:c/n,progress:r,radius:d}),b=cl(e,v),x=ll(e,Math.min(v,a),u,_),S=h===`auto`&&t.upright===!0&&Math.cos(x)<-1e-9,C=h===`level`?0:S?P(x-Math.PI):x;return q.multiply(q.translate(b.x,b.y),q.rotate(C),S?q.scale(-1,1):el,q.translate(-f.x,-f.y-y.lift*n-m),q.rotate(y.spin-y.tilt,p))}}}function al(e,t){return t===void 0?e:e.segments?e.segments.find(e=>e.series===t):e.series===t?e:void 0}function ol(e){let{length:t}=e,n=[],r=0;for(let[i,a]of e.gaps??[])a>i&&a>r&&(i>r&&n.push([r*t,Math.min(1,i)*t]),r=Math.min(1,a));return n.push([r*t,t]),n}function sl(e){return ol(e).reduce((e,[t,n])=>e+(n-t),0)}function cl(e,t){let{length:n}=e;return t<=n?e.path(t/n):tt(e.end,e.angle(1),t-n)}function ll(e,t,n,r){let{length:i}=e,a=Math.min(n,t-r.from,r.to-t);if(a>1e-6){let n=e.path((t-a)/i),r=e.path((t+a)/i);if(Math.hypot(r.x-n.x,r.y-n.y)>1e-9)return Math.atan2(r.y-n.y,r.x-n.x)}return e.angle(t/i)}function ul(e,t){if((typeof e!=`string`||e===``)&&(typeof e!=`object`||!e||typeof e.name!=`string`))throw TypeError(`travel needs an icon or an icon's name, got ${e===null?`null`:typeof e}.`);let{along:n,gait:r,size:i,orient:a,ride:o}=t;if(n!==void 0&&typeof n!=`string`)throw RangeError(`travel: along must be a series name, got ${String(n)}.`);if(r!==void 0&&typeof r!=`function`&&!Object.prototype.hasOwnProperty.call($c,r))throw RangeError(`travel: gait must be a gait or one of roll, step, slide, got ${String(r)}.`);if(i!==void 0&&i!==`fit`&&!(typeof i==`number`&&i>0&&Number.isFinite(i)))throw RangeError(`travel: size must be more than 0 px, or "fit", got ${String(i)}.`);if(a!==void 0&&!tl.includes(a))throw RangeError(`travel: orient must be auto, follow or level, got ${String(a)}.`);if(o!==void 0&&!nl.includes(o))throw RangeError(`travel: ride must be center or on, got ${String(o)}.`)}let dl=.25;function fl(e={}){hl(e);let t=e.width??8,n=e.opacity??.35,{color:r}=e,i=(e,i)=>{let a=t*pl(i);e.mark.set({halo:a>0?{width:a,opacity:n,...r===void 0?{}:{color:r}}:void 0})};return{kind:`geometry`,async run(e,t){t.signal.aborted||await t.tween({duration:900,timing:`effect`,ease:o,update:e=>i(t,e)}).finished},end(){},clear(){}}}function pl(e){return!(e>0)||e>=1?0:e<dl?ml(e/dl):1-ml((e-dl)/.75)}function ml(e){if(!(e>0))return 0;if(e>=1)return 1;let t=0,n=1;for(let r=0;r<24;r++){let r=(t+n)/2;1.74*r*r*(1-r)+r*r*r<e?t=r:n=r}let r=(t+n)/2;return 3*r*r-2*r*r*r}function hl(e){let{width:t,opacity:n,color:r}=e;if(t!==void 0&&!(typeof t==`number`&&t>0&&Number.isFinite(t)))throw RangeError(`flash: width must be more than 0 px, got ${String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>0&&n<=1))throw RangeError(`flash: opacity must be more than 0 and at most 1, got ${String(n)}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`flash: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}let gl=[1,-.5,.25],_l=Math.PI/12;function vl(e={}){xl(e);let t=e.swing??3;return{kind:`geometry`,async run(e,n){if(n.signal.aborted)return;let r=e,i=yl(e,t),a=0,s=()=>{let e=i*bl(a);n.mark.set({transform:e===0?void 0:q.rotate(e,r.pivot)})};n.onChange(e=>{r=e,i=yl(e,t),s()}),await n.tween({duration:450,timing:`effect`,ease:o,update:e=>{a=e,s()}}).finished},end(){},clear(){}}}function yl(e,t){let{pivot:n}=e,r=0;for(let t of e.outline.sample(64))r=Math.max(r,Math.hypot(t.x-n.x,t.y-n.y));return r>=.5?Math.min(_l,2*Math.asin(Math.min(1,t/(2*r)))):0}function bl(e){if(!(e>0)||e>=1)return 0;let t=e*gl.length,n=Math.floor(t);return gl[n]*Math.sin(Math.PI*(t-n))}function xl(e){let{swing:t}=e;if(t!==void 0&&!(typeof t==`number`&&t>0&&t<=3))throw RangeError(`wiggle: swing must be more than 0 and at most 3 px, got ${String(t)}.`)}function Sl(e={}){Cl(e);let t=e.times??2,n=e.width??12,{color:r}=e,i=(e,t)=>{let i=t>0&&t<1;e.mark.set({halo:i?{width:n*c(t),opacity:.4*(1-t),...r===void 0?{}:{color:r}}:void 0})};return{kind:`geometry`,async run(e,n){let r=0;for(let e=0;e<t;e++){if(n.signal.aborted)return;let e=n.motion.duration(600,`effect`);if(r+e>=5e3)return;r+=e,await n.tween({duration:600,timing:`effect`,ease:o,update:e=>i(n,e)}).finished}},end(){},clear(){}}}function Cl(e){let{times:t,width:n,color:r}=e;if(t!==void 0&&!(Number.isInteger(t)&&t>=1&&t<=6))throw RangeError(`pulse: times must be a whole number from 1 to 6, got ${String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>0&&Number.isFinite(n)))throw RangeError(`pulse: width must be more than 0 px, got ${String(n)}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`pulse: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}let wl=.5;function Tl(e={}){El(e);let t=e.duration??500,n={stroke:e.color??`mark`,width:e.width??3,opacity:e.opacity??.5,linecap:`round`},r=(e,t)=>{let r=e,i=0,a,o=()=>{if(!(r.length>=wl)){a?.remove(),a=void 0;return}let e=r.slice(0,i);a?a.update(e):a=t.layer.path(e,n)};return t.onChange(e=>{r=e,o()}),o(),e=>{i=e,o()}};return{kind:`geometry`,async run(e,n){if(n.signal.aborted)return;let i=r(e,n);e.length>=wl?await n.tween({duration:t,timing:`effect`,ease:s,update:i}).finished:i(1)},end(e,t){r(e,t)(1)},clear(){}}}function El(e){let{color:t,width:n,opacity:r,duration:i}=e;if(t!==void 0&&(typeof t!=`string`||t===``))throw RangeError(`trace: color must be a theme token or a CSS colour, got ${JSON.stringify(t)??String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>=0&&Number.isFinite(n)))throw RangeError(`trace: width must be 0 px or more, got ${String(n)}.`);if(r!==void 0&&!(typeof r==`number`&&r>=0&&r<=1))throw RangeError(`trace: opacity must be from 0 to 1, got ${String(r)}.`);if(i!==void 0&&!(typeof i==`number`&&i>=0&&Number.isFinite(i)))throw RangeError(`trace: duration must be 0 ms or more, got ${String(i)}.`)}function Dl(e={}){kl(e);let t=e.duration??750,n=e.faint??.3;return{kind:`geometry`,async run(e,r){if(r.signal.aborted||!(Ol(e)>=.5))return;let i=e,a=0,c=!1,l=[],u=e=>{let{segments:t}=i,n=t??[i],o=a*Ol(i),c=0;n.forEach((n,i)=>{let a=n.length>0?Math.min(1,Math.max(0,(o-c)/n.length)):0;c+=n.length;let u=n.slice(0,s(a)),d={stroke:`mark`,width:n.thickness,linecap:`butt`,...t&&{part:n.key}},f=l[i];f?f.update(u,e?{part:void 0,...d}:void 0):l[i]=r.layer.path(u,d)});for(let e of l.splice(n.length))e.remove()};r.onChange(e=>{i=e,c||u(!0)}),r.mark.set({opacity:n}),u(!1),await r.tween({duration:t,timing:`effect`,ease:o,update:e=>{a=e,u(!1)}}).finished,c=!0;for(let e of l)e.remove();r.mark.set({opacity:void 0})},end(){},clear(){}}}let Ol=e=>(e.segments??[e]).reduce((e,t)=>e+t.length,0);function kl(e){let{duration:t,faint:n}=e;if(t!==void 0&&!(typeof t==`number`&&t>=0&&Number.isFinite(t)))throw RangeError(`drawIn: duration must be 0 ms or more, got ${String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>=0&&n<=1))throw RangeError(`drawIn: faint must be from 0 to 1, got ${String(n)}.`)}let Al=.36;function jl(e,t){let n=e.labelBounds??[],r=[...n,...e.nearbyLabels??[],...t?.held??[]],i=e.angle(1);if(Ll(e.end,i,n)===void 0){let i=e.angle(.5)-Math.PI/2;if(Ll(e.center,i,n)!==void 0)return Ml(e.center,i,0,n,r,t)}return Ml(e.end,i,10,n,r,t)}function Ml(e,t,n,r,i,a){if(!a)return Fl(e,t,Math.max(n,Ll(e,t,i)??-1/0));let{x:o,y:s,width:c,height:l}=a.box(Fl(e,t,0));return Fl(e,t,Nl(e,t,Math.max(n,Ll(e,t,r)??-1/0),i,{x:o-e.x,y:s-e.y,width:c,height:l},new Set(a.held)))}function Nl(e,t,n,r,i,a){let o=Math.cos(t),s=Math.sin(t),c=Il(o),l=t=>zl(e,o,s,{x:t.x-i.x-i.width,y:t.y-i.y-i.height,width:t.width+i.width,height:t.height+i.height}),u=r.map(t=>{let n=Pl(t,6),r=zl(e,o,s,n);if(!r&&a.has(t))return l(t);let i=l(n);if(!r||!i)return i;let u=c?Math.max(r[1],((s>0?n.y+n.height:n.y)-e.y)/s):r[1];return[i[0],Math.max(u,l(t)?.[1]??-1/0)]}),d=n;for(let e=!0;e;){e=!1;for(let t of u)t&&d>t[0]+1e-6&&d<t[1]-1e-6&&(d=t[1],e=!0)}return d}let Pl=({x:e,y:t,width:n,height:r},i)=>({x:e-i,y:t-i,width:n+2*i,height:r+2*i});function Fl(e,t,n){let r=Math.cos(t),i=Math.sin(t),a=tt(e,t,n),o=12.5*(i<0?Al*(1+i):Al+.44000000000000006*i),s=Il(r)?`middle`:r>0?`start`:`end`;return{at:{x:a.x,y:a.y+o},anchor:s,toward:t}}function Il(e){return Math.abs(e)<=Math.SQRT1_2+1e-9}function Ll(e,t,n){let r=Math.cos(t),i=Math.sin(t),a=Il(r),o;for(let t of n){let n=Pl(t,6),s=Rl(e,r,i,n);s!==void 0&&a&&(s=Math.max(s,((i>0?n.y+n.height:n.y)-e.y)/i)),s!==void 0&&(o=Math.max(o??s,s))}return o}function Rl(e,t,n,r){return zl(e,t,n,r)?.[1]}function zl(e,t,n,r){let i=0,a=1/0;for(let[o,s,c,l]of[[e.x,t,r.x,r.x+r.width],[e.y,n,r.y,r.y+r.height]]){if(Math.abs(s)<1e-12){if(o<c||o>l)return;continue}let e=(c-o)/s,t=(l-o)/s;i=Math.max(i,Math.min(e,t)),a=Math.min(a,Math.max(e,t))}return a>=i?[i,a]:void 0}function Bl(e,t,n,r,i){let a=e,o=i(e,t)??``,s=t,c=0,l,{texts:u}=n,d=()=>{if(o===``){l?.remove(),l=void 0,u?.hold(void 0);return}let{at:e,anchor:t,toward:i}=jl(a,u&&{held:u.held(),box:e=>u.box(o,e)});u?.hold(u.box(o,{at:e,anchor:t}));let s={at:tt(e,i-Math.PI/2,-8*(1-c)),anchor:t,color:r,opacity:c};l?l.update(s,o):l=n.layer.text(o,s)};return n.onChange((e,t)=>{a=e,s=t??s,o=i(a,s)??``,d()}),d(),e=>{c=e,d()}}let Vl=e=>{let{samples:t}=e;return t[t.length-1]?.value??NaN},Hl,Ul=e=>(Hl??(Hl=new Intl.NumberFormat(void 0,{signDisplay:`always`,maximumFractionDigits:2})),Hl.format(e));function Wl(e={}){Gl(e);let t=e.value??Vl,n=e.format??Ul,r=e.color??`text`,i=e=>{if(!e.previous)return;let r=t(e),i=t(e.previous),a=r-i;if(!(!Number.isFinite(a)||Math.abs(a)<=1e-9*Math.max(Math.abs(r),Math.abs(i))))return n(a)};return{kind:`data`,run:async(e,t,n)=>{if(n.signal.aborted)return;let a=i(t);if(a===void 0||a===``)return;let o=Bl(e,t,n,r,()=>a);await n.tween({duration:400,timing:`effect`,update:o}).finished},end:(e,t,n)=>{let a=i(t);a!==void 0&&a!==``&&Bl(e,t,n,r,()=>a)(1)},clear(){}}}function Gl(e){let{value:t,format:n,color:r}=e;if(t!==void 0&&typeof t!=`function`)throw TypeError(`delta: value must be a function that reads the mark's value from its data, got ${typeof t}.`);if(n!==void 0&&typeof n!=`function`)throw TypeError(`delta: format must be a function that words the change, got ${typeof n}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`delta: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}function Kl(e,t={}){if(typeof e!=`function`)throw TypeError(`label needs a function that returns the text from the mark's data, got ${typeof e}.`);let{color:n=`text`}=t;if(typeof n!=`string`||n===``)throw RangeError(`label: color must be a theme token or a CSS colour, got ${JSON.stringify(n)??String(n)}.`);let r=(t,n)=>{let r=e(n,t);return r==null?void 0:String(r)};return{kind:`data`,run:async(e,t,i)=>{if(i.signal.aborted)return;let a=Bl(e,t,i,n,r);await i.tween({duration:400,timing:`effect`,update:a}).finished},end:(e,t,i)=>Bl(e,t,i,n,r)(1),clear(){}}}let ql=[`below`,`above`];function Jl(e){ru(e);let{compareTo:t}=e,n=e.when??`below`,r=e.color??`negative`,i=(e,i,a)=>{let o=[],s=i,c=e=>{let i=e.length>=.5?eu(s.samples,Yl(t,s),n):[],c={stroke:r,width:e.thickness,linecap:`butt`};i.forEach(([t,n],r)=>{let i=e.slice(t,n),s=o[r];s?s.update(i,c):o.push(a.layer.path(i,c))});for(let e of o.splice(i.length))e.remove()};a.onChange((e,t)=>{s=t??s,c(e)}),c(e)};return{kind:`data`,...typeof t==`string`?{needs:Object.freeze({related:Object.freeze([t])})}:{},run:async(e,t,n)=>{n.signal.aborted||i(e,t,n)},end:(e,t,n)=>i(e,t,n),clear(){}}}function Yl(e,t){if(typeof e==`number`)return{place:e=>e.t,valueAt:()=>e,bends:[]};let n=t.related(e);if(!n)return;let r=t.samples.every(e=>Ql(e.at)!==void 0)&&n.samples.every(e=>Ql(e.at)!==void 0)?e=>Ql(e.at):e=>e.t,i=n.samples.map(e=>({u:r(e),value:e.value})).filter(e=>Number.isFinite(e.u)).sort((e,t)=>e.u-t.u),a=Xl(n.samples,r);return{place:r,valueAt:e=>Zl(a,e)?void 0:$l(i,e),bends:i.map(e=>e.u)}}function Xl(e,t){let n=[];e.forEach((r,i)=>{let a=e[i-1];if(r.gapBefore!==!0||!a)return;let o=t(a),s=t(r);Number.isFinite(o)&&Number.isFinite(s)&&o!==s&&n.push([Math.min(o,s),Math.max(o,s)])}),n.sort((e,t)=>e[0]-t[0]);let r=[];for(let e of n){let t=r[r.length-1];t&&e[0]<t[1]?t[1]=Math.max(t[1],e[1]):r.push(e)}return r}function Zl(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i][0]<t?n=i+1:r=i}let i=e[n-1];return i!==void 0&&t<i[1]}function Ql(e){let t=typeof e==`number`?e:e instanceof Date?e.getTime():void 0;return t!==void 0&&Number.isFinite(t)?t:void 0}function $l(e,t){let n=e[0],r=e[e.length-1];if(!n||!r||t<n.u||t>r.u)return;let i=0,a=e.length-1;for(;i<a;){let n=i+a>>1;e[n].u<t?i=n+1:a=n}let o=e[i];if(i===0||o.u===t)return o.value;let s=e[i-1];return s.value+(t-s.u)/(o.u-s.u)*(o.value-s.value)}function eu(e,t,n){if(!t)return[];let r=n===`below`?1:-1,i=(e,n,i,a=!0)=>{let o=t.valueAt(n);if(o===void 0||!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(e))return{t:e,u:n,past:void 0,joined:a};let s=r*(o-i);return{t:e,u:n,past:Math.abs(s)<=1e-9*Math.max(Math.abs(o),Math.abs(i))?0:s,joined:a}},a=[];e.forEach((n,r)=>{let o=t.place(n);a.push(i(n.t,o,n.value,n.gapBefore!==!0));let s=e[r+1];if(!s||s.gapBefore===!0)return;let c=t.place(s);if(o===c||!Number.isFinite(o)||!Number.isFinite(c))return;let l=[],{bends:u}=t;for(let e=nu(u,Math.min(o,c));e<u.length&&u[e]<Math.max(o,c);e++)l.push((u[e]-o)/(c-o));c<o&&l.reverse();for(let e of l)a.push(i(n.t+e*(s.t-n.t),o+e*(c-o),n.value+e*(s.value-n.value)))});let o=[],s=(e,t)=>{let n=tu(e),r=tu(t);if(!(r>n))return;let i=o[o.length-1];i&&i[1]>=n?i[1]=Math.max(i[1],r):o.push([n,r])};for(let e=1;e<a.length;e++){let n=a[e-1],r=a[e];n.past!==void 0&&r.past!==void 0&&r.joined&&r.t>n.t&&(n.u===r.u||t.valueAt((n.u+r.u)/2)!==void 0)&&(n.past>0&&r.past>0?s(n.t,r.t):n.past>0?s(n.t,n.t+(r.t-n.t)*(n.past/(n.past-r.past))):r.past>0&&s(n.t+(r.t-n.t)*(n.past/(n.past-r.past)),r.t))}return o}let tu=e=>Math.min(1,Math.max(0,e));function nu(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i]<=t?n=i+1:r=i}return n}function ru(e){let{compareTo:t,when:n,color:r}=e??{};if(!(typeof t==`string`?t!==``:typeof t==`number`&&Number.isFinite(t)))throw RangeError(`threshold: compareTo must be a finite number or a series name, got ${iu(t)}.`);if(n!==void 0&&!ql.includes(n))throw RangeError(`threshold: when must be "below" or "above", got ${iu(n)}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`threshold: color must be a theme token or a CSS colour, got ${iu(r)}.`)}let iu=e=>typeof e==`string`?JSON.stringify(e):String(e),au=[`unroll`,`drop`];function ou(e={}){Fu(e);let t=e?.points??160,n=e?.align??`unroll`;return{kind:`transition`,async run(e,r,i){if(i.signal.aborted)return;let a=su(e,r,i.layer,t,n),c=Pu(i.start);if(c>=1){a(1);return}let u=l(c),d;d=i.tween({duration:950,timing:`transition`,ease:o,update:e=>{let t=Math.min(1,u+e);a(e===0?c:s(t)),t>=1&&e<1&&d?.finish()}}),await d.finished},end(e,r,i){su(e,r,i.layer,t,n)(1)},clear(){}}}function su(e,t,n,r,i){let a=e.outline.closed;if(a!==t.outline.closed)return ku(e,t,n);let o=a?void 0:pu(e,t,r);if(o)return uu(e,t,n,o.stops,o.kinds);let s=e.outline.sample(r),c=t.outline.sample(r);if(!a)return e.gaps?.length||t.gaps?.length?lu(e,t,n,s,c):cu(e,t,n,s,c);let[l,u]=i===`drop`?Nu(e,t,r):[0,0],d=vu(e,t,s,c,[l,u],r/4),f;return r=>{let i=r<=0?e.outline.d:r>=1?t.outline.d:Au(s,c,l,u,r,!0)+d.map(e=>xu(e,r)).join(``);f?f.update(i):f=n.path(i,{fill:`mark`})}}function cu(e,t,n,r,i){let a;return o=>{let s=o<=0?e.outline.d:o>=1?t.outline.d:Au(r,i,0,0,o,!1),c=o<=0?e.thickness:o>=1?t.thickness:Mu(e.thickness,t.thickness,o);a?a.update(s,{width:c}):a=n.path(s,{stroke:`mark`,width:c})}}function lu(e,t,n,r,i){let a=r.length,o=r.map((e,t)=>({t:t/(a-1),from:e,to:i[t]}));for(let n of[...e.gaps??[],...t.gaps??[]])for(let r of n)r>0&&r<1&&o.every(e=>Math.abs(e.t-r)>1e-9)&&o.push({t:r,from:e.path(r),to:t.path(r)});return o.sort((e,t)=>e.t-t.t),uu(e,t,n,o,o.slice(1).map((n,r)=>{let i=(o[r].t+n.t)/2;return+!!du(e,i)+(du(t,i)?2:0)}))}function uu(e,t,n,r,i){let a=[[],[],[]];for(let e=0;e<i.length;e++){let t=i[e];if(t===3)continue;let n=a[t][a[t].length-1];n&&n[1]===e?n[1]=e+1:a[t].push([e,e+1])}let o=[0,1,2].filter(e=>a[e].length>0).sort((e,t)=>a[e][0][0]-a[t][0][0]),s=[];return i=>{let c=i<=0?e.thickness:i>=1?t.thickness:Mu(e.thickness,t.thickness,i),l=[void 0,i,1-i],u=i<=0||i>=1?[[i<=0?e.outline.d:t.outline.d,void 0]]:o.map(e=>[a[e].map(e=>fu(r,e,i)).join(``),l[e]]);u.forEach(([e,t],r)=>{s[r]?s[r].update(e,{width:c,opacity:t}):s[r]=n.path(e,{stroke:`mark`,width:c,...t===void 0?{}:{opacity:t}})});for(let e of s.splice(u.length))e.remove()}}let du=(e,t)=>(e.gaps??[]).some(([e,n])=>e<t&&t<n);function fu(e,[t,n],r){let i=``;for(let a=t;a<=n;a++)i+=`${a===t?`M`:`L`}${ju(e[a].from,e[a].to,r)}`;return i}function pu(e,t,n){let r=mu(e),i=r&&mu(t);if(!r||!i||r.way!==i.way)return;let a=[...Array.from({length:n},(e,t)=>[t/(n-1),0]),...hu(r).map(e=>[e,1]),...hu(i).map(e=>[e,2])].sort((e,t)=>e[0]-t[0]),o=.01/Math.max(Math.abs(r.span),Math.abs(i.span)),s=[];for(let[e,t]of a){var c,l;let n=s[s.length-1];(!n||e-n[0]>o||t>0&&n[t]!==void 0)&&s.push(n=[e]),t===1&&((c=n)[1]??(c[1]=e)),t===2&&((l=n)[2]??(l[2]=e))}let u=s.length-1;if(u<1)return;let d=e=>s.map((t,n)=>n===0?0:n===u?1:t[e]??t[0]),[f,p]=[d(1),d(2)],[m,h]=[gu(r,f),gu(i,p)],g=s.map(([e],t)=>({t:e,from:m[t],to:h[t]})),[_,v]=[_u(r.gaps),_u(i.gaps)];return{stops:g,kinds:g.slice(1).map((e,t)=>+!!_((f[t]+f[t+1])/2)+(v((p[t]+p[t+1])/2)?2:0))}}function mu(e){let t=G(je(e.outline.d)),n=[],r=[],i=0,a=0,o=r=>{if(!(r>a))return n.push(e.path(a)),!0;let o=t[i++];if(!o)return!1;n.push(o.start);for(let e of o.segments){if(e.kind!==`line`)return!1;n.push(e.to)}return!0};for(let[t,i]of e.gaps??[]){if(!o(t))return;r.push(n.length-1),a=i}if(!o(1)||i<t.length||n.length<2)return;let s=n[0].x,c=n[n.length-1].x-s,l=Math.sign(c);for(let e=1;e<n.length;e++)if(!((n[e].x-n[e-1].x)*l>0))return;let u=n.map(e=>(e.x-s)/c);return{points:n,shares:u,gaps:r.map(e=>[u[e],u[e+1]]),span:c,way:l}}function hu(e){let{points:t,shares:n,gaps:r}=e;if(t.length<=1e3)return n;let i=e=>Math.min(249,Math.floor(n[e]*250)),a=r.flat();for(let e=0,r=1;r<=t.length;r++){if(r<t.length&&i(r)===i(e))continue;let[o,s]=[e,e];for(let n=e;n<r;n++)t[n].y<t[o].y&&(o=n),t[n].y>t[s].y&&(s=n);a.push(n[e],n[o],n[s],n[r-1]),e=r}return Array.from(new Set(a))}function gu(e,t){let{points:n,shares:r}=e,i=0;return t.map(e=>{for(;i+2<n.length&&r[i+1]<=e;)i++;let t=r[i+1]-r[i];return Su(n[i],n[i+1],t>0?Math.min(1,Math.max(0,(e-r[i])/t)):0)})}function _u(e){let t=0;return n=>{for(;t<e.length&&e[t][1]<=n;)t++;return t<e.length&&e[t][0]<n}}function vu(e,t,n,r,[i,a],o){let s=Du(e.outline,o),c=Du(t.outline,o),l=Math.min(s.length,c.length),u=s.slice(0,l).map((e,t)=>({from:e.points,to:c[t].points})),d=s.length>c.length,[f,p,m,h,g,_,v]=d?[s,c,t,n,r,i,a]:[c,s,e,r,n,a,i],y=h.length,b=h.map((e,t)=>[h[(t+_)%y],g[(t+v)%y]]),x=f.slice(0,l).map((e,t)=>e.points.map((e,n)=>[e,p[t].points[n]])),S=[g,...p.map(e=>e.points)];for(let n of f.slice(l)){let{end:r,point:i}=yu(n,Cu(n,(d?e:t).bounds,m,S),b,x),a=Array(o).fill(i);u.push(d?{from:n.points,to:a,end:r}:{from:a,to:n.points,end:r,opens:!0})}return u}function yu(e,t,n,r){let i=.5;for(;i>1/16&&!bu(e,Su(e.center,t,i),i,n,r);)i/=2;return{end:i,point:Su(e.center,t,i)}}function bu(e,t,n,r,i){for(let a=1;a<8;a++){let o=n*a/8,s=e=>Su(e[0],e[1],o),c=[r.map(s),...i.map(e=>e.map(s))];if(e.points.some(e=>Tu(Su(e,t,a/8),c)===0))return!1}return!0}function xu({from:e,to:t,end:n,opens:r},i){if(n===void 0)return Au(e,t,0,0,i,!0);let a=r?(i-(1-n))/n:i/n;return(r?a<=0:a>=1)?``:Au(e,t,0,0,a,!0)}let Su=(e,t,n)=>({x:Mu(e.x,t.x,n),y:Mu(e.y,t.y,n)});function Cu(e,t,n,r){let i=Eu(e.center,t,n.bounds);if(wu(i,r)>=e.size/4)return i;let{x:a,y:o,width:s,height:c}=n.bounds,l=n.center,u=wu(l,r);for(let e=0;e<9;e++)for(let t=0;t<9;t++){let n={x:a+s*(e+.5)/9,y:o+c*(t+.5)/9},i=wu(n,r);i>u&&([l,u]=[n,i])}return l}function wu(e,t){if(Tu(e,t)===0)return 0;let n=1/0;for(let r of t)r.forEach((t,i)=>{let a=r[(i+1)%r.length],o=a.x-t.x,s=a.y-t.y,c=o===0&&s===0?0:Math.max(0,Math.min(1,((e.x-t.x)*o+(e.y-t.y)*s)/(o*o+s*s)));n=Math.min(n,Math.hypot(e.x-t.x-c*o,e.y-t.y-c*s))});return n}function Tu(e,t){let n=0;for(let r of t)r.forEach((t,i)=>{let a=r[(i+1)%r.length],o=(a.x-t.x)*(e.y-t.y)-(e.x-t.x)*(a.y-t.y);t.y<=e.y&&a.y>e.y&&o>0?n++:t.y>e.y&&a.y<=e.y&&o<0&&n--});return n}function Eu(e,t,n){let r=(e,t,n)=>n>0?(e-t)/n:.5;return{x:n.x+r(e.x,t.x,t.width)*n.width,y:n.y+r(e.y,t.y,t.height)*n.height}}function Du(e,t){let n=G(je(e.d)).map(e=>e.segments).filter(e=>e.length>0);if(n.length<2)return[];let r=n.map(e=>e.reduce((e,t)=>e+t.length,0)),i=0;return r.forEach((e,t)=>{e>r[i]+Math.max(.01,r[i]/1e3)&&(i=t)}),n.filter((e,t)=>t!==i).map(e=>{let n=U([e]).sample(4*t),r=n.filter((e,t)=>t%4==0),i=I(e.flatMap(F));return{points:[r[0],...r.slice(1).reverse()],area:Math.abs(Ou(n)),center:{x:i.x+i.width/2,y:i.y+i.height/2},size:Math.max(i.width,i.height)/2}}).sort((e,t)=>t.area-e.area)}function Ou(e){let t=0;return e.forEach((n,r)=>{let i=e[(r+1)%e.length];t+=n.x*i.y-i.x*n.y}),t/2}function ku(e,t,n){let r=(e,t)=>({...e.outline.closed?{fill:`mark`}:{stroke:`mark`,width:e.thickness},...t===void 0?{}:{opacity:t}}),i,a;return o=>{o>=1?(i?.remove(),i=void 0,a?a.update(t.outline.d,{opacity:void 0}):a=n.path(t.outline.d,r(t))):a?(i?.update(e.outline.d,{opacity:1-o}),a.update(t.outline.d,{opacity:o})):e.outline.closed?(i=n.path(e.outline.d,r(e,1-o)),a=n.path(t.outline.d,r(t,o))):(a=n.path(t.outline.d,r(t,o)),i=n.path(e.outline.d,r(e,1-o)))}}function Au(e,t,n,r,i,a){let o=e.length,s=``;for(let a=0;a<o;a++)s+=`${a===0?`M`:`L`}${ju(e[(a+n)%o],t[(a+r)%o],i)}`;return a?`${s}Z`:s}let ju=(e,t,n)=>`${L(Mu(e.x,t.x,n))},${L(Mu(e.y,t.y,n))}`,Mu=(e,t,n)=>e*(1-n)+t*n;function Nu(e,t,n){let r=n/4,i=io(e);return i===io(t)?[0,0]:i?[0,r]:[r,0]}function Pu(e){return typeof e==`number`&&e>0?Math.min(1,e):0}function Fu(e){let{points:t,align:n}=e??{};if(t!==void 0&&!(Number.isInteger(t)&&t>=4&&t%4==0))throw RangeError(`morph: points must be a whole multiple of 4, got ${String(t)}.`);if(n!==void 0&&!au.includes(n))throw RangeError(`morph: align must be "unroll" or "drop", got ${typeof n==`string`?JSON.stringify(n):String(n)}.`)}function Iu(...e){let t=Hu(`sequence`,e);return Vu(t,async(e,n)=>{for(let r of t){if(n.signal.aborted)return;await e(r)}})}function Lu(...e){let t=Hu(`parallel`,e);return Vu(t,async e=>{await Promise.all(t.map(e))})}function Ru(e,t){if(typeof e!=`string`&&typeof e!=`function`)throw TypeError(`only needs a key, a series name or a predicate, got ${dt(e)}.`);let[n]=Hu(`only`,[t]),r=typeof e==`string`?t=>t.key===e||t.series===e:e;if(n.kind===`data`){let e=n;return{kind:`data`,...e.needs?{needs:e.needs}:{},run:(t,n,i)=>r(t)?e.run(t,n,i):Promise.resolve(),end:(t,n,i)=>{r(t)&&e.end(t,n,i)},clear:t=>e.clear(t)}}let i=n;return{kind:`geometry`,run:(e,t)=>r(e)?i.run(e,t):Promise.resolve(),end(e,t){r(e)&&i.end(e,t)},clear:e=>i.clear(e)}}function zu(e,t={}){let[n]=Hu(`stagger`,[e]),r=t.delay??50;if(!(typeof r==`number`&&r>=0&&Number.isFinite(r)))throw RangeError(`stagger: delay must be 0 ms or more, got ${String(r)}.`);let i=async(e,t,n)=>{if(n.signal.aborted)return;let{index:i,count:a}=n.batch,o=a>1?Math.min(r,500/(a-1)):0,s=i>0?i*o:0;if(!(s>0))return{mark:e,data:t};let c=Bu(e,t,n);return await n.tween({duration:s,timing:`stagger`,update:()=>{}}).finished,n.signal.aborted?void 0:c()};if(n.kind===`data`){let e=n;return{kind:`data`,...e.needs?{needs:e.needs}:{},run:async(t,n,r)=>{let a=await i(t,n,r);a&&await e.run(a.mark,a.data,r)},end:(t,n,r)=>e.end(t,n,r),clear:t=>e.clear(t)}}let a=n;return{kind:`geometry`,async run(e,t){let n=await i(e,void 0,t);n&&await a.run(n.mark,t)},end:(e,t)=>a.end(e,t),clear:e=>a.clear(e)}}function Bu(e,t,n){let r={mark:e,data:t};return n.onChange((e,t)=>{r={mark:e,data:t??r.data}}),()=>r}function Vu(e,t){let n=(e,t,n)=>{let r=Bu(e,t,n);return e=>{let{mark:t,data:i}=r();return e.kind===`data`?e.run(t,i,n):e.run(t,n)}},r=(t,n,r)=>{for(let i of e)i.kind===`data`?i.end(t,n,r):i.end(t,r)},i=t=>{let n;for(let r of e)try{r.clear(t)}catch(e){n??(n={error:e})}if(n)throw n.error};if(e.some(e=>e.kind===`data`)){let a=[...new Set(e.flatMap(e=>e.kind===`data`?e.needs?.related??[]:[]))];return{kind:`data`,...a.length>0?{needs:{related:a}}:{},run:(e,r,i)=>t(n(e,r,i),i),end:(e,t,n)=>r(e,t,n),clear:i}}return{kind:`geometry`,run:(e,r)=>t(n(e,void 0,r),r),end:(e,t)=>r(e,void 0,t),clear:i}}function Hu(e,t){return t.forEach((t,n)=>{if(!ut(t))throw TypeError(`${e}: part ${n+1} needs to be a mark effect (kind "geometry" or "data"), got ${dt(t)}.`)}),[...t]}let Uu=()=>{};function Wu(e){Ku(`defineEffect`,e);let t={kind:`geometry`,run:e.run,end:e.end,clear:e.clear??Uu};return Object.freeze(t)}function Gu(e){Ku(`defineDataEffect`,e);let t=qu(e.needs),n={kind:`data`,...t?{needs:t}:{},run:e.run,end:e.end,clear:e.clear??Uu};return Object.freeze(n)}function Ku(e,t){if(typeof t!=`object`||!t)throw TypeError(`${e} needs a spec object { run, end }, got ${t===null?`null`:typeof t}.`);let{run:n,end:r,clear:i}=t;if(typeof n!=`function`)throw TypeError(`${e}: run must be a function that animates the mark, got ${typeof n}.`);if(typeof r!=`function`)throw TypeError(`${e}: end must be a function that draws the final state, got ${typeof r}. Every effect needs one: reduced motion shows only end states.`);if(i!==void 0&&typeof i!=`function`)throw TypeError(`${e}: clear must be a function if it's given, got ${typeof i}.`)}function qu(e){if(e===void 0)return;let t=typeof e==`object`&&e?e.related:void 0;if(!(typeof e==`object`&&e&&(t===void 0||Array.isArray(t)&&t.every(e=>typeof e==`string`&&e!==``))))throw TypeError(`defineDataEffect: needs must be { related: [series names] }, got ${JSON.stringify(e)??String(e)}.`);return t===void 0?void 0:Object.freeze({related:Object.freeze([...t])})}let Ju=[`roll`,`step`,`slide`],Yu=[`butt`,`round`],Xu=[`miter`,`round`],Zu=[`nonzero`,`evenodd`],Qu=/^\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE.,+\-\s]*$/;function $u(e){let t=e?.name;if(typeof t!=`string`||t===``)throw TypeError(`defineIcon needs a non-empty string name, got ${JSON.stringify(t)}.`);let n=(e,n)=>{throw RangeError(`defineIcon: "${t}" ${e} ${n}.`)},r=(e,t)=>typeof t==`number`&&Number.isFinite(t)?t:n(e,`must be a finite number, got ${String(t)}`),i=(e,t)=>r(e,t)>0?t:n(e,`must be more than 0, got ${String(t)}`),a=(e,t)=>t&&typeof t==`object`?td({x:r(`${e}.x`,t.x),y:r(`${e}.y`,t.y)}):n(e,`must be a point { x, y }`);Array.isArray(e.shapes)&&e.shapes.length!==0||n(`shapes`,`must be a non-empty array`);let o=e.shapes.map((e,t)=>ed(e,`shapes[${t}]`,n,r)),s=e.box;s&&typeof s==`object`||n(`box`,`must be a rectangle { x, y, width, height }`);let c=td({x:r(`box.x`,s.x),y:r(`box.y`,s.y),width:i(`box.width`,s.width),height:i(`box.height`,s.height)}),l=a(`anchor`,e.anchor),u=e.pivot===void 0?l:a(`pivot`,e.pivot),d=e.footprint??[Math.max(0,l.x-c.x),Math.max(0,c.x+c.width-l.x)];Array.isArray(d)&&d.length===2||n(`footprint`,`must be [behind, ahead]`),d.forEach((e,t)=>{r(`footprint[${t}]`,e)<0&&n(`footprint[${t}]`,`can't be negative, got ${e}`)});let f=e.size===void 0?c.width:i(`size`,e.size),p=e.radius===void 0?c.height/2:i(`radius`,e.radius);return e.gait!==void 0&&!Ju.includes(e.gait)&&n(`gait`,`must be roll, step or slide, got ${String(e.gait)}`),e.upright!==void 0&&typeof e.upright!=`boolean`&&n(`upright`,`must be true or false, got ${String(e.upright)}`),td({name:t,shapes:td(o),box:c,size:f,anchor:l,pivot:u,footprint:td([d[0],d[1]]),...e.gait===void 0?{}:{gait:e.gait},radius:p,...e.upright===void 0?{}:{upright:e.upright}})}function ed(e,t,n,r){e&&typeof e==`object`||n(t,`must be a shape { d, fill?, stroke?, … }`),typeof e.d==`string`&&Qu.test(e.d)||n(`${t}.d`,`must be path data starting with a move`),e.clip===void 0||typeof e.clip==`string`&&Qu.test(e.clip)||n(`${t}.clip`,`must be path data starting with a move`);for(let r of[`fill`,`stroke`]){let i=e[r];i!==void 0&&(typeof i!=`string`||i===``)&&n(`${t}.${r}`,`must be a colour, got ${String(i)}`)}e.width!==void 0&&r(`${t}.width`,e.width)<0&&n(`${t}.width`,`can't be negative, got ${e.width}`),e.linecap!==void 0&&!Yu.includes(e.linecap)&&n(`${t}.linecap`,`must be butt or round, got ${String(e.linecap)}`),e.linejoin!==void 0&&!Xu.includes(e.linejoin)&&n(`${t}.linejoin`,`must be miter or round, got ${String(e.linejoin)}`),e.fillRule!==void 0&&!Zu.includes(e.fillRule)&&n(`${t}.fillRule`,`must be nonzero or evenodd, got ${String(e.fillRule)}`);for(let i of[`opacity`,`fillOpacity`,`strokeOpacity`]){let a=e[i]===void 0?1:r(`${t}.${i}`,e[i]);(a<0||a>1)&&n(`${t}.${i}`,`must be from 0 to 1, got ${a}`)}let i={d:e.d};for(let t of[`fill`,`stroke`,`width`,`linecap`,`linejoin`,`clip`,`fillRule`,`opacity`,`fillOpacity`,`strokeOpacity`])e[t]!==void 0&&(i[t]=e[t]);return td(i)}let td=e=>Object.freeze(e),nd=new Set([`svg`,`g`,`a`]),rd=new Set([`path`,`circle`,`rect`,`ellipse`,`line`,`polyline`,`polygon`]),id=/<![^<>]*>|<(\/?)([A-Za-z][\w:.-]*)((?:\s+[^\s=/<>]+(?:\s*=\s*(?:"[^"<]*"|'[^'<]*'|[^\s"'<>]+))?)*)\s*(\/?)>/g,ad=/([^\s=/<>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,od=/^(?:#[0-9a-fA-F]{3,8}|[a-zA-Z][a-zA-Z0-9-]*|(?:rgba?|hsla?)\([\d\s.,%+\-/]*\))$/;function sd(e,t){if(typeof e!=`string`)throw TypeError(`iconFromSvg needs SVG markup as a string.`);let n=typeof t?.name==`string`?`"${t.name}"`:`an icon`,r=e=>{throw RangeError(`iconFromSvg: ${n} ${e}.`)},i,a=1,o=[],s=[],c;for(let n of cd(e).matchAll(id)){let[,e,l,u=``,d]=n;if(l===void 0)continue;let f=l.toLowerCase();if(e){let e=gd(s,f);e>=0&&(s.length=e);continue}let p=ld(u),m=!i&&f===`svg`;m&&(i=ud(p)??r(`needs a viewBox, or a width and height in px, on its <svg>`),t.size!==void 0&&(typeof t.size==`number`&&t.size>0&&Number.isFinite(t.size)||r(`size must be more than 0, got ${String(t.size)}`),a=t.size/i.width),c={fill:`#000000`,stroke:`none`,width:1,linecap:void 0,linejoin:void 0,fillRule:`nonzero`,opacity:1,fillOpacity:1,strokeOpacity:1,transform:q.scale(a)});let h=s.length>0?s[s.length-1].state:m?c:void 0,g=h&&!pd(p)?md(h,p):void 0;if(g&&rd.has(f)){let e=hd(f,p,g);e&&o.push(e)}d||s.push({tag:f,state:nd.has(f)?g:void 0})}i||r(`needs an <svg> element`),o.length===0&&r(`has nothing to draw: no path, circle, rect, ellipse, line, polyline or polygon with a fill or stroke`);let l={x:i.x*a,y:i.y*a,width:i.width*a,height:i.height*a},u=e=>e&&typeof e==`object`?{x:e.x*a,y:e.y*a}:e;return $u({...t,shapes:o,box:l,anchor:u(t.anchor),...t.pivot?{pivot:u(t.pivot)}:{},...Array.isArray(t.footprint)?{footprint:[t.footprint[0]*a,t.footprint[1]*a]}:{},...typeof t.radius==`number`?{radius:t.radius*a}:{}})}function cd(e){let t=[[`<!--`,`-->`],[`<![CDATA[`,`]]>`],[`<?`,`?>`]],n=t.map(([t])=>e.indexOf(t)),r=``,i=0;for(;;){let a=-1;if(n.forEach((e,t)=>{e>=0&&(a<0||e<n[a])&&(a=t)}),a<0)return r+e.slice(i);let o=n[a],s=t[a][1];r+=e.slice(i,o);let c=e.indexOf(s,o+t[a][0].length);if(c<0)return r;i=c+s.length,n.forEach((r,a)=>{r>=0&&r<i&&(n[a]=e.indexOf(t[a][0],i))})}}function ld(e){let t=new Map;for(let[,n,r,i,a]of e.matchAll(ad))n!==void 0&&t.set(n,r??i??a??``);for(let e of(t.get(`style`)??``).split(`;`)){let n=e.indexOf(`:`);n>0&&t.set(e.slice(0,n).trim(),e.slice(n+1).replace(/!important/i,``).trim())}return t}function ud(e){let t=(e.get(`viewBox`)??``).trim().split(/[\s,]+/).map(Number);if(t.length===4&&t.every(Number.isFinite)&&t[2]>0&&t[3]>0)return{x:t[0],y:t[1],width:t[2],height:t[3]};let n=dd(e.get(`width`)),r=dd(e.get(`height`));return n!==void 0&&r!==void 0?{x:0,y:0,width:n,height:r}:void 0}function dd(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)\s*(?:px\s*)?$/i.exec(e??``),n=t?Number(t[1]):NaN;return n>0&&Number.isFinite(n)?n:void 0}function fd(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(%?)\s*$/i.exec(e??``);return t?Math.min(1,Math.max(0,Number(t[1])/(t[2]?100:1))):void 0}function pd(e){return e.get(`display`)?.trim()===`none`||e.get(`visibility`)?.trim()===`hidden`}function md(e,t){let n=(e,n)=>{let r=t.get(e)?.trim();if(r===void 0||!od.test(r))return n;let i=r.toLowerCase();return i===`inherit`?n:i===`currentcolor`?`text`:i===`none`?i:r},r=Number.parseFloat(t.get(`stroke-width`)??``),i=t.get(`stroke-linecap`)?.trim(),a=t.get(`stroke-linejoin`)?.trim(),o=t.get(`fill-rule`)?.trim().toLowerCase(),s=t.get(`transform`);return{fill:n(`fill`,e.fill),stroke:n(`stroke`,e.stroke),width:r>=0?r:e.width,linecap:i===`butt`||i===`round`?i:e.linecap,linejoin:a===`miter`||a===`round`?a:e.linejoin,fillRule:o===`nonzero`||o===`evenodd`?o:e.fillRule,opacity:e.opacity*(fd(t.get(`opacity`))??1),fillOpacity:fd(t.get(`fill-opacity`))??e.fillOpacity,strokeOpacity:fd(t.get(`stroke-opacity`))??e.strokeOpacity,transform:s?q.multiply(e.transform,et(s)):e.transform}}function hd(e,t,n){let r=_d(n.fillOpacity),i=_d(n.strokeOpacity),a=n.fill===`none`||!(r>0)?void 0:n.fill,o=n.stroke===`none`||!(n.width>0)||!(i>0)?void 0:n.stroke,s=_d(n.opacity);if(a===void 0&&o===void 0||!(s>0))return;let c=Pe(e,e=>t.get(e));if(!c.some(e=>e.op!==`M`))return;let l=n.transform;return{d:ze(Le(c,l)),...a===void 0?{}:{fill:a,...n.fillRule===`evenodd`?{fillRule:n.fillRule}:{},...r<1?{fillOpacity:r}:{}},...o===void 0?{}:{stroke:o,width:_d(n.width*Math.sqrt(Math.abs(l[0]*l[3]-l[1]*l[2]))),...n.linecap?{linecap:n.linecap}:{},...n.linejoin?{linejoin:n.linejoin}:{},...i<1?{strokeOpacity:i}:{}},...s<1?{opacity:s}:{}}}function gd(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].tag===t)return n;return-1}let _d=e=>Math.round(e*1e3)/1e3,vd=Object.freeze({dot:$u({name:`dot`,shapes:[{d:`M4,0A4,4 0 0 1 -4,0A4,4 0 0 1 4,0Z`,fill:`surface`,stroke:`text`,width:1.5}],box:{x:-5,y:-5,width:10,height:10},anchor:{x:0,y:0}}),arrow:$u({name:`arrow`,shapes:[{d:`M-7,-1.5L1,-1.5L1,-5L7,0L1,5L1,1.5L-7,1.5Z`,fill:`text`,stroke:`surface`,width:1.5,linejoin:`round`}],box:{x:-8,y:-6,width:16,height:12},anchor:{x:0,y:0}}),chevron:$u({name:`chevron`,shapes:[{d:`M-2.5,-5L2.5,0L-2.5,5`,stroke:`surface`,width:4.5,linecap:`round`,linejoin:`round`},{d:`M-2.5,-5L2.5,0L-2.5,5`,stroke:`text`,width:2,linecap:`round`,linejoin:`round`}],box:{x:-5,y:-7.5,width:10,height:15},anchor:{x:0,y:0}})}),yd=st({kind:`preset`,entries:{flash:()=>fl(),wiggle:()=>vl(),pulse:()=>Sl()},hint:`Register custom presets with registerPreset(name, factory).`}),bd=st({kind:`icon`,entries:vd,hint:`Register icons with registerIcon(icon) or registerIcons(icons).`});function xd(e,t){if(typeof t!=`function`)throw TypeError(`registerPreset("${e}") needs a function that returns an effect.`);yd.register(e,t)}function Sd(e){if(typeof e!=`object`||!e||typeof e.name!=`string`)throw TypeError(`registerIcon needs an icon with a name.`);bd.register(e.name,e)}function Cd(e){for(let t of e)Sd(t)}function wd(e){if(typeof e!=`object`||!e)throw TypeError(`configure needs an options object.`);if(`nonce`in e){if(e.nonce!==void 0&&(typeof e.nonce!=`string`||e.nonce===``))throw TypeError(`configure: nonce must be a non-empty string.`);yn.nonce=e.nonce}if(`injectStyles`in e){if(e.injectStyles!==void 0&&typeof e.injectStyles!=`boolean`)throw TypeError(`configure: injectStyles must be true or false.`);yn.injectStyles=e.injectStyles}}let Td={presets:yd,icons:bd,motion:v};function Ed(e,t){return zr(e,t,Td)}function Dd(e,t){return gi(e,t,Td)}function Od(e,t){return Ia(e,t,Td)}function kd(e,t){return fc(e,typeof t==`object`&&t&&t.transition===void 0?{...t,transition:ou()}:t,Td)}function Ad(e,t){return _s(e,t,Td)}function jd(e,t){return Us(e,t,Td)}function Md(e,t=v,n){return zc(e,t,n)}return e.VERSION=`0.9.0`,e.animated=C,e.barChart=Ed,e.chartSwitch=kd,e.colorAssignment=xn,e.configure=wd,e.createClock=n,e.createMotion=p,e.defaultClock=a,e.defaultScaling=u,e.defineDataEffect=Gu,e.defineEffect=Wu,e.defineIcon=$u,e.delta=Wl,e.describe=Ge,e.donutChart=Dd,e.drawIn=Dl,e.easeInOutCubic=s,e.easeOutCubic=c,e.expressive=Ad,e.flash=fl,e.fromVegaView=jd,e.gaits=$c,e.hostView=Bs,e.iconFromSvg=sd,e.icons=vd,e.interpolateNumber=b,e.interpolatePoint=x,e.interpolateRecord=S,e.label=Kl,e.lineChart=Od,e.linear=o,e.link=Mn,e.manualClock=r,e.matrix=q,e.mediaReducedMotion=h,e.morph=ou,e.motion=v,e.motionSwitch=Md,e.offset=tt,e.only=Ru,e.parallel=Lu,e.playButton=Gc,e.playback=w,e.pulse=Sl,e.registerIcon=Sd,e.registerIcons=Cd,e.registerPreset=xd,e.samplesAlong=rt,e.scaleDuration=m,e.sequence=Iu,e.stagger=zu,e.threshold=Jl,e.trace=Tl,e.travel=rl,e.tween=y,e.wiggle=vl,e})({});
|
|
96
|
+
`)?{}:{series:i.map(e=>qn(s.seriesLabels,e))},changed:o.map(a),added:c.map(a),removed:l.map(a),count:E.length});if(typeof r!=`function`){re.say(u);return}let d=e=>e.key;try{let e=r({text:u,changed:o.map(d),added:c.map(d),removed:l.map(d)});e!=null&&re.say(String(e))}catch(e){t(e)}}function kt(e){R=e;let t=ve(e),n={entering:[],exiting:[],changed:[]},r=new Set(e.rows.map(e=>e.key)),i=e.rows.length>0?e.series:[],a={changed:[],added:[],removed:[]},o=E,s=new Map(o.map(e=>[e,e.row])),c=new Map(e.rows.map(e=>[e.key,e])),l=A.filter(e=>!i.includes(e.series)),u=[];for(let e of o){let t=!r.has(e.key),n=c.get(e.key)?.missing;t&&(D.delete(e.key),e.leaving=!0,O.set(e.key,e),a.removed.push(e));for(let r of q(e))(t||!i.includes(r.series)||n?.has(r.series))&&u.push(r)}for(let e of l)j.delete(e.series);for(let e of u)M.delete(e.key);for(let e of[...l,...u])N.start(e);n.exiting.push(...l,...u);let d=new Set,f=a.removed.length>0;E=e.rows.map(e=>{let t=D.get(e.key);return t?(d.add(t),t.row.x!==e.x&&(f=!0),e.values.some((e,n)=>t.row.values[n]?.series!==e.series||t.row.values[n]?.value!==e.value)&&a.changed.push(t)):(t=O.get(e.key)??K(e,!0),O.delete(e.key),t.leaving=!1,t.x.set(e.x),t.values.set(e.levels),D.set(e.key,t),a.added.push(t),f=!0),t.row=e,t}),E.forEach((e,t)=>{d.has(e)?e.presence.value===1&&(e.anchor=void 0):e.anchor=Va(E,t,d)});for(let e of a.removed)e.anchor??(e.anchor=Va(o,o.indexOf(e),d));let p=A;A=i.map(e=>{let r=j.get(e),i=t.lines.get(e);if(r){let t=[...d].some(t=>za(s.get(t),e)!==za(t.row,e));(f||t)&&n.changed.push({record:r,from:r.shown.geometry})}else r=Nt(e,`line`)??Ce(e,i,!0),j.set(e,r),n.entering.push(r);return r.target=i,r});for(let e of E){let r=d.has(e)?s.get(e):void 0,a=i.filter(t=>!e.row.missing.has(t)).map(i=>{let a=ha(i,e.key),o=t.points.get(a),s=M.get(a);return s?r&&za(r,i)!==za(e.row,i)&&n.changed.push({record:s,from:s.shown.geometry}):(s=Nt(a,`point`)??we(e,o),s.row=e,M.set(a,s),n.entering.push(s)),s.target=o,s}),o=new Set(a);e.points=[...a,...e.points.filter(e=>!o.has(e)&&Te(e))]}for(let e of E)Tt(e);return mt(),lr(w,o.filter(e=>!e.leaving).map(e=>e.column),E.map(e=>e.column),xt.active),lr(v,p.map(e=>e.group),A.map(e=>e.group),()=>null),fe=a,ie=!0,ke(),n}function Nt(e,t){return N.get(e)?.kind===t?N.recall(e):void 0}function Pt(e,t){ie=!0;let{frame:n}=e;for(let[t,n,r]of[[le,e.yTicks,!0],[ue,e.xTicks,!1]]){let e=new Set(n.map(e=>e.value));for(let n of e)t.has(n)||Lt(t,n,0,r);for(let n of t.values())n.wanted=e.has(n.value)}for(let t of e.xTicks)ue.get(t.value).text=t.label.text;let r=Ee(),i=[...O.values()],a=Q(oe,n.scale,Sr)||[...le.values()].some(e=>Q(e.opacity,+!!e.wanted,$))||E.some(e=>Q(e.values,e.row.levels,Sr))||A.some(e=>Q(e.presence,1,$))||r.some(e=>Q(e.presence,0,$))||Q(ce,Ti(e.curve),$),o=Q(se,n.box,Sr)||[...ue.values()].some(e=>Q(e.opacity,+!!e.wanted,$))||E.some(e=>Q(e.x,e.row.x,$)||e.anchor!==void 0&&Q(e.presence,1,$))||i.some(e=>e.anchor!==void 0&&Q(e.presence,0,$)),s,l;!t&&c.staged?(s={duration:500},l={duration:500,delay:a?500:0}):t||(s=l={duration:(a&&o?2:1)*500});let u=[],d=(e,t,n,r)=>{Q(e,t,n)&&(r?u.push(e.to(t,r)):e.set(t))};d(oe,n.scale,Sr,s),d(ce,Ti(e.curve),$,s),d(se,n.box,Sr,l);for(let e of le.values())d(e.opacity,+!!e.wanted,$,s);for(let e of ue.values())d(e.opacity,+!!e.wanted,$,l);for(let e of E)d(e.values,e.row.levels,Sr,s),d(e.x,e.row.x,$,l),d(e.presence,1,$,e.anchor?l:void 0);for(let e of i)d(e.presence,0,$,e.anchor?l:void 0);for(let e of A)d(e.presence,1,$,s);for(let e of r)d(e.presence,0,$,s);return u}function Lt(e,t,n,r,i=``){let a={value:t,line:r?Y(`line`,{class:t===0?`ec-baseline`:`ec-gridline`},m):void 0,label:Y(`text`,{class:`ec-tick`},h),text:i,opacity:C(n,b,{clock:d,motion:c,onChange:ae}),wanted:!0};e.set(t,a);for(let t of[...e.values()].sort((e,t)=>e.value-t.value))t.line&&m.appendChild(t.line),h.appendChild(t.label)}function Rt(e,t){return R=e,de=Object.fromEntries(e.series.map(t=>[t,Math.max(de[t]??0,e.decimals[t]??0)])),me.run(Pt(e,t))}let zt=kr(p,c);function Bt(){if(I)return;let e=he(s),t=new Map(e.rows.map(e=>[e.key,e]));for(let e of E)e.row=t.get(e.key)??e.row;let n=ve(e);for(let e of A)e.target=n.lines.get(e.series)??e.target;for(let e of M.values())e.target=n.points.get(e.key)??e.target;Rt(e,!0)}let Vt=()=>{T.clear(),Bt()},Ht=Or(p,d,Vt),Ut=Er(i,d,F,e=>{F=e,s.width===void 0&&Bt()}),Wt=Dr(f,Vt);gr(p,s),St(),ne.render(z);{let e=ve(R);for(let e of R.yTicks)Lt(le,e.value,1,!0);for(let e of R.xTicks)Lt(ue,e.value,1,!1,e.label.text);E=R.rows.map(t=>{let n=K(t,!1);return D.set(t.key,n),n.points=R.series.filter(e=>!t.missing.has(e)).map(r=>{let i=we(n,e.points.get(ha(r,t.key)));return M.set(i.key,i),i}),Tt(n),n}),A=R.rows.length>0?R.series.map(t=>Ce(t,e.lines.get(t),!1)):[];for(let e of A)j.set(e.series,e);mt(),o===`point`&&w.setAttribute(`display`,`none`),je()}let Gt=()=>[...A,...E.flatMap(q)];xt.sync(),W.enter(Gt().map(Je));function Kt(e){let t=D.get(e);return o===`x`?(t??M.get(e)?.row)?.key:(M.get(e)??(t&&q(t)[0]))?.key}return An(xt.link,{element:p,async update(e){if(I)return;if(e.motion!==void 0&&e.motion!==s.motion)throw TypeError("lineChart: `motion` can't be changed by update() yet.");let t={...s,...e};yr(t,`lineChart`);let n=to(t);no(t);let i=`on`in e?vr(l,s.on,t.on,r.presets):l,a=he(t,i),o=wt(t,a),d=n===`x`?$a(t,a):void 0,f=n===`point`?eo(t,a):void 0;`colors`in e&&(u=Sn(t.colors));let m=s,h=R.series;s=t,B=d,V=f,gr(p,s),ne.render(o);let g=re!==void 0;s.announce&&!re?re=Ot(p):!s.announce&&re&&(re.destroy(),re=void 0),_t(n),xt.syncDim(),me.supersede();let _=i!==l;l=i;let v=xr({runner:W,events:P,hover:xt,leaving:N,input:Je,onScreen:Ye,data:`data`in e,..._?{swap:e=>{let t=new Set(e.entering);W.swap(i,Gt().filter(e=>!t.has(e)).map(Je))}}:{}},()=>kt(a),()=>{g&&Dt(m,h)});St();let y=Rt(a,c.mode===`off`);await me.wait(y,v)},reveal(e){if(I)return;if(e instanceof Date&&Number.isNaN(e.getTime()))throw RangeError(`lineChart: reveal(x) needs a valid Date, got an invalid Date.`);let t=e instanceof Date?e.getTime():e;if(typeof t!=`number`||Number.isNaN(t))throw RangeError(`lineChart: reveal(x) needs a number, got ${typeof t==`string`?JSON.stringify(t):String(t)}.`);let n=ye(R);ee=t,ye(R)!==n&&(Ae(),xt.dropGone(),xt.sync())},on:P.on,marks:()=>[...A.map(e=>e.shown.geometry),...E.filter(Se).flatMap(e=>q(e).map(e=>e.shown.geometry))],focus(e){let t=I?void 0:Kt(e);t!==void 0&&xt.focus(t)},leave(){I||xt.leave()},labels:()=>A.flatMap(e=>or(e.key,`value`,e.drawnLabel,e.label)),paintOf(e){let t=j.get(e);if(t)return{color:t.series,drawn:!0,...t.end.getAttribute(`visibility`)===`hidden`?{}:{end:oa,ring:2}};let n=M.get(e);return n&&(n.group.classList.contains(`ec-alone`)?{color:n.series,drawn:!0,ring:2}:{color:n.series,drawn:!1})},standsFor(e){return D.has(e)?[...R.series.map(t=>ha(t,e)),e]:[e]},moveTabStop(e){let t=I?void 0:Kt(e);return t!==void 0&&xt.moveTabStop(t)},destroy(){if(!I){I=!0,me.destroy(),xt.destroy(),W.destroy(),G.destroy(),te.destroy(),ne.destroy(),re?.destroy(),zt(),Ht(),Ut(),Wt();for(let e of[...E,...O.values()])for(let t of[e.x,e.values,e.presence])t.stop();for(let e of[...A,...Ee()])e.presence.stop();for(let e of N.values())e.leave?.resolve();oe.stop(),se.stop(),ce.stop();for(let e of[...le.values(),...ue.values()])e.opacity.stop();P.clear(),D.clear(),O.clear(),j.clear(),M.clear(),N.clear(),E=[],A=[],p.remove()}}})}function La(e){return{key:e.key,datum:e.datum,x:e.x,values:e.levels,missing:e.missing}}function Ra(e){return e.flatMap(e=>e.value===void 0?[]:[{series:e.series,value:e.value}])}function za(e,t){return e.values.find(e=>e.series===t)?.value}function Ba(e){return e.reduce((e,t)=>e+(t.value??0),0)}function Va(e,t,n){for(let r=t-1;r>=0;r--)if(n.has(e[r]))return e[r];for(let r=t+1;r<e.length;r++)if(n.has(e[r]))return e[r]}function Ha(e,t){return e.key===t.key&&!Cr(e,t)&&e.start.x===t.start.x&&e.start.y===t.start.y&&e.end.x===t.end.x&&e.end.y===t.end.y}function Ua(e,t){return e.datum!==t.datum||e.samples.length!==t.samples.length?!1:e.samples.every((e,n)=>{let r=t.samples[n];return e.t===r.t&&e.value===r.value&&Wa(e.at,r.at)&&e.gapBefore===r.gapBefore})}function Wa(e,t){return e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function Ga(e,t){return(e.x-t.x)**2+(e.y-t.y)**2}function Ka({geometry:e,data:{samples:t}},n,r,i,a){let o=t.findIndex(e=>Wa(e.at,n));if(o<0||!(e.length>0))return;let s=t[o].t,c=a/e.length,l;for(let n of[-1,1]){let a=r;for(let r=o;;r+=n){let o=t[r+n];if(!o||(n>0?o:t[r]).gapBefore)break;let u=n>0?Math.min(o.t,s+c):Math.max(o.t,s-c),d=e.path(u);if(l=Math.min(l??1/0,qa(i,a,d)),u!==o.t)break;a=d}}return l}function qa(e,t,n){let r=n.x-t.x,i=n.y-t.y,a=r*r+i*i,o=a>0?Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*i)/a)):0;return Math.hypot(e.x-t.x-o*r,e.y-t.y-o*i)}function Ja(e,t){return Ra(e).map(e=>({series:e.series,label:qn(t.seriesLabels,e.series),value:e.value}))}function Ya(e,t){let n=Xn(t),r=no(t);return e.map(e=>{let i=qn(t.seriesLabels,e.series);return e.value===void 0?`${i} ${r}`:`${n(e.value)} ${i}`})}function Xa(e,t){return e.missing.size===0?Mr(e.label,Ja(e.values,t),Xn(t),{total:!1}):{title:e.label,lines:[Ya(e.values,t).join(` · `)]}}function Za(e,t,n){return Mr(e.label,Ja(e.values,n).filter(e=>e.series===t),Xn(n),{total:!1})}function Qa(e,n,r){if(!e.markLabel)return r.text;try{let t=e.markLabel(n,r);if(t!=null&&String(t).trim()!==``)return String(t)}catch(e){t(e)}return r.text}function $a(e,t){let n=Xn(e);return new Map(t.rows.map(t=>{let r=`${t.label}: ${Ya(t.values,e).join(`, `)}`;return[t.key,Qa(e,t.datum,{key:t.key,category:t.label,values:Ja(t.values,e),total:Ba(t.values),format:n,text:r})]}))}function eo(e,t){let n=Xn(e);return new Map(t.rows.flatMap(t=>Ja(t.values,e).map(r=>{let i=ha(r.series,t.key),a=`${t.label}: ${n(r.value)} ${r.label}`;return[i,Qa(e,t.datum,{key:i,category:t.label,values:[r],total:r.value,format:n,text:a})]})))}function to(e){let{hover:t=`x`}=e;if(t!==`x`&&t!==`point`)throw TypeError(`lineChart: hover must be "x" or "point", got ${typeof t==`string`?JSON.stringify(t):String(t)}.`);return t}function no(e){let{missing:t=`missing`}=e;if(typeof t!=`string`||t.trim()===``)throw TypeError(`lineChart: missing must be a word for a missing value, such as "no data", got ${typeof t==`string`?JSON.stringify(t):String(t)}.`);return t}let ro=.5;function io(e){let t=ao(e.start,e.pivot);return t>ro&&Math.abs(ao(e.center,e.pivot)-t)<=ro&&Math.abs(ao(e.end,e.pivot)-t)<=ro}let ao=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y),oo=.5,so=[`left`,`right`,`top`,`bottom`];function co(e){return typeof e==`string`&&so.includes(e)}function lo(e,t){if(t!==`auto`)return e.map(()=>t);if(e.length===0)return[];let n=mo(e,e=>e.x,e=>e.x+e.width,`left`,`right`),r=mo(e,e=>e.y+e.height,e=>e.y,`bottom`,`top`);if(n&&r)return ho(e)?n:r;let i=n??r;if(!i)throw RangeError(`expressive: baseline "auto" found no edge that every mark grows from. Pass baseline: "left", "right", "top" or "bottom".`);return i}function uo(e,t,n){let r=po(t.map(e=>e.box)),i=go(r,n),a=t.map((e,t)=>({index:t,...i(e.box)})).sort((e,t)=>e.near-t.near||e.far-t.far||e.index-t.index),o=0,s=1/0,c=a.map(({index:e,near:n,far:r})=>{o>0&&r>n&&(s=Math.min(s,n-o));let i=Math.max(0,r-o);return o=Math.max(o,r),{series:t[e].series,size:i}}),l=t[a[a.length-1].index],u=t.length===1?t[0].series:void 0;return{geometry:me({key:e,...u===void 0?{}:{series:u},...r,baseline:n,radius:l.radius,gap:Number.isFinite(s)?Math.max(0,_o(s)):0,...c.every(e=>e.series!==void 0)?{segments:c.map(e=>({series:e.series,size:_o(e.size)}))}:{}}),order:a.map(e=>e.index)}}function fo(e,t){let n=t[0]===`left`||t[0]===`right`,r=e=>n?e.y:e.x,i=e=>n?e.x:e.y;return e.map((e,t)=>t).sort((t,n)=>r(e[t])-r(e[n])||i(e[t])-i(e[n])||t-n)}function po(e){let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,width:_o(Math.max(...e.map(e=>e.x+e.width))-t),height:_o(Math.max(...e.map(e=>e.y+e.height))-n)}}function mo(e,t,n,r,i){let a=e[0];if(!a)return[];for(let o of[t(a),n(a)]){let a=[];for(let s of e)if(Math.abs(t(s)-o)<oo)a.push(r);else if(Math.abs(n(s)-o)<oo)a.push(i);else break;if(a.length===e.length)return a}}function ho(e){let t=e=>Math.max(...e)-Math.min(...e),n=t(e.map(e=>e.y+e.height/2)),r=t(e.map(e=>e.x+e.width/2));return n===r?e[0].width>=e[0].height:n>r}function go(e,t){switch(t){case`left`:return t=>({near:t.x-e.x,far:t.x+t.width-e.x});case`right`:return t=>({near:e.x+e.width-(t.x+t.width),far:e.x+e.width-t.x});case`top`:return t=>({near:t.y-e.y,far:t.y+t.height-e.y});case`bottom`:return t=>({near:e.y+e.height-(t.y+t.height),far:e.y+e.height-t.y})}}function _o(e){return Math.round(e*1e3)/1e3}function vo(){let e=new Map,t=t=>{let n=e.get(t);return n||(n={attributes:new Map,styles:new Map,classes:new Set,before:{}},e.set(t,n)),n},n=e=>e.style,r=(e,t,n)=>{n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)},i=(e,t)=>{let i=t.before.style;t.styles.size>0||!i||(t.before.style=void 0,n(e)?.cssText===i.css&&r(e,`style`,i.text))},a=(e,t)=>{let n=t.before.class;if(t.classes.size>0||n===void 0)return;t.before.class=void 0;let i=e=>[...new Set((e??``).split(/\s+/).filter(Boolean))].sort().join(` `);i(e.getAttribute(`class`))===i(n)&&r(e,`class`,n)};function o(e,n,i){let a=e.getAttribute(n),o=t(e).attributes,s=o.get(n);s?(a!==s.written&&(s.original=a),s.written=i):o.set(n,{original:a,written:i}),r(e,n,i)}function s(t,n,i){if(i!==null){o(t,n,i);return}let a=e.get(t)?.attributes,s=a?.get(n);a&&s&&(t.getAttribute(n)===s.written&&r(t,n,s.original),a.delete(n))}function c(e,r,a){let o=n(e);if(!o)return;let s=t(e),c=s.styles.get(r);if(a===void 0){if(!c)return;c.value===``?o.removeProperty(r):o.setProperty(r,c.value,c.priority),s.styles.delete(r),i(e,s)}else c||(s.styles.size===0&&(s.before.style={text:e.getAttribute(`style`),css:o.cssText}),s.styles.set(r,{value:o.getPropertyValue(r),priority:o.getPropertyPriority(r)})),o.getPropertyValue(r)!==a&&o.setProperty(r,a)}function l(n,r,i){let o=n.classList;if(i){if(o.contains(r))return;let e=t(n);e.classes.size===0&&(e.before.class=n.getAttribute(`class`)),e.classes.add(r),o.add(r);return}let s=e.get(n);s?.classes.delete(r)&&(o.remove(r),a(n,s))}function u(t){let n=e.get(t);if(n){for(let e of[...n.styles.keys()])c(t,e,void 0);for(let e of[...n.classes])l(t,e,!1);for(let e of[...n.attributes.keys()])s(t,e,null);e.delete(t)}}return{attribute:s,remove:(e,t)=>o(e,t,null),style:c,styled:(t,n)=>e.get(t)?.styles.has(n)??!1,toggleClass:l,restore:u,restoreAll(){for(let t of[...e.keys()])u(t)},elements:()=>[...e.keys()]}}function yo(){let e=new Map;return t=>(e.has(t)||e.set(t,Ao(t)),e.get(t))}function bo(e,t,n,r=Ao){let i=r(e),a=i&&r(t);return i&&a?J.multiply(Qe(i),a):J.multiply(Qe(jo(e,n)),jo(t,n))}function xo(e,t){if(So(t))return e;let n=e=>J.apply(t,e),r=e=>Re(Ie(Ae(e),t)),i=Eo(t),{outline:a}=e;return{key:e.key,...e.series===void 0?{}:{series:e.series},start:n(e.start),end:n(e.end),length:e.length*i,path:t=>n(e.path(t)),angle:n=>{let r=e.angle(n),i=Math.cos(r),a=Math.sin(r);return Math.atan2(t[1]*i+t[3]*a,t[0]*i+t[2]*a)},slice:(t,n)=>r(e.slice(t,n)),...e.gaps===void 0?{}:{gaps:e.gaps},thickness:e.thickness*i,outline:{d:r(a.d),closed:a.closed,sample:e=>a.sample(e).map(n)},bounds:Do(t,e.bounds),center:n(e.center),pivot:n(e.pivot),...e.segments===void 0?{}:{segments:e.segments.map(e=>xo(e,t))}}}let So=e=>e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1&&e[4]===0&&e[5]===0;function Co(e){return $e(e.getAttribute(`transform`)??``)}function wo(e){let[t,n,r,i]=e,a=1e-9*Math.max(Math.abs(t),Math.abs(n),Math.abs(r),Math.abs(i));return Math.abs(n)<=a&&Math.abs(r)<=a||Math.abs(t)<=a&&Math.abs(i)<=a}function To(e){let[t,n,r,i]=e,a=t*t+n*n,o=r*r+i*i,s=1e-4*Math.max(a,o);return Math.abs(a-o)<=s&&Math.abs(t*r+n*i)<=s}function Eo(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))}function Do(e,t){let n=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x,y:t.y+t.height},{x:t.x+t.width,y:t.y+t.height}].map(t=>J.apply(e,t)),r=n.map(e=>e.x),i=n.map(e=>e.y),a=Mo(Math.min(...r)),o=Mo(Math.min(...i));return{x:a,y:o,width:Mo(Mo(Math.max(...r))-a),height:Mo(Mo(Math.max(...i))-o)}}function Oo(e){let t=ko(e),n=e=>{let n=Number.parseFloat(t(e)??``);return Number.isFinite(n)?n:0};return{x:n(`x`),y:n(`y`),width:Math.max(0,n(`width`)),height:Math.max(0,n(`height`))}}function ko(e){return t=>{if(!e.hasAttribute(t))return null;let n=e[t];return typeof n?.baseVal?.value==`number`?String(n.baseVal.value):e.getAttribute(t)}}function Ao(e){let t=typeof e.getScreenCTM==`function`?e.getScreenCTM():null;return t?[t.a,t.b,t.c,t.d,t.e,t.f]:void 0}function jo(e,t){let n=[1,0,0,1,0,0];for(let r=e;r&&r!==t;r=r.parentElement)n=J.multiply(Co(r),n);return n}function Mo(e){return Math.round(e*1e3)/1e3}function No(e,t,n){let r={},i=!1,a=Rn(),o=()=>{let{transform:n,opacity:a,emphasis:o}=r;for(let r of e()){let{element:e,colors:s}=r,c=n&&r.parentInverse?J.multiply(r.parentInverse,n,r.parent,Co(e)):void 0;t.style(e,`transform`,c&&Ko(c)),t.style(e,`transform-origin`,c&&`0 0`),t.style(e,`transform-box`,c&&`view-box`),t.style(e,`opacity`,a===void 0?void 0:String(a));let l=s?o===void 0?i?s.strong:void 0:Go(s,o):void 0;t.style(e,`fill`,s?.paint===`fill`?l:void 0),t.style(e,`stroke`,s?.paint===`stroke`?l:void 0),t.style(e,`transition`,o===void 0||!s?void 0:`none`)}s()},s=()=>{let t=e().flatMap(e=>e.outline===void 0?[]:[{...e.outline,color:e.colors?.color}]);a.paint(n(),t,r.halo,r.transform)};return{get style(){return r},set(e){r=dt(r,e),o()},reset(){r={},o()},repaint:o,hot(e){e!==i&&(i=e,o())}}}function Po(e,t){let n=Vo(e,t,`fill`),r=n===Ro?`stroke`:`fill`,i=r===`fill`?n:Vo(e,t,`stroke`);if(i!==void 0&&i!==Ro)return{...Fo(i),paint:r}}function Fo(e){return{color:e,strong:`color-mix(in oklab, ${e}, ${mn(`text`)} ${Lo})`}}function Io(e,t,n){let r=e.ownerDocument.defaultView?.getComputedStyle?.(e).getPropertyValue(n).trim()??``;if(Bo(t))return r;for(let r=e;r;r=r===t?null:r.parentElement){let e=r.style?.getPropertyValue(n)||r.getAttribute(n);if(e)return e.trim()}return r}let Lo=`25%`,Ro=`none`,zo=new WeakMap;function Bo(e){let t=zo.get(e);if(t!==void 0)return t;let n=e.ownerDocument.defaultView;if(!e.isConnected||typeof n?.getComputedStyle!=`function`)return!1;let r=e.ownerDocument.createElementNS(`http://www.w3.org/2000/svg`,`g`);r.setAttribute(`stroke-miterlimit`,`7`),e.appendChild(r);let i=n.getComputedStyle(r).getPropertyValue(`stroke-miterlimit`).trim()===`7`;return r.remove(),zo.set(e,i),i}function Vo(e,t,n){let r=e.ownerDocument.defaultView?.getComputedStyle?.(e).getPropertyValue(n),i=Wo(r);if(r&&Bo(t))return i;let a;for(let r=e;r&&a===void 0;r=r===t?null:r.parentElement){let e=r.style?.getPropertyValue(n)||r.getAttribute(n);e&&(a=e)}let o=n===`fill`?i?.replace(/\s/g,``)===`rgb(0,0,0)`:i===Ro;return i!==void 0&&!(o&&a!==void 0)?i:Wo(a)}function Ho(e,t){let n=e.ownerDocument.defaultView?.getComputedStyle?.(e),r=n?.getPropertyValue(`stroke-width`),i=Uo(r),a=n?.getPropertyValue(`vector-effect`).trim().toLowerCase(),o=e.style?.getPropertyValue(`vector-effect`)?a:e.getAttribute(`vector-effect`)?.trim().toLowerCase(),s=(a&&(a!==`none`||Bo(t))?a:o)===`non-scaling-stroke`;if(r&&Bo(t)||i!==void 0&&i!==1)return{width:i,screen:s};for(let n=e;n&&!n.style?.getPropertyValue(`stroke-width`);n=n===t?null:n.parentElement){let e=Uo(n.getAttribute(`stroke-width`));if(e!==void 0)return{width:e,screen:s}}return{width:i,screen:s}}function Uo(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)\s*(?:px\s*)?$/i.exec(e??``),n=t?Number(t[1]):NaN;return n>=0&&Number.isFinite(n)?n:void 0}function Wo(e){let t=e?.trim().toLowerCase();if(t&&t!==`inherit`&&!t.startsWith(`url(`))return t===Ro||t===`transparent`||/^rgba\((?:[^,]+,){3}\s*0(?:\.0*)?\s*\)$/.test(t)?Ro:e.trim()}function Go(e,t){let n=Math.min(1,Math.max(0,t));return n===0?e.color:n===1?e.strong:`color-mix(in srgb, ${e.strong} ${Math.round(n*1e3)/10}%, ${e.color})`}function Ko(e){return`matrix(${e.map((e,t)=>t<4?Math.round(e*1e6)/1e6:Math.round(e*1e3)/1e3).join(`, `)})`}function qo(e,t){let n=Eo(t);if(!To(t)||!(n>0)||e.length>32||e.some(e=>e.op===`C`||e.op===`Q`))return;let r=.5/n,i=K(e);if(i.length===0||i.length>2||!i.every(ns))return;let a=i.map(e=>ts(e.segments,r)),o=i.length===2?Jo(a[0],a[1],r):Yo(a[0],r);return o&&es(o,t)}function Jo(e,t,n){let[r,i]=[e[0],t[0]];if(e.length!==1||t.length!==1||r?.kind!==`arc`||i?.kind!==`arc`)return;let[a,o]=r.radius>=i.radius?[r,i]:[i,r],s=(e,t)=>Math.abs(Math.abs(e)-O)*t<=n;for(let e of[Qo(a),a.arcs[0].center]){if(!e)continue;let[t,r]=[is(a.from,e),is(o.from,e)],[i,c]=[Zo(a,e),Zo(o,e)];if(t>n&&t-r>n&&Math.sign(i)!==Math.sign(c)&&s(i,t)&&s(c,r)&&$o(a,e,t,n)&&$o(o,e,r,n))return{center:e,inner:r,outer:t,start:rs(a.from,e),sweep:Math.sign(i)*O}}}function Yo(e,t){let n=-1;if(e.forEach((t,r)=>{t.kind===`arc`&&(n<0||t.radius>e[n].radius)&&(n=r)}),n<0)return;let r=[...e.slice(n),...e.slice(0,n)],i=r[0],[,a,o,s]=r,c=r.length===3&&a?.kind===`line`&&o?.kind===`line`,l=r.length===4&&a?.kind===`line`&&o?.kind===`arc`&&s?.kind===`line`?o:void 0;if(!c&&!l)return;let[u,d]=l?[l.from,l.to]:[a.to,a.to],f=(e,n)=>{let r=is(e,n);return r>t?{x:e.x+(n.x-e.x)*i.radius/r,y:e.y+(n.y-e.y)*i.radius/r}:void 0},p=f(i.from,d),m=f(i.to,u);if(!p||!m)return;let h={x:(p.x+m.x)/2,y:(p.y+m.y)/2};c&&is(u,h)<=t&&(h=u);let g=h===u?0:(is(u,h)+is(d,h))/2,_=Zo(i,h);if(_===0)return;let v={center:h,inner:g,outer:(is(i.from,h)+is(i.to,h))/2,start:rs(i.from,h),sweep:_};return Xo(v,i,l,[u,d],t)?v:void 0}function Xo(e,t,n,[r,i],a){let{center:o,start:s,sweep:c}=e,l=(e,t)=>({x:o.x+e*Math.cos(t),y:o.y+e*Math.sin(t)});return e.outer>a&&e.outer-e.inner>a&&is(t.from,l(e.outer,s))<=a&&is(t.to,l(e.outer,s+c))<=a&&$o(t,o,e.outer,a)&&is(r,l(e.inner,s+c))<=a&&is(i,l(e.inner,s))<=a&&(!n||Math.abs(Zo(n,o)+c)*e.inner<=a&&$o(n,o,e.inner,a))}function Zo(e,t){let n=0;for(let r of e.arcs){let e=P(rs(j(r,1),t)-rs(j(r,0),t));n+=e+O*Math.round((r.sweep-e)/O)}return n}function Qo(e){let t=[e.from,...e.arcs.slice(0,-1).map(e=>j(e,1))];if(t.length<2)return;if(t.length===2)return{x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2};let[n,r,i]=[t[0],t[Math.floor(t.length/3)],t[Math.floor(2*t.length/3)]],a=2*(n.x*(r.y-i.y)+r.x*(i.y-n.y)+i.x*(n.y-r.y));if(!(Math.abs(a)>0))return;let[o,s,c]=[n,r,i].map(({x:e,y:t})=>e*e+t*t);return{x:(o*(r.y-i.y)+s*(i.y-n.y)+c*(n.y-r.y))/a,y:(o*(i.x-r.x)+s*(n.x-i.x)+c*(r.x-n.x))/a}}let $o=(e,t,n,r)=>Math.abs(e.radius-n)<=r&&e.arcs.every(e=>[0,.5,1].every(i=>Math.abs(is(j(e,i),t)-n)<=r));function es(e,t){let n=Eo(t),r=J.apply(t,e.center),i=J.apply(t,{x:e.center.x+e.outer*Math.cos(e.start),y:e.center.y+e.outer*Math.sin(e.start)}),a=t[0]*t[3]-t[1]*t[2]<0?-e.sweep:e.sweep,o=((rs(i,r)+Math.PI/2)%O+O)%O;return o>O-1e-9&&(o=0),{cx:as(r.x),cy:as(r.y),inner:as(e.inner*n),outer:as(e.outer*n),start:o,end:o+a}}function ts(e,t){let n=[],r=(e,n)=>e!==void 0&&Math.sign(e.sweep)===Math.sign(n.sweep)&&Math.abs(e.radius-n.radius)<=t;for(let t of e){let e=n[n.length-1];t.kind===`line`?n.push({kind:`line`,from:t.from,to:t.to}):e?.kind===`arc`&&r(e,t)?n[n.length-1]={...e,arcs:[...e.arcs,t],to:j(t,1),sweep:e.sweep+t.sweep}:n.push({kind:`arc`,arcs:[t],from:j(t,0),to:j(t,1),radius:t.radius,sweep:t.sweep})}let[i]=n,a=n[n.length-1];return n.length>1&&i?.kind===`arc`&&a?.kind===`arc`&&a.arcs.every(e=>r(i,e))&&(n[0]={...i,arcs:[...a.arcs,...i.arcs],from:a.from,sweep:a.sweep+i.sweep},n.pop()),n}let ns=({closed:e,start:t,end:n})=>e||t.x===n.x&&t.y===n.y,rs=(e,t)=>Math.atan2(e.y-t.y,e.x-t.x),is=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),as=e=>Math.round(e*1e3)/1e3+0;function os(e){if(typeof e==`string`){if(typeof document>`u`)throw TypeError(`expressive: a selector needs a document.`);return{elements:Array.from(document.querySelectorAll(e)),data:void 0}}if(us(e))return{elements:[e],data:void 0};if(ds(e)){let t=Array.from(e.nodes()),n=Array.from(e.data());return{elements:t,data:n.length===t.length?n:void 0}}if(typeof e==`object`&&e&&typeof e.length==`number`)return{elements:Array.from(e),data:void 0};throw TypeError(`expressive needs marks: a selector, an element, a list of elements or a D3 selection.`)}function ss(e){if(!ds(e))return;let{elements:t,data:n}=os(e);return n&&new Map(t.map((e,t)=>[e,n[t]]))}function cs(e){let t;for(let n of e){if(!us(n))throw TypeError(`expressive: marks must be elements, got ${String(n)}.`);let e=n.ownerSVGElement??null;if(!e){let e=n.localName;throw TypeError(e===`svg`?`expressive: got an <svg>, not its marks. Pass the marks, for example svg.querySelectorAll("rect").`:`expressive: marks must be SVG elements inside an <svg>, got <${e}>.`)}for(;e.ownerSVGElement;)e=e.ownerSVGElement;if(t&&e!==t)throw TypeError(`expressive: all marks must be in the same <svg>.`);t=e}if(!t)throw TypeError(`expressive: no marks.`);return t}function ls(e,t){let n=e[0].parentElement??t;for(;n!==t&&!e.every(e=>e!==n&&n.contains(e));)n=n.parentElement??t;return n}function us(e){return typeof e==`object`&&!!e&&e.nodeType===1}function ds(e){return typeof e==`object`&&!!e&&typeof e.nodes==`function`&&typeof e.data==`function`}let fs=[`d`,`x`,`y`,`width`,`height`,`cx`,`cy`,`r`,`rx`,`ry`,`x1`,`y1`,`x2`,`y2`,`points`,`transform`],ps=[`transform`,`style`];function ms(e,t,n){let r=e.defaultView?.MutationObserver??(typeof MutationObserver>`u`?void 0:MutationObserver);if(!r)throw TypeError(`expressive: watch needs MutationObserver, which this DOM doesn't have.`);let i=new Set,a=new Set,o=new Set,s=new Set,c,l=e=>{for(let{target:t,attributeName:n}of e){let e=t;o.has(e)&&i.add(e),s.has(e)&&(n===`transform`||n===`style`)&&a.add(e)}},u=new r(e=>{l(e),(i.size>0||a.size>0)&&!c&&(c=t.onFrame(d))});function d(){if(l(u.takeRecords()),i.size===0&&a.size===0){c?.(),c=void 0;return}let e={marks:i,ancestors:a};i=new Set,a=new Set,n(e)}function f(){u.takeRecords(),c?.(),c=void 0,i=new Set,a=new Set}return{observe(e,t){f(),u.disconnect(),o=new Set(e),s=new Set;for(let n of e)for(let e=n.parentElement;e&&!s.has(e);e=e===t?null:e.parentElement)s.add(e);for(let e of s)o.has(e)||u.observe(e,{attributes:!0,attributeFilter:ps});for(let e of o)u.observe(e,{attributes:!0,attributeFilter:fs})},destroy(){f(),u.disconnect(),o=new Set,s=new Set}}}let hs=new Set([`circle`,`ellipse`,`line`,`path`,`polygon`,`polyline`]),gs=new Set([`img`,`image`,`graphics-symbol`,`graphics-object`]),_s=new WeakMap,vs=e=>e?_s.get(e):void 0;function ys(e,n,r){bs(n);let i=Pn(n.motion,r.motion),o=ct(n.on,r.presets),s=n.on,c=r.clock??a,l=n.dim===!0,u=vo(),d=new WeakMap,f=e,p=!1,m=!1;function h(e){let{elements:t,data:r}=os(e);if(t.length===0)return{root:void 0,ancestor:void 0,marks:[]};let i=cs(t),a=ls(t,i),s=new Map;t.forEach((e,t)=>{let i=E(e,t,r),a=n.key(i,e);if(a==null||a===``)throw TypeError(`expressive: key returned ${JSON.stringify(a)??String(a)} for a <${e.localName}>. Every mark needs a key.`);let o=String(a),c=e.localName;if(!n.geometry&&c!==`rect`&&!hs.has(c))throw TypeError(`expressive: can't read the geometry of a <${c}> (mark "${o}"). <rect>, <circle>, <ellipse>, <line>, <path>, <polygon> and <polyline> are read; describe others with the geometry option.`);let l=D(i,e,o),u=s.get(o);if(!u)s.set(o,u=[]);else if(!n.geometry&&(hs.has(c)||hs.has(u[0].element.localName))){let e=hs.has(c)?c:u[0].element.localName;throw TypeError(`expressive: two elements have the key "${o}", and one is a <${e}>. A circle or a shape is a mark of its own: give each its own key.`)}else if(l===void 0)throw RangeError(`expressive: two elements have the key "${o}". Keys must be unique, or name each part with segment.`);else if(u.some(e=>e.series===l))throw RangeError(`expressive: the mark "${o}" has two "${l}" segments.`);u.push({element:e,datum:i,series:l,value:n.value?.(i,e)})});let c={svg:i,common:a,screen:yo(),colors:e=>k(e,i),stroke:e=>Ho(e,i)},l=e=>({...e,label:O(e.key,e.parts)}),u=[...s.keys()];if(n.geometry)return{root:i,ancestor:a,marks:T(w(Ds(u.map((e,t)=>l(g(e,s.get(e),t,c))),e=>e.geometry)),o)};let d=[],f=[];u.forEach((e,t)=>{let n=s.get(e);if(n[0].element.localName===`rect`&&!_(n,c))d.push(t);else{let r=b(e,n[0],t,c);r&&f.push(r)}});let p=d.map(e=>s.get(u[e]).map(t=>v(u[e],t,c))),m=p.map(e=>po(e.map(e=>e.rect.box))),h=lo(m,n.baseline??`auto`),x=e=>y(u[d[e]],p[e],h[e],d[e],c);return{root:i,ancestor:a,marks:T(w(f.length===0?fo(m,h).map(e=>l(x(e))):Ds([...d.map((e,t)=>x(t)),...f].sort((e,t)=>e.index-t.index),e=>e.geometry).map(e=>l(e))),o)}}function g(e,t,r,i){let a=t[0],o=n.geometry(a.element,a.datum,e);if(typeof o!=`object`||!o||o.key!==e)throw TypeError(`expressive: geometry for "${e}" must be a MarkGeometry with the key "${e}". Build it with describe and the key passed in.`);return{key:e,geometry:o,parts:t.map(e=>C(e,ks(o,e.series,t.length),i)),index:r}}function _(e,t){return e.length===1&&!wo(S(e[0].element,t))}function v(e,t,n){let r=S(t.element,n);if(!wo(r))throw TypeError(`expressive: the <rect> of "${e}" is rotated or skewed, so it isn't an upright bar's segment. A rect turned on its own is a shape, a mark of its own: give each its own key, or describe the bar with the geometry option.`);return{...t,rect:{box:Do(r,Oo(t.element)),series:t.series,radius:As(t.element)}}}function y(e,t,n,r,i){let{geometry:a,order:o}=uo(e,t.map(e=>e.rect),n),s=a.segments??[];return{key:e,geometry:a,parts:o.map((e,n)=>{let r=s[n];return C(t[e],r&&r.length>=.5?{d:r.outline.d}:void 0,i)}),index:r,rect:{edge:n,box:po(t.map(e=>e.rect.box))}}}function b(e,t,n,r){let{element:i,series:a}=t,o=i.localName,s=S(i,r),c=ko(i),l=e=>{let t=Number.parseFloat(c(e)??``);return Number.isFinite(t)?t:0},u=o===`circle`?l(`r`):0,d,f;if(o===`circle`&&(To(s)||!(u>0))){let t=J.apply(s,{x:l(`cx`),y:l(`cy`)});d=be({key:e,series:a,x:js(t.x),y:js(t.y),r:js(Math.max(0,u)*Eo(s))})}else{let t=Ne(o,c);if(t[0]?.op!==`M`||t.every(e=>e.op===`M`))return;f=o===`circle`?void 0:r.stroke(i);let n=o===`path`?qo(t,s):void 0;if(n)d=fe({key:e,series:a,...n});else{let n=js(x(f,s,r));d=ze({key:e,series:a,d:o===`path`?c(`d`)??``:Re(t),matrix:s,width:n>0?n:1})}}let p=[{...C(t,ks(d,a,1),r),stroke:f}];return{key:e,geometry:d,parts:p,index:n,...o===`circle`?{circle:!0}:{}}}function x(e,t,n){let r=e?.width??1;if(!e?.screen)return r*Eo(t);let i=n.screen(n.common),a=i?Eo(i):0;return a>0?r/a:r}function S(e,t){return J.multiply(bo(t.common,e.parentElement??t.svg,t.svg,t.screen),Co(e))}function C(e,t,n){let r=bo(n.common,e.element.parentElement??n.svg,n.svg,n.screen);return{element:e.element,datum:e.datum,series:e.series,value:e.value,parent:r,parentInverse:Ms(r),colors:n.colors(e.element),outline:t}}function w(e){return e.map(e=>{let{key:t,geometry:r,parts:i}=e,a=e.rect?Cs(i):void 0,o=i[0].value,s=e.circle&&typeof o==`number`&&Number.isFinite(o)?o:void 0,c=(e,i,o)=>n.samples?Ts(n.samples(e,i),o===void 0?`"${t}"`:`"${t}" (${o})`):a===void 0?s===void 0?[]:[{t:0,value:s}]:ws(r,i,a),l=new Map,u=e=>l.get(e)??Be(e,t);for(let t of Ss(e)){let e=(i.find(e=>e.series===t)??i[0]).datum;l.set(t,{datum:e,samples:c(e,r.segments?.find(e=>e.series===t)??r,t),related:u})}return{...e,data:{datum:i[0].datum,samples:c(i[0].datum,r),related:u}}})}function T(e,t){if(e.length===0)return e;let n=new Set(e.flatMap(e=>[...e.geometry.series===void 0?[]:[e.geometry.series],...Ss(e)]));for(let e of st){let r=t[e];if(r?.kind===`data`)for(let t of r.needs?.related??[]){if(n.has(t))continue;let r=n.size>0?`the marks' series are ${[...n].map(e=>`"${e}"`).join(`, `)}`:`the marks have no series`;throw RangeError(`expressive: on.${e} needs the series "${t}", but ${r}. Name each mark's series in its geometry (describe.line({ key, series, … })), or a stack's parts with segment.`)}}return e}function E(e,t,r){if(n.datum)return n.datum(e);if(r)return r[t];let i=e.__data__;return typeof i==`number`&&!p&&(p=!0,console.warn(`expressive: element.__data__ is a number, which looks like Observable Plot's row index. Pass datum: (el) => rows[el.__data__].`)),i}function D(e,t,r){if(!n.segment)return;let i=n.segment(e,t);if(i==null||i===``)throw TypeError(`expressive: segment returned ${String(i)} for a part of "${r}".`);return String(i)}function O(e,r){if(n.markLabel)try{let t=String(n.markLabel(r[0].datum,{key:e,parts:r.map(({series:e,datum:t})=>({series:e,datum:t}))})??``);return t.trim()===``?void 0:t}catch(e){t(e);return}}function k(e,t){if((u.styled(e,`fill`)||u.styled(e,`stroke`))&&d.has(e))return d.get(e);let n=Po(e,t);return d.set(e,n),n}let A=h(f),j=A.root?.ownerDocument??(typeof document>`u`?void 0:document);if(!j)throw TypeError(`expressive needs a DOM.`);bn(j);let M,N,P=new Map,F=[],I=new Map,ee=new Map,L=new Set,R={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set},z,B,V,H,U=!1,W=(e,t,n)=>{let r=j.createElementNS(`http://www.w3.org/2000/svg`,e);return X(r,t),n?.appendChild(r),r},G=W(`g`,{class:`ec-overlay`,"aria-hidden":`true`});At(G,{"pointer-events":`none`});let te=W(`g`,{class:`ec-halos`},G),ne=W(`g`,{class:`ec-runs`},G),re=Ln(G),ie=e=>P.get(e)??I.get(e),ae=It(ne),oe=Kn({overlay:ne,measure:ae,mark:e=>({set:t=>ie(e)?.handle.set(t),reset:()=>ie(e)?.handle.reset()}),colors:(e,t)=>xs(ie(e)?.mark,t)?.colors}),se=Ct({effects:o,motion:i,icons:r.icons,clock:c,surface:oe}),ce=e=>({mark:e.mark.geometry,data:e.mark.data});function le(){ae.clear();for(let e of F)se.change(e.mark.geometry,e.mark.data)}let ue=()=>{},de=Dr(j,le);function pe(e){let t={key:e.key,mark:e,handle:No(()=>t.mark.parts.filter(e=>(ee.get(e.element)?.record??t)===t),u,()=>te)};return t}function me(e){e.root&&e.root!==M&&ve(e.root),N=e.ancestor??N;let t=new Set(e.marks.map(e=>e.key)),r={entering:[],exiting:[],changed:[],moved:[],newRow:!1},i=[];for(let e of F)t.has(e.key)||(P.delete(e.key),I.set(e.key,e),r.exiting.push(e));let a=ee;ee=new Map,F=e.marks.map(e=>{let t=P.get(e.key);if(t){let a=t.mark,o=n.value?Ps(a.parts,e.parts):Fs(a.geometry,e.geometry),s=a.data.datum!==e.data.datum;s&&(r.newRow=!0),o?r.changed.push({record:t,from:a.geometry}):(s||Ls(a.geometry,e.geometry)||Is(a.data.samples,e.data.samples))&&r.moved.push(t),(a.parts.length!==e.parts.length||e.parts.some((e,t)=>e.colors?.color!==a.parts[t].colors?.color))&&i.push(e.key),t.mark=e}else t=I.get(e.key),t?(I.delete(e.key),t.mark=e):t=pe(e),P.set(e.key,t),r.entering.push(t);for(let n of e.parts)ee.set(n.element,{record:t,part:n});return t});for(let[e,t]of a)ee.get(e)?.record!==t.record&&u.restore(e);for(let e of F)he(e);ge(),_e(),Te();for(let e of F)e.handle.repaint();for(let e of i)oe.recolor(e);return Oe(),r}function he(e){if(!n.markLabel)return;let{label:t,parts:r}=e.mark;r.forEach((e,n)=>{let r=t!==void 0&&n===0;u.attribute(e.element,`role`,r?`img`:null),u.attribute(e.element,`aria-label`,r?t:null),r?u.remove(e.element,`aria-hidden`):u.attribute(e.element,`aria-hidden`,t===void 0?null:`true`)})}function ge(){let e=M,t=new Set;for(let r of n.markLabel&&e?F:[])if(r.mark.label!==void 0)for(let n of r.mark.parts)for(let r=n.element.parentElement;r&&r!==e&&e?.contains(r);r=r.parentElement){if(t.has(r)||r.hasAttribute(`aria-label`)||r.hasAttribute(`aria-labelledby`))continue;let e=r.getAttribute(`role`)?.trim().split(/\s+/)[0];(e!==void 0&&gs.has(e)||e===void 0&&L.has(r))&&t.add(r)}for(let e of L)t.has(e)||(u.attribute(e,`role`,null),u.attribute(e,`aria-roledescription`,null));for(let e of t)u.remove(e,`role`),u.remove(e,`aria-roledescription`);L=t}function _e(){if(!M||!N)return;M.lastElementChild!==G&&M.appendChild(G),G.removeAttribute(`transform`);let e=bo(G,N,M);Ns(e)||G.setAttribute(`transform`,Mt(e))}function ve(e){ye(),M=e,ue=Or(M,c,le),M.appendChild(G),(n.keyboard===!0||n.markLabel)&&M.getAttribute(`role`)===`img`&&!m&&(m=!0,console.warn(`expressive: the <svg> is role="img", so screen readers read it as one picture and skip the marks inside, with their names and keyboard focus. Make it role="group"; its aria-label can stay.`)),V=nr(M,{find(e){let t=xe(e);if(!t)return;let{key:n}=t.record;return t.part.series===void 0?{key:n}:{key:n,segment:t.part.series}},hover(e,t){let n=P.get(e.key);!n||En(z)&&z.keys[0]===e.key||(K(),Se([n],t,e.segment))},leave(){(z?.source===`pointer`||z?.source===`touch`)&&K()}})}function ye(){M&&(K(),V?.destroy(),V=void 0,ue())}function xe(e){for(let t=e;t&&t!==M;t=t.parentElement){let e=ee.get(t);if(e)return e}}function Se(e,t,n,r=!0){let i={keys:e.map(e=>e.key),source:t,effects:r};z=i,Te(),r&&se.hover(e.map(ce)),e.forEach((r,i)=>Ve(`hover`,{...ce(r),batch:{index:i,count:e.length},source:t,...n===void 0?{}:{segment:n}})),t!==`linked`&&z===i&&H?.hover(e.map(ce))}function K(){let e=z;e&&(z=void 0,Te(),Ce(e.keys),En(e)&&H?.leave())}function Ce(e){let t=e.flatMap(e=>ie(e)??[]);se.leave(e),t.forEach((e,n)=>Ve(`leave`,{...ce(e),batch:{index:n,count:t.length}}))}function we(){if(z===void 0)return;let e=z.keys.filter(e=>P.has(e));if(e.length===z.keys.length)return;if(e.length===0){V?.clear(),K();return}let t=z.keys.filter(e=>!P.has(e));z={...z,keys:e},Ce(t)}function Te(){if(!l)return;let e=`${i.duration(100,`feedback`)}ms`;G.classList.toggle(`ec-hovering`,z!==void 0),At(G,{"--ec-hover-duration":e});for(let t of F){let n=z?.keys.includes(t.key)===!0;for(let r of t.mark.parts)u.toggleClass(r.element,`ec-attached`,!0),u.toggleClass(r.element,`ec-dimmed`,z!==void 0&&!n),u.style(r.element,`--ec-hover-duration`,e);t.handle.hot(n),oe.hot(t.key,n)}for(let e of I.values())e.handle.hot(!1),oe.hot(e.key,!1)}let q=l?i.subscribe(Te):void 0,Ee=e=>new Set(st.flatMap(t=>{let n=e[t];return n?.kind===`data`?n.needs?.related??[]:[]})),De=Ee(o);function Oe(){let e=B===void 0?void 0:P.get(B);re.draw(e?.mark.geometry)}let ke=n.keyboard===!0?rr(()=>M,{find:e=>xe(e)?.record.key,order:()=>F.map(e=>e.key),element:e=>P.get(e)?.mark.parts[0]?.element,tabIndex(e,t){let n=P.get(e);n&&t!==void 0&&n.mark.parts.forEach((e,n)=>{u.attribute(e.element,`tabindex`,n===0?t:`-1`),u.style(e.element,`outline`,`none`)})},focus(e,t){B=t?e:void 0,Oe();let n=P.get(e);n&&(t?En(z)&&z.keys[0]===e?z={...z,source:`keyboard`}:(K(),Se([n],`keyboard`)):z?.source===`keyboard`&&z.keys[0]!==e&&K())},blur(){B=void 0,Oe(),z?.source===`keyboard`&&(V?.current===z.keys[0]?z={...z,source:`pointer`}:K())},escape(){return z?(z.source===`linked`&&H?H.dismiss():K(),!0):!1}}):void 0,Ae=n.watch===!0?ms(j,c,Me):void 0;function je(){Ae?.observe(F.flatMap(e=>e.mark.parts.map(e=>e.element)),M)}function Me(e){if(U||!N)return;let t=new Set;for(let n of e.marks){let e=ee.get(n)?.record;e&&t.add(e)}let n=!1;for(let r of e.ancestors)if(r.contains(N))n=!0;else for(let e of F)e.mark.parts.some(e=>r.contains(e.element))&&t.add(e);let r=new Set;if(n){_e();for(let e of F)!t.has(e)&&e.mark.parts.some(e=>e.stroke?.screen)&&r.add(e)}if(t.size===0&&r.size===0)return;let i=Pe([...t,...r]),a=i.records.flatMap((e,t)=>r.has(e)&&!Ls(e.mark.geometry,i.marks[t].geometry)?[]:[t]);if(a.length===0)return;let o=a.map(e=>i.records[e]),s=a.map(e=>i.marks[e]);o.forEach((e,t)=>{let n=s[t];e.mark=n;for(let t of n.parts)ee.set(t.element,{record:e,part:t});e.handle.repaint()}),F=Le(F),o.some(e=>e.key===B)&&Oe();let c=new Set(o);if(o.some(e=>De.has(e.mark.geometry.series??``)))for(let e of F)c.add(e);for(let e of c)se.change(e.mark.geometry,e.mark.data)}function Pe(e){let t={svg:M,common:N,screen:yo(),colors:e=>ee.get(e)?.part.colors,stroke:e=>ee.get(e)?.part.stroke},r=Ie(),i=({parts:e})=>e.map(e=>({element:e.element,datum:r(e.element),series:e.series,value:e.value}));if(n.geometry){let n=e.map(({mark:e})=>({...g(e.key,i(e),e.index,t),label:e.label}));return{records:[...e],marks:w(n)}}let a=new Set(e.filter(e=>!e.mark.rect||_(e.mark.parts,t))),o=new Map(e.flatMap(e=>a.has(e)?[]:[[e,i(e.mark).map(n=>v(e.key,n,t))]])),s=Fe(o,a);for(let e of F)e.mark.rect&&!o.has(e)&&!a.has(e)&&s.get(e)!==e.mark.rect.edge&&o.set(e,i(e.mark).map(n=>v(e.key,n,t)));let c=[...o.keys()],l=c.map(e=>({...y(e.key,o.get(e),s.get(e),e.mark.index,t),label:e.mark.label}));for(let n of e){if(!a.has(n))continue;let e=b(n.key,i(n.mark)[0],n.mark.index,t);e&&(c.push(n),l.push({...e,label:n.mark.label}))}return{records:c,marks:w(l)}}function Fe(e,t){let r=F.filter(e=>e.mark.rect&&!t.has(e)),i=new Map(r.map(e=>[e,e.mark.rect.edge]));if(n.baseline!==void 0&&n.baseline!==`auto`)return i;let a=r.map(t=>{let n=e.get(t);return n?po(n.map(e=>e.rect.box)):t.mark.rect.box});try{let e=lo(a,`auto`);return new Map(r.map((t,n)=>[t,e[n]]))}catch{return i}}function Ie(){if(n.datum)return n.datum;let e=ss(f);return t=>e?.has(t)?e.get(t):E(t,0,void 0)}function Le(e){let t=[...e].sort((e,t)=>e.mark.index-t.mark.index);return n.geometry||!t.every(e=>e.mark.rect)?[...Ds(t,e=>e.mark.geometry)]:fo(t.map(e=>e.mark.rect.box),t.map(e=>e.mark.rect.edge)).map(e=>t[e])}function Be(e,t){return F.find(n=>n.key!==t&&n.mark.geometry.series===e)?.mark.data}function Ve(e,n){for(let r of[...R[e]])try{r(n)}catch(e){t(e)}}function He(e,t){t.forEach((n,r)=>Ve(e,{...ce(n),batch:{index:r,count:t.length}}))}se.enter(me(A).entering.map(ce)),ke?.sync(),je();let Ue={targets:()=>F.map(e=>({key:e.key,marks:[ce(e)]})),hover(e,t){K();let n=e.flatMap(e=>P.get(e)??[]);n.length>0&&Se(n,`linked`,void 0,t)},unlink(){z?.source===`linked`&&K()},leave(){V?.clear(),K()},listen(e){return!U&&(H=e,!0)}},We=new Set;return _s.set(Ue,{root:()=>M,ancestor:()=>N,elements:()=>F.flatMap(e=>e.mark.parts.map(e=>e.element)),keyOf:e=>xe(e)?.record.key,colorOf:e=>P.get(e)?.mark.parts[0]?.colors?.color,moveTabStop:e=>ke?.moveTabStop(e)??!1,edits:u,refreshed:We}),An(Ue,{refresh(e){if(U)return;let t=h(e??f);e!==void 0&&(f=e),se.interrupt();let n=me(t);je(),we();let r=se.exit(n.exiting.map(ce));He(`exit`,n.exiting),(n.newRow||n.changed.length>0||n.entering.length>0||n.exiting.length>0)&&se.update(n.changed.map(({record:e,from:t})=>({...ce(e),from:t}))),n.changed.forEach(({record:e,from:t},r)=>Ve(`update`,{...ce(e),from:t,batch:{index:r,count:n.changed.length}})),se.enter(n.entering.map(ce)),He(`enter`,n.entering);let i=new Set([...n.changed.map(e=>e.record),...n.moved]);if([...i,...n.entering,...n.exiting].some(e=>De.has(e.mark.geometry.series??``))){let e=new Set(n.entering);for(let t of F)e.has(t)||i.add(t)}for(let e of i)se.change(e.mark.geometry,e.mark.data);se.settle(),ke?.sync();for(let e of We)e();r.then(()=>{for(let e of n.exiting)I.get(e.key)===e&&I.delete(e.key)})},async update(e){if(U)return;if(typeof e!=`object`||!e)throw TypeError(`expressive: update() needs options, such as { on: { hover: "lift" } }.`);let t=Object.keys(e).find(e=>e!==`on`);if(t!==void 0)throw TypeError(`expressive: \`${t}\` can't be changed by update() yet. Only \`on\` can.`);if(!(`on`in e))return;let n=vr(o,s,e.on,r.presets);T(F.map(e=>e.mark),n),s=e.on,o=n,De=Ee(n),se.swap(n,F.map(ce))},on(e,t){let n=R[e];if(!n)throw TypeError(`expressive: unknown event "${String(e)}". Use one of: ${Object.keys(R).join(`, `)}.`);return n.add(t),()=>{n.delete(t)}},marks:()=>F.map(e=>e.mark.geometry),focus(e){P.has(e)&&!U&&ke?.focus(e)},leave(){U||Ue.leave()},destroy(){if(!U){U=!0,z=void 0,H?.gone(),H=void 0,Ae?.destroy(),se.destroy(),q?.(),de(),ke?.destroy(),ye(),G.remove(),u.restoreAll();for(let e of Object.values(R))e.clear();P.clear(),I.clear(),F=[],ee=new Map}}})}function bs(e){if(typeof e!=`object`||!e)throw TypeError(`expressive needs options, with at least a key: { key: (d) => d.name }.`);if(typeof e.key!=`function`)throw TypeError(`expressive needs a key function, for example key: (d) => d.name. Marks are matched by key.`);for(let t of[`datum`,`segment`,`value`,`geometry`,`markLabel`])if(e[t]!==void 0&&typeof e[t]!=`function`)throw TypeError(`expressive: ${t} must be a function.`);if(e.baseline!==void 0&&e.baseline!==`auto`&&!co(e.baseline))throw RangeError(`expressive: baseline must be "left", "right", "top", "bottom" or "auto", got ${String(e.baseline)}.`)}function xs(e,t){if(t===void 0)return e?.parts[0];let n=e?.geometry.segments?.find(e=>e.key===t);return n&&e.parts.find(e=>e.series===n.series)}function Ss(e){let t=[...(e.geometry.segments??[]).map(e=>e.series),...e.parts.map(e=>e.series)];return[...new Set(t.filter(e=>e!==void 0))]}function Cs(e){let t=0;for(let{value:n}of e){if(typeof n!=`number`||!Number.isFinite(n))return;t+=n}return t}function ws(e,t,n){let r=t=>e.length>0?n*t/e.length:0;if(t===e)return[{t:0,value:0},{t:1,value:n}];let i=Os(e.start,t.start);return[{t:0,value:r(i)},{t:1,value:r(i+t.length)}]}function Ts(e,t){if(!Array.isArray(e))throw TypeError(`expressive: samples for ${t} must return an array of { t, value }, got ${Es(e)}.`);let n=0;return e.map((e,r)=>{let{t:i,value:a,at:o,gapBefore:s}=typeof e==`object`&&e?e:{};if(typeof i!=`number`||!(i>=0&&i<=1))throw RangeError(`expressive: samples for ${t}: samples[${r}].t must be in [0, 1], got ${Es(i)}.`);if(i<n)throw RangeError(`expressive: samples for ${t} must be in t order: samples[${r}].t is ${i}, after ${n}.`);if(typeof a!=`number`||!Number.isFinite(a))throw RangeError(`expressive: samples for ${t}: samples[${r}].value must be a finite number, got ${Es(a)}.`);if(s!==void 0&&typeof s!=`boolean`)throw RangeError(`expressive: samples for ${t}: samples[${r}].gapBefore must be true or false, got ${Es(s)}.`);return n=i,{t:i,value:a,...o===void 0?{}:{at:o},...s?{gapBefore:s}:{}}})}function Es(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Ds(e,t){let n=e[0]&&t(e[0]).pivot;if(!n||!e.every(e=>Os(t(e).pivot,n)<=.5&&io(t(e))))return e;let r=2*Math.PI,i=e=>{let{center:i}=t(e),a=Math.atan2(i.x-n.x,n.y-i.y),o=a<0?a+r:a;return o>=r?0:o};return e.map(e=>({mark:e,angle:i(e)})).sort((e,t)=>e.angle-t.angle).map(({mark:e})=>e)}function Os(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function ks(e,t,n){let r=t===void 0?void 0:e.segments?.find(e=>e.series===t),i=r??(n===1?e:void 0);if(!(!i||r&&r.length<.5))return i.outline.closed?{d:i.outline.d}:{d:i.outline.d,stroke:i.thickness}}function As(e){let t=Number.parseFloat(e.getAttribute(`rx`)??``),n=Number.parseFloat(e.getAttribute(`ry`)??``),r=Number.isFinite(t)?t:n;return Number.isFinite(r)&&r>0?r:0}function js(e){return Math.round(e*1e3)/1e3}function Ms(e){try{return Qe(e)}catch{return}}function Ns(e){return Math.abs(e[0]-1)<1e-9&&Math.abs(e[1])<1e-9&&Math.abs(e[2])<1e-9&&Math.abs(e[3]-1)<1e-9&&Math.abs(e[4])<1e-6&&Math.abs(e[5])<1e-6}function Ps(e,t){if(e.length!==t.length)return!0;let n=new Map(e.map(e=>[e.series,e.value]));return t.some(e=>{let t=n.get(e.series);return!n.has(e.series)||!(t===e.value||Object.is(t,e.value))})}function Fs(e,t){let n=e.segments??[],r=t.segments??[];return Math.abs(e.length-t.length)>.01||n.length!==r.length||n.some((e,t)=>e.key!==r[t].key||Math.abs(e.length-r[t].length)>.01)}function Is(e,t){let n=(e,t)=>e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime();return e.length!==t.length||e.some((e,r)=>e.t!==t[r].t||e.value!==t[r].value||!n(e.at,t[r].at))}function Ls(e,t){if(e.outline.d!==t.outline.d||e.thickness!==t.thickness||wr(e,t))return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((e,t)=>e.key!==r[t].key||e.outline.d!==r[t].outline.d)}let Rs=[`font-family`,`font-size`,`font-style`,`font-weight`,`font-variant-numeric`,`letter-spacing`,`word-spacing`,`dominant-baseline`,`fill`],zs=new Set([`font-size`,`letter-spacing`,`word-spacing`]);function Bs(e,t){let n=e[t]?.baseVal;return n&&n.numberOfItems>0?n.getItem(0).value:Number.parseFloat(e.getAttribute(t)??``)||0}function Vs(e,t){return t===1?e:e.replace(/(-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(px)?(?![\w.%])/gi,(e,n,r)=>`${Math.round(Number(n)*t*1e3)/1e3}${r??``}`)}function Hs(e,n={}){let r=Array.isArray(e)?e:[e];if(r.length===0)throw TypeError(`hostView needs an attachment, or an array of attachments on one <svg>: hostView([dots, connectors]).`);let i=r.map((t,n)=>{let i=typeof t==`object`&&t?jn(t):void 0,a=vs(i);if(!i||!a?.root())throw TypeError(r===e?`hostView needs attachments that expressive() or fromVegaView() returned, each with marks in an <svg>: attachments[${n}] isn't one.`:`hostView needs an attachment that expressive() or fromVegaView() returned, with marks in an <svg>.`);if(r.indexOf(t)!==n)throw TypeError(`hostView: attachments[${n}] is attachments[${r.indexOf(t)}] again. Each attachment is in a view once.`);return{attachment:t,port:i,inside:a,hidden:[]}});if(typeof n!=`object`||!n||n.labels!==void 0&&typeof n.labels!=`function`)throw TypeError(`hostView: labels must be a function that returns the host's labels, such as () => names.map((element) => ({ element, key: element.textContent, role: "category" })).`);if(n.guides!==void 0&&typeof n.guides!=`function`)throw TypeError(`hostView: guides must be a function that returns the host's guides, such as () => [{ element: svg.querySelector("g.axis"), key: "y" }].`);let a=i[0],o=i.length>1,{edits:s}=a.inside,c=()=>a.inside.root(),l,u,d,f=o?Us(i,c()):void 0;if(f)throw TypeError(`hostView: ${f.problem}.`);let p=()=>i.filter(e=>e.inside.root()===c()),m=e=>p().find(t=>t.attachment.marks().some(t=>t.key===e));function h(){if(!n.labels)return[];let e=new Set(p().flatMap(e=>e.attachment.marks().map(e=>e.key)));try{return Array.from(n.labels()).filter(t=>t?.element?.localName===`text`&&c().contains(t.element)&&e.has(t.key)&&(t.role===`category`||t.role===`value`))}catch(e){return t(e),[]}}function g(){if(!n.guides)return[];let e=c();try{return Array.from(n.guides()).filter(t=>t?.element?.nodeType===1&&t.element!==e&&e.contains(t.element)&&typeof t.key==`string`)}catch(e){return t(e),[]}}function _({element:e,key:t,role:n}){let r=c(),i=bo(y.space,e,r),a=J.apply(i,{x:Bs(e,`x`),y:Bs(e,`y`)}),o=Eo(i),s=e.ownerDocument.createElementNS(kt,`text`);s.textContent=e.textContent;for(let t of[`dx`,`dy`]){let n=e.getAttribute(t);n!==null&&s.setAttribute(t,Vs(n,o))}At(s,Object.fromEntries(Rs.map(t=>{let n=Io(e,r,t);return[t,(zs.has(t)?Vs(n,o):n)||void 0]})));let l=Io(e,r,`text-anchor`);return{key:t,role:n,text:e.textContent??``,x:a.x,y:a.y,anchor:l===`middle`||l===`end`?l:`start`,element:s}}let v=e=>{if(e&&l===void 0&&o){let e=Us(i,c());e&&t(TypeError(`hostView: ${e.problem}. The switch plays on, and ${e.left}.`))}let n=e?c():void 0;l=e?h():void 0,u=e?g():void 0;let r=[...(l??[]).map(e=>e.element),...(u??[]).map(e=>e.element)],a=i.map(({inside:e,hidden:t},i)=>new Set(l?[...e.elements(),...i===0?r:[],...t.filter(e=>n?.contains(e))]:[]));for(let e=1;e<a.length;e++)for(let t of a[e])a.some((n,r)=>r<e&&n.has(t))&&a[e].delete(t);i.forEach((e,t)=>{for(let n of e.hidden)a[t].has(n)||e.inside.edits.style(n,`visibility`,void 0)}),i.forEach((e,t)=>{e.hidden=[...a[t]];for(let t of e.hidden)e.inside.edits.style(t,`visibility`,`hidden`)}),d!==n&&(d&&s.toggleClass(d,`ec-morphing`,!1),n&&s.toggleClass(n,`ec-morphing`,!0),d=n)},y={get element(){return c()},get space(){let e=c(),[t,...n]=p().map(t=>t.inside.ancestor()??e),r=t;for(let t of n)for(;r!==e&&!r.contains(t);)r=r.parentElement??e;return r},refresh(e){if(o&&e!==void 0)throw TypeError(`hostView: a view of several attachments refreshes each from what it last read, with refresh(). To read new sources, refresh each attachment with its own.`);for(let{attachment:t}of i)t.refresh(e)},update:e=>o?Promise.all(i.map(({attachment:t})=>t.update(e))).then(()=>{}):a.attachment.update(e),on(e,t){let n=i.map(({attachment:n})=>n.on(e,t));return o?()=>n.forEach(e=>e()):n[0]},marks(){let e=c(),t=y.space,n=new Set;return p().flatMap(({attachment:r,inside:i})=>{let a=i.ancestor()??e,o=a===t?void 0:bo(t,a,e);return r.marks().flatMap(e=>n.has(e.key)?[]:(n.add(e.key),[o?xo(e,o):e]))})},focus:e=>m(e)?.attachment.focus(e),leave(){for(let{attachment:e}of i)e.leave()},destroy(){l=u=d=void 0;for(let e of i)e.hidden=[];for(let{attachment:e}of[...i].reverse())e.destroy()},labels:()=>(l??h()).map(_),guides:()=>u??g(),paintOf(e){for(let{inside:t}of p()){let n=t.colorOf(e);if(n!==void 0)return{color:e,drawn:!0,cssColor:n}}},keyOf(e){for(let{inside:t}of i){let n=t.keyOf(e);if(n!==void 0)return n}},moveTabStop:e=>p().some(({inside:t})=>t.moveTabStop(e)),morphing:v};for(let{inside:e}of i)e.refreshed.add(()=>{l&&v(!0)});return o?y:An(a.port,y)}function Us(e,t){let n=new Map;for(let[r,{attachment:i,inside:a}]of e.entries()){if(a.root()!==t)return{problem:`attachments[${r}]'s marks are in another <svg> than attachments[0]'s, and a view's attachments share one`,left:`attachments[${r}]'s marks are left out`};for(let{key:e}of i.marks()){let t=n.get(e);if(t!==void 0&&t!==r)return{problem:`attachments[${t}] and attachments[${r}] both have a mark with the key ${JSON.stringify(e)}, and each key must be one mark's. Key each one's marks apart, such as (d) => \`first@\${d.name}\``,left:`the key stays attachments[${t}]'s: attachments[${r}]'s mark is left out`};n.set(e,r)}}}let Ws=[`line`,`rect`,`arc`,`symbol`],Gs=[`d`,`transform`,`x`,`y`,`width`,`height`,`stroke-width`];function Ks(e,n,r){if(qs(e),typeof n!=`object`||!n||typeof n.key!=`function`)throw TypeError(`fromVegaView needs options with a key: { key: (d) => d.series }. Marks are matched by key.`);let i=n.mark??`marks`;if(typeof i!=`string`||i===``)throw TypeError(`fromVegaView: mark must be a mark's name, got ${String(i)}.`);if(n.sample!==void 0&&typeof n.sample!=`function`)throw TypeError(`fromVegaView: sample must be a function.`);let o=_(),{mark:s,sample:c,...l}=n,u=ys(o.elements,{...l,datum:e=>g(e).datum,geometry:(e,t,n)=>{let r=o.geometry.get(n);if(!r)throw TypeError(`fromVegaView: no geometry for "${n}". Its key must be the same for every item of a mark.`);return r},...n.samples||!n.sample?{}:{samples:(e,t)=>o.samples.get(t)??[]},...n.value||!n.sample?{}:{value:(e,t)=>o.values.get(t)}},r),d=r.clock??a,f,p,m=!1,h=typeof MutationObserver==`function`?new MutationObserver(e=>e.some(S)&&C()):void 0;w(o.root);function g(e){let t=o.items.get(e);if(!t)throw TypeError(`fromVegaView: an element that isn't one of the View's items.`);return t}function _(){let t=Ys(Js(e),i),r=Xs(t,i,e),a=e.container(),o=a?.localName===`svg`?a:a?.querySelector(`svg`),s={root:o??void 0,elements:[],items:new Map,geometry:new Map,samples:new Map,values:new Map};if(!r||!o)return s;let c=new Set(r===`line`?t.flatMap(e=>e.items?.[0]&&$s(e.items[0])?[e.items[0]]:[]):t.flatMap(e=>e.items??[])),l=new Map;for(let e of Array.from(o.querySelectorAll(`*`))){let t=e.__data__;c.has(t)&&l.set(e,t)}let u=[...l.keys()];if(u.length===0)return s;let d=cs(u),f=ls(u,d),p=yo(),m=e=>bo(f,e.parentElement??d,d,p),h=e=>String(n.key(l.get(e).datum,e)),g=e=>n.segment?String(n.segment(l.get(e).datum,e)):void 0,_={root:d,items:l,elements:u,geometry:new Map,samples:new Map,values:new Map};if(n.sample)for(let[e,t]of l){let n=r===`line`?Qs(t):[t];_.values.set(e,n.map(e=>e.defined===!1?``:y(e).value).join(`,`))}if(r===`rect`)return v(_,m,h,g);for(let e of u){let t=l.get(e),i=h(e);if(_.geometry.has(i))continue;let a=m(e),o=r===`line`?nc(i,e,t,a):r===`arc`?rc(i,t,a):ic(i,t,a);_.geometry.set(i,o),n.sample&&_.samples.set(o,r===`line`?b(o,t,a):x(o,t,r))}return _}function v(e,t,r,i){let a=new Map;for(let n of e.elements){let o=e.items.get(n),s=r(n),c={box:Do(t(n),ac(o)),series:i(n),radius:Math.max(0,o.cornerRadius??0)},l=a.get(s);l?l.push({element:n,part:c}):a.set(s,[{element:n,part:c}])}let o=[...a.keys()],s=o.map(e=>po(a.get(e).map(e=>e.part.box))),c=lo(s,n.baseline??`auto`),l=[];for(let t of fo(s,c)){let r=o[t],i=a.get(r),{geometry:s,order:u}=uo(r,i.map(e=>e.part),c[t]);if(e.geometry.set(r,s),l.push(...u.map(e=>i[e].element)),n.sample){let t=u.map(t=>y(e.items.get(i[t].element)).value),n=t.reduce((e,t)=>e+t,0);e.samples.set(s,[{t:0,value:0},{t:1,value:n}]);let r=0;(s.segments??[]).forEach((n,i)=>{let a=r;r+=t[i]??0,e.samples.set(n,[{t:0,value:a},{t:1,value:r}])})}}return{...e,elements:l}}function y(e){let t=n.sample(e.datum),r=typeof t==`number`?{value:t}:t;if(typeof r!=`object`||!r||!Number.isFinite(r.value))throw RangeError(`fromVegaView: sample must give a finite number, or { value, at }, got ${JSON.stringify(t)}.`);return r.at===void 0?{value:r.value}:{value:r.value,at:r.at}}function b(e,t,n){return nt(e,tc(t).map(({item:e,point:t})=>({...J.apply(n,t),...y(e)})))}function x(e,t,n){let{value:r,at:i}=y(t),a=i===void 0?{t:1,value:r}:{t:1,value:r,at:i};return n===`symbol`?[{...a,t:0}]:e.length>0?[{t:0,value:0},a]:[{...a,t:0}]}function S(e){let t=f?.querySelector(`:scope > .ec-overlay`),n=e=>e===t||(t?.contains(e)??!1);return n(e.target)?!1:e.type!==`childList`||[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].some(e=>!n(e))}function C(){if(p||m)return;let e=d.onFrame(()=>{e(),p=void 0;try{T()}catch(e){t(e)}});p=e}function w(e){h&&e!==f&&(h.disconnect(),f=e,e&&h.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:Gs}))}function T(){if(m)return;let e=_(),t=o;o=e;try{u.refresh(e.elements)}catch(e){throw o=t,e}w(e.root)}return An(jn(u),{refresh:T,update:u.update,on:u.on,marks:u.marks,focus:u.focus,leave:u.leave,destroy(){m||(m=!0,h?.disconnect(),p?.(),p=void 0,u.destroy())}})}function qs(e){if(typeof e!=`object`||!e||typeof e.renderer!=`function`||typeof e.scenegraph!=`function`||typeof e.container!=`function`)throw TypeError(`fromVegaView needs a Vega View: new vega.View(runtime, { renderer: "svg", container }), or vega-embed's result.view.`);let t=e.renderer();if(t!==`svg`)throw TypeError(`fromVegaView: the View renders with "${t}", which draws no SVG elements to attach to. Use renderer: "svg" (vega-embed's default; a bare vega.View uses canvas).`)}function Js(e){let t=e.scenegraph();return t.root??t}function Ys(e,t){let n=[],r=e=>{if(e.name===t&&e.marktype!==`group`&&n.push(e),e.marktype===`group`)for(let t of e.items??[])for(let e of t.items??[])r(e)};return r(e),n}function Xs(e,t,n){if(e.length===0){let e=Zs(Js(n));if(e.length===0)return;throw RangeError(`fromVegaView: the View has no mark named "${t}". Its named marks: ${e.map(e=>`"${e}"`).join(`, `)}.`)}let r=e[0].marktype;if(!e.every(e=>e.marktype===r)||!Ws.includes(r))throw TypeError(`fromVegaView: "${t}" is a ${String(r)} mark. Rects, arcs, symbols and lines can be read; describe others with expressive()'s geometry option.`);return r}function Zs(e){let t=new Set,n=e=>{e.name&&e.marktype!==`group`&&t.add(e.name);for(let t of e.items??[])for(let e of t.items??[])n(e)};return n(e),[...t]}let Qs=e=>e.mark?.items??[e],$s=e=>Qs(e).some(e=>e.defined!==!1),ec=e=>{let t=Qs(e)[0]?.interpolate;return t===void 0||t===`linear`};function tc(e){let t=Qs(e),n=[],r=!1;for(let e of t)e.defined===!1?r=n.length>0:(n.push({item:e,point:{x:sc(e.x),y:sc(e.y)},gapBefore:r}),r=!1);return n}function nc(e,t,n,r){let i=n.strokeWidth??Number.parseFloat(t.getAttribute(`stroke-width`)??`1`);if(!ec(n)){let n=i*oc(r);return ze({key:e,series:e,d:t.getAttribute(`d`)??``,matrix:r,width:n>0&&Number.isFinite(n)?n:1})}let a=tc(n),o=a.flatMap((e,t)=>e.gapBefore?[t]:[]);return ge({key:e,series:e,points:a.map(({point:e})=>J.apply(r,e)),...o.length>0?{breaks:o}:{},width:(Number.isFinite(i)?i:1)*oc(r)})}function rc(e,t,n){let r=J.apply(n,{x:sc(t.x),y:sc(t.y)}),i=oc(n),[a,o]=[sc(t.startAngle),sc(t.endAngle)].sort((e,t)=>e-t);return fe({key:e,cx:r.x,cy:r.y,inner:sc(t.innerRadius)*i,outer:sc(t.outerRadius)*i,start:a,end:o})}function ic(e,t,n){let r=J.apply(n,{x:sc(t.x),y:sc(t.y)});return be({key:e,x:r.x,y:r.y,r:Math.sqrt(Math.max(0,t.size??64)/Math.PI)*oc(n)})}function ac(e){let t=sc(e.x),n=sc(e.y),r=sc(e.width),i=sc(e.height);return{x:Math.min(t,t+r),y:Math.min(n,n+i),width:Math.abs(r),height:Math.abs(i)}}function oc(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))}function sc(e){return typeof e==`number`&&Number.isFinite(e)?e:0}let cc={get:()=>void 0},lc={set(){},reset(){}},uc={place(){},update(){},remove(){}};function dc(e,n){let{effect:r,surface:i}=n;if(!fc(r))throw TypeError(`playTransition needs a transition effect (kind "transition" with run, end and clear), got ${pc(r)}.`);let o=n.start??0;if(!(typeof o==`number`&&o>=0&&o<=1))throw RangeError(`playTransition: start must be a number from 0 to 1, got ${String(o)}.`);let s=n.motion??v,c=n.clock??a,l=n.icons??cc,u=e.length,d=[],f=!1,p=u,m,h=new Promise(e=>{m=e}),g=u>0?s.subscribe(()=>{s.mode===`off`&&w()}):void 0,_=()=>{--p>0||(g?.(),g=void 0,m())};function y(e,t,n){let i=_t({clock:c,motion:s,icons:l,batch:{index:t,count:u},layer:T(e.to.key,t,()=>a.state!==`cleared`),mark:lc}),a={pair:e,index:t,scope:i,context:{...i.context,start:o},state:`running`,done:n};d[t]=a;let{from:f,to:p}=e;try{s.mode===`off`?(r.end(f,p,a.context),b(a)):Promise.resolve(r.run(f,p,a.context)).then(()=>b(a),e=>x(a,e))}catch(e){x(a,e)}}function b(e){e.state===`running`&&(e.state=`ended`,S(e))}function x(e,n){let{signal:r}=e.context;(!r.aborted||n!==r.reason&&n?.name!==`AbortError`)&&(t(n),C(e))}function S(e){let t=e.done;e.done=void 0,t?.()}function C(e){if(e.state!==`cleared`){e.state=`cleared`,e.scope.abort();try{r.clear(e.context)}catch(e){t(e)}e.scope.clear(),S(e)}}function w(){for(let e of[...d]){if(e.state!==`running`)continue;let t=e.done;e.done=void 0,C(e),y(e.pair,e.index,t)}}function T(e,t,n){let r,a=()=>n()?r??(r=i.group(e,t)):void 0;return{icon:(e,t)=>a()?.icon(e,t)??uc,path:(e,t)=>a()?.path(e,t)??uc,text:(e,t)=>a()?.text(e,t)??uc,clear(){let e=r;r=void 0,e?.clear()}}}return e.forEach((e,t)=>y(e,t,_)),u===0&&m(),{finished:h,clear(){if(!f){f=!0;for(let e of[...d])C(e)}}}}function fc(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.kind===`transition`&&typeof t.run==`function`&&typeof t.end==`function`&&typeof t.clear==`function`}function pc(e){if(typeof e!=`object`||!e)return e===null?`null`:typeof e;let t=e.kind;return t===`geometry`||t===`data`?`a ${t} effect, which plays on one mark: put it in a chart's \`on\` option`:t===`transition`?`a transition effect without run(), end() and clear()`:t===void 0?`an object with no kind`:`an effect of kind ${JSON.stringify(t)}`}let mc=.5;function hc(e,t,n){let r=mr(e,`chartSwitch`),i=Uc(t),o=t.transition,s=Sn(t.colors),c=n.motion,l=n.clock??a,u=r.ownerDocument;bn(u);let d=u.createElement(`div`);d.className=`ec-switch`,r.appendChild(d);let f=new Map;try{for(let e of i){let n=u.createElement(`div`);n.className=`ec-switch-view`,n.setAttribute(`data-view`,e),d.appendChild(n),vc(n,e===t.initial);let r=t.views[e](n,s);if(!Hc(r,n))throw r?.destroy?.(),TypeError(`chartSwitch: views.${e} must return the chart it draws in the container it's given (with element, marks(), labels(), focus(), leave() and destroy()), such as donutChart(container, { ... }).`);f.set(e,{name:e,container:n,chart:r,port:jn(r)})}}catch(e){for(let e of f.values())e.chart.destroy();throw d.remove(),e}let p=Y(`svg`,{class:`ec-chart ec-switch-overlay`,"aria-hidden":`true`},d),m=Y(`g`,{class:`ec-switch-fades`},p),h=Y(`g`,{class:`ec-switch-runs`},p),g=Y(`g`,{class:`ec-switch-labels`},p),_=t.announce?Ot(p):void 0,v=e=>hn(e.cssColor===void 0?pn(s.slot(e.color)):Fo(e.cssColor)),y=new WeakMap,b=(e,t)=>({group(n,r){let i=Y(`g`,{class:`ec-run`,"data-key":n},h);At(i,v(e[r]??{color:n})),y.set(i,r);let a=Array.from(h.children).find(e=>(y.get(e)??-1/0)>r);h.insertBefore(i,a??null);let o=Hn(i);return{...t[r]?.wrap(o,i)??o,clear:()=>i.remove()}}});function x(e,t,n){let[r,i]=e,[a,o]=t;if(r===0&&i===0&&!a&&!o)return;let s=[];if(a&&o){let e=re();s.push({element:e,draw:t=>zc(e,{at:{x:Pc(a.at.x,o.at.x,t),y:Pc(a.at.y,o.at.y,t)},r:Pc(a.r,o.r,t),ring:Pc(a.ring,o.ring,t)})})}else[[a,kc,n[0]],[o,Ac,n[1]]].forEach(([e,t,n])=>{if(!e)return;let r=re();At(r,v(n)),zc(r,e),s.push({element:r,draw:e=>X(r,{opacity:t(e)})})});let c=r>0||i>0,l=r,u=new Map;return{wrap(e,t){u.clear();let n=()=>{for(let e of s)t.appendChild(e.element)};return n(),{...e,path(t,r){let i=c&&r.fill!==void 0&&r.stroke===void 0,a=e.path(t,i?{...r,stroke:`surface`,width:l}:r);return n(),i?(u.set(a,t),{update(e,t){u.set(a,e),a.update(e,t)},remove(){u.delete(a),a.remove()}}):a}}},draw(e){l=Pc(r,i,e);for(let[e,t]of u)e.update(t,{width:l});for(let t of s)t.draw(e)}}}let S=t.initial,C,w=!1,T,E,D=!1,O,k=c.subscribe(()=>{c.mode===`off`&&C&&W(C,!0)}),A,j=typeof ResizeObserver==`function`?new ResizeObserver(e=>{let t=e[e.length-1]?.contentRect.width??0;if(A!==void 0&&Math.abs(t-A)<.5)return;let n=A===void 0;A=t,!n&&C&&W(C,!0)}):void 0;j?.observe(d);let M=e=>f.get(e),N=(e,t=``)=>TypeError(`chartSwitch: there's no view ${JSON.stringify(e)}${t}. The views are ${i.map(e=>JSON.stringify(e)).join(`, `)}.`);function P(){return d.getRootNode().activeElement??null}function F(e){let t=P(),n=t!==null&&e.container.contains(t),r=n?t:e.chart.element.querySelector(`[tabindex="0"]`),i=r?.closest(`[data-key]`),a=(r&&e.chart.keyOf?.(r))??(i&&e.chart.element.contains(i)?i.getAttribute(`data-key`):null);if(n||a!==null)return{keys:a===null?[]:e.chart.standsFor?.(a)??[a],focused:n}}function I(e,t){if(!t)return;let n=P(),r=n!==null&&n!==u.body&&n!==u.documentElement&&!d.contains(n);if(!t.focused||r){for(let n of t.keys)if(e.chart.moveTabStop?.(n))return;return}let i=()=>e.chart.element.contains(P());for(let n of[...t.keys,...e.chart.marks().map(e=>e.key)])if(e.chart.focus(n),i())return}function ee(e){_?.say(e.chart.element.getAttribute(`aria-label`)??``)}function L(){D&&T?.shown()}function R(e,t,n,r){return n===void 0||!c.staged||n===e.name||n===t.name?z(e,t,r):z(e,M(n),r,t)}function z(e,t,n,r){let i=n?n.focus:F(e),a=[];O=a;try{e.chart.leave()}finally{O=void 0}let o=w?Promise.resolve():B(e,t,i,r);for(let e of a)e();return o}function B(e,t,n,r,i){if(S=(r??t).name,c.mode===`off`){let e=M(S);for(let t of f.values())vc(t.container,t===e);return I(e,n),ee(e),L(),Promise.resolve()}let a=[];for(let n of[e,t])n.container.classList.remove(`ec-switch-inactive`),a.push(te(n)),n.container.classList.add(`ec-switching`),n.container.setAttribute(`inert`,``),n.chart.morphing?.(!0),n.chart.element.classList.add(`ec-morphing`);let{pairs:o,surface:s,scene:l}=G(e,t,a),{done:u,settle:d}=i??Vc(),p={a:e,b:t,forward:!0,pairs:o,reversed:o.map(({from:e,to:t})=>({from:t,to:e})),surface:s,scene:l,focus:n,next:r,progress:0,transition:void 0,driver:void 0,run:0,done:u,settle:d};return C=p,V(p,0),p.done}function V(e,t){let r=++e.run;if(t>=1){H(e);return}let i=t=>{e.progress=t,e.scene.draw(e.forward?t:1-t)},a=_c(l);e.transition=dc(e.forward?e.pairs:e.reversed,{effect:o,surface:e.surface,start:t,motion:c,clock:a.clock,icons:n.icons}),e.driver=gc(t,i,{clock:a.clock,motion:c}),a.release(),Promise.all([e.driver.finished,e.transition.finished]).then(([t])=>{C===e&&e.run===r&&t===`done`&&H(e)})}function H(e){let t=e.forward?e.next:void 0;if(!t||c.mode===`off`)return W(e,!0);let{done:n,settle:r}=e;e.next=void 0,e.settle=()=>{},W(e,!1),B(e.b,t,e.focus,void 0,{done:n,settle:r})}function U(e){return e.driver?.cancel(),e.transition?.clear(),e.forward=!e.forward,S=(e.forward?e.b:e.a).name,e.settle(),{done:e.done,settle:e.settle}=Vc(),V(e,1-e.progress),e.done}function W(e,t){if(C!==e)return;C=void 0,e.run++,e.driver?.cancel(),e.transition?.clear(),e.scene.clear();let n=e.forward?e.next??e.b:e.a;for(let t of[e.a,e.b])t.chart.element.classList.remove(`ec-morphing`),t.chart.morphing?.(!1),t.container.classList.remove(`ec-switching`),t.container.style.removeProperty(`opacity`);for(let e of f.values())vc(e.container,e===n);t&&(I(n,e.focus),ee(n),L()),e.settle()}function G(e,t,n){let r=bo(p,e.chart.space??e.chart.element,d),i=bo(p,t.chart.space??t.chart.element,d),a=Bc(r),o=Bc(i),s=e.chart.marks().map(e=>xo(e,r)),c=t.chart.marks().map(e=>xo(e,i)),l=new Map(s.map(e=>[e.key,e])),f=new Set(c.map(e=>e.key)),_=[],v=[],y=[];for(let n of c){let r=l.get(n.key);if(!r)continue;let i=Fc(e,r),s=Fc(t,n);(i.drawn||s.drawn)&&(_.push({from:i.drawn?r:Ic(r),to:s.drawn?n:Ic(n)}),v.push(s),y.push(x([Lc(i,a),Lc(s,o)],[Rc(i,r,a),Rc(s,n,o)],[i,s])))}let S=[];y.some(e=>e!==void 0)&&S.push(e=>{for(let t of y)t?.draw(e)});let C=(e,t,n,r)=>{let i=Fc(e,t);i.drawn&&S.push(ne(t,i,n,r))};for(let t of s)f.has(t.key)||C(e,t,a,kc);for(let e of c)l.has(e.key)||C(t,e,o,Ac);let w=e=>`${e.role}\n${e.key}`,T=e.chart.labels(),E=t.chart.labels(),D=e.chart.space?a:1,O=t.chart.space?o:1,k=new Map(T.map(e=>[w(e),e])),A=new Set;for(let e of E){let t=k.get(w(e));t&&(A.add(w(e)),S.push(Ec(ie(t,r,D),ie(e,i,O))))}for(let e of T)A.has(w(e))||S.push(Oc(ie(e,r,D),kc));for(let e of E)k.has(w(e))||S.push(Oc(ie(e,i,O),Ac));let[j=[],M=[]]=n,N=new Map;for(let e of j)N.has(e.key)||N.set(e.key,e);let P=new Set;for(let e of M){let t=N.get(e.key);N.delete(e.key),t&&Tc(t,e)&&P.add(t).add(e)}let F;if(j.length+M.length>0){let e=F=u.createElementNS(kt,`g`);e.setAttribute(`class`,`ec-switch-guides`),p.insertBefore(e,m),[[j,e=>+(e<mc),jc],[M,e=>e<mc?0:1,Mc]].forEach(([t,n,r])=>{for(let i of t){e.appendChild(i.group);let t=P.has(i)?n:r;S.push(e=>i.group.setAttribute(`opacity`,bc(t(e))))}})}return S.push(n=>{yc(e.container,jc(n)),yc(t.container,Mc(n))}),{pairs:_,surface:b(v,y),scene:{draw:e=>{for(let t of S)t(e)},clear:()=>{F?.remove(),m.replaceChildren(),h.replaceChildren(),g.replaceChildren()}}}}function te(e){let t=e.chart.element;return(e.chart.guides?.()??[]).flatMap(e=>{let n=e?.element,r=n?.parentElement;if(typeof e?.key!=`string`||!r||!t.contains(r))return[];let i=bo(p,r,d),a=Cc(n,t),o=u.createElementNS(kt,`g`);X(o,{class:`ec-switch-guide`,"data-key":e.key,transform:So(i)?void 0:Mt(i)}),o.appendChild(a);let s=Co(n);return[{key:e.key,group:o,markup:a.outerHTML,corners:wc(n).map(e=>J.apply(i,J.apply(s,e))),place:i}]})}function ne(e,t,n,r){let i=Y(`g`,{class:`ec-switch-fade`,"data-key":e.key},m);At(i,v(t));let a=Lc(t,n);Hn(i).path(e.outline.d,e.outline.closed?{fill:`mark`,...a>0?{stroke:`surface`,width:a}:{}}:{stroke:`mark`,width:e.thickness});let o=Rc(t,e,n);return o&&zc(i.appendChild(re()),o),e=>X(i,{opacity:r(e)})}function re(){let e=u.createElementNS(kt,`circle`);return e.setAttribute(`class`,`ec-switch-end`),At(e,{fill:mn(`mark`),stroke:mn(`surface`)}),e}function ie(e,t,n){let r=e.element.cloneNode(!0);for(let e of[`id`,`opacity`,`visibility`,`aria-hidden`])r.removeAttribute(e);r.textContent=e.text;let i={text:r,at:J.apply(t,e),scale:n};return X(r,{x:i.at.x,y:i.at.y,"text-anchor":e.anchor,...Dc(i,i.at.x,i.at.y)}),g.appendChild(r),i}let ae={get current(){return S},show(e,t){if(!f.has(e))return Promise.reject(N(e));let n=t?.via;if(n!==void 0&&!f.has(n))return Promise.reject(N(n,` to go via`));if(w)return Promise.resolve();let r=O;if(r)return new Promise(n=>r.push(()=>n(ae.show(e,t))));let i=C;if(!i)return e===S?Promise.resolve():R(M(S),M(e),n);let a=i.forward?i.b:i.a,o=i.forward?i.a:i.b,s=i.next;return e===(s??a).name?i.done:s&&(i.next=void 0,e===a.name)?(S=e,i.settle(),{done:i.done,settle:i.settle}=Vc(),i.done):e===o.name?U(i):(W(i,!1),R(a,M(e),n,{focus:i.focus}))},chart(e){let t=f.get(e);if(!t)throw N(e);return t.chart},on(e,t){let n=Array.from(f.values(),n=>{let r=n.chart.on;if(typeof r==`function`)return r.call(n.chart,e,e=>{n.name===S&&t(e)})});return()=>{for(let e of n)e?.()}},marks:()=>M(S).chart.marks(),leave(){D=!1,w||M(S).chart.leave()},destroy(){if(w)return;w=!0;let e=C;if(e){C=void 0,e.run++,e.driver?.cancel(),e.transition?.clear(),e.scene.clear();for(let t of[e.a,e.b])t.chart.morphing?.(!1);e.settle()}k(),j?.disconnect(),_?.destroy();let t=T;T=void 0,t?.gone();for(let e of f.values())e.chart.destroy();d.remove()}},oe=e=>C===void 0&&e.name===S;function se(e){let t=()=>{E===e&&(E=void 0,T?.leave())};return{hover(t){oe(e)&&(E=e,T?.hover(t))},leave:t,dismiss(){oe(e)&&T?.dismiss()},shown(){},gone:t}}return An({targets:()=>C===void 0?M(S).port?.targets()??[]:[],hover(e,t){D=!0,C===void 0&&M(S).port?.hover(e,t)},unlink(){D=!1;for(let e of f.values())e.port?.unlink()},leave:()=>ae.leave(),listen(e){if(w)return!1;T=e,E=void 0,D=!1;for(let t of f.values())t.port?.listen(e&&se(t));return!0},parts:Array.from(f.values()).flatMap(e=>e.port?[e.port]:[])},ae)}function gc(e,t,n){let r=l(e),i;return i=y({duration:950,timing:`transition`,ease:o,update:n=>{let a=Math.min(1,r+n);t(n===0?e:s(a)),a>=1&&n<1&&i?.finish()}},n),i}function _c(e){let t=e.now();return{clock:{now:()=>t??e.now(),onFrame:t=>e.onFrame(t)},release(){t=void 0}}}function vc(e,t){e.classList.toggle(`ec-switch-inactive`,!t),e.toggleAttribute(`inert`,!t),t?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,`true`)}function yc(e,t){e.style.setProperty(`opacity`,bc(t))}let bc=e=>String(Math.round(e*1e3)/1e3),xc=`fill.fill-opacity.fill-rule.stroke.stroke-opacity.stroke-width.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.paint-order.marker-start.marker-mid.marker-end.color.visibility.font-family.font-size.font-style.font-weight.font-stretch.font-variant-caps.font-variant-ligatures.font-variant-numeric.font-feature-settings.font-kerning.letter-spacing.word-spacing.text-anchor.dominant-baseline.text-rendering.shape-rendering.writing-mode.direction`.split(`.`),Sc={opacity:`1`,display:`inline`,"clip-path":`none`,mask:`none`,filter:`none`,"vector-effect":`none`};function Cc(e,t){let n=e.cloneNode(!0),r=[e,...e.querySelectorAll(`*`)],i=[n,...n.querySelectorAll(`*`)];return r.forEach((e,n)=>{let r=i[n];r.removeAttribute(`id`);let a=e.ownerDocument.defaultView?.getComputedStyle?.(e),o={};for(let n of xc)o[n]=Io(e,t,n)||void 0;for(let[e,t]of Object.entries(Sc)){let n=a?.getPropertyValue(e).trim();n&&n!==t&&(o[e]=n)}At(r,o)}),n}function wc(e){try{let t=e.getBBox?.();if(t)return[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x,y:t.y+t.height},{x:t.x+t.width,y:t.y+t.height}]}catch{}return[{x:0,y:0}]}let Tc=(e,t)=>e.markup===t.markup&&e.corners.length===t.corners.length&&e.corners.every((e,n)=>Math.hypot(e.x-t.corners[n].x,e.y-t.corners[n].y)<=.5)&&[0,1,2,3].every(n=>Math.abs(e.place[n]-t.place[n])<=1e-4);function Ec(e,t){return n=>{let r=Pc(e.at.x,t.at.x,n),i=Pc(e.at.y,t.at.y,n),a=n>=mc;X(e.text,{x:r,y:i,visibility:a?`hidden`:void 0,...Dc(e,r,i)}),X(t.text,{x:r,y:i,visibility:a?void 0:`hidden`,...Dc(t,r,i)})}}let Dc=(e,t,n)=>e.scale===1?{}:{transform:Mt([e.scale,0,0,e.scale,t*(1-e.scale),n*(1-e.scale)])};function Oc(e,t){return n=>X(e.text,{opacity:t(n)})}let kc=e=>1-Nc(e/mc),Ac=e=>Nc((e-mc)/.5),jc=e=>1-Nc(e/.4),Mc=Ac,Nc=e=>Math.min(1,Math.max(0,e)),Pc=(e,t,n)=>e*(1-n)+t*n;function Fc(e,t){return e.chart.paintOf?.(t.key)??{color:t.key,drawn:!0}}function Ic(e){return be({key:e.key,...e.series===void 0?{}:{series:e.series},x:e.center.x,y:e.center.y,r:0})}let Lc=(e,t)=>e.drawn&&e.end===void 0?(e.ring??0)*t:0;function Rc(e,t,n){return e.drawn&&e.end!==void 0?{at:t.end,r:e.end*n,ring:(e.ring??0)*n}:void 0}function zc(e,t){X(e,{cx:t.at.x,cy:t.at.y,r:t.r,"stroke-width":t.ring})}let Bc=e=>Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]));function Vc(){let e;return{done:new Promise(t=>{e=t}),settle:e}}function Hc(e,t){if(typeof e!=`object`||!e)return!1;let n=e,r=n.element;return[`marks`,`labels`,`focus`,`leave`,`destroy`].every(e=>typeof n[e]==`function`)&&r?.nodeType===1&&t.contains(r)}function Uc(e){if(typeof e!=`object`||!e)throw TypeError(`chartSwitch needs options.`);let{views:t,initial:n,transition:r,announce:i}=e;if(typeof t!=`object`||!t)throw TypeError(`chartSwitch needs views: by name, a function that draws each view's chart in the container it's given.`);let a=Object.keys(t);if(a.length===0)throw TypeError(`chartSwitch needs at least one view.`);for(let e of a)if(typeof t[e]!=`function`)throw TypeError(`chartSwitch: views.${e} must be a function that draws the view's chart in the container it's given.`);if(typeof n!=`string`||!a.includes(n))throw TypeError(`chartSwitch: initial must be one of the views (${a.map(e=>JSON.stringify(e)).join(`, `)}), got ${typeof n==`string`?JSON.stringify(n):String(n)}.`);if(!fc(r))throw TypeError(`chartSwitch: transition must be a transition effect, such as morph().`);if(i!==void 0&&typeof i!=`boolean`)throw TypeError(`chartSwitch: announce must be true or false.`);return a}let Wc=[`presentation`,`analysis`,`off`],Gc={presentation:`Presentation`,analysis:`Analysis`,off:`Off`},Kc={presentation:`Staged, unhurried motion. Best for walking someone through a change.`,analysis:`Quick, unstaged motion. Best for exploring.`,off:`No motion: charts jump straight to their end state.`,reduced:`Your device asks for reduced motion, so motion is off. Picking a mode here overrides it.`},qc=0;function Jc(e,t,n={}){let r=Xc(e);Zc(t),Qc(n);let i={...Gc,...n.labels},a={...Kc,...n.hints},{persist:o}=n,s=r.ownerDocument;bn(s);let c=`ec-motion-${++qc}`,l=s.createElement(`div`);l.className=`ec-motion-switch`,l.setAttribute(`role`,`group`),l.setAttribute(`aria-labelledby`,`${c}-label`),l.setAttribute(`aria-describedby`,`${c}-hint`);let u=l.appendChild(s.createElement(`span`));u.className=`ec-motion-label`,u.id=`${c}-label`,u.textContent=n.label??`Motion`;let d=l.appendChild(s.createElement(`span`));d.className=`ec-motion-modes`;let f=Wc.map(e=>{let n=d.appendChild(s.createElement(`button`));return n.type=`button`,n.dataset.mode=e,n.textContent=i[e],n.addEventListener(`click`,()=>t.chooseMode(e)),n}),p=l.appendChild(s.createElement(`span`));p.className=`ec-motion-hint`,p.id=`${c}-hint`,p.setAttribute(`aria-live`,`polite`);let m=()=>{let e=t.mode;for(let t of f)t.setAttribute(`aria-pressed`,String(t.dataset.mode===e));p.textContent=t.prefersReduced&&t.viewerChoice===void 0?a.reduced:a[e]};if(o!==void 0){let e=Yc(s,e=>e.getItem(o));Wc.includes(e)&&t.chooseMode(e)}m(),r.appendChild(l);let h=t.subscribe(()=>{if(m(),o===void 0)return;let e=t.viewerChoice;Yc(s,t=>e===void 0?t.removeItem(o):t.setItem(o,e))}),g=!1;return{element:l,destroy(){g||(g=!0,h(),l.remove())}}}function Yc(e,t){try{let n=e.defaultView?.localStorage;return n?t(n):void 0}catch{return}}function Xc(e){if(typeof e==`string`){let t=typeof document>`u`?null:document.querySelector(e);if(!t)throw TypeError(`motionSwitch: no element matches "${e}".`);return t}if(typeof e!=`object`||!e||typeof e.appendChild!=`function`)throw TypeError(`motionSwitch needs an element or a selector to build the switch in.`);return e}function Zc(e){if(typeof e!=`object`||!e||typeof e.chooseMode!=`function`||typeof e.subscribe!=`function`)throw TypeError("motionSwitch needs a Motion, such as the page-wide `motion` or one from createMotion().")}function Qc(e){let{label:t,labels:n,hints:r,persist:i}=e;if(t!==void 0&&typeof t!=`string`)throw TypeError(`motionSwitch: label must be a string, got ${typeof t}.`);for(let[e,t]of[[`labels`,n],[`hints`,r]])if(t!==void 0){for(let[n,r]of Object.entries(t))if(typeof r!=`string`)throw TypeError(`motionSwitch: ${e}.${n} must be a string, got ${typeof r}.`)}if(i!==void 0&&(typeof i!=`string`||i===``))throw TypeError(`motionSwitch: persist must be a localStorage key, got ${JSON.stringify(i)??String(i)}.`)}let $c={play:`Play`,pause:`Pause`};function el(e,t,n={}){let r=tl(e);nl(t),rl(n);let i={...$c,...n.labels},a=r.ownerDocument;bn(a);let o=a.createElement(`button`);o.type=`button`,o.className=`ec-play`,o.addEventListener(`click`,()=>t.playing?t.pause():t.play());let s=()=>{let e=t.playing?i.pause:i.play;o.textContent!==e&&(o.textContent=e)};s(),r.appendChild(o);let c=t.subscribe(s),l=!1;return{element:o,destroy(){l||(l=!0,c(),o.remove())}}}function tl(e){if(typeof e==`string`){let t=typeof document>`u`?null:document.querySelector(e);if(!t)throw TypeError(`playButton: no element matches "${e}".`);return t}if(typeof e!=`object`||!e||typeof e.appendChild!=`function`)throw TypeError(`playButton needs an element or a selector to build the button in.`);return e}function nl(e){if(typeof e!=`object`||!e||typeof e.play!=`function`||typeof e.pause!=`function`||typeof e.subscribe!=`function`)throw TypeError(`playButton needs a Playback, from playback().`)}function rl(e){let{labels:t}=e;if(t!==void 0){for(let[e,n]of Object.entries(t))if(typeof n!=`string`||n.trim()===``)throw TypeError(`playButton: labels.${e} must be a string with some text, got ${JSON.stringify(n)??String(n)}.`)}}let il=Object.freeze({lift:0,spin:0,tilt:0});function al(){return e=>({lift:0,spin:e.distance/e.radius,tilt:0})}function ol(e={}){let t=e.stride??42,n=e.lift??3.2,r=e.tilt??9;if(!(t>0)||!Number.isFinite(t))throw RangeError(`gaits.step: stride must be more than 0, got ${t}.`);if(!(n>=0)||!Number.isFinite(n))throw RangeError(`gaits.step: lift can't be negative, got ${n}.`);if(!Number.isFinite(r))throw RangeError(`gaits.step: tilt must be a finite number of degrees, got ${r}.`);let i=r*Math.PI/180;return Object.assign(e=>{let r=Math.max(1,Math.round(e.length/t)),a=Math.abs(Math.sin(Math.PI*(e.progress*r%1)));return{lift:a*n,spin:0,tilt:a*i*(1-.3*e.progress)}},{ease:s,pace:1.15})}function sl(){return()=>il}let cl={roll:al,step:ol,slide:sl},ll=[1,0,0,1,0,0],ul=[`auto`,`follow`,`level`],dl=[`center`,`on`];function fl(e,t={}){yl(e,t);function n(n,r){let i=typeof e==`string`?r.icons.get(e):e;if(!i)throw RangeError(`travel: unknown icon "${String(e)}". Register it with registerIcon(icon), or pass the icon itself.`);let a=ml(n,t.along);if(!a||!(gl(a)>=.5))return;let o=t.size===void 0?1:t.size===`fit`?.85*a.thickness/i.box.height:t.size/i.size;if(o>0)return pl(a,i,o,t)}function r(e,t){let r=n(e,t),i,a,o=0,s=()=>{r?(i&&a?.icon===r.icon&&a.size===r.size||(i?.remove(),i=t.layer.icon(r.icon,{size:r.size}),a={icon:r.icon,size:r.size}),i.place(r.transform(o))):(i?.remove(),i=a=void 0)};return t.onChange(e=>{r=n(e,t),s()}),{get trip(){return r},show(e){o=e,s()}}}return{kind:`geometry`,async run(e,t){if(t.signal.aborted)return;let n=r(e,t),i=n.trip;!i||i.span<=0?n.show(1):await t.tween({duration:i.duration,timing:`effect`,ease:i.gait.ease??c,update:e=>n.show(e)}).finished},end(e,t){r(e,t).show(1)},clear(){}}}function pl(e,t,n,r){let i=typeof r.gait==`function`?r.gait:cl[r.gait??t.gait??`slide`](),a=e.length,o=t.footprint[0]*n,s=t.footprint[1]*n,c=0,l=hl(e).map(([e,t])=>{let n={from:e,to:t,span:Math.max(0,t-e-o-s),before:c};return c+=n.span,n}),u=Math.max(2,(o+s)/2),d=t.radius??t.box.height/2,{anchor:f}=t,p={x:f.x+n*(t.pivot.x-f.x),y:f.y+n*(t.pivot.y-f.y)},m=r.ride===`on`?e.thickness/2+(t.box.y+t.box.height-f.y)*n:0,h=r.orient??`auto`;return{icon:t,size:t.size*n,span:c,duration:Math.min(4e3,Math.max(260,c/360*1e3)*(i.pace??1)),gait:i,transform(r){let s=r*c,g=l.length-1;for(;g>0&&l[g].before>s;)g--;let _=l[g],v=_.from+o+Math.min(_.span,s-_.before),y=i({distance:s/n,length:c/n,progress:r,radius:d}),b=_l(e,v),x=vl(e,Math.min(v,a),u,_),S=h===`auto`&&t.upright===!0&&Math.cos(x)<-1e-9,C=h===`level`?0:S?P(x-Math.PI):x;return J.multiply(J.translate(b.x,b.y),J.rotate(C),S?J.scale(-1,1):ll,J.translate(-f.x,-f.y-y.lift*n-m),J.rotate(y.spin-y.tilt,p))}}}function ml(e,t){return t===void 0?e:e.segments?e.segments.find(e=>e.series===t):e.series===t?e:void 0}function hl(e){let{length:t}=e,n=[],r=0;for(let[i,a]of e.gaps??[])a>i&&a>r&&(i>r&&n.push([r*t,Math.min(1,i)*t]),r=Math.min(1,a));return n.push([r*t,t]),n}function gl(e){return hl(e).reduce((e,[t,n])=>e+(n-t),0)}function _l(e,t){let{length:n}=e;return t<=n?e.path(t/n):et(e.end,e.angle(1),t-n)}function vl(e,t,n,r){let{length:i}=e,a=Math.min(n,t-r.from,r.to-t);if(a>1e-6){let n=e.path((t-a)/i),r=e.path((t+a)/i);if(Math.hypot(r.x-n.x,r.y-n.y)>1e-9)return Math.atan2(r.y-n.y,r.x-n.x)}return e.angle(t/i)}function yl(e,t){if((typeof e!=`string`||e===``)&&(typeof e!=`object`||!e||typeof e.name!=`string`))throw TypeError(`travel needs an icon or an icon's name, got ${e===null?`null`:typeof e}.`);let{along:n,gait:r,size:i,orient:a,ride:o}=t;if(n!==void 0&&typeof n!=`string`)throw RangeError(`travel: along must be a series name, got ${String(n)}.`);if(r!==void 0&&typeof r!=`function`&&!Object.prototype.hasOwnProperty.call(cl,r))throw RangeError(`travel: gait must be a gait or one of roll, step, slide, got ${String(r)}.`);if(i!==void 0&&i!==`fit`&&!(typeof i==`number`&&i>0&&Number.isFinite(i)))throw RangeError(`travel: size must be more than 0 px, or "fit", got ${String(i)}.`);if(a!==void 0&&!ul.includes(a))throw RangeError(`travel: orient must be auto, follow or level, got ${String(a)}.`);if(o!==void 0&&!dl.includes(o))throw RangeError(`travel: ride must be center or on, got ${String(o)}.`)}let bl=.25;function xl(e={}){wl(e);let t=e.width??8,n=e.opacity??.35,{color:r}=e,i=(e,i)=>{let a=t*Sl(i);e.mark.set({halo:a>0?{width:a,opacity:n,...r===void 0?{}:{color:r}}:void 0})};return{kind:`geometry`,async run(e,t){t.signal.aborted||await t.tween({duration:900,timing:`effect`,ease:o,update:e=>i(t,e)}).finished},end(){},clear(){}}}function Sl(e){return!(e>0)||e>=1?0:e<bl?Cl(e/bl):1-Cl((e-bl)/.75)}function Cl(e){if(!(e>0))return 0;if(e>=1)return 1;let t=0,n=1;for(let r=0;r<24;r++){let r=(t+n)/2;1.74*r*r*(1-r)+r*r*r<e?t=r:n=r}let r=(t+n)/2;return 3*r*r-2*r*r*r}function wl(e){let{width:t,opacity:n,color:r}=e;if(t!==void 0&&!(typeof t==`number`&&t>0&&Number.isFinite(t)))throw RangeError(`flash: width must be more than 0 px, got ${String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>0&&n<=1))throw RangeError(`flash: opacity must be more than 0 and at most 1, got ${String(n)}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`flash: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}let Tl=[1,-.5,.25],El=Math.PI/12;function Dl(e={}){Al(e);let t=e.swing??3;return{kind:`geometry`,async run(e,n){if(n.signal.aborted)return;let r=e,i=Ol(e,t),a=0,s=()=>{let e=i*kl(a);n.mark.set({transform:e===0?void 0:J.rotate(e,r.pivot)})};n.onChange(e=>{r=e,i=Ol(e,t),s()}),await n.tween({duration:450,timing:`effect`,ease:o,update:e=>{a=e,s()}}).finished},end(){},clear(){}}}function Ol(e,t){let{pivot:n}=e,r=0;for(let t of e.outline.sample(64))r=Math.max(r,Math.hypot(t.x-n.x,t.y-n.y));return r>=.5?Math.min(El,2*Math.asin(Math.min(1,t/(2*r)))):0}function kl(e){if(!(e>0)||e>=1)return 0;let t=e*Tl.length,n=Math.floor(t);return Tl[n]*Math.sin(Math.PI*(t-n))}function Al(e){let{swing:t}=e;if(t!==void 0&&!(typeof t==`number`&&t>0&&t<=3))throw RangeError(`wiggle: swing must be more than 0 and at most 3 px, got ${String(t)}.`)}function jl(e={}){Ml(e);let t=e.times??2,n=e.width??12,{color:r}=e,i=(e,t)=>{let i=t>0&&t<1;e.mark.set({halo:i?{width:n*c(t),opacity:.4*(1-t),...r===void 0?{}:{color:r}}:void 0})};return{kind:`geometry`,async run(e,n){let r=0;for(let e=0;e<t;e++){if(n.signal.aborted)return;let e=n.motion.duration(600,`effect`);if(r+e>=5e3)return;r+=e,await n.tween({duration:600,timing:`effect`,ease:o,update:e=>i(n,e)}).finished}},end(){},clear(){}}}function Ml(e){let{times:t,width:n,color:r}=e;if(t!==void 0&&!(Number.isInteger(t)&&t>=1&&t<=6))throw RangeError(`pulse: times must be a whole number from 1 to 6, got ${String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>0&&Number.isFinite(n)))throw RangeError(`pulse: width must be more than 0 px, got ${String(n)}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`pulse: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}let Nl=.5;function Pl(e={}){Fl(e);let t=e.duration??500,n={stroke:e.color??`mark`,width:e.width??3,opacity:e.opacity??.5,linecap:`round`},r=(e,t)=>{let r=e,i=0,a,o=()=>{if(!(r.length>=Nl)){a?.remove(),a=void 0;return}let e=r.slice(0,i);a?a.update(e):a=t.layer.path(e,n)};return t.onChange(e=>{r=e,o()}),o(),e=>{i=e,o()}};return{kind:`geometry`,async run(e,n){if(n.signal.aborted)return;let i=r(e,n);e.length>=Nl?await n.tween({duration:t,timing:`effect`,ease:s,update:i}).finished:i(1)},end(e,t){r(e,t)(1)},clear(){}}}function Fl(e){let{color:t,width:n,opacity:r,duration:i}=e;if(t!==void 0&&(typeof t!=`string`||t===``))throw RangeError(`trace: color must be a theme token or a CSS colour, got ${JSON.stringify(t)??String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>=0&&Number.isFinite(n)))throw RangeError(`trace: width must be 0 px or more, got ${String(n)}.`);if(r!==void 0&&!(typeof r==`number`&&r>=0&&r<=1))throw RangeError(`trace: opacity must be from 0 to 1, got ${String(r)}.`);if(i!==void 0&&!(typeof i==`number`&&i>=0&&Number.isFinite(i)))throw RangeError(`trace: duration must be 0 ms or more, got ${String(i)}.`)}function Il(e={}){Rl(e);let t=e.duration??750,n=e.faint??.3;return{kind:`geometry`,async run(e,r){if(r.signal.aborted||!(Ll(e)>=.5))return;let i=e,a=0,c=!1,l=[],u=e=>{let{segments:t}=i,n=t??[i],o=a*Ll(i),c=0;n.forEach((n,i)=>{let a=n.length>0?Math.min(1,Math.max(0,(o-c)/n.length)):0;c+=n.length;let u=n.slice(0,s(a)),d={stroke:`mark`,width:n.thickness,linecap:`butt`,...t&&{part:n.key}},f=l[i];f?f.update(u,e?{part:void 0,...d}:void 0):l[i]=r.layer.path(u,d)});for(let e of l.splice(n.length))e.remove()};r.onChange(e=>{i=e,c||u(!0)}),r.mark.set({opacity:n}),u(!1),await r.tween({duration:t,timing:`effect`,ease:o,update:e=>{a=e,u(!1)}}).finished,c=!0;for(let e of l)e.remove();r.mark.set({opacity:void 0})},end(){},clear(){}}}let Ll=e=>(e.segments??[e]).reduce((e,t)=>e+t.length,0);function Rl(e){let{duration:t,faint:n}=e;if(t!==void 0&&!(typeof t==`number`&&t>=0&&Number.isFinite(t)))throw RangeError(`drawIn: duration must be 0 ms or more, got ${String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>=0&&n<=1))throw RangeError(`drawIn: faint must be from 0 to 1, got ${String(n)}.`)}let zl=.36;function Bl(e,t){let n=e.labelBounds??[],r=[...n,...e.nearbyLabels??[],...t?.held??[]],i=e.angle(1);if(Kl(e.end,i,n)===void 0){let i=e.angle(.5)-Math.PI/2;if(Kl(e.center,i,n)!==void 0)return Vl(e.center,i,0,n,r,t)}return Vl(e.end,i,10,n,r,t)}function Vl(e,t,n,r,i,a){if(!a)return Wl(e,t,Math.max(n,Kl(e,t,i)??-1/0));let{x:o,y:s,width:c,height:l}=a.box(Wl(e,t,0));return Wl(e,t,Hl(e,t,Math.max(n,Kl(e,t,r)??-1/0),i,{x:o-e.x,y:s-e.y,width:c,height:l},new Set(a.held)))}function Hl(e,t,n,r,i,a){let o=Math.cos(t),s=Math.sin(t),c=Gl(o),l=t=>Jl(e,o,s,{x:t.x-i.x-i.width,y:t.y-i.y-i.height,width:t.width+i.width,height:t.height+i.height}),u=r.map(t=>{let n=Ul(t,6),r=Jl(e,o,s,n);if(!r&&a.has(t))return l(t);let i=l(n);if(!r||!i)return i;let u=c?Math.max(r[1],((s>0?n.y+n.height:n.y)-e.y)/s):r[1];return[i[0],Math.max(u,l(t)?.[1]??-1/0)]}),d=n;for(let e=!0;e;){e=!1;for(let t of u)t&&d>t[0]+1e-6&&d<t[1]-1e-6&&(d=t[1],e=!0)}return d}let Ul=({x:e,y:t,width:n,height:r},i)=>({x:e-i,y:t-i,width:n+2*i,height:r+2*i});function Wl(e,t,n){let r=Math.cos(t),i=Math.sin(t),a=et(e,t,n),o=12.5*(i<0?zl*(1+i):zl+.44000000000000006*i),s=Gl(r)?`middle`:r>0?`start`:`end`;return{at:{x:a.x,y:a.y+o},anchor:s,toward:t}}function Gl(e){return Math.abs(e)<=Math.SQRT1_2+1e-9}function Kl(e,t,n){let r=Math.cos(t),i=Math.sin(t),a=Gl(r),o;for(let t of n){let n=Ul(t,6),s=ql(e,r,i,n);s!==void 0&&a&&(s=Math.max(s,((i>0?n.y+n.height:n.y)-e.y)/i)),s!==void 0&&(o=Math.max(o??s,s))}return o}function ql(e,t,n,r){return Jl(e,t,n,r)?.[1]}function Jl(e,t,n,r){let i=0,a=1/0;for(let[o,s,c,l]of[[e.x,t,r.x,r.x+r.width],[e.y,n,r.y,r.y+r.height]]){if(Math.abs(s)<1e-12){if(o<c||o>l)return;continue}let e=(c-o)/s,t=(l-o)/s;i=Math.max(i,Math.min(e,t)),a=Math.min(a,Math.max(e,t))}return a>=i?[i,a]:void 0}function Yl(e,t,n,r,i){let a=e,o=i(e,t)??``,s=t,c=0,l,{texts:u}=n,d=()=>{if(o===``){l?.remove(),l=void 0,u?.hold(void 0);return}let{at:e,anchor:t,toward:i}=Bl(a,u&&{held:u.held(),box:e=>u.box(o,e)});u?.hold(u.box(o,{at:e,anchor:t}));let s={at:et(e,i-Math.PI/2,-8*(1-c)),anchor:t,color:r,opacity:c};l?l.update(s,o):l=n.layer.text(o,s)};return n.onChange((e,t)=>{a=e,s=t??s,o=i(a,s)??``,d()}),d(),e=>{c=e,d()}}let Xl=e=>{let{samples:t}=e;return t[t.length-1]?.value??NaN},Zl,Ql=e=>(Zl??(Zl=new Intl.NumberFormat(void 0,{signDisplay:`always`,maximumFractionDigits:2})),Zl.format(e));function $l(e={}){eu(e);let t=e.value??Xl,n=e.format??Ql,r=e.color??`text`,i=e=>{if(!e.previous)return;let r=t(e),i=t(e.previous),a=r-i;if(!(!Number.isFinite(a)||Math.abs(a)<=1e-9*Math.max(Math.abs(r),Math.abs(i))))return n(a)};return{kind:`data`,run:async(e,t,n)=>{if(n.signal.aborted)return;let a=i(t);if(a===void 0||a===``)return;let o=Yl(e,t,n,r,()=>a);await n.tween({duration:400,timing:`effect`,update:o}).finished},end:(e,t,n)=>{let a=i(t);a!==void 0&&a!==``&&Yl(e,t,n,r,()=>a)(1)},clear(){}}}function eu(e){let{value:t,format:n,color:r}=e;if(t!==void 0&&typeof t!=`function`)throw TypeError(`delta: value must be a function that reads the mark's value from its data, got ${typeof t}.`);if(n!==void 0&&typeof n!=`function`)throw TypeError(`delta: format must be a function that words the change, got ${typeof n}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`delta: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}function tu(e,t={}){if(typeof e!=`function`)throw TypeError(`label needs a function that returns the text from the mark's data, got ${typeof e}.`);let{color:n=`text`}=t;if(typeof n!=`string`||n===``)throw RangeError(`label: color must be a theme token or a CSS colour, got ${JSON.stringify(n)??String(n)}.`);let r=(t,n)=>{let r=e(n,t);return r==null?void 0:String(r)};return{kind:`data`,run:async(e,t,i)=>{if(i.signal.aborted)return;let a=Yl(e,t,i,n,r);await i.tween({duration:400,timing:`effect`,update:a}).finished},end:(e,t,i)=>Yl(e,t,i,n,r)(1),clear(){}}}let nu=[`below`,`above`];function ru(e){fu(e);let{compareTo:t}=e,n=e.when??`below`,r=e.color??`negative`,i=(e,i,a)=>{let o=[],s=i,c=e=>{let i=e.length>=.5?lu(s.samples,iu(t,s),n):[],c={stroke:r,width:e.thickness,linecap:`butt`};i.forEach(([t,n],r)=>{let i=e.slice(t,n),s=o[r];s?s.update(i,c):o.push(a.layer.path(i,c))});for(let e of o.splice(i.length))e.remove()};a.onChange((e,t)=>{s=t??s,c(e)}),c(e)};return{kind:`data`,...typeof t==`string`?{needs:Object.freeze({related:Object.freeze([t])})}:{},run:async(e,t,n)=>{n.signal.aborted||i(e,t,n)},end:(e,t,n)=>i(e,t,n),clear(){}}}function iu(e,t){if(typeof e==`number`)return{place:e=>e.t,valueAt:()=>e,bends:[]};let n=t.related(e);if(!n)return;let r=t.samples.every(e=>su(e.at)!==void 0)&&n.samples.every(e=>su(e.at)!==void 0)?e=>su(e.at):e=>e.t,i=n.samples.map(e=>({u:r(e),value:e.value})).filter(e=>Number.isFinite(e.u)).sort((e,t)=>e.u-t.u),a=au(n.samples,r);return{place:r,valueAt:e=>ou(a,e)?void 0:cu(i,e),bends:i.map(e=>e.u)}}function au(e,t){let n=[];e.forEach((r,i)=>{let a=e[i-1];if(r.gapBefore!==!0||!a)return;let o=t(a),s=t(r);Number.isFinite(o)&&Number.isFinite(s)&&o!==s&&n.push([Math.min(o,s),Math.max(o,s)])}),n.sort((e,t)=>e[0]-t[0]);let r=[];for(let e of n){let t=r[r.length-1];t&&e[0]<t[1]?t[1]=Math.max(t[1],e[1]):r.push(e)}return r}function ou(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i][0]<t?n=i+1:r=i}let i=e[n-1];return i!==void 0&&t<i[1]}function su(e){let t=typeof e==`number`?e:e instanceof Date?e.getTime():void 0;return t!==void 0&&Number.isFinite(t)?t:void 0}function cu(e,t){let n=e[0],r=e[e.length-1];if(!n||!r||t<n.u||t>r.u)return;let i=0,a=e.length-1;for(;i<a;){let n=i+a>>1;e[n].u<t?i=n+1:a=n}let o=e[i];if(i===0||o.u===t)return o.value;let s=e[i-1];return s.value+(t-s.u)/(o.u-s.u)*(o.value-s.value)}function lu(e,t,n){if(!t)return[];let r=n===`below`?1:-1,i=(e,n,i,a=!0)=>{let o=t.valueAt(n);if(o===void 0||!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(e))return{t:e,u:n,past:void 0,joined:a};let s=r*(o-i);return{t:e,u:n,past:Math.abs(s)<=1e-9*Math.max(Math.abs(o),Math.abs(i))?0:s,joined:a}},a=[];e.forEach((n,r)=>{let o=t.place(n);a.push(i(n.t,o,n.value,n.gapBefore!==!0));let s=e[r+1];if(!s||s.gapBefore===!0)return;let c=t.place(s);if(o===c||!Number.isFinite(o)||!Number.isFinite(c))return;let l=[],{bends:u}=t;for(let e=du(u,Math.min(o,c));e<u.length&&u[e]<Math.max(o,c);e++)l.push((u[e]-o)/(c-o));c<o&&l.reverse();for(let e of l)a.push(i(n.t+e*(s.t-n.t),o+e*(c-o),n.value+e*(s.value-n.value)))});let o=[],s=(e,t)=>{let n=uu(e),r=uu(t);if(!(r>n))return;let i=o[o.length-1];i&&i[1]>=n?i[1]=Math.max(i[1],r):o.push([n,r])};for(let e=1;e<a.length;e++){let n=a[e-1],r=a[e];n.past!==void 0&&r.past!==void 0&&r.joined&&r.t>n.t&&(n.u===r.u||t.valueAt((n.u+r.u)/2)!==void 0)&&(n.past>0&&r.past>0?s(n.t,r.t):n.past>0?s(n.t,n.t+(r.t-n.t)*(n.past/(n.past-r.past))):r.past>0&&s(n.t+(r.t-n.t)*(n.past/(n.past-r.past)),r.t))}return o}let uu=e=>Math.min(1,Math.max(0,e));function du(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i]<=t?n=i+1:r=i}return n}function fu(e){let{compareTo:t,when:n,color:r}=e??{};if(!(typeof t==`string`?t!==``:typeof t==`number`&&Number.isFinite(t)))throw RangeError(`threshold: compareTo must be a finite number or a series name, got ${pu(t)}.`);if(n!==void 0&&!nu.includes(n))throw RangeError(`threshold: when must be "below" or "above", got ${pu(n)}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`threshold: color must be a theme token or a CSS colour, got ${pu(r)}.`)}let pu=e=>typeof e==`string`?JSON.stringify(e):String(e),mu=[`unroll`,`drop`],hu=.01;function gu(e={}){Zu(e);let t=e?.points??160,n=e?.align??`unroll`;return{kind:`transition`,async run(e,r,i){if(i.signal.aborted)return;let a=_u(e,r,i.layer,t,n),c=Xu(i.start);if(c>=1){a(1);return}let u=l(c),d;d=i.tween({duration:950,timing:`transition`,ease:o,update:e=>{let t=Math.min(1,u+e);a(e===0?c:s(t)),t>=1&&e<1&&d?.finish()}}),await d.finished},end(e,r,i){_u(e,r,i.layer,t,n)(1)},clear(){}}}function _u(e,t,n,r,i){let a=e.outline.closed;if(a!==t.outline.closed)return Gu(e,t,n);let o=a?void 0:Cu(e,t,r);if(o)return bu(e,t,n,o.stops,o.kinds);let s=a?ku(e,t,r):void 0,c=s?.from??e.outline.sample(r),l=s?.to??t.outline.sample(r);if(!a)return e.gaps?.length||t.gaps?.length?yu(e,t,n,c,l):vu(e,t,n,c,l);let[u,d]=!s&&i===`drop`?Yu(e,t,r):[0,0],f=Mu(e,t,c,l,[u,d],r/4),p;return r=>{let i=r<=0?e.outline.d:r>=1?t.outline.d:Ku(c,l,u,d,r,!0)+f.map(e=>Fu(e,r)).join(``);p?p.update(i):p=n.path(i,{fill:`mark`})}}function vu(e,t,n,r,i){let a;return o=>{let s=o<=0?e.outline.d:o>=1?t.outline.d:Ku(r,i,0,0,o,!1),c=o<=0?e.thickness:o>=1?t.thickness:Ju(e.thickness,t.thickness,o);a?a.update(s,{width:c}):a=n.path(s,{stroke:`mark`,width:c})}}function yu(e,t,n,r,i){let a=r.length,o=r.map((e,t)=>({t:t/(a-1),from:e,to:i[t]}));for(let n of[...e.gaps??[],...t.gaps??[]])for(let r of n)r>0&&r<1&&o.every(e=>Math.abs(e.t-r)>1e-9)&&o.push({t:r,from:e.path(r),to:t.path(r)});return o.sort((e,t)=>e.t-t.t),bu(e,t,n,o,o.slice(1).map((n,r)=>{let i=(o[r].t+n.t)/2;return+!!xu(e,i)+(xu(t,i)?2:0)}))}function bu(e,t,n,r,i){let a=[[],[],[]];for(let e=0;e<i.length;e++){let t=i[e];if(t===3)continue;let n=a[t][a[t].length-1];n&&n[1]===e?n[1]=e+1:a[t].push([e,e+1])}let o=[0,1,2].filter(e=>a[e].length>0).sort((e,t)=>a[e][0][0]-a[t][0][0]),s=[];return i=>{let c=i<=0?e.thickness:i>=1?t.thickness:Ju(e.thickness,t.thickness,i),l=[void 0,i,1-i],u=i<=0||i>=1?[[i<=0?e.outline.d:t.outline.d,void 0]]:o.map(e=>[a[e].map(e=>Su(r,e,i)).join(``),l[e]]);u.forEach(([e,t],r)=>{s[r]?s[r].update(e,{width:c,opacity:t}):s[r]=n.path(e,{stroke:`mark`,width:c,...t===void 0?{}:{opacity:t}})});for(let e of s.splice(u.length))e.remove()}}let xu=(e,t)=>(e.gaps??[]).some(([e,n])=>e<t&&t<n);function Su(e,[t,n],r){let i=``;for(let a=t;a<=n;a++)i+=`${a===t?`M`:`L`}${qu(e[a].from,e[a].to,r)}`;return i}function Cu(e,t,n){let r=Tu(e),i=r&&Tu(t);if(r&&i&&r.way===i.way)return wu(r,i,n)}function wu(e,t,n){let r=[...Array.from({length:n},(e,t)=>[t/(n-1),0]),...Du(e).map(e=>[e,1]),...Du(t).map(e=>[e,2])].sort((e,t)=>e[0]-t[0]),i=hu/Math.max(Math.abs(e.span),Math.abs(t.span)),a=[];for(let[e,t]of r){var o,s;let n=a[a.length-1];(!n||e-n[0]>i||t>0&&n[t]!==void 0)&&a.push(n=[e]),t===1&&((o=n)[1]??(o[1]=e)),t===2&&((s=n)[2]??(s[2]=e))}let c=a.length-1;if(c<1)return;let l=e=>a.map((t,n)=>n===0?0:n===c?1:t[e]??t[0]),[u,d]=[l(1),l(2)],[f,p]=[Ou(e,u),Ou(t,d)],m=a.map(([e],t)=>({t:e,from:f[t],to:p[t]})),[h,g]=[ju(e.gaps),ju(t.gaps)];return{stops:m,kinds:m.slice(1).map((e,t)=>+!!h((u[t]+u[t+1])/2)+(g((d[t]+d[t+1])/2)?2:0))}}function Tu(e){let t=K(Ae(e.outline.d)),n=[],r=[],i=0,a=0,o=r=>{if(!(r>a))return n.push(e.path(a)),!0;let o=t[i++];if(!o)return!1;n.push(o.start);for(let e of o.segments){if(e.kind!==`line`)return!1;n.push(e.to)}return!0};for(let[t,i]of e.gaps??[]){if(!o(t))return;r.push(n.length-1),a=i}return!o(1)||i<t.length||n.length<2?void 0:Eu(n,r)}function Eu(e,t=[]){let n=e[0].x,r=e[e.length-1].x-n,i=Math.sign(r);for(let t=1;t<e.length;t++)if(!((e[t].x-e[t-1].x)*i>0))return;let a=e.map(e=>(e.x-n)/r);return{points:e,shares:a,gaps:t.map(e=>[a[e],a[e+1]]),span:r,way:i}}function Du(e){let{points:t,shares:n,gaps:r}=e;if(t.length<=1e3)return n;let i=e=>Math.min(249,Math.floor(n[e]*250)),a=r.flat();for(let e=0,r=1;r<=t.length;r++){if(r<t.length&&i(r)===i(e))continue;let[o,s]=[e,e];for(let n=e;n<r;n++)t[n].y<t[o].y&&(o=n),t[n].y>t[s].y&&(s=n);a.push(n[e],n[o],n[s],n[r-1]),e=r}return Array.from(new Set(a))}function Ou(e,t){let{points:n,shares:r}=e,i=0;return t.map(e=>{for(;i+2<n.length&&r[i+1]<=e;)i++;let t=r[i+1]-r[i];return Iu(n[i],n[i+1],t>0?Math.min(1,Math.max(0,(e-r[i])/t)):0)})}function ku(e,t,n){let r=Au(e.outline),i=r&&Au(t.outline);if(!r||!i||Math.abs(r.left-i.left)>hu||Math.abs(r.right-i.right)>hu)return;let a=wu(r.upper,i.upper,n),o=wu(r.lower,i.lower,n);if(!a||!o)return;let s=[...a.stops,...o.stops];return{from:s.map(e=>e.from),to:s.map(e=>e.to)}}function Au(e){let t=Hu(e),n=[];for(let e of t[Uu(t)]??[]){if(e.kind!==`line`)return;n.push(e.to)}Wu(n)<0&&n.reverse();let r=n.reduce((e,t)=>Math.min(e,t.x),1/0),i=n.reduce((e,t)=>Math.max(e,t.x),-1/0);if(!(i-r>2*hu))return;let a=e=>e.x-r<=hu,o=e=>i-e.x<=hu,s=n.findIndex((e,t)=>a(e)&&!a(n[(t+1)%n.length])),c=[...n.slice(s),...n.slice(0,s+1)],l=c.findIndex(o),u=l;for(;o(c[u+1]);)u++;let d=c.findIndex((e,t)=>t>u&&a(e));if(c.slice(d).some(e=>!a(e)))return;let f=Eu(c.slice(0,l+1)),p=Eu(c.slice(u,d+1));return f&&p&&f.points.length>2&&p.points.length>2?{upper:f,lower:p,left:r,right:i}:void 0}function ju(e){let t=0;return n=>{for(;t<e.length&&e[t][1]<=n;)t++;return t<e.length&&e[t][0]<n}}function Mu(e,t,n,r,[i,a],o){let s=Vu(e.outline,o),c=Vu(t.outline,o),l=Math.min(s.length,c.length),u=s.slice(0,l).map((e,t)=>({from:e.points,to:c[t].points})),d=s.length>c.length,[f,p,m,h,g,_,v]=d?[s,c,t,n,r,i,a]:[c,s,e,r,n,a,i],y=h.length,b=h.map((e,t)=>[h[(t+_)%y],g[(t+v)%y]]),x=f.slice(0,l).map((e,t)=>e.points.map((e,n)=>[e,p[t].points[n]])),S=[g,...p.map(e=>e.points)];for(let n of f.slice(l)){let{end:r,point:i}=Nu(n,Lu(n,(d?e:t).bounds,m,S),b,x),a=Array(o).fill(i);u.push(d?{from:n.points,to:a,end:r}:{from:a,to:n.points,end:r,opens:!0})}return u}function Nu(e,t,n,r){let i=.5;for(;i>1/16&&!Pu(e,Iu(e.center,t,i),i,n,r);)i/=2;return{end:i,point:Iu(e.center,t,i)}}function Pu(e,t,n,r,i){for(let a=1;a<8;a++){let o=n*a/8,s=e=>Iu(e[0],e[1],o),c=[r.map(s),...i.map(e=>e.map(s))];if(e.points.some(e=>zu(Iu(e,t,a/8),c)===0))return!1}return!0}function Fu({from:e,to:t,end:n,opens:r},i){if(n===void 0)return Ku(e,t,0,0,i,!0);let a=r?(i-(1-n))/n:i/n;return(r?a<=0:a>=1)?``:Ku(e,t,0,0,a,!0)}let Iu=(e,t,n)=>({x:Ju(e.x,t.x,n),y:Ju(e.y,t.y,n)});function Lu(e,t,n,r){let i=Bu(e.center,t,n.bounds);if(Ru(i,r)>=e.size/4)return i;let{x:a,y:o,width:s,height:c}=n.bounds,l=n.center,u=Ru(l,r);for(let e=0;e<9;e++)for(let t=0;t<9;t++){let n={x:a+s*(e+.5)/9,y:o+c*(t+.5)/9},i=Ru(n,r);i>u&&([l,u]=[n,i])}return l}function Ru(e,t){if(zu(e,t)===0)return 0;let n=1/0;for(let r of t)r.forEach((t,i)=>{let a=r[(i+1)%r.length],o=a.x-t.x,s=a.y-t.y,c=o===0&&s===0?0:Math.max(0,Math.min(1,((e.x-t.x)*o+(e.y-t.y)*s)/(o*o+s*s)));n=Math.min(n,Math.hypot(e.x-t.x-c*o,e.y-t.y-c*s))});return n}function zu(e,t){let n=0;for(let r of t)r.forEach((t,i)=>{let a=r[(i+1)%r.length],o=(a.x-t.x)*(e.y-t.y)-(e.x-t.x)*(a.y-t.y);t.y<=e.y&&a.y>e.y&&o>0?n++:t.y>e.y&&a.y<=e.y&&o<0&&n--});return n}function Bu(e,t,n){let r=(e,t,n)=>n>0?(e-t)/n:.5;return{x:n.x+r(e.x,t.x,t.width)*n.width,y:n.y+r(e.y,t.y,t.height)*n.height}}function Vu(e,t){let n=Hu(e);if(n.length<2)return[];let r=Uu(n);return n.filter((e,t)=>t!==r).map(e=>{let n=G([e]).sample(4*t),r=n.filter((e,t)=>t%4==0),i=I(e.flatMap(F));return{points:[r[0],...r.slice(1).reverse()],area:Math.abs(Wu(n)),center:{x:i.x+i.width/2,y:i.y+i.height/2},size:Math.max(i.width,i.height)/2}}).sort((e,t)=>t.area-e.area)}let Hu=e=>K(Ae(e.d)).map(e=>e.segments).filter(e=>e.length>0);function Uu(e){let t=e.map(e=>e.reduce((e,t)=>e+t.length,0)),n=0;return t.forEach((e,r)=>{e>t[n]+Math.max(.01,t[n]/1e3)&&(n=r)}),n}function Wu(e){let t=0;return e.forEach((n,r)=>{let i=e[(r+1)%e.length];t+=n.x*i.y-i.x*n.y}),t/2}function Gu(e,t,n){let r=(e,t)=>({...e.outline.closed?{fill:`mark`}:{stroke:`mark`,width:e.thickness},...t===void 0?{}:{opacity:t}}),i,a;return o=>{o>=1?(i?.remove(),i=void 0,a?a.update(t.outline.d,{opacity:void 0}):a=n.path(t.outline.d,r(t))):a?(i?.update(e.outline.d,{opacity:1-o}),a.update(t.outline.d,{opacity:o})):e.outline.closed?(i=n.path(e.outline.d,r(e,1-o)),a=n.path(t.outline.d,r(t,o))):(a=n.path(t.outline.d,r(t,o)),i=n.path(e.outline.d,r(e,1-o)))}}function Ku(e,t,n,r,i,a){let o=e.length,s=``;for(let a=0;a<o;a++)s+=`${a===0?`M`:`L`}${qu(e[(a+n)%o],t[(a+r)%o],i)}`;return a?`${s}Z`:s}let qu=(e,t,n)=>`${L(Ju(e.x,t.x,n))},${L(Ju(e.y,t.y,n))}`,Ju=(e,t,n)=>e*(1-n)+t*n;function Yu(e,t,n){let r=n/4,i=io(e);return i===io(t)?[0,0]:i?[0,r]:[r,0]}function Xu(e){return typeof e==`number`&&e>0?Math.min(1,e):0}function Zu(e){let{points:t,align:n}=e??{};if(t!==void 0&&!(Number.isInteger(t)&&t>=4&&t%4==0))throw RangeError(`morph: points must be a whole multiple of 4, got ${String(t)}.`);if(n!==void 0&&!mu.includes(n))throw RangeError(`morph: align must be "unroll" or "drop", got ${typeof n==`string`?JSON.stringify(n):String(n)}.`)}function Qu(...e){let t=id(`sequence`,e);return rd(t,async(e,n)=>{for(let r of t){if(n.signal.aborted)return;await e(r)}})}function $u(...e){let t=id(`parallel`,e);return rd(t,async e=>{await Promise.all(t.map(e))})}function ed(e,t){if(typeof e!=`string`&&typeof e!=`function`)throw TypeError(`only needs a key, a series name or a predicate, got ${ut(e)}.`);let[n]=id(`only`,[t]),r=typeof e==`string`?t=>t.key===e||t.series===e:e;if(n.kind===`data`){let e=n;return{kind:`data`,...e.needs?{needs:e.needs}:{},run:(t,n,i)=>r(t)?e.run(t,n,i):Promise.resolve(),end:(t,n,i)=>{r(t)&&e.end(t,n,i)},clear:t=>e.clear(t)}}let i=n;return{kind:`geometry`,run:(e,t)=>r(e)?i.run(e,t):Promise.resolve(),end(e,t){r(e)&&i.end(e,t)},clear:e=>i.clear(e)}}function td(e,t={}){let[n]=id(`stagger`,[e]),r=t.delay??50;if(!(typeof r==`number`&&r>=0&&Number.isFinite(r)))throw RangeError(`stagger: delay must be 0 ms or more, got ${String(r)}.`);let i=async(e,t,n)=>{if(n.signal.aborted)return;let{index:i,count:a}=n.batch,o=a>1?Math.min(r,500/(a-1)):0,s=i>0?i*o:0;if(!(s>0))return{mark:e,data:t};let c=nd(e,t,n);return await n.tween({duration:s,timing:`stagger`,update:()=>{}}).finished,n.signal.aborted?void 0:c()};if(n.kind===`data`){let e=n;return{kind:`data`,...e.needs?{needs:e.needs}:{},run:async(t,n,r)=>{let a=await i(t,n,r);a&&await e.run(a.mark,a.data,r)},end:(t,n,r)=>e.end(t,n,r),clear:t=>e.clear(t)}}let a=n;return{kind:`geometry`,async run(e,t){let n=await i(e,void 0,t);n&&await a.run(n.mark,t)},end:(e,t)=>a.end(e,t),clear:e=>a.clear(e)}}function nd(e,t,n){let r={mark:e,data:t};return n.onChange((e,t)=>{r={mark:e,data:t??r.data}}),()=>r}function rd(e,t){let n=(e,t,n)=>{let r=nd(e,t,n);return e=>{let{mark:t,data:i}=r();return e.kind===`data`?e.run(t,i,n):e.run(t,n)}},r=(t,n,r)=>{for(let i of e)i.kind===`data`?i.end(t,n,r):i.end(t,r)},i=t=>{let n;for(let r of e)try{r.clear(t)}catch(e){n??(n={error:e})}if(n)throw n.error};if(e.some(e=>e.kind===`data`)){let a=[...new Set(e.flatMap(e=>e.kind===`data`?e.needs?.related??[]:[]))];return{kind:`data`,...a.length>0?{needs:{related:a}}:{},run:(e,r,i)=>t(n(e,r,i),i),end:(e,t,n)=>r(e,t,n),clear:i}}return{kind:`geometry`,run:(e,r)=>t(n(e,void 0,r),r),end:(e,t)=>r(e,void 0,t),clear:i}}function id(e,t){return t.forEach((t,n)=>{if(!lt(t))throw TypeError(`${e}: part ${n+1} needs to be a mark effect (kind "geometry" or "data"), got ${ut(t)}.`)}),[...t]}let ad=()=>{};function od(e){cd(`defineEffect`,e);let t={kind:`geometry`,run:e.run,end:e.end,clear:e.clear??ad};return Object.freeze(t)}function sd(e){cd(`defineDataEffect`,e);let t=ld(e.needs),n={kind:`data`,...t?{needs:t}:{},run:e.run,end:e.end,clear:e.clear??ad};return Object.freeze(n)}function cd(e,t){if(typeof t!=`object`||!t)throw TypeError(`${e} needs a spec object { run, end }, got ${t===null?`null`:typeof t}.`);let{run:n,end:r,clear:i}=t;if(typeof n!=`function`)throw TypeError(`${e}: run must be a function that animates the mark, got ${typeof n}.`);if(typeof r!=`function`)throw TypeError(`${e}: end must be a function that draws the final state, got ${typeof r}. Every effect needs one: reduced motion shows only end states.`);if(i!==void 0&&typeof i!=`function`)throw TypeError(`${e}: clear must be a function if it's given, got ${typeof i}.`)}function ld(e){if(e===void 0)return;let t=typeof e==`object`&&e?e.related:void 0;if(!(typeof e==`object`&&e&&(t===void 0||Array.isArray(t)&&t.every(e=>typeof e==`string`&&e!==``))))throw TypeError(`defineDataEffect: needs must be { related: [series names] }, got ${JSON.stringify(e)??String(e)}.`);return t===void 0?void 0:Object.freeze({related:Object.freeze([...t])})}let ud=[`roll`,`step`,`slide`],dd=[`butt`,`round`],fd=[`miter`,`round`],pd=[`nonzero`,`evenodd`],md=/^\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE.,+\-\s]*$/;function hd(e){let t=e?.name;if(typeof t!=`string`||t===``)throw TypeError(`defineIcon needs a non-empty string name, got ${JSON.stringify(t)}.`);let n=(e,n)=>{throw RangeError(`defineIcon: "${t}" ${e} ${n}.`)},r=(e,t)=>typeof t==`number`&&Number.isFinite(t)?t:n(e,`must be a finite number, got ${String(t)}`),i=(e,t)=>r(e,t)>0?t:n(e,`must be more than 0, got ${String(t)}`),a=(e,t)=>t&&typeof t==`object`?_d({x:r(`${e}.x`,t.x),y:r(`${e}.y`,t.y)}):n(e,`must be a point { x, y }`);Array.isArray(e.shapes)&&e.shapes.length!==0||n(`shapes`,`must be a non-empty array`);let o=e.shapes.map((e,t)=>gd(e,`shapes[${t}]`,n,r)),s=e.box;s&&typeof s==`object`||n(`box`,`must be a rectangle { x, y, width, height }`);let c=_d({x:r(`box.x`,s.x),y:r(`box.y`,s.y),width:i(`box.width`,s.width),height:i(`box.height`,s.height)}),l=a(`anchor`,e.anchor),u=e.pivot===void 0?l:a(`pivot`,e.pivot),d=e.footprint??[Math.max(0,l.x-c.x),Math.max(0,c.x+c.width-l.x)];Array.isArray(d)&&d.length===2||n(`footprint`,`must be [behind, ahead]`),d.forEach((e,t)=>{r(`footprint[${t}]`,e)<0&&n(`footprint[${t}]`,`can't be negative, got ${e}`)});let f=e.size===void 0?c.width:i(`size`,e.size),p=e.radius===void 0?c.height/2:i(`radius`,e.radius);return e.gait!==void 0&&!ud.includes(e.gait)&&n(`gait`,`must be roll, step or slide, got ${String(e.gait)}`),e.upright!==void 0&&typeof e.upright!=`boolean`&&n(`upright`,`must be true or false, got ${String(e.upright)}`),_d({name:t,shapes:_d(o),box:c,size:f,anchor:l,pivot:u,footprint:_d([d[0],d[1]]),...e.gait===void 0?{}:{gait:e.gait},radius:p,...e.upright===void 0?{}:{upright:e.upright}})}function gd(e,t,n,r){e&&typeof e==`object`||n(t,`must be a shape { d, fill?, stroke?, … }`),typeof e.d==`string`&&md.test(e.d)||n(`${t}.d`,`must be path data starting with a move`),e.clip===void 0||typeof e.clip==`string`&&md.test(e.clip)||n(`${t}.clip`,`must be path data starting with a move`);for(let r of[`fill`,`stroke`]){let i=e[r];i!==void 0&&(typeof i!=`string`||i===``)&&n(`${t}.${r}`,`must be a colour, got ${String(i)}`)}e.width!==void 0&&r(`${t}.width`,e.width)<0&&n(`${t}.width`,`can't be negative, got ${e.width}`),e.linecap!==void 0&&!dd.includes(e.linecap)&&n(`${t}.linecap`,`must be butt or round, got ${String(e.linecap)}`),e.linejoin!==void 0&&!fd.includes(e.linejoin)&&n(`${t}.linejoin`,`must be miter or round, got ${String(e.linejoin)}`),e.fillRule!==void 0&&!pd.includes(e.fillRule)&&n(`${t}.fillRule`,`must be nonzero or evenodd, got ${String(e.fillRule)}`);for(let i of[`opacity`,`fillOpacity`,`strokeOpacity`]){let a=e[i]===void 0?1:r(`${t}.${i}`,e[i]);(a<0||a>1)&&n(`${t}.${i}`,`must be from 0 to 1, got ${a}`)}let i={d:e.d};for(let t of[`fill`,`stroke`,`width`,`linecap`,`linejoin`,`clip`,`fillRule`,`opacity`,`fillOpacity`,`strokeOpacity`])e[t]!==void 0&&(i[t]=e[t]);return _d(i)}let _d=e=>Object.freeze(e),vd=new Set([`svg`,`g`,`a`]),yd=new Set([`path`,`circle`,`rect`,`ellipse`,`line`,`polyline`,`polygon`]),bd=/<![^<>]*>|<(\/?)([A-Za-z][\w:.-]*)((?:\s+[^\s=/<>]+(?:\s*=\s*(?:"[^"<]*"|'[^'<]*'|[^\s"'<>]+))?)*)\s*(\/?)>/g,xd=/([^\s=/<>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,Sd=/^(?:#[0-9a-fA-F]{3,8}|[a-zA-Z][a-zA-Z0-9-]*|(?:rgba?|hsla?)\([\d\s.,%+\-/]*\))$/;function Cd(e,t){if(typeof e!=`string`)throw TypeError(`iconFromSvg needs SVG markup as a string.`);let n=typeof t?.name==`string`?`"${t.name}"`:`an icon`,r=e=>{throw RangeError(`iconFromSvg: ${n} ${e}.`)},i,a=1,o=[],s=[],c;for(let n of wd(e).matchAll(bd)){let[,e,l,u=``,d]=n;if(l===void 0)continue;let f=l.toLowerCase();if(e){let e=Md(s,f);e>=0&&(s.length=e);continue}let p=Td(u),m=!i&&f===`svg`;m&&(i=Ed(p)??r(`needs a viewBox, or a width and height in px, on its <svg>`),t.size!==void 0&&(typeof t.size==`number`&&t.size>0&&Number.isFinite(t.size)||r(`size must be more than 0, got ${String(t.size)}`),a=t.size/i.width),c={fill:`#000000`,stroke:`none`,width:1,linecap:void 0,linejoin:void 0,fillRule:`nonzero`,opacity:1,fillOpacity:1,strokeOpacity:1,transform:J.scale(a)});let h=s.length>0?s[s.length-1].state:m?c:void 0,g=h&&!kd(p)?Ad(h,p):void 0;if(g&&yd.has(f)){let e=jd(f,p,g);e&&o.push(e)}d||s.push({tag:f,state:vd.has(f)?g:void 0})}i||r(`needs an <svg> element`),o.length===0&&r(`has nothing to draw: no path, circle, rect, ellipse, line, polyline or polygon with a fill or stroke`);let l={x:i.x*a,y:i.y*a,width:i.width*a,height:i.height*a},u=e=>e&&typeof e==`object`?{x:e.x*a,y:e.y*a}:e;return hd({...t,shapes:o,box:l,anchor:u(t.anchor),...t.pivot?{pivot:u(t.pivot)}:{},...Array.isArray(t.footprint)?{footprint:[t.footprint[0]*a,t.footprint[1]*a]}:{},...typeof t.radius==`number`?{radius:t.radius*a}:{}})}function wd(e){let t=[[`<!--`,`-->`],[`<![CDATA[`,`]]>`],[`<?`,`?>`]],n=t.map(([t])=>e.indexOf(t)),r=``,i=0;for(;;){let a=-1;if(n.forEach((e,t)=>{e>=0&&(a<0||e<n[a])&&(a=t)}),a<0)return r+e.slice(i);let o=n[a],s=t[a][1];r+=e.slice(i,o);let c=e.indexOf(s,o+t[a][0].length);if(c<0)return r;i=c+s.length,n.forEach((r,a)=>{r>=0&&r<i&&(n[a]=e.indexOf(t[a][0],i))})}}function Td(e){let t=new Map;for(let[,n,r,i,a]of e.matchAll(xd))n!==void 0&&t.set(n,r??i??a??``);for(let e of(t.get(`style`)??``).split(`;`)){let n=e.indexOf(`:`);n>0&&t.set(e.slice(0,n).trim(),e.slice(n+1).replace(/!important/i,``).trim())}return t}function Ed(e){let t=(e.get(`viewBox`)??``).trim().split(/[\s,]+/).map(Number);if(t.length===4&&t.every(Number.isFinite)&&t[2]>0&&t[3]>0)return{x:t[0],y:t[1],width:t[2],height:t[3]};let n=Dd(e.get(`width`)),r=Dd(e.get(`height`));return n!==void 0&&r!==void 0?{x:0,y:0,width:n,height:r}:void 0}function Dd(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)\s*(?:px\s*)?$/i.exec(e??``),n=t?Number(t[1]):NaN;return n>0&&Number.isFinite(n)?n:void 0}function Od(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(%?)\s*$/i.exec(e??``);return t?Math.min(1,Math.max(0,Number(t[1])/(t[2]?100:1))):void 0}function kd(e){return e.get(`display`)?.trim()===`none`||e.get(`visibility`)?.trim()===`hidden`}function Ad(e,t){let n=(e,n)=>{let r=t.get(e)?.trim();if(r===void 0||!Sd.test(r))return n;let i=r.toLowerCase();return i===`inherit`?n:i===`currentcolor`?`text`:i===`none`?i:r},r=Number.parseFloat(t.get(`stroke-width`)??``),i=t.get(`stroke-linecap`)?.trim(),a=t.get(`stroke-linejoin`)?.trim(),o=t.get(`fill-rule`)?.trim().toLowerCase(),s=t.get(`transform`);return{fill:n(`fill`,e.fill),stroke:n(`stroke`,e.stroke),width:r>=0?r:e.width,linecap:i===`butt`||i===`round`?i:e.linecap,linejoin:a===`miter`||a===`round`?a:e.linejoin,fillRule:o===`nonzero`||o===`evenodd`?o:e.fillRule,opacity:e.opacity*(Od(t.get(`opacity`))??1),fillOpacity:Od(t.get(`fill-opacity`))??e.fillOpacity,strokeOpacity:Od(t.get(`stroke-opacity`))??e.strokeOpacity,transform:s?J.multiply(e.transform,$e(s)):e.transform}}function jd(e,t,n){let r=Nd(n.fillOpacity),i=Nd(n.strokeOpacity),a=n.fill===`none`||!(r>0)?void 0:n.fill,o=n.stroke===`none`||!(n.width>0)||!(i>0)?void 0:n.stroke,s=Nd(n.opacity);if(a===void 0&&o===void 0||!(s>0))return;let c=Ne(e,e=>t.get(e));if(!c.some(e=>e.op!==`M`))return;let l=n.transform;return{d:Re(Ie(c,l)),...a===void 0?{}:{fill:a,...n.fillRule===`evenodd`?{fillRule:n.fillRule}:{},...r<1?{fillOpacity:r}:{}},...o===void 0?{}:{stroke:o,width:Nd(n.width*Math.sqrt(Math.abs(l[0]*l[3]-l[1]*l[2]))),...n.linecap?{linecap:n.linecap}:{},...n.linejoin?{linejoin:n.linejoin}:{},...i<1?{strokeOpacity:i}:{}},...s<1?{opacity:s}:{}}}function Md(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].tag===t)return n;return-1}let Nd=e=>Math.round(e*1e3)/1e3,Pd=Object.freeze({dot:hd({name:`dot`,shapes:[{d:`M4,0A4,4 0 0 1 -4,0A4,4 0 0 1 4,0Z`,fill:`surface`,stroke:`text`,width:1.5}],box:{x:-5,y:-5,width:10,height:10},anchor:{x:0,y:0}}),arrow:hd({name:`arrow`,shapes:[{d:`M-7,-1.5L1,-1.5L1,-5L7,0L1,5L1,1.5L-7,1.5Z`,fill:`text`,stroke:`surface`,width:1.5,linejoin:`round`}],box:{x:-8,y:-6,width:16,height:12},anchor:{x:0,y:0}}),chevron:hd({name:`chevron`,shapes:[{d:`M-2.5,-5L2.5,0L-2.5,5`,stroke:`surface`,width:4.5,linecap:`round`,linejoin:`round`},{d:`M-2.5,-5L2.5,0L-2.5,5`,stroke:`text`,width:2,linecap:`round`,linejoin:`round`}],box:{x:-5,y:-7.5,width:10,height:15},anchor:{x:0,y:0}})}),Fd=ot({kind:`preset`,entries:{flash:()=>xl(),wiggle:()=>Dl(),pulse:()=>jl()},hint:`Register custom presets with registerPreset(name, factory).`}),Id=ot({kind:`icon`,entries:Pd,hint:`Register icons with registerIcon(icon) or registerIcons(icons).`});function Ld(e,t){if(typeof t!=`function`)throw TypeError(`registerPreset("${e}") needs a function that returns an effect.`);Fd.register(e,t)}function Rd(e){if(typeof e!=`object`||!e||typeof e.name!=`string`)throw TypeError(`registerIcon needs an icon with a name.`);Id.register(e.name,e)}function zd(e){for(let t of e)Rd(t)}function Bd(e){if(typeof e!=`object`||!e)throw TypeError(`configure needs an options object.`);if(`nonce`in e){if(e.nonce!==void 0&&(typeof e.nonce!=`string`||e.nonce===``))throw TypeError(`configure: nonce must be a non-empty string.`);yn.nonce=e.nonce}if(`injectStyles`in e){if(e.injectStyles!==void 0&&typeof e.injectStyles!=`boolean`)throw TypeError(`configure: injectStyles must be true or false.`);yn.injectStyles=e.injectStyles}}let Vd={presets:Fd,icons:Id,motion:v};function Hd(e,t){return zr(e,t,Vd)}function Ud(e,t){return gi(e,t,Vd)}function Wd(e,t){return Ia(e,t,Vd)}function Gd(e,t){return hc(e,typeof t==`object`&&t&&t.transition===void 0?{...t,transition:gu()}:t,Vd)}function Kd(e,t){return ys(e,t,Vd)}function qd(e,t){return Ks(e,t,Vd)}function Jd(e,t=v,n){return Jc(e,t,n)}return e.VERSION=`0.11.0`,e.animated=C,e.barChart=Hd,e.chartSwitch=Gd,e.colorAssignment=xn,e.configure=Bd,e.createClock=n,e.createMotion=p,e.defaultClock=a,e.defaultScaling=u,e.defineDataEffect=sd,e.defineEffect=od,e.defineIcon=hd,e.delta=$l,e.describe=We,e.donutChart=Ud,e.drawIn=Il,e.easeInOutCubic=s,e.easeOutCubic=c,e.expressive=Kd,e.flash=xl,e.fromVegaView=qd,e.gaits=cl,e.hostView=Hs,e.iconFromSvg=Cd,e.icons=Pd,e.interpolateNumber=b,e.interpolatePoint=x,e.interpolateRecord=S,e.label=tu,e.lineChart=Wd,e.linear=o,e.link=Mn,e.manualClock=r,e.matrix=J,e.mediaReducedMotion=h,e.morph=gu,e.motion=v,e.motionSwitch=Jd,e.offset=et,e.only=ed,e.parallel=$u,e.playButton=el,e.playback=w,e.pulse=jl,e.registerIcon=Rd,e.registerIcons=zd,e.registerPreset=Ld,e.samplesAlong=nt,e.scaleDuration=m,e.sequence=Qu,e.stagger=td,e.threshold=ru,e.trace=Pl,e.travel=fl,e.tween=y,e.wiggle=Dl,e})({});
|
|
97
97
|
//# sourceMappingURL=expressive-charts.global.js.map
|