expressive-charts 0.1.0 → 0.2.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.
@@ -1,93 +1,93 @@
1
- "use strict";var ExpressiveCharts=(()=>{var yo=Object.defineProperty;var rc=Object.getOwnPropertyDescriptor;var oc=Object.getOwnPropertyNames;var ac=Object.prototype.hasOwnProperty;var ic=(e,t)=>{for(var n in t)yo(e,n,{get:t[n],enumerable:!0})},sc=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of oc(t))!ac.call(e,o)&&o!==n&&yo(e,o,{get:()=>t[o],enumerable:!(r=rc(t,o))||r.enumerable});return e};var cc=e=>sc(yo({},"__esModule",{value:!0}),e);var yf={};ic(yf,{VERSION:()=>af,animated:()=>Fe,barChart:()=>sf,chartSwitch:()=>df,colorAssignment:()=>Gr,configure:()=>ec,createClock:()=>xr,createMotion:()=>ho,defaultClock:()=>Ne,defaultScaling:()=>Xn,defineDataEffect:()=>Us,defineEffect:()=>Ks,defineIcon:()=>sn,describe:()=>qe,donutChart:()=>cf,easeInOutCubic:()=>it,easeOutCubic:()=>At,expressive:()=>uf,flash:()=>io,fromVegaView:()=>ff,gaits:()=>vr,iconFromSvg:()=>Ys,icons:()=>fo,interpolateNumber:()=>nt,interpolatePoint:()=>La,interpolateRecord:()=>ht,lineChart:()=>lf,linear:()=>at,manualClock:()=>Ra,matrix:()=>ve,mediaReducedMotion:()=>go,morph:()=>lo,motion:()=>pt,motionSwitch:()=>mf,offset:()=>rr,only:()=>Bs,parallel:()=>Fs,playButton:()=>ba,playback:()=>Pa,pulse:()=>co,registerIcon:()=>Ea,registerIcons:()=>Qs,registerPreset:()=>Xs,samplesAlong:()=>or,scaleDuration:()=>Qn,sequence:()=>Ns,stagger:()=>Hs,threshold:()=>Gs,travel:()=>Rs,tween:()=>Jt,wiggle:()=>so});function Se(e){let t=globalThis.reportError;typeof t=="function"?t(e):console.error(e)}function xr(e=lc()){let t=new Set,n,r=()=>{!n&&t.size>0&&(n=e.request(o))},o=a=>{n=void 0;for(let i of[...t])if(t.has(i))try{i(a)}catch(s){Se(s)}r()};return{now:()=>e.now(),onFrame(a){let i=s=>a(s);return t.add(i),r(),()=>{t.delete(i)&&t.size===0&&n&&(n(),n=void 0)}}}}function Ra(e=0){let t=e,n,r=xr({now:()=>t,request(o){return n=o,()=>{n===o&&(n=void 0)}}});return{now:r.now,onFrame:r.onFrame,get idle(){return n===void 0},advance(o){if(!(o>=0))throw new RangeError(`manualClock.advance needs a non-negative number of ms, got ${o}`);t+=o;let a=n;n=void 0,a?.(t)}}}function lc(){let e=()=>typeof performance<"u"?performance.now():Date.now();return{now:e,request(t){if(typeof requestAnimationFrame=="function"){let r=requestAnimationFrame(t);return()=>cancelAnimationFrame(r)}let n=setTimeout(()=>t(e()),16);return()=>clearTimeout(n)}}}var Ne=xr();var at=e=>e,it=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,At=e=>1-Math.pow(1-e,3);function Mr(e){return e<.5?Math.cbrt(e/4):1-Math.cbrt(2*(1-e))/2}var Xn={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}}},Ca=["presentation","analysis","off"],Sr=["feedback","transition","effect","playback","stagger"];function ho(e={}){let t=po(e.mode??"presentation"),n,r=dc(e.scaling),o=e.reducedMotion??go(),a=new Set,i,s=()=>n??(o.matches?"off":t),c=()=>{for(let d of[...a])if(a.has(d))try{d()}catch(l){Se(l)}};return{get mode(){return s()},get staged(){return s()==="presentation"},get requested(){return t},get viewerChoice(){return n},get prefersReduced(){return o.matches},duration(d,l="transition"){let u=s();return u==="off"?0:Qn(d,r[u][l])},setMode(d){po(d),d!==t&&(t=d,c())},chooseMode(d){po(d),d!==n&&(n=d,c())},clearChoice(){n!==void 0&&(n=void 0,c())},subscribe(d){let l=()=>d();return a.add(l),i??(i=o.subscribe(c)),()=>{!a.delete(l)||a.size>0||(i?.(),i=void 0)}}}}function Qn(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 go(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(r){let o=n();if(!o)return()=>{};let a=()=>r();return typeof o.addEventListener=="function"?(o.addEventListener("change",a),()=>o.removeEventListener("change",a)):(o.addListener(a),()=>o.removeListener(a))}}}function po(e){if(!Ca.includes(e))throw new TypeError(`Unknown motion mode "${String(e)}". Use one of: ${Ca.join(", ")}.`);return e}function dc(e={}){let t=n=>{let r={...Xn[n]};for(let o of Sr){let a=e[n]?.[o];a&&(r[o]=a)}return r};return{presentation:t("presentation"),analysis:t("analysis")}}var pt=ho();function Jt(e,t={}){let n=t.clock??Ne,r=t.motion??pt,o=e.timing??"transition",a=e.ease??it,i=r.duration(e.duration,o),s=e.delay?r.duration(e.delay,o):0,{update:c,signal:d}=e,l=n.now(),u="running",m,p,k=new Promise(E=>{p=E}),h=E=>{u=E,m?.(),m=void 0,d?.removeEventListener("abort",T),p(E)};function T(){u==="running"&&h("cancelled")}let V=!1;function G(){u!=="running"||V||(V=!0,H(1),u==="running"&&h("done"))}function H(E){try{c(a(E))}catch(P){throw T(),P}}let b=E=>{if(r.mode==="off"){G();return}let P=E-l-s;P>=i?G():P>0&&H(P/i)},M={finished:k,get state(){return u},cancel:T,finish:G};return d?.aborted?(h("cancelled"),M):(d?.addEventListener("abort",T,{once:!0}),i<=0&&s<=0?(G(),M):(H(0),u==="running"&&(m=n.onFrame(b)),M))}var nt=(e,t)=>n=>e*(1-n)+t*n,La=(e,t)=>n=>({x:e.x*(1-n)+t.x*n,y:e.y*(1-n)+t.y*n});function ht(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])];return r=>{if(r===1)return{...t};let o={};for(let a of n)o[a]=(e[a]??0)*(1-r)+(t[a]??0)*r;return o}}function Fe(e,t,n={}){let{onChange:r,...o}=n,a=e,i=e,s,c=!1,d=u=>{a=u,r?.(u)},l=()=>{let u=s;s=void 0,c=!1,u?.cancel()};return{get value(){return a},get target(){return s?.state==="cancelled"?a:i},get animating(){return s?.state==="running"},to(u,m){let p=s?.state==="running"&&c&&!(m.delay&&m.delay>0);l(),i=u;let k=t(a,u),h=!1,T=Jt({duration:m.duration,timing:m.timing,ease:m.ease??(p?At:it),delay:m.delay,signal:m.signal,update:V=>{h&&(c=!0),h=!0,d(k(V))}},o);return s=T,T.finished},set(u){l(),i=u,d(u)},stop(){l(),i=a}}}var uc=350;function Pa(e){fc(e);let{from:t,to:n,duration:r,onFrame:o}=e,a=e.ease??at,i=e.timing??"playback",s=e.clock??Ne,c=e.motion??pt,d=Math.min(t,n),l=Math.max(t,n),u=n,m=!1,p=!1,k,h=0,T=new Set,V=L=>{for(let D of[...T])if(T.has(D))try{D(L)}catch(K){Se(K)}},G=()=>{let L=k;return k=void 0,L?.stop(),L?.moved??!1},H=()=>{m&&(m=!1,V("pause"))},b=L=>{throw h++,G(),H(),L},M=L=>{if(L!==u){u=L;try{o(L)}catch(D){b(D)}}},E=(L,D,K,x)=>{let C=h;if(!(D>0)){M(L),h===C&&x();return}let B=u,_=s.now(),re={moved:!1,stop:s.onFrame(ae=>{let X=c.mode==="off"?1:(ae-_)/D;if(X<1){re.moved=!0;let J;try{J=K(X)}catch(ce){return b(ce)}M(B+(L-B)*J);return}G(),M(L),h===C&&x()})};k=re},P=()=>{m=!1,V("end")};return{get position(){return u},get playing(){return m},play(){if(p||m)return;let L=++h;if(G(),m=!0,V("play"),h!==L)return;let D=c.duration(r,i);D>0&&u===n&&(M(t),h!==L)||E(n,D*Math.abs(n-u)/Math.abs(n-t),a,P)},pause(){p||!m||(h++,G(),H())},seek(L,D={}){if(mc(L,D),p)return;let K=++h,x=G();if(H(),h!==K||(V("seek"),h!==K))return;let C=D.animate===!1?0:c.duration(uc,"transition");E(Math.min(Math.max(L,d),l),C,x?At:it,()=>{})},subscribe(L){if(typeof L!="function")throw new TypeError(`playback.subscribe needs a function, got ${typeof L}.`);if(p)return()=>{};let D=K=>L(K);return T.add(D),()=>{T.delete(D)}},destroy(){p||(p=!0,h++,G(),H(),T.clear())}}}function fc(e){if(typeof e!="object"||e===null)throw new TypeError("playback needs options: { from, to, duration, onFrame }.");let{from:t,to:n,duration:r,ease:o,timing:a,onFrame:i,clock:s,motion:c}=e;for(let[d,l]of[["from",t],["to",n]])if(!bo(l))throw new RangeError(`playback: ${d} must be a finite number, got ${String(l)}.`);if(t===n)throw new RangeError(`playback: from and to must differ, got ${t} for both.`);if(!bo(r)||r<0)throw new RangeError(`playback: duration must be a non-negative number of ms, got ${String(r)}.`);if(typeof i!="function")throw new TypeError(`playback: onFrame must be a function, got ${typeof i}.`);if(o!==void 0&&typeof o!="function")throw new TypeError(`playback: ease must be a function, got ${typeof o}.`);if(a!==void 0&&!Sr.includes(a))throw new RangeError(`playback: timing must be one of ${Sr.join(", ")}, got ${JSON.stringify(a)??String(a)}.`);if(s!==void 0&&(typeof s?.now!="function"||typeof s.onFrame!="function"))throw new TypeError("playback: clock must be a Clock, such as one from createClock() or manualClock().");if(c!==void 0&&typeof c?.duration!="function")throw new TypeError("playback: motion must be a Motion, such as the page-wide `motion` or one from createMotion().")}function mc(e,t){if(!bo(e))throw new RangeError(`playback.seek needs a finite number, got ${String(e)}.`);if(typeof t!="object"||t===null)throw new TypeError("playback.seek's options must be an object, such as { animate: false }.");if(t.animate!==void 0&&typeof t.animate!="boolean")throw new TypeError(`playback.seek: animate must be true or false, got ${String(t.animate)}.`)}function bo(e){return typeof e=="number"&&Number.isFinite(e)}var $t=2*Math.PI;function Ye(e,t,n=0){let r=t.x-e.x,o=t.y-e.y,a=Math.hypot(r,o);return{kind:"line",from:e,to:t,length:a,angle:a>0?Math.atan2(o,r):er(n)}}function gt(e,t,n,r){return{kind:"arc",center:e,radius:t,start:n,sweep:r,length:t*Math.abs(r)}}function Gt(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 It(e.center,e.radius,e.start+e.sweep*t)}function wo(e,t){if(e.kind==="line")return e.angle;let n=e.sweep<0?-Math.PI/2:Math.PI/2;return er(e.start+e.sweep*t+n)}function It(e,t,n){return{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}}function er(e){return e-$t*Math.ceil((e-Math.PI)/$t)}function vo(e){if(e.kind==="line")return[e.from,e.to];let t=[Gt(e,0),Gt(e,1)];for(let n=0;n<4;n++){let r=n*Math.PI/2;yc(e,r)&&t.push(It(e.center,e.radius,r))}return t}function dn(e){let t=1/0,n=1/0,r=-1/0,o=-1/0;for(let{x:a,y:i}of e)a<t&&(t=a),a>r&&(r=a),i<n&&(n=i),i>o&&(o=i);return{x:t,y:n,width:r-t,height:o-n}}function yc(e,t){let n=Math.abs(e.sweep);return n>=$t?!0:((e.sweep>=0?t-e.start:e.start-t)%$t+$t)%$t<=n}function _e(e){let t=Math.round(e*1e3)/1e3;return t===0?"0":String(t)}function Er(e){return`M${_e(e.x)},${_e(e.y)}`}function Dr(e,t=0,n=1){if(e.kind==="line"){let d=n===1?e.to:Gt(e,n);return`L${_e(d.x)},${_e(d.y)}`}let r=e.start+e.sweep*t,o=e.sweep*(n-t),a=Math.max(1,Math.ceil(Math.abs(o)/Math.PI-1e-9)),i=_e(e.radius),s=o>=0?1:0,c="";for(let d=1;d<=a;d++){let l=It(e.center,e.radius,r+o*d/a);c+=`A${i},${i} 0 0 ${s} ${_e(l.x)},${_e(l.y)}`}return c}function tr(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 o=Er(Gt(n,0));for(let a=0;a<r;a++){let i=e[a];i.length>0&&(o+=Dr(i))}return t?`${o}Z`:o}var Tr=e=>e>0?e<1?e:1:0;function Vt(e){let t=e[0],n=e[e.length-1];if(!t||!n)throw new RangeError("A walk needs at least one segment.");let r=[0];for(let d of e)r.push(r[r.length-1]+d.length);let o=r[e.length],a=Gt(t,0),i=Gt(n,1),s=d=>{if(!(o>0))return{index:0,u:0};if(d>=o){let m=e.length-1;for(;m>0&&!(e[m].length>0);)m--;return{index:m,u:1}}let l=0,u=e.length-1;for(;l<u;){let m=l+u>>1;r[m+1]>d?u=m:l=m+1}return{index:l,u:Math.min(1,(d-r[l])/e[l].length)}},c=d=>{let l=Tr(d);if(l===0)return a;if(l===1)return i;let{index:u,u:m}=s(l*o);return Gt(e[u],m)};return{segments:e,length:o,start:a,end:i,point:c,angle(d){let{index:l,u}=s(Tr(d)*o);return wo(e[l],u)},slice(d,l){let u=Tr(Math.min(d,l)),m=Tr(Math.max(d,l)),p=Er(c(u)),k=u*o,h=m*o;if(!(h>k))return p;let T=s(k);for(let V=T.index;V<e.length&&r[V]<h;V++){let G=e[V];if(!(G.length>0))continue;let H=V===T.index?T.u:0,b=r[V+1]>h?Math.min(1,(h-r[V])/G.length):1;b>H&&(p+=Dr(G,H,b))}return p},d:tr(e)}}function wn(e){let t=e.map(Vt);return{d:tr(e.flat(),!0),closed:!0,sample(n){Aa(n,4);let r=n/4,o=[];for(let a of t)for(let i=0;i<r;i++)o.push(a.point(i/r));return o}}}function Oa(e){return{d:e.d,closed:!1,sample(t){if(Aa(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 Aa(e,t){if(!Number.isInteger(e)||e<0||e%t!==0){let n=t===1?"a whole number \u2265 0":`a whole multiple of ${t}`;throw new RangeError(`outline.sample(n): n must be ${n}, got ${e}.`)}}function Yt({key:e,series:t,walk:n,thickness:r,outline:o,bounds:a,center:i,pivot:s,segments:c}){return{key:e,...t===void 0?{}:{series:t},start:n.start,end:n.end,length:n.length,path:d=>n.point(d),angle:d=>n.angle(d),slice:(d,l)=>n.slice(d,l),thickness:r,outline:o,bounds:a,center:i,pivot:s,...c===void 0?{}:{segments:c}}}function st(e,t,n){if(!Number.isFinite(n))throw new RangeError(`describe.${e}: ${t} must be a finite number, got ${n}.`);return n}function bt(e,t,n){if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`describe.${e}: ${t} must be a finite number \u2265 0, got ${n}.`);return n}function $a(e){let{key:t,series:n}=e,r={x:st("arc","cx",e.cx),y:st("arc","cy",e.cy)},o=Math.min(bt("arc","inner",e.inner),bt("arc","outer",e.outer)),a=Math.max(e.inner,e.outer);st("arc","start",e.start),st("arc","end",e.end);let i=Math.max(-$t,Math.min($t,e.end-e.start)),s=e.start-Math.PI/2,c=s+i,[d,l]=i>=0?[a,o]:[o,a],u=[[gt(r,d,s,i)],[Ye(It(r,d,c),It(r,l,c),c+(d>l?Math.PI:0))],[gt(r,l,c,-i)],[Ye(It(r,l,s),It(r,d,s),s+(d>l?0:Math.PI))]],m=Vt([gt(r,(o+a)/2,s,i)]);return Yt({key:t,series:n,walk:m,thickness:a-o,outline:wn(u),bounds:dn(u.flat().flatMap(vo)),center:m.point(.5),pivot:r})}var Ga={left:0,right:Math.PI,top:Math.PI/2,bottom:-Math.PI/2};function Ia(e){let{key:t,series:n,baseline:r,x:o,y:a,width:i,height:s}=e;if(!Object.prototype.hasOwnProperty.call(Ga,r))throw new RangeError(`describe.bar: baseline must be left, right, top or bottom, got ${String(r)}.`);st("bar","x",o),st("bar","y",a),bt("bar","width",i),bt("bar","height",s);let c=bt("bar","radius",e.radius??0),d=bt("bar","gap",e.gap??0),l=r==="left"||r==="right",u=l?i:s,m=l?s:i,p=m,k=Ga[r],h=pc(e),T=(E,P,L,D)=>{let K=Math.max(0,Math.min(L,P-E,p/2)),x=wn([[Ye(h(E,0),h(P-K,0),k)],K>0?[gt(h(P-K,K),K,k-Math.PI/2,Math.PI/2),Ye(h(P,K),h(P,p-K),k+Math.PI/2),gt(h(P-K,p-K),K,k,Math.PI/2)]:[Ye(h(P,0),h(P,p),k+Math.PI/2)],[Ye(h(P-K,p),h(E,p),k+Math.PI)],[Ye(h(E,p),h(E,0),k-Math.PI/2)]]),C=Vt([Ye(h(E,p/2),h(P,p/2),k)]);return Yt({...D,walk:C,thickness:m,outline:x,bounds:D.bounds??dn([h(E,0),h(P,p)]),center:h((E+P)/2,p/2),pivot:C.start})},V=e.segments??[{series:n,size:u}],G=new Set,H=0,M=V.map((E,P)=>{if(bt("bar",`segments[${P}].size`,E.size),E.series!==void 0){if(G.has(E.series))throw new Error(`describe.bar: series "${E.series}" appears twice in the segments of "${t}".`);G.add(E.series)}let L=Math.min(H,u);H+=E.size;let D=Math.min(H,u);return{segment:E,index:P,p0:Math.min(L+Math.min(d,L),D),p1:D}}).map(({segment:E,index:P,p0:L,p1:D})=>T(L,D,c-(u-D),{key:E.series===void 0?`${t}/${P}`:`${t}/${E.series}`,series:E.series}));return T(0,u,c,{key:t,series:n,bounds:{x:o,y:a,width:i,height:s},segments:M})}function pc({x:e,y:t,width:n,height:r,baseline:o}){switch(o){case"left":return(a,i)=>({x:e+a,y:t+i});case"right":return(a,i)=>({x:e+n-a,y:t+r-i});case"top":return(a,i)=>({x:e+n-i,y:t+a});case"bottom":return(a,i)=>({x:e+i,y:t+r-a})}}function Va(e){let{key:t,series:n,points:r}=e,o=bt("line","width",e.width??1),a=r[0];if(!a)throw new RangeError(`describe.line: "${t}" needs at least one point.`);r.forEach((l,u)=>{st("line",`points[${u}].x`,l.x),st("line",`points[${u}].y`,l.y)});let i=[];for(let l=1;l<r.length;l++)i.push(Ye(r[l-1],r[l],i[i.length-1]?.angle??0));i.length===0&&i.push(Ye(a,a));let s=Vt(i),c=dn(r),d=o/2;return Yt({key:t,series:n,walk:s,thickness:o,outline:Oa(s),bounds:{x:c.x-d,y:c.y-d,width:c.width+o,height:c.height+o},center:s.point(.5),pivot:a})}function Na(e){let{key:t,series:n}=e,r={x:st("point","x",e.x),y:st("point","y",e.y)},o=bt("point","r",e.r),a=Math.PI/2;return Yt({key:t,series:n,walk:Vt([Ye(r,r)]),thickness:2*o,outline:wn([[gt(r,o,-3*a/2,a)],[gt(r,o,-a/2,a)],[gt(r,o,a/2,a)],[gt(r,o,3*a/2,a)]]),bounds:{x:r.x-o,y:r.y-o,width:2*o,height:2*o},center:r,pivot:r})}var qe={bar:Ia,arc:$a,line:Va,point:Na};function Fa(e,t){return[1,0,0,1,e,t]}function Ba(e,t){let n=Math.cos(e),r=Math.sin(e);return za([n,r,-r,n,0,0],t)}function Ha(e,t=e,n){return za([e,0,0,t,0,0],n)}function ja(...e){let t=[1,0,0,1,0,0];for(let n of e)t=gc(t,n);return t}function hc(e,t){let[n,r,o,a,i,s]=e;return{x:n*t.x+o*t.y+i,y:r*t.x+a*t.y+s}}function gc(e,t){let[n,r,o,a,i,s]=e,[c,d,l,u,m,p]=t;return[n*c+o*d,r*c+a*d,n*l+o*u,r*l+a*u,n*m+o*p+i,r*m+a*p+s]}function za(e,t){if(!t)return e;let[n,r,o,a]=e;return[n,r,o,a,t.x-n*t.x-o*t.y,t.y-r*t.x-a*t.y]}var ve={translate:Fa,rotate:Ba,scale:Ha,multiply:ja,apply:hc};function vn(e){let[t,n,r,o,a,i]=e,s=t*o-n*r;if(!Number.isFinite(s)||Math.abs(s)<1e-12)throw new RangeError("This transform can't be inverted: it has no area.");return[o/s,-n/s,-r/s,t/s,(r*i-o*a)/s,(n*a-t*i)/s]}function nr(e){let t=[];for(let[,n,r=""]of e.matchAll(/(matrix|translate|scale|rotate|skewX|skewY)\s*\(([^)]*)\)/g)){let o=r.trim().split(/[\s,]+/).filter(Boolean).map(Number);if(!o.every(Number.isFinite))continue;let[a=0,i,s,c=0,d=0,l=0]=o,u=m=>m*Math.PI/180;switch(n){case"matrix":o.length===6&&t.push([a,i,s,c,d,l]);break;case"translate":t.push(Fa(a,i??0));break;case"scale":t.push(Ha(a,i??a));break;case"rotate":t.push(Ba(u(a),i!==void 0&&s!==void 0?{x:i,y:s}:void 0));break;case"skewX":t.push([1,0,Math.tan(u(a)),1,0,0]);break;case"skewY":t.push([1,Math.tan(u(a)),0,1,0,0]);break}}return ja(...t)}function rr(e,t,n){return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}var Rr=(Math.sqrt(5)-1)/2;function or(e,t){if(typeof e!="object"||e===null||typeof e.path!="function"||!Number.isFinite(e.length))throw new TypeError("samplesAlong needs a MarkGeometry, as describe builds it.");if(!Array.isArray(t))throw new TypeError("samplesAlong needs an array of points { x, y, value, at? }.");t.forEach((o,a)=>{for(let i of["x","y","value"]){let s=o?.[i];if(typeof s!="number"||!Number.isFinite(s))throw new RangeError(`samplesAlong: points[${a}].${i} must be a finite number, got ${String(s)}.`)}});let n=e.length>0?Math.min(4096,Math.ceil(e.length)+1):1,r=Array.from({length:n},(o,a)=>e.path(n===1?0:a/(n-1)));return t.map((o,a)=>({index:a,sample:{t:bc(e,r,o),value:o.value,...o.at===void 0?{}:{at:o.at}}})).sort((o,a)=>o.sample.t-a.sample.t||o.index-a.index).map(({sample:o})=>o)}function bc(e,t,n){let r=t.length;if(r===1)return 0;let o=0,a=1/0;t.forEach((h,T)=>{let V=_a(h,n);V<a&&(o=T,a=V)});let i=h=>_a(e.path(h),n),s=Math.max(0,o-1)/(r-1),c=Math.min(r-1,o+1)/(r-1),d=c-Rr*(c-s),l=s+Rr*(c-s),u=i(d),m=i(l);for(let h=0;h<48;h++)u<=m?(c=l,l=d,m=u,d=c-Rr*(c-s),u=i(d)):(s=d,d=l,u=m,l=s+Rr*(c-s),m=i(l));let p=(s+c)/2,k=i(p)<a?p:o/(r-1);return k>0?k<1?k:1:0}function _a(e,t){return(e.x-t.x)**2+(e.y-t.y)**2}function ko(e){let{kind:t,hint:n}=e,r=new Map,o={get:a=>r.get(a),resolve(a){let i=r.get(a);if(i!==void 0)return i;let s=r.size>0?[...r.keys()].join(", "):"none";throw new RangeError(`Unknown ${t} "${String(a)}". Registered ${t}s: ${s}.${n?` ${n}`:""}`)},register(a,i){if(typeof a!="string"||a==="")throw new TypeError(`A ${t} needs a non-empty string name, got ${JSON.stringify(a)}.`);if(i===void 0)throw new TypeError(`Registering ${t} "${a}" needs a value.`);r.set(a,i)},names:()=>[...r.keys()]};for(let[a,i]of Object.entries(e.entries??{}))o.register(a,i);return o}var Nt=["hover","enter","update","exit","decorate"];function Ft(e,t){let n={};for(let r of Object.keys(e??{}))if(!Nt.includes(r))throw new TypeError(`on.${r} isn't an effect slot. Use one of: ${Nt.join(", ")}.`);for(let r of Nt){let o=e?.[r];if(o!==void 0)if(typeof o=="string"){let a=t.resolve(o)();if(!Cr(a))throw new TypeError(`Preset "${o}" for on.${r} didn't return a mark effect; it returned ${ar(a)}.`);n[r]=a}else{if(!Cr(o))throw new TypeError(`on.${r} needs a mark effect (kind "geometry" or "data") or a preset name, got ${ar(o)}.`);n[r]=o}}return n}function Cr(e){if(typeof e!="object"||e===null)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 ar(e){if(typeof e!="object"||e===null)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 Wt(e,t){let n={...e};for(let[r,o]of Object.entries(t??{}))o===void 0?delete n[r]:n[r]=o;return n}function Mo(e){let{clock:t,motion:n,layer:r,mark:o}=e,a=new AbortController,i=[];return{context:{signal:a.signal,motion:n,mark:o,layer:r,icons:e.icons,batch:e.batch,...e.previous?{previous:e.previous}:{},tween(c){let d=c.signal,l=Jt({...c,signal:d??a.signal},{clock:t,motion:n});return d&&d!==a.signal&&(a.signal.aborted?l.cancel():a.signal.addEventListener("abort",()=>l.cancel(),{once:!0})),l},onChange(c){i.push(c)}},abort(){a.abort()},change(c,d){for(let l of[...i])l(c,d)},clear(){a.abort(),r.clear(),o.reset(),i=[]}}}var wc=["decorate","enter","update","exit","hover"],vc={get:()=>{}},xo={place(){},update(){},remove(){}};function Xt(e){let{surface:t}=e,n=e.effects,r=e.motion??pt,o=e.clock??Ne,a=e.icons??vc,i=new Map,s=new Set,c=!1,d=!1,l=0,u=r.subscribe(()=>{r.mode==="off"&&L()});function m(x){let C=x.mark.key,B=i.get(C);if(B)return B.mark=x.mark,B.data=x.data,B;let _={key:C,mark:x.mark,data:x.data,runs:new Map,applied:{},handle:void 0,exiting:void 0};return i.set(C,_),_}function p(x,C,B,_,re={}){let{previous:ae,done:X}=re,J=n[C];if(!J){X?.();return}let ce=x.runs.get(C);ce&&V(ce);let le={entry:x,slot:C,order:re.order??++l,effect:J,data:B,batch:_,previous:ae,style:{},state:"running",done:X,scope:Mo({clock:o,motion:r,icons:a,batch:_,previous:ae,layer:G(x.key,C,()=>le.order,()=>le.state!=="cleared"),mark:H(()=>le)})};x.runs.set(C,le);let ge=re.mark??x.mark,O=le.scope.context;try{if(re.end||r.mode==="off")J.kind==="data"?J.end(ge,B,O):J.end(ge,O),k(le);else{let F=J.kind==="data"?J.run(ge,B,O):J.run(ge,O);Promise.resolve(F).then(()=>k(le),Q=>h(le,Q))}}catch(F){h(le,F)}}function k(x){x.state==="running"&&(x.state="ended",T(x))}function h(x,C){let{signal:B}=x.scope.context;B.aborted&&(C===B.reason||C?.name==="AbortError")||(Se(C),V(x))}function T(x){let C=x.done;x.done=void 0,C?.()}function V(x){if(x.state==="cleared")return;x.state="cleared";let{entry:C}=x;C.runs.get(x.slot)===x&&C.runs.delete(x.slot),x.scope.abort();try{x.effect.clear(x.scope.context)}catch(B){Se(B)}x.scope.clear(),T(x)}function G(x,C,B,_){let re,ae=()=>_()?re??(re=t.group(x,C,B())):void 0;return{icon:(X,J)=>ae()?.icon(X,J)??xo,path:(X,J)=>ae()?.path(X,J)??xo,text:(X,J)=>ae()?.text(X,J)??xo,clear(){let X=re;re=void 0,X?.clear()}}}function H(x){return{set(C){let B=x();B.state!=="cleared"&&(B.style=Wt(B.style,C),b(B.entry))},reset(){let C=x();Object.keys(C.style).length!==0&&(C.style={},b(C.entry))}}}function b(x){let C=[...x.runs.values()].sort((X,J)=>X.order-J.order),B=Object.assign({},...C.map(X=>X.style)),_=x.applied;if(x.applied=B,Object.keys(B).length===0){Object.keys(_).length>0&&M(x).reset();return}let re={},ae=!1;for(let X of new Set([...Object.keys(_),...Object.keys(B)]))_[X]!==B[X]&&(re[X]=B[X],ae=!0);ae&&M(x).set(re)}function M(x){return x.handle??(x.handle=t.mark(x.key))}function E(x){i.get(x.key)===x&&i.delete(x.key),s.delete(x.key);let C=x.exiting;x.exiting=void 0;for(let B of[...x.runs.values()])V(B);x.handle=void 0,C?.()}function P(x){let C=x.exiting;if(!C)return;x.exiting=void 0;let B=x.runs.get("exit");B&&V(B),C()}function L(){for(let x of[...i.values()])for(let C of[...x.runs.values()]){if(C.state!=="running"||x.runs.get(C.slot)!==C)continue;let B=C.done;C.done=void 0,p(x,C.slot,K(x,C),C.batch,{previous:C.previous,done:B,order:C.order})}}function D(x){let C=new Map;for(let B of[...i.values()]){let _=B.runs.get(x);_&&(C.set(B,_.order),V(_))}return C}function K(x,C){let B=C.data.previous;return B&&!x.data.previous?Ka(x.data,B):x.data}return{enter(x){d||x.forEach((C,B)=>{let _=m(C);P(_);let re={index:B,count:x.length};p(_,"decorate",C.data,re),p(_,"enter",C.data,re)})},update(x){d||x.forEach((C,B)=>{let _=i.get(C.mark.key),re=C.from??_?.mark,ae=_&&!C.data.previous?Ka(C.data,_.data):C.data;p(m(C),"update",ae,{index:B,count:x.length},{previous:re})})},exit(x){if(d)return Promise.resolve();let C=x.map((B,_)=>{let re=m(B);P(re),s.delete(re.key);for(let ae of[...re.runs.values()])V(ae);return new Promise(ae=>{if(re.exiting=ae,!n.exit){E(re);return}p(re,"exit",B.data,{index:_,count:x.length},{done:()=>{re.exiting&&i.get(re.key)===re&&E(re)}})})});return Promise.all(C).then(()=>{})},hover(x){d||x.forEach((C,B)=>{let _=m(C);_.exiting||(s.add(_.key),c||p(_,"hover",C.data,{index:B,count:x.length}))})},leave(x=[...s]){for(let C of x){s.delete(C);let B=i.get(C)?.runs.get("hover");B&&V(B)}},change(x,C){let B=i.get(x.key);if(B){B.mark=x,C&&(B.data=C);for(let _ of[...B.runs.values()])if(_.state!=="cleared")try{_.scope.change(x,K(B,_))}catch(re){Se(re),V(_)}}},interrupt(){if(!d){c=!0;for(let x of[...i.values()]){let C=x.runs.get("hover");C&&V(C)}}},settle(){if(!c)return;c=!1;let x=[...s];x.forEach((C,B)=>{let _=i.get(C);_&&p(_,"hover",_.data,{index:B,count:x.length})})},swap(x,C){if(d)return;let B=wc.filter(_=>x[_]!==n[_]);n=x;for(let _ of B)if(_==="decorate"){let re=D(_);C.forEach((ae,X)=>{let J=i.get(ae.mark.key)??m(ae);J.exiting||p(J,_,ae.data,{index:X,count:C.length},{mark:ae.mark,order:re.get(J)})})}else if(_==="hover"){if(D(_),c)continue;let re=[...s];re.forEach((ae,X)=>{let J=i.get(ae);J&&p(J,_,J.data,{index:X,count:re.length})})}else for(let re of[...i.values()]){let ae=re.runs.get(_);if(!ae)continue;let X=ae.done;ae.done=void 0;let J=K(re,ae);V(ae),p(re,_,J,ae.batch,{previous:ae.previous,done:X,order:ae.order,end:!0})}},destroy(){if(!d){d=!0,c=!1,u();for(let x of[...i.values()])E(x);s.clear()}}}}function Ka(e,t){return{datum:e.datum,samples:e.samples,related:n=>e.related(n),previous:t}}var kc={value:"Sorted highest first",key:"Sorted A to Z",none:"In data order",custom:"Sorted"},So=3;function kn(e){let t=[],{series:n}=e;e.label!==void 0?t.push(e.label):n&&!(n.length===1&&n[0]==="value")&&t.push(`Showing ${Lr(n)}`),e.sort&&t.push(kc[e.sort]);let{changed:r,added:o,removed:a}=e;return!n&&r.length>0&&t.push(r.length<=So?`${Lr(r)} changed`:`${r.length} of ${e.count} changed`),o.length>0&&t.push(`Added ${o.length<=So?Lr(o):o.length}`),a.length>0&&t.push(`Removed ${a.length<=So?Lr(a):a.length}`),t.join(". ")}function Lr(e){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Tt(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(r){r!==""&&(n=!n,t.textContent=n?r:`${r}\xA0`)},destroy(){t.remove()}}}var Eo=34,Za=20,xc=4,Mc=2,Sc=72,Ec=300,qa=12.5,Ar=12.5,To=11,Do=26,Pr=4,Qt=6,Ja=.36;function Sn(e){let{x:t,y:n,stack:r,data:o}=e,a=e.orientation;if(a!==void 0&&a!=="horizontal"&&a!=="vertical")throw new TypeError(`barChart: orientation must be "horizontal" or "vertical", got ${String(a)}.`);if(r!==void 0){if(!Array.isArray(r)||r.length===0)throw new TypeError("barChart: stack needs at least one numeric field.");let u=new Set;for(let m of r){if(u.has(m))throw new TypeError(`barChart: "${m}" appears twice in stack.`);u.add(m)}}if(a===void 0)if(t!==void 0&&n!==void 0){let u=Wa(o,xn(t)),m=Wa(o,xn(n));if(u!==m)a=u?"horizontal":"vertical";else if(o.length===0)a="horizontal";else throw new RangeError(`barChart: ${u?"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?"horizontal":"vertical";else throw new TypeError("barChart needs x and y (the axis whose values aren't numbers is the category), or one of them plus stack.");let i=a==="horizontal",s=i?n:t,c=i?t:n;if(s===void 0)throw new TypeError(`barChart: a ${a} chart takes its categories from ${i?"y":"x"}.`);let d=xn(s),l;if(r!==void 0)l=r.map(u=>({series:u,value:xn(u)}));else if(c!==void 0)l=[{series:typeof c=="string"?c:"value",value:xn(c)}];else throw new TypeError(`barChart needs values: ${i?"x":"y"} set to a numeric field, or stack.`);return{orientation:a,category:d,key:e.key===void 0?d:xn(e.key),series:l}}function Ya(e){let t=Tc(Dc(e),e.sort),n=Lo(t.map(i=>i.total)),r=t.map(i=>e.format(i.total)),o=n.ticks.map(e.format),a=(e.encoding.orientation==="horizontal"?Rc:Cc)(e,t,n,r,o);return{width:a.bands.width,height:a.bands.height,orientation:a.orientation,frame:a,rows:t.map((i,s)=>Ro(a,{...i,slot:s,text:r[s]})),ticks:n.ticks.map((i,s)=>Co(a,i,o[s]))}}function Ro(e,t){let{scale:n,bands:r}=e,o=Xa(n),a=Math.abs(n.extent/(n.hi-n.lo)),i=t.values.reduce((h,T)=>h+T.value,0),s=i<0,c=o(0),d=o(i),l=r.start+t.slot*r.band,u={key:t.key,...t.values.length===1?{series:t.values[0].series}:{},radius:xc,gap:Mc,segments:t.values.map(h=>({series:h.series,size:Math.max(0,s?-h.value:h.value)*a}))},m={key:t.key,datum:t.datum,index:t.index,slot:t.slot,values:t.values,total:i};if(e.orientation==="horizontal"){let h=qe.bar({...u,x:Math.min(c,d),y:l+(r.band-r.thickness)/2,width:Math.abs(d-c),height:r.thickness,baseline:s?"right":"left"}),T=l+r.band/2+qa*Ja;return{...m,geometry:h,data:Ua(t.datum,i,h),label:{x:n.label,y:T,anchor:"end",text:t.category},value:{x:s?d-Qt:d+Qt,y:T,anchor:s?"end":"start",text:t.text},hit:{x:0,y:l,width:r.width,height:r.band}}}let p=l+r.band/2,k=qe.bar({...u,x:p-r.thickness/2,y:Math.min(c,d),width:r.thickness,height:Math.abs(d-c),baseline:s?"top":"bottom"});return{...m,geometry:k,data:Ua(t.datum,i,k),label:{x:p,y:n.label,anchor:"middle",text:t.category},value:{x:p,y:s?d+Qt+Ar*.8:d-Qt,anchor:"middle",text:t.text},hit:{x:l,y:0,width:r.band,height:r.height}}}function Co(e,t,n){let{bands:r}=e,o=Xa(e.scale)(t);if(e.orientation==="horizontal"){let a=r.start+r.span;return{value:t,line:{x1:o,y1:r.start,x2:o,y2:a},label:{x:o,y:a+16,anchor:"middle",text:n}}}return{value:t,line:{x1:r.start,y1:o,x2:r.start+r.span,y2:o},label:{x:r.start-8,y:o+To*Ja,anchor:"end",text:n}}}function Xa(e){let t=e.extent/(e.hi-e.lo);return n=>e.from+(n-e.lo)*t}function Dc({data:e,encoding:t}){let n=new Set;return e.map((r,o)=>{let a=String(t.key(r,o));if(n.has(a))throw new Error(`barChart: two rows have the key "${a}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(a);let i=t.series.map(({series:c,value:d})=>({series:c,value:Lc(d(r,o),c,a)}));if(i.some(c=>c.value>0)&&i.some(c=>c.value<0))throw new RangeError(`barChart: the stack for "${a}" mixes positive and negative values, which isn't supported yet.`);let s=i.reduce((c,d)=>c+d.value,0);return{key:a,category:String(t.category(r,o)??""),datum:r,index:o,values:i,total:s}})}function Tc(e,t){if(t===void 0||t==="none")return e;if(t==="value")return[...e].sort((n,r)=>r.total-n.total);if(t==="key")return[...e].sort((n,r)=>n.key.localeCompare(r.key,void 0,{numeric:!0}));if(typeof t=="function")return[...e].sort((n,r)=>t(n.datum,r.datum));throw new TypeError(`barChart: sort must be "value", "key", "none" or a comparator, got ${String(t)}.`)}function Lo(e){let t=e.reduce((i,s)=>Math.min(i,s),0),n=e.reduce((i,s)=>Math.max(i,s),0);t===n&&(n=1);let r=ir((n-t)/4);t=Mn(Math.floor(t/r)*r),n=Mn(Math.ceil(n/r)*r);let o=Math.round((n-t)/r),a=Array.from({length:o+1},(i,s)=>Mn(t+s*r));return{lo:t,hi:n,ticks:a}}function ir(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 Rc(e,t,n,r,o){let{width:a,measure:i}=e,s=t.length,c=Or(t.map(h=>h.category),"ec-label",qa,i),d=Or(r,"ec-value",Ar,i),l=Or(o,"ec-tick",To,i),u=n.lo<0?d+Qt:0,m=Math.max(c+10+u,l/2+2),p=Math.max(d+Qt+4,l/2+2),k=e.height===void 0||s===0?Eo:Math.max(0,e.height-Pr-Do)/s;return{orientation:"horizontal",scale:{lo:n.lo,hi:n.hi,from:m,extent:Math.max(0,a-m-p),label:m-10-u},bands:{start:Pr,band:k,thickness:k*Za/Eo,span:s*k,width:a,height:e.height??Pr+s*k+Do}}}function Cc(e,t,n,r,o){let{width:a,measure:i}=e,s=t.length,c=e.height??Ec,d=Or(o,"ec-tick",To,i),l=n.hi>0?Ar+Qt+2:Pr,u=Do+(n.lo<0?Ar+Qt:0),m=d+8+2,p={x:m,y:l,width:Math.max(0,a-m-8),height:Math.max(0,c-l-u)},k=s>0?p.width/s:0,h=p.y+p.height;return{orientation:"vertical",scale:{lo:n.lo,hi:n.hi,from:h,extent:-p.height,label:h+18},bands:{start:p.x,band:k,thickness:Math.min(k*Za/Eo,Sc),span:p.width,width:a,height:c}}}function Ua(e,t,n){let r=a=>n.length>0?t*a/n.length:0,o={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related(a){let i=n.segments?.find(c=>c.series===a);if(!i)return;let s=Math.hypot(i.start.x-n.start.x,i.start.y-n.start.y);return{datum:e,samples:[{t:0,value:r(s)},{t:1,value:r(s+i.length)}],related:o.related}}};return o}function Or(e,t,n,r){return e.reduce((o,a)=>Math.max(o,r(a,t,n)),0)}function xn(e){return typeof e=="function"?e:t=>t[e]}function Wa(e,t){let n=!1;for(let r=0;r<e.length;r++){let o=t(e[r],r);if(o!=null){if(typeof o!="number")return!1;n=!0}}return n}function Lc(e,t,n){if(e==null)return 0;if(typeof e=="number"&&Number.isFinite(e))return e;throw new RangeError(`barChart: "${t}" for "${n}" must be a finite number, got ${typeof e=="string"?JSON.stringify(e):String(e)}.`)}function Mn(e){let t=Number(e.toPrecision(12));return t===0?0:t}var sr={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"]]}},ei=["surface","text","text-muted","grid","axis","focus","negative"],De=Object.fromEntries(ei.map(e=>[e,sr.light[e]]));function Xe(e){let t=(Math.max(1,Math.floor(e))-1)%8+1,[n,r]=sr.light.series[t-1];return{color:`var(--ec-series-${t}, ${n})`,strong:`var(--ec-series-${t}-strong, ${r})`}}function Qe(e){if(e==="mark")return`var(--ec-mark, ${Xe(1).color})`;if(e==="mark-strong")return`var(--ec-mark-strong, ${Xe(1).strong})`;let t=De[e];if(t!==void 0)return`var(--ec-${e}, ${t})`;let n=/^series-(\d+)(-strong)?$/.exec(e);if(n){let r=Xe(Number(n[1]));return n[2]?r.strong:r.color}return e}function ct(e){return{"--ec-mark":e?.color,"--ec-mark-strong":e?.strong}}function Po(e,t){let r=[...ei,"ring","dim-opacity"].map(o=>`--ec-${o}: ${e[o]};`);return e.series.forEach(([o,a],i)=>r.push(`--ec-series-${i+1}: ${o};`,`--ec-series-${i+1}-strong: ${a};`)),r.map(o=>t+o).join(`
2
- `)}var Pc=`:where(:root, [data-theme="light"]) {
3
- ${Po(sr.light," ")}
1
+ "use strict";var ExpressiveCharts=(()=>{var Mo=Object.defineProperty;var Mc=Object.getOwnPropertyDescriptor;var Sc=Object.getOwnPropertyNames;var Ec=Object.prototype.hasOwnProperty;var Dc=(e,t)=>{for(var n in t)Mo(e,n,{get:t[n],enumerable:!0})},Tc=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Sc(t))!Ec.call(e,o)&&o!==n&&Mo(e,o,{get:()=>t[o],enumerable:!(r=Mc(t,o))||r.enumerable});return e};var Rc=e=>Tc(Mo({},"__esModule",{value:!0}),e);var em={};Dc(em,{VERSION:()=>Uf,animated:()=>Be,barChart:()=>Wf,chartSwitch:()=>Jf,colorAssignment:()=>Hr,configure:()=>vc,createClock:()=>Cr,createMotion:()=>Eo,defaultClock:()=>Fe,defaultScaling:()=>ar,defineDataEffect:()=>fc,defineEffect:()=>uc,defineIcon:()=>yn,delta:()=>Xs,describe:()=>Ye,donutChart:()=>Zf,easeInOutCubic:()=>nt,easeOutCubic:()=>It,expressive:()=>Yf,flash:()=>ho,fromVegaView:()=>Xf,gaits:()=>Tr,iconFromSvg:()=>gc,icons:()=>xo,interpolateNumber:()=>ct,interpolatePoint:()=>Ka,interpolateRecord:()=>xt,label:()=>Qs,lineChart:()=>qf,linear:()=>yt,link:()=>zo,manualClock:()=>za,matrix:()=>xe,mediaReducedMotion:()=>Do,morph:()=>vo,motion:()=>kt,motionSwitch:()=>Qf,offset:()=>rn,only:()=>ic,parallel:()=>ac,playButton:()=>La,playback:()=>Ua,pulse:()=>bo,registerIcon:()=>Fa,registerIcons:()=>wc,registerPreset:()=>bc,samplesAlong:()=>dr,scaleDuration:()=>ir,sequence:()=>oc,stagger:()=>sc,threshold:()=>tc,trace:()=>qs,travel:()=>js,tween:()=>en,wiggle:()=>go});function Se(e){let t=globalThis.reportError;typeof t=="function"?t(e):console.error(e)}function Cr(e=Cc()){let t=new Set,n,r=()=>{!n&&t.size>0&&(n=e.request(o))},o=a=>{n=void 0;for(let i of[...t])if(t.has(i))try{i(a)}catch(s){Se(s)}r()};return{now:()=>e.now(),onFrame(a){let i=s=>a(s);return t.add(i),r(),()=>{t.delete(i)&&t.size===0&&n&&(n(),n=void 0)}}}}function za(e=0){let t=e,n,r=Cr({now:()=>t,request(o){return n=o,()=>{n===o&&(n=void 0)}}});return{now:r.now,onFrame:r.onFrame,get idle(){return n===void 0},advance(o){if(!(o>=0))throw new RangeError(`manualClock.advance needs a non-negative number of ms, got ${o}`);t+=o;let a=n;n=void 0,a?.(t)}}}function Cc(){let e=()=>typeof performance<"u"?performance.now():Date.now();return{now:e,request(t){if(typeof requestAnimationFrame=="function"){let r=requestAnimationFrame(t);return()=>cancelAnimationFrame(r)}let n=setTimeout(()=>t(e()),16);return()=>clearTimeout(n)}}}var Fe=Cr();var yt=e=>e,nt=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,It=e=>1-Math.pow(1-e,3);function Lr(e){return e<.5?Math.cbrt(e/4):1-Math.cbrt(2*(1-e))/2}var ar={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}}},_a=["presentation","analysis","off"],Pr=["feedback","transition","effect","playback","stagger"];function Eo(e={}){let t=So(e.mode??"presentation"),n,r=Lc(e.scaling),o=e.reducedMotion??Do(),a=new Set,i,s=()=>n??(o.matches?"off":t),c=()=>{for(let d of[...a])if(a.has(d))try{d()}catch(l){Se(l)}};return{get mode(){return s()},get staged(){return s()==="presentation"},get requested(){return t},get viewerChoice(){return n},get prefersReduced(){return o.matches},duration(d,l="transition"){let u=s();return u==="off"?0:ir(d,r[u][l])},setMode(d){So(d),d!==t&&(t=d,c())},chooseMode(d){So(d),d!==n&&(n=d,c())},clearChoice(){n!==void 0&&(n=void 0,c())},subscribe(d){let l=()=>d();return a.add(l),i??(i=o.subscribe(c)),()=>{!a.delete(l)||a.size>0||(i?.(),i=void 0)}}}}function ir(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 Do(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(r){let o=n();if(!o)return()=>{};let a=()=>r();return typeof o.addEventListener=="function"?(o.addEventListener("change",a),()=>o.removeEventListener("change",a)):(o.addListener(a),()=>o.removeListener(a))}}}function So(e){if(!_a.includes(e))throw new TypeError(`Unknown motion mode "${String(e)}". Use one of: ${_a.join(", ")}.`);return e}function Lc(e={}){let t=n=>{let r={...ar[n]};for(let o of Pr){let a=e[n]?.[o];a&&(r[o]=a)}return r};return{presentation:t("presentation"),analysis:t("analysis")}}var kt=Eo();function en(e,t={}){let n=t.clock??Fe,r=t.motion??kt,o=e.timing??"transition",a=e.ease??nt,i=r.duration(e.duration,o),s=e.delay?r.duration(e.delay,o):0,{update:c,signal:d}=e,l=n.now(),u="running",f,h,w=new Promise(O=>{h=O}),v=O=>{u=O,f?.(),f=void 0,d?.removeEventListener("abort",D),h(O)};function D(){u==="running"&&v("cancelled")}let F=!1;function P(){u!=="running"||F||(F=!0,V(1),u==="running"&&v("done"))}function V(O){try{c(a(O))}catch(G){throw D(),G}}let x=O=>{if(r.mode==="off"){P();return}let G=O-l-s;G>=i?P():G>0&&V(G/i)},R={finished:w,get state(){return u},cancel:D,finish:P};return d?.aborted?(v("cancelled"),R):(d?.addEventListener("abort",D,{once:!0}),i<=0&&s<=0?(P(),R):(V(0),u==="running"&&(f=n.onFrame(x)),R))}var ct=(e,t)=>n=>e*(1-n)+t*n,Ka=(e,t)=>n=>({x:e.x*(1-n)+t.x*n,y:e.y*(1-n)+t.y*n});function xt(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])];return r=>{if(r===1)return{...t};let o={};for(let a of n)o[a]=(e[a]??0)*(1-r)+(t[a]??0)*r;return o}}function Be(e,t,n={}){let{onChange:r,...o}=n,a=e,i=e,s,c=!1,d=u=>{a=u,r?.(u)},l=()=>{let u=s;s=void 0,c=!1,u?.cancel()};return{get value(){return a},get target(){return s?.state==="cancelled"?a:i},get animating(){return s?.state==="running"},to(u,f){let h=s?.state==="running"&&c&&!(f.delay&&f.delay>0);l(),i=u;let w=t(a,u),v=!1,D=en({duration:f.duration,timing:f.timing,ease:f.ease??(h?It:nt),delay:f.delay,signal:f.signal,update:F=>{v&&(c=!0),v=!0,d(w(F))}},o);return s=D,D.finished},set(u){l(),i=u,d(u)},stop(){l(),i=a}}}var Pc=350;function Ua(e){Oc(e);let{from:t,to:n,duration:r,onFrame:o}=e,a=e.ease??yt,i=e.timing??"playback",s=e.clock??Fe,c=e.motion??kt,d=Math.min(t,n),l=Math.max(t,n),u=n,f=!1,h=!1,w,v=0,D=new Set,F=g=>{for(let E of[...D])if(D.has(E))try{E(g)}catch(U){Se(U)}},P=()=>{let g=w;return w=void 0,g?.stop(),g?.moved??!1},V=()=>{f&&(f=!1,F("pause"))},x=g=>{throw v++,P(),V(),g},R=g=>{if(g!==u){u=g;try{o(g)}catch(E){x(E)}}},O=(g,E,U,k)=>{let T=v;if(!(E>0)){R(g),v===T&&k();return}let H=u,_=s.now(),te={moved:!1,stop:s.onFrame(ae=>{let z=c.mode==="off"?1:(ae-_)/E;if(z<1){te.moved=!0;let Z;try{Z=U(z)}catch(se){return x(se)}R(H+(g-H)*Z);return}P(),R(g),v===T&&k()})};w=te},G=()=>{f=!1,F("end")};return{get position(){return u},get playing(){return f},play(){if(h||f)return;let g=++v;if(P(),f=!0,F("play"),v!==g)return;let E=c.duration(r,i);E>0&&u===n&&(R(t),v!==g)||O(n,E*Math.abs(n-u)/Math.abs(n-t),a,G)},pause(){h||!f||(v++,P(),V())},seek(g,E={}){if(Ac(g,E),h)return;let U=++v,k=P();if(V(),v!==U||(F("seek"),v!==U))return;let T=E.animate===!1?0:c.duration(Pc,"transition");O(Math.min(Math.max(g,d),l),T,k?It:nt,()=>{})},subscribe(g){if(typeof g!="function")throw new TypeError(`playback.subscribe needs a function, got ${typeof g}.`);if(h)return()=>{};let E=U=>g(U);return D.add(E),()=>{D.delete(E)}},destroy(){h||(h=!0,v++,P(),V(),D.clear())}}}function Oc(e){if(typeof e!="object"||e===null)throw new TypeError("playback needs options: { from, to, duration, onFrame }.");let{from:t,to:n,duration:r,ease:o,timing:a,onFrame:i,clock:s,motion:c}=e;for(let[d,l]of[["from",t],["to",n]])if(!To(l))throw new RangeError(`playback: ${d} must be a finite number, got ${String(l)}.`);if(t===n)throw new RangeError(`playback: from and to must differ, got ${t} for both.`);if(!To(r)||r<0)throw new RangeError(`playback: duration must be a non-negative number of ms, got ${String(r)}.`);if(typeof i!="function")throw new TypeError(`playback: onFrame must be a function, got ${typeof i}.`);if(o!==void 0&&typeof o!="function")throw new TypeError(`playback: ease must be a function, got ${typeof o}.`);if(a!==void 0&&!Pr.includes(a))throw new RangeError(`playback: timing must be one of ${Pr.join(", ")}, got ${JSON.stringify(a)??String(a)}.`);if(s!==void 0&&(typeof s?.now!="function"||typeof s.onFrame!="function"))throw new TypeError("playback: clock must be a Clock, such as one from createClock() or manualClock().");if(c!==void 0&&typeof c?.duration!="function")throw new TypeError("playback: motion must be a Motion, such as the page-wide `motion` or one from createMotion().")}function Ac(e,t){if(!To(e))throw new RangeError(`playback.seek needs a finite number, got ${String(e)}.`);if(typeof t!="object"||t===null)throw new TypeError("playback.seek's options must be an object, such as { animate: false }.");if(t.animate!==void 0&&typeof t.animate!="boolean")throw new TypeError(`playback.seek: animate must be true or false, got ${String(t.animate)}.`)}function To(e){return typeof e=="number"&&Number.isFinite(e)}var Vt=2*Math.PI;function rt(e,t,n=0){let r=t.x-e.x,o=t.y-e.y,a=Math.hypot(r,o);return{kind:"line",from:e,to:t,length:a,angle:a>0?Math.atan2(o,r):sr(n)}}function Mt(e,t,n,r){return{kind:"arc",center:e,radius:t,start:n,sweep:r,length:t*Math.abs(r)}}function Nt(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 Ft(e.center,e.radius,e.start+e.sweep*t)}function Ro(e,t){if(e.kind==="line")return e.angle;let n=e.sweep<0?-Math.PI/2:Math.PI/2;return sr(e.start+e.sweep*t+n)}function Ft(e,t,n){return{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}}function sr(e){return e-Vt*Math.ceil((e-Math.PI)/Vt)}function Co(e){if(e.kind==="line")return[e.from,e.to];let t=[Nt(e,0),Nt(e,1)];for(let n=0;n<4;n++){let r=n*Math.PI/2;$c(e,r)&&t.push(Ft(e.center,e.radius,r))}return t}function pn(e){let t=1/0,n=1/0,r=-1/0,o=-1/0;for(let{x:a,y:i}of e)a<t&&(t=a),a>r&&(r=a),i<n&&(n=i),i>o&&(o=i);return{x:t,y:n,width:r-t,height:o-n}}function $c(e,t){let n=Math.abs(e.sweep);return n>=Vt?!0:((e.sweep>=0?t-e.start:e.start-t)%Vt+Vt)%Vt<=n}function Ze(e){let t=Math.round(e*1e3)/1e3;return t===0?"0":String(t)}function Or(e){return`M${Ze(e.x)},${Ze(e.y)}`}function Ar(e,t=0,n=1){if(e.kind==="line"){let d=n===1?e.to:Nt(e,n);return`L${Ze(d.x)},${Ze(d.y)}`}let r=e.start+e.sweep*t,o=e.sweep*(n-t),a=Math.max(1,Math.ceil(Math.abs(o)/Math.PI-1e-9)),i=Ze(e.radius),s=o>=0?1:0,c="";for(let d=1;d<=a;d++){let l=Ft(e.center,e.radius,r+o*d/a);c+=`A${i},${i} 0 0 ${s} ${Ze(l.x)},${Ze(l.y)}`}return c}function cr(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 o=Or(Nt(n,0));for(let a=0;a<r;a++){let i=e[a];i.length>0&&(o+=Ar(i))}return t?`${o}Z`:o}var $r=e=>e>0?e<1?e:1:0;function Bt(e){let t=e[0],n=e[e.length-1];if(!t||!n)throw new RangeError("A walk needs at least one segment.");let r=[0];for(let d of e)r.push(r[r.length-1]+d.length);let o=r[e.length],a=Nt(t,0),i=Nt(n,1),s=d=>{if(!(o>0))return{index:0,u:0};if(d>=o){let f=e.length-1;for(;f>0&&!(e[f].length>0);)f--;return{index:f,u:1}}let l=0,u=e.length-1;for(;l<u;){let f=l+u>>1;r[f+1]>d?u=f:l=f+1}return{index:l,u:Math.min(1,(d-r[l])/e[l].length)}},c=d=>{let l=$r(d);if(l===0)return a;if(l===1)return i;let{index:u,u:f}=s(l*o);return Nt(e[u],f)};return{segments:e,length:o,start:a,end:i,point:c,angle(d){let{index:l,u}=s($r(d)*o);return Ro(e[l],u)},slice(d,l){let u=$r(Math.min(d,l)),f=$r(Math.max(d,l)),h=Or(c(u)),w=u*o,v=f*o;if(!(v>w))return h;let D=s(w);for(let F=D.index;F<e.length&&r[F]<v;F++){let P=e[F];if(!(P.length>0))continue;let V=F===D.index?D.u:0,x=r[F+1]>v?Math.min(1,(v-r[F])/P.length):1;x>V&&(h+=Ar(P,V,x))}return h},d:cr(e)}}function En(e){let t=e.map(Bt);return{d:cr(e.flat(),!0),closed:!0,sample(n){Za(n,4);let r=n/4,o=[];for(let a of t)for(let i=0;i<r;i++)o.push(a.point(i/r));return o}}}function Wa(e){return{d:e.d,closed:!1,sample(t){if(Za(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 Za(e,t){if(!Number.isInteger(e)||e<0||e%t!==0){let n=t===1?"a whole number \u2265 0":`a whole multiple of ${t}`;throw new RangeError(`outline.sample(n): n must be ${n}, got ${e}.`)}}function tn({key:e,series:t,walk:n,thickness:r,outline:o,bounds:a,center:i,pivot:s,labelBounds:c,segments:d}){return{key:e,...t===void 0?{}:{series:t},start:n.start,end:n.end,length:n.length,path:l=>n.point(l),angle:l=>n.angle(l),slice:(l,u)=>n.slice(l,u),thickness:r,outline:o,bounds:a,center:i,pivot:s,...c===void 0?{}:{labelBounds:c},...d===void 0?{}:{segments:d}}}function ot(e,t,n){if(!Number.isFinite(n))throw new RangeError(`describe.${e}: ${t} must be a finite number, got ${n}.`);return n}function nn(e,t){if(!t)return t;for(let n=0;n<t.length;n++){let{x:r,y:o,width:a,height:i}=t[n];Number.isFinite(r)&&Number.isFinite(o)&&Number.isFinite(a)&&a>=0&&Number.isFinite(i)&&i>=0||(ot(e,`labelBounds[${n}].x`,r),ot(e,`labelBounds[${n}].y`,o),lt(e,`labelBounds[${n}].width`,a),lt(e,`labelBounds[${n}].height`,i))}return t}function lt(e,t,n){if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`describe.${e}: ${t} must be a finite number \u2265 0, got ${n}.`);return n}function qa(e){let{key:t,series:n}=e,r={x:ot("arc","cx",e.cx),y:ot("arc","cy",e.cy)},o=Math.min(lt("arc","inner",e.inner),lt("arc","outer",e.outer)),a=Math.max(e.inner,e.outer);ot("arc","start",e.start),ot("arc","end",e.end);let i=Math.max(-Vt,Math.min(Vt,e.end-e.start)),s=e.start-Math.PI/2,c=s+i,[d,l]=i>=0?[a,o]:[o,a],u=[[Mt(r,d,s,i)],[rt(Ft(r,d,c),Ft(r,l,c),c+(d>l?Math.PI:0))],[Mt(r,l,c,-i)],[rt(Ft(r,l,s),Ft(r,d,s),s+(d>l?0:Math.PI))]],f=Bt([Mt(r,(o+a)/2,s,i)]);return tn({key:t,series:n,walk:f,thickness:a-o,outline:En(u),bounds:pn(u.flat().flatMap(Co)),center:f.point(.5),pivot:r,labelBounds:nn("arc",e.labelBounds)})}var Ja={left:0,right:Math.PI,top:Math.PI/2,bottom:-Math.PI/2};function Ya(e){let{key:t,series:n,baseline:r,x:o,y:a,width:i,height:s}=e;if(!Object.prototype.hasOwnProperty.call(Ja,r))throw new RangeError(`describe.bar: baseline must be left, right, top or bottom, got ${String(r)}.`);ot("bar","x",o),ot("bar","y",a),lt("bar","width",i),lt("bar","height",s);let c=lt("bar","radius",e.radius??0),d=lt("bar","gap",e.gap??0),l=nn("bar",e.labelBounds),u=r==="left"||r==="right",f=u?i:s,h=u?s:i,w=h,v=Ja[r],D=Gc(e),F=(G,g,E,U)=>{let k=Math.max(0,Math.min(E,g-G,w/2)),T=En([[rt(D(G,0),D(g-k,0),v)],k>0?[Mt(D(g-k,k),k,v-Math.PI/2,Math.PI/2),rt(D(g,k),D(g,w-k),v+Math.PI/2),Mt(D(g-k,w-k),k,v,Math.PI/2)]:[rt(D(g,0),D(g,w),v+Math.PI/2)],[rt(D(g-k,w),D(G,w),v+Math.PI)],[rt(D(G,w),D(G,0),v-Math.PI/2)]]),H=Bt([rt(D(G,w/2),D(g,w/2),v)]);return tn({...U,walk:H,thickness:h,outline:T,bounds:U.bounds??pn([D(G,0),D(g,w)]),center:D((G+g)/2,w/2),pivot:H.start})},P=e.segments??[{series:n,size:f}],V=new Set,x=0,O=P.map((G,g)=>{if(lt("bar",`segments[${g}].size`,G.size),G.series!==void 0){if(V.has(G.series))throw new Error(`describe.bar: series "${G.series}" appears twice in the segments of "${t}".`);V.add(G.series)}let E=Math.min(x,f);x+=G.size;let U=Math.min(x,f);return{segment:G,index:g,p0:Math.min(E+Math.min(d,E),U),p1:U}}).map(({segment:G,index:g,p0:E,p1:U})=>F(E,U,c-(f-U),{key:G.series===void 0?`${t}/${g}`:`${t}/${G.series}`,series:G.series}));return F(0,f,c,{key:t,series:n,bounds:{x:o,y:a,width:i,height:s},labelBounds:l,segments:O})}function Gc({x:e,y:t,width:n,height:r,baseline:o}){switch(o){case"left":return(a,i)=>({x:e+a,y:t+i});case"right":return(a,i)=>({x:e+n-a,y:t+r-i});case"top":return(a,i)=>({x:e+n-i,y:t+a});case"bottom":return(a,i)=>({x:e+i,y:t+r-a})}}function Xa(e){let{key:t,series:n,points:r}=e,o=lt("line","width",e.width??1),a=r[0];if(!a)throw new RangeError(`describe.line: "${t}" needs at least one point.`);r.forEach((l,u)=>{ot("line",`points[${u}].x`,l.x),ot("line",`points[${u}].y`,l.y)});let i=[];for(let l=1;l<r.length;l++)i.push(rt(r[l-1],r[l],i[i.length-1]?.angle??0));i.length===0&&i.push(rt(a,a));let s=Bt(i),c=pn(r),d=o/2;return tn({key:t,series:n,walk:s,thickness:o,outline:Wa(s),bounds:{x:c.x-d,y:c.y-d,width:c.width+o,height:c.height+o},center:s.point(.5),pivot:a,labelBounds:nn("line",e.labelBounds)})}function Qa(e){let{key:t,series:n}=e,r={x:ot("point","x",e.x),y:ot("point","y",e.y)},o=lt("point","r",e.r),a=Math.PI/2;return tn({key:t,series:n,walk:Bt([rt(r,r)]),thickness:2*o,outline:En([[Mt(r,o,-3*a/2,a)],[Mt(r,o,-a/2,a)],[Mt(r,o,a/2,a)],[Mt(r,o,3*a/2,a)]]),bounds:{x:r.x-o,y:r.y-o,width:2*o,height:2*o},center:r,pivot:r,labelBounds:nn("point",e.labelBounds)})}var Ye={bar:Ya,arc:qa,line:Xa,point:Qa};function ei(e,t){return[1,0,0,1,e,t]}function ti(e,t){let n=Math.cos(e),r=Math.sin(e);return oi([n,r,-r,n,0,0],t)}function ni(e,t=e,n){return oi([e,0,0,t,0,0],n)}function ri(...e){let t=[1,0,0,1,0,0];for(let n of e)t=Vc(t,n);return t}function Ic(e,t){let[n,r,o,a,i,s]=e;return{x:n*t.x+o*t.y+i,y:r*t.x+a*t.y+s}}function Vc(e,t){let[n,r,o,a,i,s]=e,[c,d,l,u,f,h]=t;return[n*c+o*d,r*c+a*d,n*l+o*u,r*l+a*u,n*f+o*h+i,r*f+a*h+s]}function oi(e,t){if(!t)return e;let[n,r,o,a]=e;return[n,r,o,a,t.x-n*t.x-o*t.y,t.y-r*t.x-a*t.y]}var xe={translate:ei,rotate:ti,scale:ni,multiply:ri,apply:Ic};function Dn(e){let[t,n,r,o,a,i]=e,s=t*o-n*r;if(!Number.isFinite(s)||Math.abs(s)<1e-12)throw new RangeError("This transform can't be inverted: it has no area.");return[o/s,-n/s,-r/s,t/s,(r*i-o*a)/s,(n*a-t*i)/s]}function lr(e){let t=[];for(let[,n,r=""]of e.matchAll(/(matrix|translate|scale|rotate|skewX|skewY)\s*\(([^)]*)\)/g)){let o=r.trim().split(/[\s,]+/).filter(Boolean).map(Number);if(!o.every(Number.isFinite))continue;let[a=0,i,s,c=0,d=0,l=0]=o,u=f=>f*Math.PI/180;switch(n){case"matrix":o.length===6&&t.push([a,i,s,c,d,l]);break;case"translate":t.push(ei(a,i??0));break;case"scale":t.push(ni(a,i??a));break;case"rotate":t.push(ti(u(a),i!==void 0&&s!==void 0?{x:i,y:s}:void 0));break;case"skewX":t.push([1,0,Math.tan(u(a)),1,0,0]);break;case"skewY":t.push([1,Math.tan(u(a)),0,1,0,0]);break}}return ri(...t)}function rn(e,t,n){return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}var Gr=(Math.sqrt(5)-1)/2;function dr(e,t){if(typeof e!="object"||e===null||typeof e.path!="function"||!Number.isFinite(e.length))throw new TypeError("samplesAlong needs a MarkGeometry, as describe builds it.");if(!Array.isArray(t))throw new TypeError("samplesAlong needs an array of points { x, y, value, at? }.");t.forEach((o,a)=>{for(let i of["x","y","value"]){let s=o?.[i];if(typeof s!="number"||!Number.isFinite(s))throw new RangeError(`samplesAlong: points[${a}].${i} must be a finite number, got ${String(s)}.`)}});let n=e.length>0?Math.min(4096,Math.ceil(e.length)+1):1,r=Array.from({length:n},(o,a)=>e.path(n===1?0:a/(n-1)));return t.map((o,a)=>({index:a,sample:{t:Nc(e,r,o),value:o.value,...o.at===void 0?{}:{at:o.at}}})).sort((o,a)=>o.sample.t-a.sample.t||o.index-a.index).map(({sample:o})=>o)}function Nc(e,t,n){let r=t.length;if(r===1)return 0;let o=0,a=1/0;t.forEach((v,D)=>{let F=ai(v,n);F<a&&(o=D,a=F)});let i=v=>ai(e.path(v),n),s=Math.max(0,o-1)/(r-1),c=Math.min(r-1,o+1)/(r-1),d=c-Gr*(c-s),l=s+Gr*(c-s),u=i(d),f=i(l);for(let v=0;v<48;v++)u<=f?(c=l,l=d,f=u,d=c-Gr*(c-s),u=i(d)):(s=d,d=l,u=f,l=s+Gr*(c-s),f=i(l));let h=(s+c)/2,w=i(h)<a?h:o/(r-1);return w>0?w<1?w:1:0}function ai(e,t){return(e.x-t.x)**2+(e.y-t.y)**2}function Lo(e){let{kind:t,hint:n}=e,r=new Map,o={get:a=>r.get(a),resolve(a){let i=r.get(a);if(i!==void 0)return i;let s=r.size>0?[...r.keys()].join(", "):"none";throw new RangeError(`Unknown ${t} "${String(a)}". Registered ${t}s: ${s}.${n?` ${n}`:""}`)},register(a,i){if(typeof a!="string"||a==="")throw new TypeError(`A ${t} needs a non-empty string name, got ${JSON.stringify(a)}.`);if(i===void 0)throw new TypeError(`Registering ${t} "${a}" needs a value.`);r.set(a,i)},names:()=>[...r.keys()]};for(let[a,i]of Object.entries(e.entries??{}))o.register(a,i);return o}var Ht=["hover","enter","update","exit","decorate"];function jt(e,t){let n={};for(let r of Object.keys(e??{}))if(!Ht.includes(r))throw new TypeError(`on.${r} isn't an effect slot. Use one of: ${Ht.join(", ")}.`);for(let r of Ht){let o=e?.[r];if(o!==void 0)if(typeof o=="string"){let a=t.resolve(o)();if(!Ir(a))throw new TypeError(`Preset "${o}" for on.${r} didn't return a mark effect; it returned ${ur(a)}.`);n[r]=a}else{if(!Ir(o))throw new TypeError(`on.${r} needs a mark effect (kind "geometry" or "data") or a preset name, got ${ur(o)}.`);n[r]=o}}return n}function Ir(e){if(typeof e!="object"||e===null)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 ur(e){if(typeof e!="object"||e===null)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 Yt(e,t){let n={...e};for(let[r,o]of Object.entries(t??{}))o===void 0?delete n[r]:n[r]=o;return n}function Oo(e){let{clock:t,motion:n,layer:r,mark:o}=e,a=new AbortController,i=[];return{context:{signal:a.signal,motion:n,mark:o,layer:r,icons:e.icons,batch:e.batch,...e.previous?{previous:e.previous}:{},tween(c){let d=c.signal,l=en({...c,signal:d??a.signal},{clock:t,motion:n});return d&&d!==a.signal&&(a.signal.aborted?l.cancel():a.signal.addEventListener("abort",()=>l.cancel(),{once:!0})),l},onChange(c){i.push(c)}},abort(){a.abort()},change(c,d){for(let l of[...i])l(c,d)},clear(){a.abort(),r.clear(),o.reset(),i=[]}}}var Fc=["decorate","enter","update","exit","hover"],Bc={get:()=>{}},Po={place(){},update(){},remove(){}};function on(e){let{surface:t}=e,n=e.effects,r=e.motion??kt,o=e.clock??Fe,a=e.icons??Bc,i=new Map,s=new Set,c=!1,d=!1,l=0,u=r.subscribe(()=>{r.mode==="off"&&g()});function f(k){let T=k.mark.key,H=i.get(T);if(H)return H.mark=k.mark,H.data=k.data,H;let _={key:T,mark:k.mark,data:k.data,runs:new Map,applied:{},handle:void 0,exiting:void 0};return i.set(T,_),_}function h(k,T,H,_,te={}){let{previous:ae,done:z}=te,Z=n[T];if(!Z){z?.();return}let se=k.runs.get(T);se&&F(se);let de={entry:k,slot:T,order:te.order??++l,effect:Z,data:H,batch:_,previous:ae,style:{},state:"running",done:z,scope:Oo({clock:o,motion:r,icons:a,batch:_,previous:ae,layer:P(k.key,T,()=>de.order,()=>de.state!=="cleared"),mark:V(()=>de)})};k.runs.set(T,de);let we=te.mark??k.mark,A=de.scope.context;try{if(te.end||r.mode==="off")Z.kind==="data"?Z.end(we,H,A):Z.end(we,A),w(de);else{let j=Z.kind==="data"?Z.run(we,H,A):Z.run(we,A);Promise.resolve(j).then(()=>w(de),Q=>v(de,Q))}}catch(j){v(de,j)}}function w(k){k.state==="running"&&(k.state="ended",D(k))}function v(k,T){let{signal:H}=k.scope.context;H.aborted&&(T===H.reason||T?.name==="AbortError")||(Se(T),F(k))}function D(k){let T=k.done;k.done=void 0,T?.()}function F(k){if(k.state==="cleared")return;k.state="cleared";let{entry:T}=k;T.runs.get(k.slot)===k&&T.runs.delete(k.slot),k.scope.abort();try{k.effect.clear(k.scope.context)}catch(H){Se(H)}k.scope.clear(),D(k)}function P(k,T,H,_){let te,ae=()=>_()?te??(te=t.group(k,T,H())):void 0;return{icon:(z,Z)=>ae()?.icon(z,Z)??Po,path:(z,Z)=>ae()?.path(z,Z)??Po,text:(z,Z)=>ae()?.text(z,Z)??Po,clear(){let z=te;te=void 0,z?.clear()}}}function V(k){return{set(T){let H=k();H.state!=="cleared"&&(H.style=Yt(H.style,T),x(H.entry))},reset(){let T=k();Object.keys(T.style).length!==0&&(T.style={},x(T.entry))}}}function x(k){let T=[...k.runs.values()].sort((z,Z)=>z.order-Z.order),H=Object.assign({},...T.map(z=>z.style)),_=k.applied;if(k.applied=H,Object.keys(H).length===0){Object.keys(_).length>0&&R(k).reset();return}let te={},ae=!1;for(let z of new Set([...Object.keys(_),...Object.keys(H)]))_[z]!==H[z]&&(te[z]=H[z],ae=!0);ae&&R(k).set(te)}function R(k){return k.handle??(k.handle=t.mark(k.key))}function O(k){i.get(k.key)===k&&i.delete(k.key),s.delete(k.key);let T=k.exiting;k.exiting=void 0;for(let H of[...k.runs.values()])F(H);k.handle=void 0,T?.()}function G(k){let T=k.exiting;if(!T)return;k.exiting=void 0;let H=k.runs.get("exit");H&&F(H),T()}function g(){for(let k of[...i.values()])for(let T of[...k.runs.values()]){if(T.state!=="running"||k.runs.get(T.slot)!==T)continue;let H=T.done;T.done=void 0,h(k,T.slot,U(k,T),T.batch,{previous:T.previous,done:H,order:T.order})}}function E(k){let T=new Map;for(let H of[...i.values()]){let _=H.runs.get(k);_&&(T.set(H,_.order),F(_))}return T}function U(k,T){let H=T.data.previous;return H&&!k.data.previous?ii(k.data,H):k.data}return{enter(k){d||k.forEach((T,H)=>{let _=f(T);G(_);let te={index:H,count:k.length};h(_,"decorate",T.data,te),h(_,"enter",T.data,te)})},update(k){d||k.forEach((T,H)=>{let _=i.get(T.mark.key),te=T.from??_?.mark,ae=_&&!T.data.previous?ii(T.data,_.data):T.data;h(f(T),"update",ae,{index:H,count:k.length},{previous:te})})},exit(k){if(d)return Promise.resolve();let T=k.map((H,_)=>{let te=f(H);G(te),s.delete(te.key);for(let ae of[...te.runs.values()])F(ae);return new Promise(ae=>{if(te.exiting=ae,!n.exit){O(te);return}h(te,"exit",H.data,{index:_,count:k.length},{done:()=>{te.exiting&&i.get(te.key)===te&&O(te)}})})});return Promise.all(T).then(()=>{})},hover(k){d||k.forEach((T,H)=>{let _=f(T);_.exiting||(s.add(_.key),c||h(_,"hover",T.data,{index:H,count:k.length}))})},leave(k=[...s]){for(let T of k){s.delete(T);let H=i.get(T)?.runs.get("hover");H&&F(H)}},change(k,T){let H=i.get(k.key);if(H){H.mark=k,T&&(H.data=T);for(let _ of[...H.runs.values()])if(_.state!=="cleared")try{_.scope.change(k,U(H,_))}catch(te){Se(te),F(_)}}},interrupt(){if(!d){c=!0;for(let k of[...i.values()]){let T=k.runs.get("hover");T&&F(T)}}},settle(){if(!c)return;c=!1;let k=[...s];k.forEach((T,H)=>{let _=i.get(T);_&&h(_,"hover",_.data,{index:H,count:k.length})})},swap(k,T){if(d)return;let H=Fc.filter(_=>k[_]!==n[_]);n=k;for(let _ of H)if(_==="decorate"){let te=E(_);T.forEach((ae,z)=>{let Z=i.get(ae.mark.key)??f(ae);Z.exiting||h(Z,_,ae.data,{index:z,count:T.length},{mark:ae.mark,order:te.get(Z)})})}else if(_==="hover"){if(E(_),c)continue;let te=[...s];te.forEach((ae,z)=>{let Z=i.get(ae);Z&&h(Z,_,Z.data,{index:z,count:te.length})})}else for(let te of[...i.values()]){let ae=te.runs.get(_);if(!ae)continue;let z=ae.done;ae.done=void 0;let Z=U(te,ae);F(ae),h(te,_,Z,ae.batch,{previous:ae.previous,done:z,order:ae.order,end:!0})}},destroy(){if(!d){d=!0,c=!1,u();for(let k of[...i.values()])O(k);s.clear()}}}}function ii(e,t){return{datum:e.datum,samples:e.samples,related:n=>e.related(n),previous:t}}var Hc={value:"Sorted highest first",key:"Sorted A to Z",none:"In data order",custom:"Sorted"},Ao=3;function Tn(e){let t=[],{series:n}=e;e.label!==void 0?t.push(e.label):n&&!(n.length===1&&n[0]==="value")&&t.push(`Showing ${Vr(n)}`),e.sort&&t.push(Hc[e.sort]);let{changed:r,added:o,removed:a}=e;return!n&&r.length>0&&t.push(r.length<=Ao?`${Vr(r)} changed`:`${r.length} of ${e.count} changed`),o.length>0&&t.push(`Added ${o.length<=Ao?Vr(o):o.length}`),a.length>0&&t.push(`Removed ${a.length<=Ao?Vr(a):a.length}`),t.join(". ")}function Vr(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(r){r!==""&&(n=!n,t.textContent=n?r:`${r}\xA0`)},destroy(){t.remove()}}}var jc="http://www.w3.org/2000/svg";function Y(e,t={},n){let o=(n?.ownerDocument??document).createElementNS(jc,e);return le(o,t),n?.appendChild(o),o}function le(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.removeAttribute(n):e.setAttribute(n,typeof r=="number"?Ze(r):r)}function $e(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.style.removeProperty(n):e.style.setProperty(n,r)}function At({width:e,height:t}){return{width:e,height:t,viewBox:`0 0 ${Ze(e)} ${Ze(t)}`}}function pt(e){let[t,n,r,o,a,i]=e;return`matrix(${[t,n,r,o].map(zc).join(" ")} ${Ze(a)} ${Ze(i)})`}function zc(e){let t=Math.round(e*1e6)/1e6;return t===0?"0":String(t)}var si=1.05,_c=.25,ci=.16;function an(e,t,n,r){let o=t(e.text.replace(/\d/g,"0"),n,r);return{x:(e.anchor==="start"?e.x:e.anchor==="end"?e.x-o:e.x-o/2)-ci*r,y:e.y-si*r,width:o+2*ci*r,height:(si+_c)*r}}function St(e,t){le(e,{x:t.x,y:t.y,"text-anchor":t.anchor}),e.textContent!==t.text&&(e.textContent=t.text)}var Kc=.6;function Rn(e){let t=new Map;return Object.assign((r,o,a)=>{if(r==="")return 0;let i=`${o}
2
+ ${a}
3
+ ${r}`,s=t.get(i);if(s!==void 0)return s;let c=0,d=Y("text",{class:o,visibility:"hidden","aria-hidden":"true"},e);return typeof d.getComputedTextLength=="function"&&e.isConnected&&(d.textContent=r,c=d.getComputedTextLength()),d.remove(),c>0?(t.set(i,c),c):r.length*a*Kc},{clear:()=>t.clear()})}var $o=34,ui=20,Uc=4,Wc=2,Zc=72,qc=300,Go=12.5,fr=12.5,Vo=11,Io=26,Nr=4,sn=6,fi=.36;function Pn(e){let{x:t,y:n,stack:r,data:o}=e,a=e.orientation;if(a!==void 0&&a!=="horizontal"&&a!=="vertical")throw new TypeError(`barChart: orientation must be "horizontal" or "vertical", got ${String(a)}.`);if(r!==void 0){if(!Array.isArray(r)||r.length===0)throw new TypeError("barChart: stack needs at least one numeric field.");let u=new Set;for(let f of r){if(u.has(f))throw new TypeError(`barChart: "${f}" appears twice in stack.`);u.add(f)}}if(a===void 0)if(t!==void 0&&n!==void 0){let u=di(o,Cn(t)),f=di(o,Cn(n));if(u!==f)a=u?"horizontal":"vertical";else if(o.length===0)a="horizontal";else throw new RangeError(`barChart: ${u?"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?"horizontal":"vertical";else throw new TypeError("barChart needs x and y (the axis whose values aren't numbers is the category), or one of them plus stack.");let i=a==="horizontal",s=i?n:t,c=i?t:n;if(s===void 0)throw new TypeError(`barChart: a ${a} chart takes its categories from ${i?"y":"x"}.`);let d=Cn(s),l;if(r!==void 0)l=r.map(u=>({series:u,value:Cn(u)}));else if(c!==void 0)l=[{series:typeof c=="string"?c:"value",value:Cn(c)}];else throw new TypeError(`barChart needs values: ${i?"x":"y"} set to a numeric field, or stack.`);return{orientation:a,category:d,key:e.key===void 0?d:Cn(e.key),series:l}}function mi(e){let t=Yc(Jc(e),e.sort),n=Bo(t.map(i=>i.total)),r=t.map(i=>e.format(i.total)),o=n.ticks.map(e.format),a=(e.encoding.orientation==="horizontal"?Xc:Qc)(e,t,n,r,o);return{width:a.bands.width,height:a.bands.height,orientation:a.orientation,frame:a,rows:t.map((i,s)=>No(a,{...i,slot:s,text:r[s]},e.measure)),ticks:n.ticks.map((i,s)=>Fo(a,i,o[s]))}}function No(e,t,n){let{scale:r,bands:o}=e,a=yi(r),i=Math.abs(r.extent/(r.hi-r.lo)),s=t.values.reduce((V,x)=>V+x.value,0),c=s<0,d=a(0),l=a(s),u=o.start+t.slot*o.band,f={key:t.key,...t.values.length===1?{series:t.values[0].series}:{},radius:Uc,gap:Wc,segments:t.values.map(V=>({series:V.series,size:Math.max(0,c?-V.value:V.value)*i}))},h={key:t.key,datum:t.datum,index:t.index,slot:t.slot,values:t.values,total:s},w=(V,x)=>{let R=[];return V.text!==""&&R.push(an(V,n,"ec-label",Go)),x.text!==""&&R.push(an(x,n,"ec-value",fr)),R};if(e.orientation==="horizontal"){let V=u+o.band/2+Go*fi,x={x:r.label,y:V,anchor:"end",text:t.category},R={x:c?l-sn:l+sn,y:V,anchor:c?"end":"start",text:t.text},O=Ye.bar({...f,x:Math.min(d,l),y:u+(o.band-o.thickness)/2,width:Math.abs(l-d),height:o.thickness,baseline:c?"right":"left",labelBounds:w(x,R)});return{...h,geometry:O,data:li(t.datum,s,O),label:x,value:R,hit:{x:0,y:u,width:o.width,height:o.band}}}let v=u+o.band/2,D={x:v,y:r.label,anchor:"middle",text:t.category},F={x:v,y:c?l+sn+fr*.8:l-sn,anchor:"middle",text:t.text},P=Ye.bar({...f,x:v-o.thickness/2,y:Math.min(d,l),width:o.thickness,height:Math.abs(l-d),baseline:c?"top":"bottom",labelBounds:w(D,F)});return{...h,geometry:P,data:li(t.datum,s,P),label:D,value:F,hit:{x:u,y:0,width:o.band,height:o.height}}}function Fo(e,t,n){let{bands:r}=e,o=yi(e.scale)(t);if(e.orientation==="horizontal"){let a=r.start+r.span;return{value:t,line:{x1:o,y1:r.start,x2:o,y2:a},label:{x:o,y:a+16,anchor:"middle",text:n}}}return{value:t,line:{x1:r.start,y1:o,x2:r.start+r.span,y2:o},label:{x:r.start-8,y:o+Vo*fi,anchor:"end",text:n}}}function yi(e){let t=e.extent/(e.hi-e.lo);return n=>e.from+(n-e.lo)*t}function Jc({data:e,encoding:t}){let n=new Set;return e.map((r,o)=>{let a=String(t.key(r,o));if(n.has(a))throw new Error(`barChart: two rows have the key "${a}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(a);let i=t.series.map(({series:c,value:d})=>({series:c,value:el(d(r,o),c,a)}));if(i.some(c=>c.value>0)&&i.some(c=>c.value<0))throw new RangeError(`barChart: the stack for "${a}" mixes positive and negative values, which isn't supported yet.`);let s=i.reduce((c,d)=>c+d.value,0);return{key:a,category:String(t.category(r,o)??""),datum:r,index:o,values:i,total:s}})}function Yc(e,t){if(t===void 0||t==="none")return e;if(t==="value")return[...e].sort((n,r)=>r.total-n.total);if(t==="key")return[...e].sort((n,r)=>n.key.localeCompare(r.key,void 0,{numeric:!0}));if(typeof t=="function")return[...e].sort((n,r)=>t(n.datum,r.datum));throw new TypeError(`barChart: sort must be "value", "key", "none" or a comparator, got ${String(t)}.`)}function Bo(e){let t=e.reduce((i,s)=>Math.min(i,s),0),n=e.reduce((i,s)=>Math.max(i,s),0);t===n&&(n=1);let r=mr((n-t)/4);t=Ln(Math.floor(t/r)*r),n=Ln(Math.ceil(n/r)*r);let o=Math.round((n-t)/r),a=Array.from({length:o+1},(i,s)=>Ln(t+s*r));return{lo:t,hi:n,ticks:a}}function mr(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 Xc(e,t,n,r,o){let{width:a,measure:i}=e,s=t.length,c=Fr(t.map(v=>v.category),"ec-label",Go,i),d=Fr(r,"ec-value",fr,i),l=Fr(o,"ec-tick",Vo,i),u=n.lo<0?d+sn:0,f=Math.max(c+10+u,l/2+2),h=Math.max(d+sn+4,l/2+2),w=e.height===void 0||s===0?$o:Math.max(0,e.height-Nr-Io)/s;return{orientation:"horizontal",scale:{lo:n.lo,hi:n.hi,from:f,extent:Math.max(0,a-f-h),label:f-10-u},bands:{start:Nr,band:w,thickness:w*ui/$o,span:s*w,width:a,height:e.height??Nr+s*w+Io}}}function Qc(e,t,n,r,o){let{width:a,measure:i}=e,s=t.length,c=e.height??qc,d=Fr(o,"ec-tick",Vo,i),l=n.hi>0?fr+sn+2:Nr,u=Io+(n.lo<0?fr+sn:0),f=d+8+2,h={x:f,y:l,width:Math.max(0,a-f-8),height:Math.max(0,c-l-u)},w=s>0?h.width/s:0,v=h.y+h.height;return{orientation:"vertical",scale:{lo:n.lo,hi:n.hi,from:v,extent:-h.height,label:v+18},bands:{start:h.x,band:w,thickness:Math.min(w*ui/$o,Zc),span:h.width,width:a,height:c}}}function li(e,t,n){let r=a=>n.length>0?t*a/n.length:0,o={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related(a){let i=n.segments?.find(c=>c.series===a);if(!i)return;let s=Math.hypot(i.start.x-n.start.x,i.start.y-n.start.y);return{datum:e,samples:[{t:0,value:r(s)},{t:1,value:r(s+i.length)}],related:o.related}}};return o}function Fr(e,t,n,r){return e.reduce((o,a)=>Math.max(o,r(a,t,n)),0)}function Cn(e){return typeof e=="function"?e:t=>t[e]}function di(e,t){let n=!1;for(let r=0;r<e.length;r++){let o=t(e[r],r);if(o!=null){if(typeof o!="number")return!1;n=!0}}return n}function el(e,t,n){if(e==null)return 0;if(typeof e=="number"&&Number.isFinite(e))return e;throw new RangeError(`barChart: "${t}" for "${n}" must be a finite number, got ${typeof e=="string"?JSON.stringify(e):String(e)}.`)}function Ln(e){let t=Number(e.toPrecision(12));return t===0?0:t}var yr={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"]]}},hi=["surface","text","text-muted","grid","axis","focus","negative"],Te=Object.fromEntries(hi.map(e=>[e,yr.light[e]]));function at(e){let t=(Math.max(1,Math.floor(e))-1)%8+1,[n,r]=yr.light.series[t-1];return{color:`var(--ec-series-${t}, ${n})`,strong:`var(--ec-series-${t}-strong, ${r})`}}function it(e){if(e==="mark")return`var(--ec-mark, ${at(1).color})`;if(e==="mark-strong")return`var(--ec-mark-strong, ${at(1).strong})`;let t=Te[e];if(t!==void 0)return`var(--ec-${e}, ${t})`;let n=/^series-(\d+)(-strong)?$/.exec(e);if(n){let r=at(Number(n[1]));return n[2]?r.strong:r.color}return e}function ht(e){return{"--ec-mark":e?.color,"--ec-mark-strong":e?.strong}}function Ho(e,t){let r=[...hi,"ring","dim-opacity"].map(o=>`--ec-${o}: ${e[o]};`);return e.series.forEach(([o,a],i)=>r.push(`--ec-series-${i+1}: ${o};`,`--ec-series-${i+1}-strong: ${a};`)),r.map(o=>t+o).join(`
4
+ `)}var tl=`:where(:root, [data-theme="light"]) {
5
+ ${Ho(yr.light," ")}
4
6
  }
5
7
  @media (prefers-color-scheme: dark) {
6
8
  :where(:root:not([data-theme="light"])) {
7
- ${Po(sr.dark," ")}
9
+ ${Ho(yr.dark," ")}
8
10
  }
9
11
  }
10
12
  :where([data-theme="dark"]) {
11
- ${Po(sr.dark," ")}
12
- }`,Oc=`/* expressive-charts: theme tokens and default styles. Every rule has zero specificity, so your CSS wins. */
13
- ${Pc}
13
+ ${Ho(yr.dark," ")}
14
+ }`,nl=`/* expressive-charts: theme tokens and default styles. Every rule has zero specificity, so your CSS wins. */
15
+ ${tl}
14
16
  :where(.ec-chart) { display: block; max-width: 100%; height: auto; overflow: visible; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
15
17
  :where(.ec-chart text) { font-variant-numeric: tabular-nums; }
16
- :where(.ec-chart .ec-gridline) { stroke: var(--ec-grid, ${De.grid}); stroke-width: 1; }
17
- :where(.ec-chart .ec-baseline) { stroke: var(--ec-axis, ${De.axis}); stroke-width: 1; }
18
- :where(.ec-chart .ec-tick) { fill: var(--ec-text-muted, ${De["text-muted"]}); font-size: 11px; }
19
- :where(.ec-chart .ec-label) { fill: var(--ec-text, ${De.text}); font-size: 12.5px; }
20
- :where(.ec-chart .ec-value, .ec-chart .ec-text) { fill: var(--ec-text, ${De.text}); font-size: 12.5px; font-weight: 600; }
18
+ :where(.ec-chart .ec-gridline) { stroke: var(--ec-grid, ${Te.grid}); stroke-width: 1; }
19
+ :where(.ec-chart .ec-baseline) { stroke: var(--ec-axis, ${Te.axis}); stroke-width: 1; }
20
+ :where(.ec-chart .ec-tick) { fill: var(--ec-text-muted, ${Te["text-muted"]}); font-size: 11px; }
21
+ :where(.ec-chart .ec-label) { fill: var(--ec-text, ${Te.text}); font-size: 12.5px; }
22
+ :where(.ec-chart .ec-value, .ec-chart .ec-text) { fill: var(--ec-text, ${Te.text}); font-size: 12.5px; font-weight: 600; }
21
23
  :where(.ec-chart .ec-hit) { fill: transparent; }
22
24
  :where(.ec-chart .ec-mark:focus) { outline: none; }
23
25
  :where(.ec-chart .ec-focus) { pointer-events: none; }
24
- :where(.ec-chart .ec-focus-ring) { fill: none; stroke: var(--ec-focus, ${De.focus}); }
25
- :where(.ec-chart .ec-focus-gap) { fill: var(--ec-surface, ${De.surface}); stroke: var(--ec-surface, ${De.surface}); }
26
- :where(.ec-chart .ec-mark) { transition: opacity var(--ec-hover-duration, 100ms) ease-out; }
27
- :where(.ec-chart .ec-segment) { fill: var(--ec-mark); transition: fill var(--ec-hover-duration, 100ms) ease-out; }
26
+ :where(.ec-chart .ec-focus-ring) { fill: none; stroke: var(--ec-focus, ${Te.focus}); }
27
+ :where(.ec-chart .ec-focus-gap) { fill: var(--ec-surface, ${Te.surface}); stroke: var(--ec-surface, ${Te.surface}); }
28
+ :where(.ec-chart .ec-body > *) { transition: opacity var(--ec-hover-duration, 100ms) ease-out; }
29
+ :where(.ec-chart .ec-segment) { fill: var(--ec-mark); transition: fill var(--ec-hover-duration, 100ms) ease-out, opacity var(--ec-hover-duration, 100ms) ease-out; }
28
30
  :where(.ec-chart .ec-hot .ec-segment) { fill: var(--ec-mark-strong); }
29
- :where(.ec-chart .ec-stroke) { fill: none; stroke: var(--ec-mark); stroke-linejoin: round; transition: stroke var(--ec-hover-duration, 100ms) ease-out; }
31
+ :where(.ec-chart .ec-stroke) { fill: none; stroke: var(--ec-mark); stroke-linejoin: round; transition: stroke var(--ec-hover-duration, 100ms) ease-out, opacity var(--ec-hover-duration, 100ms) ease-out; }
30
32
  :where(.ec-chart .ec-hot .ec-stroke) { stroke: var(--ec-mark-strong); }
31
- :where(.ec-chart .ec-end) { fill: var(--ec-mark); stroke: var(--ec-surface, ${De.surface}); stroke-width: 2; }
32
- :where(.ec-chart .ec-dot) { fill: var(--ec-mark); stroke: var(--ec-surface, ${De.surface}); stroke-width: 2; opacity: 0; transition: opacity var(--ec-hover-duration, 100ms) ease-out, fill var(--ec-hover-duration, 100ms) ease-out; }
33
+ :where(.ec-chart .ec-end) { fill: var(--ec-mark); stroke: var(--ec-surface, ${Te.surface}); stroke-width: 2; }
34
+ :where(.ec-chart .ec-dot) { fill: var(--ec-mark); stroke: var(--ec-surface, ${Te.surface}); stroke-width: 2; opacity: 0; transition: opacity var(--ec-hover-duration, 100ms) ease-out, fill var(--ec-hover-duration, 100ms) ease-out; }
33
35
  :where(.ec-chart .ec-hot .ec-dot) { fill: var(--ec-mark-strong); opacity: 1; }
34
- :where(.ec-chart .ec-crosshair) { stroke: var(--ec-axis, ${De.axis}); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
36
+ :where(.ec-chart .ec-crosshair) { stroke: var(--ec-axis, ${Te.axis}); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
35
37
  :where(.ec-chart .ec-column:focus) { outline: none; }
36
38
  :where(.ec-chart .ec-lines, .ec-chart .ec-points) { pointer-events: none; }
37
- :where(.ec-chart .ec-slice) { fill: var(--ec-mark); stroke: var(--ec-surface, ${De.surface}); stroke-width: 2; stroke-linejoin: round; transition: fill var(--ec-hover-duration, 100ms) ease-out; }
39
+ :where(.ec-chart .ec-slice) { fill: var(--ec-mark); stroke: var(--ec-surface, ${Te.surface}); stroke-width: 2; stroke-linejoin: round; transition: fill var(--ec-hover-duration, 100ms) ease-out, opacity var(--ec-hover-duration, 100ms) ease-out; }
38
40
  :where(.ec-chart .ec-hot .ec-slice) { fill: var(--ec-mark-strong); }
39
- :where(.ec-chart .ec-center-value) { fill: var(--ec-text, ${De.text}); font-size: 26px; font-weight: 600; }
40
- :where(.ec-chart .ec-center-label) { fill: var(--ec-text-muted, ${De["text-muted"]}); font-size: 12.5px; }
41
- :where(.ec-chart.ec-hovering .ec-mark:not(.ec-hot)) { opacity: var(--ec-dim-opacity, 0.3); }
41
+ :where(.ec-chart .ec-center-value) { fill: var(--ec-text, ${Te.text}); font-size: 26px; font-weight: 600; }
42
+ :where(.ec-chart .ec-center-label) { fill: var(--ec-text-muted, ${Te["text-muted"]}); font-size: 12.5px; }
43
+ :where(.ec-chart.ec-hovering .ec-mark:not(.ec-hot) > .ec-body > *) { opacity: var(--ec-dim-opacity, 0.3); }
42
44
  :where(.ec-chart.ec-morphing .ec-marks) { visibility: hidden; }
43
45
  :where(.ec-switch) { display: grid; grid-template-columns: minmax(0, 1fr); position: relative; }
44
46
  :where(.ec-switch-view) { grid-area: 1 / 1; min-width: 0; }
45
47
  :where(.ec-switch-view.ec-switch-inactive) { visibility: hidden; }
46
48
  :where(.ec-switch-view.ec-switching .ec-focus, .ec-switch-view.ec-switching .ec-overlay, .ec-switch-view.ec-switching .ec-columns) { visibility: hidden; }
47
49
  :where(.ec-switch-overlay) { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
48
- :where(.ec-motion-switch) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--ec-text, ${De.text}); font-size: 13px; }
50
+ :where(.ec-motion-switch) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--ec-text, ${Te.text}); font-size: 13px; }
49
51
  :where(.ec-motion-label) { font-weight: 600; }
50
- :where(.ec-motion-modes) { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--ec-ring, color-mix(in srgb, currentColor 12%, transparent)); border-radius: 8px; background: var(--ec-surface, ${De.surface}); }
52
+ :where(.ec-motion-modes) { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--ec-ring, color-mix(in srgb, currentColor 12%, transparent)); border-radius: 8px; background: var(--ec-surface, ${Te.surface}); }
51
53
  :where(.ec-motion-modes button) { font: inherit; color: inherit; border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
52
- :where(.ec-motion-modes button:hover, .ec-motion-modes button[aria-pressed="true"]) { background: color-mix(in srgb, var(--ec-focus, ${De.focus}) 12%, transparent); }
54
+ :where(.ec-motion-modes button:hover, .ec-motion-modes button[aria-pressed="true"]) { background: color-mix(in srgb, var(--ec-focus, ${Te.focus}) 12%, transparent); }
53
55
  :where(.ec-motion-modes button[aria-pressed="true"]) { font-weight: 600; }
54
- :where(.ec-motion-modes button:focus-visible) { outline: 2px solid var(--ec-focus, ${De.focus}); outline-offset: 2px; }
56
+ :where(.ec-motion-modes button:focus-visible) { outline: 2px solid var(--ec-focus, ${Te.focus}); outline-offset: 2px; }
55
57
  @media (forced-colors: active) {
56
58
  /* Forced colours drop the pressed mode's tint, which leaves only its weight: it takes the viewer's selection colours. */
57
59
  :where(.ec-motion-modes button[aria-pressed="true"]) { background: Highlight; color: HighlightText; }
58
60
  }
59
- :where(.ec-motion-hint) { flex: 1 1 220px; min-width: 0; color: var(--ec-text-muted, ${De["text-muted"]}); }
60
- :where(.ec-play) { font: inherit; font-size: 13px; font-weight: 600; color: var(--ec-text, ${De.text}); border: 1px solid var(--ec-ring, color-mix(in srgb, currentColor 12%, transparent)); background: var(--ec-surface, ${De.surface}); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
61
- :where(.ec-play:hover) { background: color-mix(in srgb, var(--ec-focus, ${De.focus}) 12%, var(--ec-surface, ${De.surface})); }
62
- :where(.ec-play:focus-visible) { outline: 2px solid var(--ec-focus, ${De.focus}); outline-offset: 2px; }
61
+ :where(.ec-motion-hint) { flex: 1 1 220px; min-width: 0; color: var(--ec-text-muted, ${Te["text-muted"]}); }
62
+ :where(.ec-play) { font: inherit; font-size: 13px; font-weight: 600; color: var(--ec-text, ${Te.text}); border: 1px solid var(--ec-ring, color-mix(in srgb, currentColor 12%, transparent)); background: var(--ec-surface, ${Te.surface}); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
63
+ :where(.ec-play:hover) { background: color-mix(in srgb, var(--ec-focus, ${Te.focus}) 12%, var(--ec-surface, ${Te.surface})); }
64
+ :where(.ec-play:focus-visible) { outline: 2px solid var(--ec-focus, ${Te.focus}); outline-offset: 2px; }
63
65
  :where(.ec-chart .ec-leaving, .ec-chart .ec-overlay) { pointer-events: none; }
64
66
  :where(.ec-attached.ec-dimmed) { opacity: var(--ec-dim-opacity, 0.3); }
65
67
  :where(.ec-attached) { transition: opacity var(--ec-hover-duration, 100ms) ease-out, fill var(--ec-hover-duration, 100ms) ease-out, stroke var(--ec-hover-duration, 100ms) ease-out; }
66
68
  :where(.ec-tooltip-layer) { position: relative; height: 0; }
67
- :where(.ec-tooltip) { position: absolute; left: 0; top: 0; z-index: 3; box-sizing: border-box; width: max-content; max-width: 24em; padding: 8px 10px; border: 1px solid var(--ec-ring, color-mix(in srgb, currentColor 12%, transparent)); border-radius: 8px; background: var(--ec-surface, ${De.surface}); color: var(--ec-text, ${De.text}); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); font-size: 13px; line-height: 1.35; white-space: pre-line; font-variant-numeric: tabular-nums; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity var(--ec-hover-duration, 100ms) ease-out, visibility 0s linear var(--ec-hover-duration, 100ms); }
69
+ :where(.ec-tooltip) { position: absolute; left: 0; top: 0; z-index: 3; box-sizing: border-box; width: max-content; max-width: 24em; padding: 8px 10px; border: 1px solid var(--ec-ring, color-mix(in srgb, currentColor 12%, transparent)); border-radius: 8px; background: var(--ec-surface, ${Te.surface}); color: var(--ec-text, ${Te.text}); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); font-size: 13px; line-height: 1.35; white-space: pre-line; font-variant-numeric: tabular-nums; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity var(--ec-hover-duration, 100ms) ease-out, visibility 0s linear var(--ec-hover-duration, 100ms); }
68
70
  :where(.ec-tooltip.ec-tooltip-shown) { opacity: 1; visibility: visible; transition: opacity var(--ec-hover-duration, 100ms) ease-out; }
69
71
  :where(.ec-tooltip-title) { font-weight: 600; }
70
- :where(.ec-legend) { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; font-size: 13px; line-height: 1.4; color: var(--ec-text, ${De.text}); }
72
+ :where(.ec-legend) { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; font-size: 13px; line-height: 1.4; color: var(--ec-text, ${Te.text}); }
71
73
  :where(.ec-legend-item) { display: inline-flex; align-items: center; gap: 6px; }
72
74
  :where(.ec-legend-swatch) { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--ec-mark); forced-color-adjust: none; }
73
- :where(.ec-table) { margin-top: 8px; font-size: 13px; line-height: 1.4; color: var(--ec-text, ${De.text}); }
74
- :where(.ec-table summary) { cursor: pointer; color: var(--ec-text-muted, ${De["text-muted"]}); font-weight: 600; }
75
- :where(.ec-table summary:focus-visible) { outline: 2px solid var(--ec-focus, ${De.focus}); outline-offset: 2px; border-radius: 2px; }
75
+ :where(.ec-table) { margin-top: 8px; font-size: 13px; line-height: 1.4; color: var(--ec-text, ${Te.text}); }
76
+ :where(.ec-table summary) { cursor: pointer; color: var(--ec-text-muted, ${Te["text-muted"]}); font-weight: 600; }
77
+ :where(.ec-table summary:focus-visible) { outline: 2px solid var(--ec-focus, ${Te.focus}); outline-offset: 2px; border-radius: 2px; }
76
78
  :where(.ec-table-scroll) { overflow-x: auto; margin-top: 8px; }
77
79
  :where(.ec-table table) { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
78
- :where(.ec-table th, .ec-table td) { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--ec-grid, ${De.grid}); font-weight: 400; }
79
- :where(.ec-table thead th) { color: var(--ec-text-muted, ${De["text-muted"]}); font-size: 12px; font-weight: 600; }
80
+ :where(.ec-table th, .ec-table td) { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--ec-grid, ${Te.grid}); font-weight: 400; }
81
+ :where(.ec-table thead th) { color: var(--ec-text-muted, ${Te["text-muted"]}); font-size: 12px; font-weight: 600; }
80
82
  :where(.ec-table .ec-num) { text-align: right; }
81
83
  :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; }
82
- `,Qa="data-expressive-charts";var un={};function lt(e){if(un.injectStyles===!1||e.querySelector(`style[${Qa}]`))return;let t=e.createElement("style");t.setAttribute(Qa,""),un.nonce&&t.setAttribute("nonce",un.nonce),t.textContent=Oc,(e.head??e.documentElement).appendChild(t)}function Gr(e={}){let t=new Map;for(let[n,r]of Object.entries(e)){if(!Number.isInteger(r)||r<1||r>8)throw new RangeError(`colorAssignment: the slot for "${n}" must be a whole number from 1 to ${8}, got ${String(r)}.`);t.set(n,r)}return{slot(n){let r=t.get(n);if(r===void 0){let o=new Set(t.values());for(r=1;o.has(r)&&r<=8;)r++;r>8&&(r=t.size%8+1),t.set(n,r)}return r}}}function Rt(e){return e&&typeof e.slot=="function"?e:Gr(e)}function ni(e,t){if(e===void 0||typeof e=="boolean")return;let n=o=>{throw new TypeError(`${t}: ${o}`)};(typeof e!="object"||e===null||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((o,a)=>{let{label:i,color:s}=typeof o=="object"&&o!==null?o:n(`legend.entries[${a}] must be an object with a label and a color.`);(typeof i!="string"||i.trim()==="")&&n(`legend.entries[${a}].label must be a non-empty string: the entry's name.`),(typeof s!="string"||s.trim()==="")&&n(`legend.entries[${a}].color must be a theme token or a CSS colour.`),(s==="mark"||s==="mark-strong")&&n(`legend.entries[${a}].color can't be "${s}": an entry has no mark. Use a theme token or a CSS colour.`)}))}var ti=e=>typeof e=="object"?e.entries??[]:[];function En(e){let t,n="",r=()=>{t?.remove(),t=void 0,n=""},o=(a,i,s,c)=>{let d=[...a.map(({key:m,label:p})=>({key:m,label:p,styles:ct(Xe(i.slot(m)))})),...c.map(({label:m,color:p})=>({key:void 0,label:m,styles:{"--ec-mark":Qe(p)}}))],l=e.ownerDocument;t??(t=Object.assign(l.createElement("div"),{className:"ec-legend"})),t.nextSibling!==e&&e.before(t);let u=JSON.stringify([s,d]);u!==n&&(n=u,t.replaceChildren(...d.map(({key:m,label:p,styles:k})=>{let h=l.createElement("span");h.className="ec-legend-item",m!==void 0&&h.setAttribute(s,m);for(let[G,H]of Object.entries(k))H!==void 0&&h.style.setProperty(G,H);let T=l.createElement("span");T.className="ec-legend-swatch";let V=l.createElement("span");return V.className="ec-legend-label",V.textContent=p,h.append(T,V),h})))};return{update(a,i,s){let c=ti(s);s===!1||a.length+c.length<2?r():o(a.map(({series:d,label:l})=>({key:d,label:l})),i,"data-series",c)},categories(a,i,s){s===!1||a.length===0?r():o(a,i,"data-key",ti(s))},destroy:r}}var ri=["presentation","analysis","off"];function en(e,t){if(e===void 0)return t;if(typeof e!="string")return e;if(!ri.includes(e))throw new TypeError(`Unknown motion mode "${String(e)}". Use one of: ${ri.join(", ")}.`);let n=()=>t.viewerChoice??(t.prefersReduced?"off":e);return{get mode(){return n()},get staged(){return n()==="presentation"},duration(r,o="transition"){let a=n();return a==="off"?0:Qn(r,Xn[a][o])},subscribe:r=>t.subscribe(r)}}var Ac="http://www.w3.org/2000/svg";function Y(e,t={},n){let o=(n?.ownerDocument??document).createElementNS(Ac,e);return ie(o,t),n?.appendChild(o),o}function ie(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.removeAttribute(n):e.setAttribute(n,typeof r=="number"?_e(r):r)}function Ae(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.style.removeProperty(n):e.style.setProperty(n,r)}function Ct({width:e,height:t}){return{width:e,height:t,viewBox:`0 0 ${_e(e)} ${_e(t)}`}}function dt(e){let[t,n,r,o,a,i]=e;return`matrix(${[t,n,r,o].map($c).join(" ")} ${_e(a)} ${_e(i)})`}function $c(e){let t=Math.round(e*1e6)/1e6;return t===0?"0":String(t)}var oi=2,Gc=2,ai=new WeakMap,Ic=0;function Ir(e){let t=e.ownerDocument,n=(ai.get(t)??0)+1;ai.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 o=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 Ae(a,{fill:"none",stroke:Qe("focus")}),{draw(i){if(!i){ie(a,{visibility:"hidden"});return}let{outline:s,thickness:c,transform:d}=i,l=s.closed?0:c;ie(o,{d:s.d,fill:s.closed?"black":"none","stroke-width":l+2*oi}),ie(a,{d:s.d,"stroke-width":l+2*(oi+Gc),transform:d&&dt(d),visibility:void 0})}}}function Vr(){let e,t=()=>{e?.remove(),e=void 0};return{paint(n,r,o,a){if(!o||!n||r.length===0){t();return}(!e||e.parentNode!==n)&&(e?.remove(),e=Y("g",{class:"ec-halo"},n)),e.textContent="";let i=`ec-halo-mask-${++Ic}`,s=Y("mask",{id:i,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 c of r){let d=c.stroke===void 0?{fill:"black"}:{fill:"none",stroke:"black","stroke-width":c.stroke,"stroke-linejoin":"round"};Y("path",{d:c.d,...d},s)}ie(e,{transform:a&&dt(a)});for(let c of r){let d=c.stroke!==void 0,l=Y("path",{d:c.d,"stroke-width":o.width+(c.stroke??0),"stroke-opacity":o.opacity,"stroke-linejoin":"round","stroke-linecap":d?"round":void 0,mask:`url(#${i})`},e);Ae(l,{fill:"none",stroke:o.color===void 0?c.color??Qe("mark"):Qe(o.color)})}},remove:t}}function fn(e,t={}){let n={},r,o=t.halos&&Vr(),a=()=>{let s=e();if(!s)return;let{body:c,parts:d}=s;ie(c,{transform:n.transform&&dt(n.transform),opacity:n.opacity});let l=n.emphasis;for(let u of d)Ae(u.element,{[u.open?"stroke":"fill"]:l===void 0?void 0:Vc(u.colors,l),transition:l===void 0?void 0:"none"});i(c,d)},i=(s,c)=>{let d=n.halo;if(o){let u=c.flatMap(m=>m.visible?[{d:m.d,color:m.colors.color,...m.open?{stroke:m.open.width}:{}}]:[]);o.paint(t.halos?.(),u,d,n.transform);return}if(!d){r?.remove(),r=void 0;return}(!r||r.parentNode!==s)&&(r?.remove(),r=Y("g",{class:"ec-halo"},s),s.insertBefore(r,s.firstChild));let l=c.filter(u=>u.visible);for(;r.childElementCount>l.length;)r.lastElementChild?.remove();l.forEach((u,m)=>{let p=r.children[m]??Y("path",{"stroke-linejoin":"round"},r);ie(p,{d:u.d,"stroke-width":d.width+(u.open?.width??0),"stroke-opacity":d.opacity,"stroke-linecap":u.open?"round":void 0}),Ae(p,{fill:"none",stroke:d.color===void 0?u.colors.color:Qe(d.color)})})};return{get style(){return n},set(s){n=Wt(n,s),a()},reset(){n={},a()},repaint:a}}function Vc(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})`}var Nc=0;function cr(e){return{icon(t,n){let r=n?.size;if(r!==void 0&&!(r>=0))throw new RangeError(`layer.icon: size must be a non-negative number, got ${String(r)}.`);let o=Y("g",{class:"ec-icon","data-icon":t.name,visibility:"hidden"},e),a=r===void 0||!(t.size>0)?1:r/t.size,i=a===1?o:Y("g",{transform:dt(ve.scale(a,a,t.anchor))},o);for(let c of t.shapes)Fc(c,i);return{place(c){ie(o,{transform:dt(c),visibility:void 0})},remove:()=>o.remove()}},path(t,n){let r=Y("path",{class:"ec-path",d:t},e),o={...n};return ii(r,o),{update(i,s){r.setAttribute("d",i),s&&(o=Wt(o,s),ii(r,o))},remove:()=>r.remove()}},text(t,n){let r=Y("text",{class:"ec-text"},e);r.textContent=t;let o={...n};return si(r,o),{update(i,s){o=Wt(o,i),si(r,o),s!==void 0&&(r.textContent=s)},remove:()=>r.remove()}}}}function Fc(e,t){let n;if(e.clip!==void 0){n=`ec-clip-${++Nc}`;let o=Y("clipPath",{id:n},t);Y("path",{d:e.clip},o)}let r=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},t);Ae(r,{fill:e.fill===void 0?"none":Qe(e.fill),stroke:e.stroke===void 0?void 0:Qe(e.stroke)})}function ii(e,t){ie(e,{"stroke-width":t.stroke===void 0?void 0:t.width??1,opacity:t.opacity,"stroke-linecap":t.linecap,"stroke-linejoin":"round"}),Ae(e,{fill:t.fill===void 0?"none":Qe(t.fill),stroke:t.stroke===void 0?void 0:Qe(t.stroke)})}function si(e,t){ie(e,{x:t.at.x,y:t.at.y,"text-anchor":t.anchor??"start",opacity:t.opacity}),Ae(e,{fill:Qe(t.color??"text")})}function tn(e){let{overlay:t}=e,n=new WeakMap,r=new Map,o=new Set;return{group(a,i,s){let c=Y("g",{class:"ec-run","data-key":a,"data-slot":i,visibility:o.has(a)?"hidden":void 0},t);Ae(c,ct(e.colors(a))),n.set(c,s);let d=Array.from(t.children).find(m=>(n.get(m)??-1/0)>s);t.insertBefore(c,d??null);let l=r.get(a);l||r.set(a,l=new Set),l.add(c);let u=l;return{...cr(c),clear(){c.remove(),u.delete(c),u.size===0&&r.get(a)===u&&r.delete(a)}}},mark:a=>e.mark(a),recolor(a){let i=r.get(a);if(!i)return;let s=ct(e.colors(a));for(let c of i)Ae(c,s)},hide(a,i){i?o.add(a):o.delete(a);for(let s of r.get(a)??[])ie(s,{visibility:i?"hidden":void 0})}}}function wt(e,t){ie(e,{x:t.x,y:t.y,"text-anchor":t.anchor}),e.textContent!==t.text&&(e.textContent=t.text)}var Bc=.6;function Dn(e){let t=new Map;return Object.assign((r,o,a)=>{if(r==="")return 0;let i=`${o}
83
- ${a}
84
- ${r}`,s=t.get(i);if(s!==void 0)return s;let c=0,d=Y("text",{class:o,visibility:"hidden","aria-hidden":"true"},e);return typeof d.getComputedTextLength=="function"&&e.isConnected&&(d.textContent=r,c=d.getComputedTextLength()),d.remove(),c>0?(t.set(i,c),c):r.length*a*Bc},{clear:()=>t.clear()})}function Je(e,t){return e!==void 0&&Object.prototype.hasOwnProperty.call(e,t)?e[t]??t:t}function ci(e,t){if(e!==void 0){if(typeof e!="object"||e===null||Array.isArray(e))throw new 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 new TypeError(`${t}: seriesLabels.${n} must be a name, not ${typeof r=="string"?"blank":String(r)}.`)}}function Tn(e){let t={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set};function n(r,o){for(let a of[...t[r]])try{a(o)}catch(i){Se(i)}}return{emit:n,emitEach(r,o,a){o.forEach((i,s)=>n(r,{...a(i),batch:{index:s,count:o.length}}))},on(r,o){let a=t[r];if(!a)throw new TypeError(`${e}: unknown event "${String(r)}". Use one of: ${Object.keys(t).join(", ")}.`);return a.add(o),()=>{a.delete(o)}},clear(){for(let r of Object.values(t))r.clear()}}}function Ke(e){return e.format??Hc}var Oo;function Hc(e){return Oo??(Oo=new Intl.NumberFormat(void 0,{maximumFractionDigits:2})),Oo.format(e)}function Bt(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 mn(e,t){let n=10**t,r=Math.round(e*n)/n;return r===0?0:r}function yn(e){return`${mn(e*100,0)}%`}function Nr(e,t){let n=e.ownerDocument,r,o="mouse",a=(m,p)=>{m?.key!==r&&(i(),m&&(r=m.key,t.hover(m,p)))},i=()=>{r!==void 0&&(r=void 0,t.leave())},s=m=>{m.pointerType!=="touch"&&a(t.find(m.target),"pointer")},c=m=>{m.pointerType!=="touch"&&i()},d=m=>{o=m.pointerType},l=m=>{o==="touch"&&a(t.find(m.target),"touch")},u=m=>{r!==void 0&&m.pointerType==="touch"&&!e.contains(m.target)&&i()};return e.addEventListener("pointerover",s),e.addEventListener("pointerleave",c),e.addEventListener("pointerdown",d),e.addEventListener("click",l),n.addEventListener("pointerdown",u,!0),{get current(){return r},clear:i,destroy(){r=void 0,e.removeEventListener("pointerover",s),e.removeEventListener("pointerleave",c),e.removeEventListener("pointerdown",d),e.removeEventListener("click",l),n.removeEventListener("pointerdown",u,!0)}}}function Fr(e,t){let n,r,o,a,i,s=[],c=!0,d=t.tabIndex??((b,M)=>{let E=t.element(b);M===void 0?E?.removeAttribute("tabindex"):E?.setAttribute("tabindex",M)}),l=b=>{for(let M of b)d(M,M===i?"0":"-1")},u=b=>{i=b,l(t.order()),t.element(b)?.focus()},m=()=>{let b=r;r=void 0,b!==void 0&&t.blur(b)},p=b=>{!b.metaKey&&!b.altKey&&!b.ctrlKey&&(c=!0)},k=()=>{c=!1,a=void 0},h=b=>{a=void 0;let M=t.find(b.target);if(M===void 0){m();return}let E=t.element(M);E&&E!==b.target&&b.target.getAttribute("aria-hidden")==="true"&&(E.focus(),n?.scope.activeElement===E)||(o={key:M,element:b.target},M!==r&&(r=M,i=M,l(t.order()),t.focus(M,c)))},T=b=>{let M=o?.element;r===void 0||!M||b.target!==M||t.find(b.relatedTarget)===void 0&&(m(),b.relatedTarget===null&&(a=M,queueMicrotask(()=>{a===M&&M.isConnected&&(a=void 0)})))},V=b=>{let M=t.find(b.target);if(M===void 0||b.altKey||b.ctrlKey||b.metaKey)return;let E=t.order(),P=E.indexOf(M),L;switch(b.key){case"ArrowDown":case"ArrowRight":L=E[Math.min(E.length-1,P+1)];break;case"ArrowUp":case"ArrowLeft":L=E[Math.max(0,P-1)];break;case"Home":L=E[0];break;case"End":L=E[E.length-1];break;case"Escape":t.escape(M)&&b.preventDefault();return;default:return}b.preventDefault(),L!==void 0&&L!==M&&u(L)},G=()=>{n&&(n.doc.removeEventListener("keydown",p,!0),n.doc.removeEventListener("pointerdown",k,!0),n.scope.removeEventListener("focusin",h,!0),n.scope.removeEventListener("focusout",T,!0),n.svg.removeEventListener("keydown",V),n=void 0)},H=()=>{let b=e(),M=b?.getRootNode(),E=M&&"host"in M?M:b?.ownerDocument;b===n?.svg&&E===n?.scope||(G(),!(!b||!E)&&(n={svg:b,doc:b.ownerDocument,scope:E},n.doc.addEventListener("keydown",p,!0),n.doc.addEventListener("pointerdown",k,!0),n.scope.addEventListener("focusin",h,!0),n.scope.addEventListener("focusout",T,!0),n.svg.addEventListener("keydown",V)))};return H(),{active:()=>n?.scope.activeElement??null,focus(b){c=!0,b===r&&o?.element===n?.scope.activeElement?t.focus(b,!0):u(b)},sync(){H();let b=t.order(),M=new Set(b),E=s.filter(K=>!M.has(K));(i===void 0||!M.has(i))&&(i=jc(s,i,M)??b[0]);let P=!n?.doc.activeElement||n.doc.activeElement===n.doc.body,L=o!==void 0&&!o.element.isConnected&&(r!==void 0||o.element===a&&P),D=o&&(o.element===n?.scope.activeElement||L)?o:void 0;a=void 0,D&&!M.has(D.key)?i!==void 0?u(i):D.element.isConnected?D.element.blur():m():D&&t.find(D.element)!==D.key&&u(D.key),l(b);for(let K of E)d(K,void 0);s=b},destroy(){r=void 0,o=void 0,a=void 0,G()}}}function jc(e,t,n){let r=t===void 0?-1:e.indexOf(t);if(!(r<0))for(let o=1;o<e.length;o++)for(let a of[r+o,r-o]){let i=e[a];if(i!==void 0&&n.has(i))return i}}function Rn(e){let{svg:t,runner:n,events:r}=e,o=b=>e.marks?.(b)??[b],a=b=>(e.markElement??e.element)(b),i,s,c=b=>b.flatMap(M=>{let E=e.onScreen(M);return E?[{key:M,input:E}]:[]});function d(b,M,E){if(b.length===0)return;n.hover(b.map(({input:L})=>L));let P=b.length;b.forEach(({input:L},D)=>r.emit("hover",{...L,batch:{index:D,count:P},source:M,...E===void 0?{}:{segment:E}}))}function l(b){let M=c(b);if(M.length===0)return;for(let{key:P}of M)a(P)?.classList.remove("ec-hot");n.leave(M.map(({key:P})=>P));let E=M.length;M.forEach(({input:P},L)=>r.emit("leave",{...P,batch:{index:L,count:E}}))}function u(b,M,E){let P=c(o(b));i={key:b,source:M,marks:P.map(L=>L.key)};for(let{key:L}of P)a(L)?.classList.add("ec-hot");e.dim()&&t.classList.add("ec-hovering"),e.tooltip.show(b),h(!0),d(P,M,E)}function m(){let b=i?.marks??[];i=void 0,h(!1),t.classList.remove("ec-hovering"),e.tooltip.hide(),l(b)}let p,k=b=>{b.key==="Escape"&&!b.defaultPrevented&&i!==void 0&&T()};function h(b){p?.removeEventListener("keydown",k),p=b?t.ownerDocument:void 0,p?.addEventListener("keydown",k)}function T(){G.clear(),i!==void 0&&m()}let V=(b,M)=>M===b||e.live(b)&&o(b).includes(M),G=Nr(t,{find:e.find,hover(b,M){!e.live(b.key)||i?.key===b.key||(m(),u(b.key,M,b.segment))},leave(){i?.source!=="keyboard"&&m()}}),H=Fr(()=>t,{find:b=>e.find(b)?.key,order:e.order,element:e.element,focus(b,M){if(s=M?b:void 0,e.ring(s),!!e.live(b)){if(!M){i?.source==="keyboard"&&i.key!==b&&m();return}if(i?.key===b){i={...i,source:"keyboard"};return}m(),u(b,"keyboard")}},blur(){s=void 0,e.ring(s),i?.source==="keyboard"&&(G.current===i.key?i={...i,source:"pointer"}:m())},escape(){return i?(m(),!0):!1}});return{get key(){return i?.key},get ringKey(){return s},active:()=>H.active(),restyled(b){s!==void 0&&V(s,b)&&e.ring(s),i!==void 0&&(i.marks.includes(b)||b===i.key)&&e.live(i.key)&&e.tooltip.show(i.key)},syncDim(){e.dim()?i!==void 0&&t.classList.add("ec-hovering"):t.classList.remove("ec-hovering")},dropGone(){if(i===void 0)return;if(!e.live(i.key)){G.clear(),m();return}let{source:b,marks:M}=i,E=c(o(i.key));if(E.length===M.length&&E.every((x,C)=>x.key===M[C]))return;let P=new Set(M),L=new Set(E.map(x=>x.key)),D=c(M.filter(x=>!L.has(x)));i={...i,marks:E.map(x=>x.key)};for(let{key:x}of D)a(x)?.classList.remove("ec-hot");for(let{key:x}of E)P.has(x)||a(x)?.classList.add("ec-hot");n.leave(M),n.hover(E.map(({input:x})=>x)),D.forEach(({input:x},C)=>r.emit("leave",{...x,batch:{index:C,count:D.length}}));let K=E.length;E.forEach(({key:x,input:C},B)=>{P.has(x)||r.emit("hover",{...C,batch:{index:B,count:K},source:b})})},sync:()=>H.sync(),focus(b){e.live(b)&&H.focus(b)},leave:T,destroy(){h(!1),G.destroy(),H.destroy()}}}function nn(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 Cn(e){let t=new Map;return{get:n=>t.get(n),values:()=>t.values(),start(n){t.set(n.key,n),n.group.classList.add("ec-leaving"),n.group.setAttribute("aria-hidden","true"),n.leave=zc()},recall(n){let r=t.get(n);if(r)return t.delete(n),r.group.classList.remove("ec-leaving"),r.group.removeAttribute("aria-hidden"),r.leave?.resolve(),r.leave=void 0,r},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 zc(){let e;return{exited:!1,gone:new Promise(n=>{e=n}),resolve:e}}function pn(e,t,n,r){if(!n.some((s,c)=>t[c]!==s))return;let o=r(),a=n.findIndex(s=>s===o),i=n[a]??null;n.forEach((s,c)=>{c<a?e.insertBefore(s,i):c>a&&e.appendChild(s)})}function di(e,t){if(e===void 0||typeof e=="boolean"||e==="hidden")return;let n=l=>{throw new TypeError(`${t}: ${l}`)};(typeof e!="object"||e===null)&&n('table must be true, false, "hidden" or an object of table options.');let{hidden:r,columns:o,category:a,total:i,share:s,summary:c,series:d}=e;r!==void 0&&typeof r!="boolean"&&n("table.hidden must be true or false.");for(let[l,u]of Object.entries({category:a,total:i,share:s,summary:c}))u!==void 0&&typeof u!="string"&&n(`table.${l} must be a string.`);if(d!==void 0){(typeof d!="object"||d===null||Array.isArray(d))&&n('table.series must be an object of headers by series, as { shots: "Shots" }.');for(let[l,u]of Object.entries(d))typeof u!="string"&&n(`table.series.${l} must be a string: the column's header.`)}o!==void 0&&(Array.isArray(o)||n("table.columns must be an array of { label, field }."),o.forEach((l,u)=>{let m=typeof l=="object"&&l!==null?l:n(`table.columns[${u}] must be an object with a label and a field.`);typeof m.label!="string"&&n(`table.columns[${u}].label must be a string: the column's header.`),typeof m.field!="string"&&typeof m.field!="function"&&n(`table.columns[${u}].field must be a field name or a function of the row.`),m.format!==void 0&&typeof m.format!="function"&&n(`table.columns[${u}].format must be a function.`),m.after!==void 0&&m.after!=="category"&&m.after!=="values"&&n(`table.columns[${u}].after must be "category" or "values".`)}))}function Ln(e){let{option:t,format:n}=e;if(t===!1)return;let r=typeof t=="object"?t:{},o=r.columns??[],a=o.filter(b=>b.after!=="values"),i=o.filter(b=>b.after==="values"),s=e.total??e.series.length>1,c=b=>({text:n(b),numeric:!0}),d=e.rows.reduce((b,M)=>b+M.total,0),l=b=>e.shares?[{text:yn(d>0?b/d:0),numeric:!0}]:[],u=b=>({text:b.label,numeric:!1}),m=b=>r.series&&Object.prototype.hasOwnProperty.call(r.series,b)?r.series[b]:void 0,p=()=>({text:"",numeric:!1}),k=[{text:r.category??e.category??"Category",numeric:!1},...a.map(u),...e.series.map(b=>({text:m(b)??e.label?.(b)??b,numeric:!0})),...s?[{text:r.total??"Total",numeric:!0}]:[],...e.shares?[{text:r.share??"Share",numeric:!0}]:[],...i.map(u)],h=e.rows.map(b=>{let M=new Map(b.values.map(E=>[E.series,E.value]));return{key:b.key,cells:[{text:b.category,numeric:!1},...a.map(E=>li(E,b,n)),...e.series.map(E=>c(M.get(E)??0)),...s?[c(b.total)]:[],...l(b.total),...i.map(E=>li(E,b,n))]}}),T=b=>e.rows.reduce((M,E)=>M+(E.values.find(P=>P.series===b)?.value??0),0),V=e.shares?[{text:r.total??"Total",numeric:!1},...a.map(p),...e.series.map(b=>c(T(b))),...s?[c(d)]:[],...l(d),...i.map(p)]:void 0,G=k.length-i.length,H=[...a.map((b,M)=>1+M),...i.map((b,M)=>G+M)];for(let b of H){let M=h.map(E=>E.cells[b]).filter(E=>E.text!=="");M.length>0&&M.every(E=>E.numeric)&&(k[b]={...k[b],numeric:!0})}return{hidden:t==="hidden"||r.hidden===!0,summary:r.summary??"Data table",caption:e.caption,headers:k,rows:h,...V?{footer:V}:{}}}function li(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 Pn(e){let t=e.ownerDocument,n,r,o,a,i,s,c,d=new Map,l="",u=(T,V)=>{let G=t.createElement(T);return V&&(G.className=V),G};function m(){o=u("table"),a=u("caption","ec-table-caption");let T=u("thead");return i=u("tr"),T.appendChild(i),s=u("tbody"),o.append(a,T,s),o}function p(T,V){let G=T?"DIV":"DETAILS";if(n?.tagName!==G){let H=T?u("div","ec-table ec-visually-hidden"):u("details","ec-table"),b=o??m();if(T)r=void 0,H.appendChild(b);else{r=u("summary");let M=u("div","ec-table-scroll");M.appendChild(b),H.append(r,M)}n?.isConnected&&n.replaceWith(H),n=H}n.isConnected||e.after(n),r&&r.textContent!==V&&(r.textContent=V)}function k(T,{text:V,numeric:G}){T.textContent!==V&&(T.textContent=V),T.classList.toggle("ec-num",G)}function h(){n?.remove(),n=r=o=a=i=s=c=void 0,d.clear(),l=""}return{render(T){if(!T){h();return}p(T.hidden,T.summary),a.textContent!==T.caption&&(a.textContent=T.caption);let V=JSON.stringify(T.headers);V!==l&&(l=V,i.replaceChildren(...T.headers.map(M=>{let E=u("th");return E.scope="col",k(E,M),E})),d.clear(),s.replaceChildren());let G=new Set(T.rows.map(M=>M.key));for(let[M,E]of d)G.has(M)||(E.remove(),d.delete(M));if(T.rows.forEach((M,E)=>{let P=d.get(M.key);P||(P=u("tr"),P.setAttribute("data-key",M.key),M.cells.forEach((L,D)=>{let K=u(D===0?"th":"td");D===0&&(K.scope="row"),P.appendChild(K)}),d.set(M.key,P)),M.cells.forEach((L,D)=>k(P.cells[D],L)),s.children[E]!==P&&s.insertBefore(P,s.children[E]??null)}),!T.footer){c?.remove(),c=void 0;return}let H=T.footer,b=c?.rows[0];(!c||!b||b.cells.length!==H.length)&&(c?.remove(),c=u("tfoot"),b=u("tr"),H.forEach((M,E)=>{let P=u(E===0?"th":"td");E===0&&(P.scope="row"),b.appendChild(P)}),c.appendChild(b),o.appendChild(c)),H.forEach((M,E)=>k(b.cells[E],M))},destroy:h}}var _c=640;function rn(e,t){if(typeof e=="string"){let n=typeof document>"u"?null:document.querySelector(e);if(!n)throw new TypeError(`${t}: no element matches "${e}".`);return n}if(!e||typeof e.appendChild!="function")throw new TypeError(`${t} needs a container element or a selector.`);return e}function On(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:_c}function on(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 An(e,t,n){for(let r of Nt){let o=e[r];if(o?.kind==="data"){for(let a of o.needs?.related??[])if(!t.includes(a))throw new RangeError(`${n}: on.${r} needs the series "${a}", but the chart's series are ${t.map(i=>`"${i}"`).join(", ")}.`)}}}function $n(e,t,n,r){let o=s=>Nt.includes(s)&&n?.[s]!==void 0&&n[s]===t?.[s],a=Ft(Object.fromEntries(Object.entries(n??{}).filter(([s])=>!o(s))),r),i={};for(let s of Nt){let c=o(s)?e[s]:a[s];c&&(i[s]=c)}return i}function hn(e,t){if(typeof e!="object"||e===null)throw new TypeError(`${t} needs options.`);if(typeof e.label!="string"||e.label.trim()==="")throw new TypeError(`${t} needs a label: the chart's accessible name.`);if(!Array.isArray(e.data))throw new TypeError(`${t}: data must be an array of rows.`);for(let c of["width","height"]){let d=e[c];if(d!==void 0&&!(typeof d=="number"&&Number.isFinite(d)&&d>0))throw new RangeError(`${t}: ${c} must be a positive number of px, got ${String(d)}.`)}let{format:n,tooltip:r,markLabel:o,markDescription:a,legend:i,announce:s}=e;if(n!==void 0&&typeof n!="function")throw new TypeError(`${t}: format must be a function that turns a value into text.`);if(r!==void 0&&typeof r!="boolean"&&typeof r!="function")throw new TypeError(`${t}: tooltip must be true, false or a function that returns a row's text.`);if(o!==void 0&&typeof o!="function")throw new TypeError(`${t}: markLabel must be a function that returns a mark's accessible name.`);if(a!==void 0&&a!==!1&&typeof a!="function")throw new TypeError(`${t}: markDescription must be false or a function that returns a mark's accessible description.`);if(ni(i,t),ci(e.seriesLabels,t),di(e.table,t),s!==void 0&&typeof s!="boolean"&&typeof s!="function")throw new TypeError(`${t}: announce must be true, false or a function that returns the text to announce.`)}function Gn(e){let{clock:t}=e,n,r=0,o,a,i=!1;function s(c){if(i||n?.id!==c)return;let{waiters:d}=n;n=void 0,o?.(),o=void 0,e.land(),e.runner.settle(),e.leaving.sweep();for(let l of d)l()}return{run(c){e.draw();let d=++r;return new Promise(l=>{if(n={id:d,waiters:[...n?.waiters??[],l]},c.length===0){s(d);return}o?.(),o=t.onFrame(()=>e.draw()),Promise.all(c).then(()=>s(d))})},supersede:()=>a?.(),wait(c,d){return new Promise(l=>{a=l,c.then(()=>Promise.all(d.map(u=>u.gone))).then(()=>l())})},destroy(){i=!0,n=void 0,o?.(),a?.()}}}function In(e,t,n){let{runner:r,events:o,input:a,onScreen:i}=e;r.interrupt();let s=t();e.swap?.(s),e.hover.dropGone();let c=s.exiting.map(l=>l.leave);return r.exit(s.exiting.map(i)).then(()=>{for(let l of c)l.exited=!0;e.leaving.sweep()}),o.emitEach("exit",s.exiting,i),r.update(s.changed.map(({record:l,from:u})=>({...a(l),from:u}))),o.emitEach("update",s.changed,({record:l,from:u})=>({...a(l),from:u})),r.enter(s.entering.map(a)),o.emitEach("enter",s.entering,a),n(s),e.hover.sync(),c}function Pe(e,t,n){return e.animating||!n(e.value,t)}var xe=(e,t)=>e===t;function Be(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(r=>e[r]===t[r])}function an(e,t){if(e.outline.d!==t.outline.d)return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((o,a)=>o.key!==r[a].key||o.outline.d!==r[a].outline.d)}function Vn(e,t,n,r){if(typeof ResizeObserver!="function")return()=>{};let o=n,a=n,i,s=new ResizeObserver(c=>{let d=c[c.length-1]?.contentRect.width??0;!(d>0)||Math.abs(d-a)<.5||(a=d,i??(i=t.onFrame(()=>{i?.(),i=void 0,!(Math.abs(a-o)<.5)&&(o=a,r(o))})))});return s.observe(e),()=>{s.disconnect(),i?.()}}function Nn(e,t){let n=e.fonts;return n?.addEventListener?.("loadingdone",t),()=>n?.removeEventListener?.("loadingdone",t)}function Fn(e,t){let n=()=>e.style.setProperty("--ec-hover-duration",`${t.duration(100,"feedback")}ms`);return n(),t.subscribe(n)}var Ao=12,Kc=100,Uc=0;function ui(e,t,n,r){let o=e.top-Ao,a=n.height-e.bottom-Ao;return r??(r=t.height<=o||o>=a?"above":"below"),{x:Math.max(0,Math.min(n.width-t.width,e.x-t.width/2)),y:r==="above"?o-t.height:e.bottom+Ao,side:r}}function Br(e,t,n,r={}){let o=t.length===1&&t[0].series==="value"&&(t[0].label??"value")==="value",a=[t.map(i=>o?n(i.value):`${n(i.value)} ${i.label??i.series}`).join(" \xB7 ")];return t.length>1&&r.total!==!1&&a.push(`${n(t.reduce((i,s)=>i+s.value,0))} total`),{title:e,lines:a}}function Bn(e,t){let n,r,o=new WeakMap,a,i=u=>u.style.setProperty("--ec-hover-duration",`${t.motion.duration(Kc,"feedback")}ms`);function s(){if(!n||!r){let u=e.ownerDocument;n=u.createElement("div"),n.className="ec-tooltip-layer",r=u.createElement("div"),r.className="ec-tooltip",r.setAttribute("aria-hidden","true"),n.appendChild(r)}return n.previousSibling!==e&&e.after(n),r}function c(u,m){let p=t.option(),k=o.get(u);if(k&&k.option===p)return k.content;let h=Wc(p,u.datum,m);return o.set(u,{option:p,content:h}),h}function d(){r&&(i(r),r.classList.remove("ec-tooltip-shown"))}function l(u,m,p,k){let h=c(u,m);if(h===void 0){d();return}let T=s(),V=typeof h=="string"?`text:${h}`:JSON.stringify(h);V!==a&&(Zc(T,h),a=V);let G=qc(e),H=e.getBoundingClientRect(),b=H.width>0&&G.width>0?H.width/G.width:1,M={x:K=>(K-G.x)*b,y:K=>(K-G.y)*b},E=H.width>0?{width:H.width,height:H.height}:{width:G.width,height:G.height},P={width:T.offsetWidth,height:T.offsetHeight},L=ui(p(M,k),P,E,k?ui(p(M,!1),P,E).side:void 0),D=n.getBoundingClientRect();T.style.left=`${Math.round(H.left-D.left+L.x)}px`,T.style.top=`${Math.round(H.top-D.top+L.y)}px`,T.setAttribute("data-side",L.side),i(T),T.classList.add("ec-tooltip-shown")}return{show(u,m,p,k){l(m,p,(T,V)=>{let G=V?k:void 0,{x:H,y:b,width:M,height:E}=u.bounds,P=[{x:H,y:b},{x:H+M,y:b},{x:H,y:b+E},{x:H+M,y:b+E}].map(D=>G?ve.apply(G,D).y:D.y),L=G?ve.apply(G,u.center):u.center;return{x:T.x(L.x),top:T.y(Math.min(...P)),bottom:T.y(Math.max(...P))}},k!==void 0)},showAt(u,m,p){l(m,p,k=>({x:k.x(u.x),top:k.y(u.top),bottom:k.y(u.bottom)}),!1)},describe(u,m){let p=t.description?.(),k;if(p===!1)k=void 0;else if(typeof p=="function")try{let T=p(m.datum);k=typeof T=="string"&&T!==""?T:void 0}catch(T){Se(T),k=void 0}else k=typeof t.option()=="function"?c(m,()=>""):void 0;let h=u.querySelector(":scope > desc.ec-description");if(typeof k!="string"){if(!h)return;u.getAttribute("aria-describedby")===h.id&&u.removeAttribute("aria-describedby"),h.remove();return}h??(h=Y("desc",{class:"ec-description",id:`ec-description-${++Uc}`},u)),h.textContent!==k&&(h.textContent=k),u.setAttribute("aria-describedby",h.id)},hide:d,destroy(){n?.remove(),n=void 0,r=void 0,o=new WeakMap,a=void 0}}}function Wc(e,t,n){if(e!==!1){if(typeof e!="function")return n();try{let r=e(t);return r==null||r===""?void 0:String(r)}catch(r){Se(r);return}}}function Zc(e,t){if(typeof t=="string"){e.textContent=t;return}let n=e.ownerDocument,r=(o,a)=>{let i=n.createElement("div");return a&&(i.className=a),i.textContent=o,i};e.replaceChildren(r(t.title,"ec-tooltip-title"),...t.lines.map(o=>r(o)))}function qc(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}}var Hn=500,fi=2,Jc=2;function Go(e,t,n){let r=rn(e,"barChart");mi(t);let o=t,a=en(t.motion,n.motion),i=Ft(t.on,n.presets),s=Rt(t.colors),c=n.clock??Ne,d=r.ownerDocument;lt(d);let l=Y("svg",{class:"ec-chart ec-bar-chart",role:"group"},r),u=Y("g",{class:"ec-grid","aria-hidden":"true"},l),m=Y("g",{class:"ec-axis","aria-hidden":"true"},l),p=Y("g",{class:"ec-focus","aria-hidden":"true",visibility:"hidden"},l),k=[Y("path",{class:"ec-focus-ring","stroke-width":2*(fi+Jc),"stroke-linejoin":"round"},p),Y("path",{class:"ec-focus-gap","stroke-width":2*fi,"stroke-linejoin":"round"},p)],h=Y("g",{class:"ec-marks"},l),T=Y("g",{class:"ec-overlay","aria-hidden":"true"},l),V=Dn(l),G=[],H=new Map,b=Cn(v=>v.values.animating||v.presence.animating),M=new WeakMap,E=Tn("barChart"),P=On(r),L=!1,D,K;try{D=ye(o),K=He(o,D)}catch(v){throw l.remove(),v}let x=v=>H.get(v)??b.get(v),C=tn({overlay:T,mark:v=>({set:z=>{x(v)?.handle.set(z),Ge.restyled(v)},reset:()=>{x(v)?.handle.reset(),Ge.restyled(v)}}),colors:v=>x(v)?.parts[0]?.colors}),B=Xt({effects:i,motion:a,icons:n.icons,clock:c,surface:C}),_=Bn(l,{motion:a,option:()=>o.tooltip,description:()=>o.markDescription}),re=En(l),ae=Pn(l),X=o.announce?Tt(l):void 0,J=D.orientation,ce=new Map,le=new Set,ge=!1,O=!1,F=Fe(D.frame.scale,ht,{clock:c,motion:a,onChange:()=>ge=!0}),Q=Fe(D.frame.bands,ht,{clock:c,motion:a,onChange:()=>ge=!0}),de=Gn({clock:c,runner:B,leaving:b,draw:je,land:ot});function ye(v,z=i){let w=Sn(v);return An(z,w.series.map(S=>S.series),"barChart"),Ya({data:v.data,encoding:w,sort:v.sort,width:v.width??P,height:v.height,format:Ke(v),measure:V})}function ke(v,z){let w=Y("g",{class:"ec-mark","data-key":v.key,role:"img"},h),S={clock:c,motion:a,onChange:()=>le.add(g)},f=jr(v),g={key:v.key,row:v,shown:v,group:w,hit:Y("rect",{class:"ec-hit"},w),label:Y("text",{class:"ec-label","aria-hidden":"true"},w),body:Y("g",{class:"ec-body"},w),value:Y("text",{class:"ec-value","aria-hidden":"true"},w),paths:new Map,parts:[],handle:fn(()=>g),values:Fe(z?$o(f):f,ht,S),series:v.values.map($=>$.series),slot:Fe(v.slot,nt,S),presence:Fe(z?0:1,nt,S),count:void 0,leave:void 0};return M.set(w,g),Ce(g,z?rt(g,ft()):v),g}function Ce(v,z){let w=v.parts[0]?.colors.color;v.shown=z,ie(v.hit,{...z.hit}),wt(v.label,z.label),wt(v.value,z.value);let S=v.presence.value,f=S<1?S:void 0;ie(v.label,{opacity:f}),ie(v.value,{opacity:f});let g=z.geometry.segments??[],$=new Set,R=Hr(o)?Xe(s.slot(v.key)):void 0;v.parts=g.map(j=>{let Z=j.series??j.key;$.add(Z);let oe=v.paths.get(Z);oe||(oe=Y("path",{class:"ec-segment","data-series":Z},v.body),v.paths.set(Z,oe));let Me=R??Xe(s.slot(Z));return oe.setAttribute("d",j.outline.d),Ae(oe,ct(Me)),{element:oe,d:j.outline.d,colors:Me,visible:j.length>=.5}});for(let[j,Z]of v.paths)$.has(j)||(Z.remove(),v.paths.delete(j));let N=Array.from(v.body.children).filter(j=>j.classList.contains("ec-segment"));if(v.parts.some((j,Z)=>N[Z]!==j.element))for(let j of v.parts)v.body.appendChild(j.element);v.handle.repaint(),v.parts[0]?.colors.color!==w&&C.recolor(v.key),v.key===Ge.ringKey&&Oe(v.key)}function Oe(v){let z=v===void 0?void 0:H.get(v);if(!z){p.setAttribute("visibility","hidden");return}for(let S of k)S.setAttribute("d",z.shown.geometry.outline.d);let{transform:w}=z.handle.style;ie(p,{transform:w&&dt(w),visibility:void 0})}function Ue(v,z){let w=an(v.shown.geometry,z.geometry);Ce(v,z),w&&B.change(z.geometry,z.data),v.key===Ge.key&&Te(v)}function Te(v){let{row:z}=v;_.show(v.shown.geometry,z,()=>Br(z.label.text,pi(z.values,o),Ke(o)),v.handle.style.transform)}function $e(v){if(Hr(o)){re.categories(v.rows.map(z=>({key:z.key,label:z.label.text})),s,o.legend);return}re.update(Sn(o).series.map(z=>({series:z.series,label:Je(o.seriesLabels,z.series)})),s,o.legend)}function He(v,z){let w=Sn(v),S=w.orientation==="horizontal"?v.y:v.x;return Ln({option:v.table,caption:v.label,category:typeof S=="string"?S:void 0,series:w.series.map(f=>f.series),label:f=>Je(v.seriesLabels,f),rows:z.rows.map(f=>({key:f.key,category:f.label.text,datum:f.datum,index:f.index,values:f.values,total:f.total})),format:Ke(v)})}function et(v,z){let w=o.announce;if(!X||!w)return;let S=Sn(o).series.map(Z=>Z.series),f=Sn(v).series.map(Z=>Z.series),g=yi(o.sort),$=Z=>Z.row.label.text,R=z.changed.map(({record:Z})=>Z),N=kn({...o.label!==v.label?{label:o.label}:{},...S.join(`
85
- `)!==f.join(`
86
- `)?{series:S.map(Z=>Je(o.seriesLabels,Z))}:{},...g!==yi(v.sort)||g==="custom"&&o.sort!==v.sort?{sort:g}:{},changed:R.map($),added:z.entering.map($),removed:z.exiting.map($),count:G.length});if(typeof w!="function"){X.say(N);return}let j=Z=>Z.key;try{let Z=w({text:N,changed:R.map(j),added:z.entering.map(j),removed:z.exiting.map(j)});Z!=null&&X.say(String(Z))}catch(Z){Se(Z)}}let ft=()=>({orientation:J,scale:F.value,bands:Q.value});function rt(v,z){let{row:w}=v,S=v.values.value,f=v.series.map(R=>({series:R,value:S[R]??0})),g=f.reduce((R,N)=>R+N.value,0),$=v.count===void 0?w.value.text:Ke(o)(mn(g,v.count));return Ro(z,{key:w.key,datum:w.datum,index:w.index,category:w.label.text,values:f,slot:v.slot.value,text:$})}function me(v,z){let w={value:v,line:Y("line",{class:v===0?"ec-baseline":"ec-gridline"},u),label:Y("text",{class:"ec-tick"},m),opacity:Fe(z,nt,{clock:c,motion:a,onChange:()=>O=!0}),wanted:!0};ce.set(v,w);for(let S of[...ce.values()].sort((f,g)=>f.value-g.value))u.appendChild(S.line),m.appendChild(S.label)}function Ie(v,z){let w=Co(z,v.value,Ke(o)(v.value)),S=v.opacity.value<1?v.opacity.value:void 0;ie(v.line,{...w.line,opacity:S}),wt(v.label,w.label),ie(v.label,{opacity:S})}function je(){let v=ft();if(ge&&ie(l,Ct(v.bands)),ge||O)for(let z of ce.values())Ie(z,v);for(let z of[...G,...b.values()])(ge||le.has(z))&&Ue(z,rt(z,v));ge=!1,O=!1,le.clear()}function ot(){ie(l,Ct(D.frame.bands));for(let v of[...ce.values()])v.wanted||(v.line.remove(),v.label.remove(),ce.delete(v.value));for(let v of D.ticks){let z=ce.get(v.value);z&&(ie(z.line,{...v.line,opacity:void 0}),wt(z.label,v.label),z.label.removeAttribute("opacity"))}for(let v of G)v.series=v.row.values.map(z=>z.series),v.count=void 0,Ue(v,v.row);ge=!1,O=!1,le.clear()}function Lt(v){let z=new Set(v.rows.map(f=>f.key)),w={entering:[],exiting:[],changed:[]};for(let f of G)z.has(f.key)||(H.delete(f.key),b.start(f),f.count=void 0,w.exiting.push(f));let S=G;return G=v.rows.map(f=>{let g=H.get(f.key);return g?(Xc(g.row,f)&&w.changed.push({record:g,from:g.shown.geometry}),g.count=Math.max(Bt(g.row.total),Bt(f.total))):(g=b.recall(f.key)??ke(f,!0),g.count=void 0,H.set(f.key,g),w.entering.push(g)),g.row=f,g.series=Qc(g.series,f.values.map($=>$.series)),Pt(g),g}),pn(h,S.map(f=>f.group),G.map(f=>f.group),Ge.active),w}function Pt(v){v.group.setAttribute("aria-label",Yc(v.row,o)),_.describe(v.group,v.row)}function Ze(v,z){let{frame:w}=v;z&&(J=v.orientation);let S=new Set(v.ticks.map(te=>te.value));for(let te of S)ce.has(te)||me(te,0);for(let te of ce.values())te.wanted=S.has(te.value);let f=new Set(G.filter(te=>te.presence.value===0)),g=G.filter(te=>!f.has(te)),$=[...b.values()],R=Pe(F,w.scale,Be)||[...ce.values()].some(te=>Pe(te.opacity,te.wanted?1:0,xe))||g.some(te=>Pe(te.values,jr(te.row),Be)||Pe(te.presence,1,xe))||$.some(te=>Pe(te.values,$o(te.values.value),Be)||Pe(te.presence,0,xe)),N=f.size>0||Pe(Q,w.bands,Be)||g.some(te=>Pe(te.slot,te.row.slot,xe)),j,Z,oe;if(!z&&a.staged){let te=R?Hn:0;j={duration:Hn},Z={duration:Hn,delay:te},oe={duration:Hn/2,delay:te+Hn/2}}else z||(j=Z=oe={duration:(R&&N?2:1)*Hn});let Me=[],he=(te,be,Ve,Le)=>{Pe(te,be,Ve)&&(Le?Me.push(te.to(be,Le)):te.set(be))};he(F,w.scale,Be,j),he(Q,w.bands,Be,Z);for(let te of ce.values())he(te.opacity,te.wanted?1:0,xe,j);for(let te of g)he(te.values,jr(te.row),Be,j),he(te.presence,1,xe,j),he(te.slot,te.row.slot,xe,Z);for(let te of f)te.slot.set(te.row.slot),he(te.values,jr(te.row),Be,oe),he(te.presence,1,xe,oe);for(let te of $)he(te.values,$o(te.values.value),Be,j),he(te.presence,0,xe,j);return Me}function vt(v,z){return D=v,de.run(Ze(v,z))}let xt=v=>({mark:v.row.geometry,data:v.row.data}),Mt=v=>({mark:v.shown.geometry,data:v.shown.data});function jt(v){let z=v,w=typeof z?.closest=="function"?z.closest(".ec-mark"):null,S=w?M.get(w):void 0;return S&&H.get(S.key)===S?S:void 0}let Ge=Rn({svg:l,runner:B,events:E,dim:()=>o.dim!==!1,find(v){let z=jt(v);if(!z)return;let w=v.closest(".ec-segment")?.getAttribute("data-series")??void 0;return w===void 0?{key:z.key}:{key:z.key,segment:w}},live:v=>H.has(v),order:()=>G.map(v=>v.key),element:v=>x(v)?.group,onScreen(v){let z=x(v);return z&&Mt(z)},ring:Oe,tooltip:{show(v){let z=H.get(v);z&&Te(z)},hide:()=>_.hide()}}),St=Fn(l,a);function Ot(){if(L)return;let v=ye(o),z=new Map(v.rows.map(w=>[w.key,w]));for(let w of G)w.row=z.get(w.key)??w.row;vt(v,!0)}let qt=Vn(r,c,P,v=>{P=v,o.width===void 0&&Ot()}),We=Nn(d,()=>{V.clear(),Ot()});on(l,o),$e(D),ae.render(K),ie(l,Ct(D.frame.bands));for(let v of D.ticks)me(v.value,1);for(let v of ce.values())Ie(v,D.frame);return G=D.rows.map(v=>{let z=ke(v,!1);return H.set(v.key,z),Pt(z),z}),Ge.sync(),B.enter(G.map(xt)),{element:l,async update(v){if(L)return;if(v.motion!==void 0&&v.motion!==o.motion)throw new TypeError("barChart: `motion` can't be changed by update() yet.");let z={...o,...v};mi(z);let w="on"in v?$n(i,o.on,z.on,n.presets):i,S=ye(z,w),f=He(z,S);"colors"in v&&(s=Rt(z.colors));let g=o;o=z,on(l,o),$e(S),ae.render(f);let $=X!==void 0;o.announce&&!X?X=Tt(l):!o.announce&&X&&(X.destroy(),X=void 0),Ge.syncDim(),de.supersede();let R=w!==i;i=w;let N=In({runner:B,events:E,hover:Ge,leaving:b,input:xt,onScreen:Mt,...R?{swap:Z=>{let oe=new Set(Z.entering);B.swap(w,G.filter(Me=>!oe.has(Me)).map(xt))}}:{}},()=>Lt(S),Z=>{$&&et(g,Z)});if(Hr(o)!==Hr(g))for(let Z of[...G,...b.values()])le.add(Z);let j=vt(S,a.mode==="off"||S.orientation!==J);await de.wait(j,N)},on:E.on,marks:()=>G.map(v=>v.shown.geometry),focus(v){L||Ge.focus(v)},leave(){L||Ge.leave()},labels:()=>G.flatMap(v=>[...nn(v.key,"category",v.shown.label,v.label),...nn(v.key,"value",v.shown.value,v.value)]),destroy(){if(!L){L=!0,de.destroy(),Ge.destroy(),B.destroy(),_.destroy(),re.destroy(),ae.destroy(),X?.destroy(),St(),qt(),We();for(let v of[...G,...b.values()]){for(let z of[v.values,v.slot,v.presence])z.stop();v.leave?.resolve()}F.stop(),Q.stop();for(let v of ce.values())v.opacity.stop();E.clear(),H.clear(),b.clear(),G=[],l.remove()}}}}function mi(e){hn(e,"barChart");let{colorBy:t}=e;if(t!==void 0&&t!=="series"&&t!=="category")throw new TypeError(`barChart: colorBy must be "series" or "category", got ${String(t)}.`);if(t==="category"&&e.stack!==void 0)throw new 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 Hr(e){return e.colorBy==="category"}function Yc(e,t){let n=Ke(t),r=pi(e.values,t),o=r.length===1&&r[0].series==="value"&&r[0].label==="value",a=`${e.label.text}: ${r.map(i=>o?n(i.value):`${n(i.value)} ${i.label}`).join(", ")}`;if(!t.markLabel)return a;try{let i=t.markLabel(e.datum,{key:e.key,category:e.label.text,values:r,total:e.total,format:n,text:a});if(i!=null&&String(i).trim()!=="")return String(i)}catch(i){Se(i)}return a}function pi(e,t){return e.map(n=>({series:n.series,label:Je(t.seriesLabels,n.series),value:n.value}))}function Xc(e,t){return e.values.length!==t.values.length||e.values.some((n,r)=>n.series!==t.values[r].series||n.value!==t.values[r].value)}function jr(e){return Object.fromEntries(e.values.map(t=>[t.series,t.value]))}function $o(e){return Object.fromEntries(Object.keys(e).map(t=>[t,0]))}function Qc(e,t){let n=[...t];return e.forEach((r,o)=>{if(n.includes(r))return;let a=0;for(let i=o-1;i>=0;i--){let s=n.indexOf(e[i]);if(s>=0){a=s+1;break}}n.splice(a,0,r)}),n}function yi(e){return typeof e=="function"?"custom":e??"none"}var hi=2*Math.PI,el=300,tl=.6,Io=4,No=10,nl=Math.PI/12,Ho=12.5,bi=12.5,Fo=10,wi=15,Bo=Fo+wi+3,zr=2,lr=26,rl=14,ol=20,al=16,il=.36;function jn(e){let{category:t,value:n,key:r}=e;if(typeof t!="string"&&typeof t!="function")throw new TypeError("donutChart needs a category: the field, or a function, that names each slice.");if(typeof n!="string"&&typeof n!="function")throw new 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 new TypeError("donutChart: key must be a field name or a function.");let o=Vo(t);return{category:o,key:r===void 0?o:Vo(r),series:typeof n=="string"?n:"value",value:Vo(n)}}function vi(e){let t=ll(cl(e),e.sort),n=dl(e,t),r=t.reduce((s,c)=>s+c.value,0),o=sl(t.map(s=>s.value)),a=t.map((s,c)=>{let d=r>0?s.value/r:0,l=c+1<t.length&&r>0?o[c+1]:r>0?1:0;return jo(n,{...s,series:e.encoding.series,share:d,start:o[c]*hi,end:l*hi})}),i=e.center(r);return{frame:n,total:r,slices:a,labels:zo(n,a,e.measure),centerText:i,center:_o(n,i,e.measure)}}function sl(e){let t=e.reduce((r,o)=>r+o,0),n=0;return e.map(r=>{let o=t>0?n/t:0;return n+=r,o})}function jo(e,t){let n=qe.arc({key:t.key,series:t.series,cx:e.cx,cy:e.cy,inner:e.inner,outer:e.outer,start:t.start,end:t.end});return{...t,geometry:n,data:fl(t.datum,t.share,t.series)}}function zo(e,t,n){let r,o,a=t.map((i,s)=>{if(i.end-i.start<nl-1e-9)return;let c=ul(e,i,n),{box:d}=c;if(!(d.x<0||d.y<0||d.x+d.width>e.width||d.y+d.height>e.height)&&!(r&&gi(r,d)))return r=d,o??(o=s),c});for(let i=a.length-1;o!==void 0&&i>o;i--){let s=a[i];if(s){if(!gi(a[o].box,s.box))break;a[i]=void 0}}return a}function _o(e,t,n){if(t==="")return[];let r=t.split(`
87
- `),o=2*e.inner*.85,a=n(r[0],"ec-center-value",lr),i=a>o&&a>0?Math.max(rl,lr*o/a):lr,s=r.map((l,u)=>u===0?0:ol+(u-1)*al),c=s[s.length-1],d=e.cy+(2*il*i-c)/2;return r.map((l,u)=>({x:e.cx,y:d+s[u],anchor:"middle",text:l,size:u===0?i:Ho}))}function cl({data:e,encoding:t}){let n=new Set;return e.map((r,o)=>{let a=String(t.key(r,o));if(n.has(a))throw new Error(`donutChart: two rows have the key "${a}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(a);let i=ml(t.value(r,o),t.series,a);return{key:a,category:String(t.category(r,o)??""),datum:r,index:o,value:i}})}function ll(e,t){if(t===void 0||t==="none")return e;if(t==="value")return[...e].sort((n,r)=>r.value-n.value);throw new TypeError(`donutChart: sort must be "value" or "none", got ${String(t)}.`)}function dl(e,t){let{width:n,measure:r}=e,o=e.height??el,a=n/2,i=o/2,s=r("100%","ec-value",bi),c=t.reduce((m,p)=>Math.max(m,r(p.category,"ec-label",Ho)),s),d=Math.min(a-Io-No-c,i-Io-No-Bo),l=Math.max(0,Math.min(a,i)-Io),u=Math.max(0,d,l/2);return{width:n,height:o,cx:a,cy:i,inner:u*tl,outer:u}}function ul(e,t,n){let r=(t.start+t.end)/2,o=Math.sin(r),a=Math.cos(r),i=e.outer+No,s=e.cx+i*o,c=e.cy-i*a,d=yn(t.share),l=[n(t.category,"ec-label",Ho),n(d,"ec-value",bi)],u=Math.max(...l),m=c-Bo*(a+1)/2,p=k=>s+o*k/2;return{category:{x:p(l[0]),y:m+Fo,anchor:"middle",text:t.category},share:{x:p(l[1]),y:m+Fo+wi,anchor:"middle",text:d},box:{x:p(u)-u/2,y:m,width:u,height:Bo}}}function gi(e,t){return e.x<t.x+t.width+zr&&t.x<e.x+e.width+zr&&e.y<t.y+t.height+zr&&t.y<e.y+e.height+zr}function fl(e,t,n){let r={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related:o=>o===n?r:void 0};return r}function Vo(e){return typeof e=="function"?e:t=>t[e]}function ml(e,t,n){if(e==null)return 0;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e;throw new RangeError(`donutChart: "${t}" for "${n}" must be a finite number of 0 or more, got ${typeof e=="string"?JSON.stringify(e):String(e)}.`)}var zn=500,ki=2*Math.PI,yl=.5;function Ko(e,t,n){let r=rn(e,"donutChart");xi(t);let o=t,a=en(t.motion,n.motion),i=Ft(t.on,n.presets),s=Rt(t.colors),c=n.clock??Ne,d=r.ownerDocument;lt(d);let l=Y("svg",{class:"ec-chart ec-donut-chart",role:"group"},r),u=Y("g",{class:"ec-center","aria-hidden":"true"},l),m=Y("g",{class:"ec-marks"},l),p=Y("g",{class:"ec-overlay","aria-hidden":"true"},l),k=Y("g",{class:"ec-halos"},p),h=Ir(p),T=Y("g",{class:"ec-runs"},p),V=Dn(l),G=[],H=new Map,b=Cn(f=>f.value.animating||f.presence.animating),M=new WeakMap,E=Tn("donutChart"),P=On(r),L=!1,D,K,x;try{D=ye(o),K=et(o,D),x=Mi(o,D)}catch(f){throw l.remove(),f}let C=f=>H.get(f)??b.get(f),B=tn({overlay:T,mark:f=>({set:g=>{C(f)?.handle.set(g),We.restyled(f)},reset:()=>{C(f)?.handle.reset(),We.restyled(f)}}),colors:f=>C(f)?.parts[0]?.colors}),_=Xt({effects:i,motion:a,icons:n.icons,clock:c,surface:B}),re=Bn(l,{motion:a,option:()=>o.tooltip,description:()=>o.markDescription}),ae=En(l),X=Pn(l),J=o.announce?Tt(l):void 0,ce=[],le=[],ge=!1,O=Fe(D.frame,ht,{clock:c,motion:a,onChange:()=>ge=!0}),F,Q,de=Gn({clock:c,runner:_,leaving:b,draw:Pt,land:vt});function ye(f,g=i){let $=jn(f);return An(g,[$.series],"donutChart"),vi({data:f.data,encoding:$,sort:f.sort,width:f.width??P,height:f.height,center:R=>Si(f,$.series,R),measure:V})}function ke(f,g){let $=Y("g",{class:"ec-mark","data-key":f.key,role:"img"},m),R={clock:c,motion:a,onChange:()=>ge=!0},N=Y("g",{class:"ec-body"},$),j={key:f.key,row:f,shown:f,group:$,hit:Y("path",{class:"ec-hit"},$),body:N,path:Y("path",{class:"ec-slice","data-series":f.series},N),label:Y("text",{class:"ec-label","aria-hidden":"true"},$),share:Y("text",{class:"ec-value","aria-hidden":"true"},$),drawnLabel:void 0,parts:[],handle:fn(()=>j,{halos:()=>k}),value:Fe(g?0:f.value,nt,R),turn:Fe(1,nt,R),offset:0,planned:0,presence:Fe(g?0:1,nt,R),leave:void 0};return $.insertBefore(j.hit,N),M.set($,j),j}function Ce(f,g,$){let R=f.parts[0]?.colors.color;f.shown=g;let{outline:N}=g.geometry,j=g.geometry.length>=yl,Z=j?void 0:"hidden";ie(f.path,{d:N.d,visibility:Z}),ie(f.hit,{d:N.d,visibility:Z});let oe=Xe(s.slot(f.key));Ae(f.path,ct(oe)),f.parts=[{element:f.path,d:N.d,colors:oe,visible:j}];let Me=f.presence.value,he=Me<1?Me:void 0;f.drawnLabel=$;for(let[te,be]of[[f.label,$?.category],[f.share,$?.share]])be&&wt(te,be),ie(te,{visibility:be?void 0:"hidden",opacity:he});f.handle.repaint(),oe.color!==R&&B.recolor(f.key),f.key===We.ringKey&&Oe(f.key)}function Oe(f){let g=f===void 0?void 0:H.get(f);h.draw(g&&{outline:g.shown.geometry.outline,thickness:g.shown.geometry.thickness,transform:g.handle.style.transform})}function Ue(f,g,$){let R=an(f.shown.geometry,g.geometry);Ce(f,g,$),R&&_.change(g.geometry,g.data),f.key===We.key&&Te(f)}function Te(f){let{row:g}=f;re.show(f.shown.geometry,g,()=>({title:g.category,lines:[`${Ei(g,o)} \xB7 ${yn(g.share)}`]}),f.handle.style.transform)}function $e(f){for(;u.childElementCount>f.length;)u.lastElementChild.remove();f.forEach((g,$)=>{let R=u.children[$]??Y("text",{},u);ie(R,{class:$===0?"ec-center-value":"ec-center-label"}),wt(R,g),Ae(R,{"font-size":$===0&&g.size!==lr?`${g.size}px`:void 0})})}let He=()=>ae.categories(D.slices.map(f=>({key:f.key,label:f.category})),s,o.legend);function et(f,g){let{series:$}=jn(f);return Ln({option:f.table,caption:f.label,category:typeof f.category=="string"?f.category:void 0,series:[$],label:R=>Je(f.seriesLabels,R),rows:g.slices.map(R=>({key:R.key,category:R.category,datum:R.datum,index:R.index,values:[{series:$,value:R.value}],total:R.value})),format:Ke(f),shares:!0})}function ft(){on(l,{label:o.label,description:hl(o.description,D.centerText)})}function rt(f,g){let $=o.announce;if(!J||!$)return;let R=jn(o).series,N=jn(f).series,j=o.sort??"none",Z=te=>te.row.category,oe=g.changed.map(({record:te})=>te),Me=kn({...o.label!==f.label?{label:o.label}:{},...R!==N?{series:[Je(o.seriesLabels,R)]}:{},...j!==(f.sort??"none")?{sort:j}:{},changed:oe.map(Z),added:g.entering.map(Z),removed:g.exiting.map(Z),count:G.length});if(typeof $!="function"){J.say(Me);return}let he=te=>te.key;try{let te=$({text:Me,changed:oe.map(he),added:g.entering.map(he),removed:g.exiting.map(he)});te!=null&&J.say(String(te))}catch(te){Se(te)}}let me=f=>H.get(f.key)===f||b.get(f.key)===f,Ie=f=>Math.max(0,f.value.value);function je(f,g,$=Ie){let R=new Map,N=0;for(let j of f)R.set(j,g>0?N/g:0),N+=$(j);return R}function ot(){ce=ce.filter(me),le=le.filter(me);let f=ce.reduce((N,j)=>N+Ie(j),0),g=je(ce,f),$=je(le,f),R=new Map;for(let N of ce){let j=g.get(N),Z=N.turn.value,oe=$.get(N),Me=j;if(oe!==void 0&&Z<1){let he=oe+N.offset-j;Me=j+(1-Z)*(he-Math.round(he-N.planned))}R.set(N,{start:Me,span:f>0?Ie(N)/f:0})}return R}function Lt(f){return[...ot()].map(([g,{start:$,span:R}])=>{let{row:N}=g,j=jo(f,{key:N.key,datum:N.datum,index:N.index,category:N.category,series:N.series,value:Ie(g),share:R,start:$*ki,end:($+R)*ki});return{record:g,slice:j}})}function Pt(){if(!ge)return;ge=!1;let f=O.value;ie(l,Ct(f));let g=Lt(f),$=zo(f,g.map(({slice:N})=>N),V);g.forEach(({record:N,slice:j},Z)=>Ue(N,j,$[Z]));let R=g.reduce((N,{slice:j})=>N+j.value,0);$e(_o(f,F===void 0?D.centerText:Ze(mn(R,F)),V))}function Ze(f){return Q?.total!==f&&(Q={total:f,text:Si(o,jn(o).series,f)}),Q.text}function vt(){ce=ce.filter(me),le=ce;for(let f of ce)f.turn.set(1),f.offset=0,f.planned=0;F=void 0,Q=void 0,ie(l,Ct(D.frame)),D.slices.forEach((f,g)=>Ue(H.get(f.key),f,D.labels[g])),$e(D.center),ge=!1}function xt(f){let g=new Set(f.slices.map(N=>N.key)),$={entering:[],exiting:[],changed:[]};for(let N of G)g.has(N.key)||(H.delete(N.key),b.start(N),$.exiting.push(N));let R=G;return G=f.slices.map(N=>{let j=H.get(N.key);return j?(j.row.value!==N.value||j.row.series!==N.series)&&$.changed.push({record:j,from:j.shown.geometry}):(j=b.recall(N.key)??ke(N,!0),H.set(N.key,j),$.entering.push(j)),j.row=N,j.path.setAttribute("data-series",N.series),Mt(j),j}),pn(m,R.map(N=>N.group),G.map(N=>N.group),We.active),$}function Mt(f){f.group.setAttribute("aria-label",x.get(f.key)),re.describe(f.group,f.row)}function jt(f,g){ge=!0;let $=ot(),R=new Set(G.filter(se=>se.presence.value===0)),N=G.filter(se=>!R.has(se)),j=[...b.values()],Z=le.length>0&&le.every(se=>se.turn.value===0),oe=ce;if(ce=gl(oe,G),!Z){le=oe;let se=oe.reduce((zt,ln)=>zt+Ie(ln),0),yt=je(oe,se);for(let zt of oe)zt.offset=$.get(zt).start-yt.get(zt)}le=le.filter(se=>!R.has(se));let Me=se=>H.get(se.key)===se?se.row.value:0,he=ce.reduce((se,yt)=>se+Me(yt),0),te=je(ce,he,Me),be=je(le,he,Me),Ve=!1;for(let se of le){let yt=be.get(se)+se.offset-te.get(se);se.planned=yt-Math.round(yt),Math.abs(se.planned)>1e-9&&(Ve=!0)}let Le=N.some(se=>Pe(se.value,se.row.value,xe)||Pe(se.presence,1,xe))||j.some(se=>Pe(se.value,0,xe)||Pe(se.presence,0,xe)),mt=Ve||R.size>0||Pe(O,f.frame,Be),tt,kt,Et;if(!g&&a.staged){let se=Le?zn:0;tt={duration:zn},kt={duration:zn,delay:se},Et={duration:zn/2,delay:se+zn/2}}else g||(tt=kt=Et={duration:(Le&&mt?2:1)*zn});let cn=[],Dt=(se,yt,zt,ln)=>{Pe(se,yt,zt)&&(ln?cn.push(se.to(yt,ln)):se.set(yt))};Dt(O,f.frame,Be,kt);for(let se of N)Dt(se.value,se.row.value,xe,tt),Dt(se.presence,1,xe,tt);for(let se of R)Dt(se.value,se.row.value,xe,Et),Dt(se.presence,1,xe,Et);for(let se of j)Dt(se.value,0,xe,tt),Dt(se.presence,0,xe,tt);if(g){le=ce;for(let se of ce)se.turn.set(1),se.offset=0,se.planned=0;return cn}let mo=new Set(le);for(let se of ce)se.turn.set(mo.has(se)?0:1);if(Ve)for(let se of le)Dt(se.turn,1,xe,kt);return cn}function Ge(f,g){return D=f,de.run(jt(f,g))}let St=f=>({mark:f.row.geometry,data:f.row.data}),Ot=f=>({mark:f.shown.geometry,data:f.shown.data});function qt(f){let g=f,$=typeof g?.closest=="function"?g.closest(".ec-mark"):null,R=$?M.get($):void 0;return R&&H.get(R.key)===R?R:void 0}let We=Rn({svg:l,runner:_,events:E,dim:()=>o.dim!==!1,find(f){let g=qt(f);return g&&{key:g.key}},live:f=>H.has(f),order:()=>G.map(f=>f.key),element:f=>C(f)?.group,onScreen(f){let g=C(f);return g&&Ot(g)},ring:Oe,tooltip:{show(f){let g=H.get(f);g&&Te(g)},hide:()=>re.hide()}}),v=Fn(l,a);function z(){if(L)return;let f=ye(o),g=new Map(f.slices.map($=>[$.key,$]));for(let $ of G)$.row=g.get($.key)??$.row;Ge(f,!0)}let w=Vn(r,c,P,f=>{P=f,o.width===void 0&&z()}),S=Nn(d,()=>{V.clear(),z()});return ft(),He(),X.render(K),ie(l,Ct(D.frame)),G=D.slices.map(f=>{let g=ke(f,!1);return H.set(f.key,g),Mt(g),g}),ce=le=G,D.slices.forEach((f,g)=>Ce(G[g],f,D.labels[g])),$e(D.center),We.sync(),_.enter(G.map(St)),{element:l,async update(f){if(L)return;if(f.motion!==void 0&&f.motion!==o.motion)throw new TypeError("donutChart: `motion` can't be changed by update() yet.");let g={...o,...f};xi(g);let $="on"in f?$n(i,o.on,g.on,n.presets):i,R=ye(g,$),N=et(g,R),j=Mi(g,R);"colors"in f&&(s=Rt(g.colors));let Z=o,oe=D.total;o=g,D=R,x=j,ft(),He(),X.render(N);let Me=J!==void 0;o.announce&&!J?J=Tt(l):!o.announce&&J&&(J.destroy(),J=void 0),We.syncDim(),de.supersede();let he=$!==i;i=$;let te=In({runner:_,events:E,hover:We,leaving:b,input:St,onScreen:Ot,...he?{swap:Ve=>{let Le=new Set(Ve.entering);_.swap($,G.filter(mt=>!Le.has(mt)).map(St))}}:{}},()=>xt(R),Ve=>{Me&&rt(Z,Ve)});F=R.total===oe?void 0:Math.max(Bt(oe),Bt(R.total));let be=Ge(R,a.mode==="off");await de.wait(be,te)},on:E.on,marks:()=>G.map(f=>f.shown.geometry),focus(f){L||We.focus(f)},leave(){L||We.leave()},labels:()=>G.flatMap(f=>[...nn(f.key,"category",f.drawnLabel?.category,f.label),...nn(f.key,"value",f.drawnLabel?.share,f.share)]),destroy(){if(!L){L=!0,de.destroy(),We.destroy(),_.destroy(),re.destroy(),ae.destroy(),X.destroy(),J?.destroy(),v(),w(),S();for(let f of[...G,...b.values()]){for(let g of[f.value,f.turn,f.presence])g.stop();f.leave?.resolve()}O.stop(),E.clear(),H.clear(),b.clear(),G=ce=le=[],l.remove()}}}}function xi(e){hn(e,"donutChart");let{center:t,sort:n}=e;if(t!==void 0&&t!==!1&&typeof t!="function")throw new 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 new TypeError(`donutChart: sort must be "value" or "none", got ${String(n)}.`)}function Ei(e,t){let n=Ke(t)(e.value),r=Je(t.seriesLabels,e.series);return e.series==="value"&&r==="value"?n:`${n} ${r}`}function Mi(e,t){return new Map(t.slices.map(n=>[n.key,pl(n,e)]))}function pl(e,t){let n=`${e.category}: ${Ei(e,t)}, ${yn(e.share)}`;if(!t.markLabel)return n;try{let r={series:e.series,label:Je(t.seriesLabels,e.series),value:e.value},o=t.markLabel(e.datum,{key:e.key,category:e.category,values:[r],total:e.value,share:e.share,format:Ke(t),text:n});if(o!=null&&String(o).trim()!=="")return String(o)}catch(r){Se(r)}return n}function Si(e,t,n){let{center:r}=e,o=Ke(e);if(r===!1)return"";if(r===void 0){let a=Je(e.seriesLabels,t);return t==="value"&&a==="value"?o(n):`${o(n)}
88
- ${a}`}try{let a=r(n,o);return a==null?"":String(a)}catch(a){return Se(a),""}}function hl(e,t){let n=t.split(`
89
- `).join(" ").trim(),r=e?.trim();return n===""?e:r?/[.!?:;]$/.test(r)?`${r} ${n}`:`${r}. ${n}`:n}function gl(e,t){let n=[...t];return e.forEach((r,o)=>{if(n.includes(r))return;let a=0;for(let i=o-1;i>=0;i--){let s=n.indexOf(e[i]);if(s>=0){a=s+1;break}}n.splice(a,0,r)}),n}var Di=["UTC","local"],Zo=1e3,Wr=60*Zo,Ur=60*Wr,_r=24*Ur,Uo={second:Zo,minute:Wr,hour:Ur,day:_r+Ur,week:7*_r+Ur,month:31*_r,year:366*_r},bl=[...[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}],Ht=["year","month","day","hour","minute","second","millisecond"],wl={second:"second",minute:"minute",hour:"hour",day:"day",week:"day",month:"month",year:"year"},vl={fractionalSecondDigits:3},Wo={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",...vl}};function kl(e){for(let t of bl)if(Uo[t.unit]*t.count>=e)return t;return{unit:"year",count:Math.max(1,ir(e/Uo.year))}}function Ti(e,t,n){let r=Sl(n);if(!(t>e))return[{value:e,text:r(e,"year")}];let o=kl((t-e)/4),a=Ht[Math.min(Ht.indexOf(wl[o.unit]),Ht.indexOf(xl(e,t,n)))],i=Ml(e,t,o,n).map(s=>({value:s,text:r(s,"millisecond")}));return[{value:e,text:r(e,a)},...i,{value:t,text:r(t,a)}]}function xl(e,t,n){let[r,o]=[_n(e,n),_n(t,n)];return r.year!==o.year?"year":r.month!==o.month?"month":r.date!==o.date?"day":r.hours!==o.hours?"hour":r.minutes!==o.minutes?"minute":"second"}function Ml(e,t,n,r){let{unit:o,count:a}=n,i=[],s=_n(e,r);if(o==="second"||o==="minute"||o==="hour"){let l=o==="hour"?15*Wr:Uo[o],u=e-s.ms-(o==="second"?0:s.seconds*Zo)-(o==="hour"?s.minutes%15*Wr:0);for(;u<t;u+=l){let m=_n(u,r),p=o!=="hour"||m.minutes===0,k=o==="second"?m.seconds:o==="minute"?m.minutes:m.hours;u>e&&p&&k%a===0&&i.push(u)}return i}let c=o==="day"?l=>Kr(r,s.year,s.month,s.date+l):o==="week"?l=>Kr(r,s.year,s.month,s.date-(s.weekday+6)%7+7*l):o==="month"?l=>Kr(r,s.year,Math.floor(s.month/a)*a+a*l,1):l=>Kr(r,Math.floor(s.year/a)*a+a*l,0,1),d=-1/0;for(let l=0;;l++){let u=c(l);if(u>=t||u<=d)break;d=u,u>e&&(o!=="day"||(_n(u,r).date-1)%a===0)&&i.push(u)}return i}function Ri(e,t){let{ms:n,seconds:r,minutes:o,hours:a,date:i,month:s}=_n(e,t);return n!==0?"millisecond":r!==0?"second":o!==0?"minute":a!==0?"hour":i!==1?"day":s!==0?"month":"year"}function Ci(e,t){let n=e.reduce((s,c)=>Math.max(s,Ht.indexOf(Ri(c,t))),0),r=Li(t),o=n>=Ht.indexOf("second")?"medium":n>=Ht.indexOf("hour")?"short":void 0,a=n===Ht.indexOf("millisecond")?{year:"numeric",...Wo.day,...Wo.millisecond,timeZone:r}:{dateStyle:"medium",...o?{timeStyle:o}:{},timeZone:r},i=new Intl.DateTimeFormat(void 0,a);return s=>i.format(s)}function Sl(e){let t=new Map;return(n,r)=>{let o=Ht.indexOf(Ri(n,e)),a={};for(let c=Math.min(o,Ht.indexOf(r));c<=o;c++)Object.assign(a,Wo[Ht[c]]);let i=JSON.stringify(a),s=t.get(i);return s||t.set(i,s=new Intl.DateTimeFormat(void 0,{...a,timeZone:Li(e)})),s.format(n)}}var Li=e=>e==="UTC"?"UTC":void 0;function _n(e,t){let n=new Date(e);return t==="UTC"?{year:n.getUTCFullYear(),month:n.getUTCMonth(),date:n.getUTCDate(),weekday:n.getUTCDay(),hours:n.getUTCHours(),minutes:n.getUTCMinutes(),seconds:n.getUTCSeconds(),ms:n.getUTCMilliseconds()}:{year:n.getFullYear(),month:n.getMonth(),date:n.getDate(),weekday:n.getDay(),hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds(),ms:n.getMilliseconds()}}function Kr(e,t,n,r){let o=new Date(0);return e==="UTC"?(o.setUTCFullYear(t,n,r),o.setUTCHours(0,0,0,0)):(o.setFullYear(t,n,r),o.setHours(0,0,0,0)),o.getTime()}var Qo=2.25,ur=4.5,El=300,Pi=12,Dl=32,Ai=8,Yo=11,Xo=12.5,$i=10,Tl=16,qo=8,Gi=.36;function Ii(e){let{x:t,series:n,key:r}=e;if(typeof t!="string"&&typeof t!="function")throw new 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 new TypeError("lineChart needs series: the numeric fields to draw as lines.");let o=new Set;for(let c of n){if(typeof c!="string"||c==="")throw new TypeError(`lineChart: each series must be a field name, got ${dr(c)}.`);if(o.has(c))throw new TypeError(`lineChart: "${c}" appears twice in series.`);o.add(c)}if(r!==void 0&&typeof r!="string"&&typeof r!="function")throw new 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 new TypeError("lineChart: labels must be false or a function that returns a line's end label.");let i=e.timeZone??"UTC";if(!Di.includes(i))throw new TypeError(`lineChart: timeZone must be "UTC" or "local", got ${dr(i)}.`);let s=e.xFormat;if(s!==void 0&&typeof s!="function")throw new TypeError("lineChart: xFormat must be a function that turns an x into text.");return{x:Jo(t),key:r===void 0?void 0:Jo(r),series:n.map(c=>({series:c,value:Jo(c)})),timeZone:i,xFormat:e.xFormat}}function Vi(e){let{width:t,measure:n}=e,r=e.height??El,{rows:o,time:a}=Pl(e),i=e.encoding.series.map(M=>M.series),s=Lo(o.flatMap(M=>M.values.map(E=>E.value))),c=s.ticks.map(e.format),d=o[0]?.x??0,l=o[o.length-1]?.x??0,u=o.length===0?[]:a?Ti(d,l,e.encoding.timeZone):Cl(d,l).map(M=>({value:M,text:oa(M)})),m=u.map(M=>M.value),p=u.map(M=>M.text),k=p.map(M=>n(M,"ec-tick",Yo)),h=e.label?Oi(Gl(o,e.label),"ec-value",Xo,n):0,T=Math.max(Oi(c,"ec-tick",Yo,n)+10,(k[0]??0)/2+2),V=Math.max(Ai+2,(k[k.length-1]??0)/2+2,h>0?$i+h+4:0),G={scale:{lo:s.lo,hi:s.hi},box:{xLo:d,xHi:l,left:T,right:Math.max(T,t-V),top:Pi,bottom:Math.max(Pi,r-Dl),width:t,height:r}},H={};for(let M of i)H[M]=0;for(let M of o)for(let E of M.values)H[E.series]=Math.max(H[E.series],Bt(E.value));let b=m.map((M,E)=>ra(G,M,p[E]));return{width:t,height:r,frame:G,rows:o,time:a,series:i,yTicks:s.ticks.map((M,E)=>na(G,M,c[E])),xTicks:Ll(b,k),decimals:H}}function Kn(e){let{scale:t,box:n}=e,r=n.xHi-n.xLo,o=t.hi-t.lo;return{x:a=>r>0?n.left+(a-n.xLo)/r*(n.right-n.left):(n.left+n.right)/2,y:a=>o>0?n.bottom-(a-t.lo)/o*(n.bottom-n.top):n.bottom}}function ea(e,t,n,r,o=!1){if(!t[0])return[];let i=Kn(e),s=0;for(;s+1<t.length&&t[s+1].x<=r;)s++;let c=t[s],d=t[s+1],l=d&&d.x>c.x&&r>c.x?(r-c.x)/(d.x-c.x):void 0,u=t.slice(0,s+1),m=new Map,p=h=>T=>T===h?void 0:m.get(T);return n.map(h=>{let T=u.map(P=>({at:P.x,value:P.values[h]??0}));if(l!==void 0){let P=c.values[h]??0;T.push({at:r,value:P+l*((d.values[h]??0)-P)})}let V=T.map(P=>({x:i.x(P.at),y:i.y(P.value)})),G=qe.line({key:h,series:h,points:V,width:Qo}),H=0,b=T.map((P,L)=>(L>0&&(H+=Math.hypot(V[L].x-V[L-1].x,V[L].y-V[L-1].y)),{t:G.length>0?L===T.length-1?1:Math.min(1,H/G.length):0,value:P.value,at:Hi(P.at,o)})),M={datum:c.datum,samples:b,related:p(h)};m.set(h,M);let E=T[T.length-1];return{series:h,geometry:G,data:M,end:{...V[V.length-1],value:E.value}}})}function fr(e,t){return`${e}@${t}`}function ta(e,t,n,r=!1){let o=Kn(e),a=o.x(t.x),i=new Map;return n.map(s=>{let c=t.values[s]??0,d=fr(s,t.key),l={datum:t.datum,samples:[{t:0,value:c,at:Hi(t.x,r)}],related:u=>u===s?void 0:i.get(u)};return i.set(s,l),{key:d,series:s,geometry:qe.point({key:d,series:s,x:a,y:o.y(c),r:ur}),data:l}})}function Ni(e,t){let{width:n,height:r}=e.box;return t.map((o,a)=>{let i=a===0?0:(t[a-1]+o)/2,s=a===t.length-1?n:(o+t[a+1])/2;return{x:i,y:0,width:Math.max(0,s-i),height:r}})}function Fi(e,t){return{x1:t,y1:e.box.top,x2:t,y2:e.box.bottom}}function Bi(e,t){let n=Xo/2,r=Rl(t.map(o=>o.y),Tl,n,e.box.height-n);return t.map((o,a)=>({x:o.x+$i,y:r[a]+Xo*Gi,anchor:"start",text:o.text}))}function Rl(e,t,n,r){let o=e.map((c,d)=>({value:c,index:d})).sort((c,d)=>c.value-d.value||c.index-d.index),a=[],i=c=>{let d=c.reduce((u,m)=>u+m.value,0)/c.length,l=(c.length-1)*t;return Math.max(n,Math.min(r-l,d-l/2))};for(let c of o)for(a.push({members:[c],start:i([c])});a.length>1;){let d=a[a.length-1],l=a[a.length-2];if(d.start-(l.start+(l.members.length-1)*t)>=t)break;a.pop(),l.members.push(...d.members),l.start=i(l.members)}let s=new Array(e.length);for(let c of a)c.members.forEach((d,l)=>s[d.index]=c.start+l*t);return s}function na(e,t,n){let{box:r}=e,o=Kn(e).y(t);return{value:t,line:{x1:r.left,y1:o,x2:r.right+Ai,y2:o},label:{x:r.left-8,y:o+Yo*Gi,anchor:"end",text:n}}}function ra(e,t,n){return{value:t,label:{x:Kn(e).x(t),y:e.box.bottom+18,anchor:"middle",text:n}}}function Cl(e,t){if(!(t>e))return[e];let n=ir((t-e)/4),r=[e];for(let o=Math.floor(e/n)+1;Mn(o*n)<t;o++){let a=Mn(o*n);a>e&&r.push(a)}return r.push(t),r}function oa(e){return String(e)}function Ll(e,t){if(e.length<=1)return[...e];let n=e.map((a,i)=>({tick:a,from:a.label.x-t[i]/2,to:a.label.x+t[i]/2})),r=n[n.length-1],o=[n[0]];for(let a of n.slice(1,-1))a.from-o[o.length-1].to>=qo&&r.from-a.to>=qo&&o.push(a);return r.from-o[o.length-1].to>=qo&&o.push(r),o.map(a=>a.tick)}function Pl({data:e,encoding:t}){let n=new Set,r=!1,o=e.map((i,s)=>{let c=t.x(i,s);s===0&&(r=c instanceof Date);let d=Ol(c,s,r),l=String(t.key?t.key(i,s):r?new Date(d).toISOString():d);if(n.has(l))throw new Error(`lineChart: two rows have the key "${l}". Keys must be unique.`);n.add(l);let u=t.series.map(({series:m,value:p})=>({series:m,value:$l(p(i,s),m,l)}));return{key:l,datum:i,index:s,x:d,values:u}});o.sort((i,s)=>i.x-s.x);for(let i=1;i<o.length;i++){let[s,c]=[o[i-1],o[i]];if(s.x===c.x){let d=r?new Date(s.x).toISOString():oa(s.x);throw new Error(`lineChart: the rows "${s.key}" and "${c.key}" have the same x, ${d}. Each x is one point on every line, so x values must be unique.`)}}let a=Al(t,r,o.map(i=>i.x));return{rows:o.map(i=>({...i,label:a(i.x)})),time:r}}function Ol(e,t,n){if(e instanceof Date){if(!n)throw new 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 new TypeError(`lineChart: x must be a valid Date, got an invalid Date in row ${t}.`);return r}if(n)throw typeof e=="number"?new TypeError(`lineChart: x must be all numbers or all Dates, but row 0's is a Date and row ${t}'s a number.`):new TypeError(`lineChart: x must be a valid Date, got ${dr(e)} in row ${t}.`);if(typeof e!="number"||!Number.isFinite(e))throw new RangeError(`lineChart: x must be a finite number, got ${dr(e)} in row ${t}.`);return e}function Al(e,t,n){let{xFormat:r}=e;return r?o=>r(t?new Date(o):o):t?Ci(n,e.timeZone):oa}function Hi(e,t){return t?new Date(e):e}function $l(e,t,n){if(typeof e=="number"&&Number.isFinite(e))return e;throw new RangeError(`lineChart: "${t}" for "${n}" must be a finite number, got ${dr(e)}. Lines can't skip a value yet.`)}function Gl(e,t){let n=new Map;for(let r of e)for(let{series:o,value:a}of r.values){let i=t(o,a),s=i.replace(/\d/g,"0");n.has(s)||n.set(s,i)}return[...n.values()]}function Oi(e,t,n,r){return e.reduce((o,a)=>Math.max(o,r(a,t,n)),0)}function Jo(e){return typeof e=="function"?e:t=>t[e]}var dr=e=>typeof e=="string"?JSON.stringify(e):String(e);var Zr=500,ji=2,Il=2,Vl=.5;function aa(e,t,n){let r=rn(e,"lineChart");hn(t,"lineChart");let o=t,a=en(t.motion,n.motion),i=Ft(t.on,n.presets),s=Rt(t.colors),c=n.clock??Ne,d=r.ownerDocument;lt(d);let l=Y("svg",{class:"ec-chart ec-line-chart",role:"group"},r),u=Y("g",{class:"ec-grid","aria-hidden":"true"},l),m=Y("g",{class:"ec-axis","aria-hidden":"true"},l),p=Y("line",{class:"ec-crosshair","aria-hidden":"true",visibility:"hidden"},l),k=Y("g",{class:"ec-focus","aria-hidden":"true",visibility:"hidden"},l),h=Y("g",{class:"ec-marks","aria-hidden":"true"},l),T=Y("g",{class:"ec-lines"},h),V=Y("g",{class:"ec-points"},h),G=Y("g",{class:"ec-columns"},l),H=Y("g",{class:"ec-overlay","aria-hidden":"true"},l),b=Dn(l),M=[],E=new Map,P=new Map,L=new WeakMap,D=[],K=new Map,x=new Map,C=Cn(y=>y.kind==="line"?y.presence.animating:y.row.presence.animating||y.row.values.animating||y.row.x.animating),B=Tn("lineChart"),_=On(r),re=!1,ae=1/0,X=new WeakSet,J,ce,le;try{J=Ie(o),ce=tt(o,J),le=Ui(o,J)}catch(y){throw l.remove(),y}let ge=y=>x.get(y)??K.get(y)??C.get(y),O=tn({overlay:H,mark:y=>({set:A=>{ge(y)?.handle.set(A),Le.restyled(y)},reset:()=>{ge(y)?.handle.reset(),Le.restyled(y)}}),colors:y=>ge(y)?.parts[0]?.colors}),F=Xt({effects:i,motion:a,icons:n.icons,clock:c,surface:O}),Q=Bn(l,{motion:a,option:()=>o.tooltip,description:()=>o.markDescription}),de=En(l),ye=Pn(l),ke=o.announce?Tt(l):void 0,Ce=!1,Oe=()=>{Ce=!0},Ue=Fe(J.frame.scale,ht,{clock:c,motion:a,onChange:Oe}),Te=Fe(J.frame.box,ht,{clock:c,motion:a,onChange:Oe}),$e=new Map,He=new Map,et=J.decimals,ft={changed:[],added:[],removed:[]},rt=J.frame,me=Gn({clock:c,runner:F,leaving:C,draw:We,land:z});function Ie(y,A=i){let I=Ii(y),q=I.series.map(ee=>ee.series);An(A,q,"lineChart");let U=Vi({data:y.data,encoding:I,width:y.width??_,height:y.height,format:Ke(y),measure:b,label:je(y,!0)}),W=new Set(U.series);for(let ee of U.rows)for(let fe of U.series){let pe=fr(fe,ee.key);if(W.has(pe))throw new RangeError(`lineChart: two marks would have the key "${pe}". Series and keys joined with "@" must be unique.`);W.add(pe)}for(let ee of U.rows)if(W.has(ee.key))throw new RangeError(`lineChart: the key "${ee.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 U}function je(y,A=!1){let{labels:I}=y;if(I===!1)return;let q=Ke(y);return(U,W)=>{let ee=`${q(W)} ${Je(y.seriesLabels,U)}`;if(typeof I!="function")return ee;try{let fe=I(W,U,q);return fe==null?"":String(fe)}catch(fe){return!A&&!X.has(I)&&(X.add(I),Se(fe)),ee}}}function ot(y){let A=y.rows.map(zi);return{lines:new Map(ea(y.frame,A,y.series,Pt(y),y.time).map(I=>[I.series,I])),points:new Map(A.flatMap(I=>ta(y.frame,I,y.series,y.time)).map(I=>[I.key,I]))}}function Lt(y){let A=y.rows[0],I=y.rows[y.rows.length-1];return A&&I?Math.min(Math.max(ae,A.x),I.x):ae}function Pt(y){let A=y.rows[y.rows.length-1];return A&&ae<A.x?Lt(y):1/0}let Ze=y=>!y.leaving&&y.row.x<=Lt(J);function vt(y,A){let I=Y("g",{class:"ec-column","data-key":y.key,role:"img"},G),q={clock:c,motion:a,onChange:Oe},U={key:y.key,row:y,column:I,hit:Y("rect",{class:"ec-hit"},I),x:Fe(y.x,nt,q),values:Fe(mr(y.values),ht,q),presence:Fe(A?0:1,nt,q),anchor:void 0,points:[],leaving:!1,shown:!0};return L.set(I,U),U}function xt(y,A,I){let q=Y("g",{class:"ec-line","data-key":y,"data-series":y},T),U=Y("g",{class:"ec-body"},q),W={kind:"line",key:y,series:y,group:q,body:U,path:Y("path",{class:"ec-stroke","stroke-width":Qo},U),end:Y("circle",{class:"ec-end",r:ur},U),label:Y("text",{class:"ec-value ec-end-label"},q),drawnLabel:void 0,parts:[],handle:fn(()=>W),target:A,shown:A,presence:Fe(I?0:1,nt,{clock:c,motion:a,onChange:Oe}),leave:void 0};return W}function Mt(y,A){let I=Y("g",{class:"ec-point","data-key":A.key,"data-series":A.series},V),q=Y("g",{class:"ec-body"},I),U={kind:"point",key:A.key,series:A.series,row:y,group:I,body:q,path:Y("path",{class:"ec-dot"},q),parts:[],handle:fn(()=>U),target:A,shown:A,hidden:void 0,leave:void 0};return U}let jt=y=>ge(y.key)===y,Ge=y=>y.points.filter(A=>x.get(A.key)===A),St=()=>[...C.values()].filter(y=>y.kind==="line"),Ot=()=>({scale:Ue.value,box:Te.value});function qt(){let y=W=>({x:W.x.value,values:W.values.value}),A=new Map,I=new Set,q=W=>{let ee=A.get(W);if(ee)return ee;let fe=W.presence.value,pe=y(W);if(W.anchor&&fe<1&&!I.has(W)){I.add(W);let Ee=q(W.anchor);I.delete(W),pe={x:Ee.x+fe*(pe.x-Ee.x),values:ht(Ee.values,pe.values)(fe)}}return A.set(W,pe),pe};return[...M,...[...P.values()].filter(W=>W.presence.value>0&&W.anchor)].map(W=>{let{x:ee,values:fe}=q(W);return{record:W,state:{key:W.key,datum:W.row.datum,x:ee,values:fe}}}).sort((W,ee)=>W.state.x-ee.state.x)}function We(){if(!Ce)return;Ce=!1;let y=Ot(),A=qt();w(y),S(y,A.map(I=>I.state));for(let{record:I,state:q}of A){let U=new Map(ta(y,q,I.points.map(W=>W.series),J.time).map(W=>[W.key,W]));g(I.points.filter(jt).map(W=>({record:W,placed:U.get(W.key)})))}j(y,A),he()}function v(){let y=Ot(),A=qt();S(y,A.map(I=>I.state)),j(y,A),he()}function z(){for(let U of P.values()){for(let W of[U.x,U.values,U.presence])W.stop();U.column.remove()}P.clear();for(let U of M)U.anchor=void 0,U.points=U.points.filter(jt);for(let[U,W]of[[$e,J.yTicks],[He,J.xTicks]]){for(let ee of[...U.values()])ee.wanted||(ee.line?.remove(),ee.label.remove(),U.delete(ee.value));for(let ee of W){let fe=U.get(ee.value);fe&&(fe.line&&"line"in ee&&ie(fe.line,{...ee.line,opacity:void 0}),wt(fe.label,ee.label),fe.label.removeAttribute("opacity"))}}et=J.decimals;let{frame:y}=J;ie(l,Ct(y.box)),rt=y;let A=ot(J),I=(U,W)=>{let ee=U.flatMap(pe=>{let Ee=W(pe);return Ee?[{record:pe,to:Ee}]:[]});if(!ee.every(({record:pe,to:Ee})=>Nl(pe.target.geometry,Ee.geometry)&&Ki(pe.target.data,Ee.data)))for(let{record:pe,to:Ee}of ee)pe.target=Ee;g(ee.map(({record:pe})=>({record:pe,placed:pe.target})))};I(D,U=>A.lines.get(U.series)),f(y,new Map(D.flatMap(U=>A.lines.has(U.series)?[[U,A.lines.get(U.series)]]:[])));let q=M.map(U=>({record:U,state:zi(U.row)}));for(let{record:U}of q)I(Ge(U),W=>A.points.get(W.key));j(y,q),he(),Ce=!1}function w(y){rt=y,ie(l,Ct(y.box));let A=Ke(o);for(let I of $e.values()){let q=na(y,I.value,A(I.value)),U=I.opacity.value<1?I.opacity.value:void 0;ie(I.line,{...q.line,opacity:U}),wt(I.label,q.label),ie(I.label,{opacity:U})}for(let I of He.values())wt(I.label,ra(y,I.value,I.text).label),ie(I.label,{opacity:I.opacity.value<1?I.opacity.value:void 0})}function S(y,A){let I=[...D,...St()];if(A.length===0||I.length===0)return;let q=ea(y,A,I.map(U=>U.series),Pt(J),J.time);g(I.map((U,W)=>({record:U,placed:q[W]}))),f(y,new Map(I.map((U,W)=>[U,q[W]])))}function f(y,A){let I=je(o),q=[...A],U=I?Bi(y,q.map(([W,{end:ee}])=>({x:ee.x,y:ee.y,text:I(W.series,mn(ee.value,et[W.series]??Bt(ee.value)))}))):[];q.forEach(([W],ee)=>{let fe=U[ee];fe&&wt(W.label,fe),W.drawnLabel=fe&&fe.text!==""?fe:void 0,ie(W.label,{visibility:W.drawnLabel?void 0:"hidden"})})}function g(y){let A=y.some(({record:I,placed:q})=>!Ki(I.shown.data,q.data));for(let{record:I,placed:q}of y)I.kind==="line"?$(I,q,A):R(I,q,A)}function $(y,A,I){let q=I||an(y.shown.geometry,A.geometry);y.shown=A;let{geometry:U}=A;N(y,Xe(s.slot(y.series)),{visible:U.length>=Vl,open:{width:U.thickness}}),ie(y.end,{cx:U.end.x,cy:U.end.y});let W=y.presence.value;ie(y.group,{opacity:W<1?W:void 0}),q&&F.change(U,A.data)}function R(y,A,I){let q=I||an(y.shown.geometry,A.geometry);y.shown=A,N(y,Xe(s.slot(y.series)),{visible:!0}),q&&F.change(A.geometry,A.data)}function N(y,A,I){let q=y.parts[0],{d:U}=y.shown.geometry.outline,W=q?.colors.color!==A.color;!W&&q?.d===U&&q.visible===I.visible&&q.open?.width===I.open?.width||(y.path.getAttribute("d")!==U&&y.path.setAttribute("d",U),W&&Ae(y.group,ct(A)),y.parts=[{element:y.path,d:U,colors:A,...I}],y.handle.repaint(),q&&W&&O.recolor(y.key))}function j(y,A){let{x:I}=Kn(y),q=A.filter(({record:ee})=>Ze(ee)),U=Ni(y,q.map(({state:ee})=>I(ee.x)));q.forEach(({record:ee},fe)=>ie(ee.hit,{...U[fe]}));let W=new Set(q.map(({record:ee})=>ee));for(let ee of[...M,...P.values()]){let fe=W.has(ee);ee.shown!==fe&&(ee.shown=fe,ie(ee.column,{visibility:fe?void 0:"hidden","aria-hidden":ee.leaving?"true":void 0}));let pe=!Ze(ee);for(let Ee of ee.points)Ee.hidden!==pe&&(Ee.hidden=pe,ie(Ee.group,{visibility:pe?"hidden":void 0}),O.hide(Ee.key,pe))}}function Z(y){let A=E.get(y),I=A&&Ze(A)?Ge(A):[],q=I[0];if(!A||!q)return;let U=q.shown.geometry.center.x;ie(p,{...Fi(rt,U),visibility:void 0});let W=I.map(fe=>{let{transform:pe}=fe.handle.style,{center:Ee}=fe.shown.geometry;return(pe?ve.apply(pe,Ee):Ee).y}),{row:ee}=A;Q.showAt({x:U,top:Math.min(...W)-ur,bottom:Math.max(...W)+ur},ee,()=>Br(ee.label,Zi(ee.values,o),Ke(o),{total:!1}))}function oe(){p.setAttribute("visibility","hidden"),Q.hide()}function Me(y){let A=y===void 0?void 0:E.get(y),I=A&&Ze(A)?Ge(A):[];for(;k.childElementCount>I.length;)k.lastElementChild.remove();I.forEach((q,U)=>{let W=k.children[U];W||(W=Y("g",{},k),Y("path",{class:"ec-focus-ring","stroke-width":2*(ji+Il)},W),Y("path",{class:"ec-focus-gap","stroke-width":2*ji},W));for(let fe of Array.from(W.children))fe.setAttribute("d",q.shown.geometry.outline.d);let{transform:ee}=q.handle.style;ie(W,{transform:ee&&dt(ee)})}),ie(k,{visibility:I.length>0?void 0:"hidden"})}function he(){Le.key!==void 0&&Z(Le.key),Le.ringKey!==void 0&&Me(Le.ringKey)}let te=y=>({mark:y.target.geometry,data:y.target.data}),be=y=>({mark:y.shown.geometry,data:y.shown.data});function Ve(y){let A=y,I=typeof A?.closest=="function"?A.closest(".ec-column"):null,q=I?L.get(I):void 0;return q&&E.get(q.key)===q&&Ze(q)?q:void 0}let Le=Rn({svg:l,runner:F,events:B,dim:()=>!1,find(y){let A=Ve(y);return A&&{key:A.key}},live(y){let A=E.get(y);return A!==void 0&&Ze(A)},order:()=>M.filter(Ze).map(y=>y.key),marks:y=>{let A=E.get(y);return A?Ge(A).map(I=>I.key):[]},element:y=>(E.get(y)??P.get(y))?.column,markElement:y=>ge(y)?.group,onScreen(y){let A=ge(y);return A&&be(A)},ring:Me,tooltip:{show:Z,hide:oe}}),mt=()=>de.update(J.series.map(y=>({series:y,label:Je(o.seriesLabels,y)})),s,o.legend);function tt(y,A){return Ln({option:y.table,caption:y.label,category:typeof y.x=="string"?y.x:void 0,series:A.series,label:I=>Je(y.seriesLabels,I),rows:A.rows.map(I=>({key:I.key,category:I.label,datum:I.datum,index:I.index,values:I.values,total:Wi(I.values)})),format:Ke(y),total:!1})}function kt(y){y.column.setAttribute("aria-label",le.get(y.key)),Q.describe(y.column,y.row)}function Et(y,A){let I=o.announce;if(!ke||!I)return;let q=J.series,U=Re=>Re.row.label,{changed:W,added:ee,removed:fe}=ft,pe=kn({...o.label!==y.label?{label:o.label}:{},...q.join(`
90
- `)!==A.join(`
91
- `)?{series:q.map(Re=>Je(o.seriesLabels,Re))}:{},changed:W.map(U),added:ee.map(U),removed:fe.map(U),count:M.length});if(typeof I!="function"){ke.say(pe);return}let Ee=Re=>Re.key;try{let Re=I({text:pe,changed:W.map(Ee),added:ee.map(Ee),removed:fe.map(Ee)});Re!=null&&ke.say(String(Re))}catch(Re){Se(Re)}}function cn(y){J=y;let A=ot(y),I={entering:[],exiting:[],changed:[]},q=new Set(y.rows.map(ne=>ne.key)),U=y.rows.length>0?y.series:[],W={changed:[],added:[],removed:[]},ee=M,fe=new Map(ee.map(ne=>[ne,ne.row])),pe=D.filter(ne=>!U.includes(ne.series)),Ee=[];for(let ne of ee){let we=!q.has(ne.key);we&&(E.delete(ne.key),ne.leaving=!0,P.set(ne.key,ne),W.removed.push(ne));for(let ze of Ge(ne))(we||!U.includes(ze.series))&&Ee.push(ze)}for(let ne of pe)K.delete(ne.series);for(let ne of Ee)x.delete(ne.key);for(let ne of[...pe,...Ee])C.start(ne);I.exiting.push(...pe,...Ee);let Re=new Set,ue=W.removed.length>0;M=y.rows.map(ne=>{let we=E.get(ne.key);return we?(Re.add(we),we.row.x!==ne.x&&(ue=!0),ne.values.some((ze,bn)=>we.row.values[bn]?.series!==ze.series||we.row.values[bn]?.value!==ze.value)&&W.changed.push(we)):(we=P.get(ne.key)??vt(ne,!0),P.delete(ne.key),we.leaving=!1,we.x.set(ne.x),we.values.set(mr(ne.values)),E.set(ne.key,we),W.added.push(we),ue=!0),we.row=ne,we}),M.forEach((ne,we)=>{Re.has(ne)?ne.presence.value===1&&(ne.anchor=void 0):ne.anchor=_i(M,we,Re)});for(let ne of W.removed)ne.anchor??(ne.anchor=_i(ee,ee.indexOf(ne),Re));let _t=D;D=U.map(ne=>{let we=K.get(ne),ze=A.lines.get(ne);if(we){let bn=[...Re].some(Kt=>qr(fe.get(Kt),ne)!==qr(Kt.row,ne));(ue||bn)&&I.changed.push({record:we,from:we.shown.geometry})}else we=Dt(ne,"line")??xt(ne,ze,!0),K.set(ne,we),I.entering.push(we);return we.target=ze,we});for(let ne of M){let we=Re.has(ne)?fe.get(ne):void 0,ze=U.map(Kt=>{let kr=fr(Kt,ne.key),Ta=A.points.get(kr),Ut=x.get(kr);return Ut?we&&qr(we,Kt)!==qr(ne.row,Kt)&&I.changed.push({record:Ut,from:Ut.shown.geometry}):(Ut=Dt(kr,"point")??Mt(ne,Ta),Ut.row=ne,x.set(kr,Ut),I.entering.push(Ut)),Ut.target=Ta,Ut}),bn=new Set(ze);ne.points=[...ze,...ne.points.filter(Kt=>!bn.has(Kt)&&jt(Kt))]}for(let ne of M)kt(ne);return pn(G,ee.filter(ne=>!ne.leaving).map(ne=>ne.column),M.map(ne=>ne.column),Le.active),pn(T,_t.map(ne=>ne.group),D.map(ne=>ne.group),()=>null),ft=W,Ce=!0,We(),I}function Dt(y,A){return C.get(y)?.kind===A?C.recall(y):void 0}function mo(y,A){Ce=!0;let{frame:I}=y;for(let[ue,_t,ne]of[[$e,y.yTicks,!0],[He,y.xTicks,!1]]){let we=new Set(_t.map(ze=>ze.value));for(let ze of we)ue.has(ze)||se(ue,ze,0,ne);for(let ze of ue.values())ze.wanted=we.has(ze.value)}for(let ue of y.xTicks)He.get(ue.value).text=ue.label.text;let q=St(),U=[...P.values()],W=Pe(Ue,I.scale,Be)||[...$e.values()].some(ue=>Pe(ue.opacity,ue.wanted?1:0,xe))||M.some(ue=>Pe(ue.values,mr(ue.row.values),Be))||D.some(ue=>Pe(ue.presence,1,xe))||q.some(ue=>Pe(ue.presence,0,xe)),ee=Pe(Te,I.box,Be)||[...He.values()].some(ue=>Pe(ue.opacity,ue.wanted?1:0,xe))||M.some(ue=>Pe(ue.x,ue.row.x,xe)||ue.anchor!==void 0&&Pe(ue.presence,1,xe))||U.some(ue=>ue.anchor!==void 0&&Pe(ue.presence,0,xe)),fe,pe;!A&&a.staged?(fe={duration:Zr},pe={duration:Zr,delay:W?Zr:0}):A||(fe=pe={duration:(W&&ee?2:1)*Zr});let Ee=[],Re=(ue,_t,ne,we)=>{Pe(ue,_t,ne)&&(we?Ee.push(ue.to(_t,we)):ue.set(_t))};Re(Ue,I.scale,Be,fe),Re(Te,I.box,Be,pe);for(let ue of $e.values())Re(ue.opacity,ue.wanted?1:0,xe,fe);for(let ue of He.values())Re(ue.opacity,ue.wanted?1:0,xe,pe);for(let ue of M)Re(ue.values,mr(ue.row.values),Be,fe),Re(ue.x,ue.row.x,xe,pe),Re(ue.presence,1,xe,ue.anchor?pe:void 0);for(let ue of U)Re(ue.presence,0,xe,ue.anchor?pe:void 0);for(let ue of D)Re(ue.presence,1,xe,fe);for(let ue of q)Re(ue.presence,0,xe,fe);return Ee}function se(y,A,I,q,U=""){let W={value:A,line:q?Y("line",{class:A===0?"ec-baseline":"ec-gridline"},u):void 0,label:Y("text",{class:"ec-tick"},m),text:U,opacity:Fe(I,nt,{clock:c,motion:a,onChange:Oe}),wanted:!0};y.set(A,W);for(let ee of[...y.values()].sort((fe,pe)=>fe.value-pe.value))ee.line&&u.appendChild(ee.line),m.appendChild(ee.label)}function yt(y,A){return J=y,et=Object.fromEntries(y.series.map(I=>[I,Math.max(et[I]??0,y.decimals[I]??0)])),me.run(mo(y,A))}let zt=Fn(l,a);function ln(){if(re)return;let y=Ie(o),A=new Map(y.rows.map(q=>[q.key,q]));for(let q of M)q.row=A.get(q.key)??q.row;let I=ot(y);for(let q of D)q.target=I.lines.get(q.series)??q.target;for(let q of x.values())q.target=I.points.get(q.key)??q.target;yt(y,!0)}let tc=Vn(r,c,_,y=>{_=y,o.width===void 0&&ln()}),nc=Nn(d,()=>{b.clear(),ln()});on(l,o),mt(),ye.render(ce);{let y=ot(J);for(let A of J.yTicks)se($e,A.value,1,!0);for(let A of J.xTicks)se(He,A.value,1,!1,A.label.text);M=J.rows.map(A=>{let I=vt(A,!1);return E.set(A.key,I),I.points=J.series.map(q=>{let U=Mt(I,y.points.get(fr(q,A.key)));return x.set(U.key,U),U}),kt(I),I}),D=J.rows.length>0?J.series.map(A=>xt(A,y.lines.get(A),!1)):[];for(let A of D)K.set(A.series,A);z()}let Da=()=>[...D,...M.flatMap(Ge)];return Le.sync(),F.enter(Da().map(te)),{element:l,async update(y){if(re)return;if(y.motion!==void 0&&y.motion!==o.motion)throw new TypeError("lineChart: `motion` can't be changed by update() yet.");let A={...o,...y};hn(A,"lineChart");let I="on"in y?$n(i,o.on,A.on,n.presets):i,q=Ie(A,I),U=tt(A,q),W=Ui(A,q);"colors"in y&&(s=Rt(A.colors));let ee=o,fe=J.series;o=A,le=W,on(l,o),ye.render(U);let pe=ke!==void 0;o.announce&&!ke?ke=Tt(l):!o.announce&&ke&&(ke.destroy(),ke=void 0),me.supersede();let Ee=I!==i;i=I;let Re=In({runner:F,events:B,hover:Le,leaving:C,input:te,onScreen:be,...Ee?{swap:_t=>{let ne=new Set(_t.entering);F.swap(I,Da().filter(we=>!ne.has(we)).map(te))}}:{}},()=>cn(q),()=>{pe&&Et(ee,fe)});mt();let ue=yt(q,a.mode==="off");await me.wait(ue,Re)},reveal(y){if(re)return;if(y instanceof Date&&Number.isNaN(y.getTime()))throw new RangeError("lineChart: reveal(x) needs a valid Date, got an invalid Date.");let A=y instanceof Date?y.getTime():y;if(typeof A!="number"||Number.isNaN(A))throw new RangeError(`lineChart: reveal(x) needs a number, got ${typeof A=="string"?JSON.stringify(A):String(A)}.`);let I=Lt(J);ae=A,Lt(J)!==I&&(v(),Le.dropGone(),Le.sync())},on:B.on,marks:()=>[...D.map(y=>y.shown.geometry),...M.filter(Ze).flatMap(y=>Ge(y).map(A=>A.shown.geometry))],focus(y){if(re)return;let A=E.get(y)??x.get(y)?.row;A&&Le.focus(A.key)},leave(){re||Le.leave()},labels:()=>D.flatMap(y=>nn(y.key,"value",y.drawnLabel,y.label)),destroy(){if(!re){re=!0,me.destroy(),Le.destroy(),F.destroy(),Q.destroy(),de.destroy(),ye.destroy(),ke?.destroy(),zt(),tc(),nc();for(let y of[...M,...P.values()])for(let A of[y.x,y.values,y.presence])A.stop();for(let y of[...D,...St()])y.presence.stop();for(let y of C.values())y.leave?.resolve();Ue.stop(),Te.stop();for(let y of[...$e.values(),...He.values()])y.opacity.stop();B.clear(),E.clear(),P.clear(),K.clear(),x.clear(),C.clear(),M=[],D=[],l.remove()}}}}function zi(e){return{key:e.key,datum:e.datum,x:e.x,values:mr(e.values)}}function mr(e){return Object.fromEntries(e.map(t=>[t.series,t.value]))}function qr(e,t){return e.values.find(n=>n.series===t)?.value}function Wi(e){return e.reduce((t,n)=>t+n.value,0)}function _i(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 Nl(e,t){return e.key===t.key&&!an(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 Ki(e,t){return e.datum!==t.datum||e.samples.length!==t.samples.length?!1:e.samples.every((n,r)=>{let o=t.samples[r];return n.t===o.t&&n.value===o.value&&Fl(n.at,o.at)})}function Fl(e,t){return e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function Zi(e,t){return e.map(n=>({series:n.series,label:Je(t.seriesLabels,n.series),value:n.value}))}function Ui(e,t){let n=Ke(e);return new Map(t.rows.map(r=>{let o=Zi(r.values,e),a=`${r.label}: ${o.map(i=>`${n(i.value)} ${i.label}`).join(", ")}`;if(!e.markLabel)return[r.key,a];try{let i=e.markLabel(r.datum,{key:r.key,category:r.label,values:o,total:Wi(r.values),format:n,text:a});if(i!=null&&String(i).trim()!=="")return[r.key,String(i)]}catch(i){Se(i)}return[r.key,a]}))}function yr(e){let t=ia(e.start,e.pivot);return t>.5&&Math.abs(ia(e.center,e.pivot)-t)<=.5&&Math.abs(ia(e.end,e.pivot)-t)<=.5}var ia=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y);var qi=.5,Bl=["left","right","top","bottom"];function Yi(e){return typeof e=="string"&&Bl.includes(e)}function pr(e,t){if(t!=="auto")return e.map(()=>t);if(e.length===0)return[];let n=Ji(e,a=>a.x,a=>a.x+a.width,"left","right"),r=Ji(e,a=>a.y+a.height,a=>a.y,"bottom","top");if(n&&r)return Hl(e)?n:r;let o=n??r;if(!o)throw new RangeError('expressive: baseline "auto" found no edge that every mark grows from. Pass baseline: "left", "right", "top" or "bottom".');return o}function Yr(e,t,n){let r=gn(t.map(m=>m.box)),o=jl(r,n),a=t.map((m,p)=>({index:p,...o(m.box)})).sort((m,p)=>m.near-p.near||m.far-p.far||m.index-p.index),i=0,s=1/0,c=a.map(({index:m,near:p,far:k})=>{i>0&&k>p&&(s=Math.min(s,p-i));let h=Math.max(0,k-i);return i=Math.max(i,k),{series:t[m].series,size:h}}),d=t[a[a.length-1].index],l=t.length===1?t[0].series:void 0;return{geometry:qe.bar({key:e,...l===void 0?{}:{series:l},...r,baseline:n,radius:d.radius,gap:Number.isFinite(s)?Math.max(0,Jr(s)):0,...c.every(m=>m.series!==void 0)?{segments:c.map(m=>({series:m.series,size:Jr(m.size)}))}:{}}),order:a.map(m=>m.index)}}function hr(e,t){let n=t[0]==="left"||t[0]==="right",r=a=>n?a.y:a.x,o=a=>n?a.x:a.y;return e.map((a,i)=>i).sort((a,i)=>r(e[a])-r(e[i])||o(e[a])-o(e[i])||a-i)}function gn(e){let t=Math.min(...e.map(r=>r.x)),n=Math.min(...e.map(r=>r.y));return{x:t,y:n,width:Jr(Math.max(...e.map(r=>r.x+r.width))-t),height:Jr(Math.max(...e.map(r=>r.y+r.height))-n)}}function Ji(e,t,n,r,o){let a=e[0];if(!a)return[];for(let i of[t(a),n(a)]){let s=[];for(let c of e)if(Math.abs(t(c)-i)<qi)s.push(r);else if(Math.abs(n(c)-i)<qi)s.push(o);else break;if(s.length===e.length)return s}}function Hl(e){let t=o=>Math.max(...o)-Math.min(...o),n=t(e.map(o=>o.y+o.height/2)),r=t(e.map(o=>o.x+o.width/2));return n!==r?n>r:e[0].width>=e[0].height}function jl(e,t){switch(t){case"left":return n=>({near:n.x-e.x,far:n.x+n.width-e.x});case"right":return n=>({near:e.x+e.width-(n.x+n.width),far:e.x+e.width-n.x});case"top":return n=>({near:n.y-e.y,far:n.y+n.height-e.y});case"bottom":return n=>({near:e.y+e.height-(n.y+n.height),far:e.y+e.height-n.y})}}function Jr(e){return Math.round(e*1e3)/1e3}function Xi(){let e=new Map,t=u=>{let m=e.get(u);return m||(m={attributes:new Map,styles:new Map,classes:new Set,before:{}},e.set(u,m)),m},n=u=>u.style,r=(u,m,p)=>{p===null?u.removeAttribute(m):u.getAttribute(m)!==p&&u.setAttribute(m,p)},o=(u,m)=>{let p=m.before.style;m.styles.size>0||!p||(m.before.style=void 0,n(u)?.cssText===p.css&&r(u,"style",p.text))},a=(u,m)=>{let p=m.before.class;if(m.classes.size>0||p===void 0)return;m.before.class=void 0;let k=h=>[...new Set((h??"").split(/\s+/).filter(Boolean))].sort().join(" ");k(u.getAttribute("class"))===k(p)&&r(u,"class",p)};function i(u,m,p){let k=u.getAttribute(m),h=t(u).attributes,T=h.get(m);T?(k!==T.written&&(T.original=k),T.written=p):h.set(m,{original:k,written:p}),r(u,m,p)}function s(u,m,p){if(p!==null){i(u,m,p);return}let k=e.get(u)?.attributes,h=k?.get(m);!k||!h||(u.getAttribute(m)===h.written&&r(u,m,h.original),k.delete(m))}function c(u,m,p){let k=n(u);if(!k)return;let h=t(u),T=h.styles.get(m);if(p===void 0){if(!T)return;T.value===""?k.removeProperty(m):k.setProperty(m,T.value,T.priority),h.styles.delete(m),o(u,h);return}T||(h.styles.size===0&&(h.before.style={text:u.getAttribute("style"),css:k.cssText}),h.styles.set(m,{value:k.getPropertyValue(m),priority:k.getPropertyPriority(m)})),k.getPropertyValue(m)!==p&&k.setProperty(m,p)}function d(u,m,p){let k=u.classList;if(p){if(k.contains(m))return;let T=t(u);T.classes.size===0&&(T.before.class=u.getAttribute("class")),T.classes.add(m),k.add(m);return}let h=e.get(u);h?.classes.delete(m)&&(k.remove(m),a(u,h))}function l(u){let m=e.get(u);if(m){for(let p of[...m.styles.keys()])c(u,p,void 0);for(let p of[...m.classes])d(u,p,!1);for(let p of[...m.attributes.keys()])s(u,p,null);e.delete(u)}}return{attribute:s,remove:(u,m)=>i(u,m,null),style:c,styled:(u,m)=>e.get(u)?.styles.has(m)??!1,toggleClass:d,restore:l,restoreAll(){for(let u of[...e.keys()])l(u)},elements:()=>[...e.keys()]}}function gr(){let e=new Map;return t=>(e.has(t)||e.set(t,ns(t)),e.get(t))}function Zt(e,t,n,r=ns){let o=r(e),a=o&&r(t);return o&&a?ve.multiply(vn(o),a):ve.multiply(vn(Qi(e,n)),Qi(t,n))}function br(e){return nr(e.getAttribute("transform")??"")}function es(e){let[t,n,r,o]=e,a=1e-9*Math.max(Math.abs(t),Math.abs(n),Math.abs(r),Math.abs(o));return Math.abs(n)<=a&&Math.abs(r)<=a||Math.abs(t)<=a&&Math.abs(o)<=a}function Wn(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(s=>ve.apply(e,s)),r=n.map(s=>s.x),o=n.map(s=>s.y),a=Un(Math.min(...r)),i=Un(Math.min(...o));return{x:a,y:i,width:Un(Un(Math.max(...r))-a),height:Un(Un(Math.max(...o))-i)}}function ts(e){let t=n=>{let r=e[n],o=typeof r?.baseVal?.value=="number"?r.baseVal.value:Number.parseFloat(e.getAttribute(n)??"");return Number.isFinite(o)?o:0};return{x:t("x"),y:t("y"),width:Math.max(0,t("width")),height:Math.max(0,t("height"))}}function ns(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 Qi(e,t){let n=[1,0,0,1,0,0];for(let r=e;r&&r!==t;r=r.parentElement)n=ve.multiply(br(r),n);return n}function Un(e){return Math.round(e*1e3)/1e3}function as(e,t,n){let r={},o=!1,a=Vr(),i=()=>{let{transform:c,opacity:d,emphasis:l}=r;for(let u of e()){let{element:m,colors:p}=u,k=c&&u.parentInverse?ve.multiply(u.parentInverse,c,u.parent,br(m)):void 0;t.style(m,"transform",k&&Kl(k)),t.style(m,"transform-origin",k&&"0 0"),t.style(m,"transform-box",k&&"view-box"),t.style(m,"opacity",d===void 0?void 0:String(d));let h=p?l!==void 0?_l(p,l):o?p.strong:void 0:void 0;t.style(m,"fill",p?.paint==="fill"?h:void 0),t.style(m,"stroke",p?.paint==="stroke"?h:void 0),t.style(m,"transition",l===void 0||!p?void 0:"none")}s()},s=()=>{let c=e().flatMap(d=>d.outline===void 0?[]:[{...d.outline,color:d.colors?.color}]);a.paint(n(),c,r.halo,r.transform)};return{get style(){return r},set(c){r=Wt(r,c),i()},reset(){r={},i()},repaint:i,hot(c){c!==o&&(o=c,i())}}}function is(e,t){let n=rs(e,t,"fill"),r=n===wr?"stroke":"fill",o=r==="fill"?n:rs(e,t,"stroke");if(!(o===void 0||o===wr))return{color:o,strong:`color-mix(in oklab, ${o}, ${Qe("text")} ${zl})`,paint:r}}var zl="25%",wr="none";function rs(e,t,n){let r;for(let i=e;i&&r===void 0;i=i===t?null:i.parentElement){let s=i.style?.getPropertyValue(n)||i.getAttribute(n);s&&(r=s)}let o=os(e.ownerDocument.defaultView?.getComputedStyle?.(e).getPropertyValue(n)),a=n==="fill"?o?.replace(/\s/g,"")==="rgb(0,0,0)":o===wr;return o!==void 0&&!(a&&r!==void 0)?o:os(r)}function os(e){let t=e?.trim().toLowerCase();if(!(!t||t==="inherit"||t.startsWith("url(")))return t===wr||t==="transparent"||/^rgba\((?:[^,]+,){3}\s*0(?:\.0*)?\s*\)$/.test(t)?wr:e.trim()}function _l(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 Kl(e){return`matrix(${e.map((t,n)=>n<4?Math.round(t*1e6)/1e6:Math.round(t*1e3)/1e3).join(", ")})`}function sa(e){if(typeof e=="string"){if(typeof document>"u")throw new 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(e!==null&&typeof e=="object"&&typeof e.length=="number")return{elements:Array.from(e),data:void 0};throw new TypeError("expressive needs marks: a selector, an element, a list of elements or a D3 selection.")}function ss(e){if(!ls(e))return;let{elements:t,data:n}=sa(e);return n&&new Map(t.map((r,o)=>[r,n[o]]))}function Xr(e){let t;for(let n of e){if(!cs(n))throw new TypeError(`expressive: marks must be elements, got ${String(n)}.`);let r=n.ownerSVGElement??null;if(!r){let o=n.localName;throw new TypeError(o==="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 <${o}>.`)}for(;r.ownerSVGElement;)r=r.ownerSVGElement;if(t&&r!==t)throw new TypeError("expressive: all marks must be in the same <svg>.");t=r}if(!t)throw new TypeError("expressive: no marks.");return t}function Qr(e,t){let n=e[0].parentElement??t;for(;n!==t&&!e.every(r=>r!==n&&n.contains(r));)n=n.parentElement??t;return n}function cs(e){return typeof e=="object"&&e!==null&&e.nodeType===1}function ls(e){return typeof e=="object"&&e!==null&&typeof e.nodes=="function"&&typeof e.data=="function"}var Ul=["d","x","y","width","height","cx","cy","r","points","transform"],Wl=["transform","style"];function ds(e,t,n){let r=e.defaultView?.MutationObserver??(typeof MutationObserver>"u"?void 0:MutationObserver);if(!r)throw new TypeError("expressive: watch needs MutationObserver, which this DOM doesn't have.");let o=new Set,a=new Set,i=new Set,s=new Set,c,d=p=>{for(let{target:k,attributeName:h}of p){let T=k;i.has(T)&&o.add(T),s.has(T)&&(h==="transform"||h==="style")&&a.add(T)}},l=new r(p=>{d(p),(o.size>0||a.size>0)&&!c&&(c=t.onFrame(u))});function u(){if(d(l.takeRecords()),o.size===0&&a.size===0){c?.(),c=void 0;return}let p={marks:o,ancestors:a};o=new Set,a=new Set,n(p)}function m(){l.takeRecords(),c?.(),c=void 0,o=new Set,a=new Set}return{observe(p,k){m(),l.disconnect(),i=new Set(p),s=new Set;for(let h of p)for(let T=h.parentElement;T&&!s.has(T);T=T===k?null:T.parentElement)s.add(T);for(let h of s)i.has(h)||l.observe(h,{attributes:!0,attributeFilter:Wl});for(let h of i)l.observe(h,{attributes:!0,attributeFilter:Ul})},destroy(){m(),l.disconnect(),i=new Set,s=new Set}}}var Zl="http://www.w3.org/2000/svg",us={index:0,count:1},ql=new Set(["img","image","graphics-symbol","graphics-object"]);function Zn(e,t,n){Jl(t);let r=en(t.motion,n.motion),o=Ft(t.on,n.presets),a=n.clock??Ne,i=t.dim===!0,s=Xi(),c=new WeakMap,d=e,l=!1,u=!1;function m(w){let{elements:S,data:f}=sa(w);if(S.length===0)return{root:void 0,ancestor:void 0,marks:[]};let g=Xr(S),$=Qr(S,g),R=new Map;S.forEach((be,Ve)=>{let Le=H(be,Ve,f),mt=t.key(Le,be);if(mt==null||mt==="")throw new TypeError(`expressive: key returned ${JSON.stringify(mt)??String(mt)} for a <${be.localName}>. Every mark needs a key.`);let tt=String(mt),kt=b(Le,be,tt),Et=R.get(tt);if(!Et)R.set(tt,Et=[]);else{if(kt===void 0)throw new RangeError(`expressive: two elements have the key "${tt}". Keys must be unique, or name each part with segment.`);if(Et.some(cn=>cn.series===kt))throw new RangeError(`expressive: the mark "${tt}" has two "${kt}" segments.`)}Et.push({element:be,datum:Le,series:kt,value:t.value?.(Le,be)})});let N={svg:g,common:$,screen:gr(),colors:be=>E(be,g)},j=be=>({...be,label:M(be.key,be.parts)}),Z=[...R.keys()];if(t.geometry){let be=Z.map((Ve,Le)=>j(p(Ve,R.get(Ve),Le,N)));return{root:g,ancestor:$,marks:G(V(ms(be,Ve=>Ve.geometry)))}}let oe=Z.map(be=>R.get(be).map(Ve=>k(be,Ve,N))),Me=oe.map(be=>gn(be.map(Ve=>Ve.rect.box))),he=pr(Me,t.baseline??"auto"),te=hr(Me,he).map(be=>j(h(Z[be],oe[be],he[be],be,N)));return{root:g,ancestor:$,marks:G(V(te))}}function p(w,S,f,g){let $=S[0],R=t.geometry($.element,$.datum,w);if(typeof R!="object"||R===null||R.key!==w)throw new TypeError(`expressive: geometry for "${w}" must be a MarkGeometry with the key "${w}". Build it with describe and the key passed in.`);let N=S.map(j=>T(j,ed(R,j.series,S.length),g));return{key:w,geometry:R,parts:N,index:f}}function k(w,S,f){if(S.element.localName!=="rect")throw new TypeError(`expressive: can't read the geometry of a <${S.element.localName}> (mark "${w}"). Only <rect> marks are read; describe others with the geometry option.`);let g=ve.multiply(Zt(f.common,S.element.parentElement??f.svg,f.svg,f.screen),br(S.element));if(!es(g))throw new TypeError(`expressive: the <rect> of "${w}" is rotated or skewed, so it isn't an upright bar. Describe it with the geometry option.`);return{...S,rect:{box:Wn(g,ts(S.element)),series:S.series,radius:td(S.element)}}}function h(w,S,f,g,$){let{geometry:R,order:N}=Yr(w,S.map(oe=>oe.rect),f),j=R.segments??[],Z=N.map((oe,Me)=>{let he=j[Me];return T(S[oe],he&&he.length>=.5?{d:he.outline.d}:void 0,$)});return{key:w,geometry:R,parts:Z,index:g,rect:{edge:f,box:gn(S.map(oe=>oe.rect.box))}}}function T(w,S,f){let g=Zt(f.common,w.element.parentElement??f.svg,f.svg,f.screen);return{element:w.element,datum:w.datum,series:w.series,value:w.value,parent:g,parentInverse:nd(g),colors:f.colors(w.element),outline:S}}function V(w){return w.map(S=>{let{key:f,geometry:g,parts:$}=S,R=S.rect?Yl($):void 0,N=(oe,Me,he)=>t.samples?Ql(t.samples(oe,Me),he===void 0?`"${f}"`:`"${f}" (${he})`):R===void 0?[]:Xl(g,Me,R),j=new Map,Z=oe=>j.get(oe)??We(oe,f);for(let oe of fs(S)){let Me=($.find(he=>he.series===oe)??$[0]).datum;j.set(oe,{datum:Me,samples:N(Me,g.segments?.find(he=>he.series===oe)??g,oe),related:Z})}return{...S,data:{datum:$[0].datum,samples:N($[0].datum,g),related:Z}}})}function G(w){if(w.length===0)return w;let S=new Set(w.flatMap(f=>[...f.geometry.series===void 0?[]:[f.geometry.series],...fs(f)]));for(let f of Nt){let g=o[f];if(g?.kind==="data")for(let $ of g.needs?.related??[]){if(S.has($))continue;let R=S.size>0?`the marks' series are ${[...S].map(N=>`"${N}"`).join(", ")}`:"the marks have no series";throw new RangeError(`expressive: on.${f} needs the series "${$}", but ${R}. Name each mark's series in its geometry (describe.line({ key, series, \u2026 })), or a stack's parts with segment.`)}}return w}function H(w,S,f){if(t.datum)return t.datum(w);if(f)return f[S];let g=w.__data__;return typeof g=="number"&&!l&&(l=!0,console.warn("expressive: element.__data__ is a number, which looks like Observable Plot's row index. Pass datum: (el) => rows[el.__data__].")),g}function b(w,S,f){if(!t.segment)return;let g=t.segment(w,S);if(g==null||g==="")throw new TypeError(`expressive: segment returned ${String(g)} for a part of "${f}".`);return String(g)}function M(w,S){if(t.markLabel)try{let f=String(t.markLabel(S[0].datum,{key:w,parts:S.map(({series:g,datum:$})=>({series:g,datum:$}))})??"");return f.trim()===""?void 0:f}catch(f){Se(f);return}}function E(w,S){if((s.styled(w,"fill")||s.styled(w,"stroke"))&&c.has(w))return c.get(w);let f=is(w,S);return c.set(w,f),f}let P=m(d),L=P.root?.ownerDocument??(typeof document>"u"?void 0:document);if(!L)throw new TypeError("expressive needs a DOM.");lt(L);let D,K,x=new Map,C=[],B=new Map,_=new Map,re=new Set,ae={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set},X,J,ce,le=!1,ge=(w,S,f)=>{let g=L.createElementNS(Zl,w);return ie(g,S),f?.appendChild(g),g},O=ge("g",{class:"ec-overlay","aria-hidden":"true"});Ae(O,{"pointer-events":"none"});let F=ge("g",{class:"ec-halos"},O),Q=ge("g",{class:"ec-runs"},O),de=Ir(O),ye=w=>x.get(w)??B.get(w),ke=tn({overlay:Q,mark:w=>({set:S=>ye(w)?.handle.set(S),reset:()=>ye(w)?.handle.reset()}),colors:w=>ye(w)?.mark.parts[0]?.colors}),Ce=Xt({effects:o,motion:r,icons:n.icons,clock:a,surface:ke}),Oe=w=>({mark:w.mark.geometry,data:w.mark.data});function Ue(w){let S={key:w.key,mark:w,handle:as(()=>S.mark.parts.filter(f=>(_.get(f.element)?.record??S)===S),s,()=>F)};return S}function Te(w){w.root&&w.root!==D&&ft(w.root),K=w.ancestor??K;let S=new Set(w.marks.map(R=>R.key)),f={entering:[],exiting:[],changed:[],moved:[]},g=[];for(let R of C)S.has(R.key)||(x.delete(R.key),B.set(R.key,R),f.exiting.push(R));let $=_;_=new Map,C=w.marks.map(R=>{let N=x.get(R.key);if(N){let j=N.mark;(t.value?od(j.parts,R.parts):ad(j.geometry,R.geometry))?f.changed.push({record:N,from:j.geometry}):(sd(j.geometry,R.geometry)||j.data.datum!==R.data.datum||id(j.data.samples,R.data.samples))&&f.moved.push(N),j.parts[0]?.colors?.color!==R.parts[0]?.colors?.color&&g.push(R.key),N.mark=R}else N=B.get(R.key),N?(B.delete(R.key),N.mark=R):N=Ue(R),x.set(R.key,N),f.entering.push(N);for(let j of R.parts)_.set(j.element,{record:N,part:j});return N});for(let[R,N]of $)_.get(R)?.record!==N.record&&s.restore(R);for(let R of C)$e(R);He(),et(),ot();for(let R of C)R.handle.repaint();for(let R of g)ke.recolor(R);return Ze(),f}function $e(w){if(!t.markLabel)return;let{label:S,parts:f}=w.mark;f.forEach((g,$)=>{let R=S!==void 0&&$===0;s.attribute(g.element,"role",R?"img":null),s.attribute(g.element,"aria-label",R?S:null),R?s.remove(g.element,"aria-hidden"):s.attribute(g.element,"aria-hidden",S===void 0?null:"true")})}function He(){let w=D,S=new Set;for(let f of t.markLabel&&w?C:[])if(f.mark.label!==void 0)for(let g of f.mark.parts)for(let $=g.element.parentElement;$&&$!==w&&w?.contains($);$=$.parentElement){if(S.has($)||$.hasAttribute("aria-label")||$.hasAttribute("aria-labelledby"))continue;let R=$.getAttribute("role")?.trim().split(/\s+/)[0];(R!==void 0&&ql.has(R)||R===void 0&&re.has($))&&S.add($)}for(let f of re)S.has(f)||(s.attribute(f,"role",null),s.attribute(f,"aria-roledescription",null));for(let f of S)s.remove(f,"role"),s.remove(f,"aria-roledescription");re=S}function et(){if(!D||!K)return;D.lastElementChild!==O&&D.appendChild(O),O.removeAttribute("transform");let w=Zt(O,K,D);rd(w)||O.setAttribute("transform",dt(w))}function ft(w){rt(),D=w,D.appendChild(O),(t.keyboard===!0||t.markLabel)&&D.getAttribute("role")==="img"&&!u&&(u=!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.')),ce=Nr(D,{find(S){let f=me(S);if(!f)return;let{key:g}=f.record;return f.part.series===void 0?{key:g}:{key:g,segment:f.part.series}},hover(S,f){let g=x.get(S.key);!g||X?.key===S.key||(je(),Ie(g,f,S.segment))},leave(){X?.source!=="keyboard"&&je()}})}function rt(){D&&(je(),ce?.destroy(),ce=void 0)}function me(w){for(let S=w;S&&S!==D;S=S.parentElement){let f=_.get(S);if(f)return f}}function Ie(w,S,f){X={key:w.key,source:S},ot(),Ce.hover([Oe(w)]),v("hover",{...Oe(w),batch:us,source:S,...f===void 0?{}:{segment:f}})}function je(){let w=X;if(!w)return;X=void 0;let S=ye(w.key);ot(),Ce.leave([w.key]),S&&v("leave",{...Oe(S),batch:us})}function ot(){if(!i)return;let w=`${r.duration(100,"feedback")}ms`;for(let S of C){let f=X?.key===S.key;for(let g of S.mark.parts)s.toggleClass(g.element,"ec-attached",!0),s.toggleClass(g.element,"ec-dimmed",X!==void 0&&!f),s.style(g.element,"--ec-hover-duration",w);S.handle.hot(f)}for(let S of B.values())S.handle.hot(!1)}let Lt=i?r.subscribe(ot):void 0,Pt=new Set(Nt.flatMap(w=>{let S=o[w];return S?.kind==="data"?S.needs?.related??[]:[]}));function Ze(){let w=J===void 0?void 0:x.get(J);de.draw(w?.mark.geometry)}let vt=t.keyboard===!0?Fr(()=>D,{find:w=>me(w)?.record.key,order:()=>C.map(w=>w.key),element:w=>x.get(w)?.mark.parts[0]?.element,tabIndex(w,S){let f=x.get(w);!f||S===void 0||f.mark.parts.forEach((g,$)=>{s.attribute(g.element,"tabindex",$===0?S:"-1"),s.style(g.element,"outline","none")})},focus(w,S){J=S?w:void 0,Ze();let f=x.get(w);if(f){if(!S){X?.source==="keyboard"&&X.key!==w&&je();return}if(X?.key===w){X={key:w,source:"keyboard"};return}je(),Ie(f,"keyboard")}},blur(){J=void 0,Ze(),X?.source==="keyboard"&&(ce?.current===X.key?X={key:X.key,source:"pointer"}:je())},escape(){return X?(je(),!0):!1}}):void 0,xt=t.watch===!0?ds(L,a,jt):void 0;function Mt(){xt?.observe(C.flatMap(w=>w.mark.parts.map(S=>S.element)),D)}function jt(w){if(le||!K)return;let S=new Set;for(let N of w.marks){let j=_.get(N)?.record;j&&S.add(j)}let f=!1;for(let N of w.ancestors)if(N.contains(K))f=!0;else for(let j of C)j.mark.parts.some(Z=>N.contains(Z.element))&&S.add(j);if(f&&et(),S.size===0)return;let{records:g,marks:$}=Ge([...S]);g.forEach((N,j)=>{let Z=$[j];N.mark=Z;for(let oe of Z.parts)_.set(oe.element,{record:N,part:oe});N.handle.repaint()}),C=qt(C),g.some(N=>N.key===J)&&Ze();let R=new Set(g);if(g.some(N=>Pt.has(N.mark.geometry.series??"")))for(let N of C)R.add(N);for(let N of R)Ce.change(N.mark.geometry,N.mark.data)}function Ge(w){let S={svg:D,common:K,screen:gr(),colors:Z=>_.get(Z)?.part.colors},f=Ot(),g=({parts:Z})=>Z.map(oe=>({element:oe.element,datum:f(oe.element),series:oe.series,value:oe.value}));if(t.geometry){let Z=w.map(({mark:oe})=>({...p(oe.key,g(oe),oe.index,S),label:oe.label}));return{records:[...w],marks:V(Z)}}let $=new Map(w.map(Z=>[Z,g(Z.mark).map(oe=>k(Z.key,oe,S))])),R=St($);for(let Z of C)!$.has(Z)&&R.get(Z)!==Z.mark.rect.edge&&$.set(Z,g(Z.mark).map(oe=>k(Z.key,oe,S)));let N=[...$.keys()],j=N.map(Z=>({...h(Z.key,$.get(Z),R.get(Z),Z.mark.index,S),label:Z.mark.label}));return{records:N,marks:V(j)}}function St(w){let S=new Map(C.map(g=>[g,g.mark.rect.edge]));if(t.baseline!==void 0&&t.baseline!=="auto")return S;let f=C.map(g=>{let $=w.get(g);return $?gn($.map(R=>R.rect.box)):g.mark.rect.box});try{let g=pr(f,"auto");return new Map(C.map(($,R)=>[$,g[R]]))}catch{return S}}function Ot(){if(t.datum)return t.datum;let w=ss(d);return S=>w?.has(S)?w.get(S):H(S,0,void 0)}function qt(w){let S=[...w].sort(($,R)=>$.mark.index-R.mark.index);if(t.geometry)return[...ms(S,$=>$.mark.geometry)];let f=S.map($=>$.mark.rect.box),g=S.map($=>$.mark.rect.edge);return hr(f,g).map($=>S[$])}function We(w,S){return C.find(f=>f.key!==S&&f.mark.geometry.series===w)?.mark.data}function v(w,S){for(let f of[...ae[w]])try{f(S)}catch(g){Se(g)}}function z(w,S){S.forEach((f,g)=>v(w,{...Oe(f),batch:{index:g,count:S.length}}))}return Ce.enter(Te(P).entering.map(Oe)),vt?.sync(),Mt(),{refresh(w){if(le)return;let S=m(w??d);w!==void 0&&(d=w),Ce.interrupt();let f=Te(S);Mt(),X!==void 0&&!x.has(X.key)&&(ce?.clear(),je());let g=Ce.exit(f.exiting.map(Oe));z("exit",f.exiting),Ce.update(f.changed.map(({record:R,from:N})=>({...Oe(R),from:N}))),f.changed.forEach(({record:R,from:N},j)=>v("update",{...Oe(R),from:N,batch:{index:j,count:f.changed.length}})),Ce.enter(f.entering.map(Oe)),z("enter",f.entering);let $=new Set([...f.changed.map(R=>R.record),...f.moved]);if([...$,...f.entering,...f.exiting].some(R=>Pt.has(R.mark.geometry.series??""))){let R=new Set(f.entering);for(let N of C)R.has(N)||$.add(N)}for(let R of $)Ce.change(R.mark.geometry,R.mark.data);Ce.settle(),vt?.sync(),g.then(()=>{for(let R of f.exiting)B.get(R.key)===R&&B.delete(R.key)})},on(w,S){let f=ae[w];if(!f)throw new TypeError(`expressive: unknown event "${String(w)}". Use one of: ${Object.keys(ae).join(", ")}.`);return f.add(S),()=>{f.delete(S)}},marks:()=>C.map(w=>w.mark.geometry),focus(w){x.has(w)&&!le&&vt?.focus(w)},destroy(){if(!le){le=!0,X=void 0,xt?.destroy(),Ce.destroy(),Lt?.(),vt?.destroy(),rt(),O.remove(),s.restoreAll();for(let w of Object.values(ae))w.clear();x.clear(),B.clear(),C=[],_=new Map}}}}function Jl(e){if(typeof e!="object"||e===null)throw new TypeError("expressive needs options, with at least a key: { key: (d) => d.name }.");if(typeof e.key!="function")throw new 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 new TypeError(`expressive: ${t} must be a function.`);if(e.baseline!==void 0&&e.baseline!=="auto"&&!Yi(e.baseline))throw new RangeError(`expressive: baseline must be "left", "right", "top", "bottom" or "auto", got ${String(e.baseline)}.`)}function fs(e){let t=[...(e.geometry.segments??[]).map(n=>n.series),...e.parts.map(n=>n.series)];return[...new Set(t.filter(n=>n!==void 0))]}function Yl(e){let t=0;for(let{value:n}of e){if(typeof n!="number"||!Number.isFinite(n))return;t+=n}return t}function Xl(e,t,n){let r=a=>e.length>0?n*a/e.length:0;if(t===e)return[{t:0,value:0},{t:1,value:n}];let o=ys(e.start,t.start);return[{t:0,value:r(o)},{t:1,value:r(o+t.length)}]}function Ql(e,t){if(!Array.isArray(e))throw new TypeError(`expressive: samples for ${t} must return an array of { t, value }, got ${ca(e)}.`);let n=0;return e.map((r,o)=>{let{t:a,value:i,at:s}=typeof r=="object"&&r!==null?r:{};if(typeof a!="number"||!(a>=0&&a<=1))throw new RangeError(`expressive: samples for ${t}: samples[${o}].t must be in [0, 1], got ${ca(a)}.`);if(a<n)throw new RangeError(`expressive: samples for ${t} must be in t order: samples[${o}].t is ${a}, after ${n}.`);if(typeof i!="number"||!Number.isFinite(i))throw new RangeError(`expressive: samples for ${t}: samples[${o}].value must be a finite number, got ${ca(i)}.`);return n=a,s===void 0?{t:a,value:i}:{t:a,value:i,at:s}})}function ca(e){return typeof e=="string"?JSON.stringify(e):String(e)}function ms(e,t){let n=e[0]&&t(e[0]).pivot;if(!n||!e.every(a=>ys(t(a).pivot,n)<=.5&&yr(t(a))))return e;let r=2*Math.PI,o=a=>{let{center:i}=t(a),s=Math.atan2(i.x-n.x,n.y-i.y),c=s<0?s+r:s;return c>=r?0:c};return e.map(a=>({mark:a,angle:o(a)})).sort((a,i)=>a.angle-i.angle).map(({mark:a})=>a)}function ys(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function ed(e,t,n){let r=t===void 0?void 0:e.segments?.find(a=>a.series===t),o=r??(n===1?e:void 0);if(!(!o||r&&r.length<.5))return o.outline.closed?{d:o.outline.d}:{d:o.outline.d,stroke:o.thickness}}function td(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 nd(e){try{return vn(e)}catch{return}}function rd(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 od(e,t){if(e.length!==t.length)return!0;let n=new Map(e.map(r=>[r.series,r.value]));return t.some(r=>{let o=n.get(r.series);return!n.has(r.series)||!(o===r.value||Object.is(o,r.value))})}function ad(e,t){let n=e.segments??[],r=t.segments??[];return Math.abs(e.length-t.length)>.01||n.length!==r.length?!0:n.some((o,a)=>o.key!==r[a].key||Math.abs(o.length-r[a].length)>.01)}function id(e,t){let n=(r,o)=>r===o||r instanceof Date&&o instanceof Date&&r.getTime()===o.getTime();return e.length!==t.length||e.some((r,o)=>r.t!==t[o].t||r.value!==t[o].value||!n(r.at,t[o].at))}function sd(e,t){if(e.outline.d!==t.outline.d||e.thickness!==t.thickness)return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((o,a)=>o.key!==r[a].key||o.outline.d!==r[a].outline.d)}var cd=["line","rect","arc","symbol"],ld=["d","transform","x","y","width","height","stroke-width"];function eo(e,t,n){if(dd(e),typeof t!="object"||t===null||typeof t.key!="function")throw new TypeError("fromVegaView needs options with a key: { key: (d) => d.series }. Marks are matched by key.");let r=t.mark??"marks";if(typeof r!="string"||r==="")throw new TypeError(`fromVegaView: mark must be a mark's name, got ${String(r)}.`);if(t.sample!==void 0&&typeof t.sample!="function")throw new TypeError("fromVegaView: sample must be a function.");let o=h(),{mark:a,sample:i,...s}=t,c=Zn(o.elements,{...s,datum:L=>k(L).datum,geometry:(L,D,K)=>{let x=o.geometry.get(K);if(!x)throw new TypeError(`fromVegaView: no geometry for "${K}". Its key must be the same for every item of a mark.`);return x},...t.samples||!t.sample?{}:{samples:(L,D)=>o.samples.get(D)??[]},...t.value||!t.sample?{}:{value:(L,D)=>o.values.get(D)}},n),d=n.clock??Ne,l,u,m=!1,p=typeof MutationObserver=="function"?new MutationObserver(L=>L.some(b)&&M()):void 0;E(o.root);function k(L){let D=o.items.get(L);if(!D)throw new TypeError("fromVegaView: an element that isn't one of the View's items.");return D}function h(){let L=ud(ps(e),r),D=fd(L,r,e),K=e.container(),x=K?.localName==="svg"?K:K?.querySelector("svg"),C={root:x??void 0,elements:[],items:new Map,geometry:new Map,samples:new Map,values:new Map};if(!D||!x)return C;let B=new Set(D==="line"?L.flatMap(F=>F.items?.length?[F.items[0]]:[]):L.flatMap(F=>F.items??[])),_=new Map;for(let F of Array.from(x.querySelectorAll("*"))){let Q=F.__data__;B.has(Q)&&_.set(F,Q)}let re=[..._.keys()];if(re.length===0)return C;let ae=Xr(re),X=Qr(re,ae),J=gr(),ce=F=>Zt(X,F.parentElement??ae,ae,J),le=F=>String(t.key(_.get(F).datum,F)),ge=F=>t.segment?String(t.segment(_.get(F).datum,F)):void 0,O={root:ae,items:_,elements:re,geometry:new Map,samples:new Map,values:new Map};if(t.sample)for(let[F,Q]of _){let de=D==="line"?la(Q).map(ye=>ye.item):[Q];O.values.set(F,de.map(ye=>V(ye).value).join(","))}if(D==="rect")return T(O,ce,le,ge);for(let F of re){let Q=_.get(F),de=le(F);if(O.geometry.has(de))continue;let ye=ce(F),ke=D==="line"?yd(de,F,Q,ye):D==="arc"?pd(de,Q,ye):hd(de,Q,ye);O.geometry.set(de,ke),t.sample&&O.samples.set(ke,D==="line"?G(ke,Q,ye):H(ke,Q,D))}return O}function T(L,D,K,x){let C=new Map;for(let X of L.elements){let J=L.items.get(X),ce=K(X),le={box:Wn(D(X),gd(J)),series:x(X),radius:Math.max(0,J.cornerRadius??0)},ge=C.get(ce);ge?ge.push({element:X,part:le}):C.set(ce,[{element:X,part:le}])}let B=[...C.keys()],_=B.map(X=>gn(C.get(X).map(J=>J.part.box))),re=pr(_,t.baseline??"auto"),ae=[];for(let X of hr(_,re)){let J=B[X],ce=C.get(J),{geometry:le,order:ge}=Yr(J,ce.map(O=>O.part),re[X]);if(L.geometry.set(J,le),ae.push(...ge.map(O=>ce[O].element)),t.sample){let O=ge.map(de=>V(L.items.get(ce[de].element)).value),F=O.reduce((de,ye)=>de+ye,0);L.samples.set(le,[{t:0,value:0},{t:1,value:F}]);let Q=0;(le.segments??[]).forEach((de,ye)=>{let ke=Q;Q+=O[ye]??0,L.samples.set(de,[{t:0,value:ke},{t:1,value:Q}])})}}return{...L,elements:ae}}function V(L){let D=t.sample(L.datum),K=typeof D=="number"?{value:D}:D;if(typeof K!="object"||K===null||!Number.isFinite(K.value))throw new RangeError(`fromVegaView: sample must give a finite number, or { value, at }, got ${JSON.stringify(D)}.`);return K.at===void 0?{value:K.value}:{value:K.value,at:K.at}}function G(L,D,K){return or(L,la(D).map(({item:x,point:C})=>({...ve.apply(K,C),...V(x)})))}function H(L,D,K){let{value:x,at:C}=V(D),B=C===void 0?{t:1,value:x}:{t:1,value:x,at:C};return K==="symbol"?[{...B,t:0}]:L.length>0?[{t:0,value:0},B]:[{...B,t:0}]}function b(L){let D=l?.querySelector(":scope > .ec-overlay"),K=x=>x===D||(D?.contains(x)??!1);return K(L.target)?!1:L.type==="childList"?[...Array.from(L.addedNodes),...Array.from(L.removedNodes)].some(x=>!K(x)):!0}function M(){if(u||m)return;let L=d.onFrame(()=>{L(),u=void 0;try{P()}catch(D){Se(D)}});u=L}function E(L){!p||L===l||(p.disconnect(),l=L,L&&p.observe(L,{subtree:!0,childList:!0,attributes:!0,attributeFilter:ld}))}function P(){if(m)return;let L=h(),D=o;o=L;try{c.refresh(L.elements)}catch(K){throw o=D,K}E(L.root)}return{refresh:P,on:c.on,marks:c.marks,focus:c.focus,destroy(){m||(m=!0,p?.disconnect(),u?.(),u=void 0,c.destroy())}}}function dd(e){if(typeof e!="object"||e===null||typeof e.renderer!="function"||typeof e.scenegraph!="function"||typeof e.container!="function")throw new 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 new 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 ps(e){let t=e.scenegraph();return t.root??t}function ud(e,t){let n=[],r=o=>{if(o.name===t&&o.marktype!=="group"&&n.push(o),o.marktype==="group")for(let a of o.items??[])for(let i of a.items??[])r(i)};return r(e),n}function fd(e,t,n){if(e.length===0){let o=md(ps(n));if(o.length===0)return;throw new RangeError(`fromVegaView: the View has no mark named "${t}". Its named marks: ${o.map(a=>`"${a}"`).join(", ")}.`)}let r=e[0].marktype;if(!e.every(o=>o.marktype===r)||!cd.includes(r))throw new 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 md(e){let t=new Set,n=r=>{r.name&&r.marktype!=="group"&&t.add(r.name);for(let o of r.items??[])for(let a of o.items??[])n(a)};return n(e),[...t]}function la(e){let t=e.mark?.items??[e],n=t[0]?.interpolate;if(n!==void 0&&n!=="linear")throw new TypeError(`fromVegaView: a line is drawn with interpolate "${n}", but only straight lines can be read. Use interpolate "linear" (the default), or describe the curve with expressive()'s geometry option.`);if(t.some(r=>r.defined===!1))throw new TypeError("fromVegaView: a line has a gap (a point with defined: false). Lines with gaps can't be read yet.");return t.map(r=>({item:r,point:{x:ut(r.x),y:ut(r.y)}}))}function yd(e,t,n,r){let o=n.strokeWidth??Number.parseFloat(t.getAttribute("stroke-width")??"1");return qe.line({key:e,series:e,points:la(n).map(({point:a})=>ve.apply(r,a)),width:(Number.isFinite(o)?o:1)*da(r)})}function pd(e,t,n){let r=ve.apply(n,{x:ut(t.x),y:ut(t.y)}),o=da(n),[a,i]=[ut(t.startAngle),ut(t.endAngle)].sort((s,c)=>s-c);return qe.arc({key:e,cx:r.x,cy:r.y,inner:ut(t.innerRadius)*o,outer:ut(t.outerRadius)*o,start:a,end:i})}function hd(e,t,n){let r=ve.apply(n,{x:ut(t.x),y:ut(t.y)});return qe.point({key:e,x:r.x,y:r.y,r:Math.sqrt(Math.max(0,t.size??64)/Math.PI)*da(n)})}function gd(e){let t=ut(e.x),n=ut(e.y),r=ut(e.width),o=ut(e.height);return{x:Math.min(t,t+r),y:Math.min(n,n+o),width:Math.abs(r),height:Math.abs(o)}}function da(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))}function ut(e){return typeof e=="number"&&Number.isFinite(e)?e:0}var bd={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},ua=/[\s,]*([A-Za-z]|[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)/y,hs=/^[A-Za-z]$/;function to(e){let t=[];ua.lastIndex=0;for(let c=ua.exec(e);c;c=ua.exec(e))t.push(c[1]);let n=[],r={x:0,y:0},o=r,a,i="",s=0;for(;s<t.length;){if(hs.test(t[s]))i=t[s++];else if(i===""||i==="Z"||i==="z")break;let c=i.toUpperCase();if(c==="Z"){n.push({op:"Z",to:o}),r=o,a=void 0;continue}let d=bd[c];if(d===void 0)break;let l=[],u=!1;for(;l.length<d&&s<t.length&&!hs.test(t[s]);){let E=t[s];if(c==="A"&&(l.length===3||l.length===4)){let P=E[0];if(P!=="0"&&P!=="1"){u=!0;break}l.push(Number(P)),E.length>1?t[s]=E.slice(1):s++;continue}l.push(Number(E)),s++}if(u||l.length<d||!l.every(Number.isFinite))break;let m=i!==c,p=(E,P)=>m?{x:r.x+E,y:r.y+P}:{x:E,y:P},[k=0,h=0,T=0,V=0,G=0,H=0,b=0]=l,M;switch(c){case"M":r=o=p(k,h),n.push({op:"M",to:r}),i=m?"l":"L";break;case"L":n.push({op:"L",to:r=p(k,h)});break;case"H":n.push({op:"L",to:r={x:m?r.x+k:k,y:r.y}});break;case"V":n.push({op:"L",to:r={x:r.x,y:m?r.y+k:k}});break;case"C":case"S":{let E=c==="S",P=E?a&&gs(n,"C")?bs(a,r):r:p(k,h);M=E?p(k,h):p(T,V),n.push({op:"C",c1:P,c2:M,to:r=E?p(T,V):p(G,H)});break}case"Q":case"T":{let E=c==="T";M=E?a&&gs(n,"Q")?bs(a,r):r:p(k,h),n.push({op:"Q",c:M,to:r=E?p(k,h):p(T,V)});break}case"A":n.push({op:"A",rx:Math.abs(k),ry:Math.abs(h),rotation:T,large:V!==0,sweep:G!==0,to:r=p(H,b)});break}a=M}return n}var gs=(e,t)=>e[e.length-1]?.op===t,bs=(e,t)=>({x:2*t.x-e.x,y:2*t.y-e.y});function no(e,t){let n=o=>({x:t[0]*o.x+t[2]*o.y+t[4],y:t[1]*o.x+t[3]*o.y+t[5]}),r=t[0]*t[3]-t[1]*t[2]<0;return e.map(o=>{switch(o.op){case"M":case"L":case"Z":return{op:o.op,to:n(o.to)};case"C":return{op:"C",c1:n(o.c1),c2:n(o.c2),to:n(o.to)};case"Q":return{op:"Q",c:n(o.c),to:n(o.to)};case"A":return{...o,...wd(o,t),sweep:r!==o.sweep,to:n(o.to)}}})}function wd({rx:e,ry:t,rotation:n},r){let o=n*Math.PI/180,a=Math.cos(o),i=Math.sin(o),s=(r[0]*a+r[2]*i)*e,c=(r[2]*a-r[0]*i)*t,d=(r[1]*a+r[3]*i)*e,l=(r[3]*a-r[1]*i)*t,u=s*s+c*c,m=s*d+c*l,p=d*d+l*l,k=(u+p)/2,h=Math.hypot((u-p)/2,m),T=k+h,V=Math.abs(m)<1e-12?u>=p?0:Math.PI/2:Math.atan2(T-u,m);return{rx:Math.sqrt(T),ry:Math.sqrt(Math.max(0,k-h)),rotation:V*180/Math.PI}}function ro(e){let t=_e,n=r=>`${t(r.x)},${t(r.y)}`;return e.map(r=>{switch(r.op){case"M":case"L":return`${r.op}${n(r.to)}`;case"C":return`C${n(r.c1)} ${n(r.c2)} ${n(r.to)}`;case"Q":return`Q${n(r.c)} ${n(r.to)}`;case"A":return`A${t(r.rx)},${t(r.ry)} ${t(r.rotation)} ${r.large?1:0} ${r.sweep?1:0} ${n(r.to)}`;case"Z":return"Z"}}).join("")}var vd={get:()=>{}},kd={set(){},reset(){}},fa={place(){},update(){},remove(){}};function ws(e,t){let{effect:n,surface:r}=t;if(!ma(n))throw new TypeError(`playTransition needs a transition effect (kind "transition" with run, end and clear), got ${xd(n)}.`);let o=t.start??0;if(!(typeof o=="number"&&o>=0&&o<=1))throw new RangeError(`playTransition: start must be a number from 0 to 1, got ${String(o)}.`);let a=t.motion??pt,i=t.clock??Ne,s=t.icons??vd,c=e.length,d=[],l=!1,u=c,m,p=new Promise(P=>{m=P}),k=c>0?a.subscribe(()=>{a.mode==="off"&&M()}):void 0,h=()=>{--u>0||(k?.(),k=void 0,m())};function T(P,L,D){let K=Mo({clock:i,motion:a,icons:s,batch:{index:L,count:c},layer:E(P.to.key,L,()=>x.state!=="cleared"),mark:kd}),x={pair:P,index:L,scope:K,context:{...K.context,start:o},state:"running",done:D};d[L]=x;let{from:C,to:B}=P;try{a.mode==="off"?(n.end(C,B,x.context),V(x)):Promise.resolve(n.run(C,B,x.context)).then(()=>V(x),_=>G(x,_))}catch(_){G(x,_)}}function V(P){P.state==="running"&&(P.state="ended",H(P))}function G(P,L){let{signal:D}=P.context;D.aborted&&(L===D.reason||L?.name==="AbortError")||(Se(L),b(P))}function H(P){let L=P.done;P.done=void 0,L?.()}function b(P){if(P.state!=="cleared"){P.state="cleared",P.scope.abort();try{n.clear(P.context)}catch(L){Se(L)}P.scope.clear(),H(P)}}function M(){for(let P of[...d]){if(P.state!=="running")continue;let L=P.done;P.done=void 0,b(P),T(P.pair,P.index,L)}}function E(P,L,D){let K,x=()=>D()?K??(K=r.group(P,L)):void 0;return{icon:(C,B)=>x()?.icon(C,B)??fa,path:(C,B)=>x()?.path(C,B)??fa,text:(C,B)=>x()?.text(C,B)??fa,clear(){let C=K;K=void 0,C?.clear()}}}return e.forEach((P,L)=>T(P,L,h)),c===0&&m(),{finished:p,clear(){if(!l){l=!0;for(let P of[...d])b(P)}}}}function ma(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.kind==="transition"&&typeof t.run=="function"&&typeof t.end=="function"&&typeof t.clear=="function"}function xd(e){if(typeof e!="object"||e===null)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)}`}var Md=950,Sd=.4,qn=.5;function ha(e,t,n){let r=rn(e,"chartSwitch"),o=Ld(t),a=t.transition,i=Rt(t.colors),s=n.motion,c=n.clock??Ne,d=r.ownerDocument;lt(d);let l=d.createElement("div");l.className="ec-switch",r.appendChild(l);let u=new Map;try{for(let O of o){let F=d.createElement("div");F.className="ec-switch-view",F.setAttribute("data-view",O),l.appendChild(F),ya(F,O===t.initial);let Q=t.views[O](F,i);if(!Cd(Q,F))throw Q?.destroy?.(),new TypeError(`chartSwitch: views.${O} must return the chart it draws in the container it's given (with element, marks(), labels(), focus(), leave() and destroy()), such as donutChart(container, { ... }).`);u.set(O,{name:O,container:F,chart:Q})}}catch(O){for(let F of u.values())F.chart.destroy();throw l.remove(),O}let m=Y("svg",{class:"ec-chart ec-switch-overlay","aria-hidden":"true"},l),p=Y("g",{class:"ec-switch-fades"},m),k=Y("g",{class:"ec-switch-runs"},m),h=Y("g",{class:"ec-switch-labels"},m),T=t.announce?Tt(m):void 0,V=new WeakMap,G={group(O,F){let Q=Y("g",{class:"ec-run","data-key":O},k);Ae(Q,ct(Xe(i.slot(O)))),V.set(Q,F);let de=Array.from(k.children).find(ye=>(V.get(ye)??-1/0)>F);return k.insertBefore(Q,de??null),{...cr(Q),clear:()=>Q.remove()}}},H=t.initial,b,M=!1,E=s.subscribe(()=>{s.mode==="off"&&b&&X(b,!0)}),P,L=typeof ResizeObserver=="function"?new ResizeObserver(O=>{let F=O[O.length-1]?.contentRect.width??0;if(P!==void 0&&Math.abs(F-P)<.5)return;let Q=P===void 0;P=F,!Q&&b&&X(b,!0)}):void 0;L?.observe(l);let D=O=>u.get(O);function K(){return l.getRootNode().activeElement??null}function x(O){let F=K();if(!F||!O.container.contains(F))return;let Q=F.closest("[data-key]");return{key:Q&&O.chart.element.contains(Q)?Q.getAttribute("data-key")??void 0:void 0}}function C(O,F){if(!F)return;let Q=K();if(Q&&Q!==d.body&&Q!==d.documentElement&&!l.contains(Q))return;let de=()=>O.chart.element.contains(K());if(F.key!==void 0&&O.chart.focus(F.key),!de()){for(let ye of O.chart.marks())if(O.chart.focus(ye.key),de())return}}function B(O){T?.say(O.chart.element.getAttribute("aria-label")??"")}function _(O,F,Q){H=F.name;let de=Q?Q.focus:x(O);if(O.chart.leave(),s.mode==="off"){for(let Te of u.values())ya(Te.container,Te===F);return C(F,de),B(F),Promise.resolve()}for(let Te of[O,F])Te.container.classList.remove("ec-switch-inactive"),Te.container.classList.add("ec-switching"),Te.container.setAttribute("inert",""),Te.chart.element.classList.add("ec-morphing");let{pairs:ye,scene:ke}=J(O,F),{done:Ce,settle:Oe}=Es(),Ue={a:O,b:F,forward:!0,pairs:ye,reversed:ye.map(({from:Te,to:$e})=>({from:$e,to:Te})),scene:ke,focus:de,progress:0,transition:void 0,driver:void 0,run:0,done:Ce,settle:Oe};return b=Ue,re(Ue,0),Ue.done}function re(O,F){let Q=++O.run;if(F>=1){X(O,!0);return}let de=ke=>{O.progress=ke,O.scene.draw(O.forward?ke:1-ke)},ye=Dd(c);O.transition=ws(O.forward?O.pairs:O.reversed,{effect:a,surface:G,start:F,motion:s,clock:ye.clock,icons:n.icons}),O.driver=Ed(F,de,{clock:ye.clock,motion:s}),ye.release(),Promise.all([O.driver.finished,O.transition.finished]).then(([ke])=>{b===O&&O.run===Q&&ke==="done"&&X(O,!0)})}function ae(O){return O.driver?.cancel(),O.transition?.clear(),O.forward=!O.forward,H=(O.forward?O.b:O.a).name,O.settle(),{done:O.done,settle:O.settle}=Es(),re(O,1-O.progress),O.done}function X(O,F){if(b!==O)return;b=void 0,O.run++,O.driver?.cancel(),O.transition?.clear(),O.scene.clear();let Q=O.forward?O.b:O.a;for(let de of[O.a,O.b])de.chart.element.classList.remove("ec-morphing"),de.container.classList.remove("ec-switching"),de.container.style.removeProperty("opacity");for(let de of u.values())ya(de.container,de===Q);F&&(C(Q,O.focus),B(Q)),O.settle()}function J(O,F){let Q=Zt(m,O.chart.element,l),de=Zt(m,F.chart.element,l),ye=O.chart.marks().map(me=>pa(me,Q)),ke=F.chart.marks().map(me=>pa(me,de)),Ce=new Map(ye.map(me=>[me.key,me])),Oe=new Set(ke.map(me=>me.key)),Ue=ke.flatMap(me=>{let Ie=Ce.get(me.key);return Ie?[{from:Ie,to:me}]:[]}),Te=[];for(let me of ye)Oe.has(me.key)||Te.push(ce(me,xs));for(let me of ke)Ce.has(me.key)||Te.push(ce(me,Ms));let $e=me=>`${me.role}
92
- ${me.key}`,He=O.chart.labels(),et=F.chart.labels(),ft=new Map(He.map(me=>[$e(me),me])),rt=new Set;for(let me of et){let Ie=ft.get($e(me));Ie&&(rt.add($e(me)),Te.push(Td(le(Ie,Q),le(me,de))))}for(let me of He)rt.has($e(me))||Te.push(ks(le(me,Q),xs));for(let me of et)ft.has($e(me))||Te.push(ks(le(me,de),Ms));return Te.push(me=>{vs(O.container,1-oo(me/Sd)),vs(F.container,oo((me-qn)/(1-qn)))}),{pairs:Ue,scene:{draw:me=>{for(let Ie of Te)Ie(me)},clear:()=>{p.replaceChildren(),k.replaceChildren(),h.replaceChildren()}}}}function ce(O,F){let Q=Y("g",{class:"ec-switch-fade","data-key":O.key},p);return Ae(Q,ct(Xe(i.slot(O.key)))),cr(Q).path(O.outline.d,O.outline.closed?{fill:"mark"}:{stroke:"mark",width:O.thickness}),de=>ie(Q,{opacity:F(de)})}function le(O,F){let Q=O.element.cloneNode(!0);for(let ye of["id","opacity","visibility","aria-hidden"])Q.removeAttribute(ye);Q.textContent=O.text;let de=ve.apply(F,O);return ie(Q,{x:de.x,y:de.y,"text-anchor":O.anchor}),h.appendChild(Q),{text:Q,at:de}}return{get current(){return H},show(O){if(!u.has(O))return Promise.reject(new TypeError(`chartSwitch: there's no view ${JSON.stringify(O)}. The views are ${o.map(ye=>JSON.stringify(ye)).join(", ")}.`));if(M)return Promise.resolve();let F=b;if(!F)return O===H?Promise.resolve():_(D(H),D(O));let Q=F.forward?F.b:F.a,de=F.forward?F.a:F.b;return O===Q.name?F.done:O===de.name?ae(F):(X(F,!1),_(Q,D(O),{focus:F.focus}))},chart(O){let F=u.get(O);if(!F)throw new TypeError(`chartSwitch: there's no view ${JSON.stringify(O)}. The views are ${o.map(Q=>JSON.stringify(Q)).join(", ")}.`);return F.chart},destroy(){if(M)return;M=!0;let O=b;O&&(b=void 0,O.run++,O.driver?.cancel(),O.transition?.clear(),O.scene.clear(),O.settle()),E(),L?.disconnect(),T?.destroy();for(let F of u.values())F.chart.destroy();l.remove()}}}function Ed(e,t,n){let r=Mr(e),o;return o=Jt({duration:Md,timing:"transition",ease:at,update:a=>{let i=Math.min(1,r+a);t(a===0?e:it(i)),i>=1&&a<1&&o?.finish()}},n),o}function Dd(e){let t=e.now();return{clock:{now:()=>t??e.now(),onFrame:n=>e.onFrame(n)},release(){t=void 0}}}function ya(e,t){e.classList.toggle("ec-switch-inactive",!t),e.toggleAttribute("inert",!t),t?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true")}function vs(e,t){e.style.setProperty("opacity",String(Math.round(t*1e3)/1e3))}function Td(e,t){return n=>{let r=Ss(e.at.x,t.at.x,n),o=Ss(e.at.y,t.at.y,n),a=n>=qn;ie(e.text,{x:r,y:o,visibility:a?"hidden":void 0}),ie(t.text,{x:r,y:o,visibility:a?void 0:"hidden"})}}function ks(e,t){return n=>ie(e.text,{opacity:t(n)})}var xs=e=>1-oo(e/qn),Ms=e=>oo((e-qn)/(1-qn)),oo=e=>Math.min(1,Math.max(0,e)),Ss=(e,t,n)=>e*(1-n)+t*n,Rd=e=>e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1&&e[4]===0&&e[5]===0;function pa(e,t){if(Rd(t))return e;let n=i=>ve.apply(t,i),r=i=>ro(no(to(i),t)),o=Math.sqrt(Math.abs(t[0]*t[3]-t[1]*t[2])),{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*o,path:i=>n(e.path(i)),angle:i=>{let s=e.angle(i),c=Math.cos(s),d=Math.sin(s);return Math.atan2(t[1]*c+t[3]*d,t[0]*c+t[2]*d)},slice:(i,s)=>r(e.slice(i,s)),thickness:e.thickness*o,outline:{d:r(a.d),closed:a.closed,sample:i=>a.sample(i).map(n)},bounds:Wn(t,e.bounds),center:n(e.center),pivot:n(e.pivot),...e.segments===void 0?{}:{segments:e.segments.map(i=>pa(i,t))}}}function Es(){let e;return{done:new Promise(n=>{e=n}),settle:e}}function Cd(e,t){if(typeof e!="object"||e===null)return!1;let n=e,r=n.element;return["marks","labels","focus","leave","destroy"].every(o=>typeof n[o]=="function")&&r?.nodeType===1&&t.contains(r)}function Ld(e){if(typeof e!="object"||e===null)throw new TypeError("chartSwitch needs options.");let{views:t,initial:n,transition:r,announce:o}=e;if(typeof t!="object"||t===null)throw new 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 new TypeError("chartSwitch needs at least one view.");for(let i of a)if(typeof t[i]!="function")throw new TypeError(`chartSwitch: views.${i} must be a function that draws the view's chart in the container it's given.`);if(typeof n!="string"||!a.includes(n))throw new TypeError(`chartSwitch: initial must be one of the views (${a.map(i=>JSON.stringify(i)).join(", ")}), got ${typeof n=="string"?JSON.stringify(n):String(n)}.`);if(!ma(r))throw new TypeError("chartSwitch: transition must be a transition effect, such as morph().");if(o!==void 0&&typeof o!="boolean")throw new TypeError("chartSwitch: announce must be true or false.");return a}var Ds=["presentation","analysis","off"],Pd={presentation:"Presentation",analysis:"Analysis",off:"Off"},Od={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."},Ad=0;function ga(e,t,n={}){let r=$d(e);Gd(t),Id(n);let o={...Pd,...n.labels},a={...Od,...n.hints},{persist:i}=n,s=r.ownerDocument;lt(s);let c=`ec-motion-${++Ad}`,d=s.createElement("div");d.className="ec-motion-switch",d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${c}-label`),d.setAttribute("aria-describedby",`${c}-hint`);let l=d.appendChild(s.createElement("span"));l.className="ec-motion-label",l.id=`${c}-label`,l.textContent=n.label??"Motion";let u=d.appendChild(s.createElement("span"));u.className="ec-motion-modes";let m=Ds.map(V=>{let G=u.appendChild(s.createElement("button"));return G.type="button",G.dataset.mode=V,G.textContent=o[V],G.addEventListener("click",()=>t.chooseMode(V)),G}),p=d.appendChild(s.createElement("span"));p.className="ec-motion-hint",p.id=`${c}-hint`,p.setAttribute("aria-live","polite");let k=()=>{let V=t.mode;for(let G of m)G.setAttribute("aria-pressed",String(G.dataset.mode===V));p.textContent=t.prefersReduced&&t.viewerChoice===void 0?a.reduced:a[V]};if(i!==void 0){let V=Ts(s,G=>G.getItem(i));Ds.includes(V)&&t.chooseMode(V)}k(),r.appendChild(d);let h=t.subscribe(()=>{if(k(),i===void 0)return;let V=t.viewerChoice;Ts(s,G=>V===void 0?G.removeItem(i):G.setItem(i,V))}),T=!1;return{element:d,destroy(){T||(T=!0,h(),d.remove())}}}function Ts(e,t){try{let n=e.defaultView?.localStorage;return n?t(n):void 0}catch{return}}function $d(e){if(typeof e=="string"){let t=typeof document>"u"?null:document.querySelector(e);if(!t)throw new TypeError(`motionSwitch: no element matches "${e}".`);return t}if(typeof e!="object"||e===null||typeof e.appendChild!="function")throw new TypeError("motionSwitch needs an element or a selector to build the switch in.");return e}function Gd(e){if(typeof e!="object"||e===null||typeof e.chooseMode!="function"||typeof e.subscribe!="function")throw new TypeError("motionSwitch needs a Motion, such as the page-wide `motion` or one from createMotion().")}function Id(e){let{label:t,labels:n,hints:r,persist:o}=e;if(t!==void 0&&typeof t!="string")throw new TypeError(`motionSwitch: label must be a string, got ${typeof t}.`);for(let[a,i]of[["labels",n],["hints",r]])if(i!==void 0){for(let[s,c]of Object.entries(i))if(typeof c!="string")throw new TypeError(`motionSwitch: ${a}.${s} must be a string, got ${typeof c}.`)}if(o!==void 0&&(typeof o!="string"||o===""))throw new TypeError(`motionSwitch: persist must be a localStorage key, got ${JSON.stringify(o)??String(o)}.`)}var Vd={play:"Play",pause:"Pause"};function ba(e,t,n={}){let r=Nd(e);Fd(t),Bd(n);let o={...Vd,...n.labels},a=r.ownerDocument;lt(a);let i=a.createElement("button");i.type="button",i.className="ec-play",i.addEventListener("click",()=>t.playing?t.pause():t.play());let s=()=>{let l=t.playing?o.pause:o.play;i.textContent!==l&&(i.textContent=l)};s(),r.appendChild(i);let c=t.subscribe(s),d=!1;return{element:i,destroy(){d||(d=!0,c(),i.remove())}}}function Nd(e){if(typeof e=="string"){let t=typeof document>"u"?null:document.querySelector(e);if(!t)throw new TypeError(`playButton: no element matches "${e}".`);return t}if(typeof e!="object"||e===null||typeof e.appendChild!="function")throw new TypeError("playButton needs an element or a selector to build the button in.");return e}function Fd(e){if(typeof e!="object"||e===null||typeof e.play!="function"||typeof e.pause!="function"||typeof e.subscribe!="function")throw new TypeError("playButton needs a Playback, from playback().")}function Bd(e){let{labels:t}=e;if(t!==void 0){for(let[n,r]of Object.entries(t))if(typeof r!="string"||r.trim()==="")throw new TypeError(`playButton: labels.${n} must be a string with some text, got ${JSON.stringify(r)??String(r)}.`)}}var Hd=Object.freeze({lift:0,spin:0,tilt:0});function jd(){return e=>({lift:0,spin:e.distance/e.radius,tilt:0})}function zd(e={}){let t=e.stride??42,n=e.lift??3.2,r=e.tilt??9;if(!(t>0)||!Number.isFinite(t))throw new RangeError(`gaits.step: stride must be more than 0, got ${t}.`);if(!(n>=0)||!Number.isFinite(n))throw new RangeError(`gaits.step: lift can't be negative, got ${n}.`);if(!Number.isFinite(r))throw new RangeError(`gaits.step: tilt must be a finite number of degrees, got ${r}.`);let o=r*Math.PI/180;return Object.assign(i=>{let s=Math.max(1,Math.round(i.length/t)),c=Math.abs(Math.sin(Math.PI*(i.progress*s%1)));return{lift:c*n,spin:0,tilt:c*o*(1-.3*i.progress)}},{ease:it,pace:1.15})}function _d(){return()=>Hd}var vr={roll:jd,step:zd,slide:_d};var Kd=360,Ud=260,Wd=.5,Zd=.85,qd=2,Jd=[1,0,0,1,0,0],Yd=["auto","follow","level"],Xd=["center","on"];function Rs(e,t={}){ru(e,t);function n(o,a){let i=typeof e=="string"?a.icons.get(e):e;if(!i)throw new RangeError(`travel: unknown icon "${String(e)}". Register it with registerIcon(icon), or pass the icon itself.`);let s=eu(o,t.along);if(!s||!(s.length>=Wd))return;let c=t.size===void 0?1:t.size==="fit"?Zd*s.thickness/i.box.height:t.size/i.size;if(c>0)return Qd(s,i,c,t)}function r(o,a){let i=n(o,a),s,c,d=0,l=()=>{if(!i){s?.remove(),s=c=void 0;return}(!s||c?.icon!==i.icon||c.size!==i.size)&&(s?.remove(),s=a.layer.icon(i.icon,{size:i.size}),c={icon:i.icon,size:i.size}),s.place(i.transform(d))};return a.onChange(u=>{i=n(u,a),l()}),{get trip(){return i},show(u){d=u,l()}}}return{kind:"geometry",async run(o,a){if(a.signal.aborted)return;let i=r(o,a),s=i.trip;if(!s||s.span<=0){i.show(1);return}await a.tween({duration:s.duration,timing:"effect",ease:s.gait.ease??At,update:c=>i.show(c)}).finished},end(o,a){r(o,a).show(1)},clear(){}}}function Qd(e,t,n,r){let o=typeof r.gait=="function"?r.gait:vr[r.gait??t.gait??"slide"](),a=e.length,i=t.footprint[0]*n,s=t.footprint[1]*n,c=Math.max(0,a-i-s),d=Math.max(qd,(i+s)/2),l=t.radius??t.box.height/2,{anchor:u}=t,m={x:u.x+n*(t.pivot.x-u.x),y:u.y+n*(t.pivot.y-u.y)},p=r.ride==="on"?e.thickness/2+(t.box.y+t.box.height-u.y)*n:0,k=r.orient??"auto";return{icon:t,size:t.size*n,span:c,duration:Math.max(Ud,c/Kd*1e3)*(o.pace??1),gait:o,transform(h){let T=i+h*c,V=o({distance:h*c/n,length:c/n,progress:h,radius:l}),G=tu(e,T),H=nu(e,Math.min(T,a),d),b=k==="auto"&&t.upright===!0&&Math.cos(H)<-1e-9,M=k==="level"?0:b?er(H-Math.PI):H;return ve.multiply(ve.translate(G.x,G.y),ve.rotate(M),b?ve.scale(-1,1):Jd,ve.translate(-u.x,-u.y-V.lift*n-p),ve.rotate(V.spin-V.tilt,m))}}}function eu(e,t){return t===void 0?e:e.segments?e.segments.find(n=>n.series===t):e.series===t?e:void 0}function tu(e,t){let{length:n}=e;return t<=n?e.path(t/n):rr(e.end,e.angle(1),t-n)}function nu(e,t,n){let{length:r}=e,o=Math.min(n,t,r-t);if(o>1e-6){let a=e.path((t-o)/r),i=e.path((t+o)/r);if(Math.hypot(i.x-a.x,i.y-a.y)>1e-9)return Math.atan2(i.y-a.y,i.x-a.x)}return e.angle(t/r)}function ru(e,t){if(!(typeof e=="string"&&e!=="")&&(typeof e!="object"||e===null||typeof e.name!="string"))throw new TypeError(`travel needs an icon or an icon's name, got ${e===null?"null":typeof e}.`);let{along:r,gait:o,size:a,orient:i,ride:s}=t;if(r!==void 0&&typeof r!="string")throw new RangeError(`travel: along must be a series name, got ${String(r)}.`);if(o!==void 0&&typeof o!="function"&&!Object.prototype.hasOwnProperty.call(vr,o))throw new RangeError(`travel: gait must be a gait or one of roll, step, slide, got ${String(o)}.`);if(a!==void 0&&a!=="fit"&&!(typeof a=="number"&&a>0&&Number.isFinite(a)))throw new RangeError(`travel: size must be more than 0 px, or "fit", got ${String(a)}.`);if(i!==void 0&&!Yd.includes(i))throw new RangeError(`travel: orient must be auto, follow or level, got ${String(i)}.`);if(s!==void 0&&!Xd.includes(s))throw new RangeError(`travel: ride must be center or on, got ${String(s)}.`)}var ou=900,ao=.25,au=8,iu=.35;function io(e={}){cu(e);let t=e.width??au,n=e.opacity??iu,{color:r}=e,o=(a,i)=>{let s=t*su(i);a.mark.set({halo:s>0?{width:s,opacity:n,...r===void 0?{}:{color:r}}:void 0})};return{kind:"geometry",async run(a,i){i.signal.aborted||await i.tween({duration:ou,timing:"effect",ease:at,update:s=>o(i,s)}).finished},end(){},clear(){}}}function su(e){return!(e>0)||e>=1?0:e<ao?Cs(e/ao):1-Cs((e-ao)/(1-ao))}function Cs(e){if(!(e>0))return 0;if(e>=1)return 1;let t=0,n=1;for(let o=0;o<24;o++){let a=(t+n)/2;1.74*a*a*(1-a)+a*a*a<e?t=a:n=a}let r=(t+n)/2;return 3*r*r-2*r*r*r}function cu(e){let{width:t,opacity:n,color:r}=e;if(t!==void 0&&!(typeof t=="number"&&t>0&&Number.isFinite(t)))throw new RangeError(`flash: width must be more than 0 px, got ${String(t)}.`);if(n!==void 0&&!(typeof n=="number"&&n>0&&n<=1))throw new RangeError(`flash: opacity must be more than 0 and at most 1, got ${String(n)}.`);if(r!==void 0&&(typeof r!="string"||r===""))throw new RangeError(`flash: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}var lu=450,Ls=[1,-.5,.25],wa=3,du=.5,uu=64,fu=Math.PI/12;function so(e={}){yu(e);let t=e.swing??wa;return{kind:"geometry",async run(n,r){if(r.signal.aborted)return;let o=n,a=Ps(n,t),i=0,s=()=>{let c=a*mu(i);r.mark.set({transform:c===0?void 0:ve.rotate(c,o.pivot)})};r.onChange(c=>{o=c,a=Ps(c,t),s()}),await r.tween({duration:lu,timing:"effect",ease:at,update:c=>{i=c,s()}}).finished},end(){},clear(){}}}function Ps(e,t){let{pivot:n}=e,r=0;for(let o of e.outline.sample(uu))r=Math.max(r,Math.hypot(o.x-n.x,o.y-n.y));return r>=du?Math.min(fu,2*Math.asin(Math.min(1,t/(2*r)))):0}function mu(e){if(!(e>0)||e>=1)return 0;let t=e*Ls.length,n=Math.floor(t);return Ls[n]*Math.sin(Math.PI*(t-n))}function yu(e){let{swing:t}=e;if(t!==void 0&&!(typeof t=="number"&&t>0&&t<=wa))throw new RangeError(`wiggle: swing must be more than 0 and at most ${wa} px, got ${String(t)}.`)}var Os=600,pu=2,As=6,hu=12,gu=.4,bu=5e3;function co(e={}){wu(e);let t=e.times??pu,n=e.width??hu,{color:r}=e,o=(a,i)=>{let s=i>0&&i<1;a.mark.set({halo:s?{width:n*At(i),opacity:gu*(1-i),...r===void 0?{}:{color:r}}:void 0})};return{kind:"geometry",async run(a,i){let s=0;for(let c=0;c<t;c++){if(i.signal.aborted)return;let d=i.motion.duration(Os,"effect");if(s+d>=bu)return;s+=d,await i.tween({duration:Os,timing:"effect",ease:at,update:l=>o(i,l)}).finished}},end(){},clear(){}}}function wu(e){let{times:t,width:n,color:r}=e;if(t!==void 0&&!(Number.isInteger(t)&&t>=1&&t<=As))throw new RangeError(`pulse: times must be a whole number from 1 to ${As}, got ${String(t)}.`);if(n!==void 0&&!(typeof n=="number"&&n>0&&Number.isFinite(n)))throw new RangeError(`pulse: width must be more than 0 px, got ${String(n)}.`);if(r!==void 0&&(typeof r!="string"||r===""))throw new RangeError(`pulse: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}var vu=["below","above"];function Gs(e){Eu(e);let{compareTo:t}=e,n=e.when??"below",r=e.color??"negative",o=(a,i,s)=>{let c=[],d=i,l=u=>{let m=u.length>=.5?Mu(d.samples,ku(t,d),n):[],p={stroke:r,width:u.thickness,linecap:"butt"};m.forEach(([k,h],T)=>{let V=u.slice(k,h),G=c[T];G?G.update(V,p):c.push(s.layer.path(V,p))});for(let k of c.splice(m.length))k.remove()};s.onChange((u,m)=>{d=m??d,l(u)}),l(a)};return{kind:"data",...typeof t=="string"?{needs:Object.freeze({related:Object.freeze([t])})}:{},run:async(a,i,s)=>{s.signal.aborted||o(a,i,s)},end:(a,i,s)=>o(a,i,s),clear(){}}}function ku(e,t){if(typeof e=="number")return{place:i=>i.t,valueAt:()=>e,bends:[]};let n=t.related(e);if(!n)return;let o=t.samples.every(i=>va(i.at)!==void 0)&&n.samples.every(i=>va(i.at)!==void 0)?i=>va(i.at):i=>i.t,a=n.samples.map(i=>({u:o(i),value:i.value})).filter(i=>Number.isFinite(i.u)).sort((i,s)=>i.u-s.u);return{place:o,valueAt:i=>xu(a,i),bends:a.map(i=>i.u)}}function va(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 xu(e,t){let n=e[0],r=e[e.length-1];if(!n||!r||t<n.u||t>r.u)return;let o=0,a=e.length-1;for(;o<a;){let c=o+a>>1;e[c].u<t?o=c+1:a=c}let i=e[o];if(o===0||i.u===t)return i.value;let s=e[o-1];return s.value+(t-s.u)/(i.u-s.u)*(i.value-s.value)}function Mu(e,t,n){if(!t)return[];let r=n==="below"?1:-1,o=(c,d,l)=>{let u=t.valueAt(d);if(u===void 0||!Number.isFinite(u)||!Number.isFinite(l)||!Number.isFinite(c))return{t:c,past:void 0};let m=r*(u-l);return{t:c,past:Math.abs(m)<=1e-9*Math.max(Math.abs(u),Math.abs(l))?0:m}},a=[];e.forEach((c,d)=>{let l=t.place(c);a.push(o(c.t,l,c.value));let u=e[d+1];if(!u)return;let m=t.place(u);if(l===m||!Number.isFinite(l)||!Number.isFinite(m))return;let p=[],{bends:k}=t;for(let h=Su(k,Math.min(l,m));h<k.length&&k[h]<Math.max(l,m);h++)p.push((k[h]-l)/(m-l));m<l&&p.reverse();for(let h of p)a.push(o(c.t+h*(u.t-c.t),l+h*(m-l),c.value+h*(u.value-c.value)))});let i=[],s=(c,d)=>{let l=$s(c),u=$s(d);if(!(u>l))return;let m=i[i.length-1];m&&m[1]>=l?m[1]=Math.max(m[1],u):i.push([l,u])};for(let c=1;c<a.length;c++){let d=a[c-1],l=a[c];d.past===void 0||l.past===void 0||!(l.t>d.t)||(d.past>0&&l.past>0?s(d.t,l.t):d.past>0?s(d.t,d.t+(l.t-d.t)*(d.past/(d.past-l.past))):l.past>0&&s(d.t+(l.t-d.t)*(d.past/(d.past-l.past)),l.t))}return i}var $s=e=>Math.min(1,Math.max(0,e));function Su(e,t){let n=0,r=e.length;for(;n<r;){let o=n+r>>1;e[o]<=t?n=o+1:r=o}return n}function Eu(e){let{compareTo:t,when:n,color:r}=e??{};if(!(typeof t=="string"?t!=="":typeof t=="number"&&Number.isFinite(t)))throw new RangeError(`threshold: compareTo must be a finite number or a series name, got ${ka(t)}.`);if(n!==void 0&&!vu.includes(n))throw new RangeError(`threshold: when must be "below" or "above", got ${ka(n)}.`);if(r!==void 0&&(typeof r!="string"||r===""))throw new RangeError(`threshold: color must be a theme token or a CSS colour, got ${ka(r)}.`)}var ka=e=>typeof e=="string"?JSON.stringify(e):String(e);var Du=950,Tu=160,Ru=["unroll","drop"];function lo(e={}){Au(e);let t=e?.points??Tu,n=e?.align??"unroll";return{kind:"transition",async run(r,o,a){if(a.signal.aborted)return;let i=Is(r,o,a.layer,t,n),s=Ou(a.start);if(s>=1){i(1);return}let c=Mr(s),d;d=a.tween({duration:Du,timing:"transition",ease:at,update:l=>{let u=Math.min(1,c+l);i(l===0?s:it(u)),u>=1&&l<1&&d?.finish()}}),await d.finished},end(r,o,a){Is(r,o,a.layer,t,n)(1)},clear(){}}}function Is(e,t,n,r,o){let a=e.outline.closed;if(a!==t.outline.closed)return Lu(e,t,n);let i=e.outline.sample(r),s=t.outline.sample(r);if(!a)return Cu(e,t,n,i,s);let[c,d]=o==="drop"?Pu(e,t,r):[0,0],l;return u=>{let m=u<=0?e.outline.d:u>=1?t.outline.d:Vs(i,s,c,d,u,!0);l?l.update(m):l=n.path(m,{fill:"mark"})}}function Cu(e,t,n,r,o){let a;return i=>{let s=i<=0?e.outline.d:i>=1?t.outline.d:Vs(r,o,0,0,i,!1),c=i<=0?e.thickness:i>=1?t.thickness:xa(e.thickness,t.thickness,i);a?a.update(s,{width:c}):a=n.path(s,{stroke:"mark",width:c})}}function Lu(e,t,n){let r=(i,s)=>({...i.outline.closed?{fill:"mark"}:{stroke:"mark",width:i.thickness},...s===void 0?{}:{opacity:s}}),o,a;return i=>{if(i>=1){o?.remove(),o=void 0,a?a.update(t.outline.d,{opacity:void 0}):a=n.path(t.outline.d,r(t));return}a?(o?.update(e.outline.d,{opacity:1-i}),a.update(t.outline.d,{opacity:i})):e.outline.closed?(o=n.path(e.outline.d,r(e,1-i)),a=n.path(t.outline.d,r(t,i))):(a=n.path(t.outline.d,r(t,i)),o=n.path(e.outline.d,r(e,1-i)))}}function Vs(e,t,n,r,o,a){let i=e.length,s="";for(let c=0;c<i;c++){let d=e[(c+n)%i],l=t[(c+r)%i];s+=`${c===0?"M":"L"}${_e(xa(d.x,l.x,o))},${_e(xa(d.y,l.y,o))}`}return a?`${s}Z`:s}var xa=(e,t,n)=>e*(1-n)+t*n;function Pu(e,t,n){let r=n/4,o=yr(e);return o===yr(t)?[0,0]:o?[0,r]:[r,0]}function Ou(e){return typeof e=="number"&&e>0?Math.min(1,e):0}function Au(e){let{points:t,align:n}=e??{};if(t!==void 0&&!(Number.isInteger(t)&&t>=4&&t%4===0))throw new RangeError(`morph: points must be a whole multiple of 4, got ${String(t)}.`);if(n!==void 0&&!Ru.includes(n))throw new RangeError(`morph: align must be "unroll" or "drop", got ${typeof n=="string"?JSON.stringify(n):String(n)}.`)}function Ns(...e){let t=uo("sequence",e);return zs(t,async(n,r)=>{for(let o of t){if(r.signal.aborted)return;await n(o)}})}function Fs(...e){let t=uo("parallel",e);return zs(t,async n=>{await Promise.all(t.map(n))})}function Bs(e,t){if(typeof e!="string"&&typeof e!="function")throw new TypeError(`only needs a key, a series name or a predicate, got ${ar(e)}.`);let[n]=uo("only",[t]),r=typeof e=="string"?i=>i.key===e||i.series===e:e;if(n.kind==="data"){let i=n;return{kind:"data",...i.needs?{needs:i.needs}:{},run:(c,d,l)=>r(c)?i.run(c,d,l):Promise.resolve(),end:(c,d,l)=>{r(c)&&i.end(c,d,l)},clear:c=>i.clear(c)}}let o=n;return{kind:"geometry",run:(i,s)=>r(i)?o.run(i,s):Promise.resolve(),end(i,s){r(i)&&o.end(i,s)},clear:i=>o.clear(i)}}var $u=50,Gu=500;function Hs(e,t={}){let[n]=uo("stagger",[e]),r=t.delay??$u;if(!(typeof r=="number"&&r>=0&&Number.isFinite(r)))throw new RangeError(`stagger: delay must be 0 ms or more, got ${String(r)}.`);let o=async(s,c,d)=>{if(d.signal.aborted)return;let{index:l,count:u}=d.batch,m=u>1?Math.min(r,Gu/(u-1)):0,p=l>0?l*m:0;if(!(p>0))return{mark:s,data:c};let k=js(s,c,d);return await d.tween({duration:p,timing:"stagger",update:()=>{}}).finished,d.signal.aborted?void 0:k()};if(n.kind==="data"){let s=n;return{kind:"data",...s.needs?{needs:s.needs}:{},run:async(d,l,u)=>{let m=await o(d,l,u);m&&await s.run(m.mark,m.data,u)},end:(d,l,u)=>s.end(d,l,u),clear:d=>s.clear(d)}}let a=n;return{kind:"geometry",async run(s,c){let d=await o(s,void 0,c);d&&await a.run(d.mark,c)},end:(s,c)=>a.end(s,c),clear:s=>a.clear(s)}}function js(e,t,n){let r={mark:e,data:t};return n.onChange((o,a)=>{r={mark:o,data:a??r.data}}),()=>r}function zs(e,t){let n=(i,s,c)=>{let d=js(i,s,c);return l=>{let{mark:u,data:m}=d();return l.kind==="data"?l.run(u,m,c):l.run(u,c)}},r=(i,s,c)=>{for(let d of e)d.kind==="data"?d.end(i,s,c):d.end(i,c)},o=i=>{let s;for(let c of e)try{c.clear(i)}catch(d){s??(s={error:d})}if(s)throw s.error};if(e.some(i=>i.kind==="data")){let i=[...new Set(e.flatMap(c=>c.kind==="data"?c.needs?.related??[]:[]))];return{kind:"data",...i.length>0?{needs:{related:i}}:{},run:(c,d,l)=>t(n(c,d,l),l),end:(c,d,l)=>r(c,d,l),clear:o}}return{kind:"geometry",run:(i,s)=>t(n(i,void 0,s),s),end:(i,s)=>r(i,void 0,s),clear:o}}function uo(e,t){return t.forEach((n,r)=>{if(!Cr(n))throw new TypeError(`${e}: part ${r+1} needs to be a mark effect (kind "geometry" or "data"), got ${ar(n)}.`)}),[...t]}var _s=()=>{};function Ks(e){Ws("defineEffect",e);let t={kind:"geometry",run:e.run,end:e.end,clear:e.clear??_s};return Object.freeze(t)}function Us(e){Ws("defineDataEffect",e);let t=Iu(e.needs),n={kind:"data",...t?{needs:t}:{},run:e.run,end:e.end,clear:e.clear??_s};return Object.freeze(n)}function Ws(e,t){if(typeof t!="object"||t===null)throw new TypeError(`${e} needs a spec object { run, end }, got ${t===null?"null":typeof t}.`);let{run:n,end:r,clear:o}=t;if(typeof n!="function")throw new TypeError(`${e}: run must be a function that animates the mark, got ${typeof n}.`);if(typeof r!="function")throw new 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(o!==void 0&&typeof o!="function")throw new TypeError(`${e}: clear must be a function if it's given, got ${typeof o}.`)}function Iu(e){if(e===void 0)return;let t=typeof e=="object"&&e!==null?e.related:void 0;if(!(typeof e=="object"&&e!==null&&(t===void 0||Array.isArray(t)&&t.every(r=>typeof r=="string"&&r!==""))))throw new 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])})}var Vu=["roll","step","slide"],Nu=["butt","round"],Fu=["miter","round"],Zs=/^\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE.,+\-\s]*$/;function sn(e){let t=e?.name;if(typeof t!="string"||t==="")throw new TypeError(`defineIcon needs a non-empty string name, got ${JSON.stringify(t)}.`);let n=(k,h)=>{throw new RangeError(`defineIcon: "${t}" ${k} ${h}.`)},r=(k,h)=>typeof h=="number"&&Number.isFinite(h)?h:n(k,`must be a finite number, got ${String(h)}`),o=(k,h)=>r(k,h)>0?h:n(k,`must be more than 0, got ${String(h)}`),a=(k,h)=>h&&typeof h=="object"?Jn({x:r(`${k}.x`,h.x),y:r(`${k}.y`,h.y)}):n(k,"must be a point { x, y }");(!Array.isArray(e.shapes)||e.shapes.length===0)&&n("shapes","must be a non-empty array");let i=e.shapes.map((k,h)=>Bu(k,`shapes[${h}]`,n,r)),s=e.box;(!s||typeof s!="object")&&n("box","must be a rectangle { x, y, width, height }");let c=Jn({x:r("box.x",s.x),y:r("box.y",s.y),width:o("box.width",s.width),height:o("box.height",s.height)}),d=a("anchor",e.anchor),l=e.pivot===void 0?d:a("pivot",e.pivot),u=e.footprint??[Math.max(0,d.x-c.x),Math.max(0,c.x+c.width-d.x)];(!Array.isArray(u)||u.length!==2)&&n("footprint","must be [behind, ahead]"),u.forEach((k,h)=>{r(`footprint[${h}]`,k)<0&&n(`footprint[${h}]`,`can't be negative, got ${k}`)});let m=e.size===void 0?c.width:o("size",e.size),p=e.radius===void 0?c.height/2:o("radius",e.radius);return e.gait!==void 0&&!Vu.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)}`),Jn({name:t,shapes:Jn(i),box:c,size:m,anchor:d,pivot:l,footprint:Jn([u[0],u[1]]),...e.gait!==void 0?{gait:e.gait}:{},radius:p,...e.upright!==void 0?{upright:e.upright}:{}})}function Bu(e,t,n,r){(!e||typeof e!="object")&&n(t,"must be a shape { d, fill?, stroke?, \u2026 }"),(typeof e.d!="string"||!Zs.test(e.d))&&n(`${t}.d`,"must be path data starting with a move"),e.clip!==void 0&&(typeof e.clip!="string"||!Zs.test(e.clip))&&n(`${t}.clip`,"must be path data starting with a move");for(let a of["fill","stroke"]){let i=e[a];i!==void 0&&(typeof i!="string"||i==="")&&n(`${t}.${a}`,`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&&!Nu.includes(e.linecap)&&n(`${t}.linecap`,`must be butt or round, got ${String(e.linecap)}`),e.linejoin!==void 0&&!Fu.includes(e.linejoin)&&n(`${t}.linejoin`,`must be miter or round, got ${String(e.linejoin)}`);let o={d:e.d};for(let a of["fill","stroke","width","linecap","linejoin","clip"])e[a]!==void 0&&(o[a]=e[a]);return Jn(o)}var Jn=e=>Object.freeze(e);var Hu=new Set(["svg","g","a"]),ju=new Set(["path","circle","rect","ellipse","line","polyline","polygon"]),zu=/<![^<>]*>|<(\/?)([A-Za-z][\w:.-]*)((?:\s+[^\s=/<>]+(?:\s*=\s*(?:"[^"<]*"|'[^'<]*'|[^\s"'<>]+))?)*)\s*(\/?)>/g,_u=/([^\s=/<>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,Ku=/^(?:#[0-9a-fA-F]{3,8}|[a-zA-Z][a-zA-Z0-9-]*|(?:rgba?|hsla?)\([\d\s.,%+\-/]*\))$/;function Ys(e,t){if(typeof e!="string")throw new TypeError("iconFromSvg needs SVG markup as a string.");let n=typeof t?.name=="string"?`"${t.name}"`:"an icon",r=u=>{throw new RangeError(`iconFromSvg: ${n} ${u}.`)},o,a=1,i=[],s=[],c;for(let u of Uu(e).matchAll(zu)){let[,m,p,k="",h]=u;if(p===void 0)continue;let T=p.toLowerCase();if(m){let M=ef(s,T);M>=0&&(s.length=M);continue}let V=Wu(k),G=!o&&T==="svg";G&&(o=Zu(V)??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/o.width),c={fill:"#000000",stroke:"none",width:1,linecap:void 0,linejoin:void 0,transform:ve.scale(a)});let H=s.length>0?s[s.length-1].state:G?c:void 0,b=H&&!qu(V)?Ju(H,V):void 0;if(b&&ju.has(T)){let M=Yu(T,V,b);M&&i.push(M)}h||s.push({tag:T,state:Hu.has(T)?b:void 0})}o||r("needs an <svg> element"),i.length===0&&r("has nothing to draw: no path, circle, rect, ellipse, line, polyline or polygon with a fill or stroke");let d={x:o.x*a,y:o.y*a,width:o.width*a,height:o.height*a},l=u=>u&&typeof u=="object"?{x:u.x*a,y:u.y*a}:u;return sn({...t,shapes:i,box:d,anchor:l(t.anchor),...t.pivot?{pivot:l(t.pivot)}:{},...Array.isArray(t.footprint)?{footprint:[t.footprint[0]*a,t.footprint[1]*a]}:{},...typeof t.radius=="number"?{radius:t.radius*a}:{}})}function Uu(e){let t=[["<!--","-->"],["<![CDATA[","]]>"],["<?","?>"]],n=t.map(([a])=>e.indexOf(a)),r="",o=0;for(;;){let a=-1;if(n.forEach((d,l)=>{d>=0&&(a<0||d<n[a])&&(a=l)}),a<0)return r+e.slice(o);let i=n[a],s=t[a][1];r+=e.slice(o,i);let c=e.indexOf(s,i+t[a][0].length);if(c<0)return r;o=c+s.length,n.forEach((d,l)=>{d>=0&&d<o&&(n[l]=e.indexOf(t[l][0],o))})}}function Wu(e){let t=new Map;for(let[,n,r,o,a]of e.matchAll(_u))n!==void 0&&t.set(n,r??o??a??"");for(let n of(t.get("style")??"").split(";")){let r=n.indexOf(":");r>0&&t.set(n.slice(0,r).trim(),n.slice(r+1).replace(/!important/i,"").trim())}return t}function Zu(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=qs(e.get("width")),r=qs(e.get("height"));return n!==void 0&&r!==void 0?{x:0,y:0,width:n,height:r}:void 0}function qs(e){let t=/^\s*(\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 qu(e){return e.get("display")?.trim()==="none"||e.get("visibility")?.trim()==="hidden"}function Ju(e,t){let n=(s,c)=>{let d=t.get(s)?.trim();if(d===void 0||!Ku.test(d))return c;let l=d.toLowerCase();return l==="inherit"?c:l==="currentcolor"?"text":l==="none"?l:d},r=Number.parseFloat(t.get("stroke-width")??""),o=t.get("stroke-linecap")?.trim(),a=t.get("stroke-linejoin")?.trim(),i=t.get("transform");return{fill:n("fill",e.fill),stroke:n("stroke",e.stroke),width:r>=0?r:e.width,linecap:o==="butt"||o==="round"?o:e.linecap,linejoin:a==="miter"||a==="round"?a:e.linejoin,transform:i?ve.multiply(e.transform,nr(i)):e.transform}}function Yu(e,t,n){let r=n.fill==="none"?void 0:n.fill,o=n.stroke==="none"||!(n.width>0)?void 0:n.stroke;if(r===void 0&&o===void 0)return;let a=Xu(e,t);if(!a.some(s=>s.op!=="M"))return;let i=n.transform;return{d:ro(no(a,i)),...r!==void 0?{fill:r}:{},...o!==void 0?{stroke:o,width:tf(n.width*Math.sqrt(Math.abs(i[0]*i[3]-i[1]*i[2]))),...n.linecap?{linecap:n.linecap}:{},...n.linejoin?{linejoin:n.linejoin}:{}}:{}}}function Xu(e,t){let n=r=>{let o=Number.parseFloat(t.get(r)??"");return Number.isFinite(o)?o:0};switch(e){case"path":return to(t.get("d")??"");case"circle":return Js(n("cx"),n("cy"),n("r"),n("r"));case"ellipse":return Js(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 r=(t.get("points")??"").trim().split(/[\s,]+/).filter(Boolean).map(Number),o=[];for(let i=0;i+1<r.length&&Number.isFinite(r[i])&&Number.isFinite(r[i+1]);i+=2)o.push({x:r[i],y:r[i+1]});if(o.length<2)return[];let a=o.map((i,s)=>({op:s===0?"M":"L",to:i}));return e==="polygon"?[...a,{op:"Z",to:o[0]}]:a}case"rect":return Qu(n("x"),n("y"),n("width"),n("height"),t);default:return[]}}function Js(e,t,n,r){if(!(n>0&&r>0))return[];let o=a=>({op:"A",rx:n,ry:r,rotation:0,large:!1,sweep:!0,to:{x:a,y:t}});return[{op:"M",to:{x:e+n,y:t}},o(e-n),o(e+n),{op:"Z",to:{x:e+n,y:t}}]}function Qu(e,t,n,r,o){if(!(n>0&&r>0))return[];let a=l=>{let u=Number.parseFloat(o.get(l)??"");return u>=0?u:void 0},i=Math.min(a("rx")??a("ry")??0,n/2),s=Math.min(a("ry")??a("rx")??0,r/2),c=(l,u)=>({op:"L",to:{x:l,y:u}});if(!(i>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 d=(l,u)=>({op:"A",rx:i,ry:s,rotation:0,large:!1,sweep:!0,to:{x:l,y:u}});return[{op:"M",to:{x:e+i,y:t}},c(e+n-i,t),d(e+n,t+s),c(e+n,t+r-s),d(e+n-i,t+r),c(e+i,t+r),d(e,t+r-s),c(e,t+s),d(e+i,t),{op:"Z",to:{x:e+i,y:t}}]}function ef(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].tag===t)return n;return-1}var tf=e=>Math.round(e*1e3)/1e3;var nf=sn({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}}),rf=sn({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}}),of=sn({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}}),fo=Object.freeze({dot:nf,arrow:rf,chevron:of});var Ma=ko({kind:"preset",entries:{flash:()=>io(),wiggle:()=>so(),pulse:()=>co()},hint:"Register custom presets with registerPreset(name, factory)."}),Sa=ko({kind:"icon",entries:fo,hint:"Register icons with registerIcon(icon) or registerIcons(icons)."});function Xs(e,t){if(typeof t!="function")throw new TypeError(`registerPreset("${e}") needs a function that returns an effect.`);Ma.register(e,t)}function Ea(e){if(typeof e!="object"||e===null||typeof e.name!="string")throw new TypeError("registerIcon needs an icon with a name.");Sa.register(e.name,e)}function Qs(e){for(let t of e)Ea(t)}function ec(e){if(typeof e!="object"||e===null)throw new TypeError("configure needs an options object.");if("nonce"in e){if(e.nonce!==void 0&&(typeof e.nonce!="string"||e.nonce===""))throw new TypeError("configure: nonce must be a non-empty string.");un.nonce=e.nonce}if("injectStyles"in e){if(e.injectStyles!==void 0&&typeof e.injectStyles!="boolean")throw new TypeError("configure: injectStyles must be true or false.");un.injectStyles=e.injectStyles}}var af="0.1.0",Yn={presets:Ma,icons:Sa,motion:pt};function sf(e,t){return Go(e,t,Yn)}function cf(e,t){return Ko(e,t,Yn)}function lf(e,t){return aa(e,t,Yn)}function df(e,t){let n=typeof t=="object"&&t!==null&&t.transition===void 0?{...t,transition:lo()}:t;return ha(e,n,Yn)}function uf(e,t){return Zn(e,t,Yn)}function ff(e,t){return eo(e,t,Yn)}function mf(e,t=pt,n){return ga(e,t,n)}return cc(yf);})();
84
+ `,pi="data-expressive-charts";var hn={};function gt(e){if(hn.injectStyles===!1||e.querySelector(`style[${pi}]`))return;let t=e.createElement("style");t.setAttribute(pi,""),hn.nonce&&t.setAttribute("nonce",hn.nonce),t.textContent=nl,(e.head??e.documentElement).appendChild(t)}function Hr(e={}){let t=new Map;for(let[n,r]of Object.entries(e)){if(!Number.isInteger(r)||r<1||r>8)throw new RangeError(`colorAssignment: the slot for "${n}" must be a whole number from 1 to ${8}, got ${String(r)}.`);t.set(n,r)}return{slot(n){let r=t.get(n);if(r===void 0){let o=new Set(t.values());for(r=1;o.has(r)&&r<=8;)r++;r>8&&(r=t.size%8+1),t.set(n,r)}return r}}}function $t(e){return e&&typeof e.slot=="function"?e:Hr(e)}function bi(e,t){if(e===void 0||typeof e=="boolean")return;let n=o=>{throw new TypeError(`${t}: ${o}`)};(typeof e!="object"||e===null||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((o,a)=>{let{label:i,color:s}=typeof o=="object"&&o!==null?o:n(`legend.entries[${a}] must be an object with a label and a color.`);(typeof i!="string"||i.trim()==="")&&n(`legend.entries[${a}].label must be a non-empty string: the entry's name.`),(typeof s!="string"||s.trim()==="")&&n(`legend.entries[${a}].color must be a theme token or a CSS colour.`),(s==="mark"||s==="mark-strong")&&n(`legend.entries[${a}].color can't be "${s}": an entry has no mark. Use a theme token or a CSS colour.`)}))}var gi=e=>typeof e=="object"?e.entries??[]:[];function On(e){let t,n="",r=()=>{t?.remove(),t=void 0,n=""},o=(a,i,s,c)=>{let d=[...a.map(({key:f,label:h})=>({key:f,label:h,styles:ht(at(i.slot(f)))})),...c.map(({label:f,color:h})=>({key:void 0,label:f,styles:{"--ec-mark":it(h)}}))],l=e.ownerDocument;t??(t=Object.assign(l.createElement("div"),{className:"ec-legend"})),t.nextSibling!==e&&e.before(t);let u=JSON.stringify([s,d]);u!==n&&(n=u,t.replaceChildren(...d.map(({key:f,label:h,styles:w})=>{let v=l.createElement("span");v.className="ec-legend-item",f!==void 0&&v.setAttribute(s,f);for(let[P,V]of Object.entries(w))V!==void 0&&v.style.setProperty(P,V);let D=l.createElement("span");D.className="ec-legend-swatch";let F=l.createElement("span");return F.className="ec-legend-label",F.textContent=h,v.append(D,F),v})))};return{update(a,i,s){let c=gi(s);s===!1||a.length+c.length<2?r():o(a.map(({series:d,label:l})=>({key:d,label:l})),i,"data-series",c)},categories(a,i,s){s===!1||a.length===0?r():o(a,i,"data-key",gi(s))},destroy:r}}var zt=e=>e!==void 0&&e.source!=="linked",jo=new WeakMap,jr=new WeakSet;function _t(e,t){return jo.set(t,e),t}var wi=e=>jo.get(e);function zo(e,t={}){if(!Array.isArray(e))throw new TypeError("link needs an array of charts and attachments: link([columns, line]).");if(typeof t!="object"||t===null)throw new TypeError("link: options must be an object, such as { by: (event) => event.data.datum.week }.");let{by:n,effects:r=!0}=t;if(n!==void 0&&typeof n!="function")throw new TypeError("link: by must be a function, such as (event) => event.data.datum.week.");if(typeof r!="boolean")throw new TypeError(`link: effects must be true or false, got ${String(r)}.`);let o=[];for(let l of e){let u=typeof l=="object"&&l!==null?jo.get(l):void 0;if(!u)throw new TypeError("link: each source must be a chart (barChart, donutChart or lineChart) or an attachment (expressive or fromVegaView). A chartSwitch can't be linked yet.");if(jr.has(u)||o.includes(u))throw new TypeError("link: a chart or attachment can be in one link at a time. Destroy the link it's in first.");o.push(u)}let a=new Set,i;function s(l){let u;if(n)try{u=n(l)}catch(f){Se(f);return}else{let{samples:f}=l.data;u=f[f.length-1]?.at??l.mark.key}return u instanceof Date?Number.isNaN(u.getTime())?void 0:u.toISOString():u==null?void 0:String(u)}function c(l,u){i=l;let f=new Set(u.map(s));f.delete(void 0);let h=w=>w.some(v=>{let D=s(v);return D!==void 0&&f.has(D)});for(let w of a){if(w===l)continue;let v=f.size===0?[]:w.targets().flatMap(D=>h(D.marks)?[D.key]:[]);if(w.hover(v,r),i!==l)return}}function d(l){if(i===l){i=void 0;for(let u of a)u.unlink()}}for(let l of o)l.listen({hover:f=>c(l,f),leave:()=>d(l),dismiss(){let f=i;f?.leave(),f&&d(f)},gone(){a.delete(l),jr.delete(l),d(l)}})&&(a.add(l),jr.add(l));return{destroy(){for(let l of a)l.listen(void 0),l.unlink(),jr.delete(l);a.clear(),i=void 0}}}var vi=["presentation","analysis","off"];function cn(e,t){if(e===void 0)return t;if(typeof e!="string")return e;if(!vi.includes(e))throw new TypeError(`Unknown motion mode "${String(e)}". Use one of: ${vi.join(", ")}.`);let n=()=>t.viewerChoice??(t.prefersReduced?"off":e);return{get mode(){return n()},get staged(){return n()==="presentation"},duration(r,o="transition"){let a=n();return a==="off"?0:ir(r,ar[a][o])},subscribe:r=>t.subscribe(r)}}var ki=2,rl=2,xi=new WeakMap,ol=0;function zr(e){let t=e.ownerDocument,n=(xi.get(t)??0)+1;xi.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 o=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 $e(a,{fill:"none",stroke:it("focus")}),{draw(i){if(!i){le(a,{visibility:"hidden"});return}let{outline:s,thickness:c,transform:d}=i,l=s.closed?0:c;le(o,{d:s.d,fill:s.closed?"black":"none","stroke-width":l+2*ki}),le(a,{d:s.d,"stroke-width":l+2*(ki+rl),transform:d&&pt(d),visibility:void 0})}}}function _r(){let e,t=()=>{e?.remove(),e=void 0};return{paint(n,r,o,a){if(!o||!n||r.length===0){t();return}(!e||e.parentNode!==n)&&(e?.remove(),e=Y("g",{class:"ec-halo"},n)),e.textContent="";let i=`ec-halo-mask-${++ol}`,s=Y("mask",{id:i,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 c of r){let d=c.stroke===void 0?{fill:"black"}:{fill:"none",stroke:"black","stroke-width":c.stroke,"stroke-linejoin":"round"};Y("path",{d:c.d,...d},s)}le(e,{transform:a&&pt(a)});for(let c of r){let d=c.stroke!==void 0,l=Y("path",{d:c.d,"stroke-width":o.width+(c.stroke??0),"stroke-opacity":o.opacity,"stroke-linejoin":"round","stroke-linecap":d?"round":void 0,mask:`url(#${i})`},e);$e(l,{fill:"none",stroke:o.color===void 0?c.color??it("mark"):it(o.color)})}},remove:t}}function gn(e,t={}){let n={},r,o=t.halos&&_r(),a=()=>{let s=e();if(!s)return;let{body:c,parts:d}=s;le(c,{transform:n.transform&&pt(n.transform),opacity:n.opacity});let l=n.emphasis;for(let u of d)$e(u.element,{[u.open?"stroke":"fill"]:l===void 0?void 0:al(u.colors,l),transition:l===void 0?void 0:"none"});i(c,d)},i=(s,c)=>{let d=n.halo;if(o){let u=c.flatMap(f=>f.visible?[{d:f.d,color:f.colors.color,...f.open?{stroke:f.open.width}:{}}]:[]);o.paint(t.halos?.(),u,d,n.transform);return}if(!d){r?.remove(),r=void 0;return}(!r||r.parentNode!==s)&&(r?.remove(),r=Y("g",{class:"ec-halo"},s),s.insertBefore(r,s.firstChild));let l=c.filter(u=>u.visible);for(;r.childElementCount>l.length;)r.lastElementChild?.remove();l.forEach((u,f)=>{let h=r.children[f]??Y("path",{"stroke-linejoin":"round"},r);le(h,{d:u.d,"stroke-width":d.width+(u.open?.width??0),"stroke-opacity":d.opacity,"stroke-linecap":u.open?"round":void 0}),$e(h,{fill:"none",stroke:d.color===void 0?u.colors.color:it(d.color)})})};return{get style(){return n},set(s){n=Yt(n,s),a()},reset(){n={},a()},repaint:a}}function al(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})`}var il=0;function pr(e){return{icon(t,n){let r=n?.size;if(r!==void 0&&!(r>=0))throw new RangeError(`layer.icon: size must be a non-negative number, got ${String(r)}.`);let o=Y("g",{class:"ec-icon","data-icon":t.name,visibility:"hidden"},e),a=r===void 0||!(t.size>0)?1:r/t.size,i=a===1?o:Y("g",{transform:pt(xe.scale(a,a,t.anchor))},o);for(let c of t.shapes)sl(c,i);return{place(c){le(o,{transform:pt(c),visibility:void 0})},remove:()=>o.remove()}},path(t,n){let r=Y("path",{class:"ec-path",d:t},e),o={...n};return Mi(r,o),{update(i,s){r.setAttribute("d",i),s&&(o=Yt(o,s),Mi(r,o))},remove:()=>r.remove()}},text(t,n){let r=Y("text",{class:"ec-text"},e);r.textContent=t;let o={...n};return Si(r,o),{update(i,s){o=Yt(o,i),Si(r,o),s!==void 0&&(r.textContent=s)},remove:()=>r.remove()}}}}function sl(e,t){let n;if(e.clip!==void 0){n=`ec-clip-${++il}`;let o=Y("clipPath",{id:n},t);Y("path",{d:e.clip},o)}let r=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},t);$e(r,{fill:e.fill===void 0?"none":it(e.fill),stroke:e.stroke===void 0?void 0:it(e.stroke)})}function Mi(e,t){le(e,{"stroke-width":t.stroke===void 0?void 0:t.width??1,opacity:t.opacity,"stroke-linecap":t.linecap,"stroke-linejoin":"round"}),$e(e,{fill:t.fill===void 0?"none":it(t.fill),stroke:t.stroke===void 0?void 0:it(t.stroke)})}function Si(e,t){le(e,{x:t.at.x,y:t.at.y,"text-anchor":t.anchor??"start",opacity:t.opacity}),$e(e,{fill:it(t.color??"text")})}function ln(e){let{overlay:t}=e,n=new WeakMap,r=new Map,o=new Set;return{group(a,i,s){let c=Y("g",{class:"ec-run","data-key":a,"data-slot":i,visibility:o.has(a)?"hidden":void 0},t);$e(c,ht(e.colors(a))),n.set(c,s);let d=Array.from(t.children).find(f=>(n.get(f)??-1/0)>s);t.insertBefore(c,d??null);let l=r.get(a);l||r.set(a,l=new Set),l.add(c);let u=l;return{...pr(c),clear(){c.remove(),u.delete(c),u.size===0&&r.get(a)===u&&r.delete(a)}}},mark:a=>e.mark(a),recolor(a){let i=r.get(a);if(!i)return;let s=ht(e.colors(a));for(let c of i)$e(c,s)},hide(a,i){i?o.add(a):o.delete(a);for(let s of r.get(a)??[])le(s,{visibility:i?"hidden":void 0})}}}function Xe(e,t){return e!==void 0&&Object.prototype.hasOwnProperty.call(e,t)?e[t]??t:t}function Ei(e,t){if(e!==void 0){if(typeof e!="object"||e===null||Array.isArray(e))throw new 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 new TypeError(`${t}: seriesLabels.${n} must be a name, not ${typeof r=="string"?"blank":String(r)}.`)}}function An(e){let t={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set};function n(r,o){for(let a of[...t[r]])try{a(o)}catch(i){Se(i)}}return{emit:n,emitEach(r,o,a){o.forEach((i,s)=>n(r,{...a(i),batch:{index:s,count:o.length}}))},on(r,o){let a=t[r];if(!a)throw new TypeError(`${e}: unknown event "${String(r)}". Use one of: ${Object.keys(t).join(", ")}.`);return a.add(o),()=>{a.delete(o)}},clear(){for(let r of Object.values(t))r.clear()}}}function qe(e){return e.format??cl}var _o;function cl(e){return _o??(_o=new Intl.NumberFormat(void 0,{maximumFractionDigits:2})),_o.format(e)}function Kt(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 bn(e,t){let n=10**t,r=Math.round(e*n)/n;return r===0?0:r}function wn(e){return`${bn(e*100,0)}%`}function Kr(e,t){let n=e.ownerDocument,r,o="mouse",a=(f,h)=>{f?.key!==r&&(i(),f&&(r=f.key,t.hover(f,h)))},i=()=>{r!==void 0&&(r=void 0,t.leave())},s=f=>{f.pointerType!=="touch"&&a(t.find(f.target),"pointer")},c=f=>{f.pointerType!=="touch"&&i()},d=f=>{o=f.pointerType},l=f=>{o==="touch"&&a(t.find(f.target),"touch")},u=f=>{r!==void 0&&f.pointerType==="touch"&&!e.contains(f.target)&&i()};return e.addEventListener("pointerover",s),e.addEventListener("pointerleave",c),e.addEventListener("pointerdown",d),e.addEventListener("click",l),n.addEventListener("pointerdown",u,!0),{get current(){return r},clear:i,destroy(){r=void 0,e.removeEventListener("pointerover",s),e.removeEventListener("pointerleave",c),e.removeEventListener("pointerdown",d),e.removeEventListener("click",l),n.removeEventListener("pointerdown",u,!0)}}}function Ur(e,t){let n,r,o,a,i,s=[],c=!0,d=t.tabIndex??((x,R)=>{let O=t.element(x);R===void 0?O?.removeAttribute("tabindex"):O?.setAttribute("tabindex",R)}),l=x=>{for(let R of x)d(R,R===i?"0":"-1")},u=x=>{i=x,l(t.order()),t.element(x)?.focus()},f=()=>{let x=r;r=void 0,x!==void 0&&t.blur(x)},h=x=>{!x.metaKey&&!x.altKey&&!x.ctrlKey&&(c=!0)},w=()=>{c=!1,a=void 0},v=x=>{a=void 0;let R=t.find(x.target);if(R===void 0){f();return}let O=t.element(R);O&&O!==x.target&&x.target.getAttribute("aria-hidden")==="true"&&(O.focus(),n?.scope.activeElement===O)||(o={key:R,element:x.target},R!==r&&(r=R,i=R,l(t.order()),t.focus(R,c)))},D=x=>{let R=o?.element;r===void 0||!R||x.target!==R||t.find(x.relatedTarget)===void 0&&(f(),x.relatedTarget===null&&(a=R,queueMicrotask(()=>{a===R&&R.isConnected&&(a=void 0)})))},F=x=>{let R=t.find(x.target);if(R===void 0||x.altKey||x.ctrlKey||x.metaKey)return;let O=t.order(),G=O.indexOf(R),g;switch(x.key){case"ArrowDown":case"ArrowRight":g=O[Math.min(O.length-1,G+1)];break;case"ArrowUp":case"ArrowLeft":g=O[Math.max(0,G-1)];break;case"Home":g=O[0];break;case"End":g=O[O.length-1];break;case"Escape":t.escape(R)&&x.preventDefault();return;default:return}x.preventDefault(),g!==void 0&&g!==R&&u(g)},P=()=>{n&&(n.doc.removeEventListener("keydown",h,!0),n.doc.removeEventListener("pointerdown",w,!0),n.scope.removeEventListener("focusin",v,!0),n.scope.removeEventListener("focusout",D,!0),n.svg.removeEventListener("keydown",F),n=void 0)},V=()=>{let x=e(),R=x?.getRootNode(),O=R&&"host"in R?R:x?.ownerDocument;x===n?.svg&&O===n?.scope||(P(),!(!x||!O)&&(n={svg:x,doc:x.ownerDocument,scope:O},n.doc.addEventListener("keydown",h,!0),n.doc.addEventListener("pointerdown",w,!0),n.scope.addEventListener("focusin",v,!0),n.scope.addEventListener("focusout",D,!0),n.svg.addEventListener("keydown",F)))};return V(),{active:()=>n?.scope.activeElement??null,focus(x){c=!0,x===r&&o?.element===n?.scope.activeElement?t.focus(x,!0):u(x)},sync(){V();let x=t.order(),R=new Set(x),O=s.filter(U=>!R.has(U));(i===void 0||!R.has(i))&&(i=ll(s,i,R)??x[0]);let G=!n?.doc.activeElement||n.doc.activeElement===n.doc.body,g=o!==void 0&&!o.element.isConnected&&(r!==void 0||o.element===a&&G),E=o&&(o.element===n?.scope.activeElement||g)?o:void 0;a=void 0,E&&!R.has(E.key)?i!==void 0?u(i):E.element.isConnected?E.element.blur():f():E&&t.find(E.element)!==E.key&&u(E.key),l(x);for(let U of O)d(U,void 0);s=x},destroy(){r=void 0,o=void 0,a=void 0,P()}}}function ll(e,t,n){let r=t===void 0?-1:e.indexOf(t);if(!(r<0))for(let o=1;o<e.length;o++)for(let a of[r+o,r-o]){let i=e[a];if(i!==void 0&&n.has(i))return i}}function $n(e){let{svg:t,runner:n,events:r}=e,o=g=>e.marks?.(g)??[g],a=g=>(e.markElement??e.element)(g),i,s,c,d=!1,l=g=>g.flatMap(E=>{let U=e.onScreen(E);return U?[{key:E,input:U}]:[]}),u=g=>g.length===1?o(g[0]):[...new Set(g.flatMap(o))];function f(g,E,U,k){if(g.length===0)return;U&&n.hover(g.map(({input:H})=>H));let T=g.length;g.forEach(({input:H},_)=>r.emit("hover",{...H,batch:{index:_,count:T},source:E,...k===void 0?{}:{segment:k}}))}function h(g){let E=l(g);if(E.length===0)return;for(let{key:k}of E)a(k)?.classList.remove("ec-hot");n.leave(E.map(({key:k})=>k));let U=E.length;E.forEach(({input:k},T)=>r.emit("leave",{...k,batch:{index:T,count:U}}))}function w(g,E,U,k=!0){let T=l(u(g)),H={keys:g,source:E,marks:T.map(_=>_.key),effects:k};i=H;for(let{key:_}of T)a(_)?.classList.add("ec-hot");e.dim()&&t.classList.add("ec-hovering"),E!=="linked"&&(e.tooltip.show(g[0]),P(!0)),f(T,E,k,U),E!=="linked"&&i===H&&c?.hover(T.map(({input:_})=>_))}function v(){let g=i;i=void 0,P(!1),t.classList.remove("ec-hovering"),e.tooltip.hide(),h(g?.marks??[]),zt(g)&&c?.leave()}let D,F=g=>{g.key==="Escape"&&!g.defaultPrevented&&i!==void 0&&V()};function P(g){D?.removeEventListener("keydown",F),D=g?t.ownerDocument:void 0,D?.addEventListener("keydown",F)}function V(){R.clear(),i!==void 0&&v()}let x=(g,E)=>E===g||e.live(g)&&o(g).includes(E),R=Kr(t,{find:e.find,hover(g,E){!e.live(g.key)||zt(i)&&i.keys[0]===g.key||(v(),w([g.key],E,g.segment))},leave(){(i?.source==="pointer"||i?.source==="touch")&&v()}}),O=Ur(()=>t,{find:g=>e.find(g)?.key,order:e.order,element:e.element,focus(g,E){if(s=E?g:void 0,e.ring(s),!!e.live(g)){if(!E){i?.source==="keyboard"&&i.keys[0]!==g&&v();return}if(zt(i)&&i.keys[0]===g){i={...i,source:"keyboard"};return}v(),w([g],"keyboard")}},blur(){s=void 0,e.ring(s),i?.source==="keyboard"&&(R.current===i.keys[0]?i={...i,source:"pointer"}:v())},escape(){return i?(i.source==="linked"&&c?c.dismiss():v(),!0):!1}});return{get key(){return zt(i)?i.keys[0]:void 0},get ringKey(){return s},link:{targets:()=>e.order().map(g=>({key:g,marks:l(o(g)).map(({input:E})=>E)})),hover(g,E){i!==void 0&&v();let U=g.filter(e.live);U.length>0&&w(U,"linked",void 0,E)},unlink(){i?.source==="linked"&&v()},leave:V,listen(g){return d?!1:(c=g,!0)}},active:()=>O.active(),restyled(g){s!==void 0&&x(s,g)&&e.ring(s);let E=zt(i)?i.keys[0]:void 0;E!==void 0&&(i?.marks.includes(g)||g===E)&&e.live(E)&&e.tooltip.show(E)},syncDim(){e.dim()?i!==void 0&&t.classList.add("ec-hovering"):t.classList.remove("ec-hovering")},dropGone(){if(i===void 0)return;let g=i.keys.filter(e.live);if(g.length===0){R.clear(),v();return}let{source:E,marks:U,effects:k}=i,T=l(u(g));if(i={...i,keys:g},T.length===U.length&&T.every((z,Z)=>z.key===U[Z]))return;let H=new Set(U),_=new Set(T.map(z=>z.key)),te=l(U.filter(z=>!_.has(z)));i={...i,marks:T.map(z=>z.key)};for(let{key:z}of te)a(z)?.classList.remove("ec-hot");for(let{key:z}of T)H.has(z)||a(z)?.classList.add("ec-hot");n.leave(U),k&&n.hover(T.map(({input:z})=>z)),te.forEach(({input:z},Z)=>r.emit("leave",{...z,batch:{index:Z,count:te.length}}));let ae=T.length;T.forEach(({key:z,input:Z},se)=>{H.has(z)||r.emit("hover",{...Z,batch:{index:se,count:ae},source:E})})},sync:()=>O.sync(),focus(g){e.live(g)&&O.focus(g)},leave:V,destroy(){d=!0,c?.gone(),c=void 0,P(!1),R.destroy(),O.destroy()}}}function dn(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 Gn(e){let t=new Map;return{get:n=>t.get(n),values:()=>t.values(),start(n){t.set(n.key,n),n.group.classList.add("ec-leaving"),n.group.setAttribute("aria-hidden","true"),n.leave=dl()},recall(n){let r=t.get(n);if(r)return t.delete(n),r.group.classList.remove("ec-leaving"),r.group.removeAttribute("aria-hidden"),r.leave?.resolve(),r.leave=void 0,r},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 dl(){let e;return{exited:!1,gone:new Promise(n=>{e=n}),resolve:e}}function vn(e,t,n,r){if(!n.some((s,c)=>t[c]!==s))return;let o=r(),a=n.findIndex(s=>s===o),i=n[a]??null;n.forEach((s,c)=>{c<a?e.insertBefore(s,i):c>a&&e.appendChild(s)})}function Ti(e,t){if(e===void 0||typeof e=="boolean"||e==="hidden")return;let n=l=>{throw new TypeError(`${t}: ${l}`)};(typeof e!="object"||e===null)&&n('table must be true, false, "hidden" or an object of table options.');let{hidden:r,columns:o,category:a,total:i,share:s,summary:c,series:d}=e;r!==void 0&&typeof r!="boolean"&&n("table.hidden must be true or false.");for(let[l,u]of Object.entries({category:a,total:i,share:s,summary:c}))u!==void 0&&typeof u!="string"&&n(`table.${l} must be a string.`);if(d!==void 0){(typeof d!="object"||d===null||Array.isArray(d))&&n('table.series must be an object of headers by series, as { shots: "Shots" }.');for(let[l,u]of Object.entries(d))typeof u!="string"&&n(`table.series.${l} must be a string: the column's header.`)}o!==void 0&&(Array.isArray(o)||n("table.columns must be an array of { label, field }."),o.forEach((l,u)=>{let f=typeof l=="object"&&l!==null?l:n(`table.columns[${u}] must be an object with a label and a field.`);typeof f.label!="string"&&n(`table.columns[${u}].label must be a string: the column's header.`),typeof f.field!="string"&&typeof f.field!="function"&&n(`table.columns[${u}].field must be a field name or a function of the row.`),f.format!==void 0&&typeof f.format!="function"&&n(`table.columns[${u}].format must be a function.`),f.after!==void 0&&f.after!=="category"&&f.after!=="values"&&n(`table.columns[${u}].after must be "category" or "values".`)}))}function In(e){let{option:t,format:n}=e;if(t===!1)return;let r=typeof t=="object"?t:{},o=r.columns??[],a=o.filter(x=>x.after!=="values"),i=o.filter(x=>x.after==="values"),s=e.total??e.series.length>1,c=x=>({text:n(x),numeric:!0}),d=e.rows.reduce((x,R)=>x+R.total,0),l=x=>e.shares?[{text:wn(d>0?x/d:0),numeric:!0}]:[],u=x=>({text:x.label,numeric:!1}),f=x=>r.series&&Object.prototype.hasOwnProperty.call(r.series,x)?r.series[x]:void 0,h=()=>({text:"",numeric:!1}),w=[{text:r.category??e.category??"Category",numeric:!1},...a.map(u),...e.series.map(x=>({text:f(x)??e.label?.(x)??x,numeric:!0})),...s?[{text:r.total??"Total",numeric:!0}]:[],...e.shares?[{text:r.share??"Share",numeric:!0}]:[],...i.map(u)],v=e.rows.map(x=>{let R=new Map(x.values.map(O=>[O.series,O.value]));return{key:x.key,cells:[{text:x.category,numeric:!1},...a.map(O=>Di(O,x,n)),...e.series.map(O=>c(R.get(O)??0)),...s?[c(x.total)]:[],...l(x.total),...i.map(O=>Di(O,x,n))]}}),D=x=>e.rows.reduce((R,O)=>R+(O.values.find(G=>G.series===x)?.value??0),0),F=e.shares?[{text:r.total??"Total",numeric:!1},...a.map(h),...e.series.map(x=>c(D(x))),...s?[c(d)]:[],...l(d),...i.map(h)]:void 0,P=w.length-i.length,V=[...a.map((x,R)=>1+R),...i.map((x,R)=>P+R)];for(let x of V){let R=v.map(O=>O.cells[x]).filter(O=>O.text!=="");R.length>0&&R.every(O=>O.numeric)&&(w[x]={...w[x],numeric:!0})}return{hidden:t==="hidden"||r.hidden===!0,summary:r.summary??"Data table",caption:e.caption,headers:w,rows:v,...F?{footer:F}:{}}}function Di(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 Vn(e){let t=e.ownerDocument,n,r,o,a,i,s,c,d=new Map,l="",u=(D,F)=>{let P=t.createElement(D);return F&&(P.className=F),P};function f(){o=u("table"),a=u("caption","ec-table-caption");let D=u("thead");return i=u("tr"),D.appendChild(i),s=u("tbody"),o.append(a,D,s),o}function h(D,F){let P=D?"DIV":"DETAILS";if(n?.tagName!==P){let V=D?u("div","ec-table ec-visually-hidden"):u("details","ec-table"),x=o??f();if(D)r=void 0,V.appendChild(x);else{r=u("summary");let R=u("div","ec-table-scroll");R.appendChild(x),V.append(r,R)}n?.isConnected&&n.replaceWith(V),n=V}n.isConnected||e.after(n),r&&r.textContent!==F&&(r.textContent=F)}function w(D,{text:F,numeric:P}){D.textContent!==F&&(D.textContent=F),D.classList.toggle("ec-num",P)}function v(){n?.remove(),n=r=o=a=i=s=c=void 0,d.clear(),l=""}return{render(D){if(!D){v();return}h(D.hidden,D.summary),a.textContent!==D.caption&&(a.textContent=D.caption);let F=JSON.stringify(D.headers);F!==l&&(l=F,i.replaceChildren(...D.headers.map(R=>{let O=u("th");return O.scope="col",w(O,R),O})),d.clear(),s.replaceChildren());let P=new Set(D.rows.map(R=>R.key));for(let[R,O]of d)P.has(R)||(O.remove(),d.delete(R));if(D.rows.forEach((R,O)=>{let G=d.get(R.key);G||(G=u("tr"),G.setAttribute("data-key",R.key),R.cells.forEach((g,E)=>{let U=u(E===0?"th":"td");E===0&&(U.scope="row"),G.appendChild(U)}),d.set(R.key,G)),R.cells.forEach((g,E)=>w(G.cells[E],g)),s.children[O]!==G&&s.insertBefore(G,s.children[O]??null)}),!D.footer){c?.remove(),c=void 0;return}let V=D.footer,x=c?.rows[0];(!c||!x||x.cells.length!==V.length)&&(c?.remove(),c=u("tfoot"),x=u("tr"),V.forEach((R,O)=>{let G=u(O===0?"th":"td");O===0&&(G.scope="row"),x.appendChild(G)}),c.appendChild(x),o.appendChild(c)),V.forEach((R,O)=>w(x.cells[O],R))},destroy:v}}var ul=640;function un(e,t){if(typeof e=="string"){let n=typeof document>"u"?null:document.querySelector(e);if(!n)throw new TypeError(`${t}: no element matches "${e}".`);return n}if(!e||typeof e.appendChild!="function")throw new TypeError(`${t} needs a container element or a selector.`);return e}function Nn(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:ul}function fn(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 Fn(e,t,n){for(let r of Ht){let o=e[r];if(o?.kind==="data"){for(let a of o.needs?.related??[])if(!t.includes(a))throw new RangeError(`${n}: on.${r} needs the series "${a}", but the chart's series are ${t.map(i=>`"${i}"`).join(", ")}.`)}}}function Bn(e,t,n,r){let o=s=>Ht.includes(s)&&n?.[s]!==void 0&&n[s]===t?.[s],a=jt(Object.fromEntries(Object.entries(n??{}).filter(([s])=>!o(s))),r),i={};for(let s of Ht){let c=o(s)?e[s]:a[s];c&&(i[s]=c)}return i}function kn(e,t){if(typeof e!="object"||e===null)throw new TypeError(`${t} needs options.`);if(typeof e.label!="string"||e.label.trim()==="")throw new TypeError(`${t} needs a label: the chart's accessible name.`);if(!Array.isArray(e.data))throw new TypeError(`${t}: data must be an array of rows.`);for(let c of["width","height"]){let d=e[c];if(d!==void 0&&!(typeof d=="number"&&Number.isFinite(d)&&d>0))throw new RangeError(`${t}: ${c} must be a positive number of px, got ${String(d)}.`)}let{format:n,tooltip:r,markLabel:o,markDescription:a,legend:i,announce:s}=e;if(n!==void 0&&typeof n!="function")throw new TypeError(`${t}: format must be a function that turns a value into text.`);if(r!==void 0&&typeof r!="boolean"&&typeof r!="function")throw new TypeError(`${t}: tooltip must be true, false or a function that returns a row's text.`);if(o!==void 0&&typeof o!="function")throw new TypeError(`${t}: markLabel must be a function that returns a mark's accessible name.`);if(a!==void 0&&a!==!1&&typeof a!="function")throw new TypeError(`${t}: markDescription must be false or a function that returns a mark's accessible description.`);if(bi(i,t),Ei(e.seriesLabels,t),Ti(e.table,t),s!==void 0&&typeof s!="boolean"&&typeof s!="function")throw new TypeError(`${t}: announce must be true, false or a function that returns the text to announce.`)}function Hn(e){let{clock:t}=e,n,r=0,o,a,i=!1;function s(c){if(i||n?.id!==c)return;let{waiters:d}=n;n=void 0,o?.(),o=void 0,e.land(),e.runner.settle(),e.leaving.sweep();for(let l of d)l()}return{run(c){e.draw();let d=++r;return new Promise(l=>{if(n={id:d,waiters:[...n?.waiters??[],l]},c.length===0){s(d);return}o?.(),o=t.onFrame(()=>e.draw()),Promise.all(c).then(()=>s(d))})},supersede:()=>a?.(),wait(c,d){return new Promise(l=>{a=l,c.then(()=>Promise.all(d.map(u=>u.gone))).then(()=>l())})},destroy(){i=!0,n=void 0,o?.(),a?.()}}}function jn(e,t,n){let{runner:r,events:o,input:a,onScreen:i}=e;r.interrupt();let s=t();e.swap?.(s),e.hover.dropGone();let c=s.exiting.map(l=>l.leave);return r.exit(s.exiting.map(i)).then(()=>{for(let l of c)l.exited=!0;e.leaving.sweep()}),o.emitEach("exit",s.exiting,i),r.update(s.changed.map(({record:l,from:u})=>({...a(l),from:u}))),o.emitEach("update",s.changed,({record:l,from:u})=>({...a(l),from:u})),r.enter(s.entering.map(a)),o.emitEach("enter",s.entering,a),n(s),e.hover.sync(),c}function Le(e,t,n){return e.animating||!n(e.value,t)}var Me=(e,t)=>e===t;function ze(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(r=>e[r]===t[r])}function mn(e,t){if(e.outline.d!==t.outline.d||Ko(e,t))return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((o,a)=>o.key!==r[a].key||o.outline.d!==r[a].outline.d)}function Ko(e,t){let n=e.labelBounds,r=t.labelBounds;return n===r?!1:!n||!r||n.length!==r.length?!0:n.some((o,a)=>o.x!==r[a].x||o.y!==r[a].y||o.width!==r[a].width||o.height!==r[a].height)}function zn(e,t,n,r){if(typeof ResizeObserver!="function")return()=>{};let o=n,a=n,i,s=new ResizeObserver(c=>{let d=c[c.length-1]?.contentRect.width??0;!(d>0)||Math.abs(d-a)<.5||(a=d,i??(i=t.onFrame(()=>{i?.(),i=void 0,!(Math.abs(a-o)<.5)&&(o=a,r(o))})))});return s.observe(e),()=>{s.disconnect(),i?.()}}function _n(e,t){let n=e.fonts;return n?.addEventListener?.("loadingdone",t),()=>n?.removeEventListener?.("loadingdone",t)}function Kn(e,t){let n=()=>e.style.setProperty("--ec-hover-duration",`${t.duration(100,"feedback")}ms`);return n(),t.subscribe(n)}var Uo=12,fl=100,ml=0;function Ri(e,t,n,r){let o=e.top-Uo,a=n.height-e.bottom-Uo;return r??(r=t.height<=o||o>=a?"above":"below"),{x:Math.max(0,Math.min(n.width-t.width,e.x-t.width/2)),y:r==="above"?o-t.height:e.bottom+Uo,side:r}}function Wr(e,t,n,r={}){let o=t.length===1&&t[0].series==="value"&&(t[0].label??"value")==="value",a=[t.map(i=>o?n(i.value):`${n(i.value)} ${i.label??i.series}`).join(" \xB7 ")];return t.length>1&&r.total!==!1&&a.push(`${n(t.reduce((i,s)=>i+s.value,0))} total`),{title:e,lines:a}}function Un(e,t){let n,r,o=new WeakMap,a,i=u=>u.style.setProperty("--ec-hover-duration",`${t.motion.duration(fl,"feedback")}ms`);function s(){if(!n||!r){let u=e.ownerDocument;n=u.createElement("div"),n.className="ec-tooltip-layer",r=u.createElement("div"),r.className="ec-tooltip",r.setAttribute("aria-hidden","true"),n.appendChild(r)}return n.previousSibling!==e&&e.after(n),r}function c(u,f){let h=t.option(),w=o.get(u);if(w&&w.option===h)return w.content;let v=yl(h,u.datum,f);return o.set(u,{option:h,content:v}),v}function d(){r&&(i(r),r.classList.remove("ec-tooltip-shown"))}function l(u,f,h,w){let v=c(u,f);if(v===void 0){d();return}let D=s(),F=typeof v=="string"?`text:${v}`:JSON.stringify(v);F!==a&&(pl(D,v),a=F);let P=hl(e),V=e.getBoundingClientRect(),x=V.width>0&&P.width>0?V.width/P.width:1,R={x:U=>(U-P.x)*x,y:U=>(U-P.y)*x},O=V.width>0?{width:V.width,height:V.height}:{width:P.width,height:P.height},G={width:D.offsetWidth,height:D.offsetHeight},g=Ri(h(R,w),G,O,w?Ri(h(R,!1),G,O).side:void 0),E=n.getBoundingClientRect();D.style.left=`${Math.round(V.left-E.left+g.x)}px`,D.style.top=`${Math.round(V.top-E.top+g.y)}px`,D.setAttribute("data-side",g.side),i(D),D.classList.add("ec-tooltip-shown")}return{show(u,f,h,w){l(f,h,(D,F)=>{let P=F?w:void 0,{x:V,y:x,width:R,height:O}=u.bounds,G=[{x:V,y:x},{x:V+R,y:x},{x:V,y:x+O},{x:V+R,y:x+O}].map(E=>P?xe.apply(P,E).y:E.y),g=P?xe.apply(P,u.center):u.center;return{x:D.x(g.x),top:D.y(Math.min(...G)),bottom:D.y(Math.max(...G))}},w!==void 0)},showAt(u,f,h){l(f,h,w=>({x:w.x(u.x),top:w.y(u.top),bottom:w.y(u.bottom)}),!1)},describe(u,f){let h=t.description?.(),w;if(h===!1)w=void 0;else if(typeof h=="function")try{let D=h(f.datum);w=typeof D=="string"&&D!==""?D:void 0}catch(D){Se(D),w=void 0}else w=typeof t.option()=="function"?c(f,()=>""):void 0;let v=u.querySelector(":scope > desc.ec-description");if(typeof w!="string"){if(!v)return;u.getAttribute("aria-describedby")===v.id&&u.removeAttribute("aria-describedby"),v.remove();return}v??(v=Y("desc",{class:"ec-description",id:`ec-description-${++ml}`},u)),v.textContent!==w&&(v.textContent=w),u.setAttribute("aria-describedby",v.id)},hide:d,destroy(){n?.remove(),n=void 0,r=void 0,o=new WeakMap,a=void 0}}}function yl(e,t,n){if(e!==!1){if(typeof e!="function")return n();try{let r=e(t);return r==null||r===""?void 0:String(r)}catch(r){Se(r);return}}}function pl(e,t){if(typeof t=="string"){e.textContent=t;return}let n=e.ownerDocument,r=(o,a)=>{let i=n.createElement("div");return a&&(i.className=a),i.textContent=o,i};e.replaceChildren(r(t.title,"ec-tooltip-title"),...t.lines.map(o=>r(o)))}function hl(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}}var Wn=500,Ci=2,gl=2;function Zo(e,t,n){let r=un(e,"barChart");Li(t);let o=t,a=cn(t.motion,n.motion),i=jt(t.on,n.presets),s=$t(t.colors),c=n.clock??Fe,d=r.ownerDocument;gt(d);let l=Y("svg",{class:"ec-chart ec-bar-chart",role:"group"},r),u=Y("g",{class:"ec-grid","aria-hidden":"true"},l),f=Y("g",{class:"ec-axis","aria-hidden":"true"},l),h=Y("g",{class:"ec-focus","aria-hidden":"true",visibility:"hidden"},l),w=[Y("path",{class:"ec-focus-ring","stroke-width":2*(Ci+gl),"stroke-linejoin":"round"},h),Y("path",{class:"ec-focus-gap","stroke-width":2*Ci,"stroke-linejoin":"round"},h)],v=Y("g",{class:"ec-marks"},l),D=Y("g",{class:"ec-overlay","aria-hidden":"true"},l),F=Rn(l),P=[],V=new Map,x=Gn(M=>M.values.animating||M.presence.animating),R=new WeakMap,O=An("barChart"),G=Nn(r),g=!1,E,U;try{E=be(o),U=_e(o,E)}catch(M){throw l.remove(),M}let k=M=>V.get(M)??x.get(M),T=ln({overlay:D,mark:M=>({set:W=>{k(M)?.handle.set(W),Ne.restyled(M)},reset:()=>{k(M)?.handle.reset(),Ne.restyled(M)}}),colors:M=>k(M)?.parts[0]?.colors}),H=on({effects:i,motion:a,icons:n.icons,clock:c,surface:T}),_=Un(l,{motion:a,option:()=>o.tooltip,description:()=>o.markDescription}),te=On(l),ae=Vn(l),z=o.announce?Ot(l):void 0,Z=E.orientation,se=new Map,de=new Set,we=!1,A=!1,j=Be(E.frame.scale,xt,{clock:c,motion:a,onChange:()=>we=!0}),Q=Be(E.frame.bands,xt,{clock:c,motion:a,onChange:()=>we=!0}),ue=Hn({clock:c,runner:H,leaving:x,draw:ft,land:Ke});function be(M,W=i){let oe=Pn(M);return Fn(W,oe.series.map(pe=>pe.series),"barChart"),mi({data:M.data,encoding:oe,sort:M.sort,width:M.width??G,height:M.height,format:qe(M),measure:F})}function ve(M,W){let oe=Y("g",{class:"ec-mark","data-key":M.key,role:"img"},v),pe={clock:c,motion:a,onChange:()=>de.add(I)},p=qr(M),I={key:M.key,row:M,shown:M,group:oe,hit:Y("rect",{class:"ec-hit"},oe),label:Y("text",{class:"ec-label","aria-hidden":"true"},oe),body:Y("g",{class:"ec-body"},oe),value:Y("text",{class:"ec-value","aria-hidden":"true"},oe),paths:new Map,parts:[],handle:gn(()=>I),values:Be(W?Wo(p):p,xt,pe),series:M.values.map(m=>m.series),slot:Be(M.slot,ct,pe),presence:Be(W?0:1,ct,pe),count:void 0,leave:void 0};return R.set(oe,I),je(I,W?wt(I,ut()):M),I}function je(M,W){let oe=M.parts[0]?.colors.color;M.shown=W,le(M.hit,{...W.hit}),St(M.label,W.label),St(M.value,W.value);let pe=M.presence.value,p=pe<1?pe:void 0;le(M.label,{opacity:p}),le(M.value,{opacity:p});let I=W.geometry.segments??[],m=new Set,b=Zr(o)?at(s.slot(M.key)):void 0;M.parts=I.map(C=>{let B=C.series??C.key;m.add(B);let N=M.paths.get(B);N||(N=Y("path",{class:"ec-segment","data-series":B},M.body),M.paths.set(B,N));let ee=b??at(s.slot(B));return N.setAttribute("d",C.outline.d),$e(N,ht(ee)),{element:N,d:C.outline.d,colors:ee,visible:C.length>=.5}});for(let[C,B]of M.paths)m.has(C)||(B.remove(),M.paths.delete(C));let S=Array.from(M.body.children).filter(C=>C.classList.contains("ec-segment"));if(M.parts.some((C,B)=>S[B]!==C.element))for(let C of M.parts)M.body.appendChild(C.element);M.handle.repaint(),M.parts[0]?.colors.color!==oe&&T.recolor(M.key),M.key===Ne.ringKey&&Oe(M.key)}function Oe(M){let W=M===void 0?void 0:V.get(M);if(!W){h.setAttribute("visibility","hidden");return}for(let pe of w)pe.setAttribute("d",W.shown.geometry.outline.d);let{transform:oe}=W.handle.style;le(h,{transform:oe&&pt(oe),visibility:void 0})}function Pe(M,W){let oe=mn(M.shown.geometry,W.geometry)||M.shown.datum!==W.datum;je(M,W),oe&&H.change(W.geometry,W.data),M.key===Ne.key&&Ce(M)}function Ce(M){let{row:W}=M;_.show(M.shown.geometry,W,()=>Wr(W.label.text,Oi(W.values,o),qe(o)),M.handle.style.transform)}function Ae(M){if(Zr(o)){te.categories(M.rows.map(W=>({key:W.key,label:W.label.text})),s,o.legend);return}te.update(Pn(o).series.map(W=>({series:W.series,label:Xe(o.seriesLabels,W.series)})),s,o.legend)}function _e(M,W){let oe=Pn(M),pe=oe.orientation==="horizontal"?M.y:M.x;return In({option:M.table,caption:M.label,category:typeof pe=="string"?pe:void 0,series:oe.series.map(p=>p.series),label:p=>Xe(M.seriesLabels,p),rows:W.rows.map(p=>({key:p.key,category:p.label.text,datum:p.datum,index:p.index,values:p.values,total:p.total})),format:qe(M)})}function dt(M,W){let oe=o.announce;if(!z||!oe)return;let pe=Pn(o).series.map(B=>B.series),p=Pn(M).series.map(B=>B.series),I=Pi(o.sort),m=B=>B.row.label.text,b=W.changed.map(({record:B})=>B),S=Tn({...o.label!==M.label?{label:o.label}:{},...pe.join(`
85
+ `)!==p.join(`
86
+ `)?{series:pe.map(B=>Xe(o.seriesLabels,B))}:{},...I!==Pi(M.sort)||I==="custom"&&o.sort!==M.sort?{sort:I}:{},changed:b.map(m),added:W.entering.map(m),removed:W.exiting.map(m),count:P.length});if(typeof oe!="function"){z.say(S);return}let C=B=>B.key;try{let B=oe({text:S,changed:b.map(C),added:W.entering.map(C),removed:W.exiting.map(C)});B!=null&&z.say(String(B))}catch(B){Se(B)}}let ut=()=>({orientation:Z,scale:j.value,bands:Q.value});function wt(M,W){let{row:oe}=M,pe=M.values.value,p=M.series.map(b=>({series:b,value:pe[b]??0})),I=p.reduce((b,S)=>b+S.value,0),m=M.count===void 0?oe.value.text:qe(o)(bn(I,M.count));return No(W,{key:oe.key,datum:oe.datum,index:oe.index,category:oe.label.text,values:p,slot:M.slot.value,text:m},F)}function me(M,W){let oe={value:M,line:Y("line",{class:M===0?"ec-baseline":"ec-gridline"},u),label:Y("text",{class:"ec-tick"},f),opacity:Be(W,ct,{clock:c,motion:a,onChange:()=>A=!0}),wanted:!0};se.set(M,oe);for(let pe of[...se.values()].sort((p,I)=>p.value-I.value))u.appendChild(pe.line),f.appendChild(pe.label)}function Ge(M,W){let oe=Fo(W,M.value,qe(o)(M.value)),pe=M.opacity.value<1?M.opacity.value:void 0;le(M.line,{...oe.line,opacity:pe}),St(M.label,oe.label),le(M.label,{opacity:pe})}function ft(){let M=ut();if(we&&le(l,At(M.bands)),we||A)for(let W of se.values())Ge(W,M);for(let W of[...P,...x.values()])(we||de.has(W))&&Pe(W,wt(W,M));we=!1,A=!1,de.clear()}function Ke(){le(l,At(E.frame.bands));for(let M of[...se.values()])M.wanted||(M.line.remove(),M.label.remove(),se.delete(M.value));for(let M of E.ticks){let W=se.get(M.value);W&&(le(W.line,{...M.line,opacity:void 0}),St(W.label,M.label),W.label.removeAttribute("opacity"))}for(let M of P)M.series=M.row.values.map(W=>W.series),M.count=void 0,Pe(M,M.row);we=!1,A=!1,de.clear()}function Dt(M){let W=new Set(M.rows.map(p=>p.key)),oe={entering:[],exiting:[],changed:[]};for(let p of P)W.has(p.key)||(V.delete(p.key),x.start(p),p.count=void 0,oe.exiting.push(p));let pe=P;return P=M.rows.map(p=>{let I=V.get(p.key);return I?(wl(I.row,p)&&oe.changed.push({record:I,from:I.shown.geometry}),I.count=Math.max(Kt(I.row.total),Kt(p.total))):(I=x.recall(p.key)??ve(p,!0),I.count=void 0,V.set(p.key,I),oe.entering.push(I)),I.row=p,I.series=vl(I.series,p.values.map(m=>m.series)),Tt(I),I}),vn(v,pe.map(p=>p.group),P.map(p=>p.group),Ne.active),oe}function Tt(M){M.group.setAttribute("aria-label",bl(M.row,o)),_.describe(M.group,M.row)}function Rt(M,W){let{frame:oe}=M;W&&(Z=M.orientation);let pe=new Set(M.ticks.map(K=>K.value));for(let K of pe)se.has(K)||me(K,0);for(let K of se.values())K.wanted=pe.has(K.value);let p=new Set(P.filter(K=>K.presence.value===0)),I=P.filter(K=>!p.has(K)),m=[...x.values()],b=Le(j,oe.scale,ze)||[...se.values()].some(K=>Le(K.opacity,K.wanted?1:0,Me))||I.some(K=>Le(K.values,qr(K.row),ze)||Le(K.presence,1,Me))||m.some(K=>Le(K.values,Wo(K.values.value),ze)||Le(K.presence,0,Me)),S=p.size>0||Le(Q,oe.bands,ze)||I.some(K=>Le(K.slot,K.row.slot,Me)),C,B,N;if(!W&&a.staged){let K=b?Wn:0;C={duration:Wn},B={duration:Wn,delay:K},N={duration:Wn/2,delay:K+Wn/2}}else W||(C=B=N={duration:(b&&S?2:1)*Wn});let ee=[],ce=(K,ye,Ie,Ve)=>{Le(K,ye,Ie)&&(Ve?ee.push(K.to(ye,Ve)):K.set(ye))};ce(j,oe.scale,ze,C),ce(Q,oe.bands,ze,B);for(let K of se.values())ce(K.opacity,K.wanted?1:0,Me,C);for(let K of I)ce(K.values,qr(K.row),ze,C),ce(K.presence,1,Me,C),ce(K.slot,K.row.slot,Me,B);for(let K of p)K.slot.set(K.row.slot),ce(K.values,qr(K.row),ze,N),ce(K.presence,1,Me,N);for(let K of m)ce(K.values,Wo(K.values.value),ze,C),ce(K.presence,0,Me,C);return ee}function st(M,W){return E=M,ue.run(Rt(M,W))}let Ct=M=>({mark:M.row.geometry,data:M.row.data}),vt=M=>({mark:M.shown.geometry,data:M.shown.data});function Lt(M){let W=M,oe=typeof W?.closest=="function"?W.closest(".ec-mark"):null,pe=oe?R.get(oe):void 0;return pe&&V.get(pe.key)===pe?pe:void 0}let Ne=$n({svg:l,runner:H,events:O,dim:()=>o.dim!==!1,find(M){let W=Lt(M);if(!W)return;let oe=M.closest(".ec-segment")?.getAttribute("data-series")??void 0;return oe===void 0?{key:W.key}:{key:W.key,segment:oe}},live:M=>V.has(M),order:()=>P.map(M=>M.key),element:M=>k(M)?.group,onScreen(M){let W=k(M);return W&&vt(W)},ring:Oe,tooltip:{show(M){let W=V.get(M);W&&Ce(W)},hide:()=>_.hide()}}),Qe=Kn(l,a);function Pt(){if(g)return;let M=be(o),W=new Map(M.rows.map(oe=>[oe.key,oe]));for(let oe of P)oe.row=W.get(oe.key)??oe.row;st(M,!0)}let Qt=zn(r,c,G,M=>{G=M,o.width===void 0&&Pt()}),Ue=_n(d,()=>{F.clear(),Pt()});fn(l,o),Ae(E),ae.render(U),le(l,At(E.frame.bands));for(let M of E.ticks)me(M.value,1);for(let M of se.values())Ge(M,E.frame);return P=E.rows.map(M=>{let W=ve(M,!1);return V.set(M.key,W),Tt(W),W}),Ne.sync(),H.enter(P.map(Ct)),_t(Ne.link,{element:l,async update(M){if(g)return;if(M.motion!==void 0&&M.motion!==o.motion)throw new TypeError("barChart: `motion` can't be changed by update() yet.");let W={...o,...M};Li(W);let oe="on"in M?Bn(i,o.on,W.on,n.presets):i,pe=be(W,oe),p=_e(W,pe);"colors"in M&&(s=$t(W.colors));let I=o;o=W,fn(l,o),Ae(pe),ae.render(p);let m=z!==void 0;o.announce&&!z?z=Ot(l):!o.announce&&z&&(z.destroy(),z=void 0),Ne.syncDim(),ue.supersede();let b=oe!==i;i=oe;let S=jn({runner:H,events:O,hover:Ne,leaving:x,input:Ct,onScreen:vt,...b?{swap:B=>{let N=new Set(B.entering);H.swap(oe,P.filter(ee=>!N.has(ee)).map(Ct))}}:{}},()=>Dt(pe),B=>{m&&dt(I,B)});if(Zr(o)!==Zr(I))for(let B of[...P,...x.values()])de.add(B);let C=st(pe,a.mode==="off"||pe.orientation!==Z);await ue.wait(C,S)},on:O.on,marks:()=>P.map(M=>M.shown.geometry),focus(M){g||Ne.focus(M)},leave(){g||Ne.leave()},labels:()=>P.flatMap(M=>[...dn(M.key,"category",M.shown.label,M.label),...dn(M.key,"value",M.shown.value,M.value)]),destroy(){if(!g){g=!0,ue.destroy(),Ne.destroy(),H.destroy(),_.destroy(),te.destroy(),ae.destroy(),z?.destroy(),Qe(),Qt(),Ue();for(let M of[...P,...x.values()]){for(let W of[M.values,M.slot,M.presence])W.stop();M.leave?.resolve()}j.stop(),Q.stop();for(let M of se.values())M.opacity.stop();O.clear(),V.clear(),x.clear(),P=[],l.remove()}}})}function Li(e){kn(e,"barChart");let{colorBy:t}=e;if(t!==void 0&&t!=="series"&&t!=="category")throw new TypeError(`barChart: colorBy must be "series" or "category", got ${String(t)}.`);if(t==="category"&&e.stack!==void 0)throw new 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 Zr(e){return e.colorBy==="category"}function bl(e,t){let n=qe(t),r=Oi(e.values,t),o=r.length===1&&r[0].series==="value"&&r[0].label==="value",a=`${e.label.text}: ${r.map(i=>o?n(i.value):`${n(i.value)} ${i.label}`).join(", ")}`;if(!t.markLabel)return a;try{let i=t.markLabel(e.datum,{key:e.key,category:e.label.text,values:r,total:e.total,format:n,text:a});if(i!=null&&String(i).trim()!=="")return String(i)}catch(i){Se(i)}return a}function Oi(e,t){return e.map(n=>({series:n.series,label:Xe(t.seriesLabels,n.series),value:n.value}))}function wl(e,t){return e.values.length!==t.values.length||e.values.some((n,r)=>n.series!==t.values[r].series||n.value!==t.values[r].value)}function qr(e){return Object.fromEntries(e.values.map(t=>[t.series,t.value]))}function Wo(e){return Object.fromEntries(Object.keys(e).map(t=>[t,0]))}function vl(e,t){let n=[...t];return e.forEach((r,o)=>{if(n.includes(r))return;let a=0;for(let i=o-1;i>=0;i--){let s=n.indexOf(e[i]);if(s>=0){a=s+1;break}}n.splice(a,0,r)}),n}function Pi(e){return typeof e=="function"?"custom":e??"none"}var Ai=2*Math.PI,kl=300,xl=.6,qo=4,Yo=10,Ml=Math.PI/12,Yr=12.5,ea=12.5,Xo=10,Gi=15,Qo=Xo+Gi+3,Jr=2,hr=26,Sl=14,El=20,Dl=16,Tl=.36;function Zn(e){let{category:t,value:n,key:r}=e;if(typeof t!="string"&&typeof t!="function")throw new TypeError("donutChart needs a category: the field, or a function, that names each slice.");if(typeof n!="string"&&typeof n!="function")throw new 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 new TypeError("donutChart: key must be a field name or a function.");let o=Jo(t);return{category:o,key:r===void 0?o:Jo(r),series:typeof n=="string"?n:"value",value:Jo(n)}}function Ii(e){let t=Ll(Cl(e),e.sort),n=Pl(e,t),r=t.reduce((c,d)=>c+d.value,0),o=Rl(t.map(c=>c.value)),a=t.map((c,d)=>{let l=r>0?c.value/r:0,u=d+1<t.length&&r>0?o[d+1]:r>0?1:0;return{...c,series:e.encoding.series,share:l,start:o[d]*Ai,end:u*Ai}}),i=na(n,a,e.measure),s=e.center(r);return{frame:n,total:r,slices:a.map((c,d)=>ta(n,c,i[d],e.measure)),labels:i,centerText:s,center:ra(n,s,e.measure)}}function Rl(e){let t=e.reduce((r,o)=>r+o,0),n=0;return e.map(r=>{let o=t>0?n/t:0;return n+=r,o})}function ta(e,t,n,r){let o=Ye.arc({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?Al(n,r):[]});return{...t,geometry:o,data:$l(t.datum,t.share,t.series)}}function na(e,t,n){let r,o,a=t.map((i,s)=>{if(i.end-i.start<Ml-1e-9)return;let c=Ol(e,i,n),{box:d}=c;if(!(d.x<0||d.y<0||d.x+d.width>e.width||d.y+d.height>e.height)&&!(r&&$i(r,d)))return r=d,o??(o=s),c});for(let i=a.length-1;o!==void 0&&i>o;i--){let s=a[i];if(s){if(!$i(a[o].box,s.box))break;a[i]=void 0}}return a}function ra(e,t,n){if(t==="")return[];let r=t.split(`
87
+ `),o=2*e.inner*.85,a=n(r[0],"ec-center-value",hr),i=a>o&&a>0?Math.max(Sl,hr*o/a):hr,s=r.map((l,u)=>u===0?0:El+(u-1)*Dl),c=s[s.length-1],d=e.cy+(2*Tl*i-c)/2;return r.map((l,u)=>({x:e.cx,y:d+s[u],anchor:"middle",text:l,size:u===0?i:Yr}))}function Cl({data:e,encoding:t}){let n=new Set;return e.map((r,o)=>{let a=String(t.key(r,o));if(n.has(a))throw new Error(`donutChart: two rows have the key "${a}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(a);let i=Gl(t.value(r,o),t.series,a);return{key:a,category:String(t.category(r,o)??""),datum:r,index:o,value:i}})}function Ll(e,t){if(t===void 0||t==="none")return e;if(t==="value")return[...e].sort((n,r)=>r.value-n.value);throw new TypeError(`donutChart: sort must be "value" or "none", got ${String(t)}.`)}function Pl(e,t){let{width:n,measure:r}=e,o=e.height??kl,a=n/2,i=o/2,s=r("100%","ec-value",ea),c=t.reduce((f,h)=>Math.max(f,r(h.category,"ec-label",Yr)),s),d=Math.min(a-qo-Yo-c,i-qo-Yo-Qo),l=Math.max(0,Math.min(a,i)-qo),u=Math.max(0,d,l/2);return{width:n,height:o,cx:a,cy:i,inner:u*xl,outer:u}}function Ol(e,t,n){let r=(t.start+t.end)/2,o=Math.sin(r),a=Math.cos(r),i=e.outer+Yo,s=e.cx+i*o,c=e.cy-i*a,d=wn(t.share),l=[n(t.category,"ec-label",Yr),n(d,"ec-value",ea)],u=Math.max(...l),f=c-Qo*(a+1)/2,h=w=>s+o*w/2;return{category:{x:h(l[0]),y:f+Xo,anchor:"middle",text:t.category},share:{x:h(l[1]),y:f+Xo+Gi,anchor:"middle",text:d},box:{x:h(u)-u/2,y:f,width:u,height:Qo}}}function Al(e,t){let n=[];return e.category.text!==""&&n.push(an(e.category,t,"ec-label",Yr)),e.share.text!==""&&n.push(an(e.share,t,"ec-value",ea)),n}function $i(e,t){return e.x<t.x+t.width+Jr&&t.x<e.x+e.width+Jr&&e.y<t.y+t.height+Jr&&t.y<e.y+e.height+Jr}function $l(e,t,n){let r={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related:o=>o===n?r:void 0};return r}function Jo(e){return typeof e=="function"?e:t=>t[e]}function Gl(e,t,n){if(e==null)return 0;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e;throw new RangeError(`donutChart: "${t}" for "${n}" must be a finite number of 0 or more, got ${typeof e=="string"?JSON.stringify(e):String(e)}.`)}var qn=500,Vi=2*Math.PI,Il=.5;function oa(e,t,n){let r=un(e,"donutChart");Ni(t);let o=t,a=cn(t.motion,n.motion),i=jt(t.on,n.presets),s=$t(t.colors),c=n.clock??Fe,d=r.ownerDocument;gt(d);let l=Y("svg",{class:"ec-chart ec-donut-chart",role:"group"},r),u=Y("g",{class:"ec-center","aria-hidden":"true"},l),f=Y("g",{class:"ec-marks"},l),h=Y("g",{class:"ec-overlay","aria-hidden":"true"},l),w=Y("g",{class:"ec-halos"},h),v=zr(h),D=Y("g",{class:"ec-runs"},h),F=Rn(l),P=[],V=new Map,x=Gn(p=>p.value.animating||p.presence.animating),R=new WeakMap,O=An("donutChart"),G=Nn(r),g=!1,E,U,k;try{E=be(o),U=dt(o,E),k=Fi(o,E)}catch(p){throw l.remove(),p}let T=p=>V.get(p)??x.get(p),H=ln({overlay:D,mark:p=>({set:I=>{T(p)?.handle.set(I),Ue.restyled(p)},reset:()=>{T(p)?.handle.reset(),Ue.restyled(p)}}),colors:p=>T(p)?.parts[0]?.colors}),_=on({effects:i,motion:a,icons:n.icons,clock:c,surface:H}),te=Un(l,{motion:a,option:()=>o.tooltip,description:()=>o.markDescription}),ae=On(l),z=Vn(l),Z=o.announce?Ot(l):void 0,se=[],de=[],we=!1,A=Be(E.frame,xt,{clock:c,motion:a,onChange:()=>we=!0}),j,Q,ue=Hn({clock:c,runner:_,leaving:x,draw:Tt,land:st});function be(p,I=i){let m=Zn(p);return Fn(I,[m.series],"donutChart"),Ii({data:p.data,encoding:m,sort:p.sort,width:p.width??G,height:p.height,center:b=>Bi(p,m.series,b),measure:F})}function ve(p,I){let m=Y("g",{class:"ec-mark","data-key":p.key,role:"img"},f),b={clock:c,motion:a,onChange:()=>we=!0},S=Y("g",{class:"ec-body"},m),C={key:p.key,row:p,shown:p,group:m,hit:Y("path",{class:"ec-hit"},m),body:S,path:Y("path",{class:"ec-slice","data-series":p.series},S),label:Y("text",{class:"ec-label","aria-hidden":"true"},m),share:Y("text",{class:"ec-value","aria-hidden":"true"},m),drawnLabel:void 0,parts:[],handle:gn(()=>C,{halos:()=>w}),value:Be(I?0:p.value,ct,b),turn:Be(1,ct,b),offset:0,planned:0,presence:Be(I?0:1,ct,b),leave:void 0};return m.insertBefore(C.hit,S),R.set(m,C),C}function je(p,I,m){let b=p.parts[0]?.colors.color;p.shown=I;let{outline:S}=I.geometry,C=I.geometry.length>=Il,B=C?void 0:"hidden";le(p.path,{d:S.d,visibility:B}),le(p.hit,{d:S.d,visibility:B});let N=at(s.slot(p.key));$e(p.path,ht(N)),p.parts=[{element:p.path,d:S.d,colors:N,visible:C}];let ee=p.presence.value,ce=ee<1?ee:void 0;p.drawnLabel=m;for(let[K,ye]of[[p.label,m?.category],[p.share,m?.share]])ye&&St(K,ye),le(K,{visibility:ye?void 0:"hidden",opacity:ce});p.handle.repaint(),N.color!==b&&H.recolor(p.key),p.key===Ue.ringKey&&Oe(p.key)}function Oe(p){let I=p===void 0?void 0:V.get(p);v.draw(I&&{outline:I.shown.geometry.outline,thickness:I.shown.geometry.thickness,transform:I.handle.style.transform})}function Pe(p,I,m){let b=mn(p.shown.geometry,I.geometry)||p.shown.datum!==I.datum;je(p,I,m),b&&_.change(I.geometry,I.data),p.key===Ue.key&&Ce(p)}function Ce(p){let{row:I}=p;te.show(p.shown.geometry,I,()=>({title:I.category,lines:[`${Hi(I,o)} \xB7 ${wn(I.share)}`]}),p.handle.style.transform)}function Ae(p){for(;u.childElementCount>p.length;)u.lastElementChild.remove();p.forEach((I,m)=>{let b=u.children[m]??Y("text",{},u);le(b,{class:m===0?"ec-center-value":"ec-center-label"}),St(b,I),$e(b,{"font-size":m===0&&I.size!==hr?`${I.size}px`:void 0})})}let _e=()=>ae.categories(E.slices.map(p=>({key:p.key,label:p.category})),s,o.legend);function dt(p,I){let{series:m}=Zn(p);return In({option:p.table,caption:p.label,category:typeof p.category=="string"?p.category:void 0,series:[m],label:b=>Xe(p.seriesLabels,b),rows:I.slices.map(b=>({key:b.key,category:b.category,datum:b.datum,index:b.index,values:[{series:m,value:b.value}],total:b.value})),format:qe(p),shares:!0})}function ut(){fn(l,{label:o.label,description:Nl(o.description,E.centerText)})}function wt(p,I){let m=o.announce;if(!Z||!m)return;let b=Zn(o).series,S=Zn(p).series,C=o.sort??"none",B=K=>K.row.category,N=I.changed.map(({record:K})=>K),ee=Tn({...o.label!==p.label?{label:o.label}:{},...b!==S?{series:[Xe(o.seriesLabels,b)]}:{},...C!==(p.sort??"none")?{sort:C}:{},changed:N.map(B),added:I.entering.map(B),removed:I.exiting.map(B),count:P.length});if(typeof m!="function"){Z.say(ee);return}let ce=K=>K.key;try{let K=m({text:ee,changed:N.map(ce),added:I.entering.map(ce),removed:I.exiting.map(ce)});K!=null&&Z.say(String(K))}catch(K){Se(K)}}let me=p=>V.get(p.key)===p||x.get(p.key)===p,Ge=p=>Math.max(0,p.value.value);function ft(p,I,m=Ge){let b=new Map,S=0;for(let C of p)b.set(C,I>0?S/I:0),S+=m(C);return b}function Ke(){se=se.filter(me),de=de.filter(me);let p=se.reduce((S,C)=>S+Ge(C),0),I=ft(se,p),m=ft(de,p),b=new Map;for(let S of se){let C=I.get(S),B=S.turn.value,N=m.get(S),ee=C;if(N!==void 0&&B<1){let ce=N+S.offset-C;ee=C+(1-B)*(ce-Math.round(ce-S.planned))}b.set(S,{start:ee,span:p>0?Ge(S)/p:0})}return b}function Dt(p){let I=[...Ke()].map(([b,{start:S,span:C}])=>{let{row:B}=b,N={key:B.key,datum:B.datum,index:B.index,category:B.category,series:B.series,value:Ge(b),share:C,start:S*Vi,end:(S+C)*Vi};return{record:b,state:N}}),m=na(p,I.map(({state:b})=>b),F);return I.map(({record:b,state:S},C)=>({record:b,slice:ta(p,S,m[C],F),label:m[C]}))}function Tt(){if(!we)return;we=!1;let p=A.value;le(l,At(p));let I=Dt(p);for(let{record:b,slice:S,label:C}of I)Pe(b,S,C);let m=I.reduce((b,{slice:S})=>b+S.value,0);Ae(ra(p,j===void 0?E.centerText:Rt(bn(m,j)),F))}function Rt(p){return Q?.total!==p&&(Q={total:p,text:Bi(o,Zn(o).series,p)}),Q.text}function st(){se=se.filter(me),de=se;for(let p of se)p.turn.set(1),p.offset=0,p.planned=0;j=void 0,Q=void 0,le(l,At(E.frame)),E.slices.forEach((p,I)=>Pe(V.get(p.key),p,E.labels[I])),Ae(E.center),we=!1}function Ct(p){let I=new Set(p.slices.map(S=>S.key)),m={entering:[],exiting:[],changed:[]};for(let S of P)I.has(S.key)||(V.delete(S.key),x.start(S),m.exiting.push(S));let b=P;return P=p.slices.map(S=>{let C=V.get(S.key);return C?(C.row.value!==S.value||C.row.series!==S.series)&&m.changed.push({record:C,from:C.shown.geometry}):(C=x.recall(S.key)??ve(S,!0),V.set(S.key,C),m.entering.push(C)),C.row=S,C.path.setAttribute("data-series",S.series),vt(C),C}),vn(f,b.map(S=>S.group),P.map(S=>S.group),Ue.active),m}function vt(p){p.group.setAttribute("aria-label",k.get(p.key)),te.describe(p.group,p.row)}function Lt(p,I){we=!0;let m=Ke(),b=new Set(P.filter(ie=>ie.presence.value===0)),S=P.filter(ie=>!b.has(ie)),C=[...x.values()],B=de.length>0&&de.every(ie=>ie.turn.value===0),N=se;if(se=Fl(N,P),!B){de=N;let ie=N.reduce((Gt,Mn)=>Gt+Ge(Mn),0),tt=ft(N,ie);for(let Gt of N)Gt.offset=m.get(Gt).start-tt.get(Gt)}de=de.filter(ie=>!b.has(ie));let ee=ie=>V.get(ie.key)===ie?ie.row.value:0,ce=se.reduce((ie,tt)=>ie+ee(tt),0),K=ft(se,ce,ee),ye=ft(de,ce,ee),Ie=!1;for(let ie of de){let tt=ye.get(ie)+ie.offset-K.get(ie);ie.planned=tt-Math.round(tt),Math.abs(ie.planned)>1e-9&&(Ie=!0)}let Ve=S.some(ie=>Le(ie.value,ie.row.value,Me)||Le(ie.presence,1,Me))||C.some(ie=>Le(ie.value,0,Me)||Le(ie.presence,0,Me)),He=Ie||b.size>0||Le(A,p.frame,ze),Ee,Je,mt;if(!I&&a.staged){let ie=Ve?qn:0;Ee={duration:qn},Je={duration:qn,delay:ie},mt={duration:qn/2,delay:ie+qn/2}}else I||(Ee=Je=mt={duration:(Ve&&He?2:1)*qn});let Et=[],et=(ie,tt,Gt,Mn)=>{Le(ie,tt,Gt)&&(Mn?Et.push(ie.to(tt,Mn)):ie.set(tt))};et(A,p.frame,ze,Je);for(let ie of S)et(ie.value,ie.row.value,Me,Ee),et(ie.presence,1,Me,Ee);for(let ie of b)et(ie.value,ie.row.value,Me,mt),et(ie.presence,1,Me,mt);for(let ie of C)et(ie.value,0,Me,Ee),et(ie.presence,0,Me,Ee);if(I){de=se;for(let ie of se)ie.turn.set(1),ie.offset=0,ie.planned=0;return Et}let Wt=new Set(de);for(let ie of se)ie.turn.set(Wt.has(ie)?0:1);if(Ie)for(let ie of de)et(ie.turn,1,Me,Je);return Et}function Ne(p,I){return E=p,ue.run(Lt(p,I))}let Qe=p=>({mark:p.row.geometry,data:p.row.data}),Pt=p=>({mark:p.shown.geometry,data:p.shown.data});function Qt(p){let I=p,m=typeof I?.closest=="function"?I.closest(".ec-mark"):null,b=m?R.get(m):void 0;return b&&V.get(b.key)===b?b:void 0}let Ue=$n({svg:l,runner:_,events:O,dim:()=>o.dim!==!1,find(p){let I=Qt(p);return I&&{key:I.key}},live:p=>V.has(p),order:()=>P.map(p=>p.key),element:p=>T(p)?.group,onScreen(p){let I=T(p);return I&&Pt(I)},ring:Oe,tooltip:{show(p){let I=V.get(p);I&&Ce(I)},hide:()=>te.hide()}}),M=Kn(l,a);function W(){if(g)return;let p=be(o),I=new Map(p.slices.map(m=>[m.key,m]));for(let m of P)m.row=I.get(m.key)??m.row;Ne(p,!0)}let oe=zn(r,c,G,p=>{G=p,o.width===void 0&&W()}),pe=_n(d,()=>{F.clear(),W()});return ut(),_e(),z.render(U),le(l,At(E.frame)),P=E.slices.map(p=>{let I=ve(p,!1);return V.set(p.key,I),vt(I),I}),se=de=P,E.slices.forEach((p,I)=>je(P[I],p,E.labels[I])),Ae(E.center),Ue.sync(),_.enter(P.map(Qe)),_t(Ue.link,{element:l,async update(p){if(g)return;if(p.motion!==void 0&&p.motion!==o.motion)throw new TypeError("donutChart: `motion` can't be changed by update() yet.");let I={...o,...p};Ni(I);let m="on"in p?Bn(i,o.on,I.on,n.presets):i,b=be(I,m),S=dt(I,b),C=Fi(I,b);"colors"in p&&(s=$t(I.colors));let B=o,N=E.total;o=I,E=b,k=C,ut(),_e(),z.render(S);let ee=Z!==void 0;o.announce&&!Z?Z=Ot(l):!o.announce&&Z&&(Z.destroy(),Z=void 0),Ue.syncDim(),ue.supersede();let ce=m!==i;i=m;let K=jn({runner:_,events:O,hover:Ue,leaving:x,input:Qe,onScreen:Pt,...ce?{swap:Ie=>{let Ve=new Set(Ie.entering);_.swap(m,P.filter(He=>!Ve.has(He)).map(Qe))}}:{}},()=>Ct(b),Ie=>{ee&&wt(B,Ie)});j=b.total===N?void 0:Math.max(Kt(N),Kt(b.total));let ye=Ne(b,a.mode==="off");await ue.wait(ye,K)},on:O.on,marks:()=>P.map(p=>p.shown.geometry),focus(p){g||Ue.focus(p)},leave(){g||Ue.leave()},labels:()=>P.flatMap(p=>[...dn(p.key,"category",p.drawnLabel?.category,p.label),...dn(p.key,"value",p.drawnLabel?.share,p.share)]),destroy(){if(!g){g=!0,ue.destroy(),Ue.destroy(),_.destroy(),te.destroy(),ae.destroy(),z.destroy(),Z?.destroy(),M(),oe(),pe();for(let p of[...P,...x.values()]){for(let I of[p.value,p.turn,p.presence])I.stop();p.leave?.resolve()}A.stop(),O.clear(),V.clear(),x.clear(),P=se=de=[],l.remove()}}})}function Ni(e){kn(e,"donutChart");let{center:t,sort:n}=e;if(t!==void 0&&t!==!1&&typeof t!="function")throw new 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 new TypeError(`donutChart: sort must be "value" or "none", got ${String(n)}.`)}function Hi(e,t){let n=qe(t)(e.value),r=Xe(t.seriesLabels,e.series);return e.series==="value"&&r==="value"?n:`${n} ${r}`}function Fi(e,t){return new Map(t.slices.map(n=>[n.key,Vl(n,e)]))}function Vl(e,t){let n=`${e.category}: ${Hi(e,t)}, ${wn(e.share)}`;if(!t.markLabel)return n;try{let r={series:e.series,label:Xe(t.seriesLabels,e.series),value:e.value},o=t.markLabel(e.datum,{key:e.key,category:e.category,values:[r],total:e.value,share:e.share,format:qe(t),text:n});if(o!=null&&String(o).trim()!=="")return String(o)}catch(r){Se(r)}return n}function Bi(e,t,n){let{center:r}=e,o=qe(e);if(r===!1)return"";if(r===void 0){let a=Xe(e.seriesLabels,t);return t==="value"&&a==="value"?o(n):`${o(n)}
88
+ ${a}`}try{let a=r(n,o);return a==null?"":String(a)}catch(a){return Se(a),""}}function Nl(e,t){let n=t.split(`
89
+ `).join(" ").trim(),r=e?.trim();return n===""?e:r?/[.!?:;]$/.test(r)?`${r} ${n}`:`${r}. ${n}`:n}function Fl(e,t){let n=[...t];return e.forEach((r,o)=>{if(n.includes(r))return;let a=0;for(let i=o-1;i>=0;i--){let s=n.indexOf(e[i]);if(s>=0){a=s+1;break}}n.splice(a,0,r)}),n}var ji=["UTC","local"],sa=1e3,to=60*sa,eo=60*to,Xr=24*eo,aa={second:sa,minute:to,hour:eo,day:Xr+eo,week:7*Xr+eo,month:31*Xr,year:366*Xr},Bl=[...[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}],Ut=["year","month","day","hour","minute","second","millisecond"],Hl={second:"second",minute:"minute",hour:"hour",day:"day",week:"day",month:"month",year:"year"},jl={fractionalSecondDigits:3},ia={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",...jl}};function zl(e){for(let t of Bl)if(aa[t.unit]*t.count>=e)return t;return{unit:"year",count:Math.max(1,mr(e/aa.year))}}function zi(e,t,n){let r=Ul(n);if(!(t>e))return[{value:e,text:r(e,"year")}];let o=zl((t-e)/4),a=Ut[Math.min(Ut.indexOf(Hl[o.unit]),Ut.indexOf(_l(e,t,n)))],i=Kl(e,t,o,n).map(s=>({value:s,text:r(s,"millisecond")}));return[{value:e,text:r(e,a)},...i,{value:t,text:r(t,a)}]}function _l(e,t,n){let[r,o]=[Jn(e,n),Jn(t,n)];return r.year!==o.year?"year":r.month!==o.month?"month":r.date!==o.date?"day":r.hours!==o.hours?"hour":r.minutes!==o.minutes?"minute":"second"}function Kl(e,t,n,r){let{unit:o,count:a}=n,i=[],s=Jn(e,r);if(o==="second"||o==="minute"||o==="hour"){let l=o==="hour"?15*to:aa[o],u=e-s.ms-(o==="second"?0:s.seconds*sa)-(o==="hour"?s.minutes%15*to:0);for(;u<t;u+=l){let f=Jn(u,r),h=o!=="hour"||f.minutes===0,w=o==="second"?f.seconds:o==="minute"?f.minutes:f.hours;u>e&&h&&w%a===0&&i.push(u)}return i}let c=o==="day"?l=>Qr(r,s.year,s.month,s.date+l):o==="week"?l=>Qr(r,s.year,s.month,s.date-(s.weekday+6)%7+7*l):o==="month"?l=>Qr(r,s.year,Math.floor(s.month/a)*a+a*l,1):l=>Qr(r,Math.floor(s.year/a)*a+a*l,0,1),d=-1/0;for(let l=0;;l++){let u=c(l);if(u>=t||u<=d)break;d=u,u>e&&(o!=="day"||(Jn(u,r).date-1)%a===0)&&i.push(u)}return i}function _i(e,t){let{ms:n,seconds:r,minutes:o,hours:a,date:i,month:s}=Jn(e,t);return n!==0?"millisecond":r!==0?"second":o!==0?"minute":a!==0?"hour":i!==1?"day":s!==0?"month":"year"}function Ki(e,t){let n=e.reduce((s,c)=>Math.max(s,Ut.indexOf(_i(c,t))),0),r=Ui(t),o=n>=Ut.indexOf("second")?"medium":n>=Ut.indexOf("hour")?"short":void 0,a=n===Ut.indexOf("millisecond")?{year:"numeric",...ia.day,...ia.millisecond,timeZone:r}:{dateStyle:"medium",...o?{timeStyle:o}:{},timeZone:r},i=new Intl.DateTimeFormat(void 0,a);return s=>i.format(s)}function Ul(e){let t=new Map;return(n,r)=>{let o=Ut.indexOf(_i(n,e)),a={};for(let c=Math.min(o,Ut.indexOf(r));c<=o;c++)Object.assign(a,ia[Ut[c]]);let i=JSON.stringify(a),s=t.get(i);return s||t.set(i,s=new Intl.DateTimeFormat(void 0,{...a,timeZone:Ui(e)})),s.format(n)}}var Ui=e=>e==="UTC"?"UTC":void 0;function Jn(e,t){let n=new Date(e);return t==="UTC"?{year:n.getUTCFullYear(),month:n.getUTCMonth(),date:n.getUTCDate(),weekday:n.getUTCDay(),hours:n.getUTCHours(),minutes:n.getUTCMinutes(),seconds:n.getUTCSeconds(),ms:n.getUTCMilliseconds()}:{year:n.getFullYear(),month:n.getMonth(),date:n.getDate(),weekday:n.getDay(),hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds(),ms:n.getMilliseconds()}}function Qr(e,t,n,r){let o=new Date(0);return e==="UTC"?(o.setUTCFullYear(t,n,r),o.setUTCHours(0,0,0,0)):(o.setFullYear(t,n,r),o.setHours(0,0,0,0)),o.getTime()}var ua=2.25,br=4.5,Wl=300,Wi=12,Zl=32,qi=8,da=11,no=12.5,Ji=10,ql=16,ca=8,Yi=.36;function Xi(e){let{x:t,series:n,key:r}=e;if(typeof t!="string"&&typeof t!="function")throw new 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 new TypeError("lineChart needs series: the numeric fields to draw as lines.");let o=new Set;for(let c of n){if(typeof c!="string"||c==="")throw new TypeError(`lineChart: each series must be a field name, got ${gr(c)}.`);if(o.has(c))throw new TypeError(`lineChart: "${c}" appears twice in series.`);o.add(c)}if(r!==void 0&&typeof r!="string"&&typeof r!="function")throw new 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 new TypeError("lineChart: labels must be false or a function that returns a line's end label.");let i=e.timeZone??"UTC";if(!ji.includes(i))throw new TypeError(`lineChart: timeZone must be "UTC" or "local", got ${gr(i)}.`);let s=e.xFormat;if(s!==void 0&&typeof s!="function")throw new TypeError("lineChart: xFormat must be a function that turns an x into text.");return{x:la(t),key:r===void 0?void 0:la(r),series:n.map(c=>({series:c,value:la(c)})),timeZone:i,xFormat:e.xFormat}}function Qi(e){let{width:t,measure:n}=e,r=e.height??Wl,{rows:o,time:a}=ed(e),i=e.encoding.series.map(R=>R.series),s=Bo(o.flatMap(R=>R.values.map(O=>O.value))),c=s.ticks.map(e.format),d=o[0]?.x??0,l=o[o.length-1]?.x??0,u=o.length===0?[]:a?zi(d,l,e.encoding.timeZone):Xl(d,l).map(R=>({value:R,text:ha(R)})),f=u.map(R=>R.value),h=u.map(R=>R.text),w=h.map(R=>n(R,"ec-tick",da)),v=e.label?Zi(od(o,e.label),"ec-value",no,n):0,D=Math.max(Zi(c,"ec-tick",da,n)+10,(w[0]??0)/2+2),F=Math.max(qi+2,(w[w.length-1]??0)/2+2,v>0?Ji+v+4:0),P={scale:{lo:s.lo,hi:s.hi},box:{xLo:d,xHi:l,left:D,right:Math.max(D,t-F),top:Wi,bottom:Math.max(Wi,r-Zl),width:t,height:r}},V={};for(let R of i)V[R]=0;for(let R of o)for(let O of R.values)V[O.series]=Math.max(V[O.series],Kt(O.value));let x=f.map((R,O)=>pa(P,R,h[O]));return{width:t,height:r,frame:P,rows:o,time:a,series:i,yTicks:s.ticks.map((R,O)=>ya(P,R,c[O])),xTicks:Ql(x,w),decimals:V}}function Yn(e){let{scale:t,box:n}=e,r=n.xHi-n.xLo,o=t.hi-t.lo;return{x:a=>r>0?n.left+(a-n.xLo)/r*(n.right-n.left):(n.left+n.right)/2,y:a=>o>0?n.bottom-(a-t.lo)/o*(n.bottom-n.top):n.bottom}}function fa(e,t,n,r,o=!1,a){if(!t[0])return[];let s=Yn(e),c=0;for(;c+1<t.length&&t[c+1].x<=r;)c++;let d=t[c],l=t[c+1],u=l&&l.x>d.x&&r>d.x?(r-d.x)/(l.x-d.x):void 0,f=t.slice(0,c+1),h=new Map,w=P=>V=>V===P?void 0:h.get(V),v=n.map(P=>{let V=f.map(x=>({at:x.x,value:x.values[P]??0}));if(u!==void 0){let x=d.values[P]??0;V.push({at:r,value:x+u*((l.values[P]??0)-x)})}return{name:P,vertices:V,points:V.map(x=>({x:s.x(x.at),y:s.y(x.value)}))}}),D=a?Jl(e,v.map(({name:P,vertices:V,points:x})=>({...x[x.length-1],text:a.text(P,V[V.length-1].value)}))):[];return v.map(({name:P,vertices:V,points:x},R)=>{let O=D[R],G=a?O&&O.text!==""?[an(O,a.measure,"ec-value",no)]:[]:void 0,g=Ye.line({key:P,series:P,points:x,width:ua,...G?{labelBounds:G}:{}}),E=0,U=V.map((H,_)=>(_>0&&(E+=Math.hypot(x[_].x-x[_-1].x,x[_].y-x[_-1].y)),{t:g.length>0?_===V.length-1?1:Math.min(1,E/g.length):0,value:H.value,at:ns(H.at,o)})),k={datum:d.datum,samples:U,related:w(P)};h.set(P,k);let T=V[V.length-1];return{series:P,geometry:g,data:k,end:{...x[x.length-1],value:T.value},label:O}})}function wr(e,t){return`${e}@${t}`}function ma(e,t,n,r=!1){let o=Yn(e),a=o.x(t.x),i=new Map;return n.map(s=>{let c=t.values[s]??0,d=wr(s,t.key),l={datum:t.datum,samples:[{t:0,value:c,at:ns(t.x,r)}],related:u=>u===s?void 0:i.get(u)};return i.set(s,l),{key:d,series:s,geometry:Ye.point({key:d,series:s,x:a,y:o.y(c),r:br}),data:l}})}function es(e,t){let{width:n,height:r}=e.box;return t.map((o,a)=>{let i=a===0?0:(t[a-1]+o)/2,s=a===t.length-1?n:(o+t[a+1])/2;return{x:i,y:0,width:Math.max(0,s-i),height:r}})}function ts(e,t){return{x1:t,y1:e.box.top,x2:t,y2:e.box.bottom}}function Jl(e,t){let n=no/2,r=Yl(t.map(o=>o.y),ql,n,e.box.height-n);return t.map((o,a)=>({x:o.x+Ji,y:r[a]+no*Yi,anchor:"start",text:o.text}))}function Yl(e,t,n,r){let o=e.map((c,d)=>({value:c,index:d})).sort((c,d)=>c.value-d.value||c.index-d.index),a=[],i=c=>{let d=c.reduce((u,f)=>u+f.value,0)/c.length,l=(c.length-1)*t;return Math.max(n,Math.min(r-l,d-l/2))};for(let c of o)for(a.push({members:[c],start:i([c])});a.length>1;){let d=a[a.length-1],l=a[a.length-2];if(d.start-(l.start+(l.members.length-1)*t)>=t)break;a.pop(),l.members.push(...d.members),l.start=i(l.members)}let s=new Array(e.length);for(let c of a)c.members.forEach((d,l)=>s[d.index]=c.start+l*t);return s}function ya(e,t,n){let{box:r}=e,o=Yn(e).y(t);return{value:t,line:{x1:r.left,y1:o,x2:r.right+qi,y2:o},label:{x:r.left-8,y:o+da*Yi,anchor:"end",text:n}}}function pa(e,t,n){return{value:t,label:{x:Yn(e).x(t),y:e.box.bottom+18,anchor:"middle",text:n}}}function Xl(e,t){if(!(t>e))return[e];let n=mr((t-e)/4),r=[e];for(let o=Math.floor(e/n)+1;Ln(o*n)<t;o++){let a=Ln(o*n);a>e&&r.push(a)}return r.push(t),r}function ha(e){return String(e)}function Ql(e,t){if(e.length<=1)return[...e];let n=e.map((a,i)=>({tick:a,from:a.label.x-t[i]/2,to:a.label.x+t[i]/2})),r=n[n.length-1],o=[n[0]];for(let a of n.slice(1,-1))a.from-o[o.length-1].to>=ca&&r.from-a.to>=ca&&o.push(a);return r.from-o[o.length-1].to>=ca&&o.push(r),o.map(a=>a.tick)}function ed({data:e,encoding:t}){let n=new Set,r=!1,o=e.map((i,s)=>{let c=t.x(i,s);s===0&&(r=c instanceof Date);let d=td(c,s,r),l=String(t.key?t.key(i,s):r?new Date(d).toISOString():d);if(n.has(l))throw new Error(`lineChart: two rows have the key "${l}". Keys must be unique.`);n.add(l);let u=t.series.map(({series:f,value:h})=>({series:f,value:rd(h(i,s),f,l)}));return{key:l,datum:i,index:s,x:d,values:u}});o.sort((i,s)=>i.x-s.x);for(let i=1;i<o.length;i++){let[s,c]=[o[i-1],o[i]];if(s.x===c.x){let d=r?new Date(s.x).toISOString():ha(s.x);throw new Error(`lineChart: the rows "${s.key}" and "${c.key}" have the same x, ${d}. Each x is one point on every line, so x values must be unique.`)}}let a=nd(t,r,o.map(i=>i.x));return{rows:o.map(i=>({...i,label:a(i.x)})),time:r}}function td(e,t,n){if(e instanceof Date){if(!n)throw new 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 new TypeError(`lineChart: x must be a valid Date, got an invalid Date in row ${t}.`);return r}if(n)throw typeof e=="number"?new TypeError(`lineChart: x must be all numbers or all Dates, but row 0's is a Date and row ${t}'s a number.`):new TypeError(`lineChart: x must be a valid Date, got ${gr(e)} in row ${t}.`);if(typeof e!="number"||!Number.isFinite(e))throw new RangeError(`lineChart: x must be a finite number, got ${gr(e)} in row ${t}.`);return e}function nd(e,t,n){let{xFormat:r}=e;return r?o=>r(t?new Date(o):o):t?Ki(n,e.timeZone):ha}function ns(e,t){return t?new Date(e):e}function rd(e,t,n){if(typeof e=="number"&&Number.isFinite(e))return e;throw new RangeError(`lineChart: "${t}" for "${n}" must be a finite number, got ${gr(e)}. Lines can't skip a value yet.`)}function od(e,t){let n=new Map;for(let r of e)for(let{series:o,value:a}of r.values){let i=t(o,a),s=i.replace(/\d/g,"0");n.has(s)||n.set(s,i)}return[...n.values()]}function Zi(e,t,n,r){return e.reduce((o,a)=>Math.max(o,r(a,t,n)),0)}function la(e){return typeof e=="function"?e:t=>t[e]}var gr=e=>typeof e=="string"?JSON.stringify(e):String(e);var ro=500,rs=2,ad=2,id=.5;function ga(e,t,n){let r=un(e,"lineChart");kn(t,"lineChart");let o=t,a=cn(t.motion,n.motion),i=jt(t.on,n.presets),s=$t(t.colors),c=n.clock??Fe,d=r.ownerDocument;gt(d);let l=Y("svg",{class:"ec-chart ec-line-chart",role:"group"},r),u=Y("g",{class:"ec-grid","aria-hidden":"true"},l),f=Y("g",{class:"ec-axis","aria-hidden":"true"},l),h=Y("line",{class:"ec-crosshair","aria-hidden":"true",visibility:"hidden"},l),w=Y("g",{class:"ec-focus","aria-hidden":"true",visibility:"hidden"},l),v=Y("g",{class:"ec-marks","aria-hidden":"true"},l),D=Y("g",{class:"ec-lines"},v),F=Y("g",{class:"ec-points"},v),P=Y("g",{class:"ec-columns"},l),V=Y("g",{class:"ec-overlay","aria-hidden":"true"},l),x=Rn(l),R=[],O=new Map,G=new Map,g=new WeakMap,E=[],U=new Map,k=new Map,T=Gn(y=>y.kind==="line"?y.presence.animating:y.row.presence.animating||y.row.values.animating||y.row.x.animating),H=An("lineChart"),_=Nn(r),te=!1,ae=1/0,z=new WeakSet,Z,se,de;try{Z=Ge(o),se=Je(o,Z),de=ss(o,Z)}catch(y){throw l.remove(),y}let we=y=>k.get(y)??U.get(y)??T.get(y),A=ln({overlay:V,mark:y=>({set:L=>{we(y)?.handle.set(L),He.restyled(y)},reset:()=>{we(y)?.handle.reset(),He.restyled(y)}}),colors:y=>we(y)?.parts[0]?.colors}),j=on({effects:i,motion:a,icons:n.icons,clock:c,surface:A}),Q=Un(l,{motion:a,option:()=>o.tooltip,description:()=>o.markDescription}),ue=On(l),be=Vn(l),ve=o.announce?Ot(l):void 0,je=!1,Oe=()=>{je=!0},Pe=Be(Z.frame.scale,xt,{clock:c,motion:a,onChange:Oe}),Ce=Be(Z.frame.box,xt,{clock:c,motion:a,onChange:Oe}),Ae=new Map,_e=new Map,dt=Z.decimals,ut={changed:[],added:[],removed:[]},wt=Z.frame,me=Hn({clock:c,runner:j,leaving:T,draw:M,land:oe});function Ge(y,L=i){let $=Xi(y),q=$.series.map(re=>re.series);Fn(L,q,"lineChart");let J=Qi({data:y.data,encoding:$,width:y.width??_,height:y.height,format:qe(y),measure:x,label:ft(y,!0)}),X=new Set(J.series);for(let re of J.rows)for(let he of J.series){let ge=wr(he,re.key);if(X.has(ge))throw new RangeError(`lineChart: two marks would have the key "${ge}". Series and keys joined with "@" must be unique.`);X.add(ge)}for(let re of J.rows)if(X.has(re.key))throw new RangeError(`lineChart: the key "${re.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 J}function ft(y,L=!1){let{labels:$}=y;if($===!1)return;let q=qe(y);return(J,X)=>{let re=`${q(X)} ${Xe(y.seriesLabels,J)}`;if(typeof $!="function")return re;try{let he=$(X,J,q);return he==null?"":String(he)}catch(he){return!L&&!z.has($)&&(z.add($),Se(he)),re}}}function Ke(y){let L=ft(o);if(L)return{text:($,q)=>L($,bn(q,y[$]??Kt(q))),measure:x}}function Dt(y){let L=y.rows.map(os);return{lines:new Map(fa(y.frame,L,y.series,Rt(y),y.time,Ke(y.decimals)).map($=>[$.series,$])),points:new Map(L.flatMap($=>ma(y.frame,$,y.series,y.time)).map($=>[$.key,$]))}}function Tt(y){let L=y.rows[0],$=y.rows[y.rows.length-1];return L&&$?Math.min(Math.max(ae,L.x),$.x):ae}function Rt(y){let L=y.rows[y.rows.length-1];return L&&ae<L.x?Tt(y):1/0}let st=y=>!y.leaving&&y.row.x<=Tt(Z);function Ct(y,L){let $=Y("g",{class:"ec-column","data-key":y.key,role:"img"},P),q={clock:c,motion:a,onChange:Oe},J={key:y.key,row:y,column:$,hit:Y("rect",{class:"ec-hit"},$),x:Be(y.x,ct,q),values:Be(vr(y.values),xt,q),presence:Be(L?0:1,ct,q),anchor:void 0,points:[],leaving:!1,shown:!0};return g.set($,J),J}function vt(y,L,$){let q=Y("g",{class:"ec-line","data-key":y,"data-series":y},D),J=Y("g",{class:"ec-body"},q),X={kind:"line",key:y,series:y,group:q,body:J,path:Y("path",{class:"ec-stroke","stroke-width":ua},J),end:Y("circle",{class:"ec-end",r:br},J),label:Y("text",{class:"ec-value ec-end-label"},q),drawnLabel:void 0,parts:[],handle:gn(()=>X),target:L,shown:L,presence:Be($?0:1,ct,{clock:c,motion:a,onChange:Oe}),leave:void 0};return X}function Lt(y,L){let $=Y("g",{class:"ec-point","data-key":L.key,"data-series":L.series},F),q=Y("g",{class:"ec-body"},$),J={kind:"point",key:L.key,series:L.series,row:y,group:$,body:q,path:Y("path",{class:"ec-dot"},q),parts:[],handle:gn(()=>J),target:L,shown:L,hidden:void 0,leave:void 0};return J}let Ne=y=>we(y.key)===y,Qe=y=>y.points.filter(L=>k.get(L.key)===L),Pt=()=>[...T.values()].filter(y=>y.kind==="line"),Qt=()=>({scale:Pe.value,box:Ce.value});function Ue(){let y=X=>({x:X.x.value,values:X.values.value}),L=new Map,$=new Set,q=X=>{let re=L.get(X);if(re)return re;let he=X.presence.value,ge=y(X);if(X.anchor&&he<1&&!$.has(X)){$.add(X);let De=q(X.anchor);$.delete(X),ge={x:De.x+he*(ge.x-De.x),values:xt(De.values,ge.values)(he)}}return L.set(X,ge),ge};return[...R,...[...G.values()].filter(X=>X.presence.value>0&&X.anchor)].map(X=>{let{x:re,values:he}=q(X);return{record:X,state:{key:X.key,datum:X.row.datum,x:re,values:he}}}).sort((X,re)=>X.state.x-re.state.x)}function M(){if(!je)return;je=!1;let y=Qt(),L=Ue();pe(y),p(y,L.map($=>$.state));for(let{record:$,state:q}of L){let J=new Map(ma(y,q,$.points.map(X=>X.series),Z.time).map(X=>[X.key,X]));m($.points.filter(Ne).map(X=>({record:X,placed:J.get(X.key)})))}B(y,L),K()}function W(){let y=Qt(),L=Ue();p(y,L.map($=>$.state)),B(y,L),K()}function oe(){for(let J of G.values()){for(let X of[J.x,J.values,J.presence])X.stop();J.column.remove()}G.clear();for(let J of R)J.anchor=void 0,J.points=J.points.filter(Ne);for(let[J,X]of[[Ae,Z.yTicks],[_e,Z.xTicks]]){for(let re of[...J.values()])re.wanted||(re.line?.remove(),re.label.remove(),J.delete(re.value));for(let re of X){let he=J.get(re.value);he&&(he.line&&"line"in re&&le(he.line,{...re.line,opacity:void 0}),St(he.label,re.label),he.label.removeAttribute("opacity"))}}dt=Z.decimals;let{frame:y}=Z;le(l,At(y.box)),wt=y;let L=Dt(Z),$=(J,X)=>{let re=J.flatMap(ge=>{let De=X(ge);return De?[{record:ge,to:De}]:[]});if(!re.every(({record:ge,to:De})=>sd(ge.target.geometry,De.geometry)&&is(ge.target.data,De.data)))for(let{record:ge,to:De}of re)ge.target=De;m(re.map(({record:ge})=>({record:ge,placed:ge.target})))};$(E,J=>L.lines.get(J.series)),I(new Map(E.flatMap(J=>L.lines.has(J.series)?[[J,L.lines.get(J.series)]]:[])));let q=R.map(J=>({record:J,state:os(J.row)}));for(let{record:J}of q)$(Qe(J),X=>L.points.get(X.key));B(y,q),K(),je=!1}function pe(y){wt=y,le(l,At(y.box));let L=qe(o);for(let $ of Ae.values()){let q=ya(y,$.value,L($.value)),J=$.opacity.value<1?$.opacity.value:void 0;le($.line,{...q.line,opacity:J}),St($.label,q.label),le($.label,{opacity:J})}for(let $ of _e.values())St($.label,pa(y,$.value,$.text).label),le($.label,{opacity:$.opacity.value<1?$.opacity.value:void 0})}function p(y,L){let $=[...E,...Pt()];if(L.length===0||$.length===0)return;let q=fa(y,L,$.map(J=>J.series),Rt(Z),Z.time,Ke(dt));m($.map((J,X)=>({record:J,placed:q[X]}))),I(new Map($.map((J,X)=>[J,q[X]])))}function I(y){for(let[L,{label:$}]of y)$&&St(L.label,$),L.drawnLabel=$&&$.text!==""?$:void 0,le(L.label,{visibility:L.drawnLabel?void 0:"hidden"})}function m(y){let L=y.some(({record:$,placed:q})=>!is($.shown.data,q.data));for(let{record:$,placed:q}of y)$.kind==="line"?b($,q,L):S($,q,L)}function b(y,L,$){let q=$||mn(y.shown.geometry,L.geometry);y.shown=L;let{geometry:J}=L;C(y,at(s.slot(y.series)),{visible:J.length>=id,open:{width:J.thickness}}),le(y.end,{cx:J.end.x,cy:J.end.y});let X=y.presence.value;le(y.group,{opacity:X<1?X:void 0}),q&&j.change(J,L.data)}function S(y,L,$){let q=$||mn(y.shown.geometry,L.geometry);y.shown=L,C(y,at(s.slot(y.series)),{visible:!0}),q&&j.change(L.geometry,L.data)}function C(y,L,$){let q=y.parts[0],{d:J}=y.shown.geometry.outline,X=q?.colors.color!==L.color;!X&&q?.d===J&&q.visible===$.visible&&q.open?.width===$.open?.width||(y.path.getAttribute("d")!==J&&y.path.setAttribute("d",J),X&&$e(y.group,ht(L)),y.parts=[{element:y.path,d:J,colors:L,...$}],y.handle.repaint(),q&&X&&A.recolor(y.key))}function B(y,L){let{x:$}=Yn(y),q=L.filter(({record:re})=>st(re)),J=es(y,q.map(({state:re})=>$(re.x)));q.forEach(({record:re},he)=>le(re.hit,{...J[he]}));let X=new Set(q.map(({record:re})=>re));for(let re of[...R,...G.values()]){let he=X.has(re);re.shown!==he&&(re.shown=he,le(re.column,{visibility:he?void 0:"hidden","aria-hidden":re.leaving?"true":void 0}));let ge=!st(re);for(let De of re.points)De.hidden!==ge&&(De.hidden=ge,le(De.group,{visibility:ge?"hidden":void 0}),A.hide(De.key,ge))}}function N(y){let L=O.get(y),$=L&&st(L)?Qe(L):[],q=$[0];if(!L||!q)return;let J=q.shown.geometry.center.x;le(h,{...ts(wt,J),visibility:void 0});let X=$.map(he=>{let{transform:ge}=he.handle.style,{center:De}=he.shown.geometry;return(ge?xe.apply(ge,De):De).y}),{row:re}=L;Q.showAt({x:J,top:Math.min(...X)-br,bottom:Math.max(...X)+br},re,()=>Wr(re.label,ls(re.values,o),qe(o),{total:!1}))}function ee(){h.setAttribute("visibility","hidden"),Q.hide()}function ce(y){let L=y===void 0?void 0:O.get(y),$=L&&st(L)?Qe(L):[];for(;w.childElementCount>$.length;)w.lastElementChild.remove();$.forEach((q,J)=>{let X=w.children[J];X||(X=Y("g",{},w),Y("path",{class:"ec-focus-ring","stroke-width":2*(rs+ad)},X),Y("path",{class:"ec-focus-gap","stroke-width":2*rs},X));for(let he of Array.from(X.children))he.setAttribute("d",q.shown.geometry.outline.d);let{transform:re}=q.handle.style;le(X,{transform:re&&pt(re)})}),le(w,{visibility:$.length>0?void 0:"hidden"})}function K(){He.key!==void 0&&N(He.key),He.ringKey!==void 0&&ce(He.ringKey)}let ye=y=>({mark:y.target.geometry,data:y.target.data}),Ie=y=>({mark:y.shown.geometry,data:y.shown.data});function Ve(y){let L=y,$=typeof L?.closest=="function"?L.closest(".ec-column"):null,q=$?g.get($):void 0;return q&&O.get(q.key)===q&&st(q)?q:void 0}let He=$n({svg:l,runner:j,events:H,dim:()=>!1,find(y){let L=Ve(y);return L&&{key:L.key}},live(y){let L=O.get(y);return L!==void 0&&st(L)},order:()=>R.filter(st).map(y=>y.key),marks:y=>{let L=O.get(y);return L?Qe(L).map($=>$.key):[]},element:y=>(O.get(y)??G.get(y))?.column,markElement:y=>we(y)?.group,onScreen(y){let L=we(y);return L&&Ie(L)},ring:ce,tooltip:{show:N,hide:ee}}),Ee=()=>ue.update(Z.series.map(y=>({series:y,label:Xe(o.seriesLabels,y)})),s,o.legend);function Je(y,L){return In({option:y.table,caption:y.label,category:typeof y.x=="string"?y.x:void 0,series:L.series,label:$=>Xe(y.seriesLabels,$),rows:L.rows.map($=>({key:$.key,category:$.label,datum:$.datum,index:$.index,values:$.values,total:cs($.values)})),format:qe(y),total:!1})}function mt(y){y.column.setAttribute("aria-label",de.get(y.key)),Q.describe(y.column,y.row)}function Et(y,L){let $=o.announce;if(!ve||!$)return;let q=Z.series,J=Re=>Re.row.label,{changed:X,added:re,removed:he}=ut,ge=Tn({...o.label!==y.label?{label:o.label}:{},...q.join(`
90
+ `)!==L.join(`
91
+ `)?{series:q.map(Re=>Xe(o.seriesLabels,Re))}:{},changed:X.map(J),added:re.map(J),removed:he.map(J),count:R.length});if(typeof $!="function"){ve.say(ge);return}let De=Re=>Re.key;try{let Re=$({text:ge,changed:X.map(De),added:re.map(De),removed:he.map(De)});Re!=null&&ve.say(String(Re))}catch(Re){Se(Re)}}function et(y){Z=y;let L=Dt(y),$={entering:[],exiting:[],changed:[]},q=new Set(y.rows.map(ne=>ne.key)),J=y.rows.length>0?y.series:[],X={changed:[],added:[],removed:[]},re=R,he=new Map(re.map(ne=>[ne,ne.row])),ge=E.filter(ne=>!J.includes(ne.series)),De=[];for(let ne of re){let ke=!q.has(ne.key);ke&&(O.delete(ne.key),ne.leaving=!0,G.set(ne.key,ne),X.removed.push(ne));for(let We of Qe(ne))(ke||!J.includes(We.series))&&De.push(We)}for(let ne of ge)U.delete(ne.series);for(let ne of De)k.delete(ne.key);for(let ne of[...ge,...De])T.start(ne);$.exiting.push(...ge,...De);let Re=new Set,fe=X.removed.length>0;R=y.rows.map(ne=>{let ke=O.get(ne.key);return ke?(Re.add(ke),ke.row.x!==ne.x&&(fe=!0),ne.values.some((We,Sn)=>ke.row.values[Sn]?.series!==We.series||ke.row.values[Sn]?.value!==We.value)&&X.changed.push(ke)):(ke=G.get(ne.key)??Ct(ne,!0),G.delete(ne.key),ke.leaving=!1,ke.x.set(ne.x),ke.values.set(vr(ne.values)),O.set(ne.key,ke),X.added.push(ke),fe=!0),ke.row=ne,ke}),R.forEach((ne,ke)=>{Re.has(ne)?ne.presence.value===1&&(ne.anchor=void 0):ne.anchor=as(R,ke,Re)});for(let ne of X.removed)ne.anchor??(ne.anchor=as(re,re.indexOf(ne),Re));let Zt=E;E=J.map(ne=>{let ke=U.get(ne),We=L.lines.get(ne);if(ke){let Sn=[...Re].some(qt=>oo(he.get(qt),ne)!==oo(qt.row,ne));(fe||Sn)&&$.changed.push({record:ke,from:ke.shown.geometry})}else ke=Wt(ne,"line")??vt(ne,We,!0),U.set(ne,ke),$.entering.push(ke);return ke.target=We,ke});for(let ne of R){let ke=Re.has(ne)?he.get(ne):void 0,We=J.map(qt=>{let Rr=wr(qt,ne.key),ja=L.points.get(Rr),Jt=k.get(Rr);return Jt?ke&&oo(ke,qt)!==oo(ne.row,qt)&&$.changed.push({record:Jt,from:Jt.shown.geometry}):(Jt=Wt(Rr,"point")??Lt(ne,ja),Jt.row=ne,k.set(Rr,Jt),$.entering.push(Jt)),Jt.target=ja,Jt}),Sn=new Set(We);ne.points=[...We,...ne.points.filter(qt=>!Sn.has(qt)&&Ne(qt))]}for(let ne of R)mt(ne);return vn(P,re.filter(ne=>!ne.leaving).map(ne=>ne.column),R.map(ne=>ne.column),He.active),vn(D,Zt.map(ne=>ne.group),E.map(ne=>ne.group),()=>null),ut=X,je=!0,M(),$}function Wt(y,L){return T.get(y)?.kind===L?T.recall(y):void 0}function ie(y,L){je=!0;let{frame:$}=y;for(let[fe,Zt,ne]of[[Ae,y.yTicks,!0],[_e,y.xTicks,!1]]){let ke=new Set(Zt.map(We=>We.value));for(let We of ke)fe.has(We)||tt(fe,We,0,ne);for(let We of fe.values())We.wanted=ke.has(We.value)}for(let fe of y.xTicks)_e.get(fe.value).text=fe.label.text;let q=Pt(),J=[...G.values()],X=Le(Pe,$.scale,ze)||[...Ae.values()].some(fe=>Le(fe.opacity,fe.wanted?1:0,Me))||R.some(fe=>Le(fe.values,vr(fe.row.values),ze))||E.some(fe=>Le(fe.presence,1,Me))||q.some(fe=>Le(fe.presence,0,Me)),re=Le(Ce,$.box,ze)||[..._e.values()].some(fe=>Le(fe.opacity,fe.wanted?1:0,Me))||R.some(fe=>Le(fe.x,fe.row.x,Me)||fe.anchor!==void 0&&Le(fe.presence,1,Me))||J.some(fe=>fe.anchor!==void 0&&Le(fe.presence,0,Me)),he,ge;!L&&a.staged?(he={duration:ro},ge={duration:ro,delay:X?ro:0}):L||(he=ge={duration:(X&&re?2:1)*ro});let De=[],Re=(fe,Zt,ne,ke)=>{Le(fe,Zt,ne)&&(ke?De.push(fe.to(Zt,ke)):fe.set(Zt))};Re(Pe,$.scale,ze,he),Re(Ce,$.box,ze,ge);for(let fe of Ae.values())Re(fe.opacity,fe.wanted?1:0,Me,he);for(let fe of _e.values())Re(fe.opacity,fe.wanted?1:0,Me,ge);for(let fe of R)Re(fe.values,vr(fe.row.values),ze,he),Re(fe.x,fe.row.x,Me,ge),Re(fe.presence,1,Me,fe.anchor?ge:void 0);for(let fe of J)Re(fe.presence,0,Me,fe.anchor?ge:void 0);for(let fe of E)Re(fe.presence,1,Me,he);for(let fe of q)Re(fe.presence,0,Me,he);return De}function tt(y,L,$,q,J=""){let X={value:L,line:q?Y("line",{class:L===0?"ec-baseline":"ec-gridline"},u):void 0,label:Y("text",{class:"ec-tick"},f),text:J,opacity:Be($,ct,{clock:c,motion:a,onChange:Oe}),wanted:!0};y.set(L,X);for(let re of[...y.values()].sort((he,ge)=>he.value-ge.value))re.line&&u.appendChild(re.line),f.appendChild(re.label)}function Gt(y,L){return Z=y,dt=Object.fromEntries(y.series.map($=>[$,Math.max(dt[$]??0,y.decimals[$]??0)])),me.run(ie(y,L))}let Mn=Kn(l,a);function Ba(){if(te)return;let y=Ge(o),L=new Map(y.rows.map(q=>[q.key,q]));for(let q of R)q.row=L.get(q.key)??q.row;let $=Dt(y);for(let q of E)q.target=$.lines.get(q.series)??q.target;for(let q of k.values())q.target=$.points.get(q.key)??q.target;Gt(y,!0)}let kc=zn(r,c,_,y=>{_=y,o.width===void 0&&Ba()}),xc=_n(d,()=>{x.clear(),Ba()});fn(l,o),Ee(),be.render(se);{let y=Dt(Z);for(let L of Z.yTicks)tt(Ae,L.value,1,!0);for(let L of Z.xTicks)tt(_e,L.value,1,!1,L.label.text);R=Z.rows.map(L=>{let $=Ct(L,!1);return O.set(L.key,$),$.points=Z.series.map(q=>{let J=Lt($,y.points.get(wr(q,L.key)));return k.set(J.key,J),J}),mt($),$}),E=Z.rows.length>0?Z.series.map(L=>vt(L,y.lines.get(L),!1)):[];for(let L of E)U.set(L.series,L);oe()}let Ha=()=>[...E,...R.flatMap(Qe)];return He.sync(),j.enter(Ha().map(ye)),_t(He.link,{element:l,async update(y){if(te)return;if(y.motion!==void 0&&y.motion!==o.motion)throw new TypeError("lineChart: `motion` can't be changed by update() yet.");let L={...o,...y};kn(L,"lineChart");let $="on"in y?Bn(i,o.on,L.on,n.presets):i,q=Ge(L,$),J=Je(L,q),X=ss(L,q);"colors"in y&&(s=$t(L.colors));let re=o,he=Z.series;o=L,de=X,fn(l,o),be.render(J);let ge=ve!==void 0;o.announce&&!ve?ve=Ot(l):!o.announce&&ve&&(ve.destroy(),ve=void 0),me.supersede();let De=$!==i;i=$;let Re=jn({runner:j,events:H,hover:He,leaving:T,input:ye,onScreen:Ie,...De?{swap:Zt=>{let ne=new Set(Zt.entering);j.swap($,Ha().filter(ke=>!ne.has(ke)).map(ye))}}:{}},()=>et(q),()=>{ge&&Et(re,he)});Ee();let fe=Gt(q,a.mode==="off");await me.wait(fe,Re)},reveal(y){if(te)return;if(y instanceof Date&&Number.isNaN(y.getTime()))throw new RangeError("lineChart: reveal(x) needs a valid Date, got an invalid Date.");let L=y instanceof Date?y.getTime():y;if(typeof L!="number"||Number.isNaN(L))throw new RangeError(`lineChart: reveal(x) needs a number, got ${typeof L=="string"?JSON.stringify(L):String(L)}.`);let $=Tt(Z);ae=L,Tt(Z)!==$&&(W(),He.dropGone(),He.sync())},on:H.on,marks:()=>[...E.map(y=>y.shown.geometry),...R.filter(st).flatMap(y=>Qe(y).map(L=>L.shown.geometry))],focus(y){if(te)return;let L=O.get(y)??k.get(y)?.row;L&&He.focus(L.key)},leave(){te||He.leave()},labels:()=>E.flatMap(y=>dn(y.key,"value",y.drawnLabel,y.label)),destroy(){if(!te){te=!0,me.destroy(),He.destroy(),j.destroy(),Q.destroy(),ue.destroy(),be.destroy(),ve?.destroy(),Mn(),kc(),xc();for(let y of[...R,...G.values()])for(let L of[y.x,y.values,y.presence])L.stop();for(let y of[...E,...Pt()])y.presence.stop();for(let y of T.values())y.leave?.resolve();Pe.stop(),Ce.stop();for(let y of[...Ae.values(),..._e.values()])y.opacity.stop();H.clear(),O.clear(),G.clear(),U.clear(),k.clear(),T.clear(),R=[],E=[],l.remove()}}})}function os(e){return{key:e.key,datum:e.datum,x:e.x,values:vr(e.values)}}function vr(e){return Object.fromEntries(e.map(t=>[t.series,t.value]))}function oo(e,t){return e.values.find(n=>n.series===t)?.value}function cs(e){return e.reduce((t,n)=>t+n.value,0)}function as(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 sd(e,t){return e.key===t.key&&!mn(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 is(e,t){return e.datum!==t.datum||e.samples.length!==t.samples.length?!1:e.samples.every((n,r)=>{let o=t.samples[r];return n.t===o.t&&n.value===o.value&&cd(n.at,o.at)})}function cd(e,t){return e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function ls(e,t){return e.map(n=>({series:n.series,label:Xe(t.seriesLabels,n.series),value:n.value}))}function ss(e,t){let n=qe(e);return new Map(t.rows.map(r=>{let o=ls(r.values,e),a=`${r.label}: ${o.map(i=>`${n(i.value)} ${i.label}`).join(", ")}`;if(!e.markLabel)return[r.key,a];try{let i=e.markLabel(r.datum,{key:r.key,category:r.label,values:o,total:cs(r.values),format:n,text:a});if(i!=null&&String(i).trim()!=="")return[r.key,String(i)]}catch(i){Se(i)}return[r.key,a]}))}function kr(e){let t=ba(e.start,e.pivot);return t>.5&&Math.abs(ba(e.center,e.pivot)-t)<=.5&&Math.abs(ba(e.end,e.pivot)-t)<=.5}var ba=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y);var ds=.5,ld=["left","right","top","bottom"];function fs(e){return typeof e=="string"&&ld.includes(e)}function xr(e,t){if(t!=="auto")return e.map(()=>t);if(e.length===0)return[];let n=us(e,a=>a.x,a=>a.x+a.width,"left","right"),r=us(e,a=>a.y+a.height,a=>a.y,"bottom","top");if(n&&r)return dd(e)?n:r;let o=n??r;if(!o)throw new RangeError('expressive: baseline "auto" found no edge that every mark grows from. Pass baseline: "left", "right", "top" or "bottom".');return o}function io(e,t,n){let r=xn(t.map(f=>f.box)),o=ud(r,n),a=t.map((f,h)=>({index:h,...o(f.box)})).sort((f,h)=>f.near-h.near||f.far-h.far||f.index-h.index),i=0,s=1/0,c=a.map(({index:f,near:h,far:w})=>{i>0&&w>h&&(s=Math.min(s,h-i));let v=Math.max(0,w-i);return i=Math.max(i,w),{series:t[f].series,size:v}}),d=t[a[a.length-1].index],l=t.length===1?t[0].series:void 0;return{geometry:Ye.bar({key:e,...l===void 0?{}:{series:l},...r,baseline:n,radius:d.radius,gap:Number.isFinite(s)?Math.max(0,ao(s)):0,...c.every(f=>f.series!==void 0)?{segments:c.map(f=>({series:f.series,size:ao(f.size)}))}:{}}),order:a.map(f=>f.index)}}function Mr(e,t){let n=t[0]==="left"||t[0]==="right",r=a=>n?a.y:a.x,o=a=>n?a.x:a.y;return e.map((a,i)=>i).sort((a,i)=>r(e[a])-r(e[i])||o(e[a])-o(e[i])||a-i)}function xn(e){let t=Math.min(...e.map(r=>r.x)),n=Math.min(...e.map(r=>r.y));return{x:t,y:n,width:ao(Math.max(...e.map(r=>r.x+r.width))-t),height:ao(Math.max(...e.map(r=>r.y+r.height))-n)}}function us(e,t,n,r,o){let a=e[0];if(!a)return[];for(let i of[t(a),n(a)]){let s=[];for(let c of e)if(Math.abs(t(c)-i)<ds)s.push(r);else if(Math.abs(n(c)-i)<ds)s.push(o);else break;if(s.length===e.length)return s}}function dd(e){let t=o=>Math.max(...o)-Math.min(...o),n=t(e.map(o=>o.y+o.height/2)),r=t(e.map(o=>o.x+o.width/2));return n!==r?n>r:e[0].width>=e[0].height}function ud(e,t){switch(t){case"left":return n=>({near:n.x-e.x,far:n.x+n.width-e.x});case"right":return n=>({near:e.x+e.width-(n.x+n.width),far:e.x+e.width-n.x});case"top":return n=>({near:n.y-e.y,far:n.y+n.height-e.y});case"bottom":return n=>({near:e.y+e.height-(n.y+n.height),far:e.y+e.height-n.y})}}function ao(e){return Math.round(e*1e3)/1e3}function ms(){let e=new Map,t=u=>{let f=e.get(u);return f||(f={attributes:new Map,styles:new Map,classes:new Set,before:{}},e.set(u,f)),f},n=u=>u.style,r=(u,f,h)=>{h===null?u.removeAttribute(f):u.getAttribute(f)!==h&&u.setAttribute(f,h)},o=(u,f)=>{let h=f.before.style;f.styles.size>0||!h||(f.before.style=void 0,n(u)?.cssText===h.css&&r(u,"style",h.text))},a=(u,f)=>{let h=f.before.class;if(f.classes.size>0||h===void 0)return;f.before.class=void 0;let w=v=>[...new Set((v??"").split(/\s+/).filter(Boolean))].sort().join(" ");w(u.getAttribute("class"))===w(h)&&r(u,"class",h)};function i(u,f,h){let w=u.getAttribute(f),v=t(u).attributes,D=v.get(f);D?(w!==D.written&&(D.original=w),D.written=h):v.set(f,{original:w,written:h}),r(u,f,h)}function s(u,f,h){if(h!==null){i(u,f,h);return}let w=e.get(u)?.attributes,v=w?.get(f);!w||!v||(u.getAttribute(f)===v.written&&r(u,f,v.original),w.delete(f))}function c(u,f,h){let w=n(u);if(!w)return;let v=t(u),D=v.styles.get(f);if(h===void 0){if(!D)return;D.value===""?w.removeProperty(f):w.setProperty(f,D.value,D.priority),v.styles.delete(f),o(u,v);return}D||(v.styles.size===0&&(v.before.style={text:u.getAttribute("style"),css:w.cssText}),v.styles.set(f,{value:w.getPropertyValue(f),priority:w.getPropertyPriority(f)})),w.getPropertyValue(f)!==h&&w.setProperty(f,h)}function d(u,f,h){let w=u.classList;if(h){if(w.contains(f))return;let D=t(u);D.classes.size===0&&(D.before.class=u.getAttribute("class")),D.classes.add(f),w.add(f);return}let v=e.get(u);v?.classes.delete(f)&&(w.remove(f),a(u,v))}function l(u){let f=e.get(u);if(f){for(let h of[...f.styles.keys()])c(u,h,void 0);for(let h of[...f.classes])d(u,h,!1);for(let h of[...f.attributes.keys()])s(u,h,null);e.delete(u)}}return{attribute:s,remove:(u,f)=>i(u,f,null),style:c,styled:(u,f)=>e.get(u)?.styles.has(f)??!1,toggleClass:d,restore:l,restoreAll(){for(let u of[...e.keys()])l(u)},elements:()=>[...e.keys()]}}function Sr(){let e=new Map;return t=>(e.has(t)||e.set(t,gs(t)),e.get(t))}function Xt(e,t,n,r=gs){let o=r(e),a=o&&r(t);return o&&a?xe.multiply(Dn(o),a):xe.multiply(Dn(ys(e,n)),ys(t,n))}function Er(e){return lr(e.getAttribute("transform")??"")}function ps(e){let[t,n,r,o]=e,a=1e-9*Math.max(Math.abs(t),Math.abs(n),Math.abs(r),Math.abs(o));return Math.abs(n)<=a&&Math.abs(r)<=a||Math.abs(t)<=a&&Math.abs(o)<=a}function Qn(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(s=>xe.apply(e,s)),r=n.map(s=>s.x),o=n.map(s=>s.y),a=Xn(Math.min(...r)),i=Xn(Math.min(...o));return{x:a,y:i,width:Xn(Xn(Math.max(...r))-a),height:Xn(Xn(Math.max(...o))-i)}}function hs(e){let t=n=>{let r=e[n],o=typeof r?.baseVal?.value=="number"?r.baseVal.value:Number.parseFloat(e.getAttribute(n)??"");return Number.isFinite(o)?o:0};return{x:t("x"),y:t("y"),width:Math.max(0,t("width")),height:Math.max(0,t("height"))}}function gs(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 ys(e,t){let n=[1,0,0,1,0,0];for(let r=e;r&&r!==t;r=r.parentElement)n=xe.multiply(Er(r),n);return n}function Xn(e){return Math.round(e*1e3)/1e3}function vs(e,t,n){let r={},o=!1,a=_r(),i=()=>{let{transform:c,opacity:d,emphasis:l}=r;for(let u of e()){let{element:f,colors:h}=u,w=c&&u.parentInverse?xe.multiply(u.parentInverse,c,u.parent,Er(f)):void 0;t.style(f,"transform",w&&yd(w)),t.style(f,"transform-origin",w&&"0 0"),t.style(f,"transform-box",w&&"view-box"),t.style(f,"opacity",d===void 0?void 0:String(d));let v=h?l!==void 0?md(h,l):o?h.strong:void 0:void 0;t.style(f,"fill",h?.paint==="fill"?v:void 0),t.style(f,"stroke",h?.paint==="stroke"?v:void 0),t.style(f,"transition",l===void 0||!h?void 0:"none")}s()},s=()=>{let c=e().flatMap(d=>d.outline===void 0?[]:[{...d.outline,color:d.colors?.color}]);a.paint(n(),c,r.halo,r.transform)};return{get style(){return r},set(c){r=Yt(r,c),i()},reset(){r={},i()},repaint:i,hot(c){c!==o&&(o=c,i())}}}function ks(e,t){let n=bs(e,t,"fill"),r=n===Dr?"stroke":"fill",o=r==="fill"?n:bs(e,t,"stroke");if(!(o===void 0||o===Dr))return{color:o,strong:`color-mix(in oklab, ${o}, ${it("text")} ${fd})`,paint:r}}var fd="25%",Dr="none";function bs(e,t,n){let r;for(let i=e;i&&r===void 0;i=i===t?null:i.parentElement){let s=i.style?.getPropertyValue(n)||i.getAttribute(n);s&&(r=s)}let o=ws(e.ownerDocument.defaultView?.getComputedStyle?.(e).getPropertyValue(n)),a=n==="fill"?o?.replace(/\s/g,"")==="rgb(0,0,0)":o===Dr;return o!==void 0&&!(a&&r!==void 0)?o:ws(r)}function ws(e){let t=e?.trim().toLowerCase();if(!(!t||t==="inherit"||t.startsWith("url(")))return t===Dr||t==="transparent"||/^rgba\((?:[^,]+,){3}\s*0(?:\.0*)?\s*\)$/.test(t)?Dr:e.trim()}function md(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 yd(e){return`matrix(${e.map((t,n)=>n<4?Math.round(t*1e6)/1e6:Math.round(t*1e3)/1e3).join(", ")})`}function wa(e){if(typeof e=="string"){if(typeof document>"u")throw new TypeError("expressive: a selector needs a document.");return{elements:Array.from(document.querySelectorAll(e)),data:void 0}}if(Ms(e))return{elements:[e],data:void 0};if(Ss(e)){let t=Array.from(e.nodes()),n=Array.from(e.data());return{elements:t,data:n.length===t.length?n:void 0}}if(e!==null&&typeof e=="object"&&typeof e.length=="number")return{elements:Array.from(e),data:void 0};throw new TypeError("expressive needs marks: a selector, an element, a list of elements or a D3 selection.")}function xs(e){if(!Ss(e))return;let{elements:t,data:n}=wa(e);return n&&new Map(t.map((r,o)=>[r,n[o]]))}function so(e){let t;for(let n of e){if(!Ms(n))throw new TypeError(`expressive: marks must be elements, got ${String(n)}.`);let r=n.ownerSVGElement??null;if(!r){let o=n.localName;throw new TypeError(o==="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 <${o}>.`)}for(;r.ownerSVGElement;)r=r.ownerSVGElement;if(t&&r!==t)throw new TypeError("expressive: all marks must be in the same <svg>.");t=r}if(!t)throw new TypeError("expressive: no marks.");return t}function co(e,t){let n=e[0].parentElement??t;for(;n!==t&&!e.every(r=>r!==n&&n.contains(r));)n=n.parentElement??t;return n}function Ms(e){return typeof e=="object"&&e!==null&&e.nodeType===1}function Ss(e){return typeof e=="object"&&e!==null&&typeof e.nodes=="function"&&typeof e.data=="function"}var pd=["d","x","y","width","height","cx","cy","r","points","transform"],hd=["transform","style"];function Es(e,t,n){let r=e.defaultView?.MutationObserver??(typeof MutationObserver>"u"?void 0:MutationObserver);if(!r)throw new TypeError("expressive: watch needs MutationObserver, which this DOM doesn't have.");let o=new Set,a=new Set,i=new Set,s=new Set,c,d=h=>{for(let{target:w,attributeName:v}of h){let D=w;i.has(D)&&o.add(D),s.has(D)&&(v==="transform"||v==="style")&&a.add(D)}},l=new r(h=>{d(h),(o.size>0||a.size>0)&&!c&&(c=t.onFrame(u))});function u(){if(d(l.takeRecords()),o.size===0&&a.size===0){c?.(),c=void 0;return}let h={marks:o,ancestors:a};o=new Set,a=new Set,n(h)}function f(){l.takeRecords(),c?.(),c=void 0,o=new Set,a=new Set}return{observe(h,w){f(),l.disconnect(),i=new Set(h),s=new Set;for(let v of h)for(let D=v.parentElement;D&&!s.has(D);D=D===w?null:D.parentElement)s.add(D);for(let v of s)i.has(v)||l.observe(v,{attributes:!0,attributeFilter:hd});for(let v of i)l.observe(v,{attributes:!0,attributeFilter:pd})},destroy(){f(),l.disconnect(),i=new Set,s=new Set}}}var gd="http://www.w3.org/2000/svg",bd=new Set(["img","image","graphics-symbol","graphics-object"]);function er(e,t,n){wd(t);let r=cn(t.motion,n.motion),o=jt(t.on,n.presets),a=n.clock??Fe,i=t.dim===!0,s=ms(),c=new WeakMap,d=e,l=!1,u=!1;function f(m){let{elements:b,data:S}=wa(m);if(b.length===0)return{root:void 0,ancestor:void 0,marks:[]};let C=so(b),B=co(b,C),N=new Map;b.forEach((Ee,Je)=>{let mt=V(Ee,Je,S),Et=t.key(mt,Ee);if(Et==null||Et==="")throw new TypeError(`expressive: key returned ${JSON.stringify(Et)??String(Et)} for a <${Ee.localName}>. Every mark needs a key.`);let et=String(Et),Wt=x(mt,Ee,et),ie=N.get(et);if(!ie)N.set(et,ie=[]);else{if(Wt===void 0)throw new RangeError(`expressive: two elements have the key "${et}". Keys must be unique, or name each part with segment.`);if(ie.some(tt=>tt.series===Wt))throw new RangeError(`expressive: the mark "${et}" has two "${Wt}" segments.`)}ie.push({element:Ee,datum:mt,series:Wt,value:t.value?.(mt,Ee)})});let ee={svg:C,common:B,screen:Sr(),colors:Ee=>O(Ee,C)},ce=Ee=>({...Ee,label:R(Ee.key,Ee.parts)}),K=[...N.keys()];if(t.geometry){let Ee=K.map((Je,mt)=>ce(h(Je,N.get(Je),mt,ee)));return{root:C,ancestor:B,marks:P(F(Ts(Ee,Je=>Je.geometry)))}}let ye=K.map(Ee=>N.get(Ee).map(Je=>w(Ee,Je,ee))),Ie=ye.map(Ee=>xn(Ee.map(Je=>Je.rect.box))),Ve=xr(Ie,t.baseline??"auto"),He=Mr(Ie,Ve).map(Ee=>ce(v(K[Ee],ye[Ee],Ve[Ee],Ee,ee)));return{root:C,ancestor:B,marks:P(F(He))}}function h(m,b,S,C){let B=b[0],N=t.geometry(B.element,B.datum,m);if(typeof N!="object"||N===null||N.key!==m)throw new TypeError(`expressive: geometry for "${m}" must be a MarkGeometry with the key "${m}". Build it with describe and the key passed in.`);let ee=b.map(ce=>D(ce,Md(N,ce.series,b.length),C));return{key:m,geometry:N,parts:ee,index:S}}function w(m,b,S){if(b.element.localName!=="rect")throw new TypeError(`expressive: can't read the geometry of a <${b.element.localName}> (mark "${m}"). Only <rect> marks are read; describe others with the geometry option.`);let C=xe.multiply(Xt(S.common,b.element.parentElement??S.svg,S.svg,S.screen),Er(b.element));if(!ps(C))throw new TypeError(`expressive: the <rect> of "${m}" is rotated or skewed, so it isn't an upright bar. Describe it with the geometry option.`);return{...b,rect:{box:Qn(C,hs(b.element)),series:b.series,radius:Sd(b.element)}}}function v(m,b,S,C,B){let{geometry:N,order:ee}=io(m,b.map(ye=>ye.rect),S),ce=N.segments??[],K=ee.map((ye,Ie)=>{let Ve=ce[Ie];return D(b[ye],Ve&&Ve.length>=.5?{d:Ve.outline.d}:void 0,B)});return{key:m,geometry:N,parts:K,index:C,rect:{edge:S,box:xn(b.map(ye=>ye.rect.box))}}}function D(m,b,S){let C=Xt(S.common,m.element.parentElement??S.svg,S.svg,S.screen);return{element:m.element,datum:m.datum,series:m.series,value:m.value,parent:C,parentInverse:Ed(C),colors:S.colors(m.element),outline:b}}function F(m){return m.map(b=>{let{key:S,geometry:C,parts:B}=b,N=b.rect?vd(B):void 0,ee=(ye,Ie,Ve)=>t.samples?xd(t.samples(ye,Ie),Ve===void 0?`"${S}"`:`"${S}" (${Ve})`):N===void 0?[]:kd(C,Ie,N),ce=new Map,K=ye=>ce.get(ye)??oe(ye,S);for(let ye of Ds(b)){let Ie=(B.find(Ve=>Ve.series===ye)??B[0]).datum;ce.set(ye,{datum:Ie,samples:ee(Ie,C.segments?.find(Ve=>Ve.series===ye)??C,ye),related:K})}return{...b,data:{datum:B[0].datum,samples:ee(B[0].datum,C),related:K}}})}function P(m){if(m.length===0)return m;let b=new Set(m.flatMap(S=>[...S.geometry.series===void 0?[]:[S.geometry.series],...Ds(S)]));for(let S of Ht){let C=o[S];if(C?.kind==="data")for(let B of C.needs?.related??[]){if(b.has(B))continue;let N=b.size>0?`the marks' series are ${[...b].map(ee=>`"${ee}"`).join(", ")}`:"the marks have no series";throw new RangeError(`expressive: on.${S} needs the series "${B}", but ${N}. Name each mark's series in its geometry (describe.line({ key, series, \u2026 })), or a stack's parts with segment.`)}}return m}function V(m,b,S){if(t.datum)return t.datum(m);if(S)return S[b];let C=m.__data__;return typeof C=="number"&&!l&&(l=!0,console.warn("expressive: element.__data__ is a number, which looks like Observable Plot's row index. Pass datum: (el) => rows[el.__data__].")),C}function x(m,b,S){if(!t.segment)return;let C=t.segment(m,b);if(C==null||C==="")throw new TypeError(`expressive: segment returned ${String(C)} for a part of "${S}".`);return String(C)}function R(m,b){if(t.markLabel)try{let S=String(t.markLabel(b[0].datum,{key:m,parts:b.map(({series:C,datum:B})=>({series:C,datum:B}))})??"");return S.trim()===""?void 0:S}catch(S){Se(S);return}}function O(m,b){if((s.styled(m,"fill")||s.styled(m,"stroke"))&&c.has(m))return c.get(m);let S=ks(m,b);return c.set(m,S),S}let G=f(d),g=G.root?.ownerDocument??(typeof document>"u"?void 0:document);if(!g)throw new TypeError("expressive needs a DOM.");gt(g);let E,U,k=new Map,T=[],H=new Map,_=new Map,te=new Set,ae={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set},z,Z,se,de,we=!1,A=(m,b,S)=>{let C=g.createElementNS(gd,m);return le(C,b),S?.appendChild(C),C},j=A("g",{class:"ec-overlay","aria-hidden":"true"});$e(j,{"pointer-events":"none"});let Q=A("g",{class:"ec-halos"},j),ue=A("g",{class:"ec-runs"},j),be=zr(j),ve=m=>k.get(m)??H.get(m),je=ln({overlay:ue,mark:m=>({set:b=>ve(m)?.handle.set(b),reset:()=>ve(m)?.handle.reset()}),colors:m=>ve(m)?.mark.parts[0]?.colors}),Oe=on({effects:o,motion:r,icons:n.icons,clock:a,surface:je}),Pe=m=>({mark:m.mark.geometry,data:m.mark.data});function Ce(m){let b={key:m.key,mark:m,handle:vs(()=>b.mark.parts.filter(S=>(_.get(S.element)?.record??b)===b),s,()=>Q)};return b}function Ae(m){m.root&&m.root!==E&&wt(m.root),U=m.ancestor??U;let b=new Set(m.marks.map(N=>N.key)),S={entering:[],exiting:[],changed:[],moved:[]},C=[];for(let N of T)b.has(N.key)||(k.delete(N.key),H.set(N.key,N),S.exiting.push(N));let B=_;_=new Map,T=m.marks.map(N=>{let ee=k.get(N.key);if(ee){let ce=ee.mark;(t.value?Td(ce.parts,N.parts):Rd(ce.geometry,N.geometry))?S.changed.push({record:ee,from:ce.geometry}):(Ld(ce.geometry,N.geometry)||ce.data.datum!==N.data.datum||Cd(ce.data.samples,N.data.samples))&&S.moved.push(ee),ce.parts[0]?.colors?.color!==N.parts[0]?.colors?.color&&C.push(N.key),ee.mark=N}else ee=H.get(N.key),ee?(H.delete(N.key),ee.mark=N):ee=Ce(N),k.set(N.key,ee),S.entering.push(ee);for(let ce of N.parts)_.set(ce.element,{record:ee,part:ce});return ee});for(let[N,ee]of B)_.get(N)?.record!==ee.record&&s.restore(N);for(let N of T)_e(N);dt(),ut(),Rt();for(let N of T)N.handle.repaint();for(let N of C)je.recolor(N);return vt(),S}function _e(m){if(!t.markLabel)return;let{label:b,parts:S}=m.mark;S.forEach((C,B)=>{let N=b!==void 0&&B===0;s.attribute(C.element,"role",N?"img":null),s.attribute(C.element,"aria-label",N?b:null),N?s.remove(C.element,"aria-hidden"):s.attribute(C.element,"aria-hidden",b===void 0?null:"true")})}function dt(){let m=E,b=new Set;for(let S of t.markLabel&&m?T:[])if(S.mark.label!==void 0)for(let C of S.mark.parts)for(let B=C.element.parentElement;B&&B!==m&&m?.contains(B);B=B.parentElement){if(b.has(B)||B.hasAttribute("aria-label")||B.hasAttribute("aria-labelledby"))continue;let N=B.getAttribute("role")?.trim().split(/\s+/)[0];(N!==void 0&&bd.has(N)||N===void 0&&te.has(B))&&b.add(B)}for(let S of te)b.has(S)||(s.attribute(S,"role",null),s.attribute(S,"aria-roledescription",null));for(let S of b)s.remove(S,"role"),s.remove(S,"aria-roledescription");te=b}function ut(){if(!E||!U)return;E.lastElementChild!==j&&E.appendChild(j),j.removeAttribute("transform");let m=Xt(j,U,E);Dd(m)||j.setAttribute("transform",pt(m))}function wt(m){me(),E=m,E.appendChild(j),(t.keyboard===!0||t.markLabel)&&E.getAttribute("role")==="img"&&!u&&(u=!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.')),se=Kr(E,{find(b){let S=Ge(b);if(!S)return;let{key:C}=S.record;return S.part.series===void 0?{key:C}:{key:C,segment:S.part.series}},hover(b,S){let C=k.get(b.key);!C||zt(z)&&z.keys[0]===b.key||(Ke(),ft([C],S,b.segment))},leave(){(z?.source==="pointer"||z?.source==="touch")&&Ke()}})}function me(){E&&(Ke(),se?.destroy(),se=void 0)}function Ge(m){for(let b=m;b&&b!==E;b=b.parentElement){let S=_.get(b);if(S)return S}}function ft(m,b,S,C=!0){let B={keys:m.map(N=>N.key),source:b,effects:C};z=B,Rt(),C&&Oe.hover(m.map(Pe)),m.forEach((N,ee)=>pe("hover",{...Pe(N),batch:{index:ee,count:m.length},source:b,...S===void 0?{}:{segment:S}})),b!=="linked"&&z===B&&de?.hover(m.map(Pe))}function Ke(){let m=z;m&&(z=void 0,Rt(),Dt(m.keys),zt(m)&&de?.leave())}function Dt(m){let b=m.flatMap(S=>ve(S)??[]);Oe.leave(m),b.forEach((S,C)=>pe("leave",{...Pe(S),batch:{index:C,count:b.length}}))}function Tt(){if(z===void 0)return;let m=z.keys.filter(S=>k.has(S));if(m.length===z.keys.length)return;if(m.length===0){se?.clear(),Ke();return}let b=z.keys.filter(S=>!k.has(S));z={...z,keys:m},Dt(b)}function Rt(){if(!i)return;let m=`${r.duration(100,"feedback")}ms`;for(let b of T){let S=z?.keys.includes(b.key)===!0;for(let C of b.mark.parts)s.toggleClass(C.element,"ec-attached",!0),s.toggleClass(C.element,"ec-dimmed",z!==void 0&&!S),s.style(C.element,"--ec-hover-duration",m);b.handle.hot(S)}for(let b of H.values())b.handle.hot(!1)}let st=i?r.subscribe(Rt):void 0,Ct=new Set(Ht.flatMap(m=>{let b=o[m];return b?.kind==="data"?b.needs?.related??[]:[]}));function vt(){let m=Z===void 0?void 0:k.get(Z);be.draw(m?.mark.geometry)}let Lt=t.keyboard===!0?Ur(()=>E,{find:m=>Ge(m)?.record.key,order:()=>T.map(m=>m.key),element:m=>k.get(m)?.mark.parts[0]?.element,tabIndex(m,b){let S=k.get(m);!S||b===void 0||S.mark.parts.forEach((C,B)=>{s.attribute(C.element,"tabindex",B===0?b:"-1"),s.style(C.element,"outline","none")})},focus(m,b){Z=b?m:void 0,vt();let S=k.get(m);if(S){if(!b){z?.source==="keyboard"&&z.keys[0]!==m&&Ke();return}if(zt(z)&&z.keys[0]===m){z={...z,source:"keyboard"};return}Ke(),ft([S],"keyboard")}},blur(){Z=void 0,vt(),z?.source==="keyboard"&&(se?.current===z.keys[0]?z={...z,source:"pointer"}:Ke())},escape(){return z?(z.source==="linked"&&de?de.dismiss():Ke(),!0):!1}}):void 0,Ne=t.watch===!0?Es(g,a,Pt):void 0;function Qe(){Ne?.observe(T.flatMap(m=>m.mark.parts.map(b=>b.element)),E)}function Pt(m){if(we||!U)return;let b=new Set;for(let ee of m.marks){let ce=_.get(ee)?.record;ce&&b.add(ce)}let S=!1;for(let ee of m.ancestors)if(ee.contains(U))S=!0;else for(let ce of T)ce.mark.parts.some(K=>ee.contains(K.element))&&b.add(ce);if(S&&ut(),b.size===0)return;let{records:C,marks:B}=Qt([...b]);C.forEach((ee,ce)=>{let K=B[ce];ee.mark=K;for(let ye of K.parts)_.set(ye.element,{record:ee,part:ye});ee.handle.repaint()}),T=W(T),C.some(ee=>ee.key===Z)&&vt();let N=new Set(C);if(C.some(ee=>Ct.has(ee.mark.geometry.series??"")))for(let ee of T)N.add(ee);for(let ee of N)Oe.change(ee.mark.geometry,ee.mark.data)}function Qt(m){let b={svg:E,common:U,screen:Sr(),colors:K=>_.get(K)?.part.colors},S=M(),C=({parts:K})=>K.map(ye=>({element:ye.element,datum:S(ye.element),series:ye.series,value:ye.value}));if(t.geometry){let K=m.map(({mark:ye})=>({...h(ye.key,C(ye),ye.index,b),label:ye.label}));return{records:[...m],marks:F(K)}}let B=new Map(m.map(K=>[K,C(K.mark).map(ye=>w(K.key,ye,b))])),N=Ue(B);for(let K of T)!B.has(K)&&N.get(K)!==K.mark.rect.edge&&B.set(K,C(K.mark).map(ye=>w(K.key,ye,b)));let ee=[...B.keys()],ce=ee.map(K=>({...v(K.key,B.get(K),N.get(K),K.mark.index,b),label:K.mark.label}));return{records:ee,marks:F(ce)}}function Ue(m){let b=new Map(T.map(C=>[C,C.mark.rect.edge]));if(t.baseline!==void 0&&t.baseline!=="auto")return b;let S=T.map(C=>{let B=m.get(C);return B?xn(B.map(N=>N.rect.box)):C.mark.rect.box});try{let C=xr(S,"auto");return new Map(T.map((B,N)=>[B,C[N]]))}catch{return b}}function M(){if(t.datum)return t.datum;let m=xs(d);return b=>m?.has(b)?m.get(b):V(b,0,void 0)}function W(m){let b=[...m].sort((B,N)=>B.mark.index-N.mark.index);if(t.geometry)return[...Ts(b,B=>B.mark.geometry)];let S=b.map(B=>B.mark.rect.box),C=b.map(B=>B.mark.rect.edge);return Mr(S,C).map(B=>b[B])}function oe(m,b){return T.find(S=>S.key!==b&&S.mark.geometry.series===m)?.mark.data}function pe(m,b){for(let S of[...ae[m]])try{S(b)}catch(C){Se(C)}}function p(m,b){b.forEach((S,C)=>pe(m,{...Pe(S),batch:{index:C,count:b.length}}))}return Oe.enter(Ae(G).entering.map(Pe)),Lt?.sync(),Qe(),_t({targets:()=>T.map(m=>({key:m.key,marks:[Pe(m)]})),hover(m,b){Ke();let S=m.flatMap(C=>k.get(C)??[]);S.length>0&&ft(S,"linked",void 0,b)},unlink(){z?.source==="linked"&&Ke()},leave(){se?.clear(),Ke()},listen(m){return we?!1:(de=m,!0)}},{refresh(m){if(we)return;let b=f(m??d);m!==void 0&&(d=m),Oe.interrupt();let S=Ae(b);Qe(),Tt();let C=Oe.exit(S.exiting.map(Pe));p("exit",S.exiting),Oe.update(S.changed.map(({record:N,from:ee})=>({...Pe(N),from:ee}))),S.changed.forEach(({record:N,from:ee},ce)=>pe("update",{...Pe(N),from:ee,batch:{index:ce,count:S.changed.length}})),Oe.enter(S.entering.map(Pe)),p("enter",S.entering);let B=new Set([...S.changed.map(N=>N.record),...S.moved]);if([...B,...S.entering,...S.exiting].some(N=>Ct.has(N.mark.geometry.series??""))){let N=new Set(S.entering);for(let ee of T)N.has(ee)||B.add(ee)}for(let N of B)Oe.change(N.mark.geometry,N.mark.data);Oe.settle(),Lt?.sync(),C.then(()=>{for(let N of S.exiting)H.get(N.key)===N&&H.delete(N.key)})},on(m,b){let S=ae[m];if(!S)throw new TypeError(`expressive: unknown event "${String(m)}". Use one of: ${Object.keys(ae).join(", ")}.`);return S.add(b),()=>{S.delete(b)}},marks:()=>T.map(m=>m.mark.geometry),focus(m){k.has(m)&&!we&&Lt?.focus(m)},destroy(){if(!we){we=!0,z=void 0,de?.gone(),de=void 0,Ne?.destroy(),Oe.destroy(),st?.(),Lt?.destroy(),me(),j.remove(),s.restoreAll();for(let m of Object.values(ae))m.clear();k.clear(),H.clear(),T=[],_=new Map}}})}function wd(e){if(typeof e!="object"||e===null)throw new TypeError("expressive needs options, with at least a key: { key: (d) => d.name }.");if(typeof e.key!="function")throw new 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 new TypeError(`expressive: ${t} must be a function.`);if(e.baseline!==void 0&&e.baseline!=="auto"&&!fs(e.baseline))throw new RangeError(`expressive: baseline must be "left", "right", "top", "bottom" or "auto", got ${String(e.baseline)}.`)}function Ds(e){let t=[...(e.geometry.segments??[]).map(n=>n.series),...e.parts.map(n=>n.series)];return[...new Set(t.filter(n=>n!==void 0))]}function vd(e){let t=0;for(let{value:n}of e){if(typeof n!="number"||!Number.isFinite(n))return;t+=n}return t}function kd(e,t,n){let r=a=>e.length>0?n*a/e.length:0;if(t===e)return[{t:0,value:0},{t:1,value:n}];let o=Rs(e.start,t.start);return[{t:0,value:r(o)},{t:1,value:r(o+t.length)}]}function xd(e,t){if(!Array.isArray(e))throw new TypeError(`expressive: samples for ${t} must return an array of { t, value }, got ${va(e)}.`);let n=0;return e.map((r,o)=>{let{t:a,value:i,at:s}=typeof r=="object"&&r!==null?r:{};if(typeof a!="number"||!(a>=0&&a<=1))throw new RangeError(`expressive: samples for ${t}: samples[${o}].t must be in [0, 1], got ${va(a)}.`);if(a<n)throw new RangeError(`expressive: samples for ${t} must be in t order: samples[${o}].t is ${a}, after ${n}.`);if(typeof i!="number"||!Number.isFinite(i))throw new RangeError(`expressive: samples for ${t}: samples[${o}].value must be a finite number, got ${va(i)}.`);return n=a,s===void 0?{t:a,value:i}:{t:a,value:i,at:s}})}function va(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(a=>Rs(t(a).pivot,n)<=.5&&kr(t(a))))return e;let r=2*Math.PI,o=a=>{let{center:i}=t(a),s=Math.atan2(i.x-n.x,n.y-i.y),c=s<0?s+r:s;return c>=r?0:c};return e.map(a=>({mark:a,angle:o(a)})).sort((a,i)=>a.angle-i.angle).map(({mark:a})=>a)}function Rs(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Md(e,t,n){let r=t===void 0?void 0:e.segments?.find(a=>a.series===t),o=r??(n===1?e:void 0);if(!(!o||r&&r.length<.5))return o.outline.closed?{d:o.outline.d}:{d:o.outline.d,stroke:o.thickness}}function Sd(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 Ed(e){try{return Dn(e)}catch{return}}function Dd(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 Td(e,t){if(e.length!==t.length)return!0;let n=new Map(e.map(r=>[r.series,r.value]));return t.some(r=>{let o=n.get(r.series);return!n.has(r.series)||!(o===r.value||Object.is(o,r.value))})}function Rd(e,t){let n=e.segments??[],r=t.segments??[];return Math.abs(e.length-t.length)>.01||n.length!==r.length?!0:n.some((o,a)=>o.key!==r[a].key||Math.abs(o.length-r[a].length)>.01)}function Cd(e,t){let n=(r,o)=>r===o||r instanceof Date&&o instanceof Date&&r.getTime()===o.getTime();return e.length!==t.length||e.some((r,o)=>r.t!==t[o].t||r.value!==t[o].value||!n(r.at,t[o].at))}function Ld(e,t){if(e.outline.d!==t.outline.d||e.thickness!==t.thickness||Ko(e,t))return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((o,a)=>o.key!==r[a].key||o.outline.d!==r[a].outline.d)}var Pd=["line","rect","arc","symbol"],Od=["d","transform","x","y","width","height","stroke-width"];function lo(e,t,n){if(Ad(e),typeof t!="object"||t===null||typeof t.key!="function")throw new TypeError("fromVegaView needs options with a key: { key: (d) => d.series }. Marks are matched by key.");let r=t.mark??"marks";if(typeof r!="string"||r==="")throw new TypeError(`fromVegaView: mark must be a mark's name, got ${String(r)}.`);if(t.sample!==void 0&&typeof t.sample!="function")throw new TypeError("fromVegaView: sample must be a function.");let o=v(),{mark:a,sample:i,...s}=t,c=er(o.elements,{...s,datum:g=>w(g).datum,geometry:(g,E,U)=>{let k=o.geometry.get(U);if(!k)throw new TypeError(`fromVegaView: no geometry for "${U}". Its key must be the same for every item of a mark.`);return k},...t.samples||!t.sample?{}:{samples:(g,E)=>o.samples.get(E)??[]},...t.value||!t.sample?{}:{value:(g,E)=>o.values.get(E)}},n),d=n.clock??Fe,l,u,f=!1,h=typeof MutationObserver=="function"?new MutationObserver(g=>g.some(x)&&R()):void 0;O(o.root);function w(g){let E=o.items.get(g);if(!E)throw new TypeError("fromVegaView: an element that isn't one of the View's items.");return E}function v(){let g=$d(Cs(e),r),E=Gd(g,r,e),U=e.container(),k=U?.localName==="svg"?U:U?.querySelector("svg"),T={root:k??void 0,elements:[],items:new Map,geometry:new Map,samples:new Map,values:new Map};if(!E||!k)return T;let H=new Set(E==="line"?g.flatMap(j=>j.items?.length?[j.items[0]]:[]):g.flatMap(j=>j.items??[])),_=new Map;for(let j of Array.from(k.querySelectorAll("*"))){let Q=j.__data__;H.has(Q)&&_.set(j,Q)}let te=[..._.keys()];if(te.length===0)return T;let ae=so(te),z=co(te,ae),Z=Sr(),se=j=>Xt(z,j.parentElement??ae,ae,Z),de=j=>String(t.key(_.get(j).datum,j)),we=j=>t.segment?String(t.segment(_.get(j).datum,j)):void 0,A={root:ae,items:_,elements:te,geometry:new Map,samples:new Map,values:new Map};if(t.sample)for(let[j,Q]of _){let ue=E==="line"?ka(Q).map(be=>be.item):[Q];A.values.set(j,ue.map(be=>F(be).value).join(","))}if(E==="rect")return D(A,se,de,we);for(let j of te){let Q=_.get(j),ue=de(j);if(A.geometry.has(ue))continue;let be=se(j),ve=E==="line"?Vd(ue,j,Q,be):E==="arc"?Nd(ue,Q,be):Fd(ue,Q,be);A.geometry.set(ue,ve),t.sample&&A.samples.set(ve,E==="line"?P(ve,Q,be):V(ve,Q,E))}return A}function D(g,E,U,k){let T=new Map;for(let z of g.elements){let Z=g.items.get(z),se=U(z),de={box:Qn(E(z),Bd(Z)),series:k(z),radius:Math.max(0,Z.cornerRadius??0)},we=T.get(se);we?we.push({element:z,part:de}):T.set(se,[{element:z,part:de}])}let H=[...T.keys()],_=H.map(z=>xn(T.get(z).map(Z=>Z.part.box))),te=xr(_,t.baseline??"auto"),ae=[];for(let z of Mr(_,te)){let Z=H[z],se=T.get(Z),{geometry:de,order:we}=io(Z,se.map(A=>A.part),te[z]);if(g.geometry.set(Z,de),ae.push(...we.map(A=>se[A].element)),t.sample){let A=we.map(ue=>F(g.items.get(se[ue].element)).value),j=A.reduce((ue,be)=>ue+be,0);g.samples.set(de,[{t:0,value:0},{t:1,value:j}]);let Q=0;(de.segments??[]).forEach((ue,be)=>{let ve=Q;Q+=A[be]??0,g.samples.set(ue,[{t:0,value:ve},{t:1,value:Q}])})}}return{...g,elements:ae}}function F(g){let E=t.sample(g.datum),U=typeof E=="number"?{value:E}:E;if(typeof U!="object"||U===null||!Number.isFinite(U.value))throw new RangeError(`fromVegaView: sample must give a finite number, or { value, at }, got ${JSON.stringify(E)}.`);return U.at===void 0?{value:U.value}:{value:U.value,at:U.at}}function P(g,E,U){return dr(g,ka(E).map(({item:k,point:T})=>({...xe.apply(U,T),...F(k)})))}function V(g,E,U){let{value:k,at:T}=F(E),H=T===void 0?{t:1,value:k}:{t:1,value:k,at:T};return U==="symbol"?[{...H,t:0}]:g.length>0?[{t:0,value:0},H]:[{...H,t:0}]}function x(g){let E=l?.querySelector(":scope > .ec-overlay"),U=k=>k===E||(E?.contains(k)??!1);return U(g.target)?!1:g.type==="childList"?[...Array.from(g.addedNodes),...Array.from(g.removedNodes)].some(k=>!U(k)):!0}function R(){if(u||f)return;let g=d.onFrame(()=>{g(),u=void 0;try{G()}catch(E){Se(E)}});u=g}function O(g){!h||g===l||(h.disconnect(),l=g,g&&h.observe(g,{subtree:!0,childList:!0,attributes:!0,attributeFilter:Od}))}function G(){if(f)return;let g=v(),E=o;o=g;try{c.refresh(g.elements)}catch(U){throw o=E,U}O(g.root)}return _t(wi(c),{refresh:G,on:c.on,marks:c.marks,focus:c.focus,destroy(){f||(f=!0,h?.disconnect(),u?.(),u=void 0,c.destroy())}})}function Ad(e){if(typeof e!="object"||e===null||typeof e.renderer!="function"||typeof e.scenegraph!="function"||typeof e.container!="function")throw new 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 new 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 Cs(e){let t=e.scenegraph();return t.root??t}function $d(e,t){let n=[],r=o=>{if(o.name===t&&o.marktype!=="group"&&n.push(o),o.marktype==="group")for(let a of o.items??[])for(let i of a.items??[])r(i)};return r(e),n}function Gd(e,t,n){if(e.length===0){let o=Id(Cs(n));if(o.length===0)return;throw new RangeError(`fromVegaView: the View has no mark named "${t}". Its named marks: ${o.map(a=>`"${a}"`).join(", ")}.`)}let r=e[0].marktype;if(!e.every(o=>o.marktype===r)||!Pd.includes(r))throw new 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 Id(e){let t=new Set,n=r=>{r.name&&r.marktype!=="group"&&t.add(r.name);for(let o of r.items??[])for(let a of o.items??[])n(a)};return n(e),[...t]}function ka(e){let t=e.mark?.items??[e],n=t[0]?.interpolate;if(n!==void 0&&n!=="linear")throw new TypeError(`fromVegaView: a line is drawn with interpolate "${n}", but only straight lines can be read. Use interpolate "linear" (the default), or describe the curve with expressive()'s geometry option.`);if(t.some(r=>r.defined===!1))throw new TypeError("fromVegaView: a line has a gap (a point with defined: false). Lines with gaps can't be read yet.");return t.map(r=>({item:r,point:{x:bt(r.x),y:bt(r.y)}}))}function Vd(e,t,n,r){let o=n.strokeWidth??Number.parseFloat(t.getAttribute("stroke-width")??"1");return Ye.line({key:e,series:e,points:ka(n).map(({point:a})=>xe.apply(r,a)),width:(Number.isFinite(o)?o:1)*xa(r)})}function Nd(e,t,n){let r=xe.apply(n,{x:bt(t.x),y:bt(t.y)}),o=xa(n),[a,i]=[bt(t.startAngle),bt(t.endAngle)].sort((s,c)=>s-c);return Ye.arc({key:e,cx:r.x,cy:r.y,inner:bt(t.innerRadius)*o,outer:bt(t.outerRadius)*o,start:a,end:i})}function Fd(e,t,n){let r=xe.apply(n,{x:bt(t.x),y:bt(t.y)});return Ye.point({key:e,x:r.x,y:r.y,r:Math.sqrt(Math.max(0,t.size??64)/Math.PI)*xa(n)})}function Bd(e){let t=bt(e.x),n=bt(e.y),r=bt(e.width),o=bt(e.height);return{x:Math.min(t,t+r),y:Math.min(n,n+o),width:Math.abs(r),height:Math.abs(o)}}function xa(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))}function bt(e){return typeof e=="number"&&Number.isFinite(e)?e:0}var Hd={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},Ma=/[\s,]*([A-Za-z]|[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)/y,Ls=/^[A-Za-z]$/;function uo(e){let t=[];Ma.lastIndex=0;for(let c=Ma.exec(e);c;c=Ma.exec(e))t.push(c[1]);let n=[],r={x:0,y:0},o=r,a,i="",s=0;for(;s<t.length;){if(Ls.test(t[s]))i=t[s++];else if(i===""||i==="Z"||i==="z")break;let c=i.toUpperCase();if(c==="Z"){n.push({op:"Z",to:o}),r=o,a=void 0;continue}let d=Hd[c];if(d===void 0)break;let l=[],u=!1;for(;l.length<d&&s<t.length&&!Ls.test(t[s]);){let O=t[s];if(c==="A"&&(l.length===3||l.length===4)){let G=O[0];if(G!=="0"&&G!=="1"){u=!0;break}l.push(Number(G)),O.length>1?t[s]=O.slice(1):s++;continue}l.push(Number(O)),s++}if(u||l.length<d||!l.every(Number.isFinite))break;let f=i!==c,h=(O,G)=>f?{x:r.x+O,y:r.y+G}:{x:O,y:G},[w=0,v=0,D=0,F=0,P=0,V=0,x=0]=l,R;switch(c){case"M":r=o=h(w,v),n.push({op:"M",to:r}),i=f?"l":"L";break;case"L":n.push({op:"L",to:r=h(w,v)});break;case"H":n.push({op:"L",to:r={x:f?r.x+w:w,y:r.y}});break;case"V":n.push({op:"L",to:r={x:r.x,y:f?r.y+w:w}});break;case"C":case"S":{let O=c==="S",G=O?a&&Ps(n,"C")?Os(a,r):r:h(w,v);R=O?h(w,v):h(D,F),n.push({op:"C",c1:G,c2:R,to:r=O?h(D,F):h(P,V)});break}case"Q":case"T":{let O=c==="T";R=O?a&&Ps(n,"Q")?Os(a,r):r:h(w,v),n.push({op:"Q",c:R,to:r=O?h(w,v):h(D,F)});break}case"A":n.push({op:"A",rx:Math.abs(w),ry:Math.abs(v),rotation:D,large:F!==0,sweep:P!==0,to:r=h(V,x)});break}a=R}return n}var Ps=(e,t)=>e[e.length-1]?.op===t,Os=(e,t)=>({x:2*t.x-e.x,y:2*t.y-e.y});function fo(e,t){let n=o=>({x:t[0]*o.x+t[2]*o.y+t[4],y:t[1]*o.x+t[3]*o.y+t[5]}),r=t[0]*t[3]-t[1]*t[2]<0;return e.map(o=>{switch(o.op){case"M":case"L":case"Z":return{op:o.op,to:n(o.to)};case"C":return{op:"C",c1:n(o.c1),c2:n(o.c2),to:n(o.to)};case"Q":return{op:"Q",c:n(o.c),to:n(o.to)};case"A":return{...o,...jd(o,t),sweep:r!==o.sweep,to:n(o.to)}}})}function jd({rx:e,ry:t,rotation:n},r){let o=n*Math.PI/180,a=Math.cos(o),i=Math.sin(o),s=(r[0]*a+r[2]*i)*e,c=(r[2]*a-r[0]*i)*t,d=(r[1]*a+r[3]*i)*e,l=(r[3]*a-r[1]*i)*t,u=s*s+c*c,f=s*d+c*l,h=d*d+l*l,w=(u+h)/2,v=Math.hypot((u-h)/2,f),D=w+v,F=Math.abs(f)<1e-12?u>=h?0:Math.PI/2:Math.atan2(D-u,f);return{rx:Math.sqrt(D),ry:Math.sqrt(Math.max(0,w-v)),rotation:F*180/Math.PI}}function mo(e){let t=Ze,n=r=>`${t(r.x)},${t(r.y)}`;return e.map(r=>{switch(r.op){case"M":case"L":return`${r.op}${n(r.to)}`;case"C":return`C${n(r.c1)} ${n(r.c2)} ${n(r.to)}`;case"Q":return`Q${n(r.c)} ${n(r.to)}`;case"A":return`A${t(r.rx)},${t(r.ry)} ${t(r.rotation)} ${r.large?1:0} ${r.sweep?1:0} ${n(r.to)}`;case"Z":return"Z"}}).join("")}var zd={get:()=>{}},_d={set(){},reset(){}},Sa={place(){},update(){},remove(){}};function As(e,t){let{effect:n,surface:r}=t;if(!Ea(n))throw new TypeError(`playTransition needs a transition effect (kind "transition" with run, end and clear), got ${Kd(n)}.`);let o=t.start??0;if(!(typeof o=="number"&&o>=0&&o<=1))throw new RangeError(`playTransition: start must be a number from 0 to 1, got ${String(o)}.`);let a=t.motion??kt,i=t.clock??Fe,s=t.icons??zd,c=e.length,d=[],l=!1,u=c,f,h=new Promise(G=>{f=G}),w=c>0?a.subscribe(()=>{a.mode==="off"&&R()}):void 0,v=()=>{--u>0||(w?.(),w=void 0,f())};function D(G,g,E){let U=Oo({clock:i,motion:a,icons:s,batch:{index:g,count:c},layer:O(G.to.key,g,()=>k.state!=="cleared"),mark:_d}),k={pair:G,index:g,scope:U,context:{...U.context,start:o},state:"running",done:E};d[g]=k;let{from:T,to:H}=G;try{a.mode==="off"?(n.end(T,H,k.context),F(k)):Promise.resolve(n.run(T,H,k.context)).then(()=>F(k),_=>P(k,_))}catch(_){P(k,_)}}function F(G){G.state==="running"&&(G.state="ended",V(G))}function P(G,g){let{signal:E}=G.context;E.aborted&&(g===E.reason||g?.name==="AbortError")||(Se(g),x(G))}function V(G){let g=G.done;G.done=void 0,g?.()}function x(G){if(G.state!=="cleared"){G.state="cleared",G.scope.abort();try{n.clear(G.context)}catch(g){Se(g)}G.scope.clear(),V(G)}}function R(){for(let G of[...d]){if(G.state!=="running")continue;let g=G.done;G.done=void 0,x(G),D(G.pair,G.index,g)}}function O(G,g,E){let U,k=()=>E()?U??(U=r.group(G,g)):void 0;return{icon:(T,H)=>k()?.icon(T,H)??Sa,path:(T,H)=>k()?.path(T,H)??Sa,text:(T,H)=>k()?.text(T,H)??Sa,clear(){let T=U;U=void 0,T?.clear()}}}return e.forEach((G,g)=>D(G,g,v)),c===0&&f(),{finished:h,clear(){if(!l){l=!0;for(let G of[...d])x(G)}}}}function Ea(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.kind==="transition"&&typeof t.run=="function"&&typeof t.end=="function"&&typeof t.clear=="function"}function Kd(e){if(typeof e!="object"||e===null)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)}`}var Ud=950,Wd=.4,tr=.5;function Ra(e,t,n){let r=un(e,"chartSwitch"),o=Qd(t),a=t.transition,i=$t(t.colors),s=n.motion,c=n.clock??Fe,d=r.ownerDocument;gt(d);let l=d.createElement("div");l.className="ec-switch",r.appendChild(l);let u=new Map;try{for(let A of o){let j=d.createElement("div");j.className="ec-switch-view",j.setAttribute("data-view",A),l.appendChild(j),Da(j,A===t.initial);let Q=t.views[A](j,i);if(!Xd(Q,j))throw Q?.destroy?.(),new TypeError(`chartSwitch: views.${A} must return the chart it draws in the container it's given (with element, marks(), labels(), focus(), leave() and destroy()), such as donutChart(container, { ... }).`);u.set(A,{name:A,container:j,chart:Q})}}catch(A){for(let j of u.values())j.chart.destroy();throw l.remove(),A}let f=Y("svg",{class:"ec-chart ec-switch-overlay","aria-hidden":"true"},l),h=Y("g",{class:"ec-switch-fades"},f),w=Y("g",{class:"ec-switch-runs"},f),v=Y("g",{class:"ec-switch-labels"},f),D=t.announce?Ot(f):void 0,F=new WeakMap,P={group(A,j){let Q=Y("g",{class:"ec-run","data-key":A},w);$e(Q,ht(at(i.slot(A)))),F.set(Q,j);let ue=Array.from(w.children).find(be=>(F.get(be)??-1/0)>j);return w.insertBefore(Q,ue??null),{...pr(Q),clear:()=>Q.remove()}}},V=t.initial,x,R=!1,O=s.subscribe(()=>{s.mode==="off"&&x&&z(x,!0)}),G,g=typeof ResizeObserver=="function"?new ResizeObserver(A=>{let j=A[A.length-1]?.contentRect.width??0;if(G!==void 0&&Math.abs(j-G)<.5)return;let Q=G===void 0;G=j,!Q&&x&&z(x,!0)}):void 0;g?.observe(l);let E=A=>u.get(A);function U(){return l.getRootNode().activeElement??null}function k(A){let j=U();if(!j||!A.container.contains(j))return;let Q=j.closest("[data-key]");return{key:Q&&A.chart.element.contains(Q)?Q.getAttribute("data-key")??void 0:void 0}}function T(A,j){if(!j)return;let Q=U();if(Q&&Q!==d.body&&Q!==d.documentElement&&!l.contains(Q))return;let ue=()=>A.chart.element.contains(U());if(j.key!==void 0&&A.chart.focus(j.key),!ue()){for(let be of A.chart.marks())if(A.chart.focus(be.key),ue())return}}function H(A){D?.say(A.chart.element.getAttribute("aria-label")??"")}function _(A,j,Q){V=j.name;let ue=Q?Q.focus:k(A);if(A.chart.leave(),s.mode==="off"){for(let Ce of u.values())Da(Ce.container,Ce===j);return T(j,ue),H(j),Promise.resolve()}for(let Ce of[A,j])Ce.container.classList.remove("ec-switch-inactive"),Ce.container.classList.add("ec-switching"),Ce.container.setAttribute("inert",""),Ce.chart.element.classList.add("ec-morphing");let{pairs:be,scene:ve}=Z(A,j),{done:je,settle:Oe}=Fs(),Pe={a:A,b:j,forward:!0,pairs:be,reversed:be.map(({from:Ce,to:Ae})=>({from:Ae,to:Ce})),scene:ve,focus:ue,progress:0,transition:void 0,driver:void 0,run:0,done:je,settle:Oe};return x=Pe,te(Pe,0),Pe.done}function te(A,j){let Q=++A.run;if(j>=1){z(A,!0);return}let ue=ve=>{A.progress=ve,A.scene.draw(A.forward?ve:1-ve)},be=qd(c);A.transition=As(A.forward?A.pairs:A.reversed,{effect:a,surface:P,start:j,motion:s,clock:be.clock,icons:n.icons}),A.driver=Zd(j,ue,{clock:be.clock,motion:s}),be.release(),Promise.all([A.driver.finished,A.transition.finished]).then(([ve])=>{x===A&&A.run===Q&&ve==="done"&&z(A,!0)})}function ae(A){return A.driver?.cancel(),A.transition?.clear(),A.forward=!A.forward,V=(A.forward?A.b:A.a).name,A.settle(),{done:A.done,settle:A.settle}=Fs(),te(A,1-A.progress),A.done}function z(A,j){if(x!==A)return;x=void 0,A.run++,A.driver?.cancel(),A.transition?.clear(),A.scene.clear();let Q=A.forward?A.b:A.a;for(let ue of[A.a,A.b])ue.chart.element.classList.remove("ec-morphing"),ue.container.classList.remove("ec-switching"),ue.container.style.removeProperty("opacity");for(let ue of u.values())Da(ue.container,ue===Q);j&&(T(Q,A.focus),H(Q)),A.settle()}function Z(A,j){let Q=Xt(f,A.chart.element,l),ue=Xt(f,j.chart.element,l),be=A.chart.marks().map(me=>Ta(me,Q)),ve=j.chart.marks().map(me=>Ta(me,ue)),je=new Map(be.map(me=>[me.key,me])),Oe=new Set(ve.map(me=>me.key)),Pe=ve.flatMap(me=>{let Ge=je.get(me.key);return Ge?[{from:Ge,to:me}]:[]}),Ce=[];for(let me of be)Oe.has(me.key)||Ce.push(se(me,Is));for(let me of ve)je.has(me.key)||Ce.push(se(me,Vs));let Ae=me=>`${me.role}
92
+ ${me.key}`,_e=A.chart.labels(),dt=j.chart.labels(),ut=new Map(_e.map(me=>[Ae(me),me])),wt=new Set;for(let me of dt){let Ge=ut.get(Ae(me));Ge&&(wt.add(Ae(me)),Ce.push(Jd(de(Ge,Q),de(me,ue))))}for(let me of _e)wt.has(Ae(me))||Ce.push(Gs(de(me,Q),Is));for(let me of dt)ut.has(Ae(me))||Ce.push(Gs(de(me,ue),Vs));return Ce.push(me=>{$s(A.container,1-yo(me/Wd)),$s(j.container,yo((me-tr)/(1-tr)))}),{pairs:Pe,scene:{draw:me=>{for(let Ge of Ce)Ge(me)},clear:()=>{h.replaceChildren(),w.replaceChildren(),v.replaceChildren()}}}}function se(A,j){let Q=Y("g",{class:"ec-switch-fade","data-key":A.key},h);return $e(Q,ht(at(i.slot(A.key)))),pr(Q).path(A.outline.d,A.outline.closed?{fill:"mark"}:{stroke:"mark",width:A.thickness}),ue=>le(Q,{opacity:j(ue)})}function de(A,j){let Q=A.element.cloneNode(!0);for(let be of["id","opacity","visibility","aria-hidden"])Q.removeAttribute(be);Q.textContent=A.text;let ue=xe.apply(j,A);return le(Q,{x:ue.x,y:ue.y,"text-anchor":A.anchor}),v.appendChild(Q),{text:Q,at:ue}}return{get current(){return V},show(A){if(!u.has(A))return Promise.reject(new TypeError(`chartSwitch: there's no view ${JSON.stringify(A)}. The views are ${o.map(be=>JSON.stringify(be)).join(", ")}.`));if(R)return Promise.resolve();let j=x;if(!j)return A===V?Promise.resolve():_(E(V),E(A));let Q=j.forward?j.b:j.a,ue=j.forward?j.a:j.b;return A===Q.name?j.done:A===ue.name?ae(j):(z(j,!1),_(Q,E(A),{focus:j.focus}))},chart(A){let j=u.get(A);if(!j)throw new TypeError(`chartSwitch: there's no view ${JSON.stringify(A)}. The views are ${o.map(Q=>JSON.stringify(Q)).join(", ")}.`);return j.chart},destroy(){if(R)return;R=!0;let A=x;A&&(x=void 0,A.run++,A.driver?.cancel(),A.transition?.clear(),A.scene.clear(),A.settle()),O(),g?.disconnect(),D?.destroy();for(let j of u.values())j.chart.destroy();l.remove()}}}function Zd(e,t,n){let r=Lr(e),o;return o=en({duration:Ud,timing:"transition",ease:yt,update:a=>{let i=Math.min(1,r+a);t(a===0?e:nt(i)),i>=1&&a<1&&o?.finish()}},n),o}function qd(e){let t=e.now();return{clock:{now:()=>t??e.now(),onFrame:n=>e.onFrame(n)},release(){t=void 0}}}function Da(e,t){e.classList.toggle("ec-switch-inactive",!t),e.toggleAttribute("inert",!t),t?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true")}function $s(e,t){e.style.setProperty("opacity",String(Math.round(t*1e3)/1e3))}function Jd(e,t){return n=>{let r=Ns(e.at.x,t.at.x,n),o=Ns(e.at.y,t.at.y,n),a=n>=tr;le(e.text,{x:r,y:o,visibility:a?"hidden":void 0}),le(t.text,{x:r,y:o,visibility:a?void 0:"hidden"})}}function Gs(e,t){return n=>le(e.text,{opacity:t(n)})}var Is=e=>1-yo(e/tr),Vs=e=>yo((e-tr)/(1-tr)),yo=e=>Math.min(1,Math.max(0,e)),Ns=(e,t,n)=>e*(1-n)+t*n,Yd=e=>e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1&&e[4]===0&&e[5]===0;function Ta(e,t){if(Yd(t))return e;let n=i=>xe.apply(t,i),r=i=>mo(fo(uo(i),t)),o=Math.sqrt(Math.abs(t[0]*t[3]-t[1]*t[2])),{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*o,path:i=>n(e.path(i)),angle:i=>{let s=e.angle(i),c=Math.cos(s),d=Math.sin(s);return Math.atan2(t[1]*c+t[3]*d,t[0]*c+t[2]*d)},slice:(i,s)=>r(e.slice(i,s)),thickness:e.thickness*o,outline:{d:r(a.d),closed:a.closed,sample:i=>a.sample(i).map(n)},bounds:Qn(t,e.bounds),center:n(e.center),pivot:n(e.pivot),...e.segments===void 0?{}:{segments:e.segments.map(i=>Ta(i,t))}}}function Fs(){let e;return{done:new Promise(n=>{e=n}),settle:e}}function Xd(e,t){if(typeof e!="object"||e===null)return!1;let n=e,r=n.element;return["marks","labels","focus","leave","destroy"].every(o=>typeof n[o]=="function")&&r?.nodeType===1&&t.contains(r)}function Qd(e){if(typeof e!="object"||e===null)throw new TypeError("chartSwitch needs options.");let{views:t,initial:n,transition:r,announce:o}=e;if(typeof t!="object"||t===null)throw new 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 new TypeError("chartSwitch needs at least one view.");for(let i of a)if(typeof t[i]!="function")throw new TypeError(`chartSwitch: views.${i} must be a function that draws the view's chart in the container it's given.`);if(typeof n!="string"||!a.includes(n))throw new TypeError(`chartSwitch: initial must be one of the views (${a.map(i=>JSON.stringify(i)).join(", ")}), got ${typeof n=="string"?JSON.stringify(n):String(n)}.`);if(!Ea(r))throw new TypeError("chartSwitch: transition must be a transition effect, such as morph().");if(o!==void 0&&typeof o!="boolean")throw new TypeError("chartSwitch: announce must be true or false.");return a}var Bs=["presentation","analysis","off"],eu={presentation:"Presentation",analysis:"Analysis",off:"Off"},tu={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."},nu=0;function Ca(e,t,n={}){let r=ru(e);ou(t),au(n);let o={...eu,...n.labels},a={...tu,...n.hints},{persist:i}=n,s=r.ownerDocument;gt(s);let c=`ec-motion-${++nu}`,d=s.createElement("div");d.className="ec-motion-switch",d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${c}-label`),d.setAttribute("aria-describedby",`${c}-hint`);let l=d.appendChild(s.createElement("span"));l.className="ec-motion-label",l.id=`${c}-label`,l.textContent=n.label??"Motion";let u=d.appendChild(s.createElement("span"));u.className="ec-motion-modes";let f=Bs.map(F=>{let P=u.appendChild(s.createElement("button"));return P.type="button",P.dataset.mode=F,P.textContent=o[F],P.addEventListener("click",()=>t.chooseMode(F)),P}),h=d.appendChild(s.createElement("span"));h.className="ec-motion-hint",h.id=`${c}-hint`,h.setAttribute("aria-live","polite");let w=()=>{let F=t.mode;for(let P of f)P.setAttribute("aria-pressed",String(P.dataset.mode===F));h.textContent=t.prefersReduced&&t.viewerChoice===void 0?a.reduced:a[F]};if(i!==void 0){let F=Hs(s,P=>P.getItem(i));Bs.includes(F)&&t.chooseMode(F)}w(),r.appendChild(d);let v=t.subscribe(()=>{if(w(),i===void 0)return;let F=t.viewerChoice;Hs(s,P=>F===void 0?P.removeItem(i):P.setItem(i,F))}),D=!1;return{element:d,destroy(){D||(D=!0,v(),d.remove())}}}function Hs(e,t){try{let n=e.defaultView?.localStorage;return n?t(n):void 0}catch{return}}function ru(e){if(typeof e=="string"){let t=typeof document>"u"?null:document.querySelector(e);if(!t)throw new TypeError(`motionSwitch: no element matches "${e}".`);return t}if(typeof e!="object"||e===null||typeof e.appendChild!="function")throw new TypeError("motionSwitch needs an element or a selector to build the switch in.");return e}function ou(e){if(typeof e!="object"||e===null||typeof e.chooseMode!="function"||typeof e.subscribe!="function")throw new TypeError("motionSwitch needs a Motion, such as the page-wide `motion` or one from createMotion().")}function au(e){let{label:t,labels:n,hints:r,persist:o}=e;if(t!==void 0&&typeof t!="string")throw new TypeError(`motionSwitch: label must be a string, got ${typeof t}.`);for(let[a,i]of[["labels",n],["hints",r]])if(i!==void 0){for(let[s,c]of Object.entries(i))if(typeof c!="string")throw new TypeError(`motionSwitch: ${a}.${s} must be a string, got ${typeof c}.`)}if(o!==void 0&&(typeof o!="string"||o===""))throw new TypeError(`motionSwitch: persist must be a localStorage key, got ${JSON.stringify(o)??String(o)}.`)}var iu={play:"Play",pause:"Pause"};function La(e,t,n={}){let r=su(e);cu(t),lu(n);let o={...iu,...n.labels},a=r.ownerDocument;gt(a);let i=a.createElement("button");i.type="button",i.className="ec-play",i.addEventListener("click",()=>t.playing?t.pause():t.play());let s=()=>{let l=t.playing?o.pause:o.play;i.textContent!==l&&(i.textContent=l)};s(),r.appendChild(i);let c=t.subscribe(s),d=!1;return{element:i,destroy(){d||(d=!0,c(),i.remove())}}}function su(e){if(typeof e=="string"){let t=typeof document>"u"?null:document.querySelector(e);if(!t)throw new TypeError(`playButton: no element matches "${e}".`);return t}if(typeof e!="object"||e===null||typeof e.appendChild!="function")throw new TypeError("playButton needs an element or a selector to build the button in.");return e}function cu(e){if(typeof e!="object"||e===null||typeof e.play!="function"||typeof e.pause!="function"||typeof e.subscribe!="function")throw new TypeError("playButton needs a Playback, from playback().")}function lu(e){let{labels:t}=e;if(t!==void 0){for(let[n,r]of Object.entries(t))if(typeof r!="string"||r.trim()==="")throw new TypeError(`playButton: labels.${n} must be a string with some text, got ${JSON.stringify(r)??String(r)}.`)}}var du=Object.freeze({lift:0,spin:0,tilt:0});function uu(){return e=>({lift:0,spin:e.distance/e.radius,tilt:0})}function fu(e={}){let t=e.stride??42,n=e.lift??3.2,r=e.tilt??9;if(!(t>0)||!Number.isFinite(t))throw new RangeError(`gaits.step: stride must be more than 0, got ${t}.`);if(!(n>=0)||!Number.isFinite(n))throw new RangeError(`gaits.step: lift can't be negative, got ${n}.`);if(!Number.isFinite(r))throw new RangeError(`gaits.step: tilt must be a finite number of degrees, got ${r}.`);let o=r*Math.PI/180;return Object.assign(i=>{let s=Math.max(1,Math.round(i.length/t)),c=Math.abs(Math.sin(Math.PI*(i.progress*s%1)));return{lift:c*n,spin:0,tilt:c*o*(1-.3*i.progress)}},{ease:nt,pace:1.15})}function mu(){return()=>du}var Tr={roll:uu,step:fu,slide:mu};var yu=360,pu=260,hu=4e3,gu=.5,bu=.85,wu=2,vu=[1,0,0,1,0,0],ku=["auto","follow","level"],xu=["center","on"];function js(e,t={}){Tu(e,t);function n(o,a){let i=typeof e=="string"?a.icons.get(e):e;if(!i)throw new RangeError(`travel: unknown icon "${String(e)}". Register it with registerIcon(icon), or pass the icon itself.`);let s=Su(o,t.along);if(!s||!(s.length>=gu))return;let c=t.size===void 0?1:t.size==="fit"?bu*s.thickness/i.box.height:t.size/i.size;if(c>0)return Mu(s,i,c,t)}function r(o,a){let i=n(o,a),s,c,d=0,l=()=>{if(!i){s?.remove(),s=c=void 0;return}(!s||c?.icon!==i.icon||c.size!==i.size)&&(s?.remove(),s=a.layer.icon(i.icon,{size:i.size}),c={icon:i.icon,size:i.size}),s.place(i.transform(d))};return a.onChange(u=>{i=n(u,a),l()}),{get trip(){return i},show(u){d=u,l()}}}return{kind:"geometry",async run(o,a){if(a.signal.aborted)return;let i=r(o,a),s=i.trip;if(!s||s.span<=0){i.show(1);return}await a.tween({duration:s.duration,timing:"effect",ease:s.gait.ease??It,update:c=>i.show(c)}).finished},end(o,a){r(o,a).show(1)},clear(){}}}function Mu(e,t,n,r){let o=typeof r.gait=="function"?r.gait:Tr[r.gait??t.gait??"slide"](),a=e.length,i=t.footprint[0]*n,s=t.footprint[1]*n,c=Math.max(0,a-i-s),d=Math.max(wu,(i+s)/2),l=t.radius??t.box.height/2,{anchor:u}=t,f={x:u.x+n*(t.pivot.x-u.x),y:u.y+n*(t.pivot.y-u.y)},h=r.ride==="on"?e.thickness/2+(t.box.y+t.box.height-u.y)*n:0,w=r.orient??"auto";return{icon:t,size:t.size*n,span:c,duration:Math.min(hu,Math.max(pu,c/yu*1e3)*(o.pace??1)),gait:o,transform(v){let D=i+v*c,F=o({distance:v*c/n,length:c/n,progress:v,radius:l}),P=Eu(e,D),V=Du(e,Math.min(D,a),d),x=w==="auto"&&t.upright===!0&&Math.cos(V)<-1e-9,R=w==="level"?0:x?sr(V-Math.PI):V;return xe.multiply(xe.translate(P.x,P.y),xe.rotate(R),x?xe.scale(-1,1):vu,xe.translate(-u.x,-u.y-F.lift*n-h),xe.rotate(F.spin-F.tilt,f))}}}function Su(e,t){return t===void 0?e:e.segments?e.segments.find(n=>n.series===t):e.series===t?e:void 0}function Eu(e,t){let{length:n}=e;return t<=n?e.path(t/n):rn(e.end,e.angle(1),t-n)}function Du(e,t,n){let{length:r}=e,o=Math.min(n,t,r-t);if(o>1e-6){let a=e.path((t-o)/r),i=e.path((t+o)/r);if(Math.hypot(i.x-a.x,i.y-a.y)>1e-9)return Math.atan2(i.y-a.y,i.x-a.x)}return e.angle(t/r)}function Tu(e,t){if(!(typeof e=="string"&&e!=="")&&(typeof e!="object"||e===null||typeof e.name!="string"))throw new TypeError(`travel needs an icon or an icon's name, got ${e===null?"null":typeof e}.`);let{along:r,gait:o,size:a,orient:i,ride:s}=t;if(r!==void 0&&typeof r!="string")throw new RangeError(`travel: along must be a series name, got ${String(r)}.`);if(o!==void 0&&typeof o!="function"&&!Object.prototype.hasOwnProperty.call(Tr,o))throw new RangeError(`travel: gait must be a gait or one of roll, step, slide, got ${String(o)}.`);if(a!==void 0&&a!=="fit"&&!(typeof a=="number"&&a>0&&Number.isFinite(a)))throw new RangeError(`travel: size must be more than 0 px, or "fit", got ${String(a)}.`);if(i!==void 0&&!ku.includes(i))throw new RangeError(`travel: orient must be auto, follow or level, got ${String(i)}.`);if(s!==void 0&&!xu.includes(s))throw new RangeError(`travel: ride must be center or on, got ${String(s)}.`)}var Ru=900,po=.25,Cu=8,Lu=.35;function ho(e={}){Ou(e);let t=e.width??Cu,n=e.opacity??Lu,{color:r}=e,o=(a,i)=>{let s=t*Pu(i);a.mark.set({halo:s>0?{width:s,opacity:n,...r===void 0?{}:{color:r}}:void 0})};return{kind:"geometry",async run(a,i){i.signal.aborted||await i.tween({duration:Ru,timing:"effect",ease:yt,update:s=>o(i,s)}).finished},end(){},clear(){}}}function Pu(e){return!(e>0)||e>=1?0:e<po?zs(e/po):1-zs((e-po)/(1-po))}function zs(e){if(!(e>0))return 0;if(e>=1)return 1;let t=0,n=1;for(let o=0;o<24;o++){let a=(t+n)/2;1.74*a*a*(1-a)+a*a*a<e?t=a:n=a}let r=(t+n)/2;return 3*r*r-2*r*r*r}function Ou(e){let{width:t,opacity:n,color:r}=e;if(t!==void 0&&!(typeof t=="number"&&t>0&&Number.isFinite(t)))throw new RangeError(`flash: width must be more than 0 px, got ${String(t)}.`);if(n!==void 0&&!(typeof n=="number"&&n>0&&n<=1))throw new RangeError(`flash: opacity must be more than 0 and at most 1, got ${String(n)}.`);if(r!==void 0&&(typeof r!="string"||r===""))throw new RangeError(`flash: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}var Au=450,_s=[1,-.5,.25],Pa=3,$u=.5,Gu=64,Iu=Math.PI/12;function go(e={}){Nu(e);let t=e.swing??Pa;return{kind:"geometry",async run(n,r){if(r.signal.aborted)return;let o=n,a=Ks(n,t),i=0,s=()=>{let c=a*Vu(i);r.mark.set({transform:c===0?void 0:xe.rotate(c,o.pivot)})};r.onChange(c=>{o=c,a=Ks(c,t),s()}),await r.tween({duration:Au,timing:"effect",ease:yt,update:c=>{i=c,s()}}).finished},end(){},clear(){}}}function Ks(e,t){let{pivot:n}=e,r=0;for(let o of e.outline.sample(Gu))r=Math.max(r,Math.hypot(o.x-n.x,o.y-n.y));return r>=$u?Math.min(Iu,2*Math.asin(Math.min(1,t/(2*r)))):0}function Vu(e){if(!(e>0)||e>=1)return 0;let t=e*_s.length,n=Math.floor(t);return _s[n]*Math.sin(Math.PI*(t-n))}function Nu(e){let{swing:t}=e;if(t!==void 0&&!(typeof t=="number"&&t>0&&t<=Pa))throw new RangeError(`wiggle: swing must be more than 0 and at most ${Pa} px, got ${String(t)}.`)}var Us=600,Fu=2,Ws=6,Bu=12,Hu=.4,ju=5e3;function bo(e={}){zu(e);let t=e.times??Fu,n=e.width??Bu,{color:r}=e,o=(a,i)=>{let s=i>0&&i<1;a.mark.set({halo:s?{width:n*It(i),opacity:Hu*(1-i),...r===void 0?{}:{color:r}}:void 0})};return{kind:"geometry",async run(a,i){let s=0;for(let c=0;c<t;c++){if(i.signal.aborted)return;let d=i.motion.duration(Us,"effect");if(s+d>=ju)return;s+=d,await i.tween({duration:Us,timing:"effect",ease:yt,update:l=>o(i,l)}).finished}},end(){},clear(){}}}function zu(e){let{times:t,width:n,color:r}=e;if(t!==void 0&&!(Number.isInteger(t)&&t>=1&&t<=Ws))throw new RangeError(`pulse: times must be a whole number from 1 to ${Ws}, got ${String(t)}.`);if(n!==void 0&&!(typeof n=="number"&&n>0&&Number.isFinite(n)))throw new RangeError(`pulse: width must be more than 0 px, got ${String(n)}.`);if(r!==void 0&&(typeof r!="string"||r===""))throw new RangeError(`pulse: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}var _u=500,Ku=3,Uu=.5,Zs=.5;function qs(e={}){Wu(e);let t=e.duration??_u,n={stroke:e.color??"mark",width:e.width??Ku,opacity:e.opacity??Uu,linecap:"round"},r=(o,a)=>{let i=o,s=0,c,d=()=>{if(!(i.length>=Zs)){c?.remove(),c=void 0;return}let l=i.slice(0,s);c?c.update(l):c=a.layer.path(l,n)};return a.onChange(l=>{i=l,d()}),d(),l=>{s=l,d()}};return{kind:"geometry",async run(o,a){if(a.signal.aborted)return;let i=r(o,a);if(!(o.length>=Zs)){i(1);return}await a.tween({duration:t,timing:"effect",ease:nt,update:i}).finished},end(o,a){r(o,a)(1)},clear(){}}}function Wu(e){let{color:t,width:n,opacity:r,duration:o}=e;if(t!==void 0&&(typeof t!="string"||t===""))throw new 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 new RangeError(`trace: width must be 0 px or more, got ${String(n)}.`);if(r!==void 0&&!(typeof r=="number"&&r>=0&&r<=1))throw new RangeError(`trace: opacity must be from 0 to 1, got ${String(r)}.`);if(o!==void 0&&!(typeof o=="number"&&o>=0&&Number.isFinite(o)))throw new RangeError(`trace: duration must be 0 ms or more, got ${String(o)}.`)}var Zu=10,wo=6,qu=8,Ju=12.5,Oa=.36,Yu=.8;function Xu(e){let t=e.labelBounds??[],n=e.angle(1),r=Ys(e.end,n,t);if(r===void 0&&t.length>0){let o=e.angle(.5)-Math.PI/2,a=Ys(e.center,o,t);if(a!==void 0)return Js(e.center,o,a)}return Js(e.end,n,Math.max(Zu,r??-1/0))}function Js(e,t,n){let r=Math.cos(t),o=Math.sin(t),a=rn(e,t,n),i=Ju*(o<0?Oa*(1+o):Oa+(Yu-Oa)*o),s=Math.abs(r)<=Math.SQRT1_2+1e-9?"middle":r>0?"start":"end";return{at:{x:a.x,y:a.y+i},anchor:s,toward:t}}function Ys(e,t,n){let r=Math.cos(t),o=Math.sin(t),a;for(let{x:i,y:s,width:c,height:d}of n){let l={x:i-wo,y:s-wo,width:c+2*wo,height:d+2*wo},u=Qu(e,r,o,l);u!==void 0&&(a=Math.max(a??u,u))}return a}function Qu(e,t,n,r){let o=0,a=1/0;for(let[i,s,c,d]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(i<c||i>d)return;continue}let l=(c-i)/s,u=(d-i)/s;o=Math.max(o,Math.min(l,u)),a=Math.min(a,Math.max(l,u))}return a>=o?a:void 0}function nr(e,t,n,r,o){let a=e,i=o(e,t)??"",s=t,c=0,d,l=()=>{if(i===""){d?.remove(),d=void 0;return}let{at:u,anchor:f,toward:h}=Xu(a),w={at:rn(u,h-Math.PI/2,-qu*(1-c)),anchor:f,color:r,opacity:c};d?d.update(w,i):d=n.layer.text(i,w)};return n.onChange((u,f)=>{a=u,s=f??s,i=o(a,s)??"",l()}),l(),u=>{c=u,l()}}var ef=400,tf=1e-9,nf=e=>{let{samples:t}=e;return t[t.length-1]?.value??Number.NaN},Aa,rf=e=>(Aa??(Aa=new Intl.NumberFormat(void 0,{signDisplay:"always",maximumFractionDigits:2})),Aa.format(e));function Xs(e={}){of(e);let t=e.value??nf,n=e.format??rf,r=e.color??"text",o=a=>{if(!a.previous)return;let i=t(a),s=t(a.previous),c=i-s;if(!(!Number.isFinite(c)||Math.abs(c)<=tf*Math.max(Math.abs(i),Math.abs(s))))return n(c)};return{kind:"data",run:async(a,i,s)=>{if(s.signal.aborted)return;let c=o(i);if(c===void 0||c==="")return;let d=nr(a,i,s,r,()=>c);await s.tween({duration:ef,timing:"effect",update:d}).finished},end:(a,i,s)=>{let c=o(i);c!==void 0&&c!==""&&nr(a,i,s,r,()=>c)(1)},clear(){}}}function of(e){let{value:t,format:n,color:r}=e;if(t!==void 0&&typeof t!="function")throw new 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 new TypeError(`delta: format must be a function that words the change, got ${typeof n}.`);if(r!==void 0&&(typeof r!="string"||r===""))throw new RangeError(`delta: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}var af=400;function Qs(e,t={}){if(typeof e!="function")throw new 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 new RangeError(`label: color must be a theme token or a CSS colour, got ${JSON.stringify(n)??String(n)}.`);let r=(o,a)=>{let i=e(a,o);return i==null?void 0:String(i)};return{kind:"data",run:async(o,a,i)=>{if(i.signal.aborted)return;let s=nr(o,a,i,n,r);await i.tween({duration:af,timing:"effect",update:s}).finished},end:(o,a,i)=>nr(o,a,i,n,r)(1),clear(){}}}var sf=["below","above"];function tc(e){ff(e);let{compareTo:t}=e,n=e.when??"below",r=e.color??"negative",o=(a,i,s)=>{let c=[],d=i,l=u=>{let f=u.length>=.5?df(d.samples,cf(t,d),n):[],h={stroke:r,width:u.thickness,linecap:"butt"};f.forEach(([w,v],D)=>{let F=u.slice(w,v),P=c[D];P?P.update(F,h):c.push(s.layer.path(F,h))});for(let w of c.splice(f.length))w.remove()};s.onChange((u,f)=>{d=f??d,l(u)}),l(a)};return{kind:"data",...typeof t=="string"?{needs:Object.freeze({related:Object.freeze([t])})}:{},run:async(a,i,s)=>{s.signal.aborted||o(a,i,s)},end:(a,i,s)=>o(a,i,s),clear(){}}}function cf(e,t){if(typeof e=="number")return{place:i=>i.t,valueAt:()=>e,bends:[]};let n=t.related(e);if(!n)return;let o=t.samples.every(i=>$a(i.at)!==void 0)&&n.samples.every(i=>$a(i.at)!==void 0)?i=>$a(i.at):i=>i.t,a=n.samples.map(i=>({u:o(i),value:i.value})).filter(i=>Number.isFinite(i.u)).sort((i,s)=>i.u-s.u);return{place:o,valueAt:i=>lf(a,i),bends:a.map(i=>i.u)}}function $a(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 lf(e,t){let n=e[0],r=e[e.length-1];if(!n||!r||t<n.u||t>r.u)return;let o=0,a=e.length-1;for(;o<a;){let c=o+a>>1;e[c].u<t?o=c+1:a=c}let i=e[o];if(o===0||i.u===t)return i.value;let s=e[o-1];return s.value+(t-s.u)/(i.u-s.u)*(i.value-s.value)}function df(e,t,n){if(!t)return[];let r=n==="below"?1:-1,o=(c,d,l)=>{let u=t.valueAt(d);if(u===void 0||!Number.isFinite(u)||!Number.isFinite(l)||!Number.isFinite(c))return{t:c,past:void 0};let f=r*(u-l);return{t:c,past:Math.abs(f)<=1e-9*Math.max(Math.abs(u),Math.abs(l))?0:f}},a=[];e.forEach((c,d)=>{let l=t.place(c);a.push(o(c.t,l,c.value));let u=e[d+1];if(!u)return;let f=t.place(u);if(l===f||!Number.isFinite(l)||!Number.isFinite(f))return;let h=[],{bends:w}=t;for(let v=uf(w,Math.min(l,f));v<w.length&&w[v]<Math.max(l,f);v++)h.push((w[v]-l)/(f-l));f<l&&h.reverse();for(let v of h)a.push(o(c.t+v*(u.t-c.t),l+v*(f-l),c.value+v*(u.value-c.value)))});let i=[],s=(c,d)=>{let l=ec(c),u=ec(d);if(!(u>l))return;let f=i[i.length-1];f&&f[1]>=l?f[1]=Math.max(f[1],u):i.push([l,u])};for(let c=1;c<a.length;c++){let d=a[c-1],l=a[c];d.past===void 0||l.past===void 0||!(l.t>d.t)||(d.past>0&&l.past>0?s(d.t,l.t):d.past>0?s(d.t,d.t+(l.t-d.t)*(d.past/(d.past-l.past))):l.past>0&&s(d.t+(l.t-d.t)*(d.past/(d.past-l.past)),l.t))}return i}var ec=e=>Math.min(1,Math.max(0,e));function uf(e,t){let n=0,r=e.length;for(;n<r;){let o=n+r>>1;e[o]<=t?n=o+1:r=o}return n}function ff(e){let{compareTo:t,when:n,color:r}=e??{};if(!(typeof t=="string"?t!=="":typeof t=="number"&&Number.isFinite(t)))throw new RangeError(`threshold: compareTo must be a finite number or a series name, got ${Ga(t)}.`);if(n!==void 0&&!sf.includes(n))throw new RangeError(`threshold: when must be "below" or "above", got ${Ga(n)}.`);if(r!==void 0&&(typeof r!="string"||r===""))throw new RangeError(`threshold: color must be a theme token or a CSS colour, got ${Ga(r)}.`)}var Ga=e=>typeof e=="string"?JSON.stringify(e):String(e);var mf=950,yf=160,pf=["unroll","drop"];function vo(e={}){vf(e);let t=e?.points??yf,n=e?.align??"unroll";return{kind:"transition",async run(r,o,a){if(a.signal.aborted)return;let i=nc(r,o,a.layer,t,n),s=wf(a.start);if(s>=1){i(1);return}let c=Lr(s),d;d=a.tween({duration:mf,timing:"transition",ease:yt,update:l=>{let u=Math.min(1,c+l);i(l===0?s:nt(u)),u>=1&&l<1&&d?.finish()}}),await d.finished},end(r,o,a){nc(r,o,a.layer,t,n)(1)},clear(){}}}function nc(e,t,n,r,o){let a=e.outline.closed;if(a!==t.outline.closed)return gf(e,t,n);let i=e.outline.sample(r),s=t.outline.sample(r);if(!a)return hf(e,t,n,i,s);let[c,d]=o==="drop"?bf(e,t,r):[0,0],l;return u=>{let f=u<=0?e.outline.d:u>=1?t.outline.d:rc(i,s,c,d,u,!0);l?l.update(f):l=n.path(f,{fill:"mark"})}}function hf(e,t,n,r,o){let a;return i=>{let s=i<=0?e.outline.d:i>=1?t.outline.d:rc(r,o,0,0,i,!1),c=i<=0?e.thickness:i>=1?t.thickness:Ia(e.thickness,t.thickness,i);a?a.update(s,{width:c}):a=n.path(s,{stroke:"mark",width:c})}}function gf(e,t,n){let r=(i,s)=>({...i.outline.closed?{fill:"mark"}:{stroke:"mark",width:i.thickness},...s===void 0?{}:{opacity:s}}),o,a;return i=>{if(i>=1){o?.remove(),o=void 0,a?a.update(t.outline.d,{opacity:void 0}):a=n.path(t.outline.d,r(t));return}a?(o?.update(e.outline.d,{opacity:1-i}),a.update(t.outline.d,{opacity:i})):e.outline.closed?(o=n.path(e.outline.d,r(e,1-i)),a=n.path(t.outline.d,r(t,i))):(a=n.path(t.outline.d,r(t,i)),o=n.path(e.outline.d,r(e,1-i)))}}function rc(e,t,n,r,o,a){let i=e.length,s="";for(let c=0;c<i;c++){let d=e[(c+n)%i],l=t[(c+r)%i];s+=`${c===0?"M":"L"}${Ze(Ia(d.x,l.x,o))},${Ze(Ia(d.y,l.y,o))}`}return a?`${s}Z`:s}var Ia=(e,t,n)=>e*(1-n)+t*n;function bf(e,t,n){let r=n/4,o=kr(e);return o===kr(t)?[0,0]:o?[0,r]:[r,0]}function wf(e){return typeof e=="number"&&e>0?Math.min(1,e):0}function vf(e){let{points:t,align:n}=e??{};if(t!==void 0&&!(Number.isInteger(t)&&t>=4&&t%4===0))throw new RangeError(`morph: points must be a whole multiple of 4, got ${String(t)}.`);if(n!==void 0&&!pf.includes(n))throw new RangeError(`morph: align must be "unroll" or "drop", got ${typeof n=="string"?JSON.stringify(n):String(n)}.`)}function oc(...e){let t=ko("sequence",e);return lc(t,async(n,r)=>{for(let o of t){if(r.signal.aborted)return;await n(o)}})}function ac(...e){let t=ko("parallel",e);return lc(t,async n=>{await Promise.all(t.map(n))})}function ic(e,t){if(typeof e!="string"&&typeof e!="function")throw new TypeError(`only needs a key, a series name or a predicate, got ${ur(e)}.`);let[n]=ko("only",[t]),r=typeof e=="string"?i=>i.key===e||i.series===e:e;if(n.kind==="data"){let i=n;return{kind:"data",...i.needs?{needs:i.needs}:{},run:(c,d,l)=>r(c)?i.run(c,d,l):Promise.resolve(),end:(c,d,l)=>{r(c)&&i.end(c,d,l)},clear:c=>i.clear(c)}}let o=n;return{kind:"geometry",run:(i,s)=>r(i)?o.run(i,s):Promise.resolve(),end(i,s){r(i)&&o.end(i,s)},clear:i=>o.clear(i)}}var kf=50,xf=500;function sc(e,t={}){let[n]=ko("stagger",[e]),r=t.delay??kf;if(!(typeof r=="number"&&r>=0&&Number.isFinite(r)))throw new RangeError(`stagger: delay must be 0 ms or more, got ${String(r)}.`);let o=async(s,c,d)=>{if(d.signal.aborted)return;let{index:l,count:u}=d.batch,f=u>1?Math.min(r,xf/(u-1)):0,h=l>0?l*f:0;if(!(h>0))return{mark:s,data:c};let w=cc(s,c,d);return await d.tween({duration:h,timing:"stagger",update:()=>{}}).finished,d.signal.aborted?void 0:w()};if(n.kind==="data"){let s=n;return{kind:"data",...s.needs?{needs:s.needs}:{},run:async(d,l,u)=>{let f=await o(d,l,u);f&&await s.run(f.mark,f.data,u)},end:(d,l,u)=>s.end(d,l,u),clear:d=>s.clear(d)}}let a=n;return{kind:"geometry",async run(s,c){let d=await o(s,void 0,c);d&&await a.run(d.mark,c)},end:(s,c)=>a.end(s,c),clear:s=>a.clear(s)}}function cc(e,t,n){let r={mark:e,data:t};return n.onChange((o,a)=>{r={mark:o,data:a??r.data}}),()=>r}function lc(e,t){let n=(i,s,c)=>{let d=cc(i,s,c);return l=>{let{mark:u,data:f}=d();return l.kind==="data"?l.run(u,f,c):l.run(u,c)}},r=(i,s,c)=>{for(let d of e)d.kind==="data"?d.end(i,s,c):d.end(i,c)},o=i=>{let s;for(let c of e)try{c.clear(i)}catch(d){s??(s={error:d})}if(s)throw s.error};if(e.some(i=>i.kind==="data")){let i=[...new Set(e.flatMap(c=>c.kind==="data"?c.needs?.related??[]:[]))];return{kind:"data",...i.length>0?{needs:{related:i}}:{},run:(c,d,l)=>t(n(c,d,l),l),end:(c,d,l)=>r(c,d,l),clear:o}}return{kind:"geometry",run:(i,s)=>t(n(i,void 0,s),s),end:(i,s)=>r(i,void 0,s),clear:o}}function ko(e,t){return t.forEach((n,r)=>{if(!Ir(n))throw new TypeError(`${e}: part ${r+1} needs to be a mark effect (kind "geometry" or "data"), got ${ur(n)}.`)}),[...t]}var dc=()=>{};function uc(e){mc("defineEffect",e);let t={kind:"geometry",run:e.run,end:e.end,clear:e.clear??dc};return Object.freeze(t)}function fc(e){mc("defineDataEffect",e);let t=Mf(e.needs),n={kind:"data",...t?{needs:t}:{},run:e.run,end:e.end,clear:e.clear??dc};return Object.freeze(n)}function mc(e,t){if(typeof t!="object"||t===null)throw new TypeError(`${e} needs a spec object { run, end }, got ${t===null?"null":typeof t}.`);let{run:n,end:r,clear:o}=t;if(typeof n!="function")throw new TypeError(`${e}: run must be a function that animates the mark, got ${typeof n}.`);if(typeof r!="function")throw new 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(o!==void 0&&typeof o!="function")throw new TypeError(`${e}: clear must be a function if it's given, got ${typeof o}.`)}function Mf(e){if(e===void 0)return;let t=typeof e=="object"&&e!==null?e.related:void 0;if(!(typeof e=="object"&&e!==null&&(t===void 0||Array.isArray(t)&&t.every(r=>typeof r=="string"&&r!==""))))throw new 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])})}var Sf=["roll","step","slide"],Ef=["butt","round"],Df=["miter","round"],yc=/^\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE.,+\-\s]*$/;function yn(e){let t=e?.name;if(typeof t!="string"||t==="")throw new TypeError(`defineIcon needs a non-empty string name, got ${JSON.stringify(t)}.`);let n=(w,v)=>{throw new RangeError(`defineIcon: "${t}" ${w} ${v}.`)},r=(w,v)=>typeof v=="number"&&Number.isFinite(v)?v:n(w,`must be a finite number, got ${String(v)}`),o=(w,v)=>r(w,v)>0?v:n(w,`must be more than 0, got ${String(v)}`),a=(w,v)=>v&&typeof v=="object"?rr({x:r(`${w}.x`,v.x),y:r(`${w}.y`,v.y)}):n(w,"must be a point { x, y }");(!Array.isArray(e.shapes)||e.shapes.length===0)&&n("shapes","must be a non-empty array");let i=e.shapes.map((w,v)=>Tf(w,`shapes[${v}]`,n,r)),s=e.box;(!s||typeof s!="object")&&n("box","must be a rectangle { x, y, width, height }");let c=rr({x:r("box.x",s.x),y:r("box.y",s.y),width:o("box.width",s.width),height:o("box.height",s.height)}),d=a("anchor",e.anchor),l=e.pivot===void 0?d:a("pivot",e.pivot),u=e.footprint??[Math.max(0,d.x-c.x),Math.max(0,c.x+c.width-d.x)];(!Array.isArray(u)||u.length!==2)&&n("footprint","must be [behind, ahead]"),u.forEach((w,v)=>{r(`footprint[${v}]`,w)<0&&n(`footprint[${v}]`,`can't be negative, got ${w}`)});let f=e.size===void 0?c.width:o("size",e.size),h=e.radius===void 0?c.height/2:o("radius",e.radius);return e.gait!==void 0&&!Sf.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)}`),rr({name:t,shapes:rr(i),box:c,size:f,anchor:d,pivot:l,footprint:rr([u[0],u[1]]),...e.gait!==void 0?{gait:e.gait}:{},radius:h,...e.upright!==void 0?{upright:e.upright}:{}})}function Tf(e,t,n,r){(!e||typeof e!="object")&&n(t,"must be a shape { d, fill?, stroke?, \u2026 }"),(typeof e.d!="string"||!yc.test(e.d))&&n(`${t}.d`,"must be path data starting with a move"),e.clip!==void 0&&(typeof e.clip!="string"||!yc.test(e.clip))&&n(`${t}.clip`,"must be path data starting with a move");for(let a of["fill","stroke"]){let i=e[a];i!==void 0&&(typeof i!="string"||i==="")&&n(`${t}.${a}`,`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&&!Ef.includes(e.linecap)&&n(`${t}.linecap`,`must be butt or round, got ${String(e.linecap)}`),e.linejoin!==void 0&&!Df.includes(e.linejoin)&&n(`${t}.linejoin`,`must be miter or round, got ${String(e.linejoin)}`);let o={d:e.d};for(let a of["fill","stroke","width","linecap","linejoin","clip"])e[a]!==void 0&&(o[a]=e[a]);return rr(o)}var rr=e=>Object.freeze(e);var Rf=new Set(["svg","g","a"]),Cf=new Set(["path","circle","rect","ellipse","line","polyline","polygon"]),Lf=/<![^<>]*>|<(\/?)([A-Za-z][\w:.-]*)((?:\s+[^\s=/<>]+(?:\s*=\s*(?:"[^"<]*"|'[^'<]*'|[^\s"'<>]+))?)*)\s*(\/?)>/g,Pf=/([^\s=/<>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,Of=/^(?:#[0-9a-fA-F]{3,8}|[a-zA-Z][a-zA-Z0-9-]*|(?:rgba?|hsla?)\([\d\s.,%+\-/]*\))$/;function gc(e,t){if(typeof e!="string")throw new TypeError("iconFromSvg needs SVG markup as a string.");let n=typeof t?.name=="string"?`"${t.name}"`:"an icon",r=u=>{throw new RangeError(`iconFromSvg: ${n} ${u}.`)},o,a=1,i=[],s=[],c;for(let u of Af(e).matchAll(Lf)){let[,f,h,w="",v]=u;if(h===void 0)continue;let D=h.toLowerCase();if(f){let R=Hf(s,D);R>=0&&(s.length=R);continue}let F=$f(w),P=!o&&D==="svg";P&&(o=Gf(F)??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/o.width),c={fill:"#000000",stroke:"none",width:1,linecap:void 0,linejoin:void 0,transform:xe.scale(a)});let V=s.length>0?s[s.length-1].state:P?c:void 0,x=V&&!If(F)?Vf(V,F):void 0;if(x&&Cf.has(D)){let R=Nf(D,F,x);R&&i.push(R)}v||s.push({tag:D,state:Rf.has(D)?x:void 0})}o||r("needs an <svg> element"),i.length===0&&r("has nothing to draw: no path, circle, rect, ellipse, line, polyline or polygon with a fill or stroke");let d={x:o.x*a,y:o.y*a,width:o.width*a,height:o.height*a},l=u=>u&&typeof u=="object"?{x:u.x*a,y:u.y*a}:u;return yn({...t,shapes:i,box:d,anchor:l(t.anchor),...t.pivot?{pivot:l(t.pivot)}:{},...Array.isArray(t.footprint)?{footprint:[t.footprint[0]*a,t.footprint[1]*a]}:{},...typeof t.radius=="number"?{radius:t.radius*a}:{}})}function Af(e){let t=[["<!--","-->"],["<![CDATA[","]]>"],["<?","?>"]],n=t.map(([a])=>e.indexOf(a)),r="",o=0;for(;;){let a=-1;if(n.forEach((d,l)=>{d>=0&&(a<0||d<n[a])&&(a=l)}),a<0)return r+e.slice(o);let i=n[a],s=t[a][1];r+=e.slice(o,i);let c=e.indexOf(s,i+t[a][0].length);if(c<0)return r;o=c+s.length,n.forEach((d,l)=>{d>=0&&d<o&&(n[l]=e.indexOf(t[l][0],o))})}}function $f(e){let t=new Map;for(let[,n,r,o,a]of e.matchAll(Pf))n!==void 0&&t.set(n,r??o??a??"");for(let n of(t.get("style")??"").split(";")){let r=n.indexOf(":");r>0&&t.set(n.slice(0,r).trim(),n.slice(r+1).replace(/!important/i,"").trim())}return t}function Gf(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=pc(e.get("width")),r=pc(e.get("height"));return n!==void 0&&r!==void 0?{x:0,y:0,width:n,height:r}:void 0}function pc(e){let t=/^\s*(\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 If(e){return e.get("display")?.trim()==="none"||e.get("visibility")?.trim()==="hidden"}function Vf(e,t){let n=(s,c)=>{let d=t.get(s)?.trim();if(d===void 0||!Of.test(d))return c;let l=d.toLowerCase();return l==="inherit"?c:l==="currentcolor"?"text":l==="none"?l:d},r=Number.parseFloat(t.get("stroke-width")??""),o=t.get("stroke-linecap")?.trim(),a=t.get("stroke-linejoin")?.trim(),i=t.get("transform");return{fill:n("fill",e.fill),stroke:n("stroke",e.stroke),width:r>=0?r:e.width,linecap:o==="butt"||o==="round"?o:e.linecap,linejoin:a==="miter"||a==="round"?a:e.linejoin,transform:i?xe.multiply(e.transform,lr(i)):e.transform}}function Nf(e,t,n){let r=n.fill==="none"?void 0:n.fill,o=n.stroke==="none"||!(n.width>0)?void 0:n.stroke;if(r===void 0&&o===void 0)return;let a=Ff(e,t);if(!a.some(s=>s.op!=="M"))return;let i=n.transform;return{d:mo(fo(a,i)),...r!==void 0?{fill:r}:{},...o!==void 0?{stroke:o,width:jf(n.width*Math.sqrt(Math.abs(i[0]*i[3]-i[1]*i[2]))),...n.linecap?{linecap:n.linecap}:{},...n.linejoin?{linejoin:n.linejoin}:{}}:{}}}function Ff(e,t){let n=r=>{let o=Number.parseFloat(t.get(r)??"");return Number.isFinite(o)?o:0};switch(e){case"path":return uo(t.get("d")??"");case"circle":return hc(n("cx"),n("cy"),n("r"),n("r"));case"ellipse":return hc(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 r=(t.get("points")??"").trim().split(/[\s,]+/).filter(Boolean).map(Number),o=[];for(let i=0;i+1<r.length&&Number.isFinite(r[i])&&Number.isFinite(r[i+1]);i+=2)o.push({x:r[i],y:r[i+1]});if(o.length<2)return[];let a=o.map((i,s)=>({op:s===0?"M":"L",to:i}));return e==="polygon"?[...a,{op:"Z",to:o[0]}]:a}case"rect":return Bf(n("x"),n("y"),n("width"),n("height"),t);default:return[]}}function hc(e,t,n,r){if(!(n>0&&r>0))return[];let o=a=>({op:"A",rx:n,ry:r,rotation:0,large:!1,sweep:!0,to:{x:a,y:t}});return[{op:"M",to:{x:e+n,y:t}},o(e-n),o(e+n),{op:"Z",to:{x:e+n,y:t}}]}function Bf(e,t,n,r,o){if(!(n>0&&r>0))return[];let a=l=>{let u=Number.parseFloat(o.get(l)??"");return u>=0?u:void 0},i=Math.min(a("rx")??a("ry")??0,n/2),s=Math.min(a("ry")??a("rx")??0,r/2),c=(l,u)=>({op:"L",to:{x:l,y:u}});if(!(i>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 d=(l,u)=>({op:"A",rx:i,ry:s,rotation:0,large:!1,sweep:!0,to:{x:l,y:u}});return[{op:"M",to:{x:e+i,y:t}},c(e+n-i,t),d(e+n,t+s),c(e+n,t+r-s),d(e+n-i,t+r),c(e+i,t+r),d(e,t+r-s),c(e,t+s),d(e+i,t),{op:"Z",to:{x:e+i,y:t}}]}function Hf(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].tag===t)return n;return-1}var jf=e=>Math.round(e*1e3)/1e3;var zf=yn({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}}),_f=yn({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}}),Kf=yn({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}}),xo=Object.freeze({dot:zf,arrow:_f,chevron:Kf});var Va=Lo({kind:"preset",entries:{flash:()=>ho(),wiggle:()=>go(),pulse:()=>bo()},hint:"Register custom presets with registerPreset(name, factory)."}),Na=Lo({kind:"icon",entries:xo,hint:"Register icons with registerIcon(icon) or registerIcons(icons)."});function bc(e,t){if(typeof t!="function")throw new TypeError(`registerPreset("${e}") needs a function that returns an effect.`);Va.register(e,t)}function Fa(e){if(typeof e!="object"||e===null||typeof e.name!="string")throw new TypeError("registerIcon needs an icon with a name.");Na.register(e.name,e)}function wc(e){for(let t of e)Fa(t)}function vc(e){if(typeof e!="object"||e===null)throw new TypeError("configure needs an options object.");if("nonce"in e){if(e.nonce!==void 0&&(typeof e.nonce!="string"||e.nonce===""))throw new TypeError("configure: nonce must be a non-empty string.");hn.nonce=e.nonce}if("injectStyles"in e){if(e.injectStyles!==void 0&&typeof e.injectStyles!="boolean")throw new TypeError("configure: injectStyles must be true or false.");hn.injectStyles=e.injectStyles}}var Uf="0.2.0",or={presets:Va,icons:Na,motion:kt};function Wf(e,t){return Zo(e,t,or)}function Zf(e,t){return oa(e,t,or)}function qf(e,t){return ga(e,t,or)}function Jf(e,t){let n=typeof t=="object"&&t!==null&&t.transition===void 0?{...t,transition:vo()}:t;return Ra(e,n,or)}function Yf(e,t){return er(e,t,or)}function Xf(e,t){return lo(e,t,or)}function Qf(e,t=kt,n){return Ca(e,t,n)}return Rc(em);})();
93
93
  //# sourceMappingURL=expressive-charts.global.js.map