expressive-charts 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/README.md +7 -7
  3. package/dist/define-DeZLs1h7.js +95 -0
  4. package/dist/define-DeZLs1h7.js.map +1 -0
  5. package/dist/drawing-Ypmq-2h6.d.cts +214 -0
  6. package/dist/drawing-Ypmq-2h6.d.ts +214 -0
  7. package/dist/effect-C786hGyJ.d.cts +232 -0
  8. package/dist/effect-CMo-2gPf.d.ts +232 -0
  9. package/dist/expressive-charts.css +5 -2
  10. package/dist/expressive-charts.css.d.cts +1 -2
  11. package/dist/expressive-charts.css.d.ts +1 -2
  12. package/dist/expressive-charts.global.js +47 -48
  13. package/dist/expressive-charts.global.js.map +1 -1
  14. package/dist/icons/sport.cjs +211 -156
  15. package/dist/icons/sport.cjs.map +1 -1
  16. package/dist/icons/sport.d.cts +5 -7
  17. package/dist/icons/sport.d.ts +5 -7
  18. package/dist/icons/sport.js +122 -71
  19. package/dist/icons/sport.js.map +1 -1
  20. package/dist/index.cjs +13203 -9982
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +953 -871
  23. package/dist/index.d.ts +953 -871
  24. package/dist/index.js +11000 -8234
  25. package/dist/index.js.map +1 -1
  26. package/dist/path-data-DnEckjY8.js +123 -0
  27. package/dist/path-data-DnEckjY8.js.map +1 -0
  28. package/dist/testing.cjs +2047 -1255
  29. package/dist/testing.cjs.map +1 -1
  30. package/dist/testing.d.cts +135 -139
  31. package/dist/testing.d.ts +135 -139
  32. package/dist/testing.js +696 -499
  33. package/dist/testing.js.map +1 -1
  34. package/dist/transition-Bu1NsQor.js +2067 -0
  35. package/dist/transition-Bu1NsQor.js.map +1 -0
  36. package/package.json +6 -6
  37. package/dist/chunk-7A7LXXT4.js +0 -70
  38. package/dist/chunk-7A7LXXT4.js.map +0 -1
  39. package/dist/chunk-CJUQHEX6.js +0 -618
  40. package/dist/chunk-CJUQHEX6.js.map +0 -1
  41. package/dist/chunk-N2BLUETM.js +0 -1194
  42. package/dist/chunk-N2BLUETM.js.map +0 -1
  43. package/dist/drawing-CdTgixMY.d.cts +0 -206
  44. package/dist/drawing-CdTgixMY.d.ts +0 -206
  45. package/dist/effect-Bu3MHHeg.d.ts +0 -247
  46. package/dist/effect-D4vmdYP4.d.cts +0 -247
@@ -1,98 +1,97 @@
1
- "use strict";var ExpressiveCharts=(()=>{var To=Object.defineProperty;var Bc=Object.getOwnPropertyDescriptor;var Hc=Object.getOwnPropertyNames;var jc=Object.prototype.hasOwnProperty;var zc=(e,t)=>{for(var n in t)To(e,n,{get:t[n],enumerable:!0})},_c=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Hc(t))!jc.call(e,o)&&o!==n&&To(e,o,{get:()=>t[o],enumerable:!(r=Bc(t,o))||r.enumerable});return e};var Kc=e=>_c(To({},"__esModule",{value:!0}),e);var Pm={};zc(Pm,{VERSION:()=>Mm,animated:()=>He,barChart:()=>Sm,chartSwitch:()=>Tm,colorAssignment:()=>_r,configure:()=>Ic,createClock:()=>Pr,createMotion:()=>Co,defaultClock:()=>Be,defaultScaling:()=>cr,defineDataEffect:()=>Tc,defineEffect:()=>Dc,defineIcon:()=>yn,delta:()=>mc,describe:()=>Xe,donutChart:()=>Em,easeInOutCubic:()=>nt,easeOutCubic:()=>Ft,expressive:()=>Rm,flash:()=>wo,fromVegaView:()=>Cm,gaits:()=>Cr,iconFromSvg:()=>Ac,icons:()=>Eo,interpolateNumber:()=>st,interpolatePoint:()=>ei,interpolateRecord:()=>kt,label:()=>yc,lineChart:()=>Dm,linear:()=>mt,link:()=>Zo,manualClock:()=>Xa,matrix:()=>xe,mediaReducedMotion:()=>Lo,morph:()=>Mo,motion:()=>vt,motionSwitch:()=>Lm,offset:()=>on,only:()=>kc,parallel:()=>vc,playButton:()=>Na,playback:()=>ti,pulse:()=>ko,registerIcon:()=>Wa,registerIcons:()=>Gc,registerPreset:()=>$c,samplesAlong:()=>yr,scaleDuration:()=>lr,sequence:()=>wc,stagger:()=>xc,threshold:()=>hc,trace:()=>dc,travel:()=>nc,tween:()=>tn,wiggle:()=>vo});function Se(e){let t=globalThis.reportError;typeof t=="function"?t(e):console.error(e)}function Pr(e=Uc()){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 Xa(e=0){let t=e,n,r=Pr({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 Uc(){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 Be=Pr();var mt=e=>e,nt=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,Ft=e=>1-Math.pow(1-e,3);function Or(e){return e<.5?Math.cbrt(e/4):1-Math.cbrt(2*(1-e))/2}var cr={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}}},Qa=["presentation","analysis","off"],Ar=["feedback","transition","effect","playback","stagger"];function Co(e={}){let t=Ro(e.mode??"presentation"),n,r=Wc(e.scaling),o=e.reducedMotion??Lo(),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:lr(d,r[u][l])},setMode(d){Ro(d),d!==t&&(t=d,c())},chooseMode(d){Ro(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 lr(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 Lo(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 Ro(e){if(!Qa.includes(e))throw new TypeError(`Unknown motion mode "${String(e)}". Use one of: ${Qa.join(", ")}.`);return e}function Wc(e={}){let t=n=>{let r={...cr[n]};for(let o of Ar){let a=e[n]?.[o];a&&(r[o]=a)}return r};return{presentation:t("presentation"),analysis:t("analysis")}}var vt=Co();function tn(e,t={}){let n=t.clock??Be,r=t.motion??vt,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,b,w=new Promise(L=>{b=L}),v=L=>{u=L,f?.(),f=void 0,d?.removeEventListener("abort",R),b(L)};function R(){u==="running"&&v("cancelled")}let N=!1;function F(){u!=="running"||N||(N=!0,$(1),u==="running"&&v("done"))}function $(L){try{c(a(L))}catch(A){throw R(),A}}let x=L=>{if(r.mode==="off"){F();return}let A=L-l-s;A>=i?F():A>0&&$(A/i)},E={finished:w,get state(){return u},cancel:R,finish:F};return d?.aborted?(v("cancelled"),E):(d?.addEventListener("abort",R,{once:!0}),i<=0&&s<=0?(F(),E):($(0),u==="running"&&(f=n.onFrame(x)),E))}var st=(e,t)=>n=>e*(1-n)+t*n,ei=(e,t)=>n=>({x:e.x*(1-n)+t.x*n,y:e.y*(1-n)+t.y*n});function kt(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 He(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 b=s?.state==="running"&&c&&!(f.delay&&f.delay>0);l(),i=u;let w=t(a,u),v=!1,R=tn({duration:f.duration,timing:f.timing,ease:f.ease??(b?Ft:nt),delay:f.delay,signal:f.signal,update:N=>{v&&(c=!0),v=!0,d(w(N))}},o);return s=R,R.finished},set(u){l(),i=u,d(u)},stop(){l(),i=a}}}var Zc=350;function ti(e){qc(e);let{from:t,to:n,duration:r,onFrame:o}=e,a=e.ease??mt,i=e.timing??"playback",s=e.clock??Be,c=e.motion??vt,d=Math.min(t,n),l=Math.max(t,n),u=n,f=!1,b=!1,w,v=0,R=new Set,N=m=>{for(let M of[...R])if(R.has(M))try{M(m)}catch(C){Se(C)}},F=()=>{let m=w;return w=void 0,m?.stop(),m?.moved??!1},$=()=>{f&&(f=!1,N("pause"))},x=m=>{throw v++,F(),$(),m},E=m=>{if(m!==u){u=m;try{o(m)}catch(M){x(M)}}},L=(m,M,C,p)=>{let D=v;if(!(M>0)){E(m),v===D&&p();return}let G=u,K=s.now(),Y={moved:!1,stop:s.onFrame(re=>{let j=c.mode==="off"?1:(re-K)/M;if(j<1){Y.moved=!0;let U;try{U=C(j)}catch(ae){return x(ae)}E(G+(m-G)*U);return}F(),E(m),v===D&&p()})};w=Y},A=()=>{f=!1,N("end")};return{get position(){return u},get playing(){return f},play(){if(b||f)return;let m=++v;if(F(),f=!0,N("play"),v!==m)return;let M=c.duration(r,i);M>0&&u===n&&(E(t),v!==m)||L(n,M*Math.abs(n-u)/Math.abs(n-t),a,A)},pause(){b||!f||(v++,F(),$())},seek(m,M={}){if(Jc(m,M),b)return;let C=++v,p=F();if($(),v!==C||(N("seek"),v!==C))return;let D=M.animate===!1?0:c.duration(Zc,"transition");L(Math.min(Math.max(m,d),l),D,p?Ft:nt,()=>{})},subscribe(m){if(typeof m!="function")throw new TypeError(`playback.subscribe needs a function, got ${typeof m}.`);if(b)return()=>{};let M=C=>m(C);return R.add(M),()=>{R.delete(M)}},destroy(){b||(b=!0,v++,F(),$(),R.clear())}}}function qc(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(!Po(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(!Po(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&&!Ar.includes(a))throw new RangeError(`playback: timing must be one of ${Ar.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 Jc(e,t){if(!Po(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 Po(e){return typeof e=="number"&&Number.isFinite(e)}var Bt=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):dr(n)}}function xt(e,t,n,r){return{kind:"arc",center:e,radius:t,start:n,sweep:r,length:t*Math.abs(r)}}function Ht(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 jt(e.center,e.radius,e.start+e.sweep*t)}function Oo(e,t){if(e.kind==="line")return e.angle;let n=e.sweep<0?-Math.PI/2:Math.PI/2;return dr(e.start+e.sweep*t+n)}function jt(e,t,n){return{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}}function dr(e){return e-Bt*Math.ceil((e-Math.PI)/Bt)}function Ao(e){if(e.kind==="line")return[e.from,e.to];let t=[Ht(e,0),Ht(e,1)];for(let n=0;n<4;n++){let r=n*Math.PI/2;Yc(e,r)&&t.push(jt(e.center,e.radius,r))}return t}function hn(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>=Bt?!0:((e.sweep>=0?t-e.start:e.start-t)%Bt+Bt)%Bt<=n}function Ze(e){let t=Math.round(e*1e3)/1e3;return t===0?"0":String(t)}function ur(e){return`M${Ze(e.x)},${Ze(e.y)}`}function $r(e,t=0,n=1){if(e.kind==="line"){let d=n===1?e.to:Ht(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=jt(e.center,e.radius,r+o*d/a);c+=`A${i},${i} 0 0 ${s} ${Ze(l.x)},${Ze(l.y)}`}return c}function fr(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=ur(Ht(n,0));for(let a=0;a<r;a++){let i=e[a];i.length>0&&(o+=$r(i))}return t?`${o}Z`:o}var Gr=e=>e>0?e<1?e:1:0,Xc=Object.freeze([]);function zt(e,t=Xc){let n=e[0],r=e[e.length-1];if(!n||!r)throw new RangeError("A walk needs at least one segment.");let o=[0];for(let f of e)o.push(o[o.length-1]+f.length);let a=o[e.length],i=Ht(n,0),s=Ht(r,1),c=f=>{if(!(a>0))return{index:0,u:0};if(f>=a){let v=e.length-1;for(;v>0&&!(e[v].length>0);)v--;return{index:v,u:1}}let b=0,w=e.length-1;for(;b<w;){let v=b+w>>1;o[v+1]>f?w=v:b=v+1}return{index:b,u:Math.min(1,(f-o[b])/e[b].length)}},d=f=>{let b=Gr(f);if(b===0)return i;if(b===1)return s;let{index:w,u:v}=c(b*a);return Ht(e[w],v)},l=(f,b)=>{let w=ur(d(f)),v=f*a,R=b*a;if(!(R>v))return w;let N=c(v);for(let F=N.index;F<e.length&&o[F]<R;F++){let $=e[F];if(!($.length>0))continue;let x=F===N.index?N.u:0,E=o[F+1]>R?Math.min(1,(R-o[F])/$.length):1;E>x&&(w+=$r($,x,E))}return w},u=(f,b)=>{let w=Gr(Math.min(f,b)),v=Gr(Math.max(f,b));if(t.length===0)return l(w,v);let R="",N=w;for(let[F,$]of t){if(F>=v)break;F>N&&(R+=l(N,F)),$>N&&(N=$)}return v>N&&(R+=l(N,v)),R===""?ur(d(w)):R};return{segments:e,length:a,start:i,end:s,gaps:t,point:d,angle(f){let{index:b,u:w}=c(Gr(f)*a);return Oo(e[b],w)},slice:u,d:t.length===0?fr(e):u(0,1)}}function Tn(e){let t=e.map(n=>zt(n));return{d:fr(e.flat(),!0),closed:!0,sample(n){ri(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 ni(e){return{d:e.d,closed:!1,sample(t){if(ri(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 ri(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 nn({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),...n.gaps.length===0?{}:{gaps:n.gaps},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 rn(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),ct(e,`labelBounds[${n}].width`,a),ct(e,`labelBounds[${n}].height`,i))}return t}function ct(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 oi(e){let{key:t,series:n}=e,r={x:ot("arc","cx",e.cx),y:ot("arc","cy",e.cy)},o=Math.min(ct("arc","inner",e.inner),ct("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(-Bt,Math.min(Bt,e.end-e.start)),s=e.start-Math.PI/2,c=s+i,[d,l]=i>=0?[a,o]:[o,a],u=[[xt(r,d,s,i)],[rt(jt(r,d,c),jt(r,l,c),c+(d>l?Math.PI:0))],[xt(r,l,c,-i)],[rt(jt(r,l,s),jt(r,d,s),s+(d>l?0:Math.PI))]],f=zt([xt(r,(o+a)/2,s,i)]);return nn({key:t,series:n,walk:f,thickness:a-o,outline:Tn(u),bounds:hn(u.flat().flatMap(Ao)),center:f.point(.5),pivot:r,labelBounds:rn("arc",e.labelBounds)})}var ai={left:0,right:Math.PI,top:Math.PI/2,bottom:-Math.PI/2};function ii(e){let{key:t,series:n,baseline:r,x:o,y:a,width:i,height:s}=e;if(!Object.prototype.hasOwnProperty.call(ai,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),ct("bar","width",i),ct("bar","height",s);let c=ct("bar","radius",e.radius??0),d=ct("bar","gap",e.gap??0),l=rn("bar",e.labelBounds),u=r==="left"||r==="right",f=u?i:s,b=u?s:i,w=b,v=ai[r],R=Qc(e),N=(A,m,M,C)=>{let p=Math.max(0,Math.min(M,m-A,w/2)),D=Tn([[rt(R(A,0),R(m-p,0),v)],p>0?[xt(R(m-p,p),p,v-Math.PI/2,Math.PI/2),rt(R(m,p),R(m,w-p),v+Math.PI/2),xt(R(m-p,w-p),p,v,Math.PI/2)]:[rt(R(m,0),R(m,w),v+Math.PI/2)],[rt(R(m-p,w),R(A,w),v+Math.PI)],[rt(R(A,w),R(A,0),v-Math.PI/2)]]),G=zt([rt(R(A,w/2),R(m,w/2),v)]);return nn({...C,walk:G,thickness:b,outline:D,bounds:C.bounds??hn([R(A,0),R(m,w)]),center:R((A+m)/2,w/2),pivot:G.start})},F=e.segments??[{series:n,size:f}],$=new Set,x=0,L=F.map((A,m)=>{if(ct("bar",`segments[${m}].size`,A.size),A.series!==void 0){if($.has(A.series))throw new Error(`describe.bar: series "${A.series}" appears twice in the segments of "${t}".`);$.add(A.series)}let M=Math.min(x,f);x+=A.size;let C=Math.min(x,f);return{segment:A,index:m,p0:Math.min(M+Math.min(d,M),C),p1:C}}).map(({segment:A,index:m,p0:M,p1:C})=>N(M,C,c-(f-C),{key:A.series===void 0?`${t}/${m}`:`${t}/${A.series}`,series:A.series}));return N(0,f,c,{key:t,series:n,bounds:{x:o,y:a,width:i,height:s},labelBounds:l,segments:L})}function Qc({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 ci(e){let{key:t,series:n,points:r}=e,o=ct("line","width",e.width??1),a=r[0];if(!a)throw new RangeError(`describe.line: "${t}" needs at least one point.`);r.forEach((u,f)=>{ot("line",`points[${f}].x`,u.x),ot("line",`points[${f}].y`,u.y)});let i=tl(e.breaks,r.length),s=[];for(let u=1;u<r.length;u++)s.push(rt(r[u-1],r[u],s[s.length-1]?.angle??0));s.length===0&&s.push(rt(a,a));let c=zt(s,el(i,s)),d=hn(r),l=o/2;return nn({key:t,series:n,walk:c,thickness:o,outline:ni(c),bounds:{x:d.x-l,y:d.y-l,width:d.width+o,height:d.height+o},center:c.point(.5),pivot:a,labelBounds:rn("line",e.labelBounds)})}function el(e,t){let n=[0];for(let o of t)n.push(n[n.length-1]+o.length);let r=n[n.length-1];return e.filter(o=>n[o]>n[o-1]).map(o=>[n[o-1]/r,n[o]/r])}function tl(e,t){if(e===void 0)return[];if(!Array.isArray(e))throw new RangeError(`describe.line: breaks must be an array of point indices, got ${si(e)}.`);let n=0;return e.forEach((r,o)=>{if(!(Number.isInteger(r)&&r>n&&r<t))throw new RangeError(`describe.line: breaks[${o}] must be a whole number more than ${n} and less than ${t}, the number of points, got ${si(r)}.`);n=r}),e}var si=e=>typeof e=="string"?JSON.stringify(e):String(e);function li(e){let{key:t,series:n}=e,r={x:ot("point","x",e.x),y:ot("point","y",e.y)},o=ct("point","r",e.r),a=Math.PI/2;return nn({key:t,series:n,walk:zt([rt(r,r)]),thickness:2*o,outline:Tn([[xt(r,o,-3*a/2,a)],[xt(r,o,-a/2,a)],[xt(r,o,a/2,a)],[xt(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:rn("point",e.labelBounds)})}var Xe={bar:ii,arc:oi,line:ci,point:li};function di(e,t){return[1,0,0,1,e,t]}function ui(e,t){let n=Math.cos(e),r=Math.sin(e);return yi([n,r,-r,n,0,0],t)}function fi(e,t=e,n){return yi([e,0,0,t,0,0],n)}function mi(...e){let t=[1,0,0,1,0,0];for(let n of e)t=rl(t,n);return t}function nl(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 rl(e,t){let[n,r,o,a,i,s]=e,[c,d,l,u,f,b]=t;return[n*c+o*d,r*c+a*d,n*l+o*u,r*l+a*u,n*f+o*b+i,r*f+a*b+s]}function yi(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:di,rotate:ui,scale:fi,multiply:mi,apply:nl};function Rn(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 mr(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(di(a,i??0));break;case"scale":t.push(fi(a,i??a));break;case"rotate":t.push(ui(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 mi(...t)}function on(e,t,n){return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}var Ir=(Math.sqrt(5)-1)/2;function yr(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((a,i)=>{for(let s of["x","y","value"]){let c=a?.[s];if(typeof c!="number"||!Number.isFinite(c))throw new RangeError(`samplesAlong: points[${i}].${s} must be a finite number, got ${String(c)}.`)}});let n=e.length>0?Math.min(4096,Math.ceil(e.length)+1):1,r=Array.from({length:n},(a,i)=>e.path(n===1?0:i/(n-1))),o=t.map((a,i)=>({index:i,sample:{t:al(e,r,a),value:a.value,...a.at===void 0?{}:{at:a.at}}})).sort((a,i)=>a.sample.t-i.sample.t||a.index-i.index).map(({sample:a})=>a);return e.gaps&&e.gaps.length>0?ol(o,e.gaps):o}function ol(e,t){let n=t.map(([o,a])=>(o+a)/2).sort((o,a)=>o-a),r=0;return e.map((o,a)=>{if(a===0)return o;let i=e[a-1].t;for(;r<n.length&&n[r]<=i;)r++;return r<n.length&&n[r]<=o.t?{...o,gapBefore:!0}:o})}function al(e,t,n){let r=t.length;if(r===1)return 0;let o=0,a=1/0;t.forEach((v,R)=>{let N=pi(v,n);N<a&&(o=R,a=N)});let i=v=>pi(e.path(v),n),s=Math.max(0,o-1)/(r-1),c=Math.min(r-1,o+1)/(r-1),d=c-Ir*(c-s),l=s+Ir*(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-Ir*(c-s),u=i(d)):(s=d,d=l,u=f,l=s+Ir*(c-s),f=i(l));let b=(s+c)/2,w=i(b)<a?b:o/(r-1);return w>0?w<1?w:1:0}function pi(e,t){return(e.x-t.x)**2+(e.y-t.y)**2}function $o(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 _t=["hover","enter","update","exit","decorate"];function Kt(e,t){let n={};for(let r of Object.keys(e??{}))if(!_t.includes(r))throw new TypeError(`on.${r} isn't an effect slot. Use one of: ${_t.join(", ")}.`);for(let r of _t){let o=e?.[r];if(o!==void 0)if(typeof o=="string"){let a=t.resolve(o)();if(!Vr(a))throw new TypeError(`Preset "${o}" for on.${r} didn't return a mark effect; it returned ${pr(a)}.`);n[r]=a}else{if(!Vr(o))throw new TypeError(`on.${r} needs a mark effect (kind "geometry" or "data") or a preset name, got ${pr(o)}.`);n[r]=o}}return n}function Vr(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 pr(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 Xt(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 Io(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=tn({...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 il=["decorate","enter","update","exit","hover"],sl={get:()=>{}},Go={place(){},update(){},remove(){}};function an(e){let{surface:t}=e,n=e.effects,r=e.motion??vt,o=e.clock??Be,a=e.icons??sl,i=new Map,s=new Set,c=!1,d=!1,l=0,u=r.subscribe(()=>{r.mode==="off"&&m()});function f(p){let D=p.mark.key,G=i.get(D);if(G)return G.mark=p.mark,G.data=p.data,G;let K={key:D,mark:p.mark,data:p.data,resting:p.data,runs:new Map,applied:{},handle:void 0,exiting:void 0};return i.set(D,K),K}function b(p,D,G,K,Y={}){let{previous:re,done:j}=Y,U=n[D];if(!U){j?.();return}let ae=p.runs.get(D);ae&&N(ae);let se={entry:p,slot:D,order:Y.order??++l,effect:U,data:G,batch:K,previous:re,style:{},state:"running",done:j,scope:Io({clock:o,motion:r,icons:a,batch:K,previous:re,layer:F(p.key,D,()=>se.order,()=>se.state!=="cleared"),mark:$(()=>se)})};p.runs.set(D,se);let be=Y.mark??p.mark,V=se.scope.context;try{if(Y.end||r.mode==="off")U.kind==="data"?U.end(be,G,V):U.end(be,V),w(se);else{let _=U.kind==="data"?U.run(be,G,V):U.run(be,V);Promise.resolve(_).then(()=>w(se),ee=>v(se,ee))}}catch(_){v(se,_)}}function w(p){p.state==="running"&&(p.state="ended",R(p))}function v(p,D){let{signal:G}=p.scope.context;G.aborted&&(D===G.reason||D?.name==="AbortError")||(Se(D),N(p))}function R(p){let D=p.done;p.done=void 0,D?.()}function N(p){if(p.state==="cleared")return;p.state="cleared";let{entry:D}=p;D.runs.get(p.slot)===p&&D.runs.delete(p.slot),p.scope.abort();try{p.effect.clear(p.scope.context)}catch(G){Se(G)}p.scope.clear(),R(p)}function F(p,D,G,K){let Y,re=()=>K()?Y??(Y=t.group(p,D,G())):void 0;return{icon:(j,U)=>re()?.icon(j,U)??Go,path:(j,U)=>re()?.path(j,U)??Go,text:(j,U)=>re()?.text(j,U)??Go,clear(){let j=Y;Y=void 0,j?.clear()}}}function $(p){return{set(D){let G=p();G.state!=="cleared"&&(G.style=Xt(G.style,D),x(G.entry))},reset(){let D=p();Object.keys(D.style).length!==0&&(D.style={},x(D.entry))}}}function x(p){let D=[...p.runs.values()].sort((j,U)=>j.order-U.order),G=Object.assign({},...D.map(j=>j.style)),K=p.applied;if(p.applied=G,Object.keys(G).length===0){Object.keys(K).length>0&&E(p).reset();return}let Y={},re=!1;for(let j of new Set([...Object.keys(K),...Object.keys(G)]))K[j]!==G[j]&&(Y[j]=G[j],re=!0);re&&E(p).set(Y)}function E(p){return p.handle??(p.handle=t.mark(p.key))}function L(p){i.get(p.key)===p&&i.delete(p.key),s.delete(p.key);let D=p.exiting;p.exiting=void 0;for(let G of[...p.runs.values()])N(G);p.handle=void 0,D?.()}function A(p){let D=p.exiting;if(!D)return;p.exiting=void 0;let G=p.runs.get("exit");G&&N(G),D()}function m(){for(let p of[...i.values()])for(let D of[...p.runs.values()]){if(D.state!=="running"||p.runs.get(D.slot)!==D)continue;let G=D.done;D.done=void 0,b(p,D.slot,C(p,D),D.batch,{previous:D.previous,done:G,order:D.order})}}function M(p){let D=new Map;for(let G of[...i.values()]){let K=G.runs.get(p);K&&(D.set(G,K.order),N(K))}return D}function C(p,D){let G=D.data.previous;return G&&!p.data.previous?hi(p.data,G):p.data}return{enter(p){d||p.forEach((D,G)=>{let K=f(D);K.resting=D.data,A(K);let Y={index:G,count:p.length};b(K,"decorate",D.data,Y),b(K,"enter",D.data,Y)})},update(p){if(d)return;let D=new Set(p.map(G=>G.mark.key));for(let G of[...i.values()]){let K=G.runs.get("update");K&&!D.has(G.key)&&N(K)}p.forEach((G,K)=>{let Y=i.get(G.mark.key),re=G.from??Y?.mark,j=Y&&!G.data.previous?hi(G.data,Y.resting):G.data,U=f(G);U.resting=G.data,b(U,"update",j,{index:K,count:p.length},{previous:re})})},exit(p){if(d)return Promise.resolve();let D=p.map((G,K)=>{let Y=f(G);A(Y),s.delete(Y.key);for(let re of[...Y.runs.values()])N(re);return new Promise(re=>{if(Y.exiting=re,!n.exit){L(Y);return}b(Y,"exit",G.data,{index:K,count:p.length},{done:()=>{Y.exiting&&i.get(Y.key)===Y&&L(Y)}})})});return Promise.all(D).then(()=>{})},hover(p){d||p.forEach((D,G)=>{let K=f(D);K.exiting||(s.add(K.key),c||b(K,"hover",D.data,{index:G,count:p.length}))})},leave(p=[...s]){for(let D of p){s.delete(D);let G=i.get(D)?.runs.get("hover");G&&N(G)}},change(p,D){let G=i.get(p.key);if(G){G.mark=p,D&&(G.data=D,c||(G.resting=D));for(let K of[...G.runs.values()])if(K.state!=="cleared")try{K.scope.change(p,C(G,K))}catch(Y){Se(Y),N(K)}}},interrupt(){if(!d){c=!0;for(let p of[...i.values()]){let D=p.runs.get("hover");D&&N(D)}}},settle(){if(!c)return;c=!1;for(let D of i.values())D.exiting||(D.resting=D.data);let p=[...s];p.forEach((D,G)=>{let K=i.get(D);K&&b(K,"hover",K.data,{index:G,count:p.length})})},swap(p,D){if(d)return;let G=il.filter(K=>p[K]!==n[K]);n=p;for(let K of G)if(K==="decorate"){let Y=M(K);D.forEach((re,j)=>{let U=i.get(re.mark.key)??f(re);U.exiting||b(U,K,re.data,{index:j,count:D.length},{mark:re.mark,order:Y.get(U)})})}else if(K==="hover"){if(M(K),c)continue;let Y=[...s];Y.forEach((re,j)=>{let U=i.get(re);U&&b(U,K,U.data,{index:j,count:Y.length})})}else for(let Y of[...i.values()]){let re=Y.runs.get(K);if(!re)continue;let j=re.done;re.done=void 0;let U=C(Y,re);N(re),b(Y,K,U,re.batch,{previous:re.previous,done:j,order:re.order,end:!0})}},destroy(){if(!d){d=!0,c=!1,u();for(let p of[...i.values()])L(p);s.clear()}}}}function hi(e,t){return{datum:e.datum,samples:e.samples,related:n=>e.related(n),previous:t}}var cl={value:"Sorted highest first",key:"Sorted A to Z",none:"In data order",custom:"Sorted"},Vo=3;function Cn(e){let t=[],{series:n}=e;e.label!==void 0?t.push(e.label):n&&!(n.length===1&&n[0]==="value")&&t.push(`Showing ${Nr(n)}`),e.sort&&t.push(cl[e.sort]);let{changed:r,added:o,removed:a}=e;return!n&&r.length>0&&t.push(r.length<=Vo?`${Nr(r)} changed`:`${r.length} of ${e.count} changed`),o.length>0&&t.push(`Added ${o.length<=Vo?Nr(o):o.length}`),a.length>0&&t.push(`Removed ${a.length<=Vo?Nr(a):a.length}`),t.join(". ")}function Nr(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 ll="http://www.w3.org/2000/svg";function X(e,t={},n){let o=(n?.ownerDocument??document).createElementNS(ll,e);return ue(o,t),n?.appendChild(o),o}function ue(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 Ie(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 yt(e){let[t,n,r,o,a,i]=e;return`matrix(${[t,n,r,o].map(dl).join(" ")} ${Ze(a)} ${Ze(i)})`}function dl(e){let t=Math.round(e*1e6)/1e6;return t===0?"0":String(t)}var gi=1.05,ul=.25,bi=.16;function gn(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)-bi*r,y:e.y-gi*r,width:o+2*bi*r,height:(gi+ul)*r}}function Mt(e,t){ue(e,{x:t.x,y:t.y,"text-anchor":t.anchor}),e.textContent!==t.text&&(e.textContent=t.text)}var fl=.6;function Ln(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=X("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*fl},{clear:()=>t.clear()})}var Fo=34,xi=20,ml=4,yl=2,pl=72,hl=300,jr=12.5,An=12.5,Ho=11,Bo=26,Fr=4,sn=6,gl={label:!0,value:!0},Mi=.36;function $n(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=ki(o,Pn(t)),f=ki(o,Pn(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=Pn(s),l;if(r!==void 0)l=r.map(u=>({series:u,value:Pn(u)}));else if(c!==void 0)l=[{series:typeof c=="string"?c:"value",value:Pn(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:Pn(e.key),series:l}}function Si(e){let t=vl(wl(e),e.sort),n=Ko(t.map(s=>s.total)),r=t.map(s=>e.format(s.total)),o=n.ticks.map(e.format),a=(e.encoding.orientation==="horizontal"?kl:xl)(e,t,n,r,o),i=bl(a,t,r,e.measure);return{width:a.bands.width,height:a.bands.height,orientation:a.orientation,frame:a,rows:t.map((s,c)=>jo(a,{...s,slot:c,text:r[c],drawn:{label:c%i.every===0,value:i.values}},e.measure)),ticks:n.ticks.map((s,c)=>zo(a,s,o[c])),labels:i}}function bl(e,t,n,r){let o=t.map((d,l)=>Ei(e,l,d.total,d.category,n[l])),a=e.orientation==="horizontal",i=!wi(Hr(o.map(({value:d})=>d),r,"ec-value",An),a),s=d=>Hr(o.filter((l,u)=>u%d===0).map(({label:l})=>l),r,"ec-label",jr),c=0;for(;No(c)<t.length&&wi(s(No(c)),a);)c++;return{every:No(c),values:i}}var No=e=>[1,2,5][e%3]*10**Math.floor(e/3);function Hr(e,t,n,r){return e.filter(o=>o.text!=="").map(o=>gn(o,t,n,r))}function wi(e,t){let n=t?e.map(({x:o,y:a,width:i,height:s})=>({x:a,y:o,width:s,height:i})):[...e];n.sort((o,a)=>o.x-a.x);let r=[];for(let o of n){for(let a=r.length-1;a>=0;a--)r[a].x+r[a].width<=o.x&&r.splice(a,1);if(r.some(a=>a.y<o.y+o.height&&o.y<a.y+a.height))return!0;r.push(o)}return!1}function Ei(e,t,n,r,o){let{scale:a,bands:i}=e,s=n<0,c=_o(a)(n),d=i.start+t*i.band;if(e.orientation==="horizontal"){let u=d+i.band/2+jr*Mi;return{label:{x:a.label,y:u,anchor:"end",text:r},value:{x:s?c-sn:c+sn,y:u,anchor:s?"end":"start",text:o}}}let l=d+i.band/2;return{label:{x:l,y:a.label,anchor:"middle",text:r},value:{x:l,y:s?c+sn+An*.8:c-sn,anchor:"middle",text:o}}}function jo(e,t,n){let{scale:r,bands:o}=e,a=_o(r),i=Math.abs(r.extent/(r.hi-r.lo)),s=t.values.reduce((x,E)=>x+E.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:ml,gap:yl,segments:t.values.map(x=>({series:x.series,size:Math.max(0,c?-x.value:x.value)*i}))},b=t.drawn??gl,w={key:t.key,datum:t.datum,index:t.index,slot:t.slot,values:t.values,total:s,category:t.category,drawn:b},{label:v,value:R}=Ei(e,t.slot,s,b.label?t.category:"",b.value?t.text:""),N=()=>[...Hr([v],n,"ec-label",jr),...Hr([R],n,"ec-value",An)];if(e.orientation==="horizontal"){let x=Xe.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:N()});return{...w,geometry:x,data:vi(t.datum,s,x),label:v,value:R,hit:{x:0,y:u,width:o.width,height:o.band}}}let F=u+o.band/2,$=Xe.bar({...f,x:F-o.thickness/2,y:Math.min(d,l),width:o.thickness,height:Math.abs(l-d),baseline:c?"top":"bottom",labelBounds:N()});return{...w,geometry:$,data:vi(t.datum,s,$),label:v,value:R,hit:{x:u,y:0,width:o.band,height:o.height}}}function zo(e,t,n){let{bands:r}=e,o=_o(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+Ho*Mi,anchor:"end",text:n}}}function _o(e){let t=e.extent/(e.hi-e.lo);return n=>e.from+(n-e.lo)*t}function wl({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:Ml(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 vl(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 Ko(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=hr((n-t)/4);t=On(Math.floor(t/r)*r),n=On(Math.ceil(n/r)*r);let o=Math.round((n-t)/r),a=Array.from({length:o+1},(i,s)=>On(t+s*r));return{lo:t,hi:n,ticks:a}}function hr(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 kl(e,t,n,r,o){let{width:a,measure:i}=e,s=t.length,c=Br(t.map(N=>N.category),"ec-label",jr,i),d=Br(r,"ec-value",An,i),l=Br(o,"ec-tick",Ho,i),{positive:u,negative:f}=Di(e,t),b=n.lo<0?d+sn:0,w=Math.max(c+10+b+f,l/2+2),v=Math.max(d+sn+4+u,l/2+2),R=e.height===void 0||s===0?Fo:Math.max(0,e.height-Fr-Bo)/s;return{orientation:"horizontal",scale:{lo:n.lo,hi:n.hi,from:w,extent:Math.max(0,a-w-v),label:w-10-b},bands:{start:Fr,band:R,thickness:R*xi/Fo,span:s*R,width:a,height:e.height??Fr+s*R+Bo}}}function xl(e,t,n,r,o){let{width:a,measure:i}=e,s=t.length,c=e.height??hl,d=Br(o,"ec-tick",Ho,i),{positive:l,negative:u}=Di(e,t),f=(n.hi>0?An+sn+2:Fr)+l,b=Bo+(n.lo<0?An+sn:0)+u,w=d+8+2,v={x:w,y:f,width:Math.max(0,a-w-8),height:Math.max(0,c-f-b)},R=s>0?v.width/s:0,N=v.y+v.height;return{orientation:"vertical",scale:{lo:n.lo,hi:n.hi,from:N,extent:-v.height,label:N+18},bands:{start:v.x,band:R,thickness:Math.min(R*xi/Fo,pl),span:v.width,width:a,height:c}}}function Di(e,t){let n=e.room??0;return{positive:t.some(r=>r.total>0)?n:0,negative:t.some(r=>r.total<0)?n:0}}function vi(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 Br(e,t,n,r){return e.reduce((o,a)=>Math.max(o,r(a,t,n)),0)}function Pn(e){return typeof e=="function"?e:t=>t[e]}function ki(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 Ml(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 On(e){let t=Number(e.toPrecision(12));return t===0?0:t}var gr={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"]]}},Ri=["surface","text","text-muted","grid","axis","focus","negative"],De=Object.fromEntries(Ri.map(e=>[e,gr.light[e]]));function at(e){let t=(Math.max(1,Math.floor(e))-1)%8+1,[n,r]=gr.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=De[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 pt(e){return{"--ec-mark":e?.color,"--ec-mark-strong":e?.strong}}function Uo(e,t){let r=[...Ri,"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 Sl=`:where(:root, [data-theme="light"]) {
5
- ${Uo(gr.light," ")}
1
+ "use strict";var ExpressiveCharts=(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=globalThis.reportError;typeof t==`function`?t(e):console.error(e)}function n(e=i()){let n=new Set,r,a=()=>{!r&&n.size>0&&(r=e.request(o))},o=e=>{r=void 0;for(let r of[...n])if(n.has(r))try{r(e)}catch(e){t(e)}a()};return{now:()=>e.now(),onFrame(e){let t=t=>e(t);return n.add(t),a(),()=>{n.delete(t)&&n.size===0&&r&&(r(),r=void 0)}}}}function r(e=0){let t=e,r,i=n({now:()=>t,request(e){return r=e,()=>{r===e&&(r=void 0)}}});return{now:i.now,onFrame:i.onFrame,get idle(){return r===void 0},advance(e){if(!(e>=0))throw RangeError(`manualClock.advance needs a non-negative number of ms, got ${e}`);t+=e;let n=r;r=void 0,n?.(t)}}}function i(){let e=()=>typeof performance<`u`?performance.now():Date.now();return{now:e,request(t){if(typeof requestAnimationFrame==`function`){let e=requestAnimationFrame(t);return()=>cancelAnimationFrame(e)}let n=setTimeout(()=>t(e()),16);return()=>clearTimeout(n)}}}let a=n(),o=e=>e,s=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,c=e=>1-(1-e)**3;function l(e){return e<.5?Math.cbrt(e/4):1-Math.cbrt(2*(1-e))/2}let u={presentation:{feedback:{factor:1},transition:{factor:1},effect:{factor:1},playback:{factor:1},stagger:{factor:1}},analysis:{feedback:{factor:1},transition:{factor:.35,max:200},effect:{factor:.35,min:140,max:300},playback:{factor:.3},stagger:{factor:0}}},d=[`presentation`,`analysis`,`off`],f=[`feedback`,`transition`,`effect`,`playback`,`stagger`];function p(e={}){let n=g(e.mode??`presentation`),r,i=_(e.scaling),a=e.reducedMotion??h(),o=new Set,s,c=()=>r??(a.matches?`off`:n),l=()=>{for(let e of[...o])if(o.has(e))try{e()}catch(e){t(e)}};return{get mode(){return c()},get staged(){return c()===`presentation`},get requested(){return n},get viewerChoice(){return r},get prefersReduced(){return a.matches},duration(e,t=`transition`){let n=c();return n===`off`?0:m(e,i[n][t])},setMode(e){g(e),e!==n&&(n=e,l())},chooseMode(e){g(e),e!==r&&(r=e,l())},clearChoice(){r!==void 0&&(r=void 0,l())},subscribe(e){let t=()=>e();return o.add(t),s??(s=a.subscribe(l)),()=>{!o.delete(t)||o.size>0||(s?.(),s=void 0)}}}}function m(e,t){if(!(e>0))return 0;let n=Math.min(e,t.min??0),r=t.max??1/0;return Math.min(Math.max(e*t.factor,n),r)}function h(e=`(prefers-reduced-motion: reduce)`){let t,n=()=>{if(t===void 0)try{t=typeof matchMedia==`function`?matchMedia(e):null}catch{t=null}return t};return{get matches(){return n()?.matches??!1},subscribe(e){let t=n();if(!t)return()=>{};let r=()=>e();return typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))}}}function g(e){if(!d.includes(e))throw TypeError(`Unknown motion mode "${String(e)}". Use one of: ${d.join(`, `)}.`);return e}function _(e={}){let t=t=>{let n={...u[t]};for(let r of f){let i=e[t]?.[r];i&&(n[r]=i)}return n};return{presentation:t(`presentation`),analysis:t(`analysis`)}}let v=p();function y(e,t={}){let n=t.clock??a,r=t.motion??v,i=e.timing??`transition`,o=e.ease??s,c=r.duration(e.duration,i),l=e.delay?r.duration(e.delay,i):0,{update:u,signal:d}=e,f=n.now(),p=`running`,m,h,g=new Promise(e=>{h=e}),_=e=>{p=e,m?.(),m=void 0,d?.removeEventListener(`abort`,y),h(e)};function y(){p===`running`&&_(`cancelled`)}let b=!1;function x(){p!==`running`||b||(b=!0,S(1),p===`running`&&_(`done`))}function S(e){try{u(o(e))}catch(e){throw y(),e}}let C=e=>{if(r.mode===`off`){x();return}let t=e-f-l;t>=c?x():t>0&&S(t/c)},w={finished:g,get state(){return p},cancel:y,finish:x};return d?.aborted?(_(`cancelled`),w):(d?.addEventListener(`abort`,y,{once:!0}),c<=0&&l<=0?(x(),w):(S(0),p===`running`&&(m=n.onFrame(C)),w))}let b=(e,t)=>n=>e*(1-n)+t*n,x=(e,t)=>n=>({x:e.x*(1-n)+t.x*n,y:e.y*(1-n)+t.y*n});function S(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])];return r=>{if(r===1)return{...t};let i={};for(let a of n)i[a]=(e[a]??0)*(1-r)+(t[a]??0)*r;return i}}function C(e,t,n={}){let{onChange:r,...i}=n,a=e,o=e,l,u=!1,d=e=>{a=e,r?.(e)},f=()=>{let e=l;l=void 0,u=!1,e?.cancel()};return{get value(){return a},get target(){return l?.state===`cancelled`?a:o},get animating(){return l?.state===`running`},to(e,n){let r=l?.state===`running`&&u&&!(n.delay&&n.delay>0);f(),o=e;let p=t(a,e),m=!1,h=y({duration:n.duration,timing:n.timing,ease:n.ease??(r?c:s),delay:n.delay,signal:n.signal,update:e=>{m&&(u=!0),m=!0,d(p(e))}},i);return l=h,h.finished},set(e){f(),o=e,d(e)},stop(){f(),o=a}}}function w(e){T(e);let{from:n,to:r,duration:i,onFrame:l}=e,u=e.ease??o,d=e.timing??`playback`,f=e.clock??a,p=e.motion??v,m=Math.min(n,r),h=Math.max(n,r),g=r,_=!1,y=!1,b,x=0,S=new Set,C=e=>{for(let n of[...S])if(S.has(n))try{n(e)}catch(e){t(e)}},w=()=>{let e=b;return b=void 0,e?.stop(),e?.moved??!1},E=()=>{_&&(_=!1,C(`pause`))},D=e=>{throw x++,w(),E(),e},O=e=>{if(e!==g){g=e;try{l(e)}catch(e){D(e)}}},k=(e,t,n,r)=>{let i=x;if(!(t>0)){O(e),x===i&&r();return}let a=g,o=f.now(),s={moved:!1,stop:f.onFrame(c=>{let l=p.mode===`off`?1:(c-o)/t;if(l<1){s.moved=!0;let t;try{t=n(l)}catch(e){return D(e)}O(a+(e-a)*t)}else w(),O(e),x===i&&r()})};b=s},A=()=>{_=!1,C(`end`)};return{get position(){return g},get playing(){return _},play(){if(y||_)return;let e=++x;if(w(),_=!0,C(`play`),x!==e)return;let t=p.duration(i,d);t>0&&g===r&&(O(n),x!==e)||k(r,t*Math.abs(r-g)/Math.abs(r-n),u,A)},pause(){!y&&_&&(x++,w(),E())},seek(e,t={}){if(ee(e,t),y)return;let n=++x,r=w();if(E(),x!==n||(C(`seek`),x!==n))return;let i=t.animate===!1?0:p.duration(350,`transition`);k(Math.min(Math.max(e,m),h),i,r?c:s,()=>{})},subscribe(e){if(typeof e!=`function`)throw TypeError(`playback.subscribe needs a function, got ${typeof e}.`);if(y)return()=>{};let t=t=>e(t);return S.add(t),()=>{S.delete(t)}},destroy(){y||(y=!0,x++,w(),E(),S.clear())}}}function T(e){if(typeof e!=`object`||!e)throw TypeError(`playback needs options: { from, to, duration, onFrame }.`);let{from:t,to:n,duration:r,ease:i,timing:a,onFrame:o,clock:s,motion:c}=e;for(let[e,r]of[[`from`,t],[`to`,n]])if(!E(r))throw RangeError(`playback: ${e} must be a finite number, got ${String(r)}.`);if(t===n)throw RangeError(`playback: from and to must differ, got ${t} for both.`);if(!E(r)||r<0)throw RangeError(`playback: duration must be a non-negative number of ms, got ${String(r)}.`);if(typeof o!=`function`)throw TypeError(`playback: onFrame must be a function, got ${typeof o}.`);if(i!==void 0&&typeof i!=`function`)throw TypeError(`playback: ease must be a function, got ${typeof i}.`);if(a!==void 0&&!f.includes(a))throw RangeError(`playback: timing must be one of ${f.join(`, `)}, got ${JSON.stringify(a)??String(a)}.`);if(s!==void 0&&(typeof s?.now!=`function`||typeof s.onFrame!=`function`))throw TypeError(`playback: clock must be a Clock, such as one from createClock() or manualClock().`);if(c!==void 0&&typeof c?.duration!=`function`)throw TypeError("playback: motion must be a Motion, such as the page-wide `motion` or one from createMotion().")}function ee(e,t){if(!E(e))throw RangeError(`playback.seek needs a finite number, got ${String(e)}.`);if(typeof t!=`object`||!t)throw TypeError(`playback.seek's options must be an object, such as { animate: false }.`);if(t.animate!==void 0&&typeof t.animate!=`boolean`)throw TypeError(`playback.seek: animate must be true or false, got ${String(t.animate)}.`)}function E(e){return typeof e==`number`&&Number.isFinite(e)}let D=2*Math.PI;function O(e,t,n=0){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i);return{kind:`line`,from:e,to:t,length:a,angle:a>0?Math.atan2(i,r):N(n)}}function k(e,t,n,r){return{kind:`arc`,center:e,radius:t,start:n,sweep:r,length:t*Math.abs(r)}}function A(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 M(e.center,e.radius,e.start+e.sweep*t)}function j(e,t){if(e.kind===`line`)return e.angle;let n=e.sweep<0?-Math.PI/2:Math.PI/2;return N(e.start+e.sweep*t+n)}function M(e,t,n){return{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}}function N(e){return e-D*Math.ceil((e-Math.PI)/D)}function P(e){if(e.kind===`line`)return[e.from,e.to];let t=[A(e,0),A(e,1)];for(let n=0;n<4;n++){let r=n*Math.PI/2;ne(e,r)&&t.push(M(e.center,e.radius,r))}return t}function te(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let{x:a,y:o}of e)a<t&&(t=a),a>r&&(r=a),o<n&&(n=o),o>i&&(i=o);return{x:t,y:n,width:r-t,height:i-n}}function ne(e,t){let n=Math.abs(e.sweep);return n>=D||((e.sweep>=0?t-e.start:e.start-t)%D+D)%D<=n}function F(e){let t=Math.round(e*1e3)/1e3;return t===0?`0`:String(t)}function I(e){return`M${F(e.x)},${F(e.y)}`}function L(e,t=0,n=1){if(e.kind===`line`){let t=n===1?e.to:A(e,n);return`L${F(t.x)},${F(t.y)}`}let r=e.start+e.sweep*t,i=e.sweep*(n-t),a=Math.max(1,Math.ceil(Math.abs(i)/Math.PI-1e-9)),o=F(e.radius),s=+(i>=0),c=``;for(let t=1;t<=a;t++){let n=M(e.center,e.radius,r+i*t/a);c+=`A${o},${o} 0 0 ${s} ${F(n.x)},${F(n.y)}`}return c}function R(e,t=!1){let n=e[0];if(!n)return``;let r=e.length;if(t){for(;r>0&&e[r-1].length<=0;)r--;r>0&&e[r-1].kind===`line`&&r--}let i=I(A(n,0));for(let t=0;t<r;t++){let n=e[t];n.length>0&&(i+=L(n))}return t?`${i}Z`:i}let z=e=>e>0?e<1?e:1:0,re=Object.freeze([]);function B(e,t=re){let n=e[0],r=e[e.length-1];if(!n||!r)throw RangeError(`A walk needs at least one segment.`);let i=[0];for(let t of e)i.push(i[i.length-1]+t.length);let a=i[e.length],o=A(n,0),s=A(r,1),c=t=>{if(!(a>0))return{index:0,u:0};if(t>=a){let t=e.length-1;for(;t>0&&!(e[t].length>0);)t--;return{index:t,u:1}}let n=0,r=e.length-1;for(;n<r;){let e=n+r>>1;i[e+1]>t?r=e:n=e+1}return{index:n,u:Math.min(1,(t-i[n])/e[n].length)}},l=t=>{let n=z(t);if(n===0)return o;if(n===1)return s;let{index:r,u:i}=c(n*a);return A(e[r],i)},u=(t,n)=>{let r=I(l(t)),o=t*a,s=n*a;if(!(s>o))return r;let u=c(o);for(let t=u.index;t<e.length&&i[t]<s;t++){let n=e[t];if(!(n.length>0))continue;let a=t===u.index?u.u:0,o=i[t+1]>s?Math.min(1,(s-i[t])/n.length):1;o>a&&(r+=L(n,a,o))}return r},d=(e,n)=>{let r=z(Math.min(e,n)),i=z(Math.max(e,n));if(t.length===0)return u(r,i);let a=``,o=r;for(let[e,n]of t){if(e>=i)break;e>o&&(a+=u(o,e)),n>o&&(o=n)}return i>o&&(a+=u(o,i)),a===``?I(l(r)):a};return{segments:e,length:a,start:o,end:s,gaps:t,point:l,angle(t){let{index:n,u:r}=c(z(t)*a);return j(e[n],r)},slice:d,d:t.length===0?R(e):d(0,1)}}function ie(e){let t=e.map(e=>B(e));return{d:R(e.flat(),!0),closed:!0,sample(e){ue(e,4);let n=e/4,r=[];for(let e of t)for(let t=0;t<n;t++)r.push(e.point(t/n));return r}}}function ae(e){let t=e.map(e=>e.reduce((e,t)=>e+t.length,0)),n=0;t.forEach((e,r)=>{e>t[n]&&(n=r)});let r=oe(e[n])<0,i=e.map(e=>r?se(e):e),a=ce(i[n]),o=B(a);return{d:[a,...i.filter((e,t)=>t!==n)].map(e=>R(e,!0)).join(``),closed:!0,sample(e){ue(e,4);let t=e/4,n=[];for(let e=0;e<4;e++)for(let r=0;r<t;r++)n.push(o.point(e/4+r/t/4));return n}}}function oe(e){let t=0;for(let n of e){if(n.kind===`line`){t+=n.from.x*n.to.y-n.to.x*n.from.y;continue}let{center:e,radius:r,start:i,sweep:a}=n,o=i+a;t+=r*(e.x*(Math.sin(o)-Math.sin(i))-e.y*(Math.cos(o)-Math.cos(i)))+r*r*a}return t/2}function se(e){return e.map(e=>e.kind===`line`?O(e.to,e.from):k(e.center,e.radius,e.start+e.sweep,-e.sweep)).reverse()}function ce(e){let t=0,n=0,r=1/0,i=1/0,a=(e,a,o)=>{let s=e.x+e.y;(s<r-1e-9||s<=r+1e-9&&e.y<i)&&([t,n,r,i]=[a,o,s,e.y])};e.forEach((e,t)=>{if(a(A(e,0),t,0),e.kind===`arc`){let n=((e.sweep>=0?H-e.start:e.start-H)%D+D)%D/Math.abs(e.sweep);n<1&&a(A(e,n),t,n)}});let[o,s]=V(e[t],n);return[s,...e.slice(t+1),...e.slice(0,t),o].filter(e=>e.length>0)}function V(e,t){if(e.kind===`line`){let n=A(e,t);return[O(e.from,n),O(n,e.to)]}let{center:n,radius:r,start:i,sweep:a}=e;return[k(n,r,i,a*t),k(n,r,i+a*t,a*(1-t))]}let H=-3*Math.PI/4;function le(e){return{d:e.d,closed:!1,sample(t){if(ue(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 ue(e,t){if(!Number.isInteger(e)||e<0||e%t!==0){let n=t===1?`a whole number ≥ 0`:`a whole multiple of ${t}`;throw RangeError(`outline.sample(n): n must be ${n}, got ${e}.`)}}function de({key:e,series:t,walk:n,thickness:r,outline:i,bounds:a,center:o,pivot:s,labelBounds:c,nearbyLabels:l,segments:u}){return{key:e,...t===void 0?{}:{series:t},start:n.start,end:n.end,length:n.length,path:e=>n.point(e),angle:e=>n.angle(e),slice:(e,t)=>n.slice(e,t),...n.gaps.length===0?{}:{gaps:n.gaps},thickness:r,outline:i,bounds:a,center:o,pivot:s,...c===void 0?{}:{labelBounds:c},...l===void 0?{}:{nearbyLabels:l},...u===void 0?{}:{segments:u}}}function fe(e,t,n){if(!Number.isFinite(n))throw RangeError(`describe.${e}: ${t} must be a finite number, got ${n}.`);return n}function U(e,t,n=`labelBounds`){if(!t)return t;for(let r=0;r<t.length;r++){let{x:i,y:a,width:o,height:s}=t[r];Number.isFinite(i)&&Number.isFinite(a)&&Number.isFinite(o)&&o>=0&&Number.isFinite(s)&&s>=0||(fe(e,`${n}[${r}].x`,i),fe(e,`${n}[${r}].y`,a),W(e,`${n}[${r}].width`,o),W(e,`${n}[${r}].height`,s))}return t}function W(e,t,n){if(!(Number.isFinite(n)&&n>=0))throw RangeError(`describe.${e}: ${t} must be a finite number ≥ 0, got ${n}.`);return n}function pe(e){let{key:t,series:n}=e,r={x:fe(`arc`,`cx`,e.cx),y:fe(`arc`,`cy`,e.cy)},i=Math.min(W(`arc`,`inner`,e.inner),W(`arc`,`outer`,e.outer)),a=Math.max(e.inner,e.outer);fe(`arc`,`start`,e.start),fe(`arc`,`end`,e.end);let o=Math.max(-D,Math.min(D,e.end-e.start)),s=e.start-Math.PI/2,c=s+o,[l,u]=o>=0?[a,i]:[i,a],d=[[k(r,l,s,o)],[O(M(r,l,c),M(r,u,c),c+(l>u?Math.PI:0))],[k(r,u,c,-o)],[O(M(r,u,s),M(r,l,s),s+(l>u?0:Math.PI))]],f=B([k(r,(i+a)/2,s,o)]);return de({key:t,series:n,walk:f,thickness:a-i,outline:ie(d),bounds:te(d.flat().flatMap(P)),center:f.point(.5),pivot:r,labelBounds:U(`arc`,e.labelBounds),nearbyLabels:U(`arc`,e.nearbyLabels,`nearbyLabels`)})}let me={left:0,right:Math.PI,top:Math.PI/2,bottom:-Math.PI/2};function he(e){let{key:t,series:n,baseline:r,x:i,y:a,width:o,height:s}=e;if(!Object.prototype.hasOwnProperty.call(me,r))throw RangeError(`describe.bar: baseline must be left, right, top or bottom, got ${String(r)}.`);fe(`bar`,`x`,i),fe(`bar`,`y`,a),W(`bar`,`width`,o),W(`bar`,`height`,s);let c=W(`bar`,`radius`,e.radius??0),l=W(`bar`,`gap`,e.gap??0),u=U(`bar`,e.labelBounds),d=U(`bar`,e.nearbyLabels,`nearbyLabels`),f=r===`left`||r===`right`,p=f?o:s,m=f?s:o,h=m,g=me[r],_=ge(e),v=(e,t,n,r)=>{let i=Math.max(0,Math.min(n,t-e,h/2)),a=ie([[O(_(e,0),_(t-i,0),g)],i>0?[k(_(t-i,i),i,g-Math.PI/2,Math.PI/2),O(_(t,i),_(t,h-i),g+Math.PI/2),k(_(t-i,h-i),i,g,Math.PI/2)]:[O(_(t,0),_(t,h),g+Math.PI/2)],[O(_(t-i,h),_(e,h),g+Math.PI)],[O(_(e,h),_(e,0),g-Math.PI/2)]]),o=B([O(_(e,h/2),_(t,h/2),g)]);return de({...r,walk:o,thickness:m,outline:a,bounds:r.bounds??te([_(e,0),_(t,h)]),center:_((e+t)/2,h/2),pivot:o.start})},y=e.segments??[{series:n,size:p}],b=new Set,x=0,S=y.map((e,n)=>{if(W(`bar`,`segments[${n}].size`,e.size),e.series!==void 0){if(b.has(e.series))throw Error(`describe.bar: series "${e.series}" appears twice in the segments of "${t}".`);b.add(e.series)}let r=Math.min(x,p);x+=e.size;let i=Math.min(x,p);return{segment:e,index:n,p0:Math.min(r+Math.min(l,r),i),p1:i}}).map(({segment:e,index:n,p0:r,p1:i})=>v(r,i,c-(p-i),{key:e.series===void 0?`${t}/${n}`:`${t}/${e.series}`,series:e.series}));return v(0,p,c,{key:t,series:n,bounds:{x:i,y:a,width:o,height:s},labelBounds:u,nearbyLabels:d,segments:S})}function ge({x:e,y:t,width:n,height:r,baseline:i}){switch(i){case`left`:return(n,r)=>({x:e+n,y:t+r});case`right`:return(i,a)=>({x:e+n-i,y:t+r-a});case`top`:return(r,i)=>({x:e+n-i,y:t+r});case`bottom`:return(n,i)=>({x:e+i,y:t+r-n})}}function _e(e){let{key:t,series:n,points:r}=e,i=W(`line`,`width`,e.width??1),a=r[0];if(!a)throw RangeError(`describe.line: "${t}" needs at least one point.`);r.forEach((e,t)=>{fe(`line`,`points[${t}].x`,e.x),fe(`line`,`points[${t}].y`,e.y)});let o=ye(e.breaks,r.length),s=[];for(let e=1;e<r.length;e++)s.push(O(r[e-1],r[e],s[s.length-1]?.angle??0));s.length===0&&s.push(O(a,a));let c=B(s,ve(o,s)),l=te(r),u=i/2;return de({key:t,series:n,walk:c,thickness:i,outline:le(c),bounds:{x:l.x-u,y:l.y-u,width:l.width+i,height:l.height+i},center:c.point(.5),pivot:a,labelBounds:U(`line`,e.labelBounds),nearbyLabels:U(`line`,e.nearbyLabels,`nearbyLabels`)})}function ve(e,t){let n=[0];for(let e of t)n.push(n[n.length-1]+e.length);let r=n[n.length-1];return e.filter(e=>n[e]>n[e-1]).map(e=>[n[e-1]/r,n[e]/r])}function ye(e,t){if(e===void 0)return[];if(!Array.isArray(e))throw RangeError(`describe.line: breaks must be an array of point indices, got ${be(e)}.`);let n=0;return e.forEach((e,r)=>{if(!(Number.isInteger(e)&&e>n&&e<t))throw RangeError(`describe.line: breaks[${r}] must be a whole number more than ${n} and less than ${t}, the number of points, got ${be(e)}.`);n=e}),e}let be=e=>typeof e==`string`?JSON.stringify(e):String(e);function xe(e){let{key:t,series:n}=e,r={x:fe(`point`,`x`,e.x),y:fe(`point`,`y`,e.y)},i=W(`point`,`r`,e.r),a=Math.PI/2;return de({key:t,series:n,walk:B([O(r,r)]),thickness:2*i,outline:ie([[k(r,i,-3*a/2,a)],[k(r,i,-a/2,a)],[k(r,i,a/2,a)],[k(r,i,3*a/2,a)]]),bounds:{x:r.x-i,y:r.y-i,width:2*i,height:2*i},center:r,pivot:r,labelBounds:U(`point`,e.labelBounds),nearbyLabels:U(`point`,e.nearbyLabels,`nearbyLabels`)})}let Se=.1,G=1e4;function Ce(e){let t=[],n,r={x:0,y:0},i=[],a=!1,o=e=>{a&&t.push({start:n,end:r,segments:i,closed:e}),i=[],a=!1},s=e=>{a||(n=r,a=!0),r=e},c=e=>{e.length!==0&&i.push(e)},l=(e,t)=>c(O(e,t)),u=e=>{for(let t=1;t<e.length;t++)l(e[t-1],e[t])};for(let t=0;t<e.length;t++){let i=e[t],d=r;switch(i.op){case`M`:o(!1),r=i.to,e[t+1]&&e[t+1].op!==`M`&&(n=r,a=!0);break;case`Z`:s(n??r),l(d,r),o(!0);break;case`L`:s(i.to),l(d,r);break;case`C`:s(i.to),u(we(d,i.c1,i.c2,i.to));break;case`Q`:s(i.to),u(we(d,i.c,i.to));break;case`A`:s(i.to);for(let e of De(d,i))c(e)}}return o(!1),t}function we(...e){let t=e.length===4,n=t?Te(e[0],e[1],e[2],e[3]):K(1,2*Ee(e[0],e[1],e[2])),r=[e[0]];for(let i=1;i<n;i++){let a=i/n,o=1-a,[s,c,l,u]=t?[o*o*o,3*o*o*a,3*o*a*a,a*a*a]:[o*o,2*o*a,a*a,0];r.push({x:s*e[0].x+c*e[1].x+l*e[2].x+(t?u*e[3].x:0),y:s*e[0].y+c*e[1].y+l*e[2].y+(t?u*e[3].y:0)})}return r.push(e[e.length-1]),r}function Te(e,t,n,r){return K(1,6*Math.max(Ee(e,t,n),Ee(t,n,r)))}function Ee(e,t,n){return Math.hypot(e.x-2*t.x+n.x,e.y-2*t.y+n.y)}function K(e,t){let n=Math.ceil(e*Math.sqrt(t/(8*Se)));return Number.isFinite(n)?Math.min(G,Math.max(1,n)):G}function De(e,t){let{to:n,large:r,sweep:i}=t;if(e.x===n.x&&e.y===n.y)return[];let{rx:a,ry:o}=t;if(!(a>0&&o>0))return[O(e,n)];let s=Math.abs(a-o)<=1e-9*Math.max(a,o),c=s?0:t.rotation*Math.PI/180,l=Math.cos(c),u=Math.sin(c),d=(e.x-n.x)/2,f=(e.y-n.y)/2,p=l*d+u*f,m=-u*d+l*f,h=p*p/(a*a)+m*m/(o*o);h>1&&(a*=Math.sqrt(h),o*=Math.sqrt(h));let g=a*a,_=o*o,v=g*m*m+_*p*p,y=(r===i?-1:1)*Math.sqrt(Math.max(0,(g*_-v)/v)),b=y*a*m/o,x=-y*o*p/a,S={x:l*b-u*x+(e.x+n.x)/2,y:u*b+l*x+(e.y+n.y)/2},C=Math.atan2((m-x)/o,(p-b)/a),w=Math.atan2((-m-x)/o,(-p-b)/a)-C;if(i&&w<0?w+=D:!i&&w>0&&(w-=D),s)return[k(S,a,C,w)];let T=K(Math.abs(w),Math.max(a,o)),ee=e=>{let t=a*Math.cos(e),n=o*Math.sin(e);return{x:S.x+l*t-u*n,y:S.y+u*t+l*n}},E=[],A=e;for(let e=1;e<=T;e++){let t=e===T?n:ee(C+w*e/T);E.push(O(A,t)),A=t}return E}let Oe={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},ke=/[\s,]*([A-Za-z]|[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)/y,Ae=/^[A-Za-z]$/;function je(e){let t=[];ke.lastIndex=0;for(let n=ke.exec(e);n;n=ke.exec(e))t.push(n[1]);let n=[],r={x:0,y:0},i=r,a,o=``,s=0;for(;s<t.length;){if(Ae.test(t[s]))o=t[s++];else if(o===``||o===`Z`||o===`z`)break;let e=o.toUpperCase();if(e===`Z`){n.push({op:`Z`,to:i}),r=i,a=void 0;continue}let c=Oe[e];if(c===void 0)break;let l=[],u=!1;for(;l.length<c&&s<t.length&&!Ae.test(t[s]);){let n=t[s];if(e===`A`&&(l.length===3||l.length===4)){let e=n[0];if(e!==`0`&&e!==`1`){u=!0;break}l.push(Number(e)),n.length>1?t[s]=n.slice(1):s++}else l.push(Number(n)),s++}if(u||l.length<c||!l.every(Number.isFinite))break;let d=o!==e,f=(e,t)=>d?{x:r.x+e,y:r.y+t}:{x:e,y:t},[p=0,m=0,h=0,g=0,_=0,v=0,y=0]=l,b;switch(e){case`M`:r=i=f(p,m),n.push({op:`M`,to:r}),o=d?`l`:`L`;break;case`L`:n.push({op:`L`,to:r=f(p,m)});break;case`H`:n.push({op:`L`,to:r={x:d?r.x+p:p,y:r.y}});break;case`V`:n.push({op:`L`,to:r={x:r.x,y:d?r.y+p:p}});break;case`C`:case`S`:{let t=e===`S`,i=t?a&&Me(n,`C`)?Ne(a,r):r:f(p,m);b=t?f(p,m):f(h,g),n.push({op:`C`,c1:i,c2:b,to:r=t?f(h,g):f(_,v)});break}case`Q`:case`T`:{let t=e===`T`;b=t?a&&Me(n,`Q`)?Ne(a,r):r:f(p,m),n.push({op:`Q`,c:b,to:r=t?f(p,m):f(h,g)});break}case`A`:n.push({op:`A`,rx:Math.abs(p),ry:Math.abs(m),rotation:h,large:g!==0,sweep:_!==0,to:r=f(v,y)})}a=b}return n}let Me=(e,t)=>e[e.length-1]?.op===t,Ne=(e,t)=>({x:2*t.x-e.x,y:2*t.y-e.y});function Pe(e,t){let n=e=>{let n=Number.parseFloat(t(e)??``);return Number.isFinite(n)?n:0};switch(e){case`path`:return je(t(`d`)??``);case`circle`:return Fe(n(`cx`),n(`cy`),n(`r`),n(`r`));case`ellipse`:return Fe(n(`cx`),n(`cy`),n(`rx`),n(`ry`));case`line`:return[{op:`M`,to:{x:n(`x1`),y:n(`y1`)}},{op:`L`,to:{x:n(`x2`),y:n(`y2`)}}];case`polyline`:case`polygon`:{let n=(t(`points`)??``).trim().split(/[\s,]+/).filter(Boolean).map(Number),r=[];for(let e=0;e+1<n.length&&Number.isFinite(n[e])&&Number.isFinite(n[e+1]);e+=2)r.push({x:n[e],y:n[e+1]});if(r.length<2)return[];let i=r.map((e,t)=>({op:t===0?`M`:`L`,to:e}));return e===`polygon`?[...i,{op:`Z`,to:r[0]}]:i}case`rect`:return Ie(n(`x`),n(`y`),n(`width`),n(`height`),t);default:return[]}}function Fe(e,t,n,r){if(!(n>0&&r>0))return[];let i=e=>({op:`A`,rx:n,ry:r,rotation:0,large:!1,sweep:!0,to:{x:e,y:t}});return[{op:`M`,to:{x:e+n,y:t}},i(e-n),i(e+n),{op:`Z`,to:{x:e+n,y:t}}]}function Ie(e,t,n,r,i){if(!(n>0&&r>0))return[];let a=e=>{let t=Number.parseFloat(i(e)??``);return t>=0?t:void 0},o=Math.min(a(`rx`)??a(`ry`)??0,n/2),s=Math.min(a(`ry`)??a(`rx`)??0,r/2),c=(e,t)=>({op:`L`,to:{x:e,y:t}});if(!(o>0&&s>0))return[{op:`M`,to:{x:e,y:t}},c(e+n,t),c(e+n,t+r),c(e,t+r),{op:`Z`,to:{x:e,y:t}}];let l=(e,t)=>({op:`A`,rx:o,ry:s,rotation:0,large:!1,sweep:!0,to:{x:e,y:t}});return[{op:`M`,to:{x:e+o,y:t}},c(e+n-o,t),l(e+n,t+s),c(e+n,t+r-s),l(e+n-o,t+r),c(e+o,t+r),l(e,t+r-s),c(e,t+s),l(e+o,t),{op:`Z`,to:{x:e+o,y:t}}]}function Le(e,t){let n=e=>({x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}),r=t[0]*t[3]-t[1]*t[2]<0;return e.map(e=>{switch(e.op){case`M`:case`L`:case`Z`:return{op:e.op,to:n(e.to)};case`C`:return{op:`C`,c1:n(e.c1),c2:n(e.c2),to:n(e.to)};case`Q`:return{op:`Q`,c:n(e.c),to:n(e.to)};case`A`:return{...e,...Re(e,t),sweep:r!==e.sweep,to:n(e.to)}}})}function Re({rx:e,ry:t,rotation:n},r){let i=n*Math.PI/180,a=Math.cos(i),o=Math.sin(i),s=(r[0]*a+r[2]*o)*e,c=(r[2]*a-r[0]*o)*t,l=(r[1]*a+r[3]*o)*e,u=(r[3]*a-r[1]*o)*t,d=s*s+c*c,f=s*l+c*u,p=l*l+u*u,m=(d+p)/2,h=Math.hypot((d-p)/2,f),g=m+h,_=Math.abs(f)<1e-12?d>=p?0:Math.PI/2:Math.atan2(g-d,f);return{rx:Math.sqrt(g),ry:Math.sqrt(Math.max(0,m-h)),rotation:_*180/Math.PI}}function ze(e){let t=F,n=e=>`${t(e.x)},${t(e.y)}`;return e.map(e=>{switch(e.op){case`M`:case`L`:return`${e.op}${n(e.to)}`;case`C`:return`C${n(e.c1)} ${n(e.c2)} ${n(e.to)}`;case`Q`:return`Q${n(e.c)} ${n(e.to)}`;case`A`:return`A${t(e.rx)},${t(e.ry)} ${t(e.rotation)} ${+!!e.large} ${+!!e.sweep} ${n(e.to)}`;case`Z`:return`Z`}}).join(``)}function Be(e){let{key:t,series:n,d:r}=e,i=e.width??1;if(!(Number.isFinite(i)&&i>0))throw RangeError(`describe.shape: width must be a finite number more than 0, got ${i}.`);let a=Ue(e.matrix);if(typeof r!=`string`)throw RangeError(`describe.shape: d must be path data, a string, got ${We(r)}.`);let o=je(r),s=o[0]?.op===`M`?Ce(a?Le(o,a):o):[];if(s.length===0)throw RangeError(`describe.shape: d must start with a move and draw something after it, got ${We(r)}.`);let c=[],l=0;for(let e of s){c.push(e.start);for(let t of e.segments){for(let e of P(t))c.push(e);l+=t.length}}let u=te(c);if(![u.x,u.y,u.width,u.height,l].every(Number.isFinite))throw RangeError(`describe.shape: d must stay finite${a?` once moved by matrix`:``}, got ${We(r)}.`);let d=U(`shape`,e.labelBounds),f=U(`shape`,e.nearbyLabels,`nearbyLabels`);if(s.every(Ve)&&l>0){let e={x:u.x+u.width/2,y:u.y+u.height/2};return de({key:t,series:n,walk:B([O(e,e)]),thickness:Math.min(u.width,u.height),outline:ae(s.map(e=>e.segments).filter(e=>e.length>0)),bounds:u,center:e,pivot:e,labelBounds:d,nearbyLabels:f})}let{segments:p,gaps:m}=He(s),h=B(p,m),g=i/2;return de({key:t,series:n,walk:h,thickness:i,outline:le(h),bounds:{x:u.x-g,y:u.y-g,width:u.width+i,height:u.height+i},center:h.point(.5),pivot:h.start,labelBounds:d,nearbyLabels:f})}let Ve=({closed:e,start:t,end:n})=>e||t.x===n.x&&t.y===n.y;function He(e){let t=[],n=[],r;for(let i of e){r&&(r.x!==i.start.x||r.y!==i.start.y)&&(n.push(t.length),t.push(O(r,i.start)));for(let e of i.segments)t.push(e);r=i.end}t.length===0&&t.push(O(e[0].start,e[0].start));let i=[0];for(let e of t)i.push(i[i.length-1]+e.length);let a=i[i.length-1];return{segments:t,gaps:n.map(e=>[i[e]/a,i[e+1]/a])}}function Ue(e){if(e===void 0)return e;if(!(Array.isArray(e)&&e.length===6&&e.every(Number.isFinite)))throw RangeError(`describe.shape: matrix must be six finite numbers [a, b, c, d, e, f], got ${We(e)}.`);return e}function We(e){return Array.isArray(e)?`[${e.map(We).join(`, `)}]`:typeof e==`string`?JSON.stringify(e.length>40?`${e.slice(0,40)}…`:e):String(e)}let Ge={bar:he,arc:pe,line:_e,point:xe,shape:Be};function Ke(e,t){return[1,0,0,1,e,t]}function qe(e,t){let n=Math.cos(e),r=Math.sin(e);return Qe([n,r,-r,n,0,0],t)}function Je(e,t=e,n){return Qe([e,0,0,t,0,0],n)}function Ye(...e){let t=[1,0,0,1,0,0];for(let n of e)t=Ze(t,n);return t}function Xe(e,t){let[n,r,i,a,o,s]=e;return{x:n*t.x+i*t.y+o,y:r*t.x+a*t.y+s}}function Ze(e,t){let[n,r,i,a,o,s]=e,[c,l,u,d,f,p]=t;return[n*c+i*l,r*c+a*l,n*u+i*d,r*u+a*d,n*f+i*p+o,r*f+a*p+s]}function Qe(e,t){if(!t)return e;let[n,r,i,a]=e;return[n,r,i,a,t.x-n*t.x-i*t.y,t.y-r*t.x-a*t.y]}let q={translate:Ke,rotate:qe,scale:Je,multiply:Ye,apply:Xe};function $e(e){let[t,n,r,i,a,o]=e,s=t*i-n*r;if(!Number.isFinite(s)||Math.abs(s)<1e-12)throw RangeError(`This transform can't be inverted: it has no area.`);return[i/s,-n/s,-r/s,t/s,(r*o-i*a)/s,(n*a-t*o)/s]}function et(e){let t=[];for(let[,n,r=``]of e.matchAll(/(matrix|translate|scale|rotate|skewX|skewY)\s*\(([^)]*)\)/g)){let e=r.trim().split(/[\s,]+/).filter(Boolean).map(Number);if(!e.every(Number.isFinite))continue;let[i=0,a,o,s=0,c=0,l=0]=e,u=e=>e*Math.PI/180;switch(n){case`matrix`:e.length===6&&t.push([i,a,o,s,c,l]);break;case`translate`:t.push(Ke(i,a??0));break;case`scale`:t.push(Je(i,a??i));break;case`rotate`:t.push(qe(u(i),a!==void 0&&o!==void 0?{x:a,y:o}:void 0));break;case`skewX`:t.push([1,0,Math.tan(u(i)),1,0,0]);break;case`skewY`:t.push([1,Math.tan(u(i)),0,1,0,0])}}return Ye(...t)}function tt(e,t,n){return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}let nt=(Math.sqrt(5)-1)/2;function rt(e,t){if(typeof e!=`object`||!e||typeof e.path!=`function`||!Number.isFinite(e.length))throw TypeError(`samplesAlong needs a MarkGeometry, as describe builds it.`);if(!Array.isArray(t))throw TypeError(`samplesAlong needs an array of points { x, y, value, at? }.`);t.forEach((e,t)=>{for(let n of[`x`,`y`,`value`]){let r=e?.[n];if(typeof r!=`number`||!Number.isFinite(r))throw RangeError(`samplesAlong: points[${t}].${n} must be a finite number, got ${String(r)}.`)}});let n=e.length>0?Math.min(4096,Math.ceil(e.length)+1):1,r=Array.from({length:n},(t,r)=>e.path(n===1?0:r/(n-1))),i=t.map((t,n)=>({index:n,sample:{t:at(e,r,t),value:t.value,...t.at===void 0?{}:{at:t.at}}})).sort((e,t)=>e.sample.t-t.sample.t||e.index-t.index).map(({sample:e})=>e);return e.gaps&&e.gaps.length>0?it(i,e.gaps):i}function it(e,t){let n=t.map(([e,t])=>(e+t)/2).sort((e,t)=>e-t),r=0;return e.map((t,i)=>{if(i===0)return t;let a=e[i-1].t;for(;r<n.length&&n[r]<=a;)r++;return r<n.length&&n[r]<=t.t?{...t,gapBefore:!0}:t})}function at(e,t,n){let r=t.length;if(r===1)return 0;let i=0,a=1/0;t.forEach((e,t)=>{let r=ot(e,n);r<a&&(i=t,a=r)});let o=t=>ot(e.path(t),n),s=Math.max(0,i-1)/(r-1),c=Math.min(r-1,i+1)/(r-1),l=c-nt*(c-s),u=s+nt*(c-s),d=o(l),f=o(u);for(let e=0;e<48;e++)d<=f?(c=u,u=l,f=d,l=c-nt*(c-s),d=o(l)):(s=l,l=u,d=f,u=s+nt*(c-s),f=o(u));let p=(s+c)/2,m=o(p)<a?p:i/(r-1);return m>0?m<1?m:1:0}function ot(e,t){return(e.x-t.x)**2+(e.y-t.y)**2}function st(e){let{kind:t,hint:n}=e,r=new Map,i={get:e=>r.get(e),resolve(e){let i=r.get(e);if(i!==void 0)return i;let a=r.size>0?[...r.keys()].join(`, `):`none`;throw RangeError(`Unknown ${t} "${String(e)}". Registered ${t}s: ${a}.${n?` ${n}`:``}`)},register(e,n){if(typeof e!=`string`||e===``)throw TypeError(`A ${t} needs a non-empty string name, got ${JSON.stringify(e)}.`);if(n===void 0)throw TypeError(`Registering ${t} "${e}" needs a value.`);r.set(e,n)},names:()=>[...r.keys()]};for(let[t,n]of Object.entries(e.entries??{}))i.register(t,n);return i}let ct=[`hover`,`enter`,`update`,`exit`,`decorate`];function lt(e,t){let n={};for(let t of Object.keys(e??{}))if(!ct.includes(t))throw TypeError(`on.${t} isn't an effect slot. Use one of: ${ct.join(`, `)}.`);for(let r of ct){let i=e?.[r];if(i!==void 0){if(typeof i==`string`){let e=t.resolve(i)();if(!ut(e))throw TypeError(`Preset "${i}" for on.${r} didn't return a mark effect; it returned ${dt(e)}.`);n[r]=e}else{if(!ut(i))throw TypeError(`on.${r} needs a mark effect (kind "geometry" or "data") or a preset name, got ${dt(i)}.`);n[r]=i}}}return n}function ut(e){if(typeof e!=`object`||!e)return!1;let t=e;return(t.kind===`geometry`||t.kind===`data`)&&typeof t.run==`function`&&typeof t.end==`function`&&typeof t.clear==`function`}function dt(e){if(typeof e!=`object`||!e)return e===null?`null`:typeof e;let t=e.kind;return t===`transition`?`a transition effect, which runs between two charts rather than on one mark`:t===`geometry`||t===`data`?`a ${t} effect without run(), end() and clear()`:t===void 0?`an object with no kind`:`an effect of kind ${JSON.stringify(t)}`}function ft(e,t){let n={...e};for(let[e,r]of Object.entries(t??{}))r===void 0?delete n[e]:n[e]=r;return n}function pt(e){let{clock:t,motion:n,layer:r,mark:i}=e,a=new AbortController,o=[];return{context:{signal:a.signal,motion:n,mark:i,layer:r,icons:e.icons,batch:e.batch,...e.previous?{previous:e.previous}:{},tween(e){let r=e.signal,i=y({...e,signal:r??a.signal},{clock:t,motion:n});return r&&r!==a.signal&&(a.signal.aborted?i.cancel():a.signal.addEventListener(`abort`,()=>i.cancel(),{once:!0})),i},onChange(e){o.push(e)}},abort(){a.abort()},change(e,t){for(let n of[...o])n(e,t)},clear(){a.abort(),r.clear(),i.reset(),o=[]}}}let mt=[`decorate`,`enter`,`update`,`exit`,`hover`],ht={get:()=>void 0},gt={place(){},update(){},remove(){}};function _t(e){let{surface:n}=e,r=e.effects,i=e.motion??v,o=e.clock??a,s=e.icons??ht,c=new Map,l=new Set,u=!1,d=!1,f=0,p=i.subscribe(()=>{i.mode===`off`&&E()});function m(e){let t=e.mark.key,n=c.get(t);if(n)return n.mark=e.mark,n.data=e.data,n;let r={key:t,mark:e.mark,data:e.data,resting:e.data,runs:new Map,applied:{},handle:void 0,exiting:void 0};return c.set(t,r),r}function h(e,t,n,a,c={}){let{previous:l,done:u}=c,d=r[t];if(!d){u?.();return}let p=e.runs.get(t);p&&b(p);let m={entry:e,slot:t,order:c.order??++f,effect:d,data:n,batch:a,previous:l,style:{},state:`running`,done:u,scope:pt({clock:o,motion:i,icons:s,batch:a,previous:l,layer:x(e.key,t,()=>m.order,()=>m.state!==`cleared`),mark:S(()=>m)})};e.runs.set(t,m);let h=c.mark??e.mark,v=m.scope.context;try{if(c.end||i.mode===`off`)d.kind===`data`?d.end(h,n,v):d.end(h,v),g(m);else{let e=d.kind===`data`?d.run(h,n,v):d.run(h,v);Promise.resolve(e).then(()=>g(m),e=>_(m,e))}}catch(e){_(m,e)}}function g(e){e.state===`running`&&(e.state=`ended`,y(e))}function _(e,n){let{signal:r}=e.scope.context;(!r.aborted||n!==r.reason&&n?.name!==`AbortError`)&&(t(n),b(e))}function y(e){let t=e.done;e.done=void 0,t?.()}function b(e){if(e.state===`cleared`)return;e.state=`cleared`;let{entry:n}=e;n.runs.get(e.slot)===e&&n.runs.delete(e.slot),e.scope.abort();try{e.effect.clear(e.scope.context)}catch(e){t(e)}e.scope.clear(),y(e)}function x(e,t,r,i){let a,o=()=>i()?a??(a=n.group(e,t,r())):void 0;return{icon:(e,t)=>o()?.icon(e,t)??gt,path:(e,t)=>o()?.path(e,t)??gt,text:(e,t)=>o()?.text(e,t)??gt,clear(){let e=a;a=void 0,e?.clear()}}}function S(e){return{set(t){let n=e();n.state!==`cleared`&&(n.style=ft(n.style,t),C(n.entry))},reset(){let t=e();Object.keys(t.style).length!==0&&(t.style={},C(t.entry))}}}function C(e){let t=[...e.runs.values()].sort((e,t)=>e.order-t.order),n=Object.assign({},...t.map(e=>e.style)),r=e.applied;if(e.applied=n,Object.keys(n).length===0){Object.keys(r).length>0&&w(e).reset();return}let i={},a=!1;for(let e of new Set([...Object.keys(r),...Object.keys(n)]))r[e]!==n[e]&&(i[e]=n[e],a=!0);a&&w(e).set(i)}function w(e){return e.handle??(e.handle=n.mark(e.key))}function T(e){c.get(e.key)===e&&c.delete(e.key),l.delete(e.key);let t=e.exiting;e.exiting=void 0;for(let t of[...e.runs.values()])b(t);e.handle=void 0,t?.()}function ee(e){let t=e.exiting;if(!t)return;e.exiting=void 0;let n=e.runs.get(`exit`);n&&b(n),t()}function E(){for(let e of[...c.values()])for(let t of[...e.runs.values()]){if(t.state!==`running`||e.runs.get(t.slot)!==t)continue;let n=t.done;t.done=void 0,h(e,t.slot,O(e,t),t.batch,{previous:t.previous,done:n,order:t.order})}}function D(e){let t=new Map;for(let n of[...c.values()]){let r=n.runs.get(e);r&&(t.set(n,r.order),b(r))}return t}function O(e,t){let n=t.data.previous;return n&&!e.data.previous?vt(e.data,n):e.data}return{enter(e){d||e.forEach((t,n)=>{let r=m(t);r.resting=t.data,ee(r);let i={index:n,count:e.length};h(r,`decorate`,t.data,i),h(r,`enter`,t.data,i)})},update(e){if(d)return;let t=new Set(e.map(e=>e.mark.key));for(let e of[...c.values()]){let n=e.runs.get(`update`);n&&!t.has(e.key)&&b(n)}e.forEach((t,n)=>{let r=c.get(t.mark.key),i=t.from??r?.mark,a=r&&!t.data.previous?vt(t.data,r.resting):t.data,o=m(t);o.resting=t.data,h(o,`update`,a,{index:n,count:e.length},{previous:i})})},exit(e){if(d)return Promise.resolve();let t=e.map((t,n)=>{let i=m(t);ee(i),l.delete(i.key);for(let e of[...i.runs.values()])b(e);return new Promise(a=>{i.exiting=a,r.exit?h(i,`exit`,t.data,{index:n,count:e.length},{done:()=>{i.exiting&&c.get(i.key)===i&&T(i)}}):T(i)})});return Promise.all(t).then(()=>void 0)},hover(e){d||e.forEach((t,n)=>{let r=m(t);r.exiting||(l.add(r.key),u||h(r,`hover`,t.data,{index:n,count:e.length}))})},leave(e=[...l]){for(let t of e){l.delete(t);let e=c.get(t)?.runs.get(`hover`);e&&b(e)}},change(e,n){let r=c.get(e.key);if(r){r.mark=e,n&&(r.data=n,u||(r.resting=n));for(let n of[...r.runs.values()])if(n.state!==`cleared`)try{n.scope.change(e,O(r,n))}catch(e){t(e),b(n)}}},interrupt(){if(!d){u=!0;for(let e of[...c.values()]){let t=e.runs.get(`hover`);t&&b(t)}}},settle(){if(!u)return;u=!1;for(let e of c.values())e.exiting||(e.resting=e.data);let e=[...l];e.forEach((t,n)=>{let r=c.get(t);r&&h(r,`hover`,r.data,{index:n,count:e.length})})},swap(e,t){if(d)return;let n=mt.filter(t=>e[t]!==r[t]);r=e;for(let e of n)if(e===`decorate`){let n=D(e);t.forEach((r,i)=>{let a=c.get(r.mark.key)??m(r);a.exiting||h(a,e,r.data,{index:i,count:t.length},{mark:r.mark,order:n.get(a)})})}else if(e===`hover`){if(D(e),u)continue;let t=[...l];t.forEach((n,r)=>{let i=c.get(n);i&&h(i,e,i.data,{index:r,count:t.length})})}else for(let t of[...c.values()]){let n=t.runs.get(e);if(!n)continue;let r=n.done;n.done=void 0;let i=O(t,n);b(n),h(t,e,i,n.batch,{previous:n.previous,done:r,order:n.order,end:!0})}},destroy(){if(!d){d=!0,u=!1,p();for(let e of[...c.values()])T(e);l.clear()}}}}function vt(e,t){return{datum:e.datum,samples:e.samples,related:t=>e.related(t),previous:t}}let yt={value:`Sorted highest first`,key:`Sorted A to Z`,none:`In data order`,custom:`Sorted`};function bt(e){let t=[],{series:n}=e;e.label===void 0?n&&(n.length!==1||n[0]!==`value`)&&t.push(`Showing ${J(n)}`):t.push(e.label),e.sort&&t.push(yt[e.sort]);let{changed:r,added:i,removed:a}=e;return!n&&r.length>0&&t.push(r.length<=3?`${J(r)} changed`:`${r.length} of ${e.count} changed`),i.length>0&&t.push(`Added ${i.length<=3?J(i):i.length}`),a.length>0&&t.push(`Removed ${a.length<=3?J(a):a.length}`),t.join(`. `)}function J(e){return e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function xt(e){let t=e.ownerDocument.createElement(`div`);t.className=`ec-announcer ec-visually-hidden`,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-atomic`,`true`),e.after(t);let n=!1;return{say(e){e!==``&&(n=!n,t.textContent=n?e:`${e} `)},destroy(){t.remove()}}}function Y(e,t={},n){let r=(n?.ownerDocument??document).createElementNS(`http://www.w3.org/2000/svg`,e);return X(r,t),n?.appendChild(r),r}function X(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.removeAttribute(n):e.setAttribute(n,typeof r==`number`?F(r):r)}function St(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 ${F(e)} ${F(t)}`}}function wt(e){let[t,n,r,i,a,o]=e;return`matrix(${[t,n,r,i].map(Tt).join(` `)} ${F(a)} ${F(o)})`}function Tt(e){let t=Math.round(e*1e6)/1e6;return t===0?`0`:String(t)}let Et=.16;function Dt(e,t,n,r){let i=t(e.text.replace(/\d/g,`0`),n,r);return{x:(e.anchor===`start`?e.x:e.anchor===`end`?e.x-i:e.x-i/2)-Et*r,y:e.y-1.05*r,width:i+2*Et*r,height:1.3*r}}function Ot(e,t){X(e,{x:t.x,y:t.y,"text-anchor":t.anchor}),e.textContent!==t.text&&(e.textContent=t.text)}function kt(e){let t=new Map;return Object.assign((n,r,i)=>{if(n===``)return 0;let a=`${r}\n${i}\n${n}`,o=t.get(a);if(o!==void 0)return o;let s=0,c=Y(`text`,{class:r,visibility:`hidden`,"aria-hidden":`true`},e);return typeof c.getComputedTextLength==`function`&&e.isConnected&&(c.textContent=n,s=c.getComputedTextLength()),c.remove(),s>0?(t.set(a,s),s):n.length*i*.6},{clear:()=>t.clear()})}let At=12.5,jt=12.5,Mt={label:!0,value:!0},Nt=.36;function Pt(e){let{x:t,y:n,stack:r,data:i}=e,a=e.orientation;if(a!==void 0&&a!==`horizontal`&&a!==`vertical`)throw TypeError(`barChart: orientation must be "horizontal" or "vertical", got ${String(a)}.`);if(r!==void 0){if(!Array.isArray(r)||r.length===0)throw TypeError(`barChart: stack needs at least one numeric field.`);let e=new Set;for(let t of r){if(e.has(t))throw TypeError(`barChart: "${t}" appears twice in stack.`);e.add(t)}}if(a===void 0){if(t!==void 0&&n!==void 0){let e=en(i,$t(t));if(e!==en(i,$t(n)))a=e?`horizontal`:`vertical`;else if(i.length===0)a=`horizontal`;else throw RangeError(`barChart: ${e?`x and y both hold numbers`:`neither x nor y holds numbers`}, so it can't tell which is the category. Set orientation: "horizontal" (categories along y) or "vertical" (categories along x).`)}else if(r!==void 0&&(t!==void 0||n!==void 0))a=n===void 0?`vertical`:`horizontal`;else throw TypeError(`barChart needs x and y (the axis whose values aren't numbers is the category), or one of them plus stack.`)}let o=a===`horizontal`,s=o?n:t,c=o?t:n;if(s===void 0)throw TypeError(`barChart: a ${a} chart takes its categories from ${o?`y`:`x`}.`);let l=$t(s),u;if(r!==void 0)u=r.map(e=>({series:e,value:$t(e)}));else if(c!==void 0)u=[{series:typeof c==`string`?c:`value`,value:$t(c)}];else throw TypeError(`barChart needs values: ${o?`x`:`y`} set to a numeric field, or stack.`);return{orientation:a,category:l,key:e.key===void 0?l:$t(e.key),series:u}}function Ft(e){let t=Gt(Wt(e),e.sort),n=Kt(t.map(e=>e.total)),r=t.map(t=>e.format(t.total)),i=n.ticks.map(e.format),a=(e.encoding.orientation===`horizontal`?Jt:Yt)(e,t,n,r,i),o=It(a,t,r,e.measure);return{width:a.bands.width,height:a.bands.height,orientation:a.orientation,frame:a,rows:t.map((t,n)=>Vt(a,{...t,slot:n,text:r[n],drawn:{label:n%o.every===0,value:o.values}},e.measure)),ticks:n.ticks.map((e,t)=>Ht(a,e,i[t])),labels:o}}function It(e,t,n,r){let i=t.map((t,r)=>Bt(e,r,t.total,t.category,n[r])),a=e.orientation===`horizontal`,o=!zt(Rt(i.map(({value:e})=>e),r,`ec-value`,jt),a),s=e=>Rt(i.filter((t,n)=>n%e===0).map(({label:e})=>e),r,`ec-label`,At),c=0;for(;Lt(c)<t.length&&zt(s(Lt(c)),a);)c++;return{every:Lt(c),values:o}}let Lt=e=>[1,2,5][e%3]*10**Math.floor(e/3);function Rt(e,t,n,r){return e.filter(e=>e.text!==``).map(e=>Dt(e,t,n,r))}function zt(e,t){let n=t?e.map(({x:e,y:t,width:n,height:r})=>({x:t,y:e,width:r,height:n})):[...e];n.sort((e,t)=>e.x-t.x);let r=[];for(let e of n){for(let t=r.length-1;t>=0;t--)r[t].x+r[t].width<=e.x&&r.splice(t,1);if(r.some(t=>t.y<e.y+e.height&&e.y<t.y+t.height))return!0;r.push(e)}return!1}function Bt(e,t,n,r,i){let{scale:a,bands:o}=e,s=n<0,c=Ut(a)(n),l=o.start+t*o.band;if(e.orientation===`horizontal`){let e=l+o.band/2+At*Nt;return{label:{x:a.label,y:e,anchor:`end`,text:r},value:{x:s?c-6:c+6,y:e,anchor:s?`end`:`start`,text:i}}}let u=l+o.band/2;return{label:{x:u,y:a.label,anchor:`middle`,text:r},value:{x:u,y:s?c+6+jt*.8:c-6,anchor:`middle`,text:i}}}function Vt(e,t,n){let{scale:r,bands:i}=e,a=Ut(r),o=Math.abs(r.extent/(r.hi-r.lo)),s=t.values.reduce((e,t)=>e+t.value,0),c=s<0,l=a(0),u=a(s),d=i.start+t.slot*i.band,f={key:t.key,...t.values.length===1?{series:t.values[0].series}:{},radius:4,gap:2,segments:t.values.map(e=>({series:e.series,size:Math.max(0,c?-e.value:e.value)*o}))},p=t.drawn??Mt,m={key:t.key,datum:t.datum,index:t.index,slot:t.slot,values:t.values,total:s,category:t.category,drawn:p},{label:h,value:g}=Bt(e,t.slot,s,p.label?t.category:``,p.value?t.text:``),_=()=>[...Rt([h],n,`ec-label`,At),...Rt([g],n,`ec-value`,jt)];if(e.orientation===`horizontal`){let e=he({...f,x:Math.min(l,u),y:d+(i.band-i.thickness)/2,width:Math.abs(u-l),height:i.thickness,baseline:c?`right`:`left`,labelBounds:_()});return{...m,geometry:e,data:Zt(t.datum,s,e),label:h,value:g,hit:{x:0,y:d,width:i.width,height:i.band}}}let v=d+i.band/2,y=he({...f,x:v-i.thickness/2,y:Math.min(l,u),width:i.thickness,height:Math.abs(u-l),baseline:c?`top`:`bottom`,labelBounds:_()});return{...m,geometry:y,data:Zt(t.datum,s,y),label:h,value:g,hit:{x:d,y:0,width:i.band,height:i.height}}}function Ht(e,t,n){let{bands:r}=e,i=Ut(e.scale)(t);if(e.orientation===`horizontal`){let e=r.start+r.span;return{value:t,line:{x1:i,y1:r.start,x2:i,y2:e},label:{x:i,y:e+16,anchor:`middle`,text:n}}}return{value:t,line:{x1:r.start,y1:i,x2:r.start+r.span,y2:i},label:{x:r.start-8,y:i+11*Nt,anchor:`end`,text:n}}}function Ut(e){let t=e.extent/(e.hi-e.lo);return n=>e.from+(n-e.lo)*t}function Wt({data:e,encoding:t}){let n=new Set;return e.map((e,r)=>{let i=String(t.key(e,r));if(n.has(i))throw Error(`barChart: two rows have the key "${i}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(i);let a=t.series.map(({series:t,value:n})=>({series:t,value:tn(n(e,r),t,i)}));if(a.some(e=>e.value>0)&&a.some(e=>e.value<0))throw RangeError(`barChart: the stack for "${i}" mixes positive and negative values, which isn't supported yet.`);let o=a.reduce((e,t)=>e+t.value,0);return{key:i,category:String(t.category(e,r)??``),datum:e,index:r,values:a,total:o}})}function Gt(e,t){if(t===void 0||t===`none`)return e;if(t===`value`)return[...e].sort((e,t)=>t.total-e.total);if(t===`key`)return[...e].sort((e,t)=>e.key.localeCompare(t.key,void 0,{numeric:!0}));if(typeof t==`function`)return[...e].sort((e,n)=>t(e.datum,n.datum));throw TypeError(`barChart: sort must be "value", "key", "none" or a comparator, got ${String(t)}.`)}function Kt(e){let t=e.reduce((e,t)=>Math.min(e,t),0),n=e.reduce((e,t)=>Math.max(e,t),0);t===n&&(n=1);let r=qt((n-t)/4);t=nn(Math.floor(t/r)*r),n=nn(Math.ceil(n/r)*r);let i=Math.round((n-t)/r),a=Array.from({length:i+1},(e,n)=>nn(t+n*r));return{lo:t,hi:n,ticks:a}}function qt(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 Jt(e,t,n,r,i){let{width:a,measure:o}=e,s=t.length,c=Qt(t.map(e=>e.category),`ec-label`,At,o),l=Qt(r,`ec-value`,jt,o),u=Qt(i,`ec-tick`,11,o),{positive:d,negative:f}=Xt(e,t),p=n.lo<0?l+6:0,m=Math.max(c+10+p+f,u/2+2),h=Math.max(l+6+4+d,u/2+2),g=e.height===void 0||s===0?34:Math.max(0,e.height-4-26)/s;return{orientation:`horizontal`,scale:{lo:n.lo,hi:n.hi,from:m,extent:Math.max(0,a-m-h),label:m-10-p},bands:{start:4,band:g,thickness:g*20/34,span:s*g,width:a,height:e.height??4+s*g+26}}}function Yt(e,t,n,r,i){let{width:a,measure:o}=e,s=t.length,c=e.height??300,l=Qt(i,`ec-tick`,11,o),{positive:u,negative:d}=Xt(e,t),f=(n.hi>0?20.5:4)+u,p=n.lo<0?18.5:0,m=26+p+d,h=l+8+2,g={x:h,y:f,width:Math.max(0,a-h-8),height:Math.max(0,c-f-m)},_=s>0?g.width/s:0,v=g.y+g.height;return{orientation:`vertical`,scale:{lo:n.lo,hi:n.hi,from:v,extent:-g.height,label:v+p+18},bands:{start:g.x,band:_,thickness:Math.min(_*20/34,72),span:g.width,width:a,height:c}}}function Xt(e,t){let n=e.room??0;return{positive:t.some(e=>e.total>0)?n:0,negative:t.some(e=>e.total<0)?n:0}}function Zt(e,t,n){let r=e=>n.length>0?t*e/n.length:0,i={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related(t){let a=n.segments?.find(e=>e.series===t);if(!a)return;let o=Math.hypot(a.start.x-n.start.x,a.start.y-n.start.y);return{datum:e,samples:[{t:0,value:r(o)},{t:1,value:r(o+a.length)}],related:i.related}}};return i}function Qt(e,t,n,r){return e.reduce((e,i)=>Math.max(e,r(i,t,n)),0)}function $t(e){return typeof e==`function`?e:t=>t[e]}function en(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=t(e[r],r);if(i!=null){if(typeof i!=`number`)return!1;n=!0}}return n}function tn(e,t,n){if(e==null)return 0;if(typeof e==`number`&&Number.isFinite(e))return e;throw RangeError(`barChart: "${t}" for "${n}" must be a finite number, got ${typeof e==`string`?JSON.stringify(e):String(e)}.`)}function nn(e){let t=Number(e.toPrecision(12));return t===0?0:t}let rn={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`]]}},an=[`surface`,`text`,`text-muted`,`grid`,`axis`,`focus`,`negative`],Z=Object.fromEntries(an.map(e=>[e,rn.light[e]]));function on(e){let t=(Math.max(1,Math.floor(e))-1)%8+1,[n,r]=rn.light.series[t-1];return{color:`var(--ec-series-${t}, ${n})`,strong:`var(--ec-series-${t}-strong, ${r})`}}function sn(e){if(e===`mark`)return`var(--ec-mark, ${on(1).color})`;if(e===`mark-strong`)return`var(--ec-mark-strong, ${on(1).strong})`;let t=Z[e];if(t!==void 0)return`var(--ec-${e}, ${t})`;let n=/^series-(\d+)(-strong)?$/.exec(e);if(n){let e=on(Number(n[1]));return n[2]?e.strong:e.color}return e}function cn(e){return{"--ec-mark":e?.color,"--ec-mark-strong":e?.strong}}function ln(e,t){let n=[...an,`ring`,`dim-opacity`].map(t=>`--ec-${t}: ${e[t]};`);return e.series.forEach(([e,t],r)=>n.push(`--ec-series-${r+1}: ${e};`,`--ec-series-${r+1}-strong: ${t};`)),n.map(e=>t+e).join(`
2
+ `)}let un=`/* expressive-charts: theme tokens and default styles. Every rule has zero specificity, so your CSS wins. */
3
+ ${`:where(:root, [data-theme="light"]) {
4
+ ${ln(rn.light,` `)}
6
5
  }
7
6
  @media (prefers-color-scheme: dark) {
8
7
  :where(:root:not([data-theme="light"])) {
9
- ${Uo(gr.dark," ")}
8
+ ${ln(rn.dark,` `)}
10
9
  }
11
10
  }
12
11
  :where([data-theme="dark"]) {
13
- ${Uo(gr.dark," ")}
14
- }`,El=`/* expressive-charts: theme tokens and default styles. Every rule has zero specificity, so your CSS wins. */
15
- ${Sl}
12
+ ${ln(rn.dark,` `)}
13
+ }`}
16
14
  :where(.ec-chart) { display: block; max-width: 100%; height: auto; overflow: visible; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
17
15
  :where(.ec-chart text) { font-variant-numeric: tabular-nums; }
18
- :where(.ec-chart .ec-gridline) { stroke: var(--ec-grid, ${De.grid}); stroke-width: 1; }
19
- :where(.ec-chart .ec-baseline) { stroke: var(--ec-axis, ${De.axis}); stroke-width: 1; }
20
- :where(.ec-chart .ec-tick) { fill: var(--ec-text-muted, ${De["text-muted"]}); font-size: 11px; }
21
- :where(.ec-chart .ec-label) { fill: var(--ec-text, ${De.text}); font-size: 12.5px; }
22
- :where(.ec-chart .ec-value, .ec-chart .ec-text) { fill: var(--ec-text, ${De.text}); font-size: 12.5px; font-weight: 600; }
23
- :where(.ec-overlay .ec-text) { fill: var(--ec-text, ${De.text}); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
16
+ :where(.ec-chart .ec-gridline) { stroke: var(--ec-grid, ${Z.grid}); stroke-width: 1; }
17
+ :where(.ec-chart .ec-baseline) { stroke: var(--ec-axis, ${Z.axis}); stroke-width: 1; }
18
+ :where(.ec-chart .ec-tick) { fill: var(--ec-text-muted, ${Z[`text-muted`]}); font-size: 11px; }
19
+ :where(.ec-chart .ec-label) { fill: var(--ec-text, ${Z.text}); font-size: 12.5px; }
20
+ :where(.ec-chart .ec-value, .ec-chart .ec-text) { fill: var(--ec-text, ${Z.text}); font-size: 12.5px; font-weight: 600; }
21
+ :where(.ec-overlay .ec-text) { fill: var(--ec-text, ${Z.text}); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
24
22
  :where(.ec-chart .ec-hit) { fill: transparent; }
25
23
  :where(.ec-chart .ec-mark:focus) { outline: none; }
26
24
  :where(.ec-chart .ec-focus) { pointer-events: none; }
27
- :where(.ec-chart .ec-focus-ring) { fill: none; stroke: var(--ec-focus, ${De.focus}); }
28
- :where(.ec-chart .ec-focus-gap) { fill: var(--ec-surface, ${De.surface}); stroke: var(--ec-surface, ${De.surface}); }
25
+ :where(.ec-chart .ec-focus-ring) { fill: none; stroke: var(--ec-focus, ${Z.focus}); }
26
+ :where(.ec-chart .ec-focus-gap) { fill: var(--ec-surface, ${Z.surface}); stroke: var(--ec-surface, ${Z.surface}); }
29
27
  :where(.ec-chart .ec-body > *) { transition: opacity var(--ec-hover-duration, 100ms) ease-out; }
30
28
  :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; }
31
29
  :where(.ec-chart .ec-hot .ec-segment) { fill: var(--ec-mark-strong); }
32
30
  :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; }
33
31
  :where(.ec-chart .ec-hot .ec-stroke) { stroke: var(--ec-mark-strong); }
34
- :where(.ec-chart .ec-end) { fill: var(--ec-mark); stroke: var(--ec-surface, ${De.surface}); stroke-width: 2; }
35
- :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; }
32
+ :where(.ec-chart .ec-end) { fill: var(--ec-mark); stroke: var(--ec-surface, ${Z.surface}); stroke-width: 2; transition: opacity var(--ec-hover-duration, 100ms) ease-out; }
33
+ :where(.ec-chart .ec-dot) { fill: var(--ec-mark); stroke: var(--ec-surface, ${Z.surface}); stroke-width: 2; opacity: 0; transition: opacity var(--ec-hover-duration, 100ms) ease-out, fill var(--ec-hover-duration, 100ms) ease-out; }
36
34
  :where(.ec-chart .ec-hot .ec-dot) { fill: var(--ec-mark-strong); opacity: 1; }
37
35
  :where(.ec-chart .ec-alone .ec-dot) { opacity: 1; }
38
- :where(.ec-chart .ec-crosshair) { stroke: var(--ec-axis, ${De.axis}); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
39
- :where(.ec-chart .ec-column:focus) { outline: none; }
36
+ :where(.ec-chart .ec-crosshair) { stroke: var(--ec-axis, ${Z.axis}); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
37
+ :where(.ec-chart .ec-column:focus, .ec-chart .ec-stop:focus) { outline: none; }
40
38
  :where(.ec-chart .ec-lines, .ec-chart .ec-points) { pointer-events: none; }
41
- :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, opacity var(--ec-hover-duration, 100ms) ease-out; }
39
+ :where(.ec-chart .ec-slice) { fill: var(--ec-mark); stroke: var(--ec-surface, ${Z.surface}); stroke-width: 2; stroke-linejoin: round; transition: fill var(--ec-hover-duration, 100ms) ease-out, opacity var(--ec-hover-duration, 100ms) ease-out; }
42
40
  :where(.ec-chart .ec-hot .ec-slice) { fill: var(--ec-mark-strong); }
43
- :where(.ec-chart .ec-center-value) { fill: var(--ec-text, ${De.text}); font-size: 26px; font-weight: 600; }
44
- :where(.ec-chart .ec-center-label) { fill: var(--ec-text-muted, ${De["text-muted"]}); font-size: 12.5px; }
41
+ :where(.ec-chart .ec-center-value) { fill: var(--ec-text, ${Z.text}); font-size: 26px; font-weight: 600; }
42
+ :where(.ec-chart .ec-center-label) { fill: var(--ec-text-muted, ${Z[`text-muted`]}); font-size: 12.5px; }
45
43
  :where(.ec-chart.ec-hovering .ec-mark:not(.ec-hot) > .ec-body > *) { opacity: var(--ec-dim-opacity, 0.3); }
44
+ :where(.ec-chart.ec-hovering .ec-line:not(.ec-hot-line) > .ec-body > *, .ec-chart.ec-hovering .ec-alone:not(.ec-hot) > .ec-body > *) { opacity: var(--ec-dim-opacity, 0.3); }
45
+ :where(.ec-hovering .ec-run:not(.ec-hot) > .ec-follow) { opacity: var(--ec-dim-opacity, 0.3); }
46
+ :where(.ec-follow) { transition: opacity var(--ec-hover-duration, 100ms) ease-out; }
46
47
  :where(.ec-chart.ec-morphing .ec-marks) { visibility: hidden; }
47
48
  :where(.ec-switch) { display: grid; grid-template-columns: minmax(0, 1fr); position: relative; }
48
49
  :where(.ec-switch-view) { grid-area: 1 / 1; min-width: 0; }
49
50
  :where(.ec-switch-view.ec-switch-inactive) { visibility: hidden; }
50
51
  :where(.ec-switch-view.ec-switching .ec-focus, .ec-switch-view.ec-switching .ec-overlay, .ec-switch-view.ec-switching .ec-columns) { visibility: hidden; }
51
52
  :where(.ec-switch-overlay) { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
52
- :where(.ec-motion-switch) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--ec-text, ${De.text}); font-size: 13px; }
53
+ :where(.ec-motion-switch) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--ec-text, ${Z.text}); font-size: 13px; }
53
54
  :where(.ec-motion-label) { font-weight: 600; }
54
- :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}); }
55
+ :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, ${Z.surface}); }
55
56
  :where(.ec-motion-modes button) { font: inherit; color: inherit; border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
56
- :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); }
57
+ :where(.ec-motion-modes button:hover, .ec-motion-modes button[aria-pressed="true"]) { background: color-mix(in srgb, var(--ec-focus, ${Z.focus}) 12%, transparent); }
57
58
  :where(.ec-motion-modes button[aria-pressed="true"]) { font-weight: 600; }
58
- :where(.ec-motion-modes button:focus-visible) { outline: 2px solid var(--ec-focus, ${De.focus}); outline-offset: 2px; }
59
+ :where(.ec-motion-modes button:focus-visible) { outline: 2px solid var(--ec-focus, ${Z.focus}); outline-offset: 2px; }
59
60
  @media (forced-colors: active) {
60
61
  /* Forced colours drop the pressed mode's tint, which leaves only its weight: it takes the viewer's selection colours. */
61
62
  :where(.ec-motion-modes button[aria-pressed="true"]) { background: Highlight; color: HighlightText; }
62
63
  }
63
- :where(.ec-motion-hint) { flex: 1 1 220px; min-width: 0; color: var(--ec-text-muted, ${De["text-muted"]}); }
64
- :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; }
65
- :where(.ec-play:hover) { background: color-mix(in srgb, var(--ec-focus, ${De.focus}) 12%, var(--ec-surface, ${De.surface})); }
66
- :where(.ec-play:focus-visible) { outline: 2px solid var(--ec-focus, ${De.focus}); outline-offset: 2px; }
64
+ :where(.ec-motion-hint) { flex: 1 1 220px; min-width: 0; color: var(--ec-text-muted, ${Z[`text-muted`]}); }
65
+ :where(.ec-play) { font: inherit; font-size: 13px; font-weight: 600; color: var(--ec-text, ${Z.text}); border: 1px solid var(--ec-ring, color-mix(in srgb, currentColor 12%, transparent)); background: var(--ec-surface, ${Z.surface}); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
66
+ :where(.ec-play:hover) { background: color-mix(in srgb, var(--ec-focus, ${Z.focus}) 12%, var(--ec-surface, ${Z.surface})); }
67
+ :where(.ec-play:focus-visible) { outline: 2px solid var(--ec-focus, ${Z.focus}); outline-offset: 2px; }
67
68
  :where(.ec-chart .ec-leaving, .ec-chart .ec-overlay) { pointer-events: none; }
68
69
  :where(.ec-attached.ec-dimmed) { opacity: var(--ec-dim-opacity, 0.3); }
69
70
  :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; }
70
71
  :where(.ec-tooltip-layer) { position: relative; height: 0; }
71
- :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); }
72
+ :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, ${Z.surface}); color: var(--ec-text, ${Z.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); }
72
73
  :where(.ec-tooltip.ec-tooltip-shown) { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--ec-hover-duration, 100ms) ease-out; }
73
74
  :where(.ec-tooltip-bridge) { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; }
74
75
  :where(.ec-tooltip-shown + .ec-tooltip-bridge) { pointer-events: auto; }
75
76
  :where(.ec-tooltip-through > .ec-tooltip, .ec-tooltip-through > .ec-tooltip-bridge) { pointer-events: none; }
76
77
  :where(.ec-tooltip-title) { font-weight: 600; }
77
- :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}); }
78
+ :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, ${Z.text}); }
78
79
  :where(.ec-legend-item) { display: inline-flex; align-items: center; gap: 6px; }
79
80
  :where(.ec-legend-swatch) { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--ec-mark); forced-color-adjust: none; }
80
- :where(.ec-table) { margin-top: 8px; font-size: 13px; line-height: 1.4; color: var(--ec-text, ${De.text}); }
81
- :where(.ec-table summary) { cursor: pointer; color: var(--ec-text-muted, ${De["text-muted"]}); font-weight: 600; }
82
- :where(.ec-table summary:focus-visible) { outline: 2px solid var(--ec-focus, ${De.focus}); outline-offset: 2px; border-radius: 2px; }
81
+ :where(.ec-table) { margin-top: 8px; font-size: 13px; line-height: 1.4; color: var(--ec-text, ${Z.text}); }
82
+ :where(.ec-table summary) { cursor: pointer; color: var(--ec-text-muted, ${Z[`text-muted`]}); font-weight: 600; }
83
+ :where(.ec-table summary:focus-visible) { outline: 2px solid var(--ec-focus, ${Z.focus}); outline-offset: 2px; border-radius: 2px; }
83
84
  :where(.ec-table-scroll) { overflow-x: auto; margin-top: 8px; }
84
85
  :where(.ec-table table) { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
85
- :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; }
86
- :where(.ec-table thead th) { color: var(--ec-text-muted, ${De["text-muted"]}); font-size: 12px; font-weight: 600; }
86
+ :where(.ec-table th, .ec-table td) { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--ec-grid, ${Z.grid}); font-weight: 400; }
87
+ :where(.ec-table thead th) { color: var(--ec-text-muted, ${Z[`text-muted`]}); font-size: 12px; font-weight: 600; }
87
88
  :where(.ec-table .ec-num) { text-align: right; }
88
89
  :where(.ec-table-caption, .ec-visually-hidden) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
89
- `,Ti="data-expressive-charts";var bn={};function ht(e){if(bn.injectStyles===!1||e.querySelector(`style[${Ti}]`))return;let t=e.createElement("style");t.setAttribute(Ti,""),bn.nonce&&t.setAttribute("nonce",bn.nonce),t.textContent=El,(e.head??e.documentElement).appendChild(t)}function _r(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:_r(e)}function Li(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 Ci=e=>typeof e=="object"?e.entries??[]:[];function Gn(e){let t,n="",r=()=>{t?.remove(),t=void 0,n=""},o=(a,i,s,c)=>{let d=[...a.map(({key:f,label:b})=>({key:f,label:b,styles:pt(at(i.slot(f)))})),...c.map(({label:f,color:b})=>({key:void 0,label:f,styles:{"--ec-mark":it(b)}}))],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:b,styles:w})=>{let v=l.createElement("span");v.className="ec-legend-item",f!==void 0&&v.setAttribute(s,f);for(let[F,$]of Object.entries(w))$!==void 0&&v.style.setProperty(F,$);let R=l.createElement("span");R.className="ec-legend-swatch";let N=l.createElement("span");return N.className="ec-legend-label",N.textContent=b,v.append(R,N),v})))};return{update(a,i,s){let c=Ci(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",Ci(s))},destroy:r}}var Gt=e=>e!==void 0&&e.source!=="linked",Wo=new WeakMap,Kr=new WeakSet;function Ut(e,t){return Wo.set(t,e),t}var Pi=e=>Wo.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?Wo.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(Kr.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 b=w=>w.some(v=>{let R=s(v);return R!==void 0&&f.has(R)});for(let w of a){if(w===l)continue;let v=f.size===0?[]:w.targets().flatMap(R=>b(R.marks)?[R.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),Kr.delete(l),d(l)}})&&(a.add(l),Kr.add(l));return{destroy(){for(let l of a)l.listen(void 0),l.unlink(),Kr.delete(l);a.clear(),i=void 0}}}var Oi=["presentation","analysis","off"];function cn(e,t){if(e===void 0)return t;if(typeof e!="string")return e;if(!Oi.includes(e))throw new TypeError(`Unknown motion mode "${String(e)}". Use one of: ${Oi.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:lr(r,cr[a][o])},subscribe:r=>t.subscribe(r)}}var Ai=2,Dl=2,$i=new WeakMap,Tl=0;function Ur(e){let t=e.ownerDocument,n=($i.get(t)??0)+1;$i.set(t,n);let r=X("mask",{id:`ec-focus-mask-${n}`,maskUnits:"userSpaceOnUse",x:-1e5,y:-1e5,width:2e5,height:2e5},e);X("rect",{x:-1e5,y:-1e5,width:2e5,height:2e5,fill:"white"},r);let o=X("path",{stroke:"black","stroke-linejoin":"round"},r),a=X("path",{class:"ec-focus-ring",visibility:"hidden","stroke-linejoin":"round",mask:`url(#${r.id})`},e);return Ie(a,{fill:"none",stroke:it("focus")}),{draw(i){if(!i){ue(a,{visibility:"hidden"});return}let{outline:s,thickness:c,transform:d}=i,l=s.closed?0:c;ue(o,{d:s.d,fill:s.closed?"black":"none","stroke-width":l+2*Ai}),ue(a,{d:s.d,"stroke-width":l+2*(Ai+Dl),transform:d&&yt(d),visibility:void 0})}}}function Wr(){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=X("g",{class:"ec-halo"},n)),e.textContent="";let i=`ec-halo-mask-${++Tl}`,s=X("mask",{id:i,maskUnits:"userSpaceOnUse",x:-1e5,y:-1e5,width:2e5,height:2e5},e);X("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"};X("path",{d:c.d,...d},s)}ue(e,{transform:a&&yt(a)});for(let c of r){let d=c.stroke!==void 0,l=X("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);Ie(l,{fill:"none",stroke:o.color===void 0?c.color??it("mark"):it(o.color)})}},remove:t}}function wn(e,t={}){let n={},r,o=t.halos&&Wr(),a=()=>{let s=e();if(!s)return;let{body:c,parts:d}=s;ue(c,{transform:n.transform&&yt(n.transform),opacity:n.opacity});let l=n.emphasis;for(let u of d)Ie(u.element,{[u.open?"stroke":"fill"]:l===void 0?void 0:Rl(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=X("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 b=r.children[f]??X("path",{"stroke-linejoin":"round"},r);ue(b,{d:u.d,"stroke-width":d.width+(u.open?.width??0),"stroke-opacity":d.opacity,"stroke-linecap":u.open?"round":void 0}),Ie(b,{fill:"none",stroke:d.color===void 0?u.colors.color:it(d.color)})})};return{get style(){return n},set(s){n=Xt(n,s),a()},reset(){n={},a()},repaint:a}}function Rl(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 Cl=0;function br(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=X("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:X("g",{transform:yt(xe.scale(a,a,t.anchor))},o);for(let c of t.shapes)Ll(c,i);return{place(c){ue(o,{transform:yt(c),visibility:void 0})},remove:()=>o.remove()}},path(t,n){let r=X("path",{class:"ec-path",d:t},e),o={...n};return Gi(r,o),{update(i,s){r.setAttribute("d",i),s&&(o=Xt(o,s),Gi(r,o))},remove:()=>r.remove()}},text(t,n){let r=X("text",{class:"ec-text"},e);r.textContent=t;let o={...n};return Ii(r,o),{update(i,s){o=Xt(o,i),Ii(r,o),s!==void 0&&(r.textContent=s)},remove:()=>r.remove()}}}}function Ll(e,t){let n;if(e.clip!==void 0){n=`ec-clip-${++Cl}`;let o=X("clipPath",{id:n},t);X("path",{d:e.clip},o)}let r=X("path",{d:e.d,"clip-path":n&&`url(#${n})`,"stroke-width":e.stroke===void 0?void 0:e.width??1,"stroke-linecap":e.linecap,"stroke-linejoin":e.linejoin,"fill-rule":e.fillRule,opacity:e.opacity},t);Ie(r,{fill:e.fill===void 0?"none":it(e.fill),stroke:e.stroke===void 0?void 0:it(e.stroke)})}function Gi(e,t){ue(e,{"stroke-width":t.stroke===void 0?void 0:t.width??1,opacity:t.opacity,"stroke-linecap":t.linecap,"stroke-linejoin":"round"}),Ie(e,{fill:t.fill===void 0?"none":it(t.fill),stroke:t.stroke===void 0?void 0:it(t.stroke)})}function Ii(e,t){ue(e,{x:t.at.x,y:t.at.y,"text-anchor":t.anchor??"start",opacity:t.opacity}),Ie(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=X("g",{class:"ec-run","data-key":a,"data-slot":i,visibility:o.has(a)?"hidden":void 0},t);Ie(c,pt(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{...br(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=pt(e.colors(a));for(let c of i)Ie(c,s)},hide(a,i){i?o.add(a):o.delete(a);for(let s of r.get(a)??[])ue(s,{visibility:i?"hidden":void 0})}}}function qe(e,t){return e!==void 0&&Object.prototype.hasOwnProperty.call(e,t)?e[t]??t:t}function Vi(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 In(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 ze(e){return e.format??Pl}var qo;function Pl(e){return qo??(qo=new Intl.NumberFormat(void 0,{maximumFractionDigits:2})),qo.format(e)}function Wt(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 vn(e,t){let n=10**t,r=Math.round(e*n)/n;return r===0?0:r}function kn(e){return`${vn(e*100,0)}%`}function Zr(e,t){let n=e.ownerDocument,r,o="mouse",a,i,s,c=(C,p)=>{C?.key!==r&&(d(),C&&(r=C.key,t.hover(C,p)))},d=()=>{v(),r!==void 0&&(r=void 0,t.leave())},l=C=>{let p=t.tooltip?.();return p?.element&&C&&p.element.contains(C)?p:void 0},u=(C,p)=>{let D=e.getRootNode();return typeof D.elementFromPoint=="function"?D.elementFromPoint(C,p):void 0},f=C=>C.relatedTarget??u(C.clientX,C.clientY)??null,b=(C,p,D)=>{let G=l(C);G?w(G,p,D):c(C&&e.contains(C)?t.find(C):void 0,"pointer")},w=(C,p,D)=>{c({key:C.key},"pointer");let G=C.element;if(a?.element===G){a.x=p,a.y=D;return}v(),a={element:G,x:p,y:D},G.addEventListener("pointermove",R),G.addEventListener("pointerleave",N),i=new MutationObserver(F),i.observe(G,{attributes:!0,childList:!0,characterData:!0,subtree:!0})},v=()=>{a&&(a.element.removeEventListener("pointermove",R),a.element.removeEventListener("pointerleave",N),i?.disconnect(),i=void 0,a=void 0)},R=C=>{!a||C.pointerType==="touch"||(a.x=C.clientX,a.y=C.clientY)},N=C=>{C.pointerType!=="touch"&&(v(),b(f(C),C.clientX,C.clientY))},F=()=>{if(!a)return;let{x:C,y:p}=a,D=u(C,p);if(D===void 0)return;let G=t.tooltip?.(),K=G?.element!==void 0&&D!==null&&G.element.contains(D);if(!(K&&G.key===r)){if(v(),!K&&G?.key!==r){s={x:C,y:p},d();return}b(D,C,p)}},$=C=>s&&Math.abs(C.clientX-s.x)<1&&Math.abs(C.clientY-s.y)<1?!0:(s=void 0,!1),x=C=>{C.pointerType==="touch"||$(C)||(v(),c(t.find(C.target),"pointer"))},E=C=>{C.pointerType!=="touch"&&(s=void 0,b(f(C),C.clientX,C.clientY))},L=C=>{C.pointerType!=="touch"&&$(C)},A=C=>{o=C.pointerType},m=C=>{o==="touch"&&c(t.find(C.target),"touch")},M=C=>{if(r===void 0||C.pointerType!=="touch")return;let p=C.composedPath()[0]??C.target;!e.contains(p)&&!l(p)&&d()};return e.addEventListener("pointerover",x),e.addEventListener("pointerleave",E),e.addEventListener("pointermove",L),e.addEventListener("pointerdown",A),e.addEventListener("click",m),n.addEventListener("pointerdown",M,!0),{get current(){return r},clear(){a&&(s={x:a.x,y:a.y}),d()},destroy(){v(),r=void 0,e.removeEventListener("pointerover",x),e.removeEventListener("pointerleave",E),e.removeEventListener("pointermove",L),e.removeEventListener("pointerdown",A),e.removeEventListener("click",m),n.removeEventListener("pointerdown",M,!0)}}}function qr(e,t){let n,r,o,a,i,s=[],c=!0,d=t.tabIndex??((x,E)=>{let L=t.element(x);E===void 0?L?.removeAttribute("tabindex"):L?.setAttribute("tabindex",E)}),l=x=>{for(let E of x)d(E,E===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)},b=x=>{!x.metaKey&&!x.altKey&&!x.ctrlKey&&(c=!0)},w=()=>{c=!1,a=void 0},v=x=>{a=void 0;let E=t.find(x.target);if(E===void 0){f();return}let L=t.element(E);L&&L!==x.target&&x.target.getAttribute("aria-hidden")==="true"&&(L.focus(),n?.scope.activeElement===L)||(o={key:E,element:x.target},E!==r&&(r=E,i=E,l(t.order()),t.focus(E,c)))},R=x=>{let E=o?.element;r===void 0||!E||x.target!==E||t.find(x.relatedTarget)===void 0&&(f(),x.relatedTarget===null&&(a=E,queueMicrotask(()=>{a===E&&E.isConnected&&(a=void 0)})))},N=x=>{let E=t.find(x.target);if(E===void 0||x.altKey||x.ctrlKey||x.metaKey)return;let L=t.order(),A=L.indexOf(E),m;switch(x.key){case"ArrowDown":case"ArrowRight":m=L[Math.min(L.length-1,A+1)];break;case"ArrowUp":case"ArrowLeft":m=L[Math.max(0,A-1)];break;case"PageDown":case"PageUp":{let M=x.key==="PageDown"?1:-1,C=t.page?.(E,M);m=C!==void 0&&L.includes(C)?C:L[Math.min(L.length-1,Math.max(0,A+M*Math.ceil(L.length/10)))];break}case"Home":m=L[0];break;case"End":m=L[L.length-1];break;case"Escape":t.escape(E)&&x.preventDefault();return;default:return}x.preventDefault(),m!==void 0&&m!==E&&u(m)},F=()=>{n&&(n.doc.removeEventListener("keydown",b,!0),n.doc.removeEventListener("pointerdown",w,!0),n.scope.removeEventListener("focusin",v,!0),n.scope.removeEventListener("focusout",R,!0),n.svg.removeEventListener("keydown",N),n=void 0)},$=()=>{let x=e(),E=x?.getRootNode(),L=E&&"host"in E?E:x?.ownerDocument;x===n?.svg&&L===n?.scope||(F(),!(!x||!L)&&(n={svg:x,doc:x.ownerDocument,scope:L},n.doc.addEventListener("keydown",b,!0),n.doc.addEventListener("pointerdown",w,!0),n.scope.addEventListener("focusin",v,!0),n.scope.addEventListener("focusout",R,!0),n.svg.addEventListener("keydown",N)))};return $(),{active:()=>n?.scope.activeElement??null,focus(x){c=!0,x===r&&o?.element===n?.scope.activeElement?t.focus(x,!0):u(x)},sync(){$();let x=t.order(),E=new Set(x),L=s.filter(C=>!E.has(C));(i===void 0||!E.has(i))&&(i=Ol(s,i,E)??x[0]);let A=!n?.doc.activeElement||n.doc.activeElement===n.doc.body,m=o!==void 0&&!o.element.isConnected&&(r!==void 0||o.element===a&&A),M=o&&(o.element===n?.scope.activeElement||m)?o:void 0;a=void 0,M&&!E.has(M.key)?i!==void 0?u(i):M.element.isConnected?M.element.blur():f():M&&t.find(M.element)!==M.key&&u(M.key),l(x);for(let C of L)d(C,void 0);s=x},destroy(){r=void 0,o=void 0,a=void 0,F()}}}function Ol(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 Vn(e){let{svg:t,runner:n,events:r}=e,o=m=>e.marks?.(m)??[m],a=m=>(e.markElement??e.element)(m),i,s,c,d=!1,l=m=>m.flatMap(M=>{let C=e.onScreen(M);return C?[{key:M,input:C}]:[]}),u=m=>m.length===1?o(m[0]):[...new Set(m.flatMap(o))];function f(m,M,C,p){if(m.length===0)return;C&&n.hover(m.map(({input:G})=>G));let D=m.length;m.forEach(({input:G},K)=>r.emit("hover",{...G,batch:{index:K,count:D},source:M,...p===void 0?{}:{segment:p}}))}function b(m){let M=l(m);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 C=M.length;M.forEach(({input:p},D)=>r.emit("leave",{...p,batch:{index:D,count:C}}))}function w(m,M,C,p=!0){let D=l(u(m)),G={keys:m,source:M,marks:D.map(K=>K.key),effects:p};i=G;for(let{key:K}of D)a(K)?.classList.add("ec-hot");e.dim()&&t.classList.add("ec-hovering"),M!=="linked"&&(e.tooltip.show(m[0]),F(!0)),f(D,M,p,C),M!=="linked"&&i===G&&c?.hover(D.map(({input:K})=>K))}function v(){let m=i;i=void 0,F(!1),t.classList.remove("ec-hovering"),e.tooltip.hide(),b(m?.marks??[]),Gt(m)&&c?.leave()}let R,N=m=>{m.key==="Escape"&&!m.defaultPrevented&&i!==void 0&&$()};function F(m){R?.removeEventListener("keydown",N),R=m?t.ownerDocument:void 0,R?.addEventListener("keydown",N)}function $(){E.clear(),i!==void 0&&v()}let x=(m,M)=>M===m||e.live(m)&&o(m).includes(M),E=Zr(t,{find:e.find,hover(m,M){!e.live(m.key)||Gt(i)&&i.keys[0]===m.key||(v(),w([m.key],M,m.segment))},leave(){(i?.source==="pointer"||i?.source==="touch")&&v()},tooltip:()=>Gt(i)?{key:i.keys[0],element:e.tooltip.element?.()}:void 0}),L=qr(()=>t,{find:m=>e.find(m)?.key,order:e.order,page:(m,M)=>e.page?.(m,M),element:e.element,focus(m,M){if(s=M?m:void 0,e.ring(s),!!e.live(m)){if(!M){i?.source==="keyboard"&&i.keys[0]!==m&&v();return}if(Gt(i)&&i.keys[0]===m){i={...i,source:"keyboard"};return}v(),w([m],"keyboard")}},blur(){s=void 0,e.ring(s),i?.source==="keyboard"&&(E.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 Gt(i)?i.keys[0]:void 0},get ringKey(){return s},link:{targets:()=>e.order().map(m=>({key:m,marks:l(o(m)).map(({input:M})=>M)})),hover(m,M){i!==void 0&&v();let C=m.filter(e.live);C.length>0&&w(C,"linked",void 0,M)},unlink(){i?.source==="linked"&&v()},leave:$,listen(m){return d?!1:(c=m,!0)}},active:()=>L.active(),restyled(m){s!==void 0&&x(s,m)&&e.ring(s);let M=Gt(i)?i.keys[0]:void 0;M!==void 0&&(i?.marks.includes(m)||m===M)&&e.live(M)&&e.tooltip.show(M)},syncDim(){e.dim()?i!==void 0&&t.classList.add("ec-hovering"):t.classList.remove("ec-hovering")},dropGone(){if(i===void 0)return;let m=i.keys.filter(e.live);if(m.length===0){E.clear(),v();return}let{source:M,marks:C,effects:p}=i,D=l(u(m));if(i={...i,keys:m},D.length===C.length&&D.every((j,U)=>j.key===C[U]))return;let G=new Set(C),K=new Set(D.map(j=>j.key)),Y=l(C.filter(j=>!K.has(j)));i={...i,marks:D.map(j=>j.key)};for(let{key:j}of Y)a(j)?.classList.remove("ec-hot");for(let{key:j}of D)G.has(j)||a(j)?.classList.add("ec-hot");n.leave(C),p&&n.hover(D.map(({input:j})=>j)),Y.forEach(({input:j},U)=>r.emit("leave",{...j,batch:{index:U,count:Y.length}}));let re=D.length;D.forEach(({key:j,input:U},ae)=>{G.has(j)||r.emit("hover",{...U,batch:{index:ae,count:re},source:M})})},sync:()=>L.sync(),focus(m){e.live(m)&&L.focus(m)},leave:$,destroy(){d=!0,c?.gone(),c=void 0,F(!1),E.destroy(),L.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 Nn(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=Al()},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 Al(){let e;return{exited:!1,gone:new Promise(n=>{e=n}),resolve:e}}function xn(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 Fi(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".`)}))}var $l="missing";function Fn(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,E)=>x+E.total,0),l=x=>e.shares?[{text:kn(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,b=()=>({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 E=new Map(x.values.map(L=>[L.series,L.value]));return{key:x.key,cells:[{text:x.category,numeric:!1},...a.map(L=>Ni(L,x,n)),...e.series.map(L=>x.missing?.has(L)?{text:$l,numeric:!0}:c(E.get(L)??0)),...s?[c(x.total)]:[],...l(x.total),...i.map(L=>Ni(L,x,n))]}}),R=x=>e.rows.reduce((E,L)=>E+(L.values.find(A=>A.series===x)?.value??0),0),N=e.shares?[{text:r.total??"Total",numeric:!1},...a.map(b),...e.series.map(x=>c(R(x))),...s?[c(d)]:[],...l(d),...i.map(b)]:void 0,F=w.length-i.length,$=[...a.map((x,E)=>1+E),...i.map((x,E)=>F+E)];for(let x of $){let E=v.map(L=>L.cells[x]).filter(L=>L.text!=="");E.length>0&&E.every(L=>L.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,...N?{footer:N}:{}}}function Ni(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 Bn(e){let t=e.ownerDocument,n,r,o,a,i,s,c,d=new Map,l="",u=(R,N)=>{let F=t.createElement(R);return N&&(F.className=N),F};function f(){o=u("table"),a=u("caption","ec-table-caption");let R=u("thead");return i=u("tr"),R.appendChild(i),s=u("tbody"),o.append(a,R,s),o}function b(R,N){let F=R?"DIV":"DETAILS";if(n?.tagName!==F){let $=R?u("div","ec-table ec-visually-hidden"):u("details","ec-table"),x=o??f();if(R)r=void 0,$.appendChild(x);else{r=u("summary");let E=u("div","ec-table-scroll");E.appendChild(x),$.append(r,E)}n?.isConnected&&n.replaceWith($),n=$}n.isConnected||e.after(n),r&&r.textContent!==N&&(r.textContent=N)}function w(R,{text:N,numeric:F}){R.textContent!==N&&(R.textContent=N),R.classList.toggle("ec-num",F)}function v(){n?.remove(),n=r=o=a=i=s=c=void 0,d.clear(),l=""}return{render(R){if(!R){v();return}b(R.hidden,R.summary),a.textContent!==R.caption&&(a.textContent=R.caption);let N=JSON.stringify(R.headers);N!==l&&(l=N,i.replaceChildren(...R.headers.map(E=>{let L=u("th");return L.scope="col",w(L,E),L})),d.clear(),s.replaceChildren());let F=new Set(R.rows.map(E=>E.key));for(let[E,L]of d)F.has(E)||(L.remove(),d.delete(E));if(R.rows.forEach((E,L)=>{let A=d.get(E.key);A||(A=u("tr"),A.setAttribute("data-key",E.key),E.cells.forEach((m,M)=>{let C=u(M===0?"th":"td");M===0&&(C.scope="row"),A.appendChild(C)}),d.set(E.key,A)),E.cells.forEach((m,M)=>w(A.cells[M],m)),s.children[L]!==A&&s.insertBefore(A,s.children[L]??null)}),!R.footer){c?.remove(),c=void 0;return}let $=R.footer,x=c?.rows[0];(!c||!x||x.cells.length!==$.length)&&(c?.remove(),c=u("tfoot"),x=u("tr"),$.forEach((E,L)=>{let A=u(L===0?"th":"td");L===0&&(A.scope="row"),x.appendChild(A)}),c.appendChild(x),o.appendChild(c)),$.forEach((E,L)=>w(x.cells[L],E))},destroy:v}}var Gl=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 Hn(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:Gl}function fn(e,t){e.setAttribute("aria-label",t.label);let n=e.querySelector(":scope > desc");t.description?(n??(n=e.insertBefore(X("desc",{},e),e.firstChild)),n.textContent=t.description):n?.remove()}function jn(e,t,n){for(let r of _t){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 zn(e,t,n,r){let o=s=>_t.includes(s)&&n?.[s]!==void 0&&n[s]===t?.[s],a=Kt(Object.fromEntries(Object.entries(n??{}).filter(([s])=>!o(s))),r),i={};for(let s of _t){let c=o(s)?e[s]:a[s];c&&(i[s]=c)}return i}function Mn(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(Li(i,t),Vi(e.seriesLabels,t),Fi(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 _n(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 Kn(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),(e.data||s.changed.length>0||s.entering.length>0||s.exiting.length>0)&&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 _e(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||Jo(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 Jo(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 Un(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 Wn(e,t){let n=e.fonts;return n?.addEventListener?.("loadingdone",t),()=>n?.removeEventListener?.("loadingdone",t)}function Zn(e,t){let n=()=>e.style.setProperty("--ec-hover-duration",`${t.duration(100,"feedback")}ms`);return n(),t.subscribe(n)}var Yo=12,Bi=1,Il=100,Vl=0;function Hi(e,t,n,r){let o=e.top-Yo,a=n.height-e.bottom-Yo;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+Yo,side:r}}function Jr(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 qn(e,t){let n,r,o,a=new WeakMap,i,s,c=!1,d,l=$=>$.style.setProperty("--ec-hover-duration",`${t.motion.duration(Il,"feedback")}ms`),u=()=>r?.classList.contains("ec-tooltip-shown")??!1,f=()=>{if(!s||!r||!n)return!1;let{x:$,y:x}=s,{left:E,right:L,top:A,bottom:m}=r.getBoundingClientRect();if($>E&&$<L&&x>A&&x<m)return!0;if(!d)return!1;let M=n.getBoundingClientRect();return Nl(d,$-M.left,x-M.top)},b=$=>{c=$,n?.classList.toggle("ec-tooltip-through",$)},w=$=>{s=$.pointerType==="touch"?void 0:{x:$.clientX,y:$.clientY},c&&!f()&&b(!1)};e.ownerDocument.addEventListener("pointerover",w,!0),e.ownerDocument.addEventListener("pointermove",w,!0);function v(){if(!n||!r||!o){let $=e.ownerDocument;n=$.createElement("div"),n.className="ec-tooltip-layer",r=$.createElement("div"),r.className="ec-tooltip",r.setAttribute("aria-hidden","true"),o=$.createElement("div"),o.className="ec-tooltip-bridge",o.setAttribute("aria-hidden","true"),n.append(r,o)}return n.previousSibling!==e&&e.after(n),r}function R($,x){let E=t.option(),L=a.get($);if(L&&L.option===E)return L.content;let A=Bl(E,$.datum,x);return a.set($,{option:E,content:A}),A}function N(){r&&(l(r),r.classList.remove("ec-tooltip-shown"),b(!1))}function F($,x,E,L){let A=R($,x);if(A===void 0){N();return}let m=v(),M=u()&&!c&&f(),C=typeof A=="string"?`text:${A}`:JSON.stringify(A);C!==i&&(Hl(m,A),i=C);let p=jl(e),D=e.getBoundingClientRect(),G=D.width>0&&p.width>0?D.width/p.width:1,K={x:le=>(le-p.x)*G,y:le=>(le-p.y)*G},Y=D.width>0?{width:D.width,height:D.height}:{width:p.width,height:p.height},re={width:m.offsetWidth,height:m.offsetHeight},j=E(K,L),U=Hi(j,re,Y,L?Hi(E(K,!1),re,Y).side:void 0),ae=n.getBoundingClientRect(),se=D.left-ae.left,be=D.top-ae.top,V=Math.round(se+U.x),_=Math.round(be+U.y);m.style.left=`${V}px`,m.style.top=`${_}px`,m.setAttribute("data-side",U.side);let ee=j.left===void 0||j.right===void 0?void 0:{left:se+j.left,right:se+j.right,top:be+j.top,bottom:be+j.bottom};d=Fl(o,{left:V,top:_,...re},ee,U.side),l(m),m.classList.add("ec-tooltip-shown"),b(!M&&f())}return{show($,x,E,L){F(x,E,(m,M)=>{let C=M?L:void 0,{x:p,y:D,width:G,height:K}=$.bounds,Y=[{x:p,y:D},{x:p+G,y:D},{x:p,y:D+K},{x:p+G,y:D+K}].map(ae=>C?xe.apply(C,ae):ae),re=Y.map(ae=>ae.x),j=Y.map(ae=>ae.y),U=C?xe.apply(C,$.center):$.center;return{x:m.x(U.x),top:m.y(Math.min(...j)),bottom:m.y(Math.max(...j)),left:m.x(Math.min(...re)),right:m.x(Math.max(...re))}},L!==void 0)},showAt($,x,E){F(x,E,L=>({x:L.x($.x),top:L.y($.top),bottom:L.y($.bottom)}),!1)},describe($,x){let E=t.description?.(),L;if(E===!1)L=void 0;else if(typeof E=="function")try{let m=E(x.datum);L=typeof m=="string"&&m!==""?m:void 0}catch(m){Se(m),L=void 0}else L=typeof t.option()=="function"?R(x,()=>""):void 0;let A=$.querySelector(":scope > desc.ec-description");if(typeof L!="string"){if(!A)return;$.getAttribute("aria-describedby")===A.id&&$.removeAttribute("aria-describedby"),A.remove();return}A??(A=X("desc",{class:"ec-description",id:`ec-description-${++Vl}`},$)),A.textContent!==L&&(A.textContent=L),$.setAttribute("aria-describedby",A.id)},element:()=>u()?n:void 0,hide:N,destroy(){e.ownerDocument.removeEventListener("pointerover",w,!0),e.ownerDocument.removeEventListener("pointermove",w,!0),n?.remove(),n=void 0,r=void 0,o=void 0,d=void 0,c=!1,a=new WeakMap,i=void 0}}}function Nl({top:e,bottom:t,upper:n,lower:r},o,a){if(a<=e||a>=t)return!1;let i=(a-e)/(t-e);return o>n.left+(r.left-n.left)*i&&o<n.right+(r.right-n.right)*i}function Fl(e,t,n,r){if(e.hidden=n===void 0,!n)return;let o={left:t.left,right:t.left+t.width},[a,i,s,c]=r==="above"?[o,n,t.top+t.height,Math.round(n.top+Bi)]:[n,o,Math.round(n.bottom-Bi),t.top],d=Math.round(Math.min(a.left,i.left)),l=Math.round(Math.max(a.right,i.right))-d,u=Math.max(0,c-s),f=w=>`${Math.round(w)-d}px`;e.style.left=`${d}px`,e.style.top=`${s}px`,e.style.width=`${l}px`,e.style.height=`${u}px`,e.style.setProperty("clip-path",`polygon(${f(a.left)} 0px, ${f(a.right)} 0px, ${f(i.right)} ${u}px, ${f(i.left)} ${u}px)`);let b=w=>({left:Math.round(w.left),right:Math.round(w.right)});return{top:s,bottom:s+u,upper:b(a),lower:b(i)}}function Bl(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 Hl(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 jl(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 Jn=500,ji=2,zl=2;function Qo(e,t,n){let r=un(e,"barChart");zi(t);let o=t,a=cn(t.motion,n.motion),i=Kt(t.on,n.presets),s=$t(t.colors),c=n.clock??Be,d=r.ownerDocument;ht(d);let l=X("svg",{class:"ec-chart ec-bar-chart",role:"group"},r),u=X("g",{class:"ec-grid","aria-hidden":"true"},l),f=X("g",{class:"ec-axis","aria-hidden":"true"},l),b=X("g",{class:"ec-focus","aria-hidden":"true",visibility:"hidden"},l),w=[X("path",{class:"ec-focus-ring","stroke-width":2*(ji+zl),"stroke-linejoin":"round"},b),X("path",{class:"ec-focus-gap","stroke-width":2*ji,"stroke-linejoin":"round"},b)],v=X("g",{class:"ec-marks"},l),R=X("g",{class:"ec-overlay","aria-hidden":"true"},l),N=Ln(l),F=[],$=new Map,x=Nn(T=>T.values.animating||T.presence.animating),E=new WeakMap,L=In("barChart"),A=Hn(r),m=!1,M,C;try{M=we(o),C=Ke(o,M)}catch(T){throw l.remove(),T}let p=T=>$.get(T)??x.get(T),D=ln({overlay:R,mark:T=>({set:q=>{p(T)?.handle.set(q),Fe.restyled(T)},reset:()=>{p(T)?.handle.reset(),Fe.restyled(T)}}),colors:T=>p(T)?.parts[0]?.colors}),G=an({effects:i,motion:a,icons:n.icons,clock:c,surface:D}),K=qn(l,{motion:a,option:()=>o.tooltip,description:()=>o.markDescription}),Y=Gn(l),re=Bn(l),j=o.announce?Ot(l):void 0,U=M.orientation,ae=new Map,se=new Set,be=!1,V=!1,_=He(M.frame.scale,kt,{clock:c,motion:a,onChange:()=>be=!0}),ee=He(M.frame.bands,kt,{clock:c,motion:a,onChange:()=>be=!0}),le=_n({clock:c,runner:G,leaving:x,draw:ut,land:Ue});function we(T,q=i){let ie=$n(T);return jn(q,ie.series.map(he=>he.series),"barChart"),Si({data:T.data,encoding:ie,sort:T.sort,width:T.width??A,height:T.height,format:ze(T),measure:N,room:T.room??0})}function ve(T,q){let ie=X("g",{class:"ec-mark","data-key":T.key,role:"img"},v),he={clock:c,motion:a,onChange:()=>se.add(B)},g=Xr(T),B={key:T.key,row:T,shown:T,group:ie,hit:X("rect",{class:"ec-hit"},ie),label:X("text",{class:"ec-label","aria-hidden":"true"},ie),body:X("g",{class:"ec-body"},ie),value:X("text",{class:"ec-value","aria-hidden":"true"},ie),paths:new Map,parts:[],handle:wn(()=>B),values:He(q?Xo(g):g,kt,he),series:T.values.map(h=>h.series),slot:He(T.slot,st,he),presence:He(q?0:1,st,he),count:void 0,leave:void 0};return E.set(ie,B),je(B,q?Qe(B,dt()):T),B}function je(T,q){let ie=T.parts[0]?.colors.color;T.shown=q,ue(T.hit,{...q.hit}),Mt(T.label,q.label),Mt(T.value,q.value);let he=T.presence.value,g=he<1?he:void 0;ue(T.label,{opacity:g}),ue(T.value,{opacity:g});let B=q.geometry.segments??[],h=new Set,k=Yr(o)?at(s.slot(T.key)):void 0;T.parts=B.map(P=>{let z=P.series??P.key;h.add(z);let H=T.paths.get(z);H||(H=X("path",{class:"ec-segment","data-series":z},T.body),T.paths.set(z,H));let te=k??at(s.slot(z));return H.setAttribute("d",P.outline.d),Ie(H,pt(te)),{element:H,d:P.outline.d,colors:te,visible:P.length>=.5}});for(let[P,z]of T.paths)h.has(P)||(z.remove(),T.paths.delete(P));let S=Array.from(T.body.children).filter(P=>P.classList.contains("ec-segment"));if(T.parts.some((P,z)=>S[z]!==P.element))for(let P of T.parts)T.body.appendChild(P.element);T.handle.repaint(),T.parts[0]?.colors.color!==ie&&D.recolor(T.key),T.key===Fe.ringKey&&Oe(T.key)}function Oe(T){let q=T===void 0?void 0:$.get(T);if(!q){b.setAttribute("visibility","hidden");return}for(let he of w)he.setAttribute("d",q.shown.geometry.outline.d);let{transform:ie}=q.handle.style;ue(b,{transform:ie&&yt(ie),visibility:void 0})}function Pe(T,q){let ie=mn(T.shown.geometry,q.geometry)||T.shown.datum!==q.datum;je(T,q),ie&&G.change(q.geometry,q.data),T.key===Fe.key&&Re(T)}function Re(T){let{row:q}=T;K.show(T.shown.geometry,q,()=>Jr(q.category,Ki(q.values,o),ze(o)),T.handle.style.transform)}function $e(T){if(Yr(o)){Y.categories(T.rows.map(q=>({key:q.key,label:q.category})),s,o.legend);return}Y.update($n(o).series.map(q=>({series:q.series,label:qe(o.seriesLabels,q.series)})),s,o.legend)}function Ke(T,q){let ie=$n(T),he=ie.orientation==="horizontal"?T.y:T.x;return Fn({option:T.table,caption:T.label,category:typeof he=="string"?he:void 0,series:ie.series.map(g=>g.series),label:g=>qe(T.seriesLabels,g),rows:q.rows.map(g=>({key:g.key,category:g.category,datum:g.datum,index:g.index,values:g.values,total:g.total})),format:ze(T)})}function lt(T,q){let ie=o.announce;if(!j||!ie)return;let he=$n(o).series.map(z=>z.series),g=$n(T).series.map(z=>z.series),B=_i(o.sort),h=z=>z.row.category,k=q.changed.map(({record:z})=>z),S=Cn({...o.label!==T.label?{label:o.label}:{},...he.join(`
90
- `)!==g.join(`
91
- `)?{series:he.map(z=>qe(o.seriesLabels,z))}:{},...B!==_i(T.sort)||B==="custom"&&o.sort!==T.sort?{sort:B}:{},changed:k.map(h),added:q.entering.map(h),removed:q.exiting.map(h),count:F.length});if(typeof ie!="function"){j.say(S);return}let P=z=>z.key;try{let z=ie({text:S,changed:k.map(P),added:q.entering.map(P),removed:q.exiting.map(P)});z!=null&&j.say(String(z))}catch(z){Se(z)}}let dt=()=>({orientation:U,scale:_.value,bands:ee.value});function Qe(T,q){let{row:ie}=T,he=T.values.value,g=T.series.map(k=>({series:k,value:he[k]??0})),B=g.reduce((k,S)=>k+S.value,0),h=T.count===void 0?ie.value.text:ze(o)(vn(B,T.count));return jo(q,{key:ie.key,datum:ie.datum,index:ie.index,category:ie.category,values:g,slot:T.slot.value,text:h,drawn:ie.drawn},N)}function ye(T,q){let ie={value:T,line:X("line",{class:T===0?"ec-baseline":"ec-gridline"},u),label:X("text",{class:"ec-tick"},f),opacity:He(q,st,{clock:c,motion:a,onChange:()=>V=!0}),wanted:!0};ae.set(T,ie);for(let he of[...ae.values()].sort((g,B)=>g.value-B.value))u.appendChild(he.line),f.appendChild(he.label)}function Ve(T,q){let ie=zo(q,T.value,ze(o)(T.value)),he=T.opacity.value<1?T.opacity.value:void 0;ue(T.line,{...ie.line,opacity:he}),Mt(T.label,ie.label),ue(T.label,{opacity:he})}function ut(){let T=dt();if(be&&ue(l,At(T.bands)),be||V)for(let q of ae.values())Ve(q,T);for(let q of[...F,...x.values()])(be||se.has(q))&&Pe(q,Qe(q,T));be=!1,V=!1,se.clear()}function Ue(){ue(l,At(M.frame.bands));for(let T of[...ae.values()])T.wanted||(T.line.remove(),T.label.remove(),ae.delete(T.value));for(let T of M.ticks){let q=ae.get(T.value);q&&(ue(q.line,{...T.line,opacity:void 0}),Mt(q.label,T.label),q.label.removeAttribute("opacity"))}for(let T of F)T.series=T.row.values.map(q=>q.series),T.count=void 0,Pe(T,T.row);be=!1,V=!1,se.clear()}function St(T){let q=new Set(T.rows.map(g=>g.key)),ie={entering:[],exiting:[],changed:[]};for(let g of F)q.has(g.key)||($.delete(g.key),x.start(g),g.count=void 0,ie.exiting.push(g));let he=F;return F=T.rows.map(g=>{let B=$.get(g.key);return B?(Kl(B.row,g)&&ie.changed.push({record:B,from:B.shown.geometry}),B.count=Math.max(Wt(B.row.total),Wt(g.total))):(B=x.recall(g.key)??ve(g,!0),B.count=void 0,$.set(g.key,B),ie.entering.push(B)),B.row=g,B.series=Ul(B.series,g.values.map(h=>h.series)),Et(B),B}),xn(v,he.map(g=>g.group),F.map(g=>g.group),Fe.active),ie}function Et(T){T.group.setAttribute("aria-label",_l(T.row,o)),K.describe(T.group,T.row)}function Dt(T,q){let{frame:ie}=T;q&&(U=T.orientation);let he=new Set(T.ticks.map(W=>W.value));for(let W of he)ae.has(W)||ye(W,0);for(let W of ae.values())W.wanted=he.has(W.value);let g=new Set(F.filter(W=>W.presence.value===0)),B=F.filter(W=>!g.has(W)),h=[...x.values()],k=Le(_,ie.scale,_e)||[...ae.values()].some(W=>Le(W.opacity,W.wanted?1:0,Me))||B.some(W=>Le(W.values,Xr(W.row),_e)||Le(W.presence,1,Me))||h.some(W=>Le(W.values,Xo(W.values.value),_e)||Le(W.presence,0,Me)),S=g.size>0||Le(ee,ie.bands,_e)||B.some(W=>Le(W.slot,W.row.slot,Me)),P,z,H;if(!q&&a.staged){let W=k?Jn:0;P={duration:Jn},z={duration:Jn,delay:W},H={duration:Jn/2,delay:W+Jn/2}}else q||(P=z=H={duration:(k&&S?2:1)*Jn});let te=[],de=(W,me,Ne,Ge)=>{Le(W,me,Ne)&&(Ge?te.push(W.to(me,Ge)):W.set(me))};de(_,ie.scale,_e,P),de(ee,ie.bands,_e,z);for(let W of ae.values())de(W.opacity,W.wanted?1:0,Me,P);for(let W of B)de(W.values,Xr(W.row),_e,P),de(W.presence,1,Me,P),de(W.slot,W.row.slot,Me,z);for(let W of g)W.slot.set(W.row.slot),de(W.values,Xr(W.row),_e,H),de(W.presence,1,Me,H);for(let W of h)de(W.values,Xo(W.values.value),_e,P),de(W.presence,0,Me,P);return te}function et(T,q){return M=T,le.run(Dt(T,q))}let Tt=T=>({mark:T.row.geometry,data:T.row.data}),bt=T=>({mark:T.shown.geometry,data:T.shown.data});function Rt(T){let q=T,ie=typeof q?.closest=="function"?q.closest(".ec-mark"):null,he=ie?E.get(ie):void 0;return he&&$.get(he.key)===he?he:void 0}let Fe=Vn({svg:l,runner:G,events:L,dim:()=>o.dim!==!1,find(T){let q=Rt(T);if(!q)return;let ie=T.closest(".ec-segment")?.getAttribute("data-series")??void 0;return ie===void 0?{key:q.key}:{key:q.key,segment:ie}},live:T=>$.has(T),order:()=>F.map(T=>T.key),element:T=>p(T)?.group,onScreen(T){let q=p(T);return q&&bt(q)},ring:Oe,tooltip:{show(T){let q=$.get(T);q&&Re(q)},hide:()=>K.hide(),element:()=>K.element()}}),tt=Zn(l,a);function Ct(){if(m)return;let T=we(o),q=new Map(T.rows.map(ie=>[ie.key,ie]));for(let ie of F)ie.row=q.get(ie.key)??ie.row;et(T,!0)}let en=Un(r,c,A,T=>{A=T,o.width===void 0&&Ct()}),We=Wn(d,()=>{N.clear(),Ct()});fn(l,o),$e(M),re.render(C),ue(l,At(M.frame.bands));for(let T of M.ticks)ye(T.value,1);for(let T of ae.values())Ve(T,M.frame);return F=M.rows.map(T=>{let q=ve(T,!1);return $.set(T.key,q),Et(q),q}),Fe.sync(),G.enter(F.map(Tt)),Ut(Fe.link,{element:l,async update(T){if(m)return;if(T.motion!==void 0&&T.motion!==o.motion)throw new TypeError("barChart: `motion` can't be changed by update() yet.");let q={...o,...T};zi(q);let ie="on"in T?zn(i,o.on,q.on,n.presets):i,he=we(q,ie),g=Ke(q,he);"colors"in T&&(s=$t(q.colors));let B=o;o=q,fn(l,o),$e(he),re.render(g);let h=j!==void 0;o.announce&&!j?j=Ot(l):!o.announce&&j&&(j.destroy(),j=void 0),Fe.syncDim(),le.supersede();let k=ie!==i;i=ie;let S=Kn({runner:G,events:L,hover:Fe,leaving:x,input:Tt,onScreen:bt,data:"data"in T,...k?{swap:z=>{let H=new Set(z.entering);G.swap(ie,F.filter(te=>!H.has(te)).map(Tt))}}:{}},()=>St(he),z=>{h&&lt(B,z)});if(Yr(o)!==Yr(B))for(let z of[...F,...x.values()])se.add(z);let P=et(he,a.mode==="off"||he.orientation!==U);await le.wait(P,S)},on:L.on,marks:()=>F.map(T=>T.shown.geometry),focus(T){m||Fe.focus(T)},leave(){m||Fe.leave()},labels:()=>F.flatMap(T=>[...dn(T.key,"category",T.shown.label,T.label),...dn(T.key,"value",T.shown.value,T.value)]),destroy(){if(!m){m=!0,le.destroy(),Fe.destroy(),G.destroy(),K.destroy(),Y.destroy(),re.destroy(),j?.destroy(),tt(),en(),We();for(let T of[...F,...x.values()]){for(let q of[T.values,T.slot,T.presence])q.stop();T.leave?.resolve()}_.stop(),ee.stop();for(let T of ae.values())T.opacity.stop();L.clear(),$.clear(),x.clear(),F=[],l.remove()}}})}function zi(e){Mn(e,"barChart");let{colorBy:t,room:n}=e;if(n!==void 0&&!(typeof n=="number"&&Number.isFinite(n)&&n>=0))throw new RangeError(`barChart: room must be a number of px, 0 or more, got ${String(n)}.`);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 Yr(e){return e.colorBy==="category"}function _l(e,t){let n=ze(t),r=Ki(e.values,t),o=r.length===1&&r[0].series==="value"&&r[0].label==="value",a=`${e.category}: ${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.category,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 Ki(e,t){return e.map(n=>({series:n.series,label:qe(t.seriesLabels,n.series),value:n.value}))}function Kl(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 Xr(e){return Object.fromEntries(e.values.map(t=>[t.series,t.value]))}function Xo(e){return Object.fromEntries(Object.keys(e).map(t=>[t,0]))}function Ul(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 _i(e){return typeof e=="function"?"custom":e??"none"}var Ui=2*Math.PI,Wl=300,Zl=.6,ea=4,na=10,ql=Math.PI/12,eo=12.5,aa=12.5,ra=10,Zi=15,oa=ra+Zi+3,Qr=2,wr=26,Jl=14,Yl=20,Xl=16,Ql=.36;function Yn(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=ta(t);return{category:o,key:r===void 0?o:ta(r),series:typeof n=="string"?n:"value",value:ta(n)}}function qi(e){let t=nd(td(e),e.sort),n=rd(e,t),r=t.reduce((c,d)=>c+d.value,0),o=ed(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]*Ui,end:u*Ui}}),i=sa(n,a,e.measure),s=e.center(r);return{frame:n,total:r,slices:a.map((c,d)=>ia(n,c,i[d],e.measure)),labels:i,centerText:s,center:ca(n,s,e.measure)}}function ed(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 ia(e,t,n,r){let o=Xe.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?ad(n,r):[]});return{...t,geometry:o,data:id(t.datum,t.share,t.series)}}function sa(e,t,n){let r,o,a=t.map((i,s)=>{if(i.end-i.start<ql-1e-9)return;let c=od(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&&Wi(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(!Wi(a[o].box,s.box))break;a[i]=void 0}}return a}function ca(e,t,n){if(t==="")return[];let r=t.split(`
92
- `),o=2*e.inner*.85,a=n(r[0],"ec-center-value",wr),i=a>o&&a>0?Math.max(Jl,wr*o/a):wr,s=r.map((l,u)=>u===0?0:Yl+(u-1)*Xl),c=s[s.length-1],d=e.cy+(2*Ql*i-c)/2;return r.map((l,u)=>({x:e.cx,y:d+s[u],anchor:"middle",text:l,size:u===0?i:eo}))}function td({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=sd(t.value(r,o),t.series,a);return{key:a,category:String(t.category(r,o)??""),datum:r,index:o,value:i}})}function nd(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 rd(e,t){let{width:n,measure:r}=e,o=e.height??Wl,a=n/2,i=o/2,s=r("100%","ec-value",aa),c=t.reduce((f,b)=>Math.max(f,r(b.category,"ec-label",eo)),s),d=Math.min(a-ea-na-c,i-ea-na-oa),l=Math.max(0,Math.min(a,i)-ea),u=Math.max(0,d,l/2);return{width:n,height:o,cx:a,cy:i,inner:u*Zl,outer:u}}function od(e,t,n){let r=(t.start+t.end)/2,o=Math.sin(r),a=Math.cos(r),i=e.outer+na,s=e.cx+i*o,c=e.cy-i*a,d=kn(t.share),l=[n(t.category,"ec-label",eo),n(d,"ec-value",aa)],u=Math.max(...l),f=c-oa*(a+1)/2,b=w=>s+o*w/2;return{category:{x:b(l[0]),y:f+ra,anchor:"middle",text:t.category},share:{x:b(l[1]),y:f+ra+Zi,anchor:"middle",text:d},box:{x:b(u)-u/2,y:f,width:u,height:oa}}}function ad(e,t){let n=[];return e.category.text!==""&&n.push(gn(e.category,t,"ec-label",eo)),e.share.text!==""&&n.push(gn(e.share,t,"ec-value",aa)),n}function Wi(e,t){return e.x<t.x+t.width+Qr&&t.x<e.x+e.width+Qr&&e.y<t.y+t.height+Qr&&t.y<e.y+e.height+Qr}function id(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 ta(e){return typeof e=="function"?e:t=>t[e]}function sd(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 Xn=500,Ji=2*Math.PI,cd=.5;function la(e,t,n){let r=un(e,"donutChart");Yi(t);let o=t,a=cn(t.motion,n.motion),i=Kt(t.on,n.presets),s=$t(t.colors),c=n.clock??Be,d=r.ownerDocument;ht(d);let l=X("svg",{class:"ec-chart ec-donut-chart",role:"group"},r),u=X("g",{class:"ec-center","aria-hidden":"true"},l),f=X("g",{class:"ec-marks"},l),b=X("g",{class:"ec-overlay","aria-hidden":"true"},l),w=X("g",{class:"ec-halos"},b),v=Ur(b),R=X("g",{class:"ec-runs"},b),N=Ln(l),F=[],$=new Map,x=Nn(g=>g.value.animating||g.presence.animating),E=new WeakMap,L=In("donutChart"),A=Hn(r),m=!1,M,C,p;try{M=we(o),C=lt(o,M),p=Xi(o,M)}catch(g){throw l.remove(),g}let D=g=>$.get(g)??x.get(g),G=ln({overlay:R,mark:g=>({set:B=>{D(g)?.handle.set(B),We.restyled(g)},reset:()=>{D(g)?.handle.reset(),We.restyled(g)}}),colors:g=>D(g)?.parts[0]?.colors}),K=an({effects:i,motion:a,icons:n.icons,clock:c,surface:G}),Y=qn(l,{motion:a,option:()=>o.tooltip,description:()=>o.markDescription}),re=Gn(l),j=Bn(l),U=o.announce?Ot(l):void 0,ae=[],se=[],be=!1,V=He(M.frame,kt,{clock:c,motion:a,onChange:()=>be=!0}),_,ee,le=_n({clock:c,runner:K,leaving:x,draw:Et,land:et});function we(g,B=i){let h=Yn(g);return jn(B,[h.series],"donutChart"),qi({data:g.data,encoding:h,sort:g.sort,width:g.width??A,height:g.height,center:k=>Qi(g,h.series,k),measure:N})}function ve(g,B){let h=X("g",{class:"ec-mark","data-key":g.key,role:"img"},f),k={clock:c,motion:a,onChange:()=>be=!0},S=X("g",{class:"ec-body"},h),P={key:g.key,row:g,shown:g,group:h,hit:X("path",{class:"ec-hit"},h),body:S,path:X("path",{class:"ec-slice","data-series":g.series},S),label:X("text",{class:"ec-label","aria-hidden":"true"},h),share:X("text",{class:"ec-value","aria-hidden":"true"},h),drawnLabel:void 0,parts:[],handle:wn(()=>P,{halos:()=>w}),value:He(B?0:g.value,st,k),turn:He(1,st,k),offset:0,planned:0,presence:He(B?0:1,st,k),leave:void 0};return h.insertBefore(P.hit,S),E.set(h,P),P}function je(g,B,h){let k=g.parts[0]?.colors.color;g.shown=B;let{outline:S}=B.geometry,P=B.geometry.length>=cd,z=P?void 0:"hidden";ue(g.path,{d:S.d,visibility:z}),ue(g.hit,{d:S.d,visibility:z});let H=at(s.slot(g.key));Ie(g.path,pt(H)),g.parts=[{element:g.path,d:S.d,colors:H,visible:P}];let te=g.presence.value,de=te<1?te:void 0;g.drawnLabel=h;for(let[W,me]of[[g.label,h?.category],[g.share,h?.share]])me&&Mt(W,me),ue(W,{visibility:me?void 0:"hidden",opacity:de});g.handle.repaint(),H.color!==k&&G.recolor(g.key),g.key===We.ringKey&&Oe(g.key)}function Oe(g){let B=g===void 0?void 0:$.get(g);v.draw(B&&{outline:B.shown.geometry.outline,thickness:B.shown.geometry.thickness,transform:B.handle.style.transform})}function Pe(g,B,h){let k=mn(g.shown.geometry,B.geometry)||g.shown.datum!==B.datum;je(g,B,h),k&&K.change(B.geometry,B.data),g.key===We.key&&Re(g)}function Re(g){let{row:B}=g;Y.show(g.shown.geometry,B,()=>({title:B.category,lines:[`${es(B,o)} \xB7 ${kn(B.share)}`]}),g.handle.style.transform)}function $e(g){for(;u.childElementCount>g.length;)u.lastElementChild.remove();g.forEach((B,h)=>{let k=u.children[h]??X("text",{},u);ue(k,{class:h===0?"ec-center-value":"ec-center-label"}),Mt(k,B),Ie(k,{"font-size":h===0&&B.size!==wr?`${B.size}px`:void 0})})}let Ke=()=>re.categories(M.slices.map(g=>({key:g.key,label:g.category})),s,o.legend);function lt(g,B){let{series:h}=Yn(g);return Fn({option:g.table,caption:g.label,category:typeof g.category=="string"?g.category:void 0,series:[h],label:k=>qe(g.seriesLabels,k),rows:B.slices.map(k=>({key:k.key,category:k.category,datum:k.datum,index:k.index,values:[{series:h,value:k.value}],total:k.value})),format:ze(g),shares:!0})}function dt(){fn(l,{label:o.label,description:dd(o.description,M.centerText)})}function Qe(g,B){let h=o.announce;if(!U||!h)return;let k=Yn(o).series,S=Yn(g).series,P=o.sort??"none",z=W=>W.row.category,H=B.changed.map(({record:W})=>W),te=Cn({...o.label!==g.label?{label:o.label}:{},...k!==S?{series:[qe(o.seriesLabels,k)]}:{},...P!==(g.sort??"none")?{sort:P}:{},changed:H.map(z),added:B.entering.map(z),removed:B.exiting.map(z),count:F.length});if(typeof h!="function"){U.say(te);return}let de=W=>W.key;try{let W=h({text:te,changed:H.map(de),added:B.entering.map(de),removed:B.exiting.map(de)});W!=null&&U.say(String(W))}catch(W){Se(W)}}let ye=g=>$.get(g.key)===g||x.get(g.key)===g,Ve=g=>Math.max(0,g.value.value);function ut(g,B,h=Ve){let k=new Map,S=0;for(let P of g)k.set(P,B>0?S/B:0),S+=h(P);return k}function Ue(){ae=ae.filter(ye),se=se.filter(ye);let g=ae.reduce((S,P)=>S+Ve(P),0),B=ut(ae,g),h=ut(se,g),k=new Map;for(let S of ae){let P=B.get(S),z=S.turn.value,H=h.get(S),te=P;if(H!==void 0&&z<1){let de=H+S.offset-P;te=P+(1-z)*(de-Math.round(de-S.planned))}k.set(S,{start:te,span:g>0?Ve(S)/g:0})}return k}function St(g){let B=[...Ue()].map(([k,{start:S,span:P}])=>{let{row:z}=k,H={key:z.key,datum:z.datum,index:z.index,category:z.category,series:z.series,value:Ve(k),share:P,start:S*Ji,end:(S+P)*Ji};return{record:k,state:H}}),h=sa(g,B.map(({state:k})=>k),N);return B.map(({record:k,state:S},P)=>({record:k,slice:ia(g,S,h[P],N),label:h[P]}))}function Et(){if(!be)return;be=!1;let g=V.value;ue(l,At(g));let B=St(g);for(let{record:k,slice:S,label:P}of B)Pe(k,S,P);let h=B.reduce((k,{slice:S})=>k+S.value,0);$e(ca(g,_===void 0?M.centerText:Dt(vn(h,_)),N))}function Dt(g){return ee?.total!==g&&(ee={total:g,text:Qi(o,Yn(o).series,g)}),ee.text}function et(){ae=ae.filter(ye),se=ae;for(let g of ae)g.turn.set(1),g.offset=0,g.planned=0;_=void 0,ee=void 0,ue(l,At(M.frame)),M.slices.forEach((g,B)=>Pe($.get(g.key),g,M.labels[B])),$e(M.center),be=!1}function Tt(g){let B=new Set(g.slices.map(S=>S.key)),h={entering:[],exiting:[],changed:[]};for(let S of F)B.has(S.key)||($.delete(S.key),x.start(S),h.exiting.push(S));let k=F;return F=g.slices.map(S=>{let P=$.get(S.key);return P?(P.row.value!==S.value||P.row.series!==S.series)&&h.changed.push({record:P,from:P.shown.geometry}):(P=x.recall(S.key)??ve(S,!0),$.set(S.key,P),h.entering.push(P)),P.row=S,P.path.setAttribute("data-series",S.series),bt(P),P}),xn(f,k.map(S=>S.group),F.map(S=>S.group),We.active),h}function bt(g){g.group.setAttribute("aria-label",p.get(g.key)),Y.describe(g.group,g.row)}function Rt(g,B){be=!0;let h=Ue(),k=new Set(F.filter(ce=>ce.presence.value===0)),S=F.filter(ce=>!k.has(ce)),P=[...x.values()],z=se.length>0&&se.every(ce=>ce.turn.value===0),H=ae;if(ae=ud(H,F),!z){se=H;let ce=H.reduce((It,Dn)=>It+Ve(Dn),0),ft=ut(H,ce);for(let It of H)It.offset=h.get(It).start-ft.get(It)}se=se.filter(ce=>!k.has(ce));let te=ce=>$.get(ce.key)===ce?ce.row.value:0,de=ae.reduce((ce,ft)=>ce+te(ft),0),W=ut(ae,de,te),me=ut(se,de,te),Ne=!1;for(let ce of se){let ft=me.get(ce)+ce.offset-W.get(ce);ce.planned=ft-Math.round(ft),Math.abs(ce.planned)>1e-9&&(Ne=!0)}let Ge=S.some(ce=>Le(ce.value,ce.row.value,Me)||Le(ce.presence,1,Me))||P.some(ce=>Le(ce.value,0,Me)||Le(ce.presence,0,Me)),qt=Ne||k.size>0||Le(V,g.frame,_e),Ee,Je,Ae;if(!B&&a.staged){let ce=Ge?Xn:0;Ee={duration:Xn},Je={duration:Xn,delay:ce},Ae={duration:Xn/2,delay:ce+Xn/2}}else B||(Ee=Je=Ae={duration:(Ge&&qt?2:1)*Xn});let wt=[],Ye=(ce,ft,It,Dn)=>{Le(ce,ft,It)&&(Dn?wt.push(ce.to(ft,Dn)):ce.set(ft))};Ye(V,g.frame,_e,Je);for(let ce of S)Ye(ce.value,ce.row.value,Me,Ee),Ye(ce.presence,1,Me,Ee);for(let ce of k)Ye(ce.value,ce.row.value,Me,Ae),Ye(ce.presence,1,Me,Ae);for(let ce of P)Ye(ce.value,0,Me,Ee),Ye(ce.presence,0,Me,Ee);if(B){se=ae;for(let ce of ae)ce.turn.set(1),ce.offset=0,ce.planned=0;return wt}let Jt=new Set(se);for(let ce of ae)ce.turn.set(Jt.has(ce)?0:1);if(Ne)for(let ce of se)Ye(ce.turn,1,Me,Je);return wt}function Fe(g,B){return M=g,le.run(Rt(g,B))}let tt=g=>({mark:g.row.geometry,data:g.row.data}),Ct=g=>({mark:g.shown.geometry,data:g.shown.data});function en(g){let B=g,h=typeof B?.closest=="function"?B.closest(".ec-mark"):null,k=h?E.get(h):void 0;return k&&$.get(k.key)===k?k:void 0}let We=Vn({svg:l,runner:K,events:L,dim:()=>o.dim!==!1,find(g){let B=en(g);return B&&{key:B.key}},live:g=>$.has(g),order:()=>F.map(g=>g.key),element:g=>D(g)?.group,onScreen(g){let B=D(g);return B&&Ct(B)},ring:Oe,tooltip:{show(g){let B=$.get(g);B&&Re(B)},hide:()=>Y.hide(),element:()=>Y.element()}}),T=Zn(l,a);function q(){if(m)return;let g=we(o),B=new Map(g.slices.map(h=>[h.key,h]));for(let h of F)h.row=B.get(h.key)??h.row;Fe(g,!0)}let ie=Un(r,c,A,g=>{A=g,o.width===void 0&&q()}),he=Wn(d,()=>{N.clear(),q()});return dt(),Ke(),j.render(C),ue(l,At(M.frame)),F=M.slices.map(g=>{let B=ve(g,!1);return $.set(g.key,B),bt(B),B}),ae=se=F,M.slices.forEach((g,B)=>je(F[B],g,M.labels[B])),$e(M.center),We.sync(),K.enter(F.map(tt)),Ut(We.link,{element:l,async update(g){if(m)return;if(g.motion!==void 0&&g.motion!==o.motion)throw new TypeError("donutChart: `motion` can't be changed by update() yet.");let B={...o,...g};Yi(B);let h="on"in g?zn(i,o.on,B.on,n.presets):i,k=we(B,h),S=lt(B,k),P=Xi(B,k);"colors"in g&&(s=$t(B.colors));let z=o,H=M.total;o=B,M=k,p=P,dt(),Ke(),j.render(S);let te=U!==void 0;o.announce&&!U?U=Ot(l):!o.announce&&U&&(U.destroy(),U=void 0),We.syncDim(),le.supersede();let de=h!==i;i=h;let W=Kn({runner:K,events:L,hover:We,leaving:x,input:tt,onScreen:Ct,data:"data"in g,...de?{swap:Ne=>{let Ge=new Set(Ne.entering);K.swap(h,F.filter(qt=>!Ge.has(qt)).map(tt))}}:{}},()=>Tt(k),Ne=>{te&&Qe(z,Ne)});_=k.total===H?void 0:Math.max(Wt(H),Wt(k.total));let me=Fe(k,a.mode==="off");await le.wait(me,W)},on:L.on,marks:()=>F.map(g=>g.shown.geometry),focus(g){m||We.focus(g)},leave(){m||We.leave()},labels:()=>F.flatMap(g=>[...dn(g.key,"category",g.drawnLabel?.category,g.label),...dn(g.key,"value",g.drawnLabel?.share,g.share)]),destroy(){if(!m){m=!0,le.destroy(),We.destroy(),K.destroy(),Y.destroy(),re.destroy(),j.destroy(),U?.destroy(),T(),ie(),he();for(let g of[...F,...x.values()]){for(let B of[g.value,g.turn,g.presence])B.stop();g.leave?.resolve()}V.stop(),L.clear(),$.clear(),x.clear(),F=ae=se=[],l.remove()}}})}function Yi(e){Mn(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 es(e,t){let n=ze(t)(e.value),r=qe(t.seriesLabels,e.series);return e.series==="value"&&r==="value"?n:`${n} ${r}`}function Xi(e,t){return new Map(t.slices.map(n=>[n.key,ld(n,e)]))}function ld(e,t){let n=`${e.category}: ${es(e,t)}, ${kn(e.share)}`;if(!t.markLabel)return n;try{let r={series:e.series,label:qe(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:ze(t),text:n});if(o!=null&&String(o).trim()!=="")return String(o)}catch(r){Se(r)}return n}function Qi(e,t,n){let{center:r}=e,o=ze(e);if(r===!1)return"";if(r===void 0){let a=qe(e.seriesLabels,t);return t==="value"&&a==="value"?o(n):`${o(n)}
93
- ${a}`}try{let a=r(n,o);return a==null?"":String(a)}catch(a){return Se(a),""}}function dd(e,t){let n=t.split(`
94
- `).join(" ").trim(),r=e?.trim();return n===""?e:r?/[.!?:;]$/.test(r)?`${r} ${n}`:`${r}. ${n}`:n}function ud(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 ts=["UTC","local"],fa=1e3,oo=60*fa,ro=60*oo,to=24*ro,da={second:fa,minute:oo,hour:ro,day:to+ro,week:7*to+ro,month:31*to,year:366*to},fd=[...[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}],Zt=["year","month","day","hour","minute","second","millisecond"],md={second:"second",minute:"minute",hour:"hour",day:"day",week:"day",month:"month",year:"year"},yd={fractionalSecondDigits:3},ua={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",...yd}};function pd(e){for(let t of fd)if(da[t.unit]*t.count>=e)return t;return{unit:"year",count:Math.max(1,hr(e/da.year))}}function ns(e,t,n){let r=bd(n);if(!(t>e))return[{value:e,text:r(e,"year")}];let o=pd((t-e)/4),a=Zt[Math.min(Zt.indexOf(md[o.unit]),Zt.indexOf(hd(e,t,n)))],i=gd(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 hd(e,t,n){let[r,o]=[Sn(e,n),Sn(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 gd(e,t,n,r){let{unit:o,count:a}=n,i=[],s=Sn(e,r);if(o==="second"||o==="minute"||o==="hour"){let l=o==="hour"?15*oo:da[o],u=e-s.ms-(o==="second"?0:s.seconds*fa)-(o==="hour"?s.minutes%15*oo:0);for(;u<t;u+=l){let f=Sn(u,r),b=o!=="hour"||f.minutes===0,w=o==="second"?f.seconds:o==="minute"?f.minutes:f.hours;u>e&&b&&w%a===0&&i.push(u)}return i}let c=o==="day"?l=>no(r,s.year,s.month,s.date+l):o==="week"?l=>no(r,s.year,s.month,s.date-(s.weekday+6)%7+7*l):o==="month"?l=>no(r,s.year,Math.floor(s.month/a)*a+a*l,1):l=>no(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"||(Sn(u,r).date-1)%a===0)&&i.push(u)}return i}function rs(e,t,n){let{year:r,month:o,date:a,hours:i,minutes:s,seconds:c,ms:d}=Sn(e,n),l=new Date(0);l.setUTCFullYear(r,o+t+1,0);let u=Math.min(a,l.getUTCDate()),f=new Date(0);return n==="UTC"?(f.setUTCFullYear(r,o+t,u),f.setUTCHours(i,s,c,d)):(f.setFullYear(r,o+t,u),f.setHours(i,s,c,d)),f.getTime()}function os(e,t){let{ms:n,seconds:r,minutes:o,hours:a,date:i,month:s}=Sn(e,t);return n!==0?"millisecond":r!==0?"second":o!==0?"minute":a!==0?"hour":i!==1?"day":s!==0?"month":"year"}function as(e,t){let n=e.reduce((s,c)=>Math.max(s,Zt.indexOf(os(c,t))),0),r=is(t),o=n>=Zt.indexOf("second")?"medium":n>=Zt.indexOf("hour")?"short":void 0,a=n===Zt.indexOf("millisecond")?{year:"numeric",...ua.day,...ua.millisecond,timeZone:r}:{dateStyle:"medium",...o?{timeStyle:o}:{},timeZone:r},i=new Intl.DateTimeFormat(void 0,a);return s=>i.format(s)}function bd(e){let t=new Map;return(n,r)=>{let o=Zt.indexOf(os(n,e)),a={};for(let c=Math.min(o,Zt.indexOf(r));c<=o;c++)Object.assign(a,ua[Zt[c]]);let i=JSON.stringify(a),s=t.get(i);return s||t.set(i,s=new Intl.DateTimeFormat(void 0,{...a,timeZone:is(e)})),s.format(n)}}var is=e=>e==="UTC"?"UTC":void 0;function Sn(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 no(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 ha=2.25,xr=4.5,wd=300,ss=12,vd=32,ls=8,pa=11,vr=12.5,ga=10,kd=16,ma=8,ba=.36;function wa(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 ${kr(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(!ts.includes(i))throw new TypeError(`lineChart: timeZone must be "UTC" or "local", got ${kr(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:ya(t),key:r===void 0?void 0:ya(r),series:n.map(c=>({series:c,value:ya(c)})),timeZone:i,xFormat:e.xFormat}}function ds(e){let{width:t,measure:n}=e,r=e.height??wd,{rows:o,time:a}=Dd(e),i=e.encoding.series.map(E=>E.series),s=Ko(o.flatMap(E=>E.values.flatMap(L=>L.value===void 0?[]:[L.value]))),c=s.ticks.map(e.format),d=o[0]?.x??0,l=o[o.length-1]?.x??0,u=o.length===0?[]:a?ns(d,l,e.encoding.timeZone):Sd(d,l).map(E=>({value:E,text:Ea(E)})),f=u.map(E=>E.value),b=u.map(E=>E.text),w=b.map(E=>n(E,"ec-tick",pa)),v=e.label?cs(Pd(o,e.label),"ec-value",vr,n):0,R=Math.max(cs(c,"ec-tick",pa,n)+10,(w[0]??0)/2+2),N=Math.max(ls+2,(w[w.length-1]??0)/2+2,v>0?ga+v+4:0),F={scale:{lo:s.lo,hi:s.hi},box:{xLo:d,xHi:l,left:R,right:Math.max(R,t-N),top:ss,bottom:Math.max(ss,r-vd),width:t,height:r}},$={};for(let E of i)$[E]=0;for(let E of o)for(let L of E.values)L.value!==void 0&&($[L.series]=Math.max($[L.series],Wt(L.value)));let x=f.map((E,L)=>Sa(F,E,b[L]));return{width:t,height:r,frame:F,rows:o,time:a,series:i,yTicks:s.ticks.map((E,L)=>Ma(F,E,c[L])),xTicks:Ed(x,w),decimals:$}}function Qn(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 va(e,t,n,r,o=!1,a){let i=t[0];if(!i)return[];let s=Qn(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),b=new Map,w=$=>x=>x===$?void 0:b.get(x),v=n.map($=>{let x=m=>!m.missing?.has($),E=[],L=!1;for(let m of f)x(m)?(E.push({at:m.x,value:m.values[$]??0,datum:m.datum,gapBefore:L}),L=!1):L=E.length>0;if(u!==void 0&&x(d)&&x(l)){let m=d.values[$]??0;E.push({at:r,value:m+u*((l.values[$]??0)-m),datum:d.datum,gapBefore:!1})}let A=E.length>0?E.map(m=>({x:s.x(m.at),y:s.y(m.value)})):[{x:s.x(i.x),y:s.y(i.values[$]??0)}];return{name:$,vertices:E,points:A}}),R=v.filter(({vertices:$})=>$.length>0),N=a?xd(e,R.map(({name:$,vertices:x,points:E})=>({...E[E.length-1],text:a.text($,x[x.length-1].value)}))):[];return v.map(({name:$,vertices:x,points:E})=>{let L=E[E.length-1],A=a?N[R.findIndex(Y=>Y.name===$)]??{x:L.x+ga,y:L.y+vr*ba,anchor:"start",text:""}:void 0,m=a?A&&A.text!==""?[gn(A,a.measure,"ec-value",vr)]:[]:void 0,M=x.flatMap((Y,re)=>Y.gapBefore?[re]:[]),C=Xe.line({key:$,series:$,points:E,width:ha,...M.length>0?{breaks:M}:{},...m?{labelBounds:m}:{}}),p=0,D=x.map((Y,re)=>(re>0&&(p+=Math.hypot(E[re].x-E[re-1].x,E[re].y-E[re-1].y)),{t:C.length>0?re===x.length-1?1:Math.min(1,p/C.length):0,value:Y.value,at:ms(Y.at,o),...Y.gapBefore?{gapBefore:!0}:{}})),G=x[x.length-1],K={datum:G?G.datum:d.datum,samples:D,related:w($)};return b.set($,K),{series:$,geometry:C,data:K,end:{...L,value:G?G.value:i.values[$]??0},label:A}})}function us(e,t){let n=new Set;if(!e.some(o=>o.missing!==void 0&&o.missing.size>0))return n;let r=(o,a)=>o!==void 0&&!o.missing?.has(a);return e.forEach((o,a)=>{for(let i of t){let s=e[a-1],c=e[a+1];r(o,i)&&!r(s,i)&&!r(c,i)&&(s!==void 0||c!==void 0)&&n.add(er(i,o.key))}}),n}function er(e,t){return`${e}@${t}`}function ka(e,t,n,r=!1){let o=Qn(e),a=o.x(t.x),i=new Map;return n.filter(s=>!t.missing?.has(s)).map(s=>{let c=t.values[s]??0,d=er(s,t.key),l={datum:t.datum,samples:[{t:0,value:c,at:ms(t.x,r)}],related:u=>u===s?void 0:i.get(u)};return i.set(s,l),{key:d,series:s,geometry:Xe.point({key:d,series:s,x:a,y:o.y(c),r:xr}),data:l}})}function fs(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 xa(e,t){return{x1:t,y1:e.box.top,x2:t,y2:e.box.bottom}}function xd(e,t){let n=vr/2,r=Md(t.map(o=>o.y),kd,n,e.box.height-n);return t.map((o,a)=>({x:o.x+ga,y:r[a]+vr*ba,anchor:"start",text:o.text}))}function Md(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 Ma(e,t,n){let{box:r}=e,o=Qn(e).y(t);return{value:t,line:{x1:r.left,y1:o,x2:r.right+ls,y2:o},label:{x:r.left-8,y:o+pa*ba,anchor:"end",text:n}}}function Sa(e,t,n){return{value:t,label:{x:Qn(e).x(t),y:e.box.bottom+18,anchor:"middle",text:n}}}function Sd(e,t){if(!(t>e))return[e];let n=hr((t-e)/4),r=[e];for(let o=Math.floor(e/n)+1;On(o*n)<t;o++){let a=On(o*n);a>e&&r.push(a)}return r.push(t),r}function Ea(e){return String(e)}function Ed(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>=ma&&r.from-a.to>=ma&&o.push(a);return r.from-o[o.length-1].to>=ma&&o.push(r),o.map(a=>a.tick)}function Dd({data:e,encoding:t}){let n=new Set,r=!1,o=e.map((s,c)=>{let d=t.x(s,c);c===0&&(r=d instanceof Date);let l=Rd(d,c,r),u=String(t.key?t.key(s,c):r?new Date(l).toISOString():l);if(n.has(u))throw new Error(`lineChart: two rows have the key "${u}". Keys must be unique.`);n.add(u);let f=t.series.map(({series:b,value:w})=>({series:b,value:Ld(w(s,c),b,u)}));return{key:u,datum:s,index:c,x:l,values:f}});o.sort((s,c)=>s.x-c.x);for(let s=1;s<o.length;s++){let[c,d]=[o[s-1],o[s]];if(c.x===d.x){let l=r?new Date(c.x).toISOString():Ea(c.x);throw new Error(`lineChart: the rows "${c.key}" and "${d.key}" have the same x, ${l}. Each x is one point on every line, so x values must be unique.`)}}let a=Cd(t,r,o.map(s=>s.x)),i=Td(o,t.series.length);return{rows:o.map((s,c)=>({...s,label:a(s.x),missing:new Set(s.values.flatMap(d=>d.value===void 0?[d.series]:[])),levels:i[c]})),time:r}}function Td(e,t){let n=e.map(()=>({}));for(let r=0;r<t;r++){let o=-1,a=-1;e.forEach((i,s)=>{let{series:c,value:d}=i.values[r];if(d!==void 0){n[s][c]=d,o=s;return}if(a<=s)for(a=s+1;a<e.length&&e[a].values[r].value===void 0;)a++;let l=e[o]?.values[r].value,u=e[a]?.values[r].value;n[s][c]=l!==void 0&&u!==void 0?l+(i.x-e[o].x)/(e[a].x-e[o].x)*(u-l):l??u??0})}return n}function Rd(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 ${kr(e)} in row ${t}.`);if(typeof e!="number"||!Number.isFinite(e))throw new RangeError(`lineChart: x must be a finite number, got ${kr(e)} in row ${t}.`);return e}function Cd(e,t,n){let{xFormat:r}=e;return r?o=>r(t?new Date(o):o):t?as(n,e.timeZone):Ea}function ms(e,t){return t?new Date(e):e}function Ld(e,t,n){if(typeof e=="number"&&Number.isFinite(e))return e;if(e!=null)throw new RangeError(`lineChart: "${t}" for "${n}" must be a finite number, or null or undefined where it has no value, got ${kr(e)}.`)}function Pd(e,t){let n=new Map;for(let r of e)for(let{series:o,value:a}of r.values){if(a===void 0)continue;let i=t(o,a),s=i.replace(/\d/g,"0");n.has(s)||n.set(s,i)}return[...n.values()]}function cs(e,t,n,r){return e.reduce((o,a)=>Math.max(o,r(a,t,n)),0)}function ya(e){return typeof e=="function"?e:t=>t[e]}var kr=e=>typeof e=="string"?JSON.stringify(e):String(e);var ao=500,ys=2,ps=2,Od=.5;function Da(e,t,n){let r=un(e,"lineChart");Mn(t,"lineChart");let o=t,a=cn(t.motion,n.motion),i=Kt(t.on,n.presets),s=$t(t.colors),c=n.clock??Be,d=r.ownerDocument;ht(d);let l=X("svg",{class:"ec-chart ec-line-chart",role:"group"},r),u=X("g",{class:"ec-grid","aria-hidden":"true"},l),f=X("g",{class:"ec-axis","aria-hidden":"true"},l),b=X("line",{class:"ec-crosshair","aria-hidden":"true",visibility:"hidden"},l),w=X("g",{class:"ec-focus","aria-hidden":"true",visibility:"hidden"},l),v=X("g",{class:"ec-marks","aria-hidden":"true"},l),R=X("g",{class:"ec-lines"},v),N=X("g",{class:"ec-points"},v),F=X("g",{class:"ec-columns"},l),$=X("g",{class:"ec-overlay","aria-hidden":"true"},l),x=Ln(l),E=[],L=new Map,A=new Map,m=new WeakMap,M=[],C=new Map,p=new Map,D=Nn(y=>y.kind==="line"?y.presence.animating:y.row.presence.animating||y.row.values.animating||y.row.x.animating),G=In("lineChart"),K=Hn(r),Y=!1,re=1/0,j=new WeakSet,U,ae,se;try{U=Ve(o),ae=Ye(o,U),se=ws(o,U)}catch(y){throw l.remove(),y}let be=y=>p.get(y)??C.get(y)??D.get(y),V=ln({overlay:$,mark:y=>({set:O=>{be(y)?.handle.set(O),Ae.restyled(y)},reset:()=>{be(y)?.handle.reset(),Ae.restyled(y)}}),colors:y=>be(y)?.parts[0]?.colors}),_=an({effects:i,motion:a,icons:n.icons,clock:c,surface:V}),ee=qn(l,{motion:a,option:()=>o.tooltip,description:()=>o.markDescription}),le=Gn(l),we=Bn(l),ve=o.announce?Ot(l):void 0,je=!1,Oe=()=>{je=!0},Pe=He(U.frame.scale,kt,{clock:c,motion:a,onChange:Oe}),Re=He(U.frame.box,kt,{clock:c,motion:a,onChange:Oe}),$e=new Map,Ke=new Map,lt=U.decimals,dt={changed:[],added:[],removed:[]},Qe=U.frame,ye=_n({clock:c,runner:_,leaving:D,draw:T,land:ie});function Ve(y,O=i){let I=wa(y),Z=I.series.map(oe=>oe.series);jn(O,Z,"lineChart");let J=ds({data:y.data,encoding:I,width:y.width??K,height:y.height,format:ze(y),measure:x,label:ut(y,!0)}),Q=new Set(J.series);for(let oe of J.rows)for(let pe of J.series){let ge=er(pe,oe.key);if(Q.has(ge))throw new RangeError(`lineChart: two marks would have the key "${ge}". Series and keys joined with "@" must be unique.`);Q.add(ge)}for(let oe of J.rows)if(Q.has(oe.key))throw new RangeError(`lineChart: the key "${oe.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 ut(y,O=!1){let{labels:I}=y;if(I===!1)return;let Z=ze(y);return(J,Q)=>{let oe=`${Z(Q)} ${qe(y.seriesLabels,J)}`;if(typeof I!="function")return oe;try{let pe=I(Q,J,Z);return pe==null?"":String(pe)}catch(pe){return!O&&!j.has(I)&&(j.add(I),Se(pe)),oe}}}function Ue(y){let O=ut(o);if(O)return{text:(I,Z)=>O(I,vn(Z,y[I]??Wt(Z))),measure:x}}function St(y){let O=y.rows.map(hs);return{lines:new Map(va(y.frame,O,y.series,Dt(y),y.time,Ue(y.decimals)).map(I=>[I.series,I])),points:new Map(O.flatMap(I=>ka(y.frame,I,y.series,y.time)).map(I=>[I.key,I]))}}function Et(y){let O=y.rows[0],I=y.rows[y.rows.length-1];return O&&I?Math.min(Math.max(re,O.x),I.x):re}function Dt(y){let O=y.rows[y.rows.length-1];return O&&re<O.x?Et(y):1/0}let et=y=>!y.leaving&&y.row.x<=Et(U);function Tt(y,O){let I=X("g",{class:"ec-column","data-key":y.key,role:"img"},F),Z={clock:c,motion:a,onChange:Oe},J={key:y.key,row:y,column:I,hit:X("rect",{class:"ec-hit"},I),x:He(y.x,st,Z),values:He(y.levels,kt,Z),presence:He(O?0:1,st,Z),anchor:void 0,points:[],leaving:!1,shown:!0,px:0};return m.set(I,J),J}function bt(y,O,I){let Z=X("g",{class:"ec-line","data-key":y,"data-series":y},R),J=X("g",{class:"ec-body"},Z),Q={kind:"line",key:y,series:y,group:Z,body:J,path:X("path",{class:"ec-stroke","stroke-width":ha},J),end:X("circle",{class:"ec-end",r:xr},J),label:X("text",{class:"ec-value ec-end-label"},Z),drawnLabel:void 0,parts:[],handle:wn(()=>Q),target:O,shown:O,presence:He(I?0:1,st,{clock:c,motion:a,onChange:Oe}),leave:void 0};return Q}function Rt(y,O){let I=X("g",{class:"ec-point","data-key":O.key,"data-series":O.series},N),Z=X("g",{class:"ec-body"},I),J={kind:"point",key:O.key,series:O.series,row:y,group:I,body:Z,path:X("path",{class:"ec-dot"},Z),parts:[],handle:wn(()=>J),target:O,shown:O,hidden:void 0,leave:void 0};return J}let Fe=y=>be(y.key)===y,tt=y=>y.points.filter(O=>p.get(O.key)===O),Ct=()=>[...D.values()].filter(y=>y.kind==="line"),en=()=>({scale:Pe.value,box:Re.value});function We(){let y=Q=>({x:Q.x.value,values:Q.values.value}),O=new Map,I=new Set,Z=Q=>{let oe=O.get(Q);if(oe)return oe;let pe=Q.presence.value,ge=y(Q);if(Q.anchor&&pe<1&&!I.has(Q)){I.add(Q);let Te=Z(Q.anchor);I.delete(Q),ge={x:Te.x+pe*(ge.x-Te.x),values:kt(Te.values,ge.values)(pe)}}return O.set(Q,ge),ge};return[...E,...[...A.values()].filter(Q=>Q.presence.value>0&&Q.anchor)].map(Q=>{let{x:oe,values:pe}=Z(Q);return{record:Q,state:{key:Q.key,datum:Q.row.datum,x:oe,values:pe,missing:Q.row.missing}}}).sort((Q,oe)=>Q.state.x-oe.state.x)}function T(){if(!je)return;je=!1;let y=en(),O=We();he(y),g(y,O.map(I=>I.state));for(let{record:I,state:Z}of O){let J=new Map(ka(y,Z,I.points.map(Q=>Q.series),U.time).map(Q=>[Q.key,Q]));h(I.points.filter(Fe).flatMap(Q=>J.has(Q.key)?[{record:Q,placed:J.get(Q.key)}]:[]))}H(O.map(I=>I.state)),te(y,O),Ge()}function q(){let y=en(),O=We();g(y,O.map(I=>I.state)),te(y,O),Ge()}function ie(){for(let J of A.values()){for(let Q of[J.x,J.values,J.presence])Q.stop();J.column.remove()}A.clear();for(let J of E)J.anchor=void 0,J.points=J.points.filter(Fe);for(let[J,Q]of[[$e,U.yTicks],[Ke,U.xTicks]]){for(let oe of[...J.values()])oe.wanted||(oe.line?.remove(),oe.label.remove(),J.delete(oe.value));for(let oe of Q){let pe=J.get(oe.value);pe&&(pe.line&&"line"in oe&&ue(pe.line,{...oe.line,opacity:void 0}),Mt(pe.label,oe.label),pe.label.removeAttribute("opacity"))}}lt=U.decimals;let{frame:y}=U;ue(l,At(y.box)),Qe=y;let O=St(U),I=(J,Q)=>{let oe=J.flatMap(ge=>{let Te=Q(ge);return Te?[{record:ge,to:Te}]:[]});if(!oe.every(({record:ge,to:Te})=>Ad(ge.target.geometry,Te.geometry)&&bs(ge.target.data,Te.data)))for(let{record:ge,to:Te}of oe)ge.target=Te;h(oe.map(({record:ge})=>({record:ge,placed:ge.target})))};I(M,J=>O.lines.get(J.series)),B(new Map(M.flatMap(J=>O.lines.has(J.series)?[[J,O.lines.get(J.series)]]:[])));let Z=E.map(J=>({record:J,state:hs(J.row)}));for(let{record:J}of Z)I(tt(J),Q=>O.points.get(Q.key));H(Z.map(J=>J.state)),te(y,Z),Ge(),je=!1}function he(y){Qe=y,ue(l,At(y.box));let O=ze(o);for(let I of $e.values()){let Z=Ma(y,I.value,O(I.value)),J=I.opacity.value<1?I.opacity.value:void 0;ue(I.line,{...Z.line,opacity:J}),Mt(I.label,Z.label),ue(I.label,{opacity:J})}for(let I of Ke.values())Mt(I.label,Sa(y,I.value,I.text).label),ue(I.label,{opacity:I.opacity.value<1?I.opacity.value:void 0})}function g(y,O){let I=[...M,...Ct()];if(O.length===0||I.length===0)return;let Z=va(y,O,I.map(J=>J.series),Dt(U),U.time,Ue(lt));h(I.map((J,Q)=>({record:J,placed:Z[Q]}))),B(new Map(I.map((J,Q)=>[J,Z[Q]])))}function B(y){for(let[O,{label:I}]of y)I&&Mt(O.label,I),O.drawnLabel=I&&I.text!==""?I:void 0,ue(O.label,{visibility:O.drawnLabel?void 0:"hidden"})}function h(y){let O=y.some(({record:I,placed:Z})=>!bs(I.shown.data,Z.data));for(let{record:I,placed:Z}of y)I.kind==="line"?k(I,Z,O):S(I,Z,O)}function k(y,O,I){let Z=I||mn(y.shown.geometry,O.geometry);y.shown=O;let{geometry:J}=O;P(y,at(s.slot(y.series)),{visible:J.length>=Od,open:{width:J.thickness}}),ue(y.end,{cx:J.end.x,cy:J.end.y,visibility:O.data.samples.length===0?"hidden":void 0});let Q=y.presence.value;ue(y.group,{opacity:Q<1?Q:void 0}),Z&&_.change(J,O.data)}function S(y,O,I){let Z=I||mn(y.shown.geometry,O.geometry);y.shown=O,P(y,at(s.slot(y.series)),{visible:!0}),Z&&_.change(O.geometry,O.data)}function P(y,O,I){let Z=y.parts[0],{d:J}=y.shown.geometry.outline,Q=Z?.colors.color!==O.color;!Q&&Z?.d===J&&Z.visible===I.visible&&Z.open?.width===I.open?.width||(y.path.getAttribute("d")!==J&&y.path.setAttribute("d",J),Q&&Ie(y.group,pt(O)),y.parts=[{element:y.path,d:J,colors:O,...I}],y.handle.repaint(),Z&&Q&&V.recolor(y.key))}let z=!1;function H(y){let O=us(y,U.series);if(!(O.size===0&&!z)){for(let I of p.values())I.group.classList.toggle("ec-alone",O.has(I.key));z=O.size>0}}function te(y,O){let{x:I}=Qn(y),Z=O.filter(({record:oe})=>et(oe)),J=fs(y,Z.map(({state:oe})=>I(oe.x)));Z.forEach(({record:oe,state:pe},ge)=>{ue(oe.hit,{...J[ge]}),oe.px=I(pe.x)});let Q=new Set(Z.map(({record:oe})=>oe));for(let oe of[...E,...A.values()]){let pe=Q.has(oe);oe.shown!==pe&&(oe.shown=pe,ue(oe.column,{visibility:pe?void 0:"hidden","aria-hidden":oe.leaving?"true":void 0}));let ge=!et(oe);for(let Te of oe.points)Te.hidden!==ge&&(Te.hidden=ge,ue(Te.group,{visibility:ge?"hidden":void 0}),V.hide(Te.key,ge))}}function de(y){let O=L.get(y);if(!O||!et(O))return;let I=tt(O),Z=I[0]?.shown.geometry.center.x??O.px;ue(b,{...xa(Qe,Z),visibility:void 0});let J=I.map(pe=>{let{transform:ge}=pe.handle.style,{center:Te}=pe.shown.geometry;return(ge?xe.apply(ge,Te):Te).y}),{row:Q}=O,oe=J.length>0?{top:Math.min(...J)-xr,bottom:Math.max(...J)+xr}:{top:Qe.box.top,bottom:Qe.box.top};ee.showAt({x:Z,...oe},Q,()=>Gd(Q,o))}function W(){b.setAttribute("visibility","hidden"),ee.hide()}let me;function Ne(y){let O=y===void 0?void 0:L.get(y),I=O!==void 0&&et(O),Z=I?tt(O):[];if(I&&Z.length===0){me??(me=X("line",{class:"ec-focus-ring","stroke-width":ps},w)),(w.childElementCount>1||w.firstElementChild!==me)&&w.replaceChildren(me),ue(me,xa(Qe,O.px)),w.removeAttribute("visibility");return}for(me?.remove();w.childElementCount>Z.length;)w.lastElementChild.remove();Z.forEach((J,Q)=>{let oe=w.children[Q];oe||(oe=X("g",{},w),X("path",{class:"ec-focus-ring","stroke-width":2*(ys+ps)},oe),X("path",{class:"ec-focus-gap","stroke-width":2*ys},oe));for(let ge of Array.from(oe.children))ge.setAttribute("d",J.shown.geometry.outline.d);let{transform:pe}=J.handle.style;ue(oe,{transform:pe&&yt(pe)})}),ue(w,{visibility:Z.length>0?void 0:"hidden"})}function Ge(){Ae.key!==void 0&&de(Ae.key),Ae.ringKey!==void 0&&Ne(Ae.ringKey)}let qt=y=>({mark:y.target.geometry,data:y.target.data}),Ee=y=>({mark:y.shown.geometry,data:y.shown.data});function Je(y){let O=y,I=typeof O?.closest=="function"?O.closest(".ec-column"):null,Z=I?m.get(I):void 0;return Z&&L.get(Z.key)===Z&&et(Z)?Z:void 0}let Ae=Vn({svg:l,runner:_,events:G,dim:()=>!1,find(y){let O=Je(y);return O&&{key:O.key}},live(y){let O=L.get(y);return O!==void 0&&et(O)},order:()=>E.filter(et).map(y=>y.key),page(y,O){let I=L.get(y);if(!U.time||!I)return;let Z=E.filter(et),J=rs(I.row.x,O,wa(o).timeZone);if(O>0)return(Z.find(Q=>Q.row.x>=J)??Z[Z.length-1])?.key;for(let Q=Z.length-1;Q>=0;Q--)if(Z[Q].row.x<=J)return Z[Q].key;return Z[0]?.key},marks:y=>{let O=L.get(y);return O?tt(O).map(I=>I.key):[]},element:y=>(L.get(y)??A.get(y))?.column,markElement:y=>be(y)?.group,onScreen(y){let O=be(y);return O&&Ee(O)},ring:Ne,tooltip:{show:de,hide:W,element:()=>ee.element()}}),wt=()=>le.update(U.series.map(y=>({series:y,label:qe(o.seriesLabels,y)})),s,o.legend);function Ye(y,O){return Fn({option:y.table,caption:y.label,category:typeof y.x=="string"?y.x:void 0,series:O.series,label:I=>qe(y.seriesLabels,I),rows:O.rows.map(I=>({key:I.key,category:I.label,datum:I.datum,index:I.index,values:vs(I.values),missing:I.missing,total:ks(I.values)})),format:ze(y),total:!1})}function Jt(y){y.column.setAttribute("aria-label",se.get(y.key)),ee.describe(y.column,y.row)}function ce(y,O){let I=o.announce;if(!ve||!I)return;let Z=U.series,J=Ce=>Ce.row.label,{changed:Q,added:oe,removed:pe}=dt,ge=Cn({...o.label!==y.label?{label:o.label}:{},...Z.join(`
95
- `)!==O.join(`
96
- `)?{series:Z.map(Ce=>qe(o.seriesLabels,Ce))}:{},changed:Q.map(J),added:oe.map(J),removed:pe.map(J),count:E.length});if(typeof I!="function"){ve.say(ge);return}let Te=Ce=>Ce.key;try{let Ce=I({text:ge,changed:Q.map(Te),added:oe.map(Te),removed:pe.map(Te)});Ce!=null&&ve.say(String(Ce))}catch(Ce){Se(Ce)}}function ft(y){U=y;let O=St(y),I={entering:[],exiting:[],changed:[]},Z=new Set(y.rows.map(ne=>ne.key)),J=y.rows.length>0?y.series:[],Q={changed:[],added:[],removed:[]},oe=E,pe=new Map(oe.map(ne=>[ne,ne.row])),ge=new Map(y.rows.map(ne=>[ne.key,ne])),Te=M.filter(ne=>!J.includes(ne.series)),Ce=[];for(let ne of oe){let ke=!Z.has(ne.key),Vt=ge.get(ne.key)?.missing;ke&&(L.delete(ne.key),ne.leaving=!0,A.set(ne.key,ne),Q.removed.push(ne));for(let Nt of tt(ne))(ke||!J.includes(Nt.series)||Vt?.has(Nt.series))&&Ce.push(Nt)}for(let ne of Te)C.delete(ne.series);for(let ne of Ce)p.delete(ne.key);for(let ne of[...Te,...Ce])D.start(ne);I.exiting.push(...Te,...Ce);let fe=new Set,Lt=Q.removed.length>0;E=y.rows.map(ne=>{let ke=L.get(ne.key);return ke?(fe.add(ke),ke.row.x!==ne.x&&(Lt=!0),ne.values.some((Vt,Nt)=>ke.row.values[Nt]?.series!==Vt.series||ke.row.values[Nt]?.value!==Vt.value)&&Q.changed.push(ke)):(ke=A.get(ne.key)??Tt(ne,!0),A.delete(ne.key),ke.leaving=!1,ke.x.set(ne.x),ke.values.set(ne.levels),L.set(ne.key,ke),Q.added.push(ke),Lt=!0),ke.row=ne,ke}),E.forEach((ne,ke)=>{fe.has(ne)?ne.presence.value===1&&(ne.anchor=void 0):ne.anchor=gs(E,ke,fe)});for(let ne of Q.removed)ne.anchor??(ne.anchor=gs(oe,oe.indexOf(ne),fe));let pn=M;M=J.map(ne=>{let ke=C.get(ne),Vt=O.lines.get(ne);if(ke){let Nt=[...fe].some(Pt=>io(pe.get(Pt),ne)!==io(Pt.row,ne));(Lt||Nt)&&I.changed.push({record:ke,from:ke.shown.geometry})}else ke=It(ne,"line")??bt(ne,Vt,!0),C.set(ne,ke),I.entering.push(ke);return ke.target=Vt,ke});for(let ne of E){let ke=fe.has(ne)?pe.get(ne):void 0,Vt=J.filter(Pt=>!ne.row.missing.has(Pt)).map(Pt=>{let Lr=er(Pt,ne.key),Ya=O.points.get(Lr),Yt=p.get(Lr);return Yt?ke&&io(ke,Pt)!==io(ne.row,Pt)&&I.changed.push({record:Yt,from:Yt.shown.geometry}):(Yt=It(Lr,"point")??Rt(ne,Ya),Yt.row=ne,p.set(Lr,Yt),I.entering.push(Yt)),Yt.target=Ya,Yt}),Nt=new Set(Vt);ne.points=[...Vt,...ne.points.filter(Pt=>!Nt.has(Pt)&&Fe(Pt))]}for(let ne of E)Jt(ne);return xn(F,oe.filter(ne=>!ne.leaving).map(ne=>ne.column),E.map(ne=>ne.column),Ae.active),xn(R,pn.map(ne=>ne.group),M.map(ne=>ne.group),()=>null),dt=Q,je=!0,T(),I}function It(y,O){return D.get(y)?.kind===O?D.recall(y):void 0}function Dn(y,O){je=!0;let{frame:I}=y;for(let[fe,Lt,pn]of[[$e,y.yTicks,!0],[Ke,y.xTicks,!1]]){let ne=new Set(Lt.map(ke=>ke.value));for(let ke of ne)fe.has(ke)||Do(fe,ke,0,pn);for(let ke of fe.values())ke.wanted=ne.has(ke.value)}for(let fe of y.xTicks)Ke.get(fe.value).text=fe.label.text;let Z=Ct(),J=[...A.values()],Q=Le(Pe,I.scale,_e)||[...$e.values()].some(fe=>Le(fe.opacity,fe.wanted?1:0,Me))||E.some(fe=>Le(fe.values,fe.row.levels,_e))||M.some(fe=>Le(fe.presence,1,Me))||Z.some(fe=>Le(fe.presence,0,Me)),oe=Le(Re,I.box,_e)||[...Ke.values()].some(fe=>Le(fe.opacity,fe.wanted?1:0,Me))||E.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)),pe,ge;!O&&a.staged?(pe={duration:ao},ge={duration:ao,delay:Q?ao:0}):O||(pe=ge={duration:(Q&&oe?2:1)*ao});let Te=[],Ce=(fe,Lt,pn,ne)=>{Le(fe,Lt,pn)&&(ne?Te.push(fe.to(Lt,ne)):fe.set(Lt))};Ce(Pe,I.scale,_e,pe),Ce(Re,I.box,_e,ge);for(let fe of $e.values())Ce(fe.opacity,fe.wanted?1:0,Me,pe);for(let fe of Ke.values())Ce(fe.opacity,fe.wanted?1:0,Me,ge);for(let fe of E)Ce(fe.values,fe.row.levels,_e,pe),Ce(fe.x,fe.row.x,Me,ge),Ce(fe.presence,1,Me,fe.anchor?ge:void 0);for(let fe of J)Ce(fe.presence,0,Me,fe.anchor?ge:void 0);for(let fe of M)Ce(fe.presence,1,Me,pe);for(let fe of Z)Ce(fe.presence,0,Me,pe);return Te}function Do(y,O,I,Z,J=""){let Q={value:O,line:Z?X("line",{class:O===0?"ec-baseline":"ec-gridline"},u):void 0,label:X("text",{class:"ec-tick"},f),text:J,opacity:He(I,st,{clock:c,motion:a,onChange:Oe}),wanted:!0};y.set(O,Q);for(let oe of[...y.values()].sort((pe,ge)=>pe.value-ge.value))oe.line&&u.appendChild(oe.line),f.appendChild(oe.label)}function Za(y,O){return U=y,lt=Object.fromEntries(y.series.map(I=>[I,Math.max(lt[I]??0,y.decimals[I]??0)])),ye.run(Dn(y,O))}let Vc=Zn(l,a);function qa(){if(Y)return;let y=Ve(o),O=new Map(y.rows.map(Z=>[Z.key,Z]));for(let Z of E)Z.row=O.get(Z.key)??Z.row;let I=St(y);for(let Z of M)Z.target=I.lines.get(Z.series)??Z.target;for(let Z of p.values())Z.target=I.points.get(Z.key)??Z.target;Za(y,!0)}let Nc=Un(r,c,K,y=>{K=y,o.width===void 0&&qa()}),Fc=Wn(d,()=>{x.clear(),qa()});fn(l,o),wt(),we.render(ae);{let y=St(U);for(let O of U.yTicks)Do($e,O.value,1,!0);for(let O of U.xTicks)Do(Ke,O.value,1,!1,O.label.text);E=U.rows.map(O=>{let I=Tt(O,!1);return L.set(O.key,I),I.points=U.series.filter(Z=>!O.missing.has(Z)).map(Z=>{let J=Rt(I,y.points.get(er(Z,O.key)));return p.set(J.key,J),J}),Jt(I),I}),M=U.rows.length>0?U.series.map(O=>bt(O,y.lines.get(O),!1)):[];for(let O of M)C.set(O.series,O);ie()}let Ja=()=>[...M,...E.flatMap(tt)];return Ae.sync(),_.enter(Ja().map(qt)),Ut(Ae.link,{element:l,async update(y){if(Y)return;if(y.motion!==void 0&&y.motion!==o.motion)throw new TypeError("lineChart: `motion` can't be changed by update() yet.");let O={...o,...y};Mn(O,"lineChart");let I="on"in y?zn(i,o.on,O.on,n.presets):i,Z=Ve(O,I),J=Ye(O,Z),Q=ws(O,Z);"colors"in y&&(s=$t(O.colors));let oe=o,pe=U.series;o=O,se=Q,fn(l,o),we.render(J);let ge=ve!==void 0;o.announce&&!ve?ve=Ot(l):!o.announce&&ve&&(ve.destroy(),ve=void 0),ye.supersede();let Te=I!==i;i=I;let Ce=Kn({runner:_,events:G,hover:Ae,leaving:D,input:qt,onScreen:Ee,data:"data"in y,...Te?{swap:Lt=>{let pn=new Set(Lt.entering);_.swap(I,Ja().filter(ne=>!pn.has(ne)).map(qt))}}:{}},()=>ft(Z),()=>{ge&&ce(oe,pe)});wt();let fe=Za(Z,a.mode==="off");await ye.wait(fe,Ce)},reveal(y){if(Y)return;if(y instanceof Date&&Number.isNaN(y.getTime()))throw new RangeError("lineChart: reveal(x) needs a valid Date, got an invalid Date.");let O=y instanceof Date?y.getTime():y;if(typeof O!="number"||Number.isNaN(O))throw new RangeError(`lineChart: reveal(x) needs a number, got ${typeof O=="string"?JSON.stringify(O):String(O)}.`);let I=Et(U);re=O,Et(U)!==I&&(q(),Ae.dropGone(),Ae.sync())},on:G.on,marks:()=>[...M.map(y=>y.shown.geometry),...E.filter(et).flatMap(y=>tt(y).map(O=>O.shown.geometry))],focus(y){if(Y)return;let O=L.get(y)??p.get(y)?.row;O&&Ae.focus(O.key)},leave(){Y||Ae.leave()},labels:()=>M.flatMap(y=>dn(y.key,"value",y.drawnLabel,y.label)),destroy(){if(!Y){Y=!0,ye.destroy(),Ae.destroy(),_.destroy(),ee.destroy(),le.destroy(),we.destroy(),ve?.destroy(),Vc(),Nc(),Fc();for(let y of[...E,...A.values()])for(let O of[y.x,y.values,y.presence])O.stop();for(let y of[...M,...Ct()])y.presence.stop();for(let y of D.values())y.leave?.resolve();Pe.stop(),Re.stop();for(let y of[...$e.values(),...Ke.values()])y.opacity.stop();G.clear(),L.clear(),A.clear(),C.clear(),p.clear(),D.clear(),E=[],M=[],l.remove()}}})}function hs(e){return{key:e.key,datum:e.datum,x:e.x,values:e.levels,missing:e.missing}}function vs(e){return e.flatMap(t=>t.value===void 0?[]:[{series:t.series,value:t.value}])}function io(e,t){return e.values.find(n=>n.series===t)?.value}function ks(e){return e.reduce((t,n)=>t+(n.value??0),0)}function gs(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 Ad(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 bs(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&&$d(n.at,o.at)&&n.gapBefore===o.gapBefore})}function $d(e,t){return e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function xs(e,t){return vs(e).map(n=>({series:n.series,label:qe(t.seriesLabels,n.series),value:n.value}))}function Ms(e,t){let n=ze(t);return e.map(r=>{let o=qe(t.seriesLabels,r.series);return r.value===void 0?`${o} missing`:`${n(r.value)} ${o}`})}function Gd(e,t){return e.missing.size===0?Jr(e.label,xs(e.values,t),ze(t),{total:!1}):{title:e.label,lines:[Ms(e.values,t).join(" \xB7 ")]}}function ws(e,t){let n=ze(e);return new Map(t.rows.map(r=>{let o=xs(r.values,e),a=`${r.label}: ${Ms(r.values,e).join(", ")}`;if(!e.markLabel)return[r.key,a];try{let i=e.markLabel(r.datum,{key:r.key,category:r.label,values:o,total:ks(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 Mr(e){let t=Ta(e.start,e.pivot);return t>.5&&Math.abs(Ta(e.center,e.pivot)-t)<=.5&&Math.abs(Ta(e.end,e.pivot)-t)<=.5}var Ta=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y);var Ss=.5,Id=["left","right","top","bottom"];function Ds(e){return typeof e=="string"&&Id.includes(e)}function Sr(e,t){if(t!=="auto")return e.map(()=>t);if(e.length===0)return[];let n=Es(e,a=>a.x,a=>a.x+a.width,"left","right"),r=Es(e,a=>a.y+a.height,a=>a.y,"bottom","top");if(n&&r)return Vd(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 co(e,t,n){let r=En(t.map(f=>f.box)),o=Nd(r,n),a=t.map((f,b)=>({index:b,...o(f.box)})).sort((f,b)=>f.near-b.near||f.far-b.far||f.index-b.index),i=0,s=1/0,c=a.map(({index:f,near:b,far:w})=>{i>0&&w>b&&(s=Math.min(s,b-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:Xe.bar({key:e,...l===void 0?{}:{series:l},...r,baseline:n,radius:d.radius,gap:Number.isFinite(s)?Math.max(0,so(s)):0,...c.every(f=>f.series!==void 0)?{segments:c.map(f=>({series:f.series,size:so(f.size)}))}:{}}),order:a.map(f=>f.index)}}function Er(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 En(e){let t=Math.min(...e.map(r=>r.x)),n=Math.min(...e.map(r=>r.y));return{x:t,y:n,width:so(Math.max(...e.map(r=>r.x+r.width))-t),height:so(Math.max(...e.map(r=>r.y+r.height))-n)}}function Es(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)<Ss)s.push(r);else if(Math.abs(n(c)-i)<Ss)s.push(o);else break;if(s.length===e.length)return s}}function Vd(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 Nd(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 so(e){return Math.round(e*1e3)/1e3}function Ts(){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,b)=>{b===null?u.removeAttribute(f):u.getAttribute(f)!==b&&u.setAttribute(f,b)},o=(u,f)=>{let b=f.before.style;f.styles.size>0||!b||(f.before.style=void 0,n(u)?.cssText===b.css&&r(u,"style",b.text))},a=(u,f)=>{let b=f.before.class;if(f.classes.size>0||b===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(b)&&r(u,"class",b)};function i(u,f,b){let w=u.getAttribute(f),v=t(u).attributes,R=v.get(f);R?(w!==R.written&&(R.original=w),R.written=b):v.set(f,{original:w,written:b}),r(u,f,b)}function s(u,f,b){if(b!==null){i(u,f,b);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,b){let w=n(u);if(!w)return;let v=t(u),R=v.styles.get(f);if(b===void 0){if(!R)return;R.value===""?w.removeProperty(f):w.setProperty(f,R.value,R.priority),v.styles.delete(f),o(u,v);return}R||(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)!==b&&w.setProperty(f,b)}function d(u,f,b){let w=u.classList;if(b){if(w.contains(f))return;let R=t(u);R.classes.size===0&&(R.before.class=u.getAttribute("class")),R.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 b of[...f.styles.keys()])c(u,b,void 0);for(let b of[...f.classes])d(u,b,!1);for(let b of[...f.attributes.keys()])s(u,b,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 Dr(){let e=new Map;return t=>(e.has(t)||e.set(t,Ps(t)),e.get(t))}function Qt(e,t,n,r=Ps){let o=r(e),a=o&&r(t);return o&&a?xe.multiply(Rn(o),a):xe.multiply(Rn(Rs(e,n)),Rs(t,n))}function Tr(e){return mr(e.getAttribute("transform")??"")}function Cs(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 nr(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=tr(Math.min(...r)),i=tr(Math.min(...o));return{x:a,y:i,width:tr(tr(Math.max(...r))-a),height:tr(tr(Math.max(...o))-i)}}function Ls(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 Ps(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 Rs(e,t){let n=[1,0,0,1,0,0];for(let r=e;r&&r!==t;r=r.parentElement)n=xe.multiply(Tr(r),n);return n}function tr(e){return Math.round(e*1e3)/1e3}function $s(e,t,n){let r={},o=!1,a=Wr(),i=()=>{let{transform:c,opacity:d,emphasis:l}=r;for(let u of e()){let{element:f,colors:b}=u,w=c&&u.parentInverse?xe.multiply(u.parentInverse,c,u.parent,Tr(f)):void 0;t.style(f,"transform",w&&Hd(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=b?l!==void 0?Bd(b,l):o?b.strong:void 0:void 0;t.style(f,"fill",b?.paint==="fill"?v:void 0),t.style(f,"stroke",b?.paint==="stroke"?v:void 0),t.style(f,"transition",l===void 0||!b?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=Xt(r,c),i()},reset(){r={},i()},repaint:i,hot(c){c!==o&&(o=c,i())}}}function Gs(e,t){let n=Os(e,t,"fill"),r=n===Rr?"stroke":"fill",o=r==="fill"?n:Os(e,t,"stroke");if(!(o===void 0||o===Rr))return{color:o,strong:`color-mix(in oklab, ${o}, ${it("text")} ${Fd})`,paint:r}}var Fd="25%",Rr="none";function Os(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=As(e.ownerDocument.defaultView?.getComputedStyle?.(e).getPropertyValue(n)),a=n==="fill"?o?.replace(/\s/g,"")==="rgb(0,0,0)":o===Rr;return o!==void 0&&!(a&&r!==void 0)?o:As(r)}function As(e){let t=e?.trim().toLowerCase();if(!(!t||t==="inherit"||t.startsWith("url(")))return t===Rr||t==="transparent"||/^rgba\((?:[^,]+,){3}\s*0(?:\.0*)?\s*\)$/.test(t)?Rr:e.trim()}function Bd(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 Hd(e){return`matrix(${e.map((t,n)=>n<4?Math.round(t*1e6)/1e6:Math.round(t*1e3)/1e3).join(", ")})`}function Ra(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(Vs(e))return{elements:[e],data:void 0};if(Ns(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 Is(e){if(!Ns(e))return;let{elements:t,data:n}=Ra(e);return n&&new Map(t.map((r,o)=>[r,n[o]]))}function lo(e){let t;for(let n of e){if(!Vs(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 uo(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 Vs(e){return typeof e=="object"&&e!==null&&e.nodeType===1}function Ns(e){return typeof e=="object"&&e!==null&&typeof e.nodes=="function"&&typeof e.data=="function"}var jd=["d","x","y","width","height","cx","cy","r","points","transform"],zd=["transform","style"];function Fs(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=b=>{for(let{target:w,attributeName:v}of b){let R=w;i.has(R)&&o.add(R),s.has(R)&&(v==="transform"||v==="style")&&a.add(R)}},l=new r(b=>{d(b),(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 b={marks:o,ancestors:a};o=new Set,a=new Set,n(b)}function f(){l.takeRecords(),c?.(),c=void 0,o=new Set,a=new Set}return{observe(b,w){f(),l.disconnect(),i=new Set(b),s=new Set;for(let v of b)for(let R=v.parentElement;R&&!s.has(R);R=R===w?null:R.parentElement)s.add(R);for(let v of s)i.has(v)||l.observe(v,{attributes:!0,attributeFilter:zd});for(let v of i)l.observe(v,{attributes:!0,attributeFilter:jd})},destroy(){f(),l.disconnect(),i=new Set,s=new Set}}}var _d="http://www.w3.org/2000/svg",Kd=new Set(["img","image","graphics-symbol","graphics-object"]);function rr(e,t,n){Ud(t);let r=cn(t.motion,n.motion),o=Kt(t.on,n.presets),a=n.clock??Be,i=t.dim===!0,s=Ts(),c=new WeakMap,d=e,l=!1,u=!1;function f(h){let{elements:k,data:S}=Ra(h);if(k.length===0)return{root:void 0,ancestor:void 0,marks:[]};let P=lo(k),z=uo(k,P),H=new Map;k.forEach((Ee,Je)=>{let Ae=$(Ee,Je,S),wt=t.key(Ae,Ee);if(wt==null||wt==="")throw new TypeError(`expressive: key returned ${JSON.stringify(wt)??String(wt)} for a <${Ee.localName}>. Every mark needs a key.`);let Ye=String(wt),Jt=x(Ae,Ee,Ye),ce=H.get(Ye);if(!ce)H.set(Ye,ce=[]);else{if(Jt===void 0)throw new RangeError(`expressive: two elements have the key "${Ye}". Keys must be unique, or name each part with segment.`);if(ce.some(ft=>ft.series===Jt))throw new RangeError(`expressive: the mark "${Ye}" has two "${Jt}" segments.`)}ce.push({element:Ee,datum:Ae,series:Jt,value:t.value?.(Ae,Ee)})});let te={svg:P,common:z,screen:Dr(),colors:Ee=>L(Ee,P)},de=Ee=>({...Ee,label:E(Ee.key,Ee.parts)}),W=[...H.keys()];if(t.geometry){let Ee=W.map((Je,Ae)=>de(b(Je,H.get(Je),Ae,te)));return{root:P,ancestor:z,marks:F(N(Hs(Ee,Je=>Je.geometry)))}}let me=W.map(Ee=>H.get(Ee).map(Je=>w(Ee,Je,te))),Ne=me.map(Ee=>En(Ee.map(Je=>Je.rect.box))),Ge=Sr(Ne,t.baseline??"auto"),qt=Er(Ne,Ge).map(Ee=>de(v(W[Ee],me[Ee],Ge[Ee],Ee,te)));return{root:P,ancestor:z,marks:F(N(qt))}}function b(h,k,S,P){let z=k[0],H=t.geometry(z.element,z.datum,h);if(typeof H!="object"||H===null||H.key!==h)throw new TypeError(`expressive: geometry for "${h}" must be a MarkGeometry with the key "${h}". Build it with describe and the key passed in.`);let te=k.map(de=>R(de,Jd(H,de.series,k.length),P));return{key:h,geometry:H,parts:te,index:S}}function w(h,k,S){if(k.element.localName!=="rect")throw new TypeError(`expressive: can't read the geometry of a <${k.element.localName}> (mark "${h}"). Only <rect> marks are read; describe others with the geometry option.`);let P=xe.multiply(Qt(S.common,k.element.parentElement??S.svg,S.svg,S.screen),Tr(k.element));if(!Cs(P))throw new TypeError(`expressive: the <rect> of "${h}" is rotated or skewed, so it isn't an upright bar. Describe it with the geometry option.`);return{...k,rect:{box:nr(P,Ls(k.element)),series:k.series,radius:Yd(k.element)}}}function v(h,k,S,P,z){let{geometry:H,order:te}=co(h,k.map(me=>me.rect),S),de=H.segments??[],W=te.map((me,Ne)=>{let Ge=de[Ne];return R(k[me],Ge&&Ge.length>=.5?{d:Ge.outline.d}:void 0,z)});return{key:h,geometry:H,parts:W,index:P,rect:{edge:S,box:En(k.map(me=>me.rect.box))}}}function R(h,k,S){let P=Qt(S.common,h.element.parentElement??S.svg,S.svg,S.screen);return{element:h.element,datum:h.datum,series:h.series,value:h.value,parent:P,parentInverse:Xd(P),colors:S.colors(h.element),outline:k}}function N(h){return h.map(k=>{let{key:S,geometry:P,parts:z}=k,H=k.rect?Wd(z):void 0,te=(me,Ne,Ge)=>t.samples?qd(t.samples(me,Ne),Ge===void 0?`"${S}"`:`"${S}" (${Ge})`):H===void 0?[]:Zd(P,Ne,H),de=new Map,W=me=>de.get(me)??ie(me,S);for(let me of Bs(k)){let Ne=(z.find(Ge=>Ge.series===me)??z[0]).datum;de.set(me,{datum:Ne,samples:te(Ne,P.segments?.find(Ge=>Ge.series===me)??P,me),related:W})}return{...k,data:{datum:z[0].datum,samples:te(z[0].datum,P),related:W}}})}function F(h){if(h.length===0)return h;let k=new Set(h.flatMap(S=>[...S.geometry.series===void 0?[]:[S.geometry.series],...Bs(S)]));for(let S of _t){let P=o[S];if(P?.kind==="data")for(let z of P.needs?.related??[]){if(k.has(z))continue;let H=k.size>0?`the marks' series are ${[...k].map(te=>`"${te}"`).join(", ")}`:"the marks have no series";throw new RangeError(`expressive: on.${S} needs the series "${z}", but ${H}. Name each mark's series in its geometry (describe.line({ key, series, \u2026 })), or a stack's parts with segment.`)}}return h}function $(h,k,S){if(t.datum)return t.datum(h);if(S)return S[k];let P=h.__data__;return typeof P=="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__].")),P}function x(h,k,S){if(!t.segment)return;let P=t.segment(h,k);if(P==null||P==="")throw new TypeError(`expressive: segment returned ${String(P)} for a part of "${S}".`);return String(P)}function E(h,k){if(t.markLabel)try{let S=String(t.markLabel(k[0].datum,{key:h,parts:k.map(({series:P,datum:z})=>({series:P,datum:z}))})??"");return S.trim()===""?void 0:S}catch(S){Se(S);return}}function L(h,k){if((s.styled(h,"fill")||s.styled(h,"stroke"))&&c.has(h))return c.get(h);let S=Gs(h,k);return c.set(h,S),S}let A=f(d),m=A.root?.ownerDocument??(typeof document>"u"?void 0:document);if(!m)throw new TypeError("expressive needs a DOM.");ht(m);let M,C,p=new Map,D=[],G=new Map,K=new Map,Y=new Set,re={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set},j,U,ae,se,be=!1,V=(h,k,S)=>{let P=m.createElementNS(_d,h);return ue(P,k),S?.appendChild(P),P},_=V("g",{class:"ec-overlay","aria-hidden":"true"});Ie(_,{"pointer-events":"none"});let ee=V("g",{class:"ec-halos"},_),le=V("g",{class:"ec-runs"},_),we=Ur(_),ve=h=>p.get(h)??G.get(h),je=ln({overlay:le,mark:h=>({set:k=>ve(h)?.handle.set(k),reset:()=>ve(h)?.handle.reset()}),colors:h=>ve(h)?.mark.parts[0]?.colors}),Oe=an({effects:o,motion:r,icons:n.icons,clock:a,surface:je}),Pe=h=>({mark:h.mark.geometry,data:h.mark.data});function Re(h){let k={key:h.key,mark:h,handle:$s(()=>k.mark.parts.filter(S=>(K.get(S.element)?.record??k)===k),s,()=>ee)};return k}function $e(h){h.root&&h.root!==M&&Qe(h.root),C=h.ancestor??C;let k=new Set(h.marks.map(H=>H.key)),S={entering:[],exiting:[],changed:[],moved:[],newRow:!1},P=[];for(let H of D)k.has(H.key)||(p.delete(H.key),G.set(H.key,H),S.exiting.push(H));let z=K;K=new Map,D=h.marks.map(H=>{let te=p.get(H.key);if(te){let de=te.mark,W=t.value?eu(de.parts,H.parts):tu(de.geometry,H.geometry),me=de.data.datum!==H.data.datum;me&&(S.newRow=!0),W?S.changed.push({record:te,from:de.geometry}):(me||ru(de.geometry,H.geometry)||nu(de.data.samples,H.data.samples))&&S.moved.push(te),de.parts[0]?.colors?.color!==H.parts[0]?.colors?.color&&P.push(H.key),te.mark=H}else te=G.get(H.key),te?(G.delete(H.key),te.mark=H):te=Re(H),p.set(H.key,te),S.entering.push(te);for(let de of H.parts)K.set(de.element,{record:te,part:de});return te});for(let[H,te]of z)K.get(H)?.record!==te.record&&s.restore(H);for(let H of D)Ke(H);lt(),dt(),Dt();for(let H of D)H.handle.repaint();for(let H of P)je.recolor(H);return bt(),S}function Ke(h){if(!t.markLabel)return;let{label:k,parts:S}=h.mark;S.forEach((P,z)=>{let H=k!==void 0&&z===0;s.attribute(P.element,"role",H?"img":null),s.attribute(P.element,"aria-label",H?k:null),H?s.remove(P.element,"aria-hidden"):s.attribute(P.element,"aria-hidden",k===void 0?null:"true")})}function lt(){let h=M,k=new Set;for(let S of t.markLabel&&h?D:[])if(S.mark.label!==void 0)for(let P of S.mark.parts)for(let z=P.element.parentElement;z&&z!==h&&h?.contains(z);z=z.parentElement){if(k.has(z)||z.hasAttribute("aria-label")||z.hasAttribute("aria-labelledby"))continue;let H=z.getAttribute("role")?.trim().split(/\s+/)[0];(H!==void 0&&Kd.has(H)||H===void 0&&Y.has(z))&&k.add(z)}for(let S of Y)k.has(S)||(s.attribute(S,"role",null),s.attribute(S,"aria-roledescription",null));for(let S of k)s.remove(S,"role"),s.remove(S,"aria-roledescription");Y=k}function dt(){if(!M||!C)return;M.lastElementChild!==_&&M.appendChild(_),_.removeAttribute("transform");let h=Qt(_,C,M);Qd(h)||_.setAttribute("transform",yt(h))}function Qe(h){ye(),M=h,M.appendChild(_),(t.keyboard===!0||t.markLabel)&&M.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.')),ae=Zr(M,{find(k){let S=Ve(k);if(!S)return;let{key:P}=S.record;return S.part.series===void 0?{key:P}:{key:P,segment:S.part.series}},hover(k,S){let P=p.get(k.key);!P||Gt(j)&&j.keys[0]===k.key||(Ue(),ut([P],S,k.segment))},leave(){(j?.source==="pointer"||j?.source==="touch")&&Ue()}})}function ye(){M&&(Ue(),ae?.destroy(),ae=void 0)}function Ve(h){for(let k=h;k&&k!==M;k=k.parentElement){let S=K.get(k);if(S)return S}}function ut(h,k,S,P=!0){let z={keys:h.map(H=>H.key),source:k,effects:P};j=z,Dt(),P&&Oe.hover(h.map(Pe)),h.forEach((H,te)=>he("hover",{...Pe(H),batch:{index:te,count:h.length},source:k,...S===void 0?{}:{segment:S}})),k!=="linked"&&j===z&&se?.hover(h.map(Pe))}function Ue(){let h=j;h&&(j=void 0,Dt(),St(h.keys),Gt(h)&&se?.leave())}function St(h){let k=h.flatMap(S=>ve(S)??[]);Oe.leave(h),k.forEach((S,P)=>he("leave",{...Pe(S),batch:{index:P,count:k.length}}))}function Et(){if(j===void 0)return;let h=j.keys.filter(S=>p.has(S));if(h.length===j.keys.length)return;if(h.length===0){ae?.clear(),Ue();return}let k=j.keys.filter(S=>!p.has(S));j={...j,keys:h},St(k)}function Dt(){if(!i)return;let h=`${r.duration(100,"feedback")}ms`;for(let k of D){let S=j?.keys.includes(k.key)===!0;for(let P of k.mark.parts)s.toggleClass(P.element,"ec-attached",!0),s.toggleClass(P.element,"ec-dimmed",j!==void 0&&!S),s.style(P.element,"--ec-hover-duration",h);k.handle.hot(S)}for(let k of G.values())k.handle.hot(!1)}let et=i?r.subscribe(Dt):void 0,Tt=new Set(_t.flatMap(h=>{let k=o[h];return k?.kind==="data"?k.needs?.related??[]:[]}));function bt(){let h=U===void 0?void 0:p.get(U);we.draw(h?.mark.geometry)}let Rt=t.keyboard===!0?qr(()=>M,{find:h=>Ve(h)?.record.key,order:()=>D.map(h=>h.key),element:h=>p.get(h)?.mark.parts[0]?.element,tabIndex(h,k){let S=p.get(h);!S||k===void 0||S.mark.parts.forEach((P,z)=>{s.attribute(P.element,"tabindex",z===0?k:"-1"),s.style(P.element,"outline","none")})},focus(h,k){U=k?h:void 0,bt();let S=p.get(h);if(S){if(!k){j?.source==="keyboard"&&j.keys[0]!==h&&Ue();return}if(Gt(j)&&j.keys[0]===h){j={...j,source:"keyboard"};return}Ue(),ut([S],"keyboard")}},blur(){U=void 0,bt(),j?.source==="keyboard"&&(ae?.current===j.keys[0]?j={...j,source:"pointer"}:Ue())},escape(){return j?(j.source==="linked"&&se?se.dismiss():Ue(),!0):!1}}):void 0,Fe=t.watch===!0?Fs(m,a,Ct):void 0;function tt(){Fe?.observe(D.flatMap(h=>h.mark.parts.map(k=>k.element)),M)}function Ct(h){if(be||!C)return;let k=new Set;for(let te of h.marks){let de=K.get(te)?.record;de&&k.add(de)}let S=!1;for(let te of h.ancestors)if(te.contains(C))S=!0;else for(let de of D)de.mark.parts.some(W=>te.contains(W.element))&&k.add(de);if(S&&dt(),k.size===0)return;let{records:P,marks:z}=en([...k]);P.forEach((te,de)=>{let W=z[de];te.mark=W;for(let me of W.parts)K.set(me.element,{record:te,part:me});te.handle.repaint()}),D=q(D),P.some(te=>te.key===U)&&bt();let H=new Set(P);if(P.some(te=>Tt.has(te.mark.geometry.series??"")))for(let te of D)H.add(te);for(let te of H)Oe.change(te.mark.geometry,te.mark.data)}function en(h){let k={svg:M,common:C,screen:Dr(),colors:W=>K.get(W)?.part.colors},S=T(),P=({parts:W})=>W.map(me=>({element:me.element,datum:S(me.element),series:me.series,value:me.value}));if(t.geometry){let W=h.map(({mark:me})=>({...b(me.key,P(me),me.index,k),label:me.label}));return{records:[...h],marks:N(W)}}let z=new Map(h.map(W=>[W,P(W.mark).map(me=>w(W.key,me,k))])),H=We(z);for(let W of D)!z.has(W)&&H.get(W)!==W.mark.rect.edge&&z.set(W,P(W.mark).map(me=>w(W.key,me,k)));let te=[...z.keys()],de=te.map(W=>({...v(W.key,z.get(W),H.get(W),W.mark.index,k),label:W.mark.label}));return{records:te,marks:N(de)}}function We(h){let k=new Map(D.map(P=>[P,P.mark.rect.edge]));if(t.baseline!==void 0&&t.baseline!=="auto")return k;let S=D.map(P=>{let z=h.get(P);return z?En(z.map(H=>H.rect.box)):P.mark.rect.box});try{let P=Sr(S,"auto");return new Map(D.map((z,H)=>[z,P[H]]))}catch{return k}}function T(){if(t.datum)return t.datum;let h=Is(d);return k=>h?.has(k)?h.get(k):$(k,0,void 0)}function q(h){let k=[...h].sort((z,H)=>z.mark.index-H.mark.index);if(t.geometry)return[...Hs(k,z=>z.mark.geometry)];let S=k.map(z=>z.mark.rect.box),P=k.map(z=>z.mark.rect.edge);return Er(S,P).map(z=>k[z])}function ie(h,k){return D.find(S=>S.key!==k&&S.mark.geometry.series===h)?.mark.data}function he(h,k){for(let S of[...re[h]])try{S(k)}catch(P){Se(P)}}function g(h,k){k.forEach((S,P)=>he(h,{...Pe(S),batch:{index:P,count:k.length}}))}return Oe.enter($e(A).entering.map(Pe)),Rt?.sync(),tt(),Ut({targets:()=>D.map(h=>({key:h.key,marks:[Pe(h)]})),hover(h,k){Ue();let S=h.flatMap(P=>p.get(P)??[]);S.length>0&&ut(S,"linked",void 0,k)},unlink(){j?.source==="linked"&&Ue()},leave(){ae?.clear(),Ue()},listen(h){return be?!1:(se=h,!0)}},{refresh(h){if(be)return;let k=f(h??d);h!==void 0&&(d=h),Oe.interrupt();let S=$e(k);tt(),Et();let P=Oe.exit(S.exiting.map(Pe));g("exit",S.exiting),(S.newRow||S.changed.length>0||S.entering.length>0||S.exiting.length>0)&&Oe.update(S.changed.map(({record:H,from:te})=>({...Pe(H),from:te}))),S.changed.forEach(({record:H,from:te},de)=>he("update",{...Pe(H),from:te,batch:{index:de,count:S.changed.length}})),Oe.enter(S.entering.map(Pe)),g("enter",S.entering);let z=new Set([...S.changed.map(H=>H.record),...S.moved]);if([...z,...S.entering,...S.exiting].some(H=>Tt.has(H.mark.geometry.series??""))){let H=new Set(S.entering);for(let te of D)H.has(te)||z.add(te)}for(let H of z)Oe.change(H.mark.geometry,H.mark.data);Oe.settle(),Rt?.sync(),P.then(()=>{for(let H of S.exiting)G.get(H.key)===H&&G.delete(H.key)})},on(h,k){let S=re[h];if(!S)throw new TypeError(`expressive: unknown event "${String(h)}". Use one of: ${Object.keys(re).join(", ")}.`);return S.add(k),()=>{S.delete(k)}},marks:()=>D.map(h=>h.mark.geometry),focus(h){p.has(h)&&!be&&Rt?.focus(h)},destroy(){if(!be){be=!0,j=void 0,se?.gone(),se=void 0,Fe?.destroy(),Oe.destroy(),et?.(),Rt?.destroy(),ye(),_.remove(),s.restoreAll();for(let h of Object.values(re))h.clear();p.clear(),G.clear(),D=[],K=new Map}}})}function Ud(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"&&!Ds(e.baseline))throw new RangeError(`expressive: baseline must be "left", "right", "top", "bottom" or "auto", got ${String(e.baseline)}.`)}function Bs(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 Wd(e){let t=0;for(let{value:n}of e){if(typeof n!="number"||!Number.isFinite(n))return;t+=n}return t}function Zd(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=js(e.start,t.start);return[{t:0,value:r(o)},{t:1,value:r(o+t.length)}]}function qd(e,t){if(!Array.isArray(e))throw new TypeError(`expressive: samples for ${t} must return an array of { t, value }, got ${fo(e)}.`);let n=0;return e.map((r,o)=>{let{t:a,value:i,at:s,gapBefore:c}=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 ${fo(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 ${fo(i)}.`);if(c!==void 0&&typeof c!="boolean")throw new RangeError(`expressive: samples for ${t}: samples[${o}].gapBefore must be true or false, got ${fo(c)}.`);return n=a,{t:a,value:i,...s===void 0?{}:{at:s},...c?{gapBefore:c}:{}}})}function fo(e){return typeof e=="string"?JSON.stringify(e):String(e)}function Hs(e,t){let n=e[0]&&t(e[0]).pivot;if(!n||!e.every(a=>js(t(a).pivot,n)<=.5&&Mr(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 js(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Jd(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 Yd(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 Xd(e){try{return Rn(e)}catch{return}}function Qd(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 eu(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 tu(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 nu(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 ru(e,t){if(e.outline.d!==t.outline.d||e.thickness!==t.thickness||Jo(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 ou=["line","rect","arc","symbol"],au=["d","transform","x","y","width","height","stroke-width"];function mo(e,t,n){if(iu(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=rr(o.elements,{...s,datum:m=>w(m).datum,geometry:(m,M,C)=>{let p=o.geometry.get(C);if(!p)throw new TypeError(`fromVegaView: no geometry for "${C}". Its key must be the same for every item of a mark.`);return p},...t.samples||!t.sample?{}:{samples:(m,M)=>o.samples.get(M)??[]},...t.value||!t.sample?{}:{value:(m,M)=>o.values.get(M)}},n),d=n.clock??Be,l,u,f=!1,b=typeof MutationObserver=="function"?new MutationObserver(m=>m.some(x)&&E()):void 0;L(o.root);function w(m){let M=o.items.get(m);if(!M)throw new TypeError("fromVegaView: an element that isn't one of the View's items.");return M}function v(){let m=su(zs(e),r),M=cu(m,r,e),C=e.container(),p=C?.localName==="svg"?C:C?.querySelector("svg"),D={root:p??void 0,elements:[],items:new Map,geometry:new Map,samples:new Map,values:new Map};if(!M||!p)return D;let G=new Set(M==="line"?m.flatMap(_=>_.items?.length?[_.items[0]]:[]):m.flatMap(_=>_.items??[])),K=new Map;for(let _ of Array.from(p.querySelectorAll("*"))){let ee=_.__data__;G.has(ee)&&K.set(_,ee)}let Y=[...K.keys()];if(Y.length===0)return D;let re=lo(Y),j=uo(Y,re),U=Dr(),ae=_=>Qt(j,_.parentElement??re,re,U),se=_=>String(t.key(K.get(_).datum,_)),be=_=>t.segment?String(t.segment(K.get(_).datum,_)):void 0,V={root:re,items:K,elements:Y,geometry:new Map,samples:new Map,values:new Map};if(t.sample)for(let[_,ee]of K){let le=M==="line"?Ca(ee).map(we=>we.item):[ee];V.values.set(_,le.map(we=>N(we).value).join(","))}if(M==="rect")return R(V,ae,se,be);for(let _ of Y){let ee=K.get(_),le=se(_);if(V.geometry.has(le))continue;let we=ae(_),ve=M==="line"?du(le,_,ee,we):M==="arc"?uu(le,ee,we):fu(le,ee,we);V.geometry.set(le,ve),t.sample&&V.samples.set(ve,M==="line"?F(ve,ee,we):$(ve,ee,M))}return V}function R(m,M,C,p){let D=new Map;for(let j of m.elements){let U=m.items.get(j),ae=C(j),se={box:nr(M(j),mu(U)),series:p(j),radius:Math.max(0,U.cornerRadius??0)},be=D.get(ae);be?be.push({element:j,part:se}):D.set(ae,[{element:j,part:se}])}let G=[...D.keys()],K=G.map(j=>En(D.get(j).map(U=>U.part.box))),Y=Sr(K,t.baseline??"auto"),re=[];for(let j of Er(K,Y)){let U=G[j],ae=D.get(U),{geometry:se,order:be}=co(U,ae.map(V=>V.part),Y[j]);if(m.geometry.set(U,se),re.push(...be.map(V=>ae[V].element)),t.sample){let V=be.map(le=>N(m.items.get(ae[le].element)).value),_=V.reduce((le,we)=>le+we,0);m.samples.set(se,[{t:0,value:0},{t:1,value:_}]);let ee=0;(se.segments??[]).forEach((le,we)=>{let ve=ee;ee+=V[we]??0,m.samples.set(le,[{t:0,value:ve},{t:1,value:ee}])})}}return{...m,elements:re}}function N(m){let M=t.sample(m.datum),C=typeof M=="number"?{value:M}:M;if(typeof C!="object"||C===null||!Number.isFinite(C.value))throw new RangeError(`fromVegaView: sample must give a finite number, or { value, at }, got ${JSON.stringify(M)}.`);return C.at===void 0?{value:C.value}:{value:C.value,at:C.at}}function F(m,M,C){return yr(m,Ca(M).map(({item:p,point:D})=>({...xe.apply(C,D),...N(p)})))}function $(m,M,C){let{value:p,at:D}=N(M),G=D===void 0?{t:1,value:p}:{t:1,value:p,at:D};return C==="symbol"?[{...G,t:0}]:m.length>0?[{t:0,value:0},G]:[{...G,t:0}]}function x(m){let M=l?.querySelector(":scope > .ec-overlay"),C=p=>p===M||(M?.contains(p)??!1);return C(m.target)?!1:m.type==="childList"?[...Array.from(m.addedNodes),...Array.from(m.removedNodes)].some(p=>!C(p)):!0}function E(){if(u||f)return;let m=d.onFrame(()=>{m(),u=void 0;try{A()}catch(M){Se(M)}});u=m}function L(m){!b||m===l||(b.disconnect(),l=m,m&&b.observe(m,{subtree:!0,childList:!0,attributes:!0,attributeFilter:au}))}function A(){if(f)return;let m=v(),M=o;o=m;try{c.refresh(m.elements)}catch(C){throw o=M,C}L(m.root)}return Ut(Pi(c),{refresh:A,on:c.on,marks:c.marks,focus:c.focus,destroy(){f||(f=!0,b?.disconnect(),u?.(),u=void 0,c.destroy())}})}function iu(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 zs(e){let t=e.scenegraph();return t.root??t}function su(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 cu(e,t,n){if(e.length===0){let o=lu(zs(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)||!ou.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 lu(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 Ca(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:gt(r.x),y:gt(r.y)}}))}function du(e,t,n,r){let o=n.strokeWidth??Number.parseFloat(t.getAttribute("stroke-width")??"1");return Xe.line({key:e,series:e,points:Ca(n).map(({point:a})=>xe.apply(r,a)),width:(Number.isFinite(o)?o:1)*La(r)})}function uu(e,t,n){let r=xe.apply(n,{x:gt(t.x),y:gt(t.y)}),o=La(n),[a,i]=[gt(t.startAngle),gt(t.endAngle)].sort((s,c)=>s-c);return Xe.arc({key:e,cx:r.x,cy:r.y,inner:gt(t.innerRadius)*o,outer:gt(t.outerRadius)*o,start:a,end:i})}function fu(e,t,n){let r=xe.apply(n,{x:gt(t.x),y:gt(t.y)});return Xe.point({key:e,x:r.x,y:r.y,r:Math.sqrt(Math.max(0,t.size??64)/Math.PI)*La(n)})}function mu(e){let t=gt(e.x),n=gt(e.y),r=gt(e.width),o=gt(e.height);return{x:Math.min(t,t+r),y:Math.min(n,n+o),width:Math.abs(r),height:Math.abs(o)}}function La(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))}function gt(e){return typeof e=="number"&&Number.isFinite(e)?e:0}var yu={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},Pa=/[\s,]*([A-Za-z]|[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)/y,_s=/^[A-Za-z]$/;function yo(e){let t=[];Pa.lastIndex=0;for(let c=Pa.exec(e);c;c=Pa.exec(e))t.push(c[1]);let n=[],r={x:0,y:0},o=r,a,i="",s=0;for(;s<t.length;){if(_s.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=yu[c];if(d===void 0)break;let l=[],u=!1;for(;l.length<d&&s<t.length&&!_s.test(t[s]);){let L=t[s];if(c==="A"&&(l.length===3||l.length===4)){let A=L[0];if(A!=="0"&&A!=="1"){u=!0;break}l.push(Number(A)),L.length>1?t[s]=L.slice(1):s++;continue}l.push(Number(L)),s++}if(u||l.length<d||!l.every(Number.isFinite))break;let f=i!==c,b=(L,A)=>f?{x:r.x+L,y:r.y+A}:{x:L,y:A},[w=0,v=0,R=0,N=0,F=0,$=0,x=0]=l,E;switch(c){case"M":r=o=b(w,v),n.push({op:"M",to:r}),i=f?"l":"L";break;case"L":n.push({op:"L",to:r=b(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 L=c==="S",A=L?a&&Ks(n,"C")?Us(a,r):r:b(w,v);E=L?b(w,v):b(R,N),n.push({op:"C",c1:A,c2:E,to:r=L?b(R,N):b(F,$)});break}case"Q":case"T":{let L=c==="T";E=L?a&&Ks(n,"Q")?Us(a,r):r:b(w,v),n.push({op:"Q",c:E,to:r=L?b(w,v):b(R,N)});break}case"A":n.push({op:"A",rx:Math.abs(w),ry:Math.abs(v),rotation:R,large:N!==0,sweep:F!==0,to:r=b($,x)});break}a=E}return n}var Ks=(e,t)=>e[e.length-1]?.op===t,Us=(e,t)=>({x:2*t.x-e.x,y:2*t.y-e.y});function po(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,...pu(o,t),sweep:r!==o.sweep,to:n(o.to)}}})}function pu({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,b=d*d+l*l,w=(u+b)/2,v=Math.hypot((u-b)/2,f),R=w+v,N=Math.abs(f)<1e-12?u>=b?0:Math.PI/2:Math.atan2(R-u,f);return{rx:Math.sqrt(R),ry:Math.sqrt(Math.max(0,w-v)),rotation:N*180/Math.PI}}function ho(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 hu={get:()=>{}},gu={set(){},reset(){}},Oa={place(){},update(){},remove(){}};function Ws(e,t){let{effect:n,surface:r}=t;if(!Aa(n))throw new TypeError(`playTransition needs a transition effect (kind "transition" with run, end and clear), got ${bu(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??vt,i=t.clock??Be,s=t.icons??hu,c=e.length,d=[],l=!1,u=c,f,b=new Promise(A=>{f=A}),w=c>0?a.subscribe(()=>{a.mode==="off"&&E()}):void 0,v=()=>{--u>0||(w?.(),w=void 0,f())};function R(A,m,M){let C=Io({clock:i,motion:a,icons:s,batch:{index:m,count:c},layer:L(A.to.key,m,()=>p.state!=="cleared"),mark:gu}),p={pair:A,index:m,scope:C,context:{...C.context,start:o},state:"running",done:M};d[m]=p;let{from:D,to:G}=A;try{a.mode==="off"?(n.end(D,G,p.context),N(p)):Promise.resolve(n.run(D,G,p.context)).then(()=>N(p),K=>F(p,K))}catch(K){F(p,K)}}function N(A){A.state==="running"&&(A.state="ended",$(A))}function F(A,m){let{signal:M}=A.context;M.aborted&&(m===M.reason||m?.name==="AbortError")||(Se(m),x(A))}function $(A){let m=A.done;A.done=void 0,m?.()}function x(A){if(A.state!=="cleared"){A.state="cleared",A.scope.abort();try{n.clear(A.context)}catch(m){Se(m)}A.scope.clear(),$(A)}}function E(){for(let A of[...d]){if(A.state!=="running")continue;let m=A.done;A.done=void 0,x(A),R(A.pair,A.index,m)}}function L(A,m,M){let C,p=()=>M()?C??(C=r.group(A,m)):void 0;return{icon:(D,G)=>p()?.icon(D,G)??Oa,path:(D,G)=>p()?.path(D,G)??Oa,text:(D,G)=>p()?.text(D,G)??Oa,clear(){let D=C;C=void 0,D?.clear()}}}return e.forEach((A,m)=>R(A,m,v)),c===0&&f(),{finished:b,clear(){if(!l){l=!0;for(let A of[...d])x(A)}}}}function Aa(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 bu(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 wu=950,vu=.4,or=.5;function Ia(e,t,n){let r=un(e,"chartSwitch"),o=Du(t),a=t.transition,i=$t(t.colors),s=n.motion,c=n.clock??Be,d=r.ownerDocument;ht(d);let l=d.createElement("div");l.className="ec-switch",r.appendChild(l);let u=new Map;try{for(let V of o){let _=d.createElement("div");_.className="ec-switch-view",_.setAttribute("data-view",V),l.appendChild(_),$a(_,V===t.initial);let ee=t.views[V](_,i);if(!Eu(ee,_))throw ee?.destroy?.(),new TypeError(`chartSwitch: views.${V} 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(V,{name:V,container:_,chart:ee})}}catch(V){for(let _ of u.values())_.chart.destroy();throw l.remove(),V}let f=X("svg",{class:"ec-chart ec-switch-overlay","aria-hidden":"true"},l),b=X("g",{class:"ec-switch-fades"},f),w=X("g",{class:"ec-switch-runs"},f),v=X("g",{class:"ec-switch-labels"},f),R=t.announce?Ot(f):void 0,N=new WeakMap,F={group(V,_){let ee=X("g",{class:"ec-run","data-key":V},w);Ie(ee,pt(at(i.slot(V)))),N.set(ee,_);let le=Array.from(w.children).find(we=>(N.get(we)??-1/0)>_);return w.insertBefore(ee,le??null),{...br(ee),clear:()=>ee.remove()}}},$=t.initial,x,E=!1,L=s.subscribe(()=>{s.mode==="off"&&x&&j(x,!0)}),A,m=typeof ResizeObserver=="function"?new ResizeObserver(V=>{let _=V[V.length-1]?.contentRect.width??0;if(A!==void 0&&Math.abs(_-A)<.5)return;let ee=A===void 0;A=_,!ee&&x&&j(x,!0)}):void 0;m?.observe(l);let M=V=>u.get(V);function C(){return l.getRootNode().activeElement??null}function p(V){let _=C();if(!_||!V.container.contains(_))return;let ee=_.closest("[data-key]");return{key:ee&&V.chart.element.contains(ee)?ee.getAttribute("data-key")??void 0:void 0}}function D(V,_){if(!_)return;let ee=C();if(ee&&ee!==d.body&&ee!==d.documentElement&&!l.contains(ee))return;let le=()=>V.chart.element.contains(C());if(_.key!==void 0&&V.chart.focus(_.key),!le()){for(let we of V.chart.marks())if(V.chart.focus(we.key),le())return}}function G(V){R?.say(V.chart.element.getAttribute("aria-label")??"")}function K(V,_,ee){$=_.name;let le=ee?ee.focus:p(V);if(V.chart.leave(),s.mode==="off"){for(let Re of u.values())$a(Re.container,Re===_);return D(_,le),G(_),Promise.resolve()}for(let Re of[V,_])Re.container.classList.remove("ec-switch-inactive"),Re.container.classList.add("ec-switching"),Re.container.setAttribute("inert",""),Re.chart.element.classList.add("ec-morphing");let{pairs:we,scene:ve}=U(V,_),{done:je,settle:Oe}=Qs(),Pe={a:V,b:_,forward:!0,pairs:we,reversed:we.map(({from:Re,to:$e})=>({from:$e,to:Re})),scene:ve,focus:le,progress:0,transition:void 0,driver:void 0,run:0,done:je,settle:Oe};return x=Pe,Y(Pe,0),Pe.done}function Y(V,_){let ee=++V.run;if(_>=1){j(V,!0);return}let le=ve=>{V.progress=ve,V.scene.draw(V.forward?ve:1-ve)},we=xu(c);V.transition=Ws(V.forward?V.pairs:V.reversed,{effect:a,surface:F,start:_,motion:s,clock:we.clock,icons:n.icons}),V.driver=ku(_,le,{clock:we.clock,motion:s}),we.release(),Promise.all([V.driver.finished,V.transition.finished]).then(([ve])=>{x===V&&V.run===ee&&ve==="done"&&j(V,!0)})}function re(V){return V.driver?.cancel(),V.transition?.clear(),V.forward=!V.forward,$=(V.forward?V.b:V.a).name,V.settle(),{done:V.done,settle:V.settle}=Qs(),Y(V,1-V.progress),V.done}function j(V,_){if(x!==V)return;x=void 0,V.run++,V.driver?.cancel(),V.transition?.clear(),V.scene.clear();let ee=V.forward?V.b:V.a;for(let le of[V.a,V.b])le.chart.element.classList.remove("ec-morphing"),le.container.classList.remove("ec-switching"),le.container.style.removeProperty("opacity");for(let le of u.values())$a(le.container,le===ee);_&&(D(ee,V.focus),G(ee)),V.settle()}function U(V,_){let ee=Qt(f,V.chart.element,l),le=Qt(f,_.chart.element,l),we=V.chart.marks().map(ye=>Ga(ye,ee)),ve=_.chart.marks().map(ye=>Ga(ye,le)),je=new Map(we.map(ye=>[ye.key,ye])),Oe=new Set(ve.map(ye=>ye.key)),Pe=ve.flatMap(ye=>{let Ve=je.get(ye.key);return Ve?[{from:Ve,to:ye}]:[]}),Re=[];for(let ye of we)Oe.has(ye.key)||Re.push(ae(ye,Js));for(let ye of ve)je.has(ye.key)||Re.push(ae(ye,Ys));let $e=ye=>`${ye.role}
97
- ${ye.key}`,Ke=V.chart.labels(),lt=_.chart.labels(),dt=new Map(Ke.map(ye=>[$e(ye),ye])),Qe=new Set;for(let ye of lt){let Ve=dt.get($e(ye));Ve&&(Qe.add($e(ye)),Re.push(Mu(se(Ve,ee),se(ye,le))))}for(let ye of Ke)Qe.has($e(ye))||Re.push(qs(se(ye,ee),Js));for(let ye of lt)dt.has($e(ye))||Re.push(qs(se(ye,le),Ys));return Re.push(ye=>{Zs(V.container,1-go(ye/vu)),Zs(_.container,go((ye-or)/(1-or)))}),{pairs:Pe,scene:{draw:ye=>{for(let Ve of Re)Ve(ye)},clear:()=>{b.replaceChildren(),w.replaceChildren(),v.replaceChildren()}}}}function ae(V,_){let ee=X("g",{class:"ec-switch-fade","data-key":V.key},b);return Ie(ee,pt(at(i.slot(V.key)))),br(ee).path(V.outline.d,V.outline.closed?{fill:"mark"}:{stroke:"mark",width:V.thickness}),le=>ue(ee,{opacity:_(le)})}function se(V,_){let ee=V.element.cloneNode(!0);for(let we of["id","opacity","visibility","aria-hidden"])ee.removeAttribute(we);ee.textContent=V.text;let le=xe.apply(_,V);return ue(ee,{x:le.x,y:le.y,"text-anchor":V.anchor}),v.appendChild(ee),{text:ee,at:le}}return{get current(){return $},show(V){if(!u.has(V))return Promise.reject(new TypeError(`chartSwitch: there's no view ${JSON.stringify(V)}. The views are ${o.map(we=>JSON.stringify(we)).join(", ")}.`));if(E)return Promise.resolve();let _=x;if(!_)return V===$?Promise.resolve():K(M($),M(V));let ee=_.forward?_.b:_.a,le=_.forward?_.a:_.b;return V===ee.name?_.done:V===le.name?re(_):(j(_,!1),K(ee,M(V),{focus:_.focus}))},chart(V){let _=u.get(V);if(!_)throw new TypeError(`chartSwitch: there's no view ${JSON.stringify(V)}. The views are ${o.map(ee=>JSON.stringify(ee)).join(", ")}.`);return _.chart},destroy(){if(E)return;E=!0;let V=x;V&&(x=void 0,V.run++,V.driver?.cancel(),V.transition?.clear(),V.scene.clear(),V.settle()),L(),m?.disconnect(),R?.destroy();for(let _ of u.values())_.chart.destroy();l.remove()}}}function ku(e,t,n){let r=Or(e),o;return o=tn({duration:wu,timing:"transition",ease:mt,update:a=>{let i=Math.min(1,r+a);t(a===0?e:nt(i)),i>=1&&a<1&&o?.finish()}},n),o}function xu(e){let t=e.now();return{clock:{now:()=>t??e.now(),onFrame:n=>e.onFrame(n)},release(){t=void 0}}}function $a(e,t){e.classList.toggle("ec-switch-inactive",!t),e.toggleAttribute("inert",!t),t?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true")}function Zs(e,t){e.style.setProperty("opacity",String(Math.round(t*1e3)/1e3))}function Mu(e,t){return n=>{let r=Xs(e.at.x,t.at.x,n),o=Xs(e.at.y,t.at.y,n),a=n>=or;ue(e.text,{x:r,y:o,visibility:a?"hidden":void 0}),ue(t.text,{x:r,y:o,visibility:a?void 0:"hidden"})}}function qs(e,t){return n=>ue(e.text,{opacity:t(n)})}var Js=e=>1-go(e/or),Ys=e=>go((e-or)/(1-or)),go=e=>Math.min(1,Math.max(0,e)),Xs=(e,t,n)=>e*(1-n)+t*n,Su=e=>e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1&&e[4]===0&&e[5]===0;function Ga(e,t){if(Su(t))return e;let n=i=>xe.apply(t,i),r=i=>ho(po(yo(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:nr(t,e.bounds),center:n(e.center),pivot:n(e.pivot),...e.segments===void 0?{}:{segments:e.segments.map(i=>Ga(i,t))}}}function Qs(){let e;return{done:new Promise(n=>{e=n}),settle:e}}function Eu(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 Du(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(!Aa(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 ec=["presentation","analysis","off"],Tu={presentation:"Presentation",analysis:"Analysis",off:"Off"},Ru={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."},Cu=0;function Va(e,t,n={}){let r=Lu(e);Pu(t),Ou(n);let o={...Tu,...n.labels},a={...Ru,...n.hints},{persist:i}=n,s=r.ownerDocument;ht(s);let c=`ec-motion-${++Cu}`,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=ec.map(N=>{let F=u.appendChild(s.createElement("button"));return F.type="button",F.dataset.mode=N,F.textContent=o[N],F.addEventListener("click",()=>t.chooseMode(N)),F}),b=d.appendChild(s.createElement("span"));b.className="ec-motion-hint",b.id=`${c}-hint`,b.setAttribute("aria-live","polite");let w=()=>{let N=t.mode;for(let F of f)F.setAttribute("aria-pressed",String(F.dataset.mode===N));b.textContent=t.prefersReduced&&t.viewerChoice===void 0?a.reduced:a[N]};if(i!==void 0){let N=tc(s,F=>F.getItem(i));ec.includes(N)&&t.chooseMode(N)}w(),r.appendChild(d);let v=t.subscribe(()=>{if(w(),i===void 0)return;let N=t.viewerChoice;tc(s,F=>N===void 0?F.removeItem(i):F.setItem(i,N))}),R=!1;return{element:d,destroy(){R||(R=!0,v(),d.remove())}}}function tc(e,t){try{let n=e.defaultView?.localStorage;return n?t(n):void 0}catch{return}}function Lu(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 Pu(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 Ou(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 Au={play:"Play",pause:"Pause"};function Na(e,t,n={}){let r=$u(e);Gu(t),Iu(n);let o={...Au,...n.labels},a=r.ownerDocument;ht(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 $u(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 Gu(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 Iu(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 Vu=Object.freeze({lift:0,spin:0,tilt:0});function Nu(){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 Bu(){return()=>Vu}var Cr={roll:Nu,step:Fu,slide:Bu};var Hu=360,ju=260,zu=4e3,_u=.5,Ku=.85,Uu=2,Wu=[1,0,0,1,0,0],Zu=["auto","follow","level"],qu=["center","on"];function nc(e,t={}){tf(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=Yu(o,t.along);if(!s||!(Xu(s)>=_u))return;let c=t.size===void 0?1:t.size==="fit"?Ku*s.thickness/i.box.height:t.size/i.size;if(c>0)return Ju(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??Ft,update:c=>i.show(c)}).finished},end(o,a){r(o,a).show(1)},clear(){}}}function Ju(e,t,n,r){let o=typeof r.gait=="function"?r.gait:Cr[r.gait??t.gait??"slide"](),a=e.length,i=t.footprint[0]*n,s=t.footprint[1]*n,c=0,d=rc(e).map(([R,N])=>{let F={from:R,to:N,span:Math.max(0,N-R-i-s),before:c};return c+=F.span,F}),l=Math.max(Uu,(i+s)/2),u=t.radius??t.box.height/2,{anchor:f}=t,b={x:f.x+n*(t.pivot.x-f.x),y:f.y+n*(t.pivot.y-f.y)},w=r.ride==="on"?e.thickness/2+(t.box.y+t.box.height-f.y)*n:0,v=r.orient??"auto";return{icon:t,size:t.size*n,span:c,duration:Math.min(zu,Math.max(ju,c/Hu*1e3)*(o.pace??1)),gait:o,transform(R){let N=R*c,F=d.length-1;for(;F>0&&d[F].before>N;)F--;let $=d[F],x=$.from+i+Math.min($.span,N-$.before),E=o({distance:N/n,length:c/n,progress:R,radius:u}),L=Qu(e,x),A=ef(e,Math.min(x,a),l,$),m=v==="auto"&&t.upright===!0&&Math.cos(A)<-1e-9,M=v==="level"?0:m?dr(A-Math.PI):A;return xe.multiply(xe.translate(L.x,L.y),xe.rotate(M),m?xe.scale(-1,1):Wu,xe.translate(-f.x,-f.y-E.lift*n-w),xe.rotate(E.spin-E.tilt,b))}}}function Yu(e,t){return t===void 0?e:e.segments?e.segments.find(n=>n.series===t):e.series===t?e:void 0}function rc(e){let{length:t}=e,n=[],r=0;for(let[o,a]of e.gaps??[])!(a>o)||!(a>r)||(o>r&&n.push([r*t,Math.min(1,o)*t]),r=Math.min(1,a));return n.push([r*t,t]),n}function Xu(e){return rc(e).reduce((t,[n,r])=>t+(r-n),0)}function Qu(e,t){let{length:n}=e;return t<=n?e.path(t/n):on(e.end,e.angle(1),t-n)}function ef(e,t,n,r){let{length:o}=e,a=Math.min(n,t-r.from,r.to-t);if(a>1e-6){let i=e.path((t-a)/o),s=e.path((t+a)/o);if(Math.hypot(s.x-i.x,s.y-i.y)>1e-9)return Math.atan2(s.y-i.y,s.x-i.x)}return e.angle(t/o)}function tf(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(Cr,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&&!Zu.includes(i))throw new RangeError(`travel: orient must be auto, follow or level, got ${String(i)}.`);if(s!==void 0&&!qu.includes(s))throw new RangeError(`travel: ride must be center or on, got ${String(s)}.`)}var nf=900,bo=.25,rf=8,of=.35;function wo(e={}){sf(e);let t=e.width??rf,n=e.opacity??of,{color:r}=e,o=(a,i)=>{let s=t*af(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:nf,timing:"effect",ease:mt,update:s=>o(i,s)}).finished},end(){},clear(){}}}function af(e){return!(e>0)||e>=1?0:e<bo?oc(e/bo):1-oc((e-bo)/(1-bo))}function oc(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 sf(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 cf=450,ac=[1,-.5,.25],Fa=3,lf=.5,df=64,uf=Math.PI/12;function vo(e={}){mf(e);let t=e.swing??Fa;return{kind:"geometry",async run(n,r){if(r.signal.aborted)return;let o=n,a=ic(n,t),i=0,s=()=>{let c=a*ff(i);r.mark.set({transform:c===0?void 0:xe.rotate(c,o.pivot)})};r.onChange(c=>{o=c,a=ic(c,t),s()}),await r.tween({duration:cf,timing:"effect",ease:mt,update:c=>{i=c,s()}}).finished},end(){},clear(){}}}function ic(e,t){let{pivot:n}=e,r=0;for(let o of e.outline.sample(df))r=Math.max(r,Math.hypot(o.x-n.x,o.y-n.y));return r>=lf?Math.min(uf,2*Math.asin(Math.min(1,t/(2*r)))):0}function ff(e){if(!(e>0)||e>=1)return 0;let t=e*ac.length,n=Math.floor(t);return ac[n]*Math.sin(Math.PI*(t-n))}function mf(e){let{swing:t}=e;if(t!==void 0&&!(typeof t=="number"&&t>0&&t<=Fa))throw new RangeError(`wiggle: swing must be more than 0 and at most ${Fa} px, got ${String(t)}.`)}var sc=600,yf=2,cc=6,pf=12,hf=.4,gf=5e3;function ko(e={}){bf(e);let t=e.times??yf,n=e.width??pf,{color:r}=e,o=(a,i)=>{let s=i>0&&i<1;a.mark.set({halo:s?{width:n*Ft(i),opacity:hf*(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(sc,"effect");if(s+d>=gf)return;s+=d,await i.tween({duration:sc,timing:"effect",ease:mt,update:l=>o(i,l)}).finished}},end(){},clear(){}}}function bf(e){let{times:t,width:n,color:r}=e;if(t!==void 0&&!(Number.isInteger(t)&&t>=1&&t<=cc))throw new RangeError(`pulse: times must be a whole number from 1 to ${cc}, 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 wf=500,vf=3,kf=.5,lc=.5;function dc(e={}){xf(e);let t=e.duration??wf,n={stroke:e.color??"mark",width:e.width??vf,opacity:e.opacity??kf,linecap:"round"},r=(o,a)=>{let i=o,s=0,c,d=()=>{if(!(i.length>=lc)){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>=lc)){i(1);return}await a.tween({duration:t,timing:"effect",ease:nt,update:i}).finished},end(o,a){r(o,a)(1)},clear(){}}}function xf(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 Mf=10,xo=6,Sf=8,Ef=12.5,Ba=.36,Df=.8;function Tf(e){let t=e.labelBounds??[],n=e.angle(1),r=fc(e.end,n,t);if(r===void 0&&t.length>0){let o=e.angle(.5)-Math.PI/2,a=fc(e.center,o,t);if(a!==void 0)return uc(e.center,o,a)}return uc(e.end,n,Math.max(Mf,r??-1/0))}function uc(e,t,n){let r=Math.cos(t),o=Math.sin(t),a=on(e,t,n),i=Ef*(o<0?Ba*(1+o):Ba+(Df-Ba)*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 fc(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-xo,y:s-xo,width:c+2*xo,height:d+2*xo},u=Rf(e,r,o,l);u!==void 0&&(a=Math.max(a??u,u))}return a}function Rf(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 ar(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:b}=Tf(a),w={at:on(u,b-Math.PI/2,-Sf*(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 Cf=400,Lf=1e-9,Pf=e=>{let{samples:t}=e;return t[t.length-1]?.value??Number.NaN},Ha,Of=e=>(Ha??(Ha=new Intl.NumberFormat(void 0,{signDisplay:"always",maximumFractionDigits:2})),Ha.format(e));function mc(e={}){Af(e);let t=e.value??Pf,n=e.format??Of,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)<=Lf*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=ar(a,i,s,r,()=>c);await s.tween({duration:Cf,timing:"effect",update:d}).finished},end:(a,i,s)=>{let c=o(i);c!==void 0&&c!==""&&ar(a,i,s,r,()=>c)(1)},clear(){}}}function Af(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 $f=400;function yc(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=ar(o,a,i,n,r);await i.tween({duration:$f,timing:"effect",update:s}).finished},end:(o,a,i)=>ar(o,a,i,n,r)(1),clear(){}}}var Gf=["below","above"];function hc(e){jf(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?Bf(d.samples,If(t,d),n):[],b={stroke:r,width:u.thickness,linecap:"butt"};f.forEach(([w,v],R)=>{let N=u.slice(w,v),F=c[R];F?F.update(N,b):c.push(s.layer.path(N,b))});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 If(e,t){if(typeof e=="number")return{place:s=>s.t,valueAt:()=>e,bends:[]};let n=t.related(e);if(!n)return;let o=t.samples.every(s=>ja(s.at)!==void 0)&&n.samples.every(s=>ja(s.at)!==void 0)?s=>ja(s.at):s=>s.t,a=n.samples.map(s=>({u:o(s),value:s.value})).filter(s=>Number.isFinite(s.u)).sort((s,c)=>s.u-c.u),i=Vf(n.samples,o);return{place:o,valueAt:s=>Nf(i,s)?void 0:Ff(a,s),bends:a.map(s=>s.u)}}function Vf(e,t){let n=[];e.forEach((o,a)=>{let i=e[a-1];if(o.gapBefore!==!0||!i)return;let s=t(i),c=t(o);Number.isFinite(s)&&Number.isFinite(c)&&s!==c&&n.push([Math.min(s,c),Math.max(s,c)])}),n.sort((o,a)=>o[0]-a[0]);let r=[];for(let o of n){let a=r[r.length-1];a&&o[0]<a[1]?a[1]=Math.max(a[1],o[1]):r.push(o)}return r}function Nf(e,t){let n=0,r=e.length;for(;n<r;){let a=n+r>>1;e[a][0]<t?n=a+1:r=a}let o=e[n-1];return o!==void 0&&t<o[1]}function ja(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 Ff(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 Bf(e,t,n){if(!t)return[];let r=n==="below"?1:-1,o=(c,d,l,u=!0)=>{let f=t.valueAt(d);if(f===void 0||!Number.isFinite(f)||!Number.isFinite(l)||!Number.isFinite(c))return{t:c,u:d,past:void 0,joined:u};let b=r*(f-l);return{t:c,u:d,past:Math.abs(b)<=1e-9*Math.max(Math.abs(f),Math.abs(l))?0:b,joined:u}},a=[];e.forEach((c,d)=>{let l=t.place(c);a.push(o(c.t,l,c.value,c.gapBefore!==!0));let u=e[d+1];if(!u||u.gapBefore===!0)return;let f=t.place(u);if(l===f||!Number.isFinite(l)||!Number.isFinite(f))return;let b=[],{bends:w}=t;for(let v=Hf(w,Math.min(l,f));v<w.length&&w[v]<Math.max(l,f);v++)b.push((w[v]-l)/(f-l));f<l&&b.reverse();for(let v of b)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=pc(c),u=pc(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.joined||!(l.t>d.t)||d.u!==l.u&&t.valueAt((d.u+l.u)/2)===void 0||(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 pc=e=>Math.min(1,Math.max(0,e));function Hf(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 jf(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 ${za(t)}.`);if(n!==void 0&&!Gf.includes(n))throw new RangeError(`threshold: when must be "below" or "above", got ${za(n)}.`);if(r!==void 0&&(typeof r!="string"||r===""))throw new RangeError(`threshold: color must be a theme token or a CSS colour, got ${za(r)}.`)}var za=e=>typeof e=="string"?JSON.stringify(e):String(e);var zf=950,_f=160,Kf=["unroll","drop"];function Mo(e={}){Jf(e);let t=e?.points??_f,n=e?.align??"unroll";return{kind:"transition",async run(r,o,a){if(a.signal.aborted)return;let i=gc(r,o,a.layer,t,n),s=qf(a.start);if(s>=1){i(1);return}let c=Or(s),d;d=a.tween({duration:zf,timing:"transition",ease:mt,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){gc(r,o,a.layer,t,n)(1)},clear(){}}}function gc(e,t,n,r,o){let a=e.outline.closed;if(a!==t.outline.closed)return Wf(e,t,n);let i=e.outline.sample(r),s=t.outline.sample(r);if(!a)return Uf(e,t,n,i,s);let[c,d]=o==="drop"?Zf(e,t,r):[0,0],l;return u=>{let f=u<=0?e.outline.d:u>=1?t.outline.d:bc(i,s,c,d,u,!0);l?l.update(f):l=n.path(f,{fill:"mark"})}}function Uf(e,t,n,r,o){let a;return i=>{let s=i<=0?e.outline.d:i>=1?t.outline.d:bc(r,o,0,0,i,!1),c=i<=0?e.thickness:i>=1?t.thickness:_a(e.thickness,t.thickness,i);a?a.update(s,{width:c}):a=n.path(s,{stroke:"mark",width:c})}}function Wf(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 bc(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(_a(d.x,l.x,o))},${Ze(_a(d.y,l.y,o))}`}return a?`${s}Z`:s}var _a=(e,t,n)=>e*(1-n)+t*n;function Zf(e,t,n){let r=n/4,o=Mr(e);return o===Mr(t)?[0,0]:o?[0,r]:[r,0]}function qf(e){return typeof e=="number"&&e>0?Math.min(1,e):0}function Jf(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&&!Kf.includes(n))throw new RangeError(`morph: align must be "unroll" or "drop", got ${typeof n=="string"?JSON.stringify(n):String(n)}.`)}function wc(...e){let t=So("sequence",e);return Sc(t,async(n,r)=>{for(let o of t){if(r.signal.aborted)return;await n(o)}})}function vc(...e){let t=So("parallel",e);return Sc(t,async n=>{await Promise.all(t.map(n))})}function kc(e,t){if(typeof e!="string"&&typeof e!="function")throw new TypeError(`only needs a key, a series name or a predicate, got ${pr(e)}.`);let[n]=So("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 Yf=50,Xf=500;function xc(e,t={}){let[n]=So("stagger",[e]),r=t.delay??Yf;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,b=l>0?l*f:0;if(!(b>0))return{mark:s,data:c};let w=Mc(s,c,d);return await d.tween({duration:b,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 Mc(e,t,n){let r={mark:e,data:t};return n.onChange((o,a)=>{r={mark:o,data:a??r.data}}),()=>r}function Sc(e,t){let n=(i,s,c)=>{let d=Mc(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 So(e,t){return t.forEach((n,r)=>{if(!Vr(n))throw new TypeError(`${e}: part ${r+1} needs to be a mark effect (kind "geometry" or "data"), got ${pr(n)}.`)}),[...t]}var Ec=()=>{};function Dc(e){Rc("defineEffect",e);let t={kind:"geometry",run:e.run,end:e.end,clear:e.clear??Ec};return Object.freeze(t)}function Tc(e){Rc("defineDataEffect",e);let t=Qf(e.needs),n={kind:"data",...t?{needs:t}:{},run:e.run,end:e.end,clear:e.clear??Ec};return Object.freeze(n)}function Rc(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 Qf(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 em=["roll","step","slide"],tm=["butt","round"],nm=["miter","round"],rm=["nonzero","evenodd"],Cc=/^\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"?ir({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)=>om(w,`shapes[${v}]`,n,r)),s=e.box;(!s||typeof s!="object")&&n("box","must be a rectangle { x, y, width, height }");let c=ir({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),b=e.radius===void 0?c.height/2:o("radius",e.radius);return e.gait!==void 0&&!em.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)}`),ir({name:t,shapes:ir(i),box:c,size:f,anchor:d,pivot:l,footprint:ir([u[0],u[1]]),...e.gait!==void 0?{gait:e.gait}:{},radius:b,...e.upright!==void 0?{upright:e.upright}:{}})}function om(e,t,n,r){(!e||typeof e!="object")&&n(t,"must be a shape { d, fill?, stroke?, \u2026 }"),(typeof e.d!="string"||!Cc.test(e.d))&&n(`${t}.d`,"must be path data starting with a move"),e.clip!==void 0&&(typeof e.clip!="string"||!Cc.test(e.clip))&&n(`${t}.clip`,"must be path data starting with a move");for(let i of["fill","stroke"]){let s=e[i];s!==void 0&&(typeof s!="string"||s==="")&&n(`${t}.${i}`,`must be a colour, got ${String(s)}`)}e.width!==void 0&&r(`${t}.width`,e.width)<0&&n(`${t}.width`,`can't be negative, got ${e.width}`),e.linecap!==void 0&&!tm.includes(e.linecap)&&n(`${t}.linecap`,`must be butt or round, got ${String(e.linecap)}`),e.linejoin!==void 0&&!nm.includes(e.linejoin)&&n(`${t}.linejoin`,`must be miter or round, got ${String(e.linejoin)}`),e.fillRule!==void 0&&!rm.includes(e.fillRule)&&n(`${t}.fillRule`,`must be nonzero or evenodd, got ${String(e.fillRule)}`);let o=e.opacity===void 0?1:r(`${t}.opacity`,e.opacity);(o<0||o>1)&&n(`${t}.opacity`,`must be from 0 to 1, got ${o}`);let a={d:e.d};for(let i of["fill","stroke","width","linecap","linejoin","clip","fillRule","opacity"])e[i]!==void 0&&(a[i]=e[i]);return ir(a)}var ir=e=>Object.freeze(e);var am=new Set(["svg","g","a"]),im=new Set(["path","circle","rect","ellipse","line","polyline","polygon"]),sm=/<![^<>]*>|<(\/?)([A-Za-z][\w:.-]*)((?:\s+[^\s=/<>]+(?:\s*=\s*(?:"[^"<]*"|'[^'<]*'|[^\s"'<>]+))?)*)\s*(\/?)>/g,cm=/([^\s=/<>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,lm=/^(?:#[0-9a-fA-F]{3,8}|[a-zA-Z][a-zA-Z0-9-]*|(?:rgba?|hsla?)\([\d\s.,%+\-/]*\))$/;function Ac(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 dm(e).matchAll(sm)){let[,f,b,w="",v]=u;if(b===void 0)continue;let R=b.toLowerCase();if(f){let E=wm(s,R);E>=0&&(s.length=E);continue}let N=um(w),F=!o&&R==="svg";F&&(o=fm(N)??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,fillRule:"nonzero",opacity:1,transform:xe.scale(a)});let $=s.length>0?s[s.length-1].state:F?c:void 0,x=$&&!ym(N)?pm($,N):void 0;if(x&&im.has(R)){let E=hm(R,N,x);E&&i.push(E)}v||s.push({tag:R,state:am.has(R)?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 dm(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 um(e){let t=new Map;for(let[,n,r,o,a]of e.matchAll(cm))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 fm(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=Lc(e.get("width")),r=Lc(e.get("height"));return n!==void 0&&r!==void 0?{x:0,y:0,width:n,height:r}:void 0}function Lc(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 mm(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(%?)\s*$/i.exec(e??"");return t?Math.min(1,Math.max(0,Number(t[1])/(t[2]?100:1))):1}function ym(e){return e.get("display")?.trim()==="none"||e.get("visibility")?.trim()==="hidden"}function pm(e,t){let n=(c,d)=>{let l=t.get(c)?.trim();if(l===void 0||!lm.test(l))return d;let u=l.toLowerCase();return u==="inherit"?d:u==="currentcolor"?"text":u==="none"?u:l},r=Number.parseFloat(t.get("stroke-width")??""),o=t.get("stroke-linecap")?.trim(),a=t.get("stroke-linejoin")?.trim(),i=t.get("fill-rule")?.trim().toLowerCase(),s=t.get("transform");return{fill:n("fill",e.fill),stroke:n("stroke",e.stroke),width:r>=0?r:e.width,linecap:o==="butt"||o==="round"?o:e.linecap,linejoin:a==="miter"||a==="round"?a:e.linejoin,fillRule:i==="nonzero"||i==="evenodd"?i:e.fillRule,opacity:e.opacity*mm(t.get("opacity")),transform:s?xe.multiply(e.transform,mr(s)):e.transform}}function hm(e,t,n){let r=n.fill==="none"?void 0:n.fill,o=n.stroke==="none"||!(n.width>0)?void 0:n.stroke,a=Oc(n.opacity);if(r===void 0&&o===void 0||!(a>0))return;let i=gm(e,t);if(!i.some(c=>c.op!=="M"))return;let s=n.transform;return{d:ho(po(i,s)),...r!==void 0?{fill:r,...n.fillRule==="evenodd"?{fillRule:n.fillRule}:{}}:{},...o!==void 0?{stroke:o,width:Oc(n.width*Math.sqrt(Math.abs(s[0]*s[3]-s[1]*s[2]))),...n.linecap?{linecap:n.linecap}:{},...n.linejoin?{linejoin:n.linejoin}:{}}:{},...a<1?{opacity:a}:{}}}function gm(e,t){let n=r=>{let o=Number.parseFloat(t.get(r)??"");return Number.isFinite(o)?o:0};switch(e){case"path":return yo(t.get("d")??"");case"circle":return Pc(n("cx"),n("cy"),n("r"),n("r"));case"ellipse":return Pc(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 bm(n("x"),n("y"),n("width"),n("height"),t);default:return[]}}function Pc(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 bm(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 wm(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].tag===t)return n;return-1}var Oc=e=>Math.round(e*1e3)/1e3;var vm=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}}),km=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}}),xm=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}}),Eo=Object.freeze({dot:vm,arrow:km,chevron:xm});var Ka=$o({kind:"preset",entries:{flash:()=>wo(),wiggle:()=>vo(),pulse:()=>ko()},hint:"Register custom presets with registerPreset(name, factory)."}),Ua=$o({kind:"icon",entries:Eo,hint:"Register icons with registerIcon(icon) or registerIcons(icons)."});function $c(e,t){if(typeof t!="function")throw new TypeError(`registerPreset("${e}") needs a function that returns an effect.`);Ka.register(e,t)}function Wa(e){if(typeof e!="object"||e===null||typeof e.name!="string")throw new TypeError("registerIcon needs an icon with a name.");Ua.register(e.name,e)}function Gc(e){for(let t of e)Wa(t)}function Ic(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.");bn.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.");bn.injectStyles=e.injectStyles}}var Mm="0.3.0",sr={presets:Ka,icons:Ua,motion:vt};function Sm(e,t){return Qo(e,t,sr)}function Em(e,t){return la(e,t,sr)}function Dm(e,t){return Da(e,t,sr)}function Tm(e,t){let n=typeof t=="object"&&t!==null&&t.transition===void 0?{...t,transition:Mo()}:t;return Ia(e,n,sr)}function Rm(e,t){return rr(e,t,sr)}function Cm(e,t){return mo(e,t,sr)}function Lm(e,t=vt,n){return Va(e,t,n)}return Kc(Pm);})();
90
+ `,dn=`data-expressive-charts`,fn={};function pn(e){if(fn.injectStyles===!1||e.querySelector(`style[${dn}]`))return;let t=e.createElement(`style`);t.setAttribute(dn,``),fn.nonce&&t.setAttribute(`nonce`,fn.nonce),t.textContent=un,(e.head??e.documentElement).appendChild(t)}function mn(e={}){let t=new Map;for(let[n,r]of Object.entries(e)){if(!Number.isInteger(r)||r<1||r>8)throw RangeError(`colorAssignment: the slot for "${n}" must be a whole number from 1 to 8, got ${String(r)}.`);t.set(n,r)}return{slot(e){let n=t.get(e);if(n===void 0){let r=new Set(t.values());for(n=1;r.has(n)&&n<=8;)n++;n>8&&(n=t.size%8+1),t.set(e,n)}return n}}}function hn(e){return e&&typeof e.slot==`function`?e:mn(e)}function gn(e,t){if(e===void 0||typeof e==`boolean`)return;let n=e=>{throw TypeError(`${t}: ${e}`)};(typeof e!=`object`||!e||Array.isArray(e))&&n(`legend must be true or false, or an object with the entries the page adds.`);let{entries:r}=e;r!==void 0&&(Array.isArray(r)||n(`legend.entries must be an array of { label, color }.`),r.forEach((e,t)=>{let{label:r,color:i}=typeof e==`object`&&e?e:n(`legend.entries[${t}] must be an object with a label and a color.`);(typeof r!=`string`||r.trim()===``)&&n(`legend.entries[${t}].label must be a non-empty string: the entry's name.`),(typeof i!=`string`||i.trim()===``)&&n(`legend.entries[${t}].color must be a theme token or a CSS colour.`),(i===`mark`||i===`mark-strong`)&&n(`legend.entries[${t}].color can't be "${i}": an entry has no mark. Use a theme token or a CSS colour.`)}))}let _n=e=>typeof e==`object`?e.entries??[]:[];function vn(e){let t,n=``,r=()=>{t?.remove(),t=void 0,n=``},i=(r,i,a,o)=>{let s=[...r.map(({key:e,label:t})=>({key:e,label:t,styles:cn(on(i.slot(e)))})),...o.map(({label:e,color:t})=>({key:void 0,label:e,styles:{"--ec-mark":sn(t)}}))],c=e.ownerDocument;t??(t=Object.assign(c.createElement(`div`),{className:`ec-legend`})),t.nextSibling!==e&&e.before(t);let l=JSON.stringify([a,s]);l!==n&&(n=l,t.replaceChildren(...s.map(({key:e,label:t,styles:n})=>{let r=c.createElement(`span`);r.className=`ec-legend-item`,e!==void 0&&r.setAttribute(a,e);for(let[e,t]of Object.entries(n))t!==void 0&&r.style.setProperty(e,t);let i=c.createElement(`span`);i.className=`ec-legend-swatch`;let o=c.createElement(`span`);return o.className=`ec-legend-label`,o.textContent=t,r.append(i,o),r})))};return{update(e,t,n){let a=_n(n);n===!1||e.length+a.length<2?r():i(e.map(({series:e,label:t})=>({key:e,label:t})),t,`data-series`,a)},categories(e,t,n){n===!1||e.length===0?r():i(e,t,`data-key`,_n(n))},destroy:r}}let yn=e=>e!==void 0&&e.source!==`linked`,bn=new WeakMap,xn=new WeakSet,Sn=e=>e.parts?[e,...e.parts]:[e];function Cn(e,t){return bn.set(t,e),t}let wn=e=>bn.get(e);function Tn(e,n={}){if(!Array.isArray(e))throw TypeError(`link needs an array of charts, chart switches and attachments: link([columns, line]).`);if(typeof n!=`object`||!n)throw TypeError(`link: options must be an object, such as { by: (event) => event.data.datum.week }.`);let{by:r,effects:i=!0}=n;if(r!==void 0&&typeof r!=`function`)throw TypeError(`link: by must be a function, such as (event) => event.data.datum.week.`);if(typeof i!=`boolean`)throw TypeError(`link: effects must be true or false, got ${String(i)}.`);let a=[],o=new Set;for(let t of e){let e=typeof t==`object`&&t?bn.get(t):void 0;if(!e)throw TypeError(`link: each source must be a chart (barChart, donutChart or lineChart), a chartSwitch or an attachment (expressive or fromVegaView).`);let n=Sn(e);if(n.some(e=>xn.has(e)||o.has(e)))throw TypeError(`link: a chart, chart switch or attachment can be in one link at a time, and a chart switch's views' charts go with it. Destroy the link it's in first.`);for(let e of n)o.add(e);a.push(e)}let s=new Set,c,l=new Set;function u(e){let n;if(r)try{n=r(e)}catch(e){t(e);return}else{let{samples:t}=e.data;n=t[t.length-1]?.at??e.mark.key}return n instanceof Date?Number.isNaN(n.getTime())?void 0:n.toISOString():n==null?void 0:String(n)}function d(e,t){if(t.size===0)return[];let n=e=>e.some(e=>{let n=u(e);return n!==void 0&&t.has(n)});return e.targets().flatMap(e=>n(e.marks)?[e.key]:[])}function f(e,t){c=e;let n=new Set(t.map(u));n.delete(void 0),l=n;for(let t of s)if(t!==e&&(t.hover(d(t,n),i),c!==e))return}function p(e){if(c===e){c=void 0,l=new Set;for(let e of s)e.unlink()}}for(let e of a)if(e.listen({hover:t=>f(e,t),leave:()=>p(e),dismiss(){let e=c;e?.leave(),e&&p(e)},shown(){c!==void 0&&c!==e&&s.has(e)&&e.hover(d(e,l),i)},gone(){s.delete(e);for(let t of Sn(e))xn.delete(t);p(e)}})){s.add(e);for(let t of Sn(e))xn.add(t)}return{destroy(){for(let e of s){e.listen(void 0),e.unlink();for(let t of Sn(e))xn.delete(t)}s.clear(),c=void 0,l=new Set}}}let En=[`presentation`,`analysis`,`off`];function Dn(e,t){if(e===void 0)return t;if(typeof e!=`string`)return e;if(!En.includes(e))throw TypeError(`Unknown motion mode "${String(e)}". Use one of: ${En.join(`, `)}.`);let n=()=>t.viewerChoice??(t.prefersReduced?`off`:e);return{get mode(){return n()},get staged(){return n()===`presentation`},duration(e,t=`transition`){let r=n();return r===`off`?0:m(e,u[r][t])},subscribe:e=>t.subscribe(e)}}let On=new WeakMap,kn=0;function An(e){let t=e.ownerDocument,n=(On.get(t)??0)+1;On.set(t,n);let r=Y(`mask`,{id:`ec-focus-mask-${n}`,maskUnits:`userSpaceOnUse`,x:-1e5,y:-1e5,width:2e5,height:2e5},e);Y(`rect`,{x:-1e5,y:-1e5,width:2e5,height:2e5,fill:`white`},r);let i=Y(`path`,{stroke:`black`,"stroke-linejoin":`round`},r),a=Y(`path`,{class:`ec-focus-ring`,visibility:`hidden`,"stroke-linejoin":`round`,mask:`url(#${r.id})`},e);return St(a,{fill:`none`,stroke:sn(`focus`)}),{draw(e){if(!e){X(a,{visibility:`hidden`});return}let{outline:t,thickness:n,transform:r}=e,o=t.closed?0:n;X(i,{d:t.d,fill:t.closed?`black`:`none`,"stroke-width":o+4}),X(a,{d:t.d,"stroke-width":o+8,transform:r&&wt(r),visibility:void 0})}}}function jn(){let e,t=()=>{e?.remove(),e=void 0};return{paint(n,r,i,a){if(!i||!n||r.length===0){t();return}e&&e.parentNode===n||(e?.remove(),e=Y(`g`,{class:`ec-halo`},n)),e.textContent=``;let o=`ec-halo-mask-${++kn}`,s=Y(`mask`,{id:o,maskUnits:`userSpaceOnUse`,x:-1e5,y:-1e5,width:2e5,height:2e5},e);Y(`rect`,{x:-1e5,y:-1e5,width:2e5,height:2e5,fill:`white`},s);for(let e of r){let t=e.stroke===void 0?{fill:`black`}:{fill:`none`,stroke:`black`,"stroke-width":e.stroke,"stroke-linejoin":`round`};Y(`path`,{d:e.d,...t},s)}X(e,{transform:a&&wt(a)});for(let t of r){let n=t.stroke!==void 0;St(Y(`path`,{d:t.d,"stroke-width":i.width+(t.stroke??0),"stroke-opacity":i.opacity,"stroke-linejoin":`round`,"stroke-linecap":n?`round`:void 0,mask:`url(#${o})`},e),{fill:`none`,stroke:i.color===void 0?t.color??sn(`mark`):sn(i.color)})}},remove:t}}function Mn(e,t={}){let n={},r,i=t.halos&&jn(),a=()=>{let t=e();if(!t)return;let{body:r,parts:i}=t;X(r,{transform:n.transform&&wt(n.transform),opacity:n.opacity});let a=n.emphasis;for(let e of i)St(e.element,{[e.open?`stroke`:`fill`]:a===void 0?void 0:Nn(e.colors,a),transition:a===void 0?void 0:`none`});o(r,i)},o=(e,a)=>{let o=n.halo;if(i){let e=a.flatMap(e=>e.visible?[{d:e.d,color:e.colors.color,...e.open?{stroke:e.open.width}:{}}]:[]);i.paint(t.halos?.(),e,o,n.transform);return}if(!o){r?.remove(),r=void 0;return}r&&r.parentNode===e||(r?.remove(),r=Y(`g`,{class:`ec-halo`},e),e.insertBefore(r,e.firstChild));let s=a.filter(e=>e.visible);for(;r.childElementCount>s.length;)r.lastElementChild?.remove();s.forEach((e,t)=>{let n=r.children[t]??Y(`path`,{"stroke-linejoin":`round`},r);X(n,{d:e.d,"stroke-width":o.width+(e.open?.width??0),"stroke-opacity":o.opacity,"stroke-linecap":e.open?`round`:void 0}),St(n,{fill:`none`,stroke:o.color===void 0?e.colors.color:sn(o.color)})})};return{get style(){return n},set(e){n=ft(n,e),a()},reset(){n={},a()},repaint:a}}function Nn(e,t){let n=Math.min(1,Math.max(0,t));return n===0?e.color:n===1?e.strong:`color-mix(in srgb, ${e.strong} ${Math.round(n*1e3)/10}%, ${e.color})`}let Pn=0;function Fn(e,t){let n=()=>{if(!t)return e;let n=e.lastElementChild;if(n?.getAttribute(`class`)===`ec-follow`)return n;let r=t();return Y(`g`,{class:`ec-follow`,transform:r&&wt(r)},e)};return{icon(e,t){let r=t?.size;if(r!==void 0&&!(r>=0))throw RangeError(`layer.icon: size must be a non-negative number, got ${String(r)}.`);let i=Y(`g`,{class:`ec-icon`,"data-icon":e.name,visibility:`hidden`},n()),a=r===void 0||!(e.size>0)?1:r/e.size,o=a===1?i:Y(`g`,{transform:wt(q.scale(a,a,e.anchor))},i);for(let t of e.shapes)In(t,o);return{place(e){X(i,{transform:wt(e),visibility:void 0})},remove:()=>i.remove()}},path(e,t){let r=Y(`path`,{class:`ec-path`,d:e},n()),i={...t};return Ln(r,i),{update(e,t){r.setAttribute(`d`,e),t&&(i=ft(i,t),Ln(r,i))},remove:()=>r.remove()}},text(t,n){let r=Y(`text`,{class:`ec-text`},e);r.textContent=t;let i={...n};return Rn(r,i),{update(e,t){i=ft(i,e),Rn(r,i),t!==void 0&&(r.textContent=t)},remove:()=>r.remove()}}}}function In(e,t){let n;if(e.clip!==void 0){n=`ec-clip-${++Pn}`;let r=Y(`clipPath`,{id:n},t);Y(`path`,{d:e.clip},r)}St(Y(`path`,{d:e.d,"clip-path":n&&`url(#${n})`,"stroke-width":e.stroke===void 0?void 0:e.width??1,"stroke-linecap":e.linecap,"stroke-linejoin":e.linejoin,"fill-rule":e.fillRule,opacity:e.opacity,"fill-opacity":e.fillOpacity,"stroke-opacity":e.strokeOpacity},t),{fill:e.fill===void 0?`none`:sn(e.fill),stroke:e.stroke===void 0?void 0:sn(e.stroke)})}function Ln(e,t){X(e,{"stroke-width":t.stroke===void 0?void 0:t.width??1,opacity:t.opacity,"stroke-linecap":t.linecap,"stroke-linejoin":`round`}),St(e,{fill:t.fill===void 0?`none`:sn(t.fill),stroke:t.stroke===void 0?void 0:sn(t.stroke)})}function Rn(e,t){X(e,{x:t.at.x,y:t.at.y,"text-anchor":t.anchor??`start`,opacity:t.opacity}),St(e,{fill:sn(t.color??`text`)})}function zn(e){let{overlay:t}=e,n=new WeakMap,r=new Map,i=new Set,a=new Set,o=new Map,s=(e,t)=>{if(t)o.set(e,t);else if(!o.delete(e))return;for(let n of r.get(e)??[])for(let e of Array.from(n.children))e.getAttribute(`class`)===`ec-follow`&&X(e,{transform:t&&wt(t)})};return{group(s,c,l){let u=Y(`g`,{class:a.has(s)?`ec-run ec-hot`:`ec-run`,"data-key":s,"data-slot":c,visibility:i.has(s)?`hidden`:void 0},t);St(u,cn(e.colors(s))),n.set(u,l);let d=Array.from(t.children).find(e=>(n.get(e)??-1/0)>l);t.insertBefore(u,d??null);let f=r.get(s);f||r.set(s,f=new Set),f.add(u);let p=f;return{...Fn(u,()=>o.get(s)),clear(){u.remove(),p.delete(u),p.size===0&&r.get(s)===p&&r.delete(s)}}},mark(t){let n=e.mark(t);return{set(e){n.set(e),`transform`in e&&s(t,e.transform)},reset(){n.reset(),s(t,void 0)}}},recolor(t){let n=r.get(t);if(!n)return;let i=cn(e.colors(t));for(let e of n)St(e,i)},hide(e,t){t?i.add(e):i.delete(e);for(let n of r.get(e)??[])X(n,{visibility:t?`hidden`:void 0})},hot(e,t){t?a.add(e):a.delete(e);for(let n of r.get(e)??[])n.classList.toggle(`ec-hot`,t)}}}function Bn(e,t){return e!==void 0&&Object.prototype.hasOwnProperty.call(e,t)?e[t]??t:t}function Vn(e,t){if(e!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`${t}: seriesLabels must be an object of names by series, as { goals: "Goals" }.`);for(let[n,r]of Object.entries(e))if(typeof r!=`string`||r.trim()===``)throw TypeError(`${t}: seriesLabels.${n} must be a name, not ${typeof r==`string`?`blank`:String(r)}.`)}}function Hn(e){let n={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set};function r(e,r){for(let i of[...n[e]])try{i(r)}catch(e){t(e)}}return{emit:r,emitEach(e,t,n){t.forEach((i,a)=>r(e,{...n(i),batch:{index:a,count:t.length}}))},on(t,r){let i=n[t];if(!i)throw TypeError(`${e}: unknown event "${String(t)}". Use one of: ${Object.keys(n).join(`, `)}.`);return i.add(r),()=>{i.delete(r)}},clear(){for(let e of Object.values(n))e.clear()}}}function Un(e){return e.format??Gn}let Wn;function Gn(e){return Wn??(Wn=new Intl.NumberFormat(void 0,{maximumFractionDigits:2})),Wn.format(e)}function Kn(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 qn(e,t){let n=10**t,r=Math.round(e*n)/n;return r===0?0:r}function Jn(e){return`${qn(e*100,0)}%`}function Yn(e,t){let n=e.ownerDocument,r,i=`mouse`,a,o,s,c,l=(e,n)=>{c=e?.key,e?.key!==r&&(u(),e&&(r=e.key,t.hover(e,n)))},u=()=>{_(),r!==void 0&&(r=void 0,t.leave())},d=e=>{let n=t.tooltip?.();return n?.element&&e&&n.element.contains(e)?n:void 0},f=(t,n)=>{let r=e.getRootNode();return typeof r.elementFromPoint==`function`?r.elementFromPoint(t,n):void 0},p=e=>e.relatedTarget??f(e.clientX,e.clientY)??null,m=(n,r,i)=>{let a=d(n);a?g(a,r,i):l(n&&e.contains(n)?t.find(n,{x:r,y:i}):void 0,`pointer`)},h=e=>t.find(e.target,{x:e.clientX,y:e.clientY}),g=(e,t,n)=>{l({key:e.key},`pointer`);let r=e.element;a?.element===r?(a.x=t,a.y=n):(_(),a={element:r,x:t,y:n},r.addEventListener(`pointermove`,v),r.addEventListener(`pointerleave`,y),o=new MutationObserver(b),o.observe(r,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))},_=()=>{a&&(a.element.removeEventListener(`pointermove`,v),a.element.removeEventListener(`pointerleave`,y),o?.disconnect(),o=void 0,a=void 0)},v=e=>{a&&e.pointerType!==`touch`&&(a.x=e.clientX,a.y=e.clientY)},y=e=>{e.pointerType!==`touch`&&(_(),m(p(e),e.clientX,e.clientY))},b=()=>{if(!a)return;let{x:e,y:n}=a,i=f(e,n);if(i===void 0)return;let o=t.tooltip?.(),c=o?.element!==void 0&&i!==null&&o.element.contains(i);c&&o.key===r||(_(),!c&&o?.key!==r?(s={x:e,y:n},u()):m(i,e,n))},x=e=>s&&Math.abs(e.clientX-s.x)<1&&Math.abs(e.clientY-s.y)<1?!0:(s=void 0,!1),S=e=>{if(e.pointerType===`touch`||x(e))return;_();let n=h(e);t.moves?.()&&n?.key===c||l(n,`pointer`)},C=e=>{e.pointerType!==`touch`&&(s=void 0,m(p(e),e.clientX,e.clientY))},w=e=>{if(e.pointerType===`touch`||x(e)||!t.moves?.())return;let n=h(e);n?.key!==c&&(_(),l(n,`pointer`))},T=e=>{i=e.pointerType},ee=e=>{i===`touch`&&l(h(e),`touch`)},E=t=>{if(r===void 0||t.pointerType!==`touch`)return;let n=t.composedPath()[0]??t.target;!e.contains(n)&&!d(n)&&u()};return e.addEventListener(`pointerover`,S),e.addEventListener(`pointerleave`,C),e.addEventListener(`pointermove`,w),e.addEventListener(`pointerdown`,T),e.addEventListener(`click`,ee),n.addEventListener(`pointerdown`,E,!0),{get current(){return r},clear(){a&&(s={x:a.x,y:a.y}),u()},destroy(){_(),r=void 0,e.removeEventListener(`pointerover`,S),e.removeEventListener(`pointerleave`,C),e.removeEventListener(`pointermove`,w),e.removeEventListener(`pointerdown`,T),e.removeEventListener(`click`,ee),n.removeEventListener(`pointerdown`,E,!0)}}}function Xn(e,t){let n,r,i,a,o,s=[],c=!0,l=t.tabIndex??((e,n)=>{let r=t.element(e);n===void 0?r?.removeAttribute(`tabindex`):r?.setAttribute(`tabindex`,n)}),u=e=>{for(let t of e)l(t,t===o?`0`:`-1`)},d=e=>{o=e,u(t.order()),t.element(e)?.focus()},f=()=>{let e=r;r=void 0,e!==void 0&&t.blur(e)},p=e=>{e.metaKey||e.altKey||e.ctrlKey||(c=!0)},m=()=>{c=!1,a=void 0},h=e=>{a=void 0;let s=t.find(e.target);if(s===void 0){f();return}let l=t.element(s);l&&l!==e.target&&e.target.getAttribute(`aria-hidden`)===`true`&&(l.focus(),n?.scope.activeElement===l)||(i={key:s,element:e.target},s!==r&&(r=s,o=s,u(t.order()),t.focus(s,c)))},g=e=>{let n=i?.element;r!==void 0&&n&&e.target===n&&t.find(e.relatedTarget)===void 0&&(f(),e.relatedTarget===null&&(a=n,queueMicrotask(()=>{a===n&&n.isConnected&&(a=void 0)})))},_=e=>{let n=t.find(e.target);if(n===void 0||e.altKey||e.ctrlKey||e.metaKey)return;let r=t.order(),i=r.indexOf(n),a=(e,i)=>{let a=t.move?.(n,e);return a!==void 0&&r.includes(a)?a:i},o;switch(e.key){case`ArrowDown`:case`ArrowRight`:o=a(e.key,r[Math.min(r.length-1,i+1)]);break;case`ArrowUp`:case`ArrowLeft`:o=a(e.key,r[Math.max(0,i-1)]);break;case`PageDown`:case`PageUp`:{let a=e.key===`PageDown`?1:-1,s=t.page?.(n,a);o=s!==void 0&&r.includes(s)?s:r[Math.min(r.length-1,Math.max(0,i+a*Math.ceil(r.length/10)))];break}case`Home`:o=a(e.key,r[0]);break;case`End`:o=a(e.key,r[r.length-1]);break;case`Escape`:t.escape(n)&&e.preventDefault();return;default:return}e.preventDefault(),o!==void 0&&o!==n&&d(o)},v=()=>{n&&(n.doc.removeEventListener(`keydown`,p,!0),n.doc.removeEventListener(`pointerdown`,m,!0),n.scope.removeEventListener(`focusin`,h,!0),n.scope.removeEventListener(`focusout`,g,!0),n.svg.removeEventListener(`keydown`,_),n=void 0)},y=()=>{let t=e(),r=t?.getRootNode(),i=r&&`host`in r?r:t?.ownerDocument;(t!==n?.svg||i!==n?.scope)&&(v(),t&&i&&(n={svg:t,doc:t.ownerDocument,scope:i},n.doc.addEventListener(`keydown`,p,!0),n.doc.addEventListener(`pointerdown`,m,!0),n.scope.addEventListener(`focusin`,h,!0),n.scope.addEventListener(`focusout`,g,!0),n.svg.addEventListener(`keydown`,_)))};return y(),{active:()=>n?.scope.activeElement??null,focus(e){c=!0,e===r&&i?.element===n?.scope.activeElement?t.focus(e,!0):d(e)},sync(){y();let e=t.order(),c=new Set(e),p=s.filter(e=>!c.has(e));o!==void 0&&c.has(o)||(o=Zn(s,o,c)??e[0]);let m=!n?.doc.activeElement||n.doc.activeElement===n.doc.body,h=i!==void 0&&!i.element.isConnected&&(r!==void 0||i.element===a&&m),g=i&&(i.element===n?.scope.activeElement||h)?i:void 0;a=void 0,g&&!c.has(g.key)?o===void 0?g.element.isConnected?g.element.blur():f():d(o):g&&t.find(g.element)!==g.key&&d(g.key),u(e);for(let e of p)l(e,void 0);s=e},retarget(e){y();let a=t.order(),c=new Set(a),d=n?.scope.activeElement??null,f=i?.element===d?i.key:s.find(e=>t.element(e)===d),p=f??o,m=p===void 0?void 0:e(p);o=m!==void 0&&c.has(m)?m:a[0],u(a),f!==void 0&&(r=o,o===void 0?(d.blur(),i=void 0):t.element(o)?.focus());for(let e of s)c.has(e)||l(e,void 0);return s=a,f===void 0?void 0:r},destroy(){r=void 0,i=void 0,a=void 0,v()}}}function Zn(e,t,n){let r=t===void 0?-1:e.indexOf(t);if(!(r<0))for(let t=1;t<e.length;t++)for(let i of[r+t,r-t]){let t=e[i];if(t!==void 0&&n.has(t))return t}}function Qn(e){let{svg:t,runner:n,events:r}=e,i=t=>e.marks?.(t)??[t],a=t=>(e.markElement??e.element)(t),o=(t,n)=>{a(t)?.classList.toggle(`ec-hot`,n),e.hot?.(t,n)},s,c,l,u=!1,d=t=>t.flatMap(t=>{let n=e.onScreen(t);return n?[{key:t,input:n}]:[]}),f=e=>e.length===1?i(e[0]):[...new Set(e.flatMap(i))];function p(e,t,i,a){if(e.length===0)return;i&&n.hover(e.map(({input:e})=>e));let o=e.length;e.forEach(({input:e},n)=>r.emit(`hover`,{...e,batch:{index:n,count:o},source:t,...a===void 0?{}:{segment:a}}))}function m(e){for(let t of e)o(t,!1);let t=d(e);if(t.length===0)return;n.leave(t.map(({key:e})=>e));let i=t.length;t.forEach(({input:e},t)=>r.emit(`leave`,{...e,batch:{index:t,count:i}}))}function h(n,r,i,a=!0){let c=d(f(n)),u={keys:n,source:r,marks:c.map(e=>e.key),effects:a};s=u;for(let{key:e}of c)o(e,!0);e.dim()&&t.classList.add(`ec-hovering`),r!==`linked`&&(e.tooltip.show(n[0]),y(!0)),p(c,r,a,i),r!==`linked`&&s===u&&l?.hover(c.map(({input:e})=>e))}function g(){let n=s;s=void 0,y(!1),t.classList.remove(`ec-hovering`),e.tooltip.hide(),m(n?.marks??[]),yn(n)&&l?.leave()}let _,v=e=>{e.key===`Escape`&&!e.defaultPrevented&&s!==void 0&&b()};function y(e){_?.removeEventListener(`keydown`,v),_=e?t.ownerDocument:void 0,_?.addEventListener(`keydown`,v)}function b(){S.clear(),s!==void 0&&g()}let x=(t,n)=>n===t||e.live(t)&&i(t).includes(n),S=Yn(t,{find:e.find,moves:()=>e.moves?.()??!1,hover(t,n){!e.live(t.key)||yn(s)&&s.keys[0]===t.key||(g(),h([t.key],n,t.segment))},leave(){(s?.source===`pointer`||s?.source===`touch`)&&g()},tooltip:()=>yn(s)?{key:s.keys[0],element:e.tooltip.element?.()}:void 0}),C=Xn(()=>t,{find:t=>e.find(t)?.key,order:e.order,page:(t,n)=>e.page?.(t,n),move:(t,n)=>e.move?.(t,n),element:e.element,focus(t,n){c=n?t:void 0,e.ring(c),e.live(t)&&(n?yn(s)&&s.keys[0]===t?s={...s,source:`keyboard`}:(g(),h([t],`keyboard`)):s?.source===`keyboard`&&s.keys[0]!==t&&g())},blur(){c=void 0,e.ring(c),s?.source===`keyboard`&&(S.current===s.keys[0]?s={...s,source:`pointer`}:g())},escape(){return s?(s.source===`linked`&&l?l.dismiss():g(),!0):!1}});return{get key(){return yn(s)?s.keys[0]:void 0},get ringKey(){return c},link:{targets:()=>e.order().map(e=>({key:e,marks:d(i(e)).map(({input:e})=>e)})),hover(t,n){s!==void 0&&g();let r=t.filter(e.live);r.length>0&&h(r,`linked`,void 0,n)},unlink(){s?.source===`linked`&&g()},leave:b,listen(e){return!u&&(l=e,!0)}},active:()=>C.active(),restyled(t){c!==void 0&&x(c,t)&&e.ring(c);let n=yn(s)?s.keys[0]:void 0;n!==void 0&&(s?.marks.includes(t)||t===n)&&e.live(n)&&e.tooltip.show(n)},syncDim(){e.dim()?s!==void 0&&t.classList.add(`ec-hovering`):t.classList.remove(`ec-hovering`)},dropGone(){if(s===void 0)return;let t=s.keys.filter(e.live);if(t.length===0){S.clear(),g();return}let{source:i,marks:a,effects:c}=s,l=d(f(t));if(s={...s,keys:t},l.length===a.length&&l.every((e,t)=>e.key===a[t]))return;let u=new Set(a),p=new Set(l.map(e=>e.key)),m=d(a.filter(e=>!p.has(e)));s={...s,marks:l.map(e=>e.key)};for(let e of a)p.has(e)||o(e,!1);for(let{key:e}of l)u.has(e)||o(e,!0);n.leave(a),c&&n.hover(l.map(({input:e})=>e)),m.forEach(({input:e},t)=>r.emit(`leave`,{...e,batch:{index:t,count:m.length}}));let h=l.length;l.forEach(({key:e,input:t},n)=>{u.has(e)||r.emit(`hover`,{...t,batch:{index:n,count:h},source:i})})},sync:()=>C.sync(),retarget(t){let n=C.retarget(t);c!==void 0&&(c=n,e.ring(c)),l?.shown()},focus(t){e.live(t)&&C.focus(t)},leave:b,destroy(){u=!0,l?.gone(),l=void 0,y(!1),S.destroy(),C.destroy()}}}function $n(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 er(e){let t=new Map;return{get:e=>t.get(e),values:()=>t.values(),start(e){t.set(e.key,e),e.group.classList.add(`ec-leaving`),e.group.setAttribute(`aria-hidden`,`true`),e.leave=tr()},recall(e){let n=t.get(e);if(n)return t.delete(e),n.group.classList.remove(`ec-leaving`),n.group.removeAttribute(`aria-hidden`),n.leave?.resolve(),n.leave=void 0,n},sweep(){for(let n of[...t.values()]){let{leave:r}=n;r?.exited&&!e(n)&&(t.delete(n.key),n.leave=void 0,n.group.remove(),r.resolve())}},clear:()=>t.clear()}}function tr(){let e;return{exited:!1,gone:new Promise(t=>{e=t}),resolve:e}}function nr(e,t,n,r){if(!n.some((e,n)=>t[n]!==e))return;let i=r(),a=n.findIndex(e=>e===i),o=n[a]??null;n.forEach((t,n)=>{n<a?e.insertBefore(t,o):n>a&&e.appendChild(t)})}function rr(e,t){if(e===void 0||typeof e==`boolean`||e===`hidden`)return;let n=e=>{throw TypeError(`${t}: ${e}`)};typeof e==`object`&&e||n(`table must be true, false, "hidden" or an object of table options.`);let{hidden:r,columns:i,category:a,total:o,share:s,summary:c,series:l}=e;r!==void 0&&typeof r!=`boolean`&&n(`table.hidden must be true or false.`);for(let[e,t]of Object.entries({category:a,total:o,share:s,summary:c}))t!==void 0&&typeof t!=`string`&&n(`table.${e} must be a string.`);if(l!==void 0){(typeof l!=`object`||!l||Array.isArray(l))&&n(`table.series must be an object of headers by series, as { shots: "Shots" }.`);for(let[e,t]of Object.entries(l))typeof t!=`string`&&n(`table.series.${e} must be a string: the column's header.`)}i!==void 0&&(Array.isArray(i)||n(`table.columns must be an array of { label, field }.`),i.forEach((e,t)=>{let r=typeof e==`object`&&e?e:n(`table.columns[${t}] must be an object with a label and a field.`);typeof r.label!=`string`&&n(`table.columns[${t}].label must be a string: the column's header.`),typeof r.field!=`string`&&typeof r.field!=`function`&&n(`table.columns[${t}].field must be a field name or a function of the row.`),r.format!==void 0&&typeof r.format!=`function`&&n(`table.columns[${t}].format must be a function.`),r.after!==void 0&&r.after!==`category`&&r.after!==`values`&&n(`table.columns[${t}].after must be "category" or "values".`)}))}function ir(e){let{option:t,format:n}=e;if(t===!1)return;let r=typeof t==`object`?t:{},i=r.columns??[],a=i.filter(e=>e.after!==`values`),o=i.filter(e=>e.after===`values`),s=e.total??e.series.length>1,c=e=>({text:n(e),numeric:!0}),l=e.rows.reduce((e,t)=>e+t.total,0),u=t=>e.shares?[{text:Jn(l>0?t/l:0),numeric:!0}]:[],d=e=>({text:e.label,numeric:!1}),f=e=>r.series&&Object.prototype.hasOwnProperty.call(r.series,e)?r.series[e]:void 0,p=()=>({text:``,numeric:!1}),m=[{text:r.category??e.category??`Category`,numeric:!1},...a.map(d),...e.series.map(t=>({text:f(t)??e.label?.(t)??t,numeric:!0})),...s?[{text:r.total??`Total`,numeric:!0}]:[],...e.shares?[{text:r.share??`Share`,numeric:!0}]:[],...o.map(d)],h=e.rows.map(t=>{let r=new Map(t.values.map(e=>[e.series,e.value]));return{key:t.key,cells:[{text:t.category,numeric:!1},...a.map(e=>ar(e,t,n)),...e.series.map(e=>t.missing?.has(e)?{text:`missing`,numeric:!0}:c(r.get(e)??0)),...s?[c(t.total)]:[],...u(t.total),...o.map(e=>ar(e,t,n))]}}),g=t=>e.rows.reduce((e,n)=>e+(n.values.find(e=>e.series===t)?.value??0),0),_=e.shares?[{text:r.total??`Total`,numeric:!1},...a.map(p),...e.series.map(e=>c(g(e))),...s?[c(l)]:[],...u(l),...o.map(p)]:void 0,v=m.length-o.length,y=[...a.map((e,t)=>1+t),...o.map((e,t)=>v+t)];for(let e of y){let t=h.map(t=>t.cells[e]).filter(e=>e.text!==``);t.length>0&&t.every(e=>e.numeric)&&(m[e]={...m[e],numeric:!0})}return{hidden:t===`hidden`||r.hidden===!0,summary:r.summary??`Data table`,caption:e.caption,headers:m,rows:h,..._?{footer:_}:{}}}function ar(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 or(e){let t=e.ownerDocument,n,r,i,a,o,s,c,l=new Map,u=``,d=(e,n)=>{let r=t.createElement(e);return n&&(r.className=n),r};function f(){i=d(`table`),a=d(`caption`,`ec-table-caption`);let e=d(`thead`);return o=d(`tr`),e.appendChild(o),s=d(`tbody`),i.append(a,e,s),i}function p(t,a){let o=t?`DIV`:`DETAILS`;if(n?.tagName!==o){let e=t?d(`div`,`ec-table ec-visually-hidden`):d(`details`,`ec-table`),a=i??f();if(t)r=void 0,e.appendChild(a);else{r=d(`summary`);let t=d(`div`,`ec-table-scroll`);t.appendChild(a),e.append(r,t)}n?.isConnected&&n.replaceWith(e),n=e}n.isConnected||e.after(n),r&&r.textContent!==a&&(r.textContent=a)}function m(e,{text:t,numeric:n}){e.textContent!==t&&(e.textContent=t),e.classList.toggle(`ec-num`,n)}function h(){n?.remove(),n=r=i=a=o=s=c=void 0,l.clear(),u=``}return{render(e){if(!e){h();return}p(e.hidden,e.summary),a.textContent!==e.caption&&(a.textContent=e.caption);let t=JSON.stringify(e.headers);t!==u&&(u=t,o.replaceChildren(...e.headers.map(e=>{let t=d(`th`);return t.scope=`col`,m(t,e),t})),l.clear(),s.replaceChildren());let n=new Set(e.rows.map(e=>e.key));for(let[e,t]of l)n.has(e)||(t.remove(),l.delete(e));if(e.rows.forEach((e,t)=>{let n=l.get(e.key);n||(n=d(`tr`),n.setAttribute(`data-key`,e.key),e.cells.forEach((e,t)=>{let r=d(t===0?`th`:`td`);t===0&&(r.scope=`row`),n.appendChild(r)}),l.set(e.key,n)),e.cells.forEach((e,t)=>m(n.cells[t],e)),s.children[t]!==n&&s.insertBefore(n,s.children[t]??null)}),!e.footer){c?.remove(),c=void 0;return}let r=e.footer,f=c?.rows[0];c&&f&&f.cells.length===r.length||(c?.remove(),c=d(`tfoot`),f=d(`tr`),r.forEach((e,t)=>{let n=d(t===0?`th`:`td`);t===0&&(n.scope=`row`),f.appendChild(n)}),c.appendChild(f),i.appendChild(c)),r.forEach((e,t)=>m(f.cells[t],e))},destroy:h}}function sr(e,t){if(typeof e==`string`){let n=typeof document>`u`?null:document.querySelector(e);if(!n)throw TypeError(`${t}: no element matches "${e}".`);return n}if(!e||typeof e.appendChild!=`function`)throw TypeError(`${t} needs a container element or a selector.`);return e}function cr(e){let t=e.ownerDocument.defaultView?.getComputedStyle(e),n=(parseFloat(t?.paddingLeft??``)||0)+(parseFloat(t?.paddingRight??``)||0),r=e.clientWidth-n;return r>0?r:640}function lr(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 ur(e,t,n){for(let r of ct){let i=e[r];if(i?.kind===`data`){for(let e of i.needs?.related??[])if(!t.includes(e))throw RangeError(`${n}: on.${r} needs the series "${e}", but the chart's series are ${t.map(e=>`"${e}"`).join(`, `)}.`)}}}function dr(e,t,n,r){let i=e=>ct.includes(e)&&n?.[e]!==void 0&&n[e]===t?.[e],a=lt(Object.fromEntries(Object.entries(n??{}).filter(([e])=>!i(e))),r),o={};for(let t of ct){let n=i(t)?e[t]:a[t];n&&(o[t]=n)}return o}function fr(e,t){if(typeof e!=`object`||!e)throw TypeError(`${t} needs options.`);if(typeof e.label!=`string`||e.label.trim()===``)throw TypeError(`${t} needs a label: the chart's accessible name.`);if(!Array.isArray(e.data))throw TypeError(`${t}: data must be an array of rows.`);for(let n of[`width`,`height`]){let r=e[n];if(r!==void 0&&!(typeof r==`number`&&Number.isFinite(r)&&r>0))throw RangeError(`${t}: ${n} must be a positive number of px, got ${String(r)}.`)}let{format:n,tooltip:r,markLabel:i,markDescription:a,legend:o,announce:s}=e;if(n!==void 0&&typeof n!=`function`)throw TypeError(`${t}: format must be a function that turns a value into text.`);if(r!==void 0&&typeof r!=`boolean`&&typeof r!=`function`)throw TypeError(`${t}: tooltip must be true, false or a function that returns a row's text.`);if(i!==void 0&&typeof i!=`function`)throw TypeError(`${t}: markLabel must be a function that returns a mark's accessible name.`);if(a!==void 0&&a!==!1&&typeof a!=`function`)throw TypeError(`${t}: markDescription must be false or a function that returns a mark's accessible description.`);if(gn(o,t),Vn(e.seriesLabels,t),rr(e.table,t),s!==void 0&&typeof s!=`boolean`&&typeof s!=`function`)throw TypeError(`${t}: announce must be true, false or a function that returns the text to announce.`)}function pr(e){let{clock:t}=e,n,r=0,i,a,o=!1;function s(t){if(o||n?.id!==t)return;let{waiters:r}=n;n=void 0,i?.(),i=void 0,e.land(),e.runner.settle(),e.leaving.sweep();for(let e of r)e()}return{run(a){e.draw();let o=++r;return new Promise(r=>{n={id:o,waiters:[...n?.waiters??[],r]},a.length===0?s(o):(i?.(),i=t.onFrame(()=>e.draw()),Promise.all(a).then(()=>s(o)))})},supersede:()=>a?.(),wait(e,t){return new Promise(n=>{a=n,e.then(()=>Promise.all(t.map(e=>e.gone))).then(()=>n())})},destroy(){o=!0,n=void 0,i?.(),a?.()}}}function mr(e,t,n){let{runner:r,events:i,input:a,onScreen:o}=e;r.interrupt();let s=t();e.swap?.(s),e.hover.dropGone();let c=s.exiting.map(e=>e.leave);return r.exit(s.exiting.map(o)).then(()=>{for(let e of c)e.exited=!0;e.leaving.sweep()}),i.emitEach(`exit`,s.exiting,o),(e.data||s.changed.length>0||s.entering.length>0||s.exiting.length>0)&&r.update(s.changed.map(({record:e,from:t})=>({...a(e),from:t}))),i.emitEach(`update`,s.changed,({record:e,from:t})=>({...a(e),from:t})),r.enter(s.entering.map(a)),i.emitEach(`enter`,s.entering,a),n(s),e.hover.sync(),c}function Q(e,t,n){return e.animating||!n(e.value,t)}let $=(e,t)=>e===t;function hr(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])}function gr(e,t){if(e.outline.d!==t.outline.d||_r(e,t))return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((e,t)=>e.key!==r[t].key||e.outline.d!==r[t].outline.d)}function _r(e,t){return vr(e.labelBounds,t.labelBounds)||vr(e.nearbyLabels,t.nearbyLabels)}function vr(e,t){return e===t?!1:!e||!t||e.length!==t.length||e.some((e,n)=>e.x!==t[n].x||e.y!==t[n].y||e.width!==t[n].width||e.height!==t[n].height)}function yr(e,t,n,r){if(typeof ResizeObserver!=`function`)return()=>{};let i=n,a=n,o,s=new ResizeObserver(e=>{let n=e[e.length-1]?.contentRect.width??0;!(n>0)||Math.abs(n-a)<.5||(a=n,o??(o=t.onFrame(()=>{o?.(),o=void 0,!(Math.abs(a-i)<.5)&&(i=a,r(i))})))});return s.observe(e),()=>{s.disconnect(),o?.()}}function br(e,t){let n=e.fonts;return n?.addEventListener?.(`loadingdone`,t),()=>n?.removeEventListener?.(`loadingdone`,t)}function xr(e,t){let n=()=>e.style.setProperty(`--ec-hover-duration`,`${t.duration(100,`feedback`)}ms`);return n(),t.subscribe(n)}let Sr=0;function Cr(e,t,n,r){let i=e.top-12,a=n.height-e.bottom-12;return r??(r=t.height<=i||i>=a?`above`:`below`),{x:Math.max(0,Math.min(n.width-t.width,e.x-t.width/2)),y:r===`above`?i-t.height:e.bottom+12,side:r}}function wr(e,t,n,r={}){let i=t.length===1&&t[0].series===`value`&&(t[0].label??`value`)===`value`,a=[t.map(e=>i?n(e.value):`${n(e.value)} ${e.label??e.series}`).join(` · `)];return t.length>1&&r.total!==!1&&a.push(`${n(t.reduce((e,t)=>e+t.value,0))} total`),{title:e,lines:a}}function Tr(e,n){let r,i,a,o=new WeakMap,s,c,l=!1,u,d=e=>e.style.setProperty(`--ec-hover-duration`,`${n.motion.duration(100,`feedback`)}ms`),f=()=>i?.classList.contains(`ec-tooltip-shown`)??!1,p=()=>{if(!c||!i||!r)return!1;let{x:e,y:t}=c,{left:n,right:a,top:o,bottom:s}=i.getBoundingClientRect();if(e>n&&e<a&&t>o&&t<s)return!0;if(!u)return!1;let l=r.getBoundingClientRect();return Er(u,e-l.left,t-l.top)},m=e=>{l=e,r?.classList.toggle(`ec-tooltip-through`,e)},h=e=>{c=e.pointerType===`touch`?void 0:{x:e.clientX,y:e.clientY},l&&!p()&&m(!1)};e.ownerDocument.addEventListener(`pointerover`,h,!0),e.ownerDocument.addEventListener(`pointermove`,h,!0);function g(){if(!r||!i||!a){let t=e.ownerDocument;r=t.createElement(`div`),r.className=`ec-tooltip-layer`,i=t.createElement(`div`),i.className=`ec-tooltip`,i.setAttribute(`aria-hidden`,`true`),a=t.createElement(`div`),a.className=`ec-tooltip-bridge`,a.setAttribute(`aria-hidden`,`true`),r.append(i,a)}return r.previousSibling!==e&&e.after(r),i}function _(e,t){let r=n.option(),i=o.get(e);if(i&&i.option===r)return i.content;let a=Or(r,e.datum,t,e.series);return o.set(e,{option:r,content:a}),a}function v(){i&&(d(i),i.classList.remove(`ec-tooltip-shown`),m(!1))}function y(t,n,i,o){let c=_(t,n);if(c===void 0){v();return}let h=g(),y=f()&&!l&&p(),b=typeof c==`string`?`text:${c}`:JSON.stringify(c);b!==s&&(kr(h,c),s=b);let x=Ar(e),S=e.getBoundingClientRect(),C=S.width>0&&x.width>0?S.width/x.width:1,w={x:e=>(e-x.x)*C,y:e=>(e-x.y)*C},T=S.width>0?{width:S.width,height:S.height}:{width:x.width,height:x.height},ee={width:h.offsetWidth,height:h.offsetHeight},E=i(w,o),D=Cr(E,ee,T,o?Cr(i(w,!1),ee,T).side:void 0),O=r.getBoundingClientRect(),k=S.left-O.left,A=S.top-O.top,j=Math.round(k+D.x),M=Math.round(A+D.y);h.style.left=`${j}px`,h.style.top=`${M}px`,h.setAttribute(`data-side`,D.side);let N=E.left===void 0||E.right===void 0?void 0:{left:k+E.left,right:k+E.right,top:A+E.top,bottom:A+E.bottom};u=Dr(a,{left:j,top:M,...ee},N,D.side),d(h),h.classList.add(`ec-tooltip-shown`),m(!y&&p())}return{show(e,t,n,r){y(t,n,(t,n)=>{let i=n?r:void 0,{x:a,y:o,width:s,height:c}=e.bounds,l=[{x:a,y:o},{x:a+s,y:o},{x:a,y:o+c},{x:a+s,y:o+c}].map(e=>i?q.apply(i,e):e),u=l.map(e=>e.x),d=l.map(e=>e.y),f=i?q.apply(i,e.center):e.center;return{x:t.x(f.x),top:t.y(Math.min(...d)),bottom:t.y(Math.max(...d)),left:t.x(Math.min(...u)),right:t.x(Math.max(...u))}},r!==void 0)},showAt(e,t,n){y(t,n,t=>({x:t.x(e.x),top:t.y(e.top),bottom:t.y(e.bottom)}),!1)},describe(e,r){let i=n.description?.(),a;if(i===!1)a=void 0;else if(typeof i==`function`)try{let e=i(r.datum);a=typeof e==`string`&&e!==``?e:void 0}catch(e){t(e),a=void 0}else a=typeof n.option()==`function`?_(r,()=>``):void 0;let o=e.querySelector(`:scope > desc.ec-description`);if(typeof a!=`string`){if(!o)return;e.getAttribute(`aria-describedby`)===o.id&&e.removeAttribute(`aria-describedby`),o.remove()}else o??(o=Y(`desc`,{class:`ec-description`,id:`ec-description-${++Sr}`},e)),o.textContent!==a&&(o.textContent=a),e.setAttribute(`aria-describedby`,o.id)},element:()=>f()?r:void 0,hide:v,destroy(){e.ownerDocument.removeEventListener(`pointerover`,h,!0),e.ownerDocument.removeEventListener(`pointermove`,h,!0),r?.remove(),r=void 0,i=void 0,a=void 0,u=void 0,l=!1,o=new WeakMap,s=void 0}}}function Er({top:e,bottom:t,upper:n,lower:r},i,a){if(a<=e||a>=t)return!1;let o=(a-e)/(t-e);return i>n.left+(r.left-n.left)*o&&i<n.right+(r.right-n.right)*o}function Dr(e,t,n,r){if(e.hidden=n===void 0,!n)return;let i={left:t.left,right:t.left+t.width},[a,o,s,c]=r===`above`?[i,n,t.top+t.height-1,Math.round(n.top+1)]:[n,i,Math.round(n.bottom-1),t.top+1],l=Math.round(Math.min(a.left,o.left)),u=Math.round(Math.max(a.right,o.right))-l,d=Math.max(0,c-s),f=e=>`${Math.round(e)-l}px`;e.style.left=`${l}px`,e.style.top=`${s}px`,e.style.width=`${u}px`,e.style.height=`${d}px`,e.style.setProperty(`clip-path`,`polygon(${f(a.left)} 0px, ${f(a.right)} 0px, ${f(o.right)} ${d}px, ${f(o.left)} ${d}px)`);let p=e=>({left:Math.round(e.left),right:Math.round(e.right)});return{top:s,bottom:s+d,upper:p(a),lower:p(o)}}function Or(e,n,r,i){if(e!==!1){if(typeof e!=`function`)return r();try{let t=i===void 0?e(n):e(n,{series:i});return t==null||t===``?void 0:String(t)}catch(e){t(e);return}}}function kr(e,t){if(typeof t==`string`){e.textContent=t;return}let n=e.ownerDocument,r=(e,t)=>{let r=n.createElement(`div`);return t&&(r.className=t),r.textContent=e,r};e.replaceChildren(r(t.title,`ec-tooltip-title`),...t.lines.map(e=>r(e)))}function Ar(e){let t=(e.getAttribute(`viewBox`)??``).split(/[\s,]+/).map(Number);return t.length===4&&t.every(Number.isFinite)?{x:t[0],y:t[1],width:t[2],height:t[3]}:{x:0,y:0,width:Number(e.getAttribute(`width`))||0,height:Number(e.getAttribute(`height`))||0}}function jr(e,n,r){let i=sr(e,`barChart`);Mr(n);let o=n,s=Dn(n.motion,r.motion),c=lt(n.on,r.presets),l=hn(n.colors),u=r.clock??a,d=i.ownerDocument;pn(d);let f=Y(`svg`,{class:`ec-chart ec-bar-chart`,role:`group`},i),p=Y(`g`,{class:`ec-grid`,"aria-hidden":`true`},f),m=Y(`g`,{class:`ec-axis`,"aria-hidden":`true`},f),h=Y(`g`,{class:`ec-focus`,"aria-hidden":`true`,visibility:`hidden`},f),g=[Y(`path`,{class:`ec-focus-ring`,"stroke-width":8,"stroke-linejoin":`round`},h),Y(`path`,{class:`ec-focus-gap`,"stroke-width":4,"stroke-linejoin":`round`},h)],_=Y(`g`,{class:`ec-marks`},f),v=Y(`g`,{class:`ec-overlay`,"aria-hidden":`true`},f),y=kt(f),x=[],w=new Map,T=er(e=>e.values.animating||e.presence.animating),ee=new WeakMap,E=Hn(`barChart`),D=cr(i),O=!1,k,A;try{k=oe(o),A=de(o,k)}catch(e){throw f.remove(),e}let j=e=>w.get(e)??T.get(e),M=zn({overlay:v,mark:e=>({set:t=>{j(e)?.handle.set(t),Ce.restyled(e)},reset:()=>{j(e)?.handle.reset(),Ce.restyled(e)}}),colors:e=>j(e)?.parts[0]?.colors}),N=_t({effects:c,motion:s,icons:r.icons,clock:u,surface:M}),P=Tr(f,{motion:s,option:()=>o.tooltip,description:()=>o.markDescription}),te=vn(f),ne=or(f),F=o.announce?xt(f):void 0,I=k.orientation,L=new Map,R=new Set,z=!1,re=!1,B=C(k.frame.scale,S,{clock:u,motion:s,onChange:()=>z=!0}),ie=C(k.frame.bands,S,{clock:u,motion:s,onChange:()=>z=!0}),ae=pr({clock:u,runner:N,leaving:T,draw:he,land:ge});function oe(e,t=c){let n=Pt(e);return ur(t,n.series.map(e=>e.series),`barChart`),Ft({data:e.data,encoding:n,sort:e.sort,width:e.width??D,height:e.height,format:Un(e),measure:y,room:e.room??0})}function se(e,t){let n=Y(`g`,{class:`ec-mark`,"data-key":e.key,role:`img`},_),r={clock:u,motion:s,onChange:()=>R.add(a)},i=Lr(e),a={key:e.key,row:e,shown:e,group:n,hit:Y(`rect`,{class:`ec-hit`},n),label:Y(`text`,{class:`ec-label`,"aria-hidden":`true`},n),body:Y(`g`,{class:`ec-body`},n),value:Y(`text`,{class:`ec-value`,"aria-hidden":`true`},n),paths:new Map,parts:[],handle:Mn(()=>a),values:C(t?Rr(i):i,S,r),series:e.values.map(e=>e.series),slot:C(e.slot,b,r),presence:C(+!t,b,r),count:void 0,leave:void 0};return ee.set(n,a),ce(a,t?W(a,U()):e),a}function ce(e,t){let n=e.parts[0]?.colors.color;e.shown=t,X(e.hit,{...t.hit}),Ot(e.label,t.label),Ot(e.value,t.value);let r=e.presence.value,i=r<1?r:void 0;X(e.label,{opacity:i}),X(e.value,{opacity:i});let a=t.geometry.segments??[],s=new Set,c=Nr(o)?on(l.slot(e.key)):void 0;e.parts=a.map(t=>{let n=t.series??t.key;s.add(n);let r=e.paths.get(n);r||(r=Y(`path`,{class:`ec-segment`,"data-series":n},e.body),e.paths.set(n,r));let i=c??on(l.slot(n));return r.setAttribute(`d`,t.outline.d),St(r,cn(i)),{element:r,d:t.outline.d,colors:i,visible:t.length>=.5}});for(let[t,n]of e.paths)s.has(t)||(n.remove(),e.paths.delete(t));let u=Array.from(e.body.children).filter(e=>e.classList.contains(`ec-segment`));if(e.parts.some((e,t)=>u[t]!==e.element))for(let t of e.parts)e.body.appendChild(t.element);e.handle.repaint(),e.parts[0]?.colors.color!==n&&M.recolor(e.key),e.key===Ce.ringKey&&V(e.key)}function V(e){let t=e===void 0?void 0:w.get(e);if(!t){h.setAttribute(`visibility`,`hidden`);return}for(let e of g)e.setAttribute(`d`,t.shown.geometry.outline.d);let{transform:n}=t.handle.style;X(h,{transform:n&&wt(n),visibility:void 0})}function H(e,t){let n=gr(e.shown.geometry,t.geometry)||e.shown.datum!==t.datum;ce(e,t),n&&N.change(t.geometry,t.data),e.key===Ce.key&&le(e)}function le(e){let{row:t}=e;P.show(e.shown.geometry,t,()=>wr(t.category,Fr(t.values,o),Un(o)),e.handle.style.transform)}function ue(e){Nr(o)?te.categories(e.rows.map(e=>({key:e.key,label:e.category})),l,o.legend):te.update(Pt(o).series.map(e=>({series:e.series,label:Bn(o.seriesLabels,e.series)})),l,o.legend)}function de(e,t){let n=Pt(e),r=n.orientation===`horizontal`?e.y:e.x;return ir({option:e.table,caption:e.label,category:typeof r==`string`?r:void 0,series:n.series.map(e=>e.series),label:t=>Bn(e.seriesLabels,t),rows:t.rows.map(e=>({key:e.key,category:e.category,datum:e.datum,index:e.index,values:e.values,total:e.total})),format:Un(e)})}function fe(e,n){let r=o.announce;if(!F||!r)return;let i=Pt(o).series.map(e=>e.series),a=Pt(e).series.map(e=>e.series),s=Br(o.sort),c=e=>e.row.category,l=n.changed.map(({record:e})=>e),u=bt({...o.label===e.label?{}:{label:o.label},...i.join(`
91
+ `)===a.join(`
92
+ `)?{}:{series:i.map(e=>Bn(o.seriesLabels,e))},...s!==Br(e.sort)||s===`custom`&&o.sort!==e.sort?{sort:s}:{},changed:l.map(c),added:n.entering.map(c),removed:n.exiting.map(c),count:x.length});if(typeof r!=`function`){F.say(u);return}let d=e=>e.key;try{let e=r({text:u,changed:l.map(d),added:n.entering.map(d),removed:n.exiting.map(d)});e!=null&&F.say(String(e))}catch(e){t(e)}}let U=()=>({orientation:I,scale:B.value,bands:ie.value});function W(e,t){let{row:n}=e,r=e.values.value,i=e.series.map(e=>({series:e,value:r[e]??0})),a=i.reduce((e,t)=>e+t.value,0),s=e.count===void 0?n.value.text:Un(o)(qn(a,e.count));return Vt(t,{key:n.key,datum:n.datum,index:n.index,category:n.category,values:i,slot:e.slot.value,text:s,drawn:n.drawn},y)}function pe(e,t){let n={value:e,line:Y(`line`,{class:e===0?`ec-baseline`:`ec-gridline`},p),label:Y(`text`,{class:`ec-tick`},m),opacity:C(t,b,{clock:u,motion:s,onChange:()=>re=!0}),wanted:!0};L.set(e,n);for(let e of[...L.values()].sort((e,t)=>e.value-t.value))p.appendChild(e.line),m.appendChild(e.label)}function me(e,t){let n=Ht(t,e.value,Un(o)(e.value)),r=e.opacity.value<1?e.opacity.value:void 0;X(e.line,{...n.line,opacity:r}),Ot(e.label,n.label),X(e.label,{opacity:r})}function he(){let e=U();if(z&&X(f,Ct(e.bands)),z||re)for(let t of L.values())me(t,e);for(let t of[...x,...T.values()])(z||R.has(t))&&H(t,W(t,e));z=!1,re=!1,R.clear()}function ge(){X(f,Ct(k.frame.bands));for(let e of[...L.values()])e.wanted||(e.line.remove(),e.label.remove(),L.delete(e.value));for(let e of k.ticks){let t=L.get(e.value);t&&(X(t.line,{...e.line,opacity:void 0}),Ot(t.label,e.label),t.label.removeAttribute(`opacity`))}for(let e of x)e.series=e.row.values.map(e=>e.series),e.count=void 0,H(e,e.row);z=!1,re=!1,R.clear()}function _e(e){let t=new Set(e.rows.map(e=>e.key)),n={entering:[],exiting:[],changed:[]};for(let e of x)t.has(e.key)||(w.delete(e.key),T.start(e),e.count=void 0,n.exiting.push(e));let r=x;return x=e.rows.map(e=>{let t=w.get(e.key);return t?(Ir(t.row,e)&&n.changed.push({record:t,from:t.shown.geometry}),t.count=Math.max(Kn(t.row.total),Kn(e.total))):(t=T.recall(e.key)??se(e,!0),t.count=void 0,w.set(e.key,t),n.entering.push(t)),t.row=e,t.series=zr(t.series,e.values.map(e=>e.series)),ve(t),t}),nr(_,r.map(e=>e.group),x.map(e=>e.group),Ce.active),n}function ve(e){e.group.setAttribute(`aria-label`,Pr(e.row,o)),P.describe(e.group,e.row)}function ye(e,t){let{frame:n}=e;t&&(I=e.orientation);let r=new Set(e.ticks.map(e=>e.value));for(let e of r)L.has(e)||pe(e,0);for(let e of L.values())e.wanted=r.has(e.value);let i=new Set(x.filter(e=>e.presence.value===0)),a=x.filter(e=>!i.has(e)),o=[...T.values()],c=Q(B,n.scale,hr)||[...L.values()].some(e=>Q(e.opacity,+!!e.wanted,$))||a.some(e=>Q(e.values,Lr(e.row),hr)||Q(e.presence,1,$))||o.some(e=>Q(e.values,Rr(e.values.value),hr)||Q(e.presence,0,$)),l=i.size>0||Q(ie,n.bands,hr)||a.some(e=>Q(e.slot,e.row.slot,$)),u,d,f;if(!t&&s.staged){let e=c?500:0;u={duration:500},d={duration:500,delay:e},f={duration:250,delay:e+250}}else t||(u=d=f={duration:(c&&l?2:1)*500});let p=[],m=(e,t,n,r)=>{Q(e,t,n)&&(r?p.push(e.to(t,r)):e.set(t))};m(B,n.scale,hr,u),m(ie,n.bands,hr,d);for(let e of L.values())m(e.opacity,+!!e.wanted,$,u);for(let e of a)m(e.values,Lr(e.row),hr,u),m(e.presence,1,$,u),m(e.slot,e.row.slot,$,d);for(let e of i)e.slot.set(e.row.slot),m(e.values,Lr(e.row),hr,f),m(e.presence,1,$,f);for(let e of o)m(e.values,Rr(e.values.value),hr,u),m(e.presence,0,$,u);return p}function be(e,t){return k=e,ae.run(ye(e,t))}let xe=e=>({mark:e.row.geometry,data:e.row.data}),Se=e=>({mark:e.shown.geometry,data:e.shown.data});function G(e){let t=e,n=typeof t?.closest==`function`?t.closest(`.ec-mark`):null,r=n?ee.get(n):void 0;return r&&w.get(r.key)===r?r:void 0}let Ce=Qn({svg:f,runner:N,events:E,dim:()=>o.dim!==!1,find(e){let t=G(e);if(!t)return;let n=e.closest(`.ec-segment`)?.getAttribute(`data-series`)??void 0;return n===void 0?{key:t.key}:{key:t.key,segment:n}},live:e=>w.has(e),order:()=>x.map(e=>e.key),element:e=>j(e)?.group,hot:M.hot,onScreen(e){let t=j(e);return t&&Se(t)},ring:V,tooltip:{show(e){let t=w.get(e);t&&le(t)},hide:()=>P.hide(),element:()=>P.element()}}),we=xr(f,s);function Te(){if(O)return;let e=oe(o),t=new Map(e.rows.map(e=>[e.key,e]));for(let e of x)e.row=t.get(e.key)??e.row;be(e,!0)}let Ee=yr(i,u,D,e=>{D=e,o.width===void 0&&Te()}),K=br(d,()=>{y.clear(),Te()});lr(f,o),ue(k),ne.render(A),X(f,Ct(k.frame.bands));for(let e of k.ticks)pe(e.value,1);for(let e of L.values())me(e,k.frame);return x=k.rows.map(e=>{let t=se(e,!1);return w.set(e.key,t),ve(t),t}),Ce.sync(),N.enter(x.map(xe)),Cn(Ce.link,{element:f,async update(e){if(O)return;if(e.motion!==void 0&&e.motion!==o.motion)throw TypeError("barChart: `motion` can't be changed by update() yet.");let t={...o,...e};Mr(t);let n=`on`in e?dr(c,o.on,t.on,r.presets):c,i=oe(t,n),a=de(t,i);`colors`in e&&(l=hn(t.colors));let u=o;o=t,lr(f,o),ue(i),ne.render(a);let d=F!==void 0;o.announce&&!F?F=xt(f):!o.announce&&F&&(F.destroy(),F=void 0),Ce.syncDim(),ae.supersede();let p=n!==c;c=n;let m=mr({runner:N,events:E,hover:Ce,leaving:T,input:xe,onScreen:Se,data:`data`in e,...p?{swap:e=>{let t=new Set(e.entering);N.swap(n,x.filter(e=>!t.has(e)).map(xe))}}:{}},()=>_e(i),e=>{d&&fe(u,e)});if(Nr(o)!==Nr(u))for(let e of[...x,...T.values()])R.add(e);let h=be(i,s.mode===`off`||i.orientation!==I);await ae.wait(h,m)},on:E.on,marks:()=>x.map(e=>e.shown.geometry),focus(e){O||Ce.focus(e)},leave(){O||Ce.leave()},labels:()=>x.flatMap(e=>[...$n(e.key,`category`,e.shown.label,e.label),...$n(e.key,`value`,e.shown.value,e.value)]),destroy(){if(!O){O=!0,ae.destroy(),Ce.destroy(),N.destroy(),P.destroy(),te.destroy(),ne.destroy(),F?.destroy(),we(),Ee(),K();for(let e of[...x,...T.values()]){for(let t of[e.values,e.slot,e.presence])t.stop();e.leave?.resolve()}B.stop(),ie.stop();for(let e of L.values())e.opacity.stop();E.clear(),w.clear(),T.clear(),x=[],f.remove()}}})}function Mr(e){fr(e,`barChart`);let{colorBy:t,room:n}=e;if(n!==void 0&&!(typeof n==`number`&&Number.isFinite(n)&&n>=0))throw RangeError(`barChart: room must be a number of px, 0 or more, got ${String(n)}.`);if(t!==void 0&&t!==`series`&&t!==`category`)throw TypeError(`barChart: colorBy must be "series" or "category", got ${String(t)}.`);if(t===`category`&&e.stack!==void 0)throw TypeError(`barChart: colorBy: "category" gives each bar one colour, so it needs one series, not a stack. A stack colours its segments by series.`)}function Nr(e){return e.colorBy===`category`}function Pr(e,n){let r=Un(n),i=Fr(e.values,n),a=i.length===1&&i[0].series===`value`&&i[0].label===`value`,o=`${e.category}: ${i.map(e=>a?r(e.value):`${r(e.value)} ${e.label}`).join(`, `)}`;if(!n.markLabel)return o;try{let t=n.markLabel(e.datum,{key:e.key,category:e.category,values:i,total:e.total,format:r,text:o});if(t!=null&&String(t).trim()!==``)return String(t)}catch(e){t(e)}return o}function Fr(e,t){return e.map(e=>({series:e.series,label:Bn(t.seriesLabels,e.series),value:e.value}))}function Ir(e,t){return e.values.length!==t.values.length||e.values.some((e,n)=>e.series!==t.values[n].series||e.value!==t.values[n].value)}function Lr(e){return Object.fromEntries(e.values.map(e=>[e.series,e.value]))}function Rr(e){return Object.fromEntries(Object.keys(e).map(e=>[e,0]))}function zr(e,t){let n=[...t];return e.forEach((t,r)=>{if(n.includes(t))return;let i=0;for(let t=r-1;t>=0;t--){let r=n.indexOf(e[t]);if(r>=0){i=r+1;break}}n.splice(i,0,t)}),n}function Br(e){return typeof e==`function`?`custom`:e??`none`}let Vr=2*Math.PI,Hr=Math.PI/12,Ur=12.5,Wr=12.5;function Gr(e){let{category:t,value:n,key:r}=e;if(typeof t!=`string`&&typeof t!=`function`)throw TypeError(`donutChart needs a category: the field, or a function, that names each slice.`);if(typeof n!=`string`&&typeof n!=`function`)throw TypeError(`donutChart needs a value: the numeric field, or a function, that sizes each slice.`);if(r!==void 0&&typeof r!=`string`&&typeof r!=`function`)throw TypeError(`donutChart: key must be a field name or a function.`);let i=ai(t);return{category:i,key:r===void 0?i:ai(r),series:typeof n==`string`?n:`value`,value:ai(n)}}function Kr(e){let t=$r(Qr(e),e.sort),n=ei(e,t),r=t.reduce((e,t)=>e+t.value,0),i=qr(t.map(e=>e.value)),a=t.map((n,a)=>{let o=r>0?n.value/r:0,s=a+1<t.length&&r>0?i[a+1]:+(r>0);return{...n,series:e.encoding.series,share:o,start:i[a]*Vr,end:s*Vr}}),o=Xr(n,a,e.measure),s=e.center(r);return{frame:n,total:r,slices:Jr(n,a,o,e.measure),labels:o,centerText:s,center:Zr(n,s,e.measure)}}function qr(e){let t=e.reduce((e,t)=>e+t,0),n=0;return e.map(e=>{let r=t>0?n/t:0;return n+=e,r})}function Jr(e,t,n,r){let i=n.map(e=>e?ni(e,r):void 0),a=i.flatMap((e,t)=>e?[t]:[]),o=a[0],s=a[a.length-1],c=[],l=[],u;for(let e=0;e<t.length;e++)c[e]=u??(s===e?void 0:s),i[e]&&(u=e);u=void 0;for(let e=t.length-1;e>=0;e--)l[e]=u??(o===e?void 0:o),i[e]&&(u=e);return t.map((t,a)=>{let o=c[a]===l[a]?[c[a]]:[c[a],l[a]];return Yr(e,t,n[a],r,o.flatMap(e=>e===void 0?[]:i[e]))})}function Yr(e,t,n,r,i){let a=pe({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?ni(n,r):[],...i?{nearbyLabels:i}:{}});return{...t,geometry:a,data:ii(t.datum,t.share,t.series)}}function Xr(e,t,n){let r,i,a=t.map((t,a)=>{if(t.end-t.start<Hr-1e-9)return;let o=ti(e,t,n),{box:s}=o;if(!(s.x<0||s.y<0||s.x+s.width>e.width||s.y+s.height>e.height)&&!(r&&ri(r,s)))return r=s,i??(i=a),o});for(let e=a.length-1;i!==void 0&&e>i;e--){let t=a[e];if(t){if(!ri(a[i].box,t.box))break;a[e]=void 0}}return a}function Zr(e,t,n){if(t===``)return[];let r=t.split(`
93
+ `),i=2*e.inner*.85,a=n(r[0],`ec-center-value`,26),o=a>i&&a>0?Math.max(14,26*i/a):26,s=r.map((e,t)=>t===0?0:20+(t-1)*16),c=s[s.length-1],l=e.cy+(.72*o-c)/2;return r.map((t,n)=>({x:e.cx,y:l+s[n],anchor:`middle`,text:t,size:n===0?o:Ur}))}function Qr({data:e,encoding:t}){let n=new Set;return e.map((e,r)=>{let i=String(t.key(e,r));if(n.has(i))throw Error(`donutChart: two rows have the key "${i}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(i);let a=oi(t.value(e,r),t.series,i);return{key:i,category:String(t.category(e,r)??``),datum:e,index:r,value:a}})}function $r(e,t){if(t===void 0||t===`none`)return e;if(t===`value`)return[...e].sort((e,t)=>t.value-e.value);throw TypeError(`donutChart: sort must be "value" or "none", got ${String(t)}.`)}function ei(e,t){let{width:n,measure:r}=e,i=e.height??300,a=n/2,o=i/2,s=r(`100%`,`ec-value`,Wr),c=t.reduce((e,t)=>Math.max(e,r(t.category,`ec-label`,Ur)),s),l=Math.min(a-4-10-c,o-4-10-28),u=Math.max(0,Math.min(a,o)-4),d=Math.max(0,l,u/2);return{width:n,height:i,cx:a,cy:o,inner:d*.6,outer:d}}function ti(e,t,n){let r=(t.start+t.end)/2,i=Math.sin(r),a=Math.cos(r),o=e.outer+10,s=e.cx+o*i,c=e.cy-o*a,l=Jn(t.share),u=[n(t.category,`ec-label`,Ur),n(l,`ec-value`,Wr)],d=Math.max(...u),f=c-28*(a+1)/2,p=e=>s+i*e/2;return{category:{x:p(u[0]),y:f+10,anchor:`middle`,text:t.category},share:{x:p(u[1]),y:f+10+15,anchor:`middle`,text:l},box:{x:p(d)-d/2,y:f,width:d,height:28}}}function ni(e,t){let n=[];return e.category.text!==``&&n.push(Dt(e.category,t,`ec-label`,Ur)),e.share.text!==``&&n.push(Dt(e.share,t,`ec-value`,Wr)),n}function ri(e,t){return e.x<t.x+t.width+2&&t.x<e.x+e.width+2&&e.y<t.y+t.height+2&&t.y<e.y+e.height+2}function ii(e,t,n){let r={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related:e=>e===n?r:void 0};return r}function ai(e){return typeof e==`function`?e:t=>t[e]}function oi(e,t,n){if(e==null)return 0;if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return e;throw RangeError(`donutChart: "${t}" for "${n}" must be a finite number of 0 or more, got ${typeof e==`string`?JSON.stringify(e):String(e)}.`)}let si=2*Math.PI;function ci(e,n,r){let i=sr(e,`donutChart`);li(n);let o=n,s=Dn(n.motion,r.motion),c=lt(n.on,r.presets),l=hn(n.colors),u=r.clock??a,d=i.ownerDocument;pn(d);let f=Y(`svg`,{class:`ec-chart ec-donut-chart`,role:`group`},i),p=Y(`g`,{class:`ec-center`,"aria-hidden":`true`},f),m=Y(`g`,{class:`ec-marks`},f),h=Y(`g`,{class:`ec-overlay`,"aria-hidden":`true`},f),g=Y(`g`,{class:`ec-halos`},h),_=An(h),v=Y(`g`,{class:`ec-runs`},h),y=kt(f),x=[],w=new Map,T=er(e=>e.value.animating||e.presence.animating),ee=new WeakMap,E=Hn(`donutChart`),D=cr(i),O=!1,k,A,j;try{k=oe(o),A=fe(o,k),j=di(o,k)}catch(e){throw f.remove(),e}let M=e=>w.get(e)??T.get(e),N=zn({overlay:v,mark:e=>({set:t=>{M(e)?.handle.set(t),K.restyled(e)},reset:()=>{M(e)?.handle.reset(),K.restyled(e)}}),colors:e=>M(e)?.parts[0]?.colors}),P=_t({effects:c,motion:s,icons:r.icons,clock:u,surface:N}),te=Tr(f,{motion:s,option:()=>o.tooltip,description:()=>o.markDescription}),ne=vn(f),F=or(f),I=o.announce?xt(f):void 0,L=[],R=[],z=!1,re=C(k.frame,S,{clock:u,motion:s,onChange:()=>z=!0}),B,ie,ae=pr({clock:u,runner:P,leaving:T,draw:ve,land:be});function oe(e,t=c){let n=Gr(e);return ur(t,[n.series],`donutChart`),Kr({data:e.data,encoding:n,sort:e.sort,width:e.width??D,height:e.height,center:t=>pi(e,n.series,t),measure:y})}function se(e,t){let n=Y(`g`,{class:`ec-mark`,"data-key":e.key,role:`img`},m),r={clock:u,motion:s,onChange:()=>z=!0},i=Y(`g`,{class:`ec-body`},n),a={key:e.key,row:e,shown:e,group:n,hit:Y(`path`,{class:`ec-hit`},n),body:i,path:Y(`path`,{class:`ec-slice`,"data-series":e.series},i),label:Y(`text`,{class:`ec-label`,"aria-hidden":`true`},n),share:Y(`text`,{class:`ec-value`,"aria-hidden":`true`},n),drawnLabel:void 0,parts:[],handle:Mn(()=>a,{halos:()=>g}),value:C(t?0:e.value,b,r),turn:C(1,b,r),offset:0,planned:0,presence:C(+!t,b,r),leave:void 0};return n.insertBefore(a.hit,i),ee.set(n,a),a}function ce(e,t,n){let r=e.parts[0]?.colors.color;e.shown=t;let{outline:i}=t.geometry,a=t.geometry.length>=.5,o=a?void 0:`hidden`;X(e.path,{d:i.d,visibility:o}),X(e.hit,{d:i.d,visibility:o});let s=on(l.slot(e.key));St(e.path,cn(s)),e.parts=[{element:e.path,d:i.d,colors:s,visible:a}];let c=e.presence.value,u=c<1?c:void 0;e.drawnLabel=n;for(let[t,r]of[[e.label,n?.category],[e.share,n?.share]])r&&Ot(t,r),X(t,{visibility:r?void 0:`hidden`,opacity:u});e.handle.repaint(),s.color!==r&&N.recolor(e.key),e.key===K.ringKey&&V(e.key)}function V(e){let t=e===void 0?void 0:w.get(e);_.draw(t&&{outline:t.shown.geometry.outline,thickness:t.shown.geometry.thickness,transform:t.handle.style.transform})}function H(e,t,n){let r=gr(e.shown.geometry,t.geometry)||e.shown.datum!==t.datum;ce(e,t,n),r&&P.change(t.geometry,t.data),e.key===K.key&&le(e)}function le(e){let{row:t}=e;te.show(e.shown.geometry,t,()=>({title:t.category,lines:[`${ui(t,o)} · ${Jn(t.share)}`]}),e.handle.style.transform)}function ue(e){for(;p.childElementCount>e.length;)p.lastElementChild.remove();e.forEach((e,t)=>{let n=p.children[t]??Y(`text`,{},p);X(n,{class:t===0?`ec-center-value`:`ec-center-label`}),Ot(n,e),St(n,{"font-size":t===0&&e.size!==26?`${e.size}px`:void 0})})}let de=()=>ne.categories(k.slices.map(e=>({key:e.key,label:e.category})),l,o.legend);function fe(e,t){let{series:n}=Gr(e);return ir({option:e.table,caption:e.label,category:typeof e.category==`string`?e.category:void 0,series:[n],label:t=>Bn(e.seriesLabels,t),rows:t.slices.map(e=>({key:e.key,category:e.category,datum:e.datum,index:e.index,values:[{series:n,value:e.value}],total:e.value})),format:Un(e),shares:!0})}function U(){lr(f,{label:o.label,description:mi(o.description,k.centerText)})}function W(e,n){let r=o.announce;if(!I||!r)return;let i=Gr(o).series,a=Gr(e).series,s=o.sort??`none`,c=e=>e.row.category,l=n.changed.map(({record:e})=>e),u=bt({...o.label===e.label?{}:{label:o.label},...i===a?{}:{series:[Bn(o.seriesLabels,i)]},...s===(e.sort??`none`)?{}:{sort:s},changed:l.map(c),added:n.entering.map(c),removed:n.exiting.map(c),count:x.length});if(typeof r!=`function`){I.say(u);return}let d=e=>e.key;try{let e=r({text:u,changed:l.map(d),added:n.entering.map(d),removed:n.exiting.map(d)});e!=null&&I.say(String(e))}catch(e){t(e)}}let pe=e=>w.get(e.key)===e||T.get(e.key)===e,me=e=>Math.max(0,e.value.value);function he(e,t,n=me){let r=new Map,i=0;for(let a of e)r.set(a,t>0?i/t:0),i+=n(a);return r}function ge(){L=L.filter(pe),R=R.filter(pe);let e=L.reduce((e,t)=>e+me(t),0),t=he(L,e),n=he(R,e),r=new Map;for(let i of L){let a=t.get(i),o=i.turn.value,s=n.get(i),c=a;if(s!==void 0&&o<1){let e=s+i.offset-a;c=a+(1-o)*(e-Math.round(e-i.planned))}r.set(i,{start:c,span:e>0?me(i)/e:0})}return r}function _e(e){let t=[...ge()].map(([e,{start:t,span:n}])=>{let{row:r}=e;return{record:e,state:{key:r.key,datum:r.datum,index:r.index,category:r.category,series:r.series,value:me(e),share:n,start:t*si,end:(t+n)*si}}}),n=Xr(e,t.map(({state:e})=>e),y),r=Jr(e,t.map(({state:e})=>e),n,y);return t.map(({record:e},t)=>({record:e,slice:r[t],label:n[t]}))}function ve(){if(!z)return;z=!1;let e=re.value;X(f,Ct(e));let t=_e(e);for(let{record:e,slice:n,label:r}of t)H(e,n,r);let n=t.reduce((e,{slice:t})=>e+t.value,0);ue(Zr(e,B===void 0?k.centerText:ye(qn(n,B)),y))}function ye(e){return ie?.total!==e&&(ie={total:e,text:pi(o,Gr(o).series,e)}),ie.text}function be(){L=L.filter(pe),R=L;for(let e of L)e.turn.set(1),e.offset=0,e.planned=0;B=void 0,ie=void 0,X(f,Ct(k.frame)),k.slices.forEach((e,t)=>H(w.get(e.key),e,k.labels[t])),ue(k.center),z=!1}function xe(e){let t=new Set(e.slices.map(e=>e.key)),n={entering:[],exiting:[],changed:[]};for(let e of x)t.has(e.key)||(w.delete(e.key),T.start(e),n.exiting.push(e));let r=x;return x=e.slices.map(e=>{let t=w.get(e.key);return t?(t.row.value!==e.value||t.row.series!==e.series)&&n.changed.push({record:t,from:t.shown.geometry}):(t=T.recall(e.key)??se(e,!0),w.set(e.key,t),n.entering.push(t)),t.row=e,t.path.setAttribute(`data-series`,e.series),Se(t),t}),nr(m,r.map(e=>e.group),x.map(e=>e.group),K.active),n}function Se(e){e.group.setAttribute(`aria-label`,j.get(e.key)),te.describe(e.group,e.row)}function G(e,t){z=!0;let n=ge(),r=new Set(x.filter(e=>e.presence.value===0)),i=x.filter(e=>!r.has(e)),a=[...T.values()],o=R.length>0&&R.every(e=>e.turn.value===0),c=L;if(L=hi(c,x),!o){R=c;let e=he(c,c.reduce((e,t)=>e+me(t),0));for(let t of c)t.offset=n.get(t).start-e.get(t)}R=R.filter(e=>!r.has(e));let l=e=>w.get(e.key)===e?e.row.value:0,u=L.reduce((e,t)=>e+l(t),0),d=he(L,u,l),f=he(R,u,l),p=!1;for(let e of R){let t=f.get(e)+e.offset-d.get(e);e.planned=t-Math.round(t),Math.abs(e.planned)>1e-9&&(p=!0)}let m=i.some(e=>Q(e.value,e.row.value,$)||Q(e.presence,1,$))||a.some(e=>Q(e.value,0,$)||Q(e.presence,0,$)),h=p||r.size>0||Q(re,e.frame,hr),g,_,v;if(!t&&s.staged){let e=m?500:0;g={duration:500},_={duration:500,delay:e},v={duration:250,delay:e+250}}else t||(g=_=v={duration:(m&&h?2:1)*500});let y=[],b=(e,t,n,r)=>{Q(e,t,n)&&(r?y.push(e.to(t,r)):e.set(t))};b(re,e.frame,hr,_);for(let e of i)b(e.value,e.row.value,$,g),b(e.presence,1,$,g);for(let e of r)b(e.value,e.row.value,$,v),b(e.presence,1,$,v);for(let e of a)b(e.value,0,$,g),b(e.presence,0,$,g);if(t){R=L;for(let e of L)e.turn.set(1),e.offset=0,e.planned=0;return y}let S=new Set(R);for(let e of L)e.turn.set(+!S.has(e));if(p)for(let e of R)b(e.turn,1,$,_);return y}function Ce(e,t){return k=e,ae.run(G(e,t))}let we=e=>({mark:e.row.geometry,data:e.row.data}),Te=e=>({mark:e.shown.geometry,data:e.shown.data});function Ee(e){let t=e,n=typeof t?.closest==`function`?t.closest(`.ec-mark`):null,r=n?ee.get(n):void 0;return r&&w.get(r.key)===r?r:void 0}let K=Qn({svg:f,runner:P,events:E,dim:()=>o.dim!==!1,find(e){let t=Ee(e);return t&&{key:t.key}},live:e=>w.has(e),order:()=>x.map(e=>e.key),element:e=>M(e)?.group,hot:N.hot,onScreen(e){let t=M(e);return t&&Te(t)},ring:V,tooltip:{show(e){let t=w.get(e);t&&le(t)},hide:()=>te.hide(),element:()=>te.element()}}),De=xr(f,s);function Oe(){if(O)return;let e=oe(o),t=new Map(e.slices.map(e=>[e.key,e]));for(let e of x)e.row=t.get(e.key)??e.row;Ce(e,!0)}let ke=yr(i,u,D,e=>{D=e,o.width===void 0&&Oe()}),Ae=br(d,()=>{y.clear(),Oe()});return U(),de(),F.render(A),X(f,Ct(k.frame)),x=k.slices.map(e=>{let t=se(e,!1);return w.set(e.key,t),Se(t),t}),L=R=x,k.slices.forEach((e,t)=>ce(x[t],e,k.labels[t])),ue(k.center),K.sync(),P.enter(x.map(we)),Cn(K.link,{element:f,async update(e){if(O)return;if(e.motion!==void 0&&e.motion!==o.motion)throw TypeError("donutChart: `motion` can't be changed by update() yet.");let t={...o,...e};li(t);let n=`on`in e?dr(c,o.on,t.on,r.presets):c,i=oe(t,n),a=fe(t,i),u=di(t,i);`colors`in e&&(l=hn(t.colors));let d=o,p=k.total;o=t,k=i,j=u,U(),de(),F.render(a);let m=I!==void 0;o.announce&&!I?I=xt(f):!o.announce&&I&&(I.destroy(),I=void 0),K.syncDim(),ae.supersede();let h=n!==c;c=n;let g=mr({runner:P,events:E,hover:K,leaving:T,input:we,onScreen:Te,data:`data`in e,...h?{swap:e=>{let t=new Set(e.entering);P.swap(n,x.filter(e=>!t.has(e)).map(we))}}:{}},()=>xe(i),e=>{m&&W(d,e)});B=i.total===p?void 0:Math.max(Kn(p),Kn(i.total));let _=Ce(i,s.mode===`off`);await ae.wait(_,g)},on:E.on,marks:()=>x.map(e=>e.shown.geometry),focus(e){O||K.focus(e)},leave(){O||K.leave()},labels:()=>x.flatMap(e=>[...$n(e.key,`category`,e.drawnLabel?.category,e.label),...$n(e.key,`value`,e.drawnLabel?.share,e.share)]),destroy(){if(!O){O=!0,ae.destroy(),K.destroy(),P.destroy(),te.destroy(),ne.destroy(),F.destroy(),I?.destroy(),De(),ke(),Ae();for(let e of[...x,...T.values()]){for(let t of[e.value,e.turn,e.presence])t.stop();e.leave?.resolve()}re.stop(),E.clear(),w.clear(),T.clear(),x=L=R=[],f.remove()}}})}function li(e){fr(e,`donutChart`);let{center:t,sort:n}=e;if(t!==void 0&&t!==!1&&typeof t!=`function`)throw TypeError(`donutChart: center must be false or a function that returns the text for the total.`);if(n!==void 0&&n!==`none`&&n!==`value`)throw TypeError(`donutChart: sort must be "value" or "none", got ${String(n)}.`)}function ui(e,t){let n=Un(t)(e.value),r=Bn(t.seriesLabels,e.series);return e.series===`value`&&r===`value`?n:`${n} ${r}`}function di(e,t){return new Map(t.slices.map(t=>[t.key,fi(t,e)]))}function fi(e,n){let r=`${e.category}: ${ui(e,n)}, ${Jn(e.share)}`;if(!n.markLabel)return r;try{let t={series:e.series,label:Bn(n.seriesLabels,e.series),value:e.value},i=n.markLabel(e.datum,{key:e.key,category:e.category,values:[t],total:e.value,share:e.share,format:Un(n),text:r});if(i!=null&&String(i).trim()!==``)return String(i)}catch(e){t(e)}return r}function pi(e,n,r){let{center:i}=e,a=Un(e);if(i===!1)return``;if(i===void 0){let t=Bn(e.seriesLabels,n);return n===`value`&&t===`value`?a(r):`${a(r)}\n${t}`}try{let e=i(r,a);return e==null?``:String(e)}catch(e){return t(e),``}}function mi(e,t){let n=t.split(`
94
+ `).join(` `).trim(),r=e?.trim();return n===``?e:r?/[.!?:;]$/.test(r)?`${r} ${n}`:`${r}. ${n}`:n}function hi(e,t){let n=[...t];return e.forEach((t,r)=>{if(n.includes(t))return;let i=0;for(let t=r-1;t>=0;t--){let r=n.indexOf(e[t]);if(r>=0){i=r+1;break}}n.splice(i,0,t)}),n}let gi=[`linear`,`monotone`];function _i(e){return+(e===`monotone`)}function vi(e,t,n,r,i){let a=new Int32Array(e.length).fill(-1),o=[],s=[],c=[],l=[],u=0,d=!1;for(let n=0;n<e.length;n++){let r=t[n];if(r===void 0){d=!1;continue}let f=o.length-1;d&&e[n]===o[f]&&r===s[f]?(a[n]=f,l[f]=Math.max(l[f],i?.[n]??1)):(d&&e[n]!==o[f]||u++,o.push(e[n]),s.push(r),c.push(u),l.push(i?.[n]??1),a[n]=f+1,d=!0)}let f=n>0?new Float64Array(o.length):void 0;if(f)for(let e=0;e<o.length;){let t=e+1;for(;t<o.length&&c[t]===c[e];)t++;yi(o,s,e,t,f),i&&bi(o,s,l,e,t,f),e=t}let p=(e,t)=>{let r=a[e];if(r<0||a[t]!==r+1||c[r+1]!==c[r])return;let i=o[r+1]-o[r],l=s[r],u=s[r+1],d=(u-l)/i,[p,m]=d<0?[3*d,0]:[0,3*d],h=e=>Math.min(m,Math.max(p,n===1?e:d+n*(e-d))),g=f?h(f[r]):d,_=f?h(f[r+1]):d;return[l,l+i*g/3,u-i*_/3,u,r]};return{between(e,t,n=1/0){let i=p(e,t);if(!i||!f)return[];let[a,s,c,l,u]=i,d=o[u],m=o[u+1]-d,h=r.x(d),g=r.x(o[u+1]),_=Math.min(Te({x:h,y:r.y(a)},{x:h+(g-h)/3,y:r.y(s)},{x:g-(g-h)/3,y:r.y(c)},{x:g,y:r.y(l)}),Math.max(1,Math.ceil(Math.abs(g-h)/Se))),v=[];for(let e=1;e<_;e++){let t=d+e/_*m;if(!(t<n))break;v.push({x:t,value:Si(a,s,c,l,e/_)})}return v},valueAt(e,n,r){let i=p(e,n);if(!i)return t[e]??0;let[a,s,c,l,u]=i;return Si(a,s,c,l,(r-o[u])/(o[u+1]-o[u]))}}}function yi(e,t,n,r,i){let a=r-n;if(a<2){a===1&&(i[n]=0);return}let o=n=>(t[n+1]-t[n])/(e[n+1]-e[n]);if(a===2)i[n]=i[n+1]=o(n);else{for(let t=n+1;t<r-1;t++){let n=e[t]-e[t-1],r=e[t+1]-e[t],a=o(t-1),s=o(t),c=(a*r+s*n)/(n+r);i[t]=(xi(a)+xi(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(c))||0}i[n]=(3*o(n)-i[n+1])/2,i[r-1]=(3*o(r-2)-i[r-2])/2}}function bi(e,t,n,r,i,a){let o=[];for(let e=r;e<i;e++)n[e]>=1&&o.push(e);if(o.length===i-r||o.length<2)return;let s=o.map(t=>e[t]),c=o.map(e=>t[e]),l=new Float64Array(o.length);yi(s,c,0,o.length,l);let u=new Float64Array(i-r),d=0,f=0;for(let t=r;t<i;t++){for(;d<s.length-2&&s[d+1]<=e[t];)d++;let p=o[f]===t?f++:-1,m=1;for(let e=Math.max(r,t-2);e<Math.min(i,t+3);e++)m=Math.min(m,n[e]);if(m>=1){u[t-r]=a[t];continue}let h;if(p>=0)h=l[p];else{let n=s[d+1]-s[d],r=Math.min(1,Math.max(0,(e[t]-s[d])/n));h=(6*r*r-6*r)*(c[d]-c[d+1])/n+(3*r*r-4*r+1)*l[d]+(3*r*r-2*r)*l[d+1]}u[t-r]=m*a[t]+(1-m)*h}a.set(u,r)}let xi=e=>e<0?-1:1;function Si(e,t,n,r,i){let a=1-i;return a*a*a*e+3*a*a*i*t+3*a*i*i*n+i*i*i*r}let Ci=[`UTC`,`local`],wi=1e3,Ti=60*wi,Ei=60*Ti,Di=24*Ei,Oi={second:wi,minute:Ti,hour:Ei,day:9e7,week:6084e5,month:31*Di,year:366*Di},ki=[...[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}],Ai=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],ji={second:`second`,minute:`minute`,hour:`hour`,day:`day`,week:`day`,month:`month`,year:`year`},Mi={year:{year:`numeric`},month:{month:`short`},day:{month:`short`,day:`numeric`},hour:{hour:`numeric`,minute:`2-digit`},minute:{hour:`numeric`,minute:`2-digit`},second:{hour:`numeric`,minute:`2-digit`,second:`2-digit`},millisecond:{hour:`numeric`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3}};function Ni(e){for(let t of ki)if(Oi[t.unit]*t.count>=e)return t;return{unit:`year`,count:Math.max(1,qt(e/Oi.year))}}function Pi(e,t,n){let r=Bi(n);if(!(t>e))return[{value:e,text:r(e,`year`)}];let i=Ni((t-e)/4),a=Ai[Math.min(Ai.indexOf(ji[i.unit]),Ai.indexOf(Fi(e,t,n)))],o=Ii(e,t,i,n).map(e=>({value:e,text:r(e,`millisecond`)}));return[{value:e,text:r(e,a)},...o,{value:t,text:r(t,a)}]}function Fi(e,t,n){let[r,i]=[Hi(e,n),Hi(t,n)];return r.year===i.year?r.month===i.month?r.date===i.date?r.hours===i.hours?r.minutes===i.minutes?`second`:`minute`:`hour`:`day`:`month`:`year`}function Ii(e,t,n,r){let{unit:i,count:a}=n,o=[],s=Hi(e,r);if(i===`second`||i===`minute`||i===`hour`){let n=i===`hour`?15*Ti:Oi[i],c=e-s.ms-(i===`second`?0:s.seconds*wi)-(i===`hour`?s.minutes%15*Ti:0);for(;c<t;c+=n){let t=Hi(c,r),n=i!==`hour`||t.minutes===0,s=i===`second`?t.seconds:i===`minute`?t.minutes:t.hours;c>e&&n&&s%a===0&&o.push(c)}return o}let c=i===`day`?e=>Ui(r,s.year,s.month,s.date+e):i===`week`?e=>Ui(r,s.year,s.month,s.date-(s.weekday+6)%7+7*e):i===`month`?e=>Ui(r,s.year,Math.floor(s.month/a)*a+a*e,1):e=>Ui(r,Math.floor(s.year/a)*a+a*e,0,1),l=-1/0;for(let n=0;;n++){let s=c(n);if(s>=t||s<=l)break;l=s,s>e&&(i!==`day`||(Hi(s,r).date-1)%a==0)&&o.push(s)}return o}function Li(e,t,n){let{year:r,month:i,date:a,hours:o,minutes:s,seconds:c,ms:l}=Hi(e,n),u=new Date(0);u.setUTCFullYear(r,i+t+1,0);let d=Math.min(a,u.getUTCDate()),f=new Date(0);return n===`UTC`?(f.setUTCFullYear(r,i+t,d),f.setUTCHours(o,s,c,l)):(f.setFullYear(r,i+t,d),f.setHours(o,s,c,l)),f.getTime()}function Ri(e,t){let{ms:n,seconds:r,minutes:i,hours:a,date:o,month:s}=Hi(e,t);return n===0?r===0?i===0?a===0?o===1?s===0?`year`:`month`:`day`:`hour`:`minute`:`second`:`millisecond`}function zi(e,t){let n=e.reduce((e,n)=>Math.max(e,Ai.indexOf(Ri(n,t))),0),r=Vi(t),i=n>=Ai.indexOf(`second`)?`medium`:n>=Ai.indexOf(`hour`)?`short`:void 0,a=n===Ai.indexOf(`millisecond`)?{year:`numeric`,...Mi.day,...Mi.millisecond,timeZone:r}:{dateStyle:`medium`,...i?{timeStyle:i}:{},timeZone:r},o=new Intl.DateTimeFormat(void 0,a);return e=>o.format(e)}function Bi(e){let t=new Map;return(n,r)=>{let i=Ai.indexOf(Ri(n,e)),a={};for(let e=Math.min(i,Ai.indexOf(r));e<=i;e++)Object.assign(a,Mi[Ai[e]]);let o=JSON.stringify(a),s=t.get(o);return s||t.set(o,s=new Intl.DateTimeFormat(void 0,{...a,timeZone:Vi(e)})),s.format(n)}}let Vi=e=>e===`UTC`?`UTC`:void 0;function Hi(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 Ui(e,t,n,r){let i=new Date(0);return e===`UTC`?(i.setUTCFullYear(t,n,r),i.setUTCHours(0,0,0,0)):(i.setFullYear(t,n,r),i.setHours(0,0,0,0)),i.getTime()}let Wi=2.25,Gi=4.5,Ki=12.5,qi=.36;function Ji(e){let{x:t,series:n,key:r}=e;if(typeof t!=`string`&&typeof t!=`function`)throw TypeError(`lineChart needs x: a field of numbers or Dates, or a function that returns each row's x.`);if(!Array.isArray(n)||n.length===0)throw TypeError(`lineChart needs series: the numeric fields to draw as lines.`);let i=new Set;for(let e of n){if(typeof e!=`string`||e===``)throw TypeError(`lineChart: each series must be a field name, got ${ya(e)}.`);if(i.has(e))throw TypeError(`lineChart: "${e}" appears twice in series.`);i.add(e)}if(r!==void 0&&typeof r!=`string`&&typeof r!=`function`)throw TypeError(`lineChart: key must be a field name or a function.`);let a=e.labels;if(a!==void 0&&a!==!1&&typeof a!=`function`)throw TypeError(`lineChart: labels must be false or a function that returns a line's end label.`);let o=e.timeZone??`UTC`;if(!Ci.includes(o))throw TypeError(`lineChart: timeZone must be "UTC" or "local", got ${ya(o)}.`);let s=e.xFormat;if(s!==void 0&&typeof s!=`function`)throw TypeError(`lineChart: xFormat must be a function that turns an x into text.`);let c=e.curve??`linear`;if(!gi.includes(c))throw TypeError(`lineChart: curve must be "linear" or "monotone", got ${ya(c)}.`);return{x:va(t),key:r===void 0?void 0:va(r),series:n.map(e=>({series:e,value:va(e)})),timeZone:o,xFormat:e.xFormat,curve:c}}function Yi(e){let{width:t,measure:n}=e,r=e.height??300,{rows:i,time:a}=ua(e),o=e.encoding.series.map(e=>e.series),s=Kt(i.flatMap(e=>e.values.flatMap(e=>e.value===void 0?[]:[e.value]))),c=s.ticks.map(e.format),l=i[0]?.x??0,u=i[i.length-1]?.x??0,d=i.length===0?[]:a?Pi(l,u,e.encoding.timeZone):sa(l,u).map(e=>({value:e,text:ca(e)})),f=d.map(e=>e.value),p=d.map(e=>e.text),m=p.map(e=>n(e,`ec-tick`,11)),h=e.label?_a(ga(i,e.label),`ec-value`,Ki,n):0,g=Math.max(_a(c,`ec-tick`,11,n)+10,(m[0]??0)/2+2),_=Math.max(10,(m[m.length-1]??0)/2+2,h>0?10+h+4:0),v={scale:{lo:s.lo,hi:s.hi},box:{xLo:l,xHi:u,left:g,right:Math.max(g,t-_),top:12,bottom:Math.max(12,r-32),width:t,height:r}},y={};for(let e of o)y[e]=0;for(let e of i)for(let t of e.values)t.value!==void 0&&(y[t.series]=Math.max(y[t.series],Kn(t.value)));let b=f.map((e,t)=>oa(v,e,p[t]));return{width:t,height:r,frame:v,rows:i,time:a,series:o,yTicks:s.ticks.map((e,t)=>aa(v,e,c[t])),xTicks:la(b,m),decimals:y,curve:e.encoding.curve}}function Xi(e){let{scale:t,box:n}=e,r=n.xHi-n.xLo,i=t.hi-t.lo;return{x:e=>r>0?n.left+(e-n.xLo)/r*(n.right-n.left):(n.left+n.right)/2,y:e=>i>0?n.bottom-(e-t.lo)/i*(n.bottom-n.top):n.bottom}}function Zi(e,t,n,r,i=!1,a,o=0){let s=t[0];if(!s)return[];let c=Xi(e),l=0;for(;l+1<t.length&&t[l+1].x<=r;)l++;let u=t[l],d=t[l+1],f=d&&d.x>u.x&&r>u.x?(r-u.x)/(d.x-u.x):void 0,p=t.slice(0,l+1),m=o>0?t.map(e=>e.x):[],h=o>0&&t.some(e=>e.presence!==void 0&&e.presence<1)?t.map(e=>e.presence??1):void 0,g=new Map,_=e=>t=>t===e?void 0:g.get(t),v=n.map(e=>{let n=t=>!t.missing?.has(e),i=o>0?vi(m,t.map(t=>n(t)?t.values[e]??0:void 0),o,c,h):void 0,a=[],g=!1,_=-1;if(p.forEach((r,o)=>{if(!n(r))g=a.length>0;else{if(i&&_>=0)for(let e of i.between(_,o))a.push({at:e.x,value:e.value,datum:t[_].datum,gapBefore:!1});a.push({at:r.x,value:r.values[e]??0,datum:r.datum,gapBefore:g}),g=!1,_=o}}),f!==void 0&&n(u)&&n(d)){if(i)for(let e of i.between(l,l+1,r))a.push({at:e.x,value:e.value,datum:u.datum,gapBefore:!1});let t=u.values[e]??0,n=i?i.valueAt(l,l+1,r):t+f*((d.values[e]??0)-t);a.push({at:r,value:n,datum:u.datum,gapBefore:!1})}return{name:e,vertices:a,points:a.length>0?a.map(e=>({x:c.x(e.at),y:c.y(e.value)})):[{x:c.x(s.x),y:c.y(s.values[e]??0)}]}}),y=v.filter(({vertices:e})=>e.length>0),b=a?ra(e,y.map(({name:e,vertices:t,points:n})=>({...n[n.length-1],text:a.text(e,t[t.length-1].value)}))):[],x=a?b.map(e=>e.text===``?void 0:Dt(e,a.measure,`ec-value`,Ki)):[];return v.map(({name:e,vertices:t,points:n})=>{let r=n[n.length-1],o=y.findIndex(t=>t.name===e),c=a?b[o]??{x:r.x+10,y:r.y+Ki*qi,anchor:`start`,text:``}:void 0,l=x[o],d=a?l?[l]:[]:void 0,f=a?x.filter((e,t)=>e!==void 0&&t!==o):void 0,p=t.flatMap((e,t)=>e.gapBefore?[t]:[]),m=_e({key:e,series:e,points:n,width:Wi,...p.length>0?{breaks:p}:{},...d?{labelBounds:d}:{},...f?{nearbyLabels:f}:{}}),h=0,v=t.map((e,r)=>(r>0&&(h+=Math.hypot(n[r].x-n[r-1].x,n[r].y-n[r-1].y)),{t:m.length>0?r===t.length-1?1:Math.min(1,h/m.length):0,value:e.value,at:ma(e.at,i),...e.gapBefore?{gapBefore:!0}:{}})),S=t[t.length-1],C={datum:S?S.datum:u.datum,samples:v,related:_(e)};return g.set(e,C),{series:e,geometry:m,data:C,end:{...r,value:S?S.value:s.values[e]??0},label:c}})}function Qi(e,t){let n=new Set;if(!e.some(e=>e.missing!==void 0&&e.missing.size>0))return n;let r=(e,t)=>e!==void 0&&!e.missing?.has(t);return e.forEach((i,a)=>{for(let o of t){let t=e[a-1],s=e[a+1];!r(i,o)||r(t,o)||r(s,o)||t===void 0&&s===void 0||n.add($i(o,i.key))}}),n}function $i(e,t){return`${e}@${t}`}function ea(e,t,n,r=!1){let i=Xi(e),a=i.x(t.x),o=new Map;return n.filter(e=>!t.missing?.has(e)).map(e=>{let n=t.values[e]??0,s=$i(e,t.key),c={datum:t.datum,samples:[{t:0,value:n,at:ma(t.x,r)}],related:t=>t===e?void 0:o.get(t)};return o.set(e,c),{key:s,series:e,geometry:xe({key:s,series:e,x:a,y:i.y(n),r:Gi}),data:c}})}function ta(e,t){let{width:n,height:r}=e.box;return t.map((e,i)=>{let a=i===0?0:(t[i-1]+e)/2,o=i===t.length-1?n:(e+t[i+1])/2;return{x:a,y:0,width:Math.max(0,o-a),height:r}})}function na(e,t){return{x1:t,y1:e.box.top,x2:t,y2:e.box.bottom}}function ra(e,t){let n=Ki/2,r=ia(t.map(e=>e.y),16,n,e.box.height-n);return t.map((e,t)=>({x:e.x+10,y:r[t]+Ki*qi,anchor:`start`,text:e.text}))}function ia(e,t,n,r){let i=e.map((e,t)=>({value:e,index:t})).sort((e,t)=>e.value-t.value||e.index-t.index),a=[],o=e=>{let i=e.reduce((e,t)=>e+t.value,0)/e.length,a=(e.length-1)*t;return Math.max(n,Math.min(r-a,i-a/2))};for(let e of i)for(a.push({members:[e],start:o([e])});a.length>1;){let e=a[a.length-1],n=a[a.length-2];if(e.start-(n.start+(n.members.length-1)*t)>=t)break;a.pop(),n.members.push(...e.members),n.start=o(n.members)}let s=Array(e.length);for(let e of a)e.members.forEach((n,r)=>s[n.index]=e.start+r*t);return s}function aa(e,t,n){let{box:r}=e,i=Xi(e).y(t);return{value:t,line:{x1:r.left,y1:i,x2:r.right+8,y2:i},label:{x:r.left-8,y:i+11*qi,anchor:`end`,text:n}}}function oa(e,t,n){return{value:t,label:{x:Xi(e).x(t),y:e.box.bottom+18,anchor:`middle`,text:n}}}function sa(e,t){if(!(t>e))return[e];let n=qt((t-e)/4),r=[e];for(let i=Math.floor(e/n)+1;nn(i*n)<t;i++){let t=nn(i*n);t>e&&r.push(t)}return r.push(t),r}function ca(e){return String(e)}function la(e,t){if(e.length<=1)return[...e];let n=e.map((e,n)=>({tick:e,from:e.label.x-t[n]/2,to:e.label.x+t[n]/2})),r=n[n.length-1],i=[n[0]];for(let e of n.slice(1,-1))e.from-i[i.length-1].to>=8&&r.from-e.to>=8&&i.push(e);return r.from-i[i.length-1].to>=8&&i.push(r),i.map(e=>e.tick)}function ua({data:e,encoding:t}){let n=new Set,r=!1,i=e.map((e,i)=>{let a=t.x(e,i);i===0&&(r=a instanceof Date);let o=fa(a,i,r),s=String(t.key?t.key(e,i):r?new Date(o).toISOString():o);if(n.has(s))throw Error(`lineChart: two rows have the key "${s}". Keys must be unique.`);return n.add(s),{key:s,datum:e,index:i,x:o,values:t.series.map(({series:t,value:n})=>({series:t,value:ha(n(e,i),t,s)}))}});i.sort((e,t)=>e.x-t.x);for(let e=1;e<i.length;e++){let[t,n]=[i[e-1],i[e]];if(t.x===n.x){let e=r?new Date(t.x).toISOString():ca(t.x);throw Error(`lineChart: the rows "${t.key}" and "${n.key}" have the same x, ${e}. Each x is one point on every line, so x values must be unique.`)}}let a=pa(t,r,i.map(e=>e.x)),o=da(i,t.series.length);return{rows:i.map((e,t)=>({...e,label:a(e.x),missing:new Set(e.values.flatMap(e=>e.value===void 0?[e.series]:[])),levels:o[t]})),time:r}}function da(e,t){let n=e.map(()=>({}));for(let r=0;r<t;r++){let t=-1,i=-1;e.forEach((a,o)=>{let{series:s,value:c}=a.values[r];if(c!==void 0){n[o][s]=c,t=o;return}if(i<=o)for(i=o+1;i<e.length&&e[i].values[r].value===void 0;)i++;let l=e[t]?.values[r].value,u=e[i]?.values[r].value;n[o][s]=l!==void 0&&u!==void 0?l+(a.x-e[t].x)/(e[i].x-e[t].x)*(u-l):l??u??0})}return n}function fa(e,t,n){if(e instanceof Date){if(!n)throw TypeError(`lineChart: x must be all numbers or all Dates, but row 0's is a number and row ${t}'s a Date.`);let r=e.getTime();if(Number.isNaN(r))throw TypeError(`lineChart: x must be a valid Date, got an invalid Date in row ${t}.`);return r}if(n)throw TypeError(typeof e==`number`?`lineChart: x must be all numbers or all Dates, but row 0's is a Date and row ${t}'s a number.`:`lineChart: x must be a valid Date, got ${ya(e)} in row ${t}.`);if(typeof e!=`number`||!Number.isFinite(e))throw RangeError(`lineChart: x must be a finite number, got ${ya(e)} in row ${t}.`);return e}function pa(e,t,n){let{xFormat:r}=e;return r?e=>r(t?new Date(e):e):t?zi(n,e.timeZone):ca}function ma(e,t){return t?new Date(e):e}function ha(e,t,n){if(typeof e==`number`&&Number.isFinite(e))return e;if(e!=null)throw RangeError(`lineChart: "${t}" for "${n}" must be a finite number, or null or undefined where it has no value, got ${ya(e)}.`)}function ga(e,t){let n=new Map;for(let r of e)for(let{series:e,value:i}of r.values){if(i===void 0)continue;let r=t(e,i),a=r.replace(/\d/g,`0`);n.has(a)||n.set(a,r)}return[...n.values()]}function _a(e,t,n,r){return e.reduce((e,i)=>Math.max(e,r(i,t,n)),0)}function va(e){return typeof e==`function`?e:t=>t[e]}let ya=e=>typeof e==`string`?JSON.stringify(e):String(e);function ba(e,n,r){let i=sr(e,`lineChart`);fr(n,`lineChart`);let o=Ia(n),s=n,c=Dn(n.motion,r.motion),l=lt(n.on,r.presets),u=hn(n.colors),d=r.clock??a,f=i.ownerDocument;pn(f);let p=Y(`svg`,{class:`ec-chart ec-line-chart`,role:`group`},i),m=Y(`g`,{class:`ec-grid`,"aria-hidden":`true`},p),h=Y(`g`,{class:`ec-axis`,"aria-hidden":`true`},p),g=Y(`line`,{class:`ec-crosshair`,"aria-hidden":`true`,visibility:`hidden`},p),_=Y(`g`,{class:`ec-focus`,"aria-hidden":`true`,visibility:`hidden`},p),v=Y(`g`,{class:`ec-marks`,"aria-hidden":`true`},p),y=Y(`g`,{class:`ec-lines`},v),x=Y(`g`,{class:`ec-points`},v),w=Y(`g`,{class:`ec-columns`},p),T=Y(`g`,{class:`ec-overlay`,"aria-hidden":`true`},p),ee=kt(p),E=[],D=new Map,O=new Map,k=new WeakMap,A=[],j=new Map,M=new Map,N=er(e=>e.kind===`line`?e.presence.animating:e.row.presence.animating||e.row.values.animating||e.row.x.animating),P=Hn(`lineChart`),te=cr(i),ne=!1,F=1/0,I=new WeakSet,L,R,z,re;try{L=_e(s),R=Et(s,L),z=Pa(s,L),re=o===`point`?Fa(s,L):void 0}catch(e){throw p.remove(),e}let B=e=>M.get(e)??j.get(e)??N.get(e),ie=zn({overlay:T,mark:e=>({set:t=>{B(e)?.handle.set(t),J.restyled(e)},reset:()=>{B(e)?.handle.reset(),J.restyled(e)}}),colors:e=>B(e)?.parts[0]?.colors}),ae=_t({effects:l,motion:c,icons:r.icons,clock:d,surface:ie}),oe=Tr(p,{motion:c,option:()=>s.tooltip,description:()=>s.markDescription}),se=vn(p),ce=or(p),V=s.announce?xt(p):void 0,H=!1,le=()=>{H=!0},ue=C(L.frame.scale,S,{clock:d,motion:c,onChange:le}),de=C(L.frame.box,S,{clock:d,motion:c,onChange:le}),fe=C(_i(L.curve),b,{clock:d,motion:c,onChange:le}),U=new Map,W=new Map,pe=L.decimals,me={changed:[],added:[],removed:[]},he=L.frame,ge=pr({clock:d,runner:ae,leaving:N,draw:Ae,land:Me});function _e(e,t=l){let n=Ji(e);ur(t,n.series.map(e=>e.series),`lineChart`);let r=Yi({data:e.data,encoding:n,width:e.width??te,height:e.height,format:Un(e),measure:ee,label:ve(e,!0)}),i=new Set(r.series);for(let e of r.rows)for(let t of r.series){let n=$i(t,e.key);if(i.has(n))throw RangeError(`lineChart: two marks would have the key "${n}". Series and keys joined with "@" must be unique.`);i.add(n)}for(let e of r.rows)if(i.has(e.key))throw RangeError(`lineChart: the key "${e.key}" would name both an x and a line or point. A row's key can't be a series, or a series and a key joined with "@".`);return r}function ve(e,n=!1){let{labels:r}=e;if(r===!1)return;let i=Un(e);return(a,o)=>{let s=`${i(o)} ${Bn(e.seriesLabels,a)}`;if(typeof r!=`function`)return s;try{let e=r(o,a,i);return e==null?``:String(e)}catch(e){return!n&&!I.has(r)&&(I.add(r),t(e)),s}}}function ye(e){let t=ve(s);if(t)return{text:(n,r)=>t(n,qn(r,e[n]??Kn(r))),measure:ee}}function be(e){let t=e.rows.map(xa);return{lines:new Map(Zi(e.frame,t,e.series,Se(e),e.time,ye(e.decimals),_i(e.curve)).map(e=>[e.series,e])),points:new Map(t.flatMap(t=>ea(e.frame,t,e.series,e.time)).map(e=>[e.key,e]))}}function xe(e){let t=e.rows[0],n=e.rows[e.rows.length-1];return t&&n?Math.min(Math.max(F,t.x),n.x):F}function Se(e){let t=e.rows[e.rows.length-1];return t&&F<t.x?xe(e):1/0}let G=e=>!e.leaving&&e.row.x<=xe(L);function Ce(e,t){let n=Y(`g`,{class:`ec-column`,"data-key":e.key,role:`img`},w),r={clock:d,motion:c,onChange:le},i={key:e.key,row:e,column:n,hit:Y(`rect`,{class:`ec-hit`},n),x:C(e.x,b,r),values:C(e.levels,S,r),presence:C(+!t,b,r),anchor:void 0,points:[],leaving:!1,shown:!0,px:0};return k.set(n,i),i}function we(e,t,n){let r=Y(`g`,{class:`ec-line`,"data-key":e,"data-series":e},y),i=Y(`g`,{class:`ec-body`},r),a={kind:`line`,key:e,series:e,group:r,body:i,path:Y(`path`,{class:`ec-stroke`,"stroke-width":Wi},i),end:Y(`circle`,{class:`ec-end`,r:Gi},i),label:Y(`text`,{class:`ec-value ec-end-label`},r),drawnLabel:void 0,parts:[],handle:Mn(()=>a),target:t,shown:t,presence:C(+!n,b,{clock:d,motion:c,onChange:le}),leave:void 0};return a}function Te(e,t){let n=Y(`g`,{class:`ec-point`,"data-key":t.key,"data-series":t.series},x),r=Y(`g`,{class:`ec-body`},n),i={kind:`point`,key:t.key,series:t.series,row:e,group:n,body:r,path:Y(`path`,{class:`ec-dot`},r),parts:[],handle:Mn(()=>i),target:t,shown:t,hidden:void 0,leave:void 0};return i}let Ee=e=>B(e.key)===e,K=e=>e.points.filter(e=>M.get(e.key)===e),De=()=>[...N.values()].filter(e=>e.kind===`line`),Oe=()=>({scale:ue.value,box:de.value});function ke(){let e=e=>({x:e.x.value,values:e.values.value}),t=new Map,n=new Set,r=i=>{let a=t.get(i);if(a)return a;let o=i.presence.value,s=e(i);if(i.anchor&&o<1&&!n.has(i)){n.add(i);let e=r(i.anchor);n.delete(i),s={x:e.x+o*(s.x-e.x),values:S(e.values,s.values)(o)}}return t.set(i,s),s};return[...E,...[...O.values()].filter(e=>e.presence.value>0&&e.anchor)].map(e=>{let{x:t,values:n}=r(e),i=e.anchor&&e.presence.value<1?{presence:e.presence.value}:{};return{record:e,state:{key:e.key,datum:e.row.datum,x:t,values:n,missing:e.row.missing,...i}}}).sort((e,t)=>e.state.x-t.state.x)}function Ae(){if(!H)return;H=!1;let e=Oe(),t=ke();Ne(e),Pe(e,t.map(e=>e.state));for(let{record:n,state:r}of t){let t=new Map(ea(e,r,n.points.map(e=>e.series),L.time).map(e=>[e.key,e]));Ie(n.points.filter(Ee).flatMap(e=>t.has(e.key)?[{record:e,placed:t.get(e.key)}]:[]))}Ve(t.map(e=>e.state)),He(e,t),qe()}function je(){let e=Oe(),t=ke();Pe(e,t.map(e=>e.state)),He(e,t),qe()}function Me(){for(let e of O.values()){for(let t of[e.x,e.values,e.presence])t.stop();e.column.remove()}O.clear();for(let e of E)e.anchor=void 0,e.points=e.points.filter(Ee);for(let[e,t]of[[U,L.yTicks],[W,L.xTicks]]){for(let t of[...e.values()])t.wanted||(t.line?.remove(),t.label.remove(),e.delete(t.value));for(let n of t){let t=e.get(n.value);t&&(t.line&&`line`in n&&X(t.line,{...n.line,opacity:void 0}),Ot(t.label,n.label),t.label.removeAttribute(`opacity`))}}pe=L.decimals;let{frame:e}=L;X(p,Ct(e.box)),he=e;let t=be(L),n=(e,t)=>{let n=e.flatMap(e=>{let n=t(e);return n?[{record:e,to:n}]:[]});if(!n.every(({record:e,to:t})=>Ea(e.target.geometry,t.geometry)&&Da(e.target.data,t.data)))for(let{record:e,to:t}of n)e.target=t;Ie(n.map(({record:e})=>({record:e,placed:e.target})))};n(A,e=>t.lines.get(e.series)),Fe(new Map(A.flatMap(e=>t.lines.has(e.series)?[[e,t.lines.get(e.series)]]:[])));let r=E.map(e=>({record:e,state:xa(e.row)}));for(let{record:e}of r)n(K(e),e=>t.points.get(e.key));Ve(r.map(e=>e.state)),He(e,r),qe(),H=!1}function Ne(e){he=e,X(p,Ct(e.box));let t=Un(s);for(let n of U.values()){let r=aa(e,n.value,t(n.value)),i=n.opacity.value<1?n.opacity.value:void 0;X(n.line,{...r.line,opacity:i}),Ot(n.label,r.label),X(n.label,{opacity:i})}for(let t of W.values())Ot(t.label,oa(e,t.value,t.text).label),X(t.label,{opacity:t.opacity.value<1?t.opacity.value:void 0})}function Pe(e,t){let n=[...A,...De()];if(t.length===0||n.length===0)return;let r=Zi(e,t,n.map(e=>e.series),Se(L),L.time,ye(pe),fe.value);Ie(n.map((e,t)=>({record:e,placed:r[t]}))),Fe(new Map(n.map((e,t)=>[e,r[t]])))}function Fe(e){for(let[t,{label:n}]of e)n&&Ot(t.label,n),t.drawnLabel=n&&n.text!==``?n:void 0,X(t.label,{visibility:t.drawnLabel?void 0:`hidden`})}function Ie(e){let t=e.some(({record:e,placed:t})=>!Da(e.shown.data,t.data));for(let{record:n,placed:r}of e)n.kind===`line`?Le(n,r,t):Re(n,r,t)}function Le(e,t,n){let r=n||gr(e.shown.geometry,t.geometry);e.shown=t;let{geometry:i}=t;ze(e,on(u.slot(e.series)),{visible:i.length>=.5,open:{width:i.thickness}}),X(e.end,{cx:i.end.x,cy:i.end.y,visibility:t.data.samples.length===0?`hidden`:void 0});let a=e.presence.value;X(e.group,{opacity:a<1?a:void 0}),r&&ae.change(i,t.data)}function Re(e,t,n){let r=n||gr(e.shown.geometry,t.geometry);e.shown=t,ze(e,on(u.slot(e.series)),{visible:!0}),r&&ae.change(t.geometry,t.data)}function ze(e,t,n){let r=e.parts[0],{d:i}=e.shown.geometry.outline,a=r?.colors.color!==t.color;(a||r?.d!==i||r.visible!==n.visible||r.open?.width!==n.open?.width)&&(e.path.getAttribute(`d`)!==i&&e.path.setAttribute(`d`,i),a&&St(e.group,cn(t)),e.parts=[{element:e.path,d:i,colors:t,...n}],e.handle.repaint(),r&&a&&ie.recolor(e.key))}let Be=!1;function Ve(e){let t=Qi(e,L.series);if(t.size!==0||Be){for(let e of M.values())e.group.classList.toggle(`ec-alone`,t.has(e.key));Be=t.size>0}}function He(e,t){let{x:n}=Xi(e),r=t.filter(({record:e})=>G(e)),i=ta(e,r.map(({state:e})=>n(e.x)));r.forEach(({record:e,state:t},r)=>{X(e.hit,{...i[r]}),e.px=n(t.x)});let a=new Set(r.map(({record:e})=>e));for(let e of[...E,...O.values()]){let t=a.has(e);e.shown!==t&&(e.shown=t,X(e.column,{visibility:t?void 0:`hidden`,"aria-hidden":e.leaving?`true`:void 0}));let n=!G(e);for(let t of e.points)t.hidden!==n&&(t.hidden=n,X(t.group,{visibility:n?`hidden`:void 0}),ie.hide(t.key,n))}Ze&&pt(e)}function Ue(e){let t=M.get(e);if(t){if(!G(t.row))return;let{row:e}=t.row;oe.show(t.shown.geometry,dt(e,t.series),()=>Ma(e,t.series,s),t.handle.style.transform);return}let n=D.get(e);if(!n||!G(n))return;let r=K(n),i=r[0]?.shown.geometry.center.x??n.px;X(g,{...na(he,i),visibility:void 0});let a=r.map(e=>{let{transform:t}=e.handle.style,{center:n}=e.shown.geometry;return(t?q.apply(t,n):n).y}),{row:o}=n,c=a.length>0?{top:Math.min(...a)-Gi,bottom:Math.max(...a)+Gi}:{top:he.box.top,bottom:he.box.top};oe.showAt({x:i,...c},o,()=>ja(o,s))}function We(){g.setAttribute(`visibility`,`hidden`),oe.hide()}let Ge;function Ke(e){let t=e===void 0?void 0:M.get(e),n=e===void 0?void 0:t?.row??D.get(e),r=n!==void 0&&G(n),i=r?t?[t]:K(n):[];if(r&&i.length===0)Ge??(Ge=Y(`line`,{class:`ec-focus-ring`,"stroke-width":2},_)),(_.childElementCount>1||_.firstElementChild!==Ge)&&_.replaceChildren(Ge),X(Ge,na(he,n.px)),_.removeAttribute(`visibility`);else{for(Ge?.remove();_.childElementCount>i.length;)_.lastElementChild.remove();i.forEach((e,t)=>{let n=_.children[t];n||(n=Y(`g`,{},_),Y(`path`,{class:`ec-focus-ring`,"stroke-width":8},n),Y(`path`,{class:`ec-focus-gap`,"stroke-width":4},n));for(let t of Array.from(n.children))t.setAttribute(`d`,e.shown.geometry.outline.d);let{transform:r}=e.handle.style;X(n,{transform:r&&wt(r)})}),X(_,{visibility:i.length>0?void 0:`hidden`})}}function qe(){J.key!==void 0&&Ue(J.key),J.ringKey!==void 0&&Ke(J.ringKey)}let Je=e=>({mark:e.target.geometry,data:e.target.data}),Ye=e=>({mark:e.shown.geometry,data:e.shown.data});function Xe(e){let t=e,n=typeof t?.closest==`function`?t.closest(`.ec-column`):null,r=n?k.get(n):void 0;return r&&D.get(r.key)===r&&G(r)?r:void 0}let Ze,Qe,et=new Map,tt=[],nt=new WeakMap;function rt(){let e=new Map(L.series.map(e=>[e,[]]));for(let t of E)for(let n of K(t))e.get(n.series)?.push(n);return[...e.values()].flat()}let it=e=>E.filter(G).flatMap(t=>K(t).filter(t=>t.series===e));function at(e){let t,n=1/0,r=1/0;for(let i of E)if(G(i))for(let a of K(i)){let{x:i,y:o}=a.shown.geometry.center,s=(i-e.x)**2+(o-e.y)**2,c=L.series.indexOf(a.series);(s<n||s===n&&c<r)&&([t,n,r]=[a,s,c])}return t}function ot(e){let t=J.key===void 0||!oe.element()?void 0:M.get(J.key);if(!t||!G(t.row))return;let{transform:n}=t.handle.style,r=e;if(n)try{r=q.apply($e(n),e)}catch{return}let{center:i}=t.shown.geometry;return(r.x-i.x)**2+(r.y-i.y)**2<=4.5**2?t:void 0}function st(e,t){let n=ct(e,t);return ot(n)??at(n)}function ct(e,t){let n=p.getBoundingClientRect(),r=n.width>0&&he.box.width>0?n.width/he.box.width:1;return{x:(e-n.left)/r,y:(t-n.top)/r}}let ut=new WeakMap;function dt(e,t){let n=ut.get(e);n||ut.set(e,n=new Map);let r=n.get(t);return r||n.set(t,r={datum:e.datum,series:t}),r}function ft(){if(o!==`point`)return;Ze||(Ze=Y(`g`,{class:`ec-stops`},p),p.insertBefore(Ze,T),Qe=Y(`rect`,{class:`ec-hit`},Ze),Ze.addEventListener(`click`,e=>{let t=st(e.clientX,e.clientY);t&&et.get(t.key)?.element.focus()}));let e=rt(),t=new Set(e.map(e=>e.key));for(let[e,n]of et)t.has(e)||(n.element.remove(),et.delete(e));let n=e.map(e=>{let t=et.get(e.key);if(!t){let n=Y(`g`,{class:`ec-stop`,"data-key":e.key,role:`img`},Ze);t={element:n,bounds:Y(`circle`,{r:8.5,fill:`none`},n),x:NaN,y:NaN,hidden:void 0},et.set(e.key,t),nt.set(n,e.key)}let n=re?.get(e.key)??e.key;return t.element.getAttribute(`aria-label`)!==n&&t.element.setAttribute(`aria-label`,n),oe.describe(t.element,dt(e.row.row,e.series)),t.element});nr(Ze,tt,n,J.active),tt=n}function pt(e){let{left:t,right:n,top:r,bottom:i}=e.box;X(Qe,{x:t-Gi,y:r-Gi,width:n-t+2*Gi,height:i-r+2*Gi});for(let[e,t]of et){let n=M.get(e);if(!n)continue;let r=!G(n.row);t.hidden!==r&&(t.hidden=r,X(t.element,{visibility:r?`hidden`:void 0}));let{x:i,y:a}=n.shown.geometry.center;(t.x!==i||t.y!==a)&&(t.x=i,t.y=a,X(t.bounds,{cx:i,cy:a}))}}function mt(e){let t=M.get(e);if(t)return t.row.key;let n=E.filter(G),r=n.findIndex(t=>t.key===e);for(let e=0;r>=0&&e<n.length;e++)for(let t of[r+e,r-e]){let e=n[t]&&K(n[t])[0];if(e)return e.key}}function ht(e){e!==o&&(J.leave(),o=e,e===`point`?(ft(),pt(he)):w.removeAttribute(`display`),J.retarget(mt),e===`point`?w.setAttribute(`display`,`none`):(Ze?.remove(),Ze=Qe=void 0,et.clear(),tt=[]))}let gt=new Map;function vt(e,t){let n=t?o===`point`?B(e)?.series:void 0:gt.get(e);n!==void 0&&(t?gt.set(e,n):gt.delete(e),ie.hot(e,t),(t||![...gt.values()].includes(n))&&(B(n)?.group.classList.toggle(`ec-hot-line`,t),ie.hot(n,t)))}function yt(e){let t=o===`point`?M.get(e):void 0,n=o===`point`?t?.row:D.get(e);return n!==void 0&&G(n)}let J=Qn({svg:p,runner:ae,events:P,dim:()=>o===`point`&&s.dim!==!1&&J.key!==void 0,hot:vt,find(e,t){if(o===`x`){let t=Xe(e);return t&&{key:t.key}}let n=e;if(!Ze||typeof n?.closest!=`function`||!Ze.contains(n))return;if(t){let e=st(t.x,t.y);return e&&{key:e.key}}let r=n.closest(`.ec-stop`),i=r?nt.get(r):void 0;return i!==void 0&&yt(i)?{key:i}:void 0},moves:()=>o===`point`,live:yt,order:()=>(o===`point`?rt().filter(e=>G(e.row)):E.filter(G)).map(e=>e.key),page(e,t){let n=o===`point`?M.get(e):void 0,r=n?it(n.series).map(e=>({key:e.key,x:e.row.row.x})):E.filter(G).map(e=>({key:e.key,x:e.row.x})),i=r.findIndex(t=>t.key===e);if(i<0)return;if(!L.time)return n?r[Math.min(r.length-1,Math.max(0,i+t*Math.ceil(r.length/10)))].key:void 0;let a=Li(r[i].x,t,Ji(s).timeZone);if(t>0)return(r.find(e=>e.x>=a)??r[r.length-1])?.key;for(let e=r.length-1;e>=0;e--)if(r[e].x<=a)return r[e].key;return r[0]?.key},move(e,t){let n=o===`point`?M.get(e):void 0;if(!n)return;let r=t===`ArrowUp`||t===`ArrowDown`?K(n.row).sort((e,t)=>e.shown.geometry.center.y-t.shown.geometry.center.y):it(n.series),i=r.indexOf(n),a=t===`Home`?0:t===`End`?r.length-1:i+(t===`ArrowDown`||t===`ArrowRight`?1:-1);return r[Math.max(0,Math.min(r.length-1,a))]?.key},marks:e=>{let t=D.get(e);return t?K(t).map(e=>e.key):M.has(e)?[e]:[]},element:e=>(D.get(e)??O.get(e))?.column??et.get(e)?.element,markElement:e=>B(e)?.group,onScreen(e){let t=B(e);return t&&Ye(t)},ring:Ke,tooltip:{show:Ue,hide:We,element:()=>oe.element()}}),Tt=()=>se.update(L.series.map(e=>({series:e,label:Bn(s.seriesLabels,e)})),u,s.legend);function Et(e,t){return ir({option:e.table,caption:e.label,category:typeof e.x==`string`?e.x:void 0,series:t.series,label:t=>Bn(e.seriesLabels,t),rows:t.rows.map(e=>({key:e.key,category:e.label,datum:e.datum,index:e.index,values:Sa(e.values),missing:e.missing,total:wa(e.values)})),format:Un(e),total:!1})}function Dt(e){e.column.setAttribute(`aria-label`,z.get(e.key)),o===`x`&&oe.describe(e.column,e.row)}function At(e,n){let r=s.announce;if(!V||!r)return;let i=L.series,a=e=>e.row.label,{changed:o,added:c,removed:l}=me,u=bt({...s.label===e.label?{}:{label:s.label},...i.join(`
95
+ `)===n.join(`
96
+ `)?{}:{series:i.map(e=>Bn(s.seriesLabels,e))},changed:o.map(a),added:c.map(a),removed:l.map(a),count:E.length});if(typeof r!=`function`){V.say(u);return}let d=e=>e.key;try{let e=r({text:u,changed:o.map(d),added:c.map(d),removed:l.map(d)});e!=null&&V.say(String(e))}catch(e){t(e)}}function jt(e){L=e;let t=be(e),n={entering:[],exiting:[],changed:[]},r=new Set(e.rows.map(e=>e.key)),i=e.rows.length>0?e.series:[],a={changed:[],added:[],removed:[]},o=E,s=new Map(o.map(e=>[e,e.row])),c=new Map(e.rows.map(e=>[e.key,e])),l=A.filter(e=>!i.includes(e.series)),u=[];for(let e of o){let t=!r.has(e.key),n=c.get(e.key)?.missing;t&&(D.delete(e.key),e.leaving=!0,O.set(e.key,e),a.removed.push(e));for(let r of K(e))(t||!i.includes(r.series)||n?.has(r.series))&&u.push(r)}for(let e of l)j.delete(e.series);for(let e of u)M.delete(e.key);for(let e of[...l,...u])N.start(e);n.exiting.push(...l,...u);let d=new Set,f=a.removed.length>0;E=e.rows.map(e=>{let t=D.get(e.key);return t?(d.add(t),t.row.x!==e.x&&(f=!0),e.values.some((e,n)=>t.row.values[n]?.series!==e.series||t.row.values[n]?.value!==e.value)&&a.changed.push(t)):(t=O.get(e.key)??Ce(e,!0),O.delete(e.key),t.leaving=!1,t.x.set(e.x),t.values.set(e.levels),D.set(e.key,t),a.added.push(t),f=!0),t.row=e,t}),E.forEach((e,t)=>{d.has(e)?e.presence.value===1&&(e.anchor=void 0):e.anchor=Ta(E,t,d)});for(let e of a.removed)e.anchor??(e.anchor=Ta(o,o.indexOf(e),d));let p=A;A=i.map(e=>{let r=j.get(e),i=t.lines.get(e);if(r){let t=[...d].some(t=>Ca(s.get(t),e)!==Ca(t.row,e));(f||t)&&n.changed.push({record:r,from:r.shown.geometry})}else r=Mt(e,`line`)??we(e,i,!0),j.set(e,r),n.entering.push(r);return r.target=i,r});for(let e of E){let r=d.has(e)?s.get(e):void 0,a=i.filter(t=>!e.row.missing.has(t)).map(i=>{let a=$i(i,e.key),o=t.points.get(a),s=M.get(a);return s?r&&Ca(r,i)!==Ca(e.row,i)&&n.changed.push({record:s,from:s.shown.geometry}):(s=Mt(a,`point`)??Te(e,o),s.row=e,M.set(a,s),n.entering.push(s)),s.target=o,s}),o=new Set(a);e.points=[...a,...e.points.filter(e=>!o.has(e)&&Ee(e))]}for(let e of E)Dt(e);return ft(),nr(w,o.filter(e=>!e.leaving).map(e=>e.column),E.map(e=>e.column),J.active),nr(y,p.map(e=>e.group),A.map(e=>e.group),()=>null),me=a,H=!0,Ae(),n}function Mt(e,t){return N.get(e)?.kind===t?N.recall(e):void 0}function Nt(e,t){H=!0;let{frame:n}=e;for(let[t,n,r]of[[U,e.yTicks,!0],[W,e.xTicks,!1]]){let e=new Set(n.map(e=>e.value));for(let n of e)t.has(n)||Pt(t,n,0,r);for(let n of t.values())n.wanted=e.has(n.value)}for(let t of e.xTicks)W.get(t.value).text=t.label.text;let r=De(),i=[...O.values()],a=Q(ue,n.scale,hr)||[...U.values()].some(e=>Q(e.opacity,+!!e.wanted,$))||E.some(e=>Q(e.values,e.row.levels,hr))||A.some(e=>Q(e.presence,1,$))||r.some(e=>Q(e.presence,0,$))||Q(fe,_i(e.curve),$),o=Q(de,n.box,hr)||[...W.values()].some(e=>Q(e.opacity,+!!e.wanted,$))||E.some(e=>Q(e.x,e.row.x,$)||e.anchor!==void 0&&Q(e.presence,1,$))||i.some(e=>e.anchor!==void 0&&Q(e.presence,0,$)),s,l;!t&&c.staged?(s={duration:500},l={duration:500,delay:a?500:0}):t||(s=l={duration:(a&&o?2:1)*500});let u=[],d=(e,t,n,r)=>{Q(e,t,n)&&(r?u.push(e.to(t,r)):e.set(t))};d(ue,n.scale,hr,s),d(fe,_i(e.curve),$,s),d(de,n.box,hr,l);for(let e of U.values())d(e.opacity,+!!e.wanted,$,s);for(let e of W.values())d(e.opacity,+!!e.wanted,$,l);for(let e of E)d(e.values,e.row.levels,hr,s),d(e.x,e.row.x,$,l),d(e.presence,1,$,e.anchor?l:void 0);for(let e of i)d(e.presence,0,$,e.anchor?l:void 0);for(let e of A)d(e.presence,1,$,s);for(let e of r)d(e.presence,0,$,s);return u}function Pt(e,t,n,r,i=``){let a={value:t,line:r?Y(`line`,{class:t===0?`ec-baseline`:`ec-gridline`},m):void 0,label:Y(`text`,{class:`ec-tick`},h),text:i,opacity:C(n,b,{clock:d,motion:c,onChange:le}),wanted:!0};e.set(t,a);for(let t of[...e.values()].sort((e,t)=>e.value-t.value))t.line&&m.appendChild(t.line),h.appendChild(t.label)}function Ft(e,t){return L=e,pe=Object.fromEntries(e.series.map(t=>[t,Math.max(pe[t]??0,e.decimals[t]??0)])),ge.run(Nt(e,t))}let It=xr(p,c);function Lt(){if(ne)return;let e=_e(s),t=new Map(e.rows.map(e=>[e.key,e]));for(let e of E)e.row=t.get(e.key)??e.row;let n=be(e);for(let e of A)e.target=n.lines.get(e.series)??e.target;for(let e of M.values())e.target=n.points.get(e.key)??e.target;Ft(e,!0)}let Rt=yr(i,d,te,e=>{te=e,s.width===void 0&&Lt()}),zt=br(f,()=>{ee.clear(),Lt()});lr(p,s),Tt(),ce.render(R);{let e=be(L);for(let e of L.yTicks)Pt(U,e.value,1,!0);for(let e of L.xTicks)Pt(W,e.value,1,!1,e.label.text);E=L.rows.map(t=>{let n=Ce(t,!1);return D.set(t.key,n),n.points=L.series.filter(e=>!t.missing.has(e)).map(r=>{let i=Te(n,e.points.get($i(r,t.key)));return M.set(i.key,i),i}),Dt(n),n}),A=L.rows.length>0?L.series.map(t=>we(t,e.lines.get(t),!1)):[];for(let e of A)j.set(e.series,e);ft(),o===`point`&&w.setAttribute(`display`,`none`),Me()}let Bt=()=>[...A,...E.flatMap(K)];return J.sync(),ae.enter(Bt().map(Je)),Cn(J.link,{element:p,async update(e){if(ne)return;if(e.motion!==void 0&&e.motion!==s.motion)throw TypeError("lineChart: `motion` can't be changed by update() yet.");let t={...s,...e};fr(t,`lineChart`);let n=Ia(t),i=`on`in e?dr(l,s.on,t.on,r.presets):l,a=_e(t,i),o=Et(t,a),d=Pa(t,a),f=n===`point`?Fa(t,a):void 0;`colors`in e&&(u=hn(t.colors));let m=s,h=L.series;s=t,z=d,re=f,lr(p,s),ce.render(o);let g=V!==void 0;s.announce&&!V?V=xt(p):!s.announce&&V&&(V.destroy(),V=void 0),ht(n),J.syncDim(),ge.supersede();let _=i!==l;l=i;let v=mr({runner:ae,events:P,hover:J,leaving:N,input:Je,onScreen:Ye,data:`data`in e,..._?{swap:e=>{let t=new Set(e.entering);ae.swap(i,Bt().filter(e=>!t.has(e)).map(Je))}}:{}},()=>jt(a),()=>{g&&At(m,h)});Tt();let y=Ft(a,c.mode===`off`);await ge.wait(y,v)},reveal(e){if(ne)return;if(e instanceof Date&&Number.isNaN(e.getTime()))throw RangeError(`lineChart: reveal(x) needs a valid Date, got an invalid Date.`);let t=e instanceof Date?e.getTime():e;if(typeof t!=`number`||Number.isNaN(t))throw RangeError(`lineChart: reveal(x) needs a number, got ${typeof t==`string`?JSON.stringify(t):String(t)}.`);let n=xe(L);F=t,xe(L)!==n&&(je(),J.dropGone(),J.sync())},on:P.on,marks:()=>[...A.map(e=>e.shown.geometry),...E.filter(G).flatMap(e=>K(e).map(e=>e.shown.geometry))],focus(e){if(ne)return;let t=D.get(e);if(o===`x`){let n=t??M.get(e)?.row;n&&J.focus(n.key);return}let n=M.get(e)??(t&&K(t)[0]);n&&J.focus(n.key)},leave(){ne||J.leave()},labels:()=>A.flatMap(e=>$n(e.key,`value`,e.drawnLabel,e.label)),destroy(){if(!ne){ne=!0,ge.destroy(),J.destroy(),ae.destroy(),oe.destroy(),se.destroy(),ce.destroy(),V?.destroy(),It(),Rt(),zt();for(let e of[...E,...O.values()])for(let t of[e.x,e.values,e.presence])t.stop();for(let e of[...A,...De()])e.presence.stop();for(let e of N.values())e.leave?.resolve();ue.stop(),de.stop(),fe.stop();for(let e of[...U.values(),...W.values()])e.opacity.stop();P.clear(),D.clear(),O.clear(),j.clear(),M.clear(),N.clear(),E=[],A=[],p.remove()}}})}function xa(e){return{key:e.key,datum:e.datum,x:e.x,values:e.levels,missing:e.missing}}function Sa(e){return e.flatMap(e=>e.value===void 0?[]:[{series:e.series,value:e.value}])}function Ca(e,t){return e.values.find(e=>e.series===t)?.value}function wa(e){return e.reduce((e,t)=>e+(t.value??0),0)}function Ta(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 Ea(e,t){return e.key===t.key&&!gr(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 Da(e,t){return e.datum!==t.datum||e.samples.length!==t.samples.length?!1:e.samples.every((e,n)=>{let r=t.samples[n];return e.t===r.t&&e.value===r.value&&Oa(e.at,r.at)&&e.gapBefore===r.gapBefore})}function Oa(e,t){return e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function ka(e,t){return Sa(e).map(e=>({series:e.series,label:Bn(t.seriesLabels,e.series),value:e.value}))}function Aa(e,t){let n=Un(t);return e.map(e=>{let r=Bn(t.seriesLabels,e.series);return e.value===void 0?`${r} missing`:`${n(e.value)} ${r}`})}function ja(e,t){return e.missing.size===0?wr(e.label,ka(e.values,t),Un(t),{total:!1}):{title:e.label,lines:[Aa(e.values,t).join(` · `)]}}function Ma(e,t,n){return wr(e.label,ka(e.values,n).filter(e=>e.series===t),Un(n),{total:!1})}function Na(e,n,r){if(!e.markLabel)return r.text;try{let t=e.markLabel(n,r);if(t!=null&&String(t).trim()!==``)return String(t)}catch(e){t(e)}return r.text}function Pa(e,t){let n=Un(e);return new Map(t.rows.map(t=>{let r=`${t.label}: ${Aa(t.values,e).join(`, `)}`;return[t.key,Na(e,t.datum,{key:t.key,category:t.label,values:ka(t.values,e),total:wa(t.values),format:n,text:r})]}))}function Fa(e,t){let n=Un(e);return new Map(t.rows.flatMap(t=>ka(t.values,e).map(r=>{let i=$i(r.series,t.key),a=`${t.label}: ${n(r.value)} ${r.label}`;return[i,Na(e,t.datum,{key:i,category:t.label,values:[r],total:r.value,format:n,text:a})]})))}function Ia(e){let{hover:t=`x`}=e;if(t!==`x`&&t!==`point`)throw TypeError(`lineChart: hover must be "x" or "point", got ${typeof t==`string`?JSON.stringify(t):String(t)}.`);return t}let La=.5;function Ra(e){let t=za(e.start,e.pivot);return t>La&&Math.abs(za(e.center,e.pivot)-t)<=La&&Math.abs(za(e.end,e.pivot)-t)<=La}let za=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y),Ba=.5,Va=[`left`,`right`,`top`,`bottom`];function Ha(e){return typeof e==`string`&&Va.includes(e)}function Ua(e,t){if(t!==`auto`)return e.map(()=>t);if(e.length===0)return[];let n=qa(e,e=>e.x,e=>e.x+e.width,`left`,`right`),r=qa(e,e=>e.y+e.height,e=>e.y,`bottom`,`top`);if(n&&r)return Ja(e)?n:r;let i=n??r;if(!i)throw RangeError(`expressive: baseline "auto" found no edge that every mark grows from. Pass baseline: "left", "right", "top" or "bottom".`);return i}function Wa(e,t,n){let r=Ka(t.map(e=>e.box)),i=Ya(r,n),a=t.map((e,t)=>({index:t,...i(e.box)})).sort((e,t)=>e.near-t.near||e.far-t.far||e.index-t.index),o=0,s=1/0,c=a.map(({index:e,near:n,far:r})=>{o>0&&r>n&&(s=Math.min(s,n-o));let i=Math.max(0,r-o);return o=Math.max(o,r),{series:t[e].series,size:i}}),l=t[a[a.length-1].index],u=t.length===1?t[0].series:void 0;return{geometry:he({key:e,...u===void 0?{}:{series:u},...r,baseline:n,radius:l.radius,gap:Number.isFinite(s)?Math.max(0,Xa(s)):0,...c.every(e=>e.series!==void 0)?{segments:c.map(e=>({series:e.series,size:Xa(e.size)}))}:{}}),order:a.map(e=>e.index)}}function Ga(e,t){let n=t[0]===`left`||t[0]===`right`,r=e=>n?e.y:e.x,i=e=>n?e.x:e.y;return e.map((e,t)=>t).sort((t,n)=>r(e[t])-r(e[n])||i(e[t])-i(e[n])||t-n)}function Ka(e){let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,width:Xa(Math.max(...e.map(e=>e.x+e.width))-t),height:Xa(Math.max(...e.map(e=>e.y+e.height))-n)}}function qa(e,t,n,r,i){let a=e[0];if(!a)return[];for(let o of[t(a),n(a)]){let a=[];for(let s of e)if(Math.abs(t(s)-o)<Ba)a.push(r);else if(Math.abs(n(s)-o)<Ba)a.push(i);else break;if(a.length===e.length)return a}}function Ja(e){let t=e=>Math.max(...e)-Math.min(...e),n=t(e.map(e=>e.y+e.height/2)),r=t(e.map(e=>e.x+e.width/2));return n===r?e[0].width>=e[0].height:n>r}function Ya(e,t){switch(t){case`left`:return t=>({near:t.x-e.x,far:t.x+t.width-e.x});case`right`:return t=>({near:e.x+e.width-(t.x+t.width),far:e.x+e.width-t.x});case`top`:return t=>({near:t.y-e.y,far:t.y+t.height-e.y});case`bottom`:return t=>({near:e.y+e.height-(t.y+t.height),far:e.y+e.height-t.y})}}function Xa(e){return Math.round(e*1e3)/1e3}function Za(){let e=new Map,t=t=>{let n=e.get(t);return n||(n={attributes:new Map,styles:new Map,classes:new Set,before:{}},e.set(t,n)),n},n=e=>e.style,r=(e,t,n)=>{n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)},i=(e,t)=>{let i=t.before.style;t.styles.size>0||!i||(t.before.style=void 0,n(e)?.cssText===i.css&&r(e,`style`,i.text))},a=(e,t)=>{let n=t.before.class;if(t.classes.size>0||n===void 0)return;t.before.class=void 0;let i=e=>[...new Set((e??``).split(/\s+/).filter(Boolean))].sort().join(` `);i(e.getAttribute(`class`))===i(n)&&r(e,`class`,n)};function o(e,n,i){let a=e.getAttribute(n),o=t(e).attributes,s=o.get(n);s?(a!==s.written&&(s.original=a),s.written=i):o.set(n,{original:a,written:i}),r(e,n,i)}function s(t,n,i){if(i!==null){o(t,n,i);return}let a=e.get(t)?.attributes,s=a?.get(n);a&&s&&(t.getAttribute(n)===s.written&&r(t,n,s.original),a.delete(n))}function c(e,r,a){let o=n(e);if(!o)return;let s=t(e),c=s.styles.get(r);if(a===void 0){if(!c)return;c.value===``?o.removeProperty(r):o.setProperty(r,c.value,c.priority),s.styles.delete(r),i(e,s)}else c||(s.styles.size===0&&(s.before.style={text:e.getAttribute(`style`),css:o.cssText}),s.styles.set(r,{value:o.getPropertyValue(r),priority:o.getPropertyPriority(r)})),o.getPropertyValue(r)!==a&&o.setProperty(r,a)}function l(n,r,i){let o=n.classList;if(i){if(o.contains(r))return;let e=t(n);e.classes.size===0&&(e.before.class=n.getAttribute(`class`)),e.classes.add(r),o.add(r);return}let s=e.get(n);s?.classes.delete(r)&&(o.remove(r),a(n,s))}function u(t){let n=e.get(t);if(n){for(let e of[...n.styles.keys()])c(t,e,void 0);for(let e of[...n.classes])l(t,e,!1);for(let e of[...n.attributes.keys()])s(t,e,null);e.delete(t)}}return{attribute:s,remove:(e,t)=>o(e,t,null),style:c,styled:(t,n)=>e.get(t)?.styles.has(n)??!1,toggleClass:l,restore:u,restoreAll(){for(let t of[...e.keys()])u(t)},elements:()=>[...e.keys()]}}function Qa(){let e=new Map;return t=>(e.has(t)||e.set(t,so(t)),e.get(t))}function $a(e,t,n,r=so){let i=r(e),a=i&&r(t);return i&&a?q.multiply($e(i),a):q.multiply($e(co(e,n)),co(t,n))}function eo(e){return et(e.getAttribute(`transform`)??``)}function to(e){let[t,n,r,i]=e,a=1e-9*Math.max(Math.abs(t),Math.abs(n),Math.abs(r),Math.abs(i));return Math.abs(n)<=a&&Math.abs(r)<=a||Math.abs(t)<=a&&Math.abs(i)<=a}function no(e){let[t,n,r,i]=e,a=t*t+n*n,o=r*r+i*i,s=1e-4*Math.max(a,o);return Math.abs(a-o)<=s&&Math.abs(t*r+n*i)<=s}function ro(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))}function io(e,t){let n=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x,y:t.y+t.height},{x:t.x+t.width,y:t.y+t.height}].map(t=>q.apply(e,t)),r=n.map(e=>e.x),i=n.map(e=>e.y),a=lo(Math.min(...r)),o=lo(Math.min(...i));return{x:a,y:o,width:lo(lo(Math.max(...r))-a),height:lo(lo(Math.max(...i))-o)}}function ao(e){let t=oo(e),n=e=>{let n=Number.parseFloat(t(e)??``);return Number.isFinite(n)?n:0};return{x:n(`x`),y:n(`y`),width:Math.max(0,n(`width`)),height:Math.max(0,n(`height`))}}function oo(e){return t=>{let n=e[t];return typeof n?.baseVal?.value==`number`?String(n.baseVal.value):e.getAttribute(t)}}function so(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 co(e,t){let n=[1,0,0,1,0,0];for(let r=e;r&&r!==t;r=r.parentElement)n=q.multiply(eo(r),n);return n}function lo(e){return Math.round(e*1e3)/1e3}function uo(e,t,n){let r={},i=!1,a=jn(),o=()=>{let{transform:n,opacity:a,emphasis:o}=r;for(let r of e()){let{element:e,colors:s}=r,c=n&&r.parentInverse?q.multiply(r.parentInverse,n,r.parent,eo(e)):void 0;t.style(e,`transform`,c&&So(c)),t.style(e,`transform-origin`,c&&`0 0`),t.style(e,`transform-box`,c&&`view-box`),t.style(e,`opacity`,a===void 0?void 0:String(a));let l=s?o===void 0?i?s.strong:void 0:xo(s,o):void 0;t.style(e,`fill`,s?.paint===`fill`?l:void 0),t.style(e,`stroke`,s?.paint===`stroke`?l:void 0),t.style(e,`transition`,o===void 0||!s?void 0:`none`)}s()},s=()=>{let t=e().flatMap(e=>e.outline===void 0?[]:[{...e.outline,color:e.colors?.color}]);a.paint(n(),t,r.halo,r.transform)};return{get style(){return r},set(e){r=ft(r,e),o()},reset(){r={},o()},repaint:o,hot(e){e!==i&&(i=e,o())}}}function fo(e,t){let n=_o(e,t,`fill`),r=n===mo?`stroke`:`fill`,i=r===`fill`?n:_o(e,t,`stroke`);if(i!==void 0&&i!==mo)return{color:i,strong:`color-mix(in oklab, ${i}, ${sn(`text`)} ${po})`,paint:r}}let po=`25%`,mo=`none`,ho=new WeakMap;function go(e){let t=ho.get(e);if(t!==void 0)return t;let n=e.ownerDocument.defaultView;if(!e.isConnected||typeof n?.getComputedStyle!=`function`)return!1;let r=e.ownerDocument.createElementNS(`http://www.w3.org/2000/svg`,`g`);r.setAttribute(`stroke-miterlimit`,`7`),e.appendChild(r);let i=n.getComputedStyle(r).getPropertyValue(`stroke-miterlimit`).trim()===`7`;return r.remove(),ho.set(e,i),i}function _o(e,t,n){let r=e.ownerDocument.defaultView?.getComputedStyle?.(e).getPropertyValue(n),i=bo(r);if(r&&go(t))return i;let a;for(let r=e;r&&a===void 0;r=r===t?null:r.parentElement){let e=r.style?.getPropertyValue(n)||r.getAttribute(n);e&&(a=e)}let o=n===`fill`?i?.replace(/\s/g,``)===`rgb(0,0,0)`:i===mo;return i!==void 0&&!(o&&a!==void 0)?i:bo(a)}function vo(e,t){let n=e.ownerDocument.defaultView?.getComputedStyle?.(e).getPropertyValue(`stroke-width`),r=yo(n);if(n&&go(t)||r!==void 0&&r!==1)return r;for(let n=e;n&&!n.style?.getPropertyValue(`stroke-width`);n=n===t?null:n.parentElement){let e=yo(n.getAttribute(`stroke-width`));if(e!==void 0)return e}return r}function yo(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)\s*(?:px\s*)?$/i.exec(e??``),n=t?Number(t[1]):NaN;return n>=0&&Number.isFinite(n)?n:void 0}function bo(e){let t=e?.trim().toLowerCase();if(t&&t!==`inherit`&&!t.startsWith(`url(`))return t===mo||t===`transparent`||/^rgba\((?:[^,]+,){3}\s*0(?:\.0*)?\s*\)$/.test(t)?mo:e.trim()}function xo(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 So(e){return`matrix(${e.map((e,t)=>t<4?Math.round(e*1e6)/1e6:Math.round(e*1e3)/1e3).join(`, `)})`}function Co(e){if(typeof e==`string`){if(typeof document>`u`)throw TypeError(`expressive: a selector needs a document.`);return{elements:Array.from(document.querySelectorAll(e)),data:void 0}}if(Do(e))return{elements:[e],data:void 0};if(Oo(e)){let t=Array.from(e.nodes()),n=Array.from(e.data());return{elements:t,data:n.length===t.length?n:void 0}}if(typeof e==`object`&&e&&typeof e.length==`number`)return{elements:Array.from(e),data:void 0};throw TypeError(`expressive needs marks: a selector, an element, a list of elements or a D3 selection.`)}function wo(e){if(!Oo(e))return;let{elements:t,data:n}=Co(e);return n&&new Map(t.map((e,t)=>[e,n[t]]))}function To(e){let t;for(let n of e){if(!Do(n))throw TypeError(`expressive: marks must be elements, got ${String(n)}.`);let e=n.ownerSVGElement??null;if(!e){let e=n.localName;throw TypeError(e===`svg`?`expressive: got an <svg>, not its marks. Pass the marks, for example svg.querySelectorAll("rect").`:`expressive: marks must be SVG elements inside an <svg>, got <${e}>.`)}for(;e.ownerSVGElement;)e=e.ownerSVGElement;if(t&&e!==t)throw TypeError(`expressive: all marks must be in the same <svg>.`);t=e}if(!t)throw TypeError(`expressive: no marks.`);return t}function Eo(e,t){let n=e[0].parentElement??t;for(;n!==t&&!e.every(e=>e!==n&&n.contains(e));)n=n.parentElement??t;return n}function Do(e){return typeof e==`object`&&!!e&&e.nodeType===1}function Oo(e){return typeof e==`object`&&!!e&&typeof e.nodes==`function`&&typeof e.data==`function`}let ko=[`d`,`x`,`y`,`width`,`height`,`cx`,`cy`,`r`,`rx`,`ry`,`x1`,`y1`,`x2`,`y2`,`points`,`transform`],Ao=[`transform`,`style`];function jo(e,t,n){let r=e.defaultView?.MutationObserver??(typeof MutationObserver>`u`?void 0:MutationObserver);if(!r)throw TypeError(`expressive: watch needs MutationObserver, which this DOM doesn't have.`);let i=new Set,a=new Set,o=new Set,s=new Set,c,l=e=>{for(let{target:t,attributeName:n}of e){let e=t;o.has(e)&&i.add(e),s.has(e)&&(n===`transform`||n===`style`)&&a.add(e)}},u=new r(e=>{l(e),(i.size>0||a.size>0)&&!c&&(c=t.onFrame(d))});function d(){if(l(u.takeRecords()),i.size===0&&a.size===0){c?.(),c=void 0;return}let e={marks:i,ancestors:a};i=new Set,a=new Set,n(e)}function f(){u.takeRecords(),c?.(),c=void 0,i=new Set,a=new Set}return{observe(e,t){f(),u.disconnect(),o=new Set(e),s=new Set;for(let n of e)for(let e=n.parentElement;e&&!s.has(e);e=e===t?null:e.parentElement)s.add(e);for(let e of s)o.has(e)||u.observe(e,{attributes:!0,attributeFilter:Ao});for(let e of o)u.observe(e,{attributes:!0,attributeFilter:ko})},destroy(){f(),u.disconnect(),o=new Set,s=new Set}}}let Mo=new Set([`circle`,`ellipse`,`line`,`path`,`polygon`,`polyline`]),No=new Set([`img`,`image`,`graphics-symbol`,`graphics-object`]);function Po(e,n,r){Fo(n);let i=Dn(n.motion,r.motion),o=lt(n.on,r.presets),s=n.on,c=r.clock??a,l=n.dim===!0,u=Za(),d=new WeakMap,f=e,p=!1,m=!1;function h(e){let{elements:t,data:r}=Co(e);if(t.length===0)return{root:void 0,ancestor:void 0,marks:[]};let i=To(t),a=Eo(t,i),s=new Map;t.forEach((e,t)=>{let i=w(e,t,r),a=n.key(i,e);if(a==null||a===``)throw TypeError(`expressive: key returned ${JSON.stringify(a)??String(a)} for a <${e.localName}>. Every mark needs a key.`);let o=String(a),c=e.localName;if(!n.geometry&&c!==`rect`&&!Mo.has(c))throw TypeError(`expressive: can't read the geometry of a <${c}> (mark "${o}"). <rect>, <circle>, <ellipse>, <line>, <path>, <polygon> and <polyline> are read; describe others with the geometry option.`);let l=T(i,e,o),u=s.get(o);if(!u)s.set(o,u=[]);else if(!n.geometry&&(Mo.has(c)||Mo.has(u[0].element.localName))){let e=Mo.has(c)?c:u[0].element.localName;throw TypeError(`expressive: two elements have the key "${o}", and one is a <${e}>. A circle or a shape is a mark of its own: give each its own key.`)}else if(l===void 0)throw RangeError(`expressive: two elements have the key "${o}". Keys must be unique, or name each part with segment.`);else if(u.some(e=>e.series===l))throw RangeError(`expressive: the mark "${o}" has two "${l}" segments.`);u.push({element:e,datum:i,series:l,value:n.value?.(i,e)})});let c={svg:i,common:a,screen:Qa(),colors:e=>E(e,i),strokeWidth:e=>vo(e,i)},l=e=>({...e,label:ee(e.key,e.parts)}),u=[...s.keys()];if(n.geometry)return{root:i,ancestor:a,marks:C(S(Vo(u.map((e,t)=>l(g(e,s.get(e),t,c))),e=>e.geometry)),o)};let d=[],f=[];u.forEach((e,t)=>{let n=s.get(e);if(n[0].element.localName===`rect`)d.push(t);else{let r=y(e,n[0],t,c);r&&f.push(r)}});let p=d.map(e=>s.get(u[e]).map(t=>_(u[e],t,c))),m=p.map(e=>Ka(e.map(e=>e.rect.box))),h=Ua(m,n.baseline??`auto`),b=e=>v(u[d[e]],p[e],h[e],d[e],c);return{root:i,ancestor:a,marks:C(S(f.length===0?Ga(m,h).map(e=>l(b(e))):Vo([...d.map((e,t)=>b(t)),...f].sort((e,t)=>e.index-t.index),e=>e.geometry).map(e=>l(e))),o)}}function g(e,t,r,i){let a=t[0],o=n.geometry(a.element,a.datum,e);if(typeof o!=`object`||!o||o.key!==e)throw TypeError(`expressive: geometry for "${e}" must be a MarkGeometry with the key "${e}". Build it with describe and the key passed in.`);return{key:e,geometry:o,parts:t.map(e=>x(e,Uo(o,e.series,t.length),i)),index:r}}function _(e,t,n){let r=b(t.element,n);if(!to(r))throw TypeError(`expressive: the <rect> of "${e}" is rotated or skewed, so it isn't an upright bar. Describe it with the geometry option.`);return{...t,rect:{box:io(r,ao(t.element)),series:t.series,radius:Wo(t.element)}}}function v(e,t,n,r,i){let{geometry:a,order:o}=Wa(e,t.map(e=>e.rect),n),s=a.segments??[];return{key:e,geometry:a,parts:o.map((e,n)=>{let r=s[n];return x(t[e],r&&r.length>=.5?{d:r.outline.d}:void 0,i)}),index:r,rect:{edge:n,box:Ka(t.map(e=>e.rect.box))}}}function y(e,t,n,r){let{element:i,series:a}=t,o=i.localName,s=b(i,r),c=oo(i),l=e=>{let t=Number.parseFloat(c(e)??``);return Number.isFinite(t)?t:0},u=o===`circle`?l(`r`):0,d,f;if(o===`circle`&&(no(s)||!(u>0))){let t=q.apply(s,{x:l(`cx`),y:l(`cy`)});d=xe({key:e,series:a,x:Go(t.x),y:Go(t.y),r:Go(Math.max(0,u)*ro(s))})}else{let t=Pe(o,c);if(t[0]?.op!==`M`||t.every(e=>e.op===`M`))return;f=o===`circle`?void 0:r.strokeWidth(i);let n=Go((f??1)*ro(s));d=Be({key:e,series:a,d:o===`path`?c(`d`)??``:ze(t),matrix:s,width:n>0?n:1})}let p=[{...x(t,Uo(d,a,1),r),strokeWidth:f}];return{key:e,geometry:d,parts:p,index:n,...o===`circle`?{circle:!0}:{}}}function b(e,t){return q.multiply($a(t.common,e.parentElement??t.svg,t.svg,t.screen),eo(e))}function x(e,t,n){let r=$a(n.common,e.element.parentElement??n.svg,n.svg,n.screen);return{element:e.element,datum:e.datum,series:e.series,value:e.value,parent:r,parentInverse:Ko(r),colors:n.colors(e.element),outline:t}}function S(e){return e.map(e=>{let{key:t,geometry:r,parts:i}=e,a=e.rect?Lo(i):void 0,o=i[0].value,s=e.circle&&typeof o==`number`&&Number.isFinite(o)?o:void 0,c=(e,i,o)=>n.samples?zo(n.samples(e,i),o===void 0?`"${t}"`:`"${t}" (${o})`):a===void 0?s===void 0?[]:[{t:0,value:s}]:Ro(r,i,a),l=new Map,u=e=>l.get(e)??je(e,t);for(let t of Io(e)){let e=(i.find(e=>e.series===t)??i[0]).datum;l.set(t,{datum:e,samples:c(e,r.segments?.find(e=>e.series===t)??r,t),related:u})}return{...e,data:{datum:i[0].datum,samples:c(i[0].datum,r),related:u}}})}function C(e,t){if(e.length===0)return e;let n=new Set(e.flatMap(e=>[...e.geometry.series===void 0?[]:[e.geometry.series],...Io(e)]));for(let e of ct){let r=t[e];if(r?.kind===`data`)for(let t of r.needs?.related??[]){if(n.has(t))continue;let r=n.size>0?`the marks' series are ${[...n].map(e=>`"${e}"`).join(`, `)}`:`the marks have no series`;throw RangeError(`expressive: on.${e} needs the series "${t}", but ${r}. Name each mark's series in its geometry (describe.line({ key, series, … })), or a stack's parts with segment.`)}}return e}function w(e,t,r){if(n.datum)return n.datum(e);if(r)return r[t];let i=e.__data__;return typeof i==`number`&&!p&&(p=!0,console.warn(`expressive: element.__data__ is a number, which looks like Observable Plot's row index. Pass datum: (el) => rows[el.__data__].`)),i}function T(e,t,r){if(!n.segment)return;let i=n.segment(e,t);if(i==null||i===``)throw TypeError(`expressive: segment returned ${String(i)} for a part of "${r}".`);return String(i)}function ee(e,r){if(n.markLabel)try{let t=String(n.markLabel(r[0].datum,{key:e,parts:r.map(({series:e,datum:t})=>({series:e,datum:t}))})??``);return t.trim()===``?void 0:t}catch(e){t(e);return}}function E(e,t){if((u.styled(e,`fill`)||u.styled(e,`stroke`))&&d.has(e))return d.get(e);let n=fo(e,t);return d.set(e,n),n}let D=h(f),O=D.root?.ownerDocument??(typeof document>`u`?void 0:document);if(!O)throw TypeError(`expressive needs a DOM.`);pn(O);let k,A,j=new Map,M=[],N=new Map,P=new Map,te=new Set,ne={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set},F,I,L,R,z=!1,re=(e,t,n)=>{let r=O.createElementNS(`http://www.w3.org/2000/svg`,e);return X(r,t),n?.appendChild(r),r},B=re(`g`,{class:`ec-overlay`,"aria-hidden":`true`});St(B,{"pointer-events":`none`});let ie=re(`g`,{class:`ec-halos`},B),ae=re(`g`,{class:`ec-runs`},B),oe=An(B),se=e=>j.get(e)??N.get(e),ce=zn({overlay:ae,mark:e=>({set:t=>se(e)?.handle.set(t),reset:()=>se(e)?.handle.reset()}),colors:e=>se(e)?.mark.parts[0]?.colors}),V=_t({effects:o,motion:i,icons:r.icons,clock:c,surface:ce}),H=e=>({mark:e.mark.geometry,data:e.mark.data});function le(e){let t={key:e.key,mark:e,handle:uo(()=>t.mark.parts.filter(e=>(P.get(e.element)?.record??t)===t),u,()=>ie)};return t}function ue(e){e.root&&e.root!==k&&W(e.root),A=e.ancestor??A;let t=new Set(e.marks.map(e=>e.key)),r={entering:[],exiting:[],changed:[],moved:[],newRow:!1},i=[];for(let e of M)t.has(e.key)||(j.delete(e.key),N.set(e.key,e),r.exiting.push(e));let a=P;P=new Map,M=e.marks.map(e=>{let t=j.get(e.key);if(t){let a=t.mark,o=n.value?Jo(a.parts,e.parts):Yo(a.geometry,e.geometry),s=a.data.datum!==e.data.datum;s&&(r.newRow=!0),o?r.changed.push({record:t,from:a.geometry}):(s||Zo(a.geometry,e.geometry)||Xo(a.data.samples,e.data.samples))&&r.moved.push(t),a.parts[0]?.colors?.color!==e.parts[0]?.colors?.color&&i.push(e.key),t.mark=e}else t=N.get(e.key),t?(N.delete(e.key),t.mark=e):t=le(e),j.set(e.key,t),r.entering.push(t);for(let n of e.parts)P.set(n.element,{record:t,part:n});return t});for(let[e,t]of a)P.get(e)?.record!==t.record&&u.restore(e);for(let e of M)de(e);fe(),U(),ye();for(let e of M)e.handle.repaint();for(let e of i)ce.recolor(e);return Ce(),r}function de(e){if(!n.markLabel)return;let{label:t,parts:r}=e.mark;r.forEach((e,n)=>{let r=t!==void 0&&n===0;u.attribute(e.element,`role`,r?`img`:null),u.attribute(e.element,`aria-label`,r?t:null),r?u.remove(e.element,`aria-hidden`):u.attribute(e.element,`aria-hidden`,t===void 0?null:`true`)})}function fe(){let e=k,t=new Set;for(let r of n.markLabel&&e?M:[])if(r.mark.label!==void 0)for(let n of r.mark.parts)for(let r=n.element.parentElement;r&&r!==e&&e?.contains(r);r=r.parentElement){if(t.has(r)||r.hasAttribute(`aria-label`)||r.hasAttribute(`aria-labelledby`))continue;let e=r.getAttribute(`role`)?.trim().split(/\s+/)[0];(e!==void 0&&No.has(e)||e===void 0&&te.has(r))&&t.add(r)}for(let e of te)t.has(e)||(u.attribute(e,`role`,null),u.attribute(e,`aria-roledescription`,null));for(let e of t)u.remove(e,`role`),u.remove(e,`aria-roledescription`);te=t}function U(){if(!k||!A)return;k.lastElementChild!==B&&k.appendChild(B),B.removeAttribute(`transform`);let e=$a(B,A,k);qo(e)||B.setAttribute(`transform`,wt(e))}function W(e){pe(),k=e,k.appendChild(B),(n.keyboard===!0||n.markLabel)&&k.getAttribute(`role`)===`img`&&!m&&(m=!0,console.warn(`expressive: the <svg> is role="img", so screen readers read it as one picture and skip the marks inside, with their names and keyboard focus. Make it role="group"; its aria-label can stay.`)),L=Yn(k,{find(e){let t=me(e);if(!t)return;let{key:n}=t.record;return t.part.series===void 0?{key:n}:{key:n,segment:t.part.series}},hover(e,t){let n=j.get(e.key);!n||yn(F)&&F.keys[0]===e.key||(ge(),he([n],t,e.segment))},leave(){(F?.source===`pointer`||F?.source===`touch`)&&ge()}})}function pe(){k&&(ge(),L?.destroy(),L=void 0)}function me(e){for(let t=e;t&&t!==k;t=t.parentElement){let e=P.get(t);if(e)return e}}function he(e,t,n,r=!0){let i={keys:e.map(e=>e.key),source:t,effects:r};F=i,ye(),r&&V.hover(e.map(H)),e.forEach((r,i)=>Me(`hover`,{...H(r),batch:{index:i,count:e.length},source:t,...n===void 0?{}:{segment:n}})),t!==`linked`&&F===i&&R?.hover(e.map(H))}function ge(){let e=F;e&&(F=void 0,ye(),_e(e.keys),yn(e)&&R?.leave())}function _e(e){let t=e.flatMap(e=>se(e)??[]);V.leave(e),t.forEach((e,n)=>Me(`leave`,{...H(e),batch:{index:n,count:t.length}}))}function ve(){if(F===void 0)return;let e=F.keys.filter(e=>j.has(e));if(e.length===F.keys.length)return;if(e.length===0){L?.clear(),ge();return}let t=F.keys.filter(e=>!j.has(e));F={...F,keys:e},_e(t)}function ye(){if(!l)return;let e=`${i.duration(100,`feedback`)}ms`;B.classList.toggle(`ec-hovering`,F!==void 0),St(B,{"--ec-hover-duration":e});for(let t of M){let n=F?.keys.includes(t.key)===!0;for(let r of t.mark.parts)u.toggleClass(r.element,`ec-attached`,!0),u.toggleClass(r.element,`ec-dimmed`,F!==void 0&&!n),u.style(r.element,`--ec-hover-duration`,e);t.handle.hot(n),ce.hot(t.key,n)}for(let e of N.values())e.handle.hot(!1),ce.hot(e.key,!1)}let be=l?i.subscribe(ye):void 0,Se=e=>new Set(ct.flatMap(t=>{let n=e[t];return n?.kind===`data`?n.needs?.related??[]:[]})),G=Se(o);function Ce(){let e=I===void 0?void 0:j.get(I);oe.draw(e?.mark.geometry)}let we=n.keyboard===!0?Xn(()=>k,{find:e=>me(e)?.record.key,order:()=>M.map(e=>e.key),element:e=>j.get(e)?.mark.parts[0]?.element,tabIndex(e,t){let n=j.get(e);n&&t!==void 0&&n.mark.parts.forEach((e,n)=>{u.attribute(e.element,`tabindex`,n===0?t:`-1`),u.style(e.element,`outline`,`none`)})},focus(e,t){I=t?e:void 0,Ce();let n=j.get(e);n&&(t?yn(F)&&F.keys[0]===e?F={...F,source:`keyboard`}:(ge(),he([n],`keyboard`)):F?.source===`keyboard`&&F.keys[0]!==e&&ge())},blur(){I=void 0,Ce(),F?.source===`keyboard`&&(L?.current===F.keys[0]?F={...F,source:`pointer`}:ge())},escape(){return F?(F.source===`linked`&&R?R.dismiss():ge(),!0):!1}}):void 0,Te=n.watch===!0?jo(O,c,K):void 0;function Ee(){Te?.observe(M.flatMap(e=>e.mark.parts.map(e=>e.element)),k)}function K(e){if(z||!A)return;let t=new Set;for(let n of e.marks){let e=P.get(n)?.record;e&&t.add(e)}let n=!1;for(let r of e.ancestors)if(r.contains(A))n=!0;else for(let e of M)e.mark.parts.some(e=>r.contains(e.element))&&t.add(e);if(n&&U(),t.size===0)return;let{records:r,marks:i}=De([...t]);r.forEach((e,t)=>{let n=i[t];e.mark=n;for(let t of n.parts)P.set(t.element,{record:e,part:t});e.handle.repaint()}),M=Ae(M),r.some(e=>e.key===I)&&Ce();let a=new Set(r);if(r.some(e=>G.has(e.mark.geometry.series??``)))for(let e of M)a.add(e);for(let e of a)V.change(e.mark.geometry,e.mark.data)}function De(e){let t={svg:k,common:A,screen:Qa(),colors:e=>P.get(e)?.part.colors,strokeWidth:e=>P.get(e)?.part.strokeWidth},r=ke(),i=({parts:e})=>e.map(e=>({element:e.element,datum:r(e.element),series:e.series,value:e.value}));if(n.geometry){let n=e.map(({mark:e})=>({...g(e.key,i(e),e.index,t),label:e.label}));return{records:[...e],marks:S(n)}}let a=new Map(e.flatMap(e=>e.mark.rect?[[e,i(e.mark).map(n=>_(e.key,n,t))]]:[])),o=Oe(a);for(let e of M)e.mark.rect&&!a.has(e)&&o.get(e)!==e.mark.rect.edge&&a.set(e,i(e.mark).map(n=>_(e.key,n,t)));let s=[...a.keys()],c=s.map(e=>({...v(e.key,a.get(e),o.get(e),e.mark.index,t),label:e.mark.label}));for(let n of e){if(n.mark.rect)continue;let e=y(n.key,i(n.mark)[0],n.mark.index,t);e&&(s.push(n),c.push({...e,label:n.mark.label}))}return{records:s,marks:S(c)}}function Oe(e){let t=M.filter(e=>e.mark.rect),r=new Map(t.map(e=>[e,e.mark.rect.edge]));if(n.baseline!==void 0&&n.baseline!==`auto`)return r;let i=t.map(t=>{let n=e.get(t);return n?Ka(n.map(e=>e.rect.box)):t.mark.rect.box});try{let e=Ua(i,`auto`);return new Map(t.map((t,n)=>[t,e[n]]))}catch{return r}}function ke(){if(n.datum)return n.datum;let e=wo(f);return t=>e?.has(t)?e.get(t):w(t,0,void 0)}function Ae(e){let t=[...e].sort((e,t)=>e.mark.index-t.mark.index);return n.geometry||!t.every(e=>e.mark.rect)?[...Vo(t,e=>e.mark.geometry)]:Ga(t.map(e=>e.mark.rect.box),t.map(e=>e.mark.rect.edge)).map(e=>t[e])}function je(e,t){return M.find(n=>n.key!==t&&n.mark.geometry.series===e)?.mark.data}function Me(e,n){for(let r of[...ne[e]])try{r(n)}catch(e){t(e)}}function Ne(e,t){t.forEach((n,r)=>Me(e,{...H(n),batch:{index:r,count:t.length}}))}V.enter(ue(D).entering.map(H)),we?.sync(),Ee();let Fe={targets:()=>M.map(e=>({key:e.key,marks:[H(e)]})),hover(e,t){ge();let n=e.flatMap(e=>j.get(e)??[]);n.length>0&&he(n,`linked`,void 0,t)},unlink(){F?.source===`linked`&&ge()},leave(){L?.clear(),ge()},listen(e){return!z&&(R=e,!0)}};return Cn(Fe,{refresh(e){if(z)return;let t=h(e??f);e!==void 0&&(f=e),V.interrupt();let n=ue(t);Ee(),ve();let r=V.exit(n.exiting.map(H));Ne(`exit`,n.exiting),(n.newRow||n.changed.length>0||n.entering.length>0||n.exiting.length>0)&&V.update(n.changed.map(({record:e,from:t})=>({...H(e),from:t}))),n.changed.forEach(({record:e,from:t},r)=>Me(`update`,{...H(e),from:t,batch:{index:r,count:n.changed.length}})),V.enter(n.entering.map(H)),Ne(`enter`,n.entering);let i=new Set([...n.changed.map(e=>e.record),...n.moved]);if([...i,...n.entering,...n.exiting].some(e=>G.has(e.mark.geometry.series??``))){let e=new Set(n.entering);for(let t of M)e.has(t)||i.add(t)}for(let e of i)V.change(e.mark.geometry,e.mark.data);V.settle(),we?.sync(),r.then(()=>{for(let e of n.exiting)N.get(e.key)===e&&N.delete(e.key)})},async update(e){if(z)return;if(typeof e!=`object`||!e)throw TypeError(`expressive: update() needs options, such as { on: { hover: "lift" } }.`);let t=Object.keys(e).find(e=>e!==`on`);if(t!==void 0)throw TypeError(`expressive: \`${t}\` can't be changed by update() yet. Only \`on\` can.`);if(!(`on`in e))return;let n=dr(o,s,e.on,r.presets);C(M.map(e=>e.mark),n),s=e.on,o=n,G=Se(n),V.swap(n,M.map(H))},on(e,t){let n=ne[e];if(!n)throw TypeError(`expressive: unknown event "${String(e)}". Use one of: ${Object.keys(ne).join(`, `)}.`);return n.add(t),()=>{n.delete(t)}},marks:()=>M.map(e=>e.mark.geometry),focus(e){j.has(e)&&!z&&we?.focus(e)},leave(){z||Fe.leave()},destroy(){if(!z){z=!0,F=void 0,R?.gone(),R=void 0,Te?.destroy(),V.destroy(),be?.(),we?.destroy(),pe(),B.remove(),u.restoreAll();for(let e of Object.values(ne))e.clear();j.clear(),N.clear(),M=[],P=new Map}}})}function Fo(e){if(typeof e!=`object`||!e)throw TypeError(`expressive needs options, with at least a key: { key: (d) => d.name }.`);if(typeof e.key!=`function`)throw TypeError(`expressive needs a key function, for example key: (d) => d.name. Marks are matched by key.`);for(let t of[`datum`,`segment`,`value`,`geometry`,`markLabel`])if(e[t]!==void 0&&typeof e[t]!=`function`)throw TypeError(`expressive: ${t} must be a function.`);if(e.baseline!==void 0&&e.baseline!==`auto`&&!Ha(e.baseline))throw RangeError(`expressive: baseline must be "left", "right", "top", "bottom" or "auto", got ${String(e.baseline)}.`)}function Io(e){let t=[...(e.geometry.segments??[]).map(e=>e.series),...e.parts.map(e=>e.series)];return[...new Set(t.filter(e=>e!==void 0))]}function Lo(e){let t=0;for(let{value:n}of e){if(typeof n!=`number`||!Number.isFinite(n))return;t+=n}return t}function Ro(e,t,n){let r=t=>e.length>0?n*t/e.length:0;if(t===e)return[{t:0,value:0},{t:1,value:n}];let i=Ho(e.start,t.start);return[{t:0,value:r(i)},{t:1,value:r(i+t.length)}]}function zo(e,t){if(!Array.isArray(e))throw TypeError(`expressive: samples for ${t} must return an array of { t, value }, got ${Bo(e)}.`);let n=0;return e.map((e,r)=>{let{t:i,value:a,at:o,gapBefore:s}=typeof e==`object`&&e?e:{};if(typeof i!=`number`||!(i>=0&&i<=1))throw RangeError(`expressive: samples for ${t}: samples[${r}].t must be in [0, 1], got ${Bo(i)}.`);if(i<n)throw RangeError(`expressive: samples for ${t} must be in t order: samples[${r}].t is ${i}, after ${n}.`);if(typeof a!=`number`||!Number.isFinite(a))throw RangeError(`expressive: samples for ${t}: samples[${r}].value must be a finite number, got ${Bo(a)}.`);if(s!==void 0&&typeof s!=`boolean`)throw RangeError(`expressive: samples for ${t}: samples[${r}].gapBefore must be true or false, got ${Bo(s)}.`);return n=i,{t:i,value:a,...o===void 0?{}:{at:o},...s?{gapBefore:s}:{}}})}function Bo(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Vo(e,t){let n=e[0]&&t(e[0]).pivot;if(!n||!e.every(e=>Ho(t(e).pivot,n)<=.5&&Ra(t(e))))return e;let r=2*Math.PI,i=e=>{let{center:i}=t(e),a=Math.atan2(i.x-n.x,n.y-i.y),o=a<0?a+r:a;return o>=r?0:o};return e.map(e=>({mark:e,angle:i(e)})).sort((e,t)=>e.angle-t.angle).map(({mark:e})=>e)}function Ho(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Uo(e,t,n){let r=t===void 0?void 0:e.segments?.find(e=>e.series===t),i=r??(n===1?e:void 0);if(!(!i||r&&r.length<.5))return i.outline.closed?{d:i.outline.d}:{d:i.outline.d,stroke:i.thickness}}function Wo(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 Go(e){return Math.round(e*1e3)/1e3}function Ko(e){try{return $e(e)}catch{return}}function qo(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 Jo(e,t){if(e.length!==t.length)return!0;let n=new Map(e.map(e=>[e.series,e.value]));return t.some(e=>{let t=n.get(e.series);return!n.has(e.series)||!(t===e.value||Object.is(t,e.value))})}function Yo(e,t){let n=e.segments??[],r=t.segments??[];return Math.abs(e.length-t.length)>.01||n.length!==r.length||n.some((e,t)=>e.key!==r[t].key||Math.abs(e.length-r[t].length)>.01)}function Xo(e,t){let n=(e,t)=>e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime();return e.length!==t.length||e.some((e,r)=>e.t!==t[r].t||e.value!==t[r].value||!n(e.at,t[r].at))}function Zo(e,t){if(e.outline.d!==t.outline.d||e.thickness!==t.thickness||_r(e,t))return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((e,t)=>e.key!==r[t].key||e.outline.d!==r[t].outline.d)}let Qo=[`line`,`rect`,`arc`,`symbol`],$o=[`d`,`transform`,`x`,`y`,`width`,`height`,`stroke-width`];function es(e,n,r){if(ts(e),typeof n!=`object`||!n||typeof n.key!=`function`)throw TypeError(`fromVegaView needs options with a key: { key: (d) => d.series }. Marks are matched by key.`);let i=n.mark??`marks`;if(typeof i!=`string`||i===``)throw TypeError(`fromVegaView: mark must be a mark's name, got ${String(i)}.`);if(n.sample!==void 0&&typeof n.sample!=`function`)throw TypeError(`fromVegaView: sample must be a function.`);let o=_(),{mark:s,sample:c,...l}=n,u=Po(o.elements,{...l,datum:e=>g(e).datum,geometry:(e,t,n)=>{let r=o.geometry.get(n);if(!r)throw TypeError(`fromVegaView: no geometry for "${n}". Its key must be the same for every item of a mark.`);return r},...n.samples||!n.sample?{}:{samples:(e,t)=>o.samples.get(t)??[]},...n.value||!n.sample?{}:{value:(e,t)=>o.values.get(t)}},r),d=r.clock??a,f,p,m=!1,h=typeof MutationObserver==`function`?new MutationObserver(e=>e.some(S)&&C()):void 0;w(o.root);function g(e){let t=o.items.get(e);if(!t)throw TypeError(`fromVegaView: an element that isn't one of the View's items.`);return t}function _(){let t=rs(ns(e),i),r=is(t,i,e),a=e.container(),o=a?.localName===`svg`?a:a?.querySelector(`svg`),s={root:o??void 0,elements:[],items:new Map,geometry:new Map,samples:new Map,values:new Map};if(!r||!o)return s;let c=new Set(r===`line`?t.flatMap(e=>e.items?.[0]&&ss(e.items[0])?[e.items[0]]:[]):t.flatMap(e=>e.items??[])),l=new Map;for(let e of Array.from(o.querySelectorAll(`*`))){let t=e.__data__;c.has(t)&&l.set(e,t)}let u=[...l.keys()];if(u.length===0)return s;let d=To(u),f=Eo(u,d),p=Qa(),m=e=>$a(f,e.parentElement??d,d,p),h=e=>String(n.key(l.get(e).datum,e)),g=e=>n.segment?String(n.segment(l.get(e).datum,e)):void 0,_={root:d,items:l,elements:u,geometry:new Map,samples:new Map,values:new Map};if(n.sample)for(let[e,t]of l){let n=r===`line`?os(t):[t];_.values.set(e,n.map(e=>e.defined===!1?``:y(e).value).join(`,`))}if(r===`rect`)return v(_,m,h,g);for(let e of u){let t=l.get(e),i=h(e);if(_.geometry.has(i))continue;let a=m(e),o=r===`line`?us(i,e,t,a):r===`arc`?ds(i,t,a):fs(i,t,a);_.geometry.set(i,o),n.sample&&_.samples.set(o,r===`line`?b(o,t,a):x(o,t,r))}return _}function v(e,t,r,i){let a=new Map;for(let n of e.elements){let o=e.items.get(n),s=r(n),c={box:io(t(n),ps(o)),series:i(n),radius:Math.max(0,o.cornerRadius??0)},l=a.get(s);l?l.push({element:n,part:c}):a.set(s,[{element:n,part:c}])}let o=[...a.keys()],s=o.map(e=>Ka(a.get(e).map(e=>e.part.box))),c=Ua(s,n.baseline??`auto`),l=[];for(let t of Ga(s,c)){let r=o[t],i=a.get(r),{geometry:s,order:u}=Wa(r,i.map(e=>e.part),c[t]);if(e.geometry.set(r,s),l.push(...u.map(e=>i[e].element)),n.sample){let t=u.map(t=>y(e.items.get(i[t].element)).value),n=t.reduce((e,t)=>e+t,0);e.samples.set(s,[{t:0,value:0},{t:1,value:n}]);let r=0;(s.segments??[]).forEach((n,i)=>{let a=r;r+=t[i]??0,e.samples.set(n,[{t:0,value:a},{t:1,value:r}])})}}return{...e,elements:l}}function y(e){let t=n.sample(e.datum),r=typeof t==`number`?{value:t}:t;if(typeof r!=`object`||!r||!Number.isFinite(r.value))throw RangeError(`fromVegaView: sample must give a finite number, or { value, at }, got ${JSON.stringify(t)}.`);return r.at===void 0?{value:r.value}:{value:r.value,at:r.at}}function b(e,t,n){return rt(e,ls(t).map(({item:e,point:t})=>({...q.apply(n,t),...y(e)})))}function x(e,t,n){let{value:r,at:i}=y(t),a=i===void 0?{t:1,value:r}:{t:1,value:r,at:i};return n===`symbol`?[{...a,t:0}]:e.length>0?[{t:0,value:0},a]:[{...a,t:0}]}function S(e){let t=f?.querySelector(`:scope > .ec-overlay`),n=e=>e===t||(t?.contains(e)??!1);return n(e.target)?!1:e.type!==`childList`||[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].some(e=>!n(e))}function C(){if(p||m)return;let e=d.onFrame(()=>{e(),p=void 0;try{T()}catch(e){t(e)}});p=e}function w(e){h&&e!==f&&(h.disconnect(),f=e,e&&h.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:$o}))}function T(){if(m)return;let e=_(),t=o;o=e;try{u.refresh(e.elements)}catch(e){throw o=t,e}w(e.root)}return Cn(wn(u),{refresh:T,update:u.update,on:u.on,marks:u.marks,focus:u.focus,leave:u.leave,destroy(){m||(m=!0,h?.disconnect(),p?.(),p=void 0,u.destroy())}})}function ts(e){if(typeof e!=`object`||!e||typeof e.renderer!=`function`||typeof e.scenegraph!=`function`||typeof e.container!=`function`)throw TypeError(`fromVegaView needs a Vega View: new vega.View(runtime, { renderer: "svg", container }), or vega-embed's result.view.`);let t=e.renderer();if(t!==`svg`)throw TypeError(`fromVegaView: the View renders with "${t}", which draws no SVG elements to attach to. Use renderer: "svg" (vega-embed's default; a bare vega.View uses canvas).`)}function ns(e){let t=e.scenegraph();return t.root??t}function rs(e,t){let n=[],r=e=>{if(e.name===t&&e.marktype!==`group`&&n.push(e),e.marktype===`group`)for(let t of e.items??[])for(let e of t.items??[])r(e)};return r(e),n}function is(e,t,n){if(e.length===0){let e=as(ns(n));if(e.length===0)return;throw RangeError(`fromVegaView: the View has no mark named "${t}". Its named marks: ${e.map(e=>`"${e}"`).join(`, `)}.`)}let r=e[0].marktype;if(!e.every(e=>e.marktype===r)||!Qo.includes(r))throw TypeError(`fromVegaView: "${t}" is a ${String(r)} mark. Rects, arcs, symbols and lines can be read; describe others with expressive()'s geometry option.`);return r}function as(e){let t=new Set,n=e=>{e.name&&e.marktype!==`group`&&t.add(e.name);for(let t of e.items??[])for(let e of t.items??[])n(e)};return n(e),[...t]}let os=e=>e.mark?.items??[e],ss=e=>os(e).some(e=>e.defined!==!1),cs=e=>{let t=os(e)[0]?.interpolate;return t===void 0||t===`linear`};function ls(e){let t=os(e),n=[],r=!1;for(let e of t)e.defined===!1?r=n.length>0:(n.push({item:e,point:{x:hs(e.x),y:hs(e.y)},gapBefore:r}),r=!1);return n}function us(e,t,n,r){let i=n.strokeWidth??Number.parseFloat(t.getAttribute(`stroke-width`)??`1`);if(!cs(n)){let n=i*ms(r);return Be({key:e,series:e,d:t.getAttribute(`d`)??``,matrix:r,width:n>0&&Number.isFinite(n)?n:1})}let a=ls(n),o=a.flatMap((e,t)=>e.gapBefore?[t]:[]);return _e({key:e,series:e,points:a.map(({point:e})=>q.apply(r,e)),...o.length>0?{breaks:o}:{},width:(Number.isFinite(i)?i:1)*ms(r)})}function ds(e,t,n){let r=q.apply(n,{x:hs(t.x),y:hs(t.y)}),i=ms(n),[a,o]=[hs(t.startAngle),hs(t.endAngle)].sort((e,t)=>e-t);return pe({key:e,cx:r.x,cy:r.y,inner:hs(t.innerRadius)*i,outer:hs(t.outerRadius)*i,start:a,end:o})}function fs(e,t,n){let r=q.apply(n,{x:hs(t.x),y:hs(t.y)});return xe({key:e,x:r.x,y:r.y,r:Math.sqrt(Math.max(0,t.size??64)/Math.PI)*ms(n)})}function ps(e){let t=hs(e.x),n=hs(e.y),r=hs(e.width),i=hs(e.height);return{x:Math.min(t,t+r),y:Math.min(n,n+i),width:Math.abs(r),height:Math.abs(i)}}function ms(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))}function hs(e){return typeof e==`number`&&Number.isFinite(e)?e:0}let gs={get:()=>void 0},_s={set(){},reset(){}},vs={place(){},update(){},remove(){}};function ys(e,n){let{effect:r,surface:i}=n;if(!bs(r))throw TypeError(`playTransition needs a transition effect (kind "transition" with run, end and clear), got ${xs(r)}.`);let o=n.start??0;if(!(typeof o==`number`&&o>=0&&o<=1))throw RangeError(`playTransition: start must be a number from 0 to 1, got ${String(o)}.`);let s=n.motion??v,c=n.clock??a,l=n.icons??gs,u=e.length,d=[],f=!1,p=u,m,h=new Promise(e=>{m=e}),g=u>0?s.subscribe(()=>{s.mode===`off`&&w()}):void 0,_=()=>{--p>0||(g?.(),g=void 0,m())};function y(e,t,n){let i=pt({clock:c,motion:s,icons:l,batch:{index:t,count:u},layer:T(e.to.key,t,()=>a.state!==`cleared`),mark:_s}),a={pair:e,index:t,scope:i,context:{...i.context,start:o},state:`running`,done:n};d[t]=a;let{from:f,to:p}=e;try{s.mode===`off`?(r.end(f,p,a.context),b(a)):Promise.resolve(r.run(f,p,a.context)).then(()=>b(a),e=>x(a,e))}catch(e){x(a,e)}}function b(e){e.state===`running`&&(e.state=`ended`,S(e))}function x(e,n){let{signal:r}=e.context;(!r.aborted||n!==r.reason&&n?.name!==`AbortError`)&&(t(n),C(e))}function S(e){let t=e.done;e.done=void 0,t?.()}function C(e){if(e.state!==`cleared`){e.state=`cleared`,e.scope.abort();try{r.clear(e.context)}catch(e){t(e)}e.scope.clear(),S(e)}}function w(){for(let e of[...d]){if(e.state!==`running`)continue;let t=e.done;e.done=void 0,C(e),y(e.pair,e.index,t)}}function T(e,t,n){let r,a=()=>n()?r??(r=i.group(e,t)):void 0;return{icon:(e,t)=>a()?.icon(e,t)??vs,path:(e,t)=>a()?.path(e,t)??vs,text:(e,t)=>a()?.text(e,t)??vs,clear(){let e=r;r=void 0,e?.clear()}}}return e.forEach((e,t)=>y(e,t,_)),u===0&&m(),{finished:h,clear(){if(!f){f=!0;for(let e of[...d])C(e)}}}}function bs(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.kind===`transition`&&typeof t.run==`function`&&typeof t.end==`function`&&typeof t.clear==`function`}function xs(e){if(typeof e!=`object`||!e)return e===null?`null`:typeof e;let t=e.kind;return t===`geometry`||t===`data`?`a ${t} effect, which plays on one mark: put it in a chart's \`on\` option`:t===`transition`?`a transition effect without run(), end() and clear()`:t===void 0?`an object with no kind`:`an effect of kind ${JSON.stringify(t)}`}let Ss=.5;function Cs(e,t,n){let r=sr(e,`chartSwitch`),i=Rs(t),o=t.transition,s=hn(t.colors),c=n.motion,l=n.clock??a,u=r.ownerDocument;pn(u);let d=u.createElement(`div`);d.className=`ec-switch`,r.appendChild(d);let f=new Map;try{for(let e of i){let n=u.createElement(`div`);n.className=`ec-switch-view`,n.setAttribute(`data-view`,e),d.appendChild(n),Es(n,e===t.initial);let r=t.views[e](n,s);if(!Ls(r,n))throw r?.destroy?.(),TypeError(`chartSwitch: views.${e} must return the chart it draws in the container it's given (with element, marks(), labels(), focus(), leave() and destroy()), such as donutChart(container, { ... }).`);f.set(e,{name:e,container:n,chart:r,port:wn(r)})}}catch(e){for(let e of f.values())e.chart.destroy();throw d.remove(),e}let p=Y(`svg`,{class:`ec-chart ec-switch-overlay`,"aria-hidden":`true`},d),m=Y(`g`,{class:`ec-switch-fades`},p),h=Y(`g`,{class:`ec-switch-runs`},p),g=Y(`g`,{class:`ec-switch-labels`},p),_=t.announce?xt(p):void 0,v=new WeakMap,y={group(e,t){let n=Y(`g`,{class:`ec-run`,"data-key":e},h);St(n,cn(on(s.slot(e)))),v.set(n,t);let r=Array.from(h.children).find(e=>(v.get(e)??-1/0)>t);return h.insertBefore(n,r??null),{...Fn(n),clear:()=>n.remove()}}},b=t.initial,x,S=!1,C,w,T=!1,ee,E=c.subscribe(()=>{c.mode===`off`&&x&&L(x,!0)}),D,O=typeof ResizeObserver==`function`?new ResizeObserver(e=>{let t=e[e.length-1]?.contentRect.width??0;if(D!==void 0&&Math.abs(t-D)<.5)return;let n=D===void 0;D=t,!n&&x&&L(x,!0)}):void 0;O?.observe(d);let k=e=>f.get(e);function A(){return d.getRootNode().activeElement??null}function j(e){let t=A();if(!t||!e.container.contains(t))return;let n=t.closest(`[data-key]`);return{key:n&&e.chart.element.contains(n)?n.getAttribute(`data-key`)??void 0:void 0}}function M(e,t){if(!t)return;let n=A();if(n&&n!==u.body&&n!==u.documentElement&&!d.contains(n))return;let r=()=>e.chart.element.contains(A());if(t.key!==void 0&&e.chart.focus(t.key),!r()){for(let t of e.chart.marks())if(e.chart.focus(t.key),r())return}}function N(e){_?.say(e.chart.element.getAttribute(`aria-label`)??``)}function P(){T&&C?.shown()}function te(e,t,n){let r=n?n.focus:j(e),i=[];ee=i;try{e.chart.leave()}finally{ee=void 0}let a=S?Promise.resolve():ne(e,t,r);for(let e of i)e();return a}function ne(e,t,n){if(b=t.name,c.mode===`off`){for(let e of f.values())Es(e.container,e===t);return M(t,n),N(t),P(),Promise.resolve()}for(let n of[e,t])n.container.classList.remove(`ec-switch-inactive`),n.container.classList.add(`ec-switching`),n.container.setAttribute(`inert`,``),n.chart.element.classList.add(`ec-morphing`);let{pairs:r,scene:i}=R(e,t),{done:a,settle:o}=Is(),s={a:e,b:t,forward:!0,pairs:r,reversed:r.map(({from:e,to:t})=>({from:t,to:e})),scene:i,focus:n,progress:0,transition:void 0,driver:void 0,run:0,done:a,settle:o};return x=s,F(s,0),s.done}function F(e,t){let r=++e.run;if(t>=1){L(e,!0);return}let i=t=>{e.progress=t,e.scene.draw(e.forward?t:1-t)},a=Ts(l);e.transition=ys(e.forward?e.pairs:e.reversed,{effect:o,surface:y,start:t,motion:c,clock:a.clock,icons:n.icons}),e.driver=ws(t,i,{clock:a.clock,motion:c}),a.release(),Promise.all([e.driver.finished,e.transition.finished]).then(([t])=>{x===e&&e.run===r&&t===`done`&&L(e,!0)})}function I(e){return e.driver?.cancel(),e.transition?.clear(),e.forward=!e.forward,b=(e.forward?e.b:e.a).name,e.settle(),{done:e.done,settle:e.settle}=Is(),F(e,1-e.progress),e.done}function L(e,t){if(x!==e)return;x=void 0,e.run++,e.driver?.cancel(),e.transition?.clear(),e.scene.clear();let n=e.forward?e.b:e.a;for(let t of[e.a,e.b])t.chart.element.classList.remove(`ec-morphing`),t.container.classList.remove(`ec-switching`),t.container.style.removeProperty(`opacity`);for(let e of f.values())Es(e.container,e===n);t&&(M(n,e.focus),N(n),P()),e.settle()}function R(e,t){let n=$a(p,e.chart.element,d),r=$a(p,t.chart.element,d),i=e.chart.marks().map(e=>Fs(e,n)),a=t.chart.marks().map(e=>Fs(e,r)),o=new Map(i.map(e=>[e.key,e])),s=new Set(a.map(e=>e.key)),c=a.flatMap(e=>{let t=o.get(e.key);return t?[{from:t,to:e}]:[]}),l=[];for(let e of i)s.has(e.key)||l.push(z(e,As));for(let e of a)o.has(e.key)||l.push(z(e,js));let u=e=>`${e.role}\n${e.key}`,f=e.chart.labels(),_=t.chart.labels(),v=new Map(f.map(e=>[u(e),e])),y=new Set;for(let e of _){let t=v.get(u(e));t&&(y.add(u(e)),l.push(Os(re(t,n),re(e,r))))}for(let e of f)y.has(u(e))||l.push(ks(re(e,n),As));for(let e of _)v.has(u(e))||l.push(ks(re(e,r),js));return l.push(n=>{Ds(e.container,1-Ms(n/.4)),Ds(t.container,Ms((n-Ss)/.5))}),{pairs:c,scene:{draw:e=>{for(let t of l)t(e)},clear:()=>{m.replaceChildren(),h.replaceChildren(),g.replaceChildren()}}}}function z(e,t){let n=Y(`g`,{class:`ec-switch-fade`,"data-key":e.key},m);return St(n,cn(on(s.slot(e.key)))),Fn(n).path(e.outline.d,e.outline.closed?{fill:`mark`}:{stroke:`mark`,width:e.thickness}),e=>X(n,{opacity:t(e)})}function re(e,t){let n=e.element.cloneNode(!0);for(let e of[`id`,`opacity`,`visibility`,`aria-hidden`])n.removeAttribute(e);n.textContent=e.text;let r=q.apply(t,e);return X(n,{x:r.x,y:r.y,"text-anchor":e.anchor}),g.appendChild(n),{text:n,at:r}}let B={get current(){return b},show(e){if(!f.has(e))return Promise.reject(TypeError(`chartSwitch: there's no view ${JSON.stringify(e)}. The views are ${i.map(e=>JSON.stringify(e)).join(`, `)}.`));if(S)return Promise.resolve();let t=ee;if(t)return new Promise(n=>t.push(()=>n(B.show(e))));let n=x;if(!n)return e===b?Promise.resolve():te(k(b),k(e));let r=n.forward?n.b:n.a,a=n.forward?n.a:n.b;return e===r.name?n.done:e===a.name?I(n):(L(n,!1),te(r,k(e),{focus:n.focus}))},chart(e){let t=f.get(e);if(!t)throw TypeError(`chartSwitch: there's no view ${JSON.stringify(e)}. The views are ${i.map(e=>JSON.stringify(e)).join(`, `)}.`);return t.chart},on(e,t){let n=Array.from(f.values(),n=>{let r=n.chart.on;if(typeof r==`function`)return r.call(n.chart,e,e=>{n.name===b&&t(e)})});return()=>{for(let e of n)e?.()}},marks:()=>k(b).chart.marks(),leave(){T=!1,S||k(b).chart.leave()},destroy(){if(S)return;S=!0;let e=x;e&&(x=void 0,e.run++,e.driver?.cancel(),e.transition?.clear(),e.scene.clear(),e.settle()),E(),O?.disconnect(),_?.destroy();let t=C;C=void 0,t?.gone();for(let e of f.values())e.chart.destroy();d.remove()}},ie=e=>x===void 0&&e.name===b;function ae(e){let t=()=>{w===e&&(w=void 0,C?.leave())};return{hover(t){ie(e)&&(w=e,C?.hover(t))},leave:t,dismiss(){ie(e)&&C?.dismiss()},shown(){},gone:t}}return Cn({targets:()=>x===void 0?k(b).port?.targets()??[]:[],hover(e,t){T=!0,x===void 0&&k(b).port?.hover(e,t)},unlink(){T=!1;for(let e of f.values())e.port?.unlink()},leave:()=>B.leave(),listen(e){if(S)return!1;C=e,w=void 0,T=!1;for(let t of f.values())t.port?.listen(e&&ae(t));return!0},parts:Array.from(f.values()).flatMap(e=>e.port?[e.port]:[])},B)}function ws(e,t,n){let r=l(e),i;return i=y({duration:950,timing:`transition`,ease:o,update:n=>{let a=Math.min(1,r+n);t(n===0?e:s(a)),a>=1&&n<1&&i?.finish()}},n),i}function Ts(e){let t=e.now();return{clock:{now:()=>t??e.now(),onFrame:t=>e.onFrame(t)},release(){t=void 0}}}function Es(e,t){e.classList.toggle(`ec-switch-inactive`,!t),e.toggleAttribute(`inert`,!t),t?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,`true`)}function Ds(e,t){e.style.setProperty(`opacity`,String(Math.round(t*1e3)/1e3))}function Os(e,t){return n=>{let r=Ns(e.at.x,t.at.x,n),i=Ns(e.at.y,t.at.y,n),a=n>=Ss;X(e.text,{x:r,y:i,visibility:a?`hidden`:void 0}),X(t.text,{x:r,y:i,visibility:a?void 0:`hidden`})}}function ks(e,t){return n=>X(e.text,{opacity:t(n)})}let As=e=>1-Ms(e/Ss),js=e=>Ms((e-Ss)/.5),Ms=e=>Math.min(1,Math.max(0,e)),Ns=(e,t,n)=>e*(1-n)+t*n,Ps=e=>e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1&&e[4]===0&&e[5]===0;function Fs(e,t){if(Ps(t))return e;let n=e=>q.apply(t,e),r=e=>ze(Le(je(e),t)),i=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*i,path:t=>n(e.path(t)),angle:n=>{let r=e.angle(n),i=Math.cos(r),a=Math.sin(r);return Math.atan2(t[1]*i+t[3]*a,t[0]*i+t[2]*a)},slice:(t,n)=>r(e.slice(t,n)),thickness:e.thickness*i,outline:{d:r(a.d),closed:a.closed,sample:e=>a.sample(e).map(n)},bounds:io(t,e.bounds),center:n(e.center),pivot:n(e.pivot),...e.segments===void 0?{}:{segments:e.segments.map(e=>Fs(e,t))}}}function Is(){let e;return{done:new Promise(t=>{e=t}),settle:e}}function Ls(e,t){if(typeof e!=`object`||!e)return!1;let n=e,r=n.element;return[`marks`,`labels`,`focus`,`leave`,`destroy`].every(e=>typeof n[e]==`function`)&&r?.nodeType===1&&t.contains(r)}function Rs(e){if(typeof e!=`object`||!e)throw TypeError(`chartSwitch needs options.`);let{views:t,initial:n,transition:r,announce:i}=e;if(typeof t!=`object`||!t)throw TypeError(`chartSwitch needs views: by name, a function that draws each view's chart in the container it's given.`);let a=Object.keys(t);if(a.length===0)throw TypeError(`chartSwitch needs at least one view.`);for(let e of a)if(typeof t[e]!=`function`)throw TypeError(`chartSwitch: views.${e} must be a function that draws the view's chart in the container it's given.`);if(typeof n!=`string`||!a.includes(n))throw TypeError(`chartSwitch: initial must be one of the views (${a.map(e=>JSON.stringify(e)).join(`, `)}), got ${typeof n==`string`?JSON.stringify(n):String(n)}.`);if(!bs(r))throw TypeError(`chartSwitch: transition must be a transition effect, such as morph().`);if(i!==void 0&&typeof i!=`boolean`)throw TypeError(`chartSwitch: announce must be true or false.`);return a}let zs=[`presentation`,`analysis`,`off`],Bs={presentation:`Presentation`,analysis:`Analysis`,off:`Off`},Vs={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.`},Hs=0;function Us(e,t,n={}){let r=Gs(e);Ks(t),qs(n);let i={...Bs,...n.labels},a={...Vs,...n.hints},{persist:o}=n,s=r.ownerDocument;pn(s);let c=`ec-motion-${++Hs}`,l=s.createElement(`div`);l.className=`ec-motion-switch`,l.setAttribute(`role`,`group`),l.setAttribute(`aria-labelledby`,`${c}-label`),l.setAttribute(`aria-describedby`,`${c}-hint`);let u=l.appendChild(s.createElement(`span`));u.className=`ec-motion-label`,u.id=`${c}-label`,u.textContent=n.label??`Motion`;let d=l.appendChild(s.createElement(`span`));d.className=`ec-motion-modes`;let f=zs.map(e=>{let n=d.appendChild(s.createElement(`button`));return n.type=`button`,n.dataset.mode=e,n.textContent=i[e],n.addEventListener(`click`,()=>t.chooseMode(e)),n}),p=l.appendChild(s.createElement(`span`));p.className=`ec-motion-hint`,p.id=`${c}-hint`,p.setAttribute(`aria-live`,`polite`);let m=()=>{let e=t.mode;for(let t of f)t.setAttribute(`aria-pressed`,String(t.dataset.mode===e));p.textContent=t.prefersReduced&&t.viewerChoice===void 0?a.reduced:a[e]};if(o!==void 0){let e=Ws(s,e=>e.getItem(o));zs.includes(e)&&t.chooseMode(e)}m(),r.appendChild(l);let h=t.subscribe(()=>{if(m(),o===void 0)return;let e=t.viewerChoice;Ws(s,t=>e===void 0?t.removeItem(o):t.setItem(o,e))}),g=!1;return{element:l,destroy(){g||(g=!0,h(),l.remove())}}}function Ws(e,t){try{let n=e.defaultView?.localStorage;return n?t(n):void 0}catch{return}}function Gs(e){if(typeof e==`string`){let t=typeof document>`u`?null:document.querySelector(e);if(!t)throw TypeError(`motionSwitch: no element matches "${e}".`);return t}if(typeof e!=`object`||!e||typeof e.appendChild!=`function`)throw TypeError(`motionSwitch needs an element or a selector to build the switch in.`);return e}function Ks(e){if(typeof e!=`object`||!e||typeof e.chooseMode!=`function`||typeof e.subscribe!=`function`)throw TypeError("motionSwitch needs a Motion, such as the page-wide `motion` or one from createMotion().")}function qs(e){let{label:t,labels:n,hints:r,persist:i}=e;if(t!==void 0&&typeof t!=`string`)throw TypeError(`motionSwitch: label must be a string, got ${typeof t}.`);for(let[e,t]of[[`labels`,n],[`hints`,r]])if(t!==void 0){for(let[n,r]of Object.entries(t))if(typeof r!=`string`)throw TypeError(`motionSwitch: ${e}.${n} must be a string, got ${typeof r}.`)}if(i!==void 0&&(typeof i!=`string`||i===``))throw TypeError(`motionSwitch: persist must be a localStorage key, got ${JSON.stringify(i)??String(i)}.`)}let Js={play:`Play`,pause:`Pause`};function Ys(e,t,n={}){let r=Xs(e);Zs(t),Qs(n);let i={...Js,...n.labels},a=r.ownerDocument;pn(a);let o=a.createElement(`button`);o.type=`button`,o.className=`ec-play`,o.addEventListener(`click`,()=>t.playing?t.pause():t.play());let s=()=>{let e=t.playing?i.pause:i.play;o.textContent!==e&&(o.textContent=e)};s(),r.appendChild(o);let c=t.subscribe(s),l=!1;return{element:o,destroy(){l||(l=!0,c(),o.remove())}}}function Xs(e){if(typeof e==`string`){let t=typeof document>`u`?null:document.querySelector(e);if(!t)throw TypeError(`playButton: no element matches "${e}".`);return t}if(typeof e!=`object`||!e||typeof e.appendChild!=`function`)throw TypeError(`playButton needs an element or a selector to build the button in.`);return e}function Zs(e){if(typeof e!=`object`||!e||typeof e.play!=`function`||typeof e.pause!=`function`||typeof e.subscribe!=`function`)throw TypeError(`playButton needs a Playback, from playback().`)}function Qs(e){let{labels:t}=e;if(t!==void 0){for(let[e,n]of Object.entries(t))if(typeof n!=`string`||n.trim()===``)throw TypeError(`playButton: labels.${e} must be a string with some text, got ${JSON.stringify(n)??String(n)}.`)}}let $s=Object.freeze({lift:0,spin:0,tilt:0});function ec(){return e=>({lift:0,spin:e.distance/e.radius,tilt:0})}function tc(e={}){let t=e.stride??42,n=e.lift??3.2,r=e.tilt??9;if(!(t>0)||!Number.isFinite(t))throw RangeError(`gaits.step: stride must be more than 0, got ${t}.`);if(!(n>=0)||!Number.isFinite(n))throw RangeError(`gaits.step: lift can't be negative, got ${n}.`);if(!Number.isFinite(r))throw RangeError(`gaits.step: tilt must be a finite number of degrees, got ${r}.`);let i=r*Math.PI/180;return Object.assign(e=>{let r=Math.max(1,Math.round(e.length/t)),a=Math.abs(Math.sin(Math.PI*(e.progress*r%1)));return{lift:a*n,spin:0,tilt:a*i*(1-.3*e.progress)}},{ease:s,pace:1.15})}function nc(){return()=>$s}let rc={roll:ec,step:tc,slide:nc},ic=[1,0,0,1,0,0],ac=[`auto`,`follow`,`level`],oc=[`center`,`on`];function sc(e,t={}){mc(e,t);function n(n,r){let i=typeof e==`string`?r.icons.get(e):e;if(!i)throw RangeError(`travel: unknown icon "${String(e)}". Register it with registerIcon(icon), or pass the icon itself.`);let a=lc(n,t.along);if(!a||!(dc(a)>=.5))return;let o=t.size===void 0?1:t.size===`fit`?.85*a.thickness/i.box.height:t.size/i.size;if(o>0)return cc(a,i,o,t)}function r(e,t){let r=n(e,t),i,a,o=0,s=()=>{r?(i&&a?.icon===r.icon&&a.size===r.size||(i?.remove(),i=t.layer.icon(r.icon,{size:r.size}),a={icon:r.icon,size:r.size}),i.place(r.transform(o))):(i?.remove(),i=a=void 0)};return t.onChange(e=>{r=n(e,t),s()}),{get trip(){return r},show(e){o=e,s()}}}return{kind:`geometry`,async run(e,t){if(t.signal.aborted)return;let n=r(e,t),i=n.trip;!i||i.span<=0?n.show(1):await t.tween({duration:i.duration,timing:`effect`,ease:i.gait.ease??c,update:e=>n.show(e)}).finished},end(e,t){r(e,t).show(1)},clear(){}}}function cc(e,t,n,r){let i=typeof r.gait==`function`?r.gait:rc[r.gait??t.gait??`slide`](),a=e.length,o=t.footprint[0]*n,s=t.footprint[1]*n,c=0,l=uc(e).map(([e,t])=>{let n={from:e,to:t,span:Math.max(0,t-e-o-s),before:c};return c+=n.span,n}),u=Math.max(2,(o+s)/2),d=t.radius??t.box.height/2,{anchor:f}=t,p={x:f.x+n*(t.pivot.x-f.x),y:f.y+n*(t.pivot.y-f.y)},m=r.ride===`on`?e.thickness/2+(t.box.y+t.box.height-f.y)*n:0,h=r.orient??`auto`;return{icon:t,size:t.size*n,span:c,duration:Math.min(4e3,Math.max(260,c/360*1e3)*(i.pace??1)),gait:i,transform(r){let s=r*c,g=l.length-1;for(;g>0&&l[g].before>s;)g--;let _=l[g],v=_.from+o+Math.min(_.span,s-_.before),y=i({distance:s/n,length:c/n,progress:r,radius:d}),b=fc(e,v),x=pc(e,Math.min(v,a),u,_),S=h===`auto`&&t.upright===!0&&Math.cos(x)<-1e-9,C=h===`level`?0:S?N(x-Math.PI):x;return q.multiply(q.translate(b.x,b.y),q.rotate(C),S?q.scale(-1,1):ic,q.translate(-f.x,-f.y-y.lift*n-m),q.rotate(y.spin-y.tilt,p))}}}function lc(e,t){return t===void 0?e:e.segments?e.segments.find(e=>e.series===t):e.series===t?e:void 0}function uc(e){let{length:t}=e,n=[],r=0;for(let[i,a]of e.gaps??[])a>i&&a>r&&(i>r&&n.push([r*t,Math.min(1,i)*t]),r=Math.min(1,a));return n.push([r*t,t]),n}function dc(e){return uc(e).reduce((e,[t,n])=>e+(n-t),0)}function fc(e,t){let{length:n}=e;return t<=n?e.path(t/n):tt(e.end,e.angle(1),t-n)}function pc(e,t,n,r){let{length:i}=e,a=Math.min(n,t-r.from,r.to-t);if(a>1e-6){let n=e.path((t-a)/i),r=e.path((t+a)/i);if(Math.hypot(r.x-n.x,r.y-n.y)>1e-9)return Math.atan2(r.y-n.y,r.x-n.x)}return e.angle(t/i)}function mc(e,t){if((typeof e!=`string`||e===``)&&(typeof e!=`object`||!e||typeof e.name!=`string`))throw TypeError(`travel needs an icon or an icon's name, got ${e===null?`null`:typeof e}.`);let{along:n,gait:r,size:i,orient:a,ride:o}=t;if(n!==void 0&&typeof n!=`string`)throw RangeError(`travel: along must be a series name, got ${String(n)}.`);if(r!==void 0&&typeof r!=`function`&&!Object.prototype.hasOwnProperty.call(rc,r))throw RangeError(`travel: gait must be a gait or one of roll, step, slide, got ${String(r)}.`);if(i!==void 0&&i!==`fit`&&!(typeof i==`number`&&i>0&&Number.isFinite(i)))throw RangeError(`travel: size must be more than 0 px, or "fit", got ${String(i)}.`);if(a!==void 0&&!ac.includes(a))throw RangeError(`travel: orient must be auto, follow or level, got ${String(a)}.`);if(o!==void 0&&!oc.includes(o))throw RangeError(`travel: ride must be center or on, got ${String(o)}.`)}let hc=.25;function gc(e={}){yc(e);let t=e.width??8,n=e.opacity??.35,{color:r}=e,i=(e,i)=>{let a=t*_c(i);e.mark.set({halo:a>0?{width:a,opacity:n,...r===void 0?{}:{color:r}}:void 0})};return{kind:`geometry`,async run(e,t){t.signal.aborted||await t.tween({duration:900,timing:`effect`,ease:o,update:e=>i(t,e)}).finished},end(){},clear(){}}}function _c(e){return!(e>0)||e>=1?0:e<hc?vc(e/hc):1-vc((e-hc)/.75)}function vc(e){if(!(e>0))return 0;if(e>=1)return 1;let t=0,n=1;for(let r=0;r<24;r++){let r=(t+n)/2;1.74*r*r*(1-r)+r*r*r<e?t=r:n=r}let r=(t+n)/2;return 3*r*r-2*r*r*r}function yc(e){let{width:t,opacity:n,color:r}=e;if(t!==void 0&&!(typeof t==`number`&&t>0&&Number.isFinite(t)))throw RangeError(`flash: width must be more than 0 px, got ${String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>0&&n<=1))throw RangeError(`flash: opacity must be more than 0 and at most 1, got ${String(n)}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`flash: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}let bc=[1,-.5,.25],xc=Math.PI/12;function Sc(e={}){Tc(e);let t=e.swing??3;return{kind:`geometry`,async run(e,n){if(n.signal.aborted)return;let r=e,i=Cc(e,t),a=0,s=()=>{let e=i*wc(a);n.mark.set({transform:e===0?void 0:q.rotate(e,r.pivot)})};n.onChange(e=>{r=e,i=Cc(e,t),s()}),await n.tween({duration:450,timing:`effect`,ease:o,update:e=>{a=e,s()}}).finished},end(){},clear(){}}}function Cc(e,t){let{pivot:n}=e,r=0;for(let t of e.outline.sample(64))r=Math.max(r,Math.hypot(t.x-n.x,t.y-n.y));return r>=.5?Math.min(xc,2*Math.asin(Math.min(1,t/(2*r)))):0}function wc(e){if(!(e>0)||e>=1)return 0;let t=e*bc.length,n=Math.floor(t);return bc[n]*Math.sin(Math.PI*(t-n))}function Tc(e){let{swing:t}=e;if(t!==void 0&&!(typeof t==`number`&&t>0&&t<=3))throw RangeError(`wiggle: swing must be more than 0 and at most 3 px, got ${String(t)}.`)}function Ec(e={}){Dc(e);let t=e.times??2,n=e.width??12,{color:r}=e,i=(e,t)=>{let i=t>0&&t<1;e.mark.set({halo:i?{width:n*c(t),opacity:.4*(1-t),...r===void 0?{}:{color:r}}:void 0})};return{kind:`geometry`,async run(e,n){let r=0;for(let e=0;e<t;e++){if(n.signal.aborted)return;let e=n.motion.duration(600,`effect`);if(r+e>=5e3)return;r+=e,await n.tween({duration:600,timing:`effect`,ease:o,update:e=>i(n,e)}).finished}},end(){},clear(){}}}function Dc(e){let{times:t,width:n,color:r}=e;if(t!==void 0&&!(Number.isInteger(t)&&t>=1&&t<=6))throw RangeError(`pulse: times must be a whole number from 1 to 6, got ${String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>0&&Number.isFinite(n)))throw RangeError(`pulse: width must be more than 0 px, got ${String(n)}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`pulse: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}let Oc=.5;function kc(e={}){Ac(e);let t=e.duration??500,n={stroke:e.color??`mark`,width:e.width??3,opacity:e.opacity??.5,linecap:`round`},r=(e,t)=>{let r=e,i=0,a,o=()=>{if(!(r.length>=Oc)){a?.remove(),a=void 0;return}let e=r.slice(0,i);a?a.update(e):a=t.layer.path(e,n)};return t.onChange(e=>{r=e,o()}),o(),e=>{i=e,o()}};return{kind:`geometry`,async run(e,n){if(n.signal.aborted)return;let i=r(e,n);e.length>=Oc?await n.tween({duration:t,timing:`effect`,ease:s,update:i}).finished:i(1)},end(e,t){r(e,t)(1)},clear(){}}}function Ac(e){let{color:t,width:n,opacity:r,duration:i}=e;if(t!==void 0&&(typeof t!=`string`||t===``))throw RangeError(`trace: color must be a theme token or a CSS colour, got ${JSON.stringify(t)??String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>=0&&Number.isFinite(n)))throw RangeError(`trace: width must be 0 px or more, got ${String(n)}.`);if(r!==void 0&&!(typeof r==`number`&&r>=0&&r<=1))throw RangeError(`trace: opacity must be from 0 to 1, got ${String(r)}.`);if(i!==void 0&&!(typeof i==`number`&&i>=0&&Number.isFinite(i)))throw RangeError(`trace: duration must be 0 ms or more, got ${String(i)}.`)}let jc=.36;function Mc(e){let t=e.labelBounds??[],n=e.nearbyLabels??[],r=e.angle(1),i=Fc(e.end,r,t);if(i===void 0&&t.length>0){let r=e.angle(.5)-Math.PI/2,i=Fc(e.center,r,t);if(i!==void 0)return Nc(e.center,r,Math.max(i,Fc(e.center,r,n)??-1/0))}return Nc(e.end,r,Math.max(10,i??-1/0,Fc(e.end,r,n)??-1/0))}function Nc(e,t,n){let r=Math.cos(t),i=Math.sin(t),a=tt(e,t,n),o=12.5*(i<0?jc*(1+i):jc+.44000000000000006*i),s=Pc(r)?`middle`:r>0?`start`:`end`;return{at:{x:a.x,y:a.y+o},anchor:s,toward:t}}function Pc(e){return Math.abs(e)<=Math.SQRT1_2+1e-9}function Fc(e,t,n){let r=Math.cos(t),i=Math.sin(t),a=Pc(r),o;for(let{x:t,y:s,width:c,height:l}of n){let n={x:t-6,y:s-6,width:c+12,height:l+12},u=Ic(e,r,i,n);u!==void 0&&a&&(u=Math.max(u,((i>0?n.y+n.height:n.y)-e.y)/i)),u!==void 0&&(o=Math.max(o??u,u))}return o}function Ic(e,t,n,r){let i=0,a=1/0;for(let[o,s,c,l]of[[e.x,t,r.x,r.x+r.width],[e.y,n,r.y,r.y+r.height]]){if(Math.abs(s)<1e-12){if(o<c||o>l)return;continue}let e=(c-o)/s,t=(l-o)/s;i=Math.max(i,Math.min(e,t)),a=Math.min(a,Math.max(e,t))}return a>=i?a:void 0}function Lc(e,t,n,r,i){let a=e,o=i(e,t)??``,s=t,c=0,l,u=()=>{if(o===``){l?.remove(),l=void 0;return}let{at:e,anchor:t,toward:i}=Mc(a),s={at:tt(e,i-Math.PI/2,-8*(1-c)),anchor:t,color:r,opacity:c};l?l.update(s,o):l=n.layer.text(o,s)};return n.onChange((e,t)=>{a=e,s=t??s,o=i(a,s)??``,u()}),u(),e=>{c=e,u()}}let Rc=e=>{let{samples:t}=e;return t[t.length-1]?.value??NaN},zc,Bc=e=>(zc??(zc=new Intl.NumberFormat(void 0,{signDisplay:`always`,maximumFractionDigits:2})),zc.format(e));function Vc(e={}){Hc(e);let t=e.value??Rc,n=e.format??Bc,r=e.color??`text`,i=e=>{if(!e.previous)return;let r=t(e),i=t(e.previous),a=r-i;if(!(!Number.isFinite(a)||Math.abs(a)<=1e-9*Math.max(Math.abs(r),Math.abs(i))))return n(a)};return{kind:`data`,run:async(e,t,n)=>{if(n.signal.aborted)return;let a=i(t);if(a===void 0||a===``)return;let o=Lc(e,t,n,r,()=>a);await n.tween({duration:400,timing:`effect`,update:o}).finished},end:(e,t,n)=>{let a=i(t);a!==void 0&&a!==``&&Lc(e,t,n,r,()=>a)(1)},clear(){}}}function Hc(e){let{value:t,format:n,color:r}=e;if(t!==void 0&&typeof t!=`function`)throw TypeError(`delta: value must be a function that reads the mark's value from its data, got ${typeof t}.`);if(n!==void 0&&typeof n!=`function`)throw TypeError(`delta: format must be a function that words the change, got ${typeof n}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`delta: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}function Uc(e,t={}){if(typeof e!=`function`)throw TypeError(`label needs a function that returns the text from the mark's data, got ${typeof e}.`);let{color:n=`text`}=t;if(typeof n!=`string`||n===``)throw RangeError(`label: color must be a theme token or a CSS colour, got ${JSON.stringify(n)??String(n)}.`);let r=(t,n)=>{let r=e(n,t);return r==null?void 0:String(r)};return{kind:`data`,run:async(e,t,i)=>{if(i.signal.aborted)return;let a=Lc(e,t,i,n,r);await i.tween({duration:400,timing:`effect`,update:a}).finished},end:(e,t,i)=>Lc(e,t,i,n,r)(1),clear(){}}}let Wc=[`below`,`above`];function Gc(e){el(e);let{compareTo:t}=e,n=e.when??`below`,r=e.color??`negative`,i=(e,i,a)=>{let o=[],s=i,c=e=>{let i=e.length>=.5?Zc(s.samples,Kc(t,s),n):[],c={stroke:r,width:e.thickness,linecap:`butt`};i.forEach(([t,n],r)=>{let i=e.slice(t,n),s=o[r];s?s.update(i,c):o.push(a.layer.path(i,c))});for(let e of o.splice(i.length))e.remove()};a.onChange((e,t)=>{s=t??s,c(e)}),c(e)};return{kind:`data`,...typeof t==`string`?{needs:Object.freeze({related:Object.freeze([t])})}:{},run:async(e,t,n)=>{n.signal.aborted||i(e,t,n)},end:(e,t,n)=>i(e,t,n),clear(){}}}function Kc(e,t){if(typeof e==`number`)return{place:e=>e.t,valueAt:()=>e,bends:[]};let n=t.related(e);if(!n)return;let r=t.samples.every(e=>Yc(e.at)!==void 0)&&n.samples.every(e=>Yc(e.at)!==void 0)?e=>Yc(e.at):e=>e.t,i=n.samples.map(e=>({u:r(e),value:e.value})).filter(e=>Number.isFinite(e.u)).sort((e,t)=>e.u-t.u),a=qc(n.samples,r);return{place:r,valueAt:e=>Jc(a,e)?void 0:Xc(i,e),bends:i.map(e=>e.u)}}function qc(e,t){let n=[];e.forEach((r,i)=>{let a=e[i-1];if(r.gapBefore!==!0||!a)return;let o=t(a),s=t(r);Number.isFinite(o)&&Number.isFinite(s)&&o!==s&&n.push([Math.min(o,s),Math.max(o,s)])}),n.sort((e,t)=>e[0]-t[0]);let r=[];for(let e of n){let t=r[r.length-1];t&&e[0]<t[1]?t[1]=Math.max(t[1],e[1]):r.push(e)}return r}function Jc(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i][0]<t?n=i+1:r=i}let i=e[n-1];return i!==void 0&&t<i[1]}function Yc(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 Xc(e,t){let n=e[0],r=e[e.length-1];if(!n||!r||t<n.u||t>r.u)return;let i=0,a=e.length-1;for(;i<a;){let n=i+a>>1;e[n].u<t?i=n+1:a=n}let o=e[i];if(i===0||o.u===t)return o.value;let s=e[i-1];return s.value+(t-s.u)/(o.u-s.u)*(o.value-s.value)}function Zc(e,t,n){if(!t)return[];let r=n===`below`?1:-1,i=(e,n,i,a=!0)=>{let o=t.valueAt(n);if(o===void 0||!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(e))return{t:e,u:n,past:void 0,joined:a};let s=r*(o-i);return{t:e,u:n,past:Math.abs(s)<=1e-9*Math.max(Math.abs(o),Math.abs(i))?0:s,joined:a}},a=[];e.forEach((n,r)=>{let o=t.place(n);a.push(i(n.t,o,n.value,n.gapBefore!==!0));let s=e[r+1];if(!s||s.gapBefore===!0)return;let c=t.place(s);if(o===c||!Number.isFinite(o)||!Number.isFinite(c))return;let l=[],{bends:u}=t;for(let e=$c(u,Math.min(o,c));e<u.length&&u[e]<Math.max(o,c);e++)l.push((u[e]-o)/(c-o));c<o&&l.reverse();for(let e of l)a.push(i(n.t+e*(s.t-n.t),o+e*(c-o),n.value+e*(s.value-n.value)))});let o=[],s=(e,t)=>{let n=Qc(e),r=Qc(t);if(!(r>n))return;let i=o[o.length-1];i&&i[1]>=n?i[1]=Math.max(i[1],r):o.push([n,r])};for(let e=1;e<a.length;e++){let n=a[e-1],r=a[e];n.past!==void 0&&r.past!==void 0&&r.joined&&r.t>n.t&&(n.u===r.u||t.valueAt((n.u+r.u)/2)!==void 0)&&(n.past>0&&r.past>0?s(n.t,r.t):n.past>0?s(n.t,n.t+(r.t-n.t)*(n.past/(n.past-r.past))):r.past>0&&s(n.t+(r.t-n.t)*(n.past/(n.past-r.past)),r.t))}return o}let Qc=e=>Math.min(1,Math.max(0,e));function $c(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i]<=t?n=i+1:r=i}return n}function el(e){let{compareTo:t,when:n,color:r}=e??{};if(!(typeof t==`string`?t!==``:typeof t==`number`&&Number.isFinite(t)))throw RangeError(`threshold: compareTo must be a finite number or a series name, got ${tl(t)}.`);if(n!==void 0&&!Wc.includes(n))throw RangeError(`threshold: when must be "below" or "above", got ${tl(n)}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`threshold: color must be a theme token or a CSS colour, got ${tl(r)}.`)}let tl=e=>typeof e==`string`?JSON.stringify(e):String(e),nl=[`unroll`,`drop`];function rl(e={}){dl(e);let t=e?.points??160,n=e?.align??`unroll`;return{kind:`transition`,async run(e,r,i){if(i.signal.aborted)return;let a=il(e,r,i.layer,t,n),c=ul(i.start);if(c>=1){a(1);return}let u=l(c),d;d=i.tween({duration:950,timing:`transition`,ease:o,update:e=>{let t=Math.min(1,u+e);a(e===0?c:s(t)),t>=1&&e<1&&d?.finish()}}),await d.finished},end(e,r,i){il(e,r,i.layer,t,n)(1)},clear(){}}}function il(e,t,n,r,i){let a=e.outline.closed;if(a!==t.outline.closed)return ol(e,t,n);let o=e.outline.sample(r),s=t.outline.sample(r);if(!a)return al(e,t,n,o,s);let[c,l]=i===`drop`?ll(e,t,r):[0,0],u;return r=>{let i=r<=0?e.outline.d:r>=1?t.outline.d:sl(o,s,c,l,r,!0);u?u.update(i):u=n.path(i,{fill:`mark`})}}function al(e,t,n,r,i){let a;return o=>{let s=o<=0?e.outline.d:o>=1?t.outline.d:sl(r,i,0,0,o,!1),c=o<=0?e.thickness:o>=1?t.thickness:cl(e.thickness,t.thickness,o);a?a.update(s,{width:c}):a=n.path(s,{stroke:`mark`,width:c})}}function ol(e,t,n){let r=(e,t)=>({...e.outline.closed?{fill:`mark`}:{stroke:`mark`,width:e.thickness},...t===void 0?{}:{opacity:t}}),i,a;return o=>{o>=1?(i?.remove(),i=void 0,a?a.update(t.outline.d,{opacity:void 0}):a=n.path(t.outline.d,r(t))):a?(i?.update(e.outline.d,{opacity:1-o}),a.update(t.outline.d,{opacity:o})):e.outline.closed?(i=n.path(e.outline.d,r(e,1-o)),a=n.path(t.outline.d,r(t,o))):(a=n.path(t.outline.d,r(t,o)),i=n.path(e.outline.d,r(e,1-o)))}}function sl(e,t,n,r,i,a){let o=e.length,s=``;for(let a=0;a<o;a++){let c=e[(a+n)%o],l=t[(a+r)%o];s+=`${a===0?`M`:`L`}${F(cl(c.x,l.x,i))},${F(cl(c.y,l.y,i))}`}return a?`${s}Z`:s}let cl=(e,t,n)=>e*(1-n)+t*n;function ll(e,t,n){let r=n/4,i=Ra(e);return i===Ra(t)?[0,0]:i?[0,r]:[r,0]}function ul(e){return typeof e==`number`&&e>0?Math.min(1,e):0}function dl(e){let{points:t,align:n}=e??{};if(t!==void 0&&!(Number.isInteger(t)&&t>=4&&t%4==0))throw RangeError(`morph: points must be a whole multiple of 4, got ${String(t)}.`);if(n!==void 0&&!nl.includes(n))throw RangeError(`morph: align must be "unroll" or "drop", got ${typeof n==`string`?JSON.stringify(n):String(n)}.`)}function fl(...e){let t=vl(`sequence`,e);return _l(t,async(e,n)=>{for(let r of t){if(n.signal.aborted)return;await e(r)}})}function pl(...e){let t=vl(`parallel`,e);return _l(t,async e=>{await Promise.all(t.map(e))})}function ml(e,t){if(typeof e!=`string`&&typeof e!=`function`)throw TypeError(`only needs a key, a series name or a predicate, got ${dt(e)}.`);let[n]=vl(`only`,[t]),r=typeof e==`string`?t=>t.key===e||t.series===e:e;if(n.kind===`data`){let e=n;return{kind:`data`,...e.needs?{needs:e.needs}:{},run:(t,n,i)=>r(t)?e.run(t,n,i):Promise.resolve(),end:(t,n,i)=>{r(t)&&e.end(t,n,i)},clear:t=>e.clear(t)}}let i=n;return{kind:`geometry`,run:(e,t)=>r(e)?i.run(e,t):Promise.resolve(),end(e,t){r(e)&&i.end(e,t)},clear:e=>i.clear(e)}}function hl(e,t={}){let[n]=vl(`stagger`,[e]),r=t.delay??50;if(!(typeof r==`number`&&r>=0&&Number.isFinite(r)))throw RangeError(`stagger: delay must be 0 ms or more, got ${String(r)}.`);let i=async(e,t,n)=>{if(n.signal.aborted)return;let{index:i,count:a}=n.batch,o=a>1?Math.min(r,500/(a-1)):0,s=i>0?i*o:0;if(!(s>0))return{mark:e,data:t};let c=gl(e,t,n);return await n.tween({duration:s,timing:`stagger`,update:()=>{}}).finished,n.signal.aborted?void 0:c()};if(n.kind===`data`){let e=n;return{kind:`data`,...e.needs?{needs:e.needs}:{},run:async(t,n,r)=>{let a=await i(t,n,r);a&&await e.run(a.mark,a.data,r)},end:(t,n,r)=>e.end(t,n,r),clear:t=>e.clear(t)}}let a=n;return{kind:`geometry`,async run(e,t){let n=await i(e,void 0,t);n&&await a.run(n.mark,t)},end:(e,t)=>a.end(e,t),clear:e=>a.clear(e)}}function gl(e,t,n){let r={mark:e,data:t};return n.onChange((e,t)=>{r={mark:e,data:t??r.data}}),()=>r}function _l(e,t){let n=(e,t,n)=>{let r=gl(e,t,n);return e=>{let{mark:t,data:i}=r();return e.kind===`data`?e.run(t,i,n):e.run(t,n)}},r=(t,n,r)=>{for(let i of e)i.kind===`data`?i.end(t,n,r):i.end(t,r)},i=t=>{let n;for(let r of e)try{r.clear(t)}catch(e){n??(n={error:e})}if(n)throw n.error};if(e.some(e=>e.kind===`data`)){let a=[...new Set(e.flatMap(e=>e.kind===`data`?e.needs?.related??[]:[]))];return{kind:`data`,...a.length>0?{needs:{related:a}}:{},run:(e,r,i)=>t(n(e,r,i),i),end:(e,t,n)=>r(e,t,n),clear:i}}return{kind:`geometry`,run:(e,r)=>t(n(e,void 0,r),r),end:(e,t)=>r(e,void 0,t),clear:i}}function vl(e,t){return t.forEach((t,n)=>{if(!ut(t))throw TypeError(`${e}: part ${n+1} needs to be a mark effect (kind "geometry" or "data"), got ${dt(t)}.`)}),[...t]}let yl=()=>{};function bl(e){Sl(`defineEffect`,e);let t={kind:`geometry`,run:e.run,end:e.end,clear:e.clear??yl};return Object.freeze(t)}function xl(e){Sl(`defineDataEffect`,e);let t=Cl(e.needs),n={kind:`data`,...t?{needs:t}:{},run:e.run,end:e.end,clear:e.clear??yl};return Object.freeze(n)}function Sl(e,t){if(typeof t!=`object`||!t)throw TypeError(`${e} needs a spec object { run, end }, got ${t===null?`null`:typeof t}.`);let{run:n,end:r,clear:i}=t;if(typeof n!=`function`)throw TypeError(`${e}: run must be a function that animates the mark, got ${typeof n}.`);if(typeof r!=`function`)throw TypeError(`${e}: end must be a function that draws the final state, got ${typeof r}. Every effect needs one: reduced motion shows only end states.`);if(i!==void 0&&typeof i!=`function`)throw TypeError(`${e}: clear must be a function if it's given, got ${typeof i}.`)}function Cl(e){if(e===void 0)return;let t=typeof e==`object`&&e?e.related:void 0;if(!(typeof e==`object`&&e&&(t===void 0||Array.isArray(t)&&t.every(e=>typeof e==`string`&&e!==``))))throw TypeError(`defineDataEffect: needs must be { related: [series names] }, got ${JSON.stringify(e)??String(e)}.`);return t===void 0?void 0:Object.freeze({related:Object.freeze([...t])})}let wl=[`roll`,`step`,`slide`],Tl=[`butt`,`round`],El=[`miter`,`round`],Dl=[`nonzero`,`evenodd`],Ol=/^\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE.,+\-\s]*$/;function kl(e){let t=e?.name;if(typeof t!=`string`||t===``)throw TypeError(`defineIcon needs a non-empty string name, got ${JSON.stringify(t)}.`);let n=(e,n)=>{throw RangeError(`defineIcon: "${t}" ${e} ${n}.`)},r=(e,t)=>typeof t==`number`&&Number.isFinite(t)?t:n(e,`must be a finite number, got ${String(t)}`),i=(e,t)=>r(e,t)>0?t:n(e,`must be more than 0, got ${String(t)}`),a=(e,t)=>t&&typeof t==`object`?jl({x:r(`${e}.x`,t.x),y:r(`${e}.y`,t.y)}):n(e,`must be a point { x, y }`);Array.isArray(e.shapes)&&e.shapes.length!==0||n(`shapes`,`must be a non-empty array`);let o=e.shapes.map((e,t)=>Al(e,`shapes[${t}]`,n,r)),s=e.box;s&&typeof s==`object`||n(`box`,`must be a rectangle { x, y, width, height }`);let c=jl({x:r(`box.x`,s.x),y:r(`box.y`,s.y),width:i(`box.width`,s.width),height:i(`box.height`,s.height)}),l=a(`anchor`,e.anchor),u=e.pivot===void 0?l:a(`pivot`,e.pivot),d=e.footprint??[Math.max(0,l.x-c.x),Math.max(0,c.x+c.width-l.x)];Array.isArray(d)&&d.length===2||n(`footprint`,`must be [behind, ahead]`),d.forEach((e,t)=>{r(`footprint[${t}]`,e)<0&&n(`footprint[${t}]`,`can't be negative, got ${e}`)});let f=e.size===void 0?c.width:i(`size`,e.size),p=e.radius===void 0?c.height/2:i(`radius`,e.radius);return e.gait!==void 0&&!wl.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)}`),jl({name:t,shapes:jl(o),box:c,size:f,anchor:l,pivot:u,footprint:jl([d[0],d[1]]),...e.gait===void 0?{}:{gait:e.gait},radius:p,...e.upright===void 0?{}:{upright:e.upright}})}function Al(e,t,n,r){e&&typeof e==`object`||n(t,`must be a shape { d, fill?, stroke?, … }`),typeof e.d==`string`&&Ol.test(e.d)||n(`${t}.d`,`must be path data starting with a move`),e.clip===void 0||typeof e.clip==`string`&&Ol.test(e.clip)||n(`${t}.clip`,`must be path data starting with a move`);for(let r of[`fill`,`stroke`]){let i=e[r];i!==void 0&&(typeof i!=`string`||i===``)&&n(`${t}.${r}`,`must be a colour, got ${String(i)}`)}e.width!==void 0&&r(`${t}.width`,e.width)<0&&n(`${t}.width`,`can't be negative, got ${e.width}`),e.linecap!==void 0&&!Tl.includes(e.linecap)&&n(`${t}.linecap`,`must be butt or round, got ${String(e.linecap)}`),e.linejoin!==void 0&&!El.includes(e.linejoin)&&n(`${t}.linejoin`,`must be miter or round, got ${String(e.linejoin)}`),e.fillRule!==void 0&&!Dl.includes(e.fillRule)&&n(`${t}.fillRule`,`must be nonzero or evenodd, got ${String(e.fillRule)}`);for(let i of[`opacity`,`fillOpacity`,`strokeOpacity`]){let a=e[i]===void 0?1:r(`${t}.${i}`,e[i]);(a<0||a>1)&&n(`${t}.${i}`,`must be from 0 to 1, got ${a}`)}let i={d:e.d};for(let t of[`fill`,`stroke`,`width`,`linecap`,`linejoin`,`clip`,`fillRule`,`opacity`,`fillOpacity`,`strokeOpacity`])e[t]!==void 0&&(i[t]=e[t]);return jl(i)}let jl=e=>Object.freeze(e),Ml=new Set([`svg`,`g`,`a`]),Nl=new Set([`path`,`circle`,`rect`,`ellipse`,`line`,`polyline`,`polygon`]),Pl=/<![^<>]*>|<(\/?)([A-Za-z][\w:.-]*)((?:\s+[^\s=/<>]+(?:\s*=\s*(?:"[^"<]*"|'[^'<]*'|[^\s"'<>]+))?)*)\s*(\/?)>/g,Fl=/([^\s=/<>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,Il=/^(?:#[0-9a-fA-F]{3,8}|[a-zA-Z][a-zA-Z0-9-]*|(?:rgba?|hsla?)\([\d\s.,%+\-/]*\))$/;function Ll(e,t){if(typeof e!=`string`)throw TypeError(`iconFromSvg needs SVG markup as a string.`);let n=typeof t?.name==`string`?`"${t.name}"`:`an icon`,r=e=>{throw RangeError(`iconFromSvg: ${n} ${e}.`)},i,a=1,o=[],s=[],c;for(let n of Rl(e).matchAll(Pl)){let[,e,l,u=``,d]=n;if(l===void 0)continue;let f=l.toLowerCase();if(e){let e=Kl(s,f);e>=0&&(s.length=e);continue}let p=zl(u),m=!i&&f===`svg`;m&&(i=Bl(p)??r(`needs a viewBox, or a width and height in px, on its <svg>`),t.size!==void 0&&(typeof t.size==`number`&&t.size>0&&Number.isFinite(t.size)||r(`size must be more than 0, got ${String(t.size)}`),a=t.size/i.width),c={fill:`#000000`,stroke:`none`,width:1,linecap:void 0,linejoin:void 0,fillRule:`nonzero`,opacity:1,fillOpacity:1,strokeOpacity:1,transform:q.scale(a)});let h=s.length>0?s[s.length-1].state:m?c:void 0,g=h&&!Ul(p)?Wl(h,p):void 0;if(g&&Nl.has(f)){let e=Gl(f,p,g);e&&o.push(e)}d||s.push({tag:f,state:Ml.has(f)?g:void 0})}i||r(`needs an <svg> element`),o.length===0&&r(`has nothing to draw: no path, circle, rect, ellipse, line, polyline or polygon with a fill or stroke`);let l={x:i.x*a,y:i.y*a,width:i.width*a,height:i.height*a},u=e=>e&&typeof e==`object`?{x:e.x*a,y:e.y*a}:e;return kl({...t,shapes:o,box:l,anchor:u(t.anchor),...t.pivot?{pivot:u(t.pivot)}:{},...Array.isArray(t.footprint)?{footprint:[t.footprint[0]*a,t.footprint[1]*a]}:{},...typeof t.radius==`number`?{radius:t.radius*a}:{}})}function Rl(e){let t=[[`<!--`,`-->`],[`<![CDATA[`,`]]>`],[`<?`,`?>`]],n=t.map(([t])=>e.indexOf(t)),r=``,i=0;for(;;){let a=-1;if(n.forEach((e,t)=>{e>=0&&(a<0||e<n[a])&&(a=t)}),a<0)return r+e.slice(i);let o=n[a],s=t[a][1];r+=e.slice(i,o);let c=e.indexOf(s,o+t[a][0].length);if(c<0)return r;i=c+s.length,n.forEach((r,a)=>{r>=0&&r<i&&(n[a]=e.indexOf(t[a][0],i))})}}function zl(e){let t=new Map;for(let[,n,r,i,a]of e.matchAll(Fl))n!==void 0&&t.set(n,r??i??a??``);for(let e of(t.get(`style`)??``).split(`;`)){let n=e.indexOf(`:`);n>0&&t.set(e.slice(0,n).trim(),e.slice(n+1).replace(/!important/i,``).trim())}return t}function Bl(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=Vl(e.get(`width`)),r=Vl(e.get(`height`));return n!==void 0&&r!==void 0?{x:0,y:0,width:n,height:r}:void 0}function Vl(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)\s*(?:px\s*)?$/i.exec(e??``),n=t?Number(t[1]):NaN;return n>0&&Number.isFinite(n)?n:void 0}function Hl(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(%?)\s*$/i.exec(e??``);return t?Math.min(1,Math.max(0,Number(t[1])/(t[2]?100:1))):void 0}function Ul(e){return e.get(`display`)?.trim()===`none`||e.get(`visibility`)?.trim()===`hidden`}function Wl(e,t){let n=(e,n)=>{let r=t.get(e)?.trim();if(r===void 0||!Il.test(r))return n;let i=r.toLowerCase();return i===`inherit`?n:i===`currentcolor`?`text`:i===`none`?i:r},r=Number.parseFloat(t.get(`stroke-width`)??``),i=t.get(`stroke-linecap`)?.trim(),a=t.get(`stroke-linejoin`)?.trim(),o=t.get(`fill-rule`)?.trim().toLowerCase(),s=t.get(`transform`);return{fill:n(`fill`,e.fill),stroke:n(`stroke`,e.stroke),width:r>=0?r:e.width,linecap:i===`butt`||i===`round`?i:e.linecap,linejoin:a===`miter`||a===`round`?a:e.linejoin,fillRule:o===`nonzero`||o===`evenodd`?o:e.fillRule,opacity:e.opacity*(Hl(t.get(`opacity`))??1),fillOpacity:Hl(t.get(`fill-opacity`))??e.fillOpacity,strokeOpacity:Hl(t.get(`stroke-opacity`))??e.strokeOpacity,transform:s?q.multiply(e.transform,et(s)):e.transform}}function Gl(e,t,n){let r=ql(n.fillOpacity),i=ql(n.strokeOpacity),a=n.fill===`none`||!(r>0)?void 0:n.fill,o=n.stroke===`none`||!(n.width>0)||!(i>0)?void 0:n.stroke,s=ql(n.opacity);if(a===void 0&&o===void 0||!(s>0))return;let c=Pe(e,e=>t.get(e));if(!c.some(e=>e.op!==`M`))return;let l=n.transform;return{d:ze(Le(c,l)),...a===void 0?{}:{fill:a,...n.fillRule===`evenodd`?{fillRule:n.fillRule}:{},...r<1?{fillOpacity:r}:{}},...o===void 0?{}:{stroke:o,width:ql(n.width*Math.sqrt(Math.abs(l[0]*l[3]-l[1]*l[2]))),...n.linecap?{linecap:n.linecap}:{},...n.linejoin?{linejoin:n.linejoin}:{},...i<1?{strokeOpacity:i}:{}},...s<1?{opacity:s}:{}}}function Kl(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].tag===t)return n;return-1}let ql=e=>Math.round(e*1e3)/1e3,Jl=Object.freeze({dot:kl({name:`dot`,shapes:[{d:`M4,0A4,4 0 0 1 -4,0A4,4 0 0 1 4,0Z`,fill:`surface`,stroke:`text`,width:1.5}],box:{x:-5,y:-5,width:10,height:10},anchor:{x:0,y:0}}),arrow:kl({name:`arrow`,shapes:[{d:`M-7,-1.5L1,-1.5L1,-5L7,0L1,5L1,1.5L-7,1.5Z`,fill:`text`,stroke:`surface`,width:1.5,linejoin:`round`}],box:{x:-8,y:-6,width:16,height:12},anchor:{x:0,y:0}}),chevron:kl({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}})}),Yl=st({kind:`preset`,entries:{flash:()=>gc(),wiggle:()=>Sc(),pulse:()=>Ec()},hint:`Register custom presets with registerPreset(name, factory).`}),Xl=st({kind:`icon`,entries:Jl,hint:`Register icons with registerIcon(icon) or registerIcons(icons).`});function Zl(e,t){if(typeof t!=`function`)throw TypeError(`registerPreset("${e}") needs a function that returns an effect.`);Yl.register(e,t)}function Ql(e){if(typeof e!=`object`||!e||typeof e.name!=`string`)throw TypeError(`registerIcon needs an icon with a name.`);Xl.register(e.name,e)}function $l(e){for(let t of e)Ql(t)}function eu(e){if(typeof e!=`object`||!e)throw TypeError(`configure needs an options object.`);if(`nonce`in e){if(e.nonce!==void 0&&(typeof e.nonce!=`string`||e.nonce===``))throw TypeError(`configure: nonce must be a non-empty string.`);fn.nonce=e.nonce}if(`injectStyles`in e){if(e.injectStyles!==void 0&&typeof e.injectStyles!=`boolean`)throw TypeError(`configure: injectStyles must be true or false.`);fn.injectStyles=e.injectStyles}}let tu={presets:Yl,icons:Xl,motion:v};function nu(e,t){return jr(e,t,tu)}function ru(e,t){return ci(e,t,tu)}function iu(e,t){return ba(e,t,tu)}function au(e,t){return Cs(e,typeof t==`object`&&t&&t.transition===void 0?{...t,transition:rl()}:t,tu)}function ou(e,t){return Po(e,t,tu)}function su(e,t){return es(e,t,tu)}function cu(e,t=v,n){return Us(e,t,n)}return e.VERSION=`0.5.0`,e.animated=C,e.barChart=nu,e.chartSwitch=au,e.colorAssignment=mn,e.configure=eu,e.createClock=n,e.createMotion=p,e.defaultClock=a,e.defaultScaling=u,e.defineDataEffect=xl,e.defineEffect=bl,e.defineIcon=kl,e.delta=Vc,e.describe=Ge,e.donutChart=ru,e.easeInOutCubic=s,e.easeOutCubic=c,e.expressive=ou,e.flash=gc,e.fromVegaView=su,e.gaits=rc,e.iconFromSvg=Ll,e.icons=Jl,e.interpolateNumber=b,e.interpolatePoint=x,e.interpolateRecord=S,e.label=Uc,e.lineChart=iu,e.linear=o,e.link=Tn,e.manualClock=r,e.matrix=q,e.mediaReducedMotion=h,e.morph=rl,e.motion=v,e.motionSwitch=cu,e.offset=tt,e.only=ml,e.parallel=pl,e.playButton=Ys,e.playback=w,e.pulse=Ec,e.registerIcon=Ql,e.registerIcons=$l,e.registerPreset=Zl,e.samplesAlong=rt,e.scaleDuration=m,e.sequence=fl,e.stagger=hl,e.threshold=Gc,e.trace=kc,e.travel=sc,e.tween=y,e.wiggle=Sc,e})({});
98
97
  //# sourceMappingURL=expressive-charts.global.js.map